commit d7a6de771c10b87f1f96bc4aaec0d73db9eba5fb Author: IrvingGao <1729854488@qq.com> Date: Sat May 18 15:50:56 2024 +0800 first commit for takway.ai diff --git a/.github/ISSUE_TEMPLATE/ask_questions.md b/.github/ISSUE_TEMPLATE/ask_questions.md new file mode 100644 index 0000000..4716faa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ask_questions.md @@ -0,0 +1,38 @@ +--- +name: ❓ Questions/Help +about: If you have questions, please first search existing issues and docs +labels: 'question, needs triage' +--- + +Notice: In order to resolve issues more efficiently, please raise issue following the template. +(注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节) + +## ❓ Questions and Help + + +### Before asking: +1. search the issues. +2. search the docs. + + + +#### What is your question? + +#### Code + + + +#### What have you tried? + +#### What's your environment? + + - OS (e.g., Linux): + - FunASR Version (e.g., 1.0.0): + - ModelScope Version (e.g., 1.11.0): + - PyTorch Version (e.g., 2.0.0): + - How you installed funasr (`pip`, source): + - Python version: + - GPU (e.g., V100M32) + - CUDA/cuDNN version (e.g., cuda11.7): + - Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1) + - Any other relevant information: \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..80b0317 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,47 @@ +--- +name: 🐛 Bug Report +about: Submit a bug report to help us improve +labels: 'bug, needs triage' +--- + +Notice: In order to resolve issues more efficiently, please raise issue following the template. +(注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节) + +## 🐛 Bug + + + +### To Reproduce + +Steps to reproduce the behavior (**always include the command you ran**): + +1. Run cmd '....' +2. See error + + + + +#### Code sample + + +### Expected behavior + + + +### Environment + + - OS (e.g., Linux): + - FunASR Version (e.g., 1.0.0): + - ModelScope Version (e.g., 1.11.0): + - PyTorch Version (e.g., 2.0.0): + - How you installed funasr (`pip`, source): + - Python version: + - GPU (e.g., V100M32) + - CUDA/cuDNN version (e.g., cuda11.7): + - Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1) + - Any other relevant information: + +### Additional context + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 0000000..ec4bb38 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1 @@ +blank_issues_enabled: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/error_docs.md b/.github/ISSUE_TEMPLATE/error_docs.md new file mode 100644 index 0000000..ee731c1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/error_docs.md @@ -0,0 +1,15 @@ +--- +name: 📚 Documentation/Typos +about: Report an issue related to documentation or a typo +labels: 'documentation, needs triage' +--- + +## 📚 Documentation + +For typos and doc fixes, please go ahead and: + +1. Create an issue. +2. Fix the typo. +3. Submit a PR. + +Thanks! \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d0c684a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/psf/black + rev: 24.4.0 + hooks: + - id: black + args: ['--line-length=100'] # 示例参数,black默认使用4个空格缩进 diff --git a/Acknowledge.md b/Acknowledge.md new file mode 100644 index 0000000..f49d66a --- /dev/null +++ b/Acknowledge.md @@ -0,0 +1,10 @@ +## Acknowledge + +1. We borrowed a lot of code from [Kaldi](http://kaldi-asr.org/) for data preparation. +2. We borrowed a lot of code from [ESPnet](https://github.com/espnet/espnet). FunASR follows up the training and finetuning pipelines of ESPnet. +3. We referred [Wenet](https://github.com/wenet-e2e/wenet) for building dataloader for large scale data training. +4. We acknowledge [ChinaTelecom](https://github.com/zhuzizyf/damo-fsmn-vad-infer-httpserver) for contributing the VAD runtime. +5. We acknowledge [RapidAI](https://github.com/RapidAI) for contributing the Paraformer and CT_Transformer-punc runtime. +6. We acknowledge [AiHealthx](http://www.aihealthx.com/) for contributing the websocket service and html5. +7. We acknowledge [XVERSE](http://www.xverse.cn/index.html) for contributing the grpc service. +8. We acknowledge [blt](https://github.com/bltcn) for develop and deploy website. \ No newline at end of file diff --git a/MODEL_LICENSE b/MODEL_LICENSE new file mode 100644 index 0000000..09ee9eb --- /dev/null +++ b/MODEL_LICENSE @@ -0,0 +1,74 @@ +FunASR Model Open Source License +Version 1.0 + +Copyright (C) [2023-2028] Alibaba Group. All rights reserved. + +Thank you for choosing the FunASR open source models. The FunASR open source models contain a series of open-source models that allow everyone to use, modify, share, and learn from it. + +To ensure better community collaboration, we have developed the following agreement and hope that you carefully read and abide by it. + +1 Definitions +In this agreement, [FunASR software] refers to the FunASR open source model, and its derivatives, including fine-tuned models. [You] refer to individuals or organizations who use, modify, share, and learn from [FunASR software]. + +2 License and Restrictions + +2.1 License +You are free to use, copy, modify, and share [FunASR software] under the conditions of this agreement. + +2.2 Restrictions +You should indicate the code and model source and author information when using, copying, modifying and sharing [FunASR software]. You should keep the relevant names of models in [FunASR software]. + +3 Responsibility and Risk +[FunASR software] is for reference and learning purposes only and is not responsible for any direct or indirect losses caused by your use or modification of [FunASR software]. You should take responsibility and risks for your use and modification of [FunASR software]. + +4 Termination +If you violate any terms of this agreement, your license will be automatically terminated, and you must stop using, copying, modifying, and sharing [FunASR software]. + +5 Revision +This agreement may be updated and revised from time to time. The revised agreement will be published in the FunASR official repository and automatically take effect. If you continue to use, copy, modify, and share [FunASR software], it means you agree to the revised agreement. + +6 Other Provisions +This agreement is subject to the laws of [Country/Region]. If any provisions are found to be illegal, invalid, or unenforceable, they shall be deemed deleted from this agreement, and the remaining provisions shall remain valid and binding. + +If you have any questions or comments about this agreement, please contact us. + +Copyright (c) [2023-2028] Alibaba Group. All rights reserved. + +FunASR 模型开源协议 + +版本号:1.0 + +版权所有 (C) [2023-2028] [阿里巴巴集团]。保留所有权利。 + +感谢您选择 FunASR 开源模型。FunASR 开源模型包含一系列免费且开源的工业模型,让大家可以使用、修改、分享和学习该模型。 + +为了保证更好的社区合作,我们制定了以下协议,希望您仔细阅读并遵守本协议。 + +1 定义 +本协议中,[FunASR 软件]指 FunASR 开源模型权重及其衍生品,包括 Finetune 后的模型;[您]指使用、修改、分享和学习[FunASR 软件]的个人或组织。 + +2 许可和限制 +2.1 许可 + +您可以在遵守本协议的前提下,自由地使用、复制、修改和分享[FunASR 软件]。 + +2.2 限制 + +您在使用、复制、修改和分享[FunASR 软件]时,必须注明出处以及作者信息,并保留[FunASR 软件]中相关模型名称。 + +3 责任和风险承担 +[FunASR 软件]仅作为参考和学习使用,不对您使用或修改[FunASR 软件]造成的任何直接或间接损失承担任何责任。您对[FunASR 软件]的使用和修改应该自行承担风险。 + +4 终止 +如果您违反本协议的任何条款,您的许可将自动终止,您必须停止使用、复制、修改和分享[FunASR 软件]。 + +5 修订 +本协议可能会不时更新和修订。修订后的协议将在[FunASR 软件]官方仓库发布,并自动生效。如果您继续使用、复制、修改和分享[FunASR 软件],即表示您同意修订后的协议。 + +6 其他规定 +本协议受到[国家/地区] 的法律管辖。如果任何条款被裁定为不合法、无效或无法执行,则该条款应被视为从本协议中删除,而其余条款应继续有效并具有约束力。 + +如果您对本协议有任何问题或意见,请联系我们。 + +版权所有© [2023-2028] [阿里巴巴集团]。保留所有权利。 + diff --git a/README.md b/README.md new file mode 100644 index 0000000..d3762c8 --- /dev/null +++ b/README.md @@ -0,0 +1,307 @@ +[//]: # (
) + +([简体中文](./README_zh.md)|English) + +# FunASR: A Fundamental End-to-End Speech Recognition Toolkit + + +[![PyPI](https://img.shields.io/pypi/v/funasr)](https://pypi.org/project/funasr/) + + +FunASR hopes to build a bridge between academic research and industrial applications on speech recognition. By supporting the training & finetuning of the industrial-grade speech recognition model, researchers and developers can conduct research and production of speech recognition models more conveniently, and promote the development of speech recognition ecology. ASR for Fun! + +[**Highlights**](#highlights) +| [**News**](https://github.com/alibaba-damo-academy/FunASR#whats-new) +| [**Installation**](#installation) +| [**Quick Start**](#quick-start) +| [**Tutorial**](https://github.com/alibaba-damo-academy/FunASR/blob/main/docs/tutorial/README.md) +| [**Runtime**](./runtime/readme.md) +| [**Model Zoo**](#model-zoo) +| [**Contact**](#contact) + + + +## Highlights +- FunASR is a fundamental speech recognition toolkit that offers a variety of features, including speech recognition (ASR), Voice Activity Detection (VAD), Punctuation Restoration, Language Models, Speaker Verification, Speaker Diarization and multi-talker ASR. FunASR provides convenient scripts and tutorials, supporting inference and fine-tuning of pre-trained models. +- We have released a vast collection of academic and industrial pretrained models on the [ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition) and [huggingface](https://huggingface.co/FunASR), which can be accessed through our [Model Zoo](https://github.com/alibaba-damo-academy/FunASR/blob/main/docs/model_zoo/modelscope_models.md). The representative [Paraformer-large](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary), a non-autoregressive end-to-end speech recognition model, has the advantages of high accuracy, high efficiency, and convenient deployment, supporting the rapid construction of speech recognition services. For more details on service deployment, please refer to the [service deployment document](runtime/readme_cn.md). + + + +## What's new: +- 2024/05/15:emotion recognition models are new supported. [emotion2vec+large](https://modelscope.cn/models/iic/emotion2vec_plus_large/summary),[emotion2vec+base](https://modelscope.cn/models/iic/emotion2vec_plus_base/summary),[emotion2vec+seed](https://modelscope.cn/models/iic/emotion2vec_plus_seed/summary). currently supports the following categories: 0: angry 1: happy 2: neutral 3: sad 4: unknown. +- 2024/05/15: Offline File Transcription Service 4.5, Offline File Transcription Service of English 1.6,Real-time Transcription Service 1.10 released,adapting to FunASR 1.0 model structure;([docs](runtime/readme.md)) +- 2024/03/05:Added the Qwen-Audio and Qwen-Audio-Chat large-scale audio-text multimodal models, which have topped multiple audio domain leaderboards. These models support speech dialogue, [usage](examples/industrial_data_pretraining/qwen_audio). +- 2024/03/05:Added support for the Whisper-large-v3 model, a multitasking model that can perform multilingual speech recognition, speech translation, and language identification. It can be downloaded from the[modelscope](examples/industrial_data_pretraining/whisper/demo.py), and [openai](examples/industrial_data_pretraining/whisper/demo_from_openai.py). +- 2024/03/05: Offline File Transcription Service 4.4, Offline File Transcription Service of English 1.5,Real-time Transcription Service 1.9 released,docker image supports ARM64 platform, update modelscope;([docs](runtime/readme.md)) +- 2024/01/30:funasr-1.0 has been released ([docs](https://github.com/alibaba-damo-academy/FunASR/discussions/1319)) +- 2024/01/30:emotion recognition models are new supported. [model link](https://www.modelscope.cn/models/iic/emotion2vec_base_finetuned/summary), modified from [repo](https://github.com/ddlBoJack/emotion2vec). +- 2024/01/25: Offline File Transcription Service 4.2, Offline File Transcription Service of English 1.3 released,optimized the VAD (Voice Activity Detection) data processing method, significantly reducing peak memory usage, memory leak optimization; Real-time Transcription Service 1.7 released,optimizatized the client-side;([docs](runtime/readme.md)) +- 2024/01/09: The Funasr SDK for Windows version 2.0 has been released, featuring support for The offline file transcription service (CPU) of Mandarin 4.1, The offline file transcription service (CPU) of English 1.2, The real-time transcription service (CPU) of Mandarin 1.6. For more details, please refer to the official documentation or release notes([FunASR-Runtime-Windows](https://www.modelscope.cn/models/damo/funasr-runtime-win-cpu-x64/summary)) +- 2024/01/03: File Transcription Service 4.0 released, Added support for 8k models, optimized timestamp mismatch issues and added sentence-level timestamps, improved the effectiveness of English word FST hotwords, supported automated configuration of thread parameters, and fixed known crash issues as well as memory leak problems, refer to ([docs](runtime/readme.md#file-transcription-service-mandarin-cpu)). +- 2024/01/03: Real-time Transcription Service 1.6 released,The 2pass-offline mode supports Ngram language model decoding and WFST hotwords, while also addressing known crash issues and memory leak problems, ([docs](runtime/readme.md#the-real-time-transcription-service-mandarin-cpu)) +- 2024/01/03: Fixed known crash issues as well as memory leak problems, ([docs](runtime/readme.md#file-transcription-service-english-cpu)). +- 2023/12/04: The Funasr SDK for Windows version 1.0 has been released, featuring support for The offline file transcription service (CPU) of Mandarin, The offline file transcription service (CPU) of English, The real-time transcription service (CPU) of Mandarin. For more details, please refer to the official documentation or release notes([FunASR-Runtime-Windows](https://www.modelscope.cn/models/damo/funasr-runtime-win-cpu-x64/summary)) +- 2023/11/08: The offline file transcription service 3.0 (CPU) of Mandarin has been released, adding punctuation large model, Ngram language model, and wfst hot words. For detailed information, please refer to [docs](runtime#file-transcription-service-mandarin-cpu). +- 2023/10/17: The offline file transcription service (CPU) of English has been released. For more details, please refer to ([docs](runtime#file-transcription-service-english-cpu)). +- 2023/10/13: [SlideSpeech](https://slidespeech.github.io/): A large scale multi-modal audio-visual corpus with a significant amount of real-time synchronized slides. +- 2023/10/10: The ASR-SpeakersDiarization combined pipeline [Paraformer-VAD-SPK](https://github.com/alibaba-damo-academy/FunASR/blob/main/egs_modelscope/asr_vad_spk/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/demo.py) is now released. Experience the model to get recognition results with speaker information. +- 2023/10/07: [FunCodec](https://github.com/alibaba-damo-academy/FunCodec): A Fundamental, Reproducible and Integrable Open-source Toolkit for Neural Speech Codec. +- 2023/09/01: The offline file transcription service 2.0 (CPU) of Mandarin has been released, with added support for ffmpeg, timestamp, and hotword models. For more details, please refer to ([docs](runtime#file-transcription-service-mandarin-cpu)). +- 2023/08/07: The real-time transcription service (CPU) of Mandarin has been released. For more details, please refer to ([docs](runtime#the-real-time-transcription-service-mandarin-cpu)). +- 2023/07/17: BAT is released, which is a low-latency and low-memory-consumption RNN-T model. For more details, please refer to ([BAT](egs/aishell/bat)). +- 2023/06/26: ASRU2023 Multi-Channel Multi-Party Meeting Transcription Challenge 2.0 completed the competition and announced the results. For more details, please refer to ([M2MeT2.0](https://alibaba-damo-academy.github.io/FunASR/m2met2/index.html)). + + + +## Installation + +install from source code +``` sh +git clone http://43.132.157.186:3000/gaohz/FunASR.git && cd FunASR +pip3 install -v -e . +``` +Install modelscope for the pretrained models (Optional) + +```shell +pip3 install -U modelscope +``` + +## Model Zoo +FunASR has open-sourced a large number of pre-trained models on industrial data. You are free to use, copy, modify, and share FunASR models under the [Model License Agreement](./MODEL_LICENSE). Below are some representative models, for more models please refer to the [Model Zoo](./model_zoo). + +(Note: ⭐ represents the ModelScope model zoo, 🤗 represents the Huggingface model zoo, 🍀 represents the OpenAI model zoo) + + +| Model Name | Task Details | Training Data | Parameters | +|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------:|:--------------------------------:|:----------:| +| paraformer-zh
([⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) [🤗](https://huggingface.co/funasr/paraformer-tp) ) | speech recognition, with timestamps, non-streaming | 60000 hours, Mandarin | 220M | +| paraformer-zh-streaming
( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗](https://huggingface.co/funasr/paraformer-zh-streaming) )
| speech recognition, streaming | 60000 hours, Mandarin | 220M | +| paraformer-en
( [⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) [🤗](https://huggingface.co/funasr/paraformer-en) ) | speech recognition, without timestamps, non-streaming | 50000 hours, English | 220M | +| conformer-en
( [⭐](https://modelscope.cn/models/damo/speech_conformer_asr-en-16k-vocab4199-pytorch/summary) [🤗](https://huggingface.co/funasr/conformer-en) ) | speech recognition, non-streaming | 50000 hours, English | 220M | +| ct-punc
( [⭐](https://modelscope.cn/models/damo/punc_ct-transformer_cn-en-common-vocab471067-large/summary) [🤗](https://huggingface.co/funasr/ct-punc) ) | punctuation restoration | 100M, Mandarin and English | 1.1G | +| fsmn-vad
( [⭐](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary) [🤗](https://huggingface.co/funasr/fsmn-vad) ) | voice activity detection | 5000 hours, Mandarin and English | 0.4M | +| fa-zh
( [⭐](https://modelscope.cn/models/damo/speech_timestamp_prediction-v1-16k-offline/summary) [🤗](https://huggingface.co/funasr/fa-zh) ) | timestamp prediction | 5000 hours, Mandarin | 38M | +| cam++
( [⭐](https://modelscope.cn/models/iic/speech_campplus_sv_zh-cn_16k-common/summary) [🤗](https://huggingface.co/funasr/campplus) ) | speaker verification/diarization | 5000 hours | 7.2M | +| Whisper-large-v2
([⭐](https://www.modelscope.cn/models/iic/speech_whisper-large_asr_multilingual/summary) [🍀](https://github.com/openai/whisper) ) | speech recognition, with timestamps, non-streaming | multilingual | 1550 M | +| Whisper-large-v3
([⭐](https://www.modelscope.cn/models/iic/Whisper-large-v3/summary) [🍀](https://github.com/openai/whisper) ) | speech recognition, with timestamps, non-streaming | multilingual | 1550 M | +| Qwen-Audio
([⭐](examples/industrial_data_pretraining/qwen_audio/demo.py) [🤗](https://huggingface.co/Qwen/Qwen-Audio) ) | audio-text multimodal models (pretraining) | multilingual | 8B | +| Qwen-Audio-Chat
([⭐](examples/industrial_data_pretraining/qwen_audio/demo_chat.py) [🤗](https://huggingface.co/Qwen/Qwen-Audio-Chat) ) | audio-text multimodal models (chat) | multilingual | 8B | +| emotion2vec+large
([⭐](https://modelscope.cn/models/iic/emotion2vec_plus_large/summary) [🤗](https://huggingface.co/emotion2vec/emotion2vec_plus_large) ) | speech emotion recongintion | 40000 hours | 300M | + + + + +[//]: # () +[//]: # (FunASR supports pre-trained or further fine-tuned models for deployment as a service. The CPU version of the Chinese offline file conversion service has been released, details can be found in [docs](funasr/runtime/docs/SDK_tutorial.md). More detailed information about service deployment can be found in the [deployment roadmap](funasr/runtime/readme_cn.md).) + + + +## Quick Start + +Below is a quick start tutorial. Test audio files ([Mandarin](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav), [English](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav)). + +### Command-line usage + +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +Notes: Support recognition of single audio file, as well as file list in Kaldi-style wav.scp format: `wav_id wav_pat` + +### Speech Recognition (Non-streaming) +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", vad_model="fsmn-vad", punc_model="ct-punc", + # spk_model="cam++", + ) +res = model.generate(input=f"{model.model_path}/example/asr_example.wav", + batch_size_s=300, + hotword='魔搭') +print(res) +``` +Note: `hub`: represents the model repository, `ms` stands for selecting ModelScope download, `hf` stands for selecting Huggingface download. + +### Speech Recognition (Streaming) +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` +Note: `chunk_size` is the configuration for streaming latency.` [0,10,5]` indicates that the real-time display granularity is `10*60=600ms`, and the lookahead information is `5*60=300ms`. Each inference input is `600ms` (sample points are `16000*0.6=960`), and the output is the corresponding text. For the last speech segment input, `is_final=True` needs to be set to force the output of the last word. + +### Voice Activity Detection (Non-Streaming) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +Note: The output format of the VAD model is: `[[beg1, end1], [beg2, end2], ..., [begN, endN]]`, where `begN/endN` indicates the starting/ending point of the `N-th` valid audio segment, measured in milliseconds. + +### Voice Activity Detection (Streaming) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +Note: The output format for the streaming VAD model can be one of four scenarios: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:The same as the offline VAD output result mentioned above. +- `[[beg, -1]]`:Indicates that only a starting point has been detected. +- `[[-1, end]]`:Indicates that only an ending point has been detected. +- `[]`:Indicates that neither a starting point nor an ending point has been detected. + +The output is measured in milliseconds and represents the absolute time from the starting point. +### Punctuation Restoration +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` +### Timestamp Prediction +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` +More usages ref to [docs](docs/tutorial/README_zh.md), +more examples ref to [demo](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining) + + +## Export ONNX + +### Command-line usage +```shell +funasr-export ++model=paraformer ++quantize=false ++device=cpu +``` + +### Python +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer", device="cpu") + +res = model.export(quantize=False) +``` + +### Test ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +More examples ref to [demo](runtime/python/onnxruntime) + +## Deployment Service +FunASR supports deploying pre-trained or further fine-tuned models for service. Currently, it supports the following types of service deployment: +- File transcription service, Mandarin, CPU version, done +- The real-time transcription service, Mandarin (CPU), done +- File transcription service, English, CPU version, done +- File transcription service, Mandarin, GPU version, in progress +- and more. + +For more detailed information, please refer to the [service deployment documentation](runtime/readme.md). + + + +## Community Communication +If you encounter problems in use, you can directly raise Issues on the github page. + +You can also scan the following DingTalk group or WeChat group QR code to join the community group for communication and discussion. + +| DingTalk group | WeChat group | +|:-------------------------------------------------------------------:|:-----------------------------------------------------:| +|
|
| + +## Contributors + +|
|
|
|
| | | +|:------------------------------------------------------------------:|:---------------------------------------------------------------:|:--------------------------------------------------------------:|:-------------------------------------------------------:|:-----------------------------------------------------------:|:------------------------------------------------------:| + +The contributors can be found in [contributors list](./Acknowledge.md) + +## License +This project is licensed under [The MIT License](https://opensource.org/licenses/MIT). FunASR also contains various third-party components and some code modified from other repos under other open source licenses. +The use of pretraining model is subject to [model license](./MODEL_LICENSE) + + +## Citations +``` bibtex +@inproceedings{gao2023funasr, + author={Zhifu Gao and Zerui Li and Jiaming Wang and Haoneng Luo and Xian Shi and Mengzhe Chen and Yabin Li and Lingyun Zuo and Zhihao Du and Zhangyu Xiao and Shiliang Zhang}, + title={FunASR: A Fundamental End-to-End Speech Recognition Toolkit}, + year={2023}, + booktitle={INTERSPEECH}, +} +@inproceedings{An2023bat, + author={Keyu An and Xian Shi and Shiliang Zhang}, + title={BAT: Boundary aware transducer for memory-efficient and low-latency ASR}, + year={2023}, + booktitle={INTERSPEECH}, +} +@inproceedings{gao22b_interspeech, + author={Zhifu Gao and ShiLiang Zhang and Ian McLoughlin and Zhijie Yan}, + title={Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition}, + year=2022, + booktitle={Proc. Interspeech 2022}, + pages={2063--2067}, + doi={10.21437/Interspeech.2022-9996} +} +@inproceedings{shi2023seaco, + author={Xian Shi and Yexin Yang and Zerui Li and Yanni Chen and Zhifu Gao and Shiliang Zhang}, + title={SeACo-Paraformer: A Non-Autoregressive ASR System with Flexible and Effective Hotword Customization Ability}, + year={2023}, + booktitle={ICASSP2024} +} +``` diff --git a/README_zh.md b/README_zh.md new file mode 100644 index 0000000..d3c9ff6 --- /dev/null +++ b/README_zh.md @@ -0,0 +1,310 @@ +[//]: # (
) + +(简体中文|[English](./README.md)) + +# FunASR: A Fundamental End-to-End Speech Recognition Toolkit + +[![PyPI](https://img.shields.io/pypi/v/funasr)](https://pypi.org/project/funasr/) + + +FunASR希望在语音识别的学术研究和工业应用之间架起一座桥梁。通过发布工业级语音识别模型的训练和微调,研究人员和开发人员可以更方便地进行语音识别模型的研究和生产,并推动语音识别生态的发展。让语音识别更有趣! + +
+

+ 核心功能 +| 最新动态 +| 安装 +| 快速开始 +| 教程文档 +| 模型仓库 +| 服务部署 +| 联系我们 +

+
+ + +## 核心功能 +- FunASR是一个基础语音识别工具包,提供多种功能,包括语音识别(ASR)、语音端点检测(VAD)、标点恢复、语言模型、说话人验证、说话人分离和多人对话语音识别等。FunASR提供了便捷的脚本和教程,支持预训练好的模型的推理与微调。 +- 我们在[ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition)与[huggingface](https://huggingface.co/FunASR)上发布了大量开源数据集或者海量工业数据训练的模型,可以通过我们的[模型仓库](https://github.com/alibaba-damo-academy/FunASR/blob/main/docs/model_zoo/modelscope_models.md)了解模型的详细信息。代表性的[Paraformer](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary)非自回归端到端语音识别模型具有高精度、高效率、便捷部署的优点,支持快速构建语音识别服务,详细信息可以阅读([服务部署文档](runtime/readme_cn.md))。 + + +## 最新动态 +- 2024/05/15:新增加情感识别模型,[emotion2vec+large](https://modelscope.cn/models/iic/emotion2vec_plus_large/summary),[emotion2vec+base](https://modelscope.cn/models/iic/emotion2vec_plus_base/summary),[emotion2vec+seed](https://modelscope.cn/models/iic/emotion2vec_plus_seed/summary),输出情感类别为:生气/angry,开心/happy,中立/neutral,难过/sad。 +- 2024/05/15: 中文离线文件转写服务 4.5、英文离线文件转写服务 1.6、中文实时语音听写服务 1.10 发布,适配FunASR 1.0模型结构;详细信息参阅([部署文档](runtime/readme_cn.md)) +- 2024/03/05:新增加Qwen-Audio与Qwen-Audio-Chat音频文本模态大模型,在多个音频领域测试榜单刷榜,中支持语音对话,详细用法见 [示例](examples/industrial_data_pretraining/qwen_audio)。 +- 2024/03/05:新增加Whisper-large-v3模型支持,多语言语音识别/翻译/语种识别,支持从 [modelscope](examples/industrial_data_pretraining/whisper/demo.py)仓库下载,也支持从 [openai](examples/industrial_data_pretraining/whisper/demo_from_openai.py)仓库下载模型。 +- 2024/03/05: 中文离线文件转写服务 4.4、英文离线文件转写服务 1.5、中文实时语音听写服务 1.9 发布,docker镜像支持arm64平台,升级modelscope版本;详细信息参阅([部署文档](runtime/readme_cn.md)) +- 2024/01/30:funasr-1.0发布,更新说明[文档](https://github.com/alibaba-damo-academy/FunASR/discussions/1319) +- 2024/01/30:新增加情感识别 [模型链接](https://www.modelscope.cn/models/iic/emotion2vec_base_finetuned/summary),原始模型 [repo](https://github.com/ddlBoJack/emotion2vec). +- 2024/01/25: 中文离线文件转写服务 4.2、英文离线文件转写服务 1.3,优化vad数据处理方式,大幅降低峰值内存占用,内存泄漏优化;中文实时语音听写服务 1.7 发布,客户端优化;详细信息参阅([部署文档](runtime/readme_cn.md)) +- 2024/01/09: funasr社区软件包windows 2.0版本发布,支持软件包中文离线文件转写4.1、英文离线文件转写1.2、中文实时听写服务1.6的最新功能,详细信息参阅([FunASR社区软件包windows版本](https://www.modelscope.cn/models/damo/funasr-runtime-win-cpu-x64/summary)) +- 2024/01/03: 中文离线文件转写服务 4.0 发布,新增支持8k模型、优化时间戳不匹配问题及增加句子级别时间戳、优化英文单词fst热词效果、支持自动化配置线程参数,同时修复已知的crash问题及内存泄漏问题,详细信息参阅([部署文档](runtime/readme_cn.md#中文离线文件转写服务cpu版本)) +- 2024/01/03: 中文实时语音听写服务 1.6 发布,2pass-offline模式支持Ngram语言模型解码、wfst热词,同时修复已知的crash问题及内存泄漏问题,详细信息参阅([部署文档](runtime/readme_cn.md#中文实时语音听写服务cpu版本)) +- 2024/01/03: 英文离线文件转写服务 1.2 发布,修复已知的crash问题及内存泄漏问题,详细信息参阅([部署文档](runtime/readme_cn.md#英文离线文件转写服务cpu版本)) +- 2023/12/04: funasr社区软件包windows 1.0版本发布,支持中文离线文件转写、英文离线文件转写、中文实时听写服务,详细信息参阅([FunASR社区软件包windows版本](https://www.modelscope.cn/models/damo/funasr-runtime-win-cpu-x64/summary)) +- 2023/11/08:中文离线文件转写服务3.0 CPU版本发布,新增标点大模型、Ngram语言模型与wfst热词,详细信息参阅([部署文档](runtime/readme_cn.md#中文离线文件转写服务cpu版本)) +- 2023/10/17: 英文离线文件转写服务一键部署的CPU版本发布,详细信息参阅([部署文档](runtime/readme_cn.md#英文离线文件转写服务cpu版本)) +- 2023/10/13: [SlideSpeech](https://slidespeech.github.io/): 一个大规模的多模态音视频语料库,主要是在线会议或者在线课程场景,包含了大量与发言人讲话实时同步的幻灯片。 +- 2023.10.10: [Paraformer-long-Spk](https://github.com/alibaba-damo-academy/FunASR/blob/main/egs_modelscope/asr_vad_spk/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/demo.py)模型发布,支持在长语音识别的基础上获取每句话的说话人标签。 +- 2023.10.07: [FunCodec](https://github.com/alibaba-damo-academy/FunCodec): FunCodec提供开源模型和训练工具,可以用于音频离散编码,以及基于离散编码的语音识别、语音合成等任务。 +- 2023.09.01: 中文离线文件转写服务2.0 CPU版本发布,新增ffmpeg、时间戳与热词模型支持,详细信息参阅([部署文档](runtime/readme_cn.md#中文离线文件转写服务cpu版本)) +- 2023.08.07: 中文实时语音听写服务一键部署的CPU版本发布,详细信息参阅([部署文档](runtime/readme_cn.md#中文实时语音听写服务cpu版本)) +- 2023.07.17: BAT一种低延迟低内存消耗的RNN-T模型发布,详细信息参阅([BAT](egs/aishell/bat)) +- 2023.06.26: ASRU2023 多通道多方会议转录挑战赛2.0完成竞赛结果公布,详细信息参阅([M2MeT2.0](https://alibaba-damo-academy.github.io/FunASR/m2met2_cn/index.html)) + + +## 安装教程 + +```shell +pip3 install -U funasr +``` +或者从源代码安装 +``` sh +git clone https://github.com/alibaba/FunASR.git && cd FunASR +pip3 install -e ./ +``` +如果需要使用工业预训练模型,安装modelscope(可选) + +```shell +pip3 install -U modelscope +``` + +## 模型仓库 + +FunASR开源了大量在工业数据上预训练模型,您可以在[模型许可协议](./MODEL_LICENSE)下自由使用、复制、修改和分享FunASR模型,下面列举代表性的模型,更多模型请参考 [模型仓库](./model_zoo)。 + +(注:⭐ 表示ModelScope模型仓库,🤗 表示Huggingface模型仓库,🍀表示OpenAI模型仓库) + + +| 模型名字 | 任务详情 | 训练数据 | 参数量 | +|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------:|:--------------:|:------:| +| paraformer-zh
([⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) [🤗](https://huggingface.co/funasr/paraformer-tp) ) | 语音识别,带时间戳输出,非实时 | 60000小时,中文 | 220M | +| paraformer-zh-streaming
( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗](https://huggingface.co/funasr/paraformer-zh-streaming) ) | 语音识别,实时 | 60000小时,中文 | 220M | +| paraformer-en
( [⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) [🤗](https://huggingface.co/funasr/paraformer-en) ) | 语音识别,非实时 | 50000小时,英文 | 220M | +| conformer-en
( [⭐](https://modelscope.cn/models/damo/speech_conformer_asr-en-16k-vocab4199-pytorch/summary) [🤗](https://huggingface.co/funasr/conformer-en) ) | 语音识别,非实时 | 50000小时,英文 | 220M | +| ct-punc
( [⭐](https://modelscope.cn/models/damo/punc_ct-transformer_cn-en-common-vocab471067-large/summary) [🤗](https://huggingface.co/funasr/ct-punc) ) | 标点恢复 | 100M,中文与英文 | 1.1B | +| fsmn-vad
( [⭐](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary) [🤗](https://huggingface.co/funasr/fsmn-vad) ) | 语音端点检测,实时 | 5000小时,中文与英文 | 0.4M | +| fa-zh
( [⭐](https://modelscope.cn/models/damo/speech_timestamp_prediction-v1-16k-offline/summary) [🤗](https://huggingface.co/funasr/fa-zh) ) | 字级别时间戳预测 | 50000小时,中文 | 38M | +| cam++
( [⭐](https://modelscope.cn/models/iic/speech_campplus_sv_zh-cn_16k-common/summary) [🤗](https://huggingface.co/funasr/campplus) ) | 说话人确认/分割 | 5000小时 | 7.2M | +| Whisper-large-v3
([⭐](https://www.modelscope.cn/models/iic/Whisper-large-v3/summary) [🍀](https://github.com/openai/whisper) ) | 语音识别,带时间戳输出,非实时 | 多语言 | 1550 M | +| Qwen-Audio
([⭐](examples/industrial_data_pretraining/qwen_audio/demo.py) [🤗](https://huggingface.co/Qwen/Qwen-Audio) ) | 音频文本多模态大模型(预训练) | 多语言 | 8B | +| Qwen-Audio-Chat
([⭐](examples/industrial_data_pretraining/qwen_audio/demo_chat.py) [🤗](https://huggingface.co/Qwen/Qwen-Audio-Chat) ) | 音频文本多模态大模型(chat版本) | 多语言 | 8B | +| emotion2vec+large
([⭐](https://modelscope.cn/models/iic/emotion2vec_plus_large/summary) [🤗](https://huggingface.co/emotion2vec/emotion2vec_plus_large) ) | 情感识别模型 | 40000小时,4种情感类别 | 300M | + + +## 快速开始 + +下面为快速上手教程,测试音频([中文](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav),[英文](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav)) + +### 可执行命令行 + +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +注:支持单条音频文件识别,也支持文件列表,列表为kaldi风格wav.scp:`wav_id wav_path` + +### 非实时语音识别 +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", vad_model="fsmn-vad", punc_model="ct-punc", + # spk_model="cam++" + ) +res = model.generate(input=f"{model.model_path}/example/asr_example.wav", + batch_size_s=300, + hotword='魔搭') +print(res) +``` +注:`hub`:表示模型仓库,`ms`为选择modelscope下载,`hf`为选择huggingface下载。 + +### 实时语音识别 + +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` + +注:`chunk_size`为流式延时配置,`[0,10,5]`表示上屏实时出字粒度为`10*60=600ms`,未来信息为`5*60=300ms`。每次推理输入为`600ms`(采样点数为`16000*0.6=960`),输出为对应文字,最后一个语音片段输入需要设置`is_final=True`来强制输出最后一个字。 + +### 语音端点检测(非实时) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") + +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +注:VAD模型输出格式为:`[[beg1, end1], [beg2, end2], .., [begN, endN]]`,其中`begN/endN`表示第`N`个有效音频片段的起始点/结束点, +单位为毫秒。 + +### 语音端点检测(实时) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +注:流式VAD模型输出格式为4种情况: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:同上离线VAD输出结果。 +- `[[beg, -1]]`:表示只检测到起始点。 +- `[[-1, end]]`:表示只检测到结束点。 +- `[]`:表示既没有检测到起始点,也没有检测到结束点 +输出结果单位为毫秒,从起始点开始的绝对时间。 + +### 标点恢复 +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") + +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` + +### 时间戳预测 +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") + +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` +更详细([教程文档](docs/tutorial/README_zh.md)), +更多([模型示例](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)) + +## 导出ONNX +### 从命令行导出 +```shell +funasr-export ++model=paraformer ++quantize=false +``` + +### 从Python导出 +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer") + +res = model.export(quantize=False) +``` + +### 测试ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +更多例子请参考 [样例](runtime/python/onnxruntime) + + +## 服务部署 +FunASR支持预训练或者进一步微调的模型进行服务部署。目前支持以下几种服务部署: + +- 中文离线文件转写服务(CPU版本),已完成 +- 中文流式语音识别服务(CPU版本),已完成 +- 英文离线文件转写服务(CPU版本),已完成 +- 中文离线文件转写服务(GPU版本),进行中 +- 更多支持中 + +详细信息可以参阅([服务部署文档](runtime/readme_cn.md))。 + + + +## 联系我们 + +如果您在使用中遇到问题,可以直接在github页面提Issues。欢迎语音兴趣爱好者扫描以下的钉钉群或者微信群二维码加入社区群,进行交流和讨论。 + +| 钉钉群 | 微信 | +|:---------------------------------------------------------------------:|:-----------------------------------------------------:| +|
|
| + +## 社区贡献者 + +|
|
|
|
| | | +|:------------------------------------------------------------------:|:---------------------------------------------------------------:|:--------------------------------------------------------------:|:-------------------------------------------------------:|:-----------------------------------------------------------:|:------------------------------------------------------:| + +贡献者名单请参考([致谢名单](./Acknowledge.md)) + + +## 许可协议 +项目遵循[The MIT License](https://opensource.org/licenses/MIT)开源协议,模型许可协议请参考([模型协议](./MODEL_LICENSE)) + + +## 论文引用 + +``` bibtex +@inproceedings{gao2023funasr, + author={Zhifu Gao and Zerui Li and Jiaming Wang and Haoneng Luo and Xian Shi and Mengzhe Chen and Yabin Li and Lingyun Zuo and Zhihao Du and Zhangyu Xiao and Shiliang Zhang}, + title={FunASR: A Fundamental End-to-End Speech Recognition Toolkit}, + year={2023}, + booktitle={INTERSPEECH}, +} +@inproceedings{An2023bat, + author={Keyu An and Xian Shi and Shiliang Zhang}, + title={BAT: Boundary aware transducer for memory-efficient and low-latency ASR}, + year={2023}, + booktitle={INTERSPEECH}, +} +@inproceedings{gao22b_interspeech, + author={Zhifu Gao and ShiLiang Zhang and Ian McLoughlin and Zhijie Yan}, + title={{Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition}}, + year=2022, + booktitle={Proc. Interspeech 2022}, + pages={2063--2067}, + doi={10.21437/Interspeech.2022-9996} +} +@article{shi2023seaco, + author={Xian Shi and Yexin Yang and Zerui Li and Yanni Chen and Zhifu Gao and Shiliang Zhang}, + title={{SeACo-Paraformer: A Non-Autoregressive ASR System with Flexible and Effective Hotword Customization Ability}}, + year=2023, + journal={arXiv preprint arXiv:2308.03266(accepted by ICASSP2024)}, +} +``` diff --git a/benchmarks/benchmark_pipeline_cer.md b/benchmarks/benchmark_pipeline_cer.md new file mode 100644 index 0000000..33d8571 --- /dev/null +++ b/benchmarks/benchmark_pipeline_cer.md @@ -0,0 +1,216 @@ +# Leaderboard IO + + +## Configuration +### Data set: +[Aishell1](https://www.openslr.org/33/): dev, test + +[Aishell2](https://www.aishelltech.com/aishell_2): dev_ios, test_ios, test_android, test_mic + +[WenetSpeech](https://github.com/wenet-e2e/WenetSpeech): dev, test_meeting, test_net + + +### Tools +#### [Install Requirements](https://alibaba-damo-academy.github.io/FunASR/en/installation/installation.html#installation) + +Install ModelScope and FunASR from pip +```shell +pip install -U modelscope funasr +# For the users in China, you could install with the command: +#pip install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +Or install FunASR from source code +```shell +git clone https://github.com/alibaba/FunASR.git && cd FunASR +pip install -e ./ +# For the users in China, you could install with the command: +# pip install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + + +#### Recipe + + +##### [Test CER](https://alibaba-damo-academy.github.io/FunASR/en/modelscope_pipeline/asr_pipeline.html#inference-with-multi-thread-cpus-or-multi-gpus) +set the `model`, `data_dir` and `output_dir` in `infer.sh`. +```shell +cd egs_modelscope/asr/TEMPLATE +bash infer.sh +``` + +## Benchmark CER + + +### Chinese Dataset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ModelOffline/OnlineAishell1Aishell2WenetSpeech
devtestdev_iostest_iostest_androidtest_micdevtest_meetingtest_net
Paraformer-large Offline1.761.942.792.843.083.033.437.016.66
Paraformer-large-long Offline1.802.102.782.873.123.113.4413.287.08
Paraformer-large-contextual Offline1.762.022.732.852.982.953.427.166.72
Paraformer-large-online Online2.373.344.043.864.384.214.5510.647.78
Paraformer Offline3.243.694.584.634.834.714.198.329.19
UniASR Online3.343.994.624.524.774.734.5110.639.70
UniASR-large Offline2.933.483.953.874.114.114.1610.098.69
Paraformer-aishell Offline4.885.43-------
ParaformerBert-aishell Offline6.147.01-------
Paraformer-aishell2 Offline--5.826.306.605.83---
ParaformerBert-aishell2 Offline--4.955.455.595.83---
+ + +### English Dataset + diff --git a/data/list/train.jsonl b/data/list/train.jsonl new file mode 100644 index 0000000..618af38 --- /dev/null +++ b/data/list/train.jsonl @@ -0,0 +1,4 @@ +{"key": "BAC009S0764W0121", "source": "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav", "source_len": 90, "target": "甚至出现交易几乎停滞的情况", "target_len": 13} +{"key": "BAC009S0916W0489", "source": "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav", "source_len": 90, "target": "湖北一公司以员工名义贷款数十员工负债千万", "target_len": 20} +{"key": "asr_example_cn_en", "source": "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav", "source_len": 91, "target": "所有只要处理 data 不管你是做 machine learning 做 deep learning 做 data analytics 做 data science 也好 scientist 也好通通都要都做的基本功啊那 again 先先对有一些也许对", "target_len": 19} +{"key": "ID0012W0014", "source": "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav", "source_len": 88, "target": "he tried to think how it could be", "target_len": 8} diff --git a/data/list/train_text.txt b/data/list/train_text.txt new file mode 100644 index 0000000..2fc2aa5 --- /dev/null +++ b/data/list/train_text.txt @@ -0,0 +1,4 @@ +BAC009S0764W0121 甚至出现交易几乎停滞的情况 +BAC009S0916W0489 湖北一公司以员工名义贷款数十员工负债千万 +asr_example_cn_en 所有只要处理 data 不管你是做 machine learning 做 deep learning 做 data analytics 做 data science 也好 scientist 也好通通都要都做的基本功啊那 again 先先对有一些也许对 +ID0012W0014 he tried to think how it could be \ No newline at end of file diff --git a/data/list/train_wav.scp b/data/list/train_wav.scp new file mode 100644 index 0000000..210f3cb --- /dev/null +++ b/data/list/train_wav.scp @@ -0,0 +1,4 @@ +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +asr_example_cn_en https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +ID0012W0014 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav \ No newline at end of file diff --git a/data/list/val.jsonl b/data/list/val.jsonl new file mode 100644 index 0000000..8cd75ad --- /dev/null +++ b/data/list/val.jsonl @@ -0,0 +1,2 @@ +{"key": "ID0012W0013", "source": "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", "source_len": 88, "target": "欢迎大家来体验达摩院推出的语音识别模型", "target_len": 19} +{"key": "ID0012W0014", "source": "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav", "source_len": 88, "target": "he tried to think how it could be", "target_len": 8} diff --git a/data/list/val_text.txt b/data/list/val_text.txt new file mode 100644 index 0000000..c1aa42d --- /dev/null +++ b/data/list/val_text.txt @@ -0,0 +1,2 @@ +ID0012W0013 欢迎大家来体验达摩院推出的语音识别模型 +ID0012W0014 he tried to think how it could be \ No newline at end of file diff --git a/data/list/val_wav.scp b/data/list/val_wav.scp new file mode 100644 index 0000000..4054ad3 --- /dev/null +++ b/data/list/val_wav.scp @@ -0,0 +1,2 @@ +ID0012W0013 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav +ID0012W0014 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d58379b --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,21 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = FunASR +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..df9b556 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,19 @@ +# FunASR document generation + +## Generate HTML +For convenience, we provide users with the ability to generate local HTML manually. + +First, you should install the following packages, which is required for building HTML: + +```sh +pip3 install -U "funasr[docs]" +``` + +Then you can generate HTML manually. + +```sh +cd docs +make html +``` + +The generated files are all contained in the "FunASR/docs/_build" directory. You can access the FunASR documentation by simply opening the "html/index.html" file in your browser from this directory. \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..a1bdcd7 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,67 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = "FunASR" +copyright = "2022, Speech Lab, Alibaba Group" +author = "Speech Lab, Alibaba Group" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "nbsphinx", + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.viewcode", + "sphinx.ext.mathjax", + "sphinx.ext.todo", + # "sphinxarg.ext", + "sphinx_markdown_tables", + "recommonmark", + "sphinx_rtd_theme", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +source_suffix = [".rst", ".md"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# + +html_theme = "sphinx_rtd_theme" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] diff --git a/docs/images/China_Telecom.png b/docs/images/China_Telecom.png new file mode 100644 index 0000000..3f4b22f Binary files /dev/null and b/docs/images/China_Telecom.png differ diff --git a/docs/images/DeepScience.png b/docs/images/DeepScience.png new file mode 100644 index 0000000..9f46165 Binary files /dev/null and b/docs/images/DeepScience.png differ diff --git a/docs/images/RapidAI.png b/docs/images/RapidAI.png new file mode 100644 index 0000000..0de3dda Binary files /dev/null and b/docs/images/RapidAI.png differ diff --git a/docs/images/XVERSE.png b/docs/images/XVERSE.png new file mode 100644 index 0000000..12e6e49 Binary files /dev/null and b/docs/images/XVERSE.png differ diff --git a/docs/images/aihealthx.png b/docs/images/aihealthx.png new file mode 100644 index 0000000..5727c5b Binary files /dev/null and b/docs/images/aihealthx.png differ diff --git a/docs/images/alibaba.png b/docs/images/alibaba.png new file mode 100644 index 0000000..6ac9012 Binary files /dev/null and b/docs/images/alibaba.png differ diff --git a/docs/images/damo.png b/docs/images/damo.png new file mode 100644 index 0000000..4e692ed Binary files /dev/null and b/docs/images/damo.png differ diff --git a/docs/images/dingding.png b/docs/images/dingding.png new file mode 100644 index 0000000..e77d9c3 Binary files /dev/null and b/docs/images/dingding.png differ diff --git a/docs/images/funasr_logo.jpg b/docs/images/funasr_logo.jpg new file mode 100644 index 0000000..a47243e Binary files /dev/null and b/docs/images/funasr_logo.jpg differ diff --git a/docs/images/funasr_overview.png b/docs/images/funasr_overview.png new file mode 100644 index 0000000..15a6d85 Binary files /dev/null and b/docs/images/funasr_overview.png differ diff --git a/docs/images/logo.png b/docs/images/logo.png new file mode 100644 index 0000000..7375de3 Binary files /dev/null and b/docs/images/logo.png differ diff --git a/docs/images/nwpu.png b/docs/images/nwpu.png new file mode 100644 index 0000000..6b4713c Binary files /dev/null and b/docs/images/nwpu.png differ diff --git a/docs/images/wechat.png b/docs/images/wechat.png new file mode 100644 index 0000000..0ae1890 Binary files /dev/null and b/docs/images/wechat.png differ diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..bf4268b --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,121 @@ +.. Funasr documentation master file, created by + sphinx-quickstart on Tues Dec 6 19:05:00 2022. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +FunASR: A Fundamental End-to-End Speech Recognition Toolkit +============================================================ +.. image:: ./images/funasr_logo.jpg + +FunASR hopes to build a bridge between academic research and industrial applications on speech recognition. By supporting the training & finetuning of the industrial-grade speech recognition model released on `ModelScope `_, researchers and developers can conduct research and production of speech recognition models more conveniently, and promote the development of speech recognition ecology. ASR for Fun! + +Overview +============================================================ +.. image:: ./images/funasr_overview.png + +.. toctree:: + :maxdepth: 1 + :caption: Installation + + ./installation/installation.md + ./installation/docker.md + +.. toctree:: + :maxdepth: 5 + :caption: Quick Start + + ./funasr/quick_start.md + + +.. toctree:: + :maxdepth: 1 + :caption: Academic Egs + + ./academic_recipe/asr_recipe.md + ./academic_recipe/punc_recipe.md + ./academic_recipe/vad_recipe.md + ./academic_recipe/sv_recipe.md + ./academic_recipe/sd_recipe.md + + + + +.. toctree:: + :maxdepth: 1 + :caption: ModelScope Egs + + ./modelscope_pipeline/quick_start.md + ./egs_modelscope/asr/TEMPLATE/README.md + ./egs_modelscope/vad/TEMPLATE/README.md + ./egs_modelscope/punctuation/TEMPLATE/README.md + ./egs_modelscope/tp/TEMPLATE/README.md + ./modelscope_pipeline/sv_pipeline.md + ./modelscope_pipeline/sd_pipeline.md + ./modelscope_pipeline/itn_pipeline.md + +.. toctree:: + :maxdepth: 1 + :caption: Huggingface Egs + + Undo + + +.. toctree:: + :maxdepth: 1 + :caption: Model Zoo + + ./model_zoo/modelscope_models.md + ./model_zoo/huggingface_models.md + +.. toctree:: + :maxdepth: 1 + :caption: Runtime and Service + + ./runtime/readme.md + ./runtime/docs/SDK_tutorial_online.md + ./runtime/docs/SDK_tutorial.md + ./runtime/html5/readme.md + + + +.. toctree:: + :maxdepth: 1 + :caption: Benchmark and Leaderboard + + ./benchmark/benchmark_onnx.md + ./benchmark/benchmark_onnx_cpp.md + ./benchmark/benchmark_libtorch.md + ./benchmark/benchmark_pipeline_cer.md + + +.. toctree:: + :maxdepth: 1 + :caption: Funasr Library + + ./reference/build_task.md + +.. toctree:: + :maxdepth: 1 + :caption: Papers + + ./reference/papers.md + +.. toctree:: + :maxdepth: 1 + :caption: Application + + ./reference/application.md + +.. toctree:: + :maxdepth: 1 + :caption: FQA + + ./reference/FQA.md + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/installation/docker.md b/docs/installation/docker.md new file mode 100644 index 0000000..63bf485 --- /dev/null +++ b/docs/installation/docker.md @@ -0,0 +1,72 @@ +([简体中文](./docker_zh.md)|English) + +# Docker + +## Install Docker + +### Ubuntu +```shell +curl -fsSL https://test.docker.com -o test-docker.sh +sudo sh test-docker.sh +``` +### Debian +```shell + curl -fsSL https://get.docker.com -o get-docker.sh + sudo sh get-docker.sh +``` + +### CentOS +```shell +curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun +``` + +### MacOS +```shell +brew install --cask --appdir=/Applications docker +``` + +### Windows +Ref to [docs](https://docs.docker.com/desktop/install/windows-install/) + +## Start Docker +```shell +sudo systemctl start docker +``` +## Download image + +### Image Hub + +#### CPU +`registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.1` + +#### GPU + +`registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-py38-torch1.11.0-tf1.15.5-1.8.1` + +### Pull Image +```shell +sudo docker pull : +``` + +### Check Image +```shell +sudo docker images +``` + +## Run Docker +```shell +# cpu +sudo docker run -itd --name funasr -v : /bin/bash +# gpu +sudo docker run -itd --gpus all --name funasr -v : /bin/bash + +sudo docker exec -it funasr /bin/bash +``` + +## Stop Docker +```shell +exit +sudo docker ps +sudo docker stop funasr +``` + diff --git a/docs/installation/docker_zh.md b/docs/installation/docker_zh.md new file mode 100644 index 0000000..2fa6a90 --- /dev/null +++ b/docs/installation/docker_zh.md @@ -0,0 +1,72 @@ +(简体中文|[English](./docker.md)) + +# Docker + +## 安装Docker + +### Ubuntu +```shell +curl -fsSL https://test.docker.com -o test-docker.sh +sudo sh test-docker.sh +``` +### Debian +```shell + curl -fsSL https://get.docker.com -o get-docker.sh + sudo sh get-docker.sh +``` + +### CentOS +```shell +curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun +``` + +### MacOS +```shell +brew install --cask --appdir=/Applications docker +``` + +### Windows +请参考[文档](https://docs.docker.com/desktop/install/windows-install/) + +## 启动Docker +```shell +sudo systemctl start docker +``` +## 下载Docker镜像 + +### 镜像仓库 + +#### CPU +`registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.1` + +#### GPU + +`registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-py38-torch1.11.0-tf1.15.5-1.8.1` + +### 拉取镜像 +```shell +sudo docker pull : +``` + +### 查看镜像 +```shell +sudo docker images +``` + +## 运行Docker +```shell +# cpu +sudo docker run -itd --name funasr -v : /bin/bash +# gpu +sudo docker run -itd --gpus all --name funasr -v : /bin/bash + +sudo docker exec -it funasr /bin/bash +``` + +## 停止Docker +```shell +exit +sudo docker ps +sudo docker stop funasr +``` + diff --git a/docs/installation/installation.md b/docs/installation/installation.md new file mode 100644 index 0000000..43856cd --- /dev/null +++ b/docs/installation/installation.md @@ -0,0 +1,74 @@ +([简体中文](./installation_zh.md)|English) + +

+ + + +

+ +## Installation + +### Install Conda (Optional): + +#### Linux +```sh +wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh +sh Miniconda3-latest-Linux-x86_64.sh +source ~/.bashrc +conda create -n funasr python=3.8 +conda activate funasr +``` +#### Mac +```sh +wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh +# For M1 chip +# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh +sh Miniconda3-latest-MacOSX* +source ~/.zashrc +conda create -n funasr python=3.8 +conda activate funasr +``` +#### Windows +Ref to [docs](https://docs.conda.io/en/latest/miniconda.html#windows-installers) + +### Install Pytorch (version >= 1.11.0): + +```sh +pip3 install torch torchaudio +``` +If there exists CUDAs in your environments, you should install the pytorch with the version matching the CUDA. The matching list could be found in [docs](https://pytorch.org/get-started/previous-versions/). +### Install funasr + +#### Install from pip + +```shell +pip3 install -U funasr +# For the users in China, you could install with the command: +# pip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +#### Or install from source code + +``` sh +git clone https://github.com/alibaba/FunASR.git && cd FunASR +pip3 install -e ./ +# For the users in China, you could install with the command: +# pip3 install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +### Install modelscope (Optional) +If you want to use the pretrained models in ModelScope, you should install the modelscope: + +```shell +pip3 install -U modelscope +# For the users in China, you could install with the command: +# pip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +### FQA +- For installation on MAC M1 chip, the following error may happen: +- - _cffi_backend.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) + ```shell + pip uninstall cffi pycparser + ARCHFLAGS="-arch arm64" pip install cffi pycparser --compile --no-cache-dir + ``` diff --git a/docs/installation/installation_zh.md b/docs/installation/installation_zh.md new file mode 100644 index 0000000..f663148 --- /dev/null +++ b/docs/installation/installation_zh.md @@ -0,0 +1,75 @@ +(简体中文|[English](./installation.md)) + +

+ + + +

+ +## 安装 + +### 安装Conda(可选): + +#### Linux +```sh +wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh +sh Miniconda3-latest-Linux-x86_64.sh +source ~/.bashrc +conda create -n funasr python=3.8 +conda activate funasr +``` +#### Mac +```sh +wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh +# For M1 chip +# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh +sh Miniconda3-latest-MacOSX* +source ~/.zashrc +conda create -n funasr python=3.8 +conda activate funasr +``` +#### Windows +Ref to [docs](https://docs.conda.io/en/latest/miniconda.html#windows-installers) + +### 安装Pytorch(版本 >= 1.11.0): + +```sh +pip3 install torch torchaudio +``` +如果您的环境中存在CUDAs,则应安装与CUDA匹配版本的pytorch,匹配列表可在文档中找到([文档](https://pytorch.org/get-started/previous-versions/))。 +### 安装funasr + +#### 从pip安装 + +```shell +pip3 install -U funasr +# 对于中国大陆用户,可以使用以下命令进行安装: +# pip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +#### 或者从源代码安装 + +``` sh +git clone https://github.com/alibaba/FunASR.git && cd FunASR +pip3 install -e ./ +# 对于中国大陆用户,可以使用以下命令进行安装: +# pip3 install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +### 安装modelscope(可选) + +如果您想要使用ModelScope中的预训练模型,则应安装modelscope: + +```shell +pip3 install -U modelscope +# 对于中国大陆用户,可以使用以下命令进行安装: +# pip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +### 常见问题解答 +- 在MAC M1芯片上安装时,可能会出现以下错误: +- - _cffi_backend.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) + ```shell + pip uninstall cffi pycparser + ARCHFLAGS="-arch arm64" pip install cffi pycparser --compile --no-cache-dir + ``` diff --git a/docs/m2met2/Baseline.md b/docs/m2met2/Baseline.md new file mode 100644 index 0000000..12b6206 --- /dev/null +++ b/docs/m2met2/Baseline.md @@ -0,0 +1,38 @@ +# Baseline +## Overview +We will release an E2E SA-ASR baseline conducted on [FunASR](https://github.com/alibaba-damo-academy/FunASR) at the time according to the timeline. The model architecture is shown in Figure 3. The SpeakerEncoder is initialized with a pre-trained speaker verification model from ModelScope. This speaker verification model is also be used to extract the speaker embedding in the speaker profile. + +![model archietecture](images/sa_asr_arch.png) + +## Quick start +To run the baseline, first you need to install FunASR and ModelScope. ([installation](https://github.com/alibaba-damo-academy/FunASR#installation)) +There are two startup scripts, `run.sh` for training and evaluating on the old eval and test sets, and `run_m2met_2023_infer.sh` for inference on the new test set of the Multi-Channel Multi-Party Meeting Transcription 2.0 ([M2MeT2.0](https://alibaba-damo-academy.github.io/FunASR/m2met2/index.html)) Challenge. +Before running `run.sh`, you must manually download and unpack the [AliMeeting](http://www.openslr.org/119/) corpus and place it in the `./dataset` directory: +```shell +dataset +|—— Eval_Ali_far +|—— Eval_Ali_near +|—— Test_Ali_far +|—— Test_Ali_near +|—— Train_Ali_far +|—— Train_Ali_near +``` +Before running `run_m2met_2023_infer.sh`, you need to place the new test set `Test_2023_Ali_far` (to be released after the challenge starts) in the `./dataset` directory, which contains only raw audios. Then put the given `wav.scp`, `wav_raw.scp`, `segments`, `utt2spk` and `spk2utt` in the `./data/Test_2023_Ali_far` directory. +```shell +data/Test_2023_Ali_far +|—— wav.scp +|—— wav_raw.scp +|—— segments +|—— utt2spk +|—— spk2utt +``` +For more details you can see [here](https://github.com/alibaba-damo-academy/FunASR/blob/main/egs/alimeeting/sa-asr/README.md) + +## Baseline results +The results of the baseline system are shown in Table 3. The speaker profile adopts the oracle speaker embedding during training. However, due to the lack of oracle speaker label during evaluation, the speaker profile provided by an additional spectral clustering is used. Meanwhile, the results of using the oracle speaker profile on Eval and Test Set are also provided to show the impact of speaker profile accuracy. + + +| |SI-CER(%) |cpCER(%) | +|:---------------|:------------:|----------:| +|oracle profile |32.72 |42.92 | +|cluster profile|32.73 |49.37 | \ No newline at end of file diff --git a/docs/m2met2/Challenge_result.md b/docs/m2met2/Challenge_result.md new file mode 100644 index 0000000..52bbedd --- /dev/null +++ b/docs/m2met2/Challenge_result.md @@ -0,0 +1,14 @@ +# Challenge Result +The following table shows the final results of the competition, where Sub-track1 represents the sub-track under fixed training condition and Sub-track 2 represents the sub-track under the open training condition. All result in this table is cp-CER (%). The rankings in the table are the combined rankings of the two sub-tracks as all teams' submissions met the requirements of the sub-track under fixed training condition. +| Rank     | Team Name                             | Sub-track1     | Sub-track2     | paper | +|------|----------------------|------------|------------|------------------------| +| 1 | Ximalaya Speech Team | 11.27 | 11.27 | | +| 2 | 小马达 | 18.64 | 18.64 | | +| 3 | AIzyzx | 22.83 | 22.83 | | +| 4 | AsrSpeeder | / | 23.51 | | +| 5 | zyxlhz | 24.82 | 24.82 | | +| 6 | CMCAI | 26.11 | / | | +| 7 | Volcspeech | 34.21 | 34.21 | | +| 8 | 鉴往知来 | 40.14 | 40.14 | | +| 9 | baseline | 41.55 | 41.55 | | +| 10 | DAICT | 41.64 | | | diff --git a/docs/m2met2/Contact.md b/docs/m2met2/Contact.md new file mode 100644 index 0000000..c05cd57 --- /dev/null +++ b/docs/m2met2/Contact.md @@ -0,0 +1,4 @@ +# Contact +If you have any questions about M2MeT2.0 challenge, please contact us by + +- email: [m2met.alimeeting@gmail.com](mailto:m2met.alimeeting@gmail.com) diff --git a/docs/m2met2/Dataset.md b/docs/m2met2/Dataset.md new file mode 100644 index 0000000..74548fd --- /dev/null +++ b/docs/m2met2/Dataset.md @@ -0,0 +1,26 @@ +# Datasets +## Overview of training data +In the fixed training condition, the training dataset is restricted to three publicly available corpora, namely, AliMeeting, AISHELL-4, and CN-Celeb. To evaluate the performance of the models trained on these datasets, we will release a new Test set called Test-2023 for scoring and ranking. We will describe the AliMeeting dataset and the Test-2023 set in detail. +## Detail of AliMeeting corpus +AliMeeting contains 118.75 hours of speech data in total. The dataset is divided into 104.75 hours for training (Train), 4 hours for evaluation (Eval) and 10 hours as test set (Test) for scoring and ranking. Specifically, the Train, Eval and Test sets contain 212, 8 and 20 sessions, respectively. Each session consists of a 15 to 30-minute discussion by a group of participants. The total number of participants in Train, Eval and Test sets is 456, 25 and 60, respectively, with balanced gender coverage. + +The dataset is collected in 13 meeting venues, which are categorized into three types: small, medium, and large rooms with sizes ranging from 8 m$^{2}$ to 55 m$^{2}$. Different rooms give us a variety of acoustic properties and layouts. The detailed parameters of each meeting venue will be released together with the Train data. The type of wall material of the meeting venues covers cement, glass, etc. Other furnishings in meeting venues include sofa, TV, blackboard, fan, air conditioner, plants, etc. During recording, the participants of the meeting sit around the microphone array which is placed on the table and conduct a natural conversation. The microphone-speaker distance ranges from 0.3 m to 5.0 m. All participants are native Chinese speakers speaking Mandarin without strong accents. During the meeting, various kinds of indoor noise including but not limited to clicking, keyboard, door opening/closing, fan, bubble noise, etc., are made naturally. For both Train and Eval sets, the participants are required to remain in the same position during recording. There is no speaker overlap between the Train and Eval set. An example of the recording venue from the Train set is shown in Fig 1. + +![meeting room](images/meeting_room.png) + +The number of participants within one meeting session ranges from 2 to 4. To ensure the coverage of different overlap ratios, we select various meeting topics during recording, including medical treatment, education, business, organization management, industrial production and other daily routine meetings. The average speech overlap ratio of Train, Eval and Test sets are 42.27\%, 34.76\% and 42.8\%, respectively. More details of AliMeeting are shown in Table 1. A detailed overlap ratio distribution of meeting sessions with different numbers of speakers in the Train, Eval and Test set is shown in Table 2. + +![dataset detail](images/dataset_details.png) + +The Test-2023 set consists of 20 sessions that were recorded in an identical acoustic setting to that of the AliMeeting corpus. Each meeting session in the Test-2023 dataset comprises between 2 and 4 participants, thereby sharing a similar configuration with the AliMeeting test set. + +We also record the near-field signal of each participant using a headset microphone and ensure that only the participant's own speech is recorded and transcribed. It is worth noting that the far-field audio recorded by the microphone array and the near-field audio recorded by the headset microphone will be synchronized to a common timeline range. + +All transcriptions of the speech data are prepared in TextGrid format for each session, which contains the information of the session duration, speaker information (number of speaker, speaker-id, gender, etc.), the total number of segments of each speaker, the timestamp and transcription of each segment, etc. +## Get the data +The three dataset for training mentioned above can be downloaded at [OpenSLR](https://openslr.org/resources.php). The participants can download via the following links. Particularly, in the baseline we provide convenient data preparation scripts for AliMeeting corpus. +- [AliMeeting](https://openslr.org/119/) +- [AISHELL-4](https://openslr.org/111/) +- [CN-Celeb](https://openslr.org/82/) + +Now, the new test set is available [here](https://speech-lab-share-data.oss-cn-shanghai.aliyuncs.com/AliMeeting/openlr/Test_2023_Ali.tar.gz) diff --git a/docs/m2met2/Introduction.md b/docs/m2met2/Introduction.md new file mode 100644 index 0000000..a1cd6c7 --- /dev/null +++ b/docs/m2met2/Introduction.md @@ -0,0 +1,28 @@ +# Introduction +## Call for participation +Automatic speech recognition (ASR) and speaker diarization have made significant strides in recent years, resulting in a surge of speech technology applications across various domains. However, meetings present unique challenges to speech technologies due to their complex acoustic conditions and diverse speaking styles, including overlapping speech, variable numbers of speakers, far-field signals in large conference rooms, and environmental noise and reverberation. + +Over the years, several challenges have been organized to advance the development of meeting transcription, including the Rich Transcription evaluation and Computational Hearing in Multisource Environments (CHIME) challenges. The latest iteration of the CHIME challenge has a particular focus on distant automatic speech recognition and developing systems that can generalize across various array topologies and application scenarios. However, while progress has been made in English meeting transcription, language differences remain a significant barrier to achieving comparable results in non-English languages, such as Mandarin. The Multimodal Information Based Speech Processing (MISP) and Multi-Channel Multi-Party Meeting Transcription (M2MeT) challenges have been instrumental in advancing Mandarin meeting transcription. The MISP challenge seeks to address the problem of audio-visual distant multi-microphone signal processing in everyday home environments, while the M2MeT challenge focuses on tackling the speech overlap issue in offline meeting rooms. + +The ICASSP2022 M2MeT challenge focuses on meeting scenarios, and it comprises two main tasks: speaker diarization and multi-speaker automatic speech recognition. The former involves identifying who spoke when in the meeting, while the latter aims to transcribe speech from multiple speakers simultaneously, which poses significant technical difficulties due to overlapping speech and acoustic interferences. + +Building on the success of the previous M2MeT challenge, we are excited to propose the M2MeT2.0 challenge as an ASRU 2023 challenge special session. In the original M2MeT challenge, the evaluation metric was speaker-independent, which meant that the transcription could be determined, but not the corresponding speaker. To address this limitation and further advance the current multi-talker ASR system towards practicality, the M2MeT2.0 challenge proposes the speaker-attributed ASR task with two sub-tracks: fixed and open training conditions. The speaker-attribute automatic speech recognition (ASR) task aims to tackle the practical and challenging problem of identifying "who spoke what at when". To facilitate reproducible research in this field, we offer a comprehensive overview of the dataset, rules, evaluation metrics, and baseline systems. Furthermore, we will release a carefully curated test set, comprising approximately 10 hours of audio, according to the timeline. The new test set is designed to enable researchers to validate and compare their models' performance and advance the state of the art in this area. + +## Timeline(AOE Time) +- $ April~29, 2023: $ Challenge and registration open. +- $ May~11, 2023: $ Baseline release. +- $ May~22, 2023: $ Registration deadline, the due date for participants to join the Challenge. +- $ June~16, 2023: $ Test data release and leaderboard open. +- $ June~20, 2023: $ Final submission deadline and leaderboar close. +- $ June~26, 2023: $ Evaluation result and ranking release. +- $ July~3, 2023: $ Deadline for paper submission. +- $ July~10, 2023: $ Deadline for final paper submission. +- $ December~12\ to\ 16, 2023: $ ASRU Workshop and Challenge Session. + +## Guidelines + +Interested participants, whether from academia or industry, must register for the challenge by completing the Google form below. The deadline for registration is May 22, 2023. + +[M2MeT2.0 Registration](https://docs.google.com/forms/d/e/1FAIpQLSf77T9vAl7Ym-u5g8gXu18SBofoWRaFShBo26Ym0-HDxHW9PQ/viewform?usp=sf_link) + +Within three working days, the challenge organizer will send email invitations to eligible teams to participate in the challenge. All qualified teams are required to adhere to the challenge rules, which will be published on the challenge page. Prior to the ranking release time, each participant must submit a system description document detailing their approach and methods. The organizer will select the top ranking submissions to be included in the ASRU2023 Proceedings. diff --git a/docs/m2met2/Makefile b/docs/m2met2/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/m2met2/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/m2met2/Organizers.md b/docs/m2met2/Organizers.md new file mode 100644 index 0000000..f5a9da2 --- /dev/null +++ b/docs/m2met2/Organizers.md @@ -0,0 +1,48 @@ +# Organizers +***Lei Xie, Professor, AISHELL foundation, China*** + +Email: [lxie@nwpu.edu.cn](mailto:lxie@nwpu.edu.cn) + +lxie + + +***Kong Aik Lee, Senior Scientist at Institute for Infocomm Research, A\*Star, Singapore*** + +Email: [kongaik.lee@ieee.org](mailto:kongaik.lee@ieee.org) + +kong + + +***Zhijie Yan, Principal Engineer at Alibaba, China*** +Email: [zhijie.yzj@alibaba-inc.com](mailto:zhijie.yzj@alibaba-inc.com) + +zhijie + +***Shiliang Zhang, Senior Engineer at Alibaba, China*** +Email: [sly.zsl@alibaba-inc.com](mailto:sly.zsl@alibaba-inc.com) + +zsl + +***Yanmin Qian, Professor, Shanghai Jiao Tong University, China*** + +Email: [yanminqian@sjtu.edu.cn](mailto:yanminqian@sjtu.edu.cn) + +qian + +***Zhuo Chen, Applied Scientist in Microsoft, USA*** + +Email: [zhuc@microsoft.com](mailto:zhuc@microsoft.com) + +chenzhuo + +***Jian Wu, Applied Scientist in Microsoft, USA*** + +Email: [wujian@microsoft.com](mailto:wujian@microsoft.com) + +wujian + +***Hui Bu, CEO, AISHELL foundation, China*** + +Email: [buhui@aishelldata.com](mailto:buhui@aishelldata.com) + +buhui diff --git a/docs/m2met2/Rules.md b/docs/m2met2/Rules.md new file mode 100644 index 0000000..340c2f5 --- /dev/null +++ b/docs/m2met2/Rules.md @@ -0,0 +1,14 @@ +# Rules +All participants should adhere to the following rules to be eligible for the challenge. + +- Data augmentation is allowed on the original training dataset, including, but not limited to, adding noise or reverberation, speed perturbation and tone change. + +- Participants are permitted to use the Eval set for model training, but it is not allowed to use the Test set for this purpose. Instead, the Test set should only be utilized for parameter tuning and model selection. Any use of the Test-2023 dataset that violates these rules is strictly prohibited, including but not limited to the use of the Test set for fine-tuning or training the model. + +- If the cpCER of the two systems on the Test dataset are the same, the system with lower computation complexity will be judged as the superior one. + +- If the forced alignment is used to obtain the frame-level classification label, the forced alignment model must be trained on the basis of the data allowed by the corresponding sub-track. + +- Shallow fusion is allowed to the end-to-end approaches, e.g., LAS, RNNT and Transformer, but the training data of the shallow fusion language model can only come from the transcripts of the allowed training dataset. + +- The right of final interpretation belongs to the organizer. In case of special circumstances, the organizer will coordinate the interpretation. \ No newline at end of file diff --git a/docs/m2met2/Track_setting_and_evaluation.md b/docs/m2met2/Track_setting_and_evaluation.md new file mode 100644 index 0000000..2b75fca --- /dev/null +++ b/docs/m2met2/Track_setting_and_evaluation.md @@ -0,0 +1,17 @@ +# Track & Evaluation +## Speaker-Attributed ASR +The speaker-attributed ASR task poses a unique challenge of transcribing speech from multiple speakers and assigning a speaker label to the transcription. Figure 2 illustrates the difference between the speaker-attributed ASR task and the multi-speaker ASR task. This track allows for the use of the AliMeeting, Aishell4, and Cn-Celeb datasets as constrained data sources during both training and evaluation. The AliMeeting dataset, which was used in the M2MeT challenge, includes Train, Eval, and Test sets. Additionally, a new Test-2023 set, consisting of approximately 10 hours of meeting data recorded in an identical acoustic setting as the AliMeeting corpus, will be released soon for challenge scoring and ranking. It's worth noting that the organizers will not provide the near-field audio, transcriptions, or oracle timestamps of the Test-2023 set. Instead, segments containing multiple speakers will be provided, which can be obtained using a simple voice activity detection (VAD) model. + +![task difference](images/task_diff.png) + +## Evaluation metric +The accuracy of a speaker-attributed ASR system is evaluated using the concatenated minimum permutation character error rate (cpCER) metric. The calculation of cpCER involves three steps. Firstly, the reference and hypothesis transcriptions from each speaker in a session are concatenated in chronological order. Secondly, the character error rate (CER) is calculated between the concatenated reference and hypothesis transcriptions, and this process is repeated for all possible speaker permutations. Finally, the permutation with the lowest CER is selected as the cpCER for that session. TThe CER is obtained by dividing the total number of insertions (Ins), substitutions (Sub), and deletions(Del) of characters required to transform the ASR output into the reference transcript by the total number of characters in the reference transcript. Specifically, CER is calculated by: + +$$\text{CER} = \frac {\mathcal N_{\text{Ins}} + \mathcal N_{\text{Sub}} + \mathcal N_{\text{Del}} }{\mathcal N_{\text{Total}}} \times 100\%,$$ + +where $\mathcal N_{\text{Ins}}$, $\mathcal N_{\text{Sub}}$, $\mathcal N_{\text{Del}}$ are the character number of the three errors, and $\mathcal N_{\text{Total}}$ is the total number of characters. +## Sub-track arrangement +### Sub-track I (Fixed Training Condition): +Participants are required to use only the fixed-constrained data (i.e., AliMeeting, Aishell-4, and CN-Celeb) for system development. The usage of any additional data is strictly prohibited. However, participants can use open-source pre-trained models from third-party sources, such as [Hugging Face](https://huggingface.co/models) and [ModelScope](https://www.modelscope.cn/models), provided that the list of utilized models is clearly stated in the final system description paper. +### Sub-track II (Open Training Condition): +Participants are allowed to use any publicly available data set, privately recorded data, and manual simulation to build their systems in addition to the fixed-constrained data. They can also utilize any open-source pre-trained models, but it is mandatory to provide a clear list of the data and models used in the final system description paper. If manually simulated data is used, a detailed description of the data simulation scheme must be provided. \ No newline at end of file diff --git a/docs/m2met2/conf.py b/docs/m2met2/conf.py new file mode 100644 index 0000000..6edc1b4 --- /dev/null +++ b/docs/m2met2/conf.py @@ -0,0 +1,44 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "MULTI-PARTY MEETING TRANSCRIPTION CHALLENGE 2.0" +copyright = "2023, Speech Lab, Alibaba Group; ASLP Group, Northwestern Polytechnical University" +author = "Speech Lab, Alibaba Group; Audio, Speech and Language Processing Group, Northwestern Polytechnical University" + + +extensions = [ + "nbsphinx", + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.viewcode", + "sphinx.ext.mathjax", + "sphinx.ext.todo", + # "sphinxarg.ext", + "sphinx_markdown_tables", + # 'recommonmark', + "sphinx_rtd_theme", + "myst_parser", +] + +myst_enable_extensions = [ + "colon_fence", + "deflist", + "dollarmath", + "html_image", +] + +myst_heading_anchors = 2 +myst_highlight_code_blocks = True +myst_update_mathjax = False + +templates_path = ["_templates"] +source_suffix = [".rst", ".md"] + +pygments_style = "sphinx" + +html_theme = "sphinx_rtd_theme" diff --git a/docs/m2met2/images/buhui.jpeg b/docs/m2met2/images/buhui.jpeg new file mode 100644 index 0000000..86efc8f Binary files /dev/null and b/docs/m2met2/images/buhui.jpeg differ diff --git a/docs/m2met2/images/chenzhuo.jpg b/docs/m2met2/images/chenzhuo.jpg new file mode 100644 index 0000000..66aaad2 Binary files /dev/null and b/docs/m2met2/images/chenzhuo.jpg differ diff --git a/docs/m2met2/images/dataset_details.png b/docs/m2met2/images/dataset_details.png new file mode 100644 index 0000000..c9ac1c0 Binary files /dev/null and b/docs/m2met2/images/dataset_details.png differ diff --git a/docs/m2met2/images/kong.png b/docs/m2met2/images/kong.png new file mode 100644 index 0000000..c81b172 Binary files /dev/null and b/docs/m2met2/images/kong.png differ diff --git a/docs/m2met2/images/lxie.jpeg b/docs/m2met2/images/lxie.jpeg new file mode 100644 index 0000000..477cfda Binary files /dev/null and b/docs/m2met2/images/lxie.jpeg differ diff --git a/docs/m2met2/images/meeting_room.png b/docs/m2met2/images/meeting_room.png new file mode 100644 index 0000000..d26178d Binary files /dev/null and b/docs/m2met2/images/meeting_room.png differ diff --git a/docs/m2met2/images/qian.jpeg b/docs/m2met2/images/qian.jpeg new file mode 100644 index 0000000..61d4af3 Binary files /dev/null and b/docs/m2met2/images/qian.jpeg differ diff --git a/docs/m2met2/images/sa_asr_arch.png b/docs/m2met2/images/sa_asr_arch.png new file mode 100644 index 0000000..fd65dd2 Binary files /dev/null and b/docs/m2met2/images/sa_asr_arch.png differ diff --git a/docs/m2met2/images/task_diff.png b/docs/m2met2/images/task_diff.png new file mode 100644 index 0000000..5cb6c0a Binary files /dev/null and b/docs/m2met2/images/task_diff.png differ diff --git a/docs/m2met2/images/wujian.jpg b/docs/m2met2/images/wujian.jpg new file mode 100644 index 0000000..4d968d3 Binary files /dev/null and b/docs/m2met2/images/wujian.jpg differ diff --git a/docs/m2met2/images/zhijie.jpg b/docs/m2met2/images/zhijie.jpg new file mode 100644 index 0000000..11cfabf Binary files /dev/null and b/docs/m2met2/images/zhijie.jpg differ diff --git a/docs/m2met2/images/zsl.JPG b/docs/m2met2/images/zsl.JPG new file mode 100644 index 0000000..c6318ac Binary files /dev/null and b/docs/m2met2/images/zsl.JPG differ diff --git a/docs/m2met2/index.rst b/docs/m2met2/index.rst new file mode 100644 index 0000000..6567dee --- /dev/null +++ b/docs/m2met2/index.rst @@ -0,0 +1,26 @@ +.. m2met2 documentation master file, created by + sphinx-quickstart on Tue Apr 11 14:18:55 2023. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +ASRU 2023 MULTI-CHANNEL MULTI-PARTY MEETING TRANSCRIPTION CHALLENGE 2.0 (M2MeT2.0) +================================================================================== +Building on the success of the M2MeT challenge, we are delighted to propose the M2MeT2.0 challenge as a special session at ASRU2023. +To advance the current state-of-the-art in multi-talker automatic speech recognition, the M2MeT2.0 challenge proposes a speaker-attributed ASR task, comprising two sub-tracks: fixed and open training conditions. +To facilitate reproducible research, we provide a comprehensive overview of the dataset, challenge rules, evaluation metrics, and baseline systems. + +Now the new test set contains about 10 hours audio is available. You can download from `here `_ + +.. toctree:: + :maxdepth: 1 + :caption: Contents: + + ./Introduction + ./Dataset + ./Track_setting_and_evaluation + ./Baseline + ./Rules + ./Challenge_result + ./Organizers + ./Contact + diff --git a/docs/m2met2/make.bat b/docs/m2met2/make.bat new file mode 100644 index 0000000..954237b --- /dev/null +++ b/docs/m2met2/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..dc1312a --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/reference/FQA.md b/docs/reference/FQA.md new file mode 100644 index 0000000..46c5aa3 --- /dev/null +++ b/docs/reference/FQA.md @@ -0,0 +1,22 @@ +# FQA + +## How to use VAD model by modelscope pipeline +Ref to [docs](https://github.com/alibaba-damo-academy/FunASR/discussions/236) + +## How to use Punctuation model by modelscope pipeline +Ref to [docs](https://github.com/alibaba-damo-academy/FunASR/discussions/238) + +## How to use Parafomrer model for streaming by modelscope pipeline +Ref to [docs](https://github.com/alibaba-damo-academy/FunASR/discussions/241) + +## How to use vad, asr and punc model by modelscope pipeline +Ref to [docs](https://github.com/alibaba-damo-academy/FunASR/discussions/278) + +## How to combine vad, asr, punc and nnlm models inside modelscope pipeline +Ref to [docs](https://github.com/alibaba-damo-academy/FunASR/discussions/134) + +## How to combine timestamp prediction model by modelscope pipeline +Ref to [docs](https://github.com/alibaba-damo-academy/FunASR/discussions/246) + +## How to switch decoding mode between online and offline for UniASR model +Ref to [docs](https://github.com/alibaba-damo-academy/FunASR/discussions/151) \ No newline at end of file diff --git a/docs/reference/application.md b/docs/reference/application.md new file mode 100644 index 0000000..1c19dd6 --- /dev/null +++ b/docs/reference/application.md @@ -0,0 +1,5 @@ +## Audio Cut + +## Realtime Speech Recognition + +## Audio Chat \ No newline at end of file diff --git a/docs/reference/build_task.md b/docs/reference/build_task.md new file mode 100644 index 0000000..2020860 --- /dev/null +++ b/docs/reference/build_task.md @@ -0,0 +1,125 @@ +# Build custom tasks +FunASR is similar to ESPNet, which applies `Task` as the general interface ti achieve the training and inference of models. Each `Task` is a class inherited from `AbsTask` and its corresponding code can be seen in `funasr/tasks/abs_task.py`. The main functions of `AbsTask` are shown as follows: +```python +class AbsTask(ABC): + @classmethod + def add_task_arguments(cls, parser: argparse.ArgumentParser): + pass + + @classmethod + def build_preprocess_fn(cls, args, train): + (...) + + @classmethod + def build_collate_fn(cls, args: argparse.Namespace): + (...) + + @classmethod + def build_model(cls, args): + (...) + + @classmethod + def main(cls, args): + (...) +``` +- add_task_arguments:Add parameters required by a specified `Task` +- build_preprocess_fn:定义如何处理对样本进行预处理 define how to preprocess samples +- build_collate_fn:define how to combine multiple samples into a `batch` +- build_model:define the model +- main:training interface, starting training through `Task.main()` + +Next, we take the speech recognition as an example to introduce how to define a new `Task`. For the corresponding code, please see `ASRTask` in `funasr/tasks/asr.py`. The procedure of defining a new `Task` is actually the procedure of redefining the above functions according to the requirements of the specified `Task`. + +- add_task_arguments +```python +@classmethod +def add_task_arguments(cls, parser: argparse.ArgumentParser): + group = parser.add_argument_group(description="Task related") + group.add_argument( + "--token_list", + type=str_or_none, + default=None, + help="A text mapping int-id to token", + ) + (...) +``` +For speech recognition tasks, specific parameters required include `token_list`, etc. According to the specific requirements of different tasks, users can define corresponding parameters in this function. + +- build_preprocess_fn +```python +@classmethod +def build_preprocess_fn(cls, args, train): + if args.use_preprocessor: + retval = CommonPreprocessor( + train=train, + token_type=args.token_type, + token_list=args.token_list, + bpemodel=args.bpemodel, + non_linguistic_symbols=args.non_linguistic_symbols, + text_cleaner=args.cleaner, + ... + ) + else: + retval = None + return retval +``` +This function defines how to preprocess samples. Specifically, the input of speech recognition tasks includes speech and text. For speech, functions such as (optional) adding noise and reverberation to the speech are supported. For text, functions such as (optional) processing text according to bpe and mapping text to `tokenid` are supported. Users can choose the preprocessing operation that needs to be performed on the sample. For the detail implementation, please refer to `CommonPreprocessor`. + +- build_collate_fn +```python +@classmethod +def build_collate_fn(cls, args, train): + return CommonCollateFn(float_pad_value=0.0, int_pad_value=-1) +``` +This function defines how to combine multiple samples into a `batch`. For speech recognition tasks, `padding` is employed to obtain equal-length data from different speech and text. Specifically, we set `0.0` as the default padding value for speech and `-1` as the default padding value for text. Users can define different `batch` operations here. For the detail implementation, please refer to `CommonCollateFn`. + +- build_model +```python +@classmethod +def build_model(cls, args, train): + with open(args.token_list, encoding="utf-8") as f: + token_list = [line.rstrip() for line in f] + vocab_size = len(token_list) + frontend = frontend_class(**args.frontend_conf) + specaug = specaug_class(**args.specaug_conf) + normalize = normalize_class(**args.normalize_conf) + preencoder = preencoder_class(**args.preencoder_conf) + encoder = encoder_class(input_size=input_size, **args.encoder_conf) + postencoder = postencoder_class(input_size=encoder_output_size, **args.postencoder_conf) + decoder = decoder_class(vocab_size=vocab_size, encoder_output_size=encoder_output_size, **args.decoder_conf) + ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **args.ctc_conf) + model = model_class( + vocab_size=vocab_size, + frontend=frontend, + specaug=specaug, + normalize=normalize, + preencoder=preencoder, + encoder=encoder, + postencoder=postencoder, + decoder=decoder, + ctc=ctc, + token_list=token_list, + **args.model_conf, + ) + return model +``` +This function defines the detail of the model. For different speech recognition models, the same speech recognition `Task` can usually be shared and the remaining thing needed to be done is to define a specific model in this function. For example, a speech recognition model with a standard encoder-decoder structure has been shown above. Specifically, it first defines each module of the model, including encoder, decoder, etc. and then combine these modules together to generate a complete model. In FunASR, the model needs to inherit `FunASRModel` and the corresponding code can be seen in `funasr/train/abs_espnet_model.py`. The main function needed to be implemented is the `forward` function. + +Next, we take `SANMEncoder` as an example to introduce how to use a custom encoder as a part of the model when defining the specified model and the corresponding code can be seen in `funasr/models/encoder/sanm_encoder.py`. For a custom encoder, in addition to inheriting the common encoder class `AbsEncoder`, it is also necessary to define the `forward` function to achieve the forward computation of the `encoder`. After defining the `encoder`, it should also be registered in the `Task`. The corresponding code example can be seen as below: +```python +encoder_choices = ClassChoices( + "encoder", + classes=dict( + conformer=ConformerEncoder, + transformer=TransformerEncoder, + rnn=RNNEncoder, + sanm=SANMEncoder, + sanm_chunk_opt=SANMEncoderChunkOpt, + data2vec_encoder=Data2VecEncoder, + mfcca_enc=MFCCAEncoder, + ), + type_check=AbsEncoder, + default="rnn", +) +``` +In this code, `sanm=SANMEncoder` takes the newly defined `SANMEncoder` as an optional choice of the `encoder`. Once the user specifies the `encoder` as `sanm` in the configuration file, the `SANMEncoder` will be correspondingly employed as the `encoder` module of the model. \ No newline at end of file diff --git a/docs/reference/papers.md b/docs/reference/papers.md new file mode 100644 index 0000000..aa04dfc --- /dev/null +++ b/docs/reference/papers.md @@ -0,0 +1,38 @@ +# Papers + +FunASR have implemented the following paper code + +### Speech Recognition +- [FunASR: A Fundamental End-to-End Speech Recognition Toolkit](https://arxiv.org/abs/2305.11013), INTERSPEECH 2023 +- [BAT: Boundary aware transducer for memory-efficient and low-latency ASR](https://arxiv.org/abs/2305.11571), INTERSPEECH 2023 +- [Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition](https://arxiv.org/abs/2206.08317), INTERSPEECH 2022 +- [E-branchformer: Branchformer with enhanced merging for speech recognition](https://arxiv.org/abs/2210.00077), SLT 2022 +- [Branchformer: Parallel mlp-attention architectures to capture local and global context for speech recognition and understanding](https://proceedings.mlr.press/v162/peng22a.html?ref=https://githubhelp.com), ICML 2022 +- [Universal ASR: Unifying Streaming and Non-Streaming ASR Using a Single Encoder-Decoder Model](https://arxiv.org/abs/2010.14099), arXiv preprint arXiv:2010.14099, 2020 +- [San-m: Memory equipped self-attention for end-to-end speech recognition](https://arxiv.org/pdf/2006.01713), INTERSPEECH 2020 +- [Streaming Chunk-Aware Multihead Attention for Online End-to-End Speech Recognition](https://arxiv.org/abs/2006.01712), INTERSPEECH 2020 +- [Conformer: Convolution-augmented Transformer for Speech Recognition](https://arxiv.org/abs/2005.08100), INTERSPEECH 2020 +- [Sequence-to-sequence learning with Transducers](https://arxiv.org/pdf/1211.3711.pdf), NIPS 2016 + + +### Multi-talker Speech Recognition +- [MFCCA:Multi-Frame Cross-Channel attention for multi-speaker ASR in Multi-party meeting scenario](https://arxiv.org/abs/2210.05265), ICASSP 2022 + +### Voice Activity Detection +- [Deep-FSMN for Large Vocabulary Continuous Speech Recognition](https://arxiv.org/abs/1803.05030), ICASSP 2018 + +### Punctuation Restoration +- [CT-Transformer: Controllable time-delay transformer for real-time punctuation prediction and disfluency detection](https://arxiv.org/pdf/2003.01309.pdf), ICASSP 2018 + +### Language Models +- [Attention Is All You Need](https://arxiv.org/abs/1706.03762), NEURIPS 2017 + +### Speaker Verification +- [X-VECTORS: ROBUST DNN EMBEDDINGS FOR SPEAKER RECOGNITION](https://www.danielpovey.com/files/2018_icassp_xvectors.pdf), ICASSP 2018 + +### Speaker diarization +- [Speaker Overlap-aware Neural Diarization for Multi-party Meeting Analysis](https://arxiv.org/abs/2211.10243), EMNLP 2022 +- [TOLD: A Novel Two-Stage Overlap-Aware Framework for Speaker Diarization](https://arxiv.org/abs/2303.05397), ICASSP 2023 + +### Timestamp Prediction +- [Achieving Timestamp Prediction While Recognizing with Non-Autoregressive End-to-End ASR Model](https://arxiv.org/abs/2301.12343), arXiv:2301.12343 diff --git a/docs/tutorial/README.md b/docs/tutorial/README.md new file mode 100644 index 0000000..f87d5fa --- /dev/null +++ b/docs/tutorial/README.md @@ -0,0 +1,424 @@ +([简体中文](./README_zh.md)|English) + +FunASR has open-sourced a large number of pre-trained models on industrial data. You are free to use, copy, modify, and share FunASR models under the [Model License Agreement](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE). Below, we list some representative models. For a comprehensive list, please refer to our [Model Zoo](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo). + + + + +## Model Inference + +### Quick Start + +For command-line invocation: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +For python code invocation (recommended): + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### API Description +#### AutoModel Definition +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): model name in the [Model Repository](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo), or a model path on local disk. +- `device`(str): `cuda:0` (default gpu0) for using GPU for inference, specify `cpu` for using CPU. +- `ncpu`(int): `4` (default), sets the number of threads for CPU internal operations. +- `output_dir`(str): `None` (default), set this to specify the output path for the results. +- `batch_size`(int): `1` (default), the number of samples per batch during decoding. +- `hub`(str):`ms` (default) to download models from ModelScope. Use `hf` to download models from Hugging Face. +- `**kwargs`(dict): Any parameters found in config.yaml can be directly specified here, for instance, the maximum segmentation length in the vad model max_single_segment_time=6000 (milliseconds). + +#### AutoModel Inference +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: The input to be decoded, which could be: + - A wav file path, e.g., asr_example.wav + - A pcm file path, e.g., asr_example.pcm, in this case, specify the audio sampling rate fs (default is 16000) + - An audio byte stream, e.g., byte data from a microphone + - A wav.scp, a Kaldi-style wav list (wav_id \t wav_path), for example: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + When using wav.scp as input, you must set output_dir to save the output results. + - Audio samples, `e.g.`: `audio, rate = soundfile.read("asr_example_zh.wav")`, data type is numpy.ndarray. Supports batch inputs, type is list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank input, supports batch grouping. Shape is [batch, frames, dim], type is torch.Tensor. +- `output_dir`: None (default), if set, specifies the output path for the results. +- `**kwargs`(dict): Inference parameters related to the model, for example,`beam_size=10`,`decoding_ctc_weight=0.1`. + + +### More Usage Introduction + + +#### Speech Recognition (Non-streaming) +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +Notes: +- Typically, the input duration for models is limited to under 30 seconds. However, when combined with `vad_model`, support for audio input of any length is enabled, not limited to the paraformer model—any audio input model can be used. +- Parameters related to model can be directly specified in the definition of AutoModel; parameters related to `vad_model` can be set through `vad_kwargs`, which is a dict; similar parameters include `punc_kwargs` and `spk_kwargs`. +- `max_single_segment_time`: Denotes the maximum audio segmentation length for `vad_model`, measured in milliseconds (ms). +- `batch_size_s` represents the use of dynamic batching, where the total audio duration within a batch is measured in seconds (s). +- `batch_size_threshold_s`: Indicates that when the duration of an audio segment post-VAD segmentation exceeds the batch_size_threshold_s threshold, the batch size is set to 1, measured in seconds (s). + +Recommendations: + +When you input long audio and encounter Out Of Memory (OOM) issues, since memory usage tends to increase quadratically with audio length, consider the following three scenarios: + +a) At the beginning of inference, memory usage primarily depends on `batch_size_s`. Appropriately reducing this value can decrease memory usage. +b) During the middle of inference, when encountering long audio segments cut by VAD and the total token count is less than `batch_size_s`, yet still facing OOM, you can appropriately reduce `batch_size_threshold_s`. If the threshold is exceeded, the batch size is forced to 1. +c) Towards the end of inference, if long audio segments cut by VAD have a total token count less than `batch_size_s` and exceed the `threshold` batch_size_threshold_s, forcing the batch size to 1 and still facing OOM, you may reduce `max_single_segment_time` to shorten the VAD audio segment length. + +#### Speech Recognition (Streaming) +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` +Note: `chunk_size` is the configuration for streaming latency.` [0,10,5]` indicates that the real-time display granularity is `10*60=600ms`, and the lookahead information is `5*60=300ms`. Each inference input is `600ms` (sample points are `16000*0.6=960`), and the output is the corresponding text. For the last speech segment input, `is_final=True` needs to be set to force the output of the last word. + +#### Voice Activity Detection (Non-Streaming) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +Note: The output format of the VAD model is: `[[beg1, end1], [beg2, end2], ..., [begN, endN]]`, where `begN/endN` indicates the starting/ending point of the `N-th` valid audio segment, measured in milliseconds. + +#### Voice Activity Detection (Streaming) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +Note: The output format for the streaming VAD model can be one of four scenarios: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:The same as the offline VAD output result mentioned above. +- `[[beg, -1]]`:Indicates that only a starting point has been detected. +- `[[-1, end]]`:Indicates that only an ending point has been detected. +- `[]`:Indicates that neither a starting point nor an ending point has been detected. + +The output is measured in milliseconds and represents the absolute time from the starting point. +#### Punctuation Restoration +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` +#### Timestamp Prediction +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` + +More examples ref to [docs](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining) + + +## Model Training and Testing + +### Quick Start + +Execute via command line (for quick testing, not recommended): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +Execute with Python code (supports multi-node and multi-GPU, recommended): + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +Full code ref to [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### Detailed Parameter Description: + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str): The name of the model (the ID in the model repository), at which point the script will automatically download the model to local storage; alternatively, the path to a model already downloaded locally. +- `train_data_set_list`(str): The path to the training data, typically in jsonl format, for specific details refer to [examples](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list). +- `valid_data_set_list`(str):The path to the validation data, also generally in jsonl format, for specific details refer to examples](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list). +- `dataset_conf.batch_type`(str):example (default), the type of batch. example means batches are formed with a fixed number of batch_size samples; length or token means dynamic batching, with total length or number of tokens of the batch equalling batch_size. +- `dataset_conf.batch_size`(int):Used in conjunction with batch_type. When batch_type=example, it represents the number of samples; when batch_type=length, it represents the length of the samples, measured in fbank frames (1 frame = 10 ms) or the number of text tokens. +- `train_conf.max_epoch`(int):The total number of epochs for training. +- `train_conf.log_interval`(int):The number of steps between logging. +- `train_conf.resume`(int):Whether to enable checkpoint resuming for training. +- `train_conf.validate_interval`(int):The interval in steps to run validation tests during training. +- `train_conf.save_checkpoint_interval`(int):The interval in steps for saving the model during training. +- `train_conf.keep_nbest_models`(int):The maximum number of model parameters to retain, sorted by validation set accuracy, from highest to lowest. +- `train_conf.avg_nbest_model`(int):Average over the top n models with the highest accuracy. +- `optim_conf.lr`(float):The learning rate. +- `output_dir`(str):The path for saving the model. +- `**kwargs`(dict): Any parameters in config.yaml can be specified directly here, for example, to filter out audio longer than 20s: dataset_conf.max_token_length=2000, measured in fbank frames (1 frame = 10 ms) or the number of text tokens. + +#### Multi-GPU Training +##### Single-Machine Multi-GPU Training +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes represents the total number of participating nodes, while --nproc_per_node indicates the number of processes running on each node. + +##### Multi-Machine Multi-GPU Training + +On the master node, assuming the IP is 192.168.1.1 and the port is 12345, and you're using 2 GPUs, you would run the following command: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr=192.168.1.1 --master_port=12345 \ +../../../funasr/bin/train.py ${train_args} +``` +On the worker node (assuming the IP is 192.168.1.2), you need to ensure that the MASTER_ADDR and MASTER_PORT environment variables are set to match those of the master node, and then run the same command: + +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr=192.168.1.1 --master_port=12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes indicates the total number of nodes participating in the training, --node_rank represents the ID of the current node, and --nproc_per_node specifies the number of processes running on each node (usually corresponds to the number of GPUs). + +#### Data prepare + +`jsonl` ref to([demo](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list)). +The instruction scp2jsonl can be used to generate from wav.scp and text.txt. The preparation process for wav.scp and text.txt is as follows: + +`train_text.txt` + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`Command` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(Optional, not required) If you need to parse from jsonl back to wav.scp and text.txt, you can use the following command: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### Training log + +##### log.txt +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` + + +- `rank`:gpu id。 +- `epoch`,`step`,`total step`:the current epoch, step, and total steps. +- `loss_avg_rank`:the average loss across all GPUs for the current step. +- `loss/ppl/acc_avg_epoch`:the overall average loss/perplexity/accuracy for the current epoch, up to the current step count. The last step of the epoch when it ends represents the total average loss/perplexity/accuracy for that epoch; it is recommended to use the accuracy metric. +- `lr`:the learning rate for the current step. +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:the specific data for the current GPU ID. +- `total_time`:the total time taken for a single step. +- `GPU, memory`:the model-used/peak memory and the model+cache-used/peak memory. + +##### tensorboard +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +http://localhost:6006/ + +### 训练后模型测试 + + +#### With `configuration.json` file + +Assuming the training model path is: ./model_dir, if a configuration.json file has been generated in this directory, you only need to change the model name to the model path in the above model inference method. + +For example, for shell inference: +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` + +Python inference + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### Without `configuration.json` file + +If there is no configuration.json in the model path, you need to manually specify the exact configuration file path and the model path. + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +Parameter Introduction +- `config-path`:This is the path to the config.yaml saved during the experiment, which can be found in the experiment's output directory. +- `config-name`:The name of the configuration file, usually config.yaml. It supports both YAML and JSON formats, for example config.json. +- `init_param`:The model parameters that need to be tested, usually model.pt. You can choose a specific model file as needed. +- `tokenizer_conf.token_list`:The path to the vocabulary file, which is normally specified in config.yaml. There is no need to manually specify it again unless the path in config.yaml is incorrect, in which case the correct path must be manually specified here. +- `frontend_conf.cmvn_file`:The CMVN (Cepstral Mean and Variance Normalization) file used when extracting fbank features from WAV files, which is usually specified in config.yaml. There is no need to manually specify it again unless the path in config.yaml is incorrect, in which case the correct path must be manually specified here. + +Other parameters are the same as mentioned above. A complete [example](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) can be found here. + + +## Export ONNX + +### Command-line usage +```shell +funasr-export ++model=paraformer ++quantize=false ++device=cpu +``` + +### Python +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer", device="cpu") + +res = model.export(quantize=False) +``` + +### Test ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +More examples ref to [demo](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/docs/tutorial/README_zh.md b/docs/tutorial/README_zh.md new file mode 100644 index 0000000..b016f9e --- /dev/null +++ b/docs/tutorial/README_zh.md @@ -0,0 +1,436 @@ +(简体中文|[English](./README.md)) + +FunASR开源了大量在工业数据上预训练模型,您可以在 [模型许可协议](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE)下自由使用、复制、修改和分享FunASR模型,下面列举代表性的模型,更多模型请参考 [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo)。 + + + + +## 模型推理 + +### 快速使用 + +命令行方式调用: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +python代码调用(推荐) + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### 接口说明 + +#### AutoModel 定义 +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo) 中的模型名称,或本地磁盘中的模型路径 +- `device`(str): `cuda:0`(默认gpu0),使用 GPU 进行推理,指定。如果为`cpu`,则使用 CPU 进行推理 +- `ncpu`(int): `4` (默认),设置用于 CPU 内部操作并行性的线程数 +- `output_dir`(str): `None` (默认),如果设置,输出结果的输出路径 +- `batch_size`(int): `1` (默认),解码时的批处理,样本个数 +- `hub`(str):`ms`(默认),从modelscope下载模型。如果为`hf`,从huggingface下载模型。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,vad模型中最大切割长度 `max_single_segment_time=6000` (毫秒)。 + +#### AutoModel 推理 +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: 要解码的输入,可以是: + - wav文件路径, 例如: asr_example.wav + - pcm文件路径, 例如: asr_example.pcm,此时需要指定音频采样率fs(默认为16000) + - 音频字节数流,例如:麦克风的字节数数据 + - wav.scp,kaldi 样式的 wav 列表 (`wav_id \t wav_path`), 例如: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + 在这种输入 `wav.scp` 的情况下,必须设置 `output_dir` 以保存输出结果 + - 音频采样点,例如:`audio, rate = soundfile.read("asr_example_zh.wav")`, 数据类型为 numpy.ndarray。支持batch输入,类型为list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank输入,支持组batch。shape为[batch, frames, dim],类型为torch.Tensor,例如 +- `output_dir`: None (默认),如果设置,输出结果的输出路径 +- `**kwargs`(dict): 与模型相关的推理参数,例如,`beam_size=10`,`decoding_ctc_weight=0.1`。 + + +### 更多用法介绍 + + +#### 非实时语音识别 +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +注意: +- 通常模型输入限制时长30s以下,组合`vad_model`后,支持任意时长音频输入,不局限于paraformer模型,所有音频输入模型均可以。 +- `model`相关的参数可以直接在`AutoModel`定义中直接指定;与`vad_model`相关参数可以通过`vad_kwargs`来指定,类型为dict;类似的有`punc_kwargs`,`spk_kwargs`; +- `max_single_segment_time`: 表示`vad_model`最大切割音频时长, 单位是毫秒ms. +- `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。 +- `batch_size_threshold_s`: 表示`vad_model`切割后音频片段时长超过 `batch_size_threshold_s`阈值时,将batch_size数设置为1, 单位为秒s. + +建议:当您输入为长音频,遇到OOM问题时,因为显存占用与音频时长呈平方关系增加,分为3种情况: +- a)推理起始阶段,显存主要取决于`batch_size_s`,适当减小该值,可以减少显存占用; +- b)推理中间阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,仍然出现OOM,可以适当减小`batch_size_threshold_s`,超过阈值,强制batch为1; +- c)推理快结束阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,且超过阈值`batch_size_threshold_s`,强制batch为1,仍然出现OOM,可以适当减小`max_single_segment_time`,使得VAD切割音频时长变短。 + +#### 实时语音识别 + +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` + +注:`chunk_size`为流式延时配置,`[0,10,5]`表示上屏实时出字粒度为`10*60=600ms`,未来信息为`5*60=300ms`。每次推理输入为`600ms`(采样点数为`16000*0.6=960`),输出为对应文字,最后一个语音片段输入需要设置`is_final=True`来强制输出最后一个字。 + +#### 语音端点检测(非实时) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") + +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +注:VAD模型输出格式为:`[[beg1, end1], [beg2, end2], .., [begN, endN]]`,其中`begN/endN`表示第`N`个有效音频片段的起始点/结束点, +单位为毫秒。 + +#### 语音端点检测(实时) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +注:流式VAD模型输出格式为4种情况: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:同上离线VAD输出结果。 +- `[[beg, -1]]`:表示只检测到起始点。 +- `[[-1, end]]`:表示只检测到结束点。 +- `[]`:表示既没有检测到起始点,也没有检测到结束点 +输出结果单位为毫秒,从起始点开始的绝对时间。 + +#### 标点恢复 +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") + +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` + +#### 时间戳预测 +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") + +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` +更多([示例](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)) + + +## 模型训练与测试 + +### 快速开始 + +命令行执行(用于快速测试,不推荐): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +python代码执行(可以多机多卡,推荐) + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +详细完整的脚本参考 [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### 详细参数介绍 + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str):模型名字(模型仓库中的ID),此时脚本会自动下载模型到本读;或者本地已经下载好的模型路径。 +- `train_data_set_list`(str):训练数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `valid_data_set_list`(str):验证数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `dataset_conf.batch_type`(str):`example`(默认),batch的类型。`example`表示按照固定数目batch_size个样本组batch;`length` or `token` 表示动态组batch,batch总长度或者token数为batch_size。 +- `dataset_conf.batch_size`(int):与 `batch_type` 搭配使用,当 `batch_type=example` 时,表示样本个数;当 `batch_type=length` 时,表示样本中长度,单位为fbank帧数(1帧10ms)或者文字token个数。 +- `train_conf.max_epoch`(int):`100`(默认),训练总epoch数。 +- `train_conf.log_interval`(int):`50`(默认),打印日志间隔step数。 +- `train_conf.resume`(int):`True`(默认),是否开启断点重训。 +- `train_conf.validate_interval`(int):`5000`(默认),训练中做验证测试的间隔step数。 +- `train_conf.save_checkpoint_interval`(int):`5000`(默认),训练中模型保存间隔step数。 +- `train_conf.avg_keep_nbest_models_type`(str):`acc`(默认),保留nbest的标准为acc(越大越好)。`loss`表示,保留nbest的标准为loss(越小越好)。 +- `train_conf.keep_nbest_models`(int):`500`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 保留最佳的n个模型,其他删除,节约存储空间。 +- `train_conf.avg_nbest_model`(int):`10`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 对最佳的n个模型平均。 +- `train_conf.accum_grad`(int):`1`(默认),梯度累积功能。 +- `train_conf.grad_clip`(float):`10.0`(默认),梯度截断功能。 +- `train_conf.use_fp16`(bool):`False`(默认),开启fp16训练,加快训练速度。 +- `optim_conf.lr`(float):学习率。 +- `output_dir`(str):模型保存路径。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,过滤20s以上长音频:`dataset_conf.max_token_length=2000`,单位为音频fbank帧数(1帧10ms)或者文字token个数。 + +#### 多gpu训练 +##### 单机多gpu训练 +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes 表示参与的节点总数,--nproc_per_node 表示每个节点上运行的进程数 + +##### 多机多gpu训练 + +在主节点上,假设IP为192.168.1.1,端口为12345,使用的是2个GPU,则运行如下命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +在从节点上(假设IP为192.168.1.2),你需要确保MASTER_ADDR和MASTER_PORT环境变量与主节点设置的一致,并运行同样的命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes 表示参与的节点总数,--node_rank 表示当前节点id,--nproc_per_node 表示每个节点上运行的进程数(通常为gpu个数) + +#### 准备数据 + +`jsonl`格式可以参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +可以用指令 `scp2jsonl` 从wav.scp与text.txt生成。wav.scp与text.txt准备过程如下: + +`train_text.txt` + +左边为数据唯一ID,需与`train_wav.scp`中的`ID`一一对应 +右边为音频文件标注文本,格式如下: + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + +左边为数据唯一ID,需与`train_text.txt`中的`ID`一一对应 +右边为音频文件的路径,格式如下 + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`生成指令` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(可选,非必需)如果需要从jsonl解析成wav.scp与text.txt,可以使用指令: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### 查看训练日志 + +##### 查看实验log +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` +指标解释: +- `rank`:表示gpu id。 +- `epoch`,`step`,`total step`:表示当前epoch,step,总step。 +- `loss_avg_rank`:表示当前step,所有gpu平均loss。 +- `loss/ppl/acc_avg_epoch`:表示当前epoch周期,截止当前step数时,总平均loss/ppl/acc。epoch结束时的最后一个step表示epoch总平均loss/ppl/acc,推荐使用acc指标。 +- `lr`:当前step的学习率。 +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:表示当前gpu id的具体数据。 +- `total_time`:表示单个step总耗时。 +- `GPU, memory`:分别表示,模型使用/峰值显存,模型+缓存使用/峰值显存。 + +##### tensorboard可视化 +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +浏览器中打开:http://localhost:6006/ + +### 训练后模型测试 + + +#### 有configuration.json + +假定,训练模型路径为:./model_dir,如果改目录下有生成configuration.json,只需要将 [上述模型推理方法](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/README_zh.md#%E6%A8%A1%E5%9E%8B%E6%8E%A8%E7%90%86) 中模型名字修改为模型路径即可 + +例如: + +从shell推理 +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` +从python推理 + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### 无configuration.json时 + +如果模型路径中无configuration.json时,需要手动指定具体配置文件路径与模型路径 + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +参数介绍 +- `config-path`:为实验中保存的 `config.yaml`,可以从实验输出目录中查找。 +- `config-name`:配置文件名,一般为 `config.yaml`,支持yaml格式与json格式,例如 `config.json` +- `init_param`:需要测试的模型参数,一般为`model.pt`,可以自己选择具体的模型文件 +- `tokenizer_conf.token_list`:词表文件路径,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 +- `frontend_conf.cmvn_file`:wav提取fbank中用到的cmvn文件,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 + +其他参数同上,完整 [示例](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) + + + +## 模型导出与测试 +### 从命令行导出 +```shell +funasr-export ++model=paraformer ++quantize=false +``` + +### 从Python导出 +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer") + +res = model.export(quantize=False) +``` + +### 测试ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +更多例子请参考 [样例](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..0191a2d --- /dev/null +++ b/examples/README.md @@ -0,0 +1,424 @@ +([简体中文](./README_zh.md)|English) + +FunASR has open-sourced a large number of pre-trained models on industrial data. You are free to use, copy, modify, and share FunASR models under the [Model License Agreement](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE). Below, we list some representative models. For a comprehensive list, please refer to our [Model Zoo](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo). + + + + +## Model Inference + +### Quick Start + +For command-line invocation: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +For python code invocation (recommended): + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### API Description +#### AutoModel Definition +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): model name in the [Model Repository](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo), or a model path on local disk. +- `device`(str): `cuda:0` (default gpu0) for using GPU for inference, specify `cpu` for using CPU. +- `ncpu`(int): `4` (default), sets the number of threads for CPU internal operations. +- `output_dir`(str): `None` (default), set this to specify the output path for the results. +- `batch_size`(int): `1` (default), the number of samples per batch during decoding. +- `hub`(str):`ms` (default) to download models from ModelScope. Use `hf` to download models from Hugging Face. +- `**kwargs`(dict): Any parameters found in config.yaml can be directly specified here, for instance, the maximum segmentation length in the vad model max_single_segment_time=6000 (milliseconds). + +#### AutoModel Inference +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: The input to be decoded, which could be: + - A wav file path, e.g., asr_example.wav + - A pcm file path, e.g., asr_example.pcm, in this case, specify the audio sampling rate fs (default is 16000) + - An audio byte stream, e.g., byte data from a microphone + - A wav.scp, a Kaldi-style wav list (wav_id \t wav_path), for example: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + When using wav.scp as input, you must set output_dir to save the output results. + - Audio samples, `e.g.`: `audio, rate = soundfile.read("asr_example_zh.wav")`, data type is numpy.ndarray. Supports batch inputs, type is list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank input, supports batch grouping. Shape is [batch, frames, dim], type is torch.Tensor. +- `output_dir`: None (default), if set, specifies the output path for the results. +- `**kwargs`(dict): Inference parameters related to the model, for example,`beam_size=10`,`decoding_ctc_weight=0.1`. + + +### More Usage Introduction + + +#### Speech Recognition (Non-streaming) +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +Notes: +- Typically, the input duration for models is limited to under 30 seconds. However, when combined with `vad_model`, support for audio input of any length is enabled, not limited to the paraformer model—any audio input model can be used. +- Parameters related to model can be directly specified in the definition of AutoModel; parameters related to `vad_model` can be set through `vad_kwargs`, which is a dict; similar parameters include `punc_kwargs` and `spk_kwargs`. +- `max_single_segment_time`: Denotes the maximum audio segmentation length for `vad_model`, measured in milliseconds (ms). +- `batch_size_s` represents the use of dynamic batching, where the total audio duration within a batch is measured in seconds (s). +- `batch_size_threshold_s`: Indicates that when the duration of an audio segment post-VAD segmentation exceeds the batch_size_threshold_s threshold, the batch size is set to 1, measured in seconds (s). + +Recommendations: + +When you input long audio and encounter Out Of Memory (OOM) issues, since memory usage tends to increase quadratically with audio length, consider the following three scenarios: + +a) At the beginning of inference, memory usage primarily depends on `batch_size_s`. Appropriately reducing this value can decrease memory usage. +b) During the middle of inference, when encountering long audio segments cut by VAD and the total token count is less than `batch_size_s`, yet still facing OOM, you can appropriately reduce `batch_size_threshold_s`. If the threshold is exceeded, the batch size is forced to 1. +c) Towards the end of inference, if long audio segments cut by VAD have a total token count less than `batch_size_s` and exceed the `threshold` batch_size_threshold_s, forcing the batch size to 1 and still facing OOM, you may reduce `max_single_segment_time` to shorten the VAD audio segment length. + +#### Speech Recognition (Streaming) +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` +Note: `chunk_size` is the configuration for streaming latency.` [0,10,5]` indicates that the real-time display granularity is `10*60=600ms`, and the lookahead information is `5*60=300ms`. Each inference input is `600ms` (sample points are `16000*0.6=960`), and the output is the corresponding text. For the last speech segment input, `is_final=True` needs to be set to force the output of the last word. + +#### Voice Activity Detection (Non-Streaming) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +Note: The output format of the VAD model is: `[[beg1, end1], [beg2, end2], ..., [begN, endN]]`, where `begN/endN` indicates the starting/ending point of the `N-th` valid audio segment, measured in milliseconds. + +#### Voice Activity Detection (Streaming) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +Note: The output format for the streaming VAD model can be one of four scenarios: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:The same as the offline VAD output result mentioned above. +- `[[beg, -1]]`:Indicates that only a starting point has been detected. +- `[[-1, end]]`:Indicates that only an ending point has been detected. +- `[]`:Indicates that neither a starting point nor an ending point has been detected. + +The output is measured in milliseconds and represents the absolute time from the starting point. +#### Punctuation Restoration +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` +#### Timestamp Prediction +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` + +More examples ref to [docs](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining) + + +## Model Training and Testing + +### Quick Start + +Execute via command line (for quick testing, not recommended): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +Execute with Python code (supports multi-node and multi-GPU, recommended): + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +Full code ref to [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### Detailed Parameter Description: + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str): The name of the model (the ID in the model repository), at which point the script will automatically download the model to local storage; alternatively, the path to a model already downloaded locally. +- `train_data_set_list`(str): The path to the training data, typically in jsonl format, for specific details refer to [examples](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list). +- `valid_data_set_list`(str):The path to the validation data, also generally in jsonl format, for specific details refer to examples](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list). +- `dataset_conf.batch_type`(str):example (default), the type of batch. example means batches are formed with a fixed number of batch_size samples; length or token means dynamic batching, with total length or number of tokens of the batch equalling batch_size. +- `dataset_conf.batch_size`(int):Used in conjunction with batch_type. When batch_type=example, it represents the number of samples; when batch_type=length, it represents the length of the samples, measured in fbank frames (1 frame = 10 ms) or the number of text tokens. +- `train_conf.max_epoch`(int):The total number of epochs for training. +- `train_conf.log_interval`(int):The number of steps between logging. +- `train_conf.resume`(int):Whether to enable checkpoint resuming for training. +- `train_conf.validate_interval`(int):The interval in steps to run validation tests during training. +- `train_conf.save_checkpoint_interval`(int):The interval in steps for saving the model during training. +- `train_conf.keep_nbest_models`(int):The maximum number of model parameters to retain, sorted by validation set accuracy, from highest to lowest. +- `train_conf.avg_nbest_model`(int):Average over the top n models with the highest accuracy. +- `optim_conf.lr`(float):The learning rate. +- `output_dir`(str):The path for saving the model. +- `**kwargs`(dict): Any parameters in config.yaml can be specified directly here, for example, to filter out audio longer than 20s: dataset_conf.max_token_length=2000, measured in fbank frames (1 frame = 10 ms) or the number of text tokens. + +#### Multi-GPU Training +##### Single-Machine Multi-GPU Training +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes represents the total number of participating nodes, while --nproc_per_node indicates the number of processes running on each node. --master_port indicates the port is 12345 + +##### Multi-Machine Multi-GPU Training + +On the master node, assuming the IP is 192.168.1.1 and the port is 12345, and you're using 2 GPUs, you would run the following command: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +On the worker node (assuming the IP is 192.168.1.2), you need to ensure that the MASTER_ADDR and MASTER_PORT environment variables are set to match those of the master node, and then run the same command: + +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes indicates the total number of nodes participating in the training, --node_rank represents the ID of the current node, and --nproc_per_node specifies the number of processes running on each node (usually corresponds to the number of GPUs). + +#### Data prepare + +`jsonl` ref to([demo](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list)). +The instruction scp2jsonl can be used to generate from wav.scp and text.txt. The preparation process for wav.scp and text.txt is as follows: + +`train_text.txt` + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`Command` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(Optional, not required) If you need to parse from jsonl back to wav.scp and text.txt, you can use the following command: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### Training log + +##### log.txt +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` + + +- `rank`:gpu id。 +- `epoch`,`step`,`total step`:the current epoch, step, and total steps. +- `loss_avg_rank`:the average loss across all GPUs for the current step. +- `loss/ppl/acc_avg_epoch`:the overall average loss/perplexity/accuracy for the current epoch, up to the current step count. The last step of the epoch when it ends represents the total average loss/perplexity/accuracy for that epoch; it is recommended to use the accuracy metric. +- `lr`:the learning rate for the current step. +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:the specific data for the current GPU ID. +- `total_time`:the total time taken for a single step. +- `GPU, memory`:the model-used/peak memory and the model+cache-used/peak memory. + +##### tensorboard +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +http://localhost:6006/ + +### 训练后模型测试 + + +#### With `configuration.json` file + +Assuming the training model path is: ./model_dir, if a configuration.json file has been generated in this directory, you only need to change the model name to the model path in the above model inference method. + +For example, for shell inference: +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` + +Python inference + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### Without `configuration.json` file + +If there is no configuration.json in the model path, you need to manually specify the exact configuration file path and the model path. + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +Parameter Introduction +- `config-path`:This is the path to the config.yaml saved during the experiment, which can be found in the experiment's output directory. +- `config-name`:The name of the configuration file, usually config.yaml. It supports both YAML and JSON formats, for example config.json. +- `init_param`:The model parameters that need to be tested, usually model.pt. You can choose a specific model file as needed. +- `tokenizer_conf.token_list`:The path to the vocabulary file, which is normally specified in config.yaml. There is no need to manually specify it again unless the path in config.yaml is incorrect, in which case the correct path must be manually specified here. +- `frontend_conf.cmvn_file`:The CMVN (Cepstral Mean and Variance Normalization) file used when extracting fbank features from WAV files, which is usually specified in config.yaml. There is no need to manually specify it again unless the path in config.yaml is incorrect, in which case the correct path must be manually specified here. + +Other parameters are the same as mentioned above. A complete [example](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) can be found here. + + +## Export ONNX + +### Command-line usage +```shell +funasr-export ++model=paraformer ++quantize=false ++device=cpu +``` + +### Python +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer", device="cpu") + +res = model.export(quantize=False) +``` + +### Test ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +More examples ref to [demo](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/examples/README_zh.md b/examples/README_zh.md new file mode 100644 index 0000000..b0a6665 --- /dev/null +++ b/examples/README_zh.md @@ -0,0 +1,436 @@ +(简体中文|[English](./README.md)) + +FunASR开源了大量在工业数据上预训练模型,您可以在 [模型许可协议](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE)下自由使用、复制、修改和分享FunASR模型,下面列举代表性的模型,更多模型请参考 [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo)。 + + + + +## 模型推理 + +### 快速使用 + +命令行方式调用: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +python代码调用(推荐) + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### 接口说明 + +#### AutoModel 定义 +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo) 中的模型名称,或本地磁盘中的模型路径 +- `device`(str): `cuda:0`(默认gpu0),使用 GPU 进行推理,指定。如果为`cpu`,则使用 CPU 进行推理 +- `ncpu`(int): `4` (默认),设置用于 CPU 内部操作并行性的线程数 +- `output_dir`(str): `None` (默认),如果设置,输出结果的输出路径 +- `batch_size`(int): `1` (默认),解码时的批处理,样本个数 +- `hub`(str):`ms`(默认),从modelscope下载模型。如果为`hf`,从huggingface下载模型。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,vad模型中最大切割长度 `max_single_segment_time=6000` (毫秒)。 + +#### AutoModel 推理 +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: 要解码的输入,可以是: + - wav文件路径, 例如: asr_example.wav + - pcm文件路径, 例如: asr_example.pcm,此时需要指定音频采样率fs(默认为16000) + - 音频字节数流,例如:麦克风的字节数数据 + - wav.scp,kaldi 样式的 wav 列表 (`wav_id \t wav_path`), 例如: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + 在这种输入 `wav.scp` 的情况下,必须设置 `output_dir` 以保存输出结果 + - 音频采样点,例如:`audio, rate = soundfile.read("asr_example_zh.wav")`, 数据类型为 numpy.ndarray。支持batch输入,类型为list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank输入,支持组batch。shape为[batch, frames, dim],类型为torch.Tensor,例如 +- `output_dir`: None (默认),如果设置,输出结果的输出路径 +- `**kwargs`(dict): 与模型相关的推理参数,例如,`beam_size=10`,`decoding_ctc_weight=0.1`。 + + +### 更多用法介绍 + + +#### 非实时语音识别 +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +注意: +- 通常模型输入限制时长30s以下,组合`vad_model`后,支持任意时长音频输入,不局限于paraformer模型,所有音频输入模型均可以。 +- `model`相关的参数可以直接在`AutoModel`定义中直接指定;与`vad_model`相关参数可以通过`vad_kwargs`来指定,类型为dict;类似的有`punc_kwargs`,`spk_kwargs`; +- `max_single_segment_time`: 表示`vad_model`最大切割音频时长, 单位是毫秒ms. +- `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。 +- `batch_size_threshold_s`: 表示`vad_model`切割后音频片段时长超过 `batch_size_threshold_s`阈值时,将batch_size数设置为1, 单位为秒s. + +建议:当您输入为长音频,遇到OOM问题时,因为显存占用与音频时长呈平方关系增加,分为3种情况: +- a)推理起始阶段,显存主要取决于`batch_size_s`,适当减小该值,可以减少显存占用; +- b)推理中间阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,仍然出现OOM,可以适当减小`batch_size_threshold_s`,超过阈值,强制batch为1; +- c)推理快结束阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,且超过阈值`batch_size_threshold_s`,强制batch为1,仍然出现OOM,可以适当减小`max_single_segment_time`,使得VAD切割音频时长变短。 + +#### 实时语音识别 + +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` + +注:`chunk_size`为流式延时配置,`[0,10,5]`表示上屏实时出字粒度为`10*60=600ms`,未来信息为`5*60=300ms`。每次推理输入为`600ms`(采样点数为`16000*0.6=960`),输出为对应文字,最后一个语音片段输入需要设置`is_final=True`来强制输出最后一个字。 + +#### 语音端点检测(非实时) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") + +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +注:VAD模型输出格式为:`[[beg1, end1], [beg2, end2], .., [begN, endN]]`,其中`begN/endN`表示第`N`个有效音频片段的起始点/结束点, +单位为毫秒。 + +#### 语音端点检测(实时) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +注:流式VAD模型输出格式为4种情况: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:同上离线VAD输出结果。 +- `[[beg, -1]]`:表示只检测到起始点。 +- `[[-1, end]]`:表示只检测到结束点。 +- `[]`:表示既没有检测到起始点,也没有检测到结束点 +输出结果单位为毫秒,从起始点开始的绝对时间。 + +#### 标点恢复 +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") + +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` + +#### 时间戳预测 +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") + +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` +更多([示例](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)) + + +## 模型训练与测试 + +### 快速开始 + +命令行执行(用于快速测试,不推荐): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +python代码执行(可以多机多卡,推荐) + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +详细完整的脚本参考 [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### 详细参数介绍 + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str):模型名字(模型仓库中的ID),此时脚本会自动下载模型到本读;或者本地已经下载好的模型路径。 +- `train_data_set_list`(str):训练数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `valid_data_set_list`(str):验证数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `dataset_conf.batch_type`(str):`example`(默认),batch的类型。`example`表示按照固定数目batch_size个样本组batch;`length` or `token` 表示动态组batch,batch总长度或者token数为batch_size。 +- `dataset_conf.batch_size`(int):与 `batch_type` 搭配使用,当 `batch_type=example` 时,表示样本个数;当 `batch_type=length` 时,表示样本中长度,单位为fbank帧数(1帧10ms)或者文字token个数。 +- `train_conf.max_epoch`(int):`100`(默认),训练总epoch数。 +- `train_conf.log_interval`(int):`50`(默认),打印日志间隔step数。 +- `train_conf.resume`(int):`True`(默认),是否开启断点重训。 +- `train_conf.validate_interval`(int):`5000`(默认),训练中做验证测试的间隔step数。 +- `train_conf.save_checkpoint_interval`(int):`5000`(默认),训练中模型保存间隔step数。 +- `train_conf.avg_keep_nbest_models_type`(str):`acc`(默认),保留nbest的标准为acc(越大越好)。`loss`表示,保留nbest的标准为loss(越小越好)。 +- `train_conf.keep_nbest_models`(int):`500`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 保留最佳的n个模型,其他删除,节约存储空间。 +- `train_conf.avg_nbest_model`(int):`10`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 对最佳的n个模型平均。 +- `train_conf.accum_grad`(int):`1`(默认),梯度累积功能。 +- `train_conf.grad_clip`(float):`10.0`(默认),梯度截断功能。 +- `train_conf.use_fp16`(bool):`False`(默认),开启fp16训练,加快训练速度。 +- `optim_conf.lr`(float):学习率。 +- `output_dir`(str):模型保存路径。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,过滤20s以上长音频:`dataset_conf.max_token_length=2000`,单位为音频fbank帧数(1帧10ms)或者文字token个数。 + +#### 多gpu训练 +##### 单机多gpu训练 +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes 表示参与的节点总数,--nproc_per_node 表示每个节点上运行的进程数,--master_port 表示端口号 + +##### 多机多gpu训练 + +在主节点上,假设IP为192.168.1.1,端口为12345,使用的是2个GPU,则运行如下命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +在从节点上(假设IP为192.168.1.2),你需要确保MASTER_ADDR和MASTER_PORT环境变量与主节点设置的一致,并运行同样的命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes 表示参与的节点总数,--node_rank 表示当前节点id,--nproc_per_node 表示每个节点上运行的进程数(通常为gpu个数),--master_port 表示端口号 + +#### 准备数据 + +`jsonl`格式可以参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +可以用指令 `scp2jsonl` 从wav.scp与text.txt生成。wav.scp与text.txt准备过程如下: + +`train_text.txt` + +左边为数据唯一ID,需与`train_wav.scp`中的`ID`一一对应 +右边为音频文件标注文本,格式如下: + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + +左边为数据唯一ID,需与`train_text.txt`中的`ID`一一对应 +右边为音频文件的路径,格式如下 + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`生成指令` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(可选,非必需)如果需要从jsonl解析成wav.scp与text.txt,可以使用指令: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### 查看训练日志 + +##### 查看实验log +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` +指标解释: +- `rank`:表示gpu id。 +- `epoch`,`step`,`total step`:表示当前epoch,step,总step。 +- `loss_avg_rank`:表示当前step,所有gpu平均loss。 +- `loss/ppl/acc_avg_epoch`:表示当前epoch周期,截止当前step数时,总平均loss/ppl/acc。epoch结束时的最后一个step表示epoch总平均loss/ppl/acc,推荐使用acc指标。 +- `lr`:当前step的学习率。 +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:表示当前gpu id的具体数据。 +- `total_time`:表示单个step总耗时。 +- `GPU, memory`:分别表示,模型使用/峰值显存,模型+缓存使用/峰值显存。 + +##### tensorboard可视化 +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +浏览器中打开:http://localhost:6006/ + +### 训练后模型测试 + + +#### 有configuration.json + +假定,训练模型路径为:./model_dir,如果改目录下有生成configuration.json,只需要将 [上述模型推理方法](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/README_zh.md#%E6%A8%A1%E5%9E%8B%E6%8E%A8%E7%90%86) 中模型名字修改为模型路径即可 + +例如: + +从shell推理 +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` +从python推理 + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### 无configuration.json时 + +如果模型路径中无configuration.json时,需要手动指定具体配置文件路径与模型路径 + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +参数介绍 +- `config-path`:为实验中保存的 `config.yaml`,可以从实验输出目录中查找。 +- `config-name`:配置文件名,一般为 `config.yaml`,支持yaml格式与json格式,例如 `config.json` +- `init_param`:需要测试的模型参数,一般为`model.pt`,可以自己选择具体的模型文件 +- `tokenizer_conf.token_list`:词表文件路径,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 +- `frontend_conf.cmvn_file`:wav提取fbank中用到的cmvn文件,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 + +其他参数同上,完整 [示例](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) + + + +## 模型导出与测试 +### 从命令行导出 +```shell +funasr-export ++model=paraformer ++quantize=false +``` + +### 从Python导出 +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer") + +res = model.export(quantize=False) +``` + +### 测试ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +更多例子请参考 [样例](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/examples/aishell/branchformer/README.md b/examples/aishell/branchformer/README.md new file mode 100644 index 0000000..930e58f --- /dev/null +++ b/examples/aishell/branchformer/README.md @@ -0,0 +1,14 @@ +# Branchformer Result + +## Training Config +- Feature info: using raw speech, extracting 80 dims fbank online, global cmvn, speed perturb(0.9, 1.0, 1.1), specaugment +- Train info: lr 0.001, batch_size 10000, 4 gpu(Tesla V100), acc_grad 1, 180 epochs +- Train config: conf/train_asr_branchformer.yaml +- LM config: LM was not used + +## Results (CER) + +| testset | CER(%) | +|:-----------:|:-------:| +| dev | 4.15 | +| test | 4.51 | \ No newline at end of file diff --git a/examples/aishell/branchformer/conf/branchformer_12e_6d_2048_256.yaml b/examples/aishell/branchformer/conf/branchformer_12e_6d_2048_256.yaml new file mode 100644 index 0000000..acb7946 --- /dev/null +++ b/examples/aishell/branchformer/conf/branchformer_12e_6d_2048_256.yaml @@ -0,0 +1,122 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Branchformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: BranchformerEncoder +encoder_conf: + output_size: 256 + use_attn: true + attention_heads: 4 + attention_layer_type: rel_selfattn + pos_enc_layer_type: rel_pos + rel_pos_type: latest + use_cgmlp: true + cgmlp_linear_units: 2048 + cgmlp_conv_kernel: 31 + use_linear_after_conv: false + gate_activation: identity + merge_method: concat + cgmlp_weight: 0.5 # used only if merge_method is "fixed_ave" + attn_branch_drop_rate: 0.0 # used only if merge_method is "learned_ave" + num_blocks: 24 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: conv2d + stochastic_depth_rate: 0.0 + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0. + src_attention_dropout_rate: 0. + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + dither: 0.0 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 180 + keep_nbest_models: 10 + avg_keep_nbest_models_type: acc + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.001 + weight_decay: 0.000001 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 35000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: EspnetStyleBatchSampler + batch_type: length # example or length + batch_size: 10000 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 1024 + shuffle: True + num_workers: 4 + preprocessor_speech: SpeechPreprocessSpeedPerturb + preprocessor_speech_conf: + speed_perturb: [0.9, 1.0, 1.1] + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null + +beam_size: 10 +decoding_ctc_weight: 0.4 \ No newline at end of file diff --git a/examples/aishell/branchformer/demo_infer.sh b/examples/aishell/branchformer/demo_infer.sh new file mode 100644 index 0000000..9d0a7a9 --- /dev/null +++ b/examples/aishell/branchformer/demo_infer.sh @@ -0,0 +1 @@ +../paraformer/demo_infer.sh \ No newline at end of file diff --git a/examples/aishell/branchformer/demo_train_or_finetune.sh b/examples/aishell/branchformer/demo_train_or_finetune.sh new file mode 100644 index 0000000..bbabdbe --- /dev/null +++ b/examples/aishell/branchformer/demo_train_or_finetune.sh @@ -0,0 +1 @@ +../paraformer/demo_train_or_finetune.sh \ No newline at end of file diff --git a/examples/aishell/branchformer/infer.sh b/examples/aishell/branchformer/infer.sh new file mode 100644 index 0000000..bcd4305 --- /dev/null +++ b/examples/aishell/branchformer/infer.sh @@ -0,0 +1,12 @@ + + +python -m funasr.bin.inference \ +--config-path="/mnt/workspace/FunASR/examples/aishell/paraformer/exp/baseline_paraformer_conformer_12e_6d_2048_256_zh_char_exp3" \ +--config-name="config.yaml" \ +++init_param="/mnt/workspace/FunASR/examples/aishell/paraformer/exp/baseline_paraformer_conformer_12e_6d_2048_256_zh_char_exp3/model.pt.ep38" \ +++tokenizer_conf.token_list="/mnt/nfs/zhifu.gzf/data/AISHELL-1-feats/DATA/data/zh_token_list/char/tokens.txt" \ +++frontend_conf.cmvn_file="/mnt/nfs/zhifu.gzf/data/AISHELL-1-feats/DATA/data/train/am.mvn" \ +++input="/mnt/nfs/zhifu.gzf/data/AISHELL-1/data_aishell/wav/train/S0002/BAC009S0002W0122.wav" \ +++output_dir="./outputs/debug" \ +++device="cuda:0" \ + diff --git a/examples/aishell/branchformer/local/aishell_data_prep.sh b/examples/aishell/branchformer/local/aishell_data_prep.sh new file mode 100644 index 0000000..83f489b --- /dev/null +++ b/examples/aishell/branchformer/local/aishell_data_prep.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Copyright 2017 Xingyu Na +# Apache 2.0 + +#. ./path.sh || exit 1; + +if [ $# != 3 ]; then + echo "Usage: $0 " + echo " $0 /export/a05/xna/data/data_aishell/wav /export/a05/xna/data/data_aishell/transcript data" + exit 1; +fi + +aishell_audio_dir=$1 +aishell_text=$2/aishell_transcript_v0.8.txt +output_dir=$3 + +train_dir=$output_dir/data/local/train +dev_dir=$output_dir/data/local/dev +test_dir=$output_dir/data/local/test +tmp_dir=$output_dir/data/local/tmp + +mkdir -p $train_dir +mkdir -p $dev_dir +mkdir -p $test_dir +mkdir -p $tmp_dir + +# data directory check +if [ ! -d $aishell_audio_dir ] || [ ! -f $aishell_text ]; then + echo "Error: $0 requires two directory arguments" + exit 1; +fi + +# find wav audio file for train, dev and test resp. +find $aishell_audio_dir -iname "*.wav" > $tmp_dir/wav.flist +n=`cat $tmp_dir/wav.flist | wc -l` +[ $n -ne 141925 ] && \ + echo Warning: expected 141925 data data files, found $n + +grep -i "wav/train" $tmp_dir/wav.flist > $train_dir/wav.flist || exit 1; +grep -i "wav/dev" $tmp_dir/wav.flist > $dev_dir/wav.flist || exit 1; +grep -i "wav/test" $tmp_dir/wav.flist > $test_dir/wav.flist || exit 1; + +rm -r $tmp_dir + +# Transcriptions preparation +for dir in $train_dir $dev_dir $test_dir; do + echo Preparing $dir transcriptions + sed -e 's/\.wav//' $dir/wav.flist | awk -F '/' '{print $NF}' > $dir/utt.list + paste -d' ' $dir/utt.list $dir/wav.flist > $dir/wav.scp_all + utils/filter_scp.pl -f 1 $dir/utt.list $aishell_text > $dir/transcripts.txt + awk '{print $1}' $dir/transcripts.txt > $dir/utt.list + utils/filter_scp.pl -f 1 $dir/utt.list $dir/wav.scp_all | sort -u > $dir/wav.scp + sort -u $dir/transcripts.txt > $dir/text +done + +mkdir -p $output_dir/data/train $output_dir/data/dev $output_dir/data/test + +for f in wav.scp text; do + cp $train_dir/$f $output_dir/data/train/$f || exit 1; + cp $dev_dir/$f $output_dir/data/dev/$f || exit 1; + cp $test_dir/$f $output_dir/data/test/$f || exit 1; +done + +echo "$0: AISHELL data preparation succeeded" +exit 0; diff --git a/examples/aishell/branchformer/local/download_and_untar.sh b/examples/aishell/branchformer/local/download_and_untar.sh new file mode 100644 index 0000000..d982559 --- /dev/null +++ b/examples/aishell/branchformer/local/download_and_untar.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# Copyright 2014 Johns Hopkins University (author: Daniel Povey) +# 2017 Xingyu Na +# Apache 2.0 + +remove_archive=false + +if [ "$1" == --remove-archive ]; then + remove_archive=true + shift +fi + +if [ $# -ne 3 ]; then + echo "Usage: $0 [--remove-archive] " + echo "e.g.: $0 /export/a05/xna/data www.openslr.org/resources/33 data_aishell" + echo "With --remove-archive it will remove the archive after successfully un-tarring it." + echo " can be one of: data_aishell, resource_aishell." +fi + +data=$1 +url=$2 +part=$3 + +if [ ! -d "$data" ]; then + echo "$0: no such directory $data" + exit 1; +fi + +part_ok=false +list="data_aishell resource_aishell" +for x in $list; do + if [ "$part" == $x ]; then part_ok=true; fi +done +if ! $part_ok; then + echo "$0: expected to be one of $list, but got '$part'" + exit 1; +fi + +if [ -z "$url" ]; then + echo "$0: empty URL base." + exit 1; +fi + +if [ -f $data/$part/.complete ]; then + echo "$0: data part $part was already successfully extracted, nothing to do." + exit 0; +fi + +# sizes of the archive files in bytes. +sizes="15582913665 1246920" + +if [ -f $data/$part.tgz ]; then + size=$(/bin/ls -l $data/$part.tgz | awk '{print $5}') + size_ok=false + for s in $sizes; do if [ $s == $size ]; then size_ok=true; fi; done + if ! $size_ok; then + echo "$0: removing existing file $data/$part.tgz because its size in bytes $size" + echo "does not equal the size of one of the archives." + rm $data/$part.tgz + else + echo "$data/$part.tgz exists and appears to be complete." + fi +fi + +if [ ! -f $data/$part.tgz ]; then + if ! command -v wget >/dev/null; then + echo "$0: wget is not installed." + exit 1; + fi + full_url=$url/$part.tgz + echo "$0: downloading data from $full_url. This may take some time, please be patient." + + cd $data || exit 1 + if ! wget --no-check-certificate $full_url; then + echo "$0: error executing wget $full_url" + exit 1; + fi +fi + +cd $data || exit 1 + +if ! tar -xvzf $part.tgz; then + echo "$0: error un-tarring archive $data/$part.tgz" + exit 1; +fi + +touch $data/$part/.complete + +if [ $part == "data_aishell" ]; then + cd $data/$part/wav || exit 1 + for wav in ./*.tar.gz; do + echo "Extracting wav from $wav" + tar -zxf $wav && rm $wav + done +fi + +echo "$0: Successfully downloaded and un-tarred $data/$part.tgz" + +if $remove_archive; then + echo "$0: removing $data/$part.tgz file since --remove-archive option was supplied." + rm $data/$part.tgz +fi + +exit 0; diff --git a/examples/aishell/branchformer/run.sh b/examples/aishell/branchformer/run.sh new file mode 100644 index 0000000..5b64954 --- /dev/null +++ b/examples/aishell/branchformer/run.sh @@ -0,0 +1,203 @@ +#!/usr/bin/env bash + + +CUDA_VISIBLE_DEVICES="0,1,2,3" + +# general configuration +feats_dir="../DATA" #feature output dictionary +exp_dir=`pwd` +lang=zh +token_type=char +stage=0 +stop_stage=5 + +# feature configuration +nj=32 + +inference_device="cuda" #"cpu" +inference_checkpoint="model.pt.avg10" +inference_scp="wav.scp" +inference_batch_size=1 + +# data +raw_data=../raw_data +data_url=www.openslr.org/resources/33 + +# exp tag +tag="exp1" +workspace=`pwd` + +master_port=12345 + +. utils/parse_options.sh || exit 1; + +# Set bash to 'debug' mode, it will exit on : +# -e 'error', -u 'undefined variable', -o ... 'error in pipeline', -x 'print commands', +set -e +set -u +set -o pipefail + +train_set=train +valid_set=dev +test_sets="dev test" + +config=branchformer_12e_6d_2048_256.yaml +model_dir="baseline_$(basename "${config}" .yaml)_${lang}_${token_type}_${tag}" + + + +if [ ${stage} -le -1 ] && [ ${stop_stage} -ge -1 ]; then + echo "stage -1: Data Download" + mkdir -p ${raw_data} + local/download_and_untar.sh ${raw_data} ${data_url} data_aishell + local/download_and_untar.sh ${raw_data} ${data_url} resource_aishell +fi + +if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then + echo "stage 0: Data preparation" + # Data preparation + local/aishell_data_prep.sh ${raw_data}/data_aishell/wav ${raw_data}/data_aishell/transcript ${feats_dir} + for x in train dev test; do + cp ${feats_dir}/data/${x}/text ${feats_dir}/data/${x}/text.org + paste -d " " <(cut -f 1 -d" " ${feats_dir}/data/${x}/text.org) <(cut -f 2- -d" " ${feats_dir}/data/${x}/text.org | tr -d " ") \ + > ${feats_dir}/data/${x}/text + utils/text2token.py -n 1 -s 1 ${feats_dir}/data/${x}/text > ${feats_dir}/data/${x}/text.org + mv ${feats_dir}/data/${x}/text.org ${feats_dir}/data/${x}/text + + # convert wav.scp text to jsonl + scp_file_list_arg="++scp_file_list='[\"${feats_dir}/data/${x}/wav.scp\",\"${feats_dir}/data/${x}/text\"]'" + python ../../../funasr/datasets/audio_datasets/scp2jsonl.py \ + ++data_type_list='["source", "target"]' \ + ++jsonl_file_out=${feats_dir}/data/${x}/audio_datasets.jsonl \ + ${scp_file_list_arg} + done +fi + +if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then + echo "stage 1: Feature and CMVN Generation" + python ../../../funasr/bin/compute_audio_cmvn.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++cmvn_file="${feats_dir}/data/${train_set}/cmvn.json" \ + +fi + +token_list=${feats_dir}/data/${lang}_token_list/$token_type/tokens.txt +echo "dictionary: ${token_list}" +if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then + echo "stage 2: Dictionary Preparation" + mkdir -p ${feats_dir}/data/${lang}_token_list/$token_type/ + + echo "make a dictionary" + echo "" > ${token_list} + echo "" >> ${token_list} + echo "" >> ${token_list} + utils/text2token.py -s 1 -n 1 --space "" ${feats_dir}/data/$train_set/text | cut -f 2- -d" " | tr " " "\n" \ + | sort | uniq | grep -a -v -e '^\s*$' | awk '{print $0}' >> ${token_list} + echo "" >> ${token_list} +fi + +# LM Training Stage +if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then + echo "stage 3: LM Training" +fi + +# ASR Training Stage +if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then + echo "stage 4: ASR Training" + + mkdir -p ${exp_dir}/exp/${model_dir} + current_time=$(date "+%Y-%m-%d_%H-%M") + log_file="${exp_dir}/exp/${model_dir}/train.log.txt.${current_time}" + echo "log_file: ${log_file}" + + export CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES + gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + torchrun \ + --nnodes 1 \ + --nproc_per_node ${gpu_num} \ + --master_port ${master_port} \ + ../../../funasr/bin/train.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++valid_data_set_list="${feats_dir}/data/${valid_set}/audio_datasets.jsonl" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++output_dir="${exp_dir}/exp/${model_dir}" &> ${log_file} +fi + + + +# Testing Stage +if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then + echo "stage 5: Inference" + + if [ ${inference_device} == "cuda" ]; then + nj=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + else + inference_batch_size=1 + CUDA_VISIBLE_DEVICES="" + for JOB in $(seq ${nj}); do + CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"-1," + done + fi + + for dset in ${test_sets}; do + + inference_dir="${exp_dir}/exp/${model_dir}/inference-${inference_checkpoint}/${dset}" + _logdir="${inference_dir}/logdir" + echo "inference_dir: ${inference_dir}" + + mkdir -p "${_logdir}" + data_dir="${feats_dir}/data/${dset}" + key_file=${data_dir}/${inference_scp} + + split_scps= + for JOB in $(seq "${nj}"); do + split_scps+=" ${_logdir}/keys.${JOB}.scp" + done + utils/split_scp.pl "${key_file}" ${split_scps} + + gpuid_list_array=(${CUDA_VISIBLE_DEVICES//,/ }) + for JOB in $(seq ${nj}); do + { + id=$((JOB-1)) + gpuid=${gpuid_list_array[$id]} + + export CUDA_VISIBLE_DEVICES=${gpuid} + python ../../../funasr/bin/inference.py \ + --config-path="${exp_dir}/exp/${model_dir}" \ + --config-name="config.yaml" \ + ++init_param="${exp_dir}/exp/${model_dir}/${inference_checkpoint}" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++input="${_logdir}/keys.${JOB}.scp" \ + ++output_dir="${inference_dir}/${JOB}" \ + ++device="${inference_device}" \ + ++ncpu=1 \ + ++disable_log=true \ + ++batch_size="${inference_batch_size}" &> ${_logdir}/log.${JOB}.txt + }& + + done + wait + + mkdir -p ${inference_dir}/1best_recog + for f in token score text; do + if [ -f "${inference_dir}/${JOB}/1best_recog/${f}" ]; then + for JOB in $(seq "${nj}"); do + cat "${inference_dir}/${JOB}/1best_recog/${f}" + done | sort -k1 >"${inference_dir}/1best_recog/${f}" + fi + done + + echo "Computing WER ..." + python utils/postprocess_text_zh.py ${inference_dir}/1best_recog/text ${inference_dir}/1best_recog/text.proc + python utils/postprocess_text_zh.py ${data_dir}/text ${inference_dir}/1best_recog/text.ref + python utils/compute_wer.py ${inference_dir}/1best_recog/text.ref ${inference_dir}/1best_recog/text.proc ${inference_dir}/1best_recog/text.cer + tail -n 3 ${inference_dir}/1best_recog/text.cer + done + +fi \ No newline at end of file diff --git a/examples/aishell/branchformer/utils b/examples/aishell/branchformer/utils new file mode 100644 index 0000000..1f2ce9d --- /dev/null +++ b/examples/aishell/branchformer/utils @@ -0,0 +1 @@ +../paraformer/utils \ No newline at end of file diff --git a/examples/aishell/conformer/README.md b/examples/aishell/conformer/README.md new file mode 100644 index 0000000..003cbac --- /dev/null +++ b/examples/aishell/conformer/README.md @@ -0,0 +1,16 @@ + +# Conformer Result + +## Training Config +- Feature info: using 80 dims fbank, global cmvn, speed perturb(0.9, 1.0, 1.1), specaugment +- Train info: lr 5e-4, batch_size 25000, 2 gpu(Tesla V100), acc_grad 1, 50 epochs +- Train config: conf/train_asr_transformer.yaml +- LM config: LM was not used +- Model size: 46M + +## Results (CER) + +| testset | CER(%) | +|:-----------:|:-------:| +| dev | 4.42 | +| test | 4.87 | \ No newline at end of file diff --git a/examples/aishell/conformer/conf/conformer_12e_6d_2048_256.yaml b/examples/aishell/conformer/conf/conformer_12e_6d_2048_256.yaml new file mode 100644 index 0000000..5e179f4 --- /dev/null +++ b/examples/aishell/conformer/conf/conformer_12e_6d_2048_256.yaml @@ -0,0 +1,110 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Conformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: ConformerEncoder +encoder_conf: + output_size: 256 # dimension of attention + attention_heads: 4 + linear_units: 2048 # the number of units of position-wise feed forward + num_blocks: 12 # the number of encoder blocks + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: conv2d # encoder architecture type + normalize_before: true + pos_enc_layer_type: rel_pos + selfattention_layer_type: rel_selfattn + activation_type: swish + macaron_style: true + use_cnn_module: true + cnn_module_kernel: 15 + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.0 + src_attention_dropout_rate: 0.0 + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: EspnetStyleBatchSampler + batch_type: length # example or length + batch_size: 25000 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 1024 + shuffle: True + num_workers: 4 + preprocessor_speech: SpeechPreprocessSpeedPerturb + preprocessor_speech_conf: + speed_perturb: [0.9, 1.0, 1.1] + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/examples/aishell/conformer/conf/conformer_rwkv.yaml b/examples/aishell/conformer/conf/conformer_rwkv.yaml new file mode 100644 index 0000000..4742838 --- /dev/null +++ b/examples/aishell/conformer/conf/conformer_rwkv.yaml @@ -0,0 +1,124 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Conformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: ConformerEncoder +encoder_conf: + output_size: 256 # dimension of attention + attention_heads: 4 + linear_units: 2048 # the number of units of position-wise feed forward + num_blocks: 12 # the number of encoder blocks + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: conv2d # encoder architecture type + normalize_before: true + pos_enc_layer_type: rel_pos + selfattention_layer_type: rel_selfattn + activation_type: swish + macaron_style: true + use_cnn_module: true + cnn_module_kernel: 15 + +# decoder +decoder: TransformerRWKVDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.0 + src_attention_dropout_rate: 0.0 + input_layer: embed + rwkv_cfg: + n_embd: 256 + dropout: 0 + head_size_a: 64 + ctx_len: 512 + dim_att: 256 #${model_conf.rwkv_cfg.n_embd} + dim_ffn: null + head_size_divisor: 4 + n_layer: 6 + pre_ffn: 0 + ln0: false + ln1: false + init_rwkv: true + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: EspnetStyleBatchSampler + batch_type: length # example or length + batch_size: 25000 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 1024 + shuffle: True + num_workers: 4 + preprocessor_speech: SpeechPreprocessSpeedPerturb + preprocessor_speech_conf: + speed_perturb: [0.9, 1.0, 1.1] + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/examples/aishell/conformer/demo_infer.sh b/examples/aishell/conformer/demo_infer.sh new file mode 100644 index 0000000..9d0a7a9 --- /dev/null +++ b/examples/aishell/conformer/demo_infer.sh @@ -0,0 +1 @@ +../paraformer/demo_infer.sh \ No newline at end of file diff --git a/examples/aishell/conformer/demo_train_or_finetune.sh b/examples/aishell/conformer/demo_train_or_finetune.sh new file mode 100644 index 0000000..bbabdbe --- /dev/null +++ b/examples/aishell/conformer/demo_train_or_finetune.sh @@ -0,0 +1 @@ +../paraformer/demo_train_or_finetune.sh \ No newline at end of file diff --git a/examples/aishell/conformer/local/aishell_data_prep.sh b/examples/aishell/conformer/local/aishell_data_prep.sh new file mode 100644 index 0000000..83f489b --- /dev/null +++ b/examples/aishell/conformer/local/aishell_data_prep.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Copyright 2017 Xingyu Na +# Apache 2.0 + +#. ./path.sh || exit 1; + +if [ $# != 3 ]; then + echo "Usage: $0 " + echo " $0 /export/a05/xna/data/data_aishell/wav /export/a05/xna/data/data_aishell/transcript data" + exit 1; +fi + +aishell_audio_dir=$1 +aishell_text=$2/aishell_transcript_v0.8.txt +output_dir=$3 + +train_dir=$output_dir/data/local/train +dev_dir=$output_dir/data/local/dev +test_dir=$output_dir/data/local/test +tmp_dir=$output_dir/data/local/tmp + +mkdir -p $train_dir +mkdir -p $dev_dir +mkdir -p $test_dir +mkdir -p $tmp_dir + +# data directory check +if [ ! -d $aishell_audio_dir ] || [ ! -f $aishell_text ]; then + echo "Error: $0 requires two directory arguments" + exit 1; +fi + +# find wav audio file for train, dev and test resp. +find $aishell_audio_dir -iname "*.wav" > $tmp_dir/wav.flist +n=`cat $tmp_dir/wav.flist | wc -l` +[ $n -ne 141925 ] && \ + echo Warning: expected 141925 data data files, found $n + +grep -i "wav/train" $tmp_dir/wav.flist > $train_dir/wav.flist || exit 1; +grep -i "wav/dev" $tmp_dir/wav.flist > $dev_dir/wav.flist || exit 1; +grep -i "wav/test" $tmp_dir/wav.flist > $test_dir/wav.flist || exit 1; + +rm -r $tmp_dir + +# Transcriptions preparation +for dir in $train_dir $dev_dir $test_dir; do + echo Preparing $dir transcriptions + sed -e 's/\.wav//' $dir/wav.flist | awk -F '/' '{print $NF}' > $dir/utt.list + paste -d' ' $dir/utt.list $dir/wav.flist > $dir/wav.scp_all + utils/filter_scp.pl -f 1 $dir/utt.list $aishell_text > $dir/transcripts.txt + awk '{print $1}' $dir/transcripts.txt > $dir/utt.list + utils/filter_scp.pl -f 1 $dir/utt.list $dir/wav.scp_all | sort -u > $dir/wav.scp + sort -u $dir/transcripts.txt > $dir/text +done + +mkdir -p $output_dir/data/train $output_dir/data/dev $output_dir/data/test + +for f in wav.scp text; do + cp $train_dir/$f $output_dir/data/train/$f || exit 1; + cp $dev_dir/$f $output_dir/data/dev/$f || exit 1; + cp $test_dir/$f $output_dir/data/test/$f || exit 1; +done + +echo "$0: AISHELL data preparation succeeded" +exit 0; diff --git a/examples/aishell/conformer/local/download_and_untar.sh b/examples/aishell/conformer/local/download_and_untar.sh new file mode 100644 index 0000000..d982559 --- /dev/null +++ b/examples/aishell/conformer/local/download_and_untar.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# Copyright 2014 Johns Hopkins University (author: Daniel Povey) +# 2017 Xingyu Na +# Apache 2.0 + +remove_archive=false + +if [ "$1" == --remove-archive ]; then + remove_archive=true + shift +fi + +if [ $# -ne 3 ]; then + echo "Usage: $0 [--remove-archive] " + echo "e.g.: $0 /export/a05/xna/data www.openslr.org/resources/33 data_aishell" + echo "With --remove-archive it will remove the archive after successfully un-tarring it." + echo " can be one of: data_aishell, resource_aishell." +fi + +data=$1 +url=$2 +part=$3 + +if [ ! -d "$data" ]; then + echo "$0: no such directory $data" + exit 1; +fi + +part_ok=false +list="data_aishell resource_aishell" +for x in $list; do + if [ "$part" == $x ]; then part_ok=true; fi +done +if ! $part_ok; then + echo "$0: expected to be one of $list, but got '$part'" + exit 1; +fi + +if [ -z "$url" ]; then + echo "$0: empty URL base." + exit 1; +fi + +if [ -f $data/$part/.complete ]; then + echo "$0: data part $part was already successfully extracted, nothing to do." + exit 0; +fi + +# sizes of the archive files in bytes. +sizes="15582913665 1246920" + +if [ -f $data/$part.tgz ]; then + size=$(/bin/ls -l $data/$part.tgz | awk '{print $5}') + size_ok=false + for s in $sizes; do if [ $s == $size ]; then size_ok=true; fi; done + if ! $size_ok; then + echo "$0: removing existing file $data/$part.tgz because its size in bytes $size" + echo "does not equal the size of one of the archives." + rm $data/$part.tgz + else + echo "$data/$part.tgz exists and appears to be complete." + fi +fi + +if [ ! -f $data/$part.tgz ]; then + if ! command -v wget >/dev/null; then + echo "$0: wget is not installed." + exit 1; + fi + full_url=$url/$part.tgz + echo "$0: downloading data from $full_url. This may take some time, please be patient." + + cd $data || exit 1 + if ! wget --no-check-certificate $full_url; then + echo "$0: error executing wget $full_url" + exit 1; + fi +fi + +cd $data || exit 1 + +if ! tar -xvzf $part.tgz; then + echo "$0: error un-tarring archive $data/$part.tgz" + exit 1; +fi + +touch $data/$part/.complete + +if [ $part == "data_aishell" ]; then + cd $data/$part/wav || exit 1 + for wav in ./*.tar.gz; do + echo "Extracting wav from $wav" + tar -zxf $wav && rm $wav + done +fi + +echo "$0: Successfully downloaded and un-tarred $data/$part.tgz" + +if $remove_archive; then + echo "$0: removing $data/$part.tgz file since --remove-archive option was supplied." + rm $data/$part.tgz +fi + +exit 0; diff --git a/examples/aishell/conformer/run.sh b/examples/aishell/conformer/run.sh new file mode 100644 index 0000000..0c8ab50 --- /dev/null +++ b/examples/aishell/conformer/run.sh @@ -0,0 +1,202 @@ +#!/usr/bin/env bash + + +CUDA_VISIBLE_DEVICES="0,1" + +# general configuration +feats_dir="../DATA" #feature output dictionary +exp_dir=`pwd` +lang=zh +token_type=char +stage=0 +stop_stage=5 + +# feature configuration +nj=32 + +inference_device="cuda" #"cpu", "cuda:0", "cuda:1" +inference_checkpoint="model.pt.avg10" +inference_scp="wav.scp" +inference_batch_size=1 + +# data +raw_data=../raw_data +data_url=www.openslr.org/resources/33 + +# exp tag +tag="exp1" +workspace=`pwd` + +master_port=12345 + +. utils/parse_options.sh || exit 1; + +# Set bash to 'debug' mode, it will exit on : +# -e 'error', -u 'undefined variable', -o ... 'error in pipeline', -x 'print commands', +set -e +set -u +set -o pipefail + +train_set=train +valid_set=dev +test_sets="dev test" + +config=conformer_12e_6d_2048_256.yaml +model_dir="baseline_$(basename "${config}" .yaml)_${lang}_${token_type}_${tag}" + + +if [ ${stage} -le -1 ] && [ ${stop_stage} -ge -1 ]; then + echo "stage -1: Data Download" + mkdir -p ${raw_data} + local/download_and_untar.sh ${raw_data} ${data_url} data_aishell + local/download_and_untar.sh ${raw_data} ${data_url} resource_aishell +fi + +if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then + echo "stage 0: Data preparation" + # Data preparation + local/aishell_data_prep.sh ${raw_data}/data_aishell/wav ${raw_data}/data_aishell/transcript ${feats_dir} + for x in train dev test; do + cp ${feats_dir}/data/${x}/text ${feats_dir}/data/${x}/text.org + paste -d " " <(cut -f 1 -d" " ${feats_dir}/data/${x}/text.org) <(cut -f 2- -d" " ${feats_dir}/data/${x}/text.org | tr -d " ") \ + > ${feats_dir}/data/${x}/text + utils/text2token.py -n 1 -s 1 ${feats_dir}/data/${x}/text > ${feats_dir}/data/${x}/text.org + mv ${feats_dir}/data/${x}/text.org ${feats_dir}/data/${x}/text + + # convert wav.scp text to jsonl + scp_file_list_arg="++scp_file_list='[\"${feats_dir}/data/${x}/wav.scp\",\"${feats_dir}/data/${x}/text\"]'" + python ../../../funasr/datasets/audio_datasets/scp2jsonl.py \ + ++data_type_list='["source", "target"]' \ + ++jsonl_file_out=${feats_dir}/data/${x}/audio_datasets.jsonl \ + ${scp_file_list_arg} + done +fi + +if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then + echo "stage 1: Feature and CMVN Generation" + python ../../../funasr/bin/compute_audio_cmvn.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++cmvn_file="${feats_dir}/data/${train_set}/cmvn.json" \ + +fi + +token_list=${feats_dir}/data/${lang}_token_list/$token_type/tokens.txt +echo "dictionary: ${token_list}" +if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then + echo "stage 2: Dictionary Preparation" + mkdir -p ${feats_dir}/data/${lang}_token_list/$token_type/ + + echo "make a dictionary" + echo "" > ${token_list} + echo "" >> ${token_list} + echo "" >> ${token_list} + utils/text2token.py -s 1 -n 1 --space "" ${feats_dir}/data/$train_set/text | cut -f 2- -d" " | tr " " "\n" \ + | sort | uniq | grep -a -v -e '^\s*$' | awk '{print $0}' >> ${token_list} + echo "" >> ${token_list} +fi + +# LM Training Stage +if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then + echo "stage 3: LM Training" +fi + +# ASR Training Stage +if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then + echo "stage 4: ASR Training" + + mkdir -p ${exp_dir}/exp/${model_dir} + current_time=$(date "+%Y-%m-%d_%H-%M") + log_file="${exp_dir}/exp/${model_dir}/train.log.txt.${current_time}" + echo "log_file: ${log_file}" + + export CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES + gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + torchrun \ + --nnodes 1 \ + --nproc_per_node ${gpu_num} \ + --master_port ${master_port} \ + ../../../funasr/bin/train.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++valid_data_set_list="${feats_dir}/data/${valid_set}/audio_datasets.jsonl" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++output_dir="${exp_dir}/exp/${model_dir}" &> ${log_file} +fi + + + +# Testing Stage +if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then + echo "stage 5: Inference" + + if [ ${inference_device} == "cuda" ]; then + nj=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + else + inference_batch_size=1 + CUDA_VISIBLE_DEVICES="" + for JOB in $(seq ${nj}); do + CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"-1," + done + fi + + for dset in ${test_sets}; do + + inference_dir="${exp_dir}/exp/${model_dir}/inference-${inference_checkpoint}/${dset}" + _logdir="${inference_dir}/logdir" + echo "inference_dir: ${inference_dir}" + + mkdir -p "${_logdir}" + data_dir="${feats_dir}/data/${dset}" + key_file=${data_dir}/${inference_scp} + + split_scps= + for JOB in $(seq "${nj}"); do + split_scps+=" ${_logdir}/keys.${JOB}.scp" + done + utils/split_scp.pl "${key_file}" ${split_scps} + + gpuid_list_array=(${CUDA_VISIBLE_DEVICES//,/ }) + for JOB in $(seq ${nj}); do + { + id=$((JOB-1)) + gpuid=${gpuid_list_array[$id]} + + export CUDA_VISIBLE_DEVICES=${gpuid} + python ../../../funasr/bin/inference.py \ + --config-path="${exp_dir}/exp/${model_dir}" \ + --config-name="config.yaml" \ + ++init_param="${exp_dir}/exp/${model_dir}/${inference_checkpoint}" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++input="${_logdir}/keys.${JOB}.scp" \ + ++output_dir="${inference_dir}/${JOB}" \ + ++device="${inference_device}" \ + ++ncpu=1 \ + ++disable_log=true \ + ++batch_size="${inference_batch_size}" &> ${_logdir}/log.${JOB}.txt + }& + + done + wait + + mkdir -p ${inference_dir}/1best_recog + for f in token score text; do + if [ -f "${inference_dir}/${JOB}/1best_recog/${f}" ]; then + for JOB in $(seq "${nj}"); do + cat "${inference_dir}/${JOB}/1best_recog/${f}" + done | sort -k1 >"${inference_dir}/1best_recog/${f}" + fi + done + + echo "Computing WER ..." + python utils/postprocess_text_zh.py ${inference_dir}/1best_recog/text ${inference_dir}/1best_recog/text.proc + python utils/postprocess_text_zh.py ${data_dir}/text ${inference_dir}/1best_recog/text.ref + python utils/compute_wer.py ${inference_dir}/1best_recog/text.ref ${inference_dir}/1best_recog/text.proc ${inference_dir}/1best_recog/text.cer + tail -n 3 ${inference_dir}/1best_recog/text.cer + done + +fi diff --git a/examples/aishell/conformer/utils b/examples/aishell/conformer/utils new file mode 100644 index 0000000..1f2ce9d --- /dev/null +++ b/examples/aishell/conformer/utils @@ -0,0 +1 @@ +../paraformer/utils \ No newline at end of file diff --git a/examples/aishell/e_branchformer/README.md b/examples/aishell/e_branchformer/README.md new file mode 100644 index 0000000..ac0aabb --- /dev/null +++ b/examples/aishell/e_branchformer/README.md @@ -0,0 +1,14 @@ +# E-Branchformer Result + +## Training Config +- Feature info: using raw speech, extracting 80 dims fbank online, global cmvn, speed perturb(0.9, 1.0, 1.1), specaugment +- Train info: lr 0.001, batch_size 10000, 4 gpu(Tesla V100), acc_grad 1, 180 epochs +- Train config: conf/train_asr_e_branchformer.yaml +- LM config: LM was not used + +## Results (CER) + +| testset | CER(%) | +|:-----------:|:-------:| +| dev | 4.10 | +| test | 4.52 | \ No newline at end of file diff --git a/examples/aishell/e_branchformer/conf/e_branchformer_12e_6d_2048_256.yaml b/examples/aishell/e_branchformer/conf/e_branchformer_12e_6d_2048_256.yaml new file mode 100644 index 0000000..6438ae1 --- /dev/null +++ b/examples/aishell/e_branchformer/conf/e_branchformer_12e_6d_2048_256.yaml @@ -0,0 +1,118 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Branchformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: EBranchformerEncoder +encoder_conf: + output_size: 256 + attention_heads: 4 + attention_layer_type: rel_selfattn + pos_enc_layer_type: rel_pos + rel_pos_type: latest + cgmlp_linear_units: 1024 + cgmlp_conv_kernel: 31 + use_linear_after_conv: false + gate_activation: identity + num_blocks: 12 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: conv2d + layer_drop_rate: 0.0 + linear_units: 1024 + positionwise_layer_type: linear + use_ffn: true + macaron_ffn: true + merge_conv_kernel: 31 + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0. + src_attention_dropout_rate: 0. + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + dither: 0.0 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 180 + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.001 + weight_decay: 0.000001 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 35000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: EspnetStyleBatchSampler + batch_type: length # example or length + batch_size: 10000 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 1024 + shuffle: True + num_workers: 4 + preprocessor_speech: SpeechPreprocessSpeedPerturb + preprocessor_speech_conf: + speed_perturb: [0.9, 1.0, 1.1] + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/examples/aishell/e_branchformer/demo_infer.sh b/examples/aishell/e_branchformer/demo_infer.sh new file mode 100644 index 0000000..9d0a7a9 --- /dev/null +++ b/examples/aishell/e_branchformer/demo_infer.sh @@ -0,0 +1 @@ +../paraformer/demo_infer.sh \ No newline at end of file diff --git a/examples/aishell/e_branchformer/demo_train_or_finetune.sh b/examples/aishell/e_branchformer/demo_train_or_finetune.sh new file mode 100644 index 0000000..bbabdbe --- /dev/null +++ b/examples/aishell/e_branchformer/demo_train_or_finetune.sh @@ -0,0 +1 @@ +../paraformer/demo_train_or_finetune.sh \ No newline at end of file diff --git a/examples/aishell/e_branchformer/local/aishell_data_prep.sh b/examples/aishell/e_branchformer/local/aishell_data_prep.sh new file mode 100644 index 0000000..83f489b --- /dev/null +++ b/examples/aishell/e_branchformer/local/aishell_data_prep.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Copyright 2017 Xingyu Na +# Apache 2.0 + +#. ./path.sh || exit 1; + +if [ $# != 3 ]; then + echo "Usage: $0 " + echo " $0 /export/a05/xna/data/data_aishell/wav /export/a05/xna/data/data_aishell/transcript data" + exit 1; +fi + +aishell_audio_dir=$1 +aishell_text=$2/aishell_transcript_v0.8.txt +output_dir=$3 + +train_dir=$output_dir/data/local/train +dev_dir=$output_dir/data/local/dev +test_dir=$output_dir/data/local/test +tmp_dir=$output_dir/data/local/tmp + +mkdir -p $train_dir +mkdir -p $dev_dir +mkdir -p $test_dir +mkdir -p $tmp_dir + +# data directory check +if [ ! -d $aishell_audio_dir ] || [ ! -f $aishell_text ]; then + echo "Error: $0 requires two directory arguments" + exit 1; +fi + +# find wav audio file for train, dev and test resp. +find $aishell_audio_dir -iname "*.wav" > $tmp_dir/wav.flist +n=`cat $tmp_dir/wav.flist | wc -l` +[ $n -ne 141925 ] && \ + echo Warning: expected 141925 data data files, found $n + +grep -i "wav/train" $tmp_dir/wav.flist > $train_dir/wav.flist || exit 1; +grep -i "wav/dev" $tmp_dir/wav.flist > $dev_dir/wav.flist || exit 1; +grep -i "wav/test" $tmp_dir/wav.flist > $test_dir/wav.flist || exit 1; + +rm -r $tmp_dir + +# Transcriptions preparation +for dir in $train_dir $dev_dir $test_dir; do + echo Preparing $dir transcriptions + sed -e 's/\.wav//' $dir/wav.flist | awk -F '/' '{print $NF}' > $dir/utt.list + paste -d' ' $dir/utt.list $dir/wav.flist > $dir/wav.scp_all + utils/filter_scp.pl -f 1 $dir/utt.list $aishell_text > $dir/transcripts.txt + awk '{print $1}' $dir/transcripts.txt > $dir/utt.list + utils/filter_scp.pl -f 1 $dir/utt.list $dir/wav.scp_all | sort -u > $dir/wav.scp + sort -u $dir/transcripts.txt > $dir/text +done + +mkdir -p $output_dir/data/train $output_dir/data/dev $output_dir/data/test + +for f in wav.scp text; do + cp $train_dir/$f $output_dir/data/train/$f || exit 1; + cp $dev_dir/$f $output_dir/data/dev/$f || exit 1; + cp $test_dir/$f $output_dir/data/test/$f || exit 1; +done + +echo "$0: AISHELL data preparation succeeded" +exit 0; diff --git a/examples/aishell/e_branchformer/local/download_and_untar.sh b/examples/aishell/e_branchformer/local/download_and_untar.sh new file mode 100644 index 0000000..d982559 --- /dev/null +++ b/examples/aishell/e_branchformer/local/download_and_untar.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# Copyright 2014 Johns Hopkins University (author: Daniel Povey) +# 2017 Xingyu Na +# Apache 2.0 + +remove_archive=false + +if [ "$1" == --remove-archive ]; then + remove_archive=true + shift +fi + +if [ $# -ne 3 ]; then + echo "Usage: $0 [--remove-archive] " + echo "e.g.: $0 /export/a05/xna/data www.openslr.org/resources/33 data_aishell" + echo "With --remove-archive it will remove the archive after successfully un-tarring it." + echo " can be one of: data_aishell, resource_aishell." +fi + +data=$1 +url=$2 +part=$3 + +if [ ! -d "$data" ]; then + echo "$0: no such directory $data" + exit 1; +fi + +part_ok=false +list="data_aishell resource_aishell" +for x in $list; do + if [ "$part" == $x ]; then part_ok=true; fi +done +if ! $part_ok; then + echo "$0: expected to be one of $list, but got '$part'" + exit 1; +fi + +if [ -z "$url" ]; then + echo "$0: empty URL base." + exit 1; +fi + +if [ -f $data/$part/.complete ]; then + echo "$0: data part $part was already successfully extracted, nothing to do." + exit 0; +fi + +# sizes of the archive files in bytes. +sizes="15582913665 1246920" + +if [ -f $data/$part.tgz ]; then + size=$(/bin/ls -l $data/$part.tgz | awk '{print $5}') + size_ok=false + for s in $sizes; do if [ $s == $size ]; then size_ok=true; fi; done + if ! $size_ok; then + echo "$0: removing existing file $data/$part.tgz because its size in bytes $size" + echo "does not equal the size of one of the archives." + rm $data/$part.tgz + else + echo "$data/$part.tgz exists and appears to be complete." + fi +fi + +if [ ! -f $data/$part.tgz ]; then + if ! command -v wget >/dev/null; then + echo "$0: wget is not installed." + exit 1; + fi + full_url=$url/$part.tgz + echo "$0: downloading data from $full_url. This may take some time, please be patient." + + cd $data || exit 1 + if ! wget --no-check-certificate $full_url; then + echo "$0: error executing wget $full_url" + exit 1; + fi +fi + +cd $data || exit 1 + +if ! tar -xvzf $part.tgz; then + echo "$0: error un-tarring archive $data/$part.tgz" + exit 1; +fi + +touch $data/$part/.complete + +if [ $part == "data_aishell" ]; then + cd $data/$part/wav || exit 1 + for wav in ./*.tar.gz; do + echo "Extracting wav from $wav" + tar -zxf $wav && rm $wav + done +fi + +echo "$0: Successfully downloaded and un-tarred $data/$part.tgz" + +if $remove_archive; then + echo "$0: removing $data/$part.tgz file since --remove-archive option was supplied." + rm $data/$part.tgz +fi + +exit 0; diff --git a/examples/aishell/e_branchformer/run.sh b/examples/aishell/e_branchformer/run.sh new file mode 100644 index 0000000..452ec80 --- /dev/null +++ b/examples/aishell/e_branchformer/run.sh @@ -0,0 +1,203 @@ +#!/usr/bin/env bash + + +CUDA_VISIBLE_DEVICES="0,1,2,3" + +# general configuration +feats_dir="../DATA" #feature output dictionary +exp_dir=`pwd` +lang=zh +token_type=char +stage=0 +stop_stage=5 + +# feature configuration +nj=32 + +inference_device="cuda" #"cpu" +inference_checkpoint="model.pt.avg10" +inference_scp="wav.scp" +inference_batch_size=1 + +# data +raw_data=../raw_data +data_url=www.openslr.org/resources/33 + +# exp tag +tag="exp1" +workspace=`pwd` + +master_port=12345 + +. utils/parse_options.sh || exit 1; + +# Set bash to 'debug' mode, it will exit on : +# -e 'error', -u 'undefined variable', -o ... 'error in pipeline', -x 'print commands', +set -e +set -u +set -o pipefail + +train_set=train +valid_set=dev +test_sets="dev test" + +config=e_branchformer_12e_6d_2048_256.yaml +model_dir="baseline_$(basename "${config}" .yaml)_${lang}_${token_type}_${tag}" + + + +if [ ${stage} -le -1 ] && [ ${stop_stage} -ge -1 ]; then + echo "stage -1: Data Download" + mkdir -p ${raw_data} + local/download_and_untar.sh ${raw_data} ${data_url} data_aishell + local/download_and_untar.sh ${raw_data} ${data_url} resource_aishell +fi + +if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then + echo "stage 0: Data preparation" + # Data preparation + local/aishell_data_prep.sh ${raw_data}/data_aishell/wav ${raw_data}/data_aishell/transcript ${feats_dir} + for x in train dev test; do + cp ${feats_dir}/data/${x}/text ${feats_dir}/data/${x}/text.org + paste -d " " <(cut -f 1 -d" " ${feats_dir}/data/${x}/text.org) <(cut -f 2- -d" " ${feats_dir}/data/${x}/text.org | tr -d " ") \ + > ${feats_dir}/data/${x}/text + utils/text2token.py -n 1 -s 1 ${feats_dir}/data/${x}/text > ${feats_dir}/data/${x}/text.org + mv ${feats_dir}/data/${x}/text.org ${feats_dir}/data/${x}/text + + # convert wav.scp text to jsonl + scp_file_list_arg="++scp_file_list='[\"${feats_dir}/data/${x}/wav.scp\",\"${feats_dir}/data/${x}/text\"]'" + python ../../../funasr/datasets/audio_datasets/scp2jsonl.py \ + ++data_type_list='["source", "target"]' \ + ++jsonl_file_out=${feats_dir}/data/${x}/audio_datasets.jsonl \ + ${scp_file_list_arg} + done +fi + +if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then + echo "stage 1: Feature and CMVN Generation" + python ../../../funasr/bin/compute_audio_cmvn.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++cmvn_file="${feats_dir}/data/${train_set}/cmvn.json" \ + +fi + +token_list=${feats_dir}/data/${lang}_token_list/$token_type/tokens.txt +echo "dictionary: ${token_list}" +if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then + echo "stage 2: Dictionary Preparation" + mkdir -p ${feats_dir}/data/${lang}_token_list/$token_type/ + + echo "make a dictionary" + echo "" > ${token_list} + echo "" >> ${token_list} + echo "" >> ${token_list} + utils/text2token.py -s 1 -n 1 --space "" ${feats_dir}/data/$train_set/text | cut -f 2- -d" " | tr " " "\n" \ + | sort | uniq | grep -a -v -e '^\s*$' | awk '{print $0}' >> ${token_list} + echo "" >> ${token_list} +fi + +# LM Training Stage +if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then + echo "stage 3: LM Training" +fi + +# ASR Training Stage +if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then + echo "stage 4: ASR Training" + + mkdir -p ${exp_dir}/exp/${model_dir} + current_time=$(date "+%Y-%m-%d_%H-%M") + log_file="${exp_dir}/exp/${model_dir}/train.log.txt.${current_time}" + echo "log_file: ${log_file}" + + export CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES + gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + torchrun \ + --nnodes 1 \ + --nproc_per_node ${gpu_num} \ + --master_port ${master_port} \ + ../../../funasr/bin/train.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++valid_data_set_list="${feats_dir}/data/${valid_set}/audio_datasets.jsonl" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++output_dir="${exp_dir}/exp/${model_dir}" &> ${log_file} +fi + + + +# Testing Stage +if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then + echo "stage 5: Inference" + + if [ ${inference_device} == "cuda" ]; then + nj=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + else + inference_batch_size=1 + CUDA_VISIBLE_DEVICES="" + for JOB in $(seq ${nj}); do + CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"-1," + done + fi + + for dset in ${test_sets}; do + + inference_dir="${exp_dir}/exp/${model_dir}/inference-${inference_checkpoint}/${dset}" + _logdir="${inference_dir}/logdir" + echo "inference_dir: ${inference_dir}" + + mkdir -p "${_logdir}" + data_dir="${feats_dir}/data/${dset}" + key_file=${data_dir}/${inference_scp} + + split_scps= + for JOB in $(seq "${nj}"); do + split_scps+=" ${_logdir}/keys.${JOB}.scp" + done + utils/split_scp.pl "${key_file}" ${split_scps} + + gpuid_list_array=(${CUDA_VISIBLE_DEVICES//,/ }) + for JOB in $(seq ${nj}); do + { + id=$((JOB-1)) + gpuid=${gpuid_list_array[$id]} + + export CUDA_VISIBLE_DEVICES=${gpuid} + python ../../../funasr/bin/inference.py \ + --config-path="${exp_dir}/exp/${model_dir}" \ + --config-name="config.yaml" \ + ++init_param="${exp_dir}/exp/${model_dir}/${inference_checkpoint}" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++input="${_logdir}/keys.${JOB}.scp" \ + ++output_dir="${inference_dir}/${JOB}" \ + ++device="${inference_device}" \ + ++ncpu=1 \ + ++disable_log=true \ + ++batch_size="${inference_batch_size}" &> ${_logdir}/log.${JOB}.txt + }& + + done + wait + + mkdir -p ${inference_dir}/1best_recog + for f in token score text; do + if [ -f "${inference_dir}/${JOB}/1best_recog/${f}" ]; then + for JOB in $(seq "${nj}"); do + cat "${inference_dir}/${JOB}/1best_recog/${f}" + done | sort -k1 >"${inference_dir}/1best_recog/${f}" + fi + done + + echo "Computing WER ..." + python utils/postprocess_text_zh.py ${inference_dir}/1best_recog/text ${inference_dir}/1best_recog/text.proc + python utils/postprocess_text_zh.py ${data_dir}/text ${inference_dir}/1best_recog/text.ref + python utils/compute_wer.py ${inference_dir}/1best_recog/text.ref ${inference_dir}/1best_recog/text.proc ${inference_dir}/1best_recog/text.cer + tail -n 3 ${inference_dir}/1best_recog/text.cer + done + +fi \ No newline at end of file diff --git a/examples/aishell/e_branchformer/utils b/examples/aishell/e_branchformer/utils new file mode 100644 index 0000000..1f2ce9d --- /dev/null +++ b/examples/aishell/e_branchformer/utils @@ -0,0 +1 @@ +../paraformer/utils \ No newline at end of file diff --git a/examples/aishell/paraformer/README.md b/examples/aishell/paraformer/README.md new file mode 100644 index 0000000..c0385db --- /dev/null +++ b/examples/aishell/paraformer/README.md @@ -0,0 +1,24 @@ +# Paraformer +pretrained model in [ModelScope](https://www.modelscope.cn/home):[speech_paraformer_asr_nat-aishell1-pytorch](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-aishell1-pytorch/summary) + +## Training Config +- Feature info: using 80 dims fbank, global cmvn, speed perturb(0.9, 1.0, 1.1), specaugment +- Train info: lr 5e-4, batch_size 25000, 2 gpu(Tesla V100), acc_grad 1, 50 epochs +- Train config: conf/train_asr_paraformer_conformer_12e_6d_2048_256.yaml +- LM config: LM was not used + +## Results (CER) + +- Decode config: conf/decode_asr_transformer_noctc_1best.yaml (ctc weight:0.0) + +| testset | CER(%) | +|:-----------:|:-------:| +| dev | 4.66 | +| test | 5.11 | + +- Decode config: conf/decode_asr_transformer.yaml (ctc weight:0.5) + +| testset | CER(%) | +|:-----------:|:-------:| +| dev | 4.52 | +| test | 4.94 | \ No newline at end of file diff --git a/examples/aishell/paraformer/conf/paraformer_conformer_12e_6d_2048_256.yaml b/examples/aishell/paraformer/conf/paraformer_conformer_12e_6d_2048_256.yaml new file mode 100644 index 0000000..75c3098 --- /dev/null +++ b/examples/aishell/paraformer/conf/paraformer_conformer_12e_6d_2048_256.yaml @@ -0,0 +1,118 @@ + +# network architecture +model: Paraformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 + length_normalized_loss: false + predictor_weight: 1.0 + sampling_ratio: 0.4 + use_1st_decoder_loss: true + +# encoder +encoder: ConformerEncoder +encoder_conf: + output_size: 256 # dimension of attention + attention_heads: 4 + linear_units: 2048 # the number of units of position-wise feed forward + num_blocks: 12 # the number of encoder blocks + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: conv2d # encoder architecture type + normalize_before: true + pos_enc_layer_type: rel_pos + selfattention_layer_type: rel_selfattn + activation_type: swish + macaron_style: true + use_cnn_module: true + cnn_module_kernel: 15 + +# decoder +decoder: ParaformerSANDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.0 + src_attention_dropout_rate: 0.0 + +# predictor +predictor: CifPredictor +predictor_conf: + idim: 256 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + avg_nbest_model: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: EspnetStyleBatchSampler + batch_type: length # example or length + batch_size: 25000 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 1024 + shuffle: True + num_workers: 4 + preprocessor_speech: SpeechPreprocessSpeedPerturb + preprocessor_speech_conf: + speed_perturb: [0.9, 1.0, 1.1] + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null + + diff --git a/examples/aishell/paraformer/demo_infer.sh b/examples/aishell/paraformer/demo_infer.sh new file mode 100644 index 0000000..b3b989f --- /dev/null +++ b/examples/aishell/paraformer/demo_infer.sh @@ -0,0 +1,15 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + + +python -m funasr.bin.inference \ +--config-path="/mnt/workspace/FunASR/examples/aishell/paraformer/exp/baseline_paraformer_conformer_12e_6d_2048_256_zh_char_exp3" \ +--config-name="config.yaml" \ +++init_param="/mnt/workspace/FunASR/examples/aishell/paraformer/exp/baseline_paraformer_conformer_12e_6d_2048_256_zh_char_exp3/model.pt.ep38" \ +++tokenizer_conf.token_list="/mnt/nfs/zhifu.gzf/data/AISHELL-1-feats/DATA/data/zh_token_list/char/tokens.txt" \ +++frontend_conf.cmvn_file="/mnt/nfs/zhifu.gzf/data/AISHELL-1-feats/DATA/data/train/am.mvn" \ +++input="/mnt/nfs/zhifu.gzf/data/AISHELL-1/data_aishell/wav/train/S0002/BAC009S0002W0122.wav" \ +++output_dir="./outputs/debug" \ +++device="cuda:0" \ + diff --git a/examples/aishell/paraformer/demo_train_or_finetune.sh b/examples/aishell/paraformer/demo_train_or_finetune.sh new file mode 100644 index 0000000..06607c7 --- /dev/null +++ b/examples/aishell/paraformer/demo_train_or_finetune.sh @@ -0,0 +1,51 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# data dir, which contains: train.json, val.json, tokens.jsonl/tokens.txt, am.mvn +data_dir="/Users/zhifu/funasr1.0/data/list" + +## generate jsonl from wav.scp and text.txt +#python -m funasr.datasets.audio_datasets.scp2jsonl \ +#++scp_file_list='["/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"]' \ +#++data_type_list='["source", "target"]' \ +#++jsonl_file_out=/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" +tokens="${data_dir}/tokens.json" +cmvn_file="${data_dir}/am.mvn" + +# exp output dir +output_dir="/Users/zhifu/exp" +log_file="${output_dir}/log.txt" + +workspace=`pwd` +config="paraformer_conformer_12e_6d_2048_256.yaml" + +init_param="${output_dir}/model.pt" + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +--config-path "${workspace}/conf" \ +--config-name "${config}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++dataset_conf.batch_size=32 \ +++dataset_conf.batch_type="example" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=150 \ +++optim_conf.lr=0.0002 \ +++init_param="${init_param}" \ +++output_dir="${output_dir}" &> ${log_file} diff --git a/examples/aishell/paraformer/local/aishell_data_prep.sh b/examples/aishell/paraformer/local/aishell_data_prep.sh new file mode 100644 index 0000000..83f489b --- /dev/null +++ b/examples/aishell/paraformer/local/aishell_data_prep.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Copyright 2017 Xingyu Na +# Apache 2.0 + +#. ./path.sh || exit 1; + +if [ $# != 3 ]; then + echo "Usage: $0 " + echo " $0 /export/a05/xna/data/data_aishell/wav /export/a05/xna/data/data_aishell/transcript data" + exit 1; +fi + +aishell_audio_dir=$1 +aishell_text=$2/aishell_transcript_v0.8.txt +output_dir=$3 + +train_dir=$output_dir/data/local/train +dev_dir=$output_dir/data/local/dev +test_dir=$output_dir/data/local/test +tmp_dir=$output_dir/data/local/tmp + +mkdir -p $train_dir +mkdir -p $dev_dir +mkdir -p $test_dir +mkdir -p $tmp_dir + +# data directory check +if [ ! -d $aishell_audio_dir ] || [ ! -f $aishell_text ]; then + echo "Error: $0 requires two directory arguments" + exit 1; +fi + +# find wav audio file for train, dev and test resp. +find $aishell_audio_dir -iname "*.wav" > $tmp_dir/wav.flist +n=`cat $tmp_dir/wav.flist | wc -l` +[ $n -ne 141925 ] && \ + echo Warning: expected 141925 data data files, found $n + +grep -i "wav/train" $tmp_dir/wav.flist > $train_dir/wav.flist || exit 1; +grep -i "wav/dev" $tmp_dir/wav.flist > $dev_dir/wav.flist || exit 1; +grep -i "wav/test" $tmp_dir/wav.flist > $test_dir/wav.flist || exit 1; + +rm -r $tmp_dir + +# Transcriptions preparation +for dir in $train_dir $dev_dir $test_dir; do + echo Preparing $dir transcriptions + sed -e 's/\.wav//' $dir/wav.flist | awk -F '/' '{print $NF}' > $dir/utt.list + paste -d' ' $dir/utt.list $dir/wav.flist > $dir/wav.scp_all + utils/filter_scp.pl -f 1 $dir/utt.list $aishell_text > $dir/transcripts.txt + awk '{print $1}' $dir/transcripts.txt > $dir/utt.list + utils/filter_scp.pl -f 1 $dir/utt.list $dir/wav.scp_all | sort -u > $dir/wav.scp + sort -u $dir/transcripts.txt > $dir/text +done + +mkdir -p $output_dir/data/train $output_dir/data/dev $output_dir/data/test + +for f in wav.scp text; do + cp $train_dir/$f $output_dir/data/train/$f || exit 1; + cp $dev_dir/$f $output_dir/data/dev/$f || exit 1; + cp $test_dir/$f $output_dir/data/test/$f || exit 1; +done + +echo "$0: AISHELL data preparation succeeded" +exit 0; diff --git a/examples/aishell/paraformer/local/download_and_untar.sh b/examples/aishell/paraformer/local/download_and_untar.sh new file mode 100644 index 0000000..d982559 --- /dev/null +++ b/examples/aishell/paraformer/local/download_and_untar.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# Copyright 2014 Johns Hopkins University (author: Daniel Povey) +# 2017 Xingyu Na +# Apache 2.0 + +remove_archive=false + +if [ "$1" == --remove-archive ]; then + remove_archive=true + shift +fi + +if [ $# -ne 3 ]; then + echo "Usage: $0 [--remove-archive] " + echo "e.g.: $0 /export/a05/xna/data www.openslr.org/resources/33 data_aishell" + echo "With --remove-archive it will remove the archive after successfully un-tarring it." + echo " can be one of: data_aishell, resource_aishell." +fi + +data=$1 +url=$2 +part=$3 + +if [ ! -d "$data" ]; then + echo "$0: no such directory $data" + exit 1; +fi + +part_ok=false +list="data_aishell resource_aishell" +for x in $list; do + if [ "$part" == $x ]; then part_ok=true; fi +done +if ! $part_ok; then + echo "$0: expected to be one of $list, but got '$part'" + exit 1; +fi + +if [ -z "$url" ]; then + echo "$0: empty URL base." + exit 1; +fi + +if [ -f $data/$part/.complete ]; then + echo "$0: data part $part was already successfully extracted, nothing to do." + exit 0; +fi + +# sizes of the archive files in bytes. +sizes="15582913665 1246920" + +if [ -f $data/$part.tgz ]; then + size=$(/bin/ls -l $data/$part.tgz | awk '{print $5}') + size_ok=false + for s in $sizes; do if [ $s == $size ]; then size_ok=true; fi; done + if ! $size_ok; then + echo "$0: removing existing file $data/$part.tgz because its size in bytes $size" + echo "does not equal the size of one of the archives." + rm $data/$part.tgz + else + echo "$data/$part.tgz exists and appears to be complete." + fi +fi + +if [ ! -f $data/$part.tgz ]; then + if ! command -v wget >/dev/null; then + echo "$0: wget is not installed." + exit 1; + fi + full_url=$url/$part.tgz + echo "$0: downloading data from $full_url. This may take some time, please be patient." + + cd $data || exit 1 + if ! wget --no-check-certificate $full_url; then + echo "$0: error executing wget $full_url" + exit 1; + fi +fi + +cd $data || exit 1 + +if ! tar -xvzf $part.tgz; then + echo "$0: error un-tarring archive $data/$part.tgz" + exit 1; +fi + +touch $data/$part/.complete + +if [ $part == "data_aishell" ]; then + cd $data/$part/wav || exit 1 + for wav in ./*.tar.gz; do + echo "Extracting wav from $wav" + tar -zxf $wav && rm $wav + done +fi + +echo "$0: Successfully downloaded and un-tarred $data/$part.tgz" + +if $remove_archive; then + echo "$0: removing $data/$part.tgz file since --remove-archive option was supplied." + rm $data/$part.tgz +fi + +exit 0; diff --git a/examples/aishell/paraformer/run.sh b/examples/aishell/paraformer/run.sh new file mode 100644 index 0000000..ffef61e --- /dev/null +++ b/examples/aishell/paraformer/run.sh @@ -0,0 +1,201 @@ +#!/usr/bin/env bash + + +CUDA_VISIBLE_DEVICES="0,1" + +# general configuration +feats_dir="../DATA" #feature output dictionary +exp_dir=`pwd` +lang=zh +token_type=char +stage=0 +stop_stage=5 + +# feature configuration +nj=32 + +inference_device="cuda" #"cpu" +inference_checkpoint="model.pt.avg10" +inference_scp="wav.scp" +inference_batch_size=32 + +# data +raw_data=../raw_data +data_url=www.openslr.org/resources/33 + +# exp tag +tag="exp1" +workspace=`pwd` + +master_port=12345 + +. utils/parse_options.sh || exit 1; + +# Set bash to 'debug' mode, it will exit on : +# -e 'error', -u 'undefined variable', -o ... 'error in pipeline', -x 'print commands', +set -e +set -u +set -o pipefail + +train_set=train +valid_set=dev +test_sets="dev test" + +config=paraformer_conformer_12e_6d_2048_256.yaml +model_dir="baseline_$(basename "${config}" .yaml)_${lang}_${token_type}_${tag}" + + +if [ ${stage} -le -1 ] && [ ${stop_stage} -ge -1 ]; then + echo "stage -1: Data Download" + mkdir -p ${raw_data} + local/download_and_untar.sh ${raw_data} ${data_url} data_aishell + local/download_and_untar.sh ${raw_data} ${data_url} resource_aishell +fi + +if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then + echo "stage 0: Data preparation" + # Data preparation + local/aishell_data_prep.sh ${raw_data}/data_aishell/wav ${raw_data}/data_aishell/transcript ${feats_dir} + for x in train dev test; do + cp ${feats_dir}/data/${x}/text ${feats_dir}/data/${x}/text.org + paste -d " " <(cut -f 1 -d" " ${feats_dir}/data/${x}/text.org) <(cut -f 2- -d" " ${feats_dir}/data/${x}/text.org | tr -d " ") \ + > ${feats_dir}/data/${x}/text + utils/text2token.py -n 1 -s 1 ${feats_dir}/data/${x}/text > ${feats_dir}/data/${x}/text.org + mv ${feats_dir}/data/${x}/text.org ${feats_dir}/data/${x}/text + + # convert wav.scp text to jsonl + scp_file_list_arg="++scp_file_list='[\"${feats_dir}/data/${x}/wav.scp\",\"${feats_dir}/data/${x}/text\"]'" + python ../../../funasr/datasets/audio_datasets/scp2jsonl.py \ + ++data_type_list='["source", "target"]' \ + ++jsonl_file_out=${feats_dir}/data/${x}/audio_datasets.jsonl \ + ${scp_file_list_arg} + done +fi + +if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then + echo "stage 1: Feature and CMVN Generation" + python ../../../funasr/bin/compute_audio_cmvn.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++cmvn_file="${feats_dir}/data/${train_set}/cmvn.json" +fi + +token_list=${feats_dir}/data/${lang}_token_list/$token_type/tokens.txt +echo "dictionary: ${token_list}" +if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then + echo "stage 2: Dictionary Preparation" + mkdir -p ${feats_dir}/data/${lang}_token_list/$token_type/ + + echo "make a dictionary" + echo "" > ${token_list} + echo "" >> ${token_list} + echo "" >> ${token_list} + utils/text2token.py -s 1 -n 1 --space "" ${feats_dir}/data/$train_set/text | cut -f 2- -d" " | tr " " "\n" \ + | sort | uniq | grep -a -v -e '^\s*$' | awk '{print $0}' >> ${token_list} + echo "" >> ${token_list} +fi + +# LM Training Stage +if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then + echo "stage 3: LM Training" +fi + +# ASR Training Stage +if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then + echo "stage 4: ASR Training" + + mkdir -p ${exp_dir}/exp/${model_dir} + current_time=$(date "+%Y-%m-%d_%H-%M") + log_file="${exp_dir}/exp/${model_dir}/train.log.txt.${current_time}" + echo "log_file: ${log_file}" + + export CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES + gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + torchrun \ + --nnodes 1 \ + --nproc_per_node ${gpu_num} \ + --master_port ${master_port} \ + ../../../funasr/bin/train.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++valid_data_set_list="${feats_dir}/data/${valid_set}/audio_datasets.jsonl" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++output_dir="${exp_dir}/exp/${model_dir}" &> ${log_file} +fi + + + +# Testing Stage +if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then + echo "stage 5: Inference" + + if [ ${inference_device} == "cuda" ]; then + nj=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + else + inference_batch_size=1 + CUDA_VISIBLE_DEVICES="" + for JOB in $(seq ${nj}); do + CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"-1," + done + fi + + for dset in ${test_sets}; do + + inference_dir="${exp_dir}/exp/${model_dir}/inference-${inference_checkpoint}/${dset}" + _logdir="${inference_dir}/logdir" + echo "inference_dir: ${inference_dir}" + + mkdir -p "${_logdir}" + data_dir="${feats_dir}/data/${dset}" + key_file=${data_dir}/${inference_scp} + + split_scps= + for JOB in $(seq "${nj}"); do + split_scps+=" ${_logdir}/keys.${JOB}.scp" + done + utils/split_scp.pl "${key_file}" ${split_scps} + + gpuid_list_array=(${CUDA_VISIBLE_DEVICES//,/ }) + for JOB in $(seq ${nj}); do + { + id=$((JOB-1)) + gpuid=${gpuid_list_array[$id]} + + export CUDA_VISIBLE_DEVICES=${gpuid} + python ../../../funasr/bin/inference.py \ + --config-path="${exp_dir}/exp/${model_dir}" \ + --config-name="config.yaml" \ + ++init_param="${exp_dir}/exp/${model_dir}/${inference_checkpoint}" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++input="${_logdir}/keys.${JOB}.scp" \ + ++output_dir="${inference_dir}/${JOB}" \ + ++device="${inference_device}" \ + ++ncpu=1 \ + ++disable_log=true \ + ++batch_size="${inference_batch_size}" &> ${_logdir}/log.${JOB}.txt + }& + + done + wait + + mkdir -p ${inference_dir}/1best_recog + for f in token score text; do + if [ -f "${inference_dir}/${JOB}/1best_recog/${f}" ]; then + for JOB in $(seq "${nj}"); do + cat "${inference_dir}/${JOB}/1best_recog/${f}" + done | sort -k1 >"${inference_dir}/1best_recog/${f}" + fi + done + + echo "Computing WER ..." + python utils/postprocess_text_zh.py ${inference_dir}/1best_recog/text ${inference_dir}/1best_recog/text.proc + python utils/postprocess_text_zh.py ${data_dir}/text ${inference_dir}/1best_recog/text.ref + python utils/compute_wer.py ${inference_dir}/1best_recog/text.ref ${inference_dir}/1best_recog/text.proc ${inference_dir}/1best_recog/text.cer + tail -n 3 ${inference_dir}/1best_recog/text.cer + done + +fi \ No newline at end of file diff --git a/examples/aishell/paraformer/utils/compute_wer.py b/examples/aishell/paraformer/utils/compute_wer.py new file mode 100644 index 0000000..3d00010 --- /dev/null +++ b/examples/aishell/paraformer/utils/compute_wer.py @@ -0,0 +1,197 @@ +import os +import numpy as np +import sys + + +def compute_wer(ref_file, hyp_file, cer_detail_file): + rst = { + "Wrd": 0, + "Corr": 0, + "Ins": 0, + "Del": 0, + "Sub": 0, + "Snt": 0, + "Err": 0.0, + "S.Err": 0.0, + "wrong_words": 0, + "wrong_sentences": 0, + } + + hyp_dict = {} + ref_dict = {} + with open(hyp_file, "r") as hyp_reader: + for line in hyp_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + hyp_dict[key] = value + with open(ref_file, "r") as ref_reader: + for line in ref_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + ref_dict[key] = value + + cer_detail_writer = open(cer_detail_file, "w") + for hyp_key in hyp_dict: + if hyp_key in ref_dict: + out_item = compute_wer_by_line(hyp_dict[hyp_key], ref_dict[hyp_key]) + rst["Wrd"] += out_item["nwords"] + rst["Corr"] += out_item["cor"] + rst["wrong_words"] += out_item["wrong"] + rst["Ins"] += out_item["ins"] + rst["Del"] += out_item["del"] + rst["Sub"] += out_item["sub"] + rst["Snt"] += 1 + if out_item["wrong"] > 0: + rst["wrong_sentences"] += 1 + cer_detail_writer.write(hyp_key + print_cer_detail(out_item) + "\n") + cer_detail_writer.write( + "ref:" + "\t" + " ".join(list(map(lambda x: x.lower(), ref_dict[hyp_key]))) + "\n" + ) + cer_detail_writer.write( + "hyp:" + "\t" + " ".join(list(map(lambda x: x.lower(), hyp_dict[hyp_key]))) + "\n" + ) + + if rst["Wrd"] > 0: + rst["Err"] = round(rst["wrong_words"] * 100 / rst["Wrd"], 2) + if rst["Snt"] > 0: + rst["S.Err"] = round(rst["wrong_sentences"] * 100 / rst["Snt"], 2) + + cer_detail_writer.write("\n") + cer_detail_writer.write( + "%WER " + + str(rst["Err"]) + + " [ " + + str(rst["wrong_words"]) + + " / " + + str(rst["Wrd"]) + + ", " + + str(rst["Ins"]) + + " ins, " + + str(rst["Del"]) + + " del, " + + str(rst["Sub"]) + + " sub ]" + + "\n" + ) + cer_detail_writer.write( + "%SER " + + str(rst["S.Err"]) + + " [ " + + str(rst["wrong_sentences"]) + + " / " + + str(rst["Snt"]) + + " ]" + + "\n" + ) + cer_detail_writer.write( + "Scored " + + str(len(hyp_dict)) + + " sentences, " + + str(len(hyp_dict) - rst["Snt"]) + + " not present in hyp." + + "\n" + ) + + +def compute_wer_by_line(hyp, ref): + hyp = list(map(lambda x: x.lower(), hyp)) + ref = list(map(lambda x: x.lower(), ref)) + + len_hyp = len(hyp) + len_ref = len(ref) + + cost_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int16) + + ops_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int8) + + for i in range(len_hyp + 1): + cost_matrix[i][0] = i + for j in range(len_ref + 1): + cost_matrix[0][j] = j + + for i in range(1, len_hyp + 1): + for j in range(1, len_ref + 1): + if hyp[i - 1] == ref[j - 1]: + cost_matrix[i][j] = cost_matrix[i - 1][j - 1] + else: + substitution = cost_matrix[i - 1][j - 1] + 1 + insertion = cost_matrix[i - 1][j] + 1 + deletion = cost_matrix[i][j - 1] + 1 + + compare_val = [substitution, insertion, deletion] + + min_val = min(compare_val) + operation_idx = compare_val.index(min_val) + 1 + cost_matrix[i][j] = min_val + ops_matrix[i][j] = operation_idx + + match_idx = [] + i = len_hyp + j = len_ref + rst = {"nwords": len_ref, "cor": 0, "wrong": 0, "ins": 0, "del": 0, "sub": 0} + while i >= 0 or j >= 0: + i_idx = max(0, i) + j_idx = max(0, j) + + if ops_matrix[i_idx][j_idx] == 0: # correct + if i - 1 >= 0 and j - 1 >= 0: + match_idx.append((j - 1, i - 1)) + rst["cor"] += 1 + + i -= 1 + j -= 1 + + elif ops_matrix[i_idx][j_idx] == 2: # insert + i -= 1 + rst["ins"] += 1 + + elif ops_matrix[i_idx][j_idx] == 3: # delete + j -= 1 + rst["del"] += 1 + + elif ops_matrix[i_idx][j_idx] == 1: # substitute + i -= 1 + j -= 1 + rst["sub"] += 1 + + if i < 0 and j >= 0: + rst["del"] += 1 + elif j < 0 and i >= 0: + rst["ins"] += 1 + + match_idx.reverse() + wrong_cnt = cost_matrix[len_hyp][len_ref] + rst["wrong"] = wrong_cnt + + return rst + + +def print_cer_detail(rst): + return ( + "(" + + "nwords=" + + str(rst["nwords"]) + + ",cor=" + + str(rst["cor"]) + + ",ins=" + + str(rst["ins"]) + + ",del=" + + str(rst["del"]) + + ",sub=" + + str(rst["sub"]) + + ") corr:" + + "{:.2%}".format(rst["cor"] / rst["nwords"]) + + ",cer:" + + "{:.2%}".format(rst["wrong"] / rst["nwords"]) + ) + + +if __name__ == "__main__": + if len(sys.argv) != 4: + print("usage : python compute-wer.py test.ref test.hyp test.wer") + sys.exit(0) + + ref_file = sys.argv[1] + hyp_file = sys.argv[2] + cer_detail_file = sys.argv[3] + compute_wer(ref_file, hyp_file, cer_detail_file) diff --git a/examples/aishell/paraformer/utils/extract_embeds.py b/examples/aishell/paraformer/utils/extract_embeds.py new file mode 100644 index 0000000..e0cf98d --- /dev/null +++ b/examples/aishell/paraformer/utils/extract_embeds.py @@ -0,0 +1,49 @@ +from transformers import AutoTokenizer, AutoModel, pipeline +import numpy as np +import sys +import os +import torch +from kaldiio import WriteHelper +import re + +text_file_json = sys.argv[1] +out_ark = sys.argv[2] +out_scp = sys.argv[3] +out_shape = sys.argv[4] +device = int(sys.argv[5]) +model_path = sys.argv[6] + +model = AutoModel.from_pretrained(model_path) +tokenizer = AutoTokenizer.from_pretrained(model_path) +extractor = pipeline(task="feature-extraction", model=model, tokenizer=tokenizer, device=device) + +with open(text_file_json, "r") as f: + js = f.readlines() + + +f_shape = open(out_shape, "w") +with WriteHelper("ark,scp:{},{}".format(out_ark, out_scp)) as writer: + with torch.no_grad(): + for idx, line in enumerate(js): + id, tokens = line.strip().split(" ", 1) + tokens = re.sub(" ", "", tokens.strip()) + tokens = " ".join([j for j in tokens]) + token_num = len(tokens.split(" ")) + outputs = extractor(tokens) + outputs = np.array(outputs) + embeds = outputs[0, 1:-1, :] + + token_num_embeds, dim = embeds.shape + if token_num == token_num_embeds: + writer(id, embeds) + shape_line = "{} {},{}\n".format(id, token_num_embeds, dim) + f_shape.write(shape_line) + else: + print( + "{}, size has changed, {}, {}, {}".format( + id, token_num, token_num_embeds, tokens + ) + ) + + +f_shape.close() diff --git a/examples/aishell/paraformer/utils/filter_scp.pl b/examples/aishell/paraformer/utils/filter_scp.pl new file mode 100644 index 0000000..003530d --- /dev/null +++ b/examples/aishell/paraformer/utils/filter_scp.pl @@ -0,0 +1,87 @@ +#!/usr/bin/env perl +# Copyright 2010-2012 Microsoft Corporation +# Johns Hopkins University (author: Daniel Povey) + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# This script takes a list of utterance-ids or any file whose first field +# of each line is an utterance-id, and filters an scp +# file (or any file whose "n-th" field is an utterance id), printing +# out only those lines whose "n-th" field is in id_list. The index of +# the "n-th" field is 1, by default, but can be changed by using +# the -f switch + +$exclude = 0; +$field = 1; +$shifted = 0; + +do { + $shifted=0; + if ($ARGV[0] eq "--exclude") { + $exclude = 1; + shift @ARGV; + $shifted=1; + } + if ($ARGV[0] eq "-f") { + $field = $ARGV[1]; + shift @ARGV; shift @ARGV; + $shifted=1 + } +} while ($shifted); + +if(@ARGV < 1 || @ARGV > 2) { + die "Usage: filter_scp.pl [--exclude] [-f ] id_list [in.scp] > out.scp \n" . + "Prints only the input lines whose f'th field (default: first) is in 'id_list'.\n" . + "Note: only the first field of each line in id_list matters. With --exclude, prints\n" . + "only the lines that were *not* in id_list.\n" . + "Caution: previously, the -f option was interpreted as a zero-based field index.\n" . + "If your older scripts (written before Oct 2014) stopped working and you used the\n" . + "-f option, add 1 to the argument.\n" . + "See also: scripts/filter_scp.pl .\n"; +} + + +$idlist = shift @ARGV; +open(F, "<$idlist") || die "Could not open id-list file $idlist"; +while() { + @A = split; + @A>=1 || die "Invalid id-list file line $_"; + $seen{$A[0]} = 1; +} + +if ($field == 1) { # Treat this as special case, since it is common. + while(<>) { + $_ =~ m/\s*(\S+)\s*/ || die "Bad line $_, could not get first field."; + # $1 is what we filter on. + if ((!$exclude && $seen{$1}) || ($exclude && !defined $seen{$1})) { + print $_; + } + } +} else { + while(<>) { + @A = split; + @A > 0 || die "Invalid scp file line $_"; + @A >= $field || die "Invalid scp file line $_"; + if ((!$exclude && $seen{$A[$field-1]}) || ($exclude && !defined $seen{$A[$field-1]})) { + print $_; + } + } +} + +# tests: +# the following should print "foo 1" +# ( echo foo 1; echo bar 2 ) | scripts/filter_scp.pl <(echo foo) +# the following should print "bar 2". +# ( echo foo 1; echo bar 2 ) | scripts/filter_scp.pl -f 2 <(echo 2) diff --git a/examples/aishell/paraformer/utils/fix_data.sh b/examples/aishell/paraformer/utils/fix_data.sh new file mode 100644 index 0000000..b1a2bb8 --- /dev/null +++ b/examples/aishell/paraformer/utils/fix_data.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +echo "$0 $@" +data_dir=$1 + +if [ ! -f ${data_dir}/wav.scp ]; then + echo "$0: wav.scp is not found" + exit 1; +fi + +if [ ! -f ${data_dir}/text ]; then + echo "$0: text is not found" + exit 1; +fi + + + +mkdir -p ${data_dir}/.backup + +awk '{print $1}' ${data_dir}/wav.scp > ${data_dir}/.backup/wav_id +awk '{print $1}' ${data_dir}/text > ${data_dir}/.backup/text_id + +sort ${data_dir}/.backup/wav_id ${data_dir}/.backup/text_id | uniq -d > ${data_dir}/.backup/id + +cp ${data_dir}/wav.scp ${data_dir}/.backup/wav.scp +cp ${data_dir}/text ${data_dir}/.backup/text + +mv ${data_dir}/wav.scp ${data_dir}/wav.scp.bak +mv ${data_dir}/text ${data_dir}/text.bak + +utils/filter_scp.pl -f 1 ${data_dir}/.backup/id ${data_dir}/wav.scp.bak | sort -k1,1 -u > ${data_dir}/wav.scp +utils/filter_scp.pl -f 1 ${data_dir}/.backup/id ${data_dir}/text.bak | sort -k1,1 -u > ${data_dir}/text + +rm ${data_dir}/wav.scp.bak +rm ${data_dir}/text.bak diff --git a/examples/aishell/paraformer/utils/fix_data_feat.sh b/examples/aishell/paraformer/utils/fix_data_feat.sh new file mode 100644 index 0000000..84eea36 --- /dev/null +++ b/examples/aishell/paraformer/utils/fix_data_feat.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +echo "$0 $@" +data_dir=$1 + +if [ ! -f ${data_dir}/feats.scp ]; then + echo "$0: feats.scp is not found" + exit 1; +fi + +if [ ! -f ${data_dir}/text ]; then + echo "$0: text is not found" + exit 1; +fi + +if [ ! -f ${data_dir}/speech_shape ]; then + echo "$0: feature lengths is not found" + exit 1; +fi + +if [ ! -f ${data_dir}/text_shape ]; then + echo "$0: text lengths is not found" + exit 1; +fi + +mkdir -p ${data_dir}/.backup + +awk '{print $1}' ${data_dir}/feats.scp > ${data_dir}/.backup/wav_id +awk '{print $1}' ${data_dir}/text > ${data_dir}/.backup/text_id + +sort ${data_dir}/.backup/wav_id ${data_dir}/.backup/text_id | uniq -d > ${data_dir}/.backup/id + +cp ${data_dir}/feats.scp ${data_dir}/.backup/feats.scp +cp ${data_dir}/text ${data_dir}/.backup/text +cp ${data_dir}/speech_shape ${data_dir}/.backup/speech_shape +cp ${data_dir}/text_shape ${data_dir}/.backup/text_shape + +mv ${data_dir}/feats.scp ${data_dir}/feats.scp.bak +mv ${data_dir}/text ${data_dir}/text.bak +mv ${data_dir}/speech_shape ${data_dir}/speech_shape.bak +mv ${data_dir}/text_shape ${data_dir}/text_shape.bak + +utils/filter_scp.pl -f 1 ${data_dir}/.backup/id ${data_dir}/feats.scp.bak | sort -k1,1 -u > ${data_dir}/feats.scp +utils/filter_scp.pl -f 1 ${data_dir}/.backup/id ${data_dir}/text.bak | sort -k1,1 -u > ${data_dir}/text +utils/filter_scp.pl -f 1 ${data_dir}/.backup/id ${data_dir}/speech_shape.bak | sort -k1,1 -u > ${data_dir}/speech_shape +utils/filter_scp.pl -f 1 ${data_dir}/.backup/id ${data_dir}/text_shape.bak | sort -k1,1 -u > ${data_dir}/text_shape + +rm ${data_dir}/feats.scp.bak +rm ${data_dir}/text.bak +rm ${data_dir}/speech_shape.bak +rm ${data_dir}/text_shape.bak + diff --git a/examples/aishell/paraformer/utils/parse_options.sh b/examples/aishell/paraformer/utils/parse_options.sh new file mode 100644 index 0000000..71fb9e5 --- /dev/null +++ b/examples/aishell/paraformer/utils/parse_options.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +# Copyright 2012 Johns Hopkins University (Author: Daniel Povey); +# Arnab Ghoshal, Karel Vesely + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# Parse command-line options. +# To be sourced by another script (as in ". parse_options.sh"). +# Option format is: --option-name arg +# and shell variable "option_name" gets set to value "arg." +# The exception is --help, which takes no arguments, but prints the +# $help_message variable (if defined). + + +### +### The --config file options have lower priority to command line +### options, so we need to import them first... +### + +# Now import all the configs specified by command-line, in left-to-right order +for ((argpos=1; argpos<$#; argpos++)); do + if [ "${!argpos}" == "--config" ]; then + argpos_plus1=$((argpos+1)) + config=${!argpos_plus1} + [ ! -r $config ] && echo "$0: missing config '$config'" && exit 1 + . $config # source the config file. + fi +done + + +### +### Now we process the command line options +### +while true; do + [ -z "${1:-}" ] && break; # break if there are no arguments + case "$1" in + # If the enclosing script is called with --help option, print the help + # message and exit. Scripts should put help messages in $help_message + --help|-h) if [ -z "$help_message" ]; then echo "No help found." 1>&2; + else printf "$help_message\n" 1>&2 ; fi; + exit 0 ;; + --*=*) echo "$0: options to scripts must be of the form --name value, got '$1'" + exit 1 ;; + # If the first command-line argument begins with "--" (e.g. --foo-bar), + # then work out the variable name as $name, which will equal "foo_bar". + --*) name=`echo "$1" | sed s/^--// | sed s/-/_/g`; + # Next we test whether the variable in question is undefned-- if so it's + # an invalid option and we die. Note: $0 evaluates to the name of the + # enclosing script. + # The test [ -z ${foo_bar+xxx} ] will return true if the variable foo_bar + # is undefined. We then have to wrap this test inside "eval" because + # foo_bar is itself inside a variable ($name). + eval '[ -z "${'$name'+xxx}" ]' && echo "$0: invalid option $1" 1>&2 && exit 1; + + oldval="`eval echo \\$$name`"; + # Work out whether we seem to be expecting a Boolean argument. + if [ "$oldval" == "true" ] || [ "$oldval" == "false" ]; then + was_bool=true; + else + was_bool=false; + fi + + # Set the variable to the right value-- the escaped quotes make it work if + # the option had spaces, like --cmd "queue.pl -sync y" + eval $name=\"$2\"; + + # Check that Boolean-valued arguments are really Boolean. + if $was_bool && [[ "$2" != "true" && "$2" != "false" ]]; then + echo "$0: expected \"true\" or \"false\": $1 $2" 1>&2 + exit 1; + fi + shift 2; + ;; + *) break; + esac +done + + +# Check for an empty argument to the --cmd option, which can easily occur as a +# result of scripting errors. +[ ! -z "${cmd+xxx}" ] && [ -z "$cmd" ] && echo "$0: empty argument to --cmd option" 1>&2 && exit 1; + + +true; # so this script returns exit code 0. diff --git a/examples/aishell/paraformer/utils/postprocess_text_zh.py b/examples/aishell/paraformer/utils/postprocess_text_zh.py new file mode 100644 index 0000000..d03febd --- /dev/null +++ b/examples/aishell/paraformer/utils/postprocess_text_zh.py @@ -0,0 +1,30 @@ +import sys +import re + +in_f = sys.argv[1] +out_f = sys.argv[2] + + +with open(in_f, "r", encoding="utf-8") as f: + lines = f.readlines() + +with open(out_f, "w", encoding="utf-8") as f: + for line in lines: + outs = line.strip().split(" ", 1) + if len(outs) == 2: + idx, text = outs + text = re.sub("", "", text) + text = re.sub("", "", text) + text = re.sub("@@", "", text) + text = re.sub("@", "", text) + text = re.sub("", "", text) + text = re.sub(" ", "", text) + text = text.lower() + else: + idx = outs[0] + text = " " + + text = [x for x in text] + text = " ".join(text) + out = "{} {}\n".format(idx, text) + f.write(out) diff --git a/examples/aishell/paraformer/utils/shuffle_list.pl b/examples/aishell/paraformer/utils/shuffle_list.pl new file mode 100644 index 0000000..a116200 --- /dev/null +++ b/examples/aishell/paraformer/utils/shuffle_list.pl @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +# Copyright 2013 Johns Hopkins University (author: Daniel Povey) + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +if ($ARGV[0] eq "--srand") { + $n = $ARGV[1]; + $n =~ m/\d+/ || die "Bad argument to --srand option: \"$n\""; + srand($ARGV[1]); + shift; + shift; +} else { + srand(0); # Gives inconsistent behavior if we don't seed. +} + +if (@ARGV > 1 || $ARGV[0] =~ m/^-.+/) { # >1 args, or an option we + # don't understand. + print "Usage: shuffle_list.pl [--srand N] [input file] > output\n"; + print "randomizes the order of lines of input.\n"; + exit(1); +} + +@lines; +while (<>) { + push @lines, [ (rand(), $_)] ; +} + +@lines = sort { $a->[0] cmp $b->[0] } @lines; +foreach $l (@lines) { + print $l->[1]; +} \ No newline at end of file diff --git a/examples/aishell/paraformer/utils/split_scp.pl b/examples/aishell/paraformer/utils/split_scp.pl new file mode 100644 index 0000000..0876dcb --- /dev/null +++ b/examples/aishell/paraformer/utils/split_scp.pl @@ -0,0 +1,246 @@ +#!/usr/bin/env perl + +# Copyright 2010-2011 Microsoft Corporation + +# See ../../COPYING for clarification regarding multiple authors +# +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# This program splits up any kind of .scp or archive-type file. +# If there is no utt2spk option it will work on any text file and +# will split it up with an approximately equal number of lines in +# each but. +# With the --utt2spk option it will work on anything that has the +# utterance-id as the first entry on each line; the utt2spk file is +# of the form "utterance speaker" (on each line). +# It splits it into equal size chunks as far as it can. If you use the utt2spk +# option it will make sure these chunks coincide with speaker boundaries. In +# this case, if there are more chunks than speakers (and in some other +# circumstances), some of the resulting chunks will be empty and it will print +# an error message and exit with nonzero status. +# You will normally call this like: +# split_scp.pl scp scp.1 scp.2 scp.3 ... +# or +# split_scp.pl --utt2spk=utt2spk scp scp.1 scp.2 scp.3 ... +# Note that you can use this script to split the utt2spk file itself, +# e.g. split_scp.pl --utt2spk=utt2spk utt2spk utt2spk.1 utt2spk.2 ... + +# You can also call the scripts like: +# split_scp.pl -j 3 0 scp scp.0 +# [note: with this option, it assumes zero-based indexing of the split parts, +# i.e. the second number must be 0 <= n < num-jobs.] + +use warnings; + +$num_jobs = 0; +$job_id = 0; +$utt2spk_file = ""; +$one_based = 0; + +for ($x = 1; $x <= 3 && @ARGV > 0; $x++) { + if ($ARGV[0] eq "-j") { + shift @ARGV; + $num_jobs = shift @ARGV; + $job_id = shift @ARGV; + } + if ($ARGV[0] =~ /--utt2spk=(.+)/) { + $utt2spk_file=$1; + shift; + } + if ($ARGV[0] eq '--one-based') { + $one_based = 1; + shift @ARGV; + } +} + +if ($num_jobs != 0 && ($num_jobs < 0 || $job_id - $one_based < 0 || + $job_id - $one_based >= $num_jobs)) { + die "$0: Invalid job number/index values for '-j $num_jobs $job_id" . + ($one_based ? " --one-based" : "") . "'\n" +} + +$one_based + and $job_id--; + +if(($num_jobs == 0 && @ARGV < 2) || ($num_jobs > 0 && (@ARGV < 1 || @ARGV > 2))) { + die +"Usage: split_scp.pl [--utt2spk=] in.scp out1.scp out2.scp ... + or: split_scp.pl -j num-jobs job-id [--one-based] [--utt2spk=] in.scp [out.scp] + ... where 0 <= job-id < num-jobs, or 1 <= job-id <- num-jobs if --one-based.\n"; +} + +$error = 0; +$inscp = shift @ARGV; +if ($num_jobs == 0) { # without -j option + @OUTPUTS = @ARGV; +} else { + for ($j = 0; $j < $num_jobs; $j++) { + if ($j == $job_id) { + if (@ARGV > 0) { push @OUTPUTS, $ARGV[0]; } + else { push @OUTPUTS, "-"; } + } else { + push @OUTPUTS, "/dev/null"; + } + } +} + +if ($utt2spk_file ne "") { # We have the --utt2spk option... + open($u_fh, '<', $utt2spk_file) || die "$0: Error opening utt2spk file $utt2spk_file: $!\n"; + while(<$u_fh>) { + @A = split; + @A == 2 || die "$0: Bad line $_ in utt2spk file $utt2spk_file\n"; + ($u,$s) = @A; + $utt2spk{$u} = $s; + } + close $u_fh; + open($i_fh, '<', $inscp) || die "$0: Error opening input scp file $inscp: $!\n"; + @spkrs = (); + while(<$i_fh>) { + @A = split; + if(@A == 0) { die "$0: Empty or space-only line in scp file $inscp\n"; } + $u = $A[0]; + $s = $utt2spk{$u}; + defined $s || die "$0: No utterance $u in utt2spk file $utt2spk_file\n"; + if(!defined $spk_count{$s}) { + push @spkrs, $s; + $spk_count{$s} = 0; + $spk_data{$s} = []; # ref to new empty array. + } + $spk_count{$s}++; + push @{$spk_data{$s}}, $_; + } + # Now split as equally as possible .. + # First allocate spks to files by allocating an approximately + # equal number of speakers. + $numspks = @spkrs; # number of speakers. + $numscps = @OUTPUTS; # number of output files. + if ($numspks < $numscps) { + die "$0: Refusing to split data because number of speakers $numspks " . + "is less than the number of output .scp files $numscps\n"; + } + for($scpidx = 0; $scpidx < $numscps; $scpidx++) { + $scparray[$scpidx] = []; # [] is array reference. + } + for ($spkidx = 0; $spkidx < $numspks; $spkidx++) { + $scpidx = int(($spkidx*$numscps) / $numspks); + $spk = $spkrs[$spkidx]; + push @{$scparray[$scpidx]}, $spk; + $scpcount[$scpidx] += $spk_count{$spk}; + } + + # Now will try to reassign beginning + ending speakers + # to different scp's and see if it gets more balanced. + # Suppose objf we're minimizing is sum_i (num utts in scp[i] - average)^2. + # We can show that if considering changing just 2 scp's, we minimize + # this by minimizing the squared difference in sizes. This is + # equivalent to minimizing the absolute difference in sizes. This + # shows this method is bound to converge. + + $changed = 1; + while($changed) { + $changed = 0; + for($scpidx = 0; $scpidx < $numscps; $scpidx++) { + # First try to reassign ending spk of this scp. + if($scpidx < $numscps-1) { + $sz = @{$scparray[$scpidx]}; + if($sz > 0) { + $spk = $scparray[$scpidx]->[$sz-1]; + $count = $spk_count{$spk}; + $nutt1 = $scpcount[$scpidx]; + $nutt2 = $scpcount[$scpidx+1]; + if( abs( ($nutt2+$count) - ($nutt1-$count)) + < abs($nutt2 - $nutt1)) { # Would decrease + # size-diff by reassigning spk... + $scpcount[$scpidx+1] += $count; + $scpcount[$scpidx] -= $count; + pop @{$scparray[$scpidx]}; + unshift @{$scparray[$scpidx+1]}, $spk; + $changed = 1; + } + } + } + if($scpidx > 0 && @{$scparray[$scpidx]} > 0) { + $spk = $scparray[$scpidx]->[0]; + $count = $spk_count{$spk}; + $nutt1 = $scpcount[$scpidx-1]; + $nutt2 = $scpcount[$scpidx]; + if( abs( ($nutt2-$count) - ($nutt1+$count)) + < abs($nutt2 - $nutt1)) { # Would decrease + # size-diff by reassigning spk... + $scpcount[$scpidx-1] += $count; + $scpcount[$scpidx] -= $count; + shift @{$scparray[$scpidx]}; + push @{$scparray[$scpidx-1]}, $spk; + $changed = 1; + } + } + } + } + # Now print out the files... + for($scpidx = 0; $scpidx < $numscps; $scpidx++) { + $scpfile = $OUTPUTS[$scpidx]; + ($scpfile ne '-' ? open($f_fh, '>', $scpfile) + : open($f_fh, '>&', \*STDOUT)) || + die "$0: Could not open scp file $scpfile for writing: $!\n"; + $count = 0; + if(@{$scparray[$scpidx]} == 0) { + print STDERR "$0: eError: split_scp.pl producing empty .scp file " . + "$scpfile (too many splits and too few speakers?)\n"; + $error = 1; + } else { + foreach $spk ( @{$scparray[$scpidx]} ) { + print $f_fh @{$spk_data{$spk}}; + $count += $spk_count{$spk}; + } + $count == $scpcount[$scpidx] || die "Count mismatch [code error]"; + } + close($f_fh); + } +} else { + # This block is the "normal" case where there is no --utt2spk + # option and we just break into equal size chunks. + + open($i_fh, '<', $inscp) || die "$0: Error opening input scp file $inscp: $!\n"; + + $numscps = @OUTPUTS; # size of array. + @F = (); + while(<$i_fh>) { + push @F, $_; + } + $numlines = @F; + if($numlines == 0) { + print STDERR "$0: error: empty input scp file $inscp\n"; + $error = 1; + } + $linesperscp = int( $numlines / $numscps); # the "whole part".. + $linesperscp >= 1 || die "$0: You are splitting into too many pieces! [reduce \$nj ($numscps) to be smaller than the number of lines ($numlines) in $inscp]\n"; + $remainder = $numlines - ($linesperscp * $numscps); + ($remainder >= 0 && $remainder < $numlines) || die "bad remainder $remainder"; + # [just doing int() rounds down]. + $n = 0; + for($scpidx = 0; $scpidx < @OUTPUTS; $scpidx++) { + $scpfile = $OUTPUTS[$scpidx]; + ($scpfile ne '-' ? open($o_fh, '>', $scpfile) + : open($o_fh, '>&', \*STDOUT)) || + die "$0: Could not open scp file $scpfile for writing: $!\n"; + for($k = 0; $k < $linesperscp + ($scpidx < $remainder ? 1 : 0); $k++) { + print $o_fh $F[$n++]; + } + close($o_fh) || die "$0: Eror closing scp file $scpfile: $!\n"; + } + $n == $numlines || die "$n != $numlines [code error]"; +} + +exit ($error); diff --git a/examples/aishell/paraformer/utils/text2token.py b/examples/aishell/paraformer/utils/text2token.py new file mode 100644 index 0000000..263cb9d --- /dev/null +++ b/examples/aishell/paraformer/utils/text2token.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 + +# Copyright 2017 Johns Hopkins University (Shinji Watanabe) +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + + +import argparse +import codecs +import re +import sys + +is_python2 = sys.version_info[0] == 2 + + +def exist_or_not(i, match_pos): + start_pos = None + end_pos = None + for pos in match_pos: + if pos[0] <= i < pos[1]: + start_pos = pos[0] + end_pos = pos[1] + break + + return start_pos, end_pos + + +def get_parser(): + parser = argparse.ArgumentParser( + description="convert raw text to tokenized text", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.add_argument( + "--nchar", + "-n", + default=1, + type=int, + help="number of characters to split, i.e., \ + aabb -> a a b b with -n 1 and aa bb with -n 2", + ) + parser.add_argument("--skip-ncols", "-s", default=0, type=int, help="skip first n columns") + parser.add_argument("--space", default="", type=str, help="space symbol") + parser.add_argument( + "--non-lang-syms", + "-l", + default=None, + type=str, + help="list of non-linguistic symobles, e.g., etc.", + ) + parser.add_argument("text", type=str, default=False, nargs="?", help="input text") + parser.add_argument( + "--trans_type", + "-t", + type=str, + default="char", + choices=["char", "phn"], + help="""Transcript type. char/phn. e.g., for TIMIT FADG0_SI1279 - + If trans_type is char, + read from SI1279.WRD file -> "bricks are an alternative" + Else if trans_type is phn, + read from SI1279.PHN file -> "sil b r ih sil k s aa r er n aa l + sil t er n ih sil t ih v sil" """, + ) + return parser + + +def main(): + parser = get_parser() + args = parser.parse_args() + + rs = [] + if args.non_lang_syms is not None: + with codecs.open(args.non_lang_syms, "r", encoding="utf-8") as f: + nls = [x.rstrip() for x in f.readlines()] + rs = [re.compile(re.escape(x)) for x in nls] + + if args.text: + f = codecs.open(args.text, encoding="utf-8") + else: + f = codecs.getreader("utf-8")(sys.stdin if is_python2 else sys.stdin.buffer) + + sys.stdout = codecs.getwriter("utf-8")(sys.stdout if is_python2 else sys.stdout.buffer) + line = f.readline() + n = args.nchar + while line: + x = line.split() + print(" ".join(x[: args.skip_ncols]), end=" ") + a = " ".join(x[args.skip_ncols :]) + + # get all matched positions + match_pos = [] + for r in rs: + i = 0 + while i >= 0: + m = r.search(a, i) + if m: + match_pos.append([m.start(), m.end()]) + i = m.end() + else: + break + + if args.trans_type == "phn": + a = a.split(" ") + else: + if len(match_pos) > 0: + chars = [] + i = 0 + while i < len(a): + start_pos, end_pos = exist_or_not(i, match_pos) + if start_pos is not None: + chars.append(a[start_pos:end_pos]) + i = end_pos + else: + chars.append(a[i]) + i += 1 + a = chars + + a = [a[j : j + n] for j in range(0, len(a), n)] + + a_flat = [] + for z in a: + a_flat.append("".join(z)) + + a_chars = [z.replace(" ", args.space) for z in a_flat] + if args.trans_type == "phn": + a_chars = [z.replace("sil", args.space) for z in a_chars] + print(" ".join(a_chars)) + line = f.readline() + + +if __name__ == "__main__": + main() diff --git a/examples/aishell/paraformer/utils/text_tokenize.py b/examples/aishell/paraformer/utils/text_tokenize.py new file mode 100644 index 0000000..31500f1 --- /dev/null +++ b/examples/aishell/paraformer/utils/text_tokenize.py @@ -0,0 +1,104 @@ +import re +import argparse + + +def load_dict(seg_file): + seg_dict = {} + with open(seg_file, "r") as infile: + for line in infile: + s = line.strip().split() + key = s[0] + value = s[1:] + seg_dict[key] = " ".join(value) + return seg_dict + + +def forward_segment(text, dic): + word_list = [] + i = 0 + while i < len(text): + longest_word = text[i] + for j in range(i + 1, len(text) + 1): + word = text[i:j] + if word in dic: + if len(word) > len(longest_word): + longest_word = word + word_list.append(longest_word) + i += len(longest_word) + return word_list + + +def tokenize(txt, seg_dict): + out_txt = "" + pattern = re.compile(r"([\u4E00-\u9FA5A-Za-z0-9])") + for word in txt: + if pattern.match(word): + if word in seg_dict: + out_txt += seg_dict[word] + " " + else: + out_txt += "" + " " + else: + continue + return out_txt.strip() + + +def get_parser(): + parser = argparse.ArgumentParser( + description="text tokenize", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.add_argument( + "--text-file", + "-t", + default=False, + required=True, + type=str, + help="input text", + ) + parser.add_argument( + "--seg-file", + "-s", + default=False, + required=True, + type=str, + help="seg file", + ) + parser.add_argument( + "--txt-index", + "-i", + default=1, + required=True, + type=int, + help="txt index", + ) + parser.add_argument( + "--output-dir", + "-o", + default=False, + required=True, + type=str, + help="output dir", + ) + return parser + + +def main(): + parser = get_parser() + args = parser.parse_args() + + txt_writer = open("{}/text.{}.txt".format(args.output_dir, args.txt_index), "w") + shape_writer = open("{}/len.{}".format(args.output_dir, args.txt_index), "w") + seg_dict = load_dict(args.seg_file) + with open(args.text_file, "r") as infile: + for line in infile: + s = line.strip().split() + text_id = s[0] + text_list = forward_segment("".join(s[1:]).lower(), seg_dict) + text = tokenize(text_list, seg_dict) + lens = len(text.strip().split()) + txt_writer.write(text_id + " " + text + "\n") + shape_writer.write(text_id + " " + str(lens) + "\n") + + +if __name__ == "__main__": + main() diff --git a/examples/aishell/paraformer/utils/text_tokenize.sh b/examples/aishell/paraformer/utils/text_tokenize.sh new file mode 100644 index 0000000..6b74fef --- /dev/null +++ b/examples/aishell/paraformer/utils/text_tokenize.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + + +# Begin configuration section. +nj=32 +cmd=utils/run.pl + +echo "$0 $@" + +. utils/parse_options.sh || exit 1; + +# tokenize configuration +text_dir=$1 +seg_file=$2 +logdir=$3 +output_dir=$4 + +txt_dir=${output_dir}/txt; mkdir -p ${output_dir}/txt +mkdir -p ${logdir} + +$cmd JOB=1:$nj $logdir/text_tokenize.JOB.log \ + python utils/text_tokenize.py -t ${text_dir}/txt/text.JOB.txt \ + -s ${seg_file} -i JOB -o ${txt_dir} \ + || exit 1; + +# concatenate the text files together. +for n in $(seq $nj); do + cat ${txt_dir}/text.$n.txt || exit 1 +done > ${output_dir}/text || exit 1 + +for n in $(seq $nj); do + cat ${txt_dir}/len.$n || exit 1 +done > ${output_dir}/text_shape || exit 1 + +echo "$0: Succeeded text tokenize" diff --git a/examples/aishell/paraformer/utils/textnorm_zh.py b/examples/aishell/paraformer/utils/textnorm_zh.py new file mode 100644 index 0000000..9de8e81 --- /dev/null +++ b/examples/aishell/paraformer/utils/textnorm_zh.py @@ -0,0 +1,911 @@ +#!/usr/bin/env python3 +# coding=utf-8 + +# Authors: +# 2019.5 Zhiyang Zhou (https://github.com/Joee1995/chn_text_norm.git) +# 2019.9 Jiayu DU +# +# requirements: +# - python 3.X +# notes: python 2.X WILL fail or produce misleading results + +import sys, os, argparse, codecs, string, re + +# ================================================================================ # +# basic constant +# ================================================================================ # +CHINESE_DIGIS = "零一二三四五六七八九" +BIG_CHINESE_DIGIS_SIMPLIFIED = "零壹贰叁肆伍陆柒捌玖" +BIG_CHINESE_DIGIS_TRADITIONAL = "零壹貳參肆伍陸柒捌玖" +SMALLER_BIG_CHINESE_UNITS_SIMPLIFIED = "十百千万" +SMALLER_BIG_CHINESE_UNITS_TRADITIONAL = "拾佰仟萬" +LARGER_CHINESE_NUMERING_UNITS_SIMPLIFIED = "亿兆京垓秭穰沟涧正载" +LARGER_CHINESE_NUMERING_UNITS_TRADITIONAL = "億兆京垓秭穰溝澗正載" +SMALLER_CHINESE_NUMERING_UNITS_SIMPLIFIED = "十百千万" +SMALLER_CHINESE_NUMERING_UNITS_TRADITIONAL = "拾佰仟萬" + +ZERO_ALT = "〇" +ONE_ALT = "幺" +TWO_ALTS = ["两", "兩"] + +POSITIVE = ["正", "正"] +NEGATIVE = ["负", "負"] +POINT = ["点", "點"] +# PLUS = [u'加', u'加'] +# SIL = [u'杠', u'槓'] + +FILLER_CHARS = ["呃", "啊"] +ER_WHITELIST = ( + "(儿女|儿子|儿孙|女儿|儿媳|妻儿|" + "胎儿|婴儿|新生儿|婴幼儿|幼儿|少儿|小儿|儿歌|儿童|儿科|托儿所|孤儿|" + "儿戏|儿化|台儿庄|鹿儿岛|正儿八经|吊儿郎当|生儿育女|托儿带女|养儿防老|痴儿呆女|" + "佳儿佳妇|儿怜兽扰|儿无常父|儿不嫌母丑|儿行千里母担忧|儿大不由爷|苏乞儿)" +) + +# 中文数字系统类型 +NUMBERING_TYPES = ["low", "mid", "high"] + +CURRENCY_NAMES = ( + "(人民币|美元|日元|英镑|欧元|马克|法郎|加拿大元|澳元|港币|先令|芬兰马克|爱尔兰镑|" + "里拉|荷兰盾|埃斯库多|比塞塔|印尼盾|林吉特|新西兰元|比索|卢布|新加坡元|韩元|泰铢)" +) +CURRENCY_UNITS = ( + "((亿|千万|百万|万|千|百)|(亿|千万|百万|万|千|百|)元|(亿|千万|百万|万|千|百|)块|角|毛|分)" +) +COM_QUANTIFIERS = ( + "(匹|张|座|回|场|尾|条|个|首|阙|阵|网|炮|顶|丘|棵|只|支|袭|辆|挑|担|颗|壳|窠|曲|墙|群|腔|" + "砣|座|客|贯|扎|捆|刀|令|打|手|罗|坡|山|岭|江|溪|钟|队|单|双|对|出|口|头|脚|板|跳|枝|件|贴|" + "针|线|管|名|位|身|堂|课|本|页|家|户|层|丝|毫|厘|分|钱|两|斤|担|铢|石|钧|锱|忽|(千|毫|微)克|" + "毫|厘|分|寸|尺|丈|里|寻|常|铺|程|(千|分|厘|毫|微)米|撮|勺|合|升|斗|石|盘|碗|碟|叠|桶|笼|盆|" + "盒|杯|钟|斛|锅|簋|篮|盘|桶|罐|瓶|壶|卮|盏|箩|箱|煲|啖|袋|钵|年|月|日|季|刻|时|周|天|秒|分|旬|" + "纪|岁|世|更|夜|春|夏|秋|冬|代|伏|辈|丸|泡|粒|颗|幢|堆|条|根|支|道|面|片|张|颗|块)" +) + +# punctuation information are based on Zhon project (https://github.com/tsroten/zhon.git) +CHINESE_PUNC_STOP = "!?。。" +CHINESE_PUNC_NON_STOP = ""#$%&'()*+,-/:;<=>@[\]^_`{|}~⦅⦆「」、、〃》「」『』【】〔〕〖〗〘〙〚〛〜〝〞〟〰〾〿–—‘’‛“”„‟…‧﹏" +CHINESE_PUNC_LIST = CHINESE_PUNC_STOP + CHINESE_PUNC_NON_STOP + + +# ================================================================================ # +# basic class +# ================================================================================ # +class ChineseChar(object): + """ + 中文字符 + 每个字符对应简体和繁体, + e.g. 简体 = '负', 繁体 = '負' + 转换时可转换为简体或繁体 + """ + + def __init__(self, simplified, traditional): + self.simplified = simplified + self.traditional = traditional + # self.__repr__ = self.__str__ + + def __str__(self): + return self.simplified or self.traditional or None + + def __repr__(self): + return self.__str__() + + +class ChineseNumberUnit(ChineseChar): + """ + 中文数字/数位字符 + 每个字符除繁简体外还有一个额外的大写字符 + e.g. '陆' 和 '陸' + """ + + def __init__(self, power, simplified, traditional, big_s, big_t): + super(ChineseNumberUnit, self).__init__(simplified, traditional) + self.power = power + self.big_s = big_s + self.big_t = big_t + + def __str__(self): + return "10^{}".format(self.power) + + @classmethod + def create(cls, index, value, numbering_type=NUMBERING_TYPES[1], small_unit=False): + + if small_unit: + return ChineseNumberUnit( + power=index + 1, + simplified=value[0], + traditional=value[1], + big_s=value[1], + big_t=value[1], + ) + elif numbering_type == NUMBERING_TYPES[0]: + return ChineseNumberUnit( + power=index + 8, + simplified=value[0], + traditional=value[1], + big_s=value[0], + big_t=value[1], + ) + elif numbering_type == NUMBERING_TYPES[1]: + return ChineseNumberUnit( + power=(index + 2) * 4, + simplified=value[0], + traditional=value[1], + big_s=value[0], + big_t=value[1], + ) + elif numbering_type == NUMBERING_TYPES[2]: + return ChineseNumberUnit( + power=pow(2, index + 3), + simplified=value[0], + traditional=value[1], + big_s=value[0], + big_t=value[1], + ) + else: + raise ValueError( + "Counting type should be in {0} ({1} provided).".format( + NUMBERING_TYPES, numbering_type + ) + ) + + +class ChineseNumberDigit(ChineseChar): + """ + 中文数字字符 + """ + + def __init__(self, value, simplified, traditional, big_s, big_t, alt_s=None, alt_t=None): + super(ChineseNumberDigit, self).__init__(simplified, traditional) + self.value = value + self.big_s = big_s + self.big_t = big_t + self.alt_s = alt_s + self.alt_t = alt_t + + def __str__(self): + return str(self.value) + + @classmethod + def create(cls, i, v): + return ChineseNumberDigit(i, v[0], v[1], v[2], v[3]) + + +class ChineseMath(ChineseChar): + """ + 中文数位字符 + """ + + def __init__(self, simplified, traditional, symbol, expression=None): + super(ChineseMath, self).__init__(simplified, traditional) + self.symbol = symbol + self.expression = expression + self.big_s = simplified + self.big_t = traditional + + +CC, CNU, CND, CM = ChineseChar, ChineseNumberUnit, ChineseNumberDigit, ChineseMath + + +class NumberSystem(object): + """ + 中文数字系统 + """ + + pass + + +class MathSymbol(object): + """ + 用于中文数字系统的数学符号 (繁/简体), e.g. + positive = ['正', '正'] + negative = ['负', '負'] + point = ['点', '點'] + """ + + def __init__(self, positive, negative, point): + self.positive = positive + self.negative = negative + self.point = point + + def __iter__(self): + for v in self.__dict__.values(): + yield v + + +# class OtherSymbol(object): +# """ +# 其他符号 +# """ +# +# def __init__(self, sil): +# self.sil = sil +# +# def __iter__(self): +# for v in self.__dict__.values(): +# yield v + + +# ================================================================================ # +# basic utils +# ================================================================================ # +def create_system(numbering_type=NUMBERING_TYPES[1]): + """ + 根据数字系统类型返回创建相应的数字系统,默认为 mid + NUMBERING_TYPES = ['low', 'mid', 'high']: 中文数字系统类型 + low: '兆' = '亿' * '十' = $10^{9}$, '京' = '兆' * '十', etc. + mid: '兆' = '亿' * '万' = $10^{12}$, '京' = '兆' * '万', etc. + high: '兆' = '亿' * '亿' = $10^{16}$, '京' = '兆' * '兆', etc. + 返回对应的数字系统 + """ + + # chinese number units of '亿' and larger + all_larger_units = zip( + LARGER_CHINESE_NUMERING_UNITS_SIMPLIFIED, LARGER_CHINESE_NUMERING_UNITS_TRADITIONAL + ) + larger_units = [CNU.create(i, v, numbering_type, False) for i, v in enumerate(all_larger_units)] + # chinese number units of '十, 百, 千, 万' + all_smaller_units = zip( + SMALLER_CHINESE_NUMERING_UNITS_SIMPLIFIED, SMALLER_CHINESE_NUMERING_UNITS_TRADITIONAL + ) + smaller_units = [CNU.create(i, v, small_unit=True) for i, v in enumerate(all_smaller_units)] + # digis + chinese_digis = zip( + CHINESE_DIGIS, CHINESE_DIGIS, BIG_CHINESE_DIGIS_SIMPLIFIED, BIG_CHINESE_DIGIS_TRADITIONAL + ) + digits = [CND.create(i, v) for i, v in enumerate(chinese_digis)] + digits[0].alt_s, digits[0].alt_t = ZERO_ALT, ZERO_ALT + digits[1].alt_s, digits[1].alt_t = ONE_ALT, ONE_ALT + digits[2].alt_s, digits[2].alt_t = TWO_ALTS[0], TWO_ALTS[1] + + # symbols + positive_cn = CM(POSITIVE[0], POSITIVE[1], "+", lambda x: x) + negative_cn = CM(NEGATIVE[0], NEGATIVE[1], "-", lambda x: -x) + point_cn = CM(POINT[0], POINT[1], ".", lambda x, y: float(str(x) + "." + str(y))) + # sil_cn = CM(SIL[0], SIL[1], '-', lambda x, y: float(str(x) + '-' + str(y))) + system = NumberSystem() + system.units = smaller_units + larger_units + system.digits = digits + system.math = MathSymbol(positive_cn, negative_cn, point_cn) + # system.symbols = OtherSymbol(sil_cn) + return system + + +def chn2num(chinese_string, numbering_type=NUMBERING_TYPES[1]): + + def get_symbol(char, system): + for u in system.units: + if char in [u.traditional, u.simplified, u.big_s, u.big_t]: + return u + for d in system.digits: + if char in [d.traditional, d.simplified, d.big_s, d.big_t, d.alt_s, d.alt_t]: + return d + for m in system.math: + if char in [m.traditional, m.simplified]: + return m + + def string2symbols(chinese_string, system): + int_string, dec_string = chinese_string, "" + for p in [system.math.point.simplified, system.math.point.traditional]: + if p in chinese_string: + int_string, dec_string = chinese_string.split(p) + break + return [get_symbol(c, system) for c in int_string], [ + get_symbol(c, system) for c in dec_string + ] + + def correct_symbols(integer_symbols, system): + """ + 一百八 to 一百八十 + 一亿一千三百万 to 一亿 一千万 三百万 + """ + + if integer_symbols and isinstance(integer_symbols[0], CNU): + if integer_symbols[0].power == 1: + integer_symbols = [system.digits[1]] + integer_symbols + + if len(integer_symbols) > 1: + if isinstance(integer_symbols[-1], CND) and isinstance(integer_symbols[-2], CNU): + integer_symbols.append(CNU(integer_symbols[-2].power - 1, None, None, None, None)) + + result = [] + unit_count = 0 + for s in integer_symbols: + if isinstance(s, CND): + result.append(s) + unit_count = 0 + elif isinstance(s, CNU): + current_unit = CNU(s.power, None, None, None, None) + unit_count += 1 + + if unit_count == 1: + result.append(current_unit) + elif unit_count > 1: + for i in range(len(result)): + if ( + isinstance(result[-i - 1], CNU) + and result[-i - 1].power < current_unit.power + ): + result[-i - 1] = CNU( + result[-i - 1].power + current_unit.power, None, None, None, None + ) + return result + + def compute_value(integer_symbols): + """ + Compute the value. + When current unit is larger than previous unit, current unit * all previous units will be used as all previous units. + e.g. '两千万' = 2000 * 10000 not 2000 + 10000 + """ + value = [0] + last_power = 0 + for s in integer_symbols: + if isinstance(s, CND): + value[-1] = s.value + elif isinstance(s, CNU): + value[-1] *= pow(10, s.power) + if s.power > last_power: + value[:-1] = list(map(lambda v: v * pow(10, s.power), value[:-1])) + last_power = s.power + value.append(0) + return sum(value) + + system = create_system(numbering_type) + int_part, dec_part = string2symbols(chinese_string, system) + int_part = correct_symbols(int_part, system) + int_str = str(compute_value(int_part)) + dec_str = "".join([str(d.value) for d in dec_part]) + if dec_part: + return "{0}.{1}".format(int_str, dec_str) + else: + return int_str + + +def num2chn( + number_string, + numbering_type=NUMBERING_TYPES[1], + big=False, + traditional=False, + alt_zero=False, + alt_one=False, + alt_two=True, + use_zeros=True, + use_units=True, +): + + def get_value(value_string, use_zeros=True): + + striped_string = value_string.lstrip("0") + + # record nothing if all zeros + if not striped_string: + return [] + + # record one digits + elif len(striped_string) == 1: + if use_zeros and len(value_string) != len(striped_string): + return [system.digits[0], system.digits[int(striped_string)]] + else: + return [system.digits[int(striped_string)]] + + # recursively record multiple digits + else: + result_unit = next(u for u in reversed(system.units) if u.power < len(striped_string)) + result_string = value_string[: -result_unit.power] + return ( + get_value(result_string) + + [result_unit] + + get_value(striped_string[-result_unit.power :]) + ) + + system = create_system(numbering_type) + + int_dec = number_string.split(".") + if len(int_dec) == 1: + int_string = int_dec[0] + dec_string = "" + elif len(int_dec) == 2: + int_string = int_dec[0] + dec_string = int_dec[1] + else: + raise ValueError( + "invalid input num string with more than one dot: {}".format(number_string) + ) + + if use_units and len(int_string) > 1: + result_symbols = get_value(int_string) + else: + result_symbols = [system.digits[int(c)] for c in int_string] + dec_symbols = [system.digits[int(c)] for c in dec_string] + if dec_string: + result_symbols += [system.math.point] + dec_symbols + + if alt_two: + liang = CND( + 2, + system.digits[2].alt_s, + system.digits[2].alt_t, + system.digits[2].big_s, + system.digits[2].big_t, + ) + for i, v in enumerate(result_symbols): + if isinstance(v, CND) and v.value == 2: + next_symbol = result_symbols[i + 1] if i < len(result_symbols) - 1 else None + previous_symbol = result_symbols[i - 1] if i > 0 else None + if isinstance(next_symbol, CNU) and isinstance(previous_symbol, (CNU, type(None))): + if next_symbol.power != 1 and ( + (previous_symbol is None) or (previous_symbol.power != 1) + ): + result_symbols[i] = liang + + # if big is True, '两' will not be used and `alt_two` has no impact on output + if big: + attr_name = "big_" + if traditional: + attr_name += "t" + else: + attr_name += "s" + else: + if traditional: + attr_name = "traditional" + else: + attr_name = "simplified" + + result = "".join([getattr(s, attr_name) for s in result_symbols]) + + # if not use_zeros: + # result = result.strip(getattr(system.digits[0], attr_name)) + + if alt_zero: + result = result.replace(getattr(system.digits[0], attr_name), system.digits[0].alt_s) + + if alt_one: + result = result.replace(getattr(system.digits[1], attr_name), system.digits[1].alt_s) + + for i, p in enumerate(POINT): + if result.startswith(p): + return CHINESE_DIGIS[0] + result + + # ^10, 11, .., 19 + if ( + len(result) >= 2 + and result[1] + in [ + SMALLER_CHINESE_NUMERING_UNITS_SIMPLIFIED[0], + SMALLER_CHINESE_NUMERING_UNITS_TRADITIONAL[0], + ] + and result[0] + in [CHINESE_DIGIS[1], BIG_CHINESE_DIGIS_SIMPLIFIED[1], BIG_CHINESE_DIGIS_TRADITIONAL[1]] + ): + result = result[1:] + + return result + + +# ================================================================================ # +# different types of rewriters +# ================================================================================ # +class Cardinal: + """ + CARDINAL类 + """ + + def __init__(self, cardinal=None, chntext=None): + self.cardinal = cardinal + self.chntext = chntext + + def chntext2cardinal(self): + return chn2num(self.chntext) + + def cardinal2chntext(self): + return num2chn(self.cardinal) + + +class Digit: + """ + DIGIT类 + """ + + def __init__(self, digit=None, chntext=None): + self.digit = digit + self.chntext = chntext + + # def chntext2digit(self): + # return chn2num(self.chntext) + + def digit2chntext(self): + return num2chn(self.digit, alt_two=False, use_units=False) + + +class TelePhone: + """ + TELEPHONE类 + """ + + def __init__(self, telephone=None, raw_chntext=None, chntext=None): + self.telephone = telephone + self.raw_chntext = raw_chntext + self.chntext = chntext + + # def chntext2telephone(self): + # sil_parts = self.raw_chntext.split('') + # self.telephone = '-'.join([ + # str(chn2num(p)) for p in sil_parts + # ]) + # return self.telephone + + def telephone2chntext(self, fixed=False): + + if fixed: + sil_parts = self.telephone.split("-") + self.raw_chntext = "".join( + [num2chn(part, alt_two=False, use_units=False) for part in sil_parts] + ) + self.chntext = self.raw_chntext.replace("", "") + else: + sp_parts = self.telephone.strip("+").split() + self.raw_chntext = "".join( + [num2chn(part, alt_two=False, use_units=False) for part in sp_parts] + ) + self.chntext = self.raw_chntext.replace("", "") + return self.chntext + + +class Fraction: + """ + FRACTION类 + """ + + def __init__(self, fraction=None, chntext=None): + self.fraction = fraction + self.chntext = chntext + + def chntext2fraction(self): + denominator, numerator = self.chntext.split("分之") + return chn2num(numerator) + "/" + chn2num(denominator) + + def fraction2chntext(self): + numerator, denominator = self.fraction.split("/") + return num2chn(denominator) + "分之" + num2chn(numerator) + + +class Date: + """ + DATE类 + """ + + def __init__(self, date=None, chntext=None): + self.date = date + self.chntext = chntext + + # def chntext2date(self): + # chntext = self.chntext + # try: + # year, other = chntext.strip().split('年', maxsplit=1) + # year = Digit(chntext=year).digit2chntext() + '年' + # except ValueError: + # other = chntext + # year = '' + # if other: + # try: + # month, day = other.strip().split('月', maxsplit=1) + # month = Cardinal(chntext=month).chntext2cardinal() + '月' + # except ValueError: + # day = chntext + # month = '' + # if day: + # day = Cardinal(chntext=day[:-1]).chntext2cardinal() + day[-1] + # else: + # month = '' + # day = '' + # date = year + month + day + # self.date = date + # return self.date + + def date2chntext(self): + date = self.date + try: + year, other = date.strip().split("年", 1) + year = Digit(digit=year).digit2chntext() + "年" + except ValueError: + other = date + year = "" + if other: + try: + month, day = other.strip().split("月", 1) + month = Cardinal(cardinal=month).cardinal2chntext() + "月" + except ValueError: + day = date + month = "" + if day: + day = Cardinal(cardinal=day[:-1]).cardinal2chntext() + day[-1] + else: + month = "" + day = "" + chntext = year + month + day + self.chntext = chntext + return self.chntext + + +class Money: + """ + MONEY类 + """ + + def __init__(self, money=None, chntext=None): + self.money = money + self.chntext = chntext + + # def chntext2money(self): + # return self.money + + def money2chntext(self): + money = self.money + pattern = re.compile(r"(\d+(\.\d+)?)") + matchers = pattern.findall(money) + if matchers: + for matcher in matchers: + money = money.replace(matcher[0], Cardinal(cardinal=matcher[0]).cardinal2chntext()) + self.chntext = money + return self.chntext + + +class Percentage: + """ + PERCENTAGE类 + """ + + def __init__(self, percentage=None, chntext=None): + self.percentage = percentage + self.chntext = chntext + + def chntext2percentage(self): + return chn2num(self.chntext.strip().strip("百分之")) + "%" + + def percentage2chntext(self): + return "百分之" + num2chn(self.percentage.strip().strip("%")) + + +def remove_erhua(text, er_whitelist): + """ + 去除儿化音词中的儿: + 他女儿在那边儿 -> 他女儿在那边 + """ + + er_pattern = re.compile(er_whitelist) + new_str = "" + while re.search("儿", text): + a = re.search("儿", text).span() + remove_er_flag = 0 + + if er_pattern.search(text): + b = er_pattern.search(text).span() + if b[0] <= a[0]: + remove_er_flag = 1 + + if remove_er_flag == 0: + new_str = new_str + text[0 : a[0]] + text = text[a[1] :] + else: + new_str = new_str + text[0 : b[1]] + text = text[b[1] :] + + text = new_str + text + return text + + +# ================================================================================ # +# NSW Normalizer +# ================================================================================ # +class NSWNormalizer: + def __init__(self, raw_text): + self.raw_text = "^" + raw_text + "$" + self.norm_text = "" + + def _particular(self): + text = self.norm_text + pattern = re.compile(r"(([a-zA-Z]+)二([a-zA-Z]+))") + matchers = pattern.findall(text) + if matchers: + # print('particular') + for matcher in matchers: + text = text.replace(matcher[0], matcher[1] + "2" + matcher[2], 1) + self.norm_text = text + return self.norm_text + + def normalize(self): + text = self.raw_text + + # 规范化日期 + pattern = re.compile(r"\D+((([089]\d|(19|20)\d{2})年)?(\d{1,2}月(\d{1,2}[日号])?)?)") + matchers = pattern.findall(text) + if matchers: + # print('date') + for matcher in matchers: + text = text.replace(matcher[0], Date(date=matcher[0]).date2chntext(), 1) + + # 规范化金钱 + pattern = re.compile( + r"\D+((\d+(\.\d+)?)[多余几]?" + CURRENCY_UNITS + r"(\d" + CURRENCY_UNITS + r"?)?)" + ) + matchers = pattern.findall(text) + if matchers: + # print('money') + for matcher in matchers: + text = text.replace(matcher[0], Money(money=matcher[0]).money2chntext(), 1) + + # 规范化固话/手机号码 + # 手机 + # http://www.jihaoba.com/news/show/13680 + # 移动:139、138、137、136、135、134、159、158、157、150、151、152、188、187、182、183、184、178、198 + # 联通:130、131、132、156、155、186、185、176 + # 电信:133、153、189、180、181、177 + pattern = re.compile(r"\D((\+?86 ?)?1([38]\d|5[0-35-9]|7[678]|9[89])\d{8})\D") + matchers = pattern.findall(text) + if matchers: + # print('telephone') + for matcher in matchers: + text = text.replace( + matcher[0], TelePhone(telephone=matcher[0]).telephone2chntext(), 1 + ) + # 固话 + pattern = re.compile(r"\D((0(10|2[1-3]|[3-9]\d{2})-?)?[1-9]\d{6,7})\D") + matchers = pattern.findall(text) + if matchers: + # print('fixed telephone') + for matcher in matchers: + text = text.replace( + matcher[0], TelePhone(telephone=matcher[0]).telephone2chntext(fixed=True), 1 + ) + + # 规范化分数 + pattern = re.compile(r"(\d+/\d+)") + matchers = pattern.findall(text) + if matchers: + # print('fraction') + for matcher in matchers: + text = text.replace(matcher, Fraction(fraction=matcher).fraction2chntext(), 1) + + # 规范化百分数 + text = text.replace("%", "%") + pattern = re.compile(r"(\d+(\.\d+)?%)") + matchers = pattern.findall(text) + if matchers: + # print('percentage') + for matcher in matchers: + text = text.replace( + matcher[0], Percentage(percentage=matcher[0]).percentage2chntext(), 1 + ) + + # 规范化纯数+量词 + pattern = re.compile(r"(\d+(\.\d+)?)[多余几]?" + COM_QUANTIFIERS) + matchers = pattern.findall(text) + if matchers: + # print('cardinal+quantifier') + for matcher in matchers: + text = text.replace(matcher[0], Cardinal(cardinal=matcher[0]).cardinal2chntext(), 1) + + # 规范化数字编号 + pattern = re.compile(r"(\d{4,32})") + matchers = pattern.findall(text) + if matchers: + # print('digit') + for matcher in matchers: + text = text.replace(matcher, Digit(digit=matcher).digit2chntext(), 1) + + # 规范化纯数 + pattern = re.compile(r"(\d+(\.\d+)?)") + matchers = pattern.findall(text) + if matchers: + # print('cardinal') + for matcher in matchers: + text = text.replace(matcher[0], Cardinal(cardinal=matcher[0]).cardinal2chntext(), 1) + + self.norm_text = text + self._particular() + + return self.norm_text.lstrip("^").rstrip("$") + + +def nsw_test_case(raw_text): + print("I:" + raw_text) + print("O:" + NSWNormalizer(raw_text).normalize()) + print("") + + +def nsw_test(): + nsw_test_case("固话:0595-23865596或23880880。") + nsw_test_case("固话:0595-23865596或23880880。") + nsw_test_case("手机:+86 19859213959或15659451527。") + nsw_test_case("分数:32477/76391。") + nsw_test_case("百分数:80.03%。") + nsw_test_case("编号:31520181154418。") + nsw_test_case("纯数:2983.07克或12345.60米。") + nsw_test_case("日期:1999年2月20日或09年3月15号。") + nsw_test_case("金钱:12块5,34.5元,20.1万") + nsw_test_case("特殊:O2O或B2C。") + nsw_test_case("3456万吨") + nsw_test_case("2938个") + nsw_test_case("938") + nsw_test_case("今天吃了115个小笼包231个馒头") + nsw_test_case("有62%的概率") + + +if __name__ == "__main__": + # nsw_test() + + p = argparse.ArgumentParser() + p.add_argument("ifile", help="input filename, assume utf-8 encoding") + p.add_argument("ofile", help="output filename") + p.add_argument("--to_upper", action="store_true", help="convert to upper case") + p.add_argument("--to_lower", action="store_true", help="convert to lower case") + p.add_argument( + "--has_key", action="store_true", help="input text has Kaldi's key as first field." + ) + p.add_argument( + "--remove_fillers", type=bool, default=True, help='remove filler chars such as "呃, 啊"' + ) + p.add_argument( + "--remove_erhua", type=bool, default=True, help='remove erhua chars such as "这儿"' + ) + p.add_argument( + "--log_interval", type=int, default=10000, help="log interval in number of processed lines" + ) + args = p.parse_args() + + ifile = codecs.open(args.ifile, "r", "utf8") + ofile = codecs.open(args.ofile, "w+", "utf8") + + n = 0 + for l in ifile: + key = "" + text = "" + if args.has_key: + cols = l.split(maxsplit=1) + key = cols[0] + if len(cols) == 2: + text = cols[1].strip() + else: + text = "" + else: + text = l.strip() + + # cases + if args.to_upper and args.to_lower: + sys.stderr.write("text norm: to_upper OR to_lower?") + exit(1) + if args.to_upper: + text = text.upper() + if args.to_lower: + text = text.lower() + + # Filler chars removal + if args.remove_fillers: + for ch in FILLER_CHARS: + text = text.replace(ch, "") + + if args.remove_erhua: + text = remove_erhua(text, ER_WHITELIST) + + # NSW(Non-Standard-Word) normalization + text = NSWNormalizer(text).normalize() + + # Punctuations removal + old_chars = CHINESE_PUNC_LIST + string.punctuation # includes all CN and EN punctuations + new_chars = " " * len(old_chars) + del_chars = "" + text = text.translate(str.maketrans(old_chars, new_chars, del_chars)) + + # + if args.has_key: + ofile.write(key + "\t" + text + "\n") + else: + ofile.write(text + "\n") + + n += 1 + if n % args.log_interval == 0: + sys.stderr.write("text norm: {} lines done.\n".format(n)) + + sys.stderr.write("text norm: {} lines done in total.\n".format(n)) + + ifile.close() + ofile.close() diff --git a/examples/aishell/transformer/README.md b/examples/aishell/transformer/README.md new file mode 100644 index 0000000..2435b55 --- /dev/null +++ b/examples/aishell/transformer/README.md @@ -0,0 +1,16 @@ + +# Conformer Result + +## Training Config +- Feature info: using 80 dims fbank, global cmvn, speed perturb(0.9, 1.0, 1.1), specaugment +- Train info: lr 5e-4, batch_size 25000, 2 gpu(Tesla V100), acc_grad 1, 50 epochs +- Train config: conf/train_asr_transformer.yaml +- LM config: LM was not used +- Model size: 46M + +## Results (CER) + +| testset | CER(%) | +|:-----------:|:------:| +| dev | 4.97 | +| test | 5.37 | \ No newline at end of file diff --git a/examples/aishell/transformer/conf/transformer_12e_6d_2048_256.yaml b/examples/aishell/transformer/conf/transformer_12e_6d_2048_256.yaml new file mode 100644 index 0000000..efcf593 --- /dev/null +++ b/examples/aishell/transformer/conf/transformer_12e_6d_2048_256.yaml @@ -0,0 +1,104 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Transformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: TransformerEncoder +encoder_conf: + output_size: 256 # dimension of attention + attention_heads: 4 + linear_units: 2048 # the number of units of position-wise feed forward + num_blocks: 12 # the number of encoder blocks + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: conv2d # encoder architecture type + normalize_before: true + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.0 + src_attention_dropout_rate: 0.0 + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.002 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: EspnetStyleBatchSampler + batch_type: length # example or length + batch_size: 25000 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 1024 + shuffle: True + num_workers: 4 + preprocessor_speech: SpeechPreprocessSpeedPerturb + preprocessor_speech_conf: + speed_perturb: [0.9, 1.0, 1.1] + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/examples/aishell/transformer/demo_infer.sh b/examples/aishell/transformer/demo_infer.sh new file mode 100644 index 0000000..9d0a7a9 --- /dev/null +++ b/examples/aishell/transformer/demo_infer.sh @@ -0,0 +1 @@ +../paraformer/demo_infer.sh \ No newline at end of file diff --git a/examples/aishell/transformer/demo_train_or_finetune.sh b/examples/aishell/transformer/demo_train_or_finetune.sh new file mode 100644 index 0000000..bbabdbe --- /dev/null +++ b/examples/aishell/transformer/demo_train_or_finetune.sh @@ -0,0 +1 @@ +../paraformer/demo_train_or_finetune.sh \ No newline at end of file diff --git a/examples/aishell/transformer/local/aishell_data_prep.sh b/examples/aishell/transformer/local/aishell_data_prep.sh new file mode 100644 index 0000000..83f489b --- /dev/null +++ b/examples/aishell/transformer/local/aishell_data_prep.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Copyright 2017 Xingyu Na +# Apache 2.0 + +#. ./path.sh || exit 1; + +if [ $# != 3 ]; then + echo "Usage: $0 " + echo " $0 /export/a05/xna/data/data_aishell/wav /export/a05/xna/data/data_aishell/transcript data" + exit 1; +fi + +aishell_audio_dir=$1 +aishell_text=$2/aishell_transcript_v0.8.txt +output_dir=$3 + +train_dir=$output_dir/data/local/train +dev_dir=$output_dir/data/local/dev +test_dir=$output_dir/data/local/test +tmp_dir=$output_dir/data/local/tmp + +mkdir -p $train_dir +mkdir -p $dev_dir +mkdir -p $test_dir +mkdir -p $tmp_dir + +# data directory check +if [ ! -d $aishell_audio_dir ] || [ ! -f $aishell_text ]; then + echo "Error: $0 requires two directory arguments" + exit 1; +fi + +# find wav audio file for train, dev and test resp. +find $aishell_audio_dir -iname "*.wav" > $tmp_dir/wav.flist +n=`cat $tmp_dir/wav.flist | wc -l` +[ $n -ne 141925 ] && \ + echo Warning: expected 141925 data data files, found $n + +grep -i "wav/train" $tmp_dir/wav.flist > $train_dir/wav.flist || exit 1; +grep -i "wav/dev" $tmp_dir/wav.flist > $dev_dir/wav.flist || exit 1; +grep -i "wav/test" $tmp_dir/wav.flist > $test_dir/wav.flist || exit 1; + +rm -r $tmp_dir + +# Transcriptions preparation +for dir in $train_dir $dev_dir $test_dir; do + echo Preparing $dir transcriptions + sed -e 's/\.wav//' $dir/wav.flist | awk -F '/' '{print $NF}' > $dir/utt.list + paste -d' ' $dir/utt.list $dir/wav.flist > $dir/wav.scp_all + utils/filter_scp.pl -f 1 $dir/utt.list $aishell_text > $dir/transcripts.txt + awk '{print $1}' $dir/transcripts.txt > $dir/utt.list + utils/filter_scp.pl -f 1 $dir/utt.list $dir/wav.scp_all | sort -u > $dir/wav.scp + sort -u $dir/transcripts.txt > $dir/text +done + +mkdir -p $output_dir/data/train $output_dir/data/dev $output_dir/data/test + +for f in wav.scp text; do + cp $train_dir/$f $output_dir/data/train/$f || exit 1; + cp $dev_dir/$f $output_dir/data/dev/$f || exit 1; + cp $test_dir/$f $output_dir/data/test/$f || exit 1; +done + +echo "$0: AISHELL data preparation succeeded" +exit 0; diff --git a/examples/aishell/transformer/local/download_and_untar.sh b/examples/aishell/transformer/local/download_and_untar.sh new file mode 100644 index 0000000..d982559 --- /dev/null +++ b/examples/aishell/transformer/local/download_and_untar.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# Copyright 2014 Johns Hopkins University (author: Daniel Povey) +# 2017 Xingyu Na +# Apache 2.0 + +remove_archive=false + +if [ "$1" == --remove-archive ]; then + remove_archive=true + shift +fi + +if [ $# -ne 3 ]; then + echo "Usage: $0 [--remove-archive] " + echo "e.g.: $0 /export/a05/xna/data www.openslr.org/resources/33 data_aishell" + echo "With --remove-archive it will remove the archive after successfully un-tarring it." + echo " can be one of: data_aishell, resource_aishell." +fi + +data=$1 +url=$2 +part=$3 + +if [ ! -d "$data" ]; then + echo "$0: no such directory $data" + exit 1; +fi + +part_ok=false +list="data_aishell resource_aishell" +for x in $list; do + if [ "$part" == $x ]; then part_ok=true; fi +done +if ! $part_ok; then + echo "$0: expected to be one of $list, but got '$part'" + exit 1; +fi + +if [ -z "$url" ]; then + echo "$0: empty URL base." + exit 1; +fi + +if [ -f $data/$part/.complete ]; then + echo "$0: data part $part was already successfully extracted, nothing to do." + exit 0; +fi + +# sizes of the archive files in bytes. +sizes="15582913665 1246920" + +if [ -f $data/$part.tgz ]; then + size=$(/bin/ls -l $data/$part.tgz | awk '{print $5}') + size_ok=false + for s in $sizes; do if [ $s == $size ]; then size_ok=true; fi; done + if ! $size_ok; then + echo "$0: removing existing file $data/$part.tgz because its size in bytes $size" + echo "does not equal the size of one of the archives." + rm $data/$part.tgz + else + echo "$data/$part.tgz exists and appears to be complete." + fi +fi + +if [ ! -f $data/$part.tgz ]; then + if ! command -v wget >/dev/null; then + echo "$0: wget is not installed." + exit 1; + fi + full_url=$url/$part.tgz + echo "$0: downloading data from $full_url. This may take some time, please be patient." + + cd $data || exit 1 + if ! wget --no-check-certificate $full_url; then + echo "$0: error executing wget $full_url" + exit 1; + fi +fi + +cd $data || exit 1 + +if ! tar -xvzf $part.tgz; then + echo "$0: error un-tarring archive $data/$part.tgz" + exit 1; +fi + +touch $data/$part/.complete + +if [ $part == "data_aishell" ]; then + cd $data/$part/wav || exit 1 + for wav in ./*.tar.gz; do + echo "Extracting wav from $wav" + tar -zxf $wav && rm $wav + done +fi + +echo "$0: Successfully downloaded and un-tarred $data/$part.tgz" + +if $remove_archive; then + echo "$0: removing $data/$part.tgz file since --remove-archive option was supplied." + rm $data/$part.tgz +fi + +exit 0; diff --git a/examples/aishell/transformer/run.sh b/examples/aishell/transformer/run.sh new file mode 100644 index 0000000..3fb8465 --- /dev/null +++ b/examples/aishell/transformer/run.sh @@ -0,0 +1,203 @@ +#!/usr/bin/env bash + + +CUDA_VISIBLE_DEVICES="0,1" + +# general configuration +feats_dir="../DATA" #feature output dictionary +exp_dir=`pwd` +lang=zh +token_type=char +stage=0 +stop_stage=5 + +# feature configuration +nj=32 + +inference_device="cuda" #"cpu" +inference_checkpoint="model.pt.avg10" +inference_scp="wav.scp" +inference_batch_size=1 + +# data +raw_data=../raw_data +data_url=www.openslr.org/resources/33 + +# exp tag +tag="exp1" +workspace=`pwd` + +master_port=12345 + +. utils/parse_options.sh || exit 1; + +# Set bash to 'debug' mode, it will exit on : +# -e 'error', -u 'undefined variable', -o ... 'error in pipeline', -x 'print commands', +set -e +set -u +set -o pipefail + +train_set=train +valid_set=dev +test_sets="dev test" + +config=transformer_12e_6d_2048_256.yaml +model_dir="baseline_$(basename "${config}" .yaml)_${lang}_${token_type}_${tag}" + + + +if [ ${stage} -le -1 ] && [ ${stop_stage} -ge -1 ]; then + echo "stage -1: Data Download" + mkdir -p ${raw_data} + local/download_and_untar.sh ${raw_data} ${data_url} data_aishell + local/download_and_untar.sh ${raw_data} ${data_url} resource_aishell +fi + +if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then + echo "stage 0: Data preparation" + # Data preparation + local/aishell_data_prep.sh ${raw_data}/data_aishell/wav ${raw_data}/data_aishell/transcript ${feats_dir} + for x in train dev test; do + cp ${feats_dir}/data/${x}/text ${feats_dir}/data/${x}/text.org + paste -d " " <(cut -f 1 -d" " ${feats_dir}/data/${x}/text.org) <(cut -f 2- -d" " ${feats_dir}/data/${x}/text.org | tr -d " ") \ + > ${feats_dir}/data/${x}/text + utils/text2token.py -n 1 -s 1 ${feats_dir}/data/${x}/text > ${feats_dir}/data/${x}/text.org + mv ${feats_dir}/data/${x}/text.org ${feats_dir}/data/${x}/text + + # convert wav.scp text to jsonl + scp_file_list_arg="++scp_file_list='[\"${feats_dir}/data/${x}/wav.scp\",\"${feats_dir}/data/${x}/text\"]'" + python ../../../funasr/datasets/audio_datasets/scp2jsonl.py \ + ++data_type_list='["source", "target"]' \ + ++jsonl_file_out=${feats_dir}/data/${x}/audio_datasets.jsonl \ + ${scp_file_list_arg} + done +fi + +if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then + echo "stage 1: Feature and CMVN Generation" + python ../../../funasr/bin/compute_audio_cmvn.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++cmvn_file="${feats_dir}/data/${train_set}/cmvn.json" \ + +fi + +token_list=${feats_dir}/data/${lang}_token_list/$token_type/tokens.txt +echo "dictionary: ${token_list}" +if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then + echo "stage 2: Dictionary Preparation" + mkdir -p ${feats_dir}/data/${lang}_token_list/$token_type/ + + echo "make a dictionary" + echo "" > ${token_list} + echo "" >> ${token_list} + echo "" >> ${token_list} + utils/text2token.py -s 1 -n 1 --space "" ${feats_dir}/data/$train_set/text | cut -f 2- -d" " | tr " " "\n" \ + | sort | uniq | grep -a -v -e '^\s*$' | awk '{print $0}' >> ${token_list} + echo "" >> ${token_list} +fi + +# LM Training Stage +if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then + echo "stage 3: LM Training" +fi + +# ASR Training Stage +if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then + echo "stage 4: ASR Training" + + mkdir -p ${exp_dir}/exp/${model_dir} + current_time=$(date "+%Y-%m-%d_%H-%M") + log_file="${exp_dir}/exp/${model_dir}/train.log.txt.${current_time}" + echo "log_file: ${log_file}" + + export CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES + gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + torchrun \ + --nnodes 1 \ + --nproc_per_node ${gpu_num} \ + --master_port ${master_port} \ + ../../../funasr/bin/train.py \ + --config-path "${workspace}/conf" \ + --config-name "${config}" \ + ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ + ++valid_data_set_list="${feats_dir}/data/${valid_set}/audio_datasets.jsonl" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++output_dir="${exp_dir}/exp/${model_dir}" &> ${log_file} +fi + + + +# Testing Stage +if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then + echo "stage 5: Inference" + + if [ ${inference_device} == "cuda" ]; then + nj=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + else + inference_batch_size=1 + CUDA_VISIBLE_DEVICES="" + for JOB in $(seq ${nj}); do + CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"-1," + done + fi + + for dset in ${test_sets}; do + + inference_dir="${exp_dir}/exp/${model_dir}/inference-${inference_checkpoint}/${dset}" + _logdir="${inference_dir}/logdir" + echo "inference_dir: ${inference_dir}" + + mkdir -p "${_logdir}" + data_dir="${feats_dir}/data/${dset}" + key_file=${data_dir}/${inference_scp} + + split_scps= + for JOB in $(seq "${nj}"); do + split_scps+=" ${_logdir}/keys.${JOB}.scp" + done + utils/split_scp.pl "${key_file}" ${split_scps} + + gpuid_list_array=(${CUDA_VISIBLE_DEVICES//,/ }) + for JOB in $(seq ${nj}); do + { + id=$((JOB-1)) + gpuid=${gpuid_list_array[$id]} + + export CUDA_VISIBLE_DEVICES=${gpuid} + python ../../../funasr/bin/inference.py \ + --config-path="${exp_dir}/exp/${model_dir}" \ + --config-name="config.yaml" \ + ++init_param="${exp_dir}/exp/${model_dir}/${inference_checkpoint}" \ + ++tokenizer_conf.token_list="${token_list}" \ + ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ + ++input="${_logdir}/keys.${JOB}.scp" \ + ++output_dir="${inference_dir}/${JOB}" \ + ++device="${inference_device}" \ + ++ncpu=1 \ + ++disable_log=true \ + ++batch_size="${inference_batch_size}" &> ${_logdir}/log.${JOB}.txt + }& + + done + wait + + mkdir -p ${inference_dir}/1best_recog + for f in token score text; do + if [ -f "${inference_dir}/${JOB}/1best_recog/${f}" ]; then + for JOB in $(seq "${nj}"); do + cat "${inference_dir}/${JOB}/1best_recog/${f}" + done | sort -k1 >"${inference_dir}/1best_recog/${f}" + fi + done + + echo "Computing WER ..." + python utils/postprocess_text_zh.py ${inference_dir}/1best_recog/text ${inference_dir}/1best_recog/text.proc + python utils/postprocess_text_zh.py ${data_dir}/text ${inference_dir}/1best_recog/text.ref + python utils/compute_wer.py ${inference_dir}/1best_recog/text.ref ${inference_dir}/1best_recog/text.proc ${inference_dir}/1best_recog/text.cer + tail -n 3 ${inference_dir}/1best_recog/text.cer + done + +fi \ No newline at end of file diff --git a/examples/aishell/transformer/utils b/examples/aishell/transformer/utils new file mode 100644 index 0000000..1f2ce9d --- /dev/null +++ b/examples/aishell/transformer/utils @@ -0,0 +1 @@ +../paraformer/utils \ No newline at end of file diff --git a/examples/common_voice/whisper_lid/demo_funasr.py b/examples/common_voice/whisper_lid/demo_funasr.py new file mode 100644 index 0000000..f771b61 --- /dev/null +++ b/examples/common_voice/whisper_lid/demo_funasr.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +multilingual_wavs = [ + "example_zh-CN.mp3", + "example_en.mp3", + "example_ja.mp3", + "example_ko.mp3", +] + +model = AutoModel(model="iic/speech_whisper-large_lid_multilingual_pytorch") +for wav_id in multilingual_wavs: + wav_file = f"{model.model_path}/examples/{wav_id}" + res = model.generate(input=wav_file, data_type="sound", inference_clip_length=250) + print("detect sample {}: {}".format(wav_id, res)) diff --git a/examples/common_voice/whisper_lid/demo_modelscope.py b/examples/common_voice/whisper_lid/demo_modelscope.py new file mode 100644 index 0000000..b0bc22b --- /dev/null +++ b/examples/common_voice/whisper_lid/demo_modelscope.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks + +multilingual_wavs = [ + "https://www.modelscope.cn/api/v1/models/iic/speech_whisper-large_lid_multilingual_pytorch/repo?Revision=master&FilePath=examples/example_zh-CN.mp3", + "https://www.modelscope.cn/api/v1/models/iic/speech_whisper-large_lid_multilingual_pytorch/repo?Revision=master&FilePath=examples/example_en.mp3", + "https://www.modelscope.cn/api/v1/models/iic/speech_whisper-large_lid_multilingual_pytorch/repo?Revision=master&FilePath=examples/example_ja.mp3", + "https://www.modelscope.cn/api/v1/models/iic/speech_whisper-large_lid_multilingual_pytorch/repo?Revision=master&FilePath=examples/example_ko.mp3", +] + +inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, model="iic/speech_whisper-large_lid_multilingual_pytorch" +) + +for wav in multilingual_wavs: + rec_result = inference_pipeline(input=wav, inference_clip_length=250) + print(rec_result) diff --git a/examples/industrial_data_pretraining/bicif_paraformer/demo.py b/examples/industrial_data_pretraining/bicif_paraformer/demo.py new file mode 100644 index 0000000..57c1c6c --- /dev/null +++ b/examples/industrial_data_pretraining/bicif_paraformer/demo.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel( + model="iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + punc_model="iic/punc_ct-transformer_cn-en-common-vocab471067-large", + # spk_model="iic/speech_campplus_sv_zh-cn_16k-common", +) + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_vad_punc_example.wav", + batch_size_s=300, + batch_size_threshold_s=60, +) +print(res) diff --git a/examples/industrial_data_pretraining/bicif_paraformer/demo.sh b/examples/industrial_data_pretraining/bicif_paraformer/demo.sh new file mode 100644 index 0000000..7776d78 --- /dev/null +++ b/examples/industrial_data_pretraining/bicif_paraformer/demo.sh @@ -0,0 +1,18 @@ + +model="iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch" +#punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" +punc_model="iic/punc_ct-transformer_cn-en-common-vocab471067-large" +spk_model="iic/speech_campplus_sv_zh-cn_16k-common" + +python funasr/bin/inference.py \ ++model=${model} \ ++vad_model=${vad_model} \ ++punc_model=${punc_model} \ ++spk_model=${spk_model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_vad_punc_example.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ ++batch_size_s=300 \ ++batch_size_threshold_s=60 + diff --git a/examples/industrial_data_pretraining/bicif_paraformer/export.py b/examples/industrial_data_pretraining/bicif_paraformer/export.py new file mode 100644 index 0000000..31098d2 --- /dev/null +++ b/examples/industrial_data_pretraining/bicif_paraformer/export.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub + +from funasr import AutoModel + +model = AutoModel( + model="iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + device="cpu", +) + +res = model.export(type="onnx", quantize=False) +print(res) + + +# method2, inference from local path +from funasr import AutoModel + +model = AutoModel( + model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + device="cpu", +) + +res = model.export(type="onnx", quantize=False) +print(res) diff --git a/examples/industrial_data_pretraining/bicif_paraformer/export.sh b/examples/industrial_data_pretraining/bicif_paraformer/export.sh new file mode 100644 index 0000000..8511f91 --- /dev/null +++ b/examples/industrial_data_pretraining/bicif_paraformer/export.sh @@ -0,0 +1,23 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub +export HYDRA_FULL_ERROR=1 + + +model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false \ +++device="cpu" + +# method2, inference from local path +model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false \ +++device="cpu" \ No newline at end of file diff --git a/examples/industrial_data_pretraining/bicif_paraformer/finetune.sh b/examples/industrial_data_pretraining/bicif_paraformer/finetune.sh new file mode 100644 index 0000000..08f6f56 --- /dev/null +++ b/examples/industrial_data_pretraining/bicif_paraformer/finetune.sh @@ -0,0 +1,65 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, finetune from model hub + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# model_name from model_hub, or model_dir in local path + +## option 1, download model automatically +model_name_or_model_dir="iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + +## option 2, download model by git +#local_path_root=${workspace}/modelscope_models +#mkdir -p ${local_path_root}/${model_name_or_model_dir} +#git clone https://www.modelscope.cn/${model_name_or_model_dir}.git ${local_path_root}/${model_name_or_model_dir} +#model_name_or_model_dir=${local_path_root}/${model_name_or_model_dir} + + +# data dir, which contains: train.json, val.json +data_dir="../../../data/list" + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" + +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${train_data}" + +scp2jsonl \ +++scp_file_list='["../../../data/list/val_wav.scp", "../../../data/list/val_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${val_data}" + + +# exp output dir +output_dir="./outputs" +log_file="${output_dir}/log.txt" + + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} \ No newline at end of file diff --git a/examples/industrial_data_pretraining/campplus_sv/demo.py b/examples/industrial_data_pretraining/campplus_sv/demo.py new file mode 100644 index 0000000..ba3356b --- /dev/null +++ b/examples/industrial_data_pretraining/campplus_sv/demo.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel(model="iic/speech_campplus_sv_zh-cn_16k-common") + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" +) +print(res) diff --git a/examples/industrial_data_pretraining/conformer/demo.py b/examples/industrial_data_pretraining/conformer/demo.py new file mode 100644 index 0000000..c2d7682 --- /dev/null +++ b/examples/industrial_data_pretraining/conformer/demo.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel(model="iic/speech_conformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch") + +res = model.generate( + input="https://modelscope.oss-cn-beijing.aliyuncs.com/test/audios/asr_example.wav", + decoding_ctc_weight=0.0, +) +print(res) diff --git a/examples/industrial_data_pretraining/conformer/demo.sh b/examples/industrial_data_pretraining/conformer/demo.sh new file mode 100644 index 0000000..dc1314b --- /dev/null +++ b/examples/industrial_data_pretraining/conformer/demo.sh @@ -0,0 +1,9 @@ + +model="iic/speech_conformer_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch" + +python funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ + diff --git a/examples/industrial_data_pretraining/contextual_paraformer/demo.py b/examples/industrial_data_pretraining/contextual_paraformer/demo.py new file mode 100644 index 0000000..d7952a7 --- /dev/null +++ b/examples/industrial_data_pretraining/contextual_paraformer/demo.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel(model="iic/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404") + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + hotword="达摩院 魔搭", +) +print(res) diff --git a/examples/industrial_data_pretraining/contextual_paraformer/demo.sh b/examples/industrial_data_pretraining/contextual_paraformer/demo.sh new file mode 100644 index 0000000..17b005e --- /dev/null +++ b/examples/industrial_data_pretraining/contextual_paraformer/demo.sh @@ -0,0 +1,11 @@ + +model="iic/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404" + + +python ../../../funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ ++"hotword='达摩院 魔搭'" + diff --git a/examples/industrial_data_pretraining/contextual_paraformer/demo2.sh b/examples/industrial_data_pretraining/contextual_paraformer/demo2.sh new file mode 100644 index 0000000..282f4f1 --- /dev/null +++ b/examples/industrial_data_pretraining/contextual_paraformer/demo2.sh @@ -0,0 +1,9 @@ +python -m funasr.bin.inference \ +--config-path="/nfs/yufan.yf/workspace/model_download/modelscope/hub/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404" \ +--config-name="config.yaml" \ +++init_param="/nfs/yufan.yf/workspace/model_download/modelscope/hub/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/model.pb" \ +++tokenizer_conf.token_list="/nfs/yufan.yf/workspace/model_download/modelscope/hub/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/tokens.txt" \ +++frontend_conf.cmvn_file="/nfs/yufan.yf/workspace/model_download/modelscope/hub/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/am.mvn" \ +++input="/nfs/yufan.yf/workspace/model_download/modelscope/hub/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/asr_example_zh.wav" \ +++output_dir="./outputs/debug2" \ +++device="" \ diff --git a/examples/industrial_data_pretraining/contextual_paraformer/finetune.sh b/examples/industrial_data_pretraining/contextual_paraformer/finetune.sh new file mode 100644 index 0000000..25c7330 --- /dev/null +++ b/examples/industrial_data_pretraining/contextual_paraformer/finetune.sh @@ -0,0 +1,67 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, finetune from model hub + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# model_name from model_hub, or model_dir in local path + +## option 1, download model automatically +model_name_or_model_dir="iic/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404" + + +## option 2, download model by git +#local_path_root=${workspace}/modelscope_models +#mkdir -p ${local_path_root}/${model_name_or_model_dir} +#git clone https://www.modelscope.cn/${model_name_or_model_dir}.git ${local_path_root}/${model_name_or_model_dir} +#model_name_or_model_dir=${local_path_root}/${model_name_or_model_dir} + + +# data dir, which contains: train.json, val.json +data_dir="../../../data/list" + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" + +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${train_data}" + +scp2jsonl \ +++scp_file_list='["../../../data/list/val_wav.scp", "../../../data/list/val_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${val_data}" + + +# exp output dir +output_dir="./outputs" +log_file="${output_dir}/log.txt" + + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++model_revision="${model_revision}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} \ No newline at end of file diff --git a/examples/industrial_data_pretraining/contextual_paraformer/path.sh b/examples/industrial_data_pretraining/contextual_paraformer/path.sh new file mode 100644 index 0000000..1a6d67e --- /dev/null +++ b/examples/industrial_data_pretraining/contextual_paraformer/path.sh @@ -0,0 +1,6 @@ +export FUNASR_DIR=$PWD/../../../ + +# NOTE(kan-bayashi): Use UTF-8 in Python to avoid UnicodeDecodeError when LC_ALL=C +export PYTHONIOENCODING=UTF-8 +export PATH=$FUNASR_DIR/funasr/bin:$PATH +export PYTHONPATH=$FUNASR_DIR/funasr/bin:$FUNASR_DIR/funasr:$FUNASR_DIR:$PYTHONPATH diff --git a/examples/industrial_data_pretraining/ct_transformer/demo.py b/examples/industrial_data_pretraining/ct_transformer/demo.py new file mode 100644 index 0000000..c19af2b --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer/demo.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel(model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch") + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_text/punc_example.txt" +) +print(res) + + +from funasr import AutoModel + +model = AutoModel(model="iic/punc_ct-transformer_cn-en-common-vocab471067-large") + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_text/punc_example.txt" +) +print(res) diff --git a/examples/industrial_data_pretraining/ct_transformer/demo.sh b/examples/industrial_data_pretraining/ct_transformer/demo.sh new file mode 100644 index 0000000..6c63c02 --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer/demo.sh @@ -0,0 +1,12 @@ + +#model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" +# + +model="iic/punc_ct-transformer_cn-en-common-vocab471067-large" + + +python funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_text/punc_example.txt" \ ++output_dir="./outputs/debug" \ ++device="cpu" diff --git a/examples/industrial_data_pretraining/ct_transformer/export.py b/examples/industrial_data_pretraining/ct_transformer/export.py new file mode 100644 index 0000000..7115728 --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer/export.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub + +from funasr import AutoModel + +model = AutoModel( + model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", +) + +res = model.export(type="onnx", quantize=False) +print(res) + + +# method2, inference from local path +from funasr import AutoModel + +model = AutoModel( + model="/Users/zhifu/.cache/modelscope/hub/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" +) + +res = model.export(type="onnx", quantize=False) +print(res) diff --git a/examples/industrial_data_pretraining/ct_transformer/export.sh b/examples/industrial_data_pretraining/ct_transformer/export.sh new file mode 100644 index 0000000..780bcad --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer/export.sh @@ -0,0 +1,26 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub +export HYDRA_FULL_ERROR=1 + + +model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" + + +python -m funasr.bin.export \ +++model=${model} \ +++model_revision=${model_revision} \ +++type="onnx" \ +++quantize=false \ +++device="cpu" + + +# method2, inference from local path +model="/Users/zhifu/.cache/modelscope/hub/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false \ +++device="cpu" \ No newline at end of file diff --git a/examples/industrial_data_pretraining/ct_transformer_streaming/demo.py b/examples/industrial_data_pretraining/ct_transformer_streaming/demo.py new file mode 100644 index 0000000..42e0b9b --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer_streaming/demo.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel(model="iic/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727") + +inputs = "跨境河流是养育沿岸|人民的生命之源长期以来为帮助下游地区防灾减灾中方技术人员|在上游地区极为恶劣的自然条件下克服巨大困难甚至冒着生命危险|向印方提供汛期水文资料处理紧急事件中方重视印方在跨境河流问题上的关切|愿意进一步完善双方联合工作机制|凡是|中方能做的我们|都会去做而且会做得更好我请印度朋友们放心中国在上游的|任何开发利用都会经过科学|规划和论证兼顾上下游的利益" +vads = inputs.split("|") +rec_result_all = "outputs: " +cache = {} +for vad in vads: + rec_result = model.generate(input=vad, cache=cache) + rec_result_all += rec_result[0]["text"] + +print(rec_result_all) diff --git a/examples/industrial_data_pretraining/ct_transformer_streaming/demo.sh b/examples/industrial_data_pretraining/ct_transformer_streaming/demo.sh new file mode 100644 index 0000000..84ab5a2 --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer_streaming/demo.sh @@ -0,0 +1,9 @@ + +model="iic/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727" + + +python funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_text/punc_example.txt" \ ++output_dir="./outputs/debug" \ ++device="cpu" diff --git a/examples/industrial_data_pretraining/ct_transformer_streaming/export.py b/examples/industrial_data_pretraining/ct_transformer_streaming/export.py new file mode 100644 index 0000000..afab1ae --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer_streaming/export.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub + +from funasr import AutoModel + +model = AutoModel( + model="iic/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727", +) + +res = model.export(type="onnx", quantize=False) +print(res) + + +# method2, inference from local path +from funasr import AutoModel + +model = AutoModel( + model="/Users/zhifu/.cache/modelscope/hub/iic/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727" +) + +res = model.export(type="onnx", quantize=False) +print(res) diff --git a/examples/industrial_data_pretraining/ct_transformer_streaming/export.sh b/examples/industrial_data_pretraining/ct_transformer_streaming/export.sh new file mode 100644 index 0000000..eb76978 --- /dev/null +++ b/examples/industrial_data_pretraining/ct_transformer_streaming/export.sh @@ -0,0 +1,28 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub +export HYDRA_FULL_ERROR=1 + + +model="iic/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727" + + +python -m funasr.bin.export \ +++model=${model} \ +++model_revision=${model_revision} \ +++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav" \ +++type="onnx" \ +++quantize=false \ +++device="cpu" + + +# method2, inference from local path +model="/Users/zhifu/.cache/modelscope/hub/iic/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727" + +python -m funasr.bin.export \ +++model=${model} \ +++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav" \ +++type="onnx" \ +++quantize=false \ +++device="cpu" \ No newline at end of file diff --git a/examples/industrial_data_pretraining/fsmn_vad_streaming/demo.py b/examples/industrial_data_pretraining/fsmn_vad_streaming/demo.py new file mode 100644 index 0000000..21ce0cb --- /dev/null +++ b/examples/industrial_data_pretraining/fsmn_vad_streaming/demo.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +wav_file = "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav" + +model = AutoModel(model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch") + +res = model.generate(input=wav_file) +print(res) + +# [[beg1, end1], [beg2, end2], .., [begN, endN]] +# beg/end: ms + + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/vad_example.wav") +speech, sample_rate = soundfile.read(wav_file) + +chunk_size = 200 # ms +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} + +total_chunk_num = int(len((speech) - 1) / chunk_stride + 1) +for i in range(total_chunk_num): + speech_chunk = speech[i * chunk_stride : (i + 1) * chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate( + input=speech_chunk, + cache=cache, + is_final=is_final, + chunk_size=chunk_size, + disable_pbar=True, + ) + # print(res) + if len(res[0]["value"]): + print(res) + + +# 1. [[beg1, end1], [beg2, end2], .., [begN, endN]]; [[beg, end]]; [[beg1, end1], [beg2, end2]] +# 2. [[beg, -1]] +# 3. [[-1, end]] +# beg/end: ms diff --git a/examples/industrial_data_pretraining/fsmn_vad_streaming/demo.sh b/examples/industrial_data_pretraining/fsmn_vad_streaming/demo.sh new file mode 100644 index 0000000..0d3623c --- /dev/null +++ b/examples/industrial_data_pretraining/fsmn_vad_streaming/demo.sh @@ -0,0 +1,10 @@ + + +model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch" + + +python funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ diff --git a/examples/industrial_data_pretraining/fsmn_vad_streaming/export.py b/examples/industrial_data_pretraining/fsmn_vad_streaming/export.py new file mode 100644 index 0000000..38a1798 --- /dev/null +++ b/examples/industrial_data_pretraining/fsmn_vad_streaming/export.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# method1, inference from model hub + +from funasr import AutoModel + +model = AutoModel(model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch") + +res = model.export(type="onnx", quantize=False) +print(res) + +# method2, inference from local path + +from funasr import AutoModel + +model = AutoModel( + model="/Users/zhifu/.cache/modelscope/hub/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch" +) + +res = model.export(type="onnx", quantize=False) +print(res) diff --git a/examples/industrial_data_pretraining/fsmn_vad_streaming/export.sh b/examples/industrial_data_pretraining/fsmn_vad_streaming/export.sh new file mode 100644 index 0000000..e095544 --- /dev/null +++ b/examples/industrial_data_pretraining/fsmn_vad_streaming/export.sh @@ -0,0 +1,24 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# method1, inference from model hub +export HYDRA_FULL_ERROR=1 + + +model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch" + + +python -m funasr.bin.export \ +++model=${model} \ +++model_revision=${model_revision} \ +++type="onnx" \ +++quantize=false + +# method2, inference from local path +model="/Users/zhifu/.cache/modelscope/hub/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch" + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false \ No newline at end of file diff --git a/examples/industrial_data_pretraining/lcbnet/compute_wer_details.py b/examples/industrial_data_pretraining/lcbnet/compute_wer_details.py new file mode 100644 index 0000000..f672cc8 --- /dev/null +++ b/examples/industrial_data_pretraining/lcbnet/compute_wer_details.py @@ -0,0 +1,735 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + + +from enum import Enum +import re, sys, unicodedata +import codecs +import argparse +from tqdm import tqdm +import os +import pdb + +remove_tag = False +spacelist = [" ", "\t", "\r", "\n"] +puncts = [ + "!", + ",", + "?", + "、", + "。", + "!", + ",", + ";", + "?", + ":", + "「", + "」", + "︰", + "『", + "』", + "《", + "》", +] + + +class Code(Enum): + match = 1 + substitution = 2 + insertion = 3 + deletion = 4 + + +class WordError(object): + def __init__(self): + self.errors = { + Code.substitution: 0, + Code.insertion: 0, + Code.deletion: 0, + } + self.ref_words = 0 + + def get_wer(self): + assert self.ref_words != 0 + errors = ( + self.errors[Code.substitution] + + self.errors[Code.insertion] + + self.errors[Code.deletion] + ) + return 100.0 * errors / self.ref_words + + def get_result_string(self): + return ( + f"error_rate={self.get_wer():.4f}, " + f"ref_words={self.ref_words}, " + f"subs={self.errors[Code.substitution]}, " + f"ins={self.errors[Code.insertion]}, " + f"dels={self.errors[Code.deletion]}" + ) + + +def characterize(string): + res = [] + i = 0 + while i < len(string): + char = string[i] + if char in puncts: + i += 1 + continue + cat1 = unicodedata.category(char) + # https://unicodebook.readthedocs.io/unicode.html#unicode-categories + if cat1 == "Zs" or cat1 == "Cn" or char in spacelist: # space or not assigned + i += 1 + continue + if cat1 == "Lo": # letter-other + res.append(char) + i += 1 + else: + # some input looks like: , we want to separate it to two words. + sep = " " + if char == "<": + sep = ">" + j = i + 1 + while j < len(string): + c = string[j] + if ord(c) >= 128 or (c in spacelist) or (c == sep): + break + j += 1 + if j < len(string) and string[j] == ">": + j += 1 + res.append(string[i:j]) + i = j + return res + + +def stripoff_tags(x): + if not x: + return "" + chars = [] + i = 0 + T = len(x) + while i < T: + if x[i] == "<": + while i < T and x[i] != ">": + i += 1 + i += 1 + else: + chars.append(x[i]) + i += 1 + return "".join(chars) + + +def normalize(sentence, ignore_words, cs, split=None): + """sentence, ignore_words are both in unicode""" + new_sentence = [] + for token in sentence: + x = token + if not cs: + x = x.upper() + if x in ignore_words: + continue + if remove_tag: + x = stripoff_tags(x) + if not x: + continue + if split and x in split: + new_sentence += split[x] + else: + new_sentence.append(x) + return new_sentence + + +class Calculator: + def __init__(self): + self.data = {} + self.space = [] + self.cost = {} + self.cost["cor"] = 0 + self.cost["sub"] = 1 + self.cost["del"] = 1 + self.cost["ins"] = 1 + + def calculate(self, lab, rec): + # Initialization + lab.insert(0, "") + rec.insert(0, "") + while len(self.space) < len(lab): + self.space.append([]) + for row in self.space: + for element in row: + element["dist"] = 0 + element["error"] = "non" + while len(row) < len(rec): + row.append({"dist": 0, "error": "non"}) + for i in range(len(lab)): + self.space[i][0]["dist"] = i + self.space[i][0]["error"] = "del" + for j in range(len(rec)): + self.space[0][j]["dist"] = j + self.space[0][j]["error"] = "ins" + self.space[0][0]["error"] = "non" + for token in lab: + if token not in self.data and len(token) > 0: + self.data[token] = {"all": 0, "cor": 0, "sub": 0, "ins": 0, "del": 0} + for token in rec: + if token not in self.data and len(token) > 0: + self.data[token] = {"all": 0, "cor": 0, "sub": 0, "ins": 0, "del": 0} + # Computing edit distance + for i, lab_token in enumerate(lab): + for j, rec_token in enumerate(rec): + if i == 0 or j == 0: + continue + min_dist = sys.maxsize + min_error = "none" + dist = self.space[i - 1][j]["dist"] + self.cost["del"] + error = "del" + if dist < min_dist: + min_dist = dist + min_error = error + dist = self.space[i][j - 1]["dist"] + self.cost["ins"] + error = "ins" + if dist < min_dist: + min_dist = dist + min_error = error + if lab_token == rec_token.replace("", ""): + dist = self.space[i - 1][j - 1]["dist"] + self.cost["cor"] + error = "cor" + else: + dist = self.space[i - 1][j - 1]["dist"] + self.cost["sub"] + error = "sub" + if dist < min_dist: + min_dist = dist + min_error = error + self.space[i][j]["dist"] = min_dist + self.space[i][j]["error"] = min_error + # Tracing back + result = { + "lab": [], + "rec": [], + "code": [], + "all": 0, + "cor": 0, + "sub": 0, + "ins": 0, + "del": 0, + } + i = len(lab) - 1 + j = len(rec) - 1 + while True: + if self.space[i][j]["error"] == "cor": # correct + if len(lab[i]) > 0: + self.data[lab[i]]["all"] = self.data[lab[i]]["all"] + 1 + self.data[lab[i]]["cor"] = self.data[lab[i]]["cor"] + 1 + result["all"] = result["all"] + 1 + result["cor"] = result["cor"] + 1 + result["lab"].insert(0, lab[i]) + result["rec"].insert(0, rec[j]) + result["code"].insert(0, Code.match) + i = i - 1 + j = j - 1 + elif self.space[i][j]["error"] == "sub": # substitution + if len(lab[i]) > 0: + self.data[lab[i]]["all"] = self.data[lab[i]]["all"] + 1 + self.data[lab[i]]["sub"] = self.data[lab[i]]["sub"] + 1 + result["all"] = result["all"] + 1 + result["sub"] = result["sub"] + 1 + result["lab"].insert(0, lab[i]) + result["rec"].insert(0, rec[j]) + result["code"].insert(0, Code.substitution) + i = i - 1 + j = j - 1 + elif self.space[i][j]["error"] == "del": # deletion + if len(lab[i]) > 0: + self.data[lab[i]]["all"] = self.data[lab[i]]["all"] + 1 + self.data[lab[i]]["del"] = self.data[lab[i]]["del"] + 1 + result["all"] = result["all"] + 1 + result["del"] = result["del"] + 1 + result["lab"].insert(0, lab[i]) + result["rec"].insert(0, "") + result["code"].insert(0, Code.deletion) + i = i - 1 + elif self.space[i][j]["error"] == "ins": # insertion + if len(rec[j]) > 0: + self.data[rec[j]]["ins"] = self.data[rec[j]]["ins"] + 1 + result["ins"] = result["ins"] + 1 + result["lab"].insert(0, "") + result["rec"].insert(0, rec[j]) + result["code"].insert(0, Code.insertion) + j = j - 1 + elif self.space[i][j]["error"] == "non": # starting point + break + else: # shouldn't reach here + print( + "this should not happen , i = {i} , j = {j} , error = {error}".format( + i=i, j=j, error=self.space[i][j]["error"] + ) + ) + return result + + def overall(self): + result = {"all": 0, "cor": 0, "sub": 0, "ins": 0, "del": 0} + for token in self.data: + result["all"] = result["all"] + self.data[token]["all"] + result["cor"] = result["cor"] + self.data[token]["cor"] + result["sub"] = result["sub"] + self.data[token]["sub"] + result["ins"] = result["ins"] + self.data[token]["ins"] + result["del"] = result["del"] + self.data[token]["del"] + return result + + def cluster(self, data): + result = {"all": 0, "cor": 0, "sub": 0, "ins": 0, "del": 0} + for token in data: + if token in self.data: + result["all"] = result["all"] + self.data[token]["all"] + result["cor"] = result["cor"] + self.data[token]["cor"] + result["sub"] = result["sub"] + self.data[token]["sub"] + result["ins"] = result["ins"] + self.data[token]["ins"] + result["del"] = result["del"] + self.data[token]["del"] + return result + + def keys(self): + return list(self.data.keys()) + + +def width(string): + return sum(1 + (unicodedata.east_asian_width(c) in "AFW") for c in string) + + +def default_cluster(word): + unicode_names = [unicodedata.name(char) for char in word] + for i in reversed(range(len(unicode_names))): + if unicode_names[i].startswith("DIGIT"): # 1 + unicode_names[i] = "Number" # 'DIGIT' + elif unicode_names[i].startswith("CJK UNIFIED IDEOGRAPH") or unicode_names[i].startswith( + "CJK COMPATIBILITY IDEOGRAPH" + ): + # 明 / 郎 + unicode_names[i] = "Mandarin" # 'CJK IDEOGRAPH' + elif unicode_names[i].startswith("LATIN CAPITAL LETTER") or unicode_names[i].startswith( + "LATIN SMALL LETTER" + ): + # A / a + unicode_names[i] = "English" # 'LATIN LETTER' + elif unicode_names[i].startswith("HIRAGANA LETTER"): # は こ め + unicode_names[i] = "Japanese" # 'GANA LETTER' + elif ( + unicode_names[i].startswith("AMPERSAND") + or unicode_names[i].startswith("APOSTROPHE") + or unicode_names[i].startswith("COMMERCIAL AT") + or unicode_names[i].startswith("DEGREE CELSIUS") + or unicode_names[i].startswith("EQUALS SIGN") + or unicode_names[i].startswith("FULL STOP") + or unicode_names[i].startswith("HYPHEN-MINUS") + or unicode_names[i].startswith("LOW LINE") + or unicode_names[i].startswith("NUMBER SIGN") + or unicode_names[i].startswith("PLUS SIGN") + or unicode_names[i].startswith("SEMICOLON") + ): + # & / ' / @ / ℃ / = / . / - / _ / # / + / ; + del unicode_names[i] + else: + return "Other" + if len(unicode_names) == 0: + return "Other" + if len(unicode_names) == 1: + return unicode_names[0] + for i in range(len(unicode_names) - 1): + if unicode_names[i] != unicode_names[i + 1]: + return "Other" + return unicode_names[0] + + +def get_args(): + parser = argparse.ArgumentParser(description="wer cal") + parser.add_argument("--ref", type=str, help="Text input path") + parser.add_argument("--ref_ocr", type=str, help="Text input path") + parser.add_argument("--rec_name", type=str, action="append", default=[]) + parser.add_argument("--rec_file", type=str, action="append", default=[]) + parser.add_argument("--verbose", type=int, default=1, help="show") + parser.add_argument("--char", type=bool, default=True, help="show") + args = parser.parse_args() + return args + + +def main(args): + cluster_file = "" + ignore_words = set() + tochar = args.char + verbose = args.verbose + padding_symbol = " " + case_sensitive = False + max_words_per_line = sys.maxsize + split = None + + if not case_sensitive: + ig = set([w.upper() for w in ignore_words]) + ignore_words = ig + + default_clusters = {} + default_words = {} + ref_file = args.ref + ref_ocr = args.ref_ocr + rec_files = args.rec_file + rec_names = args.rec_name + assert len(rec_files) == len(rec_names) + + # load ocr + ref_ocr_dict = {} + with codecs.open(ref_ocr, "r", "utf-8") as fh: + for line in fh: + if "$" in line: + line = line.replace("$", " ") + if tochar: + array = characterize(line) + else: + array = line.strip().split() + if len(array) == 0: + continue + fid = array[0] + ref_ocr_dict[fid] = normalize(array[1:], ignore_words, case_sensitive, split) + + if split and not case_sensitive: + newsplit = dict() + for w in split: + words = split[w] + for i in range(len(words)): + words[i] = words[i].upper() + newsplit[w.upper()] = words + split = newsplit + + rec_sets = {} + calculators_dict = dict() + ub_wer_dict = dict() + hotwords_related_dict = dict() # 记录recall相关的内容 + for i, hyp_file in enumerate(rec_files): + rec_sets[rec_names[i]] = dict() + with codecs.open(hyp_file, "r", "utf-8") as fh: + for line in fh: + if tochar: + array = characterize(line) + else: + array = line.strip().split() + if len(array) == 0: + continue + fid = array[0] + rec_sets[rec_names[i]][fid] = normalize( + array[1:], ignore_words, case_sensitive, split + ) + + calculators_dict[rec_names[i]] = Calculator() + ub_wer_dict[rec_names[i]] = {"u_wer": WordError(), "b_wer": WordError(), "wer": WordError()} + hotwords_related_dict[rec_names[i]] = {"tp": 0, "tn": 0, "fp": 0, "fn": 0} + # tp: 热词在label里,同时在rec里 + # tn: 热词不在label里,同时不在rec里 + # fp: 热词不在label里,但是在rec里 + # fn: 热词在label里,但是不在rec里 + + # record wrong label but in ocr + wrong_rec_but_in_ocr_dict = {} + for rec_name in rec_names: + wrong_rec_but_in_ocr_dict[rec_name] = 0 + + _file_total_len = 0 + with os.popen("cat {} | wc -l".format(ref_file)) as pipe: + _file_total_len = int(pipe.read().strip()) + + # compute error rate on the interaction of reference file and hyp file + for line in tqdm(open(ref_file, "r", encoding="utf-8"), total=_file_total_len): + if tochar: + array = characterize(line) + else: + array = line.rstrip("\n").split() + if len(array) == 0: + continue + fid = array[0] + lab = normalize(array[1:], ignore_words, case_sensitive, split) + + if verbose: + print("\nutt: %s" % fid) + + ocr_text = ref_ocr_dict[fid] + ocr_set = set(ocr_text) + print("ocr: {}".format(" ".join(ocr_text))) + list_match = [] # 指label里面在ocr里面的内容 + list_not_mathch = [] + tmp_error = 0 + tmp_match = 0 + for index in range(len(lab)): + # text_list.append(uttlist[index+1]) + if lab[index] not in ocr_set: + tmp_error += 1 + list_not_mathch.append(lab[index]) + else: + tmp_match += 1 + list_match.append(lab[index]) + print("label in ocr: {}".format(" ".join(list_match))) + + # for each reco file + base_wrong_ocr_wer = None + ocr_wrong_ocr_wer = None + + for rec_name in rec_names: + rec_set = rec_sets[rec_name] + if fid not in rec_set: + continue + rec = rec_set[fid] + + # print(rec) + for word in rec + lab: + if word not in default_words: + default_cluster_name = default_cluster(word) + if default_cluster_name not in default_clusters: + default_clusters[default_cluster_name] = {} + if word not in default_clusters[default_cluster_name]: + default_clusters[default_cluster_name][word] = 1 + default_words[word] = default_cluster_name + + result = calculators_dict[rec_name].calculate(lab.copy(), rec.copy()) + if verbose: + if result["all"] != 0: + wer = ( + float(result["ins"] + result["sub"] + result["del"]) * 100.0 / result["all"] + ) + else: + wer = 0.0 + print("WER(%s): %4.2f %%" % (rec_name, wer), end=" ") + print( + "N=%d C=%d S=%d D=%d I=%d" + % (result["all"], result["cor"], result["sub"], result["del"], result["ins"]) + ) + + # print(result['rec']) + wrong_rec_but_in_ocr = [] + for idx in range(len(result["lab"])): + if result["lab"][idx] != "": + if result["lab"][idx] != result["rec"][idx].replace("", ""): + if result["lab"][idx] in list_match: + wrong_rec_but_in_ocr.append(result["lab"][idx]) + wrong_rec_but_in_ocr_dict[rec_name] += 1 + print("wrong_rec_but_in_ocr: {}".format(" ".join(wrong_rec_but_in_ocr))) + + if rec_name == "base": + base_wrong_ocr_wer = len(wrong_rec_but_in_ocr) + if "ocr" in rec_name or "hot" in rec_name: + ocr_wrong_ocr_wer = len(wrong_rec_but_in_ocr) + if ocr_wrong_ocr_wer < base_wrong_ocr_wer: + print( + "{} {} helps, {} -> {}".format( + fid, rec_name, base_wrong_ocr_wer, ocr_wrong_ocr_wer + ) + ) + elif ocr_wrong_ocr_wer > base_wrong_ocr_wer: + print( + "{} {} hurts, {} -> {}".format( + fid, rec_name, base_wrong_ocr_wer, ocr_wrong_ocr_wer + ) + ) + + # recall = 0 + # false_alarm = 0 + # for idx in range(len(result['lab'])): + # if "" in result['rec'][idx]: + # if result['rec'][idx].replace("", "") in list_match: + # recall += 1 + # else: + # false_alarm += 1 + # print("bias hotwords recall: {}, fa: {}, list_match {}, recall: {:.2f}, fa: {:.2f}".format( + # recall, false_alarm, len(list_match), recall / len(list_match) if len(list_match) != 0 else 0, false_alarm / len(list_match) if len(list_match) != 0 else 0 + # )) + # tp: 热词在label里,同时在rec里 + # tn: 热词不在label里,同时不在rec里 + # fp: 热词不在label里,但是在rec里 + # fn: 热词在label里,但是不在rec里 + _rec_list = [word.replace("", "") for word in rec] + _label_list = [word for word in lab] + _tp = _tn = _fp = _fn = 0 + hot_true_list = [hotword for hotword in ocr_text if hotword in _label_list] + hot_bad_list = [hotword for hotword in ocr_text if hotword not in _label_list] + for badhotword in hot_bad_list: + count = len([word for word in _rec_list if word == badhotword]) + # print(f"bad {badhotword} count: {count}") + # for word in _rec_list: + # if badhotword == word: + # count += 1 + if count == 0: + hotwords_related_dict[rec_name]["tn"] += 1 + _tn += 1 + # fp: 0 + else: + hotwords_related_dict[rec_name]["fp"] += count + _fp += count + # tn: 0 + # if badhotword in _rec_list: + # hotwords_related_dict[rec_name]['fp'] += 1 + # else: + # hotwords_related_dict[rec_name]['tn'] += 1 + for hotword in hot_true_list: + true_count = len([word for word in _label_list if hotword == word]) + rec_count = len([word for word in _rec_list if hotword == word]) + # print(f"good {hotword} true_count: {true_count}, rec_count: {rec_count}") + if rec_count == true_count: + hotwords_related_dict[rec_name]["tp"] += true_count + _tp += true_count + elif rec_count > true_count: + hotwords_related_dict[rec_name]["tp"] += true_count + # fp: 不在label里,但是在rec里 + hotwords_related_dict[rec_name]["fp"] += rec_count - true_count + _tp += true_count + _fp += rec_count - true_count + else: + hotwords_related_dict[rec_name]["tp"] += rec_count + # fn: 热词在label里,但是不在rec里 + hotwords_related_dict[rec_name]["fn"] += true_count - rec_count + _tp += rec_count + _fn += true_count - rec_count + print( + "hotword: tp: {}, tn: {}, fp: {}, fn: {}, all: {}, recall: {:.2f}%".format( + _tp, + _tn, + _fp, + _fn, + sum([_tp, _tn, _fp, _fn]), + _tp / (_tp + _fn) * 100 if (_tp + _fn) != 0 else 0, + ) + ) + + # if hotword in _rec_list: + # hotwords_related_dict[rec_name]['tp'] += 1 + # else: + # hotwords_related_dict[rec_name]['fn'] += 1 + # 计算uwer, bwer, wer + for code, rec_word, lab_word in zip(result["code"], result["rec"], result["lab"]): + if code == Code.match: + ub_wer_dict[rec_name]["wer"].ref_words += 1 + if lab_word in hot_true_list: + # tmp_ref.append(ref_tokens[ref_idx]) + ub_wer_dict[rec_name]["b_wer"].ref_words += 1 + else: + ub_wer_dict[rec_name]["u_wer"].ref_words += 1 + elif code == Code.substitution: + ub_wer_dict[rec_name]["wer"].ref_words += 1 + ub_wer_dict[rec_name]["wer"].errors[Code.substitution] += 1 + if lab_word in hot_true_list: + # tmp_ref.append(ref_tokens[ref_idx]) + ub_wer_dict[rec_name]["b_wer"].ref_words += 1 + ub_wer_dict[rec_name]["b_wer"].errors[Code.substitution] += 1 + else: + ub_wer_dict[rec_name]["u_wer"].ref_words += 1 + ub_wer_dict[rec_name]["u_wer"].errors[Code.substitution] += 1 + elif code == Code.deletion: + ub_wer_dict[rec_name]["wer"].ref_words += 1 + ub_wer_dict[rec_name]["wer"].errors[Code.deletion] += 1 + if lab_word in hot_true_list: + # tmp_ref.append(ref_tokens[ref_idx]) + ub_wer_dict[rec_name]["b_wer"].ref_words += 1 + ub_wer_dict[rec_name]["b_wer"].errors[Code.deletion] += 1 + else: + ub_wer_dict[rec_name]["u_wer"].ref_words += 1 + ub_wer_dict[rec_name]["u_wer"].errors[Code.deletion] += 1 + elif code == Code.insertion: + ub_wer_dict[rec_name]["wer"].errors[Code.insertion] += 1 + if rec_word in hot_true_list: + ub_wer_dict[rec_name]["b_wer"].errors[Code.insertion] += 1 + else: + ub_wer_dict[rec_name]["u_wer"].errors[Code.insertion] += 1 + + space = {} + space["lab"] = [] + space["rec"] = [] + for idx in range(len(result["lab"])): + len_lab = width(result["lab"][idx]) + len_rec = width(result["rec"][idx]) + length = max(len_lab, len_rec) + space["lab"].append(length - len_lab) + space["rec"].append(length - len_rec) + upper_lab = len(result["lab"]) + upper_rec = len(result["rec"]) + lab1, rec1 = 0, 0 + while lab1 < upper_lab or rec1 < upper_rec: + if verbose > 1: + print("lab(%s):" % fid.encode("utf-8"), end=" ") + else: + print("lab:", end=" ") + lab2 = min(upper_lab, lab1 + max_words_per_line) + for idx in range(lab1, lab2): + token = result["lab"][idx] + print("{token}".format(token=token), end="") + for n in range(space["lab"][idx]): + print(padding_symbol, end="") + print(" ", end="") + print() + if verbose > 1: + print("rec(%s):" % fid.encode("utf-8"), end=" ") + else: + print("rec:", end=" ") + + rec2 = min(upper_rec, rec1 + max_words_per_line) + for idx in range(rec1, rec2): + token = result["rec"][idx] + print("{token}".format(token=token), end="") + for n in range(space["rec"][idx]): + print(padding_symbol, end="") + print(" ", end="") + print() + # print('\n', end='\n') + lab1 = lab2 + rec1 = rec2 + print("\n", end="\n") + # break + if verbose: + print("===========================================================================") + print() + + print(wrong_rec_but_in_ocr_dict) + for rec_name in rec_names: + result = calculators_dict[rec_name].overall() + + if result["all"] != 0: + wer = float(result["ins"] + result["sub"] + result["del"]) * 100.0 / result["all"] + else: + wer = 0.0 + print("{} Overall -> {:4.2f} %".format(rec_name, wer), end=" ") + print( + "N=%d C=%d S=%d D=%d I=%d" + % (result["all"], result["cor"], result["sub"], result["del"], result["ins"]) + ) + print(f"WER: {ub_wer_dict[rec_name]['wer'].get_result_string()}") + print(f"U-WER: {ub_wer_dict[rec_name]['u_wer'].get_result_string()}") + print(f"B-WER: {ub_wer_dict[rec_name]['b_wer'].get_result_string()}") + + print( + "hotword: tp: {}, tn: {}, fp: {}, fn: {}, all: {}, recall: {:.2f}%".format( + hotwords_related_dict[rec_name]["tp"], + hotwords_related_dict[rec_name]["tn"], + hotwords_related_dict[rec_name]["fp"], + hotwords_related_dict[rec_name]["fn"], + sum([v for k, v in hotwords_related_dict[rec_name].items()]), + ( + hotwords_related_dict[rec_name]["tp"] + / ( + hotwords_related_dict[rec_name]["tp"] + + hotwords_related_dict[rec_name]["fn"] + ) + * 100 + if hotwords_related_dict[rec_name]["tp"] + hotwords_related_dict[rec_name]["fn"] + != 0 + else 0 + ), + ) + ) + + # tp: 热词在label里,同时在rec里 + # tn: 热词不在label里,同时不在rec里 + # fp: 热词不在label里,但是在rec里 + # fn: 热词在label里,但是不在rec里 + if not verbose: + print() + print() + + +if __name__ == "__main__": + args = get_args() + + # print("") + print(args) + main(args) diff --git a/examples/industrial_data_pretraining/lcbnet/demo.py b/examples/industrial_data_pretraining/lcbnet/demo.py new file mode 100644 index 0000000..39e11ee --- /dev/null +++ b/examples/industrial_data_pretraining/lcbnet/demo.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel(model="iic/LCB-NET", model_revision="v1.0.0") + + +res = model.generate( + input=( + "https://www.modelscope.cn/api/v1/models/iic/LCB-NET/repo?Revision=master&FilePath=example/asr_example.wav", + "https://www.modelscope.cn/api/v1/models/iic/LCB-NET/repo?Revision=master&FilePath=example/ocr.txt", + ), + data_type=("sound", "text"), +) + +print(res) diff --git a/examples/industrial_data_pretraining/lcbnet/demo.sh b/examples/industrial_data_pretraining/lcbnet/demo.sh new file mode 100644 index 0000000..2f226bc --- /dev/null +++ b/examples/industrial_data_pretraining/lcbnet/demo.sh @@ -0,0 +1,72 @@ +file_dir="/home/yf352572/.cache/modelscope/hub/iic/LCB-NET/" +CUDA_VISIBLE_DEVICES="0,1" +inference_device="cuda" + +if [ ${inference_device} == "cuda" ]; then + nj=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') +else + inference_batch_size=1 + CUDA_VISIBLE_DEVICES="" + for JOB in $(seq ${nj}); do + CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"-1," + done +fi + +inference_dir="outputs/slidespeech_dev" +_logdir="${inference_dir}/logdir" +echo "inference_dir: ${inference_dir}" + +mkdir -p "${_logdir}" +key_file1=${file_dir}/dev/wav.scp +key_file2=${file_dir}/dev/ocr.txt +split_scps1= +split_scps2= +for JOB in $(seq "${nj}"); do + split_scps1+=" ${_logdir}/wav.${JOB}.scp" + split_scps2+=" ${_logdir}/ocr.${JOB}.txt" +done +utils/split_scp.pl "${key_file1}" ${split_scps1} +utils/split_scp.pl "${key_file2}" ${split_scps2} + +gpuid_list_array=(${CUDA_VISIBLE_DEVICES//,/ }) +for JOB in $(seq ${nj}); do + { + id=$((JOB-1)) + gpuid=${gpuid_list_array[$id]} + + export CUDA_VISIBLE_DEVICES=${gpuid} + + python -m funasr.bin.inference \ + --config-path=${file_dir} \ + --config-name="config.yaml" \ + ++init_param=${file_dir}/model.pt \ + ++tokenizer_conf.token_list=${file_dir}/tokens.txt \ + ++input=[${_logdir}/wav.${JOB}.scp,${_logdir}/ocr.${JOB}.txt] \ + +data_type='["kaldi_ark", "text"]' \ + ++tokenizer_conf.bpemodel=${file_dir}/bpe.pt \ + ++normalize_conf.stats_file=${file_dir}/am.mvn \ + ++output_dir="${inference_dir}/${JOB}" \ + ++device="${inference_device}" \ + ++ncpu=1 \ + ++disable_log=true &> ${_logdir}/log.${JOB}.txt + + }& +done +wait + + +mkdir -p ${inference_dir}/1best_recog + +for JOB in $(seq "${nj}"); do + cat "${inference_dir}/${JOB}/1best_recog/token" >> "${inference_dir}/1best_recog/token" +done + +echo "Computing WER ..." +sed -e 's/ /\t/' -e 's/ //g' -e 's/▁/ /g' -e 's/\t /\t/' ${inference_dir}/1best_recog/token > ${inference_dir}/1best_recog/token.proc +cp ${file_dir}/dev/text ${inference_dir}/1best_recog/token.ref +cp ${file_dir}/dev/ocr.list ${inference_dir}/1best_recog/ocr.list +python utils/compute_wer.py ${inference_dir}/1best_recog/token.ref ${inference_dir}/1best_recog/token.proc ${inference_dir}/1best_recog/token.cer +tail -n 3 ${inference_dir}/1best_recog/token.cer + +./run_bwer_recall.sh ${inference_dir}/1best_recog/ +tail -n 6 ${inference_dir}/1best_recog/BWER-UWER.results |head -n 5 diff --git a/examples/industrial_data_pretraining/lcbnet/run_bwer_recall.sh b/examples/industrial_data_pretraining/lcbnet/run_bwer_recall.sh new file mode 100644 index 0000000..7d6b6ff --- /dev/null +++ b/examples/industrial_data_pretraining/lcbnet/run_bwer_recall.sh @@ -0,0 +1,11 @@ +#now_result_name=asr_conformer_acc1_lr002_warm20000/decode_asr_asr_model_valid.acc.ave +#hotword_type=ocr_1ngram_top10_hotwords_list +hot_exp_suf=$1 + + +python compute_wer_details.py --v 1 \ + --ref ${hot_exp_suf}/token.ref \ + --ref_ocr ${hot_exp_suf}/ocr.list \ + --rec_name base \ + --rec_file ${hot_exp_suf}/token.proc \ + > ${hot_exp_suf}/BWER-UWER.results diff --git a/examples/industrial_data_pretraining/lcbnet/utils b/examples/industrial_data_pretraining/lcbnet/utils new file mode 100644 index 0000000..be5e5a3 --- /dev/null +++ b/examples/industrial_data_pretraining/lcbnet/utils @@ -0,0 +1 @@ +../../aishell/paraformer/utils \ No newline at end of file diff --git a/examples/industrial_data_pretraining/llm_asr/conf/template.yaml b/examples/industrial_data_pretraining/llm_asr/conf/template.yaml new file mode 100644 index 0000000..c64c886 --- /dev/null +++ b/examples/industrial_data_pretraining/llm_asr/conf/template.yaml @@ -0,0 +1,89 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: LLMASR +model_conf: + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: true + +# encoder +encoder: WhisperWarp +encoder_conf: + hub: funasr + init_param_path: "/nfs/maziyang.mzy/models/Whisper-large-v2" + freeze: true + +llm: Vicuna +llm_conf: + hub: hf + init_param_path: "/nfs/maziyang.mzy/models/vicuna-7b-v1.5" + freeze: true + +adaptor: Linear +adaptor_conf: + downsample_rate: 5 + llm_dim: 4096 + encoder_dim: 512 + +# frontend related +frontend: WhisperFrontend +frontend_conf: + fs: 16000 + whisper_model: large + do_pad_trim: true + + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + log_interval: 10 + +optim: adamw +optim_conf: + lr: 0.0001 + weight_decay: 0.000001 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 1500 + +dataset: AudioLLMDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 8 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 4 + preprocessor_text: TextPreprocessRemovePunctuation + +tokenizer: HuggingfaceTokenizer +tokenizer_conf: + unk_symbol: + init_param_path: "/nfs/maziyang.mzy/models/vicuna-7b-v1.5" + diff --git a/examples/industrial_data_pretraining/llm_asr/conf/whisper_qwen_linear.yaml b/examples/industrial_data_pretraining/llm_asr/conf/whisper_qwen_linear.yaml new file mode 100644 index 0000000..34be78d --- /dev/null +++ b/examples/industrial_data_pretraining/llm_asr/conf/whisper_qwen_linear.yaml @@ -0,0 +1,94 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: LLMASR +model_conf: + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: true + +# encoder +audio_encoder: "/nfs/zhifu.gzf/init_model/Whisper-large-v3" #iic/Whisper-large-v3 +audio_encoder_conf: + hub: ms + freeze: true + +llm: Qwen1.5-7b-chat +llm_conf: + hub: hf + freeze: true + init_param_path: "/nfs/zhifu.gzf/init_model/qwen/Qwen1___5-7B-Chat" + +audio_adaptor: Linear +audio_adaptor_conf: + downsample_rate: 5 + llm_dim: 4096 + encoder_dim: 512 + +# frontend related +frontend: WhisperFrontend +frontend_conf: + fs: 16000 + whisper_model: large-v3 + do_pad_trim: true + permute: true # true: [bs, frames, dims]; false: [bs, dims, frames] + + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 15 + keep_nbest_models: 10 + log_interval: 10 + +optim: adamw +optim_conf: + lr: 0.0001 + weight_decay: 0.000000 + +scheduler: warmuplr +scheduler_conf: + warmup_steps: 1500 + +dataset: AudioLLMQwenAudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: CustomDistributedBatchSampler + batch_type: example # example or length + batch_size: 4 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 3000 # filter samples if source_token_len+target_token_len > max_token_length, + shuffle: True + num_workers: 4 + preprocessor_text: TextPreprocessRemovePunctuation + audio_adaptor_downsample_rate: ${audio_adaptor_conf.downsample_rate} + audio_encoder_downsample_rate: 2 +# prompt: "<|startoftranscription|><|zh|><|transcribe|><|zh|><|notimestamps|><|wo_itn|>" + + + +tokenizer: HuggingfaceTokenizer +tokenizer_conf: + unk_symbol: + init_param_path: "/nfs/zhifu.gzf/init_model/qwen/Qwen1___5-7B-Chat" + diff --git a/examples/industrial_data_pretraining/llm_asr/conf/whisper_vicuna_linear.yaml b/examples/industrial_data_pretraining/llm_asr/conf/whisper_vicuna_linear.yaml new file mode 100644 index 0000000..f4f8c01 --- /dev/null +++ b/examples/industrial_data_pretraining/llm_asr/conf/whisper_vicuna_linear.yaml @@ -0,0 +1,93 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: LLMASR +model_conf: + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: true + +# encoder +audio_encoder: "/nfs/zhifu.gzf/init_model/Whisper-large-v3" #iic/Whisper-large-v3 +audio_encoder_conf: + hub: ms + freeze: true + +llm: Vicuna +llm_conf: + hub: hf + init_param_path: "/nfs/maziyang.mzy/models/vicuna-7b-v1.5" + freeze: true + +audio_adaptor: Linear +audio_adaptor_conf: + downsample_rate: 5 + llm_dim: 4096 + encoder_dim: 512 + +# frontend related +frontend: WhisperFrontend +frontend_conf: + fs: 16000 + whisper_model: large-v3 + do_pad_trim: true + permute: true # true: [bs, frames, dims]; false: [bs, dims, frames] + + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 15 + keep_nbest_models: 10 + log_interval: 10 + +optim: adamw +optim_conf: + lr: 0.0001 + weight_decay: 0 + +scheduler: warmuplr +scheduler_conf: + warmup_steps: 1500 + +dataset: AudioLLMVicunaDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: CustomDistributedBatchSampler + batch_type: example # example or length + batch_size: 4 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 3000 # filter samples if source_token_len+target_token_len > max_token_length, + shuffle: True + num_workers: 4 +# preprocessor_text: TextPreprocessRemovePunctuation + audio_adaptor_downsample_rate: ${audio_adaptor_conf.downsample_rate} + audio_encoder_downsample_rate: 2 + + + +tokenizer: HuggingfaceTokenizer +tokenizer_conf: + unk_symbol: + init_param_path: "/nfs/maziyang.mzy/models/vicuna-7b-v1.5" + diff --git a/examples/industrial_data_pretraining/llm_asr/demo_infer.sh b/examples/industrial_data_pretraining/llm_asr/demo_infer.sh new file mode 100644 index 0000000..f8ebc4c --- /dev/null +++ b/examples/industrial_data_pretraining/llm_asr/demo_infer.sh @@ -0,0 +1,14 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + + +python -m funasr.bin.inference \ +--config-path="/root/FunASR/examples/aishell/llm_asr_nar/conf" \ +--config-name="template.yaml" \ +++init_param="/mnt/workspace/FunASR/examples/aishell/paraformer/exp/baseline_paraformer_conformer_12e_6d_2048_256_zh_char_exp3/model.pt.ep38" \ +++input="/nfs/beinian.lzr/workspace/datasets/data/16k/opendata/aishell1/dev/wav/S0724/BAC009S0724W0121.wav" \ +++scope_map="encoder.model,audio_encoder,encoder_projector,adaptor" \ +++output_dir="./outputs/debug" \ +++device="cpu" \ + diff --git a/examples/industrial_data_pretraining/llm_asr/demo_train_or_finetune.sh b/examples/industrial_data_pretraining/llm_asr/demo_train_or_finetune.sh new file mode 100644 index 0000000..6b88e75 --- /dev/null +++ b/examples/industrial_data_pretraining/llm_asr/demo_train_or_finetune.sh @@ -0,0 +1,46 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# data dir, which contains: train.json, val.json, tokens.jsonl/tokens.txt, am.mvn +#data_dir="/Users/zhifu/funasr1.0/data/list" + +## generate jsonl from wav.scp and text.txt +#python -m funasr.datasets.audio_datasets.scp2jsonl \ +#++scp_file_list='["/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"]' \ +#++data_type_list='["source", "target"]' \ +#++jsonl_file_out=/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl + +train_data="/nfs/maziyang.mzy/data/librispeech/librispeech_train_960h.jsonl" +val_data="/nfs/maziyang.mzy/data/librispeech/librispeech_dev_other_filtered.jsonl" + +# exp output dir +output_dir="/nfs/zhifu.gzf/ckpt/exp/llm_asr_whisper_vicuna_exp1" +log_file="${output_dir}/log.txt" + +workspace=`pwd` +config="whisper_vicuna_linear.yaml" + +init_param="${output_dir}/model.pt" + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +--config-path "${workspace}/conf" \ +--config-name "${config}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=4 \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=15 \ +++optim_conf.lr=0.0001 \ +++init_param="${init_param}" \ +++output_dir="${output_dir}" &> ${log_file} & diff --git a/examples/industrial_data_pretraining/monotonic_aligner/README_zh.md b/examples/industrial_data_pretraining/monotonic_aligner/README_zh.md new file mode 100644 index 0000000..8ddb202 --- /dev/null +++ b/examples/industrial_data_pretraining/monotonic_aligner/README_zh.md @@ -0,0 +1,42 @@ +(简体中文|[English](./README.md)) + +# 语音识别 + +> **注意**: +> pipeline 支持 [modelscope模型仓库](https://alibaba-damo-academy.github.io/FunASR/en/model_zoo/modelscope_models.html#pretrained-models-on-modelscope) 中的所有模型进行推理和微调。这里我们以典型模型作为示例来演示使用方法。 + +## 推理 + +### 快速使用 +#### [Paraformer 模型](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) +```python +from funasr import AutoModel + +model = AutoModel(model="/Users/zhifu/Downloads/modelscope_models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch") + +res = model(input="/Users/zhifu/Downloads/modelscope_models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav") +print(res) +``` + +### API接口说明 +#### AutoModel 定义 +- `model`: [模型仓库](https://alibaba-damo-academy.github.io/FunASR/en/model_zoo/modelscope_models.html#pretrained-models-on-modelscope) 中的模型名称,或本地磁盘中的模型路径 +- `device`: `cuda`(默认),使用 GPU 进行推理。如果为`cpu`,则使用 CPU 进行推理 +- `ncpu`: `None` (默认),设置用于 CPU 内部操作并行性的线程数 +- `output_dir`: `None` (默认),如果设置,输出结果的输出路径 +- `batch_size`: `1` (默认),解码时的批处理大小 +#### AutoModel 推理 +- `input`: 要解码的输入,可以是: + - wav文件路径, 例如: asr_example.wav + - pcm文件路径, 例如: asr_example.pcm,此时需要指定音频采样率fs(默认为16000) + - 音频字节数流,例如:麦克风的字节数数据 + - wav.scp,kaldi 样式的 wav 列表 (`wav_id \t wav_path`), 例如: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + 在这种输入 `wav.scp` 的情况下,必须设置 `output_dir` 以保存输出结果 + - 音频采样点,例如:`audio, rate = soundfile.read("asr_example_zh.wav")`, 数据类型为 numpy.ndarray。支持batch输入,类型为list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank输入,支持组batch。shape为[batch, frames, dim],类型为torch.Tensor,例如 +- `output_dir`: None (默认),如果设置,输出结果的输出路径 diff --git a/examples/industrial_data_pretraining/monotonic_aligner/demo.py b/examples/industrial_data_pretraining/monotonic_aligner/demo.py new file mode 100644 index 0000000..35ddb89 --- /dev/null +++ b/examples/industrial_data_pretraining/monotonic_aligner/demo.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel(model="iic/speech_timestamp_prediction-v1-16k-offline") + +res = model.generate( + input=( + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + "欢迎大家来到魔搭社区进行体验", + ), + data_type=("sound", "text"), + batch_size=2, +) +print(res) diff --git a/examples/industrial_data_pretraining/monotonic_aligner/demo.sh b/examples/industrial_data_pretraining/monotonic_aligner/demo.sh new file mode 100644 index 0000000..8c54265 --- /dev/null +++ b/examples/industrial_data_pretraining/monotonic_aligner/demo.sh @@ -0,0 +1,11 @@ + +model="iic/speech_timestamp_prediction-v1-16k-offline" + + +python funasr/bin/inference.py \ ++model=${model} \ ++input='["https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", "欢迎大家来到魔搭社区进行体验"]' \ ++data_type='["sound", "text"]' \ ++output_dir="../outputs/debug" \ ++device="cpu" \ ++batch_size=2 diff --git a/examples/industrial_data_pretraining/paraformer-zh-spk/README_zh.md b/examples/industrial_data_pretraining/paraformer-zh-spk/README_zh.md new file mode 100644 index 0000000..b016f9e --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer-zh-spk/README_zh.md @@ -0,0 +1,436 @@ +(简体中文|[English](./README.md)) + +FunASR开源了大量在工业数据上预训练模型,您可以在 [模型许可协议](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE)下自由使用、复制、修改和分享FunASR模型,下面列举代表性的模型,更多模型请参考 [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo)。 + + + + +## 模型推理 + +### 快速使用 + +命令行方式调用: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +python代码调用(推荐) + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### 接口说明 + +#### AutoModel 定义 +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo) 中的模型名称,或本地磁盘中的模型路径 +- `device`(str): `cuda:0`(默认gpu0),使用 GPU 进行推理,指定。如果为`cpu`,则使用 CPU 进行推理 +- `ncpu`(int): `4` (默认),设置用于 CPU 内部操作并行性的线程数 +- `output_dir`(str): `None` (默认),如果设置,输出结果的输出路径 +- `batch_size`(int): `1` (默认),解码时的批处理,样本个数 +- `hub`(str):`ms`(默认),从modelscope下载模型。如果为`hf`,从huggingface下载模型。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,vad模型中最大切割长度 `max_single_segment_time=6000` (毫秒)。 + +#### AutoModel 推理 +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: 要解码的输入,可以是: + - wav文件路径, 例如: asr_example.wav + - pcm文件路径, 例如: asr_example.pcm,此时需要指定音频采样率fs(默认为16000) + - 音频字节数流,例如:麦克风的字节数数据 + - wav.scp,kaldi 样式的 wav 列表 (`wav_id \t wav_path`), 例如: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + 在这种输入 `wav.scp` 的情况下,必须设置 `output_dir` 以保存输出结果 + - 音频采样点,例如:`audio, rate = soundfile.read("asr_example_zh.wav")`, 数据类型为 numpy.ndarray。支持batch输入,类型为list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank输入,支持组batch。shape为[batch, frames, dim],类型为torch.Tensor,例如 +- `output_dir`: None (默认),如果设置,输出结果的输出路径 +- `**kwargs`(dict): 与模型相关的推理参数,例如,`beam_size=10`,`decoding_ctc_weight=0.1`。 + + +### 更多用法介绍 + + +#### 非实时语音识别 +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +注意: +- 通常模型输入限制时长30s以下,组合`vad_model`后,支持任意时长音频输入,不局限于paraformer模型,所有音频输入模型均可以。 +- `model`相关的参数可以直接在`AutoModel`定义中直接指定;与`vad_model`相关参数可以通过`vad_kwargs`来指定,类型为dict;类似的有`punc_kwargs`,`spk_kwargs`; +- `max_single_segment_time`: 表示`vad_model`最大切割音频时长, 单位是毫秒ms. +- `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。 +- `batch_size_threshold_s`: 表示`vad_model`切割后音频片段时长超过 `batch_size_threshold_s`阈值时,将batch_size数设置为1, 单位为秒s. + +建议:当您输入为长音频,遇到OOM问题时,因为显存占用与音频时长呈平方关系增加,分为3种情况: +- a)推理起始阶段,显存主要取决于`batch_size_s`,适当减小该值,可以减少显存占用; +- b)推理中间阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,仍然出现OOM,可以适当减小`batch_size_threshold_s`,超过阈值,强制batch为1; +- c)推理快结束阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,且超过阈值`batch_size_threshold_s`,强制batch为1,仍然出现OOM,可以适当减小`max_single_segment_time`,使得VAD切割音频时长变短。 + +#### 实时语音识别 + +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` + +注:`chunk_size`为流式延时配置,`[0,10,5]`表示上屏实时出字粒度为`10*60=600ms`,未来信息为`5*60=300ms`。每次推理输入为`600ms`(采样点数为`16000*0.6=960`),输出为对应文字,最后一个语音片段输入需要设置`is_final=True`来强制输出最后一个字。 + +#### 语音端点检测(非实时) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") + +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +注:VAD模型输出格式为:`[[beg1, end1], [beg2, end2], .., [begN, endN]]`,其中`begN/endN`表示第`N`个有效音频片段的起始点/结束点, +单位为毫秒。 + +#### 语音端点检测(实时) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +注:流式VAD模型输出格式为4种情况: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:同上离线VAD输出结果。 +- `[[beg, -1]]`:表示只检测到起始点。 +- `[[-1, end]]`:表示只检测到结束点。 +- `[]`:表示既没有检测到起始点,也没有检测到结束点 +输出结果单位为毫秒,从起始点开始的绝对时间。 + +#### 标点恢复 +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") + +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` + +#### 时间戳预测 +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") + +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` +更多([示例](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)) + + +## 模型训练与测试 + +### 快速开始 + +命令行执行(用于快速测试,不推荐): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +python代码执行(可以多机多卡,推荐) + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +详细完整的脚本参考 [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### 详细参数介绍 + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str):模型名字(模型仓库中的ID),此时脚本会自动下载模型到本读;或者本地已经下载好的模型路径。 +- `train_data_set_list`(str):训练数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `valid_data_set_list`(str):验证数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `dataset_conf.batch_type`(str):`example`(默认),batch的类型。`example`表示按照固定数目batch_size个样本组batch;`length` or `token` 表示动态组batch,batch总长度或者token数为batch_size。 +- `dataset_conf.batch_size`(int):与 `batch_type` 搭配使用,当 `batch_type=example` 时,表示样本个数;当 `batch_type=length` 时,表示样本中长度,单位为fbank帧数(1帧10ms)或者文字token个数。 +- `train_conf.max_epoch`(int):`100`(默认),训练总epoch数。 +- `train_conf.log_interval`(int):`50`(默认),打印日志间隔step数。 +- `train_conf.resume`(int):`True`(默认),是否开启断点重训。 +- `train_conf.validate_interval`(int):`5000`(默认),训练中做验证测试的间隔step数。 +- `train_conf.save_checkpoint_interval`(int):`5000`(默认),训练中模型保存间隔step数。 +- `train_conf.avg_keep_nbest_models_type`(str):`acc`(默认),保留nbest的标准为acc(越大越好)。`loss`表示,保留nbest的标准为loss(越小越好)。 +- `train_conf.keep_nbest_models`(int):`500`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 保留最佳的n个模型,其他删除,节约存储空间。 +- `train_conf.avg_nbest_model`(int):`10`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 对最佳的n个模型平均。 +- `train_conf.accum_grad`(int):`1`(默认),梯度累积功能。 +- `train_conf.grad_clip`(float):`10.0`(默认),梯度截断功能。 +- `train_conf.use_fp16`(bool):`False`(默认),开启fp16训练,加快训练速度。 +- `optim_conf.lr`(float):学习率。 +- `output_dir`(str):模型保存路径。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,过滤20s以上长音频:`dataset_conf.max_token_length=2000`,单位为音频fbank帧数(1帧10ms)或者文字token个数。 + +#### 多gpu训练 +##### 单机多gpu训练 +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes 表示参与的节点总数,--nproc_per_node 表示每个节点上运行的进程数 + +##### 多机多gpu训练 + +在主节点上,假设IP为192.168.1.1,端口为12345,使用的是2个GPU,则运行如下命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +在从节点上(假设IP为192.168.1.2),你需要确保MASTER_ADDR和MASTER_PORT环境变量与主节点设置的一致,并运行同样的命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes 表示参与的节点总数,--node_rank 表示当前节点id,--nproc_per_node 表示每个节点上运行的进程数(通常为gpu个数) + +#### 准备数据 + +`jsonl`格式可以参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +可以用指令 `scp2jsonl` 从wav.scp与text.txt生成。wav.scp与text.txt准备过程如下: + +`train_text.txt` + +左边为数据唯一ID,需与`train_wav.scp`中的`ID`一一对应 +右边为音频文件标注文本,格式如下: + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + +左边为数据唯一ID,需与`train_text.txt`中的`ID`一一对应 +右边为音频文件的路径,格式如下 + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`生成指令` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(可选,非必需)如果需要从jsonl解析成wav.scp与text.txt,可以使用指令: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### 查看训练日志 + +##### 查看实验log +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` +指标解释: +- `rank`:表示gpu id。 +- `epoch`,`step`,`total step`:表示当前epoch,step,总step。 +- `loss_avg_rank`:表示当前step,所有gpu平均loss。 +- `loss/ppl/acc_avg_epoch`:表示当前epoch周期,截止当前step数时,总平均loss/ppl/acc。epoch结束时的最后一个step表示epoch总平均loss/ppl/acc,推荐使用acc指标。 +- `lr`:当前step的学习率。 +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:表示当前gpu id的具体数据。 +- `total_time`:表示单个step总耗时。 +- `GPU, memory`:分别表示,模型使用/峰值显存,模型+缓存使用/峰值显存。 + +##### tensorboard可视化 +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +浏览器中打开:http://localhost:6006/ + +### 训练后模型测试 + + +#### 有configuration.json + +假定,训练模型路径为:./model_dir,如果改目录下有生成configuration.json,只需要将 [上述模型推理方法](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/README_zh.md#%E6%A8%A1%E5%9E%8B%E6%8E%A8%E7%90%86) 中模型名字修改为模型路径即可 + +例如: + +从shell推理 +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` +从python推理 + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### 无configuration.json时 + +如果模型路径中无configuration.json时,需要手动指定具体配置文件路径与模型路径 + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +参数介绍 +- `config-path`:为实验中保存的 `config.yaml`,可以从实验输出目录中查找。 +- `config-name`:配置文件名,一般为 `config.yaml`,支持yaml格式与json格式,例如 `config.json` +- `init_param`:需要测试的模型参数,一般为`model.pt`,可以自己选择具体的模型文件 +- `tokenizer_conf.token_list`:词表文件路径,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 +- `frontend_conf.cmvn_file`:wav提取fbank中用到的cmvn文件,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 + +其他参数同上,完整 [示例](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) + + + +## 模型导出与测试 +### 从命令行导出 +```shell +funasr-export ++model=paraformer ++quantize=false +``` + +### 从Python导出 +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer") + +res = model.export(quantize=False) +``` + +### 测试ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +更多例子请参考 [样例](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/examples/industrial_data_pretraining/paraformer-zh-spk/__init__.py b/examples/industrial_data_pretraining/paraformer-zh-spk/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/industrial_data_pretraining/paraformer-zh-spk/demo.py b/examples/industrial_data_pretraining/paraformer-zh-spk/demo.py new file mode 100644 index 0000000..9afd801 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer-zh-spk/demo.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel( + model="iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", + spk_model="iic/speech_campplus_sv_zh-cn_16k-common", +) + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + hotword="达摩院 磨搭", +) +print(res) diff --git a/examples/industrial_data_pretraining/paraformer-zh-spk/demo.sh b/examples/industrial_data_pretraining/paraformer-zh-spk/demo.sh new file mode 100644 index 0000000..ab94179 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer-zh-spk/demo.sh @@ -0,0 +1,16 @@ + +model="iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch" +#punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" +punc_model="iic/punc_ct-transformer_cn-en-common-vocab471067-large" +spk_model="iic/speech_campplus_sv_zh-cn_16k-common" + +python funasr/bin/inference.py \ +++model=${model} \ +++vad_model=${vad_model} \ +++punc_model=${punc_model} \ +++spk_model=${spk_model} \ +++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" \ +++output_dir="./outputs/debug" \ +++device="cpu" \ +++"hotword='达摩院 魔搭'" diff --git a/examples/industrial_data_pretraining/paraformer/README.md b/examples/industrial_data_pretraining/paraformer/README.md new file mode 100644 index 0000000..f87d5fa --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/README.md @@ -0,0 +1,424 @@ +([简体中文](./README_zh.md)|English) + +FunASR has open-sourced a large number of pre-trained models on industrial data. You are free to use, copy, modify, and share FunASR models under the [Model License Agreement](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE). Below, we list some representative models. For a comprehensive list, please refer to our [Model Zoo](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo). + + + + +## Model Inference + +### Quick Start + +For command-line invocation: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +For python code invocation (recommended): + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### API Description +#### AutoModel Definition +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): model name in the [Model Repository](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo), or a model path on local disk. +- `device`(str): `cuda:0` (default gpu0) for using GPU for inference, specify `cpu` for using CPU. +- `ncpu`(int): `4` (default), sets the number of threads for CPU internal operations. +- `output_dir`(str): `None` (default), set this to specify the output path for the results. +- `batch_size`(int): `1` (default), the number of samples per batch during decoding. +- `hub`(str):`ms` (default) to download models from ModelScope. Use `hf` to download models from Hugging Face. +- `**kwargs`(dict): Any parameters found in config.yaml can be directly specified here, for instance, the maximum segmentation length in the vad model max_single_segment_time=6000 (milliseconds). + +#### AutoModel Inference +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: The input to be decoded, which could be: + - A wav file path, e.g., asr_example.wav + - A pcm file path, e.g., asr_example.pcm, in this case, specify the audio sampling rate fs (default is 16000) + - An audio byte stream, e.g., byte data from a microphone + - A wav.scp, a Kaldi-style wav list (wav_id \t wav_path), for example: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + When using wav.scp as input, you must set output_dir to save the output results. + - Audio samples, `e.g.`: `audio, rate = soundfile.read("asr_example_zh.wav")`, data type is numpy.ndarray. Supports batch inputs, type is list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank input, supports batch grouping. Shape is [batch, frames, dim], type is torch.Tensor. +- `output_dir`: None (default), if set, specifies the output path for the results. +- `**kwargs`(dict): Inference parameters related to the model, for example,`beam_size=10`,`decoding_ctc_weight=0.1`. + + +### More Usage Introduction + + +#### Speech Recognition (Non-streaming) +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +Notes: +- Typically, the input duration for models is limited to under 30 seconds. However, when combined with `vad_model`, support for audio input of any length is enabled, not limited to the paraformer model—any audio input model can be used. +- Parameters related to model can be directly specified in the definition of AutoModel; parameters related to `vad_model` can be set through `vad_kwargs`, which is a dict; similar parameters include `punc_kwargs` and `spk_kwargs`. +- `max_single_segment_time`: Denotes the maximum audio segmentation length for `vad_model`, measured in milliseconds (ms). +- `batch_size_s` represents the use of dynamic batching, where the total audio duration within a batch is measured in seconds (s). +- `batch_size_threshold_s`: Indicates that when the duration of an audio segment post-VAD segmentation exceeds the batch_size_threshold_s threshold, the batch size is set to 1, measured in seconds (s). + +Recommendations: + +When you input long audio and encounter Out Of Memory (OOM) issues, since memory usage tends to increase quadratically with audio length, consider the following three scenarios: + +a) At the beginning of inference, memory usage primarily depends on `batch_size_s`. Appropriately reducing this value can decrease memory usage. +b) During the middle of inference, when encountering long audio segments cut by VAD and the total token count is less than `batch_size_s`, yet still facing OOM, you can appropriately reduce `batch_size_threshold_s`. If the threshold is exceeded, the batch size is forced to 1. +c) Towards the end of inference, if long audio segments cut by VAD have a total token count less than `batch_size_s` and exceed the `threshold` batch_size_threshold_s, forcing the batch size to 1 and still facing OOM, you may reduce `max_single_segment_time` to shorten the VAD audio segment length. + +#### Speech Recognition (Streaming) +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` +Note: `chunk_size` is the configuration for streaming latency.` [0,10,5]` indicates that the real-time display granularity is `10*60=600ms`, and the lookahead information is `5*60=300ms`. Each inference input is `600ms` (sample points are `16000*0.6=960`), and the output is the corresponding text. For the last speech segment input, `is_final=True` needs to be set to force the output of the last word. + +#### Voice Activity Detection (Non-Streaming) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +Note: The output format of the VAD model is: `[[beg1, end1], [beg2, end2], ..., [begN, endN]]`, where `begN/endN` indicates the starting/ending point of the `N-th` valid audio segment, measured in milliseconds. + +#### Voice Activity Detection (Streaming) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +Note: The output format for the streaming VAD model can be one of four scenarios: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:The same as the offline VAD output result mentioned above. +- `[[beg, -1]]`:Indicates that only a starting point has been detected. +- `[[-1, end]]`:Indicates that only an ending point has been detected. +- `[]`:Indicates that neither a starting point nor an ending point has been detected. + +The output is measured in milliseconds and represents the absolute time from the starting point. +#### Punctuation Restoration +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` +#### Timestamp Prediction +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` + +More examples ref to [docs](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining) + + +## Model Training and Testing + +### Quick Start + +Execute via command line (for quick testing, not recommended): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +Execute with Python code (supports multi-node and multi-GPU, recommended): + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +Full code ref to [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### Detailed Parameter Description: + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str): The name of the model (the ID in the model repository), at which point the script will automatically download the model to local storage; alternatively, the path to a model already downloaded locally. +- `train_data_set_list`(str): The path to the training data, typically in jsonl format, for specific details refer to [examples](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list). +- `valid_data_set_list`(str):The path to the validation data, also generally in jsonl format, for specific details refer to examples](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list). +- `dataset_conf.batch_type`(str):example (default), the type of batch. example means batches are formed with a fixed number of batch_size samples; length or token means dynamic batching, with total length or number of tokens of the batch equalling batch_size. +- `dataset_conf.batch_size`(int):Used in conjunction with batch_type. When batch_type=example, it represents the number of samples; when batch_type=length, it represents the length of the samples, measured in fbank frames (1 frame = 10 ms) or the number of text tokens. +- `train_conf.max_epoch`(int):The total number of epochs for training. +- `train_conf.log_interval`(int):The number of steps between logging. +- `train_conf.resume`(int):Whether to enable checkpoint resuming for training. +- `train_conf.validate_interval`(int):The interval in steps to run validation tests during training. +- `train_conf.save_checkpoint_interval`(int):The interval in steps for saving the model during training. +- `train_conf.keep_nbest_models`(int):The maximum number of model parameters to retain, sorted by validation set accuracy, from highest to lowest. +- `train_conf.avg_nbest_model`(int):Average over the top n models with the highest accuracy. +- `optim_conf.lr`(float):The learning rate. +- `output_dir`(str):The path for saving the model. +- `**kwargs`(dict): Any parameters in config.yaml can be specified directly here, for example, to filter out audio longer than 20s: dataset_conf.max_token_length=2000, measured in fbank frames (1 frame = 10 ms) or the number of text tokens. + +#### Multi-GPU Training +##### Single-Machine Multi-GPU Training +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes represents the total number of participating nodes, while --nproc_per_node indicates the number of processes running on each node. + +##### Multi-Machine Multi-GPU Training + +On the master node, assuming the IP is 192.168.1.1 and the port is 12345, and you're using 2 GPUs, you would run the following command: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr=192.168.1.1 --master_port=12345 \ +../../../funasr/bin/train.py ${train_args} +``` +On the worker node (assuming the IP is 192.168.1.2), you need to ensure that the MASTER_ADDR and MASTER_PORT environment variables are set to match those of the master node, and then run the same command: + +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr=192.168.1.1 --master_port=12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes indicates the total number of nodes participating in the training, --node_rank represents the ID of the current node, and --nproc_per_node specifies the number of processes running on each node (usually corresponds to the number of GPUs). + +#### Data prepare + +`jsonl` ref to([demo](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list)). +The instruction scp2jsonl can be used to generate from wav.scp and text.txt. The preparation process for wav.scp and text.txt is as follows: + +`train_text.txt` + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`Command` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(Optional, not required) If you need to parse from jsonl back to wav.scp and text.txt, you can use the following command: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### Training log + +##### log.txt +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` + + +- `rank`:gpu id。 +- `epoch`,`step`,`total step`:the current epoch, step, and total steps. +- `loss_avg_rank`:the average loss across all GPUs for the current step. +- `loss/ppl/acc_avg_epoch`:the overall average loss/perplexity/accuracy for the current epoch, up to the current step count. The last step of the epoch when it ends represents the total average loss/perplexity/accuracy for that epoch; it is recommended to use the accuracy metric. +- `lr`:the learning rate for the current step. +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:the specific data for the current GPU ID. +- `total_time`:the total time taken for a single step. +- `GPU, memory`:the model-used/peak memory and the model+cache-used/peak memory. + +##### tensorboard +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +http://localhost:6006/ + +### 训练后模型测试 + + +#### With `configuration.json` file + +Assuming the training model path is: ./model_dir, if a configuration.json file has been generated in this directory, you only need to change the model name to the model path in the above model inference method. + +For example, for shell inference: +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` + +Python inference + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### Without `configuration.json` file + +If there is no configuration.json in the model path, you need to manually specify the exact configuration file path and the model path. + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +Parameter Introduction +- `config-path`:This is the path to the config.yaml saved during the experiment, which can be found in the experiment's output directory. +- `config-name`:The name of the configuration file, usually config.yaml. It supports both YAML and JSON formats, for example config.json. +- `init_param`:The model parameters that need to be tested, usually model.pt. You can choose a specific model file as needed. +- `tokenizer_conf.token_list`:The path to the vocabulary file, which is normally specified in config.yaml. There is no need to manually specify it again unless the path in config.yaml is incorrect, in which case the correct path must be manually specified here. +- `frontend_conf.cmvn_file`:The CMVN (Cepstral Mean and Variance Normalization) file used when extracting fbank features from WAV files, which is usually specified in config.yaml. There is no need to manually specify it again unless the path in config.yaml is incorrect, in which case the correct path must be manually specified here. + +Other parameters are the same as mentioned above. A complete [example](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) can be found here. + + +## Export ONNX + +### Command-line usage +```shell +funasr-export ++model=paraformer ++quantize=false ++device=cpu +``` + +### Python +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer", device="cpu") + +res = model.export(quantize=False) +``` + +### Test ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +More examples ref to [demo](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/examples/industrial_data_pretraining/paraformer/README_zh.md b/examples/industrial_data_pretraining/paraformer/README_zh.md new file mode 100644 index 0000000..b016f9e --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/README_zh.md @@ -0,0 +1,436 @@ +(简体中文|[English](./README.md)) + +FunASR开源了大量在工业数据上预训练模型,您可以在 [模型许可协议](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE)下自由使用、复制、修改和分享FunASR模型,下面列举代表性的模型,更多模型请参考 [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo)。 + + + + +## 模型推理 + +### 快速使用 + +命令行方式调用: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +python代码调用(推荐) + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### 接口说明 + +#### AutoModel 定义 +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo) 中的模型名称,或本地磁盘中的模型路径 +- `device`(str): `cuda:0`(默认gpu0),使用 GPU 进行推理,指定。如果为`cpu`,则使用 CPU 进行推理 +- `ncpu`(int): `4` (默认),设置用于 CPU 内部操作并行性的线程数 +- `output_dir`(str): `None` (默认),如果设置,输出结果的输出路径 +- `batch_size`(int): `1` (默认),解码时的批处理,样本个数 +- `hub`(str):`ms`(默认),从modelscope下载模型。如果为`hf`,从huggingface下载模型。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,vad模型中最大切割长度 `max_single_segment_time=6000` (毫秒)。 + +#### AutoModel 推理 +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: 要解码的输入,可以是: + - wav文件路径, 例如: asr_example.wav + - pcm文件路径, 例如: asr_example.pcm,此时需要指定音频采样率fs(默认为16000) + - 音频字节数流,例如:麦克风的字节数数据 + - wav.scp,kaldi 样式的 wav 列表 (`wav_id \t wav_path`), 例如: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + 在这种输入 `wav.scp` 的情况下,必须设置 `output_dir` 以保存输出结果 + - 音频采样点,例如:`audio, rate = soundfile.read("asr_example_zh.wav")`, 数据类型为 numpy.ndarray。支持batch输入,类型为list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank输入,支持组batch。shape为[batch, frames, dim],类型为torch.Tensor,例如 +- `output_dir`: None (默认),如果设置,输出结果的输出路径 +- `**kwargs`(dict): 与模型相关的推理参数,例如,`beam_size=10`,`decoding_ctc_weight=0.1`。 + + +### 更多用法介绍 + + +#### 非实时语音识别 +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +注意: +- 通常模型输入限制时长30s以下,组合`vad_model`后,支持任意时长音频输入,不局限于paraformer模型,所有音频输入模型均可以。 +- `model`相关的参数可以直接在`AutoModel`定义中直接指定;与`vad_model`相关参数可以通过`vad_kwargs`来指定,类型为dict;类似的有`punc_kwargs`,`spk_kwargs`; +- `max_single_segment_time`: 表示`vad_model`最大切割音频时长, 单位是毫秒ms. +- `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。 +- `batch_size_threshold_s`: 表示`vad_model`切割后音频片段时长超过 `batch_size_threshold_s`阈值时,将batch_size数设置为1, 单位为秒s. + +建议:当您输入为长音频,遇到OOM问题时,因为显存占用与音频时长呈平方关系增加,分为3种情况: +- a)推理起始阶段,显存主要取决于`batch_size_s`,适当减小该值,可以减少显存占用; +- b)推理中间阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,仍然出现OOM,可以适当减小`batch_size_threshold_s`,超过阈值,强制batch为1; +- c)推理快结束阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,且超过阈值`batch_size_threshold_s`,强制batch为1,仍然出现OOM,可以适当减小`max_single_segment_time`,使得VAD切割音频时长变短。 + +#### 实时语音识别 + +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` + +注:`chunk_size`为流式延时配置,`[0,10,5]`表示上屏实时出字粒度为`10*60=600ms`,未来信息为`5*60=300ms`。每次推理输入为`600ms`(采样点数为`16000*0.6=960`),输出为对应文字,最后一个语音片段输入需要设置`is_final=True`来强制输出最后一个字。 + +#### 语音端点检测(非实时) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") + +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +注:VAD模型输出格式为:`[[beg1, end1], [beg2, end2], .., [begN, endN]]`,其中`begN/endN`表示第`N`个有效音频片段的起始点/结束点, +单位为毫秒。 + +#### 语音端点检测(实时) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +注:流式VAD模型输出格式为4种情况: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:同上离线VAD输出结果。 +- `[[beg, -1]]`:表示只检测到起始点。 +- `[[-1, end]]`:表示只检测到结束点。 +- `[]`:表示既没有检测到起始点,也没有检测到结束点 +输出结果单位为毫秒,从起始点开始的绝对时间。 + +#### 标点恢复 +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") + +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` + +#### 时间戳预测 +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") + +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` +更多([示例](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)) + + +## 模型训练与测试 + +### 快速开始 + +命令行执行(用于快速测试,不推荐): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +python代码执行(可以多机多卡,推荐) + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +详细完整的脚本参考 [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### 详细参数介绍 + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str):模型名字(模型仓库中的ID),此时脚本会自动下载模型到本读;或者本地已经下载好的模型路径。 +- `train_data_set_list`(str):训练数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `valid_data_set_list`(str):验证数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `dataset_conf.batch_type`(str):`example`(默认),batch的类型。`example`表示按照固定数目batch_size个样本组batch;`length` or `token` 表示动态组batch,batch总长度或者token数为batch_size。 +- `dataset_conf.batch_size`(int):与 `batch_type` 搭配使用,当 `batch_type=example` 时,表示样本个数;当 `batch_type=length` 时,表示样本中长度,单位为fbank帧数(1帧10ms)或者文字token个数。 +- `train_conf.max_epoch`(int):`100`(默认),训练总epoch数。 +- `train_conf.log_interval`(int):`50`(默认),打印日志间隔step数。 +- `train_conf.resume`(int):`True`(默认),是否开启断点重训。 +- `train_conf.validate_interval`(int):`5000`(默认),训练中做验证测试的间隔step数。 +- `train_conf.save_checkpoint_interval`(int):`5000`(默认),训练中模型保存间隔step数。 +- `train_conf.avg_keep_nbest_models_type`(str):`acc`(默认),保留nbest的标准为acc(越大越好)。`loss`表示,保留nbest的标准为loss(越小越好)。 +- `train_conf.keep_nbest_models`(int):`500`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 保留最佳的n个模型,其他删除,节约存储空间。 +- `train_conf.avg_nbest_model`(int):`10`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 对最佳的n个模型平均。 +- `train_conf.accum_grad`(int):`1`(默认),梯度累积功能。 +- `train_conf.grad_clip`(float):`10.0`(默认),梯度截断功能。 +- `train_conf.use_fp16`(bool):`False`(默认),开启fp16训练,加快训练速度。 +- `optim_conf.lr`(float):学习率。 +- `output_dir`(str):模型保存路径。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,过滤20s以上长音频:`dataset_conf.max_token_length=2000`,单位为音频fbank帧数(1帧10ms)或者文字token个数。 + +#### 多gpu训练 +##### 单机多gpu训练 +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes 表示参与的节点总数,--nproc_per_node 表示每个节点上运行的进程数 + +##### 多机多gpu训练 + +在主节点上,假设IP为192.168.1.1,端口为12345,使用的是2个GPU,则运行如下命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +在从节点上(假设IP为192.168.1.2),你需要确保MASTER_ADDR和MASTER_PORT环境变量与主节点设置的一致,并运行同样的命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes 表示参与的节点总数,--node_rank 表示当前节点id,--nproc_per_node 表示每个节点上运行的进程数(通常为gpu个数) + +#### 准备数据 + +`jsonl`格式可以参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +可以用指令 `scp2jsonl` 从wav.scp与text.txt生成。wav.scp与text.txt准备过程如下: + +`train_text.txt` + +左边为数据唯一ID,需与`train_wav.scp`中的`ID`一一对应 +右边为音频文件标注文本,格式如下: + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + +左边为数据唯一ID,需与`train_text.txt`中的`ID`一一对应 +右边为音频文件的路径,格式如下 + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`生成指令` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(可选,非必需)如果需要从jsonl解析成wav.scp与text.txt,可以使用指令: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### 查看训练日志 + +##### 查看实验log +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` +指标解释: +- `rank`:表示gpu id。 +- `epoch`,`step`,`total step`:表示当前epoch,step,总step。 +- `loss_avg_rank`:表示当前step,所有gpu平均loss。 +- `loss/ppl/acc_avg_epoch`:表示当前epoch周期,截止当前step数时,总平均loss/ppl/acc。epoch结束时的最后一个step表示epoch总平均loss/ppl/acc,推荐使用acc指标。 +- `lr`:当前step的学习率。 +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:表示当前gpu id的具体数据。 +- `total_time`:表示单个step总耗时。 +- `GPU, memory`:分别表示,模型使用/峰值显存,模型+缓存使用/峰值显存。 + +##### tensorboard可视化 +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +浏览器中打开:http://localhost:6006/ + +### 训练后模型测试 + + +#### 有configuration.json + +假定,训练模型路径为:./model_dir,如果改目录下有生成configuration.json,只需要将 [上述模型推理方法](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/README_zh.md#%E6%A8%A1%E5%9E%8B%E6%8E%A8%E7%90%86) 中模型名字修改为模型路径即可 + +例如: + +从shell推理 +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` +从python推理 + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### 无configuration.json时 + +如果模型路径中无configuration.json时,需要手动指定具体配置文件路径与模型路径 + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +参数介绍 +- `config-path`:为实验中保存的 `config.yaml`,可以从实验输出目录中查找。 +- `config-name`:配置文件名,一般为 `config.yaml`,支持yaml格式与json格式,例如 `config.json` +- `init_param`:需要测试的模型参数,一般为`model.pt`,可以自己选择具体的模型文件 +- `tokenizer_conf.token_list`:词表文件路径,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 +- `frontend_conf.cmvn_file`:wav提取fbank中用到的cmvn文件,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 + +其他参数同上,完整 [示例](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) + + + +## 模型导出与测试 +### 从命令行导出 +```shell +funasr-export ++model=paraformer ++quantize=false +``` + +### 从Python导出 +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer") + +res = model.export(quantize=False) +``` + +### 测试ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +更多例子请参考 [样例](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/examples/industrial_data_pretraining/paraformer/demo.py b/examples/industrial_data_pretraining/paraformer/demo.py new file mode 100644 index 0000000..eb7e72f --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/demo.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel( + model="iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", + # spk_model="iic/speech_campplus_sv_zh-cn_16k-common", +) + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + cache={}, +) + +print(res) + + +""" can not use currently +from funasr import AutoFrontend + +frontend = AutoFrontend(model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch") + +fbanks = frontend(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", batch_size=2) + +for batch_idx, fbank_dict in enumerate(fbanks): + res = model.generate(**fbank_dict) + print(res) +""" diff --git a/examples/industrial_data_pretraining/paraformer/export.py b/examples/industrial_data_pretraining/paraformer/export.py new file mode 100644 index 0000000..19512c1 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/export.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# method1, inference from model hub + + +from funasr import AutoModel + +model = AutoModel( + model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", +) + +res = model.export(type="onnx", quantize=False) +print(res) + + +# method2, inference from local path +from funasr import AutoModel + +model = AutoModel( + model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +) + +res = model.export(type="onnx", quantize=False) +print(res) diff --git a/examples/industrial_data_pretraining/paraformer/export.sh b/examples/industrial_data_pretraining/paraformer/export.sh new file mode 100644 index 0000000..0880829 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/export.sh @@ -0,0 +1,24 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub +export HYDRA_FULL_ERROR=1 + + +model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + + + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false + + +# method2, inference from local path +model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false diff --git a/examples/industrial_data_pretraining/paraformer/finetune.sh b/examples/industrial_data_pretraining/paraformer/finetune.sh new file mode 100644 index 0000000..9467a0b --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/finetune.sh @@ -0,0 +1,66 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# model_name from model_hub, or model_dir in local path + +## option 1, download model automatically +model_name_or_model_dir="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + +## option 2, download model by git +#local_path_root=${workspace}/modelscope_models +#mkdir -p ${local_path_root}/${model_name_or_model_dir} +#git clone https://www.modelscope.cn/${model_name_or_model_dir}.git ${local_path_root}/${model_name_or_model_dir} +#model_name_or_model_dir=${local_path_root}/${model_name_or_model_dir} + + +# data dir, which contains: train.json, val.json +data_dir="../../../data/list" + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" + +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${train_data}" + +scp2jsonl \ +++scp_file_list='["../../../data/list/val_wav.scp", "../../../data/list/val_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${val_data}" + + +# exp output dir +output_dir="./outputs" +log_file="${output_dir}/log.txt" + + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--node_rank 0 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} \ No newline at end of file diff --git a/examples/industrial_data_pretraining/paraformer/infer.sh b/examples/industrial_data_pretraining/paraformer/infer.sh new file mode 100644 index 0000000..c389163 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/infer.sh @@ -0,0 +1,20 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub + +# for more input type, please ref to readme.md +input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + +output_dir="./outputs/debug" + +model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + + +device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu" + +python -m funasr.bin.inference \ +++model=${model} \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" \ diff --git a/examples/industrial_data_pretraining/paraformer/infer_from_local.sh b/examples/industrial_data_pretraining/paraformer/infer_from_local.sh new file mode 100644 index 0000000..06c9ca6 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/infer_from_local.sh @@ -0,0 +1,39 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method2, inference from local model + +# for more input type, please ref to readme.md +input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + +output_dir="./outputs/debug" + +workspace=`pwd` + +# download model +local_path_root=${workspace}/modelscope_models +mkdir -p ${local_path_root} +local_path=${local_path_root}/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch +git clone https://www.modelscope.cn/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git ${local_path} + +device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu" + +tokens="${local_path}/tokens.json" +cmvn_file="${local_path}/am.mvn" + +config="config.yaml" +init_param="${local_path}/model.pt" + +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" \ + + + + diff --git a/examples/industrial_data_pretraining/paraformer/train_from_local.sh b/examples/industrial_data_pretraining/paraformer/train_from_local.sh new file mode 100644 index 0000000..b883908 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer/train_from_local.sh @@ -0,0 +1,75 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method2, finetune from local model + +workspace=`pwd` + +echo "current path: ${workspace}" # /xxxx/funasr/examples/industrial_data_pretraining/paraformer + +# download model +local_path_root=${workspace}/modelscope_models +mkdir -p ${local_path_root} +local_path=${local_path_root}/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch +git clone https://www.modelscope.cn/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git ${local_path} + + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# data dir, which contains: train.json, val.json +data_dir="../../../data/list" + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" + + +# generate train.jsonl and val.jsonl from wav.scp and text.txt +python -m funasr.datasets.audio_datasets.scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${train_data}" + +python -m funasr.datasets.audio_datasets.scp2jsonl \ +++scp_file_list='["../../../data/list/val_wav.scp", "../../../data/list/val_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${val_data}" + + +tokens="${local_path}/tokens.json" +cmvn_file="${local_path}/am.mvn" + +# output dir +output_dir="./outputs" +log_file="${output_dir}/log.txt" + +config_name="config.yaml" + +init_param="${local_path}/model.pt" + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +--config-path "${local_path}" \ +--config-name "${config_name}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=10 \ +++train_conf.resume=false \ +++train_conf.validate_interval=15 \ +++train_conf.save_checkpoint_interval=15 \ +++train_conf.keep_nbest_models=50 \ +++optim_conf.lr=0.0002 \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++output_dir="${output_dir}" &> ${log_file} diff --git a/examples/industrial_data_pretraining/paraformer_streaming/README_zh.md b/examples/industrial_data_pretraining/paraformer_streaming/README_zh.md new file mode 100644 index 0000000..b016f9e --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer_streaming/README_zh.md @@ -0,0 +1,436 @@ +(简体中文|[English](./README.md)) + +FunASR开源了大量在工业数据上预训练模型,您可以在 [模型许可协议](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE)下自由使用、复制、修改和分享FunASR模型,下面列举代表性的模型,更多模型请参考 [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo)。 + + + + +## 模型推理 + +### 快速使用 + +命令行方式调用: +```shell +funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav +``` + +python代码调用(推荐) + +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer-zh") + +res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav") +print(res) +``` + +### 接口说明 + +#### AutoModel 定义 +```python +model = AutoModel(model=[str], device=[str], ncpu=[int], output_dir=[str], batch_size=[int], hub=[str], **kwargs) +``` +- `model`(str): [模型仓库](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo) 中的模型名称,或本地磁盘中的模型路径 +- `device`(str): `cuda:0`(默认gpu0),使用 GPU 进行推理,指定。如果为`cpu`,则使用 CPU 进行推理 +- `ncpu`(int): `4` (默认),设置用于 CPU 内部操作并行性的线程数 +- `output_dir`(str): `None` (默认),如果设置,输出结果的输出路径 +- `batch_size`(int): `1` (默认),解码时的批处理,样本个数 +- `hub`(str):`ms`(默认),从modelscope下载模型。如果为`hf`,从huggingface下载模型。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,vad模型中最大切割长度 `max_single_segment_time=6000` (毫秒)。 + +#### AutoModel 推理 +```python +res = model.generate(input=[str], output_dir=[str]) +``` +- `input`: 要解码的输入,可以是: + - wav文件路径, 例如: asr_example.wav + - pcm文件路径, 例如: asr_example.pcm,此时需要指定音频采样率fs(默认为16000) + - 音频字节数流,例如:麦克风的字节数数据 + - wav.scp,kaldi 样式的 wav 列表 (`wav_id \t wav_path`), 例如: + ```text + asr_example1 ./audios/asr_example1.wav + asr_example2 ./audios/asr_example2.wav + ``` + 在这种输入 `wav.scp` 的情况下,必须设置 `output_dir` 以保存输出结果 + - 音频采样点,例如:`audio, rate = soundfile.read("asr_example_zh.wav")`, 数据类型为 numpy.ndarray。支持batch输入,类型为list: + ```[audio_sample1, audio_sample2, ..., audio_sampleN]``` + - fbank输入,支持组batch。shape为[batch, frames, dim],类型为torch.Tensor,例如 +- `output_dir`: None (默认),如果设置,输出结果的输出路径 +- `**kwargs`(dict): 与模型相关的推理参数,例如,`beam_size=10`,`decoding_ctc_weight=0.1`。 + + +### 更多用法介绍 + + +#### 非实时语音识别 +```python +from funasr import AutoModel +# paraformer-zh is a multi-functional asr model +# use vad, punc, spk or not as you need +model = AutoModel(model="paraformer-zh", + vad_model="fsmn-vad", + vad_kwargs={"max_single_segment_time": 60000}, + punc_model="ct-punc", + # spk_model="cam++" + ) +wav_file = f"{model.model_path}/example/asr_example.wav" +res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='魔搭') +print(res) +``` +注意: +- 通常模型输入限制时长30s以下,组合`vad_model`后,支持任意时长音频输入,不局限于paraformer模型,所有音频输入模型均可以。 +- `model`相关的参数可以直接在`AutoModel`定义中直接指定;与`vad_model`相关参数可以通过`vad_kwargs`来指定,类型为dict;类似的有`punc_kwargs`,`spk_kwargs`; +- `max_single_segment_time`: 表示`vad_model`最大切割音频时长, 单位是毫秒ms. +- `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。 +- `batch_size_threshold_s`: 表示`vad_model`切割后音频片段时长超过 `batch_size_threshold_s`阈值时,将batch_size数设置为1, 单位为秒s. + +建议:当您输入为长音频,遇到OOM问题时,因为显存占用与音频时长呈平方关系增加,分为3种情况: +- a)推理起始阶段,显存主要取决于`batch_size_s`,适当减小该值,可以减少显存占用; +- b)推理中间阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,仍然出现OOM,可以适当减小`batch_size_threshold_s`,超过阈值,强制batch为1; +- c)推理快结束阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_s`,且超过阈值`batch_size_threshold_s`,强制batch为1,仍然出现OOM,可以适当减小`max_single_segment_time`,使得VAD切割音频时长变短。 + +#### 实时语音识别 + +```python +from funasr import AutoModel + +chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel(model="paraformer-zh-streaming") + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = chunk_size[1] * 960 # 600ms + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) + print(res) +``` + +注:`chunk_size`为流式延时配置,`[0,10,5]`表示上屏实时出字粒度为`10*60=600ms`,未来信息为`5*60=300ms`。每次推理输入为`600ms`(采样点数为`16000*0.6=960`),输出为对应文字,最后一个语音片段输入需要设置`is_final=True`来强制输出最后一个字。 + +#### 语音端点检测(非实时) +```python +from funasr import AutoModel + +model = AutoModel(model="fsmn-vad") + +wav_file = f"{model.model_path}/example/vad_example.wav" +res = model.generate(input=wav_file) +print(res) +``` +注:VAD模型输出格式为:`[[beg1, end1], [beg2, end2], .., [begN, endN]]`,其中`begN/endN`表示第`N`个有效音频片段的起始点/结束点, +单位为毫秒。 + +#### 语音端点检测(实时) +```python +from funasr import AutoModel + +chunk_size = 200 # ms +model = AutoModel(model="fsmn-vad") + +import soundfile + +wav_file = f"{model.model_path}/example/vad_example.wav" +speech, sample_rate = soundfile.read(wav_file) +chunk_stride = int(chunk_size * sample_rate / 1000) + +cache = {} +total_chunk_num = int(len((speech)-1)/chunk_stride+1) +for i in range(total_chunk_num): + speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) + if len(res[0]["value"]): + print(res) +``` +注:流式VAD模型输出格式为4种情况: +- `[[beg1, end1], [beg2, end2], .., [begN, endN]]`:同上离线VAD输出结果。 +- `[[beg, -1]]`:表示只检测到起始点。 +- `[[-1, end]]`:表示只检测到结束点。 +- `[]`:表示既没有检测到起始点,也没有检测到结束点 +输出结果单位为毫秒,从起始点开始的绝对时间。 + +#### 标点恢复 +```python +from funasr import AutoModel + +model = AutoModel(model="ct-punc") + +res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") +print(res) +``` + +#### 时间戳预测 +```python +from funasr import AutoModel + +model = AutoModel(model="fa-zh") + +wav_file = f"{model.model_path}/example/asr_example.wav" +text_file = f"{model.model_path}/example/text.txt" +res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) +print(res) +``` +更多([示例](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)) + + +## 模型训练与测试 + +### 快速开始 + +命令行执行(用于快速测试,不推荐): +```shell +funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt & +``` + +python代码执行(可以多机多卡,推荐) + +```shell +cd examples/industrial_data_pretraining/paraformer +bash finetune.sh +# "log_file: ./outputs/log.txt" +``` +详细完整的脚本参考 [finetune.sh](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/finetune.sh) + +### 详细参数介绍 + +```shell +funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} +``` + +- `model`(str):模型名字(模型仓库中的ID),此时脚本会自动下载模型到本读;或者本地已经下载好的模型路径。 +- `train_data_set_list`(str):训练数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `valid_data_set_list`(str):验证数据路径,默认为jsonl格式,具体参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +- `dataset_conf.batch_type`(str):`example`(默认),batch的类型。`example`表示按照固定数目batch_size个样本组batch;`length` or `token` 表示动态组batch,batch总长度或者token数为batch_size。 +- `dataset_conf.batch_size`(int):与 `batch_type` 搭配使用,当 `batch_type=example` 时,表示样本个数;当 `batch_type=length` 时,表示样本中长度,单位为fbank帧数(1帧10ms)或者文字token个数。 +- `train_conf.max_epoch`(int):`100`(默认),训练总epoch数。 +- `train_conf.log_interval`(int):`50`(默认),打印日志间隔step数。 +- `train_conf.resume`(int):`True`(默认),是否开启断点重训。 +- `train_conf.validate_interval`(int):`5000`(默认),训练中做验证测试的间隔step数。 +- `train_conf.save_checkpoint_interval`(int):`5000`(默认),训练中模型保存间隔step数。 +- `train_conf.avg_keep_nbest_models_type`(str):`acc`(默认),保留nbest的标准为acc(越大越好)。`loss`表示,保留nbest的标准为loss(越小越好)。 +- `train_conf.keep_nbest_models`(int):`500`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 保留最佳的n个模型,其他删除,节约存储空间。 +- `train_conf.avg_nbest_model`(int):`10`(默认),保留最大多少个模型参数,配合 `avg_keep_nbest_models_type` 按照验证集 acc/loss 对最佳的n个模型平均。 +- `train_conf.accum_grad`(int):`1`(默认),梯度累积功能。 +- `train_conf.grad_clip`(float):`10.0`(默认),梯度截断功能。 +- `train_conf.use_fp16`(bool):`False`(默认),开启fp16训练,加快训练速度。 +- `optim_conf.lr`(float):学习率。 +- `output_dir`(str):模型保存路径。 +- `**kwargs`(dict): 所有在`config.yaml`中参数,均可以直接在此处指定,例如,过滤20s以上长音频:`dataset_conf.max_token_length=2000`,单位为音频fbank帧数(1帧10ms)或者文字token个数。 + +#### 多gpu训练 +##### 单机多gpu训练 +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 1 --nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py ${train_args} +``` +--nnodes 表示参与的节点总数,--nproc_per_node 表示每个节点上运行的进程数 + +##### 多机多gpu训练 + +在主节点上,假设IP为192.168.1.1,端口为12345,使用的是2个GPU,则运行如下命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` +在从节点上(假设IP为192.168.1.2),你需要确保MASTER_ADDR和MASTER_PORT环境变量与主节点设置的一致,并运行同样的命令: +```shell +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \ +../../../funasr/bin/train.py ${train_args} +``` + +--nnodes 表示参与的节点总数,--node_rank 表示当前节点id,--nproc_per_node 表示每个节点上运行的进程数(通常为gpu个数) + +#### 准备数据 + +`jsonl`格式可以参考([例子](https://github.com/alibaba-damo-academy/FunASR/blob/main/data/list))。 +可以用指令 `scp2jsonl` 从wav.scp与text.txt生成。wav.scp与text.txt准备过程如下: + +`train_text.txt` + +左边为数据唯一ID,需与`train_wav.scp`中的`ID`一一对应 +右边为音频文件标注文本,格式如下: + +```bash +ID0012W0013 当客户风险承受能力评估依据发生变化时 +ID0012W0014 所有只要处理 data 不管你是做 machine learning 做 deep learning +ID0012W0015 he tried to think how it could be +``` + + +`train_wav.scp` + +左边为数据唯一ID,需与`train_text.txt`中的`ID`一一对应 +右边为音频文件的路径,格式如下 + +```bash +BAC009S0764W0121 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0764W0121.wav +BAC009S0916W0489 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/BAC009S0916W0489.wav +ID0012W0015 https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cn_en.wav +``` + +`生成指令` + +```shell +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="../../../data/list/train.jsonl" +``` + +(可选,非必需)如果需要从jsonl解析成wav.scp与text.txt,可以使用指令: + +```shell +# generate wav.scp and text.txt from train.jsonl and val.jsonl +jsonl2scp \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in="../../../data/list/train.jsonl" +``` + +#### 查看训练日志 + +##### 查看实验log +```shell +tail log.txt +[2024-03-21 15:55:52,137][root][INFO] - train, rank: 3, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.327), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)], {'data_load': '0.000', 'forward_time': '0.315', 'backward_time': '0.555', 'optim_time': '0.076', 'total_time': '0.947'}, GPU, memory: usage: 3.830 GB, peak: 18.357 GB, cache: 20.910 GB, cache_peak: 20.910 GB +[2024-03-21 15:55:52,139][root][INFO] - train, rank: 1, epoch: 0/50, step: 6990/1, total step: 6990, (loss_avg_rank: 0.334), (loss_avg_epoch: 0.409), (ppl_avg_epoch: 1.506), (acc_avg_epoch: 0.795), (lr: 1.165e-04), [('loss_att', 0.285), ('acc', 0.823), ('loss_pre', 0.046), ('loss', 0.331), ('batch_size', 36)], {'data_load': '0.000', 'forward_time': '0.334', 'backward_time': '0.536', 'optim_time': '0.077', 'total_time': '0.948'}, GPU, memory: usage: 3.943 GB, peak: 18.291 GB, cache: 19.619 GB, cache_peak: 19.619 GB +``` +指标解释: +- `rank`:表示gpu id。 +- `epoch`,`step`,`total step`:表示当前epoch,step,总step。 +- `loss_avg_rank`:表示当前step,所有gpu平均loss。 +- `loss/ppl/acc_avg_epoch`:表示当前epoch周期,截止当前step数时,总平均loss/ppl/acc。epoch结束时的最后一个step表示epoch总平均loss/ppl/acc,推荐使用acc指标。 +- `lr`:当前step的学习率。 +- `[('loss_att', 0.259), ('acc', 0.825), ('loss_pre', 0.04), ('loss', 0.299), ('batch_size', 40)]`:表示当前gpu id的具体数据。 +- `total_time`:表示单个step总耗时。 +- `GPU, memory`:分别表示,模型使用/峰值显存,模型+缓存使用/峰值显存。 + +##### tensorboard可视化 +```bash +tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard +``` +浏览器中打开:http://localhost:6006/ + +### 训练后模型测试 + + +#### 有configuration.json + +假定,训练模型路径为:./model_dir,如果改目录下有生成configuration.json,只需要将 [上述模型推理方法](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/README_zh.md#%E6%A8%A1%E5%9E%8B%E6%8E%A8%E7%90%86) 中模型名字修改为模型路径即可 + +例如: + +从shell推理 +```shell +python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}" +``` +从python推理 + +```python +from funasr import AutoModel + +model = AutoModel(model="./model_dir") + +res = model.generate(input=wav_file) +print(res) +``` + +#### 无configuration.json时 + +如果模型路径中无configuration.json时,需要手动指定具体配置文件路径与模型路径 + +```shell +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++tokenizer_conf.token_list="${tokens}" \ +++frontend_conf.cmvn_file="${cmvn_file}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" +``` + +参数介绍 +- `config-path`:为实验中保存的 `config.yaml`,可以从实验输出目录中查找。 +- `config-name`:配置文件名,一般为 `config.yaml`,支持yaml格式与json格式,例如 `config.json` +- `init_param`:需要测试的模型参数,一般为`model.pt`,可以自己选择具体的模型文件 +- `tokenizer_conf.token_list`:词表文件路径,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 +- `frontend_conf.cmvn_file`:wav提取fbank中用到的cmvn文件,一般在 `config.yaml` 有指定,无需再手动指定,当 `config.yaml` 中路径不正确时,需要在此处手动指定。 + +其他参数同上,完整 [示例](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh) + + + +## 模型导出与测试 +### 从命令行导出 +```shell +funasr-export ++model=paraformer ++quantize=false +``` + +### 从Python导出 +```python +from funasr import AutoModel + +model = AutoModel(model="paraformer") + +res = model.export(quantize=False) +``` + +### 测试ONNX +```python +# pip3 install -U funasr-onnx +from funasr_onnx import Paraformer +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + +result = model(wav_path) +print(result) +``` + +更多例子请参考 [样例](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime) \ No newline at end of file diff --git a/examples/industrial_data_pretraining/paraformer_streaming/demo.py b/examples/industrial_data_pretraining/paraformer_streaming/demo.py new file mode 100644 index 0000000..a1e9882 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer_streaming/demo.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import os + +from funasr import AutoModel + +chunk_size = [0, 10, 5] # [0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 4 # number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 1 # number of encoder chunks to lookback for decoder cross-attention +model = AutoModel(model="iic/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online") + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +res = model.generate( + input=wav_file, + chunk_size=chunk_size, + encoder_chunk_look_back=encoder_chunk_look_back, + decoder_chunk_look_back=decoder_chunk_look_back, +) +print(res) + + +import soundfile + + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) + +chunk_stride = chunk_size[1] * 960 # 600ms、480ms + +cache = {} +total_chunk_num = int(len((speech) - 1) / chunk_stride + 1) +for i in range(total_chunk_num): + speech_chunk = speech[i * chunk_stride : (i + 1) * chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate( + input=speech_chunk, + cache=cache, + is_final=is_final, + chunk_size=chunk_size, + encoder_chunk_look_back=encoder_chunk_look_back, + decoder_chunk_look_back=decoder_chunk_look_back, + ) + print(res) diff --git a/examples/industrial_data_pretraining/paraformer_streaming/demo.sh b/examples/industrial_data_pretraining/paraformer_streaming/demo.sh new file mode 100644 index 0000000..a025345 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer_streaming/demo.sh @@ -0,0 +1,10 @@ + +model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online" + + +python funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ + diff --git a/examples/industrial_data_pretraining/paraformer_streaming/export.py b/examples/industrial_data_pretraining/paraformer_streaming/export.py new file mode 100644 index 0000000..588fd08 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer_streaming/export.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# method1, inference from model hub + + +from funasr import AutoModel + +model = AutoModel( + model="iic/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online", +) + +res = model.export(type="onnx", quantize=False) +print(res) + + +# method2, inference from local path +from funasr import AutoModel + + +model = AutoModel( + model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online" +) + +res = model.export(type="onnx", quantize=False) +print(res) diff --git a/examples/industrial_data_pretraining/paraformer_streaming/export.sh b/examples/industrial_data_pretraining/paraformer_streaming/export.sh new file mode 100644 index 0000000..cf3e7f4 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer_streaming/export.sh @@ -0,0 +1,27 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# method1, inference from model hub +export HYDRA_FULL_ERROR=1 + + +model="iic/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online" + + + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false \ +++device="cpu" + + +# method2, inference from local path +model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online" + +python -m funasr.bin.export \ +++model=${model} \ +++type="onnx" \ +++quantize=false \ +++device="cpu" \ +++debug=false diff --git a/examples/industrial_data_pretraining/paraformer_streaming/finetune.sh b/examples/industrial_data_pretraining/paraformer_streaming/finetune.sh new file mode 100644 index 0000000..54bc2d1 --- /dev/null +++ b/examples/industrial_data_pretraining/paraformer_streaming/finetune.sh @@ -0,0 +1,65 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# model_name from model_hub, or model_dir in local path + +## option 1, download model automatically +model_name_or_model_dir="iic/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online" + + +## option 2, download model by git +#local_path_root=${workspace}/modelscope_models +#mkdir -p ${local_path_root}/${model_name_or_model_dir} +#git clone https://www.modelscope.cn/${model_name_or_model_dir}.git ${local_path_root}/${model_name_or_model_dir} +#model_name_or_model_dir=${local_path_root}/${model_name_or_model_dir} + + +# data dir, which contains: train.json, val.json +data_dir="../../../data/list" + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" + +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${train_data}" + +scp2jsonl \ +++scp_file_list='["../../../data/list/val_wav.scp", "../../../data/list/val_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${val_data}" + + +# exp output dir +output_dir="./outputs" +log_file="${output_dir}/log.txt" + + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} \ No newline at end of file diff --git a/examples/industrial_data_pretraining/qwen_audio/demo.py b/examples/industrial_data_pretraining/qwen_audio/demo.py new file mode 100644 index 0000000..04a8e58 --- /dev/null +++ b/examples/industrial_data_pretraining/qwen_audio/demo.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U "funasr[llm]" + +from funasr import AutoModel + +model = AutoModel(model="Qwen-Audio") + +audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac" +prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>" + +res = model.generate(input=audio_in, prompt=prompt) +print(res) diff --git a/examples/industrial_data_pretraining/qwen_audio/demo_chat.py b/examples/industrial_data_pretraining/qwen_audio/demo_chat.py new file mode 100644 index 0000000..6a69fa1 --- /dev/null +++ b/examples/industrial_data_pretraining/qwen_audio/demo_chat.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U "funasr[llm]" + +from funasr import AutoModel + +model = AutoModel(model="Qwen-Audio-Chat") + +audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac" + +# 1st dialogue turn +prompt = "what does the person say?" +cache = {"history": None} +res = model.generate(input=audio_in, prompt=prompt, cache=cache) +print(res) + + +# 2nd dialogue turn +prompt = 'Find the start time and end time of the word "middle classes"' +res = model.generate(input=None, prompt=prompt, cache=cache) +print(res) diff --git a/examples/industrial_data_pretraining/qwen_audio/demo_chat_from_local.py b/examples/industrial_data_pretraining/qwen_audio/demo_chat_from_local.py new file mode 100644 index 0000000..99d4caf --- /dev/null +++ b/examples/industrial_data_pretraining/qwen_audio/demo_chat_from_local.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U "funasr[llm]" + +from funasr import AutoModel + +model = AutoModel( + model="Qwen-Audio-Chat", + model_path="/nfs/zhifu.gzf/init_model/qwen/Qwen-Audio-Chat", +) + +audio_in = ( + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" +) + +# 1st dialogue turn +prompt = "what does the person say?" +cache = {"history": None} +res = model.generate(input=audio_in, prompt=prompt, cache=cache) +print(res) + + +# 2nd dialogue turn +prompt = 'Find the start time and end time of the word "middle classes"' +res = model.generate(input=None, prompt=prompt, cache=cache) +print(res) diff --git a/examples/industrial_data_pretraining/qwen_audio/demo_from_local.py b/examples/industrial_data_pretraining/qwen_audio/demo_from_local.py new file mode 100644 index 0000000..5ade205 --- /dev/null +++ b/examples/industrial_data_pretraining/qwen_audio/demo_from_local.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U "funasr[llm]" + +from funasr import AutoModel + +model = AutoModel( + model="Qwen-Audio", + model_path="/nfs/zhifu.gzf/init_model/qwen/Qwen-Audio", +) + +audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac" +prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>" + +res = model.generate(input=audio_in, prompt=prompt) +print(res) diff --git a/examples/industrial_data_pretraining/scama/demo.py b/examples/industrial_data_pretraining/scama/demo.py new file mode 100644 index 0000000..00d85ae --- /dev/null +++ b/examples/industrial_data_pretraining/scama/demo.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +chunk_size = [5, 10, 5] # [0, 10, 5] 600ms, [0, 8, 4] 480ms +encoder_chunk_look_back = 0 # number of chunks to lookback for encoder self-attention +decoder_chunk_look_back = 0 # number of encoder chunks to lookback for decoder cross-attention + +model = AutoModel( + model="/Users/zhifu/Downloads/modelscope_models/speech_SCAMA_asr-zh-cn-16k-common-vocab8358-streaming" +) +cache = {} +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + chunk_size=chunk_size, + encoder_chunk_look_back=encoder_chunk_look_back, + decoder_chunk_look_back=decoder_chunk_look_back, +) +print(res) + + +import soundfile +import os + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) + +chunk_stride = chunk_size[1] * 960 # 600ms、480ms + +cache = {} +total_chunk_num = int(len((speech) - 1) / chunk_stride + 1) +for i in range(total_chunk_num): + speech_chunk = speech[i * chunk_stride : (i + 1) * chunk_stride] + is_final = i == total_chunk_num - 1 + res = model.generate( + input=speech_chunk, + cache=cache, + is_final=is_final, + chunk_size=chunk_size, + encoder_chunk_look_back=encoder_chunk_look_back, + decoder_chunk_look_back=decoder_chunk_look_back, + ) + print(res) diff --git a/examples/industrial_data_pretraining/scama/demo.sh b/examples/industrial_data_pretraining/scama/demo.sh new file mode 100644 index 0000000..a025345 --- /dev/null +++ b/examples/industrial_data_pretraining/scama/demo.sh @@ -0,0 +1,10 @@ + +model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online" + + +python funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ + diff --git a/examples/industrial_data_pretraining/seaco_paraformer/demo.py b/examples/industrial_data_pretraining/seaco_paraformer/demo.py new file mode 100644 index 0000000..a88e880 --- /dev/null +++ b/examples/industrial_data_pretraining/seaco_paraformer/demo.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel( + model="iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + # vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + # punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", + # spk_model="iic/speech_campplus_sv_zh-cn_16k-common", +) + + +# example1 +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + hotword="达摩院 魔搭", + # return_raw_text=True, # return raw text recognition results splited by space of equal length with timestamp + # preset_spk_num=2, # preset speaker num for speaker cluster model + # sentence_timestamp=True, # return sentence level information when spk_model is not given +) +print(res) + + +""" +# tensor or numpy as input +# example2 +import torchaudio +import os +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +input_tensor, sample_rate = torchaudio.load(wav_file) +input_tensor = input_tensor.mean(0) +res = model.generate(input=[input_tensor], batch_size_s=300, is_final=True) + + +# example3 +import soundfile + +wav_file = os.path.join(model.model_path, "example/asr_example.wav") +speech, sample_rate = soundfile.read(wav_file) +res = model.generate(input=[speech], batch_size_s=300, is_final=True) +""" diff --git a/examples/industrial_data_pretraining/seaco_paraformer/demo.sh b/examples/industrial_data_pretraining/seaco_paraformer/demo.sh new file mode 100644 index 0000000..e9efc4b --- /dev/null +++ b/examples/industrial_data_pretraining/seaco_paraformer/demo.sh @@ -0,0 +1,18 @@ + +model="iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + +vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch" +vad_model_revision="master" +punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" +punc_model_revision="master" + +python funasr/bin/inference.py \ ++model=${model} \ ++vad_model=${vad_model} \ ++vad_model_revision=${vad_model_revision} \ ++punc_model=${punc_model} \ ++punc_model_revision=${punc_model_revision} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ ++"hotword='达摩院 魔搭'" diff --git a/examples/industrial_data_pretraining/seaco_paraformer/finetune.sh b/examples/industrial_data_pretraining/seaco_paraformer/finetune.sh new file mode 100644 index 0000000..0221bb2 --- /dev/null +++ b/examples/industrial_data_pretraining/seaco_paraformer/finetune.sh @@ -0,0 +1,65 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0,1" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# model_name from model_hub, or model_dir in local path + +## option 1, download model automatically +model_name_or_model_dir="iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + +## option 2, download model by git +#local_path_root=${workspace}/modelscope_models +#mkdir -p ${local_path_root}/${model_name_or_model_dir} +#git clone https://www.modelscope.cn/${model_name_or_model_dir}.git ${local_path_root}/${model_name_or_model_dir} +#model_name_or_model_dir=${local_path_root}/${model_name_or_model_dir} + + +# data dir, which contains: train.json, val.json +data_dir="../../../data/list" + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" + +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${train_data}" + +scp2jsonl \ +++scp_file_list='["../../../data/list/val_wav.scp", "../../../data/list/val_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${val_data}" + + +# exp output dir +output_dir="./outputs" +log_file="${output_dir}/log.txt" + + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +torchrun \ +--nnodes 1 \ +--nproc_per_node ${gpu_num} \ +../../../funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=20000 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=4 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.avg_keep_nbest_models_type='loss' \ +++train_conf.keep_nbest_models=20 \ +++optim_conf.lr=0.0002 \ +++output_dir="${output_dir}" &> ${log_file} \ No newline at end of file diff --git a/examples/industrial_data_pretraining/sense_voice/demo.py b/examples/industrial_data_pretraining/sense_voice/demo.py new file mode 100644 index 0000000..5303999 --- /dev/null +++ b/examples/industrial_data_pretraining/sense_voice/demo.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel( + model="/Users/zhifu/Downloads/modelscope_models/SenseVoiceModelscope", + # vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + # vad_kwargs={"max_single_segment_time": 30000}, +) + + +input_wav = ( + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" +) + +DecodingOptions = { + "task": ("ASR", "AED", "SER"), + "language": "auto", + "fp16": True, + "gain_event": True, + "beam_size": 5, +} + +res = model.generate(input=input_wav, batch_size_s=0, DecodingOptions=DecodingOptions) +print(res) diff --git a/examples/industrial_data_pretraining/sense_voice/demo_fsmn.py b/examples/industrial_data_pretraining/sense_voice/demo_fsmn.py new file mode 100644 index 0000000..ce4bdf8 --- /dev/null +++ b/examples/industrial_data_pretraining/sense_voice/demo_fsmn.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +model = AutoModel( + model="/Users/zhifu/Downloads/modelscope_models/SenseVoiceModelscopeFSMN", + vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + vad_kwargs={"max_single_segment_time": 30000}, +) + + +input_wav = ( + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" +) + +DecodingOptions = { + "task": ("ASR", "AED", "SER"), + "language": "auto", + "fp16": True, + "gain_event": True, + "beam_size": 5, +} + +res = model.generate(input=input_wav, batch_size_s=0, DecodingOptions=DecodingOptions, beam_size=5) +print(res) diff --git a/examples/industrial_data_pretraining/sense_voice/finetune.sh b/examples/industrial_data_pretraining/sense_voice/finetune.sh new file mode 100644 index 0000000..cb07901 --- /dev/null +++ b/examples/industrial_data_pretraining/sense_voice/finetune.sh @@ -0,0 +1,69 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + + +# which gpu to train or finetune +export CUDA_VISIBLE_DEVICES="0" +gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') + +# model_name from model_hub, or model_dir in local path + +## option 1, download model automatically +model_name_or_model_dir="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model_name_or_model_dir="/Users/zhifu/Downloads/modelscope_models/SenseVoiceModelscope" +## option 2, download model by git +#local_path_root=${workspace}/modelscope_models +#mkdir -p ${local_path_root}/${model_name_or_model_dir} +#git clone https://www.modelscope.cn/${model_name_or_model_dir}.git ${local_path_root}/${model_name_or_model_dir} +#model_name_or_model_dir=${local_path_root}/${model_name_or_model_dir} + + +# data dir, which contains: train.json, val.json +data_dir="../../../data/list" + +train_data="${data_dir}/train.jsonl" +val_data="${data_dir}/val.jsonl" + +# generate train.jsonl and val.jsonl from wav.scp and text.txt +scp2jsonl \ +++scp_file_list='["../../../data/list/train_wav.scp", "../../../data/list/train_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${train_data}" + +scp2jsonl \ +++scp_file_list='["../../../data/list/val_wav.scp", "../../../data/list/val_text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out="${val_data}" + + +# exp output dir +output_dir="./outputs" +log_file="${output_dir}/log.txt" + + +mkdir -p ${output_dir} +echo "log_file: ${log_file}" + +#torchrun \ +#--nnodes 1 \ +#--node_rank 0 \ +#--nproc_per_node ${gpu_num} \ +python \ +../../../funasr/bin/train.py \ +++model="${model_name_or_model_dir}" \ +++train_data_set_list="${train_data}" \ +++valid_data_set_list="${val_data}" \ +++dataset_conf.batch_size=500 \ +++dataset_conf.batch_type="token" \ +++dataset_conf.num_workers=0 \ +++train_conf.max_epoch=50 \ +++train_conf.log_interval=1 \ +++train_conf.resume=false \ +++train_conf.validate_interval=2000 \ +++train_conf.save_checkpoint_interval=2000 \ +++train_conf.keep_nbest_models=20 \ +++train_conf.avg_nbest_model=10 \ +++optim_conf.lr=0.0002 \ +++debug=true \ +++device="cpu" \ +++output_dir="${output_dir}" #&> ${log_file} \ No newline at end of file diff --git a/examples/industrial_data_pretraining/transducer/demo.py b/examples/industrial_data_pretraining/transducer/demo.py new file mode 100644 index 0000000..0b3d638 --- /dev/null +++ b/examples/industrial_data_pretraining/transducer/demo.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + +# Transducer, BAT and RWKV_BAT models are just same to use, use the correct model_revision +# https://modelscope.cn/models?name=transducer&page=1&tasks=auto-speech-recognition&type=audio +model = AutoModel( + model="iic/speech_bat_asr-zh-cn-16k-aishell1-vocab4234-pytorch", +) + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" +) +print(res) diff --git a/examples/industrial_data_pretraining/uniasr/demo.py b/examples/industrial_data_pretraining/uniasr/demo.py new file mode 100644 index 0000000..d3741b8 --- /dev/null +++ b/examples/industrial_data_pretraining/uniasr/demo.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from funasr import AutoModel + + +model = AutoModel( + model="iic/speech_UniASR-large_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-offline", +) + + +res = model.generate( + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" +) +print(res) + + +""" can not use currently +from funasr import AutoFrontend + +frontend = AutoFrontend(model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch") + +fbanks = frontend(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", batch_size=2) + +for batch_idx, fbank_dict in enumerate(fbanks): + res = model.generate(**fbank_dict) + print(res) +""" diff --git a/examples/industrial_data_pretraining/uniasr/demo.sh b/examples/industrial_data_pretraining/uniasr/demo.sh new file mode 100644 index 0000000..f191ce6 --- /dev/null +++ b/examples/industrial_data_pretraining/uniasr/demo.sh @@ -0,0 +1,10 @@ + +model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + + +python funasr/bin/inference.py \ ++model=${model} \ ++input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" \ ++output_dir="./outputs/debug" \ ++device="cpu" \ + diff --git a/examples/industrial_data_pretraining/whisper/demo.py b/examples/industrial_data_pretraining/whisper/demo.py new file mode 100644 index 0000000..e9c2a83 --- /dev/null +++ b/examples/industrial_data_pretraining/whisper/demo.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U openai-whisper + +from funasr import AutoModel + +model = AutoModel( + model="iic/Whisper-large-v3", + vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + vad_kwargs={"max_single_segment_time": 30000}, +) + +DecodingOptions = { + "task": "transcribe", + "language": None, + "beam_size": None, + "fp16": True, + "without_timestamps": False, + "prompt": None, +} +res = model.generate( + DecodingOptions=DecodingOptions, + batch_size_s=0, + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", +) + +print(res) diff --git a/examples/industrial_data_pretraining/whisper/demo_from_openai.py b/examples/industrial_data_pretraining/whisper/demo_from_openai.py new file mode 100644 index 0000000..097e942 --- /dev/null +++ b/examples/industrial_data_pretraining/whisper/demo_from_openai.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U openai-whisper + +from funasr import AutoModel + +# model = AutoModel(model="Whisper-small", hub="openai") +# model = AutoModel(model="Whisper-medium", hub="openai") +# model = AutoModel(model="Whisper-large-v2", hub="openai") +model = AutoModel( + model="Whisper-large-v3", + vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + vad_kwargs={"max_single_segment_time": 30000}, + hub="openai", +) + +DecodingOptions = { + "task": "transcribe", + "language": None, + "beam_size": None, + "fp16": True, + "without_timestamps": False, + "prompt": None, +} +res = model.generate( + DecodingOptions=DecodingOptions, + batch_size_s=0, + input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", +) + +print(res) diff --git a/examples/industrial_data_pretraining/whisper/infer.sh b/examples/industrial_data_pretraining/whisper/infer.sh new file mode 100644 index 0000000..71811e2 --- /dev/null +++ b/examples/industrial_data_pretraining/whisper/infer.sh @@ -0,0 +1,22 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U openai-whisper + +# method1, inference from model hub + +# for more input type, please ref to readme.md +input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + +output_dir="./outputs/debug" + +model="iic/speech_whisper-large_asr_multilingual" + + +device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu" + +python -m funasr.bin.inference \ +++model=${model} \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" \ diff --git a/examples/industrial_data_pretraining/whisper/infer_from_local.sh b/examples/industrial_data_pretraining/whisper/infer_from_local.sh new file mode 100644 index 0000000..4e12a3b --- /dev/null +++ b/examples/industrial_data_pretraining/whisper/infer_from_local.sh @@ -0,0 +1,42 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U openai-whisper + +# method2, inference from local model + +# for more input type, please ref to readme.md +input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + +output_dir="./outputs/debug" + +workspace=`pwd` + +# download model +local_path_root=${workspace}/modelscope_models +mkdir -p ${local_path_root} +#Whisper-large-v2 +#local_path=${local_path_root}/speech_whisper-large_asr_multilingual +#git clone https://www.modelscope.cn/iic/speech_whisper-large_asr_multilingual.git ${local_path} +#init_param="${local_path}/large-v2.pt" +#Whisper-large-v3 +local_path=${local_path_root}/Whisper-large-v3 +git clone https://www.modelscope.cn/iic/Whisper-large-v3.git ${local_path} +init_param="${local_path}/large-v3.pt" + +device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu" + +config="config.yaml" + + +python -m funasr.bin.inference \ +--config-path "${local_path}" \ +--config-name "${config}" \ +++init_param="${init_param}" \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" \ + + + + diff --git a/examples/industrial_data_pretraining/whisper/infer_from_openai.sh b/examples/industrial_data_pretraining/whisper/infer_from_openai.sh new file mode 100644 index 0000000..7ce92e8 --- /dev/null +++ b/examples/industrial_data_pretraining/whisper/infer_from_openai.sh @@ -0,0 +1,26 @@ +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +# To install requirements: pip3 install -U openai-whisper + +# method1, inference from model hub + +# for more input type, please ref to readme.md +input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + +output_dir="./outputs/debug" + +#model="Whisper-small" +#model="Whisper-medium" +model="Whisper-large-v2" +#model="Whisper-large-v3" +hub="openai" + +device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu" + +python -m funasr.bin.inference \ +++model=${model} \ +++hub=${hub} \ +++input="${input}" \ +++output_dir="${output_dir}" \ +++device="${device}" \ diff --git a/fun_text_processing/README.md b/fun_text_processing/README.md new file mode 100644 index 0000000..9947fa4 --- /dev/null +++ b/fun_text_processing/README.md @@ -0,0 +1,32 @@ +**Fundamental Text Processing (FunTextProcessing)** +========================== + +### Introduction + +FunTextProcessing is a Python toolkit for fundamental text processing in ASR including text processing , inverse text processing, num2words, which is included in the `FunASR`. + +### Highlights + +- FunTextProcessing supports inverse text processing (ITN), text processing (TN), number to words (num2words). +- FunTextProcessing supports multilingual, 10+ languages for ITN, 5 languages for TN, 50+ languages for num2words. + + +### Example +#### Inverse Text Processing (ITN) +Given text inputs, such as speech recognition results, use `fun_text_processing/inverse_text_normalization/inverse_normalize.py` to output ITN results. You may refer to the following example scripts. + +``` +test_file=fun_text_processing/inverse_text_normalization/id/id_itn_test_input.txt + +python fun_text_processing/inverse_text_normalization/inverse_normalize.py --input_file $test_file --cache_dir ./itn_model/ --output_file output.txt --language=id +``` + + +### Acknowledge +1. We borrowed a lot of codes from [NeMo](https://github.com/NVIDIA/NeMo). +2. We refered the codes from [WeTextProcessing](https://github.com/wenet-e2e/WeTextProcessing) for Chinese inverse text normalization. +3. We borrowed a lot of codes from [num2words](https://pypi.org/project/num2words/) library for convert the number to words function in some languages. + +### License + +This project is licensed under the [The MIT License](https://opensource.org/licenses/MIT). FunTextProcessing also contains various third-party components and some code modified from other repos under other open source licenses. diff --git a/fun_text_processing/__init__.py b/fun_text_processing/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/install_pynini.sh b/fun_text_processing/install_pynini.sh new file mode 100644 index 0000000..8da8c15 --- /dev/null +++ b/fun_text_processing/install_pynini.sh @@ -0,0 +1,6 @@ +#!/bin/bash +if [[ $OSTYPE == 'darwin'* ]]; then + conda install -c conda-forge -y pynini=2.1.5 +else + pip install pynini==2.1.5 +fi \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/__init__.py b/fun_text_processing/inverse_text_normalization/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/de/__init__.py b/fun_text_processing/inverse_text_normalization/de/__init__.py new file mode 100644 index 0000000..4f73ff2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/de/taggers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/de/taggers/cardinal.py new file mode 100644 index 0000000..1aadad8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/cardinal.py @@ -0,0 +1,65 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, GraphFst +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals. Numbers below ten are not converted. + Allows both compound numeral strings or separated by whitespace. + "und" (en: "and") can be inserted between "hundert" and following number or "tausend" and following single or double digit number. + + e.g. minus drei und zwanzig -> cardinal { negative: "-" integer: "23" } } + e.g. minus dreiundzwanzig -> cardinal { integer: "23" } } + e.g. dreizehn -> cardinal { integer: "13" } } + e.g. ein hundert -> cardinal { integer: "100" } } + e.g. einhundert -> cardinal { integer: "100" } } + e.g. ein tausend -> cardinal { integer: "1000" } } + e.g. eintausend -> cardinal { integer: "1000" } } + e.g. ein tausend zwanzig -> cardinal { integer: "1020" } } + + Args: + tn_cardinal_tagger: TN cardinal tagger + """ + + def __init__(self, tn_cardinal_tagger: GraphFst, deterministic: bool = True): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + + # add_space_between_chars = pynini.cdrewrite(pynini.closure(insert_space, 0, 1), DAMO_CHAR, DAMO_CHAR, DAMO_SIGMA) + optional_delete_space = pynini.closure(DAMO_SIGMA | pynutil.delete(" ")) + + graph = (tn_cardinal_tagger.graph @ optional_delete_space).invert().optimize() + self.graph_hundred_component_at_least_one_none_zero_digit = ( + ( + tn_cardinal_tagger.graph_hundred_component_at_least_one_none_zero_digit + @ optional_delete_space + ) + .invert() + .optimize() + ) + + self.graph_ties = ( + (tn_cardinal_tagger.two_digit_non_zero @ optional_delete_space).invert().optimize() + ) + # this is to make sure if there is an ambiguity with decimal, decimal is chosen, e.g. 1000000 vs. 1 million + graph = pynutil.add_weight(graph, weight=0.001) + self.graph_no_exception = graph + self.digit = ( + pynini.arcmap(tn_cardinal_tagger.digit, map_type="rmweight").invert().optimize() + ) + graph_exception = pynini.project(self.digit, "input") + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + self.optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus ", '"-" '), 0, 1 + ) + + final_graph = ( + self.optional_minus_graph + + pynutil.insert('integer: "') + + self.graph + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/date.py b/fun_text_processing/inverse_text_normalization/de/taggers/date.py new file mode 100644 index 0000000..31aa614 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/date.py @@ -0,0 +1,84 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + convert_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, in the form of (day) month (year) or year + e.g. vierundzwanzigster juli zwei tausend dreizehn -> tokens { name: "24. Jul. 2013" } + e.g. neunzehnachtzig -> tokens { name: "1980" } + e.g. vierzehnter januar -> tokens { name: "14. Jan." } + e.g. zweiter dritter -> tokens { name: "02.03." } + e.g. januar neunzehnachtzig -> tokens { name: "Jan. 1980" } + e.g. zwanzigzwanzig -> tokens { name: "2020" } + + Args: + itn_cardinal_tagger: ITN cardinal tagger + tn_date_tagger: TN date tagger + tn_date_verbalizer: TN date verbalizer + """ + + def __init__( + self, + itn_cardinal_tagger: GraphFst, + tn_date_tagger: GraphFst, + tn_date_verbalizer: GraphFst, + deterministic: bool = True, + ): + super().__init__(name="date", kind="classify", deterministic=deterministic) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + optional_delete_space = pynini.closure(DAMO_SIGMA | pynutil.delete(" ", weight=0.0001)) + tagger = tn_date_verbalizer.graph.invert().optimize() + + delete_day_marker = ( + pynutil.delete('day: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) @ itn_cardinal_tagger.graph_no_exception + + month_as_number = ( + pynutil.delete('month: "') + + itn_cardinal_tagger.graph_no_exception + + pynutil.delete('"') + ) + month_as_string = ( + pynutil.delete('month: "') + tn_date_tagger.month_abbr.invert() + pynutil.delete('"') + ) + + convert_year = (tn_date_tagger.year @ optional_delete_space).invert().optimize() + delete_year_marker = ( + pynutil.delete('year: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) @ convert_year + + # day. month as string (year) + verbalizer = ( + pynini.closure(delete_day_marker + pynutil.insert(".") + pynini.accep(" "), 0, 1) + + month_as_string + + pynini.closure(pynini.accep(" ") + delete_year_marker, 0, 1) + ) + + # day. month as number (year) + verbalizer |= ( + delete_day_marker @ add_leading_zero_to_double_digit + + pynutil.insert(".") + + pynutil.delete(" ") + + month_as_number @ add_leading_zero_to_double_digit + + pynutil.insert(".") + + pynini.closure(pynutil.delete(" ") + delete_year_marker, 0, 1) + ) + + # year + verbalizer |= delete_year_marker + + final_graph = tagger @ verbalizer + + graph = pynutil.insert('name: "') + convert_space(final_graph) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/de/taggers/decimal.py new file mode 100644 index 0000000..e2dba5a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/decimal.py @@ -0,0 +1,52 @@ +import pynini +from fun_text_processing.text_normalization.de.taggers.decimal import get_quantity, quantities +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, GraphFst +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. minus elf komma zwei null null sechs billionen -> decimal { negative: "true" integer_part: "11" fractional_part: "2006" quantity: "billionen" } + e.g. eine billion -> decimal { integer_part: "1" quantity: "billion" } + Args: + itn_cardinal_tagger: ITN Cardinal tagger + tn_decimal_tagger: TN decimal tagger + """ + + def __init__( + self, itn_cardinal_tagger: GraphFst, tn_decimal_tagger: GraphFst, deterministic: bool = True + ): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + + self.graph = tn_decimal_tagger.graph.invert().optimize() + + delete_point = pynutil.delete(" komma") + + allow_spelling = pynini.cdrewrite( + pynini.cross("eine ", "eins ") + quantities, "[BOS]", "[EOS]", DAMO_SIGMA + ) + + graph_fractional = pynutil.insert('fractional_part: "') + self.graph + pynutil.insert('"') + graph_integer = ( + pynutil.insert('integer_part: "') + + itn_cardinal_tagger.graph_no_exception + + pynutil.insert('"') + ) + final_graph_wo_sign = graph_integer + delete_point + pynini.accep(" ") + graph_fractional + + self.final_graph_wo_negative = ( + allow_spelling + @ ( + final_graph_wo_sign + | get_quantity( + final_graph_wo_sign, + itn_cardinal_tagger.graph_hundred_component_at_least_one_none_zero_digit, + ) + ).optimize() + ) + + final_graph = itn_cardinal_tagger.optional_minus_graph + self.final_graph_wo_negative + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/de/taggers/electronic.py new file mode 100644 index 0000000..823188a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/electronic.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: email addresses, etc. + e.g. c d f eins at a b c punkt e d u -> tokens { name: "cdf1.abc.edu" } + + Args: + tn_electronic_tagger: TN eletronic tagger + tn_electronic_verbalizer: TN eletronic verbalizer + """ + + def __init__( + self, + tn_electronic_tagger: GraphFst, + tn_electronic_verbalizer: GraphFst, + deterministic: bool = True, + ): + super().__init__(name="electronic", kind="classify", deterministic=deterministic) + + tagger = pynini.invert(tn_electronic_verbalizer.graph).optimize() + verbalizer = pynini.invert(tn_electronic_tagger.graph).optimize() + final_graph = tagger @ verbalizer + + graph = pynutil.insert('name: "') + final_graph + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/de/taggers/fraction.py new file mode 100644 index 0000000..dd307ba --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/fraction.py @@ -0,0 +1,66 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + convert_space, + delete_space, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + e.g. ein halb -> tokens { name: "1/2" } + e.g. ein ein halb -> tokens { name: "1 1/2" } + e.g. drei zwei ein hundertstel -> tokens { name: "3 2/100" } + + Args: + itn_cardinal_tagger: ITN cardinal tagger + tn_fraction_verbalizer: TN fraction verbalizer + """ + + def __init__( + self, + itn_cardinal_tagger: GraphFst, + tn_fraction_verbalizer: GraphFst, + deterministic: bool = True, + ): + super().__init__(name="fraction", kind="classify", deterministic=deterministic) + tagger = tn_fraction_verbalizer.graph.invert().optimize() + + delete_optional_sign = pynini.closure( + pynutil.delete("negative: ") + pynini.cross('"true" ', "-"), 0, 1 + ) + delete_integer_marker = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) @ itn_cardinal_tagger.graph_no_exception + + delete_numerator_marker = ( + pynutil.delete('numerator: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) @ itn_cardinal_tagger.graph_no_exception + + delete_denominator_marker = ( + pynutil.insert("/") + + ( + pynutil.delete('denominator: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + @ itn_cardinal_tagger.graph_no_exception + ) + + graph = ( + pynini.closure(delete_integer_marker + pynini.accep(" "), 0, 1) + + delete_numerator_marker + + delete_space + + delete_denominator_marker + ).optimize() + verbalizer = delete_optional_sign + graph + + self.graph = tagger @ verbalizer + + graph = pynutil.insert('name: "') + convert_space(self.graph) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/measure.py b/fun_text_processing/inverse_text_normalization/de/taggers/measure.py new file mode 100644 index 0000000..cd3c557 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/measure.py @@ -0,0 +1,98 @@ +import pynini +from fun_text_processing.text_normalization.de.taggers.measure import ( + singular_to_plural, + unit_singular, +) +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure. Allows for plural form for unit. + e.g. minus elf kilogramm -> measure { cardinal { negative: "true" integer: "11" } units: "kg" } + e.g. drei stunden -> measure { cardinal { integer: "3" } units: "h" } + e.g. ein halb kilogramm -> measure { decimal { integer_part: "1/2" } units: "kg" } + e.g. eins komma zwei kilogramm -> measure { decimal { integer_part: "1" fractional_part: "2" } units: "kg" } + + Args: + itn_cardinal_tagger: ITN Cardinal tagger + itn_decimal_tagger: ITN Decimal tagger + itn_fraction_tagger: ITN Fraction tagger + """ + + def __init__( + self, + itn_cardinal_tagger: GraphFst, + itn_decimal_tagger: GraphFst, + itn_fraction_tagger: GraphFst, + deterministic: bool = True, + ): + super().__init__(name="measure", kind="classify", deterministic=deterministic) + + cardinal_graph = ( + pynini.cdrewrite( + pynini.cross(pynini.union("ein", "eine"), "eins"), "[BOS]", "[EOS]", DAMO_SIGMA + ) + @ itn_cardinal_tagger.graph_no_exception + ) + + graph_unit_singular = pynini.invert(unit_singular) # singular -> abbr + unit = ( + pynini.invert(singular_to_plural()) @ graph_unit_singular + ) | graph_unit_singular # plural -> abbr + unit = convert_space(unit) + graph_unit_singular = convert_space(graph_unit_singular) + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_misc = pynutil.insert("/") + pynutil.delete("pro") + delete_space + graph_unit_singular + + unit = ( + pynutil.insert('units: "') + + (unit | unit_misc | pynutil.add_weight(unit + delete_space + unit_misc, 0.01)) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + itn_decimal_tagger.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit + ) + + subgraph_fraction = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + pynutil.insert('integer_part: "') + + itn_fraction_tagger.graph + + pynutil.insert('" }') + + delete_extra_space + + unit + ) + + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + cardinal_graph + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit + ) + final_graph = subgraph_cardinal | subgraph_decimal | subgraph_fraction + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/money.py b/fun_text_processing/inverse_text_normalization/de/taggers/money.py new file mode 100644 index 0000000..041adc1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/money.py @@ -0,0 +1,90 @@ +import pynini +from fun_text_processing.text_normalization.de.taggers.money import ( + maj_singular, + min_plural, + min_singular, +) +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. elf euro und vier cent -> money { integer_part: "11" fractional_part: 04 currency: "€" } + + Args: + itn_cardinal_tagger: ITN Cardinal Tagger + itn_decimal_tagger: ITN Decimal Tagger + """ + + def __init__( + self, + itn_cardinal_tagger: GraphFst, + itn_decimal_tagger: GraphFst, + deterministic: bool = True, + ): + super().__init__(name="money", kind="classify", deterministic=deterministic) + cardinal_graph = ( + pynini.cdrewrite( + pynini.cross(pynini.union("ein", "eine"), "eins"), "[BOS]", "[EOS]", DAMO_SIGMA + ) + @ itn_cardinal_tagger.graph_no_exception + ) + graph_decimal_final = itn_decimal_tagger.final_graph_wo_negative + + graph_unit = pynini.invert(maj_singular) + graph_unit = pynutil.insert('currency: "') + convert_space(graph_unit) + pynutil.insert('"') + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + min_unit = pynini.project(min_singular | min_plural, "output") + # elf euro (und) vier cent, vier cent + cents_standalone = ( + pynutil.insert('fractional_part: "') + + cardinal_graph @ add_leading_zero_to_double_digit + + delete_space + + pynutil.delete(min_unit) + + pynutil.insert('"') + ) + + optional_cents_standalone = pynini.closure( + delete_space + + pynini.closure(pynutil.delete("und") + delete_space, 0, 1) + + insert_space + + cents_standalone, + 0, + 1, + ) + # elf euro vierzig, only after integer + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('fractional_part: "') + + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + cardinal_graph + + pynutil.insert('"') + + delete_extra_space + + graph_unit + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_decimal = graph_decimal_final + delete_extra_space + graph_unit + graph_decimal |= pynutil.insert('currency: "€" integer_part: "0" ') + cents_standalone + final_graph = graph_integer | graph_decimal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/de/taggers/ordinal.py new file mode 100644 index 0000000..d2c1590 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/ordinal.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + e.g. dreizehnter -> tokens { name: "13." } + + Args: + itn_cardinal_tagger: ITN Cardinal Tagger + tn_ordinal_verbalizer: TN Ordinal Verbalizer + """ + + def __init__( + self, + itn_cardinal_tagger: GraphFst, + tn_ordinal_verbalizer: GraphFst, + deterministic: bool = True, + ): + super().__init__(name="ordinal", kind="classify", deterministic=deterministic) + + tagger = tn_ordinal_verbalizer.graph.invert().optimize() + + graph = ( + pynutil.delete('integer: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) @ itn_cardinal_tagger.graph + + final_graph = tagger @ graph + pynutil.insert(".") + + graph = pynutil.insert('name: "') + final_graph + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/de/taggers/telephone.py new file mode 100644 index 0000000..1dace7b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/telephone.py @@ -0,0 +1,43 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + convert_space, + insert_space, +) +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + null vier eins eins eins zwei drei vier eins zwei drei vier -> tokens { name: "(0411) 1234-1234" } + + Args: + tn_cardinal_tagger: TN Cardinal Tagger + """ + + def __init__(self, tn_cardinal_tagger: GraphFst, deterministic: bool = True): + super().__init__(name="telephone", kind="classify", deterministic=deterministic) + separator = pynini.accep(" ") # between components + digit = pynini.union(*list(map(str, range(1, 10)))) @ tn_cardinal_tagger.two_digit_non_zero + zero = pynini.cross("0", "null") + + number_part = ( + pynutil.delete("(") + + zero + + insert_space + + pynini.closure(digit + insert_space, 2, 2) + + digit + + pynutil.delete(")") + + separator + + pynini.closure(digit + insert_space, 3, 3) + + digit + + pynutil.delete("-") + + insert_space + + pynini.closure(digit + insert_space, 3, 3) + + digit + ) + graph = convert_space(pynini.invert(number_part)) + final_graph = pynutil.insert('name: "') + graph + pynutil.insert('"') + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/time.py b/fun_text_processing/inverse_text_normalization/de/taggers/time.py new file mode 100644 index 0000000..f9b05c9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/time.py @@ -0,0 +1,28 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, GraphFst +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. acht uhr e s t-> time { hours: "8" zone: "e s t" } + e.g. dreizehn uhr -> time { hours: "13" } + e.g. dreizehn uhr zehn -> time { hours: "13" minutes: "10" } + e.g. viertel vor zwölf -> time { minutes: "45" hours: "11" } + e.g. viertel nach zwölf -> time { minutes: "15" hours: "12" } + e.g. halb zwölf -> time { minutes: "30" hours: "11" } + e.g. drei vor zwölf -> time { minutes: "57" hours: "11" } + e.g. drei nach zwölf -> time { minutes: "3" hours: "12" } + e.g. drei uhr zehn minuten zehn sekunden -> time { hours: "3" hours: "10" sekunden: "10"} + + Args: + tn_time_verbalizer: TN time verbalizer + """ + + def __init__(self, tn_time_verbalizer: GraphFst, deterministic: bool = True): + super().__init__(name="time", kind="classify", deterministic=deterministic) + # lazy way to make sure compounds work + optional_delete_space = pynini.closure(DAMO_SIGMA | pynutil.delete(" ", weight=0.0001)) + graph = (tn_time_verbalizer.graph @ optional_delete_space).invert().optimize() + self.fst = self.add_tokens(graph).optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/de/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..13d64b1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/tokenize_and_classify.py @@ -0,0 +1,162 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.de.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.de.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.de.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.de.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.de.taggers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.de.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.de.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.de.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.de.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.de.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.de.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.en.taggers.word import WordFst +from fun_text_processing.text_normalization.de.taggers.cardinal import ( + CardinalFst as TNCardinalTagger, +) +from fun_text_processing.text_normalization.de.taggers.date import DateFst as TNDateTagger +from fun_text_processing.text_normalization.de.taggers.decimal import DecimalFst as TNDecimalTagger +from fun_text_processing.text_normalization.de.taggers.electronic import ( + ElectronicFst as TNElectronicTagger, +) +from fun_text_processing.text_normalization.de.taggers.whitelist import ( + WhiteListFst as TNWhitelistTagger, +) +from fun_text_processing.text_normalization.de.verbalizers.date import DateFst as TNDateVerbalizer +from fun_text_processing.text_normalization.de.verbalizers.electronic import ( + ElectronicFst as TNElectronicVerbalizer, +) +from fun_text_processing.text_normalization.de.verbalizers.fraction import ( + FractionFst as TNFractionVerbalizer, +) +from fun_text_processing.text_normalization.de.verbalizers.ordinal import ( + OrdinalFst as TNOrdinalVerbalizer, +) +from fun_text_processing.text_normalization.de.verbalizers.time import TimeFst as TNTimeVerbalizer +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__( + self, cache_dir: str = None, overwrite_cache: bool = False, deterministic: bool = True + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_de_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + tn_cardinal_tagger = TNCardinalTagger(deterministic=False) + tn_date_tagger = TNDateTagger(cardinal=tn_cardinal_tagger, deterministic=False) + tn_decimal_tagger = TNDecimalTagger(cardinal=tn_cardinal_tagger, deterministic=False) + tn_ordinal_verbalizer = TNOrdinalVerbalizer(deterministic=False) + tn_fraction_verbalizer = TNFractionVerbalizer( + ordinal=tn_ordinal_verbalizer, deterministic=False + ) + tn_time_verbalizer = TNTimeVerbalizer( + cardinal_tagger=tn_cardinal_tagger, deterministic=False + ) + tn_date_verbalizer = TNDateVerbalizer( + ordinal=tn_ordinal_verbalizer, deterministic=False + ) + tn_electronic_tagger = TNElectronicTagger(deterministic=False) + tn_electronic_verbalizer = TNElectronicVerbalizer(deterministic=False) + tn_whitelist_tagger = TNWhitelistTagger(input_case="cased", deterministic=False) + + cardinal = CardinalFst(tn_cardinal_tagger=tn_cardinal_tagger) + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst( + itn_cardinal_tagger=cardinal, tn_ordinal_verbalizer=tn_ordinal_verbalizer + ) + ordinal_graph = ordinal.fst + decimal = DecimalFst(itn_cardinal_tagger=cardinal, tn_decimal_tagger=tn_decimal_tagger) + decimal_graph = decimal.fst + + fraction = FractionFst( + itn_cardinal_tagger=cardinal, tn_fraction_verbalizer=tn_fraction_verbalizer + ) + fraction_graph = fraction.fst + + measure_graph = MeasureFst( + itn_cardinal_tagger=cardinal, + itn_decimal_tagger=decimal, + itn_fraction_tagger=fraction, + ).fst + date_graph = DateFst( + itn_cardinal_tagger=cardinal, + tn_date_verbalizer=tn_date_verbalizer, + tn_date_tagger=tn_date_tagger, + ).fst + word_graph = WordFst().fst + time_graph = TimeFst(tn_time_verbalizer=tn_time_verbalizer).fst + money_graph = MoneyFst(itn_cardinal_tagger=cardinal, itn_decimal_tagger=decimal).fst + whitelist_graph = WhiteListFst(tn_whitelist_tagger=tn_whitelist_tagger).fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst( + tn_electronic_tagger=tn_electronic_tagger, + tn_electronic_verbalizer=tn_electronic_verbalizer, + ).fst + telephone_graph = TelephoneFst(tn_cardinal_tagger=tn_cardinal_tagger).fst + + classify = ( + pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(whitelist_graph, 1.0) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.1) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/de/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/de/taggers/whitelist.py new file mode 100644 index 0000000..884c2f0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "Mrs." } + Args: + tn_whitelist_tagger: TN whitelist tagger + """ + + def __init__(self, tn_whitelist_tagger: GraphFst, deterministic: bool = True): + super().__init__(name="whitelist", kind="classify", deterministic=deterministic) + + whitelist = pynini.invert(tn_whitelist_tagger.graph) + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/cardinal.py new file mode 100644 index 0000000..a9f8426 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/cardinal.py @@ -0,0 +1,23 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + + Args: + tn_cardinal_verbalizer: TN cardinal verbalizer + """ + + def __init__(self, tn_cardinal_verbalizer: GraphFst, deterministic: bool = True): + super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) + self.numbers = tn_cardinal_verbalizer.numbers + optional_sign = pynini.closure( + pynutil.delete('negative: "') + DAMO_NOT_QUOTE + pynutil.delete('" '), 0, 1 + ) + graph = optional_sign + self.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/decimal.py new file mode 100644 index 0000000..1c8042f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/decimal.py @@ -0,0 +1,37 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_preserve_order, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + + Args: + tn_decimal_verbalizer: TN decimal verbalizer + """ + + def __init__(self, tn_decimal_verbalizer: GraphFst, deterministic: bool = True): + super().__init__(name="decimal", kind="verbalize", deterministic=deterministic) + delete_space = pynutil.delete(" ") + optional_sign = pynini.closure( + pynutil.delete('negative: "') + DAMO_NOT_QUOTE + pynutil.delete('"') + delete_space, + 0, + 1, + ) + optional_integer = pynini.closure(tn_decimal_verbalizer.integer, 0, 1) + optional_fractional = pynini.closure( + delete_space + pynutil.insert(",") + tn_decimal_verbalizer.fractional_default, 0, 1 + ) + graph = ( + optional_integer + optional_fractional + tn_decimal_verbalizer.optional_quantity + ).optimize() + self.numbers = optional_sign + graph + graph = self.numbers + delete_preserve_order + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/measure.py new file mode 100644 index 0000000..2b9480b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/measure.py @@ -0,0 +1,50 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, delete_space +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { cardinal { negative: "true" integer: "12" } units: "kg" } -> -12 kg + measure { decimal { integer_part: "1/2" } units: "kg" } -> 1/2 kg + measure { decimal { integer_part: "1" fractional_part: "2" quantity: "million" } units: "kg" } -> 1,2 million kg + + Args: + decimal: ITN Decimal verbalizer + cardinal: ITN Cardinal verbalizer + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="measure", kind="verbalize", deterministic=deterministic) + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + + graph = (graph_cardinal | graph_decimal) + delete_space + pynutil.insert(" ") + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/money.py new file mode 100644 index 0000000..bca7492 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/money.py @@ -0,0 +1,26 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, delete_space +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> $12.05 + + Args: + decimal: ITN Decimal verbalizer + """ + + def __init__(self, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="verbalize", deterministic=deterministic) + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/time.py new file mode 100644 index 0000000..429563f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/time.py @@ -0,0 +1,52 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "8" minutes: "30" zone: "e s t" } -> 08:30 Uhr est + time { hours: "8" } -> 8 Uhr + time { hours: "8" minutes: "30" seconds: "10" } -> 08:30:10 Uhr + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="time", kind="verbalize", deterministic=deterministic) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + hour = pynutil.delete('hours: "') + pynini.closure(DAMO_DIGIT, 1) + pynutil.delete('"') + minute = pynutil.delete('minutes: "') + pynini.closure(DAMO_DIGIT, 1) + pynutil.delete('"') + + second = pynutil.delete('seconds: "') + pynini.closure(DAMO_DIGIT, 1) + pynutil.delete('"') + zone = ( + pynutil.delete('zone: "') + + pynini.closure(DAMO_ALPHA + delete_space) + + DAMO_ALPHA + + pynutil.delete('"') + ) + optional_zone = pynini.closure(pynini.accep(" ") + zone, 0, 1) + graph = ( + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + pynini.closure( + delete_space + pynutil.insert(":") + (second @ add_leading_zero_to_double_digit), + 0, + 1, + ) + + pynutil.insert(" Uhr") + + optional_zone + ) + graph_h = hour + pynutil.insert(" Uhr") + optional_zone + graph_hm = hour @ add_leading_zero_to_double_digit + graph + graph_hms = hour @ add_leading_zero_to_double_digit + graph + final_graph = graph_hm | graph_hms | graph_h + self.fst = self.delete_tokens(final_graph).optimize() diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/verbalize.py new file mode 100644 index 0000000..4293772 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/verbalize.py @@ -0,0 +1,35 @@ +from fun_text_processing.inverse_text_normalization.de.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.de.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.de.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.de.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.de.verbalizers.time import TimeFst +from fun_text_processing.text_normalization.de.verbalizers.cardinal import ( + CardinalFst as TNCardinalVerbalizer, +) +from fun_text_processing.text_normalization.de.verbalizers.decimal import ( + DecimalFst as TNDecimalVerbalizer, +) +from fun_text_processing.text_normalization.en.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="verbalize", kind="verbalize", deterministic=deterministic) + tn_cardinal_verbalizer = TNCardinalVerbalizer(deterministic=False) + tn_decimal_verbalizer = TNDecimalVerbalizer(deterministic=False) + + cardinal = CardinalFst(tn_cardinal_verbalizer=tn_cardinal_verbalizer) + cardinal_graph = cardinal.fst + decimal = DecimalFst(tn_decimal_verbalizer=tn_decimal_verbalizer) + decimal_graph = decimal.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + graph = time_graph | money_graph | measure_graph | decimal_graph | cardinal_graph + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/de/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/de/verbalizers/verbalize_final.py new file mode 100644 index 0000000..470fa27 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/de/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.de.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "jetzt" } tokens { name: "ist" } tokens { time { hours: "12" minutes: "30" } } -> jetzt ist 12:30 Uhr + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="verbalize_final", kind="verbalize", deterministic=deterministic) + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/en/__init__.py b/fun_text_processing/inverse_text_normalization/en/__init__.py new file mode 100644 index 0000000..4f73ff2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/en/clean_eval_data.py b/fun_text_processing/inverse_text_normalization/en/clean_eval_data.py new file mode 100644 index 0000000..e975bf5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/clean_eval_data.py @@ -0,0 +1,384 @@ +from argparse import ArgumentParser +from typing import List + +import regex as re +from fun_text_processing.text_normalization.data_loader_utils import ( + EOS_TYPE, + Instance, + load_files, + training_data_to_sentences, +) + + +""" +This file is for evaluation purposes. +filter_loaded_data() cleans data (list of instances) for inverse text normalization. Filters and cleaners can be specified for each semiotic class individually. +For example, normalized text should only include characters and whitespace characters but no punctuation. + Cardinal unnormalized instances should contain at least one integer and all other characters are removed. +""" + + +class Filter: + """ + Filter class + + Args: + class_type: semiotic class used in dataset + process_func: function to transform text + filter_func: function to filter text + + """ + + def __init__(self, class_type: str, process_func: object, filter_func: object): + self.class_type = class_type + self.process_func = process_func + self.filter_func = filter_func + + def filter(self, instance: Instance) -> bool: + """ + filter function + + Args: + filters given instance with filter function + + Returns: True if given instance fulfills criteria or does not belong to class type + """ + if instance.token_type != self.class_type: + return True + return self.filter_func(instance) + + def process(self, instance: Instance) -> Instance: + """ + process function + + Args: + processes given instance with process function + + Returns: processed instance if instance belongs to expected class type or original instance + """ + if instance.token_type != self.class_type: + return instance + return self.process_func(instance) + + +def filter_cardinal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_cardinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[^0-9]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_ordinal_1(instance: Instance) -> bool: + ok = re.search(r"(st|nd|rd|th)\s*$", instance.un_normalized) + return ok + + +def process_ordinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[,\s]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_decimal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_decimal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_measure_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_measure_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"m2", "m²", un_normalized) + un_normalized = re.sub(r"(\d)([^\d.\s])", r"\1 \2", un_normalized) + normalized = re.sub(r"[^a-z\s]", "", normalized) + normalized = re.sub(r"per ([a-z\s]*)s$", r"per \1", normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_money_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_money_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"a\$", r"$", un_normalized) + un_normalized = re.sub(r"us\$", r"$", un_normalized) + un_normalized = re.sub(r"(\d)m\s*$", r"\1 million", un_normalized) + un_normalized = re.sub(r"(\d)bn?\s*$", r"\1 billion", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_time_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_time_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r": ", ":", un_normalized) + un_normalized = re.sub(r"(\d)\s?a\s?m\s?", r"\1 a.m.", un_normalized) + un_normalized = re.sub(r"(\d)\s?p\s?m\s?", r"\1 p.m.", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_plain_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_plain_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_punct_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_punct_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_date_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_date_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_letters_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_letters_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_verbatim_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_verbatim_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_digit_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_digit_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_telephone_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_telephone_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_electronic_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_electronic_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_fraction_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_fraction_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_address_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_address_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +filters = [] +filters.append( + Filter(class_type="CARDINAL", process_func=process_cardinal_1, filter_func=filter_cardinal_1) +) +filters.append( + Filter(class_type="ORDINAL", process_func=process_ordinal_1, filter_func=filter_ordinal_1) +) +filters.append( + Filter(class_type="DECIMAL", process_func=process_decimal_1, filter_func=filter_decimal_1) +) +filters.append( + Filter(class_type="MEASURE", process_func=process_measure_1, filter_func=filter_measure_1) +) +filters.append(Filter(class_type="MONEY", process_func=process_money_1, filter_func=filter_money_1)) +filters.append(Filter(class_type="TIME", process_func=process_time_1, filter_func=filter_time_1)) + +filters.append(Filter(class_type="DATE", process_func=process_date_1, filter_func=filter_date_1)) +filters.append(Filter(class_type="PLAIN", process_func=process_plain_1, filter_func=filter_plain_1)) +filters.append(Filter(class_type="PUNCT", process_func=process_punct_1, filter_func=filter_punct_1)) +filters.append( + Filter(class_type="LETTERS", process_func=process_letters_1, filter_func=filter_letters_1) +) +filters.append( + Filter(class_type="VERBATIM", process_func=process_verbatim_1, filter_func=filter_verbatim_1) +) +filters.append(Filter(class_type="DIGIT", process_func=process_digit_1, filter_func=filter_digit_1)) +filters.append( + Filter(class_type="TELEPHONE", process_func=process_telephone_1, filter_func=filter_telephone_1) +) +filters.append( + Filter( + class_type="ELECTRONIC", process_func=process_electronic_1, filter_func=filter_electronic_1 + ) +) +filters.append( + Filter(class_type="FRACTION", process_func=process_fraction_1, filter_func=filter_fraction_1) +) +filters.append( + Filter(class_type="ADDRESS", process_func=process_address_1, filter_func=filter_address_1) +) +filters.append(Filter(class_type=EOS_TYPE, process_func=lambda x: x, filter_func=lambda x: True)) + + +def filter_loaded_data(data: List[Instance], verbose: bool = False) -> List[Instance]: + """ + Filters list of instances + + Args: + data: list of instances + + Returns: filtered and transformed list of instances + """ + updates_instances = [] + for instance in data: + updated_instance = False + for fil in filters: + if fil.class_type == instance.token_type and fil.filter(instance): + instance = fil.process(instance) + updated_instance = True + if updated_instance: + if verbose: + print(instance) + updates_instances.append(instance) + return updates_instances + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument( + "--input", help="input file path", type=str, default="./en_with_types/output-00001-of-00100" + ) + parser.add_argument("--verbose", help="print filtered instances", action="store_true") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + file_path = args.input + + print("Loading training data: " + file_path) + instance_list = load_files([file_path]) # List of instances + filtered_instance_list = filter_loaded_data(instance_list, args.verbose) + training_data_to_sentences(filtered_instance_list) diff --git a/fun_text_processing/inverse_text_normalization/en/data/__init__.py b/fun_text_processing/inverse_text_normalization/en/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/en/data/currency.tsv b/fun_text_processing/inverse_text_normalization/en/data/currency.tsv new file mode 100644 index 0000000..c371255 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/currency.tsv @@ -0,0 +1,35 @@ +$ dollar +$ us dollar +$ united states dollar +£ british pound +€ euro +₩ won +nzd new zealand dollar +rs rupee +chf swiss franc +dkk danish kroner +fim finnish markka +aed arab emirates dirham +¥ yen +czk czech koruna +mro mauritanian ouguiya +pkr pakistani rupee +crc costa rican colon +hk$ hong kong dollar +npr nepalese rupee +awg aruban florin +nok norwegian kroner +tzs tanzanian shilling +sek swedish kronor +cyp cypriot pound +r real +sar saudi riyal +cve cape verde escudo +rsd serbian dinar +dm german mark +shp saint helena pounds +php philippine peso +cad canadian dollar +ssp south sudanese pound +scr seychelles rupee +mvr maldivian rufiyaa \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/en/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/en/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/en/data/electronic/domain.tsv new file mode 100644 index 0000000..207a14a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/electronic/domain.tsv @@ -0,0 +1,10 @@ +com +uk +fr +net +br +in +ru +de +it +ai diff --git a/fun_text_processing/inverse_text_normalization/en/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/en/data/electronic/server_name.tsv new file mode 100644 index 0000000..ca7f97b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast +google diff --git a/fun_text_processing/inverse_text_normalization/en/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/en/data/electronic/symbols.tsv new file mode 100644 index 0000000..5be8da8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/electronic/symbols.tsv @@ -0,0 +1,22 @@ +. dot +- dash +- hyphen +_ underscore +! exclamation mark +# number sign +$ dollar sign +% percent sign +& ampersand +' quote +* asterisk ++ plus +/ slash += equal sign +? question mark +^ circumflex +` right single quote +{ left brace +| vertical bar +} right brace +~ tilde +, comma \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/magnitudes.tsv b/fun_text_processing/inverse_text_normalization/en/data/magnitudes.tsv new file mode 100644 index 0000000..3bfa484 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/magnitudes.tsv @@ -0,0 +1,4 @@ +k thousand +m million +b billion +t trillion \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/measurements.tsv b/fun_text_processing/inverse_text_normalization/en/data/measurements.tsv new file mode 100644 index 0000000..6801b7b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/measurements.tsv @@ -0,0 +1,109 @@ +f fahrenheit +c celsius +km kilometer +m meter +cm centimeter +mm millimeter +ha hectare +mi mile +m² square meter +km² square kilometer +ft foot +% percent +hz hertz +kw kilowatt +hp horsepower +mg milligram +kg kilogram +ghz gigahertz +khz kilohertz +mhz megahertz +v volt +h hour +mc mega coulomb +s second +nm nanometer +rpm revolution per minute +min minute +mA milli ampere +% per cent +kwh kilo watt hour +m³ cubic meter +mph mile per hour +tw tera watt +mv milli volt +mw megawatt +μm micrometer +" inch +tb terabyte +cc c c +g gram +da dalton +atm atmosphere +ω ohm +db decibel +ps peta second +oz ounce +hl hecto liter +μg microgram +pg petagram +gb gigabyte +kb kilobit +ev electron volt +mb megabyte +kb kilobyte +kbps kilobit per second +mbps megabit per second +st stone +kl kilo liter +tj tera joule +kv kilo volt +mv mega volt +kn kilonewton +mm megameter +au astronomical unit +yd yard +rad radian +lm lumen +hs hecto second +mol mole +gpa giga pascal +ml milliliter +gw gigawatt +ma mega ampere +kt knot +kgf kilogram force +ng nano gram +ns nanosecond +ms mega siemens +bar bar +gl giga liter +μs microsecond +da deci ampere +pa pascal +ds deci second +ms milli second +dm deci meter +dm³ cubic deci meter +amu atomic mass unit +mb megabit +mf mega farad +bq becquerel +pb petabit +mm² square millimeter +cm² square centimeter +sq mi square mile +sq ft square foot +kpa kilopascal +cd candela +tl tera liter +ms mega second +mpa megapascal +pm peta meter +pb peta byte +gwh giga watt hour +kcal kilo calory +gy gray +sv sievert +cwt hundredweight +cc c c diff --git a/fun_text_processing/inverse_text_normalization/en/data/months.tsv b/fun_text_processing/inverse_text_normalization/en/data/months.tsv new file mode 100644 index 0000000..6e7903c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/months.tsv @@ -0,0 +1,12 @@ +january +february +march +april +may +june +july +august +september +october +november +december \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/en/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/en/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/en/data/numbers/digit.tsv new file mode 100644 index 0000000..fa32979 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/numbers/digit.tsv @@ -0,0 +1,9 @@ +one 1 +two 2 +three 3 +four 4 +five 5 +six 6 +seven 7 +eight 8 +nine 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/numbers/hundred.tsv b/fun_text_processing/inverse_text_normalization/en/data/numbers/hundred.tsv new file mode 100644 index 0000000..10e2b96 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/numbers/hundred.tsv @@ -0,0 +1 @@ +hundred \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/en/data/numbers/teen.tsv new file mode 100644 index 0000000..8e60fa1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/numbers/teen.tsv @@ -0,0 +1,10 @@ +ten 10 +eleven 11 +twelve 12 +thirteen 13 +fourteen 14 +fifteen 15 +sixteen 16 +seventeen 17 +eighteen 18 +nineteen 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/numbers/thousands.tsv b/fun_text_processing/inverse_text_normalization/en/data/numbers/thousands.tsv new file mode 100644 index 0000000..bf30542 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/numbers/thousands.tsv @@ -0,0 +1,22 @@ +thousand +million +billion +trillion +quadrillion +quintillion +sextillion +septillion +octillion +nonillion +decillion +undecillion +duodecillion +tredecillion +quattuordecillion +quindecillion +sexdecillion +septendecillion +octodecillion +novemdecillion +vigintillion +centillion \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/en/data/numbers/ties.tsv new file mode 100644 index 0000000..d7ec82e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/numbers/ties.tsv @@ -0,0 +1,9 @@ +twenty 2 +thirty 3 +forty 4 +fourty 4 +fifty 5 +sixty 6 +seventy 7 +eighty 8 +ninety 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/en/data/numbers/zero.tsv new file mode 100644 index 0000000..c479272 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/numbers/zero.tsv @@ -0,0 +1 @@ +zero 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/en/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/en/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/en/data/ordinals/digit.tsv new file mode 100644 index 0000000..4b7fc24 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/ordinals/digit.tsv @@ -0,0 +1,9 @@ +first one +second two +third three +fourth four +fifth five +sixth sixth +seventh seven +eighth eight +ninth nine \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/ordinals/teen.tsv b/fun_text_processing/inverse_text_normalization/en/data/ordinals/teen.tsv new file mode 100644 index 0000000..496fefc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/ordinals/teen.tsv @@ -0,0 +1 @@ +twelfth twelve \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/en/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/en/data/time/minute_to.tsv b/fun_text_processing/inverse_text_normalization/en/data/time/minute_to.tsv new file mode 100644 index 0000000..edab4d5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/time/minute_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 diff --git a/fun_text_processing/inverse_text_normalization/en/data/time/time_suffix.tsv b/fun_text_processing/inverse_text_normalization/en/data/time/time_suffix.tsv new file mode 100644 index 0000000..b39a9ef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/time/time_suffix.tsv @@ -0,0 +1,8 @@ +p m p.m. +pm p.m. +p.m. +p.m p.m. +am a.m. +a.m. +a.m a.m. +a m a.m. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/time/time_zone.tsv b/fun_text_processing/inverse_text_normalization/en/data/time/time_zone.tsv new file mode 100644 index 0000000..3e0ade4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t diff --git a/fun_text_processing/inverse_text_normalization/en/data/time/to_hour.tsv b/fun_text_processing/inverse_text_normalization/en/data/time/to_hour.tsv new file mode 100644 index 0000000..1b006ea --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/time/to_hour.tsv @@ -0,0 +1,12 @@ +one 12 +two 1 +three 2 +four 3 +five 4 +six 5 +seven 6 +eigh 7 +nine 8 +ten 9 +eleven 10 +twelve 11 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/en/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/en/data/whitelist.tsv new file mode 100644 index 0000000..7eed41e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/data/whitelist.tsv @@ -0,0 +1,12 @@ +e.g. for example +dr. doctor +mr. mister +mrs. misses +st. saint +7-eleven seven eleven +es3 e s three +s&p s and p +ASAP a s a p +AT&T a t and t +LLP l l p +ATM a t m diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/en/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/en/taggers/cardinal.py new file mode 100644 index 0000000..5246d0e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/cardinal.py @@ -0,0 +1,138 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path, num_to_word +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. minus twenty three -> cardinal { integer: "23" negative: "-" } } + Numbers below thirteen are not converted. + """ + + def __init__(self): + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + + graph_hundred = pynini.cross("hundred", "") + + graph_hundred_component = pynini.union( + graph_digit + delete_space + graph_hundred, pynutil.insert("0") + ) + graph_hundred_component += delete_space + graph_hundred_component += pynini.union( + graph_teen | pynutil.insert("00"), + (graph_ties | pynutil.insert("0")) + delete_space + (graph_digit | pynutil.insert("0")), + ) + + graph_hundred_component_at_least_one_none_zero_digit = graph_hundred_component @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) + + graph_thousands = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("thousand"), + pynutil.insert("000", weight=0.1), + ) + + graph_million = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("million"), + pynutil.insert("000", weight=0.1), + ) + graph_billion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("billion"), + pynutil.insert("000", weight=0.1), + ) + graph_trillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("trillion"), + pynutil.insert("000", weight=0.1), + ) + graph_quadrillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("quadrillion"), + pynutil.insert("000", weight=0.1), + ) + graph_quintillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("quintillion"), + pynutil.insert("000", weight=0.1), + ) + graph_sextillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("sextillion"), + pynutil.insert("000", weight=0.1), + ) + + graph = pynini.union( + graph_sextillion + + delete_space + + graph_quintillion + + delete_space + + graph_quadrillion + + delete_space + + graph_trillion + + delete_space + + graph_billion + + delete_space + + graph_million + + delete_space + + graph_thousands + + delete_space + + graph_hundred_component, + graph_zero, + ) + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + labels_exception = [num_to_word(x) for x in range(0, 13)] + graph_exception = pynini.union(*labels_exception) + + graph = ( + pynini.cdrewrite(pynutil.delete("and"), DAMO_SPACE, DAMO_SPACE, DAMO_SIGMA) + @ (DAMO_ALPHA + DAMO_SIGMA) + @ graph + ) + + self.graph_no_exception = graph + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/date.py b/fun_text_processing/inverse_text_normalization/en/taggers/date.py new file mode 100644 index 0000000..82fe2a7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/date.py @@ -0,0 +1,150 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + +graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")).optimize() +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize() +ties_graph = pynini.string_file(get_abs_path("data/numbers/ties.tsv")).optimize() + + +def _get_month_graph(): + """ + Transducer for month, e.g. march -> march + """ + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + return month_graph + + +def _get_ties_graph(): + """ + Transducer for 20-99 e.g + twenty three -> 23 + """ + graph = ties_graph + (delete_space + graph_digit | pynutil.insert("0")) + return graph + + +def _get_range_graph(): + """ + Transducer for decades (1**0s, 2**0s), centuries (2*00s, 1*00s), millennia (2000s) + """ + graph_ties = _get_ties_graph() + graph = (graph_ties | graph_teen) + delete_space + pynini.cross("hundreds", "00s") + graph |= pynini.cross("two", "2") + delete_space + pynini.cross("thousands", "000s") + graph |= ( + (graph_ties | graph_teen) + + delete_space + + (pynini.closure(DAMO_ALPHA, 1) + (pynini.cross("ies", "y") | pynutil.delete("s"))) + @ (graph_ties | pynini.cross("ten", "10")) + + pynutil.insert("s") + ) + graph @= pynini.union("1", "2") + DAMO_DIGIT + DAMO_DIGIT + DAMO_DIGIT + "s" + return graph + + +def _get_year_graph(): + """ + Transducer for year, e.g. twenty twenty -> 2020 + """ + + def _get_digits_graph(): + zero = pynini.cross((pynini.accep("oh") | pynini.accep("o")), "0") + graph = zero + delete_space + graph_digit + graph.optimize() + return graph + + def _get_thousands_graph(): + graph_ties = _get_ties_graph() + graph_hundred_component = ( + graph_digit + delete_space + pynutil.delete("hundred") + ) | pynutil.insert("0") + graph = ( + graph_digit + + delete_space + + pynutil.delete("thousand") + + delete_space + + graph_hundred_component + + delete_space + + (graph_teen | graph_ties) + ) + return graph + + graph_ties = _get_ties_graph() + graph_digits = _get_digits_graph() + graph_thousands = _get_thousands_graph() + year_graph = ( + # 20 19, 40 12, 2012 - assuming no limit on the year + (graph_teen + delete_space + (graph_ties | graph_digits | graph_teen)) + | (graph_ties + delete_space + (graph_ties | graph_digits | graph_teen)) + | graph_thousands + ) + year_graph.optimize() + return year_graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. january fifth twenty twelve -> date { month: "january" day: "5" year: "2012" preserve_order: true } + e.g. the fifth of january twenty twelve -> date { day: "5" month: "january" year: "2012" preserve_order: true } + e.g. twenty twenty -> date { year: "2012" preserve_order: true } + + Args: + ordinal: OrdinalFst + """ + + def __init__(self, ordinal: GraphFst): + super().__init__(name="date", kind="classify") + + ordinal_graph = ordinal.graph + year_graph = _get_year_graph() + YEAR_WEIGHT = 0.001 + year_graph = pynutil.add_weight(year_graph, YEAR_WEIGHT) + month_graph = _get_month_graph() + + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + + day_graph = ( + pynutil.insert('day: "') + pynutil.add_weight(ordinal_graph, -0.7) + pynutil.insert('"') + ) + graph_year = ( + delete_extra_space + + pynutil.insert('year: "') + + pynutil.add_weight(year_graph, -YEAR_WEIGHT) + + pynutil.insert('"') + ) + optional_graph_year = pynini.closure( + graph_year, + 0, + 1, + ) + graph_mdy = month_graph + ( + (delete_extra_space + day_graph) + | graph_year + | (delete_extra_space + day_graph + graph_year) + ) + graph_dmy = ( + pynutil.delete("the") + + delete_space + + day_graph + + delete_space + + pynutil.delete("of") + + delete_extra_space + + month_graph + + optional_graph_year + ) + graph_year = ( + pynutil.insert('year: "') + (year_graph | _get_range_graph()) + pynutil.insert('"') + ) + + final_graph = graph_mdy | graph_dmy | graph_year + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/en/taggers/decimal.py new file mode 100644 index 0000000..987af43 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/decimal.py @@ -0,0 +1,100 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + numbers = cardinal_up_to_hundred @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + suffix = pynini.union( + "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion" + ) + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + + delete_extra_space + + pynutil.insert('quantity: "') + + (suffix | "thousand") + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. minus twelve point five o o six billion -> decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } + e.g. one billion -> decimal { integer_part: "1" quantity: "billion" } + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_decimal = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_decimal |= pynini.string_file(get_abs_path("data/numbers/zero.tsv")) | pynini.cross( + "o", "0" + ) + + graph_decimal = pynini.closure(graph_decimal + delete_space) + graph_decimal + self.graph = graph_decimal + + point = pynutil.delete("point") + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + point + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/en/taggers/electronic.py new file mode 100644 index 0000000..49292fc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/electronic.py @@ -0,0 +1,97 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import DAMO_ALPHA, GraphFst, insert_space +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. c d f one at a b c dot e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("dot", ".") + username = ( + alpha_num + pynini.closure(delete_extra_space + accepted_username) + ) | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + username = pynutil.insert('username: "') + username + pynutil.insert('"') + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete("at") + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("w w w", "www"), "www") + protocol_start = ( + pynini.cross("h t t p", "http") | pynini.cross("h t t p s", "https") + ) + pynini.cross(" colon slash slash ", "://") + # .com, + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + ( + domain + | pynini.closure( + accepted_username + delete_extra_space, + ) + + accepted_username + ) + ) + + protocol_default = ( + ( + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + ) + + pynini.closure(ending, 1) + ).optimize() + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + protocol_default + ).optimize() + + protocol |= ( + pynini.closure(protocol_end + delete_extra_space + process_dot, 0, 1) + protocol_default + ) + + protocol = pynutil.insert('protocol: "') + protocol.optimize() + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/en/taggers/fraction.py new file mode 100644 index 0000000..2829e9e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/fraction.py @@ -0,0 +1,11 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + """ + + def __init__(self): + super().__init__(name="fraction", kind="classify") + # integer_part # numerator # denominator diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/measure.py b/fun_text_processing/inverse_text_normalization/en/taggers/measure.py new file mode 100644 index 0000000..3d581e3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/measure.py @@ -0,0 +1,97 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. minus twelve kilograms -> measure { negative: "true" cardinal { integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_unit = pynini.string_file(get_abs_path("data/measurements.tsv")) + graph_unit_singular = pynini.invert(graph_unit) # singular -> abbr + graph_unit_plural = get_singulars(graph_unit_singular) # plural -> abbr + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_singular = convert_space(graph_unit_singular) + unit_plural = convert_space(graph_unit_plural) + unit_misc = ( + pynutil.insert("/") + + pynutil.delete("per") + + delete_space + + convert_space(graph_unit_singular) + ) + + unit_singular = ( + pynutil.insert('units: "') + + ( + unit_singular + | unit_misc + | pynutil.add_weight(unit_singular + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + unit_plural = ( + pynutil.insert('units: "') + + ( + unit_plural + | unit_misc + | pynutil.add_weight(unit_plural + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "one") @ cardinal_graph) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + pynini.cross("one", "1") + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/money.py b/fun_text_processing/inverse_text_normalization/en/taggers/money.py new file mode 100644 index 0000000..df21975 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/money.py @@ -0,0 +1,110 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. twelve dollars and five cents -> money { integer_part: "12" fractional_part: 05 currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + # add support for missing hundred (only for 3 digit numbers) + # "one fifty" -> "one hundred fifty" + with_hundred = pynini.compose( + pynini.closure(DAMO_NOT_SPACE) + + pynini.accep(" ") + + pynutil.insert("hundred ") + + DAMO_SIGMA, + pynini.compose(cardinal_graph, DAMO_DIGIT**3), + ) + cardinal_graph |= with_hundred + graph_decimal_final = decimal.final_graph_wo_negative + + unit = pynini.string_file(get_abs_path("data/currency.tsv")) + unit_singular = pynini.invert(unit) + unit_plural = get_singulars(unit_singular) + + graph_unit_singular = ( + pynutil.insert('currency: "') + convert_space(unit_singular) + pynutil.insert('"') + ) + graph_unit_plural = ( + pynutil.insert('currency: "') + convert_space(unit_plural) + pynutil.insert('"') + ) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + # twelve dollars (and) fifty cents, zero cents + cents_standalone = ( + pynutil.insert('fractional_part: "') + + pynini.union( + pynutil.add_weight(((DAMO_SIGMA - "one") @ cardinal_graph), -0.7) + @ add_leading_zero_to_double_digit + + delete_space + + (pynutil.delete("cents") | pynutil.delete("cent")), + pynini.cross("one", "01") + delete_space + pynutil.delete("cent"), + ) + + pynutil.insert('"') + ) + + optional_cents_standalone = pynini.closure( + delete_space + + pynini.closure(pynutil.delete("and") + delete_space, 0, 1) + + insert_space + + cents_standalone, + 0, + 1, + ) + # twelve dollars fifty, only after integer + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('fractional_part: "') + + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "one") @ cardinal_graph) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_plural + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_integer |= ( + pynutil.insert('integer_part: "') + + pynini.cross("one", "1") + + pynutil.insert('"') + + delete_extra_space + + graph_unit_singular + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_decimal = graph_decimal_final + delete_extra_space + graph_unit_plural + graph_decimal |= pynutil.insert('currency: "$" integer_part: "0" ') + cents_standalone + final_graph = graph_integer | graph_decimal + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/en/taggers/ordinal.py new file mode 100644 index 0000000..2c6f276 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/ordinal.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + e.g. thirteenth -> ordinal { integer: "13" } + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="ordinal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + graph_digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")) + graph_teens = pynini.string_file(get_abs_path("data/ordinals/teen.tsv")) + graph = pynini.closure(DAMO_CHAR) + pynini.union( + graph_digit, graph_teens, pynini.cross("tieth", "ty"), pynini.cross("th", "") + ) + + self.graph = graph @ cardinal_graph + final_graph = pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/en/taggers/punctuation.py new file mode 100644 index 0000000..dfe16fa --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/en/taggers/telephone.py new file mode 100644 index 0000000..280ff88 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/telephone.py @@ -0,0 +1,149 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALNUM, + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +def get_serial_number(cardinal): + """ + any alphanumerical character sequence with at least one number with length greater equal to 3 + """ + digit = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT) + character = digit | DAMO_ALPHA + sequence = character + pynini.closure(pynutil.delete(" ") + character, 2) + sequence = sequence @ (pynini.closure(DAMO_ALNUM) + DAMO_DIGIT + pynini.closure(DAMO_ALNUM)) + return sequence.optimize() + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + one two three one two three five six seven eight -> { number_part: "123-123-5678" } + + This class also support card number and IP format. + "one two three dot one double three dot o dot four o" -> { number_part: "123.133.0.40"} + + "three two double seven three two one four three two one four three double zero five" -> + { number_part: 3277 3214 3214 3005} + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="telephone", kind="classify") + # country code, number_part, extension + digit_to_str = ( + pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize()) + | pynini.cross("0", pynini.union("o", "oh", "zero")).optimize() + ) + + str_to_digit = pynini.invert(digit_to_str) + + double_digit = pynini.union( + *[ + pynini.cross( + pynini.project(str(i) @ digit_to_str, "output") + + pynini.accep(" ") + + pynini.project(str(i) @ digit_to_str, "output"), + pynutil.insert("double ") + pynini.project(str(i) @ digit_to_str, "output"), + ) + for i in range(10) + ] + ) + double_digit.invert() + + # to handle cases like "one twenty three" + two_digit_cardinal = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT**2) + double_digit_to_digit = ( + pynini.compose(double_digit, str_to_digit + pynutil.delete(" ") + str_to_digit) + | two_digit_cardinal + ) + + single_or_double_digit = ( + pynutil.add_weight(double_digit_to_digit, -0.0001) | str_to_digit + ).optimize() + single_or_double_digit |= ( + single_or_double_digit + + pynini.closure( + pynutil.add_weight(pynutil.delete(" ") + single_or_double_digit, 0.0001) + ) + ).optimize() + + number_part = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + number_part = ( + pynutil.insert('number_part: "') + number_part.optimize() + pynutil.insert('"') + ) + + cardinal_option = pynini.compose(single_or_double_digit, DAMO_DIGIT ** (2, 3)) + + country_code = ( + pynutil.insert('country_code: "') + + pynini.closure(pynini.cross("plus ", "+"), 0, 1) + + ( + (pynini.closure(str_to_digit + pynutil.delete(" "), 0, 2) + str_to_digit) + | cardinal_option + ) + + pynutil.insert('"') + ) + + optional_country_code = pynini.closure( + country_code + pynutil.delete(" ") + insert_space, 0, 1 + ).optimize() + graph = optional_country_code + number_part + + # credit card number + space_four_digits = insert_space + DAMO_DIGIT**4 + credit_card_graph = pynini.compose( + single_or_double_digit, DAMO_DIGIT**4 + space_four_digits**3 + ).optimize() + graph |= ( + pynutil.insert('number_part: "') + credit_card_graph.optimize() + pynutil.insert('"') + ) + + # SSN + ssn_graph = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**2 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + graph |= pynutil.insert('number_part: "') + ssn_graph.optimize() + pynutil.insert('"') + + # ip + digit_or_double = ( + pynini.closure(str_to_digit + pynutil.delete(" "), 0, 1) + double_digit_to_digit + ) + digit_or_double |= double_digit_to_digit + pynini.closure( + pynutil.delete(" ") + str_to_digit, 0, 1 + ) + digit_or_double |= str_to_digit + (pynutil.delete(" ") + str_to_digit) ** (0, 2) + digit_or_double |= cardinal_option + digit_or_double = digit_or_double.optimize() + + ip_graph = digit_or_double + (pynini.cross(" dot ", ".") + digit_or_double) ** 3 + + graph |= pynutil.insert('number_part: "') + ip_graph.optimize() + pynutil.insert('"') + graph |= ( + pynutil.insert('number_part: "') + + pynutil.add_weight(get_serial_number(cardinal=cardinal), weight=0.0001) + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/time.py b/fun_text_processing/inverse_text_normalization/en/taggers/time.py new file mode 100644 index 0000000..72cfe54 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/time.py @@ -0,0 +1,139 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path, num_to_word +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. twelve thirty -> time { hours: "12" minutes: "30" } + e.g. twelve past one -> time { minutes: "12" hours: "1" } + e.g. two o clock a m -> time { hours: "2" suffix: "a.m." } + e.g. quarter to two -> time { hours: "1" minutes: "45" } + e.g. quarter past two -> time { hours: "2" minutes: "15" } + e.g. half past two -> time { hours: "2" minutes: "30" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + suffix_graph = pynini.string_file(get_abs_path("data/time/time_suffix.tsv")) + time_zone_graph = pynini.invert(pynini.string_file(get_abs_path("data/time/time_zone.tsv"))) + to_hour_graph = pynini.string_file(get_abs_path("data/time/to_hour.tsv")) + minute_to_graph = pynini.string_file(get_abs_path("data/time/minute_to.tsv")) + + # only used for < 1000 thousand -> 0 weight + cardinal = pynutil.add_weight(CardinalFst().graph_no_exception, weight=-0.7) + + labels_hour = [num_to_word(x) for x in range(0, 24)] + labels_minute_single = [num_to_word(x) for x in range(1, 10)] + labels_minute_double = [num_to_word(x) for x in range(10, 60)] + + graph_hour = pynini.union(*labels_hour) @ cardinal + + graph_minute_single = pynini.union(*labels_minute_single) @ cardinal + graph_minute_double = pynini.union(*labels_minute_double) @ cardinal + graph_minute_verbose = pynini.cross("half", "30") | pynini.cross("quarter", "15") + oclock = pynini.cross(pynini.union("o' clock", "o clock", "o'clock", "oclock"), "") + + final_graph_hour = pynutil.insert('hours: "') + graph_hour + pynutil.insert('"') + graph_minute = ( + oclock + pynutil.insert("00") + | pynutil.delete("o") + delete_space + graph_minute_single + | graph_minute_double + ) + final_suffix = ( + pynutil.insert('suffix: "') + convert_space(suffix_graph) + pynutil.insert('"') + ) + final_suffix = delete_space + insert_space + final_suffix + final_suffix_optional = pynini.closure(final_suffix, 0, 1) + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + # five o' clock + # two o eight, two thirty five (am/pm) + # two pm/am + graph_hm = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minute + + pynutil.insert('"') + ) + # 10 past four, quarter past four, half past four + graph_m_past_h = ( + pynutil.insert('minutes: "') + + pynini.union(graph_minute_single, graph_minute_double, graph_minute_verbose) + + pynutil.insert('"') + + delete_space + + pynutil.delete("past") + + delete_extra_space + + final_graph_hour + ) + + graph_quarter_time = ( + pynutil.insert('minutes: "') + + pynini.cross("quarter", "45") + + pynutil.insert('"') + + delete_space + + pynutil.delete(pynini.union("to", "till")) + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + ) + + graph_m_to_h_suffix_time = ( + pynutil.insert('minutes: "') + + ((graph_minute_single | graph_minute_double).optimize() @ minute_to_graph) + + pynutil.insert('"') + + pynini.closure( + delete_space + pynutil.delete(pynini.union("min", "mins", "minute", "minutes")), + 0, + 1, + ) + + delete_space + + pynutil.delete(pynini.union("to", "till")) + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + + final_suffix + ) + + graph_h = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + (pynutil.insert("00") | graph_minute) + + pynutil.insert('"') + + final_suffix + + final_time_zone_optional + ) + final_graph = ( + (graph_hm | graph_m_past_h | graph_quarter_time) + + final_suffix_optional + + final_time_zone_optional + ) + final_graph |= graph_h + final_graph |= graph_m_to_h_suffix_time + + final_graph = self.add_tokens(final_graph.optimize()) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/en/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..756ea9e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/tokenize_and_classify.py @@ -0,0 +1,102 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.en.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.en.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.en.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.en.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.en.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.en.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.en.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.en.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.en.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.en.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.en.taggers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_en_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst(cardinal) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst(ordinal=ordinal).fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst(cardinal).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/en/taggers/whitelist.py new file mode 100644 index 0000000..c7443ac --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/taggers/word.py b/fun_text_processing/inverse_text_normalization/en/taggers/word.py new file mode 100644 index 0000000..9758f68 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/utils.py b/fun_text_processing/inverse_text_normalization/en/utils.py new file mode 100644 index 0000000..38a95ba --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/utils.py @@ -0,0 +1,33 @@ +import os +from typing import Union + +import inflect + +_inflect = inflect.engine() + + +def num_to_word(x: Union[str, int]): + """ + converts integer to spoken representation + + Args + x: integer + + Returns: spoken representation + """ + if isinstance(x, int): + x = str(x) + x = _inflect.number_to_words(str(x)).replace("-", " ").replace(",", "") + return x + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/cardinal.py new file mode 100644 index 0000000..939c406 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/date.py new file mode 100644 index 0000000..d8cdfb0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/date.py @@ -0,0 +1,70 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "january" day: "5" year: "2012" preserve_order: true } -> february 5 2012 + date { day: "5" month: "january" year: "2012" preserve_order: true } -> 5 february 2012 + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + + # month (day) year + graph_mdy = ( + month + + pynini.closure(delete_extra_space + day, 0, 1) + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + # (day) month year + graph_dmy = ( + pynini.closure(day + delete_extra_space, 0, 1) + + month + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = (graph_mdy | year | graph_dmy) + delete_space + optional_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/decimal.py new file mode 100644 index 0000000..0b7b637 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/decimal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/electronic.py new file mode 100644 index 0000000..a886074 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/fraction.py new file mode 100644 index 0000000..b546ad1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/fraction.py @@ -0,0 +1,10 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction, + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/measure.py new file mode 100644 index 0000000..8f6a134 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/measure.py @@ -0,0 +1,47 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, delete_space +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + pynutil.insert(" ") + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/money.py new file mode 100644 index 0000000..99747f4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/money.py @@ -0,0 +1,26 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, delete_space +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> $12.05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/ordinal.py new file mode 100644 index 0000000..29f4f53 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/ordinal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" } -> 13th + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + convert_eleven = pynini.cross("11", "11th") + convert_twelve = pynini.cross("12", "12th") + convert_thirteen = pynini.cross("13", "13th") + convert_one = pynini.cross("1", "1st") + convert_two = pynini.cross("2", "2nd") + convert_three = pynini.cross("3", "3rd") + convert_rest = pynutil.insert("th", weight=0.01) + + suffix = pynini.cdrewrite( + convert_eleven + | convert_twelve + | convert_thirteen + | convert_one + | convert_two + | convert_three + | convert_rest, + "", + "[EOS]", + DAMO_SIGMA, + ) + graph = graph @ suffix + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/telephone.py new file mode 100644 index 0000000..7f7b0b6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/telephone.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_country_code = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" "), + 0, + 1, + ) + delete_tokens = self.delete_tokens(optional_country_code + number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/time.py new file mode 100644 index 0000000..c85f259 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/time.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "12" minutes: "30" } -> 12:30 + time { hours: "1" minutes: "12" } -> 01:12 + time { hours: "2" suffix: "a.m." } -> 02:00 a.m. + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + suffix = ( + delete_space + + insert_space + + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + zone = ( + delete_space + + insert_space + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + graph = ( + hour @ add_leading_zero_to_double_digit + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + optional_suffix + + optional_zone + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/verbalize.py new file mode 100644 index 0000000..c9ce9d5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/verbalize.py @@ -0,0 +1,47 @@ +from fun_text_processing.inverse_text_normalization.en.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.en.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/verbalize_final.py new file mode 100644 index 0000000..f028428 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/whitelist.py new file mode 100644 index 0000000..cd57a42 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/en/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/en/verbalizers/word.py new file mode 100644 index 0000000..1d33cd1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/en/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/__init__.py b/fun_text_processing/inverse_text_normalization/es/__init__.py new file mode 100644 index 0000000..19bb6ec --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.es.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.es.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/es/data/__init__.py b/fun_text_processing/inverse_text_normalization/es/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/es/data/currency_plural.tsv b/fun_text_processing/inverse_text_normalization/es/data/currency_plural.tsv new file mode 100644 index 0000000..b222ff7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/currency_plural.tsv @@ -0,0 +1,6 @@ +€ euros +US$ dólares estadounidenses +US$ dólares americanos +$ dólares +$ pesos +¥ yenes \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/currency_singular.tsv b/fun_text_processing/inverse_text_normalization/es/data/currency_singular.tsv new file mode 100644 index 0000000..f3977ea --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/currency_singular.tsv @@ -0,0 +1,6 @@ +€ euro +US$ dólar estadounidense +US$ dólar americano +$ dólar +$ peso +¥ yen \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/es/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/es/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/es/data/electronic/domain.tsv new file mode 100644 index 0000000..8053757 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/electronic/domain.tsv @@ -0,0 +1,25 @@ +com +es +uk +fr +net +br +in +ru +de +it +edu +co +ar +bo +cl +co +ec +fk +gf +fy +pe +py +sr +ve +uy \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/es/data/electronic/server_name.tsv new file mode 100644 index 0000000..711073d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +gmail g mail +gmail +nvidia n vidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast +bbc \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/es/data/electronic/symbols.tsv new file mode 100644 index 0000000..9835226 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/electronic/symbols.tsv @@ -0,0 +1,4 @@ +. punto +- guion +_ guion bajo +/ barra \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/measurements_plural.tsv b/fun_text_processing/inverse_text_normalization/es/data/measurements_plural.tsv new file mode 100644 index 0000000..a27d890 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/measurements_plural.tsv @@ -0,0 +1,19 @@ +cm centímetros +g gramos +h horas +kg kilos +kg kilogramos +km kilómetros +km² kilómetros cuadrados +l litros +m metros +m² metros cuadrados +m³ metros cubicos +mph millas por hora +ml mililitros +mm milímetros +ms milisegundos +min minutos +% por ciento +% porciento +s segundos diff --git a/fun_text_processing/inverse_text_normalization/es/data/measurements_singular.tsv b/fun_text_processing/inverse_text_normalization/es/data/measurements_singular.tsv new file mode 100644 index 0000000..7c892b5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/measurements_singular.tsv @@ -0,0 +1,19 @@ +cm centímetro +g gramo +h hora +kg kilo +kg kilogramo +km kilómetro +km² kilómetro cuadrado +l litro +m metro +m² metro cuadrado +m³ metro cubico +mph milla por hora +ml mililitro +mm milímetro +ms milisegundo +min minuto +% por ciento +% porciento +s segundo diff --git a/fun_text_processing/inverse_text_normalization/es/data/months.tsv b/fun_text_processing/inverse_text_normalization/es/data/months.tsv new file mode 100644 index 0000000..55ada22 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/months.tsv @@ -0,0 +1,12 @@ +enero +febrero +marzo +abril +mayo +junio +julio +agosto +septiembre +octubre +noviembre +diciembre \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/es/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/es/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/es/data/numbers/digit.tsv new file mode 100644 index 0000000..639fe1c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/numbers/digit.tsv @@ -0,0 +1,12 @@ +uno 1 +un 1 +ún 1 +una 1 +dos 2 +tres 3 +cuatro 4 +cinco 5 +seis 6 +siete 7 +ocho 8 +nueve 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/numbers/hundreds.tsv b/fun_text_processing/inverse_text_normalization/es/data/numbers/hundreds.tsv new file mode 100644 index 0000000..972e687 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/numbers/hundreds.tsv @@ -0,0 +1,18 @@ +ciento 1 +cien 1 +doscientos 2 +doscientas 2 +trescientos 3 +trescientas 3 +cuatrocientos 4 +cuatrocientas 4 +quinientos 5 +quinientas 5 +seiscientos 6 +seiscientas 6 +setecientos 7 +setecientas 7 +ochocientos 8 +ochocientas 8 +novecientos 9 +novecientas 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/es/data/numbers/teen.tsv new file mode 100644 index 0000000..370526e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/numbers/teen.tsv @@ -0,0 +1,10 @@ +diez 10 +once 11 +doce 12 +trece 13 +catorce 14 +quince 15 +dieciséis 16 +diecisiete 17 +dieciocho 18 +diecinueve 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/es/data/numbers/ties.tsv new file mode 100644 index 0000000..30f0d43 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/numbers/ties.tsv @@ -0,0 +1,9 @@ +veinte 2 +treinta 3 +cuarenta 4 +cincuenta 5 +cinquenta 5 +sesenta 6 +setenta 7 +ochenta 8 +noventa 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/numbers/twenties.tsv b/fun_text_processing/inverse_text_normalization/es/data/numbers/twenties.tsv new file mode 100644 index 0000000..e586cfa --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/numbers/twenties.tsv @@ -0,0 +1,14 @@ +veintiuno 21 +veintiún 21 +veintiuna 21 +veintidós 22 +veintitrés 23 +veintitres 23 +veinticuatro 24 +veinticuátro 24 +veintiacuátro 24 +veinticinco 25 +veintiséis 26 +veintisiete 27 +veintiocho 28 +veintinueve 29 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/es/data/numbers/zero.tsv new file mode 100644 index 0000000..9457852 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/numbers/zero.tsv @@ -0,0 +1 @@ +cero 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/es/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/es/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/es/data/ordinals/digit.tsv new file mode 100644 index 0000000..a478659 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/ordinals/digit.tsv @@ -0,0 +1,22 @@ +primero uno +primera uno +primer uno +segundo dos +segunda dos +tercero tres +tercera tres +tercer tres +cuarto cuatro +cuarta cuatro +quinto cinco +quinta cinco +sexto seis +sexta seis +séptimo siete +séptima siete +sétimo siete +sétima siete +octavo ocho +octava ocho +noveno nueve +novena nueve \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/ordinals/hundreds.tsv b/fun_text_processing/inverse_text_normalization/es/data/ordinals/hundreds.tsv new file mode 100644 index 0000000..4887306 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/ordinals/hundreds.tsv @@ -0,0 +1,18 @@ +centésimo ciento +centésima ciento +ducentésimo doscientos +ducentésima doscientos +tricentésimo trescientos +tricentésima trescientos +cuadringentésimo cuatrocientos +cuadringentésima cuatrocientos +quingentésimo quinientos +quingentésima quinientos +sexcentésimo seiscientos +sexcentésima seiscientos +septingentésimo setecientos +septingentésima setecientos +octingentésimo ochocientos +octingentésima ochocientos +noningentésimo novecientos +noningentésima novecientos \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/ordinals/teen.tsv b/fun_text_processing/inverse_text_normalization/es/data/ordinals/teen.tsv new file mode 100644 index 0000000..9463988 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/ordinals/teen.tsv @@ -0,0 +1,55 @@ +décimo diez +décima diez +decimoprimero once +decimoprimera once +decimoprimer once +décimo primero once +décima primera once +décimo primera once +décimo primer once +undécimo once +undécima once +decimosegundo doce +decimosegunda doce +décimo segundo doce +décima segunda doce +décimo segunda doce +duodécimo doce +duodécima doce +decimotercero trece +decimotercera trece +decimotercer trece +décimo tercero trece +décima tercera trece +décimo tercera trece +décimo tercer trece +decimocuarto catorce +decimocuarta catorce +décimo cuarto catorce +décima cuarta catorce +décimo cuarta catorce +decimoquinto quince +decimoquinta quince +décimo quinto quince +décima quinta quince +décimo quinta quince +decimosexto dieciséis +decimosexta dieciséis +décimo sexto dieciséis +décima sexta dieciséis +décimo sexta dieciséis +decimoséptimo diecisiete +decimoséptima diecisiete +décimo séptimo diecisiete +décima séptima diecisiete +décimo séptima diecisiete +decimoctavo dieciocho +decimoctava dieciocho +décimo octavo dieciocho +décima octava dieciocho +décimo octava dieciocho +decimonoveno diecinueve +decimonovena diecinueve +décimo noveno diecinueve +décima novena diecinueve +décimo novena diecinueve \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/ordinals/ties.tsv b/fun_text_processing/inverse_text_normalization/es/data/ordinals/ties.tsv new file mode 100644 index 0000000..5c22d55 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/ordinals/ties.tsv @@ -0,0 +1,15 @@ +vigésimo veinte +vigésima veinte +trigésimo treinta +cuadragésimo cuarenta +cuadragésima cuarenta +quincuagésimo cincuenta +quincuagésima cincuenta +sexagésimo sesenta +sexagésima sesenta +septuagésimo setenta +septuagésima setenta +octogésimo ochenta +octogésima ochenta +nonagésimo noventa +nonagésima noventa \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/ordinals/twenties.tsv b/fun_text_processing/inverse_text_normalization/es/data/ordinals/twenties.tsv new file mode 100644 index 0000000..4c1b177 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/ordinals/twenties.tsv @@ -0,0 +1,20 @@ +vigesimoprimero veintiuno +vigesimoprimera veintiuno +vigesimoprimer veintiuno +vigésimosegundo veintidós +vigésimosegunda veintidós +vigésimotercero veintitrés +vigésimotercera veintitrés +vigésimotercer veintitrés +vigésimocuarto veinticuatro +vigésimocuarta veinticuatro +vigésimoquinto veinticinco +vigésimoquinta veinticinco +vigésimosexto veintiséis +vigésimosexta veintiséis +vigésimoséptimo veintisiete +vigésimoséptima veintisiete +vigésimooctavo veintiocho +vigésimooctava veintiocho +vigésimonoveno veintinueve +vigésimonovena veintinueve \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/es/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/es/data/time/time_suffix.tsv b/fun_text_processing/inverse_text_normalization/es/data/time/time_suffix.tsv new file mode 100644 index 0000000..00604d9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/time/time_suffix.tsv @@ -0,0 +1,12 @@ +peme p.m. +pe eme p.m. +p m p.m. +pm p.m. +p.m. +p.m p.m. +ame a.m. +a eme a.m. +am a.m. +a.m. +a.m a.m. +a m a.m. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/time/time_to.tsv b/fun_text_processing/inverse_text_normalization/es/data/time/time_to.tsv new file mode 100644 index 0000000..71d4bcd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/time/time_to.tsv @@ -0,0 +1,24 @@ +la una las 12 +las dos la 1 +las tres las 2 +las cuatro las 3 +las cinco las 4 +las seis las 5 +las siete las 6 +las ocho las 7 +las nueve las 8 +las diez las 9 +las once las 10 +las doce las 11 +las trece las 12 +las catorce las 13 +las quince las 14 +las dieciséis las 15 +las diecisiete las 16 +las diecieocho las 17 +las diecinueve las 18 +las veinte las 19 +las veintiuna las 20 +las veintidos las 21 +las veintitres las 22 +las cero las 23 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/es/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/es/data/whitelist.tsv new file mode 100644 index 0000000..e1816d9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/data/whitelist.tsv @@ -0,0 +1,2 @@ +ud. usted +uds. ustedes diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/es/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/es/taggers/cardinal.py new file mode 100644 index 0000000..bb9ffd1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/cardinal.py @@ -0,0 +1,186 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. menos veintitrés -> cardinal { negative: "-" integer: "23"} + This class converts cardinals up to (but not including) "un cuatrillón", + i.e up to "one septillion" in English (10^{24}). + Cardinals below ten are not converted (in order to avoid + "vivo en una casa" --> "vivo en 1 casa" and any other odd conversions.) + + Although technically Spanish grammar requires that "y" only comes after + "10s" numbers (ie. "treinta", ..., "noventa"), these rules will convert + numbers even with "y" in an ungrammatical place (because "y" is ignored + inside cardinal numbers). + e.g. "mil y una" -> cardinal { integer: "1001"} + e.g. "ciento y una" -> cardinal { integer: "101"} + """ + + def __init__(self): + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + graph_hundreds = pynini.string_file(get_abs_path("data/numbers/hundreds.tsv")) + + graph_hundred_component = graph_hundreds | pynutil.insert("0") + graph_hundred_component += delete_space + graph_hundred_component += pynini.union( + graph_twenties | graph_teen | pynutil.insert("00"), + (graph_ties | pynutil.insert("0")) + delete_space + (graph_digit | pynutil.insert("0")), + ) + + graph_hundred_component_at_least_one_none_zero_digit = graph_hundred_component @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) + + graph_thousands = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("mil"), + pynutil.insert("001") + pynutil.delete("mil"), # because we say 'mil', not 'un mil' + pynutil.insert("000", weight=0.1), + ) + + graph_millones = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("millones") | pynutil.delete("millón")), + pynutil.insert("000") + pynutil.delete("millones"), # to allow for 'mil millones' + ) + + graph_mil_millones = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("mil"), + pynutil.insert("001") + pynutil.delete("mil"), # because we say 'mil', not 'un mil' + ) + graph_mil_millones += delete_space + ( + graph_millones | pynutil.insert("000") + pynutil.delete("millones") + ) # allow for 'mil millones' + graph_mil_millones |= pynutil.insert("000000", weight=0.1) + + # also allow 'millardo' instead of 'mil millones' + graph_millardo = ( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("millardo") | pynutil.delete("millardos")) + ) + + graph_billones = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("billones") | pynutil.delete("billón")), + ) + + graph_mil_billones = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("mil"), + pynutil.insert("001") + pynutil.delete("mil"), # because we say 'mil', not 'un mil' + ) + graph_mil_billones += delete_space + ( + graph_billones | pynutil.insert("000") + pynutil.delete("billones") + ) # allow for 'mil billones' + graph_mil_billones |= pynutil.insert("000000", weight=0.1) + + graph_trillones = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("trillones") | pynutil.delete("trillón")), + ) + + graph_mil_trillones = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("mil"), + pynutil.insert("001") + pynutil.delete("mil"), # because we say 'mil', not 'un mil' + ) + graph_mil_trillones += delete_space + ( + graph_trillones | pynutil.insert("000") + pynutil.delete("trillones") + ) # allow for 'mil trillones' + graph_mil_trillones |= pynutil.insert("000000", weight=0.1) + + graph = pynini.union( + (graph_mil_trillones | pynutil.insert("000", weight=0.1) + graph_trillones) + + delete_space + + (graph_mil_billones | pynutil.insert("000", weight=0.1) + graph_billones) + + delete_space + + pynini.union( + graph_mil_millones, + pynutil.insert("000", weight=0.1) + graph_millones, + graph_millardo + graph_millones, + graph_millardo + pynutil.insert("000", weight=0.1), + ) + + delete_space + + graph_thousands + + delete_space + + graph_hundred_component, + graph_zero, + ) + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + # ignore "y" inside cardinal numbers + graph = ( + pynini.cdrewrite(pynutil.delete("y"), DAMO_SPACE, DAMO_SPACE, DAMO_SIGMA) + @ (DAMO_ALPHA + DAMO_SIGMA) + @ graph + ) + + self.graph_no_exception = graph + + # save self.numbers_up_to_thousand for use in DecimalFst + digits_up_to_thousand = DAMO_DIGIT | (DAMO_DIGIT**2) | (DAMO_DIGIT**3) + numbers_up_to_thousand = pynini.compose(graph, digits_up_to_thousand).optimize() + self.numbers_up_to_thousand = numbers_up_to_thousand + + # save self.numbers_up_to_million for use in DecimalFst + digits_up_to_million = ( + DAMO_DIGIT + | (DAMO_DIGIT**2) + | (DAMO_DIGIT**3) + | (DAMO_DIGIT**4) + | (DAMO_DIGIT**5) + | (DAMO_DIGIT**6) + ) + numbers_up_to_million = pynini.compose(graph, digits_up_to_million).optimize() + self.numbers_up_to_million = numbers_up_to_million + + # don't convert cardinals from zero to nine inclusive + graph_exception = pynini.project(pynini.union(graph_digit, graph_zero), "input") + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("menos", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/date.py b/fun_text_processing/inverse_text_normalization/es/taggers/date.py new file mode 100644 index 0000000..7204f55 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/date.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. primero de enero -> date { day: "1" month: "enero" } + e.g. uno de enero -> date { day: "1" month: "enero" } + """ + + def __init__(self): + super().__init__(name="date", kind="classify") + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + + graph_1_to_100 = pynini.union( + graph_digit, + graph_twenties, + graph_teen, + (graph_ties + pynutil.insert("0")), + (graph_ties + pynutil.delete(" y ") + graph_digit), + ) + + digits_1_to_31 = [str(digits) for digits in range(1, 32)] + graph_1_to_31 = graph_1_to_100 @ pynini.union(*digits_1_to_31) + # can use "primero" for 1st day of the month + graph_1_to_31 = pynini.union(graph_1_to_31, pynini.cross("primero", "1")) + + day_graph = pynutil.insert('day: "') + graph_1_to_31 + pynutil.insert('"') + + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + + graph_dm = ( + day_graph + delete_space + pynutil.delete("de") + delete_extra_space + month_graph + ) + + final_graph = graph_dm + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/es/taggers/decimal.py new file mode 100644 index 0000000..2a3dd50 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/decimal.py @@ -0,0 +1,117 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_million: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_million: cardinal FST + """ + numbers = cardinal_up_to_million @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + + suffix = pynini.union( + "millón", + "millones", + "millardo", + "millardos", + "billón", + "billones", + "trillón", + "trillones", + "cuatrillón", + "cuatrillones", + ) + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + delete_extra_space + pynutil.insert('quantity: "') + suffix + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + Decimal point is either "." or ",", determined by whether "punto" or "coma" is spoken. + e.g. menos uno coma dos seis -> decimal { negative: "true" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" } + e.g. menos uno punto dos seis -> decimal { negative: "true" integer_part: "1" morphosyntactic_features: "." fractional_part: "26" } + + This decimal rule assumes that decimals can be pronounced as: + (a cardinal) + ('coma' or 'punto') plus (any sequence of cardinals <1000, including 'zero') + + Also writes large numbers in shortened form, e.g. + e.g. uno coma dos seis millón -> decimal { negative: "false" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" quantity: "millón" } + e.g. dos millones -> decimal { negative: "false" integer_part: "2" quantity: "millones" } + e.g. mil ochocientos veinticuatro millones -> decimal { negative: "false" integer_part: "1824" quantity: "millones" } + Args: + cardinal: CardinalFst + + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + # number after decimal point can be any series of cardinals <1000, including 'zero' + graph_decimal = cardinal.numbers_up_to_thousand + graph_decimal = pynini.closure(graph_decimal + delete_space) + graph_decimal + self.graph = graph_decimal + + # decimal point can be denoted by 'coma' or 'punto' + decimal_point = pynini.cross("coma", 'morphosyntactic_features: ","') + decimal_point |= pynini.cross("punto", 'morphosyntactic_features: "."') + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("menos", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + + cardinal_graph = cardinal.graph_no_exception | pynini.string_file( + get_abs_path("data/numbers/zero.tsv") + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + decimal_point + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.numbers_up_to_million + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.numbers_up_to_million + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/es/taggers/electronic.py new file mode 100644 index 0000000..76c5523 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/electronic.py @@ -0,0 +1,103 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import DAMO_ALPHA, GraphFst, insert_space +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying 'electronic' semiotic classes, i.e. + email address (which get converted to "username" and "domain" fields), + and URLS (which get converted to a "protocol" field). + e.g. c d f uno arroba a b c punto e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + e.g. doble ve doble ve doble ve a b c punto e d u -> tokens { electronic { protocol: "www.abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("punto", ".") + username = ( + pynutil.insert('username: "') + + alpha_num + + delete_extra_space + + pynini.closure(accepted_username + delete_extra_space) + + alpha_num + + pynutil.insert('"') + ) + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = ( + single_alphanum + | pynini.string_file(get_abs_path("data/electronic/server_name.tsv")).invert() + ) + domain = ( + single_alphanum + | pynini.string_file(get_abs_path("data/electronic/domain.tsv")).invert() + ) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete("arroba") + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross( + pynini.union("www", "w w w", "doble ve doble ve doble ve"), "www" + ) + protocol_start = pynini.cross(pynini.union("http", "h t t p", "hache te te pe"), "http") + protocol_start |= pynini.cross( + pynini.union("https", "h t t p s", "hache te te pe ese"), "https" + ) + protocol_start += pynini.cross(" dos puntos barra barra ", "://") + + # e.g. .com, .es + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + ( + domain + | pynini.closure( + accepted_username + delete_extra_space, + ) + + accepted_username + ) + ) + + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + delete_extra_space + + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + + pynini.closure(ending, 1) + ) + protocol = pynutil.insert('protocol: "') + protocol + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/measure.py b/fun_text_processing/inverse_text_normalization/es/taggers/measure.py new file mode 100644 index 0000000..0092a0a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/measure.py @@ -0,0 +1,97 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. menos doce kilogramos -> measure { cardinal { negative: "true" integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_unit_singular = pynini.string_file(get_abs_path("data/measurements_singular.tsv")) + graph_unit_singular = pynini.invert(graph_unit_singular) # singular -> abbr + graph_unit_plural = pynini.string_file(get_abs_path("data/measurements_plural.tsv")) + graph_unit_plural = pynini.invert(graph_unit_plural) # plural -> abbr + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("menos", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_singular = convert_space(graph_unit_singular) + unit_plural = convert_space(graph_unit_plural) + unit_misc = ( + pynutil.insert("/") + + pynutil.delete("por") + + delete_space + + convert_space(graph_unit_singular) + ) + + unit_singular = ( + pynutil.insert('units: "') + + ( + unit_singular + | unit_misc + | pynutil.add_weight(unit_singular + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + unit_plural = ( + pynutil.insert('units: "') + + ( + unit_plural + | unit_misc + | pynutil.add_weight(unit_plural + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "un" - "una" - "uno") @ cardinal_graph) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + (pynini.cross("un", "1") | pynini.cross("una", "1") | pynini.cross("uno", "1")) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/money.py b/fun_text_processing/inverse_text_normalization/es/taggers/money.py new file mode 100644 index 0000000..742484b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/money.py @@ -0,0 +1,106 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. doce dólares y cinco céntimos -> money { integer_part: "12" fractional_part: 05 currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + graph_decimal_final = decimal.final_graph_wo_negative + + unit_singular = pynini.string_file(get_abs_path("data/currency_singular.tsv")) + unit_singular = pynini.invert(unit_singular) + unit_plural = pynini.string_file(get_abs_path("data/currency_plural.tsv")) + unit_plural = pynini.invert(unit_plural) + + graph_unit_singular = ( + pynutil.insert('currency: "') + convert_space(unit_singular) + pynutil.insert('"') + ) + graph_unit_plural = ( + pynutil.insert('currency: "') + convert_space(unit_plural) + pynutil.insert('"') + ) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + # twelve dollars (and) fifty cents, zero cents + cents_standalone = ( + pynutil.insert('morphosyntactic_features: ","') # always use a comma in the decimal + + insert_space + + pynutil.insert('fractional_part: "') + + pynini.union( + pynutil.add_weight(((DAMO_SIGMA - "un") @ cardinal_graph), -0.7) + @ add_leading_zero_to_double_digit + + delete_space + + pynutil.delete(pynini.union("centavos", "céntimos")), + pynini.cross("un", "01") + + delete_space + + pynutil.delete(pynini.union("centavo", "céntimo")), + ) + + pynutil.insert('"') + ) + + optional_cents_standalone = pynini.closure( + delete_space + + pynini.closure((pynutil.delete("con") | pynutil.delete("y")) + delete_space, 0, 1) + + insert_space + + cents_standalone, + 0, + 1, + ) + # twelve dollars fifty, only after integer + # setenta y cinco dólares con sesenta y tres~$75,63 + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('morphosyntactic_features: ","') # always use a comma in the decimal + + insert_space + + pynutil.insert('fractional_part: "') + + pynini.closure((pynutil.delete("con") | pynutil.delete("y")) + delete_space, 0, 1) + + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "un" - "una") @ cardinal_graph) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_plural + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_integer |= ( + pynutil.insert('integer_part: "') + + (pynini.cross("un", "1") | pynini.cross("una", "1")) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_singular + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_decimal = graph_decimal_final + delete_extra_space + graph_unit_plural + graph_decimal |= pynutil.insert('currency: "$" integer_part: "0" ') + cents_standalone + final_graph = graph_integer | graph_decimal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/es/taggers/ordinal.py new file mode 100644 index 0000000..014e7ee --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/ordinal.py @@ -0,0 +1,91 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, GraphFst, delete_space +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + vigésimo primero -> ordinal { integer: "21" morphosyntactic_features: "o" } + This class converts ordinal up to "millesímo" (one thousandth) exclusive. + + Cardinals below ten are not converted (in order to avoid + e.g. "primero hice ..." -> "1.º hice...", "segunda guerra mundial" -> "2.ª guerra mundial" + and any other odd conversions.) + + This FST also records the ending of the ordinal (called "morphosyntactic_features"): + either "o", "a", or "er". + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="ordinal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + graph_digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")) + graph_teens = pynini.string_file(get_abs_path("data/ordinals/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/ordinals/twenties.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/ordinals/ties.tsv")) + graph_hundreds = pynini.string_file(get_abs_path("data/ordinals/hundreds.tsv")) + + ordinal_graph_union = pynini.union( + graph_digit, + graph_teens, + graph_twenties, + graph_ties, + graph_hundreds, + ) + + accept_o_endings = DAMO_SIGMA + pynini.accep("o") + accept_a_endings = DAMO_SIGMA + pynini.accep("a") + accept_er_endings = DAMO_SIGMA.closure() + pynini.accep("er") + + ordinal_graph_o = accept_o_endings @ ordinal_graph_union + ordinal_graph_a = accept_a_endings @ ordinal_graph_union + ordinal_graph_er = accept_er_endings @ ordinal_graph_union + + # 'optional_numbers_in_front' have negative weight so we always + # include them if they're there + optional_numbers_in_front = ( + pynutil.add_weight(ordinal_graph_union, -0.1) + delete_space.closure() + ).closure() + graph_o_suffix = (optional_numbers_in_front + ordinal_graph_o) @ cardinal_graph + graph_a_suffix = (optional_numbers_in_front + ordinal_graph_a) @ cardinal_graph + graph_er_suffix = (optional_numbers_in_front + ordinal_graph_er) @ cardinal_graph + + # don't convert ordinals from one to nine inclusive + graph_exception = pynini.project(pynini.union(graph_digit), "input") + graph_o_suffix = ( + pynini.project(graph_o_suffix, "input") - graph_exception.arcsort() + ) @ graph_o_suffix + graph_a_suffix = ( + pynini.project(graph_a_suffix, "input") - graph_exception.arcsort() + ) @ graph_a_suffix + graph_er_suffix = ( + pynini.project(graph_er_suffix, "input") - graph_exception.arcsort() + ) @ graph_er_suffix + + graph = ( + pynutil.insert('integer: "') + + graph_o_suffix + + pynutil.insert('"') + + pynutil.insert(' morphosyntactic_features: "o"') + ) + graph |= ( + pynutil.insert('integer: "') + + graph_a_suffix + + pynutil.insert('"') + + pynutil.insert(' morphosyntactic_features: "a"') + ) + graph |= ( + pynutil.insert('integer: "') + + graph_er_suffix + + pynutil.insert('"') + + pynutil.insert(' morphosyntactic_features: "er"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/es/taggers/punctuation.py new file mode 100644 index 0000000..dfe16fa --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/es/taggers/telephone.py new file mode 100644 index 0000000..d8c90a1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/telephone.py @@ -0,0 +1,134 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + uno dos tres uno dos tres cinco seis siete ocho -> { number_part: "123-123-5678" }. + If 10 digits are spoken, they are grouped as 3+3+4 (eg. 123-456-7890). + If 9 digits are spoken, they are grouped as 3+3+3 (eg. 123-456-789). + If 8 digits are spoken, they are grouped as 4+4 (eg. 1234-5678). + In Spanish, digits are generally spoken individually, or as 2-digit numbers, + eg. "one twenty three" = "123", + "twelve thirty four" = "1234". + + (we ignore more complicated cases such as "three hundred and two" or "three nines"). + """ + + def __init__(self): + super().__init__(name="telephone", kind="classify") + + # create `single_digits` and `double_digits` graphs as these will be + # the building blocks of possible telephone numbers + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + + single_digits = pynini.invert(graph_digit).optimize() | pynini.cross("0", "cero") + + double_digits = pynini.union( + graph_twenties, + graph_teen, + (graph_ties + pynutil.insert("0")), + (graph_ties + delete_space + pynutil.delete("y") + delete_space + graph_digit), + ).invert() + + # define `ten_digit_graph`, `nine_digit_graph`, `eight_digit_graph` + # which accept telephone numbers spoken (1) only with single digits, + # or (2) spoken with double digits (and sometimes single digits) + + # 10-digit option (1): all single digits + ten_digit_graph = ( + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + single_digits + ) + + # 10-digit option (2): (1+2) + (1+2) + (2+2) digits + ten_digit_graph |= ( + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + # 9-digit option (1): all single digits + nine_digit_graph = ( + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 2, 2) + + single_digits + ) + + # 9-digit option (2): (1+2) + (1+2) + (1+2) digits + nine_digit_graph |= ( + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + single_digits + + insert_space + + double_digits + ) + + # 8-digit option (1): all single digits + eight_digit_graph = ( + pynini.closure(single_digits + insert_space, 4, 4) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + single_digits + ) + + # 8-digit option (2): (2+2) + (2+2) digits + eight_digit_graph |= ( + double_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + number_part = pynini.union( + ten_digit_graph, + nine_digit_graph, + eight_digit_graph, + ) + + number_part = ( + pynutil.insert('number_part: "') + pynini.invert(number_part) + pynutil.insert('"') + ) + + graph = number_part + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/time.py b/fun_text_processing/inverse_text_normalization/es/taggers/time.py new file mode 100644 index 0000000..9fa5cf2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/time.py @@ -0,0 +1,139 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + Time formats that it converts: + - + + e.g. la una diez -> time { hours: "la 1" minutes: "10" } + - + " y " + + e.g. la una y diez -> time { hours: "la 1" minutes: "10" } + - + " con " + + e.g. la una con diez -> time { hours: "la 1" minutes: "10" } + - + " menos " + + e.g. las dos menos cuarto -> time { hours: "la 1" minutes: "45" } + - "(un) cuarto para " + + e.g. cuarto para las dos -> time { minutes: "45" hours: "la 1" } + + Note that times on the hour (e.g. "las dos" i.e. "two o'clock") do not get + converted into a time format. This is to avoid converting phrases that are + not part of a time phrase (e.g. "las dos personas" i.e. "the two people") + e.g. las dos -> tokens { name: "las" } tokens { name: "dos" } + However, if a time on the hour is followed by a suffix (indicating 'a.m.' + or 'p.m.'), it will be converted. + e.g. las dos pe eme -> time { hours: "las 2" minutes: "00" suffix: "p.m." } + + Note that although the TimeFst verbalizer can accept 'zone' (timezone) fields, + so far the rules have not been added to the TimeFst tagger to process + timezones (to keep the rules simple, and because timezones are not very + often specified in Spanish.) + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + + suffix_graph = pynini.string_file(get_abs_path("data/time/time_suffix.tsv")) + time_to_graph = pynini.string_file(get_abs_path("data/time/time_to.tsv")) + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + + graph_1_to_100 = pynini.union( + graph_digit, + graph_twenties, + graph_teen, + (graph_ties + pynutil.insert("0")), + (graph_ties + pynutil.delete(" y ") + graph_digit), + ) + + # note that graph_hour will start from 2 hours + # "1 o'clock" will be treated differently because it + # is singular + digits_2_to_23 = [str(digits) for digits in range(2, 24)] + digits_1_to_59 = [str(digits) for digits in range(1, 60)] + + graph_1oclock = pynini.cross("la una", "la 1") + graph_hour = pynini.cross("las ", "las ") + graph_1_to_100 @ pynini.union(*digits_2_to_23) + graph_minute = graph_1_to_100 @ pynini.union(*digits_1_to_59) + graph_minute_verbose = pynini.cross("media", "30") | pynini.cross("cuarto", "15") + + final_graph_hour = ( + pynutil.insert('hours: "') + (graph_1oclock | graph_hour) + pynutil.insert('"') + ) + + final_graph_minute = ( + pynutil.insert('minutes: "') + + pynini.closure((pynutil.delete("y") | pynutil.delete("con")) + delete_space, 0, 1) + + (graph_minute | graph_minute_verbose) + + pynutil.insert('"') + ) + + final_suffix = ( + pynutil.insert('suffix: "') + convert_space(suffix_graph) + pynutil.insert('"') + ) + final_suffix_optional = pynini.closure(delete_space + insert_space + final_suffix, 0, 1) + + # las nueve a eme (only convert on-the-hour times if they are followed by a suffix) + graph_hsuffix = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "00"') + + insert_space + + final_suffix + ) + + # las nueve y veinticinco + graph_hm = final_graph_hour + delete_extra_space + final_graph_minute + + # un cuarto para las cinco + graph_mh = ( + pynutil.insert('minutes: "') + + pynini.union( + pynini.cross("un cuarto para", "45"), + pynini.cross("cuarto para", "45"), + ) + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('hours: "') + + time_to_graph + + pynutil.insert('"') + ) + + # las diez menos diez + graph_time_to = ( + pynutil.insert('hours: "') + + time_to_graph + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('minutes: "') + + delete_space + + pynutil.delete("menos") + + delete_space + + pynini.union( + pynini.cross("cinco", "55"), + pynini.cross("diez", "50"), + pynini.cross("cuarto", "45"), + pynini.cross("veinte", "40"), + pynini.cross("veinticinco", "30"), + ) + + pynutil.insert('"') + ) + final_graph = pynini.union( + (graph_hm | graph_mh | graph_time_to) + final_suffix_optional, graph_hsuffix + ).optimize() + + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/es/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..3851de2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/tokenize_and_classify.py @@ -0,0 +1,103 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.es.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.es.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.es.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.es.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.es.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.es.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.es.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.es.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.es.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.es.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.es.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.es.taggers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_es_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst(cardinal) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst().fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst().fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.09) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/es/taggers/whitelist.py new file mode 100644 index 0000000..09c3286 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. usted -> tokens { name: "ud." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/taggers/word.py b/fun_text_processing/inverse_text_normalization/es/taggers/word.py new file mode 100644 index 0000000..9758f68 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/utils.py b/fun_text_processing/inverse_text_normalization/es/utils.py new file mode 100644 index 0000000..c6fdb74 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/utils.py @@ -0,0 +1,13 @@ +import os + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/cardinal.py new file mode 100644 index 0000000..005fae0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { negative: "-" integer: "23" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/date.py new file mode 100644 index 0000000..b708ade --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/date.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { day: "1" month: "enero" preserve_order: true } -> 1 de enero + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + # day month + graph_dm = day + delete_extra_space + pynutil.insert("de") + insert_space + month + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = graph_dm + delete_space + optional_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/decimal.py new file mode 100644 index 0000000..346e15b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/decimal.py @@ -0,0 +1,56 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, + e.g. decimal { negative: "true" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" } -> -1,26 + e.g. decimal { negative: "true" integer_part: "1" morphosyntactic_features: "." fractional_part: "26" } -> -1.26 + e.g. decimal { negative: "false" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" quantity: "millón" } -> 1,26 millón + e.g. decimal { negative: "false" integer_part: "2" quantity: "millones" } -> 2 millones + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + + decimal_point = pynini.cross('morphosyntactic_features: ","', ",") + decimal_point |= pynini.cross('morphosyntactic_features: "."', ".") + + fractional = ( + decimal_point + + delete_space + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/electronic.py new file mode 100644 index 0000000..bcdf689 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + e.g. tokens { electronic { protocol: "www.abc.edu" } } -> www.abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/measure.py new file mode 100644 index 0000000..b2005c3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/measure.py @@ -0,0 +1,47 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, delete_space +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { cardinal { negative: "true" integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + pynutil.insert(" ") + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/money.py new file mode 100644 index 0000000..566a385 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/money.py @@ -0,0 +1,26 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, delete_space +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" morphosyntactic_features: "," fractional_part: "05" currency: "$" } -> $12,05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/ordinal.py new file mode 100644 index 0000000..017cddf --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/ordinal.py @@ -0,0 +1,35 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" morphosyntactic_features: "o" } -> 13.º + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + replace_suffix = pynini.union( + pynini.cross(' morphosyntactic_features: "o"', ".º"), + pynini.cross(' morphosyntactic_features: "a"', ".ª"), + pynini.cross(' morphosyntactic_features: "er"', ".ᵉʳ"), + ) + + graph = graph + replace_suffix + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/telephone.py new file mode 100644 index 0000000..8c30c08 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/telephone.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/time.py new file mode 100644 index 0000000..3214678 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/time.py @@ -0,0 +1,70 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, + e.g. time { hours: "la 1" minutes: "10" } -> la 1:10 + e.g. time { hours: "la 1" minutes: "45" } -> la 1:45 + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + + # hour includes preposition ("la" or "las") + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.union("la ", "las ") + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + suffix = ( + delete_space + + insert_space + + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + zone = ( + delete_space + + insert_space + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + graph = ( + hour + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + optional_suffix + + optional_zone + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/verbalize.py new file mode 100644 index 0000000..8a25015 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/verbalize.py @@ -0,0 +1,48 @@ +from fun_text_processing.inverse_text_normalization.es.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.en.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/verbalize_final.py new file mode 100644 index 0000000..19e6e49 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.es.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.es.verbalizers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/whitelist.py new file mode 100644 index 0000000..da019c5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "uds." } -> uds. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/es/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/es/verbalizers/word.py new file mode 100644 index 0000000..1d33cd1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/es/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/export_models.py b/fun_text_processing/inverse_text_normalization/export_models.py new file mode 100644 index 0000000..0597f7f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/export_models.py @@ -0,0 +1,127 @@ +import os +from time import perf_counter +from argparse import ArgumentParser +from fun_text_processing.text_normalization.en.graph_utils import generator_main + + +def parse_args(): + parser = ArgumentParser() + + parser.add_argument( + "--language", + help="language", + choices=["de", "en", "es", "fr", "id", "ja", "ko", "pt", "ru", "vi", "zh"], + default="en", + type=str, + ) + parser.add_argument( + "--export_dir", + help="path to export directory. Default to current directory.", + default="./", + type=str, + ) + return parser.parse_args() + + +def get_grammars(lang: str = "en"): + if lang == "de": + from fun_text_processing.inverse_text_normalization.de.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.de.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "en": + from fun_text_processing.inverse_text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "es": + from fun_text_processing.inverse_text_normalization.es.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.es.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "fr": + from fun_text_processing.inverse_text_normalization.fr.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.fr.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "id": + from fun_text_processing.inverse_text_normalization.id.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.id.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "ja": + from fun_text_processing.inverse_text_normalization.ja.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.ja.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "ko": + from fun_text_processing.inverse_text_normalization.ko.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.ko.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "pt": + from fun_text_processing.inverse_text_normalization.pt.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.pt.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "ru": + from fun_text_processing.inverse_text_normalization.ru.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.ru.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "vi": + from fun_text_processing.inverse_text_normalization.vi.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.vi.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "zh": + from fun_text_processing.inverse_text_normalization.zh.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.zh.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + else: + from fun_text_processing.inverse_text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + return ClassifyFst().fst, VerbalizeFinalFst().fst + + +if __name__ == "__main__": + args = parse_args() + + export_dir = args.export_dir + os.makedirs(export_dir, exist_ok=True) + tagger_far_file = os.path.join(export_dir, args.language + "_itn_tagger.far") + verbalizer_far_file = os.path.join(export_dir, args.language + "_itn_verbalizer.far") + + start_time = perf_counter() + tagger_fst, verbalizer_fst = get_grammars(args.language) + generator_main(tagger_far_file, {"tokenize_and_classify": tagger_fst}) + generator_main(verbalizer_far_file, {"verbalize": verbalizer_fst}) + print(f"Time to generate graph: {round(perf_counter() - start_time, 2)} sec") diff --git a/fun_text_processing/inverse_text_normalization/fr/README.md b/fun_text_processing/inverse_text_normalization/fr/README.md new file mode 100644 index 0000000..049f718 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/README.md @@ -0,0 +1,30 @@ +# Note on French spelling + +Due to a 1990 orthographic reform, there are currently two conventions for written French numbers: + +1. **Reformed** All composite words are joined by a hyphen: +e.g. `1122 -> mille-cent-vingt-deux` + +2. **Traditional** Hyphenation only occurs (with exception) for numbers from 17 to 99 (inclusive): +e.g. `1122 -> mille cent vingt-deux` + +As available training data for upstream ASR will vary in use of convention, NeMo's French ITN accomodates either style for normalization e.g. + +``` + python inverse_normalize.py "mille-cent-vingt-deux" --language="fr" --> 1122 + python inverse_normalize.py "mille cent vingt-deux" --language="fr" --> 1122 +``` + +As a result, there exists some ambiguity in the case of currency conversions, namely minor denominations of the dollar e.g. + +``` + 300 -> "trois-cents" # Reformed spelling + 300 -> "trois cents" # Traditional spelling + 3 ¢ -> "trois cents" # Valid for both +``` + +Cardinals take priority in such cases. + +``` +python inverse_normalize.py "trois cents" --language="fr" -> 300 +``` diff --git a/fun_text_processing/inverse_text_normalization/fr/__init__.py b/fun_text_processing/inverse_text_normalization/fr/__init__.py new file mode 100644 index 0000000..a5fc721 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.fr.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.fr.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/fr/data/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/fr/data/electronic/domain.tsv new file mode 100644 index 0000000..8053757 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/electronic/domain.tsv @@ -0,0 +1,25 @@ +com +es +uk +fr +net +br +in +ru +de +it +edu +co +ar +bo +cl +co +ec +fk +gf +fy +pe +py +sr +ve +uy \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/fr/data/electronic/server_name.tsv new file mode 100644 index 0000000..cf6bbf4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +google +comcast \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/fr/data/electronic/symbols.tsv new file mode 100644 index 0000000..198f13c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/electronic/symbols.tsv @@ -0,0 +1,12 @@ +chez @ +at @ +à @ +arobase @ +point . +barre oblique / +tiret - +tiret bas _ +souligné _ +sous-tiret _ +blanc souligné _ +underscore _ \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/fractions.tsv b/fun_text_processing/inverse_text_normalization/fr/data/fractions.tsv new file mode 100644 index 0000000..5f18ea2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/fractions.tsv @@ -0,0 +1,41 @@ +demie deux +demies deux +demi deux +demis deux +tiers trois +quart quatre +quarts quatre +quatrièmes quatre +quatrième quatre +cinquième cinq +cinquièmes cinq +neuvième neuf +neuvièmes neuf +onzième onze +onzièmes onze +douzième douze +douzièmes douze +treizième treize +treizièmes treize +quatorzième quatorze +quatorzièmes quatorze +quinzième quinze +quinzièmes quinze +seizième seize +seizièmes seize +trentième trente +trentièmes trente +quarantième quarante +quarantièmes quarante +cinquantième cinquante +cinquantièmes cinquante +soixantième soixante +soixantièmes soixante +septantième septante +septantièmes septante +huitantième huitante +huitantièmes huitante +nonantième nonante +nonantièmes nonante +millième mille +millièmes mille \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/measurements/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/measurements/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/measurements/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/measurements/magnitudes.tsv b/fun_text_processing/inverse_text_normalization/fr/data/measurements/magnitudes.tsv new file mode 100644 index 0000000..ded57b9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/measurements/magnitudes.tsv @@ -0,0 +1,16 @@ +exa E +péta P +téra T +giga G +méga M +kilo k +hecto h +déca da +déci d +centi c +milli m +micro µ +nano n +pico p +femto f +atto a \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/measurements/measurements.tsv b/fun_text_processing/inverse_text_normalization/fr/data/measurements/measurements.tsv new file mode 100644 index 0000000..91ca880 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/measurements/measurements.tsv @@ -0,0 +1,27 @@ +mètre m +mètre carré m² +mètres carrés m² +mètre cube m³ +mètres cubes m³ +seconde s +minute min +heure h +degré ° +degrés ° +degré celsius °C +degrés celsius °C +gramme g +litre l +kilo kg +pouce '' +livre lb +poid lb +mile ml +pour cent % +pour mille ‰ +mètre heure km/h +mètres heure m/h +mètre à l’heure m/h +mètres à l’heure m/h +mètre par l’heure m/h +mètres par l’heure m/h \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/money/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/money/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/money/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/money/currency_major.tsv b/fun_text_processing/inverse_text_normalization/fr/data/money/currency_major.tsv new file mode 100644 index 0000000..3f9e1ce --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/money/currency_major.tsv @@ -0,0 +1,40 @@ +dollar $ +dollars $ +dollar américain $ US +dollars américains $ US +dollar des États-Unis $ US +dollars des États-Unis $ US +dollar canadien $ CA +dollars canadiens $ CA +dollar australien $ AU +dollars australien $ AU +dollar néo-zélandais $ NZ +dollars néo-zélandais $ NZ +dollar de Hong Kong $ HK +dollars de Hong Kong $ HK +euro € +euros € +livre sterling £ +livre £ +livres £ +livre britannique £ +livres britanniques £ +sterling £ +won ₩ +won sud-coréen ₩ +yen japonais ¥ +yens japonais ¥ +yen ¥ +yens ¥ +yuan ¥ +yuans ¥ +franc CHF +franc suisse CHF +dinar algérien DA +dinars algériens DA +dinar DA +dinars DA +dirham marocain DH +dirhams marocains DH +dirham DH +dirhams DH \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/money/currency_minor.tsv b/fun_text_processing/inverse_text_normalization/fr/data/money/currency_minor.tsv new file mode 100644 index 0000000..f5622c2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/money/currency_minor.tsv @@ -0,0 +1,5 @@ +centime € +centimes € +eurocent € +eurocents € +pence £ \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/months.tsv b/fun_text_processing/inverse_text_normalization/fr/data/months.tsv new file mode 100644 index 0000000..5051c68 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/months.tsv @@ -0,0 +1,12 @@ +janvier +février +mars +avril +mai +juin +juillet +août +septembre +octobre +novembre +décembre \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/fr/data/numbers/digit.tsv new file mode 100644 index 0000000..1cb4992 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/digit.tsv @@ -0,0 +1,10 @@ +un 1 +une 1 +deux 2 +trois 3 +quatre 4 +cinq 5 +six 6 +sept 7 +huit 8 +neuf 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/hundreds.tsv b/fun_text_processing/inverse_text_normalization/fr/data/numbers/hundreds.tsv new file mode 100644 index 0000000..f23060a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/hundreds.tsv @@ -0,0 +1,2 @@ +cent +cents \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/fr/data/numbers/teen.tsv new file mode 100644 index 0000000..0229696 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/teen.tsv @@ -0,0 +1,6 @@ +onze 11 +douze 12 +treize 13 +quatorze 14 +quinze 15 +seize 16 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/thousands.tsv b/fun_text_processing/inverse_text_normalization/fr/data/numbers/thousands.tsv new file mode 100644 index 0000000..f77e514 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/thousands.tsv @@ -0,0 +1,23 @@ +mille +million +millions +milliard +milliards +billion +billions +trillion +trillions +quadrillion +quadrillions +quintillion +quintillions +sextillion +sextillions +septillion +septillions +octillion +octillions +nonillion +nonillions +decillion +decillions \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/fr/data/numbers/ties.tsv new file mode 100644 index 0000000..b4dc2d6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/ties.tsv @@ -0,0 +1,13 @@ +dix 1 +vingt 2 +vingts 2 +trente 3 +quarante 4 +cinquante 5 +soixante 6 +soixante-dix 7 +septante 7 +huitante 8 +quatre-vingt 8 +quatre-vingt-dix 9 +nonante 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/ties_unique.tsv b/fun_text_processing/inverse_text_normalization/fr/data/numbers/ties_unique.tsv new file mode 100644 index 0000000..2729167 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/ties_unique.tsv @@ -0,0 +1,25 @@ +vingts 20 +vingt-et-un 21 +vingt-et-une 21 +trente-et-un 31 +trente-et-une 31 +quarante-et-un 41 +quarante-et-une 41 +cinquante-et-un 51 +cinquante-et-une 51 +soixante-et-un 61 +soixante-et-une 61 +soixante-et-onze 71 +soixante-douze 72 +soixante-treize 73 +soixante-quatorze 74 +soixante-quinze 75 +soixante-seize 76 +quatre-vingts 80 +quatre-vingt 80 +quatre-vingt-onze 91 +quatre-vingt-douze 92 +quatre-vingt-treize 93 +quatre-vingt-quatorze 94 +quatre-vingt-quinze 95 +quatre-vingt-seize 96 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/fr/data/numbers/zero.tsv new file mode 100644 index 0000000..3ee7c2a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/numbers/zero.tsv @@ -0,0 +1 @@ +zéro 0 diff --git a/fun_text_processing/inverse_text_normalization/fr/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/ordinals/digits_root_change.tsv b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/digits_root_change.tsv new file mode 100644 index 0000000..ab7c438 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/digits_root_change.tsv @@ -0,0 +1,17 @@ +quatrième quatre +cinquième cinq +neuvième neuf +onzième onze +douzième douze +treizième treize +quatorzième quatorze +quinzième quinze +seizième seize +trentième trente +quarantième quarante +cinquantième cinquante +soixantième soixante +septantième septante +huitantième huitante +nonantième nonante +millième mille \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/ordinals/firsts.tsv b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/firsts.tsv new file mode 100644 index 0000000..d648b34 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/firsts.tsv @@ -0,0 +1,4 @@ +premier er +premiers ers +première re +premières res \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/ordinals/key_nouns.tsv b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/key_nouns.tsv new file mode 100644 index 0000000..543e4f0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/key_nouns.tsv @@ -0,0 +1 @@ +siècle \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/ordinals/second.tsv b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/second.tsv new file mode 100644 index 0000000..2eaead5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/ordinals/second.tsv @@ -0,0 +1,4 @@ +second d +seconde de +seconds ds +secondes des \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/roman/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/roman/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/roman/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/roman/digits_large.tsv b/fun_text_processing/inverse_text_normalization/fr/data/roman/digits_large.tsv new file mode 100644 index 0000000..e5fde2c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/roman/digits_large.tsv @@ -0,0 +1,9 @@ +I 1 +II 2 +III 3 +IV 4 +V 5 +VI 6 +VII 7 +VIII 8 +IX 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/roman/hundreds_large.tsv b/fun_text_processing/inverse_text_normalization/fr/data/roman/hundreds_large.tsv new file mode 100644 index 0000000..5e04779 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/roman/hundreds_large.tsv @@ -0,0 +1,9 @@ +C 1 +CC 2 +CCC 3 +CD 4 +D 5 +DC 6 +DCC 7 +DCCC 8 +CM 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/roman/ties_large.tsv b/fun_text_processing/inverse_text_normalization/fr/data/roman/ties_large.tsv new file mode 100644 index 0000000..445773d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/roman/ties_large.tsv @@ -0,0 +1,9 @@ +X 1 +XX 2 +XXX 3 +XL 4 +L 5 +LX 6 +LXX 7 +LXXX 8 +XC 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/suppletive.tsv b/fun_text_processing/inverse_text_normalization/fr/data/suppletive.tsv new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/fr/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/hour_to_night.tsv b/fun_text_processing/inverse_text_normalization/fr/data/time/hour_to_night.tsv new file mode 100644 index 0000000..1374f45 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/hour_to_night.tsv @@ -0,0 +1,12 @@ +1 13 +2 14 +3 15 +4 16 +5 17 +6 18 +7 19 +8 20 +9 21 +10 22 +11 23 +12 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/hours.tsv b/fun_text_processing/inverse_text_normalization/fr/data/time/hours.tsv new file mode 100644 index 0000000..732b2b0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/hours.tsv @@ -0,0 +1,26 @@ +zéro 0 +une 1 +deux 2 +trois 3 +quatre 4 +cinq 5 +six 6 +sept 7 +huit 8 +neuf 9 +dix 10 +onze 11 +douze 12 +treize 13 +quatorze 14 +quinze 15 +seize 16 +dix-sept 17 +dix-huit 18 +dix-neuf 19 +vingt 20 +vingt-et-une 21 +vingt et une +vingt-deux 22 +vingt-trois 23 +vingt-quatre 24 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/hours_to.tsv b/fun_text_processing/inverse_text_normalization/fr/data/time/hours_to.tsv new file mode 100644 index 0000000..a562195 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/hours_to.tsv @@ -0,0 +1,25 @@ +1 0 +2 1 +3 2 +4 3 +5 4 +6 5 +7 6 +8 7 +9 8 +10 9 +11 10 +12 11 +13 12 +14 13 +15 14 +16 15 +17 16 +18 17 +19 18 +20 19 +21 20 +22 21 +23 22 +24 23 +0 23 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/minutes.tsv b/fun_text_processing/inverse_text_normalization/fr/data/time/minutes.tsv new file mode 100644 index 0000000..c0a5554 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/minutes.tsv @@ -0,0 +1,63 @@ +une 01 +deux 02 +trois 03 +quatre 04 +cinq 05 +six 06 +sept 07 +huit 08 +neuf 09 +dix 10 +onze 11 +douze 12 +treize 13 +quatorze 14 +quinze 15 +seize 16 +dix-sept 17 +dix-huit 18 +dix-neuf 19 +vingt 20 +vingt-et-une 21 +vingt et une 21 +vingt-deux 22 +vingt-trois 23 +vingt-quatre 27 +vingt-cinq 25 +vingt-six 26 +vingt-sept 27 +vingt-huit 28 +vingt-neuf 29 +trente 30 +trente-et-une 31 +trente et une 31 +trente-deux 32 +trente-trois 33 +trente-quatre 34 +trente-cinq 35 +trente-six 36 +trente-sept 37 +trente-huit 38 +trente-neuf 39 +quarante 40 +quarante-et-une 41 +quarante et une 41 +quarante-deux 42 +quarante-trois 43 +quarante-quatre 44 +quarante-cinq 45 +quarante-six 46 +quarante-sept 47 +quarante-huit 48 +quarante-neuf 49 +cinquante 50 +cinquante-et-une 51 +cinquante et une 51 +cinquante-deux 52 +cinquante-trois 53 +cinquante-quatre 54 +cinquante-cinq 55 +cinquante-six 56 +cinquante-sept 57 +cinquante-huit 58 +cinquante-neuf 59 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/minutes_to.tsv b/fun_text_processing/inverse_text_normalization/fr/data/time/minutes_to.tsv new file mode 100644 index 0000000..d8516a9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/minutes_to.tsv @@ -0,0 +1,59 @@ +01 59 +02 58 +03 57 +04 56 +05 55 +06 54 +07 53 +08 52 +09 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 09 +52 08 +53 07 +54 06 +55 05 +56 04 +57 03 +58 02 +59 01 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/time_suffix_am.tsv b/fun_text_processing/inverse_text_normalization/fr/data/time/time_suffix_am.tsv new file mode 100644 index 0000000..7ae3693 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/time_suffix_am.tsv @@ -0,0 +1 @@ +du matin \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/time/time_suffix_pm.tsv b/fun_text_processing/inverse_text_normalization/fr/data/time/time_suffix_pm.tsv new file mode 100644 index 0000000..3cad151 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/time/time_suffix_pm.tsv @@ -0,0 +1,2 @@ +de l'après-midi +du soir \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/fr/data/whitelist.tsv new file mode 100644 index 0000000..1a09a2e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/data/whitelist.tsv @@ -0,0 +1,16 @@ +monsieur M. +messieurs MM. +madame Mᵐᵉ +mesdames Mᵐᵉˢ +mademoiselle Mˡˡᵉ +mademoiselles Mˡˡᵉˢ +docteur Dʳ +docteurs Dʳˢ +docteure Dʳᵉ +docteures Dʳᵉˢ +après jésus-christ apr. J.-C. +avant Jésus-Christ av. J.-C. +ca v. +vers v. +l’honorable le hon. +le très hononrable le très hon. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/fr/graph_utils.py b/fun_text_processing/inverse_text_normalization/fr/graph_utils.py new file mode 100644 index 0000000..4b2cc42 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/graph_utils.py @@ -0,0 +1,180 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini import Far +from pynini.examples import plurals +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") + +# French frequently compounds numbers with hyphen. +delete_hyphen = pynutil.delete(pynini.closure("-", 0, 1)) +insert_hyphen = pynutil.insert("-") +suppletive = pynini.string_file(get_abs_path("data/suppletive.tsv")) + +_s = DAMO_SIGMA + pynutil.insert("s") +_x = DAMO_SIGMA + pynini.string_map([("eau"), ("eu"), ("ou")]) + pynutil.insert("x") +_aux = DAMO_SIGMA + pynini.string_map([("al", "aux"), ("ail", "aux")]) + +graph_plural = plurals._priority_union( + suppletive, plurals._priority_union(_s, pynini.union(_x, _aux), DAMO_SIGMA), DAMO_SIGMA +).optimize() + +SINGULAR_TO_PLURAL = graph_plural +PLURAL_TO_SINGULAR = pynini.invert(graph_plural) +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) + + +def generator_main(file_name: str, graphs: Dict[str, pynini.FstLike]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def get_plurals(fst): + """ + Given singular returns plurals + + Args: + fst: Fst + + Returns plurals to given singular forms + """ + return SINGULAR_TO_PLURAL @ fst + + +def get_singulars(fst): + """ + Given plural returns singulars + + Args: + fst: Fst + + Returns singulars to given plural forms + """ + return PLURAL_TO_SINGULAR @ fst + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + + Args: + fst: input fst + + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/fr/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/fr/taggers/cardinal.py new file mode 100644 index 0000000..39901a9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/cardinal.py @@ -0,0 +1,287 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_hyphen, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +def rewrite(cardinal: "pynini.FstLike") -> "pynini.FstLike": + """ + Function to rewrite cardinals written in traditional orthograph (no '-' for numbers >100) + to current orthography ('-' between all words in number string) + e.g. deux mille cent vingt-trois -> deux-mille-cent-vingt-trois. + In cases where original orthography is current, or string is mixture of two orthographies, + will render invalid form that will not pass through CardinalFst + e.g. deux-mille cent-vingt-trois -> "deux##vingt-trois" ('#' is not accepted in cardinal FST and will fail to convert.) + e.g. deux + + Args: + cardinal: cardinal FST + """ + + # Traditional orthography does not hyphenate numbers > 100, this will insert hyphens in + # those contexts. + targets = pynini.string_map( + [ + "et", # for 'et un/onze' + "cent", + "mille", + "million", + "milliard", + "billion", + "billiard", + "trillion", + "trilliard", + ] + ) + targets += pynini.accep("s").ques + + no_spaces = pynini.closure(DAMO_NOT_SPACE) + + # Valid numbers in reformed orthography will have no spaces. + new_orthography_sigma = no_spaces + + # Old orthography will not have these strings. Replacing with character to mark. + targets_for_filtering = ("-" + targets) | ("-" + targets + "-") | (targets + "-") + + filter = pynini.cdrewrite( + pynini.cross(targets_for_filtering, "#"), "", "", DAMO_SIGMA + ) # Invalid for cardinal + + old_orthography_sigma = pynini.difference( + DAMO_CHAR, "#" + ) # Marked character removed from sigma_star. + old_orthography_sigma.closure() + + # Only accept strings that occur in old orthography. (This avoids tying two non-related numbers together.) + # e.g. mille cent-une -> mille-cent-une + filter @= old_orthography_sigma + + # Now know replacements will only work around targets + replace_left = pynini.cdrewrite(pynini.cross(" ", "-"), "", targets, DAMO_SIGMA) + + replace_right = pynini.cdrewrite(pynini.cross(" ", "-"), targets, "", DAMO_SIGMA) + + replace = replace_left @ replace_right + + graph = new_orthography_sigma | (filter @ replace) + + return graph @ cardinal + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. mois vingt-trois -> cardinal { negative: "-" integer: "23"} + This class converts cardinals up to (but not including) "un-quatrillion", + i.e up to "one septillion" in English (10^{24}). + Cardinals below nine are not converted (in order to avoid + "j'ai un pomme." --> "j'ai 1 pomme" and any other odd conversions.) + This transducer accomodates both traditional hyphenation of numbers ('-' for most numbers <100) + and current hyphenation (all elements of number are hyphenated), prioritizing the latter. + e.g cent cinquante et un -> cardinal { integer: "151"} + cent-cinquante-et-un -> cardinal { integer: "151"} + This is done through a context dependent rewrite that attempts to map old spelling to new. + e.g. cent cinquante et un -> cent-cinquante-et-un + """ + + def __init__(self): + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_teens = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_ties_unique = pynini.string_file(get_abs_path("data/numbers/ties_unique.tsv")) + + # Tens components + graph_tens_component = graph_ties + ((delete_hyphen + graph_digit) | pynutil.insert("0")) + graph_tens_component = pynini.union(graph_tens_component, graph_teens, graph_ties_unique) + + graph_tens_component_with_leading_zeros = pynini.union( + graph_tens_component, + (pynutil.insert("0") + (graph_digit | pynutil.insert("0", weight=0.01))), + ) + + # Hundreds components + graph_cent_singular = pynutil.delete("cent") # Used in hundreds place + graph_cent_plural = pynini.cross( + "cents", "00" + ) # Only used as terminus of hundred sequence. deux cents -> 200, deux cent un -> 201 + + graph_digit_no_one = pynini.project(pynini.union("un", "une"), "input") + graph_digit_no_one = ( + pynini.project(graph_digit, "input") - graph_digit_no_one.arcsort() + ) @ graph_digit + + graph_hundreds_component_singular = ( + graph_digit_no_one + delete_hyphen + graph_cent_singular + ) # Regular way: [1-9] * 100 + + graph_hundreds_component_singular = pynini.union( + graph_hundreds_component_singular, pynini.cross("cent", "1") + ) + graph_hundreds_component_singular += delete_hyphen + graph_hundreds_component_singular += graph_tens_component_with_leading_zeros + + graph_hundreds_component_plural = graph_digit_no_one + delete_hyphen + graph_cent_plural + + graph_hundreds_component = pynini.union( + graph_hundreds_component_singular, + graph_hundreds_component_plural, + pynutil.insert("0") + graph_tens_component_with_leading_zeros, + ) + + graph_hundreds_component_at_least_one_none_zero_digit = graph_hundreds_component @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + self.graph_hundreds_component_at_least_one_none_zero_digit = rewrite( + graph_hundreds_component_at_least_one_none_zero_digit + ).optimize() + + # Graph thousands (we'll need this for cases of mille millions, mille milliards...) + graph_tens_of_hundreds_component_singular = ( + graph_tens_component + delete_hyphen + graph_cent_singular + ) # Tens of hundreds. e.g. 1900 = nineteen hundred/ 'dix neuf cents" + graph_tens_of_hundreds_component_singular += ( + delete_hyphen + graph_tens_component_with_leading_zeros + ) + graph_tens_of_hundreds_component_plural = ( + graph_tens_component + delete_hyphen + graph_cent_plural + ) + graph_tens_of_hundred_component = ( + graph_tens_of_hundreds_component_plural | graph_tens_of_hundreds_component_singular + ) + + graph_thousands = pynini.union( + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + pynutil.delete("mille"), + pynutil.insert("001") + pynutil.delete("mille"), # because 'mille', not 'un mille' + pynutil.insert("000", weight=0.1), + ) + + # All other large amounts + graph_millions = pynini.union( + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + (pynutil.delete("million") | pynutil.delete("millions")), + pynutil.insert("000", weight=0.1), + ) + + graph_milliards = pynini.union( # French for English 'billion' + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + (pynutil.delete("milliard") | pynutil.delete("milliards")), + pynutil.insert("000", weight=0.1), + ) + + graph_billions = pynini.union( # NOTE: this is English 'trillion.' + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + (pynutil.delete("billions") | pynutil.delete("billion")), + pynutil.insert("000", weight=0.1), + ) + + graph_mille_billion = pynini.union( + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + pynutil.delete("mille"), + pynutil.insert("001") + + pynutil.delete("mille"), # because we say 'mille', not 'un mille' + ) + graph_mille_billion += delete_hyphen + ( + graph_millions | pynutil.insert("000") + pynutil.delete("billions") + ) # allow for 'mil millones' + graph_mille_billion |= pynutil.insert("000000", weight=0.1) + + graph_billiards = pynini.union( + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + (pynutil.delete("billiards") | pynutil.delete("billiard")), + pynutil.insert("000", weight=0.1), + ) + + graph_trillions = pynini.union( # One thousand English trillions. + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + (pynutil.delete("trillions") | pynutil.delete("trillion")), + pynutil.insert("000", weight=0.1), + ) + + graph_trilliards = pynini.union( + graph_hundreds_component_at_least_one_none_zero_digit + + delete_hyphen + + (pynutil.delete("trilliards") | pynutil.delete("trilliard")), + pynutil.insert("000", weight=0.1), + ) + + graph = pynini.union( + graph_trilliards + + delete_hyphen + + graph_trillions + + delete_hyphen + + graph_billiards + + delete_hyphen + + graph_billions + + delete_hyphen + + graph_milliards + + delete_hyphen + + graph_millions + + delete_hyphen + + graph_thousands + + delete_hyphen + + graph_hundreds_component, + graph_tens_of_hundred_component, + graph_zero, + ) + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + graph = rewrite(graph) + + self.graph_no_exception = graph.optimize() + + # save self.numbers_up_to_thousand for use in DecimalFst + digits_up_to_thousand = DAMO_DIGIT | (DAMO_DIGIT**2) | (DAMO_DIGIT**3) + numbers_up_to_thousand = pynini.compose(graph, digits_up_to_thousand).optimize() + self.numbers_up_to_thousand = numbers_up_to_thousand + + # save self.numbers_up_to_million for use in DecimalFst + digits_up_to_million = ( + DAMO_DIGIT + | (DAMO_DIGIT**2) + | (DAMO_DIGIT**3) + | (DAMO_DIGIT**4) + | (DAMO_DIGIT**5) + | (DAMO_DIGIT**6) + ) + numbers_up_to_million = pynini.compose(graph, digits_up_to_million).optimize() + self.numbers_up_to_million = numbers_up_to_million + + # don't convert cardinals from zero to nine inclusive + graph_exception = pynini.project(pynini.union(graph_digit, graph_zero), "input") + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("moins", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/date.py b/fun_text_processing/inverse_text_normalization/fr/taggers/date.py new file mode 100644 index 0000000..9997206 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/date.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + GraphFst, + delete_extra_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, in the form of (day) month (year) or year + e.g. le vingt-quatre juillet deux-mille-treize -> date { day: "24" month: "juli" year: "2013" preserve_order: true } + e.g. le vingt-quatre juillet deux-mille-treize -> date { day: "24" month: "juli" year: "2013" preserve_order: true } + e.g. le premier janvier -> date { day: "1" month: "janvier" preserve_order: true } + + Also will convert colloquialism of spelling in which tens of hundreds are used to express date. (e.g. nineteen hundred and four) + e.g. le vingt mais dix-neuf-cent-quatre -> date { day: "20" month: "mais" year: "1904" preserve_order: true } + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="date", kind="classify") + + self.cardinal = cardinal.graph_no_exception + + year_graph = self.cardinal + + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + + day_graph = self.cardinal | pynini.cross( + "premier", "1" + ) # Premier is only ordinal used for dates + day_graph = pynutil.insert('day: "') + day_graph + pynutil.insert('"') + optional_graph_year = pynini.closure( + delete_extra_space + pynutil.insert('year: "') + year_graph + pynutil.insert('"'), + 0, + 1, + ) + graph_dmy = day_graph + delete_extra_space + month_graph + optional_graph_year + + final_graph = graph_dmy + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/fr/taggers/decimal.py new file mode 100644 index 0000000..9a00a6a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/decimal.py @@ -0,0 +1,126 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_hyphen, + delete_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_thousand: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Will tag cases up to denominations of tens of hundreds of thousand. 'douze cent mille millions' -> 1 200 000 millions + + Args: + decimal: decimal FST + cardinal_up_to_million: cardinal FST + """ + numbers = cardinal_up_to_thousand @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + + suffix = pynini.union( + "million", + "millions", + "milliard", + "milliards", + "billion", + "billions", + "billiard", + "billiards", + "trillion", + "trillions", + "trilliard", + "trilliards", + ) + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + ( + pynini.union(delete_hyphen, delete_extra_space) + ) # Can be written either as 'deux-millions' or 'deux millions' depending on whether it registers as a noun or part of cardinal. + + pynutil.insert(' quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + delete_extra_space + pynutil.insert(' quantity: "') + suffix + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + Decimal point is "," (virgule). + e.g. moins un virgule deux six -> decimal { negative: "true" integer_part: "1" fractional_part: "26" } + + This decimal rule assumes that decimals can be pronounced as: + (a cardinal) + ('virgule') plus (any sequence of cardinals <1 million, including 'zero') + + Also writes large numbers in shortened form, e.g. + e.g. un virgule deux-six-million -> decimal { negative: "false" integer_part: "1" fractional_part: "26" quantity: "million" } + e.g. deux-million -> decimal { negative: "false" integer_part: "2" quantity: "millions" } + e.g. moins cent-vingt-quatre-millions -> decimal { negative: "true" integer_part: "124" quantity: "millions" } + Args: + cardinal: CardinalFst + + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + # number after decimal point can be any series of cardinals <1 million, including 'zero' + graph_decimal = cardinal.numbers_up_to_million + graph_decimal = pynini.closure(graph_decimal + delete_space) + graph_decimal + self.graph = graph_decimal + + # decimal point is denote by virgule + graph_fractional_separator = pynutil.delete("virgule") + + # Possible negatives + optional_graph_negative = ( + pynutil.insert("negative: ") + pynini.cross("moins", '"true"') + delete_extra_space + ) + optional_graph_negative = optional_graph_negative.ques + + # Fractional portion + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + + # Integers + cardinal_graph = cardinal.graph_no_exception | pynini.string_file( + get_abs_path("data/numbers/zero.tsv") + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + + # Final graphs + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + graph_fractional_separator + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.graph_hundreds_component_at_least_one_none_zero_digit + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.graph_hundreds_component_at_least_one_none_zero_digit + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/fr/taggers/electronic.py new file mode 100644 index 0000000..8c4d217 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/electronic.py @@ -0,0 +1,106 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_ALPHA, + GraphFst, + insert_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying 'electronic' semiotic classes, i.e. + email address (which get converted to "username" and "domain" fields), + and URLS (which get converted to a "protocol" field). + e.g. c d f une arobase a b c point e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + e.g. double vé double vé double vé a b c point e d u -> tokens { electronic { protocol: "www.abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")) + ampersand = pynini.string_map([("arobase"), ("chez"), ("at"), ("à")]) + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("point", ".") + username = ( + pynutil.insert('username: "') + + alpha_num + + delete_extra_space + + pynini.closure(accepted_username + delete_extra_space) + + alpha_num + + pynutil.insert('"') + ) + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete(ampersand) + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross( + pynini.union("www", "w w w", "double vé double vé double vé"), "www" + ) + protocol_start = pynini.cross(pynini.union("http", "h t t p", "ache té té pé"), "http") + protocol_start |= pynini.cross( + pynini.union("https", "h t t p s", "ache té té pé esse"), "https" + ) + protocol_start += pynini.cross( + pynini.union( + " deux-points barre oblique barre oblique ", + " deux-points barre barre ", + " deux-points double barre ", + " deux-points slash slash ", + ), + "://", + ) + + # e.g. .com, .es + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + (domain | pynini.closure(accepted_username + delete_extra_space) + accepted_username) + ) + + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + delete_extra_space + + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + + pynini.closure(ending, 1) + ) + protocol = pynutil.insert('protocol: "') + protocol + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/fr/taggers/fraction.py new file mode 100644 index 0000000..b6a7b0f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/fraction.py @@ -0,0 +1,67 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + e.g. demi -> tokens { fraction { numerator: "1" denominator: "2" } } + e.g. un et demi -> tokens { fraction { integer_part: "1" numerator: "1" denominator: "2" } } + e.g. trois et deux centième -> tokens { fraction { integer_part: "3" numerator: "2" denominator: "100" } } + + Args: + cardinal: OrdinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="fraction", kind="classify") + # integer_part # numerator # denominator + + graph_cardinal = cardinal.graph_no_exception + graph_strip_undo_root_change = pynini.string_file( + get_abs_path("data/fractions.tsv") + ) # add in absolute path + + graph_strip_no_root_change = pynutil.delete("ième") # For no change to root + graph_strip_no_root_change += pynutil.delete("s").ques # for plurals + + graph_strip = graph_strip_no_root_change | graph_strip_undo_root_change + + self.fractional = ((pynini.closure(DAMO_CHAR) + graph_strip) @ graph_cardinal).optimize() + + integer = pynutil.insert('integer_part: "') + graph_cardinal + pynutil.insert('" ') + integer += delete_space + integer += pynutil.delete("et") # used to demarcate integer and fractional parts + + numerator = pynutil.insert('numerator: "') + graph_cardinal + pynutil.insert('"') + denominator = pynutil.insert(' denominator: "') + self.fractional + pynutil.insert('"') + + # Demi (half) can occur alone without explicit numerator. + graph_demi_component = ( + pynutil.delete("demi") + pynutil.delete("e").ques + pynutil.delete("s").ques + ) + graph_demi_component += pynutil.insert('numerator: "1" denominator: "2"') + + graph_fraction_component = numerator + delete_space + denominator + graph_fraction_component |= graph_demi_component + self.graph_fraction_component = graph_fraction_component + + graph = pynini.closure(integer + delete_space, 0, 1) + graph_fraction_component + graph = graph.optimize() + self.final_graph_wo_negative = graph + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("moins", '"true"') + delete_extra_space, + 0, + 1, + ) + graph = optional_graph_negative + graph + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/measure.py b/fun_text_processing/inverse_text_normalization/fr/taggers/measure.py new file mode 100644 index 0000000..07854a8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/measure.py @@ -0,0 +1,85 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + get_singulars, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure. Allows for plural form for unit. + e.g. moins onze kilogramme -> measure { negative: "true" cardinal { integer: "11" } units: "kg" } + e.g. trois heures -> measure { cardinal { integer: "3" } units: "h" } + e.g. demi gramme -> measure { fraction { numerator: "1" denominator: "2" } units: "g" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + fraction: FractionFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst, fraction: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_prefix = pynini.string_file(get_abs_path("data/measurements/magnitudes.tsv")) + graph_unit_singular = pynini.string_file(get_abs_path("data/measurements/measurements.tsv")) + + unit = get_singulars(graph_unit_singular) | graph_unit_singular + unit = graph_prefix.ques + unit + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("moins", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_misc = ( + pynutil.insert("/") + + (pynutil.delete("par") | pynutil.delete("à")) + + delete_space + + unit + ) + + unit = ( + pynutil.insert('units: "') + + (unit | unit_misc | pynutil.add_weight(unit + delete_space + unit_misc, 0.01)) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit + ) + + subgraph_fraction = ( + pynutil.insert("fraction { ") + + optional_graph_negative + + fraction.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit + ) + + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + cardinal_graph + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit + ) + final_graph = subgraph_decimal | subgraph_cardinal | subgraph_fraction + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/money.py b/fun_text_processing/inverse_text_normalization/fr/taggers/money.py new file mode 100644 index 0000000..1236f53 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/money.py @@ -0,0 +1,130 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. douze euro cinq -> money { integer_part: "12" currency: "€" fractional_part: 05} + e.g. zéro euro cinq -> money { integer_part: "0" currency: "€" fractional_part: 05} + e.g. cinq centimes -> money { integer_part: "0" currency: "€" fractional_part: 05} + + Note, the currency symbol seems more common for exact amounts and quantities less than 'un million' + For 'round' quantities of >=million (milliard, billion), the symbol is dropped. This allows + use of the 'de' preposition. + e.g. cinq millions d'euros -> money { integer_part: "5" currency: "d'euros" fractional_part: 00} + e.g. un milliard d'euro -> money { integer_part: "5" currency: "d'euro" fractional_part: 00} + e.g. trois virgule trois millions d'euros -> money { integer_part: "3" currency: "d'euros" fractional_part: 3} + + Currency is included for uniform tagging. + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + # quantities + cardinal_graph = cardinal.graph_no_exception + graph_decimal = decimal.final_graph_wo_negative + + # Converts currency names to symbols + convert_currency_major = pynini.string_file( + get_abs_path("data/money/currency_major.tsv") + ) # major denominations + convert_currency_minor = pynini.string_file( + get_abs_path("data/money/currency_minor.tsv") + ) # minor denominations to major symbol. (e.g. 5 cents -> 0.05 $ ) + + accept_all_currency = (convert_currency_major | convert_currency_minor).project( + "input" + ) # recognizes all currencies + + # Graphs for large round amounts ('deux billiards d'euros', 'un milliard de dollars') + graph_de = pynini.union( + "de ", "des ", "d'" + ) # the use of de/d'only occurs with round amounts + graph_currency_component_large_round_amounts = graph_de + accept_all_currency + graph_currency_component_large_round_amounts = ( + pynutil.insert(' currency: "') + + graph_currency_component_large_round_amounts + + pynutil.insert('"') + ) + + graph_money_large_round_amounts = ( + graph_decimal + delete_space + ) # graph_decimal includes tags and quantities already + graph_money_large_round_amounts += graph_currency_component_large_round_amounts + + # For standard currency + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + + # Graphs integer denomination for large denominations (e.g. $) + graph_integer_component_major = ( + pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + ) + graph_integer_component_major += delete_space + + graph_currency_component_major = ( + pynutil.insert(' currency: "') + convert_currency_major + pynutil.insert('"') + ) + + graph_decimal_component_major = ( + delete_space + + pynutil.insert(' fractional_part: "') + + (cardinal_graph @ add_leading_zero_to_double_digit) + + pynutil.insert('"') + ) + + # Rare cases where 'et' will separate major and minor denominations. + delete_minor_currency = pynini.project(convert_currency_minor, "input") + delete_minor_currency = delete_extra_space + pynutil.delete(delete_minor_currency) + + delete_et = delete_extra_space + pynutil.delete("et") + + graph_money_major = ( + graph_integer_component_major + + graph_currency_component_major + + delete_et.ques + + graph_decimal_component_major.ques + + delete_minor_currency.ques + ) + + # For cases when only small denominations are used. + graph_integer_component_minor = pynutil.insert('integer_part: "0"') + + graph_decimal_component_minor = ( + pynutil.insert(' fractional_part: "') + + (cardinal_graph @ add_leading_zero_to_double_digit) + + pynutil.insert('"') + ) + graph_decimal_component_minor += delete_extra_space + + graph_currency_component_minor = ( + pynutil.insert(' currency: "') + convert_currency_minor + pynutil.insert('"') + ) + + graph_money_minor = ( + graph_integer_component_minor + + graph_decimal_component_minor + + graph_currency_component_minor + ) + + graph_money_standard_amounts = graph_money_major | graph_money_minor + + final_graph = graph_money_large_round_amounts | graph_money_standard_amounts + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/fr/taggers/ordinal.py new file mode 100644 index 0000000..faeb62f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/ordinal.py @@ -0,0 +1,67 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_SIGMA, + GraphFst, + delete_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + vingt-deuxième -> ordinal { integer: "22" morphosyntactic_features: "e" } + + Also notes specific nouns that have unique normalization conventions. + For instance, 'siècles' are rendered in roman numerals when given an ordinal adjective. + e.g. dix-neuvième siècle -> XIXe + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="ordinal", kind="classify") + + graph_cardinal = cardinal.graph_no_exception + graph_undo_root_change = pynini.string_file( + get_abs_path("data/ordinals/digits_root_change.tsv") + ) # Returns base number to normal after root change. + graph_firsts = pynini.string_file(get_abs_path("data/ordinals/firsts.tsv")) + graph_second = pynini.string_file(get_abs_path("data/ordinals/second.tsv")) + graph_special_ordinals = pynini.string_file(get_abs_path("data/ordinals/key_nouns.tsv")) + + # Removes morpheme + graph_no_root_change = pynutil.delete("ième") # For no change to root + + graph_strip_morpheme = pynini.union(graph_no_root_change, graph_undo_root_change) + graph_strip_morpheme = DAMO_SIGMA + graph_strip_morpheme + + graph_integer_component = graph_strip_morpheme @ graph_cardinal + + graph_morpheme_component = pynutil.insert("e") # Put the superscript in. + graph_morpheme_component += pynini.accep("s").ques # In case of plurals. + + # Concatenate with cardinal graph. + graph_ordinal = pynutil.insert('integer: "') + graph_integer_component + pynutil.insert('"') + graph_ordinal += ( + pynutil.insert(' morphosyntactic_features: "') + graph_morpheme_component + ) # Leave open in case further morphems occur + + # Primer has a different subscript depending on gender, need to take note if + # 'premier' or 'première' + graph_firsts = pynutil.insert('integer: "1" morphosyntactic_features: "') + graph_firsts + + # Second used 'd' as a superscript. + graph_second = pynutil.insert('integer: "2" morphosyntactic_features: "') + graph_second + + graph = graph_firsts | graph_second | graph_ordinal + + # For roman numerals. Carries over designation to verbalizer + graph_special_ordinals = pynutil.insert("/") + delete_space + graph_special_ordinals + + graph += graph_special_ordinals.ques + pynutil.insert('"') + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/fr/taggers/punctuation.py new file mode 100644 index 0000000..ae5dc1e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/punctuation.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + guillemets = "\u00AB" + "\u00BB" # quotation marks in French. + s += guillemets + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/fr/taggers/telephone.py new file mode 100644 index 0000000..efa4141 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/telephone.py @@ -0,0 +1,72 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + GraphFst, + delete_hyphen, + delete_space, + insert_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers. Assumes conventional grouping for Metropolitan France (and overseas departments) + (two number sequences are grouped as individual cardinals) or digit by digit (chiffre-par-chiffre) e.g. + "zero un quatre-vingt-deux zero deux vingt-deux cinquante" -> { number_part: "01 42 02 22 50" } + "zero un quatre deux zero deux deux deux cinq zero" -> { number_part: "01 42 02 22 50" } + + In cases where only one digit of the first pairing is admitted, assumes that the 0 was skipped. + "une vingt-trois quatre-vingt zero six dix-sept" -> { number_part: "01 23 40 06 17" } + """ + + def __init__(self): + super().__init__(name="telephone", kind="classify") + + # create `single_digits` and `double_digits` graphs as these will be + # the building blocks of possible telephone numbers + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_ties_unique = pynini.string_file((get_abs_path("data/numbers/ties_unique.tsv"))) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + + double_digits = pynini.union( + graph_teen, + graph_ties_unique, + (graph_ties + pynutil.insert("0")), + (graph_ties + delete_hyphen + graph_digit), + ) + + graph_first_pair = graph_zero + delete_space + graph_digit + graph_first_pair |= pynutil.insert("0") + graph_digit # if zero is omitted + graph_first_pair += ( + delete_space + insert_space + ) # delete_space since closure allows possible gaps to be removed + + # All digits + single_digits = graph_digit | graph_zero + + graph_pair_all_digits = single_digits + delete_space + graph_pair_all_digits += single_digits + + graph_all_digits = pynini.closure(graph_pair_all_digits + delete_space + insert_space, 3, 3) + graph_all_digits = graph_first_pair + graph_all_digits + graph_pair_all_digits + + # Paired digits + graph_pair_digits_and_ties = double_digits | graph_pair_all_digits + + graph_digits_and_ties = pynini.closure( + graph_pair_digits_and_ties + delete_space + insert_space, 3, 3 + ) + graph_digits_and_ties = ( + graph_first_pair + graph_digits_and_ties + graph_pair_digits_and_ties + ) + + number_part = pynini.union(graph_all_digits, graph_digits_and_ties) + + number_part = pynutil.insert('number_part: "') + number_part + pynutil.insert('"') + + graph = number_part + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/time.py b/fun_text_processing/inverse_text_normalization/fr/taggers/time.py new file mode 100644 index 0000000..f62efcc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/time.py @@ -0,0 +1,109 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import GraphFst, delete_space +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. huit heures -> time { hours: "8" minutes: "00" } + e.g. treize heures -> time { hours: "13" minutes: "00" } + e.g. treize heures dix -> time { hours: "13" minutes: "10" } + e.g. huit heures du matin -> time { hours: "8" minutes: "00" suffix: "avant mid"} + e.g. huite heures du après midi -> time { hours: "8" minutes: "00" suffix: "après-midi"} + e.g. douze heures moins qart -> time { hours: "11" minutes: "45" } + e.g. douze heures et qart -> time { hours: "12" minutes: "15" } + e.g. midi et qart -> time { hours: "12" minutes: "15" } + e.g. minuit et medi -> time { hours: "0" minutes: "30" } + e.g. douze heures moins medi -> time { hours: "11" minutes: "30" } + e.g. douze heures moins trois -> time { hours: "11" minutes: "57" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + # time_zone = pynini.invert(pynini.string_file(get_abs_path("data/time/time_zone.tsv"))) + graph_hours_to = pynini.string_file(get_abs_path("data/time/hours_to.tsv")) + graph_minutes_to = pynini.string_file(get_abs_path("data/time/minutes_to.tsv")) + graph_hours = pynini.string_file(get_abs_path("data/time/hours.tsv")) + graph_minutes = pynini.string_file(get_abs_path("data/time/minutes.tsv")) + graph_suffix_am = pynini.string_file(get_abs_path("data/time/time_suffix_am.tsv")) + graph_suffix_pm = pynini.string_file(get_abs_path("data/time/time_suffix_pm.tsv")) + + graph_suffix = pynini.cross(graph_suffix_am, "am") | pynini.cross(graph_suffix_pm, "pm") + + # Mapping 'heures' + graph_heures = pynini.accep("heure") + pynini.accep("s").ques + graph_heures = pynutil.delete(graph_heures) + + graph_hours += delete_space + graph_heures + + # Midi and minuit + graph_midi = pynini.cross("midi", "12") + graph_minuit = pynini.cross("minuit", "0") + + # Mapping 'et demi' and 'et qart' + graph_et = pynutil.delete("et") + delete_space + + graph_demi = pynini.accep("demi") + graph_demi += pynini.accep("e").ques # people vary on feminine or masculine form + graph_demi = pynini.cross(graph_demi, "30") + + graph_quart = pynini.accep("quart") + graph_quart = pynini.accep("le ").ques + graph_quart # sometimes used + graph_quart = pynini.cross(graph_quart, "15") + graph_trois_quart = pynini.cross("trois quarts", "45") + + graph_fractions = pynini.union(graph_demi, graph_quart, graph_trois_quart) + + graph_et_fractions = graph_et + graph_fractions + + # Hours component is usually just a cardinal + 'heures' (ignored in case of 'midi/minuit'). + graph_hours_component = pynini.union(graph_hours, graph_midi, graph_minuit) + graph_hours_component = ( + pynutil.insert('hours: "') + graph_hours_component + pynutil.insert('"') + ) + graph_hours_component += delete_space + + # Minutes component + graph_minutes_component = ( + pynutil.insert(' minutes: "') + + pynini.union(graph_minutes, graph_et_fractions) + + pynutil.insert('"') + ) + + # Hour and minutes together. For 'demi' and 'qart', 'et' is used as a conjunction. + graph_time_standard = graph_hours_component + graph_minutes_component.ques + + # For time until hour. "quatre heures moins qart" -> 4 h 00 - 0 h 15 = 3 h 45 + graph_moins = pynutil.delete("moins") + graph_moins += delete_space + + graph_hours_to_component = graph_hours | graph_midi | graph_minuit + graph_hours_to_component @= graph_hours_to + graph_hours_to_component = ( + pynutil.insert('hours: "') + graph_hours_to_component + pynutil.insert('"') + ) + graph_hours_to_component += delete_space + + graph_minutes_to_component = pynini.union(graph_minutes, graph_fractions) + graph_minutes_to_component @= graph_minutes_to + graph_minutes_to_component = ( + pynutil.insert(' minutes: "') + graph_minutes_to_component + pynutil.insert('"') + ) + + graph_time_to = graph_hours_to_component + graph_moins + graph_minutes_to_component + + graph_time_no_suffix = graph_time_standard | graph_time_to + + graph_suffix_component = pynutil.insert(' suffix: "') + graph_suffix + pynutil.insert('"') + graph_suffix_component = delete_space + graph_suffix_component + graph_suffix_component = graph_suffix_component.ques + + final_graph = graph_time_no_suffix + graph_suffix_component + + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/fr/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..69d64e6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/tokenize_and_classify.py @@ -0,0 +1,108 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.inverse_text_normalization.fr.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.fr.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.fr.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.fr.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.fr.taggers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.fr.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.fr.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.fr.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.fr.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.fr.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.fr.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.fr.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.fr.taggers.word import WordFst +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_fr_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + fraction = FractionFst(cardinal) + fraction_graph = fraction.fst + + ordinal = OrdinalFst(cardinal) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal, fraction=fraction).fst + date_graph = DateFst(cardinal).fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal, decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst().fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.05) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.08) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.09) + | pynutil.add_weight(money_graph, 1.07) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/fr/taggers/whitelist.py new file mode 100644 index 0000000..f333e91 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import GraphFst, convert_space +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")) + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/taggers/word.py b/fun_text_processing/inverse_text_normalization/fr/taggers/word.py new file mode 100644 index 0000000..a2db671 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/utils.py b/fun_text_processing/inverse_text_normalization/fr/utils.py new file mode 100644 index 0000000..c6fdb74 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/utils.py @@ -0,0 +1,13 @@ +import os + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/cardinal.py new file mode 100644 index 0000000..28087c9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { negative: "-" integer: "23" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/date.py new file mode 100644 index 0000000..85e971c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/date.py @@ -0,0 +1,62 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { day: "1" month: "janvier" preserve_order: true } -> 1 de enero + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + + convert_primer = pynini.cross("1", "1ᵉʳ") + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + ( + pynini.closure(DAMO_NOT_QUOTE, 1) | pynutil.add_weight(convert_primer, -1) + ) # first of the month is ordinal + + pynutil.delete('"') + ) + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + # day month + graph_dm = day + delete_extra_space + month + graph_dmy = graph_dm + delete_extra_space + year + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = (graph_dm | graph_dmy) + delete_space + optional_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/decimal.py new file mode 100644 index 0000000..fadb7da --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/decimal.py @@ -0,0 +1,81 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_DIGIT, + DAMO_NON_BREAKING_SPACE, + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class NumberParser(GraphFst): + """ + Finite state transducer for parsing strings of digis. Breaks up digit strings into groups of three for + strings of digits of four or more (inclusive). Groupings are separated by non-breaking space. + e.g. '1000' -> '1 000' + e.g. '1000,33333' -> '1 000,333 33 + """ + + def __init__(self): + super().__init__(name="parser", kind="verbalize") + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + + # Need parser to group digits by threes + exactly_three_digits = DAMO_DIGIT**3 + at_most_three_digits = pynini.closure(DAMO_DIGIT, 1, 3) + + space_every_three_integer = ( + at_most_three_digits + + (pynutil.insert(DAMO_NON_BREAKING_SPACE) + exactly_three_digits).closure() + ) + space_every_three_decimal = ( + pynini.accep(",") + + (exactly_three_digits + pynutil.insert(DAMO_NON_BREAKING_SPACE)).closure() + + at_most_three_digits + ) + group_by_threes = space_every_three_integer | space_every_three_decimal + self.group_by_threes = group_by_threes + + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + integer = integer @ group_by_threes + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(",") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + fractional = fractional @ group_by_threes + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = (optional_integer + optional_fractional + optional_quantity).optimize() + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/electronic.py new file mode 100644 index 0000000..866af3f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/electronic.py @@ -0,0 +1,35 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/fraction.py new file mode 100644 index 0000000..d73e41c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/fraction.py @@ -0,0 +1,43 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction + e.g. fraction { integer_part: "1" numerator: "2" denominator: "3" } } -> 1 2/3 + + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + insert_space + ) + numerator = ( + pynutil.delete('numerator: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + + denominator = ( + pynutil.insert("/") + + pynutil.delete('denominator: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = ( + pynini.closure(integer + delete_space, 0, 1) + numerator + delete_space + denominator + ).optimize() + self.numbers = graph + delete_tokens = self.delete_tokens(optional_sign + graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/measure.py new file mode 100644 index 0000000..f6deac8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/measure.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + fraction: FractionFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst, fraction: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + @ decimal.group_by_threes # measurements most obey three by three spacing + + delete_space + + pynutil.delete("}") + ) + graph_fraction = ( + pynutil.delete("fraction {") + + delete_space + + optional_sign + + delete_space + + fraction.numbers + + delete_space + + pynutil.delete("}") + ) + + graph = ( + (graph_cardinal | graph_decimal | graph_fraction) + + delete_space + + pynutil.insert(" ") + + unit + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/money.py new file mode 100644 index 0000000..8c8d0a0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/money.py @@ -0,0 +1,31 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> 12.05 $ + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_extra_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + graph = decimal.numbers + delete_space + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/ordinal.py new file mode 100644 index 0000000..aa46237 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/ordinal.py @@ -0,0 +1,71 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" morphosyntactic_features: "e" } -> 13ᵉ + + Given 'special' terms for ordinals (e.g. siècle), renders + amount in conventional format. e.g. + + ordinal { integer: "13" morphosyntactic_features: "e/siècle" } -> XIIIᵉ + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph_integer = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + replace_suffix = pynini.union( + pynini.cross("e", "ᵉ"), # only delete first quote since there may be more features + pynini.cross("d", "ᵈ"), + pynini.cross("r", "ʳ"), + pynini.cross("s", "ˢ"), + ) + replace_suffix = pynutil.delete(' morphosyntactic_features: "') + replace_suffix.plus + + graph_arabic = graph_integer + replace_suffix.plus + + # For roman. + graph_roman_digits = pynini.string_file( + get_abs_path("data/roman/digits_large.tsv") + ).invert() + graph_roman_ties = pynini.string_file(get_abs_path("data/roman/ties_large.tsv")).invert() + graph_roman_hundreds = pynini.string_file( + get_abs_path("data/roman/hundreds_large.tsv") + ).invert() + graph_roman_zero_digit = pynutil.delete("0") + + graph_roman_hundreds = DAMO_DIGIT**3 @ ( + graph_roman_hundreds + + pynini.union(graph_roman_ties, graph_roman_zero_digit) + + pynini.union(graph_roman_digits, graph_roman_zero_digit) + ) + graph_roman_ties = DAMO_DIGIT**2 @ ( + graph_roman_ties + pynini.union(graph_roman_digits, graph_roman_zero_digit) + ) + graph_roman_digits = DAMO_DIGIT @ graph_roman_digits + + graph_roman_integers = graph_roman_hundreds | graph_roman_ties | graph_roman_digits + + graph_roman = (graph_integer @ graph_roman_integers) + replace_suffix + graph_roman += pynini.cross("/", " ") + "siècle" + + graph = (graph_roman | graph_arabic) + pynutil.delete('"') + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/telephone.py new file mode 100644 index 0000000..c35d7e5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/telephone.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "02 33 43 53 22" } + -> 02 33 43 53 22 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/time.py new file mode 100644 index 0000000..0de583f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/time.py @@ -0,0 +1,61 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.fr.utils import get_abs_path +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "8" minutes: "30" suffix: "du matin"} -> 8 h 30 + time { hours: "8" minutes: "30" } -> 8 h 30 + time { hours: "8" minutes: "30" suffix: "du soir"} -> 20 h 30 + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + + hour_to_night = pynini.string_file(get_abs_path("data/time/hour_to_night.tsv")) + + day_suffixes = pynutil.delete('suffix: "am"') + night_suffixes = pynutil.delete('suffix: "pm"') + + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1, 2) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_extra_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1, 2) + + pynutil.delete('"') + ) + + graph = ( + hour + + delete_extra_space + + pynutil.insert("h") + + minute.ques + + delete_space + + day_suffixes.ques + ) + + graph |= ( + hour @ hour_to_night + + delete_extra_space + + pynutil.insert("h") + + minute.ques + + delete_space + + night_suffixes + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/verbalize.py new file mode 100644 index 0000000..55d5eb2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/verbalize.py @@ -0,0 +1,51 @@ +from fun_text_processing.inverse_text_normalization.fr.graph_utils import GraphFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.whitelist import WhiteListFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + fraction = FractionFst() + fraction_graph = fraction.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal, fraction=fraction).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | fraction_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/verbalize_final.py new file mode 100644 index 0000000..c384df5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.fr.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.fr.verbalizers.word import WordFst +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/whitelist.py new file mode 100644 index 0000000..889dc88 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/fr/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/fr/verbalizers/word.py new file mode 100644 index 0000000..5a9fc1c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/fr/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.fr.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/__init__.py b/fun_text_processing/inverse_text_normalization/id/__init__.py new file mode 100644 index 0000000..096e8f1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.id.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.id.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/id/clean_eval_data.py b/fun_text_processing/inverse_text_normalization/id/clean_eval_data.py new file mode 100644 index 0000000..fc0a315 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/clean_eval_data.py @@ -0,0 +1,384 @@ +from argparse import ArgumentParser +from typing import List + +import regex as re +from fun_text_processing.text_normalization.data_loader_utils import ( + EOS_TYPE, + Instance, + load_files, + training_data_to_sentences, +) + + +""" +This file is for evaluation purposes. +filter_loaded_data() cleans data (list of instances) for inverse text normalization. Filters and cleaners can be specified for each semiotic class individually. +For example, normalized text should only include characters and whitespace characters but no punctuation. + Cardinal unnormalized instances should contain at least one integer and all other characters are removed. +""" + + +class Filter: + """ + Filter class + + Args: + class_type: semiotic class used in dataset + process_func: function to transform text + filter_func: function to filter text + + """ + + def __init__(self, class_type: str, process_func: object, filter_func: object): + self.class_type = class_type + self.process_func = process_func + self.filter_func = filter_func + + def filter(self, instance: Instance) -> bool: + """ + filter function + + Args: + filters given instance with filter function + + Returns: True if given instance fulfills criteria or does not belong to class type + """ + if instance.token_type != self.class_type: + return True + return self.filter_func(instance) + + def process(self, instance: Instance) -> Instance: + """ + process function + + Args: + processes given instance with process function + + Returns: processed instance if instance belongs to expected class type or original instance + """ + if instance.token_type != self.class_type: + return instance + return self.process_func(instance) + + +def filter_cardinal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_cardinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[^0-9]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_ordinal_1(instance: Instance) -> bool: + ok = re.search(r"(st|nd|rd|th)\s*$", instance.un_normalized) + return ok + + +def process_ordinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[,\s]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_decimal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_decimal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_measure_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_measure_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"m2", "m²", un_normalized) + un_normalized = re.sub(r"(\d)([^\d.\s])", r"\1 \2", un_normalized) + normalized = re.sub(r"[^a-z\s]", "", normalized) + normalized = re.sub(r"per ([a-z\s]*)s$", r"per \1", normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_money_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_money_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"a\$", r"$", un_normalized) + un_normalized = re.sub(r"us\$", r"$", un_normalized) + un_normalized = re.sub(r"(\d)m\s*$", r"\1 juta", un_normalized) + un_normalized = re.sub(r"(\d)bn?\s*$", r"\1 milyar", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_time_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_time_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r": ", ":", un_normalized) + un_normalized = re.sub(r"(\d)\s?a\s?m\s?", r"\1 a.m.", un_normalized) + un_normalized = re.sub(r"(\d)\s?p\s?m\s?", r"\1 p.m.", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_plain_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_plain_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_punct_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_punct_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_date_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_date_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_letters_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_letters_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_verbatim_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_verbatim_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_digit_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_digit_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_telephone_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_telephone_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_electronic_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_electronic_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_fraction_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_fraction_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_address_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_address_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +filters = [] +filters.append( + Filter(class_type="CARDINAL", process_func=process_cardinal_1, filter_func=filter_cardinal_1) +) +filters.append( + Filter(class_type="ORDINAL", process_func=process_ordinal_1, filter_func=filter_ordinal_1) +) +filters.append( + Filter(class_type="DECIMAL", process_func=process_decimal_1, filter_func=filter_decimal_1) +) +filters.append( + Filter(class_type="MEASURE", process_func=process_measure_1, filter_func=filter_measure_1) +) +filters.append(Filter(class_type="MONEY", process_func=process_money_1, filter_func=filter_money_1)) +filters.append(Filter(class_type="TIME", process_func=process_time_1, filter_func=filter_time_1)) + +filters.append(Filter(class_type="DATE", process_func=process_date_1, filter_func=filter_date_1)) +filters.append(Filter(class_type="PLAIN", process_func=process_plain_1, filter_func=filter_plain_1)) +filters.append(Filter(class_type="PUNCT", process_func=process_punct_1, filter_func=filter_punct_1)) +filters.append( + Filter(class_type="LETTERS", process_func=process_letters_1, filter_func=filter_letters_1) +) +filters.append( + Filter(class_type="VERBATIM", process_func=process_verbatim_1, filter_func=filter_verbatim_1) +) +filters.append(Filter(class_type="DIGIT", process_func=process_digit_1, filter_func=filter_digit_1)) +filters.append( + Filter(class_type="TELEPHONE", process_func=process_telephone_1, filter_func=filter_telephone_1) +) +filters.append( + Filter( + class_type="ELECTRONIC", process_func=process_electronic_1, filter_func=filter_electronic_1 + ) +) +filters.append( + Filter(class_type="FRACTION", process_func=process_fraction_1, filter_func=filter_fraction_1) +) +filters.append( + Filter(class_type="ADDRESS", process_func=process_address_1, filter_func=filter_address_1) +) +filters.append(Filter(class_type=EOS_TYPE, process_func=lambda x: x, filter_func=lambda x: True)) + + +def filter_loaded_data(data: List[Instance], verbose: bool = False) -> List[Instance]: + """ + Filters list of instances + + Args: + data: list of instances + + Returns: filtered and transformed list of instances + """ + updates_instances = [] + for instance in data: + updated_instance = False + for fil in filters: + if fil.class_type == instance.token_type and fil.filter(instance): + instance = fil.process(instance) + updated_instance = True + if updated_instance: + if verbose: + print(instance) + updates_instances.append(instance) + return updates_instances + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument( + "--input", help="input file path", type=str, default="./id_with_types/output-00001-of-00100" + ) + parser.add_argument("--verbose", help="print filtered instances", action="store_true") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + file_path = args.input + + print("Loading training data: " + file_path) + instance_list = load_files([file_path]) # List of instances + filtered_instance_list = filter_loaded_data(instance_list, args.verbose) + training_data_to_sentences(filtered_instance_list) diff --git a/fun_text_processing/inverse_text_normalization/id/data/__init__.py b/fun_text_processing/inverse_text_normalization/id/data/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/id/data/currency.tsv b/fun_text_processing/inverse_text_normalization/id/data/currency.tsv new file mode 100644 index 0000000..95a854c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/currency.tsv @@ -0,0 +1,37 @@ +$ dolar +$ dolar Amerika +$ dolar amerika serikat +Rp rupiah +IDR rupiah +£ pound inggris +€ euro +₩ won +nzd dolar selandia baru +rs rupee +chf swiss franc +dkk kroner Denmark +fim markka finlandia +aed dirham emirat arab +¥ yen +czk koruna ceko +mro ouguiya mauritania +pkr rupee pakistan +crc usus besar kosta rika +hk$ dollar Hongkong +npr rupee nepal +awg florin aruba +nok kroner norwegia +tzs shilling tanzan +sek kronor Swedia +cyp pound siprus +r nyata +sar riyal saudi +cve escudo tanjung verde +rsd dinar serbia +dm tanda jerman +shp santo helena pound +php peso filipina +cad dolar Kanada +ssp pound sunda selatan +scr rupiah seychelles +mvr rufiyaa maldivian diff --git a/fun_text_processing/inverse_text_normalization/id/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/id/data/electronic/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/id/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/id/data/electronic/domain.tsv new file mode 100644 index 0000000..b288cf6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/electronic/domain.tsv @@ -0,0 +1,11 @@ +com +uk +fr +net +br +in +ru +de +it +ai +id diff --git a/fun_text_processing/inverse_text_normalization/id/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/id/data/electronic/server_name.tsv new file mode 100644 index 0000000..ca7f97b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast +google diff --git a/fun_text_processing/inverse_text_normalization/id/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/id/data/electronic/symbols.tsv new file mode 100644 index 0000000..7ae60af --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/electronic/symbols.tsv @@ -0,0 +1,130 @@ +. dot +- berlari +- tanda penghubung +_ menggarisbawahi +! tanda seru +$ tanda dollar +& simbol untuk 'dan +' mengutip +* asterisk ++ plus +/ memotong +? tanda tanya +^ sirkomfleks +` kutipan tunggal yang tepat +{ penyangga kiri +| batang vertikal +} penjepit kanan +~ pasang surut +, koma +% persen +# tanda pagar += sama dengan +@ at +_ garis bawah +~ tilde +≥ lebih besar dari atau sama dengan +≤ lebih kecil dari atau sama dengan +≠ tidak sama dengan +≈ mendekati sama dengan +± kurang lebih +× kali +A A +B B +C C +D D +E E +F F +G G +H H +I I +J J +K K +L L +M M +N N +O O +P P +Q Q +R R +S S +T T +U U +V V +W W +X X +Y Y +Z Z +a A +b B +c C +d D +e E +f F +g G +h H +i I +j J +k K +l L +m M +n N +o O +p P +q Q +r R +s S +t T +u U +v V +w W +x X +y Y +z Z +Α alfa +Β beta +Γ gamma +Δ delta +Ε epsilon +Ζ zeta +Θ theta +Ι iota +Κ kappa +∧ lambda +Μ mu +Ν nu +Ξ ksi +Ο omikron +∏ pi +Ρ rho +∑ sigma +Τ tau +Υ upsilon +Φ phi +Χ khi +Ψ psi +Ω omega +α alfa +β beta +γ gamma +δ delta +ε epsilon +ζ zeta +η eta +θ theta +ι iota +κ kappa +λ lambda +μ mu +ν nu +ξ ksi +ο omikron +π pi +ρ rho +σ sigma +τ tau +υ upsilon +φ phi +χ khi +ψ psi +ω omega \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/magnitudes.tsv b/fun_text_processing/inverse_text_normalization/id/data/magnitudes.tsv new file mode 100644 index 0000000..0bff376 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/magnitudes.tsv @@ -0,0 +1,4 @@ +k ribu +m juta +b milyar +t triliun \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/measurements.tsv b/fun_text_processing/inverse_text_normalization/id/data/measurements.tsv new file mode 100644 index 0000000..af31662 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/measurements.tsv @@ -0,0 +1,361 @@ +fahrenheit f +celsius c +kilometer km +meter m +sentimeter cm +milimeter mm +hektar ha +mil mi +meter persegi m² +kilometer persegi km² +kaki ft +persen % +hertz hz +kilowat kw +daya kuda hp +miligram mg +kilogram kg +gigahertz ghz +kilohertz khz +megahertz mhz +volt v +jam h +mega coulomb mc +kedua s +nanometer nm +revolusi per menit rpm +menit min +mili ampere mA +persen % +kilo watt jam kwh +meter kubik m³ +mil per jam mph +tera watt tw +mili volt mv +megawatt mw +mikrometer μm +terabyte tb +c c cc +gram g +dalton da +suasana atm +ohm ω +desibel db +peta kedua ps +ons oz +hekto liter hl +mikrogram μg +petagram pg +gigabyte gb +kilobit kb +elektron volt ev +megabita mb +kilobyte kb +kilobit per detik kbps +megabit per detik mbps +batu st +kilo liter kl +tera joule tj +kilo volt kv +mega volt mv +kilonewton kn +megameter mm +satuan astronomi au +halaman yd +radian rad +lumen lm +hekto detik hs +tahi lalat mol +giga pascal gpa +mililiter ml +gigawatt gw +mega ampere ma +simpul kt +kekuatan kilogram kgf +nano gram ng +nanodetik ns +mega siemens ms +batang bar +giga liter gl +mikrodetik μs +desi ampere da +pascal pa +desi detik ds +mili detik ms +meteran desi dm +kubik desi meter dm³ +satuan massa atom amu +megabita mb +mega farad mf +becquerel bq +petabit pb +milimeter persegi mm² +sentimeter persegi cm² +mil persegi sq mi +kaki persegi sq ft +kilopascal kpa +candela cd +tera liter tl +mega detik ms +megapascal mpa +meteran peta pm +peta byte pb +giga watt jam gwh +kilo kalori kcal +abu-abu gy +saringan sv +kelas seratus cwt +c c cc +kaki persegi sq ft +inci persegi sq in +kaki persegi sqft +kaki persegi SqFt +milidetik msec +kilowatt jam kw·h +miliampere-jam mA⋅h +kilokalori kcal +kilokalori kCal +kilokalori Kcal +milimeter merkuri mmhg +milimeter merkuri mmHg +milimeter persegi mm2 +milimeter kubik mm3 +sentimeter persegi cm2 +sentimeter kubik cm3 +kilometer persegi km2 +kilometer kubik km3 +desimeter persegi dm2 +desimeter kubik dm3 +detik sec +jam hrs +mil per jam mph +kiloherts khz +kiloherts kHz +megahertz mhz +megahertz mHz +gigahertz ghz +gigahertz gHz +kilowatt jam kwh +mol mol +sendok the tsp +kilopascal kPa +volume vol +volume Vol +rotasi per menit rpm +detak per menit bpm +galon gal +pascal pa +megapascal mpa +miliampere-jam mah +menit min +detik SEC +kalori cal +kilokalori Cal +meter persegi m2 +meter kubik m3 +milimeter mm +sentimeter cm +sentimeter CM +kilometer km +kilometer KM +miligram mg +kilogram kg +kilogram KG +jam hr +hertz hz +hertz Hz +mililiter ml +mililiter mL +miliampere mA +sentimeter kubik cc +piksel px +piksel PX +volt v +volt V +kilovolt kv +kilovolt kV +hektar ha +ekar ac +karat ct +inci in +kaki ft +yard yd +nanometer nm +desimeter dm +kilobyte kb +megabyte mb +gigabyte gb +terabyte tb +kilobyte KB +megabyte MB +gigabyte GB +terabyte TB +daya kuda hp +desibel db +desibel dB +kilojoule kj +kilojoule kJ +ons oz +kilowatt kw +kilowatt KW +joule j +joule J +gram g +gram G +liter l +liter L +meter m +ohm-meter Ω·m +mikrometer μm +mikrogram μg +mikroampere μA +derajat Celsius °c +derajat Celsius ˚c +derajat Fahrenheit °f +derajat Fahrenheit ˚f +milimeter persegi mm² +milimeter kubik mm³ +sentimeter persegi cm² +sentimeter kubik cm³ +kilometer persegi km² +kilometer kubik km³ +desimeter kubik dm³ +meter persegi m² +meter kubik m³ +derajat ° +derajat ˚ +derajat Celsius ℃ +derajat Fahrenheit ℉ +ohm Ω +mikrometer μm +milimeter persegi mm2 +milimeter kubik mm3 +milimeter mm +sentimeter persegi cm2 +sentimeter kubik cm3 +sentimeter cm +sentimeter CM +kilometer persegi km2 +kilometer kubik km3 +kilometer km +kilometer KM +desimeter persegi dm2 +desimeter kubik dm3 +meter persegi m2 +meter kubik m3 +kaki persegi sq ft +kaki persegi sq. ft +kaki persegi sq.ft +kaki persegi sqft +kaki persegi SqFt +inci persegi sq in +mikrogram μg +miligram mg +kilogram kg +kilogram KG +milidetik msec +detik sec +jam hr +jam hrs +meter per detik m/s +kilometer per jam km/h +mil per jam mph +bit per detik bit/s +bit per detik Bit/s +byte per detik byte/s +byte per detik Byte/s +derajat Celsius °c +derajat Celsius ˚c +derajat Fahrenheit °f +derajat Fahrenheit ˚f +kilokalori kcal +kilokalori kCal +kilokalori Kcal +ons cairan fl.oz +farad per meter F/m +gram per liter g/l +gram per mililiter g/mL +hertz hz +hertz Hz +kiloherts khz +kiloherts kHz +megahertz mhz +megahertz mHz +gigahertz ghz +gigahertz gHz +kilometer per jam km/h +kilowatt per jam kw/h +kilowatt jam kw·h +kilowatt jam kS·h +kilowatt jam kwh +kilowatt jam kSh +mililiter ml +mililiter mL +miligram per mililiter mg/ml +miligram per mililiter mg/mL +miligram per liter mg/l +miligram per liter mg/L +miliampere mA +miliampere-jam mA⋅h +mol mol +ohm-meter Ω·m +siemens per meter S/m +sendok the tsp +mikroampere μA +kilopascal kPa +milimeter merkuri mmhg +milimeter merkuri mmHg +volume vol +volume Vol +sentimeter kubik cc +rotasi per menit rpm +rotasi per menit r/min +detak per menit bpm +piksel px +piksel PX +volt v +volt V +kilovolt kv +kilovolt kV +hektar ha +ekar ac +karat ct +liter l +liter L +galon gal +mol mol +pascal pa +megapascal mpa +miliampere ma +miliampere-jam mah +inci in +kaki ft +yard yd +nanometer nm +meter m +desimeter dm +gram g +gram G +kilobyte kb +megabyte mb +gigabyte gb +terabyte tb +kilobyte KB +megabyte MB +gigabyte GB +terabyte TB +daya kuda hp +desibel db +desibel dB +joule j +joule J +kilojoule kj +kilojoule kJ +ons oz +kilowatt kw +kilowatt KW +menit min +detik SEC +kalori cal +kilokalori Cal +inci " \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/months.tsv b/fun_text_processing/inverse_text_normalization/id/data/months.tsv new file mode 100644 index 0000000..63744b9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/months.tsv @@ -0,0 +1,12 @@ +Januari +Februari +Maret +April +Mei +Juni +Juli +Agustus +September +Oktober +November +Desember \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/id/data/numbers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/digit.tsv new file mode 100644 index 0000000..9087986 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/digit.tsv @@ -0,0 +1,9 @@ +satu 1 +dua 2 +tiga 3 +empat 4 +lima 5 +enam 6 +tujuh 7 +delapan 8 +sembilan 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/dot.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/dot.tsv new file mode 100644 index 0000000..a5aede6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/dot.tsv @@ -0,0 +1 @@ +titik . \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/hundred.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/hundred.tsv new file mode 100644 index 0000000..9f3057c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/hundred.tsv @@ -0,0 +1,2 @@ +ratus +seratus \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/hundreds.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/hundreds.tsv new file mode 100644 index 0000000..59a4ec8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/hundreds.tsv @@ -0,0 +1,10 @@ +ratus 1 +seratus 1 +dua ratus 2 +tiga ratus 3 +empat ratus 4 +lima ratus 5 +enam ratus 6 +tujuh ratus 7 +delapan ratus 8 +sembilan ratus 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/teen.tsv new file mode 100644 index 0000000..50a23f6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/teen.tsv @@ -0,0 +1,15 @@ +sepuluh 10 +sebelas 11 +duabelas 12 +dua belas 12 +tigabelas 13 +tiga belas 13 +empatbelas 14 +empat belas 14 +limabelas 15 +lima belas 15 +enambelas 16 +enam belas 16 +tujuh belas 17 +delapan belas 18 +sembilan belas 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/thousand.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/thousand.tsv new file mode 100644 index 0000000..ab646fb --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/thousand.tsv @@ -0,0 +1,10 @@ +ribu 1 +seribu 1 +dua ribu 2 +tiga ribu 3 +empat ribu 4 +lima ribu 5 +enam ribu 6 +tujuh ribu 7 +delapan ribu 8 +sembilan ribu 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/thousands.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/thousands.tsv new file mode 100644 index 0000000..fd3be5a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/thousands.tsv @@ -0,0 +1,23 @@ +ribu +seribu +juta +miliar +triliun +milion lipat empat +triliun +sextillion +septillion +oktillion +nonmiliar +satu juta +undecillion +duodecillion +triliun +quattuordecillion +quindecillion +sexdecillion +septendeciliun +octodecillion +novemdecillion +vigintillion +centillion \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/ties.tsv new file mode 100644 index 0000000..eac73c4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/ties.tsv @@ -0,0 +1,9 @@ +dua puluh 2 +tigapuluh 3 +empat puluh 4 +empat puluh 4 +lima puluh 5 +enam puluh 6 +tujuh puluh 7 +delapan puluh 8 +sembilan puluh 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/id/data/numbers/zero.tsv new file mode 100644 index 0000000..7679cf1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/numbers/zero.tsv @@ -0,0 +1 @@ +nol 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/id/data/ordinals/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/id/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/id/data/ordinals/digit.tsv new file mode 100644 index 0000000..0a9bf25 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/ordinals/digit.tsv @@ -0,0 +1,9 @@ +pertama satu +kedua dua +ketiga tiga +keempat empat +kelima lima +keenam enam +ketujuh tujuh +kedelapan delapan +kesembilan sembilan \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/ordinals/teen.tsv b/fun_text_processing/inverse_text_normalization/id/data/ordinals/teen.tsv new file mode 100644 index 0000000..3c36f98 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/ordinals/teen.tsv @@ -0,0 +1 @@ +keduabelas dua belas \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/suppletive.tsv b/fun_text_processing/inverse_text_normalization/id/data/suppletive.tsv new file mode 100644 index 0000000..115460a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/suppletive.tsv @@ -0,0 +1,83 @@ +deer +fish +sheep +foot feet +goose geese +man men +mouse mice +tooth teeth +woman women +won +child children +ox oxen +wife wives +wolf wolves +analysis analyses +criterion criteria +lbs +focus foci +percent +hertz +kroner krone +inch inches +calory calories +yen +megahertz +gigahertz +kilohertz +hertz +CC +c c +horsepower +hundredweight +kilogram force kilograms force +mega siemens +revolution per minute revolutions per minute +mile per hour miles per hour +megabit per second megabits per second +square foot square feet +kilobit per second kilobits per second +degree Celsius degrees Celsius +degree Fahrenheit degrees Fahrenheit +ATM +AU +BQ +CC +CD +DA +EB +EV +F +GB +G +GL +GPA +GY +HA +H +HL +GP +HS +KB +KL +KN +KT +KV +LM +MA +MA +MB +MC +MF +M +MM +MS +MV +MW +PB +PG +PS +S +TB +YB +ZB \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/id/data/time/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/id/data/time/minute_to.tsv b/fun_text_processing/inverse_text_normalization/id/data/time/minute_to.tsv new file mode 100644 index 0000000..edab4d5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/time/minute_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 diff --git a/fun_text_processing/inverse_text_normalization/id/data/time/time_suffix.tsv b/fun_text_processing/inverse_text_normalization/id/data/time/time_suffix.tsv new file mode 100644 index 0000000..b39a9ef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/time/time_suffix.tsv @@ -0,0 +1,8 @@ +p m p.m. +pm p.m. +p.m. +p.m p.m. +am a.m. +a.m. +a.m a.m. +a m a.m. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/time/time_zone.tsv b/fun_text_processing/inverse_text_normalization/id/data/time/time_zone.tsv new file mode 100644 index 0000000..3e0ade4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t diff --git a/fun_text_processing/inverse_text_normalization/id/data/time/to_hour.tsv b/fun_text_processing/inverse_text_normalization/id/data/time/to_hour.tsv new file mode 100644 index 0000000..8c76bff --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/time/to_hour.tsv @@ -0,0 +1,24 @@ +satu 1 +dua 2 +tiga 3 +empat 4 +lima 5 +enam 6 +tujuh 7 +delapan 8 +sembilan 9 +sepuluh 10 +sebelas 11 +dua belas 12 +satu 13 +dua 14 +tiga 15 +empat 16 +lima 17 +enam 18 +tujuh 19 +delapan 20 +sembilan 21 +sepuluh 22 +sebelas 23 +dua belas 24 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/id/data/whitelist.tsv new file mode 100644 index 0000000..b918db3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/data/whitelist.tsv @@ -0,0 +1,12 @@ +e.g. misalnya +dr. dokter +mr. tuan +mrs. rindu +st. santo +7-eleven tujuhsebelas +es3 e s tiga +s&p s dan p +ASAP a s a p +AT&T a t dan t +LLP l l p +ATM a t m diff --git a/fun_text_processing/inverse_text_normalization/id/graph_utils.py b/fun_text_processing/inverse_text_normalization/id/graph_utils.py new file mode 100644 index 0000000..81a4da9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/graph_utils.py @@ -0,0 +1,209 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from pynini import Far +from pynini.examples import plurals +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +delete_zero_or_one_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE, 0, 1)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") +delete_preserve_order = pynini.closure( + pynutil.delete(" preserve_order: true") + | (pynutil.delete(' field_order: "') + DAMO_NOT_QUOTE + pynutil.delete('"')) +) + +suppletive = pynini.string_file(get_abs_path("data/suppletive.tsv")) +# _v = pynini.union("a", "e", "i", "o", "u") +_c = pynini.union( + "b", + "c", + "d", + "f", + "g", + "h", + "j", + "k", + "l", + "m", + "n", + "p", + "q", + "r", + "s", + "t", + "v", + "w", + "x", + "y", + "z", +) +_ies = DAMO_SIGMA + _c + pynini.cross("y", "ies") +_es = DAMO_SIGMA + pynini.union("s", "sh", "ch", "x", "z") + pynutil.insert("es") +_s = DAMO_SIGMA + pynutil.insert("s") + +graph_plural = plurals._priority_union( + suppletive, + plurals._priority_union(_ies, plurals._priority_union(_es, _s, DAMO_SIGMA), DAMO_SIGMA), + DAMO_SIGMA, +).optimize() + +SINGULAR_TO_PLURAL = graph_plural +PLURAL_TO_SINGULAR = pynini.invert(graph_plural) +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) +MIN_NEG_WEIGHT = -0.0001 +MIN_POS_WEIGHT = 0.0001 + + +def generator_main(file_name: str, graphs: Dict[str, "pynini.FstLike"]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def get_plurals(fst): + """ + Given singular returns plurals + + Args: + fst: Fst + + Returns plurals to given singular forms + """ + return SINGULAR_TO_PLURAL @ fst + + +def get_singulars(fst): + """ + Given plural returns singulars + + Args: + fst: Fst + + Returns singulars to given plural forms + """ + return PLURAL_TO_SINGULAR @ fst + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + + Args: + fst: input fst + + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/inverse_text_normalization/id/id_itn_test_expected.txt b/fun_text_processing/inverse_text_normalization/id/id_itn_test_expected.txt new file mode 100644 index 0000000..dfee6bd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/id_itn_test_expected.txt @@ -0,0 +1,29 @@ +2022 +300 +9999 +100001 +100 +1000 +10289 +1289 +01 2345-6789 +14 +15 +16 +17 +18 +19 +20 +106 +600 +100 +100 +1 miliar +123 +123 +24 maret +10076 +100076 +10076 rupiah +76 ++62 21 6539-0605 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/id_itn_test_input.txt b/fun_text_processing/inverse_text_normalization/id/id_itn_test_input.txt new file mode 100644 index 0000000..cf1b3b8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/id_itn_test_input.txt @@ -0,0 +1,29 @@ +dua ribu dua puluh dua +tiga ribu +sembilan ribu sembilan ratus sembilan puluh sembilan +seribu satu +ribu +seribu +seribu dua ratus delapan puluh sembilan +ribu dua ratus delapan puluh sembilan +nol satu dua tiga empat lima enam tujuh delapan sembilan +empat belas +limabelas +enambelas +tujuh belas +delapan belas +sembilan belas +dua puluh +seratus enam +enam ratus +ratus +seratus +satu miliar +seratus dua puluh tiga +ratus dua puluh tiga +dua puluh empat maret +ribu tujuh puluh enam +seribu tujuh puluh enam +ribu tujuh puluh enam rupiah +tujuh puluh enam +ditambah enam dua dua satu enam lima tiga sembilan nol enam nol lima \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/id_unit_test.tsv b/fun_text_processing/inverse_text_normalization/id/id_unit_test.tsv new file mode 100644 index 0000000..49eda5f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/id_unit_test.tsv @@ -0,0 +1,29 @@ +dua ribu dua puluh dua 2022 +tiga ribu 3000 +sembilan ribu sembilan ratus sembilan puluh sembilan 9999 +seribu satu 1001 +ribu 1000 +seribu 1000 +seribu dua ratus delapan puluh sembilan 1289 +ribu dua ratus delapan puluh sembilan 1289 +nol satu dua tiga empat lima enam tujuh delapan sembilan 01 2345-6789 +empat belas 14 +limabelas 15 +enambelas 16 +tujuh belas 17 +delapan belas 18 +sembilan belas 19 +dua puluh 20 +seratus enam 106 +enam ratus 600 +ratus 100 +seratus 100 +satu miliar 1 miliar +seratus dua puluh tiga 123 +ratus dua puluh tiga 123 +dua puluh empat maret 24 maret +ribu tujuh puluh enam 1076 +seribu tujuh puluh enam 1076 +ribu tujuh puluh enam rupiah 1076 rupiah +tujuh puluh enam 76 +ditambah enam dua dua satu enam lima tiga sembilan nol enam nol lima +62 21 6539-0605 diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/id/taggers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/id/taggers/cardinal.py new file mode 100644 index 0000000..f9e826e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/cardinal.py @@ -0,0 +1,161 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path, num_to_word +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. minus twenty three -> cardinal { integer: "23" negative: "-" } } + Numbers below thirteen are not converted. + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_hundreds = pynini.string_file(get_abs_path("data/numbers/hundreds.tsv")) + graph_thousand = pynini.string_file(get_abs_path("data/numbers/thousand.tsv")) + + graph_hundred = pynini.cross("ratus", "") | pynini.cross("seratus", "") + + graph_hundred_component = pynini.union( + graph_digit + delete_space + graph_hundred, pynutil.insert("0") + ) + graph_hundred_component += delete_space + graph_hundred_component += pynini.union( + graph_teen | pynutil.insert("00"), + (graph_ties | pynutil.insert("0")) + delete_space + (graph_digit | pynutil.insert("0")), + ) + + graph_one_hundred_component = pynini.union( + pynini.cross("ratus", "1") | pynini.cross("seratus", "1") + ) + graph_one_hundred_component += delete_space + graph_one_hundred_component += pynini.union( + graph_teen | pynutil.insert("00"), + (graph_ties | pynutil.insert("0")) + delete_space + (graph_digit | pynutil.insert("0")), + ) + graph_hundred_component = graph_hundred_component | graph_one_hundred_component + + graph_hundred_component_at_least_one_none_zero_digit = graph_hundred_component @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) + graph_thousand = pynini.cross("ribu", "") | pynini.cross("seribu", "") + graph_one_thousand_component = pynini.union( + pynini.cross("ribu", "1") | pynini.cross("seribu", "1") + ) + + graph_thousands = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("ribu") | pynutil.delete("seribu")), + pynutil.insert("000", weight=0.1), + ) + graph_thousands = graph_thousands | (pynutil.insert("00") + graph_one_thousand_component) + + graph_million = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("juta") | pynutil.delete("sejuta")), + pynutil.insert("000", weight=0.1), + ) + graph_billion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + ( + pynutil.delete("miliar") + | pynutil.delete("semiliar") + | pynutil.delete("milyar") + | pynutil.delete("semilyar") + ), + pynutil.insert("000", weight=0.1), + ) + graph_trillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("triliun") | pynutil.delete("setriliun")), + pynutil.insert("000", weight=0.1), + ) + graph_quadrillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("milion lipat empat"), + pynutil.insert("000", weight=0.1), + ) + graph_quintillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("triliun"), + pynutil.insert("000", weight=0.1), + ) + graph_sextillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("sextillion"), + pynutil.insert("000", weight=0.1), + ) + + graph = pynini.union( + graph_sextillion + + delete_space + + graph_quintillion + + delete_space + + graph_quadrillion + + delete_space + + graph_trillion + + delete_space + + graph_billion + + delete_space + + graph_million + + delete_space + + graph_thousands + + delete_space + + graph_hundred_component, + # graph_digit, + graph_zero, + ) + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + labels_exception = ["nol"] + graph_exception = pynini.union(*labels_exception) + + graph = ( + pynini.cdrewrite(pynutil.delete("dan"), DAMO_SPACE, DAMO_SPACE, DAMO_SIGMA) + @ (DAMO_ALPHA + DAMO_SIGMA) + @ graph + ) + + self.graph_no_exception = graph + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("kurang", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/date.py b/fun_text_processing/inverse_text_normalization/id/taggers/date.py new file mode 100644 index 0000000..82147fe --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/date.py @@ -0,0 +1,150 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + +graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")).optimize() +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize() +ties_graph = pynini.string_file(get_abs_path("data/numbers/ties.tsv")).optimize() + + +def _get_month_graph(): + """ + Transducer for month, e.g. march -> march + """ + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + return month_graph + + +def _get_ties_graph(): + """ + Transducer for 20-99 e.g + twenty three -> 23 + """ + graph = ties_graph + (delete_space + graph_digit | pynutil.insert("0")) + return graph + + +def _get_range_graph(): + """ + Transducer for decades (1**0s, 2**0s), centuries (2*00s, 1*00s), millennia (2000s) + """ + graph_ties = _get_ties_graph() + graph = (graph_ties | graph_teen) + delete_space + pynini.cross("ratusan", "00s") + graph |= pynini.cross("dua", "2") + delete_space + pynini.cross("ribuan", "000s") + graph |= ( + (graph_ties | graph_teen) + + delete_space + + (pynini.closure(DAMO_ALPHA, 1) + (pynini.cross("ies", "y") | pynutil.delete("s"))) + @ (graph_ties | pynini.cross("sepuluh", "10")) + + pynutil.insert("s") + ) + graph @= pynini.union("1", "2") + DAMO_DIGIT + DAMO_DIGIT + DAMO_DIGIT + "s" + return graph + + +def _get_year_graph(): + """ + Transducer for year, e.g. twenty twenty -> 2020 + """ + + def _get_digits_graph(): + zero = pynini.cross((pynini.accep("oh") | pynini.accep("o")), "0") + graph = zero + delete_space + graph_digit + graph.optimize() + return graph + + def _get_thousands_graph(): + graph_ties = _get_ties_graph() + graph_hundred_component = ( + graph_digit + delete_space + pynutil.delete("ratus") + ) | pynutil.insert("0") + graph = ( + graph_digit + + delete_space + + pynutil.delete("ribu") + + delete_space + + graph_hundred_component + + delete_space + + (graph_teen | graph_ties) + ) + return graph + + graph_ties = _get_ties_graph() + graph_digits = _get_digits_graph() + graph_thousands = _get_thousands_graph() + year_graph = ( + # 20 19, 40 12, 2012 - assuming no limit on the year + (graph_teen + delete_space + (graph_ties | graph_digits | graph_teen)) + | (graph_ties + delete_space + (graph_ties | graph_digits | graph_teen)) + | graph_thousands + ) + year_graph.optimize() + return year_graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. january fifth twenty twelve -> date { month: "january" day: "5" year: "2012" preserve_order: true } + e.g. the fifth of january twenty twelve -> date { day: "5" month: "january" year: "2012" preserve_order: true } + e.g. twenty twenty -> date { year: "2012" preserve_order: true } + + Args: + ordinal: OrdinalFst + """ + + def __init__(self, ordinal: GraphFst): + super().__init__(name="date", kind="classify") + + ordinal_graph = ordinal.graph + year_graph = _get_year_graph() + YEAR_WEIGHT = 0.001 + year_graph = pynutil.add_weight(year_graph, YEAR_WEIGHT) + month_graph = _get_month_graph() + + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + + day_graph = ( + pynutil.insert('day: "') + pynutil.add_weight(ordinal_graph, -0.7) + pynutil.insert('"') + ) + graph_year = ( + delete_extra_space + + pynutil.insert('year: "') + + pynutil.add_weight(year_graph, -YEAR_WEIGHT) + + pynutil.insert('"') + ) + optional_graph_year = pynini.closure( + graph_year, + 0, + 1, + ) + graph_mdy = month_graph + ( + (delete_extra_space + day_graph) + | graph_year + | (delete_extra_space + day_graph + graph_year) + ) + graph_dmy = ( + pynutil.delete("the") + + delete_space + + day_graph + + delete_space + + pynutil.delete("of") + + delete_extra_space + + month_graph + + optional_graph_year + ) + graph_year = ( + pynutil.insert('year: "') + (year_graph | _get_range_graph()) + pynutil.insert('"') + ) + + final_graph = graph_mdy | graph_dmy | graph_year + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/id/taggers/decimal.py new file mode 100644 index 0000000..98b4205 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/decimal.py @@ -0,0 +1,100 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil +import pdb + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + numbers = cardinal_up_to_hundred @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + suffix = pynini.union("juta", "miliar", "triliun", "kuadriliun", "triliun", "sextillion") + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + + delete_extra_space + + pynutil.insert('quantity: "') + + (suffix | "ribu") + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. minus twelve point five o o six billion -> decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } + e.g. one billion -> decimal { integer_part: "1" quantity: "billion" } + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_decimal = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + + graph_decimal |= pynini.string_file(get_abs_path("data/numbers/zero.tsv")) | pynini.cross( + "o", "0" + ) + + graph_decimal = pynini.closure(graph_decimal + delete_space) + graph_decimal + self.graph = graph_decimal + + point = pynutil.delete("point") # titik + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("kurang", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + point + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/id/taggers/electronic.py new file mode 100644 index 0000000..3d401f0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/electronic.py @@ -0,0 +1,100 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_ALPHA, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. c d f one at a b c dot e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("dot", ".") + username = ( + alpha_num + pynini.closure(delete_extra_space + accepted_username) + ) | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + username = pynutil.insert('username: "') + username + pynutil.insert('"') + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete("at") + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("w w w", "www"), "www") + protocol_start = ( + pynini.cross("h t t p", "http") | pynini.cross("h t t p s", "https") + ) + pynini.cross(" colon slash slash ", "://") + # .com, + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + ( + domain + | pynini.closure( + accepted_username + delete_extra_space, + ) + + accepted_username + ) + ) + + protocol_default = ( + ( + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + ) + + pynini.closure(ending, 1) + ).optimize() + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + protocol_default + ).optimize() + + protocol |= ( + pynini.closure(protocol_end + delete_extra_space + process_dot, 0, 1) + protocol_default + ) + + protocol = pynutil.insert('protocol: "') + protocol.optimize() + pynutil.insert('"') + graph |= protocol + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/id/taggers/fraction.py new file mode 100644 index 0000000..48f3a98 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/fraction.py @@ -0,0 +1,11 @@ +from fun_text_processing.inverse_text_normalization.id.graph_utils import GraphFst + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + """ + + def __init__(self): + super().__init__(name="fraction", kind="classify") + # integer_part # numerator # denominator diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/measure.py b/fun_text_processing/inverse_text_normalization/id/taggers/measure.py new file mode 100644 index 0000000..519cc08 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/measure.py @@ -0,0 +1,97 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. minus twelve kilograms -> measure { negative: "true" cardinal { integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_unit = pynini.string_file(get_abs_path("data/measurements.tsv")) + graph_unit_singular = pynini.invert(graph_unit) # singular -> abbr + graph_unit_plural = get_singulars(graph_unit_singular) # plural -> abbr + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("kurang", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_singular = convert_space(graph_unit_singular) + unit_plural = convert_space(graph_unit_plural) + unit_misc = ( + pynutil.insert("/") + + pynutil.delete("per") + + delete_space + + convert_space(graph_unit_singular) + ) + + unit_singular = ( + pynutil.insert('units: "') + + ( + unit_singular + | unit_misc + | pynutil.add_weight(unit_singular + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + unit_plural = ( + pynutil.insert('units: "') + + ( + unit_plural + | unit_misc + | pynutil.add_weight(unit_plural + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "satu") @ cardinal_graph) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + pynini.cross("satu", "1") + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/money.py b/fun_text_processing/inverse_text_normalization/id/taggers/money.py new file mode 100644 index 0000000..fbe7af4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/money.py @@ -0,0 +1,110 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. twelve dollars and five cents -> money { integer_part: "12" fractional_part: 05 currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + # add support for missing hundred (only for 3 digit numbers) + # "one fifty" -> "one hundred fifty" + with_hundred = pynini.compose( + pynini.closure(DAMO_NOT_SPACE) + + pynini.accep(" ") + + pynutil.insert("ratus ") + + DAMO_SIGMA, + pynini.compose(cardinal_graph, DAMO_DIGIT**3), + ) + cardinal_graph |= with_hundred + graph_decimal_final = decimal.final_graph_wo_negative + + unit = pynini.string_file(get_abs_path("data/currency.tsv")) + unit_singular = pynini.invert(unit) + unit_plural = get_singulars(unit_singular) + + graph_unit_singular = ( + pynutil.insert('currency: "') + convert_space(unit_singular) + pynutil.insert('"') + ) + graph_unit_plural = ( + pynutil.insert('currency: "') + convert_space(unit_plural) + pynutil.insert('"') + ) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + # twelve dollars (and) fifty cents, zero cents + cents_standalone = ( + pynutil.insert('fractional_part: "') + + pynini.union( + pynutil.add_weight(((DAMO_SIGMA - "satu") @ cardinal_graph), -0.7) + @ add_leading_zero_to_double_digit + + delete_space + + pynutil.delete("sen"), + pynini.cross("satu", "01") + delete_space + pynutil.delete("sen"), + ) + + pynutil.insert('"') + ) + + optional_cents_standalone = pynini.closure( + delete_space + + pynini.closure(pynutil.delete("dan") + delete_space, 0, 1) + + insert_space + + cents_standalone, + 0, + 1, + ) + # twelve dollars fifty, only after integer + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('fractional_part: "') + + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "satu") @ cardinal_graph) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_plural + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_integer |= ( + pynutil.insert('integer_part: "') + + pynini.cross("satu", "1") + + pynutil.insert('"') + + delete_extra_space + + graph_unit_singular + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_decimal = graph_decimal_final + delete_extra_space + graph_unit_plural + graph_decimal |= pynutil.insert('currency: "$" integer_part: "0" ') + cents_standalone + final_graph = graph_integer | graph_decimal + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/id/taggers/ordinal.py new file mode 100644 index 0000000..46c0363 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/ordinal.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import DAMO_CHAR, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + e.g. thirteenth -> ordinal { integer: "13" } + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="ordinal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + graph_digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")) + graph_teens = pynini.string_file(get_abs_path("data/ordinals/teen.tsv")) + graph = pynini.closure(DAMO_CHAR) + pynini.union( + graph_digit, graph_teens, pynini.cross("tieth", "ty"), pynini.cross("th", "") + ) # TODO + + self.graph = graph @ cardinal_graph + final_graph = pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/id/taggers/punctuation.py new file mode 100644 index 0000000..fee28ae --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/id/taggers/telephone.py new file mode 100644 index 0000000..6256fed --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/telephone.py @@ -0,0 +1,149 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_ALNUM, + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +def get_serial_number(cardinal): + """ + any alphanumerical character sequence with at least one number with length greater equal to 3 + """ + digit = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT) + character = digit | DAMO_ALPHA + sequence = character + pynini.closure(pynutil.delete(" ") + character, 2) + sequence = sequence @ (pynini.closure(DAMO_ALNUM) + DAMO_DIGIT + pynini.closure(DAMO_ALNUM)) + return sequence.optimize() + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + one two three one two three five six seven eight -> { number_part: "123-123-5678" } + + This class also support card number and IP format. + "one two three dot one double three dot o dot four o" -> { number_part: "123.133.0.40"} + + "three two double seven three two one four three two one four three double zero five" -> + { number_part: 3277 3214 3214 3005} + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="telephone", kind="classify") + # country code, number_part, extension + digit_to_str = ( + pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize()) + | pynini.cross("0", pynini.union("o", "oh", "nol")).optimize() + ) + + str_to_digit = pynini.invert(digit_to_str) + + double_digit = pynini.union( + *[ + pynini.cross( + pynini.project(str(i) @ digit_to_str, "output") + + pynini.accep(" ") + + pynini.project(str(i) @ digit_to_str, "output"), + pynutil.insert("dobel ") + pynini.project(str(i) @ digit_to_str, "output"), + ) + for i in range(10) + ] + ) + double_digit.invert() + + # to handle cases like "one twenty three" + two_digit_cardinal = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT**2) + double_digit_to_digit = ( + pynini.compose(double_digit, str_to_digit + pynutil.delete(" ") + str_to_digit) + | two_digit_cardinal + ) + + single_or_double_digit = ( + pynutil.add_weight(double_digit_to_digit, -0.0001) | str_to_digit + ).optimize() + single_or_double_digit |= ( + single_or_double_digit + + pynini.closure( + pynutil.add_weight(pynutil.delete(" ") + single_or_double_digit, 0.0001) + ) + ).optimize() + + number_part = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**2 + + pynutil.insert(" ") + + DAMO_DIGIT**4 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + number_part = ( + pynutil.insert('number_part: "') + number_part.optimize() + pynutil.insert('"') + ) + + cardinal_option = pynini.compose(single_or_double_digit, DAMO_DIGIT ** (2, 3)) + + country_code = ( + pynutil.insert('country_code: "') + + pynini.closure(pynini.cross("ditambah ", "+"), 0, 1) + + ( + (pynini.closure(str_to_digit + pynutil.delete(" "), 0, 2) + str_to_digit) + | cardinal_option + ) + + pynutil.insert('"') + ) + + optional_country_code = pynini.closure( + country_code + pynutil.delete(" ") + insert_space, 0, 1 + ).optimize() + graph = optional_country_code + number_part + + # credit card number + space_four_digits = insert_space + DAMO_DIGIT**4 + credit_card_graph = pynini.compose( + single_or_double_digit, DAMO_DIGIT**4 + space_four_digits**3 + ).optimize() + graph |= ( + pynutil.insert('number_part: "') + credit_card_graph.optimize() + pynutil.insert('"') + ) + + # SSN + ssn_graph = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**2 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + graph |= pynutil.insert('number_part: "') + ssn_graph.optimize() + pynutil.insert('"') + + # ip + digit_or_double = ( + pynini.closure(str_to_digit + pynutil.delete(" "), 0, 1) + double_digit_to_digit + ) + digit_or_double |= double_digit_to_digit + pynini.closure( + pynutil.delete(" ") + str_to_digit, 0, 1 + ) + digit_or_double |= str_to_digit + (pynutil.delete(" ") + str_to_digit) ** (0, 2) + digit_or_double |= cardinal_option + digit_or_double = digit_or_double.optimize() + + ip_graph = digit_or_double + (pynini.cross(" dot ", ".") + digit_or_double) ** 3 + + graph |= pynutil.insert('number_part: "') + ip_graph.optimize() + pynutil.insert('"') + graph |= ( + pynutil.insert('number_part: "') + + pynutil.add_weight(get_serial_number(cardinal=cardinal), weight=0.0001) + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/time.py b/fun_text_processing/inverse_text_normalization/id/taggers/time.py new file mode 100644 index 0000000..3071c9f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/time.py @@ -0,0 +1,151 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path, num_to_word +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. twelve thirty -> time { hours: "12" minutes: "30" } + e.g. twelve past one -> time { minutes: "12" hours: "1" } + e.g. two o clock a m -> time { hours: "2" suffix: "a.m." } + e.g. quarter to two -> time { hours: "1" minutes: "45" } + e.g. quarter past two -> time { hours: "2" minutes: "15" } + e.g. half past two -> time { hours: "2" minutes: "30" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + suffix_graph = pynini.string_file(get_abs_path("data/time/time_suffix.tsv")) + time_zone_graph = pynini.invert(pynini.string_file(get_abs_path("data/time/time_zone.tsv"))) + to_hour_graph = pynini.string_file(get_abs_path("data/time/to_hour.tsv")) + minute_to_graph = pynini.string_file(get_abs_path("data/time/minute_to.tsv")) + + cardinal = pynutil.add_weight(CardinalFst().graph_no_exception, weight=-0.7) + + labels_hour = [ + "nol", + "satu", + "dua", + "tiga", + "empat", + "lima", + "enam", + "tujuh", + "delapan", + "sembilan", + "sepuluh", + "sebelas", + "duabelas", + "tigabelas", + ] + labels_minute_single = [num_to_word(x) for x in range(1, 10)] + labels_minute_double = [num_to_word(x) for x in range(10, 60)] + + graph_hour = pynini.union(*labels_hour) @ cardinal + + graph_minute_single = pynini.union(*labels_minute_single) @ cardinal + graph_minute_double = pynini.union(*labels_minute_double) @ cardinal + graph_minute_verbose = pynini.cross("setengah", "30") | pynini.cross("seperempat", "15") + oclock = pynini.cross(pynini.union("jam", "pukul"), "") + + final_graph_hour = pynutil.insert('hours: "') + graph_hour + pynutil.insert('"') + graph_minute = ( + oclock + pynutil.insert("00") + | pynutil.delete("o") + delete_space + graph_minute_single + | graph_minute_double + ) + final_suffix = ( + pynutil.insert('suffix: "') + convert_space(suffix_graph) + pynutil.insert('"') + ) + final_suffix = delete_space + insert_space + final_suffix + final_suffix_optional = pynini.closure(final_suffix, 0, 1) + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + # five o' clock + # two o eight, two thirty five (am/pm) + # two pm/am + graph_hm = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minute + + pynutil.insert('"') + ) + # 10 past four, quarter past four, half past four + graph_m_past_h = ( + pynutil.insert('minutes: "') + + pynini.union(graph_minute_single, graph_minute_double, graph_minute_verbose) + + pynutil.insert('"') + + delete_space + + pynutil.delete("setengah") + + delete_extra_space + + final_graph_hour + ) + + graph_quarter_time = ( + pynutil.insert('minutes: "') + + pynini.cross("seperempat", "45") + + pynutil.insert('"') + + delete_space + + pynutil.delete(pynini.union("to", "till")) + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + ) + + graph_m_to_h_suffix_time = ( + pynutil.insert('minutes: "') + + ((graph_minute_single | graph_minute_double).optimize() @ minute_to_graph) + + pynutil.insert('"') + + pynini.closure( + delete_space + pynutil.delete(pynini.union("min", "mins", "menit")), 0, 1 + ) + + delete_space + + pynutil.delete(pynini.union("sampai")) + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + + final_suffix + ) + + graph_h = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + (pynutil.insert("00") | graph_minute) + + pynutil.insert('"') + + final_suffix + + final_time_zone_optional + ) + final_graph = ( + (graph_hm | graph_m_past_h | graph_quarter_time) + + final_suffix_optional + + final_time_zone_optional + ) + final_graph |= graph_h + final_graph |= graph_m_to_h_suffix_time + + final_graph = self.add_tokens(final_graph.optimize()) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/id/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..8037c25 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/tokenize_and_classify.py @@ -0,0 +1,102 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.id.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.id.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.id.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.id.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.id.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.id.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.id.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.id.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.id.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.id.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.id.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.id.taggers.word import WordFst +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_id_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst(cardinal) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst(ordinal=ordinal).fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst(cardinal).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/id/taggers/whitelist.py new file mode 100644 index 0000000..c238f2c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.id.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/taggers/word.py b/fun_text_processing/inverse_text_normalization/id/taggers/word.py new file mode 100644 index 0000000..8af6ed9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/text_cases.tsv b/fun_text_processing/inverse_text_normalization/id/text_cases.tsv new file mode 100644 index 0000000..d8c396a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/text_cases.tsv @@ -0,0 +1,40 @@ +dua ribu dua puluh dua 2022 +nol satu dua tiga empat lima enam tujuh delapan sembilan 0123456789 +empat belas 14 +limabelas 15 +enambelas 16 +tujuh belas 17 +delapan belas 18 +sembilan belas 19 +dua puluh 20 +seratus enam 106 +enam ratus 600 +ratus 100 +seratus 100 +satu juta 1,000,000 +satu miliar 1 miliar +seratus dua puluh tiga 123 +ratus dua puluh tiga 123 +dua puluh empat maret 24th March +seribu dua ratus delapan puluh sembilan 1289 +lima juta tiga ribu tujuh puluh enam rupiah Rp5003076 +ribu tujuh puluh enam rupiah Rp1076 +tujuh puluh enam rupiah dollar $1076 +ditambah enam dua dua satu enam lima tiga sembilan nol enam nol lima +62 21 6539-0605 +tiga ribu 3000 +sembilan ribu sembilan ratus sembilan puluh sembilan 9999 +seribu satu 1001 +nol 0 +satu 1 +dua 2 +tiga 3 +empat 4 +lima 5 +enam 6 +tujuh 7 +delapan 8 +sembilan 9 +sepuluh 10 +sebelas 11 +dua belas 12 +tigabelas 13 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/id/utils.py b/fun_text_processing/inverse_text_normalization/id/utils.py new file mode 100644 index 0000000..38a95ba --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/utils.py @@ -0,0 +1,33 @@ +import os +from typing import Union + +import inflect + +_inflect = inflect.engine() + + +def num_to_word(x: Union[str, int]): + """ + converts integer to spoken representation + + Args + x: integer + + Returns: spoken representation + """ + if isinstance(x, int): + x = str(x) + x = _inflect.number_to_words(str(x)).replace("-", " ").replace(",", "") + return x + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/cardinal.py new file mode 100644 index 0000000..e5ed7ea --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/date.py new file mode 100644 index 0000000..995836c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/date.py @@ -0,0 +1,70 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "january" day: "5" year: "2012" preserve_order: true } -> february 5 2012 + date { day: "5" month: "january" year: "2012" preserve_order: true } -> 5 february 2012 + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + + # month (day) year + graph_mdy = ( + month + + pynini.closure(delete_extra_space + day, 0, 1) + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + # (day) month year + graph_dmy = ( + pynini.closure(day + delete_extra_space, 0, 1) + + month + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = (graph_mdy | year | graph_dmy) + delete_space + optional_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/decimal.py new file mode 100644 index 0000000..99cf634 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/decimal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/electronic.py new file mode 100644 index 0000000..4994cb9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/fraction.py new file mode 100644 index 0000000..a424b25 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/fraction.py @@ -0,0 +1,10 @@ +from fun_text_processing.inverse_text_normalization.id.graph_utils import GraphFst + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction, + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/measure.py new file mode 100644 index 0000000..470169d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/measure.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + pynutil.insert(" ") + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/money.py new file mode 100644 index 0000000..11bf875 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/money.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> $12.05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/ordinal.py new file mode 100644 index 0000000..2a6801f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/ordinal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" } -> 13th + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + convert_eleven = pynini.cross("11", "11th") + convert_twelve = pynini.cross("12", "12th") + convert_thirteen = pynini.cross("13", "13th") + convert_one = pynini.cross("1", "1st") + convert_two = pynini.cross("2", "2nd") + convert_three = pynini.cross("3", "3rd") + convert_rest = pynutil.insert("th", weight=0.01) + + suffix = pynini.cdrewrite( + convert_eleven + | convert_twelve + | convert_thirteen + | convert_one + | convert_two + | convert_three + | convert_rest, + "", + "[EOS]", + DAMO_SIGMA, + ) + graph = graph @ suffix + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/telephone.py new file mode 100644 index 0000000..2332057 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/telephone.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_country_code = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" "), + 0, + 1, + ) + delete_tokens = self.delete_tokens(optional_country_code + number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/time.py new file mode 100644 index 0000000..b98fc99 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/time.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "12" minutes: "30" } -> 12:30 + time { hours: "1" minutes: "12" } -> 01:12 + time { hours: "2" suffix: "a.m." } -> 02:00 a.m. + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + suffix = ( + delete_space + + insert_space + + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + zone = ( + delete_space + + insert_space + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + graph = ( + hour @ add_leading_zero_to_double_digit + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + optional_suffix + + optional_zone + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/verbalize.py new file mode 100644 index 0000000..7aaef2a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/verbalize.py @@ -0,0 +1,47 @@ +from fun_text_processing.inverse_text_normalization.id.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.id.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/verbalize_final.py new file mode 100644 index 0000000..014dac1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.id.verbalizers.word import WordFst +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/whitelist.py new file mode 100644 index 0000000..4450202 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/id/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/id/verbalizers/word.py new file mode 100644 index 0000000..079c613 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/id/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.id.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/inverse_normalize.py b/fun_text_processing/inverse_text_normalization/inverse_normalize.py new file mode 100644 index 0000000..2dffd5d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/inverse_normalize.py @@ -0,0 +1,230 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from argparse import ArgumentParser +from time import perf_counter +from typing import List + +from fun_text_processing.text_normalization.data_loader_utils import load_file, write_file +from fun_text_processing.text_normalization.normalize import Normalizer +from fun_text_processing.text_normalization.token_parser import TokenParser + + +class InverseNormalizer(Normalizer): + """ + Inverse normalizer that converts text from spoken to written form. Useful for ASR postprocessing. + Input is expected to have no punctuation outside of approstrophe (') and dash (-) and be lower cased. + + Args: + lang: language specifying the ITN + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__( + self, + lang: str = "en", + cache_dir: str = None, + overwrite_cache: bool = False, + enable_standalone_number: bool = True, + enable_0_to_9: bool = True, + ): + + if lang == "en": + from fun_text_processing.inverse_text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + elif lang == "id": + from fun_text_processing.inverse_text_normalization.id.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.id.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + elif lang == "ja": + from fun_text_processing.inverse_text_normalization.ja.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.ja.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + elif lang == "es": + from fun_text_processing.inverse_text_normalization.es.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.es.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + elif lang == "pt": + from fun_text_processing.inverse_text_normalization.pt.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.pt.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + elif lang == "ru": + from fun_text_processing.inverse_text_normalization.ru.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.ru.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + elif lang == "de": + from fun_text_processing.inverse_text_normalization.de.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.de.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "fr": + from fun_text_processing.inverse_text_normalization.fr.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.fr.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "vi": + from fun_text_processing.inverse_text_normalization.vi.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.vi.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "ko": + from fun_text_processing.inverse_text_normalization.ko.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.ko.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "zh": + from fun_text_processing.inverse_text_normalization.zh.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.zh.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "tl": + from fun_text_processing.inverse_text_normalization.tl.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.inverse_text_normalization.tl.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + self.tagger = ClassifyFst(cache_dir=cache_dir, overwrite_cache=overwrite_cache) + self.verbalizer = VerbalizeFinalFst() + self.parser = TokenParser() + self.lang = lang + self.convert_number = enable_standalone_number + self.enable_0_to_9 = enable_0_to_9 + + def inverse_normalize_list(self, texts: List[str], verbose=False) -> List[str]: + """ + NeMo inverse text normalizer + + Args: + texts: list of input strings + verbose: whether to print intermediate meta information + + Returns converted list of input strings + """ + # print(texts) + return self.normalize_list(texts=texts, verbose=verbose) + + def inverse_normalize(self, text: str, verbose: bool) -> str: + """ + Main function. Inverse normalizes tokens from spoken to written form + e.g. twelve kilograms -> 12 kg + + Args: + text: string that may include semiotic classes + verbose: whether to print intermediate meta information + + Returns: written form + """ + print(text) + return self.normalize(text=text, verbose=verbose) + + +def str2bool(s, default=False): + s = s.lower() + if s == "true": + return True + elif s == "false": + return False + else: + return default + + +def parse_args(): + parser = ArgumentParser() + input = parser.add_mutually_exclusive_group() + input.add_argument("--text", dest="input_string", help="input string", type=str) + input.add_argument("--input_file", dest="input_file", help="input file path", type=str) + parser.add_argument("--output_file", dest="output_file", help="output file path", type=str) + parser.add_argument( + "--language", + help="language", + choices=["en", "id", "ja", "de", "es", "pt", "ru", "fr", "vi", "ko", "zh", "tl"], + default="en", + type=str, + ) + parser.add_argument("--verbose", help="print info for debugging", action="store_true") + parser.add_argument( + "--overwrite_cache", help="set to True to re-create .far grammar files", action="store_true" + ) + parser.add_argument( + "--cache_dir", + help="path to a dir with .far grammar file. Set to None to avoid using cache", + default=None, + type=str, + ) + parser.add_argument( + "--enable_standalone_number", type=str, default="True", help="enable standalone number" + ) + parser.add_argument( + "--enable_0_to_9", type=str, default="True", help="enable convert number 0 to 9" + ) + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + start_time = perf_counter() + if args.language == "ja": + inverse_normalizer = InverseNormalizer( + lang=args.language, + cache_dir=args.cache_dir, + overwrite_cache=args.overwrite_cache, + enable_standalone_number=str2bool(args.enable_standalone_number), + enable_0_to_9=str2bool(args.enable_0_to_9), + ) + else: + inverse_normalizer = InverseNormalizer( + lang=args.language, cache_dir=args.cache_dir, overwrite_cache=args.overwrite_cache + ) + print(f"Time to generate graph: {round(perf_counter() - start_time, 2)} sec") + + if args.input_string: + print(inverse_normalizer.inverse_normalize(args.input_string, verbose=args.verbose)) + elif args.input_file: + print("Loading data: " + args.input_file) + data = load_file(args.input_file) + + print("- Data: " + str(len(data)) + " sentences") + prediction = inverse_normalizer.inverse_normalize_list(data, verbose=args.verbose) + if args.output_file: + write_file(args.output_file, prediction) + print(f"- Denormalized. Writing out to {args.output_file}") + else: + print(prediction) diff --git a/fun_text_processing/inverse_text_normalization/ja/__init__.py b/fun_text_processing/inverse_text_normalization/ja/__init__.py new file mode 100644 index 0000000..4f73ff2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/ja/clean_eval_data.py b/fun_text_processing/inverse_text_normalization/ja/clean_eval_data.py new file mode 100644 index 0000000..e975bf5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/clean_eval_data.py @@ -0,0 +1,384 @@ +from argparse import ArgumentParser +from typing import List + +import regex as re +from fun_text_processing.text_normalization.data_loader_utils import ( + EOS_TYPE, + Instance, + load_files, + training_data_to_sentences, +) + + +""" +This file is for evaluation purposes. +filter_loaded_data() cleans data (list of instances) for inverse text normalization. Filters and cleaners can be specified for each semiotic class individually. +For example, normalized text should only include characters and whitespace characters but no punctuation. + Cardinal unnormalized instances should contain at least one integer and all other characters are removed. +""" + + +class Filter: + """ + Filter class + + Args: + class_type: semiotic class used in dataset + process_func: function to transform text + filter_func: function to filter text + + """ + + def __init__(self, class_type: str, process_func: object, filter_func: object): + self.class_type = class_type + self.process_func = process_func + self.filter_func = filter_func + + def filter(self, instance: Instance) -> bool: + """ + filter function + + Args: + filters given instance with filter function + + Returns: True if given instance fulfills criteria or does not belong to class type + """ + if instance.token_type != self.class_type: + return True + return self.filter_func(instance) + + def process(self, instance: Instance) -> Instance: + """ + process function + + Args: + processes given instance with process function + + Returns: processed instance if instance belongs to expected class type or original instance + """ + if instance.token_type != self.class_type: + return instance + return self.process_func(instance) + + +def filter_cardinal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_cardinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[^0-9]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_ordinal_1(instance: Instance) -> bool: + ok = re.search(r"(st|nd|rd|th)\s*$", instance.un_normalized) + return ok + + +def process_ordinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[,\s]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_decimal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_decimal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_measure_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_measure_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"m2", "m²", un_normalized) + un_normalized = re.sub(r"(\d)([^\d.\s])", r"\1 \2", un_normalized) + normalized = re.sub(r"[^a-z\s]", "", normalized) + normalized = re.sub(r"per ([a-z\s]*)s$", r"per \1", normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_money_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_money_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"a\$", r"$", un_normalized) + un_normalized = re.sub(r"us\$", r"$", un_normalized) + un_normalized = re.sub(r"(\d)m\s*$", r"\1 million", un_normalized) + un_normalized = re.sub(r"(\d)bn?\s*$", r"\1 billion", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_time_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_time_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r": ", ":", un_normalized) + un_normalized = re.sub(r"(\d)\s?a\s?m\s?", r"\1 a.m.", un_normalized) + un_normalized = re.sub(r"(\d)\s?p\s?m\s?", r"\1 p.m.", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_plain_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_plain_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_punct_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_punct_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_date_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_date_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_letters_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_letters_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_verbatim_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_verbatim_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_digit_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_digit_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_telephone_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_telephone_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_electronic_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_electronic_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_fraction_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_fraction_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_address_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_address_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +filters = [] +filters.append( + Filter(class_type="CARDINAL", process_func=process_cardinal_1, filter_func=filter_cardinal_1) +) +filters.append( + Filter(class_type="ORDINAL", process_func=process_ordinal_1, filter_func=filter_ordinal_1) +) +filters.append( + Filter(class_type="DECIMAL", process_func=process_decimal_1, filter_func=filter_decimal_1) +) +filters.append( + Filter(class_type="MEASURE", process_func=process_measure_1, filter_func=filter_measure_1) +) +filters.append(Filter(class_type="MONEY", process_func=process_money_1, filter_func=filter_money_1)) +filters.append(Filter(class_type="TIME", process_func=process_time_1, filter_func=filter_time_1)) + +filters.append(Filter(class_type="DATE", process_func=process_date_1, filter_func=filter_date_1)) +filters.append(Filter(class_type="PLAIN", process_func=process_plain_1, filter_func=filter_plain_1)) +filters.append(Filter(class_type="PUNCT", process_func=process_punct_1, filter_func=filter_punct_1)) +filters.append( + Filter(class_type="LETTERS", process_func=process_letters_1, filter_func=filter_letters_1) +) +filters.append( + Filter(class_type="VERBATIM", process_func=process_verbatim_1, filter_func=filter_verbatim_1) +) +filters.append(Filter(class_type="DIGIT", process_func=process_digit_1, filter_func=filter_digit_1)) +filters.append( + Filter(class_type="TELEPHONE", process_func=process_telephone_1, filter_func=filter_telephone_1) +) +filters.append( + Filter( + class_type="ELECTRONIC", process_func=process_electronic_1, filter_func=filter_electronic_1 + ) +) +filters.append( + Filter(class_type="FRACTION", process_func=process_fraction_1, filter_func=filter_fraction_1) +) +filters.append( + Filter(class_type="ADDRESS", process_func=process_address_1, filter_func=filter_address_1) +) +filters.append(Filter(class_type=EOS_TYPE, process_func=lambda x: x, filter_func=lambda x: True)) + + +def filter_loaded_data(data: List[Instance], verbose: bool = False) -> List[Instance]: + """ + Filters list of instances + + Args: + data: list of instances + + Returns: filtered and transformed list of instances + """ + updates_instances = [] + for instance in data: + updated_instance = False + for fil in filters: + if fil.class_type == instance.token_type and fil.filter(instance): + instance = fil.process(instance) + updated_instance = True + if updated_instance: + if verbose: + print(instance) + updates_instances.append(instance) + return updates_instances + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument( + "--input", help="input file path", type=str, default="./en_with_types/output-00001-of-00100" + ) + parser.add_argument("--verbose", help="print filtered instances", action="store_true") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + file_path = args.input + + print("Loading training data: " + file_path) + instance_list = load_files([file_path]) # List of instances + filtered_instance_list = filter_loaded_data(instance_list, args.verbose) + training_data_to_sentences(filtered_instance_list) diff --git a/fun_text_processing/inverse_text_normalization/ja/data/__init__.py b/fun_text_processing/inverse_text_normalization/ja/data/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/char/__init__.py b/fun_text_processing/inverse_text_normalization/ja/data/char/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/char/fullwidth_to_halfwidth.tsv b/fun_text_processing/inverse_text_normalization/ja/data/char/fullwidth_to_halfwidth.tsv new file mode 100644 index 0000000..7b3fd04 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/char/fullwidth_to_halfwidth.tsv @@ -0,0 +1,92 @@ +! ! +" " +# # +$ $ +% % +& & +' ' +( ( +) ) +* * ++ + +, , +- - +. . +/ / +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +; ; +< < += = +> > +? ? +@ @ +A A +B B +C C +D D +E E +F F +G G +H H +I I +J J +K K +L L +M M +N N +O O +P P +Q Q +R R +S S +T T +U U +V V +W W +X X +Y Y +Z Z +\ \ +^ ^ +_ _ +` ` +a a +b b +c c +d d +e e +f f +g g +h h +i i +j j +k k +l l +m m +n n +o o +p p +q q +r r +s s +t t +u u +v v +w w +x x +y y +z z +{ { +| | +: : +} } +~ ~ diff --git a/fun_text_processing/inverse_text_normalization/ja/data/char/halfwidth_to_fullwidth.tsv b/fun_text_processing/inverse_text_normalization/ja/data/char/halfwidth_to_fullwidth.tsv new file mode 100644 index 0000000..1f46629 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/char/halfwidth_to_fullwidth.tsv @@ -0,0 +1,92 @@ +! ! +" " +# # +$ $ +% % +& & +' ' +( ( +) ) +* * ++ + +, , +- - +. . +/ / +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +; ; +< < += = +> > +? ? +@ @ +A A +B B +C C +D D +E E +F F +G G +H H +I I +J J +K K +L L +M M +N N +O O +P P +Q Q +R R +S S +T T +U U +V V +W W +X X +Y Y +Z Z +\ \ +^ ^ +_ _ +` ` +a a +b b +c c +d d +e e +f f +g g +h h +i i +j j +k k +l l +m m +n n +o o +p p +q q +r r +s s +t t +u u +v v +w w +x x +y y +z z +{ { +| | +: : +} } +~ ~ diff --git a/fun_text_processing/inverse_text_normalization/ja/data/char/oov_tags.tsv b/fun_text_processing/inverse_text_normalization/ja/data/char/oov_tags.tsv new file mode 100644 index 0000000..cd6c56f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/char/oov_tags.tsv @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ja/data/char/punctuations_zh.tsv b/fun_text_processing/inverse_text_normalization/ja/data/char/punctuations_zh.tsv new file mode 100644 index 0000000..963b07d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/char/punctuations_zh.tsv @@ -0,0 +1,72 @@ +! +? +。 +。 +" +# +$ +% +& +' +( +) +* ++ +, +- +/ +: +; +< += +> +@ +[ +\ +] +^ +_ +` +{ +| +} +~ +⦅ +⦆ +「 +」 +、 +、 +〃 +》 +「 +」 +『 +』 +【 +】 +〔 +〕 +〖 +〗 +〘 +〙 +〚 +〛 +〜 +〝 +〞 +〟 +〰 +– +— +‘ +’ +‛ +“ +” +„ +‟ +… +‧ +﹏ diff --git a/fun_text_processing/inverse_text_normalization/ja/data/currency.tsv b/fun_text_processing/inverse_text_normalization/ja/data/currency.tsv new file mode 100644 index 0000000..58cdfc4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/currency.tsv @@ -0,0 +1,35 @@ +$ ドル +$ 米ドル +$ 米ドル +£ 英国ポンド +€ ユーロ +₩ 勝った +nzd ニュージーランドドル +rs ルピー +chf スイスフラン +dkk デンマーククローネ +fim フィンランドのマルッカ +aed アラブ首長国連邦ディルハム +¥ 円 +czk チェココルナ +mro モーリタニアのウギア +pkr パキスタン・ルピー +crc コスタリカのコロン +hk$ 香港ドル +npr ネパールルピー +awg アルバフロリン +nok ノルウェークローネ +tzs タンザニアシリング +sek スウェーデンクローナ +cyp キプロスポンド +r 本物 +sar サウジアラビアリヤル +cve カーボベルデ エスクード +rsd セルビアディナール +dm ドイツマーク +shp セントヘレナ・ポンド +php フィリピンペソ +cad カナダドル +ssp 南スーダンポンド +scr セーシェル・ルピー +mvr モルディブ・ルフィア \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/ja/data/electronic/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/ja/data/electronic/domain.tsv new file mode 100644 index 0000000..1da623e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/electronic/domain.tsv @@ -0,0 +1,11 @@ +com +uk +fr +net +br +in +ru +de +it +ai +ja \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/ja/data/electronic/server_name.tsv new file mode 100644 index 0000000..ca7f97b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast +google diff --git a/fun_text_processing/inverse_text_normalization/ja/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/ja/data/electronic/symbols.tsv new file mode 100644 index 0000000..8be4e18 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/electronic/symbols.tsv @@ -0,0 +1,22 @@ +. 点 +- ダッシュ +- ハイフン +_ 下線 +! エクスクラメーション・マーク +# 番号記号 +$ ドル記号 +% パーセント記号 +& アンパサンド +' 見積もり +* アスタリスク ++ プラス +/ スラッシュ += 等号 +? 疑問符 +^ サーカムフレックス +` 右一重引用符 +{ 左ブレース +| 縦棒 +} 右ブレース +~ チルダ +, コンマ \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/magnitudes.tsv b/fun_text_processing/inverse_text_normalization/ja/data/magnitudes.tsv new file mode 100644 index 0000000..54a9124 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/magnitudes.tsv @@ -0,0 +1,4 @@ +千 k +百万 m +十億 b +兆 t \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/measurements.tsv b/fun_text_processing/inverse_text_normalization/ja/data/measurements.tsv new file mode 100644 index 0000000..44a8341 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/measurements.tsv @@ -0,0 +1,109 @@ +華氏 f +摂氏 c +キロメートル km +メートル m +センチメートル cm +ミリメートル mm +ヘクタール ha +マイル mi +平方メートル m² +平方キロメートル km² +足 ft +パーセント % +ヘルツ hz +キロワット kw +馬力 hp +ミリグラム mg +キログラム kg +キロ kg +ギガヘルツ ghz +キロヘルツ khz +メガヘルツ mhz +ボルト v +時 h +メガクーロン mc +秒 s +ナノメートル nm +毎分回転数 rpm +分 min +ミリアンペア mA +パーセント % +キロワット時 kwh +立方メートル m³ +時速マイル mph +テラワット tw +ミリボルト mv +メガワット mw +マイクロメータ μm +インチ " +テラバイト tb +c c cc +グラム g +ダルトン da +雰囲気 atm +オーム ω +デシベル db +ペタ秒 ps +オンス oz +ヘクトリットル hl +マイクログラム μg +ペタグラム pg +ギガバイト gb +キロビット kb +電子ボルト ev +メガバイト mb +キロバイト kb +キロビット/秒 kbps +毎秒メガビット mbps +結石 st +キロリットル kl +テラジュール tj +キロボルト kv +メガボルト mv +キロニュートン kn +メガメーター mm +天文単位 au +ヤード yd +ラジアン rad +ルーメン lm +ヘクト秒 hs +モル mol +ギガパスカル gpa +ミリリットル ml +ギガワット gw +メガアンペア ma +結び目 kt +キログラム力 kgf +ナノグラム ng +ナノ秒 ns +メガシーメンス ms +バー bar +ギガリットル gl +マイクロ秒 μs +デシアンペア da +パスカル pa +デシ秒 ds +ミリ秒 ms +デシメートル dm +立方デシメートル dm³ +原子質量単位 amu +メガビット mb +メガファラッド mf +ベクレル bq +ペタビット pb +平方ミリメートル mm² +平方センチメートル cm² +平方マイル sq mi +平方フィート sq ft +キロパスカル kpa +カンデラ cd +テラリットル tl +メガ秒 ms +メガパスカル mpa +ペタメーター pm +ペタバイト pb +ギガワットアワー gwh +キロカロリー kcal +グレー gy +シーベルト sv +ハンドレッド cwt \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/money/__init__.py b/fun_text_processing/inverse_text_normalization/ja/data/money/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/money/currency_code.tsv b/fun_text_processing/inverse_text_normalization/ja/data/money/currency_code.tsv new file mode 100644 index 0000000..238c01b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/money/currency_code.tsv @@ -0,0 +1,117 @@ +ALL 阿尔巴尼亚列克 +AFN 阿富汗 阿富汗尼 +ARS 阿根廷比索 +AWG 阿鲁巴盾 +AUD 澳元 +AZN 阿塞拜疆马纳特 +BSD 巴哈马元 +BBD 巴巴多斯元 +BYN 白俄罗斯卢布 +BZD 伯利兹元 +BMD 百慕大元 +BOB 玻利维亚玻利维亚诺 +BAM 波斯尼亚和黑塞哥维那可兑换马克 +BWP 博茨瓦纳普拉 +BGN 保加利亚列弗 +BRL 巴西雷亚尔 +BND 文莱达鲁萨兰国元 +KHR 柬埔寨瑞尔 +CAD 加元 +KYD 开曼群岛元 +CLP 智利比索 +CNY 人民币 +COP 哥伦比亚比索 +CRC 哥斯达黎加科隆 +HRK 克罗地亚库纳 +CUP 古巴比索 +CZK 捷克克朗 +DKK 丹麦克朗 +DOP 多米尼加共和国比索 +XCD 东加勒比元 +EGP 埃及镑 +SVC 萨尔瓦多科隆 +EUR 欧元成员国 +FKP 福克兰群岛(马尔维纳斯)镑 +FJD 斐济元 +GHS 加纳塞地 +GIP 直布罗陀镑 +GTQ 危地马拉格查尔 +GGP 根西岛镑 +GYD 圭亚那元 +HNL 洪都拉斯伦皮拉 +HKD 港元 +HUF 匈牙利福林 +ISK 冰岛克朗 +INR 印度卢比 +IDR 印尼盾 +IRR 伊朗里亚尔 +IMP 马恩岛英镑 +ILS 以色列谢克尔 +JMD 牙买加元 +JPY 日元 +JEP 泽西镑 +KZT 哈萨克斯坦腾格 +KPW 朝鲜园 +KRW 韩元 +KGS 吉尔吉斯斯坦索姆 +LAK 老挝基普 +LBP 黎巴嫩镑 +LRD 利比里亚元 +MKD 马其顿代纳尔 +MYR 马来西亚令吉 +MUR 毛里求斯卢比 +MXN 墨西哥比索 +MNT 蒙古图格里克 +MNT 摩洛哥迪拉姆 +MZN 莫桑比克梅蒂卡尔 +NAD 纳米比亚元 +NPR 尼泊尔卢比 +ANG 荷属安的列斯盾 +NZD 新西兰元 +NIO 尼加拉瓜科尔多瓦 +NGN 尼日利亚奈拉 +NOK 挪威克朗 +OMR 阿曼里亚尔 +PKR 巴基斯坦卢比 +PAB 巴拿马巴尔博亚 +PYG 巴拉圭瓜拉尼 +PEN 秘鲁索尔 +PHP 菲律宾比索 +PLN 波兰兹罗提 +QAR 卡塔尔里亚尔 +RON 罗马尼亚列伊 +RUB 俄罗斯卢布 +SHP 圣赫勒拿镑 +SAR 沙特阿拉伯里亚尔 +RSD 塞尔维亚第纳尔 +SCR 塞舌尔卢比 +SGD 新加坡元 +SBD 所罗门群岛元 +SOS 索马里先令 +KRW 韩元 +ZAR 南非兰特 +LKR 斯里兰卡卢比 +SEK 瑞典克朗 +CHF 瑞士法郎 +SRD 苏里南元 +SYP 叙利亚镑 +TWD 新台币 +THB 泰铢 +TTD 特立尼达和多巴哥元 +TRY 土耳其里拉 +TVD 图瓦卢元 +UAH 乌克兰格里夫纳 +AED 阿联酋迪拉姆 +GBP 英镑 +USD 美元 +UYU 乌拉圭比索 +UZS 乌兹别克斯坦索姆 +VEF 委内瑞拉玻利瓦尔 +VND 越南东 +YER 也门里亚尔 +ZWD 津巴布韦元 +J¥ 日元 +JPY¥ 日元 +HK$ 港元 +A$ 澳元 +CAD$ 加元 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/money/currency_symbol.tsv b/fun_text_processing/inverse_text_normalization/ja/data/money/currency_symbol.tsv new file mode 100644 index 0000000..18e2af4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/money/currency_symbol.tsv @@ -0,0 +1,63 @@ +Lek 阿尔巴尼亚列克 +ƒ 阿鲁巴盾 +Br 白俄罗斯卢布 +BZ$ 伯利兹元 +$b 玻利维亚玻利维亚诺 +KM 波斯尼亚和黑塞哥维那可兑换马克 +P 博茨瓦纳普拉 +лв 保加利亚列弗 +R$ 巴西雷亚尔 +៛ 柬埔寨瑞尔 +¥ 人民币 +₡ 哥斯达黎加科隆 +kn 克罗地亚库纳 +₱ 古巴比索 +Kč 捷克克朗 +kr 丹麦克朗 +RD$ 多米尼加共和国比索 +€ 欧元 +¢ 加纳塞地 +Q 危地马拉格查尔 +L 洪都拉斯伦皮拉 +Ft 匈牙利福林 +₹ 印度卢比 +Rp 印尼盾 +£ 英镑 +£ 英镑 +₪ 以色列谢克尔 +J$ 牙买加元 +лв 哈萨克斯坦腾格 +₩ 朝鲜园 +лв 吉尔吉斯斯坦索姆 +₭ 老挝基普 +ден 马其顿代纳尔 +RM 马来西亚令吉 +₨ 毛里求斯卢比 +₮ 蒙古图格里克 +MT 莫桑比克梅蒂卡尔 +C$ 尼加拉瓜科尔多瓦 +₦ 尼日利亚奈拉 +₨ 巴基斯坦卢比 +B/. 巴拿马巴尔博亚 +Gs 巴拉圭瓜拉尼 +S/. 秘鲁索尔 +₱ 菲律宾比索 +zł 波兰兹罗提 +lei 罗马尼亚列伊 +₽ 卢布 +Дин. 塞尔维亚第纳尔 +S 索马里先令 +R 南非兰特 +CHF 瑞士法郎 +NT$ 新台币 +฿ 泰铢 +TT$ 特立尼达和多巴哥元 +₺ 土耳其里拉 +₴ 乌克兰格里夫纳 +$ 美元 +$U 乌拉圭比索 +лв 乌兹别克斯坦索姆 +Bs 委内瑞拉玻利瓦尔 +₫ 越南东 +Z$ 津巴布韦元 +¥ 人民币 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/months.tsv b/fun_text_processing/inverse_text_normalization/ja/data/months.tsv new file mode 100644 index 0000000..3f7261c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/months.tsv @@ -0,0 +1,12 @@ +一月 +二月 +三月 +四月 +五月 +六月 +七月 +八月 +九月 +十月 +十一月 +十二月 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/name/japanese_surname_full_list.tsv b/fun_text_processing/inverse_text_normalization/ja/data/name/japanese_surname_full_list.tsv new file mode 100644 index 0000000..56650aa --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/name/japanese_surname_full_list.tsv @@ -0,0 +1,98882 @@ +〆 +〆垣 +〆崎 +〆木 +〆本 +〆田 +〆谷 +〆野 +はr +カはカタカナ +タはカタカナ +ニ司 +ユ川 +㓇野 +㔟原 +㔟簱 +㕝子 +㗴口 +㘴古 +㘴呂奥 +㘴間 +㘴馬 +㝡住 +㝡川 +㝡知 +㝡部 +㟁 +㟁口 +㟁本 +㟁田 +㟁野 +㟽峯 +㬢 +㮈本 +㮈村 +㯃尾 +㯃松 +㳒武 +㵤川 +㵮 +䄅 +䅈 +䅏田 +䆴谷 +䈎元 +䋆井 +䋆屋 +䋆本 +䋆村 +䋆沢 +䋆澤 +䋆田 +䋆谷 +䋝田 +䌂見 +䑓中 +䑶早 +䑺谷 +䒳原 +䒾毛 +䓔原 +䓔田 +䖝合 +䡄保 +䦰目 +䯨 +一 +一の上 +一の倉 +一の口 +一の坪 +一の宮 +一の渡 +一の瀬 +一の谷 +一の関 +一ツ井 +一ツ子 +一ツ家 +一ツ屋 +一ツ山 +一ツ木 +一ツ本松 +一ツ松 +一ツ柳 +一ツ森 +一ツ橋 +一ツ氏 +一ツ渡 +一ツ田 +一ツ町 +一ツ矢 +一ツ石 +一ツ谷 +一ノ世 +一ノ井 +一ノ倉 +一ノ勢 +一ノ原 +一ノ口 +一ノ名 +一ノ坪 +一ノ子 +一ノ字 +一ノ宮 +一ノ尾 +一ノ山 +一ノ川 +一ノ戸 +一ノ木 +一ノ木戸 +一ノ本 +一ノ枝 +一ノ橋 +一ノ沢 +一ノ清 +一ノ渡 +一ノ澤 +一ノ瀬 +一ノ田 +一ノ矢 +一ノ穂 +一ノ谷 +一ノ間 +一ノ関 +一丁田 +一丁畑 +一万田 +一三 +一上 +一下 +一与 +一世 +一丸 +一乃瀬 +一久 +一久保 +一之上 +一之宮 +一之木 +一之森 +一之沢 +一之澤 +一之瀬 +一之谷 +一乗 +一乘 +一事 +一二 +一二三 +一井 +一仏 +一伊達 +一住連 +一佛 +一作 +一倉 +一元 +一光 +一児島 +一兜 +一入 +一内 +一円 +一冨 +一刀 +一分片 +一刈 +一刎 +一前 +一力 +一勢 +一北 +一十林 +一原 +一又 +一双 +一反田 +一口 +一司 +一吉 +一后 +一向 +一味 +一和 +一和多 +一和田 +一噌 +一国 +一國 +一圓 +一地 +一坂 +一坊 +一坊寺 +一坪 +一垣 +一城 +一堂 +一場 +一塚 +一塲 +一増 +一天満谷 +一好 +一宅 +一宇 +一守 +一安 +一定 +一宝 +一宮 +一家 +一富 +一富士 +一寳 +一寶 +一寸木 +一寺 +一小路 +一尺八寸 +一尾 +一居 +一山 +一岐 +一岡 +一岩 +一峯寺 +一峰 +一峰寺 +一島 +一崎 +一嶋 +一嶌 +一川 +一布 +一幡 +一平 +一広 +一庵 +一廣 +一廼穂 +一式 +一弛 +一徳 +一心 +一志 +一恩 +一戸 +一振 +一政 +一文字 +一斗 +一新 +一方井 +一方隅 +一明 +一星 +一最 +一月 +一期 +一期崎 +一木 +一木戸 +一本 +一本島 +一本嶋 +一本木 +一本杉 +一本松 +一本柳 +一本槍 +一本鎗 +一杉 +一村 +一条 +一来 +一松 +一林 +一枚田 +一枝 +一柳 +一柿 +一栄 +一桐 +一桝 +一條 +一棟 +一森 +一植庵 +一楽 +一樂 +一樋 +一樹 +一橋 +一次 +一毛 +一氏 +一水 +一永 +一江 +一沢 +一河 +一泉 +一法 +一法師 +一津屋 +一津田 +一津矢 +一津谷 +一浦 +一海 +一渡 +一湊 +一溝 +一滴 +一澤 +一瀬 +一片 +一牛 +一玖 +一瓢 +一田 +一田山 +一由 +一甲 +一町 +一町田 +一畝 +一番ケ瀬 +一番合戦 +一番屋 +一番星 +一登 +一百野 +一盃森 +一盛 +一真 +一矢 +一石 +一社 +一神 +一笠 +一筆 +一箭 +一篠 +一籏 +一糸 +一美 +一羽 +一老 +一肩 +一脇 +一與 +一興 +一舎 +一色 +一色田 +一芝 +一花 +一華 +一萬田 +一葉 +一薮 +一藁 +一藤 +一藤木 +一蝶 +一見 +一視 +一角 +一言 +一谷 +一貫坂 +一貫田 +一越 +一路 +一身 +一軸 +一迫 +一道 +一適 +一邨 +一郎丸 +一郡 +一部 +一郷 +一都 +一里塚 +一里山 +一里越 +一重 +一野 +一野坪 +一野本 +一野瀬 +一野谷 +一野辺 +一野邊 +一針 +一釣 +一鉄 +一鍬田 +一鏡 +一鐵 +一門 +一間 +一関 +一關 +一阪 +一阿 +一陣 +一階 +一霍 +一青 +一面 +一願 +一香 +一馬 +一駒 +一高 +一鬼 +一鷓 +一鷹 +丁 +丁ケ阪 +丁井 +丁名塚 +丁坪 +丁場 +丁塚 +丁子 +丁子原 +丁子谷 +丁字 +丁字谷 +丁官 +丁山 +丁嵐 +丁左近 +丁新 +丁村 +丁沢 +丁田 +丁畑 +丁義 +丁野 +丁銀 +丁門 +七々原 +七々木 +七々瀬 +七ケ所 +七ツ役 +七ツ村 +七ツ河 +七ツ田 +七ツ町 +七ツ矢 +七ツ谷 +七丈 +七世 +七久保 +七五三 +七五三掛 +七五三木 +七五三田 +七五三野 +七井 +七俵 +七倉 +七元 +七分 +七利 +七加家 +七十刈 +七十苅 +七原 +七反田 +七呂 +七味 +七坂 +七堂 +七塚 +七夕 +七字 +七宝 +七宮 +七家 +七寳 +七寸 +七尾 +七尾谷 +七山 +七山谷 +七岡 +七島 +七崎 +七嵐 +七嶋 +七川 +七帖 +七度 +七座 +七役 +七徳 +七戸 +七搦 +七日市 +七星 +七木田 +七本 +七村 +七条 +七松 +七林 +七枝 +七栗 +七條 +七森 +七楽 +七歩 +七沢 +七河 +七波 +七津角 +七浦 +七海 +七滝 +七澤 +七瀧 +七瀬 +七瀬川 +七瀬谷 +七熊 +七牟礼 +七牟禮 +七理 +七田 +七町 +七目木 +七石 +七社 +七種 +七竹 +七篠 +七納 +七絛 +七良川 +七良浴 +七草 +七草木 +七蔵司 +七藏司 +七見 +七角 +七谷 +七軒 +七辺 +七迫 +七邊 +七郎丸 +七部 +七里 +七野 +七釜 +七釜子 +七門 +七間 +七障子 +七類 +七高 +七黒 +万 +万々 +万ケ谷 +万ノ +万丈 +万上 +万世 +万両 +万並 +万中 +万丸 +万久 +万久里 +万亀 +万亀山 +万事 +万井 +万代 +万代呂 +万代寺 +万仲 +万佐木 +万保 +万俵 +万倉 +万元 +万光 +万公 +万処 +万出 +万利乃 +万前 +万力 +万力屋 +万力谷 +万十 +万千野 +万司 +万合 +万名 +万善 +万喜 +万国 +万国谷 +万地 +万城 +万城目 +万埜 +万場 +万塩 +万壽本 +万好 +万子 +万字 +万宝 +万実 +万宮 +万家 +万實 +万寿 +万寿本 +万尾 +万屋 +万山 +万岡 +万崎 +万川 +万平 +万年 +万年山 +万幸 +万広 +万度 +万庭 +万廣 +万徳 +万慶 +万戈 +万成 +万我 +万戸 +万所 +万才 +万方 +万月 +万木 +万本 +万束 +万条 +万来 +万條 +万森 +万楽 +万正 +万歩 +万歳 +万殿 +万水 +万永 +万江 +万沢 +万治 +万波 +万津 +万洲 +万浪 +万浮 +万澤 +万濃 +万瀬 +万灯 +万燈 +万狩 +万玉 +万田 +万直 +万矢 +万石 +万砂 +万福 +万福寺 +万立 +万竝 +万納 +万納寺 +万羽 +万膳 +万葉 +万藤 +万行 +万袋 +万見 +万谷 +万豆 +万財 +万賀 +万越 +万足 +万辺 +万辻 +万造寺 +万道 +万邉 +万邊 +万部 +万里 +万里小路 +万里崎 +万里川 +万重 +万野 +万金 +万開 +万関 +万阿弥 +万雲 +万願寺 +万𡌛 +丈 +丈下 +丈井 +丈光 +丈六 +丈口 +丈富 +丈居 +丈島 +丈束 +丈池 +丈田 +丈谷 +丈迫 +丈達 +丈野 +丈間 +三 +三々賀 +三つ石 +三の丸 +三の宮 +三の輪 +三カ崎 +三ケ +三ケ原 +三ケ尻 +三ケ山 +三ケ島 +三ケ崎 +三ケ嶋 +三ケ月 +三ケ木 +三ケ本 +三ケ森 +三ケ津 +三ケ田 +三ケ部 +三ケ野 +三ケ野原 +三ツ +三ツ中 +三ツ丸 +三ツ井 +三ツ俣 +三ツ倉 +三ツ元 +三ツ出 +三ツ又 +三ツ口 +三ツ国 +三ツ國 +三ツ堀 +三ツ塚 +三ツ家 +三ツ寄 +三ツ寺 +三ツ尾 +三ツ居 +三ツ屋 +三ツ山 +三ツ岡 +三ツ岩 +三ツ峰 +三ツ島 +三ツ崎 +三ツ嶋 +三ツ川 +三ツ巻 +三ツ平 +三ツ広 +三ツ廣 +三ツ扇 +三ツ持 +三ツ星 +三ツ木 +三ツ本 +三ツ杉 +三ツ村 +三ツ松 +三ツ林 +三ツ柳 +三ツ梨 +三ツ森 +三ツ橋 +三ツ汐 +三ツ江 +三ツ池 +三ツ沢 +三ツ沼 +三ツ泉 +三ツ浜 +三ツ浦 +三ツ浪 +三ツ溝 +三ツ滝 +三ツ澤 +三ツ濱 +三ツ瀬 +三ツ田 +三ツ畑 +三ツ目 +三ツ矢 +三ツ石 +三ツ股 +三ツ角 +三ツ谷 +三ツ辻 +三ツ邑 +三ツ野 +三ツ間 +三ノ上 +三ノ丸 +三ノ京 +三ノ宮 +三ノ戸 +三ノ浦 +三ノ輪 +三ヵ木 +三丁 +三丁目 +三七 +三丈 +三上 +三上山 +三下 +三与木 +三世 +三世川 +三並 +三中 +三中西 +三串 +三丸 +三乃 +三久 +三久保 +三之丸 +三之宮 +三之本 +三之瀬 +三之輪 +三乗 +三乘 +三九 +三九二 +三亀 +三亀山 +三二 +三五 +三井 +三井倉 +三井原 +三井名 +三井寺 +三井島 +三井戸 +三井所 +三井津 +三井田 +三京 +三仏 +三仙 +三代 +三代地 +三代崎 +三代川 +三代木 +三代森 +三代沢 +三代澤 +三代瀬 +三代田 +三代野 +三仲 +三伍 +三伝 +三位 +三位所 +三住 +三佐 +三佐々川 +三佐保 +三佐和 +三佐尾 +三佐崎 +三佐川 +三佐藤 +三余 +三佛 +三保 +三保家 +三保木 +三保田 +三保谷 +三保野 +三信 +三俣 +三俵 +三倉 +三個 +三傅 +三傳 +三僮 +三元 +三先 +三光 +三光坊 +三光寺 +三光楼 +三光院 +三入 +三八九 +三八木 +三八木沢 +三八木澤 +三共 +三其 +三具 +三内 +三冨 +三冨士 +三凌 +三刀 +三刀屋 +三刀谷 +三分 +三分一 +三分一所 +三分利 +三前 +三力谷 +三功 +三加 +三加茂 +三勢 +三包 +三北 +三十刈 +三十尾 +三十日 +三十木 +三十苅 +三十間 +三千 +三千山 +三千田 +三升 +三升木 +三升畑 +三升谷 +三原 +三原屋 +三原松 +三原田 +三原詰 +三原鍛治 +三厨 +三又 +三友 +三双 +三反 +三反園 +三反崎 +三反田 +三反畑 +三反長 +三叚崎 +三口 +三古 +三古谷 +三可 +三合 +三合堂 +三吉 +三吉矢 +三吉谷 +三吉野 +三名木 +三名本 +三名田 +三吾 +三味 +三和 +三和山 +三和田 +三品 +三品寺 +三善 +三喜 +三喜田 +三喜畑 +三嘴 +三四 +三国 +三国出 +三国屋 +三国谷 +三國 +三國屋 +三國谷 +三園 +三土 +三土井 +三土手 +三在 +三地 +三地沢 +三地澤 +三坂 +三坊 +三坪 +三垣 +三城 +三埜 +三堀 +三堂 +三堂地 +三堤 +三場 +三塚 +三塩 +三増 +三墨 +三壁 +三声 +三壷 +三壺 +三壽 +三多 +三多村 +三多田 +三多見 +三夜 +三大 +三大寺 +三太 +三奈戸 +三奈木 +三好 +三好野 +三妙 +三妻 +三姓 +三宅 +三宅川 +三宇根 +三守 +三安 +三宗 +三宝 +三室 +三室戸 +三宮 +三家 +三家丸 +三家本 +三宿 +三寄 +三富 +三富士 +三寳 +三寶 +三寸木 +三寺 +三寿 +三尋木 +三小 +三小牛 +三小田 +三尾 +三尾原 +三尾川 +三尾母 +三尾谷 +三尾野 +三居 +三屋 +三屋田 +三山 +三山口 +三岐 +三岡 +三岩 +三岳 +三岸 +三峯 +三峰 +三島 +三島木 +三崎 +三崎屋 +三嵜 +三嶋 +三嶋木 +三嶌 +三嶽 +三川 +三川原 +三州 +三差 +三巴 +三巻 +三市 +三師 +三帰 +三幡 +三幣 +三平 +三年 +三幸 +三広 +三府 +三度 +三廉 +三廚 +三廻部 +三廼 +三弊 +三引 +三弦谷 +三張 +三影 +三待 +三後 +三徳 +三徳屋 +三志多 +三志奈 +三恵 +三惠 +三慶 +三成 +三戸 +三戸代 +三戸口 +三戸呂 +三戸尻 +三戸岡 +三戸手 +三戸森 +三戸瀬 +三戸田 +三戸見 +三戸谷 +三戸辺 +三戸邉 +三戸部 +三房 +三手木 +三才 +三才町 +三扶 +三技 +三折 +三掘 +三摩 +三改木 +三政 +三文字 +三方 +三日尻 +三日市 +三日月 +三日田 +三昌 +三明 +三星 +三春 +三時 +三曳 +三曵 +三曽田 +三曾野 +三月 +三月田 +三朕 +三朝 +三木 +三木元 +三木原 +三木家 +三木屋 +三木本 +三木江 +三木田 +三木谷 +三木野 +三末 +三本 +三本木 +三本杉 +三本松 +三本柳 +三本漆 +三本竹 +三本管 +三本菅 +三杉 +三村 +三村田 +三束 +三条 +三条場 +三条橋 +三条目 +三条西 +三条谷 +三杭 +三杯 +三東 +三松 +三林 +三枚地 +三枚堂 +三枚山 +三枚橋 +三枝 +三枝崎 +三枝木 +三枝松 +三枝樹 +三枡 +三柏 +三染 +三柳 +三柴 +三栄 +三栖 +三栖本 +三栖谷 +三栗 +三栗家 +三栗屋 +三栗谷 +三栗野 +三根 +三根山 +三根生 +三根谷 +三桐 +三桝 +三桶 +三條 +三條場 +三條目 +三條西 +三條谷 +三梨 +三棟 +三森 +三棹 +三椚 +三楊 +三楠 +三榊 +三槁 +三槇 +三槙 +三槻 +三横 +三横呂 +三樹 +三樹元 +三橋 +三次 +三武 +三武士 +三歩 +三歩一 +三段 +三段崎 +三母 +三比 +三毛 +三毛門 +三水 +三永 +三永川 +三江 +三池 +三池田 +三沖 +三沢 +三河 +三河井 +三河内 +三河原 +三河口 +三河尻 +三河島 +三河嶋 +三河谷 +三治 +三沼 +三波 +三洗 +三津 +三津中 +三津井 +三津出 +三津原 +三津国 +三津國 +三津守 +三津家 +三津尾 +三津屋 +三津山 +三津島 +三津川 +三津木 +三津本 +三津村 +三津林 +三津橋 +三津永 +三津江 +三津沢 +三津浜 +三津澤 +三津田 +三津目 +三津矢 +三津石 +三津谷 +三津越 +三津輪 +三津野 +三津間 +三洲 +三浅 +三浜 +三浦 +三浪 +三海 +三淵 +三添 +三清 +三渓 +三渕 +三渡 +三渡洲 +三満 +三満田 +三溝 +三滝 +三潟 +三潴 +三澄 +三澤 +三濃川 +三濱 +三瀦 +三瀧 +三瀬 +三瀬下 +三瀬町 +三熊 +三牧 +三狭間 +三獄 +三玉 +三王 +三王寺 +三珠 +三瓶 +三甘 +三生 +三用 +三甫 +三田 +三田上 +三田井 +三田地 +三田寺 +三田尻 +三田尾 +三田村 +三田池 +三田美 +三田谷 +三田迫 +三田部 +三田野 +三由 +三甲野 +三町 +三界 +三畑 +三留 +三畝 +三畠 +三畦 +三番 +三登 +三百 +三百田 +三百苅 +三皷 +三盃 +三盛 +三目 +三省 +三県 +三矢 +三矢城 +三矢島 +三矢本 +三矢田 +三知矢 +三石 +三砂 +三社所 +三神 +三神山 +三福 +三福寺 +三秋 +三科 +三程 +三種 +三穂 +三穂野 +三穗野 +三窪 +三立 +三竜 +三竝 +三竹 +三竿 +三笘 +三笠 +三笠屋 +三笠木 +三笹 +三箇 +三箇尻 +三箇山 +三箇島 +三箭 +三箸 +三節草 +三築 +三簾 +三籔 +三糸 +三納 +三紙 +三続 +三綿 +三緒 +三縁 +三縄 +三縞 +三縣 +三繩 +三美 +三義 +三羽 +三者 +三聲 +三股 +三脇 +三腰 +三膳 +三與木 +三舘 +三舛 +三舛木 +三舛畑 +三舛谷 +三舟 +三舩 +三船 +三良 +三良丸 +三艸 +三芝 +三芦 +三芳 +三芳野 +三苫 +三草 +三荊 +三荒 +三荷 +三荻 +三菅 +三華 +三葉 +三葛 +三葛木 +三蓼 +三蔭 +三蔵 +三薗 +三薮 +三藤 +三藤田 +三藪 +三行 +三行地 +三裏 +三見 +三角 +三角園 +三角田 +三觜 +三計 +三記 +三訳 +三調 +三諾 +三譯 +三谷 +三谷原 +三谷山 +三谷川 +三谷本 +三谷沢 +三谷澤 +三谷野 +三谿 +三豬 +三貝 +三貫納 +三貴 +三賀 +三賀山 +三賀本 +三賀森 +三賢 +三越 +三足 +三路 +三身 +三軒 +三軒家 +三軒屋 +三軒谷 +三輪 +三輪出 +三輪屋 +三輪山 +三輪木 +三輪橋 +三輪浦 +三輪田 +三輪谷 +三輪野 +三輸 +三辺 +三辻 +三近 +三迫 +三迺 +三通 +三通田 +三逵 +三道 +三達 +三達屋 +三邉 +三邊 +三邑 +三那三 +三那川 +三邨 +三郎丸 +三郎迫 +三部 +三郷 +三都 +三都主 +三都井 +三里 +三重 +三重堀 +三重松 +三重生 +三重野 +三野 +三野原 +三野宮 +三野岡 +三野島 +三野本 +三野村 +三野瀬 +三野田 +三野谷 +三野輪 +三金 +三釜田 +三鈷 +三録 +三鍋 +三鍵 +三鎌 +三鐘 +三鑰 +三長 +三門 +三門明 +三間 +三間地 +三間屋 +三間瀬 +三間谷 +三関 +三阪 +三附 +三隅 +三隅田 +三隈 +三階 +三階松 +三随 +三隨 +三雲 +三露 +三須 +三須田 +三須磨 +三頭 +三頭谷 +三餘 +三館 +三馬 +三駄 +三駒 +三高 +三鬼 +三鳥川 +三鴨 +三鶴 +三鹿 +三鹿野 +三黒 +三黒江 +三鼓 +三龍 +三𢌞部 +三𧮾 +上 +上々手 +上の内 +上の園 +上の坊 +上り口 +上り坂 +上り戸 +上り浜 +上ガ島 +上ケ内 +上ケ原 +上ケ吹 +上ケ山 +上ケ島 +上ケ嶋 +上ケ市 +上ケ平 +上ケ谷 +上ケ迫 +上ノ +上ノ下 +上ノ井 +上ノ内 +上ノ勝 +上ノ原 +上ノ台 +上ノ園 +上ノ土 +上ノ坊 +上ノ堀 +上ノ宮 +上ノ家 +上ノ山 +上ノ川 +上ノ平 +上ノ本 +上ノ段 +上ノ沢 +上ノ澤 +上ノ瀬 +上ノ田 +上ノ町 +上ノ畑 +上ノ神 +上ノ茗 +上ノ薗 +上ノ谷 +上ノ道 +上ノ郷谷 +上ミ地 +上ヱ地 +上㹦 +上一 +上万 +上三 +上三信 +上三地 +上三垣 +上三路 +上下 +上不 +上与那原 +上丑屋 +上世 +上中 +上中別府 +上中前 +上中園 +上中尾 +上中居 +上中屋敷 +上中村 +上中田 +上中谷 +上中野 +上丸 +上主 +上乃 +上久 +上久保 +上久木田 +上之 +上之下 +上之内 +上之勝 +上之原 +上之園 +上之坊 +上之堀 +上之家 +上之山 +上之平 +上之段 +上之浜 +上之浦 +上之濱 +上之神 +上之脇 +上之薗 +上之谷 +上之郷 +上之郷谷 +上之門 +上乗 +上乾 +上亀 +上井 +上井尻 +上井尾 +上井戸 +上井手 +上井田 +上井谷 +上亟 +上京 +上京田 +上人 +上仁 +上今 +上今別府 +上仙 +上仙地 +上代 +上仮屋 +上仲 +上仲間 +上任 +上伊倉 +上伊南 +上伊沢 +上伊澤 +上伏 +上休場 +上住 +上住谷 +上佐 +上佐古 +上佐近 +上作 +上保 +上保木 +上信 +上倉 +上假屋 +上元 +上光 +上入ケ山 +上入佐 +上入來 +上入来 +上八重 +上兼 +上兼栗 +上内 +上内侍 +上内寺 +上内田 +上円 +上冨 +上冨居 +上処 +上出 +上出口 +上分 +上切石 +上刈谷 +上刎 +上別府 +上別祖 +上別縄 +上利 +上剃 +上則 +上前 +上前泊 +上前田 +上加 +上加世田 +上加治 +上勢 +上勢頭 +上勧 +上化田 +上北 +上北田 +上升 +上半 +上南 +上原 +上原口 +上原子 +上原田 +上参郷 +上友 +上口 +上口屋 +上古 +上古代 +上古殿 +上古立 +上古見 +上古閑 +上台 +上司 +上吉 +上吉原 +上吉川 +上名 +上名主 +上向 +上向井 +上吹越 +上周 +上味 +上和田 +上和野 +上品 +上唐 +上唐湊 +上善 +上四元 +上団 +上国 +上国料 +上国領 +上囿 +上國 +上國料 +上園 +上園田 +上圓 +上團 +上土 +上土井 +上土居 +上土師 +上土橋 +上土生 +上土谷 +上地 +上圷 +上坂 +上坂元 +上坊 +上坊寺 +上坊江 +上坪 +上垣 +上垣内 +上垣外 +上垰 +上城 +上城戸 +上埜 +上埜山 +上堀 +上堀内 +上堂 +上堂園 +上堂地 +上堂薗 +上堅 +上堤 +上場 +上塘 +上塚 +上塩 +上塩入 +上境 +上境田 +上墅 +上増 +上増田 +上壁 +上夏井 +上多 +上大 +上大前 +上大園 +上大川 +上大年 +上大沢 +上大湯 +上大澤 +上大田 +上大薗 +上大角 +上大谷 +上大迫 +上大長 +上大門 +上天 +上太場 +上太田 +上夷 +上奈 +上奈路 +上奈露 +上奥 +上女鹿 +上好 +上妻 +上子 +上宇宿 +上宇都 +上守 +上安 +上安平 +上宗 +上官 +上定 +上宜 +上実 +上室 +上宮 +上宮田 +上宮迫 +上家 +上宿 +上富 +上富居 +上實 +上寺 +上射場 +上小倉 +上小園 +上小城 +上小家 +上小川 +上小手 +上小林 +上小沢 +上小澤 +上小牧 +上小田 +上小薗 +上小谷 +上小路 +上小野田 +上小鶴 +上尾 +上尾崎 +上尾田 +上尾野辺 +上尾野邊 +上居 +上屋 +上屋敷 +上屋舗 +上山 +上山下 +上山口 +上山崎 +上山本 +上山根 +上山田 +上岡 +上岡谷 +上岩 +上岸 +上峠 +上峯 +上峰 +上島 +上崎 +上嵜 +上嶋 +上嶌 +上川 +上川井 +上川内 +上川原 +上川合 +上川名 +上川床 +上川渡 +上川畑 +上川路 +上州 +上工地 +上左近 +上己 +上巳 +上巻 +上巾 +上市 +上市園 +上布 +上平 +上平川 +上平瀬 +上平熊 +上平田 +上年 +上広 +上庄 +上床 +上府 +上廣 +上延 +上廻 +上引地 +上弘 +上当 +上形 +上徳 +上志 +上志羽 +上念 +上恐 +上恵木 +上惠木 +上慶 +上成 +上戸 +上戸田 +上戸鎖 +上房 +上所 +上手 +上才 +上打田内 +上払 +上折 +上拂 +上拾石 +上指 +上捨石 +上掘 +上掛 +上提 +上揚 +上撫 +上政頼 +上敷領 +上文司 +上斗 +上斗米 +上新 +上新井田 +上新内 +上新原 +上方 +上方野 +上日向 +上早稲 +上明 +上明代 +上明戸 +上星 +上春 +上時 +上景 +上更家 +上更谷 +上曽 +上曽山 +上曽根 +上曾 +上曾山 +上月 +上有谷 +上木 +上木原 +上木場 +上木屋 +上木崎 +上木戸 +上本 +上本野 +上机 +上杉 +上村 +上村井 +上村渠 +上条 +上来 +上東 +上東地 +上東野 +上松 +上松瀬 +上松野 +上板 +上林 +上林山 +上林川 +上林房 +上枝 +上枡 +上柏 +上柳 +上柳田 +上柴 +上柿 +上柿元 +上栄 +上栄城 +上栗 +上栢 +上栫 +上根 +上桐 +上桐原 +上桝 +上桝谷 +上档 +上桶 +上梅 +上梅沢 +上梅澤 +上條 +上梨 +上梨子 +上梶 +上梶迫 +上棚 +上棟 +上森 +上森合 +上椋 +上椙 +上楢原 +上楽 +上榁 +上槙 +上樂 +上横手 +上樽 +上橋 +上檔 +上次 +上次田 +上正原 +上正路 +上武 +上段 +上殿 +上水 +上水口 +上水樽 +上水流 +上永 +上永井 +上永吉 +上永瀬 +上永田 +上永野 +上江 +上江川 +上江州 +上江後 +上江洌 +上江津 +上江洲 +上江滝 +上江瀧 +上江田 +上池 +上池田 +上沖 +上沢 +上沢津 +上沢田 +上河 +上河内 +上河原 +上河辺 +上河邉 +上河邊 +上治 +上沼 +上泉 +上法 +上波 +上泰 +上洌 +上洞 +上津 +上津原 +上津曲 +上津留 +上津遊 +上洲 +上浅 +上浜 +上浜川 +上浦 +上浪 +上浴 +上海 +上海道 +上淵 +上清 +上清水 +上清田 +上渓 +上渕 +上渡 +上温湯 +上湊 +上湯瀬 +上満 +上源 +上溝 +上溢 +上溪 +上滝 +上潟口 +上澄 +上澗 +上澤 +上澤上 +上澤津 +上澤田 +上濃 +上濱 +上瀉口 +上瀧 +上瀬 +上瀬戸 +上灘 +上烝 +上焏 +上熊 +上熊須 +上片 +上片平 +上片野 +上牟田 +上牧 +上牧瀬 +上牧野 +上狭 +上狹 +上猶 +上玉 +上玉利 +上甑 +上甑町 +上生 +上用 +上甫木 +上田 +上田中 +上田井 +上田代 +上田原 +上田尾 +上田屋 +上田平 +上田才 +上田橋 +上田谷 +上甲 +上町 +上畑 +上畝 +上畝地 +上畠 +上畦地 +上番増 +上當 +上登 +上登能 +上登野 +上白土 +上白川 +上白戸 +上白木 +上白石 +上盛 +上県 +上眞 +上真 +上真地 +上督 +上矢 +上矢原 +上知 +上石 +上石丸 +上石坂 +上石田 +上砂 +上砂原 +上砂口 +上砂田 +上硲 +上社 +上祐 +上神 +上神田 +上神谷 +上祢 +上福 +上福丸 +上福井 +上福元 +上福浦 +上福田 +上禰 +上程 +上種 +上稲 +上稲葉 +上穂 +上穂木 +上穗木 +上穴 +上空 +上窪 +上窪田 +上立 +上端 +上竹 +上竹原 +上符 +上笹 +上笹山 +上笹貫 +上等 +上筋 +上管 +上篠 +上篭 +上簑 +上簗 +上簿 +上籔 +上籠 +上米良 +上粂 +上納 +上紙 +上紺屋 +上紺谷 +上結 +上絛 +上継 +上続 +上綱 +上網 +上総 +上縄手 +上總 +上繁 +上續 +上羅 +上美谷 +上羽 +上羽坪 +上羽場 +上者 +上能 +上脇 +上脇田 +上腰 +上臺 +上與那原 +上舎 +上舘 +上舛 +上舞 +上舩 +上舩津 +上船 +上船津 +上良 +上芝 +上芝原 +上花輪 +上苙 +上茂 +上茶 +上茶谷 +上草 +上荒 +上荒磯 +上荷 +上荷田 +上萩 +上萩原 +上萬 +上落 +上葉 +上葛 +上蓑 +上蔀 +上蔵 +上蕨 +上薄 +上薗 +上薮 +上藏 +上藤 +上藪 +上蘢 +上處 +上袴田 +上裏 +上西 +上西園 +上西川原 +上西窪 +上見 +上見世 +上角 +上角地 +上諏訪 +上諸 +上講 +上谷 +上谷内 +上谷地 +上谷川 +上谷田 +上豊 +上貂 +上貝 +上貝津 +上貞 +上貫 +上賀 +上赤 +上赤坂 +上赤阪 +上越 +上路 +上轟 +上辰 +上農 +上辺 +上辻 +上込 +上迎 +上近 +上迫 +上迫田 +上迴 +上通 +上造輪 +上逵 +上運天 +上道 +上達 +上遠 +上遠野 +上邉 +上邊 +上邑 +上邨 +上郎 +上郡 +上郡山 +上部 +上郷 +上都 +上酔尾 +上醉尾 +上里 +上里田 +上重 +上野 +上野代 +上野内 +上野原 +上野台 +上野園 +上野城 +上野堂 +上野尻 +上野山 +上野島 +上野川 +上野平 +上野明 +上野本 +上野段 +上野毛戸 +上野沢 +上野浦 +上野澤 +上野田 +上野畑 +上野目 +上野矢 +上野臺 +上野谷 +上金 +上釜 +上釡 +上鈴 +上鈴木 +上鉄穴 +上鉢 +上銅 +上銘 +上鍋 +上鍛冶 +上鍛治 +上鍜治 +上鍵 +上鑪 +上長 +上長根 +上長者 +上長野 +上門 +上門戸 +上門田 +上開地 +上間 +上関 +上阪 +上阪本 +上防 +上陰 +上陸 +上隅 +上隠 +上集 +上雲地 +上霜 +上霞 +上青木 +上面 +上須 +上須崎 +上須田 +上須賀 +上領 +上頭 +上願 +上風呂 +上飛田 +上飯坂 +上飯野 +上養母 +上館 +上香 +上馬 +上馬場 +上馬塲 +上馬庭 +上駄 +上駄場 +上高 +上高原 +上高垣内 +上高家 +上高山 +上高牧 +上鳴 +上鵜瀬 +上鶴 +上鹿庭 +上鹿渡 +上黒 +上𡌛 +下 +下の薗 +下り +下り松 +下り藤 +下ケ橋 +下ケ藤 +下タ +下タ村 +下ノ上 +下ノ原 +下ノ園 +下ノ坊 +下ノ堀 +下ノ平 +下ノ木 +下ノ本 +下ノ村 +下ノ段 +下ノ薗 +下ノ角 +下ノ関 +下モ +下モ内 +下リ藤 +下㹦 +下一ノ宮 +下万 +下上 +下世 +下世古 +下中 +下中園 +下中村 +下中者 +下中野 +下串 +下丸畑 +下久 +下久保 +下久吉 +下久根 +下久田 +下久祢 +下久禰 +下之 +下之内 +下之原 +下之園 +下之坊 +下之堀 +下之段 +下之薗 +下之角 +下之門 +下二井 +下井 +下井倉 +下井戸 +下井手 +下井田 +下井谷 +下井関 +下亟 +下京 +下京田 +下仁 +下今別府 +下今西 +下代 +下仮 +下仮屋 +下仲 +下仲谷 +下伊倉 +下伊豆 +下伏 +下休場 +下会所 +下位 +下住 +下佐 +下佐古 +下佐田 +下佐粉 +下保 +下保木 +下保田 +下俵 +下倉 +下假 +下假屋 +下側 +下元 +下先 +下光 +下入ケ山 +下入佐 +下八 +下八尻 +下八川 +下八重 +下公 +下兼 +下兼操 +下内 +下内侍 +下内田 +下出 +下出口 +下出手 +下出水 +下出谷 +下分 +下切 +下刎 +下別 +下別府 +下利 +下前 +下前原 +下前園 +下前田 +下副田 +下加 +下加土 +下加茂 +下勝 +下北 +下南 +下南出 +下原 +下原口 +下原田 +下又 +下友 +下反 +下取 +下口 +下口谷 +下古場 +下古立 +下古谷 +下台 +下司 +下吉 +下名 +下名主 +下名迫 +下向 +下向井 +下吹越 +下和佐 +下和田 +下唐湊 +下問 +下嘉 +下四日市 +下団 +下国 +下國 +下園 +下土 +下土井 +下土居 +下土橋 +下地 +下地頭所 +下坂 +下坂元 +下坂本 +下坊 +下坊江 +下坪 +下垂 +下垣 +下垣元 +下垣内 +下垣外 +下垣津 +下垣鳴海 +下城 +下埜 +下堀 +下堂 +下堂前 +下堂園 +下堂薗 +下場 +下堺田 +下塚 +下塩 +下塩入 +下塩見 +下境 +下境田 +下夕 +下夕村 +下多 +下多村 +下多津 +下大久保 +下大前 +下大園 +下大寺 +下大屋 +下大川 +下大工 +下大沢 +下大洞 +下大澤 +下大田 +下大薗 +下大迫 +下大長 +下天广 +下天摩 +下天満 +下太坂 +下太沢 +下夷 +下奈志 +下奥 +下妻 +下宇坪 +下宇垰 +下宇宿 +下宇峠 +下安 +下定 +下宝 +下室 +下宮 +下宮園 +下宮薗 +下宮路 +下家 +下家地 +下宿 +下宿口 +下寶 +下寺 +下小倉 +下小園 +下小城 +下小家 +下小川 +下小浦 +下小瀬 +下小牧 +下小田 +下小薗 +下小路 +下小野田 +下小鶴 +下尻 +下尾 +下尾崎 +下居 +下屋 +下屋敷 +下屋鋪 +下屏 +下山 +下山下 +下山井 +下山根 +下山田 +下山野 +下岡 +下岩 +下岳 +下岸 +下峠 +下峯 +下峰 +下島 +下島野 +下崎 +下嵜 +下嶋 +下嶌 +下嶝 +下嶽 +下川 +下川原 +下川床 +下川戸 +下川渡 +下川路 +下川辺 +下川邉 +下川邊 +下川部 +下工垣 +下左近 +下市 +下市園 +下市後 +下帯 +下帶 +下平 +下平尾 +下平木 +下平瀬 +下平熊 +下幸茂 +下広 +下庄 +下店 +下座 +下庫理 +下廣 +下廼 +下引地 +下形 +下影 +下後 +下御領 +下徳 +下徳辺 +下志 +下志万 +下忠 +下成 +下戸 +下戸地 +下戸成 +下房 +下房地 +下所 +下手 +下打 +下払 +下拂 +下拾石 +下振 +下掘 +下掛 +下敷頒 +下敷領 +下斗米 +下新 +下新井田 +下新原 +下新田 +下方 +下日向 +下日蔭 +下星 +下星場 +下星崎 +下春 +下更屋 +下曽小川 +下曽山 +下曽根 +下曽禰 +下曾小川 +下曾山 +下曾根 +下曾禰 +下會所 +下有村 +下木 +下木原 +下木場 +下木屋 +下木崎 +下木戸 +下木谷 +下末 +下本 +下本地 +下机 +下杉 +下杉木 +下村 +下条 +下条道 +下東 +下松 +下松八重 +下松瀬 +下松谷 +下林 +下林山 +下枝 +下枡 +下柳 +下柳田 +下柴 +下柿 +下柿元 +下柿本 +下栃棚 +下栗 +下根 +下桐 +下桑田 +下桑谷 +下桜 +下桝 +下档 +下桶 +下梁 +下條 +下條道 +下梨 +下梶 +下梶谷 +下森 +下楠 +下楠園 +下楠薗 +下楽 +下樋 +下権谷 +下横 +下橋 +下橋場 +下櫻 +下權谷 +下次 +下正 +下正原 +下段 +下殿 +下毛 +下毛内 +下氏 +下水木 +下水流 +下永 +下永吉 +下永瀬 +下永田 +下汐見 +下江 +下江後 +下池 +下池田 +下沖 +下沢 +下沢田 +下河 +下河内 +下河原 +下河辺 +下河道 +下河邉 +下河邊 +下河部 +下治 +下沼 +下泉 +下波 +下洞 +下津 +下津佐 +下津屋 +下津左 +下津曲 +下津江 +下津浜 +下津浦 +下津濱 +下津谷 +下津貫 +下津間 +下浅 +下浜 +下浦 +下浴 +下海戸 +下深沢 +下深迫 +下淵 +下清水 +下清田 +下渕 +下渡 +下温湯 +下湯 +下湯北 +下湯川 +下湯瀬 +下満 +下源 +下溝 +下溝口 +下滝 +下滿 +下漆 +下潟 +下潮 +下澗 +下澤 +下澤田 +下濃 +下濱 +下瀧 +下瀬 +下瀬川 +下無 +下無敷 +下熊 +下片野 +下牛尾 +下牟田 +下牧 +下牧瀬 +下狩谷 +下猶 +下玉 +下玉利 +下甑町 +下生 +下甫木 +下田 +下田中 +下田代 +下田原 +下田和 +下田尾 +下田屋 +下田平 +下田沢 +下田谷 +下甲 +下町 +下畑 +下留 +下畝 +下畝地 +下畠 +下畠田 +下畦 +下登 +下白木 +下白石 +下益田 +下目 +下真下 +下真新 +下矢 +下矢原 +下矢突 +下知 +下石 +下石原 +下石坂 +下石川 +下石畑 +下石見 +下砥 +下硲 +下社 +下神 +下神田 +下神納木 +下祢 +下福 +下秋 +下程 +下種 +下稲 +下稲葉 +下穂木 +下空 +下窄 +下窪 +下立 +下章 +下端 +下竹 +下竹原 +下笛 +下笠 +下笹 +下箱石 +下篠 +下簗 +下籔 +下籔井 +下糀 +下紺 +下絛 +下絵図 +下総 +下縄 +下總 +下置 +下羅 +下美 +下羽 +下羽坪 +下老 +下脇 +下脇田 +下腰 +下臺 +下舌 +下舗 +下舘 +下舞 +下船 +下良 +下芝 +下花 +下苙 +下苧坪 +下茂 +下茂野 +下茂門 +下茅 +下茶 +下茶谷 +下草 +下荒 +下荒地 +下荒磯 +下荒神 +下荢坪 +下菊 +下萩 +下萩原 +下萬 +下葛 +下蔭 +下蔵 +下薄 +下薗 +下薮 +下藤 +下藪 +下藪居 +下袴田 +下裏 +下西 +下西ノ園 +下西之園 +下西園 +下西窪 +下見 +下見世 +下見川 +下親 +下角 +下触 +下觸 +下許 +下諸 +下謝名 +下護 +下谷 +下谷内 +下谷地 +下谷田 +下豊留 +下貞 +下賀 +下赤 +下赤所 +下起 +下越 +下越田 +下路 +下農 +下辺 +下辻 +下込 +下迫 +下迫田 +下迺 +下通 +下造座 +下遊名 +下道 +下遠 +下遠野 +下邉 +下邊 +下邑 +下邨 +下郡 +下郡山 +下部 +下郷 +下酉 +下酒井 +下酔尾 +下醉尾 +下釆 +下采 +下里 +下重 +下野 +下野原 +下野園 +下野坊 +下野尻 +下野川 +下野平 +下野戸 +下野段 +下野江 +下野津 +下野谷 +下野間 +下金 +下釜 +下釣 +下鈩 +下鉄穴 +下鉢 +下錦田 +下鍋 +下鍛冶 +下鍛治 +下鍜治 +下鍵 +下鑪 +下長 +下長根 +下長谷 +下長野 +下門 +下開 +下間 +下間山 +下関 +下阪 +下阪本 +下防 +下陣 +下陰 +下陳 +下陸 +下隅 +下隈 +下隠 +下隥 +下雅意 +下雲 +下霜 +下青木 +下須 +下須崎 +下須賀 +下風 +下飛田 +下飯 +下飯坂 +下飯野 +下飼 +下飼手 +下餅原 +下館 +下香川 +下馬 +下馬場 +下馬庭 +下駄 +下駄場 +下高 +下高下 +下高原 +下高呂 +下高山 +下高牧 +下高谷 +下鳥 +下鳴 +下鵜瀬 +下鶴 +下麥 +下麦 +下黒 +下黒沢 +下黒澤 +下鼻 +下𡧃坪 +不二 +不二井 +不二原 +不二山 +不二崎 +不二川 +不二木 +不二樹 +不二葦 +不二見 +不二門 +不井 +不京 +不働 +不免 +不別 +不動 +不動地 +不動堂 +不動寺 +不動岩 +不動木 +不動田 +不動野 +不動院 +不可三 +不喜 +不室 +不島 +不嶋 +不川 +不後 +不戸 +不断 +不施 +不木 +不来方 +不死原 +不死川 +不殿 +不波 +不波野 +不流 +不田 +不留美 +不知 +不破 +不破勝 +不破本 +不破野 +不破間 +不笠 +不老 +不老地 +不聞 +不藤 +不虚作 +不計 +不越 +不退 +不野 +与 +与ノ +与一迫 +与三井 +与三川 +与三手 +与三本 +与三野 +与上 +与下 +与世原 +与世山 +与世川 +与世平 +与世田 +与世盛 +与世里 +与久田 +与之村 +与五沢 +与五澤 +与佐岡 +与佐田 +与保田 +与倉 +与儀 +与力 +与北 +与十田 +与原 +与口 +与古光 +与古田 +与合 +与吉 +与名 +与名城 +与名本 +与吾 +与吾沢 +与呉 +与味 +与品 +与喜 +与喜多 +与四田 +与国 +与坂 +与多垣内 +与太夫 +与子田 +与安 +与宗 +与小田 +与山 +与島 +与崎 +与嶋 +与嶺 +与川 +与市 +与市前 +与市園 +与座 +与後 +与志平 +与戸 +与斉 +与斎 +与曽井 +与曽田 +与曾井 +与曾田 +与木 +与本 +与村 +与杢 +与板 +与根本 +与永 +与沢 +与河 +与治 +与津 +与浦 +与澤 +与熊 +与猶 +与田 +与畑 +与畠 +与縄 +与繩 +与義 +与羽 +与羽瀬 +与能本 +与良 +与芝 +与茂 +与茂佐 +与茂田 +与藤 +与西 +与語 +与謝 +与謝野 +与谷 +与賀田 +与路 +与迫 +与那 +与那下 +与那元 +与那原 +与那国 +与那城 +与那嶺 +与那花 +与那覇 +与都 +与野 +与野井 +与野山 +与野木 +与門 +与風 +与齊 +丑ケ谷 +丑上 +丑丸 +丑久保 +丑井 +丑場 +丑子 +丑寅 +丑尾 +丑尾田 +丑屋 +丑山 +丑岡 +丑島 +丑嶋 +丑木 +丑本 +丑村 +丑永 +丑沢 +丑渕 +丑澤 +丑田 +丑番 +丑米 +丑膓 +丑舘 +丑若 +丑谷 +丑越 +丑込 +丑野 +丒丸 +丒久保 +丒山 +丒田 +丒米 +且 +且井 +且元 +且原 +且又 +且味 +且尾 +且本 +且来 +且田 +且股 +且見 +且部 +且野 +世ノ一 +世ノ上 +世ノ下 +世ノ本 +世一 +世上 +世並 +世並屋 +世代 +世伝 +世佐木 +世俵 +世儀 +世光弘 +世六 +世利 +世取 +世取山 +世古 +世古口 +世古宗 +世名城 +世和 +世喜 +世嘉良 +世坂 +世垣 +世増 +世多 +世子 +世子口 +世安 +世宮 +世尾 +世山 +世川 +世応 +世應 +世戸 +世戸原 +世戸口 +世戸島 +世持 +世木 +世木沢 +世木澤 +世木田 +世本 +世来 +世根 +世根村 +世桐 +世森 +世次原 +世歩 +世永 +世沢 +世河 +世波 +世津 +世津谷 +世浪 +世渡 +世満 +世瀬 +世王 +世理 +世田 +世界 +世登 +世直 +世知原 +世継 +世続 +世羅 +世羅田 +世耕 +世良 +世良井 +世良田 +世見 +世貝 +世賀 +世野 +世門 +世間瀬 +世雄 +世鳥山 +丘 +丘井 +丘元 +丘原 +丘咲 +丘太 +丘山 +丘島 +丘崎 +丘本 +丘村 +丘沢 +丘澤 +丘田 +丘野 +丞原 +丞徳 +丞村 +両井口 +両城 +両岡 +両川 +両沢 +両澤 +両角 +並 +並井 +並内 +並原 +並吉 +並家 +並山 +並岡 +並崎 +並川 +並平 +並床 +並木 +並本 +並村 +並杭 +並松 +並江 +並河 +並波 +並田 +並羅 +並良 +並谷 +並里 +中 +中の子 +中の瀬 +中の目 +中ノ +中ノ上 +中ノ内 +中ノ原 +中ノ又 +中ノ園 +中ノ坊 +中ノ堂 +中ノ子 +中ノ崎 +中ノ森 +中ノ殿 +中ノ渡 +中ノ瀬 +中ノ目 +中ノ神 +中ノ端 +中ノ谷 +中一 +中丁 +中七 +中万 +中三川 +中三瀬 +中上 +中上川 +中上野 +中下 +中下浦 +中与 +中世 +中世古 +中世良 +中丘 +中並 +中串 +中丸 +中丸木 +中主 +中久 +中久保 +中久喜 +中久木 +中久根 +中之 +中之上 +中之丸 +中之内 +中之前 +中之園 +中之坊 +中之宮 +中之庄 +中之庄谷 +中之所 +中之森 +中之浦 +中之瀬 +中之薗 +中之谷 +中之迫 +中之間 +中乗 +中亀 +中二 +中井 +中井上 +中井川 +中井戸 +中井手 +中井沢 +中井澤 +中井田 +中井谷 +中亭 +中人 +中仁沢 +中仁澤 +中仁谷 +中今 +中付 +中仙 +中仙道 +中代 +中仮屋 +中伊 +中伏 +中伏木 +中伝 +中位 +中住 +中佐 +中佐古 +中佐藤 +中作 +中來田 +中俊 +中保 +中信 +中俣 +中倉 +中倏 +中側 +中儀 +中兀 +中元 +中元寺 +中光 +中入 +中入地 +中八児 +中公 +中六角 +中其 +中兼 +中内 +中内侍 +中内田 +中円尾 +中冨 +中出 +中出口 +中出水 +中刀 +中分 +中切 +中刎 +中初 +中別 +中別府 +中利 +中剃 +中前 +中前園 +中前田 +中力 +中功 +中加 +中務 +中勝 +中勢 +中北 +中十 +中千 +中千代 +中升 +中南 +中原 +中原田 +中又 +中友 +中友安 +中口 +中古 +中古味 +中古場 +中古谷 +中古賀 +中古閑 +中台 +中右 +中司 +中司馬 +中合 +中吉 +中名 +中名主 +中名林 +中名生 +中向 +中向井 +中和 +中和田 +中和野 +中咲 +中唯 +中善寺 +中喜多 +中図 +中国 +中囿 +中國 +中園 +中圓尾 +中圖 +中土 +中土井 +中土居 +中地 +中坂 +中坊 +中坪 +中垣 +中垣内 +中垰 +中城 +中埜 +中埜渡 +中堀 +中堂 +中堂園 +中堂薗 +中堤 +中堰 +中場 +中塔 +中塘 +中塚 +中塢 +中塩 +中塩屋 +中塩路 +中墅 +中増 +中墨 +中墳 +中士代 +中壷 +中壺 +中壽賀 +中多 +中夜 +中大窪 +中大谷 +中大路 +中太 +中夲 +中夷 +中奥 +中妻 +中子 +中宅 +中宅間 +中宇地 +中宇根 +中宇祢 +中宇禰 +中守 +中安 +中宗 +中宗根 +中官 +中定 +中室 +中宥 +中宮 +中宮寺 +中家 +中宿 +中寄 +中寉 +中富 +中寺 +中対 +中寿賀 +中射 +中對 +中小原 +中小司 +中小城 +中小川 +中小次 +中小牧 +中小田 +中小路 +中小野 +中小野田 +中尻 +中尾 +中尾上 +中尾山 +中尾根 +中尾田 +中居 +中居向 +中居戸 +中居林 +中屋 +中屋原 +中屋敷 +中屋鋪 +中山 +中山田 +中岑 +中岡 +中岩 +中岩持 +中岫 +中岳 +中岸 +中峠 +中峯 +中峰 +中島 +中島田 +中島谷 +中崎 +中嵜 +中嶋 +中嶋田 +中嶌 +中嶒 +中嶺 +中嶽 +中川 +中川内 +中川原 +中川西 +中川路 +中州 +中工 +中左 +中己出 +中巳出 +中巻 +中市 +中市後 +中布 +中布利 +中師 +中常 +中幡 +中干場 +中平 +中平田 +中平等 +中広 +中庄 +中庄司 +中庄谷 +中店 +中座 +中庭 +中康 +中廣 +中延 +中建 +中廻 +中廼 +中弘 +中弥 +中張 +中彌 +中当 +中後 +中得 +中御門 +中徳 +中志 +中志貴 +中恵 +中惠 +中惣 +中戸 +中戸川 +中戸鎖 +中房 +中所 +中手 +中才 +中打 +中打木 +中払 +中拂 +中拾石 +中指 +中挟 +中振 +中振田 +中挾 +中捨 +中掘 +中提 +中摩 +中播 +中政 +中数賀 +中敷 +中敷領 +中文 +中斉 +中斎 +中新 +中新井 +中新井田 +中新出 +中新原 +中新地 +中新居 +中新屋 +中新田 +中方 +中日奈 +中日裏 +中早 +中明 +中易 +中昜 +中星 +中春 +中時 +中晴 +中智 +中曲瀬 +中曽 +中曽根 +中曽祢 +中曽禰 +中曽称 +中曾 +中曾根 +中曾祢 +中月 +中木 +中木原 +中木場 +中木屋 +中木戸 +中木村 +中末 +中本 +中本谷 +中机 +中朽 +中杉 +中村 +中村渠 +中村谷 +中束 +中条 +中条屋 +中杤 +中来田 +中東 +中松 +中松前 +中松尾 +中板 +中枌 +中林 +中枝 +中枡 +中柄 +中柳 +中柴 +中栃 +中栄 +中栖 +中栗 +中根 +中桐 +中桝 +中桧 +中桶 +中梅 +中條 +中條屋 +中梶 +中棚 +中森 +中棹 +中植 +中楚 +中楠 +中楯 +中榮 +中槁 +中槇 +中槙 +中樋 +中横 +中橋 +中檜 +中次 +中正 +中正司 +中武 +中歩師 +中段 +中殿 +中比良 +中氏 +中水 +中水流 +中永 +中永田 +中江 +中江川 +中江田 +中池 +中沖 +中沢 +中河 +中河内 +中河原 +中河西 +中治 +中沼 +中泉 +中泊 +中波 +中波田 +中洌 +中洞 +中津 +中津井 +中津原 +中津尾 +中津山 +中津川 +中津江 +中津浜 +中津海 +中津濱 +中津瀬 +中津熊 +中津畑 +中津留 +中津野 +中津隈 +中洲 +中浜 +中浜田 +中浦 +中浪 +中浴 +中海 +中深 +中深迫 +中淵 +中添 +中清 +中清水 +中済 +中渋 +中渓 +中渕 +中渡 +中渡瀬 +中港 +中湊 +中湖 +中湯 +中湯平 +中満 +中源 +中溝 +中溪 +中滝 +中滿 +中潟 +中潮 +中澁 +中澄 +中澗 +中澤 +中澤山 +中濃 +中濟 +中濱 +中瀧 +中瀬 +中瀬古 +中瀬戸 +中灘 +中火 +中無田 +中熊 +中牟田 +中牟礼 +中牟禮 +中牧 +中犀 +中狢 +中狭 +中狹 +中猪 +中獄 +中玉利 +中王子 +中王寺 +中理 +中瓦 +中瓶子 +中甑 +中生 +中生加 +中甫木 +中田 +中田島 +中田谷 +中由 +中町 +中畑 +中畔 +中留 +中畝 +中畝地 +中畠 +中畦 +中當 +中登 +中登屋 +中白 +中益 +中盛 +中目 +中眞 +中真 +中督 +中矢 +中矢代 +中矢野 +中知 +中知山 +中石 +中石橋 +中石田 +中砂 +中硲 +中磨 +中磯 +中礒 +中礼 +中社 +中祖 +中神 +中祢 +中福 +中福島 +中禮 +中禰 +中秋 +中科 +中租 +中移 +中程 +中稲 +中稻 +中穂 +中積 +中空 +中窪 +中立 +中竜 +中端 +中竹 +中笹 +中筋 +中筬 +中管 +中箭 +中箸 +中篠 +中篠迫 +中籔 +中米 +中粉 +中納 +中紙 +中細 +中組 +中絛 +中絵図 +中継 +中網 +中緒 +中繁 +中美 +中羽 +中老 +中老田 +中者 +中耒田 +中股 +中背 +中胡 +中能 +中能島 +中脇 +中腰 +中臣 +中臺 +中與 +中興 +中舍 +中舎 +中舗 +中舘 +中舛 +中舟木 +中舩津 +中船 +中船木 +中船津 +中良 +中芝 +中花 +中花田 +中芳 +中苑 +中茂 +中茎 +中茶 +中荒 +中荒井 +中荒江 +中荘 +中荷 +中莖 +中菅 +中菊 +中華 +中萩 +中萬 +中落 +中葉 +中蔦 +中蔵 +中薗 +中薮 +中薹 +中藏 +中藤 +中藪 +中虫壁 +中衛 +中袴田 +中裏 +中西 +中西出 +中見 +中見川 +中角 +中言 +中許 +中請 +中谷 +中谷内 +中谷地 +中谷里 +中豊留 +中貝 +中財 +中貫 +中賀 +中赤 +中越 +中跡 +中路 +中路間 +中車 +中軍 +中軸 +中軽米 +中農 +中辺 +中辻 +中込 +中迎 +中近 +中返 +中迫 +中迺 +中通 +中造 +中進 +中逵 +中逸 +中逹 +中道 +中達 +中邊 +中邑 +中邨 +中郡 +中部 +中部屋 +中部谷 +中郷 +中都 +中都留 +中里 +中里見 +中重 +中野 +中野上 +中野下 +中野内 +中野利 +中野地 +中野子 +中野尻 +中野尾 +中野屋 +中野崎 +中野川 +中野手 +中野村 +中野江 +中野沢 +中野渡 +中野澤 +中野田 +中野町 +中野目 +中野西 +中野谷 +中野里 +中野間 +中金 +中金名 +中釘 +中釜 +中釣 +中鉢 +中銭 +中鋪 +中錦 +中鍋 +中鍛冶 +中鍛治 +中鍵 +中鏡 +中長 +中門 +中門出 +中閑 +中間 +中間庭 +中間谷 +中関 +中阪 +中防 +中阿地 +中附 +中院 +中陣 +中陦 +中陳 +中陽 +中隅 +中隈 +中障子 +中隠居 +中隣 +中隥 +中隯 +中雄 +中霜 +中露 +中静 +中靜 +中面 +中面谷 +中須 +中須加 +中須田 +中須磨 +中須賀 +中頭 +中願寺 +中風 +中風呂 +中飛 +中食 +中飯 +中飯田 +中養母 +中館 +中馬 +中馬場 +中馬越 +中駄 +中高 +中高下 +中高路 +中髪 +中鳥 +中鶴 +中鶴間 +中鹿 +中麦 +中麻原 +中麿 +中黒 +中鼻 +中齊 +中齋 +中龍 +中﨏 +中𡌛 +中𦚰) +串 +串上 +串下 +串井 +串元 +串光 +串前 +串原 +串園 +串宮 +串尾 +串山 +串岡 +串島 +串崎 +串平 +串延 +串形 +串戸 +串木 +串木野 +串本 +串村 +串松 +串橋 +串浦 +串淵 +串渕 +串田 +串町 +串畑 +串谷 +串辺 +串部 +串野 +串間 +串阪 +串馬 +丸 +丸ノ内 +丸一 +丸七 +丸上 +丸下 +丸与 +丸世 +丸中 +丸乃内 +丸久 +丸久保 +丸之内 +丸亀 +丸二 +丸井 +丸井戸 +丸代 +丸仲 +丸伊 +丸伝 +丸住 +丸佐 +丸倉 +丸備 +丸傳 +丸儀 +丸元 +丸光 +丸児 +丸内 +丸剱 +丸加 +丸勢 +丸十 +丸原 +丸又 +丸口 +丸古 +丸吉 +丸喜 +丸国 +丸國 +丸地 +丸坂 +丸坪 +丸垣内 +丸城 +丸埜 +丸堂 +丸場 +丸塚 +丸大 +丸太 +丸子 +丸安 +丸宝 +丸宮 +丸家 +丸富 +丸小 +丸小山 +丸小野 +丸尾 +丸居 +丸屋 +丸山 +丸山内 +丸山谷 +丸山野 +丸岡 +丸岩 +丸岳 +丸峯 +丸峰 +丸島 +丸崎 +丸嵜 +丸嶋 +丸嶌 +丸嶺 +丸川 +丸市 +丸平 +丸幸 +丸広 +丸形 +丸徳 +丸応 +丸應 +丸戸 +丸投 +丸新 +丸最 +丸月 +丸木 +丸末 +丸本 +丸杉 +丸村 +丸林 +丸柱 +丸栖 +丸根 +丸梅 +丸森 +丸楠 +丸樹 +丸橋 +丸次 +丸武 +丸段 +丸毛 +丸民 +丸水 +丸永 +丸江 +丸池 +丸沢 +丸河 +丸治 +丸泉 +丸津 +丸浜 +丸浦 +丸浪 +丸海老 +丸淵 +丸添 +丸清水 +丸渕 +丸満 +丸潟 +丸澤 +丸濱 +丸瀬 +丸熊 +丸物 +丸玉 +丸王 +丸田 +丸田谷 +丸町 +丸畑 +丸畠 +丸登 +丸益 +丸目 +丸矢 +丸石 +丸碆 +丸福 +丸穂 +丸竜 +丸竹 +丸笠 +丸笹 +丸箸 +丸籔 +丸米 +丸繁 +丸與 +丸舛 +丸花 +丸芳 +丸若 +丸茂 +丸草 +丸菅 +丸菱 +丸葉 +丸薮 +丸藤 +丸藻 +丸衛 +丸西 +丸見 +丸角 +丸谷 +丸貴 +丸賀 +丸越 +丸身 +丸辻 +丸道 +丸重 +丸野 +丸野内 +丸金 +丸釼 +丸銭 +丸長 +丸開 +丸関 +丸隈 +丸雄 +丸領 +丸飯 +丸馬 +丸高 +丸鳩 +丸鶴 +丸龍 +丹 +丹上 +丹下 +丹下坂 +丹井 +丹京 +丹代 +丹伊田 +丹保 +丹光 +丹党 +丹内 +丹冶 +丹出 +丹北 +丹南 +丹原 +丹古 +丹台 +丹司 +丹合 +丹后 +丹吾 +丹呉 +丹和 +丹喜 +丹圃 +丹土 +丹地 +丹坂 +丹埜 +丹場 +丹塚 +丹多 +丹宗 +丹宮 +丹家 +丹尾 +丹山 +丹島 +丹崎 +丹嶋 +丹嶌 +丹川 +丹川元 +丹度 +丹後 +丹後田 +丹後谷 +丹慶 +丹戸 +丹所 +丹新 +丹木 +丹本 +丹村 +丹松 +丹林 +丹柿 +丹根 +丹森 +丹橋 +丹次 +丹正 +丹比 +丹気 +丹氣 +丹沢 +丹治 +丹治比 +丹法 +丹波 +丹波地 +丹波屋 +丹波谷 +丹渡 +丹澤 +丹生 +丹生屋 +丹生山 +丹生川 +丹生田 +丹生石 +丹生谷 +丹生附 +丹甫 +丹田 +丹穂 +丹竜 +丹籐 +丹羽 +丹羽口 +丹羽瀬 +丹羽野 +丹能 +丹良本 +丹花 +丹菊 +丹葉 +丹蔵 +丹藤 +丹谷 +丹賀 +丹賀沢 +丹賀澤 +丹路 +丹輪 +丹農 +丹辺 +丹邉 +丹邊 +丹那 +丹部 +丹郷 +丹重 +丹野 +丹鍬 +丹間 +丹阪 +丹阿弥 +丹頂 +丹馬 +丹黒 +主 +主井 +主代 +主侍 +主出 +主原 +主和津 +主地本 +主山 +主島 +主御門 +主枝 +主森 +主浜 +主海 +主濱 +主田 +主税 +主藤 +主計 +主谷 +主頭 +主馬 +主馬野 +乃一 +乃万 +乃上 +乃井 +乃勢 +乃口 +乃台 +乃坂 +乃川 +乃木 +乃木田 +乃村 +乃林 +乃生 +乃生須 +乃田 +乃美 +乃込 +久 +久々 +久々他 +久々原 +久々宇 +久々宮 +久々山 +久々成 +久々江 +久々津 +久々港 +久々湊 +久々知 +久々野 +久ケ山 +久ケ本 +久ケ沢 +久ケ澤 +久ケ谷 +久ノ +久ノ坪 +久一 +久七 +久万 +久万寿 +久万川 +久万沢 +久万澤 +久万田 +久上 +久下 +久下井 +久下塚 +久下本 +久下沼 +久下谷 +久世 +久世谷 +久中 +久丸 +久久江 +久久津 +久久湊 +久之坪 +久乗 +久乘 +久井 +久井原 +久井田 +久仁 +久仏 +久代 +久伊 +久伝 +久住 +久住呂 +久住川 +久佐 +久佐木 +久佐田 +久佐訳 +久佐賀 +久佐野 +久佛 +久保 +久保ノ谷 +久保上 +久保下 +久保世 +久保中 +久保井 +久保倉 +久保元 +久保内 +久保処 +久保出 +久保利 +久保原 +久保口 +久保向 +久保園 +久保地 +久保坂 +久保埜 +久保塚 +久保多 +久保奥 +久保宮 +久保寺 +久保尻 +久保尾 +久保居 +久保屋敷 +久保山 +久保岡 +久保島 +久保崎 +久保嶋 +久保川 +久保市 +久保平 +久保庭 +久保形 +久保戸 +久保敷 +久保木 +久保本 +久保杉 +久保村 +久保松 +久保柿 +久保毛 +久保永 +久保江 +久保池 +久保沢 +久保河 +久保河内 +久保沼 +久保津 +久保浦 +久保淵 +久保添 +久保渕 +久保澤 +久保瀬 +久保玉井 +久保田 +久保白 +久保目 +久保石 +久保秋 +久保脇 +久保薗 +久保西 +久保見 +久保谷 +久保道 +久保野 +久保野谷 +久保長 +久保隅 +久保頭 +久保高 +久信 +久信田 +久倉 +久傅 +久傳 +久元 +久光 +久八 +久具 +久具山 +久兼 +久内 +久冨 +久冨木 +久冨木原 +久冨貴 +久出 +久出川 +久分 +久利 +久利生 +久利須 +久前 +久力 +久加 +久加天 +久加根 +久勝 +久勢 +久北 +久原 +久古 +久古谷 +久司 +久合田 +久吉 +久名木 +久呂 +久呂宮 +久呉 +久味木 +久和 +久和原 +久和山 +久和田 +久和野 +久品 +久善 +久喜 +久喜津 +久喜田 +久国 +久國 +久土 +久土地 +久土目 +久地 +久地井 +久地岡 +久地楽 +久地浦 +久地石 +久坂 +久坂部 +久坊 +久城 +久埜 +久堀 +久堂 +久場 +久場島 +久場川 +久塚 +久墨 +久壁 +久士本 +久士目 +久壽 +久壽居 +久壽米木 +久多羅岐 +久多羅木 +久多良 +久多良岐 +久多良木 +久多見 +久多里 +久夛良木 +久奥 +久女田 +久好 +久妻 +久子 +久宇田 +久守 +久安 +久宍 +久宗 +久宝 +久宮 +久家 +久家田 +久宿 +久富 +久富木 +久富木原 +久寝 +久寳 +久寶 +久寿 +久寿居 +久寿田 +久寿米木 +久寿里 +久尾 +久居 +久屋 +久山 +久岐 +久岡 +久峨 +久峩 +久峯 +久島 +久崎 +久嵜 +久嶋 +久嶌 +久川 +久左賀 +久市 +久布白 +久常 +久平 +久幸 +久幾田 +久府 +久座 +久延 +久弘 +久形 +久後 +久徳 +久志 +久志井 +久志岡 +久志木 +久志本 +久志田 +久志目 +久志野 +久恒 +久恵 +久惠 +久慈 +久慈林 +久慈道 +久成 +久我 +久我原 +久我口 +久我尾 +久我美 +久我谷 +久戸 +久戸瀬 +久所 +久手 +久手堅 +久手川 +久才 +久持 +久掘 +久故 +久敷 +久文 +久斉 +久斎 +久斗 +久新 +久方 +久昌 +久明 +久曽神 +久曾神 +久替 +久有 +久朗津 +久木 +久木井 +久木元 +久木原 +久木園 +久木宮 +久木山 +久木崎 +久木川 +久木本 +久木村 +久木田 +久木留 +久木迫 +久木野 +久木野々 +久木野野 +久未 +久末 +久本 +久杉 +久村 +久東 +久松 +久板 +久林 +久枝 +久染 +久柳 +久柴 +久栄 +久栖 +久根 +久根下 +久根内 +久根口 +久根崎 +久根木 +久根本 +久根次 +久根添 +久根田 +久根間 +久森 +久椿 +久楽 +久楽持 +久樂 +久樂持 +久樹 +久次 +久次目 +久次米 +久武 +久武城 +久歳 +久毛 +久民 +久水 +久永 +久江 +久江田 +久池 +久池井 +久池岡 +久沢 +久河 +久治 +久治米 +久泉 +久波 +久津 +久津内 +久津名 +久津呂 +久津和 +久津屋 +久津岡 +久津川 +久津摩 +久津木 +久津沢 +久津澤 +久津田 +久津礼 +久津美 +久津見 +久津谷 +久津輪 +久津那 +久津野 +久津間 +久浦 +久海東 +久清 +久渡 +久湊 +久満 +久源 +久溜間 +久滋 +久滝 +久澄 +久澤 +久瀧 +久瀬 +久瀬川 +久物 +久玉 +久理田 +久生 +久甫 +久甫川 +久田 +久田原 +久田松 +久田見 +久田里 +久畄島 +久畄嶋 +久畄間 +久畑 +久留 +久留主 +久留井 +久留内 +久留利 +久留原 +久留味川 +久留宮 +久留島 +久留嶋 +久留巣 +久留戸 +久留木 +久留本 +久留林 +久留栖 +久留生 +久留田 +久留真 +久留磨 +久留米 +久留美 +久留見 +久留野 +久留間 +久留須 +久留飛 +久留馬 +久登本 +久白 +久百々 +久盛 +久目 +久目形 +久知良 +久石 +久磨 +久礼 +久礼田 +久礼羽 +久礼輪 +久祖神 +久神 +久祢田 +久禮 +久禮田 +久禮羽 +久禰田 +久秋 +久穂 +久積 +久穐 +久竜 +久竹 +久笠 +久笹 +久篠 +久米 +久米井 +久米原 +久米子 +久米山 +久米島 +久米川 +久米木 +久米本 +久米村 +久米橋 +久米沢 +久米澤 +久米田 +久米谷 +久米野 +久納 +久継 +久綱 +久繁 +久美 +久美屋 +久美岡 +久美田 +久羽 +久翁 +久胡 +久能 +久能木 +久良 +久良持 +久良木 +久良知 +久良谷 +久芝 +久芳 +久茂田 +久茂谷 +久萬 +久萬壽 +久萬田 +久葉 +久蔵 +久薮 +久藏 +久藤 +久藪 +久行 +久西 +久見 +久見木 +久見瀬 +久見迫 +久角 +久詰 +久語 +久谷 +久豊 +久貝 +久貞 +久貫 +久貴 +久貴谷 +久賀 +久賀田 +久賀谷 +久賀野 +久路 +久軒 +久辺 +久迩 +久連山 +久連松 +久連石 +久道 +久遠 +久邇 +久邊 +久郎津 +久部 +久部良 +久郷 +久郷江 +久郷田 +久都 +久都内 +久都間 +久里 +久里山 +久重 +久重路 +久野 +久野井 +久野木 +久野村 +久野瀬 +久野田 +久金 +久銘地 +久銘次 +久鍋 +久長 +久門 +久門田 +久開 +久閑 +久間 +久間倉 +久間原 +久間地 +久間木 +久間瀬 +久間生 +久間田 +久間部 +久阪 +久防 +久隅 +久須 +久須木 +久須本 +久須田 +久須窪 +久須美 +久須見 +久頭見 +久馬 +久高 +久鬼 +久鹿 +久黒 +久龍 +乍 +乕丘 +乕井 +乕尾 +乕屋 +乕岩 +乕松 +乕溪 +乕瀬 +乕田 +乕若 +乕谷 +乕野 +乕間 +乗 +乗上 +乗久 +乗井 +乗京 +乗付 +乗住 +乗倉 +乗元 +乗光 +乗兼 +乗冨 +乗原 +乗友 +乗口 +乗地 +乗安 +乗宗 +乗定 +乗富 +乗山 +乗岡 +乗峯 +乗峰 +乗島 +乗崎 +乗嶺 +乗川 +乗常 +乗影 +乗房 +乗政 +乗智 +乗替 +乗木 +乗末 +乗本 +乗杉 +乗村 +乗松 +乗橋 +乗次 +乗正房 +乗永 +乗池 +乗浜 +乗添 +乗濱 +乗物 +乗田 +乗矢 +乗石 +乗秀 +乗立 +乗竹 +乗舟 +乗船 +乗藤 +乗行 +乗谷 +乗貞 +乗越 +乗重 +乗金 +乗附 +乗鞍 +乘井 +乘京 +乘光 +乘兼 +乘冨 +乘友 +乘口 +乘安 +乘富 +乘山 +乘岡 +乘峯 +乘川 +乘常 +乘木 +乘末 +乘本 +乘杉 +乘村 +乘松 +乘次 +乘永 +乘浜 +乘添 +乘濱 +乘田 +乘秀 +乘立 +乘竹 +乘船 +乘藤 +乘行 +乘越 +乘金 +乘附 +乙 +乙ケ迫 +乙ケ部 +乙丸 +乙二 +乙井 +乙供 +乙保 +乙倉 +乙内 +乙出 +乙加 +乙原 +乙吉 +乙名 +乙咩 +乙地 +乙坂 +乙場 +乙女 +乙子 +乙守 +乙宗 +乙山 +乙島 +乙崎 +乙嶋 +乙川 +乙幡 +乙広 +乙度 +乙廣 +乙志 +乙成 +乙戸 +乙政 +乙木 +乙村 +乙枝 +乙森 +乙武 +乙母 +乙河内 +乙津 +乙浦 +乙瀬 +乙牧 +乙犬 +乙田 +乙益 +乙目 +乙石 +乙社 +乙竹 +乙羽 +乙脇 +乙花 +乙茂内 +乙葉 +乙藤 +乙見 +乙訓 +乙谷 +乙谷内 +乙貫 +乙賀 +乙辺 +乙道 +乙邊 +乙部 +乙重 +乙野 +乙間 +乙須 +乙顔 +乙馬 +乙骨 +乙高 +乙黒 +九 +九々 +九ノ池 +九ノ里 +九万原 +九万田 +九之坪 +九之池 +九乗 +九九 +九二 +九井 +九会田 +九住 +九佐 +九保 +九俵 +九内 +九冨 +九刕 +九十 +九十三 +九十九 +九十九沢 +九十九澤 +九十九田 +九十九里 +九十歩 +九十田 +九十谷 +九千房 +九原 +九反 +九反田 +九司 +九合 +九喜 +九坪 +九城 +九埜 +九堀 +九家 +九富 +九尾 +九山 +九岡 +九島 +九嶋 +九川 +九平 +九座 +九後 +九徳 +九志田 +九戸 +九手 +九折 +九日 +九星 +九曜 +九會田 +九木 +九木田 +九木野 +九本 +九村 +九条 +九東 +九栗 +九條 +九次米 +九沢 +九河 +九法 +九津見 +九浦 +九海 +九渡 +九澤 +九猪 +九玉 +九田 +九町 +九目 +九矢 +九石 +九社前 +九穂 +九笹 +九綱 +九翟 +九能 +九良 +九良賀野 +九良野 +九萬原 +九藤 +九蘭 +九角 +九護 +九谷 +九谷田 +九貫 +九賀 +九軒 +九郎丸 +九郎座 +九郎明川 +九郎田 +九郷 +九里 +九里山 +九里田 +九重 +九重地 +九重谷 +九重路 +九野 +九野坂 +九野木 +九野里 +九門 +九間 +九頭 +九頭竜 +九頭竜坂 +九頭見 +九頭龍 +九頭龍坂 +九首見 +九高 +九鬼 +九鬼丸 +乞水 +乢 +乱橋 +乳久保 +乳井 +乳原 +乳川 +乳根 +乳母 +乳深 +乾 +乾中 +乾井 +乾原 +乾口 +乾山 +乾川 +乾房 +乾条 +乾條 +乾沢 +乾澤 +乾田 +乾田和 +乾谷 +乾辺 +乾邊 +乾野 +乾風 +亀 +亀ケ井 +亀ケ岡 +亀ケ川 +亀ケ森 +亀ケ沢 +亀ケ渕 +亀ケ澤 +亀ケ盛 +亀ケ谷 +亀ノ上 +亀ノ園 +亀上 +亀下 +亀中 +亀丸 +亀久 +亀久保 +亀之内 +亀之原 +亀之園 +亀井 +亀井山 +亀井川 +亀井沢 +亀代 +亀位 +亀住 +亀作 +亀倉 +亀元 +亀光 +亀入 +亀内 +亀冷 +亀割 +亀卦川 +亀原 +亀友 +亀口 +亀吉 +亀和 +亀和田 +亀喜 +亀園 +亀地 +亀坂 +亀垣 +亀城 +亀埼 +亀塚 +亀多 +亀好 +亀子 +亀守 +亀安 +亀宝 +亀家 +亀寉 +亀寳 +亀寶 +亀尻 +亀尾 +亀居 +亀屋 +亀山 +亀岡 +亀岩 +亀岬 +亀島 +亀崎 +亀嵜 +亀嶋 +亀嶽 +亀川 +亀川田 +亀師 +亀平 +亀広 +亀廣 +亀廻 +亀廼井 +亀弘 +亀形 +亀徳 +亀慶 +亀掛川 +亀星 +亀有 +亀木 +亀本 +亀村 +亀松 +亀板 +亀林 +亀梨 +亀森 +亀樋 +亀橋 +亀次 +亀氏 +亀水 +亀永 +亀江 +亀池 +亀沖 +亀沢 +亀治中 +亀洞 +亀津 +亀浜 +亀浦 +亀海 +亀淵 +亀渕 +亀滝 +亀澗 +亀澤 +亀濱 +亀瀧 +亀田 +亀田谷 +亀甲 +亀甲谷 +亀畑 +亀矢 +亀石 +亀窟 +亀窪 +亀竜 +亀竹 +亀舎 +亀苔 +亀若 +亀蔦 +亀西 +亀谷 +亀貝 +亀越 +亀迫 +亀迺井 +亀遊 +亀里 +亀重 +亀野 +亀野尾 +亀金谷 +亀長 +亀間 +亀関 +亀阪 +亀頭 +亀頭迫 +亀飼 +亀高 +亀鶴 +亀鷹 +亀龍 +予城 +予山 +予風 +事 +事代堂 +事口 +事崎 +事柴 +事浦 +事谷 +二っ家 +二の丸 +二の宮 +二の瀬 +二タ川 +二タ月 +二タ村 +二タ見 +二ツ亀 +二ツ井 +二ツ城 +二ツ家 +二ツ寺 +二ツ屋 +二ツ山 +二ツ川 +二ツ木 +二ツ柳 +二ツ森 +二ツ橋 +二ツ池 +二ツ町 +二ツ矢 +二ツ石 +二ツ神 +二ツ谷 +二ツ迫 +二ツ野 +二ノ上 +二ノ下 +二ノ丸 +二ノ久保 +二ノ井 +二ノ倉 +二ノ原 +二ノ口 +二ノ坂 +二ノ城 +二ノ宮 +二ノ峰 +二ノ形 +二ノ戸 +二ノ文 +二ノ方 +二ノ本 +二ノ村 +二ノ瀬 +二ノ田 +二ノ神 +二ノ美屋 +二ノ谷 +二ノ関 +二丁田 +二万 +二三 +二三味 +二三四 +二三島 +二上 +二世 +二串 +二丸 +二丹 +二丹田 +二久 +二久山 +二之夕 +二之宮 +二之形 +二之方 +二之段 +二之湯 +二之瀬 +二之部 +二九 +二五 +二五元 +二五垰 +二五田 +二井 +二井上 +二井内 +二井原 +二井土 +二井家 +二井屋 +二井屋田 +二井山 +二井岡 +二井川 +二井手 +二井本 +二井林 +二井田 +二井矢 +二井藤 +二井見 +二井谷 +二井野 +二井関 +二亦 +二位 +二位松 +二位永 +二位関 +二佐 +二保 +二俟 +二俣 +二元 +二六 +二出川 +二分 +二分野 +二十一 +二十二 +二十八 +二十歩 +二十田 +二十軒 +二十里 +二原 +二又 +二又川 +二叉 +二叉川 +二反 +二反地 +二反田 +二反長 +二口 +二口谷 +二司 +二名 +二味 +二和田 +二唐 +二問 +二善 +二喜 +二四 +二四岡 +二国 +二國 +二坂 +二坂谷 +二坪 +二垣 +二基 +二堂 +二場 +二塚 +二夕川 +二夕見 +二多田 +二子 +二子岩 +二子石 +二字 +二宗 +二宝 +二宮 +二家 +二家本 +二尾 +二居 +二居野 +二山 +二岡 +二岩 +二岸 +二峯 +二峰 +二島 +二崎 +二嶋 +二川 +二川原 +二川目 +二幡 +二平 +二平太 +二弊? +二張 +二戸 +二戸部 +二所宮 +二挺木 +二摩 +二改 +二敷 +二文字 +二文字屋 +二斗蒔 +二斗蒔田 +二斜 +二方 +二日一 +二日市 +二星 +二曽 +二替 +二月田 +二木 +二木田 +二本 +二本垣 +二本木 +二本杉 +二本松 +二本柳 +二本柿 +二本森 +二本樹 +二本橋 +二杁 +二杉 +二村 +二条 +二条久保 +二条院 +二松 +二林 +二枚田 +二枚畑 +二枝 +二柱 +二柳 +二柿 +二栗 +二栢 +二株 +二梃木 +二條 +二條久保 +二森 +二椙 +二楷堂 +二標 +二橋 +二次 +二正寺 +二武 +二歩 +二段 +二殿 +二永 +二江 +二沢 +二沢平 +二河 +二河田 +二法田 +二津 +二津谷 +二浦 +二浦尾 +二浪 +二渡 +二滝 +二澤 +二澤平 +二瀧 +二瀬 +二瀬川 +二熊 +二片 +二牟礼 +二牟禮 +二牧畑 +二王堂 +二王頭 +二瓶 +二田 +二田原 +二田口 +二田水 +二町 +二畑 +二畠 +二百寺 +二百田 +二目 +二矢 +二矢川 +二矢田 +二石 +二礼 +二礼木 +二社谷 +二祖 +二神 +二禮木 +二科 +二穴 +二窓 +二籐 +二継 +二羽 +二股 +二艘木 +二艘舟 +二色 +二若 +二茅 +二荒 +二葉 +二薮 +二藤 +二藤部 +二見 +二見屋 +二見谷 +二角 +二谷 +二谷島 +二貝 +二賀木 +二越 +二軒谷 +二輪 +二通 +二連木 +二道 +二邨 +二郎丸 +二部 +二部野 +二郷 +二里 +二里木 +二重 +二重作 +二重谷 +二野 +二野上 +二野下 +二野井 +二野塀 +二野宮 +二野屏 +二野川 +二野戸 +二野瀬 +二野瓶 +二門 +二間 +二間戸 +二間瀬 +二関 +二隅 +二階 +二階堂 +二階戸 +二階蔵 +二階藏 +二階谷 +二面 +二飯田 +二馬 +二鹿 +互 +互井 +互野 +五の井 +五の坪 +五ケ山 +五ケ市 +五ケ谷 +五ノ上 +五ノ井 +五ノ坪 +五ノ田 +五ノ谷 +五丁 +五丁森 +五万戸 +五三 +五上 +五下 +五丸 +五丹 +五之治 +五乙女 +五井 +五井山 +五井淵 +五井渕 +五井野 +五代 +五代儀 +五伝木 +五位 +五位堂 +五位塚 +五位尾 +五位淵 +五位渕 +五位野 +五來 +五傳木 +五六 +五内川 +五冨利 +五刀 +五分木 +五利江 +五前 +五加 +五勝出 +五十井 +五十井田 +五十代 +五十住 +五十免 +五十公野 +五十内 +五十刈 +五十右 +五十君 +五十地 +五十場 +五十子 +五十実 +五十實 +五十山田 +五十峯 +五十峰 +五十島 +五十崎 +五十嵐 +五十嶋 +五十嶺 +五十川 +五十州 +五十幡 +五十木 +五十村 +五十栖 +五十森 +五十棲 +五十樓 +五十殿 +五十沢 +五十洲 +五十澤 +五十玉 +五十田 +五十畑 +五十畠 +五十石 +五十立 +五十苅 +五十谷 +五十貝 +五十部 +五十里 +五十里屋 +五十野 +五十鈴 +五十鈴川 +五十風 +五十香 +五升田 +五升目 +五反 +五反分 +五反地 +五反田 +五反田屋 +五古 +五名 +五呂 +五味 +五味之本 +五味原 +五味多 +五味岡 +五味川 +五味本 +五味沢 +五味淵 +五味渕 +五味澤 +五味田 +五和宮 +五唐 +五喜田 +五坊 +五坪 +五城 +五堂 +五大 +五大院 +五天 +五太代 +五太子 +五字 +五孝 +五安 +五安城 +五官 +五定 +五宝 +五宮 +五家 +五寧 +五寳 +五寶 +五対 +五對 +五屋 +五山 +五岩 +五峯 +五島 +五島屋 +五崎 +五嵐 +五嵐川 +五嶋 +五嶋屋 +五嶌 +五川 +五師 +五幣 +五幤 +五平地 +五幾谷 +五座 +五庵 +五弊 +五弓 +五影 +五影堂 +五得 +五徳 +五戸 +五所 +五所尾 +五所村 +五所野尾 +五拾免 +五敷 +五斗 +五斗田 +五斗蒔 +五日市 +五明 +五明田 +五智 +五月 +五月女 +五月日 +五月田 +五木 +五木本 +五木田 +五木谷 +五本 +五本上 +五本木 +五本松 +五村 +五条 +五条堀 +五条川 +五条方 +五来 +五東 +五林 +五枚橋 +五枝 +五枡本 +五桝本 +五條 +五條堀 +五條歩 +五次 +五歩一 +五歩市 +五歩池 +五殿 +五水井 +五江淵 +五江渕 +五沢 +五泉 +五津 +五浦 +五海 +五瀬 +五熊 +五王 +五瓶 +五田 +五由出 +五町 +五町森 +五畑 +五畿田 +五百 +五百久 +五百井 +五百住 +五百倉 +五百原 +五百城 +五百尾 +五百山 +五百島 +五百崎 +五百川 +五百扇 +五百旗部 +五百旗頭 +五百木 +五百森 +五百沢 +五百澤 +五百瀬 +五百田 +五百目 +五百磐 +五百竹 +五百籏頭 +五百蔵 +五百藏 +五百路 +五百部 +五百野 +五百雀 +五石 +五社 +五社谷 +五神 +五福 +五穀 +五端 +五筒 +五箇 +五箇谷 +五箇野 +五籐 +五網 +五老 +五老海 +五耒 +五舛出 +五舛目 +五艘 +五良 +五良島 +五良水 +五色 +五荘 +五葉 +五葉木 +五葉谷 +五藤 +五行 +五見 +五角 +五谷 +五貝 +五貫 +五賀 +五軒家 +五軒浜 +五軒濱 +五軒矢 +五輪 +五辺 +五辻 +五通 +五道 +五邉 +五郎 +五郎三 +五郎丸 +五郎地 +五郎大 +五郎尾 +五郎島 +五郎川 +五郎水 +五郎畑 +五郎谷 +五郎部 +五郡 +五酔 +五里地 +五里守 +五里川原 +五里江 +五重目 +五野 +五野上 +五野井 +五閑 +五間 +五間岩 +五間長 +五関 +五阿味 +五阿弥 +五阿彌 +五陸 +五雲寺 +五領 +五領田 +五頭 +五香 +五香屋 +五鬼上 +五鬼助 +五鬼田 +五鬼継 +五鹿 +五龍神田 +井 +井々村 +井の下 +井の口 +井ケ倉 +井ケ瀬 +井ケ田 +井ケ谷 +井ノ一 +井ノ上 +井ノ下 +井ノ久保 +井ノ井 +井ノ倉 +井ノ元 +井ノ内 +井ノ原 +井ノ又 +井ノ口 +井ノ坂 +井ノ塚 +井ノ子 +井ノ宮 +井ノ尻 +井ノ尾 +井ノ山 +井ノ岡 +井ノ島 +井ノ崎 +井ノ川 +井ノ戸 +井ノ木 +井ノ末 +井ノ本 +井ノ村 +井ノ根 +井ノ森 +井ノ江 +井ノ浦 +井ノ瀬 +井ノ畑 +井ノ脇 +井ノ蔵 +井ノ藏 +井ノ谷 +井ノ辺 +井ノ辻 +井ノ迫 +井ノ道 +井ノ邊 +井ノ部 +井ノ阪 +井一 +井上 +井上川 +井下 +井下原 +井下山 +井下田 +井世 +井並 +井中 +井中家 +井丸 +井丸岡 +井丹 +井主 +井久保 +井久田 +井之 +井之上 +井之下 +井之丸 +井之元 +井之内 +井之前 +井之原 +井之口 +井之坂 +井之尻 +井之尾 +井之崎 +井之川 +井之本 +井之村 +井之浦 +井之脇 +井之藏 +井之谷 +井之輪 +井亀 +井二 +井亦 +井仁 +井介 +井代 +井伊 +井伊塚 +井伊田 +井伊谷 +井伏 +井住 +井佐 +井佐原 +井佐子 +井余田 +井作 +井保 +井保内 +井保呂 +井保田 +井俣 +井倉 +井値 +井側 +井元 +井先 +井光 +井入 +井内 +井内田 +井冨 +井出 +井出上 +井出下 +井出之上 +井出元 +井出原 +井出口 +井出尻 +井出尾 +井出山 +井出岡 +井出崎 +井出川 +井出本 +井出村 +井出段 +井出沢 +井出澤 +井出田 +井出迫 +井出野 +井分 +井刈 +井利 +井利元 +井削 +井前 +井副 +井加 +井加田 +井勘 +井勝 +井勢 +井升 +井南 +井原 +井原木 +井又 +井口 +井古 +井古田 +井合 +井吉 +井名 +井向 +井吹 +井周 +井和丸 +井和田 +井唯 +井園 +井土 +井土下 +井土井 +井土垣 +井土川 +井土本 +井地 +井地口 +井地岡 +井地知 +井坂 +井坊 +井坪 +井垣 +井城 +井埜 +井堀 +井堂 +井堤 +井堰 +井場 +井場中 +井場元 +井場崎 +井場木 +井場田 +井塚 +井塞 +井塲 +井境 +井墉 +井壮 +井壷 +井多原 +井太家 +井奈 +井奈波 +井奥 +井好 +井孝 +井学 +井學 +井守 +井宗 +井定 +井実 +井室 +井宮 +井家 +井家上 +井寄 +井富 +井實 +井寺 +井対 +井對 +井小萩 +井小路 +井尻 +井尾 +井尾瀬 +井居 +井居島 +井居嶋 +井山 +井岡 +井岩 +井岸 +井峯 +井峰 +井島 +井崎 +井嵐 +井嵜 +井嶋 +井嶌 +井川 +井川上 +井川原 +井巻 +井師 +井幕 +井幡 +井平 +井床 +井庭 +井延 +井廻 +井形 +井後 +井徳 +井恵 +井成 +井戸 +井戸ノ上 +井戸ノ本 +井戸上 +井戸下 +井戸之上 +井戸井 +井戸側 +井戸元 +井戸入 +井戸内 +井戸前 +井戸原 +井戸口 +井戸向 +井戸坂 +井戸垣 +井戸家 +井戸尻 +井戸屋 +井戸山 +井戸岡 +井戸崎 +井戸川 +井戸木 +井戸本 +井戸村 +井戸根 +井戸沢 +井戸沼 +井戸浦 +井戸浴 +井戸渕 +井戸澤 +井戸田 +井戸畑 +井戸硲 +井戸窪 +井戸端 +井戸西 +井戸谷 +井戸賀 +井戸辺 +井戸辻 +井戸邉 +井戸邊 +井戸野 +井戸阪 +井戸頭 +井所 +井手 +井手ケ原 +井手ノ上 +井手ノ瀬 +井手上 +井手下 +井手中 +井手之上 +井手元 +井手光 +井手内 +井手原 +井手口 +井手吉 +井手向 +井手坂 +井手尾 +井手山 +井手岡 +井手川 +井手平 +井手本 +井手林 +井手橋 +井手段 +井手永 +井手淵 +井手添 +井手渕 +井手瀬 +井手田 +井手畑 +井手窪 +井手端 +井手篭 +井手籠 +井手脇 +井手西 +井手谷 +井手迫 +井手重 +井手野 +井手野下 +井折 +井指 +井掘 +井掛 +井改 +井斉 +井斎 +井斗 +井料 +井料田 +井方 +井旗 +井早 +井早山 +井星 +井曽 +井曾 +井月 +井木 +井木戸 +井木沢 +井木澤 +井末 +井本 +井杉 +井村 +井東 +井松 +井板 +井林 +井枡 +井柄 +井染 +井柳 +井栗 +井根 +井根口 +井根本 +井桁 +井桜 +井桝 +井梅 +井森 +井植 +井槌 +井槻 +井樋 +井樋元 +井樋口 +井樋田 +井樋迫 +井樋野 +井樫 +井樽 +井橋 +井櫻 +井次 +井武 +井殿 +井比 +井毛田 +井民 +井水 +井永 +井江 +井池 +井汲 +井沖 +井沢 +井沢島 +井河 +井河原 +井河沢 +井河澤 +井治 +井沼 +井沼田 +井泉 +井波 +井波屋 +井波谷 +井洞 +井津 +井津上 +井津井 +井津元 +井津垣 +井津川 +井津木 +井津本 +井津端 +井津美 +井津野 +井流 +井浜 +井浦 +井浪 +井海 +井海田 +井涛 +井深 +井淵 +井添 +井清 +井渓 +井渕 +井溝 +井溪 +井滝 +井漕 +井潟 +井澄 +井澗 +井澤 +井澤島 +井濃内 +井濱 +井瀉 +井瀧 +井瀬 +井瀬谷 +井灘 +井無田 +井熊 +井爪 +井片 +井狩 +井玉 +井王 +井理 +井生 +井用 +井田 +井田丸 +井田倉 +井田屋 +井田川 +井町 +井畑 +井畔 +井畝 +井畠 +井登 +井白 +井益 +井盛 +井相田 +井矢崎 +井石 +井砂 +井硲 +井碩 +井磧 +井祐 +井神 +井福 +井科 +井積 +井穴 +井窪 +井立 +井立田 +井竜 +井端 +井竹 +井竿 +井笹 +井筒 +井筒屋 +井筒谷 +井箆 +井箟 +井管 +井篠 +井籐 +井籠 +井納 +井組 +井綱 +井織 +井置 +井羅 +井美 +井義 +井股 +井能 +井脇 +井腰 +井舎 +井舟 +井船 +井良々 +井良沢 +井良澤 +井艸 +井芝 +井花 +井芹 +井苅 +井若 +井茂 +井草 +井菅 +井萱 +井落 +井葉野 +井蓋 +井藁 +井藤 +井藤田 +井藤賀 +井藻 +井街 +井表 +井裏 +井西 +井角 +井詰 +井谷 +井谷内 +井谷松 +井谷田 +井豆 +井豫 +井貝 +井貫 +井賀 +井賀木 +井越 +井足 +井跡 +井路側 +井路端 +井踏 +井辰 +井辺 +井辻 +井迎 +井迫 +井通 +井道 +井達 +井邉 +井邊 +井邑 +井那 +井邨 +井部 +井郷 +井野 +井野上 +井野下 +井野元 +井野内 +井野口 +井野場 +井野塲 +井野宮 +井野家 +井野屋 +井野山 +井野岡 +井野崎 +井野川 +井野戸 +井野木 +井野本 +井野村 +井野松 +井野根 +井野森 +井野瀬 +井野田 +井野畑 +井野端 +井野谷 +井野越 +井野辺 +井野辻 +井野邉 +井野邊 +井野部 +井釜 +井釡 +井銅 +井鍋 +井長 +井長原 +井門 +井開 +井間 +井関 +井關 +井阪 +井隅 +井隈 +井階 +井隝 +井隼 +井雲 +井面 +井須 +井領 +井頭 +井餘田 +井馬 +井駒 +井高 +井鳥 +井鷺 +井麻田 +井黒 +井鼻 +井齊 +井齋 +井龍 +亜厂 +亜原 +亜地知 +亜宮原 +亜岐 +亜比留 +亜雁 +亞厂 +亟々 +亟村 +交久瀬 +交合 +交告 +交告田 +交川 +交易場 +交河 +交田 +交野 +亥ノ坂 +亥ノ瀬 +亥上 +亥下 +亥口 +亥埜 +亥場 +亥子 +亥子田 +亥岡 +亥川 +亥本 +亥瀬 +亥田 +亥角 +亥野 +亥野本 +亥飼 +亦 +亦勝 +亦場 +亦川 +亦平 +亦木 +亦瀬 +亦田 +亦賀 +亦部 +亦野 +亨 +亨丸 +亨保 +亨紺 +享丸 +享保 +享紺 +京 +京ケ島 +京下 +京中 +京久保 +京久野 +京之嶺 +京井 +京仏 +京仲 +京伝 +京住 +京佛 +京保 +京信 +京僧 +京元 +京光 +京免 +京兼 +京円 +京力 +京原 +京口 +京名 +京呂平 +京和 +京和泉 +京地 +京坂 +京堂 +京塚 +京墓 +京増 +京奥 +京宝院 +京家 +京寛 +京寛院 +京寶院 +京小 +京尾 +京尾谷 +京屋 +京山 +京岡 +京峯 +京峰 +京島 +京崎 +京嶋 +京嶌 +京川 +京師 +京平 +京当 +京徳 +京応 +京念 +京念屋 +京戸 +京才 +京本 +京村 +京条 +京松 +京林 +京柄 +京柳 +京桝 +京條 +京森 +京極 +京楽 +京樂 +京橋 +京正 +京武 +京江 +京沢 +京河 +京治 +京泉 +京海 +京深 +京滝 +京澤 +京瀧 +京牟礼 +京牟禮 +京田 +京町 +京當 +京盛 +京相 +京矢 +京石 +京砂 +京空 +京竹 +京籐 +京納 +京紺 +京良 +京菱 +京藤 +京西 +京見 +京角 +京谷 +京近 +京道 +京部 +京郷 +京都 +京野 +京金 +京阪 +京面 +京須 +京馬 +京黒 +亭 +亭島 +亭嶋 +亮 +亰仙 +亰守 +人与 +人丸 +人之間 +人位 +人吉 +人形 +人形寺 +人母 +人瀬 +人目 +人知 +人羅 +人美 +人西 +人見 +人走 +人部 +人里 +人野 +人長 +人長舘 +人首 +人魯 +仁 +仁ケ竹 +仁ノ内 +仁ノ岡 +仁ノ平 +仁ノ木 +仁上 +仁下 +仁串 +仁丹 +仁久丸 +仁久保 +仁井 +仁井元 +仁井内 +仁井出 +仁井原 +仁井名 +仁井山 +仁井岡 +仁井戸 +仁井本 +仁井村 +仁井栄 +仁井田 +仁井見 +仁井谷 +仁井部 +仁井野 +仁介 +仁令 +仁伍 +仁位 +仁佐 +仁佐瀬 +仁保 +仁保島 +仁信 +仁儀 +仁光 +仁児 +仁八 +仁内 +仁分 +仁加保 +仁助 +仁原 +仁口 +仁司 +仁同 +仁吾 +仁和 +仁和寺 +仁和山 +仁和田 +仁品 +仁喜 +仁国 +仁地 +仁坂 +仁垣 +仁城 +仁城寺 +仁士 +仁多 +仁多田 +仁多脇 +仁多見 +仁子 +仁宇 +仁宮 +仁専 +仁尾 +仁尾谷 +仁居 +仁居津 +仁居舎 +仁山 +仁岸 +仁島 +仁崎 +仁川 +仁平 +仁平井 +仁張 +仁後 +仁志 +仁志出 +仁志川 +仁志田 +仁念 +仁成寺 +仁戸 +仁戸田 +仁戸部 +仁手 +仁掛 +仁敷 +仁方越 +仁昌寺 +仁木 +仁木島 +仁本 +仁杉 +仁村 +仁束 +仁林 +仁枝 +仁柿 +仁正寺 +仁歩 +仁比 +仁池 +仁沢 +仁沢瀬 +仁泉 +仁波 +仁浜 +仁浦 +仁添 +仁澤 +仁濱 +仁熊 +仁王 +仁王頭 +仁瓶 +仁田 +仁田原 +仁田坂 +仁田尾 +仁田山 +仁田峠 +仁田水 +仁田畑 +仁田窪 +仁田脇 +仁田野 +仁矢 +仁礼 +仁礼木 +仁神 +仁禮 +仁科 +仁籐 +仁紙 +仁紫 +仁羅山 +仁美 +仁義 +仁羽 +仁興 +仁船 +仁茂田 +仁菅 +仁藤 +仁藤佐 +仁衡 +仁見 +仁規 +仁谷 +仁豊野 +仁賀 +仁賀井 +仁賀奈 +仁賀木 +仁賀田 +仁賀谷 +仁辺 +仁近 +仁連 +仁道 +仁邨 +仁部 +仁部屋 +仁里 +仁野 +仁野平 +仁野村 +仁鎌 +仁開 +仁階? +仁階堂 +仁頃 +仁須賀 +今 +今ケ倉 +今ケ瀬 +今ケ迫 +今一 +今上 +今下 +今丑 +今中 +今丸 +今久 +今久保 +今久留主 +今井 +今井尻 +今井崎 +今井松 +今井田 +今井野 +今仁 +今代 +今仲 +今任 +今伊 +今住 +今來 +今保 +今俣 +今倉 +今儀 +今億 +今元 +今光 +今入 +今八幡 +今兼 +今内 +今冨 +今冶 +今出 +今出川 +今出来 +今出水 +今分 +今別 +今別府 +今利 +今前田 +今勝 +今北 +今南 +今原 +今口 +今古川 +今古賀 +今吉 +今吹 +今和泉 +今咲 +今喜多 +今喜夛 +今国 +今國 +今園 +今土 +今在 +今在家 +今地 +今坂 +今垣 +今垣内 +今城 +今埜 +今堀 +今堂 +今場 +今塚 +今塩 +今塩屋 +今増 +今多 +今大地 +今大路 +今奈良 +今奥 +今子 +今安 +今定 +今実 +今室 +今宮 +今家 +今宿 +今富 +今實 +今寺 +今小路 +今尾 +今居 +今屋 +今屋敷 +今山 +今岡 +今岸 +今峯 +今峰 +今島 +今崎 +今嵐 +今嵜 +今嶋 +今嶌 +今川 +今市 +今市屋 +今帰仁 +今幡 +今平 +今幾多 +今広 +今庄 +今府 +今度 +今庭 +今康 +今廣 +今弘 +今待 +今後 +今徳 +今成 +今戸 +今房 +今手 +今掘 +今掛 +今政 +今敷 +今新 +今方 +今明 +今春 +今時 +今朝丸 +今朝戸 +今朝洞 +今朝田 +今朝石 +今木 +今木屋 +今木田 +今末 +今本 +今杉 +今村 +今来 +今来田 +今東 +今松 +今林 +今枝 +今柄 +今柳 +今柳田 +今柴 +今栄 +今栖 +今桃 +今桐 +今條 +今森 +今植 +今榮 +今樫 +今橋 +今次 +今正 +今武 +今氏 +今水 +今水流 +今永 +今江 +今池 +今沢 +今河 +今治 +今治具 +今沼 +今泉 +今波 +今津 +今津屋 +今津谷 +今洲 +今浜 +今浦 +今浪 +今海 +今淵 +今清水 +今渕 +今渡 +今湊 +今満 +今溝 +今滝 +今滿 +今澄 +今澤 +今濱 +今瀧 +今瀬 +今熊 +今牛 +今牧 +今状 +今獅々 +今玉利 +今用 +今田 +今田中 +今田屋 +今町 +今畑 +今留 +今畠 +今畠中 +今登 +今白 +今盛 +今矢 +今知 +今石 +今碇 +今磯 +今社 +今神 +今福 +今禰 +今秋 +今積 +今窪 +今立 +今端 +今竹 +今筋 +今筒 +今糸 +今納 +今紺 +今紺谷 +今給黎 +今美 +今義 +今脇 +今舗 +今花 +今若 +今荘 +今葷倍 +今蔵 +今蔵屋 +今薗 +今薩 +今薬師 +今藏 +今藤 +今行 +今西 +今見 +今見堂 +今角 +今記 +今諏訪 +今谷 +今貝 +今越 +今辻 +今込 +今迫 +今道 +今達 +今邑 +今邨 +今郡 +今部 +今郷 +今酒 +今里 +今重 +今野 +今野谷 +今金 +今釘 +今釜 +今針山 +今鉾 +今銀 +今長 +今長谷 +今門 +今間 +今関 +今關 +今阪 +今隈 +今雪 +今鞍 +今須 +今須賀 +今頭 +今飯田 +今馳 +今駒 +今高 +今鶴 +今鷹 +今鹿倉 +介中 +介山 +介川 +介弘 +介田 +介見 +仏 +仏下 +仏井 +仏京 +仏光 +仏具 +仏円 +仏前 +仏原 +仏器 +仏園 +仏圓 +仏坂 +仏姓 +仏子 +仏山 +仏峠 +仏島 +仏崎 +仏川 +仏師田 +仏常 +仏性 +仏明 +仏木 +仏本 +仏淵 +仏渕 +仏生 +仏田 +仏石 +仏谷 +仏願 +仕入 +仕切 +仕合 +仕名野 +仕垣 +仕子 +仕平 +仕幸 +仕明 +仕田 +仕田中 +仕田原 +仕立 +仕舘 +仕藤 +仕道 +仕館 +仕黒 +他中 +他力 +他力野 +他屋 +他村 +他田 +他谷 +他阿呉 +付城 +付岡 +付田 +付附 +仙 +仙ノ木 +仙丁 +仙丸 +仙之木 +仙井 +仙人 +仙仁 +仙代 +仙保 +仙倉 +仙元 +仙光 +仙入 +仙内 +仙北 +仙北屋 +仙北谷 +仙原 +仙台 +仙台谷 +仙名 +仙国 +仙國 +仙土 +仙坂 +仙坊 +仙城 +仙場 +仙太 +仙宅 +仙島 +仙崎 +仙川 +仙幸 +仙度 +仙座 +仙庭 +仙当 +仙徳 +仙才 +仙敷 +仙斉 +仙斎 +仙月 +仙木 +仙本 +仙村 +仙林 +仙柳 +仙次 +仙水 +仙沢 +仙河 +仙波 +仙洞田 +仙浪 +仙海 +仙済 +仙澤 +仙田 +仙田山 +仙石 +仙福 +仙立 +仙納 +仙臺 +仙花 +仙葉 +仙藤 +仙誉 +仙譽 +仙谷 +仙貫 +仙賀 +仙道 +仙達 +仙部 +仙野 +仙長 +仙防 +仙頭 +仙題 +仙黒 +仙齋 +代 +代々 +代々城 +代々木 +代久 +代住 +代倉 +代元 +代入 +代口 +代古 +代名 +代喜 +代場 +代宮司 +代居 +代山 +代島 +代崎 +代嶋 +代工 +代市 +代情 +代慶 +代木 +代末 +代本 +代次 +代永 +代田 +代畑 +代継 +代美原 +代花 +代蔵 +代見 +代谷 +代財 +代重 +代野 +代長 +代門 +代阪 +代高田 +以ケ本 +以久井 +以倉 +以元 +以内 +以勢 +以南 +以呂免 +以後 +以後崎 +以後田 +以手井 +以田貝 +以登田 +以西 +以野上 +以須野 +以頭 +仮 +仮上 +仮井 +仮元 +仮名 +仮名田 +仮坂 +仮家 +仮宿 +仮屋 +仮屋原 +仮屋園 +仮屋山 +仮屋崎 +仮屋瀬 +仮屋田 +仮屋薗 +仮山 +仮戸 +仮本 +仮水 +仮沢 +仮澤 +仮田 +仮畠 +仮薗 +仮谷 +仮谷川 +仮込 +仮道 +仮重 +仮野 +仰 +仰倉 +仰山 +仰木 +仲 +仲三河 +仲上 +仲上里 +仲上門 +仲下 +仲与志 +仲与根 +仲世 +仲世古 +仲丸 +仲主 +仲久保 +仲久木 +仲亀 +仲二見 +仲井 +仲井眞 +仲井真 +仲井間 +仲仁谷 +仲代 +仲伊部 +仲伏 +仲住 +仲佐 +仲保 +仲信 +仲俣 +仲倉 +仲側 +仲儀 +仲元 +仲元寺 +仲光 +仲兼 +仲兼久 +仲内 +仲冨 +仲出 +仲出川 +仲利 +仲前 +仲前門 +仲北 +仲北浦 +仲升 +仲南 +仲原 +仲又 +仲口 +仲古 +仲古谷 +仲台 +仲吉 +仲唐 +仲問 +仲喜 +仲嘉 +仲噌 +仲地 +仲坂 +仲垣 +仲垣内 +仲城 +仲埜 +仲堀 +仲塚 +仲増 +仲大 +仲大嶺 +仲大底 +仲大盛 +仲太 +仲奥 +仲妻 +仲子 +仲字根 +仲宇佐 +仲安 +仲宗 +仲宗根 +仲宮 +仲家 +仲富 +仲小路 +仲尾 +仲尾次 +仲居 +仲屋 +仲山 +仲岡 +仲岩 +仲岸 +仲峯 +仲峰 +仲島 +仲崎 +仲嵜 +仲嵩 +仲嶋 +仲嶌 +仲嶺 +仲川 +仲市 +仲平 +仲平良 +仲底 +仲座 +仲庭 +仲後 +仲得 +仲徳盛 +仲志茂 +仲戸 +仲戸川 +仲手川 +仲才 +仲持 +仲摩 +仲敷 +仲斉 +仲新城 +仲新門 +仲智 +仲曽 +仲曽根 +仲曾 +仲曾根 +仲木 +仲本 +仲杉 +仲村 +仲村柄 +仲村渠 +仲条 +仲東 +仲松 +仲林 +仲枡 +仲柴 +仲栄 +仲栄眞 +仲栄真 +仲根 +仲桃原 +仲桐 +仲桝 +仲條 +仲森 +仲植 +仲榮眞 +仲榮真 +仲橋 +仲次 +仲正 +仲正路 +仲武 +仲氏 +仲永 +仲求 +仲江 +仲江川 +仲江間 +仲池 +仲沢 +仲河 +仲治 +仲沼 +仲泉 +仲泊 +仲波 +仲波名 +仲津 +仲津留 +仲浜 +仲浦 +仲渡 +仲澤 +仲濱 +仲瀬 +仲玉栄 +仲玉榮 +仲田 +仲由 +仲町 +仲畑 +仲畠 +仲白保 +仲皿 +仲盛 +仲眞 +仲眞次 +仲真 +仲真次 +仲矢 +仲知 +仲石 +仲磨 +仲神 +仲祢 +仲秋 +仲程 +仲窪 +仲立 +仲筋 +仲築間 +仲篠 +仲米 +仲納林 +仲絵 +仲義 +仲肥 +仲臺 +仲與根 +仲舎 +仲舘 +仲舛 +仲舟井 +仲若 +仲葉 +仲薮 +仲藤 +仲藪 +仲行 +仲衛 +仲表 +仲西 +仲見 +仲見川 +仲角 +仲谷 +仲谷内 +仲財 +仲路 +仲辻 +仲道 +仲達 +仲邑 +仲邨 +仲部 +仲里 +仲重 +仲野 +仲野内 +仲野谷 +仲野間 +仲鉢 +仲長 +仲門 +仲間 +仲順 +仲須 +仲館 +仲馬 +仲高 +仲麻 +仲黒島 +仲𡌛 +任 +任介 +任勢 +任堂 +任海 +任田 +任補 +任那 +任都栗 +企救岳 +伊 +伊々田 +伊カ谷 +伊ケ崎 +伊ケ谷 +伊セ崎 +伊ノ上 +伊ノ木 +伊ヵ崎 +伊万里 +伊三木 +伊三部 +伊三野 +伊上 +伊下 +伊下田 +伊与 +伊与久 +伊与喜 +伊与政 +伊与木 +伊与森 +伊与泉 +伊与田 +伊与部 +伊世 +伊世井 +伊世原 +伊世崎 +伊世谷 +伊並 +伊中 +伊串 +伊丸 +伊丸岡 +伊丹 +伊丹屋 +伊丹川 +伊丹谷 +伊久 +伊久山 +伊久留 +伊久美 +伊久良 +伊久見 +伊久身 +伊久間 +伊之井 +伊之口 +伊之坂 +伊之沢 +伊之澤 +伊之脇 +伊了部 +伊予 +伊予屋 +伊予岡 +伊予島 +伊予木 +伊予本 +伊予永 +伊予田 +伊予谷 +伊予部 +伊予隅 +伊五沢 +伊五澤 +伊井 +伊井埜 +伊井島 +伊井沢 +伊井澤 +伊井田 +伊井谷 +伊井野 +伊介 +伊代 +伊代住 +伊代田 +伊代野 +伊仲 +伊伏 +伊伝 +伊住 +伊佐 +伊佐冶 +伊佐名 +伊佐地 +伊佐坂 +伊佐山 +伊佐岡 +伊佐川 +伊佐敷 +伊佐早 +伊佐木 +伊佐杯 +伊佐次 +伊佐治 +伊佐津 +伊佐田 +伊佐美 +伊佐芹 +伊佐藤 +伊佐見 +伊佐路 +伊佐野 +伊佐間 +伊佐馬 +伊作 +伊作川 +伊來 +伊保 +伊保内 +伊保木 +伊保橋 +伊保谷 +伊倉 +伊傳 +伊儀 +伊元 +伊内 +伊冨貴 +伊出 +伊出井 +伊出口 +伊利 +伊前 +伊加 +伊加井 +伊加利 +伊加田 +伊加畠 +伊勢 +伊勢ノ海 +伊勢上 +伊勢亀 +伊勢井 +伊勢元 +伊勢出 +伊勢加 +伊勢原 +伊勢呂 +伊勢地 +伊勢坊 +伊勢垣 +伊勢城 +伊勢塚 +伊勢家 +伊勢居 +伊勢屋 +伊勢山 +伊勢岡 +伊勢島 +伊勢崎 +伊勢嶋 +伊勢川 +伊勢戸 +伊勢木 +伊勢本 +伊勢村 +伊勢根 +伊勢森 +伊勢沢 +伊勢津 +伊勢浜 +伊勢海 +伊勢澤 +伊勢濱 +伊勢田 +伊勢知 +伊勢福 +伊勢脇 +伊勢谷 +伊勢路 +伊勢野 +伊勢間 +伊勢馬場 +伊千 +伊南 +伊卷 +伊原 +伊原木 +伊原組 +伊取 +伊口 +伊古 +伊古田 +伊古美 +伊古野 +伊台 +伊吉 +伊名 +伊名岡 +伊名波 +伊名田 +伊名野 +伊君 +伊吹 +伊吹山 +伊吾多 +伊吾田 +伊呂原 +伊呂波 +伊和 +伊咲 +伊善 +伊喜 +伊喜利 +伊喜見 +伊園 +伊土 +伊在丸 +伊在井 +伊地 +伊地山 +伊地智 +伊地田 +伊地知 +伊坂 +伊坪 +伊垢離 +伊垣 +伊城 +伊埜山 +伊埜谷 +伊堀 +伊堂 +伊堂寺 +伊場 +伊場田 +伊場野 +伊塚 +伊墻 +伊壷 +伊壺 +伊多 +伊多倉 +伊多波 +伊大知 +伊夫伎 +伊夫気 +伊夫氣 +伊夫貴 +伊奈 +伊奈井 +伊奈垣 +伊奈山 +伊奈岡 +伊奈川 +伊奈田 +伊奈葉 +伊奈見 +伊奈野 +伊奥 +伊妻 +伊子 +伊守 +伊宝 +伊宝田 +伊室 +伊宮 +伊家 +伊家村 +伊寄 +伊富 +伊富喜 +伊富貴 +伊寳 +伊寳田 +伊寶 +伊寿 +伊小萩 +伊尻 +伊尾 +伊尾喜 +伊尾木 +伊尾瀬 +伊尾知 +伊屋ケ迫 +伊屯 +伊山 +伊岐 +伊岐見 +伊岡 +伊岡森 +伊島 +伊崎 +伊崎田 +伊嵜 +伊嶋 +伊嶌 +伊川 +伊左 +伊左次 +伊左治 +伊差 +伊差川 +伊巻 +伊師 +伊帳田 +伊平 +伊座 +伊座並 +伊庭 +伊庭本 +伊庭野 +伊延 +伊弉末 +伊形 +伊後 +伊徒 +伊従 +伊得 +伊從 +伊徳 +伊徳田 +伊志井 +伊志伊 +伊志原 +伊志峰 +伊志嶺 +伊志川 +伊志田 +伊志良 +伊成 +伊戸 +伊戸川 +伊戸松 +伊戸田 +伊手 +伊才 +伊折 +伊掛 +伊政 +伊故海 +伊敷 +伊斎田 +伊方 +伊早坂 +伊早阪 +伊星 +伊是名 +伊時 +伊智 +伊智地 +伊曽乃 +伊月 +伊木 +伊木原 +伊木田 +伊木美 +伊本 +伊材 +伊村 +伊来 +伊東 +伊東山 +伊林 +伊柳 +伊柿 +伊根 +伊桐 +伊桜 +伊森 +伊槻 +伊橋 +伊櫻 +伊次 +伊欲 +伊武 +伊比 +伊比井 +伊比礼 +伊比禮 +伊民 +伊永 +伊江 +伊池 +伊沢 +伊治 +伊沼 +伊泉 +伊泊 +伊法 +伊波 +伊波山 +伊波川 +伊津 +伊津井 +伊津本 +伊津村 +伊津田 +伊津美 +伊津見 +伊津野 +伊浅 +伊浜 +伊浦 +伊浪 +伊海 +伊海田 +伊深 +伊淵 +伊添 +伊清 +伊渕 +伊渡村 +伊澤 +伊濱 +伊瀬 +伊瀬地 +伊瀬知 +伊瀬谷 +伊熊 +伊牆 +伊牟田 +伊狩 +伊玉 +伊王野 +伊理 +伊瓶 +伊生 +伊田 +伊田屋 +伊田山 +伊町 +伊畑 +伊登 +伊皆 +伊盛 +伊相 +伊矢田 +伊矢野 +伊知地 +伊知川 +伊石 +伊砂 +伊礼 +伊礼泊 +伊礼門 +伊祁 +伊神 +伊福 +伊福屋 +伊福部 +伊禮 +伊禮泊 +伊禮門 +伊秩 +伊積 +伊窪 +伊竜 +伊端 +伊竹 +伊笠 +伊笹 +伊築 +伊籐 +伊糸 +伊納 +伊組 +伊縫 +伊織 +伊羅子 +伊羅沢 +伊羅胡 +伊美 +伊能 +伊能勢 +伊脇 +伊臣 +伊與 +伊與久 +伊與政 +伊與木 +伊與森 +伊與泉 +伊與田 +伊與部 +伊興 +伊興木 +伊興田 +伊舎堂 +伊舎良 +伊舘 +伊舟城 +伊良 +伊良原 +伊良子 +伊良波 +伊良皆 +伊良知 +伊良部 +伊花 +伊芸 +伊苅 +伊茂 +伊茂治 +伊茂野 +伊草 +伊荻 +伊菅 +伊萬里 +伊落 +伊葉 +伊蔵 +伊藝 +伊藤 +伊藤寺 +伊藤田 +伊蘇 +伊西 +伊西口 +伊覇 +伊見 +伊規 +伊規須 +伊角 +伊計 +伊記 +伊調 +伊谷 +伊谷只 +伊谷野 +伊豆 +伊豆上 +伊豆丸 +伊豆井 +伊豆倉 +伊豆元 +伊豆内 +伊豆原 +伊豆名 +伊豆味 +伊豆山 +伊豆岡 +伊豆島 +伊豆嶋 +伊豆川 +伊豆本 +伊豆村 +伊豆橋 +伊豆永 +伊豆沢 +伊豆津 +伊豆浦 +伊豆澤 +伊豆田 +伊豆葉 +伊豆蔵 +伊豆藏 +伊豆見 +伊豆谷 +伊豆賀 +伊豆野 +伊豫 +伊豫屋 +伊豫岡 +伊豫木 +伊豫本 +伊豫永 +伊豫田 +伊豫谷 +伊豫部 +伊豫隅 +伊貝 +伊財 +伊貸 +伊賀 +伊賀上 +伊賀並 +伊賀井 +伊賀倉 +伊賀利 +伊賀原 +伊賀奈 +伊賀屋 +伊賀山 +伊賀崎 +伊賀川 +伊賀敷 +伊賀本 +伊賀松 +伊賀棒 +伊賀瀬 +伊賀田 +伊賀美 +伊賀良 +伊賀谷 +伊賀道 +伊賀野 +伊路見 +伊輪 +伊輿 +伊輿田 +伊辺 +伊辻 +伊迫 +伊通 +伊逹 +伊達 +伊達山 +伊達岡 +伊達崎 +伊達川 +伊達木 +伊達田 +伊達道 +伊達野 +伊邉 +伊邊 +伊那 +伊部 +伊郷 +伊都 +伊里 +伊里山 +伊里院 +伊野 +伊野上 +伊野並 +伊野前 +伊野勢 +伊野原 +伊野口 +伊野塚 +伊野宮 +伊野家 +伊野尾 +伊野木 +伊野本 +伊野波 +伊野瀬 +伊野田 +伊野谷 +伊野部 +伊鍋 +伊鍔 +伊関 +伊關 +伊阪 +伊阿弥 +伊阿彌 +伊集 +伊集田 +伊集院 +伊青 +伊音 +伊須 +伊須原 +伊須田 +伊頭 +伊飼 +伊香 +伊香賀 +伊香輪 +伊香間 +伊駒 +伊高 +伊鶴 +伊鹿倉 +伊黒 +伊齋田 +伊龍 +伍々 +伍上 +伍井 +伍代 +伍十川 +伍堂 +伍島 +伍嶋 +伍東 +伍楼 +伍樓 +伍用 +伍田 +伍石 +伍藤 +伍賀 +伍香 +伏 +伏下 +伏中 +伏井 +伏代 +伏信 +伏原 +伏喜 +伏場 +伏塚 +伏多 +伏婦 +伏尾 +伏居 +伏屋 +伏山 +伏岡 +伏岩 +伏島 +伏崎 +伏嵜 +伏嶋 +伏川 +伏平 +伏春 +伏木 +伏木田 +伏木野 +伏本 +伏村 +伏栗 +伏根 +伏水 +伏江 +伏津 +伏浦 +伏田 +伏石 +伏脇 +伏葉 +伏西 +伏見 +伏見屋 +伏見谷 +伏谷 +伏貫 +伏部内 +伏里 +伏野 +伏間 +伏間江 +伏鹿 +伏黒 +伐分 +伐山 +伐明 +伐栗 +休 +休万 +休井 +休位 +休坂 +休堂 +休場 +休塲 +休宮 +休山 +休庭 +休徳 +休性 +休斉 +休斎 +休束 +休波 +休田 +休石 +休萬 +休見 +休齋 +会 +会下 +会也 +会亀 +会原 +会坂 +会場 +会島 +会崎 +会嶋 +会川 +会所 +会曽川 +会曾川 +会木 +会本 +会森 +会沢 +会津 +会澤 +会田 +会町 +会笠 +会見 +会谷 +会退 +会野 +会順 +伝 +伝並 +伝井 +伝代 +伝住 +伝佐 +伝保 +伝内 +伝刀 +伝四 +伝地多 +伝坂 +伝城 +伝宝 +伝崎 +伝川 +伝平 +伝幸 +伝庄 +伝明地 +伝明寺 +伝村 +伝条 +伝條 +伝江 +伝法 +伝法寺 +伝法谷 +伝甫 +伝田 +伝石 +伝福 +伝羽 +伝能 +伝藤 +伝見 +伝谷 +伝農 +伝道 +伝里 +伝野 +伝長 +伝須 +伝馬 +伯 +伯々上 +伯ケ部 +伯井 +伯儀 +伯山 +伯川 +伯方 +伯木 +伯本 +伯母 +伯水 +伯田 +伯美 +伯耆 +伯耆原 +伯耆田 +伯谷 +伯部 +伯野 +估城 +伴 +伴の内 +伴ノ内 +伴丈 +伴中 +伴之内 +伴之木 +伴井 +伴仲 +伴光 +伴内 +伴在 +伴地 +伴城 +伴埜 +伴場 +伴塲 +伴山 +伴島 +伴庭 +伴戸 +伴木 +伴林 +伴根地 +伴治 +伴流 +伴海 +伴瀬 +伴瑞 +伴田 +伴登 +伴能 +伴苗 +伴蔵 +伴藤 +伴谷 +伴辺 +伴道 +伴邪 +伴野 +伸 +伸井 +伸居 +伸沢 +伸澤 +伸田 +伸藤 +伹井 +伹住 +伹吉 +伹尾 +伹川 +伹木 +伹本 +伹田 +伹見 +伹野 +伹馬 +似内 +似吹 +似田 +似田代 +似田貝 +似里 +似鳥 +伽羅 +伽羅谷 +伽藍 +伽賀 +佃 +佃井 +佃屋 +佃田 +佃谷 +佃野 +但中 +但丸 +但井 +但住 +但吉 +但尾 +但岡 +但島 +但川 +但木 +但本 +但村 +但田 +但見 +但野 +但馬 +佇 +位 +位ノ花 +位上 +位下 +位並 +位原 +位古 +位地 +位坂 +位守 +位寄 +位島 +位崎 +位川 +位本 +位田 +位藤 +位部 +位野木 +位野花 +位頭 +位飼 +位高 +低引 +低田 +住 +住ノ井 +住ノ江 +住上 +住下 +住中 +住久 +住之江 +住井 +住佐 +住信 +住倉 +住元 +住内 +住出 +住原 +住友 +住口 +住司 +住吉 +住吉屋 +住吉山 +住吉谷 +住和 +住坂 +住垣 +住大 +住奥 +住好 +住宅 +住安 +住定 +住宮 +住家 +住寄 +住尾 +住居 +住屋 +住山 +住岡 +住岡田 +住崎 +住川 +住平 +住広 +住廣 +住得 +住徳 +住忠 +住成 +住戸 +住所 +住明 +住木 +住本 +住村 +住松 +住林 +住枝 +住栄 +住森 +住榮 +住母家 +住永 +住江 +住沢 +住浜 +住浦 +住浪 +住添 +住清 +住澤 +住瀬 +住田 +住田谷 +住畑 +住畠 +住登 +住相 +住矢 +住石 +住福 +住羽地 +住脇 +住舎 +住若 +住藤 +住谷 +住貞 +住路 +住辻 +住近 +住連川 +住連木 +住里 +住重 +住野 +住野谷 +住金 +住釜 +住鞆 +住香 +住駒 +住高 +佐 +佐々 +佐々並 +佐々中 +佐々井 +佐々倉 +佐々内 +佐々利 +佐々原 +佐々口 +佐々城 +佐々塚 +佐々士 +佐々家 +佐々尾 +佐々山 +佐々岡 +佐々島 +佐々崎 +佐々川 +佐々市 +佐々布 +佐々木 +佐々木原 +佐々本 +佐々村 +佐々松 +佐々森 +佐々江 +佐々治 +佐々波 +佐々浦 +佐々浪 +佐々生 +佐々田 +佐々畑 +佐々知 +佐々竹 +佐々繁 +佐々良 +佐々葉 +佐々藤 +佐々見 +佐々谷 +佐々貴 +佐々辺 +佐々邉 +佐々邊 +佐々部 +佐々重 +佐々野 +佐々門 +佐々間 +佐ケ山 +佐ケ野 +佐ツ々 +佐ノ川谷 +佐ノ木 +佐上 +佐下 +佐下橋 +佐下谷 +佐世 +佐世川 +佐中 +佐丸 +佐久 +佐久井 +佐久保 +佐久原 +佐久名 +佐久山 +佐久島 +佐久嶋 +佐久川 +佐久本 +佐久田 +佐久盛 +佐久目 +佐久眞 +佐久真 +佐久知 +佐久網 +佐久美 +佐久良 +佐久見 +佐久野 +佐久間 +佐久馬 +佐之井 +佐之瀬 +佐事 +佐二木 +佐井 +佐井川 +佐井木 +佐井熊 +佐井田 +佐井藤 +佐井賀 +佐井門 +佐京 +佐今 +佐仮 +佐仲 +佐份利 +佐伊 +佐伍 +佐伝 +佐伯 +佐伯部 +佐伽羅 +佐住 +佐佐 +佐佐布 +佐佐木 +佐佐田 +佐來 +佐保 +佐保井 +佐保城 +佐保埜 +佐保山 +佐保川 +佐保田 +佐保野 +佐信 +佐俣 +佐倉 +佐倉井 +佐倉崎 +佐倉永 +佐倉田 +佐倉谷 +佐元 +佐光 +佐八 +佐内 +佐円 +佐冶 +佐出 +佐分 +佐分利 +佐別当 +佐別當 +佐前 +佐加 +佐加井 +佐加伊 +佐加良 +佐加野 +佐南 +佐南谷 +佐原 +佐双 +佐取 +佐口 +佐古 +佐古下 +佐古井 +佐古口 +佐古尾 +佐古山 +佐古岡 +佐古川 +佐古本 +佐古田 +佐古藤 +佐古谷 +佐古野 +佐可野 +佐右田 +佐司 +佐合 +佐合井 +佐同 +佐名 +佐名川 +佐名手 +佐名木 +佐名田 +佐向 +佐周原 +佐味 +佐味川 +佐味谷 +佐和 +佐和山 +佐和橋 +佐和田 +佐善 +佐喜 +佐喜本 +佐喜眞 +佐喜真 +佐喜間 +佐嘉 +佐嘉伊 +佐嘉田 +佐囲東 +佐国 +佐國 +佐園 +佐圓 +佐土 +佐土下 +佐土井 +佐土原 +佐土島 +佐土嶋 +佐土平 +佐土根 +佐土瀬 +佐土谷 +佐地 +佐坂 +佐垣 +佐城 +佐埜 +佐堀 +佐堂 +佐場 +佐場野 +佐塚 +佐増 +佐多 +佐多家 +佐多平 +佐多浦 +佐多賀 +佐大路 +佐太 +佐太木 +佐太留 +佐奈 +佐奈喜 +佐奈木 +佐奈田 +佐子 +佐子山 +佐子川 +佐子田 +佐孝 +佐守 +佐宗 +佐官 +佐定 +佐室 +佐宮 +佐寄 +佐小 +佐小田 +佐少 +佐尾 +佐尾山 +佐居 +佐居東 +佐屋 +佐山 +佐岡 +佐峠 +佐島 +佐崇 +佐崎 +佐嵜 +佐嶋 +佐嶌 +佐川 +佐川田 +佐巴勢 +佐巻 +佐布 +佐師 +佐平 +佐幸 +佐幸田 +佐広 +佐度 +佐座 +佐廣 +佐式 +佐当 +佐形 +佐後 +佐復 +佐志 +佐志原 +佐志田 +佐応 +佐怒賀 +佐想 +佐成 +佐成屋 +佐我 +佐戸 +佐戸井 +佐戸口 +佐戸川 +佐戸谷 +佐手 +佐才 +佐折 +佐抜 +佐拔 +佐持 +佐掘 +佐故 +佐敷 +佐敷屋 +佐文 +佐斉 +佐斎 +佐方 +佐星 +佐是 +佐曽 +佐曽利 +佐曽木 +佐曽田 +佐曽羅 +佐曽谷 +佐曾利 +佐曾谷 +佐替 +佐木 +佐木山 +佐木崎 +佐木川 +佐木森 +佐木田 +佐末 +佐本 +佐村 +佐村木 +佐村河内 +佐村田 +佐条 +佐来 +佐東 +佐松 +佐林 +佐枝 +佐枝藤 +佐柄 +佐柄木 +佐柳 +佐柿 +佐根 +佐桐 +佐桑 +佐梁 +佐條 +佐棟 +佐森 +佐楢見 +佐槁 +佐樹 +佐橋 +佐橘 +佐次 +佐次川 +佐次本 +佐次清 +佐次田 +佐武 +佐段田 +佐比内 +佐毘 +佐氏 +佐水 +佐永 +佐永田 +佐江 +佐江木 +佐江田 +佐沢 +佐河 +佐治 +佐治木 +佐沼 +佐波 +佐波古 +佐波瀬 +佐泻 +佐津 +佐津川 +佐津間 +佐浦 +佐海 +佐渕 +佐渡 +佐渡原 +佐渡友 +佐渡屋 +佐渡山 +佐渡島 +佐渡嶋 +佐渡川 +佐渡本 +佐渡村 +佐渡谷 +佐湖 +佐源太 +佐源田 +佐溝 +佐滝 +佐潟 +佐澤 +佐濃 +佐瀉 +佐瀧 +佐瀬 +佐瀬部 +佐為 +佐無田 +佐熊 +佐片 +佐牟田 +佐狐 +佐理伴 +佐生 +佐用 +佐用谷 +佐田 +佐田久 +佐田元 +佐田友 +佐田国 +佐田國 +佐田富 +佐田尾 +佐田山 +佐田谷 +佐田野 +佐甲 +佐畑 +佐畠 +佐當 +佐登 +佐目 +佐直 +佐相 +佐矢 +佐矢本 +佐矢野 +佐知 +佐礼尾 +佐神 +佐禮尾 +佐穂 +佐立 +佐竹 +佐竹田 +佐等 +佐管 +佐築 +佐篠 +佐籐 +佐粧 +佐糠 +佐糸 +佐納 +佐紺 +佐縁馬 +佐織 +佐織田 +佐美 +佐美三 +佐義 +佐義名 +佐羽 +佐羽内 +佐羽尾 +佐羽根 +佐耒 +佐股 +佐能 +佐脇 +佐臼 +佐舖 +佐舗 +佐舘 +佐良 +佐良土 +佐良家 +佐良木 +佐茂 +佐草 +佐荘 +佐菅 +佐蔵 +佐薙 +佐藏 +佐藤 +佐藤山 +佐藤根 +佐藤沢 +佐藤澤 +佐衛田 +佐衞田 +佐西 +佐見 +佐見津 +佐見田 +佐護 +佐谷 +佐谷口 +佐谷戸 +佐谷野 +佐貝 +佐貫 +佐貫田 +佐賀 +佐賀井 +佐賀原 +佐賀山 +佐賀岡 +佐賀川 +佐賀木 +佐賀村 +佐賀枝 +佐賀根 +佐賀田 +佐賀美 +佐賀良 +佐賀見 +佐賀里 +佐賀野 +佐賀関 +佐越 +佐路 +佐軒 +佐農 +佐辺 +佐近 +佐近田 +佐迫間 +佐通 +佐道 +佐達 +佐違 +佐邉 +佐邊 +佐那川 +佐郡 +佐部 +佐部利 +佐部田 +佐郷 +佐郷屋 +佐郷谷 +佐野 +佐野倉 +佐野内 +佐野口 +佐野坂 +佐野屋 +佐野峯 +佐野峰 +佐野島 +佐野川 +佐野川谷 +佐野木 +佐野本 +佐野村 +佐野棟 +佐野瀬 +佐野田 +佐野町 +佐野間 +佐金 +佐鋪 +佐長 +佐長谷 +佐門 +佐間 +佐間山 +佐間田 +佐間野 +佐阪 +佐隈 +佐雙 +佐鞍 +佐須 +佐須田 +佐須見 +佐飛 +佐館 +佐香 +佐馬 +佐馬野 +佐高 +佐鯉 +佐鳥 +佐鹿 +佐齊 +佑 +佑川 +体岡 +体阿弥 +体阿彌 +何 +何原 +何吉 +何川 +何左 +何木 +何本 +何東 +何松 +何森 +何沢 +何澤 +何盛 +何谷 +何輪 +佗美 +余久保 +余井 +余伍 +余伝 +余保 +余傅 +余傳 +余公 +余利 +余利野 +余力 +余助 +余原 +余合 +余吾 +余呉 +余喜多 +余地 +余増 +余多分 +余宮 +余家 +余山 +余島 +余崎 +余嵜 +余嶋 +余川 +余平 +余平名 +余座 +余志村 +余悟 +余慶 +余戸 +余所地 +余木 +余木元 +余村 +余根田 +余桝 +余水 +余永 +余江 +余沢 +余河 +余海 +余湖 +余瀬 +余田 +余百 +余目 +余米 +余縄 +余膳 +余舛 +余茂田 +余西 +余語 +余谷 +余財 +余越 +余部 +余郷 +余里 +余野 +余野木 +余野部 +余門 +余間 +余頃 +余黒 +佛 +佛下 +佛井 +佛京 +佛具 +佛円 +佛原 +佛圓 +佛坂 +佛姓 +佛子 +佛山 +佛峠 +佛島 +佛崎 +佛川 +佛師 +佛師田 +佛常 +佛性 +佛明 +佛木 +佛本 +佛淵 +佛渕 +佛生 +佛田 +佛石 +佛華 +佛谷 +佛願 +作 +作々 +作ケ平 +作下 +作並 +作中 +作久 +作久本 +作久間 +作井 +作伯 +作佐辺 +作佐部 +作保 +作俵 +作倉 +作元 +作内 +作出 +作前 +作原 +作取 +作古 +作台 +作吉 +作地 +作城 +作埜 +作場 +作増 +作守 +作宮 +作家 +作尾 +作屋 +作山 +作岡 +作島 +作嶋 +作川 +作左部 +作平 +作広 +作意 +作才 +作本 +作村 +作林 +作栄 +作森 +作榮 +作次 +作永 +作江 +作治 +作沼 +作津 +作満 +作澤 +作用 +作田 +作畑 +作畠 +作石 +作磨 +作網 +作美 +作能 +作良 +作花 +作華 +作藤 +作見 +作谷 +作農 +作道 +作部 +作部屋 +作重 +作野 +作長 +作間 +作阿弥 +作馬 +佩川 +佱元 +佳 +佳久 +佳倉 +佳元 +佳冨 +佳富 +佳山 +佳岡 +佳島 +佳川 +佳本 +佳村 +佳波 +佳瀬井 +佳田 +佳留 +佳藤木 +佶住 +使村 +來 +來下 +來代 +來住 +來住野 +來原 +來司 +來女木 +來山 +來島 +來崎 +來嶋 +來摩 +來本 +來村 +來栖 +來栖川 +來條 +來次 +來正 +來海 +來生 +來田 +來福 +來米 +來藤 +來見 +來見田 +來間 +來須 +來馬 +侍園 +侍来 +侍留 +侍金 +侘美 +供保 +供利 +供川 +供村 +供田 +供野 +供長 +依元 +依光 +依兼 +依包 +依吉 +依岡 +依帖 +依怗 +依怙 +依戸 +依斐 +依期 +依木 +依本 +依浮 +依田 +依知川 +依網 +依藤 +依里 +依野木 +依馬 +侭 +侭下 +侭田 +便 +便元 +便田 +俄山 +俄羽 +俉樓 +俊 +俊原 +俊山 +俊岡 +俊崎 +俊成 +俊正 +俊沢 +俊澤 +俊田 +俊藤 +俊道 +俊野 +俊長 +俗多 +保 +保々 +保ケ淵 +保ケ渕 +保ケ辺 +保ケ邊 +保ケ部 +保上 +保下 +保下部 +保世院 +保中 +保久 +保久上 +保久原 +保久村 +保久盛 +保久良 +保井 +保井田 +保仙 +保代 +保位 +保住 +保信 +保倉 +保元 +保光 +保冨 +保冶 +保出 +保刈 +保利 +保利免 +保前 +保勇 +保原 +保友 +保口 +保古 +保司 +保吉 +保名 +保呂 +保呂田 +保呂草 +保喜 +保国 +保國 +保園 +保土 +保土原 +保土塚 +保土山 +保土沢 +保土澤 +保土田 +保地 +保地谷 +保坂 +保垣 +保城 +保堀 +保堂 +保士 +保壽 +保多 +保多田 +保多盛 +保大木 +保子 +保宗 +保宝 +保実 +保室 +保宮 +保家 +保富 +保實 +保寿 +保尊 +保尾 +保居 +保屋 +保屋松 +保屋野 +保山 +保岡 +保島 +保崎 +保嶋 +保川 +保市 +保平 +保広 +保庭 +保延 +保志 +保志名 +保志場 +保志岩 +保志条 +保志野 +保志門 +保恵 +保成 +保戸 +保戸塚 +保戸山 +保戸田 +保房 +保手 +保手浜 +保手濱 +保手田 +保持 +保方 +保日部 +保昌 +保明 +保智 +保曽井 +保曽川 +保曾井 +保曾永 +保月 +保木 +保木下 +保木井 +保木元 +保木口 +保木山 +保木平 +保木本 +保木脇 +保木野 +保本 +保杉 +保村 +保条 +保東 +保松 +保林 +保枝 +保柳 +保栄茂 +保栖 +保格 +保條 +保森 +保楊枝 +保榮茂 +保橋 +保正 +保武 +保母 +保毛 +保毛津 +保気口 +保氣口 +保永 +保江 +保池 +保沢 +保泉 +保洞 +保津 +保浦 +保海 +保清 +保渡山 +保滌 +保澤 +保珍 +保理 +保理江 +保甫 +保田 +保田井 +保田盛 +保登田 +保知 +保知戸 +保礼 +保社 +保福 +保禮 +保科 +保積 +保立 +保竹 +保米本 +保美 +保脇 +保良 +保芦 +保花 +保苅 +保蔵 +保藤 +保西 +保要 +保見 +保角 +保谷 +保谷野 +保賀 +保足 +保路 +保路地 +保迫 +保道 +保達 +保郡 +保都 +保里 +保里川 +保野 +保長 +保間 +保関 +保阪 +保院 +保高 +保黒 +俟野 +信 +信ケ原 +信上 +信下 +信中 +信乃 +信久 +信井 +信伊奈 +信佐 +信作 +信保 +信元 +信免 +信兼 +信包 +信原 +信友 +信吉 +信国 +信國 +信坂 +信垣 +信塚 +信多 +信太 +信夫 +信好 +信安 +信宗 +信定 +信実 +信宮 +信家 +信實 +信尾 +信居 +信山 +信岡 +信岩 +信島 +信崎 +信嶋 +信川 +信常 +信平 +信広 +信廣 +信恵 +信成 +信戸 +信房 +信政 +信方 +信明 +信時 +信朝 +信木 +信末 +信本 +信村 +信東 +信松 +信枝 +信根 +信桜 +信森 +信楽 +信樂 +信櫻 +信次 +信正 +信武 +信歳 +信殿 +信氏 +信永 +信江 +信沢 +信治 +信海 +信清 +信澤 +信濃 +信濃小路 +信濃屋 +信濃川 +信瀬 +信田 +信畑 +信砂 +信秋 +信種 +信竜 +信組 +信耀 +信耕 +信藤 +信行 +信西 +信谷 +信貞 +信貴 +信貴野 +信賀 +信近 +信迫 +信達 +信達谷 +信部 +信里 +信重 +信野 +信金 +信長 +信開 +信隆 +信頭 +信高 +信龍 +俣 +俣倉 +俣塚 +俣妻 +俣山 +俣岡 +俣島 +俣崎 +俣嶋 +俣川 +俣平 +俣摩 +俣木 +俣本 +俣村 +俣江 +俣沢 +俣溝 +俣瀬 +俣田 +俣見 +俣賀 +俣野 +修善寺 +修多羅 +修家 +修山 +修本 +修業 +修理 +修理田 +修田 +修繕寺 +修行 +俳 +俵 +俵上 +俵井 +俵元 +俵内 +俵原 +俵口 +俵地 +俵坂 +俵家 +俵屋 +俵山 +俵崎 +俵川 +俵木 +俵本 +俵本谷 +俵森 +俵満 +俵田 +俵町 +俵畑 +俵盛 +俵矢 +俵石 +俵積田 +俵箭 +俵藤 +俵谷 +俵迫 +俵道 +俵野 +俵頭 +倉 +倉ケ崎 +倉ケ市 +倉ケ谷 +倉ケ野 +倉ノ +倉ノ下 +倉上 +倉下 +倉世古 +倉並 +倉中 +倉主 +倉久 +倉之段 +倉井 +倉代 +倉住 +倉佐 +倉信 +倉俣 +倉側 +倉元 +倉光 +倉八 +倉兼 +倉内 +倉冨 +倉出 +倉前 +倉升 +倉原 +倉又 +倉叉 +倉友 +倉口 +倉司 +倉吉 +倉向 +倉品 +倉員 +倉嘉 +倉国 +倉園 +倉地 +倉坂 +倉坪 +倉垣 +倉垣内 +倉城 +倉埜 +倉堀 +倉堂 +倉場 +倉塚 +倉増 +倉多 +倉奥 +倉好 +倉守 +倉宗 +倉宮 +倉家 +倉富 +倉富二 +倉尾 +倉屋 +倉山 +倉岡 +倉島 +倉崎 +倉嵜 +倉嶋 +倉嶌 +倉川 +倉平 +倉床 +倉廸 +倉形 +倉恒 +倉懸 +倉成 +倉戸 +倉持 +倉指 +倉掛 +倉数 +倉敷 +倉斗 +倉方 +倉智 +倉木 +倉本 +倉杉 +倉村 +倉東 +倉松 +倉林 +倉枡 +倉柳 +倉栄 +倉根 +倉梯 +倉森 +倉楠 +倉槁 +倉橋 +倉次 +倉武 +倉毛 +倉水 +倉永 +倉池 +倉沢 +倉河 +倉治 +倉沼 +倉泉 +倉波 +倉津 +倉浜 +倉浪 +倉淵 +倉渕 +倉満 +倉滝 +倉滿 +倉澤 +倉瀧 +倉瀬 +倉爪 +倉片 +倉狩 +倉生 +倉田 +倉町 +倉畑 +倉留 +倉益 +倉盛 +倉矢 +倉知 +倉石 +倉神 +倉科 +倉窪 +倉立 +倉竹 +倉繁 +倉股 +倉脇 +倉臼 +倉舗 +倉舘 +倉良 +倉若 +倉茂 +倉薗 +倉藤 +倉西 +倉見 +倉見谷 +倉角 +倉谷 +倉貫 +倉賀野 +倉起 +倉越 +倉跡 +倉辺 +倉辻 +倉迫 +倉道 +倉邉 +倉邊 +倉部 +倉郷 +倉都 +倉重 +倉重屋 +倉野 +倉野内 +倉野尾 +倉金 +倉鋪 +倉鍵 +倉鎌 +倉長 +倉門 +倉間 +倉阪 +倉頭 +倉館 +倉骨 +倉高 +倉鹿野 +倍 +倍井 +倍償 +倍味 +倍地 +倍巌 +倍川 +倍本 +倍永 +倍田 +倍盛 +倍賞 +倍野 +倚水 +値 +値賀 +倭 +倭文 +倭村 +倭田 +倭谷 +倶利加羅 +倶羅 +偆道 +假名 +假名垣 +假名田 +假家 +假宿 +假屋 +假屋原 +假屋園 +假屋崎 +假屋瀬 +假水 +假谷 +假重 +假野 +偉士大 +偉川 +偉関 +偕家 +健 +健代 +健名 +健山 +健崎 +健木 +健正 +健物 +健石 +健部 +側 +側原 +側垣 +側島 +側嶋 +側瀬 +側田 +側見 +側高 +偵田 +偸伽 +傅 +傅住 +傅刀 +傅川 +傅法 +傅法谷 +傅甫 +傅田 +傅石 +傅谷 +傅道 +傅野 +傅馬 +傍士 +傍島 +傍嶋 +傍木 +傍田 +傍示 +傘 +傘井 +傘倉 +傘木 +傘本 +傘松 +傘谷 +備 +備中 +備仲 +備全 +備前 +備前島 +備前谷 +備原 +備家 +備嶋 +備後 +備後内 +備本 +備江 +備海 +備瀬 +備生 +備藤 +備谷 +備酒 +備里川 +備野 +備魚 +催山 +催本 +催郷 +傳 +傳井 +傳住 +傳佐 +傳保 +傳刀 +傳地多 +傳城 +傳宝 +傳寳 +傳寶 +傳崎 +傳川 +傳平 +傳幸 +傳庄 +傳明地 +傳村 +傳江 +傳法 +傳法寺 +傳法谷 +傳甫 +傳田 +傳石 +傳福 +傳能 +傳谷 +傳農 +傳道 +傳里 +傳野 +傳長 +傳馬 +僉山 +僊元 +僊崎 +僊石 +働 +働々 +像尾 +僧根 +僧津 +僧理 +僧都 +僧野 +僧頭 +儀 +儀丁 +儀万 +儀三武 +儀丹 +儀久 +儀仁 +儀俄 +儀保 +儀光 +儀利古 +儀同 +儀天 +儀宝 +儀峨 +儀惣 +儀我 +儀本 +儀武 +儀満 +儀滿 +儀理 +儀田 +儀福 +儀納 +儀藤 +儀谷 +儀賀 +儀道 +儀部 +儀野 +儀間 +儁侃 +億 +億吉 +億岐 +億川 +億本 +億田 +億谷 +億貞 +億野 +儘 +儘下 +儘多 +儘田 +優谷 +儲口 +兀下 +兀塚 +兀尾 +兀山 +兀橋 +兀脇 +兀越 +元 +元上 +元下 +元中 +元丸 +元主 +元久 +元久保 +元二 +元井 +元仲 +元位 +元住 +元佐 +元信 +元倉 +元光 +元兼 +元内 +元利 +元勝 +元原 +元古 +元吉 +元名 +元呑 +元和木 +元国 +元國 +元園 +元土肥 +元地 +元坂 +元垣 +元垣内 +元城 +元堀 +元堤 +元場 +元塚 +元売 +元多 +元太 +元女 +元好 +元如 +元妹 +元安 +元宗 +元宮 +元家 +元宿 +元寺 +元小出 +元尾 +元居 +元屋 +元屋地 +元屋敷 +元山 +元岡 +元峯 +元島 +元崎 +元嵜 +元嶋 +元嶌 +元川 +元市 +元平 +元広 +元庄矢 +元座 +元廣 +元恒 +元戎 +元成 +元戸 +元房 +元折 +元抜 +元持 +元故 +元文 +元方 +元日田 +元明 +元春 +元智 +元木 +元木沢 +元木澤 +元本 +元杉 +元村 +元杭 +元松 +元林 +元柏 +元柳 +元栄 +元根 +元梅 +元森 +元植 +元椿 +元榮 +元樋 +元橋 +元次 +元正 +元武 +元氏 +元水 +元永 +元江 +元池 +元沢 +元河 +元治 +元泉 +元波 +元津 +元洲 +元流 +元浄 +元浜 +元浦 +元浪 +元海 +元淵 +元清水 +元渕 +元満 +元澤 +元濱 +元生 +元田 +元由 +元町 +元畑 +元番 +元盛 +元目 +元矢 +元石 +元砂 +元祐 +元神 +元禄 +元秋 +元秋葉 +元稲 +元管 +元籔 +元紺谷 +元結 +元綱 +元網 +元繁 +元脇 +元臼 +元船 +元良 +元花 +元芳 +元茂 +元菅 +元薮 +元藤 +元藪 +元行 +元西 +元見 +元親 +元角 +元谷 +元谷内 +元賀 +元起 +元越 +元辻 +元近 +元迫 +元道 +元達 +元部 +元重 +元野 +元野木 +元金 +元録 +元長 +元開 +元関 +元阪 +元雄 +元風 +元風呂 +元飛騨 +元馬 +兄井 +兄内 +兄山 +兄後 +兄木 +兄父 +兄部 +先 +先中 +先久 +先低 +先光 +先光寺 +先内 +先出谷 +先前 +先原 +先名 +先坊 +先城 +先堀 +先場 +先家 +先小山 +先尾 +先山 +先岡 +先崎 +先嵜 +先川 +先川原 +先成 +先曽 +先本 +先村 +先東 +先森 +先槻 +先水 +先永 +先沖 +先浜 +先浦 +先濱 +先灘 +先生 +先田 +先田口 +先矢 +先砥 +先祖 +先立 +先納 +先織 +先花 +先藤 +先規 +先谷 +先達 +先野 +先野々 +先野浜 +先野濱 +先間 +先附 +先陣山 +先馬 +光 +光上 +光下 +光丘 +光中 +光丸 +光主 +光久 +光井 +光亦 +光仙 +光代 +光位 +光來 +光來出 +光保 +光信 +光俣 +光倉 +光元 +光兼 +光内 +光冨 +光冨士 +光前 +光勢 +光原 +光又 +光友 +光司 +光吉 +光同寺 +光善 +光善坊 +光国 +光國 +光國寺 +光在 +光地 +光坂 +光城 +光堀 +光場 +光塚 +光増 +光墨 +光多 +光太 +光好 +光守 +光安 +光宗 +光定 +光実 +光宮 +光家 +光富 +光實 +光寺 +光寿 +光尾 +光居 +光山 +光岡 +光岩 +光岳 +光峪 +光峰 +光島 +光崎 +光嵜 +光嶋 +光嶌 +光川 +光巻 +光常 +光平 +光年 +光広 +光庵 +光庵寺 +光廣 +光延 +光引 +光弘 +光待 +光後 +光応 +光恒 +光應 +光成 +光戸 +光持 +光教路 +光斉 +光斎 +光旗 +光明 +光明寺 +光明院 +光易 +光星 +光月 +光木 +光末 +光本 +光杉 +光村 +光来 +光来出 +光松 +光林 +光林坊 +光枝 +光栄 +光根 +光桑野 +光森 +光楽 +光榮 +光樂 +光橋 +光正 +光武 +光水 +光永 +光江 +光池 +光沖 +光沢 +光河 +光泉 +光法 +光波 +光浦 +光浪 +光清 +光満 +光源 +光源寺 +光滝 +光澤 +光瀧 +光瀬 +光照 +光用 +光田 +光町 +光畑 +光畠 +光益 +光盛 +光眞 +光眞坊 +光真 +光真坊 +光石 +光神 +光移 +光竹 +光籏 +光納 +光股 +光能 +光芳 +光若 +光英 +光菅 +光葉 +光藤 +光行 +光西 +光見 +光見寺 +光角 +光谷 +光貞 +光賀 +光輪 +光辻 +光造 +光達 +光邨 +光部 +光郷 +光里 +光重 +光野 +光野井 +光金 +光銭 +光長 +光門 +光間 +光阪 +光随 +光隨 +光頭 +光頼 +光風 +光飛田 +光髄 +光高 +光黒 +光齋 +克辺 +克邉 +免 +免井 +免出 +免取 +免古地 +免坂 +免山 +免手 +免滝 +免瀧 +免田 +免農 +免養 +免鳥 +兎中 +兎内 +兎原 +兎太 +兎子尾 +兎山 +兎川 +兎払 +兎拂 +兎本 +兎束 +兎毛成 +兎沢 +兎洞 +兎澤 +兎田 +兎田谷 +兎耳山 +兎谷 +児ノ原 +児下 +児丸 +児之原 +児井 +児仁井 +児保 +児倉 +児原 +児坂 +児堀 +児堂 +児塔 +児塚 +児子 +児守 +児安 +児室 +児宮山 +児寺 +児屋野 +児山 +児岸 +児島 +児崎 +児嵜 +児嶋 +児嶌 +児川 +児平 +児成 +児戸 +児房 +児新 +児松 +児林 +児桜 +児森 +児橋 +児池 +児沢 +児泉 +児波 +児浜 +児浦 +児浪 +児澤 +児濱 +児玉 +児玉谷 +児珠 +児田 +児田原 +児矢野 +児美川 +児脇 +児藤 +児西 +児見山 +児谷 +児野 +児銀 +児門 +児馬 +児高 +兒丸 +兒井 +兒仁井 +兒堂 +兒子 +兒山 +兒島 +兒崎 +兒嶋 +兒嶌 +兒林 +兒森 +兒橋 +兒浦 +兒玉 +兒田 +兒見山 +兒野 +兒門 +兒高 +兔内 +兔太 +兔子尾 +党 +党崎 +兜 +兜坂 +兜屋 +兜山 +兜岩 +兜島 +兜崎 +兜木 +兜森 +兜玉 +兜着 +兜石 +兜谷 +兜金 +兠坂 +入 +入ケ町 +入一 +入万 +入不二 +入与那国 +入中 +入久戸 +入之内 +入井 +入交 +入仲 +入仲本 +入伊泊 +入住 +入佐 +入來 +入來院 +入倉 +入元 +入内 +入内島 +入内嶋 +入内嶌 +入内沢 +入内澤 +入冨村 +入出 +入前 +入南風野 +入原 +入口 +入合 +入吉 +入君 +入国 +入國 +入地 +入坂 +入垣 +入埜 +入場 +入塚 +入塩 +入夏 +入多 +入好 +入子 +入学 +入學 +入宇田 +入宇部 +入宮 +入家 +入富村 +入小 +入小底 +入尾 +入尾野 +入居 +入屋 +入山 +入岡 +入島 +入崎 +入嵩西 +入嶋 +入川 +入座 +入徳 +入慶田本 +入戸 +入戸野 +入手 +入料 +入方 +入日 +入星 +入曽 +入曾 +入月 +入木 +入木田 +入本 +入杉 +入村 +入来 +入来田 +入来院 +入松川 +入松田 +入枝 +入柿 +入栄 +入梅 +入橋 +入毛町 +入水 +入永 +入汐 +入江 +入江田 +入池原 +入沢 +入河 +入波 +入波平 +入津 +入浜 +入浦 +入海 +入潮 +入澤 +入濱 +入瀬 +入玉 +入生 +入生田 +入田 +入田衛 +入田谷 +入田里 +入町 +入盛本 +入相 +入眞地 +入真地 +入矢 +入石 +入石垣 +入砂 +入福 +入福浜 +入福濱 +入稲福 +入端 +入米蔵 +入米藏 +入籾 +入義 +入羽 +入耒 +入耒院 +入膳 +入舟 +入舩 +入船 +入船渡 +入花 +入葉 +入蔵 +入蔵元 +入藏 +入藏元 +入西 +入西原 +入角 +入請舛 +入谷 +入貝 +入賀 +入路 +入軽井 +入辺 +入迎里 +入迫 +入道 +入道山 +入邊 +入部 +入里 +入野 +入野田 +入野谷 +入金 +入門 +入間 +入間川 +入間田 +入間野 +入領 +入馬 +入駒 +入高島 +入鳩間 +入鹿 +入鹿山 +全並 +全先 +全原 +全屋 +全川 +全徳 +全斉 +全本 +全田 +全野 +兪山 +八つ代 +八ケ代 +八ケ婦 +八ケ窪 +八ツ井 +八ツ代 +八ツ元 +八ツ塚 +八ツ尾 +八ツ山 +八ツ岩 +八ツ峰 +八ツ崎 +八ツ役 +八ツ星 +八ツ木 +八ツ本 +八ツ柳 +八ツ橋 +八ツ波 +八ツ浦 +八ツ田 +八ツ繁 +八ツ藤 +八ツ賀 +八丁 +八丁地 +八丁目 +八丁野 +八七橋 +八万 +八万木 +八丈 +八丈野 +八上 +八下田 +八与 +八世山 +八並 +八串 +八丸 +八丹 +八久 +八久保 +八乕 +八乙女 +八九 +八亀 +八五郎丸 +八井 +八井沢 +八井田 +八京 +八代 +八代田 +八代谷 +八代醍 +八伏 +八住 +八作 +八俣 +八倉 +八倉巻 +八元 +八光 +八児 +八兒 +八内 +八切 +八別当 +八別當 +八前 +八剣 +八剱 +八劒 +八劔 +八力 +八加部 +八十 +八十住 +八十八 +八十出 +八十原 +八十山 +八十岡 +八十島 +八十嶋 +八十川 +八十広 +八十木 +八十歩 +八十河 +八十浜 +八十濱 +八十瀬 +八十田 +八十科 +八千 +八千代 +八千古島 +八千古嶋 +八千田 +八卷 +八原 +八又 +八友 +八反 +八反丸 +八反地 +八反田 +八取 +八司 +八合 +八名 +八名木 +八向 +八吹 +八周 +八和田 +八品 +八国 +八国生 +八國 +八國生 +八地又 +八坂 +八垣 +八垰 +八城 +八塔 +八塚 +八塩 +八壁 +八声 +八壽八 +八多 +八多川 +八太 +八夫 +八子 +八子熊 +八字 +八宗岡 +八宮 +八家 +八富 +八寿八 +八寿田 +八尋 +八尋淵 +八尋渕 +八尺 +八尻 +八尾 +八尾井 +八尾坂 +八尾師 +八尾村 +八尾板 +八尾田 +八尾谷 +八尾野 +八屋 +八山 +八岡 +八岩 +八峠 +八島 +八崎 +八嵜 +八嶋 +八嶌 +八川 +八巻 +八幡 +八幡原 +八幡垣 +八幡屋 +八幡木 +八幡秋山 +八幡谷 +八幡野 +八幡領 +八平 +八幾井 +八広 +八度 +八廣 +八張 +八影 +八役 +八性 +八惣 +八懸 +八戸 +八戸木 +八戸野 +八房 +八所 +八手 +八手亦 +八手又 +八手幡 +八括 +八掛 +八敷 +八文字 +八斗 +八方 +八旗 +八日 +八日囿 +八日園 +八日市 +八日市屋 +八日市谷 +八明 +八星 +八景 +八月一日 +八月朔日 +八朔 +八朔日 +八朝 +八木 +八木ケ谷 +八木下 +八木井 +八木原 +八木司 +八木場 +八木尾 +八木山 +八木岡 +八木島 +八木巻 +八木平 +八木庭 +八木戸 +八木本 +八木森 +八木橋 +八木沢 +八木沼 +八木澤 +八木田 +八木谷 +八木野 +八本 +八本木 +八杉 +八村 +八杖 +八束 +八条 +八東 +八松 +八板 +八林 +八柄 +八柏 +八染 +八柳 +八栗 +八桁 +八條 +八森 +八槇 +八構 +八槙 +八槻 +八樹 +八橋 +八次 +八武崎 +八段 +八毛 +八永 +八汐 +八江 +八沢 +八河 +八波 +八波田 +八津 +八津倉 +八津又 +八津口 +八津尾 +八津川 +八津橋 +八津田 +八津谷 +八洲 +八浜 +八浦 +八浪 +八海 +八淵 +八渓 +八渡 +八源寺 +八潮 +八澤 +八濱 +八瀬 +八瀬尾 +八瀬山 +八瀬川 +八瀬林 +八瀬河 +八瀬辺 +八瀬邉 +八熊 +八牟礼 +八牟禮 +八牧 +八王 +八王地 +八王子 +八甫谷 +八田 +八田井 +八田原 +八田堀 +八田羽 +八田谷 +八田部 +八田野 +八甲田 +八町 +八畑 +八畝田 +八畠 +八登 +八百 +八百三 +八百下 +八百中 +八百井 +八百代 +八百原 +八百坂 +八百城 +八百屋 +八百山 +八百川 +八百市 +八百幸 +八百木 +八百本 +八百村 +八百板 +八百枝 +八百田 +八百谷 +八百野 +八的 +八矢 +八石 +八社宮 +八神 +八穴 +八窪 +八端 +八竹 +八符 +八筈 +八筬 +八箇 +八篠 +八籏 +八納 +八絛 +八綿 +八羽 +八羽毛 +八耳 +八聲 +八與 +八舟 +八船 +八色 +八若 +八荷 +八萬 +八葉 +八蕪 +八藤 +八藤丸 +八藤後 +八角 +八記 +八講 +八谷 +八賀 +八起 +八越 +八車 +八軒 +八軒屋 +八輪 +八辺 +八辻 +八道 +八郎田 +八部 +八部野 +八郷 +八里 +八重 +八重下 +八重代 +八重倉 +八重元 +八重原 +八重口 +八重垣 +八重尾 +八重山 +八重岡 +八重岳 +八重島 +八重崎 +八重嶋 +八重嶌 +八重嶽 +八重川 +八重幡 +八重座 +八重木 +八重本 +八重柏 +八重桓 +八重桜 +八重森 +八重樫 +八重橋 +八重櫻 +八重沢 +八重津 +八重澤 +八重田 +八重畑 +八重盛 +八重石 +八重練 +八重見 +八重野 +八重門 +八野 +八野井 +八野田 +八釖 +八釜 +八釣 +八釼 +八鍬 +八鎌 +八長 +八間 +八間川 +八阪 +八陣 +八陳 +八隅 +八雲 +八雲井 +八面 +八鞍 +八須 +八須元 +八須賀 +八頭 +八頭司 +八馬 +八高 +八鬼 +八鳥 +八鹿 +八黄地 +公下 +公事 +公保 +公原 +公受 +公地 +公塚 +公宅 +公家 +公山 +公平 +公庄 +公手 +公文 +公文代 +公文名 +公方 +公月 +公望 +公木 +公木平 +公本 +公森 +公江 +公田 +公畑 +公盛 +公納 +公舟 +公荘 +公賀 +公野 +公門 +公門城 +六 +六ケ村 +六ツ名 +六ツ崎 +六ツ役 +六ツ森 +六ツ石 +六ツ見 +六万 +六与 +六串 +六井 +六人石 +六人部 +六信 +六倉 +六十田 +六十苅 +六十谷 +六十里 +六厩 +六名 +六呂田 +六坂 +六塚 +六宗 +六室 +六尾 +六山 +六岡 +六峯 +六峰 +六崎 +六川 +六平 +六戸部 +六日市 +六枝 +六楽内 +六津井 +六浦 +六田 +六碕 +六笠 +六與 +六興 +六萬 +六藤 +六角 +六角屋 +六谷 +六車 +六軒 +六辻 +六連 +六野 +六釜 +六鎗 +六門 +六雄 +六鹿 +共明 +共田 +兵 +兵ケ谷 +兵万 +兵三 +兵丹 +兵丹石 +兵主 +兵井 +兵伊 +兵佐 +兵倉 +兵働 +兵動 +兵吾 +兵土 +兵地 +兵坂 +兵埜 +兵堀 +兵堂 +兵士 +兵多 +兵子 +兵山 +兵崎 +兵工 +兵平 +兵床 +兵底 +兵庫 +兵庫屋 +兵庫谷 +兵延 +兵後 +兵恵 +兵惠 +兵木 +兵本 +兵東 +兵毛 +兵永 +兵江 +兵沢 +兵法 +兵津 +兵渡 +兵澤 +兵田 +兵等 +兵籐 +兵藤 +兵衛 +兵谷 +兵賀 +兵連 +兵道 +兵部 +兵郷 +兵野 +兵間 +兵頭 +兵馬 +其上 +其原 +其山 +其川 +其日 +其木 +其村 +其池 +其浦 +其田 +其町 +其畑 +其竹 +其脇 +其谷 +其輪 +其道 +其部 +其都 +其野 +其阿弥 +其阿彌 +具 +具伊 +具原 +具呂 +具塚 +具島 +具嶋 +具市 +具志 +具志堅 +具志川 +具志頭 +具本 +具治 +具田 +具藤 +具谷 +具足 +具足島 +具路 +具頭 +典略 +兼 +兼ケ崎 +兼上 +兼下 +兼丘 +兼中 +兼丸 +兼久 +兼井 +兼京 +兼今 +兼任 +兼佐 +兼俊 +兼保 +兼信 +兼俵 +兼倉 +兼元 +兼先 +兼光 +兼児 +兼八 +兼内 +兼冨 +兼利 +兼則 +兼勝 +兼原 +兼友 +兼口 +兼古 +兼台 +兼吉 +兼品 +兼国 +兼國 +兼坂 +兼城 +兼堀 +兼堅 +兼塚 +兼増 +兼外 +兼好 +兼子 +兼守 +兼安 +兼宗 +兼定 +兼実 +兼富 +兼小 +兼尾 +兼屋 +兼山 +兼岡 +兼岩 +兼峯 +兼島 +兼崎 +兼嶋 +兼川 +兼巻 +兼市 +兼常 +兼平 +兼年 +兼広 +兼庄 +兼康 +兼廣 +兼延 +兼弘 +兼得 +兼徳 +兼成 +兼房 +兼折 +兼掘 +兼政 +兼春 +兼時 +兼木 +兼末 +兼本 +兼杉 +兼村 +兼松 +兼板 +兼林 +兼枡 +兼桝 +兼森 +兼橋 +兼次 +兼正 +兼武 +兼歳 +兼氏 +兼永 +兼江 +兼池 +兼沢 +兼浜 +兼浦 +兼海 +兼深 +兼清 +兼満 +兼澤 +兼濱 +兼瀬 +兼為 +兼田 +兼畠 +兼益 +兼盛 +兼目 +兼石 +兼福 +兼竹 +兼箇 +兼箇段 +兼築 +兼綱 +兼脇 +兼芳 +兼若 +兼茂 +兼藤 +兼行 +兼西 +兼見 +兼角 +兼謝名 +兼谷 +兼貞 +兼賀 +兼近 +兼迫 +兼述 +兼逑 +兼里 +兼重 +兼長 +兼門 +兼間 +兼頭 +兼頼 +兼高 +冀北 +内 +内の宮 +内の浦 +内ケ島 +内ケ崎 +内ケ嶋 +内ノ井 +内ノ倉 +内ノ宮 +内ノ村 +内ノ浦 +内一 +内上 +内上堀 +内中 +内丸 +内久保 +内久根 +内之丸 +内之倉 +内之八重 +内之宮 +内之段 +内之浦 +内之牧 +内之蔵 +内亀 +内井 +内仮屋 +内仲 +内住 +内保 +内倉 +内儀 +内元 +内免 +内全 +内八重 +内兼久 +内冨 +内出 +内切 +内別府 +内前 +内勢 +内匠 +内匠屋 +内升 +内原 +内古 +内古田 +内古閑 +内司 +内吉 +内名 +内呂 +内呑 +内和 +内和田 +内喜 +内囿 +内園 +内園田 +内土井 +内地原 +内坂 +内坪 +内垣 +内垣内 +内垣外 +内城 +内埜 +内埼 +内堀 +内場 +内塚 +内多 +内大久保 +内大保 +内宇田 +内室 +内宮 +内富 +内尾 +内屋 +内屋敷 +内山 +内山田 +内岡 +内岩 +内島 +内崎 +内嶋 +内嶌 +内嶺 +内川 +内川口 +内巻 +内布 +内幡 +内平 +内広 +内座 +内廣 +内形 +内御堂 +内徳 +内恒見 +内恵 +内惠 +内戸 +内手 +内掘 +内掛根 +内方 +内春 +内木 +内木場 +内本 +内杉 +内村 +内条 +内東 +内松 +内林 +内枦保 +内柱 +内柳 +内柴 +内栫 +内根原 +内桝 +内桶 +内條 +内梨 +内森 +内構 +内樋 +内樹 +内橋 +内正 +内水 +内永 +内江 +内池 +内沖 +内沢 +内河 +内河内 +内河野 +内沼 +内泉 +内波 +内洞 +内津 +内浜 +内浦 +内浪 +内海 +内海崎 +内添 +内満 +内滿 +内潟 +内澤 +内濱 +内瀉 +内瀬戸 +内炭 +内片 +内牧 +内甑 +内生 +内生蔵 +内生藏 +内田 +内田屋 +内町 +内畑 +内畑谷 +内畠 +内盛 +内矢 +内石 +内祐 +内神 +内種 +内空閑 +内窪 +内立 +内立元 +内立輪 +内竹 +内笹井 +内籐 +内糸 +内納 +内美家 +内能美 +内膳 +内舘 +内舛 +内舩 +内船 +内良 +内芝 +内苑 +内蔵 +内蔵成 +内蔵田 +内薗 +内藏 +内藏田 +内藤 +内西 +内見 +内角 +内記 +内谷 +内豊留 +内貝 +内貴 +内賀 +内賀島 +内賀嶋 +内赤 +内越 +内輪 +内迫 +内那 +内部 +内里 +内重 +内野 +内野々 +内野井 +内野倉 +内野宮 +内野沢 +内野澤 +内野谷 +内野野 +内金 +内金崎 +内鉙 +内鏡原 +内長 +内門 +内間 +内間木 +内面 +内音坊 +内須川 +内館 +内馬場 +内騰 +内麻 +内黒 +内黒羽子 +円 +円一 +円丁 +円上 +円丘 +円並 +円並地 +円中 +円丸 +円乗 +円井 +円仏 +円佛 +円保 +円倉 +円光 +円光寺 +円入 +円口 +円句 +円地 +円垣内 +円城 +円城寺 +円堂 +円場 +円増 +円奈 +円妙 +円子 +円実 +円富 +円尾 +円居 +円山 +円岡 +円島 +円崎 +円川 +円市 +円座 +円延 +円応 +円成 +円成寺 +円戸 +円日 +円明 +円月 +円木 +円本 +円札 +円東 +円林 +円橋 +円次 +円正 +円毛 +円水 +円池 +円法 +円波 +円浄 +円淨 +円満 +円満堂 +円満字 +円玉 +円生 +円生寺 +円田 +円町 +円界 +円目 +円石 +円福 +円福寺 +円能寺 +円舘 +円花 +円若 +円藤 +円行 +円見 +円角 +円谷 +円賀 +円越 +円通 +円道 +円道寺 +円酒 +円野 +円鍔 +円間 +円館 +円馬 +再名生 +再本 +再東 +再田 +再藤 +再起 +写野 +冠 +冠地 +冠城 +冠崎 +冠木 +冠村 +冠満 +冠滿 +冠者 +冠谷 +冠野 +冢田 +冥加 +冥賀 +冨 +冨ケ原 +冨上 +冨下 +冨丘 +冨並 +冨中 +冨丸 +冨主 +冨久 +冨久世 +冨久増 +冨久尾 +冨久山 +冨久川 +冨久田 +冨久長 +冨井 +冨仲 +冨住 +冨來 +冨依 +冨保 +冨倉 +冨元 +冨光 +冨内 +冨処 +冨加津 +冨加美 +冨加見 +冨加須 +冨原 +冨取 +冨口 +冨司 +冨合 +冨吉 +冨名 +冨名腰 +冨向 +冨和 +冨善 +冨喜 +冨園 +冨地 +冨坂 +冨垣 +冨城 +冨堂 +冨場 +冨塚 +冨増 +冨士 +冨士中 +冨士井 +冨士代 +冨士元 +冨士光 +冨士原 +冨士名 +冨士和 +冨士坂 +冨士埜 +冨士大 +冨士尾 +冨士居 +冨士屋 +冨士山 +冨士岡 +冨士島 +冨士崎 +冨士川 +冨士平 +冨士成 +冨士木 +冨士末 +冨士本 +冨士村 +冨士松 +冨士枝 +冨士栄 +冨士根 +冨士森 +冨士永 +冨士池 +冨士沢 +冨士浜 +冨士渕 +冨士澤 +冨士濱 +冨士瀬 +冨士田 +冨士登 +冨士盛 +冨士縄 +冨士繩 +冨士蔭 +冨士見 +冨士谷 +冨士越 +冨士道 +冨士野 +冨士金 +冨士鷹 +冨多 +冨奥 +冨好 +冨子 +冨宅 +冨宇加 +冨宇賀 +冨守 +冨安 +冨室 +冨家 +冨宿 +冨小路 +冨尾 +冨尾木 +冨居 +冨屋 +冨山 +冨岡 +冨岩 +冨岳 +冨峯 +冨島 +冨崎 +冨嵜 +冨嶋 +冨嶺 +冨川 +冨工 +冨平 +冨広 +冨底 +冨康 +冨廣 +冨弘 +冨弥 +冨張 +冨彌 +冨恵 +冨惠 +冨成 +冨戸野 +冨所 +冨手 +冨政 +冨春 +冨木 +冨木田 +冨本 +冨村 +冨来 +冨松 +冨板 +冨林 +冨栄 +冨桝 +冨森 +冨楽 +冨樂 +冨樫 +冨次 +冨武 +冨気 +冨氣 +冨水 +冨水流 +冨永 +冨江 +冨沢 +冨河 +冨波 +冨津田 +冨浦 +冨浪 +冨海 +冨清 +冨満 +冨滿 +冨澤 +冨瀬 +冨狭 +冨生 +冨田 +冨田川 +冨畑 +冨留宮 +冨留田 +冨益 +冨盛 +冨着 +冨矢 +冨石 +冨砂 +冨福 +冨秋 +冨竹 +冨築 +冨米野 +冨綱 +冨繁 +冨美 +冨羽 +冨耒 +冨能 +冨脇 +冨舛 +冨芳 +冨菜 +冨薮 +冨藤 +冨西 +冨見田 +冨谷 +冨貞 +冨貫 +冨貴 +冨貴井 +冨貴原 +冨貴塚 +冨貴島 +冨貴本 +冨貴沢 +冨貴澤 +冨貴田 +冨賀 +冨賀瀬 +冨賀見 +冨路 +冨路本 +冨近 +冨迫 +冨部 +冨酒 +冨里 +冨里川 +冨重 +冨野 +冨野井 +冨金原 +冨長 +冨阪 +冨高 +冨鶴 +冨鹿 +冬井 +冬城 +冬室 +冬山 +冬島 +冬崎 +冬川 +冬広 +冬廣 +冬木 +冬村 +冬柴 +冬梅 +冬沢 +冬泉 +冬澤 +冬爪 +冬田 +冬至 +冬賀 +冬部 +冬野 +冬頭 +冬麻 +冲 +冲中 +冲山 +冲本 +冲永 +冲田 +冲邑 +冲野 +决得 +冴来 +冶城 +冶田 +冷原 +冷岡 +冷川 +冷水 +冷清水 +冷牟田 +冷田 +冷野沢 +冽鎌 +凉木 +凉松 +凉野 +凌 +凌木 +凍田 +凝地 +凝重 +几 +凡内 +凡河内 +凢 +凢内 +処 +凩 +凪 +出 +出ケ迫 +出ツ古 +出ツ所 +出ノ口 +出上 +出下 +出世 +出中 +出丸 +出丹保 +出久 +出久地 +出久根 +出之口 +出井 +出仙 +出伊 +出会 +出佐 +出作 +出來 +出來島 +出來嶋 +出來田 +出來谷 +出來須 +出保 +出倉 +出元 +出先 +出光 +出内 +出分 +出利葉 +出前 +出南 +出原 +出口 +出合 +出合場 +出向 +出向井 +出呂町 +出和 +出地 +出坂 +出垣 +出垣内 +出堀 +出場 +出塚 +出塩 +出太鼓 +出孝 +出宮 +出家 +出家鋪 +出富 +出射 +出尻 +出尾 +出居 +出屋 +出屋敷 +出山 +出岐 +出岡 +出岸 +出島 +出崎 +出嵜 +出嶋 +出嶌 +出川 +出市 +出師 +出平 +出広 +出店 +出廣 +出張 +出形 +出待 +出後 +出志久保 +出戸 +出戸端 +出所 +出手 +出手下 +出手野 +出春 +出晴 +出會 +出月 +出木 +出木原 +出木場 +出木山 +出木岡 +出木浦 +出木田 +出木舎 +出木谷 +出木野 +出本 +出村 +出村谷 +出来 +出来元 +出来尾 +出来屋 +出来山 +出来岡 +出来島 +出来嶋 +出来本 +出来村 +出来田 +出来町 +出来谷 +出来野 +出来須 +出林 +出柄 +出栗 +出棚 +出森 +出構 +出樋 +出橋 +出水 +出水園 +出水屋 +出水川 +出水沢 +出水澤 +出水田 +出永 +出江 +出沖 +出沢 +出河 +出河原 +出沼 +出波 +出津 +出津野 +出浜 +出浦 +出海 +出淵 +出清水 +出渊 +出渕 +出渡 +出温 +出湯 +出満 +出満富 +出澤 +出濱 +出牛 +出田 +出町 +出畑 +出盛 +出目 +出相 +出石 +出石家 +出砂 +出秀 +出科 +出穂 +出窪 +出竃 +出竈 +出立 +出端 +出竹 +出竿 +出篭 +出籠 +出納 +出縄 +出繩 +出羽 +出羽沢 +出羽澤 +出羽野 +出耒 +出耒田 +出脇 +出船 +出良 +出花 +出茂 +出葉 +出蔵 +出藏 +出藤 +出西 +出見 +出見世 +出角 +出谷 +出貝 +出越 +出路 +出車 +出輪 +出途 +出逢 +出道 +出邑 +出野 +出野上 +出釜 +出門 +出開 +出間 +出雄 +出雲 +出雲井 +出雲寺 +出雲屋 +出雲崎 +出雲谷 +出雲路 +出頭 +出馬 +出麹 +函城 +函館 +凾城 +凾館 +刀 +刀上 +刀井 +刀儀 +刀利 +刀原 +刀坂 +刀塚 +刀山 +刀川 +刀弥 +刀根 +刀根川 +刀楠 +刀沢 +刀澤 +刀田 +刀祢 +刀祢平 +刀祢明 +刀祢田 +刀祢谷 +刀祢館 +刀禰 +刀禰平 +刀禰田 +刀禰館 +刀称 +刀稱 +刀納 +刀脇 +刀谷 +刀迫 +刀野 +刁 +刁菊 +刃振 +刃田 +刃禰谷 +刃金 +刄田 +刄金 +分倉 +分園 +分家 +分寺 +分才 +分明 +分木 +分松 +分林 +分枝 +分校 +分根 +分玉 +分田 +分藤 +分造 +分道 +分野 +分銅 +分領 +切上 +切中 +切久保 +切井 +切付 +切佐古 +切原 +切口 +切喰 +切地 +切坂 +切塚 +切士 +切封 +切尾 +切山 +切岩 +切岸 +切島 +切嶋 +切川 +切幡 +切建 +切後 +切戸 +切手 +切抜 +切敷 +切明 +切明畑 +切替 +切木 +切本 +切東 +切松 +切林 +切柳 +切梅 +切欠 +切江 +切池 +切沢 +切浜 +切澤 +切無沢 +切無澤 +切田 +切畑 +切畑屋 +切留 +切畠 +切目 +切石 +切石中 +切端 +切籏 +切詰 +切谷 +切貫 +切越 +切輪 +切辻 +切通 +切道 +切里 +切金 +切開 +切間 +切附 +切鼻 +刈内 +刈和 +刈安 +刈宿 +刈屋 +刈屋田 +刈山 +刈川 +刈敷 +刈本 +刈生田 +刈田 +刈畑 +刈米 +刈茅 +刈草 +刈谷 +刈賀 +刈込 +刈部 +刈郷 +刈野 +刈金 +刈間 +刈間澤 +刎 +刎ケ辻 +刎元 +刎本 +刎田 +刑部 +初 +初ケ谷 +初一 +初世 +初井 +初亦 +初代 +初元 +初刀 +初原 +初又 +初叉 +初取 +初古 +初坂 +初塚 +初塩 +初宿 +初山 +初岡 +初島 +初崎 +初嵐 +初嶋 +初嶌 +初川 +初手 +初木 +初本 +初村 +初柴 +初根 +初森 +初永 +初汐 +初沢 +初治 +初波 +初津 +初浦 +初海 +初澤 +初瀬 +初瀬尾 +初瀬川 +初瀬田 +初瀬部 +初田 +初盛 +初矢 +初祖 +初神 +初芝 +初行 +初見 +初谷 +初貝 +初道 +初都 +初野 +初阪 +初雁 +初音 +初馬 +初鳥 +初鹿 +初鹿野 +判 +判中 +判前 +判多 +判官 +判家 +判木屋 +判沢 +判治 +判澤 +判田 +判藤 +判谷 +判野 +別井 +別保 +別処 +別又 +別司 +別名 +別城 +別宗 +別宮 +別家 +別小 +別島 +別川 +別広 +別府 +別府園 +別府込 +別廣 +別当 +別当屋敷 +別役 +別惣 +別所 +別所内 +別技 +別曽 +別曾 +別木 +別本 +別村 +別東 +別枝 +別森 +別段 +別永 +別火 +別生 +別田 +別當 +別祖 +別符 +別筒 +別納 +別紙 +別縄 +別能 +別芝 +別荘 +別華 +別處 +別行 +別角 +別車 +別部 +別重 +別野 +別院 +別頭 +利 +利井 +利信 +利倉 +利元 +利光 +利原 +利国 +利國 +利守 +利安 +利宮 +利尾 +利屋 +利山 +利岡 +利島 +利嶋 +利川 +利広 +利廣 +利弘 +利志 +利木 +利末 +利本 +利村 +利根 +利根屋 +利根山 +利根川 +利根木 +利根沢 +利根澤 +利根田 +利森 +利水 +利江 +利波 +利浪 +利満 +利田 +利行 +利見 +利谷 +利部 +利重 +利野 +利長 +到津 +制野 +券田 +刺刀 +刺又 +刺田 +刺賀 +刺野 +剃田 +則 +則久 +則井 +則俊 +則保 +則信 +則元 +則光 +則兼 +則内 +則包 +則友 +則吉 +則安 +則宗 +則定 +則家 +則尾 +則岡 +則島 +則川 +則常 +則広 +則座 +則房 +則政 +則月 +則木 +則末 +則本 +則村 +則松 +則枝 +則次 +則正 +則武 +則永 +則清 +則満 +則生 +則田 +則皮 +則盛 +則直 +則竹 +則藤 +則行 +則貞 +則近 +則重 +則野 +則金 +則長 +則頭 +剌刀 +剌田 +前 +前ケ迫 +前ノ園 +前ノ坊 +前丁田 +前三盛 +前上 +前上城 +前上里 +前上門 +前下 +前並 +前中 +前中尾 +前久 +前久保 +前之原 +前之園 +前之浜 +前之濱 +前之薗 +前井 +前井出 +前井手 +前亦 +前仏 +前代 +前仲 +前仲里 +前仲門 +前伊 +前伊礼門 +前住 +前佐嘉伊 +前佛 +前保 +前信 +前倉 +前側 +前元 +前先 +前光 +前兼久 +前内 +前内原 +前冨 +前冨里 +前出 +前刀 +前切 +前利 +前加良 +前勝 +前勢 +前北 +前南 +前原 +前友 +前反 +前口 +前古 +前司 +前吉 +前名 +前向 +前和田 +前喜 +前嘉保 +前国 +前国藤 +前囿 +前國 +前園 +前土井 +前土佐 +前土居 +前土肥 +前地 +前坂 +前坊 +前坪 +前垣 +前垣内 +前垰 +前城 +前埜 +前堀 +前堂 +前場 +前塘 +前塚 +前外間 +前多 +前夛 +前大 +前大舛 +前大路 +前大道 +前夷 +前奥 +前宇根 +前宇根底 +前安井 +前定 +前室 +前宮 +前家 +前富 +前富里 +前寺 +前小屋 +前小田 +前小路 +前尾 +前屋 +前屋敷 +前屋舗 +前山 +前山田 +前岑 +前岡 +前岨 +前岩 +前岬 +前岳 +前岸 +前峠 +前峯 +前峰 +前島 +前崎 +前嵜 +前嵩 +前嵩西 +前嶋 +前嶌 +前川 +前川内 +前川原 +前川尻 +前市 +前市岡 +前平 +前幸地 +前広 +前床 +前底 +前座 +前座領 +前庭 +前廣 +前延 +前当 +前後 +前徳 +前徳比嘉 +前成 +前我名 +前戸 +前所 +前手 +前掘 +前提 +前敷 +前新 +前新城 +前新屋 +前新門 +前方 +前明力 +前時 +前更 +前木 +前木場 +前末 +前末宗 +前本 +前杉 +前村 +前条 +前杢 +前東 +前松 +前松田 +前板 +前林 +前枝 +前柳 +前柴 +前根 +前條 +前梶 +前棚原 +前森 +前森田 +前楚 +前横 +前横山 +前樫 +前樽 +前橋 +前正 +前此 +前武当 +前武田 +前武當 +前段 +前殿 +前比嘉 +前水流 +前永 +前江 +前江田 +前池 +前池味 +前沖 +前沢 +前河 +前河内 +前河原 +前河土 +前沼 +前泉 +前泊 +前波 +前津 +前津宗 +前浜 +前浜盛 +前浜門 +前浦 +前浪 +前海 +前淵 +前添 +前渋 +前渕 +前満 +前溝 +前滝 +前潟 +前澁 +前澤 +前濱 +前濱門 +前瀉 +前瀧 +前瀬 +前牟田 +前玉 +前瓦 +前田 +前田原 +前田場 +前田島 +前田河 +前田盛 +前田谷 +前甲 +前甸 +前畑 +前畔 +前畠 +前當 +前登野城 +前盛 +前矢 +前石 +前石垣 +前石野 +前砂 +前硲 +前神 +前祢 +前窪 +前端 +前竹 +前籔 +前粟蔵 +前粟藏 +前納 +前羽 +前背戸 +前脇 +前脊戸 +前船 +前船道 +前良 +前芝 +前花 +前芽 +前茂 +前葉 +前蔵 +前薗 +前薮 +前藤 +前藪 +前衛 +前表 +前西 +前西原 +前見 +前角 +前角地 +前請盛 +前谷 +前谷内 +前谷津 +前貞 +前賀 +前越 +前車 +前辻 +前迎 +前迫 +前道 +前部 +前部屋 +前郷 +前里 +前重 +前野 +前金 +前釜 +前鈍内 +前長 +前門 +前門戸 +前間 +前関 +前阪 +前防 +前陸路 +前隈 +前霍 +前須 +前須賀 +前頭 +前馬 +前高 +前鬼 +前鳩間 +前鶴 +前鹿川 +前黒島 +前鼻 +前﨏 +前𡌛 +前𡶡 +剛 +剛力 +剛家 +剛山 +剛崎 +剛生 +剛谷 +剛迫 +剣 +剣先 +剣吉 +剣地 +剣山 +剣崎 +剣持 +剣木 +剣本 +剣村 +剣熊 +剣物 +剣田 +剣荘 +剣菱 +剣重 +剤藤 +剥岩 +剥田 +副 +副万 +副井 +副住 +副山 +副島 +副嶋 +副松 +副枝 +副田 +副見 +副角 +副重 +副野 +副馬 +剱 +剱吉 +剱地 +剱宝 +剱山 +剱崎 +剱形 +剱持 +剱木 +剱本 +剱村 +剱物 +剱田 +剱荘 +剱菱 +剱谷 +剱重 +創地 +劍持 +劒 +劒地 +劒持 +劒木 +劒村 +劒物 +劒田 +劒重 +劔 +劔吉 +劔地 +劔崎 +劔持 +劔木 +劔村 +劔熊 +劔物 +劔田 +劔重 +力 +力は漢字 +力元 +力弓 +力石 +力谷 +功刃 +功力 +功家 +功能 +功野 +加 +加々井 +加々宮 +加々尾 +加々山 +加々島 +加々崎 +加々本 +加々村 +加々爪 +加々田 +加々羅 +加々美 +加々良 +加々見 +加々谷 +加々路 +加々野井 +加ケ崎 +加ケ嵜 +加ケ美 +加䦰 +加䦰山 +加䰗 +加䰗山 +加三 +加上 +加下 +加下井 +加世 +加世井 +加世堂 +加世多 +加世木 +加世田 +加中 +加久 +加久保 +加久本 +加久田 +加久石 +加久見 +加久間 +加九 +加二倉 +加二谷 +加五元 +加井 +加井妻 +加井野 +加仁 +加代 +加仲 +加住 +加佐 +加佐利 +加佐原 +加佐見 +加來 +加來野 +加保 +加信 +加倉 +加倉井 +加倉田 +加儀 +加光 +加児 +加児島 +加兒 +加内 +加冶 +加冶佐 +加冶屋 +加冶木 +加冷 +加利 +加利屋 +加利川 +加利部 +加力 +加加山 +加加美 +加勇田 +加勢 +加勢山 +加勢川 +加勢本 +加勢熊 +加勢田 +加千須 +加原 +加友 +加反 +加取 +加口 +加古 +加古井 +加古原 +加古屋 +加古山 +加古川 +加古田 +加古藤 +加古谷 +加可谷 +加司 +加司山 +加名山 +加名生 +加名田 +加向 +加味 +加味根 +加和 +加唐 +加固 +加国 +加國 +加園 +加土 +加土井 +加地 +加地屋 +加坂 +加城 +加埜 +加執 +加堂 +加場 +加塚 +加塩 +加増 +加増利 +加多 +加多上 +加多木 +加多納 +加多駄 +加太 +加奈山 +加奈川 +加奈森 +加奈谷 +加奥 +加好 +加姓 +加子 +加子坂 +加子崎 +加宅田 +加守 +加守田 +加室 +加宮 +加家 +加家壁 +加富 +加寿 +加小 +加小川 +加尻 +加尾 +加尾谷 +加屋 +加屋本 +加屋野 +加山 +加岳井 +加峯 +加峰 +加島 +加島谷 +加崎 +加嵜 +加嶋 +加嶌 +加川 +加州 +加差野 +加己野 +加巳野 +加市 +加布里 +加帳面 +加幡 +加幸 +加府藤 +加度 +加座 +加庭 +加弓 +加当 +加形 +加後 +加徳 +加志 +加志崎 +加志川 +加志村 +加志田 +加志畑 +加恵 +加恵田 +加悦 +加成 +加我 +加戸 +加戸川 +加持 +加持谷 +加数 +加文 +加文字 +加斗 +加旗 +加星 +加智 +加曽利 +加曽我 +加曽里 +加曾利 +加月 +加木 +加木元 +加木場 +加木屋 +加木谷 +加末 +加本 +加朱 +加村 +加条 +加来 +加来田 +加来野 +加東 +加松 +加林 +加柴 +加栗 +加根 +加根元 +加根川 +加根村 +加根田 +加根魯 +加森 +加椎 +加楽 +加櫓 +加欄 +加次 +加次井 +加武 +加武田 +加毛 +加毛田 +加永 +加江 +加沢 +加河 +加治 +加治井 +加治佐 +加治前 +加治原 +加治堀 +加治家 +加治屋 +加治山 +加治川 +加治工 +加治木 +加治本 +加治村 +加治矢 +加治谷 +加治野 +加治間 +加治馬 +加沼 +加波 +加波沢 +加津 +加津山 +加津間 +加洲 +加涌 +加淵 +加添 +加清 +加渕 +加減 +加渡 +加渡田 +加満多 +加澤 +加濃 +加瀬 +加瀬井 +加瀬川 +加瀬林 +加瀬沢 +加瀬澤 +加瀬田 +加瀬谷 +加瀬部 +加瀬野 +加瀬間 +加無木 +加狭 +加王 +加生 +加用 +加田 +加田山 +加田岡 +加田平 +加田木 +加田野 +加甲 +加畑 +加留 +加留部 +加畠 +加番 +加當 +加登 +加登井 +加登住 +加登屋 +加登山 +加登岡 +加登島 +加登川 +加登本 +加登林 +加登田 +加登脇 +加登舎 +加登見 +加登谷 +加登野 +加百 +加盛 +加相 +加知 +加知下 +加知方 +加祢山 +加祥 +加福 +加禰山 +加科 +加立 +加竜 +加端 +加笠 +加筑 +加篭六 +加籏 +加籐 +加籠 +加籠六 +加糠 +加納 +加納井 +加納川 +加納江 +加納谷 +加統 +加羅 +加羅利 +加羅川 +加羅田 +加美 +加美台 +加美山 +加美川 +加美田 +加美谷 +加美野 +加美長 +加羽 +加羽沢 +加羽澤 +加老戸 +加耒 +加聖 +加胡川 +加能 +加舍 +加舎 +加良 +加良谷 +加芝 +加芽田 +加苅 +加茂 +加茂下 +加茂井 +加茂前 +加茂坂 +加茂宮 +加茂尾 +加茂川 +加茂田 +加茂谷 +加茂部 +加茂野 +加荘 +加菅 +加葉田 +加蔵 +加藏 +加藤 +加藤子 +加藤岡 +加藤川 +加藤州 +加藤木 +加藤洲 +加藤海 +加藤田 +加蘭 +加行 +加西 +加見 +加見谷 +加規 +加覧 +加覽 +加角 +加計 +加計本 +加護 +加護谷 +加護野 +加谷 +加貫 +加賀 +加賀井 +加賀其 +加賀利 +加賀原 +加賀和 +加賀城 +加賀妻 +加賀宇 +加賀宮 +加賀家 +加賀尾 +加賀屋 +加賀山 +加賀崎 +加賀川 +加賀度 +加賀本 +加賀林 +加賀江 +加賀沢 +加賀沼 +加賀澤 +加賀瀬 +加賀為 +加賀爪 +加賀田 +加賀登 +加賀矢間 +加賀羅 +加賀美 +加賀美山 +加賀良 +加賀落 +加賀藤 +加賀見 +加賀谷 +加賀野 +加賀野井 +加越 +加路 +加輪上 +加辺 +加辻 +加迫 +加連 +加連川 +加進 +加運 +加道 +加道川 +加邉 +加邊 +加那原 +加那屋 +加部 +加部東 +加部藤 +加郷 +加里 +加里本 +加重 +加野 +加野井 +加野岡 +加野島 +加野嶋 +加長川 +加門 +加門堂 +加間 +加附 +加陽 +加隅 +加隈 +加隝 +加集 +加順 +加須井 +加須屋 +加須我 +加須栄 +加須榮 +加須賀 +加頭 +加養 +加香 +加鬮 +加鬮山 +加鳥 +加鹿 +加麻 +加鼻 +加龍 +助中 +助乗 +助乘 +助井 +助代 +助佐 +助佐美 +助供 +助信 +助元 +助光 +助内 +助則 +助原 +助友 +助口 +助台 +助吉 +助名 +助国 +助國 +助塚 +助守田 +助安 +助宗 +助定 +助実 +助宮 +助寅 +助實 +助岡 +助島 +助崎 +助嶋 +助川 +助工 +助平 +助広 +助座 +助廣 +助弘 +助成 +助政 +助木 +助本 +助村 +助松 +助森 +助永 +助沢 +助清 +助澤 +助田 +助畑 +助石 +助籐 +助臺 +助藤 +助谷 +助貞 +助迫 +助道 +助重 +助野 +助金 +助長 +助間 +助飛羅 +努力 +励 +励波 +勅丁 +勅使 +勅使ケ原 +勅使原 +勅使川 +勅使川原 +勅使河原 +勅使瓦 +勅史河原 +勇 +勇ノ上 +勇上 +勇井 +勇伊 +勇元 +勇内 +勇内山 +勇利 +勇勢 +勇原 +勇地 +勇塚 +勇士 +勇宮 +勇家 +勇尾 +勇山 +勇島 +勇崎 +勇川 +勇左 +勇徳 +勇惣 +勇我 +勇木 +勇本 +勇村 +勇林 +勇樹 +勇次 +勇水 +勇永 +勇沢 +勇海 +勇生 +勇田 +勇知 +勇美 +勇見 +勇谷 +勇都 +勇野 +勇野喜 +勇金 +勉 +動山 +動木 +動橋 +動田 +動道 +動音 +勘 +勘七 +勘久保 +勘代 +勘伝 +勘佐 +勘傳 +勘元 +勘六野 +勘原 +勘図 +勘坂 +勘場 +勘場瀬 +勘塲 +勘奥 +勘如 +勘定 +勘家 +勘屋 +勘山 +勘島 +勘崎 +勘川 +勘左 +勘平 +勘座 +勘才 +勘木 +勘村 +勘林 +勘沢 +勘澤 +勘甚 +勘田 +勘田口 +勘米良 +勘納 +勘者 +勘舎 +勘藤 +勘角 +勘解 +勘解由 +勘解由小路 +勘迫 +勘造 +勘那 +勘部 +勘里 +勘野 +勘間 +勘𡌛 +務中 +務仲 +務台 +務川 +務臺 +勝 +勝上 +勝下 +勝世 +勝並 +勝中 +勝丸 +勝久 +勝乗 +勝乘 +勝二 +勝井 +勝亦 +勝代 +勝佐 +勝俣 +勝倉 +勝元 +勝円 +勝冨 +勝冶 +勝利 +勝力 +勝占 +勝原 +勝又 +勝叉 +勝取 +勝口 +勝吉 +勝呂 +勝命 +勝喜 +勝地 +勝坂 +勝城 +勝埜 +勝埼 +勝堂 +勝場 +勝好 +勝守 +勝宮 +勝家 +勝尾 +勝居 +勝屋 +勝山 +勝岐 +勝岡 +勝峯 +勝峰 +勝島 +勝崎 +勝嵜 +勝嶋 +勝嶌 +勝川 +勝平 +勝幸 +勝弘 +勝志 +勝戸 +勝扇 +勝手 +勝摩 +勝政 +勝文子 +勝方 +勝木 +勝木屋 +勝木田 +勝本 +勝村 +勝林 +勝枝 +勝柴 +勝根 +勝森 +勝楽 +勝樂 +勝正 +勝武 +勝毛 +勝水 +勝永 +勝江 +勝池 +勝沢 +勝河 +勝治 +勝沼 +勝泉 +勝津 +勝浜 +勝浦 +勝浪 +勝海 +勝澤 +勝濱 +勝瀬 +勝然 +勝瑞 +勝田 +勝男 +勝畑 +勝盛 +勝目 +勝眞 +勝真 +勝矢 +勝知 +勝碕 +勝磯 +勝箆 +勝箭 +勝篦 +勝羅 +勝美 +勝羽 +勝股 +勝良 +勝芝 +勝花 +勝葉 +勝藤 +勝裕 +勝西 +勝見 +勝谷 +勝負沢 +勝負澤 +勝賀 +勝賀瀬 +勝賀野 +勝越 +勝身 +勝辺 +勝連 +勝進 +勝部 +勝里 +勝重 +勝野 +勝野井 +勝長 +勝間 +勝間田 +勝間谷 +勝馬 +勝馬田 +募井 +勢 +勢〆 +勢一 +勢万 +勢上 +勢井 +勢力 +勢原 +勢口 +勢古 +勢古口 +勢司 +勢合 +勢喜 +勢堂 +勢塒 +勢多 +勢子 +勢家 +勢尾 +勢屋 +勢山 +勢島 +勢嶋 +勢川 +勢州谷 +勢志 +勢戸 +勢料 +勢旗 +勢木 +勢村 +勢柄 +勢水 +勢津 +勢渡 +勢溜 +勢濃 +勢瀬 +勢理客 +勢田 +勢畑 +勢登 +勢石 +勢礼 +勢禮 +勢籏 +勢納 +勢羅 +勢羽 +勢能 +勢至 +勢良 +勢藤 +勢見 +勢見月 +勢賀 +勢起 +勢越 +勢造 +勢郷 +勢野 +勢間 +勢頭 +勢馬 +勤息 +勤桑 +勧修寺 +勧夕 +勧学 +勧山 +勧師 +勧農 +勧野 +勵 +勸夕 +勸山 +勸野 +勺代 +勾坂 +勾梅 +勾田 +勿来 +匂坂 +匂山 +匂末 +匂梅 +匂阪 +包 +包原 +包吉 +包国 +包國 +包城 +包子 +包守 +包山 +包末 +包本 +包松 +包清 +包行 +包重 +化生 +化田 +化粧坂 +北 +北ケ崎 +北ケ嵜 +北ケ市 +北ノ上 +北ノ内 +北ノ原 +北ノ又 +北ノ口 +北ノ園 +北ノ坊 +北ノ浦 +北ノ薗 +北ノ門 +北ノ間 +北一 +北七 +北上 +北上田 +北下 +北世 +北中 +北丸 +北久 +北久保 +北之 +北之上 +北之内 +北之原 +北之口 +北之園 +北之坊 +北之橋 +北之薗 +北之迫 +北之間 +北之防 +北之馬 +北乗 +北乘 +北乾 +北亀 +北井 +北井上 +北井崎 +北亦 +北代 +北仲 +北住 +北佐古 +北作 +北保 +北俣 +北倉 +北側 +北億 +北元 +北先 +北光 +北八 +北八代 +北内 +北冨 +北出 +北出谷 +北分 +北別府 +北前 +北勝 +北升 +北南 +北原 +北又 +北友 +北受 +北口 +北古 +北古味 +北古賀 +北句 +北台 +北吉 +北名 +北向 +北吹 +北和田 +北喜 +北嘉多 +北国 +北国谷 +北囿 +北圃 +北國 +北國谷 +北園 +北土井 +北地 +北坂 +北坊 +北坪 +北垣 +北垣内 +北垣外 +北垣戸 +北城 +北城戸 +北埜 +北基 +北堀 +北堂 +北場 +北塔 +北塚 +北外 +北多條 +北大宅 +北大路 +北奥 +北奧 +北子 +北学 +北宅 +北守 +北安 +北宗 +北室 +北宮 +北家 +北宿 +北寄崎 +北密 +北富 +北寒寺 +北寺 +北小屋 +北小矢 +北小路 +北尻 +北尾 +北尾根 +北居 +北屋 +北屋敷 +北屋根 +北山 +北岑 +北岡 +北岩 +北岸 +北峪 +北峯 +北峰 +北島 +北崎 +北嵐 +北嵜 +北嶋 +北嶌 +北嶺 +北川 +北川内 +北川原 +北市 +北市屋 +北幅 +北平 +北平地 +北広 +北庄 +北庄司 +北床 +北座 +北廣 +北張 +北形 +北後 +北得 +北御門 +北恵 +北惠 +北戸 +北所 +北扇 +北折 +北掘 +北政 +北斗 +北新 +北新居 +北方 +北明 +北星 +北時 +北木 +北本 +北朴木 +北杉 +北村 +北村谷 +北束 +北条 +北来 +北東 +北東部 +北松 +北林 +北枝 +北枡 +北柳 +北柴 +北柿 +北栃 +北栄 +北株 +北根 +北桜 +北桝 +北梅 +北條 +北梶 +北森 +北植 +北楠 +北楯 +北榮 +北構 +北樋口 +北橋 +北檀 +北次 +北正 +北殿 +北氏 +北水 +北永 +北江 +北池 +北沖 +北沢 +北河 +北河原 +北治 +北沼 +北泉 +北泊 +北波 +北洞 +北津留 +北浜 +北浦 +北浪 +北海 +北淵 +北添 +北清 +北清水 +北渕 +北渡瀬 +北湊 +北湯口 +北満 +北溝 +北滝 +北潟 +北潟谷 +北澄 +北澗 +北澤 +北濃 +北濱 +北瀉 +北瀬 +北焼 +北熊 +北熨斗 +北爪 +北片 +北牧 +北王 +北瓜 +北生 +北田 +北田井 +北田代 +北町 +北畑 +北留 +北畠 +北番 +北白 +北白川 +北目 +北相模 +北眞 +北真 +北矢 +北石 +北砂 +北磯 +北神 +北福 +北福智 +北秋 +北窓 +北窪 +北竜 +北端 +北竹 +北筋 +北箸 +北篠 +北籔 +北紺 +北組 +北絛 +北総 +北緒 +北總 +北織 +北纓 +北羅 +北股 +北能 +北脇 +北臺 +北舎 +北舘 +北舛 +北良 +北芝 +北花 +北荒井 +北荘 +北落 +北薗 +北薮 +北藤 +北藪 +北虎 +北行 +北袋 +北裏 +北西 +北見 +北角 +北詰 +北誥 +北谷 +北谷内 +北谷戸 +北谿 +北賀 +北起 +北越 +北路 +北輪 +北辰 +北農 +北辺 +北辻 +北迫 +北逵 +北道 +北邑 +北邨 +北郡 +北部 +北郷 +北里 +北重 +北野 +北野上 +北野井 +北野原 +北野又 +北野口 +北野沢 +北野澤 +北野谷 +北長 +北門 +北間 +北関 +北阪 +北防 +北陸 +北陽 +北隅 +北際 +北雑 +北面 +北須賀 +北風 +北飯 +北館 +北馬 +北馬越 +北高野 +北鬼江 +北鳴 +北鶴 +北鹿渡 +北黒 +北龍 +北𡌛 +北𦚰 +匝嵯 +匝瑳 +匠 +匠内 +匠原 +匠田 +匠間 +匹 +匹本 +匹田 +匹野 +区藤 +医山 +医王 +医王田 +區藤 +十々木 +十ノ目 +十一 +十一家 +十一谷 +十七 +十七夜月 +十七女 +十七部 +十七里 +十万 +十三 +十中 +十丸 +十久保 +十九川 +十九本 +十九波 +十九浦 +十九百 +十亀 +十二 +十二丁 +十二役 +十二所 +十二村 +十二林 +十二町 +十二谷 +十二里 +十二野 +十五 +十代 +十代田 +十住 +十佐近 +十信田 +十倉 +十倍 +十八 +十八公 +十八日 +十六原 +十六沢 +十六澤 +十前 +十十木 +十南 +十原 +十司 +十合 +十名 +十和 +十和田 +十場 +十塚 +十字 +十家 +十屋 +十山 +十島 +十川 +十左近 +十市 +十府 +十役 +十徳 +十志田 +十念 +十手山 +十持 +十握 +十文字 +十日市 +十日谷 +十時 +十朱 +十村 +十束 +十条 +十松 +十林 +十枝 +十枝内 +十根川 +十森 +十楚 +十楽 +十楽寺 +十河 +十津 +十津川 +十玉 +十王 +十王寺 +十王舘 +十王館 +十田 +十石 +十祖 +十神 +十良 +十良沢 +十良澤 +十菱 +十萬 +十蔵寺 +十蟹 +十見 +十角 +十輪地 +十返 +十連地 +十郎 +十部 +十都 +十重田 +十野 +十門地 +十阿弥 +十阿彌 +十露木 +十鳥 +千 +千々和 +千々岩 +千々布 +千々木 +千々村 +千々松 +千々波 +千々石 +千々谷 +千々輪 +千々部 +千々野 +千が崎 +千ケ崎 +千ノ木 +千ノ本 +千万 +千丈 +千三木 +千上 +千且 +千並 +千中 +千丸 +千久田 +千久谷 +千久間 +千之巣 +千之木 +千之本 +千井 +千井野 +千京 +千仏 +千代 +千代世 +千代丸 +千代住 +千代倉 +千代原 +千代反田 +千代園 +千代坂 +千代山 +千代岡 +千代島 +千代崎 +千代川 +千代延 +千代政 +千代木 +千代本 +千代村 +千代松 +千代森 +千代樵 +千代永 +千代沢 +千代浦 +千代澤 +千代田 +千代留 +千代盛 +千代窪 +千代薗 +千代藤 +千代西尾 +千代谷 +千代野 +千代間 +千代鶴 +千伝 +千住 +千佐 +千保 +千保木 +千俵 +千倉 +千傳 +千僧供 +千先 +千光 +千光士 +千光寺 +千児島 +千切 +千切谷 +千刈 +千利浜 +千利濱 +千割 +千力 +千勝 +千北 +千千和 +千千松 +千千波 +千千石 +千千輪 +千原 +千口 +千古 +千台 +千司 +千合 +千吉良 +千同 +千名 +千名原 +千味 +千品 +千喜田 +千喜良 +千国 +千國 +千土 +千地 +千地丸 +千地岩 +千坂 +千坊 +千垣内 +千城 +千埜 +千堂 +千場 +千塚 +千塲 +千壽 +千多 +千守 +千安 +千室 +千家 +千寺丸 +千寿 +千尋 +千尺 +千尾 +千屋 +千山 +千島 +千崎 +千嵐 +千嵜 +千嶋 +千嶌 +千巌 +千巖 +千川 +千川原 +千巣 +千布 +千年 +千年原 +千年屋 +千広 +千廣 +千引 +千後 +千後滝 +千後瀧 +千徳 +千応山 +千應山 +千成 +千戝 +千房 +千手 +千手間 +千才 +千把 +千抦 +千振 +千斛 +千日 +千日坂 +千旦 +千早 +千明 +千星 +千智岩 +千智松 +千曳 +千月 +千木 +千木崎 +千木穂 +千木良 +千木里 +千木野 +千本 +千本木 +千本松 +千朿 +千杉 +千村 +千束 +千条 +千東 +千松 +千林 +千枝 +千柄 +千根 +千桐 +千桜 +千桝 +千條 +千棒 +千森 +千檀 +千櫻 +千正 +千歩 +千歳 +千歳丸 +千水 +千江 +千沢 +千沢口 +千河 +千治松 +千波 +千津井 +千浜 +千浦 +千海 +千滝 +千澤 +千澤口 +千濱 +千烝 +千焏 +千熊 +千玉 +千生 +千田 +千田口 +千田谷 +千町 +千畑 +千疋 +千登勢 +千百松 +千盤 +千目 +千眼 +千矢 +千知 +千知岩 +千知松 +千知波 +千石 +千石谷 +千神 +千福 +千福地 +千秋 +千種 +千穐 +千竃 +千竈 +千竜 +千端 +千笠 +千管 +千籐 +千絛 +千綾 +千綿 +千羽 +千股 +千能 +千脇 +千舘 +千舩 +千船 +千艘 +千良 +千色 +千艸 +千苅 +千草 +千菅 +千菊 +千葉 +千葉井 +千葉原 +千葉山 +千葉崎 +千葉東 +千葉桜 +千葉櫻 +千蒲 +千蔵 +千藏 +千藤 +千虎 +千行 +千装 +千見寺 +千覚原 +千谷 +千貝 +千財 +千財丸 +千貫 +千賀 +千賀浦 +千足 +千車 +千載 +千輝 +千輪 +千速 +千道 +千達 +千邑 +千部 +千郷 +千酌 +千里 +千里久 +千里内 +千重 +千野 +千野原 +千野根 +千野田 +千野辺 +千金 +千金楽 +千金良 +千釜 +千間 +千阪 +千陽 +千隝 +千須和 +千頭 +千頭井 +千頭和 +千香 +千馬 +千駄 +千高 +千鳥 +千鶴 +千鹿野 +千龍 +千𥧄 +升 +升ノ内 +升一 +升久 +升也 +升井 +升倉 +升元 +升光 +升内 +升冨 +升原 +升吉 +升味 +升国 +升國 +升守 +升家 +升富 +升尾 +升居 +升屋 +升山 +升岡 +升島 +升崎 +升川 +升巴 +升市 +升平 +升広 +升廣 +升形 +升成 +升掛 +升方 +升明 +升星 +升木 +升本 +升村 +升森 +升水 +升永 +升沢 +升淵 +升添 +升渕 +升潟 +升澤 +升田 +升箕 +升舘 +升行 +升見 +升谷 +升賀 +升迫 +升重 +升野 +升金 +升鏡 +升間 +升館 +午上 +午井淵 +午來 +午坊 +午堂 +午居 +午市 +午庵 +午房 +午房崎 +午来 +午耒 +午腸 +午膓 +午菴 +午角 +午賜 +午道 +午除 +午頭 +午鼻 +半 +半が石 +半ケ石 +半ノ +半上野 +半下石 +半中 +半井 +半井野 +半仁田 +半代 +半保 +半内 +半原 +半司 +半名 +半坂 +半埜 +半場 +半塚 +半塲 +半夏 +半妙 +半山 +半崎 +半嶺 +半川 +半左 +半座 +半情 +半戸 +半揚 +半日 +半明 +半晴 +半月 +半木 +半本 +半村 +半杭 +半林 +半根 +半永 +半沢 +半治 +半泊 +半波 +半洲毛 +半浦 +半浴 +半海 +半渡 +半澤 +半瀬 +半田 +半田山 +半畑 +半白 +半矢 +半羽 +半能 +半蔀 +半藤 +半谷 +半貫 +半辺 +半道 +半邉 +半邊 +半那 +半部 +半野 +半野田 +半間 +半阪 +卍山下 +卒場石 +卒田 +卒間 +卓 +卓地 +卓山 +卓田 +卓間 +卓馬 +南 +南ノ園 +南上 +南上田 +南下 +南丘 +南中 +南中道 +南久保 +南久松 +南之原 +南之園 +南井 +南井上 +南井之上 +南京 +南京極 +南仙 +南代 +南任 +南佐 +南保 +南倉 +南側 +南儀 +南元 +南光 +南光坊 +南光院 +南免羅 +南八重 +南内 +南出 +南利 +南前 +南勝 +南北 +南原 +南口 +南古 +南合 +南吉 +南向 +南君 +南国 +南園 +南土居 +南土手 +南地 +南坂 +南坂本 +南坊 +南坊城 +南坪 +南垣 +南垣内 +南城 +南埜 +南埼 +南堀 +南堂 +南場 +南塚 +南塲 +南壽 +南外 +南大林 +南大津 +南大谷 +南大路 +南奉 +南奥 +南子 +南孝 +南学 +南學 +南宅 +南官 +南室 +南宮 +南家 +南寺 +南寿 +南小柿 +南小路 +南尾 +南居 +南屋 +南屋敷 +南山 +南岡 +南岩 +南岳 +南岳院 +南岸 +南峠 +南島 +南崎 +南嵜 +南嶋 +南川 +南巾 +南市 +南幅 +南平 +南幸 +南庄 +南形 +南後 +南志 +南戸 +南房 +南所 +南手 +南指原 +南摩 +南文 +南斉 +南斎 +南新 +南方 +南施 +南日 +南明 +南星 +南晴 +南曇 +南曲 +南有田 +南木 +南木野 +南本 +南朴木 +南村 +南条 +南東 +南松 +南林 +南柿 +南桑 +南條 +南梨 +南森 +南業 +南極 +南橋 +南正覚 +南正覺 +南殿 +南氏 +南水 +南江 +南池 +南沢 +南河 +南治 +南泉 +南法 +南波 +南波佐間 +南波留 +南洞 +南津 +南浜 +南浦 +南浮 +南浴 +南海 +南涛 +南淵 +南清 +南渕 +南湖 +南漁 +南潟 +南澤 +南濃 +南濤 +南濱 +南瀬 +南無 +南無納 +南牟礼 +南牟禮 +南玉利 +南理 +南生 +南田 +南畑 +南畝 +南百瀬 +南目 +南石 +南磨 +南祇 +南種 +南立 +南端 +南竹 +南笹崎 +南篠 +南義 +南羽 +南羽坪 +南脇 +南舎 +南舘 +南良 +南良原 +南艸 +南茂 +南草 +南荘 +南葉 +南蔭 +南薗 +南藤 +南藪 +南裏 +南西 +南見 +南角 +南詰 +南谷 +南賀 +南越 +南路 +南辺山 +南辺(南邊) +南辻 +南迫 +南道 +南達 +南部 +南部谷 +南郷 +南郷谷 +南都 +南里 +南野 +南金山 +南門 +南開 +南間 +南阪 +南阪本 +南院 +南陽 +南隅 +南隣 +南雑 +南雜 +南雲 +南面 +南面良 +南須原 +南風 +南風原 +南風成 +南風本 +南風盛 +南風立 +南風見 +南風里 +南風野 +南館 +南馬 +南馬越 +南高 +南鶴 +南黒沢 +南黒澤 +南齋 +博 +博久 +博井 +博多 +博多屋 +博夛 +博山 +博本 +博田 +博野 +卜井 +卜倉 +卜半 +卜木 +卜沢 +卜澤 +卜田 +卜蔵 +卜藏 +卜辺 +卜部 +占掛 +占部 +占野 +卯ノ木 +卯ノ田 +卯ノ花 +卯中 +卯之原 +卯之木 +卯之沢 +卯之澤 +卯之田 +卯休 +卯余野 +卯元 +卯内 +卯原 +卯名根口 +卯善 +卯図 +卯坂 +卯坪 +卯城 +卯埜 +卯塚 +卯子沢 +卯子澤 +卯尾 +卯尾田 +卯山 +卯島 +卯崎 +卯嶋 +卯川 +卯月 +卯月原 +卯木 +卯本 +卯松 +卯柳 +卯江 +卯沢 +卯津江 +卯津羅 +卯滝 +卯澤 +卯瀧 +卯田 +卯目 +卯花 +卯薄 +卯西 +卯路 +卯辰 +卯道 +卯都木 +卯里 +卯野 +卯野山 +卯野木 +卯野浜 +卯野濱 +卯野田 +印 +印丸 +印具 +印出 +印出井 +印南 +印口 +印吟 +印塚 +印宮 +印居 +印山 +印幡 +印平 +印旛 +印束 +印東 +印河 +印波 +印浪 +印牧 +印田 +印籐 +印藤 +印貢 +印道 +印遠 +印部 +印野 +印銀 +印鑰 +印頭 +即城 +即席 +即真 +却野 +卷 +卷口 +卷本 +卸川 +厂原 +厂木 +厂金 +厚 +厚ケ瀬 +厚主 +厚井 +厚別 +厚原 +厚味 +厚喜 +厚地 +厚坂 +厚坊 +厚山 +厚川 +厚志 +厚木 +厚朴 +厚村 +厚東 +厚森 +厚楽 +厚樂 +厚母 +厚毛 +厚沢 +厚治 +厚浦 +厚海 +厚澤 +厚狭 +厚狭野 +厚狹 +厚田 +厚畑 +厚目 +厚石 +厚綿 +厚緜 +厚美 +厚芝 +厚見 +厚谷 +厚賀 +原 +原ノ園 +原ノ後 +原上 +原下 +原中 +原之下 +原之園 +原之後 +原之村 +原之薗 +原井 +原井川 +原代 +原仲 +原住 +原信田 +原元 +原先 +原光 +原内 +原冨 +原出 +原前 +原勢 +原北 +原口 +原吉 +原名 +原品 +原国 +原囿 +原國 +原園 +原土 +原地 +原坂 +原垣 +原垣内 +原城 +原埜 +原塚 +原多 +原子 +原子内 +原富 +原寺 +原尻 +原尾 +原屋 +原屋敷 +原山 +原岡 +原島 +原崎 +原嵜 +原嶋 +原嶌 +原川 +原巻 +原市 +原平 +原廻 +原弥 +原後 +原戸 +原明 +原木 +原本 +原村 +原条 +原東 +原松 +原林 +原根 +原梶 +原森 +原槇 +原槙 +原橋 +原武 +原殿 +原毛 +原水 +原永 +原江 +原池 +原沢 +原河 +原沼 +原津 +原浜 +原浦 +原淵 +原添 +原渕 +原澤 +原濱 +原瀬 +原熊 +原生 +原田 +原田口 +原田平 +原町 +原畑 +原留 +原畠 +原目 +原矢 +原石 +原神 +原祢 +原禰 +原科 +原竹 +原笹 +原篠 +原納 +原紺 +原背 +原脇 +原脊 +原良 +原良田 +原茂 +原薗 +原藤 +原衛 +原西 +原見 +原谷 +原賀 +原越 +原農 +原辺 +原迫 +原邊 +原部 +原郷 +原重 +原野 +原野谷 +原間 +原間井 +原頭 +原馬 +原黄 +厨 +厨井 +厨司 +厨子 +厨子井 +厨屋 +厨川 +厩 +厩所 +厩本 +厩橋 +厳主 +厳原 +厳城 +厳島 +厳嶋 +厳本 +厳樫 +厳田 +厳見 +去來川 +去川 +去来川 +去渡 +去田 +去石 +去耒川 +去間 +参 +参三 +参上 +参宮 +参島 +参川 +参成 +参木 +参沢 +参河 +参澤 +参田 +参納 +参谷 +参輪 +参郷 +参鍋 +參宮 +又 +又㘴 +又丸 +又井 +又刈 +又原 +又口 +又吉 +又地 +又坂 +又城 +又場 +又多 +又居 +又山 +又川 +又市 +又平 +又座 +又打 +又曽 +又木 +又村 +又来 +又森 +又江 +又江原 +又田 +又畔 +又羽 +又耒 +又葉 +又見 +又谷 +又賀 +又農 +又辺 +又邊 +又部 +又重 +又野 +又間 +叉井 +叉吉 +叉城 +叉平 +叉木 +叉村 +叉羽 +叉見 +叉賀 +及位 +及佛 +及原 +及川 +及木 +及木田 +及森 +及河 +及生 +及田 +及能 +及谷 +及部 +及野寺 +友 +友上 +友下 +友中 +友久 +友久保 +友井 +友井川 +友井田 +友住 +友佐 +友保 +友信 +友倉 +友光 +友兼 +友冨 +友利 +友則 +友前 +友原 +友口 +友吉 +友名 +友員 +友善 +友国 +友國 +友地 +友坂 +友塚 +友好 +友守 +友安 +友宗 +友定 +友実 +友寄 +友富 +友實 +友尻 +友尾 +友居 +友屋 +友山 +友岡 +友峯 +友峰 +友島 +友崎 +友嶋 +友川 +友巻 +友師 +友常 +友平 +友広 +友座 +友廣 +友延 +友弘 +友影 +友恵 +友成 +友房 +友才 +友政 +友数 +友斉 +友方 +友時 +友景 +友木 +友木屋 +友末 +友本 +友杉 +友村 +友松 +友林 +友枝 +友染 +友栄 +友栗 +友森 +友椙 +友楽 +友次 +友正 +友武 +友歳 +友水 +友永 +友江 +友池 +友沢 +友河 +友浦 +友淵 +友添 +友清 +友渕 +友滝 +友澤 +友瀧 +友瀬 +友生 +友田 +友盛 +友直 +友眞 +友真 +友知 +友石 +友碇 +友竹 +友納 +友綱 +友縄 +友繁 +友義 +友膳 +友良 +友草 +友菊 +友葭 +友藤 +友虎 +友行 +友西 +友谷 +友貞 +友辺 +友近 +友道 +友邉 +友邊 +友部 +友里 +友重 +友野 +友金 +友長 +友附 +友高 +友鳴 +友齊 +友齋 +双代 +双佐 +双原 +双和 +双城 +双山 +双川 +双木 +双松 +双森 +双樹 +双沢 +双津 +双澤 +双田 +双畑 +双知 +双石 +双紙 +双菊 +双葉 +双見 +双道 +双郷 +双里 +双須 +反 +反り目 +反リ目 +反中 +反保 +反信 +反口 +反吉 +反圃 +反尾 +反岡 +反布 +反後 +反怖 +反房 +反方 +反木 +反本 +反橋 +反甫 +反田 +反町 +反畑 +反目 +反端 +反納 +反葉 +反迫 +反野 +反頭 +収納 +取井 +取付 +取光 +取出 +取切 +取口 +取坂 +取尾 +取屋 +取島 +取嶋 +取嶌 +取替 +取本 +取枡 +取桝 +取森 +取次 +取海 +取淵 +取渕 +取溜 +取田 +取谷 +取越 +取違 +取釜 +取附 +取香 +取鳥 +受井 +受園 +受島 +受川 +受本 +受村 +受楽院 +受水 +受瀬 +受田 +受野 +受野口 +受領 +叡南 +叢 +口 +口ノ町 +口中 +口中道 +口丸 +口之町 +口井 +口元 +口入田 +口出 +口分田 +口原 +口取 +口地 +口垣内 +口塚 +口寸保 +口尾 +口屋 +口山 +口岩 +口峯 +口川 +口広 +口廣 +口手 +口木 +口本 +口村 +口林 +口池 +口沢 +口澤 +口無 +口田 +口町 +口石 +口羽 +口脇 +口舩 +口船 +口蔵 +口藏 +口西 +口谷 +口輪 +口輪野 +口野 +口開 +古 +古々本 +古ケ谷内 +古一 +古三庄 +古上 +古下 +古世 +古世古 +古世子 +古中 +古丸 +古主 +古久井 +古久保 +古久根 +古久沢 +古久澤 +古久籐 +古亀 +古了 +古井 +古井丸 +古井地 +古井戸 +古井田 +古井神 +古京 +古仁所 +古今 +古今堂 +古仙 +古代 +古仲 +古伊万里 +古伏脇 +古伯 +古伴 +古住 +古佐 +古佐井 +古佐原 +古佐小 +古佐田 +古佐賀 +古作 +古來 +古俄 +古保 +古保志 +古保木 +古保里 +古信 +古俣 +古俵 +古倉 +古倍 +古儀 +古元 +古光 +古免 +古八 +古六 +古其 +古典田 +古内 +古冨 +古出 +古別府 +古前 +古前田 +古割 +古加原 +古勝 +古勢 +古北 +古匠 +古南 +古卿 +古原 +古厩 +古友 +古口 +古吉 +古名 +古名家 +古名手 +古君 +古吟 +古吹 +古味 +古味山 +古味輪 +古和 +古和利 +古和口 +古和田 +古和谷 +古唐戸 +古唐櫃 +古喜屋 +古国 +古国府 +古囿 +古園 +古園井 +古土 +古土井 +古土居 +古圧 +古在 +古地 +古圷 +古坂 +古坊 +古坐 +古坪 +古垣 +古垣内 +古垣外 +古垰 +古城 +古城戸 +古城門 +古埜 +古堀 +古堂 +古堅 +古堤 +古場 +古場田 +古堺 +古塘 +古塚 +古塩 +古壕 +古壽田 +古多仁 +古多部 +古大内 +古大工 +古太刀 +古奈 +古奥 +古好 +古妻 +古姓 +古婦山 +古子 +古字 +古孝 +古宅 +古宇 +古宇利 +古宇田 +古守 +古安 +古定 +古室 +古宮 +古宮山 +古家 +古家一 +古家崎 +古家後 +古家野 +古宿 +古寄 +古富 +古寺 +古寿田 +古小 +古小田 +古小路 +古小高 +古尾 +古尾谷 +古居 +古屋 +古屋仲 +古屋後 +古屋敷 +古屋本 +古屋瀬 +古屋田 +古屋舗 +古屋野 +古屋鋪 +古山 +古山田 +古岡 +古岩 +古岩井 +古岳 +古岸 +古峠 +古峨 +古峪 +古峯 +古峰 +古島 +古崎 +古嵜 +古嶋 +古嶌 +古川 +古川内 +古川原 +古川園 +古川戸 +古川端 +古川谷 +古巣 +古工 +古巻 +古市 +古市谷 +古布 +古布村 +古帰 +古幡 +古平 +古幸 +古広 +古庄 +古床 +古府 +古度 +古座 +古座岩 +古座谷 +古座野 +古庫 +古庭 +古庵 +古廏 +古廐 +古廣 +古弓 +古張 +古形 +古後 +古御堂 +古御門 +古徳 +古志 +古志根 +古志谷 +古志野 +古怒田 +古思 +古性 +古恵 +古恵良 +古惠良 +古戎 +古我 +古我地 +古我城 +古我知 +古戝 +古戸 +古手 +古手川 +古指 +古挽 +古提 +古敷谷 +古新 +古新居 +古方 +古旗 +古日山 +古明地 +古明治 +古春 +古晒 +古暮 +古曳 +古曵 +古曽 +古曽尾 +古曽志 +古曽根 +古曽部 +古曾尾 +古曾部 +古月 +古望 +古木 +古木名 +古木曽 +古末 +古本 +古杉 +古村 +古条 +古来 +古東 +古松 +古松原 +古板 +古林 +古枝 +古枡 +古柳 +古柴 +古柿 +古栃 +古栗 +古株 +古栫 +古根 +古根川 +古根村 +古桐 +古桑 +古桝 +古桧山 +古梅 +古條 +古梶 +古森 +古森谷 +古椀 +古椎 +古楠 +古槁 +古槇 +古槙 +古樋 +古樫 +古橋 +古檜山 +古櫛 +古次 +古正 +古武 +古武城 +古武家 +古歩道 +古歸 +古段 +古殿 +古比谷 +古毛 +古毛堂 +古水 +古水戸 +古永 +古永家 +古江 +古池 +古池谷 +古沖 +古沢 +古河 +古河井 +古河内 +古河原 +古河崎 +古沼 +古泉 +古泊 +古泓 +古波 +古波倉 +古波津 +古波田 +古波蔵 +古波藏 +古波鮫 +古津 +古浜 +古浦 +古海 +古淵 +古清水 +古渓 +古渕 +古渡 +古港 +古湊 +古湖 +古満 +古源 +古溝 +古溪 +古滝 +古滿 +古澄 +古澤 +古濱 +古瀧 +古瀬 +古瀬村 +古熊 +古牛田 +古牧 +古玉 +古生 +古用 +古田 +古田中 +古田原 +古田口 +古田土 +古田島 +古田嶋 +古田川 +古田部 +古甲 +古町 +古畑 +古畝 +古畠 +古白川 +古益 +古目谷 +古相 +古矢 +古矢野 +古知 +古知屋 +古知谷 +古石 +古磯 +古礒 +古神 +古神子 +古福 +古稲 +古積 +古窪 +古立 +古端 +古竹 +古笛 +古笹原 +古筆 +古箕 +古管 +古箭 +古籍 +古籏 +古籐 +古米 +古糸 +古納 +古結 +古網 +古美山 +古美門 +古羽 +古耶 +古胡 +古能 +古脇 +古至真 +古舎 +古舘 +古舞 +古船場 +古良田 +古芝 +古茂田 +古茶 +古草 +古荘 +古莊 +古菅 +古萱 +古葉 +古蒔 +古蔭 +古蔵 +古薗 +古薮 +古藏 +古藤 +古藤田 +古藤野 +古藪 +古蛇 +古行 +古衛 +古西 +古要 +古見 +古見堂 +古見山 +古見沢 +古見田 +古角 +古請 +古謝 +古谷 +古谷内 +古谷埜 +古谷島 +古谷津 +古谷田 +古谷野 +古豊 +古貝 +古財 +古賀 +古賀上 +古賀原 +古賀坂 +古賀山 +古賀林 +古賀田 +古賀野 +古起 +古越 +古跡 +古路 +古路木 +古路石 +古軸 +古輪 +古農 +古辺 +古辻 +古込 +古迫 +古道 +古道谷 +古達 +古遠 +古邊 +古邑 +古邸 +古郝 +古郡 +古部 +古部山 +古部田 +古郷 +古都 +古酒 +古酒谷 +古里 +古重 +古野 +古野本 +古野村 +古野間 +古金 +古金谷 +古針 +古鉄 +古銭 +古録 +古鍛冶 +古鍛治 +古鍜冶 +古鍜治 +古鎌 +古鐡 +古鐵 +古長 +古長谷 +古門 +古閑 +古閑丸 +古閑原 +古閑山 +古閑本 +古閑森 +古閑田 +古閑畑 +古閑迫 +古間 +古間地 +古間木 +古関 +古關 +古阜 +古阪 +古防 +古隅 +古隈 +古霜 +古鞘 +古頃 +古頭 +古飯塚 +古館 +古香 +古馬 +古高 +古鳥 +古鳥井 +古鶴 +古鷹 +古鹿 +句村 +叩 +只 +只井 +只佐 +只保 +只信 +只内 +只友 +只埜 +只安 +只宗 +只尾 +只岡 +只峰 +只川 +只左 +只平 +只政 +只木 +只本 +只村 +只松 +只森 +只津 +只浦 +只熊 +只石 +只縄 +只繩 +只羅 +只腰 +只見 +只越 +只重 +只野 +只隈 +召古 +召本 +召田 +可 +可世木 +可久 +可二生 +可信 +可児 +可児子 +可児島 +可兒 +可兒子 +可原 +可喜 +可士村 +可山 +可川 +可徳 +可愛 +可愛川 +可成 +可村 +可沼 +可瀬 +可畑 +可直 +可知 +可知井 +可藤 +可西 +可計 +可貫 +可貴 +可賀 +可部 +可部本 +可部田 +可部谷 +可部野 +可野 +可長 +可須水 +可香 +可香谷 +台 +台上 +台中 +台丸 +台丸谷 +台之尊 +台井 +台代 +台仲 +台信 +台内 +台区 +台原 +台司 +台坂 +台坐 +台堂 +台場 +台屋 +台岳 +台川 +台座 +台当 +台所 +台木 +台本 +台沖 +台田 +台納 +台良 +台蔵 +台藏 +台谷 +台越 +台部 +台野 +史野 +史陀 +右 +右ノ子 +右下 +右井 +右京 +右今 +右代 +右代谷 +右佐 +右佐林 +右働 +右内 +右原 +右城 +右寺 +右屋 +右山 +右島 +右崎 +右嶋 +右川 +右左林 +右左美 +右左見 +右幸 +右形 +右成 +右戸口 +右手 +右本 +右松 +右柳 +右梅 +右橋 +右江 +右沢 +右澤 +右田 +右畑 +右秦 +右立 +右納 +右色 +右藤 +右衛門佐 +右見 +右角 +右谷 +右近 +右遠 +右野 +右門 +右馬 +右馬ノ +右馬埜 +右馬野 +右高 +叶 +叶上 +叶世 +叶丸 +叶井 +叶光 +叶内 +叶原 +叶地 +叶城 +叶堂 +叶多 +叶居 +叶屋 +叶山 +叶岡 +叶崎 +叶川 +叶成 +叶木 +叶本 +叶松 +叶栄 +叶榮 +叶沢 +叶浦 +叶渕 +叶澤 +叶生 +叶田 +叶親 +叶谷 +叶賀 +叶迫 +叶野 +号 +号刀 +司 +司下 +司代 +司口 +司城 +司子 +司宮 +司尾 +司山 +司村 +司東 +司波 +司田 +司空 +司茂 +司跡 +司農 +司辻 +司郎丸 +司関 +司馬 +司馬名 +司馬田 +叺田 +各務 +各和 +各川 +各見 +合ケ坪 +合中 +合井 +合代 +合佐昆 +合佐毘 +合使 +合元 +合六 +合内 +合力 +合原 +合口 +合地 +合坂 +合坪 +合堀 +合場 +合宝 +合家 +合寳 +合尾 +合屋 +合山 +合島 +合崎 +合嶋 +合嶌 +合川 +合庭 +合志 +合戸 +合掌 +合摩 +合月 +合木 +合林 +合柿 +合楽 +合樂 +合歓垣 +合歡垣 +合江 +合沢 +合沼 +合津 +合浜 +合浦 +合渡 +合満 +合滿 +合澤 +合濱 +合瀬 +合甫 +合田 +合田口 +合砂 +合羅 +合群 +合羽 +合羽井 +合葉 +合蒲 +合角地 +合谷 +合谷木 +合路 +合野 +合野口 +合間 +合阪 +合頭 +合馬 +吉 +吉ケ別府 +吉ケ別符 +吉ケ島 +吉ケ崎 +吉ケ嶋 +吉ケ江 +吉ケ沢 +吉ケ澤 +吉ケ谷 +吉ノ元 +吉ノ園 +吉ノ薗 +吉ノ谷 +吉㚖 +吉上 +吉下 +吉丘 +吉並 +吉中 +吉丸 +吉久 +吉久保 +吉之元 +吉之園 +吉之薗 +吉井 +吉井木 +吉仕 +吉代 +吉仲 +吉伊 +吉位 +吉住 +吉佐 +吉作 +吉保 +吉信 +吉俣 +吉倉 +吉備 +吉備永 +吉備津 +吉備田 +吉儀 +吉元 +吉光 +吉光寺 +吉免 +吉八木 +吉兼 +吉内 +吉冨 +吉出 +吉利 +吉副 +吉加 +吉加江 +吉勝 +吉北 +吉原 +吉友 +吉友高 +吉口 +吉合 +吉吉 +吉名 +吉向 +吉呑 +吉味 +吉和 +吉和田 +吉喜 +吉嗣 +吉国 +吉國 +吉園 +吉地 +吉坂 +吉垣 +吉垣内 +吉城 +吉城寺 +吉埜 +吉堀 +吉堂 +吉場 +吉塚 +吉増 +吉墨 +吉士 +吉多 +吉太 +吉奥 +吉子 +吉宇田 +吉守 +吉安 +吉宗 +吉実 +吉室 +吉宮 +吉家 +吉富 +吉實 +吉対 +吉對 +吉小神 +吉尾 +吉居 +吉屋 +吉山 +吉岐 +吉岑 +吉岡 +吉岡屋 +吉岩 +吉岳 +吉峯 +吉峰 +吉島 +吉崎 +吉崎屋 +吉崗 +吉嵜 +吉嵯峨 +吉嶋 +吉嶌 +吉嶺 +吉川 +吉州 +吉巳 +吉巻 +吉市 +吉幡 +吉平 +吉年 +吉幸 +吉広 +吉府 +吉度 +吉廣 +吉延 +吉廹 +吉廻 +吉引 +吉弘 +吉弥 +吉弥侯部 +吉弥候部 +吉彌 +吉形 +吉彦 +吉得 +吉徳 +吉志 +吉志部 +吉忠 +吉成 +吉戒 +吉戸 +吉房 +吉持 +吉政 +吉敷 +吉文字 +吉新 +吉方 +吉日 +吉昌 +吉春 +吉時 +吉月 +吉朝 +吉木 +吉木谷 +吉末 +吉本 +吉本屋 +吉杉 +吉村 +吉束 +吉条 +吉松 +吉林 +吉枝 +吉枡 +吉枩 +吉柳 +吉柴 +吉栄 +吉栖 +吉根 +吉桑 +吉桝 +吉梅 +吉條 +吉棟 +吉森 +吉植 +吉椿 +吉楽 +吉樂 +吉樹 +吉橋 +吉機 +吉櫻 +吉次 +吉止 +吉正 +吉武 +吉歳 +吉母 +吉比 +吉毛利 +吉氏 +吉水 +吉氷 +吉永 +吉江 +吉池 +吉汲 +吉沖 +吉沢 +吉河 +吉治 +吉沼 +吉泉 +吉波 +吉津 +吉津谷 +吉浜 +吉浦 +吉浪 +吉海 +吉海江 +吉淵 +吉添 +吉清 +吉清水 +吉渓 +吉渕 +吉渡 +吉満 +吉満屋 +吉溪 +吉滝 +吉滿 +吉澄 +吉澗 +吉澤 +吉濱 +吉瀧 +吉瀬 +吉灘 +吉無田 +吉牟田 +吉牟礼 +吉牟禮 +吉玉 +吉生 +吉用 +吉田 +吉田屋 +吉田形 +吉田矢 +吉田谷 +吉町 +吉畄 +吉畑 +吉留 +吉畠 +吉畳 +吉皮 +吉益 +吉盛 +吉目木 +吉直 +吉相 +吉眞 +吉真 +吉矢 +吉石 +吉祇 +吉神 +吉祥 +吉祥寺 +吉祥庵 +吉福 +吉秀 +吉秋 +吉種 +吉積 +吉窪 +吉立 +吉竜 +吉端 +吉竹 +吉筋 +吉管 +吉納 +吉納谷 +吉経 +吉継 +吉続 +吉綱 +吉繁 +吉織 +吉續 +吉羅 +吉美 +吉羽 +吉能 +吉脇 +吉舌 +吉舎 +吉舗 +吉舘 +吉舛 +吉船 +吉良 +吉良山 +吉良川 +吉良田 +吉花 +吉苗 +吉若 +吉荒 +吉葉 +吉蔵 +吉薗 +吉藤 +吉行 +吉西 +吉見 +吉見谷 +吉規 +吉角 +吉謙 +吉識 +吉谷 +吉谷地 +吉谷川 +吉貝 +吉貞 +吉貫 +吉貴 +吉賀 +吉越 +吉路 +吉輪 +吉辺 +吉近 +吉迫 +吉道 +吉邑 +吉邨 +吉部 +吉郷 +吉都紀 +吉里 +吉里田 +吉重 +吉野 +吉野内 +吉野屋 +吉野山 +吉野川 +吉野谷 +吉野辺 +吉野部 +吉金 +吉鋪 +吉鎌 +吉長 +吉門 +吉開 +吉間 +吉阪 +吉附 +吉隆 +吉際 +吉雄 +吉須 +吉飼 +吉館 +吉香 +吉馴 +吉高 +吉高神 +吉鶴 +吉鷹 +吉鹿 +吉龍 +同々 +同京 +同免 +同免木 +同前 +同地 +同姓 +同崎 +同形尻 +同村 +同町 +同道 +同馬 +名々井 +名ケ迫 +名上 +名下 +名主川 +名久 +名久井 +名井 +名仁沢 +名仁澤 +名代 +名佐原 +名佳 +名倉 +名元 +名免良 +名児屋 +名児耶 +名兒耶 +名内 +名冨 +名出 +名刀 +名切 +名切元 +名剣 +名加 +名化 +名原 +名取 +名取川 +名口 +名古 +名古家 +名古屋 +名古弥 +名古曽 +名古曾 +名古根 +名古瀬 +名古田 +名古谷 +名古路 +名合 +名呉 +名和 +名和原 +名和川 +名和手 +名和田 +名和谷 +名和野 +名嘉 +名嘉元 +名嘉原 +名嘉地 +名嘉山 +名嘉嶺 +名嘉座 +名嘉村 +名嘉毛 +名嘉眞 +名嘉真 +名嘉間 +名地 +名坂 +名垣 +名垣浦 +名城 +名執 +名場 +名塚 +名塩 +名女川 +名女松 +名子 +名子屋 +名子平 +名守 +名定 +名富 +名小路 +名小路谷 +名尾 +名屋 +名山 +名島 +名崎 +名嶋 +名嶌 +名川 +名幡 +名平 +名幸 +名座 +名引 +名張 +名当 +名後 +名徳 +名所 +名手 +名打 +名持 +名方 +名明 +名智 +名月 +名有 +名木 +名木佐 +名木山 +名木橋 +名木田 +名木葉 +名木野 +名本 +名村 +名東 +名柄 +名桐 +名桑 +名楽 +名樂 +名武 +名池 +名沢 +名河内 +名波 +名波家 +名波谷 +名洗 +名津井 +名浦 +名淵 +名渕 +名渡山 +名澤 +名無 +名王 +名生 +名用 +名田 +名田屋 +名田平 +名田谷 +名田部 +名畑 +名畑目 +名畠 +名當 +名目良 +名直 +名眞 +名真 +名矢 +名知 +名知原 +名種 +名窪 +名立 +名竹 +名筋 +名節 +名美 +名胡 +名舩 +名船 +名良 +名良橋 +名艸 +名苗 +名若 +名草 +名荷原 +名葉 +名蔵 +名藏 +名藤 +名西 +名見崎 +名角 +名護 +名護屋 +名護山 +名護田 +名護谷 +名谷 +名賀 +名賀石 +名賀谷 +名超 +名越 +名輪 +名辺田 +名迫 +名連 +名逹 +名達 +名部 +名部井 +名郷 +名郷根 +名里 +名野 +名野平 +名鏡 +名間 +名阪 +名雪 +名雲 +名頃 +名須 +名須川 +名須谷 +名須賀 +名頭園 +名頭薗 +名願 +名飯 +名高 +名高下 +名鳥 +名鷺 +名鹿 +名黒 +后藤 +吐前 +吐合 +吐山 +吐崎 +吐師 +吐月 +吐生 +吐田 +吐院 +向 +向イ平 +向上 +向下 +向中 +向中野 +向久保 +向井 +向井中 +向井仲 +向井元 +向井原 +向井地 +向井山 +向井干場 +向井所 +向井殿 +向井田 +向井畑 +向井良 +向井谷 +向井野 +向仲 +向伊 +向佐 +向來 +向保 +向内 +向出 +向原 +向口 +向台 +向吉 +向囿 +向園 +向土井 +向地 +向坂 +向坊 +向坪 +向垣 +向垣内 +向城 +向埜 +向堀 +向堂 +向大野 +向奥 +向宮 +向家 +向尾 +向居 +向屋敷 +向山 +向山口 +向岩 +向岸 +向峠 +向峯 +向峰 +向島 +向崎 +向嶋 +向嶌 +向川 +向川原 +向川戸 +向市 +向平 +向当 +向後 +向志水 +向成 +向所 +向手 +向折戸 +向敷 +向新 +向日 +向日路 +向明戸 +向暁 +向本 +向村 +向条 +向来 +向東 +向松 +向林 +向柴 +向根 +向條 +向森 +向橋 +向段 +向殿 +向永 +向江 +向江村 +向江脇 +向沢 +向河原 +向洞 +向津 +向浜 +向浦 +向深沢 +向深澤 +向澤 +向濱 +向瀬 +向田 +向畑 +向畠 +向畦地 +向當 +向矢 +向窪 +向竹 +向笠 +向米 +向縄 +向繩 +向脇 +向舘 +向良 +向芝 +向薗 +向薮 +向藤原 +向藪 +向西 +向角 +向谷 +向谷内 +向谷地 +向迫 +向逹 +向達 +向郷 +向里 +向野 +向野下 +向野瀬 +向門 +向阪 +向陽 +向面 +向頭 +向館 +向駒木 +向高 +向鶴 +君 +君ケ洞 +君ケ袋 +君付 +君原 +君口 +君吉 +君名川 +君和 +君和田 +君国 +君園 +君垣 +君塚 +君安 +君官 +君家 +君山 +君岡 +君島 +君崎 +君嶋 +君嶌 +君川 +君市 +君平 +君座 +君恵 +君成 +君成田 +君本 +君村 +君永 +君沢 +君波 +君洞 +君浦 +君浪 +君澤 +君田 +君砂 +君羅 +君谷 +君野 +吟佐 +吟谷 +吠木 +否笠 +含本 +含満 +吸原 +吸坂 +吸山 +吹 +吹ケ +吹ケ田 +吹ケ迫 +吹ノ戸 +吹一 +吹上 +吹中 +吹井 +吹付 +吹元 +吹冨 +吹出 +吹切 +吹原 +吹地 +吹坂 +吹場 +吹寄 +吹屋 +吹山 +吹戸 +吹抜 +吹挙 +吹揚 +吹擧 +吹明 +吹春 +吹曽 +吹本 +吹毛井 +吹気 +吹氣 +吹江 +吹沢 +吹浦 +吹澤 +吹田 +吹留 +吹畠 +吹矢 +吹石 +吹藤 +吹角 +吹訳 +吹譯 +吹谷 +吹貝 +吹越 +吹迫 +吹野 +吹金原 +吹附 +吹風 +吽野 +吾㛏 +吾丸 +吾住 +吾勝 +吾妻 +吾子 +吾孫 +吾孫子 +吾孫子端 +吾屋 +吾岳 +吾川 +吾平 +吾明 +吾東 +吾河 +吾津 +吾浦 +吾田 +吾藤 +吾郷 +吾野 +呈 +呉 +呉井 +呉人 +呉元 +呉光 +呉原 +呉地 +呉坪 +呉城 +呉堂 +呉宮 +呉家 +呉屋 +呉山 +呉岡 +呉岳 +呉島 +呉崎 +呉川 +呉座 +呉座井 +呉座谷 +呉我 +呉服 +呉本 +呉村 +呉東 +呉松 +呉林 +呉橋 +呉比 +呉永 +呉河 +呉津 +呉浦 +呉海 +呉田 +呉町 +呉石 +呉竹 +呉羽 +呉藤 +呉谷 +呉野 +告 +告上 +告下 +告中 +告井 +告原 +告口 +告吉 +告坂 +告堀 +告宮 +告山 +告川 +告本 +告松 +告森 +告溝 +告瀬 +告田 +告畑 +告脇 +告船 +告見 +告野 +告鍬 +告馬 +呑原 +呑口 +呑名 +呑山 +呑川 +呑村 +呑沢 +呑海 +呑澤 +呑田 +呑谷 +呑野 +呑香 +周々木 +周世 +周世原 +周伝 +周佐 +周作 +周内 +周原 +周参見 +周善寺 +周嘉谷 +周央 +周宝 +周家 +周寳 +周尾 +周山 +周崎 +周川 +周布 +周布本 +周布野 +周度 +周戸 +周才 +周木 +周本 +周村 +周東 +周栄 +周榮 +周治 +周津 +周浦 +周産 +周田 +周知 +周磨 +周神 +周管 +周籐 +周藤 +周観地 +周詞 +周谷 +周輪 +周遠 +周郷 +周野 +周防 +周防原 +周防屋 +呰 +呰上 +味上 +味代木 +味元 +味八木 +味内 +味冨 +味勝 +味原 +味口 +味吉 +味呑 +味喜 +味噌 +味噌井 +味噌作 +味噌山 +味噌谷 +味噌野 +味園 +味土 +味地 +味坂 +味埜 +味好 +味富 +味寺 +味山 +味岡 +味崎 +味川 +味府 +味形 +味志 +味戸 +味方 +味曽野 +味曾野 +味木 +味本 +味村 +味松 +味森 +味水 +味沢 +味波 +味浪 +味澤 +味生 +味田 +味田村 +味知 +味窪 +味美 +味能 +味舌 +味若 +味蓼 +味藤 +味見 +味谷 +味道 +味酒 +味野 +味野和 +味間 +味香 +呼元 +呼坂 +呼子 +呼川 +呼石 +呼野 +命婦 +命尾 +命苫 +命長 +咄 +咄下 +和 +和井 +和仁 +和倉 +和山 +和己 +和布浦 +和本 +和泉 +和泉元 +和泉原 +和泉屋 +和泉山 +和泉川 +和泉広 +和泉廣 +和泉本 +和泉沢 +和泉澤 +和泉田 +和泉谷 +和澤 +和美 +和間 +咲寿 +咲尾 +咲山 +咲川 +咲摩 +咲本 +咲村 +咲枝 +咲田 +咲花 +咲谷 +咲賀 +咲野 +咲間 +咸原 +咸平 +咸本 +咸豊 +咽原 +咽本 +品 +品ケ瀬 +品原 +品口 +品地 +品堀 +品尾 +品居 +品山 +品岡 +品川 +品平 +品慶 +品木 +品末 +品本 +品村 +品沢 +品治 +品渡 +品澤 +品玉 +品田 +品矢 +品竹 +品脇 +品草 +品衛 +品角 +品谷 +品部 +品野 +哉原 +哉尾 +哘 +哘崎 +哘嵜 +員弁 +員本 +員田 +員見 +員野 +哥 +哥丸 +哥川 +哲 +哲翁 +哿 +唄 +唄代 +唄川 +唄野 +唐 +唐下 +唐亀 +唐井 +唐仁 +唐仁原 +唐住 +唐來 +唐倉 +唐元 +唐内 +唐原 +唐口 +唐司 +唐吾 +唐品 +唐国 +唐國 +唐土 +唐坂 +唐坊 +唐城 +唐堂 +唐士 +唐太 +唐妻 +唐婦 +唐子 +唐宮 +唐家 +唐尼 +唐尾 +唐山 +唐岡 +唐岩 +唐岸 +唐峯 +唐島 +唐島田 +唐崎 +唐嵜 +唐嶋 +唐嶋田 +唐川 +唐帆 +唐弓 +唐戸 +唐戸島 +唐戸嶋 +唐木 +唐木沢 +唐木澤 +唐木田 +唐本 +唐杉 +唐村 +唐来 +唐松 +唐林 +唐桑 +唐桶 +唐梨子 +唐椀 +唐樋 +唐橋 +唐櫃 +唐永 +唐池 +唐沢 +唐治谷 +唐津 +唐津土井 +唐津土居 +唐津屋 +唐津谷 +唐津麻 +唐渓 +唐渡 +唐溪 +唐滝 +唐澤 +唐牛 +唐生 +唐田 +唐畑 +唐登 +唐眞 +唐真 +唐石 +唐神 +唐立 +唐竹 +唐笠 +唐箕 +唐管 +唐糸 +唐紙 +唐耒 +唐芳 +唐苧 +唐菅 +唐藤 +唐見 +唐谷 +唐邦 +唐重 +唐野 +唐金 +唐釜 +唐錦 +唐鎌 +唐門 +唐間 +唐須 +唐馬 +唯 +唯井 +唯保 +唯内 +唯吉 +唯山 +唯岡 +唯島 +唯我 +唯敷 +唯是 +唯有 +唯木 +唯杉 +唯松 +唯根 +唯浦 +唯藤 +唯見 +唯谷 +唯野 +唯間 +唯須 +唱 +商光 +商史 +商家 +商山 +商崎 +問 +問井 +問口 +問可 +問坂 +問屋 +問山 +問川 +問本 +問田 +問矢 +問端 +問船 +問芝 +問覚 +問覺 +問註所 +問谷 +問馬 +啓乕 +啓利 +啓塚 +啓田 +善 +善万 +善上 +善並 +善久 +善井 +善住 +善倉 +善元 +善光 +善光寺 +善入 +善利 +善加 +善勝 +善原 +善名 +善哉 +善国 +善國 +善坊 +善場 +善塔 +善塚 +善塲 +善如 +善如寺 +善定 +善宝 +善家 +善寳 +善尾 +善山 +善岡 +善峰 +善川 +善平 +善幸 +善弓 +善弘 +善当 +善徳 +善志 +善成 +善戝 +善才 +善教 +善斉 +善斎 +善方 +善明 +善最 +善木 +善本 +善村 +善林 +善正 +善永 +善沢 +善治 +善波 +善浪 +善海 +善澄 +善理 +善生 +善用 +善甫 +善田 +善當 +善相原 +善知鳥 +善福 +善積 +善端 +善竹 +善納 +善能寺 +善茂作 +善茂砂 +善藤 +善行 +善行地 +善見 +善谷 +善財 +善辻 +善通 +善連 +善道 +善那 +善部 +善里 +善重 +善野 +善金 +善長 +善陸 +善養司 +善養寺 +善齊 +喚山 +喚田 +喚阿 +喜 +喜々津 +喜タ田 +喜三 +喜下 +喜世 +喜世川 +喜世盛 +喜中 +喜久 +喜久元 +喜久地 +喜久子 +喜久山 +喜久嶺 +喜久川 +喜久本 +喜久村 +喜久永 +喜久生 +喜久田 +喜久盛 +喜久知 +喜久里 +喜久野 +喜久間 +喜井 +喜京 +喜代 +喜代原 +喜代吉 +喜代多 +喜代崎 +喜代平 +喜代志 +喜代永 +喜代浜 +喜代濱 +喜代田 +喜代美 +喜代門 +喜伊 +喜住 +喜佐 +喜佐上 +喜佐田 +喜佐美 +喜佐見 +喜作 +喜來 +喜元 +喜入 +喜内 +喜利 +喜助田 +喜勢 +喜原 +喜友名 +喜友村 +喜友永 +喜友里 +喜古 +喜司 +喜吉 +喜名 +喜名田 +喜和 +喜和田 +喜国 +喜國 +喜園 +喜地 +喜坂 +喜堂 +喜塚 +喜壽屋 +喜夕田 +喜多 +喜多下 +喜多井 +喜多代 +喜多仲 +喜多内 +喜多原 +喜多口 +喜多埜 +喜多尾 +喜多居 +喜多山 +喜多岡 +喜多島 +喜多崎 +喜多嶋 +喜多川 +喜多幅 +喜多幡 +喜多方 +喜多本 +喜多村 +喜多条 +喜多林 +喜多條 +喜多沢 +喜多河 +喜多澤 +喜多濃 +喜多王 +喜多田 +喜多畑 +喜多穂 +喜多羅 +喜多良 +喜多西 +喜多見 +喜多詰 +喜多谷 +喜多野 +喜多阪 +喜多須 +喜夛 +喜夛仲 +喜夛口 +喜夛尾 +喜夛島 +喜夛嶋 +喜夛川 +喜夛本 +喜夛村 +喜夛河 +喜夛野 +喜好 +喜如喜 +喜如嘉 +喜始 +喜子 +喜宇 +喜安 +喜家村 +喜家田 +喜寅 +喜寿屋 +喜尾 +喜尾野 +喜屋原 +喜屋武 +喜屋田 +喜山 +喜岡 +喜島 +喜崎 +喜嶋 +喜川 +喜左上 +喜幡 +喜平 +喜平田 +喜庄 +喜志 +喜志口 +喜志多 +喜志永 +喜志田 +喜志麻 +喜悦 +喜成 +喜戸 +喜捨 +喜文字 +喜旦 +喜早 +喜明 +喜本 +喜村 +喜来 +喜林 +喜枝 +喜柳 +喜根井 +喜森 +喜楽 +喜樂 +喜殿 +喜沢 +喜治 +喜泉 +喜津川 +喜津木 +喜津瀬 +喜洲 +喜浦 +喜清 +喜渡 +喜澤 +喜瀬 +喜瀬川 +喜熊 +喜熨斗 +喜田 +喜田嶋 +喜田川 +喜田村 +喜田橋 +喜畑 +喜登 +喜登良 +喜禎 +喜福 +喜種 +喜竹 +喜築 +喜籐 +喜納 +喜綿 +喜美候部 +喜美田 +喜羽 +喜耒 +喜聞 +喜舍場 +喜舍塲 +喜舎場 +喜舎塲 +喜良 +喜花 +喜芳 +喜茶 +喜菜 +喜葉 +喜藤 +喜虎 +喜見 +喜見山 +喜覚 +喜覺 +喜読 +喜讀 +喜谷 +喜谷村 +喜賀 +喜輪理 +喜連 +喜連川 +喜道 +喜邑 +喜里山 +喜野 +喜録 +喜音家 +喜頭 +喜馬 +喜鶴 +喬久 +喬木 +喬橋 +喰代 +喰田 +営田 +営野 +嗔木 +嗣永 +嗣江 +嘉 +嘉ノ海 +嘉久 +嘉久和 +嘉久志 +嘉久見 +嘉井 +嘉仁 +嘉代 +嘉会 +嘉住 +嘉佐 +嘉保 +嘉信 +嘉倉 +嘉儀 +嘉元 +嘉内 +嘉副 +嘉勢 +嘉勢山 +嘉原 +嘉口 +嘉古田 +嘉吉 +嘉名 +嘉向 +嘉味元 +嘉味本 +嘉味田 +嘉和地 +嘉和知 +嘉喜 +嘉喜多 +嘉喜山 +嘉喜村 +嘉喜田 +嘉土 +嘉地 +嘉堂 +嘉場 +嘉壽 +嘉多 +嘉多山 +嘉夛 +嘉奈 +嘉室 +嘉宮 +嘉富 +嘉寺 +嘉寿 +嘉屋 +嘉屋崎 +嘉屋本 +嘉屋重 +嘉山 +嘉岡 +嘉島 +嘉崎 +嘉嶋 +嘉川 +嘉幡 +嘉平 +嘉年坂 +嘉弓 +嘉弥真 +嘉彌眞 +嘉彌真 +嘉形 +嘉志 +嘉志摩 +嘉応寺 +嘉悦 +嘉應寺 +嘉成 +嘉戸 +嘉手刈 +嘉手名 +嘉手川 +嘉手納 +嘉手苅 +嘉指 +嘉摩尻 +嘉数 +嘉数田 +嘉數 +嘉斉 +嘉斎 +嘉新 +嘉會 +嘉月 +嘉本 +嘉村 +嘉来 +嘉東 +嘉松 +嘉枝 +嘉柳 +嘉根 +嘉森 +嘉正 +嘉永 +嘉永島 +嘉沢 +嘉治 +嘉治井 +嘉治本 +嘉沼 +嘉波 +嘉洋 +嘉津 +嘉津山 +嘉流 +嘉海 +嘉満 +嘉澤 +嘉瀬 +嘉瀬井 +嘉無木 +嘉生 +嘉田 +嘉畑 +嘉登 +嘉白 +嘉目 +嘉神 +嘉祥 +嘉祥司 +嘉祥寺 +嘉祥寺谷 +嘉福 +嘉積 +嘉籐 +嘉糖 +嘉糠 +嘉納 +嘉美 +嘉義 +嘉羽 +嘉者熊 +嘉能 +嘉良 +嘉良戸 +嘉茂 +嘉藤 +嘉藤田 +嘉見 +嘉規 +嘉賀 +嘉賀宮 +嘉越 +嘉那井 +嘉那原 +嘉部 +嘉部井 +嘉郷 +嘉重 +嘉野 +嘉野内 +嘉野川 +嘉野浦 +嘉門 +嘉陽 +嘉陽田 +嘉須利 +嘉香 +嘉鳥 +嘉齊 +嘉齋 +噂 +噂江 +噌西 +噐楽堂 +噐樂堂 +器楽堂 +噺 +嚴原 +嚴島 +嚴嶋 +嚴本 +嚴樫 +四つ橋 +四つ目 +四の宮 +四ケ所 +四ケ浦 +四ケ田 +四ケ谷 +四ケ野 +四ツ井 +四ツ井田 +四ツ倉 +四ツ分 +四ツ塚 +四ツ家 +四ツ居 +四ツ屋 +四ツ岳 +四ツ島 +四ツ嶋 +四ツ嶽 +四ツ役 +四ツ木 +四ツ村 +四ツ柳 +四ツ橋 +四ツ永 +四ツ滝 +四ツ瀧 +四ツ田 +四ツ目 +四ツ碇 +四ツ谷 +四ツ路 +四ツ車 +四ツ辻 +四ツ釜 +四ツ門 +四ツ関 +四ノ原 +四ノ宮 +四七 +四万村 +四万田 +四下 +四丸 +四丹 +四之宮 +四井 +四井田 +四伊 +四位 +四位例 +四住 +四作 +四俣 +四俵 +四倉 +四元 +四冨 +四分一 +四分谷 +四十 +四十万 +四十万谷 +四十九 +四十九院 +四十井 +四十住 +四十八願 +四十内 +四十坊 +四十塚 +四十宮 +四十山 +四十岡 +四十崎 +四十川 +四十木 +四十本 +四十栄 +四十榮 +四十沢 +四十洲 +四十澤 +四十物 +四十物谷 +四十田 +四十竹 +四十萬谷 +四十谷 +四十野 +四反田 +四国 +四國 +四坂 +四坊 +四垂 +四堂 +四塚 +四夷 +四女野 +四季 +四宅 +四宮 +四宮田 +四家 +四家井 +四富 +四尺 +四尾 +四居 +四屋 +四山 +四岡 +四島 +四嶋 +四川 +四平 +四広 +四度 +四廣 +四役 +四徳 +四恩 +四戸 +四戸岸 +四手 +四手井 +四折 +四斉谷 +四斎谷 +四斗 +四斗辺 +四斗邊 +四方 +四方伝 +四方城 +四方堂 +四方天 +四方山 +四方川 +四方田 +四方谷 +四方路 +四日 +四日市 +四日谷 +四月朔日 +四木 +四本 +四本木 +四本松 +四杉 +四村 +四条 +四林 +四枚田 +四枝 +四柳 +四栗 +四條 +四橋 +四歩一 +四氏 +四水 +四沢 +四津 +四津井 +四津川 +四津田 +四津谷 +四浦 +四海 +四淵 +四渕 +四潟 +四澤 +四熊 +四牟田 +四王天 +四田 +四町田 +四畑 +四畝町 +四登 +四百刈 +四百田 +四百目 +四百苅 +四目忠 +四碇 +四礼 +四禮 +四竃 +四竈 +四童子 +四篠 +四籐 +四維 +四脇 +四至本 +四良丸 +四茂野 +四葉 +四蔵 +四藏 +四藤 +四衢 +四角 +四角目 +四谷 +四越 +四車 +四軒家 +四軒町 +四辻 +四通 +四通田 +四道 +四達 +四邨 +四郎丸 +四郎園 +四郎田 +四重田 +四野 +四野宮 +四野見 +四釜 +四鈴 +四鏡 +四門 +四間 +四間丁 +四関 +四阿 +四静 +四飯 +四馬田 +四鬼 +四鹿 +四齊谷 +回 +回り道 +回夜 +回木 +回渕 +回谷 +回道 +回里 +回陽 +因 +因來 +因埜 +因幡 +因庭 +因来 +因泥 +因田 +因葉 +因藤 +因谷 +因野 +因間 +団 +団上 +団丸 +団之原 +団井 +団原 +団塚 +団子 +団子石 +団孝 +団村 +団栗 +団田 +団藤 +団貞 +団迫 +団野 +囬り道 +囬渕 +囲 +囲夜 +図 +図佐 +図司 +図子 +図子田 +図師 +図師田 +図志田 +図所 +図斉 +図斎 +図書 +図末 +図越 +固城 +固屋 +固山 +固本 +固武 +固蔵 +固谷 +国 +国ノ十 +国ノ重 +国ヰ +国上 +国下 +国中 +国丸 +国丹 +国乃 +国久 +国久保 +国乗 +国井 +国京 +国仙 +国仙谷 +国代 +国仲 +国伝 +国住 +国佐 +国俊 +国保 +国信 +国僧 +国元 +国光 +国兼 +国冨 +国出 +国分 +国分寺 +国分方 +国利 +国則 +国前 +国副 +国力 +国包 +国北 +国原 +国又 +国友 +国只 +国司 +国司田 +国吉 +国和 +国唯 +国土 +国坂 +国城 +国場 +国塚 +国塩 +国増 +国多 +国天 +国奥 +国奧 +国好 +国子 +国宇 +国守 +国安 +国安院 +国宗 +国定 +国宝 +国実 +国家 +国寄 +国富 +国尾 +国居 +国屋 +国山 +国岡 +国峯 +国峰 +国島 +国崎 +国嵜 +国嶋 +国嶌 +国嶽 +国川 +国師 +国常 +国平 +国年 +国広 +国府 +国府寺 +国府島 +国府方 +国府浜 +国府田 +国府谷 +国廣 +国延 +国弘 +国当 +国影 +国徳 +国志 +国忠 +国恵 +国成 +国戸 +国房 +国持 +国掌 +国政 +国文 +国料 +国方 +国時 +国木 +国木田 +国末 +国本 +国杉 +国村 +国東 +国松 +国林 +国枝 +国柄 +国柴 +国栖 +国桝 +国森 +国樹 +国橋 +国次 +国正 +国武 +国歳 +国母 +国永 +国江 +国沖 +国沢 +国治 +国津 +国浜 +国浦 +国清 +国渓 +国渡 +国満 +国溪 +国滝 +国澤 +国瀬 +国狭 +国狹 +国玉 +国王寺 +国生 +国田 +国益 +国盛 +国眼 +国矢 +国矢田 +国知 +国知出 +国石 +国祐 +国立 +国竹 +国米 +国納 +国続 +国繁 +国脇 +国舛 +国芳 +国藤 +国行 +国衙 +国裡 +国西 +国見 +国見川 +国谷 +国貞 +国賀 +国越 +国近 +国道 +国遠 +国邑 +国部 +国里 +国重 +国野 +国金 +国長 +国門 +国陶 +国雲 +国鞆 +国須 +国頒 +国領 +国頭 +国頼 +国香 +国馬 +国高 +国龍 +囿山 +囿田 +圀府寺 +圃中 +圃山 +圃田 +國 +國ノ十 +國上 +國下 +國中 +國丸 +國丹 +國久 +國久保 +國乗 +國乘 +國井 +國京 +國仙 +國仙谷 +國代 +國仲 +國住 +國佐 +國俊 +國保 +國信 +國傳 +國元 +國光 +國兼 +國冨 +國出 +國分 +國分寺 +國利 +國則 +國副 +國包 +國北 +國原 +國又 +國友 +國只 +國司 +國司田 +國吉 +國和 +國唯 +國土 +國坂 +國場 +國塚 +國塩 +國増 +國多 +國天 +國奥 +國好 +國守 +國安 +國安院 +國宗 +國定 +國実 +國家 +國寄 +國富 +國實 +國寳 +國尾 +國居 +國屋 +國山 +國岡 +國峯 +國峰 +國島 +國崎 +國嵜 +國嶋 +國嶌 +國嶺 +國川 +國師 +國常 +國平 +國年 +國広 +國府 +國府寺 +國府島 +國府方 +國府田 +國府谷 +國廣 +國延 +國弘 +國影 +國徳 +國志 +國忠 +國戸 +國房 +國持 +國政 +國料 +國方 +國時 +國木 +國木田 +國末 +國本 +國村 +國東 +國松 +國枝 +國柄 +國栖 +國桝 +國森 +國樹 +國橋 +國次 +國正 +國武 +國母 +國永 +國江 +國沖 +國沢 +國治 +國津 +國清 +國滿 +國澤 +國瀧 +國瀬 +國狭 +國狹 +國玉 +國生 +國田 +國當 +國盛 +國眼 +國矢田 +國知 +國知出 +國石 +國祐 +國立 +國竹 +國米 +國納 +國繁 +國脇 +國舛 +國芳 +國藤 +國行 +國西 +國見 +國見川 +國谷 +國貞 +國賀 +國越 +國近 +國道 +國遠 +國邑 +國部 +國里 +國重 +國野 +國金 +國長 +國門 +國陶 +國雲 +國須 +國領 +國頭 +國香 +國馬 +國高 +圍 +園 +園上 +園下 +園中 +園井 +園倉 +園元 +園光 +園内 +園出 +園南寺 +園原 +園又 +園口 +園可 +園和 +園坂 +園城 +園城寺 +園塚 +園宮 +園家 +園尾 +園屋 +園屋敷 +園山 +園岡 +園島 +園崎 +園嵜 +園川 +園延 +園曽 +園曾 +園木 +園本 +園村 +園杭 +園林 +園林寺 +園江 +園池 +園浦 +園淵 +園渕 +園滝 +園瀧 +園生 +園田 +園畑 +園畠 +園石 +園能寺 +園花 +園藤 +園谷 +園越 +園路 +園辺 +園道 +園邉 +園邊 +園部 +園里 +園野 +園雄 +園頭 +圓 +圓一 +圓丘 +圓中 +圓丸 +圓乗 +圓乘 +圓井 +圓佛 +圓倉 +圓光 +圓光寺 +圓入 +圓勺 +圓口 +圓句 +圓地 +圓垣内 +圓城 +圓城寺 +圓堂 +圓増 +圓奈 +圓妙 +圓子 +圓富 +圓實 +圓尾 +圓居 +圓山 +圓岡 +圓島 +圓崎 +圓川 +圓成 +圓戸 +圓日 +圓明 +圓月 +圓木 +圓本 +圓札 +圓東 +圓林 +圓橋 +圓次 +圓水 +圓浄 +圓淨 +圓満 +圓満字 +圓生 +圓田 +圓目 +圓石 +圓福 +圓福寺 +圓能寺 +圓舘 +圓若 +圓藤 +圓行 +圓見 +圓角 +圓谷 +圓越 +圓通 +圓道 +圓道寺 +圓酒 +圓野 +圓鍔 +圓館 +圓馬 +圖司 +圖子 +圖子田 +圖左 +圖師 +圖師田 +圖志田 +圖所 +圖書 +圖越 +圖齋 +團 +團上 +團之原 +團井 +團原 +團塚 +團子 +團子石 +團孝 +團村 +團栗 +團田 +團藤 +團迫 +團野 +土 +土ケ内 +土ケ手 +土ケ端 +土一 +土上 +土下 +土与本 +土中 +土丸 +土丸谷 +土久 +土久岡 +土久里 +土也 +土亀 +土井 +土井上 +土井下 +土井中 +土井丸 +土井信 +土井光 +土井内 +土井原 +土井口 +土井地 +土井垣 +土井垣内 +土井富 +土井尻 +土井山 +土井岡 +土井川 +土井政 +土井本 +土井根 +土井池 +土井浦 +土井添 +土井田 +土井畑 +土井脇 +土井良 +土井藤 +土井谷 +土井豆 +土井迫 +土井重 +土井野 +土井長 +土代 +土代川 +土伏 +土会平 +土佐 +土佐井 +土佐内 +土佐屋 +土佐岡 +土佐川 +土佐木 +土佐林 +土佐田 +土佐谷 +土佐路 +土佐野 +土作 +土保 +土信田 +土倉 +土元 +土先 +土光 +土党 +土公 +土具 +土内 +土出 +土切 +土利川 +土利野 +土勢 +土原 +土反 +土取 +土取場 +土口 +土古 +土合 +土呂 +土味 +土喰 +土器 +土器園 +土器屋 +土器手 +土器薗 +土園 +土地 +土地川 +土地溝 +土地畑 +土坂 +土城 +土基 +土堀 +土堂 +土堤 +土堤内 +土場 +土塀 +土塔 +土塚 +土塩 +土増 +土壁 +土士田 +土多 +土子 +土守 +土定 +土宜 +土室 +土家 +土寄 +土富 +土射津 +土小呂 +土尻 +土尾 +土居 +土居ノ内 +土居下 +土居内 +土居原 +土居地 +土居岡 +土居岸 +土居崎 +土居川 +土居本 +土居森 +土居河 +土居田 +土居脇 +土居重 +土居野 +土屋 +土屋垣内 +土屋尾 +土山 +土岐 +土岐倉 +土岐山 +土岐岡 +土岐川 +土岐沢 +土岐澤 +土岐田 +土岡 +土岩 +土岸 +土島 +土崎 +土嶋 +土嶺 +土川 +土工 +土左 +土市 +土師 +土師元 +土師原 +土師田 +土師野 +土幡 +土平 +土幸 +土広 +土床 +土庫 +土庵 +土廣 +土弘 +土形 +土後 +土御門 +土志田 +土性 +土恵 +土成 +土戸 +土手 +土手下 +土手中 +土手側 +土手内 +土手原 +土手口 +土手塚 +土手川 +土手本 +土手添 +土手谷 +土手野 +土持 +土斐崎 +土方 +土日 +土明 +土木 +土木田 +土本 +土村 +土東 +土松 +土林 +土枝 +土栄 +土栗 +土桑 +土棚 +土棟 +土森 +土椰 +土榮 +土樋 +土樋輪 +土橋 +土次 +土永 +土江 +土江田 +土池 +土沢 +土河 +土河原 +土沼 +土泉 +土洞 +土津井 +土津川 +土津田 +土浜 +土浦 +土浪 +土浮 +土海 +土淵 +土清水 +土渕 +土渡 +土澤 +土濃塚 +土濱 +土瀬 +土瀬戸 +土片 +土生 +土生井 +土生居 +土生川 +土生木 +土生津 +土生田 +土生谷 +土生都 +土産 +土産田 +土用 +土用下 +土田 +土田子 +土由 +土畑 +土留 +土畠 +土矢 +土石 +土石川 +土砂 +土福 +土穴 +土窪 +土端 +土筆 +土築 +土細工 +土網 +土綿 +土肥 +土肥元 +土肥原 +土肥口 +土肥野 +土脇 +土至田 +土與本 +土舘 +土花 +土草 +土葛 +土蔵 +土藏 +土藤 +土見 +土角 +土記 +土許 +土谷 +土賀 +土赤 +土路 +土路生 +土車 +土輪 +土辺 +土道 +土遠 +土邊 +土部 +土野 +土野庄 +土野池 +土金 +土釜 +土長 +土門 +土開 +土間 +土阪 +土面 +土風 +土館 +土馬 +土高 +土黒 +土鼻 +圦山 +圦本 +圧司 +圧地 +圧山 +在中 +在井 +在仲 +在則 +在前 +在原 +在古 +在国寺 +在國寺 +在塚 +在安 +在定 +在家 +在山 +在岡 +在川 +在所 +在明 +在木 +在末 +在本 +在永 +在江 +在沢 +在津 +在澤 +在田 +在町 +在竹 +在藤 +在賀 +在路 +在郷 +在里 +在野 +在長 +在間 +圭室 +圯岡 +圯田 +地 +地の上 +地の塩 +地上 +地下 +地下中 +地中 +地丸 +地主 +地主園 +地久里 +地久間 +地井 +地京 +地代 +地代所 +地住 +地作 +地倶 +地元 +地具 +地内 +地分 +地切 +地割 +地原 +地口 +地吉 +地名 +地名坊 +地吹 +地土 +地土井 +地坂 +地堂 +地場 +地多 +地夛 +地大 +地天 +地子 +地子給 +地守 +地宗 +地家 +地寄 +地小 +地尾 +地山 +地岡 +地峯 +地峰 +地島 +地崎 +地嵐 +地嵜 +地嶋 +地川 +地巻 +地布久 +地平 +地幸 +地庄 +地庵 +地引 +地引場 +地当 +地形 +地後 +地後井 +地徳 +地念 +地戸 +地所 +地挽 +地搗 +地斉 +地斎 +地方 +地明 +地曳 +地曵 +地木 +地木楽 +地木樂 +地本 +地村 +地柴 +地案 +地森 +地楽 +地樂 +地橋 +地武 +地浜 +地浦 +地海 +地添 +地渡 +地湧 +地濃 +地濱 +地王 +地現 +地田 +地町 +地畑 +地畠 +地當 +地疋 +地白 +地石 +地神 +地福 +地紙 +地網 +地美 +地職 +地脇 +地舘 +地良田 +地良見 +地花 +地葉 +地蔵 +地蔵丸 +地蔵原 +地蔵堂 +地蔵山 +地蔵本 +地藏 +地藏堂 +地藤 +地衆 +地行 +地西 +地見 +地谷 +地越 +地辺 +地迫 +地造 +地道 +地邉 +地邊 +地部 +地部田 +地里 +地野 +地野田 +地金 +地釜 +地阪 +地附 +地面 +地領 +地頭 +地頭代 +地頭園 +地頭所 +地頭方 +地頭江 +地頭薗 +地館 +地高 +地黄 +地鼻 +地齊 +地齋 +圷 +坂 +坂々 +坂ノ上 +坂ノ下 +坂ノ井 +坂ノ坊 +坂ノ脇 +坂㞍 +坂三 +坂上 +坂上田 +坂上谷 +坂下 +坂不田 +坂中 +坂丸 +坂丹羽 +坂主 +坂久保 +坂之上 +坂之下 +坂之井 +坂之内 +坂亀 +坂井 +坂井原 +坂井山 +坂井田 +坂井野沢 +坂井野澤 +坂京 +坂代 +坂仲 +坂佐井 +坂俣 +坂倉 +坂元 +坂光 +坂入 +坂八 +坂内 +坂出 +坂利 +坂前 +坂力 +坂加 +坂北 +坂千代 +坂卷 +坂厘 +坂原 +坂又 +坂友 +坂取 +坂口 +坂口屋 +坂吉 +坂名 +坂名井 +坂向 +坂和 +坂哉 +坂喜 +坂園 +坂圦 +坂地 +坂坪 +坂垣 +坂垣内 +坂垰 +坂城 +坂埜 +坂埼 +坂堂 +坂場 +坂塲 +坂多 +坂夛 +坂大 +坂奥 +坂妻 +坂守 +坂宗 +坂室 +坂宮 +坂家 +坂寄 +坂富 +坂寺 +坂尻 +坂尾 +坂居 +坂屋 +坂山 +坂岡 +坂岩 +坂岸 +坂峯 +坂峰 +坂島 +坂崎 +坂嵜 +坂嶋 +坂川 +坂巻 +坂市 +坂常 +坂平 +坂庄 +坂庭 +坂廻 +坂廼辺 +坂廼邉 +坂弥 +坂当 +坂待 +坂後 +坂従 +坂從 +坂恵 +坂惠 +坂成 +坂戸 +坂手 +坂才 +坂折 +坂斉 +坂斎 +坂曽 +坂木 +坂木原 +坂木田 +坂本 +坂本屋 +坂本谷 +坂村 +坂東 +坂東島 +坂東橋 +坂松 +坂林 +坂枝 +坂枩 +坂柳 +坂柿 +坂栄 +坂栗 +坂根 +坂梨 +坂森 +坂植 +坂榮 +坂槇 +坂槙 +坂樟 +坂橋 +坂次 +坂毛 +坂水 +坂永 +坂江 +坂池 +坂沢 +坂治 +坂沼 +坂津 +坂浦 +坂浪 +坂澤 +坂瀬 +坂無 +坂熊 +坂爪 +坂牛 +坂牟田 +坂牧 +坂狩 +坂理 +坂生 +坂田 +坂田屋 +坂田谷 +坂町 +坂畑 +坂留 +坂番 +坂當 +坂登 +坂白 +坂矢 +坂石 +坂神 +坂祢 +坂稲 +坂積 +坂端 +坂竹 +坂納 +坂能 +坂脇 +坂腰 +坂苗 +坂茂 +坂葉 +坂蒔 +坂蓋 +坂蔵 +坂薮 +坂藤 +坂藪 +坂西 +坂見 +坂角 +坂詰 +坂誥 +坂谷 +坂谷内 +坂賀 +坂越 +坂足 +坂路 +坂輪 +坂辺 +坂辻 +坂迺辺 +坂道 +坂邉 +坂邊 +坂那 +坂部 +坂里 +坂野 +坂野上 +坂野下 +坂野井 +坂金 +坂長 +坂門 +坂間 +坂除 +坂隠 +坂頂 +坂頭 +坂馬 +坂駄 +坂高 +坂齊 +坂齋 +均 +坊 +坊の本 +坊ケ内 +坊ケ島 +坊ケ澤 +坊ケ田 +坊ケ迫 +坊ノ下 +坊ノ内 +坊上 +坊下 +坊中 +坊之下 +坊之園 +坊之本 +坊井 +坊伝 +坊作 +坊傳 +坊内 +坊出 +坊前 +坊南 +坊原 +坊古居 +坊向 +坊園 +坊地 +坊坂 +坊垣 +坊垣内 +坊城 +坊奥 +坊寺 +坊屋敷 +坊屋舗 +坊屋鋪 +坊山 +坊岡 +坊川 +坊所 +坊木 +坊本 +坊村 +坊池 +坊沢 +坊河内 +坊濃 +坊田 +坊良 +坊薗 +坊西 +坊谷 +坊農 +坊迫 +坊野 +坎 +坎田 +坐光寺 +坐古 +坐和 +坐臥 +坐間 +坡下 +坡伊 +坡場 +坡山 +坡川 +坡平 +坤徳 +坦 +坦ケ +坦田 +坪 +坪ノ上 +坪ノ内 +坪上 +坪下 +坪中 +坪久田 +坪之内 +坪井 +坪住 +坪佐 +坪倉 +坪元 +坪光 +坪入 +坪内 +坪利 +坪副 +坪北 +坪原 +坪口 +坪和 +坪地 +坪坂 +坪塚 +坪多 +坪子 +坪家 +坪尻 +坪尾 +坪居 +坪屋 +坪山 +坪岡 +坪島 +坪崎 +坪嶋 +坪川 +坪平 +坪庭 +坪意 +坪木 +坪本 +坪村 +坪来 +坪松 +坪林 +坪栄 +坪根 +坪森 +坪水 +坪江 +坪池 +坪沢 +坪河 +坪治 +坪沼 +坪浦 +坪澤 +坪田 +坪矢 +坪石 +坪祢 +坪禰 +坪能 +坪茶 +坪西 +坪見 +坪谷 +坪郷 +坪重 +坪野 +坪野内 +坪野松 +坪野谷 +坪金 +坪香 +垂 +垂ノ内 +垂下 +垂井 +垂伊 +垂内 +垂又 +垂口 +垂山 +垂木 +垂柳 +垂水 +垂永 +垂沢 +垂澤 +垂石 +垂脇 +垂見 +垂谷 +垂迫 +垂野 +垂門 +垂髪 +垢木 +垣 +垣ケ原 +垣上 +垣下 +垣並 +垣中 +垣丸 +垣久保 +垣之内 +垣井 +垣元 +垣入 +垣内 +垣内中 +垣内尻 +垣内田 +垣出 +垣出中 +垣副 +垣原 +垣又 +垣口 +垣合 +垣吉 +垣地 +垣坂 +垣城 +垣堺 +垣塚 +垣外 +垣外中 +垣妻 +垣守 +垣実 +垣實 +垣尻 +垣尾 +垣屋 +垣山 +垣岡 +垣岩 +垣島 +垣崎 +垣川 +垣巣 +垣平 +垣成 +垣戸 +垣手 +垣替 +垣木 +垣本 +垣村 +垣東 +垣松 +垣根 +垣森 +垣樋 +垣橋 +垣水 +垣永 +垣江 +垣沢 +垣沼 +垣波 +垣津 +垣浦 +垣浪 +垣深 +垣淵 +垣添 +垣渕 +垣澤 +垣瀬 +垣生 +垣田 +垣畑 +垣矢 +垣石 +垣立 +垣端 +垣羽 +垣脇 +垣花 +垣見 +垣谷 +垣貞 +垣貫 +垣越 +垣辺 +垣辻 +垣迫 +垣通 +垣道 +垣采 +垣野 +垣野内 +垣鍔 +垣阪 +垣附 +垣鼻 +垤 +垪和 +垰 +垰下 +垰井 +垰原 +垰口 +垰坂 +垰夲 +垰始 +垰尻 +垰山 +垰岡 +垰崎 +垰広 +垰本 +垰村 +垰根 +垰森 +垰田 +垰畑 +垰谷 +垰越 +垰野 +垰野下 +垳田 +埀井 +埀口 +埀石 +埀見 +埀野 +埀門 +埃沢 +埆田 +埇田 +埋 +埋ノ江 +埋忠 +埋樋 +埋橋 +埋田 +埋見 +埋金 +城 +城ケ原 +城ケ園 +城ケ埼 +城ケ峰 +城ケ崎 +城ケ平 +城ケ滝 +城ケ瀧 +城ケ端 +城ケ谷 +城ケ辻 +城ケ野 +城ノ上 +城ノ下 +城ノ代 +城ノ内 +城ノ口 +城ノ園 +城ノ戸 +城ノ脇 +城一 +城上 +城下 +城中 +城丸 +城之下 +城之内 +城之前 +城之園 +城之尾 +城之木 +城之脇 +城之薗 +城之鼻 +城井 +城井田 +城仁田 +城仙 +城代 +城使 +城信 +城倉 +城元 +城光 +城光寺 +城光治 +城全 +城内 +城処 +城出 +城分 +城前 +城力 +城加 +城勘 +城北 +城南 +城原 +城取 +城口 +城古 +城台 +城吉 +城向 +城和 +城国 +城園 +城土 +城土井 +城地 +城坂 +城垣 +城垣内 +城埜 +城堀 +城堂 +城塚 +城墻 +城多 +城子 +城守 +城定 +城宝 +城家 +城寳 +城寶 +城寺 +城尾 +城居 +城屋 +城屋敷 +城山 +城岡 +城岩 +城岸 +城峯 +城島 +城崎 +城嵜 +城嶋 +城嶌 +城嶽 +城川 +城川原 +城市 +城平 +城座 +城庵 +城弟 +城後 +城御堂 +城徳 +城念 +城成 +城戸 +城戸内 +城戸口 +城戸坂 +城戸岡 +城戸崎 +城戸橋 +城戸田 +城戸脇 +城所 +城方 +城明 +城月 +城木 +城本 +城杉 +城村 +城条 +城松 +城林 +城根 +城條 +城森 +城楽 +城武 +城殿 +城水 +城永 +城永須 +城江 +城池 +城沢 +城河内 +城津 +城浦 +城浴 +城海 +城添 +城滝 +城澤 +城瀬 +城物 +城生 +城生越 +城生野 +城田 +城甲 +城畑 +城直 +城石 +城福 +城立 +城端 +城竹 +城第 +城築 +城籏 +城籔 +城米 +城納 +城美 +城者 +城聞 +城能 +城脇 +城腰 +城至 +城臺 +城薮 +城薹 +城藤 +城藪 +城虎 +城處 +城西 +城見 +城角 +城詰 +城谷 +城貝 +城賀 +城賀本 +城越 +城辺 +城近 +城迫 +城連 +城道 +城部 +城里生 +城重 +城野 +城野口 +城金 +城釜 +城長 +城門 +城間 +城阪 +城音寺 +城須 +城領 +城頭 +城風 +城鳥 +城鼻 +埜 +埜々 +埜々下 +埜々内 +埜々山 +埜上 +埜下 +埜中 +埜仲 +埜倉 +埜口 +埜坂 +埜多家 +埜尻 +埜島 +埜崎 +埜嵜 +埜嶋 +埜川 +埜木 +埜本 +埜村 +埜林 +埜森 +埜沢 +埜渡 +埜澤 +埜瀬 +埜田 +埜畑 +埜真 +埜藤 +埜谷 +埜路木 +埜辺 +埜邉 +埜邊 +埜邑 +埜邨 +埜野内 +埜間 +埜馬 +域田 +埣塚 +埣浦 +埴 +埴原 +埴和 +埴山 +埴岡 +埴崎 +埴村 +埴沢 +埴淵 +埴渕 +埴澤 +埴生 +埴田 +埴谷 +埴部 +埴野 +執印 +執取 +執柄 +執業 +執行 +執見 +執頭 +基 +基井 +基太村 +基山 +基岡 +基峰 +基島 +基常 +基志川 +基村 +基森 +基永 +基江 +基田 +基石 +基野 +埼原 +埼山 +埼玉 +埼迫 +埼野 +埼間 +堀 +堀の内 +堀ノ +堀ノ上 +堀ノ下 +堀ノ内 +堀ノ口 +堀ノ江 +堀ノ薗 +堀一 +堀上 +堀下 +堀中 +堀之上 +堀之丸 +堀之内 +堀之北 +堀之口 +堀之園 +堀之段 +堀之江 +堀之薗 +堀亀 +堀井 +堀人 +堀代 +堀住 +堀保 +堀信 +堀元 +堀光 +堀兼 +堀内 +堀出 +堀切 +堀切園 +堀切川 +堀前 +堀北 +堀原 +堀友 +堀口 +堀古 +堀合 +堀吉 +堀名 +堀向 +堀味 +堀園 +堀土 +堀地 +堀坂 +堀垣 +堀城 +堀埜 +堀埼 +堀場 +堀塲 +堀士 +堀壽 +堀奥 +堀子 +堀安 +堀宮 +堀家 +堀富 +堀小 +堀尻 +堀尾 +堀居 +堀屋 +堀屋敷 +堀山 +堀岡 +堀峰 +堀島 +堀崎 +堀嵜 +堀嶋 +堀川 +堀常 +堀平 +堀底 +堀庭 +堀後 +堀恵 +堀戸 +堀打 +堀抜 +堀拔 +堀明 +堀木 +堀木田 +堀末 +堀本 +堀杉 +堀村 +堀束 +堀松 +堀林 +堀栄 +堀根 +堀榮 +堀欠 +堀次 +堀正 +堀段 +堀毛 +堀水 +堀永 +堀江 +堀江屋 +堀池 +堀沢 +堀河 +堀泉 +堀津 +堀浜 +堀海 +堀淵 +堀添 +堀清水 +堀渕 +堀渡 +堀溝 +堀澄 +堀澤 +堀濱 +堀瀬 +堀熊 +堀生 +堀田 +堀田井 +堀田沢 +堀田澤 +堀町 +堀畑 +堀留 +堀益 +堀矢 +堀石 +堀立 +堀端 +堀竹 +堀筋 +堀篭 +堀籐 +堀籠 +堀米 +堀納 +堀脇 +堀腰 +堀舘 +堀良 +堀苑 +堀葉 +堀藤 +堀蘢 +堀行 +堀西 +堀見 +堀角 +堀詰 +堀谷 +堀貫 +堀賀 +堀起 +堀越 +堀辺 +堀辻 +堀込 +堀近 +堀迫 +堀邉 +堀邊 +堀部 +堀里 +堀重 +堀野 +堀野上 +堀野内 +堀野辺 +堀金 +堀長 +堀間 +堀阪 +堀際 +堀館 +堀首 +堀馬 +堀高 +堂 +堂々 +堂の瀬 +堂ケ原 +堂ケ口 +堂ケ尾 +堂ケ崎 +堂ケ平 +堂ケ沢 +堂ケ澤 +堂ケ端 +堂ノ上 +堂ノ下 +堂ノ元 +堂ノ内 +堂ノ前 +堂ノ口 +堂ノ尾 +堂ノ本 +堂ノ浦 +堂ノ瀬 +堂ノ脇 +堂七 +堂丈 +堂上 +堂下 +堂中 +堂丸 +堂久保 +堂之上 +堂之下 +堂之前 +堂之本 +堂之脇 +堂井 +堂仏 +堂代 +堂伝 +堂佛 +堂元 +堂免 +堂八 +堂六 +堂内 +堂処 +堂出 +堂前 +堂加 +堂北 +堂原 +堂口 +堂向 +堂国 +堂囿 +堂國 +堂園 +堂土 +堂地 +堂坂 +堂坪 +堂垂 +堂垣 +堂垣内 +堂垣戸 +堂城 +堂城川 +堂埜 +堂場 +堂守 +堂安 +堂官 +堂宮 +堂家 +堂富 +堂寺 +堂寺ケ盛 +堂尻 +堂尾 +堂屋 +堂屋敷 +堂山 +堂岡 +堂岸 +堂峯 +堂峰 +堂島 +堂崎 +堂嵜 +堂嶋 +堂嶽 +堂川 +堂平 +堂床 +堂庭 +堂当 +堂後 +堂徳 +堂念 +堂所 +堂故 +堂新橋 +堂木 +堂本 +堂村 +堂東 +堂林 +堂柿 +堂根 +堂森 +堂棺 +堂橋 +堂段 +堂河内 +堂洞 +堂浜 +堂浦 +堂添 +堂湯 +堂満 +堂滿 +堂濱 +堂瀬 +堂珍 +堂用 +堂田 +堂畑 +堂畝 +堂當 +堂目 +堂知 +堂石 +堂福 +堂窪 +堂端 +堂篭 +堂籠 +堂脇 +堂腰 +堂芝 +堂花 +堂薗 +堂藤 +堂裏 +堂西 +堂見 +堂角 +堂角田 +堂谷 +堂谷内 +堂賀 +堂越 +堂跡 +堂路 +堂込 +堂迫 +堂道 +堂野 +堂野元 +堂野前 +堂野崎 +堂門 +堂閑 +堂間 +堂阪 +堂面 +堂領 +堂願 +堂馬 +堂高 +堂鳳 +堂黒 +堂鼻 +堂龍 +堅 +堅上 +堅井 +堅元 +堅名 +堅固 +堅固山 +堅城 +堅多 +堅小 +堅尾 +堅山 +堅岡 +堅島 +堅川 +堅帯 +堅志 +堅持 +堅木 +堅本 +堅東 +堅次 +堅正 +堅沢 +堅海 +堅澤 +堅物 +堅田 +堅畠 +堅石 +堅羽 +堅谷 +堅道 +堅達 +堅野 +堆 +堆中 +堆朱 +堆橋 +堤 +堤ノ内 +堤上 +堤下 +堤中 +堤之 +堤井 +堤側 +堤内 +堤原 +堤口 +堤坂 +堤尻 +堤山 +堤島 +堤崎 +堤嶋 +堤川 +堤本 +堤林 +堤橋 +堤沢 +堤添 +堤田 +堤町 +堤石 +堤端 +堤竹 +堤箸 +堤腰 +堤花 +堤荘 +堤見 +堤谷 +堤野 +堤針 +堤髪 +堧水尾 +堪井 +堪山 +堯 +堯天 +堯部 +堰 +堰上 +堰下 +堰代 +堰免 +堰八 +堰内 +堰口 +堰合 +堰向 +堰城 +堰塚 +堰川 +堰本 +堰根 +堰楽 +堰樂 +堰沢 +堰澤 +堰田 +堰端 +堰見 +堰野端 +場 +場々 +場中 +場作 +場先 +場勝 +場口 +場合 +場地 +場垣内 +場場 +場家 +場崎 +場工 +場所 +場本 +場松 +場正 +場生松 +場田 +場目 +場知賀 +場色 +場谷 +場谷内 +場野 +場集田 +堺 +堺井 +堺入 +堺原 +堺口 +堺垣 +堺堀 +堺屋 +堺本 +堺栄 +堺沢 +堺澤 +堺田 +堺目 +堺谷 +堺部 +堺野 +塀内 +塀和 +塀島 +塀本 +塀谷 +塊原 +塊場 +塒 +塔 +塔ケ崎 +塔ノ上 +塔上 +塔下 +塔之岡 +塔元 +塔前 +塔原 +塔向 +塔尾 +塔山 +塔岡 +塔島 +塔崎 +塔嶌 +塔春 +塔本 +塔村 +塔田 +塔筋 +塔谷 +塔迫 +塔野 +塔野岡 +塔間 +塔鼻 +塗 +塗々木 +塗井 +塗信 +塗合 +塗園 +塗塀 +塗壁 +塗家 +塗山 +塗岡 +塗島 +塗師 +塗師井 +塗師尾 +塗師岡 +塗師木 +塗師本 +塗師村 +塗師田 +塗師谷 +塗広 +塗廣 +塗木 +塗木岡 +塗本 +塗村 +塗森 +塗物 +塗田 +塗矢 +塗茂 +塗谷 +塗野 +塘 +塘中 +塘之口 +塘内 +塘原 +塘口 +塘地 +塘坂 +塘居 +塘岡 +塘崎 +塘川 +塘本 +塘村 +塘林 +塘永 +塘添 +塘田 +塘端 +塘路 +塘野 +塙 +塙下 +塙坂 +塙平 +塙本 +塙田 +塙谷 +塙阪 +塚 +塚ノ目 +塚上 +塚下 +塚中 +塚亀 +塚井 +塚倉 +塚元 +塚八 +塚内 +塚出 +塚分 +塚前 +塚副 +塚北 +塚升 +塚原 +塚口 +塚園 +塚地 +塚埼 +塚大 +塚定 +塚家 +塚尾 +塚山 +塚岡 +塚岸 +塚島 +塚崎 +塚嵜 +塚嶋 +塚川 +塚常 +塚平 +塚広 +塚廣 +塚形 +塚挟 +塚月 +塚木 +塚本 +塚村 +塚松 +塚林 +塚根 +塚橋 +塚正 +塚水 +塚永 +塚沢 +塚浜 +塚浦 +塚澤 +塚瀬 +塚狭 +塚狹 +塚生 +塚田 +塚由 +塚町 +塚畑 +塚留 +塚畝 +塚盛 +塚目 +塚石 +塚碕 +塚穴 +塚窪 +塚羽 +塚脇 +塚腰 +塚西 +塚見 +塚谷 +塚越 +塚輪 +塚辺 +塚迫 +塚邉 +塚邊 +塚部 +塚里 +塚野 +塚野目 +塚間 +塞本 +塩 +塩ノ入 +塩ノ崎 +塩ノ谷 +塩三 +塩上 +塩下 +塩中 +塩之入 +塩之谷 +塩井 +塩井川 +塩付 +塩住 +塩佐 +塩保 +塩俵 +塩倉 +塩元 +塩先 +塩光 +塩入 +塩入ケ谷 +塩入谷 +塩内 +塩冶 +塩出 +塩刈 +塩加井 +塩原 +塩口 +塩合 +塩向 +塩味 +塩唐松 +塩地 +塩坂 +塩坪 +塩垣 +塩埼 +塩塚 +塩境 +塩増 +塩士 +塩多 +塩安 +塩室 +塩宦 +塩宮 +塩家 +塩寺 +塩小路 +塩尻 +塩尾 +塩屋 +塩屋園 +塩山 +塩岡 +塩島 +塩崎 +塩嵜 +塩嶋 +塩嶌 +塩川 +塩幡 +塩平 +塩座 +塩形 +塩志 +塩成 +塩手 +塩抦 +塩旗 +塩月 +塩木 +塩本 +塩杉 +塩村 +塩松 +塩林 +塩柄 +塩栗 +塩根 +塩梅 +塩森 +塩次 +塩毛 +塩水 +塩水流 +塩永 +塩江 +塩池 +塩汲 +塩沢 +塩河 +塩治 +塩沼 +塩泡 +塩津 +塩浜 +塩浦 +塩海 +塩渕 +塩湯 +塩満 +塩滝 +塩滿 +塩澄 +塩澤 +塩濱 +塩瀧 +塩瀬 +塩生 +塩田 +塩畑 +塩留 +塩盛 +塩眞 +塩真 +塩矢 +塩石 +塩福 +塩穴 +塩竃 +塩竈 +塩竹 +塩築 +塩組 +塩練 +塩美 +塩羽間 +塩脇 +塩芳 +塩苅 +塩西 +塩見 +塩谷 +塩貝 +塩賀 +塩越 +塩足 +塩路 +塩車 +塩辺 +塩迫 +塩道 +塩邊 +塩部 +塩郷 +塩里 +塩野 +塩野井 +塩野入 +塩野崎 +塩野目 +塩野谷 +塩金 +塩釜 +塩長 +塩間 +塩阪 +塩附 +塩音 +塩頭 +塩飽 +塩高 +塩鶴 +填山 +塰川 +塰河 +塰泊 +塲中 +塲本 +塲田 +塵岡 +塵浜 +塵濱 +塹江 +境 +境下 +境井 +境元 +境入 +境内 +境出 +境原 +境口 +境地 +境垣内 +境堀 +境家 +境屋 +境山 +境川 +境木 +境本 +境松 +境橋 +境江 +境沢 +境澤 +境田 +境目 +境脇 +境蓮 +境藤 +境谷 +境野 +墅中 +墅間 +墓下 +墓前 +墓本 +墓田 +墓谷内 +墓越 +墓野 +墔郷 +増 +増ノ井 +増上 +増下 +増中 +増丸 +増井 +増亦 +増位 +増住 +増保 +増倉 +増元 +増内 +増冨 +増出 +増利 +増南 +増原 +増口 +増古 +増吉 +増味 +増和 +増喜 +増地 +増坂 +増坪 +増垣 +増埜 +増場 +増塩 +増子 +増守 +増実 +増宮 +増家 +増富 +増尾 +増居 +増屋 +増山 +増岡 +増島 +増崎 +増嵜 +増嶋 +増嶌 +増嶹 +増川 +増市 +増平 +増広 +増廣 +増弘 +増当 +増形 +増成 +増戸 +増掛 +増春 +増月 +増木 +増本 +増村 +増東 +増林 +増柴 +増栄 +増根 +増森 +増榮 +増橋 +増毛 +増水 +増永 +増汐 +増江 +増池 +増沢 +増治 +増泉 +増津 +増浜 +増浦 +増浪 +増淵 +増添 +増渕 +増満 +増滿 +増澤 +増濱 +増瀬 +増生 +増田 +増田屋 +増留 +増畠 +増當 +増百 +増盛 +増県 +増矢 +増石 +増神 +増穂 +増竹 +増縣 +増美 +増羽 +増茂 +増藤 +増藺 +増西 +増見 +増記 +増谷 +増賀 +増輪 +増邨 +増部 +増都 +増重 +増野 +増野谷 +増金 +増長 +増門 +増間 +増阪 +増雄 +増馬 +墨 +墨井 +墨原 +墨友 +墨吉 +墨土 +墨屋 +墨山 +墨岡 +墨崎 +墨川 +墨本 +墨村 +墨林 +墨江 +墨田 +墨矢 +墨笠 +墨絵 +墨繪 +墨谷 +墨野倉 +墫 +墫野 +墳下 +墳原 +墳崎 +墳本 +墹仲 +墻 +墻内 +墻屋 +墾 +壁 +壁下 +壁井 +壁内 +壁口 +壁地 +壁坂 +壁寸 +壁屋 +壁山 +壁岸 +壁島 +壁巣 +壁広 +壁打 +壁本 +壁村 +壁瀬 +壁田 +壁矢 +壁石 +壁総 +壁總 +壁腰 +壁舘 +壁谷 +壁谷沢 +壁谷澤 +壁野 +壁館 +壇 +壇上 +壇原 +壇崎 +壇本 +壇浦 +壇田 +壇辻 +壇野 +壕 +壙 +士反 +士坪 +士堅 +士師 +士水 +士津田 +士浦 +士濃塚 +士竪 +士貴 +士農 +士野 +壬生 +壬生倉 +壬生塚 +壬生川 +壬生田 +壮子 +声元 +声本 +声高 +壱ツ石 +壱丁 +壱丁田 +壱反田 +壱岐 +壱岐尾 +壱岐島 +壱岐本 +壱岐村 +壱崎 +壱村 +壱東 +壱枝 +壱柳 +壱橋 +壱添 +壱田 +壱谷 +壱貫田 +壱郷 +売井坂 +売場 +売島 +売市 +売谷 +売豆紀 +売賀 +売野 +売間 +壷 +壷中 +壷井 +壷倉 +壷内 +壷坂 +壷屋 +壷山 +壷崎 +壷川 +壷本 +壷林 +壷江 +壷河 +壷田 +壷見 +壷谷 +壷野 +壷阪 +壹ツ石 +壹丁 +壹反田 +壹岐 +壹岐尾 +壹岐島 +壹崎 +壹村 +壹橋 +壹添 +壹町畠 +壹谷 +壹貫田 +壺 +壺中 +壺井 +壺倉 +壺内 +壺坂 +壺屋 +壺山 +壺崎 +壺川 +壺林 +壺田 +壺谷 +壺阪 +壼内 +壽 +壽上 +壽乃田 +壽原 +壽命 +壽圓 +壽孝 +壽守 +壽安 +壽尾 +壽山 +壽岡 +壽崎 +壽嵜 +壽川 +壽徳 +壽惠村 +壽慶 +壽昌 +壽時 +壽本 +壽村 +壽松 +壽松木 +壽柳 +壽楽 +壽榮松 +壽樂 +壽永 +壽江島 +壽浅 +壽浦 +壽海 +壽淺 +壽渕 +壽満 +壽田 +壽田琉之 +壽畑 +壽盛 +壽福 +壽福院 +壽秋 +壽系 +壽美 +壽美田 +壽美谷 +壽老 +壽臺 +壽藤 +壽見 +壽谷 +壽賀 +壽賀崎 +壽賀野 +壽里 +壽野 +壽量 +夏 +夏井 +夏井坂 +夏伐 +夏住 +夏八木 +夏冨 +夏凪 +夏刈 +夏加 +夏原 +夏厩 +夏口 +夏吉 +夏地 +夏坂 +夏堀 +夏宮 +夏富 +夏屋 +夏山 +夏岸 +夏嶋 +夏川 +夏川戸 +夏成 +夏戸 +夏掘 +夏日 +夏明 +夏木 +夏木瀬 +夏本 +夏村 +夏林 +夏栗 +夏梅 +夏森 +夏樹 +夏水 +夏江 +夏池 +夏沢 +夏沼 +夏海 +夏焼 +夏生 +夏田 +夏畑 +夏目 +夏目田 +夏石 +夏神 +夏秋 +夏至 +夏苅 +夏葉 +夏虫 +夏見 +夏谷 +夏賀 +夏越 +夏迫 +夏野 +夏間 +夏龝 +夕 +夕は漢字 +夕下 +夕出 +夕向 +夕季 +夕島 +夕川 +夕日 +夕木 +夕永 +夕田 +夕部 +外 +外ノ岡 +外ノ池 +外ノ沢 +外上 +外下 +外丸 +外久保 +外之内 +外井 +外京 +外仮屋 +外余 +外倉 +外側 +外内 +外処 +外前原 +外前田 +外勢 +外原 +外口 +外司 +外和 +外和田 +外囿 +外園 +外地 +外垣 +外城 +外城戸 +外埼 +外堀 +外塚 +外子浦 +外室 +外宮 +外尾 +外尾原 +外屋 +外屋敷 +外山 +外岡 +外岩戸 +外岩根 +外峯 +外峰 +外島 +外崎 +外嵜 +外嶋 +外嶌 +外嶺 +外川 +外川内 +外希 +外平 +外当 +外恒見 +外戸 +外戸口 +外所 +外手 +外木 +外木場 +外木塲 +外本 +外村 +外松 +外林 +外枦保 +外枷 +外柳 +外櫨保 +外江 +外池 +外沢 +外河 +外波 +外波山 +外浜 +外浦 +外海 +外澤 +外濱 +外瀬 +外牧 +外狩 +外甫木 +外田 +外畑 +外當 +外矢 +外矢切 +外石 +外磯 +外礒 +外種子田 +外種田 +外窪 +外立 +外竹 +外筬 +外義 +外羽 +外舘 +外良 +外花 +外蔵 +外薗 +外處 +外裏 +外西 +外角 +外記 +外谷 +外谷地 +外谷場 +外谷塲 +外賀 +外赤 +外越 +外輪 +外邨 +外郎 +外部 +外里 +外野 +外野村 +外門 +外間 +外間門 +外除 +外音防 +外飼 +外館 +外鯨 +夘之原 +夘之木 +夘余野 +夘内 +夘原 +夘坂 +夘城 +夘埜 +夘塚 +夘尾 +夘尾崎 +夘山 +夘月 +夘月原 +夘木 +夘本 +夘沢 +夘津羅 +夘滝 +夘澤 +夘田 +夘目 +夘路 +夘辰 +夘道 +夘都木 +夘野 +夘野木 +多 +多々 +多々井 +多々内 +多々原 +多々地 +多々岡 +多々崎 +多々川 +多々木 +多々納 +多々羅 +多々美 +多々良 +多々見 +多々野 +多々隈 +多ケ谷 +多上 +多並 +多中 +多丸 +多久 +多久佐里 +多久島 +多久嶋 +多久田 +多久美 +多久見 +多久野 +多久間 +多井 +多井中 +多井作 +多井田 +多仁 +多代 +多代田 +多以良 +多仲 +多伊良 +多保 +多保田 +多倉 +多儀 +多元 +多児 +多内 +多冨 +多出村 +多利 +多功 +多加 +多加喜 +多加谷 +多勢 +多原 +多口 +多古 +多可 +多可谷 +多司 +多司馬 +多名井 +多名賀 +多名部 +多吾 +多呂 +多和 +多和本 +多和田 +多喜 +多喜乃 +多喜井 +多喜代 +多喜川 +多喜本 +多喜田 +多喜端 +多喜荘 +多喜野 +多嘉 +多嘉山 +多嘉良 +多園 +多地 +多坂 +多垜 +多城 +多堀 +多場 +多多 +多多納 +多多良 +多多見 +多多野 +多奈村 +多奈田 +多奈部 +多宇 +多宝 +多宝院 +多宮 +多家 +多富 +多寳 +多寳院 +多寶 +多寿 +多小田 +多小谷 +多尾 +多尾田 +多居 +多屋 +多山 +多岐 +多岐川 +多岡 +多島 +多島田 +多崎 +多嵜 +多嶋 +多嶋田 +多川 +多巻 +多布 +多幡 +多平 +多幸 +多幾 +多幾山 +多度 +多度津 +多形 +多志満 +多志賀 +多恵 +多恵馬 +多戸 +多持 +多摩川 +多斐 +多方 +多昌 +多智 +多智花 +多曽田 +多曾田 +多月 +多木 +多本 +多村 +多東 +多松 +多林 +多根 +多根井 +多桐 +多桗 +多森 +多橋 +多次 +多次見 +多武 +多武保 +多武良 +多武野 +多母髪 +多比 +多比木 +多比羅 +多比良 +多民 +多気 +多気田 +多氣 +多氣田 +多江 +多沢 +多河 +多治川 +多治比 +多治美 +多治見 +多波見 +多津 +多津田 +多津美 +多津見 +多海本 +多淵 +多渡 +多湖 +多満 +多満井 +多満城 +多満里 +多澤 +多瀬田 +多炭 +多熊 +多牧 +多田 +多田久 +多田井 +多田元 +多田内 +多田出 +多田尾 +多田川 +多田村 +多田津 +多田納 +多田羅 +多田良 +多田見 +多田谷 +多田野 +多田隈 +多畄 +多畑 +多留 +多留井 +多留木 +多留美 +多留見 +多留谷 +多皮 +多矢 +多知 +多知川 +多知花 +多石 +多神田 +多祢 +多福 +多禰 +多称 +多積 +多端 +多筥 +多米 +多米田 +多紀 +多納 +多羅 +多羅尾 +多羅岡 +多羅沢 +多羅澤 +多羅間 +多羽本 +多羽田 +多聞 +多胡 +多胡島 +多良 +多良尾 +多良木 +多良澤 +多良部 +多良間 +多芸 +多苗 +多菊 +多葉 +多葉井 +多葉村 +多葉田 +多葉西 +多藝 +多藤 +多衛野 +多見 +多見谷 +多見野 +多計 +多計為 +多記 +多谷 +多谷本 +多貝 +多賀 +多賀井 +多賀原 +多賀名 +多賀堂 +多賀屋 +多賀戸 +多賀本 +多賀根 +多賀橋 +多賀田 +多賀社 +多賀糸 +多賀能 +多賀良 +多賀谷 +多賀部 +多賀野 +多賀須 +多辺 +多辺田 +多辻 +多造 +多邉田 +多邊田 +多那 +多那瀬 +多邨 +多郎浦 +多郎畑 +多部 +多部田 +多郷 +多里 +多野 +多野木 +多鍋 +多長 +多門 +多門寺 +多門院 +多間 +多間田 +多陀 +多附 +多須 +多飛市 +多飯 +多飯田 +多養 +多鹿 +夛々 +夛々野 +夛ケ谷 +夛久 +夛久島 +夛井 +夛利 +夛和田 +夛喜 +夛喜田 +夛山 +夛島 +夛嶋 +夛川 +夛方 +夛村 +夛根井 +夛治川 +夛治見 +夛湖 +夛澤 +夛田 +夛田隈 +夛留見 +夛筥 +夛胡 +夛葉田 +夛谷 +夛賀 +夛賀谷 +夛賀野 +夛辺田 +夛那 +夛部 +夛部田 +夜久 +夜光 +夜山 +夜差 +夜明 +夜舩 +夜船 +夜西 +夜見 +夜部 +夜野 +夜野田 +夜陣 +夢 +夢寺 +夢川 +夢田 +夢藤 +夢道 +夢野 +大 +大ケ島 +大ケ瀬 +大ケ生 +大ケ谷 +大ケ谷内 +大ツ +大ノ上 +大ノ木 +大丁 +大万 +大丈 +大三 +大三和 +大三島 +大三川 +大三輪 +大上 +大上免 +大上戸 +大上野 +大下 +大下倉 +大下内 +大下本 +大下毛 +大下浦 +大下田 +大世 +大世古 +大世戸 +大世渡 +大丘 +大中 +大中原 +大中田 +大中臣 +大中道 +大串 +大丸 +大丸谷 +大丹生 +大主 +大久 +大久佐 +大久保 +大久利 +大久原 +大久奈 +大久村 +大久根 +大久津 +大久田 +大久畑 +大久農 +大久野 +大久間 +大之木 +大乗 +大乗坊 +大乗寺 +大九 +大乢 +大亀 +大二 +大五 +大井 +大井上 +大井出 +大井口 +大井園 +大井屋 +大井山 +大井川 +大井戸 +大井手 +大井津 +大井田 +大亦 +大京 +大京寺 +大人 +大人形 +大仁 +大仁後 +大仁田 +大今 +大仏 +大付 +大仙 +大代 +大仲 +大伊 +大伍 +大伏 +大休 +大休寺 +大伝 +大伯 +大伴 +大住 +大住元 +大佐 +大佐々 +大佐古 +大佐和 +大佐田 +大佐賀 +大佛 +大作 +大來 +大供 +大依 +大保 +大保古 +大保寺 +大保方 +大保木 +大保貝 +大信 +大信田 +大俣 +大俵 +大倉 +大倉野 +大倭 +大健 +大偶 +大傍 +大備 +大傳 +大儀 +大儀田 +大儀見 +大元 +大先 +大光 +大光司 +大光寺 +大光明 +大入 +大八児 +大八木 +大六 +大六野 +大具 +大兼 +大兼久 +大兼政 +大内 +大内山 +大内田 +大内蔵 +大内藏 +大円 +大円坊 +大冢 +大冨 +大冨部 +大出 +大出水 +大刀 +大刀川 +大刀祢 +大刀禰 +大分 +大切 +大刕 +大判 +大別府 +大利 +大削 +大前 +大副 +大割 +大力 +大力屋 +大加 +大加戸 +大加瀬 +大加田 +大加茂 +大動 +大務 +大勝 +大勢 +大勢待 +大勢持 +大勢登 +大北 +大千里 +大升 +大半場 +大南 +大印 +大即 +大原 +大原田 +大原関 +大厨 +大厩 +大参 +大又 +大叉 +大友 +大取 +大口 +大古 +大古利 +大古場 +大古戸 +大古殿 +大古瀬 +大古田 +大古知 +大古閑 +大句 +大可 +大台 +大司 +大吉 +大吉原 +大同 +大名 +大名門 +大后 +大向 +大向井 +大向江 +大否方 +大吹 +大呂 +大呑 +大味 +大味谷 +大和 +大和久 +大和地 +大和多 +大和屋 +大和山 +大和崎 +大和川 +大和杉 +大和江 +大和泉 +大和瀬 +大和田 +大和田野 +大和矢 +大和谷 +大和貴 +大咲 +大品畑 +大品畠 +大唐 +大善 +大喜 +大喜多 +大喜夛 +大喜太 +大喜戸 +大喜田 +大嘉 +大嘉田 +大四 +大図 +大図子 +大国 +大国護 +大国谷 +大囿 +大圃 +大國 +大國護 +大國谷 +大園 +大圓 +大圖 +大土 +大土井 +大土呂 +大土居 +大土手 +大土橋 +大土谷 +大在 +大在家 +大地 +大地原 +大地家 +大地山 +大地川 +大地木 +大地本 +大地田 +大坂 +大坂下 +大坂家 +大坂屋 +大坂田 +大坂谷 +大坂部 +大坂間 +大坊 +大坐畠 +大坪 +大垣 +大垣内 +大垰 +大埇 +大城 +大城代 +大城戸 +大城谷 +大埜 +大埜間 +大埴 +大基 +大埼 +大堀 +大堂 +大堤 +大堰 +大場 +大場沢 +大場澤 +大堺 +大塔 +大塘 +大塚 +大塧 +大塩 +大塲 +大塵 +大境 +大墅 +大増 +大墨 +大墳 +大墻 +大壁 +大士 +大売 +大壷 +大壺 +大壽美 +大壽賀 +大多 +大多和 +大多喜 +大多尾 +大多新 +大多氣 +大多田 +大多良 +大多賀 +大夛 +大夛和 +大夛田 +大夛賀 +大天 +大太 +大太刀 +大夫堀 +大奈 +大奈良 +大奈路 +大奥 +大好 +大如 +大妻 +大姓 +大姶良 +大威 +大子 +大子田 +大字 +大孝 +大学 +大學 +大宅 +大宇根 +大守 +大安 +大宗 +大定 +大宜味 +大宜見 +大宝 +大宝院 +大宣見 +大室 +大宮 +大宮司 +大宮地 +大宮山 +大宮路 +大宰 +大家 +大家庄 +大家谷 +大家迫 +大宿 +大寄 +大富 +大富部 +大寳 +大寶 +大寺 +大寺屋 +大対 +大寿 +大寿堂 +大寿美 +大寿賀 +大封 +大将 +大對 +大導寺 +大小 +大小出 +大小原 +大小堀 +大小島 +大小森 +大小治 +大小瀬 +大小田 +大小路 +大尻 +大尾 +大尾嘉 +大尾谷 +大居 +大屋 +大屋戸 +大屋敷 +大屋根 +大屋舗 +大屋船 +大屋部 +大屋鋪 +大山 +大山口 +大山田 +大山霰 +大岐 +大岡 +大岩 +大岩川 +大岩本 +大岩根 +大岩迫 +大岬 +大岳 +大岸 +大峠 +大峡 +大峪 +大峯 +大峰 +大島 +大島屋 +大島谷 +大峽 +大崎 +大崩 +大嵐 +大嵜 +大嵩 +大嵩崎 +大嶋 +大嶌 +大嶧 +大嶹 +大嶺 +大嶽 +大巌 +大川 +大川井 +大川内 +大川原 +大川口 +大川向 +大川平 +大川戸 +大川本 +大川津 +大川畑 +大川端 +大州 +大工 +大工保 +大工原 +大工園 +大工地 +大工屋 +大工廻 +大工町 +大工舎 +大工谷 +大工迴 +大己 +大巳 +大巴 +大巻 +大巾 +大市 +大師 +大師堂 +大席 +大常 +大帽 +大幅 +大幡 +大幢 +大平 +大平井 +大平原 +大平落 +大平野 +大年 +大幸 +大广邪 +大広 +大庄司 +大床 +大底 +大府 +大座 +大座畑 +大庫 +大庭 +大庭竹 +大庵 +大庾 +大廐 +大廣 +大廹 +大建 +大廻 +大廽 +大弓 +大弓川 +大引 +大弥 +大張 +大当 +大形 +大影 +大役寺 +大待 +大後 +大後戸 +大得 +大御 +大御堂 +大御門 +大徤 +大徳 +大徳屋 +大心池 +大志 +大志万 +大志保 +大志多 +大志摩 +大志民 +大志田 +大志磨 +大志茂 +大志賀 +大志野 +大忠 +大快 +大念寺 +大性 +大恵 +大恵田 +大悟法 +大悲山 +大惠 +大惠田 +大愛 +大慈 +大慈弥 +大慈彌 +大慶 +大懸 +大戎 +大成 +大成権 +大我 +大我口 +大戸 +大戸井 +大戸谷 +大戸迫 +大房 +大所 +大手 +大手山 +大手木 +大打 +大扱 +大折 +大抜 +大拔 +大持 +大指 +大挾 +大捕 +大掘 +大掛 +大握 +大搗 +大播 +大政 +大数 +大数加 +大数見 +大数賀 +大敷 +大文 +大文字 +大文字屋 +大新 +大新井 +大新垣 +大新田 +大方 +大施戸 +大旗 +大日 +大日南 +大日向 +大日川 +大日方 +大日田 +大日野 +大日陰 +大早 +大早田 +大昇 +大明 +大明地 +大星 +大春 +大景 +大智 +大暮 +大曲 +大更 +大曽 +大曽利 +大曽根 +大曾 +大曾根 +大月 +大有 +大朋 +大朏 +大朝 +大期 +大木 +大木下 +大木元 +大木原 +大木場 +大木山 +大木島 +大木戸 +大木手 +大木本 +大木田 +大木畑 +大木葉 +大木谷 +大木野 +大木須 +大末 +大本 +大杉 +大杉谷 +大村 +大村田 +大村谷 +大杓 +大杖 +大束 +大条 +大来 +大来帰 +大来田 +大東 +大東和 +大松 +大松崎 +大松沢 +大松澤 +大松谷 +大板 +大极 +大林 +大枝 +大枡 +大枦 +大柄 +大柄根 +大柏 +大柚 +大柚利 +大柚木 +大柱 +大柳 +大柳戸 +大柳津 +大柳生 +大柳豆 +大柴 +大柿 +大栃 +大栄 +大栗 +大栗田 +大栢 +大栩 +大株 +大根 +大根原 +大根坂 +大根川 +大根沢 +大根田 +大根谷 +大格 +大桃 +大桐 +大桑 +大桜 +大桝 +大桶 +大梁 +大梅 +大梙 +大梛 +大條 +大梧 +大梶 +大棒 +大棚 +大棟 +大森 +大棹 +大椋 +大植 +大椙 +大椚 +大椛 +大椨 +大椰 +大椿 +大楠 +大楢 +大楫 +大楯 +大極 +大楽 +大楽院 +大榊 +大榎 +大榎木 +大榎田 +大榮 +大槁 +大槇 +大構 +大槌 +大槙 +大槻 +大樂 +大樂院 +大樅 +大樋 +大樌 +大権 +大横 +大横田 +大樫 +大樹 +大樽 +大橋 +大橋場 +大機 +大檐 +大櫃 +大櫛 +大櫨 +大櫻 +大欠 +大次 +大欣 +大歌 +大正 +大正寺 +大正水流 +大正谷 +大正路 +大武 +大歯 +大歳 +大歴 +大段 +大殻 +大殿 +大殿内 +大比叡 +大比田 +大比羅 +大比良 +大比賀 +大毛 +大毛利 +大氏 +大気 +大氣 +大水 +大水戸 +大水流 +大永 +大汐 +大江 +大江原 +大江喜 +大江山 +大江田 +大池 +大池辺 +大沢 +大沢口 +大沢津 +大沢田 +大河 +大河内 +大河原 +大河平 +大河戸 +大河津 +大河瀬 +大河端 +大治 +大沼 +大沼田 +大泉 +大泊 +大法 +大波 +大波加 +大波多 +大波夛 +大注連 +大泰 +大泰司 +大洋 +大洞 +大津 +大津久 +大津加 +大津奇 +大津家 +大津寄 +大津屋 +大津山 +大津木 +大津田 +大津畄 +大津留 +大津谷 +大津賀 +大津輪 +大洲 +大浅 +大浅田 +大浜 +大浜崎 +大浦 +大浦地 +大浦坂 +大浦方 +大浩 +大浪 +大浴 +大海 +大海寺 +大海戸 +大海渡 +大涯地 +大涯池 +大淀 +大深 +大淵 +大淵脇 +大淺 +大清水 +大渓 +大渕 +大渕脇 +大渡 +大港 +大湊 +大湖 +大湖田 +大湯 +大湲 +大湾 +大満 +大源 +大源寺 +大溜 +大溝 +大溢 +大溪 +大滝 +大漁 +大漉 +大漏 +大潟 +大潮 +大澄 +大澗 +大澤 +大澤口 +大澤堂 +大澤津 +大濃 +大濱 +大濱崎 +大瀧 +大瀬 +大瀬坂 +大瀬戸 +大瀬木 +大瀬良 +大瀬音 +大灘 +大炊 +大炊御門 +大炭 +大烏 +大焚 +大無田 +大照 +大熊 +大熨 +大爺 +大片 +大牙 +大牛 +大牟田 +大牟礼 +大牟禮 +大牧 +大物 +大狩 +大狭 +大狭間 +大狹 +大狹間 +大狼 +大獄 +大玄 +大玉 +大王 +大王丸 +大理 +大瓦 +大瓶 +大甕 +大生 +大生川 +大用 +大甫 +大田 +大田中 +大田代 +大田原 +大田口 +大田和 +大田喜 +大田垣 +大田尾 +大田屋 +大田川 +大田木 +大田本 +大田桐 +大田石 +大田笠 +大田見 +大田越 +大田部 +大田黒 +大由 +大由利 +大由里 +大甲 +大町 +大町田 +大畑 +大畑谷 +大畔 +大畔地 +大留 +大畝 +大畠 +大畠谷 +大畦 +大番 +大番屋 +大當 +大疁 +大登 +大白 +大皷 +大皷石 +大皿 +大皿川 +大益 +大盛 +大盤 +大目 +大目木 +大相 +大相模 +大眉 +大県 +大矢 +大矢内 +大矢場 +大矢木 +大矢根 +大矢知 +大矢船 +大矢部 +大矢野 +大知 +大知里 +大矩 +大石 +大石原 +大石平 +大石本 +大石根 +大石橋 +大石田 +大石黒 +大砂 +大砂古 +大砂賀 +大硲 +大碇 +大磐 +大磧 +大磨 +大磯 +大礒 +大礰 +大礼 +大社 +大祖根 +大神 +大神田 +大祢 +大祢宜 +大祥 +大福 +大福地 +大福根 +大福谷 +大禮 +大禰 +大秋 +大科 +大秦 +大程 +大稔 +大稲 +大穀 +大穂 +大積 +大穗 +大穴 +大空 +大窄 +大窟 +大窪 +大竃 +大立 +大立川 +大立目 +大竜 +大童 +大端 +大竹 +大竹口 +大竹山 +大竹野 +大笑事 +大笘 +大笠 +大符 +大笹 +大筆 +大筋 +大筏 +大筒 +大箇 +大箕 +大管 +大箭 +大箱 +大箸 +大節 +大篁 +大範 +大築 +大篠 +大篭 +大簱 +大籏 +大籐 +大籔 +大籠 +大米 +大粂 +大粒來 +大粒来 +大粟 +大糀 +大紋 +大納 +大紫 +大紫磨 +大累 +大細 +大細田 +大紺 +大組 +大給 +大継 +大綱 +大網 +大総 +大緑 +大縄 +大縄橋 +大縣 +大縫 +大總 +大繁 +大繩 +大繹 +大纏 +大纒 +大置 +大羅 +大美 +大美屋 +大美浪 +大美賀 +大群 +大羽 +大羽沢 +大羽澤 +大羽田 +大羽賀 +大耒 +大聖 +大聖寺 +大聖寺谷 +大股 +大背 +大背戸 +大胡 +大胡田 +大能 +大脇 +大脊戸 +大腰 +大腹 +大膳 +大膳亮 +大臣 +大臺 +大臼 +大興 +大舌 +大舍羅 +大舎 +大舎羅 +大舘 +大舛 +大舟 +大舟木 +大舩 +大船 +大船人 +大良 +大良木 +大艶 +大艸 +大芋 +大芝 +大芦 +大花 +大花森 +大芳賀 +大苗 +大苗代 +大若 +大苫 +大茂 +大茂矢 +大茂谷 +大茄子川 +大茶 +大草 +大荒 +大荒田 +大荷 +大菅 +大菊 +大菰 +大菱池 +大萩 +大萬 +大萱 +大萱生 +大葉 +大葉勢 +大葉田 +大葛 +大葦 +大葭 +大葭原 +大葮原 +大蒔 +大蒲 +大蓮 +大蔦 +大蔭 +大蔵 +大薄 +大薗 +大薮 +大藏 +大藤 +大藪 +大蘆 +大蘿 +大虫 +大蛇 +大蛇森 +大蜘蛛 +大蝶 +大行 +大行司 +大衛 +大衡 +大表 +大裏 +大西 +大見 +大見山 +大見川 +大見本 +大見謝 +大規 +大観 +大角 +大角地 +大許 +大語 +大誠寺 +大護 +大谷 +大谷内 +大谷地 +大谷守 +大谷川 +大谷木 +大谷根 +大谷津 +大谷矢 +大谷部 +大谿 +大豆 +大豆堂 +大豆寄 +大豆本 +大豆村 +大豆生田 +大豆田 +大豊 +大貝 +大貞 +大財 +大貫 +大貴 +大賀 +大賀志 +大賀美 +大赤見 +大赦 +大起 +大越 +大越智 +大越谷 +大足 +大跡 +大路 +大車 +大軒 +大軽 +大輝 +大輪 +大輪田 +大辰 +大辺 +大辻 +大辻子 +大込 +大迎 +大近 +大迫 +大追 +大通 +大造 +大連 +大逵 +大逸 +大道 +大道口 +大道寺 +大達 +大邉 +大邊 +大邑 +大那 +大邨 +大郎良 +大部 +大部薗 +大郷 +大郷司 +大都 +大都城 +大酉 +大酒 +大酒井 +大酢 +大釈 +大釋 +大里 +大重 +大野 +大野上 +大野内 +大野原 +大野呂 +大野屋 +大野山 +大野川 +大野平 +大野木 +大野本 +大野段 +大野沢 +大野澤 +大野瀬 +大野田 +大野谷 +大金 +大釜 +大針 +大鈍内 +大鈴 +大鉙 +大鉢 +大銅 +大銧地 +大鋳 +大鋸 +大鋸本 +大鋸村 +大鋸谷 +大錦 +大録 +大鍋 +大鍔 +大鍛冶 +大鍛治 +大鍜治 +大鍬 +大鎌 +大鎗 +大鏡 +大鐘 +大鑄 +大鑿 +大長 +大長光 +大長根 +大門 +大開 +大間 +大間々 +大間知 +大関 +大關 +大阪 +大阪屋 +大阪谷 +大阪間 +大阿久 +大阿見 +大附 +大院 +大除 +大陰 +大陽 +大陽寺 +大隅 +大隆 +大隈 +大隝 +大隣 +大隩 +大雁丸 +大雄 +大雄寺 +大雅 +大集 +大雪 +大雲 +大霜 +大面 +大鞆 +大鞭 +大音 +大音師 +大須 +大須加 +大須田 +大須賀 +大領 +大頭 +大額 +大類 +大風 +大飛 +大飯 +大飯田 +大飼 +大館 +大饗 +大首 +大馬 +大馬崎 +大馬渡 +大駄 +大駅 +大駒 +大驛 +大高 +大高下 +大高坂 +大高木 +大高知 +大髭 +大鬼 +大魚 +大鮫 +大鯛 +大鰐 +大鱗 +大鳥 +大鳥井 +大鳥居 +大鳥羽 +大鳳 +大鳴 +大鴈丸 +大鴨 +大鴻 +大鵬 +大鵰 +大鶴 +大鷲 +大鷹 +大鷺 +大鹽 +大鹿 +大鹿糠 +大麦 +大麻 +大黒 +大黒司 +大黒屋 +大黒田 +大黒谷 +大鼓 +大鼓石 +大鼻 +大龍 +大﨏 +大𡌛 +大𡵸 +大𣽾 +大𥸮 +天 +天ケ島 +天ケ嶋 +天ケ瀬 +天ケ谷 +天一 +天上 +天下 +天下井 +天下谷 +天丸 +天久 +天久保 +天之宮 +天之辻 +天井 +天井沢 +天井澤 +天京 +天休 +天住 +天保 +天信 +天倉 +天元 +天光 +天児 +天兒 +天内 +天冨 +天利 +天前 +天助 +天勝 +天南 +天原 +天口 +天古 +天句 +天可 +天吹 +天呑 +天命 +天和 +天唐和 +天喰 +天国 +天國 +天土 +天地 +天坂 +天坊 +天坪 +天城 +天埜 +天堀 +天堂 +天堤 +天場 +天堵 +天塚 +天塲 +天女目 +天孝 +天宅 +天守 +天安 +天官 +天宮 +天宮城 +天家 +天寅 +天富 +天寺 +天小 +天尾 +天屯 +天山 +天岡 +天岩 +天岫 +天岳 +天岸 +天峰 +天島 +天崎 +天嵜 +天川 +天川谷 +天工 +天幸 +天广 +天広 +天廣 +天引 +天弘 +天形 +天後 +天徳 +天徳寺 +天恵 +天戸 +天手 +天掘 +天摩 +天新 +天方 +天日 +天早 +天明 +天明屋 +天春 +天晶 +天木 +天本 +天杉 +天村 +天林 +天根 +天森 +天橋 +天正 +天毎木 +天毛 +天気 +天水 +天江 +天池 +天沢 +天河 +天沼 +天法 +天津 +天津川 +天海 +天清 +天渡 +天満 +天満屋 +天満屋敷 +天満戸 +天満谷 +天滿 +天澤 +天瀬 +天瀬川 +天瀬田 +天然 +天牛 +天狗木 +天狗石 +天玉 +天王 +天王地 +天王寺 +天王寺谷 +天王沢 +天王澤 +天王野 +天瑞山 +天甚 +天生 +天生目 +天田 +天田内 +天畠 +天登 +天白 +天盛 +天目 +天目石 +天眞 +天真 +天矢 +天知 +天石 +天磨 +天社 +天神 +天神原 +天神園 +天神山 +天神木 +天神林 +天福 +天秤 +天立 +天竜 +天童 +天竹 +天竺 +天竺桂 +天笠 +天筒 +天米 +天粕 +天納 +天羽 +天羽生 +天聖院 +天能 +天良 +天艸 +天花寺 +天草 +天蔵 +天薬 +天藏 +天藤 +天見 +天親 +天谷 +天谷地 +天貝 +天賀 +天賀谷 +天路 +天辰 +天農 +天辺 +天辻 +天近 +天造 +天道 +天達 +天部 +天郷 +天都 +天里 +天重 +天野 +天野井 +天野倉 +天野宮 +天野川 +天金 +天門 +天間 +天間屋敷 +天間舘 +天間館 +天阪 +天雨 +天雲 +天雷 +天願 +天馬 +天高 +天鬼 +天鷲 +天麻 +天龍 +太 +太々野 +太上 +太下 +太与茂 +太中 +太丸 +太久保 +太井 +太井子 +太仁 +太代 +太仲 +太佐 +太倉 +太倉坐 +太公望 +太内 +太内田 +太刀 +太刀上 +太刀内 +太刀原 +太刀山 +太刀岡 +太刀川 +太刀掛 +太刀沢 +太刀浦 +太刀野 +太刀鉾 +太利 +太前 +太原 +太口 +太古 +太古前 +太司 +太向 +太呉 +太和田 +太喜 +太地 +太垣 +太城 +太場 +太場岡 +太塚 +太塲 +太多 +太多和 +太夫 +太夫本 +太子 +太子堂 +太子田 +太宅 +太安 +太宰 +太寺 +太寿堂 +太尾 +太尾下 +太尾田 +太居 +太屋 +太屋岡 +太山 +太岐口 +太島 +太崎 +太嵜 +太嶋 +太川 +太左 +太巻 +太布 +太幡 +太平 +太幸 +太志 +太恵須 +太房 +太才 +太斉 +太斎 +太智 +太智花 +太月 +太期 +太木 +太木本 +太村 +太枝 +太柳元 +太根 +太森 +太楽 +太歳 +太民 +太汐 +太江 +太江田 +太池 +太沢 +太河 +太河原 +太治 +太治野 +太洋 +太洞 +太津 +太浦 +太渕 +太湯 +太源 +太漏 +太澤 +太瀬 +太甫 +太田 +太田中 +太田井 +太田代 +太田児 +太田原 +太田口 +太田和 +太田喜 +太田垣 +太田家 +太田尻 +太田尾 +太田屋 +太田島 +太田嶋 +太田川 +太田桐 +太田津 +太田瀬 +太田良 +太田見 +太田越 +太田部 +太田野 +太田隈 +太田黒 +太町 +太畑 +太白 +太皷 +太皷地 +太目 +太矢 +太知 +太石 +太磨 +太神 +太秦 +太竹 +太等 +太箸 +太粟 +太細 +太組 +太縄 +太良 +太良丸 +太良坊 +太良尾 +太良木 +太茂野 +太葉田 +太藤 +太裏 +太西 +太見 +太記 +太谷 +太貫 +太賀 +太路 +太農 +太造 +太郎丸 +太郎坊 +太郎浦 +太郎田 +太郎良 +太郎館 +太野 +太野垣 +太長根 +太間 +太閤 +太附 +太陽寺 +太陽楼 +太隅 +太養寺 +太駄 +太高 +太麻 +太鼓 +太鼓地 +太鼓場 +太鼓矢 +太齊 +太齋 +夫代 +夫婦岩 +夫婦石 +夫宮 +夫本 +夫松 +夫津木 +夫馬 +央 +失尾 +夲多 +夷 +夷亀 +夷井 +夷塚 +夷子 +夷岡 +夷森 +夷石 +夷藤 +夷谷 +夷隅 +奇二 +奇峯 +奇峰 +奇本 +奇能 +奇藤 +奇験 +奈ラ原 +奈下恵 +奈代 +奈住 +奈佐 +奈佐原 +奈倉 +奈切 +奈加 +奈原 +奈古 +奈古屋 +奈呉 +奈呉江 +奈和手 +奈和良 +奈喜良 +奈地田 +奈城 +奈多 +奈女田 +奈女良 +奈子原 +奈宮 +奈尾 +奈山 +奈島 +奈嶋 +奈川 +奈幡 +奈手 +奈数 +奈智 +奈木 +奈木野 +奈村 +奈柄 +奈桐 +奈比川 +奈河 +奈治原 +奈波 +奈流芳 +奈爪 +奈田 +奈田羽 +奈田野 +奈留 +奈目良 +奈目良右治 +奈知 +奈竹 +奈羅尾 +奈義良 +奈良 +奈良井 +奈良元 +奈良原 +奈良口 +奈良和 +奈良坂 +奈良垣 +奈良場 +奈良定 +奈良尾 +奈良屋 +奈良山 +奈良岡 +奈良島 +奈良崎 +奈良嵜 +奈良川 +奈良平 +奈良木 +奈良本 +奈良村 +奈良林 +奈良橋 +奈良沢 +奈良澤 +奈良瀬 +奈良田 +奈良脇 +奈良芝 +奈良谷 +奈良貞 +奈良越 +奈良輪 +奈良迫 +奈良部 +奈良野 +奈良間 +奈蔵 +奈谷 +奈賀 +奈賀尾 +奈賀野 +奈路 +奈路田 +奈輪 +奈辺 +奈迫 +奈邉 +奈部 +奈部川 +奈部谷 +奈雪 +奈雲 +奈須 +奈須下 +奈須埜 +奈須川 +奈須本 +奈須田 +奈須賀 +奈須那 +奈須野 +奈鬼羅 +奉城 +奉守 +奉寿 +奉新 +奉日本 +奉書 +奉生 +奉養 +奏 +奐梠 +契里 +奔剛 +奠乃 +奠邑 +奥 +奥の矢 +奥ケ谷 +奥ノ +奥ノ園 +奥ノ坊 +奥ノ木 +奥ノ矢 +奥ノ薗 +奥ノ谷 +奥一 +奥丁 +奥上 +奥上野 +奥下 +奥並 +奥中 +奥丸 +奥主 +奥乃 +奥久 +奥久保 +奥之園 +奥之山 +奥之薗 +奥井 +奥代 +奥仲 +奥休場 +奥伝 +奥住 +奥佐 +奥佐羅 +奥作 +奥保 +奥信 +奥倉 +奥備 +奥傳 +奥元 +奥先 +奥内 +奥冨 +奥出 +奥分 +奥切 +奥刕屋 +奥利 +奥前 +奥北 +奥原 +奥友 +奥口 +奥吉 +奥名 +奥向 +奥呂木 +奥和田 +奥園 +奥土 +奥土居 +奥地 +奥坂 +奥坊 +奥垣 +奥垣内 +奥城 +奥埜 +奥堀 +奥堂 +奥場 +奥塚 +奥塩 +奥墨 +奥多 +奥大谷 +奥天 +奥定 +奥室 +奥宮 +奥家 +奥富 +奥寺 +奥小路 +奥尾 +奥居 +奥屋 +奥屋敷 +奥山 +奥岡 +奥岨 +奥岩 +奥岬 +奥岳 +奥岸 +奥峪 +奥峯 +奥峰 +奥島 +奥崎 +奥嵜 +奥嶋 +奥川 +奥州 +奥州屋 +奥州谷 +奥市 +奥平 +奥広 +奥座 +奥庭 +奥庵 +奥廣 +奥延 +奥御堂 +奥成 +奥戸 +奥所 +奥手 +奥抜 +奥拔 +奥政 +奥新 +奥明 +奥更屋 +奥木 +奥末 +奥本 +奥杉 +奥村 +奥村上 +奥条 +奥東 +奥松 +奥板 +奥林 +奥枝 +奥柳 +奥柿 +奥根 +奥條 +奥梠 +奥森 +奥植 +奥橋 +奥正 +奥武 +奥殿 +奥水 +奥永 +奥江 +奥池 +奥沢 +奥河 +奥河内 +奥河原 +奥泉 +奥波 +奥波羅 +奥洞 +奥津 +奥洲屋 +奥浜 +奥浦 +奥浦屋 +奥浪 +奥海 +奥深 +奥深山 +奥添 +奥渓 +奥滝 +奥澤 +奥濃 +奥濱 +奥瀧 +奥瀬 +奥灘 +奥炭 +奥爪 +奥牧 +奥玉 +奥田 +奥田代 +奥田良 +奥町 +奥畑 +奥留 +奥畠 +奥矢 +奥知 +奥石 +奥秋 +奥積 +奥空 +奥窪 +奥立 +奥端 +奥竹 +奥納 +奥美 +奥羽 +奥羽場 +奥能谷 +奥脇 +奥膳 +奥舎 +奥芝 +奥苑 +奥茂 +奥薗 +奥藤 +奥西 +奥見 +奥角 +奥詰 +奥谷 +奥谷内 +奥貞 +奥貫 +奥賀 +奥越 +奥辻 +奥迫 +奥逵 +奥道 +奥邑 +奥邨 +奥部 +奥里 +奥重 +奥野 +奥野井 +奥野山 +奥野所 +奥野木 +奥野田 +奥野矢 +奥野谷 +奥長 +奥門 +奥開 +奥間 +奥阪 +奥防 +奥隅 +奥雲 +奥須賀 +奥風 +奥駒 +奥高 +奥鳴 +奥鶴 +奥𡌛 +奧 +奧田 +奧野 +奮林 +女ケ沢 +女ケ澤 +女井 +女供 +女坂 +女夫池 +女子分 +女寺 +女屋 +女川 +女木 +女柳 +女池 +女沢 +女浦 +女淵 +女渕 +女滝 +女澤 +女瀧 +女田 +女町 +女良 +女良畑 +女賀 +女部田 +女鳥 +女鹿 +女鹿口 +女鹿田 +女鹿舘 +女鹿野 +女鹿館 +奴 +奴久妻 +奴井 +奴井名 +奴田 +奴田原 +奴畄湯 +奴留湯 +奴留由 +奴白 +奴賀 +奴野 +奴間 +好 +好並 +好中 +好井 +好住 +好元 +好光 +好冨 +好博 +好原 +好口 +好地 +好城 +好士 +好士埼 +好士崎 +好多 +好実 +好宮 +好富 +好山 +好岡 +好峯 +好峰 +好崎 +好川 +好平 +好廣 +好恒 +好木 +好末 +好本 +好村 +好森 +好次 +好武 +好永 +好江 +好池 +好沢 +好浦 +好満 +好澤 +好田 +好竹 +好美 +好藤 +好見 +好野 +好長 +好間 +如休 +如南 +如山 +如意 +如月 +如水 +如沢 +如法寺 +如澤 +如田 +如見 +如阪 +妃 +妋崎 +妓津 +妖崎 +妙一 +妙中 +妙井 +妙代 +妙光寺 +妙円園 +妙円薗 +妙加谷 +妙圓園 +妙圓薗 +妙島 +妙嶋 +妙川 +妙摩 +妙智 +妙木 +妙本 +妙村 +妙林 +妙楽 +妙泉 +妙清 +妙瀬田 +妙玄 +妙珍 +妙田 +妙立 +妙見 +妙見寺 +妙見迫 +妙護地 +妙護寺 +妙谷 +妙賀谷 +妙願 +妥敏尊 +妹原 +妹塚 +妹尾 +妹尾谷 +妹山 +妹岡 +妹島 +妹崎 +妹川 +妹沢 +妹澤 +妹田 +妹石 +妹背 +妹能 +妹脊 +妹良 +妹葉 +妹藤 +妹野 +妻ノ神 +妻井 +妻倉 +妻刈 +妻垣 +妻城 +妻夫木 +妻屋 +妻岐 +妻島 +妻崎 +妻嶋 +妻川 +妻形 +妻戸 +妻方 +妻有 +妻木 +妻本 +妻沢 +妻沼 +妻波 +妻澤 +妻瀬 +妻田 +妻由 +妻神 +妻科 +妻籠 +妻苅 +妻藤 +妻谷 +妻道 +妻達 +妻重 +妻野 +妻鳥 +妻鹿 +姉ケ山 +姉吉 +姉小路 +姉山 +姉崎 +姉嵜 +姉川 +姉帯 +姉帶 +姉歯 +姉石 +始平堂 +始沢 +始澤 +始田 +始関 +始閣 +姑射 +姑山 +姓丸 +姓億 +姓本 +姓納 +姓農 +委文 +委細 +姜山 +姜本 +姥 +姥ケ崎 +姥ケ沢 +姥ケ澤 +姥ケ谷 +姥久手 +姥原 +姥名 +姥塚 +姥妙 +姥山 +姥岳 +姥島 +姥崎 +姥嶋 +姥嶽 +姥木 +姥柳 +姥沢 +姥浦 +姥渕 +姥澤 +姥田 +姥神 +姥谷 +姥貝 +姥迫 +姥野 +姨島 +姨嶋 +姪原 +姪子本 +姫 +姫ケ迫 +姫井 +姫元 +姫内 +姫原 +姫地 +姫坂 +姫城 +姫子松 +姫宮 +姫小松 +姫尾 +姫居 +姫岡 +姫岩 +姫島 +姫崎 +姫嶋 +姫川 +姫川原 +姫廻 +姫木 +姫本 +姫村 +姫松 +姫次 +姫氏原 +姫池 +姫沢 +姫治 +姫沼 +姫浦 +姫澤 +姫田 +姫石 +姫見 +姫谷 +姫路 +姫里 +姫野 +姶良 +姿 +姿見 +威世 +威和 +威徳 +威徳井 +威徳寺 +威本 +威知 +威能 +威脇 +娌谷 +娚杉 +婦士 +婦川 +婦木 +媚山 +嫁兼 +嫁田 +嫁阪 +嫩 +嬉 +嬉内 +嬉賀 +嬉里 +嬉野 +子々津 +子ケ倉 +子上 +子井野 +子俣 +子冨呂 +子出藤 +子南 +子原 +子吉 +子坂 +子守 +子安 +子山 +子島 +子川 +子師 +子幡 +子延 +子成場 +子日 +子木弥 +子木彌 +子末 +子本 +子松 +子林 +子池 +子浦 +子浦田 +子牟礼 +子玉 +子生谷 +子甫 +子田 +子白 +子石 +子籠 +子羽根 +子若女 +子茂田 +子谷 +子迫 +子道 +子野井 +子野日 +子金 +子隅 +子鹿 +孔井 +孔原 +孔山 +孔本 +孔村 +孔沢 +孕 +孕川 +孕石 +字井 +字原 +字宝 +字室 +字山 +字廻 +字引 +字羽井 +字見 +存 +孚育 +孝 +孝久 +孝井 +孝内 +孝冨士 +孝原 +孝口 +孝壽 +孝多 +孝子 +孝学 +孝富士 +孝寿 +孝山 +孝岡 +孝峯 +孝峰 +孝島 +孝志 +孝忠 +孝戸 +孝月 +孝本 +孝村 +孝森 +孝橋 +孝治 +孝田 +孝石 +孝花 +孝行 +孝谷 +孝賢 +孝野 +孝頭 +孟子 +孟山 +季井 +季原 +季子 +季富 +季山 +季平 +季広 +季杉 +季村 +季東 +季松 +季武 +季白 +季盛 +季秋 +季羽 +季高 +孤塚 +孤峰 +孤島 +孤崎 +孤嶋 +孤杉 +孤松 +孤渓 +孤爪 +学 +学之 +学原 +学多 +学所 +学正 +学田 +学野 +学頭 +孫井 +孫代 +孫佐 +孫入 +孫八 +孫六 +孫城 +孫大 +孫子 +孫山 +孫崎 +孫嵜 +孫工 +孫左近 +孫平 +孫本 +孫根 +孫橋 +孫田 +孫福 +孫竹 +孫総 +孫總 +孫谷 +孫野 +孰賀 +學之 +學所 +學頭 +宅 +宅万 +宅井 +宅原 +宅味 +宅坊 +宅増 +宅宮 +宅島 +宅崎 +宅嶋 +宅嶌 +宅川 +宅摩 +宅明 +宅本 +宅森 +宅水 +宅永 +宅江 +宅波 +宅瀬 +宅田 +宅石 +宅磨 +宅美 +宅萬 +宅見 +宅部 +宅重 +宅野 +宅間 +宇ケ村 +宇ツ木 +宇ノ井 +宇ノ木 +宇ノ沢 +宇ノ澤 +宇上 +宇下 +宇並 +宇中 +宇丹 +宇久 +宇久本 +宇久村 +宇久田 +宇久里 +宇之木 +宇之沢 +宇之津 +宇之澤 +宇井 +宇井土 +宇井戸 +宇井野 +宇京 +宇仁 +宇仁田 +宇仁菅 +宇代 +宇住庵 +宇佐 +宇佐住 +宇佐元 +宇佐原 +宇佐崎 +宇佐嵜 +宇佐川 +宇佐木田 +宇佐波 +宇佐田 +宇佐神 +宇佐美 +宇佐見 +宇佐賀 +宇佐野 +宇侍見 +宇保 +宇働 +宇元 +宇内 +宇円田 +宇出 +宇出津 +宇別 +宇利 +宇加 +宇加井 +宇加地 +宇加江 +宇加治 +宇加津 +宇加谷 +宇加野 +宇南山 +宇原 +宇参 +宇口 +宇古 +宇名 +宇名手 +宇名根 +宇名沢 +宇名澤 +宇吹 +宇呂 +宇和 +宇和上 +宇和佐 +宇和城 +宇和山 +宇和島 +宇和嶋 +宇和川 +宇和房地 +宇和木 +宇和村 +宇和田 +宇和谷 +宇和賀 +宇和野 +宇品 +宇喜原 +宇喜多 +宇喜田 +宇圓田 +宇土 +宇土原 +宇土木 +宇土沢 +宇土澤 +宇地井 +宇地原 +宇地泊 +宇地越 +宇坂 +宇坪 +宇垣 +宇城 +宇埜 +宇埼 +宇堂 +宇塚 +宇壽山 +宇多 +宇多小路 +宇多川 +宇多村 +宇多津 +宇多田 +宇多見 +宇多賀 +宇夫 +宇夫形 +宇夫方 +宇奈手 +宇字 +宇宗田 +宇宙 +宇室 +宇宮 +宇家 +宇宿 +宇対瀬 +宇寿山 +宇小 +宇尻 +宇尾 +宇尾野 +宇居 +宇屋 +宇山 +宇岡 +宇岬 +宇島 +宇崎 +宇嵜 +宇嶋 +宇嶌 +宇川 +宇左美 +宇平 +宇座 +宇座敷 +宇庭 +宇建 +宇式 +宇張前 +宇徳 +宇志呂 +宇恵 +宇恵野 +宇惠 +宇惠野 +宇慶 +宇成 +宇戸 +宇戸口 +宇戸平 +宇戸田 +宇戸谷 +宇摩木 +宇数賀 +宇敷 +宇斗世 +宇新明 +宇於崎 +宇於嵜 +宇昌 +宇智田 +宇智英 +宇曽 +宇曽井 +宇曽谷 +宇曾 +宇月 +宇月原 +宇木 +宇末 +宇本 +宇杉 +宇条 +宇枝 +宇柳 +宇栄 +宇栄原 +宇栄城 +宇根 +宇根元 +宇根内 +宇根原 +宇根坪 +宇根山 +宇根岡 +宇根崎 +宇根川 +宇根底 +宇根本 +宇根水 +宇根沢 +宇根瀬 +宇根田 +宇根端 +宇根見 +宇根谷 +宇根越 +宇條 +宇梶 +宇森 +宇榮原 +宇橋 +宇次 +宇次原 +宇正 +宇殿 +宇毛 +宇民 +宇気 +宇水 +宇江 +宇江原 +宇江喜 +宇江城 +宇江杉 +宇江田 +宇沢 +宇河 +宇治 +宇治丸 +宇治原 +宇治土公 +宇治宮 +宇治家 +宇治山 +宇治川 +宇治木 +宇治本 +宇治村 +宇治橋 +宇治沢 +宇治澤 +宇治田 +宇治谷 +宇治部 +宇治郷 +宇治野 +宇沼 +宇波 +宇洞 +宇津 +宇津上 +宇津井 +宇津保 +宇津元 +宇津内 +宇津原 +宇津呂 +宇津味 +宇津和 +宇津喜 +宇津城 +宇津宮 +宇津尾 +宇津山 +宇津崎 +宇津川 +宇津巻 +宇津志 +宇津恵 +宇津木 +宇津木沢 +宇津木澤 +宇津本 +宇津村 +宇津森 +宇津橋 +宇津江 +宇津沢 +宇津澤 +宇津田 +宇津美 +宇津美矢 +宇津見 +宇津野 +宇浦 +宇浪 +宇海 +宇渡 +宇滝 +宇澤 +宇瀧 +宇瀬 +宇熊 +宇理須 +宇瑠間 +宇生 +宇田 +宇田利 +宇田尻 +宇田尾 +宇田居 +宇田山 +宇田川 +宇田津 +宇田見 +宇田賀 +宇田野 +宇田須 +宇畄島 +宇畑 +宇留井 +宇留島 +宇留嶋 +宇留川 +宇留志 +宇留根 +宇留江 +宇留生 +宇留田 +宇留賀 +宇留野 +宇留間 +宇留鷲 +宇登 +宇矢 +宇知川 +宇知田 +宇磨谷 +宇祢 +宇祢島 +宇祢嶋 +宇祢田 +宇禄 +宇禰 +宇秋 +宇積 +宇立 +宇納 +宇緑 +宇羅 +宇美 +宇羽野 +宇自可 +宇舗 +宇舘 +宇良 +宇良田 +宇苗 +宇茂佐 +宇草 +宇葉 +宇薄 +宇藤 +宇藤原 +宇藤山 +宇衛 +宇衞 +宇角 +宇谷 +宇貝 +宇貞 +宇貫 +宇賀 +宇賀伸 +宇賀冶 +宇賀地 +宇賀塚 +宇賀居 +宇賀山 +宇賀持 +宇賀本 +宇賀村 +宇賀治 +宇賀田 +宇賀神 +宇賀耶 +宇賀見 +宇賀谷 +宇賀那 +宇賀野 +宇越 +宇路 +宇辰 +宇達 +宇那手 +宇那木 +宇那田 +宇那野 +宇部 +宇部本 +宇部野 +宇郷 +宇都 +宇都井 +宇都保 +宇都元 +宇都出 +宇都原 +宇都口 +宇都城 +宇都宮 +宇都山 +宇都岡 +宇都木 +宇都本 +宇都江 +宇都田 +宇都見 +宇都野 +宇里 +宇野 +宇野丸 +宇野井 +宇野原 +宇野女 +宇野宮 +宇野山 +宇野川 +宇野木 +宇野本 +宇野沢 +宇野津 +宇野澤 +宇野田 +宇野辺 +宇鉄 +宇関 +宇關 +宇陀 +宇陀川 +宇陽 +宇随 +宇隨 +宇音 +宇須 +宇須井 +宇館 +宇高 +宇鷹 +宇麼谷 +守 +守ケ洞 +守一 +守上 +守下 +守丘 +守中 +守主 +守久 +守井 +守仲 +守住 +守作 +守倉 +守元 +守先 +守光 +守内 +守冨 +守分 +守利 +守北 +守原 +守友 +守口 +守合 +守吉 +守国 +守坂 +守城 +守塚 +守多 +守安 +守実 +守宮 +守家 +守富 +守實 +守尾 +守居 +守屋 +守山 +守岡 +守岩 +守島 +守崎 +守嶋 +守川 +守帰 +守広 +守廣 +守弘 +守戸 +守政 +守時 +守月 +守木 +守末 +守本 +守村 +守松 +守橋 +守次 +守武 +守殿 +守永 +守江 +守池 +守沖 +守沢 +守河 +守泉 +守法 +守泰 +守津 +守浦 +守満 +守澤 +守瀬 +守生 +守田 +守留 +守畠 +守真 +守矢 +守石 +守礼寿多 +守神 +守繁 +守能 +守脇 +守興 +守舎 +守良 +守茂山 +守藤 +守行 +守袖 +守西 +守角 +守護 +守谷 +守賀 +守越 +守道 +守邦 +守部 +守都 +守里 +守重 +守野 +守金 +守長 +守随 +守隨 +守高 +安 +安か川 +安カ川 +安ケ川 +安ケ平 +安チ谷 +安ノ井 +安上 +安下 +安並 +安中 +安丸 +安久 +安久井 +安久原 +安久根 +安久沢 +安久津 +安久澤 +安久祢 +安久称 +安久都 +安井 +安井田 +安仁屋 +安仏 +安代 +安仲 +安任 +安休 +安住 +安佐 +安佐伊 +安佛 +安作 +安來 +安保 +安保木 +安信 +安倉 +安倍 +安倍中 +安倍川 +安倍松 +安元 +安光 +安全寺 +安冨 +安冨祖 +安出 +安出川 +安則 +安前 +安力川 +安加賀 +安助 +安北 +安千谷 +安南 +安原 +安厨味 +安友 +安双 +安口 +安只 +安台 +安司 +安吉 +安名 +安周 +安味 +安和 +安善 +安喜 +安喰 +安図 +安国 +安國 +安土 +安在 +安地 +安地川 +安坂 +安型 +安垣 +安城 +安堂 +安場 +安堵 +安堵城 +安塚 +安増 +安士 +安多 +安多栄 +安大 +安好 +安妻 +安姓 +安威 +安子 +安子島 +安字井 +安孫 +安孫子 +安宅 +安宅山 +安宅川 +安宅木 +安守 +安宍 +安宗 +安定 +安宝 +安実 +安室 +安宮 +安家 +安宿 +安宿部 +安富 +安富祖 +安實 +安寺 +安封 +安尻 +安尾 +安居 +安居和 +安居院 +安屋 +安屋敷 +安山 +安岐 +安岡 +安岩 +安岳 +安岸 +安峯 +安峰 +安島 +安崎 +安嵜 +安嶋 +安嶌 +安嶺 +安川 +安川内 +安常 +安平 +安平次 +安平治 +安広 +安床 +安座 +安座上 +安座名 +安座間 +安庭 +安康 +安廣 +安延 +安引 +安形 +安彦 +安影 +安徳 +安心院 +安志摩 +安念 +安恒 +安恵 +安惠 +安慶 +安慶名 +安慶田 +安懸 +安成 +安我子 +安戝 +安戸 +安房 +安房井 +安房田 +安才 +安持 +安持地 +安掛 +安摩 +安政 +安斉 +安斎 +安方 +安日 +安旨 +安明 +安星 +安是 +安昼 +安晝 +安曇 +安曽 +安曽田 +安曾 +安月 +安木 +安本 +安村 +安杖 +安来 +安東 +安松 +安松谷 +安林 +安枝 +安枩谷 +安栄 +安栖 +安栗 +安根 +安梅 +安棟 +安森 +安棲 +安楽 +安楽城 +安楽岡 +安楽島 +安榮 +安槌 +安槻 +安樂 +安樂城 +安樂岡 +安樂島 +安樹 +安橋 +安次 +安次富 +安次峯 +安次峰 +安次嶺 +安次知 +安武 +安毛 +安氏 +安気 +安水 +安永 +安江 +安池 +安沢 +安河 +安河内 +安河山 +安治 +安治川 +安泉 +安波 +安津 +安津定 +安津畑 +安津見 +安洲 +安浦 +安浦岡 +安浪 +安海 +安清 +安済 +安渓 +安渕 +安渡 +安渡林 +安満 +安潟 +安澄 +安澤 +安濃 +安濃田 +安濟 +安瀬 +安瀬原 +安瀬地 +安父 +安片 +安生 +安生地 +安用寺 +安甫 +安田 +安畑 +安留 +安発 +安登 +安發 +安益 +安盛 +安相 +安県 +安知 +安知谷 +安石 +安社 +安神 +安福 +安秋 +安穂 +安積 +安立 +安竜 +安竹 +安籐 +安精 +安納 +安素野 +安細 +安縣 +安羅 +安羅岡 +安美 +安美留 +安能 +安舎木 +安舘 +安良 +安良城 +安良岡 +安良田 +安良賀 +安芸 +安芸友 +安芸田 +安若 +安茂 +安荘 +安葉 +安蒜 +安蔭 +安蔵 +安薺 +安藏 +安藝 +安藤 +安蘇 +安蘇谷 +安蘓 +安蛭 +安行 +安衣 +安西 +安見 +安詮院 +安諸 +安護 +安護田 +安谷 +安谷仁屋 +安谷内 +安谷屋 +安谷矢 +安谿 +安豊 +安財 +安賀 +安賀多 +安賀川 +安足 +安路賀 +安辺 +安近 +安迫 +安逹 +安道 +安達 +安達原 +安邉 +安邊 +安那 +安邨 +安部 +安部井 +安部倉 +安部山 +安部川 +安部松 +安部田 +安部野 +安郷 +安都間 +安酸 +安里 +安重 +安野 +安野木 +安野谷 +安長 +安間 +安阪 +安阿弥 +安阿彌 +安附 +安陪 +安陵 +安随 +安隨 +安雑 +安雙 +安雲 +安静 +安面 +安類 +安風 +安食 +安養 +安養子 +安養寺 +安館 +安香 +安馬 +安高 +安黒 +安齊 +安齋 +安齎 +安龍 +宋原 +宋本 +完 +完井 +完倉 +完原 +完土 +完城 +完塚 +完山 +完岡 +完戸 +完本 +完甘 +完田 +完賀 +完野 +宍井 +宍倉 +宍喰 +宍喰野 +宍土 +宍塚 +宍室 +宍戸 +宍木 +宍村 +宍浦 +宍甘 +宍田 +宍篭 +宍籠 +宍粟 +宍継 +宍貝 +宍道 +宍野 +宏乃 +宏林 +宏橋 +宏洲 +宗 +宗万 +宗上 +宗下 +宗中 +宗久 +宗井 +宗京 +宗亭 +宗仲 +宗伝 +宗佐 +宗佐田 +宗俊 +宗保 +宗信 +宗倉 +宗像 +宗元 +宗光 +宗兼 +宗内 +宗円 +宗利 +宗則 +宗前 +宗助 +宗包 +宗原 +宗友 +宗口 +宗台 +宗司 +宗吉 +宗呂 +宗和 +宗国 +宗國 +宗園 +宗圓 +宗垣 +宗塚 +宗好 +宗守 +宗安 +宗官 +宗定 +宗実 +宗宮 +宗家 +宗實 +宗尻 +宗尾 +宗山 +宗岡 +宗島 +宗崎 +宗嶋 +宗川 +宗平 +宗広 +宗座 +宗廣 +宗延 +宗弘 +宗形 +宗得 +宗徳 +宗心 +宗忠 +宗意 +宗我 +宗我部 +宗戸 +宗房 +宗接 +宗政 +宗数 +宗方 +宗明 +宗時 +宗景 +宗木 +宗末 +宗本 +宗村 +宗条 +宗東 +宗松 +宗林 +宗枝 +宗根 +宗條 +宗森 +宗楽 +宗樂 +宗橋 +宗次 +宗正 +宗武 +宗歳 +宗永 +宗沢 +宗河 +宗津 +宗海 +宗添 +宗清 +宗源 +宗滝 +宗澤 +宗瀧 +宗片 +宗玄 +宗田 +宗畑 +宗盛 +宗石 +宗福 +宗竹 +宗籐 +宗続 +宗綱 +宗續 +宗美 +宗臺 +宗蓮 +宗藤 +宗行 +宗西 +宗谷 +宗貞 +宗賀 +宗越 +宗輪 +宗近 +宗造 +宗進 +宗部 +宗里 +宗重 +宗野 +宗金 +宗長 +宗院 +宗隆 +宗雪 +宗雲 +宗高 +官 +官上 +官中 +官代 +官尾 +官崎 +官川 +官林 +官梅 +官沢 +官治 +官浪 +官澤 +官田 +官福 +官能 +官見 +官谷 +官部 +官野 +定 +定中 +定丸 +定久 +定井 +定京 +定仙 +定仲 +定住 +定作 +定保 +定信 +定元 +定光 +定免 +定入 +定兼 +定冨 +定別当 +定別當 +定利 +定原 +定友 +定司 +定国 +定國 +定地 +定塚 +定好 +定守 +定安 +定宗 +定家 +定富 +定尾 +定居 +定山 +定岡 +定峰 +定島 +定嶋 +定川 +定師 +定常 +定平 +定広 +定廣 +定延 +定形 +定影 +定徳 +定成 +定房 +定政 +定敏 +定方 +定時 +定月 +定木 +定末 +定本 +定杉 +定村 +定来 +定松 +定栄 +定梶 +定棟 +定森 +定榮 +定標 +定橋 +定次 +定歳 +定水 +定永 +定江 +定池 +定浪 +定清 +定満 +定田 +定由 +定留 +定益 +定盛 +定直 +定石 +定祐 +定秀 +定籐 +定繁 +定者 +定脇 +定舎 +定良 +定藤 +定蛇 +定行 +定衛 +定見 +定詰 +定講 +定谷 +定賀 +定近 +定連 +定道 +定野 +定金 +定雪 +定面 +定𡌛 +宛坂 +宛塚 +宛木 +宜保 +宜名眞 +宜名真 +宜喜 +宜壽次 +宜寿次 +宜川 +宜志 +宜志富 +宜春 +宜本 +宜野 +宜野山 +宜野座 +宜間 +宝 +宝ノ木 +宝上 +宝中 +宝久 +宝亀 +宝井 +宝京 +宝仙 +宝代 +宝代地 +宝住 +宝保 +宝光井 +宝光山 +宝内 +宝出 +宝利 +宝前 +宝剣 +宝剱 +宝劒 +宝劔 +宝力 +宝勝 +宝勢 +宝口 +宝喜 +宝園 +宝土 +宝地 +宝地戸 +宝坂 +宝垣 +宝城 +宝埼 +宝場 +宝塚 +宝壁 +宝壷 +宝壺 +宝多 +宝大寺 +宝妻 +宝子 +宝子丸 +宝子山 +宝学 +宝官 +宝定 +宝寄 +宝寄山 +宝寺 +宝寿 +宝専 +宝尺 +宝居 +宝屋敷 +宝山 +宝岡 +宝島 +宝崎 +宝嶋 +宝川 +宝平 +宝得 +宝徳 +宝性 +宝意 +宝持 +宝方 +宝明 +宝智 +宝月 +宝木 +宝木原 +宝本 +宝村 +宝条 +宝来 +宝松 +宝林 +宝柳 +宝栄 +宝森 +宝楽 +宝榮 +宝槌 +宝槻 +宝樹 +宝橋 +宝正 +宝殊山 +宝毛 +宝水 +宝永 +宝江 +宝池 +宝沢 +宝治米 +宝泉 +宝泉坊 +宝渦 +宝満 +宝溝 +宝滿 +宝澤 +宝玉 +宝珍 +宝珎 +宝珠 +宝珠山 +宝珠戸 +宝理 +宝生 +宝田 +宝石 +宝示 +宝示戸 +宝神 +宝福 +宝積 +宝窪 +宝立 +宝竜 +宝納 +宝耒 +宝船 +宝莱 +宝華 +宝蔵 +宝蔵地 +宝蔵寺 +宝蔵院 +宝藏 +宝藏寺 +宝藤 +宝見 +宝角 +宝諸 +宝谷 +宝財院 +宝賀 +宝起 +宝輪 +宝辺 +宝迫 +宝道 +宝達 +宝部 +宝都賀 +宝里 +宝野 +宝金 +宝鏡 +宝門 +宝関 +宝閣 +宝龍 +実 +実下 +実丸 +実久 +実井 +実保 +実信 +実倉 +実光 +実入 +実兼 +実利 +実升 +実原 +実友 +実取 +実吉 +実善 +実国 +実城 +実好 +実好田 +実守 +実安 +実宗 +実宝 +実宮 +実富 +実山 +実岡 +実島 +実崎 +実川 +実常 +実平 +実広 +実延 +実形 +実成 +実才 +実操 +実政 +実方 +実木 +実末 +実末(實末) +実本 +実村 +実松 +実柿 +実桐 +実森 +実樹 +実正 +実歳 +実沢 +実法 +実法院 +実浄 +実淵 +実清 +実渊 +実渕 +実熊 +実生 +実田 +実登 +実盛 +実相 +実相寺 +実相院 +実石 +実積 +実籐 +実籾 +実綿 +実繁 +実義 +実能田 +実藤 +実谷 +実貞 +実貴 +実近 +実迫 +実透 +実邑 +実重 +実野 +実金 +実隅 +客 +客井 +客出 +客坂 +客本 +客殿 +客永 +客渡 +客野 +宣井 +宣保 +宣元 +宣原 +宣城 +宣山 +宣川 +宣志富 +宣本 +宣野 +宣野座 +室 +室ノ園 +室上 +室下 +室中 +室久 +室久保 +室之園 +室井 +室人 +室伏 +室住 +室作 +室元 +室内 +室冨 +室前 +室加 +室北 +室原 +室口 +室園 +室地 +室坂 +室垣 +室垣内 +室城 +室塚 +室安 +室宮 +室家 +室富 +室寺 +室尾 +室屋 +室山 +室岡 +室岩 +室峯 +室峰 +室島 +室崎 +室川 +室巻 +室市 +室常 +室弥 +室志 +室我 +室戸 +室星 +室月 +室木 +室本 +室杉 +室村 +室松 +室林 +室根 +室梅 +室橋 +室武 +室殿 +室水 +室永 +室江 +室沢 +室河 +室波 +室洋 +室津 +室浜 +室浦 +室渓 +室溝 +室溪 +室澄 +室澤 +室濱 +室瀬 +室生 +室田 +室町 +室畑 +室留 +室矢 +室石 +室積 +室端 +室笠 +室節 +室脇 +室腰 +室臣 +室舘 +室茂 +室薗 +室見 +室角 +室谷 +室谷内 +室賀 +室賦 +室越 +室辰 +室達 +室重 +室野 +室野井 +室長 +室門 +室館 +室高 +宥下 +宥免 +宮 +宮の下 +宮の原 +宮ケ +宮ケ丁 +宮ケ中 +宮ケ原 +宮ケ崎 +宮ケ谷 +宮ケ迫 +宮ケ野 +宮ノ上 +宮ノ下 +宮ノ入 +宮ノ内 +宮ノ前 +宮ノ原 +宮ノ尾 +宮ノ畑 +宮ノ脇 +宮ノ腰 +宮一 +宮三 +宮上 +宮下 +宮世古 +宮丘 +宮中 +宮串 +宮丸 +宮久 +宮久保 +宮久地 +宮之上 +宮之下 +宮之元 +宮之内 +宮之前 +宮之原 +宮之尾 +宮之本 +宮之脇 +宮之腰 +宮之首 +宮井 +宮仕 +宮代 +宮仲 +宮住 +宮佐 +宮佐古 +宮作 +宮保 +宮信 +宮倉 +宮側 +宮傍 +宮儀 +宮元 +宮先 +宮光 +宮入 +宮兼 +宮内 +宮内後 +宮冨 +宮冶 +宮凪 +宮出 +宮分 +宮利 +宮前 +宮副 +宮加谷 +宮勝 +宮北 +宮千代 +宮南 +宮原 +宮原田 +宮口 +宮古 +宮台 +宮司 +宮吉 +宮名 +宮名利 +宮向 +宮向井 +宮告 +宮和田 +宮咲 +宮喜 +宮回 +宮国 +宮囿 +宮國 +宮園 +宮土 +宮地 +宮坂 +宮坊 +宮坪 +宮垣 +宮垣内 +宮垣津 +宮城 +宮城島 +宮城嶋 +宮城嶌 +宮城谷 +宮城野 +宮埜 +宮基 +宮埼 +宮堀 +宮堂 +宮場 +宮堺 +宮塚 +宮増 +宮士 +宮壽 +宮外 +宮多 +宮夫 +宮奈 +宮奥 +宮子 +宮字 +宮宅 +宮宇地 +宮宇治 +宮守 +宮安 +宮宗 +宮定 +宮室 +宮家 +宮富 +宮寺 +宮寿 +宮小路 +宮尻 +宮尾 +宮尾井 +宮居 +宮屋 +宮屋敷 +宮山 +宮岐 +宮岡 +宮岳 +宮岸 +宮島 +宮崎 +宮嵜 +宮嶋 +宮嶌 +宮川 +宮巻 +宮市 +宮師 +宮幡 +宮平 +宮幸 +宮广 +宮広 +宮庄 +宮床 +宮座 +宮康 +宮廣 +宮廻 +宮廽 +宮弓 +宮当 +宮形 +宮後 +宮応 +宮慶 +宮應 +宮成 +宮戸 +宮戸田 +宮房 +宮所 +宮手 +宮折 +宮拝 +宮持 +宮政 +宮新 +宮方 +宮明 +宮春 +宮時 +宮景 +宮智 +宮曽根 +宮月 +宮有 +宮木 +宮末 +宮本 +宮杉 +宮村 +宮杜 +宮条 +宮東 +宮松 +宮板 +宮林 +宮枝 +宮柱 +宮柳 +宮栄 +宮根 +宮條 +宮森 +宮植 +宮楠 +宮榮 +宮橋 +宮次 +宮正 +宮武 +宮毛 +宮氏 +宮気 +宮氣 +宮水 +宮永 +宮江 +宮池 +宮沖 +宮沢 +宮河 +宮治 +宮沼 +宮波 +宮洞 +宮津 +宮洲 +宮浜 +宮浦 +宮淵 +宮添 +宮清 +宮渓 +宮渕 +宮滝 +宮澄 +宮澤 +宮濱 +宮瀧 +宮瀬 +宮熊 +宮牟礼 +宮牟禮 +宮牧 +宮狭 +宮狹 +宮王 +宮生 +宮田 +宮町 +宮畑 +宮留 +宮畝 +宮畠 +宮當 +宮登 +宮盛 +宮石 +宮碕 +宮磨 +宮福 +宮秋 +宮穂 +宮穗 +宮窪 +宮立 +宮端 +宮竹 +宮管 +宮籐 +宮糸 +宮納 +宮縁 +宮繁 +宮羽 +宮能 +宮脇 +宮腰 +宮腰屋 +宮臣 +宮臺 +宮舘 +宮舟 +宮良 +宮艸 +宮芝 +宮花 +宮苑 +宮草 +宮葉 +宮蔭 +宮薗 +宮藤 +宮袋 +宮裏 +宮裡 +宮西 +宮規 +宮角 +宮訳 +宮詰 +宮譯 +宮谷 +宮谷内 +宮谷台 +宮負 +宮賀 +宮賀崎 +宮越 +宮路 +宮軒 +宮輪 +宮辺 +宮辻 +宮近 +宮迫 +宮追 +宮逧 +宮道 +宮達 +宮邉 +宮邊 +宮邦 +宮部 +宮郷 +宮都 +宮里 +宮重 +宮野 +宮野下 +宮野入 +宮野内 +宮野前 +宮野原 +宮野尾 +宮野川 +宮野森 +宮野谷 +宮野里 +宮野音 +宮野首 +宮野鼻 +宮金 +宮錦 +宮鍋 +宮長 +宮門 +宮間 +宮関 +宮阪 +宮隅 +宮階 +宮際 +宮領 +宮頭 +宮風 +宮風呂 +宮食 +宮飼 +宮館 +宮首 +宮馬 +宮高 +宮鳥 +宮鷹 +宮鹿 +宮鹿野 +宮麻 +宮鼻 +宮𢌞 +宮𦊆 +宰 +宰井 +宰務 +宰原 +宰川 +宰所 +宰田 +宰相 +宰若 +宵 +宵奈良 +宵田 +宵谷 +宵野間 +家 +家ノ上 +家ノ子 +家上 +家下 +家並 +家中 +家串 +家久 +家久人 +家久保 +家久来 +家久来慶 +家久耒 +家亀 +家井 +家亦 +家代 +家代岡 +家令 +家仲 +家住 +家保 +家信 +家倉 +家元 +家光 +家入 +家内 +家冨 +家出 +家前 +家加 +家千 +家原 +家口 +家古 +家古矢 +家古谷 +家合 +家吉 +家名田 +家向 +家喜 +家地 +家坂 +家垣 +家城 +家塚 +家壽多 +家壽田 +家奥 +家始 +家子 +家宅 +家宇治 +家守 +家安 +家室 +家宮 +家富 +家寿 +家寿多 +家寿田 +家尾谷 +家山 +家岡 +家島 +家崎 +家嶋 +家川 +家市 +家常 +家平 +家広 +家座 +家廣 +家式 +家弓 +家彌 +家形 +家後 +家徳 +家志 +家成 +家戸 +家所 +家才子 +家持 +家接 +家政 +家敷 +家方 +家時 +家曽 +家木 +家本 +家村 +家板 +家林 +家柄木 +家柳 +家根 +家根内 +家根原 +家根口 +家根川 +家根本 +家根村 +家根橋 +家根田 +家根谷 +家森 +家次 +家段 +家氏 +家永 +家江 +家池 +家沢 +家治 +家治川 +家泉 +家洞 +家浦 +家浮 +家満登 +家澤 +家瀬 +家熊 +家現 +家生 +家田 +家町 +家留 +家畠 +家登 +家盛 +家石 +家神 +家祢 +家福 +家禰 +家竹 +家納 +家老 +家股 +家脇 +家興 +家舗 +家良田 +家花 +家苗 +家蔵 +家藤 +家衛 +家西 +家親 +家護谷 +家谷 +家財 +家越 +家路 +家辺 +家込 +家近 +家迫 +家造坊 +家邉 +家邊 +家部 +家郷 +家里 +家重 +家野 +家野本 +家鋪 +家鍋 +家長 +家門 +家間 +家雲 +家頭 +家馬 +家馴 +家高 +容貝 +宿 +宿久 +宿井 +宿出 +宿利 +宿利原 +宿前 +宿南 +宿原 +宿口 +宿名 +宿坊 +宿城 +宿女 +宿屋 +宿岡 +宿岩 +宿島 +宿崎 +宿弥 +宿本 +宿村 +宿松 +宿森 +宿母 +宿沢 +宿波 +宿澤 +宿理 +宿田 +宿称 +宿茂 +宿西 +宿見 +宿谷 +宿賀 +宿輪 +宿里 +宿野 +宿野辺 +宿野部 +宿間谷 +宿院 +寂室 +寄 +寄ケ瀬 +寄上 +寄下 +寄中 +寄主 +寄井 +寄井田 +寄住 +寄保 +寄元 +寄光 +寄兼 +寄内 +寄出 +寄原 +寄友 +寄口 +寄合 +寄吉 +寄名 +寄国 +寄國 +寄場 +寄宗 +寄定 +寄実 +寄尾 +寄岡 +寄島 +寄崎 +寄嶋 +寄川 +寄平 +寄広 +寄廣 +寄恵 +寄持 +寄政 +寄木 +寄本 +寄村 +寄東 +寄松 +寄林 +寄森 +寄橋 +寄気 +寄氣 +寄水 +寄永 +寄江 +寄河 +寄満 +寄瀬 +寄特 +寄玉 +寄田 +寄町 +寄留 +寄石 +寄砂 +寄神 +寄立 +寄能 +寄藤 +寄親 +寄詰 +寄谷 +寄貞 +寄辺 +寄邊 +寄重 +寄野 +寄金 +寄鑓 +寄門 +寄高 +寅ケ口 +寅丸 +寅井 +寅口 +寅垣内 +寅尾 +寅屋 +寅屋敷 +寅山 +寅岡 +寅岩 +寅島 +寅嶋 +寅川 +寅巴里 +寅市 +寅本 +寅松 +寅林 +寅沢 +寅澤 +寅田 +寅矢 +寅磐 +寅若 +寅谷 +寅貝 +寅野 +密 +密井 +密原 +密城 +密居 +密山 +密岡 +密島 +密嶋 +密川 +密木 +密本 +密村 +密林 +密沢 +密波羅 +密涌 +密照 +密田 +密石 +密谷 +密野 +密門 +寉切 +寉岡 +寉島 +寉来 +寉田 +寉見 +富 +富ケ原 +富上 +富下 +富丘 +富並 +富中 +富丸 +富主 +富久 +富久世 +富久保 +富久増 +富久尾 +富久田 +富也 +富井 +富代 +富仲 +富住 +富佐 +富來 +富依 +富保 +富倉 +富元 +富光 +富内 +富処 +富加津 +富加美 +富加見 +富原 +富取 +富口 +富司 +富吉 +富名 +富名腰 +富向 +富和 +富国 +富國 +富園 +富土 +富地 +富坂 +富垣 +富城 +富堂 +富場 +富塚 +富増 +富士 +富士上 +富士井 +富士代 +富士元 +富士原 +富士和 +富士坂 +富士大 +富士尾 +富士居 +富士屋 +富士山 +富士岡 +富士崎 +富士川 +富士巻 +富士平 +富士庫 +富士成 +富士持 +富士木 +富士末 +富士本 +富士村 +富士松 +富士枝 +富士栄 +富士根 +富士森 +富士榮 +富士水 +富士永 +富士池 +富士波 +富士浜 +富士渓 +富士湲 +富士溪 +富士瀬 +富士田 +富士登 +富士盛 +富士縄 +富士繩 +富士蔭 +富士見 +富士谷 +富士越 +富士道 +富士野 +富士鷹 +富多 +富太 +富奥 +富好 +富宅 +富宇加 +富宇賀 +富守 +富安 +富室 +富宮 +富家 +富宿 +富小路 +富尾 +富尾木 +富居 +富屋 +富山 +富岡 +富岩 +富岳 +富峰 +富島 +富崎 +富嵜 +富嶋 +富嶺 +富嶽 +富川 +富工 +富平 +富広 +富底 +富康 +富廣 +富弘 +富弥 +富張 +富恵 +富惠 +富成 +富戸野 +富房 +富所 +富手 +富持 +富摩 +富政 +富方 +富施 +富春 +富木 +富本 +富杉 +富村 +富来 +富東 +富松 +富板 +富林 +富枡 +富栄 +富桝 +富森 +富楽 +富樫 +富橋 +富次 +富武 +富水 +富水流 +富永 +富江 +富池 +富沢 +富治林 +富波 +富浜 +富浦 +富浪 +富海 +富清 +富満 +富澤 +富濱 +富瀬 +富生 +富田 +富田川 +富田谷 +富畑 +富留宮 +富留田 +富登 +富盛 +富真 +富着 +富矢 +富石 +富砂 +富磨 +富福 +富秋 +富穂 +富積 +富窪 +富築 +富米野 +富綱 +富繁 +富美 +富美本 +富羽 +富耒 +富能 +富脇 +富舘 +富舛 +富良謝 +富良野 +富芳 +富菜 +富薗 +富藤 +富藪 +富西 +富見山 +富計 +富谷 +富貞 +富貫 +富貴 +富貴原 +富貴塚 +富貴沢 +富貴澤 +富貴田 +富賀 +富賀瀬 +富賀見 +富越 +富路 +富辺 +富近 +富迫 +富部 +富酒 +富里 +富重 +富野 +富野井 +富金原 +富銅 +富銘 +富長 +富門 +富阪 +富領 +富館 +富高 +富鶴 +富鹿 +寒 +寒作 +寒倉 +寒出 +寒原 +寒地 +寒山 +寒崎 +寒川 +寒川井 +寒川江 +寒木 +寒松 +寒林 +寒梅 +寒水 +寒水山 +寒江 +寒沢 +寒河 +寒河井 +寒河江 +寒波 +寒澤 +寒田 +寒竹 +寒者 +寒葉 +寒藤 +寒蝉 +寒谷 +寒郡 +寒野 +寒長 +寒風 +寒風沢 +寒風澤 +寒香 +寒鳥 +寔 +寛 +寛住 +寛司 +寛山 +寛島 +寛嶋 +寛座 +寛応 +寛應 +寛明 +寛永 +寛澄 +寛田 +寛紀 +寛藤 +寛谷 +寛那見 +寛野 +寛長 +寝占 +察時 +寢占 +實 +實下 +實久 +實井 +實信 +實光 +實兼 +實升 +實原 +實友 +實取 +實吉 +實善 +實國 +實城 +實好 +實守 +實安 +實宗 +實寳 +實山 +實岡 +實島 +實崎 +實川 +實平 +實廣 +實延 +實形 +實成 +實操 +實政 +實方 +實本 +實村 +實松 +實桐 +實森 +實正 +實歳 +實沢 +實法院 +實淨 +實淵 +實渊 +實渕 +實澤 +實熊 +實生 +實田 +實盛 +實石 +實籐 +實籾 +實繁 +實義 +實能田 +實藤 +實谷 +實近 +實迫 +實重 +實野 +實金 +寧山 +審 +審良 +寳 +寳上 +寳亀 +寳井 +寳代 +寳代地 +寳住 +寳來 +寳保 +寳利 +寳劔 +寳力 +寳喜 +寳地 +寳地戸 +寳坂 +寳城 +寳壁 +寳多 +寳子丸 +寳子山 +寳學 +寳官 +寳寄山 +寳尺 +寳居 +寳屋敷 +寳山 +寳島 +寳崎 +寳嶋 +寳川 +寳平 +寳徳 +寳持 +寳月 +寳木 +寳木原 +寳村 +寳来 +寳柳 +寳森 +寳榮 +寳槌 +寳槻 +寳樂 +寳正 +寳永 +寳池 +寳泉 +寳満 +寳滿 +寳澤 +寳玉 +寳珎 +寳珠 +寳珠山 +寳理 +寳生 +寳田 +寳石 +寳示戸 +寳神 +寳福 +寳積 +寳納 +寳耒 +寳舩 +寳蔵 +寳藏 +寳藏寺 +寳角 +寳諸 +寳谷 +寳達 +寳邉 +寳部 +寳里 +寳野 +寳金 +寳鏡 +寳門 +寳関 +寳閣 +寳龍 +寵谷 +寶 +寶亀 +寶井 +寶代 +寶代地 +寶來 +寶保 +寶光井 +寶利 +寶勝 +寶勢 +寶園 +寶地 +寶塚 +寶壁 +寶壺 +寶多 +寶子 +寶子丸 +寶子山 +寶官 +寶寄山 +寶尺 +寶居 +寶屋敷 +寶山 +寶岡 +寶島 +寶崎 +寶川 +寶徳 +寶意 +寶持 +寶明 +寶月 +寶木 +寶木原 +寶村 +寶来 +寶森 +寶榮 +寶槻 +寶樂 +寶毛 +寶永 +寶池 +寶沢 +寶泉 +寶満 +寶滿 +寶澤 +寶珍 +寶珎 +寶珠山 +寶理 +寶生 +寶田 +寶示 +寶示戸 +寶福 +寶積 +寶納 +寶耒 +寶舩 +寶船 +寶莱 +寶蔵 +寶蔵寺 +寶藏 +寶藏寺 +寶藤 +寶角 +寶諸 +寶谷 +寶賀 +寶迫 +寶達 +寶野 +寶金 +寶閣 +寸原 +寸古幾 +寸和 +寸土 +寸山 +寸村 +寸為 +寸田 +寸石 +寸賀 +寸越 +寺 +寺ノ下 +寺一 +寺七 +寺上 +寺下 +寺世 +寺中 +寺丸 +寺主 +寺久保 +寺二 +寺井 +寺井屋 +寺代 +寺住 +寺倉 +寺側 +寺儀 +寺元 +寺光 +寺内 +寺出 +寺分 +寺前 +寺北 +寺升 +寺南 +寺原 +寺口 +寺台 +寺司 +寺吉 +寺名 +寺園 +寺土 +寺土井 +寺地 +寺坂 +寺坊 +寺坪 +寺垣 +寺垣内 +寺埜 +寺堀 +寺堂 +寺塚 +寺塩 +寺境 +寺増 +寺墨 +寺外 +寺奥 +寺守 +寺家 +寺家村 +寺家谷 +寺尻 +寺尾 +寺居 +寺屋 +寺屋敷 +寺山 +寺岡 +寺岬 +寺岸 +寺峯 +寺峰 +寺島 +寺崎 +寺嵜 +寺嶋 +寺嶌 +寺川 +寺師 +寺平 +寺広 +寺床 +寺庵下 +寺廣 +寺延 +寺廹 +寺建 +寺廻 +寺後 +寺戸 +寺才元 +寺才本 +寺拝 +寺政 +寺敷 +寺方 +寺曽 +寺木 +寺末 +寺本 +寺村 +寺杣 +寺東 +寺松 +寺林 +寺柿 +寺栖 +寺根 +寺森 +寺横 +寺橋 +寺次 +寺段 +寺氏 +寺永 +寺江 +寺池 +寺沖 +寺沢 +寺沢口 +寺河 +寺河内 +寺治 +寺沼 +寺泉 +寺洞 +寺津 +寺浜 +寺浦 +寺添 +寺渓 +寺滝 +寺澤 +寺濱 +寺瀬 +寺片 +寺牛 +寺生 +寺田 +寺田谷 +寺町 +寺畑 +寺畠 +寺県 +寺眞 +寺真 +寺矢 +寺石 +寺社 +寺社下 +寺神 +寺神戸 +寺福 +寺窪 +寺立 +寺端 +寺竹 +寺篭 +寺籠 +寺縣 +寺美 +寺義 +寺背 +寺脇 +寺腰 +寺舘 +寺花 +寺若 +寺莿 +寺菴 +寺薗 +寺藤 +寺裏 +寺西 +寺要 +寺見 +寺角 +寺訳 +寺譯 +寺谷 +寺谷内 +寺賀 +寺越 +寺跡 +寺路 +寺輪 +寺農 +寺辺 +寺辻 +寺迫 +寺道 +寺邉 +寺邊 +寺邑 +寺部 +寺里 +寺重 +寺野 +寺野下 +寺野段 +寺鍛冶 +寺鍛治 +寺鍜治 +寺長 +寺長根 +寺門 +寺間 +寺阪 +寺際 +寺面 +寺須 +寺館 +寺馬 +寺鼻 +対 +対中 +対喜 +対尾 +対島 +対崎 +対嶋 +対川 +対月 +対木 +対本 +対村 +対東 +対梨 +対比地 +対田 +対知 +対藤 +対重 +対野 +対間 +対馬 +寿 +寿々川 +寿々木 +寿上 +寿乃田 +寿倉 +寿元 +寿光 +寿円 +寿南 +寿原 +寿台 +寿司 +寿命 +寿咲谷 +寿喜多 +寿埼 +寿士 +寿多 +寿孝 +寿守 +寿尾 +寿山 +寿岡 +寿岳 +寿島 +寿崎 +寿川 +寿床 +寿徳 +寿恵 +寿恵村 +寿慶 +寿数喜 +寿文字 +寿昌 +寿明 +寿時 +寿木 +寿本 +寿村 +寿松 +寿松木 +寿柳 +寿栄松 +寿楽 +寿永 +寿江島 +寿洲貴 +寿浅 +寿浦 +寿海 +寿淵 +寿渕 +寿満 +寿瑠屋 +寿田 +寿畑 +寿盛 +寿真田 +寿福 +寿福院 +寿秋 +寿系 +寿美 +寿美井 +寿美田 +寿美谷 +寿老 +寿藤 +寿見 +寿谷 +寿賀 +寿賀崎 +寿賀本 +寿賀野 +寿里 +寿野 +寿量 +封戸 +専 +専修 +専光 +専光寺 +専名 +専坊 +専崎 +専当 +専徒 +専徳 +専徳院 +専斉 +専甫 +専田 +専當 +専福 +専称 +専稱 +専能 +専野 +専頭 +射り口 +射原 +射号津 +射和 +射場 +射場山 +射場本 +射塲 +射守屋 +射守矢 +射庭 +射延 +射手 +射手園 +射手矢 +射手谷 +射敷 +射本 +射残 +射水 +射浜 +射田 +射矢 +射羽 +射落 +射號津 +射谷 +射越 +射通 +射馬 +射鹿 +将亦 +将口 +将司 +将基 +将基面 +将堂 +将月 +将木 +将田 +将積 +将邑 +将野 +將亦 +將口 +將司 +將基 +將木 +將田 +將積 +將道 +專徒 +專田 +專當 +專能 +尊保 +尊入 +尊瀬 +尊田 +尊能 +尊藤 +尊谷 +尊野 +尊鉢 +尊馬 +尋木 +尋田 +對 +對中 +對喜 +對尾 +對島 +對崎 +對嶋 +對川 +對木 +對梨 +對比地 +對田 +對知 +對藤 +對重 +對野 +對間 +對馬 +導利 +導寺 +導𡏄 +小 +小々馬 +小々高 +小ケ倉 +小ケ内 +小ケ原 +小ケ口 +小ケ島 +小ケ嶋 +小ケ谷 +小ノ上 +小ノ山 +小ノ島 +小ノ嶋 +小ノ木 +小ノ沢 +小ノ澤 +小ノ田 +小㔫 +小一原 +小万 +小三田 +小三門 +小上 +小上屋 +小上防 +小上馬 +小下 +小不動 +小世 +小世木 +小並 +小中 +小中冨 +小中出 +小中原 +小中尾 +小中居 +小中山 +小中島 +小中嶋 +小中村 +小中沢 +小中澤 +小中谷 +小中野 +小串 +小丸 +小丸山 +小丹 +小丹保 +小丹枝 +小丹波 +小丹羽 +小主 +小久 +小久井 +小久保 +小久江 +小久米 +小久見 +小久貫 +小久間 +小之道 +小乾 +小亀 +小二又 +小二田 +小二里 +小井 +小井中 +小井住 +小井出 +小井口 +小井土 +小井塚 +小井島 +小井川 +小井戸 +小井手 +小井根 +小井沢 +小井沼 +小井津 +小井澤 +小井田 +小井筒 +小井詰 +小井谷 +小井関 +小井關 +小井阪 +小亦 +小亭 +小人 +小仁 +小仁井 +小仁子 +小仁所 +小仁熊 +小仁田 +小今井 +小今津 +小介川 +小仏 +小仙 +小代 +小代崎 +小代田 +小仮 +小仮家 +小仲 +小仲井 +小仲谷 +小伊勢 +小伊根 +小伊藤 +小伊豆 +小伏 +小伏脇 +小伏間 +小休 +小伝 +小伝良 +小伝茂 +小住 +小佐 +小佐々 +小佐乃 +小佐井 +小佐原 +小佐古 +小佐妻 +小佐川 +小佐手 +小佐村 +小佐治 +小佐波 +小佐海 +小佐田 +小佐畑 +小佐見 +小佐辺 +小佐邊 +小佐部 +小佐野 +小余塚 +小佛 +小作 +小侍 +小保 +小保内 +小保川 +小保形 +小保方 +小保木 +小保根 +小保田 +小俟 +小信 +小俣 +小俵 +小倉 +小倉山 +小倉畑 +小倉石 +小倉見 +小倍 +小値賀 +小倭 +小傅茂 +小傳 +小傳良 +小傳茂 +小儀 +小元 +小先 +小光 +小児 +小入羽 +小八ケ代 +小八木 +小八田 +小八重 +小六 +小兵具 +小具 +小内 +小円間 +小冨士 +小冨家 +小冷 +小出 +小出仙 +小出來 +小出島 +小出崎 +小出所 +小出村 +小出来 +小出水 +小出沢 +小出澤 +小出石 +小出谷 +小刀 +小刀弥 +小刀根 +小刀祢 +小刀禰 +小刀称 +小刀稱 +小分坂 +小分校 +小切 +小切山 +小切間 +小判 +小別 +小別当 +小別所 +小別當 +小利池 +小前 +小前田 +小副 +小副川 +小割 +小力 +小加本 +小加部 +小助川 +小勝 +小勝負 +小化 +小北 +小千田 +小千谷 +小升 +小午田 +小半 +小半田 +小南 +小南舘 +小南館 +小博 +小原 +小原井 +小原坂 +小原木 +小原沢 +小原澤 +小原田 +小原野 +小厳 +小又 +小叉 +小友 +小取 +小受 +小口 +小口田 +小古 +小古井 +小古呂 +小古山 +小古瀬 +小古田 +小古間 +小只 +小台 +小右エ門 +小右衛門 +小司 +小合 +小合沢 +小合澤 +小合瀬 +小合田 +小吉 +小吉川 +小吉田 +小名 +小名原 +小名坂 +小名山 +小名川 +小名木 +小名田 +小名野 +小向 +小向井 +小向得 +小吹 +小呂舘 +小呂館 +小味 +小味山 +小味淵 +小味渕 +小味田 +小和 +小和口 +小和多 +小和板 +小和泉 +小和瀬 +小和田 +小和野 +小品 +小善 +小喜多 +小嗣 +小四郎丸 +小団扇 +小図子 +小国 +小国政 +小囿 +小圃 +小國 +小園 +小園井 +小園江 +小圖子 +小團扇 +小土 +小土井 +小土居 +小土手 +小土橋 +小地 +小地原 +小地合 +小地戸 +小地沢 +小地澤 +小地谷 +小圷 +小坂 +小坂井 +小坂元 +小坂家 +小坂田 +小坂谷 +小坂辺 +小坂邊 +小坂部 +小坊 +小坪 +小垂 +小垂葉 +小垣 +小垣内 +小垣原 +小垣外 +小垨 +小垰 +小埀 +小城 +小城下 +小城原 +小城戸 +小埜 +小埜上 +小埜原 +小埜寺 +小埜尾 +小埜山 +小埜木 +小埜沢 +小埜田 +小埼 +小堀 +小堀内 +小堀川 +小堀田 +小堀端 +小堂 +小堆 +小堤 +小場 +小場佐 +小場川 +小場瀬 +小場田 +小場石 +小場谷 +小堺 +小塀 +小塊 +小塗 +小塙 +小塚 +小塩 +小塩野 +小境 +小増 +小壁 +小壷 +小壺 +小夏 +小多 +小多喜 +小多田 +小夜 +小大塚 +小天 +小太刀 +小夫 +小夫家 +小央 +小夷 +小奈 +小奥 +小妻 +小姓堂 +小子内 +小孫 +小宅 +小宇佐 +小宇根 +小宇田 +小宇羅 +小宇都 +小守 +小守林 +小守谷 +小安 +小安土 +小安永 +小宗 +小定 +小実 +小室 +小室山 +小宮 +小宮地 +小宮山 +小宮林 +小宮根 +小宮沢 +小宮澤 +小宮田 +小宮谷 +小宮路 +小家 +小家山 +小家平 +小家松 +小家石 +小家野 +小宿 +小富 +小富士 +小富家 +小實 +小寺 +小寺山 +小寺沢 +小寺澤 +小寿田 +小小高 +小尻 +小尾 +小尾口 +小尾野 +小居 +小屋 +小屋原 +小屋口 +小屋垣 +小屋垣内 +小屋場 +小屋岡 +小屋敷 +小屋本 +小屋松 +小屋根 +小屋瀬 +小屋田 +小屋町 +小屋畑 +小屋端 +小屋谷 +小屋越 +小屋迫 +小屋野 +小屋開地 +小山 +小山下 +小山内 +小山口 +小山岸 +小山崎 +小山川 +小山戸 +小山手 +小山松 +小山田 +小山石 +小山谷 +小山路 +小岐須 +小岡 +小岩 +小岩井 +小岩原 +小岩屋 +小岩崎 +小岱 +小岳 +小岸 +小峠 +小峪 +小峯 +小峰 +小島 +小島原 +小崎 +小崎川 +小崎沢 +小崎澤 +小嵐 +小嵜 +小嵩 +小嶋 +小嶌 +小嶺 +小嶽 +小巌 +小巖 +小川 +小川内 +小川原 +小川口 +小川名 +小川地 +小川寺 +小川屋 +小川戸 +小川渕 +小川田 +小川谷 +小川路 +小左 +小左井 +小左古 +小巻 +小巻沢 +小巻澤 +小市 +小布山 +小布施 +小師 +小幅 +小幡 +小幡谷 +小干場 +小平 +小平場 +小平沢 +小平潟 +小平澤 +小平田 +小平間 +小広 +小広川 +小庄 +小庄司 +小底 +小座 +小座本 +小座野 +小座間 +小庭 +小庵 +小廣 +小廣川 +小延 +小廹 +小建 +小廻 +小弁野 +小式山 +小式沢 +小式海 +小式澤 +小弓 +小弓場 +小弓川 +小引 +小弥 +小張 +小弾正 +小形 +小形谷 +小影 +小役丸 +小彼 +小後摩 +小後貫 +小御門 +小徳 +小志 +小志戸前 +小志田 +小恒 +小懸 +小戎 +小成 +小成田 +小我野 +小戝 +小戸 +小戸森 +小戸田 +小戸野 +小房 +小手 +小手川 +小手本 +小手森 +小手沢 +小手澤 +小手田 +小手石 +小才 +小才度 +小打 +小払 +小抜 +小拂 +小持 +小持留 +小指 +小掘 +小掘端 +小掛 +小掠 +小提 +小揚 +小摩木 +小摺戸 +小播 +小操 +小政 +小故島 +小数賀 +小敷沢 +小敷澤 +小敷瀬 +小數賀 +小斉 +小斉平 +小斎 +小斎平 +小斯波 +小新 +小新井 +小新堂 +小新田 +小方 +小旗 +小旙 +小旛 +小日出 +小日向 +小日山 +小日置 +小早 +小早川 +小早志 +小早敷 +小早瀬 +小早稲 +小早谷 +小明 +小昏 +小易 +小星 +小春 +小時田 +小暮 +小曲 +小曳 +小更 +小曵 +小曽 +小曽原 +小曽宇谷 +小曽川 +小曽我 +小曽戸 +小曽根 +小曽納 +小曽部 +小曾 +小曾川 +小曾我 +小曾戸 +小曾根 +小曾納 +小月 +小木 +小木下 +小木原 +小木埜 +小木戸 +小木曽 +小木曾 +小木本 +小木津 +小木田 +小木谷 +小木野 +小末 +小本 +小本地 +小札 +小机 +小杉 +小杉山 +小杉田 +小材 +小村 +小村井 +小村崎 +小村方 +小村田 +小村谷 +小束 +小条 +小来田 +小杭 +小東 +小松 +小松丸 +小松井 +小松代 +小松倉 +小松原 +小松園 +小松塚 +小松尾 +小松屋 +小松山 +小松島 +小松崎 +小松嵜 +小松川 +小松平 +小松木 +小松本 +小松林 +小松永 +小松沢 +小松澤 +小松田 +小松碕 +小松谷 +小松野 +小板 +小板橋 +小板谷 +小枇 +小林 +小林川 +小枝 +小枝原 +小枝指 +小枡 +小枩 +小枩谷 +小柄 +小柏 +小染 +小柱 +小柳 +小柳出 +小柳津 +小柴 +小柿 +小柿平 +小栂 +小栃洞 +小栄 +小栄住 +小栗 +小栗山 +小栗林 +小栗栖 +小栗田 +小栗須 +小栢 +小根 +小根久保 +小根口 +小根国 +小根國 +小根山 +小根森 +小根沢 +小根澤 +小根田 +小桂 +小桐 +小桐間 +小桑 +小桜 +小桝 +小桧 +小桧原 +小桧山 +小桶 +小梁 +小梁川 +小梅 +小梅川 +小梅枝 +小梛 +小條 +小梢 +小梨 +小梯 +小梶 +小棚 +小棚木 +小森 +小森園 +小森宮 +小森山 +小森林 +小森沢 +小森田 +小森谷 +小棹 +小椋 +小椎八重 +小椎尾 +小椎葉 +小椙 +小椚 +小椰 +小椿 +小楠 +小楽崎 +小榎 +小榎田 +小榑 +小榮 +小槁 +小槇 +小槌 +小槙 +小槫 +小槻 +小樂崎 +小樋 +小樋井 +小樋山 +小樽 +小橋 +小橋口 +小橋川 +小橘 +小橘田 +小檜 +小檜原 +小檜山 +小櫃 +小櫛 +小櫻 +小次 +小正 +小正富 +小正路 +小此内 +小此木 +小此鬼 +小武 +小武佐 +小武内 +小武守 +小武家 +小武山 +小武方 +小武海 +小歩 +小段 +小殿 +小比 +小比加 +小比山 +小比木 +小比田 +小比賀 +小比類巻 +小毘賀 +小毛利 +小水 +小水内 +小水流 +小永 +小永井 +小永光 +小永吉 +小永田 +小永谷 +小汀 +小汐 +小江 +小江戸 +小江畑 +小池 +小池上 +小池沢 +小池澤 +小池田 +小汲 +小沖 +小沢 +小沢口 +小沢津 +小沢田 +小河 +小河内 +小河原 +小河瀬 +小河畑 +小河路 +小治 +小治谷 +小沼 +小沼野 +小泉 +小泊 +小泓 +小法師 +小波 +小波本 +小波津 +小波瀬 +小波石 +小波蔵 +小波藏 +小洗 +小洞 +小津 +小津和 +小津源 +小津美 +小津野 +小津間 +小洲賀 +小流 +小浅 +小浜 +小浜田 +小浦 +小浦場 +小浦方 +小浦浜 +小浪 +小浮 +小浮気 +小浴 +小海 +小海川 +小海老沢 +小海老澤 +小海途 +小涌 +小深 +小深山 +小深田 +小淵 +小淺 +小清水 +小済 +小渋 +小渓 +小渕 +小渡 +小港 +小湊 +小湟 +小湯原 +小湾 +小満 +小源寺 +小溝 +小溪 +小滝 +小漆 +小漆間 +小漉 +小潟 +小潮川 +小澁 +小澄 +小澤 +小濃 +小濱 +小濱田 +小瀉 +小瀧 +小瀬 +小瀬内 +小瀬利 +小瀬古 +小瀬垣 +小瀬川 +小瀬戸 +小瀬木 +小瀬本 +小瀬村 +小瀬水 +小瀬沢 +小瀬澤 +小瀬田 +小瀬良 +小瀬谷 +小瀬野 +小灘 +小烏 +小無 +小無田 +小焼山 +小熊 +小熊坂 +小父内 +小片 +小牛尾 +小牛田 +小牟田 +小牟礼 +小牟禮 +小牧 +小牧園 +小物 +小物谷 +小犬丸 +小狩 +小狭 +小猿 +小獄 +小玉 +小玉屋 +小瑤 +小生 +小生川 +小生方 +小用 +小田 +小田々 +小田上 +小田中 +小田二 +小田井 +小田代 +小田住 +小田佐 +小田倉 +小田元 +小田内 +小田切 +小田前 +小田原 +小田口 +小田和 +小田喜 +小田土 +小田垣 +小田城 +小田多 +小田多井 +小田宮 +小田尾 +小田山 +小田岐 +小田島 +小田崎 +小田嶋 +小田嶌 +小田川 +小田巻 +小田平 +小田戸 +小田木 +小田本 +小田村 +小田林 +小田柳 +小田柿 +小田根 +小田桐 +小田森 +小田橋 +小田沢 +小田波 +小田海 +小田滝 +小田澤 +小田脇 +小田草 +小田谷 +小田賀 +小田辺 +小田邉 +小田邊 +小田部 +小田野 +小田金 +小田長 +小由里 +小甲 +小町 +小町屋 +小町谷 +小界 +小畑 +小畑田 +小畔 +小畠 +小畦 +小畦地 +小番 +小番場 +小畴 +小疇 +小白 +小白井 +小白川 +小白方 +小白木 +小白金 +小的 +小皆 +小皷 +小益 +小盛 +小目 +小目谷 +小相 +小相沢 +小相澤 +小県 +小眞頼 +小真頼 +小矢 +小矢島 +小矢崎 +小矢沢 +小矢澤 +小矢田 +小矢畑 +小矢部 +小矢野 +小知井 +小知和 +小石 +小石倉 +小石原 +小石峯 +小石峰 +小石川 +小石木 +小石沢 +小石澤 +小石田 +小砂 +小砂子 +小砂川 +小砂見 +小研 +小硲 +小碇 +小磯 +小礒 +小社 +小祝 +小神 +小神埜 +小神子 +小神田 +小神谷 +小神野 +小祿 +小禄 +小福 +小福川 +小福田 +小禿 +小秋元 +小稔 +小稗 +小稲 +小稲垣 +小積 +小穴 +小窪 +小立 +小立花 +小童 +小童谷 +小端 +小竹 +小竹出 +小竹原 +小竹守 +小竹山 +小竹島 +小竹林 +小竹栄 +小竹森 +小竿 +小笛 +小笠 +小笠原 +小笹 +小笹原 +小笹山 +小筆 +小筋 +小筏 +小箕 +小管 +小管生 +小箱 +小節 +小築 +小篠 +小篭 +小簑 +小簔 +小籏 +小籔 +小籠 +小米 +小米良 +小粂 +小粒 +小粥 +小糠 +小糸 +小紅 +小納 +小納谷 +小紙 +小紫 +小細 +小細工 +小細沢 +小細澤 +小紺 +小結 +小絲 +小継 +小綱 +小網 +小網中 +小網代 +小綿 +小緑 +小練 +小縁 +小縄 +小縞 +小縣 +小織 +小繩 +小美 +小美堂 +小美山 +小美川 +小美戸 +小美浪 +小美濃 +小美野 +小羽 +小羽島 +小羽根 +小羽田 +小羽石 +小翆 +小翠 +小股 +小肥 +小肥下 +小肩 +小胎 +小能 +小能林 +小能見 +小脇 +小舎 +小舘 +小舛 +小舞 +小舟 +小舟戸 +小舩 +小舩井 +小舩内 +小舩戸 +小船 +小船井 +小船内 +小船屋 +小船戸 +小船谷 +小色 +小艾 +小芝 +小芦 +小花 +小花井 +小花和 +小花波 +小花衣 +小苅米 +小苗 +小苗代 +小若 +小若女 +小茂出 +小茂尻 +小茂川 +小茂池 +小茂田 +小茂鳥 +小茄子川 +小茅 +小茅生 +小茶 +小草 +小荒 +小荒井 +小荒田 +小荒谷 +小荷子 +小荷田 +小菅 +小菅山 +小菅生 +小菊 +小菓 +小菜 +小華和 +小菱 +小萩 +小萩沢 +小萩澤 +小萱 +小葉 +小葉松 +小葉田 +小葉竹 +小蒲 +小蓑 +小蓬 +小蓬原 +小蔦 +小蔭 +小蔵 +小蔵崎 +小蕎 +小薄 +小薗 +小薗井 +小薗江 +小薬 +小薮 +小藏 +小藤 +小藤田 +小藥 +小藪 +小蘂 +小虎 +小蟹 +小袋 +小袖 +小裏 +小西 +小西出 +小西山 +小西川 +小西池 +小西谷 +小要 +小見 +小見寺 +小見山 +小見川 +小見戸 +小見波 +小見淵 +小見渕 +小見田 +小見角 +小見谷 +小見野 +小見門 +小角 +小許住 +小詰 +小請 +小諸 +小谷 +小谷中 +小谷内 +小谷原 +小谷口 +小谷地 +小谷家 +小谷屋 +小谷崎 +小谷川 +小谷木 +小谷本 +小谷松 +小谷沢 +小谷津 +小谷澤 +小谷瀬 +小谷田 +小谷部 +小谷野 +小豆 +小豆原 +小豆島 +小豆嶋 +小豆川 +小豆沢 +小豆澤 +小豆畑 +小豆野 +小貝 +小貝沢 +小貝澤 +小財 +小貫 +小貫山 +小賀 +小賀原 +小賀坂 +小賀根 +小賀田 +小賀野 +小賦 +小赤沢 +小赤澤 +小走 +小越 +小足 +小跡 +小跨 +小路 +小路丸 +小路口 +小路合 +小路山 +小路岡 +小路島 +小路川 +小路方 +小路木 +小路永 +小路田 +小路谷 +小車 +小軽米 +小輕米 +小輪 +小輪瀬 +小辨野 +小辰 +小辺 +小辻 +小迎 +小迎森 +小近 +小迫 +小迫田 +小通 +小造 +小逵 +小遊 +小道 +小道世 +小道場 +小道才 +小道野 +小達 +小邉 +小邊 +小邑 +小那木 +小那覇 +小那谷 +小邦 +小邨 +小部 +小部家 +小部山 +小郷 +小郷原 +小都 +小酒 +小酒井 +小酒谷 +小酒部 +小采 +小里 +小里田 +小里谷 +小重 +小野 +小野ケ原 +小野上 +小野下 +小野井 +小野住 +小野倉 +小野内 +小野原 +小野又 +小野口 +小野名 +小野地 +小野坂 +小野垣 +小野塚 +小野宮 +小野家 +小野寺 +小野尾 +小野山 +小野岡 +小野島 +小野崎 +小野嵜 +小野嶋 +小野川 +小野房 +小野打 +小野星 +小野曽 +小野木 +小野本 +小野村 +小野松 +小野林 +小野森 +小野植 +小野橋 +小野江 +小野池 +小野沢 +小野津 +小野満 +小野澤 +小野瀬 +小野田 +小野目 +小野美 +小野良 +小野落 +小野藤 +小野谷 +小野辺 +小野邉 +小野邊 +小野部 +小野里 +小野間 +小野関 +小野高 +小金 +小金丸 +小金井 +小金原 +小金園 +小金坂 +小金屋 +小金山 +小金平 +小金森 +小金沢 +小金淵 +小金渕 +小金澤 +小金石 +小金谷 +小釜 +小針 +小釣 +小鈎 +小鈴 +小鈴木 +小鉄 +小鉢 +小銀 +小銭 +小銭岡 +小錦 +小鍋 +小鍛冶 +小鍛治 +小鍜 +小鍜冶 +小鍜治 +小鍵 +小鎌 +小鎗 +小鎚 +小鐡 +小鐵 +小鑓 +小長 +小長井 +小長光 +小長根 +小長谷 +小長野 +小門 +小門前 +小門口 +小開 +小間 +小間井 +小間前 +小間口 +小間喜 +小間坂 +小間場 +小間宮 +小間屋 +小間川 +小間木 +小間沢 +小間海 +小間澤 +小間物 +小間物谷 +小間田 +小間西 +小間谷 +小関 +小関川 +小闕 +小關 +小阪 +小阪井 +小阪田 +小阿弥 +小阿瀬 +小阿見 +小附 +小院瀬見 +小陣 +小陳 +小陽 +小隅 +小隈 +小障子 +小雀 +小雑賀 +小難波 +小雲 +小霜 +小面 +小面原 +小鞠 +小響 +小須田 +小須賀 +小頭 +小風 +小飛山 +小飯 +小飯塚 +小飯田 +小飼 +小餅 +小餅谷 +小館 +小首 +小馬 +小馬井 +小馬場 +小馬崎 +小馬瀬 +小馬田 +小馬谷 +小駅 +小駒 +小駕 +小駕籠 +小驛 +小高 +小高井 +小高峯 +小高峰 +小高根 +小髪 +小魚 +小鮒 +小鯖 +小鯛 +小鯵 +小鱗 +小鳥 +小鳥井 +小鳥居 +小鳥川 +小鳥田 +小鳥谷 +小鳥遊 +小鳶 +小鴉 +小鴨 +小鶴 +小鷲 +小鷹 +小鷹狩 +小鷺 +小鹿 +小鹿倉 +小鹿原 +小鹿山 +小鹿島 +小鹿野 +小麥田 +小麦 +小麦崎 +小麦川 +小麦田 +小麻野 +小黒 +小黒沢 +小黒澤 +小鼓 +小鼻 +小齊 +小齊平 +小齋 +小齋平 +小龍山 +少作 +少内 +少前 +少名子 +少寺 +少弐 +少徳 +少数 +少橘 +少田 +少覚 +少谷 +少貮 +少貳 +少路 +尖 +尖崎 +尚 +尚原 +尚台 +尚司 +尚和 +尚山 +尚師 +尚徳 +尚木 +尚本 +尚村 +尚樹 +尚永 +尚田 +尭 +尭天 +尭部 +就 +就本 +就鳥 +尹戸 +尹本 +尺 +尺一 +尺司 +尺土 +尺戸 +尺田 +尺釆 +尺采 +尺野 +尺金 +尺長 +尻 +尻井 +尻口 +尻家 +尻屋 +尻引 +尻懸 +尻枝 +尻江 +尻池 +尻無 +尻無浜 +尻無濱 +尻田 +尻石 +尻谷 +尻高 +尻高沢 +尻高澤 +尼 +尼ケ塚 +尼ケ崎 +尼丁 +尼元 +尼児 +尼口 +尼塚 +尼子 +尼宮 +尼寺 +尼岡 +尼岸 +尼崎 +尼嵜 +尼嶋 +尼川 +尼形 +尼木 +尼本 +尼田 +尼留 +尼義 +尼見 +尼谷 +尼迫 +尼野 +尼額 +尽田 +尾 +尾々野 +尾の上 +尾ケ井 +尾ケ口 +尾ケ崎 +尾ケ瀬 +尾ノ上 +尾ノ下 +尾ノ井 +尾ノ前 +尾ノ口 +尾ノ岡 +尾ノ後 +尾一 +尾万 +尾上 +尾下 +尾世 +尾世川 +尾中 +尾串 +尾久 +尾久保 +尾久土 +尾久田 +尾久葉 +尾久迫 +尾之上 +尾之下 +尾之内 +尾之前 +尾之口 +尾之家 +尾之崎 +尾之後 +尾之江 +尾之里 +尾之首 +尾亀 +尾井 +尾井川 +尾井田 +尾亦 +尾仁 +尾付野 +尾代 +尾仲 +尾伊端 +尾位 +尾住 +尾佐 +尾佐古 +尾佐川 +尾佐竹 +尾作 +尾保手 +尾俣 +尾倉 +尾儀 +尾元 +尾先 +尾入 +尾兼 +尾内 +尾凪 +尾出 +尾刀 +尾刃 +尾分 +尾初瀬 +尾利 +尾利出 +尾前 +尾副 +尾割 +尾加 +尾加名 +尾勝 +尾勢 +尾北 +尾原 +尾原家 +尾又 +尾叉 +尾友 +尾口 +尾古 +尾古森 +尾古貴 +尾台 +尾合 +尾吉 +尾名 +尾名口 +尾名高 +尾向 +尾吹 +尾呂 +尾呂志 +尾呂田 +尾味 +尾和 +尾和瀬 +尾和田 +尾喜 +尾国 +尾國 +尾園 +尾土井 +尾土平 +尾地 +尾坂 +尾坐 +尾坐原 +尾坪 +尾垣 +尾垣内 +尾城 +尾埜 +尾埼 +尾堀 +尾堂 +尾堤 +尾場 +尾場瀬 +尾塚 +尾塩 +尾塲瀬 +尾多賀 +尾大 +尾太 +尾子 +尾子浦 +尾宅 +尾宇江 +尾守 +尾宗寺 +尾定 +尾実 +尾室 +尾宮 +尾家 +尾寄 +尾寅 +尾實 +尾寺 +尾小山 +尾小平 +尾小谷 +尾尻 +尾居 +尾居土 +尾屋 +尾屋家 +尾屋敷 +尾山 +尾岡 +尾岩 +尾岸 +尾峪 +尾島 +尾崎 +尾崎坊 +尾崎屋 +尾嵜 +尾嶋 +尾嶌 +尾嶝 +尾川 +尾川原 +尾市 +尾幡 +尾平 +尾平野 +尾幸 +尾広 +尾座 +尾座元 +尾座原 +尾座本 +尾庭 +尾廣 +尾引 +尾張 +尾張谷 +尾張部 +尾形 +尾後 +尾後家 +尾後貫 +尾成 +尾戸 +尾戸井 +尾手 +尾才 +尾抜 +尾拔 +尾持 +尾故島 +尾敷 +尾方 +尾日 +尾日向 +尾早 +尾暮 +尾曲 +尾曽 +尾曽根 +尾曽越 +尾曾 +尾有 +尾朝 +尾木 +尾木原 +尾木野 +尾末 +尾本 +尾本原 +尾杉 +尾村 +尾来 +尾東 +尾松 +尾板 +尾林 +尾枝 +尾柏 +尾柳 +尾柴 +尾柿 +尾栄 +尾栗 +尾栢 +尾根 +尾根山 +尾根沢 +尾根澤 +尾根田 +尾桐 +尾梶 +尾森 +尾棹 +尾植 +尾楠 +尾樽部 +尾橋 +尾櫃 +尾武 +尾比津 +尾比賀 +尾毛 +尾毛川 +尾毛谷 +尾毫 +尾水 +尾永 +尾江 +尾池 +尾沢 +尾河 +尾治 +尾沼 +尾泉 +尾波 +尾泻 +尾洞 +尾津 +尾流 +尾浜 +尾浦 +尾浪 +尾浴 +尾海 +尾淵 +尾添 +尾渕 +尾渡 +尾溝 +尾滝 +尾潟 +尾澤 +尾濱 +尾瀉 +尾瀧 +尾瀬 +尾瀬戸 +尾瀬田 +尾為 +尾無 +尾焼津 +尾熊 +尾熨斗 +尾片 +尾牧 +尾玉 +尾生 +尾生屋 +尾田 +尾田原 +尾田川 +尾田木 +尾田村 +尾町 +尾畑 +尾留川 +尾畠 +尾登 +尾白 +尾目 +尾県 +尾真田 +尾矢 +尾矢島 +尾矢戸 +尾知 +尾知山 +尾石 +尾硲 +尾碕 +尾神 +尾科 +尾種 +尾窪 +尾立 +尾端 +尾竹 +尾笹 +尾筋 +尾箸 +尾篭 +尾籐 +尾籠 +尾糠 +尾納 +尾組 +尾絵 +尾続 +尾縄 +尾縣 +尾繩 +尾續 +尾美 +尾美谷 +尾美野 +尾羽 +尾羽林 +尾羽根 +尾羽沢 +尾羽澤 +尾羽瀬 +尾股 +尾能 +尾脇 +尾臺 +尾舘 +尾芝 +尾芦 +尾花 +尾花山 +尾苗 +尾若 +尾茂 +尾茂井 +尾茂弥 +尾茂田 +尾茂谷 +尾華 +尾葉石 +尾蔵 +尾薗 +尾藏 +尾藤 +尾西 +尾見 +尾見谷 +尾見門 +尾角 +尾谷 +尾賀 +尾賀原 +尾賀田 +尾越 +尾跡 +尾路 +尾身 +尾辺 +尾辻 +尾込 +尾近 +尾迫 +尾通 +尾造 +尾道 +尾邉 +尾邊 +尾邑 +尾那 +尾部 +尾郷 +尾郷原 +尾都野 +尾里 +尾重 +尾野 +尾野上 +尾野寺 +尾野山 +尾野島 +尾野崎 +尾野嶋 +尾野川 +尾野恵 +尾野木 +尾野本 +尾野村 +尾野松 +尾野江 +尾野瀬 +尾野田 +尾野畑 +尾野藤 +尾野間 +尾金 +尾金沢 +尾釜 +尾針 +尾銭 +尾錢 +尾鍋 +尾長 +尾長谷 +尾門 +尾間 +尾間谷 +尾関 +尾關 +尾阪 +尾陰 +尾隠山 +尾面 +尾頃 +尾頭 +尾風 +尾食 +尾館 +尾首 +尾駮 +尾高 +尾鳥 +尾鴑 +尾鶴 +尾鷲 +尾鷹 +尾鹿 +尾黒 +尾鼻 +尾﨏 +局 +局田 +居ケ内 +居上 +居下 +居串 +居也 +居井 +居仙 +居代 +居作 +居倉 +居内 +居出 +居出上 +居出下 +居出本 +居初 +居升 +居原 +居原田 +居合 +居吹 +居和城 +居在家 +居地 +居坂 +居垣 +居城 +居場 +居塚 +居壁 +居守 +居安 +居家野 +居宿 +居山 +居島 +居崎 +居嶋 +居川 +居平 +居弥口 +居成 +居戸 +居敷 +居月 +居木 +居木井 +居本 +居村 +居松 +居林 +居森 +居椿 +居樹 +居橋 +居永 +居沢 +居波 +居潟 +居澤 +居田 +居町 +居畑 +居相 +居石 +居神 +居福 +居穀 +居積 +居立 +居築 +居細工 +居組 +居組谷 +居織 +居聞 +居舘 +居蔵 +居藏 +居藤 +居谷 +居貞 +居賀井 +居軒 +居迫 +居郷 +居酒 +居野上 +居野原 +居野家 +居長 +居長原 +居関 +居阪 +居附 +居館 +居馬 +居駒 +居高 +居鳥 +居鶴 +屈岡 +届木 +屋 +屋ケ田 +屋上 +屋下 +屋並 +屋中 +屋久 +屋亀 +屋井 +屋代 +屋代崎 +屋仲 +屋住 +屋保 +屋内 +屋冨祖 +屋冨租 +屋北 +屋原 +屋口 +屋名池 +屋吹 +屋和田 +屋喜 +屋嘉 +屋嘉比 +屋嘉部 +屋園 +屋地 +屋地元 +屋地岡 +屋城 +屋子 +屋宜 +屋宣 +屋宮 +屋家 +屋富祖 +屋富租 +屋尾 +屋山 +屋島 +屋崎 +屋嶋 +屋広 +屋式 +屋形 +屋形場 +屋後 +屋慶名 +屋成 +屋我 +屋戸 +屋所 +屋敷 +屋敷平 +屋敷村 +屋敷田 +屋敷谷 +屋敷野 +屋方 +屋木 +屋本 +屋村 +屋林 +屋柳 +屋根 +屋根下 +屋根中 +屋根佐 +屋根内 +屋根本 +屋根田 +屋根谷 +屋森 +屋次 +屋武 +屋比久 +屋江 +屋沢 +屋淵 +屋渕 +屋渡 +屋澤 +屋片 +屋田 +屋祢 +屋祢下 +屋祢佐 +屋祢本 +屋禰 +屋称下 +屋種 +屋納 +屋職 +屋舖 +屋舗 +屋舗田 +屋良 +屋良部 +屋葺 +屋蔵 +屋藏 +屋藤 +屋谷 +屋貝 +屋賀部 +屋辺 +屋部 +屋野 +屋野丸 +屋野原 +屋金 +屋鋪 +屋附 +屋須 +屋馬崎 +屋麻戸 +屏 +屏之内 +屏賀 +屏風 +属 +属増 +履輪 +屬 +屯 +屯倉 +屯田 +山 +山の井 +山の内 +山ケ城 +山ケ野 +山ケ鼻 +山ノ上 +山ノ下 +山ノ丸 +山ノ井 +山ノ先 +山ノ内 +山ノ口 +山ノ寺 +山ノ川 +山ノ平 +山ノ石 +山ノ腰 +山ノ辺 +山ノ邉 +山ノ鼻 +山㟁 +山㟢 +山一 +山七 +山丈 +山三 +山上 +山下 +山下谷 +山下部 +山与 +山世 +山丘 +山並 +山中 +山中島 +山中嶋 +山中谷 +山丸 +山主 +山久 +山久保 +山久地 +山久手 +山久瀬 +山之上 +山之下 +山之井 +山之元 +山之内 +山之口 +山之坊 +山之城 +山之川 +山之平 +山之氏 +山之江 +山之端 +山之腰 +山之越 +山乗 +山乘 +山乙 +山亀 +山二 +山井 +山仁 +山今 +山仕 +山代 +山代屋 +山代谷 +山仲 +山伊勢 +山伏 +山住 +山佐 +山佐木 +山作 +山佳 +山來 +山俊 +山保 +山信 +山信田 +山倉 +山側 +山像 +山元 +山先 +山光 +山児 +山入 +山入端 +山八 +山六 +山内 +山冨 +山冶 +山出 +山出谷 +山分 +山切 +山初 +山則 +山前 +山副 +山加 +山勝 +山勢 +山北 +山千代 +山南 +山卯 +山原 +山去 +山友 +山取 +山口 +山口屋 +山口谷 +山古 +山台 +山司 +山合 +山吉 +山同 +山名 +山名田 +山向 +山吹 +山和 +山咲 +山品 +山喜 +山喜多 +山喜夛 +山営 +山国 +山國 +山園 +山土 +山土井 +山地 +山坂 +山垣 +山垣内 +山城 +山城屋 +山城戸 +山城谷 +山埜 +山埜井 +山基 +山埼 +山堀 +山場 +山塙 +山塚 +山塩 +山境 +山増 +山壁 +山士家 +山壷 +山外 +山外森 +山多 +山大路 +山夲 +山奇 +山奈 +山奥 +山姥 +山姿 +山子 +山子沢 +山子澤 +山季 +山宅 +山守 +山安 +山宜 +山室 +山宮 +山家 +山家谷 +山宿 +山寄 +山富 +山寺 +山対 +山小 +山小瀬 +山小田 +山小路 +山尻 +山尾 +山居 +山屋 +山岐 +山岡 +山岨 +山岩 +山岬 +山岳 +山岸 +山峯 +山峰 +山島 +山崎 +山崎屋 +山崖 +山崩 +山嵜 +山嶋 +山嶺 +山嶽 +山川 +山巣 +山巻 +山市 +山師 +山幡 +山平 +山広 +山庄 +山庄司 +山床 +山府木 +山座 +山廣 +山延 +山廻 +山廼辺 +山廼邉 +山廼邊 +山引 +山当 +山形 +山形屋 +山形谷 +山彦 +山影 +山後 +山徳 +山志田 +山懸 +山成 +山我 +山戸 +山戸東 +山戸田 +山手 +山打 +山折 +山抱 +山持 +山掘 +山数 +山敷 +山斗 +山新 +山新田 +山方 +山日 +山明 +山星 +山春 +山時 +山景 +山月 +山木 +山木戸 +山木田 +山末 +山本 +山本寺 +山本屋 +山杉 +山村 +山条 +山杢 +山来 +山来多 +山東 +山松 +山板 +山林 +山林堂 +山枝 +山枡 +山柄 +山柴 +山柾 +山柿 +山栄 +山栗 +山根 +山根川 +山根木 +山桐 +山桑 +山桝 +山梅 +山條 +山梨 +山梶 +山森 +山植 +山楯 +山極 +山樋 +山樹 +山橋 +山橲 +山次 +山正 +山武 +山段 +山比羅 +山毛 +山毛利 +山氏 +山水 +山永 +山江 +山池 +山沖 +山沢 +山沢津 +山河 +山治 +山沼 +山泉 +山波 +山泻 +山洞 +山津 +山津田 +山浅 +山浜 +山浦 +山海 +山涌 +山淵 +山添 +山清 +山清水 +山渋 +山渕 +山渡 +山溝 +山滝 +山潟 +山澁 +山澄 +山澤 +山澤津 +山濱 +山瀧 +山瀬 +山火 +山灰 +山炭 +山照 +山熊 +山片 +山牟田 +山牧 +山玉 +山王 +山王丸 +山王堂 +山理 +山瑞 +山瓶子 +山生 +山田 +山田原 +山田大路 +山田寺 +山田屋 +山田島 +山田狩 +山田谷 +山町 +山畑 +山畔 +山畠 +山畦 +山畳 +山當 +山疊 +山登 +山登代 +山白 +山百 +山盛 +山目 +山直 +山相 +山県 +山真 +山矢 +山知 +山石 +山砥 +山碕 +山磨 +山神 +山禄 +山福 +山秀 +山秋 +山科 +山移 +山積 +山究 +山窪 +山竒 +山端 +山竹 +山筋 +山管 +山篠 +山篤 +山納 +山紫田 +山綛 +山緑 +山縁 +山縣 +山繁 +山罌粟 +山置 +山美 +山羽 +山老 +山耒 +山肥田 +山肩 +山背 +山能 +山脇 +山脊 +山腋 +山腰 +山臺 +山與 +山舖 +山舗 +山舘 +山舩 +山船 +山良 +山花 +山芳 +山苗 +山若 +山茂 +山荘 +山荷 +山菅 +山華 +山葉 +山葉多 +山葭 +山葺 +山蔦 +山蔭 +山蔵 +山薗 +山藤 +山衛守 +山表 +山裏 +山裾 +山西 +山見 +山見坂 +山見場 +山見阪 +山角 +山許 +山訳 +山諸 +山譯 +山谷 +山谷口 +山豫 +山貝 +山貫 +山賀 +山走 +山越 +山足 +山跡 +山路 +山路野 +山農 +山辺 +山辻 +山近 +山迫 +山通 +山道 +山達 +山遠 +山邉 +山邊 +山邑 +山那 +山邨 +山郡 +山部 +山郷 +山都 +山里 +山重 +山野 +山野上 +山野下 +山野井 +山野内 +山野口 +山野寺 +山野居 +山野川 +山野木 +山野本 +山野江 +山野田 +山野目 +山野辺 +山野邉 +山野邊 +山野部 +山野鼻 +山金 +山銅 +山錦 +山鍛治 +山鍬 +山長 +山門 +山開 +山間 +山関 +山阪 +山阿 +山附 +山陰 +山陸 +山隅 +山隈 +山階 +山際 +山雄 +山集 +山面 +山音 +山須 +山須田 +山領 +山頬 +山頭 +山風 +山風呂 +山館 +山饒覇 +山首 +山香 +山高 +山鬼 +山鳥 +山鷲 +山鹿 +山鹿辺 +山鹿邊 +山黒 +山鼻 +山𣷹 +山𦚰 +屶納 +屶網 +屼の下 +屼ノ下 +屼下 +岊 +岐 +岐亦 +岐保 +岐原 +岐土 +岐城 +岐奈 +岐崎 +岐本 +岐村 +岐津 +岐浦 +岐田 +岐美 +岐邨 +岐部 +岐阜 +岑 +岑吉 +岑地 +岑尾 +岑山 +岑本 +岑村 +岑永 +岑田 +岑畑 +岑野 +岡 +岡の谷 +岡ノ上 +岡ノ谷 +岡一 +岡丈 +岡上 +岡下 +岡世 +岡並 +岡中 +岡丸 +岡主 +岡久 +岡久保 +岡之上 +岡之下 +岡井 +岡井谷 +岡代 +岡仲 +岡住 +岡佐 +岡佐古 +岡保 +岡信 +岡倉 +岡元 +岡先 +岡光 +岡入 +岡内 +岡冨 +岡出 +岡別府 +岡利 +岡前 +岡副 +岡勢 +岡北 +岡南 +岡原 +岡口 +岡司 +岡吉 +岡名 +岡向 +岡和田 +岡咲 +岡固 +岡園 +岡土 +岡土居 +岡地 +岡坂 +岡坊 +岡垣 +岡垣内 +岡垰 +岡城 +岡埜 +岡埜谷 +岡基 +岡堀 +岡堂 +岡場 +岡塚 +岡増 +岡墻 +岡壽 +岡外 +岡多 +岡太 +岡奥 +岡宅 +岡守 +岡安 +岡宗 +岡実 +岡室 +岡宮 +岡家 +岡富 +岡寺 +岡寿 +岡尾 +岡居 +岡屋 +岡屋敷 +岡山 +岡山下 +岡岬 +岡岸 +岡峠 +岡峯 +岡峰 +岡島 +岡崎 +岡嵜 +岡嶋 +岡嶌 +岡川 +岡巻 +岡市 +岡平 +岡広 +岡座 +岡庭 +岡廣 +岡廻 +岡弘 +岡恵 +岡成 +岡戸 +岡所 +岡手 +岡持 +岡掛 +岡政 +岡新 +岡方 +岡明 +岡月 +岡木 +岡本 +岡本谷 +岡朶 +岡村 +岡杖 +岡条 +岡東 +岡松 +岡林 +岡枝 +岡柳 +岡根 +岡根谷 +岡桝 +岡條 +岡棟 +岡森 +岡植 +岡槁 +岡橋 +岡次 +岡正 +岡武 +岡段 +岡殿 +岡氏 +岡水 +岡永 +岡江 +岡沢 +岡河 +岡治 +岡沼 +岡泉 +岡波 +岡津 +岡浜 +岡浦 +岡浪 +岡淵 +岡添 +岡渕 +岡源 +岡滝 +岡澄 +岡澤 +岡濱 +岡瀧 +岡瀬 +岡片 +岡田 +岡田上 +岡田垣内 +岡田屋 +岡田蔭 +岡田谷 +岡町 +岡畑 +岡留 +岡畠 +岡登 +岡矢 +岡石 +岡福 +岡積 +岡空 +岡端 +岡竹 +岡筋 +岡籐 +岡納 +岡羽 +岡胡 +岡脇 +岡腰 +岡花 +岡芹 +岡茂 +岡蔦 +岡薗 +岡藤 +岡裏 +岡西 +岡見 +岡角 +岡谷 +岡谷内 +岡豊 +岡貞 +岡賀 +岡越 +岡路 +岡輪 +岡辺 +岡辻 +岡迫 +岡道 +岡邉 +岡邊 +岡邑 +岡那 +岡邨 +岡部 +岡都 +岡里 +岡重 +岡野 +岡野一 +岡野上 +岡野内 +岡野原 +岡野城 +岡野定 +岡野屋 +岡野本 +岡野谷 +岡長 +岡門 +岡阪 +岡防 +岡阿弥 +岡阿彌 +岡隅 +岡音 +岡須 +岡頭 +岡風呂 +岡馬 +岡鼻 +岡𡌛 +岨 +岨下 +岨中 +岨山 +岨手 +岨野 +岩 +岩の上 +岩ケ下 +岩ケ坂 +岩ケ沢 +岩ケ澤 +岩ケ瀬 +岩ケ谷 +岩ノ上 +岩三 +岩上 +岩下 +岩世 +岩並 +岩中 +岩丸 +岩乃 +岩久 +岩久保 +岩之上 +岩之谷 +岩也 +岩亀 +岩井 +岩井中 +岩井出 +岩井原 +岩井堂 +岩井屋 +岩井川 +岩井沢 +岩井澤 +岩井田 +岩井花 +岩井谷 +岩井迫 +岩井野 +岩付 +岩代 +岩仲 +岩住 +岩佐 +岩佐戸 +岩倉 +岩倉谷 +岩儀 +岩元 +岩先 +岩光 +岩八重 +岩内 +岩冨 +岩出 +岩切 +岩前 +岩動 +岩勘 +岩務 +岩勢 +岩北 +岩原 +岩口 +岩古 +岩合 +岩吉 +岩同 +岩名 +岩名地 +岩向 +岩吹 +岩周 +岩味 +岩品 +岩噌 +岩国 +岩國 +岩國屋 +岩園 +岩土 +岩地 +岩坂 +岩坪 +岩垂 +岩垣 +岩垣津 +岩城 +岩城谷 +岩埜 +岩埼 +岩堀 +岩堂 +岩堤 +岩場 +岩塚 +岩増 +岩壁 +岩壷 +岩壺 +岩外 +岩多 +岩大路 +岩奥 +岩好 +岩子 +岩安 +岩宗 +岩定 +岩室 +岩宮 +岩家 +岩富 +岩寺 +岩尻 +岩尾 +岩居 +岩屋 +岩屋ケ野 +岩屋口 +岩屋野 +岩山 +岩岡 +岩岬 +岩岳 +岩岸 +岩峅 +岩峪 +岩峯 +岩峰 +岩島 +岩崎 +岩嵜 +岩嶋 +岩嶽 +岩川 +岩左 +岩巻 +岩市 +岩平 +岩広 +岩庄 +岩床 +岩府 +岩庫 +岩庭 +岩廣 +岩引 +岩弘 +岩形 +岩後 +岩志 +岩恵 +岩成 +岩戸 +岩手 +岩手山 +岩打 +岩折 +岩拼 +岩持 +岩指 +岩掘 +岩摩 +岩撫 +岩政 +岩故 +岩敷 +岩方 +岩日 +岩明 +岩星 +岩曽 +岩月 +岩朝 +岩木 +岩木呂 +岩木川 +岩本 +岩杉 +岩村 +岩来 +岩東 +岩松 +岩林 +岩枝 +岩柳 +岩柴 +岩柿 +岩栄 +岩根 +岩桐 +岩桜 +岩梨 +岩梶 +岩森 +岩楯 +岩榮 +岩槻 +岩樋 +岩橋 +岩橘 +岩櫻 +岩正 +岩武 +岩段 +岩気 +岩水 +岩永 +岩江 +岩池 +岩沖 +岩沙 +岩沢 +岩河 +岩河内 +岩治 +岩沼 +岩泉 +岩波 +岩洞 +岩津 +岩浅 +岩浜 +岩浦 +岩浪 +岩淵 +岩淺 +岩添 +岩清水 +岩渊 +岩渓 +岩渕 +岩満 +岩溪 +岩滝 +岩滿 +岩澤 +岩濱 +岩瀧 +岩瀬 +岩瀬張 +岩瀬谷 +岩熊 +岩爪 +岩片 +岩牧 +岩狭 +岩狹 +岩猿 +岩生 +岩田 +岩田谷 +岩男 +岩町 +岩畑 +岩畔 +岩留 +岩畠 +岩畦 +岩登 +岩白 +岩益 +岩目 +岩目地 +岩目後 +岩矢 +岩知 +岩知道 +岩石 +岩砂 +岩破 +岩碕 +岩磨 +岩祖 +岩神 +岩科 +岩秩 +岩穴 +岩穴口 +岩窪 +岩立 +岩端 +岩竹 +岩筋 +岩築 +岩篠 +岩結 +岩継 +岩縄 +岩繁 +岩織 +岩繰 +岩美 +岩群 +岩羽 +岩耒 +岩脇 +岩腰 +岩舘 +岩舟 +岩舩 +岩船 +岩芝 +岩花 +岩芳 +岩苔 +岩茸 +岩草 +岩荷 +岩菅 +岩萩 +岩葉 +岩蕗 +岩藤 +岩行 +岩西 +岩見 +岩見屋 +岩見田 +岩見谷 +岩角 +岩谷 +岩貝 +岩貞 +岩越 +岩路 +岩辺 +岩辻 +岩込 +岩近 +岩迫 +岩逧 +岩道 +岩達 +岩邉 +岩邊 +岩邑 +岩部 +岩郷 +岩酒 +岩里 +岩重 +岩野 +岩野上 +岩野内 +岩金 +岩釜 +岩釣 +岩鉄 +岩銅 +岩鍋 +岩鍛冶 +岩鍛治 +岩鍜治 +岩鎌 +岩鐵 +岩長 +岩門 +岩開 +岩間 +岩関 +岩阪 +岩附 +岩隈 +岩階 +岩雲 +岩音 +岩須 +岩頭 +岩館 +岩香 +岩高 +岩鬼 +岩鶴 +岩鹿 +岩黒 +岩鼻 +岩𦚰 +岫 +岫下 +岬 +岬崎 +岬本 +岳 +岳上 +岳下 +岳中 +岳井 +岳元 +岳内 +岳原 +岳口 +岳坂 +岳塚 +岳室 +岳小原 +岳尾 +岳山 +岳峰 +岳崎 +岳川 +岳本 +岳村 +岳沢 +岳澤 +岳獅 +岳田 +岳石 +岳肩 +岳藤 +岳谷 +岳辺 +岳道 +岳邊 +岳野 +岳釜 +岳間 +岳間沢 +岳間澤 +岶尾 +岶田 +岸 +岸ノ上 +岸上 +岸下 +岸並 +岸中 +岸丸 +岸之上 +岸井 +岸人 +岸代 +岸仲 +岸住 +岸保 +岸信 +岸元 +岸光 +岸内 +岸前 +岸副 +岸北 +岸原 +岸又 +岸口 +岸名 +岸和 +岸和田 +岸和田谷 +岸園 +岸垣 +岸城 +岸埜 +岸場 +岸塚 +岸塲 +岸大路 +岸奥 +岸守 +岸宗 +岸家 +岸尾 +岸屋 +岸山 +岸岡 +岸峯 +岸峰 +岸島 +岸崎 +岸嶋 +岸川 +岸幕 +岸平 +岸懸 +岸戸 +岸房 +岸木 +岸本 +岸村 +岸杭 +岸松 +岸林 +岸柳 +岸柿 +岸根 +岸梅 +岸森 +岸槌 +岸武 +岸氏 +岸水 +岸永 +岸江 +岸沖 +岸沢 +岸治 +岸波 +岸津 +岸浜 +岸浦 +岸浪 +岸淵 +岸添 +岸渕 +岸澤 +岸灘 +岸田 +岸畑 +岸皮 +岸科 +岸立 +岸端 +岸縄 +岸羽 +岸脇 +岸良 +岸菜 +岸蔭 +岸薗 +岸裏 +岸見 +岸谷 +岸越 +岸路 +岸辺 +岸邉 +岸邊 +岸部 +岸里 +岸野 +岸間 +岸高 +岸鶴 +岼 +峉地 +峐下 +峐山 +峙 +峠 +峠ヶ +峠下 +峠中 +峠之内 +峠井 +峠元 +峠前 +峠原 +峠口 +峠土 +峠坂 +峠垰 +峠山 +峠岡 +峠崎 +峠広 +峠木 +峠本 +峠村 +峠根 +峠浦 +峠田 +峠畑 +峠舘 +峠谷 +峠越 +峠野 +峠野下 +峠館 +峡 +峡下 +峡戸 +峨家 +峨家下 +峨山 +峩洋 +峪 +峪中 +峪原 +峪口 +峪合 +峪川 +峪村 +峪田 +峯 +峯ノ井 +峯㟁 +峯上 +峯下 +峯中 +峯丸 +峯久 +峯久保 +峯井 +峯佐 +峯俊 +峯元 +峯光 +峯内 +峯北 +峯原 +峯友 +峯口 +峯吉 +峯園 +峯地 +峯坂 +峯垣 +峯垣内 +峯垣外 +峯城 +峯塚 +峯宇 +峯尾 +峯山 +峯岡 +峯岩 +峯岸 +峯島 +峯崎 +峯嵜 +峯嶋 +峯嶌 +峯嶺 +峯川 +峯左 +峯平 +峯広 +峯廻 +峯当 +峯影 +峯後 +峯得 +峯戸 +峯戸松 +峯房 +峯政 +峯木 +峯本 +峯杉 +峯村 +峯松 +峯林 +峯枝 +峯柴 +峯森 +峯氏 +峯水 +峯永 +峯沢 +峯浦 +峯添 +峯滝 +峯澤 +峯瀧 +峯瀬 +峯玉 +峯田 +峯畑 +峯畠 +峯石 +峯砂 +峯神 +峯秀 +峯積 +峯竹 +峯籏 +峯脇 +峯芝 +峯苫 +峯藤 +峯西 +峯見 +峯谷 +峯越 +峯近 +峯迫 +峯邑 +峯部 +峯重 +峯野 +峯金 +峯間 +峯雪 +峯高 +峰 +峰㟁 +峰上 +峰下 +峰中 +峰久 +峰久保 +峰井 +峰俊 +峰元 +峰光 +峰内 +峰原 +峰友 +峰口 +峰吉 +峰咲 +峰回 +峰園 +峰地 +峰坂 +峰垣 +峰垣外 +峰城 +峰埼 +峰堂 +峰宇 +峰守 +峰安 +峰尾 +峰山 +峰岡 +峰岸 +峰島 +峰崎 +峰嶋 +峰嶌 +峰嶺 +峰川 +峰平 +峰広 +峰廣 +峰廻 +峰当 +峰得 +峰戸 +峰戸松 +峰房 +峰政 +峰数 +峰時 +峰晴 +峰木 +峰末 +峰本 +峰村 +峰松 +峰林 +峰森 +峰水 +峰永 +峰江 +峰沢 +峰浦 +峰添 +峰滝 +峰澤 +峰瀬 +峰田 +峰畑 +峰石 +峰砂 +峰神 +峰積 +峰竹 +峰籏 +峰脇 +峰苫 +峰藤 +峰行 +峰見 +峰谷 +峰越 +峰近 +峰邑 +峰重 +峰野 +峰金 +峰間 +峰阪 +峰雄 +峰雪 +峰高 +島 +島の江 +島ノ上 +島ノ内 +島ノ江 +島上 +島下 +島世 +島並 +島中 +島丸 +島乃 +島之上 +島之内 +島之江 +島也 +島井 +島仁 +島仲 +島住 +島佐 +島作 +島倉 +島元 +島先 +島光 +島児 +島兒 +島内 +島出 +島利 +島勝 +島北 +島原 +島口 +島台 +島吉 +島名 +島向 +島喜 +島図 +島地 +島坂 +島垣 +島垣内 +島埜 +島埜内 +島埼 +島堀 +島場 +島塚 +島多 +島夛 +島子 +島守 +島宗 +島宮 +島家 +島寄 +島富 +島寺 +島寿 +島尻 +島尾 +島居 +島屋 +島屋敷 +島山 +島岡 +島岩 +島峯 +島峰 +島崎 +島嵜 +島川 +島巡 +島巻 +島市 +島広 +島廣 +島廻 +島当 +島形 +島影 +島後 +島戸 +島扇 +島抜 +島拔 +島掛 +島方 +島星 +島朝 +島木 +島末 +島本 +島村 +島来 +島松 +島林 +島根 +島森 +島樋 +島橋 +島次 +島武 +島氏 +島永 +島江 +島池 +島沢 +島河 +島波 +島津 +島津屋 +島津江 +島浦 +島淵 +島添 +島渕 +島渡 +島滝 +島澤 +島瀧 +島瀬 +島片 +島王 +島生 +島田 +島田屋 +島田谷 +島畑 +島當 +島盛 +島矢 +島石 +島福 +島立 +島端 +島竹 +島筒 +島箭 +島籐 +島脇 +島薗 +島薮 +島藤 +島袋 +島西 +島見 +島角 +島記 +島谷 +島豆 +島貫 +島賀 +島越 +島路 +島軒 +島辺 +島辻 +島迫 +島途 +島道 +島邉 +島邊 +島邑 +島部 +島里 +島重 +島野 +島金 +島長 +島関 +島陰 +島隅 +島雄 +島須 +島頭 +島香 +島高 +島鼻 +峻 +峽戸 +崇像 +崇原 +崇宮 +崇島 +崇嶋 +崇本 +崇田 +崇谷 +崇雲 +崎 +崎上 +崎上野 +崎下 +崎中 +崎丸 +崎久保 +崎井 +崎代 +崎信 +崎元 +崎内 +崎出 +崎前 +崎原 +崎口 +崎向 +崎園 +崎土居 +崎地 +崎坂 +崎塩 +崎家 +崎尾 +崎屋 +崎山 +崎岡 +崎島 +崎嶋 +崎川 +崎平 +崎広 +崎廣 +崎弥 +崎戸 +崎手 +崎摩 +崎新谷 +崎本 +崎村 +崎松 +崎枝 +崎根 +崎森 +崎横 +崎水流 +崎永 +崎江 +崎池 +崎津 +崎浜 +崎浦 +崎浴 +崎濱 +崎瀬 +崎灘 +崎玉 +崎生 +崎田 +崎畑 +崎石 +崎神 +崎花 +崎薗 +崎薮 +崎藤 +崎西 +崎見 +崎詰 +崎谷 +崎辺 +崎迫 +崎道 +崎邉 +崎邊 +崎部 +崎里 +崎重 +崎野 +崎長 +崎門 +崎間 +崎阪 +崎須家 +崎須賀 +崎高 +崎高科 +崑野 +崔原 +崔山 +崔川 +崔本 +崔村 +崔玉 +崔藤 +崕 +崖 +崗崎 +崗本 +崟 +崩 +崩中 +崩前 +崩口 +崩場 +崩宗 +崩山 +崩岡 +崩田 +崩紫 +崩谷 +嵐 +嵐倉 +嵐口 +嵐城 +嵐山 +嵐川 +嵐柴 +嵐田 +嵐谷 +嵐野 +嵒 +嵒淵 +嵒瀬 +嵓 +嵓尾 +嵓栖 +嵓渕 +嵓田 +嵜 +嵜上 +嵜中 +嵜井 +嵜元 +嵜原 +嵜口 +嵜山 +嵜岡 +嵜嶋 +嵜川 +嵜本 +嵜村 +嵜永 +嵜浜 +嵜濵 +嵜田 +嵜辺 +嵜迫 +嵜野 +嵡 +嵩 +嵩下 +嵩井 +嵩倉 +嵩元 +嵩原 +嵩地 +嵩垣 +嵩宮 +嵩寺 +嵩尾 +嵩山 +嵩岡 +嵩島 +嵩嶺 +嵩本 +嵩村 +嵩橋 +嵩田 +嵩西 +嵩谷 +嵩里 +嵩野 +嵪司 +嵭寄 +嵭崎 +嵯城 +嵯峨 +嵯峨井 +嵯峨原 +嵯峨口 +嵯峨山 +嵯峨崎 +嵯峨座 +嵯峨根 +嵯峨濃 +嵯峨田 +嵯峨見 +嵯峨谷 +嵯峨里 +嵯峨野 +嵯川 +嵯我 +嵯我根 +嵯末 +嵯維 +嵳峩 +嶂南 +嶋 +嶋ノ内 +嶋ノ江 +嶋上 +嶋下 +嶋中 +嶋之内 +嶋之木 +嶋井 +嶋仁 +嶋仲 +嶋住 +嶋佐 +嶋作 +嶋倉 +嶋元 +嶋先 +嶋児 +嶋内 +嶋出 +嶋利 +嶋加 +嶋北 +嶋原 +嶋口 +嶋司 +嶋吉 +嶋名 +嶋地 +嶋坂 +嶋垣 +嶋城 +嶋埜 +嶋埼 +嶋場 +嶋壽 +嶋多 +嶋夛 +嶋子 +嶋守 +嶋宗 +嶋宮 +嶋家 +嶋富 +嶋寺 +嶋寿 +嶋尻 +嶋尾 +嶋居 +嶋屋 +嶋山 +嶋岡 +嶋峰 +嶋崎 +嶋嵜 +嶋川 +嶋巻 +嶋市 +嶋広 +嶋廻 +嶋形 +嶋影 +嶋戸 +嶋指 +嶋方 +嶋木 +嶋末 +嶋本 +嶋村 +嶋松 +嶋林 +嶋柳 +嶋根 +嶋森 +嶋橋 +嶋永 +嶋江 +嶋池 +嶋沢 +嶋治 +嶋津 +嶋浦 +嶋浦屋 +嶋添 +嶋渡 +嶋澤 +嶋瀬 +嶋生 +嶋田 +嶋畑 +嶋矢 +嶋立 +嶋竹 +嶋羽 +嶋脇 +嶋藤 +嶋袋 +嶋西 +嶋見 +嶋谷 +嶋貫 +嶋越 +嶋路 +嶋辺 +嶋道 +嶋邑 +嶋邨 +嶋部 +嶋里 +嶋野 +嶋長 +嶋雄 +嶋頭 +嶋香 +嶋高 +嶌 +嶌中 +嶌井 +嶌倉 +嶌内 +嶌原 +嶌口 +嶌名 +嶌堀 +嶌場 +嶌子 +嶌守 +嶌屋 +嶌岡 +嶌峰 +嶌崎 +嶌嵜 +嶌川 +嶌影 +嶌末 +嶌本 +嶌村 +嶌根 +嶌森 +嶌津 +嶌浦 +嶌生 +嶌田 +嶌藤 +嶌谷 +嶌貫 +嶌越 +嶌野 +嶌頭 +嶌𡌛 +嶝 +嶝口 +嶝本 +嶝野 +嶧田 +嶬峨 +嶮岡 +嶸山 +嶹村 +嶹津 +嶺 +嶺下 +嶺乗 +嶺井 +嶺倉 +嶺元 +嶺出 +嶺尾 +嶺山 +嶺岡 +嶺岸 +嶺島 +嶺崎 +嶺川 +嶺木 +嶺本 +嶺村 +嶺沢 +嶺澤 +嶺田 +嶺石 +嶺脇 +嶺蔭 +嶺藤 +嶺重 +嶺野 +嶺間 +嶼 +嶼田 +嶽 +嶽ノ +嶽下 +嶽元 +嶽内 +嶽出 +嶽北 +嶽友 +嶽坂 +嶽小原 +嶽尾 +嶽山 +嶽岡 +嶽崎 +嶽川 +嶽木 +嶽木場 +嶽本 +嶽村 +嶽森 +嶽沢 +嶽澤 +嶽田 +嶽盛 +嶽石 +嶽肩 +嶽道 +嶽部 +嶽野 +嶽釜 +嶽間沢 +嶽間澤 +巌 +巌上 +巌主 +巌佐 +巌倉 +巌内 +巌名 +巌后 +巌城 +巌寺 +巌島 +巌崎 +巌川 +巌本 +巌村 +巌林 +巌根 +巌樫 +巌水 +巌洞 +巌津 +巌淵 +巌渕 +巌瀬 +巌田 +巌真 +巌築 +巌西 +巌見 +巌谷 +巌野 +巌間 +巖 +巖主 +巖倉 +巖内 +巖后 +巖城 +巖埼 +巖寺 +巖崎 +巖嵜 +巖川 +巖木 +巖本 +巖林 +巖根 +巖水 +巖洞 +巖津 +巖淵 +巖渕 +巖田 +巖築 +巖西 +巖見 +巖谷 +巖野 +巖間 +川 +川ノ上 +川ノ口 +川ノ辺 +川ノ邉 +川ノ邊 +川㠀 +川七 +川上 +川下 +川丘 +川並 +川中 +川中子 +川中島 +川中嶋 +川久 +川久保 +川之上 +川之内 +川之江 +川之辺 +川之邉 +川乗 +川乘 +川九 +川乱 +川井 +川井京 +川井田 +川亦 +川人 +川仁 +川付 +川代 +川仲 +川伊 +川会 +川住 +川佐 +川來 +川保 +川信 +川俣 +川倉 +川元 +川先 +川光 +川入 +川内 +川内丸 +川内田 +川内谷 +川内野 +川円 +川冨 +川出 +川分 +川初 +川前 +川副 +川勝 +川勢 +川勾 +川匂 +川北 +川南 +川原 +川原上 +川原井 +川原出 +川原口 +川原名 +川原吹 +川原園 +川原垣 +川原場 +川原塚 +川原子 +川原山 +川原崎 +川原木 +川原村 +川原林 +川原橋 +川原田 +川原畑 +川原窪 +川原谷 +川原道 +川去 +川去田 +川又 +川叉 +川取 +川口 +川口屋 +川口谷 +川古 +川古谷 +川合 +川合田 +川吉 +川名 +川名子 +川名部 +川后 +川向 +川向井 +川吾 +川味 +川和 +川和田 +川咲 +川品 +川喜多 +川喜田 +川図 +川土 +川土居 +川地 +川坂 +川垣 +川城 +川埜 +川埼 +川堀 +川堤 +川堰 +川場 +川堺 +川塚 +川塲 +川増 +川墨 +川壁 +川夏 +川外 +川多 +川太 +川奈 +川奈辺 +川奈部 +川奈野 +川奥 +川妻 +川子 +川守 +川守田 +川安 +川室 +川宮 +川宿田 +川寄 +川寅 +川密 +川富 +川小 +川小根 +川小谷 +川尻 +川尾 +川居 +川山 +川岡 +川岬 +川岳 +川岸 +川峯 +川峰 +川島 +川崎 +川崎田 +川崎舎 +川崎谷 +川崖 +川嵜 +川嶋 +川嶌 +川嶺 +川市 +川幅 +川幡 +川平 +川広 +川庄 +川床 +川底 +川座 +川廣 +川延 +川廷 +川建 +川当 +川形 +川影 +川後 +川後田 +川恵 +川成 +川戸 +川戸口 +川戸洞 +川戸道 +川手 +川打 +川挾 +川政 +川敷 +川新 +川方 +川旗 +川智 +川曲 +川曽 +川會 +川月 +川木 +川木戸 +川末 +川本 +川杉 +川村 +川条 +川来 +川東 +川松 +川林 +川枝 +川柄 +川染 +川柳 +川柴 +川栄 +川根 +川桐 +川桝 +川梅 +川條 +川棚 +川森 +川森田 +川植 +川椙 +川楠 +川極 +川榮 +川樋 +川横 +川橋 +川次 +川武 +川武当 +川毛 +川水 +川水流 +川永 +川江 +川池 +川沢 +川治 +川沼 +川沿 +川泉 +川波 +川波多 +川泻 +川津 +川津原 +川洲 +川浜 +川浦 +川浪 +川涯 +川淵 +川添 +川済 +川渕 +川渡 +川湊 +川満 +川溿 +川滝 +川滿 +川潟 +川澄 +川澤 +川濱 +川瀧 +川瀬 +川瀬木 +川熊 +川片 +川猿 +川生 +川田 +川田代 +川田原 +川由 +川町 +川畑 +川畔 +川留 +川畠 +川當 +川登 +川白 +川盛 +川目 +川相 +川眞田 +川真田 +川真角 +川知 +川石 +川砂 +川神 +川福 +川空 +川窪 +川立 +川竜 +川童 +川端 +川端下 +川竹 +川等 +川筋 +川節 +川篠 +川籏 +川綱 +川緑 +川縁 +川羽田 +川股 +川脇 +川腰 +川舗 +川舛 +川舟 +川舩 +川船 +川良 +川芹 +川茂 +川蔦 +川藤 +川蜜 +川行 +川衛 +川衞 +川袋 +川裏 +川裾 +川西 +川見 +川角 +川谷 +川谷内 +川賀 +川越 +川跡 +川路 +川路山 +川路迫 +川辰 +川辺 +川辺田 +川辻 +川込 +川迎 +川近 +川迫 +川述 +川逑 +川通 +川連 +川道 +川達 +川邉 +川邊 +川邊田 +川邑 +川那 +川那子 +川那辺 +川那邉 +川那邊 +川那部 +川邨 +川部 +川部本 +川部谷 +川里 +川重 +川野 +川野上 +川野元 +川野原 +川野名 +川野目 +川野谷 +川野賀 +川野輪 +川野辺 +川野邉 +川野邊 +川野部 +川金 +川釣 +川鈴木 +川鍋 +川長 +川門 +川門前 +川開 +川間 +川関 +川阪 +川附 +川除 +川隅 +川隈 +川際 +川霜 +川面 +川音 +川須 +川須宮 +川頭 +川風 +川飛 +川馬 +川高 +川鮎 +川鯉 +川鰭 +川鶴 +川龍 +川𡌛 +州之内 +州合 +州山 +州崎 +州嵜 +州本 +州村 +州沢 +州浜 +州濱 +州脇 +州野戸 +州鎌 +巡 +巡田 +巣 +巣之内 +巣元 +巣内 +巣原 +巣合 +巣子守 +巣守 +巣山 +巣張 +巣木 +巣森 +巣永 +巣河 +巣瀬 +巣田 +巣立 +巣篭 +巣籠 +巣組 +巣野 +巣鴨 +巣鷹 +巣黒 +工 +工一 +工並 +工代 +工伝 +工位 +工保 +工光 +工内 +工匠 +工原 +工口 +工古田 +工合田 +工垣内 +工士 +工宗 +工家 +工富 +工岡 +工島 +工嶋 +工川 +工平 +工広 +工廣 +工徳 +工忠 +工方 +工月 +工木 +工本 +工村 +工東 +工棟 +工楽 +工樂 +工水戸 +工永 +工波 +工津 +工田 +工畑 +工納 +工能 +工藤 +工西 +工谷 +工通 +工道 +工野 +工門 +工頭谷 +左 +左々 +左々木 +左リ +左三川 +左中 +左久田 +左久間 +左京 +左今 +左伊木 +左伝 +左伴 +左倉 +左光 +左内 +左利 +左原 +左口 +左古 +左古田 +左右 +左右内 +左右加 +左右崎 +左右木 +左右津 +左右田 +左右知 +左右都 +左司 +左合 +左同 +左向 +左土 +左地 +左坂 +左坐 +左坤 +左奈田 +左子 +左孝 +左官 +左官谷 +左少 +左尾 +左居 +左屏 +左山 +左島 +左崎 +左嵜 +左川 +左巴 +左巻 +左座 +左応 +左成 +左戸 +左手 +左振 +左文字 +左方 +左木 +左木山 +左本 +左村 +左東 +左枝 +左柄 +左橋 +左次 +左武 +左殿 +左氏 +左沢 +左治木 +左波 +左津前 +左海 +左海谷 +左溝 +左滝 +左澤 +左瀧 +左熊 +左田 +左田本 +左田野 +左甲斐 +左畑 +左留間 +左登 +左直 +左着 +左神 +左竹 +左納 +左紺 +左織 +左脇 +左膳 +左舗 +左舘 +左良 +左良井 +左草 +左藤 +左衛門三郎 +左谷 +左谷野 +左貝 +左貫 +左賀 +左路 +左農 +左近 +左近上 +左近作 +左近允 +左近充 +左近司 +左近士 +左近戸 +左近田 +左迫間 +左道 +左達 +左部 +左郷 +左野 +左門 +左間 +左雨 +左雲 +左順 +左館 +左高 +左鴻 +巧 +巧野 +巨勢 +巨山 +巨島 +巨嶋 +巨摩 +巨智部 +巨椋 +巨橋 +巨泉 +巨津 +巨海 +巨瀬 +巨炊 +巨田 +巨畠 +巨知 +巨藤 +巨谷 +巨銀 +巨関 +差ケ久保 +差久保 +差出 +差司 +差尾 +差形 +差本 +差波 +差海 +差生 +差畑 +差間 +己ノ瀬 +己上 +己之上 +己之口 +己之越 +己亦 +己城 +己山 +己岡 +己年後 +己扇 +己斐 +己斐田 +己波 +己浪 +己谷 +己越 +己野 +已上 +已亦 +已浪 +巳ノ瀬 +巳上 +巳之上 +巳之口 +巳亦 +巳作 +巳午 +巳原 +巳口 +巳城 +巳寅 +巳山 +巳岡 +巳嵜 +巳年後 +巳扇 +巳本 +巳村 +巳松 +巳波 +巳浪 +巳田 +巳継 +巳角 +巳谷 +巳越 +巳造 +巳野 +巳鼻 +巴 +巴亜久 +巴山 +巴川 +巴月 +巴田 +巴谷 +巴里 +巴陵 +巷岡 +巷野 +巻 +巻上 +巻下 +巻之内 +巻井 +巻内 +巻出 +巻口 +巻坂 +巻埜 +巻堂 +巻多 +巻寄 +巻尾 +巻山 +巻島 +巻崎 +巻嶋 +巻嶌 +巻川 +巻幡 +巻木 +巻本 +巻柄 +巻沢 +巻淵 +巻渕 +巻田 +巻矢 +巻砂 +巻端 +巻苑 +巻藁 +巻藤 +巻郷 +巻野 +巻鞘 +巽 +巽口 +巽川 +巽谷 +巾 +巾下 +巾内 +巾島 +巾崎 +巾嶋 +巾村 +巾田 +巾野 +市 +市の川 +市の瀬 +市ケ坪 +市ケ谷 +市ケ関 +市ノ川 +市ノ木 +市ノ木山 +市ノ沢 +市ノ渡 +市ノ澤 +市ノ瀬 +市ノ羽 +市万田 +市上 +市下 +市中 +市丸 +市之坪 +市之宮 +市之川 +市之瀬 +市井 +市井川 +市井瀬 +市人 +市位 +市佐 +市來 +市來崎 +市保 +市倉 +市側 +市元 +市六 +市兼 +市内 +市冨 +市前 +市加 +市勢 +市南 +市原 +市口 +市古 +市吉 +市名 +市呂 +市味 +市囿 +市園 +市地 +市坂 +市坡 +市坪 +市埜 +市堀 +市堰 +市場 +市場屋 +市場谷 +市塙 +市塚 +市塲 +市大 +市太 +市妙 +市姫 +市子 +市子原 +市子島 +市子嶋 +市守 +市室 +市宮 +市富 +市尻 +市尾 +市居 +市屋 +市山 +市岡 +市峪 +市島 +市崎 +市崎野 +市嶋 +市川 +市布 +市平 +市座 +市延 +市後 +市後崎 +市成 +市戸 +市政 +市明 +市木 +市木山 +市木崎 +市木嵜 +市末 +市本 +市村 +市村元 +市条 +市来 +市来原 +市来崎 +市来嵜 +市東 +市林 +市枝 +市栄 +市根井 +市森 +市楽 +市榮 +市槁 +市橋 +市毛 +市永 +市江 +市池 +市沢 +市河 +市河原 +市波 +市津 +市浜 +市浦 +市渡 +市澤 +市濱 +市瀬 +市物 +市玖 +市田 +市田山 +市町 +市畑 +市石 +市礒 +市穂 +市竹 +市紋 +市耒 +市耒原 +市耒崎 +市耒嵜 +市脇 +市花 +市葉 +市薗 +市藤 +市裏 +市西 +市角 +市谷 +市賀 +市輪 +市辺 +市辻 +市道 +市邉 +市邊 +市邨 +市部 +市里 +市野 +市野井 +市野塚 +市野川 +市野木 +市野沢 +市野渡 +市野澤 +市野瀬 +市野郷 +市金 +市長 +市門 +市間 +市頭 +布 +布々内 +布一 +布上 +布下 +布久保 +布井 +布住 +布佐 +布作 +布俣 +布倉 +布元 +布内 +布冨 +布出 +布利幡 +布勢 +布原 +布台 +布垣 +布埜 +布塚 +布士 +布子 +布宮 +布家 +布富 +布寺 +布尻 +布尾 +布居 +布屋 +布山 +布島 +布崎 +布川 +布巻 +布市 +布平 +布広 +布廣 +布引 +布志原 +布志木 +布戸 +布手 +布方 +布施 +布施屋 +布施川 +布施木 +布施田 +布施谷 +布施野 +布施院 +布旗 +布木 +布本 +布村 +布柴 +布栄 +布橋 +布江 +布江田 +布沢 +布河谷 +布津 +布津田 +布浦 +布滝 +布澤 +布瀬 +布瀬川 +布瀬谷 +布生 +布田 +布田原 +布田川 +布留 +布留宮 +布留川 +布留本 +布留谷 +布益 +布目 +布目谷 +布矢 +布知永 +布籐 +布綛 +布能 +布臺 +布良 +布花原 +布藤 +布袋 +布袋屋 +布袋田 +布袋谷 +布見 +布角 +布谷 +布路野 +布辻 +布部 +布重 +布野 +布金 +布間 +帆 +帆井 +帆代 +帆保 +帆先 +帆刈 +帆前 +帆加利 +帆北 +帆坂 +帆士 +帆山 +帆崎 +帆巻 +帆引 +帆影 +帆戸石 +帆景 +帆木の上 +帆木ノ上 +帆木上 +帆本 +帆江 +帆波 +帆玉 +帆秋 +帆苅 +帆西 +帆角 +帆谷 +帆足 +帆風 +帆高 +帆鷲 +帋谷 +希代 +希有 +帖佐 +帖地 +帘 +帝井 +帝都 +帝釈 +帝釋 +帥 +師 +師々田 +師井 +師入 +師子堂 +師子角 +師子野 +師子鹿 +師富 +師尾 +師山 +師岡 +師崎 +師川 +師星 +師村 +師橋 +師水 +師池 +師玉 +師田 +師社 +師藤 +師角 +師資田 +席定 +帯 +帯井 +帯刀 +帯刀田 +帯刃 +帯包 +帯原 +帯名 +帯向 +帯壁 +帯屋 +帯山 +帯島 +帯川 +帯戸 +帯施 +帯杓 +帯永 +帯津 +帯瀬 +帯田 +帯盛 +帯谷 +帯賀 +帯辺 +帯邉 +帯邊 +帯部 +帯野 +帯金 +帯長 +帰依 +帰土 +帰坂 +帰家 +帰山 +帰度 +帰村 +帰来 +帰路 +帳 +帳佐 +帳地 +帳山 +帶井 +帶刀 +帶包 +帶向 +帶屋 +帶山 +帶川 +帶施 +帶杓 +帶瀬 +帶田 +帶谷 +帶賀 +帶金 +帷 +帷子 +常 +常ノ内 +常下 +常世 +常世田 +常丗田 +常丸 +常久 +常井 +常住 +常俊 +常保 +常信 +常倍 +常元 +常光 +常光寺 +常兼 +常内 +常冨 +常前 +常包 +常原 +常友 +常吉 +常名 +常味 +常和 +常喜 +常国 +常国院 +常國 +常城 +常塚 +常増 +常多 +常好 +常守 +常安 +常宗 +常定 +常宮 +常家 +常富 +常察 +常少 +常尾 +常山 +常岡 +常峯 +常峰 +常島 +常崎 +常川 +常平 +常幸 +常広 +常廣 +常弘 +常徳 +常念 +常恒 +常慶 +常成 +常戸 +常持 +常政 +常数 +常明 +常木 +常末 +常本 +常村 +常松 +常板 +常林 +常林坊 +常枝 +常栄 +常森 +常楽 +常楽寺 +常樂 +常橋 +常次 +常武 +常永 +常沢 +常泉 +常法 +常法寺 +常泰 +常浦 +常深 +常清 +常澄 +常澤 +常玄 +常田 +常畑 +常盛 +常盤 +常盤井 +常盤山 +常盤木 +常盤野 +常石 +常磐 +常磐井 +常福 +常秋 +常脇 +常葉 +常藤 +常行 +常西 +常見 +常角 +常詰 +常諾 +常谷 +常貞 +常賀 +常軒 +常通 +常道 +常重 +常野 +常銀 +常長 +常門 +常間地 +常陰 +常陸 +常陸谷 +常隂 +常雪 +常風 +常高 +帽子 +帽子山 +帽田 +帾畑 +幅 +幅上 +幅下 +幅中 +幅之上 +幅内 +幅出 +幅口 +幅多 +幅寺 +幅尾 +幅屋 +幅岸 +幅崎 +幅嵜 +幅田 +幅米 +幅舘 +幅谷 +幅野 +幌 +幌岩 +幌村 +幕 +幕井 +幕内 +幕地 +幕沢 +幕澤 +幕田 +幕谷 +幟 +幟山 +幟川 +幟建 +幟持 +幟立 +幡 +幡上 +幡中 +幡丸 +幡井 +幡保 +幡出 +幡南 +幡原 +幡司 +幡吉 +幡地 +幡坂 +幡垣 +幡基 +幡場 +幡多 +幡宮 +幡屋 +幡山 +幡島 +幡川 +幡手 +幡掛 +幡摩 +幡新 +幡木 +幡本 +幡杭 +幡東 +幡歩 +幡永 +幡江 +幡瀬 +幡生 +幡田 +幡田実 +幡田實 +幡盛 +幡矢 +幡磨 +幡竜 +幡谷 +幡豆 +幡部 +幡野 +幡鉾 +幡鎌 +幡隋 +幡随 +幡頭 +幡龍 +幢崎 +幣 +幣ノ内 +幣之内 +幣倉 +幣内 +幣原 +幣司 +幣守 +幣島 +幣旗 +幣次 +幣田 +幤 +幤内 +干上 +干井 +干元 +干台 +干場 +干塲 +干山 +干岸田 +干川 +干布 +干張 +干明田 +干本 +干村 +干水 +干河岸 +干泥 +干潟 +干瀉 +干物 +干田 +干田尾 +干畑 +干畠 +干臺 +干谷 +干貝 +干賀 +干越 +干野 +干飯 +干高 +干鯛 +干鰯谷 +平 +平々 +平ケ倉 +平ノ上 +平ノ内 +平ノ谷 +平㔟 +平上 +平下 +平世 +平丘 +平中 +平丸 +平久 +平久井 +平久保 +平久江 +平之 +平之内 +平之園 +平之山 +平井 +平井出 +平井名 +平井谷 +平仁田 +平仙 +平代 +平仲 +平伊 +平伊良 +平伴 +平位 +平住 +平佐 +平佐多 +平佐田 +平体 +平作 +平信 +平倉 +平儀野 +平元 +平光 +平児 +平児玉 +平入 +平八重 +平兮 +平兼 +平内 +平冨 +平出 +平出水 +平利 +平前 +平加 +平勢 +平包 +平化 +平北 +平升 +平南 +平原 +平口 +平口山 +平古 +平古場 +平吉 +平名 +平向 +平吹 +平吾 +平和 +平和田 +平国 +平國 +平園 +平土 +平土井 +平土名 +平地 +平地屋 +平坂 +平坪 +平垣 +平垣内 +平城 +平埜 +平堀 +平場 +平塚 +平塩 +平増 +平墳 +平多 +平大路 +平太 +平奈 +平奥 +平好 +平子 +平子田 +平宅 +平宇 +平守 +平安 +平安名 +平安寺 +平安山 +平安座 +平室 +平宮 +平家 +平富 +平小場 +平小瀬 +平尻 +平尾 +平居 +平屋 +平屋敷 +平山 +平岡 +平岡江 +平岩 +平岳 +平岸 +平峠 +平峯 +平峰 +平島 +平崎 +平嵜 +平嶋 +平嶌 +平嶺 +平川 +平工 +平己 +平巳 +平市 +平幡 +平床 +平座 +平康 +平延 +平形 +平後 +平後園 +平得 +平徳 +平忠 +平意 +平戸 +平戸木 +平手 +平抜 +平掛 +平敷 +平文 +平新 +平方 +平早 +平早水 +平昌 +平明 +平星 +平春 +平昭 +平時 +平木 +平木場 +平木塲 +平末 +平本 +平杉 +平村 +平松 +平松大 +平林 +平柳 +平柴 +平柿 +平栃 +平栗 +平根 +平桑 +平桜 +平桝 +平梅 +平棟 +平森 +平楽 +平楽寺 +平槇 +平槙 +平樂 +平樂寺 +平橋 +平櫛 +平櫻 +平武 +平水 +平水流 +平永 +平江 +平池 +平沖 +平沙 +平沢 +平沢津 +平河 +平河内 +平治 +平沼 +平泉 +平波 +平泻 +平津 +平浜 +平浪 +平浴 +平海 +平添 +平清 +平清水 +平渕 +平渡 +平湯 +平満 +平源 +平滑 +平滝 +平潟 +平澤 +平澤津 +平濱 +平瀧 +平瀬 +平瀬戸 +平熊 +平片 +平牛 +平牟礼 +平牟禮 +平牧 +平玉 +平理 +平瓦 +平生 +平田 +平田谷 +平町 +平畑 +平畒 +平留 +平畝 +平畠 +平盛 +平目 +平矢 +平石 +平砂 +平硲 +平碆 +平碰 +平磯 +平礒 +平社 +平神 +平福 +平稲 +平窪 +平端 +平竹 +平等 +平等路 +平籔 +平糠 +平紗 +平紙 +平綱 +平綿 +平緒 +平繁 +平織 +平美 +平群 +平義 +平職 +平能 +平脇 +平腰 +平舗 +平舘 +平舛 +平舟 +平舩 +平船 +平良 +平良木 +平芝 +平芳 +平若 +平葉 +平葦 +平葭 +平蔡 +平蔵 +平薮 +平藤 +平藪 +平衛 +平西 +平見 +平親 +平角 +平訳 +平識 +平譯 +平谷 +平貞 +平財 +平賀 +平越 +平路 +平身 +平躰 +平輪 +平辻 +平迫 +平通 +平連 +平道 +平遠 +平邑 +平郡 +平部 +平郷 +平都 +平里 +平重 +平野 +平野井 +平野内 +平野前 +平野原 +平野西 +平野谷 +平金 +平釜 +平鍋 +平長 +平門 +平間 +平阪 +平隈 +平須賀 +平館 +平馬 +平高 +平魯 +平鹿 +平麻 +平黄 +年々 +年代 +年光 +年前 +年友 +年吉 +年名 +年国 +年増 +年宗 +年岡 +年川 +年徳 +年徳谷 +年恵 +年木 +年未 +年末 +年本 +年梅 +年森 +年楳 +年次 +年水 +年永 +年清 +年澄 +年田 +年盛 +年真 +年神 +年綱 +年縄 +年繩 +年藤 +年見 +年見口 +年財 +年貢田 +年野 +幵分 +幸 +幸丈 +幸上 +幸下 +幸世 +幸中 +幸丸 +幸之松 +幸亀 +幸事 +幸井 +幸人 +幸伏 +幸住 +幸佐 +幸保 +幸元 +幸先 +幸光 +幸内 +幸円 +幸冨 +幸前 +幸加木 +幸勢城 +幸原 +幸口 +幸吉 +幸喜 +幸園 +幸土 +幸地 +幸坂 +幸城 +幸埜 +幸堀 +幸場 +幸塚 +幸増 +幸壬 +幸多 +幸妻 +幸婦山 +幸家 +幸富 +幸寺 +幸尻 +幸尾 +幸屋 +幸山 +幸岡 +幸岩 +幸島 +幸崎 +幸嶋 +幸川 +幸左 +幸平 +幸弥 +幸形 +幸待 +幸後 +幸得 +幸徳 +幸恵 +幸所 +幸才 +幸明 +幸月 +幸木 +幸本 +幸村 +幸来 +幸松 +幸林 +幸柳 +幸柿 +幸根 +幸森 +幸次 +幸正 +幸毛 +幸永 +幸池 +幸沢 +幸河 +幸治 +幸泉 +幸津 +幸津川 +幸浦 +幸淵 +幸渕 +幸澤 +幸物 +幸玉 +幸王 +幸生 +幸田 +幸畑 +幸畠 +幸真 +幸知 +幸神 +幸福 +幸福司 +幸福田 +幸積 +幸窪 +幸節 +幸縁 +幸繁 +幸義 +幸者 +幸脇 +幸良 +幸若 +幸茂 +幸菊 +幸藤 +幸西 +幸谷 +幸賀 +幸路 +幸迫 +幸道 +幸部 +幸里 +幸重 +幸野 +幸野屋 +幸野谷 +幸鉢 +幸長 +幸間 +幸阪 +幸頭 +幸風 +幸馬 +幸高 +幹 +幹山 +幹戸 +幹江 +幹田 +幻中 +幼方 +幽渓 +幽溪 +幽経 +幽谷 +幾 +幾世 +幾世橋 +幾世永 +幾乃 +幾久 +幾井 +幾代 +幾佐田 +幾原 +幾合 +幾和 +幾地 +幾坂 +幾尾 +幾山 +幾岡 +幾島 +幾嶋 +幾川 +幾左田 +幾度 +幾志 +幾戸 +幾政 +幾本 +幾村 +幾桑 +幾橋 +幾永 +幾波 +幾浦 +幾渡 +幾滝 +幾瀧 +幾瀬 +幾田 +幾留 +幾石 +幾竹 +幾老 +幾良 +幾見 +幾谷 +幾野 +幾間 +幾馬 +幾高 +庁 +広 +広エ +広上 +広下 +広世 +広丘 +広中 +広丸 +広久 +広久保 +広之内 +広亀 +広井 +広仲 +広住 +広佐古 +広作 +広保 +広信 +広倉 +広元 +広光 +広兼 +広内 +広冨 +広出 +広刈 +広利 +広前 +広勢 +広升 +広南 +広原 +広友 +広口 +広司 +広吉 +広和 +広国 +広地 +広坂 +広垣 +広城 +広場 +広塚 +広増 +広多 +広奥 +広好 +広子 +広宇次 +広宇治 +広守 +広安 +広実 +広宮 +広家 +広富 +広實 +広小路 +広尾 +広居 +広屋 +広山 +広岡 +広岩 +広峯 +広峰 +広島 +広島屋 +広崎 +広嵜 +広嶋 +広嶌 +広嶼 +広川 +広常 +広幡 +広平 +広幸 +広底 +広庭 +広康 +広延 +広引 +広志 +広恒 +広恵 +広戸 +広房 +広政 +広方 +広明 +広曽 +広木 +広未 +広末 +広本 +広杉 +広村 +広東 +広松 +広林 +広枝 +広根 +広桝 +広桶 +広梅 +広森 +広橋 +広次 +広正 +広武 +広歳 +広段 +広比 +広氏 +広水 +広永 +広江 +広池 +広沢 +広河 +広河原 +広沼 +広波 +広洞 +広津 +広津留 +広浜 +広浦 +広海 +広海渡 +広淵 +広清 +広済 +広渕 +広渡 +広滋 +広滝 +広澤 +広濱 +広瀧 +広瀬 +広狩 +広猟 +広玉 +広理 +広田 +広町 +広畑 +広畝 +広畠 +広白 +広盛 +広目 +広直 +広知 +広石 +広砂 +広神 +広秋 +広端 +広竹 +広籐 +広納 +広綱 +広繁 +広羽 +広能 +広脇 +広舟 +広船 +広芝 +広花 +広芳 +広芽 +広苅 +広若 +広茂 +広葉 +広藤 +広行 +広西 +広見 +広角 +広谷 +広貞 +広賀 +広越 +広路 +広辺 +広辻 +広近 +広迫 +広連 +広道 +広郡 +広部 +広里 +広重 +広野 +広金 +広長 +広門 +広間 +広阪 +広陵 +広隅 +広隆 +広須 +広飯 +広高 +広鰭 +広鶴 +広鹿 +庄 +庄ノ +庄下 +庄中 +庄井 +庄倉 +庄八 +庄内 +庄内谷 +庄出 +庄加 +庄勢 +庄原 +庄口 +庄古 +庄司 +庄司沢 +庄司澤 +庄司見 +庄司野 +庄喜 +庄地 +庄地畠 +庄坪 +庄垣 +庄垣内 +庄埜 +庄堀 +庄堂 +庄境 +庄太 +庄子 +庄寿見 +庄尻 +庄屋 +庄山 +庄島 +庄崎 +庄嵜 +庄嶋 +庄川 +庄形 +庄後 +庄慶 +庄戸 +庄木 +庄未 +庄末 +庄本 +庄村 +庄条 +庄林 +庄條 +庄森 +庄武 +庄毛 +庄江 +庄治 +庄津 +庄満 +庄源 +庄瀬 +庄田 +庄田平 +庄畑 +庄畠 +庄盛 +庄矢 +庄礼 +庄福 +庄禮 +庄窪 +庄篭 +庄籠 +庄納 +庄舘 +庄藤 +庄見 +庄谷 +庄谷内 +庄賀 +庄路 +庄部 +庄野 +庄野屋 +庄野崎 +庄門 +庄館 +庇 +床 +床並 +床井 +床元 +床分 +床原 +床司 +床呂 +床坊 +床夏 +床宿 +床尾 +床山 +床岡 +床島 +床嶋 +床川 +床平 +床本 +床村 +床板 +床枝 +床桜 +床櫻 +床次 +床波 +床津 +床浦 +床浪 +床爪 +床田 +床石 +床西 +床谷 +床辺 +床那部 +床野 +床鍋 +床間 +底 +底原 +底押 +底水 +底田 +庖丁 +庖刀 +店 +店元 +店場 +店居 +店崎 +店曲 +店本 +店村 +店橋 +店田 +店網 +店谷 +店部 +店野 +庚 +庚塚 +庚田 +庚申 +府上 +府中 +府中屋 +府中谷 +府内 +府味田 +府和 +府屋 +府山 +府岡 +府川 +府後 +府木 +府本 +府栄野 +府榮野 +府殿 +府津羅 +府瀬川 +府玻 +府田 +府藤 +府賀 +府越 +府道 +府野 +府金 +府録 +府間 +府馬 +府高 +府鳥 +度 +度合 +度山 +度島 +度嶋 +度紀 +度野 +度長 +座主 +座主坊 +座久 +座光寺 +座加比 +座古 +座古谷 +座吾 +座呂奥 +座和 +座喜味 +座嘉比 +座守 +座安 +座小田 +座山 +座床 +座木 +座本 +座正 +座波 +座田 +座礼 +座禮 +座覇 +座親 +座谷 +座賀白 +座間 +座間味 +座馬 +庫ケ入 +庫井 +庫元 +庫内 +庫山 +庫岡 +庫川 +庫本 +庫田 +庫谷 +庭 +庭久保 +庭井 +庭代 +庭前 +庭和田 +庭坂 +庭尾 +庭屋 +庭山 +庭崎 +庭川 +庭文 +庭新 +庭月 +庭月野 +庭木 +庭本 +庭村 +庭林 +庭植 +庭池 +庭瀬 +庭田 +庭谷 +庭野 +庭鳥島 +庭鳥嶋 +庵 +庵ノ下 +庵ノ前 +庵上 +庵下 +庵之下 +庵井 +庵住 +庵前 +庵原 +庵口 +庵地 +庵坂 +庵奥 +庵尾 +庵屋敷 +庵山 +庵崎 +庵床 +庵戸 +庵木 +庵本 +庵杉 +庵森 +庵治 +庵治川 +庵田 +庵藤 +庵袋 +庵谷 +庵谷内 +庵跡 +庵軒 +庵迫 +庵逧 +庵野 +庵阪 +康上 +康乗 +康乘 +康井 +康原 +康友 +康守 +康富 +康山 +康川 +康広 +康成 +康本 +康村 +康松 +康永 +康海 +康田 +康谷 +康野 +庸司 +廉 +廉内 +廉屋 +廉岡 +廉嵎 +廉川 +廉林 +廉沢 +廉澤 +廉田 +廉谷 +廉野 +廉隅 +廐橋 +廓 +廚川 +廣 +廣丈 +廣上 +廣下 +廣世 +廣中 +廣久保 +廣亀 +廣井 +廣仲 +廣住 +廣佐古 +廣作 +廣保 +廣信 +廣元 +廣光 +廣兼 +廣内 +廣冨 +廣出 +廣利 +廣前 +廣勢 +廣升 +廣南 +廣原 +廣友 +廣口 +廣司 +廣吉 +廣和 +廣国 +廣國 +廣地 +廣坂 +廣垣 +廣城 +廣場 +廣塚 +廣増 +廣多 +廣奥 +廣子 +廣宇治 +廣安 +廣実 +廣宮 +廣富 +廣實 +廣小路 +廣尾 +廣居 +廣屋 +廣山 +廣岡 +廣岩 +廣峯 +廣峰 +廣島 +廣島屋 +廣崎 +廣嵜 +廣嶋 +廣嶌 +廣嶺 +廣嶼 +廣川 +廣布 +廣常 +廣幡 +廣幸 +廣底 +廣庭 +廣康 +廣廉 +廣延 +廣引 +廣恒 +廣恵 +廣惠 +廣戸 +廣房 +廣政 +廣方 +廣明 +廣木 +廣末 +廣本 +廣村 +廣東 +廣松 +廣林 +廣枝 +廣根 +廣梅 +廣森 +廣橋 +廣次 +廣正 +廣武 +廣歳 +廣段 +廣比 +廣氏 +廣永 +廣江 +廣池 +廣沢 +廣河 +廣沼 +廣波 +廣洞 +廣津 +廣津留 +廣浜 +廣浦 +廣海 +廣淵 +廣清 +廣渕 +廣渡 +廣滋 +廣滝 +廣澤 +廣濟 +廣濱 +廣瀧 +廣瀬 +廣狩 +廣猟 +廣理 +廣田 +廣町 +廣畑 +廣畝 +廣畠 +廣白 +廣盛 +廣目 +廣直 +廣石 +廣砂 +廣神 +廣端 +廣竹 +廣納 +廣経 +廣綱 +廣繁 +廣羽 +廣能 +廣脇 +廣船 +廣芝 +廣花 +廣芳 +廣芽 +廣苅 +廣若 +廣茂 +廣華 +廣葉 +廣藤 +廣行 +廣西 +廣見 +廣角 +廣谷 +廣貞 +廣賀 +廣越 +廣路 +廣辺 +廣辻 +廣近 +廣道 +廣邉 +廣邊 +廣郡 +廣部 +廣里 +廣重 +廣野 +廣金 +廣長 +廣門 +廣間 +廣阪 +廣陵 +廣隅 +廣隆 +廣飯 +廣高 +廣鰭 +廣鹿 +廬原 +廳 +延 +延下 +延与 +延井 +延元 +延兼 +延利 +延力 +延原 +延友 +延口 +延吉 +延味 +延命 +延命寺 +延国 +延國 +延地 +延坂 +延城 +延堂 +延塚 +延増 +延壽 +延壽堂 +延壽寺 +延安 +延対寺 +延寿 +延寿堂 +延寿寺 +延尺 +延尾 +延山 +延岡 +延島 +延崎 +延嶋 +延川 +延常 +延平 +延広 +延廣 +延形 +延方 +延日 +延明 +延時 +延木 +延末 +延本 +延札 +延村 +延東 +延松 +延次 +延正 +延武 +延永 +延江 +延沢 +延河 +延清 +延満 +延澤 +延片 +延生 +延田 +延籐 +延與 +延藤 +延谷 +延賀 +延足 +延輿 +延近 +延里 +延野 +延金 +延青 +廷 +廷々 +廷廷 +廹田 +廹野 +建 +建井 +建代 +建元 +建入 +建具 +建内 +建原 +建口 +建吉 +建城 +建壁 +建多 +建守 +建宮 +建家 +建尾 +建山 +建岡 +建岩 +建島 +建崎 +建嶋 +建川 +建平 +建徳 +建持 +建木 +建本 +建村 +建松 +建林 +建沼 +建田 +建畑 +建畠 +建矢 +建石 +建神 +建穂 +建脇 +建藤 +建見 +建貝 +建路 +建辺 +建道 +建部 +建野 +建風呂 +廻 +廻り道 +廻口 +廻尾 +廻川 +廻戸 +廻本 +廻淵 +廻渕 +廻田 +廻矢 +廻神 +廻立 +廻舩 +廻船 +廻角 +廻谷 +廻道 +廻野 +廻間 +廼島 +廽上 +廽谷 +廿 +廿千 +廿地 +廿日出 +廿日岩 +廿木屋 +廿枝 +廿楽 +廿樂 +廿浦 +廿野 +弁 +弁上 +弁天 +弁官 +弁崎 +弁木 +弁条 +弁森 +弁畑 +弁納 +弁谷 +弁野 +弁開 +弊 +弊次 +弋 +式 +式井 +式司 +式地 +式場 +式守 +式尾 +式居 +式島 +式嶋 +式庄 +式本 +式村 +式根 +式森 +式沢 +式澤 +式田 +式町 +式綱 +式見 +式谷 +式部 +式野 +弐又 +弐宮 +弐方 +弐月 +弐枚田 +弐百免 +弓 +弓下 +弓中 +弓井 +弓仲 +弓倉 +弓元 +弓先 +弓出 +弓削 +弓削多 +弓削夛 +弓削田 +弓勢 +弓北 +弓原 +弓取 +弓口 +弓地 +弓坂 +弓埜 +弓場 +弓場上 +弓場井 +弓場元 +弓塲 +弓家 +弓家田 +弓尾 +弓屋 +弓山 +弓岡 +弓島 +弓崎 +弓嶋 +弓川 +弓庄 +弓床 +弓座 +弓庭 +弓弦 +弓張 +弓戸 +弓手 +弓指 +弓掛 +弓木 +弓木田 +弓木野 +弓本 +弓束 +弓林 +弓桁 +弓樹 +弓武 +弓気多 +弓気田 +弓氣田 +弓永 +弓沢 +弓波 +弓浜 +弓渓 +弓溪 +弓澤 +弓濱 +弓瀬 +弓狩 +弓田 +弓町 +弓畑 +弓矢 +弓立 +弓納持 +弓能家 +弓良 +弓谷 +弓越 +弓達 +弓部 +弓野 +弓長 +弓間 +弓鳥 +引 +引原 +引又 +引口 +引土 +引地 +引坂 +引場 +引塲 +引字 +引宇根 +引寺 +引尻 +引尾 +引屋 +引屋敷 +引山 +引戸 +引持 +引敷林 +引方 +引木 +引本 +引村 +引橋 +引水 +引沼 +引波 +引浦 +引田 +引石 +引綱 +引網 +引落 +引藤 +引谷 +引象 +引越 +引辻 +引野 +引間 +引頭 +引馬 +弗田 +弗蘭 +弘 +弘下 +弘世 +弘中 +弘井 +弘仲 +弘保 +弘元 +弘光 +弘兼 +弘内 +弘利 +弘前 +弘原 +弘友 +弘吉 +弘国 +弘地 +弘埜 +弘奥 +弘宜 +弘実 +弘家 +弘實 +弘山 +弘岡 +弘岩 +弘島 +弘崎 +弘嶋 +弘川 +弘平谷 +弘政 +弘月 +弘末 +弘本 +弘松 +弘橋 +弘永 +弘沢 +弘法 +弘法堂 +弘津 +弘浜 +弘浦 +弘海 +弘澤 +弘瀬 +弘灰 +弘生 +弘田 +弘畑 +弘畠 +弘石 +弘種 +弘繁 +弘胤 +弘芝 +弘茂 +弘蔵 +弘藏 +弘藤 +弘西 +弘谷 +弘農 +弘部 +弘重 +弘野 +弘金 +弘長 +弘間 +弘高 +弟子 +弟子丸 +弟月 +弥三川 +弥三谷 +弥三須 +弥上 +弥中 +弥久保 +弥久刺 +弥久末 +弥五 +弥五郎丸 +弥代 +弥佐 +弥元 +弥六 +弥冨 +弥勒 +弥勒地 +弥勒寺 +弥勒院 +弥勤 +弥勤院 +弥十郎 +弥吉 +弥園 +弥城 +弥富 +弥山 +弥島 +弥崎 +弥川 +弥左 +弥常 +弥延 +弥忠田 +弥政 +弥本 +弥村 +弥栄 +弥森 +弥武 +弥氏 +弥永 +弥浦 +弥源治 +弥生 +弥田 +弥登 +弥益 +弥石 +弥納 +弥藤 +弥蛇山 +弥谷 +弥郡 +弥重 +弥野 +弥録 +弥長 +弥陀 +弥頭 +弦 +弦井 +弦元 +弦切 +弦卷 +弦岡 +弦嶋 +弦川 +弦巻 +弦弓 +弦念 +弦木 +弦本 +弦桐 +弦橋 +弦牧 +弦田 +弦谷 +弦間 +弧塚 +弧山 +弧崎 +弧杉 +弧松 +弭間 +張 +張ケ井 +張ケ代 +張ケ谷 +張丁 +張丘 +張久 +張井 +張元 +張光 +張原 +張口 +張吉 +張堂 +張場 +張富 +張尾 +張山 +張山沢 +張山澤 +張岡 +張岳 +張島 +張崎 +張川 +張戸 +張摩 +張替 +張木 +張本 +張村 +張林 +張永 +張江 +張沢 +張渕 +張田 +張田谷 +張真 +張矢 +張石 +張磨 +張篭 +張籠 +張能 +張西 +張谷 +張貝 +張迫 +張道 +張野 +張間 +強 +強力 +強口 +強崎 +強瀬 +強田 +強矢 +強谷 +弾 +弾塚 +弾正 +弾正原 +弾野原 +彈塚 +彈正原 +彈野原 +彌 +彌三川 +彌中 +彌久保 +彌久末 +彌五郎丸 +彌元 +彌八 +彌六 +彌冨 +彌勒 +彌勒地 +彌勒寺 +彌吉 +彌園 +彌城 +彌富 +彌山 +彌島 +彌左 +彌常 +彌延 +彌政 +彌本 +彌栄 +彌榮 +彌武 +彌永 +彌源治 +彌生 +彌田 +彌益 +彌重 +彌野 +彌録 +当 +当マ +当代 +当仲 +当住 +当作 +当六 +当具 +当内 +当別当 +当利 +当前 +当原 +当喜 +当坂 +当城 +当堂 +当天 +当宮 +当寺ケ盛 +当寺河 +当寺盛 +当尊 +当山 +当岐 +当島 +当嶋 +当川 +当广 +当座 +当房 +当所 +当摩 +当新 +当時 +当時久保 +当時盛 +当木 +当本 +当村 +当林 +当森 +当正 +当毛 +当江 +当波 +当津 +当流谷 +当瀬 +当田 +当目 +当眞 +当真 +当磨 +当舎 +当谷 +当道 +当郷 +当重 +当野 +当野坂 +当金 +当銀 +当銘 +当間 +当馬 +当麻 +形 +形上 +形井 +形倉 +形切 +形原 +形地 +形埜 +形屋 +形山 +形岡 +形川 +形幅 +形木原 +形本 +形村 +形柳 +形浦 +形田 +形石 +形神 +形福 +形舞 +形見 +形谷 +形部 +形野 +形鍬 +彦 +彦エ +彦ノ上 +彦ヱ +彦上 +彦久保 +彦井 +彦凪 +彦出 +彦前 +彦坂 +彦山 +彦島 +彦川 +彦工 +彦惣 +彦本 +彦枝 +彦根 +彦森 +彦次 +彦江 +彦沢 +彦瀬 +彦田 +彦由 +彦竹 +彦素 +彦谷 +彦路 +彦部 +彦野 +彦間 +彦阪 +彦面 +彩 +彩木 +彩田 +彫谷 +彬山 +彭城 +影 +影下 +影中 +影久 +影井 +影佐 +影信 +影元 +影内 +影原 +影吉 +影向 +影土井 +影地 +影安 +影居 +影山 +影岡 +影島 +影嶋 +影川 +影平 +影広 +影廣 +影戸 +影日 +影木 +影末 +影本 +影松 +影林 +影森 +影正 +影沢 +影治 +影沼沢 +影沼澤 +影洞 +影浦 +影澤 +影田 +影田久保 +影畑 +影目 +影矢 +影石 +影行 +影裡 +影谷 +影路 +影近 +影野 +影長 +役 +役山 +役川 +役末 +役田 +役谷 +役重 +役野 +彼ノ矢 +彼塚 +彼宗 +彼島 +彼崎 +彼川 +彼方 +彼末 +彼杵 +彼谷 +往下 +往住 +往光 +往友 +往古 +往安 +往岸 +往本 +往田 +往蔵 +往藏 +往西 +往見 +往谷 +往長 +往陸 +往頼 +征矢 +征矢野 +征録 +徂徠 +徃住 +徃光 +徃友 +徃安 +徃本 +徃田 +徃藏 +徃西 +徃見 +徃陸 +徃頼 +待井 +待元 +待合 +待場 +待夜 +待寺 +待山 +待岡 +待島 +待嶋 +待川 +待木 +待本 +待水 +待永 +待田 +待谷 +待野 +待鳥 +後 +後々 +後々田 +後ケ沢 +後ケ澤 +後ノ上 +後一 +後丁 +後上 +後上里 +後下門 +後世 +後中 +後中田 +後久 +後久保 +後井 +後仲筋 +後仲舛 +後仲門 +後伊 +後内 +後冨底 +後出 +後分 +後前 +後北 +後原 +後反 +後反田 +後口 +後口寺 +後呂 +後呂岡 +後和 +後喜多 +後喜田 +後地 +後坂 +後坊 +後垣 +後垣内 +後城 +後埜上 +後堂 +後士 +後夷 +後守 +後安 +後安里 +後宝 +後宮 +後家山 +後富村 +後小橋川 +後小路 +後尾 +後居 +後屋敷 +後山 +後岡 +後島 +後嵩西 +後嶋 +後川 +後川花 +後工田 +後平 +後幸 +後庵 +後庵野 +後延 +後弓 +後引 +後当 +後戸 +後房 +後日 +後明 +後木 +後本 +後村 +後条 +後東 +後松 +後根 +後案 +後條 +後梶谷 +後極 +後檀 +後水流 +後沢 +後河 +後河内 +後河原 +後泻 +後浜 +後浜門 +後溝 +後潟 +後澤 +後濱 +後濱門 +後瀉 +後瀬 +後燈明 +後生川 +後田 +後田多 +後田盛 +後町 +後界 +後畑 +後畠 +後當 +後登 +後白 +後盛 +後眞地 +後真地 +後石原 +後神 +後神村 +後福 +後竹 +後等 +後籐 +後給 +後舍 +後舎 +後芝 +後蔵根 +後藤 +後藤橋 +後藤田 +後親田 +後記 +後調 +後谷 +後賀田 +後路 +後辺 +後迫 +後道 +後遠田 +後部 +後郷 +後醍院 +後野 +後野木 +後釜 +後長 +後門 +後閑 +後間 +後関 +後飯塚 +後馬場 +後鳥 +徐山 +徐松 +徐水 +徐田 +徐福 +従二 +従二谷 +従野 +従金 +従長 +得 +得上 +得中 +得丸 +得井 +得光 +得冨 +得利 +得力 +得原 +得可主 +得地 +得字 +得富 +得居 +得山 +得岡 +得島 +得嶋 +得川 +得平 +得政 +得本 +得村 +得松 +得楽 +得永 +得沢 +得津 +得猪 +得田 +得知 +得竹 +得納 +得能 +得草 +得藤 +得重 +得野 +得間 +從二 +從野 +從長 +御上 +御世梅 +御中 +御井 +御代 +御代出 +御代川 +御代田 +御代谷 +御任 +御供 +御供井 +御供所 +御供田 +御倉 +御共 +御内 +御処野 +御前 +御勢 +御原 +御厨 +御厩 +御厩園 +御厩敷 +御友 +御古 +御合 +御喜 +御喜家 +御喜田 +御器 +御器谷 +御囲 +御園 +御園井 +御園生 +御地合 +御坊 +御坊前 +御坊田 +御坊谷 +御城 +御堀 +御堂 +御堂丸 +御堂前 +御堂地 +御堂岡 +御堂島 +御堂河内 +御堂開地 +御場瀬 +御塚 +御塩 +御姓 +御子 +御子川内 +御子柴 +御子神 +御子芝 +御子貝 +御守 +御室 +御宮司 +御宮寺 +御宮知 +御家 +御家瀬 +御宿 +御小柴 +御屋敷 +御山 +御岳 +御崎 +御嵜 +御嶽 +御川 +御巫 +御幡 +御幣 +御幸 +御幸尾 +御庄 +御床 +御座 +御座岡 +御庭 +御廉納 +御廐 +御廐敷 +御建 +御影 +御影池 +御後 +御所 +御所名 +御所園 +御所窪 +御所脇 +御所谷 +御所野 +御手水 +御手洗 +御手洗屋 +御播 +御旅屋 +御旗 +御明 +御書 +御木 +御木本 +御本 +御村 +御林 +御栗 +御橋 +御正 +御正山 +御武内 +御殿谷 +御母衣 +御氏川 +御江 +御池 +御沓 +御沖 +御沢 +御油 +御法 +御法川 +御滝 +御澤 +御牧 +御獄 +御田 +御田寺 +御田村 +御畑 +御盥 +御着 +御石 +御神本 +御神村 +御福 +御秡如 +御立 +御立田 +御竿 +御笹 +御筆 +御簗 +御簾 +御簾納 +御簾野 +御籏 +御糀 +御給 +御縁 +御縞 +御纏 +御纒 +御興 +御舘 +御舘田 +御舟 +御舩 +御船 +御船谷 +御苑 +御苗 +御茶屋 +御荘 +御菩薩木 +御菩薩池 +御蔵 +御薗 +御薗生 +御薬袋 +御藏 +御藤 +御蘭生 +御處野 +御蛇本 +御角 +御調 +御護守 +御賀多 +御輿 +御辺 +御邊 +御郷 +御都山 +御酒本 +御野 +御鍵 +御門 +御雲 +御須 +御領 +御領原 +御領園 +御館 +御馬舎 +御魚谷 +御鱗 +御鳴 +徤名 +復井 +復光 +復本 +循林 +微笑 +徳 +徳ケ崎 +徳一 +徳万 +徳三 +徳上 +徳下 +徳世 +徳丘 +徳並 +徳中 +徳丸 +徳久 +徳久阪 +徳予 +徳井 +徳住 +徳佐 +徳佐屋 +徳佐田 +徳保 +徳倉 +徳備 +徳元 +徳光 +徳内 +徳冨 +徳利 +徳前 +徳力 +徳勝 +徳勢 +徳千代 +徳升 +徳南 +徳原 +徳吉 +徳名 +徳味 +徳和 +徳和目 +徳善 +徳図 +徳園 +徳土 +徳地 +徳地屋 +徳地谷 +徳坂 +徳垣 +徳城 +徳埜 +徳堂 +徳増 +徳多 +徳大寺 +徳大路 +徳奈賀 +徳好 +徳守 +徳安 +徳宗 +徳実 +徳宮 +徳家 +徳宿 +徳寄 +徳富 +徳寺 +徳小田 +徳尾 +徳尾野 +徳居 +徳屋 +徳山 +徳岡 +徳岩 +徳岳 +徳峯 +徳峰 +徳島 +徳崎 +徳嵜 +徳嵩 +徳嶋 +徳嶌 +徳嶺 +徳嶽 +徳川 +徳差 +徳市 +徳常 +徳平 +徳広 +徳庄 +徳座 +徳庵 +徳廣 +徳弘 +徳応 +徳應 +徳成 +徳持 +徳政 +徳方 +徳日 +徳明 +徳月 +徳木 +徳末 +徳本 +徳村 +徳松 +徳林 +徳枡 +徳根 +徳桝 +徳梅 +徳森 +徳植 +徳楠 +徳楽 +徳槁 +徳樂 +徳橋 +徳次 +徳正 +徳武 +徳比嘉 +徳毛 +徳水 +徳永 +徳江 +徳沢 +徳河 +徳治 +徳泉 +徳波 +徳津 +徳浜 +徳浦 +徳浩 +徳浪 +徳海 +徳淵 +徳添 +徳清 +徳渕 +徳満 +徳滿 +徳澄 +徳澤 +徳濱 +徳瀬 +徳炭 +徳照 +徳物 +徳王 +徳王丸 +徳珍 +徳生 +徳用 +徳田 +徳畑 +徳留 +徳益 +徳盛 +徳矢 +徳知 +徳石 +徳礼 +徳禮 +徳稲 +徳穂 +徳積 +徳竹 +徳納 +徳網 +徳繁 +徳織 +徳美 +徳義 +徳能 +徳脇 +徳臣 +徳舛 +徳良 +徳若 +徳茂 +徳萬 +徳蔵 +徳藏 +徳藤 +徳行 +徳衛 +徳西 +徳見 +徳角 +徳谷 +徳豫 +徳貞 +徳賀 +徳迫 +徳連 +徳道 +徳邑 +徳部 +徳里 +徳重 +徳野 +徳野本 +徳金 +徳長 +徳門 +徳間 +徳高 +徴 +徹 +徹島 +徹辺 +徹邊 +心光 +心山 +心斉 +心王院 +心石 +忌部 +忍 +忍久保 +忍出 +忍垂 +忍山 +忍峽 +忍崎 +忍川 +忍成 +忍沢 +忍海辺 +忍海邊 +忍海部 +忍澤 +忍田 +忍穂 +忍穂井 +忍穗 +忍見 +忍谷 +忍賀 +忍足 +忍関 +忍頂寺 +志 +志々場 +志々岐 +志々木 +志々田 +志々目 +志々見 +志万 +志並 +志丸 +志久 +志久保 +志久内 +志久間 +志井 +志井田 +志伊 +志伊礼 +志伊良 +志伯 +志位 +志佐 +志佐池 +志佳摩 +志保 +志保井 +志保入 +志保原 +志保山 +志保川 +志保沢 +志保澤 +志保田 +志保石 +志保見 +志保谷 +志保野 +志俵 +志倉 +志儀 +志免 +志免木 +志内 +志冨 +志冨田 +志冶 +志出 +志勇 +志原 +志受 +志和 +志和久 +志和地 +志和屋 +志和山 +志和木 +志和村 +志和橋 +志和池 +志和知 +志喜 +志喜屋 +志土地 +志土富 +志坪 +志垣 +志埜 +志堂寺 +志堅原 +志場 +志塚 +志多 +志多伯 +志多木 +志多田 +志多野 +志太 +志太波 +志奈 +志奥 +志女木 +志子 +志子田 +志字 +志学 +志學 +志宇知 +志宮 +志家 +志富 +志富田 +志寒 +志寿 +志尊 +志小田 +志尾 +志尾崎 +志尾本 +志尾田 +志山 +志岐 +志岐内 +志崎 +志川 +志市 +志布 +志布志 +志師本 +志平 +志幸 +志广 +志度 +志度沢 +志度谷 +志形 +志後野迫 +志志目 +志慶眞 +志慶真 +志戸 +志戸前 +志戸岡 +志戸摩 +志戸本 +志戸田 +志手 +志手盛 +志摩 +志摩井 +志摩村 +志摩田 +志摩邑 +志斉 +志斎 +志方 +志明野 +志智 +志月 +志木内 +志木田 +志本 +志村 +志条 +志柿 +志森 +志楽 +志次 +志武 +志母谷 +志比 +志比奈 +志比川 +志比田 +志毛 +志民 +志気 +志氣 +志水 +志水口 +志沢 +志治 +志泉 +志波 +志波原 +志洞 +志津 +志津利 +志津城 +志津川 +志津木 +志津田 +志津里 +志津野 +志津間 +志津馬 +志浦 +志浪 +志済 +志渡 +志渡岡 +志渡沢 +志渡澤 +志満 +志満津 +志潟 +志澤 +志濃原 +志濟 +志熊 +志牟田 +志生野 +志甫 +志甫木 +志甫津 +志甫谷 +志田 +志田上 +志田原 +志田尾 +志田山 +志田岡 +志田藤 +志田野 +志白 +志目 +志目田 +志直 +志真 +志知 +志知島 +志磨 +志磨村 +志礼 +志礼田 +志社 +志禮 +志禮田 +志穂 +志積 +志窪 +志立 +志筑 +志築 +志籐 +志紀 +志羅 +志羅山 +志美津 +志羽 +志羽久 +志自岐 +志舩 +志船 +志良 +志良以 +志良堂 +志苫 +志茂 +志茂坂 +志茂山 +志茂田 +志茂野 +志萱 +志葉 +志葉木 +志藤 +志行 +志見 +志観寺 +志記 +志谷 +志豆機 +志貴 +志賀 +志賀久 +志賀原 +志賀口 +志賀崎 +志賀村 +志賀松 +志賀江 +志賀浦 +志賀浪 +志賀谷 +志賀野 +志路 +志農 +志辺 +志連 +志道 +志達 +志邑 +志邨 +志部 +志部谷 +志都 +志野 +志野原 +志野崎 +志野木 +志野村 +志釜 +志鎌 +志間 +志間村 +志関 +志風 +志食 +志馬 +志馬田 +志鳥 +志鶴 +志鷹 +志鹿 +志麻 +志齊 +志齋 +応供 +応儀 +応利 +応前 +応原 +応和 +応地 +応地峯 +応地峰 +応家 +応崎 +応川 +応平 +応後 +応戸 +応手 +応本 +応武 +応永 +応江 +応沢 +応治 +応海 +応潟 +応田 +応矢 +応葉 +応藤 +応西 +応請 +応谷 +応野 +応長 +忠 +忠井 +忠住 +忠保 +忠信 +忠内 +忠原 +忠地 +忠垣 +忠女 +忠尾 +忠山 +忠岡 +忠島 +忠嶋 +忠平 +忠恵 +忠政 +忠木 +忠末 +忠本 +忠村 +忠永 +忠沢 +忠津 +忠海 +忠澤 +忠瀬 +忠田 +忠石 +忠縄 +忠繩 +忠藤 +忠見 +忠谷 +忠貞 +忠重 +忠野 +忠鉢 +忠隈 +忠願寺 +快勝院 +快楽 +忰山 +忰熊 +忰田 +忰部 +念介 +念仏 +念代 +念佛 +念冶 +念垣 +念平 +念張 +念沢 +念治 +念澤 +忽戸 +忽滑谷 +忽那 +怒 +怒和 +怒木 +怒田 +怒留湯 +怒谷 +怒賀 +思 +思井 +思坊田 +思川 +思田 +怡土 +怡田 +急式 +性全 +性海 +性田 +怱滑谷 +怱那 +恋中 +恋口 +恋塚 +恋川 +恋木 +恋本 +恋水 +恋河内 +恋淵 +恋渕 +恋田 +恋野 +恐田 +恐神 +恒 +恒久 +恒任 +恒住 +恒儀 +恒元 +恒光 +恒冨 +恒原 +恒友 +恒吉 +恒国 +恒國 +恒安 +恒宮 +恒富 +恒屋 +恒岡 +恒崎 +恒川 +恒広 +恒廣 +恒弘 +恒成 +恒木 +恒末 +恒本 +恒村 +恒松 +恒枝 +恒森 +恒次 +恒永 +恒河 +恒田 +恒益 +恒盛 +恒矢 +恒石 +恒籐 +恒良 +恒藤 +恒行 +恒見 +恒谷 +恒賀 +恒遠 +恣岡 +恩 +恩井 +恩仲寺 +恩地 +恩塚 +恩多 +恩崎 +恩川 +恩幣 +恩庄 +恩徳 +恩慈 +恩房 +恩智 +恩曽 +恩曾 +恩本 +恩村 +恩氏 +恩沢 +恩河 +恩津 +恩海 +恩澤 +恩田 +恩知 +恩穂井 +恩穗井 +恩納 +恩蔵 +恩藏 +恩藤 +恩谷 +恩賀 +恩道 +恩部 +恩重 +恩馬 +恭林 +息 +息戈 +息才 +息栖 +息田 +息野 +息長 +恰 +恵 +恵上 +恵下 +恵下田 +恵中 +恵井 +恵京 +恵元 +恵免 +恵内 +恵利 +恵利川 +恵南 +恵原 +恵口 +恵古 +恵味名 +恵喜 +恵喜名 +恵土 +恵坂 +恵多谷 +恵守 +恵宝 +恵山 +恵島 +恵崎 +恵嶋 +恵川 +恵帳塚 +恵平 +恵後原 +恵志 +恵我 +恵戸 +恵方谷 +恵日 +恵明 +恵星 +恵智 +恵木 +恵木本 +恵本 +恵村 +恵来 +恵林 +恵柳 +恵森 +恵比 +恵比原 +恵比名 +恵比壽 +恵比奈 +恵比寿 +恵比志 +恵比木 +恵比根 +恵比沢 +恵比澤 +恵比須 +恵沢 +恵泉 +恵波 +恵津 +恵津森 +恵澤 +恵濃 +恵田 +恵畑 +恵福 +恵納 +恵紙 +恵羅 +恵美 +恵美奈 +恵美酒 +恵美須 +恵美須屋 +恵良 +恵良本 +恵良田 +恵花 +恵茂田 +恵荘 +恵藤 +恵西 +恵見 +恵谷 +恵賀 +恵遍主 +恵郷 +恵野 +恵野木 +恵野村 +恵長塚 +恵阪 +恵面 +恵須川 +恵飛須 +恵鶴 +悉地 +悉知 +悉陀 +悌 +悟川 +悟道 +悠木 +悦 +悦内 +悦勝 +悦喜 +悦宗 +悦家 +悦居 +悦岡 +悦方 +悦木 +悦本 +悦永 +悦淵 +悦渕 +悦田 +悦見 +悦覟 +悦過 +悦道 +悦野 +悪七 +悪原 +悪戸 +悪沢 +悪澤 +悪虫 +悲佐田 +悳 +悳埼 +悳山 +悴山 +悴田 +情 +情家 +情島 +情野 +惟 +惟任 +惟住 +惟子 +惟康 +惟村 +惟永 +惟高 +惠 +惠上 +惠下 +惠下田 +惠中 +惠井 +惠京 +惠免 +惠内 +惠利川 +惠南 +惠原 +惠口 +惠古 +惠土 +惠多谷 +惠守 +惠山 +惠島 +惠崎 +惠嶋 +惠川 +惠平 +惠後原 +惠星 +惠木 +惠本 +惠村 +惠森 +惠比 +惠比原 +惠比壽 +惠比寿 +惠比根 +惠比澤 +惠比須 +惠波 +惠津森 +惠澤 +惠濃 +惠田 +惠畑 +惠籐 +惠納 +惠羅 +惠美 +惠美酒 +惠美須 +惠美須屋 +惠良 +惠良田 +惠花 +惠茂田 +惠荘 +惠藤 +惠見 +惠谷 +惠阪 +惠面 +惠飛須 +惣万 +惣上分 +惣中 +惣之代 +惣代 +惣伊田 +惣佐 +惣元 +惣光 +惣八 +惣内 +惣出 +惣則 +惣前 +惣卜 +惣原 +惣口 +惣台 +惣司 +惣名 +惣向 +惣土 +惣坊 +惣城 +惣埜 +惣塚 +惣多 +惣宇利 +惣守 +惣定 +惣山 +惣島 +惣崎 +惣川 +惣市 +惣引 +惣慶 +惣戸 +惣明 +惣木 +惣本 +惣村 +惣林坊 +惣楽 +惣樂 +惣次 +惣水 +惣江 +惣洞 +惣津 +惣浜 +惣田 +惣田畑 +惣田谷 +惣畑 +惣石 +惣福 +惣福脇 +惣脇 +惣臺 +惣萬 +惣蔵 +惣藏 +惣藤 +惣角 +惣谷 +惣賀 +惣路 +惣輪 +惣道 +惣那 +惣部 +惣郷 +惣野 +惣野代 +惣門 +惣間 +惣附 +惣領 +惣馬 +想 +想厨子 +想本 +想田 +想都 +意元 +意加美 +意島 +意嶋 +意東 +意真 +愚川 +愛 +愛上 +愛下 +愛久沢 +愛久澤 +愛内 +愛原 +愛合 +愛地 +愛坪 +愛垣 +愛場 +愛多地 +愛子 +愛宕 +愛宮 +愛尾 +愛屋 +愛山 +愛島 +愛川 +愛州 +愛徳 +愛教 +愛敬 +愛新 +愛日 +愛智 +愛月 +愛木 +愛村 +愛染 +愛橋 +愛水 +愛江田 +愛沢 +愛沼 +愛波 +愛津 +愛洲 +愛清 +愛澤 +愛瀬 +愛田 +愛甲 +愛知 +愛知後 +愛葉 +愛谷 +愛路 +愛野 +愛須 +感応 +感応寺 +感應 +感應寺 +感王寺 +感見 +愼改 +愼次 +愼澤 +愼野 +愿山 +愿田 +慈 +慈光寺 +慈地 +慈幸 +慈性 +慈氏 +慈父田 +慈眼 +慈耆 +慈観 +慈道 +慎城 +慎尾 +慎山 +慎改 +慎本 +慎次 +慎田 +慎野 +慧善 +慧嶽 +慧本 +慶 +慶上 +慶世村 +慶久 +慶井 +慶伊 +慶佐次 +慶保 +慶元 +慶光院 +慶児 +慶兒 +慶原 +慶塚 +慶増 +慶家 +慶寺 +慶尾 +慶山 +慶島 +慶崎 +慶川 +慶広 +慶廣 +慶徳 +慶木 +慶本 +慶村 +慶松 +慶林坊 +慶森 +慶楽 +慶永 +慶澤 +慶田 +慶田元 +慶田城 +慶田嵩 +慶田本 +慶田盛 +慶田花 +慶留間 +慶祐 +慶祥 +慶福 +慶秀 +慶籐 +慶納 +慶藤 +慶裕 +慶西 +慶見 +慶谷 +慶越 +慶野 +慶金 +慶長 +慶雲寺 +慶馬 +憑子 +憲 +懈良 +應供 +應儀 +應利 +應原 +應和 +應地 +應地峯 +應家 +應崎 +應平 +應後 +應戸 +應手 +應本 +應武 +應永 +應治 +應泻 +應潟 +應澤 +應田 +應矢 +應西 +應谷 +應長 +懐 +懸 +懸上 +懸場 +懸尾 +懸山 +懸岸 +懸島 +懸崎 +懸川 +懸戸 +懸本 +懸林 +懸樋 +懸橋 +懸田 +懸谷 +懸野 +懸野崎 +懸高 +戀中 +戀塚 +戀川 +戀木 +戀水 +戀河内 +戀田 +戀野 +戈 +戈ノ元 +戈宮 +戈川 +戈木 +戈本 +戈津 +戈田 +戈良 +戈賀 +戈野谷 +戊亥 +戌丸 +戌井 +戌亥 +戌徳 +戌爪 +戌角 +戌谷 +戍丸 +戍亥 +戍徳 +戎 +戎下 +戎丸屋 +戎井 +戎原 +戎吉 +戎堀 +戎子 +戎家 +戎居 +戎屋 +戎岡 +戎島 +戎崎 +戎嶋 +戎木 +戎末 +戎本 +戎森 +戎池 +戎浦 +戎湯 +戎田 +戎矢 +戎能 +戎脇 +戎藤 +戎谷 +戎野 +成 +成ケ沢 +成ケ澤 +成上 +成世 +成中 +成久 +成之坊 +成井 +成京 +成伯 +成住 +成保 +成元 +成光 +成兼 +成内 +成冨 +成出 +成利 +成勢 +成原 +成友 +成合 +成吉 +成味 +成和 +成国 +成國 +成地 +成城 +成塚 +成増 +成好 +成子 +成守 +成安 +成宗 +成定 +成実 +成宮 +成家 +成富 +成實 +成尾 +成山 +成岡 +成岩 +成島 +成崎 +成嶋 +成嶌 +成川 +成平 +成広 +成底 +成廣 +成影 +成徳 +成恒 +成戸 +成房 +成政 +成方 +成時 +成智 +成木 +成末 +成本 +成村 +成東 +成松 +成林 +成枝 +成栗 +成楽 +成橋 +成次 +成毛 +成水 +成永 +成江 +成沢 +成河 +成津 +成浦 +成海 +成清 +成満 +成滝 +成澤 +成瀧 +成瀬 +成生 +成田 +成畑 +成登 +成相 +成矢 +成石 +成神 +成竹 +成等 +成繁 +成美 +成美本 +成羽 +成舞 +成良 +成茂 +成藤 +成行 +成見 +成谷 +成豊 +成貞 +成輪 +成迫 +成道 +成里 +成重 +成野 +成長 +成阪 +成願 +成高 +我久 +我伊野 +我原 +我喜屋 +我堂 +我如古 +我妻 +我孫子 +我山 +我戸 +我有 +我毛 +我沢 +我満 +我滿 +我澤 +我生 +我科 +我舞 +我舞谷 +我藤 +我蛭 +我謝 +我谷 +我那覇 +我部 +我部山 +我野 +我間 +戒井 +戒外 +戒田 +戒能 +戒谷 +戒重 +戒野 +戛山 +戝川 +戝木 +戝津 +戝満 +戝田 +戝部 +戟 +戦場 +戸 +戸ケ崎 +戸ケ嵜 +戸ケ沢 +戸ケ瀬 +戸ケ里 +戸ノ下 +戸ノ内 +戸ノ岡 +戸ノ崎 +戸ノ本 +戸ノ部 +戸上 +戸下 +戸並 +戸中 +戸丸 +戸久世 +戸久河 +戸之内 +戸之口 +戸之洞 +戸亀 +戸井 +戸井原 +戸井口 +戸井崎 +戸井川 +戸井本 +戸井永 +戸井津 +戸井田 +戸井詰 +戸井間 +戸代 +戸代原 +戸代沢 +戸代澤 +戸代谷 +戸仲 +戸伏 +戸住 +戸佐 +戸佐間 +戸來 +戸保家 +戸倉 +戸倉川 +戸借 +戸光 +戸入 +戸兵 +戸内 +戸円 +戸出 +戸切 +戸刈 +戸刺 +戸前 +戸加里 +戸北 +戸匹 +戸原 +戸取 +戸口 +戸口田 +戸台 +戸叶 +戸司 +戸合 +戸名 +戸向 +戸和 +戸咲 +戸国 +戸國 +戸圓 +戸土 +戸地 +戸坂 +戸垣 +戸城 +戸埜村 +戸堀 +戸堂 +戸堅 +戸場 +戸塚 +戸増 +戸壽 +戸奈 +戸奈尾 +戸好 +戸子台 +戸子田 +戸子臺 +戸子薹 +戸守 +戸定 +戸室 +戸宮 +戸家 +戸寿 +戸小台 +戸小尾 +戸尻 +戸尾 +戸屋 +戸山 +戸岐 +戸島 +戸崎 +戸嵜 +戸嶋 +戸嶌 +戸川 +戸川屋 +戸巻 +戸市 +戸幡 +戸平 +戸床 +戸座間 +戸庭 +戸延 +戸引 +戸張 +戸恒 +戸成 +戸所 +戸手 +戸掛 +戸摩 +戸政 +戸敷 +戸方 +戸早 +戸明 +戸星 +戸曽 +戸曾 +戸木 +戸木田 +戸本 +戸杉 +戸村 +戸来 +戸松 +戸板 +戸林 +戸枝 +戸柏 +戸柱 +戸栗 +戸根 +戸根山 +戸根川 +戸根木 +戸根谷 +戸梶 +戸森 +戸構 +戸樋 +戸樋谷 +戸樫 +戸橋 +戸次 +戸毛 +戸水 +戸永 +戸江 +戸沢 +戸河 +戸河里 +戸治野 +戸沼 +戸泉 +戸波 +戸津 +戸津井 +戸津崎 +戸津川 +戸浦 +戸浪 +戸清 +戸渡 +戸澗 +戸澤 +戸瀬 +戸瀬川 +戸熊 +戸牧 +戸狩 +戸玉 +戸田 +戸田代 +戸田山 +戸田岸 +戸田川 +戸田沢 +戸田澤 +戸由 +戸町 +戸畑 +戸登 +戸真伊 +戸矢 +戸矢埼 +戸矢崎 +戸知 +戸知谷 +戸石 +戸石川 +戸破 +戸神 +戸祢 +戸祭 +戸禰 +戸端 +戸笈 +戸笹 +戸篠 +戸簾 +戸納 +戸納瀬 +戸継 +戸練 +戸羽 +戸耒 +戸肥 +戸能 +戸脇 +戸臺 +戸舍 +戸舎 +戸舘 +戸花 +戸苅 +戸草 +戸草内 +戸葉 +戸蒔 +戸蔵 +戸藏 +戸藤 +戸袋 +戸西 +戸見 +戸見山 +戸見嶋 +戸設 +戸諸 +戸谷 +戸谷塚 +戸谷川 +戸谷沢 +戸谷澤 +戸谷田 +戸貝 +戸貴田 +戸賀 +戸賀崎 +戸賀沢 +戸賀澤 +戸賀瀬 +戸賀里 +戸越 +戸軽 +戸辺 +戸邉 +戸邊 +戸邨 +戸部 +戸部田 +戸郷 +戸野 +戸野倉 +戸野原 +戸野口 +戸野塚 +戸野川 +戸野広 +戸野廣 +戸野本 +戸野村 +戸野田 +戸野谷 +戸野辺 +戸野部 +戸金 +戸鋪 +戸鎖 +戸長 +戸門 +戸開 +戸間 +戸間替 +戸阪 +戸階 +戸隠 +戸雲 +戸鞠 +戸頃 +戸須 +戸須田 +戸風 +戸館 +戸馬田 +戸高 +戸鳴 +戸鹿島 +戸鹿里 +戸鹿野 +戸黒 +戸鼻 +房 +房光 +房内 +房出 +房前 +房原 +房友 +房園 +房地 +房垣 +房安 +房宗 +房家 +房富 +房尾 +房山 +房岡 +房崎 +房川 +房州 +房常 +房延 +房木 +房本 +房村 +房松 +房林 +房枝 +房永 +房洲 +房田 +房登 +房立 +房薗 +房谷 +房野 +房間 +所 +所久保 +所付 +所代 +所古 +所司 +所司原 +所垣内 +所埜 +所山 +所崎 +所嵜 +所川 +所方 +所村 +所沢 +所河 +所澤 +所田 +所畑 +所神根 +所谷 +所賀 +所開地 +所附 +扇 +扇一 +扇下 +扇久保 +扇元 +扇内 +扇割 +扇原 +扇喜 +扇園 +扇塚 +扇増 +扇子 +扇屋 +扇山 +扇島 +扇崎 +扇平 +扇成 +扇本 +扇松 +扇柳 +扇橋 +扇殿 +扇沢 +扇浦 +扇澤 +扇玉 +扇田 +扇畑 +扇石 +扇能 +扇舎 +扇芝 +扇薗 +扇藤 +扇谷 +扇迫 +扇野 +扇間 +扈山 +手下 +手串 +手丸 +手井 +手代 +手代木 +手代森 +手仲 +手倉 +手倉森 +手光 +手原 +手取 +手取屋 +手口 +手古 +手合 +手向 +手呂内 +手坂 +手垂 +手城 +手塚 +手墳 +手子 +手室 +手小 +手尾 +手山 +手島 +手島野 +手崎 +手嶋 +手嶋野 +手嶌 +手川 +手平 +手戸 +手打 +手拜 +手拝 +手持 +手捲 +手操 +手月 +手木 +手束 +手林 +手柄 +手柳 +手柴 +手桑 +手槌 +手水 +手水川 +手沢 +手洗 +手渡 +手澤 +手町 +手登根 +手皮 +手石 +手石方 +手科 +手穂 +手簑 +手納 +手綱 +手縄 +手繰 +手老 +手良向 +手良村 +手良脇 +手良西 +手蓑 +手見野 +手角 +手計 +手谷 +手貝 +手賀 +手越 +手跡 +手辺 +手邉 +手邊 +手野 +手野根 +手金 +手銭 +手錢 +手間 +手間本 +手面 +手鹿 +才 +才ノ元 +才ノ内 +才ノ平 +才ノ木 +才ノ本 +才ノ神 +才一 +才上 +才下 +才丸 +才之内 +才之神 +才保 +才元 +才光 +才兼 +才内 +才力 +才加志 +才勝 +才原 +才口 +才名園 +才善 +才園 +才場 +才塚 +才守 +才宮 +才寺 +才尾 +才岡 +才峠 +才島 +才崎 +才川 +才巻 +才市 +才式 +才念 +才戸 +才所 +才揖 +才料 +才新 +才智 +才木 +才本 +才村 +才松 +才林 +才気 +才沢 +才治 +才津 +才津原 +才満 +才澤 +才無佐 +才無左 +才田 +才畑 +才目 +才知 +才神 +才福 +才穂 +才竹 +才納 +才能 +才脇 +才花 +才茂 +才荷 +才藤 +才見 +才記 +才谷 +才賀 +才賀屋 +才賀崎 +才辻 +才迫 +才郷 +才野 +才野原 +才野木 +才野瀬 +才門 +才間 +才雁 +才須 +才頭 +才願 +才馬 +才高 +才鴈 +打ケ口 +打上 +打井 +打会 +打保 +打出 +打出谷 +打合 +打味 +打和 +打土井 +打地 +打坂 +打垣内 +打它 +打宅 +打尾 +打屋 +打山 +打川 +打座 +打抜 +打揚 +打方 +打明 +打會 +打木 +打本 +打村 +打林 +打桐 +打桜 +打樋 +打橋 +打櫻 +打江 +打波 +打浪 +打海 +打猶 +打田 +打田内 +打矢 +打綿 +打良木 +打荻 +打藁 +打見 +打訳 +打詰 +打譯 +打谷 +打越 +打越山 +打込 +打道 +打野 +打間 +打集 +払井 +払山 +払川 +払田 +扚瀬 +扣穀 +扶川 +扶持本 +扶滋倉 +扶瀬 +扶蘇 +扶蘓 +批把田 +批杷 +批杷木 +承先 +承山 +抅井 +把子 +把田 +把野 +抓揉 +抔本 +投元 +投埜 +投山 +投石 +投野 +折 +折上 +折下 +折中 +折久木 +折之内 +折井 +折付 +折倉 +折元 +折免 +折内 +折出 +折南 +折原 +折口 +折地 +折坂 +折場 +折場沢 +折場澤 +折増 +折壁 +折宇 +折安 +折寄 +折小野 +折尾 +折居 +折山 +折岡 +折島 +折崎 +折川 +折工 +折平 +折式田 +折懸 +折戸 +折戸谷 +折手 +折敷 +折敷出 +折敷地 +折敷瀬 +折方 +折木 +折本 +折杉 +折村 +折林 +折楠 +折橋 +折毛 +折江 +折池 +折河 +折津 +折浪 +折滝 +折瀧 +折田 +折田衛 +折畑 +折登 +折登谷 +折目 +折祖 +折租 +折立 +折端 +折竹 +折笠 +折紙 +折美 +折羽 +折腹 +折舘 +折茂 +折萩 +折葉 +折藤 +折見 +折谷 +折越 +折込 +折道 +折部 +折重 +折野 +折金 +折間 +折阪 +折附 +折霜 +折館 +折高 +折鶴 +抜井 +抜元 +抜口 +抜居 +抜屋 +抜山 +抜崎 +抜木 +抜水 +抜田 +抜谷 +抜迫 +抜銘 +択岻 +抦﨑 +披岸 +披川 +披村 +披田 +披田野 +抱 +抱井 +抱山 +抱岩 +抱江 +抱田 +抱石 +抹香 +押 +押三見 +押上 +押下 +押久保 +押之見 +押井 +押仲 +押保 +押元 +押入 +押兼 +押出 +押切 +押原 +押口 +押名 +押味 +押坂 +押垂 +押埀 +押場 +押塚 +押多連 +押富 +押小路 +押尾 +押山 +押岡 +押岩 +押島 +押崎 +押川 +押床 +押手 +押方 +押日 +押月 +押木 +押本 +押村 +押条 +押杵 +押柄 +押栗 +押桐 +押條 +押森 +押樋 +押樽 +押止 +押毛 +押水 +押永 +押江 +押沢 +押海 +押淵 +押渕 +押渡部 +押澤 +押火 +押田 +押留 +押目 +押立 +押篠 +押耳 +押葉 +押見 +押谷 +押賀 +押越 +押足 +押部 +押野 +押野見 +押野谷 +押金 +押鐘 +押阪 +押領司 +押領寺 +押鴨 +抽井 +抽冬 +抽口 +抽那 +拂井 +拂山 +拂川 +拂田 +拇速 +拍戸 +拓植 +拔井 +拔山 +拔田 +拔迫 +拙冬 +拙家 +招 +拜原 +拜司 +拜地 +拜崎 +拜師 +拜形 +拜志 +拜戸 +拜木 +拜殿 +拜田 +拜藤 +拜詞 +拜郷 +拜野 +拝 +拝上 +拝中 +拝加 +拝原 +拝司 +拝地 +拝島 +拝崎 +拝嵜 +拝川 +拝師 +拝形 +拝志 +拝戸 +拝木 +拝村 +拝根 +拝生 +拝田 +拝藤 +拝詞 +拝谷 +拝賀 +拝郷 +拝野 +拝頭 +拝高 +拭石 +拮石 +拵 +拵井 +拾三原 +拾井 +拾尾 +拾雄 +持下 +持丸 +持主 +持井 +持仏 +持佛 +持倉 +持元 +持光 +持冨 +持原 +持吉 +持地 +持垣 +持城 +持場 +持塚 +持増 +持安 +持宝 +持家 +持富 +持尾 +持屋 +持山 +持島 +持崎 +持川 +持平 +持延 +持建 +持徳 +持持 +持掛 +持摩 +持斉 +持斎 +持明 +持明院 +持月 +持木 +持末 +持本 +持村 +持松 +持林 +持橋 +持永 +持沢 +持溝 +持澤 +持田 +持留 +持石 +持立 +持箸 +持舘 +持西 +持谷 +持金 +持長 +持館 +持麾 +持齋 +指 +指中 +指出 +指南谷 +指原 +指口 +指吸 +指場 +指宿 +指尾 +指山 +指岡 +指崎 +指川 +指平 +指形 +指方 +指旗 +指月 +指本 +指村 +指江 +指沢 +指澤 +指熊 +指物 +指物谷 +指田 +指簱 +指籏 +指谷 +指賀 +指輪 +指野 +指間 +指首 +按 +按察 +按田 +挙市 +挙野 +挟土 +挟場 +挟谷 +挟間 +挟間田 +振 +振五 +振井 +振分 +振原 +振古 +振吉 +振屋 +振川 +振旗 +振木 +振本 +振槌 +振津 +振甫 +振田 +振籏 +振落 +振袖 +振角 +挺屋 +挽 +挽内 +挽分 +挽地 +挽本 +挽田 +挽谷 +挽野 +挾土 +挾場 +挾本 +挾訪 +挾谷 +挾間 +挾間田 +捌幡 +捧 +捧箸 +捨田利 +捨野 +捫垣 +据 +据田 +据石 +捶井 +捺村 +捻原 +捻崎 +捻木 +捻橋 +捻金 +掃 +掃守 +掃本 +掃詰 +掃部 +掃部関 +掘 +掘下 +掘之内 +掘之江 +掘井 +掘内 +掘切 +掘前 +掘口 +掘地 +掘坂 +掘場 +掘家 +掘尾 +掘山 +掘岡 +掘川 +掘平 +掘抜 +掘木 +掘本 +掘杉 +掘林 +掘毛 +掘江 +掘池 +掘沢 +掘添 +掘田 +掘畑 +掘留 +掘立 +掘篭 +掘籠 +掘米 +掘脇 +掘越 +掘込 +掘部 +掘野 +掘金 +掘龍 +掛 +掛ノ上 +掛ノ下 +掛上 +掛下 +掛中 +掛之内 +掛井 +掛作 +掛信 +掛内 +掛原 +掛又 +掛口 +掛合 +掛園 +掛地 +掛埜 +掛場 +掛塚 +掛尾 +掛屋 +掛山 +掛岡 +掛島 +掛川 +掛川原 +掛巣 +掛布 +掛平 +掛戸 +掛折 +掛木 +掛本 +掛札 +掛村 +掛林 +掛桶 +掛森 +掛樋 +掛橋 +掛水 +掛江 +掛沢 +掛波 +掛澤 +掛田 +掛石 +掛碆 +掛礼 +掛神 +掛福 +掛端 +掛見 +掛谷 +掛貝 +掛越 +掛足 +掛迫 +掛造 +掛部 +掛野 +掛須 +掛飛 +掛馬 +掛鯛 +掛鼻 +掟 +採 +採沢 +採澤 +採田 +接待 +接木 +控井 +推久 +推井 +推名 +推屋 +推川 +推比乃 +推津 +推葉 +推谷 +推野 +掬川 +掬月 +掬池 +掲野 +掴原 +揃 +揃江 +揃田 +揉井 +提 +提中 +提仲 +提口 +提坂 +提山 +提島 +提嶋 +提橋 +提水流 +提石 +提箸 +提谷 +提野 +提針 +提髪 +揖 +揖保 +揖取 +揖場 +揖宿 +揖川 +揖斐 +揖本 +揖東 +揖沢 +揖澤 +揖田 +揖藤 +揖野 +揚 +揚井 +揚倉 +揚出 +揚利 +揚原 +揚口 +揚城 +揚場 +揚塩 +揚妻 +揚山 +揚岩 +揚張 +揚戸 +揚木 +揚本 +揚村 +揚松 +揚枝 +揚永 +揚沢 +揚田 +揚石 +揚紀 +揚葉 +揚見 +揚野 +握美 +援川 +揺本 +搆 +搆口 +搆居 +搗井 +搗本 +搗頭 +搦手 +搭本 +摂受 +摂山 +摂州 +摂待 +摂津 +摂田 +摂賀 +摘田 +摠墨 +摠谷 +摩上 +摩中田 +摩垣 +摩壽意 +摩多 +摩寿意 +摩尼 +摩島 +摩嶋 +摩庭 +摩志塚 +摩文仁 +摩江 +摩治 +摩湯 +摩瀬 +摩田 +摩砂 +摩護谷 +摩郡 +摩郷 +摩須 +摩騰 +摸利 +摺 +摺元 +摺出 +摺出寺 +摺寺 +摺崎 +摺川 +摺建 +摺木 +摺本 +摺沢 +摺河 +摺淵 +摺渕 +摺澤 +摺田 +摺石 +摺臼 +撞井 +撫 +撫中 +撫井 +撫佐 +撫原 +撫坂 +撫子 +撫尾 +撫山 +撫島 +撫川 +撫本 +撫谷 +撫野 +撫養 +播 +播上 +播井 +播元 +播原 +播口 +播山 +播岡 +播島 +播川 +播广 +播广谷 +播戸 +播摩 +播摩屋 +播摩谷 +播木 +播本 +播村 +播正 +播永 +播治 +播田 +播田実 +播田實 +播田見 +播眞 +播真 +播磨 +播磨屋 +播磨谷 +播見 +播谷 +播重 +播野 +播金 +播間 +播馬 +播麿 +撰 +撰定 +撰富 +撰梅 +撰田 +撰藻 +撹上 +撿崎 +操 +操上 +操原 +操崎 +操川 +操木 +操本 +操田 +操神 +操谷 +操野 +擣木 +擲 +攝受 +攝待 +攝津 +攝田 +攪上 +支倉 +支田 +支部 +改 +改世 +改之 +改井 +改働 +改元 +改光堂 +改原 +改口 +改喜 +改壽 +改寿 +改崎 +改戸 +改木 +改森 +改正 +改泉 +改瀬 +改田 +改発 +改發 +改藤 +改谷 +改賀 +改道 +改野 +放上 +放出 +放地 +放寺 +放寺谷 +放岩 +放崎 +放生 +放生会 +放生會 +放示 +放馬 +政 +政ケ谷 +政上 +政中 +政丸 +政久 +政也 +政二 +政井 +政住 +政保 +政信 +政倉 +政元 +政光 +政兼 +政処 +政原 +政友 +政司 +政吉 +政喜 +政嘉 +政国 +政國 +政地 +政坂 +政城 +政埜 +政場 +政塚 +政子 +政守 +政安 +政宗 +政実 +政家 +政實 +政尾 +政居 +政屋 +政山 +政岡 +政岩 +政島 +政崎 +政川 +政平 +政年 +政広 +政廣 +政延 +政影 +政後 +政徳 +政成 +政所 +政明 +政春 +政時 +政木 +政木屋 +政末 +政本 +政村 +政東 +政枝 +政栄 +政棟 +政森 +政榮 +政橋 +政次 +政氏 +政水 +政永 +政池 +政治 +政浦 +政清 +政滝 +政瀧 +政狩 +政田 +政盛 +政石 +政籐 +政綱 +政繁 +政義 +政芳 +政藤 +政行 +政西 +政見 +政谷 +政賀 +政輝 +政辺 +政辻 +政近 +政道 +政重 +政野 +政野屋 +政金 +政門 +政頼 +政香 +政鹿 +故倉 +故園 +故字 +故山 +故島 +故引 +故木 +故東 +故田 +故見 +故谷 +故選 +故金 +故長井 +敏安 +敏森 +敏蔭 +敏鎌 +敏陰 +救 +救仁郷 +救田 +救護 +敕使河原 +教仙 +教場 +教学 +教山 +教川 +教明 +教村 +教来石 +教楽木 +教樂木 +教正院 +教海 +教羽 +教蓮 +教誓 +教連 +教重 +教野 +敞 +敞田 +敦 +敦井 +敦加 +敦坂 +敦岡 +敦島 +敦嶋 +敦川 +敦巻 +敦朶 +敦森 +敦永 +敦沢 +敦澤 +敦田 +敦見 +敦谷 +敦賀 +敦賀屋 +敦賀谷 +敬向 +敬島 +敬川 +敬松 +敬礼 +敬礼寺 +敬禮 +数 +数乗 +数井 +数代 +数住 +数佐 +数元 +数原 +数又 +数口 +数合 +数味 +数土 +数坂 +数多 +数宝 +数実 +数家 +数寄 +数寄屋 +数尾 +数山 +数岡 +数島 +数崎 +数川 +数左 +数度 +数延 +数成 +数戸 +数木 +数本 +数村 +数枝 +数枝木 +数森 +数歩 +数永 +数江 +数沢 +数河 +数津 +数浜 +数澤 +数瀬 +数牛 +数田 +数登 +数益 +数矢 +数納 +数胴 +数藤 +数見 +数許 +数谷 +数貫 +数賀山 +数越 +数近 +数野 +数金 +数長 +数間 +数阪 +数面 +数馬 +数馬田 +敲森 +敷 +敷中 +敷井 +敷冨 +敷名 +敷地 +敷地屋 +敷妙 +敷宮 +敷富 +敷山 +敷島 +敷嶋 +敷平 +敷広 +敷戸 +敷本 +敷村 +敷根 +敷樋 +敷水 +敷波 +敷津 +敷浪 +敷田 +敷町 +敷矢 +敷知 +敷石 +敷谷 +敷野 +數 +數乘 +數井 +數住 +數佐 +數元 +數原 +數口 +數土 +數坂 +數家 +數寳 +數尾 +數山 +數岡 +數崎 +數川 +數本 +數村 +數森 +數江 +數河 +數澤 +數田 +數納 +數胴 +數藤 +數見 +數野 +數間 +數阪 +數馬 +數馬田 +文 +文中 +文井 +文仙 +文伝 +文倉 +文傳 +文元 +文入 +文分 +文原 +文司 +文園 +文垣 +文城 +文堀 +文堂 +文壽 +文大 +文字 +文字山 +文室 +文寿 +文屋 +文山 +文岡 +文岩 +文川 +文平 +文庫 +文弥 +文後 +文徳 +文成 +文挟 +文挾 +文明 +文月 +文木 +文本 +文村 +文東 +文林 +文栄 +文梨 +文森 +文榮 +文樹 +文殊 +文殊四郎 +文永 +文沢 +文渕 +文澤 +文狭 +文珠 +文珠四郎 +文珠寺 +文珠川 +文理 +文田 +文福 +文箭 +文能 +文蔵 +文藏 +文藤 +文谷 +文道 +文違 +文選 +文野 +文野森 +文随 +文隨 +文馬 +斉 +斉ケ原 +斉ケ瀬 +斉ノ内 +斉ノ平 +斉上 +斉下 +斉中 +斉丸 +斉之内 +斉之平 +斉二 +斉五沢 +斉井 +斉京 +斉伯 +斉信 +斉元 +斉内 +斉前 +斉加 +斉勝 +斉原 +斉古 +斉吉 +斉名 +斉喜 +斉土 +斉地 +斉坂 +斉城 +斉堂 +斉場 +斉子 +斉官 +斉宮 +斉家 +斉寺 +斉尾 +斉山 +斉岡 +斉島 +斉川 +斉当 +斉心 +斉悟 +斉慶 +斉戸 +斉所 +斉数 +斉料 +斉明寺 +斉木 +斉本 +斉村 +斉条 +斉東 +斉根 +斉條 +斉梧 +斉森 +斉正 +斉江 +斉河 +斉浦 +斉生 +斉田 +斉當 +斉穏寺 +斉竹 +斉籐 +斉能 +斉脇 +斉良 +斉藤 +斉見 +斉記 +斉谷 +斉賀 +斉賀原 +斉通 +斉道 +斉部 +斉郷 +斉野 +斉野平 +斉門 +斉間 +斉院 +斉須 +斉馨 +斉高 +斉鹿 +斎 +斎ケ原 +斎ノ内 +斎上 +斎下 +斎中 +斎丸 +斎之内 +斎之平 +斎二 +斎五沢 +斎五澤 +斎井 +斎京 +斎伯 +斎信 +斎元 +斎内 +斎出 +斎加 +斎勝 +斎原 +斎吉 +斎喜 +斎地 +斎坂 +斎城 +斎場 +斎塔 +斎多 +斎子 +斎官 +斎宮 +斎寺 +斎尾 +斎山 +斎岡 +斎島 +斎川 +斎当 +斎心 +斎慶 +斎戸 +斎所 +斎数 +斎明寺 +斎木 +斎本 +斎村 +斎条 +斎東 +斎條 +斎森 +斎正 +斎江 +斎河 +斎津 +斎浦 +斎生 +斎田 +斎竹 +斎籐 +斎能 +斎脇 +斎良 +斎藤 +斎藤日 +斎見 +斎谷 +斎賀 +斎通 +斎道 +斎部 +斎郷 +斎野 +斎野平 +斎門 +斎間 +斎院 +斎須 +斎高 +斎鹿 +斐 +斐品 +斐田 +斑目 +斑鳩 +斗々田 +斗ケ沢 +斗ケ澤 +斗光 +斗内 +斗内沢 +斗升 +斗南 +斗山 +斗崎 +斗巍下 +斗成 +斗星 +斗村 +斗根 +斗桝 +斗永 +斗沢 +斗澤 +斗石 +斗米 +斗納 +斗舛 +斗蔵 +斗谷 +斗賀 +斗賀山 +斗野 +斗高 +斗鬼 +斜木 +斜森 +斜田 +斧 +斧上 +斧内 +斧出 +斧原 +斧口 +斧城 +斧家 +斧尾 +斧山 +斧崎 +斧川 +斧木 +斧本 +斧村 +斧林 +斧江 +斧沢 +斧洞 +斧淵 +斧渕 +斧澤 +斧生 +斧田 +斧研 +斧窪 +斧谷 +斧鉈 +斯林 +斯波 +斯眞田 +斯真田 +新 +新ケ江 +新ケ谷 +新タ +新ノ居 +新上 +新下 +新中 +新中崎 +新中須 +新丸 +新主 +新久 +新久保 +新久田 +新九町 +新亀 +新二日市 +新井 +新井原 +新井場 +新井山 +新井川 +新井本 +新井田 +新井谷 +新井野 +新京 +新今 +新仏 +新休 +新伝 +新位 +新住 +新佐 +新佐古 +新佐枝 +新余 +新佛 +新作 +新保 +新保屋 +新保谷 +新信 +新信田 +新倉 +新傳 +新元 +新先 +新光 +新免 +新入 +新八 +新具 +新典 +新内 +新内谷 +新冨 +新出 +新出水 +新出谷 +新分 +新別 +新前 +新力 +新加 +新北 +新升 +新卓 +新南 +新原 +新友 +新取 +新口 +新古 +新古谷 +新号 +新司 +新吉 +新吉屋 +新名 +新名主 +新名内 +新名谷 +新向 +新向井 +新吾 +新呂 +新呑 +新味 +新和 +新和田 +新喜 +新嘉喜 +新噌 +新四原 +新図 +新国 +新國 +新園 +新土 +新土井 +新土居 +新在家 +新地 +新坂 +新坂上 +新坊 +新坪 +新垣 +新垣内 +新城 +新城谷 +新埜 +新埼 +新堀 +新堂 +新堰 +新場 +新塘 +新塚 +新増 +新夕 +新多 +新天寺 +新奥 +新好 +新妻 +新子 +新子谷 +新字 +新宅 +新宅谷 +新守 +新安 +新定 +新宝 +新実 +新室 +新宮 +新宮原 +新宮領 +新家 +新家子 +新家谷 +新宿 +新富 +新實 +新寺 +新尋 +新小倉 +新小田 +新尺 +新尾 +新居 +新居崎 +新居川 +新居延 +新居田 +新居見 +新屋 +新屋敷 +新屋鋪 +新山 +新山王 +新山田 +新岡 +新岩 +新島 +新崎 +新嵜 +新嵩 +新嶋 +新嶌 +新川 +新川庄 +新川床 +新川田 +新工 +新巻 +新帯 +新帶 +新幟 +新幡 +新平 +新幸 +新広 +新庄 +新庄屋 +新庄谷 +新床 +新度 +新座 +新廣 +新延 +新張 +新形 +新影 +新後 +新後閑 +新御堂 +新徳 +新志 +新性 +新恒 +新恵 +新惠 +新戸 +新戸部 +新房 +新手 +新才 +新持 +新指 +新掘 +新改 +新政 +新敷 +新斗米 +新方 +新明 +新月 +新有留 +新木 +新木本 +新木田 +新本 +新杉 +新村 +新村谷 +新条 +新東 +新松 +新林 +新枝 +新枝田 +新枦 +新柴 +新柵 +新栄 +新根 +新梅 +新條 +新森 +新楯 +新極 +新楽 +新榮 +新槇 +新槙 +新樂 +新樹 +新橋 +新櫨 +新次 +新正 +新武 +新武屋 +新歩 +新歩一 +新殿 +新比叡 +新比恵 +新毛 +新水 +新永 +新江 +新江田 +新池 +新池谷 +新沖 +新沢 +新沢津 +新河 +新河戸 +新治 +新沼 +新沼舘 +新沼館 +新泉 +新泊 +新泻 +新洞 +新津 +新津保 +新津谷 +新浜 +新浜脇 +新浦 +新浪 +新海 +新淵 +新添 +新清 +新渕 +新渡 +新渡戸 +新湯 +新満 +新滝 +新潟 +新潟谷 +新澤 +新澤津 +新濃 +新濱 +新瀧 +新瀬 +新為 +新熊 +新牛込 +新牧 +新玉 +新甚 +新生 +新用 +新用谷 +新甫 +新田 +新田井 +新田山 +新田川 +新田町 +新田目 +新田見 +新田谷 +新田頭 +新甲 +新町 +新畄 +新界 +新畑 +新留 +新畠 +新畦 +新発 +新発田 +新登 +新發田 +新白 +新盛 +新目 +新相 +新矢 +新石 +新磯 +新祖 +新福 +新福留 +新稲 +新穂 +新穗 +新窪 +新立 +新章 +新竹 +新籐 +新籾 +新粥 +新納 +新紺 +新網 +新織 +新置 +新羅 +新美 +新羽 +新羽坪 +新胡 +新脇 +新膳 +新舍 +新舎 +新舗 +新舘 +新舛 +新舞 +新舟 +新舩 +新船 +新良 +新良貴 +新色 +新芝 +新苗 +新茶 +新荘 +新荻 +新葉 +新蔵 +新蔵淵 +新蔵渕 +新薗 +新藏 +新藤 +新藤間 +新行 +新行内 +新行寺 +新行谷 +新西 +新見 +新覚 +新角 +新解 +新託 +新記 +新谷 +新谷垣内 +新谷松 +新谷田 +新豊 +新貝 +新賀 +新越 +新路 +新輪 +新農 +新辺 +新辻 +新近 +新迫 +新述 +新途 +新通 +新造 +新道 +新達 +新達谷 +新那 +新部 +新郷 +新酒 +新里 +新重 +新野 +新野尾 +新野田 +新野見 +新野辺 +新野邉 +新野邊 +新金 +新金子 +新釜 +新鉢 +新銀 +新銅 +新鋪 +新鍋 +新鎧 +新長 +新門 +新開 +新開谷 +新間 +新関 +新關 +新阜 +新防 +新隈 +新階 +新青木 +新鞍 +新須 +新頭 +新飯田 +新飼 +新館 +新馬場 +新馬込 +新駿河 +新高 +新鶴 +新鶴田 +新鷲 +新鹿 +新黒 +方 +方ケ部 +方丈 +方上 +方井 +方京 +方伊儀 +方便 +方倉 +方円 +方原 +方喰 +方城 +方堂 +方壁 +方尺 +方尾 +方山 +方岡 +方島 +方川 +方志 +方月 +方木 +方本 +方村 +方杭 +方柄 +方桐 +方森 +方楽 +方橋 +方波見 +方田 +方緒 +方藤 +方谷 +方違 +方釈 +方野 +方金 +於久 +於久田 +於久野 +於保 +於勢 +於土井 +於子 +於宿 +於島 +於川 +於市 +於方 +於曽 +於曽能 +於曾能 +於本 +於東 +於玉 +於田 +於留尊 +於茂田 +施井 +施向 +施山 +施村 +施永 +施賀 +施野 +旁川 +旅 +旅井 +旅家 +旅川 +旅沢 +旅河 +旅澤 +旅田 +旅谷 +旗 +旗中 +旗原 +旗垣 +旗家 +旗屋 +旗山 +旗岡 +旗島 +旗崎 +旗嶋 +旗川 +旗手 +旗持 +旗智 +旗本 +旗根 +旗瀬 +旗生 +旗田 +旗町 +旗福 +旗見 +旗谷 +旗野 +旙山 +旙本 +旛山 +日 +日々 +日々谷 +日々野 +日の出 +日の原 +日の杉 +日の沢 +日ケ丸 +日ケ久保 +日ノ下 +日ノ出 +日ノ原 +日ノ岡 +日ノ戸 +日ノ本 +日ノ沢 +日ノ澤 +日ノ西 +日ノ迫 +日㘴 +日上 +日下 +日下山 +日下志 +日下生 +日下田 +日下石 +日下辺 +日下邊 +日下部 +日下野 +日与川 +日並 +日中 +日丸 +日之内 +日之出 +日之原 +日之蔵 +日之裏 +日之西 +日之迫 +日代山 +日伝 +日住 +日佐 +日佐戸 +日余 +日保 +日信 +日俣 +日倉 +日傅 +日傘 +日備野 +日傳 +日元 +日光 +日内 +日内地 +日出 +日出口 +日出山 +日出島 +日出嶋 +日出平 +日出幸 +日出木 +日出柄 +日出谷 +日出間 +日切 +日前 +日力 +日勝 +日南 +日南休 +日南住 +日南山 +日南川 +日南本 +日南田 +日原 +日又 +日友 +日口 +日古見 +日台 +日合 +日吉 +日吉屋 +日吉山 +日吉田 +日名 +日名内 +日名口 +日名地 +日名子 +日名川 +日名田 +日名貞 +日向 +日向埜 +日向寺 +日向瀬 +日向端 +日向野 +日吾 +日和 +日和上 +日和佐 +日和原 +日和山 +日和崎 +日和田 +日和野 +日土 +日地 +日地谷 +日坂 +日垣 +日城 +日埜 +日域 +日堂 +日塔 +日塚 +日墻 +日壁 +日夏 +日外 +日多 +日好 +日妻 +日宅 +日宇 +日守 +日室 +日富 +日寺 +日小田 +日尻 +日尻田 +日尾 +日尾野 +日山 +日岐 +日岡 +日岳 +日峰 +日島 +日崎 +日嶽 +日川 +日巡 +日巻 +日幡 +日平 +日座 +日延 +日廻 +日引 +日当 +日当瀬 +日形 +日形井 +日影 +日影舘 +日影野 +日影館 +日後 +日徳寺 +日恵井 +日恵野 +日惠野 +日成 +日我 +日戸 +日指 +日掛 +日改 +日数谷 +日敷 +日新 +日方 +日日 +日昔 +日時 +日時本 +日景 +日景館 +日暮 +日替 +日月 +日朝 +日木 +日本 +日本木 +日本松 +日本柳 +日本貴 +日村 +日東 +日東寺 +日松 +日林 +日枝 +日柄 +日柳 +日柴喜 +日柴鬼 +日栄 +日根 +日根ノ谷 +日根埜谷 +日根居 +日根谷 +日根野 +日根野谷 +日森 +日極 +日楽 +日榮 +日樂 +日樫 +日橋 +日此 +日比 +日比原 +日比埜 +日比宇 +日比生 +日比谷 +日比野 +日毛 +日水 +日永 +日永田 +日江 +日江井 +日池 +日沖 +日沢 +日河 +日河岸 +日沼 +日泉 +日津 +日浅 +日浦 +日浦田 +日淺 +日添 +日渓 +日渡 +日満 +日溪 +日潟 +日澤 +日焼 +日照 +日照田 +日照院 +日熊 +日爪 +日玉 +日生 +日生下 +日用 +日田 +日田井 +日田内 +日田野 +日畑 +日留 +日留川 +日留田 +日當 +日當瀬 +日疋 +日登 +日登利 +日盛 +日直 +日矢川 +日石 +日神 +日神山 +日神美 +日秋 +日種 +日立 +日竎 +日端 +日笠 +日笠山 +日箇原 +日納 +日紫喜 +日紫鬼 +日置 +日置江 +日羅山 +日美 +日聖 +日能 +日脇 +日脚 +日臺 +日與川 +日良 +日色 +日花 +日芳 +日茂 +日蔭 +日蔭茂井 +日蔭野 +日衛島 +日衛嶋 +日裏 +日西 +日見 +日覚 +日覺 +日角 +日計 +日詰 +日誥 +日請 +日諸 +日谷 +日貝 +日貫 +日賀 +日賀井 +日賀志 +日賀野 +日賢 +日越 +日足 +日路井 +日車 +日輝 +日輪 +日辻 +日迫 +日退 +日道 +日達 +日那 +日那田 +日部 +日里 +日野 +日野上 +日野下 +日野出 +日野原 +日野口 +日野地 +日野坪 +日野宮 +日野尾 +日野屋 +日野山 +日野岡 +日野岳 +日野島 +日野崎 +日野川 +日野川角 +日野平 +日野戸 +日野月 +日野本 +日野杉 +日野村 +日野林 +日野根 +日野森 +日野水 +日野沢 +日野浦 +日野溝 +日野澤 +日野田 +日野目 +日野石 +日野西 +日野見 +日野谷 +日野迫 +日野間 +日金 +日開 +日開野 +日間賀 +日関 +日阪 +日限 +日陰 +日陰茂井 +日隅 +日隈 +日隠 +日雨孫 +日露 +日露野 +日面 +日須 +日頭 +日食 +日首 +日馬 +日高 +日高谷 +日鷹 +日鼻 +旦 +旦丘 +旦代 +旦保 +旦原 +旦尾 +旦平 +旦暮 +旦木 +旦来 +旦花 +旦谷 +旦過 +旦道 +旦那寺 +旦部 +旦野 +旧井 +旧冨 +旧宮 +旧富 +旧川 +旧役 +旧木 +旧杵 +旧林 +旧橋 +旧沢 +旧澤 +旧田 +旧谷 +旧部 +旨山 +旨森 +旨田 +旨行 +早 +早ノ瀬 +早上 +早下 +早世 +早丸 +早久 +早久間 +早乗 +早乙女 +早亀 +早井 +早人 +早佐 +早佐古 +早倉 +早借 +早元 +早先 +早光 +早兼 +早内 +早冨 +早出 +早分 +早副 +早助 +早勢 +早原 +早友 +早取 +早口 +早司 +早名 +早味 +早咲 +早園 +早坂 +早垣 +早場 +早塚 +早塩 +早子 +早定 +早富 +早尻 +早尾 +早山 +早岐 +早岡 +早島 +早崎 +早嵜 +早嶋 +早川 +早師 +早平 +早幸 +早弓 +早形 +早志 +早戸 +早房 +早手 +早方 +早日 +早日渡 +早曽 +早月 +早月女 +早朝 +早木 +早本 +早杉 +早村 +早東 +早松 +早林 +早柏 +早栗 +早梅 +早森 +早樋 +早樫 +早橋 +早武 +早水 +早水口 +早永 +早沢 +早河 +早泉 +早津 +早津田 +早浜 +早浪 +早海 +早淵 +早渕 +早渡 +早滝 +早澤 +早濱 +早瀧 +早瀬 +早瀬川 +早瀬戸 +早灘 +早熊 +早狩 +早猛 +早猟 +早生 +早田 +早目 +早矢仕 +早矢士 +早石 +早福 +早稲 +早立 +早竹 +早笋 +早羽 +早脇 +早舟 +早舩 +早船 +早良 +早苗 +早苫 +早草 +早藤 +早見 +早谷 +早谷川 +早貸 +早賀 +早起 +早越 +早足 +早辺 +早迫 +早通 +早速 +早道 +早部 +早重 +早野 +早金 +早鈴 +早鉦 +早鐘 +早間 +早阪 +早雨 +早雲 +早頭 +早風 +早馬 +早馬木 +早高 +早麻 +旭 +旭井 +旭南 +旭吉 +旭天 +旭奈 +旭山 +旭岡 +旭川 +旭形 +旭日 +旭林 +旭梶山 +旭森 +旭沢 +旭泉 +旭澤 +旭爪 +旭田 +旭立 +旭置 +旭谷 +旭野 +昂師 +昂月 +昆 +昆埜 +昆尾 +昆布 +昆布屋 +昆布山 +昆布谷 +昆木内 +昆沙丸 +昆沙賀 +昆沢 +昆澤 +昆田 +昆藤 +昆野 +昆金 +昆陽 +昆陽名 +昇 +昇作 +昇地 +昇塚 +昇田 +昇高 +昊澄 +昌 +昌保 +昌元 +昌原 +昌司 +昌子 +昌安 +昌尾 +昌山 +昌岡 +昌島 +昌崎 +昌川 +昌木 +昌本 +昌村 +昌林 +昌林寺 +昌武 +昌浦 +昌田 +昌角 +昌谷 +昌野 +明 +明ケ戸 +明ケ谷 +明上 +明上山 +明下 +明丸 +明主 +明事 +明井 +明仁 +明仗 +明仙 +明代 +明作 +明保 +明保能 +明元 +明先 +明光 +明光院 +明全 +明内 +明円 +明冨士 +明刕 +明利 +明前 +明力 +明劦 +明午 +明原 +明受 +明口 +明司 +明吉 +明名 +明周 +明和 +明喜 +明園 +明圓 +明土 +明地 +明坂 +明城 +明堂 +明場 +明塚 +明塩 +明壁 +明士 +明妻 +明姓 +明字 +明学 +明官 +明定 +明実 +明富士 +明尾 +明居 +明山 +明岡 +明岩 +明岳 +明峯 +明峰 +明島 +明崎 +明嵐 +明嵜 +明川 +明市 +明平 +明度 +明庭 +明後 +明徳 +明心 +明念 +明意 +明慶 +明戸 +明才地 +明採 +明政 +明新 +明日 +明日山 +明日見 +明日香 +明星 +明是 +明時 +明景 +明智 +明暗 +明月 +明月院 +明望 +明木 +明木庵 +明末 +明本 +明杉 +明村 +明杖 +明東 +明松 +明林 +明果瑠 +明枝 +明柴 +明栄 +明森 +明楽 +明槻 +明樂 +明橋 +明正 +明正寺 +明歩谷 +明比 +明永 +明沢 +明河 +明治 +明沼 +明泉 +明法寺 +明津 +明浄 +明浦 +明海 +明添 +明渡 +明滝 +明澄 +明澤 +明瀬 +明照 +明父 +明珍 +明珎 +明理 +明生 +明用 +明田 +明田川 +明界 +明畑 +明畠 +明登 +明知 +明石 +明石家 +明石田 +明石谷 +明礼 +明神 +明福 +明禮 +明穂 +明空 +明立 +明箱 +明翫 +明致 +明芝 +明蓮 +明藪 +明見 +明角 +明護 +明谷 +明豆 +明貝 +明貫 +明賀 +明路 +明輪 +明通 +明連 +明道 +明部 +明都 +明里 +明野 +明金 +明鎮 +明閑 +明間 +明関 +明阪 +明陳 +明隅 +明雪 +明頓 +明鹿野 +昏上 +昏中 +昏本 +昏石 +易 +易平 +易本 +易楽 +易水 +易永 +易田 +易葉 +昔 +昔奈 +昔宮 +昔川 +昔志 +昔農 +昜居 +昜本 +昜永 +星 +星ノ宮 +星ノ谷 +星上 +星下 +星丘 +星中 +星丸 +星乃 +星久保 +星久木 +星之内 +星亀 +星井 +星井田 +星仲 +星住 +星信 +星倉 +星元 +星先 +星光 +星出 +星加 +星加屋 +星原 +星合 +星名 +星呂 +星地 +星坂 +星埜 +星場 +星塚 +星奈 +星子 +星守 +星安 +星宗 +星宮 +星尾 +星居 +星屋 +星山 +星岡 +星島 +星崎 +星嵜 +星川 +星州 +星平 +星座 +星庵 +星徳 +星志野 +星戸 +星指 +星文 +星明 +星月 +星木 +星本 +星村 +星根 +星次 +星武 +星永 +星江 +星沢 +星河 +星泉 +星波 +星津 +星浦 +星澤 +星熊 +星牟礼 +星牟禮 +星玖 +星生 +星田 +星畑 +星盛 +星神 +星簇 +星能 +星脇 +星芝 +星衛 +星見 +星谷 +星賀 +星越 +星里 +星野 +星野井 +星野尾 +星野谷 +星野黒 +星金 +星銅 +星長 +星間 +星隈 +春 +春上 +春下 +春中 +春久 +春井 +春住 +春佐 +春元 +春光 +春兼 +春内 +春冨 +春出 +春別府 +春原 +春口 +春吉 +春名 +春和 +春国 +春國 +春園 +春城 +春堂 +春増 +春多 +春好 +春宮 +春尾 +春山 +春岡 +春島 +春崎 +春嵜 +春嶋 +春川 +春慶 +春成 +春戸 +春摘 +春日 +春日亀 +春日井 +春日原 +春日埜 +春日屋 +春日山 +春日岡 +春日川 +春日田 +春日谷 +春日部 +春日野 +春明 +春木 +春木場 +春木屋 +春木谷 +春末 +春本 +春村 +春松 +春林 +春柳 +春森 +春樋 +春樹 +春次 +春正 +春武 +春永 +春江 +春沢 +春浪 +春海 +春添 +春滝 +春潮楼 +春澤 +春瀧 +春瀬 +春田 +春町 +春畑 +春石 +春秋 +春竹 +春美 +春花 +春芳 +春芽 +春若 +春菜 +春薗 +春藤 +春見 +春谷 +春貝地 +春貴 +春賀 +春辺 +春近 +春遍 +春道 +春那 +春里 +春重 +春野 +春長 +春間 +春風 +春馬 +春駒 +春高 +昨宅 +昨間 +昭元 +昭原 +昭司 +昭和 +昭山 +昭本 +昭林 +昭野 +是 +是下 +是久 +是井 +是住 +是佐 +是信 +是元 +是光 +是兼 +是利 +是則 +是友 +是吉 +是国 +是國 +是安 +是定 +是山 +是岡 +是島 +是川 +是常 +是平 +是広 +是廣 +是忠 +是恒 +是成 +是政 +是方 +是時 +是月 +是木 +是末 +是本 +是村 +是松 +是枝 +是森 +是次 +是此田 +是永 +是沢 +是洞 +是津 +是浦 +是清 +是澤 +是田 +是盛 +是石 +是竹 +是繁 +是藤 +是行 +是角 +是谷 +是貞 +是賀 +是近 +是重 +是金 +是長 +是非 +是高 +昼仲 +昼八 +昼埜 +昼場 +昼岡 +昼川 +昼沢 +昼河 +昼田 +昼神 +昼野 +昼間 +昼馬 +昿野 +晁 +時 +時々輪 +時下 +時丸 +時久 +時乗 +時乘 +時井 +時仕 +時任 +時位 +時佐 +時信 +時倉 +時元 +時光 +時兼 +時原 +時友 +時合 +時吉 +時和 +時国 +時國 +時園 +時塚 +時増 +時女 +時子山 +時守 +時安 +時宗 +時実 +時實 +時尾 +時山 +時岡 +時峯 +時崎 +時川 +時平 +時広 +時庭 +時庵 +時廣 +時延 +時弘 +時待 +時得 +時志 +時惣 +時戸 +時政 +時数 +時數 +時末 +時本 +時札 +時杉 +時村 +時松 +時林 +時枝 +時森 +時正 +時武 +時水 +時永 +時沢 +時津 +時浦 +時澤 +時田 +時畦 +時盛 +時目 +時真 +時矢 +時繁 +時耕 +時舘 +時葉 +時藤 +時見 +時計 +時谷 +時貞 +時里 +時重 +時野 +時野谷 +時鐘 +時長 +時間 +時雨 +時頼 +時館 +時高 +時鳥 +晃 +晃宗 +晃昇 +晄 +晄安 +晄晏 +晋 +晋山 +晋川 +晋河 +晋道 +晋野 +晋陽 +晒 +晒名 +晒尾 +晒屋 +晒木 +晒科 +晒谷 +晒野 +晝仲 +晝八 +晝場 +晝岡 +晝川 +晝沢 +晝河 +晝澤 +晝田 +晝間 +晝馬 +晦日 +晨 +晨原 +晩 +晩沢 +晩田 +晩葉 +普世 +普久原 +普久山 +普久嶺 +普久本 +普久里 +普久間 +普代 +普光 +普光上 +普光江 +普光院 +普入 +普勝 +普和 +普喜 +普天間 +普奈木 +普家 +普山 +普山田 +普嶋 +普川 +普後 +普明 +普本 +普森 +普津沢 +普津澤 +普済 +普照 +普現 +普神 +普見 +普賢 +普賢寺 +普赤 +普輪崎 +普門 +景 +景下 +景中 +景井 +景元 +景光 +景出 +景利 +景原 +景宇治 +景守 +景安 +景家 +景尾 +景山 +景岡 +景崎 +景川 +景平 +景政 +景方 +景本 +景村 +景枝 +景森 +景沢 +景浦 +景清 +景湖 +景澤 +景田 +景由 +景行 +景見 +景谷 +景里 +景野 +晴 +晴佐久 +晴原 +晴城 +晴家 +晴山 +晴岡 +晴峯 +晴嶺 +晴川 +晴披 +晴明 +晴智 +晴木 +晴柀 +晴気 +晴氣 +晴永 +晴沢 +晴澤 +晴田 +晴野 +晴間 +晶 +晶納 +晶貴 +智下 +智井 +智内 +智原 +智口 +智和 +智多 +智夫 +智山 +智徳 +智念 +智明 +智有 +智木田 +智本 +智治 +智片 +智田 +智羽 +智者 +智脇 +智葉 +智谷 +智野 +暁 +暁山 +暁星 +暁烏 +暁谷 +暄 +暈 +暉 +暉峻 +暉本 +暒田 +暖 +暖井 +暖水 +暘 +暢孫 +暮井 +暮地 +暮地岩 +暮地本 +暮坪 +暮山 +暮床 +暮日 +暮木 +暮松 +暮林 +暮橋 +暮沢 +暮沼 +暮泉 +暮田 +暮町 +暮石 +暮谷 +暮部 +曄道 +曇 +曙 +曜山 +曜日 +曝野 +曠原 +曠野 +曦 +曲 +曲り +曲井 +曲出 +曲原 +曲子 +曲尺 +曲尾 +曲山 +曲川 +曲師 +曲戸 +曲手 +曲木 +曲本 +曲村 +曲梶 +曲沢 +曲沼 +曲淵 +曲渕 +曲澤 +曲瀬 +曲瀬川 +曲田 +曲直 +曲直瀬 +曲直部 +曲竹 +曲藤 +曲谷 +曲谷地 +曲輪 +曲辻 +曲迫 +曲道 +曲里 +曲野 +曲馬 +曳原 +曳地 +曳埜 +曳摩 +曳木 +曳村 +曳汐 +曳沼 +曳田 +曳町 +曳野 +曳間 +曳馬 +更エ +更ヱ +更井 +更原 +更家 +更居 +更屋 +更屋敷 +更山 +更岡 +更木 +更永 +更江 +更沢 +更澤 +更田 +更科 +更紗 +更級 +更西 +更谷 +曵原 +曵地 +曵成 +曵木 +曵村 +曵汐 +曵沼 +曵田 +曵野 +曵間 +曷川 +書上 +書川 +曹山 +曹我 +曹我部 +曹永 +曹路地 +曽々木 +曽ケ端 +曽ノ木 +曽不江 +曽与島 +曽世田 +曽亀 +曽井 +曽代島 +曽佐 +曽余田 +曽倉 +曽出 +曽利 +曽利久 +曽利吾乃 +曽利田 +曽原 +曽又 +曽合 +曽呂利 +曽呂里 +曽和 +曽和田 +曽地 +曽坂 +曽場 +曽場尾 +曽塚 +曽奈 +曽子 +曽宇 +曽宇谷 +曽宮 +曽家 +曽小川 +曽尾 +曽屋 +曽山 +曽崎 +曽川 +曽布川 +曽師 +曽庭 +曽志 +曽志崎 +曽慶 +曽我 +曽我井 +曽我尾 +曽我本 +曽我田 +曽我石 +曽我美 +曽我見 +曽我賀 +曽我辺 +曽我邉 +曽我部 +曽我野 +曽戸 +曽方 +曽明 +曽木 +曽村 +曽束 +曽根 +曽根下 +曽根井 +曽根元 +曽根勝 +曽根原 +曽根塚 +曽根岡 +曽根崎 +曽根嵜 +曽根川 +曽根本 +曽根沢 +曽根田 +曽根脇 +曽根辻 +曽根高 +曽武川 +曽水 +曽江 +曽江井 +曽沢 +曽泉 +曽波 +曽澤 +曽瀬 +曽爾 +曽田 +曽矢 +曽碕 +曽碩 +曽祇 +曽祢 +曽祢原 +曽福 +曽禰 +曽禰原 +曽称 +曽篠 +曽織 +曽羽 +曽與島 +曽良 +曽良中 +曽良岡 +曽谷 +曽谷原 +曽谷村 +曽貝 +曽賀 +曽賀野 +曽越 +曽足 +曽路地 +曽路里 +曽輪 +曽部 +曽郷 +曽里 +曽里田 +曽野 +曽野田 +曽野部 +曽雌 +曾々木 +曾ケ端 +曾与島 +曾世田 +曾亀 +曾代島 +曾佐 +曾倉 +曾利 +曾利田 +曾原 +曾合 +曾和 +曾地 +曾場 +曾塚 +曾塲 +曾子 +曾宇 +曾宮 +曾家 +曾小川 +曾屋 +曾山 +曾川 +曾布川 +曾師 +曾志 +曾志崎 +曾慶 +曾我 +曾我井 +曾我尾 +曾我石 +曾我美 +曾我辺 +曾我邊 +曾我部 +曾我野 +曾戸 +曾方 +曾木 +曾村 +曾根 +曾根井 +曾根原 +曾根岡 +曾根崎 +曾根嵜 +曾根川 +曾根本 +曾根澤 +曾根田 +曾根高 +曾武川 +曾江 +曾波 +曾津 +曾澤 +曾爾 +曾田 +曾矢 +曾碕 +曾祢 +曾福 +曾禰 +曾篠 +曾紙 +曾織 +曾羅 +曾羽 +曾良 +曾良中 +曾良岡 +曾谷 +曾谷原 +曾谷村 +曾貝 +曾賀 +曾賀野 +曾越 +曾輪 +曾部 +曾郷 +曾里田 +曾野 +曾野田 +曾野部 +曾間 +曾雌 +替地 +替場 +替山 +替田 +最上 +最上屋 +最上川 +最上田 +最上谷 +最乗 +最住 +最初 +最勝 +最勝寺 +最勝林 +最川 +最所 +最明 +最明治 +最本 +最林寺 +最生 +最田 +最相 +最知 +最紙 +最能 +最見 +最賀 +最部 +最里 +最首 +會 +會下 +會原 +會坂 +會場 +會嶋 +會川 +會布川 +會我部 +會所 +會曽川 +會木 +會本 +會根原 +會森 +會沢 +會津 +會澤 +會田 +會町 +會見 +會谷 +會退 +會野 +月 +月ケ洞 +月ケ瀬 +月ノ井 +月ノ木 +月下 +月下部 +月丘 +月井 +月代 +月俟 +月俣 +月僧 +月元 +月光 +月共 +月内 +月出 +月原 +月又 +月吉 +月向 +月善 +月地 +月坂 +月城 +月守 +月安 +月宮 +月小路 +月尾 +月居 +月山 +月岡 +月岩 +月峯 +月峰 +月島 +月崎 +月嶋 +月嶹 +月川 +月形 +月待 +月性 +月成 +月折 +月持 +月方 +月明 +月星 +月時 +月木 +月末 +月本 +月李 +月村 +月東 +月松 +月林 +月森 +月橋 +月永 +月江 +月沢 +月泉 +月波 +月洞 +月津 +月浜 +月浦 +月浪 +月海 +月渓 +月溪 +月澄 +月澤 +月濱 +月瀬 +月生 +月生田 +月田 +月盛 +月石 +月精 +月縄 +月繩 +月脚 +月舘 +月花 +月芳 +月葉 +月藤 +月見 +月見里 +月谷 +月貫 +月足 +月輪 +月迫 +月退 +月邨 +月里 +月野 +月野和 +月野木 +月長 +月門 +月間 +月阪 +月隈 +月雪 +月館 +有 +有ケ谷 +有ノ木 +有上 +有下 +有中 +有久 +有乗 +有乳 +有井 +有井山 +有仂 +有代 +有住 +有佐 +有佐見 +有保 +有信 +有倉 +有側 +有働 +有元 +有光 +有兼 +有内 +有冨 +有凉 +有出 +有利 +有加 +有加利 +有助 +有動 +有北 +有南 +有原 +有友 +有可 +有司 +有吉 +有和 +有喜多 +有国 +有國 +有園 +有地 +有坂 +有坪 +有城 +有埜 +有堀 +有場 +有塚 +有塲 +有墨 +有壁 +有壽多 +有好 +有子山 +有安 +有宗 +有定 +有家 +有家川 +有富 +有寿夷 +有尓 +有尾 +有居 +有屋 +有屋田 +有山 +有岡 +有島 +有崎 +有嶋 +有川 +有巣 +有市 +有常 +有平 +有年 +有年田 +有広 +有座 +有廣 +有延 +有弘 +有形 +有待 +有得 +有徳 +有志 +有恵 +有慟 +有我 +有戸 +有房 +有手 +有持 +有政 +有方 +有明 +有時 +有月 +有木 +有木園 +有未 +有末 +有本 +有村 +有東 +有松 +有林 +有枝 +有栖 +有根 +有根元 +有桝 +有森 +有橋 +有櫛 +有次 +有正 +有水 +有永 +有江 +有汲 +有沢 +有沼 +有泉 +有波 +有津 +有浜 +有浦 +有浪 +有海 +有涼 +有清 +有渡 +有渡山 +有渡根 +有満 +有滝 +有滿 +有漢 +有澄 +有澤 +有瀧 +有瀬 +有為楠 +有熊 +有爾 +有牛 +有生 +有田 +有由 +有町 +有畑 +有留 +有益 +有盛 +有矢 +有知山 +有石 +有磯 +有福 +有積 +有竹 +有簾 +有米 +有紀 +有美 +有芝 +有芳 +有若 +有菅 +有薗 +有藤 +有行 +有衛 +有西 +有見 +有角 +有計 +有請 +有谷 +有谿 +有貝 +有貞 +有財 +有貫 +有賀 +有路 +有輪 +有辺 +有近 +有迫 +有道 +有部 +有郷 +有釆 +有采 +有里 +有重 +有野 +有金 +有銘 +有長 +有門 +有間 +有阪 +有附 +有隅 +有隣 +有雅 +有須 +有須川 +有須田 +有馬 +有馬山 +有馬殿 +有高 +有鹿 +有麻 +有鼻 +朋政 +朋沢 +朋澤 +朋田 +朋里 +服井 +服免 +服卷 +服原 +服取 +服多 +服山 +服岡 +服島 +服崎 +服巻 +服平 +服本 +服村 +服池 +服田 +服藤 +服部 +服野 +服鳥 +朏 +朏島 +朏魄 +朔 +朔晦 +朗 +望 +望丘 +望主 +望山 +望岡 +望戸 +望月 +望木 +望橋 +望永 +望渓 +望溪 +望田 +望野 +望陀 +朝 +朝い奈 +朝䕃 +朝一 +朝三 +朝下 +朝丘 +朝中 +朝丸 +朝久 +朝久野 +朝井 +朝井出 +朝付 +朝代 +朝代谷 +朝位 +朝來野 +朝侍 +朝信 +朝倉 +朝元 +朝光 +朝内 +朝利 +朝加 +朝原 +朝古 +朝吹 +朝和 +朝喜 +朝国 +朝國 +朝地 +朝坂 +朝垣 +朝埜 +朝堀 +朝場 +朝塚 +朝塲 +朝増 +朝多 +朝夷 +朝夷名 +朝奈 +朝妻 +朝子 +朝守 +朝宮 +朝家 +朝富 +朝尾 +朝居 +朝山 +朝岡 +朝岩 +朝島 +朝崎 +朝嵐 +朝川 +朝平 +朝広 +朝廣 +朝弘 +朝彝 +朝影 +朝戸 +朝日 +朝日出 +朝日南 +朝日原 +朝日向 +朝日奈 +朝日山 +朝日川 +朝日田 +朝日藤 +朝日野 +朝明 +朝景 +朝月 +朝木 +朝末 +朝本 +朝村 +朝来 +朝来野 +朝松 +朝枝 +朝柄 +朝栄 +朝根 +朝桐 +朝森 +朝槻 +朝橋 +朝武 +朝武士 +朝比 +朝比奈 +朝民 +朝水 +朝永 +朝江 +朝池 +朝沢 +朝河 +朝治 +朝沼 +朝波 +朝津 +朝浜 +朝浦 +朝浪 +朝海 +朝渓 +朝溪 +朝澤 +朝瀬 +朝火 +朝烏 +朝熊 +朝生 +朝田 +朝町 +朝留 +朝直 +朝矢 +朝秀 +朝稲 +朝穂 +朝立 +朝緑 +朝美 +朝羽 +朝耒 +朝耒野 +朝胡 +朝船 +朝良 +朝芝 +朝苗 +朝若 +朝草 +朝蔭 +朝藤 +朝蜘 +朝西 +朝見 +朝谷 +朝貝 +朝賀 +朝越 +朝輝 +朝辺 +朝辻 +朝迫 +朝部 +朝酌 +朝酔 +朝里 +朝重 +朝野 +朝野辺 +朝鍋 +朝長 +朝間 +朝陰 +朝陽 +朝隅 +朝隈 +朝雄 +朝雛 +朝雲 +朝霧 +朝顔 +朝風 +朝飛 +朝香 +朝馬 +朝鳥 +朝鳴 +朝鵜 +朝黄 +期 +期上 +朧 +朧毛 +朧気 +朧氣 +朧谷 +木 +木々川 +木々津 +木々羅 +木の内 +木の本 +木の脇 +木ノ上 +木ノ下 +木ノ井 +木ノ元 +木ノ内 +木ノ切 +木ノ原 +木ノ口 +木ノ宮 +木ノ山 +木ノ島 +木ノ嶋 +木ノ嶌 +木ノ川 +木ノ平 +木ノ戸 +木ノ本 +木ノ村 +木ノ根 +木ノ桐 +木ノ瀬 +木ノ脇 +木ノ花 +木一 +木丈 +木三田 +木上 +木下 +木下内 +木下川 +木与田 +木並 +木中 +木串 +木丸 +木主 +木久 +木久家 +木久山 +木久田 +木之上 +木之下 +木之井 +木之元 +木之内 +木之前 +木之宮 +木之崎 +木之本 +木之村 +木之根 +木之江 +木之瀬 +木之田 +木之脇 +木乕 +木了 +木井 +木井直 +木亦 +木京 +木仏寺 +木付 +木代 +木代成 +木代目 +木伏 +木住 +木住野 +木佐 +木佐一 +木佐木 +木佐森 +木佐美 +木佐谷 +木佐貫 +木佛寺 +木作 +木保 +木保田 +木俣 +木俵 +木倉 +木倉谷 +木元 +木光 +木全 +木公 +木具 +木内 +木出 +木出崎 +木出嵜 +木刀 +木分 +木切倉 +木刕 +木利 +木前 +木割 +木劦 +木勢 +木匠 +木南 +木卜 +木原 +木原山 +木原田 +木又 +木叉 +木友 +木反田 +木口 +木口屋 +木古 +木司 +木吉 +木名瀬 +木呂場 +木呂子 +木和 +木和村 +木和田 +木和面 +木咲 +木圓 +木土 +木地 +木地光 +木地尾 +木地山 +木地平 +木地本 +木地村 +木地谷 +木坂 +木坊子 +木坪 +木城 +木埜 +木埜下 +木埜山 +木堂 +木場 +木場崎 +木場本 +木場田 +木場谷 +木場迫 +木場野 +木塚 +木塲 +木塲迫 +木境 +木売 +木多 +木多村 +木多浦 +木多良 +木多見 +木天 +木太 +木太久 +木奈崎 +木奥 +木嬰 +木子 +木学 +木學 +木守 +木安 +木実 +木実谷 +木室 +木宮 +木家 +木家下 +木宿 +木寅 +木密 +木富 +木實 +木實谷 +木寺 +木対 +木寿 +木對 +木尾 +木屋 +木屋尾 +木屋川内 +木屋村 +木屋路 +木屋野 +木履 +木山 +木山沢 +木山澤 +木山田 +木岐 +木岡 +木峰 +木島 +木崎 +木崎原 +木嵜 +木嶋 +木嶋谷 +木嶌 +木川 +木川田 +木工 +木工本 +木左木 +木師 +木師本 +木幡 +木平 +木床 +木庭 +木庭袋 +木建 +木引 +木形 +木影 +木待 +木徳 +木志 +木志根 +木志田 +木性 +木成 +木我 +木戸 +木戸上 +木戸元 +木戸内 +木戸出 +木戸口 +木戸地 +木戸坂 +木戸場 +木戸屋 +木戸岡 +木戸崎 +木戸川 +木戸本 +木戸村 +木戸浦 +木戸田 +木戸秋 +木戸脇 +木戸西 +木戸谷 +木戸間 +木房 +木所 +木持 +木挽 +木挽屋 +木斉 +木斎 +木方 +木明 +木易 +木星 +木春 +木時 +木暮 +木更津 +木曽 +木曽原 +木曽尾 +木曽山 +木曽川 +木曽林 +木曽田 +木曽谷 +木曽野 +木曾 +木曾原 +木曾山 +木曾川 +木曾田 +木曾野 +木月 +木末 +木本 +木杉 +木村 +木村田 +木村谷 +木束 +木束地 +木杢 +木東 +木枕 +木林 +木枝 +木枯 +木柑子 +木柳 +木柴 +木栖 +木栗 +木根 +木根内 +木根原 +木根森 +木根淵 +木根渕 +木根田 +木桐 +木桧 +木梚 +木梨 +木梨子 +木棚 +木棟 +木森 +木椋 +木植 +木榑 +木槫 +木槻 +木樽 +木橋 +木檜 +木櫛 +木欒子 +木次 +木次井 +木次谷 +木歩士 +木母 +木氏 +木水 +木永 +木池谷 +木沢 +木沢畑 +木河 +木治 +木治屋 +木治間 +木波 +木波本 +木洞 +木津 +木津井 +木津内 +木津和 +木津喜 +木津川 +木津本 +木津田 +木津西 +木津谷 +木浦 +木浦原 +木浦木 +木浪 +木浪谷 +木淵 +木添 +木清 +木済 +木渓 +木渕 +木渡 +木渡路 +木溪 +木滑 +木滝 +木澤 +木澤畑 +木濟 +木瀧 +木瀬 +木無 +木熊 +木爪 +木牟礼 +木牟禮 +木牧 +木狭谷 +木理 +木生 +木田 +木田余 +木田山 +木田川 +木田村 +木田橋 +木田谷 +木田餘 +木甲斐 +木町 +木畑 +木畠 +木登 +木白 +木的 +木皮 +木皿 +木皿儀 +木皿木 +木盛 +木目 +木目沢 +木目澤 +木目田 +木矢 +木矢村 +木砂 +木福 +木科 +木種 +木稲 +木積 +木立 +木竜 +木端 +木竹 +木節 +木築 +木籐 +木籔 +木米 +木納 +木納谷 +木継 +木綱 +木網 +木綿 +木綿織 +木綿谷 +木練 +木織 +木羅 +木美 +木羽 +木股 +木脇 +木興 +木舎 +木舘 +木舟 +木舩 +木舩田 +木船 +木船田 +木良 +木色 +木花 +木苗 +木若 +木茂 +木菱 +木萬 +木落 +木葉 +木葉原 +木葭 +木蓋 +木蔭 +木蔵 +木薗 +木薮 +木藏 +木藤 +木藤古 +木藤岡 +木藤田 +木藤良 +木藪 +木虎 +木蜜 +木衛 +木裏 +木裳 +木西 +木見 +木見塚 +木見尻 +木見田 +木見谷 +木角 +木許 +木谷 +木谷村 +木谷田 +木谷畑 +木貞 +木賀 +木賀沢 +木賀澤 +木賀田 +木賊 +木賊川 +木賣 +木越 +木越谷 +木路 +木輪 +木辺 +木辻 +木近 +木迫 +木透 +木通 +木造 +木道 +木達 +木邉 +木邊 +木邑 +木邨 +木邸 +木郡 +木部 +木部崎 +木部石 +木郷 +木都 +木都老 +木里 +木野 +木野下 +木野井 +木野元 +木野内 +木野勢 +木野口 +木野宮 +木野山 +木野島 +木野崎 +木野戸 +木野本 +木野村 +木野瀬 +木野田 +木野目 +木野知 +木野谷 +木野邑 +木金 +木鉛 +木鉢 +木鋤 +木鋪 +木鎌 +木長 +木間 +木間塚 +木間瀬 +木闇 +木阪 +木附 +木附沢 +木附澤 +木陰 +木露 +木頃 +木須 +木須井 +木須田 +木頭 +木飼 +木館 +木香 +木馬 +木高 +木鷺 +木齊 +木龍 +未口 +未吉 +未崎 +未広 +未松 +未永 +未継 +未至磨 +未谷 +末 +末一 +末上 +末下 +末並 +末中 +末丸 +末久 +末井 +末代 +末仲 +末住 +末佐 +末信 +末倉 +末元 +末光 +末兼 +末内 +末冨 +末冨士 +末利 +末包 +末原 +末友 +末口 +末吉 +末味 +末善 +末国 +末國 +末園 +末地 +末坂 +末塚 +末増 +末好 +末守 +末安 +末宗 +末定 +末実 +末宮 +末富 +末富士 +末實 +末尾 +末屋 +末山 +末岐 +末岡 +末岩 +末峯 +末峰 +末島 +末崎 +末嵜 +末嶋 +末川 +末常 +末平 +末広 +末廣 +末延 +末弘 +末影 +末徳 +末成 +末戸 +末房 +末政 +末方 +末時 +末朋 +末木 +末本 +末杉 +末村 +末松 +末林 +末柄 +末柏 +末栄 +末桝 +末棟 +末森 +末次 +末正 +末武 +末歳 +末水 +末永 +末沢 +末河 +末法 +末津 +末浦 +末浪 +末海 +末清 +末満 +末滝 +末滿 +末澤 +末瀧 +末瀬 +末田 +末畑 +末留 +末益 +末盛 +末石 +末神 +末福 +末秋 +末積 +末窪 +末竹 +末継 +末続 +末綱 +末繁 +末續 +末羽 +末脇 +末舛 +末良 +末花 +末芳 +末若 +末菅 +末葭 +末藤 +末行 +末西 +末角 +末谷 +末貞 +末賀 +末近 +末迫 +末通 +末道 +末部 +末里 +末重 +末野 +末金 +末釜 +末長 +末門 +末陰 +末高 +末鶴 +末鷹 +本 +本丁 +本上 +本下 +本並 +本中 +本中島 +本中野 +本丸 +本丹 +本久 +本久保 +本九町 +本二日市 +本井 +本井伝 +本井傳 +本京 +本仁 +本仏 +本仮屋 +本仲 +本伊 +本伝 +本伴 +本位傳 +本位田 +本住 +本佐 +本佛 +本作 +本保 +本信 +本倉 +本假屋 +本傳 +本儀 +本元 +本光 +本兼 +本内 +本内沢 +本円 +本出 +本前 +本前原 +本剛 +本加 +本勝 +本勢 +本北 +本匠 +本南 +本卦 +本原 +本口 +本古谷 +本台 +本司 +本合 +本吉 +本吉原 +本吉谷 +本同 +本名 +本君田 +本告 +本咲 +本図 +本国 +本國 +本園 +本圓 +本圖 +本土 +本地 +本地川 +本坂 +本坊 +本垣内 +本垰 +本城 +本城屋 +本城谷 +本埜 +本堀 +本堂 +本場 +本塚 +本塩 +本壽 +本多 +本夛 +本好 +本孝 +本守 +本安 +本定 +本実 +本室 +本宮 +本家 +本宿 +本富 +本寺 +本寿 +本射 +本導 +本小 +本尾 +本居 +本屋 +本屋敷 +本山 +本山崎 +本岐 +本岡 +本岩 +本岸 +本峯 +本島 +本崎 +本嵜 +本嶋 +本嶌 +本川 +本巣 +本市 +本常 +本幡 +本干尾 +本平 +本広 +本庄 +本庄屋 +本庄谷 +本底 +本座 +本庶 +本康 +本廣 +本延 +本弓 +本弘 +本強矢 +本彦 +本影 +本後 +本徳 +本応 +本忠 +本惣 +本慶 +本成 +本戸 +本房 +本所 +本手 +本折 +本持 +本掘 +本摩 +本政 +本方 +本日 +本明 +本春 +本有 +本望 +本木 +本木下 +本末 +本杉 +本村 +本条 +本東 +本東地 +本松 +本林 +本枝 +本柳 +本根 +本梅 +本條 +本梶 +本棒 +本森 +本椙 +本槁 +本横山 +本樫 +本橋 +本正 +本武 +本殿 +本母 +本比田 +本毛 +本水 +本永 +本江 +本池 +本沖 +本沢 +本河 +本治 +本泉 +本法院 +本波 +本津 +本浄 +本浜 +本浦 +本浪 +本海 +本淨 +本淵 +本清 +本渕 +本渡 +本満 +本溜 +本滝 +本澤 +本濃 +本濱 +本瀧 +本瀬 +本瀬戸 +本炭 +本片山 +本牧 +本猪木 +本玉 +本瓦 +本生 +本田 +本田原 +本田山 +本由 +本町 +本畑 +本畝 +本畠 +本畠中 +本登 +本白水 +本盛 +本目 +本直 +本眞 +本真 +本矢 +本石 +本石田 +本砂 +本砥 +本磯 +本礒 +本神 +本祥 +本禄 +本福 +本秀 +本種 +本窪 +本窪田 +本竃 +本竈 +本立 +本竜 +本竹 +本管 +本組 +本結 +本綱 +本網 +本繁 +本美 +本羽 +本肝 +本脇 +本臼 +本舘 +本舩坂 +本船坂 +本良 +本芳 +本若 +本茂 +本草野 +本荘 +本荘谷 +本莊 +本菅 +本萩 +本萱 +本落 +本葉 +本葭 +本蔵 +本薗 +本藏 +本藤 +本行 +本街 +本袋 +本西 +本見 +本覚 +本角 +本計 +本誉 +本調 +本諏訪 +本谷 +本谷内 +本貞 +本賀 +本越 +本車田 +本近 +本迫 +本造 +本道 +本遠 +本邑 +本那 +本邨 +本部 +本郷 +本郷谷 +本里 +本重 +本野 +本釘 +本釜 +本針 +本銅 +本銚 +本鍋 +本鍋田 +本鍛治 +本長 +本長谷 +本門 +本開 +本間 +本阪 +本防 +本阿 +本阿弥 +本阿彌 +本陣 +本霊 +本領 +本願 +本館 +本馬 +本馬場 +本高 +本高屋 +本鬼 +本麻 +本龍 +札 +札ノ内 +札ノ木 +札ノ辻 +札元 +札内 +札埜 +札堂 +札場 +札塲 +札山 +札岡 +札川 +札抜 +札木 +札本 +札田 +札立 +札脇 +札葉 +札谷 +札軒 +札辻 +札野 +札雪 +朱 +朱亀 +朱原 +朱城 +朱宮 +朱家 +朱山 +朱島 +朱川 +朱戸 +朱本 +朱村 +朱桃 +朱牟田 +朱田 +朱矢 +朱膳寺 +朱藤 +朱谷 +朱通 +朱里 +朱野 +朱雀 +朱雀井 +朱雀野 +朱鞘 +朱鷺田 +朴井 +朴元 +朴原 +朴山 +朴峠 +朴木 +朴木原 +朴本 +朴村 +朴沢 +朴澤 +朴田 +朴舘 +朴谷 +朴養 +朴館 +朶 +机 +机元 +机地 +机谷 +朽原 +朽名 +朽垣内 +朽平 +朽方 +朽木 +朽本 +朽津 +朽綱 +朽網 +朽葉 +朽見 +朽谷 +杁山 +杁本 +杁江 +权田 +杆鞭 +杇崎 +杇木 +杉 +杉の目 +杉ノ上 +杉ノ下 +杉ノ内 +杉ノ原 +杉ノ木 +杉ノ目 +杉万 +杉上 +杉下 +杉丘 +杉並 +杉中 +杉丸 +杉乃 +杉乃下 +杉久 +杉久保 +杉之下 +杉之内 +杉之原 +杉之尾 +杉之目 +杉之間 +杉井 +杉保 +杉信 +杉俣 +杉倉 +杉元 +杉先 +杉光 +杉全 +杉八合 +杉内 +杉分 +杉前 +杉原 +杉原井 +杉友 +杉口 +杉吉 +杉名 +杉園 +杉坂 +杉垣 +杉埜 +杉埼 +杉堀 +杉場 +杉塚 +杉多 +杉妻 +杉守 +杉安 +杉宮 +杉富 +杉寺 +杉尾 +杉居 +杉屋 +杉屋敷 +杉山 +杉山田 +杉岡 +杉岳 +杉峠 +杉峯 +杉峰 +杉島 +杉崎 +杉嵜 +杉嶋 +杉嶌 +杉川 +杉左近 +杉市 +杉平 +杉広 +杉座 +杉廣 +杉延 +杉建 +杉弘 +杉形 +杉恵 +杉惠 +杉慰 +杉戸 +杉所 +杉持 +杉政 +杉方 +杉木 +杉末 +杉本 +杉村 +杉杖 +杉東 +杉松 +杉林 +杉枝 +杉柳 +杉根 +杉森 +杉橋 +杉正 +杉殿 +杉水 +杉水流 +杉永 +杉江 +杉池 +杉沢 +杉河 +杉沼 +杉泊 +杉津 +杉浜 +杉浦 +杉淵 +杉渓 +杉渕 +杉滝 +杉澤 +杉瀧 +杉瀬 +杉焼 +杉琴 +杉生 +杉田 +杉田屋 +杉町 +杉畑 +杉畠 +杉盛 +杉目 +杉矢 +杉石 +杉砂 +杉窪 +杉立 +杉端 +杉竹 +杉箸 +杉籔 +杉能 +杉脇 +杉臣 +杉舘 +杉舩 +杉船 +杉若 +杉茂 +杉薗 +杉薮 +杉藤 +杉裏 +杉西 +杉見 +杉角 +杉谷 +杉貞 +杉貴 +杉足 +杉辺 +杉迫 +杉道 +杉達 +杉邑 +杉邨 +杉部 +杉里 +杉野 +杉野原 +杉野尾 +杉野本 +杉野森 +杉野目 +杉野谷 +杉金 +杉長 +杉間 +杉阪 +杉館 +杉香 +杉馬場 +杉高 +李 +李原 +李木 +李沢 +李澤 +李田 +李谷 +杏 +杏中 +杏井 +杏山 +杏川 +杏村 +杏橋 +杏西 +材井 +材原 +材寄 +材木 +材木谷 +材本 +材津 +材野 +村 +村万 +村上 +村下 +村並 +村中 +村中田 +村串 +村丸 +村主 +村久保 +村久木 +村亀 +村井 +村井田 +村仲 +村住 +村佐 +村信 +村側 +村儀 +村元 +村先 +村光 +村兼 +村内 +村冨 +村出 +村刺 +村前 +村加 +村勇 +村勢 +村勧 +村北 +村卸 +村原 +村友 +村取 +村口 +村古 +村司 +村合 +村吉 +村名 +村君 +村和 +村国 +村國 +村土 +村地 +村坂 +村垣 +村垣内 +村城 +村埜 +村堀 +村場 +村塚 +村壽 +村外 +村多 +村大 +村太 +村奈 +村奈嘉 +村奥 +村子 +村守 +村安 +村実 +村宮 +村家 +村寄 +村富 +村實 +村寿 +村尻 +村尾 +村居 +村屋 +村山 +村岡 +村岬 +村岸 +村島 +村崎 +村嵜 +村嶋 +村嶌 +村川 +村市 +村平 +村廻 +村形 +村往 +村恵 +村惠 +村戸 +村手 +村持 +村政 +村敷 +村斉 +村斎 +村新 +村方 +村木 +村末 +村本 +村杉 +村杜 +村東 +村松 +村林 +村枝 +村枩 +村栃 +村栄 +村梶 +村森 +村椙 +村椿 +村榮 +村槁 +村槇 +村槙 +村樫 +村橋 +村櫛 +村次 +村正 +村武 +村永 +村江 +村池 +村沢 +村河 +村治 +村泉 +村波 +村津 +村浜 +村浦 +村浪 +村添 +村清 +村滝 +村澤 +村濱 +村瀧 +村瀬 +村片 +村牧 +村生 +村田 +村田谷 +村畑 +村留 +村畠 +村益 +村矢 +村知 +村石 +村磯 +村礒 +村社 +村神 +村福 +村穂 +村端 +村竹 +村繁 +村脇 +村舘 +村花 +村若 +村蒔 +村蕃 +村藤 +村行 +村西 +村見 +村角 +村詰 +村谷 +村貫 +村賀 +村賀多 +村越 +村跡 +村路 +村輿 +村辺 +村辻 +村迫 +村道 +村邉 +村邊 +村部 +村里 +村重 +村野 +村野井 +村金 +村釘 +村長 +村門 +村間 +村関 +村阪 +村防 +村陰 +村雄 +村雨 +村雲 +村霜 +村鞘 +村頭 +村館 +村馬 +村高 +村鳥 +村﨏 +杓井 +杓伝 +杓子 +杓子尾 +杓子屋 +杓居 +杓永 +杓瀬 +杓田 +杓谷 +杓野 +杖下 +杖之上 +杖先 +杖原 +杖口 +杖子 +杖宗 +杖尻 +杖崎 +杖抜 +杖本 +杖村 +杖池 +杖田 +杖谷 +杖野 +杖野久保 +杜 +杜下 +杜倉 +杜原 +杜吉 +杜塚 +杜多 +杜山 +杜岡 +杜崎 +杜川 +杜師 +杜本 +杜氏 +杜沢 +杜澤 +杜瀬 +杜田 +杜腰 +杜芳 +杜若 +杝 +杞山 +杞川 +杞本 +杞根 +束 +束元 +束前 +束原 +束尾 +束岡 +束崎 +束川 +束木原 +束本 +束村 +束松 +束河 +束田 +束稲 +束花 +束野 +杠 +杠葉 +条 +条々 +条元 +条内 +条川 +条敷 +条時 +条楽 +条生 +条田 +条谷 +条辺 +条連 +条邊 +条野 +杢 +杢三 +杢中 +杢代 +杢例 +杢保 +杢元 +杢内 +杢出 +杢原 +杢大 +杢子 +杢家 +杢尾 +杢屋 +杢師 +杢木 +杢本 +杢生 +杢田 +杢谷 +杢重 +杢野 +杣 +杣ケ西 +杣与 +杣井 +杣出 +杣原 +杣友 +杣取 +杣場 +杣塲 +杣山 +杣崎 +杣川 +杣庄 +杣戸 +杣木 +杣本 +杣林 +杣沢 +杣津 +杣澤 +杣田 +杣畑 +杣谷 +杣野 +杤 +杤下 +杤丸 +杤久保 +杤内 +杤原 +杤垣内 +杤堀 +杤尾 +杤山 +杤岡 +杤川 +杤平 +杤木 +杤本 +杤田 +杤畠 +杤藤 +杤谷 +杤金 +来 +来下 +来丸 +来代 +来会 +来住 +来住南 +来住野 +来原 +来司 +来場 +来多 +来女木 +来守谷 +来実 +来宮 +来山 +来島 +来崎 +来嶋 +来嶌 +来川 +来待 +来戸 +来摩 +来本 +来村 +来栖 +来栖川 +来次 +来正 +来沢 +来海 +来海谷 +来生 +来田 +来田村 +来留島 +来目 +来福 +来米 +来藤 +来見 +来見田 +来谷 +来迎 +来野 +来間 +来須 +来馬 +杪谷 +杭 +杭ノ瀬 +杭全 +杭出 +杭升 +杭原 +杭岡 +杭本 +杭東 +杭瀬 +杭田 +杭谷 +杭迫 +杭野 +杯本 +東 +東ケ埼 +東ケ島 +東ケ崎 +東ケ嵜 +東一 +東一坊 +東一昉 +東万 +東三条 +東上 +東上別符 +東上床 +東上里 +東上門 +東下 +東与那覇 +東世古 +東中 +東中園 +東中尾 +東中屋 +東中川 +東中村 +東中薗 +東中道 +東中野 +東中須 +東丸 +東乃 +東久 +東久世 +東久保 +東久邇 +東久部良 +東之園 +東之薗 +東九 +東九條 +東二町 +東五十川 +東井 +東井上 +東京 +東亭 +東仁田 +東仙 +東代 +東代宮 +東仮屋 +東仲 +東仲与根 +東仲村 +東仲與根 +東仲里 +東伊牟田 +東伏見 +東住 +東佐古 +東使 +東來 +東保 +東保木 +東俣 +東倉 +東候 +東假屋 +東側 +東偽 +東儀 +東元 +東光 +東入來 +東入来 +東八重 +東兼久 +東内 +東内原 +東円 +東冨 +東出 +東別府 +東前 +東前門 +東力 +東功 +東勢 +東北 +東南 +東原 +東原口 +東又 +東口 +東古 +東司 +東司丘 +東合 +東吉 +東吉原 +東名 +東后 +東向 +東吾 +東呂木 +東和田 +東嘉弥真 +東嘉彌真 +東四柳 +東国 +東国原 +東國原 +東園 +東地 +東地井 +東坂 +東坊 +東坊城 +東垂水 +東垣 +東垣内 +東垣外 +東埀水 +東城 +東埜 +東堀 +東堂 +東堂園 +東堤 +東場 +東塚 +東壱 +東外門 +東大園 +東大寺 +東大島 +東大嶺 +東大森 +東大浜 +東大田 +東大薗 +東大路 +東大野 +東太田 +東奥 +東妻 +東孤 +東学 +東宅 +東宇 +東宇里 +東定 +東宝 +東実 +東宮 +東家 +東富 +東寺 +東小園 +東小川 +東小橋川 +東小浜 +東小薗 +東小路 +東小野 +東尾 +東居 +東屋 +東屋敷 +東山 +東山崎 +東山盛 +東岡 +東岩 +東岩井 +東岱 +東岸 +東峪 +東峯 +東峰 +東島 +東崎 +東崎原 +東嵩西 +東嶋 +東嶌 +東嶺 +東川 +東川上 +東川内 +東川原 +東川平 +東巻原 +東市 +東帰 +東常 +東平 +東庄 +東府 +東度 +東当 +東影 +東後 +東後藤 +東御建田 +東徳嶺 +東志 +東恩名 +東恩納 +東成底 +東我謝 +東戸 +東房 +東所 +東手 +東提 +東新 +東新城 +東新家 +東新川 +東方 +東方田 +東日 +東日下 +東旭 +東昌 +東明 +東木 +東木場 +東木谷 +東末 +東本 +東本地 +東村 +東条 +東杢比野 +東来 +東松 +東林 +東枝 +東柳 +東根 +東根作 +東桂木 +東桃 +東桜 +東梅 +東條 +東森 +東榊 +東榎田 +東槇 +東構 +東槙 +東樋口 +東権 +東樹 +東橋 +東櫻 +東次呂久 +東歌 +東正 +東正路 +東武 +東比嘉 +東水 +東水流 +東永 +東江 +東池 +東沖 +東沢 +東河 +東泉 +東泊 +東波 +東洋 +東洞 +東津 +東流 +東浄 +東浜 +東浦 +東海 +東海林 +東海枝 +東海谷 +東涌 +東淨 +東深沢 +東深澤 +東淵 +東添 +東清 +東渓 +東渕 +東渡 +東湖 +東源 +東溟 +東滝 +東漸 +東潟 +東澗 +東澤 +東濃 +東濱 +東瀧 +東瀬 +東瀬戸 +東瀬野 +東灘 +東照 +東照寺 +東爪 +東父岡 +東牧 +東牧原 +東牧野 +東狐 +東猴 +東玉盛 +東王地 +東現 +東生 +東甫 +東田 +東田中 +東田盛 +東町 +東畑 +東留 +東畝 +東畠 +東當 +東白金 +東盛 +東目 +東眞 +東真 +東矢 +東石 +東福 +東福寺 +東稔 +東稲葉 +東穂 +東穗 +東窪 +東童 +東端 +東竹西 +東等 +東筋 +東篠 +東籔 +東米盛 +東納 +東絛 +東羅 +東美 +東耀 +東耕 +東脇 +東膳 +東與那覇 +東舎 +東舘 +東舟道 +東船道 +東良 +東芝 +東芦谷 +東苑 +東若 +東萩原 +東落 +東葭 +東蓮寺 +東蔵盛 +東蕨 +東薗 +東薮 +東藏盛 +東藤 +東藪 +東裏 +東西 +東西田 +東見 +東覚 +東覺 +東角 +東角井 +東護 +東谷 +東谷内 +東谷口 +東賀 +東越 +東路 +東軒 +東農 +東辺地 +東辻 +東辻野 +東迎 +東近 +東迫 +東連寺 +東道 +東邊地 +東邑 +東邦 +東邨 +東郡 +東部 +東郷 +東都 +東里 +東重 +東野 +東野村 +東野谷 +東金 +東金城 +東金嶺 +東鉄 +東長 +東長浜 +東長濱 +東長田 +東門 +東門口 +東門田 +東閑 +東間 +東阪 +東院 +東陰地 +東陽 +東雲 +東面 +東頭 +東風 +東風上 +東風平 +東風浜 +東風浦 +東風濱 +東風谷 +東風輪 +東館 +東馬 +東馬場 +東馬塲 +東鬼 +東鶴 +東鶴園 +東麻 +東麻生原 +東黒島 +東𡌛 +東𡵸 +杲 +杲田 +杵坂 +杵塚 +杵多 +杵家 +杵屋 +杵岩 +杵島 +杵崎 +杵嶋 +杵川 +杵村 +杵淵 +杵渕 +杵田 +杵築 +杵谷 +杵鞭 +杷野 +杼元 +杼原 +杼山 +杼木 +杼本 +杼村 +杼森 +杼窪 +杼谷 +松 +松の尾 +松の脇 +松ガ野 +松ケ下 +松ケ中 +松ケ井 +松ケ峠 +松ケ島 +松ケ崎 +松ケ平 +松ケ枝 +松ケ根 +松ケ沢 +松ケ浦 +松ケ澤 +松ケ瀬 +松ケ角 +松ケ谷 +松ケ迫 +松ケ野 +松ノ下 +松ノ井 +松ノ元 +松ノ内 +松ノ尾 +松ノ木 +松ノ段 +松ノ谷 +松一 +松七五三 +松三 +松上 +松下 +松下田 +松世 +松丘 +松並 +松並木 +松中 +松丸 +松乃 +松久 +松久保 +松之 +松之下 +松之内 +松之尾 +松之平 +松之木 +松之本 +松之段 +松之浦 +松之舎 +松之迫 +松二 +松井 +松井川 +松井田 +松井端 +松仁 +松代 +松代屋 +松仲 +松任 +松任屋 +松任谷 +松伊 +松伏 +松会 +松位 +松住 +松佐 +松佐古 +松佐川 +松保 +松信 +松俵 +松倉 +松儀 +松元 +松八重 +松兼 +松内 +松冨 +松出 +松分 +松前 +松前屋 +松前谷 +松割 +松加本 +松勢 +松北 +松千 +松南 +松原 +松友 +松口 +松古 +松台 +松吉 +松名 +松名瀬 +松向 +松向寺 +松味 +松和 +松喜 +松嘉 +松四 +松圃 +松園 +松土 +松地 +松坂 +松垣 +松城 +松埜 +松埼 +松堀 +松堂 +松場 +松塚 +松塲 +松壽 +松多 +松大 +松大路 +松夲 +松奈木 +松奥 +松好 +松姫 +松宇 +松守 +松安 +松宗 +松実 +松室 +松宮 +松家 +松富 +松富士 +松實 +松寺 +松寿 +松尻 +松尾 +松尾崎 +松尾澤 +松尾田 +松尾谷 +松尾賀 +松居 +松屋 +松山 +松岡 +松岡屋 +松岩 +松岳 +松岸 +松峠 +松峯 +松峰 +松峴 +松島 +松島屋 +松崎 +松嵜 +松嶋 +松嶌 +松嶠 +松嶺 +松川 +松川原 +松川渡 +松左川 +松巾 +松布 +松帆 +松常 +松干 +松平 +松広 +松広屋 +松庫 +松廣 +松廣屋 +松延 +松廷 +松廼辺 +松弘 +松形 +松影 +松徳 +松成 +松戸 +松房 +松扉 +松手 +松折 +松持 +松掛 +松政 +松新 +松方 +松日 +松日楽 +松日樂 +松日比 +松明 +松景 +松會 +松月 +松有 +松木 +松木囿 +松木園 +松木場 +松木平 +松木田 +松木薗 +松木谷 +松未 +松末 +松本 +松本山 +松杉 +松村 +松林 +松枝 +松柏 +松柳 +松柴 +松栄 +松根 +松梅 +松梛 +松梨 +松梶 +松棟 +松森 +松植 +松榮 +松槁 +松樹 +松橋 +松武 +松比良 +松毛 +松気之宮 +松水 +松永 +松汐 +松江 +松江川 +松池 +松沢 +松河 +松沼 +松波 +松津 +松浜 +松浦 +松浪 +松浮 +松浴 +松海 +松涛 +松淵 +松添 +松清 +松渓 +松渕 +松渡 +松満 +松溪 +松滝 +松澤 +松濤 +松濱 +松瀬 +松灘 +松為 +松熊 +松爲 +松猪 +松王 +松琴 +松生 +松甫 +松田 +松田原 +松田島 +松田谷 +松由 +松男 +松畑 +松留 +松畠 +松登 +松百 +松皮 +松盛 +松目 +松直 +松相 +松真 +松矢 +松石 +松碕 +松神 +松禾 +松秋 +松程 +松穂 +松穗 +松窄 +松窪 +松立 +松竜 +松竝 +松端 +松竹 +松竹谷 +松笠 +松篠 +松籠 +松納 +松綱 +松緑 +松緒 +松縄 +松繁 +松繩 +松羅 +松美 +松義 +松羽 +松羽佐 +松考 +松股 +松背 +松胴 +松能 +松脇 +松脊 +松臺 +松舎 +松舘 +松舟 +松船 +松良 +松色 +松芝 +松花 +松芳 +松苗 +松若 +松英 +松茂 +松茂渡 +松茂良 +松草 +松荘 +松菱 +松落 +松葉 +松葉井 +松葉佐 +松葉口 +松葉屋 +松葉瀬 +松葉谷 +松蔭 +松蔵 +松薗 +松藏 +松藤 +松行 +松裏 +松西 +松見 +松角 +松谷 +松谷内 +松貝 +松賀 +松越 +松路 +松身 +松軒 +松輪 +松農 +松辺 +松辻 +松近 +松迫 +松迫間 +松邑 +松那 +松邦 +松邨 +松部 +松郷 +松酒 +松里 +松里軒 +松重 +松野 +松野下 +松野井 +松野内 +松野尾 +松野平 +松野木 +松野本 +松野谷 +松野郷 +松金 +松鐘 +松長 +松長根 +松門 +松門字 +松門寺 +松間 +松阪 +松阪谷 +松阿弥 +松阿彌 +松陰 +松陵 +松隅 +松隆 +松隈 +松雄 +松雪 +松露 +松音 +松頭 +松風 +松風呂 +松養 +松館 +松香 +松馬 +松馬場 +松高 +松魚 +松鳥 +松鵜 +松鶴 +松鷹 +松鹿 +松麿 +松黒 +松鼻 +松龍 +松𡌛 +板 +板上 +板下 +板下部 +板並 +板久 +板久保 +板乗 +板井 +板井川 +板井田 +板付 +板保 +板倉 +板元 +板先 +板八 +板内 +板切 +板割 +板升 +板原 +板取 +板口 +板坂 +板垣 +板場 +板塲 +板子 +板室 +板宮 +板家 +板寺 +板尾 +板屋 +板屋地 +板屋越 +板山 +板岡 +板島 +板崎 +板嶋 +板嶌 +板川 +板平 +板庇 +板床 +板庭 +板戸 +板持 +板摺 +板敷 +板木 +板木平 +板本 +板杉 +板村 +板東 +板東橋 +板松 +板林 +板柿 +板根 +板森 +板楠 +板槁 +板橋 +板殿 +板永 +板沢 +板河 +板波 +板津 +板津呂 +板浦 +板浪 +板淵 +板清 +板渕 +板澤 +板瀬 +板狩 +板生 +板田 +板矢 +板石 +板端 +板箭 +板緑 +板美 +板羽 +板脇 +板舛 +板良敷 +板花 +板蔭 +板蔵 +板藤 +板衛 +板西 +板見 +板見谷 +板谷 +板谷越 +板賀 +板越 +板辺 +板迫 +板邊 +板部 +板郷 +板里 +板重 +板野 +板金 +板間 +板阪 +板鞍 +板頭 +板高 +板鳥 +板鼻 +极木 +枅川 +枇々木 +枇把田 +枇本 +枇杷 +枇杷原 +枇杷友 +枇杷岸 +枇杷木 +枇杷本 +枇杷橋 +枇杷田 +枇杷谷 +枇杷阪 +枇榔 +枇谷 +枋山 +枋木 +枋谷 +枋迫 +枌 +枌原 +枌尾 +枌山 +枌岡 +枌本 +枌谷 +枌野 +析口 +枓木 +枕辺 +枕邉 +枕邊 +林 +林ケ谷 +林ノ下 +林ノ内 +林上 +林下 +林中 +林丸 +林之下 +林井 +林倉 +林元 +林内 +林出 +林原 +林口 +林園 +林地 +林垣 +林垣内 +林埜 +林埼 +林堂 +林家 +林寺 +林尻 +林尾 +林屋 +林山 +林岡 +林岸 +林島 +林崎 +林嵜 +林川 +林平 +林庄 +林志 +林戸 +林木 +林本 +林村 +林松 +林根 +林森 +林殿 +林沢 +林沼 +林添 +林瀬 +林田 +林石 +林竹 +林能 +林脇 +林腰 +林葉 +林薗 +林見 +林谷 +林越 +林辺 +林辻 +林迫 +林邉 +林邊 +林部 +林野 +林野下 +林金 +林間 +林阪 +林飛 +枚栂木 +枚田 +枛木澤 +果 +果瀬 +枝 +枝並 +枝中 +枝久保 +枝井 +枝信 +枝倉 +枝元 +枝光 +枝原 +枝口 +枝吉 +枝国 +枝國 +枝園 +枝垣 +枝尾 +枝岡 +枝岸 +枝島 +枝崎 +枝嶋 +枝川 +枝常 +枝平 +枝広 +枝廣 +枝折 +枝木 +枝本 +枝村 +枝松 +枝根 +枝森 +枝橋 +枝次 +枝正 +枝永 +枝沢 +枝波 +枝浪 +枝澤 +枝田 +枝畑 +枝窪 +枝茂川 +枝見 +枝谷 +枝迫 +枝連 +枝重 +枝野 +枝長 +枠山 +枠田 +枡 +枡一 +枡上 +枡中 +枡之内 +枡井 +枡元 +枡内 +枡原 +枡塚 +枡宇 +枡実 +枡家 +枡富 +枡尾 +枡居 +枡屋 +枡山 +枡岡 +枡崎 +枡嵜 +枡川 +枡平 +枡形 +枡方 +枡本 +枡村 +枡永 +枡沢 +枡渕 +枡潟 +枡澤 +枡田 +枡矢 +枡竹 +枡蔵 +枡藤 +枡見 +枡谷 +枡野 +枡鏡 +枡長 +枡𡌛 +枦 +枦下 +枦井 +枦元 +枦原 +枦口 +枦場 +枦山 +枦岡 +枦川 +枦木 +枦木原 +枦本 +枦村 +枦林 +枦段 +枦淵 +枦渕 +枦田 +枦畑 +枦込 +枦野 +枩下 +枩井 +枩倉 +枩原 +枩埜 +枩場 +枩尾 +枩山 +枩岡 +枩崎 +枩川 +枩本 +枩村 +枩林 +枩永 +枩池 +枩沢 +枩浦 +枩澤 +枩田 +枩葉 +枩藤 +枩西 +枩谷 +枩邑 +枩野 +枯木 +枯芝 +枳原 +枳本 +枳梖 +枳殻 +枳穀 +架場 +架田 +架谷 +架間 +枷下 +枷場 +枷本 +枸杞 +枻川 +柁 +柁原 +柁山 +柁川 +柁沢 +柁澤 +柁谷 +柄 +柄井 +柄原 +柄多 +柄夛 +柄子 +柄山 +柄島 +柄崎 +柄川 +柄戸 +柄木 +柄木田 +柄本 +柄松 +柄池 +柄沢 +柄津 +柄浦 +柄溝 +柄澤 +柄田 +柄目 +柄脇 +柄西 +柄谷 +柄越 +柄野 +柄須賀 +柆原 +柆生 +柆田 +柊 +柊ノ木 +柊中 +柊元 +柊原 +柊宇都 +柊屋 +柊山 +柊崎 +柊平 +柊木 +柊木野 +柊本 +柊沢 +柊澤 +柊田 +柊谷 +柊迫 +柊野 +柏 +柏下 +柏中 +柏丸 +柏井 +柏信 +柏俣 +柏倉 +柏元 +柏内 +柏分 +柏原 +柏原崎 +柏又 +柏口 +柏合 +柏坂 +柏城 +柏堂 +柏場 +柏塚 +柏多 +柏女 +柏子見 +柏尾 +柏居 +柏屋 +柏山 +柏岡 +柏島 +柏崎 +柏嵜 +柏嶋 +柏川 +柏工 +柏平 +柏床 +柏当 +柏戸 +柏手 +柏撫 +柏木 +柏木谷 +柏本 +柏村 +柏林 +柏枝 +柏柳 +柏梨田 +柏森 +柏槁 +柏樹 +柏橋 +柏櫓 +柏次 +柏比 +柏民 +柏沢 +柏沼 +柏浦 +柏淵 +柏渕 +柏瀬 +柏熊 +柏田 +柏當 +柏矢 +柏矢倉 +柏端 +柏舘 +柏葉 +柏蔵 +柏薮 +柏西 +柏谷 +柏輪 +柏迫 +柏部 +柏酒 +柏野 +柏野間 +柏館 +柑子山 +柑子木 +柑本 +柑谷 +染 +染中 +染也 +染井 +染伊 +染倉 +染分 +染原 +染宮 +染小 +染屋 +染山 +染岡 +染島 +染崎 +染川 +染手 +染木 +染本 +染村 +染林 +染森 +染橋 +染次 +染沢 +染河 +染浦 +染澤 +染瀬 +染田 +染田屋 +染矢 +染石 +染羽 +染菱 +染葉 +染谷 +染道 +染郷 +染野 +染野谷 +柘 +柘上 +柘原 +柘山 +柘川 +柘本 +柘桂 +柘植 +柘植井 +柘植山 +柘植野 +柘榴 +柘浦 +柘野 +柚 +柚ノ木 +柚ノ谷 +柚上 +柚下 +柚中 +柚久保 +柚之上 +柚之原 +柚之木 +柚井 +柚元 +柚原 +柚口 +柚園 +柚垣 +柚場 +柚山 +柚岡 +柚崎 +柚川 +柚平 +柚木 +柚木原 +柚木園 +柚木尾 +柚木山 +柚木崎 +柚木沢 +柚木澤 +柚木脇 +柚本 +柚村 +柚根 +柚森 +柚江 +柚沢 +柚洞 +柚津 +柚浅 +柚澤 +柚瀬 +柚田 +柚留木 +柚花 +柚葉 +柚谷 +柚賀 +柚野 +柚須 +柚鳥 +柞原 +柞山 +柞木 +柞木田 +柞磨 +柞野 +柤浦 +柤野 +柧木沢 +柧木澤 +柬理 +柬里 +柯 +柯王 +柰園 +柱 +柱井 +柱尾 +柱山 +柱本 +柱松 +柱谷 +柱野 +柳 +柳ケ水 +柳ケ瀬 +柳ノ +柳上 +柳下 +柳世 +柳丸 +柳久保 +柳之内 +柳井 +柳井原 +柳井戸 +柳井津 +柳井田 +柳井谷 +柳倉 +柳元 +柳内 +柳分 +柳別府 +柳勢 +柳北 +柳原 +柳取 +柳口 +柳吉 +柳咲 +柳園 +柳坂 +柳坊 +柳坪 +柳垂 +柳垣 +柳堀 +柳堂 +柳場 +柳多 +柳大路 +柳太 +柳子 +柳室 +柳家 +柳寺 +柳尾 +柳居 +柳屋 +柳山 +柳岡 +柳島 +柳崎 +柳嶋 +柳川 +柳川屋 +柳川瀬 +柳平 +柳幸 +柳弘 +柳戸 +柳曽 +柳木 +柳木田 +柳本 +柳村 +柳杭田 +柳松 +柳板 +柳林 +柳枝 +柳根 +柳森 +柳楽 +柳樂 +柳橋 +柳武 +柳水流 +柳江 +柳池 +柳沢 +柳沢屋 +柳河 +柳河瀬 +柳沼 +柳泉 +柳津 +柳浜 +柳浦 +柳淵 +柳清 +柳清水 +柳渕 +柳渡 +柳澤 +柳瀬 +柳父 +柳牛 +柳生 +柳生田 +柳田 +柳町 +柳畑 +柳矢 +柳石 +柳秀 +柳窪 +柳立 +柳竹 +柳笠 +柳箱 +柳箸 +柳美沢 +柳美澤 +柳舘 +柳花 +柳葉 +柳薗 +柳蘓 +柳衛 +柳見沢 +柳詰 +柳谷 +柳谷内 +柳賀瀬 +柳路 +柳農 +柳辺 +柳迫 +柳通 +柳道 +柳邉 +柳邊 +柳部 +柳郷 +柳里 +柳野 +柳雫 +柳静 +柳風呂 +柳館 +柳香 +柳鳥 +柳鶴 +柴 +柴ケ谷 +柴下 +柴中 +柴丸 +柴丹 +柴主 +柴久喜 +柴井 +柴代 +柴伐 +柴住 +柴作 +柴倉 +柴元 +柴入 +柴内 +柴冨 +柴冨田 +柴切 +柴刈 +柴北 +柴原 +柴又 +柴口 +柴台 +柴和 +柴土 +柴地 +柴坂 +柴垣 +柴埼 +柴塚 +柴墻 +柴多 +柴奥 +柴宮 +柴家 +柴富 +柴小屋 +柴小谷 +柴尾 +柴尾田 +柴居 +柴屋 +柴山 +柴岡 +柴峠 +柴峯 +柴峰 +柴島 +柴崎 +柴嵜 +柴嶺 +柴川 +柴平 +柴床 +柴建 +柴引 +柴戸 +柴折 +柴木 +柴本 +柴村 +柴林 +柴柳 +柴栄 +柴桃 +柴森 +柴榮 +柴橋 +柴永 +柴江 +柴沢 +柴沼 +柴泉 +柴波 +柴津 +柴浦 +柴海 +柴渕 +柴澤 +柴瀬 +柴燈 +柴牟田 +柴生 +柴生田 +柴田 +柴矢 +柴立 +柴端 +柴笠 +柴臺 +柴苅 +柴若 +柴草 +柴萩 +柴葉 +柴薮 +柴藤 +柴藪 +柴行 +柴西 +柴谷 +柴車 +柴辻 +柴迫 +柴道 +柴邨 +柴部 +柴里 +柴野 +柴門 +柴間 +柴関 +柴阪 +柴高 +柵 +柵原 +柵山 +柵木 +柵橋 +柵瀬 +柵田 +柾 +柾切沢 +柾切澤 +柾家 +柾尾 +柾屋 +柾岡 +柾川 +柾木 +柾本 +柾田 +柾谷 +柿 +柿ケ原 +柿ケ尾 +柿ケ野 +柿ノ内 +柿ノ木 +柿ノ谷 +柿ノ迫 +柿上 +柿下 +柿並 +柿中 +柿丸 +柿久 +柿久保 +柿之本 +柿井 +柿井田 +柿仲 +柿倉 +柿元 +柿内 +柿出 +柿副 +柿原 +柿口 +柿囿 +柿園 +柿坂 +柿坪 +柿城 +柿埜 +柿堺 +柿塚 +柿境 +柿宇土 +柿安 +柿実 +柿家 +柿實 +柿尾 +柿屋 +柿山 +柿岡 +柿島 +柿崎 +柿嵜 +柿嶋 +柿嶌 +柿川 +柿市 +柿平 +柿成 +柿戸 +柿手 +柿打 +柿木 +柿木原 +柿木園 +柿木山 +柿木田 +柿本 +柿村 +柿林 +柿栖 +柿根 +柿森 +柿永 +柿江 +柿沢 +柿沼 +柿浦 +柿添 +柿渕 +柿澤 +柿瀬 +柿爪 +柿田 +柿町 +柿畑 +柿畠 +柿白 +柿窪 +柿竝 +柿縄 +柿脇 +柿芝 +柿花 +柿葉 +柿薗 +柿藤 +柿西 +柿見 +柿谷 +柿迫 +柿部 +柿野 +柿野上 +柿野谷 +柿長 +柿間 +柿阪 +柿鶴 +栁濱 +栂 +栂並 +栂井 +栂原 +栂園 +栂坂 +栂安 +栂尾 +栂岡 +栂崎 +栂嵜 +栂木 +栂本 +栂村 +栂根 +栂森 +栂瀬 +栂谷 +栂谷内 +栂輪 +栂野 +栂野尾 +栃 +栃ケ岡 +栃下 +栃丸 +栃久保 +栃井 +栃倉 +栃元 +栃内 +栃原 +栃囿 +栃堀 +栃尾 +栃屋 +栃山 +栃岡 +栃島 +栃崎 +栃川 +栃平 +栃折 +栃木 +栃本 +栃村 +栃林 +栃棚 +栃森 +栃沢 +栃波 +栃洞 +栃澤 +栃田 +栃畠 +栃眞賀 +栃真賀 +栃窪 +栃籔 +栃羽 +栃薮 +栃藤 +栃藪 +栃谷 +栃迫 +栃野 +栃金 +栄 +栄久庵 +栄井 +栄代 +栄保 +栄倉 +栄元 +栄出 +栄利 +栄前田 +栄原 +栄口 +栄喜 +栄国 +栄土 +栄坂 +栄城 +栄塚 +栄多 +栄多谷 +栄子 +栄家 +栄居 +栄屋 +栄山 +栄岩 +栄島 +栄崎 +栄嶋 +栄嶌 +栄川 +栄徳 +栄月 +栄木 +栄本 +栄村 +栄東 +栄松 +栄林 +栄枝 +栄根 +栄森 +栄楽 +栄次 +栄永 +栄江 +栄沢 +栄治 +栄泉 +栄浪 +栄澤 +栄田 +栄畑 +栄留 +栄盛 +栄祝 +栄福 +栄笹 +栄羽 +栄花 +栄薗 +栄藤 +栄西 +栄角 +栄谷 +栄賀 +栄迫 +栄部 +栄野 +栄野元 +栄野川 +栄野比 +栄長 +栄門 +栄開 +栄阪 +栄隈 +栄馬 +栄鶴 +栓山 +栖井 +栖原 +栖宮 +栖山 +栖川 +栖本 +栖村 +栖田 +栖舘 +栖間 +栖関 +栖雲 +栖養 +栗 +栗ノ木迫 +栗三 +栗上 +栗下 +栗並 +栗中 +栗丸 +栗久 +栗之丸 +栗之宮 +栗之池 +栗之脇 +栗井 +栗作 +栗信 +栗俣 +栗元 +栗光 +栗内 +栗副 +栗加 +栗原 +栗又 +栗叉 +栗和田 +栗国 +栗園 +栗坂 +栗坪 +栗垣 +栗城 +栗埼 +栗場 +栗場石 +栗塚 +栗太 +栗子 +栗宇 +栗宗 +栗家 +栗尾 +栗屋 +栗屋野 +栗山 +栗岡 +栗岩 +栗峯 +栗島 +栗崎 +栗嵜 +栗嶋 +栗嶌 +栗川 +栗巣 +栗巣野 +栗幅 +栗平 +栗延 +栗廼 +栗形 +栗政 +栗方 +栗明 +栗木 +栗木原 +栗末 +栗本 +栗村 +栗林 +栗枝 +栗柄 +栗柳 +栗柴 +栗栖 +栗棟 +栗森 +栗楢 +栗橋 +栗正 +栗比 +栗毛 +栗毛野 +栗永 +栗江 +栗沢 +栗河 +栗波 +栗津 +栗洲 +栗浜 +栗浦 +栗添 +栗澤 +栗濱 +栗瀬 +栗焼 +栗熊 +栗牧 +栗生 +栗生沢 +栗生澤 +栗田 +栗畑 +栗盛 +栗目 +栗真 +栗矢 +栗石 +栗秋 +栗空 +栗繁 +栗股 +栗脇 +栗芝 +栗花 +栗花落 +栗若 +栗葉 +栗蔭 +栗藤 +栗虫 +栗西 +栗見 +栗谷 +栗谷川 +栗谷本 +栗賀 +栗辺 +栗迫 +栗部 +栗重 +栗野 +栗間 +栗阪 +栗須 +栗須谷 +栗飯原 +栗駒 +栞山 +栟田 +校条 +校條 +栢 +栢下 +栢之間 +栢元 +栢内 +栢分 +栢割 +栢原 +栢口 +栢垣 +栢場 +栢多 +栢尾 +栢岡 +栢島 +栢嶋 +栢工 +栢木 +栢木谷 +栢本 +栢村 +栢根 +栢森 +栢橋 +栢沼 +栢瀬 +栢田 +栢盛 +栢脇 +栢菅 +栢葉 +栢谷 +栢部 +栢野 +栢間 +栩中 +栩久保 +栩兼 +栩内 +栩原 +栩坂 +栩山 +栩川 +栩平 +栩木 +栩本 +栩田 +栩秋 +栩窪 +栩谷 +栩野 +株 +株丹 +株井 +株元 +株内 +株原 +株屋 +株屋根 +株崎 +株戸 +株木 +株本 +株柳 +株根 +株橋 +株田 +株竹 +株籔 +株薮 +株藪 +株谷 +株野 +栫 +栫井 +栫井園 +栫山 +栴檀 +核 +核藤 +根 +根〆 +根ケ山 +根ノ井 +根ノ木 +根上 +根上屋 +根中 +根之木 +根井 +根井路 +根仕切 +根住 +根來 +根來川 +根保 +根倉 +根元 +根兵 +根内 +根切田 +根前 +根北 +根占 +根原 +根反 +根口 +根古 +根古屋 +根古林 +根古谷 +根司 +根喜田 +根回 +根地島 +根地嶋 +根地戸 +根坂 +根垣 +根城 +根塚 +根子 +根守 +根宜 +根宣 +根家 +根小屋 +根小山 +根小田 +根尾 +根屋 +根山 +根岩 +根岸 +根峯 +根島 +根崎 +根嵜 +根川 +根市 +根布 +根布井 +根布原 +根布屋 +根布谷 +根布長 +根師 +根平 +根府 +根建 +根廻 +根引 +根張 +根形 +根志 +根戸内 +根方 +根日屋 +根木 +根木原 +根木地 +根木屋 +根木山 +根木島 +根木嶋 +根木村 +根木田 +根木谷 +根本 +根本内 +根村 +根来 +根来川 +根東 +根松 +根林 +根梨 +根森 +根橋 +根次金 +根武谷 +根比 +根水 +根沢 +根河 +根波 +根津 +根津谷 +根深 +根澤 +根無 +根生 +根田 +根田林 +根畑 +根目沢 +根目澤 +根矢 +根石 +根神 +根立 +根竹 +根笈 +根符 +根笹 +根箭 +根米 +根緒 +根縫 +根羽 +根耒 +根舛 +根芝 +根萩 +根葉 +根藤 +根角 +根谷 +根谷崎 +根賀 +根路銘 +根道 +根達 +根郷 +根酒 +根里 +根野 +根釜 +根鈴 +根門 +根間 +根附 +根頃 +根須 +根食 +根馬 +根鴻 +格井 +格井原 +格内 +格口 +格和 +格地 +格山 +格島 +格嶋 +格川 +格清 +格由 +格畑 +格矢 +格谷 +格重 +格野 +栽 +栽原 +栽松 +桁山 +桁谷 +桁野 +桂 +桂下 +桂井 +桂内 +桂出 +桂原 +桂口 +桂城 +桂宮 +桂尾 +桂屋 +桂山 +桂岡 +桂島 +桂嶋 +桂嶽 +桂川 +桂巻 +桂平 +桂徳 +桂木 +桂本 +桂林 +桂樹 +桂正 +桂沢 +桂浦 +桂澤 +桂田 +桂畑 +桂華 +桂藤 +桂谷 +桂野 +桂阪 +桂馬 +桃 +桃下 +桃世 +桃井 +桃住 +桃内 +桃北 +桃原 +桃吉 +桃園 +桃坂 +桃城 +桃塚 +桃宇 +桃実 +桃實 +桃尾 +桃山 +桃崎 +桃嵜 +桃川 +桃平 +桃木 +桃木野 +桃本 +桃村 +桃林 +桃枝 +桃柄 +桃根 +桃江 +桃沢 +桃津 +桃渓 +桃澤 +桃瀬 +桃生 +桃田 +桃盛 +桃薗 +桃谷 +桃辻 +桃里 +桃野 +案地 +案志 +案浦 +案済 +案田 +案納 +案藤 +案西 +案部 +案里 +案野 +案間 +案面 +桉田 +桐 +桐ケ久保 +桐ケ窪 +桐ケ谷 +桐ノ谷 +桐上 +桐下 +桐久井 +桐久保 +桐井 +桐元 +桐内 +桐原 +桐原本 +桐口 +桐吉 +桐地 +桐坂 +桐場 +桐子 +桐小林 +桐尾 +桐山 +桐岡 +桐島 +桐崎 +桐嶋 +桐嶺 +桐川 +桐戸 +桐敷 +桐明 +桐月 +桐木 +桐木平 +桐本 +桐村 +桐林 +桐枝 +桐栄 +桐森 +桐榮 +桐樋 +桐永 +桐江 +桐沢 +桐流 +桐浴 +桐淵 +桐渓 +桐渕 +桐溪 +桐澤 +桐生 +桐田 +桐畑 +桐石 +桐竹 +桐籐 +桐綱 +桐脇 +桐腰 +桐花 +桐萱 +桐葉 +桐藤 +桐谷 +桐貝 +桐貫 +桐越 +桐辺 +桐迫 +桐部 +桐野 +桐野江 +桐間 +桐高 +桑 +桑ケ谷 +桑上 +桑下 +桑中 +桑丸 +桑主 +桑久保 +桑之内 +桑井 +桑代 +桑住 +桑俣 +桑元 +桑先 +桑内 +桑前 +桑加 +桑北 +桑升 +桑南 +桑原 +桑原田 +桑又 +桑取 +桑口 +桑古 +桑司 +桑吉 +桑名 +桑園 +桑土 +桑地 +桑坂 +桑坪 +桑垣 +桑垣内 +桑城 +桑場 +桑塚 +桑多 +桑子 +桑宅 +桑守 +桑実 +桑室 +桑宮 +桑尾 +桑屋 +桑山 +桑岡 +桑島 +桑崎 +桑嶋 +桑嶌 +桑川 +桑幡 +桑平 +桑引 +桑形 +桑戸 +桑折 +桑月 +桑木 +桑木野 +桑本 +桑机 +桑村 +桑松 +桑林 +桑根 +桑森 +桑橋 +桑水 +桑水流 +桑永 +桑江 +桑沢 +桑波 +桑波田 +桑洞 +桑津 +桑津留 +桑海 +桑添 +桑渕 +桑満 +桑滝 +桑澤 +桑瀬 +桑理 +桑生 +桑田 +桑畑 +桑畠 +桑盛 +桑端 +桑羽 +桑葉 +桑藤 +桑見 +桑谷 +桑貝 +桑路 +桑辺 +桑迫 +桑邊 +桑邑 +桑那 +桑重 +桑野 +桑門 +桑間 +桑阪 +桑霍 +桑高 +桑鶴 +桒前 +桓本 +桔原 +桔川 +桔木 +桔梗 +桔梗原 +桔梗谷 +桔流 +桜 +桜ケ平 +桜下 +桜中 +桜久保 +桜井 +桜元 +桜内 +桜卯 +桜原 +桜又 +桜口 +桜台 +桜吉 +桜地 +桜坂 +桜堂 +桜場 +桜多 +桜宮 +桜小路 +桜尾 +桜居 +桜屋 +桜屋敷 +桜山 +桜岡 +桜島 +桜崎 +桜川 +桜庭 +桜戸 +桜打 +桜木 +桜木谷 +桜本 +桜松 +桜林 +桜枝 +桜栄 +桜根 +桜森 +桜橋 +桜武 +桜段 +桜永 +桜江 +桜沢 +桜河 +桜河内 +桜浜 +桜淵 +桜渕 +桜湯 +桜澤 +桜瀬 +桜田 +桜町 +桜畑 +桜畠 +桜目 +桜石 +桜窪 +桜糀 +桜美 +桜羽 +桜羽場 +桜花 +桜葉 +桜谷 +桜谷敷 +桜越 +桜野 +桜間 +桝 +桝一 +桝上 +桝下 +桝中 +桝之内 +桝井 +桝仲 +桝倉 +桝元 +桝内 +桝冨 +桝原 +桝友 +桝取 +桝口 +桝呑 +桝宇 +桝宗 +桝実 +桝室 +桝宮 +桝家 +桝富 +桝實 +桝尾 +桝居 +桝屋 +桝屋根 +桝山 +桝岡 +桝島 +桝崎 +桝川 +桝市 +桝平 +桝幸 +桝広 +桝形 +桝成 +桝方 +桝木 +桝本 +桝村 +桝林 +桝森 +桝概 +桝次 +桝水 +桝永 +桝江 +桝沢 +桝波 +桝浦 +桝淵 +桝添 +桝渕 +桝満 +桝潟 +桝澤 +桝甚 +桝田 +桝田屋 +桝矢 +桝石 +桝竹 +桝舎 +桝蔵 +桝藤 +桝裏 +桝見 +桝谷 +桝賀 +桝郷 +桝重 +桝野 +桝鏡 +桝長 +桝隅 +桝高 +桟 +桟原 +桟敷 +桟敷原 +桟敷野 +桧 +桧ケ谷 +桧ノ山 +桧下 +桧並 +桧井 +桧佐 +桧作 +桧前 +桧原 +桧口 +桧吉 +桧和田 +桧坂 +桧垣 +桧室 +桧尾 +桧山 +桧岡 +桧崎 +桧嵜 +桧川 +桧平 +桧座 +桧掛 +桧木 +桧木田 +桧本 +桧村 +桧杖 +桧林 +桧枝 +桧森 +桧槙 +桧沢 +桧波田 +桧浜 +桧浦 +桧渡 +桧澤 +桧物 +桧物谷 +桧田 +桧畑 +桧皮 +桧皮田 +桧皮谷 +桧脇 +桧西 +桧谷 +桧貝 +桧野 +桧野皮 +桧阪 +桧高 +桧鶴 +桧鼻 +桴海 +桴谷 +桵沢 +桵澤 +桶 +桶下 +桶中 +桶井 +桶仕 +桶作 +桶元 +桶原 +桶口 +桶土井 +桶家 +桶富 +桶尻 +桶尾 +桶屋 +桶山 +桶島 +桶崎 +桶嶋 +桶川 +桶師 +桶成 +桶戸 +桶木 +桶本 +桶村 +桶東 +桶樋 +桶橋 +桶江井 +桶沢 +桶河 +桶澤 +桶爪 +桶生 +桶田 +桶皮 +桶矢 +桶結 +桶舎 +桶葭 +桶谷 +桶野 +桶間 +桺原 +桾 +桾木 +桾本 +桾沢 +桾澤 +梁 +梁井 +梁元 +梁原 +梁取 +梁地 +梁場 +梁守 +梁山 +梁岡 +梁島 +梁崎 +梁嶋 +梁川 +梁木 +梁本 +梁村 +梁根 +梁次 +梁池 +梁沢 +梁河 +梁治 +梁浦 +梁淵 +梁澤 +梁瀬 +梁田 +梁脇 +梁谷 +梁部 +梁野 +梁間 +梃屋 +梅 +梅ケ枝 +梅ケ谷 +梅ケ辻 +梅ケ迫 +梅ノ井 +梅ノ木 +梅ノ木沢 +梅ノ木澤 +梅上 +梅下 +梅中 +梅丸 +梅主 +梅久 +梅久保 +梅之内 +梅井 +梅代 +梅佐古 +梅元 +梅先 +梅光 +梅内 +梅前 +梅北 +梅区 +梅千野 +梅原 +梅友 +梅口 +梅古川 +梅只 +梅名 +梅咲 +梅国 +梅國 +梅園 +梅地 +梅坂 +梅坪 +梅垣 +梅城 +梅埜 +梅基 +梅堀 +梅塚 +梅壷 +梅壽 +梅多 +梅夛 +梅宅 +梅守 +梅実 +梅室 +梅宮 +梅富 +梅實 +梅寺 +梅寿 +梅小路 +梅尻 +梅尾 +梅居 +梅屋 +梅屋敷 +梅山 +梅岡 +梅峪 +梅島 +梅崎 +梅嵜 +梅嶋 +梅川 +梅市 +梅干野 +梅平 +梅庭 +梅延 +梅形 +梅影 +梅徳 +梅戸 +梅敷 +梅景 +梅月 +梅木 +梅木原 +梅木沢 +梅木澤 +梅木田 +梅木谷 +梅末 +梅本 +梅村 +梅松 +梅林 +梅林寺 +梅枝 +梅染 +梅根 +梅森 +梅棹 +梅樹 +梅橋 +梅次 +梅比良 +梅永 +梅江 +梅沢 +梅河内 +梅津 +梅浦 +梅海 +梅清 +梅渓 +梅溪 +梅澤 +梅牧 +梅田 +梅畑 +梅盛 +梅相 +梅硲 +梅窪 +梅竹 +梅籐 +梅群 +梅能木 +梅脇 +梅舍 +梅舎 +梅舘 +梅舟 +梅花 +梅若 +梅落 +梅葉 +梅蔭 +梅薗 +梅藤 +梅西 +梅見 +梅谷 +梅谷内 +梅貝 +梅賀 +梅路 +梅辻 +梅迫 +梅邑 +梅都 +梅里 +梅野 +梅鉢 +梅門 +梅阪 +梅陰 +梅須 +梅須磨 +梅館 +梅香 +梅香家 +梅香路 +梅高 +梅鴬 +梅鶯 +梐 +梓 +梓沢 +梓澤 +梓野 +梔 +梙野 +梚木 +梛 +梛原 +梛尾 +梛山 +梛川 +梛木 +梛橋 +梛良 +梛野 +條 +條々 +條乃 +條内 +條原 +條島 +條川 +條敷 +條時 +條本 +條生 +條紫 +條谷 +條辺 +條野 +梢 +梢江 +梥本 +梥見 +梧 +梧原 +梧川 +梧桐 +梧藤 +梧谷 +梨 +梨ケ瀬 +梨ノ木 +梨井 +梨元 +梨原 +梨和 +梨子 +梨子下 +梨子木 +梨子本 +梨子村 +梨子田 +梨尾 +梨山 +梨岡 +梨崎 +梨川 +梨木 +梨本 +梨村 +梨森 +梨沢 +梨澤 +梨田 +梨畑 +梨羽 +梨脇 +梨谷 +梨野 +梯 +梯上 +梯本 +梯谷 +械塚 +梵 +梶 +梶ケ内 +梶ケ山 +梶ケ谷 +梶ケ野 +梶上 +梶下 +梶丘 +梶並 +梶中 +梶丸 +梶井 +梶仲 +梶佐古 +梶保 +梶倉 +梶側 +梶元 +梶光 +梶内 +梶前 +梶北 +梶原 +梶又 +梶取 +梶口 +梶吉 +梶園 +梶坂 +梶垣 +梶埼 +梶塚 +梶家 +梶尾 +梶居 +梶屋 +梶山 +梶岡 +梶島 +梶崎 +梶嵜 +梶嶋 +梶嶌 +梶川 +梶巻 +梶師 +梶平 +梶建 +梶応 +梶恵 +梶應 +梶戸 +梶房 +梶木 +梶木屋 +梶本 +梶村 +梶東 +梶松 +梶林 +梶栄 +梶栗 +梶梅 +梶森 +梶榮 +梶永 +梶江 +梶沢 +梶河 +梶沼 +梶波 +梶泰 +梶津 +梶浜 +梶浦 +梶清 +梶渡 +梶澤 +梶濱 +梶熊 +梶生 +梶田 +梶田谷 +梶畑 +梶畠 +梶白 +梶目 +梶矢 +梶緒 +梶縄 +梶繩 +梶肥 +梶脇 +梶芳 +梶葉 +梶蔦 +梶藤 +梶西 +梶見 +梶谷 +梶谷垣内 +梶谷迫 +梶賀 +梶返 +梶迫 +梶邑 +梶部 +梶野 +梶間 +梶間谷 +梶音 +梶馬 +梶高 +梼原 +梼山 +梼川 +梼木 +棈木 +棈松 +棏平 +棒屋 +棒崎 +棒引 +棒手 +棒方 +棒星 +棒本 +棒沢 +棒火 +棒田 +棒葉 +棒谷 +棔 +棕沢 +棕澤 +棗 +棗田 +棘 +棘木 +棚 +棚上 +棚井 +棚佐 +棚倉 +棚元 +棚内 +棚原 +棚口 +棚垣 +棚垣外 +棚場 +棚多 +棚家 +棚尾 +棚山 +棚岡 +棚崎 +棚嵜 +棚川 +棚平 +棚成 +棚木 +棚木原 +棚本 +棚村 +棚林 +棚森 +棚橋 +棚次 +棚江 +棚池 +棚沢 +棚治 +棚潟 +棚澤 +棚瀬 +棚田 +棚町 +棚畑 +棚矢 +棚窪 +棚端 +棚網 +棚見 +棚谷 +棚辺 +棚邉 +棚邊 +棚部 +棚野 +棚鰭 +棟 +棟上 +棟久 +棟保 +棟元 +棟兼 +棟加登 +棟原 +棟友 +棟口 +棟安 +棟尾 +棟居 +棟山 +棟岡 +棟川 +棟平 +棟広 +棟廣 +棟形 +棟影 +棟政 +棟方 +棟朝 +棟末 +棟本 +棟杉 +棟東 +棟森 +棟永 +棟清 +棟渡 +棟田 +棟石 +棟羽 +棟語 +棟近 +棟重 +棟野 +棟長 +棟雄 +棟高 +棡葉 +棣棠 +棤木 +棧 +棧原 +棧敷 +森 +森ケ山 +森ケ崎 +森ノ上 +森ノ内 +森ノ向 +森ノ木 +森ノ本 +森一 +森上 +森下 +森下原 +森丘 +森並 +森中 +森主 +森久 +森久保 +森之上 +森之下 +森之本 +森井 +森井泉 +森亦 +森京 +森代 +森仲 +森任 +森伊 +森位 +森住 +森作 +森保 +森信 +森倉 +森側 +森元 +森先 +森光 +森兼 +森内 +森円 +森冨 +森出 +森分 +森切 +森利口 +森前 +森副 +森加 +森勝 +森勢 +森北 +森南 +森原 +森友 +森反 +森口 +森古 +森合 +森吉 +森名 +森向 +森和木 +森咲 +森喜 +森国 +森囿 +森國 +森園 +森圓 +森土 +森土井 +森地 +森坂 +森坪 +森垣 +森垣内 +森城 +森埜 +森埼 +森堀 +森場 +森塚 +森増 +森外 +森多 +森天 +森奈 +森奥 +森好 +森子 +森宅 +森安 +森宗 +森定 +森実 +森宮 +森家 +森富 +森實 +森寺 +森小 +森尻 +森尾 +森居 +森屋 +森屋敷 +森山 +森岡 +森岩 +森岳 +森岸 +森峰 +森島 +森崎 +森嵜 +森嶋 +森嶌 +森嶺 +森川 +森市 +森常 +森幡 +森平 +森年 +森広 +森庵 +森廣 +森延 +森弘 +森当 +森影 +森後 +森徳 +森忠 +森恒 +森恵 +森惠 +森成 +森戸 +森房 +森政 +森数 +森數 +森新 +森方 +森旨 +森明 +森時 +森景 +森月 +森朝 +森木 +森木園 +森木田 +森未 +森末 +森本 +森朴 +森杉 +森村 +森東 +森松 +森林 +森枝 +森柄 +森柏 +森柾 +森栄 +森栖 +森栗 +森根 +森桜 +森桶 +森梅 +森棟 +森植 +森椙 +森楠 +森榮 +森槌 +森横 +森橋 +森櫻 +森次 +森正 +森武 +森比良 +森氏 +森水 +森永 +森江 +森池 +森沖 +森沢 +森河 +森河内 +森河原 +森治 +森泉 +森波 +森津 +森浜 +森浦 +森浴 +森海 +森淵 +森添 +森清 +森済 +森渕 +森満 +森源 +森溝 +森滝 +森滿 +森澄 +森澤 +森濱 +森瀧 +森瀬 +森灘 +森熊 +森玉 +森王 +森生 +森田 +森田谷 +森由 +森町 +森畑 +森留 +森畝 +森畠 +森畦 +森白 +森相 +森矢 +森知 +森石 +森碕 +森神 +森福 +森秋 +森種 +森積 +森窪 +森立 +森端 +森竹 +森竿 +森笠 +森笹 +森糸 +森継 +森続 +森綱 +森繁 +森義 +森能 +森脇 +森腰 +森興 +森舍 +森舎 +森花 +森芳 +森若 +森茂 +森萩 +森蔦 +森蔭 +森薗 +森藤 +森行 +森表 +森裏 +森西 +森見 +森角 +森詰 +森谷 +森豊 +森貝 +森貞 +森貫 +森賀 +森越 +森路 +森辺 +森辻 +森近 +森迫 +森道 +森邉 +森邊 +森部 +森里 +森重 +森野 +森野下 +森野原 +森野辺 +森野邊 +森金 +森銅 +森鍵 +森鎌 +森長 +森門 +森開 +森間 +森阪 +森陰 +森隅 +森階 +森際 +森隥 +森雪 +森須 +森馬 +森高 +森鳰 +森麻 +森黒 +森鼻 +森𦚰 +棯 +棯原 +棯崎 +棯木 +棰井 +棰石 +棱野 +棲井 +棹 +棹台 +棹山 +棹本 +棹登米 +椃木 +椄植 +椊田 +椋 +椋下 +椋井 +椋代 +椋倉 +椋元 +椋原 +椋名 +椋園 +椋埜 +椋尾 +椋居 +椋山 +椋平 +椋木 +椋本 +椋村 +椋林 +椋梨 +椋棒 +椋樹 +椋橋 +椋毛 +椋沢 +椋浦 +椋澤 +椋田 +椋目 +椋立 +椋竜 +椋野 +椋開地 +椋露地 +椋龍 +椌井 +植 +植ノ原 +植上 +植下 +植並 +植中 +植丸 +植主 +植久 +植久保 +植之原 +植井 +植付 +植代 +植仲 +植住 +植作 +植倉 +植元 +植内 +植出 +植前 +植北 +植南 +植原 +植吉 +植向 +植和田 +植喜 +植喜多 +植囿 +植園 +植地 +植坂 +植垣 +植垰 +植城 +植埜 +植場 +植多 +植実 +植家 +植尾 +植屋 +植山 +植岡 +植峠 +植島 +植崎 +植嶋 +植嶌 +植川 +植常 +植平 +植広 +植弘 +植戸 +植手 +植敷 +植新 +植方 +植月 +植木 +植木原 +植木園 +植木田 +植木谷 +植本 +植杉 +植村 +植条 +植東 +植松 +植林 +植枩 +植柳 +植柴 +植栗 +植根 +植桧 +植條 +植梶 +植森 +植椙 +植樹 +植檜 +植次 +植武 +植永 +植江田 +植池 +植沢 +植河 +植波 +植津 +植浜 +植浦 +植渕 +植澤 +植濃 +植炭 +植片 +植生 +植田 +植町 +植畑 +植畠 +植益 +植盛 +植石 +植竹 +植第 +植羅 +植美 +植羽 +植良 +植艸 +植芝 +植花 +植苗 +植茶 +植草 +植萱 +植葉 +植薄 +植薗 +植藤 +植西 +植見 +植谷 +植辻 +植道 +植邑 +植邨 +植部 +植里 +植重 +植野 +植野上 +植野堀 +植野畑 +植鉢 +植長 +植阪 +植附 +植頭 +植高 +植𡌛 +椎 +椎ケ本 +椎久 +椎井 +椎八重 +椎出 +椎原 +椎口 +椎名 +椎場 +椎塚 +椎奈 +椎尾 +椎屋 +椎山 +椎崎 +椎嵜 +椎川 +椎平 +椎木 +椎木尾 +椎本 +椎村 +椎林 +椎根 +椎森 +椎橋 +椎江 +椎津 +椎熊 +椎爪 +椎田 +椎畑 +椎窓 +椎葉 +椎谷 +椎貝 +椎野 +椎間 +椎須 +椙 +椙下 +椙井 +椙元 +椙原 +椙守 +椙尾 +椙屋 +椙山 +椙岡 +椙島 +椙崎 +椙嶋 +椙弘 +椙木 +椙本 +椙村 +椙杜 +椙棟 +椙森 +椙橋 +椙江 +椙沢 +椙浦 +椙澤 +椙生 +椙田 +椙目 +椙藤 +椙谷 +椙野 +椚 +椚原 +椚山 +椚座 +椚瀬 +椚田 +椚谷 +椛 +椛元 +椛山 +椛島 +椛嶋 +椛嶌 +椛木 +椛木野 +椛本 +椛村 +椛沢 +椛澤 +椛田 +椛谷 +検保 +検学 +検崎 +検本 +検校 +検梗谷 +検見崎 +検見川 +椢原 +椨 +椨元 +椨木 +椨本 +椪 +椰尾 +椰山 +椰木 +椰野 +椴 +椴井 +椴内 +椴山 +椴木 +椴本 +椴田 +椴谷 +椴野 +椵山 +椵木 +椵田 +椹 +椹口 +椹木 +椹沢 +椹澤 +椹野 +椻下 +椿 +椿下 +椿井 +椿倉 +椿元 +椿内 +椿分 +椿原 +椿土 +椿地 +椿坂 +椿垣内 +椿尾 +椿居 +椿屋 +椿山 +椿崎 +椿川 +椿木 +椿本 +椿杉 +椿松 +椿根 +椿森 +椿沢 +椿澤 +椿田 +椿紅 +椿谷 +椿野 +椿阪 +椿館 +楉 +楊井 +楊原 +楊山 +楊川 +楊木 +楊木田 +楊林 +楊枝 +楊河 +楊田 +楊盧木 +楊箸 +楊野 +楓 +楓井 +楓原 +楓堂 +楓山 +楓岡 +楓川 +楚 +楚南 +楚和 +楚坂 +楚山 +楚田 +楚良 +楚輪 +楚郷 +楚里 +楚阪 +楜桃田 +楜沢 +楜澤 +楞川 +楞田 +楞谷 +楞野 +楠 +楠ケ谷 +楠ノ木 +楠ノ瀬 +楠上 +楠下 +楠丸 +楠久 +楠之木 +楠亀 +楠井 +楠倉 +楠元 +楠八重 +楠円 +楠前 +楠原 +楠口 +楠名 +楠園 +楠圓 +楠土 +楠坂 +楠城 +楠堀 +楠堂 +楠多 +楠奥 +楠実 +楠家 +楠富 +楠尾 +楠居 +楠屋 +楠山 +楠岡 +楠島 +楠崎 +楠嵜 +楠嶺 +楠川 +楠平 +楠待 +楠後 +楠戸 +楠木 +楠木園 +楠木谷 +楠本 +楠村 +楠林 +楠枝 +楠根 +楠森 +楠樹 +楠橋 +楠段 +楠毛 +楠永 +楠江 +楠沢 +楠浦 +楠浴 +楠滝 +楠澤 +楠瀧 +楠瀬 +楠照 +楠牟礼 +楠牟禮 +楠生 +楠田 +楠畑 +楠目 +楠石 +楠神 +楠窪 +楠美 +楠脇 +楠茂 +楠葉 +楠蔭 +楠藤 +楠見 +楠谷 +楠部 +楠野 +楠間 +楠陰 +楠香谷 +楡 +楡井 +楡原 +楡居 +楡木 +楡本 +楡田 +楡金 +楢 +楢井 +楢原 +楢和 +楢埼 +楢尾 +楢屋 +楢山 +楢岡 +楢島 +楢崎 +楢嵜 +楢嶋 +楢府 +楢戸 +楢支 +楢木 +楢木野 +楢本 +楢村 +楢松 +楢林 +楢柴 +楢橋 +楢沢 +楢田 +楢畑 +楢舘 +楢葉 +楢見舘 +楢見館 +楢谷 +楢迫 +楢部 +楢野 +楢館 +楪 +楪葉 +楫 +楫ケ瀬 +楫井 +楫原 +楫取 +楫尾 +楫屋 +楫山 +楫川 +楫斐 +楫本 +楫江 +楫浜 +楫田 +楫西 +楫谷 +楫賀 +楫部 +楫野 +楫間 +業 +業合 +業天 +業田 +楮 +楮佐古 +楮元 +楮原 +楮山 +楮木 +楮本 +楮林 +楮根 +楮畑 +楮籔 +楮藪 +楮谷 +楮野 +楯 +楯井 +楯列 +楯尾 +楯山 +楯岡 +楯岩 +楯川 +楯木 +楯本 +楯村 +楯条 +楯林 +楯沢 +楯澤 +楯田 +楯石 +楯能 +楯薗 +楯谷 +楯貫 +楯身 +楯野 +楳下 +楳井 +楳元 +楳内 +楳北 +楳原 +楳図 +楳園 +楳地 +楳坂 +楳垣 +楳寿 +楳山 +楳崎 +楳川 +楳座 +楳木 +楳本 +楳村 +楳林 +楳森 +楳沢 +楳泉 +楳津 +楳渓 +楳溪 +楳澤 +楳生 +楳田 +楳窪 +楳谷 +楳辻 +楳野 +極並 +極壇 +極屋 +極山 +極川 +極意 +極本 +極楽 +極楽地 +極楽寺 +極檀 +極殿 +極田 +極立 +極里 +楸 +楸原 +楸田 +楽々 +楽々浦 +楾 +榁木 +榁本 +榁田 +榊 +榊下 +榊井 +榊元 +榊原 +榊山 +榊巻 +榊平 +榊木 +榊本 +榊林 +榊枝 +榊森 +榊沢 +榊澤 +榊田 +榊谷 +榊野 +榊間 +榎 +榎下 +榎並 +榎並宮 +榎並谷 +榎丸 +榎井 +榎倉 +榎元 +榎内 +榎勢 +榎南 +榎原 +榎又 +榎吉 +榎園 +榎土 +榎地 +榎坂 +榎垣 +榎堀 +榎塚 +榎奥 +榎室 +榎宮 +榎尾 +榎屋 +榎山 +榎峠 +榎島 +榎崎 +榎嶋 +榎川 +榎平 +榎戸 +榎木 +榎木丸 +榎木園 +榎木平 +榎木林 +榎木田 +榎木薗 +榎木谷 +榎本 +榎村 +榎林 +榎枝 +榎根本 +榎森 +榎橘 +榎沢 +榎波 +榎津 +榎浪 +榎添 +榎澤 +榎瀬 +榎田 +榎畑 +榎硲 +榎窪 +榎股 +榎薗 +榎谷 +榎野 +榎阪 +榎頭 +榎鶴 +榑井 +榑元 +榑本 +榑松 +榑林 +榑沢 +榑沼 +榑石 +榑谷 +榛 +榛原 +榛名 +榛地 +榛山 +榛川 +榛木 +榛村 +榛林 +榛沢 +榛澤 +榛田 +榛白 +榛葉 +榛谷 +榛野 +榛間 +榧 +榧下 +榧原 +榧垣 +榧場 +榧守 +榧木 +榧本 +榧根 +榧森 +榧橋 +榧谷 +榧野 +榮 +榮久庵 +榮井 +榮代 +榮倉 +榮元 +榮利 +榮前田 +榮原 +榮口 +榮喜 +榮國 +榮坂 +榮多 +榮子 +榮家 +榮居 +榮屋 +榮山 +榮岩 +榮島 +榮嶋 +榮嶌 +榮川 +榮徳 +榮木 +榮本 +榮村 +榮林 +榮枝 +榮根 +榮森 +榮楽 +榮樂 +榮次 +榮水 +榮永 +榮沢 +榮浪 +榮澤 +榮田 +榮畑 +榮留 +榮盛 +榮福 +榮羽 +榮花 +榮薗 +榮藤 +榮西 +榮角 +榮谷 +榮賀 +榮迫 +榮野 +榮野元 +榮野川 +榮野比 +榮長 +榮門 +榮阪 +榮高屋 +榮鶴 +榲山 +榷 +榺 +榿 +榿沢 +榿澤 +榿田 +槁倉 +槁口 +槁本 +槁爪 +槁詰 +槁野 +槃木 +槇 +槇ケ垰 +槇ノ原 +槇下 +槇井 +槇元 +槇内 +槇前 +槇原 +槇口 +槇坂 +槇坪 +槇垰 +槇埜 +槇場 +槇塚 +槇塲 +槇奥 +槇寺 +槇尾 +槇山 +槇岡 +槇峠 +槇峯 +槇峰 +槇島 +槇嶋 +槇川 +槇平 +槇廣 +槇得 +槇戸 +槇木 +槇本 +槇村 +槇林 +槇枝 +槇根 +槇森 +槇橋 +槇殿 +槇永 +槇沢 +槇浦 +槇滝 +槇澤 +槇田 +槇畝 +槇盛 +槇矢 +槇石 +槇窪 +槇納 +槇谷 +槇賀 +槇迫 +槇野 +槇雄 +構 +構井 +構内 +構口 +構司 +構木 +構江 +構田 +構谷 +構野 +槌 +槌井 +槌入 +槌原 +槌多 +槌家 +槌尾 +槌居 +槌屋 +槌山 +槌岡 +槌崎 +槌川 +槌市 +槌広 +槌廣 +槌木 +槌本 +槌林 +槌橋 +槌永 +槌江 +槌田 +槌矢 +槌納 +槌西 +槌谷 +槌賀 +槌道 +槌野 +槌間 +槍 +槍原 +槍崎 +槍戸 +槍木 +槍水 +槍沢 +槍澤 +槍田 +槍野 +槐 +槐原 +槐島 +槙 +槙ケ垰 +槙ノ原 +槙下 +槙中 +槙井 +槙元 +槙内 +槙前 +槙原 +槙口 +槙坂 +槙坪 +槙垰 +槙埜 +槙場 +槙塚 +槙奥 +槙宇 +槙家 +槙寺 +槙尾 +槙山 +槙岡 +槙峠 +槙峯 +槙峰 +槙島 +槙嶋 +槙川 +槙平 +槙広 +槙得 +槙戸 +槙木 +槙本 +槙村 +槙林 +槙枝 +槙根 +槙森 +槙橋 +槙永 +槙沢 +槙浦 +槙澤 +槙田 +槙畝 +槙盛 +槙矢 +槙石 +槙窪 +槙納 +槙藤 +槙西 +槙谷 +槙賀 +槙迫 +槙野 +槙雄 +槝之浦 +槢木 +槣原 +槣山 +槨水 +槩支 +槫松 +槫林 +槫谷 +槯賀 +槲田 +槶原 +槻 +槻ノ木沢 +槻ノ木澤 +槻並 +槻宅 +槻尾 +槻山 +槻岡 +槻川原 +槻木 +槻木沢 +槻木澤 +槻本 +槻村 +槻林 +槻橋 +槻沢 +槻澤 +槻瀬 +槻田 +槻舘 +槻谷 +槻間 +槻館 +槽井 +槽谷 +槿 +槿原 +樅内 +樅原 +樅山 +樅木 +樅田 +樅野 +樋 +樋ケ +樋ノ上 +樋ノ内 +樋ノ口 +樋ノ宮 +樋ノ水 +樋ノ浦 +樋上 +樋下 +樋下田 +樋之上 +樋之元 +樋之内 +樋之口 +樋之本 +樋之津 +樋之浦 +樋井 +樋代 +樋住 +樋元 +樋先 +樋内 +樋出 +樋前 +樋勝 +樋原 +樋口 +樋吉 +樋向 +樋嘉 +樋園 +樋地 +樋坂 +樋垣 +樋堂 +樋場 +樋守 +樋室 +樋宮 +樋富 +樋尻 +樋尾 +樋屋 +樋山 +樋岡 +樋島 +樋崎 +樋川 +樋廻 +樋引 +樋抜 +樋掛 +樋掛田 +樋敷 +樋方 +樋木 +樋木崎 +樋本 +樋村 +樋柴 +樋栄 +樋桁 +樋森 +樋榮 +樋樫 +樋水 +樋永 +樋江井 +樋池 +樋沢 +樋沼 +樋泉 +樋津 +樋浦 +樋渡 +樋澤 +樋瀬 +樋熊 +樋爪 +樋片 +樋田 +樋町 +樋畑 +樋留 +樋畠 +樋端 +樋笠 +樋者 +樋脇 +樋藤 +樋裏 +樋詰 +樋谷 +樋谷内 +樋貝 +樋越 +樋路 +樋道 +樋郡 +樋部 +樋野 +樋野口 +樋野本 +樋野村 +樋開 +樋間 +樋関 +樋高 +樒川 +樒柑 +樒柑山 +樗 +樗木 +樗沢 +樗澤 +標 +標葉 +樚本 +樛木 +樟 +樟原 +樟山 +樟木 +樟本 +樟瀬 +樟田 +模 +模利 +権丈 +権上 +権世 +権並 +権之進 +権代 +権保 +権元 +権八 +権内 +権出 +権名津 +権坐 +権城 +権執印 +権堀 +権堂 +権太 +権守 +権安 +権左 +権平 +権庄 +権度 +権座 +権掘 +権東 +権業 +権次 +権正 +権永 +権津川 +権為 +権現 +権現免 +権現堂 +権現領 +権瓶 +権田 +権畑 +権神 +権納 +権藤 +権蛇 +権谷 +権軒 +権部 +権野 +権隋 +権随 +権隨 +権頭 +横 +横丁 +横上 +横下 +横並 +横中 +横串 +横丸 +横丹 +横久 +横久保 +横井 +横井内 +横井山 +横井川 +横井手 +横亭 +横伝 +横住 +横佐 +横佐古 +横佩 +横供 +横倉 +横傳 +横儀 +横元 +横光 +横内 +横出 +横前 +横割 +横北 +横南 +横原 +横取 +横口 +横合 +横向 +横呂 +横呑 +横土 +横地 +横坂 +横坪 +横垣 +横垣内 +横城 +横堀 +横堤 +横堰 +横場 +横塚 +横増 +横士 +横多 +横大路 +横大道 +横奥 +横字 +横守 +横宗 +横室 +横宮 +横家 +横寺 +横小路 +横尾 +横居 +横屋 +横屋垣内 +横屋敷 +横山 +横岑 +横岡 +横岩 +横岳 +横岸沢 +横岸澤 +横峯 +横峰 +横島 +横崎 +横嶋 +横嶌 +横川 +横州 +横左内 +横巻 +横市 +横幕 +横平 +横店 +横座 +横式 +横引 +横張 +横後 +横戸 +横手 +横打 +横撫 +横更 +横曽根 +横曾根 +横木 +横本 +横杉 +横村 +横東 +横松 +横枕 +横林 +横枡 +横柳 +横柿 +横根 +横棚 +横森 +横構 +横橋 +横欠 +横正 +横武 +横段 +横水 +横永 +横江 +横江川 +横沢 +横沢田 +横河 +横治 +横沼 +横津 +横洲 +横浜 +横浦 +横浪 +横淵 +横渕 +横渡 +横湯 +横満 +横溝 +横滝 +横澤 +横澤田 +横濱 +横瀧 +横瀬 +横灘 +横生 +横田 +横田地 +横田川 +横町 +横畑 +横畝 +横畠 +横白 +横目 +横矢 +横知 +横石 +横積 +横窪 +横立 +横竹 +横籔 +横粂 +横網代 +横縄 +横繁 +横羽 +横腰 +横臼 +横舘 +横芝 +横萩 +横落 +横葉 +横薮 +横藤 +横藤田 +横藪 +横西 +横見 +横見瀬 +横角 +横詰 +横谷 +横貝 +横貫 +横超 +横越 +横越谷 +横路 +横輪 +横辺 +横辻 +横通 +横道 +横邊 +横部 +横里 +横重 +横野 +横銭 +横鋤 +横長 +横間 +横関 +横關 +横阪 +横障子 +横雲 +横須 +横須加 +横須賀 +横領司 +横飛 +横館 +横馬 +横馬場 +樫 +樫ケ平 +樫下 +樫久保 +樫井 +樫位 +樫元 +樫八重 +樫内 +樫出 +樫原 +樫又 +樫口 +樫合 +樫地 +樫坂 +樫埜 +樫塚 +樫子 +樫宿 +樫尾 +樫山 +樫岡 +樫崎 +樫川 +樫平 +樫志村 +樫木 +樫本 +樫村 +樫東 +樫林 +樫栄 +樫根 +樫森 +樫榮 +樫永 +樫沢 +樫津 +樫浦 +樫渕 +樫澤 +樫熊 +樫田 +樫畑 +樫福 +樫羽 +樫脇 +樫葉 +樫藤 +樫見 +樫詰 +樫谷 +樫迫 +樫部 +樫野 +樫間 +樫飯 +樰沢 +樰澤 +樵 +樵田 +樶所 +樸原 +樹 +樹下 +樹元 +樹原 +樹宮 +樹山 +樹岡 +樹所 +樹木 +樹本 +樹杉 +樹村 +樹林 +樹梨 +樹森 +樹生 +樹田 +樹神 +樹谷 +樹野 +樺 +樺井 +樺元 +樺山 +樺島 +樺嶋 +樺嶌 +樺木 +樺木野 +樺本 +樺村 +樺沢 +樺澤 +樺田 +樺谷 +樺野 +樽 +樽上 +樽下 +樽井 +樽佐 +樽元 +樽光 +樽口 +樽古 +樽味 +樽園 +樽塚 +樽好 +樽宮 +樽家 +樽尾 +樽居 +樽屋 +樽山 +樽岡 +樽島 +樽崎 +樽嶋 +樽川 +樽床 +樽政 +樽木 +樽本 +樽村 +樽栄 +樽森 +樽榮 +樽水 +樽沢 +樽津 +樽海 +樽澤 +樽田 +樽矢 +樽石 +樽磨 +樽美 +樽脇 +樽茶 +樽見 +樽角 +樽谷 +樽辺 +樽部 +樽野 +樽門 +樽馬 +橅木 +橇田 +橋 +橋ケ谷 +橋ケ迫 +橋ノ口 +橋ノ本 +橋上 +橋下 +橋丘 +橋並 +橋中 +橋丸 +橋之口 +橋之爪 +橋井 +橋住 +橋佐古 +橋信 +橋倉 +橋傍 +橋元 +橋内 +橋冨 +橋出 +橋前 +橋北 +橋原 +橋口 +橋台 +橋吉 +橋向 +橋和 +橋和田 +橋国 +橋國 +橋園 +橋坂 +橋垣 +橋垣戸 +橋埜 +橋堀 +橋場 +橋塚 +橋塲 +橋壁 +橋奥 +橋子 +橋守 +橋守屋 +橋家 +橋富 +橋寺 +橋尻 +橋尾 +橋居 +橋屋 +橋山 +橋岡 +橋島 +橋崎 +橋嵜 +橋嶋 +橋川 +橋工 +橋平 +橋広 +橋床 +橋度 +橋廣 +橋建 +橋廻 +橋弥 +橋彌 +橋形 +橋戸 +橋手 +橋折 +橋掛 +橋新 +橋方 +橋木 +橋本 +橋本屋 +橋本谷 +橋杉 +橋村 +橋枝 +橋柿 +橋根 +橋梅 +橋森 +橋植 +橋正 +橋永 +橋沢 +橋沼 +橋波 +橋津 +橋津谷 +橋浜 +橋浦 +橋添 +橋渡 +橋満 +橋溝 +橋滿 +橋澤 +橋濱 +橋熊田 +橋爪 +橋瓜 +橋田 +橋畑 +橋留 +橋目 +橋矢 +橋矢田 +橋砂 +橋秦 +橋積 +橋立 +橋端 +橋納谷 +橋結 +橋羽 +橋脇 +橋臺 +橋芝 +橋若 +橋葉 +橋西 +橋見 +橋角 +橋詰 +橋誥 +橋谷 +橋谷田 +橋越 +橋辺 +橋迫 +橋達 +橋邉 +橋邊 +橋部 +橋都 +橋酒 +橋里 +橋野 +橋長 +橋間 +橋阪 +橋隅 +橋階 +橋際 +橋馬 +橋高 +橎堂 +橎本 +橘 +橘井 +橘元 +橘八重 +橘内 +橘原 +橘和 +橘園 +橘地 +橘堂 +橘定 +橘尾 +橘屋 +橘山 +橘岡 +橘川 +橘木 +橘本 +橘林 +橘樹 +橘波 +橘浦 +橘田 +橘薗 +橘谷 +橘野 +橘高 +橘鷹 +橙 +橙山 +橙木 +橙田 +機 +機動 +機戸 +機所 +機田 +機谷 +機道 +機野 +橡尾 +橡川 +橡木 +橡本 +橡村 +橡谷 +橲久 +橳島 +橳嶋 +橳嶌 +橺山 +橿 +橿上 +橿原 +橿尾 +橿山 +橿本 +橿村 +橿林 +橿棒 +橿淵 +橿渕 +檀 +檀ノ原 +檀ノ浦 +檀上 +檀之上 +檀原 +檀岡 +檀崎 +檀床 +檀本 +檀林 +檀浦 +檀特 +檀田 +檀谷 +檀辻 +檀野 +檉 +檍 +檜 +檜ケ谷 +檜上 +檜下 +檜並 +檜井 +檜佐 +檜作 +檜内 +檜前 +檜原 +檜口 +檜吉 +檜和田 +檜坂 +檜垣 +檜室 +檜尾 +檜山 +檜岡 +檜崎 +檜嵜 +檜川 +檜巻 +檜平 +檜座 +檜掛 +檜木 +檜木田 +檜本 +檜村 +檜杖 +檜林 +檜枝 +檜森 +檜槇 +檜槙 +檜沢 +檜波 +檜波田 +檜浦 +檜渡 +檜澤 +檜濱 +檜物 +檜物谷 +檜田 +檜皮 +檜皮田 +檜皮谷 +檜立 +檜脇 +檜西 +檜谷 +檜谷本 +檜貝 +檜野 +檜野皮 +檜阪 +檜高 +檜鶴 +檜鼻 +檞 +檞原 +檞本 +檞谷 +檟 +檢見崎 +檢見川 +檪 +檪井 +檪原 +檪尾 +檪山 +檪岡 +檪木 +檪本 +檪村 +檪森 +檪浦 +檪田 +檮原 +檮山 +檮川 +檮木 +檳榔 +櫁川 +櫁柑 +櫁柑山 +櫂 +櫂作 +櫂谷 +櫃ノ上 +櫃之上 +櫃割 +櫃口 +櫃岡 +櫃本 +櫃田 +櫃石 +櫃間 +櫓 +櫓元 +櫔原 +櫛 +櫛下 +櫛下町 +櫛井 +櫛削 +櫛原 +櫛垰 +櫛屋 +櫛屋敷 +櫛山 +櫛岡 +櫛島 +櫛崎 +櫛川 +櫛延 +櫛引 +櫛方 +櫛木 +櫛本 +櫛村 +櫛来 +櫛松 +櫛桁 +櫛橋 +櫛比 +櫛毛 +櫛永 +櫛浜 +櫛淵 +櫛渕 +櫛濱 +櫛田 +櫛笥 +櫛筍 +櫛股 +櫛舎 +櫛見 +櫛谷 +櫛辺 +櫛邉 +櫛部 +櫛野 +櫛間 +櫟 +櫟井 +櫟原 +櫟尾 +櫟山 +櫟岡 +櫟木 +櫟本 +櫟村 +櫟森 +櫟浦 +櫟田 +櫟良 +櫨 +櫨下 +櫨中 +櫨井 +櫨元 +櫨原 +櫨場 +櫨塲 +櫨山 +櫨岡 +櫨川 +櫨木 +櫨本 +櫨村 +櫨林 +櫨田 +櫨畑 +櫨野 +櫻 +櫻下 +櫻中 +櫻井 +櫻元 +櫻内 +櫻原 +櫻又 +櫻台 +櫻吉 +櫻坂 +櫻堂 +櫻場 +櫻塲 +櫻宮 +櫻小路 +櫻尾 +櫻居 +櫻屋敷 +櫻山 +櫻岡 +櫻島 +櫻崎 +櫻川 +櫻庭 +櫻戸 +櫻打 +櫻木 +櫻木谷 +櫻本 +櫻松 +櫻林 +櫻枝 +櫻栄 +櫻根 +櫻森 +櫻榮 +櫻橋 +櫻武 +櫻段 +櫻永 +櫻江 +櫻沢 +櫻河内 +櫻淵 +櫻渕 +櫻澤 +櫻瀬 +櫻田 +櫻町 +櫻畑 +櫻畠 +櫻石 +櫻糀 +櫻美 +櫻羽 +櫻花 +櫻谷 +櫻谷敷 +櫻迫 +櫻部 +櫻野 +櫻間 +欄 +欄木 +欅 +欅尾 +欅田 +欅谷 +權丈 +權並 +權代 +權出 +權名津 +權堀 +權堂 +權守 +權平 +權業 +權正 +權現 +權現堂 +權現領 +權田 +權藤 +權蛇 +權谷 +權軒 +權野 +權頭 +欠 +欠ケ +欠ケ端 +欠ノ下 +欠上 +欠下 +欠口 +欠塚 +欠川 +欠戸 +欠掛 +欠村 +欠瀬 +欠田 +欠畑 +欠端 +欠野 +欠間 +次久前 +次井 +次元 +次六 +次原 +次呂久 +次嘉 +次家 +次富 +次屋 +次山 +次岡 +次島 +次川 +次広 +次廣 +次木 +次本 +次村 +次松 +次森 +次橋 +次沢 +次澤 +次田 +次石 +次社 +次良丸 +次藤 +次谷 +次賀 +次郎 +次郎万 +次郎丸 +次郎内 +次郎坊 +次郎垣内 +次郎島 +次郎嶋 +次郎萬 +次郎間 +次部 +次部田 +次重 +次野 +次野原 +欲賀 +欺波 +歌 +歌丸 +歌井 +歌代 +歌住 +歌原 +歌坂 +歌城 +歌屋敷 +歌岡 +歌島 +歌崎 +歌川 +歌房 +歌方 +歌書 +歌木 +歌村 +歌枕 +歌橋 +歌沢 +歌津 +歌浦 +歌澤 +歌田 +歌納木 +歌藤 +歌見 +歌谷 +歌里 +歌野 +歌野原 +歌門 +歌頭 +歓喜 +歓峯 +歓峰 +歓崎 +歓益 +歡峯 +歡崎 +止原 +止境 +止部 +止野 +正 +正ケ峯 +正ケ峰 +正ノ腰 +正一 +正上 +正下 +正中 +正丸 +正久 +正之 +正亀 +正井 +正代 +正伝 +正伯 +正住 +正來 +正保 +正信 +正倉 +正傳 +正儀原 +正元 +正光 +正光寺 +正入木 +正兼 +正内 +正円 +正冨 +正出 +正分 +正初 +正前 +正力 +正勇 +正務 +正化 +正印 +正原 +正又 +正口 +正古 +正司 +正司園 +正吉 +正名 +正呂地 +正味 +正和 +正善 +正喜 +正因 +正図 +正国 +正國 +正圓 +正圖 +正地 +正地畠 +正坂 +正坊地 +正垣 +正城 +正埜 +正堀 +正堂 +正堺 +正塚 +正墻 +正士 +正壽 +正多 +正夫田 +正好 +正子 +正學 +正守 +正宗 +正宝 +正宮 +正富 +正寳 +正寶 +正寺 +正寿 +正尺 +正尾 +正山 +正岡 +正峯 +正峰 +正島 +正崎 +正嵜 +正嶋 +正川 +正工 +正市 +正市園 +正平 +正広 +正座 +正廣 +正延 +正弥 +正彌 +正当 +正影 +正後 +正徳 +正心 +正志 +正意 +正慶 +正成 +正戸 +正房 +正所 +正手 +正方 +正明 +正時 +正月 +正月谷 +正木 +正本 +正札 +正村 +正条 +正来 +正東 +正松本 +正板 +正林 +正柳 +正根 +正根寺 +正根知 +正條 +正森 +正楽 +正楽井 +正楽地 +正楽寺 +正樂 +正樂井 +正樂地 +正橋 +正次 +正武 +正武家 +正武田 +正武迫 +正歩 +正殿 +正気 +正水 +正永 +正江 +正池 +正沢 +正治 +正泉寺 +正法 +正法地 +正法院 +正津 +正海 +正清 +正渡 +正満 +正源 +正源司 +正源寺 +正澤 +正玄 +正現 +正理 +正瑞 +正生 +正甫 +正田 +正田山 +正町 +正畑 +正留 +正畠 +正白 +正盛 +正直 +正眞 +正真 +正示 +正祐 +正神 +正福 +正福寺 +正立 +正立寺 +正端 +正竹 +正箱 +正籬 +正絛 +正置 +正美 +正者 +正能 +正脇 +正腰 +正膳 +正蔵寺 +正藤 +正行 +正西 +正見 +正覚 +正親 +正親町 +正覺 +正角 +正谷 +正賀 +正路 +正躰 +正辻 +正込 +正近 +正迫 +正通 +正連 +正連山 +正道 +正道寺 +正部 +正部家 +正部川 +正重 +正野 +正野崎 +正金 +正金寺 +正銀 +正鋳 +正鑄 +正長 +正門 +正阿弥 +正阿彌 +正随 +正隨 +正露 +正面 +正頭 +正願 +正願地 +正願寺 +正高 +正鬼 +此 +此ノ奥 +此ノ木 +此上 +此下 +此佐 +此元 +此内 +此原 +此口 +此和 +此垣内 +此奥 +此寺 +此尻 +此尾 +此島 +此崎 +此嶋 +此川 +此常 +此平 +此木 +此本 +此村 +此松 +此枝 +此森 +此永 +此池 +此浦 +此田 +此経 +此見 +此谷 +此谷内 +此部 +此里 +此間 +武 +武ノ上 +武ノ内 +武一 +武上 +武下 +武並 +武中 +武丸 +武久 +武之内 +武之森 +武乗 +武井 +武仲 +武位 +武住 +武佐 +武保 +武信 +武俣 +武倉 +武像 +武儀山 +武元 +武光 +武入 +武内 +武冨 +武分 +武利 +武則 +武前 +武副 +武加武 +武加竹 +武半 +武南 +武原 +武友 +武口 +武司 +武吉 +武名 +武呂 +武味 +武和 +武善 +武喜田 +武図 +武園 +武地 +武坂 +武城 +武基 +武堀 +武堂 +武塙 +武塚 +武士 +武士俣 +武士原 +武士垣外 +武士末 +武士沢 +武士澤 +武士田 +武壮 +武多 +武多和 +武奈 +武子 +武孝 +武宇 +武守 +武安 +武宮 +武家尾 +武富 +武尾 +武居 +武屋 +武山 +武岡 +武岩 +武岳 +武島 +武崎 +武嶋 +武川 +武差 +武市 +武平 +武広 +武庫 +武庫山 +武庫川 +武廣 +武延 +武弓 +武弘 +武志 +武志俣 +武手木 +武持 +武捨 +武政 +武文 +武方 +武明 +武智 +武曽 +武曾 +武木 +武木田 +武末 +武本 +武村 +武束 +武東 +武松 +武林 +武枝 +武柴 +武森 +武槍 +武樋 +武橋 +武次 +武正 +武氏 +武気 +武氣 +武永 +武江 +武沢 +武河 +武沼 +武波 +武津 +武津岡 +武浦 +武浪 +武海 +武淵 +武添 +武清 +武渕 +武満 +武澤 +武濤 +武瀬 +武熊 +武甕 +武生 +武用 +武田 +武田川 +武留井 +武畽 +武発 +武盛 +武直 +武矢 +武知 +武石 +武神 +武種 +武立 +武笠 +武箭 +武籐 +武縄 +武繁 +武繩 +武美 +武者 +武者小路 +武者野 +武脇 +武腰 +武臣 +武舎 +武良 +武良井 +武花 +武苅 +武苗 +武若 +武茂 +武荒 +武菱 +武蔵 +武蔵丸 +武蔵原 +武蔵屋 +武蔵島 +武蔵川 +武蔵谷 +武蔵野 +武藏 +武藏野 +武藤 +武藤谷 +武衛 +武衞 +武西 +武見 +武谷 +武貞 +武越 +武車 +武輪 +武辺 +武辻 +武連 +武道 +武邉 +武邊 +武邑 +武邨 +武部 +武郷 +武都 +武里 +武重 +武野 +武野内 +武野氏 +武野谷 +武鎗 +武鎧 +武鑓 +武長 +武門 +武間 +武関 +武陵 +武隅 +武隈 +武雄 +武領 +武類 +武馬 +武鹿 +武鹿野 +武黄 +武黒 +歩仁内 +歩嵯胤 +歩浜 +歩濱 +歩田 +歩行田 +歩谷 +歯朶 +歯朶原 +歯朶尾 +歯朶山 +歯黒 +歳光 +歳兼 +歳内 +歳原 +歳国 +歳國 +歳安 +歳実 +歳實 +歳岡 +歳島 +歳嶋 +歳川 +歳常 +歳平 +歳弘 +歳徳屋 +歳成 +歳本 +歳桃 +歳森 +歳永 +歳清 +歳田 +歳秀 +歳納 +歳脇 +歳良 +歳藤 +歳行 +歳谷 +歳野 +歳長 +歸坂 +歸家 +歸山 +歸度 +歸来 +殊井 +殊才 +残 +残松 +残熊 +残田 +残華 +残間 +残馬 +殖木 +殖栗 +殖田 +殘間 +段 +段ノ上 +段ノ下 +段上 +段下 +段中 +段之上 +段之下 +段之平 +段代 +段原 +段口 +段吉 +段坂 +段垣 +段垣内 +段城 +段堀 +段堂 +段塚 +段子 +段安 +段家 +段崎 +段川 +段平 +段床 +段当 +段木 +段本 +段村 +段松 +段林 +段浦 +段渕 +段王 +段田 +段畑 +段畠 +段証 +段證 +段谷 +段野 +段野下 +段題 +殻内 +殻谷 +殼谷 +殿 +殿ケ下 +殿上 +殿下 +殿下屋 +殿井 +殿代 +殿倉 +殿元 +殿内 +殿前 +殿勝 +殿北 +殿南 +殿原 +殿口 +殿園 +殿地 +殿坂 +殿垣 +殿垣内 +殿城 +殿堀 +殿塚 +殿墳 +殿守 +殿尾 +殿山 +殿岡 +殿島 +殿崎 +殿嵜 +殿川 +殿平 +殿広 +殿廹 +殿待 +殿所 +殿敷 +殿明 +殿最 +殿木 +殿木戸 +殿本 +殿村 +殿東 +殿林 +殿柿 +殿森 +殿水 +殿江 +殿池 +殿河 +殿河内 +殿浦 +殿生 +殿田 +殿界 +殿畑 +殿畠 +殿納 +殿納屋 +殿脇 +殿芝 +殿西 +殿見 +殿護 +殿谷 +殿貝 +殿迫 +殿邑 +殿部 +殿重 +母ケ野 +母倉 +母出 +母利 +母原 +母坪 +母壁 +母子泊 +母家 +母屋 +母木 +母理 +母田 +母良田 +母袋 +母谷 +母里 +毎原 +毎山 +毎川 +毎広 +毎床 +毎度 +毎座 +毎木 +毎本 +毎森 +毎沢 +毎澤 +毎熊 +毎田 +毎野 +毎隈 +毎高 +毒島 +毒嶋 +毒嶌 +比々羅木 +比上 +比下 +比与森 +比之木 +比予森 +比井 +比企 +比企野 +比企間 +比佐 +比佐野 +比内 +比前 +比南原 +比原 +比叡 +比叡谷 +比口 +比古咲 +比古田 +比古矢 +比名 +比呂 +比和谷 +比和野 +比喜多 +比喜田 +比嘉 +比嘉門 +比土平 +比地 +比地原 +比地岡 +比地黒 +比坪 +比売宮 +比多岡 +比多賀 +比夫見 +比奈 +比奈地 +比奈岡 +比奈本 +比奈田 +比奥 +比家 +比家由 +比尾野 +比屋 +比屋定 +比屋根 +比山 +比島 +比延田 +比後 +比志 +比志島 +比恵島 +比惠島 +比戸 +比文 +比日 +比日谷 +比日野 +比晋間 +比曽 +比木 +比本 +比村 +比松 +比果 +比枝 +比森 +比楽 +比榮 +比樂 +比毛 +比毛谷 +比毛野 +比気 +比氣 +比永 +比江 +比江島 +比江嶋 +比江森 +比沢 +比治 +比津 +比浦 +比湖 +比澤 +比田 +比田井 +比田勝 +比畄木 +比留 +比留井 +比留川 +比留木 +比留沢 +比留澤 +比留田 +比留間 +比知屋 +比知黒 +比石 +比砂 +比米 +比羅 +比羅岡 +比義 +比翼 +比能 +比與森 +比舎 +比舗 +比良 +比良井 +比良元 +比良園 +比良多 +比良山 +比良岡 +比良幅 +比良木 +比良松 +比良田 +比良野 +比良間 +比蓮崎 +比見 +比計 +比護 +比谷 +比豫森 +比貝原 +比賀 +比賀江 +比連崎 +比那田 +比野 +比野下 +比野平 +比金 +比須田 +比高 +毘奈 +毘比野 +毘沙賀 +毘盧谷 +毘舎利 +毛上 +毛下 +毛井 +毛保 +毛内 +毛利 +毛利上 +毛利下 +毛利井 +毛利元 +毛利光 +毛利山 +毛利川 +毛利田 +毛利藤 +毛利部 +毛利野 +毛加伊 +毛勝 +毛千 +毛原 +毛取 +毛受 +毛口 +毛吹 +毛呂 +毛呂井 +毛坂 +毛塚 +毛家村 +毛尾 +毛屋 +毛山 +毛島 +毛川 +毛戸 +毛房 +毛木 +毛村 +毛束 +毛枝 +毛江田 +毛津 +毛洲 +毛海 +毛涯 +毛満 +毛生川 +毛田 +毛畑 +毛留 +毛登 +毛登利 +毛登山 +毛知 +毛穴 +毛笠 +毛篭 +毛籠 +毛糠 +毛綱 +毛綿 +毛綿谷 +毛織 +毛良 +毛芝 +毛茂山 +毛藤 +毛見 +毛谷 +毛谷村 +毛貫 +毛賀沢 +毛賀澤 +毛越 +毛路 +毛部川 +毛里 +毛野 +毛鎗 +毛間内 +毛阪 +毛防子 +毛須 +毛頭 +毛馬 +毛馬内 +毛鳥 +毬山 +氈受 +氏 +氏上 +氏下 +氏中 +氏丸 +氏久 +氏井 +氏倉 +氏元 +氏兼 +氏内 +氏原 +氏口 +氏吉 +氏家 +氏尾 +氏居 +氏山 +氏岡 +氏峯 +氏峰 +氏島 +氏川 +氏師 +氏平 +氏弘 +氏房 +氏政 +氏木 +氏本 +氏村 +氏松 +氏林 +氏森 +氏橋 +氏次 +氏永 +氏江 +氏浦 +氏王 +氏田 +氏益 +氏神 +氏福 +氏縄 +氏繩 +氏脇 +氏衛 +氏見 +氏部 +氏郷 +氏里 +氏野 +氏長 +氏間 +民 +民上 +民下 +民久 +民井 +民内 +民喜 +民宅 +民守 +民安 +民実 +民宮 +民家 +民實 +民屋 +民山 +民岡 +民幹 +民徳 +民木 +民本 +民村 +民永 +民沢 +民法 +民澤 +民田 +民秋 +民繁 +民草 +民西 +民谷 +民輪 +民農 +民辻 +民部 +民部田 +民里 +民野 +民長 +民門 +気仙 +気仙沼 +気加沢 +気境 +気多 +気屋村 +気戸 +気比 +気比田 +気田 +気羅紗 +気谷 +気賀 +気賀沢 +気賀澤 +気駕 +気鮓 +氣仙 +氣加澤 +氣境 +氣多 +氣屋村 +氣戸 +氣比 +氣比田 +氣田 +氣谷 +氣賀 +氣賀沢 +氣賀澤 +氣駕 +氣鮓 +水 +水の江 +水ケ保 +水ケ谷 +水ケ迫 +水ノ上 +水ノ江 +水ノ浦 +水上 +水下 +水並 +水中 +水丸 +水主 +水主川 +水主村 +水久保 +水之上 +水之江 +水之浦 +水亀 +水井 +水井手 +水代 +水会 +水位 +水侍 +水保 +水信 +水俣 +水倉 +水偉 +水元 +水光 +水入 +水六 +水共 +水兼 +水内 +水冨 +水凌 +水出 +水分 +水切 +水利 +水勢 +水北 +水卜 +水原 +水友 +水取 +水口 +水合 +水吉 +水名 +水名口 +水吐 +水向 +水呉 +水呑 +水味 +水和 +水品 +水喰 +水嚢 +水四 +水国 +水國 +水地 +水坂 +水坪 +水垂 +水垣 +水城 +水埜 +水堀 +水堂 +水場 +水増 +水多 +水姓 +水子 +水宅 +水守 +水安 +水宮 +水家 +水寄 +水富 +水小瀬 +水小田 +水尻 +水尾 +水居 +水屋 +水山 +水岡 +水岩 +水岩田 +水岳 +水岸 +水島 +水崎 +水嵜 +水嶋 +水嶌 +水嶼 +水川 +水巻 +水師 +水平 +水幸 +水広 +水庫 +水庭 +水廣 +水延 +水廻 +水引 +水弘 +水志 +水成 +水戸 +水戸井 +水戸口 +水戸守 +水戸屋 +水戸岡 +水戸川 +水戸瀬 +水戸田 +水戸目 +水戸谷 +水戸路 +水戸辺 +水戸邉 +水戸邊 +水戸部 +水戸野 +水房 +水持 +水挽 +水掘 +水掛 +水掫 +水摩 +水政 +水方 +水早 +水時 +水智 +水書 +水月 +水木 +水本 +水杉 +水村 +水松 +水林 +水枝 +水枝谷 +水柿 +水株 +水根 +水梨 +水梨子 +水森 +水棹 +水植 +水楢 +水樋 +水樹 +水樽 +水橋 +水次 +水止 +水正 +水殿 +水毛 +水毛生 +水氏 +水民 +水気 +水氣 +水永 +水江 +水池 +水沢 +水河 +水治 +水沼 +水波 +水泥 +水洗 +水洞 +水津 +水流 +水流丸 +水流園 +水流添 +水流田 +水流薗 +水浜 +水浦 +水浪 +水海 +水深 +水淵 +水添 +水清 +水清田 +水渓 +水渕 +水渡 +水溜 +水溪 +水滝 +水漉 +水漏 +水澄 +水澗 +水澤 +水瀧 +水瀬 +水無 +水無口 +水無川 +水無瀬 +水牧 +水玉 +水王 +水琴 +水生 +水田 +水由 +水甲 +水町 +水畑 +水留 +水登 +水白 +水益 +水盛 +水相 +水真 +水矢 +水知 +水石 +水砂 +水磨 +水神 +水科 +水穂 +水穴 +水窪 +水端 +水竹 +水筑 +水篠 +水粉 +水精 +水納 +水納谷 +水細 +水緯 +水縄 +水繰 +水羽 +水胤 +水脇 +水腰 +水舎 +水舟 +水舩 +水船 +水良 +水艸 +水芦 +水茎 +水草 +水菓子 +水落 +水葉 +水蔵 +水薮 +水藤 +水藻 +水蘆 +水行 +水西 +水見 +水請 +水谷 +水谷内 +水谷川 +水貝 +水賀美 +水越 +水足 +水路 +水車 +水軒 +水辺 +水迫 +水速 +水道 +水邉 +水邊 +水郡 +水重 +水野 +水野上 +水野倉 +水野元 +水野口 +水野尾 +水野屋 +水野得 +水野江 +水野谷 +水野間 +水金 +水長 +水門 +水間 +水関 +水阪 +水附 +水除 +水雲 +水音 +水須 +水頭 +水飼 +水香 +水馬 +水高 +水魚谷 +水鳥 +水鳥川 +水鴨 +水鶏口 +水黒 +水𡌛 +氷 +氷上 +氷坂 +氷室 +氷山 +氷川 +氷樫 +氷沢 +氷治 +氷海 +氷渡 +氷澤 +氷熊 +氷田 +氷置 +氷見 +氷見山 +氷見谷 +氷見野 +氷谷 +氷貝 +氷野 +氷鉋 +氷高 +永 +永ノ尾 +永ノ間 +永一 +永上 +永下 +永下山 +永世 +永丘 +永並 +永中 +永丸 +永久 +永久井 +永久保 +永二 +永井 +永井口 +永井田 +永井野 +永仁 +永代 +永仮 +永仲 +永伝 +永住 +永佐 +永佐子 +永体 +永作 +永來 +永保 +永信 +永倉 +永元 +永光 +永全 +永内 +永冨 +永冨士 +永冶 +永出 +永利 +永前 +永割 +永勝 +永勢 +永南 +永原 +永友 +永取 +永口 +永合 +永吉 +永名 +永味 +永和 +永和田 +永善 +永喜 +永喜多 +永国 +永國 +永園 +永地 +永坂 +永城 +永埜 +永堀 +永場 +永塘 +永塚 +永塩 +永墓 +永壽 +永多 +永奥 +永好 +永妻 +永守 +永安 +永安寺 +永宗 +永宝 +永宮 +永家 +永富 +永富士 +永寿 +永射 +永尾 +永居 +永屋 +永山 +永岐 +永岑 +永岡 +永岩 +永峯 +永峰 +永島 +永島田 +永崎 +永嶋 +永嶌 +永嶒 +永嶺 +永川 +永市 +永幡 +永平 +永広 +永座 +永康 +永廣 +永延 +永廹 +永廻 +永弘 +永当 +永後 +永徳 +永徳屋 +永志 +永志田 +永恵 +永惠 +永成 +永戸 +永房 +永所 +永手 +永持 +永指 +永政 +永旗 +永昌 +永易 +永星 +永春 +永時 +永曽 +永曾 +永月 +永木 +永末 +永本 +永杉 +永村 +永束 +永来 +永東 +永松 +永林 +永枝 +永柄 +永柳 +永柴 +永栄 +永根 +永桶 +永棟 +永森 +永棹 +永椎 +永業 +永楽 +永榮 +永樂 +永橋 +永次 +永正 +永武 +永水 +永汐 +永江 +永池 +永沢 +永治 +永沼 +永泉 +永波 +永洞 +永津 +永津根 +永浜 +永浦 +永浴 +永海 +永淀 +永淵 +永添 +永清 +永渓 +永渕 +永渡 +永湯 +永満 +永源 +永溝 +永溪 +永滝 +永潟 +永澄 +永澤 +永濱 +永瀧 +永瀬 +永牟田 +永牟礼 +永牧 +永玉栄 +永玉榮 +永生 +永用 +永甫 +永田 +永田屋 +永田平 +永由 +永町 +永畄 +永畑 +永留 +永畠 +永當 +永登 +永益 +永盛 +永目 +永相 +永矢 +永石 +永砂 +永磯 +永礼 +永祚 +永神 +永福 +永禮 +永秋 +永穂 +永積 +永穗 +永窪 +永立 +永竹 +永竿 +永管 +永籏 +永籐 +永籔 +永納 +永綱 +永緑 +永縄 +永繁 +永織 +永繩 +永美 +永義 +永翁 +永耒 +永脇 +永舩 +永船 +永良 +永芳 +永茂 +永草 +永菅 +永蓮 +永蔵 +永薗 +永薮 +永藁 +永藏 +永藤 +永藪 +永西 +永見 +永角 +永言 +永誉 +永譽 +永谷 +永豊 +永越 +永路 +永躰 +永車 +永辺 +永辻 +永迫 +永通 +永道 +永部 +永都 +永里 +永重 +永野 +永野元 +永野原 +永野川 +永野田 +永野間 +永金 +永鉋 +永長 +永門 +永間 +永関 +永阪 +永隅 +永隈 +永雄 +永露 +永須 +永領 +永高 +永鳥 +永黒 +永𡌛 +汀 +汀埜 +求 +求原 +求广川 +求磨川 +求衛 +求野 +求馬 +求麻川 +汐中 +汐井 +汐元 +汐先 +汐入 +汐別 +汐原 +汐口 +汐埼 +汐山 +汐崎 +汐川 +汐巻 +汐待 +汐後 +汐折 +汐持 +汐月 +汐江 +汐池 +汐沢 +汐津 +汐浜 +汐海 +汐満 +汐滿 +汐澤 +汐瀬 +汐田 +汐留 +汐碇 +汐見 +汐谷 +汐重 +汐野 +汐除 +汗井 +汗部 +江 +江の上 +江の沢 +江の目 +江ケ崎 +江ケ嵜 +江ノ上 +江ノ口 +江ノ島 +江ノ本 +江ノ浦 +江ノ畑 +江ノ目 +江䰗 +江上 +江下 +江並 +江中 +江丸 +江久保 +江之口 +江之城 +江之本 +江井 +江代 +江住 +江信 +江俣 +江倉 +江元 +江先 +江入 +江六前 +江内 +江内田 +江内谷 +江出 +江刈 +江刈内 +江刈川 +江利 +江利口 +江利山 +江利川 +江利田 +江利角 +江刺 +江刺家 +江則 +江剌 +江前 +江副 +江南 +江原 +江又 +江取 +江口 +江古 +江司 +江名 +江名子 +江向 +江唐 +江国 +江國 +江園 +江坂 +江垰 +江城 +江堀 +江場 +江場田 +江塚 +江夏 +江子 +江守 +江宮 +江家 +江富 +江寺 +江導寺 +江尻 +江尾 +江居 +江山 +江岡 +江岸 +江島 +江島谷 +江崎 +江崎屋 +江嵐 +江嵜 +江嶋 +江嶌 +江川 +江川野 +江州 +江左 +江帾 +江幡 +江平 +江平原 +江座 +江形 +江後 +江後田 +江徳 +江志 +江成 +江戸 +江戸保 +江戸原 +江戸塚 +江戸屋 +江戸崎 +江戸川 +江戸田 +江戸端 +江戸網 +江戸谷 +江戸輪 +江戸野 +江打 +江指 +江操 +江文 +江方 +江星 +江曽 +江曾 +江月 +江木 +江木畑 +江木畠 +江末 +江本 +江村 +江東 +江松 +江林 +江枝 +江柄 +江柄子 +江森 +江橋 +江殿 +江水 +江永 +江沢 +江河 +江治 +江沼 +江泉 +江波 +江波戸 +江洌 +江津 +江洲 +江浜 +江浦 +江浪 +江海 +江淵 +江添 +江渕 +江渡 +江湖 +江湖山 +江澤 +江濱 +江無田 +江熊 +江爪 +江牧 +江玉 +江理口 +江田 +江田浜 +江町 +江畑 +江畠 +江発田 +江登 +江發田 +江盛 +江目 +江石 +江碕 +江神 +江種 +江積 +江窪 +江竜 +江竜田 +江端 +江筋田 +江篭 +江篭平 +江籐 +江籠 +江籠平 +江縁 +江縫 +江繋 +江羅 +江美 +江胡 +江舟 +江良 +江良木 +江艸 +江芝 +江花 +江苅 +江苅内 +江苅川 +江草 +江菅 +江葉 +江葉田 +江蒲 +江蓮 +江蔵 +江薄 +江藏 +江藤 +江表 +江袋 +江西 +江見 +江見澤 +江角 +江谷 +江賀 +江越 +江辺 +江辺野 +江辻 +江連 +江道 +江道寺 +江遠 +江邉 +江邊 +江邑 +江邨 +江部 +江部木 +江郷 +江郷下 +江里 +江里原 +江里口 +江里川 +江野 +江野上 +江野下 +江野口 +江野尻 +江野島 +江野嶋 +江野川 +江野本 +江野村 +江野沢 +江野澤 +江野畑 +江野窪 +江野脇 +江野間 +江金 +江釣子 +江長 +江間 +江間田 +江阪 +江隅 +江隈 +江面 +江頭 +江馬 +江馬城 +江高 +江鬮 +江鳩 +江鹿 +江黒 +江龍 +江龍田 +池 +池の上 +池の谷 +池の迫 +池ケ谷 +池ノ上 +池ノ下 +池ノ内 +池ノ島 +池ノ川 +池ノ平 +池ノ本 +池ノ田 +池ノ谷 +池ノ辺 +池ノ迫 +池ノ都 +池一 +池三津 +池上 +池下 +池並 +池中 +池主 +池乃本 +池久保 +池之 +池之上 +池之俣 +池之側 +池之元 +池之内 +池之原 +池之坊 +池之子 +池之山 +池之島 +池之嶌 +池之平 +池之座 +池之本 +池之畑 +池之端 +池之谷 +池之迫 +池之野 +池乗 +池乘 +池亀 +池井 +池井戸 +池住 +池保 +池信 +池俣 +池倉 +池側 +池元 +池光 +池内 +池冨 +池冨士 +池前 +池加美 +池勝 +池北 +池原 +池原谷 +池又 +池口 +池吉 +池名 +池向 +池呂 +池味 +池和田 +池園 +池土 +池地 +池坂 +池坊 +池垣 +池垣内 +池垰 +池城 +池埜 +池埼 +池堂 +池場 +池増 +池墻 +池外 +池多 +池太 +池奥 +池子 +池宇地 +池宇都 +池守 +池安 +池宗 +池室 +池宮 +池宮城 +池家 +池富 +池富士 +池尻 +池尻野 +池尾 +池屋 +池山 +池岡 +池岸 +池峠 +池峪 +池峯 +池峰 +池島 +池崎 +池嵜 +池嶋 +池嶌 +池川 +池州 +池幡 +池平 +池広 +池庄司 +池座 +池庭 +池廣 +池延 +池形 +池応 +池應 +池成 +池戸 +池手 +池方 +池月 +池木 +池未 +池末 +池本 +池杉 +池村 +池条 +池来須 +池東 +池松 +池松縄 +池林 +池栗須 +池根 +池桝 +池森 +池植 +池橋 +池水 +池永 +池江 +池沖 +池沢 +池治 +池沼 +池泉 +池波 +池洌 +池津 +池洲 +池浜 +池浦 +池浪 +池淵 +池添 +池渕 +池湧 +池満 +池溝 +池滝 +池澄 +池澤 +池濱 +池照 +池爪 +池牟礼 +池牟禮 +池猪 +池瑞 +池生 +池田 +池田垣 +池田沢 +池田谷 +池町 +池畑 +池留 +池畠 +池盛 +池目 +池知 +池石 +池神 +池福 +池穴 +池窪 +池端 +池竹 +池筒 +池細 +池縁 +池羽 +池羽田 +池肩 +池脇 +池腰 +池舘 +池苗 +池葉 +池葉須 +池薗 +池藤 +池袋 +池西 +池見 +池角 +池谷 +池谷内 +池貝 +池越 +池辺 +池迫 +池道 +池邉 +池邊 +池邑 +池邨 +池部 +池里 +池野 +池野上 +池野元 +池野内 +池野場 +池野奥 +池野屋 +池野本 +池野田 +池野畑 +池野谷 +池野辺 +池野邉 +池野邊 +池鍋 +池長 +池間 +池阪 +池防 +池隅 +池際 +池須 +池頭 +池館 +池首 +池高 +池鯉鮒 +汭田 +汰伊羅 +汰木 +汲井 +汲原 +汲地 +汲崎 +汲川 +汲田 +決得 +汾南 +汾山 +汾陽 +沃川 +沈沢 +沓 +沓ノ屋 +沓内 +沓冠 +沓名 +沓向 +沓屋 +沓山 +沓川 +沓張 +沓形 +沓抜 +沓掛 +沓木 +沓村 +沓水 +沓沢 +沓澤 +沓脱 +沓見 +沓谷 +沓野 +沓間 +沖 +沖ノ井 +沖ノ谷 +沖上 +沖下 +沖世 +沖並 +沖中 +沖丸 +沖久 +沖久保 +沖之城 +沖之島 +沖之株 +沖二 +沖井 +沖代 +沖仲 +沖住 +沖佐々木 +沖信 +沖倉 +沖元 +沖光 +沖兎 +沖内 +沖出 +沖前 +沖升 +沖原 +沖友 +沖口 +沖台 +沖合 +沖吉 +沖名 +沖名子 +沖向 +沖喜 +沖園 +沖土居 +沖地 +沖坂 +沖垣 +沖垣内 +沖埜 +沖堀 +沖塚 +沖塩 +沖増 +沖墨 +沖奈 +沖好 +沖守 +沖安 +沖宗 +沖室 +沖宮 +沖家 +沖尾 +沖居 +沖屋 +沖山 +沖岡 +沖島 +沖崎 +沖嶋 +沖嶌 +沖川 +沖州 +沖平 +沖広 +沖廣 +沖弓 +沖恵 +沖惠 +沖成 +沖手 +沖政 +沖新 +沖木 +沖末 +沖本 +沖杉 +沖村 +沖松 +沖林 +沖枝 +沖柳 +沖根 +沖桝 +沖森 +沖横田 +沖段 +沖殿 +沖水 +沖永 +沖汐 +沖江 +沖沢 +沖河 +沖泉 +沖泙 +沖波 +沖津 +沖洲 +沖浜 +沖浦 +沖浪 +沖淵 +沖添 +沖渕 +沖満 +沖滿 +沖潮 +沖澤 +沖濱 +沖瀬 +沖牟田 +沖田 +沖田屋 +沖畑 +沖畠 +沖益 +沖盛 +沖石 +沖立 +沖端 +沖米田 +沖繁 +沖羽 +沖胡 +沖舘 +沖舛 +沖芝 +沖花 +沖薗 +沖藤 +沖西 +沖見 +沖谷 +沖貝 +沖貞 +沖辺 +沖辻 +沖迫 +沖邉 +沖邊 +沖邑 +沖部 +沖部屋 +沖都 +沖重 +沖野 +沖野谷 +沖長 +沖間 +沖須 +沖館 +沖高 +沙 +沙々木 +沙也 +沙加戸 +沙原 +沙味 +沙川 +沙弥 +沙手 +沙汰 +沙海 +沙田 +沙藤 +沙魚川 +沛野 +沢 +沢ノ上 +沢ノ井 +沢上 +沢下 +沢与 +沢両 +沢中 +沢丸 +沢久 +沢久保 +沢之井 +沢之向 +沢亀 +沢井 +沢代 +沢住 +沢佐 +沢倉 +沢元 +沢入 +沢内 +沢冨 +沢出 +沢勢 +沢北 +沢原 +沢原宜 +沢又 +沢口 +沢合 +沢吉 +沢向 +沢吹 +沢味 +沢園 +沢圦 +沢地 +沢坂 +沢城 +沢埜 +沢塚 +沢多 +沢奥 +沢守 +沢安 +沢宮 +沢尻 +沢尾 +沢居 +沢屋 +沢屋敷 +沢山 +沢岡 +沢岸 +沢岻 +沢島 +沢崎 +沢嵜 +沢嶋 +沢川 +沢己 +沢巳 +沢幡 +沢平 +沢広 +沢座 +沢志 +沢成 +沢戸 +沢木 +沢本 +沢村 +沢松 +沢枝 +沢柳 +沢柿 +沢栄 +沢栗 +沢株 +沢根 +沢森 +沢樹 +沢橋 +沢武 +沢水 +沢永 +沢江 +沢池 +沢治 +沢沼 +沢泉 +沢波 +沢津 +沢津川 +沢津橋 +沢浦 +沢浪 +沢海 +沢淵 +沢添 +沢渕 +沢渡 +沢滝 +沢潟 +沢瀉 +沢瀧 +沢瀬 +沢熊 +沢牟田 +沢生 +沢田 +沢田石 +沢畑 +沢畔 +沢留 +沢畠 +沢登 +沢目 +沢矢 +沢石 +沢端 +沢竹 +沢米 +沢紙 +沢脇 +沢腰 +沢舘 +沢良 +沢良宜 +沢良木 +沢芳 +沢葉 +沢蓮 +沢藤 +沢西 +沢見 +沢谷 +沢越 +沢路 +沢農 +沢辺 +沢近 +沢邉 +沢邊 +沢邑 +沢邨 +沢部 +沢里 +沢重 +沢野 +沢野井 +沢開 +沢間 +沢面 +沢頭 +沢風 +沢飯 +沢館 +河 +河々谷 +河上 +河上屋 +河下 +河下添 +河並 +河中 +河久 +河久保 +河之内 +河之口 +河之形 +河之辺 +河之野 +河二 +河井 +河井田 +河亦 +河人 +河代 +河仲 +河会 +河伝 +河住 +河佐 +河信 +河俣 +河倉 +河備 +河元 +河先 +河光 +河児 +河内 +河内丸 +河内埜 +河内屋 +河内山 +河内田 +河内谷 +河内迫 +河内野 +河出 +河分 +河前 +河前田 +河副 +河勝 +河北 +河千泰 +河千田 +河南 +河原 +河原井 +河原地 +河原埼 +河原場 +河原塚 +河原女 +河原子 +河原山 +河原崎 +河原嵜 +河原市 +河原木 +河原条 +河原林 +河原條 +河原橋 +河原池 +河原田 +河原畑 +河又 +河口 +河合 +河合屋 +河吉 +河名 +河向 +河向井 +河呂 +河和 +河和田 +河喜多 +河地 +河坂 +河城 +河埜 +河埜内 +河堀 +河堂 +河場 +河塚 +河塩 +河増 +河太 +河奈 +河奈辺 +河奥 +河奴谷 +河妹 +河妻 +河宇 +河守 +河守田 +河宗 +河室 +河宮 +河富 +河尻 +河尾 +河居 +河山 +河岡 +河岸 +河島 +河崎 +河崎屋 +河嵜 +河嶋 +河嶌 +河州 +河幡 +河平 +河床 +河底 +河府 +河引 +河形 +河後 +河徳 +河成 +河戸 +河手 +河方 +河智 +河替 +河會 +河月 +河木 +河末 +河本 +河杉 +河村 +河東 +河東田 +河松 +河林 +河枝 +河染 +河柳 +河栗 +河根 +河森 +河横 +河橋 +河毛 +河氏 +河水 +河永 +河江 +河池 +河沖 +河治 +河沼 +河泉 +河波 +河津 +河洲 +河流 +河浜 +河浦 +河浪 +河海 +河淵 +河添 +河済 +河渕 +河渡 +河潟 +河澄 +河濟 +河濱 +河瀉 +河瀬 +河牧 +河生 +河田 +河畑 +河畠 +河登 +河盛 +河目 +河相 +河知 +河石 +河神 +河窪 +河端 +河竹 +河笠 +河納 +河縁 +河繁 +河股 +河脇 +河良 +河菜 +河藤 +河行 +河裾 +河西 +河見 +河角 +河許 +河谷 +河谷内 +河貝 +河賀 +河越 +河路 +河載 +河輪 +河辺 +河辻 +河込 +河近 +河迫 +河連 +河道 +河道前 +河邉 +河邊 +河邑 +河那辺 +河那部 +河邨 +河部 +河部本 +河郷 +河釆 +河里 +河重 +河野 +河野上 +河野内 +河野口 +河野橋 +河野瀬 +河野矢 +河野谷 +河野辺 +河野邉 +河野邊 +河金 +河鍋 +河門 +河門前 +河間 +河関 +河阪 +河附 +河除 +河隅 +河隈 +河隝 +河雲 +河霜 +河面 +河音 +河須崎 +河飯 +河高 +河鮱 +河鰭 +油 +油上 +油下 +油井 +油井原 +油佐 +油免 +油出 +油利 +油利木 +油原 +油口 +油台 +油品 +油地 +油坐 +油家 +油小路 +油尾 +油居 +油屋 +油山 +油島 +油崎 +油嵜 +油嶋 +油川 +油布 +油座 +油形 +油戸 +油木 +油木田 +油本 +油村 +油林 +油橋 +油比 +油江 +油沢 +油治 +油津 +油浅 +油浦 +油淺 +油瀬 +油片 +油田 +油目 +油矢 +油石 +油科 +油納 +油良 +油藤 +油谷 +油野 +油野木 +治 +治々和 +治下 +治久丸 +治井 +治京 +治儀 +治内 +治多 +治家 +治尾 +治居 +治山 +治岡 +治島 +治川 +治徳 +治恩 +治村 +治根田 +治武 +治沢 +治田 +治福 +治良 +治良座 +治藤 +治谷 +治郎丸 +治郎堂 +治郎島 +治郎座 +治郎田 +治部 +治部田 +治部袋 +治部野 +治野 +治金 +治面地 +沼 +沼の井 +沼ノ上 +沼上 +沼下 +沼中 +沼丸 +沼久内 +沼井 +沼佐 +沼保 +沼倉 +沼元 +沼光 +沼内 +沼前 +沼原 +沼口 +沼台 +沼向 +沼和田 +沼地 +沼垂 +沼垣 +沼城 +沼埼 +沼子 +沼守 +沼宮内 +沼尻 +沼尾 +沼居 +沼屋 +沼山 +沼岡 +沼島 +沼島谷 +沼崎 +沼嵜 +沼嶋 +沼川 +沼平 +沼座 +沼形 +沼木 +沼本 +沼村 +沼森 +沼橋 +沼江 +沼池 +沼沢 +沼波 +沼津 +沼浦 +沼浪 +沼淵 +沼渕 +沼滝 +沼澤 +沼濘 +沼瀬 +沼生 +沼田 +沼田下 +沼田尾 +沼田川 +沼田路 +沼畑 +沼知 +沼端 +沼竹 +沼能 +沼臺 +沼舘 +沼袋 +沼谷 +沼賀 +沼越 +沼辺 +沼道 +沼達 +沼邉 +沼邊 +沼部 +沼里 +沼野 +沼野上 +沼野井 +沼間 +沼隈 +沼館 +沽野 +沾野 +泉 +泉上 +泉並 +泉中 +泉丸 +泉久保 +泉二 +泉井 +泉亭 +泉仁 +泉代 +泉伝 +泉住 +泉保 +泉倉 +泉傳 +泉元 +泉内 +泉北 +泉原 +泉口 +泉名 +泉地 +泉坂 +泉堀 +泉多 +泉妻 +泉宗 +泉宮 +泉家 +泉対 +泉對 +泉尾 +泉居 +泉屋 +泉山 +泉岡 +泉島 +泉崎 +泉川 +泉市 +泉平 +泉広 +泉廣 +泉当 +泉明寺 +泉木 +泉本 +泉村 +泉松 +泉林 +泉栄 +泉根 +泉森 +泉橋 +泉水 +泉永 +泉池 +泉沢 +泉沢田 +泉波 +泉津 +泉津井 +泉浜 +泉浦 +泉海 +泉渕 +泉湧 +泉滝 +泉澤 +泉瀧 +泉灘 +泉玉 +泉王子 +泉田 +泉畑 +泉當 +泉登 +泉盛 +泉福 +泉竝 +泉端 +泉納 +泉美 +泉脇 +泉舘 +泉谷 +泉貴 +泉賀 +泉迫 +泉部 +泉里 +泉野 +泉野目 +泉鍛治 +泉門 +泉関 +泉阪 +泉雄 +泉頭 +泉類 +泉館 +泊 +泊り +泊ケ山 +泊内 +泊出 +泊利 +泊口 +泊岩 +泊川 +泊村 +泊池味 +泊沢 +泊澤 +泊瀬川 +泊谷 +泊里 +泊野 +泓 +泓上 +泓原 +泓川 +泓本 +泓田 +泓野 +法 +法㚑崎 +法上 +法両 +法中 +法事庵 +法井 +法亢 +法京 +法代地 +法伝 +法伝寺 +法信 +法倉 +法傳 +法元 +法光 +法光院 +法兼 +法利 +法力 +法化図 +法原 +法吉 +法名 +法喜 +法土 +法土寺 +法地 +法坂 +法城 +法城寺 +法堂 +法女木 +法妙 +法守 +法安 +法宗 +法官 +法定 +法寺岡 +法寿庵 +法専 +法山 +法岡 +法岳 +法島 +法崎 +法嵜 +法嶋 +法川 +法師 +法師丸 +法師人 +法師山 +法師浜 +法師濱 +法常 +法幡 +法幸 +法心 +法忍 +法性 +法戸 +法所 +法才 +法教 +法旨 +法月 +法木 +法本 +法村 +法林 +法柏 +法桑 +法森 +法橋 +法正 +法武 +法水 +法永 +法沢 +法泉 +法泉寺 +法澤 +法理 +法用 +法田 +法由 +法眼 +法福 +法積 +法竜院 +法花 +法花堂 +法花津 +法華 +法華津 +法蔵 +法蘇 +法蘓 +法行 +法西 +法覚 +法覺 +法谷 +法貞 +法貴 +法身 +法輪 +法連 +法道 +法道寺 +法邑 +法里 +法野 +法野谷 +法量 +法量崎 +法銭 +法録 +法隆 +法隆寺 +法雨 +法雲 +法霊崎 +法領田 +法龍院 +泗川 +泗水 +泙 +泙原 +泙本 +泙野 +泡原口 +泡淵 +泡渕 +泡田 +波 +波々伯部 +波々壁 +波々部 +波上 +波並 +波之平 +波井 +波伯部 +波佐 +波佐場 +波佐尾 +波佐本 +波佐谷 +波佐間 +波來 +波元 +波光 +波入 +波内 +波出本 +波出石 +波切 +波利 +波利井 +波利摩 +波勢 +波北 +波原 +波口 +波古 +波合 +波吉 +波名城 +波呂 +波場 +波塚 +波塲 +波壁 +波多 +波多埜 +波多江 +波多瀬 +波多腰 +波多辺 +波多邉 +波多部 +波多野 +波多間 +波夛 +波夛腰 +波夛野 +波奈 +波奈井 +波奈土 +波奈津 +波寄 +波尻 +波屋 +波山 +波岡 +波岸 +波島 +波崎 +波嵜 +波嶋 +波嶌 +波川 +波左間 +波平 +波床 +波座 +波座真 +波当根 +波形 +波志 +波戸 +波戸上 +波戸元 +波戸内 +波戸口 +波戸場 +波戸岡 +波戸崎 +波戸本 +波戸村 +波戸根 +波戸瀬 +波戸辺 +波戸邉 +波房 +波打 +波握 +波摩 +波方 +波早田 +波月 +波木 +波木井 +波木居 +波本 +波村 +波来 +波来谷 +波東 +波松 +波柴 +波根 +波根田 +波止 +波止元 +波武名 +波母山 +波毛 +波汐 +波江 +波江田 +波江野 +波河 +波治 +波津 +波津久 +波津見 +波津野 +波涛 +波涛崎 +波済 +波満 +波潟 +波澄 +波濤 +波瀬 +波瀬井 +波瀬山 +波瀬崎 +波瀬川 +波照間 +波爾 +波片 +波玉 +波理 +波瓦 +波田 +波田地 +波田埜 +波田江 +波田腰 +波田野 +波田間 +波留 +波當根 +波磨 +波示 +波種 +波積 +波立 +波竹 +波紫 +波羅 +波羅密 +波能 +波脇 +波良 +波若 +波藤 +波見 +波角 +波谷 +波貝 +波賀 +波賀多 +波賀野 +波越 +波辺 +波連 +波那本 +波部 +波里 +波里野 +波野 +波野平 +波間 +波青 +波音 +波須田 +波頭 +波風 +波食 +波馬 +泥 +泥堂 +泥崎 +泥川 +泥方 +泥濘 +泥田 +泥舟 +泥藤 +泥谷 +泥近 +注連 +注連内 +注連本 +注連沢 +注連澤 +注連野 +泰 +泰下 +泰丘 +泰中 +泰井 +泰円澄 +泰原 +泰国 +泰園澄 +泰圓澄 +泰地 +泰垣内 +泰増 +泰居 +泰山 +泰岡 +泰島 +泰川 +泰平 +泰志 +泰本 +泰村 +泰松 +泰楽 +泰樂 +泰永 +泰江 +泰池 +泰沢 +泰泉寺 +泰澤 +泰田 +泰磨 +泰穴 +泰羅 +泰良 +泰藤 +泰道 +泰野 +泰間 +泻山 +泻形 +泻村 +洋 +洋見 +洋谷 +洌崎 +洌嵜 +洌巻 +洌鎌 +洒井 +洗 +洗井 +洗出 +洗切 +洗川 +洗平 +洗湯 +洗谷 +洗足谷 +洙田 +洞 +洞ケ瀬 +洞ノ上 +洞ノ口 +洞上 +洞下 +洞井 +洞先 +洞内 +洞出 +洞口 +洞地 +洞垣 +洞垣内 +洞城 +洞外 +洞奥 +洞家 +洞尾 +洞山 +洞崎 +洞嶺 +洞川 +洞平 +洞庭 +洞戸 +洞木 +洞本 +洞林 +洞桐 +洞毛 +洞水 +洞江 +洞沢 +洞派 +洞渕 +洞澤 +洞田 +洞田貫 +洞筒 +洞谷 +洞野 +洞雞 +洞鶏 +洞鷄 +津 +津々 +津々日 +津々木 +津々楽 +津々樂 +津々池 +津々治 +津々浦 +津々美 +津々良 +津々見 +津々谷 +津々路 +津々野 +津の国 +津ケ原 +津ケ谷 +津ノ井 +津ノ国 +津ノ國 +津ノ地 +津ノ崎 +津ノ浦 +津ノ田 +津上 +津下 +津下本 +津中 +津丸 +津久 +津久井 +津久井山 +津久場 +津久家 +津久居 +津久戸 +津久江 +津久浦 +津久田 +津久登能 +津久登野 +津久美 +津久茂 +津久見 +津久間 +津之下 +津之地 +津之江 +津之浦 +津之田 +津之郷 +津乗 +津乘 +津九浦 +津井 +津井溜 +津井田 +津京 +津代 +津会 +津佐 +津保 +津保久 +津保井 +津保根 +津倉 +津元 +津先 +津兼 +津内 +津内口 +津出 +津加 +津勢 +津原 +津取場 +津口 +津司 +津吉 +津名 +津向 +津吹 +津吾井 +津呂 +津呂本 +津呂橋 +津和 +津和崎 +津和嵜 +津和本 +津和田 +津和野 +津嘉山 +津嘉田 +津国 +津國 +津地 +津坂 +津垣 +津城 +津埜 +津堀 +津堅 +津堅門 +津場 +津場山 +津塚 +津塩 +津多 +津奈木 +津守 +津室 +津家 +津家田 +津富 +津寺 +津尾 +津居 +津屋 +津山 +津岡 +津島 +津崎 +津嵜 +津嶋 +津嶌 +津川 +津布久 +津布子 +津布工 +津布楽 +津布樂 +津布良 +津幡 +津平 +津府子 +津庭 +津弥鹿 +津張 +津彼 +津志 +津志本 +津志田 +津恵 +津成 +津戸 +津房 +津持 +津方 +津旨 +津曲 +津木 +津末 +津本 +津村 +津村井 +津林 +津枝 +津柳 +津根 +津根鹿 +津梁 +津梅 +津森 +津橋 +津次 +津止 +津武 +津毛 +津氏 +津民 +津永 +津汐 +津江 +津江尻 +津江月 +津江本 +津江田 +津江野 +津汲 +津沢 +津河 +津治 +津波 +津波倉 +津波古 +津洲 +津浜 +津浦 +津浪 +津渕 +津渡 +津滝 +津潟 +津澤 +津濱 +津瀧 +津瀬 +津灘 +津熊 +津牧 +津狩 +津玉 +津田 +津田井 +津田和 +津田川 +津田葉 +津田谷 +津田賀 +津田野 +津町 +津畄 +津畄崎 +津畄見 +津畑 +津留 +津留崎 +津留嵜 +津留村 +津留林 +津留田 +津留見 +津矢田 +津知 +津知田 +津石 +津神 +津祢鹿 +津福 +津禰鹿 +津秋 +津秦 +津稱鹿 +津積 +津穐 +津立 +津端 +津篭 +津籠 +津組 +津羽 +津羽田 +津老 +津能 +津脇 +津舟 +津花 +津茂谷 +津草 +津荷 +津萩 +津葉 +津葉井 +津葉木 +津葉本 +津蔵 +津藤 +津蟹 +津行 +津覇 +津谷 +津谷川 +津貝 +津貫 +津賀 +津賀原 +津賀尾 +津賀山 +津賀村 +津賀根 +津賀沼 +津賀田 +津越 +津路 +津軽 +津軽屋 +津軽石 +津軽谷 +津輕 +津輕石 +津輪元 +津辺 +津辻 +津邉 +津邑 +津邨 +津郷 +津里 +津野 +津野地 +津野尾 +津野島 +津野崎 +津野森 +津野瀬 +津野熊 +津野田 +津野美 +津野見 +津野辺 +津野邉 +津野邊 +津金 +津金沢 +津金澤 +津釜 +津長 +津門 +津間 +津間岡 +津間広 +津間廣 +津間本 +津阪 +津隅 +津隈 +津雪 +津雲 +津露 +津須 +津風呂 +津馬 +津高 +津麦 +洪 +洪原 +洪城 +洪山 +洪川 +洪本 +洪村 +洪水 +洪沢 +洪田 +洪谷 +洪里 +洪野 +洲 +洲上 +洲之内 +洲加本 +洲原 +洲口 +洲合 +洲宮 +洲家 +洲尾 +洲山 +洲岬 +洲崎 +洲嵜 +洲川 +洲巻 +洲戸 +洲木 +洲本 +洲村 +洲桃 +洲永 +洲沢 +洲河 +洲波 +洲浜 +洲浪 +洲淵 +洲渕 +洲澤 +洲濱 +洲盛 +洲脇 +洲船 +洲藤 +洲見 +洲谷 +洲貝 +洲賀 +洲賀崎 +洲野 +洲野戸 +洲鎌 +洲間 +活山 +活洲 +活田 +活魚 +洼畑 +洽地 +派 +派田 +派谷 +流 +流井 +流出 +流割 +流合 +流尾 +流屋敷 +流山 +流川 +流木 +流杉 +流森 +流水 +流渡 +流田 +流目 +流矢 +流石 +流羽 +流谷 +流踊 +浄住 +浄光 +浄内 +浄円寺 +浄原 +浄善 +浄園 +浄土 +浄土寺 +浄坊 +浄安 +浄山 +浄川 +浄弘 +浄徳 +浄念 +浄慶 +浄永 +浄沼 +浄泉 +浄法寺 +浄琳坊 +浄福 +浄聖 +浄西 +浄見 +浄謙 +浄野 +浄閑 +浅 +浅の目 +浅ケ谷 +浅ケ谷内 +浅ノ目 +浅上 +浅下 +浅並 +浅中 +浅久野 +浅井 +浅井取 +浅井田 +浅付 +浅保 +浅倉 +浅儀 +浅元 +浅先 +浅内 +浅冨 +浅利 +浅加 +浅原 +浅取 +浅口 +浅古 +浅名 +浅味 +浅和 +浅品 +浅図 +浅圖 +浅地 +浅坂 +浅垣 +浅城 +浅埜 +浅堀 +浅場 +浅塲 +浅外 +浅奥 +浅妻 +浅子 +浅宮 +浅富 +浅対 +浅小 +浅尾 +浅居 +浅屋 +浅山 +浅岡 +浅島 +浅崎 +浅嶋 +浅嶌 +浅川 +浅巻 +浅市 +浅師 +浅平 +浅広 +浅庫 +浅弘 +浅形 +浅後 +浅成 +浅房 +浅摩 +浅新 +浅日 +浅月 +浅木 +浅木森 +浅本 +浅村 +浅松 +浅林 +浅枝 +浅染 +浅桐 +浅桜 +浅森 +浅樋 +浅櫻 +浅比 +浅水 +浅水屋 +浅永 +浅江 +浅池 +浅沢 +浅河 +浅治 +浅沼 +浅泉 +浅波 +浅津 +浅浦 +浅浪 +浅海 +浅深 +浅湫 +浅澤 +浅瀬 +浅瀬石 +浅熊 +浅理 +浅生 +浅生山 +浅生田 +浅田 +浅男 +浅畑 +浅畠 +浅石 +浅磨 +浅福 +浅積 +浅窪 +浅米 +浅縄 +浅美 +浅羽 +浅胡 +浅能 +浅脇 +浅良 +浅芝 +浅芽 +浅若 +浅苧 +浅草 +浅菜 +浅葉 +浅蔭 +浅蔵 +浅藤 +浅虫 +浅西 +浅見 +浅見河原 +浅谷 +浅貝 +浅賀 +浅越 +浅路 +浅輪 +浅辺 +浅迫 +浅道 +浅邉 +浅邊 +浅部 +浅郷 +浅里 +浅野 +浅野井 +浅野海 +浅野目 +浅野間 +浅長 +浅間 +浅阪 +浅附 +浅雄 +浅雛 +浅霧 +浅面 +浅須 +浅風 +浅香 +浅香保 +浅鳴 +浅黄 +浅黄谷 +浜 +浜ノ上 +浜ノ井 +浜ノ園 +浜上 +浜下 +浜中 +浜久保 +浜之上 +浜也 +浜二 +浜井 +浜井場 +浜付 +浜仲 +浜伊 +浜住 +浜佐部 +浜保 +浜倉 +浜側 +浜元 +浜先 +浜内 +浜出 +浜出口 +浜前 +浜副 +浜北 +浜千代 +浜原 +浜口 +浜口屋 +浜古賀 +浜司 +浜吉 +浜名 +浜向 +浜咲 +浜四津 +浜国 +浜園 +浜地 +浜坂 +浜垣 +浜垣内 +浜城 +浜埜 +浜埼 +浜堀 +浜堂 +浜場 +浜塚 +浜境 +浜増 +浜外 +浜多 +浜奥 +浜子 +浜宇津 +浜守 +浜安 +浜室 +浜宮 +浜家 +浜寄 +浜富 +浜小路 +浜尻 +浜尾 +浜居 +浜屋 +浜屋敷 +浜山 +浜岡 +浜岩 +浜岸 +浜島 +浜崎 +浜嵜 +浜嶋 +浜嶌 +浜川 +浜州 +浜市 +浜師 +浜平 +浜広 +浜床 +浜廣 +浜弓場 +浜形 +浜戸 +浜手 +浜操 +浜政 +浜新 +浜方 +浜月 +浜木 +浜本 +浜村 +浜条 +浜東 +浜松 +浜板 +浜林 +浜栗 +浜根 +浜桐 +浜條 +浜梶 +浜森 +浜橋 +浜欠 +浜正 +浜武 +浜殿 +浜比加 +浜比嘉 +浜氏 +浜水 +浜永 +浜江 +浜池 +浜沖 +浜沢 +浜河 +浜治 +浜沼 +浜波 +浜洌 +浜津 +浜洲 +浜浦 +浜浪 +浜海 +浜涯 +浜淵 +浜添 +浜渕 +浜渡 +浜渦 +浜湊 +浜満 +浜滝 +浜潟 +浜澤 +浜濃 +浜瀉 +浜瀬 +浜爪 +浜片 +浜生 +浜田 +浜田尾 +浜町 +浜畑 +浜畠 +浜畷 +浜登 +浜盛 +浜矢 +浜知 +浜石 +浜砂 +浜磯 +浜礒 +浜福 +浜秋 +浜窄 +浜窪 +浜端 +浜竹 +浜納 +浜組 +浜縁 +浜脇 +浜舘 +浜花 +浜荒津 +浜荻 +浜菜 +浜萩 +浜薗 +浜藤 +浜行 +浜西 +浜見 +浜親 +浜角 +浜詰 +浜谷 +浜谷内 +浜貝 +浜賀 +浜走 +浜越 +浜路 +浜辺 +浜辻 +浜近 +浜迫 +浜遊 +浜道 +浜邉 +浜邊 +浜部 +浜都 +浜里 +浜重 +浜野 +浜野上 +浜野井 +浜野内 +浜野和 +浜野谷 +浜鍛 +浜鍛冶 +浜鍛治 +浜鍜 +浜鍬 +浜長 +浜門 +浜間 +浜阪 +浜陽 +浜際 +浜面 +浜須 +浜頭 +浜風 +浜飯 +浜館 +浜駒 +浜高 +浜高家 +浦 +浦上 +浦下 +浦中 +浦丸 +浦久 +浦久保 +浦井 +浦井戸 +浦代 +浦仲 +浦住 +浦佐 +浦信 +浦元 +浦入 +浦内 +浦冨 +浦出 +浦前 +浦勇 +浦北 +浦南 +浦原 +浦口 +浦吉 +浦名 +浦和 +浦喜 +浦園 +浦土井 +浦地 +浦坂 +浦坪 +浦垣 +浦垣内 +浦城 +浦埜 +浦堀 +浦場 +浦塘 +浦塚 +浦壁 +浦安 +浦宗 +浦宮 +浦家 +浦富 +浦寺 +浦尻 +浦尾 +浦屋 +浦屋敷 +浦山 +浦岡 +浦岩 +浦岸 +浦島 +浦崎 +浦嵜 +浦嶋 +浦嶌 +浦川 +浦川内 +浦巽 +浦市 +浦平 +浦底 +浦志 +浦恩城 +浦戸 +浦所 +浦手 +浦新 +浦方 +浦木 +浦末 +浦本 +浦杉 +浦村 +浦東 +浦松 +浦林 +浦栃 +浦根 +浦森 +浦極 +浦橋 +浦次 +浦水 +浦永 +浦江 +浦池 +浦沢 +浦河 +浦沼 +浦泉 +浦波 +浦津 +浦浜 +浦浪 +浦海 +浦添 +浦渡 +浦滝 +浦潟 +浦澤 +浦濱 +浦瀉 +浦瀧 +浦瀬 +浦牛原 +浦狩 +浦田 +浦町 +浦畑 +浦畠 +浦白 +浦矢 +浦石 +浦神 +浦窪 +浦端 +浦竹 +浦籔 +浦羽 +浦脇 +浦船 +浦芝 +浦葉 +浦薮 +浦藤 +浦藪 +浦袖 +浦西 +浦見 +浦角 +浦詰 +浦谷 +浦賀 +浦越 +浦路 +浦辺 +浦辻 +浦道 +浦邉 +浦邊 +浦部 +浦郷 +浦里 +浦重 +浦野 +浦長瀬 +浦門 +浦隅 +浦霜 +浦霧 +浦須内 +浦頭 +浦風 +浦馬場 +浦鬼 +浦鶴 +浦𡌛 +浪 +浪ノ江 +浪上 +浪下 +浪久 +浪井 +浪元 +浪内 +浪分 +浪切 +浪原 +浪口 +浪合 +浪坂 +浪塚 +浪寄 +浪尾 +浪山 +浪岡 +浪岩 +浪岸 +浪島 +浪崎 +浪嵜 +浪川 +浪平 +浪床 +浪形 +浪打 +浪折 +浪指 +浪方 +浪木 +浪本 +浪杉 +浪松 +浪板 +浪江 +浪治 +浪波 +浪滝 +浪潟 +浪瀧 +浪瀬 +浪田 +浪石 +浪花 +浪華 +浪谷 +浪貝 +浪越 +浪路 +浪辺 +浪近 +浪速 +浪邊 +浪野 +浪金 +浪間 +浪除 +浪風 +浮 +浮ケ谷 +浮世 +浮並 +浮中 +浮乗 +浮亀 +浮住 +浮内 +浮原 +浮名 +浮図 +浮地 +浮城 +浮塚 +浮塩 +浮守 +浮宮 +浮家 +浮山 +浮岡 +浮岳 +浮島 +浮嶋 +浮嶌 +浮川 +浮州 +浮巣 +浮所 +浮揚 +浮月 +浮木 +浮本 +浮村 +浮森 +浮橋 +浮気 +浮氣 +浮池 +浮波 +浮津 +浮洲 +浮浦 +浮海 +浮渡 +浮瀬 +浮牟田 +浮田 +浮石 +浮穴 +浮網 +浮舟 +浮船 +浮草 +浮葉 +浮蓮 +浮見 +浮谷 +浮貝 +浮辺 +浮邉 +浮邊 +浮部 +浮里 +浮野 +浮階 +浮須 +浴 +浴中 +浴井 +浴元 +浴口 +浴坂 +浴尾 +浴山 +浴岡 +浴広 +浴廣 +浴本 +浴村 +浴林 +浴森 +浴永 +浴田 +浴町 +浴畑 +浴野 +浴長 +海 +海ケ倉 +海ノ平 +海上 +海下 +海中 +海乗 +海井 +海人宮 +海付 +海仲 +海住 +海佐 +海作 +海保 +海修 +海元 +海光 +海内 +海冨 +海冶 +海出 +海切 +海前 +海勢頭 +海北 +海南 +海原 +海口 +海古井 +海司 +海呉 +海和 +海善 +海地 +海坂 +海城 +海埜 +海基 +海堀 +海堂 +海場 +海塚 +海塩 +海士 +海士元 +海士泊 +海士部 +海士野 +海外 +海妻 +海子 +海守 +海宝 +海家 +海富 +海寳 +海寶 +海尻 +海尾 +海山 +海岡 +海岳 +海岸 +海島 +海崎 +海嵜 +海嶋 +海嶽 +海川 +海帆 +海平 +海府 +海庵 +海後 +海徳 +海恵 +海悦 +海戸 +海戸田 +海掘 +海方 +海月 +海木 +海本 +海村 +海来 +海東 +海松 +海林 +海棠 +海段 +海気 +海氣 +海永 +海汐 +海江 +海江元 +海江田 +海池 +海沢 +海治 +海沼 +海法 +海波 +海津 +海洲 +海浜 +海浦 +海浪 +海浮 +海淵 +海添 +海渕 +海渡 +海澤 +海濱 +海瀬 +海瀬頭 +海琳 +海生 +海田 +海発 +海發 +海知 +海磯 +海礒 +海神 +海福 +海稲 +海立 +海端 +海籐 +海老 +海老ケ瀬 +海老ケ迫 +海老主 +海老井 +海老原 +海老口 +海老名 +海老坂 +海老坪 +海老塚 +海老子 +海老子川 +海老山 +海老岡 +海老島 +海老崎 +海老嶋 +海老川 +海老本 +海老村 +海老根 +海老水 +海老永 +海老江 +海老池 +海老沢 +海老沼 +海老浦 +海老海 +海老澤 +海老瀬 +海老田 +海老納 +海老谷 +海老野 +海老鼻 +海良 +海良田 +海苔 +海蓋 +海蔵 +海蔵寺 +海藏 +海藏寺 +海藤 +海藻 +海西 +海見 +海許 +海読 +海讀 +海谷 +海貝 +海賀 +海路 +海輪 +海農 +海辺 +海透 +海道 +海達 +海邉 +海邊 +海部 +海部屋 +海部野 +海郷 +海野 +海野原 +海野尾 +海野瀬 +海金 +海鉾 +海鋒 +海間 +海阪 +海附 +海陸 +海隅 +海際 +海雲 +海面 +海須賀 +海頭 +海風 +海馬 +海馬沢 +海馬澤 +海高 +海鹿 +海鼠 +涌上 +涌喜 +涌羅 +涔口 +涔沢 +涔澤 +涛 +涛岡 +涛崎 +涛川 +液野 +涸田 +涼井 +涼山 +涼木 +涼松 +涼笠 +涼野 +涼風 +淀 +淀井 +淀原 +淀口 +淀名和 +淀屋 +淀川 +淀平 +淀木 +淀本 +淀村 +淀森 +淀水 +淀江 +淀沢 +淀河内 +淀淵 +淀渕 +淀渡 +淀澤 +淀瀬 +淀田 +淀縄 +淀繩 +淀見 +淀谷 +淀野 +淀金 +淀門 +淂平 +淋 +淋代 +淋蒔 +淑済 +淘江 +淡 +淡下 +淡中 +淡井 +淡佐 +淡佐口 +淡原 +淡口 +淡吉 +淡地 +淡居 +淡島 +淡嶋 +淡川 +淡成 +淡本 +淡河 +淡浪 +淡海 +淡渕 +淡田 +淡矢 +淡立 +淡谷 +淡越 +淡路 +淡路屋 +淡路川 +淡路谷 +淡輪 +淡野 +淤見 +淨住 +淨光 +淨園 +淨弘 +淨徳 +淨念 +淨慶 +淨沼 +淨泉 +淨法寺 +淨西 +淨見 +淨謙 +淨野 +淨閑 +淪 +深 +深ケ迫 +深ノ木 +深世古 +深串 +深井 +深井沢 +深井澤 +深代 +深佐 +深作 +深來 +深倉 +深元 +深光 +深内 +深出 +深利 +深原 +深口 +深吉 +深名 +深味 +深和 +深喜 +深地 +深坂 +深垣 +深城 +深堀 +深堂 +深増 +深奥 +深宮 +深家 +深尾 +深居 +深屋 +深山 +深岡 +深島 +深崎 +深嶋 +深川 +深川谷 +深平 +深年 +深志 +深応 +深應 +深戸 +深抦 +深持 +深掘 +深日 +深月 +深木 +深本 +深杉 +深村 +深来 +深松 +深林 +深柄 +深栖 +深根 +深梅 +深森 +深毛 +深民 +深水 +深江 +深池 +深沢 +深沢口 +深河 +深治 +深沼 +深津 +深浦 +深海 +深渕 +深渡 +深渡瀬 +深港 +深溝 +深滝 +深潟 +深澤 +深澤口 +深瀧 +深瀬 +深牧 +深田 +深町 +深畑 +深石 +深程 +深籔 +深緑 +深美 +深耒 +深耕 +深艸 +深芝 +深草 +深萱 +深蔵 +深薮 +深藏 +深藪 +深西 +深見 +深親 +深谷 +深谷川 +深貝 +深辺 +深迫 +深通 +深道 +深部 +深野 +深野木 +深間 +深間内 +深阪 +深雪 +深須 +淳 +淳山 +淳田 +淵 +淵の上 +淵ノ上 +淵上 +淵下 +淵之上 +淵井 +淵元 +淵先 +淵内 +淵別 +淵別府 +淵原 +淵口 +淵合 +淵名 +淵向 +淵園 +淵尻 +淵居 +淵山 +淵岡 +淵島 +淵崎 +淵川 +淵木 +淵本 +淵村 +淵柳 +淵橋 +淵江 +淵沢 +淵泉 +淵波 +淵浪 +淵澤 +淵瀬 +淵田 +淵矢 +淵端 +淵脇 +淵藤 +淵見 +淵貝 +淵辺 +淵邉 +淵邊 +淵部 +淵野 +淺上 +淺下 +淺中 +淺井 +淺倉 +淺内 +淺利 +淺原 +淺圖 +淺地 +淺埜 +淺堀 +淺場 +淺妻 +淺子 +淺尾 +淺居 +淺山 +淺岡 +淺島 +淺川 +淺日 +淺木 +淺木森 +淺本 +淺村 +淺松 +淺枝 +淺桐 +淺桜 +淺森 +淺水 +淺治 +淺沼 +淺津 +淺海 +淺湫 +淺生 +淺田 +淺石 +淺美 +淺羽 +淺芝 +淺草 +淺葉 +淺見 +淺谷 +淺貝 +淺賀 +淺越 +淺輪 +淺邊 +淺里 +淺野 +淺野間 +淺間 +淺雄 +淺雛 +淺霧 +淺面 +淺香 +添 +添ノ沢 +添ノ澤 +添原 +添岡 +添島 +添嶋 +添川 +添木 +添本 +添沢 +添泉 +添田 +添畑 +添畠 +添盛 +添石 +添谷 +添郷 +添野 +添高 +清 +清ノ +清三津 +清上 +清下 +清丘 +清中 +清丸 +清久 +清井 +清代 +清位 +清住 +清佐 +清信 +清倉 +清元 +清光 +清光院 +清兼 +清内 +清冨 +清凉 +清利 +清力 +清勇 +清原 +清友 +清口 +清古 +清司 +清吉 +清名 +清吾 +清和 +清和田 +清善 +清喜 +清国 +清國 +清園 +清土 +清地 +清坂 +清城 +清埜 +清基 +清堂 +清塘 +清塚 +清増 +清多 +清天 +清女谷 +清安 +清宗 +清定 +清宝 +清実 +清宮 +清家 +清富 +清實 +清寺 +清寿 +清尾 +清居 +清山 +清岡 +清岳 +清峰 +清島 +清崎 +清嵜 +清嶋 +清嶌 +清嶺地 +清川 +清州 +清左 +清常 +清平 +清広 +清座 +清廣 +清弘 +清徳 +清心 +清志 +清慶 +清成 +清戸 +清政 +清敷 +清明 +清時 +清替 +清月 +清木 +清木場 +清未 +清末 +清本 +清札 +清杉 +清村 +清東 +清松 +清板 +清林 +清枝 +清柳 +清栄 +清森 +清棲 +清楽 +清榮 +清橋 +清次 +清正 +清武 +清水 +清水上 +清水井 +清水口 +清水坊 +清水基 +清水屋 +清水山 +清水岡 +清水島 +清水嶋 +清水川 +清水平 +清水本 +清水村 +清水池 +清水沢 +清水澤 +清水田 +清水畑 +清水目 +清水石 +清水端 +清水谷 +清水辺 +清水迫 +清水邉 +清水野 +清水頭 +清永 +清江 +清池 +清沢 +清河 +清治 +清泉 +清波 +清津野 +清洲 +清流 +清浄 +清浦 +清海 +清涼 +清淨 +清渓 +清湖口 +清源 +清溪 +清滝 +清澄 +清澤 +清瀧 +清瀬 +清玄寺 +清王 +清生 +清田 +清留 +清登 +清益 +清矢 +清石 +清祐 +清神 +清福 +清穂 +清積 +清竹 +清符 +清籐 +清納 +清継 +清綱 +清繁 +清老 +清胤 +清舛 +清舩 +清船 +清良 +清良井 +清荒 +清華 +清蔭 +清藤 +清行 +清見 +清見原 +清覚 +清親 +清覺 +清角 +清護 +清谷 +清貞 +清賀 +清起 +清輔 +清辻 +清迫 +清造 +清道 +清遠 +清部 +清郷 +清都 +清酒 +清里 +清重 +清野 +清野山 +清野谷 +清金 +清長 +清間 +清陀 +清雄 +清雲 +清面 +清須 +清須美 +清飛羅 +清高 +清鶴 +清麻 +清黒 +済喜 +済城 +済場 +済川 +済木 +済本 +済渡 +済田 +済藤 +済谷川 +済賀 +済間 +渊上 +渋 +渋下 +渋久 +渋井 +渋佐 +渋倉 +渋原 +渋口 +渋坂 +渋垂 +渋尾 +渋屋 +渋山 +渋岡 +渋川 +渋市 +渋庵 +渋志 +渋木 +渋村 +渋柿 +渋桑 +渋梨 +渋梨子 +渋武 +渋民 +渋江 +渋沢 +渋河 +渋洞 +渋澤 +渋瀬 +渋生田 +渋田 +渋田見 +渋矢 +渋紙 +渋葉 +渋藤 +渋谷 +渋路 +渋野 +渋鍬 +渋間 +渓 +渓上 +渓中 +渓井 +渓内 +渓口 +渓山 +渓岡 +渓崎 +渓本 +渓村 +渓間 +渕 +渕ノ上 +渕ノ側 +渕上 +渕下 +渕之上 +渕井 +渕倉 +渕側 +渕元 +渕先 +渕内 +渕別 +渕別府 +渕原 +渕口 +渕合 +渕名 +渕向 +渕園 +渕尻 +渕山 +渕岡 +渕島 +渕崎 +渕嵜 +渕川 +渕戸 +渕木 +渕本 +渕村 +渕柳 +渕根 +渕橋 +渕江 +渕沢 +渕波 +渕浪 +渕澤 +渕瀬 +渕田 +渕畑 +渕矢 +渕端 +渕脇 +渕藤 +渕見 +渕谷 +渕貝 +渕辺 +渕返 +渕邉 +渕邊 +渕部 +渕野 +渚 +渚沢 +渚澤 +渚鋤 +渞 +渟城 +渡ケ敷 +渡ケ次 +渡並 +渡中 +渡丸 +渡久地 +渡久山 +渡久川 +渡久平 +渡久知 +渡井 +渡井口 +渡井本 +渡仲 +渡会 +渡保 +渡具地 +渡具知 +渡刈 +渡加 +渡加敷 +渡口 +渡合 +渡名喜 +渡嘉敷 +渡士 +渡子 +渡守 +渡守武 +渡山 +渡島 +渡崎 +渡嶋 +渡川 +渡志川 +渡慶次 +渡慶治 +渡成 +渡會 +渡木 +渡村 +渡来 +渡松 +渡根 +渡根木 +渡植 +渡橋 +渡沢 +渡浪 +渡海 +渡海谷 +渡澤 +渡田 +渡眞利 +渡真利 +渡石 +渡苅 +渡草 +渡越 +渡錬 +渡頭 +渡鹿島 +渤海 +渥原 +渥味 +渥実 +渥實 +渥川 +渥晏谷 +渥海 +渥美 +渥見 +渦元 +渦原 +渦古 +渦尻 +渦尾 +渦居 +渦岡 +渦川 +渦巻 +渦本 +渦波 +渦見 +渦輪 +温 +温井 +温勢 +温品 +温山 +温崎 +温川 +温森 +温水 +温泉 +温泉川 +温海 +温湯 +温田 +温盛 +温見 +温谷 +渫口 +渭原 +渭川 +渭東 +港 +港井 +港元 +港口 +港屋 +港崎 +港川 +港橋 +港田 +港石 +港谷 +港道 +港野 +游張 +渾大防 +渾川 +湈原 +湈本 +湊 +湊元 +湊先 +湊原 +湊口 +湊城 +湊場 +湊屋 +湊山 +湊崎 +湊川 +湊本 +湊村 +湊浦 +湊田 +湊石 +湊谷 +湊辺 +湖 +湖上 +湖中 +湖亀 +湖内 +湖出 +湖南 +湖口 +湖城 +湖埼 +湖尻 +湖屋 +湖山 +湖岐 +湖島 +湖崎 +湖川 +湖平 +湖景 +湖月 +湖本 +湖東 +湖林 +湖水 +湖浜 +湖海 +湖濱 +湖藤 +湖西 +湖野 +湖間戸 +湗田 +湘田 +湛 +湛増 +湟川 +湟打 +湟本 +湟橋 +湟野 +湧口 +湫 +湫田 +湯 +湯の上 +湯の恵 +湯の目 +湯ノ上 +湯ノ元 +湯ノ前 +湯ノ口 +湯ノ恵 +湯ノ惠 +湯ノ木 +湯ノ目 +湯ノ谷 +湯ノ迫 +湯㘴 +湯上 +湯上谷 +湯下 +湯中 +湯丸 +湯丹 +湯之上 +湯之下 +湯之前 +湯之原 +湯之口 +湯之宮 +湯之戸 +湯之脇 +湯之谷 +湯之迫 +湯之道 +湯井 +湯佐 +湯倉 +湯元 +湯免 +湯出 +湯出原 +湯出口 +湯出川 +湯前 +湯北 +湯原 +湯又 +湯口 +湯在 +湯地 +湯坂 +湯坐 +湯垣 +湯城 +湯場 +湯場元 +湯場崎 +湯塩 +湯子 +湯守 +湯室 +湯宮 +湯家谷 +湯尻 +湯尾 +湯屋 +湯屋口 +湯山 +湯岑 +湯岡 +湯峯 +湯峰 +湯島 +湯崎 +湯崎野 +湯嵜 +湯嵜野 +湯嶋 +湯川 +湯平 +湯座 +湯庭 +湯張 +湯徳 +湯恵 +湯戸 +湯手川 +湯日 +湯月 +湯朝 +湯木 +湯木野 +湯本 +湯村 +湯栗 +湯根 +湯桶 +湯森 +湯槇 +湯槙 +湯橋 +湯次 +湯殿 +湯毛 +湯水 +湯江 +湯池 +湯汲 +湯沢 +湯河 +湯治 +湯沼 +湯泉 +湯泉川 +湯津 +湯浅 +湯浅崎 +湯浦 +湯淺 +湯源 +湯溝 +湯澤 +湯瀬 +湯生 +湯田 +湯田園 +湯田坂 +湯田平 +湯町 +湯畑 +湯目 +湯矢 +湯石 +湯窪 +湯立 +湯端 +湯脇 +湯舟 +湯船 +湯葉 +湯葢 +湯蓋 +湯藤 +湯詰 +湯谷 +湯谷迫 +湯貫 +湯越 +湯通堂 +湯邨 +湯郷 +湯里 +湯野 +湯野喜 +湯野宮 +湯野尻 +湯野川 +湯野村 +湯野沢 +湯野澤 +湯門 +湯間 +湯阪 +湯面 +湯頭 +湯高 +湶 +満 +満上 +満下 +満中 +満丸 +満久 +満久保 +満井 +満仁 +満仁崎 +満以 +満仲 +満保 +満倉 +満元 +満先 +満冨 +満処 +満利 +満原 +満友 +満口 +満吉 +満名 +満喜 +満囿 +満園 +満城 +満塩 +満壽居 +満多 +満多野 +満字 +満安 +満富 +満寿 +満寿居 +満寿川 +満尾 +満居 +満屋 +満山 +満岡 +満島 +満崎 +満嵜 +満嶋 +満嶌 +満川 +満平 +満徳 +満恵川 +満惠川 +満所 +満持 +満明寺 +満月 +満木 +満本 +満村 +満束 +満来 +満松 +満林 +満枝 +満森 +満極 +満武 +満永 +満汐 +満江 +満沢 +満河 +満浦 +満淵 +満添 +満渕 +満潮 +満澤 +満濃 +満瀬 +満玉 +満生 +満田 +満畑 +満留 +満留谷 +満益 +満目 +満石 +満福 +満窪 +満羽 +満若 +満薗 +満藤 +満處 +満行 +満見 +満谷 +満越 +満足 +満身 +満重 +満野 +満長 +満間 +満類屋 +溏田 +源 +源上 +源中 +源丸 +源久 +源九 +源五郎丸 +源井 +源代 +源佐 +源信 +源元 +源光 +源光寺 +源入 +源六 +源内 +源出 +源原 +源口 +源古 +源司 +源吉 +源地 +源城 +源埜 +源場 +源多 +源大 +源太 +源太寺 +源宮 +源家 +源尾 +源島 +源崎 +源嵜 +源嶋 +源川 +源工 +源常 +源平 +源幸 +源当 +源後 +源徳 +源戸 +源摩 +源新 +源明 +源本 +源条 +源栄 +源根 +源條 +源正 +源氏 +源氏田 +源水 +源河 +源治 +源波 +源津 +源海 +源済 +源生 +源田 +源田谷 +源甲斐 +源石 +源竹山 +源羽 +源葉 +源藤 +源谷 +源通 +源造 +源野 +源長 +源間 +源関 +源馬 +源鹿 +準規 +溜 +溜ケ谷 +溜井 +溜前 +溜北 +溜口 +溜尾 +溜島 +溜川 +溜広 +溜本 +溜村 +溜水 +溜池 +溜淵 +溜渕 +溜田 +溜畑 +溜箭 +溜衛 +溜谷 +溜貝 +溜野 +溝 +溝ノ上 +溝ノ口 +溝上 +溝下 +溝中 +溝久 +溝久保 +溝之 +溝之上 +溝井 +溝依 +溝俣 +溝側 +溝元 +溝入 +溝兼 +溝内 +溝前 +溝北 +溝原 +溝口 +溝向 +溝呂木 +溝品 +溝国 +溝國 +溝坂 +溝垣 +溝多 +溝奥 +溝富 +溝尻 +溝尾 +溝山 +溝岡 +溝島 +溝崎 +溝嶋 +溝川 +溝幡 +溝平 +溝広 +溝廣 +溝延 +溝手 +溝抗 +溝曽路 +溝木 +溝本 +溝杉 +溝杭 +溝根 +溝森 +溝橋 +溝次 +溝正 +溝永 +溝江 +溝河 +溝浜 +溝浦 +溝淵 +溝添 +溝渕 +溝田 +溝畑 +溝留 +溝畠 +溝神 +溝祭 +溝端 +溝縁 +溝羽田 +溝脇 +溝腰 +溝花 +溝落 +溝行 +溝西 +溝見 +溝谷 +溝貝 +溝賀 +溝越 +溝辺 +溝道 +溝邉 +溝邊 +溝部 +溝野 +溝間 +溝隈 +溝際 +溝黒 +溢元 +溢田 +溪 +溪中 +溪井 +溪口 +溪山 +溪崎 +溪川 +溪本 +溪村 +溪神 +溪谷 +溪間 +溶原 +溶定 +溶田 +滄木 +滋井 +滋元 +滋埜 +滋富 +滋山 +滋岡 +滋松 +滋沢 +滋澤 +滋田 +滋賀 +滋野 +滋野井 +滑 +滑原 +滑川 +滑志田 +滑方 +滑沢 +滑浦 +滑澤 +滑田 +滑石 +滑羅 +滑良 +滑谷 +滔々 +滕 +滝 +滝ケ山 +滝ケ崎 +滝ケ嵜 +滝ケ平 +滝ケ浦 +滝ケ花 +滝ノ上 +滝ノ内 +滝上 +滝下 +滝中 +滝久 +滝之上 +滝之入 +滝之内 +滝之脇 +滝井 +滝仙 +滝代 +滝住 +滝倉 +滝元 +滝内 +滝前 +滝勇 +滝北 +滝原 +滝又 +滝口 +滝吉 +滝呑 +滝地 +滝坂 +滝坪 +滝垣内 +滝城 +滝埜 +滝場 +滝塚 +滝奥 +滝安 +滝宗 +滝宮 +滝家 +滝寺 +滝尻 +滝尾 +滝居 +滝屋 +滝山 +滝山田 +滝岡 +滝岩 +滝岸 +滝島 +滝崎 +滝嶋 +滝嶌 +滝川 +滝市 +滝常 +滝平 +滝幸 +滝広 +滝廣 +滝後 +滝戸 +滝打 +滝政 +滝新 +滝方 +滝日 +滝明 +滝曲 +滝木 +滝末 +滝本 +滝村 +滝林 +滝柳 +滝根 +滝桐 +滝森 +滝橋 +滝水 +滝永 +滝江 +滝池 +滝沢 +滝河 +滝沼 +滝波 +滝津 +滝浜 +滝浦 +滝浪 +滝深 +滝淵 +滝清 +滝渕 +滝渡 +滝源 +滝澤 +滝瀬 +滝照 +滝熊 +滝爪 +滝田 +滝町 +滝畑 +滝畠 +滝石 +滝窪 +滝童内 +滝端 +滝籐 +滝聞 +滝能 +滝脇 +滝腰 +滝船 +滝花 +滝華 +滝葉 +滝薮 +滝藤 +滝西 +滝見 +滝谷 +滝谷内 +滝貞 +滝賀 +滝越 +滝辺 +滝迫 +滝遊 +滝都 +滝重 +滝野 +滝野口 +滝野川 +滝野沢 +滝野澤 +滝野瀬 +滝鍵 +滝間 +滝阪 +滝雪 +滝音 +滝頭 +滝鼻 +滴草 +滹沱 +滿上 +滿丸 +滿井 +滿仲 +滿保 +滿倉 +滿冨 +滿原 +滿園 +滿壽居 +滿富 +滿尾 +滿屋 +滿岡 +滿島 +滿崎 +滿嶋 +滿木 +滿村 +滿武 +滿永 +滿汐 +滿生 +滿田 +滿留 +滿石 +滿薗 +滿處 +滿野 +滿間 +漁 +漁嶋 +漁府 +漁田 +漂川 +漆 +漆上 +漆下 +漆中 +漆久保 +漆前 +漆原 +漆地 +漆坂 +漆垣 +漆家 +漆尾 +漆屋 +漆山 +漆島 +漆崎 +漆嵜 +漆嶋 +漆嶌 +漆川 +漆師 +漆平 +漆戸 +漆木 +漆本 +漆村 +漆松 +漆林 +漆橋 +漆沢 +漆澤 +漆瀬 +漆田 +漆畑 +漆眞下 +漆真下 +漆脇 +漆舘 +漆葉 +漆谷 +漆迫 +漆道 +漆野 +漆間 +漆館 +漉橋 +漉磯 +漏水 +漏田 +漏留 +演 +演永 +漕江 +漕野 +漠駒 +漢 +漢人 +漢城 +漢川 +漢東 +漢見 +漢那 +漢野 +漣 +漸田 +潁川 +潅峯 +潅峰 +潜木 +潜道 +潟 +潟ケ谷 +潟上 +潟中 +潟保 +潟元 +潟口 +潟場 +潟山 +潟岡 +潟岸 +潟崎 +潟手 +潟村 +潟東 +潟永 +潟沼 +潟浦 +潟淵 +潟渕 +潟湊 +潟田 +潟端 +潟西 +潟見 +潟辺 +潟邉 +潟邊 +潟野 +潤 +潤井 +潤田 +潤米 +潤賀 +潤野 +潤間 +潭田 +潮 +潮上 +潮下 +潮中 +潮井 +潮井川 +潮來 +潮先 +潮入 +潮出 +潮口 +潮地 +潮塚 +潮多 +潮尻 +潮屋 +潮山 +潮崎 +潮川 +潮平 +潮月 +潮木 +潮村 +潮来 +潮水 +潮永 +潮汐 +潮江 +潮津 +潮浜 +潮海 +潮湖 +潮満 +潮濱 +潮瀬 +潮田 +潮留 +潮耒 +潮見 +潮谷 +潮路 +潮野 +潰原 +潰崎 +潰杉 +潰滝 +潰瀧 +潰田 +澁 +澁下 +澁久 +澁井 +澁佐 +澁倉 +澁原 +澁口 +澁坂 +澁垂 +澁屋 +澁山 +澁川 +澁市 +澁庵 +澁木 +澁村 +澁柿 +澁梨子 +澁武 +澁江 +澁沢 +澁澤 +澁田 +澁田見 +澁葉 +澁藤 +澁谷 +澁路 +澁野 +澁鍬 +澁間 +澄 +澄井 +澄兼 +澄出 +澄友 +澄岡 +澄川 +澄本 +澄村 +澄江 +澄田 +澄谷 +澄重 +澄野 +澄長 +澍田 +澗 +澗口 +澗岡 +澗張 +澗株 +澗淵 +澗渕 +澗潟 +澗田 +澗随 +澗隨 +澤 +澤ノ +澤ノ上 +澤ノ井 +澤上 +澤下 +澤両 +澤中 +澤丸 +澤久 +澤久保 +澤之向 +澤亀 +澤井 +澤代 +澤住 +澤佐 +澤倉 +澤元 +澤入 +澤内 +澤出 +澤勢 +澤北 +澤原 +澤原宜 +澤又 +澤口 +澤合 +澤吉 +澤向 +澤吹 +澤味 +澤園 +澤地 +澤坂 +澤城 +澤埜 +澤塚 +澤多 +澤奥 +澤守 +澤安 +澤宮 +澤富 +澤尻 +澤尾 +澤居 +澤屋 +澤屋敷 +澤山 +澤岡 +澤岸 +澤岻 +澤島 +澤崎 +澤嵜 +澤嶋 +澤川 +澤巳 +澤幡 +澤平 +澤座 +澤廣 +澤志 +澤成 +澤戸 +澤木 +澤本 +澤杉 +澤村 +澤松 +澤枝 +澤柳 +澤柿 +澤栄 +澤栗 +澤株 +澤根 +澤森 +澤樹 +澤橋 +澤武 +澤水 +澤永 +澤江 +澤池 +澤泉 +澤波 +澤津 +澤津川 +澤津橋 +澤浦 +澤浪 +澤海 +澤淵 +澤添 +澤渕 +澤渡 +澤滝 +澤潟 +澤瀉 +澤瀧 +澤瀬 +澤熊 +澤牟田 +澤生 +澤田 +澤田石 +澤畑 +澤畔 +澤留 +澤畠 +澤登 +澤目 +澤矢 +澤石 +澤砥 +澤端 +澤竹 +澤米 +澤紙 +澤脇 +澤腰 +澤與 +澤舘 +澤良木 +澤葉 +澤藤 +澤西 +澤見 +澤谷 +澤越 +澤路 +澤農 +澤辺 +澤近 +澤邉 +澤邊 +澤邑 +澤部 +澤里 +澤重 +澤野 +澤野井 +澤開 +澤間 +澤面 +澤頭 +澤飯 +澤館 +澪川 +澳 +澳原 +澳塩 +澳本 +澳津 +澵井 +澵塩 +澾 +濁川 +濁池 +濁沢 +濁沼 +濁澤 +濃中 +濃人 +濃口 +濃川 +濃明 +濃本 +濃村 +濃沼 +濃添 +濃田 +濃畑 +濃見 +濃野 +濃間 +濃香 +濟川 +濟木 +濟田 +濟籐 +濟藤 +濟谷川 +濟賀 +濡木 +濡田 +濡石 +濡髪 +濤 +濤岡 +濤崎 +濤川 +濱 +濱ノ上 +濱ノ井 +濱ノ園 +濱上 +濱下 +濱中 +濱久保 +濱之上 +濱也 +濱二 +濱井 +濱井場 +濱付 +濱仲 +濱住 +濱保 +濱倉 +濱側 +濱元 +濱先 +濱内 +濱冨 +濱冶 +濱出 +濱出口 +濱前 +濱副 +濱北 +濱千代 +濱原 +濱口 +濱口屋 +濱古賀 +濱司 +濱吉 +濱名 +濱向 +濱咲 +濱四津 +濱園 +濱地 +濱坂 +濱垣 +濱垣内 +濱埜 +濱埼 +濱堀 +濱場 +濱塚 +濱境 +濱増 +濱外 +濱多 +濱奥 +濱子 +濱宇津 +濱守 +濱安 +濱室 +濱家 +濱寄 +濱小路 +濱尻 +濱尾 +濱屋 +濱屋敷 +濱山 +濱岡 +濱岸 +濱島 +濱崎 +濱嵜 +濱嶋 +濱嶌 +濱川 +濱州 +濱市 +濱平 +濱廣 +濱弓場 +濱形 +濱戸 +濱手 +濱操 +濱政 +濱方 +濱月 +濱木 +濱本 +濱村 +濱条 +濱松 +濱板 +濱林 +濱根 +濱桐 +濱條 +濱森 +濱橋 +濱欠 +濱正 +濱武 +濱比嘉 +濱氏 +濱水 +濱永 +濱江 +濱池 +濱沖 +濱沢 +濱河 +濱治 +濱波 +濱津 +濱洲 +濱浦 +濱浪 +濱涯 +濱淵 +濱添 +濱渕 +濱渡 +濱渦 +濱湊 +濱満 +濱滝 +濱潟 +濱澤 +濱瀬 +濱爪 +濱片 +濱生 +濱田 +濱田尾 +濱町 +濱畑 +濱畠 +濱登 +濱盛 +濱矢 +濱石 +濱砂 +濱碕 +濱磯 +濱礒 +濱福 +濱秋 +濱窄 +濱窪 +濱端 +濱竹 +濱納 +濱縁 +濱脇 +濱舘 +濱荒津 +濱荻 +濱萩 +濱薗 +濱藤 +濱行 +濱西 +濱見 +濱親 +濱角 +濱詰 +濱谷 +濱谷内 +濱貝 +濱賀 +濱走 +濱路 +濱辺 +濱辻 +濱近 +濱迫 +濱遊 +濱道 +濱邉 +濱邊 +濱部 +濱里 +濱重 +濱野 +濱野上 +濱野内 +濱野谷 +濱鍛 +濱鍛冶 +濱鍜 +濱長 +濱門 +濱阪 +濱際 +濱須 +濱頭 +濱風 +濱飯 +濱館 +濱駒 +濱高 +濵前 +濵氏 +濵知 +濵重 +瀉上 +瀉口 +瀉場 +瀉山 +瀉形 +瀉方 +瀉村 +瀉永 +瀉田 +瀉野 +瀏 +瀑布川 +瀑野 +瀧 +瀧ケ山 +瀧ケ崎 +瀧ケ平 +瀧ケ花 +瀧ノ上 +瀧ノ内 +瀧上 +瀧下 +瀧个山 +瀧中 +瀧久 +瀧之上 +瀧之入 +瀧之内 +瀧之脇 +瀧井 +瀧代 +瀧住 +瀧倉 +瀧元 +瀧内 +瀧前 +瀧北 +瀧原 +瀧又 +瀧口 +瀧吉 +瀧呑 +瀧地 +瀧坂 +瀧坪 +瀧埜 +瀧場 +瀧塚 +瀧奥 +瀧安 +瀧宮 +瀧寺 +瀧尻 +瀧尾 +瀧居 +瀧屋 +瀧山 +瀧山田 +瀧岡 +瀧岩 +瀧岸 +瀧峠 +瀧島 +瀧崎 +瀧嵜 +瀧嶋 +瀧嶌 +瀧川 +瀧常 +瀧平 +瀧廣 +瀧戸 +瀧打 +瀧政 +瀧方 +瀧日 +瀧明 +瀧末 +瀧本 +瀧村 +瀧林 +瀧柳 +瀧根 +瀧桐 +瀧森 +瀧水 +瀧永 +瀧江 +瀧池 +瀧沢 +瀧泉 +瀧波 +瀧津 +瀧浦 +瀧浪 +瀧深 +瀧渕 +瀧渡 +瀧源 +瀧澤 +瀧濱 +瀧瀬 +瀧熊 +瀧田 +瀧畑 +瀧畠 +瀧石 +瀧窪 +瀧端 +瀧籔 +瀧聞 +瀧能 +瀧脇 +瀧腰 +瀧花 +瀧華 +瀧葉 +瀧藤 +瀧西 +瀧見 +瀧谷 +瀧賀 +瀧迫 +瀧都 +瀧野 +瀧野沢 +瀧野澤 +瀧野瀬 +瀧鍵 +瀧阪 +瀧音 +瀧頭 +瀧鼻 +瀬 +瀬々 +瀬々井 +瀬々倉 +瀬々奈 +瀬〆 +瀬の上 +瀬の口 +瀬ケ沼 +瀬ケ谷 +瀬ノ上 +瀬ノ内 +瀬ノ口 +瀬ノ尾 +瀬ノ田 +瀬上 +瀬下 +瀬並 +瀬丸 +瀬之上 +瀬之内 +瀬之口 +瀬之本 +瀬之間 +瀬井 +瀬亜 +瀬住 +瀬來 +瀬例 +瀬倉 +瀬元 +瀬先 +瀬光 +瀬内 +瀬出井 +瀬分 +瀬切 +瀬利 +瀬利田 +瀬原 +瀬原田 +瀬口 +瀬古 +瀬古口 +瀬古沢 +瀬古澤 +瀬合 +瀬名 +瀬名波 +瀬名畑 +瀬味 +瀬和 +瀬和居 +瀬喜 +瀬土 +瀬在 +瀬在丸 +瀬地山 +瀬垣 +瀬城 +瀬堀 +瀬堂 +瀬堂川 +瀬場 +瀬塚 +瀬多 +瀬子 +瀬守 +瀬安 +瀬室 +瀬宮 +瀬尻 +瀬尾 +瀬尾野 +瀬屋 +瀬屑 +瀬山 +瀬岡 +瀬島 +瀬崎 +瀬嵐 +瀬嵜 +瀬嵩 +瀬嶋 +瀬川 +瀬師 +瀬平 +瀬底 +瀬度 +瀬座 +瀬廼木 +瀬形 +瀬志 +瀬志本 +瀬恒 +瀬成 +瀬成田 +瀬戸 +瀬戸ノ上 +瀬戸上 +瀬戸下 +瀬戸中 +瀬戸丸 +瀬戸井 +瀬戸光 +瀬戸内 +瀬戸升 +瀬戸原 +瀬戸口 +瀬戸坂 +瀬戸垣 +瀬戸垣内 +瀬戸宇治 +瀬戸家 +瀬戸尻 +瀬戸尾 +瀬戸屋 +瀬戸山 +瀬戸岡 +瀬戸島 +瀬戸崎 +瀬戸嶋 +瀬戸川 +瀬戸本 +瀬戸村 +瀬戸東 +瀬戸林 +瀬戸根 +瀬戸浦 +瀬戸瀬 +瀬戸熊 +瀬戸田 +瀬戸脇 +瀬戸西 +瀬戸谷 +瀬戸野 +瀬戸長 +瀬戸間 +瀬政 +瀬斉 +瀬斎 +瀬方 +瀬月内 +瀬木 +瀬木根 +瀬木谷 +瀬木野 +瀬本 +瀬村 +瀬来 +瀬東 +瀬林 +瀬柳 +瀬棚 +瀬森 +瀬楽 +瀬樂 +瀬殿 +瀬水 +瀬永 +瀬江仲 +瀬沢 +瀬河 +瀬治山 +瀬沼 +瀬法司 +瀬波 +瀬津 +瀬津丸 +瀬津田 +瀬津美 +瀬浜 +瀬浦 +瀬浪 +瀬海 +瀬涛 +瀬涯 +瀬淵 +瀬渕 +瀬渡 +瀬溝 +瀬滝 +瀬澤 +瀬濃 +瀬濤 +瀬濱 +瀬瀬 +瀬熊 +瀬爪 +瀬片 +瀬王 +瀬理 +瀬理町 +瀬生 +瀬田 +瀬田井 +瀬田川 +瀬田松 +瀬田石 +瀬町 +瀬畑 +瀬留 +瀬畠 +瀬登 +瀬目 +瀬知 +瀬石 +瀬社家 +瀬窪 +瀬立 +瀬端 +瀬筒 +瀬籐 +瀬納 +瀬羅 +瀬美井 +瀬肩 +瀬能 +瀬能尾 +瀬脇 +瀬良 +瀬良垣 +瀬良田 +瀬藤 +瀬見 +瀬見井 +瀬角 +瀬詰 +瀬谷 +瀬谷崎 +瀬貝 +瀬貫 +瀬賀 +瀬越 +瀬路 +瀬辺 +瀬迫 +瀬迺木 +瀬道 +瀬邉 +瀬邊 +瀬那 +瀬部 +瀬郷 +瀬里 +瀬里崎 +瀬里沢 +瀬里澤 +瀬野 +瀬野口 +瀬野尾 +瀬野川 +瀬野木 +瀬野浦 +瀬野田 +瀬長 +瀬間 +瀬際 +瀬霜 +瀬音 +瀬領 +瀬頭 +瀬高 +瀬鴻 +瀬黒 +瀬齋 +灇 +灌峯 +灌峰 +灘 +灘上 +灘中 +灘乃 +灘井 +灘住 +灘儀 +灘先 +灘光 +灘原 +灘友 +灘口 +灘吉 +灘地 +灘家 +灘尾 +灘山 +灘岡 +灘崎 +灘本 +灘村 +灘波 +灘浜 +灘浪 +灘濱 +灘田 +灘脇 +灘見 +灘谷 +灘辺 +灘邉 +灘邊 +灘部 +灘野 +灥 +火の口 +火の浦 +火ノ口 +火ノ川 +火ノ浦 +火ノ見 +火上 +火丸 +火之浦 +火之迫 +火伏 +火原 +火口 +火口内 +火口山 +火和 +火威 +火室 +火宮 +火山 +火岡 +火島 +火川 +火打石 +火擲石 +火村 +火森 +火浦 +火消 +火焚 +火煙 +火燈 +火爪 +火物 +火狭 +火狹 +火田 +火矢 +火石 +火神 +火箱 +火縄 +火置 +火脚 +火詰 +火谷 +火野 +火野口 +火野坂 +火野宮 +火除 +灯下 +灯中 +灯明 +灯脇 +灰 +灰井 +灰住 +灰佐 +灰原 +灰口 +灰台 +灰咲 +灰垣 +灰塚 +灰外 +灰尾 +灰屋 +灰山 +灰岡 +灰島 +灰崎 +灰川 +灰床 +灰庭 +灰戸 +灰掛 +灰方 +灰本 +灰毛 +灰沢 +灰渕 +灰澤 +灰瀬 +灰玉 +灰玉平 +灰田 +灰藤 +灰西 +灰谷 +灰賀 +灰野 +灰高 +灰鹿野 +炊 +炊江 +炎谷 +炟星 +炬口 +炭 +炭中 +炭之原 +炭井 +炭倉 +炭元 +炭原 +炭口 +炭吉 +炭多 +炭家 +炭富 +炭屋 +炭山 +炭岡 +炭崎 +炭川 +炭常 +炭広 +炭床 +炭廣 +炭恵 +炭惠 +炭木 +炭本 +炭村 +炭永 +炭江 +炭沢 +炭澤 +炭焼 +炭田 +炭矢 +炭窯 +炭竃 +炭竈 +炭蔵 +炭谷 +炭野 +炭釜 +炭鎌 +炮流 +点得 +点東 +点田 +点頭 +為 +為ケ井 +為ケ谷 +為下 +為中 +為久 +為乗 +為井 +為佐 +為保 +為元 +為光 +為則 +為口 +為国 +為國 +為壮 +為季 +為安 +為定 +為実 +為家 +為實 +為尾 +為山 +為岡 +為島 +為崎 +為川 +為平 +為広 +為廣 +為延 +為後 +為成 +為我井 +為房 +為政 +為数 +為敷 +為數 +為明 +為木 +為末 +為本 +為村 +為栗 +為森 +為橋 +為水 +為永 +為汲 +為沢 +為治 +為清 +為澤 +為田 +為矢 +為石 +為福 +為積 +為端 +為羽 +為脇 +為藤 +為行 +為西 +為角 +為計田 +為谷 +為貝 +為貞 +為貴 +為賀 +為近 +為郷 +為重 +為野 +為金 +為長 +為須 +為頭 +為頼 +為高 +烏 +烏ト根 +烏ノ +烏中 +烏丸 +烏光 +烏兎沼 +烏内 +烏原 +烏土居 +烏子 +烏尾 +烏山 +烏川 +烏帽子 +烏帽子田 +烏我 +烏星 +烏末 +烏橋 +烏田 +烏羽 +烏脇 +烏藤 +烏谷 +烏賀陽 +烏賊 +烏野 +烏頭尾 +烏高 +烏鷹 +烝原 +烝徳 +烝野 +烟山 +烟田 +焏原 +焏徳 +焏野 +焔硝岩 +無井 +無佐 +無半麻土 +無地名 +無垢品 +無安 +無尽 +無山 +無川 +無州 +無徒 +無敵 +無替 +無江 +無津呂 +無漏 +無漏田 +無生ケ谷 +無田 +無田上 +無畄井 +無留井 +無盡 +無相 +無着 +無着下 +無神 +無笹 +無良 +無藤 +無道寺 +無量 +無量井 +無量小路 +無量崎 +無量林 +無量江 +無量谷 +無門 +無関 +無雁 +無類 +無類井 +無鳫 +焼中 +焼丸 +焼塩 +焼家 +焼尾 +焼山 +焼岡 +焼広 +焼廣 +焼本 +焼杉 +焼田 +焼石 +焼継 +焼谷 +焼貝 +焼野 +煉谷 +煎塚 +煎本 +煎栄 +煎江 +煎沢 +煎澤 +煎田 +煎谷 +煎野 +煓 +煙ケ谷 +煙上 +煙井 +煙原 +煙山 +煙岡 +煙崎 +煙川 +煙田 +煙石 +煙艸 +煙草 +煙草屋 +煙草森 +煙草谷 +煙谷 +煤々谷 +煤ケ谷 +煤孫 +煤本 +煤田 +煤谷 +煤賀 +照 +照下 +照井 +照信 +照元 +照光 +照内 +照原 +照哉 +照喜名 +照喜納 +照尾 +照屋 +照山 +照岡 +照峰 +照島 +照崎 +照嶋 +照嶌 +照川 +照平 +照後 +照戸 +照日 +照時 +照月 +照木 +照本 +照林 +照永 +照沢 +照沼 +照海 +照澤 +照瀬 +照田 +照谷 +照門 +煮玉 +煮雪 +熊 +熊ケ井 +熊ケ耳 +熊ケ谷 +熊ケ迫 +熊ノ細 +熊ノ迫 +熊ノ郷 +熊一 +熊上 +熊下 +熊中 +熊丸 +熊主 +熊久保 +熊之細 +熊井 +熊井戸 +熊代 +熊住 +熊佐 +熊俣 +熊倉 +熊元 +熊内 +熊凝 +熊切 +熊前 +熊副 +熊南 +熊原 +熊又 +熊取 +熊取屋 +熊取谷 +熊口 +熊善 +熊喜 +熊地 +熊坂 +熊城 +熊埜堂 +熊埜御堂 +熊埜谷 +熊埼 +熊塩 +熊守 +熊安 +熊宮 +熊家 +熊尾 +熊居 +熊屋 +熊山 +熊岡 +熊岸 +熊島 +熊崎 +熊嵜 +熊嶋 +熊川 +熊己 +熊巳 +熊平 +熊庄 +熊懐 +熊戸 +熊手 +熊抱 +熊捕 +熊木 +熊本 +熊村 +熊林 +熊柳 +熊森 +熊橋 +熊毛 +熊永 +熊江 +熊沢 +熊河 +熊洞 +熊浦 +熊淵 +熊添 +熊渕 +熊滝 +熊澤 +熊瀧 +熊瀬 +熊瀬川 +熊無 +熊狼 +熊王 +熊生 +熊田 +熊田原 +熊畑 +熊白 +熊石 +熊笹 +熊籔 +熊給 +熊耳 +熊脇 +熊膳 +熊薮 +熊藤 +熊藪 +熊西 +熊見 +熊谷 +熊賀 +熊走 +熊越 +熊辺 +熊辻 +熊迫 +熊部 +熊郷 +熊里 +熊重 +熊野 +熊野屋 +熊野御堂 +熊野林 +熊野谷 +熊野谿 +熊鞍 +熊須 +熊頭 +熊高 +熊鰐 +熊鳥 +熊鷹 +熟 +熟山 +熟田 +熨斗 +熨斗谷 +熱尾 +熱川 +熱方 +熱海 +熱田 +熱見 +熱野 +燃杭 +燃脇 +燈 +燈下 +燈中 +燈台 +燈明 +燈明田 +燈村 +燈田 +燈脇 +燒尾 +燒田 +燕 +燕昇司 +燕谷 +營田 +營野 +燧 +燧土 +燿山 +爪 +爪丸 +爪坂 +爪川 +爪林 +爪橋 +爪田 +爪野 +爪長 +爬揚 +爰保 +爰地 +爰島 +爰川 +爰河 +爰野 +爲 +爲ケ谷 +爲下 +爲久 +爲乗 +爲井 +爲佐 +爲保 +爲元 +爲光 +爲則 +爲国 +爲國 +爲季 +爲安 +爲定 +爲実 +爲家 +爲實 +爲岡 +爲島 +爲崎 +爲川 +爲平 +爲広 +爲廣 +爲後 +爲成 +爲我井 +爲房 +爲政 +爲数 +爲數 +爲明 +爲木 +爲末 +爲本 +爲村 +爲栗 +爲水 +爲永 +爲沢 +爲清 +爲澤 +爲田 +爲石 +爲福 +爲積 +爲藤 +爲行 +爲西 +爲計田 +爲谷 +爲貝 +爲近 +爲重 +爲金 +爲頼 +父尾 +父川 +父恵 +父母 +父母石 +父母院 +父田 +爾 +爾摩 +爾波 +爾牟田 +爾見 +片 +片ケ瀬 +片ノ坂 +片㘴 +片上 +片下 +片丘 +片丸 +片之坂 +片亀 +片井 +片井木 +片井野 +片伊勢 +片伊木 +片伯部 +片保 +片倉 +片側 +片元 +片内 +片出 +片切 +片刈 +片前 +片原 +片原田 +片又 +片叉 +片受 +片口 +片吉 +片向 +片地 +片坂 +片坐 +片垣 +片城 +片場 +片塩 +片塰 +片境 +片外 +片多 +片夜 +片奇 +片子沢 +片子澤 +片宗 +片宮 +片家 +片寄 +片小田 +片尾 +片居 +片居木 +片屋 +片山 +片岡 +片岩 +片岳 +片岸 +片峯 +片峰 +片島 +片崎 +片嶋 +片嶌 +片嶺 +片川 +片平 +片広 +片座 +片庭 +片廣 +片廻 +片懸 +片所 +片手 +片折 +片掛 +片方 +片月 +片木 +片木山 +片木谷 +片本 +片村 +片松 +片板 +片林 +片柳 +片柴 +片根 +片桐 +片橋 +片江 +片池 +片沢 +片河 +片沼 +片波 +片波見 +片津 +片浜 +片浦 +片浪 +片海 +片淵 +片渕 +片澤 +片濱 +片瀬 +片爪 +片牧 +片狩 +片瓜 +片田 +片田江 +片田野 +片男浪 +片町 +片畑 +片畠 +片白 +片矢 +片石 +片神 +片穂野 +片穗野 +片粕 +片糸 +片羽 +片股 +片脇 +片良 +片芝 +片苅 +片菊 +片葺 +片蓋 +片藤 +片衛 +片西 +片見 +片角 +片谷 +片貝 +片辺 +片迫 +片邉 +片邊 +片郡 +片部 +片重 +片野 +片野坂 +片野田 +片鍋 +片鎌 +片長 +片領 +片首 +牙山 +牛 +牛の浜 +牛ケ尾 +牛ケ瀬 +牛ケ谷内 +牛ノ浜 +牛ノ濱 +牛上 +牛中 +牛丸 +牛久 +牛久保 +牛之浜 +牛之濱 +牛井淵 +牛井渕 +牛作 +牛來 +牛倉 +牛内 +牛円 +牛原 +牛口 +牛古 +牛呂 +牛土毛 +牛坂 +牛坊 +牛垣 +牛城 +牛堀 +牛堂 +牛場 +牛塚 +牛塲 +牛多 +牛奥 +牛安沢 +牛安澤 +牛尼 +牛尾 +牛尾田 +牛尾谷 +牛居 +牛屋 +牛山 +牛岡 +牛岩 +牛島 +牛崎 +牛嶋 +牛嶌 +牛川 +牛平 +牛建 +牛戸 +牛房 +牛抱 +牛方 +牛木 +牛本 +牛村 +牛来 +牛林 +牛根 +牛水 +牛永 +牛江 +牛池 +牛沢 +牛河 +牛河内 +牛津 +牛流 +牛浜 +牛渡 +牛滝 +牛澤 +牛濱 +牛瀧 +牛熊 +牛牧 +牛王 +牛王田 +牛玖 +牛田 +牛留 +牛畠 +牛石 +牛神 +牛窓 +牛窪 +牛米 +牛耒 +牛腸 +牛膓 +牛若 +牛苧 +牛草 +牛衛 +牛袋 +牛見 +牛角 +牛詰 +牛谷 +牛谷内 +牛越 +牛路 +牛踏 +牛込 +牛迫 +牛追 +牛造 +牛道 +牛野 +牛間 +牛間木 +牛隈 +牛頭 +牛飼 +牛首 +牛鬼 +牛黄耆 +牛黄蓍 +牛黒 +牛鼻 +牝小路 +牟久 +牟岐 +牟木 +牟田 +牟田原 +牟田口 +牟田園 +牟田島 +牟田崎 +牟田神 +牟田神東 +牟田神西 +牟田谷 +牟田部 +牟礼 +牟禮 +牟藤 +牡丹 +牡司 +牡渡 +牡若 +牡野 +牡鹿 +牧 +牧ケ谷 +牧ケ野 +牧ノ内 +牧ノ原 +牧ノ段 +牧ノ瀬 +牧ノ矢 +牧上 +牧下 +牧中 +牧主 +牧之内 +牧之口 +牧之段 +牧之瀬 +牧之田 +牧之角 +牧井 +牧伊 +牧住 +牧元 +牧内 +牧出 +牧原 +牧口 +牧吉 +牧問 +牧園 +牧地 +牧坂 +牧垣 +牧埜 +牧多 +牧大 +牧子 +牧宮 +牧寄 +牧寺 +牧尾 +牧屋 +牧山 +牧岡 +牧島 +牧崎 +牧嵜 +牧嶋 +牧嶌 +牧川 +牧平 +牧広 +牧志 +牧戸 +牧方 +牧木 +牧本 +牧村 +牧林 +牧枝 +牧森 +牧水 +牧永 +牧江 +牧沢 +牧浦 +牧添 +牧渕 +牧港 +牧澤 +牧瀬 +牧田 +牧畑 +牧畠 +牧石 +牧碕 +牧窪 +牧統 +牧絵 +牧繪 +牧羽 +牧草 +牧落 +牧葉 +牧薗 +牧角 +牧谷 +牧迫 +牧邨 +牧部 +牧里 +牧重 +牧野 +牧野内 +牧野原 +牧野島 +牧野嶋 +牧野瀬 +牧野田 +牧野谷 +牧長 +牧門 +牧間 +牧鶴 +物 +物上 +物井 +物加波 +物史 +物屋 +物延 +物応 +物應 +物永 +物江 +物河 +物申 +物種 +物袋 +物見 +物部 +物野部 +物集 +物集女 +牮山 +牲川 +特手 +特留 +犀川 +犀藤 +犂 +犛山 +犢野 +犬上 +犬丸 +犬井 +犬亦 +犬伏 +犬内 +犬原 +犬堂 +犬塚 +犬尾 +犬居 +犬山 +犬島 +犬嶋 +犬嶌 +犬川 +犬巻 +犬房 +犬持 +犬星 +犬木 +犬本 +犬村 +犬束 +犬毛 +犬江 +犬浦 +犬淵 +犬渕 +犬牽 +犬甘 +犬田 +犬石 +犬窪 +犬童 +犬竹 +犬置 +犬股 +犬藤 +犬見 +犬谷 +犬貝 +犬賀 +犬走 +犬銅 +犬間 +犬飼 +犬養 +犬馬場 +犱梨 +状地 +状家 +状書 +犹守 +犹舘 +犹館 +犾守 +犾舘 +犾館 +狄塚 +狐井 +狐坂 +狐塚 +狐墳 +狐島 +狐崎 +狐嶋 +狐川 +狐森 +狐野 +狐鼻 +狗井 +狗又 +狗川 +狗巻 +狗田 +狗飼 +狛 +狛井 +狛林 +狛谷 +狢川 +狢沢 +狢澤 +狩下 +狩井 +狩佐須 +狩俣 +狩倉 +狩元 +狩原 +狩又 +狩口 +狩土名 +狩場 +狩塚 +狩家 +狩宿 +狩尾 +狩屋 +狩山 +狩峯 +狩峰 +狩川 +狩底 +狩戸 +狩所 +狩折 +狩本 +狩森 +狩毛 +狩浦 +狩生 +狩田 +狩矢 +狩股 +狩行 +狩谷 +狩郷 +狩野 +狩野尾 +狩野山 +狩野窪 +狩野見 +狩長 +狩集 +独古 +独島 +独活山 +独鈷 +狭 +狭口 +狭古 +狭場 +狭子 +狭山 +狭川 +狭戸 +狭戸尾 +狭武 +狭田 +狭石 +狭訪 +狭間 +狭間田 +狭霧 +狸原 +狸塚 +狹場 +狹子 +狹山 +狹川 +狹武 +狹田 +狹石 +狹間 +狼 +狼谷 +猊倉 +猖々谷 +猗股 +猛尾 +猛新 +猛野 +猜 +猜ケ宇都 +猜山 +猜本 +猜松 +猜都 +猜野 +猩々 +猪 +猪の原 +猪の間 +猪ケ倉 +猪ノ上 +猪ノ元 +猪ノ原 +猪ノ口 +猪ノ坂 +猪ノ子石 +猪ノ山 +猪ノ木 +猪ノ本 +猪ノ立山 +猪丈 +猪上 +猪下 +猪丸 +猪久保 +猪之俣 +猪之原 +猪之口 +猪之奥 +猪之尾 +猪之山 +猪之木 +猪之窪 +猪之良 +猪之詰 +猪之間 +猪之鼻 +猪井 +猪亦 +猪伏 +猪俣 +猪倉 +猪儀 +猪元 +猪児 +猪兒 +猪八重 +猪内 +猪切 +猪刈 +猪勢 +猪原 +猪去 +猪又 +猪口 +猪口志 +猪古 +猪合 +猪名冨 +猪名原 +猪名富 +猪名川 +猪名村 +猪坂 +猪坪 +猪垣 +猪城 +猪塚 +猪多 +猪奥 +猪妻 +猪子 +猪子場 +猪子石 +猪家 +猪寺 +猪尻 +猪尾 +猪居 +猪山 +猪岐 +猪岡 +猪島 +猪崎 +猪嶋 +猪嶌 +猪川 +猪巻 +猪師 +猪平 +猪平田 +猪懸 +猪戸 +猪手 +猪掛 +猪方 +猪早 +猪木 +猪木原 +猪木迫 +猪本 +猪村 +猪柘 +猪森 +猪植 +猪橋 +猪毛尾 +猪江 +猪池 +猪沢 +猪波 +猪浦 +猪浪 +猪澤 +猪瀬 +猪熊 +猪爪 +猪牧 +猪狩 +猪猟 +猪甘 +猪田 +猪留 +猪目 +猪石 +猪砂 +猪窪 +猪立山 +猪端 +猪笹 +猪羽 +猪股 +猪脇 +猪脵 +猪腰 +猪膝 +猪花 +猪苅 +猪苗代 +猪藤 +猪西 +猪角 +猪谷 +猪貝 +猪越 +猪足 +猪辺 +猪込 +猪迫 +猪邉 +猪邊 +猪部 +猪郷 +猪里 +猪野 +猪野々 +猪野俣 +猪野元 +猪野原 +猪野又 +猪野塚 +猪野尾 +猪野屋 +猪野木 +猪野毛 +猪野瀬 +猪野熊 +猪野田 +猪野越 +猪野迫 +猪野間 +猪間 +猪阪 +猪隼 +猪須 +猪頭 +猪飼 +猪首 +猪鹿倉 +猪鹿月 +猪鹿野 +猪鼻 +猪龍 +猫俣 +猫垣 +猫塚 +猫安 +猫宮 +猫屋敷 +猫屋田 +猫山 +猫島 +猫崎 +猫平 +猫戸 +猫本 +猫村 +猫橋 +猫沖 +猫渕 +猫田 +猫矢 +猫石 +猫羽 +猫葉 +猫西 +猫谷 +献上 +猶 +猶井 +猶原 +猶口 +猶喜 +猶埼 +猶場 +猶塚 +猶岡 +猶崎 +猶嵜 +猶明 +猶木 +猶本 +猶村 +猶松 +猶橋 +猶江 +猶良脇 +猶谷 +猶貞 +猶迫 +猶野 +猿 +猿ケ沢 +猿ケ澤 +猿丸 +猿井 +猿倉 +猿原 +猿口 +猿吉 +猿向 +猿喰 +猿女 +猿子 +猿屋 +猿山 +猿島 +猿川 +猿押 +猿方 +猿木 +猿本 +猿林 +猿棒 +猿楽 +猿樂 +猿橋 +猿毛 +猿沢 +猿渡 +猿滝 +猿澤 +猿瀧 +猿爪 +猿田 +猿石 +猿舘 +猿荻 +猿見田 +猿谷 +猿賀 +猿賀谷 +猿走 +猿野 +猿飼 +猿養 +猿館 +獄 +獄本 +獄森 +獄盛 +獄石 +獄肩 +獄野 +獄釜 +獅々倉 +獅々内 +獅々原 +獅々友 +獅々堀 +獅々島 +獅々戸 +獅々掘 +獅々田 +獅々見 +獅々谷 +獅々賀 +獅々鹿 +獅倉 +獅坂 +獅子 +獅子井 +獅子倉 +獅子元 +獅子内 +獅子原 +獅子口 +獅子吼 +獅子堀 +獅子堂 +獅子山 +獅子島 +獅子崎 +獅子戸 +獅子王 +獅子田 +獅子目 +獅子谷 +獅子野 +獅山 +獅峯 +獅峰 +獅戸 +獅田 +獅畑 +獅野 +獨古 +獨活山 +獨鈷 +獺ケ口 +獺口 +獺庭 +獺越 +玄 +玄之内 +玄元 +玄内 +玄古 +玄同 +玄地 +玄場 +玄士 +玄奥 +玄女 +玄子 +玄山 +玄岡 +玄岩 +玄島 +玄嶋 +玄川 +玄巣 +玄師 +玄幡 +玄当 +玄後 +玄応 +玄應 +玄手 +玄本 +玄松 +玄梅 +玄森 +玄正 +玄武 +玄永 +玄沢 +玄津 +玄海 +玄澤 +玄生 +玄甫 +玄田 +玄番 +玄知 +玄米 +玄素 +玄羽 +玄翁 +玄葉 +玄蕃 +玄藤 +玄蛇 +玄行 +玄覚 +玄覺 +玄角 +玄道 +玄野 +玄長 +玄間 +玄順 +玄馬 +玅見 +率川 +玉 +玉ノ井 +玉ノ内 +玉ノ原 +玉ノ木 +玉ノ里 +玉一 +玉上 +玉下 +玉丘 +玉中 +玉串 +玉丸 +玉主 +玉乃 +玉乃井 +玉久 +玉久保 +玉之内 +玉亀 +玉井 +玉仙 +玉代 +玉代勢 +玉伊 +玉住 +玉作 +玉保世 +玉倉 +玉元 +玉光 +玉八 +玉内 +玉出 +玉分 +玉利 +玉利地 +玉前 +玉割 +玉勢 +玉北 +玉南 +玉原 +玉口 +玉古 +玉台 +玉吉 +玉名 +玉咲 +玉国 +玉國 +玉園 +玉土 +玉地 +玉坂 +玉坪 +玉垣 +玉城 +玉堀 +玉塚 +玉奥 +玉好 +玉子石 +玉宅 +玉守 +玉定 +玉宮 +玉家 +玉寄 +玉寄勢 +玉富 +玉尾 +玉居 +玉居子 +玉屋 +玉山 +玉岡 +玉岩 +玉峯 +玉峰 +玉島 +玉崎 +玉崗 +玉嵜 +玉嶋 +玉川 +玉巻 +玉平 +玉広 +玉廣 +玉得 +玉応 +玉應 +玉懸 +玉成 +玉戸 +玉手 +玉扶持 +玉振 +玉掛 +玉春 +玉暉 +玉有 +玉木 +玉本 +玉村 +玉来 +玉杵 +玉松 +玉林 +玉枝 +玉柏 +玉柳 +玉柿 +玉栄 +玉根 +玉桜 +玉梶 +玉森 +玉榮 +玉槻 +玉樋 +玉樹 +玉橋 +玉櫛 +玉櫻 +玉正 +玉段 +玉気 +玉氣 +玉水 +玉永 +玉江 +玉池 +玉沖 +玉沢 +玉河 +玉泉 +玉津 +玉津島 +玉浜 +玉浦 +玉浴 +玉淵 +玉渕 +玉滝 +玉澤 +玉濱 +玉瀧 +玉瀬 +玉熊 +玉牧 +玉理 +玉生 +玉田 +玉男木 +玉留 +玉登 +玉盛 +玉目 +玉県 +玉眞 +玉真 +玉矢 +玉石 +玉硲 +玉祖 +玉神 +玉積 +玉米 +玉緒 +玉繁 +玉置 +玉羽 +玉耒 +玉聞 +玉脇 +玉腰 +玉臺 +玉舍 +玉舎 +玉舘 +玉舟 +玉船 +玉芳 +玉若 +玉菊 +玉藤 +玉虫 +玉蟲 +玉衛 +玉西 +玉見 +玉角 +玉記 +玉護 +玉谷 +玉貞 +玉貫 +玉貴 +玉賀 +玉起 +玉越 +玉造 +玉邑 +玉那覇 +玉那霸 +玉里 +玉重 +玉野 +玉野上 +玉野井 +玉鉾 +玉長 +玉関 +玉飼 +玉館 +玉高利 +玉鳥 +玉鷲 +玉麻 +王丸 +王供 +王前 +王原 +王地 +王垣内 +王城 +王堂 +王塚 +王子 +王子田 +王子畑 +王子谷 +王子野 +王宮西 +王家 +王寺 +王尾 +王島 +王川 +王新 +王月 +王木 +王本 +王村 +王来王家 +王森 +王植 +王永 +王治 +王津 +王海 +王滝 +王瀧 +王生 +王田 +王畑 +王竹 +王蔵 +王藤内 +王見 +王谷 +王賀 +王路 +王身代 +王道練 +王野 +王隠堂 +王鞍 +王高 +王鷲 +玖代 +玖保 +玖嘉 +玖山 +玖島 +玖村 +玖波 +玖波井 +玖津見 +玖珂 +玖珠本 +玖田 +玖賀野 +玖野 +玖須 +玻名城 +玻座眞 +玻座真 +玻座間 +玻那城 +珊瑚 +珍 +珍並 +珍名 +珍坂 +珍斉 +珍珠 +珍田 +珍行 +珍谷 +珍道 +珍部 +珎宝 +珎道 +珠乃屋 +珠久 +珠井 +珠光 +珠坪 +珠城 +珠家 +珠居 +珠山 +珠島 +珠川 +珠手 +珠数 +珠数木 +珠數 +珠本 +珠村 +珠林 +珠沢 +珠洲 +珠淵 +珠渕 +珠澤 +珠玖 +珠野 +班目 +班石 +現岡 +現影 +現方 +現海 +現王園 +現琳 +現田 +現銀谷 +球磨川 +琢明 +琢磨 +琢間 +琳谷 +琴 +琴井 +琴井谷 +琴原 +琴地 +琴坂 +琴塚 +琴宮 +琴寄 +琴尾 +琴屋 +琴山 +琴岡 +琴島 +琴崎 +琴川 +琴平 +琴本 +琴村 +琴梅 +琴森 +琴河 +琴浦 +琴田 +琴畑 +琴見 +琴谷 +琴賀岡 +琴野 +琴陵 +琵琶 +琵琶坂 +瑕丘 +瑜伽 +瑞ケ覧 +瑞井 +瑞光 +瑞原 +瑞山 +瑞岡 +瑞岩 +瑞岳 +瑞島 +瑞川 +瑞徳 +瑞慶山 +瑞慶村 +瑞慶覧 +瑞慶覽 +瑞木 +瑞松 +瑞森 +瑞樹 +瑞沢 +瑞泉 +瑞澤 +瑞田 +瑞秀 +瑞穂 +瑞野 +瑤寺 +瑤林 +瑤樹 +瑳峨 +瑳峨見 +瑶寺 +瑶樹 +璒美川 +璞 +環 +環乃 +環貫 +環野 +瓊井田 +瓊岸 +瓊田 +瓜 +瓜ケ平 +瓜井 +瓜倉 +瓜兼 +瓜原 +瓜園 +瓜坂 +瓜守 +瓜尾 +瓜屋 +瓜山 +瓜峯 +瓜峰 +瓜島 +瓜崎 +瓜巣 +瓜戸 +瓜本 +瓜林 +瓜柴 +瓜澤 +瓜生 +瓜生原 +瓜生島 +瓜生津 +瓜生田 +瓜生野 +瓜田 +瓜谷 +瓜迫 +瓜野 +瓜阪 +瓢 +瓢子 +瓢野 +瓢風 +瓦 +瓦上 +瓦井 +瓦口 +瓦吹 +瓦家 +瓦屋 +瓦崎 +瓦川 +瓦木 +瓦本 +瓦林 +瓦焼 +瓦田 +瓦葺 +瓦谷 +瓦野 +瓦間 +瓶井 +瓶内 +瓶割 +瓶原 +瓶子 +瓶居 +瓶焼 +瓶田 +瓶谷 +瓶野 +甃井 +甍 +甑 +甑塚 +甑山 +甑岳 +甑沢 +甑澤 +甕 +甕岡 +甕川 +甘サ +甘中 +甘井 +甘佐 +甘來 +甘利 +甘南 +甘南備 +甘原 +甘城 +甘岡 +甘崎 +甘川 +甘庶 +甘日岩 +甘木 +甘本 +甘村 +甘東 +甘楽 +甘水 +甘池 +甘泉 +甘濃 +甘玉 +甘瓜 +甘田 +甘竹 +甘粕 +甘糟 +甘艸 +甘草 +甘蔗 +甘蔗生 +甘谷 +甘道 +甘野 +甘露 +甘露寺 +甘麻 +甚上 +甚久 +甚九 +甚五 +甚伊 +甚佐 +甚内 +甚出 +甚口 +甚古 +甚吾 +甚吾田 +甚室 +甚尾 +甚岡 +甚川 +甚本 +甚沢 +甚洲 +甚田 +甚目 +甚観 +甚谷 +甚賀 +甚野 +生 +生ノ谷 +生一 +生三 +生中 +生乃 +生之郷 +生亀 +生井 +生井沢 +生井澤 +生伊澤 +生住 +生保内 +生信 +生倉 +生元 +生内 +生冨 +生出 +生出塚 +生利 +生力 +生勢 +生南 +生原 +生友 +生口 +生司 +生名 +生吹 +生和 +生咲 +生喜 +生嘉 +生土 +生地 +生坂 +生垣 +生城 +生城山 +生塚 +生塩 +生多 +生夛 +生天目 +生姜塚 +生子 +生守 +生安 +生宗 +生宝 +生実 +生家 +生富 +生實 +生尾 +生居 +生居沢 +生居澤 +生属 +生山 +生岡 +生岩 +生峯 +生峰 +生島 +生崎 +生嶋 +生嶌 +生嶼 +生川 +生巣 +生幡 +生平 +生座本 +生形 +生悦住 +生成 +生戸 +生抜 +生方 +生旨 +生明 +生時 +生月 +生木 +生木谷 +生末 +生本 +生杉 +生村 +生松 +生板 +生林 +生枝 +生柄 +生柳 +生根 +生桑 +生桜 +生森 +生橋 +生櫻 +生次 +生武 +生水 +生水出 +生水口 +生永 +生江 +生江沢 +生池 +生沢 +生治 +生沼 +生泉 +生津 +生津江 +生浦 +生浪島 +生海 +生清 +生湟 +生湯 +生源 +生源寺 +生澤 +生瀬 +生瀬谷 +生熊 +生父佐 +生玉 +生田 +生田屋 +生田島 +生田嶋 +生田目 +生畑目 +生盛 +生目 +生石 +生石子 +生神 +生稲 +生穂 +生竹 +生綿 +生繁 +生能 +生船 +生良 +生良志 +生艸 +生芝 +生茂 +生草 +生蔵 +生藤 +生西 +生見 +生谷 +生貝 +生貞 +生貫 +生賀 +生越 +生路 +生部 +生酒 +生重 +生野 +生長 +生間 +生関 +生雲 +生須 +生頭 +生頼 +生食 +生馬 +生駄 +生駒 +生駒峯 +生魚 +生鶴 +生鷹 +産一 +産原 +産屋敷 +産形 +産方 +産木 +産本 +産江 +産田 +産谷 +産賀 +用 +用下 +用丸 +用之丸 +用伝 +用元 +用免 +用原 +用名 +用品 +用土 +用害 +用山 +用川 +用平 +用木 +用本 +用村 +用松 +用正 +用殿 +用水 +用水原 +用水口 +用沢 +用海 +用澤 +用瀬 +用田 +用皆 +用石 +用稲 +用貝 +用達 +用階 +甫 +甫ノ木 +甫中 +甫仮 +甫出 +甫喜山 +甫喜本 +甫坂 +甫天 +甫守 +甫木 +甫木元 +甫木山 +甫本 +甫村 +甫母 +甫水 +甫田 +甫留 +甫立 +甫足 +甫里 +甬井 +田 +田々 +田々井 +田々宮 +田々木 +田々楽 +田々樂 +田々羅 +田々美 +田々良 +田々辺 +田々邉 +田々部 +田々野 +田の風 +田ケ久保 +田ケ原 +田ケ谷 +田タ井 +田ノ上 +田ノ下 +田ノ井 +田ノ倉 +田ノ元 +田ノ入 +田ノ内 +田ノ原 +田ノ口 +田ノ室 +田ノ尻 +田ノ尾 +田ノ岡 +田ノ崎 +田ノ平 +田ノ本 +田ノ沢 +田ノ浦 +田ノ澤 +田ノ瀬 +田ノ畑 +田ノ窪 +田ノ脇 +田㞍 +田一 +田丁 +田万 +田万里 +田上 +田下 +田丘 +田並 +田中 +田中丸 +田中井 +田中地 +田中屋 +田中屋敷 +田中島 +田中嶋 +田中田 +田中舘 +田中館 +田丸 +田丸屋 +田丸谷 +田主 +田主松 +田久 +田久世 +田久保 +田久喜 +田久日 +田久美 +田久見 +田之上 +田之下 +田之中 +田之井 +田之倉 +田之元 +田之内 +田之原 +田之口 +田之室 +田之尻 +田之尾 +田之岡 +田之島 +田之崎 +田之本 +田之村 +田之江 +田之浦 +田之畑 +田之端 +田之縁 +田之脇 +田之頭 +田二見 +田二谷 +田井 +田井中 +田井地 +田井戸 +田井村 +田井東 +田井沢 +田井治 +田井澤 +田井能 +田井野 +田京 +田仁 +田仕 +田付 +田代 +田仲 +田仲島 +田仲嶋 +田伏 +田伐 +田住 +田作 +田保 +田保新 +田保橋 +田保沢 +田俣 +田倉 +田倍 +田側 +田儀 +田元 +田先 +田光 +田児 +田公 +田兼 +田内 +田内川 +田円 +田冨 +田冶 +田処 +田出 +田出橋 +田出谷 +田切 +田刈子 +田初 +田利 +田制 +田前 +田副 +田割 +田力 +田加井 +田加木 +田加村 +田勢 +田北 +田千代 +田南 +田南部 +田卷 +田原 +田原口 +田原春 +田原谷 +田原迫 +田又 +田叉 +田口 +田口谷 +田古 +田古利 +田古島 +田古嶋 +田古川 +田古良 +田古部 +田古里 +田合 +田吉 +田名 +田名井 +田名出 +田名加 +田名原 +田名場 +田名後 +田名橋 +田名瀬 +田名田 +田名網 +田名見 +田名辺 +田名邉 +田名邊 +田名部 +田向 +田吹 +田呂 +田呂丸 +田味 +田和 +田和瀬 +田和田 +田和辻 +田品 +田喜 +田喜知 +田嘉 +田国 +田圃 +田國 +田園 +田圓 +田土 +田土部 +田地 +田地井 +田地川 +田地畑 +田地行 +田地野 +田坂 +田坪 +田垣 +田垣内 +田城 +田埜 +田埜入 +田埼 +田堀 +田堂 +田堰 +田場 +田場川 +田塚 +田塩 +田境 +田増 +田墨 +田士 +田壷 +田外 +田多 +田多井 +田多園 +田多羅 +田多良 +田多野 +田夛 +田太 +田夫 +田奈橋 +田奈池 +田奈田 +田奥 +田好 +田妻 +田子 +田子内 +田子多 +田子山 +田子島 +田子島屋 +田子川 +田子根 +田子森 +田子谷 +田宅 +田守 +田安 +田宗 +田宜 +田宝 +田実 +田宣 +田室 +田宮 +田家 +田家沢 +田家澤 +田家野 +田寄 +田富 +田實 +田寺 +田小路 +田尻 +田尻下 +田尻谷 +田尾 +田尾下 +田尾多 +田尾本 +田尾田 +田居 +田屋 +田屋内 +田屋原 +田屋敷 +田屋舗 +田屋舘 +田屋館 +田山 +田山地 +田岡 +田岸 +田峰 +田島 +田崎 +田嵜 +田嶋 +田嶌 +田嶼 +田川 +田川原 +田巻 +田市 +田布尾 +田布施 +田常 +田幡 +田平 +田幸 +田广 +田広 +田床 +田底 +田庭 +田廣 +田廻 +田引 +田弘 +田張 +田形 +田後 +田徳 +田志 +田志口 +田志川 +田悟 +田成 +田戸 +田戸岡 +田房 +田所 +田手 +田手原 +田才 +田打 +田扶地 +田抜 +田持 +田振 +田揚 +田摩 +田攸 +田数 +田文 +田斉 +田斎 +田新 +田方 +田旗 +田春 +田智川 +田曽 +田曾 +田替 +田替藤 +田最上 +田月 +田木 +田末 +田本 +田杉 +田村 +田村崎 +田村谷 +田束 +田杭 +田東 +田杼 +田松 +田板 +田林 +田枝 +田柄 +田染 +田柳 +田根 +田桐 +田梅 +田森 +田植 +田椽 +田極 +田槇 +田槙 +田橋 +田櫓 +田次 +田歌 +田正司 +田武 +田殿 +田毋神 +田母上 +田母神 +田母野 +田毎 +田比良 +田毛 +田民 +田水 +田永 +田江 +田池 +田汲 +田沖 +田沢 +田河 +田河内 +田河原 +田治 +田治比 +田治米 +田治見 +田沼 +田泉 +田泓 +田波 +田波多 +田洞 +田津 +田津原 +田津田 +田津見 +田浜 +田浦 +田浪 +田海 +田涛 +田深 +田淵 +田淵川 +田添 +田済 +田渊 +田渋 +田渕 +田渕川 +田渡 +田港 +田湖 +田湯 +田満 +田溿 +田滝 +田潟 +田澁 +田澤 +田濃 +田濤 +田濱 +田瀬 +田灘 +田烏 +田熊 +田爪 +田片 +田牧 +田狭 +田玄 +田玉 +田王 +田瑞 +田生 +田甫 +田田辺 +田町 +田畑 +田留 +田留見 +田畝 +田畠 +田白 +田益 +田盛 +田真 +田矢 +田知 +田知本 +田知花 +田知行 +田石 +田神 +田福 +田穂 +田積 +田穗 +田窪 +田立 +田竝 +田端 +田竹 +田節 +田築 +田篠 +田篭 +田簑 +田籠 +田米 +田米開 +田籾 +田納 +田組 +田結 +田結庄 +田結荘 +田続 +田綿 +田総 +田縁 +田縄 +田總 +田繩 +田續 +田羅 +田羅原 +田羅鋤 +田羅間 +田羽 +田羽多 +田羽田 +田翁 +田老 +田耕 +田肥 +田胡 +田能 +田能村 +田脇 +田腰 +田臥 +田舎 +田舎中 +田舎方 +田舎片 +田舘 +田舛 +田舞 +田良 +田良原 +田良尾 +田良島 +田良美舘 +田艸川 +田芝 +田花 +田苅 +田苅子 +田苗 +田苗見 +田茂 +田茂井 +田茂内 +田茂山 +田草 +田草川 +田荒井 +田荷 +田華 +田萬 +田葉 +田葉井 +田蒔 +田蓑 +田蔦 +田蔵 +田藏 +田藤 +田藻 +田處 +田螺 +田行 +田表 +田袋 +田裏 +田西 +田見 +田覚 +田角 +田計 +田記 +田詰 +田谷 +田谷内 +田谷野 +田貝 +田財 +田貫 +田賀 +田賀井 +田賀糸 +田賀谷 +田賀農 +田越 +田足井 +田路 +田軸 +田輪 +田農 +田辺 +田辺井 +田辺屋 +田辺山 +田辺谷 +田込 +田迎 +田近 +田迫 +田通 +田造 +田道 +田遠 +田邉 +田邉谷 +田邊 +田邑 +田那 +田那村 +田那橋 +田那辺 +田那邉 +田那部 +田邨 +田郎丸 +田郎沢 +田郡 +田部 +田部ケ谷 +田部井 +田部多 +田部田 +田部谷 +田郷 +田郷岡 +田里 +田重田 +田野 +田野上 +田野下 +田野中 +田野丸 +田野井 +田野保 +田野倉 +田野入 +田野内 +田野原 +田野口 +田野城 +田野多 +田野太 +田野実 +田野實 +田野尻 +田野尾 +田野岡 +田野島 +田野崎 +田野平 +田野本 +田野村 +田野沖 +田野沢 +田野浜 +田野浦 +田野澤 +田野濱 +田野瀬 +田野田 +田野畑 +田野端 +田野辺 +田野迫 +田野邉 +田野邊 +田野間 +田野風 +田金 +田鋤 +田鍋 +田鎖 +田長 +田長丸 +田門 +田開 +田間 +田阪 +田附 +田陦 +田隅 +田隈 +田際 +田隝 +田隯 +田雁 +田雑 +田雜 +田靡 +田面 +田面山 +田面木 +田鞠 +田頃家 +田須美 +田頭 +田頼 +田顔 +田食 +田飼 +田館 +田首 +田香 +田馬 +田馬場 +田高 +田高田 +田高良 +田鳥 +田鴈 +田鶴 +田鶴原 +田鶴浜 +田鶴浦 +田鶴濱 +田鶴見 +田鶴谷 +田鹿 +田麥 +田麦 +田齊 +田齋 +田龍 +由 +由上 +由下 +由中 +由久保 +由井 +由井原 +由井園 +由井浜 +由井薗 +由井野 +由住 +由佐 +由倉 +由元 +由光 +由冨 +由利 +由利谷 +由原 +由原木 +由口 +由喜門 +由土 +由地 +由城 +由多 +由宇 +由家 +由富 +由尾 +由居 +由山 +由岐 +由岐中 +由岐谷 +由岡 +由島 +由崎 +由川 +由布 +由徳 +由戸 +由手口 +由月 +由木 +由木尾 +由本 +由村 +由栄 +由根 +由桐 +由森 +由榮 +由比 +由比ケ浜 +由比ケ濱 +由比原 +由比浜 +由比濱 +由比藤 +由水 +由永 +由池 +由沢 +由波 +由浅 +由浜 +由浦 +由浪 +由淵 +由渕 +由澤 +由理 +由田 +由町 +由畄部 +由留佐 +由留出 +由留木 +由留部 +由籐 +由繁 +由羅 +由美 +由羽 +由肥 +由良 +由良木 +由良田 +由良野 +由茅 +由藤 +由衛 +由見 +由解 +由谷 +由賀 +由迫 +由里 +由里本 +由野 +由野島 +由金 +由雄 +由類江 +甲 +甲〆 +甲ノ浦 +甲上 +甲下 +甲井 +甲伊 +甲佐 +甲便 +甲信 +甲元 +甲光 +甲利 +甲加 +甲原 +甲取 +甲口 +甲和 +甲地 +甲地里 +甲坂 +甲埜 +甲堂 +甲子 +甲守 +甲屋 +甲山 +甲岡 +甲島 +甲崎 +甲嶋 +甲川 +甲州 +甲州屋 +甲州谷 +甲平 +甲府 +甲府方 +甲怒 +甲把 +甲斐 +甲斐上 +甲斐下 +甲斐中 +甲斐元 +甲斐出 +甲斐切 +甲斐原 +甲斐埜 +甲斐埼 +甲斐山 +甲斐島 +甲斐崎 +甲斐嶋 +甲斐川 +甲斐村 +甲斐根 +甲斐沢 +甲斐沼 +甲斐澤 +甲斐玉 +甲斐田 +甲斐荘 +甲斐莊 +甲斐谷 +甲斐道 +甲斐野 +甲方 +甲星 +甲月 +甲木 +甲本 +甲村 +甲林 +甲森 +甲楽城 +甲樂城 +甲正 +甲池 +甲津 +甲洲 +甲洲屋 +甲浦 +甲滝 +甲田 +甲畑 +甲盛 +甲矢 +甲石 +甲破 +甲神 +甲立 +甲緒 +甲羽 +甲能 +甲良 +甲藤 +甲角 +甲谷 +甲賀 +甲越 +甲辺 +甲邉 +甲邊 +甲部 +甲野 +甲野籐 +甲野藤 +甲阪 +甲頭 +甲高 +甲鳥 +申原 +申川 +申木 +申林 +申橋 +申河 +申田 +申畑 +申神 +申谷 +申賀 +申輪 +男 +男乕 +男全 +男原 +男城 +男女島 +男女嶋 +男山 +男座 +男庭 +男成 +男松 +男枝 +男武 +男沢 +男澤 +男熊 +男知合 +男石 +男神 +男竹 +男虎 +男谷 +男里 +男鹿 +男鹿谷 +町 +町上 +町下 +町並 +町中 +町井 +町側 +町元 +町内 +町出 +町分 +町北 +町原 +町口 +町園 +町垣 +町場 +町塚 +町多 +町家 +町尻 +町尾 +町居 +町屋 +町屋敷 +町山 +町岡 +町島 +町崎 +町嶋 +町川 +町平 +町戸 +町支 +町方 +町本 +町村 +町永 +町沢 +町河 +町浦 +町澤 +町田 +町田屋 +町畑 +町畠 +町矢 +町端 +町筋 +町羽 +町花 +町草 +町谷 +町辺 +町釈 +町釋 +町里 +町野 +町長 +町頭 +町駒 +画星 +画本 +畊田 +畊野 +界 +界久保 +界外 +界田 +界野 +畑 +畑ケ +畑ケ中 +畑ケ山 +畑ケ谷 +畑ケ迫 +畑上 +畑下 +畑中 +畑久保 +畑井 +畑井田 +畑井迫 +畑仲 +畑佐 +畑元 +畑先 +畑内 +畑出 +畑前 +畑加 +畑原 +畑口 +畑古 +畑吉 +畑名 +畑地 +畑坂 +畑垣 +畑埜 +畑堀 +畑奈 +畑守 +畑宮 +畑家 +畑尻 +畑尾 +畑屋 +畑山 +畑岡 +畑岸 +畑峯 +畑島 +畑崎 +畑嶋 +畑川 +畑帰 +畑平 +畑広 +畑廣 +畑後 +畑成 +畑戸 +畑手 +畑掘 +畑木 +畑木山 +畑末 +畑本 +畑村 +畑板 +畑林 +畑枝 +畑根 +畑森 +畑楠 +畑橋 +畑段 +畑毛 +畑江 +畑沢 +畑河内 +畑津 +畑浦 +畑淵 +畑添 +畑澄 +畑澤 +畑瀬 +畑生 +畑田 +畑畠 +畑矢 +畑石 +畑福 +畑窪 +畑端 +畑脇 +畑腰 +畑西 +畑見 +畑谷 +畑谷内 +畑賀 +畑越 +畑農 +畑辺 +畑辻 +畑迫 +畑道 +畑邉 +畑邊 +畑部 +畑里 +畑野 +畑野谷 +畑間 +畑阪 +畑際 +畑頭 +畒本 +畒村 +畒見 +畔 +畔上 +畔倉 +畔元 +畔内 +畔出 +畔勝 +畔原 +畔取 +畔合 +畔地 +畔堂 +畔山 +畔岡 +畔崎 +畔川 +畔木 +畔本 +畔村 +畔林 +畔柳 +畔永 +畔津 +畔瀬 +畔田 +畔脇 +畔蒜 +畔見 +畔谷 +畔越 +畔辻 +畔道 +畔野 +畔高 +留 +留中 +留井 +留分 +留口 +留吉 +留場 +留奥 +留守 +留安 +留山 +留岡 +留島 +留崎 +留川 +留木 +留末 +留本 +留村 +留松 +留森 +留永 +留河 +留田 +留畑 +留盛 +留目 +留碇 +留置 +留野 +留高 +畚田 +畚谷 +畚野 +畝 +畝中 +畝井 +畝光 +畝内 +畝原 +畝地 +畝尾 +畝山 +畝岡 +畝島 +畝崎 +畝嶋 +畝川 +畝延 +畝挟 +畝木 +畝本 +畝村 +畝林 +畝森 +畝沖 +畝河内 +畝狭 +畝田 +畝田谷 +畝畑 +畝目 +畝矢 +畝見 +畝迫 +畝部 +畝重 +畝野 +畝高 +畠 +畠ケ +畠ケ中 +畠上 +畠下 +畠中 +畠久保 +畠井 +畠仲 +畠保 +畠内 +畠原 +畠口 +畠吉 +畠坂 +畠垣 +畠埜 +畠堀 +畠守 +畠宗 +畠尾 +畠屋 +畠山 +畠岡 +畠島 +畠崎 +畠嶋 +畠川 +畠平 +畠木 +畠本 +畠村 +畠枝 +畠森 +畠毛 +畠江 +畠沢 +畠河 +畠添 +畠澤 +畠瀬 +畠生 +畠田 +畠田谷 +畠盛 +畠石 +畠等 +畠腹 +畠舎 +畠舘 +畠藤 +畠見 +畠谷 +畠迫 +畠道 +畠里 +畠野 +畠間 +畠頭 +畠館 +畠黒 +畤地 +畦 +畦ケ谷 +畦上 +畦中 +畦倉 +畦元 +畦内 +畦原 +畦地 +畦坪 +畦山 +畦岡 +畦崎 +畦川 +畦布 +畦平 +畦庫 +畦後 +畦智 +畦本 +畦柳 +畦森 +畦池 +畦津 +畦浦 +畦田 +畦町 +畦畑 +畦知 +畦蒜 +畦西 +畦越 +畦道 +畦野 +畦間 +畦高 +畩ケ山 +番 +番上 +番下 +番中 +番井 +番代 +番作 +番倉 +番内 +番処 +番出 +番匠 +番匠谷 +番原 +番口 +番園 +番土 +番地 +番坂 +番城 +番場 +番塲 +番字 +番定 +番家 +番屋 +番山 +番川 +番平 +番庄 +番度 +番座 +番戸 +番戸平 +番所 +番木 +番本 +番条 +番條 +番正 +番水 +番沢 +番浦 +番清 +番澤 +番田 +番留 +番矢 +番能 +番舘 +番藤 +番詰 +番谷 +番賀 +番途 +番道 +番重 +番野 +番野木 +番長 +番随 +番隨 +番馬 +畫間 +畬野 +畭 +畭元 +畭尾 +異儀田 +異島 +異相 +異石 +畳 +畳家 +畳屋 +畳岩 +畳指 +畳田 +畳見 +畳谷 +畳野 +畳開 +畴地 +畴津 +當 +當代 +當仲 +當住 +當作 +當具 +當内 +當別當 +當利 +當前 +當原 +當合 +當喜 +當坂 +當天 +當宮 +當寺ケ盛 +當寺盛 +當尊 +當山 +當島 +當川 +當巾 +當座 +當房 +當所 +當摩 +當時久保 +當木 +當本 +當村 +當森 +當正 +當江 +當波 +當津 +當流谷 +當瀬 +當田 +當目 +當眞 +當真 +當磨 +當舎 +當谷 +當郷 +當重 +當野 +當金 +當銀 +當銘 +當間 +當馬 +當麻 +畷 +畷谷 +畿度 +疂谷 +疇倉 +疇地 +疇津 +疇谷 +疊 +疊家 +疊屋 +疊指 +疊田 +疊谷 +疋 +疋出 +疋島 +疋嶋 +疋津 +疋田 +疋見 +疋谷 +疋野 +痴山 +瘧師 +癸生川 +発 +発乗 +発出 +発地 +発坂 +発師 +発智 +発生川 +発田 +発知 +登 +登り +登り口 +登り山 +登ケ谷 +登リ口 +登上 +登世岡 +登丸 +登久美 +登之内 +登亀 +登井 +登佐 +登佐古 +登倉 +登光 +登内 +登出 +登利 +登利屋 +登利谷 +登原 +登口 +登古 +登喜 +登地 +登坂 +登城 +登埜 +登婦野 +登守 +登家 +登尾 +登山 +登岐 +登岸 +登峠 +登島 +登崎 +登嶋 +登川 +登師 +登張 +登成 +登戸 +登手 +登日 +登日綱 +登木 +登木口 +登本 +登村 +登条 +登松 +登林 +登根 +登梛 +登條 +登森 +登橋 +登永 +登沢 +登津川 +登澤 +登瀬 +登玉 +登田 +登盛 +登矢 +登石 +登神 +登立 +登竜 +登籐 +登米 +登美 +登能 +登藤 +登見 +登記 +登谷 +登路 +登道 +登那木 +登里 +登野 +登野原 +登野城 +登野盛 +登間佐 +登阪 +登龍 +發 +發出 +發地 +發坂 +發智 +發田 +發知 +白 +白ケ沢 +白ケ澤 +白上 +白下 +白丸 +白主 +白久 +白井 +白井原 +白井田 +白仁 +白仁田 +白他 +白代 +白伊 +白似田 +白佐 +白佐木 +白保 +白信 +白倉 +白側 +白元 +白光 +白兼 +白内 +白出 +白前 +白勢 +白勺 +白原 +白厩 +白又 +白友 +白取 +白口 +白句 +白吉 +白名 +白和 +白善 +白国 +白國 +白土 +白土師 +白地 +白坂 +白坏 +白垣 +白城 +白埜 +白堀 +白塔 +白塚 +白塚山 +白壁 +白多 +白太 +白央 +白奥 +白妙 +白子 +白子山 +白子田 +白宮 +白寄 +白寒水 +白寿 +白小路 +白尾 +白尾谷 +白居 +白屋 +白山 +白岡 +白岩 +白岳 +白岸 +白峯 +白峰 +白島 +白崎 +白嵜 +白嶋 +白嶺 +白嶽 +白川 +白川原 +白川田 +白川部 +白州 +白市 +白幅 +白幡 +白平 +白庄司 +白府 +白座 +白形 +白後 +白応 +白惣 +白戸 +白手 +白拍子 +白政 +白数 +白敷 +白數 +白斉 +白新田 +白方 +白旗 +白旛 +白日 +白星 +白曼 +白月 +白木 +白木原 +白木屋 +白木川 +白木沢 +白木澤 +白木谷 +白本 +白杉 +白村 +白松 +白板 +白林 +白枝 +白枦 +白柏 +白柳 +白柿 +白栄 +白栗 +白根 +白根沢 +白根澤 +白桃 +白梅 +白梼山 +白森 +白椛 +白椿 +白極 +白楽 +白榊 +白榮 +白樂 +白樫 +白樹 +白樺 +白橋 +白檮山 +白櫨 +白次 +白武 +白毛 +白水 +白永 +白江 +白池 +白沙 +白沢 +白河 +白河原 +白河部 +白沼 +白泉 +白波 +白波瀬 +白津 +白洲 +白浜 +白浦 +白浪 +白淵 +白清 +白渕 +白渡 +白湯 +白源 +白滝 +白潟 +白澤 +白濱 +白瀉 +白瀚 +白瀧 +白瀬 +白灰 +白炭 +白熊 +白片 +白牛 +白猪 +白玉 +白玖 +白田 +白男川 +白畑 +白畠 +白目 +白相 +白矢 +白石 +白石田 +白砂 +白磯 +白神 +白福 +白窪 +白竜 +白竹 +白箸 +白築 +白簱 +白籏 +白米 +白米山 +白米花 +白粉田 +白糠 +白糸 +白紙 +白綛 +白綾 +白羽 +白羽根 +白肌 +白舎 +白船 +白良 +白花 +白茂 +白草 +白荻 +白菊 +白葉 +白蓋 +白薊 +白藤 +白袋 +白西 +白見 +白角 +白記 +白谷 +白貝 +白貫 +白賀 +白越 +白輪 +白輪地 +白辻 +白迫 +白道 +白邦 +白部 +白都 +白重 +白野 +白金 +白針 +白銀 +白銀屋 +白長 +白間 +白阪 +白附 +白陸 +白雪 +白雲 +白露 +白鞘 +白須 +白須賀 +白須間 +白頭 +白飯 +白館 +白馬 +白駒 +白高 +白髪 +白髭 +白鬚 +白鯛 +白鳥 +白鳳 +白鴬 +白鵬 +白鶯 +白鶴 +白鷹 +白鷺 +白鷺洲 +白鹿 +百 +百々 +百々亀 +百々坂 +百々塚 +百々海 +百々済 +百々瀬 +百々米木 +百々谷 +百々路 +百々野 +百万 +百丈 +百上 +百中 +百丸 +百井 +百代 +百倍 +百元 +百冨 +百出 +百刈 +百勝 +百北 +百千 +百千田 +百南 +百原 +百合 +百合中 +百合口 +百合園 +百合山 +百合岡 +百合島 +百合嶋 +百合川 +百合本 +百合林 +百合永 +百合沢 +百合澤 +百合田 +百合綱 +百合草 +百合薗 +百合藤 +百合野 +百合長 +百名 +百地 +百坂 +百坪 +百垣 +百堂 +百塚 +百家 +百富 +百寿 +百尾 +百山 +百岡 +百岳 +百島 +百崎 +百嶋 +百川 +百市 +百師 +百度 +百引 +百成 +百我 +百戸 +百日 +百春 +百木 +百木田 +百木野 +百本 +百村 +百束 +百松 +百枝 +百橋 +百次 +百武 +百歩 +百毛 +百永 +百江 +百沢 +百治 +百津 +百浦 +百海 +百済 +百渓 +百溪 +百澤 +百濃 +百濟 +百瀬 +百生 +百田 +百町 +百畑 +百留 +百百 +百百塚 +百目 +百目木 +百目鬼 +百相 +百石 +百積 +百竹 +百花 +百萬 +百衣 +百谷 +百貫 +百足 +百足山 +百軒 +百道 +百部 +百都 +百里 +百野 +百長 +百間 +百間田 +百間谷 +百雲 +百鬼 +百鳥 +皀 +皃玉 +的 +的之 +的井 +的代 +的地 +的埜 +的場 +的塲 +的射 +的射場 +的尾 +的屋 +的山 +的崎 +的川 +的形 +的手 +的打 +的早 +的本 +的村 +的板 +的池 +的田 +的矢 +的石 +的羽 +的葉 +的衛 +的野 +的野屋 +的馬 +皆ケ瀬 +皆上 +皆下 +皆久保 +皆井 +皆伝 +皆倉 +皆傳 +皆元 +皆光 +皆内 +皆勝 +皆原 +皆口 +皆合 +皆吉 +皆呂 +皆地 +皆坂 +皆堂 +皆場 +皆塚 +皆尺寺 +皆尾 +皆山 +皆岡 +皆島 +皆崎 +皆嶋 +皆川 +皆己 +皆已 +皆巳 +皆平 +皆広 +皆廣 +皆廻 +皆徳 +皆戸 +皆戸中 +皆政 +皆方 +皆月 +皆木 +皆本 +皆村 +皆松 +皆森 +皆橋 +皆水 +皆沢 +皆河 +皆波 +皆津 +皆浦 +皆添 +皆渡 +皆澤 +皆瀬 +皆田 +皆盛 +皆神 +皆福 +皆笹 +皆籐 +皆米 +皆美 +皆良田 +皆芳 +皆葉 +皆藤 +皆見 +皆谷 +皆賀 +皆越 +皆迫 +皆部 +皆里 +皆野 +皆野川 +皆銭 +皆黒 +皇 +皇浦 +皐 +皐山 +皐月 +皛 +皛納 +皨昇 +皮下 +皮地 +皮居 +皮田 +皮篭石 +皮籠石 +皮野 +皮間 +皷 +皷田 +皷谷 +皷野 +皿上 +皿井 +皿家 +皿屋 +皿山 +皿島 +皿嶋 +皿木 +皿末 +皿本 +皿江 +皿池 +皿沢 +皿海 +皿澤 +皿田 +皿良 +皿袋 +皿谷 +皿貝 +皿野 +盃 +盃屋 +盆下 +盆出 +盆城 +盆子 +盆子原 +盆木 +盆田 +盆野 +盈 +益 +益上 +益下 +益並 +益中 +益丸 +益久 +益井 +益位 +益住 +益倉 +益元 +益冨 +益前 +益原 +益口 +益吉 +益国 +益國 +益園 +益地 +益坂 +益城 +益塚 +益子 +益守 +益宮 +益富 +益尾 +益居 +益山 +益岡 +益島 +益崎 +益嵜 +益嶋 +益川 +益広 +益弘 +益当 +益形 +益成 +益戸 +益木 +益本 +益村 +益枝 +益栄 +益森 +益永 +益江 +益池 +益沢 +益河 +益津 +益浜 +益浦 +益海 +益淵 +益渕 +益満 +益滿 +益澤 +益濱 +益田 +益田原 +益留 +益登 +益盛 +益県 +益縣 +益繁 +益若 +益茂 +益薗 +益行 +益見 +益谷 +益貞 +益賀 +益賀多 +益賀夛 +益邑 +益重 +益野 +益金 +益長 +益雪 +益頭 +盛 +盛ノ下 +盛一 +盛上 +盛下 +盛与 +盛中 +盛久 +盛也 +盛井 +盛住 +盛元 +盛光 +盛兼 +盛内 +盛原 +盛友 +盛口 +盛合 +盛吉 +盛喜 +盛国 +盛園 +盛坪 +盛城 +盛多 +盛安 +盛定 +盛実 +盛宮 +盛家 +盛實 +盛小根 +盛小禰 +盛尾 +盛屋 +盛山 +盛岡 +盛岩 +盛島 +盛崎 +盛嶋 +盛川 +盛弘 +盛影 +盛戸 +盛房 +盛政 +盛月 +盛木 +盛末 +盛本 +盛村 +盛松 +盛林 +盛根 +盛植 +盛橋 +盛次 +盛武 +盛永 +盛江 +盛池 +盛沢 +盛泉 +盛清 +盛満 +盛滿 +盛澄 +盛澤 +盛熊 +盛生 +盛田 +盛町 +盛留 +盛矢 +盛石 +盛石田 +盛砂 +盛礼良 +盛純 +盛綱 +盛脇 +盛興 +盛舛 +盛葉 +盛藤 +盛谷 +盛貞 +盛貴 +盛越 +盛迫 +盛郷 +盛里 +盛重 +盛野 +盛長 +盛飯 +盛高 +盡田 +監原 +監埼 +監崎 +監物 +盤井 +盤匠 +盤城 +盤山 +盤崎 +盤戸 +盤所 +盤指 +盤木 +盤杖 +盤若 +盤野 +目 +目々沢 +目々澤 +目ケ谷 +目七 +目串 +目久保 +目久田 +目久美 +目乙木 +目井 +目代 +目仲 +目伯 +目佐久 +目倉 +目出 +目加多 +目加田 +目原 +目取 +目取眞 +目取真 +目取間 +目叶 +目名 +目名形 +目坂 +目堂 +目堅 +目宅 +目尾 +目山 +目島 +目崎 +目嵜 +目川 +目差 +目幡 +目年 +目幸 +目床 +目廹 +目形 +目後 +目徳 +目戸 +目抜 +目方 +目春 +目時 +目曲 +目木 +目本 +目杉 +目桑 +目楠 +目次 +目沢 +目沼 +目泰 +目澤 +目瀬 +目片 +目王 +目田 +目目沢 +目目澤 +目秦 +目移 +目等 +目細 +目縄 +目羅 +目能 +目良 +目見田 +目谷 +目貫 +目賀 +目賀多 +目賀夛 +目賀田 +目近 +目迫 +目連 +目野 +目釜 +目鏡 +目関 +目阪 +目附 +目面 +目面上 +目須田 +目高 +目鳥 +目鷹 +目黒 +直 +直一 +直上 +直下 +直之 +直井 +直佐 +直元 +直入 +直内 +直原 +直吉 +直喜 +直地 +直坂 +直堂 +直場 +直塚 +直宮 +直宿 +直居 +直山 +直岡 +直峯 +直島 +直崎 +直嶋 +直嶌 +直川 +直弘 +直志 +直成 +直指 +直木 +直本 +直村 +直松 +直林 +直枝 +直樹 +直正 +直永 +直江 +直沢 +直津 +直海 +直理 +直田 +直町 +直箆 +直箟 +直継 +直良 +直見 +直谷 +直里 +直野 +直長 +直高 +直鳥 +相 +相ケ瀬 +相ノ山 +相ノ谷 +相上 +相中 +相之俣 +相井 +相京 +相亰 +相住 +相佐 +相信 +相倉 +相元 +相光 +相内 +相前 +相原 +相友 +相口 +相古 +相可 +相台 +相合 +相合谷 +相吉 +相吉沢 +相吉澤 +相和 +相嘉 +相園 +相地 +相坂 +相垣 +相埜 +相場 +相塚 +相塲 +相墨 +相壁 +相多 +相奈良 +相子 +相宅 +相守 +相宗 +相宮 +相富 +相尾 +相山 +相島 +相崎 +相嵜 +相嶋 +相川 +相巣 +相差 +相広 +相度 +相座 +相庭 +相引 +相当 +相徳 +相戸 +相撲 +相方 +相星 +相智 +相曽 +相曾 +相月 +相木 +相本 +相村 +相松 +相枝 +相柄 +相根 +相森 +相楽 +相樂 +相模 +相橋 +相武 +相水 +相江 +相沢 +相河 +相沼 +相泉 +相波 +相津 +相洲 +相浜 +相浦 +相渡 +相滝 +相澤 +相濱 +相瀬 +相牟田 +相物 +相物屋 +相瑞 +相生 +相生垣 +相生村 +相田 +相畑 +相知 +相磯 +相神 +相福 +相笠 +相築 +相米 +相緒 +相繁 +相美 +相羽 +相臺 +相良 +相良屋 +相花 +相茶 +相葉 +相蔵 +相薗 +相藤 +相蘇 +相蘓 +相見 +相谷 +相貝 +相賀 +相越 +相輪 +相道 +相部 +相野 +相野台 +相野山 +相野田 +相野臺 +相野谷 +相間 +相間野 +相関 +相阪 +相須 +相館 +相馬 +相馬森 +相馬谷 +相高 +盾 +盾石 +眇田 +眉丈山 +眉山 +眉見 +看舎 +看谷 +県 +県内 +県島 +県田 +県詰 +眞 +眞々田 +眞々部 +眞ケ田 +眞上 +眞下 +眞中 +眞久 +眞乗坊 +眞乘坊 +眞井 +眞井田 +眞仁田 +眞仲 +眞伏 +眞住 +眞佐喜 +眞保 +眞保榮 +眞倉 +眞先 +眞光 +眞内 +眞分 +眞利 +眞利子 +眞利谷 +眞加井 +眞加部 +眞勢 +眞北 +眞南 +眞原 +眞口 +眞吉 +眞名井 +眞名垣 +眞名子 +眞名瀬 +眞名田 +眞名野 +眞喜 +眞喜屋 +眞喜志 +眞嘉比 +眞國 +眞土 +眞坂 +眞垣 +眞城 +眞埜 +眞塚 +眞塩 +眞境名 +眞壁 +眞壽田 +眞多 +眞如 +眞子 +眞孫 +眞宅 +眞宇根 +眞守 +眞安 +眞室 +眞宮 +眞家 +眞富 +眞實井 +眞寺 +眞尾 +眞屋 +眞山 +眞岡 +眞岩 +眞岸 +眞峯 +眞峰 +眞島 +眞崎 +眞嵜 +眞嶋 +眞嶌 +眞川 +眞常 +眞幡 +眞幡木 +眞座 +眞庭 +眞延 +眞弓 +眞弓田 +眞形 +眞後 +眞志取 +眞志喜 +眞志田 +眞忠 +眞惠原 +眞戸原 +眞所 +眞手 +眞方 +眞方山 +眞明 +眞智 +眞有 +眞期 +眞木 +眞木下 +眞木元 +眞木原 +眞木野 +眞末 +眞本 +眞杉 +眞村 +眞来 +眞板 +眞枝 +眞柄 +眞柳 +眞柴 +眞栄城 +眞栄平 +眞栄田 +眞栄里 +眞桐 +眞桑 +眞梶 +眞椙 +眞楽 +眞榮 +眞榮喜 +眞榮城 +眞榮平 +眞榮田 +眞榮里 +眞橋 +眞次 +眞正 +眞武 +眞殿 +眞水 +眞汐 +眞江田 +眞沢 +眞河 +眞治 +眞沼 +眞泉 +眞津野 +眞流 +眞浜 +眞浦 +眞海 +眞淵 +眞清 +眞清水 +眞渋 +眞渕 +眞渡 +眞溪 +眞澁 +眞澄 +眞澤 +眞濱 +眞瀬 +眞瀬垣 +眞熊 +眞玉 +眞珠 +眞理谷 +眞生田 +眞田 +眞田井 +眞畑 +眞白 +眞目 +眞矢 +眞知田 +眞石 +眞砂 +眞砂谷 +眞砂野 +眞神 +眞神田 +眞秀 +眞秦 +眞穂 +眞竹 +眞篠 +眞籠 +眞米 +眞継 +眞縣 +眞繼 +眞能 +眞脇 +眞舘 +眞舩 +眞船 +眞苅 +眞茅 +眞草嶺 +眞菜 +眞藤 +眞藤子 +眞行寺 +眞見 +眞覚 +眞角 +眞許 +眞謝 +眞谷 +眞貝 +眞賀 +眞賀部 +眞賀里 +眞辺 +眞辻 +眞通 +眞造 +眞道 +眞邉 +眞邊 +眞那田 +眞部 +眞里谷 +眞重 +眞野 +眞野目 +眞金 +眞釼 +眞鈴川 +眞銅 +眞鍋 +眞門 +眞開 +眞間 +眞関 +眞隅 +眞霜 +眞面 +眞館 +眞馬 +眞鳥 +眞鶴 +眞黒 +眞鼻 +眞龍寺 +眞𡽶 +真 +真々田 +真々部 +真ケ口 +真ケ田 +真ケ部 +真一 +真上 +真下 +真世土 +真並 +真中 +真丸 +真久 +真久田 +真之瀬 +真乗坊 +真也加 +真井 +真井田 +真人 +真仁田 +真仲 +真伏 +真伯 +真位 +真住 +真住居 +真佐 +真佐喜 +真佐見 +真保 +真保栄 +真倉 +真元 +真先 +真光 +真光寺 +真内 +真出 +真分 +真利 +真利子 +真利谷 +真力田 +真加井 +真加理 +真加田 +真加部 +真勢 +真北 +真南 +真原 +真取 +真口 +真古 +真吉 +真名 +真名井 +真名垣 +真名子 +真名志 +真名瀬 +真名田 +真名部 +真名野 +真喜 +真喜屋 +真喜志 +真嘉比 +真国 +真土 +真地 +真坂 +真垣 +真城 +真埜 +真埼 +真場 +真塚 +真塩 +真境名 +真壁 +真多 +真奈 +真奈子 +真奥 +真如 +真子 +真孫 +真宅 +真宇根 +真守 +真安 +真宗 +真宜 +真実 +真実井 +真室 +真宮 +真家 +真富 +真寺 +真対 +真寿田 +真尾 +真居 +真屋 +真山 +真岡 +真岩 +真岸 +真峯 +真峰 +真島 +真崎 +真嵜 +真嶋 +真嶌 +真川 +真常 +真幡 +真幡木 +真庄 +真座 +真庭 +真延 +真弓 +真弓田 +真当 +真形 +真後 +真志保 +真志取 +真志喜 +真志田 +真忠 +真恵原 +真戸原 +真所 +真手 +真教寺 +真敷 +真新 +真方 +真方山 +真旧 +真早流 +真昌 +真明 +真智 +真智田 +真月 +真有 +真期 +真木 +真木下 +真木元 +真木内 +真木原 +真木坂 +真木山 +真木田 +真木野 +真末 +真本 +真杉 +真村 +真来 +真東 +真板 +真枝 +真柄 +真柳 +真柴 +真栄 +真栄喜 +真栄城 +真栄平 +真栄田 +真栄里 +真栗 +真根井 +真桐 +真桑 +真梶 +真棟 +真椙 +真楽 +真榮 +真榮城 +真榮平 +真榮田 +真榮里 +真樹 +真橋 +真次 +真正 +真武 +真歩仁 +真殿 +真水 +真汐 +真江 +真江木 +真江田 +真池 +真沢 +真河 +真治 +真沼 +真泉 +真法 +真津 +真津野 +真流 +真浄 +真浜 +真浦 +真海 +真淵 +真添 +真清 +真清水 +真清田 +真渋 +真渓 +真渕 +真渡 +真湲 +真溪 +真澁 +真澄 +真澤 +真瀬 +真瀬垣 +真瀬木 +真瀬田 +真熊 +真狩 +真玉 +真玉橋 +真珠 +真理人 +真理谷 +真生田 +真田 +真田島 +真田野 +真畑 +真畠 +真當 +真白 +真皿 +真盛 +真目 +真県 +真矢 +真知田 +真石 +真砂 +真砂木 +真砂谷 +真砂野 +真碕 +真神 +真神田 +真秀 +真秦 +真種 +真穂 +真竹 +真篠 +真篭 +真籠 +真米 +真粉 +真納 +真紫 +真継 +真綿 +真縣 +真置 +真羽 +真耶 +真能 +真脇 +真舘 +真舟 +真舩 +真船 +真艸嶺 +真芝 +真苅 +真苧坪 +真茅 +真草嶺 +真菜 +真菰 +真葛 +真藤 +真藤子 +真行 +真行寺 +真西 +真見 +真覚 +真角 +真許 +真謝 +真谷 +真貝 +真貫 +真貴 +真貴田 +真賀 +真賀口 +真賀部 +真賀里 +真路 +真辺 +真辻 +真通 +真造 +真道 +真達 +真邉 +真邊 +真那子 +真部 +真酒谷 +真里谷 +真重 +真野 +真野田 +真野目 +真金 +真釼 +真鈴川 +真銅 +真鍋 +真長 +真門 +真開 +真間 +真間田 +真関 +真隅 +真隅田 +真雁 +真霜 +真霞 +真面 +真頼 +真館 +真首 +真馬 +真駈 +真高 +真鳥 +真鶴 +真鷲 +真黒 +真鼻 +真龍寺 +真𡌛 +真𡽶 +眠目 +眦 +眷上 +眸 +眺野 +眼崎 +眼座 +眼目 +眼竜 +眼関 +眼龍 +着 +着崎 +着月 +着本 +着籐 +着能 +着藤 +着連 +督 +督永 +睦 +睦又 +睦口 +睦好 +睦島 +睦川 +睦月 +睦永 +睦浦 +睦田 +睦良田 +睦見 +睦谷 +睦野 +睦門 +瞰野 +瞼木 +瞽女迫 +瞿曇 +矜田 +矢の下 +矢の沢 +矢の目 +矢ケ井 +矢ケ崎 +矢ケ嵜 +矢ケ村 +矢ケ瀬 +矢ケ田 +矢ケ良 +矢ケ部 +矢ノ上 +矢ノ下 +矢ノ中 +矢ノ倉 +矢ノ口 +矢ノ向 +矢ノ島 +矢ノ崎 +矢ノ川 +矢ノ師 +矢ノ木 +矢ノ本 +矢ノ根 +矢ノ沢 +矢ノ浦 +矢ノ登 +矢ノ目 +矢ノ谷 +矢ノ貴 +矢三 +矢上 +矢下 +矢下田 +矢不 +矢中 +矢久保 +矢久指 +矢久間 +矢之 +矢之目 +矢之貴 +矢之高 +矢亀 +矢五田 +矢井 +矢井田 +矢仁田 +矢代 +矢仲 +矢伏 +矢伝 +矢住 +矢佐 +矢佐間 +矢作 +矢來 +矢信 +矢俣 +矢倉 +矢倉屋 +矢傳 +矢儀 +矢儀田 +矢元 +矢先 +矢光 +矢入 +矢八 +矢具 +矢具島 +矢具野 +矢内 +矢内原 +矢冨 +矢出 +矢切 +矢利 +矢削 +矢功 +矢加部 +矢動丸 +矢勢 +矢北 +矢半田 +矢原 +矢取 +矢口 +矢古宇 +矢古島 +矢古嶋 +矢可部 +矢号 +矢司 +矢合 +矢吉 +矢名島 +矢名川 +矢名葉 +矢向 +矢吹 +矢吾田 +矢和多 +矢和田 +矢問 +矢土 +矢地 +矢坂 +矢垣 +矢垰 +矢城 +矢埜 +矢堀 +矢場 +矢場瀬 +矢場田 +矢塚 +矢壁 +矢壷 +矢壺 +矢外 +矢多 +矢多部 +矢奈 +矢奥 +矢好 +矢子 +矢守 +矢宗 +矢定 +矢実 +矢室 +矢富 +矢實 +矢寺 +矢尻 +矢尾 +矢尾井 +矢尾板 +矢尾田 +矢尾知 +矢尾谷 +矢居 +矢屏 +矢山 +矢岡 +矢岳 +矢岸 +矢峠 +矢島 +矢崎 +矢嵜 +矢嶋 +矢嶌 +矢川 +矢巻 +矢帆 +矢幅 +矢幡 +矢广城 +矢床 +矢府 +矢座 +矢庭 +矢延 +矢廹 +矢式 +矢弓 +矢引 +矢張 +矢形 +矢彦 +矢彦沢 +矢彦澤 +矢影 +矢後 +矢徳 +矢成 +矢我崎 +矢戸 +矢戸田 +矢房 +矢所 +矢折 +矢括 +矢持 +矢指 +矢指本 +矢挽 +矢掛 +矢摩城 +矢放 +矢政 +矢数 +矢敷 +矢數 +矢新 +矢方 +矢旗 +矢是 +矢普留 +矢景 +矢曳 +矢曽 +矢木 +矢木原 +矢木橋 +矢木沢 +矢木澤 +矢木田 +矢木野 +矢末 +矢本 +矢杉 +矢村 +矢来 +矢松 +矢板 +矢板橋 +矢柄 +矢柳 +矢柴 +矢根 +矢根広 +矢桐 +矢桟間 +矢森 +矢橋 +矢櫃 +矢次 +矢歌 +矢武 +矢比久 +矢毛 +矢毛石 +矢永 +矢沢 +矢河 +矢治 +矢沼 +矢泙 +矢波 +矢津 +矢津田 +矢浜 +矢浦 +矢浪 +矢淵 +矢渕 +矢渡 +矢満田 +矢滝 +矢澤 +矢瀧 +矢瀬 +矢灘 +矢熊 +矢牧 +矢狭 +矢狹 +矢玉 +矢生 +矢用 +矢田 +矢田ケ谷 +矢田主 +矢田具 +矢田堀 +矢田山 +矢田崎 +矢田川 +矢田森 +矢田浦 +矢田目 +矢田谷 +矢田貝 +矢田辺 +矢田部 +矢田郷 +矢田野 +矢畑 +矢留 +矢白木 +矢的 +矢盛 +矢目 +矢知 +矢矧 +矢石 +矢研田 +矢磨城 +矢神 +矢積 +矢立 +矢端 +矢竹 +矢笠 +矢筈 +矢筈野 +矢筒 +矢箆原 +矢箟原 +矢管 +矢篦原 +矢籐 +矢納 +矢継 +矢羽 +矢羽々 +矢羽多 +矢羽木 +矢羽根 +矢羽田 +矢羽羽 +矢羽野 +矢能 +矢舖 +矢舗 +矢舗田 +矢舘 +矢舟 +矢舩 +矢船 +矢良 +矢良上 +矢芝 +矢花 +矢草山 +矢菅 +矢萩 +矢落 +矢葺 +矢藤 +矢袋 +矢裂 +矢西 +矢角 +矢谷 +矢貝 +矢貫 +矢貴 +矢賀 +矢賀垰 +矢賀谷 +矢賀部 +矢走 +矢越 +矢路 +矢路川 +矢車 +矢農 +矢辺 +矢辻 +矢込 +矢迫 +矢追 +矢通 +矢達 +矢違 +矢邉 +矢邊 +矢那瀬 +矢部 +矢部井 +矢部川 +矢部田 +矢郷 +矢都木 +矢都村 +矢里 +矢野 +矢野上 +矢野下 +矢野倉 +矢野元 +矢野内 +矢野原 +矢野口 +矢野坂 +矢野堂 +矢野尾 +矢野島 +矢野崎 +矢野川 +矢野平 +矢野本 +矢野東 +矢野根 +矢野森 +矢野沢 +矢野澤 +矢野目 +矢野間 +矢野馬 +矢金 +矢鉾 +矢鋪 +矢録 +矢鍋 +矢長 +矢間 +矢阪 +矢附 +矢陸 +矢隅 +矢隈 +矢頃 +矢須 +矢須田 +矢須間 +矢頭 +矢飼 +矢館 +矢馳 +矢高 +矢鳥 +矢鳴 +矢鶴 +矢麥 +矢麦 +矢黒 +矤上 +知 +知々田 +知久 +知久島 +知久平 +知久田 +知久間 +知久馬 +知井 +知京 +知倉 +知元 +知光 +知公 +知切 +知利川 +知加良 +知北 +知升 +知原 +知又 +知古島 +知古嶋 +知名 +知名石 +知和 +知和井 +知土 +知地 +知地理 +知坂 +知場 +知多 +知字 +知家 +知屋城 +知山 +知崎 +知嵜 +知工 +知平 +知幸 +知念 +知恵 +知手 +知振 +知敷 +知本 +知村 +知桐 +知桝 +知気 +知沢 +知波羅 +知浦 +知田 +知留間 +知知夫 +知知田 +知神 +知福 +知禿 +知立 +知童 +知能 +知脇 +知舛 +知花 +知苑 +知葉 +知藤 +知見 +知見寺 +知覧 +知識 +知賀 +知足 +知路 +知部 +知里 +知里口 +知野 +知野根 +知野見 +知領 +知高 +矩 +矩茂 +短保 +短岡 +短田 +矮松 +矯安 +石 +石々川 +石ケ休 +石ケ原 +石ケ坪 +石ケ守 +石ケ崎 +石ケ森 +石ケ谷 +石ケ野 +石ノ巻 +石ノ鉢 +石ユ +石三 +石上 +石下 +石下谷 +石並 +石中 +石丸 +石久保 +石之 +石之久保 +石之神 +石之脇 +石之腰 +石之野 +石亀 +石五 +石井 +石井出 +石井原 +石井口 +石井山 +石井田 +石仏 +石付 +石仙 +石代 +石仲 +石伊 +石伏 +石伐 +石住 +石佐 +石佐古 +石佐喜 +石佛 +石作 +石保 +石倉 +石倭 +石側 +石元 +石先 +石光 +石児 +石其 +石兼 +石内 +石冢 +石冨 +石出 +石切 +石切山 +石切所 +石前 +石割 +石加 +石動 +石動丸 +石動谷 +石北 +石匠 +石升 +石南 +石原 +石原口 +石原坂 +石原島 +石原崎 +石原田 +石友 +石口 +石古 +石司 +石合 +石名 +石名坂 +石名沢 +石名澤 +石名田 +石名部 +石向 +石吾 +石和 +石和久 +石和田 +石咲 +石嘉 +石嘉波 +石国 +石國 +石園 +石土 +石地 +石坂 +石坂川 +石坂谷 +石坪 +石垣 +石城 +石城戸 +石埜 +石埼 +石堀 +石堂 +石堂丸 +石堤 +石場 +石塔 +石塚 +石塩 +石塲 +石増 +石墨 +石墳 +石墻 +石壷 +石外 +石多 +石大 +石妙 +石子 +石宇 +石守 +石宗 +石定 +石宝 +石室 +石室屋 +石宮 +石家 +石富 +石寺 +石射 +石小 +石尾 +石居 +石屋 +石屋敷 +石山 +石岡 +石岩 +石岳 +石岶 +石峯 +石峰 +石島 +石崎 +石崖 +石嵜 +石嶋 +石嶌 +石嶺 +石川 +石川原 +石工 +石差 +石巻 +石幡 +石平 +石幸 +石広 +石床 +石底 +石座 +石庫 +石庭 +石廣 +石建 +石引 +石当 +石形 +石後 +石後岡 +石徳 +石徹白 +石志 +石応 +石應 +石懸 +石成 +石我 +石戸 +石戸橋 +石戸谷 +石手 +石手洗 +石打 +石投 +石抜 +石拔 +石持 +石指 +石挽 +石掛 +石揚 +石政 +石故 +石敷 +石文 +石料 +石新 +石方 +石早 +石暮 +石曽根 +石曾根 +石月 +石木 +石木呂 +石木戸 +石木田 +石末 +石本 +石杉 +石村 +石杜 +石束 +石東 +石松 +石林 +石柏 +石栄 +石栗 +石根 +石桁 +石桜 +石梶 +石森 +石椛 +石榑 +石榮 +石槁 +石槌 +石槫 +石槻 +石樋 +石樵 +石橋 +石櫃 +石次 +石止 +石正 +石毋田 +石母田 +石毛 +石氏 +石水 +石氷 +石永 +石江 +石池 +石沢 +石河 +石河内 +石治 +石沼 +石泉 +石波 +石洞 +石津 +石津川 +石津江 +石津谷 +石流 +石浜 +石浦 +石浪 +石海 +石淵 +石添 +石清水 +石済 +石渓 +石渕 +石渡 +石渡戸 +石湯 +石満 +石滝 +石澤 +石濃 +石濱 +石瀧 +石瀬 +石灘 +石火矢 +石灰 +石炉 +石炭 +石熊 +石爪 +石牟礼 +石牟禮 +石牧 +石王 +石王丸 +石理 +石瓶 +石生 +石生田 +石生谷 +石田 +石田原 +石田坂 +石田尾 +石甲斐 +石町 +石畑 +石畒 +石畔 +石留 +石畝 +石畠 +石盛 +石目 +石直 +石矢 +石砂原 +石破 +石硯 +石社 +石神 +石神井 +石福 +石禾 +石積 +石突 +石窪 +石立 +石端 +石竹 +石笠 +石筒 +石答 +石策 +石築 +石米 +石糸 +石紅 +石納 +石綱 +石綿 +石美 +石羽 +石羽根 +石羽沢 +石羽澤 +石股 +石脇 +石腰 +石腸 +石膓 +石臥 +石舘 +石舟 +石船 +石良 +石花 +石芳 +石若 +石茂 +石葉 +石蔵 +石藏 +石藤 +石行 +石裏 +石西 +石見 +石見屋 +石角 +石記 +石訳 +石詰 +石谷 +石貝 +石貞 +石貫 +石賀 +石走 +石越 +石路 +石踊 +石躍 +石輪 +石辺 +石辻 +石迫 +石通 +石過 +石道 +石達 +石邉 +石邊 +石邑 +石那坂 +石那田 +石邨 +石郡 +石部 +石郷 +石郷岡 +石里 +石野 +石野巻 +石野森 +石野田 +石野目 +石野谷 +石金 +石鉈 +石鉢 +石鍋 +石鍵 +石鎚 +石鐘 +石鑑 +石長 +石長川 +石門 +石間 +石間伏 +石間戸 +石関 +石關 +石阪 +石附 +石陵 +石隅 +石隈 +石隋 +石随 +石際 +石隨 +石雲 +石鞍 +石須 +石須賀 +石頭 +石風 +石風呂 +石颪 +石飛 +石館 +石香 +石馬 +石馬場 +石高 +石鰹 +石鳥 +石鳥谷 +石鷲見 +石鷹 +石鹿 +石黒 +石龍 +石﨏 +矼 +砂 +砂上 +砂井 +砂倉 +砂元 +砂光 +砂入 +砂内 +砂刈 +砂原 +砂取 +砂口 +砂古 +砂古口 +砂合 +砂和田 +砂土 +砂土居 +砂地 +砂坂 +砂坪 +砂埜 +砂堀 +砂場 +砂塚 +砂壁 +砂奥 +砂子 +砂子勢 +砂子坂 +砂子場 +砂子沢 +砂子澤 +砂子田 +砂子間 +砂子阪 +砂守 +砂宮 +砂小原 +砂小田 +砂小間 +砂尾 +砂屋敷 +砂山 +砂岡 +砂岬 +砂岳 +砂崎 +砂嶺 +砂嶽 +砂川 +砂平 +砂広 +砂庭 +砂廣 +砂後 +砂後谷 +砂戸 +砂手 +砂押 +砂掛 +砂明利 +砂月 +砂木 +砂本 +砂村 +砂東 +砂森 +砂橋 +砂永 +砂江 +砂池 +砂沢 +砂河 +砂治 +砂泊 +砂洞 +砂津 +砂流 +砂浜 +砂浦 +砂浪 +砂渡 +砂湖 +砂溜 +砂澤 +砂濱 +砂瀬 +砂生 +砂田 +砂町 +砂畑 +砂留 +砂畠 +砂盃 +砂盛 +砂石 +砂端 +砂糖 +砂糖元 +砂脇 +砂葉 +砂藤 +砂見 +砂谷 +砂賀 +砂走 +砂越 +砂辺 +砂連尾 +砂道 +砂邉 +砂邊 +砂部 +砂野 +砂金 +砂長 +砂長谷 +砂間 +砂関 +砂馳 +研 +研井 +研和 +研壁 +研尾 +研屋 +研山 +研岡 +研川 +研本 +研田 +研矢 +研石 +研磨 +研谷 +研野 +砙礫 +砥上 +砥出 +砥坂 +砥堀 +砥山 +砥島 +砥嶋 +砥川 +砥抦 +砥掘 +砥板 +砥波 +砥田 +砥石 +砥石川 +砥綿 +砥谷 +砲流 +破入 +破呂 +破多野 +破崎 +破戸 +破毛 +破瀬 +破田野 +破石 +破磯川 +破良 +破魔 +砺山 +砺波 +砺田 +硎 +硎元 +硎光 +硎家 +硎屋 +硎矢 +硎磨 +硎谷 +硎野 +硑 +硤合 +硫黄 +硯 +硯山 +硯川 +硯田 +硯石 +硯見 +硯谷 +硯里 +硲 +硲口 +硲地 +硲本 +硲田 +硲石 +硲野 +硲間 +硴久 +硴原 +硴塚 +硴崎 +硴水 +硴田 +硴野 +碁田 +碁盤 +碁石 +碇 +碇井 +碇代 +碇元 +碇子 +碇屋 +碇山 +碇川 +碇本 +碇武 +碇永 +碇田 +碇矢 +碇石 +碇谷 +碇賀 +碇野 +碇金 +碓 +碓井 +碓居 +碓木 +碓本 +碓村 +碓水 +碓氷 +碓永 +碓田 +碕山 +碕木 +碣石 +碧 +碧山 +碧川 +碧木 +碧村 +碧海 +碩 +碩山 +碩本 +碩根 +碩野 +碪 +確井 +確田 +磆 +磊 +磋硪 +磐 +磐上 +磐下 +磐井 +磐佐 +磐前 +磐城 +磐山 +磐崎 +磐本 +磐村 +磐根 +磐梨 +磐槻 +磐沢 +磐浅 +磐淵 +磐淺 +磐渕 +磐瀬 +磐田 +磐脇 +磐谷 +磐長谷 +磐隈 +磦田 +磧 +磧上 +磧守 +磧本 +磧谷 +磨 +磨井 +磨伊 +磨呂 +磨墨 +磨家 +磨屋 +磨島 +磨平 +磨志葉 +磨樒 +磨渕 +磨田 +磨矢 +磨知 +磨蜜 +磨見 +磨谷 +磨野 +磯 +磯ケ谷 +磯ノ上 +磯上 +磯下 +磯丘 +磯中 +磯久 +磯亀 +磯井 +磯井佐 +磯仁 +磯俣 +磯倉 +磯元 +磯兼 +磯内 +磯前 +磯原 +磯口 +磯合 +磯和 +磯嘉 +磯地 +磯垣 +磯城 +磯埜 +磯場 +磯塚 +磯奥 +磯家 +磯尾 +磯屋 +磯山 +磯岡 +磯岩 +磯島 +磯崎 +磯嵜 +磯嶋 +磯嶌 +磯川 +磯干 +磯平 +磯引 +磯打 +磯方 +磯木 +磯本 +磯村 +磯村田 +磯松 +磯林 +磯根 +磯森 +磯橋 +磯次 +磯氏 +磯永 +磯江 +磯沖 +磯沢 +磯沼 +磯波 +磯津 +磯浜 +磯浦 +磯浪 +磯海 +磯淵 +磯渕 +磯濱 +磯瀬 +磯田 +磯町 +磯畑 +磯目 +磯矢 +磯石 +磯福 +磯秋 +磯積 +磯端 +磯竹 +磯網 +磯脇 +磯良 +磯花 +磯藤 +磯西 +磯見 +磯角 +磯谷 +磯貝 +磯賀 +磯越 +磯輪 +磯辺 +磯辺舘 +磯辺館 +磯遊 +磯道 +磯邉 +磯邊 +磯部 +磯里 +磯野 +磯金 +磯長 +磯間 +磯飛 +磯馴 +磴 +磹 +磻田 +礀 +礎 +礎我 +礒 +礒ケ谷 +礒上 +礒下 +礒亀 +礒井 +礒仁 +礒元 +礒兼 +礒内 +礒前 +礒原 +礒口 +礒合 +礒垣 +礒好 +礒家 +礒尾 +礒屋 +礒山 +礒岡 +礒岩 +礒島 +礒崎 +礒嵜 +礒嶋 +礒嶌 +礒川 +礒干 +礒木 +礒本 +礒村 +礒松 +礒根 +礒森 +礒橋 +礒次 +礒氏 +礒永 +礒江 +礒沢 +礒沼 +礒津 +礒浜 +礒浦 +礒浪 +礒海 +礒淵 +礒渕 +礒澤 +礒濱 +礒瀬 +礒田 +礒畑 +礒目 +礒端 +礒竹 +礒網 +礒脇 +礒西 +礒見 +礒谷 +礒貝 +礒辺 +礒道 +礒邉 +礒邊 +礒部 +礒野 +礒金 +礒間 +礒飛 +礪山 +礪波 +礫石 +示 +示崎 +示村 +示森 +示沢 +示野 +社 +社内 +社務 +社古地 +社地 +社城 +社宮司 +社家 +社家間 +社川 +社御比 +社方 +社本 +社林 +社森 +社樹 +社沢 +社河内 +社浦 +社澤 +社田 +社籐 +社納 +社藤 +社谷内 +社領 +社頭 +祁内 +祁答院 +祁荅院 +祇園 +祇園下 +祇園寺 +祇園田 +祇園白 +祇場 +祇樹 +祈 +祈山 +祈本 +祐 +祐下 +祐乗坊 +祐井 +祐仙 +祐代 +祐伯 +祐保 +祐信 +祐光 +祐原 +祐名 +祐安 +祐宗 +祐定 +祐実 +祐實 +祐尾 +祐岡 +祐島 +祐嶋 +祐川 +祐延 +祐影 +祐徳 +祐恒 +祐成 +祐木 +祐末 +祐本 +祐村 +祐東 +祐松 +祐森 +祐永 +祐泉 +祐源 +祐田 +祐盛 +祐真 +祐福 +祐耆 +祐谷 +祐辻 +祐野 +祐領 +祓川 +祖一 +祖上 +祖下 +祖伝 +祖傳 +祖出 +祖利田 +祖利目 +祖和 +祖地 +祖堅 +祖多 +祖家 +祖山 +祖岩 +祖川 +祖師 +祖平 +祖式 +祖慶 +祖敷 +祖月輪 +祖根 +祖母井 +祖母仁田 +祖母浦 +祖母谷 +祖母賀 +祖泉 +祖浜 +祖浦 +祖濱 +祖父元 +祖父尼 +祖父川 +祖父江 +祖生部 +祖田 +祖福 +祖納 +祖納元 +祖羅 +祖谷 +祖開 +祗園 +祗山 +祝 +祝ケ野 +祝井 +祝井沢口 +祝井澤口 +祝井谷 +祝儀園 +祝出 +祝前 +祝原 +祝園 +祝多 +祝子 +祝崎 +祝嶺 +祝松 +祝枝 +祝田 +祝谷 +祝賀 +祝迫 +祝部 +祝野 +神 +神々 +神々𢌞 +神ノ倉 +神ノ口 +神ノ川 +神ノ栖 +神ノ浦 +神ノ田 +神ノ薗 +神ノ門 +神㘴 +神一 +神上 +神上園 +神下 +神与 +神並 +神中 +神丸 +神主 +神主領 +神久 +神久保 +神之 +神之下 +神之原 +神之口 +神之園 +神之川 +神之村 +神之浦 +神之田 +神之薗 +神之門 +神亀 +神事 +神井 +神井田 +神人 +神仁谷 +神代 +神仲 +神位 +神住 +神佐 +神余 +神作 +神例 +神供 +神保 +神保原 +神信 +神俣 +神倉 +神元 +神先 +神光 +神免 +神八 +神内 +神凉 +神処 +神出 +神初 +神前 +神割 +神力 +神北 +神南 +神原 +神取 +神口 +神古 +神吉 +神名 +神名川 +神名部 +神向 +神向寺 +神呪 +神和住 +神咒 +神品 +神喰 +神囿 +神園 +神土 +神在 +神地 +神坂 +神坐 +神坪 +神垣 +神城 +神埜 +神埼 +神堀 +神堂 +神場 +神場矢 +神塚 +神変 +神夏磯 +神多 +神多羅木 +神多野 +神太麻 +神奈 +神奈地 +神奈川 +神奈木 +神奈沢 +神奈輪 +神奴 +神好 +神子 +神子上 +神子島 +神子嶋 +神子戸 +神子柴 +神子沢 +神子澤 +神子田 +神子素 +神子谷 +神子高 +神字 +神孫子 +神宅 +神宇知 +神守 +神安 +神定 +神宝 +神室 +神宮 +神宮司 +神宮字 +神宮寺 +神宮時 +神宮次 +神宮氏 +神宮路 +神家 +神家満 +神宿 +神宿内 +神寳 +神寶 +神尊 +神小柴 +神小路 +神尾 +神尾町 +神居 +神屋 +神屋敷 +神山 +神岡 +神岳 +神峯 +神峰 +神島 +神崎 +神崎谷 +神嵜 +神嶋 +神嶌 +神川 +神巻 +神市 +神平 +神広 +神床 +神座 +神庭 +神廣 +神建 +神張 +神影 +神後 +神徳 +神志名 +神志那 +神応 +神応寺 +神恵 +神惠 +神應 +神應寺 +神成 +神成田 +神戸 +神戸中 +神戸屋 +神戸川 +神房 +神所 +神手 +神指 +神掛 +神支那 +神方 +神於 +神明 +神明前 +神月 +神服 +神服部 +神木 +神末 +神本 +神杉 +神村 +神来社 +神東 +神松 +神林 +神柱 +神栄 +神桜 +神棒 +神森 +神植 +神楽 +神楽岡 +神楽所 +神楽田 +神樂 +神樂所 +神橋 +神武 +神殿 +神母坂 +神毛 +神水 +神水流 +神永 +神江 +神池 +神沢 +神河 +神治 +神沼 +神波 +神津 +神浜 +神浦 +神浪 +神海 +神涼 +神渡 +神澤 +神濃 +神濱 +神瀬 +神爪 +神牟礼 +神牟禮 +神牧 +神王 +神生 +神田 +神田林 +神田橋 +神界 +神畑 +神畠 +神白 +神益 +神盛 +神目 +神矢 +神石 +神社 +神祖 +神福 +神移 +神稲 +神窪 +神立 +神童 +神竹 +神笠 +神箸 +神籐 +神籔 +神納 +神納木 +神細工 +神結 +神緒 +神羽 +神翁 +神者 +神能 +神脇 +神舎 +神舘 +神船 +神良 +神花 +神茂 +神菊 +神葉 +神蔵 +神薗 +神薮 +神藏 +神藤 +神藪 +神處 +神蛇 +神行 +神西 +神谷 +神谷内 +神賀 +神越 +神足 +神路 +神路祇 +神路祗 +神車 +神農 +神辺 +神辺須 +神近 +神迫 +神通 +神通川 +神連 +神逹 +神過 +神道 +神達 +神邉 +神邊 +神邑 +神郡 +神部 +神酒 +神酒井 +神酒澤 +神里 +神重 +神野 +神野志 +神野河 +神野藤 +神鍛 +神鍜 +神長 +神長倉 +神門 +神開 +神閑 +神間 +神阪 +神院 +神雲 +神鞭 +神音 +神頃 +神領 +神頭 +神風 +神餘 +神館 +神馬 +神馬場 +神高 +神鳥 +神鷹 +神麻 +祢ギ田 +祢元 +祢占 +祢司 +祢宜 +祢宜元 +祢宜沢 +祢宜洞 +祢宜澤 +祢宜田 +祢宜田谷 +祢宜谷 +祢宣 +祢宣元 +祢宣洞 +祢宣田 +祢宣谷 +祢寝 +祢寢 +祢屋 +祢木 +祢次金 +祢津 +祢石 +祢覇 +祢酒 +祢里 +祥瑞 +祥雲 +祭 +祭主 +祭原 +祭城 +祭木 +祭本 +祭田 +祭礼田 +祭禮田 +祭貴 +祷 +禅 +禅定 +禅正 +禅洲 +禅野 +禅院 +禎 +禎山 +禎島 +禎村 +禎田 +福 +福ケ崎 +福ケ迫 +福ケ野 +福ノ上 +福一 +福万 +福三田 +福上 +福下 +福与 +福世 +福丘 +福並 +福中 +福丸 +福丸屋 +福丹 +福久 +福之上 +福之江 +福亀 +福予 +福井 +福井田 +福井谷 +福代 +福仲 +福伊 +福伝 +福住 +福佐 +福來 +福依 +福保 +福俣 +福倉 +福傅 +福傳 +福元 +福充 +福光 +福入 +福内 +福円 +福冨 +福分 +福別府 +福利 +福前 +福力 +福加 +福勢 +福北 +福升 +福原 +福友 +福取 +福口 +福口山 +福司 +福司山 +福吉 +福名 +福呂 +福味 +福和 +福和田 +福品 +福善 +福喜 +福喜多 +福喜田 +福囿 +福園 +福圓 +福土 +福地 +福地本 +福坂 +福坪 +福垣 +福垣内 +福城 +福埜 +福堀 +福堂 +福場 +福塚 +福増 +福士 +福壽 +福多 +福夛 +福好 +福字 +福守 +福安 +福定 +福室 +福宮 +福家 +福宿 +福寄 +福富 +福寺 +福寿 +福寿谷 +福尾 +福居 +福屋 +福山 +福岡 +福岡屋 +福岩 +福岳 +福峯 +福峰 +福島 +福島屋 +福崎 +福嵜 +福嶋 +福嶌 +福嶺 +福川 +福川原 +福巻 +福市 +福平 +福広 +福庄 +福座 +福庭 +福廣 +福延 +福当 +福形 +福徳 +福応 +福恵 +福惠 +福意 +福慶 +福應 +福成 +福成寺 +福戸 +福戸山 +福所 +福手 +福持 +福掘 +福摩 +福政 +福新 +福明 +福春 +福景 +福智 +福智山 +福智院 +福月 +福有 +福服 +福木 +福木屋 +福末 +福本 +福村 +福条 +福来 +福東 +福松 +福林 +福枝 +福枡 +福栄 +福根 +福桜 +福桝 +福條 +福森 +福楽 +福榮 +福橋 +福櫻 +福次 +福止 +福正 +福武 +福歳 +福殿 +福母 +福毛 +福水 +福永 +福江 +福池 +福沢 +福河 +福治 +福泉 +福泊 +福波 +福津 +福浜 +福浦 +福浪 +福海 +福添 +福清 +福渓 +福渡 +福湯 +福満 +福溜 +福溝 +福溪 +福滝 +福滿 +福澄 +福澤 +福濱 +福瀧 +福瀬 +福炭 +福状 +福玉 +福王 +福王子 +福王寺 +福生 +福用 +福田 +福田寺 +福田屋 +福田川 +福田谷 +福由 +福畑 +福留 +福畠 +福當 +福益 +福盛 +福盛田 +福目 +福眞 +福真 +福矢 +福知 +福石 +福祐 +福神 +福神屋 +福禄 +福積 +福竹 +福篭 +福籐 +福籔 +福籠 +福米 +福納 +福綱 +福網 +福繁 +福羅 +福美 +福羽 +福聚 +福脇 +福與 +福興 +福舎 +福舘 +福舛 +福良 +福良峠 +福芋 +福芝 +福芳 +福若 +福草 +福菅 +福葉 +福蔵 +福薗 +福薮 +福藤 +福衛 +福袋 +福西 +福見 +福角 +福谷 +福豊 +福豫 +福貝 +福貞 +福負 +福貴 +福貴島 +福貴田 +福貴迫 +福賀 +福越 +福路 +福躍 +福輿 +福辺 +福辻 +福迫 +福造 +福邉 +福邊 +福邑 +福部 +福郷 +福里 +福重 +福野 +福釜 +福録 +福鎌 +福長 +福門 +福間 +福阪 +福隅 +福雄 +福集 +福面 +福頼 +福飯 +福館 +福馬 +福高 +福鹿 +禧久 +禧美 +禪 +禪正 +禪野 +禪院 +禰保 +禰元 +禰占 +禰宜 +禰宜元 +禰宜洞 +禰宜田 +禰宜田谷 +禰宜谷 +禰宣 +禰宣田 +禰宣田谷 +禰寝 +禰寢 +禰屋 +禰木 +禰次金 +禰津 +禰覇 +禰酒 +禰里 +禱 +禹原 +禹山 +禹本 +禹藤 +禾 +禾几 +禾木 +禾本 +禾野 +禿 +禿下 +禿井 +禿子 +禿川 +禿末 +禿林 +禿樹 +禿氏 +禿河 +秀 +秀井 +秀倉 +秀働 +秀内 +秀南 +秀口 +秀吉 +秀坂 +秀城 +秀安 +秀山 +秀岡 +秀岳 +秀島 +秀崎 +秀嶋 +秀川 +秀平 +秀徳 +秀方 +秀本 +秀村 +秀森 +秀毛 +秀永 +秀沢 +秀浦 +秀澤 +秀瀬 +秀熊 +秀田 +秀眞 +秀真 +秀石 +秀能井 +秀衡 +秀谷 +秀里 +秀野 +秀間 +秀高 +私市 +私部 +秂 +秉附 +秋 +秋ケ島 +秋三 +秋上 +秋下 +秋中 +秋丸 +秋久 +秋久保 +秋井 +秋住 +秋保 +秋信 +秋倉 +秋元 +秋光 +秋内 +秋冨 +秋利 +秋前 +秋南 +秋原 +秋友 +秋口 +秋吉 +秋和 +秋国 +秋國 +秋園 +秋坂 +秋城 +秋堂 +秋場 +秋塚 +秋塲 +秋好 +秋子 +秋守 +秋安 +秋宗 +秋定 +秋実 +秋家 +秋寄 +秋富 +秋實 +秋尾 +秋屋 +秋山 +秋山八幡 +秋岡 +秋岸 +秋峯 +秋峰 +秋島 +秋崎 +秋嶋 +秋嶺 +秋川 +秋常 +秋幡 +秋平 +秋年 +秋広 +秋庭 +秋廣 +秋成 +秋戸 +秋房 +秋摩 +秋政 +秋月 +秋朝 +秋末 +秋本 +秋杉 +秋村 +秋松 +秋林 +秋枝 +秋柴 +秋栃 +秋栗 +秋根 +秋桝 +秋森 +秋楽 +秋橋 +秋次 +秋武 +秋水 +秋永 +秋江 +秋池 +秋沢 +秋泉 +秋波 +秋津 +秋津川 +秋津風 +秋洲 +秋浜 +秋浦 +秋済 +秋満 +秋滿 +秋澤 +秋濃 +秋濟 +秋濱 +秋瀬 +秋炭 +秋生 +秋甫 +秋田 +秋田谷 +秋由 +秋畑 +秋盛 +秋目 +秋知 +秋石 +秋神 +秋穂 +秋積 +秋穗 +秋窪 +秋竹 +秋笹 +秋築 +秋篠 +秋繁 +秋羽 +秋脇 +秋腰 +秋良 +秋艸 +秋花 +秋芳 +秋草 +秋葉 +秋藤 +秋見 +秋角 +秋谷 +秋豆 +秋貞 +秋輪 +秋辺 +秋近 +秋迫 +秋道 +秋邉 +秋邊 +秋郷 +秋里 +秋重 +秋野 +秋野森 +秋野瀬 +秋鍬 +秋長 +秋間 +秋霜 +秋頭 +秋風 +秋馬 +秋高 +秋鷹 +秋鹿 +秌元 +秌場 +秌田 +科内 +科埜 +科沢 +科澤 +科田 +科部 +科野 +秘多 +秘川 +租和 +租多 +租島 +租川 +租父江 +租田 +租開 +秡 +秡川 +秡輪 +秡銘 +秡間 +秤 +秤屋 +秤谷 +秦 +秦井 +秦口 +秦名 +秦地 +秦山 +秦岡 +秦本 +秦森 +秦泉寺 +秦田 +秦穴 +秦谷 +秦野 +秩本 +秩父 +秬谷 +称原 +称宜 +称宜田 +称寝 +称解 +称里 +移守 +移川 +移林 +稀代 +稀玉 +程 +程上 +程兼 +程内 +程原 +程口 +程吉 +程塚 +程尾 +程山 +程岡 +程島 +程嶋 +程川 +程月 +程木 +程熊 +程田 +程能 +程谷 +程野 +程間 +税光 +税出 +税初 +税所 +税木 +税本 +税田 +稔田 +稔野 +稗 +稗内 +稗圃 +稗坂 +稗島 +稗嶋 +稗方 +稗木 +稗本 +稗村 +稗沢 +稗田 +稗畑 +稗畠 +稗苗 +稗貫 +稗野 +稚名 +稚塚 +稚田 +稜野 +種 +種ケ島 +種ケ嶋 +種下 +種中 +種久 +種五 +種井 +種佐 +種倉 +種元 +種光 +種具 +種兼 +種原 +種口 +種吉 +種坂 +種場 +種子 +種子宗 +種子尾 +種子島 +種子嶋 +種子永 +種子田 +種子野 +種定 +種家 +種尻 +種尾 +種屋 +種山 +種岡 +種島 +種崎 +種川 +種市 +種帰 +種平 +種広 +種廣 +種延 +種戸 +種房 +種昂 +種木 +種本 +種村 +種林 +種森 +種植 +種橋 +種歸 +種毛 +種永 +種池 +種沢 +種河 +種治 +種浦 +種清 +種澤 +種瀬 +種物谷 +種生 +種田 +種畑 +種盛 +種石 +種稲 +種窪 +種継 +種綿 +種艸 +種茂 +種草 +種蔵 +種藤 +種谷 +種邑 +種那場 +種部 +種里 +種野 +種間 +稱 +稱原 +稱木 +稱解 +稲 +稲ケ瀬 +稲ケ部 +稲上 +稲下 +稲並 +稲中 +稲丸 +稲久 +稲久保 +稲井 +稲井田 +稲仁 +稲仈 +稲付 +稲代 +稲仲 +稲住 +稲佐 +稲何場 +稲倉 +稲元 +稲光 +稲内 +稲冨 +稲出 +稲別 +稲前 +稲動丸 +稲勝 +稲原 +稲又 +稲取 +稲口 +稲吉 +稲名 +稲向 +稲味 +稲和 +稲員 +稲国 +稲園 +稲土 +稲地 +稲坂 +稲垣 +稲城 +稲堀 +稲堂丸 +稲場 +稲塚 +稲塲 +稲増 +稲墻 +稲多 +稲奈 +稲奈葉 +稲好 +稲妻 +稲妻地 +稲子 +稲子田 +稲子谷 +稲守 +稲安 +稲宝 +稲実 +稲室 +稲宮 +稲家 +稲寄 +稲富 +稲實 +稲寺 +稲尾 +稲居 +稲屋 +稲山 +稲岡 +稲峯 +稲峰 +稲島 +稲崎 +稲嵜 +稲嶋 +稲嶌 +稲嶺 +稲川 +稲常 +稲干 +稲庭 +稲延 +稲引 +稲形 +稲恒 +稲成 +稲戸 +稲房 +稲手 +稲打 +稲持 +稲掛 +稲摩 +稲政 +稲数 +稲敷 +稲數 +稲昌 +稲星 +稲月 +稲木 +稲木戸 +稲本 +稲村 +稲束 +稲松 +稲林 +稲枝 +稲枡 +稲栄 +稲根 +稲桓 +稲桝 +稲森 +稲植 +稲榮 +稲橋 +稲次 +稲殿 +稲毛 +稲毛田 +稲水 +稲永 +稲江 +稲池 +稲沖 +稲沢 +稲河 +稲治 +稲沼 +稲泉 +稲波 +稲津 +稲浜 +稲浦 +稲浪 +稲海 +稲淵 +稲清水 +稲渕 +稲満 +稲澤 +稲濱 +稲瀬 +稲熊 +稲牆 +稲玉 +稲生 +稲生田 +稲用 +稲田 +稲田屋 +稲男 +稲畄 +稲畑 +稲留 +稲畠 +稲益 +稲盛 +稲目 +稲着 +稲石 +稲神 +稲福 +稲穂 +稲積 +稲穗 +稲窪 +稲立 +稲童丸 +稲端 +稲端下 +稲箸 +稲納 +稲継 +稲置 +稲美 +稲股 +稲脇 +稲臣 +稲舘 +稲舛 +稲舟 +稲舩 +稲船 +稲艸 +稲苗代 +稲若 +稲茂 +稲茂登 +稲草 +稲荷 +稲荷場 +稲荷山 +稲荷平 +稲荷森 +稲荷田 +稲荷迫 +稲菊 +稲葉 +稲葉谷 +稲蔭 +稲蔵 +稲薮 +稲藏 +稲藤 +稲藪 +稲西 +稲見 +稲角 +稲谷 +稲豊 +稲貝 +稲賀 +稲越 +稲足 +稲輪 +稲農 +稲辺 +稲返 +稲迫 +稲邉 +稲邊 +稲邑 +稲邪 +稲部 +稲郷 +稲里 +稲重 +稲野 +稲野辺 +稲野邉 +稲野邊 +稲鍋 +稲鍵 +稲門 +稲阪 +稲隈 +稲領 +稲飯 +稲餅 +稲館 +稲鶴 +稷山 +稻上 +稻井 +稻原 +稻口 +稻吉 +稻垣 +稻場 +稻塚 +稻子 +稻富 +稻尾 +稻山 +稻岡 +稻崎 +稻嶺 +稻川 +稻延 +稻数 +稻月 +稻木 +稻本 +稻村 +稻林 +稻森 +稻次 +稻毛 +稻永 +稻泉 +稻波 +稻津 +稻澤 +稻熊 +稻生 +稻田 +稻留 +稻益 +稻着 +稻石 +稻福 +稻積 +稻継 +稻船 +稻葉 +稻角 +稻谷 +稻邊 +稻野辺 +稼 +稼勢 +稼木 +稼農 +稽古庵 +穀内 +穀山 +穀本 +穀沢 +穀澤 +穀田 +穀蔵 +穀藏 +穀谷 +穀野 +穂 +穂上 +穂下 +穂並 +穂丸 +穂之上 +穂井田 +穂住 +穂保 +穂倉 +穂元 +穂先 +穂入 +穂刈 +穂前 +穂北 +穂原 +穂口 +穂園 +穂坂 +穂垂 +穂垣 +穂塚 +穂多田 +穂寄 +穂屋下 +穂山 +穂岐山 +穂島 +穂崎 +穂嶋 +穂川 +穂志 +穂志野 +穂戸田 +穂木 +穂本 +穂村 +穂束 +穂森 +穂毛 +穂永 +穂泉 +穂波 +穂津田 +穂浪 +穂満 +穂滿 +穂田 +穂畑 +穂登原 +穂盛 +穂科 +穂積 +穂穙 +穂竝 +穂芝 +穂苅 +穂藤 +穂見 +穂谷 +穂谷野 +穂迫 +穂道 +穂野 +穂阪 +穂高 +穂鷹 +穆佐 +穆谷 +積 +積久 +積光 +積内 +積原 +積口 +積善 +積家 +積山 +積岡 +積島 +積川 +積明 +積木 +積本 +積根 +積森 +積河内 +積治 +積田 +積良 +積賀 +積野 +積際 +穎原 +穎娃 +穎川 +穏台 +穏土 +穏地 +穏岐 +穏渡 +穏田 +穐丸 +穐久 +穐井 +穐保 +穐元 +穐利 +穐原 +穐友 +穐吉 +穐和 +穐和木 +穐場 +穐好 +穐宗 +穐山 +穐岡 +穐庭 +穐月 +穐本 +穐村 +穐枝 +穐永 +穐池 +穐沢 +穐津 +穐澤 +穐田 +穐葉 +穐西 +穐谷 +穐近 +穐里 +穐野 +穐長 +穐間 +穐鹿 +穖村 +穗並 +穗之上 +穗刈 +穗原 +穗口 +穗園 +穗坂 +穗垣 +穗屋下 +穗山 +穗岐山 +穗戸田 +穗本 +穗村 +穗束 +穗森 +穗永 +穗波 +穗浪 +穗満 +穗滿 +穗田 +穗積 +穗竝 +穗苅 +穗藤 +穗谷 +穗谷野 +穗迫 +穗阪 +穗鷹 +穝所 +穴 +穴久保 +穴井 +穴伏 +穴倉 +穴光 +穴南 +穴原 +穴口 +穴吹 +穴地 +穴堀 +穴場 +穴太 +穴尾 +穴山 +穴川 +穴戸 +穴手 +穴木沢 +穴木澤 +穴本 +穴村 +穴水 +穴沢 +穴津子 +穴渕 +穴澤 +穴瀬 +穴牛 +穴生 +穴田 +穴畑 +穴畠 +穴穂 +穴竃 +穴竈 +穴繁 +穴織 +穴蔵 +穴藏 +穴虫 +穴見 +穴谷 +穴迫 +穴野 +穴釜 +穴風 +穴鳥 +空 +空上 +空下 +空中 +空久保 +空井 +空元 +空先 +空処 +空口 +空地 +空垣内 +空場 +空増 +空宗 +空家 +空尾 +空山 +空岡 +空峯 +空峰 +空崎 +空川 +空戸 +空手 +空木 +空本 +空林 +空森 +空橋 +空池 +空沢 +空河内 +空泉 +空浜 +空澤 +空熊 +空田 +空畑 +空知 +空脇 +空花 +空華 +空處 +空西 +空見 +空谷 +空賀 +空野 +空門 +空閑 +空間 +空韻 +空風 +突々 +突元 +突出 +突合 +突山 +突川 +突廻 +突当 +突永 +突沖 +突浪 +突田 +突當 +突貫 +窄 +窄中 +窄口 +窄山 +窄野 +窄頭 +窓井 +窓原 +窓場 +窓岡 +窓岩 +窓川 +窓香 +窟 +窪 +窪ノ内 +窪上 +窪下 +窪世 +窪中 +窪之内 +窪井 +窪倉 +窪元 +窪内 +窪出 +窪利 +窪前 +窪北 +窪原 +窪口 +窪和久 +窪喜 +窪園 +窪土 +窪地 +窪坂 +窪垣内 +窪城 +窪堀 +窪塚 +窪多 +窪夛 +窪宮 +窪寺 +窪小谷 +窪尾 +窪山 +窪岡 +窪島 +窪崎 +窪嶋 +窪川 +窪川原 +窪庭 +窪徳 +窪木 +窪本 +窪村 +窪松 +窪森 +窪江 +窪池 +窪沢 +窪河 +窪津 +窪浦 +窪添 +窪澤 +窪瀬 +窪田 +窪畑 +窪目 +窪美 +窪薗 +窪薮 +窪藪 +窪西 +窪見 +窪谷 +窪道 +窪野 +窯屋 +窺 +竃 +竃土 +竃坂 +竃尾 +竃本 +竃浦 +竃淵 +竃渕 +竃窄 +竃谷 +竃門 +竈 +竈土 +竈本 +竈窄 +竈谷 +竈門 +立 +立ケ谷 +立テ +立上 +立下 +立中 +立丸 +立久井 +立久保 +立亀 +立井 +立会 +立位 +立住 +立作 +立倉 +立儀 +立元 +立光 +立入 +立具 +立内 +立円 +立冨 +立分 +立切 +立前 +立原 +立口 +立古 +立台 +立合 +立吉 +立吹 +立和 +立和名 +立和田 +立唐 +立喰 +立園 +立圓 +立土 +立地 +立坂 +立垣 +立堀 +立場 +立場川 +立塚 +立増 +立壁 +立子山 +立子川 +立富 +立小 +立小川 +立小路 +立小野 +立尾 +立居 +立居場 +立屋 +立屋敷 +立山 +立岡 +立岩 +立島 +立崎 +立嶋 +立川 +立川目 +立己 +立巳 +立幅 +立幣 +立平 +立床 +立座 +立延 +立志 +立成 +立所 +立掛 +立早 +立服 +立木 +立本 +立杉 +立村 +立松 +立枕 +立林 +立枝 +立枩 +立柄 +立柳 +立栄 +立根 +立桶 +立棒 +立森 +立橋 +立水 +立永 +立江 +立沢 +立河 +立泉 +立波 +立津 +立浜 +立浦 +立浪 +立海 +立溝 +立澤 +立濱 +立瀬 +立牧 +立用 +立田 +立町 +立畑 +立畠 +立白 +立盛 +立目 +立直 +立矢 +立石 +立磨 +立神 +立福 +立秋 +立穴 +立端 +立箱 +立美 +立羽 +立聞 +立能 +立脇 +立臺 +立臼 +立花 +立若 +立華 +立葉 +立蔵 +立薗 +立薮 +立藏 +立藤 +立藪 +立見 +立谷 +立貝 +立貞 +立賀 +立身 +立辺 +立辻 +立迫 +立通 +立道 +立邊 +立部 +立里 +立野 +立野井 +立野岡 +立錦 +立鍬 +立長 +立開 +立間 +立附 +立馬 +立髪 +立麻 +竒二 +竒山 +竒峯 +竒峰 +竒藤 +竜 +竜ケ江 +竜ノ口 +竜下 +竜中 +竜井 +竜元 +竜八 +竜原 +竜口 +竜味 +竜城 +竜堀 +竜塚 +竜室 +竜宮 +竜尾 +竜居 +竜山 +竜岡 +竜岩 +竜崎 +竜川 +竜己 +竜巳 +竜揖 +竜木 +竜本 +竜村 +竜林 +竜永 +竜江 +竜池 +竜沢 +竜河 +竜沼 +竜泉 +竜波 +竜波見 +竜淵 +竜渓 +竜渕 +竜澤 +竜田 +竜石 +竜神 +竜美 +竜腰 +竜興 +竜花 +竜見 +竜見地 +竜谷 +竜輪 +竜辺 +竜里 +竜野 +竜首 +竜鼻 +竝川 +竝木 +竝河 +竟野 +章本 +章田 +童子 +童銅 +竪 +竪元 +竪原 +竪場 +竪山 +竪岩 +竪岸 +竪川 +竪月 +竪木 +竪本 +竪村 +竪林 +竪田 +竪畑 +竪畠 +竪石 +竪谷 +竪道 +竪野 +端 +端下 +端中 +端井 +端保 +端倉 +端元 +端原 +端口 +端名 +端地 +端坂 +端坊 +端場 +端場上 +端山 +端岡 +端島 +端崎 +端川 +端慶村 +端戸 +端早田 +端木 +端本 +端村 +端根 +端森 +端橋 +端浄 +端浦 +端無 +端田 +端羽 +端詰 +端谷 +端近 +端迫 +端野 +端館 +竱廼 +竱迺 +競 +競馬 +竹 +竹の内 +竹の子 +竹の家 +竹の谷 +竹ケ原 +竹ケ端 +竹ケ鼻 +竹ノ上 +竹ノ下 +竹ノ中 +竹ノ井 +竹ノ入 +竹ノ内 +竹ノ子 +竹ノ家 +竹ノ山 +竹ノ本 +竹ノ株 +竹ノ畑 +竹ノ矢 +竹ノ脇 +竹ノ谷 +竹ノ鼻 +竹ム礼 +竹一 +竹万 +竹上 +竹下 +竹丘 +竹並 +竹中 +竹中島 +竹丸 +竹久 +竹久保 +竹之上 +竹之下 +竹之中 +竹之井 +竹之内 +竹之前 +竹之山 +竹之木進 +竹之熊 +竹之畑 +竹之矢 +竹之越 +竹之隈 +竹乗 +竹亀谷 +竹井 +竹亭 +竹今 +竹代 +竹仲 +竹位 +竹住 +竹佐 +竹保 +竹信 +竹俣 +竹倉 +竹備 +竹元 +竹光 +竹入 +竹内 +竹冨 +竹則 +竹前 +竹割 +竹勢 +竹北 +竹升 +竹半 +竹厚 +竹原 +竹原屋 +竹原崎 +竹原田 +竹又 +竹友 +竹口 +竹吉 +竹名 +竹味 +竹和 +竹囲 +竹国 +竹國 +竹園 +竹土井 +竹地 +竹坂 +竹坊 +竹垣 +竹垣内 +竹垰 +竹城 +竹埜 +竹埼 +竹堂 +竹堤 +竹場 +竹塚 +竹境 +竹増 +竹士 +竹外 +竹多 +竹夛 +竹大 +竹奥 +竹好 +竹子 +竹宇治 +竹守 +竹安 +竹宗 +竹定 +竹室 +竹宮 +竹家 +竹富 +竹射 +竹小路 +竹尻 +竹尾 +竹居 +竹居田 +竹屋 +竹屋江 +竹山 +竹岡 +竹岩 +竹岳 +竹岸 +竹峯 +竹峰 +竹島 +竹崎 +竹嵜 +竹嶋 +竹嶌 +竹巖 +竹川 +竹差 +竹巻 +竹市 +竹常 +竹平 +竹広 +竹庵 +竹廣 +竹延 +竹廷 +竹廻 +竹廻間 +竹弘 +竹当 +竹形 +竹徳山 +竹心 +竹志 +竹志田 +竹成 +竹戸 +竹房 +竹把 +竹折 +竹抜 +竹抱 +竹政 +竹日 +竹明 +竹春 +竹智 +竹木 +竹木田 +竹未 +竹末 +竹本 +竹杉 +竹村 +竹束 +竹条 +竹来 +竹松 +竹板 +竹林 +竹林地 +竹枝 +竹柴 +竹株 +竹根 +竹根沢 +竹根澤 +竹桝 +竹條 +竹森 +竹植 +竹樋 +竹橋 +竹次 +竹正 +竹武 +竹歳 +竹氏 +竹水 +竹永 +竹江 +竹池 +竹沖 +竹沢 +竹河 +竹河内 +竹治 +竹沼 +竹泉 +竹波 +竹洞 +竹津 +竹浜 +竹浦 +竹浪 +竹淵 +竹添 +竹清 +竹渓 +竹渕 +竹満 +竹溪 +竹澤 +竹濱 +竹瀬 +竹熊 +竹爪 +竹牟礼 +竹牟禮 +竹玄 +竹生 +竹生田 +竹田 +竹田原 +竹田津 +竹田谷 +竹由 +竹町 +竹畑 +竹留 +竹畠 +竹當 +竹益 +竹盛 +竹矢 +竹知 +竹石 +竹神 +竹科 +竹立 +竹竝 +竹端 +竹箇平 +竹節 +竹籔 +竹細 +竹綱 +竹網 +竹縄 +竹繁 +竹繩 +竹美 +竹股 +竹背 +竹能 +竹脇 +竹腰 +竹舎 +竹舛 +竹良 +竹芝 +竹花 +竹苗 +竹若 +竹茂 +竹荒 +竹華 +竹菱 +竹菴 +竹萬 +竹葉 +竹葢 +竹蒔 +竹蓋 +竹蔵 +竹薗 +竹薮 +竹藏 +竹藤 +竹藪 +竹虎 +竹行 +竹衛 +竹裏 +竹西 +竹見 +竹視 +竹角 +竹詰 +竹谷 +竹谷内 +竹貝 +竹貞 +竹財 +竹貫 +竹賀 +竹越 +竹路 +竹身 +竹輪 +竹辺 +竹辻 +竹迫 +竹迴間 +竹道 +竹達 +竹邉 +竹邊 +竹邑 +竹邨 +竹部 +竹郷 +竹鄭 +竹釆 +竹采 +竹里 +竹重 +竹野 +竹野々 +竹野上 +竹野下 +竹野井 +竹野入 +竹野内 +竹野原 +竹野谷 +竹鎗 +竹鑓 +竹長 +竹門 +竹間 +竹阪 +竹隈 +竹雀 +竹雅 +竹須 +竹馬 +竹駒 +竹高 +竹鶴 +竹鼻 +竺 +竺原 +竺土 +竺山 +竺川 +竺悟 +竺沙 +竺長 +竿 +竿下 +竿代 +竿先 +竿台 +竿尾 +竿山 +竿崎 +竿本 +竿浦 +竿漕 +竿田 +竿留 +竿谷 +竿野 +笆 +笈入 +笈原 +笈口 +笈川 +笈掛 +笈方 +笈木 +笈沼 +笈田 +笈西 +笊畑 +笋田 +笏本 +笑中 +笑原 +笑喜 +笑子 +笑迫 +笘 +笘ケ平 +笘下 +笘井 +笘原 +笘口 +笘尾 +笘居 +笘屋 +笘島 +笘川 +笘廣 +笘本 +笘澤 +笘篠 +笘米地 +笘見 +笘谷 +笘野 +笛 +笛井 +笛吹 +笛坂 +笛場 +笛岡 +笛川 +笛木 +笛本 +笛田 +笛至 +笛野 +笛野戸 +笠 +笠上 +笠下 +笠中 +笠丸 +笠井 +笠佐 +笠作 +笠倉 +笠光 +笠内 +笠利 +笠勝 +笠原 +笠合 +笠名 +笠告 +笠坊 +笠垣 +笠城 +笠場 +笠塚 +笠外 +笠宮 +笠家 +笠寺 +笠小 +笠尾 +笠居 +笠屋 +笠山 +笠岡 +笠島 +笠崎 +笠嶋 +笠嶌 +笠川 +笠工 +笠巻 +笠師 +笠平 +笠恒 +笠成 +笠戸 +笠折 +笠掛 +笠月 +笠木 +笠本 +笠杉 +笠村 +笠松 +笠柄 +笠柳 +笠根 +笠桐 +笠森 +笠次 +笠毛 +笠水 +笠水上 +笠永 +笠江 +笠沢 +笠沼 +笠波 +笠浦 +笠浪 +笠澄 +笠瀬 +笠無 +笠牟田 +笠生 +笠田 +笠町 +笠畑 +笠目 +笠矢 +笠石 +笠神 +笠立 +笠竹 +笠継 +笠置 +笠美 +笠羽 +笠脇 +笠舎 +笠舛 +笠舞 +笠茂 +笠蔦 +笠藤 +笠行 +笠西 +笠見 +笠谷 +笠貫 +笠越 +笠輪 +笠道 +笠野 +笠門 +笠間 +笠間屋 +笠飯 +笠高 +笠鬼 +笠鳥 +符名 +符坂 +符川 +符波 +符田 +符金 +符阪 +笨 +笪 +第十 +第新 +笹 +笹々谷 +笹ケ瀬 +笹ケ迫 +笹ノ内 +笹ノ間 +笹下 +笹中 +笹丸 +笹久保 +笹之内 +笹之池 +笹亀 +笹井 +笹亦 +笹代 +笹俣 +笹倉 +笹元 +笹光 +笹内 +笹冨 +笹出 +笹前 +笹原 +笹又 +笹反 +笹口 +笹古 +笹吉 +笹園 +笹土 +笹地 +笹垣 +笹垰 +笹城 +笹城戸 +笹埜 +笹堂 +笹場 +笹塚 +笹墳 +笹壁 +笹外 +笹子 +笹室 +笹家 +笹富 +笹尾 +笹屋 +笹山 +笹岑 +笹岡 +笹岸 +笹峯 +笹峰 +笹島 +笹崎 +笹嵜 +笹嶋 +笹嶺 +笹川 +笹巻 +笹布 +笹平 +笹弥 +笹形 +笹後 +笹掛 +笹方 +笹月 +笹木 +笹木原 +笹本 +笹村 +笹松 +笹林 +笹枝 +笹栗 +笹根 +笹森 +笹橋 +笹次 +笹気 +笹氣 +笹永 +笹江 +笹池 +笹沢 +笹河 +笹治 +笹沼 +笹波 +笹洞 +笹津 +笹浦 +笹浪 +笹淵 +笹渕 +笹渡 +笹源 +笹澤 +笹瀬 +笹熊 +笹生 +笹田 +笹男 +笹町 +笹畑 +笹盛 +笹目 +笹目子 +笹矢 +笹石 +笹硲 +笹竹 +笹羅 +笹股 +笹脇 +笹舘 +笹良 +笹艸 +笹花 +笹芳 +笹草 +笹葉 +笹薮 +笹藪 +笹裏 +笹西 +笹見 +笹記 +笹谷 +笹谷内 +笹貫 +笹賀 +笹越 +笹路 +笹辺 +笹近 +笹邉 +笹邊 +笹部 +笹重 +笹野 +笹野井 +笹野口 +笹金 +笹長 +笹間 +笹隈 +笹館 +笹香 +笹鹿 +笹鼻 +笽島 +筅 +筆 +筆井 +筆保 +筆内 +筆前 +筆口 +筆吉 +筆坂 +筆塚 +筆安 +筆宝 +筆山 +筆岡 +筆島 +筆崎 +筆本 +筆村 +筆林 +筆染 +筆氏 +筆永 +筆田 +筆矢 +筆脇 +筆谷 +筆野 +筈井 +筈元 +筈尾 +筈山 +筈木 +筈箕 +筈見 +筈谷 +等 +等々力 +等倉 +等力 +等岳 +等松 +等田 +等等力 +等農 +筋 +筋原 +筋川 +筋師 +筋本 +筋永 +筋浦 +筋瀬 +筋田 +筋箟 +筋篦 +筋誡 +筋野 +筋間 +筋頭 +筌元 +筌口 +筌場 +筌尾 +筌瀬 +筌野 +筏 +筏井 +筏場 +筏津 +筏谷 +筑 +筑下 +筑丸 +筑井 +筑元 +筑内 +筑前 +筑前屋 +筑前谷 +筑和 +筑土 +筑地 +筑坂 +筑城 +筑子 +筑尾 +筑山 +筑島 +筑川 +筑广 +筑後 +筑後谷 +筑摩 +筑木 +筑本 +筑村 +筑柴 +筑根 +筑比地 +筑治 +筑波 +筑浜 +筑濱 +筑瀬 +筑田 +筑磨 +筑紫 +筑紫秋 +筑網 +筑肱 +筑葉 +筑谷 +筑郷 +筑野 +筑間 +筑阪 +筒 +筒丸 +筒井 +筒前 +筒原 +筒口 +筒場 +筒塩 +筒威 +筒尾 +筒居 +筒屋 +筒山 +筒島 +筒崎 +筒嶋 +筒川 +筒木 +筒本 +筒水 +筒江 +筒沢 +筒治 +筒泉 +筒浦 +筒淵 +筒渕 +筒澤 +筒猪 +筒田 +筒石 +筒竹 +筒美 +筒見 +筒谷 +筒貫 +筒路 +筒野 +筒香 +筒馬 +筒鳥 +答島 +策 +筝田 +筥崎 +筥嵜 +筧 +筧下 +筧中 +筧口 +筧本 +筧爪 +筧田 +筧野 +筬 +筬井 +筬島 +筬嶋 +筬矢 +筬谷 +筬部 +筭 +筱 +筱原 +筱岡 +筱嵜 +筱生 +筱田 +筿原 +筿崎 +筿木 +箆伊 +箆津 +箒 +箒山 +箔井 +箔本 +箔谷 +箕 +箕ノ口 +箕下 +箕中 +箕井 +箕作 +箕倉 +箕内 +箕原 +箕口 +箕土路 +箕尾 +箕屋 +箕山 +箕岡 +箕島 +箕崎 +箕嶋 +箕川 +箕底 +箕延 +箕形 +箕成 +箕手 +箕打 +箕曲 +箕本 +箕村 +箕林 +箕桝 +箕沢 +箕浦 +箕澤 +箕牧 +箕田 +箕畑 +箕矢 +箕笹 +箕箸 +箕脇 +箕腰 +箕臼 +箕葉 +箕裏 +箕西 +箕谷 +箕越 +箕輪 +箕輪田 +箕迫 +箕造 +箕部 +箕野 +箕面 +箕面崎 +箕面嵜 +算 +算旭 +算用子 +箙 +箙瀬 +箟 +箟林 +管 +管ケ谷 +管井 +管付 +管内 +管原 +管又 +管埜 +管家 +管尾 +管山 +管岡 +管島 +管崎 +管川 +管惣 +管成 +管戸 +管木 +管本 +管村 +管東 +管林 +管根 +管毛 +管沢 +管河 +管沼 +管波 +管浪 +管渓 +管澤 +管生 +管田 +管納 +管能 +管藤 +管見 +管谷 +管部 +管野 +管長 +管間 +箭中 +箭井 +箭代 +箭内 +箭原 +箭吹 +箭子 +箭島 +箭崎 +箭川 +箭引 +箭木 +箭本 +箭柄 +箭柏 +箭波 +箭浪 +箭田 +箭田川 +箭竹 +箭筈 +箭野 +箭頭 +箱 +箱上 +箱丸 +箱井 +箱卸 +箱司 +箱守 +箱宮 +箱家 +箱山 +箱岡 +箱岩 +箱島 +箱崎 +箱嶋 +箱嶌 +箱川 +箱木 +箱本 +箱林 +箱柳 +箱根 +箱棟 +箱森 +箱江 +箱沢 +箱瀬 +箱田 +箱石 +箱舘 +箱谷 +箱部 +箱館 +箸 +箸中 +箸塚 +箸尾 +箸尾谷 +箸屋 +箸方 +箸本 +箸片 +箸蔵 +箸野 +箸間 +箼 +節 +節丸 +節原 +節句田 +節和 +節安 +節家 +節島 +節川 +節政 +節木 +節田 +節見 +節賀 +節野 +篁 +篁園 +範 +範国 +範國 +範多 +範実 +範岡 +範岳 +範本 +範浄 +範淨 +範田 +範重 +篇原 +築 +築井 +築井山 +築保 +築出 +築切 +築別 +築原 +築園 +築地 +築地原 +築地新 +築坂 +築城 +築家 +築尾 +築山 +築岡 +築島 +築崎 +築嶋 +築後 +築後谷 +築摩 +築木 +築本 +築村 +築林 +築柴 +築根 +築森 +築樋 +築橋 +築比地 +築永 +築池 +築沢 +築波 +築添 +築澤 +築瀬 +築田 +築留 +築磨 +築穴 +築紫 +築羽 +築肱 +築舘 +築花 +築茂 +築藤 +築谷 +築貞 +築貫 +築道 +築達 +築部 +築野 +築間 +築館 +篙 +篝 +篝山 +篠 +篠ケ沢 +篠ケ澤 +篠ケ瀬 +篠ケ谷 +篠上 +篠下 +篠丸 +篠之井 +篠井 +篠住 +篠倉 +篠儀 +篠元 +篠内 +篠前 +篠北 +篠原 +篠又 +篠口 +篠地 +篠坂 +篠垣 +篠埜 +篠埼 +篠場 +篠塚 +篠壁 +篠子 +篠宮 +篠尾 +篠山 +篠岡 +篠島 +篠崎 +篠嵜 +篠嶋 +篠川 +篠巻 +篠平 +篠後 +篠戸 +篠木 +篠本 +篠村 +篠林 +篠栗 +篠根 +篠森 +篠永 +篠江 +篠池 +篠沢 +篠河 +篠沼 +篠津 +篠浦 +篠浪 +篠澤 +篠瀬 +篠熊 +篠爪 +篠生 +篠田 +篠町 +篠畑 +篠目 +篠矢 +篠窪 +篠端 +篠竹 +篠笛 +篠笥 +篠笹 +篠置 +篠脇 +篠花 +篠葉 +篠藤 +篠見 +篠谷 +篠賀 +篠辺 +篠遠 +篠邉 +篠邊 +篠邨 +篠部 +篠郷 +篠野 +篠間 +篠隈 +篤 +篤子 +篤山 +篤岡 +篤川 +篤本 +篤永 +篤田 +篤美 +篦伊 +篦津 +篩谷 +篭 +篭井 +篭作 +篭倉 +篭利 +篭原 +篭味 +篭場 +篭宅 +篭宮 +篭尾 +篭居 +篭屋 +篭山 +篭島 +篭崎 +篭嶋 +篭嶌 +篭川 +篭巻 +篭戸 +篭手田 +篭本 +篭林 +篭橋 +篭池 +篭沢 +篭浦 +篭渡 +篭滝 +篭瀬 +篭生 +篭田 +篭畑 +篭見 +篭谷 +篭重 +篭野 +篰 +篷郷 +簀山 +簀戸 +簀河原 +簀田 +簏 +簏崎 +簏谷 +簑 +簑下 +簑内 +簑原 +簑口 +簑和 +簑和田 +簑城 +簑妻 +簑屋 +簑岡 +簑島 +簑崎 +簑嶋 +簑川 +簑手 +簑木 +簑本 +簑村 +簑毛 +簑洞 +簑津 +簑浦 +簑添 +簑牟田 +簑田 +簑羽 +簑茂 +簑葉 +簑藁田 +簑谷 +簑輪 +簑部 +簓 +簔 +簔原 +簔口 +簔和 +簔和田 +簔城 +簔宮 +簔島 +簔毛 +簔浦 +簔田 +簔谷 +簔輪 +簗 +簗井 +簗取 +簗口 +簗地 +簗場 +簗塲 +簗島 +簗崎 +簗嶋 +簗川 +簗木 +簗本 +簗浦 +簗瀬 +簗田 +簗脇 +簗詰 +簗谷 +簗迫 +簗部 +簡 +簡牛 +簡田 +簡野 +簡鳥 +簣 +簱本 +簱江 +簸川角 +簾 +簾内 +簾坂 +簾尾 +簾田 +簾畑 +簾編 +簾藤 +簾谷 +簾野 +簾長 +簿井 +籃谷 +籅谷 +籌 +籏 +籏中 +籏先 +籏原 +籏垣 +籏埜 +籏屋 +籏山 +籏岡 +籏島 +籏崎 +籏手 +籏持 +籏智 +籏本 +籏武 +籏江 +籏瀬 +籏生 +籏町 +籏知 +籏礼 +籏福 +籏禮 +籏谷 +籏野 +籏鉾 +籐 +籐乗 +籐乘 +籐内 +籐原 +籐堂 +籐尾 +籐山 +籐後 +籐敦 +籐本 +籐社 +籐舛 +籐部 +籐間 +籔 +籔ケ崎 +籔上 +籔下 +籔中 +籔之内 +籔亀 +籔井 +籔仲 +籔元 +籔内 +籔出 +籔原 +籔口 +籔地 +籔垣 +籔堀 +籔塚 +籔岸 +籔島 +籔崎 +籔嶒 +籔川 +籔押 +籔木 +籔本 +籔林 +籔根 +籔植 +籔淵 +籔添 +籔渕 +籔田 +籔端 +籔脇 +籔腰 +籔花 +籔裏 +籔見 +籔谷 +籔越 +籔野 +籔馬 +籠 +籠井 +籠倉 +籠利 +籠原 +籠味 +籠場 +籠宅 +籠宮 +籠家 +籠尾 +籠屋 +籠山 +籠島 +籠崎 +籠嶋 +籠嶌 +籠川 +籠戸 +籠手 +籠手田 +籠本 +籠村 +籠林 +籠橋 +籠池 +籠沢 +籠波 +籠浦 +籠渡 +籠滝 +籠澤 +籠瀬 +籠生 +籠田 +籠畑 +籠目 +籠見 +籠谷 +籠重 +籠野 +籬 +米 +米々沢 +米々澤 +米ケ田 +米ケ谷 +米ノ井 +米一 +米上 +米下 +米世 +米丘 +米中 +米丸 +米久 +米久保 +米久田 +米井 +米今 +米代 +米住 +米倉 +米元 +米光 +米入 +米内 +米内口 +米内山 +米内沢 +米冨 +米出 +米分 +米加田 +米勢 +米北 +米升 +米原 +米又 +米口 +米司 +米吉 +米和 +米咲 +米園 +米地 +米坂 +米垣 +米城 +米埜 +米埼 +米堂 +米塚 +米増 +米多 +米多比 +米夛 +米奥 +米女 +米好 +米子 +米守 +米安 +米家 +米富 +米尾 +米屋 +米山 +米岡 +米岸 +米峰 +米島 +米崎 +米嵜 +米嵩 +米嶋 +米嶌 +米川 +米平 +米広 +米庄 +米座 +米廣 +米延 +米弥 +米徳 +米戸 +米所 +米持 +米替 +米月 +米望 +米木 +米木津 +米本 +米杉 +米村 +米来 +米松 +米林 +米枡 +米根 +米桝 +米森 +米椿 +米橋 +米次 +米正 +米氏 +米水 +米永 +米江 +米沢 +米沢屋 +米沢谷 +米沼 +米泉 +米波 +米津 +米浜 +米浦 +米浪 +米涌 +米渓 +米湊 +米満 +米溪 +米滿 +米澄 +米澤 +米澤谷 +米濱 +米瀬 +米玉利 +米生 +米田 +米由 +米町 +米畑 +米留 +米白 +米益 +米盛 +米矢 +米石 +米神 +米福 +米積 +米窪 +米竹 +米納 +米納津 +米脇 +米舛 +米良 +米花 +米茂 +米華 +米萩 +米蒸 +米蔵 +米薗 +米藏 +米藤 +米虫 +米衛 +米衞 +米谷 +米賀多 +米賀田 +米辻 +米近 +米迫 +米通 +米道 +米部 +米里 +米重 +米野 +米野井 +米金 +米長 +米門 +米阪 +米陀 +米隅 +米須 +米須賀 +米頭 +米餅 +米麦 +米𡌛 +籾 +籾下 +籾井 +籾倉 +籾内 +籾原 +籾垣 +籾実 +籾實 +籾居 +籾山 +籾岡 +籾木 +籾本 +籾永 +籾江 +籾浦 +籾田 +籾蔵 +籾藏 +籾谷 +籾迫 +粂 +粂井 +粂内 +粂原 +粂地 +粂山 +粂岡 +粂崎 +粂川 +粂本 +粂橋 +粂沢 +粂澤 +粂田 +粂谷 +粂野 +粉吉 +粉名内 +粉奈 +粉室 +粉家 +粉山 +粉川 +粉川谷 +粉引 +粉河 +粉生 +粉究 +粉谷 +粉間 +粒來 +粒山 +粒崎 +粒木 +粒来 +粒楽 +粒田 +粒羅 +粒耒 +粒良 +粒見 +粒谷 +粒針 +粕井 +粕加屋 +粕壁 +粕尾 +粕屋 +粕山 +粕川 +粕張 +粕本 +粕江 +粕淵 +粕渕 +粕田 +粕谷 +粕賀 +粕野 +粗 +粟 +粟ケ森 +粟ケ窪 +粟下 +粟井 +粟佐 +粟倉 +粟元 +粟内 +粟冠 +粟原 +粟国 +粟國 +粟地 +粟坂 +粟埜 +粟塚 +粟多 +粟子 +粟宮 +粟家 +粟尾 +粟屋 +粟山 +粟岡 +粟島 +粟崎 +粟嶋 +粟嶌 +粟座 +粟戸 +粟木 +粟木原 +粟本 +粟村 +粟林 +粟栄 +粟根 +粟森 +粟次 +粟江 +粟沢 +粟河 +粟津 +粟津原 +粟津谷 +粟澤 +粟瀬 +粟生 +粟生屋 +粟生山 +粟生木 +粟生田 +粟田 +粟田口 +粟畑 +粟盛 +粟窪 +粟竹 +粟納 +粟蔵 +粟藏 +粟谷 +粟賀 +粟賀見 +粟路 +粟辻 +粟重 +粟野 +粟野原 +粟飯原 +粟飯島 +粠田 +粢 +粢田 +粥塚 +粥川 +粥米 +粥見 +粧 +粧田 +粭田 +粱根 +粳田 +粳賀 +粳間 +粶 +粷谷 +粽 +粽田 +精 +精元大 +精園 +精山 +精島 +精嶋 +精広 +精廣 +精廬 +精松 +精田 +精盧 +精舎 +精進 +糀 +糀元 +糀原 +糀場 +糀屋 +糀本 +糀田 +糀畑 +糀矢 +糀谷 +糀野 +糊 +糊井 +糊倉 +糊田 +糊谷 +糒 +糖信 +糖塚 +糖田 +糖谷 +糖野 +糝木 +糟 +糟井 +糟壁 +糟尾 +糟屋 +糟川 +糟江 +糟淵 +糟渕 +糟田 +糟谷 +糟貝 +糟野 +糠 +糠信 +糠加 +糠坂 +糠塚 +糠屋 +糠山 +糠川 +糠本 +糠村 +糠森 +糠沢 +糠澤 +糠田 +糠盛 +糠見 +糠谷 +糠賀 +糠野 +糦須海 +糯原 +糯田 +糯畑 +糴川 +糸 +糸中 +糸久 +糸乗 +糸乘 +糸井 +糸井川 +糸儀 +糸入 +糸勝 +糸原 +糸口 +糸園 +糸坂 +糸坪 +糸塚 +糸多 +糸尾 +糸居 +糸屋 +糸山 +糸岐 +糸岡 +糸島 +糸崎 +糸嶺 +糸川 +糸州 +糸巻 +糸平 +糸我 +糸戸崎 +糸房 +糸数 +糸數 +糸日 +糸日谷 +糸曽 +糸木 +糸本 +糸杉 +糸村 +糸林 +糸柳 +糸桜 +糸森 +糸櫻 +糸毛 +糸氏 +糸永 +糸沢 +糸洌 +糸洲 +糸浜 +糸浴 +糸海 +糸満 +糸滿 +糸澤 +糸濱 +糸瀬 +糸生 +糸田 +糸田川 +糸畑 +糸目 +糸矢 +糸石 +糸稲 +糸納 +糸総 +糸總 +糸繰 +糸藤 +糸見 +糸谷 +糸賀 +糸部 +糸里 +糸野 +糸金 +糸長 +糸雅 +糸鬢 +糸魚川 +糺 +糺地 +糺谷 +系 +系井 +系良 +系谷 +系野 +紀 +紀の川 +紀ノ上 +紀ノ国 +紀ノ国谷 +紀ノ國 +紀ノ國谷 +紀ノ定 +紀ノ岡 +紀ノ崎 +紀ノ川 +紀ノ本 +紀ノ村 +紀三井 +紀中 +紀乃 +紀之内 +紀之国 +紀之國 +紀之定 +紀之岡 +紀之崎 +紀之本 +紀井 +紀仲 +紀伊 +紀伊元 +紀伊国 +紀伊国屋 +紀伊国谷 +紀伊國 +紀伊國谷 +紀伊埜本 +紀伊川 +紀伊野 +紀伊馬 +紀元 +紀先 +紀内 +紀原 +紀古 +紀司 +紀和 +紀国 +紀国谷 +紀國 +紀國谷 +紀坂 +紀埜 +紀太 +紀室 +紀寺 +紀屋敷 +紀山 +紀岡 +紀島 +紀川 +紀州 +紀州本 +紀州谷 +紀平 +紀成 +紀戸 +紀本 +紀村 +紀氏 +紀洲 +紀洲谷 +紀熊 +紀田 +紀納 +紀藤 +紀見 +紀谷 +紀部 +紀野 +紀野国 +紀野國 +紀野川 +紀野本 +紀野田 +紀陸 +約仕 +紅 +紅井 +紅出 +紅呉 +紅坂 +紅家 +紅屋 +紅山 +紅川 +紅床 +紅本 +紅村 +紅松 +紅林 +紅梅 +紅楳 +紅沢 +紅浦 +紅澤 +紅瀬 +紅田 +紅盛 +紅矢 +紅粉 +紅粉谷 +紅花 +紅葉 +紅葉谷 +紅藤 +紅蛇 +紅谷 +紅邑 +紅野 +紅露 +紋坂 +紋川 +紋波 +紋田 +紋羽 +紋谷 +紋野 +紋間 +紋阪 +納 +納上 +納代 +納元 +納冨 +納原 +納口 +納土 +納城 +納堂 +納塚 +納多 +納夢 +納家 +納富 +納屋 +納屋内 +納屋敷 +納山 +納島 +納崎 +納庄 +納心 +納戸 +納所 +納本 +納村 +納橋 +納江 +納沢 +納瀬 +納生 +納田 +納留 +納籐 +納米 +納蔵 +納藤 +納見 +納谷 +納賀 +納身 +納部 +納野 +紐本 +紐野 +純 +純丘 +純岡 +純浦 +純田 +純空 +紙 +紙ノ原 +紙上 +紙下 +紙中 +紙丸 +紙井 +紙元 +紙原 +紙合 +紙名 +紙地 +紙坂 +紙塚 +紙子 +紙家 +紙尾 +紙居 +紙屋 +紙山 +紙岡 +紙島 +紙崎 +紙川 +紙広 +紙徳 +紙戸 +紙手 +紙本 +紙村 +紙枝 +紙森 +紙永 +紙江 +紙沢 +紙浦 +紙添 +紙漉 +紙澤 +紙田 +紙矢 +紙西 +紙谷 +紙谷畑 +紙迫 +紙透 +紙重 +紙野 +級久保 +級木 +素 +素保 +素利 +素原 +素和 +素宮 +素山 +素崎 +素川 +素木 +素本 +素村 +素栗 +素根 +素水 +素波 +素田 +素羅 +素花 +素谷 +素輪 +素都 +素野 +素麺 +紡車 +紡車田 +索手 +紣川 +紣谷 +紫 +紫乃 +紫倉 +紫冨田 +紫前 +紫加田 +紫原 +紫合 +紫和 +紫垣 +紫安 +紫富田 +紫尾 +紫尾田 +紫屋 +紫山 +紫島 +紫崎 +紫川 +紫引 +紫摩 +紫木 +紫村 +紫桃 +紫波 +紫牟田 +紫生田 +紫田 +紫竹 +紫芝 +紫花 +紫葉 +紫藤 +紫谷 +紫野 +紫関 +紫雲 +紬 +細 +細ケ谷 +細上 +細下 +細中 +細丸 +細久保 +細井 +細井戸 +細住 +細倉 +細元 +細光 +細入 +細内 +細割 +細勢 +細包 +細原 +細口 +細合 +細名 +細呂木 +細呂木谷 +細国 +細國 +細園 +細土 +細地 +細坂 +細坪 +細垣 +細垰 +細埜 +細堀 +細場 +細字 +細家 +細小路 +細尻 +細尾 +細居 +細屋 +細屋敷 +細山 +細山田 +細岡 +細岸 +細峠 +細峪 +細島 +細崎 +細嶋 +細川 +細工 +細工屋 +細工藤 +細工谷 +細布 +細平 +細広 +細径 +細戸 +細掘 +細木 +細木原 +細末 +細本 +細杉 +細村 +細杖 +細束 +細東 +細松 +細柳 +細根 +細梅 +細森 +細樅 +細橋 +細機 +細水 +細永 +細江 +細江川 +細池 +細沖 +細沢 +細河 +細沼 +細波 +細洞 +細津 +細浜 +細浦 +細浪 +細海 +細淵 +細渓 +細渕 +細溝 +細溪 +細澤 +細濱 +細瀧 +細瀬 +細物 +細狩 +細田 +細町 +細界 +細畑 +細畠 +細目 +細矢 +細石 +細砂 +細磨 +細窪 +細竹 +細糸 +細美 +細羽 +細羽見 +細脇 +細萱 +細葉 +細薗 +細藤 +細西 +細見 +細谷 +細谷地 +細貝 +細越 +細越山 +細越沢 +細越澤 +細路 +細身 +細辻 +細迫 +細道 +細部 +細郷 +細里 +細野 +細野谷 +細金 +細長 +細間 +細馬 +細高 +紹慶 +紹田 +紹美 +紺 +紺ノ +紺一 +紺一向 +紺上 +紺世 +紺乃 +紺井 +紺元 +紺原 +紺地 +紺堂 +紺多 +紺孝 +紺家 +紺屋 +紺屋囿 +紺屋園 +紺屋島 +紺屋嶋 +紺屋本 +紺屋町 +紺山 +紺岡 +紺島 +紺崎 +紺川 +紺座 +紺戸 +紺掻 +紺木 +紺本 +紺村 +紺沢 +紺清 +紺渡 +紺澤 +紺田 +紺矢 +紺社 +紺箭 +紺羽 +紺藤 +紺谷 +紺迫 +紺道 +紺野 +紺阪 +紺頼 +紿田 +終夜 +組 +組原 +組口 +組地 +組坂 +組屋 +組山 +組岡 +組岳 +組島 +組崎 +組嶽 +組木 +組本 +組村 +組東 +組橋 +組永 +組沢 +組河原 +組澤 +組田 +組登 +組脇 +組藤 +組谷 +組野 +組頭 +絆地 +絈 +絈井 +絈山 +絈沢 +絈谷 +絈野 +絋 +経 +経ケ坂 +経ケ阪 +経亀 +経元 +経免 +経国 +経堂 +経塚 +経女 +経山 +経岩 +経島 +経崎 +経広 +経廣 +経徳 +経明 +経本 +経森 +経沢 +経澤 +経田 +経盛 +経石 +経種 +経藤 +経谷 +経遠 +経隆 +結 +結南 +結城 +結城山 +結多 +結家 +結岡 +結島 +結崎 +結川 +結木 +結束 +結松 +結柴 +結田 +結石 +結笹 +結細 +結綿 +結緑 +結縁 +結縄 +結繩 +結解 +結速 +結野 +絞張 +絞結 +絞谷 +絞野 +給下 +給分 +給前 +給田 +給野 +統場 +統島 +絲原 +絲屋 +絲山 +絲川 +絵ノ沢 +絵ノ澤 +絵上 +絵内 +絵原 +絵図 +絵堂 +絵島 +絵川 +絵幡 +絵戸 +絵所 +絵本 +絵村 +絵東 +絵柳 +絵沢 +絵畑 +絵矢 +絵谷 +絵野 +絵野沢 +絵野澤 +絵門 +絵面 +絵馬 +絵鳩 +絹 +絹下 +絹中 +絹井 +絹傘 +絹内 +絹原 +絹和 +絹山 +絹岡 +絹崎 +絹川 +絹巻 +絹引 +絹張 +絹掛 +絹木 +絹本 +絹村 +絹沢 +絹漉 +絹澤 +絹田 +絹畠 +絹石 +絹笠 +絹脇 +絹見 +絹谷 +絹輪 +絹野 +絹針 +綏坂 +綏田 +經 +經堂 +經塚 +經廣 +經澤 +經田 +經種 +經遠 +継 +継丘 +継原 +継国 +継宮 +継山 +継岡 +継岩 +継木 +継本 +継松 +継枝 +継田 +継石 +継谷 +継辺 +継野 +続 +続子 +続宗 +続山 +続木 +続橋 +続池 +続田 +続石 +続米 +続葛 +続谷 +続麻 +綛 +綛井 +綛元 +綛屋 +綛山 +綛本 +綛村 +綛田 +綛谷 +綛野 +綜村 +綟川 +綣熊 +維摩 +維田 +綱 +綱上 +綱下 +綱中 +綱井 +綱代 +綱倉 +綱元 +綱兼 +綱内 +綱出 +綱分 +綱切 +綱取 +綱場 +綱宮 +綱尾 +綱屋 +綱山 +綱岡 +綱岸 +綱島 +綱崎 +綱嶋 +綱嶌 +綱川 +綱師本 +綱干 +綱引 +綱影 +綱手 +綱掛 +綱木 +綱本 +綱村 +綱森 +綱永 +綱沢 +綱河 +綱淵 +綱渕 +綱澤 +綱瀬 +綱田 +綱目 +綱脇 +綱藤 +綱谷 +綱野 +綱頭 +網 +網中 +網井 +網代 +網代木 +網仲 +網倉 +網元 +網内 +網切 +網原 +網口 +網台地 +網地 +網城 +網埜 +網塚 +網守 +網家 +網尾 +網屋 +網岡 +網岸 +網島 +網崎 +網嵜 +網嶋 +網川 +網師 +網師本 +網師野 +網干 +網広 +網廣 +網引 +網戸 +網打 +網掛 +網敷 +網木 +網本 +網村 +網林 +網根 +網森 +網永 +網江 +網沢 +網治 +網津 +網浜 +網浦 +網渕 +網澤 +網濱 +網田 +網盛 +網矢 +網籐 +網蔵 +網藏 +網藤 +網谷 +網重 +網野 +網頭 +綴 +綴喜 +綴木 +綴橋 +綶 +綷川 +綷谷 +綺田 +綽 +綾 +綾乃小路 +綾乃里 +綾井 +綾仁 +綾具 +綾原 +綾口 +綾園 +綾地 +綾坂 +綾垣 +綾城 +綾塔 +綾塚 +綾女 +綾子 +綾小路 +綾尾 +綾屋 +綾島 +綾川 +綾戸 +綾木 +綾本 +綾村 +綾森 +綾澤 +綾瀬 +綾田 +綾目 +綾織 +綾美 +綾羽 +綾藤 +綾西 +綾見 +綾谷 +綾路 +綾辺 +綾邉 +綾邊 +綾部 +綾野 +綾間 +綾香 +緇子 +緇川 +緇荘 +緇莊 +緇門 +緋山 +緋本 +緋田 +総三 +総山 +総島 +総崎 +総村 +総根 +総毛 +総田 +総見 +総領 +総麹 +緑 +緑上 +緑原 +緑埜 +緑山 +緑川 +緑松 +緑樹 +緑毛 +緑河 +緑田 +緑谷 +緑野 +緑門 +緑間 +緒佐島 +緒勝 +緒坂 +緒垣 +緒家 +緒島 +緒崎 +緒嶋 +緒川 +緒座 +緒形 +緒志 +緒方 +緒明 +緒本 +緒林 +緒橋 +緒河 +緒環 +緒田 +緒田原 +緒畑 +緒続 +緒續 +緒良中 +緒花 +緒賀 +緒車 +緒里 +緒野 +線崎 +締川 +締木 +締次 +緤 +編塚 +編木 +編沢 +編澤 +編田 +編笠屋 +緩利 +緩詰 +緩鹿 +練 +練兼 +練合 +練子 +練尾 +練木 +練生川 +練田 +練石 +練苧 +練谷 +練間 +練馬 +練鼻 +縁 +縁光 +縁山 +縁川 +縁本 +縁田 +縁筵 +縁莚 +縁記 +縁谷 +縄 +縄中 +縄井 +縄倉 +縄卷 +縄司 +縄吉 +縄岡 +縄島 +縄崎 +縄嵜 +縄嶋 +縄川 +縄巻 +縄平 +縄手 +縄本 +縄村 +縄江 +縄瀬 +縄田 +縄田屋 +縄稚 +縄竹 +縄舟 +縄舩 +縄船 +縄谷 +縄迫 +縄重 +縄野 +縄間 +縄馬 +縞居 +縞本 +縞田 +縞谷 +縣 +縣内 +縣山 +縣島 +縣橋 +縣田 +縣詰 +縦山 +縨岩 +縫 +縫原 +縫山 +縫島 +縫嶋 +縫川 +縫村 +縫殿 +縫田 +縫谷 +縫部 +縫采 +縫野 +縫針 +縬屋 +縮 +縮井 +縮谷 +縵沢 +縹 +總山 +總崎 +總田 +總領 +績 +繁 +繁下 +繁中 +繁井 +繁住 +繁保 +繁信 +繁倉 +繁元 +繁光 +繁内 +繁冨 +繁原 +繁友 +繁吉 +繁名 +繁国 +繁國 +繁在家 +繁地 +繁多 +繁好 +繁安 +繁宗 +繁定 +繁実 +繁宮 +繁家 +繁富 +繁實 +繁尾 +繁山 +繁岡 +繁崎 +繁平 +繁延 +繁張 +繁成 +繁戸 +繁政 +繁昌 +繁木 +繁本 +繁村 +繁松 +繁桝 +繁森 +繁水 +繁永 +繁沢 +繁治 +繁泉 +繁浦 +繁浪 +繁澤 +繁田 +繁畑 +繁益 +繁盛 +繁石 +繁竹 +繁縄 +繁繩 +繁芸 +繁藝 +繁藤 +繁行 +繁見 +繁谷 +繁道 +繁里 +繁野 +繁野谷 +繁高 +繋 +繋馬 +織 +織丸 +織井 +織作 +織元 +織内 +織原 +織口 +織名 +織地 +織坂 +織壁 +織多 +織奥 +織家 +織尾 +織居 +織屋 +織山 +織岡 +織島 +織川 +織平 +織恵 +織戸 +織掛 +織方 +織本 +織林 +織橋 +織毛 +織江 +織田 +織田倉 +織田原 +織田大原 +織田島 +織田嶋 +織田村 +織田桐 +織田沢 +織田澤 +織畑 +織畠 +織立 +織笠 +織繊芸 +織羽 +織茂 +織衛 +織裳 +織谷 +織辺 +織邊 +織部 +織野 +織金 +織間 +織附 +繖 +繩 +繩井 +繩倉 +繩岡 +繩島 +繩嶋 +繩巻 +繩手 +繩本 +繩村 +繩江 +繩田 +繩田屋 +繩稚 +繩竹 +繩谷 +繩重 +繩野 +繪上 +繪内 +繪原 +繪堂 +繪島 +繪川 +繪幡 +繪所 +繪本 +繪柳 +繪澤 +繪畑 +繪谷 +繪野 +繪野澤 +繪面 +繪鳩 +繭山 +繰 +繰井 +繰生 +繰納 +繰菅 +繰谷 +繼 +繼國 +續 +續子 +續宗 +續山 +續木 +續橋 +續池 +續田 +續石 +續米 +續谷 +續麻 +纐結 +纐纈 +纓坂 +纓片 +纓田 +缶 +罇 +罍 +罟谷 +置 +置名 +置地 +置塩 +置山 +置本 +置村 +置栖 +置田 +置石 +置鮎 +羅田 +美 +美ノ上 +美ノ本 +美ノ谷 +美ノ輪 +美ノ辺 +美ノ邊 +美㘴 +美上 +美世 +美世尾 +美並 +美久月 +美久羅 +美之上 +美之口 +美之浦 +美井 +美井野 +美仁 +美仙 +美代 +美代取 +美代川 +美住 +美佐 +美佐保 +美佐志 +美佐木 +美佐田 +美作 +美保 +美入 +美内 +美前 +美勢 +美原 +美又 +美取 +美口 +美吉 +美吉田 +美名口 +美名川 +美呂津 +美和 +美和田 +美咲 +美喜 +美国 +美國 +美園 +美土路 +美坂 +美坐 +美堂 +美多 +美多賀鼻 +美奈 +美奈井 +美奈川 +美女平 +美好 +美宅 +美安 +美富 +美寺 +美尚 +美尾 +美尾谷 +美尾野 +美山 +美岡 +美島 +美崎 +美嶋 +美川 +美差 +美市川 +美平 +美幸 +美底 +美座 +美延 +美弥 +美志 +美恵 +美戸 +美才治 +美摩 +美斉津 +美斎津 +美旗 +美明 +美智 +美曹 +美曽作 +美曽谷 +美曾作 +美木 +美本 +美村 +美松 +美林 +美柑 +美柳 +美根 +美桃 +美棲 +美正 +美水 +美沢 +美河 +美沼 +美泉 +美波 +美津 +美津口 +美津島 +美津濃 +美津馬 +美浜 +美浦 +美浪 +美淋 +美添 +美潮 +美澄 +美澤 +美濃 +美濃井 +美濃出 +美濃原 +美濃又 +美濃口 +美濃和 +美濃地 +美濃垣 +美濃子谷 +美濃尾 +美濃屋 +美濃山 +美濃岡 +美濃島 +美濃崎 +美濃嶋 +美濃川 +美濃本 +美濃村 +美濃林 +美濃毛 +美濃津 +美濃浦 +美濃瀬 +美濃田 +美濃羽 +美濃谷 +美濃越 +美濃輪 +美濃辺 +美濃邉 +美濃邊 +美濃部 +美濱 +美玉 +美王 +美甘 +美田 +美田村 +美田野 +美畄町 +美留町 +美登 +美登路 +美矢 +美祢 +美禰 +美籏 +美籐 +美納 +美素 +美細津 +美總穗 +美育 +美能 +美能田 +美舟 +美舩 +美船 +美良山 +美若 +美荘 +美蔦 +美藤 +美蘭田 +美行 +美裏 +美見 +美記 +美誉志 +美談 +美譽志 +美谷 +美谷島 +美谷嶋 +美谷添 +美谷脇 +美貴 +美越 +美路 +美輪 +美農 +美農井 +美農谷 +美辺 +美通 +美遠 +美邉 +美邊 +美那元 +美那川 +美郷 +美里 +美野 +美野口 +美野川 +美野本 +美野田 +美野谷 +美野輪 +美野部 +美録 +美間 +美間坂 +美阪 +美除 +美須 +美頭 +美馬 +美馬本 +美鳥 +美鴨 +美麗 +美麻 +美齊津 +美齋津 +群 +群上 +群司 +群地 +群居 +群山 +群川 +群田 +群贅 +群馬 +群高松 +義 +義ト +義丁 +義中 +義久 +義之 +義井 +義仲 +義倉 +義元 +義光 +義兼 +義則 +義原 +義友 +義名 +義国 +義國 +義城 +義基 +義墳 +義始 +義宮 +義家 +義富 +義尾 +義居 +義山 +義岡 +義崎 +義嶋 +義川 +義常 +義干 +義平 +義広 +義志 +義忠 +義政 +義木 +義末 +義本 +義村 +義松 +義栄 +義根 +義森 +義武 +義水 +義永 +義江 +義沖 +義沢 +義河 +義浦 +義満 +義源 +義澤 +義煎 +義田 +義盛 +義積 +義経 +義經 +義若 +義藤 +義見 +義談 +義財 +義農 +義道 +義達 +義那 +義野 +義金 +義長 +義間 +義高 +義鷹 +羯磨 +羽ケ崎 +羽上 +羽上田 +羽下 +羽世田 +羽中 +羽中田 +羽二塚 +羽二木 +羽二生 +羽井 +羽井佐 +羽井田 +羽井野 +羽仁 +羽仏 +羽代 +羽伐 +羽住 +羽佐 +羽佐古 +羽佐田 +羽佐間 +羽佛 +羽佳 +羽倉 +羽儀 +羽入 +羽入田 +羽兼 +羽冨 +羽出 +羽出場 +羽出山 +羽出木 +羽出重 +羽切 +羽刕 +羽利 +羽劦 +羽勢 +羽原 +羽取 +羽口 +羽古井 +羽合 +羽吉 +羽名 +羽向 +羽吹 +羽咋 +羽喰 +羽土 +羽地 +羽坂 +羽垣内 +羽城 +羽場 +羽場内 +羽場崎 +羽塚 +羽塲 +羽壁 +羽多 +羽多埜 +羽多尾 +羽多野 +羽夛 +羽夛野 +羽太 +羽夫瀬 +羽奈 +羽子岡 +羽子田 +羽守 +羽実 +羽室 +羽富 +羽實 +羽尻 +羽尾 +羽屋戸 +羽山 +羽山園 +羽山薗 +羽岡 +羽岩 +羽島 +羽崎 +羽嶋 +羽川 +羽州 +羽左田 +羽左間 +羽市 +羽布津 +羽広 +羽床 +羽座 +羽座岡 +羽座川 +羽庭 +羽廣 +羽当 +羽形 +羽形山 +羽後 +羽成 +羽我 +羽戸 +羽戸本 +羽手原 +羽手村 +羽持 +羽指 +羽斗 +羽方 +羽昊 +羽明 +羽星 +羽曳野 +羽曽部 +羽曾部 +羽月 +羽有 +羽木 +羽木原 +羽木本 +羽本 +羽村 +羽杭 +羽東 +羽板 +羽林 +羽染 +羽柴 +羽柿 +羽栗 +羽根 +羽根井 +羽根吉 +羽根地 +羽根坂 +羽根尾 +羽根岡 +羽根川 +羽根手 +羽根木 +羽根淵 +羽根渕 +羽根田 +羽根石 +羽森 +羽様 +羽橋 +羽次 +羽武戸 +羽毛 +羽毛田 +羽永 +羽江 +羽沢 +羽河 +羽沼 +羽泉 +羽波 +羽津 +羽津川 +羽津本 +羽浦 +羽浪 +羽深 +羽淵 +羽渓 +羽渕 +羽溪 +羽滝 +羽澄 +羽澤 +羽瀧 +羽瀬 +羽瀬原 +羽瀬場 +羽瀬崎 +羽瀬嵜 +羽瀬川 +羽熊 +羽片 +羽牟 +羽物 +羽玉 +羽生 +羽生沢 +羽生津 +羽生田 +羽田 +羽田中 +羽田国 +羽田地 +羽田浦 +羽田谷 +羽田野 +羽田間 +羽畑 +羽當 +羽白 +羽矢 +羽石 +羽磨 +羽磯 +羽祢田 +羽禰田 +羽称田 +羽立 +羽竜 +羽端 +羽竹 +羽納 +羽紫 +羽織 +羽織屋 +羽者家 +羽舘 +羽良 +羽芝 +羽若部 +羽草 +羽藤 +羽蚋 +羽行 +羽衣 +羽衣石 +羽角 +羽計 +羽諸 +羽谷 +羽豆 +羽貝 +羽賀 +羽賀井 +羽賀田 +羽足 +羽路 +羽辺 +羽辻 +羽迫 +羽達 +羽邑 +羽部 +羽里 +羽重 +羽重田 +羽野 +羽野島 +羽野牧 +羽金 +羽釜 +羽鎌田 +羽間 +羽関 +羽阪 +羽隅 +羽階 +羽雁 +羽音 +羽飼 +羽馬 +羽高 +羽鳥 +羽鶴 +羽鹿 +羽黒 +羽龍 +翁 +翁井 +翁像 +翁坂 +翁川 +翁村 +翁林 +翁沢 +翁澤 +翁田 +翁蔵 +翁長 +翅 +翆 +習 +習田 +翔 +翠 +翠尾 +翠川 +翠田 +翠簾屋 +翠簾野 +翫 +耀 +老 +老中 +老久保 +老伽 +老原 +老子 +老家 +老山 +老崎 +老川 +老平 +老後 +老月 +老木 +老本 +老村 +老松 +老林 +老沼 +老泉 +老泊 +老浪 +老田 +老竹 +老籾 +老羅 +老藤 +老谷 +老邑 +老野 +老野生 +老門 +老間 +考 +考藤 +耆山 +而摩 +耒丸 +耒代 +耒住 +耒住野 +耒原 +耒嶋 +耒川 +耒栖 +耒楽 +耒樂 +耒海 +耒田 +耒見 +耒谷 +耕 +耕作 +耕地 +耕守 +耕山 +耕崎 +耕智 +耕田 +耕納 +耕西 +耕谷 +耕野 +耕阪 +耘野 +耜田 +耳 +耳井 +耳兼 +耳塚 +耳川 +耳浦 +耳田 +耳道 +耳野 +耶岐島 +耶雲 +聒田 +聖 +聖代橋 +聖前 +聖園 +聖城 +聖尻 +聖居 +聖山 +聖岩 +聖川 +聖徳 +聖成 +聖沢 +聖澤 +聖生 +聖谷 +聚岳 +聞一 +聞守 +聞川 +聞谷 +聞間 +聲元 +聲高 +聳城 +聴川 +聴涛 +聴濤 +聽濤 +肆井 +肆手盛 +肆矢 +肆谷 +肉丸 +肉倉 +肉戸 +肌勢 +肌埜 +肌瀬 +肌野 +肌附 +肘井 +肘岡 +肘島 +肘谷 +肝付 +肝属 +肝川 +肝月 +肝登 +股尾 +股川 +股座 +股張 +股木 +股村 +股部 +股野 +肥 +肥上 +肥下 +肥中 +肥丸 +肥佐多 +肥前 +肥原 +肥口 +肥合 +肥吉 +肥后 +肥吾 +肥和 +肥和田 +肥和野 +肥喜里 +肥土 +肥地 +肥坐 +肥垣津 +肥塚 +肥夏 +肥多 +肥子 +肥子谷 +肥実 +肥室 +肥實 +肥尾 +肥山 +肥岡 +肥島 +肥嶋 +肥川 +肥後 +肥後井 +肥後屋 +肥後崎 +肥後嵜 +肥後本 +肥後村 +肥後橋 +肥後田 +肥後谷 +肥後野 +肥本 +肥村 +肥東 +肥毛田 +肥沢 +肥沼 +肥海 +肥渡 +肥満 +肥澤 +肥爪 +肥生 +肥田 +肥田埜 +肥田木 +肥田野 +肥留川 +肥留間 +肥目田 +肥窓 +肥谷 +肥越 +肥野 +肥野藤 +肥高 +肩 +肩上 +肩荷 +肩谷 +肩野 +肬岡 +肬方 +肱下 +肱元 +肱岡 +肱川 +肱方 +肱本 +肱黒 +育山 +育村 +育田 +育野 +肴 +肴倉 +肴場 +肴屋 +胃甲 +胆吹 +胆沢 +胆畑 +背 +背久保 +背出 +背口 +背古 +背尾 +背山 +背川 +背戸 +背戸兼 +背戸土井 +背戸山 +背戸川 +背戸川内 +背戸柳 +背戸田 +背戸開地 +背板 +背渡 +背溝 +背藤 +背足 +背野 +背黒 +胎中 +胡 +胡下 +胡中 +胡井 +胡仲 +胡元 +胡内 +胡口 +胡堂 +胡子 +胡子崎 +胡宮 +胡家 +胡居 +胡屋 +胡崎 +胡嵜 +胡川 +胡广ケ野 +胡摩 +胡摩ケ野 +胡摩崎 +胡摩平 +胡摩田 +胡摩窪 +胡摩鶴 +胡明 +胡木 +胡本 +胡桃 +胡桃坂 +胡桃沢 +胡桃澤 +胡桃田 +胡桑沢 +胡桑澤 +胡桑野 +胡浜 +胡濱 +胡田 +胡藤 +胡谷 +胡重 +胡間 +胡麻 +胡麻尻 +胡麻島 +胡麻崎 +胡麻嶋 +胡麻木 +胡麻本 +胡麻田 +胡麻鶴 +胤山 +胤末 +胤森 +胤沢 +胤澤 +胤艸 +胤草 +胸元 +胸広 +胸形 +胸方 +胸永 +胸福 +胸組 +能 +能々 +能一 +能丈 +能上 +能世 +能中 +能丸 +能久 +能井 +能井田 +能仁 +能仁宇 +能代 +能代川 +能代田 +能代谷 +能令 +能仲 +能任 +能住 +能佐 +能作 +能倉 +能元 +能充 +能円坊 +能冨 +能出 +能勢 +能勢山 +能化 +能原 +能又 +能口 +能呂 +能味 +能和 +能圓坊 +能土 +能地 +能坂 +能城 +能埜 +能堀 +能塒 +能塚 +能塩 +能多 +能守 +能宗 +能宮 +能富 +能山 +能岡 +能島 +能崎 +能嵜 +能嶋 +能嶌 +能川 +能州 +能年 +能庄 +能引 +能弾 +能彈 +能戸 +能戸谷 +能手 +能政 +能方 +能星 +能智 +能木 +能木場 +能本 +能村 +能条 +能松 +能林 +能栄 +能條 +能森 +能正 +能武 +能池 +能沢 +能治 +能波 +能津 +能浦 +能海 +能渡 +能満 +能澤 +能瀬 +能生 +能田 +能町 +能登 +能登上 +能登井 +能登原 +能登屋 +能登山 +能登崎 +能登川 +能登村 +能登田 +能登谷 +能登路 +能登部 +能祖 +能租 +能米 +能網 +能美 +能美山 +能美沢 +能美澤 +能義 +能脇 +能芝 +能藤 +能西 +能見 +能角 +能谷 +能道 +能邨 +能都 +能重 +能野 +能門 +能開 +能間 +能関 +能阿弥 +能阿彌 +能隅 +能願 +能鹿島 +脊口 +脊古 +脊尾 +脊山 +脊川 +脊戸 +脊戸兼 +脊戸土井 +脊戸山 +脊戸川 +脊戸柳 +脊戸田 +脊戸開地 +脊板 +脊野 +脊黒 +脚ノ +脚田 +脛永 +脱 +脾野 +腐頭 +腕木 +腕野 +腮尾 +腰 +腰丸 +腰元 +腰冢 +腰前 +腰前田 +腰原 +腰地 +腰坂 +腰塚 +腰尾 +腰山 +腰岡 +腰島 +腰崎 +腰嶋 +腰川 +腰巡 +腰巻 +腰廻 +腰当 +腰懸 +腰掛 +腰替 +腰本 +腰村 +腰水 +腰沢 +腰添 +腰田 +腰細 +腰舞 +腰越 +腰道 +腰野 +腰高 +腹子 +腹岡 +腹巻 +腹帯 +腹田 +腹部 +膝井 +膝付 +膝舘 +膝附 +膝館 +膳 +膳亀 +膳光 +膳場 +膳夫 +膳師 +膳所 +膳棚 +膳沢 +膳法 +膳瀬 +膳田 +膽吹 +膽沢 +膽澤 +膽熊 +膽畑 +臂 +臂折 +臂曲 +臍島 +臓内 +臓屋 +臓野 +臣 +臣司 +臣守 +臣川 +臣永 +臥田 +臥竜岡 +臥雲 +臥龍岡 +臨 +臨山 +臨海 +自 +自休 +自信 +自在 +自在丸 +自徳 +自念 +自房 +自檀地 +自然 +自生 +自見 +自覚 +自谷 +自閑 +自露中 +至 +至令 +至勢 +至当 +至極 +至田 +臺 +臺丸谷 +臺之尊 +臺代 +臺信 +臺内 +臺原 +臺坂 +臺場 +臺川 +臺木 +臺本 +臺沖 +臺田 +臺良 +臺蔵 +臺藏 +臺谷 +臺越 +臺野 +臼 +臼ケ敷 +臼ケ谷 +臼井 +臼倉 +臼元 +臼口 +臼坂 +臼城 +臼場 +臼射 +臼居 +臼屋 +臼山 +臼岩 +臼島 +臼崎 +臼庭 +臼意 +臼方 +臼木 +臼末 +臼本 +臼村 +臼杵 +臼森 +臼武 +臼池 +臼沢 +臼淵 +臼渕 +臼澤 +臼田 +臼窪 +臼舘 +臼見 +臼谷 +臼賀 +臼野 +臼間 +臼間野 +臼阪 +臼館 +臼馬 +舂井 +舂田 +與 +與ノ +與一迫 +與三 +與三川 +與三本 +與三野 +與下 +與世原 +與世山 +與世平 +與世田 +與世里 +與久田 +與五沢 +與五澤 +與佐岡 +與佐田 +與倉 +與儀 +與北 +與原 +與口 +與古光 +與古田 +與名 +與名城 +與名本 +與吾 +與呉 +與品 +與喜元 +與喜多 +與四田 +與国 +與坂 +與多垣内 +與子田 +與安 +與小田 +與山 +與島 +與崎 +與嶋 +與嶺 +與川 +與市 +與市前 +與市園 +與座 +與後 +與志平 +與戸 +與斎 +與曽井 +與曽田 +與曾井 +與木 +與本 +與板 +與根本 +與永 +與沢 +與河 +與澤 +與猶 +與田 +與町 +與畑 +與縄 +與羽 +與羽瀬 +與能本 +與良 +與芝 +與茂田 +與藤 +與西 +與語 +與謝野 +與護 +與谷 +與賀田 +與迫 +與那 +與那下 +與那原 +與那国 +與那國 +與那城 +與那嶺 +與那花 +與那覇 +與都 +與野 +與野木 +與風 +與齊 +與齋 +興 +興ケ原 +興五澤 +興井 +興亜 +興侶 +興倉 +興儀 +興古田 +興呂 +興呂木 +興国 +興國 +興地 +興山 +興島 +興嶺 +興川 +興座 +興戸 +興本 +興村 +興松 +興林 +興梠 +興梠木 +興水 +興治 +興泉 +興法 +興津 +興満 +興田 +興石 +興禅 +興膳 +興良 +興語 +興謝野 +興谷 +興辺 +興邊 +興那 +興那原 +興那城 +興那嶺 +興那覇 +興野 +興隆 +舊川 +舊役 +舊橋 +舊谷 +舌 +舌古 +舌崎 +舌川原 +舌歯 +舌津 +舌野 +舌間 +舍利倉 +舍利弗 +舍川 +舎 +舎久保 +舎人 +舎利倉 +舎利弗 +舎夷 +舎奈田 +舎川 +舎里田 +舎野 +舖野 +舗田 +舗野 +舘 +舘ケ沢 +舘ケ澤 +舘上 +舘下 +舘中 +舘久 +舘井 +舘元 +舘入 +舘内 +舘前 +舘原 +舘又 +舘口 +舘合 +舘向 +舘坂 +舘場 +舘太 +舘寺 +舘小路 +舘尾 +舘山 +舘岡 +舘島 +舘崎 +舘巖 +舘川 +舘市 +舘形 +舘後 +舘政 +舘木 +舘本 +舘村 +舘松 +舘林 +舘柳 +舘森 +舘江 +舘池 +舘沢 +舘沼 +舘泉 +舘洞 +舘浦 +舘澤 +舘田 +舘畑 +舘盛 +舘石 +舘美 +舘股 +舘脇 +舘腰 +舘花 +舘藤 +舘谷 +舘越 +舘農 +舘道 +舘野 +舘鼻 +舛 +舛ノ内 +舛上 +舛下 +舛中 +舛久 +舛井 +舛倉 +舛元 +舛光 +舛冨 +舛原 +舛友 +舛吉 +舛子 +舛宗 +舛家 +舛富 +舛尾 +舛屋 +舛山 +舛岡 +舛島 +舛崎 +舛川 +舛巴 +舛市 +舛広 +舛廣 +舛形 +舛成 +舛掛 +舛方 +舛木 +舛本 +舛本屋 +舛村 +舛森 +舛次 +舛水 +舛永 +舛沢 +舛治 +舛淵 +舛添 +舛渕 +舛潟 +舛澤 +舛甚 +舛田 +舛盛 +舛矢 +舛石 +舛繁 +舛舘 +舛花 +舛行 +舛見 +舛角 +舛谷 +舛賀 +舛迫 +舛部 +舛重 +舛野 +舛金 +舛長 +舛館 +舜太 +舜山 +舞 +舞中 +舞出 +舞原 +舞台 +舞園 +舞坂 +舞多 +舞山 +舞島 +舞嶽 +舞床 +舞弓 +舞木 +舞永 +舞沢 +舞潟 +舞澤 +舞田 +舞矢 +舞石 +舞立 +舞筬 +舞能 +舞良 +舞草 +舞薗 +舞谷 +舞野 +舞鴫 +舞鶴 +舞龍我 +舟 +舟ケ崎 +舟ノ川 +舟上 +舟下 +舟丘 +舟串 +舟久保 +舟之川 +舟井 +舟倉 +舟元 +舟原 +舟口 +舟喜 +舟坂 +舟坪 +舟城 +舟堀 +舟場 +舟塚 +舟子 +舟守 +舟宝 +舟寄 +舟寳 +舟寶 +舟尾 +舟屋 +舟山 +舟岡 +舟島 +舟崎 +舟嵜 +舟嶋 +舟川 +舟幡 +舟底 +舟引 +舟形 +舟成 +舟戸 +舟所 +舟掘 +舟掛 +舟曳 +舟曵 +舟木 +舟本 +舟杉 +舟村 +舟板 +舟林 +舟根 +舟森 +舟槻 +舟橋 +舟水 +舟江 +舟沢 +舟波 +舟洞 +舟津 +舟津丸 +舟津川 +舟浮 +舟浴 +舟涛 +舟渡 +舟澤 +舟濤 +舟瀬 +舟生 +舟田 +舟町 +舟登 +舟知 +舟石 +舟積 +舟窪 +舟竹 +舟羽 +舟腰 +舟茂 +舟見 +舟谷 +舟貝 +舟越 +舟路 +舟辺 +舟迫 +舟道 +舟邑 +舟部 +舟里 +舟野 +舟金 +舟間 +舟阪 +舩 +舩ケ山 +舩上 +舩串 +舩久保 +舩井 +舩來 +舩倉 +舩元 +舩先 +舩入 +舩冨 +舩北 +舩原 +舩口 +舩古 +舩吉 +舩坂 +舩垣 +舩城 +舩場 +舩塚 +舩大工 +舩奥 +舩守 +舩寄 +舩富 +舩尾 +舩屋 +舩山 +舩岡 +舩岩 +舩岳 +舩島 +舩崎 +舩嵜 +舩嶋 +舩川 +舩幡 +舩底 +舩引 +舩後 +舩戸 +舩方 +舩曳 +舩曵 +舩木 +舩木迫 +舩本 +舩杉 +舩村 +舩板 +舩林 +舩梁 +舩森 +舩槻 +舩樹 +舩橋 +舩水 +舩江 +舩波 +舩津 +舩津丸 +舩津屋 +舩浪 +舩渡 +舩渡川 +舩満 +舩澤 +舩瀬 +舩生 +舩田 +舩留 +舩登 +舩盛 +舩矢 +舩石 +舩砥 +舩磯 +舩穂 +舩積 +舩窪 +舩築 +舩脇 +舩脊 +舩腰 +舩蔵 +舩藏 +舩藤 +舩見 +舩谷 +舩越 +舩越谷 +舩路 +舩迫 +舩造 +舩野 +舩門 +舩間 +舩阪 +舩附 +般戸 +般林 +般若 +般谷 +舮居 +舳峯 +舳峰 +舳崎 +舳松 +舶来 +船 +船ケ山 +船ケ沢 +船ケ澤 +船ケ谷 +船ケ迫 +船上 +船下 +船中 +船串 +船久保 +船之川 +船井 +船亦 +船付 +船代 +船住 +船佐古 +船倉 +船元 +船先 +船入 +船公 +船内 +船冨 +船出 +船切 +船勢 +船北 +船原 +船口 +船古 +船台 +船吉 +船坂 +船垣 +船城 +船堂 +船場 +船塚 +船多 +船大工 +船奥 +船守 +船宝 +船宮 +船家 +船寄 +船富 +船寺 +船尻 +船尾 +船居 +船屋 +船山 +船岡 +船岩 +船岳 +船島 +船崎 +船嵜 +船嶋 +船川 +船工 +船幡 +船平 +船床 +船底 +船度 +船度川 +船廻 +船引 +船張 +船形 +船後 +船戸 +船戸川 +船所 +船手谷 +船方 +船明 +船曳 +船曵 +船木 +船木迫 +船本 +船杉 +船村 +船来 +船松 +船板 +船林 +船柳 +船根 +船梁 +船森 +船槁 +船槻 +船樹 +船橋 +船水 +船江 +船沢 +船河 +船河原 +船波 +船津 +船津丸 +船津屋 +船浜 +船浦 +船浪 +船浮 +船浴 +船渓 +船渡 +船渡川 +船満 +船溪 +船澤 +船瀬 +船生 +船田 +船町 +船畑 +船留 +船登 +船盛 +船着 +船矢 +船石 +船砥 +船磯 +船穂 +船積 +船窪 +船端 +船競 +船竹 +船築 +船綱 +船置 +船職 +船背 +船脇 +船腰 +船臺 +船草 +船蔵 +船藏 +船藤 +船見 +船谷 +船谷内 +船起 +船越 +船越谷 +船路 +船辺 +船迫 +船造 +船道 +船都 +船重 +船野 +船長 +船門 +船間 +船間屋 +船阪 +船附 +船隈 +船隠 +船面 +船頭 +艗 +艫井 +艫居 +艮 +良 +良井 +良元 +良原 +良塚 +良山 +良岡 +良峯 +良峰 +良島 +良崎 +良川 +良方 +良本 +良村 +良永 +良河 +良波 +良田 +良盛 +良知 +良谷 +良辺 +良邉 +良邊 +良雄 +色 +色井 +色原 +色増 +色山 +色島 +色川 +色平 +色摩 +色木 +色本 +色波 +色田 +色紙 +色葉 +色見 +色谷 +色部 +色野 +色雲 +艶島 +艸分 +艸切 +艸加 +艸場 +艸川 +艸戸 +艸木 +艸林 +艸楽 +艸田 +艸葉 +艸薙 +艸谷 +艸野 +艸間 +艸香 +艾 +艾原 +艾沢 +艾澤 +芋ケ崎 +芋ケ迫 +芋原 +芋吉 +芋堀 +芋塚 +芋岡 +芋川 +芋月 +芋本 +芋沢 +芋澤 +芋瀬 +芋生 +芋田 +芋畑 +芋縄 +芋谷 +芋迫 +芋野 +芋高 +芒崎 +芙家 +芙蓉 +芙頭 +芝 +芝一 +芝上 +芝下 +芝中 +芝丸 +芝井 +芝伐 +芝倉 +芝元 +芝先 +芝入 +芝内 +芝出 +芝切 +芝前 +芝勢 +芝北 +芝原 +芝口 +芝合 +芝名 +芝吹 +芝嗣 +芝土 +芝地 +芝坂 +芝垣 +芝埜 +芝埼 +芝塚 +芝多 +芝好 +芝宮 +芝家 +芝小路 +芝尾 +芝居 +芝山 +芝岡 +芝岸 +芝峰 +芝島 +芝崎 +芝嵜 +芝川 +芝平 +芝床 +芝戸 +芝木 +芝本 +芝村 +芝林 +芝柳 +芝根 +芝橋 +芝氏 +芝江 +芝池 +芝沢 +芝沼 +芝波田 +芝浜 +芝浦 +芝海 +芝淵 +芝渕 +芝滝 +芝澤 +芝瀧 +芝生 +芝生田 +芝田 +芝畑 +芝端 +芝築地 +芝脇 +芝花 +芝草 +芝藤 +芝西 +芝谷 +芝越 +芝軒 +芝辻 +芝野 +芝開 +芝間 +芝関 +芝頭 +芝高 +芝鷹 +芝鼻 +芟花 +芟薮 +芟藪 +芥 +芥切 +芥原 +芥子 +芥子川 +芥子田 +芥屋 +芥島 +芥川 +芥河 +芥生 +芥田 +芥田首 +芥野 +芦 +芦ケ原 +芦ケ沢 +芦ケ澤 +芦ケ谷 +芦ケ里 +芦中 +芦久保 +芦井 +芦住 +芦内 +芦分 +芦刈 +芦北 +芦原 +芦口 +芦名 +芦名沢 +芦名澤 +芦和 +芦垣 +芦埜 +芦場 +芦塚 +芦家 +芦尾 +芦屋 +芦山 +芦岡 +芦峯 +芦峰 +芦島 +芦崎 +芦川 +芦戸 +芦月 +芦木 +芦本 +芦村 +芦林 +芦根 +芦森 +芦永 +芦江 +芦池 +芦沢 +芦沼 +芦津 +芦浦 +芦渡 +芦澤 +芦瀬 +芦生 +芦田 +芦田川 +芦界 +芦矢 +芦硲 +芦立 +芦舘 +芦苅 +芦萱 +芦葉 +芦葭 +芦藤 +芦見 +芦谷 +芦谷原 +芦賀 +芦辺 +芦迫 +芦達 +芦邉 +芦邊 +芦部 +芦野 +芦間 +芦阪 +芦館 +芦馬 +芦高 +芭瀬田 +芭蕉 +芭蕉宮 +花 +花ケ前 +花ケ埼 +花ケ崎 +花ケ迫 +花ノ井 +花ノ内 +花ノ木 +花上 +花下 +花丘 +花中 +花丸 +花乃木 +花久 +花之内 +花之木 +花之枝 +花亀 +花井 +花住 +花俟 +花俣 +花倉 +花元 +花光 +花八 +花内 +花円 +花出 +花利 +花前 +花北 +花升 +花卷 +花原 +花厳 +花又 +花口 +花吉 +花和 +花咲 +花喜 +花嚴 +花圃 +花園 +花圓 +花土 +花坂 +花坪 +花垣 +花城 +花堂 +花塚 +花増 +花外 +花多山 +花好 +花妻 +花子 +花守 +花安 +花実 +花室 +花宮 +花家 +花密 +花實 +花小野 +花尻 +花尾 +花屋 +花山 +花山院 +花岡 +花岩 +花岳 +花岸 +花峯 +花峰 +花島 +花崎 +花嵜 +花嶋 +花川 +花巻 +花市 +花布 +花幡 +花平 +花弥 +花当 +花形 +花待 +花志 +花戸 +花房 +花手 +花折 +花摘 +花斗 +花新発 +花新發 +花方 +花時丸 +花曲 +花月 +花木 +花木内 +花本 +花村 +花松 +花林 +花枝 +花染 +花柳 +花栄 +花栗 +花根 +花桐 +花桝 +花梨 +花棚 +花森 +花植 +花榮 +花樹 +花橋 +花檀 +花段 +花毛 +花水 +花江 +花池 +花沢 +花河 +花泉 +花津谷 +花浦 +花浴 +花海 +花淵 +花添 +花清 +花渓 +花渕 +花渡 +花満 +花溪 +花澤 +花瀬 +花烏賊 +花熊 +花牟礼 +花牟禮 +花王 +花生 +花田 +花町 +花畑 +花畠 +花當 +花登 +花盛 +花矢 +花石 +花神 +花穂 +花積 +花立 +花等 +花箭 +花篤 +花篭 +花籠 +花紀 +花脇 +花舘 +花芳 +花苑 +花若 +花茂 +花草 +花菱 +花蔭 +花蔵 +花薗 +花藤 +花蜜 +花表 +花補佐 +花見 +花見堂 +花角 +花谷 +花豊 +花貫 +花越 +花車 +花輪 +花辺 +花遊 +花道 +花邉 +花邑 +花部 +花里 +花重 +花野 +花野井 +花野内 +花野木 +花金 +花釜 +花長井 +花開 +花阪 +花隈 +花面 +花館 +花香 +花高 +花麻 +芲田 +芳 +芳ケ迫 +芳ケ野 +芳ノ内 +芳上 +芳中 +芳丸 +芳之内 +芳井 +芳仲 +芳住 +芳信 +芳倉 +芳元 +芳内 +芳出 +芳匠 +芳原 +芳友 +芳口 +芳司 +芳土戸 +芳地 +芳坂 +芳垣 +芳埜 +芳士戸 +芳多 +芳家 +芳富 +芳寺戸 +芳尾 +芳居 +芳屋 +芳山 +芳岡 +芳島 +芳崎 +芳川 +芳師渡 +芳平 +芳形 +芳志戸 +芳忠 +芳成 +芳我 +芳木 +芳木田 +芳末 +芳本 +芳村 +芳松 +芳林 +芳根 +芳森 +芳樹 +芳武 +芳水 +芳永 +芳池 +芳沢 +芳沼 +芳泉 +芳津 +芳浦 +芳浪 +芳添 +芳滝 +芳潟 +芳澤 +芳炭 +芳片 +芳田 +芳竹 +芳脇 +芳蔵 +芳藏 +芳藤 +芳西 +芳見 +芳角 +芳訳 +芳譯 +芳谷 +芳賀 +芳賀沼 +芳越 +芳輪 +芳邑 +芳邦 +芳邨 +芳里 +芳重 +芳野 +芳金 +芳鐘 +芳長 +芳門 +芳間 +芳陵 +芳須 +芳養 +芸下 +芸林 +芹 +芹ケ野 +芹井 +芹内 +芹加古 +芹原 +芹口 +芹山 +芹岡 +芹川 +芹本 +芹江 +芹沢 +芹澤 +芹生 +芹田 +芹野 +芽出 +芽原 +芽山 +芽形 +芽木 +芽村 +芽組 +芽蕗 +芽野 +苅住 +苅元 +苅北 +苅又 +苅和 +苅和野 +苅場 +苅安 +苅家 +苅宿 +苅尾 +苅屋 +苅屋田 +苅山 +苅底 +苅敷山 +苅森 +苅沢 +苅澤 +苅生 +苅田 +苅畑 +苅矢 +苅端 +苅篭 +苅籠 +苅米 +苅羽 +苅舎 +苅茂 +苅草 +苅萱 +苅蘒 +苅谷 +苅辺 +苅込 +苅邉 +苅邊 +苅部 +苅郷 +苅野 +苅間沢 +苅間澤 +苆川 +苆野 +苑 +苑原 +苑川 +苑本 +苑樹 +苑田 +苑部 +苔前 +苔原 +苔口 +苔山 +苔庵 +苔田 +苔石 +苔縄 +苕野 +苗 +苗井 +苗代 +苗代巾 +苗代幅 +苗代橋 +苗代沢 +苗代澤 +苗代田 +苗代迫 +苗保 +苗倉 +苗加 +苗園 +苗山 +苗島 +苗崎 +苗川 +苗床 +苗手 +苗木 +苗村 +苗松 +苗沢 +苗渋 +苗田 +苗畑 +苙 +苙口 +苛原 +苞山 +苣原 +苣木 +苣田 +苣野 +若年 +若念 +若王子 +若野 +苦嶽 +苦木 +苦水 +苦瀬 +苦爪 +苦瓜 +苦田 +苦竹 +苧側 +苧出 +苧原 +苧園 +苧坂 +苧坪 +苧川 +苧木 +苧本 +苧毛 +苧津 +苧漬川 +苧玉 +苧田 +苧畑 +苧谷 +苧里川 +苧野 +苧阪 +苫 +苫ケ平 +苫下 +苫井 +苫原 +苫口 +苫名 +苫地 +苫坂 +苫居 +苫屋 +苫島 +苫川 +苫本 +苫渕 +苫澤 +苫田 +苫篠 +苫米地 +苫見 +苫谷 +苫野 +英 +英井 +英保 +英加 +英加野 +英原 +英口 +英城 +英堂 +英山 +英岡 +英川 +英木 +英本 +英武 +英比 +英田 +英賀 +英賀田 +英賀谷 +苷蔗 +苺谷 +苻坂 +苻川 +苻阪 +苽生 +茂 +茂り松 +茂上 +茂下 +茂中 +茂串 +茂久 +茂久田 +茂井 +茂住 +茂俣 +茂倉 +茂元 +茂兼 +茂内 +茂出木 +茂刈 +茂利 +茂利田 +茂原 +茂又 +茂叉 +茂友 +茂古沼 +茂司 +茂吉 +茂呂 +茂呂居 +茂呂沢 +茂呂澤 +茂呂田 +茂呂竹 +茂和泉 +茂在 +茂地 +茂垣 +茂塚 +茂士山 +茂太 +茂好 +茂字井 +茂宮 +茂家 +茂富 +茂尾 +茂居 +茂屋 +茂山 +茂岡 +茂岩 +茂岱 +茂島 +茂崎 +茂嶋 +茂川 +茂市 +茂幾 +茂庭 +茂怜羅 +茂成 +茂戸 +茂戸藤 +茂手 +茂手山 +茂手木 +茂曽路 +茂木 +茂木田 +茂木立 +茂末 +茂本 +茂村 +茂松 +茂林 +茂栄 +茂森 +茂業 +茂櫛 +茂永 +茂沢 +茂治 +茂泉 +茂津目 +茂浦 +茂浦口 +茂清 +茂渡 +茂澄 +茂澤 +茂瀬 +茂瀬野 +茂理 +茂田 +茂田井 +茂田山 +茂由 +茂畑 +茂登 +茂登利 +茂登山 +茂知 +茂知矢 +茂知野 +茂石 +茂神 +茂福 +茂筑 +茂築 +茂篭 +茂籠 +茂美 +茂腹 +茂膓 +茂良田 +茂苅 +茂藤 +茂見 +茂角 +茂谷 +茂貫 +茂越 +茂路 +茂道 +茂都宮 +茂里 +茂里川 +茂野 +茄子 +茄子倉 +茄子原 +茄子川 +茄子田 +茄子野 +茄川 +茅 +茅ケ崎 +茅ケ迫 +茅ノ間 +茅中 +茅之間 +茅井 +茅先 +茅切 +茅原 +茅原屋 +茅原田 +茅吹 +茅園 +茅垣 +茅埜 +茅場 +茅壁 +茅守 +茅室 +茅尾 +茅山 +茅岡 +茅島 +茅崎 +茅嶋 +茅嶌 +茅川 +茅平 +茅房 +茅早 +茅木 +茅本 +茅根 +茅森 +茅橋 +茅沼 +茅生 +茅田 +茅畑 +茅窪 +茅納 +茅花 +茅谷 +茅里 +茅野 +茅野根 +茅間 +茆原 +茉本 +茎沢 +茎津 +茎澤 +茎田 +茗ケ原 +茗ケ谷 +茗ケ迫 +茗井 +茗作 +茗加 +茗原 +茗島 +茗木 +茗田 +茗花 +茗茄 +茗荷 +茗荷原 +茗荷谷 +茜 +茜ケ久保 +茜屋 +茜谷 +茜部 +茢田 +茨 +茨原 +茨城 +茨山 +茨島 +茨戸 +茨木 +茨本 +茨池 +茨沢 +茨澤 +茨田 +茨目 +茨野 +茭ケ迫 +茭口 +茱萸 +茱萸田 +茲出 +茲地 +茶 +茶々 +茶の前 +茶の木 +茶ノ前 +茶ノ木 +茶中 +茶久 +茶之原 +茶之木 +茶井 +茶位 +茶倉 +茶元 +茶免 +茶円 +茶原 +茶吉 +茶呑 +茶和田 +茶園 +茶圓 +茶地 +茶坂 +茶垣内 +茶城 +茶埜 +茶堂 +茶売 +茶室 +茶家 +茶富 +茶尻 +茶屋 +茶屋元 +茶屋原 +茶屋垣外 +茶屋場 +茶屋本 +茶屋田 +茶屋道 +茶屋野 +茶屋鼻 +茶山 +茶岡 +茶島 +茶嶋 +茶川 +茶幡 +茶平 +茶床 +茶座 +茶弘 +茶志川 +茶戸 +茶新 +茶木 +茶木原 +茶木平 +茶木田 +茶木谷 +茶本 +茶村 +茶林 +茶栗 +茶森 +茶樹 +茶橋 +茶浦 +茶珍 +茶珎 +茶田 +茶田平 +茶畑 +茶畠 +茶登 +茶石 +茶碗谷 +茶碗野 +茶立場 +茶端 +茶竹 +茶筌 +茶納 +茶縁 +茶置 +茶臼山 +茶船 +茶花 +茶薗 +茶藤 +茶谷 +茶谷原 +茶谷垣内 +茶谷本 +茶賣 +茶辺須 +茶郷 +茶野 +茶野下 +茶野木 +茶鍋 +茶間 +茶院 +茸平 +茸木 +茸谷 +草 +草ケ谷 +草ノ井 +草ノ宮 +草ノ瀬 +草下 +草下部 +草之瀬 +草井 +草亭 +草住 +草信 +草元 +草光 +草内 +草冨 +草処 +草出 +草分 +草切 +草刈 +草別 +草前 +草剪 +草創 +草加 +草原 +草取 +草合 +草名 +草名木 +草味 +草園 +草地 +草坂 +草垣 +草埜 +草場 +草塩 +草壁 +草姥 +草宮 +草富 +草尾 +草山 +草岡 +草島 +草崎 +草嵜 +草嶋 +草嶌 +草川 +草巻 +草平 +草彅 +草戸 +草房 +草摘 +草替 +草木 +草木原 +草木田 +草木迫 +草本 +草村 +草東 +草柳 +草桶 +草梛 +草森 +草樹 +草橋 +草次 +草水 +草永 +草沢 +草河 +草治 +草津 +草浦 +草海 +草深 +草清 +草渓 +草渚 +草溪 +草澤 +草瀬 +草牟田 +草牧 +草生 +草田 +草町 +草留 +草皆 +草福 +草積 +草竹 +草羽 +草花 +草苅 +草茅 +草萱 +草葉 +草薙 +草處 +草西 +草訳 +草譯 +草谷 +草貫 +草賀 +草道 +草部 +草郷 +草野 +草門 +草開 +草間 +草階 +草難 +草露 +草飼 +草香 +草馬 +草鹿 +草鹿砥 +荊 +荊原 +荊尾 +荊木 +荊沢 +荊澤 +荊田 +荏原 +荏本 +荏柄 +荏田 +荏畑 +荏草 +荏開津 +荏隈 +荒 +荒ケ田 +荒上 +荒下 +荒中 +荒久 +荒久保 +荒久田 +荒亀 +荒二井 +荒井 +荒井出 +荒井田 +荒俣 +荒倉 +荒元 +荒光 +荒兼 +荒内 +荒冷 +荒切 +荒前 +荒勝 +荒勢 +荒北 +荒卷 +荒原 +荒又 +荒口 +荒古 +荒古江 +荒司 +荒和田 +荒品 +荒喜 +荒嘉 +荒地 +荒坂 +荒垣 +荒城 +荒埜 +荒堀 +荒場 +荒塚 +荒子 +荒宅 +荒家 +荒尾 +荒居 +荒屋 +荒屋敷 +荒屋鋪 +荒山 +荒岡 +荒岩 +荒岳 +荒岸 +荒島 +荒崎 +荒嶋 +荒嶽 +荒川 +荒川内 +荒巻 +荒幡 +荒平 +荒引 +荒張 +荒当 +荒戸 +荒手 +荒掘 +荒新 +荒明 +荒曽我 +荒木 +荒木地 +荒木田 +荒木野 +荒木関 +荒本 +荒村 +荒東 +荒松 +荒枝 +荒柄 +荒柴 +荒栄 +荒梅 +荒梶 +荒森 +荒榮 +荒槇 +荒槙 +荒樋 +荒橋 +荒武 +荒殿 +荒毛 +荒毛谷 +荒水 +荒永 +荒江 +荒池 +荒沢 +荒河 +荒治 +荒沼 +荒波 +荒津 +荒津内 +荒津前 +荒津田 +荒浜 +荒浪 +荒海 +荒涛 +荒深 +荒添 +荒清 +荒渡 +荒滝 +荒澤 +荒濤 +荒濱 +荒瀧 +荒瀬 +荒瀬原 +荒熊 +荒牧 +荒物屋 +荒玉 +荒生 +荒田 +荒田川 +荒田谷 +荒町 +荒畑 +荒畠 +荒畦 +荒當 +荒益 +荒目 +荒矢 +荒石 +荒砂 +荒砥 +荒磯 +荒礒 +荒神 +荒神原 +荒神垣内 +荒科 +荒竹 +荒籾 +荒紀 +荒納 +荒維 +荒綱 +荒美 +荒股 +荒能 +荒脇 +荒舘 +荒舟 +荒舩 +荒船 +荒良木 +荒芝 +荒花 +荒若 +荒茅 +荒蒔 +荒蔭 +荒薦 +荒藤 +荒虫 +荒衛 +荒西 +荒見 +荒角 +荒記 +荒谷 +荒貝 +荒貴 +荒賀 +荒起 +荒道 +荒邦 +荒部谷 +荒里 +荒重 +荒野 +荒野尾 +荒金 +荒銀 +荒銭 +荒鎮 +荒開 +荒間 +荒関 +荒關 +荒須 +荒館 +荒馬 +荒駒 +荒鬼 +荒鳶 +荒鹿 +荘 +荘中 +荘乃 +荘保 +荘光 +荘加 +荘原 +荘厳 +荘口 +荘司 +荘園 +荘圓 +荘埜 +荘子 +荘山 +荘島 +荘崎 +荘川 +荘所 +荘村 +荘林 +荘田 +荘羽 +荘谷 +荘野 +荘野上 +荢内 +荢原 +荢坂 +荢坪 +荢川 +荢毛 +荢津 +荢漬川 +荢田 +荢野 +荢阪 +荷上 +荷出 +荷口 +荷合島 +荷合嶋 +荷坂 +荷堂 +荷塚 +荷宮 +荷屋 +荷山 +荷川 +荷川取 +荷平 +荷所 +荷掛 +荷方 +荷月 +荷本 +荷村 +荷河取 +荷田 +荷田久保 +荷福 +荷稲 +荷葉 +荷蘭 +荷見 +荷軽井 +荷軽部 +荷輪 +荷阪 +荷高 +荻 +荻の沢 +荻ケ内 +荻ノ沢 +荻ノ迫 +荻上 +荻下 +荻中 +荻久保 +荻井 +荻倉 +荻内 +荻原 +荻園 +荻坂 +荻埜 +荻堂 +荻場 +荻多 +荻子 +荻尾 +荻山 +荻島 +荻嶋 +荻川 +荻州 +荻巣 +荻布 +荻平 +荻曽 +荻曾 +荻木 +荻本 +荻村 +荻林 +荻枝 +荻根 +荻根沢 +荻根澤 +荻森 +荻江 +荻沢 +荻沼 +荻津 +荻洲 +荻浦 +荻澤 +荻無里 +荻生 +荻田 +荻町 +荻矢 +荻窪 +荻篠 +荻納 +荻荘 +荻莊 +荻谷 +荻路 +荻迫 +荻野 +荻野江 +荻野目 +荻野谷 +荻間 +荻阪 +荻須 +莅戸 +莇 +莇生 +莇生田 +莇生野 +莇田 +莇野 +莊 +莊加 +莊司 +莊埜 +莊川 +莊田 +莍崎 +莎沢 +莎澤 +莓谷 +莖津 +莖澤 +莖田 +莚 +莚井 +莚平 +莚田 +莞牟田 +莟 +莧 +莨 +莨谷 +莪山 +莫根 +莱表 +莵原 +莵本 +莵田 +莿木 +菁川 +菅 +菅ケ谷 +菅ノ又 +菅ノ沢 +菅ノ澤 +菅ノ谷 +菅上 +菅下 +菅与 +菅並 +菅中 +菅久 +菅之屋 +菅井 +菅付 +菅佐原 +菅信 +菅俣 +菅元 +菅光 +菅具 +菅内 +菅北 +菅原 +菅又 +菅叉 +菅口 +菅名 +菅和 +菅土 +菅地 +菅坂 +菅坡 +菅城 +菅埜 +菅多 +菅安 +菅宮 +菅家 +菅家原 +菅尾 +菅居 +菅屋 +菅山 +菅岡 +菅岩 +菅峨 +菅島 +菅崎 +菅嵜 +菅嶋 +菅嶌 +菅川 +菅広 +菅庭 +菅廣 +菅延 +菅形 +菅惣 +菅成 +菅戸 +菅方 +菅昌 +菅有 +菅木 +菅本 +菅村 +菅松 +菅林 +菅枝 +菅根 +菅梅 +菅條 +菅森 +菅橋 +菅毛 +菅水 +菅江 +菅池 +菅沢 +菅河 +菅沼 +菅沼田 +菅泉 +菅波 +菅洞 +菅浜 +菅浦 +菅浪 +菅渓 +菅溪 +菅澤 +菅濱 +菅瀬 +菅牟田 +菅生 +菅生屋 +菅田 +菅畑 +菅竹 +菅籐 +菅納 +菅股 +菅能 +菅脇 +菅蒲 +菅蔵 +菅藤 +菅見 +菅谷 +菅谷内 +菅貞 +菅賀 +菅辺 +菅近 +菅重 +菅野 +菅野又 +菅野屋 +菅野谷 +菅鉢 +菅長 +菅間 +菅頭 +菅高 +菊 +菊一 +菊万 +菊下 +菊丘 +菊中 +菊丸 +菊久池 +菊之井 +菊井 +菊仲 +菊伊 +菊伊那 +菊住 +菊保 +菊元 +菊先 +菊光 +菊入 +菊内 +菊千 +菊原 +菊口 +菊吉 +菊名 +菊咲 +菊喜田 +菊園 +菊地 +菊地原 +菊地田 +菊坂 +菊城 +菊埼 +菊堂 +菊場 +菊塚 +菊壽 +菊多 +菊大路 +菊太 +菊好 +菊妻 +菊子 +菊守 +菊安 +菊宗 +菊実 +菊宮 +菊家 +菊富 +菊實 +菊寿 +菊尾 +菊居 +菊屋 +菊山 +菊岡 +菊島 +菊崎 +菊嵜 +菊嶋 +菊嶌 +菊巒 +菊川 +菊市 +菊平 +菊広 +菊庵 +菊政 +菊智 +菊月 +菊朋 +菊木 +菊末 +菊本 +菊村 +菊松 +菊林 +菊枝 +菊栄 +菊根 +菊森 +菊植 +菊楽 +菊橋 +菊次 +菊武 +菊民 +菊水 +菊永 +菊江 +菊池 +菊池原 +菊沖 +菊沢 +菊河 +菊波 +菊浦 +菊浪 +菊海 +菊淵 +菊渕 +菊澤 +菊田 +菊畑 +菊留 +菊畠 +菊盛 +菊矢 +菊知 +菊石 +菊竹 +菊継 +菊繁 +菊美 +菊若 +菊華 +菊葉 +菊薗 +菊藤 +菊蘂 +菊衣 +菊西 +菊見 +菊角 +菊谷 +菊賀 +菊輪 +菊農 +菊辻 +菊里 +菊重 +菊野 +菊間 +菊香 +菊馬 +菊高 +菓 +菓子 +菓子井 +菓子尾 +菓子本 +菓子田 +菓子谷 +菓子野 +菓谷 +菖一 +菖池 +菖浦 +菖蒲 +菖蒲奥 +菖蒲川 +菖蒲廻 +菖蒲池 +菖蒲沢 +菖蒲澤 +菖蒲田 +菖蒲谷 +菖蒲迫 +菖藤 +菖野 +菜切 +菜原 +菜子 +菜島 +菜嶋 +菜引 +菜木 +菜畑 +菜畠 +菜種 +菜花 +菜虫 +菜野 +菟原 +菟田 +菩堤寺 +菩提 +菩提寺 +菩提野 +華丘 +華井 +華元 +華原 +華園 +華地山 +華垣 +華埜井 +華学 +華宮 +華尾 +華山 +華岡 +華島 +華崎 +華嶽 +華川 +華広 +華廣 +華房 +華本 +華村 +華樹 +華江 +華沢 +華澤 +華田 +華石 +華立 +華蔵閣 +華藤 +華表 +華谷 +華輪 +華野 +華頂 +菰下 +菰千葉 +菰原 +菰口 +菰岡 +菰島 +菰敷 +菰方 +菰池 +菰沢 +菰淵 +菰渕 +菰澤 +菰生 +菰田 +菰西 +菰野 +菱 +菱ケ江 +菱中 +菱事 +菱井 +菱伊 +菱倉 +菱刈 +菱垣 +菱城 +菱家 +菱尾 +菱屋 +菱山 +菱岡 +菱島 +菱崎 +菱嶋 +菱川 +菱形 +菱戸 +菱木 +菱本 +菱村 +菱水 +菱江 +菱池 +菱沢 +菱河 +菱沼 +菱澤 +菱田 +菱矢 +菱科 +菱蔵 +菱見 +菱谷 +菱野 +菱間 +菴 +菴原 +菴木 +菴沢 +菴澤 +菴田 +菴谷 +萃房 +萇崎 +萇野 +萌出 +萌抜 +萌黄 +萎沢 +萎澤 +萎羅 +萑部 +萓 +萓原 +萓堂 +萓場 +萓岡 +萓島 +萓嶋 +萓嶌 +萓森 +萓橋 +萓沼 +萓谷 +萓野 +萓間 +萠出 +萠抜 +萠拔 +萢 +萢中 +萩 +萩の脇 +萩ノ前 +萩ノ崎 +萩ノ脇 +萩ノ谷 +萩上 +萩下 +萩中 +萩久保 +萩之内 +萩之前 +萩井 +萩保 +萩倉 +萩元 +萩内 +萩前 +萩原 +萩口 +萩台 +萩坂 +萩埜 +萩堂 +萩塚 +萩境 +萩宇田 +萩守 +萩家 +萩小田 +萩尾 +萩尾田 +萩屋 +萩山 +萩岡 +萩岩 +萩峯 +萩島 +萩崎 +萩嵜 +萩嶋 +萩嶌 +萩嶺 +萩川 +萩巣 +萩平 +萩庄 +萩庭 +萩折 +萩木場 +萩木塲 +萩本 +萩村 +萩枝 +萩根 +萩森 +萩橋 +萩永 +萩池 +萩沢 +萩沼 +萩浦 +萩渡 +萩澤 +萩生 +萩生田 +萩田 +萩矢 +萩脇 +萩臺 +萩藤 +萩行 +萩谷 +萩輪 +萩迫 +萩部 +萩里 +萩野 +萩野下 +萩野屋 +萩野矢 +萩野谷 +萩野間 +萩間 +萩隅 +萬 +萬ケ原 +萬ケ谷 +萬上 +萬世 +萬両 +萬中 +萬久 +萬亀 +萬亀山 +萬事 +萬井 +萬代 +萬代寺 +萬來 +萬保 +萬俵 +萬光 +萬処 +萬利乃 +萬力 +萬力屋 +萬力谷 +萬匠 +萬台 +萬喜 +萬国 +萬国谷 +萬國谷 +萬城 +萬城目 +萬場 +萬壽 +萬奥 +萬好 +萬字 +萬宝 +萬実 +萬宮 +萬家 +萬實 +萬寳 +萬寶 +萬寿 +萬尾 +萬屋 +萬山 +萬岡 +萬岳 +萬崎 +萬嵜 +萬川 +萬平 +萬年 +萬年山 +萬度 +萬徳 +萬慶 +萬成 +萬我 +萬戸 +萬所 +萬才 +萬方 +萬木 +萬本 +萬束 +萬来 +萬松 +萬條 +萬正 +萬歩 +萬歳 +萬水 +萬永 +萬沢 +萬治 +萬波 +萬津 +萬浪 +萬浮 +萬澤 +萬濃 +萬瀬 +萬燈 +萬狩 +萬玉 +萬田 +萬矢 +萬石 +萬砂 +萬福 +萬立 +萬竹 +萬納 +萬納寺 +萬羽 +萬膳 +萬葉 +萬藤 +萬處 +萬行 +萬谷 +萬豆 +萬財 +萬貫 +萬賀 +萬越 +萬辺 +萬造 +萬造寺 +萬道 +萬部 +萬里 +萬里小路 +萬里崎 +萬里川 +萬野 +萬金 +萬関 +萬雲 +萬願寺 +萱 +萱中 +萱元 +萱内 +萱原 +萱園 +萱垣 +萱堂 +萱場 +萱守 +萱室 +萱尾 +萱山 +萱岡 +萱島 +萱崎 +萱嶋 +萱嶌 +萱巻 +萱本 +萱村 +萱林 +萱森 +萱槙 +萱橋 +萱沢 +萱沼 +萱津 +萱澤 +萱生 +萱田 +萱畑 +萱脇 +萱苗 +萱葺 +萱谷 +萱部 +萱里 +萱野 +萱間 +萼 +落 +落下 +落丸 +落久保 +落亀 +落井 +落付 +落伏 +落元 +落先 +落内 +落分 +落原 +落口 +落司 +落合 +落合堂 +落坂 +落安 +落宰 +落山 +落岩 +落川 +落志 +落枝 +落水 +落水田 +落河 +落海 +落溜 +落瀬 +落田 +落町 +落畑 +落畠 +落盛 +落知 +落石 +落神 +落窪 +落葉 +落藤 +落谷 +落越 +落道 +落部 +落野 +葆東 +葆積 +葈沢 +葈澤 +葉上 +葉久 +葉井 +葉住 +葉佐 +葉佐井 +葉倉 +葉内 +葉利 +葉加瀬 +葉勢森 +葉原 +葉口 +葉古 +葉名 +葉名尻 +葉吹 +葉坂 +葉多埜 +葉多野 +葉室 +葉富 +葉山 +葉岡部 +葉島 +葉広 +葉廣 +葉影 +葉成 +葉戸 +葉手尻 +葉抱 +葉方 +葉月 +葉木 +葉木沢 +葉末 +葉本 +葉村 +葉杖 +葉林 +葉柳 +葉柴 +葉栗 +葉桐 +葉梨 +葉棚 +葉歌 +葉武 +葉沢 +葉波 +葉泰 +葉済 +葉満 +葉満田 +葉潤 +葉澤 +葉瀬 +葉瀬垣 +葉瀬川 +葉狩 +葉玉 +葉田 +葉田野 +葉畑 +葉石 +葉糸 +葉色 +葉若 +葉茂 +葉草 +葉葺 +葉西 +葉計 +葉谷 +葉貫 +葉賀 +葉迫 +葉里 +葉野 +葉野浦 +葉金 +葉間田 +葉阪 +葉養 +葉騰 +葉鳥 +葊 +葎 +葎口 +葎島 +葎嶋 +葎迫 +葏口 +著蕷瀬 +葛 +葛上 +葛下 +葛丸 +葛井 +葛佐 +葛卷 +葛原 +葛口 +葛和 +葛坂 +葛城 +葛堀 +葛声 +葛宇 +葛宮 +葛尾 +葛屋 +葛山 +葛岡 +葛島 +葛崎 +葛嶋 +葛川 +葛巻 +葛平 +葛形 +葛木 +葛本 +葛村 +葛根 +葛根田 +葛江 +葛生 +葛田 +葛畑 +葛目 +葛石 +葛神 +葛窪 +葛立 +葛篭 +葛篭山 +葛篭貫 +葛籠 +葛籠山 +葛籠抜 +葛籠貫 +葛綿 +葛美 +葛羽 +葛良 +葛花 +葛葉 +葛蔭 +葛薮 +葛西 +葛見 +葛谷 +葛貫 +葛輪 +葛迫 +葛野 +葛野谷 +葛間 +葛飾 +葛馬 +葛龍 +葡萄原 +董家 +葦刈 +葦原 +葦名 +葦埜 +葦塚 +葦本 +葦沢 +葦津 +葦洲 +葦浦 +葦澤 +葦田 +葦胤 +葦苅 +葦葉 +葦谷 +葦野 +葭 +葭ケ浦 +葭ノ浦 +葭中 +葭井 +葭仲 +葭内 +葭原 +葭場 +葭多 +葭安 +葭家 +葭山 +葭岡 +葭崎 +葭川 +葭平 +葭本 +葭村 +葭林 +葭森 +葭江 +葭沢 +葭澤 +葭田 +葭田野 +葭矢 +葭葉 +葭谷 +葭谷内 +葭野 +葭間 +葮家 +葮岡 +葮本 +葮村 +葮葉 +葱花 +葵 +葵木 +葵生川 +葵田 +葺屋 +葺本 +葺石 +蒋池 +蒋田 +蒋野 +蒐場 +蒔 +蒔元 +蒔内 +蒔原 +蒔山 +蒔崎 +蒔平 +蒔本 +蒔村 +蒔添 +蒔田 +蒔苗 +蒔野 +蒟油 +蒦手 +蒲 +蒲ケ原 +蒲上門 +蒲之坊 +蒲倉 +蒲刈 +蒲原 +蒲土 +蒲地 +蒲山 +蒲島 +蒲嶋 +蒲川 +蒲木 +蒲本 +蒲武 +蒲池 +蒲沢 +蒲沼 +蒲浦 +蒲澤 +蒲瀬 +蒲牟田 +蒲生 +蒲生原 +蒲生地 +蒲生田 +蒲田 +蒲谷 +蒲野 +蒸 +蒸原 +蒸野 +蒼下 +蒼佐 +蒼座 +蒼森 +蒼生 +蓁 +蓁原 +蓋 +蓋盛 +蓑 +蓑上 +蓑下 +蓑代 +蓑内 +蓑原 +蓑口 +蓑和 +蓑和田 +蓑地 +蓑垣内 +蓑城 +蓑夫 +蓑妻 +蓑宮 +蓑尾 +蓑屋 +蓑山 +蓑岡 +蓑島 +蓑崎 +蓑嶋 +蓑川 +蓑干 +蓑手 +蓑方 +蓑星 +蓑本 +蓑毛 +蓑洞 +蓑津 +蓑浦 +蓑添 +蓑牟田 +蓑田 +蓑畑 +蓑羽 +蓑茂 +蓑葉 +蓑藁田 +蓑谷 +蓑越 +蓑輪 +蓑部 +蓑野 +蓙 +蓙谷 +蓜島 +蓜嶋 +蓧崎 +蓬 +蓬ケ野 +蓬來 +蓬原 +蓬台 +蓬子 +蓬尾 +蓬本 +蓬来 +蓬来谷 +蓬沢 +蓬澤 +蓬生 +蓬田 +蓬畑 +蓬耒 +蓬臺 +蓬茨 +蓬莱 +蓬莱谷 +蓬菜 +蓬郷 +蓬野 +蓮 +蓮ケ谷 +蓮上 +蓮下 +蓮中 +蓮丸 +蓮井 +蓮住 +蓮保 +蓮元 +蓮原 +蓮場 +蓮子 +蓮宗 +蓮実 +蓮室 +蓮容 +蓮實 +蓮寺 +蓮尾 +蓮居 +蓮山 +蓮岡 +蓮川 +蓮形 +蓮把 +蓮本 +蓮村 +蓮杷 +蓮林 +蓮氏 +蓮水 +蓮江 +蓮池 +蓮沢 +蓮沼 +蓮波 +蓮浦 +蓮渓 +蓮渕 +蓮潟 +蓮澤 +蓮生 +蓮田 +蓮胤 +蓮舎 +蓮見 +蓮谷 +蓮輪 +蓮野 +蓮長 +蓮間 +蓮阿 +蓮香 +蓼 +蓼丸 +蓼之内 +蓼内 +蓼原 +蓼場 +蓼尾 +蓼川 +蓼本 +蓼沼 +蓼町 +蓼科 +蔀 +蔓 +蔓木 +蔓見 +蔔 +蔡原 +蔡本 +蔡来 +蔣野 +蔤 +蔦 +蔦ケ谷 +蔦中 +蔦井 +蔦保 +蔦原 +蔦口 +蔦垣 +蔦壁 +蔦宗 +蔦尾 +蔦屋 +蔦山 +蔦岡 +蔦島 +蔦嶋 +蔦川 +蔦巻 +蔦市 +蔦木 +蔦本 +蔦村 +蔦林 +蔦森 +蔦永 +蔦江 +蔦沢 +蔦浜 +蔦浦 +蔦澤 +蔦濱 +蔦田 +蔦芳 +蔦見 +蔦谷 +蔦野 +蔭 +蔭上 +蔭下 +蔭中 +蔭久 +蔭井 +蔭佐 +蔭割 +蔭原 +蔭地 +蔭地野 +蔭尾 +蔭居 +蔭山 +蔭岡 +蔭島 +蔭川 +蔭平 +蔭木 +蔭本 +蔭村 +蔭東 +蔭浦 +蔭田 +蔭畠 +蔭籔 +蔭薮 +蔭藤 +蔭裡 +蔭西 +蔭角 +蔭谷 +蔭道 +蔭野 +蔭間 +蔵 +蔵ケ崎 +蔵ケ迫 +蔵ノ下 +蔵ノ内 +蔵上 +蔵下 +蔵並 +蔵中 +蔵丸 +蔵之上 +蔵之下 +蔵之内 +蔵之前 +蔵五 +蔵井 +蔵人 +蔵保 +蔵信 +蔵俣 +蔵元 +蔵光 +蔵内 +蔵冨 +蔵冨士 +蔵前 +蔵力 +蔵北 +蔵升 +蔵原 +蔵口 +蔵合 +蔵吉 +蔵品 +蔵園 +蔵土 +蔵地 +蔵坂 +蔵坊 +蔵坐 +蔵坪 +蔵垣 +蔵垣内 +蔵城 +蔵埜 +蔵堀 +蔵場 +蔵増 +蔵多 +蔵多喜 +蔵子 +蔵守 +蔵宗 +蔵密 +蔵富 +蔵富士 +蔵尾 +蔵居 +蔵屋 +蔵屋敷 +蔵山 +蔵岡 +蔵島 +蔵崎 +蔵川 +蔵常 +蔵床 +蔵座 +蔵庵 +蔵当 +蔵後 +蔵成 +蔵戸 +蔵所 +蔵持 +蔵掛 +蔵数 +蔵敷 +蔵方 +蔵時 +蔵木 +蔵本 +蔵杉 +蔵村 +蔵条 +蔵東 +蔵松 +蔵林 +蔵枡 +蔵根 +蔵桝 +蔵條 +蔵森 +蔵楽 +蔵橋 +蔵永 +蔵求 +蔵沢 +蔵河 +蔵治 +蔵津 +蔵浦 +蔵淵 +蔵渕 +蔵満 +蔵滿 +蔵澄 +蔵澤 +蔵瀬 +蔵田 +蔵町 +蔵畑 +蔵留 +蔵當 +蔵盛 +蔵矢 +蔵知 +蔵石 +蔵積 +蔵立 +蔵端 +蔵竹 +蔵納 +蔵脇 +蔵腰 +蔵舛 +蔵薗 +蔵藤 +蔵行 +蔵西 +蔵見 +蔵角 +蔵谷 +蔵貫 +蔵越 +蔵辻 +蔵迫 +蔵道 +蔵部 +蔵里 +蔵重 +蔵野 +蔵野下 +蔵録 +蔵長 +蔵間 +蔵隅 +蔵面 +蕀木 +蕃 +蕃建 +蕃本 +蕎原 +蕎原屋 +蕎麥田 +蕎麦切 +蕎麦田 +蕎麦谷 +蕏塚 +蕗 +蕗上 +蕗井 +蕗原 +蕗沢 +蕗澤 +蕗田 +蕗谷 +蕗野 +蕚 +蕪 +蕪内 +蕪名 +蕪城 +蕪尻 +蕪尾 +蕪山 +蕪岡 +蕪崎 +蕪川 +蕪木 +蕪田 +蕪竹 +蕪迫 +蕪野 +薄 +薄ケ谷 +薄上 +薄久保 +薄井 +薄倉 +薄元 +薄出 +薄刃 +薄坂 +薄場 +薄墨 +薄尾 +薄尾屋 +薄山 +薄岩 +薄島 +薄川 +薄平 +薄月 +薄木 +薄本 +薄根 +薄永 +薄沢 +薄波 +薄田 +薄石 +薄窪 +薄竹 +薄網 +薄羽 +薄葉 +薄衣 +薄谷 +薄野 +薄金 +薄鍋 +薄隅 +薄雲 +薊 +薊野 +薑 +薗 +薗井 +薗内 +薗出 +薗原 +薗口 +薗尾 +薗山 +薗崎 +薗川 +薗村 +薗林 +薗浦 +薗田 +薗畑 +薗畠 +薗辺 +薗邉 +薗部 +薗頭 +薙沢 +薙澤 +薙野 +薜 +薢屋 +薢津 +薤沢 +薤澤 +薦口 +薦岡 +薦池 +薦渕 +薦田 +薦野 +薩 +薩井 +薩佐 +薩來 +薩埜 +薩埵 +薩川 +薩广 +薩摩 +薩摩林 +薩摩谷 +薩日内 +薩木 +薩本 +薩来 +薩澤 +薩田 +薩砂 +薩美 +薩耒 +薩見 +薩谷 +薩野 +薩間 +薩麻 +薪 +薪先 +薪塩 +薪木 +薪浦 +薪田 +薪谷 +薫 +薫成 +薫森 +薫田 +薫陸 +薬 +薬丸 +薬井 +薬内 +薬司 +薬子 +薬寿 +薬師 +薬師丸 +薬師地 +薬師堂 +薬師寺 +薬師山 +薬師川 +薬師時 +薬師村 +薬師浦 +薬師田 +薬師神 +薬師院 +薬志 +薬本 +薬沢 +薬澤 +薬王 +薬王寺 +薬王樹 +薬田 +薬眞寺 +薬真寺 +薬研 +薬研地 +薬研寺 +薬種 +薬袋 +薬谷 +薬野 +薮 +薮ケ崎 +薮ノ +薮ノ下 +薮ノ内 +薮ノ本 +薮上 +薮下 +薮並 +薮中 +薮之内 +薮之本 +薮亀 +薮井 +薮仲 +薮元 +薮兼 +薮内 +薮出 +薮前 +薮原 +薮口 +薮名香 +薮地 +薮坂 +薮垣 +薮堀 +薮塚 +薮山 +薮山田 +薮岡 +薮岸 +薮島 +薮崎 +薮嵜 +薮嶒 +薮川 +薮床 +薮影 +薮押 +薮木 +薮本 +薮村 +薮林 +薮根 +薮植 +薮永 +薮江 +薮沢 +薮波 +薮添 +薮渕 +薮田 +薮端 +薮納 +薮脇 +薮腰 +薮花 +薮裏 +薮西 +薮見 +薮谷 +薮越 +薮辻 +薮野 +薮長 +薮阪 +薮際 +薶輪 +薹 +薹堂 +薹木 +薺場 +薺籐 +薺藤 +藍 +藍京 +藍元 +藍原 +藍口 +藍場 +藍家 +藍岡 +藍島 +藍崎 +藍川 +藍木 +藍染 +藍森 +藍沢 +藍河 +藍澤 +藍田 +藍畑 +藍葉 +藍谷 +藍郷 +藍野 +藍順 +藏 +藏ケ崎 +藏ノ下 +藏上 +藏下 +藏並 +藏中 +藏丸 +藏之下 +藏之内 +藏之前 +藏五 +藏井 +藏俣 +藏元 +藏光 +藏内 +藏冨 +藏前 +藏原 +藏口 +藏合 +藏吉 +藏品 +藏園 +藏地 +藏坐 +藏坪 +藏垣 +藏垣内 +藏城 +藏堀 +藏増 +藏守 +藏密 +藏富 +藏尾 +藏屋 +藏屋敷 +藏山 +藏岡 +藏島 +藏崎 +藏川 +藏座 +藏戸 +藏所 +藏持 +藏掛 +藏敷 +藏方 +藏本 +藏杉 +藏村 +藏東 +藏林 +藏根 +藏條 +藏森 +藏楽 +藏樂 +藏橋 +藏永 +藏治 +藏津 +藏淵 +藏渕 +藏満 +藏滿 +藏澄 +藏澤 +藏田 +藏町 +藏留 +藏當 +藏盛 +藏知 +藏石 +藏立 +藏端 +藏納 +藏脇 +藏薗 +藏藤 +藏西 +藏見 +藏角 +藏谷 +藏貫 +藏迫 +藏道 +藏部 +藏重 +藏野 +藏長 +藏面 +藜 +藡野 +藤 +藤々木 +藤の木 +藤ケ崎 +藤ケ嵜 +藤ケ枝 +藤ケ森 +藤ケ谷 +藤ノ井 +藤ノ原 +藤ノ木 +藤ヰ +藤三 +藤上 +藤下 +藤世 +藤丘 +藤並 +藤中 +藤丸 +藤主 +藤乃 +藤乃井 +藤乃巻 +藤久 +藤久保 +藤之原 +藤之氏 +藤乗 +藤乘 +藤九 +藤亀 +藤五 +藤井 +藤井山 +藤井本 +藤井田 +藤仙 +藤代 +藤仲 +藤伊 +藤会 +藤位 +藤住 +藤佐 +藤佐原 +藤作 +藤來 +藤保 +藤信 +藤俣 +藤倉 +藤側 +藤元 +藤先 +藤光 +藤八 +藤六 +藤具 +藤兼 +藤内 +藤冨 +藤出 +藤分 +藤利 +藤則 +藤前 +藤力 +藤助 +藤勝 +藤北 +藤升 +藤南 +藤卷 +藤原 +藤又 +藤友 +藤収 +藤口 +藤古 +藤司 +藤吉 +藤名 +藤向 +藤吾 +藤和 +藤咲 +藤善 +藤喜 +藤嗣 +藤国 +藤國 +藤園 +藤土 +藤地 +藤坂 +藤坪 +藤垣 +藤城 +藤埜 +藤埜原 +藤域 +藤基 +藤埼 +藤堂 +藤場 +藤塚 +藤増 +藤墳 +藤士 +藤壷 +藤壺 +藤多 +藤大 +藤大路 +藤夲 +藤好 +藤妻 +藤子 +藤季 +藤宇 +藤守 +藤安 +藤宗 +藤定 +藤実 +藤室 +藤宮 +藤家 +藤富 +藤實 +藤寺 +藤尾 +藤居 +藤屋 +藤山 +藤岡 +藤岩 +藤岳 +藤岸 +藤峯 +藤峰 +藤島 +藤崎 +藤嵜 +藤嶋 +藤嶌 +藤嶺 +藤嶽 +藤川 +藤巴 +藤巻 +藤幡 +藤平 +藤平田 +藤平蔵 +藤幸 +藤幹 +藤広 +藤座 +藤庭 +藤庵 +藤廣 +藤延 +藤弘 +藤弥 +藤彌 +藤当 +藤形 +藤彦 +藤後 +藤得 +藤志水 +藤恵 +藤惠 +藤懸 +藤懿 +藤成 +藤戸 +藤抜 +藤掛 +藤支 +藤政 +藤敦 +藤斉 +藤斎 +藤新 +藤方 +藤旗 +藤明 +藤春 +藤時 +藤景 +藤曲 +藤曽 +藤會 +藤月 +藤木 +藤末 +藤本 +藤朶 +藤村 +藤束 +藤条 +藤来 +藤東 +藤松 +藤板 +藤林 +藤枝 +藤枡 +藤柳 +藤柴 +藤栄 +藤栩 +藤株 +藤根 +藤根井 +藤桐 +藤桝 +藤條 +藤棚 +藤森 +藤植 +藤楠 +藤極 +藤榎 +藤榮 +藤槻 +藤樌 +藤樫 +藤樹 +藤橋 +藤欠 +藤次 +藤正 +藤武 +藤永 +藤江 +藤池 +藤沖 +藤沢 +藤河 +藤河家 +藤沼 +藤泉 +藤法 +藤波 +藤津 +藤浜 +藤浦 +藤浪 +藤浴 +藤海 +藤涛 +藤淵 +藤添 +藤渓 +藤渕 +藤渡 +藤満 +藤源 +藤溪 +藤滝 +藤澤 +藤濤 +藤濱 +藤瀧 +藤瀬 +藤熊 +藤牧 +藤猪 +藤玉 +藤王 +藤生 +藤田 +藤田屋 +藤由 +藤畑 +藤畝 +藤畠 +藤當 +藤登 +藤白 +藤盛 +藤目 +藤直 +藤真 +藤矢 +藤知 +藤石 +藤砂 +藤社 +藤秀 +藤科 +藤稿 +藤窪 +藤立 +藤端 +藤竹 +藤竿 +藤笠 +藤笹 +藤箕 +藤範 +藤籔 +藤米田 +藤納 +藤絵 +藤続 +藤綱 +藤縄 +藤繁 +藤繩 +藤續 +藤纒 +藤美 +藤義 +藤肥 +藤脇 +藤腹 +藤舘 +藤舛 +藤芝 +藤花 +藤芳 +藤芽 +藤若 +藤茂 +藤茂登 +藤荒 +藤葉 +藤葉良 +藤蔵 +藤薮 +藤藁 +藤藪 +藤行 +藤裏 +藤裔 +藤西 +藤見 +藤角 +藤解 +藤記 +藤詰 +藤護 +藤谷 +藤貝 +藤貞 +藤貫 +藤賀 +藤越 +藤路 +藤身 +藤輪 +藤農 +藤辺 +藤辻 +藤近 +藤迫 +藤通 +藤道 +藤達 +藤邉 +藤邊 +藤邑 +藤邦 +藤邨 +藤部 +藤郷 +藤都 +藤里 +藤重 +藤野 +藤野井 +藤野原 +藤野屋 +藤野戸 +藤野木 +藤野本 +藤野谷 +藤金 +藤録 +藤長 +藤門 +藤間 +藤関 +藤關 +藤阪 +藤附 +藤院 +藤陵 +藤隅 +藤隠 +藤雄 +藤雄木 +藤音 +藤飛 +藤飯 +藤館 +藤香 +藤馬 +藤高 +藤鬼 +藤鳥 +藤鷹 +藤鹿 +藤麻 +藤黒 +藤齊 +藥丸 +藥井 +藥内 +藥師 +藥師堂 +藥師寺 +藥師川 +藥師田 +藥師神 +藥師院 +藥澤 +藥王 +藥王寺 +藥眞寺 +藥真寺 +藥袋 +藥谷 +藩 +藩守 +藩田 +藩藤 +藪 +藪ケ崎 +藪ノ +藪ノ内 +藪上 +藪下 +藪並 +藪中 +藪之内 +藪之本 +藪亀 +藪井 +藪仲 +藪元 +藪兼 +藪内 +藪前 +藪北 +藪原 +藪口 +藪名香 +藪地 +藪坂 +藪垣 +藪塚 +藪山田 +藪岡 +藪岸 +藪島 +藪崎 +藪嵜 +藪川 +藪影 +藪押 +藪木 +藪本 +藪林 +藪根 +藪植 +藪永 +藪江 +藪添 +藪田 +藪端 +藪納 +藪脇 +藪腰 +藪花 +藪西 +藪見 +藪谷 +藪越 +藪辻 +藪野 +藪長 +藪馬 +藺上 +藺古田 +藺守 +藺幡 +藺弁田 +藺月 +藺森 +藺沼江 +藺牟田 +藺生 +藺田 +藺草 +藺藤 +藻井 +藻利 +藻原 +藻垣 +藻塩 +藻寄 +藻島 +藻川 +藻形 +藻淵 +藻登知 +藻谷 +藻越 +蘆住 +蘆刈 +蘆原 +蘆名 +蘆塚 +蘆家 +蘆尾 +蘆屋 +蘆岡 +蘆崎 +蘆川 +蘆月 +蘆村 +蘆沢 +蘆澤 +蘆田 +蘆立 +蘆苅 +蘆谷 +蘆邉 +蘆野 +蘇 +蘇原 +蘇和 +蘇山 +蘇川 +蘇我 +蘇我原 +蘇木 +蘇来 +蘇武 +蘇河 +蘇理 +蘇田 +蘇畑 +蘇要 +蘇谷 +蘇野辺 +蘇鉄 +蘇鉄本 +蘇馬 +蘒原 +蘓 +蘓原 +蘓和 +蘓我原 +蘓村 +蘓来 +蘓武 +蘓理 +蘓畑 +蘓野 +蘓野邉 +蘓鉄 +蘭 +蘭牟田 +蘭草 +蘿 +虎 +虎上 +虎丘 +虎丸 +虎井 +虎伏 +虎前 +虎取 +虎口 +虎吉 +虎地 +虎城 +虎尾 +虎居 +虎屋 +虎山 +虎岡 +虎岩 +虎島 +虎崎 +虎嶋 +虎川 +虎戸 +虎本 +虎杖 +虎松 +虎林 +虎枝 +虎沢 +虎津 +虎清 +虎渓 +虎渡 +虎溪 +虎澤 +虎瀬 +虎熊 +虎田 +虎石 +虎竹 +虎若 +虎西 +虎見 +虎谷 +虎走 +虎野 +虎間 +虎頭 +虎餘 +處 +處谷 +虫上 +虫壁 +虫島 +虫明 +虫本 +虫狩 +虫生 +虫谷 +虫賀 +虫辺 +虫邉 +虫野 +虫鹿 +虷沢 +虷澤 +虹富 +虹林 +虹羅 +虹釜 +虻崎 +虻川 +虻江 +虻田 +蚊口 +蚊屋 +蚊崎 +蚊帳 +蚊戸 +蚊村 +蚊津見 +蚊爪 +蚊田 +蚊谷 +蚊谷野 +蚊野 +蚫谷 +蛇ケ崎 +蛇ケ鼻 +蛇ノ目 +蛇丸 +蛇原 +蛇口 +蛇喰 +蛇園 +蛇場見 +蛇塚 +蛇好 +蛇子 +蛇山 +蛇岩 +蛇島 +蛇嶋 +蛇川 +蛇平 +蛇抜 +蛇持 +蛇本 +蛇森 +蛇池 +蛇沢 +蛇沼 +蛇淵 +蛇渕 +蛇澤 +蛇田 +蛇目 +蛇石 +蛇穴 +蛇端 +蛇艸 +蛇草 +蛇蝮 +蛇見 +蛇谷 +蛇走 +蛇迫 +蛍原 +蛎久 +蛎原 +蛎埼 +蛎屋 +蛎崎 +蛎瀬 +蛎灰谷 +蛎田 +蛙前 +蛙田 +蛙石 +蛙間 +蛤 +蛤谷 +蛦美 +蛭 +蛭ケ谷 +蛭井 +蛭原 +蛭可 +蛭名 +蛭坂 +蛭多 +蛭子 +蛭子井 +蛭子屋 +蛭子本 +蛭子谷 +蛭子野 +蛭崎 +蛭川 +蛭本 +蛭池 +蛭沢 +蛭沼 +蛭波 +蛭浜 +蛭海 +蛭澤 +蛭濱 +蛭牟田 +蛭田 +蛭町 +蛭薙 +蛭藻 +蛭谷 +蛭野 +蛭間 +蛯原 +蛯名 +蛯壽 +蛯子 +蛯寿 +蛯川 +蛯江 +蛯沢 +蛯澤 +蛯田 +蛯谷 +蛸 +蛸之内 +蛸井 +蛸島 +蛸嶋 +蛸川 +蛸星 +蛸瀬 +蛸積 +蛸背 +蛸谷 +蜂 +蜂ケ崎 +蜂単 +蜂尾 +蜂屋 +蜂川 +蜂巣 +蜂木 +蜂矢 +蜂箇 +蜂谷 +蜂賀 +蜂起 +蜂野 +蜂須 +蜂須賀 +蜅沢 +蜅澤 +蜆 +蜘手 +蜘渡 +蜜井 +蜜原 +蜜口 +蜜山 +蜜岡 +蜜川 +蜜本 +蜜柑 +蜜柑山 +蜜沢 +蜜波羅 +蜜浦 +蜜澤 +蜜田 +蜜石 +蜜谷 +蜷尾 +蜷川 +蜷木 +蜷津 +蜷谷 +蝉 +蝉丸 +蝉塚 +蝉尾 +蝉岡 +蝉川 +蝉平 +蝉本 +蝉谷 +蝦 +蝦原 +蝦名 +蝦夷森 +蝦子 +蝦沢 +蝦澤 +蝦田 +蝦草 +蝦谷 +蝶 +蝶々 +蝶勢 +蝶名林 +蝶多 +蝶子 +蝶採 +蝶谷 +蝶野 +蝶間林 +蝼川内 +蝿原 +蝿庭 +蝿田 +蝿野 +融 +螢原 +螧原 +螧沢 +螧澤 +螺 +螺山 +螺沢 +螺澤 +螺良 +螻 +螻川内 +螻田 +蟇田 +蟇目 +蟬川 +蟲明 +蟹 +蟹久保 +蟹井 +蟹原 +蟹口 +蟹和 +蟹守 +蟹屋敷 +蟹山 +蟹川 +蟹巻 +蟹庵 +蟹本 +蟹江 +蟹池 +蟹沢 +蟹沢川 +蟹澤 +蟹澤川 +蟹瀬 +蟹田 +蟹由 +蟹藤 +蟹谷 +蟹野 +蟻ケ崎 +蟻ケ谷 +蟻井 +蟻原 +蟻取 +蟻坂 +蟻塚 +蟻岡 +蟻川 +蟻戸 +蟻末 +蟻本 +蟻柴 +蟻正 +蟻沢 +蟻波 +蟻浪 +蟻渓 +蟻生 +蟻田 +蟻義 +蟻芝 +蟻谷 +蟻通 +蟻道 +蟻馬 +蠅原 +蠅庭 +蠅田 +蠅野 +蠏 +蠏本 +蠏江 +蠣久 +蠣原 +蠣埼 +蠣崎 +蠣橋 +蠣瀬 +蠣灰谷 +蠣田 +血分 +血原 +血矢 +血脇 +血野 +衆徒 +衆樹 +衆田 +行 +行上 +行久 +行之内 +行事 +行井 +行京 +行仕 +行俊 +行保 +行信 +行元 +行光 +行入 +行円 +行冨 +行則 +行力 +行原 +行友 +行司 +行司谷 +行合 +行吉 +行名 +行圓 +行地 +行基 +行場 +行堵 +行壽 +行天 +行好 +行守 +行安 +行宗 +行定 +行実 +行富 +行實 +行寿 +行山 +行岡 +行島 +行嶋 +行川 +行常 +行平 +行年 +行広 +行廣 +行延 +行弘 +行形 +行待 +行徳 +行成 +行政 +行方 +行旨 +行時 +行木 +行末 +行本 +行村 +行松 +行林 +行枝 +行枩 +行梅 +行森 +行橋 +行正 +行武 +行歩 +行比 +行永 +行沢 +行泊 +行澤 +行燈 +行田 +行町 +行竹 +行縄 +行繩 +行羅 +行者 +行舎 +行舩 +行船 +行藤 +行衛 +行譜 +行谷 +行貝 +行貞 +行足 +行近 +行迫 +行道 +行部 +行部沢 +行部澤 +行里 +行重 +行野 +行長 +行騰 +術勢 +街 +街田 +街道 +街風 +衛 +衛士野 +衛守 +衛川 +衛本 +衛村 +衛湖原 +衛籐 +衛藤 +衛門 +衞本 +衞籐 +衞藤 +衡山 +衡田 +衣 +衣原 +衣奈 +衣山 +衣川 +衣巻 +衣幡 +衣掛 +衣斐 +衣旗 +衣更着 +衣本 +衣松 +衣沢 +衣浦 +衣澤 +衣田 +衣畑 +衣目 +衣目川 +衣知川 +衣笠 +衣簱 +衣籏 +衣袋 +衣裴 +衣谷 +衣越 +衣輪 +衣里 +衣陰 +衣非 +衣鳩 +表 +表上 +表井 +表側 +表具 +表内 +表出 +表利 +表前 +表原 +表口 +表地 +表家 +表寺 +表屋 +表山 +表崎 +表嶋 +表川 +表敷 +表木 +表本 +表村 +表森田 +表江 +表河内 +表浦 +表田 +表神明 +表紙口 +表藤 +表西 +表見 +表谷 +表迫 +表野 +表野谷 +衲 +衿木 +衿立 +袂井 +袈装丸 +袈裟丸 +袈裟田 +袋 +袋井 +袋住 +袋口 +袋地 +袋尻 +袋屋 +袋山 +袋崎 +袋布 +袋本 +袋楽 +袋江 +袋瀬 +袋田 +袋畑 +袋畠 +袋舘 +袋良 +袋谷 +袋路 +袋辺 +袋野 +袖 +袖ケ市 +袖ケ浦 +袖上 +袖下 +袖中 +袖中居 +袖之 +袖井 +袖口 +袖吉 +袖垣 +袖城 +袖子田 +袖屋 +袖山 +袖岡 +袖島 +袖崎 +袖嵜 +袖嶋 +袖川 +袖平 +袖木 +袖本 +袖村 +袖林 +袖森 +袖永 +袖沢 +袖浦 +袖澗 +袖澤 +袖田 +袖脇 +袖裂 +袖谷 +袖達 +袖野 +袖長 +被官 +袰主 +袰地 +袰屋 +袰岩 +袰川 +袰田 +袰綿 +袰谷 +袰野 +袰高 +袴 +袴垂 +袴塚 +袴家 +袴座 +袴田 +袴着 +袴矢 +袴見 +袴谷 +裁 +裁原 +裁頭 +裏 +裏中 +裏久保 +裏井 +裏住 +裏出 +裏前 +裏加 +裏南 +裏口 +裏地 +裏坂 +裏垣 +裏家 +裏山 +裏岡 +裏崎 +裏川 +裏巽 +裏戸 +裏政 +裏木 +裏本 +裏村 +裏東 +裏松 +裏橋 +裏正 +裏江 +裏沢 +裏河 +裏滝 +裏澤 +裏田 +裏町 +裏西 +裏見 +裏谷 +裏辺 +裏辻 +裏道 +裏部 +裏野 +裏鍛 +裏門 +裏間 +裏隠居 +裕勢 +裕島 +裕川 +裕平 +裕谷 +裕野 +裙坂 +裙本 +補伽 +補山 +補永 +補沓 +補泉 +補田 +補陀 +裡田 +裸 +裸野 +裾分 +裾野 +褒沢 +褒澤 +襖田 +襟川 +襟立 +襟谷 +襲 +襲山 +襲田 +西 +西ケ塙 +西ケ峯 +西ケ峰 +西ケ市 +西ケ広 +西ケ廣 +西ケ花 +西ケ谷 +西ケ谷内 +西ケ迫 +西ケ野 +西ケ開 +西ノ +西ノ上 +西ノ入 +西ノ内 +西ノ原 +西ノ園 +西ノ坊 +西ノ宮 +西ノ平 +西ノ明 +西ノ本 +西ノ村 +西ノ段 +西ノ浦 +西ノ薗 +西ノ谷 +西ノ首 +西丁 +西万 +西上 +西上原 +西上床 +西下 +西世古 +西並 +西中 +西中園 +西中山 +西中川 +西中村 +西中薗 +西中野 +西中間 +西中須 +西丸 +西乃 +西久保 +西久松 +西之上 +西之下 +西之入 +西之内 +西之前 +西之原 +西之園 +西之坊 +西之宮 +西之川 +西之村 +西之段 +西之浜 +西之濱 +西之腰 +西之薗 +西之谷 +西之辻 +西之野 +西亀 +西二町 +西五辻 +西井 +西井上 +西井戸 +西井田 +西亦 +西京 +西亭 +西仏 +西代 +西仮屋 +西仲 +西仲野 +西仲間 +西任 +西位 +西住 +西佐古 +西佐小 +西佛 +西來 +西依 +西保 +西保手 +西保木 +西信 +西俣 +西倉 +西倚 +西側 +西元 +西元寺 +西先 +西光 +西光寺 +西入 +西入野 +西八条 +西八條 +西兼 +西兼盛 +西内 +西冨 +西出 +西出谷 +西分 +西別府 +西別当 +西別當 +西前 +西前津 +西前田 +西前門 +西割 +西加 +西加治工 +西勝 +西北 +西半 +西占 +西卷 +西原 +西原口 +西又 +西友 +西受 +西口 +西古 +西古家 +西古屋 +西台 +西合 +西吉 +西吉原 +西名 +西向 +西向井 +西向寺 +西周 +西和久 +西和田 +西咲 +西喜 +西喜多 +西嘉山 +西四辻 +西国 +西国原 +西国領 +西囿 +西國 +西國原 +西國領 +西園 +西園寺 +西圓 +西土 +西土井 +西土居 +西在家 +西地 +西坂 +西坊 +西坪 +西垂水 +西垣 +西垣内 +西垣外 +西垣戸 +西垣津 +西埀水 +西城 +西城戸 +西埜 +西埜植 +西域 +西堀 +西堂 +西堂園 +西堂路 +西堤 +西堰 +西場 +西塔 +西塘 +西塙 +西塚 +西境 +西増 +西墻 +西壅 +西外 +西多 +西夛 +西大 +西大井 +西大条 +西大桝 +西大條 +西大濱 +西大立目 +西大絛 +西大舛 +西大路 +西天 +西太 +西奈 +西奈美 +西奥 +西奥間 +西奧 +西妻 +西子 +西宇 +西宇根 +西宇治 +西守 +西安 +西宗 +西室 +西室田 +西宮 +西家 +西寄 +西寅 +西富 +西寒水 +西寺 +西小倉 +西小原 +西小城 +西小森 +西小路 +西小部 +西小野 +西尻 +西尾 +西尾福 +西居 +西屋 +西屋敷 +西屋舗 +西屋鋪 +西山 +西山口 +西山本 +西山田 +西岐 +西岡 +西岡山 +西岡田 +西岩 +西岳 +西岸 +西峠 +西峪 +西峯 +西峰 +西島 +西島本 +西崎 +西嵜 +西嶋 +西嶌 +西嶺 +西嶽 +西川 +西川内 +西川原 +西川端 +西川路 +西工 +西巻 +西市 +西帯野 +西帶野 +西幅 +西幡 +西平 +西平田 +西平賀 +西幸 +西幹 +西広 +西庄 +西府 +西座 +西庵 +西廣 +西廻 +西廼 +西弘 +西張 +西当 +西形 +西影 +西後 +西御建田 +西御立田 +西御門 +西志村 +西応 +西念 +西性 +西應 +西懸 +西成 +西成田 +西戸 +西房 +西所 +西手 +西持田 +西指 +西掘 +西改 +西政 +西教 +西新 +西新居 +西新屋 +西新田 +西方 +西方井 +西方路 +西早 +西明 +西明地 +西明寺 +西星 +西春 +西是 +西有 +西有留 +西木 +西木場 +西木戸 +西末 +西本 +西本比田 +西杉 +西杉山 +西村 +西条 +西杢比野 +西来 +西来路 +西東 +西松 +西林 +西林寺 +西枝 +西柳 +西柴 +西栄 +西栗 +西栫 +西根 +西桐 +西桜 +西桶 +西梅 +西條 +西梨子 +西梶 +西棟 +西森 +西植 +西極 +西楽 +西榎田 +西槇 +西槙 +西樂 +西橋 +西機 +西櫻 +西正 +西武 +西武当 +西武當 +西段 +西殿 +西毛 +西氏 +西水 +西水流 +西氷 +西永 +西江 +西江口 +西江園 +西池 +西沖 +西沢 +西河 +西河内 +西河原 +西治 +西沼 +西泉 +西泊 +西法司 +西波 +西波照間 +西泰 +西洞 +西洞院 +西津 +西浄 +西浜 +西浜門 +西浦 +西浪 +西浴 +西海 +西海土 +西海地 +西海士 +西海持 +西海枝 +西海知 +西海石 +西海谷 +西海道 +西涌 +西深沢 +西深澤 +西淵 +西添 +西済 +西渊 +西渓 +西渕 +西渡 +西湖 +西湧川 +西溜 +西溝 +西溪 +西滝 +西潟 +西澤 +西濃 +西濱 +西瀧 +西瀬 +西瀬古 +西瀬戸 +西灘 +西照 +西熊 +西爪 +西牆 +西片 +西牟田 +西牟礼 +西牟禮 +西牧 +西玉 +西玉得 +西玉栄 +西玉榮 +西王 +西王地 +西生 +西田 +西田中 +西田井 +西田代 +西田原 +西田和 +西田谷 +西町 +西畑 +西畔 +西留 +西畝 +西畠 +西當 +西白保 +西皐 +西盛 +西目 +西眞田 +西真田 +西矢 +西知 +西石 +西石垣 +西硲 +西碕 +西祖 +西神 +西神頭 +西福 +西福元 +西秋 +西科 +西秦 +西稔 +西種 +西種子田 +西積 +西窪 +西立 +西立野 +西端 +西竹 +西笛 +西等 +西筋 +西篠 +西籐 +西籔 +西米 +西粉田 +西紋 +西納 +西組 +西絛 +西網 +西織 +西置 +西羅 +西美 +西羽 +西羽田 +西耒路 +西股 +西肥 +西胤 +西能 +西脇 +西腋 +西腰 +西腹 +西臣 +西臺 +西舘 +西船隈 +西良 +西芝 +西芦谷 +西花 +西若 +西茂 +西草 +西荒井 +西荘 +西菜 +西萩 +西萬 +西落 +西葛 +西蓮地 +西蓮寺 +西蔭 +西蔵 +西蔵当 +西蔵當 +西蔵盛 +西薗 +西薮 +西藏盛 +西藤 +西藪 +西行 +西行谷 +西衛 +西表 +西袋 +西袴田 +西裏 +西見 +西親川 +西角 +西角井 +西角地 +西訪 +西詰 +西諏訪 +西谷 +西谷内 +西谷地 +西豊 +西豊留 +西貝 +西賀 +西越 +西路 +西躰 +西辺 +西辻 +西込 +西迫 +西迺 +西途 +西連地 +西連寺 +西道 +西道口 +西邊 +西邑 +西那 +西邨 +西郊 +西郡 +西部 +西部山 +西郷 +西郷里 +西都 +西釈 +西釋 +西里 +西重 +西野 +西野上 +西野入 +西野内 +西野宮 +西野尾 +西野木 +西野目 +西野花 +西野谷 +西野間 +西金 +西釜 +西銘 +西鍋 +西鍛冶 +西鍛治 +西鍜治 +西鍵 +西長 +西門 +西門前 +西門口 +西開 +西開地 +西間 +西間庭 +西間木 +西関 +西阪 +西阿十 +西陣 +西陰 +西陰地 +西陸 +西隂地 +西隅 +西隈 +西際 +西隠居 +西雄 +西雪 +西青木 +西面 +西須 +西須摩 +西領 +西頭 +西頼 +西願 +西願寺 +西風 +西風田 +西風舘 +西風館 +西飯 +西館 +西首 +西馬 +西馬場 +西馬越 +西駕 +西高 +西高辻 +西鳥 +西鳥羽 +西鶴 +西鶴園 +西鷹 +西黒 +西鼻 +要 +要倉 +要元 +要力 +要名本 +要土 +要地 +要垣内 +要堺 +要害 +要島 +要崎 +要川 +要戸 +要明 +要木 +要村 +要根 +要永 +要津 +要海 +要源 +要田 +要石 +要福地 +要若 +要藤 +要覚 +要谷 +要重 +要野 +要門 +覆地 +覆平 +覇島 +見ノ井 +見ノ木 +見ノ浦 +見ル野 +見一 +見上 +見下 +見世 +見世川 +見世田 +見並 +見之浦 +見之越 +見乗 +見井田 +見付 +見代 +見佐田 +見供 +見保 +見倉 +見儀 +見元 +見先 +見光 +見内 +見冠 +見冨 +見出 +見分 +見初 +見前 +見勢 +見勢井 +見勢本 +見原 +見友 +見取 +見口 +見合 +見吉 +見呂津 +見喜 +見喜田 +見国 +見國 +見土 +見土路 +見坂 +見坊 +見坐地 +見垣 +見城 +見塚 +見塩 +見増 +見壽 +見奈原 +見奈美 +見好 +見子 +見学 +見學 +見定 +見宝 +見室 +見宮 +見家 +見宿 +見寄 +見富 +見寳 +見寺 +見寿 +見小田 +見尾 +見尾田 +見尾谷 +見屋井 +見屋本 +見山 +見岡 +見岳 +見島 +見崎 +見嵜 +見嶋 +見嶽 +見川 +見市 +見常 +見平 +見年 +見年代 +見広 +見座 +見座垣内 +見座田 +見廣 +見延 +見弓 +見張 +見当 +見当押 +見形 +見影 +見戸 +見手倉 +見持 +見持田 +見掛 +見方 +見明 +見春 +見月 +見木 +見本 +見杉 +見村 +見条 +見松 +見林 +見染 +見根 +見條 +見森 +見植 +見楚谷 +見機 +見次 +見正 +見武 +見水 +見永 +見汐 +見沢 +見沢谷 +見河 +見波 +見津 +見津田 +見浦 +見浪 +見海 +見渡 +見満 +見滝 +見潮 +見澤 +見澤谷 +見瀧 +見瀬 +見片 +見物 +見玉 +見理 +見生 +見田 +見田村 +見田野 +見由 +見畑 +見留 +見當 +見當押 +見目 +見眞地 +見真地 +見矢 +見矢木 +見矢野 +見知 +見砂 +見神 +見秋 +見立 +見立坂 +見立屋 +見竜 +見竹 +見築 +見籐 +見米 +見継 +見置 +見義 +見舘 +見船 +見良津 +見藤 +見西 +見覚 +見角 +見谷 +見貞 +見賀 +見越 +見辺 +見込 +見通 +見連場 +見道 +見達 +見邉 +見邊 +見邨 +見郷 +見酉 +見里 +見野 +見野瀬 +見野越 +見野部 +見録 +見鏡 +見門 +見間 +見阪 +見附 +見陣 +見陰 +見雪 +見須 +見須奈 +見高 +見鳥 +見鷹 +見黒 +規井 +規味木 +規家 +規工川 +規木 +規矩 +規矩一 +規矩地 +規矩智 +規矩田 +規短智 +覐元 +覗 +覗埜 +覗岩 +覗渕 +覗見 +覚 +覚上 +覚井 +覚來 +覚元 +覚内 +覚前 +覚名 +覚地 +覚城 +覚埜 +覚堂 +覚山 +覚島 +覚川 +覚幸 +覚張 +覚心 +覚成 +覚方 +覚明 +覚末 +覚本 +覚来 +覚正 +覚永 +覚王 +覚王地 +覚田 +覚知 +覚道 +覚野 +覚間 +覚音 +覧村 +親 +親上 +親井 +親元 +親家 +親富 +親富祖 +親崎 +親川 +親木 +親本 +親松 +親林 +親泊 +親田 +親盛 +親衛 +親見 +親谷 +親跡 +親道 +親部 +親里 +観 +観世 +観城 +観堂 +観寺 +観山 +観峰 +観崎 +観月 +観木 +観海 +観無 +観田 +観盥 +観興寺 +観行 +観野 +観音 +観音堂 +観音寺 +観音林 +覺井 +覺來 +覺前 +覺地 +覺川 +覺幸 +覺張 +覺心 +覺明 +覺本 +覺正 +覺永 +覺田 +覺知 +覺道 +覺野 +覺間 +觀堂 +觀崎 +觀帆 +觀田 +觀音寺 +角 +角ケ谷 +角ノ上 +角㟢 +角一 +角七 +角三 +角上 +角下 +角中 +角丸 +角久 +角久間 +角之上 +角之倉 +角之園 +角之薗 +角乢 +角二 +角五 +角井 +角亦 +角仏 +角住 +角佛 +角保 +角倉 +角元 +角先 +角光 +角免 +角入 +角内 +角出 +角分 +角前 +角力 +角力山 +角勝 +角北 +角南 +角原 +角友 +角取 +角口 +角台 +角吉 +角名 +角和 +角国 +角囿 +角園 +角地 +角地山 +角坂 +角垣 +角垣内 +角城 +角埜 +角堀 +角堂 +角場 +角増 +角大鳥居 +角太 +角子 +角守 +角安 +角宮 +角家 +角富 +角尻 +角尾 +角居 +角屋 +角屋敷 +角山 +角岡 +角岸 +角島 +角崎 +角嶋 +角川 +角川目 +角巻 +角市 +角常 +角幡 +角平 +角広 +角床 +角庵 +角廣 +角張 +角当 +角心 +角戸 +角房 +角所 +角折 +角指 +角振 +角掛 +角政 +角新 +角方 +角日 +角替 +角木 +角末 +角本 +角杉 +角村 +角来 +角松 +角林 +角柄 +角柳 +角柿 +角栗 +角桶 +角森 +角楯 +角樋 +角橋 +角正 +角水 +角永 +角江 +角池 +角沖 +角沢 +角河 +角波 +角津 +角津田 +角浜 +角浦 +角海 +角淵 +角渕 +角湯 +角澤 +角濱 +角瀬 +角熊 +角玄 +角玉 +角田 +角田川 +角甲 +角町 +角畑 +角畠 +角登 +角皆 +角目 +角眞 +角真 +角矢 +角石 +角秋 +角穴 +角竜 +角端 +角竹 +角筈 +角納 +角縁 +角羽 +角耒 +角能 +角脇 +角至 +角舎 +角舘 +角舛 +角花 +角藤 +角西 +角見 +角谷 +角貝 +角越 +角軒 +角辻 +角道 +角邑 +角部 +角釈 +角釋 +角重 +角野 +角金 +角銅 +角門 +角間 +角間崎 +角阪 +角陸 +角頼 +角館 +角馬 +角高 +角鹿 +角鼻 +角龍 +觜 +觜崎 +觜本 +解 +解川 +解江 +解田 +解良 +解語 +解野 +触 +触井園 +触沢 +触澤 +觧良 +觴谷 +觸 +觸井園 +觸澤 +言 +言上 +言後 +言根 +言水 +言美 +言野 +計 +計倉 +計屋 +計山 +計田 +計盛 +計石 +計羽 +計良 +計良田 +計見 +計谷 +計野 +計馬 +訓覇 +訓谷 +託 +託摩 +託見 +託間 +託麻 +記 +記井 +記伊 +記内 +記円 +記原 +記圓 +記対 +記島 +記州 +記平 +記本 +記村 +記田 +記藤 +記虎 +記谷 +記野 +記録 +設和 +設楽 +設樂 +設水 +設永 +設田 +許勢 +許士 +許安 +許宮 +許山 +許斐 +許本 +許村 +許沢 +許田 +許野見 +詍高 +詠 +詠村 +詠田 +詣坂 +詩丘 +詩叶 +詩谷 +詫 +詫广 +詫摩 +詫田 +詫磨 +詫間 +詫麻 +詰丸 +詰光 +詰坂 +詰田 +詰石 +誂子 +誉 +誉功路 +誉士太 +誉多 +誉川 +誉本 +誉田 +誉美 +誓 +誓山 +誓斉 +誓斎 +誘市 +語堂 +語田 +誠井 +誠光 +誠和 +誠道 +説 +説田 +読山 +読谷山 +誰角 +誾野 +調 +調子 +調所 +調月 +調枝 +談中 +談儀 +談山 +談岐 +談義 +談義所 +談議 +談議所 +談谷 +請 +請井 +請元 +請園 +請地 +請島 +請川 +請村 +請河 +請田 +請畑 +請盛 +請舛 +請花 +請蔵 +請薗 +請藏 +請谷 +請野 +請関 +諌元 +諌原 +諌山 +諌崎 +諌川 +諌早 +諌本 +諌武 +諌田 +諌見 +諏佐 +諏先 +諏内 +諏原 +諏合 +諏和 +諏坂 +諏山 +諏崎 +諏川 +諏方 +諏江 +諏沢 +諏澤 +諏田 +諏藤 +諏訪 +諏訪下 +諏訪井 +諏訪元 +諏訪免 +諏訪内 +諏訪前 +諏訪原 +諏訪園 +諏訪坂 +諏訪多 +諏訪山 +諏訪崎 +諏訪戸 +諏訪木 +諏訪本 +諏訪村 +諏訪林 +諏訪田 +諏訪脇 +諏訪薗 +諏訪辺 +諏訪邉 +諏訪邊 +諏訪部 +諏訪野 +諏訪間 +諏郷 +諦乗 +諧 +諫元 +諫原 +諫山 +諫崎 +諫川 +諫早 +諫本 +諫武 +諫田 +諫見 +諭山 +諱 +諸 +諸上 +諸中 +諸久元 +諸事 +諸井 +諸伏 +諸住 +諸佐 +諸元 +諸冨 +諸原 +諸口 +諸吉 +諸和 +諸喜多 +諸喜田 +諸国 +諸國 +諸坂 +諸塚 +諸墨 +諸多 +諸宇 +諸室 +諸家 +諸寄 +諸富 +諸尾 +諸屋 +諸山 +諸岡 +諸岩 +諸岸 +諸島 +諸崎 +諸嶋 +諸川 +諸平 +諸徳寺 +諸我 +諸戸 +諸房 +諸持 +諸明 +諸星 +諸月 +諸木 +諸本 +諸杉 +諸松 +諸林 +諸根 +諸槁 +諸橋 +諸正 +諸武 +諸永 +諸江 +諸沢 +諸河 +諸治 +諸泉 +諸洞 +諸澄 +諸澤 +諸瀬 +諸熊 +諸田 +諸町 +諸留 +諸白 +諸石 +諸積 +諸節 +諸菱 +諸葛 +諸蔵 +諸藤 +諸見 +諸見川 +諸見田 +諸見謝 +諸見里 +諸角 +諸谷 +諸貫 +諸賀 +諸越 +諸農 +諸遊 +諸道 +諸里 +諸野 +諸野脇 +諸鍛冶 +諸鍛治 +諸鍜治 +諸隅 +諸隈 +諸頭 +諸鹿 +諸麥 +諸麦 +諾浦 +謄原 +謄吹 +謄熊 +謄畑 +謙 +謙司 +謙島 +謙志 +講井 +講元 +講免 +講内 +講初 +講堂 +講夫 +講屋 +講崎 +講嵜 +講本 +講武 +講殿 +講神 +謝々比 +謝名 +謝名元 +謝名堂 +謝敷 +謝村 +謝花 +謝賀 +謡口 +謡田 +識名 +識西 +譛岐 +譜久元 +譜久原 +譜久山 +譜久島 +譜久嶺 +譜久村 +譜久盛 +譜久里 +警 +警島 +議 +議波 +譲 +譲原 +譲尾 +譲田 +譲矢 +譲葉 +譲谷 +護 +護国 +護國 +護城 +護堂 +護守 +護山 +護广迫 +護得久 +護所野 +護持 +護摩堂 +護摩所 +護法 +護田 +護神 +護邦 +譽儀 +譽多 +譽田 +讀谷山 +讃井 +讃内 +讃山 +讃岐 +讃岐田 +讃岐谷 +讃木 +讃渡 +讃田 +讃納 +讃良 +讃野 +讓原 +讓葉 +讚井 +讚良 +谷 +谷々 +谷の木 +谷ケ久保 +谷ケ城 +谷ケ崎 +谷ケ窪 +谷ツ田 +谷ノ上 +谷ノ内 +谷ノ口 +谷ノ木 +谷一 +谷上 +谷下 +谷下沢 +谷下澤 +谷下田 +谷中 +谷中田 +谷丸 +谷久 +谷久保 +谷久知 +谷之 +谷之上 +谷之内 +谷之口 +谷之木 +谷也 +谷亀 +谷井 +谷代 +谷仲 +谷会 +谷位 +谷住 +谷佐 +谷佐田 +谷保 +谷信 +谷俣 +谷倉 +谷元 +谷先 +谷光 +谷入 +谷全 +谷兼 +谷内 +谷内上 +谷内下 +谷内元 +谷内出 +谷内前 +谷内口 +谷内向 +谷内坂 +谷内尾 +谷内山 +谷内川 +谷内村 +谷内江 +谷内田 +谷内野 +谷冨 +谷出 +谷分 +谷利 +谷前 +谷加 +谷勝 +谷北 +谷原 +谷原田 +谷友 +谷口 +谷口平野 +谷古 +谷古宇 +谷合 +谷吉 +谷名 +谷向 +谷吹 +谷和 +谷国 +谷國 +谷園 +谷地 +谷地中 +谷地元 +谷地又 +谷地向 +谷地幸 +谷地村 +谷地森 +谷地沼 +谷地田 +谷地畝 +谷地端 +谷地舘 +谷地頭 +谷地館 +谷坂 +谷坊 +谷坪 +谷垣 +谷垣内 +谷城 +谷埜 +谷埼 +谷堂 +谷場 +谷塚 +谷塞 +谷境内 +谷増 +谷多 +谷奥 +谷奧 +谷好 +谷孝 +谷守 +谷安 +谷宗 +谷定 +谷室 +谷宮 +谷家 +谷富 +谷小路 +谷尻 +谷尾 +谷居 +谷屋 +谷屋義 +谷屋舗 +谷山 +谷岡 +谷岩 +谷岸 +谷峯 +谷峰 +谷島 +谷崎 +谷嵐 +谷嵜 +谷嶋 +谷嶌 +谷川 +谷川内 +谷川原 +谷川屋 +谷幡 +谷平 +谷広 +谷底 +谷廣 +谷延 +谷弘 +谷彦 +谷後 +谷成 +谷戸 +谷所 +谷手 +谷掛 +谷政 +谷敷 +谷方 +谷昌 +谷木 +谷木原 +谷末 +谷本 +谷杉 +谷村 +谷束 +谷東 +谷松 +谷林 +谷柿 +谷栖 +谷根 +谷桐 +谷梅 +谷條 +谷森 +谷槇 +谷槙 +谷橋 +谷次 +谷殿 +谷水 +谷永 +谷江 +谷池 +谷沖 +谷沢 +谷河 +谷治 +谷沿 +谷泉 +谷波 +谷津 +谷津倉 +谷津田 +谷浦 +谷淵 +谷添 +谷清 +谷渕 +谷渡 +谷満 +谷源 +谷澤 +谷瀬 +谷為 +谷爲 +谷片 +谷牛 +谷牧 +谷猪 +谷生 +谷田 +谷田内 +谷田川 +谷田沢 +谷田河 +谷田海 +谷田目 +谷田貝 +谷田辺 +谷田部 +谷町 +谷畑 +谷畔 +谷畠 +谷盛 +谷目 +谷相 +谷矢 +谷知 +谷石 +谷神 +谷福 +谷窪 +谷端 +谷笹 +谷筋 +谷米 +谷綛 +谷繁 +谷羽 +谷脇 +谷腰 +谷舗 +谷舞 +谷花 +谷苗 +谷若 +谷茂岡 +谷茶 +谷菅 +谷萩 +谷蔭 +谷藤 +谷藪 +谷裏 +谷西 +谷角 +谷許 +谷詰 +谷谷 +谷貝 +谷貞 +谷賀 +谷越 +谷路 +谷車 +谷輪 +谷辺 +谷辻 +谷迫 +谷通 +谷道 +谷邉 +谷邊 +谷邑 +谷邨 +谷部 +谷部野 +谷郶 +谷郷 +谷酒 +谷里 +谷重 +谷野 +谷野宮 +谷野田 +谷釜 +谷鉄 +谷銀 +谷鋪 +谷長 +谷門 +谷開 +谷間 +谷関 +谷阪 +谷隅 +谷隈 +谷際 +谷音 +谷頭 +谷風 +谷高 +谷鶴 +谷鹿 +谷黒 +谷𦚰 +谺 +谿 +谿口 +谿花 +豁山 +豅 +豆 +豆ケ野 +豆井 +豆佐 +豆原 +豆塚 +豆多 +豆子 +豆山 +豆岡 +豆崎 +豆川 +豆成 +豆本 +豆村 +豆板 +豆柄 +豆沢 +豆澤 +豆生田 +豆田 +豆畑 +豆白 +豆腐谷 +豆若 +豆荒 +豆谷 +豆越 +豆野 +豆鞘 +豊 +豊上 +豊下 +豊世 +豊中 +豊丸 +豊丹生 +豊久 +豊井 +豊仲 +豊住 +豊作 +豊倉 +豊元 +豊内 +豊冨 +豊則 +豊前 +豊加 +豊北 +豊卷 +豊原 +豊口 +豊古 +豊吉 +豊味 +豊咲 +豊喜 +豊国 +豊國 +豊園 +豊地 +豊坂 +豊城 +豊場 +豊塚 +豊増 +豊外 +豊好 +豊子 +豊守 +豊実 +豊宮 +豊富 +豊實 +豊寺 +豊山 +豊岡 +豊岳 +豊峯 +豊峰 +豊島 +豊崎 +豊嵜 +豊嶋 +豊嶌 +豊嶽 +豊川 +豊州 +豊巻 +豊幡 +豊平 +豊年 +豊幾 +豊広 +豊座 +豊廣 +豊後 +豊後屋 +豊志 +豊成 +豊政 +豊方 +豊日 +豊暉原 +豊朝 +豊木 +豊本 +豊杉 +豊村 +豊東 +豊松 +豊林 +豊枝 +豊枡 +豊柴 +豊栄 +豊栖 +豊根 +豊桑 +豊桝 +豊森 +豊榮 +豊橋 +豊武 +豊歳 +豊民 +豊水 +豊永 +豊永村 +豊池 +豊沢 +豊治 +豊沼 +豊泉 +豊津 +豊洲 +豊浜 +豊浦 +豊浪 +豊海 +豊済 +豊満 +豊滿 +豊澄 +豊澤 +豊濱 +豊瀬 +豊玉 +豊生 +豊用寺 +豊田 +豊田方 +豊由 +豊畑 +豊留 +豊盛 +豊石 +豊福 +豊秀 +豊秋 +豊秦 +豊種 +豊穂 +豊穐 +豊立 +豊竹 +豊米 +豊納 +豊美 +豊胡 +豊臣 +豊良 +豊芝 +豊芦 +豊若 +豊蔵 +豊藏 +豊藤 +豊行 +豊西 +豊見 +豊見坂 +豊見城 +豊見山 +豊見本 +豊見永 +豊見盛 +豊見里 +豊角 +豊谷 +豊貞 +豊貴 +豊買 +豊賀 +豊辺 +豊辻 +豊道 +豊邊 +豊部 +豊郷 +豊里 +豊重 +豊野 +豊野谷 +豊釜 +豊長 +豊開 +豊間 +豊間根 +豊阿弥 +豊隅 +豊饒 +豊馬 +豊高 +豊鳥 +豊鷲見 +豎山 +豎谷 +豎道 +豐原 +豐岳 +豐島 +豐満 +豐田 +豕瀬 +豚座 +象坪 +象山 +象島 +象橋 +象潟 +象瀉 +象谷 +象面 +豪山 +豫城 +豫宮 +豫山 +豫風 +貍塚 +貝 +貝ケ石 +貝ノ瀬 +貝久保 +貝之瀬 +貝井 +貝住 +貝保 +貝元 +貝光 +貝出 +貝原 +貝原塚 +貝取 +貝口 +貝吹 +貝和 +貝喰 +貝坂 +貝堀 +貝塚 +貝塚谷 +貝増 +貝守 +貝家 +貝尻 +貝尾 +貝屋 +貝山 +貝岐 +貝島 +貝崎 +貝嶋 +貝川 +貝市 +貝応 +貝應 +貝戸 +貝持 +貝掛 +貝敷 +貝方士 +貝木 +貝本 +貝村 +貝柄 +貝柾 +貝桝 +貝梅 +貝森 +貝殻 +貝毛 +貝江 +貝沢 +貝沼 +貝津 +貝洲 +貝淵 +貝渕 +貝漕 +貝澄 +貝澤 +貝瀬 +貝灰 +貝生 +貝田 +貝田屋 +貝田谷 +貝畑 +貝発 +貝發 +貝盛 +貝石 +貝磯 +貝羽 +貝舘 +貝良塚 +貝蔵 +貝藏 +貝藤 +貝谷 +貝貫 +貝賀 +貝越 +貝路 +貝辻 +貝迫 +貝通丸 +貝道 +貝野 +貝野瀬 +貝長 +貝間 +貝阪 +貝阿弥 +貝阿彌 +貞 +貞中 +貞丸 +貞久 +貞乗 +貞井 +貞任 +貞住 +貞保 +貞信 +貞元 +貞光 +貞入 +貞兼 +貞内 +貞冨 +貞刈 +貞利 +貞包 +貞升 +貞原 +貞友 +貞吉 +貞名 +貞国 +貞國 +貞孝 +貞守 +貞安 +貞宗 +貞家 +貞富 +貞尾 +貞山 +貞岡 +貞岩 +貞島 +貞嶋 +貞川 +貞常 +貞平 +貞広 +貞廣 +貞弘 +貞形 +貞徳 +貞持 +貞政 +貞方 +貞明 +貞時 +貞木 +貞末 +貞本 +貞村 +貞東 +貞松 +貞森 +貞比良 +貞永 +貞池 +貞清 +貞満 +貞滝 +貞瀧 +貞照 +貞熊 +貞田 +貞由 +貞益 +貞盛 +貞石 +貞神 +貞綱 +貞縄 +貞舛 +貞苅 +貞蔭 +貞藤 +貞行 +貞許 +貞谷 +貞賀 +貞近 +貞重 +貞野 +貞金 +貞長 +貞閑 +貞頼 +負田 +負野 +負門 +財 +財処 +財前 +財原 +財城 +財官 +財家 +財尾 +財崎 +財川 +財布屋 +財徳 +財所 +財方 +財木 +財本 +財来 +財津 +財満 +財滿 +財田 +財目 +財茂 +財藤 +財谷 +財賀 +財辺 +財邉 +財邑 +財部 +財間 +財頭 +財馬 +貢 +貢藤 +貢門 +貨泉 +貫 +貫上 +貫与 +貫井 +貫代 +貫原 +貫名 +貫和 +貫園 +貫地谷 +貫場 +貫塩 +貫奈 +貫定 +貫尾 +貫山 +貫島 +貫戸 +貫木 +貫橋 +貫永 +貫江 +貫沢 +貫洞 +貫渡 +貫牛 +貫田 +貫目 +貫與 +貫薗 +貫見 +貫輪 +貫里 +貫野 +貫間 +責田 +貮又 +貮方 +貮枚田 +貮百免 +貰田 +貳又 +貳方 +貳百免 +貴下 +貴井 +貴伝名 +貴俵 +貴傳名 +貴元 +貴具 +貴内 +貴原 +貴地邦 +貴堂 +貴多 +貴多本 +貴多橋 +貴多野 +貴夛 +貴宝院 +貴宮 +貴家 +貴山 +貴島 +貴崎 +貴嶋 +貴川田 +貴布根 +貴師田 +貴志 +貴戸 +貴村 +貴次 +貴正 +貴治 +貴瀬 +貴理山 +貴田 +貴田岡 +貴登羅 +貴福 +貴答 +貴納 +貴美島 +貴舟 +貴舩 +貴船 +貴虎 +貴谷 +貴貫 +貴道 +貴達 +貴邑 +貴野 +買 +買原 +買場 +買手 +買手屋 +買田 +買福 +貸場 +貸山 +貸川 +貸毛 +貸波 +貸熊 +貸谷 +賀 +賀シ尾 +賀上 +賀下 +賀中 +賀久 +賀井 +賀仁 +賀代 +賀佐 +賀佐見 +賀來 +賀儀山 +賀元 +賀光 +賀内 +賀出 +賀利 +賀前 +賀勢 +賀原 +賀口 +賀古 +賀史山 +賀司 +賀味 +賀喜 +賀地 +賀城 +賀場 +賀多上 +賀多井 +賀好 +賀子 +賀定 +賀宮 +賀家 +賀屋 +賀山 +賀岡 +賀島 +賀嶋 +賀川 +賀幡 +賀張 +賀志 +賀志古 +賀志谷 +賀慶 +賀戸 +賀持 +賀数 +賀數 +賀曽利 +賀曾利 +賀木 +賀本 +賀村 +賀来 +賀東 +賀栄 +賀根 +賀根村 +賀楽 +賀樂 +賀永 +賀沢 +賀治 +賀波沢 +賀波澤 +賀津 +賀浦 +賀淵 +賀渕 +賀満 +賀満田 +賀澤 +賀瀬 +賀爾欽 +賀田 +賀田野 +賀畑 +賀畠 +賀登 +賀真田 +賀知 +賀篭六 +賀籠六 +賀紋 +賀納 +賀美 +賀羽 +賀耒 +賀茂 +賀茂川 +賀茂田 +賀藤 +賀見 +賀谷 +賀農 +賀部 +賀野 +賀長 +賀門 +賀陽 +賀集 +賀須井 +賀鳥 +賀鷺 +賃馬 +資元 +資宗 +資延 +資村 +資逸 +資野 +賎川 +賎機 +賓 +賓井 +賓利 +賓島 +賚 +賜 +賞雅 +賢慈 +賢持 +賢木 +賢生 +賢見 +賢谷 +賢賀 +賣井坂 +賣島 +賣市 +賣豆紀 +賣賀 +賣野 +賣間 +賤機 +賦勺 +賦句 +賦舩 +賦船 +贄 +贄川 +贄田 +贅田 +赤 +赤㘴 +赤上 +赤下 +赤下部 +赤丸 +赤丹 +赤久 +赤久保 +赤井 +赤井坂 +赤井橋 +赤井沢 +赤井澤 +赤井田 +赤井畑 +赤井阪 +赤仁田 +赤代 +赤佐 +赤保 +赤保内 +赤保木 +赤保谷 +赤俣 +赤倉 +赤兀 +赤元 +赤冶 +赤出 +赤出川 +赤刎 +赤利 +赤前 +赤原 +赤口 +赤司 +赤名 +赤土 +赤在 +赤地 +赤坂 +赤坂屋 +赤坂谷 +赤垣 +赤城 +赤埜 +赤埴 +赤堀 +赤堂 +赤場 +赤塔 +赤塚 +赤塩 +赤墳 +赤壁 +赤士 +赤妻 +赤宗 +赤家 +赤家部 +赤対 +赤對 +赤尾 +赤尾杉 +赤尾津 +赤尾関 +赤居 +赤屋敷 +赤山 +赤山田 +赤岡 +赤岩 +赤岸 +赤峯 +赤峰 +赤島 +赤崎 +赤嵜 +赤嶋 +赤嶺 +赤川 +赤工 +赤平 +赤平沢 +赤平澤 +赤広 +赤座 +赤廣 +赤志 +赤我部 +赤掘 +赤摩 +赤新田 +赤星 +赤時 +赤智 +赤曽部 +赤曾部 +赤月 +赤木 +赤木谷 +赤本 +赤杉 +赤村 +赤杖 +赤松 +赤林 +赤枝 +赤枩 +赤柄 +赤柏 +赤染 +赤染部 +赤柴 +赤栗 +赤栩 +赤根 +赤根川 +赤根田 +赤根谷 +赤桐 +赤桶 +赤梁 +赤梅 +赤梨 +赤森 +赤楚 +赤樫 +赤橋 +赤次 +赤毛 +赤水 +赤永 +赤江 +赤江橋 +赤池 +赤沢 +赤治 +赤沼 +赤泊 +赤波根 +赤波江 +赤津 +赤浜 +赤浦 +赤海 +赤淵 +赤渕 +赤滝 +赤澤 +赤濱 +赤瀧 +赤瀬 +赤瀬川 +赤熊 +赤牛 +赤狩山 +赤玉 +赤理 +赤生 +赤田 +赤田部 +赤町 +赤畑 +赤畠 +赤目 +赤目川 +赤眞 +赤真 +赤真下 +赤石 +赤石沢 +赤石澤 +赤石田 +赤硲 +赤碕 +赤磨 +赤祖父 +赤神 +赤祢 +赤禰 +赤禿 +赤秀 +赤穂 +赤穂津 +赤穂谷 +赤穗 +赤穴 +赤窄 +赤竜 +赤節 +赤築 +赤繁 +赤羅 +赤羽 +赤羽根 +赤羽目 +赤翼 +赤股 +赤背戸 +赤艸 +赤芝 +赤花 +赤苅 +赤草 +赤荻 +赤萩 +赤葉 +赤藤 +赤裏 +赤西 +赤見 +赤見内 +赤見坂 +赤谷 +赤賀 +赤路 +赤近 +赤迫 +赤道 +赤部 +赤重 +赤野 +赤野田 +赤野間 +赤金 +赤鉾 +赤銅 +赤錆 +赤鍋 +赤間 +赤間田 +赤阪 +赤阪谷 +赤須 +赤須賀 +赤領 +赤頭 +赤髪 +赤髭 +赤鬼 +赤鳥 +赤鹿 +赤麿 +赤龍 +赤﨏 +赫 +赫多 +赫山 +赫本 +赫田 +走 +走り +走上 +走井 +走内 +走出 +走坂 +走尾 +走崎 +走川 +走浦 +走辺 +走邊 +走里 +起 +起の崎 +起原 +起塚 +起多 +起定 +起山 +起島 +起本 +起橋 +起汐 +起田 +起立 +起須 +超善寺 +越 +越ケ谷 +越三 +越上 +越下 +越中 +越中屋 +越中谷 +越丸 +越久 +越久村 +越久田 +越乢 +越井 +越仮 +越仲 +越住 +越來 +越側 +越元 +越光 +越内 +越冨 +越出 +越前 +越前屋 +越前谷 +越南 +越原 +越取 +越口 +越司 +越合 +越名 +越善 +越国 +越地 +越坂 +越坂部 +越垰 +越堀 +越堂 +越場 +越塚 +越塩 +越塲 +越多 +越姓 +越守 +越宗 +越宮 +越家 +越富 +越尻 +越尾 +越居 +越山 +越岐 +越岡 +越峠 +越峯 +越島 +越崎 +越嶋 +越川 +越巻 +越平 +越度 +越廻 +越当 +越後 +越後屋 +越後島 +越後林 +越後谷 +越後貫 +越志 +越懸沢 +越懸澤 +越戸 +越戸沢 +越打 +越掛沢 +越智 +越智田 +越替 +越木 +越木岩 +越本 +越杉 +越村 +越条 +越来 +越林 +越柴 +越栄 +越桐 +越森 +越榮 +越橋 +越次 +越水 +越永 +越江 +越沢 +越河 +越治 +越沼 +越波 +越津 +越浜 +越浦 +越浪 +越海 +越淵 +越渓 +越渕 +越渡 +越湖 +越溪 +越澄 +越澤 +越濱 +越瀬 +越牟田 +越猪 +越生 +越田 +越畑 +越當 +越知 +越知石 +越石 +越砺 +越磨 +越礪 +越科 +越立 +越竹 +越籐 +越納 +越能 +越膳 +越花 +越葉 +越藤 +越見 +越谷 +越賀 +越路 +越農 +越迫 +越道 +越邑 +越部 +越郷 +越野 +越門 +越間 +越阪部 +越雲 +越須賀 +越首 +越馬 +越高 +趙川 +趣梠 +足久保 +足井 +足代 +足免 +足刈 +足利 +足利谷 +足助 +足原 +足原谷 +足口 +足古 +足名 +足和 +足土 +足坂 +足垣 +足城 +足塚 +足守 +足定 +足家 +足尾 +足山 +足岡 +足川 +足平 +足建 +足日 +足昇 +足木 +足本 +足村 +足柄 +足森 +足水 +足永 +足沢 +足洗 +足海 +足滝 +足澤 +足田 +足穂 +足立 +足立原 +足立野 +足羽 +足芝 +足苅 +足藤 +足袋井 +足袋抜 +足谷 +足賀 +足逹 +足道 +足達 +足部 +足重 +足野 +足門 +足集利 +足駕 +足高 +足鹿 +足黒 +跡上 +跡地 +跡守 +跡岡 +跡川 +跡市 +跡池 +跡治 +跡瀬 +跡田 +跡藤 +跡見 +跡路 +跡辺 +跡邉 +跡邊 +跡部 +跡野 +路 +路奥 +路川 +路木 +路野 +踊 +踊堂 +踊場 +踊橋 +踊瀬 +踏分 +踏江 +踏脱 +踏込 +踞尾 +踞屋 +踞本 +蹄 +蹴上 +蹴揚 +躍場 +躍橋 +躑井 +躑躅 +躑躅森 +身内 +身原 +身吉 +身崎 +身川 +身延 +身本 +身次 +身浦 +身深 +身玉山 +身畑 +身笠 +身野 +躬藤 +躯川 +躰中 +躰長 +躰阿弥 +軀川 +車 +車井 +車元 +車力 +車取 +車口 +車古 +車地 +車垣 +車埜 +車塚 +車多 +車尾 +車屋 +車崎 +車川 +車戸 +車木 +車本 +車東 +車沢 +車澤 +車無田 +車田 +車石 +車舎 +車角 +車谷 +車野 +車頭 +車館 +軌保 +軍侍 +軍原 +軍司 +軍地 +軍場 +軍外 +軍嶋 +軍待 +軍治 +軍神 +軍記 +軍魁 +軒 +軒下 +軒内 +軒原 +軒口 +軒名 +軒山 +軒村 +軒田 +軒留 +軒端 +軒谷 +軒野 +転 +転保 +転堂 +転正 +転法輪 +転石 +転馬 +軣 +軣木 +軸丸 +軸原 +軸園 +軸屋 +軸薗 +軸見 +軸谷 +軽井 +軽井沢 +軽坂 +軽墓 +軽尾 +軽山 +軽島 +軽崎 +軽戸 +軽木 +軽本 +軽森 +軽沢 +軽海 +軽澤 +軽矢 +軽石 +軽米 +軽見 +軽谷 +軽賀 +軽辺 +軽込 +軽部 +軽野 +載寧 +載本 +載間 +輔信 +輔平 +輔田 +輔老 +輔野 +輕尾 +輕木 +輕森 +輕澤 +輕邉 +輕部 +輝 +輝井 +輝元 +輝内 +輝吉 +輝尾 +輝岡 +輝川 +輝平 +輝本 +輝東 +輝西 +輦止 +輪地 +輪田 +輸本 +輻形 +輿 +輿五澤 +輿儀 +輿古田 +輿座 +輿斎 +輿木 +輿水 +輿田 +輿石 +輿語 +輿那 +輿那嶺 +輿那覇 +輿野 +輿齊 +轉 +轉正 +轉法輪 +轉石 +轉馬 +轟 +轟之上 +轟井 +轟原 +轟木 +轡 +轡水 +轡田 +轡見 +轡貫 +辛 +辛坊 +辛山 +辛島 +辛崎 +辛嶋 +辛嶌 +辛川 +辛木 +辛木田 +辛本 +辛沢 +辛石 +辛藤 +辞本 +辨 +辨吹 +辨天 +辨官 +辨崎 +辨木 +辨森 +辨畑 +辨納 +辨谷 +辨野 +辨開 +辰 +辰ノ +辰ノ口 +辰上 +辰下 +辰丸 +辰井 +辰亥 +辰仁 +辰住 +辰元 +辰力 +辰原 +辰口 +辰吉 +辰喜 +辰堀 +辰奥 +辰宮 +辰家 +辰寅 +辰尻 +辰尾 +辰山 +辰岡 +辰岩 +辰峯 +辰島 +辰崎 +辰嵐 +辰嶋 +辰川 +辰己 +辰己屋 +辰己谷 +辰己野 +辰已 +辰巳 +辰巳屋 +辰巳砂 +辰巳谷 +辰巳野 +辰市 +辰広 +辰木 +辰本 +辰村 +辰林 +辰柳 +辰森 +辰橋 +辰段 +辰沢 +辰沼 +辰浜 +辰浦 +辰満 +辰澤 +辰濃 +辰濱 +辰田 +辰畑 +辰石 +辰繁 +辰脇 +辰英 +辰西 +辰見 +辰谷 +辰身 +辰重 +辰野 +辰間 +辰頭 +辰馬 +農 +農上 +農中 +農人 +農作 +農内 +農原 +農口 +農坂 +農塚 +農士 +農守 +農宗 +農宮 +農山 +農島 +農崎 +農嶋 +農年 +農座 +農望田 +農木 +農本 +農村 +農業 +農沢 +農海 +農添 +農澤 +農田 +農登 +農端 +農脇 +農蘇 +農蘓 +農見 +農里 +農野 +農間 +農頭 +辺 +辺々古 +辺下 +辺井 +辺保 +辺保木 +辺原 +辺土 +辺土名 +辺城 +辺川 +辺床 +辺弥 +辺志切 +辺方 +辺春 +辺木 +辺木園 +辺木薗 +辺本 +辺根 +辺母木 +辺泥 +辺津 +辺焼 +辺牟木 +辺田 +辺美 +辺見 +辺谷 +辺谷本 +辺輪 +辺野 +辺野喜 +辺銀 +辺麦 +辻 +辻の内 +辻ケ堂 +辻ケ平 +辻ノ +辻ノ上 +辻ノ内 +辻上 +辻下 +辻並 +辻中 +辻丸 +辻久 +辻之上 +辻之内 +辻之所 +辻井 +辻他 +辻仲 +辻倉 +辻元 +辻兼 +辻内 +辻出 +辻分 +辻前 +辻北 +辻占 +辻原 +辻又 +辻口 +辻合 +辻国 +辻囿 +辻園 +辻坂 +辻坊 +辻垣 +辻垣内 +辻埜 +辻堀 +辻堂 +辻塚 +辻奥 +辻子 +辻宅 +辻宗 +辻家 +辻富 +辻尾 +辻居 +辻屋 +辻山 +辻岡 +辻岳 +辻島 +辻崎 +辻嵐 +辻嶋 +辻川 +辻巻 +辻市 +辻平 +辻広 +辻廣 +辻戸 +辻新 +辻木 +辻本 +辻村 +辻東 +辻松 +辻林 +辻柿 +辻栄 +辻根 +辻森 +辻極 +辻榮 +辻横 +辻橋 +辻次 +辻武 +辻氏 +辻永 +辻江 +辻池 +辻沢 +辻河 +辻浜 +辻浦 +辻淵 +辻渕 +辻満 +辻澤 +辻濱 +辻瀬 +辻生 +辻田 +辻畑 +辻畠 +辻盛 +辻石 +辻神 +辻窪 +辻端 +辻竹 +辻築 +辻米 +辻脇 +辻芝 +辻花 +辻葩 +辻藤 +辻裏 +辻西 +辻見 +辻角 +辻谷 +辻辺 +辻道 +辻邉 +辻邊 +辻邑 +辻邨 +辻部 +辻郷 +辻里 +辻野 +辻野本 +辻間 +辻関 +辻阪 +辻際 +辻駒 +辻高 +辻鼻 +込口 +込堂 +込宮 +込尾 +込山 +込岡 +込戸 +込江 +込田 +込茶 +込谷 +込貝 +込野 +迅瀬 +迎 +迎井 +迎伊 +迎出 +迎口 +迎垣 +迎居 +迎山 +迎川 +迎林 +迎田 +迎町 +迎畑 +迎窪 +迎谷 +迎辺 +迎里 +迎野 +近 +近万 +近上 +近下 +近並 +近丸 +近久 +近乗 +近井 +近仁 +近住 +近佐 +近俊 +近保 +近信 +近倉 +近光 +近兼 +近内 +近勢 +近原 +近友 +近口 +近吉 +近名 +近喰 +近国 +近國 +近土 +近坂 +近埜 +近堀 +近堂 +近場 +近多 +近安 +近宗 +近実 +近宮 +近尾 +近山 +近岡 +近島 +近崎 +近嵐 +近嶋 +近嶌 +近川 +近左 +近常 +近幡 +近平 +近年 +近広 +近廣 +近延 +近廻 +近弘 +近惣 +近成 +近戸 +近持 +近政 +近木 +近末 +近本 +近村 +近東 +近松 +近林 +近枝 +近棟 +近森 +近橋 +近正 +近水 +近永 +近江 +近江園 +近江屋 +近江岸 +近江川 +近江戸 +近江沢 +近江田 +近江矢 +近江谷 +近池 +近沢 +近河 +近泉 +近津 +近浦 +近浪 +近添 +近清 +近渡 +近澤 +近瀬 +近田 +近田谷 +近畑 +近盛 +近石 +近砂 +近祖 +近納 +近縄 +近美 +近者 +近能 +近葉 +近藤 +近處 +近行 +近衛 +近衞 +近西 +近見 +近角 +近記 +近谷 +近貞 +近賀 +近越 +近辻 +近迫 +近造 +近道 +近部 +近郷 +近都 +近重 +近野 +近金 +近長 +近間 +近阪 +近頭 +近馬 +返田 +返町 +返脚 +返見 +迚 +迚野 +迦統 +迦西 +迫 +迫ノ岡 +迫上 +迫下 +迫中 +迫丸 +迫之上 +迫井 +迫元 +迫内 +迫分 +迫前 +迫原 +迫口 +迫園 +迫地 +迫坪 +迫垣内 +迫奥 +迫富 +迫尻 +迫尾 +迫屋 +迫山 +迫岡 +迫川 +迫平 +迫広 +迫木 +迫本 +迫村 +迫根 +迫桝 +迫森 +迫水 +迫永 +迫江 +迫沼 +迫浦 +迫浴 +迫田 +迫畑 +迫留 +迫畠 +迫矢 +迫脇 +迫西 +迫谷 +迫越 +迫部 +迫野 +迫間 +迫頭 +迯目 +述本 +述田 +述金 +迴 +迴矢 +迴立 +迹田 +迹見 +追上 +追中 +追久保 +追住 +追出町 +追分 +追切 +追別 +追原 +追口 +追坂 +追塚 +追塩 +追山 +追崎 +追川 +追平 +追手 +追抱 +追掛 +追木 +追本 +追杉 +追村 +追林 +追栄 +追榮 +追永 +追沼 +追泉 +追田 +追留 +追着 +追矢 +追立 +追良瀬 +追詰 +追谷 +追越 +追野 +追阪 +追風 +追鳥 +退田 +逆井 +逆巻 +逆水 +逆沢 +逆瀬 +逆瀬川 +逆藤 +透 +逓駅 +途中 +途佐 +途崎 +這禽 +這越 +通 +通事 +通井 +通伝 +通傳 +通円 +通前 +通力 +通善 +通地 +通坂 +通堂 +通場 +通山 +通岡 +通岩 +通島 +通崎 +通川 +通形 +通戸 +通木 +通村 +通次 +通正 +通沢 +通沢(通澤) +通清水 +通澤 +通生 +通田 +通畑 +通畠 +通端 +通筋 +通縁 +通自 +通谷 +通里 +通野 +通銅 +通門 +通阪 +速井 +速司 +速国 +速國 +速基 +速多 +速寿 +速山 +速川 +速形 +速応 +速應 +速方 +速水 +速永 +速津 +速渡 +速瀬 +速田 +速目 +速石 +速藤 +速見 +速谷 +速路 +速道 +速野 +速開 +速風 +速館 +造 +造々 +造住 +造作 +造倉 +造免 +造力 +造勇 +造場 +造士 +造山 +造座 +造武 +造田 +造船 +造谷 +造賀 +造道 +造酒 +造酒田 +造隼 +逢出 +逢台 +逢地 +逢坂 +逢坂部 +逢山 +逢来 +逢沢 +逢澤 +逢莱 +逢見 +逢見谷 +逢野 +逢阪 +連 +連尾 +連山 +連川 +連水 +連汐 +連波 +連田 +連石 +連野 +逧田 +進 +進上 +進來 +進倉 +進元 +進出 +進司 +進土 +進地 +進堂 +進士 +進学 +進宅 +進導 +進尾 +進川 +進戸 +進明 +進木 +進本 +進村 +進来 +進東 +進林 +進登 +進矢 +進籐 +進蔵 +進藤 +進谷 +進賀 +進通 +進道 +進邦 +進野 +逵 +逵中 +逵井 +逵原 +逵岡 +逵本 +逵村 +逵田 +逸原 +逸崎 +逸川 +逸持治 +逸木 +逸本 +逸村 +逸民 +逸水 +逸色 +逸見 +逸身 +逸野 +逸馬 +逹可 +逹本 +逹谷 +遁所 +遂殿 +遅塚 +遅山 +遅沢 +遅澤 +遅越 +遅野井 +遊 +遊㘴 +遊上 +遊亀 +遊亀山 +遊井 +遊井名田 +遊仙 +遊佐 +遊作 +遊免 +遊口 +遊喜 +遊坐 +遊垣 +遊城 +遊場 +遊塚 +遊子谷 +遊屋 +遊川 +遊左 +遊座 +遊戯 +遊木 +遊橋 +遊沢 +遊津 +遊澤 +遊田 +遊畑 +遊磨 +遊見 +遊谷 +遊道 +遊部 +遊里 +遊里道 +遊長 +遊間 +遊馬 +運 +運万 +運上 +運乗 +運乘 +運勢 +運天 +運寿 +運崎 +運木 +運永 +運萬 +運藤 +運賀 +運道 +運野 +遍々古 +遍照 +過 +過外 +過田 +過福 +過能 +過足 +過部 +道 +道々 +道の下 +道ノ下 +道三 +道上 +道下 +道中 +道中内 +道丸 +道丹 +道久 +道久田 +道之前 +道之後 +道井 +道亦 +道京 +道仏 +道仙 +道仲 +道休 +道伝 +道住 +道体 +道余 +道佛 +道保 +道信 +道倉 +道傅 +道傳 +道元 +道先 +道光 +道免 +道具 +道具谷 +道内 +道円 +道出 +道分 +道利 +道券 +道前 +道副 +道勇 +道勘 +道勧 +道北 +道厘 +道原 +道又 +道口 +道古 +道司 +道合 +道吉 +道同 +道向 +道味 +道和 +道善 +道喜 +道園 +道圓 +道土井 +道地 +道坂 +道垣内 +道城 +道埜 +道堀 +道堂 +道堯 +道場 +道塚 +道塩 +道奥 +道姓 +道守 +道安 +道宗 +道官 +道宮 +道家 +道寄 +道寛 +道小島 +道尭 +道尻 +道尾 +道屋 +道山 +道岡 +道岸 +道島 +道崎 +道嶋 +道川 +道川内 +道川屋 +道工 +道市 +道平 +道幸 +道広 +道庭 +道廣 +道弘 +道後 +道後屋 +道徳 +道心 +道志 +道念 +道慶 +道成 +道房 +道手 +道才 +道振 +道政 +道教 +道斉 +道斎 +道方 +道旗 +道旧 +道明 +道明内 +道智 +道木 +道末 +道本 +道村 +道東 +道林 +道枝 +道根 +道格 +道森 +道植 +道橋 +道次 +道正 +道正田 +道永 +道江 +道沖 +道沢 +道河 +道治 +道沼 +道法 +道洞 +道津 +道浄 +道浜 +道浦 +道海 +道淵 +道添 +道清 +道済 +道渕 +道満 +道源 +道滿 +道澤 +道瀬 +道狭 +道玄 +道珍 +道理 +道用 +道田 +道町 +道畑 +道畠 +道白 +道盛 +道目木 +道祖 +道祖土 +道祖尾 +道祖本 +道祖瀬戸 +道祖田 +道福 +道租尾 +道窪 +道端 +道竹 +道筆 +道筋 +道管 +道篤 +道籏 +道籔 +道紺 +道給 +道綱 +道網 +道繁 +道羅 +道股 +道能 +道脇 +道腰 +道舊 +道花 +道苗 +道菅 +道萱 +道蔦 +道薮 +道藤 +道藪 +道行 +道裏 +道西 +道見 +道観 +道角 +道解 +道言 +道訳 +道譯 +道谷 +道谷内 +道貝 +道貫 +道賀 +道越 +道路 +道躰 +道輪 +道辰 +道辺 +道辻 +道込 +道迫 +道遊 +道過 +道邊 +道部 +道重 +道野 +道野下 +道野畑 +道金 +道鋏 +道鎭 +道鎮 +道長 +道閑 +道間 +道関 +道阪 +道面 +道音 +道頃 +道順 +道須 +道頭 +道願 +道風 +道體 +道高 +道鬼 +道齊 +達 +達下 +達中 +達久 +達伊 +達入 +達冨 +達原 +達口 +達可 +達坂 +達城 +達増 +達子 +達孝 +達宮 +達家 +達富 +達山 +達岡 +達島 +達崎 +達川 +達广 +達摩 +達曽 +達曽部 +達木 +達本 +達村 +達林 +達橋 +達沢 +達田 +達知 +達石 +達磨 +達紙 +達脇 +達藤 +達見 +達谷 +達谷窟 +達賀 +達身 +達野 +達錦 +達間 +達髭 +違 +違口 +違星 +違谷 +違道 +遖 +遙地 +遙山 +遠々内 +遠ノ江 +遠上 +遠中 +遠乃 +遠久 +遠久村 +遠乗 +遠井 +遠井和 +遠光 +遠入 +遠内 +遠刕 +遠劦 +遠勢 +遠北 +遠原 +遠又 +遠口 +遠周 +遠国 +遠國 +遠土 +遠地 +遠坂 +遠城 +遠城寺 +遠堀 +遠堂 +遠塚 +遠塚谷 +遠子内 +遠宮 +遠家 +遠富 +遠屋 +遠山 +遠岳 +遠峯 +遠峰 +遠島 +遠崎 +遠嶋 +遠嶌 +遠嶺 +遠嶽 +遠川 +遠州 +遠度 +遠座 +遠役 +遠所 +遠政 +遠木 +遠本 +遠松 +遠枝 +遠森 +遠橋 +遠武 +遠水 +遠江 +遠池 +遠沢 +遠洞 +遠津 +遠海 +遠渡 +遠澤 +遠瀬 +遠獄 +遠田 +遠畑 +遠目塚 +遠矢 +遠竹 +遠茂谷 +遠藤 +遠衛 +遠衞 +遠西 +遠見 +遠見石 +遠谷 +遠賀 +遠越 +遠路 +遠辺 +遠近 +遠迫 +遠道 +遠部 +遠郷 +遠里 +遠里小野 +遠野 +遠鑑 +遠間 +遠阪 +遠飛 +遠香 +遣分 +遣水 +遣沢 +遣澤 +遣瀬 +遣田 +遥 +遥地 +遥山 +適藤 +遮那 +遲澤 +還来地 +還田 +還藤 +邉 +邉原 +邉志切 +邉方 +邉春 +邉木 +邉木薗 +邉津 +邉田 +邉見 +邊 +邊保 +邊原 +邊土 +邊土名 +邊川 +邊志切 +邊春 +邊木園 +邊本 +邊母木 +邊津 +邊牟木 +邊田 +邊見 +邊谷本 +邊野喜 +邑 +邑上 +邑並 +邑中 +邑井 +邑元 +邑十 +邑原 +邑口 +邑地 +邑尾 +邑山 +邑岡 +邑崎 +邑川 +邑智 +邑木 +邑本 +邑松 +邑林 +邑楽 +邑樂 +邑橋 +邑沢 +邑津 +邑澤 +邑瀬 +邑田 +邑石 +邑神 +邑脇 +邑野 +那 +那々木 +那住 +那佐 +那佐出 +那俄性 +那俄牲 +那倉 +那加井 +那加野 +那口 +那古屋 +那和 +那和手 +那多 +那小屋 +那川 +那志野 +那我性 +那智 +那智明 +那智野 +那木 +那村 +那根 +那樹沢 +那波 +那波多目 +那珂 +那田 +那田屋 +那知 +那知上 +那知伊 +那羅尾 +那脇 +那良 +那良伊 +那良木 +那花 +那覇 +那謨 +那谷 +那谷屋 +那賀 +那賀山 +那賀島 +那賀嶋 +那賀川 +那賀野 +那部 +那部良 +那雲 +那須 +那須井 +那須原 +那須口 +那須川 +那須本 +那須村 +那須田 +那須野 +邦 +邦光 +邦友 +邦城 +邦山 +邦岡 +邦川 +邦幡 +邦本 +邦村 +邦枝 +邦武 +邦永 +邦近 +邦重 +邦高 +邨上 +邨中 +邨井 +邨尾 +邨居 +邨山 +邨島 +邨川 +邨松 +邨橋 +邨次 +邨沢 +邨澤 +邨瀬 +邨生 +邨田 +邨谷 +邨野 +邪答院 +邵城 +郁 +郁地 +郁山 +郁島 +郁田 +郁芳 +郁野 +郊見 +郡 +郡上 +郡元 +郡内 +郡原 +郡司 +郡司島 +郡司嶋 +郡司掛 +郡地 +郡場 +郡塚 +郡士 +郡安 +郡家 +郡寄 +郡山 +郡島 +郡嶋 +郡嶌 +郡川 +郡市 +郡志 +郡戸 +郡松 +郡楽 +郡樂 +郡池 +郡浜 +郡浦 +郡田 +郡谷 +郡部 +郡野 +郡馬 +部井 +部井久 +部原 +部坂 +部奈 +部家 +部屋 +部屋内 +部屋本 +部屋浦 +部山 +部川 +部府 +部当 +部村 +部田 +部當 +部矢 +部粟 +部良 +部良本 +部谷 +部谷元 +部谷光 +部谷岡 +部谷本 +部谷森 +郭原 +郭山 +郭新 +郭本 +郭賀 +郭野 +郷 +郷万 +郷上 +郷中 +郷丸 +郷久 +郷久保 +郷之丸 +郷之原 +郷井 +郷保 +郷倉 +郷元 +郷六 +郷内 +郷出 +郷力 +郷原 +郷古 +郷右近 +郷司 +郷司山 +郷呂 +郷園 +郷土 +郷地 +郷坪 +郷堀 +郷子 +郷守 +郷実 +郷家 +郷山 +郷州 +郷式 +郷戸 +郷木 +郷本 +郷村 +郷東 +郷森 +郷橋 +郷沢 +郷治 +郷津 +郷渡 +郷湖 +郷澤 +郷田 +郷畑 +郷矢 +郷社 +郷祖 +郷端 +郷緒 +郷胡 +郷良 +郷萬 +郷藤 +郷西 +郷谷 +郷路 +郷農 +郷迫 +郷道 +郷野 +郷野原 +郷野目 +郷門 +郷間 +郷頭 +都 +都々地尾 +都々木 +都々野 +都下 +都世子 +都並 +都中 +都丸 +都久井 +都久山 +都井 +都倉 +都元 +都冨 +都冨士 +都出 +都加原 +都原 +都口 +都古 +都司 +都合 +都合田 +都吉 +都呂須 +都地 +都坂 +都城 +都外川 +都子 +都子野 +都守 +都宮 +都富 +都尾 +都山 +都島 +都崎 +都嵜 +都嶋 +都川 +都市 +都平 +都志 +都志見 +都成 +都所 +都木 +都本 +都村 +都松 +都枝 +都染 +都梅 +都森 +都楳 +都橋 +都沢 +都河 +都治 +都津川 +都渡 +都澤 +都濃 +都瑠 +都生 +都田 +都甲 +都畄 +都留 +都留崎 +都知木 +都石 +都祭 +都秋 +都積 +都竹 +都筑 +都築 +都築木 +都能 +都苗 +都藤 +都解 +都谷 +都谷森 +都賀 +都賀田 +都賀谷 +都路 +都辺 +都通 +都部 +都郷 +都鄙 +都野 +都野井 +都野国屋 +都野國屋 +都野守 +都野川 +都野森 +都野瀬 +都野田 +都間 +都関 +都香 +都馬 +都高 +都鳥 +都鹿野 +鄙口 +鄙山 +鄙里 +鄭本 +酉丸 +酉井 +酉和 +酉家 +酉岡 +酉川 +酉抜 +酉本 +酉水 +酉澤 +酉田 +酉脇 +酉越 +酌井 +酌河内 +配原 +配山 +配島 +配嶋 +配川 +配藤 +配野 +酒々井 +酒上 +酒下 +酒主 +酒井 +酒井原 +酒井田 +酒人立 +酒伊 +酒作 +酒依 +酒倉 +酒元 +酒光 +酒入 +酒出 +酒勺 +酒勾 +酒勾川 +酒匂 +酒匂川 +酒口 +酒句 +酒司 +酒向 +酒和 +酒地 +酒坂 +酒城 +酒場 +酒多 +酒家 +酒寄 +酒尾 +酒居 +酒屋 +酒島 +酒崎 +酒嶋 +酒川 +酒巻 +酒市 +酒師 +酒府 +酒庭 +酒従 +酒得 +酒徳 +酒戸 +酒折 +酒木 +酒本 +酒村 +酒松 +酒林 +酒枝 +酒栄 +酒根 +酒森 +酒楽 +酒樋 +酒樹 +酒永 +酒江 +酒池 +酒沢 +酒泉 +酒澤 +酒瀬川 +酒牧 +酒瓜 +酒生 +酒田 +酒田屋 +酒百 +酒盛 +酒美 +酒肆 +酒葉 +酒藤 +酒衛 +酒見 +酒詰 +酒誥 +酒谷 +酒賀 +酒越 +酒輪 +酒辺 +酒迎 +酒造 +酒造田 +酒道 +酒邊 +酒部 +酒野 +酒飯 +酔月 +酢 +酢原 +酢屋 +酢山 +酢崎 +酢田 +酢矢 +酢矢藤 +酢藤 +酢谷 +酢野 +酢馬 +酸漿 +酸谷 +醍湖 +醍醐 +醒ケ井 +醒井 +醜茶 +醤油 +醤油屋 +醤野 +醫山 +醫王 +醫王田 +釆 +釆井 +釆元 +釆原 +釆垣内 +釆女 +釆尾 +釆山 +釆岡 +釆本 +釆沢 +釆澤 +釆田 +釆畑 +釆見 +釆谷 +釆野 +采 +采井 +采元 +采光 +采原 +采垣内 +采女 +采尾 +采山 +采岡 +采島 +采崎 +采川 +采木 +采本 +采東 +采沢 +采浦 +采澤 +采田 +采畑 +采見 +采谷 +采野 +釈 +釈加戸 +釈囲 +釈子 +釈家 +釈尾 +釈成 +釈本 +釈氏 +釈水 +釈永 +釈河野 +釈種 +釈臣 +釈舎 +釈迦 +釈迦堂 +釈迦戸 +釈迦郡 +釈迦野 +釈迦院 +釈野 +釈随 +釋 +釋加戸 +釋圍 +釋子 +釋尾 +釋氏 +釋水 +釋永 +釋河野 +釋種 +釋舍 +釋舎 +釋迦 +釋迦堂 +釋迦戸 +釋迦郡 +釋迦野 +釋野 +里 +里上 +里中 +里之園 +里井 +里仲 +里保 +里信 +里倉 +里元 +里光 +里内 +里出 +里原 +里口 +里吉 +里和 +里園 +里地 +里坊 +里城 +里埜 +里子 +里宗 +里宮 +里富 +里尾 +里居 +里屋 +里山 +里岡 +里島 +里崎 +里嶋 +里川 +里平 +里広 +里形 +里方 +里木 +里本 +里村 +里林 +里栄 +里森 +里正 +里水 +里永 +里沖 +里沢 +里沼 +里浜 +里浦 +里深 +里澤 +里瀬 +里田 +里盛 +里石 +里神 +里緒 +里美 +里脇 +里舘 +里芳 +里茂 +里薗 +里西 +里見 +里谷 +里路 +里道 +里邑 +里邨 +里部 +里重 +里野 +里鍋 +里際 +里雄 +里頭 +里館 +里麻 +重 +重三 +重上 +重下 +重並 +重中 +重丸 +重乃 +重久 +重之 +重乗 +重井 +重住 +重佐 +重保 +重信 +重倉 +重僧 +重儀 +重元 +重充 +重光 +重入 +重共 +重兼 +重内 +重冨 +重利 +重則 +重力 +重南 +重原 +重友 +重台 +重吉 +重名 +重命 +重国 +重國 +重園 +重土 +重地 +重坂 +重坪 +重垂井 +重城 +重堂 +重塚 +重増 +重太 +重好 +重守 +重安 +重宗 +重定 +重実 +重宮 +重家 +重富 +重實 +重尾 +重屋 +重山 +重岡 +重岩 +重島 +重崎 +重嶋 +重川 +重巣 +重左 +重常 +重平 +重年 +重広 +重康 +重廣 +重延 +重弘 +重徳 +重慶 +重成 +重戸 +重房 +重政 +重文字 +重昆 +重春 +重木 +重末 +重本 +重杉 +重村 +重条 +重東 +重松 +重林 +重林寺 +重枝 +重栖 +重根 +重桝 +重條 +重棟 +重森 +重楽 +重樂 +重橋 +重次 +重正 +重武 +重歳 +重水 +重永 +重江 +重沢 +重河 +重泉 +重津 +重浜 +重浦 +重淵 +重清 +重渕 +重満 +重澤 +重濱 +重用 +重田 +重畑 +重留 +重畠 +重畳 +重白 +重益 +重盛 +重矢 +重石 +重神 +重福 +重稲 +重立 +重竹 +重綱 +重網 +重美 +重臣 +重臺 +重舎 +重舛 +重良 +重芳 +重若 +重茂 +重草 +重薗 +重藤 +重行 +重西 +重見 +重親 +重谷 +重豊 +重走 +重越 +重軒 +重近 +重迫 +重道 +重郎 +重部 +重里 +重野 +重金 +重長 +重門 +重間 +重阪 +重面 +重頭 +重高 +重黒木 +野 +野々 +野々上 +野々下 +野々井 +野々俣 +野々内 +野々原 +野々口 +野々垣 +野々垰 +野々宮 +野々尻 +野々尾 +野々屋 +野々山 +野々峠 +野々崎 +野々川 +野々市 +野々市谷 +野々平 +野々広 +野々廣 +野々木 +野々本 +野々村 +野々松 +野々浦 +野々瀬 +野々熊 +野々田 +野々目 +野々脇 +野々見 +野々部 +野の村 +野ケ山 +野ケ峯 +野ケ峰 +野ケ本 +野ツ俣 +野ノ口 +野一 +野一色 +野上 +野上田 +野下 +野与 +野世 +野世渓 +野世溪 +野並 +野中 +野丸 +野主 +野乃山 +野乃村 +野久 +野久保 +野久尾 +野之上 +野之口 +野之山 +野亀 +野事 +野井 +野井倉 +野亦 +野付 +野代 +野代谷 +野仲 +野伏 +野住 +野佐 +野佐掛 +野佐根 +野佐近 +野作 +野依 +野保 +野保留 +野俣 +野倉 +野儀 +野元 +野元堀 +野入 +野内 +野出 +野出木 +野分 +野切 +野刈 +野刈家 +野別 +野利 +野利本 +野利田 +野前 +野副 +野力 +野加 +野勢 +野北 +野午島 +野午嶋 +野原 +野原内 +野又 +野叉 +野友 +野口 +野口原 +野古 +野名 +野向 +野吹 +野吾 +野呂 +野呂内 +野呂瀬 +野呂田 +野和 +野和田 +野咲 +野喜 +野国 +野國 +野園 +野土 +野土谷 +野地 +野地元 +野地岡 +野地崎 +野地川 +野地本 +野地田 +野坂 +野坊戸 +野垣 +野垣内 +野城 +野埼 +野堀 +野場 +野塔 +野塙 +野塚 +野士広 +野外 +野夫井 +野妻 +野子 +野子谷 +野宇 +野守 +野安 +野宗 +野定 +野室 +野宮 +野家 +野寄 +野寺 +野小 +野小生 +野小谷 +野尻 +野尻野 +野尾 +野屋 +野屋敷 +野屯 +野山 +野岡 +野岳 +野岸 +野島 +野崎 +野嵜 +野嵩 +野嶋 +野嶌 +野嶽 +野川 +野州 +野左掛 +野左根 +野左近 +野巻 +野市 +野布瀬 +野師本 +野平 +野広 +野床 +野底 +野府 +野庭 +野廣 +野引 +野張 +野形 +野影 +野復 +野徳 +野志 +野志谷 +野戸 +野戸谷 +野房 +野手 +野扖 +野挽 +野掘 +野掛 +野政 +野方 +野明 +野曽 +野曽原 +野曽場 +野曽木 +野曾 +野曾原 +野替 +野月 +野月平 +野木 +野木井 +野木原 +野木和 +野木場 +野木山 +野木村 +野木森 +野木沼 +野未 +野末 +野本 +野杁 +野杉 +野村 +野村島 +野村嶋 +野条 +野松 +野林 +野枝 +野柳 +野柴 +野柴木 +野栄 +野栗 +野根 +野根山 +野桐 +野桑 +野桜 +野條 +野森 +野極 +野模 +野橋 +野櫻 +野次 +野正 +野武 +野武田 +野殿 +野母 +野毛 +野毛田 +野水 +野永 +野江 +野池 +野沢 +野沢井 +野河 +野治 +野泉 +野波 +野洌 +野津 +野津原 +野津山 +野津手 +野津本 +野津江 +野津田 +野洲 +野浜 +野浦 +野浪 +野海 +野海道 +野涯 +野深 +野淵 +野添 +野渊 +野渕 +野渡 +野渥 +野満 +野溝 +野滝 +野滿 +野潟 +野澤 +野濱 +野瀧 +野瀬 +野瀬井 +野瀬山 +野瀬田 +野火 +野焼 +野片 +野牛 +野牛島 +野牛嶋 +野牧 +野獄 +野玉 +野理 +野瑞 +野生 +野生司 +野生須 +野甫 +野田 +野田ケ谷 +野田上 +野田元 +野田口 +野田坂 +野田尾 +野田山 +野田本 +野田村 +野田沢 +野田澤 +野田谷 +野田部 +野田頭 +野町 +野界 +野畑 +野畠 +野畦 +野異地 +野登 +野登木 +野登谷 +野白 +野相 +野真 +野矢 +野知 +野知里 +野石 +野碕 +野神 +野福 +野秋 +野稲 +野積 +野窪 +野端 +野竹 +野竹内 +野竿 +野笹 +野筋 +野筒 +野篠 +野納 +野続 +野綱 +野網 +野美 +野美山 +野老 +野老山 +野老田 +野老迫 +野股 +野能 +野脇 +野腰 +野與 +野舘 +野良 +野芝 +野花 +野苅 +野苅家 +野茂 +野茎 +野草 +野荒 +野菅 +野菊 +野萩 +野萱 +野藁 +野藤 +野蝼 +野螻 +野表 +野西 +野見 +野見山 +野角 +野谷 +野賀 +野賀田 +野走 +野越 +野路 +野路井 +野辺 +野辺名 +野辺地 +野辺沼 +野辺田 +野込 +野近 +野迫 +野道 +野遠 +野邉 +野邉地 +野邉田 +野邊 +野邊地 +野邊田 +野邑 +野邨 +野部 +野郷 +野里 +野里女 +野里常 +野重 +野野 +野野内 +野野垣 +野野村 +野野田 +野金 +野長 +野長瀬 +野開 +野間 +野間井 +野間元 +野間口 +野間屋 +野間崎 +野間川内 +野間本 +野間田 +野間野 +野間須 +野関 +野阪 +野阿弥 +野附 +野陳 +野際 +野露 +野面 +野須 +野頭 +野頼 +野風呂 +野飼 +野館 +野首 +野馬 +野高 +野鳥 +野鶴 +野鹿 +野鹿瀬 +野黒 +野黒美 +量 +量山 +金 +金〆 +金ケ原 +金ケ崎 +金ケ嵜 +金ケ森 +金ケ江 +金ケ瀬 +金一 +金七 +金万 +金三津 +金上 +金下 +金世 +金並 +金中 +金丸 +金久 +金久保 +金之 +金乗 +金乙 +金也 +金五 +金井 +金井原 +金井塚 +金井島 +金井田 +金京 +金今 +金仙 +金代 +金任 +金伍 +金伏 +金住 +金佐 +金佛 +金作 +金保 +金信 +金俣 +金倉 +金個 +金像 +金元 +金光 +金光寺 +金光谷 +金児 +金兒 +金入 +金兵 +金具 +金兼 +金内 +金円 +金冨 +金出 +金出地 +金刀 +金刃 +金切 +金利 +金刺 +金剛 +金剛丸 +金剛乗 +金剛地 +金剛寺 +金剛瀬 +金剛背 +金力 +金加 +金加羅 +金勝 +金勢 +金升 +金南 +金厚 +金原 +金又 +金友 +金取 +金口 +金古 +金只 +金台 +金吉 +金名部 +金吹 +金吾 +金和 +金咲 +金品 +金善 +金喜 +金営 +金国 +金國 +金園 +金土 +金地 +金坂 +金坪 +金垣 +金垣内 +金城 +金埼 +金堀 +金堀場 +金堂 +金場 +金塚 +金増 +金墻 +金多 +金多賀 +金天 +金太 +金好 +金子 +金子屋 +金子松 +金孝 +金宅 +金宇 +金宇治 +金守 +金安 +金宗 +金定 +金宝 +金室 +金宮 +金家 +金寄 +金富 +金寺 +金寿 +金小路 +金尻 +金尾 +金居 +金居田 +金屋 +金屋敷 +金山 +金山光 +金山沢 +金山澤 +金山谷 +金岡 +金岩 +金岳 +金峯 +金峰 +金島 +金崎 +金崎屋 +金嵜 +金嶋 +金嶺 +金嶽 +金川 +金川原 +金巨 +金巻 +金市 +金布 +金常 +金幡 +金平 +金広 +金庄 +金床 +金座 +金庫 +金庭 +金康 +金廣 +金延 +金建 +金廻 +金弘 +金弥 +金弦 +金彌 +金当 +金彦 +金後 +金得 +金徳 +金志 +金忠 +金恵 +金慶 +金成 +金戸 +金房 +金扇 +金打 +金折 +金持 +金指 +金振 +金挺 +金操 +金政 +金敷 +金文 +金斗 +金新 +金日 +金明 +金星 +金春 +金時 +金曽 +金曾 +金替 +金月 +金木 +金末 +金本 +金札 +金杉 +金村 +金来 +金東 +金松 +金林 +金枝 +金枝上 +金枡 +金柄 +金柏 +金染 +金柱 +金柿 +金栄 +金栗 +金根 +金桂 +金桝 +金桶 +金棒 +金森 +金森寺 +金榮 +金槁 +金橋 +金檀 +金次 +金正 +金武 +金武川 +金比良 +金毛 +金毛利 +金氏 +金気 +金氣 +金水 +金永 +金江 +金池 +金沓 +金沖 +金沢 +金河 +金治 +金沼 +金泉 +金法 +金波 +金泥 +金洞 +金津 +金津谷 +金浜 +金浦 +金浪 +金海 +金涌 +金深 +金淵 +金添 +金清 +金渓 +金渕 +金湖 +金満 +金源 +金滝 +金澄 +金澤 +金濱 +金瀧 +金瀬 +金瀬戸 +金照 +金營 +金牧 +金物 +金物谷 +金玉 +金王 +金生 +金生谷 +金田 +金田一 +金甲 +金町 +金畑 +金留 +金當 +金登 +金益 +金盛 +金目 +金眞 +金真 +金矢 +金石 +金砺 +金碇 +金磯 +金礪 +金神 +金福 +金秀 +金秋 +金究 +金窓 +金窪 +金立 +金端 +金竹 +金笠 +金筒 +金箱 +金築 +金篭 +金籐 +金籠 +金粕 +金糸 +金納 +金綱 +金網 +金編 +金縄 +金繁 +金織 +金繩 +金羅 +金義 +金羽 +金羽木 +金胎 +金脇 +金臺 +金舗 +金舛 +金舩 +金船 +金良 +金色 +金花 +金芳 +金苗 +金若 +金茂 +金草 +金華 +金菱 +金萬 +金蔵 +金蔵院 +金藏 +金藤 +金行 +金衛 +金西 +金要 +金見 +金見代 +金親 +金谷 +金谷内 +金谷橋 +金豊 +金貝 +金貞 +金賀 +金輪 +金辺 +金辻 +金近 +金通 +金造 +金道 +金邉 +金邊 +金部 +金都 +金里 +金重 +金野 +金野尾 +金釘 +金釜 +金釣 +金銅 +金鋪 +金鋳 +金鑄 +金鑚 +金鑽 +金長 +金間 +金関 +金阪 +金阿弥 +金阿彌 +金附 +金陵 +金集 +金靖 +金鞍 +金鞠 +金須 +金頼 +金風 +金飼 +金香 +金馬 +金高 +金魚 +金鶴 +金鹿 +金黒 +金龍 +金龍山 +釖持 +釖木 +釘丸 +釘井 +釘元 +釘光 +釘原 +釘子 +釘宮 +釘尾 +釘屋 +釘山 +釘岡 +釘島 +釘崎 +釘嵜 +釘嶋 +釘抜 +釘拔 +釘本 +釘村 +釘松 +釘沢 +釘澤 +釘田 +釘町 +釘秀 +釘谷 +釘貫 +釘車 +釘野 +釜 +釜ケ沢 +釜ケ渕 +釜ケ澤 +釜ケ谷 +釜一 +釜上 +釜下 +釜世 +釜中 +釜丸 +釜井 +釜付 +釜倉 +釜元 +釜入 +釜内 +釜出 +釜原 +釜友 +釜口 +釜台 +釜土 +釜地 +釜坂 +釜垂 +釜埜 +釜堀 +釜場 +釜塚 +釜増 +釜売 +釜子 +釜尾 +釜屋 +釜山 +釜岩 +釜島 +釜崎 +釜川 +釜平 +釜床 +釜形 +釜我 +釜戸 +釜房 +釜木 +釜本 +釜村 +釜林 +釜森 +釜永 +釜江 +釜池 +釜沢 +釜沼 +釜洞 +釜津 +釜津田 +釜浦 +釜淵 +釜渕 +釜滝 +釜澤 +釜瀧 +釜瀬 +釜田 +釜矢 +釜石 +釜神 +釜窪 +釜納 +釜脇 +釜萢 +釜蓋 +釜親 +釜谷 +釜賀 +釜足 +釜辺 +釜道 +釜部 +釜野 +釜野井 +釜鈴 +釜阪 +釜須 +釜風呂 +釜鳴 +針 +針ケ谷 +針下 +針久保 +針井 +針元 +針北 +針原 +針口 +針吉 +針場 +針塚 +針多 +針宮 +針尾 +針尾島 +針屋 +針山 +針岡 +針崎 +針川 +針幸 +針持 +針替 +針木 +針本 +針村 +針江 +針池 +針沢 +針浦 +針浪 +針淵 +針渕 +針澤 +針生 +針田 +針石 +針磨 +針立 +針茂 +針谷 +針貝 +針辻 +針道 +針重 +針野 +針金 +針金屋 +針金谷 +針長 +針間 +針間矢 +針馬 +釡原 +釡台 +釡萢 +釡谷 +釣 +釣上 +釣井 +釣元 +釣兼 +釣出 +釣場 +釣家 +釣屋 +釣山 +釣岡 +釣島 +釣崎 +釣嵜 +釣川 +釣巻 +釣手 +釣木 +釣木沢 +釣木澤 +釣本 +釣楽 +釣段 +釣永 +釣沢 +釣流 +釣浦 +釣澤 +釣瓶 +釣田 +釣皷 +釣矢 +釣石 +釣竿 +釣舟 +釣舩 +釣船 +釣見 +釣谷 +釣賀 +釣運 +釣部 +釣野 +釣釜 +釣餌 +釣鼓 +釰吉 +釰持 +釼 +釼先 +釼内 +釼吉 +釼地 +釼崎 +釼形 +釼持 +釼明 +釼木 +釼本 +釼法 +釼物 +釼田 +釼羽 +釼菱 +釼谷 +釼重 +鈇田 +鈍宝 +鈍渡 +鈎 +鈩 +鈩ケ崎 +鈩前 +鈩谷 +鈩迫 +鈩野 +鈳 +鈴 +鈴々木 +鈴の家 +鈴ケ嶺 +鈴下 +鈴中 +鈴丸 +鈴久保 +鈴久名 +鈴井 +鈴倉 +鈴倭 +鈴元 +鈴光 +鈴内 +鈴出 +鈴切 +鈴加 +鈴原 +鈴口 +鈴吉 +鈴喜 +鈴土 +鈴坂 +鈴垣 +鈴城 +鈴士 +鈴奥 +鈴子 +鈴宮 +鈴富 +鈴尾 +鈴居 +鈴屋 +鈴山 +鈴岡 +鈴島 +鈴崎 +鈴嶋 +鈴嶌 +鈴川 +鈴平 +鈴広 +鈴庄 +鈴形 +鈴得 +鈴志野 +鈴掛 +鈴政 +鈴木 +鈴木田 +鈴未 +鈴本 +鈴村 +鈴来 +鈴東 +鈴杵 +鈴枝 +鈴栄 +鈴森 +鈴榮 +鈴樹 +鈴武 +鈴永 +鈴江 +鈴池 +鈴沖 +鈴沢 +鈴河 +鈴浦 +鈴清 +鈴滝 +鈴澤 +鈴熊 +鈴田 +鈴畑 +鈴石 +鈴秋 +鈴立 +鈴紀 +鈴置 +鈴義 +鈴耒 +鈴茂 +鈴萩 +鈴藤 +鈴衛 +鈴裏 +鈴見 +鈴記 +鈴谷 +鈴賀 +鈴酒 +鈴里 +鈴野 +鈴野瀬 +鈴金 +鈴間 +鈴間屋 +鈴関 +鈴雲 +鈴鴨 +鈴鹿 +鈴鹿山 +鉄 +鉄下 +鉄丸 +鉄井 +鉄倉 +鉄具 +鉄升 +鉄原 +鉄口 +鉄地川原 +鉄地河原 +鉄増 +鉄宮 +鉄家 +鉄尾 +鉄屋 +鉄山 +鉄岡 +鉄岩 +鉄島 +鉄崎 +鉄嵜 +鉄川 +鉄戸 +鉄打 +鉄指 +鉄木 +鉄本 +鉄村 +鉄東 +鉄林 +鉄柱 +鉄森 +鉄橋 +鉄永 +鉄池 +鉄沢 +鉄澤 +鉄炮 +鉄炮塚 +鉄焼 +鉄田 +鉄留 +鉄矢 +鉄石 +鉄砲 +鉄砲塚 +鉄穴 +鉄穴口 +鉄穴森 +鉄羅 +鉄羽 +鉄艸 +鉄草 +鉄見 +鉄谷 +鉄賀 +鉄車 +鉄輪 +鉄重 +鉄野 +鉄鉋 +鉄阪 +鉅鹿 +鉈峯 +鉈峰 +鉈橋 +鉈落 +鉋六 +鉙 +鉙内 +鉙川 +鉛 +鉛口 +鉛山 +鉛谷 +鉞 +鉞田 +鉢 +鉢上 +鉢内 +鉢呂 +鉢岡 +鉢峯 +鉢峰 +鉢嶺 +鉢川 +鉢巻 +鉢形 +鉢木 +鉢本 +鉢村 +鉢田 +鉢窪 +鉢蝋 +鉢蠟 +鉢見 +鉢谷 +鉢迫 +鉢野 +鉢金 +鉢鍛治 +鉢須 +鉤 +鉤巻 +鉤流 +鉤谷 +鉦丸 +鉦打 +鉦本 +鉦谷 +鉱 +鉱山 +鉱崎 +鉱田 +鉱納 +鉽 +鉾 +鉾下 +鉾丸 +鉾久 +鉾之原 +鉾井 +鉾原 +鉾屋 +鉾山 +鉾岩 +鉾崎 +鉾建 +鉾木 +鉾本 +鉾林 +鉾根 +鉾浦 +鉾田 +鉾石 +鉾碕 +鉾立 +鉾谷 +鉾館 +銀 +銀原 +銀吉屋 +銀城 +銀家 +銀屋 +銀山 +銀岡 +銀島 +銀崎 +銀川 +銀座 +銀木 +銀本 +銀杏 +銀杏田 +銀林 +銀水 +銀永 +銀沢 +銀澤 +銀田 +銀納 +銀羽 +銀谷 +銀輪 +銀野 +銀鏡 +銅 +銅々 +銅伝 +銅住 +銅傳 +銅冶 +銅前 +銅口 +銅坂 +銅城 +銅堂 +銅子 +銅家 +銅屋 +銅山 +銅島 +銅崎 +銅川 +銅座 +銅木 +銅本 +銅玄 +銅田 +銅白 +銅直 +銅突 +銅網 +銅谷 +銅道 +銅野 +銅金 +銅釜 +銅銀 +銅銭 +銑川 +銑野 +銕 +銕尾 +銕山 +銕川 +銕本 +銕谷 +銖藤 +銘刈 +銘剣 +銘形 +銘田 +銘苅 +銘里 +銘釼 +銚子 +銚沼 +銛滝 +銭 +銭上 +銭丸 +銭亀 +銭井 +銭元 +銭原 +銭口 +銭台 +銭坂 +銭坪 +銭場 +銭塚 +銭尾 +銭屋 +銭山 +銭岡 +銭川 +銭広 +銭座 +銭廣 +銭本 +銭村 +銭林 +銭沢 +銭澤 +銭王 +銭瓶 +銭田 +銭盛 +銭目 +銭神 +銭花 +銭袋 +銭谷 +銭貫 +銭野 +銭高 +鋒 +鋒城 +鋒屋 +鋒山 +鋒崎 +鋒楯 +鋒田 +鋒谷 +鋤 +鋤元 +鋤先 +鋤園 +鋤山 +鋤崎 +鋤本 +鋤柄 +鋤沢 +鋤澤 +鋤田 +鋤納 +鋤谷 +鋤野 +鋤馬把 +鋪 +鋪倉 +鋪場 +鋪屋 +鋪村 +鋪根 +鋪田 +鋪谷 +鋪野 +鋲賀 +鋳久田 +鋳場崎 +鋳山 +鋳延 +鋳形 +鋳方 +鋳物 +鋳谷 +鋳鍋 +鋸屋 +鋸崎 +鋸本 +鋸田 +鋸谷 +鋼 +鋼鉄 +鋼鐵 +錆川 +錆谷 +錠 +錠内 +錠前 +錠本 +錠者 +錠解 +錠詰 +錠誥 +錠貫 +錠野 +錢亀 +錢屋 +錢岡 +錢田 +錢神 +錢谷 +錢野 +錢高 +錣山 +錦 +錦井 +錦元 +錦光山 +錦内 +錦出 +錦古里 +錦城 +錦小路 +錦山 +錦島 +錦川 +錦帯 +錦戸 +錦木 +錦本 +錦村 +錦氷 +錦池 +錦沢 +錦浜 +錦澤 +錦生 +錦田 +錦織 +錦美 +錦職 +錦見 +錦谷 +錦辺 +錦邉 +錦郡 +錦部 +錦里 +錦野 +錦𦀗 +錨 +錫切 +錫川 +錫木 +錫本 +錫村 +錫武 +錫谷 +錬石 +錺 +錺本 +錺村 +錺谷 +錺間 +鍋 +鍋丁 +鍋下 +鍋中 +鍋久保 +鍋九 +鍋井 +鍋代 +鍋倉 +鍋元 +鍋内 +鍋割 +鍋加 +鍋原 +鍋吉 +鍋地 +鍋坂 +鍋城 +鍋多 +鍋家 +鍋屋 +鍋山 +鍋岡 +鍋岩 +鍋島 +鍋崎 +鍋嶋 +鍋嶌 +鍋川 +鍋川原 +鍋師 +鍋平 +鍋広 +鍋床 +鍋廣 +鍋方 +鍋木 +鍋本 +鍋村 +鍋東 +鍋梨 +鍋森 +鍋永 +鍋池 +鍋沢 +鍋洲 +鍋浜 +鍋浦 +鍋潟 +鍋澤 +鍋濱 +鍋田 +鍋矢 +鍋石 +鍋羅 +鍋良 +鍋藤 +鍋西 +鍋谷 +鍋迫 +鍋野 +鍋釜 +鍔 +鍔井 +鍔原 +鍔坂 +鍔屋 +鍔山 +鍔木 +鍔本 +鍔田 +鍔谷 +鍛 +鍛井 +鍛代 +鍛元 +鍛冶 +鍛冶下 +鍛冶中 +鍛冶倉 +鍛冶元 +鍛冶内 +鍛冶原 +鍛冶口 +鍛冶園 +鍛冶場 +鍛冶塚 +鍛冶家 +鍛冶尾 +鍛冶屋 +鍛冶屋敷 +鍛冶山 +鍛冶岡 +鍛冶島 +鍛冶川 +鍛冶木 +鍛冶本 +鍛冶村 +鍛冶根 +鍛冶梁 +鍛冶沢 +鍛冶河内 +鍛冶澤 +鍛冶田 +鍛冶町 +鍛冶畑 +鍛冶舎 +鍛冶谷 +鍛冶貝 +鍛冶野 +鍛原 +鍛合 +鍛地 +鍛家 +鍛屋 +鍛島 +鍛川 +鍛広 +鍛成 +鍛本 +鍛村 +鍛次 +鍛次本 +鍛次畠 +鍛永 +鍛治 +鍛治ケ沢 +鍛治ケ澤 +鍛治下 +鍛治中 +鍛治倉 +鍛治元 +鍛治内 +鍛治原 +鍛治口 +鍛治古 +鍛治園 +鍛治場 +鍛治塚 +鍛治家 +鍛治尾 +鍛治屋 +鍛治屋敷 +鍛治山 +鍛治岡 +鍛治島 +鍛治崎 +鍛治川 +鍛治広 +鍛治木 +鍛治本 +鍛治村 +鍛治村谷 +鍛治根 +鍛治梁 +鍛治永 +鍛治江 +鍛治沢 +鍛治河内 +鍛治浦 +鍛治澤 +鍛治田 +鍛治町 +鍛治畑 +鍛治矢 +鍛治舍 +鍛治舎 +鍛治谷 +鍛治谷口 +鍛治貝 +鍛治野 +鍛治間 +鍛治馬 +鍛炭 +鍛田 +鍛示 +鍛谷 +鍛野 +鍜 +鍜代 +鍜冶 +鍜冶屋 +鍜冶川 +鍜冶沢 +鍜冶澤 +鍜冶谷 +鍜島 +鍜川 +鍜広 +鍜本 +鍜村 +鍜次 +鍜治 +鍜治中 +鍜治倉 +鍜治元 +鍜治原 +鍜治口 +鍜治古 +鍜治屋 +鍜治屋敷 +鍜治岡 +鍜治川 +鍜治木 +鍜治本 +鍜治梁 +鍜治沢 +鍜治河内 +鍜治澤 +鍜治田 +鍜治畑 +鍜治谷 +鍜治貝 +鍜治野 +鍜治馬 +鍜田 +鍜示 +鍜谷 +鍜野 +鍬 +鍬ケ谷 +鍬下 +鍬之手 +鍬先 +鍬光 +鍬内 +鍬冨 +鍬初 +鍬原 +鍬取 +鍬口 +鍬塚 +鍬守 +鍬家 +鍬富 +鍬島 +鍬崎 +鍬差 +鍬形 +鍬方 +鍬本 +鍬村 +鍬柄 +鍬永 +鍬泻 +鍬潟 +鍬瀉 +鍬田 +鍬畑 +鍬竹 +鍬谷 +鍬農 +鍬野 +鍬釣 +鍬鎌 +鍬開 +鍬間 +鍵 +鍵下 +鍵中 +鍵主 +鍵井 +鍵仲 +鍵元 +鍵内 +鍵冨 +鍵原 +鍵和田 +鍵埜 +鍵家 +鍵富 +鍵小野 +鍵尾 +鍵屋 +鍵山 +鍵岡 +鍵峯 +鍵峰 +鍵崎 +鍵嶋 +鍵川 +鍵市 +鍵平 +鍵広 +鍵廣 +鍵弥 +鍵彌 +鍵戸 +鍵掛 +鍵政 +鍵本 +鍵村 +鍵森 +鍵沢 +鍵浦 +鍵渡 +鍵澤 +鍵田 +鍵畑 +鍵矢 +鍵福 +鍵窪 +鍵籔 +鍵薮 +鍵谷 +鍵野 +鍵阪 +鍼田 +鍾ケ江 +鎌 +鎌ケ迫 +鎌上 +鎌下 +鎌中 +鎌久保 +鎌井 +鎌代 +鎌仲 +鎌倉 +鎌元 +鎌光 +鎌内 +鎌刈 +鎌北 +鎌原 +鎌取 +鎌口 +鎌吉 +鎌土 +鎌地 +鎌坂 +鎌垣 +鎌城 +鎌堂 +鎌塚 +鎌多 +鎌奥 +鎌子 +鎌宮 +鎌家 +鎌尾 +鎌居 +鎌屋 +鎌山 +鎌岡 +鎌峯 +鎌島 +鎌崎 +鎌川 +鎌形 +鎌徳 +鎌戸 +鎌房 +鎌手 +鎌数 +鎌方 +鎌木 +鎌本 +鎌村 +鎌松 +鎌林 +鎌柄 +鎌桑 +鎌森 +鎌橋 +鎌次 +鎌武 +鎌江 +鎌池 +鎌沢 +鎌津田 +鎌浦 +鎌滝 +鎌澤 +鎌瀧 +鎌瀬 +鎌田 +鎌畑 +鎌矢 +鎌石 +鎌腰 +鎌船 +鎌苅 +鎌草 +鎌蒲 +鎌谷 +鎌賀 +鎌足 +鎌込 +鎌近 +鎌迫 +鎌部 +鎌重 +鎌野 +鎌鍔 +鎌須賀 +鎌鹿 +鎔 +鎖是 +鎗 +鎗丸 +鎗井 +鎗光 +鎗内 +鎗分 +鎗場 +鎗尾 +鎗居 +鎗屋 +鎗山 +鎗戸 +鎗本 +鎗柄 +鎗水 +鎗田 +鎗目 +鎗谷 +鎗野 +鎗野目 +鎚水 +鎚田 +鎚谷 +鎧 +鎧坂 +鎧塚 +鎧沢 +鎧高 +鎬山 +鎭守 +鎭浪 +鎭田 +鎭目 +鎭西 +鎭野 +鎮 +鎮原 +鎮守 +鎮寺 +鎮山 +鎮波 +鎮浪 +鎮田 +鎮目 +鎮籏 +鎮西 +鎮谷 +鎮野 +鎮静 +鎰 +鎰元 +鎰広 +鎰廣 +鎰谷 +鎹 +鎺 +鏑 +鏑城 +鏑木 +鏑根 +鏑流馬 +鏑谷 +鏟 +鏡 +鏡免 +鏡内 +鏡原 +鏡味 +鏡園 +鏡堂 +鏡宮 +鏡屋 +鏡山 +鏡島 +鏡崎 +鏡川 +鏡森 +鏡橋 +鏡池 +鏡沼 +鏡淵 +鏡渕 +鏡田 +鏡畑 +鏡石 +鏡谷 +鐃平名 +鐏 +鐘カ江 +鐘ケ江 +鐘下 +鐘井 +鐘光 +鐘司 +鐘堂 +鐘場 +鐘尾 +鐘居 +鐘岡 +鐘島 +鐘崎 +鐘嵜 +鐘川 +鐘巻 +鐘推 +鐘搗 +鐘撞 +鐘方 +鐘本 +鐘森 +鐘江 +鐘治 +鐘田 +鐘突 +鐘築 +鐘谷 +鐘野 +鐘鋳 +鐙 +鐙塚 +鐙家 +鐙屋 +鐙方 +鐙本 +鐙田 +鐙谷 +鐙野 +鐡 +鐡丸 +鐡井 +鐡家 +鐡屋 +鐡山 +鐡岩 +鐡戸 +鐡本 +鐡穴 +鐡艸 +鐡見 +鐡重 +鐵 +鐵井 +鐵倉 +鐵具 +鐵原 +鐵口 +鐵宮 +鐵尾 +鐵屋 +鐵山 +鐵岡 +鐵岩 +鐵川 +鐵本 +鐵橋 +鐵池 +鐵澤 +鐵田 +鐵矢 +鐵石 +鐵穴 +鐵羅 +鐵艸 +鐵見 +鐵谷 +鐵重 +鐵野 +鐸木 +鐺 +鑁 +鑄山 +鑄方 +鑄物 +鑄谷 +鑄鍋 +鑑 +鑑光 +鑑原 +鑑次元 +鑑江 +鑑田 +鑑継 +鑓 +鑓井 +鑓光 +鑓分 +鑓利 +鑓小路 +鑓屋 +鑓本 +鑓水 +鑓河内 +鑓溝 +鑓田 +鑓野 +鑓野目 +鑛 +鑛山 +鑛崎 +鑛納 +鑪 +鑪ケ崎 +鑪前 +鑪迫 +鑪野 +鑰尼 +鑰山 +鑰本 +鑵子 +鑿 +長 +長ケ原 +長ケ部 +長一 +長丁 +長三 +長上 +長下 +長下部 +長与 +長世 +長並 +長丸 +長主 +長久 +長久保 +長久寺 +長井 +長代 +長伊 +長位 +長住 +長佐 +長佐古 +長侶 +長保 +長信 +長俣 +長倉 +長儀 +長元 +長先 +長光 +長内 +長冨 +長出 +長刀 +長利 +長前 +長副 +長力 +長加 +長加部 +長助 +長助沢 +長助澤 +長勢 +長北 +長医 +長升 +長南 +長原 +長又 +長友 +長口 +長只 +長司 +長合 +長吉 +長名 +長命 +長和 +長喜 +長園 +長土呂 +長土居 +長地 +長坂 +長坪 +長垣 +長城 +長埜 +長基 +長埼 +長堀 +長堂 +長場 +長塚 +長塩 +長増 +長壁 +長壽 +長多 +長太 +長央 +長奥 +長妙 +長妻 +長姫 +長子 +長子谷 +長宅 +長守 +長安 +長宗 +長宗我部 +長定 +長宝 +長宝院 +長宮 +長家 +長富 +長寿 +長小田 +長尾 +長居 +長屋 +長屋敷 +長山 +長岐 +長岑 +長岡 +長岡谷 +長岩 +長岳 +長岸 +長峪 +長峯 +長峯寺 +長峰 +長峰寺 +長島 +長崎 +長崎屋 +長嵐 +長嵜 +長嶋 +長嶌 +長嶝 +長嶧 +長嶺 +長川 +長川原 +長川堂 +長州 +長巾 +長市 +長幅 +長幡 +長平 +長平良 +長広 +長底 +長府 +長府谷 +長座 +長廣 +長延 +長廻 +長弓 +長弘 +長張 +長当 +長彦 +長後 +長徳 +長徳谷 +長応 +長恒 +長悼 +長意 +長愛 +長慶 +長慶寺 +長我部 +長戸 +長戸路 +長房 +長手 +長押 +長持 +長掘 +長掛 +長政 +長敷 +長方 +長日部 +長昌 +長明 +長春 +長曽 +長曽我部 +長曽根 +長曽部 +長曾 +長曾我部 +長曾部 +長木 +長木谷 +長末 +長本 +長朶 +長杉 +長村 +長束 +長条 +長東 +長松 +長松谷 +長松軒 +長松院 +長林 +長枝 +長柄 +長柴 +長栄 +長根 +長根尾 +長根山 +長桜 +長桶 +長條 +長棟 +長森 +長棹 +長楽 +長榮 +長槁 +長樂 +長橋 +長櫓 +長次 +長正 +長正路 +長武 +長殿 +長水 +長永 +長汐 +長江 +長池 +長沖 +長沢 +長河 +長治 +長沼 +長泉 +長泉地 +長法 +長洞 +長津 +長洲 +長浜 +長浜屋 +長浜谷 +長浦 +長浴 +長海 +長深田 +長淵 +長添 +長清 +長清水 +長渕 +長渡 +長満 +長源 +長溝 +長滝 +長滝谷 +長潟 +長澄 +長澤 +長濃 +長濱 +長濱谷 +長瀞 +長瀧 +長瀧谷 +長瀬 +長瀬川 +長瀬谷 +長燈 +長牛 +長狭 +長王 +長理 +長生 +長田 +長田谷 +長町 +長界 +長畑 +長畔 +長留 +長畝 +長畠 +長畦 +長登 +長白 +長目 +長相 +長矢 +長石 +長石倉 +長砂 +長硲 +長礒 +長祖 +長神 +長福 +長穂 +長積 +長窪 +長端 +長竹 +長竿 +長笠原 +長篠 +長納 +長続 +長綱 +長網 +長綿 +長総 +長縄 +長總 +長繁 +長繩 +長置 +長羅 +長美 +長義 +長翁 +長老 +長者 +長者久保 +長者原 +長者森 +長背 +長能 +長脇 +長脊 +長膳 +長與 +長興 +長興寺 +長舗 +長舟 +長舩 +長船 +長艫 +長良 +長良木 +長艸 +長芝 +長芦 +長花 +長苗 +長若 +長草 +長荒 +長菅 +長葭 +長葮 +長薗 +長藁 +長藤 +長行 +長行事 +長行司 +長衛 +長表 +長袋 +長西 +長見 +長角 +長記 +長谷 +長谷中 +長谷井 +長谷保 +長谷出 +長谷原 +長谷口 +長谷合 +長谷地 +長谷坂 +長谷場 +長谷塚 +長谷尾 +長谷屋 +長谷山 +長谷岡 +長谷島 +長谷崎 +長谷嶋 +長谷川 +長谷本 +長谷村 +長谷沢 +長谷河 +長谷沼 +長谷波 +長谷津 +長谷澤 +長谷生 +長谷田 +長谷目 +長谷美 +長谷藤 +長谷見 +長谷部 +長谷野 +長谷阪 +長谷雄 +長谷馬 +長谷高 +長貝 +長賀 +長賀部 +長越 +長足 +長路 +長輿 +長辺 +長辻 +長迫 +長迴 +長途 +長通 +長道 +長遠 +長邉 +長邊 +長邑 +長部 +長部谷 +長郷 +長都 +長里 +長重 +長野 +長野屋 +長野津 +長野浦 +長野谷 +長野間 +長針 +長鈴 +長鉾 +長鋤 +長鋪 +長録 +長鎌 +長門 +長門石 +長門谷 +長間 +長関 +長阪 +長阿弥 +長阿彌 +長院 +長陽 +長階 +長雄 +長静 +長面 +長面川 +長須 +長須賀 +長領 +長頭 +長養 +長香 +長馬 +長高 +長鳥 +長鴫 +長鶴 +長鷺 +長龍寺 +長﨏 +長𡵸 +門 +門ノ口 +門ノ戸 +門ノ沢 +門ノ澤 +門三 +門三野 +門上 +門下 +門世 +門並 +門中 +門丸 +門丹生 +門主 +門久 +門之口 +門之園 +門乢 +門井 +門伝 +門倉 +門側 +門傅 +門傳 +門元 +門内 +門出 +門分 +門別 +門利 +門前 +門割 +門包 +門原 +門口 +門叶 +門司 +門吉 +門名 +門向 +門善 +門園 +門土 +門地 +門坂 +門垣 +門城 +門埜 +門埼 +門堀 +門場 +門塚 +門多 +門奈 +門守 +門安 +門宮 +門家 +門富 +門富士 +門寺 +門尾 +門居 +門屋 +門屋町 +門山 +門岡 +門岩 +門島 +門崎 +門嶋 +門川 +門平 +門広 +門廣 +門廻 +門戸 +門所 +門手 +門政 +門敷 +門文 +門斉 +門斎 +門明 +門木 +門本 +門杉 +門村 +門条 +門東 +門松 +門林 +門枡 +門柳 +門栗 +門根 +門根木 +門桝 +門條 +門森 +門植 +門橋 +門永 +門江 +門池 +門沢 +門河 +門浜 +門浦 +門添 +門渡 +門澤 +門濱 +門瀬 +門灘 +門田 +門田見 +門町 +門畑 +門畠 +門目 +門眞 +門真 +門矢 +門石 +門磨 +門福 +門秋 +門積 +門端 +門築 +門美 +門脇 +門舛 +門芳 +門苧谷 +門藤 +門表 +門西 +門見 +門谷 +門路 +門輪 +門辺 +門通 +門道 +門邉 +門那 +門部 +門重 +門野 +門野上 +門野内 +門野坂 +門鍋 +門長 +門間 +門阪 +門雀 +門馬 +閂 +閉伊 +閉伊口 +閉篭 +閉籠 +閉野 +開 +開キ +開ノ内 +開上 +開主 +開井 +開作 +開保津 +開元 +開光 +開内 +開出 +開初 +開前 +開化 +開原 +開口 +開地 +開坂 +開場 +開尾 +開居 +開屋 +開山 +開島 +開崎 +開嶋 +開川 +開市 +開平 +開徳 +開敷 +開智 +開本 +開村 +開森 +開楽 +開江 +開沢 +開沼 +開泉 +開渡 +開澤 +開現 +開田 +開発 +開發 +開籐 +開米 +開船 +開藤 +開谷 +開道 +開野 +開高 +閌 +閏 +閏井 +閏木 +閏米 +閏野 +閏間 +閑 +閑上 +閑井 +閑古 +閑喜 +閑地 +閑定 +閑崎 +閑念 +閑戸 +閑本 +閑林 +閑歳 +閑治谷 +閑田 +閑社 +閑納 +閑者 +閑製 +閑谷 +閑野 +閑陀 +閑陸 +間 +間々下 +間々木 +間々瀬 +間々田 +間ケ数 +間ケ敷 +間ケ部 +間ノ瀬 +間丈 +間下 +間下部 +間世田 +間中 +間久 +間久保 +間之口 +間之川 +間井 +間井田 +間井谷 +間人 +間仁田 +間仲 +間伏 +間佐 +間佐古 +間内 +間処 +間利子 +間加田 +間原 +間取 +間口 +間叮 +間合 +間名 +間名部 +間吾 +間地 +間坂 +間坐 +間垣 +間城 +間埼 +間堂 +間場 +間塚 +間壁 +間多 +間定 +間室 +間宮 +間宵 +間尾 +間屋口 +間山 +間峠 +間峰 +間島 +間崎 +間嵜 +間嶋 +間嶌 +間嶺 +間川 +間左古 +間平 +間座 +間庭 +間弓 +間形 +間彦 +間恵 +間惣 +間戸 +間戸場 +間戸谷 +間所 +間手原 +間手野 +間持 +間方 +間明 +間明田 +間普 +間曽 +間曾 +間木 +間木内 +間木平 +間木野 +間杉 +間村 +間東 +間板 +間林 +間枝 +間柄 +間柴 +間根山 +間森 +間橋 +間正 +間武 +間殿 +間水 +間永 +間江 +間江野 +間沢 +間河部 +間泉 +間津 +間浦 +間海 +間淵 +間渕 +間澤 +間瀬 +間瀬口 +間瀬垣 +間瀬場 +間瀬戸 +間瀬木 +間瀬田 +間瀬羽 +間片 +間狩 +間狭 +間狹 +間生 +間田 +間田沢 +間田澤 +間畠 +間石 +間神 +間立 +間端 +間竹 +間箕 +間篠 +間簑 +間籐 +間米 +間納 +間縞 +間脇 +間舎 +間舘 +間舩 +間船 +間芝 +間苧谷 +間蔵 +間藏 +間藤 +間處 +間見 +間見江 +間見谷 +間谷 +間賀 +間賀田 +間賀部 +間賦口 +間越 +間路 +間辺 +間込 +間道 +間遠 +間邉 +間邊 +間邪 +間部 +間野 +間野内 +間野村 +間野田 +間野目 +間野窪 +間鍋 +間長 +間門 +間間田 +間関 +間阪 +間雲 +間霄 +間霜 +間館 +間馬 +閘 +閘前 +閠井 +閠間 +関 +関の内 +関ケ原 +関ケ浜 +関上 +関下 +関中 +関乃 +関久 +関之台 +関之尾 +関之山 +関之海 +関井 +関亦 +関位 +関俣 +関元 +関光 +関内 +関冨 +関原 +関友 +関取 +関口 +関合 +関吉 +関名 +関向 +関和 +関哉 +関地 +関坂 +関城 +関基 +関埼 +関堀 +関堂 +関場 +関塚 +関子 +関守 +関宮 +関家 +関富 +関寺 +関小田 +関尾 +関居 +関屋 +関山 +関岡 +関岩 +関島 +関崎 +関嵜 +関嶋 +関川 +関平 +関広 +関延 +関弥 +関徳 +関志路 +関戸 +関戸谷 +関昆 +関末 +関本 +関札 +関杉 +関村 +関来 +関東 +関東屋 +関東谷 +関松 +関根 +関根井 +関森 +関橋 +関次 +関段 +関氏 +関水 +関永 +関江 +関沢 +関河 +関沼 +関波 +関浜 +関浦 +関浪 +関添 +関満 +関澄 +関澤 +関濱 +関灘 +関熊 +関田 +関町 +関畑 +関留 +関盛 +関目 +関矢 +関石 +関端 +関籐 +関糸 +関羽 +関能 +関脇 +関舎 +関芳 +関茂 +関藤 +関西 +関見 +関角 +関谷 +関貫 +関越 +関路 +関軒 +関輪 +関達 +関邨 +関部 +関野 +関野山 +関間 +関頭 +関黒 +閤師 +閤田 +閨 +閨島 +閨崎 +閨谷 +閻長 +閼伽井 +闇雲 +闍弥 +闍彌 +闐々 +闐闐 +闕山 +闕野 +關 +關井 +關亦 +關原 +關口 +關堀 +關場 +關塚 +關家 +關尾 +關屋 +關岡 +關川 +關戸 +關本 +關杉 +關村 +關根 +關橋 +關澤 +關田 +關目 +關藤 +關谷 +關野 +闥木 +阜 +阜山 +阜本 +阜松 +阡陌 +阪 +阪ノ上 +阪ノ下 +阪上 +阪上谷 +阪下 +阪中 +阪之上 +阪之下 +阪井 +阪井田 +阪井谷 +阪依田 +阪倉 +阪元 +阪入 +阪内 +阪出 +阪原 +阪口 +阪和 +阪地 +阪垣 +阪埜 +阪堂 +阪場 +阪奥 +阪妻 +阪寄 +阪尻 +阪尾 +阪居 +阪山 +阪岡 +阪峯 +阪島 +阪崎 +阪嵜 +阪川 +阪巻 +阪庭 +阪後 +阪従 +阪成 +阪戸 +阪手 +阪木 +阪本 +阪本谷 +阪村 +阪東 +阪松 +阪林 +阪柳 +阪柿 +阪栄 +阪根 +阪梨 +阪森 +阪植 +阪永 +阪江 +阪浜 +阪浦 +阪瀬 +阪無 +阪爪 +阪牧 +阪田 +阪畑 +阪神 +阪納 +阪脇 +阪藤 +阪藪 +阪衛 +阪裏 +阪西 +阪詰 +阪谷 +阪越 +阪路 +阪辺 +阪辻 +阪邊 +阪部 +阪野 +阪長 +阪間 +阪頭 +阪高 +防 +防ケ谷 +防地 +防川 +防後 +防木 +防村 +防玉 +防田 +防護 +防越 +防野 +阿 +阿々津 +阿㘴上 +阿万 +阿万瀬 +阿万田 +阿万野 +阿下 +阿世保 +阿世比 +阿世比丸 +阿世知 +阿世賀 +阿中 +阿久 +阿久井 +阿久刀川 +阿久原 +阿久戸 +阿久根 +阿久沢 +阿久津 +阿久澤 +阿久田 +阿久禰 +阿久間 +阿乗 +阿乘 +阿二 +阿井 +阿井光 +阿井川 +阿仁 +阿仁屋 +阿仁谷 +阿代田 +阿会根 +阿住 +阿佐 +阿佐伊 +阿佐尾 +阿佐慶 +阿佐比 +阿佐美 +阿佐見 +阿佐部 +阿佐野 +阿保 +阿保谷 +阿倉 +阿倍 +阿倍倉 +阿倍野 +阿僧田 +阿光 +阿児 +阿具根 +阿内 +阿冶部 +阿出川 +阿刀 +阿刀田 +阿分 +阿別当 +阿利 +阿加井 +阿加多 +阿北 +阿千輪 +阿南 +阿原 +阿口 +阿古 +阿古下 +阿古井 +阿古江 +阿古目 +阿合 +阿向 +阿吹 +阿吾 +阿呉夢 +阿品 +阿喰 +阿嘉 +阿嘉嶺 +阿土 +阿在 +阿地 +阿地方 +阿地知 +阿地部 +阿坂 +阿坐上 +阿垣 +阿塚 +阿墨 +阿壽賀 +阿多 +阿多利 +阿多口 +阿多江 +阿多石 +阿多野 +阿夛 +阿天坊 +阿天防 +阿太地 +阿奈 +阿妻 +阿子 +阿子島 +阿子嶋 +阿子田 +阿字 +阿字地 +阿字川 +阿字野 +阿字雄 +阿孫 +阿宅 +阿守 +阿安 +阿宗 +阿実 +阿宮 +阿寄 +阿實 +阿寺 +阿寿賀 +阿小毛 +阿尻 +阿尾 +阿尾井 +阿山 +阿岸 +阿島 +阿崎 +阿嶋 +阿川 +阿左美 +阿左見 +阿師村 +阿度 +阿座上 +阿座見野 +阿式 +阿弓 +阿弥 +阿彌 +阿形 +阿彦 +阿征 +阿志谷 +阿志賀 +阿慈地 +阿慈知 +阿慈谷 +阿慶田 +阿我妻 +阿我田 +阿我礼 +阿戸 +阿手 +阿折 +阿掛 +阿方 +阿施 +阿早田 +阿星 +阿智 +阿智北 +阿智原 +阿曇 +阿曽 +阿曽井 +阿曽宇 +阿曽尾 +阿曽村 +阿曽根 +阿曽沼 +阿曽生 +阿曽田 +阿曽野 +阿曾 +阿曾井 +阿曾尾 +阿曾村 +阿曾沼 +阿曾田 +阿月 +阿望 +阿木 +阿木良 +阿本 +阿村 +阿松 +阿桑 +阿次富 +阿武 +阿武屋 +阿武木 +阿武羅 +阿武野 +阿武隈川 +阿母 +阿比倉 +阿比子 +阿比畄 +阿比留 +阿比野 +阿毛 +阿水 +阿汀 +阿江 +阿沢 +阿河 +阿治 +阿治部 +阿泉 +阿波 +阿波井 +阿波加 +阿波屋 +阿波峯 +阿波峰 +阿波島 +阿波崎 +阿波嵜 +阿波嶋 +阿波曽 +阿波曾 +阿波村 +阿波根 +阿波治 +阿波田 +阿波角 +阿波谷 +阿波賀 +阿波連 +阿波部 +阿波野 +阿津 +阿津又 +阿津地 +阿津坂 +阿津川 +阿津沢 +阿津澤 +阿津磨 +阿津間 +阿洲波 +阿浜 +阿渡 +阿満 +阿滿 +阿漕 +阿潟浜 +阿潟濱 +阿澄 +阿澤 +阿濱 +阿瀬 +阿瀬井 +阿瀬川 +阿瀬沼 +阿瀬田 +阿瀬知 +阿瀬見 +阿瀬部 +阿片 +阿玉 +阿王 +阿生山 +阿田 +阿田原 +阿田子 +阿田川 +阿田木 +阿由葉 +阿甲 +阿留多伎 +阿畠 +阿登 +阿相 +阿県 +阿真 +阿矢谷 +阿矢部 +阿知 +阿知原 +阿知和 +阿知地 +阿知波 +阿知破 +阿知羅 +阿知良 +阿知葉 +阿知野 +阿石 +阿砂 +阿砂利 +阿磨 +阿礼 +阿神田 +阿積 +阿立 +阿童 +阿竹 +阿籏 +阿紀 +阿納 +阿納田 +阿縣 +阿羅 +阿羅田 +阿美 +阿美井 +阿美古 +阿美岡 +阿美谷 +阿能 +阿舎利 +阿良 +阿良井 +阿良山 +阿良木 +阿良田 +阿茂瀬 +阿茶 +阿草 +阿菅原 +阿萬 +阿萬瀬 +阿萬田 +阿萬野 +阿葉家 +阿蒜 +阿蔵 +阿藏 +阿藤 +阿藻 +阿蘇 +阿蘇和 +阿蘇品 +阿蘇山 +阿蘇波 +阿蘇田 +阿蘇谷 +阿蘇野 +阿蘓 +阿蘓品 +阿蘓波 +阿蛭 +阿見 +阿見寺 +阿見弥 +阿見彌 +阿見田 +阿諏訪 +阿讃坊 +阿讃横 +阿谷 +阿賀 +阿賀井 +阿賀利 +阿賀岡 +阿賀嶺 +阿賀田 +阿賀谷 +阿賀野 +阿路 +阿路川 +阿踏 +阿輪 +阿辺 +阿辺山 +阿辺川 +阿辻 +阿近 +阿迦井 +阿逹 +阿達 +阿邉 +阿邉山 +阿邊 +阿邊山 +阿那 +阿那田 +阿部 +阿部井 +阿部倉 +阿部山 +阿部島 +阿部川 +阿部松 +阿部津 +阿部田 +阿部羅 +阿部野 +阿郷 +阿都間 +阿重田 +阿野 +阿野尾 +阿野山 +阿野田 +阿金 +阿閇 +阿閉 +阿間 +阿間子 +阿間川 +阿間見 +阿阪 +阿陁 +阿陪 +阿隅 +阿随 +阿雲 +阿須名 +阿須賀 +阿須間 +阿頼耶 +阿食 +阿高 +阿鷹 +阿鹿 +阿麻橘 +阿黒 +陀保 +陀安 +附 +附出 +附家 +附屋根 +附島 +附木 +附柳 +附柴 +附田 +附芝 +附野 +陌間 +降井 +降屋 +降幡 +降旗 +降松 +降梁 +降田 +降畑 +降矢 +降簱 +降籏 +降谷 +降重 +降雄 +降駒 +降魔 +陟山 +院 +院上 +院丸 +院京 +院内 +院南 +院去 +院多本 +院山 +院瀬見 +院田 +院納 +院能 +陣 +陣ケ尾 +陣ケ岡 +陣ノ +陣ノ内 +陣一 +陣上 +陣之内 +陣之後 +陣代 +陣兵 +陣内 +陣出 +陣副 +陣原 +陣取 +陣口 +陣土井 +陣在 +陣場 +陣家 +陣尾 +陣屋 +陣山 +陣岡 +陣岸 +陣崎 +陣川 +陣座 +陣後 +陣条 +陣東 +陣松 +陣林 +陣森 +陣武 +陣田 +陣矢 +陣祐 +陣立 +陣竹 +陣脇 +陣谷 +陣貝 +陣野 +陣野原 +陣鎌 +陣門 +陣香 +陣駒 +除 +除ケ口 +除上 +除内 +除原 +除地 +除川 +除本 +除村 +除田 +除石 +除補 +除野 +除門 +陦 +陬波 +陬防 +陰 +陰上 +陰下 +陰久 +陰佐 +陰元 +陰地 +陰地野 +陰山 +陰岩 +陰島 +陰平 +陰本 +陰東 +陰永 +陰浦 +陰田 +陰能 +陰裡 +陰貞 +陰迫 +陰道 +陰里 +陰野 +陳 +陳ケ尾 +陳ノ内 +陳之内 +陳之後 +陳井 +陳代 +陳内 +陳副 +陳原 +陳園 +陳城 +陳場 +陳尾 +陳山 +陳岡 +陳川 +陳暁 +陳東 +陳松 +陳田 +陳祐 +陳野 +陳野原 +陳馬 +陵城 +陵木 +陵本 +陶 +陶久 +陶南 +陶原 +陶器 +陶国 +陶國 +陶守 +陶尾 +陶山 +陶川 +陶延 +陶木 +陶村 +陶江 +陶沢 +陶浪 +陶田 +陶野 +陸 +陸上 +陸井 +陸原 +陸口 +陸奥 +陸奥田 +陸川 +陸歎 +陸永 +陸浦 +陸田 +陸西 +陸路 +陸辺 +陸野 +陸門 +険崎 +陽 +陽原 +陽向 +陽地 +陽城 +陽奥 +陽宇 +陽山 +陽岡 +陽川 +陽木 +陽本 +陽杉 +陽江 +陽源 +陽田 +陽谷 +陽遊 +陽野 +隂地 +隂山 +隄 +隅 +隅中 +隅井 +隅倉 +隅元 +隅内 +隅出 +隅原 +隅友 +隅地 +隅坂 +隅垣 +隅垣内 +隅埜 +隅子 +隅屋 +隅山 +隅岡 +隅崎 +隅川 +隅広 +隅廣 +隅木 +隅本 +隅村 +隅水 +隅永 +隅江 +隅沢 +隅河内 +隅澤 +隅田 +隅田原 +隅田川 +隅蔵 +隅藏 +隅谷 +隅越 +隅部 +隅重 +隅野 +隅防 +隆 +隆久 +隆司 +隆埼 +隆島 +隆志 +隆杉 +隆琦 +隆藤 +隆谷 +隆辻 +隆野 +隈 +隈上 +隈下 +隈丸 +隈井 +隈伊 +隈倉 +隈元 +隈原 +隈園 +隈坂 +隈岡 +隈崎 +隈嵜 +隈川 +隈懐 +隈本 +隈村 +隈江 +隈沢 +隈河 +隈澤 +隈田 +隈田原 +隈谷 +隈辺 +隈部 +隈郷 +隈野 +隋原 +隋念 +隋行 +隍 +階 +階上 +階下 +階元 +階地 +階堂 +階子 +階川 +階戸 +階方 +階本 +階枝 +階森 +階藤 +随井 +随原 +随安 +随念 +随木 +随林 +随永 +随行 +隔山 +隘田 +際 +際中 +際川 +際本 +際田 +際谷 +障子 +障子上 +障子口 +障子川 +障子田 +隝田 +隠 +隠善 +隠土 +隠地 +隠地前 +隠塚 +隠家 +隠居 +隠山 +隠岐 +隠岐村 +隠岐田 +隠岐谷 +隠崎 +隠明寺 +隠木 +隠村 +隠樹 +隠沢 +隠浪 +隠渡 +隠澤 +隠田 +隠矢 +隠野 +隣 +隣井 +隣垣 +隣垣内 +隣谷 +隥 +隥本 +隨原 +隨念 +隨木 +隨林 +隨行 +隯 +隱岐 +隱田 +隴岡 +隴本 +隴西 +隼 +隼人 +隼木 +隼瀬 +隼田 +隼野 +雀ケ野 +雀地 +雀堂 +雀庵 +雀部 +雀野 +雁 +雁丸 +雁住 +雁俣 +雁原 +雁子 +雁尾 +雁川原 +雁幕 +雁平 +雁木 +雁林 +雁沢 +雁津 +雁澤 +雁瀬 +雁田 +雁畑 +雁藤 +雁行 +雁谷 +雁部 +雁野 +雁金 +雁長 +雁食 +雄 +雄上 +雄倉 +雄副 +雄勝 +雄城 +雄場 +雄山 +雄島 +雄崎 +雄嶋 +雄川 +雄心 +雄木 +雄松 +雄沢 +雄澤 +雄竜 +雄西 +雄谷 +雄賀多 +雄郷 +雄野 +雄長 +雄門 +雄関 +雄鳥 +雄鹿 +雄龍 +雅井 +雅岡 +雅意 +雅木 +雅楽 +雅楽代 +雅楽川 +雅樂 +雅樂川 +雅留宮 +雅鳳 +集 +集下 +集冶 +集地 +集堂 +集山 +集治 +集田 +集貝 +集路 +集𪚲 +雇地 +雉子島 +雉子沼 +雉子波 +雉子牟田 +雉子谷 +雉尾 +雉岡 +雉島 +雉嶋 +雉本 +雉真 +雉野 +雉間 +雉鳥 +雉鼻 +雌 +雌熊 +雌鹿 +雑候谷 +雑古 +雑喉 +雑喉屋 +雑喉谷 +雑子 +雑山 +雑崎 +雑敷 +雑本 +雑村 +雑色 +雑花 +雑賀 +雑部 +雑野 +雙上 +雙木 +雙松 +雙田 +雙知 +雙郷 +雙里 +雛 +雛倉 +雛元 +雛原 +雛司 +雛埜 +雛子 +雛岡 +雛川 +雛平 +雛形 +雛成 +雛木 +雛本 +雛森 +雛沢 +雛玉 +雛田 +雛田谷 +雛窪 +雛竹 +雛谷 +雛迫 +雛野 +雛鶴 +雜古 +雜喉 +雜喉屋 +雜喉谷 +雜敷 +雜村 +雜色 +雜花 +雜賀 +雜部 +離 +離石 +難場 +難家 +難波 +難波江 +難波田 +難羽 +難藤 +難部 +雨ケ崎 +雨ケ谷 +雨ノ宮 +雨ノ森 +雨下 +雨久保 +雨之宮 +雨乞 +雨井 +雨倉 +雨内 +雨包 +雨土 +雨地 +雨坂 +雨坪 +雨堤 +雨塚 +雨夜 +雨奥 +雨子 +雨安 +雨宮 +雨尾 +雨山 +雨岸 +雨島 +雨崎 +雨嶋 +雨川 +雨師 +雨平 +雨提 +雨木 +雨村 +雨松 +雨林 +雨森 +雨水 +雨池 +雨沢 +雨河 +雨沼 +雨洗 +雨海 +雨滝 +雨澤 +雨瀧 +雨瀬 +雨無 +雨田 +雨甲斐 +雨皿 +雨盛 +雨矢 +雨知 +雨積 +雨窪 +雨笠 +雨谷 +雨貝 +雨越 +雨車 +雨辺 +雨辻 +雨郡 +雨郷 +雨野 +雨野宮 +雨間 +雨霧 +雨面 +雪 +雪ノ浦 +雪上 +雪下 +雪丸 +雪井 +雪元 +雪光 +雪入 +雪冨 +雪原 +雪古 +雪吉 +雪吹 +雪垣 +雪城 +雪宗 +雪定 +雪室 +雪家 +雪富 +雪尾 +雪屋 +雪山 +雪岡 +雪峰 +雪島 +雪嵐 +雪嶋 +雪平 +雪広 +雪廣 +雪本 +雪杉 +雪村 +雪松 +雪枝 +雪森 +雪正 +雪水 +雪永 +雪江 +雪沢 +雪浦 +雪渕 +雪澤 +雪田 +雪畑 +雪盛 +雪矢 +雪竹 +雪縄 +雪繩 +雪草 +雪見 +雪谷 +雪貞 +雪辰 +雪野 +雪頭 +雫 +雫内 +雫川 +雫田 +雫石 +雲 +雲下 +雲中 +雲丹亀 +雲乗 +雲井 +雲倉 +雲内 +雲出 +雲切 +雲北 +雲南 +雲南田 +雲口 +雲名 +雲土 +雲地 +雲坂 +雲垣 +雲城 +雲壁 +雲宝 +雲宮 +雲尾 +雲居 +雲山 +雲岡 +雲峰 +雲島 +雲崎 +雲嶋 +雲川 +雲形 +雲戸 +雲所 +雲春 +雲晴 +雲木 +雲本 +雲村 +雲林 +雲林院 +雲根 +雲梯 +雲母 +雲津 +雲浦 +雲海 +雲瀬 +雲然 +雲田 +雲石 +雲竜 +雲籐 +雲英 +雲菅 +雲藤 +雲見 +雲谷 +雲財 +雲走 +雲越 +雲足 +雲郷 +雲野 +雲開 +雲雀 +雲雀田 +雲類鷲 +雲鶴 +雲龍 +雷 +電 +霄 +震 +震明 +霊 +霊元 +霊場 +霊山 +霊岳 +霊崎 +霊松 +霊池 +霊河 +霊田 +霊群 +霊鞍 +霊鷲 +霍原 +霍口 +霍山 +霍川 +霍本 +霍村 +霍沢 +霍澤 +霍田 +霍見 +霍野 +霍間 +霜 +霜上 +霜下 +霜中 +霜井 +霜倉 +霜凍 +霜出 +霜原 +霜取 +霜古田 +霜坂 +霜垣 +霜多 +霜尾 +霜山 +霜岡 +霜峯 +霜島 +霜崎 +霜嵜 +霜川 +霜平 +霜手 +霜方 +霜村 +霜柿 +霜永 +霜江 +霜沢 +霜津 +霜浦 +霜澤 +霜田 +霜石 +霜竹 +霜良 +霜藤 +霜見 +霜触 +霜觸 +霜越 +霜辻 +霜里 +霜重 +霜野 +霜門 +霜阪 +霜降 +霜鳥 +霞 +霞上 +霞堂 +霞末 +霞本 +霞沢 +霞流 +霞澤 +霞鳥 +霧下 +霧山 +霧島 +霧嶋 +霧村 +霧林 +霧渡 +霧生 +霧畑 +霧道 +霧里 +霧野 +露 +露久保 +露久志 +露元 +露先 +露内 +露原 +露口 +露地 +露岡 +露峯 +露峰 +露崎 +露嵜 +露成 +露木 +露本 +露村 +露梨 +露無 +露田 +露繁 +露花 +露草 +露詰 +露谷 +露重 +露野 +露雪 +靄門 +青 +青ノ +青丘 +青中 +青亀 +青井 +青代 +青位 +青佐 +青倉 +青儀 +青元 +青冢 +青出 +青出木 +青刈 +青北 +青原 +青口 +青司 +青合 +青名 +青名畑 +青名端 +青園 +青地 +青坂 +青垣 +青垣内 +青城 +青堀 +青塚 +青墳 +青士 +青天目 +青奈 +青宮 +青宿 +青尾 +青屋 +青山 +青岡 +青岸 +青峰 +青島 +青崎 +青嵜 +青嶋 +青嶌 +青川 +青広 +青座 +青廣 +青影 +青悦 +青戈 +青戸 +青手木 +青才 +青掘 +青掛 +青方 +青景 +青曽 +青曾 +青替 +青木 +青木原 +青木山 +青木葉 +青木谷 +青本 +青杉 +青村 +青松 +青板 +青林 +青枝 +青柳 +青柴 +青柿 +青栄 +青根 +青桝 +青梅 +青梨 +青森 +青樹 +青橋 +青水 +青江 +青池 +青沢 +青河 +青沼 +青泉 +青波 +青泰 +青津 +青浜 +青浪 +青海 +青海川 +青淵 +青渕 +青滝 +青澄 +青澤 +青瀧 +青瀬 +青田 +青盛 +青目 +青矢 +青石 +青砥 +青竜 +青竹 +青笹 +青羽 +青能 +青艸 +青芝 +青芭 +青芳 +青苅 +青草 +青菅 +青菜 +青萩 +青葉 +青蔭 +青藤 +青西 +青見 +青谷 +青豆 +青貝 +青貫 +青路 +青迫 +青郷 +青野 +青鉢 +青錆 +青陰 +青陽 +青雲 +青鬼 +青鹿 +青麻 +青黄 +青龍 +青龍寺 +青𡌛 +靖本 +靖田 +静 +静井 +静光 +静内 +静原 +静居 +静屋 +静山 +静岡 +静島 +静川 +静木 +静本 +静村 +静森 +静楽 +静永 +静波 +静浦 +静海 +静田 +静納 +静脈 +静観 +静谷 +静賀 +静里 +静野 +静間 +静馬 +靜 +靜井 +靜家 +靜川 +靜本 +靜永 +靜海 +靜目 +靜観 +靜谷 +靜野 +靜間 +非々 +非治 +非浦 +非留田 +非非 +面 +面ノ +面上 +面下 +面井 +面代 +面内 +面出 +面園 +面地 +面坪 +面城 +面壁 +面家 +面屋 +面山 +面崎 +面川 +面平 +面影 +面手 +面曽 +面曾 +面木 +面本 +面村 +面条 +面来 +面松 +面林 +面條 +面民 +面沢 +面波 +面湫 +面澤 +面田 +面畑 +面白 +面矢 +面谷 +面迫 +面野 +面高 +靨 +革島 +革嶋 +靭 +靭尾 +靭江 +靭矢 +靭負 +靱 +靱尾 +靱江 +靱矢 +靱負 +靹 +靹谷 +鞁島 +鞁嶋 +鞁田 +鞆 +鞆井 +鞆光 +鞆出 +鞆安 +鞆屋 +鞆岡 +鞆川 +鞆工 +鞆来 +鞆森 +鞆正 +鞆永 +鞆江 +鞆津 +鞆浦 +鞆清 +鞆田 +鞆綱 +鞆総 +鞆總 +鞆谷 +鞆野 +鞍 +鞍丈 +鞍井 +鞍作 +鞍元 +鞍光 +鞍内 +鞍口 +鞍垣 +鞍富 +鞍岡 +鞍崎 +鞍川 +鞍懸 +鞍成 +鞍打 +鞍掛 +鞍智 +鞍本 +鞍橋 +鞍津輪 +鞍田 +鞍田屋 +鞍留 +鞍知 +鞍石 +鞍立 +鞍谷 +鞍貫 +鞍迫 +鞍野 +鞍馬 +鞘佑 +鞘師 +鞘木 +鞘本 +鞘脇 +鞘野 +鞠 +鞠井 +鞠古 +鞠園 +鞠子 +鞠子谷 +鞠尾 +鞠山 +鞠川 +鞠本 +鞠河 +鞠谷 +鞭 +鞭木 +鞭目 +鞭馬 +韓山 +韮原 +韮塚 +韮山 +韮崎 +韮江 +韮沢 +韮澤 +韮谷 +韮野 +音 +音上 +音丸 +音之宮 +音井 +音代 +音光 +音光寺 +音出 +音吉 +音和 +音喜多 +音喜夛 +音土 +音在 +音地 +音坂 +音城 +音堂 +音堅 +音場 +音塩 +音寺 +音尾 +音居 +音山 +音峯 +音峰 +音島 +音崎 +音嶋 +音川 +音成 +音揃 +音方 +音曽 +音村 +音松 +音森 +音永 +音沢 +音河 +音泉 +音津 +音流村 +音海 +音淵 +音渕 +音渡 +音澤 +音瀬 +音無 +音琴 +音田 +音石 +音窪 +音竹 +音納 +音綿 +音羽 +音花 +音葉 +音藤 +音西 +音見 +音谷 +音賀 +音辻 +音道 +音部 +音野 +音間 +音頭 +音馬 +音高 +音𣷓 +響 +響尾 +響波 +響谷 +響野 +頂 +頂岳 +頃安 +頃常 +頃木 +頃未 +頃末 +頃橋 +頃石 +項安 +順 +順井 +順吉 +順安 +順徳 +順教寺 +順本 +順毛 +順田 +順船 +順藤 +順西 +順道 +順風 +須々井 +須々木 +須々田 +須々美 +須ケ原 +須ケ崎 +須ケ牟田 +須ケ間 +須ノ上 +須ノ内 +須ノ原 +須ノ又 +須一 +須上 +須下 +須並 +須中 +須丸 +須丹礼 +須久井 +須之内 +須之原 +須之部 +須井 +須亦 +須代 +須佐 +須佐井 +須佐美 +須佐見 +須保 +須元 +須内 +須加 +須加井 +須加原 +須加尾 +須加崎 +須加川 +須加田 +須加野 +須原 +須又 +須口 +須古 +須古井 +須古星 +須合 +須名 +須向 +須吾 +須呂 +須和 +須和名 +須和田 +須和部 +須地田 +須坂 +須垣 +須基 +須埼 +須堯 +須場 +須増 +須多 +須夜崎 +須天 +須太 +須子 +須子田 +須安 +須室 +須小 +須尭 +須山 +須島 +須崎 +須嵜 +須川 +須左美 +須平 +須广 +須床 +須弥岳 +須志原 +須志田 +須応 +須恵 +須惠 +須戸 +須摩 +須摩岡 +須摩淵 +須摩渕 +須摩谷 +須斉 +須斎 +須方 +須智 +須曽 +須曽野 +須曾 +須木 +須本 +須村 +須東 +須林 +須栗 +須栗場 +須森 +須毛原 +須毛田 +須永 +須江 +須沢 +須河 +須河内 +須沼 +須泉 +須波 +須津 +須浜 +須浦 +須浪 +須海 +須淵 +須清 +須渕 +須澄 +須澤 +須濱 +須玉 +須田 +須田山 +須田島 +須田木 +須田村 +須甲 +須留原 +須留川 +須百 +須直 +須知 +須磨 +須磨岡 +須磨崎 +須磨淵 +須磨渕 +須磨田 +須磨谷 +須笠 +須笠原 +須箕 +須箱 +須籐 +須納瀬 +須綱 +須網 +須美 +須羽 +須股 +須能 +須脇 +須花 +須茂原 +須萱 +須蒲 +須藤 +須行 +須見 +須計 +須谷 +須貝 +須貸 +須賀 +須賀中 +須賀井 +須賀原 +須賀尾 +須賀山 +須賀崎 +須賀川 +須賀本 +須賀森 +須賀沢 +須賀沼 +須賀浦 +須賀澤 +須賀田 +須賀谷 +須賀野 +須賀院 +須軽 +須輪 +須道 +須那 +須部 +須郷 +須郷多 +須郷田 +須都 +須野 +須野原 +須野崎 +須野田 +須金 +須釜 +須鎌 +須鎗 +須鑓 +須長 +須間 +須関 +須階 +須須木 +須須田 +須頭 +須飼 +須高 +須鴨 +須鹿 +須麻 +須麿 +須黒 +須鼻 +須齊 +須齋 +頌彦 +預 +預り +預幡 +頓京 +頓原 +頓名 +頓宮 +頓平 +頓所 +頓木 +頓田 +頓花 +頓華 +頓行 +頓西国 +頓部 +頓野 +頓阿弥 +頗羅堕 +頭下 +頭久保 +頭井 +頭利 +頭司 +頭地 +頭士 +頭士井 +頭山 +頭島 +頭川 +頭巾 +頭市 +頭師 +頭庄 +頭応 +頭應 +頭木 +頭本 +頭根 +頭田 +頭金 +頭間 +頭高 +頭鬼 +頴原 +頴姓 +頴娃 +頴川 +頴河 +頼 +頼久 +頼仲 +頼住 +頼信 +頼元 +頼光 +頼兼 +頼冨 +頼則 +頼前 +頼友 +頼国 +頼國 +頼地 +頼安 +頼定 +頼実 +頼富 +頼實 +頼尊 +頼岡 +頼島 +頼常 +頼広 +頼廣 +頼房 +頼政 +頼朝 +頼木 +頼末 +頼本 +頼松 +頼正 +頼母 +頼母木 +頼永 +頼沢 +頼澤 +頼田 +頼経 +頼經 +頼美 +頼藤 +頼角 +頼谷 +頼貞 +頼近 +頼重 +頼野 +頼金 +頼長 +頼高 +題仏 +題佛 +題府 +額 +額原 +額宮 +額川 +額村 +額狩 +額田 +額見 +額谷 +額賀 +顔念 +顕光院 +顕山 +顕徳 +顕木 +顕考 +顕谷 +願主 +願化 +願城 +願城寺 +願念 +願成寺 +願永 +願法 +願海 +願能 +願興寺 +願野 +顧 +顧島 +顧志 +顯谷 +風 +風ケ端 +風上 +風下 +風井 +風倉 +風元 +風卷 +風原 +風口 +風呂 +風呂ノ上 +風呂上 +風呂下 +風呂中 +風呂井 +風呂元 +風呂光 +風呂内 +風呂山 +風呂川 +風呂本 +風呂橋 +風呂田 +風呂矢 +風呂見 +風呂谷 +風呂迫 +風呂野 +風味 +風和 +風坂 +風外 +風尾 +風山 +風岡 +風嵐 +風川 +風巻 +風張 +風当 +風戸 +風折 +風斗 +風早 +風晴 +風木 +風本 +風村 +風林 +風柳 +風殿 +風沢 +風波見 +風浦 +風澤 +風炉田 +風無 +風牧 +風生 +風田 +風田川 +風留 +風當 +風登 +風盛 +風真 +風神 +風祭 +風穴 +風端 +風能 +風藤 +風袋 +風見 +風谷 +風越 +風速 +風里谷 +風野 +風間 +風隼 +颪柴 +颪辺 +颪邊 +颯々野 +颯佐 +颯波 +颯田 +飛 +飛ケ谷 +飛㘴 +飛下 +飛与田 +飛世 +飛井 +飛佐 +飛倉 +飛内 +飛原 +飛口 +飛呂 +飛喜多 +飛土 +飛地 +飛坂 +飛坐 +飛垣 +飛垣内 +飛塚 +飛多 +飛多下 +飛奈 +飛子 +飛安 +飛家 +飛尻 +飛尾 +飛屋 +飛山 +飛岡 +飛峪 +飛島 +飛崎 +飛嵜 +飛嶋 +飛川 +飛工 +飛座 +飛延 +飛弾 +飛弾村 +飛弾野 +飛彈 +飛彈野 +飛志津 +飛戸 +飛木 +飛木田 +飛村 +飛来 +飛松 +飛林 +飛柿 +飛栖 +飛梅 +飛武 +飛毛 +飛気 +飛氣 +飛永 +飛沢 +飛河 +飛渡 +飛澤 +飛瀬 +飛熊 +飛田 +飛田和 +飛田野 +飛留間 +飛登 +飛矢 +飛矢地 +飛矢崎 +飛知和 +飛知輪 +飛石 +飛竜 +飛舗 +飛良 +飛芸 +飛落 +飛葉 +飛藝 +飛見 +飛計路 +飛詰 +飛谷 +飛賀 +飛賀野 +飛越 +飛里 +飛野 +飛鋪 +飛開原 +飛間 +飛阪 +飛騨 +飛騨山 +飛騨野 +飛高 +飛鳥 +飛鳥井 +飛鳥居 +飛鳥川 +飛鳥方 +飛鳥江 +飛鳥田 +飛鳥間 +飛鳥馬 +飛鷹 +飛龍 +食図 +食堂 +食場 +食満 +食見 +食野 +飫冨 +飫富 +飯 +飯ケ浜 +飯ケ濱 +飯ケ谷 +飯㠀 +飯万島 +飯上 +飯久保 +飯久間 +飯井 +飯代 +飯伏 +飯住 +飯余 +飯作 +飯倉 +飯内 +飯冨 +飯出 +飯分 +飯利 +飯原 +飯口 +飯古 +飯合 +飯吉 +飯名 +飯向 +飯呑 +飯味 +飯国 +飯國 +飯園 +飯土井 +飯土用 +飯地 +飯坂 +飯垣 +飯堂 +飯場 +飯塚 +飯多 +飯妻 +飯守 +飯室 +飯宮 +飯寄 +飯富 +飯寺 +飯尾 +飯尾住 +飯居 +飯屋崎 +飯屋谷 +飯山 +飯岡 +飯島 +飯崎 +飯嵜 +飯嶋 +飯嶌 +飯川 +飯干 +飯平 +飯庭 +飯弘 +飯文 +飯料 +飯星 +飯曽根 +飯曾根 +飯木 +飯本 +飯杉 +飯村 +飯束 +飯東 +飯柴 +飯森 +飯棲 +飯榁 +飯樋 +飯橋 +飯母 +飯永 +飯沢 +飯河 +飯沼 +飯泉 +飯法師 +飯波 +飯津 +飯浜 +飯浦 +飯海 +飯淵 +飯渕 +飯澤 +飯濱 +飯牟田 +飯牟礼 +飯牟禮 +飯生 +飯田 +飯田丸 +飯田和 +飯畑 +飯白 +飯盛 +飯石 +飯福 +飯積 +飯窪 +飯端 +飯竹 +飯笹 +飯箸 +飯篠 +飯米場 +飯綱 +飯能 +飯芽 +飯草 +飯菅 +飯蓋 +飯藤 +飯西 +飯見 +飯詰 +飯谷 +飯豊 +飯貝 +飯賀 +飯起 +飯迫 +飯道 +飯部 +飯郷 +飯酒盃 +飯里 +飯野 +飯野山 +飯鉢 +飯銅 +飯長 +飯開 +飯間 +飯阪 +飯降 +飯隈 +飯面 +飯領田 +飯飼 +飯高 +飲 +飲伏 +飲酒盃 +飴 +飴井 +飴善 +飴家 +飴屋 +飴山 +飴島 +飴嶋 +飴川 +飴木 +飴本 +飴村 +飴沼 +飴田 +飴矢 +飴脇 +飴谷 +飴野 +飼午 +飼原 +飼場 +飼手 +飼本 +飼森 +飼沼 +飼牛 +飼田 +飼谷 +飼野 +飼馬 +飼鳥 +飼鶴丸 +飽戸 +飽本 +飽津 +飽浦 +飽田 +飽谷 +飾 +飾万 +飾万津 +飾口 +飾森 +飾磨 +飾萬 +飾西 +飾間 +飾麻 +餅 +餅丸 +餅井 +餅井田 +餅原 +餅山 +餅崎 +餅川 +餅搗 +餅月 +餅木 +餅柿 +餅永 +餅沢 +餅田 +餅米 +餅谷 +餅越 +餅重 +餅野 +餅野宮 +養 +養会 +養原 +養学 +養學 +養宇 +養安 +養庵 +養性 +養日 +養會 +養松 +養母 +養水 +養津 +養父 +養王田 +養田 +養畑 +養碩 +養祖 +養老 +養藤 +養覚 +養覺 +養道 +養鸕 +餌原 +餌取 +餌差 +餌打 +餌網代 +餌鳩 +餘久保 +餘利野 +餘助 +餘吾 +餘多分 +餘家 +餘慶 +餘戸 +餘永 +餘澤 +餘田 +餘目 +餘舛 +餘茂田 +餘語 +餘谷 +餘野 +餘野木 +餝 +餝矢 +餝谷 +餠 +餠井 +餠原 +餠田 +館 +館ケ沢 +館ケ澤 +館上 +館下 +館久 +館井 +館元 +館入 +館内 +館前 +館原 +館厳 +館又 +館口 +館合 +館向 +館坂 +館場 +館家 +館寺 +館小路 +館尾 +館山 +館岡 +館島 +館崎 +館嵜 +館巌 +館川 +館市 +館形 +館政 +館本 +館村 +館松 +館林 +館柳 +館森 +館江 +館池 +館沢 +館沼 +館泉 +館洞 +館浦 +館澤 +館田 +館畑 +館盛 +館石 +館美 +館脇 +館腰 +館花 +館藤 +館谷 +館越 +館農 +館道 +館野 +館野内 +館鼻 +饒平名 +饒村 +饒波 +饒田 +饒辺 +饒辺名 +饒邊 +饗場 +饗塲 +饗庭 +首代 +首尾木 +首村 +首東 +首浦 +首澤 +首田 +首田尾 +首籐 +首藤 +首道 +首里 +首野尾 +首長 +首頭 +首高 +香 +香々美 +香々見 +香ノ木 +香上 +香下 +香世山 +香中 +香丸 +香久山 +香井 +香仏 +香住 +香倉 +香元 +香光 +香具 +香内 +香出 +香則 +香力 +香原 +香取 +香口 +香古 +香呂 +香味 +香和 +香園 +香地 +香坂 +香城 +香奈海 +香妻 +香宗我部 +香室 +香宮 +香山 +香島 +香崎 +香嶋 +香嶌 +香川 +香庄 +香座 +香庭 +香戸 +香春 +香曽我部 +香曾我部 +香月 +香木 +香本 +香村 +香束 +香東 +香林 +香林坊 +香柄 +香梅 +香森 +香椎 +香武 +香水 +香江 +香沢 +香河 +香泉 +香津 +香浦 +香渡 +香焼 +香田 +香畑 +香留 +香畠 +香積 +香立 +香美 +香至 +香良 +香茸 +香華 +香葉村 +香藤 +香西 +香谷 +香賀 +香遠 +香里山 +香野 +香門 +香阪 +香高 +馨 +馬 +馬々 +馬々脇 +馬〆 +馬ノ段 +馬上 +馬上免 +馬下 +馬中 +馬久地 +馬之内 +馬之段 +馬乗園 +馬乘園 +馬井 +馬仁田 +馬代 +馬伏 +馬体 +馬來 +馬來田 +馬倉 +馬先 +馬内 +馬出 +馬勝 +馬医 +馬卸 +馬原 +馬取 +馬口 +馬司 +馬喰田 +馬地 +馬坂 +馬垣 +馬城 +馬堀 +馬場 +馬場上 +馬場下 +馬場井 +馬場先 +馬場内 +馬場原 +馬場口 +馬場園 +馬場尾 +馬場岡 +馬場崎 +馬場嵜 +馬場本 +馬場池 +馬場添 +馬場田 +馬場畑 +馬場目 +馬場芝 +馬場薗 +馬場見 +馬場谷 +馬場迫 +馬場野 +馬塀 +馬塚 +馬塩 +馬塲 +馬塲崎 +馬壁 +馬売 +馬奈木 +馬子田 +馬守 +馬宮 +馬宿 +馬尻 +馬居 +馬屋原 +馬山 +馬岡 +馬岸山 +馬峠 +馬峰 +馬島 +馬崎 +馬嶋 +馬川 +馬巻 +馬庄 +馬庭 +馬弓 +馬引 +馬形 +馬戸 +馬戸場 +馬戸崎 +馬所 +馬把 +馬持 +馬掘 +馬掛 +馬放 +馬方 +馬明 +馬替 +馬服 +馬木 +馬本 +馬杉 +馬村 +馬来 +馬来田 +馬来野 +馬杷 +馬林 +馬栄 +馬森 +馬榮 +馬橋 +馬欠場 +馬止 +馬段 +馬殿 +馬比尾 +馬水 +馬氷 +馬江 +馬沢 +馬河 +馬波 +馬洗 +馬津川 +馬淵 +馬渊 +馬渕 +馬渡 +馬澄 +馬澤 +馬瀬 +馬瀬口 +馬瀬山 +馬瀬戸 +馬狩 +馬瓜 +馬生 +馬田 +馬男木 +馬留 +馬登 +馬目 +馬着 +馬石 +馬神 +馬立 +馬竹 +馬篭 +馬籠 +馬継 +馬締 +馬緤 +馬舟 +馬舩 +馬船 +馬草 +馬草原 +馬藤 +馬蜂 +馬袋 +馬被 +馬西 +馬見 +馬見塚 +馬見崎 +馬見新 +馬見田 +馬角 +馬詰 +馬誥 +馬谷 +馬谷原 +馬賀 +馬賣 +馬越 +馬越脇 +馬路 +馬躰 +馬込 +馬返 +馬迫 +馬道 +馬郡 +馬部 +馬郷 +馬酔 +馬酔木 +馬醫 +馬野 +馬野木 +馬鉢 +馬門 +馬関 +馬面 +馬頭 +馬飼 +馬飼野 +馬養 +馬馬脇 +馬鳥 +馬鹿 +馰谷 +馳 +馳寄 +馳尾 +馳嵜 +馳川 +馳平 +馳沢 +馳澤 +馳田 +馳部 +馳間 +馴山 +馴敷 +馴松 +馴田 +駄原 +駄口 +駄場 +駄場中 +駄場元 +駄場岡 +駄場崎 +駄斉 +駄木 +駄本 +駄沢 +駄澤 +駄田井 +駄竹 +駄賀 +駄賃場 +駄道 +駄間 +駄阿 +駄馬 +駅 +駅場 +駅永 +駅田 +駅迫 +駅重 +駅野 +駈野 +駒 +駒ケ峯 +駒ケ峰 +駒ケ嶺 +駒ケ谷 +駒ケ領 +駒下 +駒中 +駒井 +駒倉 +駒元 +駒兼 +駒内 +駒出 +駒切 +駒勇 +駒勢 +駒原 +駒口 +駒吉 +駒喜多 +駒坂 +駒垣 +駒城 +駒埼 +駒場 +駒塚 +駒塲 +駒壽 +駒子 +駒宮 +駒寄 +駒寺 +駒寿 +駒尺 +駒居 +駒屋 +駒山 +駒岡 +駒峯 +駒峰 +駒島 +駒崎 +駒嵐 +駒嵜 +駒嶺 +駒川 +駒帰 +駒庭 +駒延 +駒引 +駒形 +駒摺 +駒方 +駒月 +駒木 +駒木根 +駒木野 +駒本 +駒村 +駒杵 +駒松 +駒板 +駒林 +駒柵 +駒栄 +駒根 +駒棚 +駒橋 +駒水 +駒江 +駒池 +駒沢 +駒津 +駒津和 +駒渕 +駒渡 +駒澤 +駒瀬 +駒牧 +駒田 +駒留 +駒畠 +駒目 +駒米 +駒組 +駒脇 +駒舘 +駒若 +駒西 +駒見 +駒詰 +駒谷 +駒走 +駒越 +駒路 +駒込 +駒里 +駒野 +駒野目 +駒野谷 +駒阪 +駒附 +駒風 +駒館 +駒馬 +駒高 +駕屋 +駕田 +駕篭島 +駕籠島 +駕谷 +駕野 +駮丸 +駿ケ崎 +駿口 +駿同 +駿地 +駿川 +駿東 +駿河 +駿河崎 +駿河谷 +駿田 +駿藤 +駿見 +駿谷 +駿高 +騎本 +騎西 +騎馬 +験馬 +騚原 +騰 +騰川 +驗馬 +驛 +驛場 +驛永 +驛田 +驛重 +驛野 +驥本 +驪城 +骨田 +骨谷 +高 +高〆 +高ケ内 +高ケ迫 +高ノ +高ノ原 +高ノ山 +高ノ瀬 +高䒳 +高一 +高三 +高三潴 +高三野 +高上 +高上馬 +高下 +高下田 +高下畑 +高下花 +高世 +高丘 +高並 +高中 +高串 +高丸 +高丹 +高主 +高久 +高久保 +高久田 +高久野 +高之口 +高之瀬 +高乗 +高乗馬 +高乘 +高亀 +高井 +高井沢 +高井田 +高井良 +高仁 +高他 +高付 +高仙坊 +高代 +高以來 +高以来 +高以耒 +高以良 +高仲 +高任 +高伊 +高伏 +高位 +高住 +高佐 +高佐原 +高佐屋 +高作 +高來 +高侶 +高保 +高信 +高倉 +高倍 +高僧 +高儀 +高元 +高先 +高光 +高免 +高八 +高八卦 +高八重 +高具 +高内 +高円 +高冨 +高冨士 +高出 +高利 +高前 +高前田 +高力 +高加 +高加茂 +高務 +高勝 +高勢 +高北 +高千代 +高千穂 +高升 +高南 +高卯 +高原 +高又 +高取 +高口 +高台 +高司 +高合 +高吉 +高吉屋 +高名 +高向 +高吹 +高呂 +高呂木 +高味 +高味沢 +高味澤 +高和 +高咲 +高品 +高国 +高國 +高園 +高園部 +高圓 +高土 +高土井 +高土地 +高土居 +高地 +高地野 +高坂 +高坊 +高坪 +高垣 +高垣内 +高城 +高埜 +高基 +高埼 +高堀 +高堂 +高堂谷 +高堤 +高堰 +高場 +高塀 +高塒 +高塚 +高塩 +高塲 +高増 +高墨 +高墳 +高士 +高壽 +高夘 +高多 +高大 +高天 +高夫 +高奈 +高奈師 +高奥 +高好 +高妻 +高姓 +高子 +高孝 +高宅 +高宇 +高宇知 +高守 +高安 +高宏 +高宗 +高実 +高実子 +高室 +高宮 +高宮城 +高家 +高寄 +高密 +高富 +高富士 +高實 +高實子 +高寺 +高寿 +高専寺 +高小野 +高尻 +高尾 +高尾屋 +高尾山 +高尾知 +高尾谷 +高尾野 +高居 +高屋 +高屋敷 +高屋舗 +高屋鋪 +高山 +高山寺 +高山正 +高山辺 +高山邊 +高山野 +高岡 +高岩 +高岳 +高岸 +高峯 +高峰 +高島 +高島田 +高崎 +高嵜 +高嶋 +高嶋田 +高嶌 +高嶺 +高川 +高川原 +高州 +高巣 +高工 +高左 +高左右 +高巻 +高市 +高帛 +高師 +高常 +高幡 +高幣 +高幤 +高平 +高広 +高庄 +高座 +高庫 +高庭 +高廣 +高延 +高弊 +高弘 +高張 +高当 +高彦 +高後 +高御堂 +高徳 +高志 +高志保 +高志武 +高忠 +高念 +高惣 +高慶 +高憧 +高懸 +高成 +高成田 +高戸 +高戸谷 +高房 +高所 +高手 +高手山 +高才 +高折 +高持 +高掛 +高揚 +高操 +高政 +高数後 +高敷 +高斉 +高斎 +高方 +高旗 +高日 +高旨 +高早 +高昌 +高明 +高星 +高春 +高時 +高智 +高智尾 +高智穂 +高曲 +高曽 +高曽根 +高曾根 +高最 +高月 +高有 +高朝 +高木 +高木元 +高木原 +高木和 +高木場 +高木田 +高末 +高本 +高杉 +高材 +高村 +高杢 +高来 +高杭 +高杯 +高東 +高松 +高松屋 +高林 +高枝 +高枩 +高柳 +高柴 +高柿 +高栄 +高栖 +高栗 +高根 +高根尾 +高根沢 +高根澤 +高桐 +高桑 +高桜 +高桝 +高梁 +高梠 +高梨 +高梨子 +高梶 +高棟 +高森 +高棹 +高椋 +高植 +高椙 +高椿 +高楊 +高楠 +高榎 +高榮 +高槁 +高槇 +高槌 +高槙 +高槻 +高樋 +高樹 +高樽 +高橋 +高機 +高櫻 +高次 +高正 +高武 +高段 +高殿 +高比 +高比座 +高比来 +高比羅 +高比耒 +高比良 +高毛礼 +高毛禮 +高氏 +高水 +高水間 +高永 +高永甲 +高汐 +高江 +高江州 +高江柄 +高江洌 +高江洲 +高池 +高沖 +高沢 +高河 +高河原 +高治 +高沼 +高泉 +高法田 +高波 +高波瀬 +高津 +高津井 +高津佐 +高津原 +高津城 +高津尾 +高津戸 +高洲 +高浜 +高浦 +高浪 +高海 +高淵 +高添 +高清 +高清水 +高済 +高渊 +高渕 +高渡 +高満 +高源 +高源寺 +高溝 +高滝 +高潔 +高潮 +高澄 +高澤 +高濃 +高濟 +高濱 +高瀧 +高瀬 +高瀬屋 +高瀬谷 +高無 +高熊 +高熨斗 +高熨示 +高牀 +高牟礼 +高牟禮 +高牧 +高猿 +高玉 +高珠 +高瓦 +高生 +高生加 +高甫 +高田 +高田原 +高田屋 +高田木 +高田橋 +高田石 +高田谷 +高申 +高男 +高町 +高畑 +高畑下 +高畔 +高畝 +高畠 +高畦 +高畴 +高畷 +高疇 +高登 +高盛 +高目 +高相 +高眞 +高真 +高着 +高矢 +高矢部 +高知 +高知尾 +高知穂 +高石 +高砂 +高砂倉 +高砂子 +高砂谷 +高研 +高硎 +高硲 +高碕 +高磨 +高磯 +高礒 +高社 +高祖 +高神 +高祥 +高福 +高秀 +高科 +高稲 +高穂 +高窪 +高端 +高竹 +高竿 +高笠 +高笠原 +高筒 +高築 +高篠 +高簱 +高籏 +高籐 +高籔 +高納 +高索 +高細 +高細工 +高継 +高綱 +高緑 +高縁 +高縄 +高繁 +高繩 +高置 +高羅 +高美 +高群 +高義 +高羽 +高能 +高脇 +高臣 +高舘 +高舛 +高良 +高艸 +高芝 +高花 +高苗 +高茂 +高草 +高草木 +高荒 +高荷 +高菅 +高菱 +高萩 +高落 +高葉 +高葭 +高葮 +高蓋 +高蔵 +高薄 +高薮 +高藏 +高藤 +高藪 +高藻 +高虫 +高蜂 +高蝶 +高蠣 +高衣 +高袖 +高西 +高見 +高見世 +高見勢 +高見堂 +高見沢 +高見澤 +高見舘 +高見館 +高角 +高記 +高詰 +高諏 +高谷 +高貝 +高貫 +高貴 +高買 +高賀 +高賀茂 +高越 +高足 +高路 +高路地 +高路木 +高輪 +高辺 +高辻 +高近 +高迫 +高道 +高達 +高遠 +高邉 +高邊 +高邑 +高那 +高部 +高郷 +高都 +高都持 +高酉 +高里 +高重 +高野 +高野倉 +高野内 +高野名 +高野子 +高野宮 +高野尾 +高野山 +高野橋 +高野江 +高野池 +高野沢 +高野浦 +高野澤 +高野瀬 +高野畑 +高野谷 +高野辺 +高野須 +高金 +高鉢 +高鉾 +高銘 +高銭 +高録 +高鍋 +高鍬 +高長 +高長根 +高長谷 +高門 +高開 +高閑者 +高間 +高間木 +高間舘 +高間館 +高関 +高阪 +高防 +高阿田 +高附 +高陽 +高階 +高際 +高隝 +高雄 +高雛 +高雲 +高露 +高面 +高須 +高須加 +高須賀 +高領 +高頭 +高顕 +高顯 +高風 +高風聞 +高飯 +高館 +高馬 +高魚 +高鳥 +高鳥毛 +高鴨 +高鶴 +高鷲 +高鷹 +高鹿 +高麗 +高麗辺 +高麻 +高黒 +高鼻 +高齊 +高齋 +高龍 +高﨏 +髪井 +髪元 +髪口 +髪林 +髭 +髭内 +髭分 +髭右近 +髭本 +髭村 +髭田 +髭白 +髭野 +髻谷 +鬘谷 +鬚川 +鬟谷 +鬢崎 +鬢櫛 +鬣 +鬮台 +鬮橋 +鬮目 +鬮臺 +鬼 +鬼ケ一 +鬼ケ原 +鬼一 +鬼下 +鬼丸 +鬼久保 +鬼乕 +鬼京 +鬼倉 +鬼児島 +鬼内 +鬼切 +鬼勢 +鬼十 +鬼原 +鬼口 +鬼同 +鬼坂 +鬼城 +鬼堂 +鬼塚 +鬼塚脇 +鬼多見 +鬼子 +鬼子尾 +鬼子角 +鬼定 +鬼室 +鬼寅 +鬼尾 +鬼屋敷 +鬼山 +鬼岡 +鬼岩 +鬼岳 +鬼島 +鬼崎 +鬼嵜 +鬼嶋 +鬼嶌 +鬼嶽 +鬼川 +鬼平 +鬼弦 +鬼形 +鬼怒川 +鬼方 +鬼月 +鬼木 +鬼本 +鬼村 +鬼束 +鬼松 +鬼柳 +鬼橋 +鬼武 +鬼気 +鬼氣 +鬼池 +鬼沢 +鬼河 +鬼沼 +鬼津 +鬼海 +鬼渕 +鬼満 +鬼澤 +鬼無 +鬼無瀬 +鬼熊 +鬼王 +鬼生田 +鬼田 +鬼界 +鬼目 +鬼石 +鬼神 +鬼窪 +鬼立 +鬼童 +鬼竹 +鬼脇 +鬼藤 +鬼西 +鬼谷 +鬼越 +鬼辻 +鬼追 +鬼釜 +鬼門 +鬼防 +鬼鞍 +鬼頭 +鬼高 +鬼鹿毛 +鬽 +魁 +魁生 +魂相 +魚 +魚下 +魚井 +魚住 +魚倉 +魚切 +魚原 +魚取 +魚地 +魚坂 +魚多 +魚好 +魚守 +魚家 +魚尾 +魚屋 +魚山 +魚岡 +魚岸 +魚島 +魚崎 +魚嵜 +魚嶋 +魚川 +魚師 +魚平 +魚座 +魚形 +魚成 +魚戸 +魚木 +魚本 +魚杉 +魚村 +魚林 +魚梁 +魚棚 +魚森 +魚橋 +魚次 +魚水 +魚永 +魚江 +魚池 +魚沢 +魚沼 +魚波 +魚津 +魚浜 +魚浦 +魚海 +魚澄 +魚澤 +魚濱 +魚瀬 +魚田 +魚留 +魚矢 +魚石 +魚立 +魚脇 +魚落 +魚藤 +魚見 +魚角 +魚谷 +魚路 +魚躬 +魚返 +魚部 +魚里 +魚重 +魚野 +魚釣 +魚頭 +魲 +魵沢 +魵澤 +魹島 +鮄川 +鮎ケ瀬 +鮎京 +鮎原 +鮎合 +鮎川 +鮎本 +鮎沢 +鮎澤 +鮎瀬 +鮎田 +鮎貝 +鮎飛 +鮏川 +鮏河 +鮑子 +鮑谷 +鮒 +鮒井 +鮒子多 +鮒子田 +鮒岡 +鮒村 +鮒橋 +鮒池 +鮒田 +鮒藻 +鮒谷 +鮓井 +鮓本 +鮓田 +鮓谷 +鮫 +鮫ケ井 +鮫ノ口 +鮫元 +鮫口 +鮫島 +鮫嶋 +鮫川 +鮫村 +鮫沢 +鮫淵 +鮫渕 +鮫澤 +鮫田 +鮫谷 +鮫貝 +鮭川 +鮭延 +鮱原 +鮱名 +鮴谷 +鯉ノ内 +鯉住 +鯉口 +鯉堂 +鯉塚 +鯉島 +鯉川 +鯉戸 +鯉森 +鯉江 +鯉池 +鯉河 +鯉沼 +鯉淵 +鯉渕 +鯉田 +鯉登 +鯉谷 +鯉迫 +鯉野 +鯖 +鯖尻 +鯖屋 +鯖戸 +鯖江 +鯖渕 +鯖瀬 +鯖田 +鯖谷 +鯛 +鯛中 +鯛勝 +鯛原 +鯛取 +鯛口 +鯛天 +鯛家 +鯛島 +鯛治 +鯛津 +鯛瀬 +鯛田 +鯛網 +鯛縄 +鯛繩 +鯛谷 +鯛釣 +鯨 +鯨井 +鯨伏 +鯨卧 +鯨吉 +鯨尾 +鯨岡 +鯨崎 +鯨波 +鯨津 +鯨田 +鯨臥 +鯨谷 +鯰 +鯰井 +鯰川 +鯰江 +鯰田 +鯰谷 +鯰越 +鯵坂 +鯵岡 +鯵川 +鯵本 +鯵目 +鯵野 +鰀目 +鰀貴 +鰆 +鰆目 +鰈崎 +鰈川 +鰍場 +鰍沢 +鰍澤 +鰕原 +鰕名 +鰕沢 +鰕澤 +鰕西 +鰝奈 +鰡 +鰣谷 +鰤岡 +鰤谷 +鰭岡 +鰭崎 +鰭嵜 +鰭沼 +鰯 +鰯中 +鰯谷 +鰰沢 +鰰澤 +鰰田 +鰹 +鰹屋 +鰹木 +鰹谷 +鰺坂 +鰺岡 +鰺川 +鰻 +鰻池 +鰻渕 +鰻田 +鱈場 +鱈沢 +鱒 +鱒村 +鱒沢 +鱒淵 +鱒渕 +鱒澤 +鱒田 +鱒見 +鱗 +鱗原 +鱗川 +鱗形 +鱗星 +鱗野 +鱠谷 +鱧 +鱧屋 +鱧永 +鱧谷 +鱧野 +鱶口 +鱸 +鱸南 +鳥 +鳥の海 +鳥ノ海 +鳥上 +鳥中 +鳥丸 +鳥之海 +鳥井 +鳥井ケ原 +鳥井元 +鳥井原 +鳥井口 +鳥井山 +鳥井崎 +鳥井戸 +鳥井本 +鳥井田 +鳥井脇 +鳥住 +鳥佐近 +鳥倉 +鳥元 +鳥光 +鳥兎沼 +鳥入 +鳥内 +鳥出 +鳥切 +鳥前 +鳥原 +鳥取 +鳥取部 +鳥口 +鳥合 +鳥吉 +鳥名木 +鳥喰 +鳥坂 +鳥坪 +鳥垣 +鳥垣内 +鳥堂 +鳥場 +鳥塚 +鳥奥 +鳥実 +鳥宮 +鳥家 +鳥實 +鳥尻 +鳥尾 +鳥居 +鳥居南 +鳥居原 +鳥居場 +鳥居塚 +鳥居大路 +鳥居小路 +鳥居川 +鳥居本 +鳥居橋 +鳥屋 +鳥屋ケ原 +鳥屋原 +鳥屋子 +鳥屋尾 +鳥屋窪 +鳥屋部 +鳥屋野 +鳥山 +鳥岡 +鳥岩 +鳥岸 +鳥島 +鳥崎 +鳥嶋 +鳥川 +鳥巣 +鳥左近 +鳥平 +鳥庭 +鳥廣 +鳥当 +鳥形 +鳥成 +鳥打 +鳥撫 +鳥木 +鳥本 +鳥村 +鳥松 +鳥林 +鳥枝 +鳥栖 +鳥根 +鳥橋 +鳥次 +鳥殿 +鳥毛 +鳥毛谷 +鳥水 +鳥永 +鳥江 +鳥沢 +鳥波 +鳥泻 +鳥津 +鳥浜 +鳥浦 +鳥海 +鳥淵 +鳥添 +鳥渕 +鳥潟 +鳥澤 +鳥濱 +鳥瀬 +鳥牛 +鳥牧 +鳥生 +鳥田 +鳥町 +鳥畑 +鳥畠 +鳥當 +鳥目 +鳥矢部 +鳥石 +鳥立 +鳥竜 +鳥竹 +鳥羽 +鳥羽々 +鳥羽家 +鳥羽山 +鳥羽瀬 +鳥羽田 +鳥羽谷 +鳥羽野 +鳥脇 +鳥脚 +鳥落 +鳥見 +鳥觜 +鳥谷 +鳥谷内 +鳥谷尾 +鳥谷峯 +鳥谷峰 +鳥谷崎 +鳥谷越 +鳥谷部 +鳥豆 +鳥貝 +鳥賀陽 +鳥越 +鳥路 +鳥辺 +鳥邉 +鳥邊 +鳥部 +鳥里 +鳥野 +鳥野見 +鳥阪 +鳥集 +鳥頭 +鳥飼 +鳥養 +鳥首 +鳥鼠 +鳥龍 +鳩 +鳩ケ谷 +鳩井 +鳩代 +鳩原 +鳩口 +鳩垣 +鳩場 +鳩宿 +鳩山 +鳩岡 +鳩島 +鳩崎 +鳩嵜 +鳩川 +鳩成 +鳩本 +鳩村 +鳩根 +鳩森 +鳩沢 +鳩澤 +鳩田 +鳩石 +鳩羽 +鳩脇 +鳩谷 +鳩貝 +鳩部 +鳩野 +鳩間 +鳩飼 +鳫 +鳫子 +鳫尾 +鳫幕 +鳫平 +鳫本 +鳫林 +鳫野 +鳫金 +鳰 +鳰原 +鳰川 +鳳 +鳳京 +鳳凰 +鳳利 +鳳城 +鳳山 +鳳崎 +鳳木 +鳳条 +鳳桐 +鳳気至 +鳳至 +鳴 +鳴上 +鳴井 +鳴古 +鳴坂 +鳴好 +鳴子 +鳴宮 +鳴尾 +鳴山 +鳴岡 +鳴岩 +鳴島 +鳴嶋 +鳴嶌 +鳴川 +鳴床 +鳴戸 +鳴木 +鳴本 +鳴村 +鳴松 +鳴橋 +鳴毛 +鳴沢 +鳴河 +鳴海 +鳴滝 +鳴澤 +鳴瀧 +鳴瀬 +鳴瀬乃 +鳴田 +鳴石 +鳴神 +鳴美 +鳴脇 +鳴見 +鳴谷 +鳴輪 +鳴重 +鳴野 +鳴釜 +鳴門 +鳴高 +鳴鬼 +鳴鹿 +鳶 +鳶ケ巣 +鳶保 +鳶口 +鳶坂 +鳶尾 +鳶岩 +鳶島 +鳶川 +鳶巣 +鳶本 +鳶根 +鳶沢 +鳶澤 +鳶田 +鳶谷 +鳶那 +鳶野 +鴇 +鴇岡 +鴇崎 +鴇嵜 +鴇巣 +鴇沢 +鴇澤 +鴇田 +鴇矢 +鴇谷 +鴈 +鴈丸 +鴈原 +鴈平 +鴈本 +鴈林 +鴈沢 +鴈澤 +鴈田 +鴈野 +鴈金 +鴉 +鴉田 +鴉越 +鴋沢 +鴋澤 +鴎 +鴎端 +鴘田 +鴛原 +鴛尾 +鴛崎 +鴛本 +鴛海 +鴛淵 +鴛渕 +鴛田 +鴛谷 +鴞 +鴟崎 +鴦山 +鴨 +鴨下 +鴨中 +鴨井 +鴨作 +鴨内 +鴨出 +鴨原 +鴨反 +鴨取 +鴨口 +鴨名 +鴨垣 +鴨埜 +鴨奥 +鴨子田 +鴨宮 +鴨尾 +鴨居 +鴨居田 +鴨山 +鴨岡 +鴨島 +鴨崎 +鴨嶋 +鴨川 +鴨平 +鴨志田 +鴨戸 +鴨打 +鴨木 +鴨本 +鴨村 +鴨東 +鴨林 +鴨根 +鴨森沢 +鴨池 +鴨沢 +鴨河 +鴨治 +鴨浦 +鴨澤 +鴨瀬 +鴨狩 +鴨生 +鴨田 +鴨目 +鴨粕 +鴨脚 +鴨藤 +鴨西 +鴨角 +鴨谷 +鴨部 +鴨重 +鴨野 +鴨門 +鴨須賀 +鴨頭 +鴨飛田 +鴫 +鴫原 +鴫山 +鴫島 +鴫嶋 +鴫本 +鴫村 +鴫浜 +鴫濱 +鴫田 +鴫畑 +鴫石 +鴫谷 +鴫野 +鴬 +鴬出 +鴬原 +鴬地 +鴬塚 +鴬巣 +鴬池 +鴬生 +鴻 +鴻上 +鴻丸 +鴻井 +鴻原 +鴻和 +鴻地 +鴻坂 +鴻埜 +鴻塚 +鴻山 +鴻島 +鴻崎 +鴻嶋 +鴻嶺 +鴻巣 +鴻戯 +鴻戸 +鴻斉 +鴻斎 +鴻本 +鴻村 +鴻松 +鴻森 +鴻江 +鴻池 +鴻沢 +鴻海 +鴻渡 +鴻澤 +鴻瀬 +鴻田 +鴻矢 +鴻谷 +鴻農 +鴻野 +鴻鳥 +鴻齋 +鴾 +鴾田 +鵙尾 +鵙谷 +鵜 +鵜ノ口 +鵜ノ木 +鵜ノ沢 +鵜ノ澤 +鵜上 +鵜丹谷 +鵜久森 +鵜之家 +鵜之沢 +鵜之澤 +鵜井 +鵜入 +鵜原 +鵜口 +鵜名山 +鵜坂 +鵜垣 +鵜城 +鵜塚 +鵜子 +鵜家 +鵜尾 +鵜居 +鵜山 +鵜峠 +鵜島 +鵜崎 +鵜嵜 +鵜嶋 +鵜嶌 +鵜川 +鵜恵山 +鵜戸 +鵜戸口 +鵜戸西 +鵜月 +鵜木 +鵜本 +鵜村 +鵜束 +鵜林 +鵜根 +鵜梶 +鵜森 +鵜殿 +鵜池 +鵜沢 +鵜河 +鵜沼 +鵜浅 +鵜浜 +鵜浦 +鵜海 +鵜渡 +鵜渡瀬 +鵜澤 +鵜濱 +鵜瀞 +鵜瀬 +鵜灘 +鵜狩 +鵜生 +鵜生川 +鵜田 +鵜田川 +鵜目 +鵜篭 +鵜籠 +鵜納 +鵜芦 +鵜藤 +鵜谷 +鵜足 +鵜足津 +鵜辺 +鵜近 +鵜里 +鵜重 +鵜野 +鵜野州 +鵜野沢 +鵜野洲 +鵜野澤 +鵜野田 +鵜頭 +鵜飼 +鵜養 +鵜高 +鵜鷹 +鵡戯 +鵣崎 +鵣飼 +鵤 +鵤木 +鵫巣 +鵬谷 +鵲 +鵺野 +鶇 +鶇川 +鶇巣 +鶉 +鶉橋 +鶉沢 +鶉石 +鶉谷 +鶉野 +鶏内 +鶏冠井 +鶏尾 +鶏建 +鶏徳 +鶏田 +鶏足 +鶫 +鶫川 +鶯 +鶯出 +鶯原 +鶯地 +鶯塚 +鶯巣 +鶯生 +鶴 +鶴ケ丘 +鶴ケ久保 +鶴ケ岡 +鶴ケ峯 +鶴ケ崎 +鶴ケ谷 +鶴ケ野 +鶴ケ関 +鶴上 +鶴下 +鶴丸 +鶴久 +鶴之園 +鶴之薗 +鶴亀 +鶴井 +鶴代 +鶴住 +鶴來 +鶴保 +鶴元 +鶴内 +鶴切 +鶴副 +鶴卷 +鶴原 +鶴原谷 +鶴口 +鶴吉 +鶴味 +鶴和 +鶴喰 +鶴嘴 +鶴園 +鶴地 +鶴坂 +鶴城 +鶴埜 +鶴堀 +鶴場 +鶴塚 +鶴増 +鶴子 +鶴宗 +鶴宮 +鶴家 +鶴小尾 +鶴小屋 +鶴尾 +鶴居 +鶴屋 +鶴山 +鶴岡 +鶴峯 +鶴峰 +鶴島 +鶴崎 +鶴嵜 +鶴嶋 +鶴嶌 +鶴川 +鶴川内 +鶴川屋 +鶴巣 +鶴巻 +鶴市 +鶴師 +鶴成 +鶴我 +鶴戸 +鶴房 +鶴指 +鶴旨 +鶴早 +鶴木 +鶴本 +鶴村 +鶴来 +鶴来谷 +鶴東 +鶴松 +鶴林 +鶴柴 +鶴栄 +鶴桝 +鶴梶 +鶴森 +鶴棹 +鶴槇 +鶴槙 +鶴橋 +鶴武 +鶴殿 +鶴水 +鶴永 +鶴江 +鶴池 +鶴沢 +鶴河 +鶴沼 +鶴泉 +鶴浜 +鶴浦 +鶴海 +鶴淵 +鶴添 +鶴渕 +鶴澤 +鶴濱 +鶴瀬 +鶴熊 +鶴牧 +鶴田 +鶴町 +鶴畑 +鶴留 +鶴皐 +鶴目 +鶴石 +鶴窪 +鶴端 +鶴竹 +鶴羽 +鶴背 +鶴脊 +鶴舎 +鶴若 +鶴葉 +鶴蒔 +鶴薗 +鶴藤 +鶴衛 +鶴西 +鶴見 +鶴谷 +鶴貝 +鶴賀 +鶴賀谷 +鶴越 +鶴身 +鶴輪 +鶴迫 +鶴追 +鶴道 +鶴郷 +鶴里 +鶴重 +鶴野 +鶴野井 +鶴野田 +鶴長 +鶴間 +鶴阪 +鶴頭 +鶴飼 +鶴馬 +鶴高 +鶴𦊆 +鶸田 +鷁野 +鷁頭 +鷄内 +鷄冠井 +鷠森 +鷦鷯 +鷭 +鷲原 +鷲崎 +鷲見 +鷹 +鷹ノ木 +鷹下 +鷹中 +鷹井 +鷹休 +鷹倉 +鷹元 +鷹内 +鷹匠 +鷹取 +鷹司 +鷹合 +鷹啄 +鷹喜 +鷹嘴 +鷹城 +鷹埜 +鷹場 +鷹塀 +鷹塚 +鷹多 +鷹好 +鷹子 +鷹宮 +鷹家 +鷹尾 +鷹尾伏 +鷹居 +鷹屋 +鷹屋敷 +鷹山 +鷹岡 +鷹峰 +鷹島 +鷹崎 +鷹嶋 +鷹川 +鷹巣 +鷹左右 +鷹幸 +鷹広 +鷹影 +鷹押 +鷹木 +鷹本 +鷹村 +鷹来 +鷹松 +鷹林 +鷹枝 +鷹架 +鷹柳 +鷹栖 +鷹梁 +鷹森 +鷹樹 +鷹橋 +鷹氏 +鷹江 +鷹沢 +鷹津 +鷹浜 +鷹浦 +鷹澤 +鷹濱 +鷹照 +鷹田 +鷹石 +鷹箸 +鷹繁 +鷹美 +鷹羽 +鷹羽司 +鷹股 +鷹藁 +鷹藤 +鷹衛 +鷹西 +鷹見 +鷹觜 +鷹谷 +鷹部 +鷹部屋 +鷹野 +鷹野主 +鷹野原 +鷹阪 +鷹雄 +鷹頭 +鷹馬 +鷹鳥 +鷹鳥屋 +鷹𡌛 +鷹𥖧 +鷺 +鷺ノ森 +鷺ノ谷 +鷺之上 +鷺内 +鷺原 +鷺坂 +鷺宮 +鷺山 +鷺岡 +鷺島 +鷺崎 +鷺嶋 +鷺川 +鷺巣 +鷺本 +鷺村 +鷺森 +鷺橋 +鷺池 +鷺沢 +鷺沼 +鷺溪 +鷺澤 +鷺田 +鷺直 +鷺谷 +鷺野 +鷺野谷 +鷺阪 +鸙野 +鹵井 +鹹味 +鹽井 +鹽田 +鹽見 +鹽野 +鹿 +鹿ケ瀬 +鹿ノ内 +鹿ノ又 +鹿ノ子 +鹿ノ戸 +鹿ノ瀬 +鹿上 +鹿中 +鹿丸 +鹿久保 +鹿之賦 +鹿乗 +鹿乘 +鹿井 +鹿人 +鹿仁島 +鹿伏兎 +鹿住 +鹿俣 +鹿倉 +鹿児 +鹿児山 +鹿児島 +鹿児嶋 +鹿児嶌 +鹿兒山 +鹿兒島 +鹿内 +鹿原 +鹿又 +鹿叉 +鹿取 +鹿口 +鹿喰 +鹿園 +鹿垣 +鹿城 +鹿埜 +鹿執 +鹿場 +鹿塚 +鹿塩 +鹿士 +鹿多 +鹿妻 +鹿子 +鹿子原 +鹿子尾 +鹿子島 +鹿子嶋 +鹿子嶌 +鹿子幡 +鹿子木 +鹿子沢 +鹿子澤 +鹿子生 +鹿子田 +鹿子畑 +鹿宗 +鹿室 +鹿尾 +鹿居 +鹿屋 +鹿屋谷 +鹿山 +鹿岡 +鹿岩 +鹿岳 +鹿岸 +鹿島 +鹿島田 +鹿島谷 +鹿崎 +鹿嶋 +鹿嶋田 +鹿嶌 +鹿嶽 +鹿川 +鹿師村 +鹿帰瀬 +鹿庭 +鹿志和 +鹿志村 +鹿志毛 +鹿戸 +鹿折 +鹿持 +鹿摩 +鹿木 +鹿末 +鹿本 +鹿村 +鹿松 +鹿林 +鹿柴 +鹿梅 +鹿森 +鹿歸瀬 +鹿毛 +鹿毛田 +鹿江 +鹿沢 +鹿沼 +鹿波 +鹿津 +鹿浜 +鹿浦 +鹿海 +鹿渕 +鹿渡 +鹿滝 +鹿澤 +鹿濱 +鹿瀧 +鹿瀬 +鹿瀬島 +鹿熊 +鹿爪 +鹿犱 +鹿狩 +鹿生 +鹿田 +鹿目 +鹿真 +鹿磯 +鹿礒 +鹿窪 +鹿篭六 +鹿籔 +鹿籠 +鹿籠六 +鹿糖 +鹿糠 +鹿糠沢 +鹿糠澤 +鹿納 +鹿紫雲 +鹿耳 +鹿肝 +鹿股 +鹿能 +鹿苑 +鹿草 +鹿藤 +鹿見 +鹿角 +鹿討 +鹿谷 +鹿貫 +鹿越 +鹿遊 +鹿道 +鹿郷 +鹿里 +鹿重 +鹿野 +鹿野内 +鹿野原 +鹿野又 +鹿野島 +鹿野川 +鹿野村 +鹿野田 +鹿野谷 +鹿釜 +鹿釡 +鹿鍋 +鹿間 +鹿頭 +鹿養 +鹿鳥 +麁原 +麋山 +麓 +麓屋 +麓川 +麝島 +麝嶋 +麝香 +麥井 +麥倉 +麥塚 +麥居 +麥屋 +麥島 +麥嶋 +麥沢 +麥澤 +麥生 +麥生田 +麥田 +麥石 +麥谷 +麥踏 +麥野 +麦 +麦井 +麦倉 +麦元 +麦原 +麦塚 +麦尾 +麦居 +麦屋 +麦山 +麦島 +麦嶋 +麦平 +麦本 +麦林 +麦沢 +麦澤 +麦生 +麦生田 +麦田 +麦石 +麦穂 +麦谷 +麦足 +麦踏 +麦野 +麦間 +麩山 +麩沢 +麩澤 +麩谷 +麸山 +麸東 +麸沢 +麸澤 +麸谷 +麹 +麹丸 +麹家 +麹屋 +麹山 +麹池 +麹盛 +麹谷 +麻 +麻上 +麻下 +麻丘 +麻中 +麻乃 +麻井 +麻住 +麻倉 +麻元 +麻内 +麻原 +麻吹 +麻呂 +麻和 +麻喜 +麻地 +麻坂 +麻埜 +麻場 +麻塲 +麻多 +麻奥 +麻妻 +麻尾 +麻屋 +麻山 +麻岡 +麻峯 +麻島 +麻崎 +麻嶋 +麻川 +麻布 +麻布地 +麻弓 +麻戸 +麻所 +麻月 +麻木 +麻本 +麻村 +麻林 +麻柄 +麻森 +麻植 +麻植塚 +麻植生 +麻橋 +麻殖生 +麻沢 +麻河 +麻沼 +麻浦 +麻滝 +麻澤 +麻王 +麻生 +麻生島 +麻生嶋 +麻生川 +麻生田 +麻田 +麻町 +麻畑 +麻畠 +麻相田 +麻空 +麻窪 +麻続 +麻績 +麻良 +麻若 +麻苧 +麻草 +麻蒔 +麻薙 +麻西 +麻見 +麻角 +麻谷 +麻谷内 +麻賀 +麻路 +麻那古 +麻部 +麻郷地 +麻里 +麻野 +麻野井 +麻野間 +麻難 +麻黄 +麿 +麿山 +黄丹 +黄之瀬 +黄倉 +黄前 +黄原 +黄友 +黄司 +黄合 +黄土 +黄地 +黄坂 +黄堂 +黄塚 +黄宮 +黄尾 +黄山 +黄島 +黄川 +黄川田 +黄幡 +黄揚 +黄木 +黄木寺 +黄本 +黄村 +黄梅 +黄楊 +黄楊川 +黄檗 +黄永 +黄江 +黄池 +黄河 +黄波戸 +黄海 +黄瀬 +黄田 +黄綿 +黄色 +黄葉 +黄賀 +黄野 +黄野瀬 +黄金 +黄金井 +黄金崎 +黌農 +黍原 +黍塚 +黍島 +黍嶋 +黍根 +黍田 +黍迫 +黍野 +黐池 +黒 +黒上 +黒下 +黒中 +黒丸 +黒主 +黒亀 +黒井 +黒仁田 +黒代 +黒住 +黒佐 +黒保 +黒倉 +黒元 +黒光 +黒公 +黒兼 +黒内 +黒北 +黒厚子 +黒原 +黒口 +黒古 +黒台 +黒味 +黒図 +黒園 +黒圖 +黒土 +黒地 +黒坂 +黒坊 +黒坪 +黒垣 +黒執 +黒埼 +黒堀 +黒堂 +黒塚 +黒墨 +黒壁 +黒多 +黒太 +黒子 +黒安 +黒宮 +黒宰 +黒小 +黒尾 +黒尾丸 +黒居 +黒屋 +黒山 +黒岡 +黒岩 +黒岩堂 +黒峰 +黒島 +黒崎 +黒嵜 +黒嶋 +黒巌 +黒巖 +黒川 +黒巣 +黒巻 +黒市 +黒平 +黒床 +黒後 +黒才 +黒政 +黒明 +黒星 +黒木 +黒木場 +黒本 +黒杉 +黒村 +黒杭 +黒東 +黒松 +黒板 +黒林 +黒枝 +黒柳 +黒柿 +黒栄 +黒根 +黒梅 +黒森 +黒橋 +黒正 +黒武者 +黒毛利 +黒氏 +黒水 +黒永 +黒江 +黒池 +黒沢 +黒沢津 +黒河 +黒河内 +黒沼 +黒泉 +黒洞 +黒津 +黒浜 +黒淵 +黒添 +黒済 +黒渕 +黒満 +黒滝 +黒潟 +黒潮 +黒澤 +黒澤津 +黒濟 +黒濱 +黒瀉 +黒瀧 +黒瀬 +黒瀬谷 +黒熊 +黒牧 +黒玉 +黒田 +黒畑 +黒皮 +黒目 +黒相 +黒矢 +黒石 +黒石川 +黒石段 +黒石田 +黒磯 +黒礒 +黒祖 +黒神 +黒積 +黒竹 +黒笹 +黒籔 +黒米 +黒精 +黒紙 +黒羽 +黒羽子 +黒羽根 +黒肘 +黒肥地 +黒肬 +黒肱 +黒脛 +黒臑 +黒臺 +黒臼 +黒舘 +黒良 +黒荷田 +黒萩 +黒萱 +黒葛 +黒葛原 +黒葛川 +黒葛平 +黒葛野 +黒蔵 +黒蕨 +黒薮 +黒藏 +黒藪 +黒西 +黒見 +黒角 +黒詰 +黒谷 +黒豆 +黒賀 +黒越 +黒輪 +黒辺 +黒迫 +黒部 +黒郷 +黒里 +黒野 +黒野坪 +黒金 +黒釜 +黒鍵 +黒鎺 +黒長 +黒門 +黒阪 +黒雲 +黒須 +黒須田 +黒飛 +黒館 +黒馬 +黒駒 +黒高 +黒髪 +黒鳥 +黒鵜 +黒鶴 +黒龍 +黒𡌛 +黛 +點東 +點田 +黨 +黨崎 +鼈 +鼈宮谷 +鼈甲屋 +鼎 +鼓 +鼓呂雲 +鼓川 +鼓田 +鼓谷 +鼓野 +鼠入 +鼠家 +鼠尾 +鼠屋 +鼠淵 +鼠田 +鼠谷 +鼡尾 +鼡屋 +鼡田 +鼡谷 +鼬川 +鼻 +鼻元 +鼻先 +鼻和 +鼻山 +鼻岡 +鼻崎 +鼻嵜 +鼻影 +鼻戸 +鼻智 +鼻本 +鼻橋 +鼻毛 +鼻渡 +鼻熊 +鼻田 +鼻町 +鼻登 +鼻知場 +鼻節 +鼻谷 +鼻輪 +鼻野 +鼻野木 +鼻高 +齊 +齊ケ原 +齊ノ内 +齊上 +齊下 +齊丸 +齊之内 +齊之平 +齊京 +齊信 +齊元 +齊内 +齊加 +齊勝 +齊原 +齊名 +齊喜 +齊土 +齊坂 +齊城 +齊場 +齊官 +齊宮 +齊尾 +齊山 +齊川 +齊心 +齊慶 +齊戸 +齊所 +齊数 +齊數 +齊明寺 +齊木 +齊本 +齊條 +齊梧 +齊正 +齊江 +齊田 +齊當 +齊穏寺 +齊籐 +齊能 +齊脇 +齊良 +齊藤 +齊賀 +齊通 +齊道 +齊部 +齊郷 +齊野 +齊野平 +齊門 +齊間 +齊院 +齊須 +齊鹿 +齋 +齋上 +齋下 +齋丸 +齋二 +齋五澤 +齋京 +齋伯 +齋信 +齋元 +齋出 +齋加 +齋勝 +齋原 +齋古 +齋喜 +齋地 +齋坂 +齋城 +齋場 +齋子 +齋官 +齋宮 +齋尾 +齋山 +齋岡 +齋川 +齋戸 +齋所 +齋数 +齋數 +齋明寺 +齋木 +齋本 +齋村 +齋東 +齋條 +齋梧 +齋森 +齋正 +齋江 +齋浦 +齋田 +齋當 +齋竹 +齋籐 +齋能 +齋脇 +齋藤 +齋見 +齋記 +齋谷 +齋賀 +齋道 +齋部 +齋郷 +齋野 +齋野平 +齋門 +齋間 +齋院 +齋須 +齋高 +齋鹿 +齎藤 +齏藤 +齢 +龍 +龍ケ江 +龍ケ花 +龍ノ口 +龍丘 +龍井 +龍元 +龍八 +龍原 +龍口 +龍味 +龍園 +龍城 +龍堀 +龍塚 +龍守 +龍宮 +龍尾 +龍居 +龍山 +龍岡 +龍岩 +龍崎 +龍川 +龍已 +龍巳 +龍揖 +龍木 +龍末 +龍本 +龍村 +龍林 +龍永 +龍池 +龍沢 +龍河 +龍沼 +龍泉 +龍波 +龍波見 +龍海 +龍淵 +龍渓 +龍渕 +龍湖 +龍満 +龍溪 +龍滿 +龍澤 +龍田 +龍石 +龍神 +龍美 +龍腰 +龍興 +龍花 +龍見 +龍見地 +龍谷 +龍谿 +龍越 +龍輪 +龍里 +龍野 +龍首 +龜井 +龜山 +龜岡 +龜徳 +龜田 +龜谷 +龝丸 +龝井 +龝元 +龝利 +龝原 +龝吉 +龝和 +龝場 +龝好 +龝宗 +龝山 +龝岡 +龝庭 +龝月 +龝本 +龝村 +龝枝 +龝永 +龝池 +龝津 +龝田 +龝葉 +龝谷 +龝近 +龝野 +龝間 +龝鹿 +﨏 +﨏内 +﨏川 +﨏本 +﨏田 +﨏畑 +﨡原 +﨤町 +𠍱𪚲 +𠷡野 +𡌛口 +𡌛島 +𡌛嶋 +𡌛本 +𡌛村 +𡌛水 +𡌛間 +𡍄田 +𡧃田 +𡧃野 +𡵅本 +𡵸田 +𡶒下 +𡶡畑 +𢌞口 +𢌞神 +𢌞谷 +𢎭 +𢰝木 +𣆶葉 +𣇃井 +𣇃田 +𣇄 +𣍲坂 +𣏓木 +𣏤栂木 +𣑋林 +𣑑子 +𣕚木 +𣕚野木 +𣘸 +𣜿 +𣟿良 +𣳾中 +𣳾井 +𣳾磨 +𣳾麿 +𣷺川 +𤇆田 +𤘩宮城 +𤰖林 +𥞩井 +𥧄 +𥫣谷 +𥱋川 +𥱋瀬 +𥱤 +𥶡 +𥸮原 +𥸮名 +𥸮島 +𥸮田 +𥹥形 +𥽜 +𥿻田 +𦁠田 +𦩂 +𦩘 +𦹀井 +𦿷 +𦿸父 +𧲸革 +𨂊池 +𨑕田 +𨕫野 +𨛗山 +𨦺口 +𨨞 +𨩱津 +𨫝子 +𨴐崎 +𨸟芦多 +𨻫本 +𨼲山 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/name/japanese_surname_w_number.tsv b/fun_text_processing/inverse_text_normalization/ja/data/name/japanese_surname_w_number.tsv new file mode 100644 index 0000000..bca9a06 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/name/japanese_surname_w_number.tsv @@ -0,0 +1,4299 @@ +一の上 +一の倉 +一の口 +一の坪 +一の宮 +一の渡 +一の瀬 +一の谷 +一の関 +一ツ井 +一ツ子 +一ツ家 +一ツ屋 +一ツ山 +一ツ木 +一ツ本松 +一ツ松 +一ツ柳 +一ツ森 +一ツ橋 +一ツ氏 +一ツ渡 +一ツ田 +一ツ町 +一ツ矢 +一ツ石 +一ツ谷 +一ノ世 +一ノ井 +一ノ倉 +一ノ勢 +一ノ原 +一ノ口 +一ノ名 +一ノ坪 +一ノ子 +一ノ字 +一ノ宮 +一ノ尾 +一ノ山 +一ノ川 +一ノ戸 +一ノ木 +一ノ木戸 +一ノ本 +一ノ枝 +一ノ橋 +一ノ沢 +一ノ清 +一ノ渡 +一ノ澤 +一ノ瀬 +一ノ田 +一ノ矢 +一ノ穂 +一ノ谷 +一ノ間 +一ノ関 +一丁田 +一丁畑 +一万田 +一三 +一上 +一下 +一与 +一世 +一丸 +一乃瀬 +一久 +一久保 +一之上 +一之宮 +一之木 +一之森 +一之沢 +一之澤 +一之瀬 +一之谷 +一乗 +一乘 +一事 +一井 +一仏 +一伊達 +一住連 +一佛 +一作 +一倉 +一元 +一光 +一児島 +一兜 +一入 +一内 +一円 +一冨 +一刀 +一分片 +一刈 +一刎 +一前 +一力 +一勢 +一北 +一十林 +一原 +一又 +一双 +一反田 +一口 +一司 +一吉 +一后 +一向 +一味 +一和 +一和多 +一和田 +一噌 +一国 +一國 +一圓 +一地 +一坂 +一坊 +一坊寺 +一坪 +一垣 +一城 +一堂 +一場 +一塚 +一塲 +一増 +一天満谷 +一好 +一宅 +一宇 +一守 +一安 +一定 +一宝 +一宮 +一家 +一富 +一富士 +一寳 +一寶 +一寸木 +一寺 +一小路 +一尺八寸 +一尾 +一居 +一山 +一岐 +一岡 +一岩 +一峯寺 +一峰 +一峰寺 +一島 +一崎 +一嶋 +一嶌 +一川 +一布 +一幡 +一平 +一広 +一庵 +一廣 +一廼穂 +一式 +一弛 +一徳 +一心 +一志 +一恩 +一戸 +一振 +一政 +一文字 +一斗 +一新 +一方井 +一方隅 +一明 +一星 +一最 +一月 +一期 +一期崎 +一木 +一木戸 +一本 +一本島 +一本嶋 +一本木 +一本杉 +一本松 +一本柳 +一本槍 +一本鎗 +一杉 +一村 +一条 +一来 +一松 +一林 +一枚田 +一枝 +一柳 +一柿 +一栄 +一桐 +一桝 +一條 +一棟 +一森 +一植庵 +一楽 +一樂 +一樋 +一樹 +一橋 +一次 +一毛 +一氏 +一水 +一永 +一江 +一沢 +一河 +一泉 +一法 +一法師 +一津屋 +一津田 +一津矢 +一津谷 +一浦 +一海 +一渡 +一湊 +一溝 +一滴 +一澤 +一瀬 +一片 +一牛 +一玖 +一瓢 +一田 +一田山 +一由 +一甲 +一町 +一町田 +一畝 +一番ケ瀬 +一番合戦 +一番屋 +一番星 +一登 +一百野 +一盃森 +一盛 +一真 +一矢 +一石 +一社 +一神 +一笠 +一筆 +一箭 +一篠 +一籏 +一糸 +一美 +一羽 +一老 +一肩 +一脇 +一與 +一興 +一舎 +一色 +一色田 +一芝 +一花 +一華 +一萬田 +一葉 +一薮 +一藁 +一藤 +一藤木 +一蝶 +一見 +一視 +一角 +一言 +一谷 +一貫坂 +一貫田 +一越 +一路 +一身 +一軸 +一迫 +一道 +一適 +一邨 +一郎丸 +一郡 +一部 +一郷 +一都 +一里塚 +一里山 +一里越 +一重 +一野 +一野坪 +一野本 +一野瀬 +一野谷 +一野辺 +一野邊 +一針 +一釣 +一鉄 +一鍬田 +一鏡 +一鐵 +一門 +一間 +一関 +一關 +一阪 +一阿 +一陣 +一階 +一霍 +一青 +一面 +一願 +一香 +一馬 +一駒 +一高 +一鬼 +一鷓 +一鷹 +七々原 +七々木 +七々瀬 +七ケ所 +七ツ役 +七ツ村 +七ツ河 +七ツ田 +七ツ町 +七ツ矢 +七ツ谷 +七丈 +七世 +七久保 +七五三 +七五三掛 +七五三木 +七五三田 +七五三野 +七井 +七俵 +七倉 +七元 +七分 +七利 +七加家 +七十刈 +七十苅 +七原 +七反田 +七呂 +七味 +七坂 +七堂 +七塚 +七夕 +七字 +七宝 +七宮 +七家 +七寳 +七寸 +七尾 +七尾谷 +七山 +七山谷 +七岡 +七島 +七崎 +七嵐 +七嶋 +七川 +七帖 +七度 +七座 +七役 +七徳 +七戸 +七搦 +七日市 +七星 +七木田 +七本 +七村 +七条 +七松 +七林 +七枝 +七栗 +七條 +七森 +七楽 +七歩 +七沢 +七河 +七波 +七津角 +七浦 +七海 +七滝 +七澤 +七瀧 +七瀬 +七瀬川 +七瀬谷 +七熊 +七牟礼 +七牟禮 +七理 +七田 +七町 +七目木 +七石 +七社 +七種 +七竹 +七篠 +七納 +七絛 +七良川 +七良浴 +七草 +七草木 +七蔵司 +七藏司 +七見 +七角 +七谷 +七軒 +七辺 +七迫 +七邊 +七郎丸 +七部 +七里 +七野 +七釜 +七釜子 +七門 +七間 +七障子 +七類 +七高 +七黒 +万 +万々 +万ケ谷 +万ノ +万丈 +万上 +万世 +万両 +万並 +万中 +万丸 +万久 +万久里 +万亀 +万亀山 +万事 +万井 +万代 +万代呂 +万代寺 +万仲 +万佐木 +万保 +万俵 +万倉 +万元 +万光 +万公 +万処 +万出 +万利乃 +万前 +万力 +万力屋 +万力谷 +万十 +万千野 +万司 +万合 +万名 +万善 +万喜 +万国 +万国谷 +万地 +万城 +万城目 +万埜 +万場 +万塩 +万壽本 +万好 +万子 +万字 +万宝 +万実 +万宮 +万家 +万實 +万寿 +万寿本 +万尾 +万屋 +万山 +万岡 +万崎 +万川 +万平 +万年 +万年山 +万幸 +万広 +万度 +万庭 +万廣 +万徳 +万慶 +万戈 +万成 +万我 +万戸 +万所 +万才 +万方 +万月 +万木 +万本 +万束 +万条 +万来 +万條 +万森 +万楽 +万正 +万歩 +万歳 +万殿 +万水 +万永 +万江 +万沢 +万治 +万波 +万津 +万洲 +万浪 +万浮 +万澤 +万濃 +万瀬 +万灯 +万燈 +万狩 +万玉 +万田 +万直 +万矢 +万石 +万砂 +万福 +万福寺 +万立 +万竝 +万納 +万納寺 +万羽 +万膳 +万葉 +万藤 +万行 +万袋 +万見 +万谷 +万豆 +万財 +万賀 +万越 +万足 +万辺 +万辻 +万造寺 +万道 +万邉 +万邊 +万部 +万里 +万里小路 +万里崎 +万里川 +万重 +万野 +万金 +万開 +万関 +万阿弥 +万雲 +万願寺 +万𡌛 +丈六 +三 +三々賀 +三つ石 +三の丸 +三の宮 +三の輪 +三カ崎 +三ケ +三ケ原 +三ケ尻 +三ケ山 +三ケ島 +三ケ崎 +三ケ嶋 +三ケ月 +三ケ木 +三ケ本 +三ケ森 +三ケ津 +三ケ田 +三ケ部 +三ケ野 +三ケ野原 +三ツ +三ツ中 +三ツ丸 +三ツ井 +三ツ俣 +三ツ倉 +三ツ元 +三ツ出 +三ツ又 +三ツ口 +三ツ国 +三ツ國 +三ツ堀 +三ツ塚 +三ツ家 +三ツ寄 +三ツ寺 +三ツ尾 +三ツ居 +三ツ屋 +三ツ山 +三ツ岡 +三ツ岩 +三ツ峰 +三ツ島 +三ツ崎 +三ツ嶋 +三ツ川 +三ツ巻 +三ツ平 +三ツ広 +三ツ廣 +三ツ扇 +三ツ持 +三ツ星 +三ツ木 +三ツ本 +三ツ杉 +三ツ村 +三ツ松 +三ツ林 +三ツ柳 +三ツ梨 +三ツ森 +三ツ橋 +三ツ汐 +三ツ江 +三ツ池 +三ツ沢 +三ツ沼 +三ツ泉 +三ツ浜 +三ツ浦 +三ツ浪 +三ツ溝 +三ツ滝 +三ツ澤 +三ツ濱 +三ツ瀬 +三ツ田 +三ツ畑 +三ツ目 +三ツ矢 +三ツ石 +三ツ股 +三ツ角 +三ツ谷 +三ツ辻 +三ツ邑 +三ツ野 +三ツ間 +三ノ上 +三ノ丸 +三ノ京 +三ノ宮 +三ノ戸 +三ノ浦 +三ノ輪 +三ヵ木 +三丁 +三丁目 +三七 +三丈 +三上 +三上山 +三下 +三与木 +三世 +三世川 +三並 +三中 +三中西 +三串 +三丸 +三乃 +三久 +三久保 +三之丸 +三之宮 +三之本 +三之瀬 +三之輪 +三乗 +三乘 +三九 +三九二 +三亀 +三亀山 +三二 +三五 +三井 +三井倉 +三井原 +三井名 +三井寺 +三井島 +三井戸 +三井所 +三井津 +三井田 +三京 +三仏 +三仙 +三代 +三代地 +三代崎 +三代川 +三代木 +三代森 +三代沢 +三代澤 +三代瀬 +三代田 +三代野 +三仲 +三伍 +三伝 +三位 +三位所 +三住 +三佐 +三佐々川 +三佐保 +三佐和 +三佐尾 +三佐崎 +三佐川 +三佐藤 +三余 +三佛 +三保 +三保家 +三保木 +三保田 +三保谷 +三保野 +三信 +三俣 +三俵 +三倉 +三個 +三傅 +三傳 +三僮 +三元 +三先 +三光 +三光坊 +三光寺 +三光楼 +三光院 +三入 +三八九 +三八木 +三八木沢 +三八木澤 +三共 +三其 +三具 +三内 +三冨 +三冨士 +三凌 +三刀 +三刀屋 +三刀谷 +三分 +三分一 +三分一所 +三分利 +三前 +三力谷 +三功 +三加 +三加茂 +三勢 +三包 +三北 +三十刈 +三十尾 +三十日 +三十木 +三十苅 +三十間 +三千 +三千山 +三千田 +三升 +三升木 +三升畑 +三升谷 +三原 +三原屋 +三原松 +三原田 +三原詰 +三原鍛治 +三厨 +三又 +三友 +三双 +三反 +三反園 +三反崎 +三反田 +三反畑 +三反長 +三叚崎 +三口 +三古 +三古谷 +三可 +三合 +三合堂 +三吉 +三吉矢 +三吉谷 +三吉野 +三名木 +三名本 +三名田 +三吾 +三味 +三和 +三和山 +三和田 +三品 +三品寺 +三善 +三喜 +三喜田 +三喜畑 +三嘴 +三四 +三国 +三国出 +三国屋 +三国谷 +三國 +三國屋 +三國谷 +三園 +三土 +三土井 +三土手 +三在 +三地 +三地沢 +三地澤 +三坂 +三坊 +三坪 +三垣 +三城 +三埜 +三堀 +三堂 +三堂地 +三堤 +三場 +三塚 +三塩 +三増 +三墨 +三壁 +三声 +三壷 +三壺 +三壽 +三多 +三多村 +三多田 +三多見 +三夜 +三大 +三大寺 +三太 +三奈戸 +三奈木 +三好 +三好野 +三妙 +三妻 +三姓 +三宅 +三宅川 +三宇根 +三守 +三安 +三宗 +三宝 +三室 +三室戸 +三宮 +三家 +三家丸 +三家本 +三宿 +三寄 +三富 +三富士 +三寳 +三寶 +三寸木 +三寺 +三寿 +三尋木 +三小 +三小牛 +三小田 +三尾 +三尾原 +三尾川 +三尾母 +三尾谷 +三尾野 +三居 +三屋 +三屋田 +三山 +三山口 +三岐 +三岡 +三岩 +三岳 +三岸 +三峯 +三峰 +三島 +三島木 +三崎 +三崎屋 +三嵜 +三嶋 +三嶋木 +三嶌 +三嶽 +三川 +三川原 +三州 +三差 +三巴 +三巻 +三市 +三師 +三帰 +三幡 +三幣 +三平 +三年 +三幸 +三広 +三府 +三度 +三廉 +三廚 +三廻部 +三廼 +三弊 +三引 +三弦谷 +三張 +三影 +三待 +三後 +三徳 +三徳屋 +三志多 +三志奈 +三恵 +三惠 +三慶 +三成 +三戸 +三戸代 +三戸口 +三戸呂 +三戸尻 +三戸岡 +三戸手 +三戸森 +三戸瀬 +三戸田 +三戸見 +三戸谷 +三戸辺 +三戸邉 +三戸部 +三房 +三手木 +三才 +三才町 +三扶 +三技 +三折 +三掘 +三摩 +三改木 +三政 +三文字 +三方 +三日尻 +三日市 +三日月 +三日田 +三昌 +三明 +三星 +三春 +三時 +三曳 +三曵 +三曽田 +三曾野 +三月 +三月田 +三朕 +三朝 +三木 +三木元 +三木原 +三木家 +三木屋 +三木本 +三木江 +三木田 +三木谷 +三木野 +三末 +三本 +三本木 +三本杉 +三本松 +三本柳 +三本漆 +三本竹 +三本管 +三本菅 +三杉 +三村 +三村田 +三束 +三条 +三条場 +三条橋 +三条目 +三条西 +三条谷 +三杭 +三杯 +三東 +三松 +三林 +三枚地 +三枚堂 +三枚山 +三枚橋 +三枝 +三枝崎 +三枝木 +三枝松 +三枝樹 +三枡 +三柏 +三染 +三柳 +三柴 +三栄 +三栖 +三栖本 +三栖谷 +三栗 +三栗家 +三栗屋 +三栗谷 +三栗野 +三根 +三根山 +三根生 +三根谷 +三桐 +三桝 +三桶 +三條 +三條場 +三條目 +三條西 +三條谷 +三梨 +三棟 +三森 +三棹 +三椚 +三楊 +三楠 +三榊 +三槁 +三槇 +三槙 +三槻 +三横 +三横呂 +三樹 +三樹元 +三橋 +三次 +三武 +三武士 +三歩 +三歩一 +三段 +三段崎 +三母 +三比 +三毛 +三毛門 +三水 +三永 +三永川 +三江 +三池 +三池田 +三沖 +三沢 +三河 +三河井 +三河内 +三河原 +三河口 +三河尻 +三河島 +三河嶋 +三河谷 +三治 +三沼 +三波 +三洗 +三津 +三津中 +三津井 +三津出 +三津原 +三津国 +三津國 +三津守 +三津家 +三津尾 +三津屋 +三津山 +三津島 +三津川 +三津木 +三津本 +三津村 +三津林 +三津橋 +三津永 +三津江 +三津沢 +三津浜 +三津澤 +三津田 +三津目 +三津矢 +三津石 +三津谷 +三津越 +三津輪 +三津野 +三津間 +三洲 +三浅 +三浜 +三浦 +三浪 +三海 +三淵 +三添 +三清 +三渓 +三渕 +三渡 +三渡洲 +三満 +三満田 +三溝 +三滝 +三潟 +三潴 +三澄 +三澤 +三濃川 +三濱 +三瀦 +三瀧 +三瀬 +三瀬下 +三瀬町 +三熊 +三牧 +三狭間 +三獄 +三玉 +三王 +三王寺 +三珠 +三瓶 +三甘 +三生 +三用 +三甫 +三田 +三田上 +三田井 +三田地 +三田寺 +三田尻 +三田尾 +三田村 +三田池 +三田美 +三田谷 +三田迫 +三田部 +三田野 +三由 +三甲野 +三町 +三界 +三畑 +三留 +三畝 +三畠 +三畦 +三番 +三登 +三百 +三百田 +三百苅 +三皷 +三盃 +三盛 +三目 +三省 +三県 +三矢 +三矢城 +三矢島 +三矢本 +三矢田 +三知矢 +三石 +三砂 +三社所 +三神 +三神山 +三福 +三福寺 +三秋 +三科 +三程 +三種 +三穂 +三穂野 +三穗野 +三窪 +三立 +三竜 +三竝 +三竹 +三竿 +三笘 +三笠 +三笠屋 +三笠木 +三笹 +三箇 +三箇尻 +三箇山 +三箇島 +三箭 +三箸 +三節草 +三築 +三簾 +三籔 +三糸 +三納 +三紙 +三続 +三綿 +三緒 +三縁 +三縄 +三縞 +三縣 +三繩 +三美 +三義 +三羽 +三者 +三聲 +三股 +三脇 +三腰 +三膳 +三與木 +三舘 +三舛 +三舛木 +三舛畑 +三舛谷 +三舟 +三舩 +三船 +三良 +三良丸 +三艸 +三芝 +三芦 +三芳 +三芳野 +三苫 +三草 +三荊 +三荒 +三荷 +三荻 +三菅 +三華 +三葉 +三葛 +三葛木 +三蓼 +三蔭 +三蔵 +三薗 +三薮 +三藤 +三藤田 +三藪 +三行 +三行地 +三裏 +三見 +三角 +三角園 +三角田 +三觜 +三計 +三記 +三訳 +三調 +三諾 +三譯 +三谷 +三谷原 +三谷山 +三谷川 +三谷本 +三谷沢 +三谷澤 +三谷野 +三谿 +三豬 +三貝 +三貫納 +三貴 +三賀 +三賀山 +三賀本 +三賀森 +三賢 +三越 +三足 +三路 +三身 +三軒 +三軒家 +三軒屋 +三軒谷 +三輪 +三輪出 +三輪屋 +三輪山 +三輪木 +三輪橋 +三輪浦 +三輪田 +三輪谷 +三輪野 +三輸 +三辺 +三辻 +三近 +三迫 +三迺 +三通 +三通田 +三逵 +三道 +三達 +三達屋 +三邉 +三邊 +三邑 +三那三 +三那川 +三邨 +三郎丸 +三郎迫 +三部 +三郷 +三都 +三都主 +三都井 +三里 +三重 +三重堀 +三重松 +三重生 +三重野 +三野 +三野原 +三野宮 +三野岡 +三野島 +三野本 +三野村 +三野瀬 +三野田 +三野谷 +三野輪 +三金 +三釜田 +三鈷 +三録 +三鍋 +三鍵 +三鎌 +三鐘 +三鑰 +三長 +三門 +三門明 +三間 +三間地 +三間屋 +三間瀬 +三間谷 +三関 +三阪 +三附 +三隅 +三隅田 +三隈 +三階 +三階松 +三随 +三隨 +三雲 +三露 +三須 +三須田 +三須磨 +三頭 +三頭谷 +三餘 +三館 +三馬 +三駄 +三駒 +三高 +三鬼 +三鳥川 +三鴨 +三鶴 +三鹿 +三鹿野 +三黒 +三黒江 +三鼓 +三龍 +三𢌞部 +三𧮾 +上一 +上万 +上三 +上三信 +上三地 +上三垣 +上三路 +上八重 +上四元 +下一ノ宮 +下万 +下二井 +下八 +下八尻 +下八川 +下八重 +下四日市 +下志万 +下松八重 +不二 +不二井 +不二原 +不二山 +不二崎 +不二川 +不二木 +不二樹 +不二葦 +不二見 +不二門 +不可三 +与一迫 +与三井 +与三川 +与三手 +与三本 +与三野 +与五沢 +与五澤 +与十田 +与四田 +世ノ一 +世一 +世六 +中一 +中七 +中万 +中三川 +中三瀬 +中二 +中八児 +中六角 +中十 +中千 +中千代 +丸一 +丸七 +丸二 +丸十 +乃一 +乃万 +久一 +久七 +久万 +久万寿 +久万川 +久万沢 +久万澤 +久万田 +久八 +久百々 +乙二 +九々 +九ノ池 +九ノ里 +九万原 +九万田 +九之坪 +九之池 +九乗 +九井 +九会田 +九住 +九佐 +九保 +九俵 +九内 +九冨 +九刕 +九十九沢 +九十九澤 +九十九田 +九十九里 +九十歩 +九十田 +九十谷 +九千房 +九原 +九反 +九反田 +九司 +九合 +九喜 +九坪 +九城 +九埜 +九堀 +九家 +九富 +九尾 +九山 +九岡 +九島 +九嶋 +九川 +九平 +九座 +九後 +九徳 +九志田 +九戸 +九手 +九折 +九日 +九星 +九曜 +九會田 +九木 +九木田 +九木野 +九本 +九村 +九条 +九東 +九栗 +九條 +九次米 +九沢 +九河 +九法 +九津見 +九浦 +九海 +九渡 +九澤 +九猪 +九玉 +九田 +九町 +九目 +九矢 +九石 +九社前 +九穂 +九笹 +九綱 +九翟 +九能 +九良 +九良賀野 +九良野 +九萬原 +九藤 +九蘭 +九角 +九護 +九谷 +九谷田 +九貫 +九賀 +九軒 +九郎丸 +九郎座 +九郎明川 +九郎田 +九郷 +九里 +九里山 +九里田 +九重 +九重地 +九重谷 +九重路 +九野 +九野坂 +九野木 +九野里 +九門 +九間 +九頭 +九頭竜 +九頭竜坂 +九頭見 +九頭龍 +九頭龍坂 +九首見 +九高 +九鬼 +九鬼丸 +二っ家 +二の丸 +二の宮 +二の瀬 +二タ川 +二タ月 +二タ村 +二タ見 +二ツ亀 +二ツ井 +二ツ城 +二ツ家 +二ツ寺 +二ツ屋 +二ツ山 +二ツ川 +二ツ木 +二ツ柳 +二ツ森 +二ツ橋 +二ツ池 +二ツ町 +二ツ矢 +二ツ石 +二ツ神 +二ツ谷 +二ツ迫 +二ツ野 +二ノ上 +二ノ下 +二ノ丸 +二ノ久保 +二ノ井 +二ノ倉 +二ノ原 +二ノ口 +二ノ坂 +二ノ城 +二ノ宮 +二ノ峰 +二ノ形 +二ノ戸 +二ノ文 +二ノ方 +二ノ本 +二ノ村 +二ノ瀬 +二ノ田 +二ノ神 +二ノ美屋 +二ノ谷 +二ノ関 +二丁田 +二万 +二三味 +二三四 +二三島 +二上 +二世 +二串 +二丸 +二丹 +二丹田 +二久 +二久山 +二之夕 +二之宮 +二之形 +二之方 +二之段 +二之湯 +二之瀬 +二之部 +二五元 +二五垰 +二五田 +二井 +二井上 +二井内 +二井原 +二井土 +二井家 +二井屋 +二井屋田 +二井山 +二井岡 +二井川 +二井手 +二井本 +二井林 +二井田 +二井矢 +二井藤 +二井見 +二井谷 +二井野 +二井関 +二亦 +二位 +二位松 +二位永 +二位関 +二佐 +二保 +二俟 +二俣 +二元 +二六 +二出川 +二分 +二分野 +二十歩 +二十田 +二十軒 +二十里 +二原 +二又 +二又川 +二叉 +二叉川 +二反 +二反地 +二反田 +二反長 +二口 +二口谷 +二司 +二名 +二味 +二和田 +二唐 +二問 +二善 +二喜 +二四岡 +二国 +二國 +二坂 +二坂谷 +二坪 +二垣 +二基 +二堂 +二場 +二塚 +二夕川 +二夕見 +二多田 +二子 +二子岩 +二子石 +二字 +二宗 +二宝 +二宮 +二家 +二家本 +二尾 +二居 +二居野 +二山 +二岡 +二岩 +二岸 +二峯 +二峰 +二島 +二崎 +二嶋 +二川 +二川原 +二川目 +二幡 +二平 +二平太 +二弊? +二張 +二戸 +二戸部 +二所宮 +二挺木 +二摩 +二改 +二敷 +二文字 +二文字屋 +二斗蒔 +二斗蒔田 +二斜 +二方 +二日一 +二日市 +二星 +二曽 +二替 +二月田 +二木 +二木田 +二本 +二本垣 +二本木 +二本杉 +二本松 +二本柳 +二本柿 +二本森 +二本樹 +二本橋 +二杁 +二杉 +二村 +二条 +二条久保 +二条院 +二松 +二林 +二枚田 +二枚畑 +二枝 +二柱 +二柳 +二柿 +二栗 +二栢 +二株 +二梃木 +二條 +二條久保 +二森 +二椙 +二楷堂 +二標 +二橋 +二次 +二正寺 +二武 +二歩 +二段 +二殿 +二永 +二江 +二沢 +二沢平 +二河 +二河田 +二法田 +二津 +二津谷 +二浦 +二浦尾 +二浪 +二渡 +二滝 +二澤 +二澤平 +二瀧 +二瀬 +二瀬川 +二熊 +二片 +二牟礼 +二牟禮 +二牧畑 +二王堂 +二王頭 +二瓶 +二田 +二田原 +二田口 +二田水 +二町 +二畑 +二畠 +二百寺 +二百田 +二目 +二矢 +二矢川 +二矢田 +二石 +二礼 +二礼木 +二社谷 +二祖 +二神 +二禮木 +二科 +二穴 +二窓 +二籐 +二継 +二羽 +二股 +二艘木 +二艘舟 +二色 +二若 +二茅 +二荒 +二葉 +二薮 +二藤 +二藤部 +二見 +二見屋 +二見谷 +二角 +二谷 +二谷島 +二貝 +二賀木 +二越 +二軒谷 +二輪 +二通 +二連木 +二道 +二邨 +二郎丸 +二部 +二部野 +二郷 +二里 +二里木 +二重 +二重作 +二重谷 +二野 +二野上 +二野下 +二野井 +二野塀 +二野宮 +二野屏 +二野川 +二野戸 +二野瀬 +二野瓶 +二門 +二間 +二間戸 +二間瀬 +二関 +二隅 +二階 +二階堂 +二階戸 +二階蔵 +二階藏 +二階谷 +二面 +二飯田 +二馬 +二鹿 +五の井 +五の坪 +五ケ山 +五ケ市 +五ケ谷 +五ノ上 +五ノ井 +五ノ坪 +五ノ田 +五ノ谷 +五丁 +五丁森 +五万戸 +五三 +五上 +五下 +五丸 +五丹 +五之治 +五乙女 +五井 +五井山 +五井淵 +五井渕 +五井野 +五代 +五代儀 +五伝木 +五位 +五位堂 +五位塚 +五位尾 +五位淵 +五位渕 +五位野 +五來 +五傳木 +五内川 +五冨利 +五刀 +五分木 +五利江 +五前 +五加 +五勝出 +五十井 +五十井田 +五十代 +五十住 +五十免 +五十公野 +五十内 +五十刈 +五十右 +五十君 +五十地 +五十場 +五十子 +五十実 +五十實 +五十山田 +五十峯 +五十峰 +五十島 +五十崎 +五十嵐 +五十嶋 +五十嶺 +五十川 +五十州 +五十幡 +五十木 +五十村 +五十栖 +五十森 +五十棲 +五十樓 +五十殿 +五十沢 +五十洲 +五十澤 +五十玉 +五十田 +五十畑 +五十畠 +五十石 +五十立 +五十苅 +五十谷 +五十貝 +五十部 +五十里 +五十里屋 +五十野 +五十鈴 +五十鈴川 +五十風 +五十香 +五升田 +五升目 +五反 +五反分 +五反地 +五反田 +五反田屋 +五古 +五名 +五呂 +五味 +五味之本 +五味原 +五味多 +五味岡 +五味川 +五味本 +五味沢 +五味淵 +五味渕 +五味澤 +五味田 +五和宮 +五唐 +五喜田 +五坊 +五坪 +五城 +五堂 +五大 +五大院 +五天 +五太代 +五太子 +五字 +五孝 +五安 +五安城 +五官 +五定 +五宝 +五宮 +五家 +五寧 +五寳 +五寶 +五対 +五對 +五屋 +五山 +五岩 +五峯 +五島 +五島屋 +五崎 +五嵐 +五嵐川 +五嶋 +五嶋屋 +五嶌 +五川 +五師 +五幣 +五幤 +五平地 +五幾谷 +五座 +五庵 +五弊 +五弓 +五影 +五影堂 +五得 +五徳 +五戸 +五所 +五所尾 +五所村 +五所野尾 +五拾免 +五敷 +五斗 +五斗田 +五斗蒔 +五日市 +五明 +五明田 +五智 +五月 +五月女 +五月日 +五月田 +五木 +五木本 +五木田 +五木谷 +五本 +五本上 +五本木 +五本松 +五村 +五条 +五条堀 +五条川 +五条方 +五来 +五東 +五林 +五枚橋 +五枝 +五枡本 +五桝本 +五條 +五條堀 +五條歩 +五次 +五歩一 +五歩市 +五歩池 +五殿 +五水井 +五江淵 +五江渕 +五沢 +五泉 +五津 +五浦 +五海 +五瀬 +五熊 +五王 +五瓶 +五田 +五由出 +五町 +五町森 +五畑 +五畿田 +五百 +五百久 +五百井 +五百住 +五百倉 +五百原 +五百城 +五百尾 +五百山 +五百島 +五百崎 +五百川 +五百扇 +五百旗部 +五百旗頭 +五百木 +五百森 +五百沢 +五百澤 +五百瀬 +五百田 +五百目 +五百磐 +五百竹 +五百籏頭 +五百蔵 +五百藏 +五百路 +五百部 +五百野 +五百雀 +五石 +五社 +五社谷 +五神 +五福 +五穀 +五端 +五筒 +五箇 +五箇谷 +五箇野 +五籐 +五網 +五老 +五老海 +五耒 +五舛出 +五舛目 +五艘 +五良 +五良島 +五良水 +五色 +五荘 +五葉 +五葉木 +五葉谷 +五藤 +五行 +五見 +五角 +五谷 +五貝 +五貫 +五賀 +五軒家 +五軒浜 +五軒濱 +五軒矢 +五輪 +五辺 +五辻 +五通 +五道 +五邉 +五郎 +五郎三 +五郎丸 +五郎地 +五郎大 +五郎尾 +五郎島 +五郎川 +五郎水 +五郎畑 +五郎谷 +五郎部 +五郡 +五酔 +五里地 +五里守 +五里川原 +五里江 +五重目 +五野 +五野上 +五野井 +五閑 +五間 +五間岩 +五間長 +五関 +五阿味 +五阿弥 +五阿彌 +五陸 +五雲寺 +五領 +五領田 +五頭 +五香 +五香屋 +五鬼上 +五鬼助 +五鬼田 +五鬼継 +五鹿 +五龍神田 +井ノ一 +井一 +井二 +仁八 +今一 +今八幡 +仲三河 +仲二見 +伊万里 +伊三木 +伊三部 +伊三野 +伊五沢 +伊五澤 +伊千 +伍十川 +休万 +伝四 +佐二木 +佐八 +佐美三 +余百 +倉八 +倉富二 +儀万 +儀三武 +元二 +入一 +入万 +入不二 +八つ代 +八ケ代 +八ケ婦 +八ケ窪 +八ツ井 +八ツ代 +八ツ元 +八ツ塚 +八ツ尾 +八ツ山 +八ツ岩 +八ツ峰 +八ツ崎 +八ツ役 +八ツ星 +八ツ木 +八ツ本 +八ツ柳 +八ツ橋 +八ツ波 +八ツ浦 +八ツ田 +八ツ繁 +八ツ藤 +八ツ賀 +八丁 +八丁地 +八丁目 +八丁野 +八七橋 +八万 +八万木 +八丈 +八丈野 +八上 +八下田 +八与 +八世山 +八並 +八串 +八丸 +八丹 +八久 +八久保 +八乕 +八乙女 +八九 +八亀 +八五郎丸 +八井 +八井沢 +八井田 +八京 +八代 +八代田 +八代谷 +八代醍 +八伏 +八住 +八作 +八俣 +八倉 +八倉巻 +八元 +八光 +八児 +八兒 +八内 +八切 +八別当 +八別當 +八前 +八剣 +八剱 +八劒 +八劔 +八力 +八加部 +八十 +八十住 +八十八 +八十出 +八十原 +八十山 +八十岡 +八十島 +八十嶋 +八十川 +八十広 +八十木 +八十歩 +八十河 +八十浜 +八十濱 +八十瀬 +八十田 +八十科 +八千 +八千代 +八千古島 +八千古嶋 +八千田 +八卷 +八原 +八又 +八友 +八反 +八反丸 +八反地 +八反田 +八取 +八司 +八合 +八名 +八名木 +八向 +八吹 +八周 +八和田 +八品 +八国 +八国生 +八國 +八國生 +八地又 +八坂 +八垣 +八垰 +八城 +八塔 +八塚 +八塩 +八壁 +八声 +八壽八 +八多 +八多川 +八太 +八夫 +八子 +八子熊 +八字 +八宗岡 +八宮 +八家 +八富 +八寿八 +八寿田 +八尋 +八尋淵 +八尋渕 +八尺 +八尻 +八尾 +八尾井 +八尾坂 +八尾師 +八尾村 +八尾板 +八尾田 +八尾谷 +八尾野 +八屋 +八山 +八岡 +八岩 +八峠 +八島 +八崎 +八嵜 +八嶋 +八嶌 +八川 +八巻 +八幡 +八幡原 +八幡垣 +八幡屋 +八幡木 +八幡秋山 +八幡谷 +八幡野 +八幡領 +八平 +八幾井 +八広 +八度 +八廣 +八張 +八影 +八役 +八性 +八惣 +八懸 +八戸 +八戸木 +八戸野 +八房 +八所 +八手 +八手亦 +八手又 +八手幡 +八括 +八掛 +八敷 +八文字 +八斗 +八方 +八旗 +八日 +八日囿 +八日園 +八日市 +八日市屋 +八日市谷 +八明 +八星 +八景 +八月朔日 +八朔 +八朔日 +八朝 +八木 +八木ケ谷 +八木下 +八木井 +八木原 +八木司 +八木場 +八木尾 +八木山 +八木岡 +八木島 +八木巻 +八木平 +八木庭 +八木戸 +八木本 +八木森 +八木橋 +八木沢 +八木沼 +八木澤 +八木田 +八木谷 +八木野 +八本 +八本木 +八杉 +八村 +八杖 +八束 +八条 +八東 +八松 +八板 +八林 +八柄 +八柏 +八染 +八柳 +八栗 +八桁 +八條 +八森 +八槇 +八構 +八槙 +八槻 +八樹 +八橋 +八次 +八武崎 +八段 +八毛 +八永 +八汐 +八江 +八沢 +八河 +八波 +八波田 +八津 +八津倉 +八津又 +八津口 +八津尾 +八津川 +八津橋 +八津田 +八津谷 +八洲 +八浜 +八浦 +八浪 +八海 +八淵 +八渓 +八渡 +八源寺 +八潮 +八澤 +八濱 +八瀬 +八瀬尾 +八瀬山 +八瀬川 +八瀬林 +八瀬河 +八瀬辺 +八瀬邉 +八熊 +八牟礼 +八牟禮 +八牧 +八王 +八王地 +八王子 +八甫谷 +八田 +八田井 +八田原 +八田堀 +八田羽 +八田谷 +八田部 +八田野 +八甲田 +八町 +八畑 +八畝田 +八畠 +八登 +八百 +八百三 +八百下 +八百中 +八百井 +八百代 +八百原 +八百坂 +八百城 +八百屋 +八百山 +八百川 +八百市 +八百幸 +八百木 +八百本 +八百村 +八百板 +八百枝 +八百田 +八百谷 +八百野 +八的 +八矢 +八石 +八社宮 +八神 +八穴 +八窪 +八端 +八竹 +八符 +八筈 +八筬 +八箇 +八篠 +八籏 +八納 +八絛 +八綿 +八羽 +八羽毛 +八耳 +八聲 +八與 +八舟 +八船 +八色 +八若 +八荷 +八萬 +八葉 +八蕪 +八藤 +八藤丸 +八藤後 +八角 +八記 +八講 +八谷 +八賀 +八起 +八越 +八車 +八軒 +八軒屋 +八輪 +八辺 +八辻 +八道 +八郎田 +八部 +八部野 +八郷 +八里 +八重 +八重下 +八重代 +八重倉 +八重元 +八重原 +八重口 +八重垣 +八重尾 +八重山 +八重岡 +八重岳 +八重島 +八重崎 +八重嶋 +八重嶌 +八重嶽 +八重川 +八重幡 +八重座 +八重木 +八重本 +八重柏 +八重桓 +八重桜 +八重森 +八重樫 +八重橋 +八重櫻 +八重沢 +八重津 +八重澤 +八重田 +八重畑 +八重盛 +八重石 +八重練 +八重見 +八重野 +八重門 +八野 +八野井 +八野田 +八釖 +八釜 +八釣 +八釼 +八鍬 +八鎌 +八長 +八間 +八間川 +八阪 +八陣 +八陳 +八隅 +八雲 +八雲井 +八面 +八鞍 +八須 +八須元 +八須賀 +八頭 +八頭司 +八馬 +八高 +八鬼 +八鳥 +八鹿 +八黄地 +六ケ村 +六ツ名 +六ツ崎 +六ツ役 +六ツ森 +六ツ石 +六ツ見 +六万 +六与 +六串 +六井 +六人石 +六人部 +六信 +六倉 +六十田 +六十苅 +六十谷 +六十里 +六厩 +六名 +六呂田 +六坂 +六塚 +六宗 +六室 +六尾 +六山 +六岡 +六峯 +六峰 +六崎 +六川 +六平 +六戸部 +六日市 +六枝 +六楽内 +六津井 +六浦 +六田 +六碕 +六笠 +六與 +六興 +六萬 +六藤 +六角 +六角屋 +六谷 +六車 +六軒 +六辻 +六連 +六野 +六釜 +六鎗 +六門 +六雄 +六鹿 +兵万 +兵三 +兼八 +内一 +内之八重 +内八重 +円一 +初一 +前三盛 +副万 +加三 +加九 +加二倉 +加二谷 +加五元 +加千須 +加百 +加篭六 +加籠六 +勘七 +勘六野 +勝二 +勢一 +勢万 +北一 +北七 +北八 +北八代 +十々木 +十ノ目 +十一 +十一家 +十一谷 +十七 +十七夜月 +十七女 +十七部 +十七里 +十万 +十三 +十中 +十丸 +十久保 +十九川 +十九本 +十九波 +十九浦 +十九百 +十亀 +十二 +十二丁 +十二役 +十二所 +十二村 +十二林 +十二町 +十二谷 +十二里 +十二野 +十五 +十代 +十代田 +十住 +十佐近 +十信田 +十倉 +十倍 +十八 +十八公 +十八日 +十六原 +十六沢 +十六澤 +十前 +十十木 +十南 +十原 +十司 +十合 +十名 +十和 +十和田 +十場 +十塚 +十字 +十家 +十屋 +十山 +十島 +十川 +十左近 +十市 +十府 +十役 +十徳 +十志田 +十念 +十手山 +十持 +十握 +十文字 +十日市 +十日谷 +十時 +十朱 +十村 +十束 +十条 +十松 +十林 +十枝 +十枝内 +十根川 +十森 +十楚 +十楽 +十楽寺 +十河 +十津 +十津川 +十玉 +十王 +十王寺 +十王舘 +十王館 +十田 +十石 +十祖 +十神 +十良 +十良沢 +十良澤 +十菱 +十萬 +十蔵寺 +十蟹 +十見 +十角 +十輪地 +十返 +十連地 +十郎 +十部 +十都 +十重田 +十野 +十門地 +十阿弥 +十阿彌 +十露木 +十鳥 +千 +千々和 +千々岩 +千々布 +千々木 +千々村 +千々松 +千々波 +千々石 +千々谷 +千々輪 +千々部 +千々野 +千が崎 +千ケ崎 +千ノ木 +千ノ本 +千万 +千丈 +千三木 +千上 +千且 +千並 +千中 +千丸 +千久田 +千久谷 +千久間 +千之巣 +千之木 +千之本 +千井 +千井野 +千京 +千仏 +千代 +千代世 +千代丸 +千代住 +千代倉 +千代原 +千代反田 +千代園 +千代坂 +千代山 +千代岡 +千代島 +千代崎 +千代川 +千代延 +千代政 +千代木 +千代本 +千代村 +千代松 +千代森 +千代樵 +千代永 +千代沢 +千代浦 +千代澤 +千代田 +千代留 +千代盛 +千代窪 +千代薗 +千代藤 +千代西尾 +千代谷 +千代野 +千代間 +千代鶴 +千伝 +千住 +千佐 +千保 +千保木 +千俵 +千倉 +千傳 +千僧供 +千先 +千光 +千光士 +千光寺 +千児島 +千切 +千切谷 +千刈 +千利浜 +千利濱 +千割 +千力 +千勝 +千北 +千千和 +千千松 +千千波 +千千石 +千千輪 +千原 +千口 +千古 +千台 +千司 +千合 +千吉良 +千同 +千名 +千名原 +千味 +千品 +千喜田 +千喜良 +千国 +千國 +千土 +千地 +千地丸 +千地岩 +千坂 +千坊 +千垣内 +千城 +千埜 +千堂 +千場 +千塚 +千塲 +千壽 +千多 +千守 +千安 +千室 +千家 +千寺丸 +千寿 +千尋 +千尺 +千尾 +千屋 +千山 +千島 +千崎 +千嵐 +千嵜 +千嶋 +千嶌 +千巌 +千巖 +千川 +千川原 +千巣 +千布 +千年 +千年原 +千年屋 +千広 +千廣 +千引 +千後 +千後滝 +千後瀧 +千徳 +千応山 +千應山 +千成 +千戝 +千房 +千手 +千手間 +千才 +千把 +千抦 +千振 +千斛 +千日 +千日坂 +千旦 +千早 +千明 +千星 +千智岩 +千智松 +千曳 +千月 +千木 +千木崎 +千木穂 +千木良 +千木里 +千木野 +千本 +千本木 +千本松 +千朿 +千杉 +千村 +千束 +千条 +千東 +千松 +千林 +千枝 +千柄 +千根 +千桐 +千桜 +千桝 +千條 +千棒 +千森 +千檀 +千櫻 +千正 +千歩 +千歳 +千歳丸 +千水 +千江 +千沢 +千沢口 +千河 +千治松 +千波 +千津井 +千浜 +千浦 +千海 +千滝 +千澤 +千澤口 +千濱 +千烝 +千焏 +千熊 +千玉 +千生 +千田 +千田口 +千田谷 +千町 +千畑 +千疋 +千登勢 +千百松 +千盤 +千目 +千眼 +千矢 +千知 +千知岩 +千知松 +千知波 +千石 +千石谷 +千神 +千福 +千福地 +千秋 +千種 +千穐 +千竃 +千竈 +千竜 +千端 +千笠 +千管 +千籐 +千絛 +千綾 +千綿 +千羽 +千股 +千能 +千脇 +千舘 +千舩 +千船 +千艘 +千良 +千色 +千艸 +千苅 +千草 +千菅 +千菊 +千葉 +千葉井 +千葉原 +千葉山 +千葉崎 +千葉東 +千葉桜 +千葉櫻 +千蒲 +千蔵 +千藏 +千藤 +千虎 +千行 +千装 +千見寺 +千覚原 +千谷 +千貝 +千財 +千財丸 +千貫 +千賀 +千賀浦 +千足 +千車 +千載 +千輝 +千輪 +千速 +千道 +千達 +千邑 +千部 +千郷 +千酌 +千里 +千里久 +千里内 +千重 +千野 +千野原 +千野根 +千野田 +千野辺 +千金 +千金楽 +千金良 +千釜 +千間 +千阪 +千陽 +千隝 +千須和 +千頭 +千頭井 +千頭和 +千香 +千馬 +千駄 +千高 +千鳥 +千鶴 +千鹿野 +千龍 +千𥧄 +升一 +南八重 +南百瀬 +参三 +古一 +古三庄 +古伊万里 +古八 +古六 +古家一 +可二生 +合六 +吉八木 +吹一 +味八木 +善万 +喜三 +四つ橋 +四つ目 +四の宮 +四ケ所 +四ケ浦 +四ケ田 +四ケ谷 +四ケ野 +四ツ井 +四ツ井田 +四ツ倉 +四ツ分 +四ツ塚 +四ツ家 +四ツ居 +四ツ屋 +四ツ岳 +四ツ島 +四ツ嶋 +四ツ嶽 +四ツ役 +四ツ木 +四ツ村 +四ツ柳 +四ツ橋 +四ツ永 +四ツ滝 +四ツ瀧 +四ツ田 +四ツ目 +四ツ碇 +四ツ谷 +四ツ路 +四ツ車 +四ツ辻 +四ツ釜 +四ツ門 +四ツ関 +四ノ原 +四ノ宮 +四七 +四万村 +四万田 +四下 +四丸 +四丹 +四之宮 +四井 +四井田 +四伊 +四位 +四位例 +四住 +四作 +四俣 +四俵 +四倉 +四元 +四冨 +四分一 +四分谷 +四十 +四十万 +四十万谷 +四十九 +四十九院 +四十井 +四十住 +四十八願 +四十内 +四十坊 +四十塚 +四十宮 +四十山 +四十岡 +四十崎 +四十川 +四十木 +四十本 +四十栄 +四十榮 +四十沢 +四十洲 +四十澤 +四十物 +四十物谷 +四十田 +四十竹 +四十萬谷 +四十谷 +四十野 +四反田 +四国 +四國 +四坂 +四坊 +四垂 +四堂 +四塚 +四夷 +四女野 +四季 +四宅 +四宮 +四宮田 +四家 +四家井 +四富 +四尺 +四尾 +四居 +四屋 +四山 +四岡 +四島 +四嶋 +四川 +四平 +四広 +四度 +四廣 +四役 +四徳 +四恩 +四戸 +四戸岸 +四手 +四手井 +四折 +四斉谷 +四斎谷 +四斗 +四斗辺 +四斗邊 +四方 +四方伝 +四方城 +四方堂 +四方天 +四方山 +四方川 +四方田 +四方谷 +四方路 +四日 +四日市 +四日谷 +四月朔日 +四木 +四本 +四本木 +四本松 +四杉 +四村 +四条 +四林 +四枚田 +四枝 +四柳 +四栗 +四條 +四橋 +四歩一 +四氏 +四水 +四沢 +四津 +四津井 +四津川 +四津田 +四津谷 +四浦 +四海 +四淵 +四渕 +四潟 +四澤 +四熊 +四牟田 +四王天 +四田 +四町田 +四畑 +四畝町 +四登 +四百刈 +四百田 +四百目 +四百苅 +四目忠 +四碇 +四礼 +四禮 +四竃 +四竈 +四童子 +四篠 +四籐 +四維 +四脇 +四至本 +四良丸 +四茂野 +四葉 +四蔵 +四藏 +四藤 +四衢 +四角 +四角目 +四谷 +四越 +四車 +四軒家 +四軒町 +四辻 +四通 +四通田 +四道 +四達 +四邨 +四郎丸 +四郎園 +四郎田 +四重田 +四野 +四野宮 +四野見 +四釜 +四鈴 +四鏡 +四門 +四間 +四間丁 +四関 +四阿 +四静 +四飯 +四馬田 +四鬼 +四鹿 +四齊谷 +国ノ十 +國ノ十 +圓一 +土一 +坂三 +坂八 +坂千代 +城一 +堀一 +堂七 +堂八 +堂六 +堰八 +塚八 +塩三 +増百 +夏八木 +大万 +大三 +大三和 +大三島 +大三川 +大三輪 +大九 +大二 +大五 +大八児 +大八木 +大六 +大六野 +大千里 +大四 +大志万 +天一 +奇二 +奥一 +妙一 +孫八 +孫六 +宅万 +守一 +安千谷 +宗万 +宮一 +宮三 +宮千代 +家千 +寺一 +寺七 +寺二 +小一原 +小万 +小三田 +小三門 +小二又 +小二田 +小二里 +小八ケ代 +小八木 +小八田 +小八重 +小六 +小千田 +小千谷 +小四郎丸 +小椎八重 +小田二 +尺一 +尾一 +尾万 +山一 +山七 +山三 +山二 +山八 +山六 +山千代 +山百 +岡一 +岡野一 +岩三 +岩八重 +川七 +川九 +工一 +左三川 +左衛門三郎 +市万田 +市六 +布一 +平八重 +庄八 +廿千 +弐百免 +弥三川 +弥三谷 +弥三須 +弥五 +弥五郎丸 +弥六 +弥十郎 +彌三川 +彌五郎丸 +彌八 +彌六 +当六 +後一 +従二 +従二谷 +從二 +徳一 +徳万 +徳三 +徳千代 +志万 +悪七 +惣万 +惣八 +扇一 +才一 +押三見 +拾三原 +振五 +政二 +文殊四郎 +文珠四郎 +斉二 +斉五沢 +斎二 +斎五沢 +斎五澤 +新九町 +新二日市 +新八 +新四原 +新歩一 +昼八 +晝八 +朝一 +朝三 +木一 +木三田 +木佐一 +末一 +本九町 +本二日市 +杉万 +杉八合 +村万 +杢三 +東一 +東一坊 +東一昉 +東万 +東三条 +東九 +東九條 +東二町 +東五十川 +東八重 +東四柳 +松一 +松七五三 +松三 +松二 +松八重 +松千 +松四 +松百 +板八 +枡一 +栗三 +桝一 +梅千野 +森一 +椎八重 +楠八重 +権八 +樫八重 +橘八重 +次六 +次郎万 +正一 +武一 +毛千 +水六 +水四 +永一 +永二 +江六前 +池一 +池三津 +沖二 +河二 +河千泰 +河千田 +泉二 +津九浦 +浜二 +浜千代 +浜四津 +清三津 +源九 +源五郎丸 +源六 +濱二 +濱千代 +濱四津 +熊一 +猪八重 +玉一 +玉八 +甚九 +甚五 +生一 +生三 +産一 +田一 +田万 +田万里 +田二見 +田二谷 +田千代 +百 +百々 +百々亀 +百々坂 +百々塚 +百々海 +百々済 +百々瀬 +百々米木 +百々谷 +百々路 +百々野 +百万 +百丈 +百上 +百中 +百丸 +百井 +百代 +百倍 +百元 +百冨 +百出 +百刈 +百勝 +百北 +百千 +百千田 +百南 +百原 +百合 +百合中 +百合口 +百合園 +百合山 +百合岡 +百合島 +百合嶋 +百合川 +百合本 +百合林 +百合永 +百合沢 +百合澤 +百合田 +百合綱 +百合草 +百合薗 +百合藤 +百合野 +百合長 +百名 +百地 +百坂 +百坪 +百垣 +百堂 +百塚 +百家 +百富 +百寿 +百尾 +百山 +百岡 +百岳 +百島 +百崎 +百嶋 +百川 +百市 +百師 +百度 +百引 +百成 +百我 +百戸 +百日 +百春 +百木 +百木田 +百木野 +百本 +百村 +百束 +百松 +百枝 +百橋 +百次 +百武 +百歩 +百毛 +百永 +百江 +百沢 +百治 +百津 +百浦 +百海 +百済 +百渓 +百溪 +百澤 +百濃 +百濟 +百瀬 +百生 +百田 +百町 +百畑 +百留 +百百 +百百塚 +百目 +百目木 +百目鬼 +百相 +百石 +百積 +百竹 +百花 +百萬 +百衣 +百谷 +百貫 +百足 +百足山 +百軒 +百道 +百部 +百都 +百里 +百野 +百長 +百間 +百間田 +百間谷 +百雲 +百鬼 +百鳥 +盛一 +目七 +直一 +真一 +矢三 +矢五田 +矢八 +石三 +石五 +祖一 +神一 +神八 +福一 +福万 +福三田 +秋三 +秋山八幡 +種五 +竒二 +竜八 +竹一 +竹万 +第十 +米一 +紀三井 +紺一 +紺一向 +総三 +羽二塚 +羽二木 +羽二生 +聞一 +能一 +與一迫 +與三 +與三川 +與三本 +與三野 +與五沢 +與五澤 +與四田 +興五澤 +芝一 +花八 +荒二井 +菊一 +菊万 +菊千 +菖一 +菰千葉 +蔵五 +藏五 +藤三 +藤九 +藤五 +藤八 +藤六 +西万 +西二町 +西五辻 +西八条 +西八條 +西四辻 +西阿十 +見一 +規矩一 +角一 +角七 +角三 +角二 +角五 +谷一 +貮百免 +貳百免 +賀篭六 +賀籠六 +越三 +輿五澤 +近万 +運万 +道三 +邑十 +郷万 +郷六 +酒百 +重三 +野一 +野一色 +金一 +金七 +金万 +金三津 +金五 +金田一 +釜一 +鉋六 +鍋九 +長一 +長三 +門三 +門三野 +阿万 +阿万瀬 +阿万田 +阿万野 +阿二 +阿千輪 +陣一 +須一 +須百 +飯万島 +飾万 +飾万津 +高一 +高三 +高三潴 +高三野 +高八 +高八卦 +高八重 +高千代 +高千穂 +鬼ケ一 +鬼一 +鬼十 +鹿篭六 +鹿籠六 +齋二 +齋五澤 +龍八 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/name/surname.tsv b/fun_text_processing/inverse_text_normalization/ja/data/name/surname.tsv new file mode 100644 index 0000000..3753aba --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/name/surname.tsv @@ -0,0 +1,126237 @@ +アイ 阿井 +アイ 藍 +アイ 相 +アイ 安威 +アイ 愛 +アイ 会 +アイ 會 +アイ 安衣 +アイイ 相井 +アイイエ 藍家 +アイイズミ 相泉 +アイイソ 相磯 +アイウ 相友 +アイウチ 相内 +アイウチ 愛内 +アイウチ 四十内 +アイウラ 相浦 +アイウラ 合浦 +アイエ 阿江 +アイエ 相江 +アイエダ 相枝 +アイエダ 愛江田 +アイオ 相尾 +アイオ 合尾 +アイオ 相緒 +アイオ 愛尾 +アイオイ 相生 +アイオイガキ 相生垣 +アイオカ 藍岡 +アイカ 相賀 +アイカ 秋鹿 +アイカ 愛下 +アイカ 穐鹿 +アイカ 相嘉 +アイガ 相賀 +アイカイ 相貝 +アイガキ 相垣 +アイガキ 愛垣 +アイガキ 合柿 +アイカクチ 合角地 +アイカサ 相笠 +アイガサ 相笠 +アイガサ 会笠 +アイガセ 鮎瀬 +アイガセ 相ケ瀬 +アイカタ 相方 +アイカベ 相壁 +アイカミ 相神 +アイガミ 相上 +アイガミ 相神 +アイガミ 愛上 +アイカワ 相川 +アイカワ 愛川 +アイカワ 合川 +アイカワ 会川 +アイカワ 相河 +アイカワ 藍川 +アイカワ 淡川 +アイカワ 四十川 +アイカワ 會川 +アイカワ 阿井川 +アイカワ 川 +アイカワ 藍河 +アイキ 相木 +アイキ 合木 +アイキ 愛木 +アイキ 藍木 +アイキ 会木 +アイキ 四十木 +アイキ 會木 +アイキヨ 愛清 +アイキョウ 相京 +アイキョウ 愛敬 +アイキョウ 鮎京 +アイキョウ 相亰 +アイキョウ 藍京 +アイキョウ 愛教 +アイクザワ 愛久澤 +アイグチ 合口 +アイグチ 相口 +アイグチ 藍口 +アイクラ 相倉 +アイクラ 相蔵 +アイグン 合群 +アイケイ 愛敬 +アイコ 相子 +アイコウ 愛甲 +アイゴウ 相合 +アイゴウ 藍郷 +アイゴウ 鮎合 +アイゴウ 愛合 +アイコシ 相越 +アイゴシ 相越 +アイサ 相佐 +アイザ 相座 +アイサカ 逢坂 +アイサカ 相坂 +アイサカ 逢阪 +アイサカ 相阪 +アイサカ 合坂 +アイサカ 合阪 +アイサカ 会坂(會坂) +アイザカ 相坂 +アイサキ 相崎(相嵜) +アイサキ 四十崎 +アイザキ 相崎(相嵜) +アイザキ 合崎 +アイザキ 藍崎 +アイザシ 相差 +アイザト 東里 +アイサビ 合佐毘 +アイサワ 相沢 +アイサワ 相澤 +アイサワ 合沢 +アイサワ 逢沢 +アイサワ 會澤 +アイサワ 愛澤 +アイサワ 合澤 +アイサワ 逢澤 +アイザワ 相沢 +アイザワ 相澤 +アイザワ 会沢 +アイザワ 鮎沢 +アイザワ 愛沢 +アイザワ 合沢 +アイザワ 藍沢 +アイザワ 鮎澤 +アイザワ 逢沢 +アイザワ 會澤 +アイザワ 愛澤 +アイザワ 藍澤 +アイザワ 合澤 +アイザワ 会澤 +アイザワ 四十沢 +アイザワ 逢澤 +アイザワ 會沢 +アイザワ 四十澤 +アイザワ 埃沢 +アイシ 愛子 +アイジ 合路 +アイジ 愛路 +アイシゲ 相繁 +アイシタ 愛下 +アイシマ 相島 +アイシマ 相嶋 +アイシマ 愛島 +アイシマ 藍島 +アイジマ 相島 +アイジマ 相嶋 +アイジマ 会嶋 +アイジマ 会島 +アイジマ 愛島 +アイジマ 會嶋 +アイシャ 合砂 +アイジュン 藍順 +アイジョウ 相上 +アイシン 愛新 +アイス 愛須 +アイス 相須 +アイス 愛洲 +アイス 愛州 +アイス 相洲 +アイス 相巣 +アイズ 会津 +アイズ 相津 +アイズ 間津 +アイズ 曾津 +アイズミ 四十住 +アイズミ 相墨 +アイズミ 相住 +アイズミ 相泉 +アイセ 愛瀬 +アイセ 相瀬 +アイセキ 相関 +アイゼキ 相関 +アイゼン 愛染 +アイソ 相磯 +アイソ 相蘇 +アイソ 相曽 +アイソ 間曽 +アイソ 相曾 +アイソ 間曾 +アイソ 相蘓 +アイソウ 相宗 +アイソウ 間惣 +アイソガワ 会曾川 +アイソガワ 会曽川(會曽川) +アイゾノ 相園 +アイゾノ 相薗 +アイゾメ 藍染 +アイタ 会田 +アイタ 相田 +アイタ 會田 +アイタ 藍田 +アイタ 愛田 +アイタ 相多 +アイダ 合田 +アイダ 会田 +アイダ 相田 +アイダ 間 +アイダ 會田 +アイダ 藍田 +アイダ 愛田 +アイダ 四十田 +アイダ 英田 +アイダ 相多 +アイタカ 相高 +アイタキ 相滝 +アイタク 相宅 +アイタケ 四十竹 +アイダテ 相館 +アイタニ 合谷 +アイタニ 間谷 +アイタニ 相谷 +アイタニ 四十谷 +アイタニ 藍谷 +アイタニ 会谷 +アイタニ 愛谷 +アイタニ 會谷 +アイダニ 間谷 +アイチ 愛知 +アイチ 間地 +アイチ 相地 +アイチ 愛智 +アイチ 相智 +アイチ 愛地 +アイチャ 相茶 +アイヅ 会津 +アイヅ 合津 +アイヅ 相津 +アイヅ 會津 +アイヅ 間津 +アイヅ 愛津 +アイヅカ 相塚 +アイツキ 合月 +アイツキ 相築 +アイツキ 愛月 +アイヅキ 合月 +アイヅキ 相月 +アイツボ 合坪 +アイツボ 愛坪 +アイト 相戸 +アイド 合戸 +アイド 相戸 +アイド 相渡 +アイド 相度 +アイトウ 相藤 +アイトウ 相当 +アイドウ 相道 +アイトク 相徳 +アイドミ 相富 +アイナイ 相内 +アイナカ 相中 +アイナカ 合中 +アイナラ 相奈良 +アイニチ 愛日 +アイヌキ 会退 +アイヌキ 會退 +アイヌマ 愛沼 +アイヌマ 合沼 +アイヌマ 相沼 +アイネ 相根 +アイノ 間野 +アイノ 相野 +アイノ 藍野 +アイノ 合野 +アイノ 愛野 +アイノ 会野(會野) +アイノ 四十野 +アイノ 相埜 +アイノウラ 相浦 +アイノキ 会退 +アイノキ 會退 +アイノグチ 合野口 +アイノタ 相野田 +アイノダ 相野田 +アイノブ 相信 +アイノマタ 相之俣 +アイノヤ 相野谷 +アイノヤ 相ノ谷 +アイノヤマ 相ノ山 +アイノヤマ 相野山 +アイバ 相馬 +アイバ 相場 +アイバ 相羽 +アイバ 饗庭 +アイバ 饗場 +アイバ 相葉 +アイバ 相庭 +アイバ 愛場 +アイバ 染葉 +アイバ 会場 +アイバ 藍場 +アイバ 相波 +アイバ 合場 +アイバ 愛葉 +アイバ 合葉 +アイバ 藍葉 +アイバ 合庭 +アイバ 間馬 +アイバ 合羽 +アイバ 愛波 +アイバ 間場 +アイバ 饗塲 +アイバ 相塲 +アイバ 會場 +アイハシ 愛橋 +アイハシ 相橋 +アイハタ 相畑 +アイハタ 藍畑 +アイハタ 間畠 +アイバタ 相畑 +アイバタ 間畠 +アイハナ 相花 +アイハマ 合浜 +アイハマ 相浜(相濱) +アイハマ 合濱 +アイバモリ 相馬森 +アイハラ 相原 +アイハラ 粟飯原 +アイハラ 合原 +アイハラ 藍原 +アイハラ 愛原 +アイハラ 栗飯原 +アイハラ 会原 +アイハラ 間原 +アイハラ 會原 +アイバラ 相原 +アイバラ 粟飯原 +アイバラ 藍原 +アイビキ 相引 +アイヒロ 相広 +アイブ 相武 +アイフク 相福 +アイベ 相部 +アイホシ 相星 +アイボシ 相星 +アイマ 相馬 +アイマ 相間 +アイマツ 相松 +アイマノ 相間野 +アイミ 相見 +アイミ 会見 +アイミ 會見 +アイミズ 相水 +アイミツ 合満 +アイミツ 阿井光 +アイミツ 合滿 +アイミツ 相光 +アイミヤ 相宮 +アイム 相武 +アイムタ 相牟田 +アイムラ 相村 +アイムラ 愛村 +アイモト 相本 +アイモト 四十本 +アイモト 相元 +アイモト 藍元 +アイモノ 四十物 +アイモノ 相物 +アイモノヤ 四十物谷 +アイモノヤ 相物屋 +アイモリ 相森 +アイモリ 相守 +アイモリ 藍森 +アイモン 靄門 +アイヤ 藍谷 +アイヤ 愛屋 +アイヤ 愛谷 +アイヤマ 相山 +アイヤマ 四十山 +アイヤマ 愛山 +アイヨシ 相吉 +アイヨシザワ 相吉沢 +アイヨシザワ 相吉澤 +アイラ 姶良 +アイロク 合六 +アイワ 相輪 +アウチ 阿内 +アウムラ 相生村 +アウメ 安梅 +アウン 阿雲 +アエ 阿江 +アエバ 饗庭 +アエバ 饗場 +アオ 粟生 +アオ 青 +アオ 阿尾 +アオ 青尾 +アオアイ 青合 +アオイ 青井 +アオイ 翠 +アオイ 葵 +アオイ 青位 +アオイ 阿尾井 +アオイケ 青池 +アオイシ 青石 +アオイズミ 青泉 +アオイタ 葵田 +アオイタ 青板 +アオイダ 葵田 +アオイデ 青出 +アオウ 粟生 +アオウ 阿王 +アオウダ 粟生田 +アオウミ 青海 +アオウメ 青梅 +アオエ 青江 +アオエ 青枝 +アオエ 青栄 +アオエダ 青枝 +アオエツ 青悦 +アオオ 青尾 +アオオカ 青岡 +アオオカ 青丘 +アオカ 青鹿 +アオガイ 青貝 +アオガイチ 青垣内 +アオガウチ 青垣内 +アオガエ 青替 +アオガキ 青柿 +アオガキ 青垣 +アオガキウチ 青垣内 +アオカケ 青掛 +アオカゲ 青景 +アオカゲ 青陰 +アオカゲ 青影 +アオカゲ 青蔭 +アオカタ 青方 +アオガメ 青亀 +アオカリ 青刈 +アオカリ 青苅 +アオカワ 青川 +アオカワ 碧川 +アオキ 青木 +アオキ 青樹 +アオキ 粟生木 +アオキ 檍 +アオキ 青鬼 +アオキ 青城 +アオキ 青黄 +アオキ 碧木 +アオキ 葵木 +アオキ 安保木 +アオキ 滄木 +アオギ 仰 +アオギ 青儀 +アオギシ 青岸 +アオキタ 青北 +アオキタニ 青木谷 +アオキツ 阿麻橘 +アオキバ 青木葉 +アオキハラ 青木原 +アオキヤマ 青木山 +アオクサ 青草 +アオクサ 青艸 +アオグチ 青口 +アオクモ 青雲 +アオグモ 青雲 +アオクラ 青倉 +アオゴウ 青郷 +アオサ 青佐 +アオザ 青座 +アオサイ 青才 +アオサイ 青戈 +アオサカ 青坂 +アオサキ 青崎 +アオサキ 青嵜 +アオザキ 青崎 +アオサコ 青迫 +アオササ 青笹 +アオザサ 青笹 +アオサビ 青錆 +アオサワ 青沢 +アオサワ 青澤 +アオザワ 青澤 +アオシ 青枝 +アオシ 青司 +アオシ 青士 +アオジ 青地 +アオジ 安生地 +アオジ 青路 +アオシカ 青鹿 +アオシバ 青芝 +アオシバ 青柴 +アオシマ 青島 +アオシマ 青嶋 +アオシマ 青嶌 +アオジマ 青嶋 +アオシロ 青代 +アオスガ 青菅 +アオスギ 青杉 +アオズミ 青澄 +アオセ 青瀬 +アオソ 青麻 +アオソ 青曾 +アオソ 青曽 +アオゾノ 青園 +アオタ 青田 +アオタ 粟生田 +アオダ 青田 +アオダ 粟生田 +アオダイ 青代 +アオタキ 青滝 +アオタキ 青瀧 +アオタケ 青竹 +アオタニ 青谷 +アオチ 青池 +アオチ 青地 +アオヂ 青地 +アオツ 青津 +アオツカ 青塚 +アオツカ 青墳 +アオツカ 青冢 +アオヅカ 青塚 +アオテキ 青手木 +アオテギ 青手木 +アオデキ 青出木 +アオト 青砥 +アオト 青戸 +アオトウ 青藤 +アオナ 青菜 +アオナ 青奈 +アオナ 青名 +アオナカ 青中 +アオナギ 青柳 +アオナシ 青梨 +アオナハタ 青名畑 +アオナハタ 青名端 +アオナミ 青波 +アオナミ 青浪 +アオニシ 青西 +アオヌキ 青貫 +アオヌマ 青沼 +アオネ 青根 +アオノ 青野 +アオノ 青能 +アオノ 青ノ +アオノ 青𡌛 +アオバ 青葉 +アオバ 青羽 +アオバ 青芭 +アオハギ 青萩 +アオハシ 青橋 +アオハチ 青鉢 +アオバチ 青鉢 +アオハマ 青浜 +アオバヤシ 青林 +アオハラ 青原 +アオバラ 青原 +アオヒロ 青広(青廣) +アオフジ 青藤 +アオブチ 青渕 +アオブチ 青淵 +アオホリ 青堀 +アオホリ 青掘 +アオマツ 青松 +アオマメ 青豆 +アオミ 青海 +アオミ 青見 +アオミ 青水 +アオミ 碧海 +アオミズ 青水 +アオミネ 青峰 +アオミヤ 青宮 +アオムラ 青村 +アオメ 青目 +アオモト 青本 +アオモト 青元 +アオモリ 青森 +アオモリ 青盛 +アオモリ 蒼森 +アオヤ 青谷 +アオヤ 青屋 +アオヤ 青矢 +アオヤ 粟生屋 +アオヤギ 青柳 +アオヤギ 青桝 +アオヤド 青宿 +アオヤナギ 青柳 +アオヤマ 青山 +アオヤマ 碧山 +アオヤマ 粟生山 +アオヨウ 青陽 +アオヨシ 青芳 +アオリ 阿折 +アカ 阿嘉 +アカ 赤 +アガ 阿賀 +アガ 阿河 +アガ 安賀 +アガ 英賀 +アガ 淡河 +アカアナ 赤穴 +アカイ 赤井 +アカイ 明井 +アカイ 阿加井 +アカイ 阿迦井 +アカイ 閼伽井 +アカイ 赤居 +アカイ 阿賀井 +アカイエ 赤家 +アカイケ 赤池 +アカイサカ 赤井阪 +アカイサカ 赤井坂 +アカイザワ 赤井沢 +アカイザワ 赤井澤 +アカイシ 明石 +アカイシ 赤石 +アカイシサワ 赤石沢 +アカイシサワ 赤石澤 +アカイシザワ 赤石沢 +アカイシザワ 赤石澤 +アカイダ 赤井田 +アカイデ 赤出 +アカイバシ 赤井橋 +アカイハタ 赤井畑 +アカイワ 赤岩 +アカウシ 赤牛 +アカウミ 赤海 +アカウメ 赤梅 +アカウラ 赤浦 +アカウラ 赤裏 +アカエ 赤江 +アカエダ 赤枝 +アカエバシ 赤江橋 +アカオ 赤尾 +アカオ 赤穂 +アカオ 赤生 +アカオカ 赤岡 +アガオカ 阿賀岡 +アカオギ 赤荻 +アカオケ 赤桶 +アカオスギ 赤尾杉 +アカオセキ 赤尾関 +アカオゼキ 赤尾関 +アカオツ 赤尾津 +アカガ 赤賀 +アカガキ 赤垣 +アカガシ 赤樫 +アカガシ 赤柏 +アカガシラ 赤頭 +アカガネ 銅 +アカガネ 赤金 +アカカベ 赤壁 +アカカベ 赤下部 +アカカベ 赤家部 +アカカベ 赤我部 +アカガミ 赤上 +アカガミ 赤神 +アカガミ 赤髪 +アカガリ 赤苅 +アカガリヤマ 赤狩山 +アカガワ 赤川 +アカガワ 安賀川 +アカキ 赤木 +アカギ 赤木 +アカギ 赤城 +アカギ 明城 +アカギ 垢木 +アカギ 赤鬼 +アガキ 阿垣 +アカギシ 赤岸 +アカギダニ 赤木谷 +アカギリ 赤桐 +アカク 赤工 +アカクサ 赤草 +アカクサ 赤艸 +アカグチ 赤口 +アカクボ 赤久保 +アカクマ 赤熊 +アカグマ 赤熊 +アカクラ 赤倉 +アカクリ 赤栗 +アカグリ 赤栗 +アカゲ 赤毛 +アガケ 安掛 +アガケ 阿掛 +アガケ 網掛 +アカゴ 赤江 +アカサ 赤佐 +アカザ 赤座 +アカザ 赤㘴 +アカザ 藜 +アカザイ 赤在 +アカサカ 赤坂 +アカサカ 赤阪 +アカサカヤ 赤坂谷 +アカサカヤ 赤坂屋 +アカサカヤ 赤阪谷 +アカサキ 赤崎 +アカサキ 赤嵜 +アカサキ 赤碕 +アカザキ 赤崎 +アカザキ 明崎 +アカザキ 赤嵜 +アカザキ 赤碕 +アカサコ 赤迫 +アカサコ 赤窄 +アカサコ 赤硲 +アカサコ 赤﨏 +アカサビ 赤錆 +アカサワ 赤沢 +アカサワ 赤澤 +アカザワ 赤沢 +アカザワ 赤澤 +アカシ 明石 +アカシ 赤石 +アカシ 赤司 +アカシ 赤枝 +アカシ 紅 +アカシ 明司 +アカシ 赤志 +アカシ 赤次 +アカシ 赤士 +アカシ 明士 +アカジ 赤司 +アカジ 赤地 +アカジ 赤路 +アカジ 赤時 +アカジ 赤治 +アカジ 赤冶 +アカシオ 赤塩 +アカシカ 赤鹿 +アカシゲ 赤繁 +アカシゲ 赤重 +アカシタ 赤下 +アカシダ 明石田 +アカシダ 赤石田 +アカシタニ 明石谷 +アカシバ 赤柴 +アカシバ 赤芝 +アカシマ 赤島 +アカシマ 赤嶋 +アカジマ 赤嶋 +アカシヤ 明石家 +アカシロ 赤城 +アカス 赤須 +アカス 赤次 +アカズ 赤頭 +アカスカ 赤須賀 +アカスガ 赤須賀 +アカスギ 赤杉 +アカセ 赤瀬 +アカセ 明瀬 +アカゼ 明是 +アカセガワ 赤瀬川 +アカセコ 赤迫 +アカセト 赤背戸 +アカソ 赤楚 +アカソフ 赤祖父 +アカソベ 赤曽部 +アカソベ 赤曾部 +アカソメ 赤染 +アカゾメ 赤染 +アカタ 赤田 +アカダ 赤田 +アカダ 朱田 +アカダ 銅田 +アガタ 東田 +アガタ 県 +アガタ 安形 +アガタ 東方 +アガタ 縣 +アガタ 阿形 +アガタ 安方 +アガタ 阿片 +アガタ 阿方 +アガタ 懸 +アガタ 阿賀田 +アガタ 阿我田 +アガタ 阿県 +アガタ 阿縣 +アガタ 安賀多 +アガタ 安潟 +アガタ 安型 +アガタ 安県 +アガタ 安縣 +アガタ 英賀田 +アガタ 阿加多 +アカタキ 赤滝 +アカタキ 赤瀧 +アカタニ 赤谷 +アガタニ 阿賀谷 +アガタニ 英賀谷 +アガタハマ 阿潟浜(阿潟濱) +アカタベ 赤田部 +アカタマ 赤玉 +アカチ 赤池 +アカチ 赤地 +アカチカ 赤近 +アカツ 赤津 +アカツ 吾勝 +アカヅエ 赤杖 +アカツカ 赤塚 +アカツカ 赤柄 +アカツカ 赤墳 +アカヅカ 赤塚 +アカツキ 暁 +アカツキ 明槻 +アカツキ 赤月 +アカツチ 赤土 +アカツマ 赤妻 +アカヅマ 赤妻 +アガツマ 我妻 +アガツマ 上妻 +アガツマ 吾妻 +アガツマ 阿我妻 +アカデガワ 赤出川 +アカド 赤土 +アガト 上戸 +アカトウ 赤塔 +アカドウ 赤堂 +アカトキ 赤時 +アカトチ 赤栩 +アカドマリ 赤泊 +アカトリ 赤鳥 +アカナ 赤名 +アカナ 赤穴 +アカナガ 赤永 +アカナシ 赤梨 +アカナベ 茜部 +アカナベ 赤鍋 +アカニ 赤丹 +アカニシ 赤西 +アカニタ 赤仁田 +アカニタ 赤新田 +アカヌマ 赤沼 +アカネ 赤根 +アカネ 茜 +アカネ 阿会根 +アカネ 赤祢(赤禰) +アガネ 阿金 +アカネガクボ 茜ケ久保 +アカネガワ 赤根川 +アカネダ 赤根田 +アカネタニ 茜谷 +アカネベ 茜部 +アカネヤ 茜谷 +アカネヤ 茜屋 +アカネヤ 赤根谷 +アカノ 赤野 +アカノ 赤埜 +アガノ 上野(上墅) +アガノ 阿賀野 +アガノ 我野 +アカノダ 赤野田 +アカノマ 赤野間 +アカハ 赤羽 +アカバ 赤羽 +アカバ 赤場 +アカバ 赤葉 +アカバエ 赤波江 +アカハギ 赤萩 +アカハゲ 赤禿 +アカハゲ 赤兀 +アカハシ 赤橋 +アカハタ 赤畑 +アカハタ 赤畠 +アカバタ 赤畑 +アカバタケ 赤畠 +アカハナ 赤花 +アカハニ 赤埴 +アカハネ 赤羽 +アカハネ 赤羽根 +アカハネ 赤刎 +アカハネ 赤波根 +アカハネ 赤翼 +アカバネ 赤羽 +アカバネ 赤羽根 +アカバネ 赤刎 +アカバネ 赤波根 +アカハマ 赤浜 +アカハマ 赤濱 +アカバメ 赤羽目 +アカバヤシ 赤林 +アカハラ 赤原 +アカヒゲ 赤髭 +アカヒサ 赤久 +アカヒデ 赤秀 +アカヒラ 赤平 +アカヒラサワ 赤平沢(赤平澤) +アカフシ 赤節 +アカフジ 赤藤 +アカブシ 赤節 +アカフチ 赤渕 +アカブチ 赤渕 +アカブチ 赤淵 +アカベ 赤部 +アカホ 赤穂 +アカホ 赤保 +アカホ 赤穗 +アカホギ 赤保木 +アカホコ 赤鉾 +アカホシ 赤星 +アカボシ 赤星 +アカホダニ 赤穂谷 +アカホツ 赤穂津 +アカホナイ 赤保内 +アカボヤ 赤保谷 +アカホリ 赤堀 +アカホリ 赤掘 +アカボリ 赤堀 +アカマ 赤間 +アカマ 赤真 +アカマ 赤摩 +アカマ 赤磨 +アカマ 赤麿 +アカマ 赤眞 +アカマエ 赤前 +アカマタ 赤股 +アカマタ 赤俣 +アカマダ 赤間田 +アカマチ 赤町 +アカマツ 赤松 +アカマツ 赤枩 +アカマッカ 赤真下 +アカマル 赤丸 +アカミ 赤見 +アカミ 赤海 +アカミサカ 赤見坂 +アカミザカ 赤見坂 +アカミズ 赤水 +アカミチ 赤道 +アカミナイ 赤見内 +アカミネ 赤嶺 +アカミネ 赤峰 +アカミネ 赤峯 +アカミネ 阿賀嶺 +アカミネ 阿嘉嶺 +アカミネ 赤領 +アガミネ 阿賀嶺 +アカムネ 赤宗 +アカムラ 赤村 +アカメ 赤目 +アカメガワ 赤目川 +アカモ 赤毛 +アカモト 赤本 +アカモト 朱本 +アカモト 赤元 +アカモリ 赤森 +アカヤ 赤谷 +アガヤ 阿賀谷 +アカヤシキ 赤屋敷 +アカヤナ 赤梁 +アカヤマ 赤山 +アカヤマ 安河山 +アカヤマダ 赤山田 +アカラ 赤羅 +アカリ 明 +アカリ 明里 +アカリ 明利 +アカリ 赤利 +アカリ 赤理 +アカリ 亜厂(亞厂) +アカリ 亜雁 +アカリ 朱里 +アガリ 上里 +アガリ 上利 +アガリ 阿賀利 +アガリ 揚利 +アガリウエジョウ 東上門 +アガリエ 東江 +アガリオ 上尾 +アガリガジャ 東我謝 +アガリクチ 上り口 +アガリグチ 上り口 +アガリジョウ 東門 +アガリスジ 東筋 +アガリタ 揚田 +アガリタ 上里田 +アガリダ 上里田 +アガリト 上り戸 +アガリトウ 東当 +アガリトウ 東當 +アガリナカザト 東仲里 +アガリハマ 上り浜 +アガリヒガ 東比嘉 +アガリフカジョウ 東外門 +アガリマエジョウ 東前門 +アカリュウ 赤龍 +アカル 耀 +アガレ 阿我礼 +アガワ 阿川 +アガワ 阿河 +アガワ 吾川 +アガワ 吾河 +アカンダ 阿神田 +アカント 赤塔 +アキ 安芸 +アキ 明 +アキ 安岐 +アキ 秋 +アキ 安喜 +アキ 安城 +アキ 安藝 +アキ 阿木 +アキ 亜岐 +アキ 阿紀 +アキ 安戝 +アギ 阿木 +アキイ 秋井 +アキイ 穐井 +アキイ 龝井 +アキイケ 秋池 +アキイケ 穐池 +アキイケ 龝池 +アキイシ 秋石 +アキイズミ 秋泉 +アキウ 秋保 +アキウ 秋生 +アキウエ 秋上 +アキウチ 秋内 +アキウマ 秋馬 +アキウラ 秋浦 +アキエ 秋枝 +アキエ 秋江 +アキエダ 秋枝 +アキエダ 穐枝 +アキエダ 明枝 +アキエダ 龝枝 +アキオ 秋尾 +アギオ 腮尾 +アキオカ 秋岡 +アキオカ 穐岡 +アキオカ 明岳 +アキオカ 龝岡 +アキガシマ 秋ケ島 +アキカゼ 秋風 +アキカネ 明金 +アキガミ 秋上 +アキガミ 秋神 +アキカワ 秋川 +アキガワ 秋川 +アキギシ 秋岸 +アキクサ 秋草(秋艸) +アキグサ 秋草(秋艸) +アキグチ 秋口 +アキグチ 明口 +アキクニ 秋国 +アキクニ 秋國 +アキグニ 秋国 +アキグニ 秋國 +アキクボ 秋久保 +アキクボ 秋窪 +アキクラ 秋倉 +アキグリ 秋栗 +アキクワ 秋鍬 +アキコシ 秋腰 +アキサカ 明坂 +アキサカ 秋坂 +アキサキ 明嵜 +アキザキ 明崎 +アキザキ 秋崎 +アキザキ 商崎 +アキサコ 秋迫 +アキササ 秋笹 +アキザサ 秋笹 +アキサダ 秋定 +アキサダ 秋貞 +アキサト 秋里(穐里) +アキサト 秋郷 +アキザト 秋里(穐里) +アキサワ 秋沢 +アキサワ 秋澤 +アキサワ 明沢 +アキザワ 秋沢 +アキザワ 秋澤 +アキザワ 穐澤 +アキザワ 穐沢 +アキサン 秋三 +アギシ 阿岸 +アギシ 安岸 +アキシカ 秋鹿 +アキシカ 穐鹿 +アキシカ 龝鹿 +アキシゲ 秋重 +アキシゲ 秋繁 +アキシタ 秋下 +アキシノ 秋篠 +アキシバ 秋柴 +アキシマ 秋島 +アキシマ 秋嶋 +アキシモ 秋霜 +アキシロ 明代 +アキシロ 秋城 +アキス 秋洲 +アキズ 秋豆 +アキスエ 秋末 +アキズエ 明杖 +アキスギ 秋杉 +アキズミ 秋済 +アキズミ 秋角 +アキズミ 秋住 +アキズミ 秋炭 +アキズミ 秋濟 +アキセ 明瀬 +アキセ 秋瀬 +アキゾノ 秋園 +アキタ 秋田 +アキタ 明田 +アキタ 穐田 +アキタ 飽田 +アキタ 龝田 +アキタ 秌田 +アキタ 阿北 +アキタ 安芸田 +アキタカ 秋鷹 +アキタカ 秋高 +アキタガワ 明田川 +アキタケ 秋武 +アキタケ 秋竹 +アキタニ 秋谷 +アキタニ 明谷 +アキタヤ 秋田谷 +アキチ 秋知 +アキチカ 穐近 +アキチカ 秋近 +アキチカ 龝近 +アキツ 秋津 +アキツ 明津 +アキツ 龝津 +アキツ 穐津 +アキヅエ 明杖 +アキツカ 秋塚 +アキヅカ 秋塚 +アキヅカ 明塚 +アキツカゼ 秋津風 +アキツガワ 秋津川 +アキツキ 秋月 +アキツキ 穐月 +アキツギ 秋次 +アキヅキ 秋月 +アキヅキ 穐月 +アキヅキ 秋築 +アキヅキ 明月 +アキヅキ 着月 +アキヅキ 龝月 +アキツネ 秋常 +アキヅマ 明妻 +アキヅミ 秋積 +アキト 秋戸 +アキト 飽戸 +アキトウ 秋藤 +アキトウ 秋頭 +アキトシ 秋利(穐利) +アキトシ 秋年 +アキトシ 龝利 +アキトチ 秋栃 +アキトミ 秋富 +アキトミ 秋冨 +アキドミ 秋富 +アキドミ 秋冨 +アキトモ 秋友 +アキトモ 秋朝 +アキトモ 穐友 +アキトモ 安芸友 +アキナカ 秋中 +アキナガ 秋永 +アキナガ 秋長 +アキナガ 明永 +アキナガ 龝永 +アキナガ 穐永 +アキナガ 穐長 +アキナミ 秋南 +アキナリ 秋成 +アキニシ 穐西 +アキニワ 秋庭 +アキヌマ 明沼 +アキネ 秋根 +アキネ 秋子 +アキノ 秋野 +アキノ 秋濃 +アキノ 龝野 +アキノ 穐野 +アキノウ 秋濃 +アキノセ 秋野瀬 +アキノブ 秋信 +アキノモリ 秋野森 +アキハ 秋葉 +アキバ 秋葉 +アキバ 秋庭 +アキバ 秋場(穐場) +アキバ 穐葉 +アキバ 秋馬 +アキバ 龝葉 +アキバ 秋波 +アキバ 秌場 +アキバ 秋羽 +アキバ 穐庭 +アキバ 秋塲 +アキバ 龝場 +アキバ 龝庭 +アキハシ 秋橋 +アキハタ 秋畑 +アキハタ 秋幡 +アキハタ 明畠 +アキバナ 秋花 +アキハマ 秋浜 +アキハマ 秋濱 +アキバヤシ 秋林 +アキバヤシ 昭林 +アキハラ 秋原 +アキハラ 穐原 +アキハラ 明原 +アキハラ 朱原 +アキハラ 昭原 +アキハラ 龝原 +アキヒサ 秋久 +アキヒサ 穐久 +アキヒラ 明平 +アキヒラ 秋平 +アキヒロ 秋広 +アキヒロ 秋廣 +アキフサ 秋房 +アキフジ 秋藤 +アキベ 秋辺(秋邊) +アキベ 秋邉 +アキホ 秋保 +アキホ 秋穂(秋穗) +アキホ 穐保 +アキホ 秋甫 +アキボ 秋保 +アキボウ 明望 +アキマ 秋間 +アキマ 明間 +アキマ 秋馬 +アキマ 秋摩 +アキマ 龝間 +アキマ 穐間 +アキマエ 秋前 +アキマサ 秋政 +アキマス 秋桝 +アキマツ 秋松 +アキマル 秋丸 +アキマル 穐丸 +アキマル 明丸 +アキマル 龝丸 +アキミ 秋見 +アキミ 秋実 +アキミ 秋實 +アキミズ 秋水 +アキミチ 秋道 +アキミツ 秋光 +アキミツ 秋満(秋滿) +アキミナミ 秋南 +アキミネ 秋峯 +アキミネ 秋嶺 +アキミネ 秋峰 +アキムネ 秋宗 +アキムネ 穐宗 +アキムネ 龝宗 +アキムラ 秋村 +アキムラ 明村 +アキムラ 穐村 +アキムラ 龝村 +アキメ 秋目 +アキモト 秋元 +アキモト 秋本 +アキモト 穐本 +アキモト 龝本 +アキモト 穐元 +アキモト 明本 +アキモト 飽本 +アキモト 龝元 +アキモト 章本 +アキモト 昭元 +アキモト 秌元 +アキモト 昭本 +アキモリ 秋森 +アキモリ 秋守 +アキモリ 秋盛 +アキモリ 明護 +アキヤ 秋谷 +アキヤ 顕谷 +アキヤ 秋屋 +アキヤ 明谷 +アキヤ 秋家 +アキヤ 穐谷 +アキヤ 龝谷 +アキヤス 秋保 +アキヤス 秋安 +アキヤマ 秋山 +アキヤマ 穐山 +アキヤマ 龝山 +アキヤマ 明山 +アキヤマ 空山 +アキヤマ 楓山 +アキヤマ 昭山 +アキヤマ 暁山 +アキヤマ 顕山 +アキヤマ 商山 +アキヤマ 彬山 +アキヤマヤワタ 秋山八幡 +アキヨシ 秋吉 +アキヨシ 秋好 +アキヨシ 穐吉 +アキヨシ 明吉 +アキヨシ 龝吉 +アキヨシ 秋芳 +アキヨシ 秋由 +アキヨシ 龝好 +アキヨシ 穐好 +アキヨセ 秋寄 +アキラ 明 +アキラ 明楽 +アキラ 審 +アキラ 秋良 +アキラ 審良 +アキラ 秋楽 +アキラ 晶 +アキラ 亮 +アキラ 阿木良 +アキラ 晃 +アキラ 明樂 +アキラ 皛 +アキラカ 明力 +アキワ 秋和 +アキワ 秋輪 +アキワ 穐和 +アキワ 明輪 +アキワ 龝和 +アギワ 阿汀 +アキワキ 秋脇 +アキワギ 穐和木 +アク 阿久 +アグ 安久 +アクイ 阿久井 +アクイ 安久井 +アグイ 安居 +アグイ 安喰 +アグイ 阿久井 +アグイ 安居院 +アグイ 日外 +アグイ 安久井 +アグイン 安居院 +アクウラ 飽浦 +アグサ 阿草 +アクサワ 阿久沢 +アクサワ 阿久澤 +アクサワ 愛久澤 +アクザワ 阿久沢 +アクザワ 阿久澤 +アクザワ 安久沢 +アクザワ 愛久沢 +アクザワ 愛久澤 +アクザワ 悪澤 +アクザワ 安久澤 +アクザワ 悪沢 +アクシチ 悪七 +アクタ 芥 +アクタ 飽田 +アクタ 芥田 +アクタ 阿久田 +アクダ 阿久田 +アクタガワ 芥川 +アクタガワ 阿久刀川 +アクタガワ 芥河 +アクタジマ 芥島 +アクタニ 飽谷 +アクタヤ 芥屋 +アクタル 明果瑠 +アグチ 阿口 +アクツ 阿久津 +アクツ 圷 +アクツ 安久津 +アクツ 堆 +アクツ 飽津 +アクツ 安久都 +アクツ 明津 +アクツ 阿々津 +アクト 阿久戸 +アクト 肥土 +アクト 飽戸 +アクド 阿久戸 +アクド 飽戸 +アクド 悪戸 +アグニ 粟国 +アグニ 粟國 +アグニ 栗国 +アクネ 阿久根 +アクネ 安久祢 +アクネ 阿久禰 +アクネ 安久根 +アクネ 安久称 +アグネ 阿具根 +アグネ 莫根 +アクハラ 悪原 +アクハラ 阿久原 +アクハラ 亜宮原 +アクハラ 安久原 +アクマ 阿久間 +アクムシ 悪虫 +アクラ 安倉 +アクラ 阿倉 +アクラ 飽浦 +アグラ 安倉 +アグラ 阿倉 +アグリ 安栗 +アグル 騰 +アグロ 安黒 +アグロ 阿黒 +アクワ 阿桑 +アケ 明 +アケ 安家 +アケ 朱 +アゲ 揚 +アケイ 明井 +アケイ 明居 +アゲイ 上井 +アゲイ 揚井 +アケイシ 明石 +アゲイシ 上石 +アゲイシ 揚石 +アケイズミ 明泉 +アケイチ 明市 +アゲイデ 揚出 +アケイワ 明岩 +アゲイワ 揚岩 +アケウチ 明内 +アケウラ 明浦 +アケオ 明尾 +アケオ 旦尾 +アケオカ 明岡 +アケガミ 明神 +アケガミ 明上 +アケガミヤマ 明上山 +アケガラス 暁烏 +アケガワ 明河 +アケガワ 明川 +アケキ 明木 +アケキ 明喜 +アケギ 明木 +アゲキ 揚城 +アゲキ 揚木 +アゲキド 上城戸 +アケグチ 明口 +アゲグチ 揚口 +アゲクラ 上倉 +アゲクラ 揚倉 +アケコレ 明是 +アケザイ 明採 +アケサカ 明坂 +アケサカ 明阪 +アケザキ 明崎 +アケサダ 明定 +アケサワ 明沢 +アケサワ 明澤 +アケザワ 明沢 +アケザワ 明澤 +アゲサワ 揚沢 +アゲサワ 上沢 +アゲサワ 上澤 +アゲジ 上路 +アケシオ 明塩 +アゲシオ 揚塩 +アケシタ 明下 +アケシバ 明芝 +アケシバ 明柴 +アケシマ 明島 +アケシマ 朱島 +アケジマ 明島 +アケジマ 朱島 +アケシロ 明城 +アケシロ 明代 +アケシロ 朱城 +アケスエ 明末 +アケスギ 明杉 +アケズマ 明妻 +アケスミ 明角 +アケズミ 明角 +アケズミ 明隅 +アケズミ 明泉 +アケズミ 明澄 +アケセ 明瀬 +アケゾエ 明添 +アケゾノ 明園 +アケタ 明田 +アケタ 緋田 +アケタ 安慶田 +アケタ 朱田 +アケタ 𦁠田 +アケダ 明田 +アケダ 緋田 +アケダ 安慶田 +アケダ 阿慶田 +アゲタ 上田 +アゲタ 揚田 +アゲダ 安慶田 +アゲダ 阿慶田 +アケタガワ 明田川 +アケタキ 明滝 +アケタニ 明谷 +アケダニ 明谷 +アケチ 明智 +アケチ 明地 +アケチ 明知 +アケチ 赤智 +アケチ 明致 +アゲチ 上地 +アケツ 明津 +アケツ 明都 +アケツエ 明杖 +アケツキ 明月 +アケヅマ 明妻 +アゲツマ 上妻 +アゲツマ 揚妻 +アケト 明戸 +アケト 明渡 +アケト 明ケ戸 +アケド 明戸 +アケド 明渡 +アケド 明ケ戸 +アケド 明土 +アケド 明度 +アゲト 揚戸 +アゲド 上土 +アケドオリ 明通 +アケトリ 明採 +アケナ 安慶名 +アケナ 明名 +アゲナ 安慶名 +アケナガ 明永 +アゲナガ 揚永 +アケニ 明仁 +アケニワ 明庭 +アケヌキ 明貫 +アケヌマ 明沼 +アケノ 明野 +アケノ 朱野 +アゲノ 上野(上墅) +アゲノ 揚野 +アゲノ 挙野 +アゲノ 掲野 +アゲノソノ 上之園 +アケバ 明庭 +アケバ 明場 +アゲハ 揚葉 +アゲバ 上場 +アゲバ 揚場 +アケハシ 明橋 +アケハス 明蓮 +アケハタ 明畑 +アケハタ 明畠 +アケバヤシ 明林 +アケハラ 昌原 +アケハラ 朱原 +アゲハラ 揚原 +アゲハリ 揚張 +アケヒ 明比 +アケヒ 明日 +アケビ 明比 +アケビ 明日 +アケビヤマ 明日山 +アケヒラ 明平 +アケフジ 明富士 +アケフジ 明冨士 +アゲフジ 上藤 +アケベ 明部 +アケホ 明穂 +アケボ 明保 +アケホシ 明星 +アケボシ 明星 +アケボシ 暁星 +アケボノ 曙 +アケボノ 明保能 +アケマ 明間 +アケマエ 明前 +アケマサ 明政 +アケマツ 明松 +アゲマツ 上松 +アゲマツ 揚松 +アケマル 明丸 +アケミ 明見 +アゲミ 上見 +アゲミ 揚見 +アゲミズ 上水 +アケミチ 明道 +アケミツ 明光 +アケミネ 明峰 +アケミネ 明峯 +アケムラ 明村 +アケムラ 朱村 +アゲムラ 揚村 +アケモト 明本 +アケモト 明元 +アケモト 朱本 +アゲモト 上本 +アゲモト 揚本 +アケモリ 明森 +アゲモリ 上森 +アケヤ 明谷 +アゲヤ 上家 +アケヤブ 明藪 +アケヤマ 明山 +アケヤマ 朱山 +アゲヤマ 揚山 +アゲヤマ 上ケ山 +アケユキ 明雪 +アケヨシ 明吉 +アケヨシ 明慶 +アケラ 明楽 +アケラ 明樂 +アケリ 明里 +アコ 阿児 +アコ 阿古 +アコ 吾子 +アコ 阿子 +アゴ 安護 +アゴ 阿吾 +アコイ 阿古井 +アコウ 赤穂 +アコウ 赤広 +アコウ 阿光 +アコウ 赤廣 +アコウ 阿向 +アコウ 赤生 +アコウ 阿甲 +アコウ 安香 +アコウ 赤穗 +アゴウ 吾郷 +アゴウ 阿郷 +アゴウ 阿合 +アゴウ 安郷 +アコウダニ 赤穂谷 +アコウヅ 赤穂津 +アコエ 阿古江 +アコオ 安穂 +アコギ 阿漕 +アゴシ 鴉越 +アコシタ 阿古下 +アコシマ 阿子島 +アコジマ 阿子島 +アコジマ 阿子嶋 +アコジマ 安子島 +アゴタ 安護田 +アコネ 阿会根 +アコベ 赤染部 +アコメ 阿古目 +アコモ 阿小毛 +アサ 阿佐 +アサ 朝 +アサ 麻 +アサ 浅 +アサ 安佐 +アザ 呰 +アサアケ 朝明 +アサアラシ 朝嵐 +アサイ 浅井 +アサイ 朝井 +アサイ 浅生 +アサイ 浅居 +アサイ 麻井 +アサイ 淺井 +アサイ 朝居 +アサイ 旭井 +アサイ 朝位 +アサイ 阿佐伊 +アサイ 安佐伊 +アサイ 淺居 +アサイ 朝彝 +アザイ 阿在 +アザイ 字井 +アサイエ 朝家 +アサイケ 浅池 +アサイケ 朝池 +アサイシ 浅石(淺石) +アサイズミ 浅泉 +アサイダ 浅井田 +アサイチ 浅市 +アサイデ 朝井出 +アサイドリ 浅井取 +アサイナ 朝稲 +アサイナ 朝夷 +アサイナ 朝夷名 +アサイナ 朝い奈 +アサイネ 朝稲 +アサイワ 朝岩 +アサウ 朝生 +アサウ 浅生 +アサウ 朝鵜 +アザウイ 字羽井 +アサウエ 麻植 +アサウダ 浅生田 +アサウチ 浅内(淺内) +アサウチ 朝内 +アサウミ 浅海 +アサウミ 朝海 +アサウミ 淺海 +アサウラ 浅浦 +アサウラ 朝浦 +アサウラ 麻浦 +アサエ 浅江 +アサエ 朝栄 +アサエ 朝江 +アサエダ 朝枝 +アサエダ 浅枝 +アサエダ 淺枝 +アサエビス 朝夷 +アサエビス 朝胡 +アサエビス 浅胡 +アサオ 麻生 +アサオ 浅尾 +アサオ 朝生 +アサオ 浅生 +アサオ 浅黄 +アサオ 朝尾 +アサオ 麻尾 +アサオ 旦尾 +アサオ 浅雄 +アサオ 麻王 +アサオ 麻苧 +アサオ 阿佐尾 +アサオ 浅男 +アサオ 浅苧 +アサオ 朝雄 +アサオ 淺生 +アサオ 淺尾 +アサオ 淺雄 +アサオウ 浅黄 +アサオウ 麻黄 +アサオカ 浅岡 +アサオカ 朝岡 +アサオカ 麻岡 +アサオカ 淺岡 +アサオカ 旦丘 +アサオカ 朝丘 +アサオカ 麻丘 +アサオク 麻奥 +アサオク 浅奥 +アサオダ 麻生田 +アサオモ 浅面 +アサオモ 淺面 +アサカ 浅香 +アサカ 浅賀 +アサカ 安積 +アサカ 朝香 +アサカ 朝賀 +アサカ 安坂 +アサカ 阿坂 +アサカ 浅加 +アサカ 朝加 +アサカ 淺賀 +アサカ 阿阪 +アサカ 浅積 +アサカ 朝下 +アサカ 東日下 +アサカ 淺香 +アサガ 浅賀 +アサガ 朝賀 +アサガ 麻賀 +アサガ 淺賀 +アザカ 安坂 +アサカイ 浅海 +アサカイ 朝海 +アサカイ 浅貝(淺貝) +アサカイ 朝貝 +アサカイ 淺海 +アサガイ 浅海 +アサガイ 朝海 +アサガイ 浅貝(淺貝) +アサガイ 朝貝 +アサガイ 浅外 +アサガオ 朝顔 +アサガキ 朝垣 +アサガキ 浅垣 +アサカゲ 朝蔭 +アサカゲ 浅蔭 +アサカゲ 朝影 +アサカゲ 朝陰 +アサカゲ 朝景 +アサカゲ 朝䕃 +アサカズ 朝一 +アサカゼ 朝風 +アサカゼ 浅風 +アサガタ 浅形 +アサガタニ 浅ケ谷 +アサカホ 浅香保 +アサカミ 浅上 +アサカミ 麻上 +アサカミ 淺上 +アサガミ 浅上 +アサガミ 麻上 +アサガミ 淺上 +アザカミ 阿座上 +アザカミ 呰上 +アザカミ 阿坐上 +アザカミ 安座上 +アザガミ 阿座上 +アザガミ 呰上 +アザガミ 阿㘴上 +アサガヤチ 浅ケ谷内 +アサガラ 朝柄 +アサガラス 朝烏 +アサカワ 浅川 +アサカワ 朝川 +アサカワ 麻川 +アサカワ 淺川 +アサカワ 浅河 +アサカワ 朝河 +アサカワ 麻河 +アサガワ 浅川 +アサキ 浅木 +アサキ 朝木 +アサキ 麻木 +アサキ 朝来 +アサキ 麻喜 +アサキ 朝喜 +アサキ 淺木 +アサキ 朝黄 +アサギ 浅木 +アサギ 朝木 +アサギ 浅黄 +アサギ 麻木 +アサギ 浅儀 +アサギ 淺木 +アサギ 安舎木 +アザキ 阿崎 +アサキノ 朝来野(朝耒野) +アサキモリ 浅木森 +アサキモリ 淺木森 +アサギヤ 浅黄谷 +アサギリ 朝霧 +アサギリ 浅霧(淺霧) +アサギリ 朝桐 +アサギリ 浅桐(淺桐) +アサクサ 浅草 +アサクサ 朝草 +アサクサ 淺草 +アサグチ 浅口 +アサクニ 朝国 +アサクニ 朝國 +アサクノ 朝来野(朝耒野) +アサクノ 朝久野 +アサクノ 浅久野 +アサクノ 朝來野 +アサクノ 朝耒 +アサクボ 浅窪 +アサクボ 麻窪 +アサクマ 朝隈 +アサクマ 朝熊 +アサクマ 浅熊 +アサクマ 朝隅 +アサクミ 朝酌 +アサクモ 朝雲 +アサグモ 朝雲 +アサグモ 朝蜘 +アサクラ 朝倉 +アサクラ 浅倉 +アサクラ 麻倉 +アサクラ 淺倉 +アサクラ 浅蔵 +アサクラ 浅庫 +アサクラ 浅桜(淺桜) +アサクラ 浅櫻 +アサケ 朝明 +アサゲ 阿佐慶 +アサコ 浅子(淺子) +アサコ 浅古 +アサコ 朝子 +アサコ 浅胡 +アサコ 浅小 +アサコ 朝古 +アサゴ 浅子(淺子) +アサゴ 浅後 +アサゴウ 浅郷 +アサゴエ 浅越(淺越) +アサコシ 浅越(淺越) +アサコシ 朝越 +アサゴシ 浅越(淺越) +アサゴメ 浅米 +アササカ 浅坂 +アササカ 浅阪 +アサザカ 浅坂 +アサザカ 朝坂 +アサザキ 朝崎 +アサザキ 浅崎 +アサザキ 浅先 +アササコ 朝迫 +アササコ 浅迫 +アサザコ 朝迫 +アサザト 朝里 +アサザト 淺里 +アサザワ 浅沢 +アサザワ 浅澤 +アサザワ 朝沢 +アサザワ 朝澤 +アサザワ 麻沢(麻澤) +アサシ 浅師 +アサジ 浅地 +アサジ 浅治(淺治) +アサジ 麻地 +アサジ 朝治 +アサジ 朝地 +アサジ 浅路 +アサジ 朝侍 +アサジ 麻路 +アサジ 淺地 +アサシタ 浅下(淺下) +アサシタ 麻下 +アサシナ 浅品 +アサシバ 浅芝(淺芝) +アサシバ 朝芝 +アサシマ 浅島(淺島) +アサシマ 朝島 +アサシマ 麻島 +アサジマ 浅島(淺島) +アサジマ 朝島 +アサジマ 麻島 +アサジマ 浅嶋 +アサジマ 麻嶋 +アサジマ 浅嶌 +アサシロ 浅城 +アサシロ 朝代 +アサシロヤ 朝代谷 +アサシン 浅新 +アサス 浅須 +アサズ 浅津 +アサズ 浅図(浅圖・淺圖) +アサズマ 朝妻 +アサズミ 麻角 +アサセ 浅瀬 +アサセ 朝瀬 +アサセイシ 浅瀬石 +アサセヤマ 浅生山 +アサゾメ 浅染 +アサソラ 麻空 +アサタ 朝多 +アサダ 浅田 +アサダ 朝田 +アサダ 麻田 +アサダ 淺田 +アサダ 朝多 +アサダ 麻多 +アサダチ 朝立 +アサタニ 浅谷 +アサタニ 麻谷 +アサタニ 朝谷 +アサタニ 淺谷 +アサタニ 朝渓 +アサタニ 朝溪 +アサチ 浅地 +アサチ 朝地 +アサヂ 浅地 +アサツ 浅津 +アサツ 朝津 +アサツ 淺津 +アサヅ 浅津 +アサヅ 朝津 +アサヅ 淺津 +アサツイ 浅対 +アサツカ 朝塚 +アサツキ 朝月 +アサツキ 朝槻 +アサツキ 浅附 +アサツキ 浅付 +アサツキ 麻月 +アサヅキ 浅月 +アサヅキ 朝月 +アサツケ 朝付 +アサツケ 浅附 +アサツジ 朝辻 +アサツマ 朝妻 +アサツマ 浅妻(淺妻) +アサヅマ 朝妻 +アサヅマ 浅妻(淺妻) +アサヅマ 麻妻 +アサト 安里 +アサト 朝戸 +アサト 案里 +アサド 朝戸 +アザト 安里 +アサトウ 浅藤 +アサトビ 朝飛 +アサトミ 浅富 +アサトミ 浅冨 +アサトミ 朝富 +アサドメ 朝留 +アサトリ 朝鳥 +アサトリ 浅取 +アサナ 浅名 +アサナ 浅菜 +アサナ 朝奈 +アザナ 安座名 +アサナイ 浅内(淺内) +アサナエ 朝苗 +アサナオ 朝直 +アサナカ 麻中 +アサナカ 浅中(淺中) +アサナカ 朝中 +アサナガ 浅永 +アサナガ 浅長 +アサナギ 麻薙 +アサナギ 麻難 +アサナベ 朝鍋 +アサナミ 朝波 +アサナミ 浅並 +アサナミ 浅浪 +アサナミ 朝浪 +アサナリ 浅成 +アサナリ 浅鳴 +アサナリ 朝鳴 +アサナワ 浅縄 +アサニシ 朝西 +アサニシ 麻西 +アサニシ 浅西 +アサヌマ 浅沼 +アサヌマ 淺沼 +アサヌマ 朝沼 +アサヌマ 麻沼 +アサヌマ 浅湫(淺湫) +アサネ 朝根 +アザネ 阿実 +アザネ 阿實 +アサノ 浅野 +アサノ 朝野 +アサノ 麻野 +アサノ 淺野 +アサノ 浅埜(淺埜) +アサノ 苧野 +アサノ 麻埜 +アサノ 阿佐野 +アサノ 浅能 +アサノ 厚狭野 +アサノ 浅 +アサノ 朝埜 +アサノ 麻乃 +アサノイ 浅野井 +アサノイ 麻野井 +アサノウミ 浅海 +アサノウミ 浅野海 +アサノブ 朝信 +アサノベ 朝野辺 +アサノマ 浅野間 +アサノマ 麻野間 +アサノマ 淺野間 +アサノミ 浅海 +アサノミ 淺海 +アサノメ 浅野目 +アサノメ 浅ノ目 +アサノメ 浅の目 +アサハ 浅羽 +アサハ 浅葉(淺葉) +アサバ 浅羽 +アサバ 浅場(浅塲) +アサバ 浅葉(淺葉) +アサバ 麻場(麻塲) +アサバ 朝羽 +アサバ 朝場(朝塲) +アサバ 淺羽 +アサバ 浅波 +アサバ 淺場 +アサハシ 朝橋 +アサハシ 麻橋 +アサハタ 麻畠 +アサハタ 浅畑 +アサハタ 麻畑 +アサハタ 浅畠 +アサバタケ 麻畠 +アサハマ 朝浜 +アサバヤシ 浅林 +アサバヤシ 麻林 +アサバヤシ 旭林 +アサハラ 浅原 +アサハラ 朝原 +アサハラ 麻原 +アサハラ 淺原 +アサハラ 晨原 +アザハラ 字原 +アサヒ 朝日 +アサヒ 旭 +アサヒ 朝比 +アサヒ 朝飛 +アサヒ 朝陽 +アサヒ 浅日(淺日) +アサヒ 浅比 +アサヒ 浅樋 +アサヒ 阿佐比 +アサヒ 朝火 +アサヒ 旭日 +アサヒ 朝輝 +アサヒ 㬢(曦) +アサヒオカ 旭岡 +アサヒカジヤマ 旭梶山 +アサヒガタ 旭形 +アサヒカワ 旭川 +アサヒカワ 朝日川 +アサヒサ 朝久 +アサヒザワ 旭沢 +アサヒザワ 旭澤 +アサヒダ 旭田 +アサヒダ 朝日田 +アサヒタニ 旭谷 +アサヒダニ 旭谷 +アサヒデ 朝日出 +アサヒデ 朝秀 +アサヒトウ 朝日藤 +アサヒナ 朝比奈 +アサヒナ 朝日奈 +アサヒナ 朝日向 +アサヒナ 朝夷 +アサヒナ 浅雛(淺雛) +アサヒナ 朝日南 +アサヒナ 旭奈 +アサヒナ 朝雛 +アサヒナ 旭南 +アサヒノ 旭野 +アサヒノ 朝日野 +アサヒバラ 朝日原 +アサヒヤ 旭谷 +アサヒヤマ 旭山 +アサヒヤマ 朝日山 +アサヒラ 朝平 +アサヒラ 浅平 +アサヒロ 朝広 +アサヒロ 朝廣 +アサヒロ 浅弘 +アサヒロ 朝弘 +アサヒロ 浅広 +アサブ 麻布 +アザブ 麻布 +アサフカ 浅深 +アサブキ 朝吹 +アサブキ 麻吹 +アサフク 浅福 +アサフサ 浅房 +アサフジ 浅藤 +アサフジ 朝藤 +アサブシ 朝武士 +アサフネ 朝船 +アサベ 浅部 +アサベ 朝部 +アサベ 阿佐部 +アサベ 浅辺(浅邊・淺邊) +アサベ 朝辺 +アサベ 浅邉 +アサベ 麻部 +アサホ 浅保 +アサホ 朝穂 +アサホリ 浅堀 +アサホリ 朝堀 +アサホリ 淺堀 +アサボリ 浅堀 +アサマ 浅間 +アサマ 朝熊 +アサマ 朝間 +アサマ 淺間 +アサマ 浅磨 +アサマ 浅摩 +アサマ 朝馬 +アザマ 安座間 +アサマキ 浅巻 +アサマキ 麻蒔 +アサマス 朝増 +アサマチ 朝町 +アサマチ 麻町 +アサマツ 浅松(淺松) +アサマツ 朝松 +アサマル 朝丸 +アザマワリ 字廻 +アサミ 浅見 +アサミ 浅海 +アサミ 朝見 +アサミ 阿佐美 +アサミ 阿左美 +アサミ 阿佐見 +アサミ 阿左見 +アサミ 朝海 +アサミ 麻見 +アサミ 淺見 +アサミ 浅美(淺美) +アサミ 浅味 +アサミ 朝美 +アサミ 淺海 +アサミ 朝三 +アサミ 朝民 +アザミ 浅見 +アザミ 阿佐美 +アザミ 阿左美 +アザミ 莇 +アザミ 阿佐見 +アザミ 阿左見 +アザミ 薊 +アザミ 生明 +アザミ 淺見 +アザミ 芥生 +アザミ 字見 +アザミ 執見 +アサミガハラ 浅見河原 +アサミガワハラ 浅見河原 +アサミズ 浅水 +アサミズ 朝水 +アサミズ 淺水 +アサミズヤ 浅水屋 +アザミダ 莇田 +アサミチ 浅道 +アサミツ 朝光 +アサミドリ 朝緑 +アサミネ 麻峯 +アザミノ 阿座見野 +アザミノ 薊野 +アサミヤ 浅宮 +アサミヤ 朝宮 +アサムシ 浅虫 +アサムシ 朝武士 +アサムラ 浅村 +アサムラ 朝村 +アサムラ 麻村 +アサムラ 淺村 +アサメ 浅芽 +アサメン 浅面 +アサメン 淺面 +アサモト 浅本 +アサモト 朝本 +アサモト 麻本 +アサモト 朝元 +アサモト 浅元 +アサモト 麻元 +アサモト 淺本 +アサモリ 朝森 +アサモリ 浅森(淺森) +アサモリ 朝守 +アサモリ 麻森 +アサヤ 浅谷 +アサヤ 麻谷 +アサヤ 浅屋 +アサヤ 淺谷 +アサヤ 朝矢 +アサヤ 麻屋 +アサヤチ 麻谷内 +アサヤマ 浅山 +アサヤマ 朝山 +アサヤマ 麻山 +アサヤマ 旭山 +アサヤマ 淺山 +アサヨイ 朝酔 +アサラ 浅良 +アサラ 朝良 +アサラ 麻良 +アサライ 朝来 +アサライ 朝耒 +アサリ 浅利 +アサリ 浅里 +アサリ 漁 +アサリ 朝里 +アサリ 浅理 +アサリ 麻里 +アサリ 朝利 +アサリ 淺利 +アサリ 淺里 +アサワ 浅輪(淺輪) +アサワ 浅和 +アサワ 麻和 +アサワ 朝和 +アザワ 阿沢(阿澤) +アサワカ 浅若 +アサワカ 麻若 +アサワカ 朝若 +アサワキ 浅脇 +アサンオウ 阿讃横 +アサンボウ 阿讃坊 +アシ 芦 +アシ 葭 +アジ 安治 +アジ 阿字 +アジ 網師 +アジ 阿治 +アジ 阿路 +アジ 庵治 +アシアライ 足洗 +アシイ 芦井 +アシイ 足井 +アジイ 安字井 +アシイエ 足家 +アシウ 芦生 +アシウチ 芦内 +アシウラ 芦浦 +アシウラ 葦浦 +アシエ 足永 +アシエ 芦江 +アシオ 芦尾(蘆尾) +アシオ 足尾 +アシオ 芦生 +アジオ 阿字雄 +アシオイ 芦生 +アシオカ 芦岡 +アシオカ 足岡 +アシオカ 蘆岡 +アジオカ 味岡 +アジオカ 鯵岡 +アジオカ 鰺岡 +アジオカ 東父岡 +アシカ 足鹿 +アシカ 足駕 +アシカ 海鹿 +アシガ 阿志賀 +アシガ 芦賀 +アシガ 足賀 +アジカ 味香 +アジカ 安路賀 +アジカ 阿近 +アジカ 阿鹿 +アシカイ 芦界 +アシガイ 足海 +アシカガ 足利 +アシカガヤ 足利谷 +アシガキ 芦垣 +アシガキ 足垣 +アシガサワ 芦ケ沢 +アシガサワ 芦ケ澤 +アジカタ 味方 +アジカタ 阿地方 +アシカヤ 芦萱 +アシガヤ 芦萱 +アシガヤ 芦ケ谷 +アシガラ 足柄 +アシカリ 芦刈 +アシカリ 芦苅 +アシカリ 葦苅 +アシカリ 足苅 +アシカリ 芦ケ里 +アシカリ 葦刈 +アシカリ 足刈 +アシカリ 蘆刈 +アシカリ 蘆苅 +アシガリ 芦刈 +アシカワ 芦川 +アシカワ 足川 +アシカワ 蘆川 +アジカワ 阿路川 +アジカワ 安治川 +アジカワ 鯵川 +アジカワ 鰺川 +アジカワ 庵治川 +アジカワ 阿字川 +アジカワ 安地川 +アジカワ 味川 +アシキ 足木 +アシキ 阿式 +アシキ 芦木 +アジキ 安食 +アジキ 安喰 +アジキ 阿式 +アジキ 阿食 +アジキ 味木 +アジキ 阿喰 +アシキタ 芦北 +アシグチ 芦口 +アシグチ 足口 +アジグチ 味口 +アシクボ 芦久保 +アシクボ 足久保 +アシグロ 足黒 +アシコ 足古 +アシサカ 足坂 +アシサカ 芦阪 +アシザカ 芦阪 +アジサカ 鯵坂 +アジサカ 鰺坂 +アジサカ 味坂 +アシザキ 芦崎(蘆崎) +アシサコ 芦硲 +アシサコ 芦迫 +アシサダ 足定 +アシサワ 芦沢 +アシサワ 芦澤 +アシザワ 芦沢 +アシザワ 芦澤 +アシザワ 足沢 +アシザワ 足澤 +アシザワ 葦沢 +アシザワ 葦澤 +アシザワ 蘆澤 +アシザワ 葭沢 +アシザワ 蘆沢 +アシザワ 葭澤 +アジサワ 味沢 +アジサワ 味澤 +アジシ 味志 +アジシ 安宍 +アシシゲ 足重 +アジシタ 味舌 +アシシバ 足芝 +アシジマ 芦島 +アシズ 葦洲 +アシズ 芦津 +アシズカ 芦塚 +アシズミ 芦住(蘆住) +アシセ 芦瀬 +アシタ 芦田 +アシタ 阿下 +アシダ 芦田 +アシダ 葭田 +アシダ 足田 +アシダ 蘆田 +アシダ 葦田 +アシダ 脚田 +アジタ 味田 +アシダイ 足代 +アシタカ 芦高 +アシタカ 足高 +アシダカ 芦高 +アシダカ 足高 +アシタガワ 芦田川 +アシダガワ 芦田川 +アシタキ 足滝 +アシダチ 足立 +アシダチ 足達 +アシタテ 芦立 +アシタテ 蘆立 +アシダテ 足立 +アシダテ 芦立 +アシダテ 芦館 +アシダテ 蘆立 +アシダテ 芦舘 +アシダテ 足建 +アシタニ 芦谷 +アシタニ 足谷 +アシタニ 蘆谷 +アシタニ 葦谷 +アシダニ 芦谷 +アジタニ 味谷 +アジタニ 阿慈谷 +アシタニハラ 芦谷原 +アシタネ 葦胤 +アシダノ 葭田野 +アジチ 新地 +アジチ 阿字地 +アジチ 阿慈知 +アジチ 明父 +アジチ 味地 +アジチ 阿慈地 +アジチ 兄父 +アジチ 阿地知 +アジチ 亜地知 +アジチ 阿知地 +アジチ 安持地 +アジチ 安次知 +アジチ 按察 +アシツ 葦津 +アシヅ 葦津 +アシヅ 芦津 +アジツ 阿実 +アジツ 安日 +アジツ 阿實 +アシツカ 芦塚 +アシヅカ 芦塚 +アシヅカ 足塚 +アシヅカ 蘆塚 +アシヅカ 葦塚 +アシヅキ 芦月(蘆月) +アシド 芦戸 +アジト 味戸 +アシトミ 安次富 +アシトミ 阿次富 +アジトミ 安次富 +アジトミ 味冨 +アシナ 芦名 +アシナ 葦名 +アシナ 足名 +アシナ 蘆名 +アジナ 阿品 +アシナカ 芦中 +アシナガ 足永 +アシナガ 芦永 +アシナザワ 芦名沢 +アシナザワ 芦名澤 +アシヌマ 芦沼 +アシネ 芦根 +アシノ 芦野 +アシノ 芦埜 +アシノ 足野 +アシノ 葦埜 +アシノ 蘆野 +アシノ 葦野 +アジノ 味野 +アジノ 阿字野 +アジノ 網師野 +アジノ 鯵野 +アシバ 足羽 +アシバ 芦葉 +アシバ 芦馬 +アシバ 葦葉 +アシバヤシ 芦林 +アシハラ 芦原 +アシハラ 葦原 +アシハラ 足原 +アシハラ 蘆原 +アシバラ 芦原 +アジハラ 味原 +アシハラヤ 足原谷 +アシビ 足日 +アシヒラ 足平 +アシブ 芦部 +アジフ 味府 +アシフジ 足藤 +アシフジ 芦藤 +アシベ 芦辺(蘆邉) +アシベ 芦部 +アシベ 芦邊 +アシベ 芦邉 +アシベ 足部 +アジベ 阿地部 +アジベ 阿治部 +アジベ 阿冶部 +アシホ 足穂 +アシマ 芦間 +アシマ 芦馬 +アシマ 安志摩 +アシマ 葭間 +アジマ 安島 +アジマ 安嶋 +アジマ 阿島 +アジマ 阿嶋 +アジマ 味間 +アジマ 安嶌 +アジマイ 安栖 +アシミ 芦見 +アジミ 安心院 +アジミ 味水 +アジミ 味見 +アジミ 味美 +アジミズ 味水 +アシミネ 安次嶺 +アシミネ 芦峰 +アシミネ 芦峯 +アシミネ 安次峯 +アジミネ 安次嶺 +アジミネ 安次峰 +アジム 安心院 +アシムラ 芦村 +アシムラ 足村 +アシムラ 阿師村 +アシムラ 蘆村 +アジムラ 味村 +アシメン 足免 +アシモト 芦本 +アシモト 網師本 +アシモト 足本 +アシモト 葦本 +アジモト 鯵本 +アジモト 網師本 +アジモト 綱師本 +アシモリ 足森 +アシモリ 芦森 +アシモリ 足守 +アシヤ 芦谷 +アシヤ 葭谷 +アシヤ 芦屋 +アシヤ 芦矢 +アシヤ 芦家 +アシヤ 足家 +アシヤ 阿志谷 +アシヤ 蘆谷 +アシヤ 蘆屋 +アシヤ 蘆家 +アシヤハラ 芦谷原 +アシヤマ 芦山 +アシヤマ 足山 +アジヤマ 味山 +アジャリ 阿舎利 +アジャリ 阿砂利 +アジュウタ 阿重田 +アジュウダ 阿重田 +アシュリ 足集利 +アシヨシ 芦葭 +アジリ 安尻 +アジリ 阿尻 +アシロ 安代 +アジロ 網代 +アジロ 安城 +アジロ 安代 +アジロ 足代 +アジロ 綱代 +アジロ 足城 +アジロギ 網代木 +アシワ 足羽 +アシワ 芦和 +アシワ 足和 +アシワケ 芦分 +アシワタシ 芦渡 +アシワタリ 芦渡 +アシワラ 芦原 +アズ 安津 +アスイ 阿水 +アズイ 安随 +アズイ 安隨 +アズイ 阿随 +アズエ 安杖 +アスカ 足助 +アスカ 飛鳥 +アスカ 明日香 +アスカ 阿寿賀 +アスカ 阿須賀 +アスカ 安宿 +アスカ 阿壽賀 +アスカイ 飛鳥井 +アスカイ 飛鳥居 +アスカエ 飛鳥江 +アスカガワ 飛鳥川 +アスカタ 飛鳥田 +アスカタ 飛鳥方 +アスカベ 明壁 +アスカベ 安宿部 +アズカリ 預 +アズカリ 預り +アズカワ 東川 +アスガワラ 阿菅原 +アスキ 遊城 +アズキ 小豆 +アズキ 安槻 +アズキサワ 小豆沢 +アズキサワ 小豆澤 +アズキザワ 小豆沢 +アズキザワ 小豆澤 +アズキノ 小豆野 +アスケ 足助 +アスケ 安助 +アズサ 梓 +アズサノ 梓野 +アズサワ 小豆沢 +アズサワ 小豆澤 +アズサワ 梓沢 +アズサワ 梓澤 +アズシマ 小豆島 +アズシマ 小豆嶋 +アズセ 東瀬 +アスダ 阿子田 +アズタ 吾田 +アズタニ 東澗 +アズチ 安室 +アズチ 安槌 +アスナ 阿砂 +アスナ 阿須名 +アズノ 東野 +アズハタ 小豆畑 +アズハタ 預幡 +アスマ 遊馬 +アスマ 明間 +アスマ 飛鳥馬 +アスマ 阿須間 +アスマ 飛鳥間 +アズマ 東 +アズマ 我妻 +アズマ 吾妻 +アズマ 東間 +アズマ 阿萬 +アズマ 東馬 +アズマ 東都 +アズマ 東妻 +アズマ 阿妻 +アズマ 四阿 +アズマ 阿津間 +アズマ 東吾 +アズマ 阿都間 +アズマ 吾㛏 +アズマ 麻妻 +アズマイ 東井 +アズマイ 安栖 +アズマイシ 東石 +アズマウエジョウ 東上門 +アズマエ 東江 +アズマオ 東生 +アズマオカ 東岡 +アズマガイト 東垣外 +アズマカワ 東川 +アズマガワ 東川 +アズマギ 東木 +アズマグチ 東口 +アズマザキ 東崎 +アズマシ 東志 +アズマタ 東田 +アズマタ 阿津又 +アズマダ 東田 +アズマダイラ 東平 +アズマダテ 東舘 +アズマタニ 東谷 +アズマダニ 東谷 +アズマデ 東出 +アズマテイ 東亭 +アズマド 東戸 +アズマネ 東根 +アズマノ 東野 +アズマハラ 東原 +アズマヒガ 東比嘉 +アズマミ 東見 +アズマモト 東本 +アズマヤ 東谷 +アズマヤ 東屋 +アズマヤ 東宅 +アズマヤシキ 東屋敷 +アスミ 阿隅 +アスミ 明日見 +アズミ 東海 +アズミ 安積 +アズミ 安住 +アズミ 安見 +アズミ 安海 +アズミ 安栖 +アズミ 安曇 +アズミ 阿住 +アズミ 阿泉 +アズミ 阿墨 +アズミ 阿澄 +アズミ 吾住 +アズミ 安棲 +アズミ 阿積 +アズミ 阿曇 +アズミ 安厨味 +アスヤマ 明日山 +アスワ 阿諏訪 +アスワ 阿洲波 +アセ 安瀬 +アセ 阿瀬 +アセ 阿施 +アセ 阿陁 +アゼ 安瀬 +アゼ 阿瀬 +アゼ 畦 +アゼ 畔 +アセイ 阿瀬井 +アセイ 汗井 +アセイシ 浅瀬石 +アゼウエ 畔上 +アゼウチ 畦内 +アゼウラ 畦浦 +アゼオ 反尾 +アゼオカ 畔岡 +アゼオカ 畦岡 +アセガ 阿世賀 +アゼカ 簣 +アゼガタニ 畦ケ谷 +アゼカツ 畔勝 +アゼカミ 畔上 +アゼカミ 畦上 +アゼガミ 畔上 +アゼガミ 畦上 +アセガワ 阿瀬川 +アゼカワ 畔川 +アゼカワ 阿瀬川 +アゼカワ 畦川 +アゼガワ 畔川 +アゼガワ 阿瀬川 +アセキ 阿石 +アゼクラ 畦倉 +アゼクラ 畔倉 +アゼクラ 畦庫 +アゼクラ 疇倉 +アゼゴ 畦後 +アゼコシ 畦越 +アゼコシ 畔越 +アゼザキ 畦崎 +アゼザキ 畔崎 +アセダ 阿瀬田 +アセダ 涸田 +アゼタ 畔田 +アゼタ 畝田 +アゼタ 畦田 +アゼダ 畔田 +アゼタカ 畔高 +アゼタカ 畦高 +アゼタニ 畔谷 +アセチ 阿世知 +アセチ 阿瀬知 +アゼチ 畦地 +アゼチ 阿世知 +アゼチ 畔地 +アゼチ 疇地 +アゼチ 畴地 +アゼチ 畦池 +アゼチ 畝地 +アゼチ 安瀬地 +アゼチ 畦智 +アゼチ 按察 +アゼチ 畦知 +アゼチ 畤地 +アゼツ 畔津 +アゼツ 畦津 +アゼツ 疇津 +アゼツ 畴津 +アゼナカ 畝中 +アゼナカ 畦中 +アセヌマ 阿瀬沼 +アゼノ 畔野 +アゼノ 畦野 +アセハラ 安瀬原 +アゼハラ 畦原 +アゼハラ 畔原 +アセビ 馬酔木 +アセビ 阿世比 +アセビマル 阿世比丸 +アゼフ 畦布 +アゼブ 安詮院 +アセベ 阿瀬部 +アセベ 汗部 +アセボ 馬酔 +アセボ 阿世保 +アゼマ 畦間 +アゼマチ 畦町 +アセミ 阿瀬見 +アゼミ 畔見 +アゼミチ 畦道 +アゼミチ 畔道 +アゼムラ 畔村 +アゼモト 畝本 +アゼモト 畦元 +アゼモト 畔元 +アゼモト 畦本 +アゼモト 畔本 +アゼモリ 畦森 +アゼヤナギ 畔柳 +アゼヤナギ 畦柳 +アゼヤマ 畔山 +アゼリ 阿舎利 +アゼワキ 畔脇 +アソ 阿曽 +アソ 阿蘇 +アソ 浅生 +アソ 相蘇 +アソ 阿曾 +アソ 阿蘓 +アソ 安蘇 +アソ 安曽 +アソ 安蘓 +アソ 安曾 +アソ 阿征 +アソイ 遊井 +アソイ 阿曾井 +アソイ 阿曽井 +アゾイ 遊井 +アソウ 朝倉 +アソウ 麻生 +アソウ 阿曽 +アソウ 朝生 +アソウ 浅生 +アソウ 阿相 +アソウ 安増 +アソウ 安相 +アソウ 阿宗 +アソウ 阿曽宇 +アソウ 阿曽生 +アソウ 安双 +アソウ 安雙 +アゾウ 阿蔵 +アゾウ 莇生 +アゾウ 阿藏 +アソウジマ 麻生島 +アソウジマ 麻生嶋 +アソウダ 麻生田 +アソウダ 浅生田 +アソウダ 莇生田 +アソウダ 麻相田 +アソウヤマ 浅生山 +アソオ 麻生 +アソオ 阿曾尾 +アソオ 阿曽尾 +アソカワ 麻生川 +アソガワ 麻生川 +アソシナ 阿蘇品(阿蘓品) +アソシマ 麻生島 +アソシマ 麻生嶋 +アソジマ 麻生嶋 +アソダ 遊田 +アソダ 阿曽田 +アソダ 安曽田 +アソダ 莇生田 +アソダ 阿曾田 +アソダ 阿早田 +アソダ 阿蘇田 +アソダ 阿僧田 +アソタニ 阿蘇谷 +アソヅ 遊津 +アソヌマ 阿曽沼 +アソヌマ 阿曾沼 +アソネ 阿曽根 +アソノ 阿蘇野 +アソノ 阿曽野 +アソノ 安素野 +アゾノ 莇生野 +アゾノ 莇野 +アソバ 阿蘇波(阿蘓波) +アソバ 遊場 +アソベ 遊部 +アソマ 遊馬 +アソマ 遊間 +アソマ 間 +アソムラ 阿曾村 +アソムラ 阿曽村 +アソヤ 安蘇谷 +アソヤマ 浅生山 +アソヤマ 阿蘇山 +アソワ 阿蘇和 +アソン 阿孫 +アタ 阿多(阿夛) +アタ 阿田 +アダ 阿田 +アタアラシ 丁嵐 +アタイ 與 +アタイガワ 安宅川 +アタイシ 阿多石 +アタエ 与 +アタエ 與 +アタエ 阿多江 +アタエ 安多栄 +アタエヤマ 与山 +アタエヤマ 與山 +アタカ 安宅 +アタカ 安高 +アタカ 阿高 +アタカ 恰 +アタカ 阿鷹 +アダカ 安高 +アタカヤマ 安宅山 +アタガワ 阿田川 +アダガワ 阿田川 +アタキ 安宅 +アタギ 安宅 +アタギ 能木 +アタギ 阿田木 +アタギ 安宅木 +アタク 安宅 +アタク 阿宅 +アタグチ 阿多口 +アタケ 安宅 +アタケ 阿武 +アタケ 阿竹 +アダケ 安宅 +アタゴ 愛宕 +アタゴ 阿田子 +アタチ 足立 +アタチ 安達 +アダチ 足立 +アダチ 安達 +アダチ 足達 +アダチ 安立 +アダチ 阿達 +アダチ 芦立 +アダチ 安逹 +アダチ 阿立 +アダチ 明立 +アダチ 芦達 +アダチ 安舘 +アダチ 阿太地 +アダチ 阿逹 +アダチ 愛多地 +アダチ 安足 +アダチ 足逹 +アダチ 足昇 +アダチノ 足立野 +アダチハラ 足立原 +アダチハラ 安達原 +アダチバラ 足立原 +アダチバラ 安達原 +アタニ 阿谷 +アダニ 阿谷 +アタニヤ 安谷屋 +アタニヤ 安谷矢 +アダニヤ 安谷屋 +アダニヤ 安谷仁屋 +アタノ 阿多野 +アダノ 阿多野 +アタハラ 阿田原 +アタマ 阿玉 +アダマ 阿玉 +アタミ 熱海 +アタヤマ 温山 +アタラ 新 +アタラシ 新 +アタラシ 新子 +アタラシ 新枝 +アタラシ 新敷 +アタラシ 新志 +アタラシ 丁嵐 +アタラシキ 新木 +アタラシタニ 新子谷 +アタラシヤ 新屋 +アタラスミ 新住 +アタリ 中 +アタリ 当 +アタリ 當 +アタリ 阿多利 +アタリギ 當木 +アチ 阿地 +アチ 安地 +アチ 阿知 +アチ 阿智 +アチオク 東奥 +アチカタ 阿地方 +アヂキ 安食 +アチキタ 遠北 +アチキタ 阿智北 +アチダ 西風田 +アヂチ 明父 +アヂチ 兄父 +アヂチ 阿地知 +アヂチ 安父 +アチノ 阿知野 +アチハ 阿知波 +アチハ 阿知葉 +アチハ 阿知破 +アチバ 阿知波 +アチハラ 阿知原 +アチハラ 阿智原 +アチベ 阿地部 +アチャ 阿茶 +アチヤ 安千谷 +アチヤ 安チ谷 +アチヤ 安知谷 +アチラ 阿知良 +アチラ 阿知羅 +アチワ 阿知波 +アチワ 阿知和 +アチワ 阿知破 +アチワ 阿千輪 +アツ 厚 +アツ 阿津 +アヅ 阿津 +アヅ 安津 +アヅ 吾津 +アツアンヤ 渥晏谷 +アツイ 厚井 +アツイシ 厚石 +アツウミ 厚海 +アツウミ 渥海 +アツウラ 厚浦 +アヅエ 安杖 +アツオ 熱尾 +アッカ 安家 +アツガ 厚賀 +アヅカ 阿塚 +アツガセ 厚ケ瀬 +アツカタ 熱方 +アツカワ 厚川 +アツカワ 熱川 +アツカワ 阿津川 +アツカワ 渥川 +アツガワ 厚川 +アヅカワ 阿津川 +アツキ 厚木 +アツキ 厚喜 +アツキ 當木 +アツギ 厚木 +アヅキ 安槻 +アヅキ 阿月 +アヅキ 安月 +アヅキサワ 小豆沢 +アヅクリ 安作 +アツゲ 厚毛 +アツサ 厚狭 +アツサ 厚狹 +アヅサ 梓 +アツサカ 阿津坂 +アツサカ 厚坂 +アツサカ 敦坂 +アツザカ 阿津坂 +アツザカ 厚坂 +アツサダ 安津定 +アツサワ 厚沢 +アツサワ 阿津沢 +アツサワ 厚澤 +アツサワ 阿津澤 +アツザワ 厚沢 +アツザワ 阿津沢 +アツザワ 厚澤 +アツザワ 阿津澤 +アヅサワ 梓沢 +アヅサワ 梓澤 +アツシ 篤 +アツシ 厚志 +アツジ 厚地 +アツジ 阿閉 +アツジ 阿辻 +アツジ 厚治 +アツシバ 厚芝 +アッソ 且来 +アッソ 旦来 +アッタ 熱田 +アツタ 熱田 +アツタ 厚田 +アツタ 吾田 +アツタ 敦田 +アツタ 田 +アツタ 淳田 +アツダ 厚田 +アツダ 敦朶 +アヅタ 吾田 +アッチ 圧地 +アツチ 厚地 +アツチ 圧地 +アツヂ 厚地 +アツヂ 厚治 +アヅチ 安室 +アヅチ 安土 +アヅチ 阿津地 +アヅチ 足土 +アヅチ 阿土 +アツナガ 敦永 +アツノ 野 +アツハタ 安津畑 +アツハタ 厚畑 +アヅハタ 安津畑 +アツハラ 厚原 +アツハラ 渥原 +アッパリ 遖 +アツベツ 厚別 +アヅマ 東 +アヅマ 我妻 +アヅマ 吾妻 +アヅマ 東間 +アヅマ 東妻 +アヅマ 阿妻 +アヅマ 安妻 +アヅマ 阿津間 +アヅマ 東吾 +アヅマ 阿津磨 +アヅマ 安都間 +アヅマイ 東井 +アヅマオオジ 東大路 +アヅマダ 東田 +アヅマノ 東野 +アツマリ 集 +アツマル 集 +アツミ 渥美 +アツミ 熱海 +アツミ 厚見 +アツミ 安海 +アツミ 厚海 +アツミ 渥見 +アツミ 厚美 +アツミ 厚味 +アツミ 敦見 +アツミ 渥実 +アツミ 渥味 +アツミ 渥海 +アツミ 握美 +アツミ 渥實 +アツミ 安津見 +アツミ 温海 +アツミ 篤美 +アツミ 熱見 +アヅミ 安積 +アヅミ 安見 +アヅミ 安海 +アツムラ 厚村 +アツメ 厚目 +アツメダ 集田 +アツメヤマ 集山 +アツモ 厚母 +アツモリ 敦森 +アツモリ 厚森 +アツヤ 厚谷 +アツヤマ 淳山 +アツヤマ 厚山 +アツラク 厚楽 +アツラク 厚樂 +アツラゴ 誂子 +アツワタ 厚綿(厚緜) +アテ 阿手 +アデカワ 阿出川 +アデガワ 阿出川 +アデガワ 安出川 +アテキ 宛木 +アテギ 当木 +アテギ 當木 +アテサカ 宛坂 +アテジマ 当島 +アテジマ 当嶋 +アテヅカ 宛塚 +アテハラ 当原 +アテラ 阿寺 +アテンボウ 阿天坊 +アテンボウ 阿天防 +アト 阿戸 +アト 安戸 +アト 阿登 +アド 阿戸 +アド 網頭 +アド 阿度 +アトイケ 跡池 +アトイチ 跡市 +アトウ 安東 +アトウ 阿藤 +アトウ 安渡 +アトウ 網頭 +アトウ 阿刀 +アドウ 安藤 +アドウ 網頭 +アドウ 綱頭 +アドウ 阿童 +アトウダ 阿刀田 +アトオカ 後岡 +アトオカ 跡岡 +アトガキ 後垣 +アトガサワ 後ケ沢(後ケ澤) +アトガミ 後神 +アトガミ 跡上 +アトカワ 後川 +アトカワ 跡川 +アトグチ 後口 +アトクボ 後久保 +アトゴウチ 後河内 +アトサコ 後迫 +アトジ 阿閉 +アトジ 跡治 +アトジ 跡地 +アトジ 跡路 +アトジ 阿閇 +アトセ 跡瀬 +アトダ 後田 +アトダ 跡田 +アトダ 阿刀田 +アトダ 迹田 +アトチ 跡地 +アトナカ 後中 +アトナカスジ 後仲筋 +アトネ 後根 +アトノ 後野 +アトノ 跡野 +アトハマ 後浜 +アトハマ 後濱 +アトハラ 後原 +アトビキ 後引 +アトヒラ 後平 +アトフジ 跡藤 +アトフソコ 後冨底 +アトベ 跡部 +アトベ 跡辺 +アトベ 後辺 +アトベ 跡邊 +アトベ 跡邉 +アトミ 跡見 +アトミ 迹見 +アドミ 安富 +アトミヤ 後宮 +アトムラ 後村 +アトモリ 後守 +アトモリ 後盛 +アトモリ 跡守 +アトヤマ 後山 +アトロ 跡路 +アナ 阿奈 +アナ 阿那 +アナ 穴 +アナイ 穴井 +アナイ 孔井 +アナウシ 穴牛 +アナオ 穴生 +アナオ 穴尾 +アナオリ 穴織 +アナカ 阿中 +アナカゼ 穴風 +アナカマ 穴釜 +アナカマ 穴竃(穴竈) +アナガマ 穴釜 +アナガマ 穴竃(穴竈) +アナカワ 穴川 +アナガワ 穴川 +アナキザワ 穴木沢(穴木澤) +アナグチ 穴口 +アナクボ 穴久保 +アナクラ 穴倉 +アナクラ 穴蔵(穴藏) +アナサコ 穴迫 +アナサワ 穴沢 +アナサワ 穴澤 +アナザワ 穴沢 +アナザワ 穴澤 +アナシゲ 穴繁 +アナセ 穴瀬 +アナゼ 乾風 +アナタ 穴田 +アナタ 英 +アナタ 穴太 +アナダ 穴田 +アナダ 阿那田 +アナタニ 穴谷 +アナチ 穴地 +アナツコ 穴津子 +アナテ 穴手 +アナドリ 穴鳥 +アナバ 穴場 +アナハタ 穴畑 +アナハタ 穴畠 +アナバタ 穴畑 +アナハラ 穴原 +アナブ 穴生 +アナブキ 穴吹 +アナブシ 穴伏 +アナブチ 穴渕 +アナホ 穴穂 +アナボリ 穴堀 +アナミ 阿南 +アナミ 穴見 +アナミ 阿波 +アナミ 阿波連 +アナミ 安南 +アナミズ 穴水 +アナミツ 穴光 +アナムシ 穴虫 +アナムラ 穴村 +アナモト 穴本 +アナヤ 穴谷 +アナヤマ 穴山 +アナン 阿南 +アナン 穴南 +アニ 阿二 +アニ 阿仁 +アニイ 兄井 +アニウチ 兄内 +アニキ 兄木 +アニゴ 兄後 +アニヤ 安仁屋 +アニヤ 阿仁屋 +アニヤ 阿仁谷 +アニヤマ 兄山 +アネイシ 姉石 +アネガヤマ 姉ケ山 +アネカワ 姉川 +アネガワ 姉川 +アネコウジ 姉小路 +アネサキ 姉崎 +アネザキ 姉崎 +アネザキ 姉嵜 +アネタイ 姉帯 +アネタイ 姉帶 +アネハ 姉歯 +アネヤマ 姉山 +アネヨシ 姉吉 +アノ 阿野 +アノ 吾野 +アノウ 阿納 +アノウ 穴太 +アノウ 穴生 +アノウ 阿能 +アノウ 安能 +アノオ 阿野尾 +アノタ 阿野田 +アノダ 阿野田 +アノダ 安濃田 +アノダ 阿納田 +アノタニ 安野谷 +アノヤマ 阿野山 +アノリ 阿乗 +アノリ 阿乘 +アバ 阿波 +アバ 安波 +アバカ 阿葉家 +アハゴン 阿波根 +アバサキ 阿波崎 +アバサキ 阿波嵜 +アハタ 阿籏 +アバタケ 阿畠 +アハネ 阿波根 +アハマ 阿浜(阿濱) +アバミネ 阿波峰 +アハラ 阿原 +アハラ 亜原 +アバラ 阿原 +アバラ 湶 +アハレン 阿波連 +アビキ 安引 +アビキ 網引 +アビクラ 阿比倉 +アヒコ 安彦 +アヒコ 阿彦 +アビコ 安孫子 +アビコ 安彦 +アビコ 我孫子 +アビコ 阿彦 +アビコ 吾孫子 +アビコ 鮑子 +アビコ 阿美古 +アビコ 吾孫 +アビコ 阿比子 +アビコ 安我子 +アビコ 神孫子 +アビコ 孫子 +アビコバタ 吾孫子端 +アビノ 阿比野 +アビラ 吾平 +アビル 阿比留 +アビル 畔蒜 +アビル 阿蒜 +アビル 阿蛭 +アビル 安美留 +アビル 我蛭 +アビル 阿比畄 +アビル 亜比留 +アビル 畦蒜 +アビロ 安広 +アビロ 安廣 +アブ 阿武 +アブ 安封 +アブイ 油井 +アブエ 虻江 +アブカワ 虻川 +アブキ 阿吹 +アブキ 阿武木 +アブク 安福 +アブクマガワ 阿武隈川 +アブサキ 虻崎 +アフソ 安富祖 +アフソ 安冨祖 +アブタ 虻田 +アブタニ 油谷 +アブツカ 鐙塚 +アブノ 阿武野 +アブノ 鐙野 +アブミ 鐙 +アブミ 阿踏 +アブミカタ 鐙方 +アブミタ 鐙田 +アブミヤ 鐙谷 +アブミヤ 鐙屋 +アブミヤ 鐙家 +アブヤ 阿武屋 +アブヤマ 阿生山 +アブラ 油 +アブラ 阿武羅 +アブライ 油井 +アブライ 油居 +アブライシ 油石 +アブラオ 油尾 +アブラカタ 油片 +アブラカワ 油川 +アブラキ 油木 +アブラギ 油木 +アブラサキ 油崎 +アブラサキ 油嵜 +アブラザキ 油崎 +アブラジマ 油島 +アブラタ 油田 +アブラダ 油田 +アブラタニ 油谷 +アブラダニ 油谷 +アブラノ 油野 +アブラノコウジ 油小路 +アブラメ 油目 +アブラモト 油本 +アブラヤ 油谷 +アブラヤ 油屋 +アブラヤ 油家 +アブラヤ 油矢 +アブラヤマ 油山 +アベ 阿部 +アベ 安部 +アベ 安倍 +アベ 阿辺 +アベ 安陪 +アベ 阿閉 +アベ 阿倍 +アベ 安辺 +アベ 阿邊 +アベ 阿邉 +アベ 猜 +アベ 阿陪 +アベ 安邊 +アベ 安邉 +アベ 晁 +アベイ 安部井 +アベイ 阿部井 +アベガウト 猜ケ宇都 +アベカワ 安部川 +アベカワ 阿部川 +アベカワ 阿辺川 +アベカワ 安倍川 +アベキ 棈木 +アベクラ 阿部倉 +アベクラ 阿倍倉 +アベクラ 安部倉 +アベシマ 阿部島 +アベタ 阿部田 +アベタ 安部田 +アベツ 阿部津 +アベットウ 阿別当 +アベト 猜都 +アベナカ 安倍中 +アベノ 阿部野 +アベノ 安部野 +アベノ 阿倍野 +アベノ 猜野 +アベノ +アベマツ 棈松 +アベマツ 安倍松 +アベマツ 猜松 +アベマツ 安部松 +アベマツ 阿部松 +アベマツ 精松 +アベモト 猜本 +アベヤマ 阿辺山 +アベヤマ 阿部山 +アベヤマ 安部山 +アベヤマ 猜山 +アベヤマ 阿邊山 +アベヤマ 阿邉山 +アベラ 阿部羅 +アボ 安保 +アボ 阿保 +アボ 英保 +アボ 阿母 +アボウ 安保 +アボウ 阿保 +アボウ 安房 +アボシ 網干 +アボシ 阿星 +アボシ 安星 +アボシ 綱干 +アボタ 安房田 +アボタニ 阿保谷 +アマ 安間 +アマ 阿万 +アマ 阿萬 +アマ 天 +アマ 阿満(阿滿) +アマ 安満 +アマ 尼 +アマ 海士 +アマ 阿磨 +アマ 阿間 +アマ 阿真 +アマアキ 天晶 +アマイ 天井 +アマイ 甘井 +アマイケ 天池 +アマイケ 雨池 +アマイケ 甘池 +アマイザワ 天井沢 +アマイザワ 天井澤 +アマイシ 天石 +アマイズミ 甘泉 +アマイワ 天岩 +アマウ 天羽 +アマウ 天雨 +アマウチ 天内 +アマウチ 海内 +アマウチ 雨内 +アマウミ 雨海 +アマウリ 甘瓜 +アマエ 天江 +アマエ 天恵 +アマオ 天尾 +アマオ 雨尾 +アマオ 天生 +アマオウ 天王 +アマオウノ 天王野 +アマオカ 天岡 +アマオカ 尼岡 +アマオカ 甘岡 +アマオカ 天岳 +アマオク 雨奥 +アマカ 天可 +アマガ 天賀 +アマカイ 天海 +アマカイ 雨海 +アマガイ 天谷 +アマガイ 雨谷 +アマガイ 天海 +アマガイ 雨貝 +アマガイ 天貝 +アマガイ 雨海 +アマガイ 天下井 +アマガイ 雨甲斐 +アマガイ 天ケ谷 +アマガイ 雨ケ谷 +アマガイ 天下谷 +アマガク 尼額 +アマガサ 天笠 +アマガサ 雨笠 +アマガサキ 尼崎 +アマガサキ 尼ケ崎 +アマガサキ 雨ケ崎 +アマガシマ 天ケ島 +アマガシマ 天ケ嶋 +アマカス 甘粕 +アマカス 天春 +アマカス 甘糟 +アマカス 天粕 +アマガス 甘粕 +アマガス 天春 +アマガス 天粕 +アマガセ 天ケ瀬 +アマカタ 天方 +アマガタ 天方 +アマガタ 天形 +アマガタ 尼形 +アマカツ 天勝 +アマガツカ 尼ケ塚 +アマカド 天門 +アマガネ 天金 +アマカミ 天神 +アマガミ 天神 +アマガミ 天上 +アマガヤ 雨谷 +アマガヤ 天賀谷 +アマガヤ 天ケ谷 +アマガヤ 天下谷 +アマカワ 天川 +アマカワ 海川 +アマカワ 余川 +アマカワ 雨川 +アマカワ 天河 +アマカワ 尼川 +アマカワ 塰河 +アマカワ 阿間川 +アマカワ 甘川 +アマカワ 塰川 +アマガワ 天川 +アマカワヤ 天川谷 +アマキ 天木 +アマキ 天城 +アマキ 雨木 +アマキ 甘木 +アマキ 尼木 +アマキ 味木 +アマキ 天毎木 +アマキ 天気 +アマキ 天鬼 +アマキ 甘來 +アマギ 天木 +アマギ 天城 +アマギ 甘木 +アマギ 甘城 +アマギ 尼義 +アマギシ 天岸 +アマギシ 尼岸 +アマギシ 雨岸 +アマギリ 雨霧 +アマク 天久 +アマクキ 天岫 +アマクサ 天草 +アマクサ 天艸 +アマクサ 甘草 +アマクサ 甘艸 +アマグチ 天口 +アマグチ 尼口 +アマクニ 天国 +アマクニ 天國 +アマクボ 雨窪 +アマクボ 天久保 +アマクボ 雨久保 +アマクラ 天倉 +アマクラ 天蔵 +アマクラ 天藏 +アマクライ 天官 +アマコ 尼子 +アマコ 天児 +アマコ 尼児 +アマコ 阿間子 +アマコ 雨子 +アマコ 天小 +アマコ 天兒 +アマゴ 尼児 +アマゴイ 雨乞 +アマゴウ 雨郷 +アマゴオリ 雨郡 +アマゴシ 雨越 +アマサ 甘佐 +アマサ 甘サ +アマサカ 天坂 +アマサカ 雨坂 +アマサキ 尼崎 +アマサキ 天崎 +アマサキ 甘崎 +アマサキ 天嵜 +アマサキ 尼嵜 +アマザキ 尼崎 +アマザキ 天崎 +アマザキ 甘崎 +アマザキ 雨崎 +アマザキ 天嵜 +アマサコ 尼迫 +アマサト 天里 +アマザト 天里 +アマサワ 雨沢 +アマサワ 天沢 +アマサワ 天澤 +アマザワ 雨澤 +アマザワ 天沢 +アマザワ 天澤 +アマジ 天地 +アマジ 天路 +アマジキ 天喰 +アマシゲ 天重 +アマシタ 天下 +アマシタ 雨下 +アマシマ 尼嶋 +アマスガ 天清 +アマスギ 天杉 +アマズミ 天住 +アマズミ 普済 +アマセ 天瀬 +アマセ 雨瀬 +アマセ 阿万瀬(阿萬瀬) +アマセガワ 天瀬川 +アマセダ 天瀬田 +アマタ 天田 +アマタ 甘田 +アマタ 尼田 +アマタ 阿萬田 +アマタ 阿万田 +アマダ 天田 +アマダ 雨田 +アマダ 甘田 +アマダ 尼田 +アマダ 阿萬田 +アマダ 聒田 +アマダイラ 雨平 +アマタケ 天竹 +アマタケ 甘竹 +アマタツ 天辰 +アマタツ 天達 +アマダツ 天達 +アマダツ 天立 +アマダテ 天立 +アマタナイ 天田内 +アマタニ 天谷 +アマタニ 雨谷 +アマタニ 尼谷 +アマチ 天内 +アマチ 天地 +アマチ 天知 +アマチ 雨知 +アマチ 雨地 +アマチカ 天近 +アマチカ 天親 +アマチョウ 尼丁 +アマツ 天津 +アマツ 阿松 +アマツ 天都 +アマツカ 雨塚 +アマツカ 天塚 +アマヅカ 雨塚 +アマヅカ 尼塚 +アマツカワ 天津川 +アマツジ 天辻 +アマツジ 天堤 +アマツチ 天土 +アマツツ 天筒 +アマツツミ 雨堤 +アマツツミ 天堤 +アマヅツミ 雨堤 +アマヅツミ 雨包 +アマヅツミ 雨提 +アマツボ 雨坪 +アマツボ 天坪 +アマヅミ 雨積 +アマツユ 甘露 +アマツラ 甘蔗 +アマヅラ 雨面 +アマテ 天手 +アマデラ 尼寺 +アマデラ 天寺 +アマト 天戸 +アマト 天登 +アマド 天戸 +アマド 天満戸 +アマドマリ 塰泊 +アマドマリ 海士泊 +アマトミ 天富 +アマトミ 天冨 +アマドメ 尼留 +アマトワ 天唐和 +アマナイ 天内 +アマナカ 甘中 +アマナシ 雨無 +アマナメ 天生目 +アマヌマ 天沼 +アマヌマ 雨沼 +アマネ 天根 +アマネダ 舜太 +アマノ 天野 +アマノ 海野 +アマノ 尼野 +アマノ 雨野 +アマノ 天埜 +アマノ 天王 +アマノ 阿万野 +アマノ 甘野 +アマノ 海士野 +アマノ 阿萬野 +アマノ 天農 +アマノ 海部野 +アマノ 甘濃 +アマノイ 天野井 +アマノエ 天満戸 +アマノクラ 天野倉 +アマノメ 天生目 +アマノヤ 天宅 +アマハ 天羽 +アマバ 天羽 +アマハシ 天橋 +アマハタ 天畠 +アマハヤ 天早 +アマバヤシ 天林 +アマハラ 天原 +アマハラ 甘原 +アマハル 天春 +アマバル 天原 +アマビキ 天引 +アマヒサ 天久 +アマヒロ 天弘 +アマブキ 天吹 +アマフジ 天藤 +アマベ 海部 +アマベ 海士部 +アマベ 余部 +アマベ 天部 +アマベ 天辺 +アマベ 雨辺 +アマホリ 天堀 +アマホリ 天掘 +アママツ 雨松 +アマミ 天海 +アマミ 雨海 +アマミ 天見 +アマミ 阿間見 +アマミ 尼見 +アマミズ 天水 +アマミズ 雨水 +アマミズ 甘水 +アマミツ 天光 +アマミネ 天峰 +アマミヤ 雨宮 +アマミヤ 天宮 +アマミヤ 天明屋 +アマミヤ 海人宮 +アマミヤ 尼宮 +アマムラ 雨村 +アマムラ 天村 +アマムラ 甘村 +アマメ 天米 +アマメイシ 天目石 +アマモト 天本 +アマモト 尼本 +アマモト 尼元 +アマモト 海士元 +アマモト 甘本 +アマモリ 雨森 +アマモリ 天森 +アマモリ 天守 +アマモリ 天盛 +アマヤ 天谷 +アマヤ 雨谷 +アマヤ 雨夜 +アマヤ 天宅 +アマヤ 雨矢 +アマヤ 甘谷 +アマヤ 天家 +アマヤ 天矢 +アマヤケ 天宅 +アマヤス 天保 +アマヤス 天安 +アマヤチ 天谷地 +アマヤマ 天山 +アマリ 甘利 +アマリ 天利 +アマリ 余里 +アマリ 余利 +アマリメ 餘目 +アマルメ 餘目 +アマルメ 余目 +アマワ 天和 +アマワシ 天鷲 +アマン 阿万 +アマン 阿萬 +アマン 阿満 +アマンダ 阿万田 +アミ 安見 +アミ 網 +アミ 阿見 +アミ 阿美 +アミ 安味 +アミ 阿弥 +アミ 阿彌 +アミイ 網井 +アミイ 阿美井 +アミイエ 網家 +アミウチ 網内 +アミウチ 網打 +アミウラ 網浦 +アミエ 網江 +アミオ 網尾 +アミオカ 網岡 +アミオカ 阿美岡 +アミガサヤ 編笠屋 +アミガシラ 網頭 +アミカワ 網川 +アミキ 網木 +アミキ 編木 +アミギシ 網岸 +アミキリ 網切 +アミグチ 網口 +アミクラ 網倉 +アミクラ 網蔵(網藏) +アミクラ 綱倉 +アミサキ 網崎 +アミサキ 網嵜 +アミザキ 網崎 +アミサワ 網沢 +アミサワ 網澤 +アミザワ 網澤 +アミザワ 編沢 +アミザワ 編澤 +アミジ 網治 +アミジ 阿見寺 +アミシキ 網敷 +アミシゲ 網重 +アミシマ 網島 +アミシマ 網嶋 +アミジマ 網島 +アミシロ 網代 +アミシロ 網城 +アミタ 網田 +アミタ 編田 +アミダ 網田 +アミダ 綱田 +アミダ 編田 +アミダ 阿見田 +アミダイジ 網台地 +アミダイチ 網台地 +アミタニ 網谷 +アミタニ 阿美谷 +アミチ 網地 +アミツ 阿満 +アミツ 網津 +アミツカ 網塚 +アミヅカ 網塚 +アミヅカ 編塚 +アミデラ 阿見寺 +アミト 網戸 +アミトウ 網藤 +アミトウ 綱藤 +アミトウ 網籐 +アミナカ 網中 +アミナカ 網仲 +アミナガ 網永 +アミネ 網根 +アミノ 網野 +アミノ 綱野 +アミノ 阿比野 +アミノ 網埜 +アミハマ 網浜 +アミハマ 網濱 +アミバヤシ 網林 +アミハラ 篇原 +アミハラ 網原 +アミビキ 網引 +アミヒロ 網広 +アミヒロ 網廣 +アミフジ 網藤 +アミブチ 網渕 +アミホシ 網干 +アミムラ 網村 +アミモト 網本 +アミモト 綱本 +アミモト 網元 +アミモリ 網盛 +アミモリ 網守 +アミモリ 網森 +アミヤ 網谷 +アミヤ 網屋 +アミヤ 網矢 +アミヤ 阿宮 +アミヤ 網家 +アミヤ 罟谷 +アミヤ 阿見弥(阿見彌) +アム 阿武 +アムラ 阿村 +アムロ 安室 +アメ 飴 +アメアライ 雨洗 +アメイ 飴井 +アメイ 雨井 +アメイエ 飴家 +アメウミ 雨海 +アメガイ 雨貝 +アメガタ 𥹥形 +アメカワ 雨川 +アメカワ 雨河 +アメカワ 飴川 +アメガワ 雨川 +アメキ 飴木 +アメギ 雨木 +アメク 天久 +アメクラ 雨倉 +アメサカ 雨坂 +アメサラ 雨皿 +アメサワ 雨澤 +アメザワ 雨沢 +アメザワ 雨澤 +アメシ 雨師 +アメシタ 雨下 +アメシマ 飴島 +アメシマ 飴嶋 +アメジマ 雨島 +アメジマ 雨嶋 +アメゼン 飴善 +アメタ 雨田 +アメタ 飴田 +アメダ 雨田 +アメダ 飴田 +アメタキ 雨滝 +アメタキ 雨瀧 +アメタニ 雨谷 +アメタニ 飴谷 +アメツジ 雨辻 +アメツツミ 雨堤 +アメヅツミ 雨堤 +アメヅラ 雨面 +アメド 天戸 +アメナシ 雨無 +アメヌマ 雨沼 +アメヌマ 飴沼 +アメノ 天野 +アメノ 雨野 +アメノ 飴野 +アメノミヤ 雨宮 +アメノミヤ 雨ノ宮 +アメノミヤ 雨之宮 +アメノミヤ 雨野宮 +アメノモリ 雨森 +アメノモリ 雨ノ森 +アメマ 雨間 +アメマツ 雨松 +アメミヤ 雨宮 +アメムラ 雨村 +アメムラ 飴村 +アメモト 飴本 +アメモリ 雨森 +アメモリ 雨盛 +アメヤ 飴谷 +アメヤ 飴矢 +アメヤ 飴屋 +アメヤ 飴家 +アメヤス 雨安 +アメヤマ 雨山 +アメヤマ 飴山 +アメワキ 飴脇 +アモ 阿藻 +アモウ 天羽 +アモウ 天羽生 +アモウ 阿毛 +アモウ 阿望 +アモウ 天生 +アモオ 天羽生 +アモセ 阿茂瀬 +アモト 阿本 +アモリ 阿守 +アヤ 綾 +アヤ 安益 +アヤ 彩 +アヤ 斐 +アヤイ 綾井 +アヤウチ 安谷内 +アヤオ 綾尾 +アヤオリ 綾織 +アヤカ 綾香 +アヤガキ 綾垣 +アヤガミ 操神 +アヤカワ 綾川 +アヤキ 綾木 +アヤキ 綾城 +アヤキ 漢城 +アヤギ 綾木 +アヤギ 綾城 +アヤギ 文樹 +アヤグチ 綾口 +アヤコ 綾子 +アヤコウジ 綾小路 +アヤサカ 綾坂 +アヤザワ 綾澤 +アヤジ 綾地 +アヤジ 綾路 +アヤジキ 安屋敷 +アヤシマ 綾島 +アヤシロ 綾城 +アヤス 阿安 +アヤセ 綾瀬 +アヤゾノ 綾園 +アヤタ 綾田 +アヤダ 綾田 +アヤタニ 綾谷 +アヤタニ 阿矢谷 +アヤチ 綾地 +アヤツカ 綾塚 +アヤヅカ 綾塚 +アヤト 綾戸 +アヤト 綾藤 +アヤド 綾戸 +アヤトウ 綾塔 +アヤトウ 綾藤 +アヤトモ 綾具 +アヤニ 綾仁 +アヤニシ 綾西 +アヤノ 綾野 +アヤノコウジ 綾小路 +アヤノコウジ 綾乃小路 +アヤノサト 綾乃里 +アヤハ 綾羽 +アヤハラ 綾原 +アヤベ 綾部 +アヤベ 綾辺 +アヤベ 阿矢部 +アヤベ 綾邊 +アヤベ 綾邉 +アヤマ 阿山 +アヤマ 綾間 +アヤミ 綾見 +アヤミ 綾美 +アヤミ 漢見 +アヤムラ 綾村 +アヤメ 菖蒲 +アヤメ 綾目 +アヤメ 綾女 +アヤメ 菖浦 +アヤモト 綾本 +アヤモリ 綾森 +アヤヤ 綾屋 +アユカイ 鮎貝 +アユガイ 鮎貝 +アユガセ 鮎瀬 +アユガセ 鮎ケ瀬 +アユカワ 鮎川 +アユキョウ 鮎京 +アユサワ 鮎沢 +アユサワ 鮎澤 +アユザワ 鮎沢 +アユザワ 鮎澤 +アユセ 鮎瀬 +アユタ 鮎田 +アユダ 鮎田 +アユトビ 鮎飛 +アユハ 阿由葉 +アユバ 阿由葉 +アユハラ 鮎原 +アユミ 阿弓 +アユモト 鮎本 +アヨタ 阿代田 +アヨリ 阿寄 +アラ 新 +アラ 荒 +アラ 新良 +アラ 阿良 +アラ 阿羅 +アラ 安良 +アラ 安羅 +アラアキ 荒明 +アラアケ 荒明 +アライ 新井 +アライ 荒井 +アライ 新居 +アライ 荒居 +アライ 洗 +アライ 洗井 +アライ 流井 +アライ 阿良井 +アライ 新位 +アライ 荒維 +アライエ 新家 +アライエ 荒家 +アライカワ 洗川 +アライカワ 新井川 +アライガワ 洗川 +アライキリ 洗切 +アライケ 荒池 +アライシ 荒石 +アライシ 新石 +アライソ 荒磯 +アライソ 荒礒 +アライタ 新井田 +アライダ 新井田 +アライダ 荒井田 +アライダイ 洗平 +アライタニ 新井谷 +アライデ 荒井出 +アライデ 洗出 +アライバ 新井場 +アライハラ 新井原 +アライヤ 新井谷 +アライヤ 洗谷 +アライワ 荒岩 +アライワ 新岩 +アラウ 荒生 +アラウエ 荒上 +アラウチ 荒内 +アラウネ 荒畦 +アラウマ 荒馬 +アラウミ 荒海 +アラウメ 荒梅 +アラエ 新江 +アラエ 新栄 +アラエ 荒江 +アラエ 荒栄(荒榮) +アラエ 荒衛 +アラエ 新榮 +アラエダ 荒枝 +アラオ 荒尾 +アラオ 荒生 +アラオ 新生 +アラオ 新尾 +アラオイ 荒生 +アラオイ 新生 +アラオカ 新岡 +アラオカ 荒岡 +アラオカ 安良岡 +アラカ 荒嘉 +アラガ 荒賀 +アラカイ 荒貝 +アラカイ 荒開 +アラガイ 荒貝 +アラカキ 新垣 +アラカキ 荒垣 +アラカキ 新嘉喜 +アラガキ 新垣 +アラガキ 荒垣 +アラカゲ 荒蔭 +アラカジ 荒梶 +アラカツ 荒勝 +アラカド 荒角 +アラカネ 荒金 +アラカネ 荒兼 +アラカネ 新金 +アラガネ 荒金 +アラガネ 新金 +アラガネ 荒銀 +アラガネ 鉱(鑛) +アラカミ 荒上 +アラガミ 荒神 +アラガミ 荒上 +アラカメ 荒亀 +アラガメ 荒亀 +アラカヤ 荒茅 +アラカワ 荒川 +アラカワ 新川 +アラカワ 荒河 +アラカワ 洗川 +アラカワ 新河 +アラカワウチ 荒川内 +アラキ 荒木 +アラキ 新城 +アラキ 新木 +アラキ 有木 +アラキ 荒城 +アラキ 安良城 +アラキ 安楽城(安樂城) +アラキ 顕木 +アラキ 荒記 +アラキ 阿良木 +アラキ 荒起 +アラキ 荒良木 +アラキ 新樹 +アラキ 荒喜 +アラキ 荒紀 +アラキ 荒貴 +アラキ 荒鬼 +アラキ 嵐城 +アラキ 墾 +アラキジ 荒木地 +アラギシ 荒岸 +アラキセキ 荒木関 +アラキゼキ 荒木関 +アラキタ 荒木田 +アラキタ 荒北 +アラキダ 荒木田 +アラキダ 新木田 +アラキチ 荒木地 +アラキノ 荒木野 +アラギリ 荒切 +アラク 荒久 +アラグスク 新城 +アラクタ 荒久田 +アラクタ 新久田 +アラクダ 荒久田 +アラグチ 新口 +アラグチ 荒口 +アラクニ 荒邦 +アラクボ 荒久保 +アラクマ 荒熊 +アラクラ 新倉 +アラクラ 新蔵 +アラクラ 荒倉 +アラケ 新家 +アラケ 荒家 +アラケ 荒毛 +アラケダ 荒ケ田 +アラケダニ 荒毛谷 +アラコ 新子 +アラコ 荒古 +アラコ 荒子 +アラコマ 荒駒 +アラコモ 荒薦 +アラサカ 荒坂 +アラサキ 新崎 +アラサキ 荒崎 +アラサキ 新埼 +アラザキ 荒崎 +アラサシ 新指 +アラサト 荒里 +アラサワ 新沢 +アラサワ 荒沢 +アラサワ 新澤 +アラサワ 荒澤 +アラシ 荒 +アラシ 嵐 +アラシ 新志 +アラシ 荒清 +アラジ 荒治 +アラシカ 荒鹿 +アラシカワ 嵐川 +アラシガワ 嵐川 +アラシキ 新敷 +アラシキ 新鋪 +アラシグチ 嵐口 +アラシクラ 嵐倉 +アラシゲ 荒重 +アラシタ 新下 +アラシタ 荒下 +アラシダ 嵐田 +アラシタニ 嵐谷 +アラシタニ 新子谷 +アラシダニ 嵐谷 +アラシナ 荒品 +アラシナ 荒科 +アラシノ 嵐野 +アラシバ 荒芝 +アラシバ 荒柴 +アラシバ 新芝 +アラシバ 嵐柴 +アラシマ 新島 +アラシマ 荒島 +アラシマ 荒嶋 +アラシマ 安楽島 +アラシマ 安樂島 +アラシヤマ 嵐山 +アラシロ 新城 +アラシロ 安良城 +アラシン 荒新 +アラス 荒須 +アラスナ 荒砂 +アラスミ 荒角 +アラセ 荒瀬 +アラセ 新瀬 +アラセ 荒清 +アラセ 荒勢 +アラセキ 荒関(荒關) +アラセキ 新関 +アラゼキ 荒関(荒關) +アラゼキ 新関 +アラゼニ 荒銭 +アラセバラ 荒瀬原 +アラソエ 荒添 +アラゾエ 荒添 +アラソガ 荒曽我 +アラタ 新田 +アラタ 新 +アラタ 荒田 +アラタ 新タ(タはカタカナ) +アラタ 安良田 +アラタ 新多 +アラタ 阿良田 +アラタ 新夕(夕は漢字) +アラタ 阿羅田 +アラタガワ 荒田川 +アラタキ 荒滝 +アラタキ 荒瀧 +アラタク 荒宅 +アラタケ 荒武 +アラタケ 荒竹 +アラタケ 新竹 +アラタケ 荒嶽 +アラタケ 新嵩 +アラタケ 新武 +アラタケ 荒岳 +アラタダニ 荒田谷 +アラタチ 荒舘 +アラタチ 荒館 +アラダチ 荒舘 +アラダチ 荒館 +アラダテ 荒舘 +アラダテ 荒館 +アラタニ 新谷 +アラタニ 荒谷 +アラタニ 顕谷 +アラタノ 畬野 +アラタマ 新玉 +アラタマ 荒玉 +アラタマ 璞 +アラタメ 新目 +アラタメ 新田目 +アラタメ 新為 +アラチ 荒地 +アラツ 新津 +アラツ 荒津 +アラツカ 荒塚 +アラツカ 荒柄 +アラツカサ 荒司 +アラツダ 荒津田 +アラツナ 荒綱 +アラツナイ 荒津内 +アラツマエ 荒津前 +アラテ 荒手 +アラデ 新出 +アラト 新戸 +アラト 新渡 +アラト 荒戸 +アラト 荒砥 +アラド 新渡 +アラトウ 荒東 +アラトウ 荒藤 +アラトウ 荒当(荒當) +アラトコ 新床 +アラトノ 荒殿 +アラドノ 荒殿 +アラトビ 荒鳶 +アラトマイ 新斗米 +アラナイ 荒内 +アラナカ 荒中 +アラナガ 新長 +アラナガ 荒永 +アラナミ 荒浪 +アラナミ 荒波 +アラナミ 荒涛(荒濤) +アラニイ 荒二井 +アラニシ 荒西 +アラヌマ 荒沼 +アラノ 新野 +アラノ 荒野 +アラノ 荒納 +アラノ 荒埜 +アラノ 荒能 +アラノウ 荒納 +アラノウ 荒能 +アラノオ 新野尾 +アラノオ 荒野尾 +アラハ 新葉 +アラバ 荒場 +アラハシ 荒橋 +アラハタ 荒畑 +アラハタ 新畑 +アラハタ 荒幡 +アラハタ 新幡 +アラハタ 荒畠 +アラハナ 荒花 +アラハマ 荒浜 +アラハマ 荒濱 +アラバヤシ 新林 +アラハラ 荒原 +アラハリ 荒張 +アラハル 新治 +アラヒ 荒樋 +アラビキ 荒引 +アラヒサ 荒久 +アラヒラ 荒平 +アラフカ 荒深 +アラフジ 荒藤 +アラフネ 荒船 +アラフネ 新船 +アラフネ 新舟 +アラフネ 荒舩 +アラフネ 新舩 +アラフネ 荒舟 +アラフルエ 荒古江 +アラベヤ 荒部谷 +アラホ 新穂 +アラホリ 荒堀 +アラホリ 荒掘 +アラボリ 荒堀 +アラマ 荒間 +アラマエ 荒前 +アラマキ 荒巻 +アラマキ 荒牧 +アラマキ 荒蒔 +アラマキ 新巻 +アラマキ 新槙 +アラマキ 新牧 +アラマキ 荒槙 +アラマキ 荒槇 +アラマキ 新槇 +アラマキ 荒 +アラマキ 荒卷 +アラマサ 新正 +アラマス 荒益 +アラマタ 荒俣 +アラマタ 荒又 +アラマタ 荒股 +アラマチ 荒町 +アラマツ 荒松 +アラミ 新見 +アラミ 荒見 +アラミ 荒美 +アラミズ 荒水 +アラミチ 荒道 +アラミツ 荒光 +アラミヤ 新宮 +アラムシ 荒虫 +アラムラ 荒村 +アラメ 新目 +アラメ 荒目 +アラモト 新本 +アラモト 荒本 +アラモト 新元 +アラモト 荒元 +アラモノヤ 荒物屋 +アラモミ 新籾 +アラモミ 荒籾 +アラモリ 新森 +アラモリ 荒森 +アラヤ 新谷 +アラヤ 荒谷 +アラヤ 新家 +アラヤ 新屋 +アラヤ 荒野 +アラヤ 荒屋 +アラヤ 新矢 +アラヤ 荒家 +アラヤ 荒矢 +アラヤ 顕谷 +アラヤ 阿頼耶 +アラヤ 顯谷 +アラヤシキ 新屋敷 +アラヤシキ 荒屋敷 +アラヤシキ 荒屋鋪 +アラヤス 新安 +アラヤマ 新山 +アラヤマ 荒山 +アラヤマ 阿良山 +アラヤマツ 新谷松 +アララギ 蘭 +アララギ 櫟 +アラレイ 荒冷 +アラワカ 荒若 +アラワキ 荒脇 +アラワダ 荒和田 +アラワタリ 荒渡 +アリ 安里 +アリ 阿利 +アリ 有 +アリアケ 有明 +アリアケ 在明 +アリアラカワ 東新川 +アリイ 有井 +アリイ 有居 +アリイ 蟻井 +アリイエ 有家 +アリイシ 有石 +アリイズミ 有泉 +アリイソ 有磯 +アリイチ 有市 +アリイヤマ 有井山 +アリウ 蟻生 +アリウエ 有上 +アリウケ 有請 +アリウシ 有牛 +アリウチ 有内 +アリウネ 有采 +アリウネ 有釆 +アリウミ 有海 +アリウラ 有浦 +アリエ 有江 +アリエ 有衛 +アリエ 有得 +アリエ 有恵 +アリエ 在江 +アリエダ 有枝 +アリオ 有尾 +アリオオシマ 東大島 +アリオカ 有岡 +アリオカ 在岡 +アリオカ 蟻岡 +アリカ 有家 +アリカ 有可 +アリカ 有加 +アリガ 有賀 +アリガ 有我 +アリガ 在賀 +アリガ 有雅 +アリカイ 有海 +アリガイ 有貝 +アリガサキ 蟻ケ崎 +アリカタ 有方 +アリガタ 有形 +アリガタニ 有ケ谷 +アリカド 有門 +アリカド 有角 +アリカド 有簾 +アリカネ 有金 +アリカネ 有兼 +アリガネ 有金 +アリカベ 有壁 +アリガミ 有上 +アリガヤ 有谷 +アリガヤ 有ケ谷 +アリガヤ 蟻ケ谷 +アリカワ 有川 +アリカワ 蟻川 +アリカワ 在川 +アリカワ 有側 +アリキ 有木 +アリキ 在木 +アリキゾノ 有木園 +アリキタ 有北 +アリキヨ 有清 +アリクシ 有櫛 +アリクニ 有国 +アリクニ 有國 +アリクブラ 東久部良 +アリクマ 有熊 +アリクミ 有汲 +アリクラ 有倉 +アリケ 有家 +アリケイ 有計 +アリゴウ 有郷 +アリコバシカワ 東小橋川 +アリコハマ 東小浜 +アリサ 有佐 +アリザ 有座 +アリサカ 有坂 +アリサカ 有阪 +アリサカ 蟻坂 +アリサキ 有崎 +アリサキハラ 東崎原 +アリサコ 有迫 +アリサダ 有定 +アリサダ 有貞 +アリサダ 在定 +アリサト 有里 +アリサト 在里 +アリサワ 有沢 +アリサワ 有澤 +アリサワ 在沢 +アリサワ 蟻沢 +アリサワ 在澤 +アリザワ 有沢 +アリザワ 有澤 +アリシ 有志 +アリジ 有路 +アリジ 有地 +アリシカ 有鹿 +アリシゲ 有重 +アリシタ 有下 +アリシバ 蟻柴 +アリシバ 蟻芝 +アリシバ 有芝 +アリシマ 有島 +アリシマ 有嶋 +アリシロ 有城 +アリシロ 有代 +アリス 有巣 +アリス 有須 +アリス 有栖 +アリスイ 有寿夷 +アリスエ 有末 +アリスエ 蟻末 +アリスエ 有寿夷 +アリスエ 在末 +アリスエ 有未 +アリスガ 有菅 +アリスガワ 有須川 +アリスケ 有助 +アリスダ 有須田 +アリスミ 有住 +アリスミ 有隅 +アリスミ 有墨 +アリズミ 有泉 +アリズミ 有住 +アリズミ 有隅 +アリズミ 有墨 +アリズミ 有澄 +アリセ 有瀬 +アリセ 有生 +アリソ 有生 +アリソノ 有薗 +アリソノ 有園 +アリゾノ 有薗 +アリゾノ 有園 +アリタ 有田 +アリタ 在田 +アリタ 蟻田 +アリダ 有田 +アリタカ 有高 +アリタキ 有滝 +アリタキ 有瀧 +アリタケ 有竹 +アリタケ 在竹 +アリタニ 有谷 +アリタニ 有谿 +アリタニ 蟻谷 +アリタニ 蟻渓 +アリチ 有地 +アリチ 有乳 +アリヂ 有地 +アリチカ 有近 +アリチヤマ 有知山 +アリツ 有津 +アリヅ 有津 +アリツカ 有塚 +アリツカ 蟻塚 +アリツカ 在塚 +アリヅカ 有塚 +アリヅカ 蟻塚 +アリヅカ 在塚 +アリヅカ 垤 +アリツカサ 有司 +アリツキ 有月 +アリツギ 有次 +アリツク 有附 +アリツグ 有次 +アリツネ 有常 +アリツボ 有坪 +アリヅミ 有積 +アリテ 有手 +アリデ 有出 +アリト 有戸 +アリト 蟻戸 +アリトウ 有藤 +アリトウ 有東 +アリトウ 在藤 +アリドウ 有働 +アリドウ 蟻道 +アリドオシ 蟻通 +アリトキ 有時 +アリトク 有徳 +アリトク 有得 +アリトシ 有年 +アリトシ 有利 +アリトミ 有富 +アリトミ 有冨 +アリドミ 有富 +アリドミ 有冨 +アリトメ 有留 +アリドメ 有留 +アリトモ 有友 +アリトリ 蟻取 +アリナカ 在中 +アリナカ 有中 +アリナガ 有永 +アリナガ 有長 +アリナガ 在永 +アリナミ 有波 +アリナミ 蟻浪 +アリナミ 有南 +アリナミ 蟻波 +アリナミ 有浪 +アリニシ 有西 +アリヌキ 有貫 +アリヌマ 有沼 +アリネ 有根 +アリノ 有野 +アリノ 有埜 +アリノ 在野 +アリノキ 梨木 +アリノキ 有ノ木 +アリノブ 有延 +アリノブ 有信 +アリノベ 有延 +アリノリ 有乗 +アリノリ 在則 +アリバ 有場(有塲) +アリハシ 有橋 +アリハタ 有畑 +アリハナ 有鼻 +アリハマ 東浜 +アリハマ 東濱 +アリハマ 有浜 +アリバヤシ 有林 +アリハラ 在原 +アリハラ 有原 +アリハラ 蟻原 +アリヒサ 有久 +アリヒラ 有平 +アリヒロ 有広 +アリヒロ 有廣 +アリヒロ 有弘 +アリフク 有福 +アリフサ 有房 +アリフジ 有藤 +アリフジ 在藤 +アリベ 有辺 +アリベ 有部 +アリホリ 有堀 +アリマ 有馬 +アリマ 在間 +アリマ 有間 +アリマ 有満(有滿) +アリマ 蟻馬 +アリマ 有麻 +アリマイ 有米 +アリマサ 蟻正 +アリマサ 有政 +アリマサ 有正 +アリマス 有益 +アリマス 有桝 +アリマチ 有待 +アリマチ 在町 +アリマチ 有町 +アリマツ 有松 +アリマデン 有馬殿 +アリマヤマ 有馬山 +アリミ 有海 +アリミ 有見 +アリミズ 有水 +アリミチ 有路 +アリミチ 有道 +アリミツ 有光 +アリミツ 有満(有滿) +アリミナミ 有南 +アリムネ 有宗 +アリムラ 有村 +アリメ 有銘 +アリモチ 有持 +アリモト 有本 +アリモト 有元 +アリモト 在本 +アリモト 蟻本 +アリモリ 有森 +アリモリ 有盛 +アリヤ 有谷 +アリヤ 有矢 +アリヤ 有屋 +アリヤス 有安 +アリヤス 有保 +アリヤス 在安 +アリヤダ 有屋田 +アリヤマ 有山 +アリヤマ 在山 +アリュウ 安竜 +アリユキ 有行 +アリヨシ 有吉 +アリヨシ 有好 +アリヨシ 蟻義 +アリヨシ 有芳 +アリヨシ 有由 +アリワ 有輪 +アリワ 有和 +アリワカ 有若 +アリワカ 東若 +アルカ 有賀 +アルガ 有賀 +アルガ 有我 +アルキマチ 行町 +アルジ 有路 +アルジ 主 +アルセ 有瀬 +アルタキ 阿留多伎 +アルチ 有地 +アルドウ 有道 +アルミ 有美 +アルメ 有銘 +アレ 荒 +アレイ 阿礼 +アレチ 荒地 +アロウ 荒生 +アロウ 阿良 +アワ 阿波 +アワ 安房 +アワ 粟 +アワ 安和 +アワ 安発(安發) +アワ 淡 +アワ 阿輪 +アワイ 粟井 +アワイ 淡井 +アワイ 阿波井 +アワイ 淡居 +アワイ 安房井 +アワイイシマ 粟飯島 +アワイイジマ 粟飯島 +アワイシマ 粟飯島 +アワイハラ 粟飯原 +アワイバラ 粟飯原 +アワウ 粟生 +アワウダ 粟生田 +アワウチ 粟内 +アワエ 粟江 +アワエ 粟栄 +アワオ 粟生 +アワオ 粟尾 +アワオカ 粟岡 +アワカ 阿波加 +アワガ 粟賀 +アワガ 阿波賀 +アワカク 阿波角 +アワガクボ 粟ケ窪 +アワガミ 粟賀見 +アワガモリ 粟ケ森 +アワカワ 淡川 +アワカワ 粟河 +アワキ 粟木 +アワキ 禾几 +アワギ 粟木 +アワキハラ 粟木原 +アワグチ 淡口 +アワクニ 粟国 +アワクニ 粟國 +アワグニ 粟国 +アワグニ 粟國 +アワクボ 粟窪 +アワクラ 粟倉 +アワクラ 粟蔵(粟藏) +アワケ 阿分 +アワコ 粟子 +アワサ 淡佐 +アワサ 粟佐 +アワザ 粟座 +アワサカ 粟坂 +アワサキ 粟崎 +アワサキ 阿波崎 +アワザキ 粟崎 +アワサグチ 淡佐口 +アワサワ 粟沢 +アワサワ 粟澤 +アワザワ 粟沢 +アワザワ 粟澤 +アワジ 淡路 +アワジ 粟路 +アワジ 淡地 +アワジ 粟次 +アワジ 阿波治 +アワジカワ 淡路川 +アワシゲ 粟重 +アワシタ 粟下 +アワジタニ 淡路谷 +アワシマ 粟島 +アワシマ 淡島 +アワシマ 粟嶋(粟嶌) +アワシマ 淡嶋 +アワシマ 阿波島 +アワシマ 阿波嶋 +アワジマ 粟嶋(粟嶌) +アワジヤ 淡路谷 +アワジヤ 淡路屋 +アワズ 粟津 +アワズハラ 粟津原 +アワセ 粟生 +アワセ 粟瀬 +アワソ 阿波曾 +アワソ 阿波曽 +アワタ 粟田 +アワタ 淡田 +アワタ 阿波田 +アワタ 粟多 +アワタ 安房田 +アワタ 泡田 +アワダ 粟田 +アワダ 淡田 +アワダ 阿波田 +アワダ 粟多 +アワダ 安房田 +アワダ 泡田 +アワタグチ 粟田口 +アワタケ 粟竹 +アワダチ 淡立 +アワタニ 粟谷 +アワタニ 淡谷 +アワタニ 阿波谷 +アワタリ 阿渡 +アワチ 粟地 +アワツ 粟津 +アワヅ 粟津 +アワツカ 粟塚 +アワツジ 粟辻 +アワツハラ 粟津原 +アワヅハラ 粟津原 +アワヅヤ 粟津谷 +アワト 粟戸 +アワナカ 淡中 +アワナミ 淡浪 +アワネ 阿波根 +アワネ 粟根 +アワネ 粱根 +アワネ 梁根 +アワノ 粟野 +アワノ 阿波野 +アワノ 淡野 +アワノ 粟埜 +アワノウ 粟納 +アワノハラ 粟野原 +アワハタ 粟畑 +アワバヤシ 粟林 +アワハラ 粟原 +アワハラ 淡原 +アワビタニ 鮑谷 +アワビタニ 蚫谷 +アワブチ 泡渕 +アワブチ 淡渕 +アワブチ 泡淵 +アワベ 阿波部 +アワミネ 阿波峰 +アワミネ 阿波峯 +アワミヤ 粟宮 +アワムラ 粟村 +アワムラ 阿波村 +アワモト 粟本 +アワモト 粟元 +アワモリ 粟森 +アワモリ 粟盛 +アワヤ 粟屋 +アワヤ 粟谷 +アワヤ 淡谷 +アワヤ 阿波谷 +アワヤ 阿波屋 +アワヤ 粟家 +アワヤ 淡矢 +アワヤマ 粟山 +アワヤマ 稷山 +アワヨシ 淡吉 +アワラ 阿原 +アワラ 湶 +アワラグチ 泡原口 +アン 庵 +アンイ 安威 +アンエイ 安永 +アンエイ 安栄 +アンエイ 安榮 +アンオ 庵尾 +アンオク 庵奥 +アンカイ 安海 +アンガタ 安形 +アンキ 安気 +アンキュウ 安久 +アンキュウ 安休 +アングチ 庵口 +アンクツ 安久都 +アングリ 安栗 +アンケ 安家 +アンゲ 庵下 +アンケイ 安慶 +アンケイ 安渓 +アンコ 安戸 +アンコウ 安光 +アンコウ 安康 +アンザ 安雑 +アンサイ 安斎 +アンサイ 安斉 +アンサイ 安齋 +アンサイ 安齊 +アンサイ 安細 +アンサイ 安濟 +アンザイ 安斎 +アンザイ 安西 +アンザイ 安斉 +アンザイ 安齋 +アンザイ 安在 +アンザイ 安齊 +アンザイ 安済 +アンザイ 案西 +アンザイ 安細 +アンザイ 安財 +アンザイ 安才 +アンザイ 安洲 +アンザイ 安濟 +アンザイ 安薺 +アンザイ 安齎 +アンザイ 案済 +アンサカ 安坂 +アンサカ 安阪 +アンサカ 庵坂 +アンサカ 庵阪 +アンザキ 安崎 +アンザキ 庵崎 +アンザキ 安嵜 +アンザコ 庵逧 +アンザコ 庵迫 +アンザワ 安沢 +アンザワ 安澤 +アンシ 安司 +アンシ 案志 +アンジ 安司 +アンジ 安治 +アンジ 安地 +アンジキ 安食 +アンジキ 安喰 +アンシタ 庵下 +アンシツ 安室 +アンジツ 安実 +アンジツ 安實 +アンジマ 安島 +アンジマ 安嶋 +アンシャ 安社 +アンジュウ 安住 +アンジュウ 安重 +アンジョ 安助 +アンショウ 安荘 +アンジョウ 安生 +アンジョウ 安城 +アンジョウ 庵上 +アンジョウ 安定 +アンジョウ 安静 +アンズ 杏 +アンズ 安図 +アンズイ 安随 +アンズイ 安隨 +アンズエ 安杖 +アンセ 安瀬 +アンゼ 安瀬 +アンセイ 安生 +アンセイ 安精 +アンセキ 庵跡 +アンゼン 安前 +アンゼン 安善 +アンゼンジ 安全寺 +アンソ 安曽 +アンソ 安曾 +アンソウ 安相 +アンソウ 安荘 +アンゾウ 安蔵 +アンゾウ 莇生 +アンゾウ 安藏 +アンタ 按田 +アンタ 安多 +アンタ 桉田 +アンダ 安田 +アンダ 按田 +アンダ 安多 +アンダ 案田 +アンダ 菴田 +アンダ 庵田 +アンタイ 庵袋 +アンダイ 安大 +アンタク 安宅 +アンタチ 安立 +アンダチ 安達 +アンダチ 安立 +アンタツ 安達 +アンダツ 安達 +アンチ 庵地 +アンチ 安地 +アンチ 安知 +アンチ 案地 +アンヅ 安津 +アンヅエ 安杖 +アンツキ 安附 +アンヅキ 安附 +アンヅチ 安土 +アンデン 案田 +アント 安戸 +アンド 安土 +アンド 安戸 +アンド 安堵 +アンド 安渡 +アンド 庵戸 +アントウ 安藤 +アントウ 安東 +アンドウ 安藤 +アンドウ 安東 +アンドウ 安道 +アンドウ 安堂 +アンドウ 安任 +アンドウ 安籐 +アンドウ 庵藤 +アンドウ 案藤 +アンドウ 安登 +アントク 安徳 +アントコ 庵床 +アントコ 安床 +アンドジョウ 安堵城 +アンドシロ 安堵城 +アントリン 安渡林 +アンナカ 安中 +アンナカ 安仲 +アンナカ 杏中 +アンナン 安南 +アンニシ 杏西 +アンネ 安根 +アンネン 安念 +アンノ 安野 +アンノ 阿武 +アンノ 安濃 +アンノ 庵野 +アンノ 案野 +アンノイ 安ノ井 +アンノウ 安納 +アンノウ 案納 +アンノウ 安濃 +アンノウ 安能 +アンノウラ 案浦 +アンノキ 庵木 +アンノキ 庵軒 +アンノキ 菴木 +アンノシタ 安下 +アンノシタ 庵ノ下 +アンノシタ 庵之下 +アンノマエ 庵前 +アンノマエ 庵ノ前 +アンバイ 安倍 +アンバイ 塩梅 +アンバシ 安橋 +アンバタ 安畑 +アンピ 行比 +アンビル 安蒜 +アンビル 安昼 +アンビル 安蛭 +アンビル 安晝 +アンプク 安福 +アンブツ 安仏(安佛) +アンベ 安部 +アンベ 安倍 +アンベ 案部 +アンペイジ 安平次 +アンペイジ 安平治 +アンボ 安保 +アンポ 安保 +アンボウ 安房 +アンポウ 安宝 +アンマ 安間 +アンマ 案間 +アンマ 安馬 +アンマエ 庵前 +アンミ 安味 +アンメ 安梅 +アンメン 安面 +アンメン 案面 +アンモ 安茂 +アンモト 庵本 +アンモリ 庵森 +アンヤシキ 安屋敷 +アンヤシキ 庵屋敷 +アンヤチ 庵谷内 +アンヤマ 庵山 +アンヨウ 安養 +アンヨウシ 安養子 +アンヨウジ 安養寺 +アンヨウジ 安用寺 +アンラキ 安楽城(安樂城) +アンラク 安楽 +アンラク 安樂 +アンリ 安里 +アンリュウ 安立 +アンリュウ 安竜 +アンリュウ 安龍 +アンリョウ 安陵 +アンルイ 安類 +イ 井 +イ 猪 +イ 伊 +イアイ 居相 +イアイ 井合 +イアイ 居合 +イアサ 伊浅 +イアシ 猪足 +イアナ 井穴 +イアマ 猪甘 +イアミ 伊阿弥(伊阿彌) +イイ 伊井 +イイ 井伊 +イイ 井 +イイ 猪井 +イイ 飯井 +イイ 飯 +イイ 飯居 +イイ 井居 +イイ 居井 +イイアイ 飯合 +イイアマリ 飯余 +イイイ 飯井 +イイイシ 飯石 +イイイズミ 飯泉 +イイウチ 飯内 +イイウミ 飯海 +イイウラ 飯浦 +イイエ 井家 +イイエ 伊家 +イイオ 飯尾 +イイオカ 飯岡 +イイオモ 飯面 +イイガ 飯芽 +イイガ 飯賀 +イイカイ 飯貝 +イイガイ 飯貝 +イイガイ 飯飼 +イイガキ 飯垣 +イイガタニ 飯ケ谷 +イイガハマ 飯ケ浜 +イイガハマ 飯ケ濱 +イイガミ 飯上 +イイガヤ 飯ケ谷 +イイカワ 飯川 +イイカワ 飯河 +イイガワ 飯川 +イイキ 井城 +イイクサ 飯草 +イイグサ 飯草 +イイグチ 飯口 +イイクニ 飯国 +イイクニ 飯國 +イイグニ 飯国 +イイグニ 飯國 +イイクボ 飯窪 +イイクボ 飯久保 +イイクマ 飯隈 +イイグマ 飯隈 +イイクラ 飯倉 +イイグラ 飯倉 +イイケ 井池 +イイケ 伊池 +イイゴウ 飯郷 +イイゴウ 飯合 +イイサカ 飯坂 +イイサカ 飯阪 +イイサカ 仮坂 +イイザカ 飯坂 +イイザカ 仮坂 +イイサキ 飯崎 +イイザキ 飯崎 +イイサク 飯作 +イイサコ 飯迫 +イイザコ 飯迫 +イイササ 飯笹 +イイザサ 飯笹 +イイザサ 飯篠 +イイザト 飯里 +イイサワ 飯沢 +イイサワ 飯澤 +イイザワ 飯沢 +イイザワ 飯澤 +イイザワ 伊井沢 +イイザワ 伊井澤 +イイシ 居石 +イイシ 井石 +イイシ 飯石 +イイジ 飯地 +イイシノ 飯篠 +イイシバ 飯柴 +イイシマ 飯島 +イイシマ 飯嶋 +イイシマ 伊井島 +イイジマ 飯島 +イイジマ 飯嶋 +イイジマ 井島 +イイジマ 飯嶌 +イイジマ 伊井島 +イイジマ 井居島 +イイジマ 井居嶋 +イイジマ 飯㠀 +イイシロ 飯代 +イイシロ 飯白 +イイジロ 飯代 +イイジロ 飯白 +イイズ 飯棲 +イイズカ 飯塚 +イイスギ 飯杉 +イイスゲ 飯菅 +イイスミ 飯住 +イイズミ 飯泉 +イイズミ 飯住 +イイズミ 伊泉 +イイズミ 飯棲 +イイズミ 井泉 +イイソネ 飯曾根 +イイソネ 飯曽根 +イイゾノ 飯園 +イイタ 飯田 +イイタ 井板 +イイダ 飯田 +イイダ 伊井田 +イイダ 伊々田 +イイダ 井伊田 +イイダ 飯多 +イイタカ 飯高 +イイダカ 飯高 +イイタケ 飯竹 +イイタニ 飯谷 +イイダニ 飯谷 +イイダマル 飯田丸 +イイダワ 飯田和 +イイチ 飯地 +イイヂ 飯地 +イイツ 飯津 +イイツカ 飯塚 +イイツカ 飯束 +イイヅカ 飯塚 +イイヅカ 猪塚 +イイヅカ 飯束 +イイヅカ 井伊塚 +イイヅナ 飯綱 +イイヅマ 飯妻 +イイヅミ 伊泉 +イイヅミ 飯積 +イイヅメ 飯詰 +イイデ 飯出 +イイデラ 飯寺 +イイト 伊糸 +イイトイ 飯樋 +イイドイ 飯土井 +イイトウ 飯藤 +イイトウ 飯東 +イイドウ 飯堂 +イイトミ 飯富 +イイトミ 飯冨 +イイドミ 飯富 +イイトヨ 飯豊 +イイドヨ 飯土用 +イイナ 飯名 +イイナガ 飯永 +イイナガ 飯長 +イイナミ 飯波 +イイニシ 飯西 +イイヌマ 飯沼 +イイノ 飯野 +イイノ 飯尾 +イイノ 飯生 +イイノ 伊井野 +イイノ 伊井埜 +イイノ 飯能 +イイノウ 飯生 +イイノミ 飯呑 +イイノヤ 井伊谷 +イイノヤ 伊井谷 +イイノヤマ 飯野山 +イイバ 飯場 +イイバ 飯庭 +イイハシ 飯箸 +イイハシ 飯橋 +イイバシ 飯橋 +イイハタ 飯畑 +イイバタ 飯畑 +イイバタ 飯端 +イイバチ 飯鉢 +イイハマ 飯浜 +イイハマ 飯濱 +イイハラ 飯原 +イイヒラ 飯平 +イイヒロ 飯弘 +イイフク 飯福 +イイブシ 飯伏 +イイフタ 飯蓋 +イイブチ 飯渕 +イイブチ 飯淵 +イイフル 飯古 +イイブン 飯分 +イイベ 飯部 +イイボ 飯母 +イイホシ 飯干 +イイホシ 飯星 +イイホシ 飯法師 +イイボシ 飯干 +イイボシ 飯星 +イイマ 飯間 +イイミ 五十君 +イイミ 飯見 +イイミ 飯海 +イイミ 飯味 +イイミヤ 飯宮 +イイムカイ 飯向 +イイムラ 飯村 +イイムラ 井々村 +イイムレ 飯牟礼 +イイムレ 飯牟禮 +イイムロ 飯室 +イイムロ 飯榁 +イイメン 飯面 +イイモト 飯本 +イイモリ 飯森 +イイモリ 飯盛 +イイモリ 飯守 +イイヤ 飯谷 +イイヤ 井伊谷 +イイヤザキ 飯屋崎 +イイヤマ 飯山 +イイヨシ 飯吉 +イイヨリ 飯寄 +イイリ 飯利 +イイリ 井入 +イイワ 井岩 +イウエ 井上 +イウエ 井植 +イウエ 伊上 +イウチ 井内 +イウチ 居内 +イウチ 伊内 +イウメ 井梅 +イウラ 井浦 +イウラ 伊浦 +イウラ 井裏 +イエ 伊江 +イエ 家 +イエ 伊得 +イエ 井江 +イエ 井恵 +イエイ 家井 +イエイケ 家池 +イエイシ 家石 +イエイズミ 家泉 +イエイタ 家板 +イエイリ 家入 +イエウジ 家氏 +イエウジ 家宇治 +イエウマ 家馬 +イエウラ 家浦 +イエエ 家衛 +イエオカ 家岡 +イエオク 家奥 +イエガキ 家垣 +イエガミ 家上 +イエカメ 家亀 +イエカワ 家川 +イエキ 家城 +イエキ 家木 +イエキ 家喜 +イエキ 家生 +イエクシ 家串 +イエグシ 家串 +イエグチ 家口 +イエグマ 家熊 +イエクモ 家雲 +イエクラ 家倉 +イエコ 家子 +イエゴウ 家郷 +イエサカ 家坂 +イエサキ 家崎 +イエザキ 家崎 +イエサコ 家迫 +イエサト 家郷 +イエサト 家里 +イエザト 家里 +イエザワ 家沢 +イエザワ 家澤 +イエジ 家治 +イエジ 家路 +イエシキ 家敷 +イエシゲ 家重 +イエシタ 家下 +イエシマ 家島 +イエシマ 家嶋 +イエジマ 家島 +イエジマ 家嶋 +イエシロ 家城 +イエスミ 家住 +イエズミ 家泉 +イエズミ 家住 +イエセ 家瀬 +イエタ 家田 +イエダ 家田 +イエタカ 家高 +イエタケ 家竹 +イエタニ 家谷 +イエチ 家地 +イエチカ 家近 +イエチカ 家親 +イエツカ 家塚 +イエヅカ 家塚 +イエツグ 家次 +イエツグ 家接 +イエツネ 家常 +イエデ 家出 +イエトウ 家藤 +イエドコロ 家所 +イエトミ 家富 +イエトミ 家冨 +イエドミ 家富 +イエトメ 家留 +イエドメ 家留 +イエナカ 家中 +イエナカ 家仲 +イエナガ 家永 +イエナガ 家長 +イエニシ 家西 +イエネ 家根 +イエノ 家野 +イエノウエ 家ノ上 +イエノコ 家ノ子 +イエハタ 家畠 +イエハナ 家花 +イエバヤシ 家林 +イエハラ 家原 +イエハラ 宅原 +イエヒサ 家久 +イエヒラ 家平 +イエヒロ 家広 +イエヒロ 家廣 +イエフジ 家藤 +イエマエ 家前 +イエマサ 家政 +イエマタ 家亦 +イエマチ 家町 +イエミツ 家光 +イエミヤ 家宮 +イエムカイ 家向 +イエムラ 家村 +イエムラ 伊家村 +イエモト 家本 +イエモト 家元 +イエモリ 家守 +イエモリ 家森 +イエヤス 家保 +イエヤス 家安 +イエヤマ 家山 +イエヨシ 家吉 +イエワキ 家脇 +イオ 井尾 +イオ 猪尾 +イオ 井生 +イオ 伊尾 +イオ 伊生 +イオ 葊 +イオイ 井生 +イオイ 五百井 +イオイ 庵井 +イオイ 藺生 +イオウ 井生 +イオウ 井王 +イオウ 医王(醫王) +イオウ 硫黄 +イオウタ 医王田 +イオウダ 医王田 +イオウダ 醫王田 +イオウノ 伊王野 +イオオ 五百尾 +イオカ 井岡 +イオカ 猪岡 +イオカ 伊岡 +イオカ 亥岡 +イオカモリ 伊岡森 +イオカワ 五百川 +イオガワ 五百川 +イオキ 五百木 +イオキ 伊尾木 +イオキ 井置 +イオキ 伊尾喜 +イオキ 五百城 +イオキ 井沖 +イオギ 伊荻 +イオギ 五百扇 +イオキト 五百旗頭 +イオキベ 五百旗頭 +イオキベ 五百籏頭 +イオキベ 五百旗部 +イオク 井奥 +イオク 猪奥 +イオク 五百久 +イオク 伊奥 +イオクラ 五百蔵 +イオクラ 五百藏 +イオクラ 五百倉 +イオサキ 庵崎 +イオザキ 五百崎 +イオザワ 五百沢 +イオザワ 五百澤 +イオジ 五百路 +イオジマ 五百島 +イオジャク 五百雀 +イオズミ 五十棲 +イオズミ 五百住 +イオズミ 庵住 +イオズミ 飯尾住 +イオセ 井尾瀬 +イオセ 伊尾瀬 +イオタ 五百田 +イオタ 医王田 +イオダ 五百田 +イオタケ 五百竹 +イオタニ 庵谷 +イオチ 庵地 +イオチ 伊大知 +イオチ 井落 +イオチ 伊落 +イオチ 射落 +イオチ 伊尾知 +イオト 伊音 +イオド 庵戸 +イオノ 伊王野 +イオノ 一百野 +イオハラ 庵原 +イオハラ 菴原 +イオハラ 五百原 +イオベ 五百部 +イオモ 井面 +イオモリ 五百森 +イオヤ 伊保谷 +イオヤ 菴谷 +イオヤマ 五百山 +イオリ 庵 +イオリ 伊織 +イオリ 伊折 +イオリ 井居 +イオリ 井折 +イオリ 井織 +イオリ 葊 +イオリ 居織 +イオリザキ 庵崎 +イオリスギ 庵杉 +イオリタニ 庵谷 +イオリダニ 庵谷 +イオリハラ 廬原 +イオリヤ 庵谷 +イオロイ 五百蔵 +イオロイ 五百藏 +イカ 伊香 +イカ 井家 +イカ 伊加 +イカ 烏賊 +イカ 井加 +イガ 伊賀 +イガ 伊加 +イガ 井賀 +イガアラシ 五十嵐 +イカイ 猪飼 +イカイ 井貝 +イカイ 伊海 +イカイ 井開 +イカイ 五十井 +イカイ 伊貝 +イカイ 井海 +イカイ 飯海 +イカイ 伊介 +イカイ 井階 +イカイ 伊加井 +イカイ 伊飼 +イカイ 飯飼 +イカイ 井改 +イカイ 位飼 +イカイ 井介 +イガイ 猪飼 +イガイ 井貝 +イガイ 井開 +イガイ 五十井 +イガイ 伊貝 +イガイ 猪貝 +イガイ 伊賀井 +イガイ 亥飼 +イガイ 居賀井 +イカイダ 伊海田 +イカイダ 五十山田 +イカイダ 井海田 +イカイダ 五十井田 +イガウエ 伊賀上 +イカガ 伊香賀 +イガカミ 伊賀上 +イガガミ 伊賀上 +イカガワ 五十川 +イカガワ 伊賀川 +イカキ 伊柿 +イガキ 井垣 +イガキ 居垣 +イガキ 伊垣 +イガキ 猪垣 +イガキ 伊墻(伊牆) +イガキ 井賀木 +イガキ 井墉 +イカク 井角 +イカク 伊角 +イガク 井学(井學) +イカクラ 猪鹿倉 +イガクラ 猪鹿倉 +イガクラ 猪ケ倉 +イガクラ 伊鹿倉 +イガクラ 伊賀倉 +イガクラ 井ケ倉 +イカケ 井掛 +イカケ 伊掛 +イカケ 猪懸 +イガケ 井掛 +イカケヤマ 鋳山(鑄山) +イカゴ 五十子 +イカゴ 井籠 +イガサ 伊笠 +イカザキ 伊ケ崎 +イカザキ 伊賀崎 +イカザキ 五十崎 +イカザキ 伊ヵ崎 +イガサキ 伊ケ崎 +イガサキ 伊賀崎 +イガサキ 莍崎 +イガサワ 井河沢(井河澤) +イカシ 伊貸 +イガシ 伊貸 +イガシ 井樫 +イガシキ 伊賀敷 +イカシマ 五十嶋 +イカジマ 五十島 +イガシマ 五十島 +イガシラ 井頭 +イガシラ 猪頭 +イカシロ 碇代 +イカズチ 雷 +イガセ 伊賀瀬 +イガセ 井ケ瀬 +イカタ 井形 +イカタ 井方 +イカタ 伊形 +イカタ 伊方 +イカタ 井片 +イカタ 鋳方 +イカタ 鋳形 +イカタ 鑄方 +イカダ 筏 +イカダ 五十田 +イカダ 伊加田 +イカダ 井加田 +イガタ 井形 +イガタ 井方 +イガタ 伊形 +イガタ 伊方 +イガタ 井潟 +イガタ 伊賀田 +イガタ 猪方 +イガタ 鎔 +イガタ 井瀉 +イガタ 居潟 +イカタイ 一方井 +イカダイ 筏井 +イカダイ 五十代 +イカダツ 筏津 +イガダテ 五十立 +イカタニ 筏谷 +イカタニ 桴谷 +イガタニ 飯ケ谷 +イガタニ 伊ケ谷 +イガタニ 伊カ谷 +イガタニ 井ケ谷 +イカダマ 五十玉 +イカダヤ 筏谷 +イカツ 井勝 +イカツキ 猪鹿月 +イガッコ 五十子 +イカド 井門 +イカド 井角 +イガドウ 伊賀道 +イガナ 伊賀奈 +イガナミ 伊賀並 +イカノ 猪鹿野 +イカノ 居家野 +イガノ 伊賀野 +イカバ 筏場 +イカハタ 五十畑 +イカハタ 五十幡 +イカハタ 伊加畠 +イカバタ 五十畑 +イカバタ 五十幡 +イガハタ 五十幡 +イガハラ 伊賀原 +イガハラ 井河原 +イカベ 居壁 +イガボウ 伊賀棒 +イガマ 井釜(井釡) +イガマツ 伊賀松 +イカミ 伊神 +イカミ 井神 +イカミ 居上 +イカミ 居神 +イカミ 伊上 +イカミ 位上 +イガミ 井上 +イガミ 伊神 +イガミ 井神 +イガミ 居上 +イガミ 居神 +イガミ 伊上 +イガミ 位上 +イガミ 藺上 +イガミ 伊賀美 +イガミ 意加美 +イカメ 井亀 +イガメ 井亀 +イカモト 以ケ本 +イガモト 伊賀本 +イガヤ 猪谷 +イガヤ 伊ケ谷 +イガヤ 井萱 +イガヤ 伊賀屋 +イガヤ 伊賀谷 +イガヤマ 伊賀山 +イガラ 井柄 +イガラ 伊賀良 +イカラシ 五十嵐 +イガラシ 五十嵐 +イガラシ 井嵐 +イガラミ 五十実 +イガラミ 五十實 +イカリ 猪狩 +イカリ 碇 +イカリ 五十里 +イカリ 井狩 +イカリ 井苅 +イカリ 錠 +イカリ 伊狩 +イカリ 錨 +イカリ 猪刈 +イカリ 井刈 +イカリ 伊加利 +イカリ 伊苅 +イカリ 伊賀利 +イカリ 怒 +イガリ 猪狩 +イガリ 五十里 +イガリ 井狩 +イガリ 井苅 +イガリ 伊狩 +イガリ 猪苅 +イガリ 猪刈 +イガリ 伊賀利 +イガリ 猪猟 +イカリイ 碇井 +イカリイシ 碇石 +イカリガ 碇賀 +イカリガネ 碇金 +イカリカワ 碇川 +イカリガワ 碇川 +イカリコ 碇子 +イカリダ 碇田 +イカリタケ 碇武 +イカリタニ 碇谷 +イカリナガ 碇永 +イカリノ 碇野 +イカリモト 碇本 +イカリモト 碇元 +イカリモト 鐙本 +イカリヤ 碇谷 +イカリヤ 碇屋 +イカリヤ 五十里屋 +イカリヤ 碇矢 +イカリヤ 怒谷 +イカリヤマ 碇山 +イカルガ 鵤 +イカルガ 斑鳩 +イカルギ 五十木 +イカルギ 怒木 +イカルギ 鵤木 +イカルギ 嗔木 +イカワ 井川 +イカワ 衣川 +イカワ 伊川 +イカワ 猪川 +イカワ 居川 +イカワ 移川 +イカワ 井河 +イカワ 渭川 +イカワ 伊香輪 +イガワ 井川 +イガワ 衣川 +イガワ 五十川 +イガワ 伊川 +イガワ 飯川 +イガワ 猪川 +イガワ 居川 +イガワ 井河 +イガワ 亥川 +イガワ 位川 +イガワ 井側 +イガワカミ 井川上 +イガワハラ 井川原 +イガワラ 井河原 +イカン 井勘 +イカン 猪甘 +イキ 壱岐 +イキ 伊木 +イキ 井木 +イキ 壹岐 +イキ 生亀 +イキ 井城 +イキ 生 +イキ 位寄 +イキ 居木 +イキ 檍 +イキ 夷亀 +イキ 息 +イキ 伊喜 +イキ 猪城 +イキ 伊岐 +イキ 伊記 +イキ 伊祁 +イキ 依期 +イキ 壱枝 +イギ 猪木 +イギ 伊木 +イギ 井木 +イギ 伊儀 +イギ 井義 +イギ 猪儀 +イキイ 居木井 +イキウオ 生魚 +イキウチ 生内 +イキウラ 生浦 +イキオ 生魚 +イキオ 壱岐尾(壹岐尾) +イキオイ 勢 +イキガイ 生貝 +イキガキ 生垣 +イキガミ 生神 +イキカメ 生亀 +イキガメ 生亀 +イギキ 居聞 +イキグチ 生口 +イキクラ 生蔵 +イキコシ 生越 +イキサイ 息才 +イキザクラ 生桜 +イキザクラ 生櫻 +イキザケ 生酒 +イキザネ 生実 +イキサワ 生沢 +イキサワ 生澤 +イキザワ 生沢 +イキザワ 生澤 +イキザワ 井木沢 +イキザワ 井木澤 +イキジ 生地 +イギシ 井岸 +イキシバ 生芝 +イキシマ 生島 +イキシマ 生嶋 +イキシマ 壱岐島 +イキシマ 壹岐島 +イキス 伊規須 +イキス 生須 +イキス 息栖 +イギス 伊規須 +イギス 五十洲 +イギス 五十州 +イキズミ 生住 +イキタ 生田 +イキタ 伊木田 +イキタ 域田 +イキタ 息田 +イキダ 生田 +イギタ 異儀田 +イキタケ 生武 +イキタケ 生竹 +イキタニ 生谷 +イキツ 生津 +イキツカ 生塚 +イキヅカ 生塚 +イキツキ 生月 +イキツキ 生属 +イキド 井木戸 +イキトウ 生藤 +イキトキ 生時 +イキトモ 徃友 +イキナ 生名 +イキナカ 生中 +イキナガ 生長 +イキナガ 生永 +イキナリ 生成 +イキヌキ 生抜 +イキノ 生野 +イキノブ 生信 +イキノヤ 生ノ谷 +イキハシ 生橋 +イキハラ 生原 +イキハラ 伊木原 +イキブ 生部 +イキフジ 生藤 +イキフネ 生船 +イキホ 生穂 +イキマツ 生松 +イキミ 生見 +イキミ 伊岐見 +イキミ 伊喜見 +イキミ 伊君 +イキミ 伊木美 +イギミ 五十君 +イギミ 伊岐見 +イキミネ 生峰 +イキミネ 生峯 +イキムネ 生宗 +イキムネ 生旨 +イキムラ 生村 +イキムラ 壱岐村 +イキメ 生目 +イキモト 生本 +イキモト 壱岐本 +イキモト 徃本 +イキモリ 生盛 +イキモリ 生森 +イキモリ 生守 +イキヤマ 生山 +イキヤマ 活山 +イキュウ 為久 +イキュウ 爲久 +イキリ 伊喜利 +イギリ 猪切 +イク 郁 +イク 幾 +イクアイ 幾合 +イクイ 生井 +イクイ 幾井 +イクイ 以久井 +イクイザワ 生井澤 +イクイシ 生石 +イクイシ 幾石 +イクイナ 生稲 +イクイネ 生稲 +イクウチ 生内 +イクウラ 生浦 +イクウラ 幾浦 +イクエ 生江 +イクオ 生尾 +イクオ 幾尾 +イクオカ 生岡 +イクオカ 幾岡 +イクオサ 生長 +イクガキ 生垣 +イクカタ 生方 +イクガタ 生形 +イクカワ 生川 +イクカワ 幾川 +イクガワ 生川 +イクガワ 幾川 +イクキ 生木 +イクコシ 生越 +イクコマ 生駒 +イグサ 井草 +イグサ 伊草 +イグサ 藺草 +イグサ 井艸 +イグサ 荏草 +イグサ 生艸 +イグサ 生草 +イグサ 蘭草 +イクサカ 生坂 +イクサカ 幾坂 +イクサキ 生崎 +イクザキ 生崎 +イクサダ 生貞 +イクザネ 生実 +イクサワ 生沢 +イクサワ 生澤 +イクザワ 生沢 +イクザワ 生澤 +イクジ 生地 +イクジ 生路 +イグシ 伊串 +イグシ 居串 +イクシゲ 生重 +イクシバ 生芝 +イクシマ 生島 +イクシマ 生嶋 +イクシマ 幾島 +イクシマ 幾嶋 +イクシマ 生嶌 +イクシマ 郁島 +イクシマ 生嶼 +イクシロ 生城 +イクスエ 生末 +イクセ 生瀬 +イクセ 幾世 +イクセ 幾瀬 +イクセ 生勢 +イクタ 生田 +イクタ 行田 +イクタ 幾田 +イクタ 活田 +イクタ 往田 +イクタ 育田 +イクタ 生多(生夛) +イクタ 井久田 +イクタ 域田 +イクタ 郁田 +イクタ 鋳久田 +イクタ 徃田 +イクダ 生田 +イクタカ 幾高 +イクタキ 幾滝 +イクタキ 幾瀧 +イクタケ 行武 +イクタケ 生武 +イクタケ 幾竹 +イクタケ 生竹 +イクタジマ 生田嶋 +イクタジマ 生田島 +イクタニ 生谷 +イクタニ 幾谷 +イクタマ 生玉 +イクタメ 生田目 +イクタヤ 生田屋 +イクチ 生地 +イクチ 生口 +イクチ 郁地 +イクヂ 幾地 +イグチ 井口 +イグチ 猪口 +イグチ 乾口 +イグチ 生口 +イグチ 伊口 +イグチ 違口 +イグチ 亥口 +イクツ 生津 +イクド 幾度 +イクド 幾渡 +イクトウ 生藤 +イクトミ 生富 +イクトミ 生冨 +イクトメ 幾留 +イクドメ 幾留 +イクトモ 生友 +イクナイ 生内 +イクナカ 生中 +イクナガ 生長 +イクナガ 生永 +イクナガ 幾永 +イクナミ 生南 +イクナミ 幾波 +イクナリ 生成 +イクニシ 生西 +イクネ 生根 +イクノ 生野 +イクノ 幾野 +イクノ 行野 +イクノ 育野 +イクノ 郁野 +イクノ 幾乃 +イクノ 生乃 +イクノゴウ 生之郷 +イクノブ 生信 +イクハシ 生橋 +イクハシ 幾橋 +イクハラ 生原 +イクハラ 幾原 +イクビ 猪首 +イクヒサ 幾久 +イクフジ 生藤 +イクベ 生部 +イクボ 井久保 +イクボ 飯久保 +イクボ 井窪 +イクボ 猪久保 +イクボ 伊窪 +イクホウ 郁芳 +イクマ 猪熊 +イクマ 伊熊 +イクマ 生熊 +イクマ 井熊 +イクマ 生馬 +イクマ 伊久間 +イクマ 生間 +イクマ 井隈 +イクマ 飯久間 +イクマ 幾間 +イクマ 幾馬 +イクマ 膽熊 +イグマ 猪熊 +イグマ 伊熊 +イグマ 井熊 +イグマ 謄熊 +イクマサ 幾政 +イクマツ 生松 +イクミ 伊久美 +イクミ 生見 +イクミ 井汲 +イクミ 幾見 +イクミ 井組 +イクミ 生三 +イクミ 伊久見 +イクミ 伊久身 +イグミ 井汲 +イグミ 居組 +イグミ 井組 +イグミ 伊組 +イクミネ 生峯 +イクムネ 生宗 +イクムラ 生村 +イクムラ 育村 +イクムラ 幾村 +イクモ 生雲 +イクモ 井雲 +イクモト 行本 +イクモト 生本 +イクモト 生元 +イクモト 幾本 +イクモリ 生盛 +イクモリ 生森 +イクモリ 生守 +イクヤ 行谷 +イクヤス 生安 +イクヤマ 生山 +イクヤマ 幾山 +イクヤマ 伊久山 +イクヤマ 育山 +イクヤマ 郁山 +イクヨ 幾代 +イクラ 伊倉 +イクラ 井倉 +イクラ 居倉 +イクラ 以倉 +イクラ 猪倉 +イクラ 居蔵 +イクラ 生倉 +イクラ 生良 +イクラ 伊久良 +イクラ 幾良 +イクラ 伊蔵 +イクラ 行羅 +イグラ 伊倉 +イグラ 井倉 +イグラ 居倉 +イグラ 居蔵 +イグラ 居藏 +イクリ 井栗 +イグリ 井栗 +イクル 伊久留 +イクルミ 壬生 +イクルミ 王生 +イグルミ 弋 +イクロ 井黒 +イクロ 幾老 +イグロ 井黒 +イグロ 伊黒 +イグロ 井畔 +イクワ 生和 +イクワ 幾和 +イクワ 幾桑 +イクワ 生桑 +イケ 池 +イケ 井家 +イケ 生 +イゲ 伊芸 +イゲ 位下 +イゲ 伊藝 +イゲ 井削 +イケアナ 池穴 +イケイ 池井 +イケイ 伊計 +イケイ 池猪 +イゲイ 伊芸 +イゲイ 伊藝 +イケイシ 池石 +イケイズミ 池泉 +イケイチ 池一 +イケイド 池井戸 +イケウエ 池上 +イケウエ 池植 +イケウオ 活魚 +イケウチ 池内 +イケウチ 池宇地 +イケウツ 池宇都 +イケウラ 池浦 +イケエ 池江 +イケエズミ 生悦住 +イケオ 池尾 +イケオ 池生 +イケオ 猪毛尾 +イケオウ 池応(池應) +イケオカ 池岡 +イケオキ 池沖 +イケオク 池奥 +イケガイ 生貝 +イケガイ 池貝 +イケガイト 池垣内 +イケガキ 池垣 +イケガキ 生垣 +イケガキ 池墻 +イケガシラ 池頭 +イケガタ 池方 +イケガタ 池肩 +イケガタ 池形 +イケカツ 池勝 +イケガミ 池上 +イケガミ 池神 +イケガミ 井家上 +イケガミ 池加美 +イケカメ 池亀 +イケガメ 池亀 +イケガメ 生亀 +イケガヤ 池谷 +イケガヤ 池ケ谷 +イケカワ 池川 +イケガワ 池川 +イケガワ 池側 +イケキ 池木 +イケギ 池木 +イケギシ 池岸 +イケキタ 池北 +イケギワ 池際 +イケグチ 池口 +イケクビ 池首 +イケクボ 池久保 +イケクボ 池窪 +イケクラ 池倉 +イケクリス 池栗須 +イケクルス 池来須 +イケゴシ 生越 +イケゴシ 池越 +イケゴシ 池腰 +イケザ 池座 +イケサカ 池阪 +イケサカ 池坂 +イゲサカ 神母坂 +イケサキ 池崎 +イケサキ 池嵜 +イケザキ 池崎 +イケザキ 池嵜 +イケザキ 池埼 +イケザクラ 生桜 +イケザクラ 生櫻 +イケサコ 池迫 +イケサコ 池峪 +イケザコ 池迫 +イケサト 池里 +イケサワ 池沢 +イケサワ 池澤 +イケサワ 生沢 +イケザワ 池沢 +イケザワ 池澤 +イケザワ 生沢 +イケザワ 生澤 +イケジ 生地 +イケジ 池知 +イケジ 池地 +イケジ 池治 +イケジキ 生食 +イケシタ 池下 +イケシマ 池島 +イケシマ 池嶋 +イケシマ 池嶌 +イケジマ 池島 +イケジマ 池嶋 +イケジマ 池嶌 +イケショウ 池照 +イケジョウ 池条 +イケショウジ 池庄司 +イケジリ 池尻 +イケジリノ 池尻野 +イケシロ 池城 +イケス 池洲 +イケス 池子 +イケス 池須 +イケス 活洲 +イケス 池州 +イケス 池洌 +イケズ 池津 +イケスエ 池末 +イケスエ 池未 +イケズエ 池末 +イケスギ 池杉 +イケスギ 生杉 +イケズキ 生月 +イケスミ 池角 +イケスミ 池隅 +イケズミ 池住 +イケズミ 池角 +イケズミ 池澄 +イケズミ 生悦住 +イケズミ 生住 +イケズミ 池隅 +イケゾイ 池添 +イケゾエ 池添 +イケソト 池外 +イケゾノ 池園 +イケゾノ 池薗 +イケタ 池田 +イケタ 井桁 +イケダ 池田 +イケダ 生田 +イケダ 井ケ田 +イケダ 活田 +イケダ 池多 +イケダ 溏田 +イケダ 為計田(爲計田) +イケダ 垳田 +イケダ 池太 +イケダ 生駄 +イゲタ 井桁 +イゲタ 井下田 +イゲタ 井ケ田 +イゲタ 垳田 +イゲタ 井毛田 +イゲタ 伊下田 +イケタオ 池峠 +イケタオ 池垰 +イケタカ 池高 +イケダカ 池高 +イケダガキ 池田垣 +イケタキ 池滝 +イケタケ 池竹 +イケダザワ 池田沢 +イケダテ 池館 +イケダテ 池舘 +イケタニ 池谷 +イケダヤ 池田谷 +イケチ 池知 +イケチ 池地 +イケヂ 池知 +イケヂ 池地 +イケツ 池津 +イケヅ 池津 +イケツキ 池月 +イケヅキ 生月 +イケヅキ 池月 +イケツツ 池筒 +イケヅメ 池爪 +イケテ 池手 +イケテル 池照 +イケト 池戸 +イケド 池戸 +イケド 池土 +イケド 生土 +イケトウ 池藤 +イケトウ 池頭 +イケドウ 池堂 +イケトウゲ 池峠 +イケトミ 池富 +イケトミ 池冨 +イケドメ 池留 +イケナ 池名 +イケナエ 池苗 +イケナカ 池中 +イケナカ 生中 +イケナガ 池永 +イケナガ 生長 +イケナガ 池長 +イケナガ 生永 +イケナベ 池鍋 +イケナミ 池浪 +イケナミ 池並 +イケナミ 池波 +イケナリ 池成 +イケニシ 池西 +イケニシ 生西 +イケニワ 池庭 +イケヌシ 池主 +イケヌマ 池沼 +イケネ 池根 +イケノ 池野 +イケノ 池生 +イケノ 池埜 +イケノ 池之 +イケノウエ 池上 +イケノウエ 池之上 +イケノウエ 池ノ上 +イケノウエ 池野上 +イケノウエ 池の上 +イケノウチ 池ノ内 +イケノウチ 池之内 +イケノウチ 池野内 +イケノオク 池野奥 +イケノカミ 池之上 +イケノカミ 池ノ上 +イケノカミ 池野上 +イケノガミ 池之上 +イケノガミ 池ノ上 +イケノカワ 池ノ川 +イケノガワ 池之側 +イケノコ 池之子 +イケノザ 池之座 +イケノサコ 池之迫 +イケノサコ 池ノ迫 +イケノサコ 池の迫 +イケノシタ 池ノ下 +イケノシマ 池之島 +イケノシマ 池ノ島 +イケノシマ 池之嶌 +イケノタ 池野田 +イケノタ 池ノ田 +イケノダ 池野田 +イケノタニ 池ノ谷 +イケノタニ 池野谷 +イケノタニ 池之谷 +イケノト 池ノ都 +イケノノ 池之野 +イケノバ 池野場 +イケノハタ 池之端 +イケノハタ 池之畑 +イケノハタ 池野畑 +イケノハラ 池之原 +イケノヒラ 池之平 +イケノヒラ 池ノ平 +イケノブ 池信 +イケノベ 池辺 +イケノベ 池延 +イケノベ 池邊 +イケノベ 池邉 +イケノベ 池野辺(池野邊・池野邉) +イケノベ 池ノ辺 +イケノボウ 池坊 +イケノボウ 池之坊 +イケノマタ 池之俣 +イケノモト 池ノ本 +イケノモト 池野本 +イケノモト 池之本 +イケノモト 池之元 +イケノモト 池野元 +イケノモト 池乃本 +イケノヤ 池谷 +イケノヤ 池ノ谷 +イケノヤ 池野谷 +イケノヤ 池之谷 +イケノヤ 池の谷 +イケノヤ 池野屋 +イケノヤマ 池之山 +イケノリ 池乗(池乘) +イケバ 池羽 +イケバ 池場 +イケバ 池葉 +イケハシ 池橋 +イケハス 池葉須 +イケバス 池葉須 +イケハタ 池端 +イケハタ 池畑 +イケハタ 池畠 +イケハタ 池幡 +イケハタ 池羽田 +イケハタ 池瑞 +イケバタ 池端 +イケバタ 池畑 +イケバタ 池側 +イケバタ 池畠 +イケバタ 池幡 +イケバタ 生幡 +イケバタ 池羽田 +イケバタケ 池畠 +イケハマ 池浜 +イケハマ 池濱 +イケバヤシ 池林 +イケバヤシ 生林 +イケハラ 池原 +イケバラ 池原 +イゲハラ 荊原 +イゲハラ 井下原 +イケハラタニ 池原谷 +イケハラダニ 池原谷 +イケハラヤ 池原谷 +イケヒガシ 池東 +イケヒラ 池平 +イケヒロ 池広(池廣) +イケフク 池福 +イケブクロ 池袋 +イケフジ 生藤 +イケフジ 池藤 +イケフジ 池富士 +イケフジ 池冨士 +イケフチ 池淵 +イケフチ 池渕 +イケブチ 池淵 +イケブチ 池渕 +イケブチ 池縁 +イケベ 池辺 +イケベ 池部 +イケベ 池邊 +イケベ 生部 +イケベ 池邉 +イケホ 池保 +イケボウ 池防 +イケホソ 池細 +イケホリ 生湟 +イケマ 池間 +イケマエ 池前 +イケマス 池増 +イケマス 池桝 +イケマタ 池又 +イケマタ 池俣 +イケマチ 池町 +イケマツ 池松 +イケマツ 池末 +イケマツ 生松 +イケマツナワ 池松縄 +イケミ 池見 +イケミ 池味 +イケミ 池未 +イケミズ 池水 +イケミゾ 池溝 +イケミチ 池道 +イケミツ 池光 +イケミツ 池満 +イケミツ 池三津 +イケミネ 生峯 +イケミネ 池峯 +イケミネ 池峰 +イケミヤ 池宮 +イケミヤギ 池宮城 +イケミヤグスク 池宮城 +イケミヤシロ 池宮城 +イケムカイ 池向 +イケムネ 池宗 +イケムラ 池村 +イケムラ 生村 +イケムラ 池邨 +イケムラ 池邑 +イケムレ 池牟礼 +イケムレ 池牟禮 +イケムロ 池室 +イケメ 池目 +イケモト 池本 +イケモト 池元 +イケモト 生本 +イケモト 生元 +イケモリ 池森 +イケモリ 池守 +イケモリ 生森 +イケモリ 池盛 +イケモリ 生湟 +イケヤ 池谷 +イケヤ 池屋 +イケヤ 池家 +イケヤウチ 池谷内 +イケヤス 池安 +イケヤチ 池谷内 +イケヤツ 池谷 +イケヤマ 池山 +イゲヤマ 井下山 +イケヨシ 池吉 +イケル 蘇 +イケル 蘓 +イケロ 池呂 +イケワキ 池脇 +イケワタ 生綿 +イケワダ 池和田 +イコ 伊子 +イコ 井古 +イコ 猪古 +イコ 伊古 +イコ 位古 +イゴ 井後 +イゴ 以後 +イゴ 伊後 +イコイバ 休場(休塲) +イコウ 伊香 +イコウ 胃甲 +イコウ 井光 +イコウ 井孝 +イゴウ 伊郷 +イゴウ 井合 +イゴウ 井郷 +イゴウ 居郷 +イゴウ 猪合 +イゴウ 飯河 +イゴウ 猪郷 +イコウガ 伊香賀 +イコガ 伊香賀 +イコク 居穀 +イゴサキ 以後崎 +イゴザキ 以後崎 +イゴサワ 伊五沢 +イゴサワ 伊五澤 +イコシ 猪越 +イコシ 井越 +イコシ 井腰 +イコシ 射越 +イゴシ 生越 +イゴシ 猪越 +イゴシ 井越 +イゴシ 井腰 +イコタ 井古田 +イコタ 伊古田 +イコタ 藺古田 +イコダ 井古田 +イコダ 伊古田 +イコダ 藺古田 +イゴタ 伊吾田 +イゴタ 以後田 +イゴタ 伊吾多 +イコノ 伊古野 +イコハギ 井小萩 +イコハギ 伊小萩 +イコマ 生駒 +イコマ 生馬 +イコマ 井駒 +イコマ 伊駒 +イコマ 居駒 +イコマ 所古 +イコマ 伊香間 +イコマミネ 生駒峯 +イコミ 伊故海 +イコミ 伊古美 +イゴリ 伊垢離 +イサ 伊佐 +イサ 井佐 +イサ 伊砂 +イサ 伊 +イサ 伊左 +イサ 伊差 +イザ 伊座 +イサイ 以西 +イサイ 井斎 +イサイ 井斉 +イサイ 伊才 +イサイ 委細 +イサイ 井齋 +イサイ 井齊 +イザイ 伊在井 +イザイ 伊材 +イザイ 伊財 +イザイク 居細工 +イザイケ 居在家 +イサイダ 伊斎田 +イサイダ 伊齋田 +イサオ 井竿 +イサオ 悳 +イザオ 井竿 +イサオカ 砂岡 +イサオカ 伊佐岡 +イサカ 井坂 +イサカ 伊坂 +イサカ 井阪 +イサカ 猪坂 +イサカ 伊阪 +イサカ 猪阪 +イサカ 居阪 +イサカ 居坂 +イサカ 位坂 +イザカ 井坂 +イザカ 伊坂 +イザカ 伊阪 +イサカイ 飯盛 +イサカイ 井境 +イサガイ 飯盛 +イサカリ 飯盛 +イサガリ 飯盛 +イサカワ 伊佐川 +イサカワ 諫川 +イサガワ 砂川 +イサガワ 伊差川 +イサガワ 去来川(去耒川) +イサガワ 伊佐川 +イサガワ 砂河 +イサガワ 諫川 +イサガワ 諌川 +イサガワ 率川 +イサガワ 伊作川 +イサガワ 去來川 +イサキ 井崎 +イサキ 伊崎 +イサキ 伊佐木 +イサキ 伊三木 +イサキ 井嵜 +イサキ 伊咲 +イサキ 伊嵜 +イサキ 井先 +イサギ 伊三木 +イサギ 井鷺 +イザキ 井崎 +イザキ 伊崎 +イザキ 猪崎 +イザキ 居崎 +イザキ 井嵜 +イザキ 位崎 +イサキダ 伊崎田 +イサク 伊作 +イサク 井作 +イザク 伊作 +イザクラ 井桜 +イザクラ 伊桜 +イザクラ 井櫻 +イザクラ 伊櫻 +イザケ 居酒 +イサコ 井迫 +イサコ 井硲 +イサコ 居迫 +イサコ 伊迫 +イサコ 井佐子 +イサゴ 砂子 +イサゴ 砂金 +イサゴ 砂 +イサゴ 沙 +イサゴ 井砂 +イサゴ 砂後 +イザコ 井迫 +イザコ 居迫 +イサコザワ 砂子沢 +イサコザワ 砂子澤 +イサゴザワ 砂子沢 +イサゴザワ 砂子澤 +イサゴダ 砂子田 +イサゴハラ 石砂原 +イササ 井笹 +イザサ 井笹 +イザサ 井篠 +イザサ 𥱤 +イザサ 猪笹 +イザサ 伊笹 +イササカ 伊佐坂 +イサザキ 諌崎 +イサザキ 諫崎 +イサザワ 砂沢 +イサザワ 砂澤 +イサザワ 五十沢(五十澤) +イザサワ 十六沢(十六澤) +イサシ 井指 +イサジ 伊佐治 +イサジ 伊佐地 +イサジ 伊佐次 +イサジ 伊左治 +イサジ 伊左次 +イサジ 砂治 +イサジ 伊佐冶 +イサジ 伊佐路 +イザシ 井指 +イサシキ 伊佐敷 +イサセリ 伊佐芹 +イサダ 伊佐田 +イサダ 井定 +イサダ 居貞 +イサタケ 諌武 +イサタケ 諫武 +イサチ 伊佐地 +イサヂ 伊佐地 +イサツ 伊佐津 +イサト 伊里 +イサト 為郷 +イザト 伊里 +イザト 猪里 +イサナ 伊佐名 +イザナミ 伊座並 +イサノ 砂野 +イサノ 伊佐野 +イサノ 伊三野 +イサハイ 飯酒盃 +イサハイ 砂盃 +イサハイ 飲酒盃 +イサハイ 伊佐杯 +イサハヤ 伊佐早 +イサハヤ 諌早 +イサハヤ 諫早 +イサハヤ 䑶早 +イサハラ 諫原 +イサハラ 井佐原 +イサハラ 諌原 +イザハラ 十六原 +イサフシ 鯨臥 +イサフシ 鯨伏 +イサフシ 鯨卧 +イサフジ 伊佐藤 +イサベ 伊三部 +イサマ 伊佐間 +イサマ 伊佐馬 +イサマツ 伊弉末 +イザマル 伊在丸 +イサミ 勇 +イサミ 伊佐見 +イサミ 五老海 +イサミ 勇美 +イサミ 諫見 +イサミ 伊佐美 +イサミ 諌見 +イサミ 勇水 +イサミダ 勇田 +イサミモト 勇本 +イサミヤ 勇谷 +イサミヤマ 勇山 +イサム 勇 +イサム 薫 +イサモト 諌本 +イサモト 諫元 +イサモト 諫本 +イサモト 諌元 +イサヤマ 砂山 +イサヤマ 諫山 +イサヤマ 諌山 +イサヤマ 伊佐山 +イサヤマ 勇山 +イサヤマ 井早山 +イサライ 小井 +イサリ 漁 +イサリ 猪去 +イサリダ 漁田 +イサワ 井沢 +イサワ 伊沢 +イサワ 伊澤 +イサワ 井澤 +イサワ 石和 +イサワ 石禾 +イサワ 胆沢 +イサワ 膽沢 +イサワ 膽澤 +イザワ 井沢 +イザワ 伊沢 +イザワ 伊澤 +イザワ 井澤 +イザワ 生沢 +イザワ 生澤 +イザワ 猪沢 +イザワ 居沢 +イザワ 猪澤 +イザワ 射和 +イザワ 揖沢 +イザワ 居澤 +イザワ 揖澤 +イザワシマ 井沢島(井澤島) +イシ 石 +イシ 伊師 +イシ 井師 +イジ 井地 +イジ 伊地 +イジ 居地 +イジ 伊治 +イジ 井治 +イシアイ 石合 +イシアゲ 石揚 +イシアラ 石新 +イシイ 石井 +イシイ 石居 +イシイ 石射 +イシイ 石伊 +イシイ 甃井 +イシイ 伊志伊 +イシイ 伊志井 +イシイエ 石家 +イシイグチ 石井口 +イシイケ 石池 +イシイシカワ 石々川 +イシイズミ 石泉 +イシイダ 石井田 +イシイデ 石出 +イシイデ 石井出 +イシイト 石糸 +イシイハラ 石井原 +イシイヤマ 石井山 +イシイル 石射 +イシイワ 石岩 +イシウ 石宇 +イシウエ 石上 +イシウジ 石氏 +イシウダ 石生田 +イシウチ 石内 +イシウチ 石打 +イシウネ 石畝(石畒) +イシウマ 石馬 +イシウミ 石海 +イシウラ 石浦 +イシウラ 石裏 +イシエ 石江 +イシエ 石栄 +イシエ 石榮 +イシオ 石尾 +イシオ 石王 +イシオ 石生 +イシオ 石大 +イシオ 偉士大 +イシオウ 石王 +イシオウ 石応 +イシオウ 石應 +イシオウマル 石王丸 +イシオカ 石岡 +イジオカ 井地岡 +イシオタニ 石生谷 +イシオドリ 石躍 +イシオドリ 石踊 +イシオロシ 石下 +イシオロシ 石颪 +イシカ 石過 +イシカ 石加 +イシカ 石嘉 +イシカ 石香 +イシガ 石賀 +イシガ 石我 +イシカイ 石貝 +イシガイ 石谷 +イシガイ 石貝 +イシガイ 石海 +イシガイ 石外 +イシガイ 石甲斐 +イシガカリ 石懸 +イシカギ 石鍵 +イシガキ 石垣 +イシガキ 石城 +イシガキ 石崖 +イシガキ 石墻 +イシカク 石角 +イシカケ 石掛 +イシガケ 石掛 +イシガケ 石懸 +イシカサ 石笠 +イシガサ 石笠 +イシガサキ 石ケ崎 +イシカジ 石梶 +イシガシラ 石頭 +イシカゼ 石風 +イシカタ 石方 +イシガタ 石形 +イシガツオ 石鰹 +イシガツボ 石ケ坪 +イシカド 石角 +イシカド 石門 +イシカネ 石金 +イシカネ 石兼 +イシガネ 石金 +イシガネ 石鐘 +イシガノ 石ケ野 +イシガハラ 石ケ原 +イシカミ 石上 +イシカミ 石神 +イシガミ 石上 +イシガミ 石神 +イシガミイ 石神井 +イシカメ 石亀 +イシガメ 石亀 +イシガメ 石瓶 +イシガモリ 石ケ森 +イシガモリ 石ケ守 +イシカヤ 石柏 +イシガヤ 石谷 +イシガヤ 石ケ谷 +イシガヤ 石下谷 +イシガヤスミ 石ケ休 +イシカワ 石川 +イシカワ 石河 +イシカワ 伊志川 +イシカワ 石嘉波 +イシガワ 石側 +イジガワ 井路側 +イシカワラ 石川原 +イシガワラ 石川原 +イシキ 伊敷 +イシキ 石木 +イシキ 石城 +イシキ 居敷 +イシキ 石敷 +イシキ 石記 +イシキタ 石北 +イシキダ 石木田 +イシキド 石城戸 +イシキド 石木戸 +イシキリ 石切 +イシキリ 石伐 +イシキリドコロ 石切所 +イシキリヤマ 石切山 +イシキロ 石木呂 +イシギワ 石際 +イシク 石工 +イシク 石ユ +イシグチ 石口 +イジグチ 井地口 +イシクニ 石国 +イシクニ 石國 +イシクボ 石久保 +イシクボ 石窪 +イシクマ 石隈 +イシクマ 石熊 +イシグマ 石隈 +イシグモ 石雲 +イシクラ 石倉 +イシクラ 石蔵 +イシクラ 石鞍 +イシクラ 石藏 +イシクラ 石庫 +イシクリ 石栗 +イシグリ 石栗 +イシクレ 石榑 +イシクレ 石暮 +イシクレ 石槫 +イシグレ 石榑 +イシグレ 石暮 +イシグレ 石槫 +イシクロ 石黒 +イシクロ 石畝 +イシグロ 石黒 +イシグロ 石畝(石畒) +イシグロ 石畔 +イシケ 石毛 +イシゲ 石毛 +イシゲ 石下 +イシゲ 井茂 +イシゲ 石外 +イシケタ 石桁 +イシゲタ 石桁 +イシゲタニ 石下谷 +イシゲダニ 石下谷 +イシコ 石河 +イシコ 石子 +イシコ 石古 +イシコ 石生 +イシコ 石故 +イシコ 石児 +イシコ 石小 +イシゴ 石吾 +イシゴ 石後 +イシゴ 石五 +イシコウ 石河 +イシコウ 石向 +イシコウ 石幸 +イシゴウ 石合 +イシゴウ 石郷 +イシゴウ 石行 +イシゴウオカ 石郷岡 +イシゴウカ 石郷岡 +イシゴウチ 石河内 +イシゴウリ 石流 +イシゴオカ 石郷岡 +イシゴオカ 石後岡 +イシコオリ 石郡 +イシゴオリ 石流 +イシゴオリ 石氷 +イシゴオリ 石郡 +イシコシ 石腰 +イシコシ 石越 +イシコソ 石社 +イシコリ 石樵 +イシサ 石佐 +イシザ 石座 +イシサカ 石坂 +イシサカ 石阪 +イシザカ 石坂 +イシザカ 石阪 +イシサカガワ 石坂川 +イシザカヤ 石坂谷 +イシサキ 石崎 +イシサキ 石嵜 +イシサキ 石佐喜 +イシザキ 石崎 +イシザキ 石嵜 +イシザキ 石咲 +イシザキ 石佐喜 +イシザキ 石埼 +イシザキ 石先 +イシザクラ 石桜 +イシサコ 石迫 +イシサコ 石佐古 +イシサコ 石岶 +イシザコ 石迫 +イシザコ 石﨏 +イシサシ 石指 +イシザシ 石指 +イシザシ 石差 +イシサダ 石定 +イシサダ 石貞 +イシザト 石里 +イシサワ 石沢 +イシサワ 石澤 +イシザワ 石沢 +イシザワ 石澤 +イシシ 石志 +イシジ 石地 +イシジ 石次 +イシジ 石路 +イシジ 石治 +イシジオ 石塩 +イシシカ 石鹿 +イシジキ 石直 +イシシタ 石下 +イシジマ 石島 +イシジマ 石嶋 +イシジマ 石嶌 +イシジョウ 石城 +イシシロ 石代 +イシス 石須 +イシズ 石津 +イシズ 石須 +イシズ 石通 +イシズイ 石随 +イシズイ 石隋 +イシズイ 石隨 +イシズエ 石居 +イシズエ 礎 +イシズエ 石末 +イシスガ 石須賀 +イシズカ 石塚 +イシズカ 石策 +イシスギ 石杉 +イシズキ 石附 +イシズキ 石月 +イシズキ 石築 +イシズキ 鐏 +イシズチ 石鎚 +イシズミ 石角 +イシズミ 石墨 +イシズミ 石住 +イシズミ 石炭 +イシズミ 石済 +イシズミ 石隅 +イシズミ 石鷲見 +イシズリ 石硯 +イシセ 石瀬 +イシゼ 石瀬 +イシセキ 石関(石關) +イシゼキ 石関(石關) +イシゾエ 石添 +イシソコ 石底 +イシソネ 石曽根 +イシソネ 石曾根 +イシゾネ 石曽根 +イシゾネ 石曾根 +イシソノ 石其 +イシゾノ 石園 +イシゾノ 石其 +イシタ 石田 +イシタ 井下 +イシタ 位下 +イシタ 石多 +イシタ 居下 +イシダ 石田 +イシダ 石多 +イシダ 伊志田 +イシダイ 石代 +イシダイ 石大 +イシダイラ 石平 +イシタオ 石田尾 +イシダオ 石田尾 +イシタカ 石高 +イシタカ 石鷹 +イシダカ 石高 +イシタキ 石滝 +イシタキ 石瀧 +イシタケ 石竹 +イシダケ 石岳 +イシダザカ 石田坂 +イシタテ 石立 +イシタテ 石館 +イシタテ 石建 +イシダテ 石立 +イシダテ 石館 +イシダテ 石舘 +イシダテ 石建 +イシダテ 石達 +イシタニ 石谷 +イシタニ 稲子谷 +イシタニ 石渓 +イシダハラ 石田原 +イシタライ 石手洗 +イシチ 石地 +イシヂ 石地 +イジチ 伊地知 +イジチ 伊知地 +イジチ 伊地智 +イジチ 伊秩 +イジチ 井地知 +イシツ 石津 +イシヅ 石津 +イシヅ 石通 +イジツ 井実 +イジツ 井實 +イシヅエ 礎 +イシヅエ 石津江 +イシッカ 石過 +イシツカ 石塚 +イシツカ 石束 +イシヅカ 石塚 +イシヅカ 石束 +イシヅカ 石司 +イシヅカ 石策 +イシヅカ 石墳 +イシヅカ 石冢 +イシヅカワ 石津川 +イシツキ 石月 +イシツキ 石槻 +イシヅキ 石附 +イシヅキ 石月 +イシヅキ 石突 +イシヅキ 石築 +イシヅキ 鐏 +イシヅキ 石槻 +イシヅキ 石付 +イシヅクリ 石作 +イシツケ 石附 +イシツジ 石辻 +イシヅチ 石鎚 +イシヅチ 石槌 +イシヅチ 石土 +イシヅツ 石筒 +イシヅツミ 石堤 +イシツナ 石綱 +イシヅナ 石綱 +イシツボ 石坪 +イシツボ 石壷 +イシヅミ 石積 +イシヅミ 石墨 +イシヅメ 石詰 +イシヅメ 石爪 +イシヅヤ 石津谷 +イシテ 石手 +イシデ 石出 +イシデ 石手 +イシテアライ 石手洗 +イシデラ 石寺 +イシト 石戸 +イシド 石戸 +イシド 石土 +イシトウ 石藤 +イシトウ 石東 +イシトウ 石塔 +イシトウ 石当 +イシトウ 石答 +イシドウ 石堂 +イシドウ 石動 +イシドウ 石藤 +イシドウ 石道 +イシドウマル 石動丸 +イシドウマル 石堂丸 +イシドウヤ 石動谷 +イシドオリ 石通 +イシトク 石徳 +イシトコ 石床 +イシドコ 石床 +イシドシロ 石徹白 +イシトハシ 石戸橋 +イシトバシ 石戸橋 +イシトビ 石飛 +イシトミ 石富 +イシトミ 石冨 +イシトメ 石留 +イシドメ 石留 +イシドメ 石止 +イシトモ 石友 +イシトヤ 石戸谷 +イシドヤ 石戸谷 +イシトリ 石鳥 +イシドリ 石鳥 +イシトリヤ 石鳥谷 +イシナ 石名 +イシナ 井科 +イシナカ 石中 +イシナカ 石仲 +イシナガ 石永 +イシナガ 石長 +イシナガレ 石流 +イシナガワ 石長川 +イシナギ 石椛 +イシナゲ 石投 +イシナザカ 石名坂 +イシナザカ 石那坂 +イシナザワ 石名沢(石名澤) +イシナダ 石灘 +イシナダ 石那田 +イシナダ 石名田 +イシナダ 石鉈 +イシナベ 石鍋 +イシナベ 石名部 +イシナミ 石並 +イシナミ 石浪 +イシナミ 石波 +イシナミ 石南 +イシナリ 石動 +イシナリ 石成 +イシニシ 石西 +イシニワ 石庭 +イシヌキ 石貫 +イシヌキ 石抜(石拔) +イシヌマ 石沼 +イシネ 石根 +イシノ 石野 +イシノ 石埜 +イシノ 石之 +イシノ 石濃 +イシノウ 石納 +イシノカミ 石之神 +イシノクボ 石之久保 +イシノコシ 石之腰 +イシノダ 石野田 +イシノタニ 石野谷 +イシノノ 石之野 +イシノハチ 石鉢 +イシノハチ 石ノ鉢 +イシノマキ 石野巻 +イシノマキ 石ノ巻 +イシノメ 石野目 +イシノモリ 石野森 +イシノヤ 石野谷 +イシノワキ 石之脇 +イシバ 石場(石塲) +イシバ 石破 +イシバ 石庭 +イシバ 石葉 +イシバ 石羽 +イシバ 井芝 +イシバイ 石灰 +イシバザワ 石羽沢 +イシバザワ 石羽澤 +イシハシ 石橋 +イシバシ 石橋 +イシバシ 磴 +イシバシ 石槁 +イシバシ 矼 +イシバシリ 石走 +イシハタ 石畑 +イシハタ 石幡 +イシハタ 石畠 +イシバタ 石畑 +イシバタ 石幡 +イシバタ 石畠 +イシバタ 石端 +イジバタ 井路端 +イシバタケ 石畠 +イシハチ 石鉢 +イシバチ 石鉢 +イシハナ 石花 +イシバナ 石端 +イシバナ 石花 +イシバネ 石羽根 +イシハネザワ 石羽沢 +イシハネザワ 石羽澤 +イシババ 石馬場 +イシハマ 石浜 +イシハマ 石濱 +イシハヤ 石早 +イシバヤシ 石林 +イシハラ 石原 +イシハラ 伊志原 +イシハラグチ 石原口 +イシハラザカ 石原坂 +イシハラザキ 石原崎 +イシハラジマ 石原島 +イシハラダ 石原田 +イシヒ 石樋 +イシヒキ 石引 +イシビキ 石引 +イシビキ 石挽 +イシビツ 石櫃 +イシビヤ 石火矢 +イシヒラ 石平 +イシヒロ 石広 +イシヒロ 石廣 +イシブ 石生 +イシフク 石福 +イシフジ 石藤 +イシブシ 石伏 +イシブシ 石臥 +イシブチ 石渕 +イシブチ 石淵 +イシブツ 石仏 +イシブツ 石佛 +イシフネ 石船 +イシフネ 石舟 +イシブネ 石船 +イシフミ 石文 +イシブミ 石文 +イシフロ 石風呂 +イシブロ 石風呂 +イシベ 石部 +イシベ 石辺(石邊・石邉) +イシベニ 石紅 +イシホ 石保 +イシボ 石保 +イシホウ 石宝 +イシボトケ 石仏 +イシボトケ 石佛 +イシホラ 石洞 +イシホリ 石堀 +イシボリ 石堀 +イシマ 井島 +イシマ 石間 +イシマ 井嶋 +イシマ 猪島 +イシマ 伊島 +イシマ 伊嶋 +イシマ 伊嶌 +イシマ 異島 +イシマ 石馬 +イジマ 井島 +イジマ 井嶋 +イジマ 猪島 +イジマ 伊島 +イジマ 居島 +イジマ 伊嶋 +イジマ 猪嶋 +イジマ 居嶋 +イジマ 井嶌 +イジマ 伊嶌 +イジマ 異島 +イジマ 意島(意嶋) +イジマ 猪嶌 +イジマ 位島 +イジマ 井隝 +イシマエ 石前 +イシマキ 石巻 +イシマキ 石牧 +イシマサ 石政 +イシマサ 石正 +イシマス 石増 +イシマス 石升 +イシマタ 石股 +イシマチ 石町 +イシマツ 石松 +イシマド 石間戸 +イシマブシ 石間伏 +イシマル 石丸 +イシミ 石見 +イシミ 石三 +イシミ 石美 +イシミ 石鑑 +イジミ 伊路見 +イシミズ 石水 +イシミチ 石道 +イシミツ 石光 +イシミツ 石満 +イシミネ 石嶺 +イシミネ 伊志嶺 +イシミネ 石峰 +イシミネ 石峯 +イシミネ 伊志峰 +イシミヤ 石宮 +イシミョウ 石妙 +イシムカイ 石向 +イシムネ 石宗 +イシムラ 石村 +イシムラ 石邑 +イシムラ 石邨 +イシムレ 石牟礼 +イシムレ 石牟禮 +イシムロ 石室 +イシムロヤ 石室屋 +イシメ 石目 +イシモ 石茂 +イシモタ 石母田 +イシモダ 石母田 +イシモダ 石毋田 +イシモチ 石持 +イシモト 石本 +イシモト 石元 +イシモト 柘本 +イシモリ 石森 +イシモリ 石盛 +イシモリ 石守 +イシモリ 石杜 +イシャ 井舎 +イシヤ 石谷 +イシヤ 石屋 +イシヤ 石家 +イシヤ 石矢 +イシヤシキ 石屋敷 +イシャドウ 伊舎堂 +イシヤマ 石山 +イシャラ 伊舎良 +イシユ 石湯 +イジュ 伊集 +イジュ 伊寿 +イシュウ 伊集 +イシュウ 石生 +イシュウ 井周 +イジュウ 伊集 +イシュウイン 伊集院 +イジュウイン 伊集院 +イジュウダ 伊集田 +イシユキ 石行 +イショ 井所 +イシヨシ 石芳 +イシヨネ 石米 +イシラ 伊志良 +イシラ 石良 +イシリ 石理 +イジリ 井尻 +イジリ 井後 +イジリ 伊尻 +イジリ 猪尻 +イシリョウ 石料 +イシルギ 石動 +イシロ 居城 +イシロ 井城 +イシロ 井代 +イシロ 石路 +イシロ 伊代 +イシロ 伊城 +イシロ 井白 +イシロ 居代 +イシロ 石炉 +イジロ 居城 +イシワ 石和 +イシワ 石輪 +イシワ 石倭 +イシワカ 石若 +イシワキ 石脇 +イシワク 石和久 +イシワケ 石訳 +イシワタ 石渡 +イシワタ 石綿 +イシワタ 石和田 +イシワタ 石腸 +イシワタ 石膓 +イシワダ 石和田 +イシワタト 石渡戸 +イシワタリ 石渡 +イシワタリト 石渡戸 +イシワラ 石原 +イシワリ 石割 +イス 井須 +イス 猪須 +イス 伊須 +イズ 伊豆 +イズ 伊集 +イズ 伊津 +イズ 井豆 +イスイ 井水 +イスイ 倚水 +イズイ 出井 +イズイ 泉井 +イズイ 伊豆井 +イズイ 泉居 +イズイケ 泉池 +イズイシ 出石 +イズウチ 伊豆内 +イズウラ 泉浦 +イズウラ 伊豆浦 +イスエ 井居 +イスエ 井末 +イズエ 出江 +イズエ 出柄 +イズエ 井末 +イズオ 泉尾 +イズオ 出尾 +イズオ 泉雄 +イズオカ 出岡 +イズオカ 泉岡 +イズオカ 伊豆岡 +イズオキ 出沖 +イズカ 井塚 +イズカ 猪塚 +イズカ 泉賀 +イズカ 伊豆賀 +イズカシ 厳樫 +イズカシ 巌樫 +イズカシ 嚴樫 +イズカミ 泉上 +イズガミ 出上 +イズガミ 伊豆上 +イズカワ 泉川 +イズカワ 出川 +イズカワ 伊豆川 +イスキ 居宿 +イスギ 井杉 +イズキ 出来 +イズキ 出耒 +イズキ 泉貴 +イズグチ 泉口 +イズクネ 出久根 +イズクラ 出倉 +イズクラ 伊豆倉 +イズクラ 伊豆蔵 +イズクラ 泉倉 +イズクラ 伊豆藏 +イスケ 井祐 +イスゲ 伊菅 +イスゲ 井菅 +イスゲ 井管 +イズゴ 出後 +イズサ 出佐 +イズサカ 泉阪 +イズサキ 泉崎 +イズサワ 泉沢 +イズサワ 泉澤 +イズサワ 伊豆沢 +イズサワ 伊豆澤 +イズシ 出石 +イズシ 出師 +イズシエ 出石家 +イズシナ 出科 +イズシマ 伊豆島(伊豆嶋) +イスズ 五十鈴 +イスズカワ 五十鈴川 +イスズガワ 五十鈴川 +イスダ 伊須田 +イズタ 泉田 +イズタ 出田 +イズタ 伊豆田 +イスタニ 熊取谷 +イズタニ 泉谷 +イズタニ 出谷 +イズタニ 伊豆谷 +イズタマ 泉玉 +イズチ 井土 +イズチ 出地 +イズチ 伊秩 +イズチ 泉池 +イズツ 井筒 +イズツ 伊豆津 +イズト 出戸 +イズトウ 泉当(泉當) +イスナ 猪砂 +イズナ 伊豆名 +イズナカ 泉中 +イズナガ 出永 +イズナガ 伊豆永 +イズナガ 泉永 +イズナダ 泉灘 +イズナミ 泉並 +イズナミ 泉竝 +イスノ 以須野 +イズノ 出野 +イズノ 伊津野 +イズノ 泉野 +イズノ 伊豆野 +イズノウ 泉納 +イズノメ 泉妻 +イズノメ 泉野目 +イズハ 出羽 +イズハ 出葉 +イズハ 伊豆葉 +イズハタ 井津端 +イズハナ 出花 +イズバヤシ 泉林 +イスハラ 伊須原 +イスハラ 柞原 +イズハラ 出原 +イズハラ 泉原 +イズハラ 伊豆原 +イズハラ 何原 +イズハラ 厳原 +イズハラ 嚴原 +イズヒラ 泉平 +イズヒロ 泉広(泉廣) +イズヒロ 出広 +イズヒロ 出廣 +イズブチ 出渕 +イズブチ 出淵 +イズブチ 出渊 +イズブチ 泉渕 +イズホ 出穂 +イズホリ 泉堀 +イズマ 出間 +イズマ 伊妻 +イズマ 出馬 +イズマ 猪妻 +イズマル 伊豆丸 +イスミ 井角 +イスミ 井住 +イスミ 伊住 +イスミ 亥角 +イスミ 伊角 +イスミ 井隅 +イスミ 夷隅 +イズミ 泉 +イズミ 和泉 +イズミ 出水 +イズミ 泉水 +イズミ 出海 +イズミ 井角 +イズミ 伊豆味 +イズミ 湶 +イズミ 井住 +イズミ 伊住 +イズミ 和美 +イズミ 伊積 +イズミ 伊豆見 +イズミ 出江 +イズミ 和 +イズミ 伊津見 +イズミ 伊泉 +イズミ 伊津美 +イズミ 泉美 +イズミ 井澄 +イズミ 井泉 +イズミ 泉海 +イズミ 泉住 +イズミイ 泉井 +イズミイケ 泉池 +イズミイチ 泉市 +イズミウラ 泉浦 +イズミエ 泉栄 +イズミオ 泉尾 +イズミオカ 泉岡 +イズミカ 泉家 +イズミカジ 泉鍛治 +イズミカド 泉門 +イズミカミ 泉上 +イズミカワ 泉川 +イズミカワ 和泉川 +イズミカワ 出水川 +イズミガワ 泉川 +イズミガワ 出水川 +イズミキ 泉木 +イズミグチ 泉口 +イズミクボ 泉久保 +イズミサカ 泉坂 +イズミサキ 泉崎 +イズミザキ 泉崎 +イズミサコ 泉迫 +イズミサト 泉里 +イズミサワ 泉沢 +イズミサワ 泉澤 +イズミサワ 和泉沢 +イズミサワ 和泉澤 +イズミサワ 出水沢 +イズミサワ 出水澤 +イズミザワ 泉沢 +イズミザワ 泉澤 +イズミザワ 和泉澤 +イズミザワ 出水沢 +イズミザワ 出水澤 +イズミサワダ 泉沢田 +イズミシマ 泉島 +イズミセキ 泉関 +イズミゾノ 出水園 +イズミタ 泉田 +イズミタ 和泉田 +イズミタ 出水田 +イズミダ 泉田 +イズミダ 和泉田 +イズミダ 出水田 +イズミダイ 泉代 +イズミタキ 泉滝 +イズミタキ 泉瀧 +イズミダテ 泉館 +イズミダテ 泉舘 +イズミタニ 泉谷 +イズミタニ 和泉谷 +イズミダニ 泉谷 +イズミチ 泉地 +イズミツ 泉津 +イズミデン 泉傳 +イズミト 泉登 +イズミナ 泉名 +イズミナガ 泉永 +イズミナミ 泉並 +イズミネ 五十嶺 +イズミネ 五十峯 +イズミネ 五十峰 +イズミネ 泉根 +イズミノ 泉野 +イズミノ 五十公野 +イズミバシ 泉橋 +イズミバタ 泉端 +イズミバタ 泉畑 +イズミハマ 泉浜 +イズミハラ 泉原 +イズミハラ 和泉原 +イズミヒロ 泉広(泉廣) +イズミヒロ 和泉広(和泉廣) +イズミベ 泉部 +イズミホリ 泉堀 +イズミマル 泉丸 +イズミムラ 泉村 +イズミモト 泉本 +イズミモト 泉元 +イズミモト 和泉元 +イズミモト 和泉本 +イズミモリ 泉森 +イズミヤ 泉谷 +イズミヤ 泉屋 +イズミヤ 出宮 +イズミヤ 泉宮 +イズミヤ 和泉谷 +イズミヤ 和泉屋 +イズミヤ 泉家 +イズミヤ 出水屋 +イズミヤマ 泉山 +イズミヤマ 和泉山 +イズミワキ 泉湧 +イズムネ 泉宗 +イズムラ 出村 +イズムラ 泉村 +イズムラ 伊豆村 +イズメ 井爪 +イズモ 出雲 +イズモ 出茂 +イズモイ 出雲井 +イズモサキ 出雲崎 +イズモザキ 出雲崎 +イズモジ 出雲路 +イズモジ 出雲寺 +イズモタニ 出雲谷 +イズモト 泉本 +イズモト 出本 +イズモト 泉元 +イズモト 伊豆元 +イズモト 伊豆本 +イズモト 出元 +イズモト 和泉元 +イズモヤ 出雲屋 +イズモリ 犾守 +イズモリ 泉森 +イズモリ 犹守 +イズモリ 何森 +イズモリ 泉盛 +イズヤ 出谷 +イズヤ 出家 +イズヤ 伊豆谷 +イズヤマ 泉山 +イズヤマ 伊豆山 +イズラ 井面 +イズリハ 楪 +イズリハ 棡葉 +イズリマチ 出町 +イズル 居鶴 +イスルギ 石動 +イスルギ 岩動 +イズルマ 出間 +イズルマチ 出町 +イズロ 出路 +イズワ 出羽 +イズワ 出輪 +イズワキ 泉脇 +イセ 伊勢 +イセ 伊瀬 +イセ 井瀬 +イセ 伊世 +イセ 井勢 +イセ 井清 +イセ 伊青 +イセ 伊生 +イセ 井畝 +イセ 以勢 +イセ 威世 +イセイ 為政 +イセイ 井清 +イセイ 伊勢井 +イセイ 伊世井 +イセイ 伊勢居 +イセイ 伊政 +イセイ 伊清 +イセオカ 伊勢岡 +イセカ 伊勢家 +イセカ 伊勢加 +イセガキ 伊勢垣 +イセガミ 伊勢上 +イセカメ 伊勢亀 +イセガメ 伊勢亀 +イセカワ 伊勢川 +イセガワ 伊勢川 +イセキ 井関 +イセキ 伊関(伊關) +イセキ 井石 +イセキ 居関 +イセキ 伊勢木 +イセキ 伊石 +イセキ 井堰 +イセキ 井磧 +イセキ 井跡 +イセキ 夷石 +イセキ 井碩 +イセキ 井塞 +イセキ 井關 +イセキ 生関 +イセキ 伊勢城 +イセキ 偉関 +イゼキ 井関 +イゼキ 伊関(伊關) +イゼキ 居関 +イゼキ 井關 +イゼキ 異石 +イセザキ 伊勢崎 +イセザキ 伊セ崎 +イセザキ 伊世崎 +イセザワ 伊勢沢 +イセザワ 伊勢澤 +イセジ 伊勢地 +イセジ 伊勢路 +イセシマ 伊勢島 +イセシマ 伊勢嶋 +イセジマ 伊勢島 +イセジマ 伊勢嶋 +イセタ 伊勢田 +イセダ 伊勢田 +イセタニ 伊勢谷 +イセチ 伊瀬知 +イセチ 伊勢地 +イセチ 伊瀬地 +イセチ 伊勢知 +イセヂ 伊勢地 +イセヅ 伊勢津 +イセヅカ 伊勢塚 +イセデ 伊勢出 +イセト 伊勢戸 +イセド 伊勢戸 +イゼナ 伊是名 +イセネ 伊勢根 +イセノ 伊勢野 +イセノウミ 伊勢海 +イセノウミ 伊勢ノ海 +イセババ 伊勢馬場 +イセハマ 伊勢浜(伊勢濱) +イセハラ 伊勢原 +イセハラ 伊世原 +イセフク 伊勢福 +イセボウ 伊勢坊 +イセマ 伊勢間 +イセミ 院瀬見 +イゼミ 院瀬見 +イセムラ 伊勢村 +イセモト 伊勢本 +イセモト 伊勢元 +イセモリ 伊勢森 +イセヤ 伊勢谷 +イセヤ 伊瀬谷 +イセヤ 伊勢屋 +イセヤ 伊世谷 +イセヤ 井瀬谷 +イセヤマ 伊勢山 +イセリ 井芹 +イゼリ 井芹 +イセロ 伊勢呂 +イセワキ 伊勢脇 +イセン 居仙 +イゼン 伊善 +イソ 磯 +イソ 礒 +イソ 井曽 +イソ 伊蘇 +イソ 井曾 +イソアイ 礒合 +イソアイ 磯合 +イソアキ 磯秋 +イソアミ 磯網 +イソアミ 礒網 +イソイ 磯井 +イソイ 五十井 +イソイ 礒井 +イゾイ 井副 +イソイサ 磯井佐 +イソイシ 五十石 +イソイシ 磯石 +イソイワ 礒岩 +イソイワ 磯岩 +イソウ 伊相 +イソウ 異相 +イソウ 井漕 +イソウ 井宗 +イソウ 井藻 +イソウ 井壮 +イソウエ 磯上 +イソウジ 磯氏 +イソウジ 礒氏 +イソウダ 井相田 +イソウチ 磯打 +イソウチ 五十内 +イソウチ 磯内 +イソウチ 礒内 +イソウヂ 磯氏 +イソウラ 磯浦(礒浦) +イソエ 磯江 +イソエ 礒江 +イゾエ 井添 +イゾエ 伊添 +イゾエ 井副 +イソオ 磯尾 +イソオ 礒尾 +イソオカ 磯岡 +イソオカ 礒岡 +イソオカ 磯丘 +イソオキ 磯沖 +イソオク 磯奥 +イソカ 磯嘉 +イソカ 五十香 +イソガ 磯賀 +イソカイ 磯貝 +イソカイ 礒海 +イソガイ 磯貝 +イソガイ 磯谷 +イソガイ 礒谷 +イソガイ 礒貝 +イソガイ 五十貝 +イソガイ 磯海 +イソガエ 磯谷 +イソガキ 磯垣 +イソガキ 礒垣 +イソカゼ 五十風 +イソカタ 磯方 +イソカド 磯角 +イソカネ 磯金 +イソカネ 磯兼 +イソカネ 礒金 +イソカネ 礒兼 +イソガネ 磯金 +イソガネ 磯兼 +イソカミ 磯上 +イソガミ 石上 +イソガミ 磯上 +イソガミ 礒上 +イソガメ 磯亀 +イソガメ 礒亀 +イソガヤ 磯谷 +イソガヤ 磯ケ谷 +イソガヤ 礒ケ谷 +イソカリ 五十苅 +イソカリ 五十刈 +イソカワ 五十川 +イソカワ 磯川 +イソカワ 礒川 +イソカワ 五嵐川 +イソガワ 石上 +イソガワ 五十川 +イソガワ 磯川 +イソガワ 礒川 +イソガワ 伍十川 +イソキ 五十木 +イソキ 磯木 +イソキ 礒木 +イソギ 五十木 +イソギ 磯木 +イソギミ 五十君 +イソグチ 磯口 +イソグチ 礒口 +イソクラ 磯倉 +イソコ 五十子 +イソコ 礒好 +イソゴ 五十子 +イソゴシ 磯越 +イソサカ 伊早坂 +イソサキ 磯崎 +イソサキ 礒崎 +イソサキ 磯嵜 +イソザキ 磯崎 +イソザキ 礒崎 +イソザキ 五十崎 +イソザキ 磯嵜 +イソザキ 礒嵜 +イソザワ 磯沢 +イソザワ 五十沢(五十澤) +イソザワ 礒沢 +イソザワ 礒澤 +イソジ 磯地 +イソジ 磯次 +イソジ 礒次 +イソシタ 磯下 +イソシタ 礒下 +イソシマ 磯島 +イソシマ 五十島 +イソシマ 礒島 +イソシマ 磯嶋 +イソシマ 五十嶋 +イソシマ 礒嶋 +イソジマ 磯島 +イソジマ 五十島 +イソジマ 礒島 +イソジマ 磯嶋 +イソジマ 五十嶋 +イソジマ 礒嶋 +イソジマ 礒嶌 +イソジマ 磯嶌 +イソシロ 磯城 +イソス 五十洲 +イソズ 五十洲 +イソズミ 五十棲 +イソズミ 五十住 +イソズミ 五十栖 +イソズミ 五十樓 +イソセ 磯瀬 +イソセ 礒瀬 +イソタ 磯田 +イソタ 礒田 +イソダ 磯田 +イソダ 礒田 +イソダ 五十田 +イソダ 井相田 +イソタケ 磯竹 +イソタケ 礒竹 +イソタニ 磯谷 +イソタニ 礒谷 +イソタニ 居組谷 +イソチ 五十地 +イソチ 磯地 +イソヅ 磯津 +イソヅ 礒津 +イソヅカ 夷塚 +イソヅカ 磯塚 +イソヅミ 磯積 +イソトウ 磯藤 +イソドウ 石堂 +イソドノ 五十殿 +イソナカ 磯中 +イソナガ 磯永 +イソナガ 礒永 +イソナガ 磯長 +イソナミ 磯波 +イソナミ 礒浪 +イソナミ 磯浪 +イソナレ 磯馴 +イソニ 磯仁 +イソニ 礒仁 +イソニシ 磯西 +イソニシ 石西 +イソニシ 礒西 +イソヌマ 磯沼 +イソヌマ 礒沼 +イソネ 磯根 +イソネ 礒根 +イソノ 磯野 +イソノ 礒野 +イソノ 五十野 +イソノ 伊園 +イソノ 磯埜 +イソノ 柰園 +イソノ 伊曽乃 +イゾノ 井園 +イソノウエ 磯ノ上 +イソノカミ 磯ノ上 +イソバ 磯場 +イソバ 五十場 +イソハシ 磯橋 +イソハシ 礒橋 +イソハタ 五十畑 +イソハタ 五十幡 +イソハタ 磯畑 +イソハタ 磯端 +イソハタ 礒端 +イソハタ 礒畑 +イソハタ 五十畠 +イソバタ 五十幡 +イソバタ 磯畑 +イソバタ 磯端 +イソバタ 礒端 +イソバタ 礒畑 +イソハナ 磯花 +イソハマ 磯浜 +イソハマ 磯濱 +イソハマ 礒浜 +イソハマ 礒濱 +イソバヤシ 磯林 +イソハラ 磯原 +イソハラ 礒原 +イソヒ 磯飛 +イソヒ 礒干 +イソヒ 礒飛 +イソヒ 磯干 +イソビキ 磯引 +イソヒサ 磯久 +イソヒラ 磯平 +イソフク 磯福 +イソフチ 礒淵 +イソブチ 磯渕 +イソブチ 磯淵 +イソブチ 礒淵 +イソブチ 礒渕 +イソベ 磯部 +イソベ 磯辺 +イソベ 礒部 +イソベ 礒辺 +イソベ 五十部 +イソベ 磯邊 +イソベ 磯邉 +イソベ 礒邉 +イソベ 礒邊 +イソベダテ 磯辺館 +イソベダテ 磯辺舘 +イソマ 磯間 +イソマ 礒間 +イソマエ 磯前 +イソマエ 礒前 +イソマタ 磯俣 +イソマチ 磯町 +イソマツ 磯松 +イソマツ 礒松 +イソミ 磯見 +イソミ 礒見 +イソミギ 五十右 +イソミチ 磯道 +イソミチ 礒道 +イソミネ 五十嶺 +イソミネ 五十峯 +イソミネ 五十峰 +イソムラ 磯村 +イソムラ 礒村 +イソムラ 五十村 +イソムラタ 磯村田 +イソメ 磯目 +イソメ 居初 +イソメ 井染 +イソメ 五拾免 +イソメ 礒目 +イソメ 五十免 +イソモト 磯本 +イソモト 礒本 +イソモト 礒元 +イソモト 磯元 +イソモリ 磯森 +イソモリ 礒森 +イソモリ 五十森 +イソヤ 磯谷 +イソヤ 礒谷 +イソヤ 磯矢 +イソヤ 磯屋 +イソヤ 礒家 +イソヤ 磯家 +イソヤ 五十谷 +イソヤ 礒屋 +イソヤマ 磯山 +イソヤマ 礒山 +イソユウ 磯遊 +イソラ 磯良 +イソリ 五十里 +イソリ 磯里 +イソワ 磯和 +イソワ 磯輪 +イソワキ 磯脇 +イソワキ 礒脇 +イタ 井田 +イタ 伊田 +イタ 板 +イタ 伊多 +イダ 井田 +イダ 依田 +イダ 伊田 +イダ 位田 +イダ 猪田 +イダ 伊多 +イダ 居田 +イダ 朶 +イダ 猪多 +イダ 怡田 +イダ 維田 +イダ 射田 +イダ 亥田 +イダ 藺田 +イタイ 板井 +イタイ 衣袋 +イダイ 伊代 +イダイ 伊台 +イタイガワ 板井川 +イタイシ 板石 +イタイダ 板井田 +イダイラ 井平 +イダイラ 伊平 +イダイラ 居平 +イタウ 板生 +イタウラ 板浦 +イタエ 板衛 +イタオ 板尾 +イタオ 板生 +イタオカ 板岡 +イタカ 井高 +イタカ 伊高 +イタカ 位高 +イタガ 板賀 +イダカ 井高 +イダカ 伊高 +イダカ 位高 +イダカ 居高 +イタカキ 板垣 +イタガキ 板垣 +イタガキ 板柿 +イタカゲ 板蔭 +イタカネ 板金 +イタガネ 板金 +イタカベ 板下部 +イタガミ 板上 +イタカリ 板狩 +イタカワ 板川 +イタカワ 板河 +イタガワ 板川 +イダガワ 井田川 +イタキ 板木 +イタキ 井滝 +イタキ 井瀧 +イタギ 板木 +イタキダイラ 板木平 +イタギダイラ 板木平 +イタキヨ 板清 +イタギリ 板切 +イタク 板久 +イタクス 板楠 +イタグス 板楠 +イタグチ 板口 +イタクボ 板久保 +イタクラ 板倉 +イタクラ 井田倉 +イタクラ 板鞍 +イタクラ 伊多倉 +イタクラ 板蔵 +イタケ 井竹 +イタケ 伊竹 +イタケ 伊武 +イタケ 猪丈 +イタケ 井武 +イタコ 板子 +イタコ 潮来(潮來・潮耒) +イタゴウ 板郷 +イタゴエ 板越 +イタコシ 板越 +イタゴシ 板越 +イタサカ 板坂 +イタサカ 板阪 +イタザカ 板坂 +イタサキ 板崎 +イタサキ 板先 +イタザキ 板崎 +イタサコ 板迫 +イタサト 板里 +イタザト 板里 +イタサワ 板澤 +イタザワ 板沢 +イタザワ 板澤 +イタシキ 板敷 +イタジキ 板敷 +イタシゲ 板重 +イタシタ 板下 +イタジマ 板島 +イタジマ 板嶋 +イタジマ 板嶌 +イタシロ 五太代 +イタズ 板津 +イタズ 板頭 +イタスギ 板杉 +イタズリ 板摺 +イタセ 板瀬 +イタダ 板田 +イタダ 井唯 +イタダカ 板高 +イタダキ 頂 +イタダテ 犹館 +イタタニ 板谷 +イタダニ 板谷 +イダチ 井立 +イダチ 居立 +イタチカワ 鼬川 +イタチダ 井立田 +イタチヤマ 猪立山 +イタツ 板津 +イタツ 井立 +イタツ 井辰 +イタヅ 板津 +イダツ 井達 +イタヅケ 板付 +イタツダ 井立田 +イタヅロ 板津呂 +イダテ 井達 +イダテ 井立 +イダテ 犹館 +イダテ 居館 +イダテ 伊舘 +イダテ 居舘 +イタテヤマ 猪立山 +イタデラ 板寺 +イタド 板戸 +イタトコ 板床 +イタドコ 板床 +イタドノ 板殿 +イタトリ 板取 +イタトリ 板鳥 +イタドリ 虎杖 +イタドリ 板鳥 +イタドリ 虎枝 +イタナガ 板永 +イタナミ 板並 +イタナミ 板波 +イタナミ 板浪 +イタニ 井谷 +イタニ 猪谷 +イタニ 伊谷 +イタニ 井澗 +イタニ 庵谷 +イタニ 居谷 +イタニ 井渓 +イタニ 鋳谷(鑄谷) +イタニ 夷谷 +イタニ 衣谷 +イタニ 射谷 +イタニ 井溪 +イタニ 倭谷 +イダニ 井谷 +イダニ 猪谷 +イダニ 伊谷 +イダニ 鋳谷(鑄谷) +イダニ 井足 +イタニシ 板西 +イタニワ 板庭 +イタネ 板根 +イダネ 経種 +イダネ 經種 +イタノ 板野 +イタノリ 板乗 +イタハ 板羽 +イタバ 板場 +イタバ 板羽 +イタバ 伊多波 +イタバ 板塲 +イタハシ 板橋 +イタバシ 板橋 +イタバシ 板槁 +イタバシ 板端 +イタハチ 板八 +イタハナ 板鼻 +イタハナ 板花 +イタバナ 板鼻 +イタバナ 板花 +イタバヤシ 板林 +イタハラ 板原 +イタハラ 井多原 +イタビサシ 板庇 +イタヒラ 板平 +イタフジ 板藤 +イタブチ 板渕 +イタブチ 板淵 +イタベ 板部 +イタベ 板辺(板邊) +イタマ 板間 +イダマ 伊玉 +イダマ 井玉 +イタマス 板舛 +イタマス 板升 +イタマツ 板松 +イダマル 井田丸 +イタミ 伊丹 +イタミ 板見 +イタミ 井民 +イタミ 井丹 +イタミ 伊民 +イタミ 板美 +イタミガワ 伊丹川 +イタミヤ 板宮 +イタミヤ 板見谷 +イタミヤ 伊丹谷 +イタミヤ 伊丹屋 +イタムラ 板村 +イタムロ 板室 +イタモチ 板持 +イタモト 板本 +イタモト 板元 +イタモリ 板森 +イタヤ 板谷 +イタヤ 板屋 +イタヤ 板矢 +イタヤ 板家 +イタヤ 伊田屋 +イタヤ 板箭 +イタヤ 井太家 +イダヤ 井田屋 +イタヤコシ 板屋越 +イタヤゴシ 板屋越 +イタヤゴシ 板谷越 +イタヤジ 板屋地 +イタヤス 板保 +イタヤマ 板山 +イタヤマ 伊田山 +イタラシキ 板良敷 +イタリ 井足 +イタル 井樽 +イタル 至 +イタロク 板緑 +イタワキ 板脇 +イタワリ 板割 +イタン 伊丹 +イチ 市 +イチ 伊地 +イチ 一 +イチ 伊智 +イチ 位地 +イチ 伊千 +イヂ 井地 +イヂ 位地 +イチア 一阿 +イチアキ 市明 +イチアン 一庵 +イチイ 一井 +イチイ 市井 +イチイ 市位 +イチイ 一居 +イチイ 市居 +イチイ 檪 +イチイ 櫟 +イチイカワ 市井川 +イチイケ 市池 +イチイシ 一石 +イチイシ 市石 +イチイズミ 一泉 +イチイセ 市井瀬 +イチイダ 檪田 +イチイダ 櫟田 +イチイワ 一岩 +イチウ 一宇 +イチウエ 一上 +イチウジ 一氏 +イチウチ 市内 +イチウチ 一内 +イチウマ 一馬 +イチウミ 一海 +イチウラ 市浦 +イチウラ 一浦 +イチウラ 市裏 +イチエ 市江 +イチエ 一江 +イチエ 市栄 +イチエ 一栄 +イチエ 市榮 +イチエダ 市枝 +イチエダ 一枝 +イチエン 一円 +イチエン 一圓 +イチオ 一尾 +イチオ 市尾 +イチオカ 市岡 +イチオカ 一岡 +イチオン 一恩 +イチカ 市加 +イチガ 市賀 +イチカイ 一海 +イチガキ 一垣 +イチガキ 一柿 +イチカク 市角 +イチカサ 一笠 +イチガサ 一笠 +イチガシラ 市頭 +イチガセキ 市ケ関 +イチカタ 一肩 +イチカタイ 一方井 +イチガタニ 市ケ谷 +イチガツボ 市ケ坪 +イチカド 一門 +イチカド 市門 +イチカネ 市兼 +イチカネ 市金 +イチカブト 一兜 +イチカミ 一上 +イチカミ 市上 +イチガミ 一上 +イチガミ 一神 +イチガヤ 市谷 +イチガヤ 市ケ谷 +イチカリ 一刈 +イチカワ 市川 +イチカワ 一川 +イチカワ 市河 +イチカワ 依知川 +イチカワ 一河 +イチカワ 市側 +イチカワ 伊知川 +イチカワ 衣知川 +イチガワラ 市河原 +イチガン 一願 +イチカンダ 壱貫田 +イチキ 一木 +イチキ 市来 +イチキ 市木 +イチキ 檪 +イチキ 櫟 +イチキ 市來 +イチキ 檪木 +イチキ 一樹 +イチキ 櫟木 +イチキ 一鬼 +イチキ 一城 +イチキ 一岐 +イチキ 市耒 +イチキ 一来 +イチギ 一木 +イチギ 市木 +イチギ 櫟木 +イチキザキ 市来崎(市來崎) +イチキザキ 市木嵜 +イチキザキ 市木崎 +イチキザキ 市来嵜(市耒嵜) +イチキザキ 市耒崎 +イチキタ 一北 +イチキド 一木戸 +イチキハラ 市来原(市耒原) +イチギュウ 一牛 +イチキリ 一桐 +イチク 一玖 +イチク 市玖 +イチグチ 市口 +イチグチ 一口 +イチクニ 一国 +イチクニ 一國 +イチクボ 一久保 +イチクミ 一与 +イチクミ 一與 +イチクラ 一倉 +イチクラ 市倉 +イチクワタ 一鍬田 +イチクワダ 一鍬田 +イチグン 一郡 +イチケ 市毛 +イチゲ 市毛 +イチゲ 一毛 +イチコ 市古 +イチコ 市子 +イチゴ 市古 +イチゴ 市後 +イチゴ 一后 +イチゴ 一期 +イチコウ 一興 +イチゴウ 一郷 +イチゴウ 壱郷 +イチコウジ 一小路 +イチコク 一石 +イチゴサキ 一期崎 +イチゴザキ 一期崎 +イチゴザキ 市後崎 +イチコシ 一越 +イチコジマ 一児島 +イチコジマ 市子島 +イチコジマ 市子嶋 +イチゴタニ 苺谷 +イチゴタニ 莓谷 +イチコハラ 盆子原 +イチコハラ 市子原 +イチゴハラ 盆子原 +イチゴバラ 盆子原 +イチコマ 一駒 +イチサ 市佐 +イチザ 市座 +イチサカ 一坂 +イチサカ 市坂 +イチサカ 一阪 +イチサキ 市崎 +イチサキ 壱崎 +イチサキ 一崎 +イチサキ 壹崎 +イチザキ 市崎 +イチザキ 壱崎 +イチザキ 一崎 +イチサキノ 市崎野 +イチサコ 市峪 +イチサト 市里 +イチサワ 市沢 +イチサワ 一沢 +イチサワ 一澤 +イチサワ 市澤 +イチザワ 市沢 +イチザワ 一沢 +イチザワ 一澤 +イチザワ 市澤 +イチシ 一志 +イチシ 市礒 +イチジ 伊知地 +イチジ 市地 +イチジ 一二 +イチジ 逸持治 +イチジ 一次 +イチジ 伊智地 +イチジ 一事 +イチジク 一軸 +イチジク 九 +イチシタ 市下 +イチシタ 一下 +イチシバ 一芝 +イチシマ 市島 +イチシマ 市嶋 +イチシマ 一島 +イチシマ 一嶋 +イチシマ 一嶌 +イチジマ 市島 +イチジマ 入内島 +イチジマ 市嶋 +イチジマ 一島 +イチジマ 一嶌 +イチシメ 一住連 +イチジュウ 一重 +イチジュウアン 一植庵 +イチジュウバヤシ 一十林 +イチジョウ 一条 +イチジョウ 一條 +イチジョウ 一場(一塲) +イチジョウ 一乗(一乘) +イチジョウ 一城 +イチジョウ 一篠 +イチジョウ 一定 +イチジョウ 市条 +イチジリ 市尻 +イチジン 一陣 +イチスエ 市末 +イチズカ 市塚 +イチズカ 一塚 +イチスギ 一杉 +イチズミ 市角 +イチセ 一瀬 +イチセ 市瀬 +イチセ 市勢 +イチセ 一世 +イチセ 一畝 +イチセ 一勢 +イチセキ 一関(一關) +イチセキ 市堰 +イチゼン 市前 +イチゼン 一前 +イチソ 一噌 +イチゾエ 壱添 +イチゾエ 壹添 +イチゾノ 市園 +イチゾノ 市薗 +イチゾノ 市囿 +イチタ 市田 +イチタ 一田 +イチダ 市田 +イチダ 一田 +イチダ 伊地田 +イチダ 檪田 +イチダ 市太 +イチダ 櫟田 +イチダ 壱田 +イチダイ 市大 +イチタエ 市妙 +イチタカ 一鷹 +イチタカ 一高 +イチタケ 市竹 +イチダテ 一伊達 +イチタニ 一谷 +イチタニ 市谷 +イチタニ 壱谷 +イチタニ 壹谷 +イチタヤマ 一田山 +イチダヤマ 市田山 +イチタンダ 壱反田 +イチタンダ 壹反田 +イチヂ 伊知地 +イチヂ 市地 +イヂチ 伊地知 +イヂチ 伊知地 +イヂチ 伊地智 +イヂチ 伊秩 +イチヅ 市津 +イチツカ 市塚 +イチヅカ 市塚 +イチヅカ 一塚 +イチヅキ 一月 +イチツジ 市辻 +イチツボ 市坪 +イチツボ 一坪 +イチヅリ 一釣 +イチデラ 一寺 +イチト 市戸 +イチトウ 市東 +イチトウ 一藤 +イチドウ 一堂 +イチドウ 一道 +イチトウギ 一藤木 +イチトク 一徳 +イチトミ 一冨 +イチトミ 市富 +イチトミ 一富 +イチトミ 市冨 +イチドミ 一冨 +イチナ 市名 +イチナカ 市中 +イチナガ 一永 +イチナガ 市永 +イチナガ 市長 +イチナミ 市波 +イチナリ 市成 +イチニ 一二 +イチニシ 市西 +イチヌノ 一布 +イチネイ 市根井 +イチノ 市野 +イチノ 一野 +イチノ 市埜 +イチノイ 一井 +イチノイ 市野井 +イチノイ 一ノ井 +イチノウエ 一の上 +イチノウエ 一之上 +イチノエ 一戸 +イチノエダ 一ノ枝 +イチノオ 一ノ尾 +イチノカワ 市ノ川 +イチノカワ 市野川 +イチノカワ 市之川 +イチノカワ 一ノ川 +イチノカワ 市の川 +イチノキ 一ノ木 +イチノキ 檪 +イチノキ 櫟 +イチノキ 檪木 +イチノキ 一之木 +イチノキ 櫟木 +イチノキ 市ノ木 +イチノキ 市野木 +イチノキド 一ノ木戸 +イチノキヤマ 市ノ木山 +イチノキヤマ 市木山 +イチノクチ 一ノ口 +イチノクチ 一の口 +イチノクラ 一ノ倉 +イチノクラ 一の倉 +イチノコ 一ノ子 +イチノゴウ 市野郷 +イチノサワ 市野沢 +イチノサワ 一ノ沢 +イチノサワ 市ノ沢 +イチノサワ 市野澤 +イチノサワ 市ノ澤 +イチノサワ 一ノ澤 +イチノサワ 一之沢 +イチノサワ 一之澤 +イチノザワ 市野沢 +イチノザワ 市野澤 +イチノジ 一ノ字 +イチノシメ 一住連 +イチノセ 一ノ瀬 +イチノセ 一瀬 +イチノセ 市瀬 +イチノセ 一之瀬 +イチノセ 市之瀬 +イチノセ 市野瀬 +イチノセ 市ノ瀬 +イチノセ 一の瀬 +イチノセ 一野瀬 +イチノセ 一ノ清 +イチノセ 一ノ世 +イチノセ 一ノ勢 +イチノセ 一乃瀬 +イチノセ 市の瀬 +イチノセキ 一関(一關) +イチノセキ 一ノ関 +イチノセキ 一の関 +イチノダ 一ノ田 +イチノタニ 一ノ谷 +イチノタニ 一之谷 +イチノタニ 一の谷 +イチノツカ 市野塚 +イチノヅカ 市野塚 +イチノツボ 一坪 +イチノツボ 一ノ坪 +イチノツボ 一野坪 +イチノツボ 市之坪 +イチノツボ 一の坪 +イチノナ 一ノ名 +イチノハ 市ノ羽 +イチノハサマ 一迫 +イチノハシ 一ノ橋 +イチノハラ 一ノ原 +イチノヘ 一戸 +イチノヘ 市戸 +イチノヘ 一ノ戸 +イチノベ 市辺(市邊) +イチノベ 一野辺(一野邊) +イチノベ 市延 +イチノベ 市邉 +イチノホ 一ノ穂 +イチノホ 一廼穂 +イチノマ 一ノ間 +イチノミヤ 一宮 +イチノミヤ 一ノ宮 +イチノミヤ 市之宮 +イチノミヤ 一の宮 +イチノミヤ 一之宮 +イチノミヤ 一都 +イチノモト 一ノ本 +イチノモト 檪本 +イチノモト 櫟本 +イチノモト 一野本 +イチノモリ 一之森 +イチノヤ 一ノ谷 +イチノヤ 一之谷 +イチノヤ 一野谷 +イチノヤ 一ノ矢 +イチノヤマ 一ノ山 +イチノワタリ 一ノ渡 +イチノワタリ 市ノ渡 +イチノワタリ 一の渡 +イチノワタリ 市野渡 +イチハ 市葉 +イチハ 一羽 +イチバ 市場 +イチバ 一場 +イチバ 市葉 +イチバ 市坡 +イチバ 市塲 +イチバカセ 一番ケ瀬 +イチバガセ 一番ケ瀬 +イチバガセ 一番合戦 +イチハサマ 一迫 +イチハザマ 一迫 +イチハシ 市橋 +イチハシ 一橋 +イチハシ 壱橋 +イチハシ 市槁 +イチハシ 壹橋 +イチバシ 市橋 +イチハタ 一幡 +イチハタ 市畑 +イチハタ 一籏 +イチバタニ 市場谷 +イチハナ 一花 +イチハナ 市花 +イチハナ 市塙 +イチハマ 市浜 +イチハマ 市濱 +イチバヤ 市場谷 +イチバヤ 市場屋 +イチバヤシ 市林 +イチバヤシ 一林 +イチハラ 市原 +イチハラ 一原 +イチハラ 都原 +イチハラ 檪原 +イチハラ 櫟原 +イチバラ 櫟原 +イチハリ 一針 +イチバンガセ 一番ケ瀬 +イチバンガッセン 一番合戦 +イチバンボシ 一番星 +イチバンヤ 一番屋 +イチヒ 一樋 +イチヒト 市人 +イチヒメ 市姫 +イチヒラ 市平 +イチヒラ 一平 +イチヒロ 一広 +イチヒロ 一廣 +イチフ 市布 +イチブ 一部 +イチブ 都部 +イチブカタ 一分片 +イチフジ 一藤 +イチフジ 一富士 +イチフジ 市藤 +イチブツ 一仏 +イチブツ 一佛 +イチフル 市古 +イチベ 市辺(市邊) +イチベ 市部 +イチベ 市邉 +イチホ 市穂 +イチボ 市保 +イチボウ 一坊 +イチホウシ 一法師 +イチボウジ 一坊寺 +イチホシ 一星 +イチボシ 一星 +イチホリ 市堀 +イチボリ 市堀 +イチマ 市間 +イチマ 一間 +イチマイダ 一枚田 +イチマエ 市前 +イチマサ 一政 +イチマサ 市政 +イチマス 一桝 +イチマタ 一万田 +イチマタ 一又 +イチマタ 一萬田 +イチマダ 一万田 +イチマチ 市町 +イチマツ 一松 +イチマル 市丸 +イチマル 一丸 +イチマル 一圓 +イチマン 一幡 +イチマンダ 一万田 +イチマンダ 市万田 +イチミ 一見 +イチミ 一美 +イチミ 一味 +イチミ 市味 +イチミズ 一水 +イチミゾ 一溝 +イチミチ 市道 +イチミナミ 市南 +イチミヤ 一宮 +イチミヤ 市宮 +イチミョウ 市妙 +イチミョウ 一明 +イチミョウ 市名 +イチムネ 一棟 +イチムラ 市村 +イチムラ 一村 +イチムラ 市邨 +イチムラ 壱村(壹村) +イチムラ 一邨 +イチムラモト 市村元 +イチムロ 市室 +イチメイ 一明 +イチメン 一面 +イチモト 市本 +イチモト 一本 +イチモト 檪本 +イチモト 市元 +イチモト 一元 +イチモト 櫟本 +イチモノ 市物 +イチモリ 一森 +イチモリ 市森 +イチモリ 一守 +イチモリ 一盛 +イチモリ 市守 +イチモリ 櫟森 +イチモリ 檪森 +イチモン 市紋 +イチモンジ 一文字 +イチヤ 一谷 +イチヤ 市谷 +イチヤ 一箭 +イチヤ 壱谷 +イチヤ 一矢 +イチヤ 市屋 +イチヤ 壹谷 +イチヤギ 一柳 +イチヤス 一安 +イチヤナギ 一柳 +イチヤナギ 壱柳 +イチヤブ 一薮 +イチヤマ 市山 +イチヤマ 一山 +イチヤマ 檪山 +イチヤマ 伊地山 +イチヤマ 櫟山 +イチュウ 井中 +イチョウ 銀杏 +イチョウ 井長 +イチョウ 鴨脚 +イチョウ 伊調 +イチョウ 居長 +イチョウダ 銀杏田 +イチョウダ 伊帳田 +イチョウハラ 井長原 +イチョウハラ 居長原 +イチヨシ 市吉 +イチヨシ 一由 +イチヨシ 一吉 +イチラク 一楽 +イチラク 市楽 +イチラク 一樂 +イチリキ 一力 +イチリゴシ 一里越 +イチリヅカ 一里塚 +イチリヤマ 一里山 +イチリュウ 一柳 +イチロ 市呂 +イチロ 一路 +イチロウ 一老 +イチロウマル 一郎丸 +イチロク 市六 +イチワ 一和 +イチワ 一羽 +イチワ 市輪 +イチワキ 市脇 +イチワキ 一脇 +イチワタ 一和多 +イチワダ 一和田 +イチワタリ 市渡 +イチワタリ 一渡 +イチワラ 一藁 +イツ 井津 +イヅ 伊津 +イヅ 井津 +イツアキ 五明 +イツイ 五井 +イツイ 伍井 +イツイ 伊津井 +イツイ 井対 +イツイ 井津井 +イツイ 井對 +イヅイ 出井 +イヅイ 伊津井 +イヅイ 井津井 +イツウ 井通 +イツウ 伊通 +イツウ 射通 +イツウラ 五浦 +イツエ 生津江 +イヅエ 出江 +イッカ 一家 +イッカ 一花 +イッカ 一華 +イツカ 井塚 +イツカ 伊塚 +イツカ 夷塚 +イツカ 五鹿 +イヅカ 井塚 +イヅカ 猪塚 +イヅカ 伊塚 +イヅカ 狄塚 +イヅカ 居塚 +イヅカ 蕏塚 +イッカイ 一海 +イッカイ 一階 +イツカイチ 五日市 +イツガキ 井津垣 +イッカク 一角 +イッカク 一霍 +イツカゲ 五影 +イヅカシ 厳樫 +イヅカシ 巌樫 +イッカタイ 一方井 +イツガミ 伍上 +イヅガミ 井津上 +イッカワ 一河 +イツカワ 井津川 +イツカワ 逸川 +イッカンザカ 一貫坂 +イッカンダ 壱貫田 +イッカンダ 一貫田 +イッカンダ 壹貫田 +イッキ 一木 +イッキ 壱岐 +イッキ 一樹 +イッキ 一鬼 +イツキ 一木 +イツキ 斎 +イツキ 伊月 +イツキ 斉 +イツキ 齋 +イツキ 居附 +イツキ 斉宮 +イツキ 五木 +イツキ 斎宮 +イツキ 伊槻 +イツキ 逸木 +イツキ 居月 +イツキ 齊 +イツキ 五城 +イツキ 齋宮 +イツキ 井津木 +イツキ 居築 +イツキ 齊宮 +イツキ 伊規 +イツキ 井槻 +イツギ 伊次 +イヅキ 伊月 +イヅキ 居附 +イヅキ 井月 +イヅキ 伊築 +イヅキ 藺月 +イッキュウ 一久 +イッキョウ 一鏡 +イック 一宮 +イツグ 井次 +イツクシマ 厳島(嚴島) +イツクシマ 厳嶋(嚴嶋) +イツクマ 五熊 +イヅクラ 伊豆蔵 +イヅクラ 伊豆藏 +イヅクリ 居作 +イッケ 一家 +イッケ 一華 +イッコ 一戸 +イッコウ 一口 +イッコウ 一向 +イッコウ 一甲 +イッコウ 一光 +イッコク 一石 +イッコク 一国 +イヅサカ 泉阪 +イツサキ 逸崎 +イツザキ 逸崎 +イッサク 一作 +イッシ 一志 +イッシ 一司 +イッシ 一弛 +イツジ 井辻 +イツジ 逸持治 +イツジ 伊辻 +イッシキ 一色 +イッシキ 一式 +イッシキ 逸色 +イッシキダ 一色田 +イツシマ 五島 +イツシマ 五嶋 +イッシャ 一社 +イッシャ 一鷓 +イッシン 一新 +イッシン 一身 +イッシン 一心 +イッセ 一瀬 +イツセ 五瀬 +イッセキ 一関(一關) +イッセキ 市堰 +イッソウ 一噌 +イッソウ 一双 +イッソウ 一湊 +イッソウ 一増 +イッタ 一田 +イツタ 伊津田 +イツダ 五田 +イヅタ 出田 +イヅタ 伊津田 +イッタク 一宅 +イヅタニ 泉谷 +イッタンダ 一反田 +イッタンダ 壱反田 +イッタンダ 壹反田 +イッチ 一地 +イヅチ 井土 +イヅチ 出地 +イヅチ 伊秩 +イヅチ 井槌 +イッチョウ 一町 +イッチョウ 一蝶 +イッチョウ 壱丁 +イッチョウ 壹丁 +イッチョウダ 一町田 +イッチョウダ 一丁田 +イッチョウダ 壱丁田 +イッチョウハタ 一丁畑 +イッチョウバタ 壹町畠 +イツツ 井筒 +イヅツ 井筒 +イヅツ 井 +イツツジ 五辻 +イヅツタニ 井筒谷 +イヅツミ 井堤 +イヅツヤ 井筒谷 +イヅツヤ 井筒屋 +イッテキ 一滴 +イッテキ 一適 +イッテツ 一鉄 +イッテツ 一鐵 +イット 一戸 +イット 一斗 +イット 一登 +イットウ 一藤 +イットウ 一刀 +イットウ 壱東 +イットウギ 一藤木 +イットク 一徳 +イヅナ 伊豆名 +イヅナ 井綱 +イツノ 伊津野 +イツノ 五野 +イツノ 逸野 +イヅノ 伊津野 +イヅノ 井津野 +イヅノメ 泉妻 +イツハ 一葉 +イツバ 伊鍔 +イヅハ 出羽 +イッパイモリ 一盃森 +イツバキ 居椿 +イヅハシ 伊豆橋 +イヅハタ 井津端 +イツバヤシ 五林 +イツハラ 逸原 +イヅハラ 泉原 +イヅハラ 厳原 +イッピツ 一筆 +イッピョウ 一瓢 +イヅブチ 出渕 +イップリ 一振 +イッペン 一片 +イツボ 井坪 +イツボ 伊坪 +イツボ 伊壷 +イツボ 井壷 +イツボ 伊壺 +イッポウ 一宝 +イッポウ 一寶 +イッポウ 一寳 +イッポウイ 一方井 +イッポウシ 一法師 +イッポウジ 一坊寺 +イッポウジ 一峯寺(一峰寺) +イッポウズミ 一方隅 +イッポンギ 一本木 +イッポンジマ 一本嶋 +イッポンジマ 一本島 +イッポンスギ 一本杉 +イッポンマツ 一本松 +イッポンヤナギ 一本柳 +イッポンヤリ 一本鎗 +イッポンヤリ 一本槍 +イツマ 逸馬 +イヅマ 出間 +イヅマ 伊妻 +イヅマ 出馬 +イヅマ 猪妻 +イツミ 逸見 +イツミ 伊津見 +イツミ 五三 +イツミ 逸水 +イツミ 五見 +イツミ 逸身 +イツミ 五海 +イヅミ 泉 +イヅミ 和泉 +イヅミ 出水 +イヅミ 出海 +イヅミ 伊積 +イヅミ 伊津見 +イヅミ 為積(爲積) +イヅミ 井積 +イヅミ 伊津美 +イヅミ 井津美 +イヅミカワ 泉川 +イツミダ 五味田 +イヅミダ 泉田 +イヅミダ 和泉田 +イヅミタニ 泉谷 +イツミネ 五峯 +イツミヤ 五宮 +イヅミヤ 泉谷 +イツムラ 逸村 +イツムラ 伊津村 +イヅメ 猪爪 +イヅメ 井爪 +イヅメ 井詰 +イヅモ 出雲 +イツモト 五本 +イツモト 逸本 +イヅモト 出本 +イヅモト 井津元 +イヅモト 伊津本 +イヅモト 井津本 +イヅモリ 何森 +イツヤマ 五山 +イツラ 五良 +イツル 居鶴 +イヅル 居鶴 +イヅル 伊鶴 +イツワ 五輪 +イヅワ 出羽 +イテ 井手 +イテ 射手 +イテ 伊手 +イデ 井手 +イデ 井出 +イデ 出 +イデ 射手 +イデ 伊出 +イデ 居出 +イデ 出手 +イテイ 以手井 +イデイ 出井 +イデイ 出射 +イデイ 出居 +イデイ 伊出井 +イデイシ 出石 +イテウエ 井手上 +イデウエ 井手上 +イデウエ 出上 +イデウエ 井出上 +イデウチ 井手内 +イデウチ 出内 +イデウラ 出浦 +イデオ 井手尾 +イデオ 井出尾 +イデオカ 井手岡 +イデオカ 井出岡 +イデカゴ 井手籠 +イデガサコ 出ケ迫 +イデガタ 出形 +イデガハラ 井手ケ原 +イテガミ 井手上 +イデガミ 井手上 +イデガミ 井出上 +イデガミ 居出上 +イデカワ 出川 +イデカワ 井手川 +イデガワ 出川 +イデガワ 出河 +イデガワ 井手川 +イデガワ 井出川 +イテグチ 井手口 +イデグチ 出口 +イデグチ 井手口 +イデグチ 井出口 +イデグチ 伊出口 +イデクボ 井手窪 +イデクラ 出倉 +イデコバ 出木場 +イデゴモリ 井手籠 +イデゴモリ 井手篭 +イデゴモリ 出籠 +イデゴモリ 出篭 +イデサオ 出竿 +イデザオ 出竿 +イデサカ 井手坂 +イデサキ 出崎 +イデサキ 井出崎 +イデザキ 井出崎 +イデサコ 井手迫 +イデサコ 井出迫 +イデサワ 出沢 +イデサワ 出澤 +イデサワ 井出澤 +イデザワ 出沢 +イデザワ 出澤 +イデザワ 井出沢 +イデザワ 井出澤 +イデシオ 出塩 +イデシゲ 井手重 +イデシタ 出下 +イデシタ 井手下 +イデシタ 居出下 +イデシタ 出手下 +イデシタ 井出下 +イデジリ 井出尻 +イデスナ 出砂 +イデセ 井手瀬 +イデソエ 井手添 +イデゾエ 井手添 +イテゾノ 射手園 +イテダ 井手田 +イデタ 出田 +イデタ 井手田 +イデタ 井出田 +イデタニ 出谷 +イデタニ 井手谷 +イデダン 井手段 +イデダン 井出段 +イデチ 出地 +イデツ 出津 +イデツカ 出塚 +イデヅカ 出塚 +イデツキ 出月 +イデヅキ 出月 +イデト 出戸 +イデナカ 井手中 +イデナガ 出永 +イデナガ 井手永 +イデナワ 出繩 +イデナワ 出縄 +イテニシ 井手西 +イデニシ 井手西 +イデヌマ 出沼 +イテノ 井手野 +イデノ 出野 +イデノ 井手野 +イデノ 井出野 +イデノ 出手野 +イデノウエ 井手之上 +イデノウエ 出野上 +イデノウエ 井手ノ上 +イデノウエ 井出之上 +イデノシタ 井手野下 +イデノセ 井手ノ瀬 +イデハシ 井手橋 +イデバシ 井手橋 +イデハタ 井手畑 +イデバタ 井手端 +イデバヤシ 井手林 +イデハラ 出原 +イデハラ 井手原 +イデハラ 井出原 +イデヒラ 出平 +イデヒラ 井手平 +イデブチ 出渕 +イデブチ 出淵 +イデブチ 井手渕 +イデブチ 井手淵 +イテマダニ 一天満谷 +イデマル 出丸 +イデミ 出水 +イデミズ 出水 +イデミツ 出光 +イデミツ 井手光 +イデミツ 出満 +イデミヤ 出宮 +イデムコ 井手向 +イデムラ 出村 +イデムラ 井出村 +イテモト 井手元 +イデモト 出本 +イデモト 井手本 +イデモト 井手元 +イデモト 井出本 +イデモト 出元 +イデモト 井出元 +イデモト 居出本 +イデモリ 出森 +イデモリ 出盛 +イテヤ 射手矢 +イテヤ 射手谷 +イデヤ 出家 +イデヤマ 出山 +イデヤマ 井手山 +イデヤマ 井出山 +イデヨシ 井手吉 +イデラ 井寺 +イデラ 出良 +イデラ 猪寺 +イデリハ 出利葉 +イデワキ 井手脇 +イデワキ 出脇 +イデン 井殿 +イデン 伊伝(伊傳) +イト 井戸 +イト 糸 +イト 怡土 +イト 伊都 +イト 伊戸 +イト 井登 +イト 伊登 +イト 系 +イト 井斗 +イト 一糸 +イド 井戸 +イド 井土 +イド 井門 +イド 怡土 +イド 居戸 +イド 伊戸 +イド 伊土 +イド 依戸 +イトイ 糸井 +イトイ 井樋 +イトイ 威徳井 +イトイ 糸居 +イドイ 飯土井 +イドイ 井土井 +イドイ 井戸井 +イドイエ 井戸家 +イトイガワ 糸魚川 +イトイガワ 糸井川 +イトイシ 糸石 +イトイネ 糸稲 +イトイリ 糸入 +イドイリ 井戸入 +イトウ 伊藤 +イトウ 伊東 +イトウ 井藤 +イトウ 井筒 +イトウ 依藤 +イトウ 井東 +イトウ 井頭 +イトウ 以頭 +イトウ 居藤 +イトウ 猪頭 +イトウ 夷藤 +イトウ 井登 +イトウ 伊籐 +イトウ 猪藤 +イトウ 藺藤 +イトウ 伊登 +イトウ 位頭 +イトウ 意東 +イトウ 翫 +イトウ 渭東 +イトウ 井籐 +イトウ 伊桐 +イトウ 伊頭 +イトウ 位藤 +イトウ 糸生 +イトウ 揖東 +イトウ 揖藤 +イドウ 井道 +イドウ 井堂 +イドウ 伊堂 +イドウ 井銅 +イドウエ 井戸上 +イトウガ 井藤賀 +イトウジ 糸氏 +イトウジ 伊藤寺 +イドウジ 伊堂寺 +イトウダ 伊藤田 +イトウダ 井藤田 +イドウダ 伊藤田 +イドウチ 井戸内 +イトウヅ 到津 +イトウヤマ 伊東山 +イドウラ 井戸浦 +イトオ 糸尾 +イトオカ 糸岡 +イドオカ 井戸岡 +イトガ 糸賀 +イトガ 糸雅 +イトガ 井戸賀 +イトガ 糸我 +イドガ 井戸賀 +イドガキ 井戸垣 +イドガキ 井土垣 +イドガシラ 井戸頭 +イトカズ 糸数(糸數) +イトカツ 糸勝 +イトガネ 糸金 +イドガミ 井戸上 +イトカワ 糸川(絲川) +イトカワ 井戸川 +イトカワ 伊戸川 +イトガワ 糸川(絲川) +イトガワ 井戸川 +イトガワ 伊戸川 +イドカワ 井戸川 +イドガワ 井戸川 +イドガワ 伊戸川 +イドガワ 井戸側 +イドガワ 井土川 +イトキ 糸木 +イトキ 糸岐 +イトキ 伊時 +イトギ 糸儀 +イドキ 井戸木 +イトク 伊得 +イトク 伊徳 +イトク 威徳 +イトク 井徳 +イトクイ 威徳井 +イトクジ 威徳寺 +イトクダ 伊徳田 +イトグチ 井戸口 +イトグチ 糸口 +イドグチ 井戸口 +イドクボ 井戸窪 +イトクリ 糸繰 +イトゲ 糸毛 +イトコ 井床 +イドコ 井床 +イトサカ 井戸坂 +イトサカ 糸坂 +イドサカ 井戸坂 +イドサカ 井戸阪 +イトサキ 糸崎 +イトザキ 糸崎 +イトザキ 井戸崎 +イドサキ 井戸崎 +イトサクラ 糸桜(糸櫻) +イトザクラ 糸桜(糸櫻) +イドサコ 井戸硲 +イドサコ 井戸浴 +イトサト 糸里 +イトサワ 糸沢 +イトサワ 糸澤 +イトザワ 糸沢 +イトザワ 糸澤 +イトザワ 井戸沢 +イトザワ 井戸澤 +イドサワ 井戸澤 +イドシタ 井戸下 +イドシタ 井土下 +イトシマ 糸島 +イトジマ 糸島 +イトジリ 井戸尻 +イトシロ 石徹白 +イトス 糸洲 +イトス 糸洌 +イトス 糸州 +イトスギ 糸杉 +イトセ 糸瀬 +イトソ 糸曽 +イトゾノ 糸園 +イトタ 糸田 +イトタ 糸多 +イトダ 井戸田 +イトダ 糸田 +イトダ 以登田 +イトダ 伊戸田 +イトダ 糸多 +イドタ 井戸田 +イドダ 井戸田 +イトタガワ 糸田川 +イトダガワ 糸田川 +イトタニ 糸谷 +イトダニ 糸谷 +イドタニ 井戸谷 +イトツカ 糸塚 +イトヅカ 糸塚 +イドツジ 井戸辻 +イトツボ 糸坪 +イトトザキ 糸戸崎 +イトナカ 糸中 +イトナガ 糸永 +イトナガ 糸長 +イドニシ 井戸西 +イドヌマ 井戸沼 +イドネ 井戸根 +イトノ 糸野 +イトノ 糸納 +イドノ 井殿 +イドノ 井戸野 +イドノウエ 井戸ノ上 +イドノウエ 井戸之上 +イドノモト 井戸ノ本 +イトノリ 糸乗 +イトノリ 糸乘 +イトハタ 糸畑 +イトバタ 井戸端 +イドハタ 井戸畑 +イドバタ 井戸端 +イドバタ 井戸畑 +イトハマ 糸浜 +イトハマ 糸濱 +イトハヤシ 糸林 +イトバヤシ 糸林 +イトハラ 糸原 +イトハラ 絲原 +イドハラ 井戸原 +イトヒ 糸日 +イトヒサ 糸久 +イトヒヤ 糸日谷 +イトヒラ 糸平 +イトビン 糸鬢 +イトフサ 糸房 +イトフサ 糸総 +イトフサ 糸總 +イトフジ 糸藤 +イドブチ 井戸渕 +イトベ 糸部 +イトベ 井戸辺(井戸邊・井戸邉) +イドベ 井戸辺(井戸邊・井戸邉) +イドマエ 井戸前 +イトマキ 糸巻 +イドマツ 伊戸松 +イドマリ 伊泊 +イトマン 糸満(糸滿) +イトミ 糸見 +イトミ 井富 +イトミ 伊富 +イトミ 伊臣 +イトミ 井冨 +イトミツ 糸満(糸滿) +イトミネ 糸嶺 +イドムカイ 井戸向 +イドムキ 井戸向 +イトムラ 糸村 +イトムラ 伊渡村 +イドムラ 井戸村 +イトメ 糸目 +イトメ 猪留 +イトモト 糸本 +イドモト 井戸本 +イドモト 井戸元 +イドモト 井土本 +イトモリ 糸森 +イトヤ 糸谷 +イトヤ 糸屋(絲屋) +イトヤ 糸矢 +イドヤ 井戸谷 +イドヤ 井戸屋 +イトヤナギ 糸柳 +イトヤマ 糸山(絲山) +イトヤマ 伊東山 +イドヤマ 井戸山 +イトヨク 糸浴 +イトリ 井鳥 +イトリ 居鳥 +イトリ 伊取 +イナ 伊奈 +イナ 稲 +イナ 衣奈 +イナ 井奈 +イナ 伊那 +イナ 伊名 +イナ 稲奈 +イナ 井名 +イナ 井那 +イナアシ 稲足 +イナイ 井内 +イナイ 稲井 +イナイ 伊内 +イナイ 稲飯 +イナイ 稲居 +イナイ 伊奈井 +イナイ 稻井 +イナイケ 稲池 +イナイシ 稲石 +イナイシ 稻石 +イナイズミ 稲泉(稻泉) +イナイダ 稲井田 +イナイダ 井内田 +イナウ 稲生 +イナウエ 稲植 +イナウダ 稲生田 +イナウチ 稲内 +イナウチ 稲打 +イナウラ 稲浦 +イナエ 稲江 +イナエ 稲栄(稲榮) +イナエダ 稲枝 +イナオ 稲生 +イナオ 稲尾 +イナオ 稲男 +イナオ 稻尾 +イナオカ 稲岡(稻岡) +イナオカ 伊名岡 +イナオカ 伊奈岡 +イナオキ 稲置 +イナオキ 稲沖 +イナオミ 稲臣 +イナカ 井中 +イナカ 伊中 +イナカ 田舎 +イナカ 伊仲 +イナカ 稲中 +イナカ 為中 +イナガ 伊永 +イナガ 居永 +イナガ 稲賀 +イナガ 井永 +イナガイ 稲海 +イナガイ 稲貝 +イナカガタ 田舎片 +イナカガタ 田舎方 +イナカギ 稲鍵 +イナガキ 稲垣 +イナガキ 稲墻(稲牆) +イナガキ 伊奈垣 +イナガキ 稻垣 +イナガキ 稲桓 +イナカケ 稲掛 +イナカゲ 稲蔭 +イナガケ 稲掛 +イナカズ 稲員 +イナカズ 稲数(稲數) +イナカズ 稻数 +イナガセ 稲ケ瀬 +イナガタ 稲形 +イナカツ 稲勝 +イナカド 稲門 +イナカベ 稲ケ部 +イナカミ 稲上(稻上) +イナガミ 稲上(稻上) +イナガミ 稲神 +イナカヤ 井中家 +イナカワ 稲川 +イナカワ 伊奈川 +イナガワ 稲川 +イナガワ 伊奈川 +イナガワ 鮄川 +イナガワ 猪名川 +イナガワ 稲河 +イナガワ 稻川 +イナキ 稲生 +イナキ 稲木 +イナキ 稲城 +イナキ 因来(因來) +イナキ 稻木 +イナギ 稲木 +イナギ 稲城 +イナギ 稲置 +イナギ 稲着(稻着) +イナギ 因来(因來) +イナギ 五安城 +イナギク 稲菊 +イナキド 稲木戸 +イナク 稲久 +イナクサ 稲草 +イナクサ 稲艸 +イナグサ 稲草 +イナグサ 稲艸 +イナグチ 稲口 +イナグチ 稻口 +イナクニ 稲国 +イナクボ 稲久保 +イナクボ 稲窪 +イナクマ 稲熊 +イナクマ 稲隈 +イナグマ 稲熊 +イナグマ 稻熊 +イナクラ 稲倉 +イナクラ 稲蔵(稲藏) +イナケ 稲毛 +イナケ 稲家 +イナゲ 稲毛 +イナゲ 稲家 +イナゲ 稻毛 +イナゲタ 稲毛田 +イナゲダ 稲毛田 +イナコ 稲子(稻子) +イナゴ 稲子(稻子) +イナコシ 稲越 +イナゴシ 稲越 +イナコダ 稲子田 +イナコヤ 稲子谷 +イナゴヤ 稲子谷 +イナサ 稲佐 +イナサカ 稲坂 +イナサカ 稲阪 +イナサキ 稲崎 +イナザキ 稲崎 +イナザキ 稲嵜 +イナザキ 稻崎 +イナサコ 稲迫 +イナサト 稲里 +イナザト 稲里 +イナサワ 稲沢 +イナサワ 稲澤(稻澤) +イナザワ 稲沢 +イナザワ 稲澤(稻澤) +イナザワ 鰰澤 +イナザワ 鰰沢 +イナジ 稲次(稻次) +イナジ 稲治 +イナジ 稲地 +イナシキ 稲敷 +イナシゲ 稲重 +イナシゲ 稲茂 +イナシマ 稲島 +イナシマ 稲嶋 +イナジマ 入内島 +イナジマ 稲島 +イナジマ 入内嶋 +イナジマ 稲嶋 +イナジマ 稲嶌 +イナシミズ 稲清水 +イナシロ 稲代 +イナズ 稲津 +イナズカ 稲塚(稻塚) +イナズマ 電 +イナズマチ 稲妻地 +イナズミ 稲積(稻積) +イナズミ 稲住 +イナズミ 稲角 +イナズミ 稻角 +イナセ 稲生 +イナセ 稲瀬 +イナゾノ 稲園 +イナタ 稲田 +イナタ 稻田 +イナダ 稲田 +イナダ 稲多 +イナダ 伊名田 +イナダ 稻田 +イナダ 伊奈田 +イナダ 鰰田 +イナダ 井灘 +イナダテ 稲舘 +イナダテ 稲館 +イナダテ 稲立 +イナタニ 稲谷 +イナタニ 稻谷 +イナダニ 稲谷 +イナタマ 稲玉 +イナダマ 稲玉 +イナダヤ 稲田屋 +イナチ 稲地 +イナツ 稲津 +イナヅ 稲津 +イナヅ 稻津 +イナツカ 稲塚(稻塚) +イナツカ 稲束 +イナヅカ 稲塚(稻塚) +イナヅカ 稲束 +イナヅカ 秂 +イナツキ 稲月 +イナツキ 稲付 +イナツキ 稲着(稻着) +イナツキ 稻月 +イナツギ 稲継 +イナツギ 稲次(稻次) +イナヅキ 稲月 +イナツグ 稲継 +イナツグ 稲次(稻次) +イナツグ 稻継 +イナツチ 稲土 +イナツネ 稲恒 +イナツネ 稲常 +イナヅマ 稲妻 +イナヅマチ 稲妻地 +イナヅミ 稲積(稻積) +イナヅル 稲鶴 +イナテ 稲手 +イナデ 稲手 +イナデ 稲出 +イナテラ 稲寺 +イナデラ 稲寺 +イナド 稲土 +イナド 稲戸 +イナドウマル 稲童丸 +イナドウマル 稲堂丸 +イナドウマル 稲動丸 +イナドノ 稲殿 +イナトミ 稲富 +イナトミ 稲冨 +イナトミ 猪名富 +イナトミ 稲臣 +イナトミ 稲宝 +イナトミ 猪名冨 +イナトミ 稻富 +イナドミ 稲富 +イナドミ 稲冨 +イナドミ 猪名富 +イナドミ 猪名冨 +イナトメ 稲留(稲畄) +イナドメ 稲留(稲畄) +イナドメ 稻留 +イナトヨ 稲豊 +イナトリ 稲取 +イナナ 稲名 +イナナカ 稲中 +イナナガ 稲永 +イナナガ 稻永 +イナナベ 稲鍋 +イナナミ 稲波(稻波) +イナナミ 稲浪 +イナナミ 稲並 +イナニ 稲仁 +イナニシ 稲西 +イナニワ 稲庭 +イナヌマ 稲沼 +イナネ 稲根 +イナノ 稲野 +イナノ 伊奈野 +イナノ 伊名野 +イナノ 稲納 +イナノ 稲農 +イナノブ 稲延(稻延) +イナノベ 稲野辺(稻野辺) +イナノベ 稲延(稻延) +イナノベ 稲野邉 +イナノベ 稲野邊 +イナハ 稲葉 +イナバ 稲葉 +イナバ 稲場(稲塲) +イナバ 因幡 +イナバ 稲波(稻波) +イナバ 稲庭 +イナバ 井奈波 +イナバ 伊名波 +イナバ 稻葉 +イナバ 伊奈葉 +イナバ 稲奈葉 +イナバ 稲仈 +イナバ 因庭 +イナバ 鰍場 +イナバ 稻場 +イナハシ 稲橋 +イナハシ 稲箸 +イナバシタ 稲端下 +イナハタ 稲畑 +イナハタ 稲端 +イナハタ 稲畠 +イナバタ 稲畑 +イナバタ 稲端 +イナバタニ 稲葉谷 +イナハマ 稲浜 +イナハマ 稲濱 +イナバヤシ 稲林 +イナバヤシ 稻林 +イナハラ 稲原 +イナハラ 猪名原 +イナハラ 稻原 +イナビ 磹 +イナビキ 稲引 +イナブ 稲生 +イナフク 稲福(稻福) +イナフサ 稲房 +イナフジ 稲藤 +イナブチ 稲淵 +イナブチ 稲渕 +イナフネ 稲船 +イナフネ 稲舟 +イナフネ 稲舩 +イナフネ 稻船 +イナベ 稲辺 +イナベ 稲部 +イナベ 井鍋 +イナベ 鋳鍋 +イナベ 伊鍋 +イナベ 稲邊(稻邊) +イナベ 稲邉 +イナベ 稲返 +イナベ 員弁 +イナベ 鑄鍋 +イナベツ 稲別 +イナホ 稲穂(稲穗) +イナホ 稲豊 +イナホシ 稲干 +イナホシ 稲星 +イナボリ 稲堀 +イナマエ 稲前 +イナマサ 稲政 +イナマサ 稲昌 +イナマス 稲益(稻益) +イナマス 稲増 +イナマス 稲桝 +イナマス 稲舛 +イナマス 稲枡 +イナマタ 稲又 +イナマタ 稲股 +イナマツ 稲松 +イナマル 稲丸 +イナミ 伊波 +イナミ 稲見 +イナミ 印南 +イナミ 井波 +イナミ 稲波(稻波) +イナミ 井浪 +イナミ 伊南 +イナミ 居波 +イナミ 井並 +イナミ 井南 +イナミ 稲実 +イナミ 稲美 +イナミ 伊並 +イナミ 伊浪 +イナミ 稲味 +イナミ 以南 +イナミ 伊奈見 +イナミ 位並 +イナミ 井涛 +イナミ 稲實 +イナミ 猪波 +イナミ 猪浪 +イナミジマ 生浪島 +イナミズ 稲水 +イナミツ 稲光 +イナミツ 稲満 +イナミネ 稲嶺(稻嶺) +イナミネ 稲峰 +イナミネ 稲峯 +イナミネ 稲領 +イナミヤ 稲宮 +イナミヤ 井波屋 +イナミヤ 井波谷 +イナムカイ 稲向 +イナムキ 稲向 +イナムラ 稲村 +イナムラ 稲邑 +イナムラ 猪名村 +イナムラ 稻村 +イナムロ 稲室 +イナメ 稲目 +イナモ 稲毛 +イナモチ 稲用 +イナモチ 稲餅 +イナモチ 稲持 +イナモト 稲本 +イナモト 稲元 +イナモト 稲茂登 +イナモト 稻本 +イナモリ 稲森 +イナモリ 稲盛 +イナモリ 稲守 +イナモリ 稻森 +イナヤ 稲谷 +イナヤ 稲家 +イナヤ 稲屋 +イナヤ 稲邪 +イナヤス 稲安 +イナヤブ 稲薮 +イナヤブ 稲藪 +イナヤマ 稲山(稻山) +イナヤマ 伊奈山 +イナヨシ 稲吉(稻吉) +イナヨシ 稲好 +イナヨセ 稲寄 +イナヨリ 稲寄 +イナリ 稲荷 +イナリ 伊成 +イナリ 居也 +イナリ 井成 +イナリ 稲成 +イナリ 居成 +イナリサコ 稲荷迫 +イナリダ 稲荷田 +イナリタイ 稲荷平 +イナリダイラ 稲荷平 +イナリバ 稲荷場 +イナリバ 稲何場 +イナリヒラ 稲荷平 +イナリモリ 稲荷森 +イナリヤマ 稲荷山 +イナワ 稲輪 +イナワ 稲和 +イナワカ 稲若 +イナワキ 稲脇 +イナワシロ 猪苗代 +イナワシロ 稲苗代 +イナン 井南 +イニ 井仁 +イニシ 井西 +イニシ 伊西 +イニシ 猪西 +イニシグチ 伊西口 +イニワ 伊庭 +イニワ 五百磐 +イヌイ 乾 +イヌイ 猪井 +イヌイ 犬井 +イヌイ 戌亥 +イヌイ 伊縫 +イヌイ 乾井 +イヌイ 犬居 +イヌイ 戍亥 +イヌイ 狗井 +イヌイ 戌井 +イヌイ 戊亥 +イヌイカワ 乾川 +イヌイグチ 乾口 +イヌイザワ 乾沢 +イヌイザワ 乾澤 +イヌイシ 犬石 +イヌイジョウ 乾条 +イヌイジョウ 乾條 +イヌイダ 乾田 +イヌイタニ 乾谷 +イヌイダニ 乾谷 +イヌイナカ 乾中 +イヌイノ 乾野 +イヌイハラ 乾原 +イヌイヤ 乾谷 +イヌウラ 犬浦 +イヌエ 犬江 +イヌオ 犬尾 +イヌオキ 犬置 +イヌガ 犬賀 +イヌカイ 犬飼 +イヌカイ 狗飼 +イヌカイ 犬養 +イヌカイ 犬貝 +イヌカイ 犬甘 +イヌガイ 犬飼 +イヌガイ 狗飼 +イヌガイ 犬養 +イヌガイ 犬貝 +イヌカミ 犬上 +イヌガミ 犬上 +イヌカワ 狗川 +イヌカワ 犬川 +イヌキ 犬木 +イヌキ 井貫 +イヌキ 五貫 +イヌクボ 犬窪 +イヌゲ 犬毛 +イヌシ 井主 +イヌシマ 犬島 +イヌシマ 犬嶋 +イヌジマ 犬島 +イヌジマ 犬嶋 +イヌジマ 犬嶌 +イヌズカ 犬塚 +イヌズミ 戌角 +イヌタ 犬田 +イヌタ 狗田 +イヌダ 犬田 +イヌタケ 犬竹 +イヌタニ 犬谷 +イヌタニ 戌谷 +イヌツカ 犬塚 +イヌツカ 犬束 +イヌヅカ 犬塚 +イヌヅカ 犬束 +イヌヅメ 戌爪 +イヌドウ 犬童 +イヌドウ 犬藤 +イヌドウ 犬銅 +イヌドウ 犬堂 +イヌハシリ 犬走 +イヌバシリ 犬走 +イヌババ 犬馬場 +イヌハラ 犬原 +イヌヒキ 犬牽 +イヌフサ 犬房 +イヌフシ 犬伏 +イヌブシ 犬伏 +イヌブセ 犬伏 +イヌブチ 犬渕 +イヌブチ 犬淵 +イヌベ 乾辺 +イヌボシ 犬星 +イヌマ 井沼 +イヌマ 犬間 +イヌマ 伊沼 +イヌマエ 藺沼江 +イヌマキ 狗巻 +イヌマキ 犬巻 +イヌマタ 犬亦 +イヌマタ 井沼田 +イヌマタ 犬股 +イヌマタ 狗又 +イヌマダ 井沼田 +イヌマル 犬丸 +イヌマル 戍丸 +イヌマル 戌丸 +イヌミ 犬見 +イヌムラ 犬村 +イヌモチ 犬持 +イヌモト 犬本 +イヌヤマ 犬山 +イヌヤマ 乾山 +イネ 稲 +イネ 井根 +イネ 伊根 +イネ 井値 +イネイ 稲井 +イネイ 江井 +イネオカ 稲岡(稻岡) +イネカド 稲角 +イネグチ 井根口 +イネザワ 稲澤(稻澤) +イネシタ 稲下 +イネダ 稲田 +イネナ 稲名 +イネナカ 稲中 +イネナカ 稲仲 +イネナガ 稲永 +イネナガ 稻永 +イネナミ 稲並 +イネノ 稲野 +イネハラ 稲原 +イネモト 井根本 +イネヤマ 稲山(稻山) +イノ 井野 +イノ 猪野 +イノ 伊野 +イノ 猪 +イノ 井埜 +イノ 井箟 +イノ 亥野 +イノ 井之 +イノ 亥埜 +イノ 井箆 +イノアシ 猪足 +イノイ 猪井 +イノイ 家井 +イノイ 伊之井 +イノイ 井ノ井 +イノイ 猪居 +イノイエ 井家 +イノイエ 居野家 +イノイエ 井野家 +イノイケ 井生 +イノイケ 井池 +イノイケ 猪池 +イノイシ 猪石 +イノイチ 井ノ一 +イノイチ 井一 +イノウ 稲生 +イノウ 伊能 +イノウ 伊納 +イノウ 井能 +イノウ 井納 +イノウ 井箟 +イノウ 威能 +イノウ 稲納 +イノウ 井箆 +イノウ 稻生 +イノウエ 井上 +イノウエ 井之上 +イノウエ 井ノ上 +イノウエ 猪上 +イノウエ 居上 +イノウエ 井野上 +イノウエ 井植 +イノウエ 伊上 +イノウエ 猪ノ上 +イノウエ 伊野上 +イノウエ 藺上 +イノウエ 猪植 +イノウエ 以野上 +イノウエ 亥上 +イノウエ 家ノ上 +イノウエ 居野上 +イノウエ 伊ノ上 +イノウチ 井内 +イノウチ 井ノ内 +イノウチ 猪内 +イノウチ 井野内 +イノウチ 井之内 +イノウチ 井濃内 +イノウラ 井浦 +イノウラ 猪浦 +イノウラ 井ノ浦 +イノウラ 井之浦 +イノウヱ 井上 +イノエ 井ノ江 +イノエ 井江 +イノエ 猪江 +イノオ 飯尾 +イノオ 稲生 +イノオ 井尾 +イノオ 猪尾 +イノオ 井ノ尾 +イノオ 伊野尾 +イノオ 井之尾 +イノオ 猪野尾 +イノオ 猪之尾 +イノオカ 井岡 +イノオカ 猪岡 +イノオカ 井野岡 +イノオカ 井ノ岡 +イノオク 井奥 +イノオク 猪奥 +イノオク 猪之奥 +イノカイ 猪飼 +イノカイ 猪貝 +イノガイ 猪飼 +イノガイ 猪貝 +イノカケ 猪掛 +イノカケ 猪懸 +イノカミ 猪上 +イノカミ 井神 +イノガミ 猪上 +イノカリ 猪狩 +イノカワ 猪川 +イノカワ 井ノ川 +イノカワ 井野川 +イノカワ 井之川 +イノカワ 亥川 +イノカワ 井上川 +イノキ 猪木 +イノキ 井木 +イノキ 井城 +イノキ 居軒 +イノキ 猪野木 +イノキ 伊野木 +イノキ 井野木 +イノキ 位野木 +イノキ 猪之木 +イノキ 伊ノ木 +イノキ 井ノ木 +イノキ 猪ノ木 +イノギ 依野木 +イノキザコ 猪木迫 +イノキハラ 猪木原 +イノクチ 井口 +イノクチ 猪口 +イノクチ 井ノ口 +イノクチ 井野口 +イノクチ 井之口 +イノクチ 猪ノ口 +イノクチ 伊之口 +イノクチ 猪之口 +イノクチ 井の口 +イノグチ 井口 +イノグチ 猪口 +イノグチ 井ノ口 +イノグチ 井野口 +イノグチ 井之口 +イノグチ 猪ノ口 +イノグチ 伊之口 +イノグチ 伊野口 +イノグチ 井の口 +イノクボ 猪久保 +イノクボ 井ノ久保 +イノクボ 猪窪 +イノクボ 猪之窪 +イノクマ 猪熊 +イノクマ 猪野熊 +イノクラ 井倉 +イノクラ 猪倉 +イノクラ 井ノ倉 +イノクラ 井ノ蔵 +イノクラ 井ノ藏 +イノクラ 井之藏 +イノケ 猪野毛 +イノケ 伊野家 +イノケ 猪家 +イノコ 猪子 +イノコ 亥子 +イノコ 猪児(猪兒) +イノコ 井ノ子 +イノコイシ 猪子石 +イノコイシ 猪ノ子石 +イノコウジ 井小路 +イノコザ 豚座 +イノコシ 猪越 +イノコシ 猪腰 +イノコシ 射越 +イノコシ 射残 +イノコシ 井野越 +イノコシ 猪野越 +イノコダ 亥子田 +イノコバ 猪子場 +イノサカ 猪坂 +イノサカ 猪阪 +イノサカ 井ノ坂 +イノサカ 井ノ阪 +イノサカ 井之坂 +イノサカ 伊之坂 +イノサカ 亥ノ坂 +イノサカ 猪ノ坂 +イノサキ 猪崎 +イノサキ 井ノ崎 +イノサキ 井野崎 +イノサキ 井之崎 +イノザキ 井野崎 +イノサコ 猪砂 +イノサコ 井ノ迫 +イノサコ 猪迫 +イノサコ 猪野迫 +イノサワ 伊之沢 +イノサワ 伊之澤 +イノシ 猪師 +イノシタ 井下 +イノシタ 井ノ下 +イノシタ 猪下 +イノシタ 井之下 +イノシタ 伊下 +イノシタ 井野下 +イノシタ 井の下 +イノシタ 亥下 +イノシマ 猪島 +イノシマ 猪嶋 +イノシマ 井ノ島 +イノシリ 井尻 +イノシリ 井之尻 +イノジリ 井ノ尻 +イノジリ 井之尻 +イノシロ 井城 +イノスエ 井ノ末 +イノセ 猪瀬 +イノセ 井瀬 +イノセ 伊野瀬 +イノセ 井ノ瀬 +イノセ 猪野瀬 +イノセ 豕瀬 +イノセ 井野瀬 +イノセ 伊能勢 +イノセ 亥ノ瀬 +イノセ 伊野勢 +イノセ 亥瀬 +イノセ 猪勢 +イノタ 猪田 +イノダ 猪田 +イノダ 伊野田 +イノダ 稲生田 +イノダ 猪多 +イノダ 井野田 +イノダ 猪野田 +イノタテヤマ 猪ノ立山 +イノタニ 猪谷 +イノタニ 井ノ谷 +イノタニ 井之谷 +イノタニ 井野谷 +イノツカ 猪塚 +イノツカ 井ノ塚 +イノヅカ 猪塚 +イノヅカ 猪野塚 +イノヅカ 蕏塚 +イノヅカ 伊野塚 +イノツジ 井ノ辻 +イノツジ 井野辻 +イノツノ 猪角 +イノツボ 猪坪 +イノツマ 猪妻 +イノヅマ 猪妻 +イノツメ 猪爪 +イノツメ 井爪 +イノツメ 猪之詰 +イノヅメ 猪爪 +イノヅメ 猪之詰 +イノテ 猪手 +イノト 井ノ戸 +イノト 井野戸 +イノナミ 伊野並 +イノネ 井野根 +イノネ 井ノ根 +イノノ 猪野々 +イノハ 伊野波 +イノハ 猪羽 +イノバ 井野場(井野塲) +イノハエ 猪八重 +イノハシ 猪橋 +イノハタ 井ノ畑 +イノハタ 猪端 +イノハタ 井野畑 +イノハタ 井野端 +イノハナ 猪鼻 +イノハナ 猪之鼻 +イノハナ 猪花 +イノハナ 位野花 +イノハナ 位ノ花 +イノハヤ 猪早 +イノハヤ 猪隼 +イノハラ 猪原 +イノハラ 井ノ原 +イノハラ 猪ノ原 +イノハラ 井之原 +イノハラ 伊野原 +イノハラ 居野原 +イノハラ 猪之原 +イノハラ 猪の原 +イノハラ 猪野原 +イノハラ 謄原 +イノヒザ 猪膝 +イノヒラ 猪平 +イノブ 井延 +イノベ 井部 +イノベ 伊野部 +イノベ 射延 +イノベ 伊延 +イノベ 猪部 +イノベ 井ノ部 +イノベ 井野辺(井野邉) +イノベ 井延 +イノベ 井野部 +イノベ 井ノ辺 +イノベ 猪辺(猪邊・猪邉) +イノベ 井ノ邊 +イノベ 井野邊 +イノベ 鋳延 +イノボウ 井坊 +イノボリ 井登 +イノマ 猪間 +イノマ 猪野間 +イノマ 猪之間 +イノマ 猪の間 +イノマエ 井前 +イノマエ 井之前 +イノマエ 伊野前 +イノマキ 猪巻 +イノマキ 猪牧 +イノマタ 猪股 +イノマタ 猪俣 +イノマタ 猪又 +イノマタ 井俣 +イノマタ 猪亦 +イノマタ 猪岐 +イノマタ 猪脵 +イノマタ 猪之俣 +イノマタ 猪野又 +イノマタ 井ノ又 +イノマタ 猪野俣 +イノマタ 猗股 +イノマツ 井野松 +イノマル 猪丸 +イノマル 井之丸 +イノミチ 井ノ道 +イノミヤ 井野宮 +イノミヤ 伊野宮 +イノミヤ 井ノ宮 +イノムラ 猪村 +イノムラ 井之村 +イノムラ 井野村 +イノムラ 井ノ村 +イノメ 猪目 +イノメ 猪妻 +イノモ 井面 +イノモト 井本 +イノモト 井元 +イノモト 井 +イノモト 猪本 +イノモト 井ノ本 +イノモト 井野元 +イノモト 井ノ元 +イノモト 井之元 +イノモト 井之本 +イノモト 井野本 +イノモト 猪元 +イノモト 猪野元 +イノモト 伊野本 +イノモト 亥野本 +イノモト 猪ノ元 +イノモト 猪ノ本 +イノモリ 猪森 +イノモリ 井ノ森 +イノモリ 井野森 +イノヤ 猪谷 +イノヤ 猪野屋 +イノヤ 居野家 +イノヤ 伊埜谷 +イノヤ 伊野谷 +イノヤ 井野屋 +イノヤエ 猪八重 +イノヤマ 井山 +イノヤマ 猪山 +イノヤマ 井ノ山 +イノヤマ 猪ノ山 +イノヤマ 井野山 +イノヤマ 伊埜山 +イノヤマ 猪之山 +イノユス 猪柘 +イノラ 猪之良 +イノリ 祷 +イノリ 祈 +イノリ 禱 +イノワ 井之輪 +イノワキ 井脇 +イノワキ 井之脇 +イノワキ 猪脇 +イノワキ 伊之脇 +イノワキ 井ノ脇 +イハ 伊波 +イハ 伊覇 +イバ 伊波 +イバ 伊庭 +イバ 射場(射塲) +イバ 井波 +イバ 井場 +イバ 伊場 +イバ 井馬 +イバ 居場 +イバ 射庭 +イバ 伊葉 +イバ 井庭 +イバ 居馬 +イバ 揖場 +イバ 射馬 +イバ 井塲 +イバ 亥場 +イバガワ 伊波川 +イバキ 井場木 +イハク 伊泊 +イバサキ 井場崎 +イバサキ 鋳場崎 +イハシ 伊橋 +イハシ 井橋 +イハシ 居橋 +イバシ 伊橋 +イバシ 井橋 +イバシ 居橋 +イハタ 井畑 +イハタ 井端 +イハタ 井幡 +イハタ 衣幡 +イハタ 伊畑 +イハタ 井旗 +イハタ 居畑 +イハタ 膽畑 +イハタ 胆畑 +イハタ 謄畑 +イバタ 井畑 +イバタ 井端 +イバタ 茨田 +イバタ 井幡 +イバタ 衣幡 +イバタ 伊端 +イバタ 伊畑 +イバタ 井旗 +イバタ 井畠 +イバタ 伊場田 +イバタ 藺幡 +イバタ 井場田 +イバト 衣鳩 +イハナ 猪鼻 +イハナ 井花 +イハナ 井鼻 +イバナ 猪鼻 +イバナ 井花 +イバナ 伊花 +イバナカ 井場中 +イバネ 射羽 +イバノ 伊庭野 +イバノ 伊場野 +イバノ 井葉野 +イハマ 井浜 +イハマ 伊浜 +イハマ 伊濱 +イハマ 射浜 +イハマ 井濱 +イバモト 井場元 +イバモト 射場本 +イバモト 伊庭本 +イハヤ 井隼 +イハヤ 井早 +イハヤサカ 伊早坂 +イハヤサカ 伊早阪 +イハヤザカ 伊早坂 +イバヤシ 伊林 +イバヤシ 井林 +イバヤシ 居林 +イバヤシ 移林 +イハヤマ 伊波山 +イバヤマ 射場山 +イハラ 井原 +イハラ 伊原 +イハラ 猪原 +イハラ 飯原 +イハラ 庵原 +イハラ 居原 +イハラ 渭原 +イハラ 射原 +イハラ 位原 +イバラ 井原 +イバラ 伊原 +イバラ 猪原 +イバラ 庵原 +イバラ 居原 +イバラ 茨 +イバラ 射原 +イバラ 棘 +イバラ 茨原 +イバラ 荊 +イバライケ 茨池 +イバラオ 荊尾 +イハラキ 伊原木 +イハラギ 井原木 +イバラキ 茨木 +イバラキ 茨城 +イバラキ 荊木 +イバラキ 伊原木 +イバラキ 莿木 +イバラキ 伊舟城 +イバラキ 棘木 +イバラキ 荻木 +イバラキ 蕀木 +イバラギ 茨木 +イバラギ 茨城 +イバラギ 荊木 +イバラギ 伊原木 +イバラギ 莿木 +イバラギ 井原木 +イハラグミ 伊原組 +イハラダ 居原田 +イバラダ 茨田 +イバラメ 茨目 +イバラモト 茨本 +イバラヤマ 茨山 +イヒ 井樋 +イヒ 伊比 +イヒ 井比 +イビ 衣斐 +イビ 井樋 +イビ 伊比 +イビ 揖斐 +イビ 井比 +イビ 衣裴 +イビ 依斐 +イビ 楫斐 +イビイ 伊比井 +イヒグチ 井樋口 +イビグチ 井樋口 +イビサコ 井樋迫 +イヒダ 井樋田 +イビノ 井樋野 +イビモト 井樋元 +イヒョウ 井表 +イヒラ 井平 +イヒラ 伊平 +イビラ 伊平 +イヒラダ 猪平田 +イビレ 伊比礼(伊比禮) +イフ 依浮 +イフカ 伊深 +イブカ 井深 +イブカ 伊深 +イブキ 伊吹 +イブキ 伊富貴 +イブキ 雪吹 +イブキ 伊夫伎 +イブキ 井吹 +イブキ 似吹 +イブキ 膽吹 +イブキ 伊冨貴 +イブキ 胆吹 +イブキ 伊富喜 +イブキ 伊夫気(伊夫氣) +イブキ 伊夫貴 +イブキ 居吹 +イブキ 生吹 +イブキ 謄吹 +イブキヤマ 伊吹山 +イフク 伊福 +イフク 井福 +イフク 居福 +イフクベ 伊福部 +イフクヤ 伊福屋 +イフクロ 衣袋 +イブクロ 衣袋 +イフジ 井藤 +イフジ 居藤 +イブシ 飯伏 +イブシ 井伏 +イブシ 伊伏 +イブシ 猪伏 +イブシ 飲伏 +イブスキ 指宿 +イブスキ 揖宿 +イブセ 井伏 +イブセ 猪伏 +イブタ 井二 +イブタ 井蓋 +イブチ 井渕 +イブチ 井淵 +イブチ 伊渕 +イブチ 伊淵 +イフネ 井船 +イブネ 井舟 +イブミ 井踏 +イブミ 飯文 +イブリ 飯降 +イブリハシ 動橋 +イブン 委文 +イベ 伊部 +イベ 井部 +イベ 井辺 +イベ 伊辺 +イベ 井邊 +イベ 伊邉 +イベ 伊瓶 +イベ 伊邊 +イベ 井邉 +イホ 伊保 +イホ 井保 +イホ 五百 +イボ 揖保 +イホウ 伊宝(伊寶・伊寳) +イホウ 生宝 +イボウ 伊法 +イホオ 五百尾 +イホカワ 五百川 +イホキ 五百木 +イホキ 伊保木 +イホギ 五百木 +イボコリ 飯起 +イホサキ 五百崎 +イホザキ 五百崎 +イホジ 五百路 +イボシ 井星 +イボシ 伊星 +イボシ 違星 +イホタ 井保田 +イホダ 伊宝田 +イホダ 伊寳田 +イボナイ 伊保内 +イボナイ 井保内 +イホノ 五百野 +イホバシ 伊保橋 +イボハシ 伊保橋 +イホベ 五百部 +イホメ 五百目 +イホラ 井洞 +イホリ 井堀 +イホリ 庵 +イホリ 伊堀 +イホリ 菴 +イボリ 井堀 +イボリ 伊堀 +イボリ 井掘 +イホリサワ 菴沢 +イホリサワ 菴澤 +イホリハラ 廬原 +イホリヤ 庵谷 +イホロ 井保呂 +イボロ 井保呂 +イホロイ 五百蔵 +イホロイ 五百藏 +イマ 今 +イマ 井馬 +イマ 猪間 +イマ 井間 +イマ 意真 +イマアキ 今秋 +イマアケ 今明 +イマアラ 今新 +イマアラシ 今嵐 +イマイ 今井 +イマイ 今居 +イマイ 今伊 +イマイイダ 今飯田 +イマイエ 今家 +イマイカリ 今碇 +イマイケ 今池 +イマイザキ 今井崎 +イマイシ 今石 +イマイジリ 今井尻 +イマイズミ 今泉 +イマイズミ 今和泉 +イマイズミ 今出水 +イマイソ 今磯 +イマイダ 今井田 +イマイダ 今飯田 +イマイチ 今市 +イマイチ 今一 +イマイチヤ 今市屋 +イマイデ 今出 +イマイト 今糸 +イマイノ 今井野 +イマイマツ 今井松 +イマイリ 今入 +イマイレ 今入 +イマウエ 今上 +イマウエ 今植 +イマウシ 今牛 +イマウシ 今丑 +イマウジ 今氏 +イマウチ 今内 +イマウラ 今浦 +イマエ 今江 +イマエ 今栄 +イマエ 井前 +イマエ 今榮 +イマエ 伊前 +イマエダ 今枝 +イマオ 今尾 +イマオオジ 今大路 +イマオカ 今岡 +イマオク 今奥 +イマオク 今億 +イマガイ 今海 +イマガイ 今貝 +イマガイト 今垣内 +イマガキ 今垣 +イマカグラ 今鹿倉 +イマガクラ 今鹿倉 +イマガクラ 今ケ倉 +イマカケ 今掛 +イマガケ 今掛 +イマガサコ 今ケ迫 +イマガシ 今樫 +イマガセ 今ケ瀬 +イマカタ 今方 +イマカツ 今勝 +イマカド 今門 +イマカネ 今金 +イマカネ 今兼 +イマガネ 今金 +イマガネ 今兼 +イマガネ 今銀 +イマカマ 今釜 +イマガマ 今釜 +イマカミ 今上 +イマガミ 今上 +イマガミ 今神 +イマガラ 今柄 +イマカワ 今川 +イマカワ 今河 +イマガワ 今川 +イマガワ 今河 +イマキ 今城 +イマキ 今木 +イマキ 伊巻 +イマキ 今来 +イマキ 井巻 +イマキ 今記 +イマキ 猪牧 +イマキ 伊卷 +イマギ 今城 +イマギ 今木 +イマギ 今儀 +イマギ 今義 +イマキイレ 今給黎 +イマギイレ 今給黎 +イマギシ 今岸 +イマキタ 今北 +イマキタ 今来 +イマキタ 今喜多 +イマキタ 今喜夛 +イマキタ 今幾多 +イマキタ 今木田 +イマキタ 今来田 +イマギタ 今北 +イマキヤ 今木屋 +イマキュウレイ 今給黎 +イマギリ 今桐 +イマギレ 今給黎 +イマク 井幕 +イマクギ 今釘 +イマグチ 今口 +イマクニ 今国 +イマクニ 今國 +イマクボ 今久保 +イマクボ 今窪 +イマクマ 今熊 +イマグマ 今熊 +イマグマ 今隈 +イマクラ 今倉 +イマクラ 今蔵 +イマクラ 今鞍 +イマクラ 今藏 +イマクラヤ 今蔵屋 +イマクルス 今久留主 +イマグンバイ 今葷倍 +イマコ 今子 +イマゴ 今後 +イマゴウ 今郷 +イマコウジ 今小路 +イマゴオリ 今郡 +イマコガ 今古賀 +イマコシ 今越 +イマコマ 今駒 +イマゴメ 今込 +イマコン 今紺 +イマコンヤ 今紺谷 +イマザイ 今在 +イマザイケ 今在家 +イマサカ 今坂 +イマサカ 今阪 +イマサカ 今酒 +イマザカ 今坂 +イマザカ 今酒 +イマサキ 今崎 +イマサキ 今嵜 +イマザキ 今崎 +イマサク 今咲 +イマサコ 今迫 +イマサダ 今定 +イマサツ 今薩 +イマサト 今里 +イマザト 今里 +イマザネ 今実 +イマザネ 今實 +イマサワ 今沢 +イマサワ 今澤 +イマザワ 今沢 +イマザワ 今澤 +イマジ 今治(今冶) +イマジ 今地 +イマシオ 今塩 +イマジオ 今塩 +イマシオヤ 今塩屋 +イマシキ 今敷 +イマシキ 今舗 +イマジグ 今治具 +イマシゲ 今重 +イマジシ 今獅々 +イマシタ 今下 +イマシバ 今柴 +イマシマ 今島 +イマシマ 今嶋 +イマシマ 今嶌 +イマジマ 今島 +イマジマ 今嶋 +イマジマ 今嶌 +イマシミズ 今清水 +イマシュク 今宿 +イマジュク 今宿 +イマショウ 今庄 +イマジョウ 今城 +イマジョウ 今上 +イマジョウ 今荘 +イマジョウ 今庄 +イマジョウ 今状 +イマジョウ 今條 +イマシロ 今城 +イマシロ 今白 +イマシロ 今代 +イマス 今須 +イマス 今栖 +イマス 井桝 +イマス 井升 +イマス 今洲 +イマス 井益 +イマス 井枡 +イマス 居升 +イマズ 今津 +イマズ 今頭 +イマスエ 今末 +イマスガ 今須賀 +イマスギ 今杉 +イマスジ 今筋 +イマスミ 今角 +イマズミ 今住 +イマズミ 今澄 +イマズミ 今角 +イマズル 今鶴 +イマスワ 今諏訪 +イマセ 今瀬 +イマセキ 今関(今關) +イマゼキ 今関(今關) +イマソノ 今園 +イマゾノ 今園 +イマゾノ 今薗 +イマタ 今田 +イマタ 猪又 +イマタ 今多 +イマタ 井俣 +イマタ 井亦 +イマタ 井又 +イマタ 井股 +イマダ 今田 +イマダ 今多 +イマダ 田 +イマダ 井麻田 +イマタカ 今高 +イマタカ 今鷹 +イマダカ 今高 +イマタキ 今滝 +イマタキ 今瀧 +イマタケ 今竹 +イマタケ 今武 +イマタチ 今立 +イマダチ 今立 +イマダテ 今立 +イマダテ 今達 +イマタナカ 今田中 +イマタニ 今谷 +イマダニ 今谷 +イマタマリ 今玉利 +イマダヤ 今田屋 +イマチ 井町 +イマチ 今地 +イマチ 居町 +イマチ 井街 +イマチ 今知 +イマチ 伊町 +イマヂ 今地 +イマチョウ 今長 +イマツ 今津 +イマツ 居松 +イマツ 井松 +イマヅ 今津 +イマツカ 今塚 +イマヅカ 今塚 +イマツグ 今次 +イマツジ 今辻 +イマツチ 今土 +イマヅツ 今筒 +イマヅミ 今積 +イマツヤ 今津谷 +イマヅヤ 今津屋 +イマツル 今鶴 +イマヅル 今鶴 +イマヅル 今水流 +イマテ 今手 +イマデ 今出 +イマデガワ 今出川 +イマデキ 今出来 +イマデラ 今寺 +イマト 今戸 +イマド 今戸 +イマド 今度 +イマトウ 今藤 +イマトウ 今任 +イマトキ 今時 +イマトク 今徳 +イマトミ 今富 +イマトミ 今冨 +イマドミ 今富 +イマドミ 今冨 +イマトメ 今留 +イマドメ 今留 +イマナカ 今中 +イマナカ 今仲 +イマナガ 今永 +イマナガ 今長 +イマナミ 今浪 +イマナミ 今波 +イマナラ 今奈良 +イマナリ 今城 +イマナリ 今成 +イマニ 今仁 +イマニシ 今西 +イマニワ 今庭 +イマヌマ 今沼 +イマネ 今禰 +イマノ 今野 +イマノ 今埜 +イマノウ 今納 +イマノヤ 今野谷 +イマバ 今場 +イマハシ 今橋 +イマバシ 今橋 +イマハセ 今長谷 +イマハセ 今馳 +イマハタ 今畑 +イマハタ 今畠 +イマハタ 今幡 +イマバタ 今端 +イマハタケナカ 今畠中 +イマハタナカ 今畠中 +イマハナ 今花 +イマハマ 今浜 +イマハマ 今濱 +イマハヤシ 今林 +イマバヤシ 今林 +イマハラ 今原 +イマバラ 今原 +イマハリヤマ 今針山 +イマハル 今春 +イマヒエ 新比恵 +イマヒガシ 今東 +イマヒサ 今久 +イマヒラ 今平 +イマヒロ 今広 +イマヒロ 今弘 +イマヒロ 今廣 +イマフ 今府 +イマブキ 今吹 +イマフク 今福 +イマフサ 今房 +イマフジ 今藤 +イマブチ 今渕 +イマブチ 今淵 +イマフルカワ 今古川 +イマブン 今分 +イマベ 今部 +イマベツ 今別 +イマベップ 今別府 +イマホ 今保 +イマホコ 今鉾 +イマホリ 今堀 +イマホリ 今掘 +イマボリ 今堀 +イママ 今間 +イママエダ 今前田 +イママキ 今牧 +イママサ 今政 +イママサ 今正 +イママス 今増 +イママタ 今俣 +イママチ 今町 +イママチ 今待 +イママツ 今松 +イママル 今丸 +イマミ 今見 +イマミ 今美 +イマミズ 今水 +イマミゾ 今溝 +イマミチ 今道 +イマミツ 今満 +イマミツ 今光 +イマミツ 今滿 +イマミドウ 今見堂 +イマミナト 今湊 +イマミナミ 今南 +イマミネ 今峰 +イマミネ 今峯 +イマミヤ 今宮 +イマムラ 今村 +イマムラ 今邨 +イマムラ 今邑 +イマムロ 今室 +イマモト 今本 +イマモト 今元 +イマモリ 今森 +イマモリ 今盛 +イマヤ 今谷 +イマヤ 今屋 +イマヤ 今矢 +イマヤクシ 今薬師 +イマヤシキ 今屋敷 +イマヤス 今安 +イマヤス 今康 +イマヤナギ 今柳 +イマヤナギタ 今柳田 +イマヤナギダ 今柳田 +イマヤハタ 今八幡 +イマヤマ 今山 +イマユキ 今雪 +イマユキ 今行 +イマヨウ 今用 +イマヨシ 今吉 +イマリ 今利 +イマリ 伊万里 +イマリ 伊萬里 +イマル 井丸 +イマル 伊丸 +イマルオカ 伊丸岡 +イマルオカ 井丸岡 +イマワカ 今若 +イマワキ 今脇 +イマワタリ 今渡 +イマワリ 井廻 +イミ 伊美 +イミ 井美 +イミ 伊見 +イミギ 五十右 +イミズ 井水 +イミズ 射水 +イミゾ 井溝 +イミチ 井道 +イミナ 伊皆 +イミナ 諱 +イミナミ 井南 +イミネ 井峯(井峰) +イミヤ 井宮 +イミヤ 伊宮 +イミョウ 井名 +イムカイ 井向 +イムカイ 井迎 +イムカイ 飯向 +イムキ 井向 +イムタ 伊牟田 +イムタ 藺牟田 +イムタ 井無田 +イムタ 飯牟田 +イムタ 藺弁田 +イムタ 蘭牟田 +イムラ 井村 +イムラ 飯村 +イムラ 伊村 +イムラ 居村 +イムラ 猪村 +イムラ 井邑 +イムラ 為村 +イムラ 倭村 +イムラ 井邨 +イムラ 隠村 +イムラ 伊屯 +イムレ 飯牟礼 +イムレ 飯牟禮 +イムロ 飯室 +イムロ 伊室 +イムロ 井室 +イメン 井面 +イモ 井藻 +イモ 伊茂 +イモアライ 一口 +イモウ 芋生 +イモウトイシ 妹石 +イモオ 妹尾 +イモオ 芋生 +イモオカ 芋岡 +イモオカ 妹岡 +イモガサキ 芋ケ崎 +イモガサコ 芋ケ迫 +イモカワ 五百川 +イモカワ 芋川 +イモカワ 妹川 +イモガワ 五百川 +イモガワ 芋川 +イモガワ 妹川 +イモサコ 芋迫 +イモザワ 五百沢 +イモザワ 芋沢(芋澤) +イモザワ 五百澤 +イモジ 伊茂治 +イモセ 妹背 +イモセ 芋瀬 +イモセ 五百瀬 +イモセ 妹脊 +イモセ 著蕷瀬 +イモタ 芋田 +イモダ 芋田 +イモダ 妹田 +イモタカ 芋高 +イモタニ 芋谷 +イモヅカ 芋塚 +イモヅカ 妹塚 +イモヅキ 芋月 +イモト 井本 +イモト 井元 +イモト 猪本 +イモト 伊本 +イモト 伊元 +イモト 居本 +イモト 猪元 +イモト 意元 +イモト 射本 +イモト 以元 +イモト 位本 +イモト 威本 +イモト 亥本 +イモト 尹本 +イモナワ 芋縄 +イモノ 芋野 +イモノ 鋳物(鑄物) +イモノ 伊茂野 +イモハ 妹葉 +イモハタ 芋畑 +イモハラ 芋原 +イモホリ 芋堀 +イモモト 芋本 +イモヤマ 妹山 +イモヨシ 芋吉 +イモリ 伊森 +イモリ 井森 +イモリ 居森 +イモリ 井守 +イモリ 伊盛 +イモリ 井盛 +イモリ 伊守 +イモリ 居守 +イモリ 藺森 +イモリ 位守 +イモリ 移守 +イモリ 藺守 +イモリヤ 射守矢 +イモリヤ 射守屋 +イモン 井門 +イヤエ 猪八重 +イヤガサコ 伊屋ケ迫 +イヤガワ 袰川 +イヤグチ 居弥口 +イヤザキ 飯屋崎 +イヤザキ 井矢崎 +イヤス 居安 +イヤタ 井谷田 +イヤタ 伊矢田 +イヤタダ 伊谷只 +イヤタニ 袰谷 +イヤタニ 飯屋谷 +イヤダニ 袰谷 +イヤチ 井谷内 +イヤド 居宿 +イヤトミ 弥富 +イヤトミ 彌富 +イヤトミ 彌冨 +イヤドミ 弥富 +イヤドミ 弥冨 +イヤドミ 彌富 +イヤドミ 彌冨 +イヤナガ 弥永 +イヤナガ 彌永 +イヤナギ 井柳 +イヤナギ 伊柳 +イヤノ 伊谷野 +イヤノ 伊矢野 +イヤマ 井山 +イヤマ 伊山 +イヤマ 猪山 +イヤマ 居山 +イヤマ 鋳山(鑄山) +イヤマ 医山 +イヤマ 醫山 +イヤマツ 井谷松 +イヤモト 辞本 +イヨ 伊予 +イヨ 伊与 +イヨ 伊豫 +イヨ 伊與 +イヨ 伊興 +イヨ 伊輿 +イヨ 井世 +イヨ 井豫 +イヨウ 井用 +イヨオカ 伊予岡 +イヨオカ 伊豫岡 +イヨカワ 五百川 +イヨキ 伊与木 +イヨキ 伊與木 +イヨキ 伊興木 +イヨキ 伊予木 +イヨキ 伊豫木 +イヨキ 伊与喜 +イヨギ 五代儀 +イヨク 伊能 +イヨク 伊与久 +イヨク 伊欲 +イヨク 伊與久 +イヨザキ 五百崎 +イヨシ 伊吉 +イヨシ 井吉 +イヨシ 井好 +イヨシマ 伊予島 +イヨズミ 伊代住 +イヨズミ 伊与泉(伊與泉) +イヨズミ 伊予隅(伊豫隅) +イヨタ 伊与田 +イヨタ 伊予田 +イヨタ 伊豫田 +イヨタ 伊代田 +イヨタ 伊與田 +イヨタ 井余田 +イヨタ 井餘田 +イヨダ 伊与田 +イヨダ 伊予田 +イヨダ 伊豫田 +イヨダ 弥田 +イヨダ 伊代田 +イヨダ 伊與田 +イヨダ 井餘田 +イヨダ 彌田 +イヨダ 伊興田 +イヨダ 伊輿田 +イヨタニ 伊予谷 +イヨタニ 伊豫谷 +イヨナガ 弥永 +イヨナガ 彌永 +イヨナガ 伊予永 +イヨナガ 伊豫永 +イヨノ 伊代野 +イヨハラ 庵原 +イヨベ 伊与部 +イヨベ 五百部 +イヨベ 伊予部 +イヨベ 伊與部 +イヨベ 伊豫部 +イヨマサ 弥政 +イヨマサ 伊与政 +イヨマサ 伊與政 +イヨマサ 彌政 +イヨモト 伊予本 +イヨモト 伊豫本 +イヨモリ 伊与森(伊與森) +イヨヤ 伊豫屋 +イヨヤ 伊予屋 +イヨリ 伊従 +イヨリ 井寄 +イヨリ 伊從 +イヨリ 伊徒 +イヨリ 伊寄 +イヨロイ 五百蔵 +イヨロイ 五百藏 +イラ 伊良 +イラ 井羅 +イライ 伊来 +イライ 伊來 +イライシ 白石 +イラカ 甍 +イラク 易楽 +イラコ 五十子 +イラコ 伊良子 +イラコ 伊羅子 +イラコ 伊羅胡 +イラゴ 五十子 +イラゴ 伊羅子 +イラサワ 井良沢 +イラサワ 伊羅沢 +イラサワ 井良澤 +イラザワ 井良沢 +イラザワ 井良澤 +イラチ 伊良知 +イラナミ 伊良波 +イラハ 伊良波 +イラハラ 伊良原 +イラハラ 苛原 +イラブ 伊良部 +イラブ 伊了部 +イラベ 伊良部 +イラミナ 伊良皆 +イララ 井良々 +イリ 伊里 +イリ 入 +イリ 井利 +イリ 伊理 +イリ 井理 +イリ 伊利 +イリアイ 入合 +イリアイ 入相 +イリイ 入井 +イリイエ 入家 +イリイケハラ 入池原 +イリイシ 入石 +イリイシガキ 入石垣 +イリイチ 入一 +イリイドマリ 入伊泊 +イリイナフク 入稲福 +イリイン 伊里院 +イリウケマス 入請舛 +イリウダ 入生田 +イリウダ 入宇田 +イリウチ 入内 +イリウチザワ 入内沢(入内澤) +イリウチシマ 入内島 +イリウチシマ 入内嶋 +イリウチジマ 入内島 +イリウチジマ 入内嶋 +イリウチジマ 入内嶌 +イリウベ 入宇部 +イリウマ 入馬 +イリウミ 入海 +イリウメ 入梅 +イリウラ 入浦 +イリエ 入江 +イリエ 江 +イリエ 入家 +イリエ 杁江 +イリエ 煎栄 +イリエ 煎江 +イリエ 入栄 +イリエダ 入枝 +イリエダ 入江田 +イリオ 入尾 +イリオ 入生 +イリオカ 入岡 +イリオノ 入尾野 +イリオモテ 西表 +イリガ 入賀 +イリカイ 入貝 +イリガイ 入貝 +イリガキ 入柿 +イリガキ 入垣 +イリカタ 入方 +イリカド 入門 +イリガネ 入金 +イリカマチ 入ケ町 +イリガマチ 入ケ町 +イリカルイ 入軽井 +イリカワ 入川 +イリカワ 入河 +イリキ 入来 +イリキ 入木 +イリキ 入耒 +イリキ 入來 +イリキイン 入来院(入耒院) +イリキイン 入來院 +イリキタ 入木田 +イリキタ 入来田 +イリキダ 入木田 +イリキダ 入来田 +イリキミ 入君 +イリギミ 入君 +イリクチ 入口 +イリグチ 入口 +イリグチ 射り口 +イリクド 入久戸 +イリクニ 入国(入國) +イリクラ 入倉 +イリクラ 入蔵 +イリクラ 入藏 +イリクラモト 入蔵元(入藏元) +イリケダモト 入慶田本 +イリケマチ 入ケ町 +イリゲマチ 入毛町 +イリコ 入子 +イリコ 入小 +イリコソコ 入小底 +イリコマ 入駒 +イリコメクラ 入米蔵(入米藏) +イリサ 入佐 +イリザ 入座 +イリサカ 入坂 +イリサキ 入崎 +イリサコ 入迫 +イリサト 入里 +イリザト 入里 +イリサワ 入沢 +イリサワ 入澤 +イリサワ 煎沢 +イリサワ 煎澤 +イリザワ 入沢 +イリザワ 入澤 +イリザワ 煎沢 +イリザワ 煎澤 +イリジ 入地 +イリシオ 入潮 +イリシオ 入汐 +イリシオ 入塩 +イリシマ 入島 +イリシマ 入嶋 +イリスエ 入居 +イリスギ 入杉 +イリスジ 西筋 +イリスナ 入砂 +イリスミ 入角 +イリスミ 入住 +イリズミ 入角 +イリズミ 入住 +イリセ 入瀬 +イリゼン 入膳 +イリソ 入曽(入曾) +イリタ 入田 +イリタ 入多 +イリタエ 入田衛 +イリタカシマ 入高島 +イリタケニシ 入嵩西 +イリタサト 入田里 +イリタニ 入谷 +イリタニ 煎谷 +イリタマ 入玉 +イリタヤ 入田谷 +イリツ 入津 +イリツカ 煎塚 +イリヅカ 入塚 +イリツキ 入月 +イリヅキ 入月 +イリテ 入手 +イリデ 入出 +イリト 入戸 +イリトク 入徳 +イリトノ 入戸野 +イリトミ 納富 +イリトミムラ 入富村(入冨村) +イリナカ 入中 +イリナカ 入仲 +イリナガ 入永 +イリナカモト 入仲本 +イリナツ 入夏 +イリナミ 入波 +イリナミヒラ 入波平 +イリニシ 入西 +イリニシハラ 入西原 +イリノ 入野 +イリノ 煎野 +イリノ 入埜 +イリノウチ 入之内 +イリノダ 入野田 +イリノヤ 入野谷 +イリバ 入場 +イリハエノ 入南風野 +イリハシ 入橋 +イリバタ 入端 +イリハトマ 入鳩間 +イリハナ 入花 +イリハマ 入浜 +イリハマ 入濱 +イリハラ 入原 +イリヒ 入日 +イリフク 入福 +イリフクハマ 入福浜 +イリフクハマ 入福濱 +イリフジ 入不二 +イリフナト 入船渡 +イリフネ 入船 +イリフネ 入舟 +イリフネ 入舩 +イリベ 入部 +イリベ 入辺 +イリベ 入邊 +イリホシ 入星 +イリボシ 入星 +イリマ 入間 +イリマエ 入前 +イリマガワ 入間川 +イリマジ 入真地(入眞地) +イリマジリ 入交 +イリマタ 入間田 +イリマダ 入間田 +イリマチ 入町 +イリマツカワ 入松川 +イリマツガワ 入松川 +イリマツダ 入松田 +イリマン 入万 +イリミズ 入水 +イリミチ 入道 +イリミヤ 入宮 +イリムカイザト 入迎里 +イリムラ 入村 +イリモト 入本 +イリモト 井利元 +イリモト 杁本 +イリモト 煎本 +イリモト 入元 +イリモミ 入籾 +イリモリモト 入盛本 +イリヤ 入谷 +イリヤ 入矢 +イリヤ 入屋 +イリヤ 射矢 +イリヤマ 入山 +イリヤマ 杁山 +イリヤマ 圦山 +イリヤマ 伊里山 +イリュウ 井龍 +イリュウ 井竜 +イリュウ 井流 +イリュウ 伊龍 +イリュウ 伊竜 +イリョウ 井料 +イリョウ 井領 +イリョウ 入領 +イリョウ 猪龍 +イリョウダ 井料田 +イリョウダ 飯領田 +イリヨシ 入吉 +イリヨシ 入義 +イリヨシ 入好 +イリヨナグニ 入与那国 +イリヨネクラ 入米蔵(入米藏) +イルカ 入鹿 +イルカ 射鹿 +イルガ 入賀 +イルカヤマ 入鹿山 +イルベ 入部 +イルマ 入間 +イルマガワ 入間川 +イルマタ 入間田 +イルマダ 入間田 +イルマノ 入間野 +イルミ 入海 +イルヤ 射矢 +イレ 伊禮 +イレイ 伊礼 +イレイ 伊禮 +イレイジョウ 伊礼門(伊禮門) +イレカド 伊礼門(伊禮門) +イレコマ 入駒 +イレハク 伊礼泊(伊禮泊) +イロイ 色井 +イロカワ 色川 +イロキ 色木 +イロクモ 色雲 +イロシマ 色島 +イロタ 色田 +イロタニ 色谷 +イロデン 飯領田 +イロナミ 色波 +イロハ 伊呂波 +イロハ 色葉 +イロハラ 伊呂原 +イロハラ 色原 +イロヒラ 色平 +イロベ 色部 +イロマス 色増 +イロメ 以呂免 +イロモト 色本 +イロヤマ 色山 +イワ 岩 +イワ 巌 +イワ 伊輪 +イワ 伊和 +イワ 威和 +イワアケ 岩明 +イワアサ 岩浅 +イワアサ 岩朝 +イワアサ 岩淺 +イワアナ 岩穴 +イワアナクチ 岩穴口 +イワアナグチ 岩穴口 +イワイ 岩井 +イワイ 祝 +イワイ 祝井 +イワイ 岩生 +イワイ 磐井 +イワイ 岩居 +イワイ 慶 +イワイ 盤井 +イワイ 賀 +イワイ 岩結 +イワイエ 岩家 +イワイエダ 祝枝 +イワイガノ 祝ケ野 +イワイカワ 岩井川 +イワイガワ 岩井川 +イワイケ 岩池 +イワイサキ 祝前 +イワイザキ 祝崎 +イワイサコ 祝迫 +イワイサコ 岩井迫 +イワイザコ 祝迫 +イワイサワ 岩井澤 +イワイザワ 岩井沢 +イワイザワ 岩井澤 +イワイサワグチ 祝井沢口 +イワイサワグチ 祝井澤口 +イワイシ 岩石 +イワイズミ 岩泉 +イワイソノ 祝園 +イワイゾノ 祝園 +イワイタ 祝田 +イワイダ 慶田 +イワイダ 岩井田 +イワイダ 祝田 +イワイダ 祝多 +イワイタニ 祝井谷 +イワイダニ 祝井谷 +イワイチ 岩市 +イワイデ 岩出 +イワイデ 祝出 +イワイデ 岩井出 +イワイドウ 岩井堂 +イワイナカ 岩井中 +イワイノ 岩井野 +イワイノ 祝野 +イワイハナ 岩井花 +イワイバナ 岩井花 +イワイハラ 祝原 +イワイハラ 岩井原 +イワイバラ 祝原 +イワイブチ 悦渕(悦淵) +イワイマツ 祝松 +イワイヤ 岩井屋 +イワイヤ 岩井谷 +イワウエ 岩上 +イワウチ 岩内 +イワウチ 岩打 +イワウチ 巌内 +イワウチ 巖内 +イワウネ 岩畦 +イワウラ 岩浦 +イワエ 岩江 +イワエ 岩栄(岩榮) +イワエ 岩恵 +イワエダ 岩枝 +イワオ 岩尾 +イワオ 岩男 +イワオ 巌 +イワオ 巖 +イワオ 岩生 +イワオ 嵓 +イワオ 磐 +イワオ 嵒 +イワオ 嵓尾 +イワオオジ 岩大路 +イワオカ 岩岡 +イワオキ 岩沖 +イワオク 岩奥 +イワオト 岩音 +イワオリ 岩織 +イワオリ 岩折 +イワカ 井若 +イワカ 岩香 +イワカイ 岩階 +イワガイ 岩貝 +イワガイツ 岩垣津 +イワガキ 岩垣 +イワガキ 岩柿 +イワガサカ 岩ケ坂 +イワガサワ 岩ケ沢(岩ケ澤) +イワカジ 岩梶 +イワカジ 岩鍛治(岩鍜治) +イワカジ 岩鍛冶 +イワガシタ 岩ケ下 +イワガシラ 岩頭 +イワガセ 岩ケ瀬 +イワカタ 岩片 +イワカタ 岩方 +イワガタ 岩形 +イワカド 岩角 +イワカド 岩門 +イワカネ 岩金 +イワガネ 岩金 +イワカベ 岩壁 +イワカマ 岩鎌 +イワガマ 岩釜 +イワカミ 岩上 +イワカミ 岩神 +イワカミ 磐上 +イワカミ 巌上 +イワガミ 石上 +イワガミ 岩上 +イワガミ 岩神 +イワガミ 磐上 +イワカメ 岩亀 +イワガヤ 岩谷 +イワガヤ 岩ケ谷 +イワカワ 岩川 +イワカワ 岩河 +イワカワ 巌川 +イワカワ 巖川 +イワガワ 岩川 +イワガワ 岩河 +イワカン 岩勘 +イワキ 岩城 +イワキ 岩木 +イワキ 井脇 +イワキ 磐城 +イワキ 岩鬼 +イワキ 巌城 +イワキ 巖城 +イワキ 伊脇 +イワキ 槃木 +イワキ 威脇 +イワキ 岩気 +イワキ 岩来(岩耒) +イワキ 居和城 +イワキ 盤城 +イワキ 巖木 +イワキ 厳城 +イワギ 岩城 +イワギ 岩儀 +イワキガワ 岩木川 +イワキシ 岩岸 +イワギシ 岩岸 +イワキタ 岩北 +イワキヤ 岩城谷 +イワキリ 岩切 +イワキリ 岩桐 +イワギリ 岩切 +イワギリ 岩桐 +イワキロ 岩木呂 +イワク 岩久 +イワクサ 岩草 +イワグチ 岩口 +イワクニ 岩国 +イワクニ 岩國 +イワクニヤ 岩國屋 +イワクボ 岩窪 +イワクボ 岩久保 +イワクマ 岩熊 +イワクマ 岩隈 +イワクマ 磐隈 +イワグマ 岩熊 +イワグマ 岩隈 +イワクモ 岩雲 +イワクラ 岩倉 +イワクラ 岩峅 +イワクラ 巌倉 +イワクラ 岩庫 +イワクラ 巖倉 +イワクラタニ 岩倉谷 +イワクリ 岩繰 +イワクロ 岩畔 +イワクロ 岩黒 +イワクロ 岩畦 +イワグロ 岩畔 +イワケ 井分 +イワコ 岩子 +イワコ 岩古 +イワコ 岩故 +イワゴ 岩後 +イワゴ 巌后(巖后) +イワゴウ 岩合 +イワゴウ 岩郷 +イワコウチ 岩河内 +イワゴウチ 岩河内 +イワゴエ 岩越 +イワコケ 岩苔 +イワコケ 岩茸 +イワコシ 岩越 +イワコシ 岩腰 +イワゴシ 岩越 +イワゴシ 岩腰 +イワコミ 岩込 +イワサ 岩佐 +イワサ 岩浅 +イワサ 岩朝 +イワサ 岩沙 +イワサ 岩狭 +イワサ 岩砂 +イワサ 磐佐 +イワサ 巌佐 +イワサ 岩左 +イワサ 磐浅(磐淺) +イワサ 岩淺 +イワサ 岩狹 +イワサカ 岩坂 +イワサカ 岩阪 +イワサキ 岩崎(岩碕) +イワサキ 岩嵜 +イワサキ 岩岬 +イワサキ 巌崎 +イワサキ 岩先 +イワサキ 岩埼 +イワサキ 磐崎 +イワサキ 磐前 +イワサキ 巖崎(巖埼・巖嵜) +イワザキ 岩崎(岩碕) +イワザキ 岩嵜 +イワサク 岩破 +イワザクラ 岩桜(岩櫻) +イワサケ 岩酒 +イワサコ 岩迫 +イワサコ 岩峪 +イワサコ 岩逧 +イワサシ 岩指 +イワサダ 岩貞 +イワサダ 岩定 +イワサト 岩里 +イワサド 岩佐戸 +イワザト 岩里 +イワサル 岩猿 +イワサワ 岩沢 +イワサワ 岩澤 +イワサワ 磐沢 +イワザワ 岩沢 +イワザワ 岩澤 +イワシ 岩志 +イワシ 鰯 +イワジ 岩地 +イワジ 岩路 +イワジ 岩治 +イワシカ 岩鹿 +イワシキ 岩敷 +イワシゲ 岩重 +イワシゲ 岩繁 +イワシタ 岩下 +イワシタ 磐下 +イワシナ 岩科 +イワシナ 岩品 +イワシナカ 鰯中 +イワシノ 岩篠 +イワシバ 岩柴 +イワシバ 岩芝 +イワシマ 岩島 +イワシマ 岩嶋 +イワシマ 巌島 +イワジマ 岩島 +イワジマ 岩嶋 +イワシミズ 岩清水 +イワシミズ 石清水 +イワシヤ 鰯谷 +イワショウ 岩庄 +イワジョウ 岩城 +イワジリ 岩尻 +イワシロ 岩城 +イワシロ 岩代 +イワシロ 岩白 +イワス 岩須 +イワス 嵓栖 +イワズ 岩津 +イワスガ 岩菅 +イワスギ 岩杉 +イワスジ 岩筋 +イワスナ 岩砂 +イワスミ 岩角 +イワズミ 岩住 +イワセ 岩瀬 +イワセ 岩生 +イワセ 磐瀬 +イワセ 岩世 +イワセ 巌瀬 +イワセ 岩勢 +イワセ 嵒瀬 +イワセキ 岩関 +イワセコ 岩迫 +イワセバリ 岩瀬張 +イワセヤ 岩瀬谷 +イワソ 岩曽 +イワソ 岩祖 +イワソ 岩噌 +イワゾエ 岩添 +イワソト 岩外 +イワゾノ 岩園 +イワタ 岩田 +イワタ 磐田 +イワタ 岩多 +イワタ 井和田 +イワタ 巌田 +イワタ 厳田 +イワタ 巖田 +イワタ 嵓田 +イワダ 岩田 +イワタカ 岩高 +イワタキ 岩滝 +イワタキ 岩瀧 +イワタケ 岩竹 +イワタケ 岩武 +イワタケ 岩岳 +イワタケ 岩嶽 +イワタチ 岩立 +イワダチ 岩立 +イワタチバナ 岩橘 +イワタツ 岩立 +イワタテ 岩館 +イワタテ 岩立 +イワタテ 岩舘 +イワタテ 岩楯 +イワダテ 岩館 +イワダテ 岩立 +イワダテ 岩舘 +イワダテ 岩楯 +イワダテ 岩達 +イワタニ 岩谷 +イワタニ 巌谷 +イワタニ 岩渓 +イワタニ 岩溪 +イワタニ 祝谷 +イワタヤ 岩田谷 +イワタレ 岩垂 +イワダレ 岩垂 +イワダン 岩段 +イワチ 岩地 +イワチ 岩知 +イワヂ 岩地 +イワチカ 岩近 +イワチカ 岩周 +イワチドウ 岩知道 +イワツ 岩津 +イワツ 巌津 +イワツ 巖津 +イワヅ 岩津 +イワツカ 岩塚 +イワツカ 岩務 +イワヅカ 岩塚 +イワツキ 岩月 +イワツキ 岩附 +イワツキ 岩槻 +イワツキ 岩付 +イワツキ 岩築 +イワツキ 磐槻 +イワツグ 岩継 +イワツケ 岩附 +イワツジ 岩辻 +イワツチ 岩土 +イワヅチ 岩秩 +イワツツミ 岩堤 +イワツボ 岩坪 +イワツボ 岩壷(岩壺) +イワツメ 岩爪 +イワヅメ 岩爪 +イワツリ 岩釣 +イワツル 岩鶴 +イワツル 岩釣 +イワヅル 岩鶴 +イワテ 岩手 +イワデ 岩出 +イワテツ 岩鉄(岩鐵) +イワテヤマ 岩手山 +イワテラ 岩寺 +イワデラ 岩寺 +イワデラ 巌寺(巖寺) +イワト 岩戸 +イワト 岩登 +イワド 岩戸 +イワド 岩土 +イワトウ 岩藤 +イワトウ 岩東 +イワドウ 岩藤 +イワドウ 岩道 +イワドウ 岩堂 +イワドウ 岩銅 +イワドウ 岩同 +イワトコ 岩床 +イワトミ 岩富 +イワトミ 岩冨 +イワドメ 岩留 +イワナ 岩名 +イワナ 巌名 +イワナカ 岩中 +イワナカ 岩仲 +イワナガ 岩永 +イワナガ 岩長 +イワナグチ 岩穴口 +イワナシ 岩梨 +イワナシ 磐梨 +イワナジ 岩名地 +イワナチ 岩名地 +イワナデ 岩撫 +イワナベ 岩辺 +イワナベ 岩鍋 +イワナベ 岩邊 +イワナベ 岩邉 +イワナミ 岩波 +イワナミ 岩浪 +イワナミ 岩並 +イワナリ 岩成 +イワナリ 岩也 +イワナワ 岩縄 +イワニ 岩荷 +イワニシ 岩西 +イワニシ 巌西(巖西) +イワヌシ 巌主(巖主) +イワヌシ 厳主 +イワヌマ 岩沼 +イワネ 岩根 +イワネ 岩子 +イワネ 巌根(巖根) +イワネ 磐根 +イワノ 岩野 +イワノ 岩埜 +イワノ 巌野 +イワノ 岩乃 +イワノ 巖野 +イワノウエ 岩ノ上 +イワノウエ 岩野上 +イワノウエ 岩の上 +イワノウエ 岩之上 +イワノウチ 岩野内 +イワノヤ 岩之谷 +イワバ 岩場 +イワバ 岩葉 +イワバ 岩庭 +イワハエ 岩拼 +イワバエ 岩生 +イワハギ 岩萩 +イワハザマ 岩迫 +イワハシ 岩橋 +イワバシ 岩橋 +イワハセ 磐長谷 +イワハタ 岩畑 +イワハタ 岩端 +イワハタ 岩畠 +イワバタ 岩端 +イワハナ 岩鼻 +イワハナ 岩花 +イワハナ 岩端 +イワハネ 岩羽 +イワハマ 岩浜 +イワハマ 岩濱 +イワバヤシ 岩林 +イワバヤシ 巌林(巖林) +イワハラ 岩原 +イワヒ 岩樋 +イワヒ 岩日 +イワビキ 岩引 +イワヒサ 岩久 +イワヒラ 岩平 +イワヒラキ 岩開 +イワヒロ 岩広 +イワヒロ 岩弘 +イワヒロ 岩廣 +イワフ 岩府 +イワブ 岩部 +イワブキ 岩吹 +イワブキ 岩蕗 +イワフジ 岩藤 +イワフチ 岩渕(岩渊) +イワフチ 岩淵 +イワブチ 岩渕(岩渊) +イワブチ 岩淵 +イワブチ 巌渕(巖渕) +イワブチ 磐渕 +イワブチ 巌淵(巖淵) +イワブチ 磐淵 +イワブチ 嵒淵 +イワブチ 嵓渕 +イワフネ 岩船 +イワフネ 岩舩 +イワフネ 岩舟 +イワベ 岩部 +イワベ 岩辺 +イワベ 岩邊 +イワホカ 岩外 +イワホシ 岩星 +イワホラ 岩洞 +イワホリ 岩堀 +イワホリ 岩掘 +イワボリ 岩堀 +イワマ 岩間 +イワマ 岩摩 +イワマ 巌間 +イワマ 巌真 +イワマ 岩磨 +イワマ 巖間 +イワマエ 岩前 +イワマキ 岩牧 +イワマキ 岩巻 +イワマサ 岩政 +イワマサ 岩正 +イワマス 岩増 +イワマス 岩益 +イワマチ 岩町 +イワマツ 岩松 +イワマル 岩丸 +イワマル 井和丸 +イワミ 岩見 +イワミ 石見 +イワミ 岩味 +イワミ 巌見 +イワミ 岩三 +イワミ 岩美 +イワミ 厳見 +イワミ 巖見 +イワミズ 岩水 +イワミズ 巌水 +イワミズ 巖水 +イワミダ 岩見田 +イワミチ 岩道 +イワミツ 岩満(岩滿) +イワミツ 岩光 +イワミネ 岩峰 +イワミネ 岩峯 +イワミヤ 岩宮 +イワミヤ 岩見谷 +イワミヤ 岩見屋 +イワミヤ 石見屋 +イワムカイ 岩向 +イワムネ 岩宗 +イワムラ 岩村 +イワムラ 岩邑 +イワムラ 巌村 +イワムラ 磐村 +イワムレ 岩群 +イワムロ 岩室 +イワメ 岩目 +イワメゴ 岩目後 +イワメジ 岩目地 +イワモチ 岩持 +イワモト 岩本 +イワモト 岩元 +イワモト 岩泉 +イワモト 巌本 +イワモト 磐本 +イワモト 嚴本 +イワモト 巖本 +イワモリ 岩森 +イワヤ 岩谷 +イワヤ 岩屋 +イワヤ 巌谷 +イワヤ 岩矢 +イワヤ 巖谷 +イワヤ 窟 +イワヤ 磐谷 +イワヤエ 岩八重 +イワヤガノ 岩屋ケ野 +イワヤグチ 岩屋口 +イワヤス 岩安 +イワヤナギ 岩柳 +イワヤノ 岩屋野 +イワヤノ 岩屋ケ野 +イワヤマ 岩山 +イワヤマ 磐山 +イワヤマ 盤山 +イワユキ 岩行 +イワヨシ 岩吉 +イワヨシ 岩好 +イワヨシ 岩芳 +イワラ 井藁 +イワワキ 岩脇(岩𦚰) +イワワキ 磐脇 +イン 因 +イン 印 +イン 院 +イン 自 +インエン 印遠 +インカワ 印河 +インキ 隠木 +インギ 隠木 +インキョ 隠居 +インキョ 院去 +インキョ 印居 +インキョウ 院京 +インギン 印銀 +インギン 印吟 +イング 印具 +イングウ 印宮 +インサコ 陰迫 +インザン 印山 +インジョウ 院上 +インセミ 院瀬見 +インゼン 隠善 +インダ 印田 +インダ 隠田 +インダ 因田 +インダ 院田 +インダ 員田 +インタニ 因谷 +インタニ 戌谷 +インタボン 院多本 +インツカ 隠塚 +インヅカ 隠塚 +インヅカ 印束 +インヅカ 印塚 +インデ 印出 +インデイ 因泥 +インデイ 印出井 +インデン 位田 +インデン 印田 +インデン 因田 +インデン 院田 +イントウ 印藤 +イントウ 印東 +イントウ 引頭 +イントウ 因藤 +イントウ 印頭 +インドウ 犬童 +インドウ 印藤 +インドウ 印東 +インドウ 引頭 +インドウ 因藤 +インドウ 引藤 +インドウ 犬藤 +インドウ 印道 +インドウ 印籐 +イントク 戍徳 +イントク 戌徳 +インナイ 犬内 +インナイ 院内 +インナミ 印南 +インナミ 院南 +インナミ 印浪 +インナミ 隠浪 +インナン 印南 +インナン 院南 +インノ 陰野 +インノ 陰能 +インノ 隠野 +インノ 印野 +インノ 因野 +インノ 員野 +インノ 因埜 +インノウ 陰能 +インノウ 院納 +インノウ 院能 +インバ 印波 +インバ 印幡 +インバ 印旛 +インバ 因葉 +インヒラ 印平 +インベ 井辺 +インベ 印部 +インベ 忌部 +インベ 斎部 +インベ 井邊 +インベ 齋部 +インベ 位部 +インマ 井馬 +インマ 因間 +インマキ 印牧 +インマル 印丸 +インマル 院丸 +インミヤ 印宮 +インヤク 印鑰 +インヤマ 院山 +ウ 鵜 +ウアサ 鵜浅 +ウイ 宇井 +ウイ 右井 +ウイ 鵜居 +ウイ 宇居 +ウイ 鵜井 +ウイエ 鵜家 +ウイクス 有為楠 +ウイケ 鵜池 +ウイシ 羽衣石 +ウイジ 初治 +ウイソ 初祖 +ウィックス 有為楠 +ウイト 宇井戸 +ウイド 宇井土 +ウイナタ 初刀 +ウイノ 宇井野 +ウイロウ 外良 +ウイロウ 外郎 +ウウラ 鵜浦 +ウウラ 宇浦 +ウエ 上 +ウエ 植 +ウエ 上江 +ウエ 宇恵 +ウエ 宇江 +ウエ 宇衛(宇衞) +ウエ 右江 +ウエ 宇惠 +ウエ 卯江 +ウエアオキ 上青木 +ウエアカサカ 上赤坂 +ウエアカサカ 上赤阪 +ウエアサ 上浅 +ウエアゼチ 上畦地 +ウエアタリ 上当 +ウエアタリ 上當 +ウエアナ 上穴 +ウエアミ 上網 +ウエアラ 上荒 +ウエイ 上井 +ウエイ 植井 +ウエイ 宇栄 +ウエイエ 上家 +ウエイエ 植家 +ウエイオ 上井尾 +ウエイケ 上池 +ウエイシ 上石 +ウエイシ 植石 +ウエイズミ 上泉 +ウエイタ 上板 +ウエイタニ 上井谷 +ウエイチ 上市 +ウエイナバ 上稲葉 +ウエイヌイ 上乾 +ウエイワ 上岩 +ウエウチ 上内 +ウエウチ 植内 +ウエウマ 上馬 +ウエウラ 上浦 +ウエウラ 植浦 +ウエウンテン 上運天 +ウエエ 上江 +ウエエキ 上溢 +ウエエダ 上枝 +ウエエダ 植江田 +ウエエビス 上夷 +ウエオ 上尾 +ウエオ 植尾 +ウエオ 上生 +ウエオ 上大 +ウエオオゾノ 上大薗 +ウエオオタ 上大田 +ウエオオタニ 上大谷 +ウエオオトシ 上大年 +ウエオオマエ 上大前 +ウエオカ 上岡 +ウエオカ 植岡 +ウエオキ 上沖 +ウエオク 上奥 +ウエオチ 上落 +ウエオノダ 上小野田 +ウエオリ 上折 +ウエオロ 上苙 +ウエカ 上加 +ウエカ 植家 +ウエガ 上賀 +ウエガイ 上貝 +ウエカイツ 上貝津 +ウエガイツ 上貝津 +ウエガイト 上垣内 +ウエカギ 上鍵 +ウエガキ 上垣 +ウエガキ 上柿 +ウエガキ 植垣 +ウエガキウチ 上垣内 +ウエカク 上角 +ウエカゲ 上景 +ウエカシ 上柏 +ウエカジ 上梶 +ウエカジ 植梶 +ウエカジ 上鍛治 +ウエカジ 上加治 +ウエカジ 上鍛冶 +ウエカジ 上鍜治 +ウエガシ 上柏 +ウエカジサコ 上梶迫 +ウエガスミ 上霞 +ウエカセダ 上加世田 +ウエカタ 上方 +ウエカタ 上片 +ウエカタ 上堅 +ウエカタ 植片 +ウエカタ 植方 +ウエガタ 上形 +ウエガタ 上県 +ウエガタニ 上ケ谷 +ウエカツ 上葛 +ウエカド 上門 +ウエカド 上角 +ウエガニワ 上鹿庭 +ウエカネ 上金 +ウエカネ 上兼 +ウエガネ 上兼 +ウエカネクリ 上兼栗 +ウエガハラ 上ケ原 +ウエカマ 上釜(上釡) +ウエガマ 上釜(上釡) +ウエカミ 上神 +ウエカミ 植上 +ウエガミ 上神 +ウエガミ 植上 +ウエガミ 上紙 +ウエガミ 上督 +ウエカメ 上亀 +ウエカヤ 植萱 +ウエカラ 上空 +ウエカリヤ 上仮屋 +ウエカワ 上川 +ウエカワ 上河 +ウエカワ 植川 +ウエカワ 植河 +ウエガワ 上川 +ウエガンナ 上鉄穴 +ウエキ 植木 +ウエキ 上木 +ウエキ 植 +ウエキ 樹 +ウエキ 樹木 +ウエキ 植城 +ウエキ 宇江喜 +ウエキ 上浴 +ウエキ 上惠木 +ウエキ 植喜 +ウエキ 植樹 +ウエギシ 上岸 +ウエキゾノ 植木園 +ウエキタ 上北 +ウエキタ 植北 +ウエキタ 植喜多 +ウエキダ 植木田 +ウエギタ 植北 +ウエキタニ 植木谷 +ウエキド 上木戸 +ウエキド 上城戸 +ウエキハラ 上木原 +ウエキハラ 植木原 +ウエキヨ 上清 +ウエキョウ 上京 +ウエギリ 上桐 +ウエキリハラ 上桐原 +ウエクサ 植草 +ウエクサ 上草 +ウエクサ 植艸 +ウエグサ 植草 +ウエグサ 上草 +ウエクズ 上葛 +ウエグチ 上口 +ウエクニ 上国 +ウエクニ 上國 +ウエクボ 上久保 +ウエクボ 上窪 +ウエクボ 植久保 +ウエクマ 上熊 +ウエクマス 上熊須 +ウエクモジ 上雲地 +ウエクラ 上倉 +ウエクラ 上蔵(上藏) +ウエクラ 植倉 +ウエクリ 殖栗 +ウエクリ 上栗 +ウエクリ 植栗 +ウエグリ 殖栗 +ウエグリ 上栗 +ウエグリ 植栗 +ウエケ 上家 +ウエケ 植家 +ウエコ 上子 +ウエコウ 上甲 +ウエコウ 上高 +ウエゴウ 上郷 +ウエコウジ 上小路 +ウエゴウチ 上垣内 +ウエコシ 上越 +ウエコシ 上腰 +ウエゴシ 上越 +ウエコバ 上木場 +ウエコミ 上込 +ウエゴモリ 上籠 +ウエゴモリ 上篭 +ウエゴモリ 上蘢 +ウエサ 上佐 +ウエサカ 上坂 +ウエサカ 上阪 +ウエサカ 植坂 +ウエサカ 植阪 +ウエザカイ 上境 +ウエサキ 上崎 +ウエサキ 植崎 +ウエサキ 上嵜 +ウエザキ 上崎 +ウエザキ 植崎 +ウエザキ 上嵜 +ウエサク 上作 +ウエサク 植作 +ウエサコ 上迫 +ウエサコ 上硲 +ウエサコ 上佐古 +ウエサコ 上佐近 +ウエササ 上笹 +ウエサダ 上貞 +ウエサダ 上定 +ウエサダ 溶定 +ウエサト 上里 +ウエサト 植里 +ウエザト 上里 +ウエサライエ 上更家 +ウエサワ 上沢 +ウエサワ 上澤 +ウエサワ 植沢 +ウエサワ 植澤 +ウエザワ 上沢 +ウエザワ 上澤 +ウエザワ 植沢 +ウエザワ 植澤 +ウエサンノブ 上三信 +ウエジ 上地 +ウエジ 植地 +ウエジ 上路 +ウエジ 上治 +ウエジ 上ヱ地 +ウエジ 上工地 +ウエシオ 上塩 +ウエシキ 植敷 +ウエシゲ 上重 +ウエシゲ 上繁 +ウエシゲ 植重 +ウエシタ 上下 +ウエシタ 植下 +ウエジタ 上次田 +ウエジッコク 上拾石 +ウエシトミ 上蔀 +ウエシナ 上品 +ウエシバ 上芝 +ウエシバ 植芝 +ウエシバ 上柴 +ウエシバ 上志羽 +ウエシバ 植柴 +ウエシマ 上島 +ウエシマ 上嶋 +ウエシマ 植島 +ウエシマ 植嶋 +ウエシマ 上嶌 +ウエシマ 植嶌 +ウエジマ 上島 +ウエジマ 上嶋 +ウエジマ 植島 +ウエジマ 植嶋 +ウエジマ 上嶌 +ウエシミズ 上清水 +ウエシモ 上霜 +ウエジュッコク 上拾石 +ウエショ 上所 +ウエジョ 上所 +ウエジョ 上処(上處) +ウエジョウ 上条 +ウエジョウ 上條 +ウエジョウ 上門 +ウエジョウ 上城 +ウエジョウ 上所 +ウエジョウ 植條 +ウエジョウ 植条 +ウエジョウ 上篠 +ウエジョウ 上亟 +ウエシロ 上城 +ウエシロ 宇江城 +ウエシロ 植城 +ウエシロ 宇栄城 +ウエシロ 上栄城 +ウエシロ 植代 +ウエシン 上新 +ウエシン 植新 +ウエシン 上真(上眞) +ウエジンダ 上神田 +ウエス 上江洲 +ウエス 上須 +ウエス 上江州 +ウエス 上江洌 +ウエズ 上江洲 +ウエズ 上江州 +ウエズ 上江洌 +ウエズ 植頭 +ウエズ 上洲 +ウエズ 上州 +ウエスガ 上管 +ウエスギ 上杉 +ウエスギ 植杉 +ウエスギ 上椙 +ウエスギ 植椙 +ウエスギ 樹杉 +ウエスギ 宇江杉 +ウエスジ 上筋 +ウエスズ 上鈴 +ウエススキ 植薄 +ウエスナ 上砂 +ウエスナグチ 上砂口 +ウエスミ 上住 +ウエスミ 植炭 +ウエズミ 上住 +ウエズミ 上隅 +ウエズミ 植住 +ウエズミ 上澄 +ウエズミヤ 上住谷 +ウエセ 上瀬 +ウエセ 上勢 +ウエセド 上勢頭 +ウエソウ 上宗 +ウエゾウワ 上造輪 +ウエソネ 上曽根 +ウエソノ 上園 +ウエソノ 上薗 +ウエゾノ 上園 +ウエゾノ 上薗 +ウエゾノ 植園 +ウエゾノ 植囿 +ウエゾノ 植薗 +ウエゾノ 上囿 +ウエソノダ 上園田 +ウエソラ 上空 +ウエタ 上田 +ウエタ 植田 +ウエタ 上江田 +ウエダ 上田 +ウエダ 植田 +ウエダ 上枝 +ウエダ 上江田 +ウエダ 宇枝 +ウエダ 殖田 +ウエダ 宇円田(宇圓田) +ウエダ 植江田 +ウエダ 上駄 +ウエダ 宇江田 +ウエダ 上多 +ウエダ 植多 +ウエタイ 上田井 +ウエダイ 上田井 +ウエダイ 植第 +ウエダイチョウ 上大長 +ウエタイラ 上平 +ウエタイラ 上田平 +ウエダイラ 上平 +ウエタオ 上峠 +ウエタオ 上垰 +ウエタオ 植峠 +ウエタオ 植垰 +ウエダオ 上田尾 +ウエタカ 上高 +ウエタカ 植高 +ウエタカガイト 上高垣内 +ウエタカヤ 上高家 +ウエタキ 上滝 +ウエタキ 上瀧 +ウエタキ 上江滝 +ウエタキ 上江瀧 +ウエタケ 植竹 +ウエタケ 上竹 +ウエタケ 上武 +ウエタケ 植武 +ウエタダニ 上田谷 +ウエタツ 上辰 +ウエタナ 上棚 +ウエダナ 上棚 +ウエタナカ 上田中 +ウエタニ 上谷 +ウエタニ 植谷 +ウエタニ 上渓(上溪) +ウエダニ 上谷 +ウエタニダ 上谷田 +ウエダハラ 上田原 +ウエタヒラ 上田平 +ウエタビラ 上田平 +ウエダヒラ 上田平 +ウエタマ 上玉 +ウエダヤ 上田谷 +ウエダヤ 上田屋 +ウエタル 上樽 +ウエダン 上段 +ウエチ 上地 +ウエチ 植地 +ウエチ 植池 +ウエヂ 上地 +ウエヂ 植地 +ウエチカ 上周 +ウエチャ 植茶 +ウエチャタニ 上茶谷 +ウエチャヤ 上茶谷 +ウエツ 上津 +ウエツ 植津 +ウエツ 上江津 +ウエヅ 上津 +ウエツカ 上塚 +ウエヅカ 上塚 +ウエツキ 植月 +ウエツギ 上続 +ウエツギ 上續 +ウエツギ 植次 +ウエヅキ 上月 +ウエツグ 上続 +ウエツグ 上續 +ウエツグ 上継 +ウエツグ 上次 +ウエツケ 植付 +ウエツケ 植附 +ウエツジ 上辻 +ウエツジ 植辻 +ウエツジ 上逵 +ウエツチ 上土 +ウエツチタニ 上土谷 +ウエツチヤ 上土谷 +ウエツナ 上綱 +ウエツネ 植常 +ウエツハラ 上津原 +ウエツバラ 上津原 +ウエツボ 上坪 +ウエヅマ 上妻 +ウエテ 植手 +ウエデ 上出 +ウエデ 上手 +ウエデ 植出 +ウエテラ 上寺 +ウエデラ 上寺 +ウエト 上戸 +ウエト 植戸 +ウエド 上戸 +ウエド 上土 +ウエドイ 上土井 +ウエドイ 上土居 +ウエトウ 上東 +ウエトウ 上藤 +ウエトウ 上遠 +ウエトウ 植東 +ウエトウ 上唐 +ウエドウ 上道 +ウエドウ 上藤 +ウエドウ 上堂 +ウエトウゲ 上峠 +ウエトキ 上時 +ウエトコ 上床 +ウエトダ 上戸田 +ウエドノ 上殿 +ウエトミ 上富(上冨) +ウエトモ 上友 +ウエナ 上名 +ウエナ 上奈 +ウエナイ 植苗 +ウエナエ 植苗 +ウエナカ 上中 +ウエナカ 上仲 +ウエナカ 植中 +ウエナカ 植仲 +ウエナガ 上永 +ウエナガ 植永 +ウエナガ 上長 +ウエナガ 植長 +ウエナカイ 上中居 +ウエナカダ 上中田 +ウエナカマ 上仲間 +ウエナカマエ 上中前 +ウエナカムラ 上中村 +ウエナベ 上鍋 +ウエナミ 上南 +ウエナミ 上浪 +ウエナミ 上波 +ウエナミ 植南 +ウエナミ 植並 +ウエナリ 上成 +ウエナル 上鳴 +ウエニ 上荷 +ウエニ 上仁 +ウエニイナイ 上新内 +ウエニシ 上西 +ウエニシ 植西 +ウエニシゾノ 上西園 +ウエニダ 上荷田 +ウエヌキ 上貫 +ウエヌシ 植主 +ウエヌマ 上沼 +ウエネ 上根 +ウエネ 植根 +ウエノ 上野(上墅) +ウエノ 植野 +ウエノ 上埜 +ウエノ 上農 +ウエノ 上之 +ウエノ 宇恵野 +ウエノ 上乃 +ウエノ 植埜 +ウエノ 上濃 +ウエノ 植濃 +ウエノ 上能 +ウエノ 上納 +ウエノ 宇惠野 +ウエノ 上𡌛 +ウエノ 植𡌛 +ウエノ 上ノ +ウエノウ 上農 +ウエノウチ 上野内 +ウエノカツ 上之勝 +ウエノカツ 上ノ勝 +ウエノカド 上之門 +ウエノカミ 上ノ神 +ウエノカミ 上之神 +ウエノカミ 植野上 +ウエノカワ 上ノ川 +ウエノガワ 上野川 +ウエノゴウヤ 上之郷谷 +ウエノサワ 上野沢(上野澤) +ウエノジリ 上野尻 +ウエノソノ 上之園 +ウエノソノ 上之薗 +ウエノソノ 上ノ園 +ウエノソノ 上ノ薗 +ウエノソノ 上の園 +ウエノソノ 上野園 +ウエノゾノ 上之園 +ウエノダ 上野田 +ウエノダイ 上野代 +ウエノダイ 上野台(上野臺) +ウエノダイ 上ノ台 +ウエノタイラ 上野平 +ウエノタイラ 上ノ平 +ウエノダイラ 上野平 +ウエノタニ 上野谷 +ウエノタニ 上之谷 +ウエノダン 上段 +ウエノダン 上之段 +ウエノダン 上ノ段 +ウエノダン 上野段 +ウエノツチ 上ノ土 +ウエノドウ 上野堂 +ウエノハタ 植野畑 +ウエノハタ 上野畑 +ウエノハタ 上ノ畑 +ウエノハマ 上之浜 +ウエノハラ 上之原 +ウエノハラ 上ノ原 +ウエノハラ 上野原 +ウエノハラ 植之原 +ウエノハラ 植ノ原 +ウエノヒラ 上野平 +ウエノヒラ 上之平 +ウエノブ 上延 +ウエノブ 上信 +ウエノベ 上延 +ウエノボウ 上ノ坊 +ウエノボウ 上之坊 +ウエノボウ 上の坊 +ウエノホリ 上ノ堀 +ウエノホリ 上之堀 +ウエノボリ 植野堀 +ウエノマチ 上ノ町 +ウエノミチ 上ノ道 +ウエノミョウ 上ノ茗 +ウエノミョウ 上野明 +ウエノモト 上野毛戸 +ウエノモト 上ノ本 +ウエノモト 上野本 +ウエノヤ 上野谷 +ウエノヤ 上野矢 +ウエノヤマ 上野山 +ウエノヤマ 上ノ山 +ウエノヤマ 上之山 +ウエノヤマ 上埜山 +ウエハ 上羽 +ウエハ 上葉 +ウエハ 植波 +ウエバ 上羽 +ウエバ 上場 +ウエバ 上葉 +ウエバ 植場 +ウエバ 植羽 +ウエバ 植葉 +ウエバサミ 上狭 +ウエハシ 上橋 +ウエハタ 上畑 +ウエハタ 上畠 +ウエハタ 上端 +ウエハタ 植畑 +ウエハタ 植畠 +ウエバチ 上鉢 +ウエバチ 植鉢 +ウエハナ 植花 +ウエハネ 上刎 +ウエハバ 上羽場 +ウエババ 上馬場(上馬塲) +ウエハブ 上土生 +ウエハマ 上浜 +ウエハマ 上濱 +ウエハマ 植浜 +ウエハマガワ 上浜川 +ウエバヤシ 上林 +ウエバヤシ 植林 +ウエハラ 上原 +ウエハラ 植原 +ウエハラ 宇栄原 +ウエハラ 宇江原 +ウエハラ 宇榮原 +ウエハライ 上払 +ウエハライ 上拂 +ウエハラグチ 上原口 +ウエハラダ 上原田 +ウエハル 上春 +ウエバル 上原 +ウエバル 宇栄原 +ウエバル 宇榮原 +ウエバンソウ 上番増 +ウエバンゾウ 上番増 +ウエヒガシ 上東 +ウエヒガシ 植東 +ウエヒサ 上久 +ウエヒサ 植久 +ウエヒノキ 植桧 +ウエヒノキ 植檜 +ウエヒラ 上平 +ウエヒラ 植平 +ウエヒロ 上広 +ウエヒロ 上廣 +ウエヒロ 植弘 +ウエヒロ 上弘 +ウエヒロ 植広 +ウエブ 上符 +ウエフシ 上伏 +ウエフジ 上藤 +ウエフジ 植藤 +ウエブセ 上伏 +ウエブチ 上渕 +ウエブチ 上淵 +ウエブチ 植渕 +ウエフネ 上船(上舩) +ウエフル 上古 +ウエブン 上分 +ウエベ 上部 +ウエベ 上辺(上邉) +ウエベ 植部 +ウエヘイダ 上平田 +ウエボ 上保 +ウエボウ 上坊 +ウエボウ 上房 +ウエボウ 上防 +ウエボウエ 上坊江 +ウエホド 上程 +ウエホリ 上堀 +ウエホリ 上掘 +ウエボリ 上堀 +ウエマ 上間 +ウエマイ 上舞 +ウエマエ 上前 +ウエマエ 植前 +ウエマエトマリ 上前泊 +ウエマエドマリ 上前泊 +ウエマキ 上牧 +ウエマキ 上巻 +ウエマキ 上槙 +ウエマジ 上真地 +ウエマス 上桝 +ウエマス 植益 +ウエマス 上枡 +ウエマス 上升 +ウエマス 上増 +ウエマスダ 上増田 +ウエマスヤ 上桝谷 +ウエマチ 上町 +ウエマチ 植町 +ウエマツ 植松 +ウエマツ 上松 +ウエマツ 栽松 +ウエマツ 植枩 +ウエマル 上丸 +ウエマル 植丸 +ウエミ 上見 +ウエミ 上実 +ウエミ 上味 +ウエミ 上三 +ウエミ 植見 +ウエミ 植実 +ウエミ 植美 +ウエミズ 上水 +ウエミズクチ 上水口 +ウエミズタル 上水樽 +ウエミセ 上見世 +ウエミゾ 上溝 +ウエミチ 上道 +ウエミチ 植道 +ウエミチ 上通 +ウエミツ 上光 +ウエミツ 上満 +ウエミナミ 上南 +ウエミネ 上峯 +ウエミネ 上峰 +ウエミノ 上蓑 +ウエミヤ 上宮 +ウエミヤサコ 上宮迫 +ウエミョウダイ 上明代 +ウエムカイ 上向井 +ウエムカイ 上向 +ウエムカエ 上迎 +ウエムキ 上向 +ウエムキ 植向 +ウエムラ 上村 +ウエムラ 植村 +ウエムラ 樹村 +ウエムラ 上邑 +ウエムラ 上邨 +ウエムラ 植邨 +ウエムラ 植邑 +ウエムロ 上室 +ウエムロ 上榁 +ウエモト 上本 +ウエモト 植本 +ウエモト 上元 +ウエモト 植元 +ウエモノ 上者 +ウエモリ 上森 +ウエモリ 植森 +ウエモリ 植盛 +ウエモリ 上守 +ウエモリ 上盛 +ウエモン 上門 +ウエモンサ 右衛門佐 +ウエモンデン 上門田 +ウエモンド 上門戸 +ウエヤ 上屋 +ウエヤ 植屋 +ウエヤシキ 上屋敷 +ウエヤス 上保 +ウエヤス 上安 +ウエヤナギ 上柳 +ウエヤナギ 植柳 +ウエヤバラ 上矢原 +ウエヤブ 上籔 +ウエヤブ 上薮 +ウエヤブ 上藪 +ウエヤマ 上山 +ウエヤマ 植山 +ウエヤマ 鵜恵山 +ウエヤマダ 上山田 +ウエヨコテ 上横手 +ウエヨシ 上良 +ウエヨシ 上吉 +ウエヨシ 上好 +ウエヨシ 植吉 +ウエヨシ 上宜 +ウエヨナハラ 上与那原 +ウエヨナハラ 上與那原 +ウエヨナバル 上与那原 +ウエヨナバル 上與那原 +ウエラ 上良 +ウエラ 上羅 +ウエラ 植良 +ウエラ 上等 +ウエラ 植羅 +ウエワキ 上脇 +ウエワサ 上早稲 +ウエワセ 上早稲 +ウエワダ 上和田 +ウエワダ 植和田 +ウエンジョウ 上城 +ウエンダ 上段 +ウエンダ 宇円田(宇圓田) +ウエンダカリ 上村渠 +ウエンダン 上段 +ウエンド 上戸 +ウエンビュウ 上別府 +ウオ 宇尾 +ウオ 卯尾(夘尾) +ウオ 鵜尾 +ウオ 魚 +ウオ 宇夫 +ウオイ 魚井 +ウオイシ 魚石 +ウオウラ 魚浦 +ウオエ 魚江 +ウオオ 魚尾 +ウオオカ 魚岡 +ウオオチ 魚落 +ウオカ 宇岡 +ウオガエシ 魚返 +ウオガエリ 魚返 +ウオガタ 魚形 +ウオカワ 魚川 +ウオキ 魚木 +ウオギシ 魚岸 +ウオキリ 魚切 +ウオクラ 魚倉 +ウオザ 魚座 +ウオサカ 魚坂 +ウオサキ 魚崎 +ウオサキ 宇於崎 +ウオサキ 魚嵜 +ウオザキ 魚崎 +ウオザキ 宇於崎 +ウオザキ 宇於嵜 +ウオザキ 夘尾崎 +ウオサト 魚里 +ウオザト 魚里 +ウオサワ 魚沢 +ウオサワ 魚澤 +ウオザワ 魚沢 +ウオザワ 魚澤 +ウオシ 魚師 +ウオジ 魚路 +ウオシゲ 魚重 +ウオシタ 魚下 +ウオシマ 魚島 +ウオシマ 魚嶋 +ウオジマ 魚島 +ウオジマ 魚嶋 +ウオジマ 漁嶋 +ウオズ 魚津 +ウオズ 魚頭 +ウオスギ 魚杉 +ウオズミ 魚住 +ウオズミ 魚澄 +ウオズミ 魚角 +ウオセ 魚瀬 +ウオタ 魚田 +ウオタ 卯尾田 +ウオタ 魚多 +ウオダ 魚田 +ウオダ 卯尾田 +ウオタテ 魚立 +ウオダナ 魚棚 +ウオタニ 魚谷 +ウオチ 魚地 +ウオチ 魚池 +ウオツ 魚津 +ウオヅ 魚津 +ウオツギ 魚次 +ウオツリ 魚釣 +ウオト 魚戸 +ウオトメ 魚留 +ウオドメ 魚留 +ウオトリ 魚取 +ウオナガ 魚永 +ウオナミ 魚波 +ウオナリ 魚成 +ウオヌマ 魚沼 +ウオノ 魚野 +ウオノ 宇尾野 +ウオノミ 魚躬 +ウオハシ 魚橋 +ウオハマ 魚浜 +ウオハマ 魚濱 +ウオバヤシ 魚林 +ウオハラ 魚原 +ウオヒラ 魚平 +ウオフジ 魚藤 +ウオベ 魚部 +ウオミ 魚見 +ウオミ 魚躬 +ウオミ 魚海 +ウオミズ 魚水 +ウオムラ 魚村 +ウオモト 魚本 +ウオモリ 魚森 +ウオモリ 魚守 +ウオヤ 魚谷 +ウオヤ 魚屋 +ウオヤ 魚矢 +ウオヤ 魚家 +ウオヤマ 魚山 +ウオヨシ 魚好 +ウオワキ 魚脇 +ウオン 宇音 +ウカ 宇賀 +ウガ 宇賀 +ウガ 有我 +ウガ 烏我 +ウガ 宇加 +ウカイ 鵜飼 +ウカイ 浮海 +ウカイ 鵜海 +ウカイ 鵜養 +ウカイ 宇海 +ウカイ 宇貝 +ウカイ 鵣飼 +ウカイ 宇加井 +ウガイ 鵜飼 +ウガイ 雨谷 +ウガイ 鵜養 +ウガイ 宇海 +ウガイ 宇賀居 +ウガイ 養鸕 +ウカエ 宇加江 +ウガエリ 魚返 +ウカガイ 窺 +ウカガミ 宇賀神 +ウガキ 宇垣 +ウガキ 鵜垣 +ウカク 宇角 +ウカク 右角 +ウカゴ 鵜篭 +ウカジ 宇梶 +ウカジ 宇賀治 +ウカジ 宇加治 +ウカジ 鵜梶 +ウカジ 宇賀冶 +ウガジ 宇賀持 +ウガジ 宇賀治 +ウガジン 宇賀神 +ウガジン 宇賀伸 +ウカタ 右形 +ウガタ 宇賀田 +ウカタニ 宇加谷 +ウガタニ 宇賀谷 +ウカチ 宇加地 +ウガチ 宇賀地 +ウカツ 宇加津 +ウガツカ 宇賀塚 +ウガナ 宇賀那 +ウガノ 宇賀野 +ウガノ 宇加野 +ウガミ 宇上 +ウガミ 宇賀見 +ウガミ 鵜上 +ウカムラ 宇賀村 +ウカムラ 宇ケ村 +ウガムラ 宇賀村 +ウガモチ 宇賀持 +ウガモト 宇賀本 +ウカヤ 宇加谷 +ウガヤ 宇賀耶 +ウガヤ 烏賀陽 +ウガヤ 鵜芦 +ウガヤ 鵜谷 +ウガヤ 鳥賀陽 +ウガヤマ 宇賀山 +ウカリ 鵜狩 +ウガリ 鵜狩 +ウカワ 鵜川 +ウカワ 宇川 +ウカワ 右川 +ウカワ 卯川 +ウカワ 烏川 +ウカワ 川 +ウカワ 宇河 +ウカワ 鵜河 +ウカワ 鶇川 +ウカワ 鶇川 +ウカワ 鶫川 +ウガワ 鵜川 +ウガワ 宇川 +ウガワ 右川 +ウガワ 卯川 +ウガワ 烏川 +ウカン 有漢 +ウキ 卯木 +ウキ 宇木 +ウキ 浮気 +ウキ 夘木 +ウキ 浮 +ウキ 宇気 +ウキ 浮氣 +ウギ 卯木 +ウキアゲ 浮揚 +ウキアナ 浮穴 +ウキアミ 浮網 +ウキイエ 浮家 +ウキイケ 浮池 +ウキイシ 浮石 +ウキウチ 浮内 +ウキウラ 浮浦 +ウキオカ 浮岳 +ウキオカ 浮岡 +ウキカイ 浮貝 +ウキカイ 浮階 +ウキガイ 浮貝 +ウキガイ 浮海 +ウキガメ 浮亀 +ウキガヤ 浮ケ谷 +ウキカワ 浮川 +ウキガワ 浮川 +ウキキ 浮木 +ウキキ 浮亀 +ウキギ 浮気 +ウキギ 浮氣 +ウキクサ 浮草 +ウキサト 浮里 +ウキシオ 浮塩 +ウキシマ 浮島 +ウキシマ 浮嶋 +ウキシマ 浮嶌 +ウキショ 浮所 +ウキシロ 浮城 +ウキス 浮須 +ウキス 浮洲 +ウキス 浮巣 +ウキス 浮州 +ウキズ 浮図 +ウキズミ 浮住 +ウキセ 浮瀬 +ウキタ 浮田 +ウキタ 宇喜多 +ウキタ 宇喜田 +ウキタ 有喜多 +ウキダ 浮田 +ウキチ 浮地 +ウキツ 浮津 +ウキツカ 浮塚 +ウキヅカ 浮塚 +ウキツキ 浮月 +ウキト 浮渡 +ウキナ 浮名 +ウキナカ 浮中 +ウキナミ 浮並 +ウキナミ 浮波 +ウキノ 浮野 +ウキノリ 浮乗 +ウキバ 浮波 +ウキバ 浮葉 +ウキハシ 浮橋 +ウキハス 浮蓮 +ウキハラ 浮原 +ウキハラ 宇喜原 +ウキフネ 浮舟 +ウキフネ 浮船 +ウキブネ 浮舟 +ウキベ 浮辺 +ウキベ 浮部 +ウキベ 浮邊 +ウキベ 浮邉 +ウキミ 浮見 +ウキミヤ 浮宮 +ウキムタ 浮牟田 +ウキムラ 浮村 +ウキモト 浮本 +ウキモリ 浮森 +ウキモリ 浮守 +ウキヤ 浮谷 +ウキヤマ 浮山 +ウキュウ 卯休 +ウキヨ 浮世 +ウキョウ 右京 +ウキョウ 宇京 +ウク 宇久 +ウグイス 鴬 +ウグイス 鶯 +ウグイデ 鶯出 +ウグイデ 鴬出 +ウグサ 宇草 +ウクザト 宇久里 +ウグシロ 天宮城 +ウグス 鶯巣 +ウグス 鴬巣 +ウクタ 宇久田 +ウクダ 宇久田 +ウグチ 鵜口 +ウグチ 宇口 +ウグデ 鶯出 +ウグハラ 鴬原 +ウグハラ 鶯原 +ウクマ 宇熊 +ウクムラ 宇久村 +ウクモト 宇久本 +ウクモリ 鵜久森 +ウグモリ 鵜久森 +ウグモリ 鷠森 +ウグモリ 鵜森 +ウケ 有家 +ウケ 鵜家 +ウケ 宇毛 +ウケ 請 +ウケ 苧毛 +ウケ 荢毛 +ウゲ 宇下 +ウケイ 請井 +ウケイ 宇慶 +ウケイ 受井 +ウケオ 筌尾 +ウケカワ 請川 +ウケカワ 受川 +ウケガワ 請川 +ウケガワ 受川 +ウケガワ 浮川 +ウケガワ 請河 +ウケガワ 有家川 +ウケグチ 筌口 +ウケクラ 請蔵 +ウケクラ 請藏 +ウケジ 請地 +ウケシマ 請島 +ウケシマ 受島 +ウケセ 筌瀬 +ウケセ 受瀬 +ウケゼ 筌瀬 +ウケセキ 請関 +ウケゼキ 請関 +ウケゾノ 請園(請薗) +ウケゾノ 受園 +ウケタ 請田 +ウケダ 請田 +ウケダ 受田 +ウケタニ 請谷 +ウケチ 請地 +ウケナ 浮穴 +ウケノ 請野 +ウケノ 受野 +ウケノ 筌野 +ウケノクチ 受野口 +ウケバ 筌場 +ウケハタ 請畑 +ウケハナ 請花 +ウケベ 浮辺 +ウケベ 浮邊 +ウケベ 浮邉 +ウケマス 請舛 +ウケミズ 受水 +ウケムラ 請村 +ウケムラ 受村 +ウケモト 受本 +ウケモト 請元 +ウケモト 筌元 +ウケモリ 請盛 +ウコ 鵜子 +ウコ 宇古 +ウコ 宇小 +ウコウ 宇口 +ウコウ 右江 +ウコウ 右幸 +ウコウ 烏光 +ウコウ 羽向 +ウゴウ 宇郷 +ウゴシ 宇越 +ウゴモリ 鵜篭 +ウゴモリ 鵜籠 +ウコン 右近 +ウコン 右今 +ウコン 鵜近 +ウサ 宇佐 +ウサ 右佐 +ウザ 宇座 +ウザイ 有財 +ウサイダ 兎田 +ウサイダヤ 兎田谷 +ウサカ 羽坂 +ウサカ 苧坂 +ウサカ 宇坂 +ウサカ 鵜坂 +ウサカ 苧阪 +ウサカ 卯坂 +ウサカ 政坂 +ウサカ 荢坂 +ウサカ 夘坂 +ウサカ 荢阪 +ウサガ 宇佐賀 +ウザカ 苧坂 +ウサカミ 宇佐神 +ウサガミ 宇佐神 +ウサカワ 宇佐川 +ウサガワ 宇佐川 +ウサキ 宇崎 +ウザキ 宇嵜 +ウサキ 右崎 +ウザキ 宇崎 +ウザキ 鵜崎(鵜嵜) +ウザキ 右崎 +ウザキ 鵣崎 +ウザキ 宇埼 +ウザキ 宇岬 +ウザキ 宇嵜 +ウザキ 卯崎 +ウサギダ 兎田 +ウサギダ 宇佐木田 +ウサギナイ 兎内 +ウサギナイ 兔内 +ウサギハライ 兎拂 +ウサギバライ 兎払 +ウサギバライ 兎拂 +ウササキ 宇佐崎 +ウサザキ 宇佐崎 +ウサザキ 宇佐嵜 +ウザシキ 宇座敷 +ウサズミ 宇佐住 +ウサダ 宇佐田 +ウサダ 宇貞 +ウサト 卯里 +ウサト 鵜里 +ウザト 宇里 +ウサナミ 宇佐波 +ウサノ 宇佐野 +ウサバヤシ 右佐林 +ウサバヤシ 右左林 +ウサハラ 宇佐原 +ウサミ 宇佐美 +ウサミ 宇佐見 +ウサミ 宇佐神 +ウサミ 宇参 +ウサミ 右左美 +ウサミ 右左見 +ウサミ 有佐見 +ウサミ 宇左美 +ウサモト 宇佐元 +ウサワ 鵜澤 +ウサワ 宇沢 +ウサワ 宇澤 +ウザワ 鵜沢 +ウザワ 鵜澤 +ウザワ 宇沢 +ウザワ 宇澤 +ウザワ 夘沢 +ウザワ 卯沢(卯澤) +ウザワ 右沢 +ウザワ 右澤 +ウザワ 夘澤 +ウザワ 鶉沢 +ウシ 牛 +ウジ 宇治 +ウジ 氏 +ウジ 宇字 +ウシアマ 牛尼 +ウシイ 牛居 +ウシイ 丑井 +ウジイ 雲林院 +ウジイ 氏井 +ウジイ 氏居 +ウジイ 宇地井 +ウジイエ 氏家 +ウジイエ 宇治家 +ウシイケ 牛池 +ウシイシ 牛石 +ウシイワ 牛岩 +ウシウチ 牛内 +ウジウラ 氏浦 +ウシエ 牛江 +ウシエ 牛衛 +ウジエ 氏家 +ウジエ 氏江 +ウジエ 氏衛 +ウシオ 牛尾 +ウシオ 潮 +ウシオ 生塩 +ウシオ 海塩 +ウシオ 丑尾 +ウシオ 牛苧 +ウシオ 潮汐 +ウジオ 氏尾 +ウシオウ 牛王 +ウジオウ 氏王 +ウシオカ 丑岡 +ウシオカ 牛岡 +ウジオカ 氏岡 +ウシオギ 潮木 +ウシオギ 牛黄蓍 +ウシオク 牛奥 +ウシオタ 潮田 +ウシオダ 潮田 +ウシオダ 牛尾田 +ウシオダ 丑尾田 +ウシオダ 牛王田 +ウシオタニ 牛尾谷 +ウシオダニ 牛尾谷 +ウシオヅ 潮津 +ウシオミ 潮見 +ウジカ 氏家 +ウジカ 宇自可 +ウシカイ 牛飼 +ウシガイ 牛飼 +ウシガオ 牛ケ尾 +ウシガキ 牛垣 +ウシガセ 牛ケ瀬 +ウシカタ 牛方 +ウシガタニ 丑ケ谷 +ウジカネ 氏兼 +ウシガミ 牛上 +ウシガミ 牛神 +ウシガミ 丑上 +ウジガミ 氏神 +ウジガミ 氏上 +ウシガヤチ 牛ケ谷内 +ウシカワ 牛川 +ウシカワ 牛河 +ウジカワ 宇治川 +ウジカワ 氏川 +ウジガワ 宇治川 +ウジガワ 氏川 +ウシキ 牛木 +ウシキ 宇敷 +ウシキ 丑木 +ウシキ 右色 +ウシキ 宇式 +ウシキ 宇舗 +ウシキ 牛鬼 +ウシキ 牛城 +ウシギ 牛木 +ウジキ 氏木 +ウジキ 宇治木 +ウシク 牛久 +ウシク 牛玖 +ウシクサ 牛草 +ウシグサ 牛草 +ウシグチ 牛口 +ウジグチ 氏口 +ウシクビ 牛首 +ウシクボ 牛久保 +ウシクボ 牛窪 +ウシクボ 丑久保(丒久保) +ウシクマ 牛熊 +ウシクマ 牛隈 +ウシクラ 牛倉 +ウジクラ 氏倉 +ウシグロ 牛黒 +ウシゲ 鵜重 +ウジケ 氏家 +ウシコ 丑子 +ウシコ 牛古 +ウジゴウ 宇治郷 +ウシコウジ 牛河内 +ウシゴエ 牛越 +ウシコシ 牛越 +ウシコシ 丑越 +ウシゴシ 牛越 +ウシゴミ 牛込 +ウシゴメ 牛込 +ウシゴメ 牛米 +ウシゴメ 丑米(丒米) +ウシゴメ 丑込 +ウシサカ 牛坂 +ウシザカ 牛坂 +ウシザキ 牛崎 +ウシサク 牛作 +ウシサコ 牛迫 +ウシザコ 牛迫 +ウジサト 氏里 +ウジサト 氏郷 +ウシザワ 牛沢 +ウシザワ 牛澤 +ウシザワ 丑沢 +ウシザワ 丑澤 +ウジサワ 宇治沢(宇治澤) +ウシジ 牛路 +ウジシ 氏師 +ウジシタ 氏下 +ウシジマ 牛島 +ウシジマ 牛嶋 +ウシジマ 牛嶌 +ウシジマ 丑島 +ウシジマ 丑嶋 +ウジシマ 氏島 +ウシズ 牛津 +ウシズカ 牛塚 +ウシセコ 牛迫 +ウシセコ 牛追 +ウシタ 牛田 +ウシタ 丑田(丒田) +ウシタ 宇下 +ウシダ 牛田 +ウシダ 丑田(丒田) +ウシダ 牛多 +ウジタ 氏田 +ウジタ 宇治田 +ウシタキ 牛滝(牛瀧) +ウシダキ 牛抱 +ウシタテ 牛建 +ウシダテ 牛建 +ウシダテ 丑舘 +ウシタニ 牛谷 +ウシタニ 丑谷 +ウジタニ 宇治谷 +ウシヅ 牛津 +ウシツカ 牛塚 +ウシヅカ 牛塚 +ウジツグ 氏次 +ウシヅクリ 牛造 +ウシヅメ 牛詰 +ウシト 牛戸 +ウシド 牛戸 +ウシドウ 牛堂 +ウシトケ 牛土毛 +ウジトコ 宇治土公 +ウシドメ 牛留 +ウシトラ 艮 +ウシトラ 丑寅 +ウジナ 宇品 +ウシナカ 牛中 +ウシナガ 牛永 +ウシナガ 丑永 +ウジナカ 氏中 +ウジナガ 氏永 +ウジナガ 氏長 +ウジナワ 氏縄 +ウジナワ 氏繩 +ウシネ 牛根 +ウシノ 牛野 +ウシノ 丑野 +ウジノ 宇治野 +ウジノ 氏野 +ウジノ 姓農 +ウシノハマ 牛之浜 +ウシノハマ 牛ノ浜 +ウシノハマ 牛ノ濱 +ウシノハマ 牛之濱 +ウシノハマ 牛の浜 +ウシバ 牛場(牛塲) +ウシバ 丑場 +ウジハシ 宇治橋 +ウジハシ 氏橋 +ウジバシ 宇治橋 +ウシハタ 牛畠 +ウシバナ 牛鼻 +ウシハマ 牛浜 +ウシハマ 牛濱 +ウシバヤシ 牛林 +ウジバヤシ 氏林 +ウシハラ 牛原 +ウジハラ 氏原 +ウジハラ 宇地原 +ウジハラ 宇治原 +ウジハラ 宇次原 +ウシバン 丑番 +ウジヒサ 氏久 +ウシヒラ 牛平 +ウジヒラ 氏平 +ウジヒロ 氏弘 +ウジフク 氏福 +ウシブクロ 牛袋 +ウシフサ 牛房 +ウジフサ 氏房 +ウシブチ 丑渕 +ウシフミ 牛踏 +ウジベ 氏部 +ウジベ 宇治部 +ウシホリ 牛堀 +ウシボリ 牛堀 +ウシマ 鵜島 +ウシマ 宇島 +ウシマ 鵜嶋 +ウシマ 牛間 +ウジマ 鵜島 +ウジマ 宇島 +ウジマ 氏間 +ウジマ 鵜嶋 +ウジマ 宇嶋(宇嶌) +ウジマ 卯島 +ウジマ 卯嶋 +ウジマ 鵜嶌 +ウシマキ 牛牧 +ウシマギ 牛間木 +ウジマサ 氏政 +ウジマス 氏益 +ウジマツ 氏松 +ウシマド 牛窓 +ウシマル 牛丸 +ウシマル 丑丸(丒丸) +ウシマル 牛円 +ウジマル 氏丸 +ウジマル 宇治丸 +ウジマル 姓丸 +ウシミ 牛見 +ウシミ 宇侍見 +ウジミ 氏見 +ウシミズ 牛水 +ウシミチ 牛道 +ウジミネ 氏峰 +ウジミネ 氏峯 +ウジミヤ 宇治宮 +ウシムラ 牛村 +ウシムラ 丑村 +ウジムラ 氏村 +ウジムラ 宇治村 +ウシモト 牛本 +ウシモト 丑本 +ウジモト 氏本 +ウジモト 宇治本 +ウジモト 氏元 +ウジモリ 氏森 +ウシヤ 牛谷 +ウシヤ 牛屋 +ウシヤ 丑屋 +ウシヤ 丑谷 +ウシヤチ 牛谷内 +ウシヤマ 牛山 +ウシヤマ 丑山(丒山) +ウシヤマ 犛山 +ウシヤマ 牮山 +ウジヤマ 宇治山 +ウジヤマ 氏山 +ウジヤマ 有子山 +ウシュウ 羽刕 +ウシュウ 宇秋 +ウシュウ 羽州 +ウシュウ 羽劦 +ウジュウ 鵜重 +ウジュウアン 宇住庵 +ウシュウダ 宇宗田 +ウシュク 宇宿 +ウショウ 宇正 +ウショウ 宇昌 +ウジョウ 宇城 +ウジョウ 右城 +ウジョウ 卯城 +ウジョウ 鵜城 +ウジョウ 宇上 +ウジョウ 宇生 +ウジョウ 夘城 +ウジョウ 宇条 +ウジョウ 宇條 +ウジヨシ 氏吉 +ウジリ 宇尻 +ウシロ 後 +ウシロ 宇城 +ウシロ 後呂 +ウシロ 有城 +ウシロ 右城 +ウシロ 卯城 +ウシロ 鵜城 +ウシロ 宇代 +ウシロ 後路 +ウシロ 右代 +ウシロ 牛路 +ウシロ 有代 +ウシロ 牛呂 +ウシロ 宇志呂 +ウジロ 宇城 +ウシロイ 後井 +ウシロウエ 後上 +ウシロウチ 後内 +ウシロエビス 後夷 +ウシロオカ 後岡 +ウシロオカ 後呂岡 +ウシロガイト 後垣内 +ウシロガキ 後垣 +ウシロガサワ 後ケ沢(後ケ澤) +ウシロカジタニ 後梶谷 +ウシロガタ 後潟 +ウシロガタ 後瀉 +ウシロガタ 後泻 +ウシロカド 後門 +ウシロガマ 後釜 +ウシロカワ 後川 +ウシロカワ 後河 +ウシロガワ 後川 +ウシロカワチ 後河内 +ウシロガワラ 後河原 +ウシロギ 後木 +ウシロキタ 後北 +ウシロク 後宮 +ウシログチ 後口 +ウシロコウジ 後小路 +ウシロコウチ 後河内 +ウシロゴウチ 後河内 +ウシロザカ 後坂 +ウシロサコ 後迫 +ウシロザコ 後迫 +ウシロサワ 後沢 +ウシロサワ 後澤 +ウシロザワ 後沢 +ウシロザワ 後澤 +ウシロジ 後地 +ウシロシバ 後芝 +ウシロショウジ 後小路 +ウシロダ 後田 +ウシロタケ 後竹 +ウシロタニ 後谷 +ウシロダニ 後谷 +ウシロヂ 後地 +ウシロヅル 後水流 +ウシロデ 後出 +ウシロナカ 後中 +ウシロネ 後根 +ウシロノ 後野 +ウシロハタ 後畑 +ウシロバタ 後畠 +ウシロババ 後馬場 +ウシロハマ 後浜 +ウシロハマ 後濱 +ウシロハラ 後原 +ウシロビラ 後平 +ウシロマツ 後松 +ウシロミチ 後道 +ウシロムラ 後村 +ウシロヤ 後谷 +ウシロヤ 後舎 +ウシロヤ 右代谷 +ウシロヤツ 後谷 +ウシロヤマ 後山 +ウシワカ 牛若 +ウシワカ 丑若 +ウジワキ 氏脇 +ウシワタ 牛渡 +ウシワタリ 牛渡 +ウシンメイ 宇新明 +ウス 薄 +ウス 宇須 +ウス 臼 +ウス 碓 +ウズ 宇津 +ウスアミ 薄網 +ウスイ 臼井 +ウスイ 薄井 +ウスイ 碓井 +ウスイ 薄 +ウスイ 碓氷 +ウスイ 有水 +ウスイ 薄衣 +ウスイ 臼居 +ウスイ 笛吹 +ウスイ 旧井 +ウスイ 宇吹 +ウスイ 磨井 +ウスイ 宇須井 +ウスイ 碓水 +ウスイ 雨水 +ウスイ 臼意 +ウスイ 宇水 +ウスイ 碓居 +ウスイ 臼射 +ウスイ 確井 +ウスイ 簿井 +ウスイ 𣇃井 +ウズイ 宇随 +ウズイ 宇隨 +ウズイ 渦居 +ウスイケ 臼池 +ウスイシ 薄石 +ウスイワ 臼岩 +ウスイワ 薄岩 +ウスエ 宇末 +ウズエ 噂江 +ウズオ 渦尾 +ウズオカ 渦岡 +ウスガ 宇数賀 +ウスガ 臼賀 +ウズカ 鵜塚 +ウズカ 鵜束 +ウスガシキ 臼ケ敷 +ウスカタ 臼方 +ウスガネ 薄金 +ウスガミ 薄上 +ウスガヤ 臼ケ谷 +ウスガヤ 薄ケ谷 +ウスカワ 薄川 +ウズカワ 渦川 +ウスキ 臼杵 +ウスキ 薄 +ウスキ 臼木 +ウスキ 薄木 +ウスキ 宇宿 +ウスキ 臼城 +ウスキ 卯薄 +ウスキ 碓木 +ウスキ 旧杵 +ウスギ 臼杵 +ウスギ 臼木 +ウスギ 薄木 +ウスギ 薄衣 +ウスギ 宇杉 +ウズキ 宇津木 +ウズキ 卯月 +ウスギヌ 薄衣 +ウズキハラ 夘月原(卯月原) +ウスク 宇宿 +ウスグチ 臼口 +ウスクボ 薄窪 +ウスクボ 臼窪 +ウスクボ 薄久保 +ウスグモ 薄雲 +ウスクラ 臼倉 +ウスクラ 薄倉 +ウズコ 渦古 +ウスサカ 臼坂 +ウスザカ 臼坂 +ウスザカ 薄坂 +ウスザカ 臼阪 +ウスザキ 臼崎 +ウスザワ 臼沢 +ウスザワ 臼澤 +ウスザワ 薄沢 +ウスジマ 薄島 +ウスジマ 臼島 +ウズシリ 渦尻 +ウスズエ 臼末 +ウスズキ 宇薄 +ウスズミ 薄墨 +ウスズミ 薄隅 +ウスタ 臼田 +ウスタ 薄田 +ウスダ 臼田 +ウスダ 薄田 +ウスダ 碓田 +ウスダ 磨田 +ウスダ 旧田 +ウスダ 有壽多 +ウスダイラ 薄平 +ウスタケ 臼武 +ウスタケ 薄竹 +ウスダテ 臼館 +ウスダテ 臼舘 +ウスタニ 臼谷 +ウスタニ 薄谷 +ウスタニ 磨谷 +ウスヅキ 薄月 +ウスデ 薄出 +ウストミ 旧富 +ウストミ 旧冨 +ウスナガ 碓永 +ウスナガ 薄永 +ウスナベ 薄鍋 +ウスナミ 薄波 +ウズナミ 渦波 +ウスニワ 臼庭 +ウスネ 薄根 +ウスノ 臼野 +ウズノ 鶉野 +ウズノエ 埋ノ江 +ウスハ 薄葉 +ウスハ 薄羽 +ウスハ 薄波 +ウスバ 薄葉 +ウスバ 薄羽 +ウスバ 臼庭 +ウスバ 薄波 +ウスバ 薄刃 +ウスバ 薄場 +ウスバ 臼場 +ウズハシ 埋橋 +ウズハシ 堆橋 +ウスバネ 薄羽 +ウズハラ 渦原 +ウスヒ 碓氷 +ウスブチ 臼渕 +ウスブチ 臼淵 +ウスマ 臼間 +ウスマ 臼馬 +ウズマキ 宇津巻 +ウズマキ 太巻 +ウズマキ 淋蒔 +ウズマキ 渦巻 +ウズマサ 太秦 +ウスマノ 臼間野 +ウスミ 臼見 +ウズミ 埋見 +ウズミ 渦見 +ウズミ 埋 +ウスムラ 碓村 +ウスムラ 臼村 +ウスモト 臼本 +ウスモト 臼元 +ウスモト 碓本 +ウスモト 薄元 +ウスモト 薄本 +ウズモト 渦元 +ウズモト 渦本 +ウスモリ 臼森 +ウズモリ 敲森 +ウスヤ 臼谷 +ウスヤ 磨谷 +ウスヤ 臼屋 +ウスヤ 磨屋 +ウスヤマ 臼山 +ウスヤマ 薄山 +ウスヤマ 宇寿山(宇壽山) +ウズラ 卯津羅 +ウズラ 鶉 +ウズライシ 鶉石 +ウズラタニ 鶉谷 +ウズラノ 鶉野 +ウズラハシ 鶉橋 +ウズラバシ 鶉橋 +ウズワ 渦輪 +ウズワ 薶輪 +ウズンベ 埋樋 +ウセ 鵜瀬 +ウセ 宇瀬 +ウゼ 鵜瀬 +ウセイ 宇生 +ウセイ 宇成 +ウセキ 宇関(宇關) +ウゼキ 宇関(宇關) +ウゼン 卯善 +ウソ 宇曽 +ウソ 宇曾 +ウソイ 宇曽井 +ウゾウ 宗造 +ウソゴエ 獺越 +ウソタニ 宇曽谷 +ウタ 宇田 +ウタ 宇多 +ウタ 唄 +ウタ 歌 +ウタ 鵜足 +ウタ 打它 +ウタ 哥 +ウタ 雅楽 +ウタ 雅樂 +ウダ 宇田(𡧃田) +ウダ 右田 +ウダ 宇多 +ウダ 烏田 +ウダ 雨田 +ウダ 宇陀 +ウダ 卯田 +ウダ 鵜田 +ウダ 菟田 +ウダ 夘田 +ウダ 兎太 +ウダ 兔太 +ウダ 莵田 +ウタイ 歌井 +ウダイ 宇田居 +ウタイセ 宇対瀬 +ウタイダ 謡田 +ウタウラ 歌浦 +ウダオ 宇田尾 +ウタカ 宇高 +ウタカ 鵜鷹 +ウタカ 鵜高 +ウタカ 宇鷹 +ウタカ 宇田賀 +ウタカ 宇多賀 +ウタカ 烏鷹 +ウタガ 宇多賀 +ウダカ 宇高 +ウダカ 鵜高 +ウダカ 烏高 +ウタガキ 歌書 +ウタカタ 歌方 +ウタカワ 宇田川 +ウタカワ 歌川 +ウタガワ 宇田川 +ウタガワ 歌川 +ウタガワ 宇多川 +ウタガワ 雅楽川(雅樂川) +ウタガワ 鵜田川 +ウタガワ 唄川 +ウタガワ 哥川 +ウダカワ 宇田川 +ウダガワ 宇田川 +ウダガワ 宇多川 +ウダガワ 宇陀川 +ウタキ 卯滝 +ウタキ 宇滝(宇瀧) +ウタキ 夘滝 +ウタキ 卯瀧 +ウタギ 歌木 +ウダキ 卯瀧 +ウタグチ 謡口 +ウタコウジ 宇多小路 +ウタサカ 歌坂 +ウタサキ 歌崎 +ウタザキ 歌崎 +ウタサト 歌里 +ウタサト 頌彦 +ウタザワ 歌澤(歌沢) +ウタシマ 歌島 +ウタジリ 宇田尻 +ウタシロ 歌代 +ウタシロ 唄代 +ウタシロ 雅楽代 +ウタシロ 歌城 +ウタス 宇田須 +ウタズミ 歌住 +ウタタ 宇多田 +ウタタ 転 +ウタタ 轉 +ウタダ 歌田 +ウタダ 宇多田 +ウタタニ 歌谷 +ウタツ 宇田津 +ウタツ 歌津 +ウタツ 卯辰(夘辰) +ウタツ 宇辰 +ウタツ 宇多津 +ウタツ 宇達 +ウタヅ 歌津 +ウタヅ 鵜足津 +ウダツ 宇田津 +ウダツ 宇立 +ウダテ 右立 +ウダテ 宇館 +ウダテ 宇舘 +ウダテ 宇建 +ウタナイ 打田内 +ウタニ 烏谷 +ウタニ 宇谷 +ウタニ 右谷 +ウタニ 兎谷 +ウダニ 宇谷 +ウタノ 歌野 +ウタノ 宇田野 +ウダノ 宇田野 +ウタノハラ 歌野原 +ウタハシ 歌橋 +ウタハラ 歌原 +ウタフサ 歌房 +ウタマクラ 歌枕 +ウタマル 歌丸 +ウタマル 哥丸 +ウタミ 宇民 +ウタミ 宇田見 +ウタミ 宇多見 +ウタミ 歌見 +ウタムラ 宇多村 +ウタムラ 歌村 +ウタヤ 歌谷 +ウタヤシキ 歌屋敷 +ウダヤマ 宇田山 +ウタリ 宇田利 +ウタン 宇丹 +ウチ 内 +ウチアイ 打会 +ウチアイ 打合 +ウチアイ 打會 +ウチアカ 内赤 +ウチアケ 打明 +ウチアゲ 打上 +ウチアゲ 内上 +ウチアゲ 打揚 +ウチアツメ 打集 +ウチイ 内井 +ウチイ 打井 +ウチイケ 内池 +ウチイシ 内石 +ウチイズミ 内泉 +ウチイデ 内出 +ウチイデ 打出 +ウチイト 内糸 +ウチイワ 内岩 +ウチウ 内生 +ウチウゾ 内生蔵(内生藏) +ウチウゾウ 内生蔵(内生藏) +ウチウダ 内宇田 +ウチウミ 内海 +ウチウミザキ 内海崎 +ウチウラ 内浦 +ウチエ 打江 +ウチエ 宇智英 +ウチエ 内恵 +ウチエ 内江 +ウチエ 内惠 +ウチオ 内尾 +ウチオ 打尾 +ウチオオクボ 内大久保 +ウチオカ 内岡 +ウチオキ 内沖 +ウチオギ 打荻 +ウチオケ 内桶 +ウチオゾウ 内生蔵(内生藏) +ウチオボ 内大保 +ウチオンボウ 内音坊 +ウチカイ 内海 +ウチガイ 内貝 +ウチガイチ 内垣内 +ウチガイト 内垣内 +ウチガイト 打垣内 +ウチカガミハラ 内鏡原 +ウチガキ 内垣 +ウチガキ 内栫 +ウチガキウチ 内垣内 +ウチガキト 内垣外 +ウチガグチ 打ケ口 +ウチカケネ 内掛根 +ウチカコイ 内栫 +ウチガサキ 内ケ崎 +ウチガシマ 内ケ島 +ウチガシマ 内賀島 +ウチガシマ 内ケ嶋 +ウチガシマ 内賀嶋 +ウチカタ 内潟 +ウチカタ 内方 +ウチカタ 内形 +ウチカタ 内片 +ウチカタ 打方 +ウチガタ 内潟 +ウチガタ 内形 +ウチガタ 内瀉 +ウチカド 内門 +ウチカド 内角 +ウチカネ 内金 +ウチガネ 内金 +ウチガネク 内兼久 +ウチカネザキ 内金崎 +ウチガマエ 内構 +ウチカミ 内上 +ウチガミ 打上 +ウチガミ 内上 +ウチガミ 内神 +ウチガメ 内亀 +ウチカリヤ 内仮屋 +ウチカワ 内川 +ウチカワ 内河 +ウチカワ 打川 +ウチカワ 宇知川 +ウチガワ 内川 +ウチカワグチ 内川口 +ウチカワノ 内河野 +ウチカンナ 内鉙 +ウチカンボリ 内上堀 +ウチキ 内木 +ウチキ 打木 +ウチキ 内樹 +ウチギ 打木 +ウチキバ 内木場 +ウチキリ 内切 +ウチギリ 打桐 +ウチクガ 内空閑 +ウチクネ 内久根 +ウチクボ 内久保 +ウチクボ 内窪 +ウチクラ 内倉 +ウチクラ 内蔵(内藏) +ウチグロ 内黒 +ウチクロハネ 内黒羽子 +ウチグロハネ 内黒羽子 +ウチゴウチ 内河内 +ウチコガ 内古閑 +ウチコシ 打越 +ウチコシ 内越 +ウチコシ 宇地越 +ウチゴシ 打越 +ウチコシキ 内甑 +ウチコシヤマ 打越山 +ウチコダ 内古田 +ウチコバ 内木場 +ウチコミ 打込 +ウチザ 打座 +ウチザ 内座 +ウチサカ 内坂 +ウチサカ 打坂 +ウチザカ 内坂 +ウチサキ 内崎 +ウチザキ 内崎 +ウチザキ 内埼 +ウチザクラ 打桜 +ウチザクラ 打櫻 +ウチサコ 内迫 +ウチササイ 内笹井 +ウチザト 内里 +ウチサワ 内沢 +ウチサワ 内澤 +ウチザワ 内沢 +ウチザワ 内澤 +ウチジ 打地 +ウチシバ 内芝 +ウチシバ 内柴 +ウチジハラ 内地原 +ウチシマ 内島 +ウチシマ 内嶋 +ウチジマ 内島 +ウチジマ 内嶋 +ウチジマ 内嶌 +ウチジョウ 内城 +ウチシロ 内城 +ウチスガワ 内須川 +ウチスギ 内杉 +ウチズミ 内炭 +ウチズミ 内住 +ウチセ 内勢 +ウチセト 内瀬戸 +ウチゾエ 内添 +ウチソノ 内囿 +ウチゾノ 内園 +ウチゾノ 内薗 +ウチゾノ 内苑 +ウチゾノ 内囿 +ウチソノダ 内園田 +ウチタ 内田 +ウチタ 打田 +ウチタ 内多 +ウチダ 内田 +ウチダ 打田 +ウチダ 内多 +ウチダ 宇智田 +ウチダ 宇知田 +ウチダイラ 内平 +ウチタケ 内竹 +ウチタテ 内舘 +ウチタテ 内立 +ウチダテ 内舘 +ウチダテ 内館 +ウチダテ 内立 +ウチタテモト 内立元 +ウチタテワ 内立輪 +ウチタナイ 打田内 +ウチタニ 内谷 +ウチタニ 打谷 +ウチタネ 内種 +ウチダヤ 内田屋 +ウチツ 内津 +ウチヅカ 内塚 +ウチツネミ 内恒見 +ウチツボ 内坪 +ウチヅメ 打詰 +ウチテ 内手 +ウチデ 内出 +ウチデ 打出 +ウチデ 内手 +ウチデヤ 打出谷 +ウチド 内戸 +ウチドイ 打土井 +ウチドイ 内土井 +ウチトク 内徳 +ウチドマリ 宇地泊 +ウチトミ 内富 +ウチトミ 内冨 +ウチドミ 内富 +ウチドミ 内冨 +ウチトヨトメ 内豊留 +ウチトヨドメ 内豊留 +ウチナ 内那 +ウチナオ 打猶 +ウチナカ 内仲 +ウチナカ 内中 +ウチナガ 内永 +ウチナガ 内長 +ウチナシ 内梨 +ウチナミ 内波 +ウチナミ 打浪 +ウチナミ 打波 +ウチナミ 内浪 +ウチニシ 内西 +ウチヌキ 打抜 +ウチヌノ 内布 +ウチヌマ 内沼 +ウチネハラ 内根原 +ウチノ 内野 +ウチノ 内納 +ウチノ 内埜 +ウチノ 打野 +ウチノイ 内野井 +ウチノイ 内ノ井 +ウチノウ 内納 +ウチノウミ 内海 +ウチノウラ 内之浦 +ウチノウラ 内ノ浦 +ウチノウラ 内の浦 +ウチノクラ 内之倉 +ウチノクラ 内ノ倉 +ウチノクラ 内野倉 +ウチノクラ 内之蔵 +ウチノサワ 内野沢 +ウチノサワ 内野澤 +ウチノタニ 内野谷 +ウチノダン 内之段 +ウチノノ 内野々 +ウチノノ 内野野 +ウチノハエ 内之八重 +ウチノマキ 内之牧 +ウチノマル 内之丸 +ウチノミ 内呑 +ウチノミ 内能美 +ウチノミヤ 内野宮 +ウチノミヤ 内之宮 +ウチノミヤ 内ノ宮 +ウチノミヤ 内の宮 +ウチノムラ 内ノ村 +ウチノヤエ 内之八重 +ウチバ 内場 +ウチバエ 内八重 +ウチハシ 内橋 +ウチハシ 打橋 +ウチハタ 内畠 +ウチハタ 内畑 +ウチハタ 内幡 +ウチバタケ 内畠 +ウチハタヤ 内畑谷 +ウチババ 内馬場 +ウチハマ 内浜 +ウチハマ 内濱 +ウチバヤシ 内林 +ウチバヤシ 打林 +ウチハラ 内原 +ウチハラ 宇地原 +ウチハル 内春 +ウチヒ 打樋 +ウチヒ 内樋 +ウチヒラ 内平 +ウチヒロ 内広 +ウチヒロ 内祐 +ウチヒロ 内廣 +ウチフジ 内藤 +ウチフネ 内船(内舩) +ウチフル 内古 +ウチベ 内部 +ウチベップ 内別府 +ウチヘボ 内枦保 +ウチホ 内保 +ウチボ 内保 +ウチホラ 内洞 +ウチホリ 内堀 +ウチボリ 内堀 +ウチボリ 内掘 +ウチマ 内間 +ウチマ 内麻 +ウチマエ 内前 +ウチマキ 内牧 +ウチマキ 内間木 +ウチマキ 内巻 +ウチマギ 内間木 +ウチマサ 内正 +ウチマス 内舛 +ウチマス 内升 +ウチマス 内桝 +ウチマチ 内町 +ウチマツ 内松 +ウチマル 内丸 +ウチミ 内海 +ウチミ 内見 +ウチミ 打見 +ウチミザキ 内海崎 +ウチミズ 内水 +ウチミチ 打道 +ウチミツ 内満(内滿) +ウチミドウ 内御堂 +ウチミネ 内嶺 +ウチミヤ 内宮 +ウチミヤ 内美家 +ウチミョウ 内名 +ウチムラ 内村 +ウチムラ 打村 +ウチムロ 内室 +ウチモト 内本 +ウチモト 打本 +ウチモト 内元 +ウチモト 内一 +ウチモリ 内盛 +ウチモリ 内森 +ウチヤ 内谷 +ウチヤ 打矢 +ウチヤ 打谷 +ウチヤ 内屋 +ウチヤ 打屋 +ウチヤ 内矢 +ウチヤエ 内八重 +ウチヤシキ 内屋敷 +ウチヤナギ 内柳 +ウチヤマ 内山 +ウチヤマ 打山 +ウチヤマダ 内山田 +ウチュウ 宇宙 +ウチュウゾウ 内生蔵(内生藏) +ウチョウマエ 宇張前 +ウチヨシ 内吉 +ウチラ 内良 +ウチロ 内呂 +ウチワ 内輪 +ウチワ 打和 +ウチワ 内和 +ウチワケ 打訳 +ウチワケ 打譯 +ウチワタ 打綿 +ウチワダ 内和田 +ウチワラ 打藁 +ウツ 宇都 +ウツ 宇津 +ウヅ 宇津 +ウツイ 宇津井 +ウツイ 空井 +ウツイ 打井 +ウツイ 控井 +ウツイ 宇都井 +ウツイ 椌井 +ウツウチ 宇津内 +ウツエ 宇津江 +ウツエ 打江 +ウツエ 宇津恵 +ウツエ 宇都江 +ウヅエ 卯津江 +ウツオ 宇津尾 +ウツオ 撫尾 +ウツオカ 宇都岡 +ウツオカ 現岡 +ウツオギ 打荻 +ウツカ 宇塚 +ウツカ 鵜塚 +ウヅカ 宇塚 +ウヅカ 鵜塚 +ウヅカ 鵜束 +ウヅカ 卯塚 +ウヅカ 兎束 +ウヅカ 夘塚 +ウツガミ 宇津上 +ウツカワ 打川 +ウツカワ 宇津川 +ウツガワ 宇津川 +ウツキ 宇津木 +ウツキ 宇都木 +ウツキ 打木 +ウツキ 卯都木 +ウツキ 梼木 +ウツキ 宇月 +ウツキ 檮木 +ウツキ 宇ツ木 +ウツキ 宇津喜 +ウツギ 宇津木 +ウツギ 宇都木 +ウツギ 打木 +ウツギ 卯都木 +ウツギ 梼木 +ウツギ 宇津城 +ウツギ 楊盧木 +ウツギ 檮木 +ウツギ 宇ツ木 +ウツギ 宇次 +ウツギ 槍木 +ウツギ 宇津喜 +ウツギ 槍 +ウツギ 棯 +ウツギ 宇都城 +ウツギ 夘都木 +ウツギ 擣木 +ウヅキ 宇津木 +ウヅキ 卯月 +ウヅキ 鵜月 +ウヅキ 夘月 +ウヅキ 宇月 +ウツギザキ 槍崎 +ウツギザキ 棯崎 +ウツギザキ 捻崎 +ウツギサワ 槍沢 +ウツギサワ 宇津木沢(宇津木澤) +ウツギサワ 槍澤 +ウツギザワ 槍沢 +ウツギザワ 槍澤 +ウツギタ 槍田 +ウツギタ 櫨田 +ウツギダ 槍田 +ウツギダ 櫨田 +ウツキハラ 宇月原 +ウツキハラ 夘月原(卯月原) +ウツギハラ 櫨原 +ウツギハラ 槍原 +ウツギモト 櫨本 +ウツギリ 打桐 +ウツザキ 宇津崎 +ウツザワ 宇津沢 +ウツザワ 宇津澤 +ウツシ 宇津志 +ウツシカワ 移川 +ウツシガワ 移川 +ウッタ 打田 +ウツダ 打田 +ウツダ 槍田 +ウツダ 宇津田 +ウツダ 宇都田 +ウヅタ 宇津田 +ウヅタ 宇都田 +ウッタク 打宅 +ウッタナイ 打田内 +ウツデ 宇都出 +ウツノ 宇津野 +ウツノ 宇都野 +ウツノミヤ 宇都宮 +ウツノミヤ 宇津宮 +ウツハシ 宇津橋 +ウツハラ 宇津原 +ウツハラ 宇都原 +ウツボ 打保 +ウツボ 宇坪 +ウツボ 靭 +ウツボ 苧坪 +ウツボ 宇津保 +ウツボ 宇都保 +ウツボ 卯坪 +ウツボ 靱 +ウツボエ 靭江(靱江) +ウツボヤ 靭矢 +ウツボヤ 靱矢 +ウヅマキ 宇津巻 +ウツミ 内海 +ウツミ 宇津見 +ウツミ 宇津味 +ウツミ 宇積 +ウツミ 打海 +ウツミ 打味 +ウツミ 宇都見 +ウツミ 宇津美 +ウツミ 慈 +ウヅミ 宇積 +ウツミヤ 宇都宮 +ウツミヤ 宇津宮 +ウツミヤ 宇津美矢 +ウツムラ 宇津村 +ウツモト 宇津元 +ウツモト 宇津本 +ウツモト 宇都本 +ウツモト 宇都元 +ウツモリ 宇津森 +ウツモリ 敲森 +ウツヤマ 宇津山 +ウツヤマ 宇都山 +ウヅラ 卯津羅 +ウヅラ 夘津羅 +ウツロ 宇津呂 +ウツロギ 空木 +ウツロギ 洞木 +ウツロギ 打良木 +ウツワ 宇津和 +ウテ 右手 +ウデ 宇出 +ウデキ 腕木 +ウテツ 打越 +ウテツ 宇鉄 +ウデツ 宇出津 +ウテナ 台(薹) +ウテナ 臺 +ウデノ 腕野 +ウテビ 打樋 +ウテビ 内樋 +ウト 宇都 +ウト 宇土 +ウト 宇戸 +ウト 鵜戸 +ウト 海渡 +ウト 宇渡 +ウト 生戸 +ウト 宇登 +ウド 宇土 +ウド 宇戸 +ウド 鵜戸 +ウド 宇渡 +ウド 雨土 +ウド 鵜渡 +ウド 有渡 +ウトウ 宇藤 +ウトウ 有藤 +ウトウ 鵜藤 +ウトウ 右藤 +ウトウ 鵜頭 +ウトウ 烏藤 +ウトウ 善知鳥 +ウトウ 禹藤 +ウドウ 有働 +ウドウ 宇藤 +ウドウ 有藤 +ウドウ 兎洞 +ウドウ 宇堂 +ウドウ 卯道 +ウドウ 右働 +ウドウ 宇洞 +ウドウ 烏藤 +ウドウ 有動 +ウドウ 夘道 +ウドウ 宇働 +ウドウ 有仂 +ウドウ 有慟 +ウトウゲ 鵜峠 +ウトウハラ 宇藤原 +ウトウヤマ 宇藤山 +ウトオ 右遠 +ウトオ 烏頭尾 +ウドオ 右遠 +ウドキ 宇土木 +ウトク 宇徳 +ウトグチ 宇都口 +ウトグチ 宇戸口 +ウトグチ 右戸口 +ウドグチ 鵜戸口 +ウトサワ 宇土沢 +ウトサワ 宇土澤 +ウトザワ 宇土沢 +ウトザワ 宇土澤 +ウドサワ 宇土沢 +ウドセ 鵜渡瀬 +ウトダ 宇戸田 +ウドダイラ 宇戸平 +ウトタニ 宇戸谷 +ウドニシ 鵜戸西 +ウトヌマ 烏兎沼 +ウトヌマ 鳥兎沼 +ウトネ 烏ト根 +ウドネ 有渡根 +ウドノ 鵜殿 +ウドノ 宇殿 +ウドハラ 宇土原 +ウドヒラ 宇戸平 +ウトミヤ 宇都宮 +ウドヤ 宇戸谷 +ウトヤマ 宇都山 +ウトヤマ 宇藤山 +ウドヤマ 独活山(獨活山) +ウドヤマ 有渡山 +ウトヨ 宇斗世 +ウナ 宇名 +ウナイ 宇内 +ウナイ 垂髪 +ウナイ 卯内 +ウナイ 右内 +ウナイ 夘内 +ウナエ 宇苗 +ウナカ 烏中 +ウナカ 宇中 +ウナカ 卯中 +ウナカミ 海上 +ウナガミ 海上 +ウナキ 宇那木 +ウナギ 宇那木 +ウナギ 鰻 +ウナギイケ 鰻池 +ウナギダ 鰻田 +ウナギブチ 鰻渕 +ウナザワ 宇名沢 +ウナザワ 宇名澤 +ウナセ 海瀬 +ウナダ 鵜灘 +ウナダ 宇那田 +ウナダ 雲南田 +ウナテ 宇奈手 +ウナテ 宇那手 +ウナテ 宇名手 +ウナテ 雲梯 +ウナネ 宇名根 +ウナネグチ 卯名根口 +ウナノ 宇那野 +ウナバラ 海原 +ウナミ 宇波 +ウナミ 宇並 +ウナミ 海南 +ウナミ 宇浪 +ウナヤマ 宇南山 +ウナヤマ 鵜名山 +ウニ 宇仁 +ウニ 有爾 +ウニ 有尓 +ウニガメ 雲丹亀 +ウニサダ 溶定 +ウニシ 卯西 +ウニスガ 宇仁菅 +ウニタ 宇仁田 +ウニダ 宇仁田 +ウニヤ 鵜丹谷 +ウニュウ 鵜入 +ウニワ 宇庭 +ウヌキ 宇貫 +ウヌマ 鵜沼 +ウヌマ 宇沼 +ウネ 宇根 +ウネ 畝 +ウネ 有年 +ウネ 畦 +ウネ 采 +ウネ 釆 +ウネ 宇祢 +ウネ 鵜根 +ウネ 宇禰 +ウネイ 采井 +ウネイ 釆井 +ウネイ 畝井 +ウネウチ 宇根内 +ウネウチ 畝内 +ウネウラ 采浦 +ウネオ 畝尾 +ウネオ 采尾 +ウネオ 釆尾 +ウネオカ 畝岡 +ウネオカ 宇根岡 +ウネオカ 畦岡 +ウネオカ 采岡 +ウネオカ 釆岡 +ウネオカ 隴岡 +ウネオキ 畝沖 +ウネガイチ 釆垣内(采垣内) +ウネガウチ 畝河内 +ウネカワ 畝川 +ウネカワ 宇根川 +ウネガワ 宇根川 +ウネカワチ 畝河内 +ウネキ 畝木 +ウネキ 采木 +ウネギ 畝木 +ウネゴウチ 畝河内 +ウネゴシ 宇根越 +ウネサ 畝狭 +ウネサキ 畦崎 +ウネサキ 宇根崎 +ウネザキ 畦崎 +ウネザキ 宇根崎 +ウネザキ 畝崎 +ウネザキ 采崎 +ウネサダ 溶定 +ウネザワ 采沢 +ウネザワ 釆沢 +ウネザワ 采澤 +ウネザワ 釆澤 +ウネザワ 卯子沢 +ウネザワ 宇根沢 +ウネザワ 卯子澤 +ウネシゲ 畝重 +ウネシマ 畝島 +ウネジマ 宇祢島 +ウネジマ 宇祢嶋 +ウネジマ 畝嶋 +ウネセ 宇根瀬 +ウネソコ 宇根底 +ウネタ 畝田 +ウネタ 畦田 +ウネダ 畝田 +ウネダ 畦田 +ウネダ 宇根田 +ウネダ 采田 +ウネダ 釆田 +ウネダ 溶田 +ウネダ 宇祢田 +ウネダ 有年田 +ウネタニ 采谷 +ウネタニ 宇根谷 +ウネタニ 釆谷 +ウネダヤ 畝田谷 +ウネツボ 畦坪 +ウネツボ 宇根坪 +ウネナカ 畝中 +ウネニシ 畦西 +ウネノ 采野 +ウネノ 釆野 +ウネノ 畝野 +ウネバサミ 畝挟 +ウネハタ 畦畑 +ウネハタ 宇根端 +ウネハタ 采畑 +ウネハタ 釆畑 +ウネバヤシ 𤰖林 +ウネバヤシ 畝林 +ウネバヤシ 畔林 +ウネハラ 畝原 +ウネハラ 畦原 +ウネハラ 采原 +ウネハラ 釆原 +ウネハラ 宇根原 +ウネハラ 溶原 +ウネヒラ 畦平 +ウネベ 畝部 +ウネミ 畝見(畒見) +ウネミ 釆見 +ウネミ 宇根見 +ウネミ 采見 +ウネミズ 宇根水 +ウネミツ 畝光 +ウネミツ 采光 +ウネムラ 畝村 +ウネムラ 畒村 +ウネメ 采女 +ウネメ 釆女 +ウネメ 畝目 +ウネモト 畝本 +ウネモト 宇根本 +ウネモト 宇根元 +ウネモト 采本 +ウネモト 釆本 +ウネモト 有根元 +ウネモト 隴本 +ウネモト 采元 +ウネモト 釆元 +ウネモト 畒本 +ウネモト 𨻫本 +ウネモリ 畦森 +ウネモリ 畝森 +ウネヤ 采谷 +ウネヤ 畝矢 +ウネヤ 釆谷 +ウネヤマ 畝山 +ウネヤマ 宇根山 +ウネヤマ 畦山 +ウネヤマ 采山 +ウネヤマ 釆山 +ウノ 宇野 +ウノ 海野 +ウノ 鵜野 +ウノ 卯野 +ウノ 烏野 +ウノ 宇埜 +ウノ 鵜生 +ウノ 夘野 +ウノ 苧野 +ウノ 右野 +ウノ 卯埜 +ウノ 荢野 +ウノ 野 +ウノ 烏ノ +ウノ 夘埜 +ウノ 𡧃野 +ウノイ 宇ノ井 +ウノイ 宇野井 +ウノイケ 鵜池 +ウノウ 宇納 +ウノウ 鵜生 +ウノウ 鵜納 +ウノウ 右納 +ウノウチ 烏内 +ウノウラ 鵜浦 +ウノカワ 東川 +ウノカワ 宇野川 +ウノキ 鵜木 +ウノキ 宇野木 +ウノキ 卯木 +ウノキ 夘野木 +ウノキ 卯之木 +ウノキ 卯野木 +ウノキ 宇ノ木 +ウノキ 夘木 +ウノキ 宇之木 +ウノキ 卯ノ木 +ウノキ 鵜ノ木 +ウノキ 夘之木 +ウノクチ 鵜口 +ウノクチ 鵜ノ口 +ウノグチ 鵜ノ口 +ウノケ 鵜之家 +ウノコ 鵜子 +ウノコ 右ノ子 +ウノサワ 宇野沢 +ウノサワ 宇野澤 +ウノサワ 鵜之沢 +ウノサワ 鵜野沢 +ウノサワ 鵜ノ沢 +ウノサワ 鵜ノ澤 +ウノサワ 鵜之澤 +ウノサワ 鵜野澤 +ウノサワ 宇ノ澤 +ウノサワ 宇ノ沢 +ウノサワ 宇之沢(宇之澤) +ウノサワ 卯之沢 +ウノサワ 卯之澤 +ウノザワ 宇野沢 +ウノザワ 宇野澤 +ウノザワ 鵜之沢 +ウノザワ 鵜野沢 +ウノザワ 鵜ノ沢 +ウノザワ 鵜ノ澤 +ウノザワ 鵜之澤 +ウノザワ 鵜野澤 +ウノザワ 宇ノ澤 +ウノザワ 宇ノ沢 +ウノシマ 鵜島 +ウノシロ 鵜城 +ウノス 鵜野洲 +ウノス 鵜野州 +ウノズ 鵜頭 +ウノズ 卯図 +ウノセ 鵜瀬 +ウノダ 宇野田 +ウノダ 卯ノ田 +ウノダ 卯野田 +ウノダ 鵜野田 +ウノダ 卯之田 +ウノツ 宇之津 +ウノツ 宇野津 +ウノトロ 鵜瀞 +ウノハナ 卯花 +ウノハナ 卯ノ花 +ウノハマ 卯野浜 +ウノハマ 卯野濱 +ウノハラ 卯之原 +ウノハラ 宇野原 +ウノハラ 海野原 +ウノハラ 夘之原 +ウノベ 宇野辺 +ウノベ 鵜辺 +ウノマル 宇野丸 +ウノミヤ 宇野宮 +ウノメ 鰀目 +ウノメ 宇野女 +ウノメ 鵜目 +ウノモト 宇野本 +ウノヤマ 宇野山 +ウノヤマ 卯野山 +ウバ 姥 +ウバ 右馬 +ウバ 伯母 +ウバ 烏羽 +ウバ 宇葉 +ウバ 乳母 +ウバイ 右梅 +ウバウラ 姥浦 +ウバカイ 姥貝 +ウバガイ 祖母井 +ウバガイ 姥貝 +ウバガイ 祖母谷 +ウバガサキ 姥ケ崎 +ウバガサキ 姥崎 +ウバガサワ 姥ケ沢 +ウバガサワ 姥ケ澤 +ウバガタニ 姥ケ谷 +ウバガミ 姥神 +ウバキ 姥木 +ウバクテ 姥久手 +ウバサコ 姥迫 +ウバサワ 姥沢 +ウバサワ 姥澤 +ウバザワ 姥澤 +ウハシ 宇橋 +ウバシマ 姥島 +ウバシマ 姥嶋 +ウハタ 宇畑 +ウハタ 羽畑 +ウハタ 右秦 +ウバタ 宇畑 +ウバタ 姥田 +ウバタケ 姥岳(姥嶽) +ウバタニ 姥谷 +ウバヅカ 姥塚 +ウハナ 卯花 +ウバナ 卯花 +ウバノ 宇羽野 +ウバノ 右馬野 +ウバノ 姥野 +ウバハラ 姥原 +ウバブチ 姥渕 +ウハマ 鵜濱(鵜浜) +ウバヤシ 鵜林 +ウバヤナギ 姥柳 +ウバヤマ 姥山 +ウバヤマ 姑山 +ウハラ 宇原 +ウハラ 右原 +ウハラ 鵜原 +ウハラ 莵原 +ウハラ 乳原 +ウハラ 兎原 +ウハラ 菟原 +ウハラ 烏原 +ウハラ 卯原 +ウハラ 夘原 +ウハラ 禹原 +ウバラ 宇原 +ウバラ 鵜原 +ウバラ 莵原 +ウバラ 乳原 +ウバラ 兎原 +ウバラ 菟原 +ウヒラ 宇平 +ウフ 宇夫 +ウブ 宇夫 +ウブ 宇生 +ウブイシ 生石 +ウブエ 産江 +ウブカ 産賀 +ウブカタ 生方 +ウブカタ 生形 +ウブカタ 宇夫方 +ウブカタ 産形 +ウブカタ 幼方 +ウブカタ 産方 +ウブカタ 宇夫形 +ウブガタ 生方 +ウブガタ 産形 +ウブガタ 宇夫形 +ウブカワ 鵜生川 +ウブキ 宇吹 +ウブキ 産木 +ウブコシ 生越 +ウブサワ 生沢 +ウブサワ 生澤 +ウブシロ 天宮城 +ウブナイ 生内 +ウブヌキ 生貫 +ウブハラ 産原 +ウブヤ 産谷 +ウブヤシキ 産屋敷 +ウブユ 生湯 +ウベ 宇部 +ウベツ 宇別 +ウベノ 宇部野 +ウベモト 宇部本 +ウホ 宇保 +ウボ 宇保 +ウマ 右馬 +ウマ 馬 +ウマアライ 馬洗 +ウマイ 馬居 +ウマイ 馬井 +ウマイシ 馬石 +ウマイチ 午市 +ウマウチ 馬内 +ウマウリ 馬売 +ウマウリ 馬賣 +ウマエ 馬江 +ウマオカ 馬岡 +ウマカイ 馬飼 +ウマガイ 馬養 +ウマガキ 馬垣 +ウマカケ 馬掛 +ウマカケバ 馬欠場 +ウマカツ 馬勝 +ウマカド 馬角 +ウマカミ 馬上 +ウマガミ 馬上 +ウマガミ 午上 +ウマカリ 馬狩 +ウマカワ 馬川 +ウマカワ 馬河 +ウマキ 馬木 +ウマキ 馬着 +ウマキ 宇摩木 +ウマグチ 馬口 +ウマクラ 馬倉 +ウマゲ 馬下 +ウマゴウリ 馬郡 +ウマゴエ 馬越 +ウマゴオリ 馬郡 +ウマコシ 馬越 +ウマゴシ 馬越 +ウマサカ 馬坂 +ウマサキ 馬崎 +ウマサキ 馬先 +ウマザキ 馬崎 +ウマザワ 馬沢 +ウマザワ 馬澤 +ウマジ 馬路 +ウマジ 馬地 +ウマシロ 馬代 +ウマスギ 馬杉 +ウマズミ 馬澄 +ウマセ 馬瀬 +ウマタ 馬田 +ウマダ 馬田 +ウマタケ 馬竹 +ウマタテ 馬立 +ウマダテ 馬立 +ウマタニ 馬谷 +ウマダニ 馬谷 +ウマチ 馬地 +ウマツ 卯松 +ウマツギ 馬継 +ウマヅメ 馬詰(馬誥) +ウマデ 馬出 +ウマト 馬戸 +ウマド 馬戸 +ウマドノ 馬殿 +ウマドメ 馬止 +ウマドメ 馬留 +ウマノ 馬野 +ウマノ 右馬埜 +ウマノ 右馬野 +ウマノ 右馬ノ +ウマノウエ 馬上 +ウマノウチ 馬之内 +ウマノキ 馬野木 +ウマノダン 馬ノ段 +ウマノダン 馬之段 +ウマバ 馬場 +ウマバ 馬塲 +ウマハシ 馬橋 +ウマハシ 厩橋 +ウマハチ 馬蜂 +ウマバチ 馬鉢 +ウマバヤシ 馬林 +ウマハラ 馬原 +ウマビキ 馬引 +ウマブチ 馬渕 +ウマベ 馬部 +ウマミ 馬見 +ウマミズ 馬水 +ウマミチ 馬道 +ウマミチ 午道 +ウマミネ 馬峰 +ウマミョウ 馬明 +ウマムラ 馬村 +ウマモチ 馬持 +ウマモト 馬本 +ウマモリ 馬森 +ウマモリ 馬守 +ウマヤ 馬谷 +ウマヤ 宇麼谷(宇磨谷) +ウマヤ 厩 +ウマヤバシ 厩橋 +ウマヤバシ 廐橋 +ウマヤハラ 馬屋原 +ウマヤバラ 馬屋原 +ウマヤマ 馬山 +ウマワタリ 馬渡 +ウミ 宇美 +ウミ 海 +ウミ 右見 +ウミイ 海井 +ウミウチ 海内 +ウミエ 海江 +ウミオ 海尾 +ウミオカ 海岡 +ウミカ 海賀 +ウミカイ 海貝 +ウミガイ 海貝 +ウミカタ 海方 +ウミガネ 海金 +ウミカワ 海川 +ウミキ 海来 +ウミギシ 海岸 +ウミキタ 海北 +ウミギワ 海際 +ウミグチ 海口 +ウミサ 海佐 +ウミサキ 海崎 +ウミザキ 海崎 +ウミザワ 海沢 +ウミザワ 海澤 +ウミジ 海地 +ウミジ 海治 +ウミジ 海路 +ウミジ 海冶 +ウミシオ 海塩 +ウミシオ 海汐 +ウミシタ 海下 +ウミシマ 海島 +ウミジマ 海島 +ウミジマ 海嶋 +ウミズ 宇水 +ウミズミ 海住 +ウミセ 海瀬 +ウミセド 海勢頭 +ウミセド 海瀬頭 +ウミゾエ 海添 +ウミタ 海田 +ウミダ 海田 +ウミダイラ 海平 +ウミタニ 海谷 +ウミツ 海津 +ウミヅ 海津 +ウミツキ 海付 +ウミツキ 海附 +ウミナカ 海中 +ウミナカ 海仲 +ウミヌマ 海沼 +ウミノ 海野 +ウミノ 海埜 +ウミノオ 海野尾 +ウミノタイラ 海ノ平 +ウミハタ 海端 +ウミバタ 海端 +ウミバヤシ 海林 +ウミハラ 海原 +ウミヒラ 海平 +ウミフタ 海蓋 +ウミベ 海辺 +ウミベ 海邊 +ウミベ 海邉 +ウミホコ 海鉾 +ウミホコ 海鋒 +ウミホリ 海堀 +ウミホリ 海掘 +ウミムラ 海村 +ウミモト 海本 +ウミモト 海許 +ウミヤ 海谷 +ウミヤ 宇宮 +ウミヤマ 海山 +ウムヤシキ 産屋敷 +ウムラ 鵜村 +ウムロ 宇室 +ウメ 梅 +ウメ 右馬 +ウメ 卯目 +ウメ 夘目 +ウメアイ 梅相 +ウメイ 梅井 +ウメイ 梅居 +ウメイ 楳井 +ウメイズミ 楳泉 +ウメイチ 梅市 +ウメウチ 梅内 +ウメウラ 梅浦 +ウメエ 梅江 +ウメエダ 梅枝 +ウメオ 梅尾 +ウメオカ 梅岡 +ウメカ 梅香 +ウメガ 梅香 +ウメガ 梅賀 +ウメカイ 梅海 +ウメガイ 梅谷 +ウメガイ 梅海 +ウメガイ 梅貝 +ウメガエ 梅枝 +ウメガエ 梅ケ枝 +ウメガエ 梅香家 +ウメガキ 梅垣 +ウメガキ 楳垣 +ウメカゲ 梅景 +ウメカゲ 梅影 +ウメカゲ 梅蔭 +ウメカゲ 梅陰 +ウメガサコ 梅ケ迫 +ウメガタ 梅形 +ウメガタニ 梅ケ谷 +ウメガツジ 梅ケ辻 +ウメカド 梅門 +ウメガネ 埋金 +ウメガミ 梅上 +ウメガヤ 梅ケ谷 +ウメカワ 梅川 +ウメカワ 楳川 +ウメガワ 梅川 +ウメガワチ 梅河内 +ウメキ 梅木 +ウメキ 楳木 +ウメキ 梅基 +ウメキ 梅城 +ウメキ 梅樹 +ウメキザワ 梅木沢 +ウメキザワ 梅木澤 +ウメキタ 梅北 +ウメキタ 梅木田 +ウメキタ 楳北 +ウメキダ 梅木田 +ウメキタニ 梅木谷 +ウメキハラ 梅木原 +ウメク 梅区 +ウメグチ 梅口 +ウメクニ 梅国 +ウメクニ 梅國 +ウメクボ 梅窪 +ウメクボ 梅久保 +ウメクボ 楳窪 +ウメコウジ 梅香路 +ウメコウジ 梅小路 +ウメゴウチ 梅河内 +ウメザ 楳座 +ウメサオ 梅棹 +ウメサカ 梅坂 +ウメサカ 梅阪 +ウメサカ 楳坂 +ウメサキ 梅崎 +ウメサキ 梅咲 +ウメサキ 梅嵜 +ウメサキ 梅先 +ウメザキ 梅崎 +ウメザキ 梅咲 +ウメザキ 梅嵜 +ウメザキ 楳崎 +ウメザキ 梅前 +ウメサコ 梅迫 +ウメサコ 梅硲 +ウメサコ 梅佐古 +ウメサコ 梅峪 +ウメサト 梅里 +ウメザト 梅里 +ウメザネ 梅実 +ウメザネ 梅實 +ウメサワ 梅沢 +ウメサワ 梅澤 +ウメザワ 梅沢 +ウメザワ 梅澤 +ウメザワ 楳沢 +ウメザワ 楳澤 +ウメジ 梅地 +ウメジ 梅次 +ウメジ 梅路 +ウメシキ 梅敷 +ウメシタ 梅下 +ウメシタ 楳下 +ウメシマ 梅島 +ウメシマ 梅嶋 +ウメジマ 梅島 +ウメジマ 梅嶋 +ウメジュ 楳寿 +ウメジリ 梅尻 +ウメシロ 梅代 +ウメス 梅須 +ウメズ 梅津 +ウメズ 梅都 +ウメズ 梅主 +ウメズ 楳図 +ウメスエ 梅末 +ウメスマ 梅須磨 +ウメセイ 梅清 +ウメソノ 梅園 +ウメゾノ 梅園 +ウメゾノ 楳園 +ウメゾノ 梅薗 +ウメゾメ 梅染 +ウメタ 梅田 +ウメタ 埋田 +ウメダ 梅田 +ウメダ 楳田 +ウメダ 埋田 +ウメダ 梅多 +ウメダ 梅夛 +ウメタカ 梅高 +ウメタケ 梅竹 +ウメタダ 梅只 +ウメタダ 埋忠 +ウメダチ 梅舘 +ウメタテ 梅舘 +ウメダテ 梅館 +ウメダテ 梅舘 +ウメタニ 梅谷 +ウメタニ 梅渓 +ウメタニ 楳渓 +ウメタニ 楳谷 +ウメタニ 梅溪 +ウメタニ 楳溪 +ウメチ 梅地 +ウメチ 楳地 +ウメヂ 梅地 +ウメツ 梅津 +ウメツ 楳津 +ウメヅ 梅津 +ウメヅ 梅都 +ウメヅカ 梅塚 +ウメツキ 梅月 +ウメツギ 梅次 +ウメヅキ 梅月 +ウメツグ 梅次 +ウメツジ 梅辻 +ウメツジ 楳辻 +ウメツボ 梅坪 +ウメツボ 梅壷 +ウメデラ 梅寺 +ウメト 梅戸 +ウメド 梅戸 +ウメドイ 埋樋 +ウメトク 梅徳 +ウメトミ 梅富 +ウメドミ 梅富 +ウメトモ 梅友 +ウメナ 梅名 +ウメナイ 梅内 +ウメナイ 楳内 +ウメナカ 梅中 +ウメナガ 梅永 +ウメニシ 梅西 +ウメニワ 梅庭 +ウメネ 梅根 +ウメノ 梅野 +ウメノ 梅埜 +ウメノ 楳野 +ウメノイ 梅ノ井 +ウメノウチ 梅之内 +ウメノキ 梅ノ木 +ウメノキ 梅能木 +ウメノキサワ 梅ノ木沢(梅ノ木澤) +ウメノキザワ 梅ノ木沢(梅ノ木澤) +ウメノブ 梅延 +ウメハ 梅葉 +ウメハシ 梅橋 +ウメバシ 梅橋 +ウメハタ 梅畑 +ウメバチ 梅鉢 +ウメハナ 梅花 +ウメバヤシ 梅林 +ウメバヤシ 楳林 +ウメハラ 梅原 +ウメハラ 楳原 +ウメバラ 梅原 +ウメヒサ 梅久 +ウメヒラ 梅比良 +ウメヒラ 梅平 +ウメブ 楳生 +ウメフジ 梅藤 +ウメフネ 梅舟 +ウメフルカワ 梅古川 +ウメボリ 梅堀 +ウメマキ 梅牧 +ウメマツ 梅松 +ウメマル 梅丸 +ウメミ 梅見 +ウメミツ 梅光 +ウメミヤ 梅宮 +ウメムラ 梅村 +ウメムラ 楳村 +ウメムラ 梅邑 +ウメムレ 梅群 +ウメムロ 梅室 +ウメモト 梅本 +ウメモト 梅元 +ウメモト 梅基 +ウメモト 楳本 +ウメモト 楳元 +ウメモリ 梅森 +ウメモリ 楳森 +ウメモリ 梅守 +ウメモリ 梅盛 +ウメヤ 梅谷 +ウメヤ 梅屋 +ウメヤ 梅舎(梅舍) +ウメヤシキ 梅屋敷 +ウメヤチ 梅谷内 +ウメヤマ 梅山 +ウメヤマ 楳山 +ウメワカ 梅若 +ウメワキ 梅脇 +ウモサ 宇茂佐 +ウモト 兎本 +ウモト 卯本 +ウモト 鵜本 +ウモト 宇元 +ウモト 宇本 +ウモト 卯元 +ウモト 夘本 +ウモト 禹本 +ウモト 莵本 +ウモリ 宇森 +ウモリ 鵜森 +ウモン 右門 +ウヤ 鵜家 +ウヤ 宇家 +ウヤ 宇屋 +ウヤ 宇矢 +ウヤガワ 敬川 +ウヤギ 生柳 +ウヤナギ 卯柳 +ウヤマ 鳥山 +ウヤマ 宇山 +ウヤマ 烏山 +ウヤマ 鵜山 +ウヤマ 右山 +ウヤマ 卯山 +ウヤマ 夘山 +ウヤマ 禹山 +ウヨウ 宇陽 +ウヨノ 卯余野 +ウヨノ 夘余野 +ウラ 浦 +ウラ 宇良 +ウラ 裏 +ウラ 宇羅 +ウライ 浦井 +ウライ 裏井 +ウライ 卜井 +ウライエ 浦家 +ウライケ 浦池 +ウライサミ 浦勇 +ウライシ 浦石 +ウライズミ 浦泉 +ウライチ 浦市 +ウライデ 裏出 +ウライド 浦井戸 +ウライリ 浦入 +ウライワ 浦岩 +ウラインキョ 裏隠居 +ウラウシハラ 浦牛原 +ウラウチ 浦内 +ウラウミ 浦海 +ウラエ 浦江 +ウラエ 裏江 +ウラオ 浦尾 +ウラオカ 浦岡 +ウラオカ 裏岡 +ウラオンジョウ 浦恩城 +ウラカ 裏加 +ウラカ 裏鍛 +ウラガ 浦賀 +ウラガイト 浦垣内 +ウラガキ 浦垣 +ウラガキ 裏垣 +ウラガシラ 浦頭 +ウラカゼ 浦風 +ウラカタ 浦方 +ウラガタ 浦潟 +ウラガタ 浦瀉 +ウラカド 浦門 +ウラカド 裏門 +ウラカド 浦角 +ウラカベ 浦壁 +ウラカミ 浦上 +ウラガミ 浦上 +ウラガミ 浦神 +ウラカリ 浦狩 +ウラガリ 浦狩 +ウラカワ 浦川 +ウラカワ 裏川 +ウラカワ 浦河 +ウラカワ 裏河 +ウラガワ 浦川 +ウラカワウチ 浦川内 +ウラカワチ 浦川内 +ウラキ 浦木 +ウラキ 浦城 +ウラキ 裏木 +ウラキ 浦喜 +ウラギ 浦木 +ウラギ 裏木 +ウラギシ 浦岸 +ウラキタ 浦北 +ウラキリ 浦霧 +ウラギリ 浦霧 +ウラギワ 浦極 +ウラグチ 浦口 +ウラグチ 裏口 +ウラクボ 浦久保 +ウラクボ 浦窪 +ウラクボ 裏久保 +ウラゴウ 浦郷 +ウラゴエ 浦越 +ウラコシ 浦越 +ウラゴシ 浦越 +ウラサ 浦佐 +ウラサカ 浦坂 +ウラサカ 裏坂 +ウラサキ 浦崎 +ウラサキ 裏崎 +ウラサキ 浦嵜 +ウラザキ 浦崎 +ウラサト 浦里 +ウラザト 浦里 +ウラサワ 浦沢 +ウラサワ 浦澤 +ウラサワ 卜沢 +ウラサワ 卜澤 +ウラサワ 裏沢 +ウラサワ 裏澤 +ウラザワ 浦澤 +ウラシ 浦志 +ウラジ 浦地 +ウラジ 裏地 +ウラジ 浦路 +ウラシゲ 浦重 +ウラシタ 浦下 +ウラシバ 浦芝 +ウラシマ 浦島 +ウラシマ 浦嶋 +ウラシマ 浦嶌 +ウラジマ 浦嶋 +ウラシモ 浦霜 +ウラジョ 浦所 +ウラジリ 浦尻 +ウラシロ 浦代 +ウラジロ 浦白 +ウラシン 浦新 +ウラスエ 浦末 +ウラスギ 浦杉 +ウラスナイ 浦須内 +ウラスミ 浦隅 +ウラズミ 浦住 +ウラズミ 裏住 +ウラセ 浦瀬 +ウラソエ 浦添 +ウラゾエ 浦添 +ウラソコ 浦底 +ウラソデ 浦袖 +ウラゾノ 浦園 +ウラタ 浦田 +ウラタ 後田 +ウラタ 裏田 +ウラタ 宇良田 +ウラタ 裡田 +ウラダ 浦田 +ウラダイラ 浦平 +ウラタキ 浦滝 +ウラタキ 浦瀧 +ウラタキ 裏滝 +ウラタケ 浦竹 +ウラタツミ 浦巽 +ウラタツミ 裏巽 +ウラタニ 浦谷 +ウラタニ 裏谷 +ウラチ 浦地 +ウラチ 裏地 +ウラツ 浦津 +ウラツカ 浦塚 +ウラヅカ 浦塚 +ウラツギ 浦次 +ウラツグ 浦次 +ウラツジ 浦辻 +ウラツジ 裏辻 +ウラツボ 浦坪 +ウラヅメ 浦詰 +ウラツル 浦鶴 +ウラテ 浦手 +ウラデ 浦出 +ウラデ 裏出 +ウラテラ 浦寺 +ウラデラ 浦寺 +ウラト 浦戸 +ウラト 裏戸 +ウラト 浦渡 +ウラド 浦戸 +ウラドイ 浦土井 +ウラトウ 浦東 +ウラドコロ 浦所 +ウラトチ 浦栃 +ウラトミ 浦富 +ウラトミ 浦冨 +ウラトモ 浦塘 +ウラドモ 浦塘 +ウラナ 浦名 +ウラナカ 浦中 +ウラナカ 裏中 +ウラナカ 浦仲 +ウラナガ 浦永 +ウラナガセ 浦長瀬 +ウラナミ 浦波 +ウラナミ 浦浪 +ウラニシ 浦西 +ウラニシ 裏西 +ウラニュウ 浦入 +ウラヌマ 浦沼 +ウラネ 浦根 +ウラノ 浦野 +ウラノ 裏野 +ウラノ 浦埜 +ウラノ 浦𡌛 +ウラノブ 浦信 +ウラハ 浦葉 +ウラバ 浦波 +ウラバ 浦場 +ウラバ 浦羽 +ウラバ 浦葉 +ウラハシ 浦橋 +ウラハシ 裏橋 +ウラハタ 浦畑 +ウラハタ 浦端 +ウラハタ 浦畠 +ウラババ 浦馬場 +ウラハマ 浦浜 +ウラハマ 浦濱 +ウラバヤシ 浦林 +ウラハラ 浦原 +ウラヒガシ 浦東 +ウラヒガシ 裏東 +ウラヒサ 浦久 +ウラヒラ 浦平 +ウラフジ 浦藤 +ウラフネ 浦船 +ウラベ 占部 +ウラベ 浦部 +ウラベ 卜部 +ウラベ 浦辺 +ウラベ 浦邊 +ウラベ 浦邉 +ウラベ 裏部 +ウラベ 卜辺 +ウラベ 裏辺 +ウラホリ 浦堀 +ウラマ 裏間 +ウラマエ 浦前 +ウラマエ 裏前 +ウラマサ 裏政 +ウラマサ 裏正 +ウラマチ 浦町 +ウラマチ 裏町 +ウラマツ 浦松 +ウラマツ 裏松 +ウラマル 浦丸 +ウラミ 浦見 +ウラミ 裏見 +ウラミズ 浦水 +ウラミチ 浦道 +ウラミチ 裏道 +ウラミナミ 裏南 +ウラミナミ 浦南 +ウラミヤ 浦宮 +ウラムネ 浦宗 +ウラムラ 浦村 +ウラムラ 裏村 +ウラモト 浦本 +ウラモト 浦元 +ウラモト 裏本 +ウラモリ 浦森 +ウラモン 裏門 +ウラヤ 浦谷 +ウラヤ 浦屋 +ウラヤ 裏谷 +ウラヤ 浦矢 +ウラヤ 裏家 +ウラヤシキ 浦屋敷 +ウラヤス 浦安 +ウラヤブ 浦薮 +ウラヤブ 浦籔 +ウラヤブ 浦藪 +ウラヤマ 浦山 +ウラヤマ 裏山 +ウラヨシ 浦吉 +ウラワ 浦和 +ウラワキ 浦脇 +ウランジョ 浦所 +ウリ 瓜 +ウリ 宇利 +ウリイ 瓜井 +ウリイザカ 売井坂(賣井坂) +ウリイチ 売市(賣市) +ウリウ 瓜生 +ウリウダ 瓜生田 +ウリウノ 瓜生野 +ウリウハラ 瓜生原 +ウリウバラ 瓜生原 +ウリオ 瓜尾 +ウリガ 売賀 +ウリガ 賣賀 +ウリガナル 瓜ケ平 +ウリカネ 瓜兼 +ウリクラ 瓜倉 +ウリサカ 瓜阪 +ウリサカ 瓜坂 +ウリサキ 瓜崎 +ウリザキ 瓜崎 +ウリサコ 瓜迫 +ウリザワ 瓜澤 +ウリシバ 瓜柴 +ウリシマ 瓜島 +ウリス 瓜巣 +ウリス 宇理須 +ウリソノ 瓜園 +ウリゾノ 瓜園 +ウリタ 瓜田 +ウリダ 瓜田 +ウリタニ 瓜谷 +ウリト 瓜戸 +ウリノ 売野 +ウリノ 瓜野 +ウリノ 賣野 +ウリバ 売場 +ウリバヤシ 瓜林 +ウリハラ 瓜原 +ウリマ 売間(賣間) +ウリミネ 瓜峰 +ウリミネ 瓜峯 +ウリモト 瓜本 +ウリモリ 瓜守 +ウリヤ 瓜谷 +ウリヤ 瓜屋 +ウリヤマ 瓜山 +ウリュウ 瓜生 +ウリュウ 苽生 +ウリュウ 右柳 +ウリュウ 宇柳 +ウリュウジマ 瓜生島 +ウリュウダ 瓜生田 +ウリュウヅ 瓜生津 +ウリュウノ 瓜生野 +ウリュウハラ 瓜生原 +ウリュウバラ 瓜生原 +ウリョウ 有涼 +ウリョウ 有凉 +ウリン 雨林 +ウリン 瓜林 +ウルイ 潤 +ウルイ 潤井 +ウルイ 閏井 +ウルイ 宇留井 +ウルイ 閠井 +ウルイザカ 売井坂(賣井坂) +ウルイチ 売市(賣市) +ウルウ 潤 +ウルウ 宇留生 +ウルウ 閏 +ウルエ 宇留江 +ウルガ 宇留賀 +ウルガ 潤賀 +ウルガ 粳賀 +ウルカワ 宇留川 +ウルキ 閏木 +ウルシ 漆 +ウルシ 宇留志 +ウルシ 漆師 +ウルシオ 漆尾 +ウルシオ 㯃尾 +ウルシガキ 漆垣 +ウルシガミ 漆上 +ウルシカワ 漆川 +ウルシガワ 漆川 +ウルシキ 漆木 +ウルシギ 漆木 +ウルシクボ 漆久保 +ウルシサカ 漆坂 +ウルシザカ 漆坂 +ウルシサキ 漆崎 +ウルシサキ 漆嵜 +ウルシザキ 漆崎 +ウルシザキ 漆嵜 +ウルシサコ 漆迫 +ウルシザコ 漆迫 +ウルシザワ 漆沢 +ウルシザワ 漆澤 +ウルシシタ 漆下 +ウルシダ 漆田 +ウルシダイラ 漆平 +ウルシダテ 漆館 +ウルシダテ 漆舘 +ウルシタニ 漆谷 +ウルシダニ 漆谷 +ウルシチ 漆地 +ウルシド 漆戸 +ウルシナカ 漆中 +ウルシノ 漆野 +ウルシハ 漆葉 +ウルシバシ 漆橋 +ウルシハタ 漆畑 +ウルシハタ 洼畑 +ウルシバタ 漆畑 +ウルシバヤシ 漆林 +ウルシハラ 漆原 +ウルシハラ 槣原 +ウルシハラ 湈原 +ウルシバラ 漆原 +ウルシヒラ 漆平 +ウルシビラ 漆平 +ウルシマ 漆間 +ウルシマ 漆島 +ウルシマ 宇留島 +ウルシマ 宇留嶋 +ウルシマ 漆嶋 +ウルシマ 売島(賣島) +ウルシマ 宇畄島 +ウルシマ 漆嶌 +ウルシマ 得島 +ウルシマ 得嶋 +ウルシマエ 漆前 +ウルシマツ 㯃松(漆松) +ウルシマッカ 漆真下 +ウルシマッカ 漆眞下 +ウルシミチ 漆道 +ウルシムラ 漆村 +ウルシモト 漆本 +ウルシモト 湈本 +ウルシヤ 漆谷 +ウルシヤ 漆家 +ウルシヤ 漆屋 +ウルシヤマ 漆山 +ウルシヤマ 槣山 +ウルシワキ 漆脇 +ウルセ 漆瀬 +ウルタ 潤田 +ウルタ 宇留田 +ウルチダ 粳田 +ウルネ 宇留根 +ウルノ 宇留野 +ウルノ 閏野 +ウルノ 沽野 +ウルノ 潤野 +ウルノ 沾野 +ウルハ 漆葉 +ウルマ 漆間 +ウルマ 閏間(閠間) +ウルマ 宇留間 +ウルマ 潤間 +ウルマ 生間 +ウルマ 粳間 +ウルマ 売間(賣間) +ウルマ 得間 +ウルマ 粉間 +ウルマ 宇瑠間 +ウルマ 雨車 +ウルメ 潤米 +ウルメ 閏米 +ウルワシ 雲類鷲 +ウルワシ 漆 +ウルワシ 宇留鷲 +ウレシ 嬉 +ウレシガ 嬉賀 +ウレシナイ 嬉内 +ウレシノ 嬉野 +ウレリ 嬉里 +ウロ 卯路 +ウロ 宇呂 +ウロ 宇路 +ウロ 夘路 +ウロク 宇禄 +ウロク 宇緑 +ウロコ 鱗 +ウロコガタ 鱗形 +ウロコガワ 鱗川 +ウロコノ 鱗野 +ウロコハラ 鱗原 +ウロコボシ 鱗星 +ウワ 宇和 +ウワイ 上井 +ウワイケ 上池 +ウワイズミ 上泉 +ウワイデ 上出 +ウワイネ 上稲 +ウワエ 上江 +ウワエキ 上恵木 +ウワオ 上尾 +ウワオク 上奥 +ウワガ 宇和賀 +ウワガキ 上栫 +ウワカド 上門 +ウワガミ 上神 +ウワガミ 宇和上 +ウワガワ 宇和川 +ウワキ 上木 +ウワギ 上木 +ウワギ 表木 +ウワギ 宇和木 +ウワキド 上城戸 +ウワギリ 上桐 +ウワグチ 上口 +ウワクボ 上窪 +ウワコウ 上甲 +ウワゴウ 上郷 +ウワゴモリ 上籠 +ウワサ 上砂 +ウワサ 上佐 +ウワサ 宇和佐 +ウワサ 噂 +ウワサキ 上崎 +ウワザキ 表崎 +ウワサト 上里 +ウワサワ 上沢 +ウワサワ 上澤 +ウワジ 上地 +ウワシオ 上塩 +ウワシゲ 上茂 +ウワシトミ 上蔀 +ウワジマ 上島 +ウワジマ 上嶋 +ウワジマ 宇和島(宇和嶋) +ウワショウジ 上小路 +ウワシロ 宇和城 +ウワス 上須 +ウワズミ 上住 +ウワセキ 上関 +ウワゼキ 上関 +ウワソ 上曾 +ウワソ 上曽 +ウワダ 上田 +ウワダ 宇和田 +ウワダイ 上台(上臺) +ウワダイラ 上平 +ウワタカ 上高 +ウワタキ 上滝 +ウワタキ 上瀧 +ウワダナ 上棚 +ウワタニ 宇和谷 +ウワダバ 上太場 +ウワダバ 上駄場 +ウワタリ 宇渡 +ウワダン 上段 +ウワツ 上津 +ウワヅツミ 上堤 +ウワテ 上手 +ウワドイ 上土居 +ウワトウ 上任 +ウワドウ 上銅 +ウワトク 上徳 +ウワトコ 上床 +ウワドコ 上床 +ウワナル 上鳴 +ウワニ 上荷 +ウワニシ 上西 +ウワヌマ 上沼 +ウワヌユ 上温湯 +ウワヌリ 上温湯 +ウワヌルユ 上温湯 +ウワネ 上根 +ウワノ 上野(上墅) +ウワノ 宇和野 +ウワノ 上和野 +ウワノリ 上乗 +ウワハ 上羽 +ウワバ 上羽 +ウワバ 上場 +ウワバサミ 上狭 +ウワバサミ 上狹 +ウワバタ 上畠 +ウワバチ 上鉢 +ウワハラ 上原 +ウワブ 上武 +ウワブ 上符 +ウワフジ 上藤 +ウワフネ 上船(上舩) +ウワベ 上部 +ウワボ 上保 +ウワボウチ 宇和房地 +ウワホド 上程 +ウワホリ 上堀 +ウワボリ 上堀 +ウワマチ 上町 +ウワミ 上見 +ウワミ 上味 +ウワミズ 上水 +ウワミゾ 上溝 +ウワミチ 上道 +ウワミノ 上蓑 +ウワミノ 上簑 +ウワミョウ 上名 +ウワムカイ 上向井 +ウワムラ 宇和村 +ウワモリ 上森 +ウワヤ 上家 +ウワヤ 上屋 +ウワヤ 上矢 +ウワヤマ 宇和山 +ウワヨコテ 上横手 +ウン 運 +ウンエイ 運永 +ウンガ 運賀 +ウンカイ 雲開 +ウンキ 運木 +ウンゴウ 雲郷 +ウンザイ 雲財 +ウンザキ 運崎 +ウンジ 雲地 +ウンシマ 雲島 +ウンジュ 運寿 +ウンジョ 雲所 +ウンジョウ 運上 +ウンジョウ 雲乗 +ウンセイ 運勢 +ウンセキ 雲石 +ウンタニ 雲谷 +ウンテン 運天 +ウント 雲戸 +ウンド 雲土 +ウンドウ 雲藤 +ウンドウ 運藤 +ウンドウ 運道 +ウンドウ 雲籐 +ウンナ 雲名 +ウンナイ 雲内 +ウンナン 雲南 +ウンナンダ 雲南田 +ウンノ 海野 +ウンノ 雲野 +ウンノ 叶野 +ウンノ 吽野 +ウンノ 耘野 +ウンノ 呼野 +ウンノ 運野 +ウンノリ 運乗(運乘) +ウンポウ 雲宝 +ウンボク 雲北 +ウンマン 運万 +ウンマン 運萬 +ウンリュウ 雲竜 +ウンリュウ 雲龍 +ウンリン 雲林 +ウンリンイン 雲林院 +エ 江 +エアシロ 餌網代 +エアジロ 餌網代 +エアラシ 江嵐 +エイ 栄 +エイ 江井 +エイ 永 +エイ 頴娃 +エイ 衛 +エイ 恵井(惠井) +エイ 穎娃 +エイ 頴姓 +エイ 江居 +エイアンジ 永安寺 +エイエイ 永栄 +エイエイ 永榮 +エイオカ 永岡 +エイカ 栄花(榮花) +エイカ 栄家(榮家) +エイカ 英加 +エイガ 英賀 +エイガ 栄花(榮花) +エイガ 栄賀(榮賀) +エイカイ 永海 +エイカイ 栄開 +エイガミ 永上 +エイカワ 永川 +エイカワ 頴川 +エイカワ 栄川 +エイカワ 穎川 +エイカワ 榮川 +エイカワ 英川 +エイガワ 偉川 +エイキ 永木 +エイキ 栄木 +エイキ 栄喜 +エイキ 永喜 +エイキ 英木 +エイキ 榮木 +エイキ 榮喜 +エイギ 英木 +エイキュウ 永久 +エイギョウ 永業 +エイグチ 永口 +エイグチ 栄口 +エイグチ 英口 +エイグチ 榮口 +エイクマ 栄隈 +エイクラ 永倉 +エイクラ 栄倉(榮倉) +エイゲツ 永月 +エイゲツ 栄月 +エイゲン 栄元 +エイゲン 永源 +エイゲン 榮元 +エイゴ 永後 +エイコク 栄国(榮國) +エイコシ 永越 +エイゴン 永言 +エイザ 永座 +エイサカ 永坂 +エイサカ 栄坂(榮坂) +エイサカ 栄阪(榮阪) +エイサキ 永崎 +エイザキ 永崎 +エイサコ 栄迫 +エイサコ 榮迫 +エイササ 栄笹 +エイサワ 栄沢 +エイザワ 永沢 +エイザワ 永澤 +エイザワ 栄沢 +エイザワ 栄澤 +エイザワ 榮沢 +エイザワ 榮澤 +エイザン 恵山(惠山) +エイシ 江石 +エイジ 永治 +エイジ 永地 +エイジ 栄次 +エイジ 栄治 +エイジ 榮次 +エイシマ 永島 +エイシマ 永嶋 +エイシマ 栄島 +エイシマ 榮島 +エイシマ 榮嶌(栄嶌) +エイジマ 永島 +エイジマ 永嶋 +エイジマ 栄島 +エイジマ 栄嶋 +エイジマ 榮島 +エイジマ 榮嶋 +エイシャ 永車 +エイジュ 永寿(永壽) +エイジュウ 永住 +エイジョウ 栄城 +エイシロ 栄代 +エイシロ 榮代 +エイシン 永信 +エイス 永須 +エイズカ 永塚 +エイスギ 永杉 +エイズミ 江泉 +エイズミ 永泉 +エイズミ 栄角(榮角) +エイゼン 永善 +エイソ 永曽 +エイソ 永祚 +エイソ 永曾 +エイゾノ 栄薗(榮薗) +エイタ 永田 +エイタ 栄田 +エイタ 永多 +エイタ 栄多(榮多) +エイダ 永田 +エイダ 栄田 +エイダ 恵田(惠田) +エイダ 榮田 +エイダ 英田 +エイタイ 永代 +エイタイ 永躰 +エイタイ 永体 +エイダイ 永代 +エイタカ 永高 +エイタカヤ 榮高屋 +エイタキ 永滝 +エイタキ 永瀧 +エイタニ 永谷 +エイタニ 栄谷 +エイタニ 榮谷 +エイチ 永地 +エイチョウ 永長 +エイツウ 永通 +エイツカ 永塚 +エイツカ 栄塚 +エイヅカ 永塚 +エイツグ 栄次 +エイヅル 栄鶴(榮鶴) +エイデ 永出 +エイト 永戸 +エイト 永登 +エイド 栄土 +エイトウ 衛藤 +エイトウ 永藤 +エイトウ 栄藤(榮藤) +エイトウ 栄東 +エイトウ 永当 +エイトウ 永當 +エイトウ 永籐 +エイドウ 永洞 +エイドウ 英堂 +エイトク 永徳 +エイトク 栄徳 +エイトク 榮徳 +エイトクヤ 永徳屋 +エイドメ 栄留 +エイドメ 榮留 +エイナカ 永中 +エイナガ 永長 +エイナガ 栄永 +エイナガ 栄長(榮長) +エイナガ 榮永 +エイナマ 永生 +エイナミ 栄浪(榮浪) +エイナリ 永成 +エイナル 永成 +エイナン 永南 +エイニシ 栄西 +エイニシ 榮西 +エイヌマ 永沼 +エイノ 永野 +エイノ 栄野(榮野) +エイノ 営野 +エイノ 營野 +エイノオ 永ノ尾 +エイハ 栄羽 +エイハ 榮羽 +エイバ 永場 +エイバヤシ 永林 +エイバヤシ 栄林(榮林) +エイハラ 永原 +エイハラ 栄原 +エイハラ 榮原 +エイビ 英比 +エイフク 永福 +エイフク 栄福 +エイフク 榮福 +エイホ 英保 +エイホ 栄保 +エイホ 永甫 +エイマ 永間 +エイマエダ 栄前田 +エイマエダ 榮前田 +エイマル 永丸 +エイミズ 榮水 +エイミツ 永光 +エイムラ 永村 +エイムラ 栄村 +エイムラ 榮村 +エイムラ 詠村 +エイムラ 衛村 +エイモト 永本 +エイモト 栄本 +エイモト 栄元 +エイモト 榮元 +エイモト 榮本 +エイモリ 永森 +エイモリ 栄森 +エイモリ 栄盛(榮盛) +エイモリ 榮森 +エイモン 栄門 +エイモン 榮門 +エイヤス 栄保 +エイヤマ 永山 +エイヤマ 栄山 +エイヤマ 英山 +エイヤマ 榮山 +エイヨ 永栄 +エイヨ 栄代 +エイヨ 永誉 +エイヨ 永譽 +エイヨウ 永用 +エイライ 永来(永來・永耒) +エイラク 永楽 +エイラク 栄楽(榮楽) +エイラク 永樂 +エイラク 榮樂 +エイリ 家入 +エイリ 江入 +エイリ 栄利(榮利) +エイリュウ 永柳 +エイリュウ 永立 +エイロ 永露 +エイロ 永路 +エイワ 栄岩 +エイワ 永和 +エイワ 栄羽 +エイワ 榮岩 +エウス 江薄 +エウチ 絵内 +エウチ 江打 +エウチ 江内 +エウチ 餌打 +エウチ 繪内 +エウチダ 江内田 +エウチタニ 江内谷 +エウチダニ 江内谷 +エウラ 江浦 +エウラ 柄浦 +エオ 江尾 +エオカ 永岡 +エオカ 江岡 +エガ 恵我 +エガ 江賀 +エカイ 江海 +エガイツ 荏開津 +エカク 江角 +エガク 慧嶽 +エガサキ 江ケ崎 +エガサキ 江ケ嵜 +エガシラ 江頭 +エガタ 江形 +エガタ 江方 +エガタニ 英賀谷 +エガタヤ 恵方谷 +エガネ 江金 +エカノ 英加野 +エガミ 江上 +エガミ 恵上 +エガミ 永上 +エガミ 江神 +エガミ 廻神(𢌞神) +エガミ 絵上 +エガミ 恵紙 +エガミ 惠上 +エガミ 繪上 +エガミ 廽上 +エガラ 永柄 +エガラ 荏柄 +エガラ 江唐 +エガラ 江柄 +エガラキ 家柄木 +エガラシ 江柄子 +エカリ 江苅 +エカリ 江刈 +エガリ 江苅 +エカリガワ 江刈川 +エカリガワ 江苅川 +エカリナイ 江刈内 +エカリナイ 江苅内 +エカワ 江川 +エカワ 頴川 +エカワ 江河 +エカワ 恵川 +エカワ 栄川 +エガワ 江川 +エガワ 越川 +エガワ 永川 +エガワ 枝川 +エガワ 頴川 +エガワ 江河 +エガワ 恵川 +エガワ 栄川 +エガワ 柄川 +エガワ 穎川 +エガワ 榎川 +エガワ 得川 +エガワ 頴河 +エガワ 絵川(繪川) +エガワ 榮川 +エガワ 衛川 +エガワ 惠川 +エガワ 潁川 +エガワノ 江川野 +エキ 江木 +エキ 益 +エキ 恵木 +エキ 浴 +エキ 悦喜 +エキ 役 +エキ 易 +エキ 﨏 +エキ 駅 +エキ 驛 +エキ 惠木 +エキ 恵喜 +エキ 場 +エギ 江木 +エギ 恵木 +エギ 栄木 +エギ 江城 +エギ 榮木 +エギ 惠木 +エキイ 浴井 +エキオ 浴尾 +エキオカ 浴岡 +エキグチ 浴口 +エキサカ 浴坂 +エキサコ 駅迫 +エキサダ 益貞 +エギシ 江岸 +エキシゲ 駅重(驛重) +エキシマ 益島 +エキタ 浴田 +エキタ 駅田 +エキタ 易田 +エキタ 驛田 +エキタ 隘田 +エキダ 嶧田(𡵸田) +エキダ 浴田 +エキダ 駅田 +エキダ 易田 +エキダ 溢田 +エキダ 驛田 +エキヅカ 益塚 +エキト 益登 +エキトウ 益当 +エキナ 恵喜名 +エキナカ 浴中 +エキナガ 浴永 +エキナガ 駅永(驛永) +エキナガ 浴長 +エキノ 浴野 +エキノ 液野 +エキノ 駅野(驛野) +エキバ 駅場(驛場) +エギハタ 江木畠 +エギハタ 江木畑 +エキバヤシ 浴林 +エキヒロ 浴広(浴廣) +エキマチ 浴町 +エキムラ 浴村 +エキモト 益本 +エキモト 浴本 +エキモト 易本 +エキモト 恵木本 +エキモト 浴元 +エキモト 溢元 +エキモト 昜本 +エギモト 恵木本 +エキモリ 浴森 +エキヤマ 浴山 +エキョウ 惠京 +エキョウ 恵京 +エクアン 栄久庵(榮久庵) +エクオ 栄久庵(榮久庵) +エクサ 江草 +エクサ 荏草 +エグサ 江草 +エグサ 江種 +エグサ 江艸 +エグサ 得草 +エグチ 江口 +エグチ 永口 +エグチ 恵口(惠口) +エグチ 栄口 +エグチ 江鬮 +エグチ 江䰗 +エグチ 榮口 +エクニ 江国 +エクニ 江國 +エグニ 江国 +エグニ 江國 +エクボ 江久保 +エクボ 江窪 +エクボ 靨 +エクマ 江熊 +エクマ 江隈 +エクマ 荏隈 +エグマ 江熊 +エグマ 江隈 +エクラ 江倉 +エグラ 江蔵 +エグリ 江操 +エクレム 阿呉夢 +エグロ 江黒 +エゲ 恵下 +エゲ 会下 +エゲ 惠下 +エゲ 會下 +エゲタ 恵下田(惠下田) +エゲツ 江月 +エゲヤマ 永下山 +エコ 江湖 +エコ 恵古(惠古) +エコ 江子 +エコ 江古 +エゴ 江後 +エゴ 江籠 +エゴ 江湖 +エゴ 江篭 +エゴ 依怙 +エゴ 恵古(惠古) +エゴ 江子 +エゴ 江古 +エゴ 依帖 +エゴ 依怗 +エゴ 江胡 +エコウ 江向 +エコウ 恵口(惠口) +エゴウ 江郷 +エゴウ 江籠 +エゴウ 恵郷 +エコシ 江越 +エゴシ 江越 +エゴシタ 江郷下 +エゴタ 江後田 +エゴハラ 恵後原 +エゴハラ 衛湖原 +エゴハラ 惠後原 +エゴヒラ 江篭平 +エゴヒラ 江籠平 +エコヤマ 江湖山 +エゴヤマ 江湖山 +エサ 江左 +エザ 江座 +エサカ 江坂 +エサカ 榎坂 +エサカ 榎阪 +エサカ 江阪 +エサカ 恵阪 +エサカ 恵坂 +エサカ 惠阪 +エザカ 江坂 +エサキ 江崎 +エサキ 江嵜 +エサキ 江碕 +エサキ 江先 +エザキ 江崎 +エザキ 永崎 +エザキ 江嵜 +エザキ 榎崎 +エザキ 恵崎 +エザキ 江碕 +エザキ 惠崎 +エサキヤ 江崎屋 +エサシ 江刺(江剌) +エサシ 江指 +エサシ 永指 +エサシ 餌差 +エザシ 江指 +エサシカ 江刺家 +エサシヤ 江刺家 +エサト 江里 +エザト 江里 +エサワ 江沢 +エサワ 江澤 +エザワ 江沢 +エザワ 江澤 +エザワ 恵沢 +エザワ 絵沢 +エザワ 恵澤 +エザワ 惠澤 +エザワ 繪澤 +エシ 江志 +エシ 恵志 +エジ 榎地 +エジ 江司 +エジ 江枝 +エジ 江治 +エシカ 江鹿 +エシタ 江下 +エシタ 恵下 +エシタ 惠下 +エジノ 衛士野 +エシバ 江芝 +エシマ 江島 +エシマ 江嶋 +エシマ 栄嶋 +エジマ 永島 +エジマ 江島 +エジマ 江嶋 +エジマ 家島 +エジマ 江洲 +エジマ 恵島 +エジマ 工島 +エジマ 江嶌 +エジマ 柄島 +エジマ 恵嶋(惠嶋) +エジマ 絵島 +エジマ 惠島 +エジマ 繪島 +エジマタニ 江島谷 +エショ 絵所 +エショ 繪所 +エジョウ 江城 +エジリ 江尻 +エシロ 江城 +エシロ 江代 +エス 江洲 +エス 江洌 +エズ 絵図 +エスエ 江末 +エスガ 江菅 +エズカ 江塚 +エスカワ 恵須川 +エスダ 江筋田 +エズハラ 槐原 +エスミ 江角 +エスミ 重栖 +エスミ 江住 +エスミ 江隅 +エズミ 江角 +エズミ 江泉 +エズミ 江積 +エズミ 江住 +エズモリ 犾守 +エズモリ 犹守 +エスヤ 会也 +エズラ 江面 +エズラ 絵面 +エズラ 恵面(惠面) +エズラ 繪面 +エズレ 江連 +エズレ 江蓮 +エゼン 慧善 +エソ 江曽(江曾) +エソウ 江曽(江曾) +エソウ 恵荘(惠荘) +エゾウ 江蔵 +エゾウ 江藏 +エゾエ 江副 +エゾエ 江添 +エソタニ 鰣谷 +エゾツカ 夷塚 +エゾヅカ 夷塚 +エゾノ 榎園 +エゾノ 榎薗 +エゾノ 江園 +エゾモリ 蝦夷森 +エゾモリ 夷森 +エタ 江田 +エダ 江田 +エダ 枝 +エダ 衣田 +エダ 恵田(惠田) +エダ 朶 +エダ 枝田 +エダ 荏田 +エタイ 江袋 +エダイ 枝井 +エダイラ 恵平 +エタオ 江垰 +エダオ 枝尾 +エダオカ 枝岡 +エタカ 永高 +エダカ 江高 +エダガキ 枝垣 +エダカワ 枝川 +エダガワ 枝川 +エダキ 枝木 +エダギ 枝木 +エダギシ 枝岸 +エダグチ 枝口 +エダクニ 枝国 +エダクニ 枝國 +エダクボ 枝久保 +エダクボ 枝窪 +エダクラ 枝倉 +エダサキ 枝崎 +エダサコ 枝迫 +エダサワ 枝沢 +エダサワ 枝澤 +エダザワ 枝沢 +エダザワ 枝澤 +エダシゲ 枝重 +エダジマ 枝島 +エダジマ 枝嶋 +エダタ 枝田 +エタタニ 栄多谷 +エダタニ 枝谷 +エダツギ 枝次 +エダツグ 枝次 +エダツネ 枝常 +エダナカ 枝中 +エダナガ 枝長 +エダナガ 枝永 +エダナミ 枝並 +エダナミ 枝浪 +エダナミ 枝波 +エタニ 榎谷 +エタニ 恵谷 +エタニ 江谷 +エタニ 惠谷 +エタニ 絵谷 +エタニ 繪谷 +エダニ 榎谷 +エダニ 恵谷 +エダニ 江谷 +エダニ 惠谷 +エタネ 江種 +エダネ 経種 +エダネ 枝根 +エダネ 經種 +エダノ 枝野 +エダノブ 枝信 +エダハシ 枝橋 +エダハタ 枝畑 +エダハマ 江田浜 +エダハラ 枝原 +エダヒラ 枝平 +エダヒロ 枝広 +エダヒロ 枝廣 +エダマ 江玉 +エダマサ 枝正 +エダマツ 枝松 +エダミ 枝見 +エダミツ 枝光 +エダムラ 枝村 +エダモト 枝元 +エダモト 枝本 +エタヤ 恵多谷 +エタヤ 惠多谷 +エダヤ 枝谷 +エダヨシ 枝吉 +エチ 恵智 +エヂ 栄次 +エチエ 越江 +エチガタニ 越ケ谷 +エチカワ 越川 +エチガワ 越川 +エチキ 越岐 +エチゴ 越後 +エチゴ 愛知後 +エチゴウ 越郷 +エチゴシマ 越後島 +エチゴジマ 越後島 +エチゴタニ 越後谷 +エチゴバヤシ 越後林 +エチゴヤ 越後谷 +エチゴヤ 越後屋 +エチザキ 越崎 +エチゼン 越前 +エチゼン 越善 +エチゼン 越膳 +エチゼンタニ 越前谷 +エチゼンヤ 越前谷 +エチゼンヤ 越前屋 +エチダ 越田 +エチョウ 江町 +エチョウヅカ 恵帳塚 +エチョウヅカ 恵長塚 +エツ 悦 +エツ 恵津 +エヅ 江津 +エヅ 恵津 +エツイ 悦居 +エツウチ 悦内 +エツエ 悦永 +エツオカ 悦岡 +エッカ 悦過 +エツカ 江塚 +エツカ 悦家 +エツカ 悦過 +エヅカ 江塚 +エツカタ 悦方 +エツカツ 悦勝 +エツカワ 越川 +エツキ 悦喜 +エツキ 悦木 +エヅキ 江月 +エツグ 越次 +エッコ 越湖 +エツサキ 越崎 +エツザキ 越崎 +エツジ 江辻 +エツシマ 越島(越嶋) +エツゼン 越前 +エツゼン 越膳 +エッソウ 悦宗 +エツダ 越田 +エツダ 悦田 +エツタニ 越谷 +エッチュウ 越中 +エッチュウヤ 越中谷 +エッチュウヤ 越中屋 +エツドウ 悦道 +エツナガ 悦永 +エツナギ 江繋 +エツノ 悦野 +エツマ 越間 +エツミ 悦見 +エツミ 悦覟 +エヅミ 江積 +エヅメ 江爪 +エツモト 悦本 +エツモリ 恵津森 +エツモリ 惠津森 +エツヤ 越谷 +エヅラ 江面 +エヅラ 絵面 +エヅラ 恵面(惠面) +エヅラ 繪面 +エツリコ 江釣子 +エヅリコ 江釣子 +エヅル 恵鶴 +エツレ 江連 +エヅレ 江連 +エデ 江出 +エデラ 江寺 +エト 江戸 +エト 江渡 +エト 絵戸 +エト 恵戸 +エト 越砺 +エト 越礪 +エド 江戸 +エド 江渡 +エド 恵土(惠土) +エドアミ 江戸網 +エトウ 江藤 +エトウ 江頭 +エトウ 衛藤 +エトウ 依藤 +エトウ 江渡 +エトウ 恵藤 +エトウ 栄藤(榮藤) +エトウ 江東 +エトウ 衞藤 +エトウ 衛籐(衞籐) +エトウ 絵東 +エトウ 江登 +エトウ 江籐 +エトウ 得藤 +エトウ 惠藤 +エトウ 惠籐 +エドウ 江渡 +エドウ 江道 +エドウ 絵堂 +エドウ 繪堂 +エドウジ 江導寺 +エドウジ 江道寺 +エトオ 江遠 +エドガワ 江戸川 +エトキ 家時 +エトク 工徳 +エドコロ 永所 +エドサキ 江戸崎 +エドタ 江戸田 +エドタニ 江戸谷 +エトチ 越砺 +エドツカ 江戸塚 +エドノ 江戸野 +エドノ 江殿 +エドハタ 江戸端 +エドバタ 江戸端 +エドハラ 江戸原 +エドボ 江戸保 +エトミ 江富 +エドヤ 江戸谷 +エドヤ 江戸屋 +エトリ 餌取 +エトリ 江取 +エドワ 江戸輪 +エナ 衣奈 +エナ 江名 +エナ 恵納(惠納) +エナイ 絵内 +エナイ 恵内 +エナイ 惠内 +エナイ 繪内 +エナイダ 江内田 +エナイダニ 江内谷 +エナカ 江中 +エナカ 恵中 +エナカ 惠中 +エナガ 江永 +エナガ 江長 +エナコ 江名子 +エナツ 江夏 +エナベ 江辺 +エナミ 榎並 +エナミ 江波 +エナミ 江南 +エナミ 江並 +エナミ 枝並 +エナミ 榎波 +エナミ 江浪 +エナミ 恵南(惠南) +エナミ 榎浪 +エナミ 永並 +エナミ 益並 +エナミ 海浪 +エナミ 榎南 +エナミ 叡南 +エナミ 恵波(惠波) +エナミト 江波戸 +エナミヤ 榎並谷 +エナミヤ 榎並宮 +エナリ 江成 +エニシ 江西 +エニシ 永西 +エニシ 恵西 +エニシ 柄西 +エニチ 恵日 +エヌイ 江縫 +エヌマ 江沼 +エネイ 江井 +エネモト 榎根本 +エノ 江野 +エノ 榎野 +エノ 絵野 +エノ 恵野 +エノ 繪野 +エノイ 榎井 +エノウ 恵濃 +エノウ 惠濃 +エノウエ 江上 +エノウエ 江ノ上 +エノウエ 江の上 +エノウチ 榎内 +エノウラ 江浦 +エノウラ 江ノ浦 +エノエ 家江 +エノエダ 榎枝 +エノオ 江尾 +エノオ 榎尾 +エノオク 榎奥 +エノオモテ 江表 +エノガキ 榎垣 +エノカミ 江ノ上 +エノガミ 江ノ上 +エノガミ 江野上 +エノカワ 栄野川 +エノカワ 榎川 +エノカワ 可愛川 +エノカワ 江野川 +エノカワ 榮野川 +エノガワ 江野川 +エノキ 榎 +エノキ 榎木 +エノキ 鰀貴 +エノキ 恵野木 +エノキ 檟 +エノキ 江之城 +エノキウチ 榎内 +エノキガワ 榎川 +エノキクラ 榎倉 +エノキグラ 榎倉 +エノキザカ 榎坂 +エノキザワ 榎沢 +エノキザワ 榎澤 +エノキシマ 榎島 +エノキジマ 榎島 +エノキジマ 榎嶋 +エノキズ 榎頭 +エノキゾエ 榎添 +エノキゾノ 榎園 +エノキゾノ 榎薗 +エノキゾノ 榎木園 +エノキゾノ 榎木薗 +エノキタ 榎田 +エノキダ 榎田 +エノキダ 榎木田 +エノキダイラ 榎木平 +エノキタニ 榎谷 +エノキダニ 榎谷 +エノキダニ 榎木谷 +エノキヅ 榎津 +エノキヅル 榎鶴 +エノキト 榎戸 +エノキド 榎戸 +エノキド 榎土 +エノキトウゲ 榎峠 +エノキハタ 榎畑 +エノキバタ 榎畑 +エノキハヤシ 榎林 +エノキバヤシ 榎林 +エノキバヤシ 榎木林 +エノキハラ 榎原 +エノキバラ 榎原 +エノキヒラ 榎平 +エノキボリ 榎堀 +エノキマル 榎丸 +エノキマル 榎木丸 +エノキムラ 榎村 +エノキモト 榎本 +エノキモト 榎元 +エノキモリ 榎森 +エノキヤ 榎谷 +エノキヤ 榎屋 +エノキヤ 榎木谷 +エノクチ 江口 +エノクチ 江野口 +エノクチ 江之口 +エノクチ 江ノ口 +エノグチ 江野口 +エノグチ 江ノ口 +エノクボ 榎窪 +エノクボ 江野窪 +エノクマ 荏隈 +エノクラ 榎倉 +エノサカ 榎坂 +エノサキ 榎崎 +エノサコ 榎硲 +エノサワ 江野沢 +エノサワ 江野澤 +エノサワ 榎沢 +エノサワ 榎澤 +エノサワ 絵野沢(絵野澤) +エノサワ 絵ノ沢 +エノサワ 絵ノ澤 +エノサワ 江の沢 +エノサワ 繪野澤 +エノザワ 江野沢 +エノザワ 江野澤 +エノシタ 榎下 +エノシタ 江野下 +エノシマ 江島 +エノシマ 榎島 +エノシマ 榎嶋 +エノシマ 江ノ島 +エノシマ 江野島 +エノシマ 江野嶋 +エノシリ 江野尻 +エノジリ 江野尻 +エノセ 榎勢 +エノセ 榎瀬 +エノダ 榎田 +エノタニ 榎谷 +エノチ 江後 +エノツカ 榎塚 +エノト 榎戸 +エノハタ 榎畑 +エノハタ 江野畑 +エノハタ 江ノ畑 +エノハラ 榎原 +エノヒ 栄野比 +エノビ 栄野比 +エノビ 榮野比 +エノホリ 榎堀 +エノマ 江野間 +エノマエ 江前 +エノマタ 榎股 +エノマタ 榎又 +エノマル 榎丸 +エノミヤ 榎宮 +エノミヤ 愛宮 +エノムラ 榎村 +エノムラ 江野村 +エノムラ 恵野村 +エノメ 江目 +エノメ 鰀目 +エノメ 江ノ目 +エノメ 鯵目 +エノメ 江の目 +エノモト 榎本 +エノモト 永本 +エノモト 柄本 +エノモト 榎元 +エノモト 江野本 +エノモト 江ノ本 +エノモト 栄野元 +エノモト 荏本 +エノモト 永野元 +エノモト 江之本 +エノモト 榮野元 +エノモリ 榎森 +エノヨシ 榎吉 +エノリ 江則 +エノリ 江徳 +エノワキ 江野脇 +エバ 江場 +エバ 江葉 +エハシ 江橋 +エバシ 江端 +エバシ 江橋 +エハタ 江幡 +エハタ 江畑 +エハタ 江畠 +エハタ 絵幡 +エハタ 江帾 +エハタ 荏畑 +エハタ 繪幡 +エバタ 江端 +エバタ 江幡 +エバタ 江畑 +エバタ 江畠 +エバタ 絵幡 +エバタ 恵畑 +エバタ 衣幡 +エバタ 絵畑(繪畑) +エバタ 江帾 +エバタ 江場田 +エバタ 荏畑 +エバタ 栄畑(榮畑) +エバタ 江葉田 +エバタ 惠畑 +エバタ 繪幡 +エバタ 帾畑 +エバタ 江発田(江發田) +エハト 江波戸 +エハト 江鳩 +エハト 餌鳩 +エバト 江波戸 +エバト 江鳩 +エバト 絵鳩 +エバト 餌鳩 +エバト 繪鳩 +エハナ 江花 +エバナ 江花 +エバナ 恵花 +エバナ 惠花 +エハマ 江浜 +エハマ 江濱 +エバヤシ 江林 +エバヤシ 直林 +エバヤシ 恵林 +エハラ 江原 +エハラ 永原 +エハラ 榎原 +エハラ 荏原 +エハラ 恵原(惠原) +エハラ 頴原 +エハラ 得原 +エハラ 枝原 +エハラ 穎原 +エハラ 絵原(繪原) +エバラ 江原 +エバラ 榎原 +エバラ 荏原 +エバラ 恵原(惠原) +エバラ 頴原 +エバラ 餌原 +エビ 海老 +エビ 衣斐 +エビ 江尾 +エビ 衣裴 +エビ 衣非 +エビ 恵比 +エビ 惠比 +エビイ 戎井 +エビイ 胡井 +エビイ 海老井 +エビイケ 海老池 +エビウラ 海老浦 +エビエ 海老江 +エビエ 蛯江 +エビオカ 海老岡 +エビカイ 海老海 +エビガサコ 海老ケ迫 +エビガセ 海老ケ瀬 +エビカワ 海老川 +エビカワ 蛯川 +エビキ 恵比木 +エビクサ 蝦草 +エビグチ 海老口 +エビコ 蛯子 +エビコ 海老子 +エビコ 蝦子 +エビサカ 海老坂 +エビサキ 海老崎 +エビザキ 海老崎 +エビサワ 海老沢 +エビサワ 海老澤 +エビサワ 蛯沢 +エビサワ 蛯澤 +エビサワ 魵沢 +エビサワ 魵澤 +エビサワ 螧沢 +エビサワ 蝦沢 +エビサワ 恵比沢 +エビサワ 蝦澤 +エビサワ 恵比澤 +エビサワ 鰕沢 +エビサワ 鰕澤 +エビサワ 螧澤 +エビザワ 海老沢 +エビザワ 海老澤 +エビザワ 蛯澤 +エビザワ 惠比澤 +エビシ 恵比志 +エビシカワ 海老子川 +エビシガワ 海老子川 +エビシマ 海老島 +エビシマ 海老嶋 +エビス 戎 +エビス 蛭子 +エビス 胡 +エビス 胡子 +エビス 恵比須 +エビス 夷 +エビス 戎子 +エビス 恵比寿(惠比寿) +エビス 恵美須 +エビス 恵飛須(惠飛須) +エビス 夷子 +エビス 海老主 +エビス 胡家 +エビス 惠比須 +エビス 恵比壽 +エビス 蛭 +エビス 惠比壽 +エビス 惠美須 +エビス 蛯寿(蛯壽) +エビスアキ 胡明 +エビスイ 戎井 +エビスイ 胡井 +エビスイ 戎居 +エビスイ 蛭子井 +エビスイ 海老水 +エビスイ 夷井 +エビスイ 胡居 +エビスイケ 戎池 +エビスウラ 戎浦 +エビスエ 戎末 +エビスオカ 戎岡 +エビズカ 海老塚 +エビスガワ 海老子川 +エビスガワ 胡川 +エビスギ 胡木 +エビスギ 戎木 +エビスサキ 蛭崎 +エビスザキ 戎崎 +エビスザキ 蛭崎 +エビスザキ 胡崎 +エビスザキ 胡子崎 +エビスザキ 胡嵜 +エビスシタ 戎下 +エビスジマ 戎嶋 +エビスジマ 戎島 +エビスタ 蛭多 +エビスダ 胡田 +エビスダ 戎田 +エビスタニ 戎谷 +エビスタニ 胡谷 +エビスタニ 蛭子谷 +エビスダニ 戎谷 +エビスダニ 胡谷 +エビスドウ 胡堂 +エビスノ 戎野 +エビスノ 蛭子野 +エビスハマ 胡浜(胡濱) +エビスハラ 戎原 +エビスバラ 戎原 +エビスフジ 戎藤 +エビスボリ 戎堀 +エビスマルヤ 戎丸屋 +エビスモト 胡本 +エビスモト 戎本 +エビスモト 蛭子本 +エビスモト 胡元 +エビスモト 姪子本 +エビスモリ 戎森 +エビスヤ 戎谷 +エビスヤ 戎屋 +エビスヤ 蛭子谷 +エビスヤ 胡屋 +エビスヤ 戎家 +エビスヤ 蛭子屋 +エビスヤ 恵美須屋 +エビスヤ 戒谷 +エビスヤ 戎矢 +エビスヤ 惠美須屋 +エビスユ 戎湯 +エビスワキ 戎脇 +エビセ 海老瀬 +エビタ 胡田 +エビタ 海老田 +エビタ 蝦田 +エビタ 蛯田 +エビタニ 蛯谷 +エビタニ 海老谷 +エビタニ 蛭谷 +エビツカ 海老塚 +エビヅカ 海老塚 +エビツボ 海老坪 +エヒナ 恵比奈 +エビナ 蝦名 +エビナ 蛯名 +エビナ 海老名 +エビナ 鮱名 +エビナ 蛭名 +エビナ 鰕名 +エビナ 鰝奈 +エビナ 姥名 +エビナ 海老納 +エビナ 恵比名 +エビナ 呑名 +エビナガ 海老永 +エビニシ 鰕西 +エビヌマ 海老沼 +エビヌマ 鰭沼 +エビネ 海老根 +エビネ 恵比根 +エビネ 惠比根 +エビノ 海老野 +エビハナ 海老鼻 +エビハマ 蛭浜 +エビハマ 蛭濱 +エビハラ 海老原 +エビハラ 蛯原 +エビハラ 螧原 +エビハラ 蝦原 +エビハラ 鰕原 +エビハラ 恵比原(惠比原) +エビハラ 蛭原 +エビハラ 鮱原 +エビムラ 海老村 +エビモト 海老本 +エビヤ 蛯谷 +エビヤ 海老谷 +エビヤ 戎屋 +エビヤ 蝦谷 +エビヤマ 豁山 +エビヤマ 海老山 +エビヨシ 戎吉 +エヒラ 江平 +エヒラ 得平 +エヒラ 恵平 +エビラ 江平 +エビラ 箙 +エビラ 恵平 +エビラ 惠平 +エビラセ 箙瀬 +エヒラハラ 江平原 +エヒロ 永広 +エヒロ 永廣 +エブオカ 夷岡 +エブキ 江部木 +エフク 恵福 +エブクロ 江袋 +エブチ 江渕 +エブチ 江淵 +エブチ 江縁 +エフネ 江舟 +エフミ 江文 +エベ 江部 +エベ 江辺 +エベ 江邊 +エベ 江邉 +エベシ 得可主 +エベシュ 得可主 +エベシュ 恵遍主 +エベス 蛭子 +エベス 胡 +エベス 胡子 +エベス 戎子 +エベノ 江辺野 +エホウ 恵宝 +エボシ 烏星 +エボシ 烏帽子 +エボシ 画星 +エボシ 江星 +エボシ 永星 +エボシ 違星 +エボシ 恵星(惠星) +エボシタ 烏帽子田 +エボシダ 烏帽子田 +エボリ 江堀 +エマ 江間 +エマ 江馬 +エマ 依馬 +エマ 絵馬 +エマ 栄馬 +エマエ 江前 +エマエダ 栄前田 +エマエダ 榮前田 +エマキ 江馬城 +エマキ 江牧 +エマス 栄子 +エマス 榮子 +エマタ 江俣 +エマタ 江又 +エマダ 江間田 +エマチ 江町 +エマツ 江末 +エマツ 江松 +エマル 江丸 +エミ 江見 +エミ 衣斐 +エミ 恵美 +エミ 会見 +エミ 江美 +エミ 惠美 +エミ 恵見(惠見) +エミ 愛水 +エミ 蝦 +エミ 蛦美 +エミサコ 笑迫 +エミサワ 江見澤 +エミス 恵美須 +エミス 恵美酒(惠美酒) +エミス 笑子 +エミズ 江水 +エミチ 江道 +エミツ 枝光 +エミナ 恵美奈 +エミナ 恵味名 +エミハラ 笑原 +エミヤ 江宮 +エミョウ 恵明 +エムカイ 江向 +エムタ 江無田 +エムラ 江村 +エムラ 永村 +エムラ 枝村 +エムラ 栄村 +エムラ 榎村 +エムラ 恵村 +エムラ 江邑 +エムラ 榮村 +エムラ 江邨 +エムラ 惠村 +エムラ 絵村 +エムロ 榎室 +エメン 恵免(惠免) +エモタ 恵茂田 +エモタ 惠茂田 +エモダ 恵茂田 +エモト 榎本 +エモト 江本 +エモト 柄本 +エモト 榎元 +エモト 恵本 +エモト 衛本 +エモト 江元 +エモト 栄元 +エモト 会本(會本) +エモト 荏本 +エモト 絵本 +エモト 恵元 +エモト 惠本 +エモト 衞本 +エモト 画本 +エモト 慧本 +エモト 繪本 +エモト 朴元 +エモリ 江森 +エモリ 江守 +エモリ 榎森 +エモリ 栄森 +エモリ 江盛 +エモリ 会森(會森) +エモリ 衛守 +エモリ 恵森(惠森) +エモリ 恵守(惠守) +エモリ 枝森 +エモリ 榮森 +エモン 衛門 +エモン 絵門 +エヤ 恵谷 +エヤ 惠谷 +エヤ 絵矢 +エヤナギ 絵柳 +エヤナギ 恵柳 +エヤナギ 繪柳 +エヤマ 江山 +エヤマ 恵山(惠山) +エヤマ 榎山 +エラ 江良 +エラ 恵良 +エラ 永来(永來・永耒) +エラ 恵羅(惠羅) +エラ 惠良 +エラ 江羅 +エライ 恵来 +エラキ 江良木 +エラタ 恵良田 +エラタ 惠良田 +エラダ 恵良田 +エラダ 惠良田 +エラトミ 撰富 +エラブ 撰 +エラミ 撰 +エラモト 恵良本 +エリ 江里 +エリ 恵利 +エリ 江利 +エリカク 江利角 +エリカワ 江利川 +エリカワ 襟川 +エリカワ 恵利川(惠利川) +エリカワ 江里川 +エリガワ 江利川 +エリキ 衿木 +エリグチ 江里口 +エリグチ 江利口 +エリグチ 江理口 +エリタ 江利田 +エリタテ 襟立 +エリタテ 衿立 +エリタニ 襟谷 +エリハラ 江里原 +エリモ 撰藻 +エリヤマ 江利山 +エリュウ 江竜 +エリュウ 江龍 +エリュウデン 江竜田 +エリュウデン 江龍田 +エロクマエ 江六前 +エワタリ 江渡 +エン 円 +エン 圓 +エン 役 +エン 演 +エン 自 +エンイチ 円市 +エンイチ 円一 +エンカ 円花 +エンカイ 遠海 +エンカイ 円界 +エンガウチ 円垣内 +エンガウチ 圓垣内 +エンカク 円角 +エンカク 圓角 +エンガク 円角 +エンガク 圓角 +エンカワ 円川 +エンカワ 圓川 +エンカワ 援川 +エンキ 縁記 +エンキ 円木(圓木) +エンキタ 遠北 +エンキョ 円居 +エンギョウ 円行 +エンギョウ 圓行 +エンギョク 円玉 +エンク 円句(圓句) +エンク 圓勺 +エングサ 煙草 +エングチ 円口 +エングチ 圓口 +エンケ 遠家 +エンゲツ 円月(圓月) +エンゴ 江後 +エンコウ 円光 +エンコウ 遠光 +エンコウ 圓光 +エンコウ 縁光 +エンコウ 園光 +エンゴウ 遠郷 +エンコウジ 円光寺 +エンコウジ 圓光寺 +エンゴシ 円越 +エンザ 遠座 +エンザ 円座 +エンサカ 遠坂 +エンサカ 遠阪 +エンザカ 遠坂 +エンザキ 円崎 +エンザキ 遠崎 +エンザキ 圓崎 +エンザキ 煙崎 +エンサコ 遠迫 +エンサツ 円札 +エンサツ 延札 +エンサツ 圓札 +エンザワ 遠沢 +エンザワ 遠澤 +エンジ 槐 +エンジ 円地 +エンジ 圓地 +エンジ 円次 +エンジ 圓次 +エンジツ 円実 +エンジツ 圓實 +エンシャ 塩車 +エンジャク 延尺 +エンシュ 円酒 +エンシュ 圓酒 +エンジュ 槐 +エンジュ 延寿 +エンジュ 延壽 +エンシュウ 遠周 +エンシュウ 遠州 +エンシュウ 遠刕 +エンシュウ 遠劦 +エンジュジ 延寿寺 +エンジュジ 延壽寺 +エンジュドウ 延寿堂(延壽堂) +エンジョ 遠所 +エンショウ 延生 +エンショウ 円生 +エンショウ 圓生 +エンショウ 円正 +エンショウ 延正 +エンジョウ 円城 +エンジョウ 園城 +エンジョウ 遠城 +エンジョウ 円乗 +エンジョウ 遠上 +エンジョウ 円成 +エンジョウ 圓乗(圓乘) +エンジョウ 圓城 +エンジョウ 円浄(圓淨) +エンジョウ 延城 +エンジョウ 圓成 +エンジョウ 煙上 +エンジョウ 円上 +エンジョウ 円淨 +エンジョウ 遠乗 +エンジョウ 圓浄 +エンショウイワ 焔硝岩 +エンショウイワ 焔硝岩 +エンショウジ 燕昇司 +エンショウジ 円生寺 +エンジョウジ 円城寺 +エンジョウジ 圓城寺 +エンジョウジ 遠城寺 +エンジョウジ 円成寺 +エンスイ 円水(圓水) +エンズエ 役末 +エンセキ 煙石 +エンセキ 円石 +エンセキ 園石 +エンセキ 圓石 +エンソ 永曽 +エンソ 円増 +エンソ 園曽 +エンソウ 円増 +エンソウ 延増 +エンソウ 圓増 +エンゾウ 円増 +エンゾウ 延増 +エンゾウ 圓増 +エンタ 塩田 +エンタ 遠田 +エンタ 円田 +エンタ 圓田 +エンダ 塩田 +エンダ 遠田 +エンダ 猿田 +エンダ 円田 +エンダ 圓田 +エンダ 縁田 +エンタイジ 延対寺 +エンダテ 円館 +エンダテ 円舘 +エンダテ 犹館 +エンダテ 犹舘 +エンダテ 犾館 +エンダテ 犾舘 +エンダテ 圓館 +エンダテ 圓舘 +エンタニ 円谷 +エンタニ 圓谷 +エンタニ 遠谷 +エンチ 円地 +エンチ 遠地 +エンチ 圓地 +エンチョウ 円丁 +エンチョウ 閻長 +エンヅ 遠津 +エンツウ 円通 +エンツウ 圓通 +エンツカ 遠塚 +エンツバ 円鍔 +エンツバ 圓鍔 +エント 遠渡 +エンド 猿渡 +エンド 遠渡 +エンド 円戸 +エンド 遠度 +エンド 遠土 +エンド 圓戸 +エンドウ 遠藤 +エンドウ 猿渡 +エンドウ 延藤 +エンドウ 円藤 +エンドウ 円道 +エンドウ 圓藤 +エンドウ 延東 +エンドウ 遠洞 +エンドウ 円堂 +エンドウ 円東 +エンドウ 延堂 +エンドウ 遠堂 +エンドウ 園藤 +エンドウ 薗頭 +エンドウ 園頭 +エンドウ 遠道 +エンドウ 圓道 +エンドウ 淵藤 +エンドウ 藤 +エンドウ 圓東 +エンドウ 圓堂 +エンドウ 渕藤 +エンドウ 園道 +エンドウジ 円道寺 +エンドウジ 圓道寺 +エントミ 円富 +エントミ 圓富 +エンナ 塩冶 +エンナ 塩治 +エンナ 円奈 +エンナ 圓奈 +エンナイ 遠内 +エンナカ 遠中 +エンナミ 円並 +エンナミジ 円並地 +エンナンジ 園南寺 +エンニシ 遠西 +エンニュウ 遠入 +エンニュウ 円入 +エンニュウ 圓入 +エンノ 遠野 +エンノ 役野 +エンノ 円野 +エンノウ 円応 +エンノウジ 円能寺 +エンノウジ 園能寺 +エンノウジ 圓能寺 +エンノコシ 園越 +エンノコシ 圓越 +エンバ 円波 +エンブ 延武 +エンプク 円福 +エンプク 圓福 +エンプクジ 円福寺(圓福寺) +エンブツ 円仏 +エンブツ 圓佛 +エンブツ 円佛 +エンベ 遠部 +エンポ 円保 +エンポウ 円法 +エンホク 遠北 +エンマ 円満 +エンマ 円間 +エンマ 円馬(圓馬) +エンマ 圓満 +エンマチ 円町 +エンマル 円丸(圓丸) +エンマンジ 円満字(圓満字) +エンマンドウ 円満堂 +エンミ 遠見 +エンミ 円見 +エンミ 延味 +エンミ 圓見 +エンミョウ 延明 +エンミョウ 円妙(圓妙) +エンミョウ 圓明 +エンメイ 延命 +エンメイ 延明 +エンメイ 円明 +エンメイ 圓明 +エンメイジ 延命寺 +エンモウ 円毛 +エンモト 延本 +エンモト 円本 +エンモト 縁本 +エンモト 遠本 +エンモト 圓本 +エンヤ 塩谷 +エンヤ 円谷 +エンヤ 塩屋 +エンヤ 猿谷 +エンヤ 塩冶 +エンヤ 圓谷 +エンヤ 遠谷 +エンヤ 縁谷 +エンヤマ 円山 +エンヤマ 圓山 +エンヤマ 縁山 +エンヨ 延与 +エンヨ 延與 +エンヨ 延輿 +エンリ 延利 +エンリ 遠里 +エンリキ 延力 +エンリン 円林 +エンリン 圓林 +エンロ 遠路 +オ 尾 +オアイ 尾合 +オアキ 緒明 +オアケ 緒明 +オアサ 尾朝 +オアシ 小芦 +オアシ 大蘆 +オアシ 尾芦 +オアナ 小穴 +オアリ 尾有 +オイ 小井 +オイ 小居 +オイ 尾井 +オイ 尾居 +オイ 老 +オイイリ 笈入 +オイエ 御家 +オイエ 緒家 +オイエ 小家 +オイエ 大家 +オイエ 追栄(追榮) +オイエ 尾家 +オイエ 老家 +オイカ 小比賀 +オイカケ 笈掛 +オイカケ 追掛 +オイカゼ 追風 +オイカタ 笈方 +オイガタ 生形 +オイカド 負門 +オイカド 老門 +オイガミ 追上 +オイカワ 翁川 +オイカワ 及河 +オイカワ 及川 +オイカワ 笈川 +オイカワ 小井川 +オイカワ 生川 +オイカワ 追川 +オイカワ 乃川 +オイカワ 尾井川 +オイカワ 老川 +オイガワ 小井川 +オイキ 笈木 +オイキ 生木 +オイキ 追木 +オイキ 老木 +オイギ 追着 +オイキリ 追切 +オイグチ 笈口 +オイグチ 追口 +オイクボ 追久保 +オイクボ 老久保 +オイケ 黄池 +オイケ 御池 +オイケ 小池 +オイケ 尾池 +オイコ 老子 +オイゴ 老後 +オイゴ 老子 +オイコシ 追越 +オイゴシ 生越 +オイサカ 追坂 +オイサカ 追阪 +オイサキ 生長 +オイサキ 追崎 +オイサキ 老崎 +オイザキ 追崎 +オイザキ 老崎 +オイサワ 生沢 +オイサワ 生澤 +オイシ 生石 +オイシ 大石 +オイシ 尾石 +オイジ 生地 +オイシオ 生塩 +オイシオ 追塩 +オイシゲ 生繁 +オイシゲ 生茂 +オイスギ 生杉 +オイスギ 追杉 +オイスギ 娚杉 +オイズキ 老月 +オイズミ 小泉 +オイズミ 生泉 +オイズミ 大泉 +オイズミ 追住 +オイズミ 追泉 +オイズミ 尾泉 +オイズミ 老泉 +オイズル 生出 +オイセ 小伊勢 +オイタ 及田 +オイタ 笈田 +オイタ 種田 +オイタ 生田 +オイタ 追田 +オイタ 尾板 +オイタ 老田 +オイダ 笈田 +オイダ 種田 +オイダ 生田 +オイダ 追田 +オイダ 尾井田 +オイダ 老田 +オイタイラ 生平 +オイダイラ 生平 +オイダイラ 追平 +オイダイラ 老平 +オイタカ 生鷹 +オイダキ 追抱 +オイタケ 老竹 +オイタテ 追立 +オイダテ 追立 +オイタニ 及谷 +オイタニ 追谷 +オイタニ 老谷 +オイチ 於市 +オイチ 小市 +オイチ 尾一 +オイチ 尾市 +オイヂ 生地 +オイツカ 追塚 +オイツキ 追着 +オイツキ 老月 +オイヅキ 老月 +オイヅメ 追詰 +オイヅル 生出 +オイヅル 生鶴 +オイテ 追手 +オイデ 小出 +オイデ 生出 +オイデ 尾出 +オイデヅカ 生出塚 +オイデマチ 追出町 +オイデミズ 大出水 +オイド 尾居土 +オイトギ 老伽 +オイドマリ 老泊 +オイトメ 追留 +オイトリ 追鳥 +オイドリ 追鳥 +オイナカ 追中 +オイナカ 老中 +オイナガ 追永 +オイナミ 老浪 +オイニシ 笈西 +オイヌマ 笈沼 +オイヌマ 小井沼 +オイヌマ 生沼 +オイヌマ 追沼 +オイヌマ 老沼 +オイネ 生稲 +オイノ 生野 +オイノ 追野 +オイノ 老野 +オイノショウ 大家庄 +オイノショウ 老野生 +オイノデラ 及野寺 +オイハタ 尾伊端 +オイバタ 尾伊端 +オイバヤシ 追林 +オイバヤシ 老林 +オイハラ 及原 +オイハラ 笈原 +オイハラ 生原 +オイハラ 追原 +オイハラ 老原 +オイハラ 菴原 +オイヒラ 追平 +オイフジ 老藤 +オイマ 老間 +オイマツ 生松 +オイマツ 老松 +オイムラ 追村 +オイムラ 老村 +オイムラ 老邑 +オイモト 追本 +オイモト 老本 +オイモミ 老籾 +オイモリ 及森 +オイヤ 追矢 +オイヤス 於保 +オイヤマ 生山 +オイヤマ 追山 +オイヤマ 老山 +オイラ 御鱗 +オイラ 小鱗 +オイラ 老羅 +オイラセ 追良瀬 +オイリ 笈入 +オイリ 尾入 +オイワ 小岩 +オイワ 尾岩 +オイワケ 追分 +オイワケ 追別 +オウイエ 応家 +オウイエ 應家 +オウインドウ 王隠堂 +オウエ 応江 +オウエ 黄江 +オウエ 尾宇江 +オウエ 尾上 +オウエ 尾植 +オウエ 麻植 +オウエ 應永 +オウエイ 王永 +オウエイ 追栄(追榮) +オウエノキ 大榎 +オウカ 桜花(櫻花) +オウカ 相可 +オウガ 王賀 +オウガ 黄賀 +オウガ 相賀 +オウガタ 應泻 +オウカワ 王川 +オウカワ 応川 +オウキ 王木 +オウキ 黄木 +オウギ 応儀(應儀) +オウギ 黄木 +オウギ 扇 +オウギ 扇喜 +オウギ 扇子 +オウギイシ 扇石 +オウギイチ 扇一 +オウギウラ 扇浦 +オウギクボ 扇久保 +オウギザキ 扇崎 +オウギサワ 扇沢 +オウギサワ 扇澤 +オウギザワ 扇沢 +オウギザワ 扇澤 +オウギシ 往岸 +オウギゾノ 扇園 +オウギゾノ 扇薗 +オウギタ 扇田 +オウギダ 扇田 +オウギタニ 扇谷 +オウギダニ 扇谷 +オウギナリ 扇成 +オウギノ 扇野 +オウギバシ 扇橋 +オウギハタ 扇畑 +オウギハラ 扇原 +オウギフジ 扇藤 +オウギマ 扇間 +オウギマツ 扇松 +オウギモト 扇元 +オウギモト 扇本 +オウギヤ 扇谷 +オウギヤナギ 扇柳 +オウギヤマ 扇山 +オウギワリ 扇割 +オウグ 応供(應供) +オウグ 横供 +オウクラ 往蔵 +オウクラ 往藏 +オウクラ 王鞍 +オウクラ 黄倉 +オウクラ 徃藏 +オウコ 往古 +オウゴ 応後 +オウゴ 横後 +オウゴ 應後 +オウコウ 往光 +オウコウ 徃光 +オウゴウ 黄合 +オウコウチ 大河内 +オウゴシ 生越 +オウゴン 黄金 +オウサカ 逢坂 +オウサカ 逢阪 +オウサキ 応崎 +オウサキ 應崎 +オウサワ 逢澤 +オウサワ 翁沢(翁澤) +オウサワ 応沢 +オウサワ 大澤 +オウサワ 應澤 +オウジ 蔭地 +オウジ 応治 +オウジ 応地 +オウジ 王子 +オウジ 王寺 +オウジ 王地 +オウジ 王治 +オウジ 黄地 +オウジ 尾子 +オウジ 應治 +オウジ 應地 +オウシキ 黄色 +オウシタ 往下 +オウシダ 王子田 +オウジダ 王子田 +オウジタニ 王子谷 +オウシデン 王子田 +オウジノ 王子野 +オウジハタ 王子畑 +オウジヤ 王子谷 +オウシュウ 奥州 +オウシュウヤ 奥州屋 +オウシュウヤ 奥州谷 +オウシュウヤ 奥刕屋 +オウショウ 鴬生 +オウショウ 鶯生 +オウス 大洲 +オウセ 合瀬 +オウセイ 応請 +オウゾウ 王蔵 +オウタ 往田 +オウタ 応田 +オウタ 王田 +オウタ 翁田 +オウタ 黄田 +オウタ 太田 +オウタ 負田 +オウタ 應田 +オウダ 黄田 +オウダ 網田 +オウダ 應田 +オウタカ 王高 +オウタキ 王滝 +オウタケ 応武 +オウタケ 王竹 +オウタケ 奥岳 +オウタケ 大竹 +オウタケ 應武 +オウタニ 応谷 +オウタニ 王谷 +オウタニ 應谷 +オウタン 黄丹 +オウチ 逢地 +オウチ 応地 +オウチ 王地 +オウチ 鴬地 +オウチ 鴬池 +オウチ 黄地 +オウチ 相知 +オウチ 相地 +オウチ 尾内 +オウチ 應地 +オウチ 鶯地 +オウチ 荢内 +オウヂノ 蔭地野 +オウチミネ 応地峯(應地峯) +オウチョウ 横超 +オウチョウ 應長 +オウツカ 王塚 +オウツカ 鴬塚(鶯塚) +オウテ 追手 +オウテキ 青出木 +オウテキ 樗木 +オウデラ 王寺 +オウト 応戸 +オウト 大戸 +オウト 應戸 +オウド 黄土 +オウトウ 応藤 +オウトウ 大藤 +オウドウ 王堂 +オウドウ 大堂 +オウトウナイ 王藤内 +オウトモ 黄友 +オウトリ 大鳥 +オウナカ 大仲 +オウナガ 往長 +オウナガ 応長 +オウナガ 翁長 +オウニシ 往西 +オウニシ 応西 +オウニシ 大西 +オウニシ 徃西 +オウニシ 應西 +オウノ 逢野 +オウノ 応野 +オウノ 王野 +オウノ 黄野 +オウノ 負野 +オウバ 応葉 +オウバ 横場 +オウバ 桜庭 +オウバ 大場 +オウハシ 大橋 +オウハタ 王畑 +オウハタ 大畑 +オウハラ 応原 +オウハラ 王原 +オウハラ 應原 +オウハリ 大針 +オウバン 黄幡 +オウビ 王尾 +オウヒラ 応平 +オウヒラ 應平 +オウマ 合馬 +オウマエ 応前 +オウマエ 王前 +オウマエ 黄前 +オウマエ 大前 +オウマル 王丸 +オウミ 近江 +オウミ 青海 +オウミ 逢見 +オウミ 近見 +オウミ 黄海 +オウミ 近美 +オウミ 淡海 +オウミ 尾海 +オウミ 王見 +オウミ 応海 +オウミ 王海 +オウミガワ 近江川 +オウミキシ 近江岸 +オウミギシ 近江岸 +オウミゾノ 近江園 +オウミダ 近江田 +オウミタニ 近江谷 +オウミト 近江戸 +オウミド 近江戸 +オウミヤ 近江屋 +オウミヤ 近江谷 +オウムラ 翁村 +オウムラ 黄村 +オウムラ 大村 +オウメ 青梅 +オウモト 応本 +オウモト 王本 +オウモト 應本 +オウモリ 王森 +オウモリ 大森 +オウヤ 往谷 +オウヤ 応矢 +オウヤ 雄谷 +オウヤ 應矢 +オウヤマ 黄山 +オウラ 小浦 +オウラ 小裏 +オウラ 尾浦 +オウラ 邑楽(邑樂) +オウライ 往頼 +オウライ 生頼 +オウリ 応利(應利) +オウリク 往陸(徃陸) +オウリョウジ 押領司 +オウリョウジ 押領寺 +オウリョウジ 横領司 +オウリン 翁林 +オウルマ 小漆間 +オウロ 王路 +オウワ 応和 +オウワ 應和 +オウワシ 王鷲 +オエ 小江 +オエ 尾栄 +オエ 尾絵 +オエ 尾江 +オエ 麻植 +オエダ 尾枝 +オエヅカ 麻植塚 +オオ 大 +オオアイ 大愛 +オオアイ 大饗 +オオアイラ 大姶良 +オオアエ 大饗 +オオアカミ 大赤見 +オオアキ 大秋 +オオアキ 大明 +オオアク 大阿久 +オオアケ 大明 +オオアサ 大浅 +オオアサ 大朝 +オオアサ 大麻 +オオアサ 大淺 +オオアサダ 大浅田 +オオアシ 大葦 +オオアシ 大芦 +オオアシ 大足 +オオアシ 大蘆 +オオアゼチ 大畔地 +オオアタリ 大当 +オオアタリ 大當 +オオアト 大跡 +オオアナ 大穴 +オオアミ 大阿見 +オオアミ 大網 +オオアラ 大荒 +オオアライ 大新井 +オオアラカキ 大新垣 +オオアラシ 大嵐 +オオアラタ 大荒田 +オオアラダ 大荒田 +オオアリ 大有 +オオアレ 大荒 +オオアワ 太粟 +オオアワ 大粟 +オオイ 越猪 +オオイ 押井 +オオイ 多井 +オオイ 多飯 +オオイ 大伊 +オオイ 大威 +オオイ 大井 +オオイ 大居 +オオイ 大炊 +オオイ 大鋳(大鑄) +オオイ 大飯 +オオイ 太井 +オオイ 夛井 +オオイエ 大家 +オオイエ 大宅 +オオイカダ 大筏 +オオイカリ 大碇 +オオイカワ 大井川 +オオイガワ 大井川 +オオイケ 太池 +オオイケ 大池 +オオイケベ 大池辺 +オオイシ 太石 +オオイシ 大巌 +オオイシ 大石 +オオイシ 大歴 +オオイシ 大礰 +オオイシグロ 大石黒 +オオイシダ 大石田 +オオイシダイラ 大石平 +オオイシネ 大石根 +オオイシバシ 大石橋 +オオイシハラ 大石原 +オオイシモト 大石本 +オオイズ 大井津 +オオイズミ 大泉 +オオイズミ 大和泉 +オオイソ 大磯 +オオイソ 大礒 +オオイゾノ 大井園 +オオイタ 大板 +オオイタ 大分 +オオイダ 大井田 +オオイダ 大飯田 +オオイチ 大市 +オオイツ 大逸 +オオイヅ 大井津 +オオイヅミ 大泉 +オオイデ 大井手 +オオイデ 大井出 +オオイデ 大出 +オオイデミズ 大出水 +オオイト 大𣽾 +オオイド 大井戸 +オオイネ 大稲 +オオイノウエ 大井上 +オオイノミカド 大炊御門 +オオイマ 大今 +オオイミカド 大炊御門 +オオイモ 大芋 +オオイヤ 大井屋 +オオイヤマ 大井山 +オオイラ 大鱗 +オオイリ 大入 +オオイワ 大岩 +オオイワ 大磐 +オオイワカワ 大岩川 +オオイワガワ 大岩川 +オオイワザコ 大岩迫 +オオイワネ 大岩根 +オオイワモト 大岩本 +オオイン 大印 +オオウエ 王植 +オオウエ 太上 +オオウエ 大上 +オオウエ 大植 +オオウエノ 大上野 +オオウオ 大魚 +オオウシ 大牛 +オオウジ 大氏 +オオウス 大臼 +オオウス 大薄 +オオウタ 大歌 +オオウチ 太内 +オオウチ 大打 +オオウチ 大内 +オオウチクラ 大内蔵(大内藏) +オオウチダ 太内田 +オオウチダ 大内田 +オオウチヤマ 大内山 +オオウネ 大宇根 +オオウネ 大畦 +オオウミ 大海 +オオウメ 大梅 +オオウラ 太裏 +オオウラ 大浦 +オオウラ 大裏 +オオウラカタ 大浦方 +オオウラサカ 大浦坂 +オオウラザカ 大浦坂 +オオウラジ 大浦地 +オオウラチ 大浦地 +オオエ 応永 +オオエ 応江 +オオエ 黄江 +オオエ 小江 +オオエ 太江 +オオエ 大栄 +オオエ 大永 +オオエ 大衛 +オオエ 大家 +オオエ 大恵 +オオエ 大戸 +オオエ 大工 +オオエ 大江 +オオエ 大宅 +オオエ 大得 +オオエ 大柄 +オオエ 大惠 +オオエ 大榮 +オオエ 追栄(追榮) +オオエ 應永 +オオエ 䯨 +オオエキ 大溢 +オオエキ 大益 +オオエキ 大駅 +オオエキ 大江喜 +オオエキ 大浴 +オオエキ 大驛 +オオエキ 大﨏 +オオエキ 大嶧(大𡵸) +オオエキ 大塧 +オオエダ 太江田 +オオエダ 太枝 +オオエダ 大榎田 +オオエダ 大恵田(大惠田) +オオエダ 大江田 +オオエダ 大枝 +オオエダ 大条 +オオエダ 大條 +オオエネ 大柄根 +オオエノキ 大榎 +オオエノキ 大榎木 +オオエノショウ 大家庄 +オオエハラ 大江原 +オオエビス 大胡 +オオエビス 大戎 +オオエヤマ 大江山 +オオオカ 大岡 +オオオカ 大丘 +オオオカ 大尾嘉 +オオオキ 大置 +オオオク 大奥 +オオオケ 大桶 +オオオサ 大長 +オオオト 大音 +オオオモテ 大表 +オオオリ 大折 +オオカ 相可 +オオカ 大岡 +オオカ 大加 +オオカ 大可 +オオカ 大嘉 +オオカ 大家 +オオカ 大賀 +オオカ 大尾嘉 +オオカ 尾岡 +オオガ 王賀 +オオガ 黄賀 +オオガ 太神 +オオガ 大我 +オオガ 大賀 +オオガ 大鋸 +オオガ 大神 +オオガ 尾家 +オオガ 鉅鹿 +オオカイ 大海 +オオガイ 大海 +オオガイ 大開 +オオガイ 大貝 +オオガイ 大飼 +オオガイ 大谷 +オオガイチ 大涯地 +オオガイチ 大涯池 +オオカイド 大海渡 +オオガイト 大海戸 +オオガイト 大垣内 +オオカキ 大柿 +オオガキ 大垣 +オオガキ 大柿 +オオガキ 大墻 +オオガキウチ 大垣内 +オオカク 大格 +オオカク 大角 +オオガク 大角 +オオガク 大額 +オオカクチ 大角地 +オオカケ 大欠 +オオカゲ 大蔭 +オオカゲ 大陰 +オオカゲ 大影 +オオカゲ 大景 +オオガケ 大掛 +オオガケ 大欠 +オオガケ 大懸 +オオカゴ 大篭 +オオカゴ 大籠 +オオガサ 大笠 +オオカシ 大柏 +オオカジ 大梶 +オオカジ 大鍛治 +オオカジ 大鍛冶 +オオカジ 大楫 +オオカジ 大鍜治 +オオガシ 大賀志 +オオガシ 大樫 +オオガシマ 大ケ島 +オオガシラ 大頭 +オオカシワ 大柏 +オオカズ 大数 +オオカセ 大加瀬 +オオカゼ 大風 +オオガセ 大ケ瀬 +オオカタ 大嘉田 +オオカタ 大形 +オオカタ 大片 +オオカタ 大方 +オオカダ 大加田 +オオカダ 大嘉田 +オオガタ 応潟 +オオガタ 大加田 +オオガタ 大潟 +オオガタ 大形 +オオガタ 大県 +オオガタ 大方 +オオガタ 大縣 +オオガタ 應潟 +オオガタ 應泻 +オオカチ 大勝 +オオカツ 大勝 +オオカド 多門 +オオカド 大加戸 +オオカド 大角 +オオカド 大門 +オオカヌカ 大鹿糠 +オオカネ 大金 +オオカネ 大兼 +オオカネ 大鐘 +オオガネ 大金 +オオガネ 大兼 +オオガネ 大鐘 +オオカネク 大兼久 +オオガネク 大兼久 +オオカネマサ 大兼政 +オオカバ 大椛 +オオカバ 大蒲 +オオカハラ 大河原 +オオカブ 大株 +オオカベ 大壁 +オオカマ 大釜 +オオカマ 大鎌 +オオガマ 大竃 +オオガマ 大釜 +オオガマ 大鎌 +オオガマエ 大構 +オオカミ 太神 +オオカミ 大上 +オオカミ 大神 +オオカミ 狼 +オオガミ 太神 +オオガミ 大賀美 +オオガミ 大上 +オオガミ 大神 +オオガミ 大狼 +オオカミダニ 狼谷 +オオカミド 大上戸 +オオカメ 大亀 +オオガメ 大亀 +オオガメ 大瓶 +オオカモ 大加茂 +オオカモ 大鴨 +オオカヤ 大栢 +オオカヤ 大萱 +オオガヤ 大ケ谷 +オオガヤ 大栢 +オオガヤ 大萱 +オオガヤ 大柏 +オオガヤチ 大ケ谷内 +オオガユ 大ケ生 +オオガユ 大萱生 +オオガユウ 大萱生 +オオガラ 大柄 +オオガラス 大烏 +オオガラネ 大柄根 +オオガリ 大狩 +オオカル 大軽 +オオガル 大軽 +オオカワ 太河 +オオカワ 太川 +オオカワ 大河 +オオカワ 大生川 +オオカワ 大川 +オオガワ 大川 +オオカワイ 大川井 +オオカワウチ 大河内 +オオカワウチ 大川内 +オオカワグチ 大川口 +オオカワチ 大河内 +オオカワチ 大川内 +オオカワツ 大河津 +オオカワヅ 大川津 +オオカワト 大川戸 +オオカワド 大河戸 +オオカワド 大川戸 +オオカワバタ 大河端 +オオカワバタ 大川端 +オオカワバタ 大川畑 +オオカワハラ 大河原 +オオカワハラ 大川原 +オオカワヒラ 大川平 +オオカワムカイ 大川向 +オオカワモト 大川本 +オオカワラ 大河原 +オオカワラ 大川原 +オオカワラ 大瓦 +オオガワラ 大河原 +オオガワラ 大川原 +オオガワラ 大瓦 +オオカンダ 大神田 +オオガンナ 大鉙 +オオガンマル 大鴈丸(大雁丸) +オオキ 王城 +オオキ 黄木 +オオキ 多木 +オオキ 太木 +オオキ 大喜 +オオキ 大岐 +オオキ 大機 +オオキ 大気 +オオキ 大起 +オオキ 大鬼 +オオキ 大亀 +オオキ 大樹 +オオキ 大城 +オオキ 大木 +オオキ 大来(大來) +オオキ 大氣 +オオキ 大耒 +オオギ 応儀(應儀) +オオギ 黄木 +オオギ 仰木 +オオギ 正親 +オオギ 扇 +オオギ 扇喜 +オオギ 扇子 +オオギ 多木 +オオギ 大岐 +オオギ 大儀 +オオギ 大樹 +オオギ 大城 +オオギ 大木 +オオギ 大来(大來) +オオギイチ 扇一 +オオギウラ 扇浦 +オオギク 大菊 +オオギクボ 扇久保 +オオギザキ 扇崎 +オオギサコ 扇迫 +オオギサワ 扇沢 +オオギサワ 扇澤 +オオギザワ 扇澤 +オオキシ 大岸 +オオギシ 往岸 +オオギシ 大岸 +オオキシタ 大木下 +オオギシバ 扇芝 +オオキシマ 大木島 +オオキジマ 大木島 +オオギシマ 扇島 +オオキス 大木須 +オオギゾノ 扇園 +オオギゾノ 扇薗 +オオキタ 大喜多(大喜夛) +オオキタ 大喜太 +オオキタ 大喜田 +オオキタ 大北 +オオキタ 大木田 +オオキタ 大来(大來) +オオキタ 大来田 +オオキダ 大木田 +オオギタ 扇田 +オオギタ 大喜多(大喜夛) +オオギタ 大儀田 +オオギタ 大北 +オオギダ 扇田 +オオギダイラ 扇平 +オオキタニ 大木谷 +オオギタニ 扇谷 +オオギタニ 大城谷 +オオギダニ 扇谷 +オオギツカ 扇塚 +オオギヅカ 扇塚 +オオキデ 大木手 +オオキド 大喜戸 +オオキド 大城戸 +オオキド 大木戸 +オオギドノ 扇殿 +オオギナリ 扇成 +オオギノ 扇野 +オオギノ 大木野 +オオキバ 大牙 +オオキバ 大木場 +オオキバ 大木葉 +オオギバシ 扇橋 +オオキハタ 大木畑 +オオギハタ 扇畑 +オオギハタ 大木畑 +オオキハラ 大木原 +オオギハラ 扇原 +オオギフジ 扇藤 +オオギマス 扇増 +オオギマチ 正親町 +オオギミ 正親 +オオギミ 大儀見 +オオギミ 大宜見 +オオギミ 大宜味 +オオギミ 大宣見 +オオキモト 大木本 +オオギモト 扇元 +オオギモト 扇本 +オオギモト 大木元 +オオギヤ 扇屋 +オオギヤ 扇舎 +オオギヤ 扇谷 +オオギヤ 大木谷 +オオギヤナギ 扇柳 +オオキヤマ 大木山 +オオギヤマ 仰山 +オオギヤマ 扇山 +オオキュウ 大給 +オオギュウ 大牛 +オオキヨ 大城代 +オオギリ 大桐 +オオギリ 大切 +オオギワリ 扇割 +オオク 大久 +オオク 大九 +オオク 大句 +オオク 大工 +オオグ 大具 +オオグエ 大崩 +オオクゴ 大国護 +オオクゴ 大國護 +オオクサ 大久佐 +オオクサ 大草 +オオクサ 大日 +オオクサ 大艸 +オオグサ 大草 +オオグサ 大艸 +オオクシ 大串 +オオクシ 大櫛 +オオグシ 大串 +オオグシ 大櫛 +オオグシ 大梙 +オオクス 大楠 +オオクズ 大葛 +オオグス 大楠 +オオクダ 大久田 +オオクチ 大口 +オオグチ 大口 +オオクツ 大久津 +オオクツ 大窟 +オオクナ 大久奈 +オオクニ 大国 +オオクニ 大國 +オオグニ 大国 +オオグニ 大國 +オオクニタニ 大国谷(大國谷) +オオクニダニ 大国谷(大國谷) +オオクヌギ 大椚 +オオクネ 大久根 +オオクノ 大久農 +オオクノ 大久野 +オオクハラ 大久原 +オオクビ 大首 +オオクボ 太久保 +オオクボ 大久保 +オオクボ 大窪 +オオクボ 大工保 +オオクマ 大久間 +オオクマ 大熊 +オオクマ 大隈 +オオクマ 大隩 +オオグマ 大熊 +オオグマ 大隈 +オオクミ 大組 +オオクメ 大粂 +オオクモ 大雲 +オオクモ 大蜘蛛 +オオクラ 往蔵 +オオクラ 王鞍 +オオクラ 王蔵 +オオクラ 黄倉 +オオクラ 仰倉 +オオクラ 大庫 +オオクラ 大倉 +オオクラ 大蔵 +オオクラ 大内蔵(大内藏) +オオクラ 大藏 +オオクラ 大庾 +オオクラノ 大倉野 +オオクリ 大久利 +オオクリ 大栗 +オオクリ 大厨 +オオグリ 大久利 +オオグリ 大栗 +オオクリタ 大栗田 +オオクリダ 大栗田 +オオグルマ 大車 +オオクレ 大暮 +オオクロ 大黒 +オオクロ 大畔 +オオグロ 大黒 +オオグロ 大畔 +オオクロダ 大黒田 +オオグロヤ 大黒屋 +オオクワ 大桑 +オオクワ 大鍬 +オオクワ 大𥸮 +オオケ 大桶 +オオケ 大家 +オオケ 大毛 +オオケ 尾毛 +オオゲ 大削 +オオゲ 大毛 +オオケイ 大慶 +オオケヤ 大家谷 +オオコ 往古 +オオコ 大古 +オオコ 大庫 +オオコ 大湖 +オオコ 大胡 +オオコ 大子 +オオゴ 応後 +オオゴ 大箇 +オオゴ 大期 +オオゴ 大古 +オオゴ 大庫 +オオゴ 大湖 +オオゴ 大胡 +オオゴ 大後 +オオゴ 淡河 +オオコイデ 大小出 +オオコウ 大河 +オオコウ 大后 +オオコウ 大浩 +オオコウ 大鴻 +オオゴウ 黄合 +オオゴウ 大郷 +オオコウゲ 大高下 +オオコウジ 大河内 +オオコウジ 大糀 +オオコウジ 大小路 +オオコウチ 大河内 +オオコウチ 大川内 +オオコウチ 大古知 +オオコウチ 大高知 +オオコウチ 凡河内 +オオコウチ 大銧地 +オオゴウチ 大河内 +オオコウツ 大河津 +オオコウヅ 大河津 +オオコウド 大河戸 +オオゴエ 大越 +オオゴエ 大峠 +オオコガ 大古閑 +オオコシ 大越 +オオコシ 大腰 +オオゴシ 生越 +オオゴシ 大越 +オオゴシ 大腰 +オオコジマ 大小島 +オオコシヤ 大越谷 +オオコセ 大古瀬 +オオコセ 大小瀬 +オオコゼ 大小瀬 +オオゴセ 大古瀬 +オオコソ 大社 +オオコタ 大古田 +オオコタ 大小田 +オオコダ 大古田 +オオコダ 大湖田 +オオコダ 大胡田 +オオコダ 大小田 +オオゴタ 大子田 +オオゴダ 大古田 +オオゴダ 大胡田 +オオコチ 大古知 +オオゴチ 大越智 +オオコバ 大古場 +オオコバ 大木場 +オオコハラ 大小原 +オオコボリ 大小堀 +オオコマ 大駒 +オオコミ 大込 +オオゴメ 大込 +オオゴモ 大菰 +オオコモリ 大小森 +オオコモリ 大籠 +オオゴモリ 大篭 +オオゴモリ 大籠 +オオコリ 大古利 +オオコン 大紺 +オオゴン 黄金 +オオサ 大佐 +オオザ 大座 +オオサイ 大財 +オオザイ 大在 +オオザイ 大財 +オオザイケ 大在家 +オオサオ 大棹 +オオサカ 逢坂 +オオサカ 逢阪 +オオサカ 大幸 +オオサカ 大坂 +オオサカ 大阪 +オオサガ 大佐賀 +オオサカイ 大境 +オオサカイ 大堺 +オオサカイ 大酒井 +オオサカエ 大栄 +オオサカエ 大榮 +オオサカキ 大榊 +オオサカシタ 大坂下 +オオサカタ 大坂田 +オオサカタニ 大阪谷 +オオサカダニ 大阪谷 +オオサカベ 逢坂部 +オオサカベ 大坂部 +オオサカマ 大坂間 +オオサカマ 大阪間 +オオサガミ 大相模 +オオサカヤ 大坂屋 +オオサカヤ 大坂家 +オオサカヤ 大坂谷 +オオサカヤ 大阪屋 +オオサカヤ 大阪谷 +オオサキ 応崎 +オオサキ 大咲 +オオサキ 大崎 +オオサキ 大埼 +オオサキ 大先 +オオサキ 大前 +オオサキ 大嵜 +オオサギ 大鷺 +オオザキ 應崎 +オオザキ 大崎 +オオザキ 大嵜 +オオサク 大作 +オオサク 大迫 +オオザクラ 大桜 +オオザクラ 大櫻 +オオサケ 大酒 +オオサコ 大廻(大廽) +オオサコ 大佐古 +オオサコ 大砂 +オオサコ 大砂古 +オオサコ 大窄 +オオサコ 大追 +オオサコ 大迫 +オオサコ 大硲 +オオサコ 大浴 +オオサコ 大峪 +オオサコ 大﨏 +オオサコ 大廹 +オオサゴ 大砂 +オオササ 大佐々 +オオササ 大笹 +オオザサ 大笹 +オオサシ 大指 +オオサダ 大佐田 +オオサダ 大貞 +オオサダ 大定 +オオサチ 大幸 +オオサト 大郷 +オオサト 大里 +オオザト 大里 +オオザハタ 大坐畠 +オオザハタ 大座畑 +オオサメ 大鮫 +オオサラ 大皿 +オオサラカワ 大皿川 +オオサワ 太澤(太沢) +オオサワ 大佐和 +オオサワ 大沢 +オオサワ 大澤 +オオザワ 大沢 +オオザワ 大澤 +オオサワグチ 大沢口 +オオサワグチ 大澤口 +オオサワダ 大沢田 +オオサワツ 大沢津 +オオサワツ 大澤津 +オオジ 蔭地 +オオジ 陰地 +オオジ 応治 +オオジ 応地 +オオジ 王地 +オオジ 太路 +オオジ 大司 +オオジ 大子 +オオジ 大字 +オオジ 大治 +オオジ 大地 +オオジ 大路 +オオジ 尾子 +オオジ 應治 +オオシオ 太汐 +オオシオ 大塩(大鹽) +オオシオ 大汐 +オオシオ 大潮 +オオシカ 大鹿 +オオシガ 大志賀 +オオジキ 大敷 +オオシゲ 大重 +オオシゲ 大繁 +オオシゲ 大茂 +オオジケ 大地家 +オオシコ 生石子 +オオシタ 往下 +オオシタ 太下 +オオシタ 大下 +オオシタ 大志多 +オオシタ 大舌 +オオシダ 王子田 +オオシダ 大志多 +オオシダ 大志田 +オオシダ 大信田 +オオシタナイ 大下内 +オオシタミ 大志民 +オオシダミ 大志民 +オオシタモト 大下本 +オオシデン 王子田 +オオシナ 大科 +オオシナバタケ 大品畑 +オオシナバタケ 大品畠 +オオシノ 大志野 +オオシノ 大篠 +オオジノ 蔭地野 +オオジノ 陰地野 +オオジノ 王子野 +オオシバ 大柴 +オオシバ 大芝 +オオジハラ 大地原 +オオシホ 大志保 +オオシマ 王島 +オオシマ 巨島 +オオシマ 相島 +オオシマ 太島 +オオシマ 太嶋 +オオシマ 大志摩 +オオシマ 大志磨 +オオシマ 大志万 +オオシマ 大紫磨 +オオシマ 大島 +オオシマ 大嶋 +オオシマ 大嶌 +オオシマ 大嶹 +オオシマ 大隝 +オオシマタニ 大島谷 +オオシマダニ 大島谷 +オオシマヤ 大島屋 +オオシマン 大志万 +オオジミ 大慈弥 +オオジミ 大慈彌 +オオシミズ 大清水 +オオシメ 大注連 +オオシモ 大下 +オオシモ 大下毛 +オオシモ 大志茂 +オオシモ 大霜 +オオシモウラ 大下浦 +オオシモダ 大下田 +オオジモト 大地本 +オオジヤ 王子谷 +オオシャク 大杓 +オオジャラ 大舍羅(大舎羅) +オオシュウ 大集 +オオシュウド 大水戸 +オオシュウヤ 奥洲屋 +オオジュク 大宿 +オオショウ 大正 +オオショウ 大生 +オオショウジ 大小路 +オオショウジ 大庄司 +オオショウジ 大正路 +オオジョウボウ 大乗坊 +オオジリ 大尻 +オオシロ 王城 +オオシロ 太白 +オオシロ 大城 +オオシロ 大代 +オオシロ 大白 +オオシン 王新 +オオシン 大新 +オオジン 大新 +オオジン 大神 +オオシンダイ 王身代 +オオシンデン 大新田 +オオス 大洲 +オオス 大須 +オオス 大酢 +オオス 大 +オオズ 巨津 +オオズ 大州 +オオズ 大洲 +オオズ 大図 +オオズ 大頭 +オオズ 大圖 +オオスエ 大末 +オオスカ 大砂賀 +オオスカ 大須加 +オオスカ 大須賀 +オオスカ 大数加 +オオスカ 大数賀 +オオスガ 大管 +オオスガ 大砂賀 +オオスガ 大寿賀 +オオスガ 大須賀 +オオスガ 大菅 +オオスガ 大壽賀 +オオスキ 大漉 +オオスキ 大薄 +オオスギ 大杉 +オオスギ 大椙 +オオズキ 小槻 +オオスギタニ 大杉谷 +オオスゲ 大菅 +オオスジ 大筋 +オオズシ 大辻子 +オオスズ 大鈴 +オオスダ 大須田 +オオスナ 大砂 +オオスミ 太隅 +オオスミ 大角 +オオスミ 大偶 +オオスミ 大隅 +オオスミ 大寿美 +オオスミ 大住 +オオスミ 大数見 +オオスミ 大澄 +オオスミ 大炭 +オオスミ 大墨 +オオスミ 大壽美 +オオズミ 大住 +オオスミチ 大角地 +オオスミモト 大住元 +オオズヨリ 大豆寄 +オオズル 大水流 +オオセ 生越 +オオセ 大瀬 +オオセ 大畝 +オオセ 大勢 +オオセ 大背 +オオセ 合瀬 +オオセキ 大関 +オオセキ 大席 +オオセギ 大瀬木 +オオゼキ 大堰 +オオゼキ 大関 +オオゼキ 大磧 +オオゼキ 大關 +オオセコ 大迫 +オオゼコ 大世古 +オオセザカ 大瀬坂 +オオセツ 大節 +オオセト 大施戸 +オオセト 大世戸 +オオセト 大世渡 +オオセト 大瀬戸 +オオセト 大勢登 +オオセト 大脊戸 +オオセト 大背戸 +オオセド 大後 +オオセド 大後戸 +オオセド 大世戸 +オオセド 大世渡 +オオセド 大瀬音 +オオセド 大瀬戸 +オオセド 大勢登 +オオセド 大脊戸 +オオセド 大背戸 +オオセマチ 大勢待 +オオセモチ 大勢持 +オオセラ 大瀬良 +オオゼラ 大瀬良 +オオセント 大船人 +オオソ 大曾 +オオソ 大曽 +オオソイ 大副 +オオソウ 大宗 +オオゾウ 王蔵 +オオゾウ 大造 +オオゾエ 大副 +オオソコ 大底 +オオソネ 大曾根 +オオソネ 大曽根 +オオソネ 大祖根 +オオソネ 大埇 +オオゾネ 大曾根 +オオゾネ 大曽根 +オオソノ 大園 +オオソノ 大薗 +オオゾノ 大園 +オオゾノ 大薗 +オオゾノ 大囿 +オオソラ 大空 +オオゾラ 大空 +オオゾラ 霄 +オオソリ 大曽利 +オオタ 往田 +オオタ 応田 +オオタ 王田 +オオタ 翁田 +オオタ 黄田 +オオタ 巨田 +オオタ 多田 +オオタ 太多 +オオタ 太駄 +オオタ 太田 +オオタ 大多 +オオタ 大太 +オオタ 大田 +オオタ 大夛 +オオタ 應田 +オオダ 黄田 +オオダ 太駄 +オオダ 太田 +オオダ 大駄 +オオダ 苧田 +オオダ 網田 +オオダ 荢田 +オオタイ 太田井 +オオタイ 大鯛 +オオダイ 大代 +オオダイ 大台 +オオダイ 大平 +オオダイ 大臺 +オオタイシ 大泰司 +オオタイシ 大田石 +オオタイラ 大平 +オオダイラ 大平 +オオタオ 太田尾 +オオタオ 大多尾 +オオタオ 大田尾 +オオタオ 大峠 +オオタオ 大垰 +オオタカ 太高 +オオタカ 大高 +オオタカ 大嵩 +オオタカ 大鷹 +オオタカ 大雄 +オオタカ 大隆 +オオタガ 大多賀(大夛賀) +オオダカ 大高 +オオタカキ 大高木 +オオタガキ 太田垣 +オオタガキ 大田垣 +オオタガサ 大田笠 +オオタカサカ 大高坂 +オオタカラ 大財 +オオタカラ 大宝 +オオタカラ 大寶 +オオタカラ 大寳 +オオタガワ 太田川 +オオタガワ 大田川 +オオタキ 王滝 +オオタキ 王瀧 +オオタキ 太田喜 +オオタキ 大多喜 +オオタキ 大多氣 +オオタキ 大滝 +オオタキ 大瀧 +オオタキ 大田喜 +オオタキ 大田木 +オオタキ 大焚 +オオタキ 大竜 +オオタギリ 太田桐 +オオタギリ 大田桐 +オオタク 大宅 +オオタグチ 太田口 +オオタグチ 大田口 +オオタクミ 大工 +オオタグロ 太田黒 +オオタグロ 大田黒 +オオタケ 応武 +オオタケ 太竹 +オオタケ 太田家 +オオタケ 大岳 +オオタケ 大獄 +オオタケ 大嵩 +オオタケ 大竹 +オオタケ 大武 +オオタケ 大嶽 +オオタケ 應武 +オオダケ 大岳 +オオダケ 大嵩 +オオダケ 大嶽 +オオタケグチ 大竹口 +オオタケノ 大竹野 +オオタケヤマ 大竹山 +オオタゴシ 太田越 +オオタゴシ 大田越 +オオタジマ 太田島 +オオタジマ 太田嶋 +オオタジリ 太田尻 +オオタシロ 太田代 +オオタシロ 大田代 +オオタセ 太田瀬 +オオタダ 大多田 +オオタダ 大忠 +オオタダ 大夛田 +オオタチ 大舘 +オオタチ 大刀 +オオタチ 大立 +オオダチ 大館 +オオダチ 大舘 +オオダチ 大建 +オオダチ 大太刀 +オオダチ 大達 +オオダチ 大刀 +オオダチ 大立 +オオタチカワ 大立川 +オオタチメ 大立目 +オオダチメ 大立目 +オオタツ 大達 +オオタツ 大辰 +オオタツメ 大立目 +オオタテ 大楯 +オオタテ 大立 +オオダテ 大館 +オオダテ 大舘 +オオダテ 大健(大徤) +オオダテ 大建 +オオダテ 大達 +オオダテ 大楯 +オオダテ 大立 +オオタテメ 大立目 +オオタナ 大棚 +オオタナカ 太田中 +オオタナカ 大田中 +オオタニ 庵谷 +オオタニ 応谷 +オオタニ 王谷 +オオタニ 太谷 +オオタニ 太田児 +オオタニ 大澗 +オオタニ 大渓 +オオタニ 大多新 +オオタニ 大谷 +オオタニ 大尾谷 +オオタニ 大湲 +オオタニ 大溪 +オオタニ 大谿 +オオタニ 應谷 +オオタニウチ 大谷内 +オオタニガワ 大谷川 +オオタニヤ 大谷矢 +オオタノ 太田野 +オオタハラ 太田原 +オオタハラ 大田原 +オオタバラ 太田原 +オオタバラ 大田原 +オオダハラ 大田原 +オオタビ 大給 +オオタブ 大椨 +オオタベ 太田部 +オオタベ 大田部 +オオタマ 大玉 +オオダマ 大玉 +オオダマリ 大溜 +オオタミ 太田見 +オオタミ 大田見 +オオタモト 大田本 +オオタヤ 太田屋 +オオタヤ 大田屋 +オオタラ 太田良 +オオタラ 大多良 +オオタル 大樽 +オオタワ 太多和 +オオタワ 太田和 +オオタワ 大多和 +オオタワ 大田和 +オオタワ 大峠 +オオタワ 大垰 +オオタワ 大夛和 +オオタワ 大乢 +オオダワ 大田和 +オオタワラ 太田原 +オオタワラ 大田原 +オオタワラ 大俵 +オオダワラ 大俵 +オオタン 黄丹 +オオダン 大段 +オオチ 逢地 +オオチ 応地 +オオチ 王地 +オオチ 黄地 +オオチ 相知 +オオチ 大知 +オオチ 大地 +オオチ 大智 +オオチ 大池 +オオチ 百千 +オオチ 凡内 +オオチ 邑智 +オオチ 應地 +オオチ 凢 +オオチ 凢内 +オオヂ 蔭地 +オオチカ 大近 +オオチガワ 大地川 +オオチク 大築 +オオチダ 大地田 +オオヂノ 蔭地野 +オオチハラ 大地原 +オオチミネ 応地峰 +オオチミネ 応地峯(應地峯) +オオチャ 大茶 +オオチヤマ 大地山 +オオチョウ 大重 +オオチョウ 大蝶 +オオチョウ 大長 +オオチョウ 大鳥 +オオチリ 大塵 +オオチリ 大千里 +オオチリ 大知里 +オオツ 王津 +オオツ 大ツ +オオツ 大津 +オオツ 大都 +オオツ 苧津 +オオツ 荢津 +オオヅ 巨津 +オオツイ 大対 +オオツイ 大對 +オオツエ 大杖 +オオツカ 王塚 +オオツカ 太塚 +オオツカ 大握 +オオツカ 大束 +オオツカ 大津加 +オオツカ 大津家 +オオツカ 大津賀 +オオツカ 大塚 +オオツカ 大墳 +オオツカ 大柄 +オオツカ 大務 +オオツカ 大冢 +オオツガ 大津賀 +オオヅカ 大塚 +オオツカサ 大司 +オオツキ 王月 +オオツキ 大規 +オオツキ 大月 +オオツキ 大嵩崎 +オオツキ 大即 +オオツキ 大築 +オオツキ 大津奇 +オオツキ 大津寄 +オオツキ 大津木 +オオツキ 大槻 +オオツキ 大都城 +オオツキ 大付 +オオツキ 大附 +オオツキ 大搗 +オオツキ 大朏 +オオツギ 大継 +オオツギ 大次 +オオツク 大津久 +オオツグ 大継 +オオツケ 大附 +オオヅケ 大附 +オオツジ 大辻 +オオツジ 大逵 +オオヅシ 大図子 +オオツジコ 大辻子 +オオツタ 大蔦 +オオツダ 大津田 +オオツタニ 大津谷 +オオツダニ 大津谷 +オオツチ 大槌 +オオツチ 大土 +オオヅチ 大槌 +オオツヂコ 大辻子 +オオツチハシ 大土橋 +オオツチバシ 大土橋 +オオツチヤ 大土谷 +オオヅツ 大筒 +オオツツミ 大堤 +オオツヅミ 大鼓 +オオヅツミ 大堤 +オオツナ 大綱 +オオツネ 大常 +オオツノ 大角 +オオヅノ 大角 +オオツバ 大鍔 +オオツバキ 大椿 +オオツブライ 大粒来(大粒來) +オオツボ 大坪 +オオツボ 大壷 +オオツボ 大壺 +オオツマ 大妻 +オオツミ 大積 +オオツヤ 大艶 +オオツヤ 大津屋 +オオツヤ 大津谷 +オオツヤマ 大津山 +オオツラ 大面 +オオツル 大津留(大津畄) +オオツル 大鶴 +オオヅル 大水流 +オオヅル 大鶴 +オオツワ 大津輪 +オオテ 応手(應手) +オオテ 大健(大徤) +オオテ 大手 +オオデ 逢出 +オオデ 大出 +オオテキ 大手木 +オオテキ 樗木 +オオデミズ 大出水 +オオテヤマ 大手山 +オオテラ 大寺 +オオデラ 大寺 +オオデラオトシ 大平落 +オオデラヤ 大寺屋 +オオテル 大輝 +オオテル 大照 +オオト 応戸 +オオト 大音 +オオト 大戸 +オオト 大渡 +オオト 大登 +オオト 大都 +オオト 網戸 +オオト 應戸 +オオド 大音 +オオド 大戸 +オオド 大土 +オオトイ 押樋 +オオトイ 大戸井 +オオトイ 大樋 +オオドイ 大戸井 +オオドイ 大土井 +オオドイ 大土居 +オオトウ 大唐 +オオトウ 大塔 +オオトウ 大東 +オオトウ 大当 +オオトウ 大筒 +オオトウ 大藤 +オオトウ 大當 +オオドウ 大藤 +オオドウ 大堂 +オオドウ 大洞 +オオドウ 大幢 +オオトウゲ 大峠 +オオトウワ 大東和 +オオトオゲ 大峠 +オオトク 大徳 +オオトコ 大床 +オオドコ 大床 +オオトザコ 大戸迫 +オオトシ 大音師 +オオトシ 大歳 +オオトシ 大年 +オオトシ 大稔 +オオトシ 大利 +オオドシ 大年 +オオトチ 大栃 +オオドチ 大栩 +オオドテ 大土手 +オオトナリ 大隣 +オオドナリ 大隣 +オオトネ 大刀禰 +オオトネ 大刀祢 +オオトノ 大殿 +オオトバ 大鳥羽 +オオトビ 大飛 +オオトマ 大苫 +オオトマ 大笘 +オオトマリ 大泊 +オオドマリ 大泊 +オオトミ 大臣 +オオトミ 大富 +オオトミ 大冨 +オオドミ 大富 +オオトメ 大留 +オオトモ 王供 +オオトモ 大供 +オオトモ 大知 +オオトモ 大朝 +オオトモ 大塘 +オオトモ 大巴 +オオトモ 大伴 +オオトモ 大判 +オオトモ 大朋 +オオトモ 大友 +オオトモ 大鞆 +オオドモ 大塘 +オオトヤ 大戸谷 +オオトヨ 大豊 +オオトリ 鴻 +オオトリ 大取 +オオトリ 大鳥 +オオトリ 大酉 +オオトリ 大捕 +オオトリ 大鳳 +オオトリ 大雄 +オオトリ 鳳 +オオトリイ 大鳥井 +オオトリイ 大鳥居 +オオドロ 大土呂 +オオドンチ 大殿内 +オオドンチ 大鈍内 +オオトンベ 大富部 +オオトンベ 大冨部 +オオナ 大那 +オオナ 大名 +オオナエ 大苗 +オオナカ 太中 +オオナカ 大中 +オオナカ 大仲 +オオナガ 往長 +オオナガ 大永 +オオナガ 大長 +オオナカダ 大中田 +オオナカド 大名門 +オオナカドウ 大中道 +オオナカトミ 大中臣 +オオナガネ 大長根 +オオナカハラ 大中原 +オオナガミツ 大長光 +オオナギ 大扱 +オオナギ 大椛 +オオナギ 大梛 +オオナギ 大椰 +オオナギ 大极 +オオナスカワ 大茄子川 +オオナダ 大灘 +オオナベ 大鍋 +オオナミ 大南 +オオナミ 大波 +オオナミ 大浪 +オオナミ 涛(濤) +オオナラ 大奈良 +オオナラ 大楢 +オオナリ 大成 +オオナル 大成 +オオナル 大鳴 +オオナロ 大奈路 +オオナワ 太縄 +オオナワ 大縄 +オオナワ 大繩 +オオナワシロ 大苗代 +オオナワバシ 大縄橋 +オオニ 大荷 +オオニ 大仁 +オオニウ 大丹生 +オオニゴ 大仁後 +オオニシ 往西 +オオニシ 応西 +オオニシ 太西 +オオニシ 大西 +オオニシキ 大錦 +オオニタ 大仁田 +オオニダ 大仁田 +オオニュウ 大丹生 +オオニョ 大如 +オオニワ 大庭 +オオヌイ 大縫 +オオヌカ 大額 +オオヌキ 太貫 +オオヌキ 大貫 +オオヌキ 大抜 +オオヌキ 大拔 +オオヌキ 大樌 +オオヌシ 大主 +オオヌマ 大沼 +オオヌマタ 大沼田 +オオネ 大音 +オオネ 大根 +オオネ 大禰 +オオネ 大祢 +オオネ 蔔 +オオネガワ 大根川 +オオネギ 大祢宜 +オオネザカ 大根坂 +オオネザワ 大根沢 +オオネタ 大根田 +オオネダ 大根田 +オオネハラ 大根原 +オオネヤ 大根谷 +オオノ 逢野 +オオノ 粟野 +オオノ 王野 +オオノ 黄野 +オオノ 多 +オオノ 大埜 +オオノ 大濃 +オオノ 大能 +オオノ 大納 +オオノ 大野 +オオノ 大墅 +オオノ 大𡌛 +オオノ 尾々野 +オオノウ 大能 +オオノウ 大納 +オオノウエ 大ノ上 +オオノウチ 大野内 +オオノガミ 大野上 +オオノカワ 大野川 +オオノガワ 大野川 +オオノキ 大ノ木 +オオノキ 大軒 +オオノキ 大之木 +オオノキ 大野木 +オオノキ 大檐 +オオノギ 大之木 +オオノギ 大野木 +オオノコ 大鋸 +オオノサワ 大野沢 +オオノサワ 大野澤 +オオノシ 大熨 +オオノセ 大野瀬 +オオノタ 大野田 +オオノダ 大野田 +オオノダン 大野段 +オオノハラ 大野原 +オオノヒラ 大野平 +オオノブ 大信 +オオノボリ 大昇 +オオノボリ 大登 +オオノマ 大埜間 +オオノミ 大呑 +オオノミ 大鑿 +オオノモト 大野本 +オオノヤ 大野屋 +オオノヤ 大野谷 +オオノヤマ 大野山 +オオノリ 大矩 +オオノリ 大乗 +オオノリ 大範 +オオノリ 大法 +オオノロ 大野呂 +オオハ 大羽 +オオハ 大葉 +オオバ 横場 +オオバ 太場(太塲) +オオバ 大羽 +オオバ 大峡 +オオバ 大饗 +オオバ 大歯 +オオバ 大場 +オオバ 大庭 +オオバ 大波 +オオバ 大馬 +オオバ 大硲 +オオバ 大葉 +オオバ 大挾 +オオバ 大塲 +オオバ 大峽 +オオバ 雄場 +オオバイ 大梅 +オオバイ 大売 +オオバエ 大生 +オオハガ 大羽賀 +オオハガ 大芳賀 +オオハギ 大萩 +オオハク 大伯 +オオハコ 大箱 +オオバコ 大箱 +オオバサキ 大馬崎 +オオハザマ 大峡 +オオハザマ 大狭 +オオハザマ 大狭間(大狹間) +オオハザマ 大硲 +オオハザマ 大峽 +オオハザマ 大狹 +オオバサミ 大狹 +オオバサワ 大羽沢 +オオバサワ 大羽澤 +オオバザワ 大羽沢 +オオバザワ 大羽澤 +オオバザワ 大場沢(大場澤) +オオハシ 大橋 +オオハシ 大箸 +オオハシ 大梁 +オオハシ 大枦 +オオハシ 大槁 +オオハシバ 大橋場 +オオハシラ 大柱 +オオバシラ 大柱 +オオハス 大蓮 +オオハセ 大葉勢 +オオハゼ 大枦 +オオハゼ 大櫨 +オオハタ 王畑 +オオハタ 太幡 +オオハタ 太畑 +オオハタ 大羽田 +オオハタ 大旗 +オオハタ 大秦 +オオハタ 大泰 +オオハタ 大端 +オオハタ 大波多(大波夛) +オオハタ 大幡 +オオハタ 大畑 +オオハタ 大畠 +オオハタ 大圃 +オオハタ 大葉田 +オオハタ 大幢 +オオハタ 大籏(大簱) +オオハタ 大疁 +オオバタ 大端 +オオバタ 大幡 +オオバタ 大畑 +オオバタ 大畠 +オオハタケ 大畑 +オオバタケ 大庭竹 +オオバタケ 大畑 +オオバタケ 大畠 +オオハタヤ 大畑谷 +オオハタヤ 大畠谷 +オオハチ 大鉢 +オオハナ 大花 +オオハナ 大鼻 +オオハナモリ 大花森 +オオハニ 大埴 +オオハバ 大巾 +オオハバ 大幅 +オオハマ 大浜 +オオハマ 大濱 +オオハマザキ 大浜崎 +オオハマザキ 大濱崎 +オオハヤ 大早 +オオバヤシ 大林 +オオハヤタ 大早田 +オオハラ 王原 +オオハラ 太原 +オオハラ 大原 +オオハラ 大腹 +オオハラ 邑原 +オオハラセキ 大原関 +オオハラゼキ 大原関 +オオハラダ 大原田 +オオハリ 大針 +オオハリ 大張 +オオハリ 大播 +オオバリ 大針 +オオバリ 大張 +オオハル 大治 +オオハル 大春 +オオバン 黄幡 +オオバン 大幡 +オオバン 大伴 +オオバン 大判 +オオバン 大番 +オオハンバ 大半場 +オオバンヤ 大番屋 +オオヒ 大日 +オオヒ 大樋 +オオビ 王尾 +オオビ 黄尾 +オオビ 大備 +オオヒエ 大比叡 +オオビカ 大比賀 +オオヒカゲ 大日陰 +オオヒガシ 大東 +オオヒカタ 大日方 +オオヒガタ 大日方 +オオヒガタ 大否方 +オオビキ 大引 +オオヒゲ 大髭 +オオヒサ 大久 +オオビシ 大菱池 +オオヒタ 大日田 +オオヒダ 大日田 +オオヒタ 大比田 +オオヒツ 大櫃 +オオビツ 大櫃 +オオヒト 大人 +オオヒトカタ 大人形 +オオヒトガタ 大人形 +オオヒナ 大日南 +オオヒナタ 大日向 +オオヒナタ 大日方 +オオビナタ 大日向 +オオヒノ 大日野 +オオヒラ 応平 +オオヒラ 太平 +オオヒラ 大衡 +オオヒラ 大比羅 +オオヒラ 大比良 +オオヒラ 大平 +オオヒラ 大平落 +オオヒラ 覆平 +オオヒライ 大平井 +オオヒラオトシ 大平落 +オオヒラキ 大開 +オオビラキ 大開 +オオヒラノ 大平野 +オオヒラハラ 大平原 +オオヒラバラ 大平原 +オオヒラバル 大平原 +オオヒロ 大広 +オオヒロ 大廣 +オオブ 大生 +オオブ 大武 +オオブ 大部 +オオフカ 大深 +オオブカ 大深 +オオブキ 大吹 +オオフク 大福 +オオブク 大福 +オオフクジ 大福地 +オオフクタニ 大福谷 +オオフクダニ 大福谷 +オオフクチ 大福地 +オオフクネ 大福根 +オオフケ 大更 +オオフサ 大総 +オオフサ 大房 +オオフサ 大總 +オオフジ 太藤 +オオフジ 大藤 +オオブシ 大伏 +オオフチ 大淵 +オオフチ 大渕 +オオブチ 大淵 +オオブチ 大渕 +オオフチワキ 大淵脇 +オオフチワキ 大渕脇 +オオフデ 大筆 +オオフナキ 大舟木 +オオフネ 大舟 +オオフネ 大船 +オオフネ 大舩 +オオフル 大古 +オオフルタ 大古田 +オオフルト 大古戸 +オオフルトノ 大古殿 +オオフルドノ 大古殿 +オオフルトン 大古殿 +オオベ 大部 +オオベ 大辺 +オオベ 大邊 +オオベ 大邉 +オオベップ 大別府 +オオホ 大保 +オオホ 大甫 +オオホ 大穂 +オオホ 大穗 +オオボ 大保 +オオボ 大甫 +オオボ 大穂 +オオボウ 大坊 +オオボウ 大帽 +オオボキ 大保木 +オオホコ 大保古 +オオホシ 大星 +オオボシ 大星 +オオボソ 大細 +オオホソダ 大細田 +オオホド 大程 +オオホラ 大洞 +オオボラ 大洞 +オオホリ 大掘 +オオホリ 大堀 +オオボリ 大堀 +オオマ 合馬 +オオマ 大澗 +オオマ 大間 +オオマ 大馬 +オオマ 大磨 +オオマイ 大米 +オオマエ 大前 +オオマエ 尾前 +オオマエ 王前 +オオマエ 黄前 +オオマエ 太前 +オオマエダ 大豆生田 +オオマガリ 大曲 +オオマキ 太巻 +オオマキ 大巻 +オオマキ 大蒔 +オオマキ 大牧 +オオマキ 大槙 +オオマキ 大槇 +オオマサ 大政 +オオマサ 大正 +オオマス 大益 +オオマス 大升 +オオマス 大舛 +オオマス 大増 +オオマス 大桝 +オオマス 大枡 +オオマタ 大股 +オオマタ 大叉 +オオマタ 大亦 +オオマタ 大俣 +オオマタ 大又 +オオマチ 太町 +オオマチ 大間知 +オオマチ 大待 +オオマチ 大町 +オオマチダ 大町田 +オオマツ 大松 +オオマツザキ 大松崎 +オオマツザワ 大松沢 +オオマツザワ 大松澤 +オオマツダニ 大松谷 +オオマトイ 大纒(大纏) +オオママ 大間々 +オオマミウダ 大豆生田 +オオマミュウダ 大豆生田 +オオマメ 大豆 +オオマメウダ 大豆生田 +オオマメタ 大豆田 +オオマメダ 大豆生田 +オオマメダ 大豆田 +オオマヤ 大厩 +オオマヤ 大广邪 +オオマヤ 大廐 +オオマユ 大眉 +オオマル 王丸 +オオマル 大丸 +オオマワタリ 大馬渡 +オオマワリ 大廻(大廽) +オオミ 逢見 +オオミ 王見 +オオミ 巨海 +オオミ 近江 +オオミ 近美 +オオミ 青海 +オオミ 大海 +オオミ 大観 +オオミ 大見 +オオミ 大己 +オオミ 大御 +オオミ 大江 +オオミ 大三 +オオミ 大参 +オオミ 大美 +オオミ 大味 +オオミ 大巳 +オオミ 大箕 +オオミ 淡海 +オオミ 淤見 +オオミカ 大亀 +オオミカ 大美賀 +オオミカ 大甕 +オオミガ 大美賀 +オオミカド 大御門 +オオミカワ 青海川 +オオミカワ 大見川 +オオミカワ 大三川 +オオミガワ 近江川 +オオミガワ 青海川 +オオミギシ 近江岸 +オオミサキ 大岬 +オオミザワ 近江沢 +オオミシマ 大三島 +オオミシャ 大見謝 +オオミジャ 大見謝 +オオミズ 大水 +オオミゾ 大溝 +オオミゾノ 近江園 +オオミダ 近江田 +オオミチ 大通 +オオミチ 大道 +オオミチ 大路 +オオミツ 大光 +オオミツ 大満 +オオミド 近江戸 +オオミドウ 大御堂 +オオミドリ 大緑 +オオミナト 大港 +オオミナト 大湊 +オオミナミ 大南 +オオミナミ 大美浪 +オオミネ 大峰 +オオミネ 大峯 +オオミネ 大嶺 +オオミモト 大見本 +オオミヤ 逢見谷 +オオミヤ 近江屋 +オオミヤ 近江谷 +オオミヤ 近江矢 +オオミヤ 大宮 +オオミヤ 大光明 +オオミヤ 大美屋 +オオミヤ 大味谷 +オオミヤジ 大宮地 +オオミヤジ 大宮路 +オオミヤマ 大宮山 +オオミヤマ 大見山 +オオミョウ 大名 +オオミワ 大三輪 +オオミワ 大三和 +オオムカイ 大迎 +オオムカイ 大向 +オオムカイ 大向井 +オオムカエ 大迎 +オオムカエ 大向江 +オオムキ 大向 +オオムギ 大麦 +オオムク 大椋 +オオムシ 大虫 +オオムタ 大無田 +オオムタ 大牟田 +オオムチ 大鞭 +オオムネ 大宗 +オオムネ 大棟 +オオムラ 大村 +オオムラ 尾村 +オオムラ 太村 +オオムラ 大邑 +オオムラ 大邨 +オオムラ 黄村 +オオムラ 澳 +オオムラサキ 大紫 +オオムラジ 大連 +オオムラタ 大村田 +オオムラヤ 大村谷 +オオムレ 大群 +オオムレ 大牟礼 +オオムレ 大牟禮 +オオムロ 大室 +オオメ 青梅 +オオメ 太目 +オオメ 大目 +オオメキ 大目木 +オオメギ 大目木 +オオメグリ 大廻(大廽) +オオモ 大雲 +オオモ 大面 +オオモ 大茂 +オオモチ 大持 +オオモツ 大物 +オオモト 応本 +オオモト 王本 +オオモト 大基 +オオモト 大許 +オオモト 大元 +オオモト 大本 +オオモト 應本 +オオモミ 大樅 +オオモモ 大桃 +オオモヤ 大茂谷 +オオモヤ 大茂矢 +オオモリ 大守 +オオモリ 大森 +オオモリ 大盛 +オオモリ 大毛利 +オオモリ 大漏 +オオモリ 亰守 +オオモン 大門 +オオヤ 応矢 +オオヤ 王家 +オオヤ 巨谷 +オオヤ 君家 +オオヤ 小宅 +オオヤ 相宅 +オオヤ 太屋 +オオヤ 太宅 +オオヤ 太谷 +オオヤ 大屋 +オオヤ 大家 +オオヤ 大舘 +オオヤ 大舎 +オオヤ 大箭 +オオヤ 大宅 +オオヤ 大谷 +オオヤ 大爺 +オオヤ 大弥 +オオヤ 大矢 +オオヤ 尾家 +オオヤ 雄谷 +オオヤ 應矢 +オオヤイズ 大柳豆 +オオヤウチ 大谷内 +オオヤウチ 大矢内 +オオヤギ 大谷木 +オオヤギ 大八木 +オオヤギ 大矢木 +オオヤギ 大柳 +オオヤギュウ 大柳生 +オオヤケ 公受 +オオヤケ 公宅 +オオヤケ 大宅 +オオヤサコ 大家迫 +オオヤシキ 大屋敷 +オオヤシキ 大屋舗 +オオヤシキ 大屋鋪 +オオヤショウ 大家庄 +オオヤス 太安 +オオヤス 大安 +オオヤス 大保 +オオヤチ 大谷地 +オオヤチ 大谷内 +オオヤチ 大矢知 +オオヤチゴ 大八児 +オオヤツ 大谷津 +オオヤド 大屋戸 +オオヤド 大宿 +オオヤナイ 大谷内 +オオヤナイ 大矢内 +オオヤナギ 大柳 +オオヤネ 大屋根 +オオヤネ 大谷根 +オオヤネ 大矢根 +オオヤノ 大矢野 +オオヤバ 大矢場 +オオヤブ 大薮 +オオヤブ 大篁 +オオヤブ 大籔 +オオヤブ 大藪 +オオヤベ 大屋部 +オオヤベ 大谷部 +オオヤベ 大矢部 +オオヤマ 逢山 +オオヤマ 黄山 +オオヤマ 太山 +オオヤマ 大山 +オオヤマアラレ 大山霰 +オオヤマグチ 大山口 +オオヤマダ 大山田 +オオヤモリ 大谷守 +オオヤリ 大鎗 +オオユ 大湯 +オオユ 大柚 +オオユキ 大幸 +オオユキ 大行 +オオユキ 大雪 +オオユノキ 大柚木 +オオユミ 大弓 +オオユミカワ 大弓川 +オオユリ 大柚利 +オオユリ 大由利 +オオユリ 大由里 +オオヨ 大代 +オオヨウ 大用 +オオヨケ 大除 +オオヨコ 大横 +オオヨコタ 大横田 +オオヨシ 大吉 +オオヨシ 大好 +オオヨシ 大善 +オオヨシ 大良 +オオヨシ 大葭 +オオヨシハラ 大吉原 +オオヨシハラ 大葭原 +オオヨシハラ 大葮原 +オオヨセ 大寄 +オオヨド 大淀 +オオヨネ 大米 +オオヨリ 大依 +オオヨリ 大寄 +オオラ 大羅 +オオラ 大良 +オオラ 邑楽(邑樂) +オオライ 往頼 +オオライ 生頼 +オオライ 大来(大來) +オオライ 徃頼 +オオラギ 大来帰 +オオラク 大楽 +オオリ 大利 +オオリ 大理 +オオリョウ 大漁 +オオリョウジ 押領司 +オオリョウジ 押領寺 +オオリン 翁林 +オオルイ 大累 +オオルイ 大類 +オオレイ 大礼 +オオレイ 大禮 +オオロ 王路 +オオロ 大呂 +オオロク 大録 +オオワ 応和 +オオワ 大輪 +オオワ 大和 +オオワ 應和 +オオワイ 大饗 +オオワカ 大若 +オオワキ 大和貴 +オオワキ 大脇 +オオワク 大和久 +オオワシ 王鷲 +オオワシ 大鷲 +オオワシ 大鵰 +オオワセ 大和瀬 +オオワタ 大和田 +オオワダ 大輪田 +オオワダ 大和多 +オオワダ 大和田 +オオワタシ 大渡 +オオワダノ 大和田野 +オオワタリ 大渡 +オオワチ 大和地 +オオワニ 大鰐 +オオワヤマ 大和山 +オオワラ 大童 +オオワリ 大割 +オオワン 大湾 +オカ 阿 +オカ 隠家 +オカ 遠香 +オカ 岡 +オカ 岳 +オカ 丘 +オカ 皐 +オカ 尾加 +オカ 尾家 +オカ 阜 +オカ 陸 +オガ 遠賀 +オガ 緒賀 +オガ 小賀 +オガ 大鋸 +オガ 男鹿 +オガ 尾賀 +オガ 雄鹿 +オカアキ 岡明 +オカアミ 岡阿弥 +オカアミ 岡阿彌 +オカイ 岡井 +オカイ 岡居 +オカイ 丘井 +オカイ 小粥 +オガイ 小貝 +オガイ 小粥 +オガイ 都谷 +オガイ 尾ケ井 +オカイエ 岡家 +オカイシ 岡石 +オカイズミ 岡泉 +オカイタニ 岡井谷 +オカイダニ 岡井谷 +オカイチ 岡一 +オカイチ 岡市 +オカイリ 岡入 +オカウエ 岡上 +オカウエ 岡植 +オカウエ 岳上 +オカウジ 岡氏 +オカウチ 岡内 +オガウチ 小河内 +オガウチ 小ケ内 +オガウチ 王垣内 +オカウマ 岡馬 +オカウラ 岡浦 +オカウラ 岡裏 +オカエ 岡恵 +オカエ 岡江 +オカエダ 岡枝 +オカエビス 岡胡 +オカエリ 魚返 +オガエリ 魚返 +オカオ 岡尾 +オカオク 岡奥 +オカオト 岡音 +オカガ 岡賀 +オカガイト 岡垣内 +オカガキ 岡垣 +オカガキ 岡墻 +オカガキウチ 岡垣内 +オカガケ 岡掛 +オカガシラ 岡頭 +オカガタ 岡片 +オカガタ 岡方 +オカカド 岡門 +オカガミ 岡上 +オカガワ 岡河 +オカガワ 岡川 +オカキ 岡木 +オカギ 岡城 +オカギ 岡木 +オカギ 陵木 +オガキ 緒垣 +オガキ 小垣 +オガキ 小柿 +オガキ 小恒 +オガキ 尾垣 +オガキ 尾柿 +オガキウチ 尾垣内 +オカギシ 岡岸 +オカキタ 岡北 +オガキハラ 小垣原 +オカク 御角 +オカク 尾角 +オカグチ 岡口 +オガクチ 大垣内 +オガグチ 大我口 +オガグチ 尾ケ口 +オカクボ 岡久保 +オカクラ 岡倉 +オガクラ 小ケ倉 +オカゲ 尾陰 +オカゲン 岡元 +オカコ 岡固 +オカコイ 御囲 +オカゴウチ 岡垣内 +オカコシ 岡越 +オカコシ 岡腰 +オカゴシ 岡越 +オカサ 岡佐 +オカザ 岡座 +オガサ 小笠 +オカサカ 岡坂 +オカサカ 岡阪 +オガサカ 小賀坂 +オカサキ 岡咲 +オカサキ 岡崎 +オカサキ 岡嵜 +オカザキ 岡咲 +オカザキ 岡崎 +オカザキ 岡先 +オカザキ 岡岬 +オカザキ 岡嵜 +オカザキ 岳崎 +オカザキ 丘咲 +オカザキ 丘崎 +オカザキ 崗崎 +オガサキ 尾ケ崎 +オカサコ 岡佐古 +オカサコ 岡迫 +オカザコ 岡迫 +オカサダ 岡貞 +オカサト 岡里 +オカザト 岡里 +オガサハラ 小笠原 +オカサワ 岡澤 +オカザワ 岡沢 +オカザワ 岡澤 +オカザワ 丘沢(丘澤) +オガサワラ 小笠原 +オカジ 岡司 +オカジ 岡持 +オカジ 岡治 +オカジ 岡地 +オカジ 岡路 +オカジ 尾梶 +オカシゲ 岡重 +オカシタ 岡下 +オカシマ 岡島 +オカシマ 丘島 +オカジマ 岡蔦 +オカジマ 岡島 +オカジマ 岡嶋 +オカジマ 岡嶌 +オカジマ 丘島 +オガシマ 小ケ嶋 +オガシマ 小鹿島 +オカシモ 岡下 +オカショ 岡所 +オカジョ 岡所 +オカジョウ 岡上 +オカジョウ 岡丈 +オカジョウ 岡城 +オカジョウ 岡条(岡條) +オガシラ 尾頭 +オカシロ 岡城 +オカシロ 陵城 +オガシワ 小柏 +オガシワ 尾柏 +オカシン 岡新 +オカス 岡寿(岡壽) +オカス 岡須 +オカズ 岡頭 +オカスジ 岡筋 +オカスミ 岡隅 +オカズミ 岡角 +オカズミ 岡住 +オカズミ 岡積 +オカズミ 岡澄 +オカセ 岡瀬 +オカセ 岡世 +オカセ 岡勢 +オカゼ 小風 +オカゼ 尾風 +オガセ 尾ケ瀬 +オカセコ 岡迫 +オカセリ 岡芹 +オカゼリ 岡芹 +オカゾエ 岡添 +オカゾエ 岡副 +オカソト 岡外 +オカゾノ 岡園 +オカゾノ 岡薗 +オカソラ 岡空 +オカタ 大形 +オカダ 岡多 +オカダ 岡太 +オカダ 岡田 +オカダ 岡朶 +オカダ 岳田 +オカダ 丘太 +オカダ 丘田 +オガタ 於方 +オガタ 御賀多 +オガタ 緒形 +オガタ 緒方 +オガタ 小賀田 +オガタ 小潟 +オガタ 小形 +オガタ 小懸 +オガタ 小県 +オガタ 小肩 +オガタ 小片 +オガタ 小方 +オガタ 小瀉 +オガタ 小縣 +オガタ 織方 +オガタ 生形 +オガタ 生方 +オガタ 大神田 +オガタ 猪方 +オガタ 尾賀田 +オガタ 尾潟(尾泻) +オガタ 尾形 +オガタ 尾県 +オガタ 尾刃 +オガタ 尾刀 +オガタ 尾片 +オガタ 尾方 +オガタ 尾瀉 +オガタ 尾縣 +オガタ 雄賀多 +オガタ 纓片 +オカダイ 岡代 +オカダイラ 岡平 +オカダウエ 岡田上 +オカタオ 岡峠 +オカタオ 岡垰 +オカダオ 岡垰 +オカダガイト 岡田垣内 +オカダカゲ 岡田蔭 +オカタキ 岡滝 +オカタキ 岡瀧 +オカタク 岡宅 +オカタケ 岡竹 +オカタケ 岡武 +オカタニ 岡谷 +オカダニ 岡谷 +オカダヤ 岡田屋 +オカダヤ 岡田谷 +オガタヤ 小形谷 +オカダン 岡段 +オカチ 岡地 +オカヂ 岡地 +オガチ 小勝 +オカチョウ 岡長 +オカツ 岡津 +オカツ 緒勝 +オカツ 尾勝 +オカツ 雄勝 +オガツ 小勝 +オカヅエ 岡杖 +オカツカ 岡塚 +オカヅカ 岡塚 +オカツギ 岡次 +オカヅキ 岡月 +オカツジ 岡辻 +オカヅミ 岡積 +オカテ 岡手 +オカデ 岡出 +オカテラ 岡寺 +オカデラ 岡寺 +オカト 岡戸 +オカト 岡登 +オカト 岡都 +オカド 岡戸 +オカド 岡土 +オカド 小門 +オカド 尾角 +オカド 尾門 +オカド 雄門 +オカドイ 岡土居 +オカトウ 岡東 +オカトウ 岡頭 +オカドウ 岡堂 +オカドコロ 岡所 +オカドノ 岡殿 +オカトミ 岡富 +オカトミ 岡冨 +オカトメ 岡留 +オカドメ 岡留 +オカナ 岡那 +オカナ 岡名 +オガナ 尾加名 +オカナカ 岡中 +オカナカ 岡仲 +オカナガ 岡永 +オカナミ 岡南 +オカナミ 岡波 +オカナミ 岡並 +オカナミ 岡浪 +オカナリ 岡成 +オカナン 岡南 +オカニシ 岡西 +オカニシ 陸西 +オカニワ 岡庭 +オカヌシ 岡主 +オカヌマ 岡沼 +オカネ 岡根 +オガネ 尾金 +オガネ 尾兼 +オガネザワ 尾金沢 +オカネヤ 岡根谷 +オカノ 岡埜 +オカノ 岡野 +オカノ 岡𡌛 +オカノ 丘野 +オカノ 小神埜 +オカノ 小神野 +オガノ 小賀野 +オガノ 小鹿野 +オガノ 小彼 +オカノイチ 岡野一 +オカノウ 岡納 +オカノウエ 岡ノ上 +オカノウエ 岡上 +オカノウエ 岡之上 +オカノウエ 岡野上 +オカノウチ 岡野内 +オカノギ 岡野城 +オカノシタ 岡之下 +オカノジョウ 岡野定 +オカノタニ 岡ノ谷 +オカノハラ 岡野原 +オカノブ 岡信 +オカノボリ 岡登 +オカノボル 岡登 +オカノモト 岡野本 +オカノヤ 岡ノ谷 +オカノヤ 岡の谷 +オカノヤ 岡谷 +オカノヤ 岡埜谷 +オカノヤ 岡野屋 +オカノヤ 岡野谷 +オカバ 岡羽 +オカバ 岡場 +オカバ 岡馬 +オカハシ 岡橋 +オカハシ 岡槁 +オカハタ 岡畑 +オカハタ 岡畠 +オカバタ 岡端 +オカバタ 岡畑 +オガハタ 小河畑 +オカバタケ 岡畠 +オカハナ 岡花 +オカハナ 岡端 +オカハナ 岡鼻 +オカバナ 岡花 +オカバナ 岡鼻 +オカハマ 岡浜(岡濱) +オカバヤシ 岡林 +オカハラ 岡原 +オカハラ 岳原 +オカハラ 丘原 +オカバラ 岡原 +オガハラ 小河原 +オガハラ 小鹿原 +オガハラ 小川原 +オガハラ 尾賀原 +オガハラ 尾川原 +オカヒサ 岡久 +オカヒラ 岡平 +オカヒロ 岡広 +オカヒロ 岡弘 +オカヒロ 岡廣 +オカフク 岡福 +オカフジ 岡藤 +オカフジ 岡籐 +オカブチ 岡淵 +オカブチ 岡渕 +オカブロ 岡風呂 +オカベ 岡部 +オカベ 岡辺 +オカベ 岡邊 +オカベ 岡邉 +オカベ 小加部 +オカベ 小壁 +オカベ 陸辺 +オカベップ 岡別府 +オカホ 岡保 +オカボウ 岡坊 +オカボウ 岡防 +オカホリ 岡堀 +オカボリ 岡堀 +オガマ 小蒲 +オガマ 小釜 +オガマ 小鎌 +オガマ 尾釜 +オカマエ 岡前 +オカマキ 岡巻 +オカマサ 岡政 +オカマサ 岡正 +オカマス 岡増 +オカマス 岡桝 +オカマチ 岡町 +オカマツ 岡松 +オカマツ 泰松 +オカマツ 阜松 +オカマル 岡丸 +オカマワリ 岡廻 +オカミ 岡見 +オカミ 岡実 +オガミ 小上 +オガミ 小神 +オガミ 男神 +オガミ 尾守 +オガミ 尾上 +オガミ 尾神 +オガミ 雄上 +オカミズ 岡水 +オカミチ 岡道 +オカミツ 岡光 +オカミネ 岡峰 +オカミネ 岡峯 +オガミノ 小神埜 +オガミノ 小神野 +オカミヤ 岡宮 +オカミョウ 岡明 +オカムカイ 岡向 +オカムネ 岡宗 +オカムネ 岡棟 +オカムラ 岡村 +オカムラ 岡邑 +オカムラ 岡邨 +オカムラ 丘村 +オガムラ 大鋸村 +オカムロ 岡室 +オカムロ 岳室 +オカメ 尾亀 +オガメ 尾亀 +オカモ 岡茂 +オガモ 小鴨 +オカモチ 岡持 +オカモト 岡基 +オカモト 岡元 +オカモト 岡源 +オカモト 岡本 +オカモト 岳元 +オカモト 丘元 +オカモト 丘本 +オカモト 崗本 +オカモト 陵本 +オガモト 鋸本 +オガモト 大鋸本 +オカモトタニ 岡本谷 +オカモトダニ 岡本谷 +オカモリ 岡守 +オカモリ 岡森 +オカヤ 岡屋 +オカヤ 岡谷 +オカヤ 岡矢 +オガヤ 鋸屋 +オガヤ 鋸谷 +オガヤ 小ケ谷 +オガヤ 小栢 +オガヤ 小萱 +オガヤ 大栢 +オガヤ 大鋸谷 +オガヤ 男鹿谷 +オガヤ 尾栢 +オカヤウチ 岡谷内 +オカヤシキ 岡屋敷 +オカヤス 岡安 +オカヤス 岡保 +オカヤチ 岡谷内 +オカヤナギ 岡柳 +オカヤマ 岡山 +オカヤマ 岳山 +オカヤマ 丘山 +オカヤマ 阜山 +オガヤマ 小鹿山 +オカヤマシタ 岡山下 +オカユ 小粥 +オガユ 小粥 +オカヨシ 岡吉 +オカリ 岡利 +オカリ 岡里 +オカワ 岡輪 +オカワ 小河 +オカワ 小川 +オカワ 尾川 +オガワ 猿川 +オガワ 於川 +オガワ 恩河 +オガワ 緒河 +オガワ 緒川 +オガワ 小河 +オガワ 小川 +オガワ 苧川 +オガワ 苧側 +オガワ 尾河 +オガワ 尾川 +オガワ 雄川 +オガワ 荢川 +オガワウチ 小河内 +オガワウチ 小川内 +オカワキ 岡脇 +オガワグチ 小川口 +オガワジ 小川寺 +オガワジ 小川路 +オガワセ 小河瀬 +オカワダ 岡和田 +オガワダ 小川田 +オガワダニ 小川谷 +オカワチ 小河内 +オガワチ 小河内 +オガワチ 小川地 +オガワチ 小川内 +オガワド 小川戸 +オガワナ 小川名 +オガワハラ 小川原 +オガワブチ 小川渕 +オガワヤ 小川屋 +オガワヤ 小川谷 +オガワラ 小ケ原 +オガワラ 小河原 +オガワラ 小賀原 +オガワラ 小鹿原 +オガワラ 小川原 +オカンマ 岡馬 +オキ 沖 +オキ 小木 +オキ 尾木 +オキ 隠岐 +オキ 興 +オキ 起 +オキ 澳 +オキ 隠樹 +オキ 隠木 +オキ 扇喜 +オキ 苧木 +オキ 置 +オキ 穏岐 +オキ 億岐 +オキ 尾喜 +オキ 冲 +オキ 隱岐 +オギ 小城 +オギ 小木 +オギ 荻 +オギ 扇 +オギ 尾木 +オギ 尾城 +オギ 小儀 +オギ 雄城 +オギ 苧木 +オギ 尾儀 +オギ 𦿷 +オギ 雄木 +オキアイ 置鮎 +オキアイ 沖合 +オキアユ 置鮎 +オキイ 沖井 +オキイ 沖居 +オギイ 荻井 +オキイエ 沖家 +オキイシ 沖石 +オキイシ 置石 +オギイチ 扇一 +オギウ 荻生 +オギウ 大給 +オキウエ 沖上 +オギウエ 荻上 +オキウチ 沖内 +オギウチ 荻内 +オギウチ 扇内 +オキウラ 沖浦 +オギウラ 扇浦 +オギウラ 荻浦 +オキエ 沖江 +オキエ 沖恵 +オキエ 沖惠 +オギエ 荻江 +オギエ 荻枝 +オキエダ 沖枝 +オキエビス 沖胡 +オキオ 沖尾 +オギオ 荻尾 +オキオカ 沖岡 +オキガイ 沖貝 +オキガイト 沖垣内 +オギガウチ 荻ケ内 +オキガキ 沖垣 +オキガミ 沖上 +オギガミ 荻上 +オキカワ 沖川 +オキガワ 沖川 +オキガワ 沖河 +オギカワ 荻川 +オキガワラ 興ケ原 +オキキ 沖喜 +オキギ 沖喜 +オキギ 沖木 +オキグチ 沖口 +オキクボ 沖久保 +オギクボ 荻窪 +オギクボ 荻久保 +オキクラ 沖倉 +オギクラ 荻倉 +オキサカ 沖坂 +オギサカ 荻阪 +オギサカ 荻坂 +オキサキ 沖崎 +オキザキ 沖崎 +オキサコ 沖迫 +オギサコ 荻迫 +オキササキ 沖佐々木 +オキサダ 起定 +オキサダ 沖貞 +オキサワ 沖沢 +オキサワ 沖澤 +オキザワ 沖沢 +オキザワ 沖澤 +オギサワ 荻沢 +オギサワ 荻澤 +オギザワ 荻沢 +オギザワ 荻澤 +オキジ 置地 +オキジ 興地 +オキジ 沖地 +オギシ 小岸 +オギシ 尾岸 +オキシオ 置塩 +オキシオ 沖汐 +オキシオ 沖塩 +オキシオ 沖潮 +オキシオ 起汐 +オキシゲ 沖重 +オキシゲ 沖繁 +オキシタ 沖下 +オギシタ 荻下 +オギシタ 扇下 +オギシノ 荻篠 +オキシバ 沖芝 +オキシマ 沖島 +オキシマ 沖嶋 +オキシマ 興島 +オキシマ 沖嶌 +オキシマ 起島 +オキジマ 沖島 +オギシマ 荻島 +オギシマ 荻嶋 +オギショウ 荻荘 +オギショウ 荻莊 +オキシロ 沖代 +オキシン 沖新 +オキス 沖洲 +オキス 置栖 +オキス 起須 +オキス 沖須 +オキス 沖州 +オギス 荻須 +オギス 荻巣 +オギス 小岐須 +オギス 荻子 +オギス 荻洲 +オギス 荻州 +オキスエ 沖末 +オキスギ 沖杉 +オキズミ 沖住 +オキズミ 沖泉 +オキズミ 沖墨 +オキセ 沖世 +オキセ 沖瀬 +オキソ 小木曽 +オギソ 小木曽 +オギソ 小木曾 +オギソ 荻曽 +オギソ 荻曾 +オギソウ 荻荘 +オキゾエ 沖添 +オキゾノ 沖園 +オキゾノ 沖薗 +オギゾノ 荻園 +オキタ 沖田 +オキタ 小北 +オキタ 置田 +オキタ 小木田 +オキタ 起田 +オキタ 尾北 +オキタ 興田 +オキタ 隠岐田 +オキタ 起多 +オキタ 冲田 +オキダ 沖田 +オキダ 置田 +オギタ 荻田 +オギタ 小北 +オギタ 小木田 +オギタ 尾北 +オギタ 補陀 +オギタ 荻多 +オキダイ 沖代 +オキダイ 沖台 +オキタカ 沖高 +オキタカ 興隆 +オキタツ 起立 +オキダテ 沖館 +オキダテ 沖舘 +オキダテ 沖立 +オキタニ 沖谷 +オキタニ 隠岐谷 +オギタニ 荻谷 +オギタニ 小木谷 +オキタヤ 沖田屋 +オキダン 沖段 +オキヂ 置地 +オキヂ 興地 +オキツ 興津 +オキツ 沖津 +オキツ 澳津 +オキツ 沖都 +オギツ 荻津 +オギツ 小木津 +オキツカ 起塚 +オキツカ 沖塚 +オキヅカ 起塚 +オキツジ 沖辻 +オキテ 掟 +オキテ 沖手 +オキデ 沖出 +オキト 沖兎 +オキド 興戸 +オキドイ 沖土居 +オキトウ 沖藤 +オギドウ 荻堂 +オギドウ 萩堂 +オキドノ 沖殿 +オキトモ 沖友 +オキナ 翁 +オキナ 置名 +オキナ 沖奈 +オキナ 沖名 +オキナイ 翁井 +オキナカ 沖中 +オキナカ 沖仲 +オキナカ 冲中 +オキナガ 翁長 +オキナガ 沖永 +オキナガ 沖長 +オキナガ 冲永 +オキナガ 息長 +オギナカ 荻中 +オキナカワ 翁川 +オキナガワ 翁川 +オキナギ 沖泙 +オキナクラ 翁蔵 +オキナゴ 沖名子 +オギナサ 荻無里 +オキナサカ 翁坂 +オキナザカ 翁坂 +オキナザワ 翁沢(翁澤) +オキナゾウ 翁像 +オキナダ 翁田 +オキナミ 沖波 +オキナミ 沖並 +オキナミ 沖浪 +オキナリ 沖成 +オキニ 沖二 +オキニシ 沖西 +オギヌマ 荻沼 +オキネ 沖根 +オギネ 荻根 +オギネサワ 荻根沢 +オギネサワ 荻根澤 +オギネザワ 荻根沢 +オギネザワ 荻根澤 +オキノ 沖野 +オキノ 興野 +オキノ 沖埜 +オキノ 冲野 +オギノ 荻野 +オギノ 扇野 +オギノ 荻布 +オギノ 小木野 +オギノ 扇能 +オギノ 荻埜 +オギノ 小木埜 +オギノ 尾木野 +オギノ 藡野 +オキノイ 沖井 +オキノイ 沖ノ井 +オギノウ 荻納 +オギノエ 荻野江 +オキノカブ 沖之株 +オギノサコ 荻ノ迫 +オギノサワ 荻ノ沢 +オギノサワ 荻の沢 +オキノシタ 大木下 +オキノシマ 沖之島 +オキノジョウ 沖之城 +オキノタニ 沖野谷 +オキノタニ 沖ノ谷 +オキノブ 沖信 +オギノメ 荻野目 +オキノヤ 沖野谷 +オギノヤ 荻野谷 +オキノリ 興法 +オキバ 沖羽 +オギバ 荻場 +オキハシ 起橋 +オキハタ 沖畑 +オキハタ 沖畠 +オキバタ 沖端 +オキハナ 沖花 +オキハマ 沖浜 +オキハマ 沖濱 +オキバヤシ 沖林 +オギバヤシ 荻林 +オキハラ 沖原 +オキハラ 澳原 +オギハラ 荻原 +オギハラ 扇原 +オギハラ 小城原 +オギハラ 小木原 +オギハラ 尾木原 +オキハル 興治 +オキヒサ 沖久 +オキヒラ 沖平 +オギヒラ 荻平 +オキヒロ 沖広 +オキヒロ 沖廣 +オキフジ 沖藤 +オキブチ 沖淵 +オキブチ 沖渕 +オキベ 沖辺 +オキベ 沖部 +オキベ 沖邊 +オキベ 沖邉 +オキベヤ 沖部屋 +オキホリ 沖堀 +オキマ 沖間 +オギマ 荻間 +オキマエ 沖前 +オキマサ 沖政 +オキマス 沖増 +オキマス 沖升 +オキマス 沖益 +オキマス 沖桝 +オキマス 沖舛 +オギマチ 荻町 +オキマツ 興松 +オキマツ 沖松 +オキマル 沖丸 +オキミ 沖見 +オキミズ 沖水 +オキミツ 沖光 +オキミツ 沖満 +オキミツ 沖滿 +オキミツ 興満 +オキミネ 興嶺 +オキミヤ 沖宮 +オキムコウ 沖向 +オキムタ 沖牟田 +オキムネ 沖宗 +オキムラ 沖村 +オキムラ 興村 +オキムラ 置村 +オキムラ 沖邑(冲邑) +オキムラ 隠岐村 +オギムラ 荻村 +オキムロ 沖室 +オキモト 沖本 +オキモト 沖元 +オキモト 置本 +オキモト 起本 +オキモト 興本 +オキモト 冲本 +オギモト 荻本 +オギモト 大木元 +オキモリ 沖森 +オキモリ 沖盛 +オキモリ 沖守 +オギモリ 荻森 +オキヤ 沖谷 +オキヤ 沖屋 +オギヤ 扇谷 +オギヤ 荻谷 +オギヤ 荻矢 +オギヤ 小木谷 +オギヤ 大木谷 +オキヤス 沖安 +オキヤナギ 沖柳 +オキヤマ 沖山 +オキヤマ 興山 +オキヤマ 置山 +オキヤマ 起山 +オキヤマ 冲山 +オギヤマ 荻山 +オキュウ 尾久 +オギュウ 尾久 +オギュウ 荻生 +オギュウ 大給 +オキュウド 尾久土 +オキユミ 沖弓 +オキヨコタ 沖横田 +オキヨシ 沖吉 +オキヨシ 沖好 +オキヨネダ 沖米田 +オギリ 小桐 +オギリ 尾桐 +オギリマ 小切間 +オギリヤマ 小切山 +オギロ 荻路 +オギワラ 荻原 +オギワリ 扇割 +オク 奥(奧) +オク 尾久 +オク 於久 +オク 屋 +オク 越久 +オク 億 +オク 遠久 +オグ 尾久 +オグ 小具 +オクアキ 奥秋 +オクイ 奥井 +オクイ 奥居 +オクイ 屋井 +オクイ 舎夷 +オグイ 小杭 +オクイエ 奥家 +オクイオリ 奥庵 +オクイケ 奥池 +オクイシ 奥石 +オクイズミ 奥泉 +オクイタ 奥板 +オクイチ 奥一 +オクイチ 奥市 +オクイデ 奥出 +オクイワ 奥岩 +オクウエ 奥上 +オクウエ 奥植 +オクウエノ 奥上野 +オクウチ 奥内 +オクウミ 奥海 +オクウラ 奥浦 +オクウラヤ 奥浦屋 +オクエ 小久江 +オクエ 奥江 +オクエ 奥枝 +オクエ 屋江 +オグエ 小久江 +オクエダ 奥枝 +オクオ 奥尾 +オクオオタニ 奥大谷 +オクオカ 奥岡 +オクオカ 王来王家 +オクガ 奥賀 +オクガイチ 奥垣内 +オクガイト 奥垣内 +オクガウチ 奥垣内 +オクガキ 奥垣 +オクガキ 奥柿 +オクガキウチ 奥垣内 +オクカゼ 奥風 +オクカド 奥門 +オクガミ 奥上 +オクガヤ 奥ケ谷 +オクカワ 奥川 +オクカワ 奥河 +オクガワ 奥川 +オクガワ 奥河 +オクガワ 億川 +オクガワチ 奥河内 +オクガワラ 奥河原 +オクキ 奥木 +オクギ 奥木 +オクギシ 奥岸 +オクキタ 奥北 +オクギリ 奥切 +オクグチ 奥口 +オククボ 奥窪 +オククボ 奥久保 +オクグモ 奥雲 +オククラ 奥倉 +オクグラ 奥倉 +オクゴウチ 奥河内 +オクゴシ 奥越 +オクゴマ 奥駒 +オクサ 奥佐 +オクザ 奥座 +オグサ 小草 +オクサカ 奥坂 +オクサカ 奥阪 +オクサキ 奥崎 +オクサキ 奥先 +オクザキ 奥崎 +オクザキ 屋崎 +オクザキ 奥岬 +オクザキ 奥嵜 +オクサク 奥作 +オクサコ 奥迫 +オクサコ 奥峪 +オクサコ 尾久迫 +オクザコ 奥迫 +オクサダ 奥定 +オクサダ 奥貞 +オクサダ 億貞 +オクザト 奥里 +オクサラ 奥佐羅 +オクサラヤ 奥更屋 +オクサワ 奥沢 +オクサワ 奥澤 +オクザワ 奥沢 +オクザワ 奥澤 +オクジ 奥地 +オグシ 小串 +オグシ 尾串 +オグシ 小櫛 +オクシオ 澳塩 +オクシオ 奥塩 +オクシゲ 奥重 +オクシタ 奥下 +オクシバ 奥芝 +オクシマ 奥島 +オクシマ 奥嶋 +オクシマ 屋島 +オクジマ 奥島 +オクジマ 奥嶋 +オクシャ 奥舎 +オクシュウ 奥州 +オクショ 奥所 +オクジョ 奥所 +オクジョウ 奥城 +オクジョウ 奥上 +オクジョウ 奥條 +オクジョウ 奥条 +オクショウジ 奥小路 +オクシロ 奥城 +オクシロ 奥代 +オクシン 奥新 +オグス 小楠 +オグス 尾楠 +オクスエ 奥末 +オクスカ 奥須賀 +オクスガ 奥須賀 +オクスギ 奥杉 +オクスミ 奥住 +オクスミ 奥墨 +オクズミ 奥住 +オクズミ 奥隅 +オクズミ 奥墨 +オクズミ 奥積 +オクズミ 奥角 +オクズミ 奥炭 +オグスリ 小薬 +オクセ 奥瀬 +オクゼン 奥膳 +オクゾエ 奥添 +オクソノ 奥園 +オクゾノ 奥園 +オクゾノ 奥薗 +オクゾノ 大工園 +オクゾノ 奥苑 +オクゾノ 屋園 +オクソラ 奥空 +オクゾラ 奥空 +オクソワ 奥岨 +オクタ 奥田(奧田) +オクタ 奥多 +オクダ 奥田(奧田) +オクダ 屋田 +オクダ 億田 +オクダ 御供田 +オクダ 於久田 +オクダ 越久田 +オクダ 奥多 +オクダ 尾久田 +オクダイ 奥代 +オクダイラ 奥平 +オクタカ 奥高 +オクダカ 奥高 +オクタキ 奥滝 +オクタキ 奥瀧 +オクタケ 奥武 +オクタケ 奥竹 +オクタケ 奥岳 +オクタシロ 奥田代 +オクタテ 奥立 +オクダテ 奥立 +オクタニ 奥谷 +オクタニ 億谷 +オクタニ 奥渓 +オクダニ 奥谷 +オクタマ 奥玉 +オクタラ 奥田良 +オクチ 奥地 +オクチ 奥知 +オクヂ 奥地 +オグチ 小口 +オグチ 尾口 +オグチ 御宮知 +オクチョウ 奥丁 +オクツ 奥津 +オクヅ 奥津 +オクツカ 奥塚 +オクヅカ 奥塚 +オクツジ 奥辻 +オクツジ 奥逵 +オクツチ 奥土 +オクツノ 奥角 +オクヅミ 奥積 +オクヅメ 奥詰 +オクヅメ 奥爪 +オクツル 奥鶴 +オクテ 奥手 +オクデ 奥出 +オクデラ 奥寺 +オクテン 奥天 +オクデン 奥伝 +オクデン 奥傳 +オクト 奥戸 +オクド 奥戸 +オクド 奥土 +オクド 尾久土 +オクドイ 奥土居 +オクトウ 奥藤 +オクトウ 奥東 +オクドウ 奥藤 +オクドウ 奥洞 +オクドウ 奥堂 +オクドコロ 奥所 +オクドノ 奥殿 +オクトミ 奥富 +オクトミ 奥冨 +オクドミ 奥富 +オクドミ 奥冨 +オクトメ 奥留 +オクドメ 奥留 +オクトモ 奥友 +オクナ 奥名 +オクナカ 奥中 +オクナカ 奥仲 +オクナガ 奥永 +オクナガ 奥長 +オクナダ 奥灘 +オクナミ 奥浪 +オクナミ 奥波 +オクナミ 奥並 +オクナリ 奥成 +オクナル 奥鳴 +オクニ 小国 +オクニ 小國 +オクニ 尾国 +オクニ 尾國 +オグニ 小国 +オグニ 小國 +オグニ 尾国 +オグニ 小邦 +オグニ 尾國 +オクニシ 奥西 +オクニシ 王宮西 +オグニマサ 小国政 +オクニワ 奥庭 +オクヌキ 奥貫 +オクヌキ 奥抜(奥拔) +オクヌキ 小久貫 +オクヌギ 小椚 +オクヌシ 奥主 +オクネ 奥根 +オクノ 奥野 +オクノ 奥埜 +オクノ 屋野 +オクノ 奥ノ +オクノ 奥納 +オクノ 奥乃 +オクノ 於久野 +オクノ 奥𡌛 +オクノ 億野 +オクノ 奧野 +オクノイ 奥野井 +オクノウ 奥濃 +オクノウ 奥納 +オクノウタニ 奥能谷 +オクノキ 奥ノ木 +オクノギ 奥野木 +オクノギ 奥ノ木 +オクノショ 奥野所 +オクノソノ 奥ノ園 +オクノソノ 奥之園 +オクノソノ 奥之薗 +オクノソノ 奥ノ薗 +オクノダ 奥野田 +オクノタニ 奥野谷 +オクノタニ 奥ノ谷 +オクノブ 奥信 +オクノブ 奥延 +オクノボウ 奥坊 +オクノボウ 奥ノ坊 +オクノミヤ 奥宮 +オクノヤ 奥谷 +オクノヤ 奥野谷 +オクノヤ 奥ノ谷 +オクノヤ 奥ノ矢 +オクノヤ 奥野矢 +オクノヤ 奥の矢 +オクノヤマ 奥之山 +オクノヤマ 奥野山 +オクバ 奥羽 +オクバ 尾久葉 +オクバ 奥場 +オクハシ 奥橋 +オクバシ 奥橋 +オクハタ 奥畑 +オクハタ 奥畠 +オクハタ 奥端 +オクハタ 大久畑 +オクバタ 奥畑 +オクバタ 奥端 +オクハバ 奥羽場 +オクハマ 奥浜 +オクハマ 奥濱 +オクバヤシ 奥林 +オクハラ 奥原 +オクハラ 澳原 +オクハラ 屋原 +オクハラ 奥波羅 +オクバラ 奥原 +オクビ 尾首 +オクビ 奥備 +オクヒガシ 奥東 +オクヒサ 奥久 +オクヒラ 奥平 +オクビラキ 奥開 +オクヒロ 奥広 +オクヒロ 奥廣 +オクフカ 奥深 +オクフジ 奥藤 +オクベ 奥部 +オクボ 小久保 +オクボ 小窪 +オクボ 奥保 +オクボ 尾久保 +オクボ 尾窪 +オクボウ 奥坊 +オクボウ 奥防 +オクボラ 奥洞 +オクホリ 奥堀 +オクボリ 奥堀 +オクマ 奥間 +オグマ 小熊 +オグマ 尾熊 +オグマ 小隈 +オグマ 男熊 +オクマエ 奥前 +オクマキ 奥牧 +オクマサ 奥政 +オクマサ 奥正 +オクマチ 奥町 +オクマツ 奥松 +オクマル 奥丸 +オクミ 奥見 +オクミ 奥海 +オクミ 奥美 +オグミ 小久見 +オグミ 小汲 +オグミ 尾組 +オクミズ 奥水 +オクミチ 奥道 +オクミドウ 奥御堂 +オクミネ 奥峰 +オクミネ 奥峯 +オクミヤ 奥宮 +オクミヤ 屋宮 +オクミヤマ 奥深山 +オクミョウ 奥名 +オクミョウ 奥明 +オクムキ 奥向 +オクムラ 奥村 +オクムラ 奥邨 +オクムラ 屋村 +オクムラ 越久村 +オクムラ 大久村 +オクムラ 奥邑 +オクムラ 遠久村 +オクムラカミ 奥村上 +オクムロ 奥室 +オグメ 小久米 +オクモ 奥茂 +オグモ 小雲 +オクモト 奥本 +オクモト 奥元 +オクモト 澳本 +オクモト 納本 +オクモト 億本 +オクモリ 奥森 +オクヤ 奥谷 +オクヤ 奥家 +オクヤ 奥屋 +オクヤ 奥矢 +オクヤ 億谷 +オクヤシキ 奥屋敷 +オクヤスバ 奥休場 +オクヤチ 奥谷内 +オクヤナギ 奥柳 +オクヤマ 奥山 +オクヤマ 屋山 +オクヨシ 奥吉 +オクヨシ 億吉 +オクラ 小倉 +オクラ 屋良 +オクラ 尾倉 +オクラ 尾蔵(尾藏) +オグラ 小倉 +オグラ 小椋 +オグラ 椋 +オグラ 小掠 +オグラ 尾倉 +オグラ 小蔵 +オグラ 巨椋 +オグラ 木椋 +オグラ 小藏 +オグラ 椋倉 +オグラ 雄倉 +オグラハタ 小倉畑 +オグラミ 小倉見 +オグラヤマ 小倉山 +オクリ 奥利 +オグリ 小栗 +オグリ 尾栗 +オグリ 小操 +オグリス 小栗栖 +オグリタ 小栗田 +オグリダ 小栗田 +オグリバヤシ 小栗林 +オグリヤマ 小栗山 +オグル 小畔 +オグル 尾来 +オグルス 小栗栖 +オグルマ 小車 +オグルマ 緒車 +オグレ 小暮 +オグレ 尾暮 +オクロ 奥梠 +オグロ 小黒 +オグロ 小畔 +オグロ 尾黒 +オクロギ 奥呂木 +オグロサワ 小黒沢 +オグロサワ 小黒澤 +オグロザワ 小黒澤 +オクワキ 奥脇 +オクワケ 奥分 +オクワダ 奥和田 +オケ 尾家 +オケ 桶 +オケイ 桶井 +オケイエ 桶家 +オケオ 桶尾 +オケカワ 桶川 +オケガワ 桶川 +オケガワ 桶皮 +オケガワ 桶河 +オケギ 桶木 +オケグチ 桶口 +オケグチ 尾ケ口 +オケザキ 桶崎 +オケサク 桶作 +オケザワ 桶沢 +オケザワ 桶澤 +オケシ 桶師 +オケシ 桶仕 +オケシタ 桶下 +オケシマ 桶島 +オケシマ 桶嶋 +オケシャ 桶舎 +オケショウ 桶生 +オケジリ 桶尻 +オケタ 桶田 +オケダ 桶田 +オケタニ 桶谷 +オケタニ 尾毛谷 +オケト 桶戸 +オケドイ 桶土井 +オケドイ 桶樋 +オケトウ 桶東 +オケナカ 桶中 +オケナリ 桶成 +オケノ 桶野 +オケハシ 桶橋 +オケハラ 桶原 +オケマ 桶間 +オケムラ 桶村 +オケモト 桶本 +オケモト 桶元 +オケヤ 桶谷 +オケヤ 桶屋 +オケヤ 桶矢 +オケヤ 桶家 +オケヤマ 桶山 +オケユイ 桶結 +オケヨシ 桶葭 +オコ 小神 +オコ 尾古 +オコ 尾子 +オコ 御子 +オゴ 小河 +オゴ 尾後 +オゴ 尾子 +オゴ 於子 +オゴイエ 尾後家 +オコウ 小甲 +オコウ 小神 +オコウ 大后 +オコウ 岡豊 +オコウ 尾幸 +オゴウ 小河 +オゴウ 小郷 +オゴウ 小江 +オゴウ 小合 +オゴウ 尾郷 +オゴウ 淡河 +オゴウ 尾毫 +オコウジ 小川内 +オゴウチ 小河内 +オゴウハラ 小郷原 +オゴウハラ 尾郷原 +オゴエ 小越 +オコギ 尾古貴 +オゴケ 尾後家 +オコシ 小越 +オコシ 起 +オゴシ 小越 +オゴシ 生越 +オゴシ 尾越 +オゴシ 御輿 +オコジマ 小故島 +オコジマ 尾故島 +オコズミ 小許住 +オゴセ 生越 +オゴセ 尾越 +オゴセ 小古瀬 +オゴセ 小合瀬 +オゴソ 小社 +オコタ 小古田 +オコダ 大小田 +オコタニ 尾小谷 +オコチ 大河内 +オコナイ 小子内 +オゴヌキ 尾後貫 +オゴヌキ 越後貫 +オゴヌキ 小後貫 +オコノギ 小此木 +オコノギ 小此鬼 +オコノギ 小比木 +オゴハラ 小郷原 +オコヒラ 大河平 +オコヒラ 尾小平 +オコビラ 大河平 +オコマ 小古間 +オゴマ 小駒 +オゴマ 小後摩 +オゴミ 尾込 +オゴメ 尾込 +オコモリ 尾古森 +オゴモリ 尾籠 +オゴモリ 尾込 +オゴモリ 尾篭 +オゴモリ 御護守 +オコヤマ 小古山 +オコヤマ 尾小山 +オゴヤマ 小古山 +オゴロ 小古呂 +オゴロ 尾頃 +オゴロチ 大心池 +オコン 尾近 +オコン 小近 +オコンソウ 尾金沢 +オサ 長 +オサ 小佐 +オサ 筬 +オサ 小左 +オサ 尾佐 +オザ 御座 +オザ 男座 +オザ 尾坐 +オザ 尾座 +オザ 緒座 +オザ 小座 +オサイ 押井 +オサイ 筬井 +オサイ 尾才 +オザイ 小材 +オザイ 小菜 +オサエ 押江 +オサエ 押 +オサエ 按 +オサオ 小棹 +オサオ 尾棹 +オザオ 小竿 +オザオ 小棹 +オザオカ 御座岡 +オサカ 小坂 +オサカ 小阪 +オサカ 尾坂 +オサカ 苧坂 +オサカ 纓坂 +オサカ 苧阪 +オサカ 尾阪 +オサカ 麻坂 +オサカ 荢坂 +オサカ 緒坂 +オサカ 長香 +オサカ 櫻坂 +オサカ 綏坂 +オザカ 小坂 +オザカ 尾坂 +オザカ 苧坂 +オザカ 纓坂 +オザカ 尾阪 +オサガイ 長貝 +オサカケ 長掛 +オサカタ 長方 +オサカダ 小坂田 +オサカダ 小阪田 +オサガネ 長鎌 +オサカベ 刑部 +オサカベ 長壁 +オサカベ 越阪部 +オサカベ 小坂部 +オサカベ 小酒部 +オサカベ 長ケ部 +オサカベ 越坂部 +オサカベ 長日部 +オサカベ 長下部 +オサカベ 長我部 +オサカベ 長加部 +オサカベ 長賀部 +オサカミ 長上 +オサガミ 長上 +オサガワ 長川 +オサガワ 小佐川 +オサガワ 尾佐川 +オサキ 尾崎 +オサキ 小崎 +オサキ 尾前 +オサキ 長木 +オサキ 尾嵜 +オサキ 尾碕 +オサキ 小嵜 +オサキ 小先 +オサキ 尾先 +オザキ 尾崎 +オザキ 小崎 +オザキ 尾前 +オザキ 尾嵜 +オザキ 尾碕 +オザキ 小嵜 +オザキ 雄崎 +オザキ 緒崎 +オザキ 尾埼 +オサキザワ 小崎沢(小崎澤) +オザキボウ 尾崎坊 +オザキヤ 尾崎屋 +オサク 小作 +オサク 尾作 +オザク 小作 +オザク 尾作 +オサグチ 長口 +オサコ 尾迫 +オサコ 尾浴 +オサコ 尾嶝 +オサコ 尾﨏 +オサコ 尾峪 +オサコ 尾佐古 +オサコ 尾硲 +オサゴ 長子 +オザコ 尾迫 +オササ 小笹 +オザサ 小笹 +オザサ 小佐々 +オザサ 小篠 +オザサ 尾笹 +オザサハラ 小笹原 +オザサヤマ 小笹山 +オサザワ 長沢 +オサジ 小佐治 +オサジ 大小治 +オザシ 小指 +オサシマ 長嶋 +オサジマ 筬島 +オサジマ 緒佐島 +オサジマ 筬嶋 +オサダ 長田 +オサダ 小佐田 +オサダ 長多 +オサダ 尾定 +オサタケ 長竹 +オサタケ 長武 +オサタケ 尾佐竹 +オサタニ 長谷 +オサタニ 筬谷 +オサダヤ 長田谷 +オサテ 小佐手 +オサト 尾里 +オサト 緒里 +オザト 小里 +オザト 尾里 +オザト 百里 +オザト 緒里 +オザト 雄郷 +オサトガワ 苧里川 +オサトミ 長富 +オサナ 長名 +オサナイ 小山内 +オサナイ 長内 +オサナイ 小内 +オサナガ 長永 +オサナミ 長南 +オザナミ 小佐波 +オサニシ 長西 +オザネ 小実 +オザネ 尾実(尾實) +オザネ 小實 +オサノ 小佐野 +オサノ 小佐乃 +オザノ 小座野 +オサハシ 納橋 +オサハラ 長原 +オサハラ 小佐原 +オザハラ 尾坐原 +オザハラ 尾座原 +オサフネ 長船 +オサフネ 長舩 +オサベ 刑部 +オサベ 長部 +オサベ 福部 +オサベ 長辺(長邊) +オサベ 筬部 +オサベ 長邉 +オサマ 長間 +オザマ 小座間 +オサマツ 長松 +オサミ 長見 +オサミツ 小長光 +オサム 納 +オサムネ 長宗 +オサムラ 長村 +オサムラ 納村 +オサメ 納 +オサメモト 納本 +オサモト 長本 +オザモト 尾座本 +オザモト 生座本 +オザモト 小座本 +オザモト 尾座元 +オサヤ 筬谷 +オサヤ 筬矢 +オサヤマ 長山 +オサラギ 大仏 +オサラギ 大佛 +オサラク 長楽 +オサラク 長樂 +オサリ 長利 +オサワ 小沢 +オサワ 小澤 +オサワ 小佐波 +オザワ 小沢 +オザワ 小澤 +オザワ 尾沢 +オザワ 尾澤 +オザワ 男沢 +オザワ 男澤 +オザワ 雄沢 +オザワ 雄澤 +オシ 忍 +オシ 押 +オシ 緒志 +オシ 越志 +オジ 尾地 +オジ 尾路 +オジ 尾子 +オジ 尾治 +オシアゲ 押上 +オシイ 押井 +オシイリ 押入 +オシイワ 押岩 +オシウミ 鴛海 +オシウミ 押海 +オジウラ 尾子浦 +オシエ 押江 +オシエ 押柄 +オシオ 小塩 +オシオ 押尾 +オシオ 尾塩 +オシオ 置塩 +オシオ 生塩 +オシオ 鴛尾 +オシオ 忍峽 +オジオ 小塩 +オシオカ 押岡 +オシカ 小鹿 +オシカ 男鹿 +オシカ 牡鹿 +オシガ 忍賀 +オシガ 押賀 +オジカ 小鹿 +オジカ 男鹿 +オジカ 牡鹿 +オジカ 小値賀 +オジカ 尾鹿 +オシカイベ 忍海部 +オシカタ 押方 +オシカネ 押鐘 +オシカネ 押金 +オシカネ 押兼 +オシガネ 押鐘 +オシガネ 押金 +オシカベ 忍海部 +オシガミ 押上 +オシカモ 押鴨 +オシガモ 押鴨 +オシカワ 押川 +オシカワ 忍川 +オジカワ 小路川 +オシキ 押木 +オシキ 折敷 +オシキ 尾敷 +オシキジ 折敷地 +オシキネ 押杵 +オシキリ 押切 +オシキリ 押桐 +オシギリ 押切 +オシグチ 印口 +オシグチ 押口 +オシクボ 押久保 +オシグリ 押栗 +オシゲ 尾茂 +オシゲ 押毛 +オシゲ 尾重 +オシコウジ 押小路 +オシゴエ 押越 +オシコシ 押越 +オシサカ 押坂 +オシサカ 押阪 +オシザカ 押坂 +オシザカ 押阪 +オシザキ 鴛崎 +オシザキ 押崎 +オシザキ 忍崎 +オシザワ 押沢 +オシザワ 忍澤 +オシザワ 押澤 +オシザワ 忍沢 +オシシタ 押下 +オシジマ 押島 +オシジョウ 押条 +オシズミ 印貢 +オシタ 押田 +オシタ 尾下 +オシダ 押田 +オシダ 忍田 +オシダ 王子田 +オシダ 鴛田 +オシタテ 押立 +オシタニ 押谷 +オシタニ 鴛谷 +オシダニ 押谷 +オシタリ 忍足 +オシタリ 押足 +オシダリ 忍足 +オシタル 押樽 +オシダル 押樽 +オシダレ 押垂 +オシダレ 押多連 +オシダレ 押埀 +オシダレ 忍垂 +オシヅカ 押塚 +オシツキ 押月 +オシテ 押手 +オシデ 押手 +オシデ 押出 +オシトコ 押床 +オシトベ 押渡部 +オシトミ 押富 +オシトメ 押止 +オシドメ 押止 +オシドメ 押留 +オシナ 尾科 +オシナ 押名 +オシナカ 押仲 +オシナガ 押永 +オシナリ 忍成 +オシノ 押野 +オシノ 小篠 +オシノウミ 鴛海 +オシノミ 鴛海 +オシノミ 押野見 +オシノミ 押之見 +オシノミ 押三見 +オシノメ 押目 +オシノヤ 押野谷 +オシバ 押場 +オシバ 尾芝 +オシバ 押葉 +オシバ 尾柴 +オシハラ 押原 +オシハラ 鴛原 +オシビ 押火 +オシビ 押樋 +オシビ 押日 +オシブチ 鴛淵 +オシブチ 鴛渕 +オシブチ 押渕 +オシブチ 押淵 +オシベ 押部 +オシホ 忍穂(忍穗) +オシボ 押保 +オシホイ 恩穂井(恩穗井) +オシホイ 忍穂井 +オシマ 小島 +オシマ 小嶋 +オシマ 尾島 +オシマ 尾嶋 +オシマ 於島 +オジマ 小島 +オジマ 小嶋 +オジマ 尾島 +オジマ 生島 +オジマ 尾嶋 +オジマ 小嶌 +オジマ 雄島 +オジマ 緒嶋 +オジマ 尾嶌 +オジマ 緒島 +オジマ 雄嶋 +オシマヅキ 几 +オシミ 押見 +オシミ 鴛海 +オシミ 押味 +オシミ 忍見 +オシミ 押耳 +オシミズ 押水 +オシムラ 押村 +オシメ 押目 +オシモ 尾下 +オシモト 押本 +オシモト 押元 +オシモト 鴛本 +オシモリ 押森 +オシヤ 押谷 +オシヤマ 押山 +オシヤマ 忍山 +オシヤマ 鴦山 +オジヤマ 尾隠山 +オジャモト 御蛇本 +オシュウジ 尾宗寺 +オシュク 於宿 +オショウダニ 大正谷 +オシラベ 御調 +オジリ 尾尻 +オジリ 小尻 +オシロ 大城 +オシロ 小城 +オシロ 尾城 +オシロ 尾白 +オシロ 尾代 +オシロ 男城 +オジロ 小城 +オジロ 小代 +オジロ 尾城 +オジロ 尾白 +オジロ 小白 +オジロ 男城 +オシンベ 忍海辺 +オシンベ 忍海邊 +オズ 小津 +オズ 小都 +オズ 尾津 +オスエ 尾末 +オズエ 尾末 +オスオ 押尾 +オスカ 小須賀 +オスガ 小数賀(小數賀) +オスキ 小薄 +オスギ 尾杉 +オスジ 尾筋 +オスジョウ 押条 +オスジョウ 押條 +オスジョウ 押篠 +オズノ 小津野 +オズノ 尾都野 +オスピノ 推比乃 +オスミ 小住 +オズミ 小角 +オズミ 小住 +オズミ 小澄 +オズミ 尾住 +オセ 小瀬 +オセ 尾瀬 +オセ 於勢 +オセ 尾勢 +オセ 尾世 +オゼ 小瀬 +オセガワ 尾世川 +オセキ 小関 +オセキ 尾関 +オセキ 織繊芸 +オセキ 尾跡 +オゼキ 小関 +オゼキ 尾関 +オゼキ 小瀬木 +オゼキ 尾碕 +オゼキ 小關 +オゼキ 尾關 +オゼキ 雄関 +オセコ 尾迫 +オセザワ 小瀬沢 +オセザワ 小瀬澤 +オセダ 尾瀬田 +オセド 尾瀬戸 +オゼニ 尾銭 +オゼニ 尾錢 +オセラ 大瀬良 +オソ 尾曽 +オソ 尾曾 +オゾ 於曽 +オゾウ 尾造 +オゾウ 尾蔵(尾藏) +オソエ 尾副 +オゾエ 尾添 +オゾエ 尾副 +オゾエ 小副 +オゾエ 雄副 +オソエカワ 小副川 +オソエガワ 小副川 +オゾエガワ 小副川 +オソガグチ 獺ケ口 +オソガミ 恐神 +オソガワ 小曽川 +オソガワ 小曾川 +オソグチ 獺口 +オソゴエ 獺越 +オソゴエ 尾曽越 +オソコシ 獺越 +オソゴシ 獺越 +オソゴシ 遅越 +オソザワ 遅沢 +オソザワ 遅澤 +オソザワ 遲澤 +オソダ 襲田 +オソツカ 遅塚 +オソヅカ 遅塚 +オソド 小曽戸 +オソド 小曾戸 +オソニワ 獺庭 +オゾネ 小曽根 +オゾネ 小曾根 +オゾネ 尾曽根 +オソノ 小園 +オソノ 小薗 +オソノ 小曽納 +オソノ 於曾能 +オソノ 於曽能 +オソノ 尾薗 +オゾノ 小園 +オゾノ 小薗 +オゾノ 尾園 +オゾノ 尾薗 +オゾノ 苧園 +オソノイ 小薗井 +オソノイ 小園井 +オソノイ 遅野井 +オソノウ 小曾納 +オソノウ 小曽納 +オソノエ 小薗江 +オソノエ 小園江 +オゾノエ 小園江 +オソバ 小蕎 +オソハラ 小曽原 +オソヤマ 遅山 +オソレダ 恐田 +オタ 小田 +オタ 織田 +オタ 尾田 +オタ 尾太 +オダ 小田 +オダ 織田 +オダ 恩田 +オダ 尾田 +オダ 小多 +オダ 緒田 +オダ 苧田 +オダ 纓田(䋝田) +オダ 於田 +オダ 尾太 +オダ 綏田 +オタイ 小田井 +オタイ 小胎 +オダイ 小代 +オダイ 尾台 +オダイ 小田井 +オダイ 尾大 +オダイ 尾臺 +オダイラ 小平 +オダイラ 尾平 +オダウチ 小田内 +オダウミ 小田海 +オダオ 小田尾 +オダオオハラ 織田大原 +オタカ 小高 +オタカ 尾高 +オタカ 小鷹 +オタカ 尾鷹 +オタカ 尾多賀 +オタガ 尾多賀 +オダカ 小高 +オダカ 尾高 +オダカ 小鷹 +オダカ 尾鷹 +オダカ 小田賀 +オダガ 小田賀 +オダガキ 小田垣 +オダガキ 小田柿 +オダカサ 大田笠 +オタカネ 小高根 +オダカネ 小高根 +オダガネ 小田金 +オダカミ 小田上 +オダガミ 小田上 +オダカワ 尾田川 +オダガワ 小田川 +オダガワ 尾田川 +オタキ 小滝 +オタキ 小瀧 +オタキ 尾滝 +オタキ 尾瀧 +オタキ 麻滝 +オタギ 愛宕 +オダキ 小滝 +オダキ 小田木 +オダキ 小瀧 +オダキ 小田喜 +オダキ 小田岐 +オダキ 尾田木 +オダギ 小田木 +オタギリ 小田切 +オダキリ 小田切 +オダキリ 小田桐 +オダギリ 小田切 +オダギリ 小田桐 +オダギリ 織田桐 +オダクサ 小田草 +オダグサ 小田草 +オダグチ 小田口 +オダクラ 小田倉 +オダクラ 織田倉 +オタケ 小竹 +オタケ 小武 +オタケ 尾竹 +オタケ 男武 +オタケ 男竹 +オダケ 小竹 +オダケ 小武 +オダケ 尾竹 +オダケ 小嶽 +オダケ 男武 +オダケ 小岳 +オダケ 小獄 +オダケ 尾武 +オダサ 小田佐 +オダサキ 小田崎 +オダザキ 小田崎 +オタザワ 小田沢 +オタザワ 織田沢 +オタザワ 織田澤 +オタザワ 小田澤 +オダサワ 小田沢 +オダサワ 織田澤 +オダサワ 小田澤 +オダザワ 織田沢 +オダザワ 織田澤 +オダザワ 小田澤 +オタジマ 小田島 +オタジマ 小田嶋 +オダシマ 小田島 +オダシマ 小田嶋 +オダシマ 小田嶌 +オダジマ 小田島 +オダジマ 小田嶋 +オダジマ 織田島(織田嶋) +オダシロ 小田代 +オダシロ 小田城 +オダズミ 小田住 +オタダ 小只 +オタダ 小多田 +オダタ 小田々 +オダタ 小田多 +オダタイ 小田多井 +オダタキ 小田滝 +オタチ 小立 +オタチ 御舘 +オタチ 尾舘 +オダチ 尾立 +オダチ 小立 +オダチ 小達 +オダチメ 大立目 +オダツ 尾立 +オダテ 小舘 +オダテ 尾立 +オダテ 小達 +オダテ 尾舘 +オダテ 尾館 +オダテ 御建 +オタド 小田土 +オダト 小田戸 +オダナカ 小田中 +オダナガ 小田長 +オダナギ 小棚木 +オダナミ 小田波 +オタニ 小谷 +オタニ 尾谷 +オタニ 雄谷 +オタニ 男谷 +オタニ 苧谷 +オダニ 小谷 +オダニ 尾谷 +オダニ 男谷 +オダニ 小田二 +オタニヤ 小谷屋 +オタネ 尾種 +オダネ 小田根 +オタノ 小田野 +オダノ 小田野 +オダハシ 小田橋 +オダバシ 小田橋 +オタバヤシ 小田林 +オダバヤシ 小田林 +オダハラ 小田原 +オダハラ 大田原 +オダハラ 尾田原 +オタビヤ 御旅屋 +オダヒラ 小田平 +オタベ 小田部 +オタベ 小田辺(小田邉) +オタベ 小田邊 +オダベ 小田部 +オタマ 於玉 +オダマ 小玉 +オダマ 尾玉 +オダマ 苧玉 +オダマエ 小田前 +オダマキ 小田巻 +オダマキ 緒環 +オダミヤ 小田宮 +オタムラ 小田村 +オダムラ 小田村 +オダムラ 織田村 +オダムラ 尾田村 +オダメ 尾為 +オダモト 小田本 +オダモト 小田元 +オダモリ 小田森 +オタヤ 御旅屋 +オダヤ 小田谷 +オダヤナギ 小田柳 +オダヤマ 小田山 +オタリ 小足 +オタル 小垂 +オタル 小樽 +オタルベ 尾樽部 +オタワ 小田和 +オタワ 小垰 +オダワ 小田和 +オダワキ 小田脇 +オダワラ 小田原 +オダワラ 小俵 +オダワラ 尾田原 +オダワラ 織田原 +オダワラ 緒田原 +オチ 越智 +オチ 落 +オチ 越地 +オチ 越知 +オチ 尾地 +オチ 尾知 +オチ 樗 +オチ 落知 +オヂ 尾地 +オチアイ 落合 +オチアイ 御地合 +オチアイ 小地合 +オチアイ 男知合 +オチアイ 灇 +オチアイドウ 落合堂 +オチイ 落井 +オチイシ 落石 +オチイシ 越知石 +オチイワ 落岩 +オチウチ 落内 +オチウミ 落海 +オチエダ 落枝 +オチカ 尾近 +オヂカ 小値賀 +オチカタ 彼方 +オチガミ 落神 +オチガメ 落亀 +オチカワ 落川 +オチカワ 落河 +オチグチ 落口 +オチクボ 落久保 +オチクボ 落窪 +オチコシ 落越 +オチサイ 落宰 +オチサカ 落坂 +オチザキ 落先 +オチシタ 落下 +オチセ 落瀬 +オチダ 落田 +オチダ 越智田 +オチタニ 落谷 +オチダニ 落谷 +オチタマリ 落溜 +オチツキ 落付 +オチノ 落野 +オチバ 落葉 +オチハタ 落畑 +オチハタ 落畠 +オチハラ 落原 +オチブ 落分 +オチフジ 落藤 +オチブシ 落伏 +オチベ 落部 +オチマチ 落町 +オチマル 落丸 +オチミズ 落水 +オチミズタ 落水田 +オチミズダ 落水田 +オチミチ 落道 +オチモト 落元 +オチモリ 落盛 +オチヤ 落谷 +オチヤス 落安 +オチヤマ 落山 +オチヤマ 尾知山 +オチャヤ 御茶屋 +オチョウ 雄長 +オツ 小津 +オツ 乙津 +オツ 乙 +オヅ 小津 +オヅ 小都 +オヅ 尾津 +オツイ 乙井 +オツウマ 乙馬 +オツエ 乙枝 +オヅエ 尾末 +オツカ 尾塚 +オヅカ 小塚 +オヅカ 尾塚 +オツガオ 乙顔 +オツカワ 乙川 +オツガワ 乙川 +オツキ 小槻 +オツキ 乙木 +オツキ 小月 +オツギ 小嗣 +オヅキ 小槻 +オヅキ 小築 +オヅキ 小月 +オツキノ 尾付野 +オツクニ 乙訓 +オツクラ 乙倉 +オツクロ 乙黒 +オツグロ 乙黒 +オツケガワ 苧漬川 +オツケガワ 荢漬川 +オツケノ 尾付野 +オッコソ 乙社 +オツコソ 乙社 +オッコツ 乙骨 +オツコツ 乙骨 +オツサカ 越坂 +オツザカ 乙坂 +オツシ 乙志 +オツジ 尾辻 +オツズキ 緒続 +オツセ 乙瀬 +オッタ 追田 +オツタ 乙田 +オツダ 乙田 +オツタカ 乙高 +オツタケ 乙武 +オツチ 乙地 +オツヅキ 緒続 +オツヅキ 尾続 +オツヅキ 緒續 +オツヅキ 尾續 +オツヅク 緒続 +オツヅク 緒續 +オツヅミ 小堤 +オヅツミ 小堤 +オヅツミ 尾堤 +オヅツミ 小提 +オツデ 乙出 +オツト 乙戸 +オツド 乙戸 +オツド 乙度 +オットサワ 越戸沢 +オットモ 乙供 +オツトモ 乙供 +オツナ 乙名 +オヅナ 小綱 +オツナリ 乙成 +オヅノ 小津野 +オヅノ 尾都野 +オツハタ 乙幡 +オッパタ 乙幡 +オツボ 小坪 +オツボ 尾坪 +オツボ 苧坪 +オツボ 荢坪 +オツマ 乙馬 +オツミ 越海 +オツミ 乙見 +オヅミ 小津美 +オツミチ 乙道 +オヅミナモト 小津源 +オツモリ 乙守 +オツモリ 乙森 +オツヤマ 乙山 +オヅラ 尾面 +オヅル 尾鶴 +オテ 小手 +オテ 尾手 +オデ 小手 +オデ 尾出 +オデ 尾手 +オデ 苧出 +オデイシ 小出石 +オテキ 樗木 +オテギ 樗木 +オデサキ 小出崎 +オテミズ 御手水 +オテモリ 小手森 +オデラ 小寺 +オデラ 尾寺 +オト 尾登 +オト 音 +オト 乙 +オト 尾戸 +オト 牡渡 +オド 小渡 +オド 小戸 +オド 小土 +オトイ 乙井 +オトイ 音居 +オトイ 音井 +オトイ 尾戸井 +オドイ 小土井 +オドイ 尾土井 +オドイ 於土井 +オトイシ 音石 +オトイシ 乙石 +オトイズミ 音泉 +オトイデ 音出 +オトイヌ 乙犬 +オトウ 尾藤 +オトウ 尾登 +オトウ 乙藤 +オトウ 尾頭 +オトウ 小桐 +オトウ 尾東 +オトウ 尾通 +オトウ 於東 +オドウ 尾堂 +オドウ 小堂 +オドウ 尾洞 +オトウチ 乙内 +オトウマ 乙馬 +オトウマ 音馬 +オトウラ 乙浦 +オトオ 響尾 +オトオ 音尾 +オドオリ 尾通 +オトガ 乙加 +オトガ 乙賀 +オトガオ 乙顔 +オトガサコ 乙ケ迫 +オトカタ 音堅 +オトカタ 音方 +オトカベ 乙ケ部 +オトガミ 音上 +オトカワ 乙川 +オトカワ 音川 +オトカワ 音河 +オトガワ 乙川 +オトガワ 音川 +オトカワウチ 乙河内 +オトキ 乙木 +オトギ 乙木 +オトキタ 音喜多(音喜夛) +オトキダ 小時田 +オトクニ 乙訓 +オトクボ 音窪 +オトクラ 乙倉 +オトグロ 乙黒 +オトゴ 乙子 +オトコイシ 男石 +オトコサワ 男澤 +オトコザワ 男沢 +オトコザワ 男澤 +オトゴト 音琴 +オトコナリ 男成 +オトコハラ 男原 +オトコマツ 男松 +オトコヤマ 男山 +オトザイ 音在 +オトサカ 乙坂 +オトサカ 音坂 +オトサキ 乙崎 +オトサキ 音崎 +オトザキ 乙崎 +オトザキ 音崎 +オトザコ 大戸迫 +オトザワ 音沢 +オトザワ 音澤 +オトシ 落 +オトシ 落司 +オトシ 落志 +オトジ 音地 +オトジ 乙地 +オトシオ 音塩 +オトシゲ 乙重 +オトシマ 音島 +オトシマ 音嶋 +オトシマ 乙島(乙嶋) +オトジマ 音島 +オトジマ 音嶋 +オトシロ 音城 +オトシロ 音代 +オトス 乙須 +オトズ 乙津 +オトセ 音瀬 +オトゼ 乙瀬 +オトソ 音曽 +オトゾロ 音揃 +オトダ 音田 +オトダ 乙田 +オトタカ 音高 +オトタケ 乙武 +オトタケ 乙竹 +オトタケ 音竹 +オトタニ 音谷 +オトタニ 乙谷 +オトダニ 音谷 +オトチ 乙地 +オトヂ 音地 +オトツ 乙津 +オトヅ 乙津 +オトヅ 音津 +オトヅキ 弟月 +オトツジ 音辻 +オトヅラ 乙貫 +オトデ 乙出 +オトデラ 音寺 +オトナ 乙名 +オトナガ 音永 +オトナギ 音𣷓 +オトナギ 音和 +オトナシ 音無 +オトナリ 音成 +オトナリ 乙成 +オトニ 乙二 +オトニシ 音西 +オトノ 音野 +オトノ 乙野 +オトノ 音納 +オトノ 小戸野 +オドノ 小道野 +オトノミヤ 音之宮 +オトハ 音羽 +オトバ 音羽 +オトバ 乙葉 +オトバ 音場 +オトバ 乙場 +オトハタ 乙幡 +オトハナ 音花 +オトハナ 乙花 +オトバネ 音羽 +オトハラ 乙原 +オドヒラ 尾土平 +オトヒロ 乙広(乙廣) +オトフジ 乙藤 +オトフジ 音藤 +オトブチ 音渕 +オトブチ 音淵 +オトベ 乙部 +オトベ 音部 +オトベ 乙辺(乙邊) +オトボ 乙保 +オトマ 乙間 +オトマ 乙馬 +オトマ 音間 +オトマキ 乙牧 +オトマサ 乙政 +オトマス 乙益 +オトマツ 音松 +オトマル 乙丸 +オトマル 音丸 +オトミ 音海 +オトミ 音見 +オドミ 小富 +オトミチ 音道 +オトミツ 音光 +オトミネ 音峰 +オトミネ 音峯 +オトムネ 乙宗 +オトムラ 乙村 +オトムラ 音村 +オトメ 乙咩 +オトメ 乙女 +オトメ 乙目 +オトメガワ 尾留川 +オトモ 小友 +オトモ 尾友 +オトモ 尾朝 +オトモ 乙母 +オトモダ 御供田 +オトモナイ 乙茂内 +オトモリ 乙守 +オトモリ 音森 +オトモリ 乙森 +オトヤ 乙谷 +オトヤチ 乙谷内 +オトヤマ 音山 +オトヤマ 乙山 +オトヨシ 乙吉 +オトヨシ 音吉 +オトラ 尾寅 +オドラ 小俵 +オトリ 尾鳥 +オトリ 雄鳥 +オドリ 小鳥 +オドリ 尾鳥 +オドリ 尾通 +オドリ 踊 +オドリガワ 小鳥川 +オドリセ 踊瀬 +オドリバ 踊場 +オドリバ 躍場 +オドリハシ 躍橋 +オドリバシ 躍橋 +オドリバシ 踊橋 +オトワ 音羽 +オトワ 乙葉 +オトワ 音葉 +オトワ 乙羽 +オトワキ 乙脇 +オトワタ 音綿 +オドンネル 王道練 +オナ 小名 +オナ 小奈 +オナ 尾名 +オナ 尾那 +オナイ 小内 +オナイ 尾内 +オナイ 女井 +オナエ 尾苗 +オナカ 小中 +オナカ 尾中 +オナカ 尾仲 +オナガ 翁長 +オナガ 小長 +オナガ 小永 +オナガ 尾長 +オナガ 尾永 +オナガノ 小長野 +オナカワ 女川 +オナガワ 女川 +オナガワ 小名川 +オナキ 小名木 +オナギ 小名木 +オナギ 小梛 +オナギ 小那木 +オナギ 男枝 +オナギ 小椰 +オナギ 尾凪 +オナグチ 尾名口 +オナサカ 小名坂 +オナザワ 女沢 +オナシ 尾無 +オナダ 小名田 +オナダ 女田 +オナタカ 尾名高 +オナダカ 尾名高 +オナトモ 女供 +オナノ 小名野 +オナハ 小那覇 +オナハラ 小名原 +オナブタ 女部田 +オナブチ 女渕 +オナブチ 女淵 +オナベ 小鍋 +オナベ 尾鍋 +オナベタ 女部田 +オナマチ 女町 +オナミ 尾浪 +オナミ 尾波 +オナヤ 女屋 +オナヤ 御魚谷 +オナヤ 小那谷 +オナヤマ 小名山 +オナリ 男成 +オナリ 尾成 +オナワ 小縄 +オナワ 尾縄 +オナワ 尾繩 +オニ 鬼 +オニ 尾仁 +オニイケ 鬼池 +オニイシ 鬼石 +オニイワ 鬼岩 +オニウダ 鬼生田 +オニウミ 鬼海 +オニオ 鬼尾 +オニオウ 鬼王 +オニオカ 鬼岡 +オニガイチ 鬼ケ一 +オニカゲ 鬼鹿毛 +オニカタ 鬼形 +オニカタ 鬼方 +オニガタ 鬼形 +オニガタ 鬼方 +オニカド 鬼門 +オニガハラ 鬼ケ原 +オニガマ 鬼釜 +オニカミ 鬼神 +オニカワ 鬼川 +オニキ 鬼木 +オニキ 鬼城 +オニキ 鬼気 +オニキ 鬼氣 +オニキリ 鬼切 +オニクボ 鬼久保 +オニクボ 鬼窪 +オニクマ 鬼熊 +オニクマ 小仁熊 +オニグマ 鬼熊 +オニクラ 鬼倉 +オニクラ 鬼鞍 +オニコ 鬼子 +オニコシ 鬼越 +オニサカ 鬼坂 +オニサキ 鬼崎(鬼嵜) +オニザキ 鬼崎(鬼嵜) +オニサダ 鬼定 +オニサワ 鬼沢 +オニサワ 鬼澤 +オニザワ 鬼沢 +オニザワ 鬼澤 +オニシ 尾西 +オニシ 雄西 +オニシ 識西 +オニシタ 鬼下 +オニシマ 鬼島 +オニズカ 鬼塚 +オニタ 鬼田 +オニタカ 鬼高 +オニタケ 鬼武 +オニタケ 鬼嶽 +オニタケ 鬼岳 +オニタケ 鬼竹 +オニタニ 鬼谷 +オニダニ 鬼谷 +オニツ 鬼津 +オニツカ 鬼塚 +オニツカ 鬼束 +オニヅカ 鬼塚 +オニヅカ 鬼束 +オニツカワキ 鬼塚脇 +オニヅカワキ 鬼塚脇 +オニヅル 鬼弦 +オニハシ 鬼橋 +オニハラ 鬼原 +オニヒラ 鬼平 +オニブチ 鬼渕 +オニマツ 鬼松 +オニマル 鬼丸 +オニムラ 鬼村 +オニメ 鬼目 +オニモト 鬼本 +オニヤナギ 鬼柳 +オニヤマ 鬼山 +オニワ 男庭 +オニワ 尾庭 +オニワ 御庭 +オニワキ 鬼脇 +オヌカ 小糠 +オヌカ 尾糠 +オヌカ 尾鴑 +オヌキ 小貫 +オヌキ 小抜 +オヌキ 尾抜(尾拔) +オヌキヤマ 小貫山 +オヌマ 小沼 +オヌマ 尾沼 +オネ 尾根 +オネクボ 小根久保 +オネザワ 小根沢 +オネザワ 小根澤 +オネザワ 尾根沢 +オネザワ 尾根澤 +オネダ 小根田 +オネダ 尾根田 +オネヤマ 小根山 +オネヤマ 尾根山 +オノ 小野 +オノ 尾野 +オノ 斧 +オノ 小埜 +オノ 苧野 +オノ 小生 +オノ 尾埜 +オノ 𨨞 +オノ 緒野 +オノ 尾能 +オノ 雄野 +オノイ 尾井 +オノイ 尾ノ井 +オノイ 小野井 +オノイ 尾位 +オノイエ 斧家 +オノイケ 小野池 +オノウ 小濃 +オノウ 小納 +オノウ 小能 +オノウ 小生 +オノウ 尾納 +オノウエ 尾上 +オノウエ 尾ノ上 +オノウエ 尾之上 +オノウエ 小野上 +オノウエ 尾野上 +オノウエ 小ノ上 +オノウエ 小野植 +オノウエ 小埜上 +オノウエ 尾の上 +オノウエ 㟽峯 +オノウシロ 尾後 +オノウシロ 尾ノ後 +オノウシロ 尾之後 +オノウチ 尾内 +オノウチ 小野内 +オノウチ 尾之内 +オノウチ 小野打 +オノウチ 斧内 +オノウラ 生浦 +オノエ 尾上 +オノエ 小野江 +オノエ 尾江 +オノエ 尾野江 +オノエ 尾之江 +オノエ 斧江 +オノエ 尾野恵 +オノオ 小尾 +オノオ 小野尾 +オノオ 小埜尾 +オノオ 斧生 +オノオ 斧尾 +オノオカ 小野岡 +オノオカ 尾ノ岡 +オノオチ 小野落 +オノカ 小野家 +オノガキ 小野垣 +オノガハラ 小野ケ原 +オノガミ 小野上 +オノガミ 斧上 +オノガヤ 小野谷 +オノカワ 小野川 +オノカワ 各川 +オノガワ 小野川 +オノガワ 各川 +オノガワ 尾野川 +オノガワ 斧川 +オノキ 小野木 +オノキ 斧木 +オノギ 小野木 +オノギ 斧木 +オノギ 小ノ木 +オノギ 小埜木 +オノギ 尾野木 +オノクチ 尾ノ口 +オノクチ 尾之口 +オノグチ 小野口 +オノグチ 相口 +オノグチ 斧口 +オノクビ 尾之首 +オノクボ 斧窪 +オノクラ 小野倉 +オノサカ 小野坂 +オノザカ 小野坂 +オノサキ 小野崎 +オノザキ 小野崎 +オノザキ 斧崎 +オノザキ 尾之崎 +オノザキ 小野嵜 +オノザキ 尾野崎 +オノサト 小野里 +オノサト 男里 +オノサト 尾之里 +オノザト 小野里 +オノサワ 小野沢 +オノサワ 小野澤 +オノサワ 小ノ澤 +オノサワ 斧沢 +オノサワ 斧澤 +オノザワ 小野沢 +オノザワ 小野澤 +オノザワ 小ノ澤 +オノザワ 斧沢 +オノザワ 小ノ沢 +オノザワ 斧澤 +オノザワ 小埜沢 +オノシ 尾熨斗 +オノジ 小野地 +オノシタ 尾下 +オノシタ 小野下 +オノシタ 尾ノ下 +オノシタ 尾之下 +オノシマ 小野島 +オノシマ 尾野島 +オノシマ 小野嶋 +オノシマ 尾野嶋 +オノジマ 小野島 +オノジマ 小野嶋 +オノシリ 尾尻 +オノシロ 尾城 +オノシロ 斧城 +オノズカ 小野塚 +オノズミ 小野住 +オノセ 小野瀬 +オノセ 尾野瀬 +オノゼキ 小野関 +オノソ 小野曽 +オノタ 小野田 +オノダ 小野田 +オノダ 斧田 +オノダ 尾野田 +オノダ 鉞田 +オノダ 小埜田 +オノダ 小ノ田 +オノダ 鈇田 +オノタカ 小野高 +オノダカ 小野高 +オノタニ 小野谷 +オノタニ 斧谷 +オノダニ 小野谷 +オノチ 小野地 +オノヅ 小野津 +オノツカ 小野塚 +オノヅカ 小野塚 +オノデ 斧出 +オノテラ 小野寺 +オノデラ 小野寺 +オノデラ 小埜寺 +オノデラ 尾野寺 +オノデラ 尾寺 +オノトウ 尾野藤 +オノトギ 斧研 +オノトラ 男虎 +オノトラ 男乕 +オノナ 小野名 +オノナイ 小野内 +オノノエ 柯 +オノハシ 小野橋 +オノハタ 尾野畑 +オノバヤシ 小野林 +オノバヤシ 斧林 +オノバヤシ 小能林 +オノハラ 小野原 +オノハラ 斧原 +オノハラ 小埜原 +オノバラ 小野原 +オノフサ 小野房 +オノフジ 小野藤 +オノブチ 斧渕 +オノブチ 斧淵 +オノベ 小野辺(小野邉) +オノベ 小野部 +オノベ 小野邊 +オノボシ 小野星 +オノボラ 斧洞 +オノボリ 尾登 +オノマ 小野間 +オノマ 尾間 +オノマ 尾野間 +オノマエ 尾前 +オノマエ 尾ノ前 +オノマエ 尾之前 +オノマタ 小野又 +オノマツ 小野松 +オノマツ 尾野松 +オノミ 小野美 +オノミチ 尾道 +オノミチ 尾路 +オノミチ 小之道 +オノミツ 小野満 +オノミヤ 尾宮 +オノミヤ 小野宮 +オノムラ 小野村 +オノムラ 恩村 +オノムラ 尾野村 +オノムラ 隠村 +オノムラ 斧村 +オノメ 小野目 +オノモト 尾本 +オノモト 小野本 +オノモト 尾野本 +オノモト 斧本 +オノモリ 小野森 +オノヤ 小野谷 +オノヤ 斧谷 +オノヤ 尾之家 +オノヤマ 尾山 +オノヤマ 小野山 +オノヤマ 斧山 +オノヤマ 小埜山 +オノヤマ 尾野山 +オノヤマ 小ノ山 +オノラ 小野良 +オバ 小場 +オバ 尾羽 +オバ 尾場 +オバ 小葉 +オバイ 小倍 +オバイシ 尾葉石 +オハカ 大波加 +オハク 尾白 +オバサ 小場佐 +オバサキ 大馬崎 +オバザワ 尾羽沢 +オバザワ 尾羽澤 +オハシ 小橋 +オハシ 尾橋 +オハシ 尾箸 +オバシ 小橋 +オバシ 尾橋 +オバシ 尾箸 +オバシマ 姨島 +オバシマ 姨嶋 +オバセ 小橋 +オバセ 小長谷 +オバセ 尾場瀬(尾塲瀬) +オバセ 尾長谷 +オバセ 尾初瀬 +オバセ 御場瀬 +オバセ 小場瀬 +オバセ 尾羽瀬 +オハタ 小幡 +オハタ 尾畑 +オハタ 御幡 +オハタ 尾畠 +オバタ 小畑 +オバタ 小幡 +オバタ 小俣 +オバタ 小畠 +オバタ 尾畑 +オバタ 御幡 +オバタ 小端 +オバタ 尾畠 +オバタ 小籏 +オバタ 尾幡 +オバタ 小旗 +オバタ 尾端 +オバタ 小羽田 +オバタ 織畠 +オバタ 小八田 +オバタ 小旛 +オバタ 小旙 +オバタ 巨畠 +オバタ 緒畑 +オバタ 苧畑 +オバタ 小圃 +オバタケ 小畑 +オバタケ 小畠 +オバタケ 尾畠 +オバタヤ 小幡谷 +オバナ 尾花 +オバナ 小花 +オバナ 尾鼻 +オバナ 尾端 +オバナ 尾華 +オバナ 緒花 +オハナヤマ 尾花山 +オバナヤマ 尾花山 +オバナワ 小花和 +オバネ 尾羽 +オバネ 尾羽根 +オババヤシ 尾羽林 +オハマ 小浜 +オハマ 小濱 +オハマ 尾浜 +オハマ 尾濱 +オバマ 小浜 +オバマ 小濱 +オバマ 小汀 +オバマ 尾濱 +オハヤ 尾早 +オバヤシ 小林 +オバヤシ 尾林 +オバヤシ 緒林 +オバヤマ 姑山 +オハラ 小原 +オハラ 尾原 +オハラ 苧原 +オハラ 荢原 +オバラ 小原 +オバラ 尾原 +オバラ 遠原 +オバラ 苧原 +オバラギ 小原木 +オハラザワ 小原沢 +オハラザワ 小原澤 +オバラザワ 小原沢 +オバラザワ 小原澤 +オハラダ 小原田 +オハラヤ 尾原家 +オハリ 尾張 +オハリ 尾針 +オバリ 小針 +オバリ 小張 +オバリ 尾針 +オハリベ 尾張部 +オバル 小原 +オバル 尾原 +オハルダ 小原田 +オビ 小尾 +オビ 帯 +オビ 尾日 +オビ 小枇 +オビイ 帯井(帶井) +オビカ 小比賀 +オビカ 大比賀 +オビカ 帯賀(帶賀) +オビカ 小比加 +オビカ 小毘賀 +オビカ 尾比賀 +オビガ 帯賀(帶賀) +オヒガシ 尾東 +オビカタ 大日方 +オビカネ 帯金 +オビカネ 帯包 +オビカネ 帶金 +オビカネ 帶包 +オビガネ 帯金 +オビガネ 帯包 +オビガネ 帶金 +オビカワ 帯川 +オビカワ 大日川 +オビカワ 帶川 +オビキ 小引 +オビキ 尾引 +オビシマ 帯島 +オビシャク 帯杓(帶杓) +オビセ 帯瀬 +オビセ 帯施(帶施) +オビセ 帶瀬 +オビタ 帯田 +オビタ 帶田 +オビタニ 帯谷 +オビタニ 尾美谷 +オビツ 小櫃 +オビツ 帯津 +オビツ 尾櫃 +オビツ 尾比津 +オビト 帯戸 +オビナ 帯名 +オビナガ 帯永 +オビナガ 帯長 +オヒナタ 尾日向 +オビナタ 大日方 +オビナタ 小日向 +オビナタ 大日向 +オビナタ 帯刀 +オビナタ 尾日向 +オビナタ 帯向 +オビナタ 帶刀 +オビナタ 帶向 +オビノ 帯野 +オビハラ 帯原 +オビベ 帯部 +オビモリ 帯盛 +オビヤ 帯谷 +オビヤ 帯屋(帶屋) +オビヤ 帶谷 +オビヤマ 帯山(帶山) +オヒラ 尾平 +オビラ 尾平 +オヒラノ 尾平野 +オビラノ 尾平野 +オビロ 尾広 +オビロ 尾廣 +オブ 小賦 +オブ 小夫 +オブ 尾生 +オブ 飫富 +オブ 飫冨 +オブカタ 生方 +オブカタ 小生方 +オブカワ 小生川 +オブキ 小吹 +オブキ 尾吹 +オブキ 小浮気 +オブクロ 小袋 +オフジ 尾藤 +オブセ 小布施 +オブタ 産田 +オブタ 生多(生夛) +オブチ 小渕 +オブチ 小淵 +オブチ 尾淵 +オブチ 尾渕 +オブチ 尾駮 +オブナイ 小船井(小舩井) +オブナイ 小武内 +オブナイ 御武内 +オブナイ 小父内 +オブナイ 小舩内(小船内) +オブネ 小船 +オフネヤ 御船谷 +オフネヤ 小船屋 +オブノ 生野 +オブヤ 尾生屋 +オベ 小部 +オベ 遠部 +オベ 尾部 +オベ 尾辺(尾邉) +オベ 尾邊 +オベヤマ 小部山 +オホ 於保 +オボ 於保 +オボウチ 小保内 +オボエカタ 覚方 +オボガイ 大保貝 +オボカタ 小保方 +オボカタ 小保形 +オボカタ 覚方 +オボカタ 大保方 +オボカタ 小生方 +オボカワ 小保川 +オボクキ 朴木 +オボソ 小細 +オボテ 尾保手 +オボナイ 小保内 +オボナイ 生内 +オボナイ 生保内 +オホリ 尾堀 +オボロ 朧 +オボロケ 朧気 +オボロケ 朧氣 +オボロゲ 朧毛 +オボロヤ 朧谷 +オマ 小間 +オマ 尾間 +オマエ 尾前 +オマガリ 尾曲 +オマガリ 小曲 +オマガリ 小釣 +オマガリ 小鈎 +オマキ 尾牧 +オマタ 小俣 +オマタ 小又 +オマタ 尾又 +オマタ 尾股 +オマタ 尾亦 +オマタ 小股 +オマタ 男全 +オマタ 小亦 +オマタ 尾俣 +オマタ 尾叉 +オマタ 尾真田 +オマチ 小町 +オマチ 尾町 +オマツ 尾松 +オマツ 雄松 +オマツ 男松 +オマトイ 御纒 +オマトイ 御纏 +オマヤ 尾間谷 +オマル 小丸 +オミ 小見 +オミ 尾身 +オミ 尾見 +オミ 尾美 +オミ 淤見 +オミ 麻績 +オミ 麻見 +オミ 臣 +オミ 小箕 +オミ 尾味 +オミカ 五十殿 +オミカド 尾見門 +オミカワ 小見川 +オミカワ 小美川 +オミガワ 小見川 +オミガワ 小海川 +オミズ 生水 +オミズ 尾水 +オミゾ 尾溝 +オミタニ 尾見谷 +オミタニ 尾美谷 +オミチ 尾路 +オミチ 尾通 +オミデラ 小見寺 +オミネ 小峰 +オミネ 小峯 +オミノ 小美濃 +オミノ 小美野 +オミノ 小見野 +オミノ 尾美野 +オミブチ 小見渕 +オミブチ 小見淵 +オミヤ 尾宮 +オム 尾無 +オムカ 五十殿 +オムカイ 尾向 +オムラ 大村 +オムラ 小椋 +オムラ 小村 +オムラ 尾村 +オムラ 麻村 +オムラ 尾邑 +オムロ 小室 +オムロ 御室 +オムロ 尾室 +オメ 尾目 +オメシ 尾食 +オメジマ 男女島 +オメジマ 男女嶋 +オモ 面 +オモ 尾茂 +オモ 尾毛 +オモイ 飯井 +オモイ 重茂 +オモイ 思 +オモイ 尾茂井 +オモイ 面井 +オモイ 思井 +オモイ 想 +オモイ 恩井 +オモイシ 重石 +オモイダ 思田 +オモウ 尾毛 +オモウエ 表上 +オモウチ 表内 +オモエ 重茂 +オモガイ 沢海 +オモガイ 澤海 +オモカゲ 面影 +オモカベ 面壁 +オモガミ 面上 +オモカワ 重川 +オモカワ 面川 +オモカワ 表川 +オモカワ 尾毛川 +オモカワ 思川 +オモキ 面木 +オモキ 隆埼(隆琦) +オモクテ 面湫 +オモサキ 面崎 +オモザキ 表崎 +オモサコ 面迫 +オモジ 面地 +オモシキ 表敷 +オモシタ 重下 +オモシタ 面下 +オモシロ 面代 +オモシロ 面白 +オモジロ 面代 +オモス 重栖 +オモソ 重親 +オモソ 面曽 +オモソ 面曾 +オモタ 重田 +オモタ 面田 +オモダ 重田 +オモダ 面田 +オモダ 表田 +オモダ 尾茂田 +オモダ 思田 +オモダ 於茂田 +オモタカ 面高 +オモダカ 面高 +オモダカ 沢潟 +オモダカ 澤潟 +オモダカ 沢瀉 +オモダカ 澤瀉 +オモダチ 面城 +オモタニ 重谷 +オモタニ 面谷 +オモタニ 表谷 +オモタニ 遠茂谷 +オモダニ 面谷 +オモダニ 遠茂谷 +オモタミ 面民 +オモチ 尾持 +オモツボ 面坪 +オモテ 表 +オモテ 面 +オモテ 面手 +オモデ 面出 +オモテイ 表井 +オモテウラ 表浦 +オモテカワ 表川 +オモテガワ 表川 +オモテガワ 表側 +オモテギ 表木 +オモテグチ 表口 +オモテサコ 表迫 +オモテザコ 表迫 +オモテシマ 表嶋 +オモテシンメイ 表神明 +オモテダ 表田 +オモテダニ 表谷 +オモテデ 表出 +オモテニシ 表西 +オモテノ 表野 +オモテハラ 表原 +オモテマエ 表前 +オモテモト 表本 +オモテモリタ 表森田 +オモテヤ 表谷 +オモテヤ 表家 +オモテヤマ 表山 +オモテヤマ 面山 +オモテラ 表寺 +オモデラ 表寺 +オモト 尾本 +オモト 小本 +オモト 小元 +オモト 於本 +オモト 尾元 +オモト 緒本 +オモト 苧本 +オモト 夫本 +オモトバラ 尾本原 +オモナイ 面内 +オモナガ 重長 +オモニシ 重西 +オモニシ 表西 +オモノ 面野 +オモノ 太茂野 +オモバヤシ 面林 +オモハラ 小面原 +オモヒラ 面平 +オモミ 表見 +オモムラ 面村 +オモモト 面本 +オモヤ 重谷 +オモヤ 面谷 +オモヤ 表谷 +オモヤ 面家 +オモヤ 面屋 +オモヤ 面矢 +オモヤ 重矢 +オモヤ 重家 +オモヤ 重舎 +オモヤ 尾茂谷 +オモヤ 尾茂弥 +オモヤ 表屋 +オモヤ 重屋 +オモヤ 母屋 +オモライ 面来 +オモリ 小森 +オモリ 尾森 +オモロ 小室 +オヤ 小屋 +オヤ 尾家 +オヤ 雄谷 +オヤ 尾矢 +オヤ 尾屋 +オヤ 親 +オヤ 小弥 +オヤ 屋家 +オヤイ 親井 +オヤイズ 小柳津 +オヤイズ 大柳豆 +オヤイヅ 小柳津 +オヤイヅ 尾焼津 +オヤイヅ 大柳津 +オヤイデ 小柳出 +オヤエ 親衛 +オヤカワ 親川 +オヤガワ 親川 +オヤキ 親木 +オヤギ 大八木 +オヤギ 小八木 +オヤギ 小谷木 +オヤケ 小宅 +オヤケ 尾宅 +オヤケ 尾屋家 +オヤケ 親家 +オヤザキ 親崎 +オヤサト 親里 +オヤザト 親里 +オヤザワ 小谷沢 +オヤザワ 小谷澤 +オヤシキ 御屋敷 +オヤシキ 尾屋敷 +オヤジマ 尾矢島 +オヤタ 親田 +オヤダ 親田 +オヤタニ 親谷 +オヤツ 小柳津 +オヤド 尾矢戸 +オヤトマリ 親泊 +オヤドマリ 親泊 +オヤナ 御簗 +オヤナギ 小柳 +オヤナギ 大柳 +オヤナギ 尾柳 +オヤノ 小谷野 +オヤノキ 親木 +オヤバヤシ 親林 +オヤブ 小薮 +オヤフソ 親富祖 +オヤブネ 大屋船 +オヤブネ 大矢船 +オヤベ 小谷部 +オヤベ 小矢部 +オヤベ 親部 +オヤマ 小山 +オヤマ 尾山 +オヤマ 雄山 +オヤマ 男山 +オヤマタ 小山田 +オヤマダ 小山田 +オヤマツ 親松 +オヤマツ 小谷松 +オヤマツ 小山松 +オヤマツ 新谷松 +オヤミ 親見 +オヤモト 親本 +オヤモト 親元 +オヤモリ 親盛 +オヨイ 及位 +オヨカワ 及川 +オヨガワ 及川 +オヨシ 尾吉 +オヨビカワ 及川 +オヨビキ 及木 +オヨベ 及部 +オヨリ 尾寄 +オライ 生頼 +オラナカ 緒良中 +オリ 小里 +オリ 織 +オリ 折 +オリ 尾利 +オリイ 折井 +オリイ 折居 +オリイ 織井 +オリイ 下居 +オリイ 織居 +オリイケ 折池 +オリイシ 居石 +オリウ 折宇 +オリウチ 折内 +オリウチ 織内 +オリエ 織江 +オリエ 折江 +オリエ 織衛 +オリエ 織恵 +オリオ 折尾 +オリオ 織尾 +オリオカ 織岡 +オリオカ 折岡 +オリオク 織奥 +オリオノ 折小野 +オリオノ 遠里小野 +オリカケ 折懸 +オリカケ 織掛 +オリガケ 織掛 +オリカサ 折笠 +オリカサ 織笠 +オリガサ 折笠 +オリガサ 織笠 +オリカタ 織方 +オリカタ 折方 +オリカナイ 居ケ内 +オリガナイ 居ケ内 +オリカネ 織金 +オリカネ 折金 +オリガネ 織金 +オリガネ 折金 +オリカベ 織壁 +オリカベ 折壁 +オリカミ 折上 +オリカミ 折紙 +オリガミ 折上 +オリカワ 居川 +オリカワ 渡川 +オリカワ 折川 +オリカワ 織川 +オリカワ 折河 +オリキ 折木 +オリク 折工 +オリクキ 折久木 +オリクス 折楠 +オリクチ 折口 +オリグチ 折口 +オリグチ 織口 +オリクラ 折倉 +オリコシ 折越 +オリコノ 折小野 +オリコミ 折込 +オリサカ 折坂 +オリサカ 折阪 +オリサカ 織坂 +オリサキ 折崎 +オリサク 織作 +オリジ 織地 +オリシキ 折敷 +オリシキセ 折敷瀬 +オリシキタ 折式田 +オリシキダ 折式田 +オリシキデ 折敷出 +オリシゲ 折重 +オリシタ 折下 +オリシマ 居島 +オリシマ 折島 +オリシマ 織島 +オリシモ 折下 +オリシモ 折霜 +オリスギ 折杉 +オリソ 折祖 +オリソ 折租 +オリタ 織田 +オリタ 折田 +オリタ 織多 +オリタ 小里田 +オリダ 織田 +オリダ 折田 +オリタエ 折田衛 +オリタカ 折高 +オリタキ 折滝 +オリタキ 折瀧 +オリタケ 折竹 +オリタテ 折舘 +オリタテ 折館 +オリタテ 折立 +オリタテ 織立 +オリダテ 折舘 +オリダテ 折館 +オリタニ 折谷 +オリタニ 織谷 +オリチ 織地 +オリチ 折地 +オリツ 折津 +オリツキ 折付 +オリツキ 織附 +オリツキ 折附 +オリヅル 折鶴 +オリテ 折手 +オリデ 折出 +オリデ 折手 +オリデ 尾利出 +オリト 折戸 +オリト 織戸 +オリト 下戸 +オリト 折登 +オリト 居戸 +オリト 下渡 +オリト 折藤 +オリド 折戸 +オリド 織戸 +オリトウ 折藤 +オリドウ 通堂 +オリトヤ 折登谷 +オリトヤ 折戸谷 +オリナカ 折中 +オリナミ 折浪 +オリノ 折野 +オリノ 織野 +オリノウチ 折之内 +オリハ 折羽 +オリハ 折端 +オリバ 折葉 +オリバ 折場 +オリバ 織羽 +オリハギ 折萩 +オリバサワ 折場沢(折場澤) +オリハシ 折橋 +オリハシ 渡橋 +オリハシ 居橋 +オリハシ 織橋 +オリハタ 織畠 +オリハタ 織畑 +オリハタ 折畑 +オリバヤシ 折林 +オリバヤシ 織林 +オリハラ 折原 +オリハラ 織原 +オリハラ 折腹 +オリヒラ 織平 +オリヒラ 折平 +オリフ 折附 +オリベ 織部 +オリベ 織辺 +オリベ 折部 +オリベ 織邊 +オリマ 織間 +オリマ 折間 +オリマス 折増 +オリマル 織丸 +オリミ 折見 +オリミ 折美 +オリミチ 折道 +オリミナミ 折南 +オリムラ 折村 +オリメ 折目 +オリメ 折免 +オリメン 折免 +オリモ 織茂 +オリモ 折茂 +オリモ 織裳 +オリモ 折毛 +オリモ 織毛 +オリモト 折本 +オリモト 織本 +オリモト 折元 +オリモト 居本 +オリモト 織元 +オリヤ 折谷 +オリヤ 織谷 +オリヤ 織家 +オリヤ 織屋 +オリヤス 折安 +オリヤマ 折山 +オリヤマ 織山 +オリュウ 尾立 +オリュウ 尾流 +オリュウド 大柳戸 +オリョウ 雄龍 +オリョウ 雄竜 +オリヨセ 折寄 +オルカワ 尾留川 +オルソン 於留尊 +オロ 小路 +オロ 尾路 +オロ 尾呂 +オロ 苙 +オロカワ 卸川 +オロク 小禄 +オロク 小祿 +オログチ 苙口 +オロシ 下石 +オロシ 尾呂志 +オロジ 下石 +オロシバ 颪柴 +オロシベ 颪辺 +オロシベ 颪邊 +オロシマ 小路島 +オロタ 尾呂田 +オワ 大和 +オワ 尾和 +オワイ 大饗 +オワカ 尾若 +オワキ 尾脇 +オワケ 尾分 +オワザキ 大和崎 +オワシ 尾鷲 +オワシ 小鷲 +オワセ 小和瀬 +オワセ 尾和瀬 +オワダ 小和田 +オワダ 尾和田 +オワタリ 尾渡 +オワノ 小和野 +オワリ 尾張 +オワリ 尾割 +オワリベ 尾張部 +オワリヤ 尾張谷 +オンガ 大神 +オンガ 恩賀 +オンガ 恩河 +オンガ 音賀 +オンカイ 恩海 +オンカワ 恩河 +オンカワ 恩川 +オンカワ 温川 +オンガワ 恩河 +オンキ 御木 +オングウジ 御宮司 +オングウジ 御宮寺 +オングウチ 御宮知 +オンクラ 御倉 +オンコ 御古 +オンコウジ 音光寺 +オンコシ 御輿 +オンザ 遠座 +オンザキ 恩崎 +オンザキ 温崎 +オンザワ 恩沢 +オンザワ 恩澤 +オンザワ 隠沢(隠澤) +オンシ 恩氏 +オンジ 恩地 +オンジ 生地 +オンジ 陰地 +オンジ 音地 +オンジ 隠地 +オンジ 蔭地 +オンジ 遠地 +オンジ 穏地 +オンジ 隂地 +オンジ 恩慈 +オンシゲ 恩重 +オンジマエ 隠地前 +オンショウ 恩庄 +オンジョウ 園城 +オンジョウ 遠城 +オンジョウ 恩庄 +オンジョウジ 園城寺 +オンズカ 隠塚 +オンズカ 恩塚 +オンセ 温勢 +オンセン 温泉 +オンソ 園曽 +オンソ 園曾 +オンソ 恩曽 +オンソ 恩曾 +オンゾウ 恩蔵 +オンゾウ 恩藏 +オンゾロ 音揃 +オンタ 恩田 +オンタ 音田 +オンタ 隠田 +オンタ 温田 +オンダ 恩田 +オンダ 遠田 +オンダ 音田 +オンダ 御田 +オンダ 隠田 +オンダ 温田 +オンダ 思田 +オンダ 恩多 +オンダ 穏田 +オンダ 負田 +オンダ 隱田 +オンダイ 穏台 +オンタチ 御舘 +オンタチ 御館 +オンタニ 恩谷 +オンチ 恩地 +オンチ 音地 +オンチ 隠地 +オンチ 恩智 +オンチ 恩知 +オンヂ 恩地 +オンヂ 生地 +オンヂ 陰地 +オンヂ 音地 +オンヂ 隠地 +オンヂ 蔭地 +オンヂ 遠地 +オンチュウジ 恩仲寺 +オンヅ 恩津 +オンツカ 隠塚 +オンツカ 恩塚 +オンツカ 御塚 +オンヅカ 隠塚 +オンヅカ 恩塚 +オンド 穏土 +オンド 隠土 +オンド 隠渡 +オンド 穏渡 +オンド 音渡 +オンド 音土 +オンドウ 恩藤 +オンドウ 音頭 +オンドウ 音堂 +オンドウ 恩道 +オントク 恩徳 +オンドリ 雄 +オンナ 恩納 +オンナガワ 女川 +オンナザカ 女坂 +オンナザワ 女沢 +オンナザワ 女澤 +オンナトモ 女供 +オンノ 恩納 +オンノ 御野 +オンベ 遠部 +オンベ 恩幣 +オンベ 御辺(御邊) +オンベ 恩部 +オンボウ 恩房 +オンマ 小馬 +オンマ 恩馬 +オンマエ 御前 +オンマヤ 御厩 +オンマヤシキ 御厩敷 +オンマヤシキ 御廐敷 +オンミョウジ 隠明寺 +オンムラ 恩村 +オンモト 恩本 +オンモリ 御守 +オンヤマ 御山 +オンヤマ 温山 +オンリンジ 園林寺 +カ 果 +ガ 何 +カアイ 河合 +カアイ 河相 +カアイ 嘉会(嘉會) +カアイ 鍛合 +カアワ 河輪 +カイ 甲斐 +カイ 槐 +カイ 貝 +カイ 加井 +カイ 改井 +カイ 改 +カイ 海 +カイ 会 +カイ 香井 +カイ 賀井 +カイ 開井 +カイ 貝井 +カイ 會 +カイ 嘉井 +カイ 甲伊 +カイ 買 +カイ 櫂 +ガイ 賀井 +ガイ 雅意 +カイアミ 貝阿弥 +カイアミ 貝阿彌 +カイアン 海庵 +カイイ 改井 +カイイ 開井 +カイイ 戒井 +カイイ 貝井 +カイイ 開居 +カイイソ 海磯 +カイウチ 海内 +カイウチ 皆内 +カイウメ 貝梅 +カイウラ 海浦 +カイウン 海雲 +カイエ 貝江 +カイエ 解江 +カイエイ 海永 +カイエダ 海江田 +カイエダ 階枝 +カイエツ 海悦 +カイエモト 海江元 +カイオ 海生 +カイオ 開尾 +カイオ 貝尾 +カイオウ 貝応(貝應) +カイオカ 海岡 +カイカ 開化 +カイガ 海賀 +カイガ 貝賀 +カイガ 改賀 +カイガイ 海外 +カイガイ 戒外 +カイガイシ 貝ケ石 +カイガク 海嶽 +カイガク 海岳 +カイガクラ 海ケ倉 +カイカケ 貝掛 +カイカタ 海方 +カイガネ 海金 +カイガミ 甲斐上 +カイカメ 会亀 +カイガメ 会亀 +カイガラ 貝柄 +カイガラ 貝殻 +カイカワ 海川 +カイカワ 貝川 +カイカワ 会川 +カイカワ 甲斐川 +カイカワ 開川 +カイカワ 階川 +カイガワ 粥川 +カイガワ 海川 +カイガワ 貝川 +カイガワ 会川 +カイガワ 會川 +カイガワ 甲斐川 +カイガン 海岸 +カイキ 海木 +カイキ 貝木 +カイキ 改喜 +カイキ 改木 +カイキ 海気(海氣) +カイキ 海基 +カイギ 海木 +カイキタ 海北 +カイキリ 海切 +カイキリ 甲斐切 +カイギリ 甲斐切 +カイグチ 海口 +カイグチ 開口 +カイグチ 貝口 +カイグチ 改口 +カイグチ 渫口 +カイクボ 界久保 +カイクボ 貝久保 +カイクラ 皆倉 +カイケ 貝家 +カイゲ 海下 +カイゲ 界外 +カイゲ 皆下 +カイゲ 階下 +カイゲ 貝毛 +カイケイ 海恵 +カイゲツ 海月 +カイゲン 開現 +カイコ 海子 +カイゴ 飼牛 +カイゴ 海後 +カイゴ 海子 +カイゴ 解語 +カイゴ 海呉 +カイゴ 飼午 +カイコイ 海古井 +カイコウ 開高 +カイコウ 皆光 +カイコウ 海光 +カイコウ 開光 +カイゴウ 飼牛 +カイゴウ 皆合 +カイゴウ 海郷 +カイコウドウ 改光堂 +カイコギ 貝漕 +カイコグ 貝漕 +カイコシ 貝越 +カイゴメ 開米 +カイサカ 開坂 +カイサカ 貝坂 +カイサカ 皆坂 +カイサカ 海阪 +カイサカ 貝阪 +カイサカ 会坂(會坂) +カイサカ 海坂 +カイザカ 開坂 +カイサキ 海崎 +カイサキ 貝崎 +カイサキ 甲斐崎 +カイサキ 会崎 +カイザキ 海崎 +カイザキ 貝崎 +カイザキ 甲斐崎 +カイザキ 皆崎 +カイザキ 開崎 +カイザキ 改崎 +カイザキ 会崎 +カイザキ 海嵜 +カイザキ 甲斐埼 +カイサク 開作 +カイサク 櫂作 +カイサク 海作 +カイサコ 貝迫 +カイサト 回里 +カイザワ 貝沢 +カイザワ 開沢 +カイザワ 貝澤 +カイザワ 海沢 +カイザワ 甲斐沢 +カイザワ 螺沢 +カイザワ 海澤 +カイザワ 開澤 +カイザワ 螺澤 +カイザワ 甲斐澤 +カイザン 海山 +カイシ 海司 +カイシ 海士 +カイジ 海地 +カイジ 貝路 +カイシオ 海塩 +カイシキ 開敷 +カイシキ 貝敷 +カイシゲ 戒重 +カイシタ 海下 +カイシタ 甲斐下 +カイシタ 階下 +カイシマ 貝島 +カイシマ 貝嶋 +カイシマ 海島 +カイシマ 甲斐島 +カイシマ 開島 +カイシマ 海嶋 +カイシマ 開嶋 +カイジマ 貝島 +カイジマ 貝嶋 +カイジマ 甲斐島 +カイジマ 甲斐嶋 +カイシャクジ 皆尺寺 +カイシュ 開主 +カイジュ 改寿(改壽) +カイシュウ 海修 +カイジュウ 海住 +カイジュン 会順 +カイショ 会所 +カイショ 會所 +カイショウ 改正 +カイショウ 魁生 +カイショウ 甲斐荘(甲斐莊) +カイジョウ 海上 +カイジョウ 甲斐上 +カイジョウ 開上 +カイジョウ 海乗 +カイジョウ 海城 +カイショウイン 快勝院 +カイジリ 貝尻 +カイジリ 海尻 +カイジン 海神 +カイス 貝洲 +カイズ 海津 +カイズ 海洲 +カイスカ 海須賀 +カイズカ 貝塚 +カイズキ 海月 +カイズマ 海妻 +カイスミ 海隅 +カイズミ 海住 +カイズミ 貝澄 +カイズミ 改泉 +カイズミ 貝住 +カイズミ 香泉 +カイセ 貝瀬 +カイセ 海瀬 +カイセ 皆瀬 +カイセ 改瀬 +カイセ 改世 +カイセイ 改正 +カイセキ 貝石 +カイセド 海勢頭 +カイセン 廻船 +カイセン 皆銭 +カイセン 廻舩 +カイセン 開泉 +カイセン 開船 +カイゼン 海善 +カイゼン 海前 +カイゼン 開前 +カイソ 海磯 +カイソ 海礒 +カイソ 貝磯 +カイソ 鹿磯 +カイソ 鹿礒 +カイソウ 海藻 +カイゾウ 海蔵 +カイゾウ 海藏 +カイゾウ 貝蔵(貝藏) +カイゾウジ 海蔵寺 +カイゾウジ 海藏寺 +カイタ 会田 +カイタ 海田 +カイタ 甲斐田 +カイタ 開田 +カイタ 貝田 +カイタ 會田 +カイタ 改田 +カイタ 皆田 +カイタ 飼田 +カイダ 会田 +カイダ 海田 +カイダ 甲斐田 +カイダ 開田 +カイダ 貝田 +カイダ 會田 +カイダ 改田 +カイダ 戒田 +カイダ 皆田 +カイダ 廻田 +カイダ 飼田 +カイダ 買田 +カイダ 介田 +カイダ 界田 +カイタカ 海高 +カイタツ 海達 +カイダツ 海達 +カイダテ 海立 +カイダテ 貝舘 +カイタニ 海谷 +カイタニ 貝谷 +カイタニ 廻谷 +カイタニ 甲斐谷 +カイタニ 皆谷 +カイタニ 櫂谷 +カイタニ 飼谷 +カイタニ 開谷 +カイタニ 戒谷 +カイダマ 甲斐玉 +カイタヤ 貝田谷 +カイタヤ 貝田屋 +カイダン 海段 +カイチ 垣内 +カイチ 開地 +カイチ 海地 +カイチ 海内 +カイチ 鶏内 +カイチ 皆内 +カイチ 開市 +カイチ 海知 +カイチ 階地 +カイチ 加市 +カイチ 海池 +カイチ 開智 +カイチ 貝市 +カイチ 鷄内 +カイチダ 垣内田 +カイツ 海津 +カイツ 貝津 +カイツ 皆津 +カイヅ 海津 +カイヅ 会津 +カイヅ 貝津 +カイツウマル 貝通丸 +カイツカ 貝塚 +カイツカ 海塚 +カイツカ 皆塚 +カイツカ 貝柄 +カイヅカ 貝塚 +カイヅカ 海塚 +カイヅカ 皆塚 +カイヅカ 械塚 +カイヅカ 具塚 +カイヅカヤ 貝塚谷 +カイヅキ 海月 +カイツジ 貝辻 +カイヅマ 海妻 +カイヅマ 加井妻 +カイツルマル 飼鶴丸 +カイテ 買手 +カイテ 飼手 +カイデ 貝出 +カイデ 海出 +カイデ 買手 +カイデ 飼手 +カイデ 開出 +カイデ 鶏冠井 +カイデ 賀出 +カイデ 甲斐出 +カイデイ 楓井 +カイテヤ 買手屋 +カイデン 海田 +カイデン 開田 +カイデン 改田 +カイデン 皆伝(皆傳) +カイデン 鷄冠井 +カイト 垣内 +カイト 階戸 +カイト 海渡 +カイト 皆戸 +カイト 貝戸 +カイト 海戸 +カイト 垣外 +カイト 垣戸 +カイト 改戸 +カイト 開渡 +カイト 墻内 +カイド 階戸 +カイド 海渡 +カイド 貝戸 +カイド 海戸 +カイド 峡戸 +カイド 峽戸 +ガイト 外戸 +カイトウ 垣内 +カイトウ 海藤 +カイトウ 皆藤 +カイトウ 海東 +カイトウ 開藤 +カイトウ 貝藤 +カイトウ 海透 +カイトウ 改藤 +カイトウ 海頭 +カイトウ 海籐 +カイトウ 皆籐 +カイドウ 海藤 +カイドウ 皆藤 +カイドウ 海東 +カイドウ 海道 +カイドウ 街道 +カイドウ 開道 +カイドウ 開藤 +カイドウ 階堂 +カイドウ 海棠 +カイドウ 改藤 +カイドウ 海堂 +カイドウ 改働 +カイドウ 改道 +カイドウ 皆堂 +カイドウ 開籐 +カイドウ 階藤 +カイドウ 貝道 +カイドウ 甲斐道 +カイトク 海徳 +カイトク 海読(海讀) +カイトク 皆徳 +カイトク 開徳 +カイトジリ 垣内尻 +カイトダ 海戸田 +カイトナカ 垣外中 +カイトナカ 皆戸中 +カイトナカ 垣内中 +カイトミ 海冨 +カイトリ 飼鳥 +カイトリ 貝取 +カイナ 荷稲 +カイナイ 海内 +カイナカ 甲斐中 +カイナガ 海永 +カイナガ 貝長 +カイナミ 海波 +カイヌキ 貝貫 +カイヌマ 貝沼 +カイヌマ 海沼 +カイヌマ 開沼 +カイヌマ 飼沼 +カイヌマ 甲斐沼 +カイネ 海稲 +カイネ 甲斐根 +カイノ 海野 +カイノ 貝野 +カイノ 甲斐野 +カイノ 会野(會野) +カイノ 改野 +カイノ 開野 +カイノ 飼野 +カイノ 戒野 +カイノ 加井野 +カイノ 廻野 +カイノ 改之 +カイノ 海農 +カイノ 界野 +カイノ 甲斐埜 +ガイノ 我伊野 +カイノウ 戒能 +カイノウ 海農 +カイノウ 戎能 +カイノウチ 開ノ内 +カイノオ 海野尾 +カイノショウ 甲斐荘(甲斐莊) +カイノセ 貝之瀬 +カイノセ 貝野瀬 +カイノセ 海野瀬 +カイノセ 貝ノ瀬 +カイハ 貝羽 +カイバ 買場 +カイバ 海馬 +カイバ 飼馬 +カイバ 開場 +カイバ 海場 +カイバ 飼場 +カイハイ 貝灰 +カイバイ 貝梅 +カイバサワ 海馬沢 +カイバサワ 海馬澤 +カイバザワ 海馬沢 +カイバザワ 海馬澤 +カイハタ 貝畑 +カイハツ 開発 +カイハツ 改発 +カイハツ 海発 +カイハツ 貝発(貝發) +カイハツ 開發 +カイハツ 改發 +カイハツ 海發 +カイハツ 開初 +カイハマ 海浜(海濱) +カイハミ 貝岐 +カイバミ 貝喰 +カイハラ 貝原 +カイハラ 海原 +カイハラ 開原 +カイハラ 甲斐原 +カイハラ 飼原 +カイハラ 改原 +カイハラ 買原 +カイバラ 貝原 +カイバラ 海原 +カイバラ 開原 +カイバラ 甲斐原 +カイバラ 飼原 +カイバラ 塊原 +カイハラヅカ 貝原塚 +カイヒラ 開平 +カイフ 海部 +カイフ 海富 +カイフ 海浮 +カイフ 海冨 +カイフ 海風 +カイフ 海府 +カイフ 貝生 +カイフ 甲府 +カイブ 海部 +カイフウ 海風 +カイフキ 貝吹 +カイブキ 貝吹 +カイフク 貝吹 +カイフク 海福 +カイフク 皆福 +カイフク 買福 +カイフチ 貝渕 +カイフチ 貝淵 +カイフチ 海渕 +カイブチ 貝渕 +カイブチ 貝淵 +カイブチ 海渕 +カイブチ 海淵 +カイベ 海部 +カイベ 海辺 +カイベ 海邊 +カイベ 海邉 +カイベヤ 海部屋 +カイヘン 海邊 +カイホ 海保 +カイホ 貝保 +カイホ 海帆 +カイホウ 海宝 +カイホウ 海北 +カイホウ 海方 +カイホウ 海法 +カイホウ 海寶 +カイホウ 海寳 +カイホウ 階方 +カイホウシ 貝方士 +カイホク 海北 +カイホコ 海鉾 +カイホコ 海鋒 +カイホシ 貝方士 +カイホツ 開発 +カイホツ 改発 +カイホツ 開保津 +カイホツ 貝発(貝發) +カイホツ 開發 +カイホツ 改發 +カイホリ 海堀 +カイホリ 貝堀 +カイボリ 海堀 +カイマ 海馬 +カイマ 貝間 +カイマ 廻間 +カイマ 海間 +カイマイ 開米 +カイマサ 貝柾 +カイマス 貝増 +カイマス 貝桝 +カイマチ 会町(會町) +カイミ 皆見 +カイミ 海見 +カイミ 介見 +カイムラ 海村 +カイムラ 開村 +カイムラ 貝村 +カイムラ 甲斐村 +カイメン 海面 +カイモチ 貝持 +カイモト 皆元 +カイモト 貝本 +カイモト 海本 +カイモト 開本 +カイモト 海元 +カイモト 階元 +カイモト 改元 +カイモト 開元 +カイモト 階本 +カイモト 甲斐元 +カイモト 貝元 +カイモト 飼本 +カイモリ 貝森 +カイモリ 皆森 +カイモリ 貝守 +カイモリ 改森 +カイモリ 貝盛 +カイモリ 開森 +カイモリ 海守 +カイモリ 階森 +カイモリ 飼森 +カイヤ 海谷 +カイヤ 貝谷 +カイヤ 甲斐谷 +カイヤ 貝屋 +カイヤ 会谷 +カイヤ 囲夜 +カイヤ 回夜 +カイヤ 海家 +カイヤ 養宇 +カイヤ 偕家 +カイヤ 改谷 +カイヤマ 貝山 +カイヤマ 開山 +カイヤマ 甲斐山 +カイヤマ 介山 +カイヨウ 回陽 +カイラ 解良 +カイラ 海良 +カイラク 開楽 +カイラク 快楽 +カイラダ 皆良田 +カイラダ 海良田 +カイラヅカ 貝良塚 +カイリク 海陸 +ガイロ 外良 +カイロウ 海老 +カイワ 海和 +カイワ 貝羽 +カイワ 貝和 +カイワ 海輪 +カイワ 鹿岩 +ガウ 我有 +ガウ 俄羽 +カウエ 加上 +カウチ 賀内 +カウチ 加内 +カウミ 嘉海 +カウラ 香浦 +カウラ 賀浦 +ガウン 臥雲 +カエ 加恵 +カエ 加江 +カエイ 賀栄 +カエシダ 返田 +カエシマ 嘉永島 +カエダ 蛙田 +カエダ 加恵田 +カエダ 嘉枝 +カエダ 替田 +カエチ 替地 +カエツ 嘉悦 +カエツ 加悦 +カエデ 楓 +カエデイ 楓井 +カエデオカ 楓岡 +カエデハラ 楓原 +カエデヤマ 楓山 +カエバ 替場 +カエヤマ 替山 +カエリサカ 帰坂(歸坂) +カエリヤマ 帰山 +カエリヤマ 歸山 +カエルクサ 蝦草 +カエルダ 蛙田 +カエン 火煙 +カオ 鹿尾 +カオ 加尾 +ガオ 我生 +カオウ 加王 +カオウ 柯王 +カオウジ 嘉応寺(嘉應寺) +カオカ 鹿岡 +カオカ 歌岡 +カオカ 賀岡 +カオク 加奥 +カオタニ 加尾谷 +カオリ 鹿折 +カオリ 狩折 +カオル 薫 +カオル 馨 +カオル 鹿居 +カガ 加賀 +カガ 加我 +カガ 利 +カガ 嘉賀 +カガ 可香 +カガ 河賀 +カガ 加鹿 +カガ 香賀 +カガ 加家 +カガ 伽賀 +カガ 可賀 +カカイ 抱井 +カガイ 加賀井 +カガイ 加々井 +カガイ 香井 +カガイ 利井 +カガイ 加賀為 +カガウ 加賀宇 +カカエ 抱 +カガエ 加賀江 +カガオ 加賀尾 +カガオ 加々尾 +カガオチ 加賀落 +カガカワ 加賀川 +カガク 鹿岳 +カガク 花岳 +カガク 華嶽 +カガクイ 加岳井 +カガサ 加笠 +カガサキ 加賀崎 +カガサキ 加ケ崎 +カガサキ 加ケ嵜 +カガサキ 加々崎 +カガサワ 加賀沢 +カガサワ 加賀澤 +カガジ 加々路 +カガシマ 加々島 +カガジョウ 加賀城 +カカズ 嘉数(嘉數) +カカズ 賀数 +カカズ 加数 +カカズ 賀數 +カガセ 加賀瀬 +カガソノ 加賀其 +カガタ 加賀田 +カガタ 利田 +カガタ 加形 +カガタ 加々田 +カガタ 嘉形 +カガタ 蚊田 +カガタニ 加賀谷 +カガタニ 蚊谷 +カガツマ 加賀妻 +カガツメ 加賀爪 +カガツメ 蚊爪 +カガツメ 加々爪 +カガヅメ 加賀爪 +カガヅメ 加々爪 +カガト 蚊戸 +カガト 香戸 +カガト 加賀登 +カガド 加賀度 +カガヌマ 加賀沼 +カガノ 加賀野 +カガノイ 加賀野井 +カガノイ 加々野井 +カガノミヤ 鏡宮 +カガノミヤ 嘉賀宮 +カガバヤシ 加賀林 +カガハラ 加賀原 +カガヒ 曜日 +カガブ 利部 +カガフジ 加賀藤 +カガベ 利部 +カカミ 各務 +カガミ 各務 +カガミ 鏡 +カガミ 加賀美 +カガミ 加々美 +カガミ 鏡味 +カガミ 加々見 +カガミ 加賀見 +カガミ 賀上 +カガミ 利見 +カガミ 加上 +カガミ 香美 +カガミ 鑑 +カガミ 香々美 +カガミ 嘉神 +カガミ 香上 +カガミ 加ケ美 +カガミ 加加美 +カガミ 香々見 +カガミイケ 鏡池 +カガミイシ 鏡石 +カガミウチ 鏡内 +カガミガワ 鏡川 +カガミサキ 鏡崎 +カガミシマ 鏡島 +カガミゾノ 鏡園 +カガミタ 鏡田 +カガミダ 鏡田 +カガミダ 鑑田 +カガミタニ 鏡谷 +カガミドウ 鏡堂 +カガミヌマ 鏡沼 +カガミハシ 鏡橋 +カガミバシ 鏡橋 +カガミハタ 鏡畑 +カガミハラ 鏡原 +カガミフチ 鏡渕 +カガミフチ 鏡淵 +カガミブチ 鏡渕 +カガミブチ 鏡淵 +カガミミヤ 鏡宮 +カガミモリ 鏡森 +カガミヤ 鏡谷 +カガミヤ 加々宮 +カガミヤ 鏡宮 +カガミヤ 鏡屋 +カガミヤ 加賀宮 +カガミヤマ 鏡山 +カガミヤマ 加賀美山 +カカム 各務 +カガムラ 加々村 +カガモト 加賀本 +カガモト 加々本 +カガヤ 加賀谷 +カガヤ 加賀屋 +カガヤ 加々谷 +カガヤ 可香谷 +カガヤ 蚊谷 +カガヤ 河々谷 +カガヤ 加可谷 +カガヤ 加賀家 +カガヤマ 加賀山 +カガヤマ 加々山 +カガヤマ 加加山 +カガヤマ 加賀矢間 +カカラ 加々良 +カカラ 加唐 +カガラ 加々良 +カガラ 加唐 +カガラ 加賀良 +カガラ 加々羅 +カガラ 加賀羅 +カガラ 香柄 +カカリ 掛 +カガリ 明松 +カガリ 篝 +カガリ 加苅 +カガリ 加賀利 +カガリヤマ 篝山 +カガワ 香川 +カガワ 加川 +カガワ 賀川 +カガワ 鹿川 +カガワ 何川 +カガワ 香河 +カガワ 嘉川 +カガワ 加河 +カガワ 鍛川 +カガワ 加賀川 +カガワ 可川 +カガワ 加賀和 +カガワ 佳川 +カガワ 鍜川 +カキ 加来 +カキ 柿 +カキ 加木 +カキ 垣 +カキ 賀喜 +カキ 可貴 +カキ 嘉喜 +カキ 嘉規 +カキ 加規 +カキ 墻 +カキ 可喜 +カギ 鍵 +カギ 加木 +カギ 嘉義 +カギ 嘉儀 +カギ 加儀 +カギ 加規 +カギ 賀木 +カギ 鎰 +カキアゲ 書上 +カキアゲ 垣上 +カキアゲ 撹上 +カキアゲ 攪上 +カキアゲ 柿上 +カギアマ 鑰尼 +カキアワセ 垣合 +カキイ 垣井 +カキイ 柿井 +カギイ 鍵井 +カキイシ 垣石 +カキイダ 柿井田 +カキイチ 柿市 +カギイチ 鍵市 +カキイリ 垣入 +カキイワ 垣岩 +カキウエ 垣上 +カキウチ 垣内 +カキウチ 柿内 +カキウチ 柿打 +カギウチ 鍵内 +カキウチダ 垣内田 +カキウド 柿宇土 +カキウネ 垣采 +カキウラ 垣浦 +カキウラ 柿浦 +カギウラ 鍵浦 +カキエ 垣江 +カキエ 柿江 +カキオ 垣尾 +カキオ 垣生 +カキオ 柿尾 +カギオ 鍵尾 +カキオカ 柿岡 +カキオカ 垣岡 +カギオカ 鍵岡 +カキオサ 柿長 +カギオノ 鍵小野 +カキガエ 垣替 +カキガオ 柿ケ尾 +カギカケ 鍵掛 +カキガノ 柿ケ野 +カキガハラ 垣ケ原 +カキガハラ 柿ケ原 +カキガミ 書上 +カキガミ 垣上 +カキカワ 柿川 +カキカワ 書川 +カキカワ 垣川 +カキガワ 柿川 +カキガワ 書川 +カギカワ 鍵川 +カキキ 柿木 +カキギ 柿木 +カキギ 垣木 +カキキタ 柿木田 +カキグチ 垣口 +カキグチ 柿口 +カキクボ 柿久保 +カキクボ 柿窪 +カキクボ 垣久保 +カギクボ 鍵窪 +カキクラ 柿倉 +カキコシ 垣越 +カキゴシ 垣越 +カキサカ 柿坂 +カキサカ 垣坂 +カキサカ 柿阪 +カキサカ 垣阪 +カキザカ 柿坂 +カキザカ 垣坂 +カギサカ 鍵阪 +カキサカイ 垣堺 +カキサカイ 柿堺 +カキザカイ 垣堺 +カキザカイ 柿堺 +カキザカイ 柿境 +カキサキ 柿崎 +カキサキ 蛎崎 +カキサキ 蠣崎 +カキサキ 垣崎 +カキザキ 柿崎 +カキザキ 蛎崎 +カキザキ 蠣崎 +カキザキ 垣崎 +カキザキ 硴崎 +カキザキ 柿嵜 +カキザキ 蛎埼 +カキザキ 蠣埼 +カギサキ 鍵崎 +カギザキ 鍵崎 +カキサコ 柿迫 +カキサコ 垣迫 +カキザコ 柿迫 +カキサダ 垣貞 +カキザネ 垣実(垣實) +カキサワ 柿沢 +カキサワ 柿澤 +カキサワ 垣澤 +カキザワ 柿沢 +カキザワ 柿澤 +カキザワ 垣沢 +カキザワ 垣澤 +カギサワ 鍵沢(鍵澤) +カギザワ 鍵沢(鍵澤) +カキシタ 柿下 +カキシタ 垣下 +カギシタ 鍵下 +カキシバ 柿芝 +カキシマ 柿島 +カキシマ 柿嶋 +カキシマ 垣島 +カキシマ 柿嶌 +カキジマ 柿島 +カキジマ 垣島 +カギシマ 鍵嶋 +カキジリ 垣尻 +カキシロ 柿白 +カキシロ 垣城 +カキシロ 柿城 +カキス 柿栖 +カキス 垣巣 +カキズカ 柿塚 +カキセ 垣瀬 +カキセ 柿瀬 +カキセ 蛎瀬 +カキセ 鹿帰瀬 +カキセ 蠣瀬 +カキゼ 鹿帰瀬 +カキゼ 鹿歸瀬 +カキセコ 柿迫 +カキセコ 垣迫 +カキゾエ 柿添 +カキゾエ 垣添 +カキゾエ 垣副 +カキゾエ 柿副 +カキゾノ 柿園 +カキゾノ 柿薗 +カキゾノ 柿木園 +カキゾノ 柿囿 +カキゾノ 栃囿 +カキタ 柿田 +カキタ 垣田 +カキタ 柿木田 +カキタ 硴田 +カキタ 嘉喜田 +カキタ 蛎田 +カキタ 嘉喜多 +カキタ 蠣田 +カキダ 柿田 +カキダ 垣田 +カキダ 柿木田 +カキダ 硴田 +カキダ 蛎田 +カギタ 鍵田 +カギダ 鍵田 +カキダイラ 柿平 +カキダイラ 垣平 +カキダチ 垣立 +カキタニ 柿谷 +カキタニ 垣谷 +カキダニ 柿谷 +カギタニ 鍵谷 +カギタニ 鎰谷 +カキチ 垣地 +カキツ 垣津 +カキツ 榎橘 +カキツ 牡若 +カキツカ 柿塚 +カキツカ 硴塚 +カキヅカ 柿塚 +カキヅカ 硴塚 +カキヅカ 垣塚 +カキヅキ 垣附 +カキツジ 垣辻 +カキツバ 垣鍔 +カキツバタ 杜若 +カキツボ 柿坪 +カキツマ 垣妻 +カキヅメ 柿爪 +カキヅル 柿鶴 +カキテ 柿手 +カキテ 垣手 +カキデ 柿出 +カキデ 垣出 +カキデナカ 垣出中 +カキド 垣戸 +カキド 柿戸 +カギト 鍵戸 +カキトウ 垣東 +カキトウ 柿藤 +カギトミ 鍵冨 +カギトミ 鍵富 +カキナイ 柿内 +カキナカ 垣中 +カキナカ 柿仲 +カキナカ 柿中 +カキナガ 柿永 +カキナガ 垣永 +カキナガ 柿長 +カギナカ 鍵中 +カギナカ 鍵仲 +カキナミ 柿並 +カキナミ 垣波 +カキナミ 垣並 +カキナミ 垣浪 +カキナミ 柿竝 +カキナリ 垣成 +カキナリ 柿成 +カキナワ 柿縄 +カキニシ 柿西 +カキヌキ 垣貫 +カギヌシ 鍵主 +カキヌマ 柿沼 +カキヌマ 垣沼 +カキネ 垣根 +カキネ 柿根 +カキノ 柿野 +カキノ 垣野 +カキノ 柿埜 +カキノ 硴野 +カギノ 鍵野 +カギノ 鍵埜 +カキノウエ 柿野上 +カキノウチ 垣野内 +カキノウチ 垣之内 +カキノウチ 柿ノ内 +カキノキ 柿木 +カキノキ 垣木 +カキノキ 柿ノ木 +カキノキゾノ 柿木園 +カキノキダ 柿木田 +カキノキハラ 柿木原 +カキノサコ 柿ノ迫 +カキノハナ 垣花 +カキノモト 柿本 +カキノモト 柿之本 +カキノヤ 柿野谷 +カキノヤ 柿ノ谷 +カキバ 垣端 +カキバ 柿葉 +カキバ 架場 +カキバ 加木場 +カキバ 垣羽 +カキハシ 垣橋 +カキハシ 蠣橋 +カキハタ 柿畑 +カキハタ 垣端 +カキハタ 楮畑 +カキハタ 垣畑 +カキハタ 柿畠 +カキバタ 柿畑 +カキバタ 垣端 +カギハタ 鍵畑 +カキハナ 垣花 +カキハナ 柿花 +カキハナ 垣鼻 +カキバナ 垣花 +カキバナ 柿花 +カキバヤ 蛎灰谷 +カキバヤ 蠣灰谷 +カキバヤシ 柿林 +カキハラ 柿原 +カキハラ 垣原 +カキハラ 柿木原 +カキハラ 蠣原 +カキハラ 蛎原 +カキハラ 硴原 +カギハラ 鍵原 +カキヒ 垣樋 +カキヒサ 柿久 +カキヒサ 蛎久 +カキヒサ 硴久 +カキヒサ 蠣久 +カキヒラ 柿平 +カキヒラ 垣平 +カギヒラ 鍵平 +カギヒロ 鎰広 +カギヒロ 鎰廣 +カギヒロ 鍵広(鍵廣) +カキフカ 垣深 +カキブカ 垣深 +カギフク 鍵福 +カキフジ 柿藤 +カキブチ 垣渕 +カキブチ 柿渕 +カキブチ 垣淵 +カキベ 柿部 +カキベ 垣辺 +カキマ 柿間 +カギマサ 鍵政 +カキマタ 垣又 +カキマチ 柿町 +カキマツ 垣松 +カキマル 柿丸 +カキマル 垣丸 +カキミ 垣見 +カキミ 柿見 +カキミ 垣実(垣實) +カキミ 柿実(柿實) +カキミズ 垣水 +カキミズ 硴水 +カキミチ 垣通 +カキミチ 垣道 +カギミネ 鍵峰(鍵峯) +カキムラ 柿村 +カキムラ 垣村 +カキムラ 嘉喜村 +カギムラ 鍵村 +カキモト 柿本 +カキモト 垣本 +カキモト 柿元 +カキモト 垣元 +カキモト 加木元 +カキモト 桓本 +カギモト 鍵本 +カギモト 鍵元 +カギモト 鑰本 +カギモト 鎰元 +カキモリ 柿森 +カキモリ 垣守 +カキモリ 垣森 +カギモリ 鍵森 +カキヤ 柿谷 +カキヤ 垣谷 +カキヤ 垣屋 +カキヤ 垣矢 +カキヤ 柿家 +カキヤ 蛎屋 +カキヤ 柿屋 +カキヤ 墻屋 +カギヤ 鍵谷 +カギヤ 加木屋 +カギヤ 鍵屋 +カギヤ 鎰谷 +カギヤ 鍵矢 +カギヤ 鍵家 +カギヤ 鍵弥 +カギヤ 加木谷 +カギヤ 鍵彌 +ガキヤ 我喜屋 +カキヤス 柿安 +カギヤブ 鍵薮 +カギヤブ 鍵籔 +カキヤマ 柿山 +カキヤマ 垣山 +カキヤマ 嘉喜山 +カキヤマ 柿木山 +カギヤマ 鍵山 +カギヤマ 賀儀山 +カギヤマ 鑰山 +カキュウ 嘉久 +カキュウ 瑕丘 +カキュウド 家久人 +カキョウ 鹿郷 +カギョウ 加行 +カキヨシ 垣吉 +カキワキ 垣脇 +カキワキ 柿脇 +カギワタ 鍵渡 +カギワダ 鍵和田 +カク 角 +カク 加来 +カク 賀来 +カク 賀久 +カク 加久 +カク 加來 +カク 加耒 +カク 覚 +カク 嘉久 +カク 佳久 +カク 賀來 +カク 嘉来 +カク 加九 +カク 可久 +カク 華宮 +カク 賀耒 +カク 敦 +ガク 岳 +ガク 賀久 +ガク 額 +ガク 我久 +カクアゲ 撹上 +カクアゲ 攪上 +カクアン 角庵 +カクイ 角井 +カクイ 囲 +カクイ 角居 +カクイ 覚井(覺井) +カクイ 鹿喰 +カクイ 格井 +カクイケ 角池 +カクイシ 角石 +カクイシ 加久石 +カクイチ 角一 +カクイチ 角市 +カクイハラ 格井原 +カクウチ 角内 +カクウチ 格内 +カクウチ 此内 +カクウチ 覚内 +カクウミ 角海 +カクウラ 角浦 +カクエ 角江 +カクオ 角尾 +カクオウ 覚王 +カクオウジ 覚王地 +カクオカ 角岡 +カクオン 覚音 +カクガ 郭賀 +カクガミ 角上 +カクガラ 角柄 +カクカワ 角川 +カクカワ 角河 +カクカワ 格川 +カクガワ 角川 +カクガワ 角河 +カクガワ 狢川 +カクガワ 覚川(覺川) +カクキ 角木 +カクグチ 角口 +カクグチ 格口 +カクゲン 角玄 +カクゴ 角五 +カクコウ 覚幸 +カクコウ 覺幸 +カグサ 鹿草 +カクサカ 角坂 +カクサカ 角阪 +カクサキ 角崎 +カクザキ 角崎 +カクサワ 角沢 +カクサワ 角澤 +カクザワ 角沢 +カクザワ 角澤 +カクサン 角三 +カクシ 嘉久志 +カクシ 角至 +カクシ 角子 +ガクシ 岳獅 +カクシゲ 格重 +カクシタ 角下 +カクシチ 角七 +カクシマ 角島 +カクシマ 角嶋 +カクシマ 格島 +カクシマ 格嶋 +カクシマ 覚島 +カクシャク 角釈 +カクシャク 角釋 +カクシヤマ 隠山 +カクショ 角所 +ガクショ 学所(學所) +カクショウ 覚正(覺正) +カクショウ 角正 +カクジョウ 角城 +カクジョウ 覚上 +カクジョウ 覚城 +カクジョウ 覚成 +ガクショウ 学正 +カクシロ 角城 +カクシン 角新 +カクシン 角心 +カクシン 覚心(覺心) +カクシン 郭新 +カクスイ 角水 +カクスイ 槨水 +カクスエ 覚末 +カクスエ 角末 +カクズミ 角住 +カクセ 角瀬 +カクセ 格清 +カクセイ 格清 +カクゼン 覚前 +カクゼン 角前 +カクゼン 覺前 +カクゾノ 角園 +カクタ 角田 +カクタ 額田 +カクタ 覚田 +カクタ 加久田 +カクタ 赫多 +カクタ 加来田 +カクタ 赫田 +カクタ 確田 +カクタ 角太 +カクタ 覺田 +カクダ 角田 +カクダ 額田 +カクダ 覚田 +カクダ 加久田 +カクダ 加来田 +カクダ 覺田 +ガクタ 学田 +ガクタ 学多 +カクダイ 角台 +カクタカ 角高 +カクタケ 角竹 +カクダテ 角館 +カクダテ 角舘 +カクダテ 角楯 +カクタニ 角谷 +カクタニ 格谷 +カクタワ 角乢 +カクチ 角地 +カクチ 角内 +カクチ 覚知(覺知) +カクチ 加鬮 +カクチ 覚地(覺地) +カクチ 格内 +カクチ 此内 +カクチ 格地 +カクチ 託 +カクチ 加䰗(加䦰) +カクチ 峉地 +カグチ 家口 +カグチ 加口 +カグチ 賀口 +カグチ 鹿口 +カグチ 蚊口 +カグチ 狩口 +カグチ 嘉口 +カクチヤマ 角地山 +カクチヤマ 加䰗山 +カクチヤマ 加鬮山 +カクチヤマ 加䦰山 +カクツジ 角辻 +カクツタ 角津田 +カクツダ 角津田 +カクデ 角出 +カクト 角戸 +カクド 角戸 +カクトウ 角藤 +カクトウ 角当 +カクドウ 角藤 +カクドウ 角道 +カクドウ 角銅 +カクドウ 覚道 +カクドウ 覚堂 +カクドウ 角堂 +カクドウ 覺道 +ガクトウ 学頭 +ガクトウ 學頭 +カクナ 覚名 +カクナイ 格内 +カクナカ 角中 +カクナガ 角永 +カクナガ 覺永(覚永) +カクナミ 角波 +カクニ 加国 +カクニ 加國 +カクノ 角野 +カクノ 覚野 +カクノ 角埜 +カクノ 加来野(加來野) +カクノ 覚埜 +カクノ 郭野 +カクノ 覺野 +カクノ 格野 +ガクノ 学之(學之) +ガクノ 学野 +カクノウ 角納 +カクノウエ 角ノ上 +カクノソノ 角之薗 +カクノダテ 角館 +カクハ 角羽 +カクバ 角場 +カクハシ 角橋 +カクバシ 角橋 +カクハタ 角畑 +カクハタ 角幡 +カクハタ 角畠 +カクハタ 格畑 +カクハタ 角端 +カクバタ 角畑 +カクバタ 角畠 +カクハナ 角花 +カクハナ 角端 +カクハマ 角浜 +カクハマ 角濱 +カクバヤシ 角林 +カクハラ 角原 +カクハラ 掴原 +カクハラ 郭原 +カクハラ 霍原 +ガクハラ 学原 +ガクハラ 額原 +カクハリ 角張 +カクハリ 覚張 +カクハリ 覺張 +カクバリ 角張 +カクバリ 覚張 +ガクハリ 覚張 +ガクハリ 覺張 +ガクバリ 覚張 +ガクバリ 覺張 +カクヒ 角日 +カクヒサ 角久 +カクヒラ 角平 +カクヒロ 角広 +カクフジ 角藤 +カクブチ 角縁 +カクブツ 角仏(角佛) +カクベ 角部 +カクホ 角保 +カクボ 鹿久保 +カクボ 角保 +カクボ 加久保 +カクボ 鹿窪 +カクホウ 角方 +カクボリ 角堀 +カクマ 角間 +カクマ 鹿熊 +カクマ 加隈 +カクマ 覚間 +カクマ 加久間 +カクマ 角真 +カクマ 角久間 +カクマ 角馬 +カクマ 角眞 +カクマ 覺間 +カグマ 鹿熊 +カグマ 加隈 +カクマエ 覚前 +カクマエ 覺前 +カクマサ 角正 +カクマザキ 角間崎 +ガクマザワ 岳間沢 +ガクマザワ 嶽間沢 +ガクマザワ 嶽間澤 +ガクマザワ 岳間澤 +カクマチ 角町 +カクマル 角丸 +カクミ 神代 +カクミ 角海 +カクミ 角三 +カクミ 角見 +カクミ 各見 +カクミ 加久見 +カクミ 嘉久見 +ガクミ 額見 +カクミチ 角道 +カクミツ 角光 +カクミヤ 角宮 +カクム 各務 +カクムラ 角村 +カクメイ 覚明(覺明) +カクメン 角免 +カクモト 角本 +カクモト 角元 +カクモト 覚本(覺本) +カクモト 覚元 +カクモト 赫本 +カクモト 加久本 +カクモト 郭本 +カクモト 覐元 +カクモリ 角森 +カクヤ 角谷 +カクヤ 角屋 +カクヤ 角矢 +カクヤ 角家 +カクヤ 格谷 +カクヤ 格矢 +カクヤナギ 角柳 +カクヤマ 角山 +カクヤマ 岳山 +カクヤマ 隔山 +カクヤマ 郭山 +カクヤマ 格山 +カクヤマ 覚山 +カクヤマ 赫山 +カグヤマ 香久山 +カクユキ 覚幸 +カクユキ 覺幸 +カクヨシ 格由 +カクラ 鹿倉 +カクラ 加倉 +カクラ 加蔵 +カクラ 嘉倉 +カクラ 香倉 +カクラ 佳倉 +カクラ 加藏 +カクラ 香座 +カグラ 加倉 +カグラ 神楽 +カグラ 神樂 +カクライ 加倉井 +カクライ 角頼 +カクライ 家久来(家久耒) +カクライ 角来(角耒) +カクライ 覚来(覚來・覺來) +カグラオカ 神楽岡 +カクラギ 家久来慶 +カグラショ 神楽所 +カグラショ 神樂所 +カクラタ 加倉田 +カクラダ 加倉田 +カグラタ 神楽田 +カグラダ 神楽田 +カグリ 加栗 +カクリュウ 角龍 +カクリュウ 角竜 +カクレ 隠 +カクレザキ 隠崎 +カクレダ 隠田 +カクレヤ 隠家 +カクレヤ 隠矢 +カクワ 格和 +カクワ 角和 +カクワ 嘉久和 +カクワ 各和 +カクワキ 角脇 +カケ 掛 +カケ 加計 +カケ 賀家 +カケ 懸 +カケ 加家 +カケ 欠ケ +カゲ 鹿毛 +カゲ 蔭 +カゲ 景 +カゲ 影 +カゲ 賀家 +カゲ 陰 +カゲ 加下 +カゲ 勘解 +ガケ 峨家 +ガケ 欠 +ガケ 我毛 +ガケ 賀家 +ガケ 崖 +ガケ 可計 +カケイ 筧 +カケイ 掛井 +カケイ 加計 +カゲイ 影井 +カゲイ 景井 +カゲイ 隠居 +カゲイ 蔭井 +カゲイ 蔭居 +カゲイ 影居 +カゲイ 加下井 +ガケイ 賀慶 +カゲイエ 景家 +カケイシ 掛石 +カゲイシ 影石 +カケイダ 筧田 +カゲイワ 陰岩 +カケウエ 掛上 +カゲウエ 蔭上(陰上) +カゲウジ 景宇治 +カケウチ 掛内 +カゲウチ 影内 +カケウマ 掛馬 +カゲウラ 影浦 +カゲウラ 景浦 +カゲウラ 蔭浦 +カゲウラ 陰浦 +カケエ 掛江 +カゲエダ 景枝 +カケオ 掛尾 +カケオ 懸尾 +カゲオ 蔭尾 +カゲオ 景尾 +カケオカ 掛岡 +カケオカ 嶮岡 +カゲオカ 影岡 +カゲオカ 景岡 +カゲオカ 蔭岡 +カケオリ 掛折 +カケガイ 掛貝 +カケガケ 欠掛 +カゲカタ 景方 +カゲカド 蔭角 +カケガミ 掛上 +カケガミ 掛神 +カケガミ 懸上 +カケカワ 掛川 +カケカワ 欠川 +カケガワ 掛川 +カケガワ 懸川 +カゲカワ 蔭川 +カゲカワ 景川 +カゲカワ 影川 +カケガワラ 掛川原 +カケギ 掛木 +カゲキ 蔭木 +カゲキ 影木 +カケギシ 懸岸 +カゲキヨ 景清 +カケグチ 掛口 +カケグチ 欠口 +カケゴシ 掛越 +カゲサ 蔭佐 +カゲサ 陰佐 +カゲサ 影佐 +カケザキ 懸崎 +カゲサキ 景崎 +カケサク 掛作 +カケサコ 掛迫 +カゲサダ 陰貞 +カゲサト 陰里 +カゲサト 景里 +カケザワ 掛沢 +カケザワ 掛澤 +カゲサワ 影沢 +カゲサワ 影澤 +カゲサワ 景沢 +カゲサワ 景澤 +カゲザワ 影澤 +カケジ 掛地 +カゲジ 影治 +カゲジ 影地 +カケシタ 掛下 +カケシタ 筧下 +カケシタ 欠下 +カゲシタ 影下 +カゲシタ 陰下 +カゲシタ 蔭下 +カゲシタ 景下 +ガケシタ 嶽下 +ガケシタ 峨家下 +カケシマ 掛島 +カケジマ 県島 +カケジマ 縣島 +カケジマ 懸島 +カゲシマ 影島 +カゲシマ 蔭島 +カゲシマ 影嶋 +カゲシマ 陰島 +カケス 掛巣 +カケス 掛須 +カゲスエ 影末 +カケセ 欠瀬 +カケゾノ 掛園 +カケタ 掛田 +カケタ 懸田 +カケタ 欠田 +カケダ 掛田 +カケダ 懸田 +カケダ 欠田 +カケダ 鹿毛田 +カゲタ 蔭田 +カゲタ 影田 +カゲタ 景田 +カゲタ 陰田 +カゲタ 鹿毛田 +カケダイ 掛鯛 +カケタカ 懸高 +カゲタクボ 影田久保 +カケタニ 掛谷 +カケタニ 懸谷 +カゲタニ 蔭谷 +カゲタニ 影谷 +カゲタニ 景谷 +カケタリ 掛足 +カケチ 掛地 +カゲチ 陰地 +カゲヂ 影地 +カゲチカ 影近 +カゲツ 香月 +カゲツ 花月 +カゲツ 荷月 +カケツカ 掛塚 +カケヅカ 欠塚 +カケヅカ 掛塚 +カケヅクリ 掛作 +カケヅクリ 掛造 +カゲデ 景出 +カケト 欠戸 +カケド 掛戸 +カケド 懸戸 +カゲト 影戸 +カゲドイ 影土井 +カゲトウ 蔭東(陰東) +カゲトシ 景利 +カケナカ 掛中 +カゲナカ 影中 +カゲナカ 景中 +カゲナカ 蔭中 +カゲナガ 影長 +カゲナガ 陰永 +カケナミ 掛波 +カゲニシ 蔭西 +カゲヌマサワ 影沼沢 +カゲヌマサワ 影沼澤 +カゲヌマザワ 影沼沢 +カゲヌマザワ 影沼澤 +カケノ 掛布 +カケノ 掛野 +カケノ 懸野 +カケノ 掛埜 +カケノ 駈野 +カケノ 欠野 +カゲノ 影野 +カゲノ 蔭野 +カゲノ 景野 +ガケノ 闕野 +カケノウエ 掛ノ上 +カケノウチ 掛之内 +カケノサキ 懸野崎 +カケノシタ 欠ノ下 +カケノシタ 掛ノ下 +カケノブ 掛信 +カゲノブ 影信 +カケバ 掛場 +カケバ 懸場 +カケバ 掛碆 +カケハシ 梯 +カケハシ 掛橋 +カケハシ 桟 +カケハシ 棧 +カケハシ 懸橋 +カケハシ 縣橋 +カケハシ 悌 +カケハタ 掛端 +カケハタ 欠端 +カケハタ 欠畑 +カケハタ 欠ケ端 +カゲハタ 影畑 +カゲハタ 蔭畠 +カケハナ 掛鼻 +カケバヤシ 掛林 +カケバヤシ 懸林 +カゲバヤシ 影林 +カケハラ 掛原 +カゲハラ 蔭原 +カゲハラ 影原 +カゲハラ 景原 +カケヒ 筧 +カケヒ 垣見 +カケヒ 懸樋 +カケヒ 掛樋 +カケヒ 掛飛 +カケヒ 掛桶 +カゲヒ 影日 +カゲヒガシ 蔭東(陰東) +カゲヒサ 蔭久 +カゲヒサ 影久 +カゲヒサ 陰久 +カケヒダ 筧田 +カケヒノ 筧野 +カケヒラ 掛平 +カゲヒラ 影平 +カゲヒラ 景平 +カゲヒラ 陰平 +カゲヒラ 蔭平 +カゲヒロ 影広 +カゲヒロ 影廣 +カケフ 掛布 +カケフク 掛福 +カゲフジ 蔭藤 +カケフダ 掛札 +カケフダ 掛礼 +カケベ 掛部 +カゲホラ 影洞 +カゲボラ 影洞 +カケマ 架間 +カゲマ 蔭間 +カゲマサ 景政 +カゲマサ 影正 +カケマタ 掛又 +カゲマツ 影松 +カケミ 掛見 +カゲミ 景見 +カケミズ 掛水 +カゲミチ 蔭道 +カゲミチ 陰道 +カゲミツ 景光 +カケムラ 掛村 +カケムラ 欠村 +カゲムラ 蔭村 +カゲムラ 景村 +ガケムラ 峪村 +カゲメ 影目 +カケモト 掛本 +カケモト 懸本 +カケモト 加計本 +カケモト 梯本 +カゲモト 影本 +カゲモト 蔭本 +カゲモト 景本 +カゲモト 陰元 +カゲモト 陰本 +カゲモト 影元 +カゲモト 景元 +カケモリ 掛森 +カゲモリ 影森 +カゲモリ 景森 +カゲモリ 景守 +カケヤ 掛谷 +カケヤ 掛屋 +カケヤ 懸谷 +カケヤ 掛合 +カゲヤ 蔭谷 +カゲヤ 影谷 +カゲヤ 景谷 +カゲヤ 影矢 +カゲヤス 景安 +カゲヤス 影安 +カゲヤブ 蔭薮 +カゲヤブ 蔭籔 +カケヤマ 掛山 +カケヤマ 懸山 +カゲヤマ 影山 +カゲヤマ 景山 +カゲヤマ 蔭山 +カゲヤマ 陰山 +カゲヤマ 闕山 +カゲヤマ 隂山 +カゲヤマ 𨼲山 +カゲユ 勘解由 +カゲユ 景由 +カゲユキ 景行 +カゲユキ 影行 +カゲヨシ 影吉 +カゲリ 陰裡(蔭裡) +カゲリ 影裡 +カゲロ 影路 +カゲワリ 蔭割 +カゲン 加減 +カゲン 家現 +カコ 可児 +カコ 加古 +カコ 加子 +カコ 加固 +カコ 賀古 +カコ 家古 +カコ 香古 +カゴ 加護 +カゴ 篭 +カゴ 籠 +カゴ 加後 +カゴ 賀子 +カゴ 加籠 +カゴ 鹿児 +カコイ 栫 +カコイ 栫井 +カコイ 囲 +カコイ 圍 +カコイ 拵 +カコイ 拵井 +カコイ 加古井 +カゴイ 籠井 +カゴイ 篭井 +カゴイ 篭居 +カゴイキ 籠生 +カゴイケ 篭池 +カゴイケ 籠池 +カコイゾノ 栫井園 +カコイヤマ 栫山 +カコウ 賀好 +カコウ 鹿子生 +カコウ 加甲 +カコウ 賀光 +カコウ 加好 +カコウ 加幸 +カコウ 加香 +カコウ 角甲 +カコウ 加光 +カコウ 嘉香 +カゴウ 家郷 +カゴウ 鹿郷 +カゴウ 嘉郷 +カゴウ 加郷 +カゴウラ 籠浦 +カゴウラ 篭浦 +カコオ 鹿子生 +カコオ 鹿子尾 +カゴオ 籠尾 +カゴオ 篭尾 +カゴオ 篭生 +カコガワ 加古川 +カコガワ 水主川 +カコガワ 加胡川 +カコガワ 加小川 +カゴカワ 籠川 +カゴカワ 篭川 +カコキ 鹿子木 +カコギ 鹿子木 +カゴクラ 篭倉 +カゴクラ 籠倉 +カコサカ 加子坂 +カコザキ 加子崎 +カゴサキ 籠崎 +カゴサキ 篭崎 +カゴザキ 籠崎 +カゴサク 篭作 +カゴサワ 籠澤 +カゴザワ 篭沢 +カゴザワ 籠沢 +カゴザワ 籠澤 +カコシ 加越 +カゴシ 加越 +カゴシ 嘉越 +カゴシゲ 篭重 +カゴシゲ 籠重 +カゴシマ 鹿児島 +カゴシマ 籠島 +カゴシマ 鹿子島(鹿子嶌) +カゴシマ 神子島 +カゴシマ 篭島 +カゴシマ 鹿子嶋 +カゴシマ 篭嶋(篭嶌) +カゴシマ 鹿児嶋 +カゴシマ 籠嶋 +カゴシマ 駕籠島 +カゴシマ 加児島 +カゴシマ 駕篭島 +カゴシマ 鹿児嶌 +カゴシマ 鹿兒島 +カゴシマ 神子嶋 +カゴシマ 籠嶌 +カゴセ 籠瀬 +カゴセ 篭瀬 +カコタ 嘉古田 +カコダ 嘉古田 +カコダ 加古田 +カゴタ 篭田 +カゴタ 籠田 +カゴタ 駕田 +カゴダ 籠田 +カゴタキ 篭滝 +カゴタキ 籠滝 +カコタニ 加古谷 +カゴタニ 篭谷 +カゴタニ 籠谷 +カゴタニ 駕谷 +カゴタニ 籃谷 +カゴタニ 加護谷 +カゴテ 籠手 +カゴト 篭戸 +カゴト 籠戸 +カゴト 篭渡(籠渡) +カコトウ 加古藤 +カゴトシ 籠利 +カゴトシ 篭利 +カゴナミ 籠波 +カゴノ 加護野 +カゴノ 篭野 +カゴノ 籠野 +カゴノメ 籠目 +カゴバ 篭場 +カゴバ 籠場 +カゴハシ 篭橋 +カゴハシ 籠橋 +カゴハタ 鹿子畑 +カゴハタ 篭畑 +カゴハタ 籠畑 +カゴハタ 鹿子幡 +カコバヤシ 楮林 +カゴバヤシ 籠林 +カゴバヤシ 篭林 +カコハラ 加古原 +カゴハラ 楮原 +カゴハラ 篭原 +カゴハラ 籠原 +カゴハラ 鹿子原 +カゴマキ 篭巻 +カコミ 神代 +カゴミ 篭味 +カゴミ 籠味 +カゴミ 篭見(籠見) +カゴミヤ 籠宮 +カゴミヤ 篭宮 +カコムラ 水主村 +カゴムラ 籠村 +カゴモト 楮本 +カゴモト 篭本 +カゴモト 籠本 +カゴモト 加五元 +カコヤ 加古屋 +カゴヤ 篭谷 +カゴヤ 籠谷 +カゴヤ 駕屋 +カゴヤ 篭屋 +カゴヤ 籠屋 +カゴヤ 籠家 +カコヤマ 加古山 +カゴヤマ 楮山 +カゴヤマ 籠山 +カゴヤマ 篭山 +カゴヤマ 鹿児山(鹿兒山) +カゴリ 籠利 +カゴロク 賀籠六 +カゴロク 鹿籠六 +カゴロク 加籠六 +カゴロク 加篭六 +カゴロク 賀篭六 +カゴロク 鹿篭六 +カサ 笠 +カサ 傘 +カサ 倍 +カサ 嘉佐 +カサ 加佐 +カザ 加座 +ガサ 賀佐 +カザアナ 風穴 +カサイ 笠井 +カサイ 葛西 +カサイ 河西 +カサイ 香西 +カサイ 嵩井 +カサイ 可西 +カサイ 嘉斎 +カサイ 笠居 +カサイ 笠飯 +カサイ 嘉斉 +カサイ 傘井 +カサイ 嘉齋 +カサイ 嘉齊 +カサイ 河載 +カサイ 迦西 +カザイ 可西 +カザイ 風井 +カザイ 家財 +カサイシ 笠石 +カサイワ 重岩 +カサウエ 笠上 +カサウチ 笠内 +カサウラ 笠浦 +カザウラ 風浦 +カサエ 笠江 +カサオ 笠尾 +カザオ 風尾 +カサオカ 笠岡 +カザオカ 風岡 +カサオリ 笠折 +カザオリ 風折 +カザオレ 風折 +カサカ 加坂 +カサガイ 笠外 +カサガキ 笠垣 +カサガキ 笠恒 +カサカケ 笠掛 +カサガケ 笠掛 +カサカツ 笠勝 +カサカド 笠門 +カサカミ 笠神 +カサガミ 笠上 +カサガミ 笠神 +カザカミ 風神 +カザカミ 風上 +カサガラ 笠柄 +カサカワ 笠川 +カサガワ 笠川 +カサキ 笠木 +カサキ 笠置 +カサキ 傘木 +カサキ 加崎 +カサキ 嘉崎 +カサキ 加嵜 +カサギ 笠木 +カサギ 笠置 +カサギ 傘木 +カサギ 笠城 +カサギ 笠鬼 +カサギ 賀鷺 +カザキ 加崎 +カザキ 嘉崎 +カザキ 蚊崎 +カサギリ 笠桐 +カサク 笠工 +カザグチ 風口 +カサクラ 笠倉 +カサクラ 重倉 +カサクラ 傘倉 +カザクラ 風倉 +カサコ 加迫 +カサゴ 笠小 +カサゴ 笠合 +カサコシ 笠越 +カザコシ 風越 +カザゴシ 風越 +カササ 笠佐 +カササキ 笠崎 +カササギ 鵲 +カサザキ 笠崎 +カササク 笠作 +カササワ 笠沢 +カサシ 笠師 +カサジ 倍地 +カザシ 嘉指 +カサシゲ 笠茂 +カサシタ 笠下 +カサシマ 笠島 +カサシマ 笠嶋 +カサジマ 笠島 +カサジマ 笠嶋 +カサジマ 笠蔦 +カサジマ 笠嶌 +カサスギ 笠杉 +カサズミ 笠澄 +カサセ 笠瀬 +カサダ 笠田 +カサタカ 笠高 +カサタケ 笠竹 +カサタテ 笠立 +カサダテ 笠立 +カサタニ 笠谷 +カサタニ 傘谷 +カサダニ 笠谷 +カザタニ 風谷 +カザタニ 錺谷 +カサヅカ 笠塚 +カサツキ 笠月 +カサツグ 笠継 +カサツグ 笠告 +カサツジ 司辻 +カサデラ 笠寺 +カサド 笠戸 +カザト 風戸 +カザト 加里 +カザト 風外 +カサトウ 笠藤 +カザトメ 風留 +カサトリ 笠鳥 +カサドリ 笠鳥 +カサナ 笠名 +カサナカ 笠中 +カサナガ 笠永 +カサナシ 笠無 +カザナシ 風無 +カサナミ 笠波 +カサナミ 笠次 +カサナミ 笠浪 +カサナリ 笠成 +カサニシ 笠西 +カサヌキ 笠貫 +カサヌマ 笠沼 +カサネ 笠根 +カサネガワ 重川 +カサネギ 重木 +カサネスギ 重杉 +カサノ 笠野 +カサノ 加差野 +カザノ 風野 +カサハ 笠羽 +カサバ 笠羽 +カサバ 笠場 +カザハエ 風生 +カサハタ 笠畑 +カサバタ 笠畑 +カザハミ 風波見 +カザハヤ 風早 +カザバヤシ 風林 +カサハラ 笠原 +カサハラ 楮原 +カサハラ 加佐原 +カサハラ 上砂原 +カザハリ 風張 +カサヒ 重昆 +カサヒラ 笠平 +カサボウ 笠坊 +カサマ 笠間 +カザマ 風間 +カザマ 笠間 +カザマ 架間 +カザマ 加狭 +カザマ 風真 +カサマイ 笠舞 +カサマキ 笠巻 +カザマキ 風巻 +カザマキ 風牧 +カザマキ 風卷 +カサマス 笠舛 +カサマチ 笠町 +カサマツ 重松 +カサマツ 笠松 +カサマツ 傘松 +カザマツリ 風祭 +カサマヤ 笠間屋 +カサマル 笠丸 +カサミ 笠見 +カサミ 嵩 +カサミ 加佐見 +カサミ 賀佐見 +カサミ 笠美 +カザミ 風見 +カザミ 風味 +カサミズ 笠水 +カサミズカミ 笠水上 +カサミズガミ 笠水上 +カサミチ 笠道 +カサミツ 笠光 +カサミヤ 笠宮 +カサムタ 笠牟田 +カサムラ 笠村 +カサムラ 嵩村 +カザムラ 風村 +カサメ 笠目 +カサモ 笠毛 +カサモ 笠茂 +カサモト 笠本 +カサモト 嵩元 +カサモト 傘本 +カザモト 風本 +カサモリ 笠森 +カザモリ 風盛 +カサヤ 笠谷 +カサヤ 笠矢 +カサヤ 傘谷 +カサヤ 笠屋 +カサヤ 笠家 +カサヤ 笠舎 +カサヤナギ 笠柳 +カサヤマ 笠山 +カザヤマ 風山 +カサユキ 笠行 +カザラシ 風嵐 +カサリ 笠利 +カサリ 加佐利 +カザリ 荘 +カザリ 文 +カザリ 錺 +カザリ 飾 +カザリ 花厳 +カザリ 莊 +カザリ 花嚴 +カザリ 餝 +カザリカワ 莊川 +カザリムラ 錺村 +カザリモト 錺本 +カザリヤ 餝谷 +カザリヤ 餝矢 +カサワ 笠輪 +カザワ 賀沢 +カザワ 加沢 +カザワ 加澤 +カザワ 賀澤 +カザワ 嘉沢 +カザワ 何沢(何澤) +カザワ 嘉澤 +カザワ 香沢 +ガサワ 我沢 +ガサワ 我澤 +ガザワ 我澤 +カサワキ 笠脇 +カサン 加三 +ガザン 我山 +ガザン 峨山 +カサンノイン 花山院 +カシ 柏 +カシ 樫 +カシ 嘉指 +カシ 菓子 +カシ 加志 +カシ 家志 +カシ 橿 +カシ 家始 +カシ 加司 +カシ 香至 +カシ 嘉志 +カシ 賀志 +カジ 梶 +カジ 加地 +カジ 可児 +カジ 鍛治 +カジ 加治 +カジ 鍛冶 +カジ 楫 +カジ 加持 +カジ 鍜治 +カジ 家治 +カジ 香椎 +カジ 鍛 +カジ 嘉地 +カジ 鍛示 +カジ 賀治 +カジ 嘉寺 +カジ 楮 +カジ 嘉治 +カジ 賀地 +カジ 鍜冶 +カジ 加次 +カジ 加冶 +カジ 鍛次 +カジ 鍛地 +カジ 揖 +カジ 賀司 +カジ 鹿耳 +カジ 柁 +カジ 鍜 +カジ 鍜次 +カジ 鍜示 +カシアイ 樫合 +カシアイ 柏合 +カシアテ 柏当(柏當) +カシイ 柏井 +カシイ 香椎 +カシイ 樫井 +カシイ 加椎 +カシイ 柏居 +カシイ 菓子井 +カシイ 樫飯 +カシイ 樫位 +カジイ 梶井 +カジイ 加治井 +カジイ 梶居 +カジイ 加次井 +カジイ 嘉治井 +カジイ 鍛井 +カジイ 楫井 +カジイエ 梶家 +カジイエ 鍛冶家 +カシイデ 樫出 +カシウエ 橿上 +カジウエ 梶上 +カシウダ 柏梨田 +カシウチ 樫内 +カシウチ 柏内 +カジウチ 梶内 +カジウチ 鍛治内 +カジウチ 鍛冶内 +カジウメ 梶梅 +カシウラ 樫浦 +カシウラ 柏浦 +カジウラ 梶浦 +カジウラ 鍛治浦 +カジエ 梶家 +カジエ 梶江 +カジエ 梶恵 +カジエ 鍛治江 +カジエ 楫江 +カシオ 樫尾 +カシオ 柏尾 +カシオ 加塩 +カシオ 橿尾 +カシオ 鹿塩 +カシオ 菓子尾 +カシオ 賀シ尾 +カジオ 梶尾 +カジオ 鍛冶尾 +カジオ 梶緒 +カジオ 梶應 +カジオ 鍛治尾 +カジオ 楫尾 +カジオウ 梶応 +カジオウ 梶應 +カシオカ 柏岡 +カシオカ 樫岡 +カシオカ 栢岡 +カジオカ 梶岡 +カジオカ 鍛治岡 +カジオカ 梶丘 +カジオカ 鍛冶岡 +カジオカ 鍜治岡 +カジオト 梶音 +カシカ 加鹿 +カジカ 梶賀 +カジカ 楫賀 +カジガ 梶賀 +カジカイ 鍜治貝 +カジガイ 梶谷 +カジガイ 鍛治貝 +カジガイ 鍛冶貝 +カジガウチ 梶ケ内 +カジガエシ 梶返 +カジガキ 梶垣 +カジカザワ 鰍沢 +カジカザワ 鰍澤 +カジガサワ 鍛治ケ沢(鍛治ケ澤) +カジガセ 楫ケ瀬 +カジカタ 加知方 +カジガノ 梶ケ野 +カシガヒラ 樫ケ平 +カジカミ 梶上 +カジガヤ 梶谷 +カジガヤ 梶ケ谷 +カジガヤマ 梶ケ山 +カシカワ 柏川 +カシカワ 樫川 +カシカワ 貸川 +カシカワ 加志川 +カシガワ 樫川 +カジカワ 梶川 +カジカワ 鍛治川 +カジカワ 梶河 +カジカワ 枻川 +カジカワ 鍛川 +カジカワ 家治川 +カジカワ 鍜治川 +カジカワ 加治川 +カジカワ 柁川 +カジカワ 鍛冶川(鍜冶川) +カジカワ 楫川 +カジカワ 梶側 +カジカワ 揖川 +カジカワ 鍜川 +カジカワウチ 鍛治河内(鍜治河内) +カジカワチ 鍛冶河内 +カシキ 柏木 +カシキ 樫木 +カシキ 炊 +カシギ 樫木 +カジキ 加治木 +カジキ 梶木 +カジキ 楮木 +カジキ 加冶木 +カジキ 鍛治木 +カジキ 鍛冶木 +カジキ 鍜治木 +カシキエ 炊江 +カジキタ 梶北 +カジキヤ 梶木屋 +カジキヨ 梶清 +カジク 加治工 +カシグチ 柏口 +カシグチ 樫口 +カジグチ 梶口 +カジグチ 鍛治口(鍜治口) +カジグチ 鍛冶口 +カシクボ 樫久保 +カシクマ 柏熊 +カシクマ 樫熊 +カシクマ 貸熊 +カジクマ 梶熊 +カシクラ 柏倉 +カジクラ 鍛治倉(鍜治倉) +カジクラ 鍛冶倉 +カジクラ 梶倉 +カジクリ 梶栗 +カジグリ 梶栗 +カシゲ 鹿志毛 +カシゲ 貸毛 +カシコ 才 +カシコ 樫子 +カシコ 賀志古 +カシコ 戈 +カジコ 可児子 +カジコ 鍛治古 +カジコ 鍜治古 +カジコウチ 鍛冶河内 +カジサ 加治佐 +カジサ 加冶佐 +カシサカ 柏坂 +カシサカ 樫坂 +カシザカ 柏坂 +カジサカ 梶坂 +カシザキ 柏崎 +カシザキ 樫崎 +カシザキ 加志崎 +カジサキ 梶崎 +カジサキ 梶埼 +カジサキ 梶嵜 +カジザキ 梶崎 +カジザキ 鍛治崎 +カシサコ 樫迫 +カジサコ 梶佐古 +カジサコ 楮佐古 +カジサコ 梶迫 +カジサコ 梶栄(梶榮) +カシザワ 樫沢 +カシザワ 樫澤 +カジサワ 梶沢 +カジサワ 鍛治沢 +カジサワ 梶澤 +カジサワ 鍛冶沢 +カジサワ 柁沢 +カジサワ 柁澤 +カジサワ 鍛治澤 +カジサワ 鍛冶澤 +カジサワ 鍜治沢 +カジサワ 鍜治澤 +カジサワ 鍜冶沢(鍜冶澤) +カシジ 樫地 +カジシ 梶師 +カシシタ 栢下 +カシシタ 樫下 +カシシタ 柏下 +カジシタ 梶下 +カジシタ 鍛治下 +カジシタ 鍛冶下 +カシジマ 柏島 +カジシマ 梶島 +カジシマ 鍛島 +カジシマ 梶嶋 +カジシマ 鍛治島 +カジシマ 梶嶌 +カジシマ 鍛冶島 +カジシャ 鍛治舎(鍛治舍) +カジシャ 鍛冶舎 +カシジュク 樫宿 +カジシロ 鍛代 +カジシロ 梶白 +カジソノ 梶園 +カジゾノ 鍛治園 +カジゾノ 鍛冶園 +カシタ 柏田 +カシタ 樫田 +カシタ 香下 +カシタ 加下 +カシタ 賀下 +カシダ 柏田 +カシダ 樫田 +カシダ 菓子田 +カシダ 加志田 +カジタ 梶田 +カジタ 鍛治田 +カジタ 鍛冶田 +カジタ 鍛田 +カジタ 楫田 +カジタ 鍜治田 +カジタ 揖田 +カシダイラ 樫平 +カジタカ 梶高 +カジタテ 梶建 +カシタニ 柏谷 +カシタニ 樫谷 +カシタニ 菓子谷 +カシタニ 貸谷 +カシタニ 賀志谷 +カジタニ 梶谷 +カジタニ 鍛治谷 +カジタニ 鍛冶谷 +カジタニ 鍜治谷(鍜冶谷) +カジタニ 鍛谷 +カジタニ 柁谷 +カジタニ 楫谷 +カジタニ 加持谷 +カジタニ 加治谷 +カジタニ 鍜谷 +カシタミ 柏民 +カジタヤ 梶田谷 +カシヂ 樫地 +カシヅ 樫津 +カジツ 梶津 +カシツカ 樫塚 +カシヅカ 樫塚 +カシヅカ 柏塚 +カジツカ 梶塚 +カジツカ 鍛治塚(鍛冶塚) +カジヅカ 梶塚 +カジツタ 梶蔦 +カシヅメ 樫詰 +カシデ 樫出 +カジト 梶戸 +カシトウ 樫東 +カジトウ 梶藤 +カジトウ 梶東 +カジトリ 梶取 +カジトリ 楫取 +カジトリ 揖取 +カシナ 加科 +カシナ 神志名 +ガジナ 我科 +カシナカ 柏中 +カシナガ 樫永 +カジナカ 鍛治中(鍜治中) +カジナカ 梶中 +カジナカ 梶仲 +カジナカ 鍛冶中 +カジナガ 梶永 +カジナガ 鍛治永 +カジナミ 梶並 +カジナミ 梶波 +カジナリ 鍛成 +カジナワ 梶縄 +カジナワ 梶繩 +カジニシ 梶西 +カジニシ 楫西 +カジヌマ 梶沼 +カシネ 樫根 +カジネ 鍛治根(鍛冶根) +カシノ 柏野 +カシノ 樫野 +カシノ 菓子野 +カシノ 樫埜 +カジノ 梶野 +カジノ 楫野 +カジノ 鍛野(鍜野) +カジノ 鍛治野 +カジノ 鍛冶野 +カジノ 鍜治野 +カジノ 加治野 +カジノ 揖野 +カジノ 楮野 +カシノウラ 槝之浦 +カシノキ 樫木 +カシノブ 柏信 +カシノマ 柏野間 +カシハ 貸波 +カシバ 柏葉 +カシバ 樫葉 +カシバ 加芝 +カシバ 加柴 +カシバ 鹿柴 +カシバ 貸場 +カシバ 花新発(花新發) +カシバ 樫羽 +カジハ 梶葉 +カジバ 梶葉 +カジバ 鍛治場 +カジバ 鍛冶場 +カシバエ 樫栄(樫榮) +カシハタ 樫畑 +カシバタ 加志畑 +カジハタ 楮畑 +カジハタ 梶畑 +カジハタ 梶畠 +カジハタ 鍛治畑 +カジハタ 鍛冶畑 +カジバタ 梶畑 +カジバタ 梶畠 +カジバタ 鍛次畠 +カジバタ 鍜治畑 +カジハマ 梶浜 +カジハマ 梶濱 +カジハマ 楫浜 +カシバヤシ 樫林 +カシバヤシ 橿林 +カシバヤシ 柏林 +カジバヤシ 梶林 +カシハラ 柏原 +カシハラ 樫原 +カシハラ 栢原 +カシハラ 橿原 +カジハラ 梶原 +カジハラ 楮原 +カジハラ 柁原 +カジハラ 加治原 +カジハラ 鍛原 +カジハラ 鍛治原 +カジハラ 鍛冶原 +カジハラ 鍜治原 +カシビ 柏比 +カジヒ 梶肥 +カシヒラ 樫平 +カシヒラ 柏平 +カジヒラ 梶平 +カジヒロ 鍛広 +カジヒロ 鍛治広 +カジヒロ 鍜広 +カシフク 樫福 +カジフサ 梶房 +カシフジ 樫藤 +カシブチ 柏渕 +カシブチ 橿渕 +カシブチ 橿淵 +カシブチ 柏淵 +カシブチ 樫渕 +カシベ 樫部 +カジベ 梶部 +カジベ 楫部 +カシボ 橿棒 +カジホ 梶保 +カシボウ 橿棒 +カジボリ 加治堀 +カシマ 鹿島 +カシマ 加島 +カシマ 鹿嶋 +カシマ 加嶋 +カシマ 葛島 +カシマ 家島 +カシマ 香島(香嶌) +カシマ 賀島 +カシマ 嘉島 +カシマ 香嶋 +カシマ 賀嶋 +カシマ 鹿嶌 +カシマ 鍛島 +カシマ 嘉志摩 +カシマ 加隝 +カシマ 嘉嶋 +カシマ 佳島 +カシマ 加嶌 +カシマ 華島 +カシマ 樫間 +カシマ 鍜島 +カジマ 鹿島 +カジマ 加島 +カジマ 梶間 +カジマ 鹿嶋 +カジマ 加嶋 +カジマ 賀島 +カジマ 嘉島 +カジマ 賀嶋 +カジマ 鹿嶌 +カジマ 鍛島 +カジマ 楫間 +カジマ 加治間 +カジマ 加治馬 +カジマ 梶馬 +カジマ 鍛治間 +カジマ 鍛治馬 +カジマ 鍜治馬 +カジマ 鍜島 +カジマエ 加治前 +カジマエ 梶前 +カジマキ 梶巻 +カシマタ 柏俣 +カシマタ 柏又 +カシマタ 樫又 +カシマダ 鹿島田 +カシマダ 鹿嶋田 +カジマタ 梶又 +カジマチ 鍛治町 +カジマチ 鍛冶町 +カジマツ 梶松 +カシマヤ 加島谷 +カジマヤ 梶間谷 +カジマヤ 鹿島谷 +カジマル 梶丸 +カジマル 花時丸 +カシミ 樫見 +カシミ 柏子見 +カジミ 梶見 +カジミツ 梶光 +カシムラ 樫村 +カシムラ 柏村 +カシムラ 鹿志村 +カシムラ 橿村 +カシムラ 加志村 +カシムラ 可士村 +カシムラ 樫志村 +カシムラ 鹿師村 +カジムラ 梶村 +カジムラ 梶邑 +カジムラ 鍛治村 +カジムラ 鍛冶村 +カジムラ 加治村 +カジムラ 鍛村 +カジムラ 鍜村 +カジムラヤ 鍛治村谷 +カジメ 梶目 +カシモ 鹿紫雲 +カシモト 樫本 +カシモト 柏本 +カシモト 橿本 +カシモト 樫元 +カシモト 柏元 +カシモト 菓子本 +カジモト 梶本 +カジモト 楮本 +カジモト 鍛治本 +カジモト 梶元 +カジモト 楫本 +カジモト 鍛冶本 +カジモト 嘉治本 +カジモト 鍛本 +カジモト 楮元 +カジモト 加治本 +カジモト 鑑次元 +カジモト 鍛元 +カジモト 鍛次本 +カジモト 鍛治元 +カジモト 鍛冶元 +カジモト 揖本 +カジモト 鍜治元 +カジモト 鍜治本 +カジモト 鍜本 +カシモリ 樫森 +カシモリ 柏森 +カジモリ 梶森 +カシヤ 樫谷 +カシヤ 賀志谷 +カジヤ 梶谷 +カジヤ 加治屋 +カジヤ 梶屋 +カジヤ 鍛治谷 +カジヤ 鍛治屋 +カジヤ 梶家 +カジヤ 鍛冶屋 +カジヤ 鍛冶谷 +カジヤ 鍛屋 +カジヤ 鍜治谷(鍜冶谷) +カジヤ 柁谷 +カジヤ 梶矢 +カジヤ 楫屋 +カジヤ 加冶屋 +カジヤ 鍜治屋 +カジヤ 加治矢 +カジヤ 加治家 +カジヤ 加地屋 +カジヤ 鍛家 +カジヤ 鍛治家 +カジヤ 鍛治矢 +カジヤ 鍜冶屋 +ガシャ 我謝 +ガジャ 我謝 +カシヤエ 樫八重 +カジヤガイト 梶谷垣内 +カジヤグチ 鍛治谷口 +カシャクマ 嘉者熊 +カシャグマ 嘉者熊 +カシヤクラ 柏矢倉 +カシヤグラ 柏櫓 +カシヤグラ 柏矢倉 +カジヤサコ 梶谷迫 +カジヤシキ 鍛治屋敷(鍜治屋敷) +カジヤシキ 鍛冶屋敷 +カジヤス 梶泰 +カジヤナ 鍛治梁 +カジヤナ 鍛冶梁 +カジヤナ 鍜治梁 +カシヤナギ 柏柳 +カシヤブ 柏薮 +カシヤマ 樫山 +カシヤマ 柏山 +カシヤマ 橿山 +カシヤマ 白梼山 +カシヤマ 白檮山 +カシヤマ 加司山 +カシヤマ 貸山 +カシヤマ 賀史山 +カジヤマ 梶山 +カジヤマ 楮山 +カジヤマ 楫山 +カジヤマ 鍛治山 +カジヤマ 加治山 +カジヤマ 華地山 +カジヤマ 鍛冶山 +カジヤマ 柁山 +カシュ 加朱 +カシュウ 賀集 +カシュウ 加集 +カシュウ 加洲 +カシュウ 加州 +カジュウ 嘉重 +カジュウ 加重 +カジュウ 梶生 +ガシュウ 賀集 +カジュウジ 勧修寺 +カジュン 加順 +カショ 家所 +カショウ 加生 +カショウ 嘉生 +カショウ 嘉正 +カショウ 加祥 +カショウ 香庄 +カショウ 加小 +カショウ 加姓 +カショウ 嘉祥 +カジョウ 加城 +カジョウ 加場 +カジョウ 鹿上 +カジョウ 加条 +ガジョウ 賀定 +カショウジ 嘉祥寺 +カショウジ 嘉祥司 +カショウジヤ 嘉祥寺谷 +カジヨシ 梶芳 +カジヨシ 梶吉 +カシラギ 頭木 +カシラクボ 頭久保 +カシラシタ 頭下 +カシラジマ 頭島 +カシラモト 頭本 +カジリ 加尻 +カシロ 神代 +カシロ 嘉代 +カシロ 加代 +カシロ 加城 +カシロ 鹿城 +カシロ 賀城 +カシロ 賀代 +カシロ 嘉白 +カシロ 歌城 +カジロ 神代 +カジロ 上代 +カジロ 神白 +カシワ 柏 +カシワ 鹿志和 +カシワ 柏輪 +カシワイ 柏井 +カシワイ 柏居 +カシワウチ 柏内 +カシワエダ 柏枝 +カシワオ 柏尾 +カシワキ 柏木 +カシワキ 樫脇 +カシワギ 柏木 +カシワギ 栢木 +カシワギ 柏樹 +カシワギ 柏城 +カジワキ 梶脇 +カシワギダニ 柏木谷 +カシワク 柏工 +カシワグチ 柏口 +カシワクマ 柏熊 +カシワグマ 柏熊 +カシワクラ 柏倉 +カシワクラ 柏蔵 +カシワグラ 柏倉 +カシワザカ 柏坂 +カシワサキ 柏崎 +カシワザキ 柏崎 +カシワザキ 柏嵜 +カシワサケ 柏酒 +カシワザケ 柏酒 +カシワサコ 柏迫 +カシワザコ 柏迫 +カシワザワ 柏沢 +カシワジ 柏次 +カシワジマ 柏島 +カシワジマ 柏嶋 +カシワセ 柏瀬 +カシワダ 柏田 +カシワダテ 柏館 +カシワダテ 柏舘 +カシワタニ 柏谷 +カシワダニ 柏谷 +カジワタリ 梶渡 +カシワデ 膳 +カシワデ 柏手 +カシワド 柏戸 +カシワド 拍戸 +カシワドウ 柏堂 +カシワトコ 柏床 +カシワドコ 柏床 +カシワナデ 柏撫 +カシワニシ 柏西 +カシワヌマ 柏沼 +カシワノ 柏野 +カシワノブ 柏信 +カシワバ 柏葉 +カシワバ 栢葉 +カシワバ 柏場 +カシワバシ 柏橋 +カシワバシ 柏槁 +カシワバタ 柏端 +カシワハラ 柏原 +カシワバラ 柏原 +カシワヒラ 柏平 +カシワブチ 柏渕 +カシワブチ 柏淵 +カシワベ 柏部 +カシワマタ 柏俣 +カシワマタ 柏又 +カシワマル 柏丸 +カシワムラ 柏村 +カシワメ 柏女 +カシワモト 柏本 +カシワモリ 柏森 +カシワヤ 柏谷 +カシワヤ 柏屋 +カシワヤ 柏矢 +カシワヤナギ 柏柳 +カシワヤマ 柏山 +カシワラ 柏原 +カシワラ 樫原 +カジワラ 梶原 +カジワラ 柁原 +カジワラ 鍛原 +カジワラ 楫原 +カシワワケ 柏分 +カシン 嘉新 +カシン 嘉信 +カシン 加進 +カシン 可信 +カス 糟 +カズ 嘉数(嘉數) +カズ 一 +カズ 嘉津 +カズ 数 +カズ 和 +カズ 數 +カズ 加寿 +カスイ 香水 +カスイ 粕井 +カスイ 賀須井 +カスイ 糟井 +カスイ 加須井 +カスイ 槽井 +カズイ 一井 +カズイ 数井 +カズイ 和井 +カズイ 數井 +カズイエ 数家(數家) +カスウ 嘉数(嘉數) +カズウシ 数牛 +カスエ 霞末 +カスエ 加須栄(加須榮) +カスエ 糟江 +カスエ 粕江 +カズエ 主計 +カズエ 数江(數江) +カズエ 数枝 +カズエ 数永 +カズエ 加末 +カズエダ 一枝 +カズエン 一圓 +カスオ 粕尾 +カスオ 糟尾 +カズオ 葛尾 +カズオ 数尾 +カズオ 數尾 +カズオカ 数岡(數岡) +カスガ 春日 +カスガ 加須我 +カスガ 加須賀 +カスガ 加菅 +カスガ 粕賀 +カズカ 一香 +カスガイ 春日井 +カスガイ 鎹 +カスガイ 糟貝 +カスガオカ 春日岡 +カスガカワ 春日川 +カスガダ 春日田 +カズカタ 一肩 +カスガノ 春日野 +カスガノ 春日埜 +カスガハラ 春日原 +カスカベ 春日部 +カスカベ 粕壁 +カスカベ 月下部 +カスカベ 糟壁 +カスガベ 春日部 +カスカミ 霞上 +カスガミ 霞上 +カスガメ 春日亀 +カスカヤ 粕加屋 +カスガヤ 粕加屋 +カスガヤ 春日谷 +カスガヤ 春日屋 +カスガヤマ 春日山 +カスカワ 粕川 +カスカワ 糟川 +カスガワ 春日川 +カズカワ 一川 +カズカワ 数川(數川) +カズカワ 数河 +カズキ 加附 +カズキ 数木 +カズキ 和己 +カズグチ 一口 +カズクラ 和倉 +カズサ 上総 +カズサ 数佐(數佐) +カズサ 上總 +カズサ 葛佐 +カズサ 数左 +カズサカ 数坂 +カズサカ 数阪(數阪) +カズサカ 數坂 +カズサキ 数崎 +カズサキ 數崎 +カズサワ 万沢 +カズサワ 和澤 +カズサワ 数沢(數澤) +カズサワ 萬澤 +カズサワ 数澤 +カズサワ 萬沢 +カズシマ 一島 +カズシマ 数島 +カズシロ 数代 +カズセ 一瀬 +カズセ 数瀬 +カスタ 粕田 +カスダ 粕田 +カスダ 嘉数田 +カスダ 糟田 +カズタ 数田 +カズタ 一田 +カズタ 数多 +カズタ 數田 +カスタニ 粕谷 +カスタニ 糟谷 +カズチカ 数近 +カズナガ 数永 +カズナガ 数長 +カズナリ 数成 +カズニ 和仁 +カズヌキ 数貫 +カスノ 糟野 +カスノ 粕野 +カズノ 数野 +カズノ 鹿角 +カズノ 數野 +カズノウ 数納(數納) +カズノブ 数延 +カズノリ 数乗 +カズノリ 數乘 +カスバタ 霞流 +カズハマ 数浜 +カズハラ 数原 +カズハラ 數原 +カスハリ 粕張 +カスブチ 粕渕 +カスブチ 粕淵 +カスブチ 糟淵(糟渕) +カズマ 数馬 +カズマ 和間 +カズマ 葛馬 +カズマ 数間(數間) +カズマ 一間 +カズマ 一真 +カズマ 數馬 +カズマス 数益 +カズマタ 一万田 +カズマタ 数又 +カズマタ 数馬田 +カズマタ 數馬田 +カスミ 霞 +カスミ 鹿住 +カスミ 春見 +カスミ 嘉住 +カスミ 香住 +カスミ 加角 +カスミ 可須水 +カスミ 加隅 +カスミ 加住 +カスミ 鍛炭 +カズミ 一見 +カズミ 数見 +カズミ 鹿住 +カズミ 嘉積 +カズミ 香積 +カズミ 数実 +カズミ 一三 +カズミ 一身 +カズミ 数味 +カズミ 數見 +カズミ 員見 +カスミザワ 霞沢 +カスミザワ 霞澤 +カスミドウ 霞堂 +カスミドリ 霞鳥 +カズミネ 一峰 +カスミモト 霞本 +カズムラ 数村 +カズムラ 數村 +カズモ 一最 +カスモト 粕本 +カズモト 楮本 +カズモト 数本 +カズモト 数元(數元) +カズモト 和本 +カズモト 一元 +カズモト 員本 +カズモト 数許 +カズモト 數本 +カズモリ 一森 +カズモリ 計盛 +カズモリ 数森(數森) +カスヤ 粕谷 +カスヤ 糟谷 +カスヤ 加須屋 +カスヤ 春谷 +カスヤ 糟屋 +カスヤ 粕屋 +カスヤ 幽谷 +カスヤ 槽谷 +カズヤ 数家(數家) +カズヤ 数谷 +カスヤマ 粕山 +カズヤマ 和山 +カズヤマ 数山(數山) +カズヤマ 量山 +カズヨシ 一好 +カズヨリ 数寄 +カズラ 藤 +カズラ 葛 +カズラオ 葛尾 +カズラタチ 葛立 +カズラヤマ 葛山 +カスリ 嘉須利 +カズワ 一和 +カセ 加瀬 +カセ 加勢 +カセ 嘉瀬 +カセ 加世 +カセ 稼勢 +カセ 可瀬 +カセ 嘉勢 +カセ 賀勢 +カセ 加清 +カセ 綛 +カセ 絈 +カゼ 風 +ガセ 賀瀬 +カゼアナ 風穴 +カセイ 加勢 +カセイ 嘉瀬井 +カセイ 家政 +カセイ 絈井 +カセイ 賀勢 +カセイ 加清 +カセイ 綛井 +カセイ 䋆井 +カセイ 加瀬井 +カセイ 花清 +カセイ 佳瀬井 +カセイ 加世井 +カセイ 加聖 +カゼイ 風井 +カゼオ 風尾 +カゼオカ 風岡 +カセガイ 加瀬谷 +カゼガハタ 風ケ端 +カゼカミ 風神 +カセガワ 加瀬川 +カセガワ 加勢川 +カセガワ 紣川(綷川) +カセガワ 加長川 +カゼカワ 風川 +カセキ 可世木 +カセギ 可世木 +カセギ 稼木 +カセギ 稼 +カセギ 加世木 +カゼキ 風木 +カゼグチ 風口 +カセクマ 加勢熊 +カセグマ 加勢熊 +カセグマ 忰熊 +カゼコシ 風越 +カセザワ 加瀬沢 +カセザワ 加瀬澤 +カセザワ 䋆沢 +カセザワ 䋆澤 +カセザワ 絈沢 +カゼシタ 風下 +カセジマ 鹿瀬島 +カセダ 加世田 +カセダ 忰田 +カセダ 加勢田 +カセダ 綛田 +カセダ 加瀬田 +カセダ 悴田 +カセダ 䋆田 +カセダ 加世多 +カゼタ 風田 +カセタニ 加瀬谷 +カセタニ 綛谷 +カセタニ 䋆谷 +カセタニ 絈谷 +カゼタニ 風谷 +カゼト 風戸 +カセドウ 加世堂 +カゼトウ 風藤 +カゼトメ 風留 +カゼナシ 風無 +カセノ 加瀬野 +カセノ 絈野 +カセノ 綛野 +カゼノ 風野 +カゼハタ 風端 +カゼハヤ 風早 +カゼハヤ 風速 +カゼハヤ 風隼 +カセバヤシ 加瀬林 +カゼバヤシ 風林 +カゼハラ 風原 +カゼハリ 風張 +カゼハル 風晴 +カゼハレ 風晴 +カセベ 加瀬部 +カセベ 忰部 +カセマ 加瀬間 +カゼマキ 風巻 +カゼミ 風見 +カセム 嵩 +カセムラ 綛村 +カセムラ 䋆村 +カゼムラ 風村 +カセモト 加勢本 +カセモト 綛本 +カセモト 綛元 +カセモト 枷本 +カセモト 䋆本 +カゼモト 風本 +カゼモト 風元 +カゼモリ 風盛 +カセヤ 加瀬谷 +カセヤ 綛谷 +カセヤ 䋆谷 +カセヤ 䋆屋 +カセヤ 綛屋 +カゼヤ 風谷 +カゼヤナギ 風柳 +カセヤマ 忰山 +カセヤマ 綛山 +カセヤマ 嘉勢山 +カセヤマ 絈山 +カセヤマ 枠山 +カセヤマ 加勢山 +カセヤマ 香世山 +カセヤマ 悴山 +カゼヤマ 風山 +カセン 貨泉 +カソ 家曽 +カソウ 加相 +カソウ 笠生 +カソウ 加荘 +カゾウ 加増 +カゾウ 加蔵 +カゾエ 主計 +カゾエ 算 +カゾエ 嘉副 +カゾエ 籌 +カゾエ 加添 +カゾエ 筭 +カソガ 加曽我 +カゾネ 楮根 +カソノ 加園 +カゾノ 加園 +カゾノ 香園 +カゾノ 鹿苑 +カゾハラ 楮原 +カソリ 加曽利 +カソリ 加曾利 +カソリ 加反 +カソリ 賀曾利 +カソリ 賀曽利 +カソリ 加増利 +カソリ 加曽里 +カタ 加田 +カタ 嘉田 +カタ 片 +カタ 加太 +カタ 賀田 +カタ 嘉多(嘉夛) +カタ 方 +カタ 形 +カタ 肩 +カタ 加多 +カダ 加田 +カダ 嘉田 +カダ 加太 +カダ 賀田 +カダ 駕田 +カダ 鍛田 +カダ 佳田 +カダ 加多 +カダ 蚊田 +カダ 鍜田 +ガタ 潟 +カタアマ 片塰 +カタイ 片井 +カタイ 方井 +カタイ 賀多井 +カタイ 形井 +カタイ 片居 +カタイ 堅井 +カダイ 加代 +カタイエ 片家 +カタイキ 片伊木 +カタイキ 片井木 +カタイギ 片居木 +カタイギ 片伊木 +カタイギ 方伊儀 +カタイケ 片池 +カタイシ 片石 +カタイシ 堅石 +カタイシ 形石 +カタイセ 片伊勢 +カタイタ 片板 +カタイデ 片出 +カタイト 片糸 +カタイノ 片井野 +カダイラ 花平 +カタイワ 片岩 +カタウケ 片受 +カタウチ 片内 +カタウチ 県内 +カタウチ 縣内 +カタウミ 片海 +カタウミ 堅海 +カタウラ 片浦 +カタウラ 形浦 +カタウラ 潟浦 +カタウリ 片瓜 +カタエ 片江 +カタエ 片衛 +カタオ 片尾 +カタオ 堅尾 +カタオ 方緒 +カタオ 方尾 +カタオ 堅小 +カタオカ 片岡 +カタオカ 形岡 +カタオカ 方岡 +カタオカ 堅岡 +カタオカ 潟岡 +カタオカ 片丘 +カタオカ 加田岡 +カタオカ 片岳 +カタオダ 片小田 +カタオナミ 片男浪 +カタオリ 片折 +カタカイ 片貝 +カタガイ 片貝 +カタガイ 片外 +カタガキ 片垣 +カタカケ 片掛 +カタガケ 片懸 +カタカス 片粕 +カタガセ 片ケ瀬 +カタカタ 片方 +カタガタ 片方 +カタカベ 片伯部 +カタカマ 片鎌 +カタカミ 片上 +カタカミ 形神 +カタカミ 堅上 +カタガミ 片上 +カタガミ 潟上 +カタガミ 形上 +カタガミ 形神 +カタガミ 堅上 +カタガミ 方上 +カタガミ 加多上 +カタガミ 賀多上 +カタガミ 肩上 +カタガミ 片神 +ガタガミ 潟上 +ガタガミ 瀉上 +カタカメ 片亀 +カタガメ 片亀 +カタガヤ 潟ケ谷 +カタカリ 片苅 +カタカリ 片刈 +カタカリ 片狩 +カタカワ 片川 +カタカワ 形川 +カタカワ 方川 +カタカワ 堅川 +カタカワ 片河 +カタガワ 片川 +カタガワ 形川 +カタガワ 方川 +カタガワ 片河 +カタガワ 片側 +カタガワ 旁川 +カタキ 片木 +カタキ 堅木 +カタギ 樫木 +カタギ 片木 +カタギ 樫 +カタギ 堅木 +カタギ 加田木 +カタギ 加多木 +カタギク 片菊 +カタギサコ 樫迫 +カタギシ 片岸 +カタギシ 潟岸 +カタキハラ 形木原 +カタギハラ 樫原 +カタギハラ 形木原 +カタギヤ 片木谷 +カタキヤマ 片木山 +カタギヤマ 樫山 +カタギヤマ 片木山 +カタギリ 片桐 +カタギリ 片切 +カタギリ 形切 +カタギリ 方桐 +カタク 家宅 +カタクイ 方杭 +カタクセ 交久瀬 +カタグチ 片口 +カタグチ 潟口 +カタグチ 瀉口 +ガタグチ 潟口 +カタクビ 片首 +カタクラ 片倉 +カタクラ 方倉 +カタクラ 形倉 +カタクワ 形鍬 +カタケ 鹿嶽 +カタケ 鹿岳 +カタケ 蒲武 +カタコウ 片河 +カタコウ 片向 +カタゴオリ 片郡 +カタコザワ 片子沢 +カタコザワ 片子澤 +カタコタ 片小田 +カタコダ 片小田 +カタザ 片座 +カタザ 片坐 +カタザ 片㘴 +カタサカ 片坂 +カタサカイ 片境 +カタザカイ 片境 +カタサキ 片崎 +カタサキ 潟崎 +カタサコ 片迫 +カタザワ 片沢 +カタザワ 片澤 +カタシ 堅 +カタシ 堅志 +カタジ 片地 +カタジ 形地 +カタシオ 片塩 +カタシゲ 片重 +カタシタ 片下 +カタシバ 片芝 +カタシバ 片柴 +カタシマ 片島 +カタシマ 片嶋 +カタシマ 片嶌 +カタシマ 堅島 +カタシマ 方島 +カタジマ 片島 +カタジマ 片嶋 +カタショ 片所 +カタシロ 片白 +カタシロ 堅城 +カタシロ 固城 +カタシロ 片城 +カタスミ 片角 +カタセ 片瀬 +カタソト 片外 +カタタ 片田 +カタタ 堅田 +カタタ 片多 +カタタ 堅多 +カタダ 片田 +カタダ 堅田 +カタダ 片多 +カタダ 形田 +カタダ 堅多 +カタダ 潟田 +カタダ 県田(縣田) +カタダ 加多駄 +カタダ 瀉田 +カタタエ 片田江 +カタダエ 片田江 +カタタニ 片谷 +カタタニ 形谷 +カタダニ 片谷 +カタダノ 片田野 +カタチ 片地 +カタチ 形地 +カタチヤマ 形山 +カタツ 片津 +カタツキ 片月 +カタツグ 堅次 +カタヅメ 片爪 +カタテ 片手 +カタデ 片出 +ガタテ 潟手 +ガタデ 潟手 +カタドコロ 片所 +カタナカ 潟中 +カタナガ 潟永 +カタナガ 片長 +ガタナガ 潟永 +ガタナガ 瀉永 +カタナサカ 刀坂 +カタナザカ 刀坂 +カタナサコ 刀迫 +カタナザワ 刀沢 +カタナザワ 刀澤 +カタナハラ 刀原 +カタナベ 片鍋 +カタナミ 方波見 +カタナミ 片波 +カタナミ 片浪 +カタナヤ 刀谷 +カタニ 賀谷 +カタニ 加谷 +カタニ 蚊谷 +カタニ 肩荷 +カタニ 菓谷 +カダニ 賀谷 +カダニ 加谷 +カダニ 蚊谷 +カタニシ 片西 +カタニシ 潟西 +カタニワ 片庭 +カタヌマ 片沼 +カタヌマ 潟沼 +カタネ 片根 +カタノ 片野 +カタノ 交野 +カタノ 形野 +カタノ 加田野 +カタノ 堅野 +カタノ 方野 +カタノ 肩野 +カタノ 潟野 +カタノ 賀田野 +カタノ 加多納 +カタノ 形埜 +カタノ 瀉野 +ガタノ 潟野 +カタノサカ 片野坂 +カタノサカ 片之坂 +カタノサカ 片ノ坂 +カタノザカ 片野坂 +カタノザカ 片之坂 +カタノダ 片野田 +カタハ 片羽 +カタハ 堅羽 +カタバ 片場 +カタハシ 片橋 +カタハタ 片畑 +カタハタ 潟端 +カタハタ 片畠 +カタバタ 潟端 +カタハバ 形幅 +カタハマ 片浜 +カタハマ 片濱 +カタバミ 方波見 +カタバミ 方喰 +カタバミ 片波見 +カタバミ 酸漿 +カタバヤシ 片林 +カタハラ 片原 +カタハラ 形原 +カタハラダ 片原田 +カタヒラ 片平 +カタヒラ 加田平 +カタビラ 帷子 +カタビラ 惟子 +カタビラ 帷 +カタヒロ 片広 +カタヒロ 片廣 +カタブキ 片葺 +カタフク 形福 +カタフジ 片藤 +カタフタ 片蓋 +カタフチ 片渕 +カタフチ 片淵 +カタフチ 潟渕 +カタフチ 潟淵 +カタブチ 片渕 +カタブチ 片淵 +カタブチ 潟渕 +カタブチ 潟淵 +カタベ 形部 +カタベ 潟辺(潟邊) +カタベ 片部 +カタベ 片辺(片邊・片邉) +カタベ 潟邉 +カタホ 片保 +カタホ 潟保 +カタホカ 片外 +カタホノ 片穂野(片穗野) +カタマエ 片前 +カタマキ 片牧 +カタマタ 片又 +カタマタ 片股 +カタマタ 片叉 +カタマチ 片町 +カタマツ 片松 +カタマル 片丸 +カタマワリ 片廻 +カタミ 片見 +カタミ 形見 +カタミ 傍示 +カタミ 潟見 +カタミナト 潟湊 +カタミネ 片峰 +カタミネ 片峯 +カタミネ 片嶺 +カタミネ 片領 +カタミヤ 片宮 +カタムネ 片宗 +カタムラ 片村 +カタムラ 瀉村 +カタムラ 方村 +カタムラ 形村 +ガタムラ 潟村 +ガタムラ 泻村 +カタモト 片本 +カタモト 片元 +カタモト 固本 +カタモト 形本 +カタモト 潟元 +カタモト 堅本 +カタモト 堅元 +カタモト 方本 +カタモリ 方森 +カタヤ 片谷 +カタヤ 片矢 +カタヤ 形屋 +カタヤ 形谷 +カタヤ 堅谷 +カタヤ 片屋 +カタヤ 肩谷 +カタヤナギ 片柳 +カタヤナギ 形柳 +カタヤマ 片山 +カタヤマ 形山 +カタヤマ 方山 +カタヤマ 潟山 +カタヤマ 堅山 +カタヤマ 嘉多山 +カタヤマ 泻山 +カタヤマ 加田山 +カタヤマ 花多山 +カタヤマ 縣山 +カタヤマ 剛山 +ガタヤマ 潟山 +ガタヤマ 瀉山 +カタヨ 片夜 +カタヨシ 片吉 +カタヨセ 片寄 +カタヨセ 片奇 +カタヨリ 片寄 +カタラオ 荊尾 +カタラギ 神多羅木 +カタリョウ 片良 +カタワキ 片脇 +カダン 花檀 +カダン 家段 +カダン 花段 +カチ 加地 +カチ 可知 +カチ 甲地 +カチ 加知 +カチ 加智 +カチ 賀知 +カヂ 加地 +カヂ 加治 +カヂ 嘉地 +カヂ 賀地 +カチイ 可知井 +カチカワ 勝川 +カチキ 勝木 +カチク 加筑 +カチシタ 加知下 +カチス 加千須 +カチタ 歩田 +カチタ 歩行田 +カチハマ 歩浜(歩濱) +カチヤス 河千泰 +カチヤマ 華地山 +カチュウ 家中 +カチュウ 賀中 +カチョウ 華頂 +カチョウ 蚊帳 +カチョウ 可長 +ガチョウ 賀長 +カチョウメン 加帳面 +カツ 勝 +カツ 嘉津 +カツ 且 +カツ 加津 +カツ 勝津 +カヅ 賀津 +カツイ 勝井 +カツイ 葛井 +カツイ 勝居 +カツイ 且井 +カツイエ 勝家 +カツイケ 勝池 +カツイシ 滑石 +カツイズミ 勝泉 +カツイソ 勝磯 +カツウエ 勝上 +カツウマ 勝馬 +カツウミ 勝海 +カツウラ 勝浦 +カツウラ 桂浦 +カツエ 勝江 +カツエダ 勝枝 +カツエン 勝円 +カツオ 勝尾 +カツオ 勝男 +カツオ 且尾 +カツオ 鰹 +カヅオ 葛尾 +カツオウギ 勝扇 +カツオカ 葛岡 +カツオカ 勝岡 +カツオギ 鰹木 +カヅカ 加塚 +カヅカ 鹿塚 +カツカガ 勝利 +カツカタ 勝方 +カツカミ 葛上 +カツカワ 勝川 +カツカワ 葛川 +カツカワ 勝河 +カツカワ 曷川 +カッキ 柿木 +カツキ 香月 +カツキ 勝木 +カツキ 甲木 +カツキ 勝城 +カツキ 加月 +カツキ 嘉月 +カツキ 勝岐 +カツキ 禾木 +カツキ 勝喜 +カヅキ 香月 +カヅキ 加附 +カツキタ 蒲田 +カツキタ 勝木田 +カツキダ 勝木田 +カツキヤ 勝木屋 +カツグチ 勝口 +カツクラ 勝倉 +カツゲ 勝毛 +カッコウ 覚幸 +カツコウ 勝幸 +ガッコウ 月光 +カツコシ 勝越 +カッコンダ 葛根田 +カツサ 勝佐 +カヅサ 上総 +カヅサ 上佐 +カヅサ 葛佐 +カッサイ 葛西 +カツサカ 勝坂 +カツザキ 勝崎 +カツザキ 勝碕 +カツザキ 勝嵜 +カツザキ 勝埼 +カツサコ 葛迫 +カツサト 勝里 +ガッサビ 合佐毘 +ガッサビ 合佐昆 +カツサワ 勝沢 +カツサワ 勝澤 +カツザワ 勝沢 +カツザワ 勝澤 +カツシ 勝志 +カツジ 勝地 +カツジ 勝治 +カツジ 加辻 +カツシカ 勝然 +カツシカ 葛飾 +カツシゲ 勝重 +カツシタ 勝下 +カツシバ 勝柴 +カツシバ 勝芝 +カツシマ 勝島 +カツシマ 葛島 +カツシマ 勝嶋 +カツシマ 勝嶌 +カツジマ 勝島 +ガッショウ 合掌 +ガッショウ 月生 +カツシロ 勝城 +カツシロ 勝代 +カツシン 勝進 +カツズイ 勝瑞 +カツセ 勝瀬 +カツセ 勝世 +カッセキ 葛石 +カツセコ 葛迫 +カッタ 勝田 +カッタ 刈田 +カツタ 勝田 +カツタ 葛田 +カツタ 活田 +カツタ 且田 +カツダ 勝田 +カツダ 葛田 +カツダ 且田 +カツタケ 勝武 +カツタニ 葛谷 +カツタニ 勝谷 +カッチ 甲地 +カツチ 勝地 +カツチ 勝池 +カッテ 勝手 +カツテ 勝手 +カツト 勝戸 +カツド 勝戸 +カットウ 甲藤 +カットウ 勝藤 +カツトウ 甲藤 +カツトウ 勝藤 +ガットウ 月東 +カツドミ 勝冨 +カットリ 甲部 +カツトリ 甲取 +カツトリ 勝取 +カツナカ 勝中 +カツナガ 勝永 +カツナガ 勝長 +カツナミ 勝浪 +カツナミ 勝並 +カツニシ 葛西 +カツニシ 勝西 +カツヌマ 勝沼 +カツネ 勝根 +カツノ 勝野 +カツノ 葛野 +カツノ 鹿角 +カツノ 勝箆 +カツノ 勝埜 +カツノ 勝篦 +カヅノ 鹿角 +カツノイ 勝野井 +カツノリ 勝乗(勝乘) +カツハ 勝羽 +カツバ 勝場 +カツバ 勝羽 +カツバ 勝葉 +カッパ 川童 +ガッパ 甲把 +カッパイ 合羽井 +カツハタ 勝畑 +カツハナ 勝花 +カツハマ 勝浜(勝濱) +カツバヤシ 勝林 +カツハラ 葛原 +カツハラ 勝原 +カツハラ 桂原 +カツハラ 且原 +カツヒサ 勝久 +カツヒラ 勝平 +カツヒロ 勝弘 +カツヒロ 勝裕 +カツフジ 勝藤 +カツベ 勝部 +カツベ 克辺 +カツベ 克邉 +カツベ 勝辺 +ガッポ 合浦 +ガッポ 合蒲 +ガッポ 合甫 +ガッポウ 合宝(合寳) +カツマ 勝間 +カツマ 葛馬 +カツマ 勝馬 +カツマ 勝真 +カツマ 羯磨 +カツマ 加津間 +カツマ 勝眞 +カツマ 勝摩 +カヅマ 鹿妻 +カヅマ 加津間 +カツマサ 勝政 +カツマサ 勝正 +カツマタ 勝又 +カツマタ 勝俣 +カツマタ 勝亦 +カツマタ 勝間田 +カツマタ 勝股 +カツマタ 且股 +カツマタ 勝馬田 +カツマタ 且又 +カツマタ 勝叉 +カツマダ 勝間田 +カツマヤ 勝間谷 +カツマル 勝丸 +カツミ 勝見 +カツミ 勝海 +カツミ 勝美 +カツミ 且見 +カツミ 且味 +カツミ 勝身 +カツミ 蚊津見 +カヅミ 香積 +カツミズ 勝水 +カツミネ 勝峰 +カツミネ 勝峯 +カツミヤ 勝宮 +カツムラ 勝村 +カツメ 勝目 +カツメ 蚊爪 +カヅメ 葛綿 +カヅメ 蚊爪 +カヅメ 神爪 +カツメイ 勝命 +カツモト 勝本 +カツモト 葛本 +カツモト 勝元 +カツモト 且元 +カツモト 且本 +カツモリ 勝盛 +カツモリ 勝守 +カツモリ 勝森 +カツヤ 葛谷 +カツヤ 勝谷 +カツヤ 勝矢 +カツヤ 勝屋 +カツヤ 勝家 +カツヤ 勝治 +カツヤ 勝冶 +カツヤ 鰹谷 +カツヤ 鰹屋 +カツヤ 勝箭 +カツヤマ 勝山 +カツヤマ 葛山 +カツヤマ 嘉津山 +カツヤマ 加津山 +カツヤマ 堪山 +カツヤマ 戛山 +カツヨシ 勝吉 +カツヨシ 勝好 +カツラ 桂 +カツラ 勝連 +カツラ 葛 +カツラ 曽良 +カツラ 勝良 +カツラ 勝占 +カツラ 曾良 +カツラ 葛良 +カツラ 勝羅 +カツラ 加貫 +カツラ 可貫 +カツライ 葛井 +カツライ 桂井 +カツラウチ 桂内 +カツラウマ 葛馬 +カツラオ 葛尾 +カツラオ 桂尾 +カツラオカ 桂岡 +カツラカワ 桂川 +カツラガワ 桂川 +カツラガワ 葛川 +カツラキ 葛城 +カツラキ 桂木 +カツラギ 葛城 +カツラギ 桂木 +カツラギ 葛木 +カツラギ 桂城 +カツラギ 桂樹 +カツラク 勝楽 +カツラク 勝樂 +カツラグチ 桂口 +カツラサカ 桂阪 +カツラサコ 葛迫 +カツラザコ 葛迫 +カツラサワ 桂沢 +カツラサワ 桂澤 +カツラザワ 桂沢 +カツラザワ 桂澤 +カツラシタ 桂下 +カツラシマ 桂島 +カツラシマ 桂嶋 +カツラジマ 桂島 +カツラジマ 桂嶋 +カツラタ 桂田 +カツラダ 桂田 +カツラダケ 桂嶽 +カツラデ 桂出 +カツラノ 桂野 +カツラハタ 桂畑 +カツラバヤシ 桂林 +カツラハラ 葛原 +カツラハラ 桂原 +カツラバラ 桂原 +カツラヒラ 桂平 +カツラマキ 葛巻(葛卷) +カツラマキ 桂巻 +カツラモト 桂本 +カツラヤ 桂谷 +カツラヤ 桂屋 +カツラヤ 鬟谷(鬘谷) +カツラヤマ 葛山 +カツラヤマ 桂山 +カヅラヤマ 葛山 +カツレン 勝連 +カツロ 勝呂 +カツワタ 葛綿 +カテカリ 嘉手苅 +カテガリ 嘉手苅 +カデカリ 嘉手苅 +カテカル 嘉手苅 +カデカル 嘉手苅 +カデカル 嘉手刈 +カテカワ 嘉手川 +カテガワ 嘉手川 +カデカワ 嘉手川 +カテナ 嘉手納 +カデナ 嘉手納 +カデナ 嘉手名 +カデノコウジ 勘解由小路 +カデン 河伝 +カト 加登 +カト 加戸 +カト 嘉戸 +カト 下戸 +カト 鹿渡 +カト 嘉登 +カト 家登 +カト 蚊戸 +カト 家戸 +カド 角 +カド 門 +カド 加登 +カド 加戸 +カド 嘉戸 +カド 鹿戸 +カド 賀戸 +カド 門戸 +カド 鹿渡 +カド 加渡 +カド 廉 +カド 花土 +カド 加土 +カド 加百 +カド 家戸 +カド 加度 +カド 賀登 +カド 嘉土 +ガト 賀戸 +ガト 我戸 +ガド 賀戸 +カドアキ 門明 +カドアキ 角秋 +カドアキ 門秋 +カドイ 角井 +カドイ 門井 +カドイ 角居 +カドイ 門居 +カドイ 加土井 +カドイ 加登井 +カドイ 甬井 +カドイケ 門池 +カドイシ 角石 +カドイシ 門石 +カドイリ 角入 +カドイワ 門岩 +カトウ 加藤 +カトウ 嘉藤 +カトウ 加登 +カトウ 加戸 +カトウ 河東 +カトウ 下藤 +カトウ 加東 +カトウ 河藤 +カトウ 賀藤 +カトウ 加唐 +カトウ 花等 +カトウ 加統 +カトウ 可藤 +カトウ 家登 +カトウ 香東 +カトウ 香藤 +カトウ 歌藤 +カトウ 華藤 +カトウ 賀東 +カトウ 河隝 +カトウ 賀登 +カトウ 鴨東 +カトウ 加斗 +カトウ 加籐 +カトウ 嘉籐 +カトウ 鹿頭 +カトウ 何東 +カトウ 加当 +カトウ 加頭 +カトウ 加當 +カトウ 嘉東 +カトウ 歌頭 +カトウ 迦統 +カトウ 鹿藤 +カドウ 加堂 +カドウ 加道 +カドウ 嘉堂 +カドウ 荷堂 +ガトウ 月東 +ガトウ 賀藤 +ガトウ 我藤 +ガトウ 賀東 +ガドウ 我堂 +カドウエ 角上 +カドウエ 門植 +カトウオカ 加藤岡 +カトウカワ 加藤川 +カトウギ 加藤木 +カトウギ 佳藤木 +カトウジ 加藤子 +カトウス 加藤州 +カトウス 加藤洲 +カトウダ 河東田 +カトウダ 加藤田 +カトウダ 嘉藤田 +カドウチ 門内 +カドウチ 角内 +カトウノ 上遠野 +カトウノ 上東野 +カドウノ 上遠野 +カドウマ 門馬 +カトウミ 加藤海 +カドウミ 角海 +カドウラ 角浦 +カドウラ 門浦 +カドエ 角江 +カドエ 門江 +カドオ 角尾 +カドオ 門尾 +カトオカ 加藤岡 +カトオカ 加登岡 +カドオカ 角岡 +カドオカ 門岡 +カドオカ 廉岡 +カトオノ 上遠野 +カドオノ 上遠野 +カドオモテ 門表 +カドガキ 門垣 +カドガキ 角垣 +カドカネ 角金 +カドカミ 門上 +カドカミ 角上 +カドガミ 門上 +カトガワ 加登川 +カドカワ 角川 +カドカワ 門川 +カドカワ 角河 +カドカワ 門河 +カドカワ 楞川 +カドカワ 加戸川 +カドカワ 廉川 +カドガワ 角川 +カドガワ 門川 +カドガワ 加道川 +カドガワ 門側 +カドカワメ 角川目 +カドキ 角木 +カドキ 門木 +カドキ 闥木 +カドギシ 角岸 +カドキタ 角北 +カトク 可徳 +カトク 家徳 +カトク 加徳 +カドクチ 門口 +カドクチ 角口 +カドグチ 門口 +カドグチ 角口 +カドクニ 角国 +カドクラ 門倉 +カドクラ 角倉 +カドクリ 角栗 +カドクリ 門栗 +カドサカ 門坂 +カドサカ 角坂 +カドサカ 門阪 +カドサカ 角阪 +カドサキ 門前 +カドサキ 角崎 +カドサキ 門崎 +カドサキ 角先 +カドザキ 角崎 +カドザキ 門崎 +カドサシ 角指 +カドサワ 門沢 +カドサワ 門澤 +カドサワ 角沢 +カドサワ 廉沢 +カドサワ 角澤 +カドサワ 廉澤 +カドサン 角三 +カトシ 賀利 +カドシカ 角鹿 +カドシキ 門敷 +カドシゲ 角重 +カドシゲ 門重 +カドシタ 門下 +カドシタ 角下 +カトシマ 加登島 +カトジマ 加登島 +カドシマ 葛島 +カドシマ 角島 +カドシマ 門島 +カドシマ 角嶋 +カドシマ 門嶋 +カドシマ 廉嵎 +カドシリ 角尻 +カドシン 角新 +カドスギ 門杉 +カドスギ 角杉 +カトズミ 加登住 +カドスミ 廉隅 +カドズミ 門積 +カドズミ 廉隅 +カドセ 門瀬 +カドゾエ 門添 +カドソノ 門園 +カドゾノ 門園 +カトダ 加登田 +カドタ 角田 +カドタ 門田 +カドタ 門多 +カドタ 廉田 +カドタ 楞田 +カドタ 加渡田 +カドダ 角田 +カドダ 門田 +カドタニ 角谷 +カドタニ 門谷 +カドタニ 廉谷 +カドタニ 楞谷 +カドタミ 門田見 +カドチク 門築 +カドツカ 門塚 +カドヅカ 門塚 +カドツジ 角辻 +カドツネ 角常 +カドヅミ 門積 +カドテ 門手 +カドデ 門出 +カドデ 角出 +カドテラ 門寺 +カドデラ 門寺 +カドト 角戸 +カドトミ 門富 +カドナ 門奈 +カドナ 角納 +カドナカ 角中 +カドナカ 門中 +カドナガ 門永 +カドナガ 角永 +カドナガ 門長 +カドナシ 無門 +カドナダ 門灘 +カドナベ 門鍋 +カドナミ 門並 +カドニシ 門西 +カドニシ 角西 +カドニュウ 門丹生 +カドネ 門根 +カトノ 上遠野 +カドノ 角野 +カドノ 上遠野 +カドノ 門野 +カドノ 葛野 +カドノ 楞野 +カドノ 角埜 +カドノ 角能 +カドノ 廉野 +カドノ 角納 +カドノ 加登野 +カドノ 棱野 +カドノ 稜野 +カドノキ 角軒 +カドノクチ 門之口 +カドノクチ 門ノ口 +カドノサカ 門野坂 +カドノサワ 門ノ沢 +カドノサワ 門ノ澤 +カドノソノ 門之園 +カドノト 門ノ戸 +カドノメ 門目 +カドバ 門場 +カドハシ 角橋 +カドハシ 門端 +カドハシ 門橋 +カドハタ 門畑 +カドハタ 角畑 +カドハタ 角端 +カドハタ 門畠 +カドバタ 角畑 +カドハナ 角花 +カドハナ 角鼻 +カドハマ 角浜 +カドハマ 角濱 +カドハマ 門浜(門濱) +カトバヤシ 加登林 +カドバヤシ 門林 +カドバヤシ 廉林 +カドバヤシ 角林 +カドハラ 門原 +カドハラ 角原 +カドヒサ 門久 +カドヒラ 門平 +カドヒラ 角平 +カドヒロ 角広 +カドヒロ 門広 +カドヒロ 角廣 +カドヒロ 門廣 +カドフク 門福 +カドフサ 角房 +カドフジ 門藤 +カドフジ 門富士 +カドフミ 門文 +カドベ 門部 +カドベ 角部 +カドベ 門辺(門邉) +カドホ 角保 +カドボ 角保 +カドホリ 門堀 +カドホリ 角堀 +カドマ 門馬 +カドマ 門間 +カドマ 角間 +カドマ 門磨 +カドマエ 門前 +カドマエ 角前 +カドマサ 門政 +カドマサ 角政 +カドマス 門舛 +カドマス 角増 +カドマス 角舛 +カドマス 門桝 +カドマタ 角亦 +カドマチ 角町 +カドマチ 門町 +カドマツ 門松 +カドマツ 角松 +カドマル 角丸 +カドマル 門丸 +カトミ 加富 +カトミ 加登見 +カドミ 角海 +カドミ 角見 +カドミ 門見 +カドミ 加登見 +カドミ 門美 +カドミヤ 角宮 +カドミヤ 門宮 +カドムカイ 門向 +カドムラ 角村 +カドムラ 門村 +カドムラ 首村 +カトメ 香留 +カドメ 門目 +カドメ 角目 +カトモ 加友 +カドモト 角本 +カドモト 門本 +カドモト 門元 +カドモト 加登本 +カドモリ 角森 +カドモリ 門守 +カドモリ 門森 +カトヤ 加登谷 +カトヤ 加登屋 +カドヤ 角谷 +カドヤ 角屋 +カドヤ 門屋 +カドヤ 門谷 +カドヤ 角矢 +カドヤ 角家 +カドヤ 門矢 +カドヤ 門家 +カドヤ 廉谷 +カドヤ 格谷 +カドヤ 加登谷 +カドヤ 加登屋 +カドヤ 廉屋 +カドヤ 角舎 +カドヤ 加登舎 +カドヤシキ 角屋敷 +カドヤス 角保 +カドヤス 角安 +カドヤス 門安 +カドヤナギ 門柳 +カドヤナギ 角柳 +カトヤマ 加登山 +カドヤマ 角山 +カドヤマ 門山 +カドヤマ 加登山 +カドヤマチ 門屋町 +カドユ 角湯 +カドヨシ 門吉 +カドヨシ 門芳 +カドヨシ 角吉 +カトリ 香取 +カトリ 鹿取 +カトリ 神取 +カトリ 鹿鳥 +カトリ 楫取 +カトリ 嘉鳥 +カトリ 加取 +カトリ 鹿執 +カトリ 加鳥 +カトリ 加執 +カトリ 賀鳥 +カトリ 角取 +カトリ 鹿犱 +カドリキ 角力 +カドリク 角陸 +カドワ 門輪 +カドワキ 門脇 +カドワキ 角脇 +カドワキ 加登脇 +カドワケ 門分 +カドワケ 角分 +カドワタリ 門渡 +カドワリ 門割 +カナ 嘉名 +カナ 嘉奈 +カナ 海南 +カナ 假名 +カナアミ 金阿弥 +カナアミ 金阿彌 +カナアミ 金編 +カナアミ 金網 +カナイ 金井 +カナイ 叶 +カナイ 金居 +カナイ 叶井 +カナイ 賀内 +カナイ 家内 +カナイ 嘉那井 +カナイ 嘉内 +カナイ 叶居 +カナイ 鉽 +カナイカリ 金碇 +カナイケ 金生 +カナイケ 金池 +カナイケ 鉄池 +カナイケ 鐵池 +カナイサコ 叶迫 +カナイザコ 叶迫 +カナイシ 金石 +カナイジマ 金井島 +カナイズカ 金井塚 +カナイズミ 金泉 +カナイソ 金磯 +カナイダ 金井田 +カナイダ 金居田 +カナイツカ 金井塚 +カナイヅカ 金井塚 +カナイデ 金出 +カナイハラ 金井原 +カナイロ 金色 +カナイワ 金岩 +カナウ 金宇 +カナウ 十七夜月 +カナウエ 叶上 +カナウジ 金氏 +カナウチ 金内 +カナウチ 叶内 +カナウチ 金打 +カナウミ 金海 +カナウミ 香奈海 +カナウラ 金浦 +カナエ 金江 +カナエ 鼎 +カナエ 金苗 +カナエ 金栄 +カナエ 金得 +カナエ 金営(金營) +カナエ 家苗 +カナエ 金衛 +カナエ 金榮 +カナエ 金恵 +カナエ 𣇄 +カナエイ 金営(金營) +カナエガミ 金枝上 +カナエダ 金枝 +カナオ 金尾 +カナオ 金生 +カナオ 鐘尾 +カナオ 加名生 +カナオ 可直 +カナオ 哉尾 +カナオウギ 金扇 +カナオカ 金岡 +カナオカ 叶岡 +カナオカ 金陵 +カナオキ 金沖 +カナオト 金乙 +カナオヤ 金親 +カナオヤ 金生谷 +カナオリ 金折 +カナオリ 金織 +カナオリ 鹿折 +カナカ 金中 +カナカ 鹿中 +カナカ 加仲 +カナカ 香中 +カナカ 加中 +カナガ 金賀 +カナガ 賀長 +カナガ 嘉永 +カナガ 嘉寿(嘉壽) +カナガ 加永 +カナガ 賀永 +カナガエ 金ケ江 +カナガキ 金垣 +カナガキ 金柿 +カナガキ 金墻 +カナガキ 假名垣 +カナガキウチ 金垣内 +カナガサ 金笠 +カナガサキ 金ケ崎(金ケ嵜) +カナカゼ 金風 +カナガセ 金ケ瀬 +カナカツ 金勝 +カナカツラ 金桂 +カナガミ 金上 +カナガミ 金神 +カナガラ 金加羅 +カナカワ 金川 +カナガワ 金川 +カナガワ 神奈川 +カナガワ 金河 +カナガワ 鐘川 +カナガワ 神名川 +カナガワ 加奈川 +カナガワ 銑川 +カナキ 金城 +カナキ 金木 +カナキ 金気 +カナキ 金氣 +カナギ 金木 +カナキリ 金切 +カナギリ 金切 +カナグ 金具 +カナクギ 金釘 +カナクサ 金草 +カナクサ 鉄艸(鐵艸) +カナクサ 鐵艸(鐡艸) +カナグスク 金城 +カナクチ 金口 +カナクチ 𨦺口 +カナグチ 金口 +カナグチ 鉛口 +カナクツ 金究 +カナグツ 金沓 +カナクニ 金国 +カナクボ 金久保 +カナクボ 金窪 +カナクラ 金倉 +カナクラ 神長倉 +カナクラ 金鞍 +カナクリ 金栗 +カナグリ 金栗 +カナグリ 金操 +カナケ 金家 +カナゲ 金貝 +カナゲン 金源 +カナコ 金子 +カナコギ 鹿子木 +カナサ 金佐 +カナザ 金座 +カナサカ 金坂 +カナサキ 金崎 +カナサキ 金咲 +カナサキ 金嵜 +カナサキ 叶崎 +カナザキ 金崎 +カナサク 金作 +カナサコ 金泥 +カナサコ 叶迫 +カナサコ 金廻 +カナサシ 金指 +カナサシ 金刺 +カナザシ 金指 +カナザシ 金刺 +カナサト 金里 +カナサナ 金鑽 +カナサナ 金鑚 +カナサワ 金沢 +カナサワ 金澤 +カナサワ 神奈沢 +カナザワ 金沢 +カナザワ 金澤 +カナジ 金治 +カナジ 金地 +カナジ 金持 +カナジ 叶地 +カナジ 神奈地 +カナシキ 金敷 +カナシキ 金鋪 +カナシキ 金舗 +カナシゲ 金重 +カナシゲ 金繁 +カナシマ 金島 +カナシマ 金嶋 +カナショウジ 金小路 +カナジリ 金尻 +カナシロ 金城 +カナシロ 金代 +カナス 金須 +カナズ 金津 +カナスギ 金杉 +カナスミ 金澄 +カナズミ 金住 +カナズミ 金澄 +カナセ 金瀬 +カナセ 兼瀬 +カナセ 叶世 +カナセ 金世 +カナセ 金勢 +カナセキ 金関 +カナゾエ 金添 +カナゾノ 金園 +カナゾメ 金染 +カナタ 金田 +カナタ 金多 +カナタ 彼方 +カナダ 金田 +カナダ 叶田 +カナダ 神成田 +カナダ 鐘田 +カナダ 仮名田 +カナダ 加名田 +カナダ 假名田 +カナダイ 金代 +カナタガ 金多賀 +カナタキ 金滝 +カナタキ 金瀧 +カナタケ 金武 +カナタケ 金竹 +カナタケ 金嶽 +カナタテ 金立 +カナタニ 金谷 +カナタニ 叶谷 +カナタニ 鉦谷 +カナタニ 加奈谷 +カナダニ 金谷 +カナチ 金地 +カナヂ 金地 +カナツ 金津 +カナヅ 金津 +カナツカ 金塚 +カナツカ 彼塚 +カナヅカ 金塚 +カナツキ 金築 +カナツキ 金附 +カナツグ 金次 +カナツナ 金綱 +カナツボ 金坪 +カナヅメ 蚊爪 +カナヅメ 金集 +カナヅヤ 金津谷 +カナヅル 金弦 +カナヅル 金鶴 +カナデ 金出 +カナデチ 金出地 +カナト 金戸 +カナト 金礪 +カナト 金登 +カナド 金戸 +カナドウ 金堂 +カナドウ 叶堂 +カナトコ 金床 +カナトミ 金富 +カナトミ 金冨 +カナドミ 金富 +カナドミ 金冨 +カナトメ 金留 +カナドメ 京 +カナトモ 金友 +カナトリ 金取 +カナナリ 金成 +カナニシ 金西 +カナニワ 金庭 +カナノ 金野 +カナノブ 金信 +カナバ 金場 +カナバ 金羽 +ガナハ 我那覇 +カナハギ 金羽木 +カナハコ 金箱 +カナバコ 金箱 +カナハシ 金橋 +カナハシ 金端 +カナハシ 金槁 +カナバシラ 金柱 +カナハタ 金畑 +カナハマ 金浜 +カナハマ 金濱 +カナバヤシ 金林 +カナハラ 金原 +カナハラ 鉄原(鐵原) +カナハラ 叶原 +カナハラ 加那原 +カナハラ 嘉那原 +カナバラ 金原 +カナバル 金原 +カナビキ 金挺 +カナビシ 金菱 +カナヒデ 金秀 +カナヒョウ 金兵 +カナヒラ 金平 +カナヒロ 金広 +カナヒロ 金廣 +カナブ 金生 +カナフカ 金深 +カナフキ 金吹 +カナフク 金福 +カナフサ 金房 +カナフジ 金藤 +カナブシ 金伏 +カナフダ 金札 +カナブチ 金渕 +カナブチ 金淵 +カナブチ 叶渕 +カナブツ 金佛 +カナフリ 金振 +カナベ 加辺 +カナベ 金辺 +カナベ 金部 +カナベ 神名部 +カナベ 金名部 +カナベ 加邉 +カナベ 金邊 +カナベ 金邉 +カナホ 金保 +カナボウ 金棒 +カナボシ 金星 +カナホリ 金堀 +カナホリバ 金堀場 +カナマ 金間 +カナマキ 金巻 +カナマキ 金牧 +カナマサ 金政 +カナマス 金桝 +カナマス 金枡 +カナマツ 金松 +カナマド 金窓 +カナマル 金丸 +カナマル 神余 +カナマル 叶丸 +カナマル 神餘 +カナマル 金円 +カナミ 金海 +カナミ 金見 +カナミ 加波 +カナミ 鹿波 +カナミ 佳波 +カナミ 嘉波 +カナミズ 金水 +カナミチ 金道 +カナミツ 金光 +カナミネ 金嶺 +カナミネ 金峰 +カナミネ 金峯 +カナミヤ 金宮 +カナムネ 金宗 +カナムラ 金村 +カナムロ 金室 +カナメ 要 +カナメ 金目 +カナメ 要倉 +カナメイシ 要石 +カナメダ 要田 +カナメヤ 要谷 +カナモ 金茂 +カナモ 金毛 +カナモト 金本 +カナモト 金元 +カナモト 叶本 +カナモト 金源 +カナモノ 金物 +カナモノヤ 金物谷 +カナモリ 金森 +カナモリ 金盛 +カナモリ 兼森 +カナモリ 金守 +カナモリ 鉄穴森 +カナモリ 加奈森 +カナモリ 金森寺 +カナモリ 金毛利 +カナモリテラ 金森寺 +カナヤ 金谷 +カナヤ 金屋 +カナヤ 叶谷 +カナヤ 金矢 +カナヤ 兼谷 +カナヤ 金家 +カナヤ 兼屋 +カナヤ 銅屋 +カナヤ 加那屋 +カナヤ 金宅 +カナヤ 金弥(金彌) +カナヤス 金安 +カナヤス 金康 +カナヤチ 金谷内 +カナヤバシ 金谷橋 +カナヤマ 金山 +カナヤマ 銀山 +カナヤマ 銅山 +カナヤマ 鉱山 +カナヤマ 加奈山 +カナヤマ 加名山 +カナヤマ 鑛山 +カナヤマサワ 金山沢 +カナヤマザワ 金山沢 +カナヤマザワ 金山澤 +カナヤマヤ 金山谷 +カナヨリ 金寄 +カナヨリ 金頼 +カナラ 金羅 +カナリ 金成 +カナリ 嘉成 +カナリ 加成 +カナリ 可 +カナリ 可成 +カナリ 叶成 +カナリ 哿 +カナワ 金輪 +カナワ 金和 +カナワ 神奈輪 +カナワ 鉄輪 +カナワク 金涌 +カナン 河南 +カナン 榎南 +カニ 可児 +カニ 蟹 +カニ 可兒 +カニ 河児 +カニ 嘉仁 +カニ 加児(加兒) +カニ 賀仁 +カニ 加仁 +カニ 蠏 +カニアン 蟹庵 +カニイ 蟹井 +カニイケ 蟹池 +カニウ 可二生 +カニエ 蟹江 +カニエ 蠏江 +カニカワ 蟹川 +カニグチ 蟹口 +カニクボ 蟹久保 +カニクラ 加二倉 +カニコ 可児子 +カニコ 可兒子 +ガニコ 我如古 +カニサワ 蟹沢 +カニサワ 蟹澤 +カニサワ 蜅沢(蜅澤) +カニザワ 蟹沢 +カニザワ 蟹澤 +カニサワガワ 蟹沢川 +カニサワガワ 蟹澤川 +カニシ 香西 +カニシ 加西 +カニシマ 可児島 +カニシマ 鹿仁島 +カニセ 蟹瀬 +カニタ 蟹田 +カニダ 蟹田 +カニタニ 蟹谷 +カニトウ 蟹藤 +カニノ 蟹野 +カニハラ 蟹原 +カニマキ 蟹巻 +カニモト 蟹本(蠏本) +カニモリ 蟹守 +カニヤ 蟹谷 +カニヤ 加二谷 +カニヤ 神仁谷 +カニヤシキ 蟹屋敷 +カニヤマ 蟹山 +カニユ 蟹由 +カニワ 神庭 +カニワ 鹿庭 +カニワ 加庭 +カニワ 蟹和 +カニワ 香庭 +カヌカ 鹿糠 +カヌカ 嘉糠 +カヌカ 加糠 +カヌカ 嘉糖 +カヌカ 鹿糖 +カヌカサワ 鹿糠沢(鹿糠澤) +カヌカザワ 鹿糠沢(鹿糠澤) +カヌキ 鹿貫 +カヌマ 鹿沼 +カヌマ 神沼 +カヌマ 可沼 +カヌマ 加沼 +カヌマ 嘉沼 +カネ 金 +カネ 家根 +カネ 兼 +カネ 加根 +カネ 嘉根 +カネ 賀根 +カネ 矩 +カネアキ 金秋 +カネアマ 金天 +カネイ 金井 +カネイ 兼井 +カネイ 金居 +カネイ 鐘井 +カネイ 鐘居 +カネイ 鐘鋳 +カネイ 兼為 +カネイキ 金生 +カネイケ 金生 +カネイケ 兼池 +カネイシ 金石 +カネイシ 兼石 +カネイズミ 金泉 +カネイソ 金磯 +カネイタ 兼板 +カネイダ 金井田 +カネイチ 金一 +カネイチ 金市 +カネイチ 兼市 +カネイマ 金今 +カネイマ 兼今 +カネイリ 金入 +カネイワ 金岩 +カネイワ 兼岩 +カネウエ 金上 +カネウジ 金氏 +カネウジ 兼氏 +カネウジ 金宇治 +カネウチ 金内 +カネウチ 金打 +カネウチ 鉦打 +カネウチ 兼内 +カネウチ 鉄打 +カネウミ 金海 +カネウミ 兼海 +カネウラ 金浦 +カネウラ 兼浦 +カネエ 金江 +カネエ 金得 +カネエ 兼江 +カネエダ 金枝 +カネオ 金尾 +カネオ 金生 +カネオ 鹿子生 +カネオ 兼尾 +カネオ 鐘尾 +カネオカ 金岡 +カネオカ 兼岡 +カネオカ 銀岡 +カネオカ 兼丘 +カネオカ 兼丘 +カネオカ 鐘岡 +カネオキ 金沖 +カネオケ 金桶 +カネオヤ 金親 +カネオヤ 金生谷 +カネオリ 兼折 +カネオリ 金織 +カネガ 金賀 +カネガ 兼賀 +カネカイ 金飼 +カネガイ 金替 +カネガイチ 金垣内 +カネガエ 鐘ケ江 +カネガエ 鐘江 +カネガエ 金ケ江 +カネガエ 金替 +カネガエ 鍾ケ江 +カネガエ 鐘カ江 +カネガキ 金垣 +カネカク 兼角 +カネガサキ 金ケ崎(金ケ嵜) +カネガサキ 兼ケ崎 +カネカシ 金柏 +カネカス 金粕 +カネカズ 尺一 +カネカタ 鐘方 +カネカダン 兼箇段 +カネカツ 金勝 +カネカツ 兼勝 +カネカド 兼門 +カネガネ 金兼 +カネガハラ 金ケ原 +カネカマ 金釜 +カネカミ 兼上 +カネガミ 金上 +カネガミ 兼上 +カネガミ 金神 +カネガモリ 金ケ森 +カネカワ 金川 +カネカワ 兼川 +カネカワ 金河 +カネカワ 加根川 +カネガワ 金川 +カネガワ 兼川 +カネガワ 鐘川 +カネガワラ 金川原 +カネキ 金木 +カネキ 兼城 +カネキ 金生 +カネキ 金気 +カネキ 金氣 +カネキ 金喜 +カネギ 金城 +カネギ 兼木 +カネキタ 金来 +カネキュウ 金久 +カネキヨ 兼清 +カネキヨ 金清 +カネキヨ 包清 +カネキョウ 兼京 +カネキリ 金切 +カネク 金久 +カネク 兼久 +カネクサ 金草 +カネクサ 鉄艸(鐵艸) +カネクサ 鉄草 +カネグチ 金口 +カネグチ 兼口 +カネクツ 金沓 +カネクニ 包国 +カネクニ 兼国 +カネクニ 金国 +カネクニ 金國 +カネクニ 兼國 +カネクニ 包國 +カネクボ 金久保 +カネクラ 金倉 +カネクラ 金蔵 +カネクラ 兼倉 +カネクラ 金藏 +カネグラ 金蔵 +カネクロ 金黒 +カネケン 兼堅 +カネコ 金子 +カネコ 兼子 +カネコ 金児 +カネコ 我如古 +カネコ 兼古 +カネコ 金古 +カネコ 金湖 +カネコ 包子 +カネコ 金香 +カネコ 金個 +カネコ 金厚 +カネコ 金兒 +カネコ 兼児 +カネコ 金巨 +カネコ 金篭 +カネコ 金籠 +カネコ 兼箇 +カネコ 兼小 +カネコ 𨫝子(鑵子) +カネゴ 金後 +ガネコ 我如古 +カネコウ 金甲 +カネコダン 兼箇段 +カネコマツ 金子松 +カネコヤ 金子屋 +カネコン 金今 +カネサ 金佐 +カネサ 兼佐 +カネサカ 金坂 +カネサカ 兼坂 +カネサカ 金阪 +カネサカ 嘉年坂 +カネザカ 嘉年坂 +カネサキ 金崎 +カネサキ 兼崎 +カネサキ 兼先 +カネサキ 鐘崎(鐘嵜) +カネサキ 金嵜 +カネサキ 金埼 +カネザキ 金崎 +カネザキ 兼崎 +カネザキ 金嵜 +カネサキヤ 金崎屋 +カネサク 金作 +カネサコ 金廻 +カネサコ 兼迫 +カネサシ 金指 +カネサシ 金刺 +カネザシ 金指 +カネザシ 金刺 +カネサダ 兼定 +カネサダ 金定 +カネサダ 兼貞 +カネサダ 金貞 +カネサト 金里 +カネサト 兼里 +カネザト 金里 +カネザネ 兼実 +カネサワ 金沢 +カネサワ 金澤 +カネサワ 兼沢 +カネサワ 兼澤 +カネザワ 金沢 +カネザワ 金澤 +カネザワ 兼沢 +カネザワ 兼澤 +カネシ 兼次 +カネシ 鎌次 +カネジ 兼次 +カネジ 金治 +カネジ 金地 +カネシカ 金鹿 +カネシキ 金敷 +カネシゲ 兼重 +カネシゲ 金重 +カネシゲ 金繁 +カネシゲ 矩茂 +カネシゲ 兼茂 +カネシゲ 包重 +カネシタ 鐘下 +カネシタ 兼下 +カネシタ 金下 +カネシナ 兼品 +カネシナ 金品 +カネシマ 金島 +カネシマ 兼島 +カネシマ 金嶋 +カネシマ 鐘島 +カネシマ 兼嶋 +カネジマ 金島 +カネシメ 金〆 +カネジャナ 兼謝名 +カネショウ 金生 +カネショウ 金庄 +カネショウ 兼庄 +カネショウ 兼正 +カネジョウ 金上 +カネシロ 金城 +カネシロ 兼城 +カネシロ 金代 +カネシロ 鎌代 +カネシン 金真(金眞) +カネシン 金新 +カネス 金須 +カネスエ 金居 +カネスエ 金末 +カネスエ 兼末 +カネスエ 包末 +カネズカ 金塚 +カネスギ 金杉 +カネスギ 兼杉 +カネスミ 金住 +カネセ 金瀬 +カネセ 兼瀬 +カネセキ 金関 +カネセト 金瀬戸 +カネソ 金曽 +カネソ 金曾 +カネゾノ 金園 +カネタ 金田 +カネタ 兼田 +カネタ 金多 +カネタ 金太 +カネダ 金田 +カネダ 兼田 +カネダ 鐘田 +カネダ 加根田 +カネダイ 金台 +カネダイ 金臺 +カネダイ 兼台 +カネタカ 金高 +カネタカ 兼高 +カネタカ 金多賀 +カネタガ 金多賀 +カネタキ 金滝 +カネタキ 金瀧 +カネタク 金宅 +カネタケ 金武 +カネタケ 兼武 +カネタケ 金竹 +カネタケ 金嶽 +カネタケ 兼竹 +カネタケ 金岳 +カネタダ 金只 +カネタダ 金忠 +カネダテ 金建 +カネタニ 金谷 +カネタニ 兼谷 +カネタニ 鉦谷 +カネタニ 鐘谷 +カネタマ 金玉 +カネダワラ 兼俵 +カネチ 金地 +カネチカ 金親 +カネチカ 金近 +カネチカ 兼近 +カネチク 金築 +カネチク 鐘築 +カネチク 兼築 +カネチュウ 金鋳(金鑄) +カネツ 金津 +カネヅ 金津 +カネツカ 金塚 +カネツカ 兼塚 +カネツカ 金柄 +カネヅカ 金塚 +カネヅカ 兼塚 +カネヅカ 印塚 +カネツキ 金築 +カネツキ 鐘築 +カネツキ 金月 +カネツキ 鐘撞 +カネツキ 鐘推 +カネツキ 鐘搗 +カネツキ 鐘突 +カネツギ 兼次 +カネツギ 金次 +カネツク 金築 +カネツク 鐘築 +カネツク 鐘撞 +カネツグ 兼次 +カネツグ 金次 +カネツナ 金綱 +カネツナ 兼綱 +カネツネ 金常 +カネツネ 兼常 +カネツボ 金坪 +カネツリ 金釣 +カネデラ 金寺 +カネテル 金照 +カネト 金戸 +カネト 金砺 +カネト 金礪 +カネト 金刃 +カネト 金鋳(金鑄) +カネト 金刀 +カネトウ 金藤 +カネトウ 兼頭 +カネトウ 兼藤 +カネトウ 兼任 +カネトウ 金当 +カネトウ 金當 +カネトウ 金籐 +カネトウ 金東 +カネトウ 金任 +カネドウ 金堂 +カネトキ 金時 +カネトキ 兼時 +カネトク 金徳 +カネトク 兼徳 +カネトク 兼得 +カネトシ 兼俊 +カネトシ 兼利 +カネトシ 金利 +カネトシ 兼年 +カネトシ 兼歳 +カネトミ 金富 +カネトミ 兼冨 +カネドミ 兼冨 +カネドミ 兼富 +カネドメ 金留 +カネトモ 金友 +カネトモ 兼友 +カネトヨ 金豊 +カネナエ 金苗 +カネナカ 金中 +カネナカ 兼中 +カネナガ 金永 +カネナガ 金長 +カネナガ 兼永 +カネナガ 兼長 +カネナミ 金波 +カネナリ 金成 +カネナリ 兼成 +カネナワ 金縄(金繩) +カネニシ 兼西 +カネニシ 金西 +カネニワ 金庭 +カネヌマ 金沼 +カネネ 金根 +カネノ 金野 +カネノオ 金野尾 +カネノブ 兼信 +カネノブ 金信 +カネノブ 金延 +カネノブ 兼述 +カネノブ 兼延 +カネノブ 兼逑 +カネノリ 兼則 +カネノリ 金乗 +カネノリ 金法 +カネハ 金羽 +カネバ 金場 +カネバ 金羽 +カネバ 鐘場 +カネハギ 金羽木 +カネハコ 金箱 +カネバコ 金箱 +カネハシ 金橋 +カネハシ 兼橋 +カネハシラ 金柱 +カネハタ 金畑 +カネハタ 金幡 +カネハタ 兼畠 +カネハチ 兼八 +カネハナ 金花 +カネハマ 金浜 +カネハマ 兼浜 +カネハマ 金濱 +カネハマ 兼濱 +カネバヤシ 金林 +カネバヤシ 兼林 +カネハラ 金原 +カネハラ 兼原 +カネハラ 包原 +カネハル 兼春 +カネビ 金日 +カネヒコ 金彦 +カネヒサ 金久 +カネヒサ 兼久 +カネビシ 金菱 +カネヒデ 金秀 +カネヒョウ 金兵 +カネヒラ 兼平 +カネヒラ 金平 +カネヒラ 金比良 +カネヒラ 平 +カネヒロ 金広 +カネヒロ 兼広 +カネヒロ 兼弘 +カネヒロ 金廣 +カネヒロ 金弘 +カネヒロ 兼廣 +カネブ 金布 +カネフカ 兼深 +カネフク 金福 +カネフク 兼福 +カネフサ 金房 +カネフサ 兼房 +カネフジ 金藤 +カネフジ 兼藤 +カネフダ 金札 +カネブチ 曲渕 +カネブチ 金渕 +カネフネ 金船(金舩) +カネブン 金文 +カネベ 金部 +カネボウ 金棒 +カネボシ 金星 +カネホリ 金堀 +カネホリ 兼堀 +カネホリ 兼掘 +カネマ 金間 +カネマ 金真(金眞) +カネマ 兼間 +カネマキ 金巻 +カネマキ 印牧 +カネマキ 金牧 +カネマキ 兼巻 +カネマキ 鐘巻 +カネマサ 金政 +カネマサ 金正 +カネマサ 兼政 +カネマシ 金増 +カネマス 金桝 +カネマス 金増 +カネマス 兼益 +カネマス 金益 +カネマス 金升 +カネマス 金舛 +カネマス 兼増 +カネマス 兼桝 +カネマス 金枡 +カネマス 兼枡 +カネマタ 金又 +カネマタ 金俣 +カネマチ 金町 +カネマツ 兼松 +カネマツ 金松 +カネマツ 包松 +カネマリ 金鞠 +カネマル 金丸 +カネマル 兼丸 +カネマル 鉦丸 +カネミ 金見 +カネミ 兼見 +カネミズ 金水 +カネミチ 金道 +カネミツ 金光 +カネミツ 兼光 +カネミツ 金満 +カネミツ 金三津 +カネミツ 鑑光 +カネミツ 兼満 +カネミツ 鐘光 +カネミツヤ 金光谷 +カネミネ 金峰 +カネミネ 兼峯 +カネミヤ 金宮 +カネミヤ 金都 +カネミヨ 金見代 +カネムネ 兼宗 +カネムネ 金宗 +カネムラ 金村 +カネムラ 兼村 +カネムラ 賀根村 +カネムラ 加根村 +カネモ 金茂 +カネモチ 金持 +カネモト 金本 +カネモト 兼本 +カネモト 金元 +カネモト 兼元 +カネモト 鎌本 +カネモト 鐘本 +カネモト 金源 +カネモト 加根元 +カネモト 鉦本 +カネモト 包本 +カネモリ 金森 +カネモリ 金盛 +カネモリ 兼森 +カネモリ 金守 +カネモリ 兼盛 +カネモリ 包守 +カネモリ 鐘森 +カネモリ 兼守 +カネヤ 金谷 +カネヤ 金屋 +カネヤ 金矢 +カネヤ 兼谷 +カネヤ 兼屋 +カネヤシキ 金屋敷 +カネヤス 金安 +カネヤス 兼安 +カネヤス 兼康 +カネヤス 兼保 +カネヤス 金保 +カネヤス 金靖 +カネヤス 金康 +カネヤマ 金山 +カネヤマ 兼山 +カネヤマ 曲山 +カネヤマ 加禰山 +カネヤマ 加祢山 +カネヤマサワ 金山沢 +カネユキ 兼行 +カネユキ 金行 +カネユキ 包行 +カネヨウ 金要 +カネヨシ 金吉 +カネヨシ 兼吉 +カネヨシ 金好 +カネヨシ 兼好 +カネヨシ 金芳 +カネヨシ 包吉 +カネヨシ 金義 +カネヨシ 金慶 +カネヨシ 金善 +カネヨシ 兼芳 +カネヨリ 金寄 +カネヨリ 兼頼 +カネロ 加根魯 +カネワ 金和 +カネワカ 兼若 +カネワカ 金若 +カネワキ 金脇 +カネワキ 兼脇 +カノ 狩野 +カノ 鹿野 +カノ 加野 +カノ 叶野 +カノ 嘉野 +カノ 可野 +カノ 蚊野 +カノ 賀野 +カノ 仮野 +カノ 鍛野(鍜野) +カノ 加埜 +カノ 假野 +ガノ 駕野 +カノイ 叶井 +カノイ 加納井 +カノイ 加野井 +カノウ 加納 +カノウ 狩野 +カノウ 鹿野 +カノウ 金野 +カノウ 叶 +カノウ 嘉納 +カノウ 叶野 +カノウ 金納 +カノウ 金生 +カノウ 神生 +カノウ 家納 +カノウ 過能 +カノウ 加能 +カノウ 稼農 +カノウ 鹿能 +カノウ 鹿納 +カノウ 和 +カノウ 諧 +カノウ 鍛野(鍜野) +カノウ 加濃 +カノウ 賀納 +カノウ 鹿之賦 +カノウ 加名生 +カノウ 賀農 +カノウ 嘉能 +カノウ 叶生 +カノウ 鹿生 +カノウ 十七 +カノウ 稱 +カノウエ 加納江 +カノウガ 叶賀 +カノウギ 叶木 +カノウザワ 叶沢 +カノウザワ 叶澤 +カノウシロ 叶城 +カノウタ 叶多 +カノウダ 叶田 +カノウダ 叶多 +カノウタニ 加納谷 +カノウチ 鹿内 +カノウチ 叶内 +カノウチ 鹿野内 +カノウチ 鹿ノ内 +カノウチ 嘉野内 +カノウハラ 鹿野原 +カノウマツ 叶松 +カノウマル 叶丸 +カノウミ 嘉ノ海 +カノウヤ 叶谷 +カノウヤ 叶屋 +カノウヤマ 叶山 +カノウラ 鹿浦 +カノウラ 嘉野浦 +カノウラ 叶浦 +カノエ 鹿江 +カノエ 庚 +カノエ 叶栄 +カノエ 叶榮 +カノオ 鹿野 +カノオ 金生 +カノオ 狩野尾 +カノオカ 鹿岡 +カノオカ 加野岡 +カノオヤ 叶親 +カノガ 叶賀 +カノガワ 加納川 +カノガワ 鹿野川 +カノガワ 嘉野川 +カノガワ 叶川 +カノキ 叶木 +カノキ 歌納木 +カノクボ 狩野窪 +カノケ 鹿毛 +カノコ 家子 +カノコ 鹿子 +カノコ 鹿ノ子 +カノコギ 鹿子木 +カノコザワ 鹿子沢 +カノコザワ 鹿子澤 +カノコダ 鹿子田 +カノコハタ 鹿子畑 +カノザワ 叶沢 +カノザワ 叶澤 +カノシゲ 鹿重 +カノシマ 辛島 +カノシマ 加野島 +カノシマ 鹿野島 +カノシマ 彼島 +カノシマ 加野嶋 +カノジマ 鹿野島 +カノスエ 彼末 +カノスエ 鹿末 +カノスエ 匂末 +カノセ 鹿瀬 +カノセ 鹿ノ瀬 +カノタ 鹿野田 +カノダ 叶田 +カノダ 鹿野田 +カノタニ 叶谷 +カノツノ 鹿角 +カノト 鹿戸 +カノト 鹿ノ戸 +カノト 辛 +カノブ 加信 +カノマタ 鹿又 +カノマタ 鹿股 +カノマタ 鹿俣 +カノマタ 鹿野又 +カノマタ 鹿叉 +カノマタ 鹿ノ又 +カノマツ 叶松 +カノマル 叶丸 +カノミ 嘉ノ海 +カノミ 狩野見 +カノミツ 叶光 +カノムネ 鹿宗 +カノムネ 彼宗 +カノムラ 鹿野村 +カノメ 鹿目 +カノメ 鹿海 +カノヤ 叶谷 +カノヤ 鹿屋 +カノヤ 鹿野谷 +カノヤ 彼ノ矢 +カノヤ 叶屋 +カノヤダニ 鹿屋谷 +カノヤマ 叶山 +カノヤマ 狩野山 +カバ 蒲 +カバ 樺 +カバ 加波 +カバ 椛 +カバ 架場 +カバ 加場 +カバ 加羽 +カバ 嘉羽 +ガバ 賀場 +カバイ 樺井 +カバイ 鹿梅 +カバキ 椛木 +カバキ 蒲木 +カバキ 樺木 +ガバキ 蒲木 +カバキノ 樺木野 +カバキノ 椛木野 +カバクラ 蒲倉 +カバサワ 樺沢 +カバサワ 椛沢 +カバサワ 樺澤 +カバサワ 蒲沢 +カバサワ 椛澤 +カバサワ 蒲澤 +カバサワ 加羽沢 +カバサワ 加羽澤 +カバサワ 加波沢 +カバサワ 賀波澤 +カバサワ 賀波沢 +カバザワ 樺沢 +カバザワ 椛沢 +カバザワ 樺澤 +カバザワ 椛澤 +カバシマ 椛島 +カバシマ 樺島 +カバシマ 椛嶋 +カバシマ 樺嶋 +カバシマ 蒲島 +カバシマ 椛嶌 +カバシマ 蒲嶋 +カバシマ 樺嶌 +カバジマ 椛島 +カハタ 加畑 +カハタ 加幡 +カハタ 可畑 +カハタ 加畠 +カバタ 下野 +カバタ 蒲田 +カバタ 加畑 +カバタ 椛田 +カバタ 加幡 +カバタ 樺田 +カバタ 加葉田 +カバタ 可畑 +カバタ 加端 +カバタ 加畠 +カバタ 嘉幡 +カバタ 綺田 +カバタ 加旗 +カバタ 加籏 +カバタ 嘉畑 +カバタ 賀畠 +カバタ 賀幡 +カバタ 賀畑 +ガバタ 蒲田 +ガバダ 蒲田 +カバタニ 椛谷 +カバタニ 樺谷 +カバチ 蒲地 +カバナ 加鼻 +カバネ 加羽 +カバノ 蒲野 +カバノ 樺野 +カハムラ 香葉村 +カバムラ 椛村 +カバムラ 香葉村 +カバムラ 樺村 +カバモト 椛本 +カバモト 樺元 +カバモト 蒲本 +カバモト 椛元 +カバモト 樺本 +カバヤ 蒲谷 +カバヤ 椛谷 +カバヤシ 香林 +カバヤシ 加林 +カバヤマ 樺山 +カバヤマ 椛山 +カバヤマ 蒲山 +カハラ 河原 +カハラ 鹿原 +カハラ 加原 +カハラ 香原 +カハラ 賀原 +カハラ 嘉原 +カハラ 可原 +カハラ 華原 +カハラ 賀爾欽 +カバラ 鹿原 +ガハラ 我原 +ガハラ 賀原 +ガバリ 賀張 +カハル 香春 +カバン 加番 +カヒ 甲斐 +カヒョウ 華表 +カビラ 川平 +カビラ 嘉平 +カブ 下部 +カブ 加峯 +カブ 加峰 +カブ 蕪 +カブ 株 +カブ 加武 +ガブ 我部 +ガブ 我舞 +カブイ 株井 +カブウチ 株内 +カブオ 蕪尾 +カブオカ 蕪岡 +カブカワ 蕪川 +カブキ 蕪木 +カブキ 株木 +カブキ 冠木 +カフク 加福 +カフク 嘉福 +カフク 家福 +カフク 過福 +カブサキ 蕪崎 +カブサキ 株崎 +カブサコ 蕪迫 +カブジリ 蕪尻 +カブタ 株田 +カブタ 蕪田 +カブタ 加武田 +カブタケ 株竹 +カブタケ 蕪竹 +カブタニ 甲谷 +カブタニ 株谷 +ガブタニ 我舞谷 +カブタン 株丹 +カブチ 加渕 +カブチ 賀淵 +カブチ 賀渕 +カブチ 加淵 +カブチ 鹿渕 +カブト 甲 +カブト 加太 +カブト 兜 +カブト 株戸 +カブト 鹿伏兎 +カブトイシ 兜石 +カブトイワ 兜岩 +カフトウ 加府藤 +カブトウ 加部東 +カブトウ 甲頭 +カブトギ 兜木 +カブトギ 兜着 +カブトザキ 兜崎 +カブトジマ 兜島 +カブトボシ 甲星 +カブトモリ 兜森 +カブトモリ 甲森 +カブトヤ 甲谷 +カブトヤ 甲矢 +カブトヤ 兜谷 +カブトヤ 甲屋 +カブトヤ 兜屋 +カブトヤマ 兜山 +カブナ 蕪名 +カブネ 株根 +カブノ 蕪野 +カブノ 株野 +カブハシ 株橋 +カブハラ 株原 +カブモト 株本 +カブモト 株元 +カブヤ 株屋 +カブヤナギ 株柳 +カブヤネ 株屋根 +カブヤブ 株薮 +カブヤブ 株籔 +カブヤブ 株藪 +カブヤマ 蕪山 +カブラ 蕪 +カブラ 鏑 +カブラウチ 蕪内 +カブラキ 鏑木 +カブラキ 蕪木 +カブラキ 鏑城 +カブラキ 蕪城 +カブラギ 鏑木 +カブラギ 蕪木 +カブラギ 冠木 +カブラギ 鏑城 +カブラギ 冠城 +カブラギ 蕪城 +カブラギ 橅木 +カブラギ 甲楽城(甲樂城) +カブラギ 蔓木 +カブラサキ 蕪崎 +カブラタ 蕪田 +カブラネ 鏑根 +カブラヤ 鏑谷 +カフリ 加布里 +カベ 河辺 +カベ 加部 +カベ 神辺 +カベ 加辺 +カベ 河邊 +カベ 壁 +カベ 可部 +カベ 河邉 +カベ 嘉部 +カベ 日部 +カベ 賀部 +カベ 加邊 +カベ 加邉 +ガベ 我部 +ガベ 家部 +カベイ 嘉部井 +カベイ 壁井 +カベイシ 壁石 +カベウチ 壁内 +カベウチ 壁打 +カベギシ 壁岸 +カベグチ 壁口 +カベコシ 壁腰 +カベサカ 壁坂 +カベシタ 壁下 +カベシマ 壁島 +カベス 壁寸 +カベス 壁巣 +カベス 神辺須 +カベセ 壁瀬 +カベタ 壁田 +カベタ 可部田 +カベタテ 壁舘 +カベタテ 壁館 +カベタニ 壁谷 +カベタニ 可部谷 +カベチ 壁地 +カベトウ 加部藤 +カベノ 壁野 +カベノ 可部野 +カベヒロ 壁広 +カベフサ 壁総 +カベフサ 壁總 +カベムラ 壁村 +カベモト 壁本 +カベモト 可部本 +カベモト 河部本 +カベモト 川部本 +カベヤ 神谷 +カベヤ 壁谷 +カベヤ 壁屋 +カベヤ 可部谷 +カベヤ 壁矢 +カベヤサワ 壁谷沢 +カベヤサワ 壁谷澤 +カベヤザワ 壁谷沢 +カベヤザワ 壁谷澤 +カベヤマ 我部山 +カベヤマ 壁山 +カホ 下保 +カホ 加保 +カホ 嘉保 +カホウ 加峯 +ガホウ 雅鳳 +カボシ 加星 +カマ 蒲 +カマ 釜 +カマ 鎌 +カマ 嘉満 +カマ 加間 +カマ 加麻 +ガマ 蒲 +ガマ 我間 +ガマ 賀満 +カマイ 釜井 +カマイ 鎌井 +カマイ 構井 +カマイ 鎌居 +カマイ 搆居 +カマイケ 釜池 +カマイケ 鎌池 +ガマイケ 蒲池 +カマイシ 釜石 +カマイシ 鎌石 +カマイチ 釜一 +カマイリ 釜入 +カマイワ 釜岩 +カマウエ 釜上 +カマウエジョウ 蒲上門 +カマウチ 鎌内 +カマウチ 釜内 +カマウラ 蒲浦 +カマウラ 鎌浦 +カマウラ 釜浦 +カマウラ 竃浦 +カマウリ 釜売 +カマエ 構 +カマエ 釜江 +カマエ 鎌江 +カマエ 構江 +カマエ 廓 +カマエ 賀前 +カマエ 搆 +ガマエ 賀前 +カマエグチ 構口 +カマエグチ 搆口 +カマエダ 構田 +カマエタニ 構谷 +カマオ 鎌尾 +カマオ 釜尾 +ガマオ 蒲生 +カマオカ 鎌岡 +カマオク 鎌奥 +カマカ 鎌賀 +カマカ 鎌鹿 +カマガ 釜賀 +カマガ 釜我 +カマガ 鎌賀 +カマガキ 鎌垣 +カマガサコ 鎌ケ迫 +カマガサワ 釜ケ沢 +カマガサワ 釜ケ澤 +カマカズ 鎌数 +カマカタ 鎌形 +カマカタ 鎌方 +カマガタ 鎌形 +カマガタ 釜形 +カマガタ 鎌方 +カマガタニ 釜ケ谷 +カマカバ 鎌蒲 +カマガハラ 蒲ケ原 +カマガフチ 釜ケ渕 +カマカミ 鎌上 +カマカミ 釜神 +カマガミ 鎌上 +カマガミ 釜神 +カマガヤ 釜ケ谷 +カマカリ 鎌苅 +カマカリ 鎌刈 +カマカリ 蒲刈 +カマカワ 鎌川 +カマガワ 鎌川 +カマガワ 釜川 +カマキ 蒲木 +カマキ 鎌木 +カマキ 構木 +カマキ 釜木 +カマキ 鎌城 +カマキタ 鎌北 +カマクサ 鎌草 +カマグチ 釜口 +カマグチ 鎌口 +カマクボ 釜窪 +カマクボ 鎌久保 +カマクラ 鎌倉 +カマクラ 蒲倉 +カマクラ 釜倉 +カマクワ 鎌桑 +カマコ 鎌戸 +カマコ 鎌子 +カマコ 釜子 +カマコシ 鎌腰 +カマゴメ 鎌込 +カマサカ 釜坂 +カマサカ 鎌坂 +カマサカ 竃坂 +カマサカ 釜阪 +カマサキ 釜崎 +カマサキ 鎌崎 +カマザキ 釜崎 +カマザキ 鎌崎 +カマサコ 鎌迫 +カマサコ 竃窄(竈窄) +カマサワ 蒲沢 +カマサワ 釜沢 +カマサワ 蒲澤 +カマサワ 釜澤 +カマサワ 鎌沢 +カマサワ 鎌澤 +カマザワ 蒲沢 +カマザワ 釜沢 +カマザワ 蒲澤 +カマザワ 釜澤 +カマザワ 鎌沢 +カマザワ 鎌澤 +ガマサワ 蒲沢 +ガマサワ 蒲澤 +ガマザワ 蒲沢 +ガマザワ 蒲澤 +カマジ 釜地 +カマシゲ 鎌重 +カマシタ 釜下 +カマシタ 鎌下 +カマシマ 釜島 +カマシマ 鎌島 +カマジリ 嘉摩尻 +カマス 加増 +カマス 釜須 +カマスカ 鎌須賀 +カマスガ 鎌須賀 +カマスズ 釜鈴 +カマスダ 叺田 +カマセ 釜瀬 +カマセ 鎌瀬 +カマセ 釜世 +カマセ 蒲瀬 +カマソク 釜足 +カマタ 鎌田 +カマタ 蒲田 +カマタ 釜田 +カマタ 烟田 +カマタ 加満多 +カマタ 鎌多 +カマタ 𤇆田 +カマダ 鎌田 +カマダ 蒲田 +カマダ 釜田 +カマダ 賀満田 +カマダ 賀真田 +カマダ 鎌多 +ガマタ 蒲田 +ガマダ 蒲田 +カマダイ 釜台(釡台) +カマタキ 鎌滝 +カマタキ 釜滝 +カマタキ 釜瀧 +カマタキ 鎌瀧 +カマタケ 鎌武 +カマタニ 釜谷(釡谷) +カマタニ 鎌谷 +カマタニ 蒲谷 +カマタニ 構谷 +カマタニ 竃谷(竈谷) +カマタニ 寵谷 +カマタニ 䆴谷 +カマタリ 鎌足 +カマタレ 釜垂 +カマチ 蒲池 +カマチ 蒲地 +カマチ 釜地 +カマチ 鎌地 +カマヂ 釜地 +ガマチ 蒲池 +カマチカ 鎌近 +カマツ 嘉松 +カマツ 加松 +カマツ 釜津 +カマツカ 鎌塚 +カマツカ 釜塚 +カマツカ 鎌柄 +カマツカ 構司 +カマヅカ 鎌塚 +カマヅカ 釜塚 +カマヅカ 一尺八寸 +カマツキ 釜付 +カマツケ 釜付 +カマツダ 釜津田 +カマツダ 鎌津田 +カマツチ 釜土 +カマツチ 鎌土 +カマツチ 竃土 +カマツチ 蒲土 +カマツチ 竈土 +カマツバ 鎌鍔 +カマテ 鎌手 +カマデ 釜出 +カマト 鎌戸 +カマト 釜戸 +カマド 釜土 +カマド 鎌戸 +カマド 鎌土 +カマド 竃 +カマド 竃門(竈門) +カマド 竈 +カマド 𥧄 +カマドウ 鎌堂 +カマトク 鎌徳 +カマトコ 釜床 +カマトモ 釜友 +カマトリ 鎌取 +カマナカ 鎌仲 +カマナカ 釜中 +カマナカ 鎌中 +カマナガ 釜永 +カマナリ 釜鳴 +カマナル 釜鳴 +カマヌマ 蒲沼 +カマヌマ 釜沼 +ガマヌマ 蒲沼 +カマノ 鎌野 +カマノ 釜野 +カマノ 蒲野 +カマノ 釜埜 +カマノ 釜納 +ガマノ 蒲野 +カマノイ 釜野井 +ガマノボウ 蒲之坊 +カマバ 釜場 +カマハシ 鎌橋 +カマハタ 鎌畑 +カマバヤシ 鎌林 +カマバヤシ 釜林 +カマハラ 蒲原 +カマハラ 鎌原 +カマハラ 釜原(釡原) +ガマハラ 蒲原 +カマヒラ 釜平 +カマフサ 鎌房 +カマフサ 釜房 +カマフタ 釜蓋 +カマフチ 釜淵 +カマフチ 竃渕 +カマブチ 釜渕 +カマブチ 釜淵 +カマブチ 竃淵 +カマフネ 鎌船 +カマブロ 釜風呂 +カマベ 鎌部 +カマベ 釜部 +カマベ 釜辺 +カマホラ 釜洞 +カマボラ 釜洞 +カマホリ 釜堀 +カママス 釜増 +カママツ 鎌松 +カママル 釜丸 +カマミチ 釜道 +カマミツ 鎌光 +カマミネ 鎌峯 +カマミヤ 鎌宮 +カマムタ 蒲牟田 +カマムラ 鎌村 +カマムラ 釜村 +カマモト 釜本 +カマモト 鎌本 +カマモト 釜元 +カマモト 鎌元 +カマモト 竃本 +カマモト 竈本 +カマモリ 鎌森 +カマモリ 釜森 +カマヤ 釜谷(釡谷) +カマヤ 鎌谷 +カマヤ 蒲谷 +カマヤ 釜屋 +カマヤ 鎌家 +カマヤ 釜矢 +カマヤ 鎌屋 +カマヤ 鎌矢 +カマヤ 窯屋 +カマヤチ 釜萢(釡萢) +カマヤツ 釜萢(釡萢) +カマヤマ 釜山 +カマヤマ 鎌山 +カマヨシ 鎌吉 +カマル 鹿丸 +カマワキ 釜脇 +ガマン 我満 +ガマン 我滿 +カミ 神 +カミ 上 +カミ 上見 +カミ 加美 +カミ 紙 +カミ 嘉見 +カミ 加見 +カミ 加味 +カミ 賀美 +カミ 香味 +カミ 嘉美 +カミ 賀味 +ガミ 賀見 +カミアオキ 上青木 +カミアカ 上赤 +カミアキト 上明戸 +カミアクツ 上圷 +カミアゲ 上揚 +カミアケト 上明戸 +カミアケド 上明戸 +カミアシ 神足 +カミアツマリ 上集 +カミアテ 上当 +カミアマ 上天 +カミアラ 上荒 +カミアライソ 上荒磯 +カミアリヤ 上有谷 +カミイ 上井 +カミイ 神井 +カミイ 上居 +カミイ 神居 +カミイ 紙井 +カミイ 紙居 +カミイ 髪井 +カミイ 神位 +カミイイサカ 上飯坂 +カミイイザカ 上飯坂 +カミイイノ 上飯野 +カミイエ 上家 +カミイエ 神家 +カミイクラ 上伊倉 +カミイケ 上池 +カミイケ 神池 +カミイケダ 上池田 +カミイケヤマ 上入ケ山 +カミイザワ 上伊沢 +カミイザワ 上伊澤 +カミイシ 上石 +カミイシ 神石 +カミイシザカ 上石坂 +カミイシダ 上石田 +カミイシマル 上石丸 +カミイジリ 上井尻 +カミイズミ 上泉 +カミイダ 上井田 +カミイダ 神井田 +カミイチ 上市 +カミイチ 神市 +カミイチ 頭市 +カミイチ 上一 +カミイチゾノ 上市園 +カミイデ 上出 +カミイデ 神出 +カミイデ 上井手 +カミイド 上井戸 +カミイナ 上伊南 +カミイナバ 上稲葉 +カミイネ 神稲 +カミイバ 上射場 +カミイマ 上今 +カミイマベップ 上今別府 +カミイリキ 上入来 +カミイリキ 上入來 +カミイリサ 上入佐 +カミイワ 上岩 +カミウエ 紙上 +カミウエ 神上 +カミウエ 神植 +カミウエゾノ 神上園 +カミウシヤ 上丑屋 +カミウスキ 上宇宿 +カミウセ 上鵜瀬 +カミウチ 神内 +カミウチ 上内 +カミウチ 神宇知 +カミウチダ 上内田 +カミウッタナイ 上打田内 +カミウツリ 神移 +カミウト 上宇都 +カミウミ 神海 +カミウメ 上梅 +カミウメザワ 上梅沢 +カミウメザワ 上梅澤 +カミウラ 上浦 +カミウラ 神浦 +カミウラ 紙浦 +カミウラ 上裏 +カミウンテン 上運天 +カミエ 上江 +カミエ 神栄 +カミエ 紙江 +カミエガワ 上江川 +カミエゴ 上江後 +カミエス 上江洲 +カミエス 上江州 +カミエダ 上枝 +カミエダ 上江田 +カミエダ 紙枝 +カミエノオ 上酔尾 +カミエノオ 上醉尾 +カミエビス 上夷 +カミオ 神尾 +カミオ 上尾 +カミオ 登尾 +カミオ 神生 +カミオ 紙尾 +カミオ 神於 +カミオ 神王 +カミオ 神緒 +カミオウ 神王 +カミオウ 神翁 +カミオウジ 神応寺 +カミオウジ 神應寺 +カミオオカワ 上大川 +カミオオサコ 上大迫 +カミオオサワ 上大沢 +カミオオサワ 上大澤 +カミオオスミ 上大角 +カミオオゾノ 上大園 +カミオオタ 上大田 +カミオオタ 上太田 +カミオカ 上岡 +カミオカ 神岡 +カミオカ 紙岡 +カミオカ 頂岳 +カミオカヤ 上岡谷 +カミオキ 上沖 +カミオク 上奥 +カミオケ 上桶 +カミオザキ 上尾崎 +カミオタ 上尾田 +カミオダ 上小田 +カミオト 神音 +カミオノダ 上小野田 +カミオノベ 上尾野辺(上尾野邊) +カミオマチ 神尾町 +カミオリ 上折 +カミオンユ 上温湯 +カミカ 神賀 +カミカ 神鍛 +カミカ 神鍜 +カミカ 神閑 +カミガ 神賀 +カミガアチ 上川内 +カミカイチ 上開地 +カミガイチ 上垣内 +カミガイチ 上ケ市 +カミガイチ 上開地 +カミガイト 上垣内 +カミガイト 上垣外 +カミカイドウ 上海道 +カミガウチ 上垣内 +カミガウチ 上河内 +カミガウチ 上川内 +カミガウチ 上ケ内 +カミガキ 上垣 +カミガキ 神垣 +カミガキ 上柿 +カミガキ 上三垣 +カミガキウチ 上垣内 +カミカキモト 上柿元 +カミカクシ 上隠 +カミカクチ 上角地 +カミカケ 神掛 +カミカケ 上掛 +カミカゲ 上陰 +カミカゲ 神影 +カミカコイ 上栫 +カミガサ 神笠 +カミガサコ 上ケ迫 +カミカジ 上梶 +カミガシマ 上ケ島 +カミガシマ 上ケ嶋 +カミガシマ 上ガ島 +カミガシラ 上頭 +カミカセダ 上加世田 +カミガソ 神夏磯 +カミカタ 上方 +カミカタ 神方 +カミガタ 上方 +カミガタ 上形 +カミガタ 上片 +カミガタクチ 上潟口 +カミガタクチ 上瀉口 +カミガタグチ 上潟口 +カミカタノ 上片野 +カミカタノ 上方野 +カミカタヒラ 上片平 +カミカツ 上葛 +カミカド 神門 +カミカド 上門 +カミカド 上角 +カミカド 上鹿渡 +カミガネ 上金 +カミガハラ 上ケ原 +カミガヒラ 上ケ平 +カミカベ 上壁 +カミカベヤ 上神谷 +カミカマ 上釜(上釡) +カミガマ 上釜(上釡) +カミカミヤ 上神谷 +カミガミヤ 上神谷 +カミガヤ 上栢 +カミカリヤ 上仮屋 +カミカリヤ 上刈谷 +カミカリヤ 上假屋 +カミカワ 上川 +カミカワ 神川 +カミカワ 上河 +カミカワ 神河 +カミカワ 紙川 +カミカワ 加美川 +カミガワ 上川 +カミガワ 神川 +カミガワ 上河 +カミガワ 神河 +カミカワイ 上川合 +カミカワイ 上川井 +カミガワイ 上川合 +カミカワウチ 上川内 +カミカワジ 上川路 +カミカワト 上川渡 +カミカワトコ 上川床 +カミカワナ 上川名 +カミカワバタ 上川畑 +カミカワハラ 上川原 +カミカワベ 上河辺(上河邊) +カミカワラ 上川原 +カミカワラ 上河原 +カミガワラ 上川原 +カミガワラ 上河原 +カミカンダ 上神田 +カミカンナ 上鉄穴 +カミキ 上木 +カミキ 神木 +カミギク 神菊 +カミキサキ 上木崎 +カミギシ 上岸 +カミキタ 上北 +カミキタ 神北 +カミキタダ 上北田 +カミキチ 神吉 +カミキド 上木戸 +カミキド 上城戸 +カミキハラ 上木原 +カミキヤ 上木屋 +カミキュウ 上久 +カミキョウ 上京 +カミキョウダ 上京田 +カミキョウデン 上京田 +カミギリ 上桐 +カミキリイシ 上切石 +カミク 上久 +カミクキタ 上久木田 +カミクサ 上草 +カミクズ 上葛 +カミクチ 上口 +カミグチ 上口 +カミグチ 神口 +カミグチ 髪口 +カミグチヤ 上口屋 +カミクボ 上久保 +カミクボ 上窪 +カミクボ 神窪 +カミクボタ 上窪田 +カミクマス 上熊須 +カミクモ 神雲 +カミクモヂ 上雲地 +カミクラ 上倉 +カミクラ 神蔵 +カミクラ 神倉 +カミクラ 神藏 +カミクリ 上栗 +カミグリ 上栗 +カミケ 上家 +カミコ 神子 +カミコ 紙子 +カミコ 上子 +カミコウ 上甲 +カミコウ 上高 +カミコウ 上講 +カミコウ 上府 +カミゴウ 上郷 +カミコウジ 上小路 +カミコウジ 神小路 +カミコウチ 上垣内 +カミコウチ 上河内 +カミコウチ 上川内 +カミゴウチ 上垣内 +カミゴウチ 上河内 +カミゴウチ 上川内 +カミコウベ 上河辺(上河邊) +カミコウベ 上河邉 +カミゴウリ 神郡 +カミゴオリ 神郡 +カミゴオリ 上郡 +カミコオリヤマ 上郡山 +カミコガ 上古閑 +カミコガワ 上小川 +カミコクラ 上小倉 +カミコクリョウ 上国料 +カミコクリョウ 上國料 +カミコクリョウ 上国領 +カミコサワ 神子沢 +カミコサワ 神子澤 +カミコザワ 神子沢 +カミコザワ 上小沢 +カミコザワ 神子澤 +カミコザワ 上小澤 +カミコシ 神越 +カミコシキ 上甑 +カミコシキマチ 上甑町 +カミコシバ 神小柴 +カミコジマ 神子島 +カミコジマ 神子嶋 +カミコジョウ 上小城 +カミコソノ 上小園 +カミコゾノ 上小園 +カミコゾノ 上小薗 +カミコダ 神子田 +カミコダイ 上古代 +カミコダチ 上古立 +カミコダニ 上小谷 +カミコヅル 上小鶴 +カミコテ 上小手 +カミゴテ 上小手 +カミコバ 上木場 +カミコバヤシ 上小林 +カミコマキ 上小牧 +カミコミ 上古見 +カミゴミ 上込 +カミコヤ 上小家 +カミゴロ 神頃 +カミコンヤ 上紺屋 +カミゴンヤ 上紺谷 +カミザイク 神細工 +カミサカ 上坂 +カミサカ 上阪 +カミサカ 神坂 +カミサカ 神阪 +カミサカ 紙坂 +カミサカイ 上境 +カミサカイダ 上境田 +カミザカエ 上栄 +カミサカモト 上坂元 +カミサカモト 上阪本 +カミサキ 神崎 +カミサキ 上崎 +カミサキ 神先 +カミサキ 紙崎 +カミザキ 神崎 +カミザキ 上崎 +カミザキ 紙崎 +カミサク 神作 +カミザクラ 神桜 +カミサゲ 上提 +カミサゲ 上堤 +カミサコ 上迫 +カミサコ 上硲 +カミサコ 上廻(上迴) +カミサコ 上佐古 +カミサコ 神迫 +カミサコ 紙迫 +カミサゴ 上砂 +カミサコダ 上迫田 +カミサコン 上左近 +カミササ 上笹 +カミザサ 上笹 +カミササヌキ 上笹貫 +カミササヤマ 上笹山 +カミサシ 神指 +カミサシ 上指 +カミサダ 神定 +カミサト 上里 +カミサト 神里 +カミザト 上里 +カミザト 神里 +カミザネ 上実 +カミザネ 上實 +カミサラタニ 上更谷 +カミサワ 神沢 +カミサワ 上沢 +カミサワ 神澤 +カミサワ 上澤 +カミザワ 神沢 +カミザワ 上沢 +カミザワ 神澤 +カミザワ 上澤 +カミザワ 紙沢 +カミザワ 紙澤 +カミサワダ 上沢田 +カミサワダ 上澤田 +カミサワツ 上沢津 +カミサワツ 上澤津 +カミサンゴウ 上参郷 +カミサンロ 上三路 +カミジ 上地 +カミジ 上路 +カミジ 上治 +カミジ 神地 +カミジ 神路 +カミジ 上ミ地 +カミジ 紙地 +カミジ 神治 +カミシオ 上塩 +カミシオイリ 上塩入 +カミジキ 神喰 +カミシキリョウ 上敷領 +カミシゲ 神成 +カミシゲ 上重 +カミシゲ 神茂 +カミシゲ 紙重 +カミシゲ 神重 +カミシタ 神下 +カミシタ 上下 +カミシタ 紙下 +カミジッコク 上拾石 +カミジッコク 上捨石 +カミシナ 神志那 +カミシナ 神品 +カミシナ 神支那 +カミシバハラ 上芝原 +カミシマ 上島 +カミシマ 上嶋 +カミシマ 神島 +カミシマ 上嶌 +カミシマ 神嶋 +カミシマ 紙島 +カミシマ 神嶌 +カミジマ 上島 +カミジマ 上嶋 +カミジマ 神島 +カミジマ 神嶋 +カミシミズ 上清水 +カミシモト 上四元 +カミシャ 神舎 +カミシュク 上宿 +カミジュク 神宿 +カミシュクナイ 神宿内 +カミジュッコク 上拾石 +カミショ 上所 +カミジョ 上所 +カミジョ 上処(上處) +カミショウ 上所 +カミショウ 上庄 +カミジョウ 上条 +カミジョウ 上條 +カミジョウ 上城 +カミジョウ 紙上 +カミジョウ 神城 +カミジョウ 上篠 +カミジョウ 上亟 +カミジョウ 上絛 +カミジョウ 上粂 +カミショウジ 上小路 +カミショウジ 上正路 +カミショウハラ 上正原 +カミシライシ 上白石 +カミシラカワ 上白川 +カミシラキ 上白木 +カミシラト 上白戸 +カミシラド 上白土 +カミシロ 神代 +カミシロ 上代 +カミシロ 上城 +カミシロ 神白 +カミシロ 神城 +カミシロド 上白土 +カミシン 上新 +カミシンバラ 上新原 +カミスエ 神末 +カミスカ 上須賀 +カミスキ 紙透 +カミスキ 上薄 +カミスキ 紙漉 +カミスキ 上簿 +カミスギ 上杉 +カミスギ 神杉 +カミスサキ 上須崎 +カミスザキ 上須崎 +カミスジ 上筋 +カミスズキ 上鈴木 +カミスダ 上須田 +カミスナ 上砂 +カミスナダ 上砂田 +カミズマ 上妻 +カミズミ 神住 +カミズル 上水流 +カミズル 神水流 +カミスワ 上諏訪 +カミセ 上瀬 +カミセ 神瀬 +カミセ 上畝 +カミセ 上世 +カミセイダ 上清田 +カミセキ 上関 +カミゼキ 上関 +カミセコ 紙迫 +カミセジ 上畝地 +カミセチ 上畝地 +カミセト 上瀬戸 +カミセト 上勢頭 +カミセド 上瀬戸 +カミセド 上勢頭 +カミソ 神祖 +カミゾウレ 上澤上 +カミゾエ 紙添 +カミソノ 上園 +カミソノ 神園 +カミソノ 上薗 +カミソノ 神薗 +カミゾノ 上園 +カミゾノ 神園 +カミゾノ 上薗 +カミゾノ 神薗 +カミゾノ 神囿 +カミソノダ 上園田 +カミソヤマ 上曽山 +カミソヤマ 上曾山 +カミソリ 刺刀 +カミソリ 剌刀 +カミゾリ 上剃 +カミタ 上田 +カミタ 神田 +カミタ 紙田 +カミタ 嘉味田 +カミタ 加美田 +カミダ 上田 +カミダ 神田 +カミダ 紙田 +カミダ 嘉味田 +カミタイ 上平 +カミタイ 上田井 +カミダイ 上代 +カミダイ 上台(上臺) +カミダイ 加美台 +カミダイモン 上大門 +カミタイラ 上平 +カミダイラ 上平 +カミタカ 上高 +カミタカ 神高 +カミタカ 神鷹 +カミダカ 上高 +カミタカハラ 上高原 +カミタカマキ 上高牧 +カミタカヤマ 上高山 +カミタキ 上滝 +カミタキ 上瀧 +カミタケ 上竹 +カミタケ 上武 +カミタケ 神武 +カミタケ 神竹 +カミタケ 神岳 +カミタケハラ 上竹原 +カミダサイ 上田才 +カミタシロ 上田代 +カミタタラ 上鑪 +カミタチ 神立 +カミタチ 上立 +カミダチ 神立 +カミタツ 神達(神逹) +カミタテ 神立 +カミダテ 神立 +カミダテ 上館 +カミダテ 上舘 +カミダテ 神舘 +カミダテ 神館 +カミダテ 神建 +カミダナ 上棚 +カミタナカ 上田中 +カミタニ 神谷 +カミタニ 上谷 +カミタニ 紙谷 +カミタニ 狼谷 +カミタニ 加美谷 +カミタニ 楮谷 +カミタニ 加見谷 +カミタニ 帋谷 +カミダニ 神谷 +カミダニ 上谷 +カミダニ 紙谷 +カミタニガワ 上谷川 +カミタニダ 上谷田 +カミタネ 上種 +カミタノ 神多野 +カミタヒラ 上田平 +カミタビラ 上田平 +カミタマリ 上玉利 +カミタヤ 上田谷 +カミダユ 上大湯 +カミタリ 神足 +カミチ 上地 +カミチ 上池 +カミチ 紙地 +カミチ 上三地 +カミヂ 上地 +カミチカ 神近 +カミチカ 上近 +カミチャタニ 上茶谷 +カミチョウジャ 上長者 +カミツ 神津 +カミツ 上津 +カミツカ 神塚 +カミツカ 紙塚 +カミヅカ 上塚 +カミヅカ 神塚 +カミツカサ 上司 +カミツキ 神月 +カミツクエ 上机 +カミツジ 上辻 +カミツチイ 上土居 +カミツチハシ 上土橋 +カミツナ 上綱 +カミツボ 上坪 +カミツボ 神坪 +カミツマ 上妻 +カミヅマ 上妻 +カミツマガリ 上津曲 +カミツユ 上津遊 +カミツル 上鶴 +カミツル 上水流 +カミツル 上津留 +カミヅル 上鶴 +カミヅル 上水流 +カミヅル 神水流 +カミテ 上手 +カミテ 神手 +カミテ 紙手 +カミテ 上々手 +カミデ 上出 +カミデ 神出 +カミデグチ 上出口 +カミデラ 上寺 +カミト 神戸 +カミト 上戸 +カミト 上都 +カミト 紙戸 +カミド 上戸 +カミド 上土 +カミドイ 上土井 +カミドイ 上土居 +カミトウ 上東 +カミトウ 上塘 +カミトウ 上遠 +カミトウ 上当 +カミトウゲ 上峠 +カミドウゾノ 上堂薗 +カミドウゾノ 上堂園 +カミトウチ 上東地 +カミドウチ 上堂地 +カミトウノ 上遠野 +カミトウノ 上東野 +カミトオノ 上遠野 +カミドオリ 上通 +カミトク 紙徳 +カミトクサリ 上戸鎖 +カミトコ 上床 +カミドコ 上床 +カミトコロ 上所 +カミドコロ 上所 +カミトソ 上唐湊 +カミトダ 上戸田 +カミトドロキ 上轟 +カミトノ 上登能 +カミドノ 守殿 +カミドノ 上登野 +カミトマイ 上斗米 +カミトモ 上塘 +カミトモ 神供 +カミトヨ 上豊 +カミトリ 神鳥 +カミトリ 神取 +カミトンダ 上飛田 +カミナ 神名 +カミナ 上名 +カミナ 紙名 +カミナイ 上内 +カミナイジ 上内侍 +カミナイジ 上内寺 +カミナオ 上猶 +カミナカ 上中 +カミナカ 上仲 +カミナカ 神中 +カミナカ 紙中 +カミナカ 神仲 +カミナガ 神長 +カミナガ 神永 +カミナガ 上永 +カミナガ 上長 +カミナガ 紙永 +カミナガ 加美長 +カミナカイ 上中居 +カミナガイ 上永井 +カミナカオ 上中尾 +カミナガクラ 神長倉 +カミナガセ 上永瀬 +カミナカゾノ 上中園 +カミナガタ 上永田 +カミナガネ 上長根 +カミナカノ 上中野 +カミナガノ 上長野 +カミナガノ 上永野 +カミナカベップ 上中別府 +カミナカムラ 上中村 +カミナカヤ 上中谷 +カミナカヤシキ 上中屋敷 +カミナガヨシ 上永吉 +カミナグチ 上水口 +カミナシ 上梨 +カミナシ 上梨子 +カミナダ 上灘 +カミナツイ 上夏井 +カミナデ 上撫 +カミナベ 上鍋 +カミナミ 神並 +カミナミ 神浪 +カミナミ 上伊南 +カミナラハラ 上楢原 +カミナリ 神成 +カミナリ 雷 +カミナリタ 神成田 +カミナロ 上奈路 +カミナロ 上奈露 +カミナワテ 上縄手 +カミニイダ 上新井田 +カミニイハラ 上新原 +カミニシ 上西 +カミニシ 神西 +カミニシ 紙西 +カミニシカワハラ 上西川原 +カミニシカワラ 上西川原 +カミニシクボ 上西窪 +カミニシゾノ 上西園 +カミニワ 神庭 +カミヌシ 神主 +カミヌシ 上主 +カミヌシリョウ 神主領 +カミヌマ 上沼 +カミヌマ 神沼 +カミネ 上根 +カミネ 加峯 +カミネ 加峰 +カミネ 加味根 +カミネ 上禰 +カミネ 上祢 +カミノ 上野(上墅) +カミノ 神野 +カミノ 神農 +カミノ 上農 +カミノ 紙野 +カミノ 神埜 +カミノ 加美野 +カミノ 神之 +カミノ 加己野 +カミノ 加巳野 +カミノ 神咒 +カミノイ 上ノ井 +カミノイエ 上ノ家 +カミノイエ 上之家 +カミノウ 神農 +カミノウ 上農 +カミノウ 神納 +カミノウチ 上ノ内 +カミノウチ 上之内 +カミノウチ 上の内 +カミノウラ 神之浦 +カミノウラ 上之浦 +カミノウラ 上野浦 +カミノエ 上之家 +カミノカド 神之門 +カミノカド 上之門 +カミノカド 神ノ門 +カミノカワ 上野川 +カミノカワ 神ノ川 +カミノカワ 上ノ川 +カミノカワ 神之川 +カミノカワ 神野河 +カミノガワ 上野川 +カミノキ 神木 +カミノクチ 神ノ口 +カミノクチ 神之口 +カミノクラ 神ノ倉 +カミノゴウ 上之郷 +カミノゴウタニ 上之郷谷 +カミノゴウヤ 上之郷谷 +カミノゴウヤ 上ノ郷谷 +カミノサワ 上ノ沢 +カミノサワ 上ノ澤 +カミノシタ 神之下 +カミノシマ 上野島 +カミノス 神ノ栖 +カミノセ 上ノ瀬 +カミノソノ 上之園 +カミノソノ 上之薗 +カミノソノ 神之薗 +カミノソノ 神之園 +カミノソノ 神ノ薗 +カミノタ 神之田 +カミノタ 神ノ田 +カミノタ 上ノ田 +カミノダ 神之田 +カミノダ 神ノ田 +カミノタニ 上ノ谷 +カミノト 神之門 +カミノハマ 上之浜 +カミノハマ 上之濱 +カミノハラ 上之原 +カミノハラ 上野原 +カミノハラ 神之原 +カミノハラ 紙ノ原 +カミノブ 神信 +カミノミヤ 上ノ宮 +カミノムラ 神之村 +カミノメ 上野目 +カミノヤマ 上ノ山 +カミノリ 上則 +カミノワキ 上之脇 +カミハエ 上八重 +カミハカマダ 上袴田 +カミハギ 上萩 +カミハギハラ 上萩原 +カミハギワラ 上萩原 +カミハザ 上㹦 +カミハザ 上貂 +カミハシ 上橋 +カミハシ 神橋 +カミハシ 上端 +カミハシ 神箸 +カミハジ 上土師 +カミハシラ 神柱 +カミバシラ 神柱 +カミハタ 上畑 +カミハタ 上畠 +カミハタ 神畠 +カミハタ 神畑 +カミバタ 上端 +カミハチ 神八 +カミハツ 神初 +カミハツボ 上羽坪 +カミハナワ 上花輪 +カミハバ 上羽場 +カミハバ 上巾 +カミババ 上馬場(上馬塲) +カミババ 神馬場 +カミハマ 上浜 +カミハマ 上濱 +カミハヤシ 神林 +カミバヤシ 上林 +カミバヤシ 神林 +カミバヤシ 髪林 +カミバヤシヤマ 上林山 +カミハラ 上原 +カミハラ 神原 +カミハラ 紙原 +カミハライ 上払 +カミハライ 上拂 +カミハラグチ 上原口 +カミハラコ 上原子 +カミヒガシ 上東 +カミヒキジ 上引地 +カミヒゴシ 上吹越 +カミヒサ 上久 +カミヒナタ 上日向 +カミヒラ 上平 +カミヒラ 神平 +カミヒラカワ 上平川 +カミヒラクマ 上平熊 +カミヒラグマ 上平熊 +カミヒラセ 上平瀬 +カミヒラタ 上平田 +カミヒロ 上広 +カミヒロ 上廣 +カミヒロ 紙広 +カミヒロ 神広(神廣) +カミフキゴシ 上吹越 +カミフク 上福 +カミフク 神福 +カミフクイ 上福井 +カミフクウラ 上福浦 +カミフクダ 上福田 +カミフクマル 上福丸 +カミフクモト 上福元 +カミフゴ 上富居 +カミフゴ 上冨居 +カミフサ 上房 +カミフジ 神藤 +カミフジ 上藤 +カミフナツ 上船津(上舩津) +カミフルタチ 上古立 +カミフルトノ 上古殿 +カミフルドノ 上古殿 +カミフロ 上風呂 +カミベ 神戸 +カミベ 上部 +カミベ 上辺(上邉) +カミベ 上邊 +カミベッソ 上別祖 +カミベツナワ 上別縄 +カミベップ 上別府 +カミホ 上保 +カミホ 上穂 +カミボウ 上坊 +カミホキ 上甫木 +カミホキ 上保木 +カミホギ 上甫木 +カミホギ 上穂木(上穗木) +カミホギ 上保木 +カミホノキ 上甫木 +カミホノキ 上穂木(上穗木) +カミホラ 上洞 +カミホリ 上堀 +カミホリ 神堀 +カミボリ 上堀 +カミホリウチ 上堀内 +カミマ 上間 +カミマイ 上舞 +カミマエ 神前 +カミマエ 上前 +カミマエダ 上前田 +カミマエハク 上前泊 +カミマキ 上牧 +カミマキ 神牧 +カミマキ 神巻 +カミマキセ 上牧瀬 +カミマキノ 上牧野 +カミマサヨリ 上政頼 +カミマス 上桝 +カミマス 上枡 +カミマス 上舛 +カミマス 神益 +カミマチ 上町 +カミマツ 神松 +カミマツセ 上松瀬 +カミマツノ 上松野 +カミマテ 上档 +カミマテ 上檔 +カミマル 神丸 +カミマル 上丸 +カミマル 紙丸 +カミマン 上万 +カミマン 上萬 +カミミガキ 上三垣 +カミミズ 上水 +カミミズ 神水 +カミミズタル 上水樽 +カミミゾ 上溝 +カミミツ 神光 +カミミツ 上満 +カミミナミ 上南 +カミミネ 上峰 +カミミネ 上峯 +カミミノ 上蓑 +カミミヤ 上宮 +カミミヤ 神宮 +カミミヤジ 神宮路 +カミミヤタ 上宮田 +カミミヤダ 上宮田 +カミミョウズ 上名主 +カミムカイ 上向 +カミムカイ 上向井 +カミムキ 上向 +カミムク 上椋 +カミムタ 上牟田 +カミムネ 上宗 +カミムネ 上棟 +カミムラ 上村 +カミムラ 紙村 +カミムラ 上邑 +カミムラ 上邨 +カミムラ 神邑 +カミムライ 上村井 +カミムレ 神牟礼 +カミムレ 神牟禮 +カミムロ 上室 +カミムロ 上榁 +カミメガ 上女鹿 +カミメラ 上米良 +カミモト 嘉味元 +カミモト 嘉味本 +カミモト 紙元 +カミモト 紙本 +カミモト 上元 +カミモト 上本 +カミモト 神元 +カミモト 神本 +カミモト 髪元 +カミモトノ 上本野 +カミモリ 紙森 +カミモリ 上守 +カミモリ 上森 +カミモリ 神守 +カミモリ 神森 +カミモリ 神盛 +カミモリアイ 上森合 +カミモロ 上諸 +カミヤ 加宮 +カミヤ 加美谷 +カミヤ 嘉宮 +カミヤ 賀宮 +カミヤ 桂宮 +カミヤ 香宮 +カミヤ 紙屋 +カミヤ 紙家 +カミヤ 紙合 +カミヤ 紙谷 +カミヤ 紙矢 +カミヤ 上屋 +カミヤ 上家 +カミヤ 上宮 +カミヤ 上谷 +カミヤ 上美谷 +カミヤ 上矢 +カミヤ 神屋 +カミヤ 神家 +カミヤ 神宮 +カミヤ 神舎 +カミヤ 神谷 +カミヤ 神八 +カミヤ 神矢 +カミヤウチ 上谷内 +カミヤウチ 神谷内 +カミヤエ 上八重 +カミヤシキ 上屋敷 +カミヤシキ 上屋舗 +カミヤシキ 神屋敷 +カミヤス 上安 +カミヤス 上保 +カミヤス 神安 +カミヤス 神保 +カミヤスヒラ 上安平 +カミヤスンバ 上休場 +カミヤチ 上谷地 +カミヤッコ 神奴 +カミヤド 神宿 +カミヤナ 上簗 +カミヤナギ 上柳 +カミヤナギタ 上柳田 +カミヤナギダ 上柳田 +カミヤハタ 紙谷畑 +カミヤブ 上薮 +カミヤブ 上藪 +カミヤブ 上籔 +カミヤブ 神薮 +カミヤブ 神藪 +カミヤブ 神籔 +カミヤマ 加美山 +カミヤマ 紙山 +カミヤマ 上山 +カミヤマ 神家満 +カミヤマ 神山 +カミヤマ 霊山 +カミヤマ 祗山 +カミヤマグチ 上山口 +カミヤマサキ 上山崎 +カミヤマザキ 上山崎 +カミヤマシタ 上山下 +カミヤマネ 上山根 +カミヤマモト 上山本 +カミユイ 上結 +カミユイ 神結 +カミユキ 神行 +カミユセ 上湯瀬 +カミヨ 上代 +カミヨ 神代 +カミヨ 神余 +カミヨ 神与 +カミヨウボ 上養母 +カミヨコテ 上横手 +カミヨシ 上吉 +カミヨシ 上好 +カミヨシ 神吉 +カミヨシ 神好 +カミヨシカワ 上吉川 +カミヨシハラ 上吉原 +カミヨシワラ 上吉原 +カミヨツモト 上四元 +カミリョウ 上良 +カミリョウ 上領 +カミワキ 上脇 +カミワキ 神脇 +カミワキタ 上脇田 +カミワキダ 上脇田 +カミワズミ 神和住 +カミワダ 上和田 +カミワタリ 上渡 +カミワタリ 神渡 +カミワノ 上和野 +カミワラビ 上蕨 +カミワリ 神割 +カムキ 加向 +カムキ 加無木 +カムキ 嘉向 +カムキ 嘉無木 +カムラ 佳村 +カムラ 加村 +カムラ 可村 +カムラ 嘉村 +カムラ 家村 +カムラ 荷村 +カムラ 蚊村 +カムラ 賀村 +カムラ 香村 +カムラ 鹿村 +ガムラ 賀村 +カムリヤ 冠谷 +カムロ 加室 +カムロ 嘉室 +カムロ 家室 +カムロ 河室 +カムロ 香室 +カムロ 鹿室 +カムロ 神室 +カムロ 禿 +カムロイ 禿井 +カムロギ 禿樹 +カメ 亀 +カメ 鼈 +カメアリ 亀有 +カメイ 亀井 +カメイ 亀居 +カメイ 瓶井 +カメイ 亀位 +カメイ 瓶居 +カメイ 龜井 +カメイエ 亀家 +カメイガワ 亀井川 +カメイケ 亀池 +カメイザワ 亀井沢 +カメイシ 亀石 +カメイタ 亀板 +カメイヤマ 亀井山 +カメイリ 亀入 +カメイワ 亀岩 +カメイワ 亀窟 +カメウエ 亀上 +カメウジ 亀氏 +カメウチ 亀内 +カメウチ 瓶内 +カメウミ 亀海 +カメウラ 亀浦 +カメエ 亀江 +カメオ 亀尾 +カメオカ 亀岡 +カメオカ 甕岡 +カメオカ 龜岡 +カメオキ 亀沖 +カメカイ 亀貝 +カメガイ 亀谷 +カメガイ 亀ケ谷 +カメガイ 亀貝 +カメガイ 亀海 +カメガイ 亀飼 +カメガイ 亀ケ井 +カメガオカ 亀ケ岡 +カメガキ 亀垣 +カメガサワ 亀ケ沢 +カメガサワ 亀ケ澤 +カメガシラ 亀頭 +カメガタ 亀形 +カメカネヤ 亀金谷 +カメガフチ 亀ケ渕 +カメガミ 亀上 +カメガモリ 亀ケ森 +カメガモリ 亀ケ盛 +カメガヤ 亀谷 +カメガヤ 亀ケ谷 +カメガヤ 亀金谷 +カメカワ 亀川 +カメガワ 亀川 +カメキ 亀木 +カメキ 亀喜 +カメギ 亀城 +カメグチ 亀口 +カメクボ 亀久保 +カメクボ 亀窪 +カメクラ 亀倉 +カメコ 亀子 +カメコウ 亀甲 +カメゴシ 亀越 +カメサカ 亀坂 +カメサカ 亀阪 +カメサキ 亀崎 +カメサキ 亀岬 +カメザキ 亀崎 +カメザキ 亀嵜 +カメザキ 亀埼 +カメサク 亀作 +カメサコ 亀迫 +カメサト 亀里 +カメザト 亀里 +カメサワ 亀沢 +カメサワ 亀澤 +カメザワ 亀沢 +カメザワ 亀澤 +カメジ 亀地 +カメシゲ 亀重 +カメシタ 亀下 +カメジナカ 亀治中 +カメシマ 亀島 +カメシマ 亀嶋 +カメジマ 亀島 +カメジマ 亀嶋 +カメジリ 亀尻 +カメシロ 亀代 +カメズ 亀津 +カメズ 亀頭 +カメスイ 亀水 +カメズミ 亀住 +カメセキ 亀関 +カメゾノ 亀園 +カメタ 亀田(龜田) +カメタ 亀多 +カメダ 亀田(龜田) +カメダ 瓶田 +カメダ 亀多 +カメダ 加芽田 +カメタカ 亀高 +カメタカ 亀鷹 +カメタキ 亀滝 +カメタキ 亀瀧 +カメタケ 亀竹 +カメタケ 亀嶽 +カメタニ 亀谷 +カメタニ 狼谷 +カメタニ 亀澗 +カメタニ 瓶谷 +カメタニ 龜谷 +カメダニ 亀谷 +カメタヤ 亀田谷 +カメダヤ 亀田谷 +カメチ 亀地 +カメツ 亀津 +カメヅ 亀津 +カメツカ 亀塚 +カメヅカ 亀塚 +カメツギ 亀次 +カメツタ 亀蔦 +カメツル 亀鶴 +カメツル 亀寉 +カメトク 亀徳(龜徳) +カメトモ 亀友 +カメナカ 亀中 +カメナガ 亀永 +カメナガ 亀長 +カメナシ 亀梨 +カメニシ 亀西 +カメノ 亀野 +カメノ 瓶野 +カメノイ 亀廼井 +カメノイ 亀迺井 +カメノウエ 亀ノ上 +カメノウチ 亀之内 +カメノオ 亀野尾 +カメノソノ 亀之園 +カメノソノ 亀ノ園 +カメノハラ 亀之原 +カメノリ 亀苔 +カメハシ 亀橋 +カメハタ 亀畑 +カメハマ 亀浜 +カメハマ 亀濱 +カメバヤシ 亀林 +カメハラ 亀原 +カメヒ 亀樋 +カメビ 亀樋 +カメヒサ 亀久 +カメヒラ 亀平 +カメヒロ 亀広 +カメヒロ 亀弘 +カメヒロ 亀廣 +カメフチ 亀渕 +カメフチ 亀淵 +カメブチ 亀渕 +カメブチ 亀淵 +カメボシ 亀星 +カメボラ 亀洞 +カメマ 亀間 +カメマツ 亀松 +カメマル 亀丸 +カメマワリ 亀廻 +カメミズ 亀水 +カメミツ 亀光 +カメムラ 亀村 +カメモト 亀本 +カメモト 亀元 +カメモリ 亀森 +カメモリ 亀守 +カメヤ 亀谷 +カメヤ 亀屋 +カメヤ 亀矢 +カメヤ 亀舎 +カメヤ 龜谷 +カメヤキ 瓶焼 +カメヤス 亀安 +カメヤマ 亀山(龜山) +カメヨシ 亀好 +カメヨシ 亀吉 +カメワ 亀和 +カメワカ 亀若 +カメワダ 亀和田 +カメワリ 亀割 +カメワリ 瓶割 +カモ 加茂 +カモ 鹿毛 +カモ 鴨 +カモ 賀茂 +カモ 嘉茂 +カモ 加毛 +カモイ 鴨井 +カモイ 鴨居 +カモイ 加茂井 +カモイケ 鴨池 +カモイダ 鴨居田 +カモウ 蒲生 +カモウ 鴨生 +ガモウ 蒲生 +ガモウ 河毛 +ガモウダ 蒲生田 +カモウチ 鴨打 +カモウチ 鴨内 +カモウラ 鴨浦 +カモオ 鴨尾 +カモオ 加茂尾 +カモオカ 鴨岡 +カモオク 鴨奥 +カモガキ 鴨垣 +カモガシラ 鴨頭 +カモカス 鴨粕 +カモカリ 鴨狩 +カモガリ 鴨狩 +カモガワ 鴨川 +カモガワ 加茂川 +カモガワ 鴨河 +カモガワ 蒲川 +カモガワ 賀茂川 +カモキ 鴨木 +カモギ 鴨木 +カモグチ 鴨口 +カモサカ 加茂坂 +カモサキ 鴨崎 +カモザキ 鴨崎 +カモサク 鴨作 +カモサワ 鴨沢 +カモサワ 鴨澤 +カモザワ 鴨沢 +カモザワ 鴨澤 +カモジ 鴨治 +カモシゲ 鴨重 +カモシタ 鴨志田 +カモシタ 鴨下 +カモシタ 加茂下 +カモシダ 鴨志田 +カモシダ 鴨子田 +カモシマ 鴨島 +カモシマ 鴨嶋 +カモジマ 鴨島 +カモスガ 鴨須賀 +カモズミ 鴨角 +カモセ 鴨瀬 +カモソリ 鴨反 +カモタ 鴨田 +カモダ 鴨田 +カモダ 加茂田 +カモダ 加守田 +カモダ 加毛田 +カモダ 賀茂田 +カモタニ 加茂谷 +カモタニ 鴨谷 +カモチ 蒲地 +カモチ 加持 +カモチ 鴨池 +カモチ 鴨打 +カモチ 賀持 +カモチ 蒲生地 +カモチ 家持 +カモチ 鹿持 +カモデ 鴨出 +カモト 神本 +カモト 家本 +カモト 嘉本 +カモト 加本 +カモト 鹿本 +カモト 賀本 +カモト 賀元 +カモト 荷本 +カモト 嘉元 +カモト 鴨戸 +ガモト 賀本 +カモトウ 鴨藤 +カモトウ 鴨東 +カモトリ 鴨取 +カモナ 鴨名 +カモナカ 鴨中 +カモニシ 鴨西 +カモネ 鴨根 +カモノ 鴨野 +カモノ 加茂野 +カモノ 鴨埜 +カモバヤシ 鴨林 +カモハラ 蒲原 +カモハラ 蒲生原 +カモハラ 鴨原 +カモヒダ 鴨飛田 +カモヒラ 鴨平 +カモベ 鴨部 +カモベ 加茂部 +カモマエ 加茂前 +カモミヤ 鴨宮 +カモミヤ 加茂宮 +カモムラ 鴨村 +カモメ 鴨目 +カモメ 鴎 +カモメバタ 鴎端 +カモモリサワ 鴨森沢 +カモヤ 加茂谷 +カモヤ 鴨谷 +カモヤ 釜親 +カモヤマ 鴨山 +カモリ 冠 +カモリ 家守 +カモリ 加森 +カモリ 加守 +カモリ 嘉森 +カモリ 香森 +カモリ 加盛 +カモン 加門 +カモン 掃部 +カモン 嘉門 +カモン 家門 +カモン 賀門 +カモン 歌門 +カモン 賀紋 +カモン 香門 +カモン 加文 +カモン 鴨門 +カモンジ 加文字 +カモンゼキ 掃部関 +カモンドウ 加門堂 +カヤ 嘉屋 +カヤ 賀谷 +カヤ 賀屋 +カヤ 栢 +カヤ 架谷 +カヤ 鹿屋 +カヤ 加悦 +カヤ 加谷 +カヤ 茅 +カヤ 萱 +カヤ 加舎 +カヤ 彼谷 +カヤ 賀陽 +カヤ 香谷 +カヤ 榧 +カヤ 加屋 +カヤ 加家 +カヤ 加陽 +カヤ 蚊屋 +カヤ 加舍 +カヤ 萓 +ガヤ 賀谷 +ガヤ 我谷 +ガヤ 駕谷 +カヤイ 茅井 +カヤウチ 栢内 +カヤウチ 萱内 +カヤオ 栢尾 +カヤオ 茅尾 +カヤオ 萱尾 +カヤオイ 茅生 +カヤオカ 萱岡(萓岡) +カヤオカ 茅岡 +カヤガキ 榧垣 +カヤガキ 萱垣 +カヤガキ 栢垣 +カヤガキ 茅垣 +カヤガサコ 茅ケ迫 +カヤカベ 茅壁 +カヤカベ 加家壁 +カヤカワ 茅川 +カヤガワ 仮谷川 +カヤキ 栢木 +カヤキ 榧木 +カヤキ 茅木 +カヤギ 栢木 +カヤギ 榧木 +カヤギ 茅木 +カヤキリ 茅切 +カヤギリ 茅切 +カヤク 栢工 +カヤグチ 栢口 +カヤクボ 茅窪 +カヤサキ 茅先 +カヤサキ 嘉屋崎 +カヤサキ 茅崎 +カヤサキ 萱崎 +カヤザキ 嘉屋崎 +カヤサト 萱里 +カヤサト 茅里 +カヤザワ 萱沢 +カヤザワ 萱澤 +カヤシゲ 嘉屋重 +カヤシタ 栢下 +カヤシタ 榧下 +カヤシマ 萱島 +カヤシマ 茅島 +カヤシマ 萱嶋 +カヤシマ 茅嶋 +カヤシマ 柏島 +カヤシマ 萱嶌 +カヤシマ 萓嶌 +カヤシマ 栢島 +カヤシマ 茅嶌 +カヤシマ 栢嶋 +カヤシマ 柏嶋 +カヤシマ 萓島 +カヤシマ 萓嶋 +カヤジマ 萱島 +カヤジマ 萱嶋 +カヤジマ 萱嶌 +カヤスガ 栢菅 +カヤセ 栢瀬 +カヤソノ 萱園 +カヤゾノ 茅園 +カヤタ 茅田 +カヤタ 萱田 +カヤタ 栢多 +カヤタ 柏多 +カヤダ 茅田 +カヤダ 萱田 +カヤダ 加宅田 +カヤダ 栢田 +カヤタイ 茅平 +カヤタニ 萱谷 +カヤタニ 榧谷 +カヤタニ 茅谷 +カヤタニ 栢谷 +カヤタニ 萓谷 +カヤツ 萱津 +カヤドウ 萱堂 +カヤドウ 萓堂 +カヤナカ 茅中 +カヤナカ 萱中 +カヤナギ 嘉柳 +カヤヌマ 萱沼 +カヤヌマ 栢沼 +カヤヌマ 茅沼 +カヤヌマ 萓沼 +カヤヌマ 柏沼 +カヤネ 茅根 +カヤネ 榧根 +カヤネ 栢根 +カヤノ 茅野(茅埜) +カヤノ 萱野 +カヤノ 栢野 +カヤノ 榧野 +カヤノ 加屋野 +カヤノ 萓野 +カヤノ 茅納 +カヤノ 蚊谷野 +カヤノウ 茅納 +カヤノキ 栢木 +カヤノキ 榧木 +カヤノキダニ 栢木谷 +カヤノマ 栢之間 +カヤノマ 茅ノ間 +カヤノマ 茅之間 +カヤバ 萱場 +カヤバ 茅場 +カヤバ 榧場 +カヤバ 栢場 +カヤバ 萓場 +カヤハシ 萱橋(萓橋) +カヤハシ 栢橋 +カヤハシ 茅橋 +カヤハシ 榧橋 +カヤハタ 萱畑 +カヤハタ 茅畑 +カヤハナ 茅花 +カヤバヤシ 萱林 +カヤハラ 茅原 +カヤハラ 萱原 +カヤハラ 栢原 +カヤハラ 榧原 +カヤハラ 萓原 +カヤハラ 芽原 +カヤブキ 茅吹 +カヤブキ 萱葺 +カヤフサ 茅房 +カヤベ 栢部 +カヤベ 萱部 +カヤマ 香山 +カヤマ 加山 +カヤマ 鹿山 +カヤマ 嘉山 +カヤマ 夏山 +カヤマ 樺山 +カヤマ 華山 +カヤマ 佳山 +カヤマ 萱間 +カヤマ 家山 +カヤマ 賀山 +カヤマ 茅山 +カヤマ 荷山 +カヤマ 茅間 +カヤマ 山 +カヤマ 可山 +カヤマ 嘉弥真(嘉彌真・嘉彌眞) +カヤマ 萱山 +カヤマ 栢間 +カヤマ 萓間 +カヤマ 数山(數山) +ガヤマ 牙山 +ガヤマ 莪山 +ガヤマ 俄山 +ガヤマ 芽山 +カヤマキ 萱巻 +カヤマキ 萱槙 +カヤミョウ 萱苗 +カヤムラ 萱村 +カヤムラ 栢村 +カヤムロ 萱室 +カヤムロ 茅室 +カヤモト 栢本 +カヤモト 茅本 +カヤモト 加屋本 +カヤモト 榧本 +カヤモト 嘉屋本 +カヤモト 萱本 +カヤモト 栢元 +カヤモト 萱元 +カヤモリ 萱森 +カヤモリ 栢森 +カヤモリ 茅森 +カヤモリ 柏森 +カヤモリ 榧守 +カヤモリ 栢盛 +カヤモリ 榧森 +カヤモリ 萱守 +カヤモリ 萓森 +カヤワキ 萱脇 +カヤワキ 栢脇 +カヤワケ 栢分 +カヤワリ 栢割 +カユウ 花遊 +カユウ 鹿遊 +カユカワ 粥川 +カユガワ 粥川 +カユゴメ 粥米 +カユタ 加勇田 +カユダ 加勇田 +カユツカ 粥塚 +カユヅカ 粥塚 +カユミ 家弓 +カユミ 粥見 +カユミ 加弓 +カユミ 嘉弓 +カヨイ 通 +カヨイ 通井 +カヨイジ 通地 +カヨウ 嘉陽 +カヨウ 加用 +カヨウ 賀陽 +カヨウ 萱生 +カヨウ 鹿養 +カヨウ 加養 +カヨウ 加陽 +カヨウ 荷葉 +カヨウ 嘉洋 +カヨウ 通生 +ガヨウ 峩洋 +カヨウカタ 通形 +カヨウダ 嘉陽田 +カヨオ 萱生 +カヨオカ 家代岡 +カヨシ 嘉吉 +カヨダ 嘉陽田 +カヨタニ 通谷 +カラ 加良 +カラ 嘉良 +カラ 唐 +カラ 加羅 +カラアマ 唐尼 +カライ 賀来 +カライ 唐井 +カライ 柄井 +カライケ 唐池 +カライケ 柄池 +カライシ 辛石 +カライシ 唐石 +カライト 神来社 +カライト 唐糸 +カライワ 唐岩 +カラウシ 唐牛 +カラウチ 唐内 +カラオ 唐尾 +カラオ 唐生 +カラオ 唐苧 +カラオカ 唐岡 +カラオケ 唐桶 +カラカサ 唐笠 +カラカサ 傘 +カラカネ 唐金 +カラカマ 唐鎌 +カラカマ 唐釜 +カラカミ 唐紙 +カラカミ 唐神 +カラカメ 唐亀 +カラカワ 唐川 +カラカワ 辛川 +カラカワ 柄川 +カラカワ 加羅川 +カラキ 唐木 +カラキ 神楽 +カラキ 辛木 +カラキ 柄木 +カラキ 巨炊 +カラキ 神樂 +カラキサワ 唐木沢 +カラキサワ 唐木澤 +カラキザワ 唐木沢 +カラキザワ 唐木澤 +カラギシ 唐岸 +カラキタ 唐木田 +カラキタ 柄木田 +カラキタ 百木田 +カラキダ 唐木田 +カラキダ 柄木田 +カラキダ 辛木田 +カラク 加楽 +ガラク 賀楽(賀樂) +カラクチ 唐口 +カラグチ 唐口 +カラクニ 唐国 +カラクニ 唐國 +カラクニ 唐邦 +カラクラ 唐倉 +カラクワ 唐桑 +カラケ 唐家 +カラコ 唐子 +カラコ 柄子 +カラサキ 唐崎 +カラサキ 柄崎 +カラサキ 辛崎 +カラサキ 唐嵜 +カラサキ 抦﨑 +カラサワ 唐沢 +カラサワ 柄沢 +カラサワ 樺沢 +カラサワ 唐澤 +カラサワ 椛沢 +カラサワ 樺澤 +カラサワ 柄澤 +カラサワ 椛澤 +カラサワ 辛沢 +カラザワ 唐沢 +カラザワ 唐澤 +カラシゲ 唐重 +カラシナ 唐品 +カラシマ 辛島 +カラシマ 唐島 +カラシマ 辛嶋 +カラシマ 唐嶋 +カラシマ 柄島 +カラシマ 辛嶌 +カラシマダ 唐島田 +カラシマダ 唐嶋田 +カラシロ 唐城 +カラス 唐須 +カラス 烏 +カラス 鴉 +カラスエ 烏末 +カラスオ 烏尾 +カラスガ 柄須賀 +カラスガワ 烏川 +カラスキ 犂 +カラスギ 唐杉 +カラスゲ 唐管 +カラスゲ 唐菅 +カラスゴ 鴉越 +カラスゴ 烏子 +カラスダ 烏田 +カラスダ 鴉田 +カラスタニ 烏谷 +カラスダニ 烏谷 +カラスドイ 烏土居 +カラスノ 烏野 +カラスバシ 烏橋 +カラスマル 烏丸 +カラスミ 唐住 +カラスヤマ 烏山 +カラスワキ 烏脇 +カラタ 唐田 +カラタ 唐太 +カラタ 柄多(柄夛) +カラタ 加羅田 +カラタキ 唐滝 +カラタケ 唐竹 +カラタチ 唐立 +カラタニ 柄谷 +カラタニ 唐谷 +カラタニ 加良谷 +カラタニ 売谷 +カラタニ 殻谷 +カラタニ 唐渓 +カラタニ 唐溪 +カラタニ 殼谷 +ガラタニ 柄谷 +カラツ 唐津 +カラツ 柄津 +カラツダニ 唐津谷 +カラツチ 唐土 +カラツドイ 唐津土井 +カラツドイ 唐津土居 +カラツマ 唐津麻 +カラツマ 唐妻 +カラツヤ 唐津屋 +カラツヤ 唐津谷 +カラト 唐渡 +カラト 唐戸 +カラト 唐土 +カラト 柄戸 +カラト 嘉良戸 +カラト 唐登 +カラト 唐櫃 +カラド 唐土 +カラトシマ 唐戸嶋 +カラトジマ 唐戸島 +カラトジマ 唐戸嶋 +カラナガ 唐永 +カラニシキ 唐錦 +カラハシ 唐橋 +カラハタ 唐畑 +カラバヤシ 唐林 +カラハラ 唐原 +ガラハラ 柄原 +カラヒ 唐樋 +カラフ 唐婦 +カラフジ 唐藤 +カラホ 唐帆 +カラマツ 唐松 +カラマツ 柄松 +カラミ 唐見 +カラミゾ 柄溝 +カラミヤ 唐宮 +カラムシザワ 葈沢 +カラムシザワ 葈澤 +カラムラ 唐村 +カラメテ 搦手 +カラモト 唐本 +カラモト 唐元 +カラモモ 杏 +カラモン 唐門 +カラヤ 柄谷 +カラヤ 唐谷 +カラヤ 加良谷 +カラヤマ 辛山 +カラヤマ 柄山 +カラヤマ 唐山 +カラリ 加羅利 +カラワタリ 唐渡 +カラワン 唐椀 +カラン 加覧(加覽) +カラン 加蘭 +カラン 荷蘭 +カラン 加欄 +ガラン 加覧(加覽) +ガラン 伽藍 +カリ 雁 +カリ 仮 +カリ 賀利 +カリ 加利 +カリアツマリ 狩集 +カリアツメ 狩集 +カリイ 仮井 +カリイ 狩井 +カリウ 狩生 +カリウ 苅生 +カリウエ 仮上 +カリウダ 刈生田 +カリウチ 刈内 +カリウラ 狩浦 +カリオ 荊尾 +カリオ 苅尾 +カリオ 雁尾 +カリオ 狩尾 +カリオ 鳫尾 +カリガ 刈賀 +カリガネ 雁金(厂金) +カリガネ 鴈金 +カリガネ 鳫金 +カリガネ 刈金 +カリカワ 狩川 +カリカワ 刈川 +カリカワ 加利川 +カリキ 雁木 +カリキ 加力 +カリキタ 苅北 +カリギョウ 狩行 +カリクサ 苅草 +カリクサ 刈草 +カリグチ 狩口 +カリクラ 狩倉 +カリゴウ 狩郷 +カリゴウ 苅郷 +カリゴウ 刈郷 +カリコミ 苅込 +カリコミ 刈込 +カリコメ 苅込 +カリコメ 刈込 +カリコメ 苅米 +カリゴメ 苅込 +カリゴメ 刈込 +カリゴメ 苅米 +カリゴメ 刈米 +カリゴメ 苅籠 +カリゴメ 苅篭 +カリゴメ 仮込 +カリサス 狩佐須 +カリサワ 仮沢 +カリサワ 苅沢 +カリサワ 苅澤 +カリサワ 仮澤 +カリシキ 刈敷 +カリシキヤマ 苅敷山 +カリシゲ 仮重(假重) +カリシタ 狩下 +カリシャ 苅舎 +カリシュウ 狩集 +カリシュク 苅宿 +カリシュク 刈宿 +カリジュク 狩宿 +カリジュク 仮宿 +カリジュク 假宿 +カリズミ 苅住 +カリズミ 雁住 +カリセ 雁瀬 +カリソコ 苅底 +カリソコ 狩底 +カリゾノ 仮薗 +カリタ 苅田 +カリタ 刈田 +カリタ 狩田 +カリタ 仮田 +カリタ 茢田 +カリタ 荊田 +カリタニ 苅谷 +カリタニ 刈谷 +カリタニ 狩谷 +カリタニ 仮谷 +カリタニ 假谷 +カリツカ 狩塚 +カリヅカ 狩塚 +カリト 狩戸 +カリト 仮戸 +カリドコロ 狩所 +カリナ 仮名 +カリナガ 狩長 +カリノ 狩野 +カリノ 苅野 +カリノ 仮野 +カリノ 雁野 +カリノ 鴈野 +カリノ 假野 +カリノ 刈野 +カリバ 狩場 +カリバ 苅場 +カリハギ 苅蘒 +カリハタ 雁畑 +カリハタ 仮畠 +カリハタ 刈畑 +カリハタ 苅端 +カリハタ 苅畑 +カリハナ 芟花 +カリバヤシ 雁林 +カリバヤシ 鳫林(鴈林) +カリハラ 狩原 +カリヒラ 雁平 +カリヒラ 鴈平 +カリベ 苅部 +カリベ 雁部 +カリベ 刈部 +カリベ 加利部 +カリマ 刈間 +カリマイ 苅米 +カリマイ 刈米 +カリマザワ 苅間沢 +カリマザワ 刈間澤 +カリマザワ 苅間澤 +カリマタ 狩俣 +カリマタ 狩又 +カリマタ 苅又 +カリマタ 雁俣 +カリマタ 狩股 +カリミズ 仮水 +カリミズ 假水 +カリミチ 仮道 +カリミネ 狩峰 +カリミネ 狩峯 +カリモ 狩毛 +カリモ 苅茂 +カリモト 狩元 +カリモト 仮元 +カリモト 加里本 +カリモト 刈本 +カリモト 仮本 +カリモト 狩本 +カリモト 鴈本(鳫本) +カリモト 苅元 +カリモリ 狩森 +カリモリ 苅森 +カリヤ 仮屋 +カリヤ 苅谷 +カリヤ 刈谷 +カリヤ 狩谷 +カリヤ 刈屋 +カリヤ 仮谷 +カリヤ 苅屋 +カリヤ 假屋 +カリヤ 狩屋 +カリヤ 仮家 +カリヤ 假谷 +カリヤ 苅家 +カリヤ 雁谷 +カリヤ 加利屋 +カリヤ 假家 +カリヤ 苅矢 +カリヤ 狩矢 +カリヤサキ 仮屋崎 +カリヤザキ 仮屋崎 +カリヤザキ 假屋崎 +カリヤス 苅安 +カリヤス 刈安 +カリヤセ 仮屋瀬(假屋瀬) +カリヤソ 假屋園 +カリヤソノ 仮屋園 +カリヤゾノ 仮屋園 +カリヤゾノ 仮屋薗 +カリヤゾノ 假屋園 +カリヤダ 苅屋田 +カリヤダ 仮屋田 +カリヤダ 刈屋田 +カリヤド 苅宿 +カリヤド 刈宿 +カリヤハラ 仮屋原(假屋原) +カリヤバラ 仮屋原(假屋原) +カリヤバル 仮屋原(假屋原) +カリヤブ 芟薮 +カリヤブ 芟藪 +カリヤマ 狩山 +カリヤマ 苅山 +カリヤマ 仮山 +カリヤマ 刈山 +カリヤヤマ 仮屋山 +カリュウ 狩生 +カリュウ 家柳 +カリュウ 嘉流 +カリュウ 加立 +カリュウ 加竜 +カリュウ 加龍 +カリユキ 雁行 +カリョウ 加良 +カリヨネ 刈米 +カリワ 苅和 +カリワ 苅羽 +カリワ 刈和 +カリワノ 苅和野 +カル 加留 +カルイ 軽井 +カルイエ 狩家 +カルイザワ 軽井沢 +カルイシ 軽石 +カルオ 軽尾(輕尾) +カルカ 芟花 +カルガ 軽賀 +カルガネ 故金 +カルカヤ 刈茅 +カルカヤ 苅萱 +カルキ 軽木(輕木) +ガルグ 雅留宮 +カルコミ 軽込 +カルコメ 軽米 +カルコメ 軽込 +カルゴメ 軽米 +カルサカ 軽坂 +カルサキ 軽崎 +カルサワ 軽沢(輕澤) +カルサワ 軽澤 +カルザワ 軽沢(輕澤) +カルザワ 軽澤 +カルシマ 軽島 +カルタニ 軽谷 +カルト 軽戸 +カルドナ 狩土名 +カルノ 軽野 +カルハカ 軽墓 +カルベ 軽部 +カルベ 苅部 +カルベ 刈部 +カルベ 加留部 +カルベ 苅辺(苅邉) +カルベ 軽辺(輕邉) +カルベ 輕部 +カルベ 苅邊 +カルマイ 軽米 +カルミ 軽海 +カルミ 軽見 +カルモト 軽本 +カルモリ 軽森 +カルモリ 輕森 +カルヤ 軽矢 +カルヤマ 軽山 +カレイ 家令 +カレイ 加冷 +カレカワ 鰈川 +カレガワ 加連川 +カレキ 枯木 +カレサキ 鰈崎 +カレザキ 鰈崎 +カレシバ 枯芝 +カレン 加連 +カレンガワ 加連川 +カロ 家路 +カロ 加路 +カロ 加櫓 +カロウ 家老 +カロウジ 唐牛 +カロウト 加老戸 +カワ 川 +カワ 河 +カワ 河和 +カワ 加羽 +カワ 加和 +カワ 賀羽 +ガワ 側 +カワアイ 河合 +カワアイ 川合 +カワアイ 河相 +カワアイ 川相 +カワアゼ 川畔 +カワアト 川跡 +カワアユ 川鮎 +カワイ 河合 +カワイ 川合 +カワイ 川井 +カワイ 河井 +カワイ 河相 +カワイ 川相 +カワイ 川居 +カワイ 河居 +カワイ 合羽井 +カワイ 河飯 +カワイ 川会(川會) +カワイ 河生 +カワイ 川伊 +カワイ 可愛 +カワイ 河会(河會) +カワイ 皮居 +カワイキョウ 川井京 +カワイケ 川池 +カワイケ 河池 +カワイシ 川石 +カワイシ 河石 +カワイズミ 川泉 +カワイズミ 河泉 +カワイダ 川井田 +カワイダ 河井田 +カワイダ 川合田 +カワイチ 川市 +カワイデ 川出 +カワイヤ 河合屋 +カワイリ 川入 +カワウ 河宇 +カワウエ 川上 +カワウエ 河上 +カワウエ 川植 +カワウジ 河氏 +カワウチ 河内 +カワウチ 川内 +カワウチ 川打 +カワウチザコ 河内迫 +カワウチダ 川内田 +カワウチノ 川内野 +カワウチマル 川内丸 +カワウチマル 河内丸 +カワウチヤ 川内谷 +カワウチヤマ 河内山 +カワウメ 川梅 +カワウラ 川浦 +カワウラ 河浦 +カワウラ 川裏 +カワエ 河合 +カワエ 河江 +カワエ 川江 +カワエ 川栄 +カワエ 川衛(川衞) +カワエ 川会(川會) +カワエ 川恵 +カワエ 川榮 +カワエイ 川栄 +カワエダ 川枝 +カワエダ 河枝 +カワオ 川尾 +カワオ 河尾 +カワオイ 川生 +カワオカ 川岡 +カワオカ 河岡 +カワオカ 川丘 +カワオキ 河沖 +カワオク 河奥 +カワオク 川奥 +カワオト 川音 +カワオト 河音 +カワオモ 川面 +カワカ 河賀 +カワガ 河賀 +カワガ 川賀 +カワガイ 河貝 +カワガエ 河替 +カワガキ 川垣 +カワカゲ 川影 +カワカサ 河笠 +カワガシラ 川頭 +カワカゼ 川風 +カワカタ 河方 +カワカタ 川方 +カワカタ 川片 +カワガタ 川方 +カワガタ 川潟 +カワガタ 河形 +カワガタ 川形 +カワガタ 河潟 +カワガタ 河瀉 +カワガタ 川泻 +カワカツ 川勝 +カワカツ 河勝 +カワカツ 河釆 +カワカド 川角 +カワカド 河角 +カワカド 川門 +カワカド 河門 +カワカネ 河金 +カワカネ 川金 +カワカベ 川壁 +カワカミ 川上 +カワカミ 河上 +カワカミ 川神 +カワカミ 加輪上 +カワカミ 河神 +カワカミヤ 河上屋 +カワキ 川木 +カワキ 河木 +カワキシ 川岸 +カワキシ 河岸 +カワギシ 川岸 +カワギシ 河岸 +カワギシ 川崖 +カワキタ 川北 +カワキタ 河北 +カワキタ 川喜田 +カワキタ 川喜多 +カワキタ 河喜多 +カワキタ 川来(川來) +カワギタ 川北 +カワキド 川木戸 +カワギリ 川桐 +カワギワ 川涯 +カワギワ 川極 +カワギワ 川際 +カワク 川久 +カワク 加涌 +カワク 川九 +カワクス 川楠 +カワクチ 川口 +カワグチ 川口 +カワグチ 河口 +カワグチヤ 川口谷 +カワグチヤ 川口屋 +カワクボ 川久保 +カワクボ 川窪 +カワクボ 河窪 +カワクボ 河久保 +カワクマ 川熊 +カワクモ 河雲 +カワクラ 川倉 +カワクラ 河倉 +カワクリ 河栗 +カワグリ 河栗 +カワケ 河毛 +カワケ 川分 +カワゲ 河毛 +カワコ 川子 +カワコ 川童 +カワコ 川古 +カワゴ 川後 +カワゴ 川吾 +カワゴ 川小 +カワゴイ 川鯉 +カワゴイシ 皮籠石 +カワゴイシ 皮篭石 +カワゴウ 河合 +カワゴウ 川合 +カワゴウ 河郷 +カワゴエ 川越 +カワゴエ 河越 +カワコシ 川越 +カワコシ 河越 +カワコシ 川腰 +カワゴシ 川越 +カワゴシ 河越 +カワゴシ 川腰 +カワゴタ 川後田 +カワコタニ 川古谷 +カワコネ 川小根 +カワゴミ 河込 +カワゴミ 川込 +カワゴメ 河込 +カワゴメ 川込 +カワコヤ 川古谷 +カワコヤ 川小谷 +カワサ 河佐 +カワサ 川佐 +カワザ 川座 +カワサカ 川坂 +カワサカ 川阪 +カワサカ 河坂 +カワザカイ 川堺 +カワサキ 川崎 +カワサキ 河崎 +カワサキ 川嵜 +カワサキ 河嵜 +カワサキ 川先 +カワサキ 河先 +カワサキ 川岬 +カワサキ 川咲 +カワサキ 川埼 +カワサキダ 川崎田 +カワサキヤ 川崎舎 +カワサキヤ 河崎屋 +カワサキヤ 川崎谷 +カワサコ 川迫 +カワサコ 河迫 +カワサト 川里 +カワサト 河里 +カワサト 河郷 +カワザト 川里 +カワサリ 川去 +カワサリタ 川去田 +カワザル 川猿 +カワサワ 川沢 +カワサワ 川澤 +カワザワ 川沢 +カワザワ 川澤 +ガワサワ 蒲沢 +ガワサワ 蒲澤 +ガワザワ 蒲沢 +ガワザワ 蒲澤 +カワジ 川路 +カワジ 川地 +カワジ 河地 +カワジ 河路 +カワジ 川治 +カワジ 河治 +カワジ 河児 +カワシオ 河塩 +カワシキ 川敷 +カワシキ 川舗 +カワシゲ 河重 +カワシゲ 川重 +カワシゲ 川茂 +カワシゲ 河繁 +カワジサコ 川路迫 +カワシタ 川下 +カワシタ 河下 +カワシタ 皮下 +カワシチ 川七 +カワシナ 川品 +カワシノ 川篠 +カワシバ 川柴 +カワシマ 川島 +カワシマ 川嶋 +カワシマ 河島 +カワシマ 河嶋 +カワシマ 川嶌 +カワシマ 河嶌 +カワシマ 革島(革嶋) +カワシマ 川蔦 +カワシマ 川㠀 +カワシマ 鞁島 +カワシマ 鞁嶋 +カワシモ 川下 +カワシモ 川霜 +カワシモ 河霜 +カワジヤマ 川路山 +カワシュクダ 川宿田 +カワショウ 川庄 +カワジョウ 川門 +カワジョウ 川条 +カワジョウ 川條 +カワシリ 川尻 +カワシリ 河尻 +カワジリ 川尻 +カワジリ 河尻 +カワシロ 川代 +カワシロ 川城 +カワシロ 河城 +カワシロ 川白 +カワシロ 河代 +カワシン 川新 +カワス 川須 +カワス 河州 +カワス 河洲 +カワス 川洲 +カワズ 河津 +カワズ 川津 +カワズ 川頭 +カワズ 川洲 +カワズイシ 蛙石 +カワスエ 川末 +カワスエ 河末 +カワスギ 川杉 +カワスギ 河杉 +カワスギ 川椙 +カワスサキ 河須崎 +カワスザキ 河須崎 +カワスジ 川筋 +カワスズキ 川鈴木 +カワスソ 川裾 +カワスソ 河裾 +カワスナ 川砂 +カワズマエ 蛙前 +カワスミ 川澄 +カワスミ 川角 +カワスミ 川住 +カワスミ 河澄 +カワスミ 河角 +カワスミ 川隅 +カワスミ 河住 +カワスミ 河隅 +カワスミ 河済 +カワスミ 河隈 +カワスミ 河濟 +カワスミ 川墨 +カワスミ 川隈 +カワズミ 川澄 +カワズミ 川住 +カワズミ 河澄 +カワズミ 河住 +カワズミ 河済 +カワズミ 河濟 +カワズミ 川済 +カワスミヤ 川須宮 +カワズラ 河面 +カワズル 川水流 +カワズレ 川連 +カワセ 川瀬 +カワセ 河瀬 +カワセ 河妹 +カワセ 川勢 +カワゼ 川瀬 +ガワセ 側瀬 +カワセキ 川堰 +カワセキ 川関 +カワセキ 川瀬木 +カワセギ 川堰 +カワセツ 川節 +カワセリ 川芹 +カワソ 川曽 +カワソイ 河添 +カワゾイ 川添 +カワソエ 川添 +カワソエ 川副 +カワソエ 河添 +カワソエ 河副 +カワゾエ 川添 +カワゾエ 川副 +カワゾエ 河添 +カワゾエ 河副 +カワゾエ 川沿 +カワソコ 川底 +カワソコ 河底 +カワゾコ 川底 +カワゾコ 河底 +カワソト 川外 +カワソメ 川染 +カワゾメ 川染 +カワゾメ 河染 +カワソラ 川空 +カワゾラ 川空 +カワタ 川田 +カワタ 河田 +カワタ 波田 +カワタ 川和田 +カワタ 川多 +カワタ 河太 +カワタ 川太 +カワタ 側田 +カワタ 皮田 +カワダ 川田 +カワダ 河田 +カワダ 川和田 +カワダイ 川代 +カワタカ 川高 +カワタカ 河高 +カワタキ 川滝 +カワタキ 川瀧 +カワタケ 川竹 +カワタケ 河竹 +カワタケ 川武 +カワタケ 川長 +カワタケ 川岳 +カワタシロ 川田代 +カワタチ 川立 +カワタチ 川建 +カワタツ 川立 +カワタツ 川辰 +カワダツ 川達 +カワタテ 川建 +カワダテ 川立 +カワダテ 川建 +カワタナ 川棚 +カワタニ 川谷 +カワタニ 河谷 +カワタハラ 川田原 +カワダハラ 川田原 +カワタリ 加渡 +カワタリ 川渡 +カワチ 河内 +カワチ 川内 +カワチ 川地 +カワチ 河地 +カワチ 河知 +カワチ 河池 +カワチ 河智 +カワチ 嘉和知 +カワチ 川知 +カワチ 川智 +カワチ 嘉和地 +カワチ 皮地 +カワヂ 川地 +カワヂ 河地 +カワチカ 川近 +カワチカ 河近 +カワチダ 河千田 +カワチダ 河内田 +カワチダニ 河内谷 +カワチノ 川内野 +カワチノ 河内野 +カワチノ 河内埜 +カワチマル 川内丸 +カワチヤ 川内谷 +カワチヤ 河内谷 +カワチヤ 河内屋 +カワチヤマ 河内山 +カワツ 河津 +カワツ 川津 +カワツ 川通 +カワヅ 河津 +カワヅ 川津 +カワヅ 川図 +カワツカ 河塚 +カワツカ 川塚 +カワヅカ 川柄 +カワツキ 河月 +カワツキ 川月 +カワツキ 川附 +カワツキ 川付 +カワツグ 川次 +カワツジ 川辻 +カワツジ 河辻 +カワヅツミ 川堤 +カワツナ 川綱 +カワツハラ 川津原 +カワツマ 川妻 +カワヅマ 川妻 +カワヅマ 河妻 +カワツラ 川面 +カワツラ 川連 +カワツラ 河連 +カワヅラ 川面 +カワヅラ 河面 +カワヅラ 河連 +カワツリ 川釣 +カワツル 川鶴 +カワヅル 川鶴 +カワツレ 川連 +カワヅレ 川連 +カワヅレ 河連 +カワテ 川手 +カワテ 河手 +カワデ 川手 +カワデ 川出 +カワデ 河手 +カワデ 河出 +カワテイ 川廷 +カワト 川戸 +カワト 川人 +カワト 河戸 +カワト 川渡 +カワト 川登 +カワト 河登 +カワト 川外 +カワド 川戸 +カワド 河戸 +カワド 川土 +カワトイ 川樋 +カワドイ 川土居 +カワトウ 川東 +カワトウ 河東 +カワトウ 川藤 +カワトウ 河藤 +カワトウ 川等 +カワトウ 川当(川當) +カワドウマエ 河道前 +カワトク 河徳 +カワトグチ 川戸口 +カワトコ 川床 +カワトコ 河床 +カワトビ 川飛 +カワドボラ 川戸洞 +カワトミ 川富 +カワトミ 川冨 +カワトミ 河富 +カワトミチ 川戸道 +カワドメ 川留 +カワトラ 川寅 +カワトリ 川取 +カワナ 川名 +カワナ 河名 +カワナ 川奈 +カワナ 河奈 +カワナ 川那 +カワナ 河菜 +カワナカ 川中 +カワナカ 河中 +カワナカ 河仲 +カワナカ 川仲 +カワナガ 川永 +カワナガ 河永 +カワナカコ 川中子 +カワナカシマ 川中島 +カワナカジマ 川中島 +カワナカジマ 川中嶋 +カワナコ 川那子 +カワナゴ 川中子 +カワナゴ 川那子 +カワナゴ 川名子 +カワナツ 川夏 +カワナノ 川奈野 +カワナベ 川辺 +カワナベ 河辺 +カワナベ 川鍋 +カワナベ 川邊 +カワナベ 川那辺(川那邉) +カワナベ 河邊 +カワナベ 川邉 +カワナベ 河鍋 +カワナベ 河邉 +カワナベ 川那部 +カワナベ 川奈部 +カワナベ 川名部 +カワナベ 河那辺 +カワナベ 河奈辺 +カワナベ 河那部 +カワナベ 川奈辺 +カワナベ 川那邊 +カワナミ 川浪 +カワナミ 河南 +カワナミ 川波 +カワナミ 川南 +カワナミ 川並 +カワナミ 河波 +カワナミ 河浪 +カワナミ 河並 +カワナリ 川成 +カワナリ 河成 +カワニ 川仁 +カワニ 河二 +カワニシ 川西 +カワニシ 河西 +カワヌタニ 河奴谷 +カワヌマ 川沼 +カワヌマ 河沼 +カワネ 川根 +カワネ 河根 +カワネ 河音 +カワノ 河野 +カワノ 川野 +カワノ 河埜 +カワノ 川埜 +カワノ 河納 +カワノ 川𡌛 +カワノ 皮野 +カワノウエ 川上 +カワノウエ 川ノ上 +カワノウエ 川之上 +カワノウエ 川野上 +カワノウチ 河之内 +カワノウチ 河野内 +カワノウチ 川之内 +カワノエ 川之江 +カワノガ 川野賀 +カワノガタ 河之形 +カワノカミ 川ノ上 +カワノカミ 川之上 +カワノクチ 川ノ口 +カワノクチ 河野口 +カワノグチ 川ノ口 +カワノグチ 河野口 +カワノセ 河野瀬 +カワノナ 川野名 +カワノハラ 川野原 +カワノブ 川延 +カワノブ 河信 +カワノブ 川信 +カワノベ 川野辺 +カワノベ 河野辺 +カワノベ 川延 +カワノベ 川述 +カワノベ 川之辺(川之邉) +カワノベ 川ノ辺 +カワノベ 川野部 +カワノベ 川野邊 +カワノベ 河之辺 +カワノベ 川野邉 +カワノベ 河野邊 +カワノベ 河野邉 +カワノベ 川ノ邊 +カワノベ 川ノ邉 +カワノベ 川逑 +カワノボリ 川登 +カワノメ 川野目 +カワノモト 川野元 +カワノヤ 川野谷 +カワノヤ 河野谷 +カワノリ 川乗 +カワノリ 川乘 +カワノワ 川野輪 +カワバ 川場 +カワバ 河場 +カワバ 川塲 +カワハケ 川端下 +カワハサ 川挾 +カワハシ 川端 +カワハシ 川橋 +カワハシ 河橋 +カワハタ 川端 +カワハタ 川畑 +カワハタ 河端 +カワハタ 川幡 +カワハタ 河畑 +カワハタ 川畠 +カワハタ 河鰭 +カワハタ 川羽田 +カワハタ 河畠 +カワハタ 川溿 +カワハタ 川鰭 +カワハタ 川旗 +カワハタ 川籏 +カワハタ 川波多 +カワバタ 川端 +カワバタ 川畑 +カワバタ 河端 +カワバタ 川幡 +カワバタ 河畑 +カワバタ 川畠 +カワバタ 河俣 +カワバタ 河鰭 +カワバタ 川羽田 +カワバタ 河畠 +カワバタ 川溿 +カワバタ 川鰭 +カワバタ 川旗 +カワバタ 河鮱 +カワバタ 河幡 +カワバタケ 河畑 +カワバタケ 川畠 +カワバタケ 河畠 +カワハツ 川初 +カワハバ 川幅 +カワハマ 川浜 +カワハマ 河浜(河濱) +カワハマ 川濱 +カワバヤシ 川林 +カワバヤシ 河林 +カワハラ 川原 +カワハラ 河原 +ガワハラ 側原 +カワハライ 川原井 +カワハライケ 河原池 +カワハラカミ 川原上 +カワハラギ 河原木 +カワハラグチ 川原口 +カワハラサキ 河原崎 +カワハラサキ 川原崎 +カワハラザキ 河原崎 +カワハラザキ 川原崎 +カワハラジョウ 河原条 +カワハラソノ 川原園 +カワハラゾノ 川原園 +カワハラタ 川原田 +カワハラダ 川原田 +カワハラダ 河原田 +カワハラタニ 川原谷 +カワハラツカ 河原塚 +カワハラヅカ 河原塚 +カワハラヅカ 川原塚 +カワハラバ 川原場 +カワハラバ 河原場 +カワハラバシ 河原橋 +カワハラバシ 川原橋 +カワハラバタ 河原畑 +カワハラバヤシ 河原林 +カワハラバヤシ 川原林 +カワハラミチ 川原道 +カワハラムラ 川原村 +カワハラヤ 川原谷 +カワハラヤマ 川原山 +カワビ 河備 +カワヒガシ 川東 +カワヒガシ 河東 +カワビキ 河引 +カワヒサ 川久 +カワヒサ 河久 +カワヒト 川人 +カワヒト 河人 +カワヒラ 川平 +カワヒラ 河平 +カワビラキ 川開 +カワヒレ 川鰭 +カワヒロ 川広 +カワヒロ 川廣 +カワブ 川生 +カワフク 川福 +カワブクロ 川袋 +カワフジ 川藤 +カワフジ 河藤 +カワフチ 川渕 +カワフチ 川淵 +カワフチ 河淵 +カワブチ 川渕 +カワブチ 川淵 +カワブチ 河渕 +カワブチ 川縁 +カワブチ 河淵 +カワフネ 川船 +カワフネ 川舩 +カワフネ 川舟 +カワベ 川辺 +カワベ 河辺 +カワベ 川部 +カワベ 河部 +カワベ 川邊 +カワベ 河邊 +カワベ 川邉 +カワベ 河邉 +カワベタ 川辺田(川邊田) +カワベヤ 川部谷 +カワベリ 川縁 +カワベリ 河縁 +カワホ 川保 +カワホリ 川堀 +カワホリ 河堀 +カワボリ 川堀 +カワマ 川間 +カワマ 河間 +カワマ 皮間 +カワマ 川馬 +カワマエ 川前 +カワマエ 河前 +カワマエダ 河前田 +カワマガリ 川曲 +カワマキ 河牧 +カワマサ 川政 +カワマス 川増 +カワマス 河増 +カワマス 川舛 +カワマス 川桝 +カワマスミ 川真角 +カワマタ 川又 +カワマタ 川俣 +カワマタ 河又 +カワマタ 川股 +カワマタ 川真田 +カワマタ 河俣 +カワマタ 河股 +カワマタ 川亦 +カワマタ 川眞田 +カワマタ 河亦 +カワマタ 川叉 +カワマチ 川町 +カワマツ 川松 +カワマツ 河松 +カワマル 川円 +カワミ 川見 +カワミ 河見 +カワミ 川味 +カワミズ 川水 +カワミズ 河水 +カワミダレ 川乱 +カワミチ 川道 +カワミチ 河道 +カワミチ 川通 +カワミツ 川満(川滿) +カワミツ 川光 +カワミツ 河光 +カワミツ 川密 +カワミツ 川蜜 +カワミドリ 川緑 +カワミナト 川湊 +カワミナミ 河南 +カワミナミ 川南 +カワミナミ 汾陽 +カワミナミ 汾南 +カワミネ 川峯 +カワミネ 川嶺 +カワミネ 川峰 +カワミヤ 川宮 +カワミヤ 河宮 +カワムカイ 川向 +カワムカイ 河向 +カワムカイ 川向井 +カワムカイ 川迎 +カワムカイ 河向井 +カワムカエ 川迎 +カワムキ 川向 +カワムコ 川向 +カワムコウ 川向 +カワムトウ 川武当 +カワムネ 河宗 +カワムラ 川村 +カワムラ 河村 +カワムラ 河邑 +カワムラ 川邑 +カワムラ 河邨 +カワムラ 川邨 +カワムロ 河室 +カワムロ 川室 +カワメ 川目 +カワメ 河目 +カワメン 河面 +カワモ 川面 +カワモ 河面 +カワモ 川茂 +カワモ 川毛 +カワモト 川本 +カワモト 河本 +カワモト 川元 +カワモト 河元 +カワモト 河許 +カワモリ 川森 +カワモリ 河森 +カワモリ 河守 +カワモリ 河盛 +カワモリ 川守 +カワモリ 川盛 +カワモリタ 川守田 +カワモリタ 河守田 +カワモリタ 川森田 +カワモン 川門 +カワモンゼン 河門前 +カワモンゼン 川門前 +カワヤウチ 川谷内 +カワヤギ 檉 +カワヤス 川安 +カワヤチ 川谷内 +カワヤチ 河谷内 +カワヤナギ 川柳 +カワヤナギ 河柳 +カワヤマ 川山 +カワヤマ 河山 +カワユキ 河行 +カワユキ 川行 +カワヨケ 川除 +カワヨケ 河除 +カワヨコ 川横 +カワヨコ 河横 +カワヨシ 川吉 +カワヨシ 川由 +カワヨシ 河吉 +カワヨリ 川寄 +カワラ 川原 +カワラ 河原 +カワラ 川良 +カワラ 瓦 +カワライ 河原井 +カワライ 瓦井 +カワライ 川原井 +カワライチ 河原市 +カワラガキ 川原垣 +カワラカミ 川原上 +カワラカミ 瓦上 +カワラガワ 瓦川 +カワラギ 河原木 +カワラギ 川原木 +カワラギ 瓦木 +カワラグチ 川原口 +カワラグチ 瓦口 +カワラクボ 川原窪 +カワラゴ 川原子 +カワラゴ 河原子 +カワラサキ 河原崎 +カワラサキ 川原崎 +カワラサキ 瓦崎 +カワラサキ 河原埼 +カワラサキ 河原嵜 +カワラサキ 柏原崎 +カワラザキ 河原崎 +カワラザキ 川原崎 +カワラザキ 瓦崎 +カワラジ 河原地 +カワラジョウ 河原條 +カワラタ 川原田 +カワラタ 河原田 +カワラダ 川原田 +カワラダ 河原田 +カワラダ 瓦田 +カワラタニ 瓦谷 +カワラダニ 瓦谷 +カワラヅカ 河原塚 +カワラヅカ 川原塚 +カワラデ 川原出 +カワラナ 川原名 +カワラノ 瓦野 +カワラバ 川原場 +カワラバ 河原場 +カワラバシ 河原橋 +カワラハタ 川原畑 +カワラバタ 河原畑 +カワラバタ 川原畑 +カワラバヤシ 河原林 +カワラバヤシ 瓦林 +カワラバヤシ 川原林 +カワラブキ 瓦吹 +カワラブキ 川原吹 +カワラブキ 瓦葺 +カワラマ 瓦間 +カワラメ 河原女 +カワラモト 瓦本 +カワラヤ 瓦谷 +カワラヤ 川原谷 +カワラヤ 瓦家 +カワラヤ 瓦屋 +カワラヤキ 瓦焼 +カワラヤマ 河原山 +カワリ 川里 +カワリュウ 河流 +カワリュウ 川龍 +カワリュウ 川竜 +カワワ 川和 +カワワ 河和 +カワワ 川勾 +カワワ 河輪 +カワワ 川匂 +カワワキ 川脇 +カワワキ 河脇 +カワワケ 川分 +カワワケ 河分 +カワワタ 川和田 +カワワタ 河和田 +カワワダ 川和田 +カワワタリ 川渡 +カワンド 川人 +カン 菅 +カン 神 +カン 管 +カン 貫 +カン 漢 +カン 閑 +カン 簡 +カン 寒 +カン 幹 +カン 官 +カン 観 +カン 加運 +カン 勘 +ガン 鳫 +ガン 鴈 +カンエイ 寛永 +ガンエイ 願永 +カンエキ 歓益 +カンオ 神尾 +カンオ 官尾 +カンオウ 神応 +カンオウ 感応 +カンオウ 寛応 +カンオウ 寛應 +カンオウ 感應 +カンオウ 神應 +カンオウジ 感王寺 +カンオク 勘奥 +カンオン 観音 +カンオンジ 観音寺 +カンオンドウ 観音堂 +カンカイ 観海 +カンガイ 甲谷 +ガンカイ 願海 +カンガエ 考 +カンカク 勘角 +カンガク 勧学 +カンカケ 欠掛 +ガンカネ 鳫金 +カンカワ 寒川 +カンカワ 菅川 +カンカワ 寒河 +カンカワ 漢川 +カンガワ 寒川 +カンガワ 神川 +カンガワ 勘川 +ガンガワラ 雁川原 +カンキ 神吉 +カンキ 神木 +カンキ 神城 +カンキ 勘木 +カンキ 歓喜 +カンキ 寛紀 +カンキ 管木 +カンキ 寒木 +カンキ 観木 +カンキ 閑喜 +カンギ 貫木 +ガンキ 雁木 +ガンギ 雁木 +ガンギ 厂木 +カンギュウ 簡牛 +カンギュウ 貫牛 +カンギョウ 神行 +カンギョウ 観行 +カンギョク 甘玉 +カング 菅具 +カンクボ 勘久保 +カンクラ 完倉 +カンクラ 寒倉 +カンケ 菅家 +カンケ 管家 +カンケ 勘家 +カンケ 館家 +ガンケ 願化 +カンゲツ 観月 +カンコ 閑古 +カンコ 神古 +ガンコ 雁子 +ガンコ 鳫子 +カンコウ 鑑江 +カンコウ 神向 +カンコウ 寒香 +カンゴウ 寒河 +ガンコウ 雁行 +カンコウジ 観興寺 +ガンコウジ 願興寺 +カンゴオリ 神郡 +カンゴオリ 寒郡 +カンサ 勘佐 +カンサ 神佐 +カンザ 神佐 +カンザ 神座 +カンザ 寛座 +カンザ 勘座 +カンザ 間座 +カンザ 勘左 +ガンサ 元佐 +ガンザ 元座 +ガンザ 眼座 +カンサイ 関西 +カンサイ 閑歳 +カンサイ 勘才 +カンザカ 神坂 +カンザカ 勘坂 +カンサキ 神崎 +カンザキ 神崎 +カンザキ 金崎 +カンザキ 神前 +カンザキ 上崎 +カンザキ 関崎 +カンザキ 菅崎 +カンザキ 間崎(間埼・間嵜) +カンザキ 門崎 +カンザキ 神先 +カンザキ 神嵜 +カンザキ 甘崎 +カンザキ 勘崎 +カンザキ 官崎 +カンザキ 歓崎 +カンザキ 冠崎 +カンザキ 管崎 +カンザキ 閑崎 +カンザキ 神向 +カンザキ 神埼 +カンザキ 寒崎 +カンザキ 観崎 +カンザキ 歡崎 +カンザキ 觀崎 +カンザキタニ 神崎谷 +カンサク 神作 +カンサク 寒作 +カンサコ 間佐古 +カンサコ 間左古 +カンザコ 勘迫 +カンザト 神里 +カンザト 勘里 +カンザワ 神沢 +カンザワ 神澤 +カンザワ 蒲沢 +カンザワ 寒沢 +カンザワ 蒲澤 +カンザワ 官沢 +カンザワ 管沢 +カンザワ 虷沢 +カンザワ 寒澤 +カンザワ 勘沢 +カンザワ 管澤 +カンザワ 勘澤 +カンザワ 官澤 +カンザワ 虷澤 +ガンザワ 岸澤 +ガンザワ 雁沢 +ガンザワ 雁澤 +ガンザワ 鴈沢 +ガンザワ 鴈澤 +カンザン 完山 +カンシ 勧師 +カンシ 関子 +カンジ 神路 +カンジ 神治 +カンジ 神字 +カンジ 官治 +カンジ 観寺 +カンジキ 神喰 +ガンジキ 雁食 +カンジキダ 橇田 +カンシゲ 菅重 +カンシチ 勘七 +ガンジツダ 元日田 +カンジマ 寛島(寛嶋) +カンジマ 勘島 +カンシャ 甘蔗 +カンシャ 看舎 +カンシャ 間舎 +カンシャ 閑社 +カンシャ 苷蔗 +カンジャ 神社 +カンジャ 神舎 +カンジャ 冠者 +カンジャ 上舎 +カンジャ 勘舎 +カンジャ 甘庶 +カンジャ 間邪 +カンジャ 神者 +カンジャ 上社 +カンジャ 神蛇 +カンジャ 寒者 +カンジャ 勘者 +カンジャ 閑者 +カンジヤ 貫地谷 +カンジヤ 閑治谷 +カンショ 神所 +カンジョ 神所 +カンジョウ 神定 +カンジョウ 勘定 +カンジョウ 貫上 +カンジョウ 閑上 +カンジョウ 完城 +カンジョウ 官上 +カンジョウ 観城 +カンジョウ 貫定 +カンジョウ 閑定 +カンジョウ 欠上 +ガンジョウ 岸城 +ガンジョウ 願城 +ガンジョウ 元浄 +ガンジョウジ 願成寺 +ガンジョウジ 願城寺 +カンジン 勘甚 +カンズ 勘図 +カンスイ 寒水 +カンズイ 澗随 +カンズイ 澗隨 +カンゼ 観世 +ガンセ 雁瀬 +カンセイ 閑製 +カンセキ 勧夕(勸夕) +ガンゼキ 眼関 +カンセン 甘泉 +カンゾウ 神蔵 +カンゾウ 神藏 +カンゾウ 勘造 +カンゾノ 神園 +カンタ 神田 +カンタ 菅田 +カンタ 勘田 +カンダ 上田 +カンダ 神田 +カンダ 菅田 +カンダ 苅田 +カンダ 勘田 +カンダ 甘田 +カンダ 貫田 +カンダ 管田 +カンダ 閑田 +カンダ 寒田 +カンダ 完田 +カンダ 観田 +カンダ 寛田 +カンダ 官田 +カンダ 閑陀 +カンダ 諌田 +カンダ 還田 +カンダ 坎田 +カンダ 簡田 +カンダ 神多 +カンダ 觀田 +カンダ 諫田 +ガンダ 雁田 +ガンダ 鴈田 +カンダイ 官代 +カンダイ 勘代 +カンダイ 貫代 +カンダカ 神高 +カンダグチ 勘田口 +カンタケ 寒竹 +カンダチ 上道 +カンダチ 神立 +カンダチ 神達(神逹) +カンダツ 神立 +カンダツ 神達(神逹) +カンダテ 神立 +カンタニ 神谷 +カンタニ 間谷 +カンタニ 閑谷 +カンタニ 官谷 +カンタニ 柑谷 +カンタニ 寒谷 +カンタニ 寛谷 +カンダニ 神谷 +カンダニ 蟹谷 +カンダバシ 神田橋 +カンダバシ 上田橋 +カンダバヤシ 神田林 +カンダン 上段 +カンチ 神地 +カンチ 冠地 +カンチ 閑地 +カンチ 寒地 +カンチカ 菅近 +カンチク 寒竹 +ガンチク 巌築 +ガンチク 巖築 +カンチョウ 寒長 +カンチョウ 寛長 +ガンチョウ 雁長 +ガンヅ 雁津 +カンヅカ 完塚 +ガンヅカ 元塚 +カンヅクリ 寒作 +カンデ 神出 +カンデ 寒出 +カンデン 勘伝(勘傳) +カント 神戸 +カント 貫戸 +カント 完戸 +カント 菅戸 +カント 閑戸 +カント 金礪 +カント 肝登 +カンド 神戸 +カンド 神門 +カンド 漢人 +カンド 完戸 +カンド 菅土 +カントウ 神藤 +カントウ 上東 +カントウ 菅藤 +カントウ 関東 +カントウ 神頭 +カントウ 管藤 +カントウ 勘藤 +カントウ 神東 +カントウ 菅頭 +カントウ 寛藤 +カントウ 考藤 +カントウ 漢東 +カントウ 甘東 +カントウ 管東 +カントウ 還藤 +カントウ 菅籐 +カンドウ 神藤 +カンドウ 菅藤 +カンドウ 貫洞 +カンドウ 管藤 +カンドウ 勘藤 +カンドウ 観堂(觀堂) +カンドウ 寒藤 +カンドウ 甘道 +ガンドウ 丸藤 +ガンドウ 雁藤 +ガンドウ 巌洞 +ガンドウ 巖洞 +カントウヤ 関東屋 +カントウヤ 関東谷 +カンドコ 神床 +カンドリ 香取 +カンドリ 神鳥 +カンドリ 神取 +カンドリ 金取 +カンドリ 寒鳥 +カンドリ 簡鳥 +カンナ 漢那 +カンナ 神名 +カンナ 神南 +カンナ 鉄穴 +カンナ 神奈 +カンナ 鉙 +カンナ 勘那 +カンナ 喚阿 +カンナ 鐵穴 +カンナ 鐡穴 +カンナイ 神内 +カンナウチ 鉙内 +カンナエ 金苗 +カンナカ 甘中 +カンナカ 官中 +カンナガ 金長 +カンナガワ 鉙川 +カンナギ 神奈木 +カンナグチ 鉄穴口 +カンナベ 間鍋 +カンナベ 上鍋 +カンナミ 神波 +カンナミ 神南 +カンナミ 神並 +カンナミ 神浪 +カンナミ 寛那見 +カンナミ 甘南備 +カンナミ 官浪 +カンナミ 管浪 +カンナモリ 鉄穴森 +カンナリ 金成 +カンナリ 神成 +カンナリ 管成 +カンナン 河南 +カンナン 神南 +カンナン 甘南 +ガンニチダ 元日田 +カンニョ 勘如 +ガンニョ 元女 +ガンニョ 元如 +カンヌキ 環貫 +カンヌキ 関貫 +カンヌキ 閂 +カンヌシ 神主 +ガンヌシ 願主 +カンネン 閑念 +ガンネン 願念 +ガンネン 顔念 +カンノ 菅野 +カンノ 神野 +カンノ 管野 +カンノ 神農 +カンノ 金納 +カンノ 神納 +カンノ 閑野 +カンノ 官野 +カンノ 冠野 +カンノ 貫野 +カンノ 神能 +カンノ 神埜 +カンノ 簡野 +カンノ 観野 +カンノ 官能 +カンノ 菅能 +カンノ 乾野 +カンノ 寛野 +カンノ 勘野 +カンノ 勧野 +カンノ 菅納 +カンノ 環野 +カンノ 勘納 +カンノ 寒野 +カンノ 勧農 +カンノ 神呪 +カンノ 勘𡌛 +カンノ 完野 +カンノ 漢野 +カンノ 環乃 +カンノ 勸野 +ガンノ 鳫野 +ガンノ 雁野 +ガンノ 鴈野 +ガンノ 願野 +カンノウ 神農 +カンノウ 金納 +カンノウ 神納 +カンノウ 神能 +カンノウ 官能 +カンノウ 菅能 +カンノウ 神応 +カンノウ 菅納 +カンノウ 勘納 +カンノウ 感応 +カンノウ 閑納 +カンノウ 感應 +カンノウ 管納 +カンノウ 管能 +カンノウ 神應 +ガンノウ 願能 +カンノウジ 感王寺 +カンノウジ 感応寺(感應寺) +カンノオ 神尾 +カンノキ 関軒 +カンノト 神野藤 +カンノトウ 神野藤 +カンノン 観音 +カンノンジ 観音寺 +カンノンジ 觀音寺 +カンノンドウ 観音堂 +カンノンバヤシ 観音林 +カンバ 干場 +カンバ 蒲 +カンバ 神馬 +カンバ 神庭 +カンバ 神場 +カンバ 勘場 +カンバ 神波 +カンバ 上場 +カンバ 樺 +カンバ 椛 +カンバ 神羽 +カンバ 寒葉 +カンバ 勘塲 +カンバ 神葉 +カンパ 寒波 +カンバイ 寒梅 +カンバイ 官梅 +カンバシ 上橋 +カンバシ 神橋 +カンバシ 芳 +カンバシ 神箸 +カンバセ 勘場瀬 +カンバタ 上畑 +カンバタ 上端 +カンバタ 神畠 +カンパチ 神八 +カンハトリ 神服部 +カンババ 上馬場(上馬塲) +カンバヤ 神場矢 +カンバヤシ 上林 +カンバヤシ 神林 +カンバヤシ 寒林 +カンバヤシ 閑林 +カンバヤシ 官林 +カンバヤシ 管林 +カンバヤシ 間林 +カンバヤシ 勘林 +カンバヤシ 鎌林 +ガンバヤシ 雁林 +カンバヤシガワ 上林川 +カンバヤシヤマ 上林山 +カンバラ 菅原 +カンバラ 上原 +カンバラ 神原 +カンバラ 蒲原 +カンバラ 甲原 +カンバラ 鎌原 +カンバラ 勘原 +カンバラ 寒原 +カンバラ 乾原 +カンバラ 貫原 +カンバラ 完原 +カンバラ 監原 +カンバラ 鑑原 +カンバラ 咸原 +ガンバラ 雁原 +ガンバラ 鴈原 +ガンバラ 厂原 +カンバル 上原 +ガンピ 岸皮 +カンビュウ 上別府 +カンヒラ 勘平 +カンビラ 上平 +カンブ 神部 +カンプウ 寒風 +カンプク 官福 +カンベ 神戸 +カンベ 神部 +カンベ 上戸 +カンベ 神辺 +カンベ 上部 +カンベ 上辺(上邉) +カンベ 乾辺 +カンベ 神邊 +カンベ 勘部 +カンベ 官部 +カンベ 神邉 +カンベ 乾邊 +ガンベ 雁部 +カンペイ 勘平 +ガンペイ 鳫平 +ガンペイ 鴈平 +カンベガワ 神戸川 +カンベシヤマ 上林山 +カンベツナワ 上別縄 +カンボ 神保 +カンポ 神保 +カンポ 觀帆 +ガンボ 岸保 +カンポウ 観峰 +ガンポウ 願法 +カンボリ 上堀 +カンボリ 神堀 +カンマ 菅間 +カンマ 合間 +カンマ 神間 +カンマ 勘間 +カンマ 甘麻 +ガンマ 岩間 +ガンマ 欠間 +カンマイ 上舞 +カンマエ 神前 +カンマエ 上前 +カンマキ 上牧 +カンマキ 神牧 +ガンマク 雁幕(鳫幕) +カンマタ 神俣 +カンマチ 上町 +カンマツ 上松 +カンマツ 神松 +カンマツ 寒松 +カンマツセ 上松瀬 +カンマテ 上档 +カンマテ 上檔 +カンマニワ 上馬庭 +カンマル 上丸 +ガンマル 雁丸 +ガンマル 鴈丸 +カンマン 上万 +カンマン 上萬 +カンミ 官見 +カンミ 感見 +カンミ 鹹味 +カンミツ 冠満(冠滿) +カンミツ 神光 +カンミネ 神峰 +カンミネ 神峯 +カンミヤ 上宮 +カンミヤジ 神宮路 +カンミョウ 上明 +ガンミョウ 元明 +カンミョウズ 上名主 +カンム 観無 +カンムラ 上村 +カンムラ 勘村 +カンムラ 冠村 +カンムリ 冠 +カンムリサキ 冠崎 +カンメ 貫目 +カンメ 神目 +カンメイ 貫名 +カンメイ 寛明 +カンメラ 上米良 +カンメラ 勘米良 +カンモ 管毛 +カンモ 菅毛 +ガンモク 眼目 +カンモト 神本 +カンモト 菅本 +カンモト 神元 +カンモト 勘元 +カンモト 完本 +カンモト 閑本 +ガンモト 鴈本(鳫本) +カンモリ 上森 +カンモリ 神森 +カンモリ 神守 +カンモリ 掃守 +カンモン 神門 +カンヤ 神谷 +カンヤ 官谷 +カンヤ 勘屋 +カンヤ 帰家(歸家) +カンヤケ 神宅 +カンヤマ 完山 +カンヤマ 勘山 +カンヤマ 寒山 +カンヤマ 韓山 +カンリ 柬理 +カンリ 柬里 +カンリク 閑陸 +ガンリュウ 丸龍 +ガンリュウ 眼龍 +ガンリュウ 眼竜 +カンリョウ 神涼 +カンリョウ 神凉 +ガンリョウ 丸龍 +ガンリョウ 丸竜 +カンレイ 神例 +カンロ 甘露 +カンロクノ 勘六野 +カンロジ 甘露寺 +キ 紀 +キ 喜 +キ 期 +キ 記 +キ 木 +ギ 義 +キアキ 木明 +キアキ 喜明 +キアケ 木明 +キアミ 木網 +キイ 喜井 +キイ 紀 +キイ 城井 +キイ 紀伊 +キイ 紀井 +キイ 木井 +キイ 記伊 +キイ 記井 +キイ 鬼 +キイ 喜伊 +キイ 貴井 +キイ 木易 +キイエ 木家 +キイカワ 紀伊川 +キイクニ 紀伊国 +キイクニ 紀伊國 +キイクニヤ 紀伊国屋 +キイジキ 木井直 +キイズミ 喜泉 +キイダ 城井田 +キイチ 木一 +キイチ 鬼一 +キイチ 生一 +キイノ 紀伊野 +キイノモト 紀伊埜本 +キイマ 紀伊馬 +キイモト 紀伊元 +キイリ 喜入 +キイレ 喜入 +キイロ 木色 +キウ 喜宇 +キウエ 木上 +キウエ 木植 +キウジ 木氏 +キウチ 木内 +キウチ 城内 +キウチ 喜内 +キウチ 記内 +キウチ 紀内 +キウチ 貴内 +キウナ 喜友名 +キウマ 木馬 +キウミ 黄海 +キウラ 木浦 +キウラ 喜浦 +キウラ 岐浦 +キウラ 木裏 +キウラギ 木浦木 +キウラハラ 木浦原 +キウリ 木売 +キウリ 木賣 +キエ 帰依 +キエイ 木嬰 +キエダ 木枝 +キエツ 喜悦 +キエン 記円(記圓) +キエン 木圓 +キオ 木尾 +キオ 鬼尾 +キオ 喜尾 +ギオ 義尾 +キオイ 鬼追 +キオイ 来生(來生) +キオイ 樹生 +ギオウギ 牛黄耆 +キオカ 木岡 +キオカ 喜岡 +キオカ 紀岡 +キオカ 樹岡 +キオク 木奥 +キオチ 木落 +キオノ 喜尾野 +キオリ 木織 +ギオン 祇園 +ギオン 祗園 +ギオンジ 祇園寺 +ギオンシタ 祇園下 +ギオンダ 祇園田 +ギオンハク 祇園白 +キカ 貴家 +キガ 木賀 +キガ 木我 +キガ 気賀 +キガ 気駕(氣駕) +キガ 喜賀 +キガ 氣賀 +ギカ 儀賀 +ギガ 儀賀 +ギガ 儀俄 +ギガ 儀我 +ギガ 儀峨 +キカイ 鬼海 +キカイ 鬼界 +キカイ 木甲斐 +キガイ 木飼 +キガキ 城垣 +キカク 喜覚 +キカク 喜覺 +キガク 木学 +キガク 木學 +キカゲ 木影 +キカゲ 木陰 +キガサワ 気賀沢 +キガサワ 氣賀澤 +キガサワ 気賀澤 +キガサワ 気加沢 +キガサワ 木賀沢 +キガサワ 木賀澤 +キガサワ 氣賀沢 +キカタ 木方 +キガタ 木方 +キガタ 木賀田 +キガタ 鬼方 +キガタ 木形 +キガタナ 木刀 +キガネ 黄金 +キガネ 木金 +キカマ 木鎌 +キカミ 木上 +キガミ 木上 +キカワ 吉川 +キカワ 木川 +キカワ 城川 +キカワ 紀川 +キカワ 鬼川 +キカワ 木河 +キカワ 黄川 +キカワ 喜川 +キカワ 木皮 +キカワ 鬼河 +キカワ 杞川 +キガワ 木川 +キガワ 城川 +キガワ 紀川 +キガワ 鬼川 +キガワ 木河 +キガワ 黄川 +キガワ 喜川 +キガワ 木皮 +キカワタ 木川田 +キカワダ 木川田 +キカワダ 黄川田 +キカワダ 貴川田 +キカワダ 亀川田 +キガワダ 木川田 +キキ 木岐 +キキ 喜聞 +キギ 木岐 +ギキ 宜喜 +キキカワ 木々川 +キキツ 喜々津 +キキツ 木々津 +キキヅ 喜々津 +キギツ 木々津 +キギデラ 黄木寺 +キキマ 聞間 +キギミ 木公 +ギキュウ 儀久 +ギギュウ 儀久 +キキョウ 桔梗 +キキョウ 木京 +キキョウ 吉経 +キキョウ 喜京 +キキョウ 鬼京 +キキョウタニ 桔梗谷 +キキョウハラ 桔梗原 +キキョウバラ 桔梗原 +キギラ 木々羅 +キギリ 木桐 +キキリクラ 木切倉 +キク 菊 +キク 規矩 +キク 喜久 +キク 木久 +キク 禧久 +キク 橲久 +キグ 木具 +キグ 貴具 +キクアン 菊庵 +キクイ 菊井 +キクイ 菊伊 +キクイ 菊居 +キクイケ 喜久生 +キクイケ 菊久池 +キクイシ 菊石 +キクイチ 菊一 +キクイチ 菊市 +キクイチ 聞一 +キクイチ 規矩一 +キクイナ 菊伊那 +キクイリ 菊入 +キクイレ 菊入 +キクウエ 菊植 +キクウチ 菊内 +キクウラ 菊浦 +キクエ 菊江 +キクエイ 菊栄 +キクエダ 菊枝 +キクオ 菊尾 +キクオオジ 菊大路 +キクオカ 菊岡 +キクオカ 菊丘 +キクオキ 菊沖 +キクガ 菊賀 +キクカイ 菊海 +キクカド 菊角 +キクカワ 菊川 +キクカワ 喜久川 +キクカワ 掬川 +キクカワ 規工川 +キクカワ 菊河 +キクカワ 聴川 +キクカワ 聞川 +キクガワ 菊川 +キクガワ 喜久川 +キクガワ 規工川 +キクキ 菊木 +キクキダ 菊喜田 +キクグチ 菊口 +キクコ 菊子 +キクコ 喜久子 +キクゴロモ 菊衣 +キクサカ 菊坂 +キクサキ 菊崎 +キクサキ 菊先 +キクサキ 菊咲 +キクサキ 菊嵜 +キクザキ 菊崎 +キクザキ 菊埼 +キクザキ 菊嵜 +キクサト 喜久里 +キクサト 菊里 +キクザト 喜久里 +キクザト 菊里 +キクサワ 菊沢 +キクサワ 菊澤 +キクザワ 菊沢 +キクザワ 菊澤 +キクジ 菊次 +キグシ 木串 +キグシ 木櫛 +キクシゲ 菊重 +キクシゲ 菊繁 +キクシタ 菊下 +キクシベ 菊蘂 +キクシマ 菊島 +キクシマ 菊嶋 +キクシマ 菊嶌 +キクジュ 菊寿 +キクジュ 菊壽 +キクシロ 菊城 +キクスイ 菊水 +キクスエ 菊末 +キクズミ 菊住 +キクゾノ 菊園 +キクゾノ 菊薗 +キクタ 菊田 +キクタ 喜久田 +キクタ 菊多 +キクタ 規矩田 +キクタ 菊太 +キクタ 木久田 +キクダ 菊田 +キクダ 喜久田 +キクタカ 菊高 +キクタケ 菊竹 +キクタケ 菊武 +キクタケ 企救岳 +キクタニ 菊谷 +キクタニ 麹谷 +キクタニ 聞谷 +キクタニ 鞠谷 +キクタミ 菊民 +キクチ 菊地 +キクチ 菊池 +キクチ 菊知 +キクチ 菊智 +キクチ 釈氏 +キクチ 規矩智 +キクチ 鬼口 +キクチ 釋氏 +キクチ 喜久知 +キクチ 喜久地 +キクチ 規矩地 +キクチ 規短智 +キクチ 掬池 +キクチ 菊千 +キクチ 麹池 +キグチ 木口 +キグチ 城口 +キクチダ 菊地田 +キクチハラ 菊地原 +キクチバラ 菊地原 +キクチバラ 菊池原 +キグチヤ 木口屋 +キクヅカ 菊塚 +キクツギ 菊次 +キクツギ 菊継 +キクヅキ 菊月 +キクヅキ 掬月 +キクツグ 菊次 +キクツジ 菊辻 +キクヅマ 菊妻 +キクドウ 菊堂 +キクトミ 菊富 +キクトメ 菊留 +キクドメ 菊留 +キクトモ 菊朋 +キクナ 菊名 +キクナカ 菊仲 +キクナカ 菊中 +キクナガ 菊永 +キクナガ 喜久永 +キクナミ 菊波 +キクナミ 菊浪 +キクナミ 聴涛 +キクナミ 聴濤(聽濤) +キクニ 喜国(喜國) +キクニシ 菊西 +キクネ 菊根 +キクノ 菊野 +キクノ 菊農 +キクノ 喜久野 +キクノイ 菊之井 +キクノウ 菊農 +キクハ 菊葉 +キクバ 菊場 +キクハシ 菊橋 +キクハタ 菊畑 +キクハタ 菊畠 +キクハナ 菊華 +キクバヤシ 菊林 +キクハラ 菊原 +キクヒラ 菊平 +キクヒロ 菊広 +キクフジ 菊藤 +キクブチ 菊淵 +キクブチ 菊渕 +キクホ 菊保 +キクボ 鬼窪 +キクマ 菊間 +キクマ 喜久間 +キクマ 喜熊 +キクマ 菊馬 +キグマ 紀熊 +キグマ 鬼熊 +キグマ 木熊 +キクマサ 菊政 +キクマツ 菊松 +キクマル 菊丸 +キクマン 菊万 +キクミ 菊見 +キクミ 菊実 +キクミ 菊美 +キクミ 菊實 +キクミズ 菊水 +キクミツ 菊光 +キクミネ 喜久嶺 +キクミヤ 菊宮 +キクムネ 菊宗 +キクムラ 菊村 +キクムラ 喜久村 +キクモト 菊本 +キクモト 菊元 +キクモト 喜久本 +キクモト 喜久元 +キクモト 木工本 +キクモト 鞠本 +キクモリ 菊森 +キクモリ 菊盛 +キクモリ 喜久盛 +キクモリ 菊守 +キクモリ 聞守 +キクヤ 菊谷 +キクヤ 菊屋 +キクヤ 菊家 +キクヤ 菊矢 +キクヤ 木久家 +キクヤス 菊安 +キクヤマ 菊山 +キクヤマ 喜久山 +キクヤマ 菊巒 +キクヤマ 木久山 +キクヨシ 菊吉 +キクヨシ 菊好 +キクラ 木倉 +キクラ 鬼倉 +キクラク 菊楽 +キグラヤ 木倉谷 +キグリ 木栗 +キグレ 木暮 +キクワ 菊輪 +キクワカ 菊若 +キケイ 亀慶 +キゲウチ 木下内 +キケカワ 亀卦川 +キケガワ 亀卦川 +キケガワ 亀掛川 +キケガワ 亀ケ川 +キケン 奇験 +キコ 喜古 +キコ 木子 +キコ 紀古 +キコ 木古 +キゴ 城後 +キゴ 木子 +キコウ 亀甲 +キコウ 木香 +キコウ 木興 +キゴウ 木郷 +ギコウ 儀光 +キコウシ 木柑子 +キゴオリ 木郡 +キコク 枳穀 +キコク 喜国(喜國) +キコク 扣穀 +キコク 枳殻 +キコシ 木越 +キゴシ 木越 +キゴシ 城越 +キコシタニ 木越谷 +キコジマ 鬼児島 +キコヤ 亀甲谷 +キコリ 樵 +キゴロ 木頃 +キサ 木佐 +キサ 吉佐 +キサ 吉舎 +キサ 喜佐 +キサイ 木済 +キサイ 騎西 +キサイ 木斉(木齊) +キサイ 木濟 +キサイ 喜菜 +キサイ 木斎 +ギザイ 義財 +キサイチ 私市 +キサイチ 木佐一 +キサカ 木坂 +キサカ 木阪 +キサカ 城阪 +キサカ 喜坂 +キサカ 紀坂 +キザカ 木坂 +キザカイ 気境(氣境) +キザカイ 木境 +キサガタ 象潟 +キサガタ 象瀉 +キサカミ 喜左上 +キサカミ 喜佐上 +キサガミ 喜左上 +キサガミ 喜佐上 +キサキ 木崎 +キサキ 鬼崎(鬼嵜) +キサキ 木佐木 +キサキ 木嵜 +キサキ 薪先 +キサキ 喜崎 +キサキ 生咲 +キサキ 木咲 +キサキ 紀先 +キサキ 貴崎 +キサキ 妃 +キサキ 木左木 +キサギ 木鷺 +キザキ 木崎 +キザキ 城崎 +キザキ 鬼崎(鬼嵜) +キザキ 木嵜 +キザキ 岐崎 +キザキ 生崎 +キザキ 喜崎 +キザキ 貴崎 +キサキハラ 木崎原 +キサキバラ 木崎原 +キサキバル 木崎原 +キサク 箕作 +キサク 喜作 +キサク 木作 +キサクボ 舎久保 +キザクラ 生桜 +キサコ 木迫 +キザコ 木迫 +キサジマ 象島 +キサダ 喜佐田 +キサダ 幾左田 +キサダ 木貞 +キサダ 幾佐田 +キサタニ 木佐谷 +キサタニ 木狭谷 +キサト 木里 +キザト 木里 +キサヌキ 木佐貫 +キザハシ 象橋 +ギサブ 儀三武 +キサベ 私部 +キサミ 木佐美 +キサミ 喜佐美 +キサミ 喜佐見 +キザミ 木佐美 +キザミ 喜佐美 +キザミ 喜佐見 +キサモリ 木佐森 +キサヤマ 象山 +キサラ 木皿 +キザラ 木皿 +キサラギ 木皿儀 +キサラギ 如月 +キサラギ 木皿木 +キサラギ 衣更着 +キサラヅ 木更津 +キサワ 鬼沢 +キサワ 鬼澤 +キサワ 木澤 +キザワ 鬼沢 +キザワ 木沢 +キザワ 鬼澤 +キザワ 木澤 +キザワ 喜沢 +キザワ 喜澤 +キサワハタ 木沢畑 +キサワハタ 木澤畑 +キザワハタ 木沢畑 +キサンダ 木三田 +キシ 岸 +キシ 貴志 +キシ 来住 +キシ 木子 +キシ 喜志 +キシ 木志 +キシ 吉仕 +キシ 崖 +キシ 喜始 +キシ 季子 +キシ 喜枝 +キシ 喜子 +キシ 紀氏 +キシ 吉志 +キシ 來住 +キシ 崕 +キシ 喜司 +キシ 幾志 +キシ 紀司 +キシ 鬼子 +キシ 亀師 +キシ 城至 +キシ 木師 +キシ 耒住 +キシ 㟁 +キジ 木地 +キジ 貴治 +キジ 木治 +キジ 木路 +キジ 喜地 +キジ 喜治 +キジ 奇二(竒二) +キジ 貴次 +キジ 木司 +ギシ 義之 +ギシ 宜志 +ギシ 義志 +キシイ 岸井 +キジイ 木次井 +キシウエ 岸上 +キシウジ 岸氏 +キシウチ 岸内 +キシウメ 岸梅 +キシウラ 岸裏 +キシウラ 岸浦 +キシエ 岸江 +キシオ 岸尾 +キシオ 鬼子尾 +キジオ 木地尾 +キジオ 雉尾 +キシオオジ 岸大路 +キシオカ 岸岡 +キジオカ 雉岡 +キシオキ 岸沖 +キシオク 岸奥 +キシガキ 岸垣 +キシガキ 岸柿 +キシカケ 岸懸 +キシカゲ 岸蔭 +キシカミ 岸上 +キシガミ 岸上 +キシカワ 岸川 +キシカワ 基志川 +キシガワ 岸川 +キシキ 吉敷 +キシキ 来生(來生) +キシキ 岸木 +キシギ 岸木 +キシキタ 岸北 +キシク 木鋪 +キシグイ 岸杭 +キシグチ 岸口 +キシグチ 喜志口 +キシグチ 㟁口 +キジクニ 貴地邦 +キシゲ 木茂 +キシゴエ 岸越 +キシザキ 岸崎 +キシサト 岸里 +キシザト 岸里 +キシザワ 岸沢 +キシザワ 岸澤 +キシジ 岸路 +キシジ 岸治 +キシシタ 岸下 +キシジマ 岸島 +キシジマ 岸島 +キシジマ 岸嶋 +キジシマ 雉子島 +キシズミ 岸住 +キシズミ 鬼子角 +キシゾエ 岸添 +キシゾエ 岸副 +キシゾノ 岸園 +キシゾノ 岸薗 +キシタ 木下 +キシタ 岸田 +キシタ 樹下 +キシタ 貴下 +キシタ 喜下 +キシダ 岸田 +キシダ 喜志多 +キシダ 木志田 +キシダ 貴師田 +キシダ 㟁田 +キシダ 喜志田 +キシダイラ 岸平 +キシタカ 岸高 +キシダカ 岸高 +キシタケ 岸武 +キシタテ 岸立 +キシタニ 岸谷 +キジタニ 木地谷 +キジタニ 雉子谷 +キジダニ 雉子谷 +キシツ 岸津 +キシツ 鬼室 +キジツ 木実 +キジツ 其日 +キシヅカ 岸塚 +キシヅチ 岸槌 +キシツル 岸鶴 +キシヅル 岸鶴 +キシド 岸戸 +ギシトミ 宜志富 +キジトリ 雉鳥 +キシナ 岸名 +キシナ 岸菜 +キシナ 木科 +キシナ 岸科 +キシナカ 岸中 +キシナカ 岸仲 +キシナガ 岸永 +キシナガ 喜志永 +キシナダ 岸灘 +キシナミ 岸波 +キシナミ 岸浪 +キシナミ 岸並 +キジナミ 雉子波 +キシナワ 岸縄 +キジヌマ 雉子沼 +キシネ 岸根 +キシネ 木志根 +キシノ 岸野 +キシノ 木住野 +キシノ 来住野(來住野) +キシノ 岸埜 +キシノ 耒住野 +キシノ 㟁野 +キジノ 雉野 +キシノウエ 岸上 +キシノウエ 岸之上 +キシノウエ 岸ノ上 +キシノカミ 岸之上 +キシノガミ 岸之上 +キシノブ 岸信 +キシバ 吉柴 +キシバ 岸場 +キシバ 岸羽 +キシバ 岸塲 +キシバ 木柴 +キシハタ 岸端 +キシハタ 岸畑 +キシバタ 岸端 +キジハナ 雉鼻 +キシハマ 岸浜 +キシバヤシ 岸林 +キシハラ 岸原 +キシハラ 姫氏原 +キシバル 岸原 +キジヒラ 木地平 +キシフサ 岸房 +キシブチ 岸渕 +キシブチ 岸淵 +キシベ 岸部 +キシベ 岸辺 +キシベ 吉志部 +キシベ 岸邊 +キシベ 岸邉 +キシマ 木島 +キシマ 木嶋 +キシマ 貴島 +キシマ 鬼島 +キシマ 来島 +キシマ 喜島 +キシマ 杵島 +キシマ 鬼嶋 +キシマ 貴嶋 +キシマ 岸間 +キシマ 喜嶋 +キシマ 杵嶋 +キシマ 喜志麻 +キジマ 木島 +キジマ 木嶋 +キジマ 貴島 +キジマ 城島 +キジマ 鬼島 +キジマ 来島 +キジマ 喜島 +キジマ 来嶋 +キジマ 槐島 +キジマ 杵島 +キジマ 鬼嶋 +キジマ 貴嶋 +キジマ 喜嶋 +キジマ 城嶋 +キジマ 木嶌 +キジマ 來嶋 +キジマ 黄島 +キジマ 記島 +キジマ 來島 +キジマ 基島 +キジマ 雉島(雉嶋) +キジマ 紀島 +キジマ 鬼嶌 +キジマ 木治間 +キジマ 耒嶋 +キジマ 雉間 +キジマ 雉真 +キシマエ 岸前 +キシマク 岸幕 +キシマタ 岸又 +キシマツ 岸松 +キジマヤ 木嶋谷 +キシマル 岸丸 +キシミ 岸見 +キシミズ 岸水 +キシミツ 岸光 +キジミツ 木地光 +キシミネ 岸峰 +キシミネ 岸峯 +キジムタ 雉子牟田 +キシムネ 岸宗 +キシムラ 岸村 +キジムラ 木地村 +キシモト 岸本 +キシモト 岸元 +キシモト 㟁本 +キシモト 木師本 +キジモト 木地本 +キジモト 雉本 +キシモリ 岸森 +キシモリ 岸守 +キシヤ 岸谷 +キシヤ 岸家 +キシヤ 岸屋 +キジヤ 木次谷 +キジヤ 木地谷 +キジヤ 木治屋 +キシヤナギ 岸柳 +キシャバ 喜舎場(喜舍場・喜舎塲・喜舍塲) +キシヤマ 岸山 +キジヤマ 木地山 +キシュ 寄主 +キシュウ 季秋 +キシュウ 喜洲 +キシュウ 紀州 +キシュウ 紀洲 +キシュウ 記州 +キシュウ 木刕 +キシュウ 木劦 +キジュウ 喜住 +キシュウヤ 紀州谷 +キシュウヤ 紀洲谷 +キシュク 木宿 +ギシュン 宜春 +キショ 城所 +キショウ 喜庄 +キショウ 木性 +キショウ 喜清 +キジョウ 鬼城 +キジョウ 木丈 +ギジョウ 義城 +キジョカ 喜如嘉 +キジョキ 喜如喜 +キシラ 岸良 +キシロ 木城 +キシロ 木代 +キシロ 稀代 +キシロ 喜代 +キシロ 木白 +キシロ 岸代 +キシロ 岐城 +キシワ 岸和 +キシワキ 岸脇 +キシワダ 岸和田 +キシワダタニ 岸和田谷 +キシワダヤ 岸和田谷 +キシンド 岸人 +キス 木須 +キス 金須 +キス 木寿 +キズ 木津 +キズ 吉津 +キズ 岐津 +キスイ 木水 +キスイ 亀水 +キスイ 木須井 +キズイ 木次井 +キスエ 木末 +キズエ 木末 +キズカ 木塚 +キズガワ 木津川 +キスキ 木透 +キスキ 来次(來次) +キスキ 木鋤 +キスギ 来生(來生) +キスギ 木杉 +キスギ 季杉 +キズキ 城 +キズキ 築城 +キズキ 杵築 +キズキ 築 +キズキ 木築 +キズキ 築木 +キズクリ 木造 +キスケ 木鋤 +キスケダ 喜助田 +キズシ 切通 +キズシ 木通 +キズシ 気鮓(氣鮓) +ギスシ 宜寿次 +ギスシ 宜壽次 +ギスジ 宜寿次 +ギスジ 宜壽次 +キスダ 木須田 +キステ 喜捨 +キスナ 来住南 +キズナ 木砂 +キスノ 来住野(來住野) +キスミ 木角 +キスミ 木栖 +キスミ 喜住 +キスミ 木住 +キスミ 糦須海 +キズミ 来住 +キズミ 木角 +キズミ 喜住 +キズミ 木積 +キズミ 木住 +キズミ 耒住 +キズミノ 木住野 +キスモト 紀州本 +キズヤ 木津谷 +キズヤ 喜寿屋(喜壽屋) +キセ 吉瀬 +キセ 喜瀬 +キセ 木瀬 +キセ 黄瀬 +キセ 木勢 +キセ 喜世 +キセ 喜勢 +キセ 貴瀬 +キセ 鬼勢 +キセイ 鬼勢 +キセイ 木清 +キセイ 木生 +キセガワ 喜瀬川 +キセガワ 喜世川 +キセキ 城石 +キセキ 鬼石 +キセキ 幾石 +キセモリ 喜世盛 +キセン 気仙 +キセン 氣仙 +キソ 木曽 +キソ 木曾 +キソイ 競 +キソウ 競 +キソウ 喜早 +キゾウ 喜三 +ギソウ 儀惣 +キゾエ 木添 +キソオ 木曽尾 +キソガワ 木曽川 +キソガワ 木曾川 +キソダ 木曽田 +キソダ 木曾田 +キソタニ 木曽谷 +キソノ 木曾野 +キソノ 木曽野 +キゾノ 木薗 +キソバヤシ 木曽林 +キソハラ 木曽原 +キソハラ 木曾原 +キソヤマ 木曾山 +キソヤマ 木曽山 +キゾン 木薗 +キタ 木田 +キタ 喜多 +キタ 北 +キタ 喜田 +キタ 貴田 +キタ 来田 +キタ 木多 +キタ 記田 +キタ 木太 +キタ 紀太 +キタ 喜夛 +キタ 貴多 +キタ 気多(氣多) +キタ 城多 +キタ 來田 +キタ 貴夛 +キタ 来多 +キタ 坎 +キダ 木田 +キダ 喜多 +キダ 喜田 +キダ 城田 +キダ 貴田 +キダ 来田 +キダ 気田 +キダ 寄田 +キダ 木多 +キダ 紀田 +キダ 黄田 +キダ 義田 +キダ 記田 +キダ 木太 +キダ 紀太 +キダ 鬼田 +キダ 氣田 +キダ 樹田 +キダ 機田 +キダ 耒田 +キダ 城多 +キダ 來田 +キダ 岐田 +キダ 紀國 +キダ 杵多 +ギダ 儀田 +キタアキ 北明 +キタアキ 北秋 +キタアライ 北荒井 +キタアライ 北新居 +キタアラシ 北嵐 +キタイ 北井 +キタイ 鍛代 +キタイ 北居 +キタイ 希代 +キタイ 稀代 +キタイ 鍛 +キタイ 喜多井 +キタイ 北飯 +キタイ 喜多居 +キタイ 記対 +キタイ 鍜代 +キダイ 希代 +キダイ 来代 +キタイウエ 北井上 +キタイケ 北池 +キタイザキ 北井崎 +キタイシ 北石 +キタイズミ 北泉 +キタイソ 北磯 +キタイチ 北市 +キタイチ 北一 +キタイチヤ 北市屋 +キタイデ 北出 +キタイヌイ 北乾 +キタイノウエ 北井上 +キタイワ 北岩 +キタウエ 北上 +キタウエ 北植 +キタウエダ 北上田 +キタウケ 北受 +キタウジ 北氏 +キタウチ 北内 +キタウチ 喜多内 +キタウマ 北馬 +キタウミ 北海 +キタウメ 北梅 +キタウラ 北浦 +キタウラ 北裏 +キタウラ 木多浦 +キタエ 北江 +キタエ 鍛 +キタエ 北恵(北惠) +キタエ 北得 +キタエ 北栄 +キタエ 北榮 +キタエイ 鍛永 +キタエダ 北枝 +キタオ 北尾 +キタオ 喜多尾(喜夛尾) +キタオ 北纓 +キタオ 北緒 +キタオ 北生 +キタオウ 喜多王 +キタオウ 北王 +キタオウ 北桜 +キタオウギ 北扇 +キタオオジ 北大路 +キタオオヤ 北大宅 +キタオカ 北岡 +キタオカ 喜多岡 +キタオカ 貴田岡 +キタオキ 北沖 +キタオキ 北起 +キタオク 北奥(北奧) +キタオク 北億 +キタオチ 北落 +キタオニエ 北鬼江 +キタオネ 北尾根 +キタオリ 北折 +キタオリ 北織 +キタガ 北賀 +キダカ 木高 +キタガイチ 北垣内 +キタガイチ 北ケ市 +キタガイト 北垣内 +キタガイト 北垣戸 +キタガイト 北垣外 +キタガキ 北垣 +キタガキ 北柿 +キタガキウチ 北垣内 +キタカク 北角 +キタガク 北陸 +キタガク 北学 +キタガサキ 北ケ崎 +キタガサキ 北ケ嵜 +キタカジ 北梶 +キタカゼ 北風 +キタカタ 北方 +キタカタ 北片 +キタカタ 喜多方 +キタカタ 北嘉多 +キタガタ 北方 +キタガタ 北潟 +キタガタ 北形 +キタガタ 北瀉 +キタガタヤ 北潟谷 +キタカツ 北勝 +キタカド 北角 +キタカド 北門 +キタカド 北鹿渡 +キタガハラ 北河原 +キタカブ 北株 +キタカマエ 北構 +キタガマエ 北構 +キタカミ 北上 +キタカミ 北神 +キタガミ 北上 +キタガミ 北神 +キタカメ 北亀 +キタカワ 北川 +キタカワ 北河 +キタガワ 北川 +キタガワ 北河 +キタガワ 喜多川(喜夛川) +キタガワ 北側 +キタガワ 木田川 +キタガワ 喜田川 +キタガワ 喜多河(喜夛河) +キタガワ 来川 +キタガワ 耒川 +キタガワチ 北川内 +キタカワハラ 北川原 +キタカワハラ 北河原 +キタカワラ 北河原 +キタガワラ 北川原 +キタガワラ 北河原 +キタキ 北木 +キタキ 木滝 +キタキ 北喜 +キタキ 北来 +キタキ 北基 +キタキ 木瀧 +キタギ 北木 +キタキエ 北鬼江 +キタキザキ 北寄崎 +キタギシ 北岸 +キタキド 北城戸 +キタキミ 北竜 +キタキミ 北龍 +キタギワ 北際 +キタク 木太久 +キタク 昨宅 +キタク 北久 +キタクス 北楠 +キタグチ 北口 +キタグチ 喜多口(喜夛口) +キタクニ 北国 +キタクニ 北國 +キタグニ 北国 +キタグニ 北國 +キタクボ 北久保 +キタクボ 北窪 +キタグマ 北熊 +キタグミ 北組 +キタクラ 北倉 +キタグロ 北黒 +キタケ 木竹 +キタケ 喜竹 +キダケ 城嶽 +キタコ 北子 +キタゴ 北後 +キタゴ 北子 +キタゴウ 北郷 +キタコウジ 北小路 +キタコウチ 北川内 +キタゴオリ 北郡 +キタコガ 北古賀 +キタコシ 北越 +キタゴシ 北越 +キタコミ 北古味 +キタコヤ 北小矢 +キタゴヤ 北小屋 +キタコン 北紺 +キタザ 北座 +キタサカ 北坂 +キタサカ 北阪 +キタサカ 喜多阪 +キタサガミ 北相模 +キタサキ 北崎 +キタザキ 北崎 +キタザキ 喜多崎 +キタザキ 北先 +キタザキ 北嵜 +キタサク 北作 +キタサコ 北迫 +キタサコ 北佐古 +キタサゴ 北砂 +キタザコ 北迫 +キタサト 北里 +キタザト 北郷 +キタザト 北里 +キタサワ 北沢 +キタサワ 北澤 +キタザワ 北沢 +キタザワ 北澤 +キタザワ 喜多沢 +キタザワ 喜多澤 +キタザワ 来沢 +キタジ 北地 +キタジ 北次 +キタジ 北治 +キタジ 北路 +キダシ 木出 +キタシゲ 北重 +キタシタ 北下 +キタシタ 喜多下 +キタシチ 北七 +キタシバ 北芝 +キタシバ 北柴 +キタシマ 北島 +キタシマ 北嶋 +キタシマ 喜多島 +キタシマ 喜多嶋 +キタシマ 北嶌 +キタジマ 北島 +キタジマ 北嶋 +キタジマ 来島 +キタジマ 来嶋 +キタジマ 喜多島 +キタジマ 喜多嶋 +キタジマ 北嶌 +キタジマ 來島 +キタジマ 喜田嶋 +キタジマ 喜夛嶋(喜夛島) +キタシミズ 北清水 +キタジュク 北宿 +キタジョ 北所 +キタショウ 北荘 +キタショウ 北庄 +キタジョウ 北条 +キタジョウ 北條 +キタジョウ 北上 +キタジョウ 北城 +キタジョウ 喜多條 +キタジョウ 喜多条 +キタジョウ 北多條 +キタジョウ 來條 +キタショウジ 北庄司 +キタシラカワ 北白川 +キタジリ 北尻 +キタシロ 北代 +キタシロ 北城 +キタシロ 来代 +キタシロ 喜多代 +キタシロ 北白 +キタシン 北真(北眞) +キタシン 北新 +キタス 喜多須 +キタズ 喜多須 +キタスカ 北須賀 +キタスガ 北須賀 +キタスギ 北杉 +キタスジ 北筋 +キタスミ 北角 +キタスミ 北住 +キタスミ 北隅 +キタズミ 北角 +キタズミ 北住 +キタズミ 北隅 +キタズミ 北澄 +キタズメ 北爪 +キタズメ 北詰 +キタセ 北瀬 +キタセ 北清 +キタセ 北世 +キタセイ 北清 +キタセキ 北関 +キタゾウ 北雑 +キタゾエ 北添 +キタソト 北外 +キタソノ 北園 +キタゾノ 北園 +キタゾノ 北薗 +キタゾノ 北囿 +キタダ 北田 +キタダ 来田 +キタダ 喜多田 +キタダ 耒田 +キタダ 來田 +キタダ 喜タ田 +キタダ 喜夕田 +キタダイ 北代 +キタダイ 来代 +キタダイ 喜多代 +キタダイ 北台 +キタダイ 北田井 +キタダイ 北臺 +キタダイ 來代 +キタダイ 耒代 +キタタカノ 北高野 +キタタキ 北滝 +キタタケ 北竹 +キタタシロ 北田代 +キタダテ 北館 +キタダテ 北舘 +キタダテ 北楯 +キタタニ 北谷 +キタタニ 喜多谷 +キタタニ 木田谷 +キタタニ 北峪 +キタダニ 北谷 +キタダニ 北谿 +キタダン 北檀 +キタチ 木立 +キタチ 北地 +キタヂ 北地 +キダチ 木立 +キダチ 木達 +キタツ 貴達 +キタツカ 北束 +キタツカ 北塚 +キタヅカ 北束 +キタヅカ 北塚 +キタヅカ 北塔 +キタツギ 北次 +キタツグ 北次 +キタツジ 北辻 +キタツジ 北逵 +キタツボ 北坪 +キタツメ 北爪 +キタツメ 北詰 +キタヅメ 北爪 +キタヅメ 北詰 +キタヅメ 北瓜 +キタヅメ 北誥 +キタヅメ 喜多詰 +キタツル 北津留 +キタツル 北鶴 +キタヅル 北鶴 +キタデ 北出 +キダテ 木建 +キダテ 木舘 +キダテ 木館 +キタデヤ 北出谷 +キタデラ 北寺 +キタド 北戸 +キタドイ 北土井 +キタドウ 北堂 +キタトウベ 北東部 +キタトキ 北時 +キタトコ 北床 +キタドコロ 北所 +キタトチ 北栃 +キタドノ 北殿 +キタドマリ 北泊 +キタトミ 北富 +キタトミ 北冨 +キタドメ 北留 +キタトモ 北友 +キタトラ 北虎 +キタナ 北名 +キダナ 木棚 +キタナカ 北中 +キタナカ 北仲 +キタナカ 喜多仲(喜夛仲) +キタナガ 北永 +キタナガ 北長 +キタナミ 北波 +キタナミ 北浪 +キタナル 北鳴 +キタニ 木谷 +キタニ 気谷 +キタニ 喜谷 +キタニ 貴谷 +キタニ 氣谷 +キタニ 記谷 +キタニ 樹谷 +キタニ 木渓(木溪) +キタニ 来谷(耒谷) +キダニ 木谷 +キダニ 気谷 +キダニ 喜谷 +キダニ 氣谷 +ギタニ 儀谷 +キタニイ 北新居 +キタニシ 北西 +キタニシ 喜多西 +キタヌマ 北沼 +キタネ 北根 +キタネ 喜種 +キタネ 木種 +キダネ 喜種 +キダネ 木種 +キタノ 北野 +キタノ 北埜 +キタノ 喜多野 +キタノ 北濃 +キタノ 北農 +キタノ 喜多埜 +キタノ 喜多濃 +キタノ 北能 +キタノ 貴多野 +キタノ 北之 +キタノ 来野 +キタノ 北生 +キタノ 來 +キタノ 喜夛野 +キタノ 北𡌛 +キタノイ 北野井 +キタノウ 北濃 +キタノウ 北農 +キタノウエ 北之上 +キタノウエ 北野上 +キタノウエ 北ノ上 +キタノウチ 北ノ内 +キタノウチ 北之内 +キタノウマ 北之馬 +キタノウラ 北ノ浦 +キタノクチ 北之口 +キタノクチ 北ノ口 +キタノグチ 北之口 +キタノグチ 北野口 +キタノサコ 北之迫 +キタノサワ 北野沢 +キタノサワ 北野澤 +キタノザワ 北野沢 +キタノザワ 北野澤 +キタノシ 北熨斗 +キタノソノ 北之園 +キタノソノ 北ノ園 +キタノソノ 北ノ薗 +キタノソノ 北之薗 +キタノゾノ 北之園 +キタノハシ 北之橋 +キタノハラ 北野原 +キタノハラ 北ノ原 +キタノハラ 北之原 +キタノボウ 北之防 +キタノボウ 北之坊 +キタノボウ 北ノ坊 +キタノボウ 北坊 +キタノボウ 北防 +キタノマ 北之馬 +キタノマ 北之間 +キタノマ 北ノ間 +キタノマ 北ノ門 +キタノマタ 北野又 +キタノマタ 北ノ又 +キタノヤ 北野谷 +キタノリ 北乗(北乘) +キタバ 北波 +キタバ 北場 +キタハシ 北橋 +キタハシ 北端 +キタハシ 木田橋 +キタハシ 貴多橋 +キタハシ 北箸 +キダハシ 木田橋 +キダハシ 喜田橋 +キタハタ 北畠 +キタハタ 北畑 +キタハタ 北端 +キタハタ 喜多幡 +キタバタ 北畠 +キタバタ 北畑 +キタバタ 北端 +キタバタ 喜多畑 +キタハタケ 北圃 +キタバタケ 北畠 +キタバタケ 北畑 +キタハチ 北八 +キタハナ 北花 +キタハバ 北幅 +キタハバ 喜多幅 +キタハマ 北浜 +キタハマ 北濱 +キタバヤシ 北林 +キタバヤシ 喜多林 +キタハラ 北原 +キタハラ 喜多原 +キタバラ 喜多原 +キタハリ 北張 +キタバン 北番 +キタヒガシ 北東 +キタヒグチ 北樋口 +キタヒラ 北平 +キタヒラジ 北平地 +キタヒラチ 北平地 +キタヒロ 北広 +キタヒロ 北廣 +キタブキ 北吹 +キタフク 来福 +キタフク 北福 +キタフクチ 北福智 +キタブクロ 北袋 +キタフサ 北総(北總) +キタフジ 北藤 +キタブチ 北渕 +キタブチ 北淵 +キタフル 北古 +キタブン 北分 +キタベ 北部 +キタベ 北辺 +キタベップ 北別府 +キタホ 喜多穂 +キタボウ 北坊 +キタボウ 北防 +キタホウノキ 北朴木 +キタホシ 北星 +キタホラ 北洞 +キタボラ 北洞 +キタホリ 北堀 +キタホリ 北掘 +キタボリ 北堀 +キタマ 北間 +キタマ 北澗 +キタマエ 北前 +キタマキ 北牧 +キタマゴエ 北馬越 +キタマサ 北正 +キタマサ 北政 +キタマス 北舛 +キタマス 北升 +キタマス 北桝 +キタマス 北枡 +キタマタ 北俣 +キタマタ 北又 +キタマタ 北亦 +キタマタ 北股 +キタマチ 北町 +キタマツ 北松 +キタマド 北窓 +キダマリ 木田余 +キダマリ 木田餘 +キタマル 北丸 +キタミ 北見 +キタミ 喜多見 +キタミ 北海 +キタミ 鬼多見 +キタミ 木多見 +キタミカ 北御門 +キタミカド 北御門 +キタミズ 北水 +キタミゾ 北溝 +キタミチ 北道 +キタミツ 北光 +キタミツ 北密 +キタミツ 北満 +キタミナト 北湊 +キタミネ 北峯 +キタミネ 北峰 +キタミネ 北岑 +キタミネ 北嶺 +キタミヤ 北宮 +キタミョウ 北名 +キタムカイ 北向 +キタムキ 北向 +キタムネ 北宗 +キタムラ 北村 +キタムラ 喜多村(喜夛村) +キタムラ 北邨 +キタムラ 北邑 +キタムラ 来村 +キタムラ 喜田村 +キタムラ 基太村 +キタムラ 木田村 +キタムラ 来田村 +キタムラ 木多村 +キタムラ 來村 +キタムラヤ 北村谷 +キタムロ 北室 +キタメ 北目 +キタメイ 北明 +キタモト 北本 +キタモト 北元 +キタモト 喜多本(喜夛本) +キタモト 貴多本 +キタモリ 北森 +キタモリ 北守 +キタモン 北門 +キタヤ 北谷 +キタヤ 亀田谷 +キタヤ 北宅 +キタヤ 北矢 +キタヤ 喜多谷 +キタヤ 北家 +キタヤ 北舎 +キタヤ 北屋 +キタヤキ 北焼 +キタヤシキ 北屋敷 +キタヤシロ 北八代 +キタヤス 北安 +キタヤチ 北谷内 +キタヤツ 北谷 +キタヤド 北谷戸 +キタヤナギ 北柳 +キタヤネ 北屋根 +キタヤブ 北薮 +キタヤブ 北藪 +キタヤブ 北籔 +キタヤマ 北山 +キタヤマ 来山 +キタヤマ 喜多山 +キタヤマ 來山 +キタヤマ 木田山 +キタユグチ 北湯口 +キタヨ 鍛代 +キタヨシ 北吉 +キタラ 北羅 +キタラ 北良 +キタラ 喜多羅 +キタラ 喜多良 +キタラ 木多良 +キタル 来 +キタル 木樽 +キタル 來 +キタルミ 来海 +キタワ 北輪 +キタワキ 北脇(北𦚰) +キタワケ 北分 +キタワダ 北和田 +キタワタセ 北渡瀬 +キタワラ 貴俵 +キダワラ 貴俵 +キダワラ 木俵 +キタン 喜旦 +ギタン 儀丹 +ギダン 義談 +キタンダ 木反田 +キチ 木地 +キチ 吉 +キチカ 木近 +キチカマ 吉鎌 +キチカワ 吉川 +キヂクニ 貴地邦 +キチサ 吉佐 +キチサカ 吉坂 +キチサカ 吉阪 +キチサガ 吉嵯峨 +キチジ 吉次 +キチジ 吉地 +キチシマ 吉島 +キチジマ 吉島 +キチジマ 吉嶋 +キチジョウ 吉上 +キチジョウ 吉祥 +キチジョウ 吉条 +キチジョウ 吉條 +キチジョウジ 吉城寺 +キチジョウジ 吉祥寺 +キチズミ 佶住 +キチセ 吉瀬 +キチゼ 吉瀬 +キチセイ 吉清 +キチソウ 吉相 +キチダ 吉田 +キチナイ 吉内 +キチナカ 吉中 +キチビキ 吉引 +キヂヒラ 木地平 +キチマ 吉間 +キチミ 吉見 +キヂムラ 木地村 +キヂモト 木地本 +キチモリ 吉森 +キチモンジ 吉文字 +キチャ 喜茶 +キチヤ 木地谷 +キチヤ 木池谷 +ギチュウ 義忠 +ギチョウ 儀丁 +ギチョウ 義丁 +キチヨシ 吉吉 +キチラク 吉楽 +キチラク 吉樂 +キツ 木津 +キツ 吉津 +キヅ 木津 +キヅ 岐津 +キヅ 城津 +キヅ 妓津 +キツイ 橘井 +キツイ 木匠 +キツイ 木対 +キツイ 狐井 +キツイ 木津井 +キツイ 木對 +キヅイ 木津井 +キツウ 木通 +キツウチ 橘内 +キヅウチ 木津内 +キツウラ 橘浦 +キツオ 橘尾 +キツオカ 橘岡 +キッカ 吉家 +キツカ 木塚 +キツカ 木束 +キヅカ 鬼塚 +キヅカ 木塚 +キヅカ 黄塚 +キッカイ 吉貝 +キツカジ 木束地 +キッカワ 吉川 +キッカワ 橘川 +キッカワ 桔川 +キッカワ 掬川 +キツカワ 吉川 +キツカワ 橘川 +キツカワ 木津川 +キツカワ 桔川 +キツカワ 掬川 +キツカワ 喜津川 +キツガワ 木津川 +キヅガワ 木津川 +キツキ 橘木 +キツキ 木附 +キツキ 木付 +キツキ 木月 +キツキ 木築 +キツキ 喜津木 +キツキ 木槻 +キツキ 喜築 +キツキ 吉都紀 +キツギ 木次 +キツギ 木付 +キツギ 木継 +キヅキ 木附 +キヅキ 木付 +キヅキ 杵築 +キヅキ 木月 +キヅキ 築 +キヅキ 木築 +キヅキ 城築 +キヅキ 着月 +キヅキ 木津喜 +キヅキ 鬼月 +キツキサワ 木附沢 +キツキザワ 木附沢 +キヅキザワ 木附沢 +キッキョウ 吉経 +キヅクリ 木造 +キツケ 吉附 +キツケサワ 木附澤 +キツケザワ 木附沢 +キッコウ 亀甲 +キッコウ 吉向 +キッコウ 菊香 +キッコウジ 吉光寺 +キッコウジン 吉高神 +キッサカ 近坂 +キッシ 吉士 +キツジ 木辻 +キツジ 鬼辻 +キツジ 橘地 +キヅシ 切通 +キヅシ 木通 +キッシュウ 吉州 +キッショ 城所 +キッショウ 吉祥 +キツジョウ 橘定 +キッショウアン 吉祥庵 +キツセ 喜津瀬 +キッセイ 吉清 +キッソウ 吉相 +キッタ 橘田 +キツタ 橘田 +キツタ 木津田 +キツダ 橘田 +キツダ 木津田 +キヅタ 木津田 +キッタカ 橘高 +キッタカ 吉高 +キッタカ 橘鷹 +キツタカ 橘高 +キツタカ 橘鷹 +キッタニ 橘谷 +キツタニ 橘谷 +キヅタニ 木津谷 +キッツイ 吉対 +キッツイ 吉對 +キッテ 切手 +キットウ 吉藤 +キツドウ 橘堂 +キヅナ 木綱 +キツナイ 橘内 +キツナミ 橘波 +キヅニシ 木津西 +キツネザキ 狐崎 +キツネジマ 狐島(狐嶋) +キツネヅカ 狐塚 +キツネハナ 狐鼻 +キツネモリ 狐森 +キツノ 橘野 +キツバエ 橘八重 +キツバヤシ 橘林 +キツハラ 橘原 +キツボ 木坪 +キヅメ 木爪 +キツモト 橘本 +キヅモト 木津本 +キツヤ 木津谷 +キツヤ 橘谷 +キツヤ 吉津谷 +キヅヤ 木津谷 +キツヤマ 橘山 +キツユ 木露 +キヅル 喜鶴 +キヅレ 喜連 +キツレガワ 喜連川 +キツワ 橘和 +キツワ 木津和 +キデ 木出 +キテイ 喜禎 +キデサキ 木出崎 +キデサキ 木出嵜 +キデナ 貴伝名 +キデナ 貴傳名 +キテラ 木寺 +キデラ 木寺 +キデラ 紀寺 +キテン 木天 +ギテン 儀天 +キト 木登 +キト 喜登 +キド 木戸 +キド 城戸 +キド 城門 +キド 貴戸 +キド 幾度 +キド 喜渡 +キド 紀戸 +キド 岐土 +キド 木土 +キド 木都 +キド 喜戸 +キド 幾戸 +キド 来戸 +キド 喜登 +キド 機戸 +キド 帰度(歸度) +キド 帰土 +キド 気戸(氣戸) +キド 畿度 +ギト 義ト +キドアキ 木戸秋 +キトウ 鬼頭 +キトウ 木藤 +キトウ 紀藤 +キトウ 喜藤 +キトウ 亀頭 +キトウ 鬼藤 +キトウ 木頭 +キトウ 貴答 +キトウ 木登 +キトウ 奇藤(竒藤) +キトウ 城藤 +キトウ 木籐 +キトウ 木東 +キトウ 来藤(來藤) +キトウ 記藤 +キトウ 喜頭 +キトウ 喜籐 +キトウ 輝東 +キトウ 鬼十 +キトウ 季東 +キドウ 木藤 +キドウ 貴堂 +キドウ 木道 +キドウ 城道 +キドウ 木堂 +キドウ 鬼童 +キドウ 貴道 +キドウ 城藤 +キドウ 木籐 +キドウ 鬼同 +キドウ 城堂 +キドウ 喜道 +キドウ 機動 +キドウ 喜堂 +キドウ 機道 +キドウ 鬼堂 +キドウ 其道 +ギトウ 儀藤 +ギトウ 義藤 +ギドウ 儀同 +ギドウ 義道 +ギドウ 儀道 +キドウイン 祁答院 +キドウエ 木戸上 +キトウゴ 木藤古 +キドウチ 城戸内 +キドウチ 木戸内 +キドウラ 木戸浦 +キトオカ 木藤岡 +キドオカ 木戸岡 +キドオカ 城戸岡 +キドオカ 木藤岡 +キドオシ 木通 +キドオリ 木通 +キドガミ 木戸上 +キドカワ 木戸川 +キドガワ 木戸川 +キトキ 木時 +キドキ 木時 +キトク 寄特 +キトク 喜読 +キトク 亀徳(龜徳) +キトク 木徳 +キトク 喜讀 +キドク 寄特 +キドク 喜読 +キドク 喜讀 +キドグチ 木戸口 +キドグチ 城戸口 +キトコ 木床 +キドコ 木床 +キドコロ 城所 +キドコロ 木所 +キドコロ 城処 +キドコロ 木都老 +キドコロ 樹所 +キドコロ 機所 +キドコロ 城處 +キドサカ 木戸坂 +キドサカ 城戸坂 +キドサキ 城戸崎 +キドサキ 木戸崎 +キドサキ 𨴐崎 +キトザコ 亀頭迫 +キドジ 木戸地 +キトダ 木藤田 +キトダ 木藤田 +キドタ 木戸田 +キドタ 城戸田 +キドタニ 木戸谷 +キドデ 木戸出 +キトナ 喜友名 +キドニシ 木戸西 +キドノ 城殿 +キドノ 喜殿 +キトバ 木戸場 +キドバ 木戸場 +キドハシ 城戸橋 +キトマ 木戸間 +キドマ 木戸間 +キトミ 木富 +キドムラ 木戸村 +キトモ 木友 +キドモト 木戸元 +キドモト 木戸本 +キドヤ 木戸屋 +キトラ 木虎 +キトラ 木寅 +キトラ 記虎 +キトラ 喜寅 +キトラ 貴登羅 +キトラ 鬼乕 +キトラ 喜虎 +キトラ 喜登良 +キトラ 貴虎 +キトラ 鬼寅 +キトラ 城虎 +キトラ 木藤良 +キトラ 木乕 +キトロ 木都老 +キトロ 木渡路 +キドワキ 木戸脇 +キドワキ 城戸脇 +キナ 喜納 +キナ 喜名 +ギナ 岐奈 +ギナ 義那 +キナイ 喜内 +キナイ 紀内 +キナイ 記内 +キナイ 貴内 +キナイ 鬼内 +キナイ 城内 +キナイ 木内 +キナエ 木苗 +キナカ 喜中 +キナカ 紀中 +キナカ 紀仲 +キナカ 木中 +キナガ 黄永 +キナガ 木永 +キナガ 木長 +キナザキ 木奈崎 +キナシ 鬼無 +キナシ 木無 +キナシ 木梨 +キナシ 木梨子 +キナセ 鬼無瀬 +キナセ 木名瀬 +キナダ 喜名田 +ギナマ 宜名真(宜名眞) +キナマリ 木鉛 +キナミ 木南 +キナミ 木波 +キナミ 木並 +キナミ 木浪 +キナミヤ 木浪谷 +キナメ 木滑 +キナメリ 木滑 +キナリ 喜成 +キナリ 紀成 +キナリ 木成 +キナン 木南 +ギニ 儀仁 +キニシ 鬼西 +キニシ 木西 +キニワ 木庭 +キヌ 絹 +キヌイ 衣斐 +キヌイ 絹井 +キヌウチ 絹内 +キヌウラ 衣浦 +キヌオカ 絹岡 +キヌカケ 衣掛 +キヌカケ 絹掛 +キヌカゲ 衣陰 +キヌガケ 衣掛 +キヌカサ 絹笠 +キヌガサ 衣笠 +キヌガサ 蓋 +キヌガサ 絹笠 +キヌガサ 絹傘 +キヌガサ 繖 +キヌカワ 衣川 +キヌカワ 絹川 +キヌガワ 衣川 +キヌガワ 鬼怒川 +キヌガワ 絹川 +キヌキ 貴貫 +キヌキ 絹木 +キヌコシ 絹漉 +キヌゴシ 衣越 +キヌサキ 絹崎 +キヌサト 衣里 +キヌサワ 絹澤(絹沢) +キヌザワ 衣沢 +キヌザワ 衣澤 +キヌシ 木主 +キヌシタ 絹下 +キヌタ 衣田 +キヌタ 絹田 +キヌタ 羅田 +キヌタ 碪 +キヌタ 𥿻田 +キヌダ 絹田 +キヌタニ 絹谷 +キヌナカ 絹中 +キヌノ 絹野 +キヌハタ 衣旗 +キヌハタ 衣畑 +キヌハタ 衣籏 +キヌハタ 衣簱 +キヌハタ 絹畠 +キヌハラ 絹原 +キヌバリ 絹針 +キヌバリ 絹張 +キヌビキ 絹引 +キヌマ 鬼沼 +キヌマキ 衣巻 +キヌマキ 絹巻 +キヌマツ 衣松 +キヌミ 絹見 +キヌムラ 絹村 +キヌモト 衣本 +キヌモト 絹本 +キヌヤ 衣谷 +キヌヤ 絹谷 +キヌヤマ 衣山 +キヌヤマ 絹山 +キヌワ 衣輪 +キヌワ 絹輪 +キヌワ 絹和 +キヌワキ 絹脇 +キネ 木根 +キネ 杞根 +キネイ 喜根井 +キネイワ 杵岩 +キネウチ 木根内 +キネカワ 衣川 +キネカワ 杵川 +キネガワ 木下川 +キネサカ 杵坂 +キネザキ 杵崎 +キネシマ 杵島 +キネタ 木根田 +キネダ 杵田 +キネダ 木根田 +キネタニ 杵谷 +キネツカ 杵塚 +キネヅカ 杵塚 +キネハラ 甲原 +キネハラ 木根原 +キネフチ 杵淵 +キネフチ 杵渕 +キネブチ 杵淵 +キネブチ 杵渕 +キネブチ 木根淵 +キネブチ 木根渕 +キネムチ 杵鞭 +キネムチ 杆鞭 +キネムラ 杵村 +キネモリ 木根森 +キネヤ 喜音家 +キネヤ 杵屋 +キネヤ 杵家 +キネヤ 杵谷 +キネリ 木練 +キノ 喜納 +キノ 喜野 +キノ 嬉野 +キノ 寄能 +キノ 紀 +キノ 紀乃 +キノ 紀埜 +キノ 紀野 +キノ 記野 +キノ 貴野 +キノ 吉野 +キノ 城野 +キノ 木埜 +キノ 木野 +ギノ 儀野 +ギノ 義野 +キノイ 木ノ井 +キノイ 木之井 +キノイ 木野井 +キノウ 喜納 +キノウ 奇能 +キノウ 寄能 +キノウ 紀納 +キノウ 貴納 +キノウ 城能 +キノウ 木納 +ギノウ 義農 +ギノウ 儀納 +キノウエ 紀ノ上 +キノウエ 木ノ上 +キノウエ 木上 +キノウエ 木之上 +キノウチ 喜内 +キノウチ 紀之内 +キノウチ 城内 +キノウチ 木ノ内 +キノウチ 木の内 +キノウチ 木内 +キノウチ 木之内 +キノウチ 木野内 +キノウヤ 木納谷 +キノエ 甲 +キノエ 木之江 +キノオカ 紀ノ岡 +キノオカ 紀岡 +キノオカ 紀之岡 +キノカワ 紀ノ川 +キノカワ 紀の川 +キノカワ 紀野川 +キノカワ 木ノ川 +キノキリ 木ノ桐 +キノキリ 木ノ切 +キノクチ 木ノ口 +キノグチ 木野口 +キノクニ 紀ノ国 +キノクニ 紀ノ國 +キノクニ 紀国 +キノクニ 紀之国 +キノクニ 紀之國 +キノクニ 紀野国 +キノクニ 紀野國 +キノクニ 紀國 +キノクニヤ 紀ノ国谷(紀ノ國谷) +キノクニヤ 紀伊国屋 +キノクニヤ 紀伊国谷(紀伊國谷) +キノクニヤ 紀国谷 +キノクニヤ 紀國谷 +ギノザ 宜野座 +ギノザ 宣野座 +キノサキ 紀ノ崎 +キノサキ 紀之崎 +キノサキ 起の崎 +キノサキ 杵崎 +キノサキ 木崎 +キノサキ 木之崎 +キノサキ 木野崎 +キノサダ 紀ノ定 +キノサダ 紀之定 +キノシ 喜熨斗 +キノシタ 貴下 +キノシタ 樹下 +キノシタ 木ノ下 +キノシタ 木下 +キノシタ 木之下 +キノシタ 木埜下 +キノシタ 木野下 +キノシマ 木ノ島(木ノ嶌) +キノシマ 木ノ嶋 +キノシマ 木野島 +キノシロ 城ノ代 +キノシロ 城代 +キノシロ 木代 +キノセ 黄瀬 +キノセ 黄之瀬 +キノセ 黄野瀬 +キノセ 木ノ瀬 +キノセ 木瀬 +キノセ 木之瀬 +キノセ 木野瀬 +キノセ 木野勢 +キノタ 木野田 +キノダ 紀野田 +キノダ 木之田 +キノダ 木野田 +キノタニ 木野谷 +キノチ 木野知 +キノト 乙 +キノト 城ノ戸 +キノト 木ノ戸 +キノト 木野戸 +キノネ 木ノ根 +キノネ 木根 +キノネ 木之根 +キノハナ 木ノ花 +キノハラ 木ノ原 +キノヒラ 紀平 +キノヒラ 木ノ平 +キノヒラ 木平 +キノマエ 木之前 +キノミヤ 木ノ宮 +キノミヤ 木宮 +キノミヤ 木之宮 +キノミヤ 木野宮 +キノミヤ 来宮 +キノムラ 紀ノ村 +キノムラ 木ノ村 +キノムラ 木之村 +キノムラ 木野村 +キノムラ 木野邑 +キノメ 木野目 +キノメ 木理 +キノモ 木裳 +キノモト 紀ノ本 +キノモト 紀之本 +キノモト 紀野本 +キノモト 木ノ元 +キノモト 木ノ本 +キノモト 木の本 +キノモト 木之元 +キノモト 木之本 +キノモト 木本 +キノモト 木野元 +キノモト 木野本 +キノヤ 紀谷 +キノヤマ 木ノ山 +キノヤマ 木埜山 +キノヤマ 木野山 +ギノヤマ 宜野山 +キノワキ 木ノ脇 +キノワキ 木の脇 +キノワキ 木之脇 +キノワキ 木脇 +キバ 黄葉 +キバ 喜羽 +キバ 喜馬 +キバ 喜葉 +キバ 季羽 +キバ 騎馬 +キバ 蒐場 +キバ 木羽 +キバ 木場 +キバ 木庭 +キバ 木馬 +キバ 木葉 +キバ 木塲 +キバ 来馬(來馬) +ギバ 議波 +キバクラ 木庭袋 +キハシ 木橋 +キハシ 木 +キバシ 鬼橋 +キバシ 木橋 +キハタ 喜畑 +キハタ 木幡 +キハタ 木畑 +キハタ 木畠 +キバタ 喜幡 +キバタ 木場田 +キバタ 木端 +キバタ 木幡 +キバタ 木畑 +キバタ 木畠 +キバタニ 木場谷 +キバチ 木鉢 +キハナ 喜花 +キハナ 木花 +キバナ 木花 +キバノ 木場野 +キバハラ 木葉原 +キバハラ 騚原 +キバモト 木場本 +キバモト 木波本 +キハヤ 喜早 +キバヤシ 喜林 +キバヤシ 樹林 +キバヤシ 木林 +キバヤマ 牙山 +キハラ 木原 +キハラ 鬼原 +キハラ 来原 +キハラ 黄原 +キハラ 喜原 +キハラ 城原 +キハラ 季原 +キハラ 記原 +キハラ 起原 +キハラ 桔原 +キハラ 岐原 +キハラ 紀原 +キハラ 來原 +キハラ 貴原 +キハラ 樹原 +キハラダ 木原田 +キハラヤマ 木原山 +キハル 木春 +キビ 気比 +キビ 吉比 +キビ 吉備 +キビ 木美 +キビ 氣比 +キビキ 木引 +キビキ 木挽 +キヒサ 木久 +キビサコ 黍迫 +キビシ 木菱 +キビシマ 黍島 +キビシマ 黍嶋 +キビタ 気比田 +キビタ 吉備田 +キビタ 黍田 +キビタ 氣比田 +キビタニ 秬谷 +キビツ 吉備津 +キビヅカ 黍塚 +キビナガ 吉備永 +キビネ 黍根 +キビノ 黍野 +キビハラ 黍原 +キヒラ 紀平 +キヒラ 記平 +キヒラ 鬼平 +キヒラ 木平 +キビラ 鬼平 +ギフ 岐阜 +ギブ 儀武 +ギブ 儀部 +キブイシ 木部石 +キブカワ 癸生川 +キフク 喜福 +キフク 貴福 +キフク 木福 +キフク 来福 +キフク 來福 +ギフク 儀福 +キフサ 木房 +キフシ 木伏 +キフジ 木藤 +キブシ 木節 +キブシ 木伏 +キブシ 木歩士 +キブセ 木伏 +キブタ 木蓋 +キブチ 木淵 +キブチ 木渕 +キブデラ 木仏寺(木佛寺) +キフネ 貴舟 +キフネ 貴船 +キフネ 貴布根 +キフネ 貴舩 +キフネ 木舟 +キフネ 木船 +キフネ 木舩 +キブネ 貴舟 +キブネ 貴船 +キブネ 貴舩 +キブネ 木舟 +キブネ 木船 +キブネ 木舩 +キフネダ 木船田 +キフネダ 木舩田 +キベ 岐部 +キベ 紀部 +キベ 吉部 +キベ 木部 +キベ 木辺 +キベ 木邊 +キベ 木邉 +ギベ 儀部 +キヘイ 紀平 +キベサキ 木部崎 +キヘダ 喜平田 +キボ 木保 +キボ 木母 +ギホ 儀保 +ギボ 岐保 +ギボ 儀保 +ギボ 宜保 +ギボ 宣保 +キホウ 奇峰 +キホウ 奇峯 +キホウ 亀宝(亀寶) +キホウ 亀寳 +キホウ 木方 +キホウ 竒峯(竒峰) +キボウ 鬼防 +ギホウ 儀宝 +ギボウ 葱花 +キホウイン 貴宝院 +キホク 冀北 +キボク 木卜 +キボシ 木星 +キボシ 木歩士 +キボシ 木坊子 +ギボシ 義干 +キボタ 木保田 +キボラ 木洞 +キマ 木間 +キマ 来間 +キマ 來間 +ギマ 儀間 +ギマ 儀満(儀滿) +ギマ 宜間 +ギマ 義間 +キマエ 木前 +キマキ 木牧 +キマクラ 木枕 +キマセ 木間瀬 +キマタ 岐亦 +キマタ 木股 +キマタ 木叉 +キマタ 木全 +キマタ 木亦 +キマタ 木俣 +キマタ 木又 +キマチ 木待 +キマチ 木町 +キマチ 来海 +キマチ 来待 +キマチ 來海 +キマチ 耒海 +キマチダニ 来海谷 +キマツカ 木間塚 +キマヅカ 木間塚 +キマト 木的 +キマル 鬼丸 +キマル 木丸 +キマン 鬼満 +キマン 木萬 +ギマン 儀万 +ギマン 義満 +キミ 喜見 +キミ 紀見 +キミ 君 +キミ 木見 +キミ 木美 +キミイ 紀三井 +キミイエ 君家 +キミイチ 君市 +キミウラ 君浦 +キミエ 君恵 +キミオカ 君岡 +キミガキ 君垣 +キミカド 公門 +キミガフクロ 君ケ袋 +キミガホラ 君ケ洞 +キミカワ 君川 +キミガワ 君川 +キミカン 君官 +キミキ 公木 +キミグチ 君口 +キミコウベ 喜美候部 +キミコウベ 吉弥侯部 +キミコウベ 吉弥候部 +キミサキ 君崎 +キミザキ 君崎 +キミサゴ 君砂 +キミサワ 君沢 +キミサワ 君澤 +キミザワ 君澤 +キミシマ 貴美島 +キミシマ 君島 +キミシマ 君嶋(君嶌) +キミジマ 君島 +キミジマ 君嶋(君嶌) +キミジリ 木見尻 +キミズ 木水 +ギミズ 義水 +キミズカ 君塚 +キミズカ 公塚 +キミゾノ 君園 +キミタ 王田 +キミタ 喜美田 +キミタ 君田 +キミタ 木見田 +キミダ 君田 +キミタニ 君谷 +キミタニ 木見谷 +キミチ 木道 +キミツ 木光 +キミツ 木密 +キミツ 木蜜 +キミツカ 君塚 +キミヅカ 君塚 +キミヅカ 木見塚 +キミヅカ 公塚 +キミツキ 君付 +キミナガ 君永 +キミナガワ 君名川 +キミナミ 君波 +キミナミ 君浪 +キミナミ 木南 +キミナリ 君成 +キミナリタ 君成田 +キミネ 基峰 +キミネ 木峰 +キミノ 君野 +キミハラ 君原 +キミハラ 公原 +キミヒラ 君平 +キミヒラ 公平 +キミホラ 君洞 +キミムラ 君村 +キミモト 君本 +キミモリ 公森 +キミヤ 貴宮 +キミヤ 樹宮 +キミヤ 木宮 +キミヤ 木実谷(木實谷) +キミヤス 君安 +キミヤマ 喜見山 +キミヤマ 君山 +キミョウ 木明 +キミヨシ 君吉 +キミラ 君羅 +キミワ 君和 +キミワタ 君和田 +キミワダ 君和田 +キム 金武 +キムカイ 来迎 +キムカエ 来迎 +キムネ 木棟 +キムヤ 金也 +キムラ 黄村 +キムラ 喜村 +キムラ 喜邑 +キムラ 基村 +キムラ 岐村 +キムラ 岐邨 +キムラ 帰村 +キムラ 季村 +キムラ 紀村 +キムラ 記村 +キムラ 貴村 +キムラ 貴邑 +キムラ 鬼村 +キムラ 樹村 +キムラ 城村 +キムラ 木村 +キムラ 木邸 +キムラ 木邑 +キムラ 木邨 +キムラ 来村 +キムラタ 木村田 +キムラダ 木村田 +キムラタニ 木村谷 +キムレ 木牟礼 +キムレ 木牟禮 +キムロ 紀室 +キムロ 木室 +キメ 木目 +キメイ 木明 +キメサワ 木目沢 +キメサワ 木目澤 +キメザワ 木目沢 +キメザワ 木目澤 +キメタ 木目田 +キメダ 木目田 +キモカワ 肝川 +キモク 木杢 +キモチ 木持 +キモツ 木持 +キモツキ 肝月 +キモツキ 肝属 +キモツキ 肝付 +キモト 黄本 +キモト 喜元 +キモト 喜本 +キモト 貴元 +キモト 奇本 +キモト 岐本 +キモト 祈本 +キモト 紀元 +キモト 紀本 +キモト 記本 +キモト 騎本 +キモト 鬼本 +キモト 樹元 +キモト 樹本 +キモト 城本 +キモト 木許 +キモト 木元 +キモト 木本 +キモト 杞本 +キモト 驥本 +ギモト 儀本 +ギモト 義本 +キモリ 喜森 +キモリ 樹森 +キモリ 城守 +キモリ 城森 +キモリ 木守 +キモリ 木森 +キモリ 木盛 +キモン 鬼門 +キモンジ 喜文字 +キヤ 帰家(歸家) +キヤ 気谷 +キヤ 紀谷 +キヤ 規家 +キヤ 貴家 +キヤ 生谷 +キヤ 木屋 +キヤ 木家 +キヤ 木舎 +キヤ 木谷 +キヤ 木矢 +キヤ 氣谷 +キヤオ 木屋尾 +キヤカワウチ 木屋川内 +キャク 客 +キャクイ 客井 +ギャクイ 逆井 +キャクサカ 客坂 +ギャクシ 瘧師 +キャクデ 客出 +キャクデン 客殿 +キャクド 客渡 +キャクナガ 客永 +キャクノ 却野 +キャクノ 客野 +キャクノ 脚ノ +キャクモト 客本 +キヤジ 木屋路 +キヤシキ 紀屋敷 +キヤシキ 鬼屋敷 +キヤス 喜安 +キヤス 木安 +キヤス 木保 +キヤタ 木谷田 +キヤダ 喜屋田 +キヤダ 喜家田 +キヤタケ 喜屋武 +キヤナギ 喜柳 +キヤナギ 鬼柳 +キヤナギ 木柳 +キヤノ 木屋野 +キヤハタ 木谷畑 +キヤハラ 喜屋原 +キヤブ 喜屋武 +キヤブ 木薮 +キヤブ 木籔 +キヤブ 木藪 +キヤマ 黄山 +キヤマ 喜山 +キヤマ 帰山 +キヤマ 祈山 +キヤマ 季山 +キヤマ 紀山 +キヤマ 貴山 +キヤマ 鬼山 +キヤマ 樹山 +キヤマ 城山 +キヤマ 木山 +キヤマ 来山 +キヤマ 來山 +キヤマ 杞山 +キヤマ 歸山 +キヤマ 耆山 +ギヤマ 耆山 +キヤマザワ 木山沢 +キヤマザワ 木山澤 +キヤマダ 木山田 +キヤミ 木闇 +キヤムラ 喜家村 +キヤムラ 喜谷村 +キヤムラ 気屋村 +キヤムラ 木屋村 +キヤムラ 木谷村 +キヤムラ 木矢村 +キヤムラ 氣屋村 +キャラ 伽羅 +キャラヤ 伽羅谷 +キヤリ 寄鑓 +キャン 喜屋武 +キヤン 喜屋武 +キユウ 亀遊 +キュウアン 久安 +キュウイ 久伊 +キュウイ 休位 +キュウイ 休井 +キュウエ 久恵(久惠) +キュウエ 久江 +キュウエイ 久永 +キュウカ 久加 +キュウカ 久家 +キュウカワ 久川 +キュウキ 久喜 +キュウキ 久木 +キュウキタ 久北 +キュウケ 久家 +キュウコ 久古 +キュウコ 久故 +キュウゴ 久古 +キュウゴ 久後 +キュウゴ 救護 +ギュウコ 牛古 +キュウゴウ 久郷 +キュウザ 久座 +キュウサイ 久才 +キュウサイ 久斎 +キュウサイ 久斉 +キュウサイ 休斎(休齋) +キュウサイ 休斉 +キュウサカ 休坂 +キュウサキ 久崎 +キュウザキ 久崎 +キュウザト 喜友里 +キュウジ 久司 +キュウジ 久次 +キュウジ 久地 +キュウジ 久路 +キュウジ 九司 +キュウシキ 急式 +キュウシタ 給下 +キュウシマ 久島 +キュウシマ 久嶋 +キュウシマ 九島 +キュウジュ 久寿 +キュウジュ 久壽 +キュウシュウ 九刕 +キュウショ 久所 +キュウショウ 休性 +キュウシン 久新 +キュウセ 久世 +キュウセ 久瀬 +キュウセ 久勢 +キュウゼン 久前 +キュウゼン 給前 +キュウゾウ 久蔵(久藏) +キュウソク 休束 +キュウソジン 久曾神 +キュウソジン 久曽神 +キュウソジン 久祖神 +キュウタ 久田 +キュウタ 給田 +キュウダ 久田 +キュウダ 給田 +キュウタニ 久谷 +キュウタン 九反 +キュウチ 久地 +キュウチ 糺地 +キュウヅカ 久塚 +キュウテガワ 久手川 +キュウデン 久伝(久傳) +キュウデン 久田 +キュウデン 久傅 +キュウト 久戸 +キュウト 久斗 +キュウトウ 久藤 +キュウドウ 久堂 +キュウトク 久徳 +キュウトク 休徳 +キュウナ 喜友名 +キユウナ 喜友名 +キュウナイ 久内 +キュウナガ 喜友永 +キュウナリ 久成 +キュウノ 久能 +キュウノ 久野 +キュウノ 及能 +キュウノ 弓野 +キュウノ 給野 +キュウノ 興野 +キュウノウ 久能 +キュウノウ 及能 +キュウノキ 久軒 +キュウバ 久場 +キュウバ 久馬 +キュウバ 休場(休塲) +キュウバ 休庭 +キュウハイ 宮拝 +キュウハタ 久畑 +キュウハチ 久八 +キュウハラ 久原 +キュウフ 久府 +キュウブ 旧部 +キュウブツ 久仏 +キュウブツ 久佛 +キュウブツ 及佛 +キュウブン 久文 +キュウブン 給分 +キュウヘイ 久平 +キュウホウ 久宝(久寳) +キュウホウ 久寶 +キュウボシ 九星 +キュウマ 久間 +キュウマ 久馬 +キュウマン 休万 +キュウマン 休萬 +キュウミズ 久水 +キュウムラ 喜友村 +キュウモト 久本 +キュウモン 久門 +キュウヤク 旧役(舊役) +キュウヤマ 休山 +キュウラキ 久良木 +キュウラギ 久良木 +キュウラク 久楽 +キュウワ 久和 +キユナ 喜友名 +キヨ 喜代 +キヨ 清 +キヨアラ 清荒 +キヨイ 清位 +キヨイ 清井 +キヨイ 清居 +キヨイエ 清家 +キヨイケ 清池 +キヨイシ 清石 +キヨイズミ 清泉 +キョウ 京 +キョウ 経 +キョウ 襲 +ギョウ 業 +キョウイ 杏井 +キョウイ 京井 +キョウイ 興井 +キョウイシ 京石 +キョウイズミ 京泉 +キョウイズミ 京和泉 +キョウイワ 経岩 +キョウエ 京江 +キョウエン 京円 +ギョウエン 行円 +ギョウエン 行圓 +キョウオ 京尾 +キョウオウ 京応 +キョウオカ 京岡 +キョウオク 京奥 +キョウオタニ 京尾谷 +キョウカ 京家 +キョウカク 京角 +キョウガク 京角 +キョウガク 教学 +キョウガサカ 経ケ坂 +キョウガサカ 経ケ阪 +キョウガシマ 京ケ島 +キョウカネ 京兼 +キョウガネ 京金 +キョウガネ 京兼 +キョウカメ 経亀 +キョウガラ 京柄 +キョウカワ 京河 +キョウカワ 京川 +キョウカワ 教川 +キョウカワ 興川 +キョウカワ 鏡川 +キョウカン 京寛 +キョウカンイン 京寛院 +ギョウギ 行木 +キョウグチ 京口 +キョウクノ 京久野 +キョウクボ 京久保 +キョウグロ 京黒 +キョウケ 京家 +キョウコ 京小 +キョウゴウ 京郷 +キョウゴク 京極 +キョウコン 亨紺 +キョウコン 享紺 +キョウコン 京紺 +キョウサイ 京才 +キョウサカ 京坂 +キョウサカ 京阪 +キョウサキ 京崎 +キョウザキ 京崎 +キョウザキ 経崎 +キョウザワ 京沢 +キョウザワ 京澤 +キョウザワ 経沢 +キョウザワ 経澤 +キョウシ 京師 +キョウジ 京治 +キョウジ 京地 +ギョウジ 行仕 +ギョウジ 行司 +ギョウジ 行事 +ギョウジ 行地 +キョウシタ 京下 +キョウシタ 峡下 +ギョウジダニ 行司谷 +キョウシマ 京島 +キョウシマ 京嶋 +キョウシマ 京嶌 +キョウジマ 京島 +キョウジマ 京嶋 +キョウジマ 経島 +ギョウシャ 行舎 +ギョウジャ 行者 +ギョウジュ 行寿 +ギョウジュ 行壽 +キョウショウ 京正 +キョウジョウ 京条 +キョウジョウ 京條 +キョウショウイン 教正院 +キョウシン 京信 +ギョウシン 行信 +キョウス 京須 +キョウズ 興津 +キョウズカ 京塚 +キョウズカ 京墓 +キョウズカ 経塚 +キョウスナ 京砂 +キョウズミ 京角 +キョウズミ 京住 +キョウセイ 教誓 +キョウセン 教仙 +キョウセン 亰仙 +キョウソウ 京僧 +キョウソウ 京相 +キョウソウ 京増 +キョウゾラ 京空 +キョウタ 京田 +キョウタ 強田 +キョウダ 京田 +キョウダ 強田 +キョウダ 経田(經田) +キョウダ 矜田 +ギョウタ 行田 +ギョウダ 行田 +キョウタキ 京滝 +キョウタキ 京瀧 +キョウタケ 京竹 +キョウタニ 京谷 +キョウタニ 経谷 +キョウチ 京地 +キヨウチ 清内 +キョウチカ 京近 +キョウヅ 興津 +キョウツカ 京塚 +キョウヅカ 京塚 +キョウヅカ 京墓 +キョウヅカ 慶塚 +キョウヅカ 経塚 +キョウヅカ 經塚 +キョウデン 京伝 +キョウデン 京田 +キョウデン 経田(經田) +ギョウテン 尭天 +ギョウテン 業天 +ギョウテン 行天 +ギョウテン 堯天 +キョウト 京戸 +キョウド 京戸 +キョウトウ 京当(京當) +キョウトウ 京藤 +キョウトウ 京籐 +キョウドウ 京藤 +キョウドウ 京堂 +キョウドウ 京道 +キョウドウ 鏡堂 +キョウドウ 経藤 +キョウドウ 経堂 +ギョウトウ 行燈 +ギョウドウ 行道 +キョウトク 京徳 +ギョウトク 行徳 +キョウナ 京名 +キョウナカ 京中 +キョウナカ 京仲 +キョウニシ 京西 +キョウネン 京念 +キョウネンヤ 京念屋 +キョウノ 京野 +キョウノ 教野 +キョウノ 興野 +キョウノ 竟野 +キョウノウ 京納 +キョウノウ 皛納(晶納) +ギョウノウチ 行之内 +キョウノミネ 京之嶺 +キョウバ 教羽 +キョウバ 教場 +キョウバ 饗場 +ギョウバ 行場 +キョウハシ 京橋 +キョウバシ 杏橋 +キョウバシ 京橋 +キョウバヤシ 京林 +キョウバヤシ 恭林 +キョウハラ 京原 +キョウビシ 京菱 +キョウヒラ 京平 +キョウブ 京武 +キョウブ 京部 +ギョウフ 行譜 +ギョウブ 尭部 +ギョウブ 刑部 +ギョウブ 形部 +ギョウブ 形舞 +ギョウブ 行部 +ギョウブ 行歩 +ギョウブ 堯部 +ギョウブ 行譜 +キョウフカ 京深 +ギョウブサワ 行部沢 +ギョウブザワ 行部澤 +キョウフジ 京藤 +キョウブツ 京仏(京佛) +キョウベ 京部 +キョウホ 亨保 +キョウホ 享保 +キョウホ 京保 +キョウホウイン 京宝院(京寶院) +キョウボク 喬木 +キョウマス 京増 +キョウマス 京桝 +キョウマチ 京町 +キョウマツ 京松 +キョウマル 亨丸 +キョウマル 享丸 +キョウミ 京海 +キョウミ 京見 +キヨウミ 清海 +キョウミツ 京光 +キョウミネ 京峰 +キョウミネ 京峯 +ギョウミョウ 行名 +キョウムラ 杏村 +キョウムラ 京村 +キョウムラ 教村 +キョウムラ 興村 +キョウムレ 京牟礼 +キョウムレ 京牟禮 +キョウメイ 教明 +キョウメン 京免 +キョウメン 京面 +キョウメン 鏡免 +キョウメン 経免 +キョウモト 京元 +キョウモト 京本 +キョウモト 経元 +キョウモト 姜本 +キョウモリ 京森 +キョウモリ 京盛 +キョウヤ 京屋 +キョウヤ 京家 +キョウヤ 京谷 +キョウヤ 京矢 +キョウヤ 強谷 +キョウヤ 強矢 +キョウヤ 響谷 +ギョウヤ 暁谷 +キョウヤナギ 京柳 +キョウヤマ 杏山 +キョウヤマ 京山 +キョウヤマ 教山 +キョウヤマ 姜山 +キョウラ 京良 +キヨウラ 清浦 +キョウライセキ 教来石 +キョウラギ 教楽木 +キョウラギ 教樂木 +キョウラク 京楽 +キョウラク 京樂 +キョウリキ 京力 +キョウリキ 強力 +ギョウリキ 行力 +キョウレン 境蓮 +キョウレン 教蓮 +キョウレン 教連 +キョウロヒラ 京呂平 +キョウワ 京和 +キヨエ 清江 +キヨエ 清枝 +キヨエダ 清枝 +キヨオカ 清岡 +キヨオカ 清岳 +キヨオカ 清丘 +キヨカ 清家 +キヨガ 清賀 +キヨカゲ 清蔭 +キヨカネ 清金 +キヨカネ 清兼 +キヨガネ 清金 +キヨカミ 清上 +キヨカワ 喜世川 +キヨカワ 教川 +キヨカワ 清河 +キヨカワ 清川 +キヨキ 清木 +キヨキバ 清木場 +キヨク 清久 +ギョクセン 玉仙 +ギョクセン 玉泉 +キョクタ 曲田 +キョクダ 曲田 +キヨグチ 清口 +キョクテン 旭天 +キョクド 曲戸 +キョクトウ 曲藤 +ギョクナン 玉南 +キヨクニ 清国 +キヨクニ 清國 +キョクバ 曲馬 +キョクハラ 曲原 +キョクブチ 曲淵 +ギョクブン 玉聞 +キヨクモ 清雲 +キョクモト 曲本 +キョクヤマ 曲山 +キヨクラ 清倉 +キヨクロ 清黒 +キョクワ 曲輪 +キヨコバ 清木場 +キヨサカ 清坂 +キヨサカ 清酒 +キヨサキ 清崎 +キヨサキ 清嵜 +キヨサキ 喜代崎 +キヨザキ 清崎 +キヨサダ 清貞 +キヨサダ 清定 +キヨサト 清郷 +キヨサト 清里 +キヨザネ 清実(清實) +キヨサワ 清沢 +キヨサワ 清澤 +キヨザワ 清沢 +キヨザワ 清澤 +キョザン 巨山 +キョシ 許士 +キヨシ 喜吉 +キヨシ 喜好 +キヨシ 喜代吉 +キヨシ 喜代志 +キヨシ 喜芳 +キヨシ 寄吉 +キヨシ 清 +キヨシ 清志 +キヨシ 木吉 +キヨシ 木葭 +キヨシキ 清敷 +キヨシゲ 清重 +キヨシゲ 清繁 +キヨシタ 清下 +キヨシマ 清島 +キヨシマ 清嶋(清嶌) +キヨジマ 清島 +キヨジマ 清嶋(清嶌) +キヨシロ 清代 +キヨス 清寿 +キヨス 清州 +キヨス 清洲 +キヨス 清須 +キヨス 清棲 +キヨスエ 清末 +キヨスエ 清未 +キヨズカ 清塚 +キヨスギ 清杉 +キヨスケ 清輔 +キヨスケ 清祐 +キヨスミ 清角 +キヨスミ 清住 +キヨスミ 清須美 +キヨズミ 浄住 +キヨズミ 清角 +キヨズミ 清住 +キヨズミ 清澄 +キヨズミ 淨住 +キョセ 巨瀬 +キヨセ 清瀬 +キヨセ 清生 +キヨソノ 清園 +キヨゾノ 浄園 +キヨゾノ 清園 +キヨゾノ 淨園 +キヨタ 喜代多 +キヨタ 喜代田 +キヨタ 強田 +キヨタ 清田 +キヨタ 木与田 +キョダ 許田 +キヨダ 清田 +キヨタカ 清高 +キヨタキ 清滝 +キヨタキ 清瀧 +キヨタケ 清竹 +キヨタケ 清武 +キヨタニ 清渓 +キヨタニ 清谷 +キヨタニ 清溪 +キヨタネ 清胤 +キヨチ 清地 +キヨチカ 清親 +キヨツカ 清塚 +キヨヅカ 清塚 +キヨツキ 清月 +キヨツグ 清継 +キヨツギ 清次 +キヨツジ 清辻 +キヨツナ 清綱 +キヨツネ 清常 +キヨヅミ 清積 +キヨツラ 清面 +キヨツル 清鶴 +キヨヅル 清鶴 +キヨデラ 清寺 +キヨト 喜代門 +キヨト 清戸 +キヨト 清登 +キヨト 清都 +キヨトウ 清遠 +キヨトウ 清藤 +キヨドウ 清藤 +キヨトオ 清遠 +キヨトキ 清時 +キヨトシ 清利 +キヨトミ 清富 +キヨトミ 清冨 +キヨドメ 清留 +キヨトモ 清塘 +キヨトモ 清友 +キヨナ 清名 +キヨナカ 清中 +キヨナガ 喜代永 +キヨナガ 幾世永 +キヨナガ 清永 +キヨナガ 清長 +キヨナリ 清成 +キヨナリ 木代成 +キヨニシ 浄西(淨西) +キヨヌマ 浄沼 +キヨヌマ 淨沼 +キヨネ 木米 +キヨノ 浄野 +キヨノ 清ノ +キヨノ 清野 +キヨノ 清埜 +キヨノブ 清信 +キヨハシ 幾世橋 +キヨハシ 清橋 +キヨハマ 喜代浜 +キヨハマ 喜代濱 +キヨバヤシ 清林 +キヨハラ 喜代原 +キヨハラ 浄原 +キヨハラ 清原 +キヨヒサ 清久 +キヨヒラ 喜代平 +キヨヒラ 清飛羅 +キヨヒラ 清平 +キヨヒロ 清広(清廣) +キヨヒロ 清弘 +ギョフ 漁府 +キヨフジ 清藤 +キヨフダ 清札 +キヨフネ 清船(清舩) +キヨベ 清部 +キヨマ 清間 +キヨマサ 清政 +キヨマサ 清正 +キヨマス 清益 +キヨマス 清舛 +キヨマス 清増 +キヨマツ 清松 +キヨマル 清丸 +キヨミ 喜代美 +キヨミ 浄見 +キヨミ 清海 +キヨミ 清見 +キヨミ 淨見 +キヨミズ 清水 +キヨミチ 清道 +キヨミツ 清光 +キヨミネ 清峰 +キヨミハラ 清見原 +キヨミヤ 清宮 +キヨムネ 清宗 +キヨムラ 慶世村 +キヨムラ 清村 +キヨメ 木代目 +キョモト 許本 +キヨモト 清基 +キヨモト 清元 +キヨモト 清源 +キヨモト 清本 +キヨモト 姜本 +キヨモリ 京盛 +キヨモリ 清森 +キヨヤス 清安 +キヨヤナギ 清柳 +キヨヤマ 京山 +キヨヤマ 浄山 +キヨヤマ 清山 +キヨユキ 清行 +キヨヨシ 喜代吉 +キヨヨシ 清吉 +キラ 雲英 +キラ 雲母 +キラ 喜良 +キラ 吉楽 +キラ 吉羅 +キラ 吉良 +キラ 吉樂 +キラ 木羅 +キラ 木良 +キライ 喜来(喜耒) +キライ 喜來 +キライ 帰来(歸来) +キラガワ 吉良川 +キラク 吉楽 +キラク 喜楽(喜樂) +キラクドウ 器楽堂(噐楽堂) +キラクドウ 噐樂堂 +キラシャ 気羅紗 +キラタ 吉良田 +キラヤマ 吉良山 +キララ 雲母 +キリ 喜利 +キリ 桐 +キリ 梧 +キリ 木利 +キリ 木履 +ギリ 儀理 +キリアキ 桐明 +キリアキ 切明 +キリアケ 桐明 +キリアケ 切明 +キリアケ 伐明 +キリアケハタ 切明畑 +キリイ 桐井 +キリイ 切井 +キリイケ 切池 +キリイシ 桐石 +キリイシ 切石 +キリイシナカ 切石中 +キリイワ 切岩 +キリウ 桐生 +キリウ 城里生 +キリウ 霧生 +キリウチ 桐内 +キリウメ 切梅 +キリエ 桐江 +キリエ 切江 +キリエダ 桐枝 +キリオ 桐尾 +キリオ 切尾 +キリオカ 桐岡 +キリカイ 桐貝 +キリカエ 切替 +キリガクボ 桐ケ久保 +キリガクボ 桐ケ窪 +キリカケ 切欠 +キリカネ 切金 +キリガネ 切金 +キリカミ 桐上 +キリカミ 切上 +キリガミ 切上 +キリカヤ 桐萱 +キリガヤ 桐ケ谷 +キリガヤ 桐萱 +キリガヤ 桐谷 +キリカワ 桐川 +キリカワ 梧川 +キリカワ 切川 +キリキ 桐木 +キリキ 切木 +キリギシ 切岸 +キリキヒラ 桐木平 +キリク 紀陸 +キリクイ 桐久井 +キリクイ 切喰 +キリグチ 桐口 +キリグチ 切口 +キリクボ 桐久保 +キリクボ 切久保 +キリクラ 木切倉 +キリクリ 伐栗 +キリコ 桐子 +キリゴ 切後 +ギリコ 儀利古 +キリコシ 桐越 +キリコシ 桐腰 +キリコシ 切越 +キリコバヤシ 桐小林 +キリサカ 桐坂 +キリサカ 切坂 +キリサキ 桐崎 +キリザキ 桐崎 +キリサコ 桐浴 +キリサコ 切佐古 +キリサト 霧里 +キリザト 切里 +キリサワ 桐沢 +キリサワ 桐澤 +キリサワ 切沢 +キリサワ 切澤 +キリザワ 桐沢 +キリシ 切士 +キリジ 桐地 +キリシキ 桐敷 +キリシキ 切敷 +キリシタ 桐下 +キリシタ 霧下 +キリシマ 桐島 +キリシマ 桐嶋 +キリシマ 切島 +キリシマ 切嶋 +キリシマ 霧島 +キリシマ 霧嶋 +キリセコ 桐迫 +キリタ 吉里田 +キリタ 桐田 +キリタ 切田 +キリダ 桐田 +キリタカ 桐高 +キリタケ 桐竹 +キリタテ 切建 +キリタニ 桐渓 +キリタニ 桐谷 +キリタニ 桐溪 +キリタニ 梧谷 +キリチ 切地 +キリヅカ 切塚 +キリツキ 桐月 +キリヅキ 桐月 +キリツケ 切付 +キリツケ 切附 +キリツジ 切辻 +キリツナ 桐綱 +キリヅメ 切詰 +キリテ 切手 +キリト 桐戸 +キリト 切戸 +キリトウ 桐藤 +キリトウ 切東 +キリトウシ 切通 +キリドウシ 切通 +キリトオシ 切通 +キリドオシ 切通 +キリトメ 切留 +キリナイ 桐内 +キリナカ 切中 +キリナガ 桐永 +キリナシザワ 切無沢 +キリナシザワ 切無澤 +キリヌキ 桐貫 +キリヌキ 切貫 +キリヌキ 切抜 +キリノ 桐野 +キリノ 霧野 +キリノエ 桐野江 +キリノキ 桐木 +キリノタニ 桐ノ谷 +キリハ 桐葉 +キリバ 桐場 +キリハタ 桐畑 +キリハタ 切端 +キリハタ 切幡 +キリハタ 切畑 +キリハタ 切畠 +キリハタ 切籏 +キリハタ 霧畑 +キリハタヤ 切畑屋 +キリハナ 桐花 +キリハナ 切鼻 +キリハマ 切浜 +キリハヤシ 桐林 +キリバヤシ 桐林 +キリバヤシ 切林 +キリバヤシ 霧林 +キリハラ 桐原 +キリハラ 梧原 +キリハラ 切原 +キリヒ 桐樋 +キリヒガシ 切東 +キリヒラキ 切開 +キリフ 切封 +キリフジ 桐藤 +キリフチ 桐渕 +キリブチ 桐淵 +キリブチ 桐渕 +キリベ 桐部 +キリベ 桐辺 +キリマ 桐間 +キリマ 切間 +キリマツ 切松 +キリミチ 切道 +キリミチ 霧道 +キリミネ 桐嶺 +キリムラ 桐村 +キリムラ 霧村 +キリメ 切目 +キリモト 桐元 +キリモト 桐本 +キリモト 切本 +キリモリ 桐森 +キリヤ 桐谷 +キリヤ 切谷 +キリヤナギ 切柳 +キリヤマ 喜里山 +キリヤマ 貴理山 +キリヤマ 桐山 +キリヤマ 切山 +キリヤマ 伐山 +キリヤマ 霧山 +キリュウ 寄留 +キリュウ 鬼立 +キリュウ 亀竜 +キリュウ 亀龍 +キリュウ 吉柳 +キリュウ 吉立 +キリュウ 桔流 +キリュウ 桐生 +キリュウ 桐流 +キリュウ 城里生 +キリュウ 霧生 +キリュウ 木立 +キリュウ 木竜 +キリュウ 木龍 +キリョウ 木了 +キリヨシ 桐吉 +キリワ 切輪 +キリワキ 桐脇 +キリワケ 伐分 +キリワタリ 霧渡 +キルドウ 桐籐 +キルナカ 切中 +キルヒガシ 切東 +キルマ 切間 +キレ 喜連 +キレイ 亀冷 +キレカワ 喜連川 +キレカワ 切川 +キレガワ 喜連川 +キレト 切戸 +キレン 喜連 +キレン 着連 +キレンカワ 喜連川 +キロ 帰路 +キロク 喜録 +キロク 紀陸 +キロク 記録 +キロコ 木呂子 +キロバ 木呂場 +キワ 喜和 +キワ 紀和 +キワ 際 +キワ 木輪 +キワ 木和 +キワカ 木若 +キワカワ 極川 +キワキ 木挽 +キワキ 木脇 +キワケ 木分 +キワタ 黄綿 +キワタ 喜綿 +キワタ 際田 +キワタ 木綿 +キワタ 木和田 +キワダ 黄檗 +キワダ 喜和田 +キワダ 際田 +キワダ 木和田 +キワタオリ 木綿織 +キワダテ 極立 +キワタニ 際谷 +キワタリ 木渡 +キワド 黄波戸 +キワナカ 際中 +キワナミ 極並 +キワムラ 木和村 +キワメン 木和面 +キワモト 極本 +キワモト 際本 +キワモト 木波本 +キワヤマ 極山 +キワリ 喜輪理 +キワリ 木割 +キン 金 +キン 金武 +ギン 銀 +ギンオカ 銀岡 +キンカ 金加 +キンカ 金家 +キンカ 金花 +キンカ 金華 +キンガ 近賀 +キンカイ 金海 +キンカワ 近河 +キンカワ 金川 +キンカワ 金武川 +キンガワ 金武川 +ギンカワ 銀川 +ギンガワ 銀川 +キンギョ 金魚 +キンキョウ 金京 +キングチ 金口 +キンクラ 金倉 +キンケイ 金渓 +キンゲツ 金月 +キンコ 金庫 +キンゴ 金五 +キンゴ 金伍 +キンゴ 金吾 +キンゴ 金後 +キンゴウ 近郷 +キンコウザン 錦光山 +キンコウジ 金光寺 +キンコウヤ 金光谷 +キンコリ 錦古里 +ギンサ 吟佐 +ギンザ 銀座 +キンサカ 金阪 +ギンザキ 銀崎 +ギンザワ 銀沢 +ギンザワ 銀澤 +キンザン 金山 +ギンザン 銀山 +キンザンコウ 金山光 +キンシ 金志 +キンシ 金糸 +キンシチ 金七 +ギンシマ 銀島 +ギンジマ 銀島 +キンジュ 金寿 +キンジョ 近處 +キンショウ 金正 +キンショウ 金生 +キンジョウ 錦城 +キンジョウ 金城 +ギンジョウ 銀城 +キンショク 錦職 +キンス 金須 +キンスイ 金水 +ギンスイ 銀水 +キンセイ 錦生 +キンセイ 金生 +キンセキ 金石 +キンセキ 絹石 +キンセン 金泉 +キンゾウ 金造 +キンソク 勤息 +キンタ 近田 +キンタ 金田 +キンダ 近田 +キンダ 金田 +ギンダ 銀田 +キンタイ 錦帯 +キンダイ 金代 +キンタイチ 金田一 +キンダイチ 金田一 +キンタカ 金孝 +キンタカ 金高 +キンダカ 金高 +キンタケ 金竹 +キンタニ 金谷 +ギンタニ 吟谷 +キンダン 金檀 +キンチク 金竹 +キンツ 近都 +キンツ 金津 +キンヅカ 金塚 +キンツジ 金辻 +キンデン 近田 +キント 金戸 +キント 金斗 +キント 金登 +キントウ 金藤 +キンドウ 近藤 +キンドウ 金藤 +キンドウ 金洞 +キンドウ 金堂 +キンドウ 金道 +キンドウ 金銅 +キントキ 金時 +キントク 金徳 +キンナイ 金内 +キンナカ 金中 +ギンナガ 銀永 +キンナミ 金並 +キンナミ 金浪 +キンナン 金南 +ギンナン 銀杏 +キンネ 金根 +キンノ 金野 +ギンノ 銀野 +キンノウ 金納 +ギンノウ 銀納 +キンバ 金場 +キンバ 金馬 +ギンバ 銀羽 +キンバヤシ 金林 +ギンバヤシ 銀林 +キンバラ 金原 +キンパラ 金原 +ギンバラ 銀原 +キンベ 金部 +キンペイ 金平 +キンポウ 金宝 +キンボシ 金星 +キンマ 金馬 +キンマン 金万(金萬) +キンメイ 金明 +キンモト 金本 +ギンモト 銀本 +キンヤ 金谷 +ギンヤ 銀屋 +ギンヤ 銀家 +ギンヤ 銀谷 +ギンヤマ 銀山 +ギンヨシヤ 銀吉屋 +キンラ 金良 +キンリ 錦里 +キンリュウ 金龍 +キンリュウザン 金龍山 +ギンワ 銀輪 +ク 工 +クアイタ 工合田 +クイ 久井 +クイ 杭 +クイ 九猪 +グイ 具伊 +クイオイ 柆生 +クイオカ 杭岡 +クイク 久生 +クイサコ 杭迫 +クイシ 九石 +クイセ 杭瀬 +クイセコ 杭迫 +クイタ 杭田 +クイタ 杭全 +クイダ 杭田 +クイダ 久井田 +クイダ 柆田 +クイタニ 杭谷 +クイチ 工一 +クイデ 杭出 +クイトウ 杭東 +クイナグチ 水鶏口 +クイノ 杭野 +クイノセ 杭ノ瀬 +クイハラ 杭原 +クイハラ 柆原 +クイヒラ 柊平 +クイビラ 柊平 +クイマス 杭升 +クイモト 杭本 +クイヤマ 柊山 +クウカ 空花 +グウジ 宮司 +クウダ 久宇田 +クウド 空戸 +クウラ 久良 +クウラ 九浦 +クエダ 杭田 +クエダ 久江田 +クエダ 九会田 +クエダ 九會田 +クエタニ 杭谷 +クエナカ 崩中 +クオ 九尾 +クオカ 九岡 +クオカ 工岡 +クオリ 九折 +クガ 久我 +クガ 久家 +クガ 空閑 +クガ 久賀 +クガ 陸 +クガ 苦瓜 +クガ 久峩 +クガ 空間 +クガ 久峨 +クガ 九賀 +クガ 玖珂 +クガ 九家 +クガ 苦爪 +クガ 空賀 +クガ 久閑 +クガ 玖嘉 +クカイ 久開 +クカイ 九海 +クガイ 久貝 +クガイ 陸井 +クガイトウ 久海東 +クガオ 久我尾 +クガグチ 久我口 +クガサ 久笠 +クガサワ 久ケ沢 +クガサワ 久ケ澤 +クガタ 陸田 +クガタ 久賀田 +クガタ 工方 +クガタニ 久我谷 +クガタニ 久賀谷 +クガタニ 陸歎 +クガテン 久加天 +クガネ 久加根 +クガノ 久賀野 +クガノ 玖賀野 +クガハラ 久我原 +クガハラ 陸原 +クガミ 国上 +クガミ 國上 +クガミ 久神 +クガミ 久我美 +クガミ 陸上 +クガヤ 久下谷 +クガヤ 久我谷 +クガヤ 久賀谷 +クガヤマ 久ケ山 +クカワ 久川 +クガワ 久川 +クガワ 陸川 +クガワ 九川 +クガワ 工川 +クガワ 躯川 +クガワ 九河 +クガワ 軀川 +グカワ 愚川 +クキ 九鬼 +クキ 久木 +クキ 久喜 +クキ 久岐 +クキ 岫 +クキ 久貴 +クキ 九喜 +クキ 九木 +クキ 久鬼 +クギ 久木 +クギ 工木 +クキイ 久木井 +クギイ 釘井 +クキウト 柊宇都 +クギオ 釘尾 +クギオカ 釘岡 +クキガワ 久木川 +クギグルマ 釘車 +クギコ 釘子 +クキサキ 久木崎 +クキサキ 柊崎 +クキザキ 久木崎 +クキザキ 柊崎 +クギサキ 釘崎(釘嵜) +クギザキ 釘崎(釘嵜) +クキサコ 久木迫 +クキザコ 久木迫 +クキサワ 茎沢(莖澤) +クキサワ 茎澤 +クキザワ 茎沢(莖澤) +クギサワ 釘沢 +クギサワ 釘澤 +クギザワ 釘沢 +クギザワ 釘澤 +クギシマ 釘島 +クギシマ 釘嶋 +クキゾノ 久木園 +クキタ 久木田 +クキタ 茎田 +クキタ 久幾田 +クキタ 九木田 +クキタ 柊田 +クキタ 久喜田 +クキタ 莖田 +クキダ 茎田 +クキダ 莖田 +クギタ 久木田 +クギタ 釘田 +クギタニ 釘谷 +クキツ 茎津 +クキツ 莖津 +クキヅ 久喜津 +クキドメ 久木留 +クキナカ 柊中 +クギヌキ 釘貫 +クギヌキ 釘抜(釘拔) +クキノ 久木野 +クキノ 柊木野 +クキノ 柊野 +クキノ 九木野 +クギノ 久木野 +クギノ 釘野 +クキノノ 久木野々 +クキノノ 久木野野 +クキハラ 久木原 +クキハラ 柊原 +クギハラ 久木原 +クギハラ 釘原 +クギヒデ 釘秀 +クギマチ 釘町 +クギマツ 釘松 +クキマル 九鬼丸 +クギマル 釘丸 +クギミツ 釘光 +クキミヤ 久木宮 +クギミヤ 釘宮 +クキムラ 久木村 +クギムラ 釘村 +クキモト 久木元 +クキモト 柊元 +クキモト 久木本 +クギモト 釘本 +クギモト 釘元 +クギモト 柊元 +クギモト 檞本 +クキヤ 久貴谷 +クキヤ 紣谷(綷谷) +クギヤ 釘谷 +クギヤ 釘屋 +クキヤマ 久木山 +クギヤマ 久木山 +クギヤマ 釘山 +クギヤマ 栓山 +クク 九々 +クク 九九 +クグ 久具 +クグ 久々 +ククウ 久々宇 +クグウ 久々宇 +クグウ 久宮 +ククエ 久々江 +クグエ 久々江 +クグエ 久久江 +ククタ 久々他 +ククチ 久々知 +ククツ 久々津 +ククツ 久久津 +クグツ 久々津 +ククナリ 久々成 +クグノ 久々野 +クグノ 柊野 +ククハラ 久々原 +クグハラ 久々原 +クグハラ 芥原 +ククミナト 久々湊 +ククミナト 久々港 +クグミナト 久々湊 +クグミナト 久久湊 +クグミヤ 久々宮 +クグムタ 莞牟田 +クグヤマ 久々山 +クグヤマ 久具山 +クグリ 九栗 +クグルキ 潜木 +クゲ 久下 +クゲ 久家 +クゲ 公家 +クゲ 久毛 +クゲ 公下 +クゲ 工家 +クゲイ 久下井 +クゲタ 久家田 +クゲヌマ 久下沼 +クゲモト 久下本 +クゲモト 久ケ本 +クケヤ 紣谷(綷谷) +クケン 九軒 +クコ 久古 +クコ 久胡 +クコ 枸杞 +クゴ 久後 +クゴ 久古 +クゴ 久語 +クゴ 久呉 +クゴ 九後 +クゴ 久胡 +クゴ 九護 +クゴイ 𦹀井 +クゴウ 久郷 +クゴウ 九合 +クゴウ 九郷 +クゴウエ 久郷江 +クゴタ 久合田 +クゴタ 工古田 +クゴタ 久郷田 +クゴタニ 久古谷 +クサ 草 +クサ 久佐 +クサ 九佐 +クザ 久佐 +クザ 九座 +クサアイ 草合 +クサイ 草井 +クサウチ 草内 +クサウラ 草浦 +クサオ 草尾 +クサオ 草生 +クサオイ 草生 +クサオカ 草岡 +クサオケ 草桶 +クサカ 日下 +クサカ 久下 +クサカ 草加 +クサカ 久坂 +クサカ 草下 +クサカ 草賀 +クサカ 久佐賀 +クサカ 草鹿 +クサカ 艸香 +クサカ 草香 +クサカ 久阪 +クサカ 草花 +クサカ 艸加 +クサガ 草賀 +クサガ 久佐賀 +クサガ 久左賀 +クサカイ 草皆 +クサカイ 草開 +クサカイ 草階 +クサカイ 草替 +クサカイ 草飼 +クサカイ 日下生 +クサガイ 草皆 +クサガイ 草階 +クサガイ 草飼 +クサガイ 草海 +クサカイシ 日下石 +クサカエ 草替 +クサガキ 草垣 +クサカタ 日下田 +クサカド 草門 +クサカド 草鹿砥 +クサカノ 日下野 +クサカベ 日下部 +クサカベ 草壁 +クサカベ 草部 +クサカベ 日壁 +クサカベ 日下辺 +クサカベ 久坂部 +クサカベ 草下部 +クサカベ 日下邊 +クサカヤ 草茅 +クサカヤ 草萱 +クサガヤ 草谷 +クサガヤ 草ケ谷 +クサガヤ 草茅 +クサカリ 草刈 +クサカリ 草苅 +クサカワ 草川 +クサカワ 草河 +クサカワ 艸川 +クサガワ 草川 +クサガワ 草河 +クサキ 草木 +クサキ 久佐木 +クサキ 草樹 +クサキ 艸木 +クザキ 久崎 +クサキサコ 草木迫 +クサキザコ 草木迫 +クサキダ 草木田 +クサキハラ 草木原 +クサキヨ 草清 +クサキリ 草切 +クサキリ 艸切 +クサギリ 草切 +クサゴウ 草郷 +クササ 九笹 +クザサ 九笹 +クササカ 草坂 +クサザキ 草崎(草嵜) +クサザワ 草沢(草澤) +クサジ 草地 +クサジ 草治 +クサシオ 草塩 +クサシマ 草島 +クサシマ 草嶋 +クサジマ 草島 +クサジマ 草嶋 +クサジマ 草嶌 +クサズミ 草住 +クサセ 草瀬 +クサゾノ 草園 +クサタ 草田 +クサダ 草田 +クサダ 艸田 +クサダ 久佐田 +クサタケ 草竹 +クサタニ 草谷 +クサタニ 草渓(草溪) +クサタニ 艸谷 +クサチ 草地 +クサヂ 草地 +クサツ 草津 +クサツグ 草次 +クサツミ 草摘 +クサヅミ 草積 +クサデ 草出 +クサド 草戸 +クサド 艸戸 +クザト 九里 +クサトウ 草東 +クサドコロ 草処(草處) +クサトミ 草富 +クサトミ 草冨 +クサトメ 草留 +クサドメ 草留 +クサトリ 草取 +クサナ 草名 +クサナガ 草永 +クサナギ 草薙 +クサナギ 草彅 +クサナギ 日柳 +クサナギ 草名木 +クサナギ 草渚 +クサナギ 草摘 +クサナギ 草難 +クサナギ 草剪 +クサナギ 草梛 +クサナギ 艸薙 +クサニシ 草西 +クサヌキ 草貫 +クサノ 草野(艸野) +クサノ 種野 +クサノ 久佐野 +クサノ 苕野 +クサノ 草埜 +クサノイ 草ノ井 +クサノセ 草ノ瀬 +クサノセ 草之瀬 +クサノブ 草信 +クサノミヤ 草ノ宮 +クサバ 草場 +クサバ 草葉 +クサバ 軍場 +クサバ 草羽 +クサバ 草姥 +クサバ 艸場 +クサバ 艸葉 +クサハシ 草橋 +クサハナ 日鼻 +クサバヤシ 艸林 +クサハラ 草原 +クサヒラ 草平 +クサビラキ 草開 +クサブ 草生 +クサフカ 草深 +クサブカ 草深 +クサフク 草福 +クサフサ 草房 +クサベ 草部 +クサベツ 草別 +クサマ 草間 +クサマ 日馬 +クサマ 草馬 +クサマ 艸間 +クサマエ 草前 +クサマキ 草牧 +クサマキ 草巻 +クサマチ 草町 +クサミ 草味 +クサミズ 草水 +クサミチ 草道 +クサミツ 草光 +クサミヤ 草宮 +クサムラ 草村 +クサムラ 叢 +クサモト 草本 +クサモト 草元 +クサモト 蒼下 +クサモリ 草森 +クサヤ 草谷 +クサヤナギ 草柳 +クサヤナギ 日柳 +クサヤマ 草山 +クサヤマ 種山 +クサワ 草生 +クザワ 九沢 +クザワ 九澤 +クサワケ 草分 +クサワケ 草別 +クサワケ 草訳 +クサワケ 艸分 +クサワケ 草譯 +クサワケ 久佐訳 +クサワケ 草創 +クサワケ 幵分 +クシ 久志 +クシ 久司 +クシ 串 +クシ 櫛 +クシ 工士 +クジ 久慈 +クジ 久司 +クジ 久地 +クジ 久滋 +グシ 具志 +グシ 具市 +グジ 具治 +クシイ 櫛井 +クシイ 串井 +クシイ 久志井 +クシウエ 串上 +クシウラ 串浦 +クジウラ 久地浦 +クシオ 串尾 +クシオカ 串岡 +クシオカ 久志岡 +クシオカ 櫛岡 +クジオカ 久地岡 +クシオヤダ 後親田 +クシカ 久鹿 +クシカタ 櫛方 +クシガタ 串形 +グシカタ 具志堅 +クシガミ 串上 +グシカミ 具志頭 +クシカワ 櫛川 +グシカワ 具志川 +クシキ 櫛木 +クシキ 串木 +クシキ 久志木 +クシキノ 串木野 +クシク 櫛来 +クシクラネ 後蔵根 +クシゲ 久重 +クシゲ 櫛下 +クシゲ 櫛笥 +クシゲ 櫛毛 +クシゲ 櫛筍 +クシケズリ 櫛削 +クシケタ 櫛桁 +クシゲタ 櫛桁 +クシゲマチ 櫛下町 +グシケン 具志堅 +クシサカ 串阪 +クシサキ 串崎 +クシザキ 串崎 +クシザキ 櫛崎 +クシシタ 串下 +クシジマ 櫛島 +クシジマ 串島 +クシシモジョウ 後下門 +クシゾノ 串園 +クシタ 櫛田 +クシタ 串田 +クシタ 久下 +クシダ 櫛田 +クシダ 串田 +クシダ 久信田 +クシダ 久志田 +クシダ 九志田 +クジダイ 鬮台(鬮臺) +クシタオ 櫛垰 +クシタニ 櫛谷 +クシタニ 串谷 +グシチャン 具志頭 +クシド 串戸 +グシトウ 具志頭 +クシナ 久品 +クシナガ 櫛永 +クシナカジョウ 後仲門 +クシナカマス 後仲舛 +クシノ 櫛野 +クシノ 串野 +クシノ 久志野 +クシノ 久篠 +グシノ 梙野 +クシノベ 串延 +クシノベ 櫛延 +クシハシ 櫛橋 +クシハシ 串橋 +クシバシ 串橋 +クジハシ 鬮橋 +クシハタ 串畑 +クシハマ 櫛浜 +クシハマ 櫛濱 +グシハマ 後浜 +クシハマジョウ 後浜門(後濱門) +クジバヤシ 久慈林 +クシハラ 櫛原 +クシハラ 串原 +クシヒ 櫛比 +クシヒキ 櫛引 +クシビキ 櫛引 +クシヒラ 串平 +クシブチ 櫛淵 +クシブチ 櫛渕 +クシブチ 串淵 +クシブチ 串渕 +クシベ 櫛部 +クシベ 串部 +クシベ 櫛辺(櫛邉) +クシベ 串辺 +クシマ 久島 +クシマ 串間 +クシマ 九島 +クシマ 久嶋 +クシマ 櫛間 +クシマ 九嶋 +クシマ 玖島 +クシマ 工島 +クシマ 串馬 +クシマ 久嶌 +クシマ 工嶋 +クジマ 久島 +グシマ 具島 +グシマ 具嶋 +グジマ 具島 +グジマ 具嶋 +クシマエ 串前 +クシマタ 櫛股 +クシマチ 串町 +クシマツ 串松 +クシマツ 櫛松 +クシミ 櫛見 +クジミチ 久慈道 +クシミツ 串光 +クシミヤ 串宮 +グシミヤギ 𤘩宮城 +クシムラ 櫛村 +クシムラ 串村 +クシメ 久士目 +クシメ 久志目 +クジメ 久次米 +クジメ 鬮目 +クジメ 久治米 +クジメ 久次目 +クジメ 䦰目 +クジメ 九次米 +クシモト 久志本 +クシモト 櫛本 +クシモト 串本 +クシモト 久士本 +クシモト 串元 +クシヤ 櫛谷 +クシヤ 櫛屋 +クシヤ 櫛舎 +クシヤシキ 櫛屋敷 +クシヤマ 櫛山 +クシヤマ 串山 +クシャマエ 九社前 +クジャマエ 九社前 +クジュウ 九重 +クジュウ 九十 +クジュウジ 九重地 +クジュウブ 九十歩 +クジュウロ 久住呂 +クジュウロ 久重路 +クジュウロ 九重路 +クジュロ 久住呂 +クショウ 久生 +クジョウ 久常 +クジョウ 久城 +クジョウ 公庄 +クジョウ 九条 +クジョウ 九城 +クジョウ 九條 +クジョウ 公荘 +グジョウ 公庄 +グジョウ 郡上 +クジラ 鯨 +クジラ 久知良 +クジラ 久地楽 +クジライ 鯨井 +クジラオ 鯨尾 +クジラオカ 鯨岡 +クジラサキ 鯨崎 +クジラダ 鯨田 +クジラナミ 鯨波 +クジラヤ 鯨谷 +クシロ 久代 +クシロ 久城 +クシロ 鳩代 +クシロ 九城 +クシロ 久白 +クシロ 玖代 +クシンダ 久信田 +クス 楠 +クス 樟 +クス 玖須 +クス 久須 +クス 久寿 +クス 久壽 +クズ 葛 +クズ 久津 +クズ 九頭 +クズ 國栖 +クスイ 楠井 +クスイ 久水 +クスイ 楠居 +クスイ 久寿居(久壽居) +クズイ 葛井 +クスイシ 楠石 +クズウ 葛生 +クズウ 葛宇 +クスウラ 楠浦 +クスエ 楠江 +クスエ 楠枝 +クズエ 葛江 +クスオ 楠生 +クスオ 楠尾 +クズオ 葛生 +クズオ 葛尾 +クズオ 車尾 +クスオカ 楠岡 +クズオカ 葛岡 +クスオク 楠奥 +クスカゲ 楠蔭 +クスカゲ 楠陰 +クズカゲ 葛蔭 +クズカタ 葛形 +クズガタ 葛形 +クスカミ 楠神 +クスカミ 楠上 +クスガミ 楠神 +クスガミ 楠上 +クズカミ 葛上 +クズカミ 葛神 +クズガミ 葛上 +クズガミ 葛神 +クスカメ 楠亀 +クスガヤ 楠ケ谷 +クスカワ 楠川 +クスガワ 楠川 +クズカワ 葛川 +クスキ 楠 +クスキ 楠木 +クスキ 楠亀 +クスキ 楠城 +クスキ 久須木 +クスキ 楠樹 +クスギ 久杉 +クズキ 葛城 +クズキ 工月 +クスク 楠久 +グスク 城 +クスグチ 楠口 +クズグチ 葛口 +クスクボ 楠窪 +クスクボ 久須窪 +クズクボ 葛窪 +グスクマ 城間 +クスクラ 楠倉 +クスゲ 楠毛 +クスゴ 楠後 +クスザカ 楠坂 +クズサカ 葛坂 +クスサキ 楠崎 +クスザキ 楠崎 +クスザキ 楠嵜 +クズサキ 葛崎 +クスサコ 楠浴 +クズサコ 葛迫 +クスザワ 楠沢 +クスザワ 楠澤 +クスシタ 楠下 +クズシタ 葛下 +クスシマ 楠島 +クスジマ 楠島 +クズシマ 葛島 +クズシマ 葛嶋 +クスセ 楠瀬 +クスゾノ 楠園 +クスタ 楠田 +クスダ 楠田 +クスダ 久須田 +クスダ 久寿田 +クスダ 樟田 +クスダ 楠多 +クズタ 葛田 +クスタキ 楠滝 +クスタキ 楠瀧 +クスタニ 楠谷 +クズタニ 葛谷 +クズタニ 工頭谷 +クスダン 楠段 +クステル 楠照 +クスド 楠戸 +クスド 楠土 +クスドウ 楠堂 +クストミ 楠富 +クスナ 楠名 +クズナ 久津名 +クズナ 葛声 +クズナイ 久都内 +クスナガ 楠永 +クズニシ 葛西 +クズヌキ 葛貫 +クスネ 楠根 +クズネ 葛根 +クスノ 楠野 +クズノ 葛野 +クスノイ 楠井 +クスノエ 楠江 +クスノキ 楠 +クスノキ 楠木 +クスノキ 樟 +クスノキ 楠之木 +クスノキ 楠ノ木 +クスノキゾノ 楠木園 +クスノキタニ 楠木谷 +クスノセ 楠瀬 +クスノセ 樟瀬 +クスノセ 楠ノ瀬 +クスノダ 楠田 +クズノタニ 葛野谷 +クズノハ 葛葉 +クスバ 楠葉 +クズハ 葛葉 +クズハ 葛羽 +クズバ 葛葉 +クズバ 崩場 +クスバエ 楠生 +クスバエ 楠八重 +クスハシ 楠橋 +クスバシ 楠橋 +クスハタ 楠畑 +クスバタ 楠畑 +クズハタ 葛畑 +クズハナ 葛花 +クスバヤシ 楠林 +クスハラ 楠原 +クスハラ 樟原 +クズハラ 葛原 +クスバル 楠原 +クスヒラ 楠平 +クズヒラ 葛平 +クスベ 楠部 +クスホリ 楠堀 +クスボリ 楠堀 +クズホリ 葛堀 +クスマ 楠間 +クズマ 久津間 +クズマ 葛間 +クズマ 葛馬 +クズマ 久津摩 +クスマエ 楠前 +クズマキ 葛巻(葛卷) +クスマチ 楠待 +クスマル 楠円 +クスマル 楠丸 +クスマル 楠圓 +クズマル 葛丸 +クスミ 久住 +クスミ 楠見 +クスミ 楠美 +クスミ 久須美 +クスミ 久角 +クスミ 久須見 +クスミ 九角 +クスミ 久隅 +クスミ 久寝 +クスミ 久栖 +クスミ 久墨 +クスミ 九首見 +クスミ 楠実 +クズミ 久住 +クズミ 葛見 +クズミ 九頭見 +クズミ 瞿曇 +クズミ 九住 +クズミ 葛美 +クズミ 久頭見 +クスミカワ 久住川 +クスミネ 楠嶺 +クズミヤ 葛宮 +クスムラ 楠村 +クズムラ 葛村 +クスムレ 楠牟礼(楠牟禮) +クスメ 楠目 +クズメ 楠目 +クズメ 葛目 +クスメキ 久寿米木 +クスメキ 久壽米木 +クスメギ 久寿米木 +クスメギ 久壽米木 +クスモ 楠茂 +クズモ 車尾 +クスモト 楠本 +クスモト 楠元 +クスモト 樟本 +クスモト 久須本 +クスモト 玖珠本 +クズモト 葛本 +クスモリ 楠森 +クスヤ 楠谷 +クスヤ 楠家 +クスヤ 楠屋 +クズヤ 葛谷 +クズヤ 葛屋 +クズヤ 久津屋 +クズヤ 棒屋 +クスヤエ 楠八重 +クズヤブ 葛薮 +クスヤマ 楠山 +クスヤマ 樟山 +クズヤマ 葛山 +クスリ 久寿里 +クスリ 薬 +クズリュウ 九頭竜 +クズリュウ 九頭龍 +クズリュウザカ 九頭竜坂 +クズリュウザカ 九頭龍坂 +クズレ 崩 +クスロ 久住呂 +クズロ 久津呂 +クズワ 葛和 +クズワ 葛輪 +クスワキ 楠脇 +クズワタ 葛綿 +クセ 久世 +クセ 久瀬 +クセ 苦瀬 +クセ 久笹 +クゼ 久世 +クゼ 久瀬 +グゼ 宮所 +クセイ 久生 +クセガワ 久瀬川 +クゼガワ 久瀬川 +クセタニ 久世谷 +クセンボウ 九千房 +グソク 具足 +グソクジマ 具足島 +クダ 久田 +クダ 九田 +クダ 玖田 +グダ 具田 +クダイ 工代 +クダイシ 下石 +クダイラ 工平 +クタカ 久高 +クダカ 久高 +クダカ 九高 +クダキ 管木 +クダシゲ 降重 +クダナミ 管波 +クタニ 久谷 +クタニ 九谷 +クタニ 工谷 +グタニ 具谷 +クタニダ 九谷田 +クダハラ 久田原 +クダマ 久玉 +クダマ 九玉 +クダマツ 下松 +クダマツ 久田松 +クダマツ 降松 +クダマツヤ 下松谷 +クタミ 朽網 +クタミ 久田見 +クタミ 久多見 +クタミ 久民 +クタミ 朽綱 +クダヤマ 管山 +クタラ 久楽 +クタラ 久樂 +クダラ 百済 +クダラ 久楽 +クダラ 久多良 +クダラ 百濟 +クダラ 久樂 +クタラキ 久多良木(久夛良木) +クタラギ 久多良木(久夛良木) +クタラギ 久多羅木 +クタラギ 久多羅岐 +クタラギ 久多良岐 +クダリ 下里 +クダリ 久多里 +クダリ 下り +クダリ 久田里 +クダワラ 久田原 +クタンダ 九反田 +クチ 口 +クチイ 口井 +クチイ 久池井 +クチイ 久地井 +クチイケ 口池 +クチイシ 口石 +クチイシ 久地石 +クチイワ 口岩 +クチウラ 久地浦 +クチオ 口尾 +クチオカ 久地岡 +クチオカ 久池岡 +クチガウチ 口垣内 +クチカタ 朽方 +クチカワ 口川 +クチキ 朽木 +クチキ 口木 +クチキ 𣏓木 +クチキ 杇木 +クチクラ 口蔵(口藏) +クチゴウチ 口垣内 +クチザキ 杇崎 +クチザワ 口沢(口澤) +クチジ 口地 +クチスボ 口寸保 +クチタ 口田 +クチダ 口田 +クチタニ 口谷 +クチタニ 朽谷 +クチヂ 口地 +クチツ 朽津 +クチツカ 口塚 +クチデ 口出 +クチデ 口手 +クチトリ 口取 +クチナ 朽名 +クチナカ 口中 +クチナカミチ 口中道 +クチナシ 口無 +クチナシ 梔 +クチニシ 口西 +クチノ 口野 +クチノマチ 口ノ町 +クチノマチ 口之町 +クチハ 口羽 +クチバ 口羽 +クチバ 朽葉 +クチバヤシ 口林 +クチハラ 朽原 +クチハラ 口原 +クチヒロ 口広 +クチヒロ 口廣 +クチビロ 口広 +クチフネ 口船 +クチブネ 口舩 +クチマチ 口町 +クチマル 口丸 +クチミ 朽見 +クチミネ 口峯 +クチムラ 口村 +クチモト 口元 +クチモト 口本 +クチヤ 口屋 +クチヤ 朽谷 +クチヤマ 口山 +クチュウ 工忠 +クチョウ 九町 +クチラ 久知良 +クヂラ 久地楽 +クチワ 口輪 +クチワキ 口脇 +クチワノ 口輪野 +クツ 沓 +クツ 工津 +クヅ 久津 +クツウチ 沓内 +クツオカ 屈岡 +クツオカ 久津岡 +クヅオカ 久津岡 +クツカケ 沓掛 +クツカタ 朽方 +クツガタ 沓形 +クツカムリ 沓冠 +クツカワ 沓川 +クツカワ 久津川 +クツキ 朽木 +クツキ 沓木 +クツキ 𣏓木 +クツキ 久津木 +クツギ 朽木 +クヅキ 工月 +クヅキ 公月 +クツサワ 沓沢 +クツサワ 沓澤 +クツザワ 沓沢 +クツザワ 沓澤 +クツザワ 久津沢(久津澤) +クツダ 久津田 +クツタニ 久津谷 +クツタニ 沓谷 +クツナ 沓名 +クツナ 忽那 +クツナ 朽名 +クツナ 久綱 +クツナ 久津那 +クツナ 久津名 +クツナ 九綱 +クツナ 惣那 +クツナ 怱那 +クツナイ 沓内 +クツナイ 久都内 +クツナイ 久津内 +クツヌギ 沓脱 +クツヌギ 沓抜 +クツノ 沓野 +クツノ 久津野 +クツノヤ 沓ノ屋 +クツノヤ 沓屋 +クツハラ 朽原 +クツバリ 沓張 +クツボ 九坪 +クツマ 久津間 +クツマ 沓間 +クツマ 久津摩 +クツマ 久都間 +クヅマ 久津間 +クヅマ 久津摩 +クツミ 久津見 +クツミ 沓水 +クツミ 九頭見 +クツミ 九津見 +クツミ 朽見 +クツミ 久津美 +クツミ 玖津見 +クツミ 沓見 +クツミズ 沓水 +クツムカイ 沓向 +クツムラ 沓村 +クツメ 久詰 +クツヤ 久津屋 +クツヤマ 沓山 +クヅレ 久津礼 +クツロ 久津呂 +クヅロ 久津呂 +クツワ 久津輪 +クツワ 轡 +クツワ 久津和 +クツワ 履輪 +クツワタ 轡田 +クツワダ 轡田 +クツワヌキ 轡貫 +クツワミ 轡見 +クテ 久手 +クデ 公手 +クデ 久手 +クデ 久出 +クデ 九手 +クテガワ 久手川 +クデガワ 久出川 +クテケン 久手堅 +クデケン 久手堅 +クデン 久田 +クデン 工伝 +クト 久斗 +クド 久土 +クド 久渡 +クド 久都 +クトウ 工藤 +クトウ 久藤 +クトウ 宮東 +クトウ 久東 +クトウ 九東 +クドウ 工藤 +クドウ 久藤 +クドウ 久道 +クドウ 宮藤 +クドウ 宮東 +クドウ 貢藤 +クドウ 久東 +クドウ 工東 +クドウ 久渡 +クドウ 九藤 +クドウ 工道 +クドウ 宮籐 +クドウ 区藤 +クドウ 工通 +クドウ 工棟 +クドウ 區藤 +グトウ 具藤 +グトウ 具頭 +クドオ 竃尾 +クトク 九徳 +クトセ 久戸瀬 +クドセ 久戸瀬 +クドチ 久土地 +クトミ 久富 +クトミ 久冨 +クトミ 九富 +クトミ 九冨 +クトミ 工富 +クドミ 久富 +クドミ 久冨 +クトメ 久留 +クドメ 久留 +クドメ 久土目 +クドモト 久登本 +クドン 瞿曇 +クナ 久七 +クナイ 宮内 +クナイ 久内 +クナイ 九内 +クナイ 工内 +クナガ 工永 +クナギ 久名木 +クナミ 工並 +クニ 国 +クニ 邦 +クニ 國 +クニ 久仁 +クニ 久迩(久邇) +クニ 九二 +クニイ 国井 +クニイ 國井 +クニイ 国居 +クニイ 國居 +クニイ 国ヰ +クニイエ 国家 +クニイエ 國家 +クニイシ 国石 +クニイシ 國石 +クニウ 国宇 +クニウチ 国裡 +クニウラ 国浦 +クニエ 国江 +クニエ 國江 +クニエ 国恵 +クニエダ 国枝 +クニエダ 國枝 +クニエダ 邦枝 +クニオ 国尾(國尾) +クニオカ 国岡 +クニオカ 國岡 +クニオカ 邦岡 +クニオキ 国沖 +クニオキ 國沖 +クニオク 国奥(国奧) +クニオク 國奥 +クニカ 国香 +クニカ 國賀 +クニカ 國香 +クニガ 国賀 +クニガ 國賀 +クニカゲ 国影(國影) +クニカタ 国方 +クニカタ 國方 +クニカド 国門 +クニカド 國門 +クニカネ 国兼 +クニカネ 国金 +クニカネ 國兼 +クニカネ 国包 +クニカネ 國金 +クニカネ 國包 +クニガネ 国兼 +クニガネ 国金 +クニガネ 國兼 +クニガネ 國金 +クニカミ 国上 +クニカミ 國上 +クニガミ 国頭 +クニガミ 国上 +クニガミ 國頭 +クニガミ 國上 +クニガラ 国柄 +クニガラ 國柄 +クニカワ 国川 +クニカワ 國川 +クニカワ 邦川 +クニキ 国生 +クニキ 国木 +クニキ 國生 +クニキ 国樹 +クニキ 國木 +クニキ 國樹 +クニキ 国城 +クニキタ 槲田 +クニキタ 国木田(國木田) +クニキタ 国北 +クニキタ 國北 +クニキダ 国木田(國木田) +クニキダ 榿田 +クニギタ 椚田 +クニギタ 欅田 +クニギダ 欅田 +クニギダ 槲田 +クニキヨ 国清 +クニキヨ 國清 +クニキョウ 国京 +クニキョウ 國京 +クニクボ 国久保 +クニクボ 國久保 +クニコ 国子 +クニゴウ 救仁郷 +クニコシ 国越 +クニコシ 國越 +クニサ 国狭(国狹・國狹) +クニサ 国佐(國佐) +クニサ 國狭 +クニサカ 国坂 +クニサカ 國坂 +クニサキ 国崎 +クニサキ 国東 +クニサキ 國崎 +クニサキ 国嵜 +クニサキ 國東 +クニサキ 國嵜 +クニザキ 国崎 +クニザキ 國崎 +クニザキ 國嵜 +クニサダ 国定 +クニサダ 国貞 +クニサダ 國定 +クニサダ 國貞 +クニサト 国里 +クニサト 國里 +クニザネ 国実 +クニザネ 國實 +クニザネ 國実 +クニサワ 国沢 +クニサワ 國澤 +クニサワ 国澤 +クニサワ 國沢 +クニザワ 国沢 +クニザワ 國澤 +クニザワ 国澤 +クニザワ 國沢 +クニシ 国司 +クニシ 国師 +クニシ 國司 +クニシ 久西 +クニシ 国志 +クニシ 國師 +クニシ 工西 +クニシ 國志 +クニシ 國西 +クニジ 国次 +クニシオ 国塩 +クニシオ 國塩 +クニシゲ 国重 +クニシゲ 國重 +クニシゲ 国繁 +クニシゲ 邦重 +クニシゲ 國繁 +クニシタ 国下 +クニシタ 國下 +クニシダ 国司田 +クニシダ 國司田 +クニシバ 国柴 +クニシマ 国島 +クニシマ 国嶋 +クニシマ 國島 +クニシマ 國嶋(國嶌) +クニシマ 国嶌 +クニジマ 国島 +クニジマ 国嶋 +クニジマ 國島 +クニジマ 國嶋(國嶌) +クニショウ 国正 +クニショウ 國正 +クニシロ 国代 +クニシロ 国城 +クニシロ 國代 +クニス 国須(國須) +クニス 国栖 +クニス 國栖 +クニスエ 国末 +クニスエ 国居 +クニスエ 國末 +クニスエ 國居 +クニスエ 国陶 +クニスエ 國陶 +クニズカ 国塚 +クニズカ 國塚 +クニスギ 国杉 +クニスケ 国祐(國祐) +クニスミ 国住(國住) +クニズミ 国住(國住) +クニセ 国瀬(國瀬) +クニゾエ 国副(國副) +クニタ 国田 +クニタ 國田 +クニタ 国多 +クニタ 國多 +クニダ 国田 +クニダ 國田 +クニタカ 国高 +クニタカ 邦高 +クニタカ 國高 +クニタキ 国滝(國瀧) +クニタケ 国武 +クニタケ 國武 +クニタケ 国竹 +クニタケ 國竹 +クニタケ 国嶽 +クニタケ 邦武 +クニタダ 国只 +クニタダ 国忠 +クニタダ 国唯(國唯) +クニタダ 國只 +クニタダ 國忠 +クニタチ 國立 +クニタテ 国立 +クニタテ 國立 +クニタニ 国谷 +クニタニ 國谷 +クニタニ 国溪(国渓) +クニタマ 国玉 +クニタマ 國玉 +クニタン 国丹(國丹) +クニチ 九日 +クニチ 国知 +クニチ 國知 +クニチカ 国近 +クニチカ 國近 +クニチカ 邦近 +クニチデ 国知出 +クニチデ 國知出 +クニツ 国津 +クニツ 國津 +クニツカ 国塚 +クニツカ 国柄 +クニツカ 國塚 +クニツカ 國柄 +クニヅカ 国塚 +クニヅカ 国柄 +クニヅカ 國塚 +クニツグ 国次 +クニツグ 国続 +クニツグ 國次 +クニツネ 国常 +クニツネ 國常 +クニデ 国出(國出) +クニト 国戸(國戸) +クニト 國土 +クニト 国渡 +クニトウ 国藤 +クニトウ 国頭 +クニトウ 国東 +クニトウ 國藤 +クニトウ 國頭 +クニトウ 国遠 +クニトウ 国当 +クニトウ 國東 +クニトウ 國遠 +クニトウ 國當 +クニトオ 国遠 +クニトオ 國遠 +クニトキ 国時(國時) +クニトク 国徳 +クニトク 國徳 +クニトシ 国年 +クニトシ 国俊 +クニトシ 国利 +クニトシ 国歳 +クニトシ 國利 +クニトシ 國俊 +クニトシ 國年 +クニトミ 国富 +クニトミ 國富 +クニトミ 国冨 +クニトミ 國冨 +クニドミ 國冨 +クニトモ 国友 +クニトモ 國友 +クニトモ 国鞆 +クニトモ 邦友 +クニナカ 国仲 +クニナカ 国中 +クニナカ 國中 +クニナカ 國仲 +クニナガ 国永 +クニナガ 国長 +クニナガ 國永 +クニナガ 邦永 +クニナガ 國長 +クニナリ 国成 +クニニシ 国西 +クニニシ 國西 +クニノ 国野 +クニノ 國野 +クニノ 国乃 +クニノジュウ 国ノ十 +クニノジュウ 国ノ重 +クニノジュウ 國ノ十 +クニノブ 国信 +クニノブ 国延 +クニノブ 國信 +クニノブ 國延 +クニノベ 国延 +クニノベ 國延 +クニノリ 国則 +クニノリ 国乗(國乘) +クニノリ 國則 +クニノリ 國乗 +クニバ 国場 +クニバ 國場 +クニバ 国馬 +クニバ 國馬 +クニハシ 国橋 +クニハシ 國橋 +クニハタ 邦幡 +クニハマ 国浜 +クニバヤシ 国林 +クニハラ 国原 +クニハラ 椢原 +クニハラ 國原 +クニハラ 槶原 +クニハル 国治 +クニハル 國治 +クニヒサ 国久 +クニヒサ 國久 +クニヒラ 国平 +クニヒラ 國平 +クニヒロ 国広 +クニヒロ 国弘 +クニヒロ 國廣 +クニヒロ 國弘 +クニヒロ 国廣 +クニヒロ 國広 +クニブ 国分 +クニブ 國分 +クニフサ 国房 +クニフサ 國房 +クニフジ 国藤 +クニフジ 國藤 +クニフダ 国府田 +クニフダ 國府田 +クニベ 国部 +クニベ 國部 +クニマサ 国政 +クニマサ 国正 +クニマサ 國政 +クニマサ 國正 +クニマス 国益 +クニマス 国増 +クニマス 国舛 +クニマス 国桝 +クニマス 國舛 +クニマス 國増 +クニマス 國桝 +クニマタ 国又 +クニマタ 國又 +クニマツ 国松 +クニマツ 國松 +クニマル 国丸 +クニマル 國丸 +クニミ 国見 +クニミ 国実 +クニミ 國見 +クニミ 國實 +クニミガワ 国見川(國見川) +クニミツ 国光 +クニミツ 國光 +クニミツ 国満 +クニミツ 邦光 +クニミツ 國滿 +クニミナト 久々湊 +クニミネ 国峰 +クニミネ 国峯 +クニミネ 國峰 +クニミネ 國峯 +クニムネ 国宗 +クニムネ 國宗 +クニムラ 国村 +クニムラ 國村 +クニムラ 国邑 +クニムラ 邦村 +クニムラ 國邑 +クニモチ 国持 +クニモチ 國持 +クニモト 国本 +クニモト 國本 +クニモト 国元 +クニモト 邦本 +クニモト 國元 +クニモリ 国森 +クニモリ 国守 +クニモリ 國森 +クニモリ 国盛 +クニモリ 國守 +クニモリ 國盛 +クニヤ 国谷 +クニヤ 國谷 +クニヤ 国屋 +クニヤ 国家 +クニヤ 国矢 +クニヤ 國屋 +クニヤス 国安 +クニヤス 国保 +クニヤス 國安 +クニヤス 國保 +クニヤダ 国矢田(國矢田) +クニヤマ 国山 +クニヤマ 晋山 +クニヤマ 國山 +クニヤマ 邦山 +クニュウダ 口入田 +クニユキ 国行 +クニユキ 國行 +クニヨシ 国吉 +クニヨシ 國吉 +クニヨシ 国好 +クニヨシ 国芳 +クニヨシ 國好 +クニヨシ 國芳 +クニヨシ 城吉 +クニヨセ 国寄(國寄) +クニヨリ 国寄(國寄) +クニヨリ 国頼 +クニワ 国和 +クニワ 國和 +クニワキ 国脇 +クニワキ 國脇 +クニワケ 国分 +クニワケ 國分 +クニワケ 国頒 +クヌキ 九貫 +クヌキ 久貫 +クヌギ 椚 +クヌギ 功力 +クヌギ 樟 +クヌギ 檞 +クヌギ 久貫 +クヌギ 功刃 +クヌギ 桾 +クヌギ +クヌギオ 檪尾 +クヌギオ 櫟尾 +クヌギオ 欅尾 +クヌギザ 椚座 +クヌギサワ 椹沢(椹澤) +クヌギセ 椚瀬 +クヌギタ 椚田 +クヌギタ 欅田 +クヌギダ 槲田 +クヌギダ 椚田 +クヌギダ 欅田 +クヌギタニ 椚谷 +クヌギハラ 椚原 +クヌギハラ 檞原 +クヌギモト 桾本 +クヌギモト 檞本 +クヌギヤ 檞谷 +クヌギヤマ 樟山 +クヌギヤマ 椚山 +クヌギヤマ 橺山 +クネ 久根 +クネウチ 久根内 +クネキ 久根木 +クネギ 久根木 +クネグチ 久根口 +クネサキ 久根崎 +クネザキ 久根崎 +クネジ 久根次 +クネシタ 久根下 +クネゾエ 久根添 +クネタ 久禰田 +クネタ 久祢田 +クネダ 久祢田 +クネダ 久根田 +クネマ 久根間 +クネモト 久根本 +クノ 久野 +クノ 久納 +クノ 久能 +クノ 九野 +クノ 工野 +クノ 久埜 +クノ 求野 +クノ 椹野 +クノ 九埜 +クノ 玖野 +クノイ 久野井 +クノイケ 九之池 +クノイケ 九ノ池 +クノウ 久納 +クノウ 久能 +クノウ 九重 +クノウ 公納 +クノウ 工納 +クノウ 九能 +クノウ 工能 +クノウチ 工内 +クノキ 久野木 +クノキ 久能木 +クノキ 柊木 +クノキ 柊ノ木 +クノギ 久木 +クノギ 久野木 +クノギ 樟 +クノギ 久能木 +クノギ 九野木 +クノギ 桾木 +クノサカ 九野坂 +クノセ 久野瀬 +クノダ 久野田 +クノタニ 九重谷 +クノツボ 久ノ坪 +クノツボ 九之坪 +クノツボ 久之坪 +クノヘ 九戸 +クノムラ 久野村 +クノリ 久徳 +クノリ 九里 +クノリ 久乗 +クノリ 九法 +クノリ 九ノ里 +クノリ 九野里 +クノリ 九乗 +クノリ 久乘 +クバ 久場 +クバ 久芳 +クバ 久葉 +クバ 久羽 +クバ 久波 +クバ 玖波 +クバ 工波 +クバイ 玖波井 +クバカワ 久場川 +クバガワ 久場川 +クバシマ 久場島 +クバジマ 久場島 +クハタ 久畑 +クバタ 久畑 +クバタ 工畑 +クバヤシ 久林 +クハラ 久原 +クハラ 九原 +クハラ 工原 +クハラ 具原 +クバラ 久原 +クバル 久原 +クビウラ 首浦 +クビシロ 首代 +クビタ 首田 +クビタオ 首田尾 +クヒョウ 九俵 +クブキ 久冨木 +クブキ 久富木 +クブキ 久冨貴 +クフキハラ 久冨木原 +クフキハラ 久富木原 +クブキハラ 久冨木原 +クブキハラ 久富木原 +クフシロ 久布白 +クブシロ 久布白 +クブシロ 久武城 +クブタ 口分田 +クブツ 久佛 +クブツ 久仏 +クブラ 久部良 +クベ 久辺(久邊) +クボ 久保 +クボ 窪 +クボ 久芳 +クボ 久宝(久寳) +クボ 工保 +クボ 久穂 +クボ 九保 +クボ 供保 +クボ 久甫 +クボ 久寶 +クボ 九穂 +クボ 玖保 +クボ 公保 +クボアキ 久保秋 +クボイ 久保井 +クボイ 窪井 +クボイ 久保居 +クボイケ 久保池 +クボイケ 窪池 +クボイシ 久保石 +クボイチ 久保市 +クボウ 久芳 +クボウ 久宝(久寳) +クボウ 久坊 +クボウ 久防 +クボウ 公方 +クボウ 公望 +クボウエ 窪上 +クボウチ 窪内 +クボウチ 久保内 +クボウラ 久保浦 +クボウラ 窪浦 +クボエ 久保江 +クボエ 窪江 +クボオ 久保尾 +クボオ 窪尾 +クボオカ 久保岡 +クボオカ 窪岡 +クボオク 久保奥 +クボガイチ 窪垣内 +クボガウチ 窪垣内 +クボガキ 久保柿 +クボカキウチ 窪垣内 +クボガキウチ 窪垣内 +クボガシラ 久保頭 +クボガタ 久保形 +クボカミ 久保上 +クボカミ 窪上 +クボガミ 久保上 +クボガミ 窪上 +クボカワ 久保川 +クボカワ 窪川 +クボカワ 久保河 +クボカワ 久甫川 +クボカワ 窪河 +クボカワウチ 久保河内 +クボカワチ 久保河内 +クボガワラ 窪川原 +クボキ 久保木 +クボキ 窪木 +クボキ 窪喜 +クボキ 窪城 +クボキタ 窪北 +クボグチ 久保口 +クボグチ 窪口 +クボクラ 久保倉 +クボクラ 窪倉 +クボケ 久保毛 +クボコウチ 久保河内 +クボゴウチ 久保河内 +クボコヤ 窪小谷 +クボサカ 久保坂 +クボサカ 窪坂 +クボサキ 久保崎 +クボサキ 窪崎 +クボザキ 久保崎 +クボサワ 久保沢 +クボサワ 窪沢 +クボサワ 窪澤 +クボサワ 久保澤 +クボシ 九星 +クボジ 久保寺 +クボシキ 久保敷 +クボシタ 久保下 +クボシタ 窪下 +クボシマ 久保島 +クボシマ 窪島 +クボシマ 久保嶋 +クボシマ 窪嶋 +クボジマ 久保島 +クボジマ 窪島 +クボジマ 久保嶋 +クボジョ 久保処 +クボジリ 久保尻 +クボシロ 久布白 +クボシロ 久保白 +クボスギ 久保杉 +クボスミ 久保隅 +クボセ 窪瀬 +クボセ 久保世 +クボセ 久保瀬 +クボセ 窪世 +クボゾエ 窪添 +クボゾエ 久保添 +クボソノ 久保園 +クボソノ 久保薗 +クボゾノ 久保園 +クボゾノ 窪園 +クボゾノ 久保薗 +クボゾノ 窪薗 +クボタ 久保田 +クボタ 窪田 +クボタ 久保多 +クボタ 窪多 +クボタ 窪夛 +クボタカ 久保高 +クボタニ 久保谷 +クボタニ 窪谷 +クボタマイ 久保玉井 +クボチ 窪地 +クボチ 久保地 +クボチ 窪池 +クボツ 窪津 +クボツ 久保津 +クボツカ 窪塚 +クボツカ 久保塚 +クボヅカ 窪塚 +クボヅカ 久保塚 +クボツチ 窪土 +クボデ 久保出 +クボデ 窪出 +クボテラ 久保寺 +クボテラ 窪寺 +クボデラ 久保寺 +クボデラ 窪寺 +クボト 久保戸 +クボトク 窪徳 +クボナカ 久保中 +クボナカ 窪中 +クボナガ 久保長 +クボナガ 久保永 +クボニシ 久保西 +クボニシ 窪西 +クボニワ 久保庭 +クボニワ 窪庭 +クボヌマ 久保沼 +クボノ 窪野 +クボノ 久保野 +クボノ 久保埜 +クボノウチ 窪之内 +クボノウチ 窪ノ内 +クボノキ 枋木 +クボノメ 窪目 +クボノヤ 窪谷 +クボノヤ 久保野谷 +クボノヤ 久保ノ谷 +クボハタ 窪畑 +クボハラ 久保原 +クボハラ 窪原 +クボヒラ 久保平 +クボフチ 久保渕 +クボブチ 久保渕 +クボブチ 久保淵 +クボホリ 窪堀 +クボマエ 窪前 +クボマツ 窪松 +クボマツ 久保松 +クボミ 久保見 +クボミ 窪美 +クボミ 窪見 +クボミチ 窪道 +クボミチ 久保道 +クボミヤ 久保宮 +クボミヤ 窪宮 +クボムキ 久保向 +クボムラ 久保村 +クボムラ 窪村 +クボメ 窪目 +クボメ 久保目 +クボモト 久保本 +クボモト 久保元 +クボモト 窪本 +クボモト 窪元 +クボモリ 窪森 +クボヤ 久保谷 +クボヤ 窪谷 +クボヤシキ 久保屋敷 +クボヤブ 窪薮 +クボヤブ 窪藪 +クボヤマ 久保山 +クボヤマ 窪山 +クボリ 久堀 +クボリ 久保利 +クボリ 窪利 +クボリ 九堀 +クボリ 久掘 +クボワキ 久保脇 +クボワク 窪和久 +クマ 久間 +クマ 熊 +クマ 隈 +クマ 久万 +クマ 九間 +クマ 久磨 +クマ 久萬 +クマイ 熊井 +クマイ 隈井 +クマイ 熊居 +クマイ 隈伊 +クマイエ 熊家 +クマイシ 熊石 +クマイチ 熊一 +クマイド 熊井戸 +クマウエ 隈上 +クマウチ 熊内 +クマウラ 熊浦 +クマエ 隈江 +クマエ 熊江 +クマオ 熊尾 +クマオ 熊生 +クマオ 久間生 +クマオウ 熊王 +クマオカ 熊岡 +クマオカ 熊狼 +クマオカ 隈岡 +クマガ 熊賀 +クマガイ 熊谷 +クマガイ 隈谷 +クマガイ 熊ケ井 +クマガエ 熊谷 +クマガサコ 熊ケ迫 +クマガタニ 熊ケ谷 +クマカミ 熊上 +クマガミ 熊耳 +クマガミ 熊上 +クマガミ 隈上 +クマガミ 熊ケ耳 +クマガヤ 熊谷 +クマガヤ 熊ケ谷 +クマカワ 熊川 +クマカワ 隈川 +クマカワ 隈河 +クマカワ 熊河 +クマガワ 熊川 +クマガワ 隈川 +クマガワ 隈河 +クマガワ 久万川 +クマガワ 熊河 +クマガワ 求磨川 +クマガワ 求麻川 +クマガワ 球磨川 +クマガワ 求广川 +クマキ 熊木 +クマキ 熊城 +クマキ 久間木 +クマキ 熊喜 +クマギ 熊木 +クマギシ 熊岸 +クマキュウ 熊給 +クマキリ 熊切 +クマギリ 熊切 +クマグチ 熊口 +クマクボ 熊久保 +クマクラ 熊倉 +クマクラ 久間倉 +クマクラ 隈倉 +クマクラ 熊鞍 +クマグラ 熊倉 +クマゲ 熊毛 +クマゴウ 熊郷 +クマコシ 熊越 +クマゴシ 熊越 +クマゴリ 熊凝 +クマサ 熊佐 +クマサカ 熊坂 +クマサカ 隈坂 +クマザカ 熊坂 +クマサキ 熊崎 +クマサキ 隈崎 +クマサキ 熊嵜 +クマサキ 隈嵜 +クマザキ 熊崎 +クマザキ 隈崎 +クマザキ 熊埼 +クマサコ 熊迫 +クマザコ 熊迫 +クマササ 熊笹 +クマザサ 熊笹 +クマサト 隈郷 +クマザト 熊里 +クマサワ 熊沢 +クマサワ 熊澤 +クマザワ 熊沢 +クマザワ 熊澤 +クマザワ 久万沢 +クマザワ 隈澤 +クマザワ 久万澤 +クマザワ 隈沢 +クマジ 熊地 +クマシオ 熊塩 +クマシゲ 熊重 +クマシタ 熊下 +クマシタ 隈下 +クマシマ 熊島 +クマシマ 熊嶋 +クマジマ 熊島 +クマショウ 熊庄 +クマシロ 神代 +クマシロ 熊代 +クマシロ 熊城 +クマシロ 熊白 +クマス 熊須 +クマス 久万寿(久萬壽) +クマズ 熊頭 +クマズミ 熊住 +クマセ 熊瀬 +クマセ 久間瀬 +クマセガワ 熊瀬川 +クマゼン 熊膳 +クマゼン 熊善 +クマゾエ 熊添 +クマゾエ 熊副 +クマゾノ 隈園 +クマタ 熊田 +クマタ 隈田 +クマタ 久万田 +クマタ 久間田 +クマタ 杭全 +クマダ 熊田 +クマダ 隈田 +クマダ 久万田 +クマダ 久間田 +クマダ 久萬田 +クマダイラ 熊平 +クマタカ 熊高 +クマタカ 熊鷹 +クマタキ 熊滝 +クマタキ 熊瀧 +クマダキ 熊懐 +クマダキ 熊抱 +クマダキ 隈懐 +クマタニ 熊谷 +クマタニ 隈谷 +クマダニ 熊谷 +クマタハラ 隈田原 +クマタハラ 熊田原 +クマタバラ 隈田原 +クマタバラ 熊田原 +クマタバラ 隅田原 +クマチ 熊地 +クマチ 久間地 +クマツ 久松 +クマツジ 熊辻 +クマテ 熊手 +クマデ 熊手 +クマト 熊戸 +クマトリ 熊取 +クマトリ 熊捕 +クマトリ 熊鳥 +クマトリタニ 熊取谷 +クマトリダニ 熊取谷 +クマトリヤ 熊取谷 +クマトリヤ 熊取屋 +クマナカ 熊中 +クマナガ 熊永 +クマナシ 熊無 +クマナミ 熊南 +クマニシ 熊西 +クマヌシ 熊主 +クマノ 熊野 +クマノ 隈野 +クマノゴウ 熊ノ郷 +クマノサコ 熊ノ迫 +クマノタニ 熊野谿 +クマノドウ 熊埜堂 +クマノバヤシ 熊野林 +クマノホソ 熊之細 +クマノホソ 熊ノ細 +クマノミドウ 熊埜御堂 +クマノミドウ 熊野御堂 +クマノヤ 熊野谷 +クマノヤ 熊埜谷 +クマノヤ 熊野屋 +クマハシ 熊橋 +クマハシリ 熊走 +クマバシリ 熊走 +クマハタ 熊畑 +クマバヤシ 熊林 +クマハラ 熊原 +クマハラ 隈原 +クマハラ 九万原 +クマハラ 久間原 +クマバラ 熊原 +クマヒラ 熊平 +クマフジ 熊藤 +クマブチ 熊渕 +クマブチ 熊淵 +クマベ 隈部 +クマベ 熊部 +クマベ 久間部 +クマベ 隅部 +クマベ 隈辺 +クマベ 熊辺 +クマホラ 熊洞 +クママエ 熊前 +クママタ 熊俣 +クママタ 熊又 +クママル 熊丸 +クママル 隈丸 +クマミ 熊見 +クマミ 熊巳 +クマミ 熊己 +クマミミ 熊耳 +クマミヤ 熊宮 +クマムラ 熊村 +クマムラ 隈村 +クマモト 熊本 +クマモト 隈元 +クマモト 隈本 +クマモト 熊元 +クマモリ 熊森 +クマモリ 熊守 +クマヤ 熊谷 +クマヤ 熊屋 +クマヤス 熊安 +クマヤナギ 熊柳 +クマヤブ 熊藪 +クマヤブ 熊薮 +クマヤブ 熊籔 +クマヤマ 熊山 +クマワキ 熊脇 +クマワニ 熊鰐 +クマン 久万 +クマンダ 九万田 +クマンバラ 九万原 +クマンバラ 九萬原 +クミ 組 +クミ 久美 +グミ 茱萸 +クミイ 汲井 +クミオカ 久美岡 +クミオカ 組岡 +クミガシラ 組頭 +クミカワ 汲川 +クミガワラ 組河原 +クミキ 久見木 +クミキ 久味木 +クミキ 組木 +クミグチ 組口 +クミサカ 組坂 +クミサカ 葛坂 +クミサキ 組崎 +クミサキ 汲崎 +クミザキ 組崎 +クミサコ 久見迫 +クミサワ 組沢 +クミサワ 組澤 +グミサワ 桾沢 +グミサワ 桾澤 +グミザワ 桾沢 +グミザワ 桾澤 +クミジ 組地 +クミジ 汲地 +クミシマ 組島 +クミズ 苦水 +クミセ 久見瀬 +クミタ 汲田 +クミタ 久美田 +クミタ 組田 +クミダ 汲田 +グミダ 茱萸田 +クミタケ 組嶽 +クミタケ 組岳 +クミタニ 組谷 +クミチ 組地 +クミヂ 組地 +クミツ 工光 +クミト 工水戸 +クミト 組登 +クミトウ 組藤 +クミナガ 組永 +クミノ 組野 +グミノキ 規味木 +クミハシ 組橋 +クミハラ 汲原 +クミハラ 組原 +クミヒガシ 組東 +クミムラ 組村 +クミモト 組本 +クミヤ 組谷 +クミヤ 組屋 +クミヤ 久美屋 +クミヤマ 組山 +クミワキ 組脇 +クムイ 酌井 +クムイ 汲井 +グムキ 椃木 +クムジ 汲地 +クムヂ 汲地 +クムラ 久村 +クムラ 玖村 +クムラ 九村 +クムラ 工村 +クムラ 句村 +クメ 久米 +クメ 粂 +クメ 久馬 +クメ 久目 +クメ 九目 +クメイ 粂井 +クメイ 久米井 +クメイジ 久銘地 +クメウチ 粂内 +クメオカ 粂岡 +クメガイ 粂谷 +クメガタ 久目形 +クメカワ 粂川 +クメカワ 久米川 +クメガワ 粂川 +クメガワ 久米川 +クメギ 久米木 +クメコ 久米子 +クメザキ 粂崎 +クメザワ 久米沢 +クメザワ 粂沢 +クメザワ 久米澤 +クメザワ 粂澤 +クメジ 久銘次 +クメジ 粂地 +クメジマ 久米島 +クメタ 久米田 +クメタ 粂田 +クメタ 久女田 +クメダ 久米田 +クメダ 粂田 +クメタニ 粂谷 +クメタニ 久米谷 +クメノ 粂野 +クメノ 久米野 +クメハシ 久米橋 +クメハシ 粂橋 +クメハラ 粂原 +クメハラ 久米原 +クメバラ 粂原 +クメムラ 久米村 +クメモト 久米本 +クメモト 粂本 +クメヤ 粂谷 +クメヤ 久米谷 +クメヤマ 久米山 +クメヤマ 粂山 +クモ 雲 +クモアシ 雲足 +クモイ 雲井 +クモイ 雲居 +クモイシ 雲石 +クモイデ 雲出 +クモウ 久毛 +クモウラ 雲浦 +クモオ 雲尾 +クモオカ 雲岡 +クモガキ 雲垣 +クモガタ 雲形 +クモカベ 雲壁 +クモカワ 雲川 +クモキ 雲木 +クモギ 雲城 +クモキタ 雲北 +クモキリ 雲切 +クモグチ 雲口 +クモクラ 雲倉 +クモコシ 雲越 +クモゴシ 雲越 +クモサカ 雲坂 +クモサキ 雲崎 +クモザキ 雲崎 +クモジ 雲地 +クモシカリ 雲然 +クモシタ 雲下 +クモシマ 雲島 +クモシマ 雲嶋 +クモジマ 雲島 +クモジマ 雲嶋 +クモズ 雲津 +クモズ 雲出 +クモスガ 雲菅 +クモセ 雲瀬 +クモセ 雲晴 +クモソウ 雲走 +クモタ 雲田 +クモダ 雲田 +クモダ 口分田 +クモダ 久茂田 +クモタニ 雲谷 +クモダニ 久茂谷 +クモチ 雲地 +クモヂ 雲地 +クモツ 雲津 +クモツ 久物 +クモヅ 雲津 +クモヅル 雲鶴 +クモデ 口分田 +クモデ 雲出 +クモデ 蜘手 +クモト 久本 +クモト 九本 +クモト 工本 +グモト 具本 +クモナ 公文名 +クモナカ 雲中 +クモネ 雲根 +クモノ 雲野 +クモバヤシ 雲林 +クモハル 雲春 +クモミ 雲見 +クモミ 雲海 +クモミネ 雲峰 +クモミヤ 雲宮 +クモムラ 雲村 +クモモ 久百々 +クモモト 雲本 +クモヤ 雲谷 +クモヤマ 雲山 +クモリ 久守 +クモリ 曇 +クモワタリ 蜘渡 +クモン 公文 +クモン 久門 +クモン 公門 +クモン 九門 +クモン 工門 +クモン 貢門 +クモンジョウ 公門城 +クモンダ 久門田 +クモンダイ 公文代 +クヤ 久家 +クヤ 国谷 +クヤ 久谷 +クヤ 國谷 +クヤ 久屋 +クヤ 九矢 +クヤ 工家 +クヤタ 九谷田 +クヤマ 久山 +クヤマ 九山 +クヤマ 玖山 +クヨウ 九曜 +クヨウ 九翟 +クヨシ 久吉 +クラ 倉 +クラ 蔵 +クラ 久良 +クラ 内蔵(内藏) +クラ 藏 +クラ 鞍 +クラ 九良 +クラ 倶羅 +クラアト 倉跡 +クライ 倉井 +クライ 鞍井 +クライ 蔵井 +クライ 位 +クライ 庫井 +クライ 蔵居 +クライ 藏井 +クライエ 倉家 +クライシ 倉石 +クライシ 蔵石(藏石) +クライシ 鞍石 +クライズミ 倉泉 +クライタ 位田 +クライダ 位田 +クラウエ 倉上 +クラウス 倉臼 +クラウチ 倉内 +クラウチ 蔵内 +クラウチ 藏内 +クラウチ 鞍打 +クラウチ 庫内 +クラウチ 鞍内 +クラウチ 臓内 +クラウラ 蔵浦 +クラエ 倉栄 +クラオ 倉尾 +クラオ 蔵尾 +クラオ 藏尾 +クラオカ 倉岡 +クラオカ 蔵岡 +クラオカ 鞍岡 +クラオカ 藏岡 +クラオカ 庫岡 +クラオク 倉奥 +クラカ 倉嘉 +クラガイチ 倉ケ市 +クラガイト 蔵垣内(藏垣内) +クラガイト 倉垣内 +クラガイリ 庫ケ入 +クラカキ 倉垣 +クラカギ 倉鍵 +クラガキ 倉垣 +クラガキ 蔵垣(藏垣) +クラガキ 倉垣内 +クラガキ 鞍垣 +クラカケ 倉掛 +クラカケ 鞍掛 +クラカケ 鞍懸 +クラカケ 蔵掛(藏掛) +クラカケ 倉懸 +クラガサキ 倉ケ崎 +クラガサキ 蔵ケ崎 +クラガサキ 藏ケ崎 +クラガサコ 蔵ケ迫 +クラカズ 倉員 +クラカズ 倉数 +クラカズ 倉斗 +クラカズ 蔵数 +クラカタ 倉形 +クラカタ 倉方 +クラカタ 倉片 +クラカタ 蔵方 +クラカタ 藏方 +クラガタ 倉形 +クラカド 倉門 +クラカド 蔵角(藏角) +クラカネ 倉金 +クラカネ 倉兼 +クラガネ 倉金 +クラカノ 倉鹿野 +クラガノ 倉賀野 +クラガノ 倉鹿野 +クラガノ 九良賀野 +クラガノ 倉ケ野 +クラカマ 倉鎌 +クラカミ 倉上 +クラカミ 倉神 +クラカミ 蔵上(藏上) +クラガミ 倉上 +クラガヤ 倉ケ谷 +クラカリ 倉狩 +クラガリ 倉狩 +クラカワ 倉川 +クラカワ 蔵川 +クラカワ 鞍川 +クラカワ 倉河 +クラカワ 庫川 +クラカワ 倉側 +クラカワ 蔵河 +クラカワ 藏川 +クラキ 椋木 +クラキ 久良木 +クラキ 倉木 +クラキ 蔵城 +クラキ 倉起 +クラキ 蔵木 +クラギ 久良木 +クラキタ 蔵北 +クラク 久楽 +クラク 久樂 +クラク 工楽(工樂) +クラク 倉久 +クラクス 倉楠 +クラグチ 倉口 +クラグチ 蔵口 +クラグチ 鞍口 +クラグチ 藏口 +クラクニ 倉国 +クラクボ 倉窪 +クラケ 倉家 +クラゲ 海月 +クラコ 蔵子 +クラゴ 蔵後 +クラコシ 倉越 +クラコシ 蔵越 +クラコシ 蔵腰 +クラサ 倉佐 +クラザ 蔵座 +クラザ 藏座 +クラサカ 倉坂 +クラサカ 倉阪 +クラサカ 蔵坂 +クラサキ 倉崎 +クラサキ 蔵崎 +クラサキ 鞍崎 +クラサキ 藏崎 +クラサキ 倉嵜 +クラザキ 蔵崎 +クラザキ 藏崎 +クラサク 鞍作 +クラサコ 倉迫 +クラサコ 蔵迫 +クラサコ 鞍迫 +クラサコ 倉廸 +クラサコ 藏迫 +クラサシ 倉指 +クラサト 倉郷 +クラサト 蔵里 +クラサワ 倉沢 +クラサワ 倉澤 +クラサワ 蔵沢 +クラサワ 蔵澤 +クラサワ 藏澤 +クラザワ 倉沢 +クラザワ 倉澤 +クラシ 倉司 +クラジ 倉治 +クラジ 蔵治(藏治) +クラシキ 倉敷 +クラシキ 蔵敷 +クラシキ 倉鋪 +クラシキ 倉舗 +クラシキ 藏敷 +クラシゲ 倉重 +クラシゲ 蔵重 +クラシゲ 倉茂 +クラシゲ 倉繁 +クラシゲ 藏重 +クラシゲヤ 倉重屋 +クラシタ 倉下 +クラシタ 蔵下 +クラシタ 藏下 +クラシナ 倉科 +クラシナ 倉品 +クラシナ 蔵品 +クラシナ 藏品 +クラシマ 倉島 +クラシマ 倉嶋 +クラシマ 蔵島 +クラシマ 倉嶌 +クラシマ 藏島 +クラジマ 倉嶋 +クラシモ 蔵下 +クラショ 蔵所 +クラショ 藏所 +クラジョウ 蔵城 +クラジョウ 藏城 +クラシロ 蔵城 +クラシロ 倉城 +クラシロ 倉代 +クラスギ 蔵杉(藏杉) +クラスギ 倉杉 +クラスミ 倉住 +クラスミ 蔵隅 +クラスミ 倉角 +クラズミ 倉住 +クラズミ 蔵隅 +クラズミ 蔵澄 +クラズミ 倉角 +クラズミ 蔵積 +クラズミ 藏澄 +クラセ 倉瀬 +クラセ 蔵瀬 +クラセコ 倉世古 +クラソウ 蔵宗 +クラソノ 倉園 +クラソノ 蔵園 +クラソノ 藏園 +クラゾノ 倉園 +クラゾノ 蔵園 +クラゾノ 蔵薗 +クラゾノ 倉薗 +クラゾノ 藏薗 +クラゾノ 藏園 +クラタ 倉田 +クラタ 蔵田 +クラタ 位田 +クラタ 椋田 +クラタ 鞍田 +クラタ 藏田 +クラタ 庫田 +クラタ 蔵多 +クラタ 倉多 +クラタ 内蔵田(内藏田) +クラダ 倉田 +クラダ 蔵田 +クラダイラ 倉平 +クラタカ 倉高 +クラタキ 倉滝 +クラタキ 倉瀧 +クラタキ 蔵多喜 +クラタケ 倉竹 +クラタケ 蔵竹 +クラタケ 倉武 +クラタケ 鞍丈 +クラタテ 蔵立 +クラタテ 倉舘 +クラタテ 倉立 +クラタテ 藏立 +クラタテ 鞍立 +クラダテ 倉館 +クラダテ 蔵立 +クラダテ 倉舘 +クラダテ 藏立 +クラタニ 倉谷 +クラタニ 蔵谷 +クラタニ 鞍谷 +クラタニ 藏谷 +クラタニ 久良谷 +クラタニ 庫谷 +クラタヤ 鞍田屋 +クラチ 倉地 +クラチ 倉知 +クラチ 倉智 +クラチ 蔵地 +クラチ 久良知 +クラチ 鞍智 +クラチ 倉池 +クラチ 蔵知(藏知) +クラチ 藏地 +クラチ 鞍知 +クラツ 倉津 +クラツ 倉都 +クラツ 蔵津(藏津) +クラツカ 倉塚 +クラツクリ 鞍作 +クラツジ 倉辻 +クラツジ 蔵辻 +クラツネ 倉恒 +クラツネ 蔵常 +クラツボ 倉坪 +クラツボ 蔵坪(藏坪) +クラツメ 倉爪 +クラヅメ 倉爪 +クラツワ 鞍津輪 +クラデ 倉出 +クラト 倉戸 +クラト 蔵戸 +クラト 倉斗 +クラト 藏戸 +クラド 蔵土 +クラトウ 倉藤 +クラトウ 蔵藤 +クラトウ 蔵当 +クラトウ 倉頭 +クラトウ 藏藤 +クラトウ 倉東 +クラトウ 蔵當 +クラトウ 藏當 +クラドウ 倉堂 +クラドウ 倉道 +クラトキ 蔵時 +クラトコ 倉床 +クラトコ 蔵床 +クラトミ 倉富 +クラトミ 倉冨 +クラトミ 蔵富 +クラトミ 蔵冨 +クラトミ 藏富 +クラトミ 鞍富 +クラトミ 藏冨 +クラドミ 倉富 +クラドミ 倉冨 +クラトメ 倉留 +クラトメ 鞍留 +クラトメ 蔵留(藏留) +クラドメ 倉留 +クラドメ 蔵留(藏留) +クラトモ 倉友 +クラナカ 倉中 +クラナカ 蔵中(藏中) +クラナガ 倉永 +クラナガ 蔵永 +クラナガ 倉長 +クラナガ 藏永 +クラナガ 蔵長(藏長) +クラナマ 倉生 +クラナミ 蔵並 +クラナミ 倉浪 +クラナミ 倉並 +クラナミ 倉波 +クラナミ 倉次 +クラナミ 藏並 +クラナリ 倉成 +クラナリ 鞍成 +クラナリ 蔵成 +クラナリ 内蔵成 +クラニシ 倉西 +クラニシ 蔵西(藏西) +クラヌキ 倉貫 +クラヌキ 鞍貫 +クラヌキ 蔵貫 +クラヌキ 藏貫 +クラヌシ 倉主 +クラヌマ 倉沼 +クラネ 倉根 +クラネ 蔵根 +クラネ 藏根 +クラノ 倉野 +クラノ 蔵野 +クラノ 鞍野 +クラノ 藏野 +クラノ 倉埜 +クラノ 蔵埜 +クラノ 九良野 +クラノ 倉ノ +クラノ 臓野 +クラノウ 蔵納 +クラノウ 藏納 +クラノウエ 蔵之上 +クラノウチ 蔵之内(藏之内) +クラノウチ 倉野内 +クラノウチ 蔵ノ内 +クラノオ 倉野尾 +クラノシタ 蔵之下 +クラノシタ 蔵ノ下 +クラノシタ 倉ノ下 +クラノシタ 蔵野下 +クラノシタ 藏ノ下 +クラノシタ 藏之下 +クラノダン 倉之段 +クラノブ 倉信 +クラノブ 蔵信 +クラノマエ 蔵之前 +クラノマエ 藏之前 +クラバ 倉場 +クラバ 蔵場 +クラハシ 倉橋 +クラハシ 椋橋 +クラハシ 鞍橋 +クラハシ 蔵橋 +クラハシ 蔵端 +クラハシ 倉梯 +クラハシ 藏橋 +クラハシ 倉槁 +クラハタ 倉畑 +クラハタ 蔵端 +クラハタ 蔵畑 +クラハタ 藏端 +クラバタ 蔵端 +クラハチ 倉八 +クラハマ 倉浜 +クラハヤシ 倉林 +クラバヤシ 倉林 +クラバヤシ 蔵林 +クラバヤシ 藏林 +クラハラ 倉原 +クラハラ 蔵原 +クラハラ 藏原 +クラヒガシ 蔵東 +クラヒガシ 藏東 +クラヒサ 倉久 +クラヒラ 倉平 +クラフジ 倉藤 +クラフジ 蔵藤 +クラフジ 蔵冨士 +クラフジ 藏藤 +クラフジ 倉富二 +クラフジ 蔵富士 +クラフチ 倉渕 +クラフチ 蔵渕 +クラフチ 藏渕 +クラブチ 倉渕 +クラブチ 倉淵 +クラブチ 蔵渕 +クラブチ 蔵淵 +クラブチ 藏淵 +クラブチ 藏渕 +クラベ 倉部 +クラベ 蔵部 +クラベ 倉辺(倉邉) +クラベ 倉邊 +クラベ 藏部 +クラベイシ 双石 +クラボウ 蔵坊 +クラホネ 倉骨 +クラホリ 倉堀 +クラホリ 蔵堀(藏堀) +クラマ 座間 +クラマ 鞍馬 +クラマ 倉間 +クラマ 蔵間 +クラマエ 蔵前 +クラマエ 倉前 +クラマエ 藏前 +クラマシ 倉増 +クラマシ 蔵増 +クラマシ 藏増 +クラマス 倉増 +クラマス 倉益 +クラマス 蔵増 +クラマス 倉升 +クラマス 蔵桝 +クラマス 蔵升 +クラマス 倉枡 +クラマス 蔵舛 +クラマス 蔵枡 +クラマス 藏増 +クラマタ 倉又 +クラマタ 倉俣 +クラマタ 倉股 +クラマタ 蔵俣(藏俣) +クラマタ 倉叉 +クラマチ 倉町 +クラマチ 蔵町(藏町) +クラマツ 倉松 +クラマツ 蔵松 +クラマル 蔵丸 +クラマル 藏丸 +クラミ 倉見 +クラミ 蔵見(藏見) +クラミズ 倉水 +クラミタニ 倉見谷 +クラミチ 蔵道 +クラミチ 倉道 +クラミチ 藏道 +クラミツ 倉光 +クラミツ 蔵満 +クラミツ 蔵光 +クラミツ 倉満(倉滿) +クラミツ 藏満 +クラミツ 鞍光 +クラミツ 蔵密 +クラミツ 蔵滿 +クラミツ 藏光 +クラミツ 藏密 +クラミツ 藏滿 +クラミヤ 倉宮 +クラムカイ 倉向 +クラムネ 倉宗 +クラムラ 倉村 +クラムラ 蔵村 +クラムラ 藏村 +クラモ 倉茂 +クラモ 倉毛 +クラモチ 倉持 +クラモチ 蔵持 +クラモチ 藏持 +クラモチ 久楽持 +クラモチ 久良持 +クラモチ 久樂持 +クラモト 倉本 +クラモト 蔵本 +クラモト 椋本 +クラモト 蔵元 +クラモト 倉元 +クラモト 藏本 +クラモト 鞍本 +クラモト 庫本 +クラモト 庫元 +クラモト 藏元 +クラモト 鞍元 +クラモトメ 蔵求 +クラモリ 倉森 +クラモリ 蔵森(藏森) +クラモリ 倉盛 +クラモリ 倉守 +クラモリ 蔵盛(藏盛) +クラモリ 蔵守(藏守) +クラヤ 倉谷 +クラヤ 蔵谷 +クラヤ 蔵屋 +クラヤ 倉屋 +クラヤ 倉家 +クラヤ 倉矢 +クラヤ 藏谷 +クラヤ 藏屋 +クラヤ 蔵矢 +クラヤ 臓屋 +クラヤシキ 蔵屋敷 +クラヤシキ 藏屋敷 +クラヤス 蔵保 +クラヤナギ 倉柳 +クラヤマ 倉山 +クラヤマ 庫山 +クラヤマ 蔵山 +クラヤマ 藏山 +クラユキ 蔵行 +クラヨシ 倉吉 +クラヨシ 蔵吉(藏吉) +クラヨシ 倉好 +クララ 倉良 +クラワカ 倉若 +クラワキ 倉脇 +クラワキ 蔵脇(藏脇) +クラン 九蘭 +クランド 蔵人 +クランドウ 蔵道 +クランドウ 藏道 +クリ 九里 +クリ 栗 +クリ 久利 +クリ 久里 +クリ 繰 +クリアキ 栗秋 +クリアキ 栗明 +クリアケ 栗明 +クリアゲ 操上 +クリイ 栗井 +クリイ 繰井 +クリイイハラ 栗飯原 +クリイイバラ 栗飯原 +クリイシ 栗石 +クリイハラ 栗飯原 +クリイバラ 栗飯原 +クリイワ 栗岩 +クリウ 栗生 +クリウ 久利生 +クリウ 栗宇 +クリウ 繰生 +クリウサワ 栗生澤 +クリウザワ 栗生沢 +クリウザワ 栗生澤 +クリウチ 栗内 +クリウラ 栗浦 +クリエ 栗江 +クリエダ 栗枝 +クリオ 栗生 +クリオ 栗尾 +クリオカ 栗岡 +クリカ 栗賀 +クリガ 栗賀 +クリガ 栗加 +クリガキ 栗垣 +クリカゲ 栗蔭 +クリカタ 栗方 +クリガタ 栗形 +クリカミ 操上 +クリガミ 操上 +クリガミ 栗上 +クリカラ 倶利加羅 +クリガラ 栗柄 +クリカワ 栗川 +クリカワ 栗河 +クリカワ 操川 +クリガワ 栗川 +クリキ 栗城 +クリキ 栗木 +クリキ 久力 +クリキ 操木 +クリキハラ 栗木原 +クリクマ 栗熊 +クリケ 栗家 +クリゲ 栗毛 +クリゲノ 栗毛野 +クリコ 栗子 +クリコマ 栗駒 +クリサカ 栗坂 +クリサカ 栗阪 +クリサキ 栗崎 +クリサキ 操崎 +クリサキ 栗嵜 +クリサキ 栗埼 +クリザキ 栗崎 +クリザキ 栗嵜 +クリサク 栗作 +クリサコ 栗迫 +クリサワ 栗沢 +クリサワ 栗澤 +クリザワ 栗沢 +クリシゲ 栗重 +クリシゲ 栗繁 +クリシタ 栗下 +クリシバ 栗芝 +クリシバ 栗柴 +クリシマ 栗島 +クリシマ 栗嶋 +クリシマ 栗嶌 +クリシロ 栗城 +クリス 栗栖 +クリス 栗須 +クリス 栗巣 +クリス 久利須 +クリス 栗洲 +クリス 栗楢 +クリスエ 栗末 +クリスガ 繰菅 +クリスタニ 栗須谷 +クリスノ 栗巣野 +クリセ 栗瀬 +クリゾエ 栗添 +クリゾエ 栗副 +クリゾノ 栗園 +クリソラ 栗空 +クリゾラ 栗空 +クリタ 栗田 +クリタ 来田 +クリタ 操田 +クリタ 九里田 +クリタ 來田 +クリタ 久理田 +クリタ 栗太 +クリダ 栗田 +グリタ 操田 +クリタニ 栗谷 +クリタニ 操谷 +クリタニ 繰谷 +クリツ 栗津 +クリツカ 栗塚 +クリヅカ 栗塚 +クリツボ 栗坪 +クリトウ 栗藤 +クリナカ 栗中 +クリナガ 栗永 +クリナミ 栗波 +クリナミ 栗並 +クリニシ 栗西 +クリノ 栗野 +クリノ 操野 +クリノ 栗廼 +クリノイケ 栗之池 +クリノキザコ 栗ノ木迫 +クリノブ 栗延 +クリノブ 栗信 +クリノマル 栗之丸 +クリノミヤ 栗之宮 +クリノワキ 栗之脇 +クリハ 栗葉 +クリバ 栗場 +クリバイシ 栗場石 +クリハシ 栗橋 +クリハタ 栗畑 +クリハナ 栗花 +クリハバ 栗幅 +クリハマ 栗浜 +クリハマ 栗濱 +クリハヤシ 栗林 +クリバヤシ 栗林 +クリハラ 栗原 +クリハラ 来原 +クリハラ 操原 +クリハラ 來原 +クリバラ 栗原 +クリビ 栗比 +クリヒサ 栗久 +クリヒラ 柊平 +クリヒラ 栗平 +クリフジ 栗藤 +クリベ 栗部 +クリベ 栗辺 +クリマ 来間 +クリマ 栗間 +クリマ 栗真 +クリマ 來間 +クリマキ 栗牧 +クリマサ 栗正 +クリマサ 栗政 +クリマタ 栗又 +クリマタ 栗俣 +クリマタ 栗股 +クリマタ 栗叉 +クリマル 栗丸 +クリミ 栗見 +クリミツ 栗光 +クリミツ 栗三 +クリミネ 栗峯 +クリムシ 栗虫 +クリムネ 栗宗 +クリムネ 栗棟 +クリムラ 栗村 +クリメ 栗目 +クリモト 栗本 +クリモト 栗元 +クリモト 操本 +クリモリ 栗森 +クリモリ 栗盛 +クリヤ 栗谷 +クリヤ 栗屋 +クリヤ 厨 +クリヤ 栗矢 +クリヤ 厨屋 +クリヤカワ 栗谷川 +クリヤカワ 厨川 +クリヤガワ 栗谷川 +クリヤガワ 厨川 +クリヤガワ 廚川 +クリヤキ 栗焼 +クリヤナギ 栗柳 +クリヤノ 栗屋野 +クリヤマ 栗山 +クリヤマ 柊山 +クリヤマ 久里山 +クリヤマ 九里山 +クリヤモト 栗谷本 +クリュウ 栗生 +クリュウ 久留生 +クリュウ 久利生 +クリュウ 久龍 +クリュウ 久竜 +クリュウ 繰生 +クリュウザワ 栗生澤 +クリョウ 九良 +クリワカ 栗若 +クリワキ 栗脇 +クリワタ 栗和田 +クリワダ 栗和田 +クル 久留 +クルイ 久留井 +クルウチ 久留内 +クルエ 来会 +クルキ 久留木 +クルサキ 来崎 +クルサキ 來崎 +クルジ 来司 +クルジ 來司 +クルシタ 來下(来下) +クルシマ 久留島 +クルシマ 来島 +クルシマ 来嶋 +クルシマ 久留嶋 +クルシマ 來嶋 +クルシマ 來島 +クルシマ 来留島 +クルシマ 久畄島 +クルシマ 久畄嶋 +クルシマ 来嶌 +クルシマ 耒嶋 +クルジマ 来島 +クルス 栗栖 +クルス 来栖 +クルス 栗須 +クルス 久留須 +クルス 来須 +クルス 久留主 +クルス 久留巣 +クルス 來栖 +クルス 久留栖 +クルス 來須 +クルス 耒栖 +クルスガワ 来栖川(來栖川) +クルスタニ 来守谷 +クルセ 苦瀬 +クルタ 来田 +クルタ 久留田 +クルタ 來田 +クルト 久留戸 +クルノ 久留野 +クルバ 来馬(來馬) +クルバ 来場 +クルバヤシ 久留林 +クルハラ 来原 +クルハラ 久留原 +クルハラ 來原 +クルハラ 耒原 +クルビ 久留飛 +クルベ 訓覇 +クルマ 車 +クルマ 来間 +クルマ 来馬(來馬) +クルマ 久留間 +クルマ 來間 +クルマ 来摩 +クルマ 久留真 +クルマ 久留磨 +クルマ 久溜間 +クルマ 久留馬 +クルマ 久畄間 +クルマ 來摩 +クルマイ 車井 +クルマイ 来米 +クルマイシ 車石 +クルマオ 車尾 +クルマガキ 車垣 +クルマカド 車角 +クルマカワ 車川 +クルマガワ 車川 +クルマキ 車木 +クルマギ 車木 +クルマグチ 車口 +クルマサ 来正(來正) +クルマザキ 車崎 +クルマジ 車地 +クルマタ 車田 +クルマダ 車田 +クルマダチ 車館 +クルマタニ 車谷 +クルマダニ 車谷 +クルマチ 車地 +クルマツカ 車塚 +クルマヅカ 車塚 +クルマト 車戸 +クルマド 車戸 +クルマド 輦止 +クルマノ 車野 +クルマモト 車元 +クルマモト 車本 +クルマヤ 車谷 +クルマヤ 車屋 +クルマヤ 車舎 +クルマル 来丸 +クルマル 耒丸 +クルミ 来海 +クルミ 胡桃 +クルミ 来見(來見・耒見) +クルミ 久留美 +クルミ 菓 +クルミ 久留見 +クルミ 来実 +クルミガワ 久留味川 +クルミザカ 胡桃坂 +クルミサワ 胡桃沢 +クルミサワ 楜沢 +クルミサワ 楜澤 +クルミサワ 胡桃澤 +クルミザワ 胡桃沢 +クルミザワ 楜沢 +クルミザワ 楜澤 +クルミザワ 胡桃澤 +クルミタ 来見田(來見田) +クルミダ 来見田(來見田) +クルミダ 胡桃田 +クルミダ 楜桃田 +クルミヤ 久留宮 +クルムラ 来村 +クルメ 久留米 +クルメ 来米 +クルメ 来目 +クルメ 來米 +クルメギ 来女木 +クルメギ 來女木 +クルモト 来本 +クルモト 久留本 +クルモト 來本 +クルリ 久留利 +クルワ 曲輪 +クレ 呉 +クレ 久礼 +クレ 久禮 +クレイ 久礼 +クレイ 榑井 +クレイ 久禮 +クレイ 呉井 +クレイ 暮井 +クレイシ 暮石 +クレイシ 呉石 +クレイシ 久連石 +クレイシ 昏石 +クレイシ 榑石 +クレイズミ 暮泉 +クレウラ 呉浦 +クレオカ 呉岡 +クレガミ 昏上 +クレカワ 呉川 +クレカワ 呉河 +クレキ 暮木 +クレサキ 呉崎 +クレサワ 榑沢 +クレサワ 暮沢 +クレシマ 呉島 +クレシロ 呉城 +クレタ 呉田 +クレタ 暮田 +クレタ 久礼田 +クレタ 久禮田 +クレダ 呉田 +クレダ 久礼田 +クレダ 久禮田 +クレタケ 呉竹 +クレタニ 榑谷 +クレタニ 呉谷 +クレタニ 槫谷 +クレチ 呉地 +クレチ 暮地 +クレツ 呉津 +クレツボ 呉坪 +クレツボ 暮坪 +クレトコ 紅床 +クレトコ 暮床 +クレナカ 昏中 +クレナガ 呉永 +クレヌマ 榑沼 +クレヌマ 暮沼 +クレノ 呉野 +クレハ 呉羽 +クレハ 呉服 +クレハ 久礼羽 +クレハ 久禮羽 +クレバ 塊場 +クレハシ 呉橋 +クレハシ 暮橋 +クレバヤシ 紅林 +クレバヤシ 榑林 +クレバヤシ 暮林 +クレバヤシ 呉林 +クレバヤシ 檜林 +クレバヤシ 桧林 +クレバヤシ 槫林 +クレバヤシ 𣑋林 +クレハラ 呉原 +クレヒ 暮日 +クレビト 呉人 +クレベ 暮部 +クレマチ 呉町 +クレマチ 暮町 +クレマツ 榑松 +クレマツ 呉松 +クレマツ 久連松 +クレマツ 暮松 +クレマツ 槫松 +クレマツ 紅松 +クレミ 呉海 +クレミツ 呉光 +クレミヤ 呉宮 +クレムラ 呉村 +クレモト 呉本 +クレモト 昏本 +クレモト 榑本 +クレモト 呉元 +クレモト 榑元 +クレヤ 呉屋 +クレヤ 呉家 +クレヤマ 呉山 +クレヤマ 久連山 +クレヤマ 暮山 +クレワ 久礼輪 +クロ 黒 +クロ 畔 +クロ 玄 +クロ 久呂 +グロ 具路 +グロ 具呂 +クロアキ 黒明 +クロアケ 黒明 +クロイ 黒井 +クロイ 黒居 +クロイケ 黒池 +クロイシ 黒石 +クロイシカワ 黒石川 +クロイシダ 黒石田 +クロイシダン 黒石段 +クロイズミ 黒泉 +クロイソ 黒磯 +クロイソ 黒礒 +クロイタ 黒板 +クロイチ 黒市 +クロイデ 畔出 +クロイワ 黒岩 +クロイワ 玄岩 +クロイワ 黒巌(黒巖) +クロイワドウ 黒岩堂 +クロウ 久良 +クロウ 黒鵜 +クロウ 玄 +クロウザ 九郎座 +クロウジ 黒氏 +クロウス 黒臼 +クロウズ 黒豆 +クロウダ 九郎田 +クロウチ 黒内 +クロウチ 畔内 +クロウツ 久朗津 +クロウヅ 久朗津 +クロウヅ 久郎津 +クロウマ 黒馬 +クロウマル 九郎丸 +クロウメ 黒梅 +クロエ 黒江 +クロエ 黒栄 +クロエダ 黒枝 +クロオ 黒尾 +クロオカ 黒岡 +クロオマル 黒尾丸 +クロガ 黒賀 +クロカギ 黒鍵 +クロガキ 黒垣 +クロガキ 黒柿 +クロカタ 黒潟 +クロカタ 黒瀉 +クロガタ 黒潟 +クロカネ 黒兼 +クロガネ 鉄 +クロガネ 黒金 +クロガネ 鐵(鐡) +クロガネ 銕 +クロカベ 黒壁 +クロカマ 黒釜 +クロガマ 黒釜 +クロカミ 黒神 +クロカミ 黒髪 +クロカミ 黒上 +クロカミ 黒紙 +クロガミ 黒神 +クロガミ 黒上 +クロカメ 黒亀 +クロカヤ 黒萱 +クロカワ 黒川 +クロカワ 黒河 +クロカワ 畔川 +クロカワ 玄川 +クロカワ 黒皮 +クロカワ 緇川 +クロガワ 黒川 +クロカワウチ 黒河内 +クロカワチ 黒河内 +クロキ 黒木 +クロキ 畔木 +クロギ 黒木 +クロキタ 黒北 +クロキバ 黒木場 +クロクイ 黒杭 +クロクチ 黒口 +クログチ 黒口 +クロクマ 黒熊 +クロクモ 黒雲 +クロクラ 黒倉 +クロコ 黒子 +クロコ 黒古 +クロコ 黒小 +クロコ 緇子 +クロゴ 黒子 +クロゴ 黒古 +クロゴ 黒後 +クロコウ 黒河 +クロコウ 黒公 +クロゴウ 黒郷 +クロゴウ 畔合 +クロゴウシ 黒厚子 +クロコウチ 黒河内 +クロゴウチ 黒河内 +クロコシ 黒越 +クロゴシ 黒越 +クロコマ 黒駒 +クロコメ 皀 +クロゴメ 黒米 +クロゴメ 皀 +クロサ 黒佐 +クロサイ 黒才 +クロサイ 黒宰 +クロサカ 黒坂 +クロサカ 黒阪 +クロサキ 黒崎 +クロサキ 黒埼 +クロサキ 黒嵜 +クロザキ 黒崎 +クロササ 黒笹 +クロザサ 黒笹 +クロサト 黒里 +クロサワ 黒沢 +クロサワ 黒澤 +クロサワ 玄沢 +クロザワ 黒沢 +クロザワ 黒澤 +クロザワ 玄澤 +クロサワツ 黒沢津 +クロサワツ 黒澤津 +クロジ 黒地 +クロシオ 黒潮 +クロシタ 黒下 +クロシマ 黒島 +クロシマ 黒嶋 +クロシロ 黒代 +クロス 黒須 +クロス 黒子 +クロス 黒巣 +クロス 玄巣 +クロズ 黒図(黒圖) +クロズ 黒豆 +クロスギ 黒杉 +クロスダ 黒須田 +クロスミ 黒住 +クロスミ 黒済 +クロスミ 黒墨 +クロスミ 黒角 +クロズミ 黒住 +クロズミ 黒済 +クロズミ 黒墨 +クロズミ 黒濟 +クロセ 黒瀬 +クロセ 黒精 +クロセ 畔瀬 +クロセヤ 黒瀬谷 +クロソウ 黒相 +クロソウ 緇荘 +クロソウ 緇莊 +クロゾウ 黒蔵 +クロゾウ 黒藏 +クロソエ 黒添 +クロゾエ 黒添 +クロゾノ 黒園 +クロタ 黒田 +クロタ 黒太 +クロタ 黒多 +クロダ 黒田 +クロダ 畔田 +クロダ 黒太 +クロダ 黒多 +クロダ 𨸟芦多 +クロダイ 黒台(黒臺) +クロタカ 黒高 +クロタキ 黒滝 +クロタキ 黒瀧 +クロタケ 黒竹 +クロタチ 黒舘 +クロタツ 黒龍 +クロダテ 黒館 +クロダテ 黒舘 +クロタニ 黒谷 +クロタニ 疇谷 +クロタマ 黒玉 +クロチ 黒地 +クロツ 黒津 +クロツ 久朗津 +クロヅ 黒津 +クロツカ 黒塚 +クロヅカ 黒塚 +クロツジ 畔辻 +クロツチ 黒土 +クロツボ 黒坪 +クロヅミ 黒積 +クロヅメ 黒詰 +クロツル 黒鶴 +クロドウ 黒堂 +クロトコ 黒床 +クロトビ 黒飛 +クロトリ 黒鳥 +クロトリ 畔取 +クロトリ 黒執 +クロナカ 黒中 +クロナガ 黒永 +クロナガ 黒長 +クロナガ 畔永 +クロニシ 黒西 +クロニタ 黒仁田 +クロニタ 黒荷田 +クロニダ 黒仁田 +クロヌシ 黒主 +クロヌマ 黒沼 +クロネ 畔蒜 +クロネ 黒根 +クロノ 黒野 +クロノ 玄野 +クロノ 黒𡌛 +クロノツボ 黒野坪 +クロノミヤ 久呂宮 +クロハ 黒羽 +クロバ 黒羽 +クロハギ 黒萩 +クロハギ 黒迫 +クロハシ 黒橋 +クロハタ 黒畑 +クロハネ 黒羽 +クロハネ 黒羽根 +クロハネ 黒羽子 +クロバネ 黒羽 +クロバネ 黒羽根 +グロハネ 内黒羽子 +クロハバキ 黒 +クロハバキ 黒鎺 +クロハバキ 黒 +クロハバキ 黒脛 +クロハバキ 黒臑 +クロハマ 黒浜 +クロハマ 黒濱 +クロバヤシ 黒林 +クロハラ 黒原 +クロヒガシ 黒東 +クロヒジ 黒肥地 +クロヒジ 黒肱 +クロヒジ 黒肘 +クロヒジ 黒肬 +クロヒラ 黒平 +クロフチ 黒渕 +クロブチ 黒渕 +クロブチ 黒淵 +クロベ 黒部 +クロベ 黒辺 +クロボ 黒保 +クロボウ 黒坊 +クロホシ 黒星 +クロボシ 黒星 +クロボラ 黒洞 +クロホリ 黒堀 +クロボリ 黒堀 +クロマキ 黒牧 +クロマキ 黒巻 +クロマサ 黒政 +クロマサ 黒正 +クロマツ 黒松 +クロマツ 玄松 +クロマメ 黒豆 +クロマル 黒丸 +クロミ 黒見 +クロミ 黒味 +クロミズ 黒水 +クロミツ 黒光 +クロミツ 黒満 +クロミネ 黒峰 +クロミヤ 黒宮 +クロミョウ 黒明 +クロムシャ 黒武者 +クロムラ 黒村 +クロメ 黒目 +クロメガワ 九郎明川 +クロモウリ 黒毛利 +クロモト 黒本 +クロモト 黒元 +クロモリ 黒森 +クロモリ 玄森 +クロモリ 黒毛利 +クロモン 黒門 +クロヤ 黒谷 +クロヤ 黒屋 +クロヤ 黒矢 +クロヤス 黒保 +クロヤス 黒安 +クロヤナギ 黒柳 +クロヤナギ 畔柳 +クロヤブ 黒籔 +クロヤブ 黒薮 +クロヤブ 黒藪 +クロヤマ 黒山 +クロヤマ 玄山 +クロヨネ 黒米 +クロラ 黒良 +クロワ 黒輪 +クロワラビ 黒蕨 +クロワラベ 黒蕨 +クワ 久和 +クワ 古和 +クワ 桑 +クワ 鍬 +クワイ 桑井 +クワウチ 桑内 +クワウチ 鍬内 +クワウミ 桑海 +クワエ 桑江 +クワエ 加 +クワオ 桑尾 +クワオ 桑生 +クワオカ 桑岡 +クワオリ 桑折 +クワカ 桑加 +クワガイ 桑貝 +クワガイト 桑垣内 +クワガキ 桑垣 +クワガタ 鍬形 +クワガタ 桑形 +クワガタ 鍬方 +クワガタ 鍬泻 +クワガタ 鍬潟 +クワガタ 鍬瀉 +クワガタ 鍬 +クワカド 桑門 +クワカマ 鍬鎌 +クワカミ 桑上 +クワガヤ 桑ケ谷 +クワガヤ 鍬ケ谷 +クワカワ 桑川 +クワキ 桑木 +クワキ 桑城 +クワキ 桑机 +クワギ 桑木 +クワキタ 桑北 +クワキノ 桑木野 +クワグチ 桑口 +クワグチ 鍬口 +クワクボ 桑久保 +クワコ 桑子 +クワコ 桑古 +クワゴ 桑子 +クワサカ 桑坂 +クワサカ 桑阪 +クワサキ 桑崎 +クワサキ 鍬崎 +クワサキ 鍬先 +クワサキ 桑先 +クワザキ 桑崎 +クワザキ 鍬崎 +クワサコ 桑迫 +クワザコ 桑迫 +クワサシ 鍬差 +クワザネ 桑実 +クワサワ 桑沢 +クワサワ 桑澤 +クワザワ 桑沢 +クワザワ 桑澤 +クワジ 桑路 +クワシゲ 桑重 +クワシタ 桑下 +クワシタ 鍬下 +クワシマ 桑島 +クワシマ 桑嶋 +クワシマ 桑嶌 +クワジマ 桑島 +クワジマ 桑嶋 +クワジマ 桑嶌 +クワジマ 鍬島 +クワジマ 𥸮島 +クワシロ 桑代 +クワシロ 桑城 +クワズ 食図 +クワズミ 桑住 +クワズル 桑鶴 +クワズル 桑水流 +クワセ 桑瀬 +クワゾエ 桑添 +クワゾノ 桑園 +クワゾメ 鍬初 +クワタ 桑田 +クワタ 鍬田 +クワタ 久和田 +クワタ 桑多 +クワタ 𥸮田 +クワタ 暒田 +クワダ 桑田 +クワダ 鍬田 +クワダ 久和田 +クワダイラ 桑平 +クワタカ 桑高 +クワダカ 桑高 +クワタキ 桑滝 +クワタク 桑宅 +クワタケ 鍬竹 +クワタニ 桑谷 +クワタニ 鍬谷 +クワタリ 九渡 +クワチ 桑地 +クワツ 桑津 +クワヅ 桑津 +クワツカ 鍬塚 +クワツカ 桑塚 +クワヅカ 鍬塚 +クワヅカ 桑塚 +クワツカサ 桑司 +クワツキ 桑月 +クワツボ 桑坪 +クワツリ 鍬釣 +クワツル 桑鶴 +クワツル 桑水流 +クワヅル 桑鶴 +クワヅル 桑水流 +クワヅル 桑津留 +クワヅル 桑霍 +クワト 桑戸 +クワド 桑土 +クワトウ 桑藤 +クワトミ 鍬富(鍬冨) +クワトリ 鍬取 +クワトリ 桑取 +クワナ 桑名 +クワナ 桑那 +クワナ 𥸮名 +クワナカ 桑中 +クワナガ 桑永 +クワナガ 鍬永 +クワナミ 桑波 +クワナミ 桑南 +クワヌシ 桑主 +クワネ 桑根 +クワノ 桑野 +クワノ 鍬野 +クワノ 久和野 +クワノ 鍬農 +クワノウ 鍬農 +クワノウチ 桑之内 +クワノエ 鍬柄 +クワノテ 鍬之手 +クワバ 桑羽 +クワバ 桑葉 +クワバ 加場 +クワバ 桑場 +クワバ 桑波 +クワハシ 桑橋 +クワハタ 桑畑 +クワハタ 桑波田 +クワハタ 桑幡 +クワハタ 桑畠 +クワバタ 桑畑 +クワバタ 桑波田 +クワバタ 桑幡 +クワバタ 桑端 +クワバタ 鍬畑 +クワバヤシ 桑林 +クワハラ 桑原 +クワハラ 久和原 +クワハラ 鍬原 +クワハラ 𥸮原 +クワバラ 桑原 +クワバラ 久和原 +クワバラ 鍬原 +クワハラダ 桑原田 +クワビキ 桑引 +クワヒラ 桑平 +クワビラキ 鍬開 +クワブチ 桑渕 +クワベ 桑辺(桑邊) +クワホラ 桑洞 +クワマ 鍬間 +クワマ 桑間 +クワマエ 桒前(桑前) +クワマス 桑升 +クワマタ 桑俣 +クワマタ 桑又 +クワマツ 桑松 +クワマル 桑丸 +クワミ 桑見 +クワミズ 桑水 +クワミツ 桑満 +クワミツ 鍬光 +クワミナミ 桑南 +クワミヤ 桑宮 +クワムラ 桑村 +クワムラ 鍬村 +クワムラ 桑邑 +クワムロ 桑室 +クワモト 桑本 +クワモト 鍬本 +クワモト 桑元 +クワモリ 桑森 +クワモリ 鍬守 +クワモリ 桑守 +クワモリ 桑盛 +クワヤ 桑谷 +クワヤ 桑屋 +クワヤ 鍬家 +クワヤマ 桑山 +クワヤマ 栞山 +クワヤマ 久和山 +クワヨシ 桑吉 +クワリ 桑理 +グンカイ 軍魁 +グンガイ 軍外 +グンカワ 群川 +グンキ 軍記 +グンキ 郡寄 +グンケ 郡家 +グンゲ 郡家 +クンコク 君国 +クンザ 君座 +グンシ 郡司 +グンシ 郡市 +グンシ 郡士 +グンジ 郡司 +グンジ 軍司 +グンジ 軍地 +グンジ 群司 +グンジ 軍侍 +グンジ 郡志 +グンジ 軍治 +グンジ 軍待 +グンジ 郡地 +グンジカケ 郡司掛 +グンジガケ 郡司掛 +グンジシマ 郡司島 +グンジシマ 郡司嶋 +グンシマ 郡島 +グンシマ 郡嶋 +グンジマ 郡島 +グンジマ 郡嶋 +グンジマ 郡嶌 +グンジマ 軍嶋 +グンジョウ 郡上 +グンジョウ 群上 +グンシン 軍神 +グンゼイ 群贅 +クンダ 薫田 +グンタ 郡田 +グンダ 郡田 +グンタカマツ 群高松 +クンタニ 訓谷 +グンタニ 郡谷 +グンチ 軍地 +グンチ 群地 +グンヂ 軍地 +グンヅカ 郡塚 +グント 郡戸 +グンド 郡戸 +グンナイ 郡内 +グンノ 郡野 +グンバ 軍場 +グンバラ 軍原 +グンバラ 郡原 +グンベ 郡部 +グンマ 群馬 +グンマ 郡馬 +グンヤ 郡谷 +グンヤス 郡安 +グンラク 郡楽(郡樂) +クンリク 薫陸 +ケアゲ 蹴揚 +ケアゲ 蹴上 +ケイ 慶伊 +ケイ 毛井 +ケイ 慶 +ケイ 系井 +ケイ 警 +ケイイ 慶伊 +ケイイ 系井 +ケイイ 慶井 +ケイウンジ 慶雲寺 +ケイオ 慶尾 +ケイオ 鶏尾 +ケイカ 桂華 +ケイガ 恵賀 +ケイカミ 慶上 +ケイガミ 慶上 +ケイキュウ 慶久 +ケイクラ 計倉 +ケイコ 慶児 +ケイコ 景湖 +ケイゴ 慶児 +ケイゴ 慶兒 +ケイコアン 稽古庵 +ケイコウ 敬向 +ケイコウイン 慶光院 +ケイゴエ 慶越 +ケイゴシ 慶越 +ケイサカ 詣坂 +ケイサキ 鯨崎 +ケイザキ 慶崎 +ケイシ 結石 +ケイジ 慶寺 +ケイシマ 慶島 +ケイシマ 警島 +ケイシマ 敬島 +ケイシュウ 慶秀 +ケイショウ 桂正 +ケイショウ 慶祥 +ケイジョウ 渓上 +ケイセン 恵泉 +ケイソウ 慶増 +ケイソク 鶏足 +ケイタ 慶田 +ケイダ 桂田 +ケイダ 慶田 +ケイダ 啓田 +ケイダイ 境内 +ケイタニ 系谷 +ケイチョウ 慶長 +ケイヅカ 経塚 +ケイヅカ 啓塚 +ケイヅカ 慶塚 +ケイトウ 桂藤 +ケイトウ 慶藤 +ケイトウ 慶籐 +ケイドウ 経堂 +ケイドウ 經堂 +ケイトク 慶徳 +ケイトク 花篤 +ケイトク 鶏徳 +ケイトク 経徳 +ケイトク 桂徳 +ケイトラ 啓乕 +ケイナ 慶納 +ケイナガ 慶永 +ケイニシ 慶西 +ケイノ 慶野 +ケイノ 桂野 +ケイノ 計野 +ケイノ 景野 +ケイノ 系野 +ケイハラ 慶原 +ケイヒロ 慶広(慶廣) +ケイブ 刑部 +ケイフク 慶福 +ケイホ 慶保 +ケイマ 桂馬 +ケイマ 繋馬 +ケイマ 競馬 +ケイマ 慶馬 +ケイマ 計馬 +ケイマス 慶増 +ケイマツ 慶松 +ケイマツ 敬松 +ケイミ 計見 +ケイミ 慶見 +ケイモト 慶本 +ケイモト 慶元 +ケイヤ 慶家 +ケイヤ 慶谷 +ケイヤマ 桂山 +ケイヤマ 慶山 +ケイユウ 慶祐 +ケイユウ 慶裕 +ケイラ 計良 +ケイラク 慶楽 +ケイリ 啓利 +ケイリン 瑤林 +ゲイリン 芸林 +ケイリンボウ 慶林坊 +ケイレイ 敬礼 +ケイレイ 敬禮 +ケイレイジ 敬礼寺 +ケウ 希有 +ケウケ 毛受 +ケウチ 毛内 +ケウミ 毛海 +ケエダ 毛枝 +ケオ 毛尾 +ケオロシ 毛下 +ケガ 気賀 +ケガ 氣賀 +ゲカ 外賀 +ゲカ 下賀 +ゲガ 外賀 +ケカイ 毛加伊 +ケガイ 毛涯 +ケガイ 毛海 +ケガサ 毛笠 +ケガサワ 気賀沢 +ケガサワ 毛賀沢 +ケガサワ 氣賀澤 +ケガサワ 気賀澤 +ケガサワ 毛賀澤 +ケガサワ 氣加澤 +ケガサワ 氣賀沢 +ケガチ 毛勝 +ケガワ 外川 +ケガワ 毛川 +ゲキ 外記 +ゲキ 外希 +ゲキノズ 鷁頭 +ゲキョウ 外京 +ケグチ 毛口 +ケクラ 花倉 +ケゴシ 毛越 +ケゴヤ 家古谷 +ケゴヤ 家護谷 +ケゴヤ 家古矢 +ケゴヤマ 堅固山 +ケサイシ 今朝石 +ケサカ 毛坂 +ケサガヤマ 畩ケ山 +ケサシ 慶佐次 +ケサジ 慶佐次 +ケサダ 袈裟田 +ケサダ 今朝田 +ケサト 今朝戸 +ケサド 今朝戸 +ケサドウ 今朝洞 +ケサマル 袈裟丸 +ケサマル 今朝丸 +ケサマル 袈装丸 +ケシ 芥子 +ゲシ 下司 +ゲシ 夏至 +ゲシ 下志 +ゲシ 外司 +ゲジ 下司 +ゲシウラ 外子浦 +ケシカワ 芥子川 +ケシダ 芥子田 +ケシノ 芥野 +ケシバ 毛芝 +ケシバ 結柴 +ケシマ 毛島 +ケジマ 毛島 +ゲジマ 下島 +ゲジマ 源島 +ゲジマ 槐島 +ゲジマ 源嶋 +ゲショ 下所 +ケショウ 下庄 +ケショウ 化生 +ゲジョウ 下条 +ゲジョウ 下條 +ゲジョウ 下絛 +ケショウザカ 化粧坂 +ゲシロ 下代 +ゲズ 枳穀 +ケズカ 毛塚 +ケズカ 毛束 +ケスダ 家寿田 +ケスダ 家壽田 +ゲズハラ 枳原 +ゲズモト 枳本 +ケセン 気仙 +ケセン 氣仙 +ケセンヌマ 気仙沼 +ケゾウカク 華蔵閣 +ケゾウボウ 家造坊 +ケタ 気田 +ケタ 氣田 +ケタ 計田 +ケタ 気多(氣多) +ケタ 化田 +ケダ 気田 +ケダ 氣田 +ケダ 毛田 +ケタシュ 芥田首 +ケタシロ 慶田城 +ケダシロ 慶田城 +ケダタケ 慶田嵩 +ケタダニ 桁谷 +ケタニ 毛谷 +ケタノ 桁野 +ケダハナ 慶田花 +ケダモト 慶田元 +ケダモト 慶田本 +ケダモリ 慶田盛 +ケタヤマ 桁山 +ケッカ 結家 +ケツカ 毛塚 +ケツカ 毛束 +ケヅカ 毛塚 +ケヅカ 毛束 +ゲッカ 月花 +ゲッカイ 月海 +ケッケ 結解 +ゲッコウ 月光 +ゲッコウ 月向 +ゲッショウ 月性 +ゲッセイ 月精 +ゲッソウ 月僧 +ケッソク 結束 +ケッソク 結速 +ゲットウ 月東 +ケットク 決得 +ケットク 决得 +ケト 毛戸 +ケド 毛戸 +ケド 外戸 +ケド 家戸 +ケトウ 毛藤 +ケトウイン 邪答院 +ケドウイン 祁答院 +ケドウイン 祁荅院 +ケトグチ 外戸口 +ケドグチ 外戸口 +ケトリ 毛鳥 +ケトリ 毛取 +ケナ 毛穴 +ケナイ 毛内 +ケナイ 祁内 +ケヌカ 毛糠 +ケヌキ 毛貫 +ケノ 毛野 +ゲノスミ 下之角 +ケバ 京馬 +ゲバ 下馬 +ケバタ 毛畑 +ゲハタ 下畑 +ケハラ 毛原 +ケビ 毛尾 +ケブカワ 癸生川 +ケブカワ 毛部川 +ケブカワ 発生川 +ケブカワ 葵生川 +ケブカワ 毛生川 +ケブキ 毛吹 +ケブサ 毛房 +ゲブセ 下伏 +ケホ 毛保 +ケボ 毛保 +ゲホウ 下方 +ケボウシ 毛防子 +ケマ 京馬 +ケマ 毛馬 +ケマ 家間 +ケマ 食満 +ケマ 毛満 +ゲマ 外間 +ケマナイ 毛馬内 +ケマナイ 毛間内 +ケマワリ 皆廻 +ケミ 花見 +ケミ 毛見 +ケミ 計見 +ケミガワ 検見川 +ケミガワ 檢見川 +ケミサキ 検見崎(檢見崎) +ケミザキ 検見崎(檢見崎) +ケムカワ 煙川 +ケムヤマ 煙山 +ケムラ 毛村 +ケムリガタニ 煙ケ谷 +ケムリヤマ 煙山 +ケムリヤマ 烟山 +ケモト 家本 +ケモヤマ 毛茂山 +ケモリ 家守 +ゲモリ 下森 +ケヤ 毛屋 +ケヤ 芥屋 +ケヤ 毛谷 +ゲヤ 下家 +ケヤキ 槻 +ケヤキ 欅 +ケヤキ 梐 +ケヤキダ 欅田 +ケヤキダニ 欅谷 +ケヤキモト 槻本 +ケヤマ 毛山 +ケヤムラ 毛谷村 +ケヤムラ 毛家村 +ケヤリ 毛鎗 +ケラ 計良 +ケラ 解良 +ケラ 家老 +ケラ 螻 +ケラ 懈良 +ケラ 觧良 +ケラ 系良 +ケラ 毛良 +ケラカワウチ 螻川内 +ケラカワウチ 蝼川内 +ケラカワチ 螻川内 +ケラカワチ 蝼川内 +ケラタ 計良田 +ケラタ 螻田 +ケラダ 家良田 +ケリ 花里 +ケルマ 慶留間 +ゲルマ 慶留間 +ケン 健 +ケン 謙 +ゲン 原 +ゲン 源 +ゲン 玄 +ゲン 言 +ゲン 絋 +ゲンイ 源井 +ゲンイシ 源石 +ゲンエイ 玄永 +ゲンエイ 現影 +ゲンオウ 玄翁 +ゲンオウ 玄応 +ゲンオウ 玄應 +ゲンオウゾノ 現王園 +ゲンオオゾノ 現王園 +ゲンオカ 玄岡 +ゲンオク 玄奥 +ケンガ 賢賀 +ゲンカ 源河 +ゲンガ 源河 +ゲンガ 元賀 +ケンガイ 兼外 +ゲンカイ 玄海 +ゲンカイ 源甲斐 +ゲンカイ 現海 +ゲンカイ 元海 +ゲンカイ 元開 +ゲンカイ 源海 +ケンガク 見学 +ケンガク 検学 +ケンガク 見覚 +ケンガク 見學 +ゲンカク 元角 +ゲンカク 玄覚(玄覺) +ゲンカク 玄角 +ケンガタ 剱形 +ケンガタ 釼形 +ゲンカワ 源川 +ケンキ 健木 +ケンギ 健木 +ケンギ 見儀 +ゲンキュウ 源久 +ケンキョウ 見郷 +ゲンギョウ 玄行 +ケンギョウヤ 検梗谷 +ゲンギンタニ 現銀谷 +ゲンギンダニ 現銀谷 +ゲンク 源久 +ゲンク 源九 +ゲンク 源工 +ケンクマ 剣熊(劔熊) +ゲンケ 源家 +ケンコ 見子 +ケンゴ 堅固 +ゲンコ 源古 +ゲンコ 元古 +ゲンコ 玄古 +ゲンゴ 源後 +ゲンゴ 玄後 +ゲンゴ 玄子 +ケンコウ 検校 +ケンコウ 顕考 +ゲンコウ 源光 +ゲンコウ 源幸 +ケンコウイン 顕光院 +ゲンコウジ 源光寺 +ゲンコク 谷 +ケンゴヤマ 堅固山 +ゲンゴロウマル 源五郎丸 +ゲンサ 源佐 +ケンサイ 見西 +ゲンサイ 源済 +ゲンザイ 源済 +ケンザカ 見坂 +ゲンサカ 元坂 +ケンザキ 検崎 +ケンザキ 監崎(監埼) +ケンザキ 釼崎 +ケンザキ 剣崎 +ケンザキ 剱崎 +ケンザキ 釼先 +ケンザキ 健崎 +ケンザキ 剣先 +ケンザキ 建崎 +ケンザキ 険崎 +ケンザキ 劔崎 +ケンザキ 撿崎 +ゲンザキ 源崎(源嵜) +ケンザワ 堅沢(堅澤) +ケンザン 剣山 +ケンザン 剱山 +ケンシ 謙志 +ケンジ 謙司 +ケンジ 賢慈 +ゲンシ 玄士 +ゲンシ 玄師 +ゲンジ 元治 +ゲンジ 源氏 +ゲンジ 源治 +ゲンジ 源地 +ゲンジ 源司 +ゲンシカ 源鹿 +ゲンジダ 源氏田 +ゲンシマ 源嶋 +ゲンシマ 玄島 +ゲンジマ 源島 +ゲンジマ 源嶋 +ゲンジマ 玄島 +ゲンジマ 玄嶋 +ゲンジャ 玄蛇 +ケンジュ 見寿(見壽) +ケンジュウ 剱重 +ケンジュウ 剣重 +ケンジュウ 劔重 +ケンジュウ 劒重 +ケンジュウ 釼重 +ゲンジュン 玄順 +ケンショウ 堅正 +ケンショウ 健正 +ケンジョウ 見上 +ケンジョウ 見城 +ケンジョウ 権丈 +ケンジョウ 兼定 +ケンジョウ 見生 +ケンジョウ 見定 +ケンジョウ 兼上 +ケンジョウ 見常 +ケンジョウ 堅城 +ケンジョウ 見條 +ケンジョウ 賢生 +ケンジョウ 建城 +ケンジョウ 権城 +ケンジョウ 献上 +ケンジョウ 見条 +ケンジョウ 權丈 +ケンジョウ 眷上 +ゲンショウ 源生 +ゲンショウ 玄正 +ゲンショウ 源正 +ゲンショウ 玄生 +ゲンジョウ 源城 +ゲンジョウ 源常 +ゲンジョウ 源条(源條) +ゲンシン 源新 +ゲンシン 源信 +ケンスイ 見水 +ゲンスイ 源水 +ゲンセキ 源関 +ゲンソ 玄素 +ケンソウ 剣荘(剱荘) +ゲンゾウ 源造 +ケンダ 見田 +ケンダ 剱田 +ケンダ 剣田 +ケンダ 釼田 +ケンダ 券田 +ケンダ 劔田 +ケンダ 劒田 +ゲンタ 元田 +ゲンタ 源田 +ゲンタ 玄田 +ゲンタ 源太 +ゲンタ 源多 +ゲンダ 元田 +ゲンダ 源田 +ゲンダ 玄田 +ゲンダ 現田 +ゲンダ 巖田 +ケンダイ 見代 +ケンダイ 健代 +ケンダイ 建代 +ゲンダイ 源代 +ゲンダイ 源大 +ゲンタケヤマ 源竹山 +ゲンタジ 源太寺 +ケンタツ 堅達 +ゲンタツ 堅達 +ゲンタツ 元達 +ゲンダツ 堅達 +ケンタニ 見谷 +ケンタニ 間谷 +ケンタニ 釼谷 +ケンタニ 賢谷 +ゲンタニ 源谷 +ゲンダヤ 源田谷 +ケンタワ 乾田和 +ケンチ 剱地 +ケンチ 剣地 +ケンチ 釼地 +ケンチ 劔地 +ケンチ 劒地 +ゲンチ 玄地 +ゲンチ 元智 +ゲンチ 玄知 +ケンチュウ 間中 +ゲンチョウ 玄長 +ゲンチョウ 源長 +ケンツ 見津 +ゲンツ 源津 +ゲンツ 元津 +ゲンツ 玄津 +ゲンツウ 源通 +ケンヅメ 県詰 +ケンヅメ 縣詰 +ゲンテ 玄手 +ゲンデ 源出 +ゲント 源戸 +ケントウ 見藤 +ケントウ 見当 +ケントウ 堅東 +ケンドウ 犬童 +ケンドウ 見藤 +ゲントウ 源藤 +ゲントウ 源当 +ゲントウ 玄当 +ゲンドウ 元藤 +ゲンドウ 源藤 +ゲンドウ 玄道 +ゲンドウ 玄藤 +ゲンドウ 玄同 +ケントオ 間遠 +ケントク 建徳 +ケントク 顕徳 +ゲントク 源徳 +ケンドメ 軒留 +ケンナ 堅名 +ケンナイ 軒内 +ゲンナイ 源内 +ゲンナイ 玄内 +ゲンナカ 源中 +ゲンナミ 源波 +ゲンナミ 元浪 +ゲンニュウ 源入 +ゲンニョ 玄女 +ゲンネ 源根 +ケンネンダイ 見年代 +ケンノ 見野 +ケンノ 乾野 +ケンノ 軒野 +ゲンノ 源野 +ゲンノ 玄野 +ゲンノ 巌野 +ゲンノ 源埜 +ゲンノウゾノ 現王園 +ゲンノウチ 玄之内 +ケンノキ 釼木 +ケンノキ 枳梖 +ケンノキ 劔木 +ケンノキ 劒木 +ケンノキ 剱木 +ケンノキ 剣木 +ケンノキ 瞼木 +ケンノキ 釖木 +ゲンバ 玄番 +ゲンバ 玄馬 +ゲンバ 源波 +ゲンバ 玄葉 +ゲンバ 玄蕃 +ゲンバ 玄場 +ゲンバ 元番 +ゲンバ 玄幡 +ゲンバ 玄羽 +ゲンバ 源羽 +ゲンバ 元馬 +ゲンバ 源場 +ゲンバ 源葉 +ゲンバイ 玄梅 +ケンビシ 剣菱 +ケンビシ 剱菱 +ケンビシ 釼菱 +ゲンブ 玄武 +ゲンブン 元文 +ケンベ 建部 +ケンペ 建部 +ゲンペイ 源平 +ケンボ 兼保 +ケンポ 検保 +ゲンボ 玄甫 +ゲンポ 玄甫 +ケンボウ 見坊 +ケンボウ 乾房 +ケンポウ 見宝(見寳) +ケンポウ 剱宝 +ケンポウ 釼法 +ゲンポウ 現方 +ケンマ 見満 +ケンマ 間馬 +ケンマ 験馬(驗馬) +ケンマ 研磨 +ケンマ 硎磨 +ゲンマ 弦間 +ゲンマ 源馬 +ゲンマ 源間 +ゲンマ 玄間 +ゲンマ 玄馬 +ゲンマ 源摩 +ゲンマイ 玄米 +ゲンマツ 玄松 +ゲンマル 源丸 +ケンミ 花見 +ケンミ 計見 +ケンミ 賢見 +ケンミサキ 検見崎(檢見崎) +ケンミザキ 検見崎(檢見崎) +ケンミヤ 見宮 +ケンミョウ 見明 +ケンミョウ 釼明 +ケンムラ 剱村 +ケンムラ 剣村 +ケンムラ 劔村 +ケンムラ 劒村 +ケンメイ 健名 +ケンメイ 徤名 +ゲンメイ 源明 +ケンモク 見目 +ケンモク 見木 +ケンモク 兼目 +ケンモチ 剣持 +ケンモチ 釼持 +ケンモチ 剱持 +ケンモチ 監物 +ケンモチ 劔持 +ケンモチ 劒持 +ケンモチ 見持 +ケンモチ 堅持 +ケンモチ 賢持 +ケンモチ 建持 +ケンモチ 劍持 +ケンモチダ 見持田 +ケンモツ 剣持 +ケンモツ 釼持 +ケンモツ 剱持 +ケンモツ 監物 +ケンモツ 劔持 +ケンモツ 劒持 +ケンモツ 見持 +ケンモツ 剱物 +ケンモツ 劔物 +ケンモツ 釼物 +ケンモツ 剣物 +ケンモツ 見物 +ケンモツ 間持 +ケンモツ 劍持 +ケンモツ 釖持 +ケンモツ 釰持 +ケンモツ 健物 +ケンモツ 堅物 +ケンモツ 劒物 +ケンモト 釼本 +ケンモト 検本 +ケンモト 剣本 +ケンモト 剱本 +ゲンモト 源本 +ゲンモト 巌本 +ゲンモト 玄元 +ゲンモト 厳本 +ゲンモト 玄本 +ゲンモト 元本 +ケンヨシ 釼吉(釰吉) +ケンヨシ 剣吉 +ケンヨシ 劔吉 +ケンヨシ 剱吉 +ゲンライジ 還来地 +ケンリ 見理 +ケンリュウ 見竜 +ゲンリン 現琳 +ゲンロク 源六 +ゲンロク 元禄 +ゲンロク 元録 +ゴア 後安 +コアイ 小合 +コアイ 小相 +コアイサワ 小相沢 +コアイサワ 小相澤 +コアイザワ 小相沢 +コアイザワ 小合沢 +コアイザワ 小合澤 +コアイザワ 小相澤 +コアカサワ 小赤沢 +コアカサワ 小赤澤 +コアカザワ 小赤沢 +コアカザワ 小赤澤 +コアキ 小明 +コアキ 濃明 +コアキモト 小秋元 +コアクツ 小圷 +コアクツ 小堆 +コアクツ 古圷 +コアゲ 小揚 +コアサ 小浅(小淺) +コアサノ 小麻野 +コアシ 小芦 +コアシ 小足 +コアジ 小鯵 +コアジロ 小網代 +コアセ 小阿瀬 +コアゼ 小畔 +コアゼ 小畦 +コアゼ 小疇 +コアゼ 小畴 +コアゼチ 小畦地 +コアヅチ 小安土 +コアナ 小穴 +コアミ 小網 +コアミ 古網 +コアミ 小阿見 +コアミ 小阿弥 +ゴアミ 五阿弥 +ゴアミ 其阿弥(其阿彌) +ゴアミ 五阿味 +ゴアミ 五網 +ゴアミ 五阿彌 +コアミナカ 小網中 +コアラ 小荒 +コアライ 小荒井 +コアライ 小新井 +コアライ 小洗 +コアラシ 小嵐 +ゴアラシ 五嵐 +コアラタ 小荒田 +コアラダ 小荒田 +コアラヤ 小荒谷 +コアン 古庵 +コアン 小庵 +ゴアン 後安 +ゴアン 後庵 +ゴアン 後案 +ゴアン 五安 +ゴアン 五庵 +ゴアン 午庵 +ゴアン 午菴 +ゴアンザワ 牛安沢(牛安澤) +コアンド 小安土 +ゴアンノ 後庵野 +コイ 古井 +コイ 小井 +コイ 己斐 +コイ 小居 +コイ 児井 +コイ 兒井 +ゴイ 五井 +ゴイ 伍井 +ゴイ 後井 +ゴイ 五位 +ゴイ 後居 +ゴイ 午居 +ゴイ 後伊 +コイイケ 鯉池 +コイイダ 小飯田 +コイイヅカ 小飯塚 +コイエ 古家 +コイエ 鯉江 +コイエ 小家 +コイエヤマ 小家山 +ゴイオ 五位尾 +コイカダ 小筏 +コイカリ 小碇 +コイカワ 肥川 +コイカワ 鯉川 +コイカワ 小井川 +コイカワ 恋川(戀川) +コイカワ 鯉河 +コイカワ 濃川 +コイガワ 小井川 +コイカワチ 恋河内(戀河内) +コイガワチ 恋河内(戀河内) +コイキ 恋木(戀木) +コイグチ 鯉口 +コイグチ 小井口 +コイグチ 恋口 +コイケ 小池 +コイケ 古池 +コイケ 子池 +コイケ 小生 +コイケ 古生 +コイケ 児池 +コイケガミ 小池上 +コイケザワ 小池沢 +コイケザワ 小池澤 +コイケダ 小池田 +コイゴウチ 恋河内(戀河内) +コイサカ 小井阪 +コイサコ 鯉迫 +コイザワ 小井沢 +コイザワ 小井澤 +コイシ 小石 +コイシ 古石 +コイシ 磊 +コイシ 子石 +コイジ 越路 +コイジ 古井地 +コイジ 肥地 +ゴイシ 碁石 +ゴイシ 五石 +ゴイシ 伍石 +コイシカワ 小石川 +コイシガワ 小石川 +コイシギ 小石木 +コイシクラ 小石倉 +コイシザワ 小石沢 +コイシザワ 小石澤 +コイシダ 小石田 +コイシハラ 小石原 +コイシバラ 小石原 +ゴイシハラ 後石原 +コイジマ 鯉島 +コイジマ 小井島 +コイシミネ 小石峯 +コイシミネ 小石峰 +コイズ 小伊豆 +コイスカ 越須賀 +コイズカ 肥塚 +コイズカ 恋塚 +コイズカ 小飯塚 +コイズカ 鯉塚 +コイズミ 小泉 +コイズミ 古泉 +コイズミ 小出水 +コイズミ 幸泉 +コイズミ 児泉 +コイズミ 鯉住 +コイズミ 巨泉 +コイズミ 小井住 +コイズミ 小涌 +コイズミ 小和泉 +ゴイズミ 五泉 +コイセ 小伊勢 +コイセキ 小井関(小井關) +コイゼキ 小井関(小井關) +コイソ 小磯 +コイソ 小礒 +コイソ 古磯 +コイソ 古礒 +コイタ 小板 +コイタ 小井田 +コイタ 鯉田 +コイダ 小井田 +コイダ 鯉田 +コイダ 恋田 +コイダ 小飯田 +コイダ 古井田 +コイダ 己斐田 +コイダ 戀田 +コイタニ 鯉谷 +コイタニ 小井谷 +コイダニ 小井谷 +コイタバシ 小板橋 +コイタヤ 小板谷 +コイチ 古市 +コイチ 小市 +コイチ 古一 +コイチ 挙市 +ゴイチ 後一 +コイチタニ 古市谷 +コイチハラ 小一原 +コイヅ 小井津 +コイツカ 肥塚 +コイツカ 小井塚 +コイヅカ 肥塚 +コイヅカ 恋塚 +コイヅカ 小飯塚 +コイヅカ 小井塚 +コイヅカ 古飯塚 +コイヅカ 鯉塚 +コイヅカ 戀塚 +ゴイツカ 五位塚 +ゴイツカ 後飯塚 +ゴイヅカ 五位塚 +コイヅツ 小井筒 +コイヅミ 小泉 +コイヅメ 小井詰 +コイデ 小出 +コイデ 小井手 +コイデ 小井出 +コイデ 古出 +コイデ 湖出 +ゴイデ 後出 +コイデサワ 小出澤 +コイデザワ 小出沢 +コイデザワ 小出澤 +コイデジマ 小出島 +コイデミズ 小出水 +コイデヤ 小出谷 +コイト 小井土 +コイト 小糸 +コイト 小井戸 +コイト 鯉登 +コイト 小絲 +コイド 小井土 +コイド 小井戸 +コイド 古道 +コイド 古井戸 +コイド 鯉戸 +コイトウ 越藤 +コイトウ 小伊藤 +コイドウ 鯉堂 +ゴイドウ 五位堂 +コイナカ 恋中(戀中) +コイナカ 小井中 +コイナガキ 小稲垣 +コイヌイ 小乾 +コイヌマ 鯉沼 +コイヌマ 肥沼 +コイヌマ 越沼 +コイヌマ 小井沼 +コイヌマ 濃沼 +コイヌマル 小犬丸 +コイネ 小稲 +コイネ 小井根 +コイネ 古稲 +コイネ 小伊根 +コイノ 濃野 +コイノ 鯉野 +コイノ 子井野 +コイノ 恋野(戀野) +ゴイノ 五位野 +ゴイノ 五井野 +コイノウチ 鯉ノ内 +コイブチ 鯉淵 +コイブチ 鯉渕 +コイブチ 恋淵(恋渕) +ゴイブチ 五位渕 +ゴイブチ 五位淵 +ゴイブチ 五井渕 +ゴイブチ 牛井渕 +ゴイブチ 五井淵 +ゴイブチ 牛井淵 +ゴイブチ 午井淵 +コイマイ 小今井 +コイマヅ 小今津 +コイマド 肥窓 +コイマリ 古伊万里 +コイマル 古井丸 +コイミズ 恋水(戀水) +コイミズ 乞水 +コイモト 恋本 +コイモリ 鯉森 +ゴイヤマ 五井山 +コイロ 越路 +コイロ 小色 +コイワ 小岩 +コイワ 古岩 +コイワ 小巌 +コイワ 小巖 +コイワ 小厳 +ゴイワ 五岩 +コイワイ 小岩井 +コイワイ 小祝 +コイワイ 古岩井 +コイワサキ 小岩崎 +コイワハラ 小岩原 +コイワヤ 小岩屋 +コインゼミ 小院瀬見 +コウ 神 +コウ 高 +コウ 幸 +コウ 国府 +コウ 河 +コウ 國府 +コウ 耕 +コウ 洪 +コウ 孝 +コウ 剛 +コウ 蛤 +コウ 閌 +コウ 香 +コウ 小 +コウ 古宇 +ゴウ 郷 +ゴウ 江 +ゴウ 号 +ゴウ 剛生 +コウア 興亜 +コウアン 光庵 +コウアンジ 光庵寺 +コウイ 光井 +コウイ 厚井 +コウイ 香井 +コウイ 孝井 +コウイ 鴻井 +コウイ 光位 +コウイ 幸井 +コウイ 甲井 +コウイ 講井 +ゴウイ 合井 +ゴウイ 郷井 +コウイケ 幸池 +コウイケ 神池 +コウイケ 甲池 +コウイシ 甲石 +コウイズミ 幸泉 +コウイズミ 興泉 +コウイチ 神一 +コウイワ 光岩 +コウイワ 幸岩 +コウウイ 講初 +ゴウウコン 郷右近 +コウウチ 河内 +コウウチ 幸内 +コウウチ 香内 +コウウチ 講内 +コウウラ 幸浦 +コウウラ 甲浦 +コウウラ 皇浦 +コウエ 小上 +コウエ 鴻江 +コウエ 黄江 +コウエ 公江 +コウエ 神江 +ゴウエ 合江 +コウエキバ 交易場 +コウエモン 小右エ門 +コウエモン 小右衛門 +コウエン 高縁 +コウエン 香遠 +コウエン 高円 +コウエン 後延 +コウエン 幸円 +コウエン 高圓 +コウエン 幸縁 +コウオ 幸尾 +コウオ 幸生 +コウオ 甲緒 +コウオ 小魚 +ゴウオ 郷緒 +コウオウ 幸王 +コウオカ 甲岡 +コウオカ +コウカ 江夏 +コウカ 孝花 +コウカ 甲加 +コウカ 紅花 +コウカ 高加 +コウガ 甲賀 +コウガ 神賀 +コウガ 光賀 +コウガ 河賀 +コウガ 香賀 +コウガ 高賀 +コウガ 公賀 +コウガ 幸賀 +コウガ 黄河 +ゴウカ 郷家 +コウカイ 口開 +コウカキ 幸加木 +コウガキ 幸柿 +コウガク 孝学 +コウガシラ 幸頭 +コウカタ 甲方 +コウカタ 幸形 +コウガタ 甲方 +ゴウガツボ 合ケ坪 +コウカミ 鴻上 +コウガミ 鴻上 +コウガミ 神上 +コウガミ 甲上 +コウガミ 幸上 +ゴウガミ 郷上 +コウカメ 高亀 +コウカメ 幸亀 +コウガメ 高亀 +コウカワ 幸川 +コウカワ 甲川 +コウカワ 幸河 +コウカワ 交河 +コウガワ 神川 +コウガワ 好川 +コウガワ 幸川 +コウガワ 甲川 +コウガワ 黄川 +コウガワ 幸河 +コウキ 甲木 +コウキ 幸喜 +コウキ 黄木 +コウキ 幸木 +コウキ 好木 +コウキ 構木 +コウキ 公木 +コウキ 小浮 +コウギ 神木 +コウギ 幸木 +コウギ 香木 +コウギ 鴻戯 +コウギ 幸義 +ゴウキ 合木 +ゴウキ 郷木 +ゴウギ 合木 +ゴウギ 郷木 +コウギク 幸菊 +コウキツ 纐纈 +コウキュウ 孝久 +ゴウキュウ 郷久 +コウギョウ 向暁 +コウキョウジ 光教路 +コウク 高久 +コウグ 香具 +コウグチ 河口 +コウグチ 高口 +コウグチ 香口 +コウグチ 幸口 +コウグチ 工口 +コウグチ 孝口 +コウグチ 甲口 +コウクボ 河久保 +コウクボ 幸窪 +ゴウクボ 郷久保 +ゴウクラ 郷倉 +コウクワノ 光桑野 +コウケ 古家 +コウケ 高家 +コウケ 公家 +コウケ 光家 +コウケ 幸家 +コウケ 小請 +コウケ 江家 +コウケ 小受 +コウケ 功家 +コウケ 弘家 +コウゲ 高下 +コウゲ 河下 +コウゲ 神下 +コウゲ 香下 +コウゲ 郡家 +コウゲ 神家 +コウゲ 神毛 +コウゲ 幸下 +コウゲ 光下 +コウゲ 幸家 +コウゲ 甲下 +コウゲ 厚毛 +コウゲ 剛家 +コウゲ 幸毛 +コウゲ 香華 +ゴウケ 郷家 +コウケイ 高慶 +コウゲゾエ 河下添 +コウゲダ 高下田 +コウケツ 纐纈 +コウケツ 交告 +コウケツ 絞結 +コウケツ 高潔 +コウケツ 纐結 +コウゲツ 高月 +コウゲツ 光月 +コウケツダ 交告田 +コウゲハタ 高下畑 +コウゲバナ 高下花 +コウケン 孝賢 +コウゲン 高源 +コウゲン 光源 +コウケンジ 光見寺 +コウゲンジ 光源寺 +コウゲンジ 高源寺 +コウコ 江湖 +コウゴ 向後 +コウゴ 高後 +コウゴ 幸後 +コウゴ 光後 +コウゴ 河後 +コウゴ 紅呉 +ゴウコ 郷古 +ゴウコ 郷湖 +ゴウコ 郷胡 +ゴウコ 郷子 +コウゴイシ 皮籠石 +コウコウ 孝行 +コウゴウ 向郷 +コウゴウ 交合 +コウゴウ 光郷 +コウコク 興国(興國) +コウコクジ 光國寺 +コウゴシ 甲越 +ゴウコン 郷右近 +コウサ 高佐 +コウサ 甲佐 +コウサ 小宇佐 +コウサ 幸佐 +コウサ 幸左 +コウザ 高座 +コウサイ 香西 +コウサイ 高斎 +コウサイ 高斉 +コウサイ 高齋 +コウサイ 光斉 +コウサイ 高才 +コウサイ 鴻斉 +コウサイ 光斎 +コウサイ 光齋 +コウサイ 高齊 +コウサイ 鴻斎 +コウサイ 鴻齋 +コウサイ 幸才 +コウザイ 香西 +コウザイ 幸西 +コウザイ 光在 +コウザイ 耕西 +コウザイ 高材 +コウサカ 高坂 +コウサカ 上坂 +コウサカ 匂坂 +コウサカ 高阪 +コウサカ 向坂 +コウサカ 幸坂 +コウサカ 上阪 +コウサカ 神坂 +コウサカ 香坂 +コウサカ 向阪 +コウサカ 幸阪 +コウサカ 河坂 +コウサカ 甲坂 +コウサカ 河阪 +コウサカ 神阪 +コウサカ 香阪 +コウサカ 光坂 +コウサカ 甲阪 +コウサカ 黄坂 +コウサカ 耕阪 +コウサカ 鴻坂 +コウザカ 高坂 +コウザカ 上坂 +コウザカ 高阪 +コウザカ 向坂 +コウザカ 幸坂 +コウザカ 上阪 +コウザカ 甲坂 +コウサキ 神前 +コウサキ 幸崎 +コウサキ 光崎 +コウサキ 甲崎 +コウサキ 講崎(講嵜) +コウサキ 香崎 +コウサキ 耕崎 +コウサキ 幸先 +コウサキ 鉱崎 +コウサキ 光嵜 +コウサキ 鑛崎 +コウザキ 高崎 +コウザキ 神崎 +コウザキ 神前 +コウザキ 上崎 +コウザキ 幸崎 +コウザキ 光崎 +コウザキ 甲崎 +コウザキ 神嵜 +コウザキ 鴻崎 +コウザキ 向崎 +コウザキ 講崎(講嵜) +コウザキ 香崎 +コウザキ 光嵜 +コウザキ 高埼 +ゴウザキ 剛崎 +ゴウザキ 強崎 +コウサク 耕作 +コウサコ 高迫 +コウサコ 幸迫 +ゴウサコ 郷迫 +ゴウサコ 剛迫 +コウザシ 神指 +コウサト 幸里 +コウザト 上里 +コウサハラ 高佐原 +コウサバラ 高佐原 +コウサワ 幸沢 +コウサワ 幸澤 +コウサワ 紅沢 +コウサワ 香沢 +コウザワ 神沢 +コウザワ 神澤 +コウザワ 光沢 +コウザワ 光澤 +コウザワ 好沢 +コウザワ 幸沢 +コウザワ 孔沢 +コウザワ 幸澤 +コウザワ 紅澤 +コウザワ 鴻沢(鴻澤) +ゴウサワ 合沢 +ゴウザワ 合沢 +ゴウザワ 郷沢 +ゴウザワ 郷澤 +コウザン 高山 +コウザン 幸山 +コウザン 甲山 +コウシ 合志 +コウシ 孝子 +コウシ 好士 +コウシ 閤師 +コウシ 甲子 +コウシ 嵪司 +コウシ 昂師 +コウジ 小路 +コウジ 糀 +コウジ 幸治 +コウジ 孝治 +コウジ 小治 +コウジ 幸路 +コウジ 光寺 +コウジ 光司 +コウジ 幸事 +コウジ 幸次 +コウジ 麹 +コウジ 黄司 +ゴウシ 合志 +ゴウシ 郷司 +ゴウシ 合使 +ゴウジ 郷司 +ゴウジ 郷地 +ゴウジ 郷治 +コウシオ 小牛尾 +コウジカタ 小路方 +コウジキ 柑子木 +ゴウシキ 郷式 +コウジグチ 小路口 +コウシゲ 幸繁 +コウシザキ 好士崎(好士埼) +コウシタ 香下 +コウシタ 幸下 +コウシダ 小牛田 +コウシダ 古牛田 +コウジタ 糀田 +コウジダ 糀田 +コウジタニ 糀谷 +コウジタニ 麹谷 +コウジタニ 小路谷 +コウジタニ 粷谷 +コウジダニ 糀谷 +コウジダニ 小路谷 +コウジツ 光實 +コウシナ 神志那 +コウシナ 神品 +コウジナ 神志那 +コウジナ 神品 +コウジノ 糀野 +コウジバ 糀場 +コウジハタ 糀畑 +コウジハラ 糀原 +コウシマ 河島 +コウシマ 河嶋 +コウシマ 神島 +コウシマ 幸島 +コウシマ 光島 +コウシマ 光嶋 +コウシマ 香島 +コウシマ 香嶋 +コウシマ 幸嶋 +コウシマ 甲嶋 +コウシマ 神嶋 +コウシマ 甲島 +コウシマ 鴻嶋 +コウシマ 光嶌 +コウジマ 幸島 +コウジマ 光島 +コウジマ 光嶋 +コウジマ 香島 +コウジマ 香嶋 +コウジマ 幸嶋 +コウジマ 甲嶋 +コウジマ 国府島(國府島) +コウジマ 甲島 +コウジマ 鴻島 +コウジマ 鴻嶋 +ゴウシマ 合嶋 +ゴウジマ 合嶋 +ゴウジマ 合島 +ゴウジマ 合嶌 +コウジマル 小路丸 +コウジマル 麹丸 +コウシメ 甲〆 +コウジメ 甲〆 +コウジモト 柑本 +コウジモト 糀本 +コウジモト 糀元 +コウジモリ 麹盛 +コウシャ 高社 +コウジャ 幸者 +コウジャ 紅蛇 +コウジヤ 糀谷 +コウジヤ 糀屋 +コウジヤ 麹谷 +コウジヤ 小路谷 +コウジヤ 糀矢 +コウジヤ 粷谷 +コウジヤ 麹屋 +コウジヤ 麹家 +ゴウシャ 郷社 +コウジャク 幸若 +コウジヤマ 柑子山 +コウジヤマ 麹山 +ゴウシヤマ 郷司山 +コウシュ 光主 +コウジュ 高寿 +コウジュ 孝寿(孝壽) +コウジュ 光寿 +コウジュ 高壽 +コウシュウ 甲州 +コウシュウ 公舟 +コウシュウ 甲洲 +ゴウシュウ 江洲 +ゴウシュウ 郷州 +ゴウシュウ 江州 +コウシュウヤ 甲州屋 +コウシュウヤ 甲州谷 +コウシュウヤ 甲洲屋 +コウショ 幸所 +コウショウ 幸正 +コウショウ 公庄 +コウショウ 高庄 +コウショウ 晃昇 +コウショウ 香庄 +コウショウ 高昌 +コウショウ 甲正 +コウショウ 光照 +コウジョウ 高乗 +コウジョウ 向上 +コウジョウ 香城 +コウジョウ 向城 +コウジョウ 駒城 +コウジョウ 幸丈 +コウジョウ 洪城 +コウジョウ 康上 +ゴウジョウ 河城 +コウジョウマ 高上馬 +コウジョウマ 高乗馬 +コウジリ 河尻 +コウジリ 幸尻 +コウシロ 神代 +コウシロ 幸城 +コウジロ 神代 +コウジロ 神白 +コウジロ 神城 +コウシン 光真 +コウシン 向新 +コウシン 光眞 +コウシン 幸真 +コウシン 庚申 +コウシン 江信 +コウシン 甲神 +コウジン 荒神 +コウジン 講神 +コウジン 光神 +コウジン 幸神 +コウジン 幸壬 +コウジン 荒鎮 +ゴウジン 護神 +コウジンガイト 荒神垣内 +コウジンバラ 荒神原 +コウシンボウ 光真坊 +コウシンボウ 光眞坊 +コウズ 高津 +コウズ 神津 +コウズ 神頭 +コウズ 甲津 +コウズ 神主 +コウズ 光頭 +コウズ 香津 +ゴウズ 牛頭 +コウスイ 光水 +コウズイ 江水 +コウズイ 洪水 +コウズイ 光随(光隨) +コウズイ 光髄 +コウズエ 神末 +コウズキ 上月 +コウズキ 神月 +コウスゲ 光菅 +コウズケ 上野(上墅) +コウズケダ 上野田 +コウズマ 上妻 +コウズマ 高妻 +コウズマ 高水間 +コウスミ 河角 +コウスミ 甲角 +コウスミ 向角 +コウスミ 幸住 +コウズミ 上泉 +コウズミ 幸積 +コウセ 高瀬 +コウセ 光瀬 +コウセ 神瀬 +コウセ 紅瀬 +コウセ 鴻瀬 +ゴウセ 合瀬 +コウセイ 高姓 +コウセイ 光星 +コウセイ 幸世 +コウセイ 廣盛 +コウセキ 河関 +コウセキ 孝石 +コウセキ 幸勢城 +コウゼキ 河関 +コウセツ 幸節 +コウセン 光銭 +コウセン 光仙 +コウセン 光泉 +コウセン 香泉 +コウゼン 幸前 +コウゼン 興膳 +コウゼン 光前 +コウゼン 光銭 +コウゼン 興禅 +コウゼン 高銭 +コウセンジ 高専寺 +コウセンボウ 高仙坊 +コウゼンボウ 光善坊 +コウソ 高祖 +コウソ 高曽 +コウソ 神尊 +コウゾ 楮 +ゴウソ 郷祖 +コウソウ 高僧 +コウゾエ 河添 +コウソカベ 香曽我部 +コウソカベ 香宗我部 +コウソカベ 香曾我部 +コウソガベ 香曽我部 +コウソガベ 香宗我部 +コウソク 香束 +コウソク 香則 +コウゾタニ 楮谷 +コウゾノ 香園 +コウゾノ 幸園 +ゴウソノ 郷園 +ゴウゾノ 郷園 +コウゾハラ 楮原 +コウゾメ 神初 +コウゾヤブ 楮籔 +コウゾヤブ 楮藪 +コウゾヤマ 楮山 +コウタ 高田 +コウタ 古田 +コウタ 幸田 +コウタ 向田 +コウタ 甲田 +コウタ 光田 +コウタ 香田 +コウタ 国府田 +コウタ 古宇田 +コウタ 鴻田 +コウタ 黄田 +コウタ 國府田 +コウタ 孝田 +コウタ 公田 +コウタ 交田 +コウタ 幸多 +コウタ 孝多 +コウダ 上田 +コウダ 高田 +コウダ 神田 +コウダ 古田 +コウダ 河田 +コウダ 合田 +コウダ 江田 +コウダ 幸田 +コウダ 向田 +コウダ 甲田 +コウダ 光田 +コウダ 香田 +コウダ 弘田 +コウダ 国府田 +コウダ 行田 +コウダ 来田 +コウダ 古宇田 +コウダ 好田 +コウダ 迎田 +コウダ 口田 +コウダ 鴻田 +コウダ 黄田 +コウダ 更田 +コウダ 國府田 +コウダ 孝田 +コウダ 耕田 +コウダ 公田 +コウダ 紅田 +コウダ 工田 +コウダ 幸多 +コウダ 小宇田 +コウダ 畊田 +コウダ 古典田 +コウダ 庚田 +コウダ 洪田 +コウダ 鉱田 +コウダ 杲田 +コウダ 𥸮田 +ゴウタ 合田 +ゴウタ 郷田 +ゴウダ 合田 +ゴウダ 江田 +ゴウダ 後田 +ゴウダ 郷田 +ゴウダ 強田 +ゴウダ 閤田 +コウダイ 高代 +コウダイ 高台 +コウダイ 高大 +ゴウダイ 合代 +コウダイラ 公平 +コウタカ 甲高 +コウタカ 高鷹 +コウタカ 香高 +コウタカ 神鷹 +コウダカ 甲高 +コウダカ 香高 +コウダカ 幸高 +コウタキ 上滝 +コウタキ 上瀧 +コウタキ 香焼 +コウタキ 甲滝 +コウタク 香焼 +ゴウダグチ 合田口 +コウタケ 高武 +コウタケ 神武 +コウタケ 高竹 +コウタケ 香茸 +コウタケ 香武 +コウダチ 神立 +コウタツ 高達 +コウダツ 光達 +コウダツ 向達 +コウダツ 向逹 +コウタテ 香立 +コウダテ 神立 +コウダテ 高達 +コウダテ 神舘 +コウダテ 甲立 +コウダテ 神館 +コウタニ 神谷 +コウタニ 高谷 +コウタニ 甲谷 +コウタニ 河谷 +コウタニ 光谷 +コウタニ 幸谷 +コウタニ 香谷 +コウタニ 鴻谷 +コウタニ 耕谷 +コウタニ 蛤谷 +コウタニ 洪谷 +コウダニ 河谷 +ゴウタニ 合谷 +ゴウタニ 後谷 +ゴウタニ 郷谷 +ゴウタニ 剛谷 +コウタバシ 高田橋 +コウダバシ 高田橋 +コウダマ 幸玉 +コウダヤ 高田谷 +コウタリ 神足 +コウチ 河内 +コウチ 古内 +コウチ 古池 +コウチ 高地 +コウチ 幸地 +コウチ 高内 +コウチ 小内 +コウチ 神内 +コウチ 甲地 +コウチ 古地 +コウチ 幸内 +コウチ 高越 +コウチ 胡内 +コウチ 黄地 +コウチ 荒地 +コウチ 高知 +コウチ 幸池 +コウチ 高智 +コウチ 光地 +コウチ 河知 +コウチ 神地 +コウチ 公地 +コウチ 好地 +コウチ 河智 +コウチ 鴻地 +コウチ 耕地 +コウチ 洽地 +コウチ 光池 +コウチ 好池 +コウチ 幸知 +コウチ 構内 +コウチ 耕智 +コウチ 香地 +コウチ 小打 +ゴウチ 郷地 +ゴウチ 合地 +コウチダニ 河内谷 +コウチャク 高着 +コウチヤマ 河内山 +コウチュウ 孝忠 +コウチワ 小団扇 +コウチワ 小團扇 +コウツ 高津 +コウツ 河津 +コウヅ 高津 +コウヅ 神津 +コウヅ 江津 +コウヅ 幸津 +コウヅ 甲津 +コウヅ 向津 +コウヅ 香津 +ゴウツ 合津 +ゴウツ 郷津 +ゴウヅ 神津 +ゴウヅ 合津 +ゴウヅ 郷津 +ゴウヅ 江津 +コウツカ 高塚 +コウツカ 幸塚 +コウツカ 庚塚 +コウヅカ 高塚 +コウヅカ 河塚 +コウヅカ 幸塚 +コウヅカ 庚塚 +コウヅカ 黄塚 +コウヅカ 鴻塚 +コウツキ 香月 +コウツキ 上月 +コウツキ 高津城 +コウヅキ 香月 +コウヅキ 上月 +コウヅキ 高月 +コウヅキ 高附 +コウヅキ 神月 +コウヅキ 河月 +コウヅキ 光月 +コウヅキ 孝月 +コウヅキ 幸月 +コウヅキ 弘月 +コウヅキ 昂月 +コウヅキ 甲月 +コウヅケ 河附 +コウツサ 高津佐 +コウヅサ 高津佐 +コウツチ 高土 +コウツチ 高槌 +コウヅチ 高土 +コウヅチ 高槌 +コウヅツ 高筒 +コウツハラ 高津原 +ゴウツボ 郷坪 +コウヅマ 上妻 +コウヅマ 高妻 +コウヅマ 香妻 +コウヅマ 幸妻 +コウヅミ 幸積 +コウヅル 高鶴 +コウデ 神出 +コウデ 香出 +ゴウデ 郷出 +コウテラ 幸寺 +コウデラ 幸寺 +コウデラ 光寺 +コウデラ 国府寺(國府寺) +コウデラ 圀府寺 +コウテン 高天 +コウデン 向殿 +ゴウデン 郷田 +コウト 神戸 +コウト 河戸 +コウト 小宇都 +コウト 児戸 +コウド 神戸 +コウド 神門 +コウド 河戸 +コウド 香渡 +コウド 香戸 +コウド 孝戸 +コウド 幸土 +コウド 鴻戸 +コウド 鴻渡 +ゴウト 合戸 +ゴウト 郷戸 +ゴウト 郷渡 +ゴウド 神戸 +ゴウド 神門 +ゴウド 合戸 +ゴウド 郷戸 +ゴウド 河渡 +ゴウド 郷渡 +ゴウド 郷土 +ゴウド 合渡 +コウトウ 甲藤 +コウトウ 厚東 +コウトウ 高東 +コウトウ 向当 +コウトウ 向當 +コウトウ 向頭 +コウトウ 香東 +コウトウ 孝頭 +コウドウ 近藤 +コウドウ 古藤 +コウドウ 甲藤 +コウドウ 高堂 +コウドウ 幸道 +コウドウ 河道 +コウドウ 幸藤 +コウドウ 向頭 +コウドウ 講堂 +コウドウ 香東 +コウドウ 黄堂 +コウドウ 河堂 +コウドウ 甲堂 +ゴウトウ 郷頭 +ゴウトウ 郷東 +ゴウトウ 合頭 +ゴウドウ 郷道 +コウドウジ 光同寺 +コウドウマエ 河道前 +コウトク 神徳 +コウトク 幸得 +コウトク 幸徳 +コウドノ 神殿 +コウドノ 講殿 +コウトミ 光富 +コウトミ 光冨 +コウトミ 幸富 +コウトミ 幸冨 +コウトリ 甲鳥 +コウナイ 高内 +コウナイ 幸内 +コウナイ 香内 +コウナイ 孝内 +コウナイ 講内 +ゴウナイ 郷内 +ゴウナイ 合内 +コウナカ 香中 +コウナカ 幸中 +ゴウナカ 郷中 +ゴウナタ 号刀 +コウナミ 神波 +コウナン 江南 +コウニシ 香西 +コウニシ 幸西 +コウニシ 耕西 +ゴウニシ 郷西 +コウヌ 甲怒 +コウヌシ 厚主 +コウヌシ 神主 +コウヌマ 高沼 +コウネ 高根 +コウネ 小宇根 +コウネ 幸根 +コウネ 小采 +コウネン 高念 +コウノ 河野 +コウノ 上野(上墅) +コウノ 高野 +コウノ 狩野 +コウノ 神野 +コウノ 古野 +コウノ 高 +コウノ 幸野 +コウノ 光野 +コウノ 向野 +コウノ 国府 +コウノ 荒野 +コウノ 廣野 +コウノ 甲野 +コウノ 鴻野 +コウノ 江野 +コウノ 香野 +コウノ 後野 +コウノ 興野 +コウノ 河埜 +コウノ 紅野 +コウノ 神埜 +コウノ 國府 +コウノ 甲能 +コウノ 交野 +コウノ 耕野 +コウノ 糠野 +コウノ 公野 +コウノ 好野 +コウノ 黄野 +コウノ 功野 +コウノ 弘野 +コウノ 耕納 +コウノ 功能 +コウノ 孝野 +コウノ 鴻農 +コウノ 昿野 +コウノ 巷野 +コウノ 鉱納 +コウノ 畊野 +コウノ 河納 +コウノ 幸埜 +コウノ 構野 +コウノ 甲埜 +コウノ 神於 +コウノ 河之野 +コウノ 巧野 +コウノ 洪野 +コウノ 鴻埜 +コウノ 曠野 +コウノ 鑛納 +ゴウノ 郷野 +ゴウノ 後野 +ゴウノ 合野 +コウノイケ 鴻池 +コウノイケ 幸池 +コウノイケ 高野池 +コウノウ 神農 +コウノウ 甲能 +コウノウ 高納 +コウノウ 耕納 +コウノウ 功能 +コウノウ 黌農 +コウノウ 鴻農 +コウノウ 鉱納 +コウノウ 弘農 +ゴウノウ 郷農 +コウノウエ 高上 +コウノウエ 河野上 +コウノウエ 神植 +コウノウチ 高野内 +コウノウチ 河埜内 +コウノウミ 鴻海 +コウノウラ 神浦 +コウノウラ 神之浦 +コウノウラ 郡浦 +コウノウラ 神ノ浦 +コウノエ 鴻江 +コウノエ 香江 +コウノエ 神江 +コウノエ 高野江 +ゴウノカミ 郷上 +コウノキ 香ノ木 +コウノキ 香木 +コウノキ 神納木 +コウノギ 香ノ木 +コウノシ 神野志 +コウノシロ 上野城 +コウノス 鴻巣 +コウノス 高野須 +コウノセ 高野瀬 +コウノセ 神瀬 +コウノトウ 甲野藤 +コウノトウ 甲野籐 +コウノトリ 鴻鳥 +コウノハシ 河野橋 +ゴウノハラ 郷之原 +ゴウノハラ 郷野原 +コウノブ 甲信 +コウノベ 高延 +コウノベ 高野辺 +コウノマツ 幸之松 +ゴウノマル 郷之丸 +コウノミ 鴻海 +コウノミネ 鴻嶺 +ゴウノメ 江目 +ゴウノメ 郷野目 +ゴウノメ 江ノ目 +コウノモリ 鴻森 +コウノヤ 国府谷 +コウノヤ 幸野谷 +コウノヤ 河野矢 +コウノヤ 幸野屋 +コウノヤ 國府谷 +コウハ 甲把 +コウハ 甲羽 +コウハ 甲破 +コウバ 幸場 +ゴウバ 郷端 +コウハイ 弘灰 +コウバイ 匂梅 +コウバイ 紅梅 +コウバイ 香梅 +コウバイ 勾梅 +コウバイ 紅楳 +コウバイ 黄梅 +コウハク 高帛 +コウハシ 孝橋 +ゴウハシ 郷橋 +コウハセ 高波瀬 +コウハタ 高畑 +コウハタ 光畑 +コウハタ 向畑 +コウハタ 光旗 +コウハタ 甲畑 +コウハタ 幸畑 +コウハタ 公畑 +コウハタ 香畑 +コウハタ 香畠 +コウハタ 光籏 +コウハタ 幸畠 +コウバタ 河端 +コウバタ 古畑 +コウバタ 光旗 +コウバタ 甲畑 +コウバタ 光籏 +ゴウハタ 郷畑 +コウバチ 幸鉢 +コウハマ 国府浜 +コウバヤシ 香林 +コウバヤシ 光林 +コウバヤシ 幸林 +コウバヤシ 甲林 +コウバヤシ 興林 +ゴウバヤシ 合林 +コウハラ 高原 +コウハラ 神原 +コウハラ 甲原 +コウハラ 香原 +コウハラ 公原 +コウハラ 鴻原 +コウハラ 黄原 +コウハラ 幸原 +コウハラ 孝原 +コウハラ 洪原 +コウハラ 孔原 +コウバラ 河原 +コウバラ 高原 +コウバラ 神原 +コウバラ 甲原 +ゴウハラ 河原 +ゴウハラ 郷原 +ゴウハラ 合原 +ゴウバラ 河原 +ゴウバラ 郷原 +ゴウバル 郷原 +ゴウバル 合原 +コウヒサ 河久 +コウヒラ 高平 +コウヒラ 幸平 +コウヒラ 甲平 +コウヒロ 光広 +コウビン 甲便 +コウフ 河府 +コウフ 講夫 +コウフ 廣布 +コウブ 講武 +コウフウ 幸風 +コウフカタ 甲府方 +コウフガタ 甲府方 +コウフク 幸福 +コウフクジ 幸福司 +コウフクダ 幸福田 +コウフジ 孝富士(孝冨士) +コウブシ 幸伏 +コウブチ 河渕 +コウブチ 河淵 +コウブチ 幸渕 +コウブチ 幸淵 +コウブツ 幸物 +コウブツ 香仏 +コウブン 公文 +コウブン 高風聞 +コウベ 神戸 +コウベ 河辺 +コウベ 高部 +コウベ 神部 +コウベ 河邊 +コウベ 光部 +コウベ 河邉 +コウベ 高辺 +コウベ 甲部 +コウベ 甲辺(甲邊・甲邉) +コウベ 興辺 +コウベ 兄部 +コウベ 興邊 +コウベ 湖平 +コウベ 幸部 +コウベ 高邊 +コウベ 高邉 +コウヘイ 公平 +コウヘイヤ 弘平谷 +コウベヤ 神戸屋 +コウホ 幸保 +コウボ 幸保 +コウボ 弘保 +コウボウ 弘保 +コウボウ 弘法 +コウボウ 厚坊 +コウボウドウ 弘法堂 +コウボク 厚朴 +コウボリ 高堀 +コウボリ 幸堀 +コウボリ 河堀 +ゴウホリ 郷堀 +ゴウボリ 合堀 +コウマ 高麗 +コウマ 高馬 +コウマ 小馬 +コウマ 幸間 +コウマ 幸馬 +ゴウマ 郷間 +ゴウマ 合馬 +ゴウマ 合摩 +ゴウマ 降魔 +コウマエ 神前 +コウマエ 上前 +コウマエ 幸前 +コウマエ 後前 +コウマキ 高槙 +コウマキ 高槇 +コウマザキ 小馬崎 +コウマス 幸増 +コウマタ 河俣 +コウマツ 幸松 +コウマツ 神松 +コウマツ 鴻松 +コウマル 幸丸 +コウマル 鴻丸 +コウマル 香丸 +ゴウマル 郷丸 +ゴウマン 郷万 +ゴウマン 郷萬 +コウミ 小海 +コウミ 古海 +コウミ 高味 +コウミ 河見 +コウミ 巨海 +コウミ 香味 +コウミ 河海 +コウミ 郊見 +コウミ 神海 +コウミツ 幸光 +コウミツ 甲光 +ゴウミツ 合満 +コウミネ 孝峰 +コウミネ 孝峯 +コウミョウ 光明 +コウミョウ 幸明 +コウミョウ 高明 +コウミョウイン 光明院 +コウミョウジ 光明寺 +コウム 高武 +コウム 高無 +コウムチ 神鞭 +コウムラ 上村 +コウムラ 河村 +コウムラ 高村 +コウムラ 神村 +コウムラ 幸村 +コウムラ 香村 +コウムラ 甲村 +コウムラ 光村 +コウムラ 興村 +コウムラ 鴻村 +コウムラ 古布村 +コウムラ 紅村 +コウムラ 光邨 +コウムラ 孔村 +コウムラ 洪村 +ゴウムラ 郷村 +コウメ 小梅 +コウメ 古梅 +コウメイ 光明 +コウメイ 高銘 +コウメカワ 小梅川 +コウメガワ 小梅川 +コウメン 高免 +コウメン 高面 +コウメン 講免 +コウモ 河面 +コウモ 河毛 +コウモ 幸茂 +コウモト 河本 +コウモト 高本 +コウモト 光本 +コウモト 広本 +コウモト 神本 +コウモト 河元 +コウモト 廣本 +コウモト 甲本 +コウモト 幸本 +コウモト 甲元 +コウモト 香本 +コウモト 幸元 +コウモト 孝本 +コウモト 講元 +コウモト 鴻本 +コウモト 公本 +コウモト 講本 +コウモト 鴨本 +コウモト 紅本 +コウモト 洪本 +コウモト 孔本 +コウモト 香元 +ゴウモト 郷本 +ゴウモト 郷元 +ゴウモト 合元 +コウモリ 幸森 +コウモリ 公森 +コウモリ 孝森 +コウモリ 耕守 +コウモリ 公盛 +コウモリ 甲盛 +コウモリ 甲守 +ゴウモリ 郷森 +ゴウモリ 郷守 +コウモン 公門 +コウモン 向門 +ゴウモン 郷門 +コウヤ 高野 +コウヤ 神谷 +コウヤ 古谷 +コウヤ 高谷 +コウヤ 高屋 +コウヤ 甲谷 +コウヤ 荒野 +コウヤ 幸谷 +コウヤ 神屋 +コウヤ 郡谷 +コウヤ 光家 +コウヤ 国府谷 +コウヤ 香谷 +コウヤ 幸屋 +コウヤ 粉家 +コウヤ 講屋 +コウヤ 幸弥 +コウヤ 興谷 +コウヤ 孝谷 +コウヤ 鴻矢 +コウヤ 國府谷 +ゴウヤ 郷家 +ゴウヤ 合屋 +ゴウヤ 強矢 +ゴウヤ 合谷 +ゴウヤ 江谷 +ゴウヤ 郷谷 +ゴウヤ 五谷 +ゴウヤ 剛家 +ゴウヤ 合家 +ゴウヤ 郷矢 +コウヤウチ 高野内 +ゴウヤギ 合谷木 +コウヤス 項安 +コウヤナギ 幸柳 +コウヤマ 高山 +コウヤマ 神山 +コウヤマ 上山 +コウヤマ 香山 +コウヤマ 光山 +コウヤマ 幸山 +コウヤマ 広山 +コウヤマ 甲山 +コウヤマ 興山 +コウヤマ 河山 +コウヤマ 公山 +コウヤマ 耕山 +コウヤマ 匂山 +コウヤマ 孔山 +コウヤマ 洪山 +コウヤマ 鴻山 +コウヤマ 鎬山 +ゴウヤマ 合山 +ゴウヤマ 郷山 +ゴウヤマ 豪山 +コウヤマジ 高山寺 +コウヨウ 紅葉 +コウヨウ 光用 +コウヨウ 高揚 +コウヨシ 幸吉 +コウラ 高良 +コウラ 小浦 +コウラ 上良 +コウラ 甲良 +コウラ 古浦 +コウラ 高羅 +コウラ 幸良 +コウラ 児浦 +コウラ 子浦 +コウラ 小宇羅 +コウラ 河良 +コウラ 甲浦 +コウラ 皇浦 +コウラ 香良 +コウラ 神良 +コウラ 兒浦 +ゴウラ 郷良 +ゴウラ 五浦 +ゴウラ 吾浦 +ゴウラ 郡楽(郡樂) +ゴウラ 合羅 +コウライ 高麗 +コウライ 高来 +コウライ 光来(光來) +コウライ 向来(向來) +コウライ 幸来 +コウライ 高來 +コウラカタ 小浦方 +ゴウラク 合楽(合樂) +コウラバ 小浦場 +コウラハマ 小浦浜 +コウリ 桑折 +コウリ 古宇利 +コウリ 光里 +コウリ 幸里 +コウリ 甲利 +コウリ 洪里 +コウリカワ 郡川 +コウリキ 高力 +コウリキ 香力 +ゴウリキ 強力 +ゴウリキ 合力 +ゴウリキ 剛力 +ゴウリキ 郷力 +コウリヤマ 郡山 +コウリヤマ 香里山 +コウリュウ 高龍 +コウリン 香林 +コウリン 光林 +コウリン 幸林 +コウリン 江林 +コウリンボウ 光林坊 +コウリンボウ 香林坊 +コウルシ 小漆 +コウロ 興梠 +コウロ 紅露 +コウロ 上良 +コウロ 高路 +コウロ 高呂 +コウロ 高露 +コウロ 河呂 +コウロ 香呂 +コウロ 興呂 +ゴウロ 郷路 +ゴウロ 合路 +ゴウロ 郷呂 +コウロウ 上郎 +コウロキ 興梠 +コウロキ 高梠 +コウロキ 奐梠 +コウロギ 興梠 +コウロギ 興呂木 +コウロギ 神路祇(神路祗) +コウロギ 奥呂木 +コウロギ 興梠木 +コウロギ 高梠 +コウロギ 興侶 +コウロギ 高呂木 +コウロギ 高路木 +コウロギ 趣梠 +コウロギ 小路木 +コウロギ 高侶 +コウロク 高鹿 +コウロク 高録 +ゴウロク 合六 +ゴウロク 郷六 +コウロジ 高路地 +コウワ 高和 +コウワ 甲把 +コウワ 河和 +コウワ 香和 +コウワ 甲和 +コウワ 鴻和 +コウワカ 幸若 +コウワキ 幸脇 +ゴウンジ 五雲寺 +コエ 小江 +ゴエイドウ 五影堂 +コエガイツ 肥垣津 +コエキ 小浴 +コエキ 小駅(小驛) +ゴエク 護得久 +ゴエク 越来(越來) +コエグチ 越口 +コエサシ 小枝指 +コエザワ 肥沢 +コエザワ 肥澤 +コエジ 越地 +コエジ 越路 +コエズカ 肥塚 +コエズミ 小栄住 +コエタ 肥田 +コエダ 越田 +コエダ 肥田 +コエダ 小枝 +コエダ 条 +コエダ 木枝 +コエダ 小條 +コエダ 小榎田 +ゴエダ 五枝 +コエタカ 声高 +コエタカ 聲高 +コエダカ 声高 +コエダカ 聲高 +コエダハラ 小枝原 +コエチ 越智 +コエチ 越地 +コエツカ 肥塚 +コエヅカ 肥塚 +コエト 越渡 +コエド 越渡 +コエド 越度 +コエド 小江戸 +コエトウ 越藤(越籐) +コエドウ 越堂 +ゴエドウ 五影堂 +コエヌマ 肥沼 +コエヌマ 越沼 +コエノキ 小榎 +コエバ 越場 +コエハタ 小江畑 +コエバタ 小江畑 +コエビサワ 小海老沢 +コエビサワ 小海老澤 +コエビス 古戎 +コエビス 古胡 +コエビス 小戎 +コエビス 小夷 +ゴエブチ 五江渕 +ゴエブチ 五江淵 +コエマド 肥窓 +コエマル 肥丸 +コエモト 肥本 +コエモト 声元 +コエモト 声本 +コエモト 聲元 +コエモン 越門 +コエラ 古恵良(古惠良) +コエン 小猿 +コエン 古遠 +コエン 小縁 +コエンマ 小円間 +コオ 小尾 +コオ 国府 +コオ 國府 +ゴオ 郷 +ゴオ 後尾 +コオウ 幸王 +ゴオウ 牛王 +ゴオウ 五王 +コオオツカ 小大塚 +コオカ 小岡 +コオカ 幸岡 +コオキ 小沖 +ゴオギ 郷木 +コオク 小奥 +コオグチ 小尾口 +コオケ 小桶 +コオゲ 高下 +コオゲ 郡家 +コオザイ 香西 +コオジ 小路 +コオジタニ 糀谷 +コオゾエ 河添 +コオダ 古田 +コオダ 幸田 +コオダ 国府田 +コオダ 國府田 +ゴオダ 合田 +ゴオダ 郷田 +コオタカ 古小高 +コオタカ 小小高 +コオダカ 古小高 +コオチ 河内 +コオヅ 高津 +コオツカ 小大塚 +コオデラ 国王寺 +コオノ 河野 +コオノ 高野 +コオノ 鴻野 +ゴオハラ 郷原 +コオマ 高馬 +コオミツ 香光 +コオムラ 幸村 +コオモ 河面 +コオモ 古主 +コオモテ 小面 +コオモリ 幸森 +コオモリ 公森 +コオヤ 国府谷 +コオヤ 粉家 +コオヤ 國府谷 +コオヤマ 神山 +コオラ 甲良 +コオリ 郡 +コオリ 桑折 +コオリ 幸里 +コオリ 小織 +コオリ 氷 +コオリイケ 郡池 +コオリカワ 郡川 +コオリタ 郡田 +コオリダ 郡田 +コオリダ 凍田 +コオリタニ 郡谷 +コオリタニ 氷谷 +コオリバ 郡場 +コオリハマ 郡浜 +コオリハラ 郡原 +コオリマツ 郡松 +コオリモト 郡元 +コオリヤ 郡谷 +コオリヤマ 郡山 +コオリヤマ 氷山 +コオロ 紅露 +コオロキ 興梠 +コオロギ 興梠 +コオロギ 興呂木 +コオロギ 神路祇(神路祗) +コオロギ 奥呂木 +コオロギ 高呂木 +コカ 古家 +コカ 小菓 +コガ 古賀 +コガ 古家 +コガ 久我 +コガ 古閑 +コガ 古河 +コガ 木賀 +コガ 小賀 +コガ 古我 +コガ 古峨 +コガ 古俄 +コガ 小鍜 +ゴカ 五箇 +ゴカ 五家 +ゴカ 伍賀 +ゴカ 五賀 +ゴカ 五加 +ゴカ 五筒 +ゴガ 伍賀 +ゴガ 五賀 +ゴガ 呉我 +コカイ 小海 +コカイ 古海 +コカイ 小貝 +コカイ 湖海 +コガイ 小粥 +コガイ 小貝 +コガイ 小飼 +コガイ 小界 +コガイ 古河井 +ゴカイ 五貝 +ゴカイ 後界 +コカイザワ 小貝沢 +コカイザワ 小貝澤 +コガイチ 小垣内 +ゴカイチ 五日市 +ゴカイチ 五ケ市 +コガイト 小海途 +コガイト 小垣内 +コガイト 小垣外 +コガウエ 古賀上 +コガウチ 小河内 +コガウチ 小垣内 +コガウチ 小此内 +コガウチ 古川内 +ゴカウチ 後河内 +コカキ 小柿 +コカギ 小鍵 +コガキ 小垣 +コガキ 小柿 +コガキダイラ 小柿平 +コカク 小角 +コカク 古郝 +コガク 小角 +コガク 古岳 +ゴカク 五角 +ゴカク 牛角 +ゴカク 午角 +ゴガク 呉岳 +ゴガク 吾岳 +コカグチ 小ケ口 +コガグチ 小ケ口 +コガクラ 小ケ倉 +コガクラ 小鹿倉 +コガクラ 子ケ倉 +コカケ 小掛 +コカゲ 小蔭 +コカゲ 小影 +コカゲ 木蔭 +コカゲ 木家下 +コガケ 小闕 +コガケ 小掛 +コカゴ 小篭 +コカゴ 古神子 +コカゴ 小籠 +コカゴ 小駕 +コカゴ 小駕籠 +コガサ 小笠 +コガサカ 小賀坂 +コガサカ 古賀坂 +コガサキ 古河崎 +コガサキ 古家崎 +コガサコ 古閑迫 +コガサコ 高ケ迫 +コカジ 小梶 +コカジ 小鍛治 +コカジ 小鍛冶 +コカジ 古梶 +コカジ 古鍛治(古鍜治) +コカジ 小鍜治 +コカジ 古鍛冶(古鍜冶) +コカジ 小鍜冶 +コガシ 古樫 +コガシマ 小ケ島 +コガシワ 小柏 +コカゼ 小風 +コガタ 小形 +コガタ 小方 +コガタ 古方 +コガタ 古形 +コガタ 古賀田 +コガタ 樵田 +コガタ 古閑田 +ゴガタ 後賀田 +コガタナ 小刀 +コガチ 小勝 +コガチ 古我知 +コガチ 古勝 +コガチ 古我地 +コカツ 小勝 +コカツ 古勝 +ゴカツデ 五勝出 +ゴガツヒ 五月日 +ゴガツボ 合ケ坪 +コガツラ 小桂 +コカド 小門 +コカド 古門 +コカド 古角 +コカド 小角 +コカド 児門(兒門) +コガナザワ 小金沢 +コガニ 小蟹 +コガネ 金 +コガネ 小金 +コガネ 古金 +コガネ 黄金 +コガネ 故金 +コガネ 子金 +コガネ 巨銀 +コガネ 小賀根 +コガネイ 小金井 +コガネイ 黄金井 +コガネイシ 小金石 +コガネザカ 小金坂 +コガネザキ 黄金崎 +コガネサワ 小金沢 +コガネサワ 小金澤 +コガネザワ 小金沢 +コガネザワ 小金澤 +コカネザワ 小金澤 +コガネゾノ 小金園 +コガネハラ 小金原 +コガネヒラ 小金平 +コガネフチ 小金淵 +コガネブチ 小金渕 +コガネマル 小金丸 +コガネモリ 小金森 +コガネヤ 小金谷 +コガネヤ 古金谷 +コガネヤ 小金屋 +コガネヤマ 小金山 +コガノ 小賀野 +コガノ 小鹿野 +コガノ 古賀野 +コガノ 小我野 +ゴカノ 五箇野 +コガノキ 古我城 +コガハタ 古閑畑 +コガバヤシ 古賀林 +コガハラ 小河原 +コガハラ 古川原 +コガハラ 古河原 +コガハラ 古閑原 +コガハラ 古賀原 +コガハラ 古加原 +コカブ 小甲 +コカブ 古株 +コカブト 小甲 +コカベ 小壁 +コカマ 小鎌 +コガマ 古鎌 +コガマ 小釜 +コガマ 鈳 +コガマル 古閑丸 +コカミ 小上 +コカミ 古上 +コガミ 小上 +コガミ 小神 +コガミ 古頭 +コガミ 古上 +コガミ 古神 +コガミ 湖上 +コガミ 小紙 +コガミ 小髪 +ゴカミ 後上 +ゴカミ 五神 +ゴガミ 後上 +ゴガミ 後神 +ゴガミ 五上 +ゴガミ 五神 +コガミヤ 小上屋 +コガミヤ 小神谷 +コカメ 小亀 +コガメ 小亀 +コガメ 古亀 +コカモ 小鴨 +コガモ 小鴨 +コガモト 小加本 +コガモト 古閑本 +コガモリ 古閑森 +コカヤ 小萱 +コガヤ 小茅 +コガヤ 小萱 +ゴカヤ 五ケ谷 +ゴカヤ 五箇谷 +コガヤマ 古賀山 +コガヤマ 古閑山 +ゴカヤマ 五ケ山 +ゴカヤマ 後家山 +コカユ 小粥 +コガユ 小粥 +コガヨウ 小茅生 +コガラ 小柄 +コガラシ 凩 +コガラシ 木枯 +コガラス 小烏 +コガラス 小鴉 +コガラト 古唐戸 +コガラト 古唐櫃 +コガリ 小仮 +コガリ 小狩 +コカリマイ 小苅米 +コガリマイ 小苅米 +コカリヤ 小仮家 +コガルマイ 小軽米(小輕米) +コカワ 小川 +コカワ 古川 +コカワ 小河 +コカワ 古河 +コカワ 粉川 +コカワ 粉河 +コガワ 小川 +コガワ 古川 +コガワ 小河 +コガワ 古河 +コガワ 粉川 +コガワ 好川 +コガワ 子川 +コガワ 胡川 +コガワ 湖川 +コガワ 児川 +コガワ 狐川 +ゴカワ 五川 +ゴカワ 悟川 +コガワウチ 小河内 +コガワウチ 小川内 +コガワクチ 小川口 +コカワジ 小河路 +コカワダニ 粉川谷 +コガワチ 小川内 +コガワラ 小河原 +コガワラ 小川原 +コガワラ 古川原 +コガワラ 古河原 +コカン 古閑 +ゴカン 後閑 +ゴカン 後神 +ゴカン 五閑 +ゴカン 五官 +コカンダ 小神田 +コカンマル 古閑丸 +コキ 古木 +コキ 古起 +コキ 湖亀 +コギ 古木 +コギ 古城 +コギ 小木 +コギ 近木 +コギ 小儀 +コギ 古儀 +ゴキ 五木 +ゴキ 後記 +ゴキ 御器 +コギエ 漕江 +コギク 小菊 +コギシ 小岸 +コギシ 古岸 +コギシ 児岸 +コキシタ 小木下 +ゴキジョ 五鬼助 +ゴキジョウ 五鬼上 +コキソ 小木曽 +コキソ 小木曾 +コキソ 古木曽 +コギソ 小木曽 +コギソ 小木曾 +コキタ 小北 +コキタ 小木田 +コキタ 古北 +コキタ 小来田 +コキタ 小喜多 +コギタ 小北 +コギタ 小木田 +コギタ 古北 +コギタ 小来田 +コギタ 小喜多 +ゴキタ 五木田 +ゴキタ 五喜田 +ゴキタ 五畿田 +ゴキタ 五鬼田 +ゴキタ 後喜田 +ゴキタ 後喜多 +ゴキタニ 御器谷 +ゴキタニ 五幾谷 +ゴキツグ 五鬼継 +コギッタ 小橘田 +コキド 小木戸 +コキド 古城門 +コキド 小城戸 +コギナ 古木名 +コギノ 漕野 +コキハラ 小木原 +コギヒラ 公木平 +コギモト 小木本 +ゴキモト 五木本 +コキヤ 古喜屋 +ゴキヤ 五木谷 +コキュウ 粉究 +ゴキュウ 後久 +ゴキュウ 五弓 +ゴキュウ 後給 +ゴキュウ 御給 +ゴキュウ 後弓 +コキョウ 古郷 +ゴギョウ 五行 +コギリ 古桐 +コギリマ 小切間 +コギリマ 小桐間 +コギレ 小切 +コキン 小金 +コギン 古吟 +コギン 小銀 +コギン 児銀 +コキンドウ 古今堂 +コクアンイン 国安院(國安院) +コクイ 国井 +コクイ 國井 +コクイ 小久井 +コクイ 古久井 +ゴクイ 極意 +ゴクイ 御供井 +コクウン 国雲(國雲) +コクエ 小久江 +コグエ 小久江 +コクオ 石大 +コクガ 国賀 +コクガ 國賀 +コクガ 国衙 +コクガン 国眼 +コクガン 國眼 +コクサワ 石澤 +コクザワ 石沢 +コクザワ 石澤 +コクザワ 古久沢 +コクザワ 古久澤 +コクザワ 穀澤 +コクザワ 穀沢 +コクシ 国司 +コクシ 国師 +コクシ 國司 +コクシ 國師 +コグシ 小串 +ゴクショ 御供所 +コクショウ 国生 +コクショウ 國生 +コクショウ 黒正 +コクショウ 国掌 +コクス 古楠 +コグス 小楠 +コグスリ 小薬 +コグスリ 小藥 +コクセイ 國生 +コクセン 国仙 +コクセン 石仙 +コクセン 國仙 +コクセンタニ 國仙谷 +コクセンヤ 国仙谷 +コクセンヤ 國仙谷 +コクソ 黒祖 +コクソウ 国僧 +コクゾウ 穀蔵(穀藏) +コクタ 穀田 +コクダ 国田 +コクダ 國田 +コクダ 穀田 +ゴクタ 極田 +ゴクダ 御供田 +ゴクダ 後工田 +コクダイ 石代 +コクタニ 国谷 +コクタニ 黒谷 +コクタニ 國谷 +コクタニ 穀谷 +ゴクダン 極檀 +ゴクダン 極壇 +コグチ 小口 +コグチ 古口 +コグチ 湖口 +コグチ 胡口 +コグチダ 小口田 +コクデ 石出 +コクテン 国天(國天) +コクデン 国伝 +コクデン 國傳 +ゴクデン 御供田 +ゴクデン 極殿 +コクド 国土 +コクド 國土 +コクトウ 国東 +コクトウ 國東 +コクトウ 黒東 +コクトウ 古久籐 +コクドウ 国道 +コクドウ 國道 +コクナイ 穀内 +コクナイ 殻内 +コクニ 小国 +コクニ 小國 +コグニ 小国 +コグニ 小國 +コクニシ 国西 +コクニシ 國西 +コクヌギ 小椚 +コクネ 古久根 +コグネ 古久根 +コクノ 穀野 +コクノウ 国納 +コクノウ 國納 +コクバ 国場 +コクバ 國場 +コクハタ 石畑 +コクビ 小首 +コクフ 国府 +コクフ 國府 +コクブ 国分 +コクブ 國分 +コクブ 国府 +コクブ 国部 +コクブ 國府 +コクブ 國部 +コクフカタ 国府方 +コクフカタ 國府方 +コクフガタ 国府方 +コクフガタ 國府方 +コクブカタ 国府方 +コクブカタ 國府方 +コクブガタ 国府方 +コクブガタ 国分方 +コクブガタ 國府方 +コクフタ 国府田 +コクフタ 國府田 +コクフダ 国府田 +コクフダ 國府田 +コクブヤ 国府谷 +コクブヤ 國府谷 +コクブン 国分 +コクブン 國分 +コクブン 国文 +コクブンジ 国分寺(國分寺) +コクボ 小久保 +コクボ 古久保 +コクボ 小窪 +コクボ 国保 +コクボ 国母 +コクボ 國保 +コクボ 國母 +コクホウ 国宝 +コクホウ 國寳 +コクマ 小熊 +コクマ 古熊 +コクマ 国馬 +コクマ 國馬 +コクマ 小久間 +コグマ 小熊 +コグマ 小隈 +コグマ 古隈 +ゴクマ 五熊 +コクマイ 国米 +コクマイ 國米 +コクマエ 国前 +コグマサカ 小熊坂 +コグマザカ 小熊坂 +コクミ 小汲 +コクメ 小久米 +コクメ 小粂 +コクモト 黒元 +コクモト 穀本 +ゴクヤ 極屋 +コクヤマ 穀山 +コクラ 小倉 +コクラ 古倉 +コクラ 小蔵 +コクラ 古蔵 +コクラ 故倉 +コクラ 小藏 +コクラ 固蔵 +コグラ 小倉 +コグラ 小蔵 +コグラ 古蔵 +コグラ 児倉 +コクライシ 小倉石 +ゴクラク 極楽 +ゴクラクジ 極楽地 +ゴクラクジ 極楽寺 +コグリ 小栗 +コグリ 古栗 +ゴクリ 極里 +コクリキ 国力 +コグリヤマ 小栗山 +コクリュウ 国立 +コクリュウ 國立 +コクリュウ 国龍 +コクリョウ 国領 +コクリョウ 国料 +コクリョウ 國領 +コクリョウ 國料 +コクリョウ 石料 +コクリョウ 國嶺 +コグルス 小栗須 +コグルマ 小車 +コクレ 小暮 +コグレ 小暮 +コグレ 木暮 +コグレ 小榑 +コグレ 木榑 +コグレ 木檜 +コグレ 古暮 +コグレ 小昏 +コグレ 小檜(小桧) +コグレ 木桧 +コグレ 小塊 +コグレ 木槫 +コグレ 小槫 +コグロ 小黒 +コグロ 小畔 +コクワ 小桑 +コグワ 小桑 +コクワザワ 胡桑澤(胡桑沢) +コクワノ 胡桑野 +ゴグン 五郡 +コゲ 古家 +コゲ 此下 +コケアン 苔庵 +コケイ 古渓 +コケイ 古溪 +コケイ 湖景 +コケイシ 苔石 +コゲイチ 古家一 +コケグチ 苔口 +コケグチ 小ケ口 +コケダ 苔田 +コケツ 古結 +コゲツ 古結 +コゲツ 古月 +コゲツ 湖月 +コケナワ 苔縄 +コケハラ 苔原 +コケマエ 苔前 +コケモリ 小迎森 +コケヤマ 苔山 +コゲン 古源 +ゴケンイワ 五間岩 +コゲンジ 小源寺 +ゴケンチョウ 五間長 +ゴケンハマ 五軒浜(五軒濱) +ゴケンヤ 五軒矢 +ゴケンヤ 五軒家 +コゴ 古後 +ゴコ 五古 +ゴゴ 伍々 +ゴゴ 御後 +ゴゴ 後々 +コゴイ 小古井 +ココウ 古香 +ココウ 古工 +ココウ 古孝 +コゴウ 小郷 +コゴウ 古郷 +コゴウ 小合 +ゴコウ 後神 +ゴコウ 御幸 +ゴコウ 五香 +ゴコウ 五孝 +ゴコウ 伍香 +ゴゴウ 後郷 +ゴコウジ 後口寺 +コゴウタ 小合田 +コゴウチ 小河内 +ゴコウヤ 五香屋 +コゴエ 小越 +コゴエ 小肥 +ココカワ 爰河 +ココガワ 爰河 +ココガワ 爰川 +ゴコク 五穀 +ゴゴク 後極 +コゴシ 小越 +ココシマ 爰島 +ココジマ 爰島 +コゴタ 小牛田 +コゴタ 小午田 +ゴゴタ 後々田 +ココタカ 小々高 +ココダカ 小々高 +コゴタカ 小々高 +ココチ 爰地 +コゴチ 凝地 +ココノイ 九井 +ココノエ 九重 +ココノヒラ 九平 +ココボ 爰保 +ココマ 小駒 +コゴマ 小駒 +コゴマ 小古間 +コゴマ 小後摩 +コゴマ 小々馬 +ココモト 古々本 +コゴモリ 子籠 +コゴロ 古頃 +ココロイシ 心石 +ココン 古今 +ココン 小紺 +ココンノ 爰野 +コサ 小佐 +コサ 小左 +コサ 小㔫 +コザ 古座 +コザ 古坐 +ゴザ 御座 +ゴザ 呉座 +ゴザ 五座 +ゴザ 蓙 +コサイ 小佐井 +コサイ 小斎 +コサイ 小財(小戝) +コサイ 小斉 +コサイ 小才 +コサイ 小齋 +コサイ 小齊 +コサイ 小左井 +コサイ 小済 +コサイ 古佐井 +コザイ 小佐井 +コザイ 小材 +コザイ 古財 +コザイ 小斎 +コザイ 小財(小戝) +コザイ 小斉 +コザイ 古在 +コザイ 小齊 +コザイ 古戝 +ゴザイ 呉座井 +コザイカ 小雑賀 +コザイク 小細工 +コサイド 小才度 +コサイヒラ 小斉平 +コサイヒラ 小齊平 +コサイヒラ 小斎平 +コサイヒラ 小齋平 +コザイワ 古座岩 +コサオ 小竿 +コサオ 小棹 +ゴザオカ 御座岡 +コサカ 小坂 +コサカ 小阪 +コサカ 古坂 +コサカ 小酒 +コサカ 古阪 +コサカ 古酒 +コサカ 子坂 +コサカ 小栄(小榮) +コサカ 狐坂 +コサカ 児坂 +コサガ 古佐賀 +コザカ 小坂 +コザカ 小阪 +コザカ 小酒 +コサカイ 小堺 +コサカイ 小坂井 +コサカイ 小酒井 +コサカイ 小境 +コサカイ 小阪井 +コサカイ 小佐海 +コザカイ 小堺 +コザカイ 小坂井 +コザカイ 小酒井 +コザカイ 小境 +コザカイ 小阪井 +コザカイ 小界 +コザカイ 古堺 +コサカイエ 小坂家 +コサカエ 小栄(小榮) +コザカエ 小栄(小榮) +コサカダ 小坂田 +コサカダ 小阪田 +コサカタニ 小坂谷 +コザカタニ 小坂谷 +コサカベ 小坂部 +コサカベ 小酒部 +コサカベ 小坂辺(小坂邊) +コサカモト 小坂元 +コサカヤ 小坂家 +コサカヤ 小坂谷 +コザカヤ 小坂谷 +コザカヤ 古酒谷 +コザカヤ 小酒谷 +コサガワ 小佐川 +コサガワ 小砂川 +コサキ 小崎 +コサキ 古崎 +コサキ 小嵜 +コサキ 児崎(児嵜・兒崎) +コサキ 小先 +コサキ 湖崎 +コサキ 古嵜 +コサギ 小鷺 +コザキ 小崎 +コザキ 古崎 +コザキ 小嵜 +コザキ 狐崎 +コザキ 児崎(児嵜・兒崎) +コザキ 木嵜 +コザキ 湖崎 +コザキ 古嵜 +コザキ 胡崎 +コザキ 虎崎 +コザキ 孤崎 +コザキ 弧崎 +コザキ 湖埼 +コザキ 小埼 +ゴサキ 五崎 +コサキガワ 小崎川 +コサク 小作 +コサク 古作 +コザクラ 小桜 +コザクラ 小櫻 +コザクラ 児桜 +コサケ 小酒 +コザケ 小酒 +コサコ 小迫 +コサコ 古迫 +コサコ 小佐古 +コサコ 小浴 +コサコ 古佐小 +コサコ 子迫 +コサコ 小硲 +コサコ 小廻 +コサコ 小左古 +コサコ 小廹 +コサゴ 小砂 +コザコ 小迫 +コザコ 古迫 +コザコ 古佐小 +コザコ 子迫 +コザコ 小硲 +コザコ 小峪 +コザコ 古峪 +コサコダ 小迫田 +コササ 小笹 +コササ 小佐々 +コサザ 小佐々 +コザサ 小笹 +コザサ 小佐々 +コザサ 小篠 +コザサハラ 古笹原 +コササヤマ 小笹山 +コサシ 小指 +コサジ 小佐治 +コザシ 小指 +コザシ 古指 +コザス 小指 +コザス 古指 +コサダ 小佐田 +コサダ 古定 +コサダ 小定 +コサダ 古佐田 +コザタニ 古座谷 +ゴザタニ 呉座谷 +ゴザタニ 蓙谷 +コサツ 小札 +コサヅマ 小佐妻 +コサト 古里 +コサト 小里 +コザト 古里 +コザト 小里 +コサトヤ 小里谷 +コザネヨリ 小真頼(小眞頼) +コサノ 小佐野 +コザノ 古座野 +コザノ 小座野 +コサバ 小鯖 +コサハタ 小佐畑 +コサハラ 古佐原 +コサヒラ 小斉平 +コサヒラ 小齊平 +コサヒラ 小齋平 +コサベ 小佐部 +コサベ 小佐辺(小佐邊) +コザマ 小座間 +コサミ 小佐見 +コサムラ 小佐村 +コザムライ 小侍 +コサヤ 古鞘 +コサラ 小更 +コザラシ 古晒 +コザル 小猿 +コサワ 小沢 +コサワ 小澤 +コサワ 古沢 +コサワ 古澤 +コザワ 小沢 +コザワ 小澤 +コザワ 古沢 +コザワ 古澤 +コザワ 児沢 +コザワ 児澤 +ゴサワ 後澤 +ゴザワ 後沢 +ゴザワ 後澤 +ゴザワ 五沢 +コサワグチ 小沢口 +コサワダ 小沢田 +コサワヅ 小沢津 +コサンショウ 古三庄 +コサンダ 小三田 +コシ 越 +コシ 輿 +コシ 胡子 +コシ 古志 +コシ 腰 +コシ 古思 +コシ 小志 +コシ 顧 +コシ 顧志 +コジ 小路 +コジ 古地 +コジ 小司 +コジ 古字 +コジ 故字 +ゴシ 五師 +ゴシ 後士 +ゴジ 五次 +ゴジ 護持 +ゴジ 五字 +コシアイ 越合 +コシアサト 後安里 +コシアテ 腰当 +コシイ 越井 +コシイ 古椎 +コシイ 越居 +コシイオ 小椎尾 +コジイオ 小椎尾 +コシイシ 輿石 +コシイシ 越石 +コシイシ 興石 +コシイデ 越出 +コシイバ 小椎葉 +コシウジ 越姓 +コシウチ 越打 +コシウチ 越内 +コシウミ 越海 +コシウラ 越浦 +コシエ 越江 +コシエ 越栄(越榮) +コシオ 小塩 +コシオ 古塩 +コシオ 越尾 +コシオ 小椎尾 +コシオ 越生 +コシオ 小汐 +コシオ 腰尾 +コシオ 越塩 +コジオ 小塩 +コジオ 小椎尾 +コシオカ 越岡 +コシオカ 腰岡 +コジオカ 小路岡 +コシオカワ 小潮川 +コシオガワ 小潮川 +コシオノ 小塩野 +コシカ 小鹿 +コシカ 越賀 +コシカ 子鹿 +コシガ 越賀 +コジカ 小鹿 +コシガイ 越谷 +コシガイ 越替 +コシカエ 越替 +コシガエ 越替 +コシガエ 腰替 +コシカケ 腰掛 +コシカケ 腰懸 +コシカケザワ 越懸沢 +コシカケザワ 越掛沢 +コシカケザワ 越懸澤 +コジカタ 小路方 +コシカド 越門 +コシガミ 越上 +コシガヤ 越谷 +コシガヤ 越ケ谷 +コシカリ 越仮 +コシカワ 越川 +コシカワ 越河 +コシカワ 腰川 +コシガワ 越側 +コシキ 甑 +コシキ 越木 +ゴシキ 五敷 +ゴシキ 五色 +コシキイワ 越木岩 +コシキザワ 小式沢 +コシキザワ 甑沢 +コシキザワ 甑澤 +コシキザワ 小式澤 +コシキザワ 小敷沢 +コシキザワ 小敷澤 +コシキセ 小敷瀬 +コシキダケ 甑岳 +コシキヅカ 甑塚 +コシキミ 小式海 +コシキヤ 古敷谷 +コシキヤマ 小式山 +コシキヤマ 甑山 +コシキリ 越桐 +コシギリ 越桐 +コシグチ 越口 +コジグチ 小路口 +コシクニ 越国 +コシクビ 越首 +コシクモ 越雲 +コシグモ 越雲 +コシゲ 小重 +コシゲ 胡重 +コシコ 越湖 +コシゴエ 腰越 +コシコク 越石 +コシサカ 越坂 +コシサカ 腰坂 +コシザカ 越坂 +コシザカ 腰坂 +コシサキ 越崎 +コシザキ 越崎 +コシザキ 腰崎 +コシサコ 越迫 +コシザコ 越迫 +コシザワ 越沢 +コシザワ 越澤 +コシザワ 腰沢 +コシジ 越地 +コシジ 越路 +コシジ 越司 +コシジ 越治 +コシジ 腰地 +コシシタ 越下 +コシシバ 越柴 +コシシマ 越島(越嶋) +コシジマ 越島(越嶋) +コシジマ 腰島 +コシジマ 腰嶋 +コジシマ 小路島 +コシジョウ 越条 +コシジリ 越尻 +コシズカ 腰塚 +コシスギ 越杉 +コシズミ 越住 +コシズミ 越澄 +コシセ 越瀬 +コシゼン 越膳 +コシゾエ 腰添 +コシタ 越田 +コシタ 小下 +コシタ 腰田 +コシタ 越多 +コシタ 児下 +コシタ 胡下 +コシダ 越田 +コシダ 腰田 +コシダ 越多 +コジタ 小路田 +ゴシタ 五下 +コシタオ 越垰 +コシタカ 腰高 +コシタカ 越高 +コシダカ 腰高 +コシダカ 越高 +コシタケ 越竹 +コシタチ 越立 +コシダテ 越立 +コシタニ 越谷 +コシタニ 越渓 +コシタニ 越溪 +コシタニ 古志谷 +コジタニ 小路谷 +コジタニ 小治谷 +コジダニ 小路谷 +ゴシタニ 後谷 +コシダワ 越峠 +コシダワ 越乢 +コシチ 越知 +コシヂ 越地 +コシヅ 越津 +コジツ 小実 +コジツ 小實 +ゴジツ 後日 +コシツカ 腰塚 +コシツカ 腰冢 +コシヅカ 腰塚 +コシヅカ 越塚 +コシヅカ 腰冢 +コシデ 越出 +コシト 越戸 +コシト 越渡 +コシド 越戸 +コシド 越渡 +コジト 小地戸 +コシトウ 越藤 +コシトウ 越当 +コシトウ 越當 +コシドウ 越堂 +コシトウゲ 越峠 +コシトマエ 小志戸前 +コシトミ 越富 +コシトミ 越冨 +コシトリ 越取 +コシナ 越名 +コシナ 越科 +コジナ 小品 +コシナカ 越中 +コシナカ 越仲 +コシナガ 越永 +コシナミ 越浪 +コシナミ 越南 +コシナミ 越波 +コシヌマ 越沼 +コシネ 古志根 +コシノ 越野 +コシノ 小篠 +コシノ 古志野 +コシノ 腰野 +コシノ 越能 +コシノ 越農 +コシノ 輿野 +コシノウ 越納 +コシノウ 越農 +コシノミ 越海 +コシバ 小柴 +コシバ 小芝 +コシバ 越場 +コシバ 古柴 +コシバ 古芝 +コシバ 越馬 +コシバ 越葉 +コシバ 越塲 +コシバ 小斯波 +コシバエ 小椎八重 +コシハシ 越橋 +コシハタ 越畑 +コシハナ 越花 +コシハマ 越浜 +コシハマ 越濱 +コシバヤシ 越林 +コシハラ 腰原 +コシハラ 越原 +コシヒラ 越平 +コシブ 越生 +コシブ 小渋 +コシブ 小澁 +コシフジ 越藤 +コシブチ 越淵 +コシブチ 越渕 +コシベ 越部 +コシホソ 腰細 +コシボソ 腰細 +コシボリ 越堀 +コシマ 小島 +コシマ 小嶋 +コシマ 古島 +コシマ 小嶌 +コシマ 古嶋 +コシマ 越間 +コシマ 後間 +コシマ 越磨 +コジマ 小島 +コジマ 小嶋 +コジマ 児島 +コジマ 戸島 +コジマ 戸嶋 +コジマ 古島 +コジマ 児嶋 +コジマ 小嶌 +コジマ 古嶋 +コジマ 兒島 +コジマ 兒嶋 +コジマ 児嶌 +コジマ 巨島 +コジマ 故島 +コジマ 湖島 +コジマ 狐島(狐嶋) +コジマ 虎島(虎嶋) +コジマ 巨嶋 +コジマ 古至真 +コジマ 孤島(孤嶋) +コジマ 顧島 +コジマ 小縞 +コジマ 兒嶌 +ゴシマ 五島 +ゴシマ 五嶋 +ゴシマ 呉島 +ゴシマ 伍島 +ゴシマ 五嶌 +ゴシマ 伍嶋 +ゴシマ 後島 +ゴジマ 五島 +ゴジマ 五嶋 +ゴジマ 五嶌 +コシマイ 腰舞 +コシマエ 越前 +コシマエ 腰前 +コシマエダ 腰前田 +コシマキ 越巻 +コシマキ 腰巻 +コジマハラ 小島原 +コジマバラ 小島原 +コシマル 腰丸 +コシマル 越丸 +コジマル 小路丸 +コシマワリ 越廻 +コシマワリ 腰廻 +コシミ 越見 +コシミ 越三 +コシミズ 小清水 +コシミズ 輿水 +コシミズ 越水 +コシミズ 古清水 +コシミズ 興水 +コシミズ 腰水 +コシミチ 越道 +コシミチ 腰道 +コシミツ 越光 +コシミネ 越峯 +コシミヤ 越宮 +コシムタ 越牟田 +コシムネ 越宗 +コシムラ 越村 +コシムラ 越邑 +コシムラ 腰村 +コシメグリ 腰巡 +コシモ 小下 +コシモ 古下 +コシモ 小霜 +コシモト 越本 +コシモト 腰本 +コシモト 越元 +コシモト 腰元 +コジモト 柑本 +コシモリ 越森 +コシモリ 越守 +コシャ 古謝 +コシヤ 越谷 +コシヤ 越家 +コジャ 古謝 +コジャ 古蛇 +コジヤ 小路谷 +ゴシャ 後舎 +ゴシャ 五社 +ゴシャ 後舍 +ゴシャタニ 五社谷 +コシヤマ 越山 +コシヤマ 腰山 +コジヤマ 小路山 +ゴジュウキ 五十木 +ゴジュウチ 五十地 +ゴジュウメ 五重目 +ゴジュウメン 五拾免 +ゴショ 五所 +ゴショ 御所 +ゴショ 御書 +コショウ 古庄 +コショウ 古性 +コショウ 小正 +コショウ 古姓 +コショウ 古生 +コショウ 小庄 +コショウ 古匠 +コショウ 孤松 +コショウ 弧松 +コジョウ 古城 +コジョウ 古庄 +コジョウ 小城 +コジョウ 小上 +コジョウ 居城 +コジョウ 古上 +コジョウ 湖城 +コジョウ 公庄 +コジョウ 小條 +コジョウ 古条 +コジョウ 小条 +コジョウ 虎城 +コジョウ 固城 +コジョウ 估城 +ゴショウ 五荘 +ゴジョウ 半場 +ゴジョウ 五條 +ゴジョウ 五条 +ゴジョウ 後条 +ゴジョウ 後城 +ゴジョウ 後條 +ゴジョウ 五城 +ゴジョウ 護城 +ゴジョウ 五定 +コジョウカ 小城下 +ゴショウガワ 後生川 +ゴジョウガワ 五条川 +コショウジ 古小路 +コショウジ 小庄司 +コショウジ 小障子 +コショウジ 小正路 +ゴショウダ 五升田 +コショウドウ 小姓堂 +コショウブ 小勝負 +ゴジョウブ 五條歩 +コジョウボウ 小上防 +ゴジョウホウ 五条方 +ゴジョウボリ 五条堀 +ゴジョウボリ 五條堀 +コジョウマ 小上馬 +ゴショウメ 五升目 +ゴショウメ 五舛目 +ゴショウモト 五桝本 +ゴショウモト 五枡本 +ゴショオ 五所尾 +ゴショガワ 後生川 +ゴショクボ 御所窪 +ゴショゾノ 御所園 +ゴショタニ 御所谷 +ゴショデ 五舛出 +ゴショナ 御所名 +ゴショノ 御所野 +ゴショノ 御処野(御處野) +ゴショノ 護所野 +ゴショノオ 五所野尾 +ゴショムラ 五所村 +ゴショワキ 御所脇 +コシライ 小白井 +コシラエ 拵 +コシラカタ 小白方 +コシラカワ 小白川 +コシラカワ 古白川 +コシラキ 小白木 +コシラギ 小白木 +コジラキ 小白木 +コジリ 小尻 +コジリ 鐺 +コジリ 湖尻 +コシロ 古城 +コシロ 小城 +コシロ 小代 +コシロ 湖城 +コシロ 古代 +コシロ 固城 +コシロ 子白 +ゴシロ 後白 +ゴジロ 後城 +コシロイ 小白井 +コジロイ 小白井 +コシロウマル 小四郎丸 +コシロカネ 小白金 +コシロガネ 小白金 +コシン 小新 +コシン 古新 +コジン 小神 +コジン 小新 +コジン 小陣 +コジン 小陳 +コシンダ 小新田 +コシンドウ 小新堂 +コズ 古津 +ゴズ 牛頭 +ゴズ 午頭 +コスイ 古水 +コスイ 湖 +コスイ 湖水 +コズイ 小蘂 +ゴスイ 五水井 +ゴスイ 五酔 +コスエ 子末 +コズエ 小梢 +コズエ 梢 +コズエ 小末 +コズエ 梢江 +コスカ 小洲賀 +コスガ 小菅 +コスガ 小管 +コスガ 小須賀 +コスガ 小数賀(小數賀) +コズカ 小塚 +コズカ 狐塚 +コズカ 狐墳 +コズガイ 小番 +コズカタ 不来方 +コスガヤマ 小菅山 +コスキ 小漉 +コスギ 小杉 +コスギ 古杉 +コスギ 孤杉 +コスギ 小椙 +コスギ 弧杉 +コズキ 小築 +コスギタ 小杉田 +コスギダ 小杉田 +コスギヤマ 小杉山 +コスゲ 小菅 +コスゲ 小管 +コスゲ 古菅 +コスゲ 古管 +コスケガワ 小助川 +コスケガワ 小介川 +コスゴウ 越河 +コスゴウ 小菅生 +コスゴウ 小管生 +コスジ 小路 +コスジ 小筋 +コズシ 小図子(小圖子) +コスズ 小鈴 +コスズキ 小鈴木 +コスズメ 小雀 +コスタ 小寿田 +コスダ 小須田 +コスダ 古寿田(古壽田) +コスナ 小砂 +コスナゴ 小砂子 +コスナミ 小砂見 +コズノ 小津野 +コズハラ 楮原 +コズマ 古妻 +コズマ 小津間 +コスミ 古角 +コスミ 小角 +コスミ 小住 +コスミ 古住 +コスミ 小澄 +コスミ 小隅 +コスミ 子隅 +コズミ 古角 +コズミ 小角 +コズミ 小住 +コズミ 古積 +コズミ 古住 +コズミ 小澄 +コズミ 小積 +コズミ 木積 +コズミ 古澄 +コズメ 小詰 +コズヤ 小鳥谷 +コスリド 小摺戸 +コズル 小水流 +コセ 古瀬 +コセ 小瀬 +コセ 巨勢 +コセ 古世 +コセ 巨瀬 +コセ 小世 +コセ 許勢 +コゼ 小瀬 +ゴセ 五瀬 +ゴセ 御勢 +ゴセ 後世 +コセイ 古性 +コセウチ 小瀬内 +ゴセウメ 御世梅 +コセガキ 小瀬垣 +コセガワ 小瀬川 +コセガワ 戸瀬川 +コセキ 小関 +コセキ 古関(古關) +コセキ 古石 +コセキ 小瀬木 +コセキ 古積 +コセキ 古跡 +コセキ 小跡 +コセキ 小關 +コセキ 巨関 +コセキ 古籍 +コセキ 小世木 +コセギ 小瀬木 +コゼキ 小関 +コゼキ 小關 +ゴセキ 五関 +ゴセキ 後関 +コセキカワ 小関川 +コセキガワ 小関川 +コセコ 小迫 +コセコ 小瀬古 +コセコ 古世子 +コセコ 古世古 +ゴゼサコ 瞽女迫 +コセザワ 小瀬沢 +コセザワ 小瀬澤 +コセタ 小瀬田 +コセダ 小瀬田 +コセツ 戸設 +コセト 小瀬戸 +コセド 小瀬戸 +コセニ 小銭 +コゼニ 小銭 +コゼニオカ 小銭岡 +コセノ 小瀬野 +コセヒラ 小斉平 +コセヒラ 小齊平 +コセヒラ 小斎平 +コセヒラ 小齋平 +コセミズ 小瀬水 +コセムラ 小瀬村 +コセムラ 古瀬村 +コセモト 小瀬本 +コセヤ 小瀬谷 +コセラ 小瀬良 +コゼラ 小瀬良 +コセリ 小瀬利 +コセン 古泉 +コセン 小仙 +コセン 古銭 +コセン 古仙 +コセン 故選 +コゼン 小善 +ゴゼン 御前 +コセンダ 小千田 +コソ 小曽 +コソ 古曽 +コソ 小曾 +コゾウ 小蔵 +ゴソウ 五艘 +ゴソウ 五荘 +ゴゾウ 牛造 +コゾウザキ 小蔵崎 +コソウヤ 小曽宇谷 +コゾエ 小副 +コソエガワ 小副川 +コゾエガワ 小副川 +コソガ 小曽我 +コソガ 小曾我 +コソカワ 小曽川 +コソガワ 小曽川 +コソカワチ 社河内 +コソコ 小底 +コソシ 古曽志 +コゾタニ 楮谷 +コソデ 小袖 +コソト 小曽戸 +コソド 小曽戸 +コソネ 小曽根 +コソネ 小曾根 +コゾネ 小曽根 +コゾネ 小曾根 +コゾネ 古曽根 +コソノ 小園 +コソノ 小薗 +コソノ 古園 +コソノ 小曾納 +コソノ 小曽納 +コソノ 古其 +コゾノ 小園 +コゾノ 小薗 +コゾノ 古園 +コゾノ 小囿 +コゾノ 古其 +コゾノ 故園 +コソノイ 小薗井 +コゾノイ 小薗井 +コゾノイ 古園井 +コソノエ 小薗江 +コゾノエ 小薗江 +コゾノエ 小園江 +コソバ 小蕎 +コソバヤシ 社林 +コソベ 古曽部 +コソベ 古曾部 +コソベ 小曽部 +コソメ 小染 +コタ 小田 +コタ 木田 +コダ 小田 +コダ 古田 +コダ 木田 +コダ 子田 +コダ 小多 +コダ 児田 +コダ 兒田 +コダ 滹沱 +ゴタ 後田 +ゴタ 吾田 +ゴタ 五田 +ゴタ 伍田 +ゴダ 後田 +ゴダ 五田 +ゴダ 碁田 +ゴダ 語田 +ゴダ 伍田 +コタイ 小田井 +コタイ 小鯛 +コダイ 小鯛 +コダイ 古代 +コダイ 小台 +ゴダイ 五代 +ゴダイ 五大 +ゴダイ 伍代 +ゴダイイン 後醍院 +ゴダイイン 五大院 +コダイク 古大工 +ゴタイシ 五太子 +コダイラ 小平 +コダイラ 古平 +コダイラ 児平 +コタオ 小垰 +コタオ 古峠 +コタオ 古垰 +コダオ 小垰 +コダオ 古垰 +コタカ 小高 +コタカ 小鷹 +コタカ 古高 +コタカ 児高 +コタカ 古鷹 +コタカ 小嵩 +コタカ 兒高 +コダカ 小高 +コダカ 小鷹 +コダカ 古高 +コダカ 木高 +コダカ 児高 +コダカ 兒高 +コダカイ 小高井 +コタカガリ 小鷹狩 +コタカネ 小高根 +コタカミネ 小高峯 +コダカミネ 小高峯 +コダカミネ 小高峰 +コタカリ 小鷹狩 +コダカリ 小鷹狩 +コダガワ 小田川 +コダガワ 古田川 +コタキ 小滝 +コタキ 小瀧 +コタキ 古滝 +コタキ 古瀧 +コタキ 小多喜 +コダキ 小滝 +コダキ 小瀧 +コタギリ 小田切 +コタク 小宅 +コタク 古宅 +コタケ 小竹 +コタケ 小武 +コタケ 古武 +コタケ 小嶽 +コタケ 固武 +コダケ 小竹 +ゴタケ 後竹 +コタケウチ 小武内 +コタケエ 小竹栄 +コタケサ 小武佐 +コタケジマ 小竹島 +コタケデ 小竹出 +コタケバヤシ 小竹林 +コタケハラ 小竹原 +コタケモリ 小竹森 +コタケモリ 小竹守 +コタケモリ 小武守 +コタケヤマ 小竹山 +コダサワ 小田沢 +コダサワ 小田澤 +コタジマ 古田島 +コタジマ 答島 +コタジマ 古田嶋 +コダシマ 小田島 +コダシマ 小田嶋 +コダジマ 小田島 +コダジマ 古田島 +コダジマ 古田嶋 +コダシロ 小田代 +コタダ 小只 +コタダ 小多田 +コダタイ 小田多井 +コタタニ 小田谷 +コタダニ 小田谷 +コタチ 小太刀 +コタチ 小刀 +コタチ 古太刀 +コダチ 古舘 +コダチ 木立 +コダチ 小舘 +コダチ 小太刀 +コダチ 小立 +コダチ 古立 +コダチ 小達 +コダチ 小建 +コタチバナ 小橘 +コタチバナ 小立花 +コタツ 小辰 +コタツヤマ 小龍山 +コタテ 小舘 +コダテ 古館 +コダテ 古舘 +コダテ 小館 +コダテ 小舘 +コダテ 古立 +コタト 古田土 +コタド 古田土 +コダト 古田土 +コタナ 小棚 +コダナ 小棚 +コタナカ 小田中 +コタナカ 古田中 +コダナカ 小田中 +コダナカ 古田中 +コタナギ 小棚木 +コダナギ 小棚木 +コタニ 小谷 +コタニ 古谷 +コタニ 胡谷 +コタニ 児谷 +コタニ 粉谷 +コタニ 子谷 +コタニ 小渓 +コタニ 固谷 +コタニ 故谷 +コタニ 小溪 +コタニ 古多仁 +コタニ 孤渓 +コダニ 小谷 +コダニ 古谷 +コダニ 児谷 +コダニ 鼓谷 +ゴタニ 後谷 +ゴタニ 呉谷 +ゴタニ 五谷 +コタニカワ 小谷川 +コタニガワ 小谷川 +コタニグチ 小谷口 +コダニグチ 小谷口 +コタニヤ 小谷家 +コダハラ 古田原 +コタベ 小田部 +コタベ 小田辺 +コタベ 古田部 +コタベ 古多部 +コタベ 小田邊 +コタマ 児玉 +コタマ 小玉 +コタマ 樹神 +コタマ 古玉 +コダマ 児玉 +コダマ 小玉 +コダマ 兒玉(皃玉) +コダマ 樹神 +コダマ 古玉 +コダマ 子玉 +コダマ 児珠 +コダマ 兜玉 +コダマ 鬽 +コダマ 小瑤 +コダマ 神太麻 +コダマ 谺 +コダマタニ 児玉谷 +コダマヤ 児玉谷 +コダマヤ 小玉屋 +コタル 小垂(小埀) +コタレ 小垂 +コダレハ 小垂葉 +コタワ 小峠 +コタワ 小垰 +コダワ 小垰 +コダワラ 小俵 +コダワラ 古俵 +コダワラ 児田原 +コタン 小丹 +コダン 小段 +コダン 古段 +ゴタン 五反 +ゴタン 後反 +ゴタン 五丹 +ゴタン 五端 +ゴダン 後檀 +ゴタンジ 五反地 +コダンジョウ 小弾正 +ゴタンダ 五反田 +ゴタンダ 後反田 +ゴタンダヤ 五反田屋 +ゴタンヂ 五反地 +コタンバ 小丹波 +コタンバ 小丹羽 +ゴタンブ 五反分 +コタンボ 小丹保 +コチ 古地 +コチ 古知 +コチ 東風 +コチ 巨知 +ゴチ 五智 +コチアイ 小地合 +コチイ 小知井 +コチウラ 東風浦 +コチガハマ 東風浜(東風濱) +コチガミ 東風上 +コチザキ 東崎 +コチサワ 小地沢(小地澤) +コチザワ 小地沢(小地澤) +コチダイラ 東風平 +コチドマリ 東泊 +コチハマ 東風浜(東風濱) +コチヒラ 東風平 +コチベ 東部 +コチベ 巨智部 +コチャ 古茶 +コチャ 小茶 +コチヤ 東風谷 +コチヤ 古知屋 +コチヤ 古池谷 +コチヤ 小地谷 +コチヤ 古知谷 +コチヤ 小千谷 +ゴチャク 御着 +ゴチュウダ 後中田 +コチョウ 古長 +コチョウ 小長 +ゴチョウ 牛腸 +ゴチョウ 牛膓 +ゴチョウ 後町 +ゴチョウ 後長 +ゴチョウ 五町 +ゴチョウ 五丁 +ゴチョウ 後鳥 +ゴチョウ 午腸 +ゴチョウ 午膓 +ゴチョウ 後調 +ゴチョウ 丑膓 +ゴチョウ 午賜 +ゴチョウ 後丁 +ゴチョウモリ 五丁森 +ゴチョウモリ 五町森 +コヂリ 甲地里 +コチワ 小知和 +コチワ 東風輪 +コヂン 小陳 +コチンダ 東風平 +コツ 古津 +コヅ 小津 +コヅ 古津 +ゴツ 五津 +ゴツイ 五対(五對) +ゴツウ 五通 +コツカ 小塚 +コツカ 小束 +コヅカ 小塚 +コヅカ 狐塚 +コヅカ 古塚 +コヅカ 袴塚 +コヅカ 小柄 +コヅカ 孤塚 +コヅカ 児塚 +コヅカ 弧塚 +コヅカ 狐墳 +コツガイ 小番 +コツキ 小槻 +コツキ 小月 +コツキ 小附 +コツギ 木次 +コツギ 小次 +コツギ 小継 +コツギ 小嗣 +コヅキ 古月 +コヅキ 小築 +コヅキ 小月 +ゴツギ 五次 +コヅクエ 小机 +コヅクリ 木造 +コヅクリ 小造 +コヅケ 小附 +コツジ 小辻 +コツジ 古辻 +コツジ 小逵 +ゴツジ 五辻 +コツタ 小蔦 +コヅタ 小蔦 +コヅチ 小槌 +コヅチ 小鎚 +コヅチ 小土 +コツチハシ 小土橋 +コツチバシ 小土橋 +コツツミ 小堤 +コツヅミ 小堤 +コツヅミ 小鼓 +コツヅミ 小皷 +コヅツミ 小堤 +コヅツミ 古堤 +コヅツミ 小提 +コッテ 特手 +コット 忽戸 +コツナ 忽那 +コヅナ 小綱 +コツネ 小恒 +コヅノ 小津野 +コツバキ 小椿 +コツブ 小粒 +コツボ 小坪 +コツボ 小壷(小壺) +ゴツボ 五坪 +コツマ 古妻 +コヅマ 小妻 +コヅマ 古妻 +コヅマ 小津間 +コヅミ 古積 +コヅミ 小積 +コヅミ 木積 +コヅメ 孤爪 +コツリ 小釣 +コツル 小鶴 +コツル 古鶴 +コヅル 小鶴 +コヅル 小水流 +コヅワ 小津和 +コテ 小手 +コテ 古手 +コテイ 古定 +コテイ 小亭 +コテイシ 小手石 +コテガワ 小手川 +コテガワ 古手川 +コデキ 小出来(小出來) +コデサキ 小出崎 +コテザワ 小手沢 +コテザワ 小手澤 +コデショ 小出所 +コデセン 小出仙 +コテダ 小手田 +コテダ 籠手田 +コテダ 篭手田 +コテツ 小鉄(小鐵) +コテツ 古鉄(古鐵・古鐡) +コテツ 小鐡 +コデムラ 小出村 +コデモ 小伝茂 +コデモ 小傳茂 +コテモト 小手本 +コテモリ 小手森 +コテラ 小寺 +コテラ 古寺 +コテラ 小伝良(小傳良) +コデラ 小寺 +コデラ 古寺 +コデラ 児寺 +コデラ 少寺 +コテラサワ 小寺沢 +コテラサワ 小寺澤 +コテラザワ 小寺沢 +コテラザワ 小寺澤 +コテラヤマ 小寺山 +コテン 小天 +コデン 小伝(小傳) +ゴテン 五天 +ゴデン 呉田 +ゴデン 五殿 +ゴデンキ 五伝木 +ゴデンキ 五傳木 +ゴデンギ 五伝木 +ゴデンギ 五傳木 +コデンモ 小傅茂 +コテンラ 小伝良(小傳良) +コデンラ 小伝良(小傳良) +コト 古戸 +コト 小戸 +コト 琴 +コト 児戸 +コト 事 +コド 古戸 +コド 児戸 +ゴト 五戸 +ゴト 五斗 +ゴト 後戸 +コトイ 小樋 +コトイ 殊井 +コトイ 琴井 +コドイ 小土井 +コドイ 古土居 +コドイ 小土居 +コトイダニ 琴井谷 +コトウ 古藤 +コトウ 小藤 +コトウ 小東 +コトウ 厚東 +コトウ 古東 +コトウ 湖東 +コトウ 戸藤 +コトウ 巨藤 +コトウ 虎頭 +コトウ 児塔 +コトウ 故東 +コトウ 児藤 +コトウ 小頭 +コトウ 古籐 +コトウ 湖藤 +コトウ 胡藤 +コドウ 近藤 +コドウ 古藤 +コドウ 小藤 +コドウ 古道 +コドウ 小堂 +コドウ 小洞 +コドウ 古堂 +ゴトウ 後藤 +ゴトウ 五島 +ゴトウ 五藤 +ゴトウ 五嶋 +ゴトウ 神門 +ゴトウ 五頭 +ゴトウ 呉藤 +ゴトウ 呉島 +ゴトウ 後東 +ゴトウ 悟道 +ゴトウ 梧桐 +ゴトウ 五東 +ゴトウ 五嶌 +ゴトウ 午頭 +ゴトウ 郷頭 +ゴトウ 後道 +ゴトウ 五斗 +ゴトウ 五刀 +ゴトウ 伍藤 +ゴトウ 呉東 +ゴトウ 後当 +ゴトウ 后藤 +ゴトウ 伍堂 +ゴトウ 吾藤 +ゴトウ 後登 +ゴトウ 後當 +ゴトウ 後島 +ゴトウ 後籐 +ゴトウ 郷藤 +ゴトウ 五唐 +ゴトウ 五籐 +ゴトウ 伍東 +ゴトウ 吾東 +ゴトウ 後嶋 +ゴトウ 後等 +ゴトウ 梧藤 +ゴドウ 牛堂 +ゴドウ 悟道 +ゴドウ 後堂 +ゴドウ 後道 +ゴドウ 五堂 +ゴドウ 五道 +ゴドウ 午堂 +ゴドウ 伍堂 +ゴドウ 語堂 +ゴドウ 呉堂 +ゴドウ 護堂 +コトウゲ 小峠 +コトウゲ 古峠 +コドウサイ 小道才 +コトウダ 小藤田 +コトウダ 古藤田 +ゴトウダ 後藤田 +コトウノ 古藤野 +ゴトウバシ 後藤橋 +ゴトウミョウ 後燈明 +コトウメ 琴梅 +コドウヤ 古道谷 +ゴトウヤ 五島屋 +ゴトウヤ 五嶋屋 +コトウラ 琴浦 +コトウラ 事浦 +コトオ 琴尾 +コトオカ 琴岡 +コトオカ 琴陵 +ゴトオダ 後遠田 +コトガ 小栂 +コトガオカ 琴賀岡 +コトカワ 琴川 +コトカワ 琴河 +コトキ 毎木 +コトギ 小研 +コトク 古徳 +コトク 小徳 +ゴトク 五得 +ゴトク 五徳 +コトグチ 事口 +コトサイ 殊才 +コトサカ 琴坂 +コトザキ 琴崎 +コトザキ 事崎 +コトジ 㕝子 +コトジ 琴地 +コトシバ 事柴 +コトジマ 琴島 +コトシロドウ 事代堂 +コトセ 小道世 +コドセ 小道世 +コトタ 琴田 +コトダ 琴田 +コトダ 小戸田 +ゴトダ 五斗田 +コトタニ 琴谷 +コトタニ 事谷 +コトチボラ 小栃洞 +コトヅカ 琴塚 +コドテ 小土手 +コトドメ 特留 +コトネ 小刀祢 +コトネ 小刀称(小刀稱) +コトネ 小刀禰 +コトネ 小刀根 +コトネ 小刀弥 +コトノ 琴野 +コトノ 小殿 +コドノ 古殿 +コドノ 神殿 +コドノ 小殿 +コドバシ 小土橋 +コトハタ 琴畑 +コトハラ 琴原 +コトビ 小鳶 +コトヒラ 琴平 +コトブキ 寿 +コトブキ 壽 +コトブキヤマ 寿山 +ゴトマキ 五斗蒔 +コドマリ 小泊 +コトミ 古富 +コトミ 琴見 +コトミヤ 琴宮 +コトムラ 琴村 +コトモト 琴本 +コトモリ 小戸森 +コトモリ 琴森 +コドモリ 小戸森 +コトヤ 琴谷 +コトヤ 琴屋 +コドヤ 古道谷 +コトヤマ 壽山 +コトヤマ 琴山 +コトヨリ 琴寄 +コトラ 小虎 +コトリ 小鳥 +コトリ 古鳥 +コトリ 小取 +コドリ 小鳥 +コトリイ 小鳥居 +コトリイ 小鳥井 +コトリダ 小鳥田 +コナ 小名 +コナ 小納 +コナ 粉奈 +コナ 古奈 +コナイ 古内 +コナイ 小内 +コナイ 湖内 +ゴナイカワ 五内川 +ゴナイガワ 五内川 +コナウチ 粉名内 +コナエ 小苗 +コナカ 小中 +コナカ 小仲 +コナカ 古仲 +コナカ 古中 +コナカ 胡中 +コナカ 小央 +コナカ 湖中 +コナカ 胡仲 +コナガ 古長 +コナガ 古永 +コナガ 小長 +コナガ 小永 +ゴナカ 後中 +コナカイ 小仲井 +コナカイ 小中居 +コナガイ 小長井 +コナガイ 小永井 +コナガイ 故長井 +コナカオ 小中尾 +コナカザワ 小中沢 +コナカザワ 小中澤 +コナカジマ 小中島(小中嶋) +コナガタ 小永田 +コナカダニ 小中谷 +コナカデ 小中出 +コナカトミ 小中冨 +コナガネ 小長根 +コナカノ 小中野 +コナガノ 小長野 +コナカハラ 小中原 +コナガミツ 小長光 +コナガミツ 小永光 +コナカムラ 小中村 +コナカヤ 小中谷 +コナカヤ 小仲谷 +コナガヤ 小長谷 +コナガヤ 古永家 +コナガヤ 古長谷 +コナガヤ 小永谷 +コナカヤマ 小中山 +コナガヨシ 小永吉 +コナガレ 小流 +コナカワ 粉川 +コナカワ 小央 +コナガワ 粉川 +コナガワ 小名川 +コナサカ 小名坂 +コナシ 小梨 +コナシ 樹梨 +コナシ 小無 +コナシバ 子成場 +コナスカワ 小茄子川 +コナスガワ 小茄子川 +コナダ 小灘 +コナダ 小名田 +コナツ 小夏 +コナテ 古名手 +コナハ 小那覇 +コナベ 小鍋 +コナベ 小辺(小邊・小邉) +コナミ 木南 +コナミ 小波 +コナミ 小浪 +コナミ 古波 +コナミ 児波 +コナミ 小並 +コナミ 児浪 +コナヤ 小納谷 +コナヤ 古名家 +コナヨシ 粉吉 +コナリ 小成 +コナリ 児成 +コナリタ 小成田 +コナワ 小縄 +コナワ 小繩 +コナワシロ 小苗代 +コナンバ 小難波 +コニ 小仁 +コニイ 児仁井(兒仁井) +コニイ 古新 +コニイ 古新居 +コニイ 児新 +コニイ 小仁井 +コニクマ 小仁熊 +コニコ 小荷子 +コニコ 小仁子 +コニシ 小西 +コニシ 古西 +コニシ 小丹枝 +コニシ 湖西 +コニシ 猫西 +コニシ 児西 +コニシイケ 小西池 +コニシカワ 小西川 +コニシガワ 小西川 +コニシキ 小錦 +コニシタニ 小西谷 +コニシデ 小西出 +コニシヤ 小西谷 +コニシヤマ 小西山 +コニショ 小仁所 +コニショ 古仁所 +コニタ 小荷田 +コニタ 小仁田 +コニタ 小二田 +コニマタ 小二又 +コニュウバ 小入羽 +コニリ 小二里 +コニワ 小庭 +コヌキ 小貫 +コヌキ 小椚 +コヌキヤマ 小貫山 +コヌシ 古主 +コヌシ 小主 +コヌタ 小岱 +コヌタ 古怒田 +コヌマ 小沼 +コヌマ 古沼 +コヌマノ 小沼野 +コヌリ 小塗 +コネ 小根 +ゴネイ 五寧 +コネガワ 古根川 +コネグチ 小根口 +コネクニ 小根国 +コネクニ 小根國 +コネクボ 小根久保 +コネムラ 古根村 +コネモリ 小根森 +コネヤマ 小根山 +コネリ 小練 +コネン 小稔 +コノ 小野 +コノ 古野 +コノ 木野 +コノ 児野 +コノ 小納 +コノ 狐野 +コノ 此 +コノ 湖野 +ゴノ 後野 +ゴノ 五野 +ゴノ 吾野 +ゴノイ 五井 +ゴノイ 五ノ井 +ゴノイ 五野井 +ゴノイ 五の井 +コノイケ 小野池 +コノイケ 此池 +コノウ 小納 +コノウ 小能 +コノウ 古農 +コノウ 古納 +コノウエ 木上 +コノウエ 此上 +コノウエ 小野上 +コノウエ 小ノ上 +ゴノウエ 後上 +ゴノウエ 五野上 +ゴノウエ 五ノ上 +ゴノウエ 期上 +コノウチ 此内 +コノウラ 木浦 +コノウラ 甲ノ浦 +コノウラ 此浦 +コノエ 近衛(近衞) +コノエ 此永 +コノエ 木衛 +ゴノエ 五戸 +コノエダ 此枝 +コノオ 木尾 +コノオ 此尾 +ゴノオ 後尾 +コノオク 此ノ奥 +コノオク 此奥 +コノオク 比奥 +コノガイト 此垣内 +ゴノカマ 虹釜 +コノガミ 此上 +ゴノカミ 五野上 +ゴノカミ 五上 +ゴノカミ 護守 +ゴノカミ 後ノ上 +ゴノカミ 五神 +ゴノカミ 後埜上 +ゴノガミ 五野上 +コノカワ 此川 +コノキ 此木 +コノキ 好木 +コノキ 此ノ木 +ゴノキ 後野木 +コノクチ 此口 +ゴノクチ 河之口 +コノサキ 此崎 +コノサキ 尖崎 +コノサト 此里 +ゴノジ 五之治 +コノシタ 神下 +コノシタ 此下 +コノシタ 公下 +コノシマ 木島 +コノシマ 小野島 +コノシマ 此島 +コノシマ 此嶋 +コノシマ 小ノ島 +コノシマ 小ノ嶋 +コノシリ 此尻 +コノセ 許勢 +コノタ 小岱 +コノタ 此田 +コノダ 此田 +ゴノダ 五ノ田 +コノタニ 此谷 +ゴノタニ 五ノ谷 +コノツネ 此常 +ゴノツボ 五ノ坪 +ゴノツボ 五の坪 +コノテラ 此寺 +コノデラ 此寺 +コノナガ 此永 +コノハ 木葉 +コノハナ 木花 +コノハラ 此原 +コノハラ 児之原 +コノハラ 児ノ原 +コノヒラ 木平 +コノヒラ 此平 +コノブ 小延 +コノブ 小信 +コノベ 小延 +コノベ 此部 +ゴノヘ 五戸 +コノマ 木間 +コノマ 小野間 +コノマ 古野間 +コノマ 此間 +コノマツ 此松 +コノミ 許斐 +コノミ 木稲 +コノミ 木実 +コノミ 小能見 +コノミ 菓 +コノミ 好 +コノミ 此見 +コノミ 木實 +コノミ 許野見 +コノムラ 此村 +コノムラ 木ノ村 +コノムラ 古野村 +コノモト 木本 +コノモト 此本 +コノモト 此元 +コノモト 古野本 +コノモリ 此森 +コノワ 此和 +コハ 光葉 +コバ 木場 +コバ 木庭 +コバ 古場 +コバ 小場 +コバ 小波 +コバ 小羽 +コバ 古波 +コバ 古葉 +コバ 古馬 +コバ 古羽 +コバ 古庭 +コバ 小葉 +コバ 木塲 +コバイ 古梅 +コバイ 古倍 +コバイシ 小波石 +コバイシ 小羽石 +コバイシ 小場石 +コバエ 小八重 +コバエ 小梅枝 +コバガワ 小場川 +コハギ 小萩 +コハギサワ 小萩沢(小萩澤) +コハギザワ 小萩沢(小萩澤) +コハク 小白 +コハク 古伯 +コハク 小博 +コハクラ 古波蔵 +コハクラ 古波倉 +コハクラ 古波藏 +コハグラ 古波蔵 +コハグラ 古波倉 +コハグラ 小波蔵(小波藏) +コハグラ 古波藏 +コバクラ 古波蔵 +コハゲ 小禿 +コバケ 小化 +コバコ 小箱 +コバサ 小場佐 +コバサキ 木場崎 +コバサコ 木場迫 +コバサコ 木塲迫 +コハザマ 小硲 +コハザマ 小狭 +コハザメ 古波鮫 +コハシ 古橋 +コハシ 小橋 +コハシ 小端 +コハシ 小梯 +コバシ 古橋 +コバシ 小橋 +コバシ 小端 +コバシ 小梯 +コバシ 児橋 +コバシ 巨橋 +コバシ 小槁 +コバシ 兒橋 +コハシカワ 小橋川 +コハシガワ 小橋川 +コバシカワ 小橋川 +コバシガワ 小橋川 +コハシグチ 小橋口 +コバジマ 小羽島 +コバシラ 小柱 +コバシリ 小走 +コバシリ 虎走 +コハセ 小長谷 +コハセ 小早稲 +コバセ 小長谷 +コバセ 小早瀬 +コバセ 虎走 +コバセ 小波瀬 +コハタ 小畑 +コハタ 小幡 +コハタ 木幡 +コハタ 古畑 +コハタ 小畠 +コハタ 小籏 +コハダ 小羽田 +コバタ 小畑 +コバタ 小幡 +コバタ 木幡 +コバタ 古畑 +コバタ 小畠 +コバタ 古幡 +コバタ 古旗 +コバタ 木場田 +コバタ 小端 +コバタ 小旗 +コバタ 小羽田 +コバタ 古端 +コバタ 小八田 +コバタ 子幡 +コバタ 小葉田 +コバタ 古場田 +コバタ 小場田 +ゴハタ 五畑 +コハタケ 小葉竹 +コバタケ 小畑 +コバタケ 小畠 +コバタケ 小葉竹 +コバタケ 巨畠 +コハタダ 小畑田 +コバタニ 小場谷 +コハチ 古八 +コバチ 小鉢 +コバチ 木鉢 +コハツ 小波津 +コハツ 古波津 +コハナ 小花 +コハナ 小端 +コハナ 木花 +コハナ 小鼻 +コバナ 小花 +コバナ 小塙 +ゴハナ 牛鼻 +ゴハナ 午鼻 +コハナイ 小花衣 +コハナイ 小花井 +コハナワ 小塙 +コハナワ 小華和 +コバナワ 小塙 +コバナワ 小華和 +コバナワ 小花波 +コバネ 小羽根 +コバネ 子羽根 +コバノ 木場野 +コハバ 小幅 +コババ 小馬場 +コハマ 小浜 +コハマ 小濱 +コハマ 古浜 +コハマ 古濱 +コハマ 胡浜(胡濱) +コハマ 児浜 +コハマ 湖浜(湖濱) +コハマ 児濱 +コハマダ 小浜田 +コハマダ 小濱田 +コバマツ 小葉松 +コハモト 小波本 +コバモト 小波本 +コハヤ 小早 +コバヤ 木場谷 +コハヤカワ 小早川 +コハヤガワ 小早川 +コバヤカワ 小早川 +コバヤガワ 小早川 +コハヤシ 小林 +コハヤシ 小早志 +コバヤシ 小林 +コバヤシ 古林 +コバヤシ 児林 +コバヤシ 光林 +コバヤシ 子林 +コバヤシ 小早志 +コバヤシ 湖林 +コバヤシ 兒林 +ゴバヤシ 五林 +コバヤシガワ 小林川 +コバヤシキ 小早敷 +コハヤセ 小早瀬 +コバヤセ 小早瀬 +コハヤタニ 小早谷 +コハラ 小原 +コハラ 古原 +コハラ 子原 +コハラ 児原 +コバラ 小原 +コバラ 古原 +ゴハラ 後原 +コハライ 小原井 +コバライ 小原井 +コバライ 小払 +コバライ 小拂 +コハラギ 小原木 +コハラザカ 小原坂 +コハラザワ 小原沢 +コハラザワ 小原澤 +コハラタ 小原田 +コハラダ 小原田 +コハラノ 小原野 +コハリ 小針 +コハリ 小張 +コハリ 小梁 +コハリ 小播 +コバリ 小針 +コバリ 小張 +コバリ 古張 +コバリ 古針 +コハル 小春 +コハル 古春 +コバル 小原 +コハン 小半 +コバン 小番 +コバン 小判 +コバン 古伴 +ゴバン 碁盤 +コハンダ 小半田 +コバンタ 木場田 +コバンダ 木場田 +コバンバ 小馬場 +コバンバ 小番場 +コヒ 小樋 +コヒ 小肥 +コヒ 小比 +コビ 小尾 +コビ 小比 +ゴヒ 呉比 +コヒイ 小樋井 +コビエ 小冷 +コビエ 小稗 +コヒガ 小比賀 +コヒガ 小比加 +コヒガシ 小東 +コヒガシ 古東 +コヒキ 小引 +コヒキ 古曳 +コヒキ 古曵 +コビキ 木挽 +コビキ 小引 +コビキ 古曳 +コビキ 小曳 +コビキ 木引 +コビキ 故引 +コビキ 古挽 +コビキ 小日置 +コビキ 梚木 +コビキ 古曵 +コビキ 小曵 +コビキ 粉引 +コビキ 木梚 +コビキヤ 木挽屋 +コヒゲ 小肥下 +コヒサ 小久 +コビシ 小菱 +コヒタ 小比田 +コヒダ 小比田 +コビタ 小比田 +コビタニ 古比谷 +コビタニ 子生谷 +コヒツ 小櫃 +コヒツ 古筆 +コビツ 小櫃 +コヒデ 小日出 +コビト 小人 +コヒナタ 小日向 +コビナタ 小日向 +コビノ 小尾野 +コヒノキ 小檜(小桧) +コヒハラ 小桧原 +コヒハラ 小檜原 +コヒビキ 小響 +コビヤ 古尾谷 +ゴヒャクダ 五百田 +ゴヒャクメ 五百目 +コヒヤマ 小檜山 +コヒヤマ 小桧山 +コヒヤマ 小日山 +コヒヤマ 小樋山 +コヒヤマ 古日山 +コヒヤマ 古桧山 +コヒヤマ 小比山 +コヒヤマ 小飛山 +コヒヤマ 古檜山 +コビヤマ 小檜山 +コビヤマ 小桧山 +コビヤマ 小日山 +コビヤマ 媚山 +コビヤマ 古日山 +コビヤマ 古桧山 +コビヤマ 小比山 +コビヤマ 小飛山 +コビヤマ 古檜山 +コヒョウグ 小兵具 +コヒラ 小平 +コヒラ 古平 +コヒラ 児平 +コビラ 小平 +ゴヒラ 後平 +コヒラガタ 小平潟 +コビラキ 小開 +コヒラサワ 小平沢 +コヒラザワ 小平沢 +コヒラザワ 小平澤 +コヒラタ 小平田 +コヒラバ 小平場 +コヒルイマキ 小比類巻 +コビルイマキ 小比類巻 +コヒロ 小広 +コヒロ 小廣 +コビロ 小廣 +コヒロカワ 小広川 +コヒロカワ 小廣川 +コヒロガワ 小廣川 +コフ 古布 +コフ 古府 +コブ 古布 +ゴブイケ 五歩池 +ゴブイチ 五歩一 +コブエ 古笛 +コブエ 小笛 +コブカ 小深 +コブカイ 小武海 +コフカタ 小深田 +コフカダ 小深田 +コブカタ 小深田 +コブカタ 小武方 +コブキ 小吹 +コブキ 古吹 +ゴブキ 五分木 +コフク 小福 +コフク 古福 +ゴフク 呉服 +ゴフク 御福 +ゴフク 五福 +ゴフク 後福 +コフクガワ 小福川 +コフクダ 小福田 +コブクロ 小袋 +コフケ 小更 +コブケ 小更 +コブケ 古武家 +コブケ 小武家 +コブケ 小泓 +コブケ 古泓 +コブケ 小夫家 +コブケ 小富家(小冨家) +コフサ 児房 +コブサ 児房 +コブサ 小房 +コフジ 古藤 +コフジ 小藤 +コフジ 小冨士 +コフジ 小富士 +コブシ 小節 +コブシ 小伏 +コブシ 虎伏 +コフジタ 小藤田 +コブシロ 古武城 +コフシワキ 古伏脇 +コフシワキ 小伏脇 +コブシワキ 古伏脇 +コブスマ 小伏間 +コフセ 小布施 +コブセ 小布施 +コブセ 小伏 +コブタ 古部田 +コブタニ 昆布谷 +コブチ 小渕 +コブチ 小淵 +コブチ 古渕 +コブチ 古淵 +コフツ 小蓬 +コフツハラ 小蓬原 +コフデ 小筆 +コフドウ 小不動 +コフナ 小鮒 +コブナ 小鮒 +コフナイ 小船井(小舩井) +コブナイ 小船井(小舩井) +コブナイ 小武内 +コフナト 小舟戸 +コフナト 小船戸 +コフナト 小舩戸 +コフナバ 古船場 +コブナヤ 小船谷 +コフネ 小船 +コフネ 小舟 +コフネ 小舩 +コブネ 小船 +コブネ 小舟 +コブネ 小舩 +コブノキ 枋木 +コブヤ 古武家 +コブヤ 昆布谷 +コブヤ 昆布屋 +コブヤマ 小布山 +コブヤマ 小武山 +コブヤマ 小部山 +コブヤマ 幸婦山 +コブヤマ 古婦山 +コブヤマ 昆布山 +ゴブリ 五冨利 +コフル 小古 +コフロ 子冨呂 +ゴブン 後分 +コブンコウ 小分校 +コブンザカ 小分坂 +コベ 小部 +ゴベ 五辺 +ゴベ 後部 +ゴベ 五邉 +コヘイ 小平 +コヘイ 小塀 +ゴヘイ 五幣 +ゴヘイ 五瓶 +ゴヘイ 御幣 +ゴヘイ 五弊 +ゴヘイ 五幤 +ゴヘイジ 五平地 +コヘイマ 小平間 +コベケ 小部家 +ゴヘジ 五平地 +コベツ 小別 +コベッショ 小別所 +コベットウ 小別当 +コベットウ 小別當 +コベニ 小紅 +コヘヤ 弘平谷 +コベヤ 小部家 +コベヤマ 古部山 +コベンノ 小弁野 +コベンノ 小辨野 +コボ 古保 +コボ 小保 +ゴボイチ 五歩市 +コホウ 孤峰 +コボウ 古坊 +コボウ 小坊 +ゴホウ 五宝 +ゴホウ 五寶 +ゴホウ 五寳 +ゴホウ 後宝 +ゴホウ 護法 +ゴボウ 牛房 +ゴボウ 五宝 +ゴボウ 午房 +ゴボウ 牛坊 +ゴボウ 御坊 +ゴボウ 後坊 +ゴボウ 五坊 +ゴボウ 五寶 +ゴボウ 五寳 +ゴボウ 午坊 +ゴボウ 後房 +ゴボウザキ 午房崎 +コボウシ 小法師 +ゴボウタ 御坊田 +ゴボウタニ 御坊谷 +ゴボウマエ 御坊前 +コボキ 古保木 +コボキ 小保木 +コボク 小木 +コボシ 小星 +コボシ 古保志 +コホシバ 小干場 +コホソザワ 小細沢 +コホソザワ 小細澤 +コボソザワ 小細沢 +コボソザワ 小細澤 +コボタ 小保田 +コボトケ 小仏 +コボトケ 小佛 +コボネ 小保根 +コボノキ 枋木 +コボヤ 戸保家 +コボラ 小洞 +コホリ 小堀 +コホリ 古堀 +コホリ 小湟 +コボリ 小堀 +コボリ 古堀 +コボリ 古保里 +コボリ 古壕 +コボリ 児堀 +コボリ 小掘 +コボリウチ 小堀内 +コボリカワ 小堀川 +コホリダ 小堀田 +コボリタ 小堀田 +コボリナイ 小堀内 +コホリバタ 小堀端 +コホリバタ 小掘端 +ゴホン 五本 +ゴホンギ 五本木 +コホンジ 小本地 +ゴホンジョウ 五本上 +ゴホンマツ 五本松 +コマ 高麗 +コマ 小間 +コマ 駒 +コマ 木間 +コマ 狛 +コマ 古満(古滿) +コマ 胡摩 +コマ 胡間 +コマ 児馬 +コマ 巨摩 +ゴマ 胡摩 +ゴマ 胡麻 +ゴマ 後間 +ゴマ 胡間 +ゴマ 五間 +コマアラシ 駒嵐 +コマイ 駒井 +コマイ 古米 +コマイ 駒居 +コマイ 小間井 +コマイ 小馬井 +コマイ 狛井 +コマイ 小舞 +コマイケ 駒池 +コマイサミ 駒勇 +コマイタ 駒板 +ゴマイバシ 五枚橋 +ゴマイワ 五間岩 +コマウチ 駒内 +コマエ 小前 +コマエ 古前 +コマエ 駒栄 +コマエ 駒江 +ゴマエ 五前 +コマエダ 小前田 +コマエダ 古前田 +コマオカ 駒岡 +コマガイ 小間海 +コマガキ 駒垣 +コマカゼ 駒風 +コマガタ 駒形 +コマガタ 駒方 +コマガネ 駒兼 +コマガノ 胡摩ケ野(胡广ケ野) +ゴマガノ 胡摩ケ野(胡广ケ野) +コマガミネ 駒ケ嶺 +コマガミネ 駒ケ峯 +コマガミネ 駒ケ峰 +コマガミネ 駒ケ領 +コマガヤ 駒ケ谷 +コマガリ 小曲 +コマカワ 駒川 +コマガワ 駒川 +コマガワ 小間川 +コマキ 小牧 +コマキ 駒木 +コマキ 小巻 +コマキ 古牧 +コマキ 小槙 +コマキ 古巻 +コマキ 駒城 +コマキ 古蒔 +コマキ 古槙 +コマキ 小槇 +コマキ 駒帰 +コマキ 古槇 +コマキ 胡麻木 +コマキ 小間喜 +コマキ 小間木 +コマキ 小摩木 +コマキ 驪城 +コマギ 駒木 +コマキザワ 小巻沢 +コマキザワ 小巻澤 +コマキゾノ 小牧園 +コマキタ 駒喜多 +コマキネ 駒木根 +コマキネ 駒杵 +コマギネ 駒木根 +コマキノ 駒木野 +コマギノ 駒木野 +コマギリ 駒切 +コマグチ 駒口 +コマグチ 小間口 +ゴマクボ 胡摩窪 +コマグミ 駒組 +コマクラ 駒倉 +コマゲ 駒下 +コマゴ 小孫 +コマゴ 駒子 +コマゴエ 駒越 +コマコシ 駒越 +コマゴメ 駒込 +コマゴメ 駒米 +コマサ 小正 +コマサ 小政 +コマサカ 駒坂 +コマサカ 駒阪 +コマサカ 小間坂 +コマサキ 駒崎 +コマザキ 駒崎 +コマザキ 胡摩崎 +コマザキ 駒埼 +コマザキ 駒嵜 +ゴマサキ 胡摩崎 +ゴマサキ 胡麻崎 +ゴマザキ 胡摩崎 +ゴマザキ 胡麻崎 +コマサク 駒柵 +ゴマサコ 護广迫 +コマサト 駒里 +コマサドミ 小正富 +コマサワ 駒沢 +コマサワ 駒澤 +コマザワ 駒沢 +コマザワ 駒澤 +コマザワ 小間沢 +コマザワ 小間澤 +コマジ 駒路 +コマシタ 駒下 +コマシマ 駒島 +ゴマジマ 胡麻島 +ゴマジマ 胡麻嶋 +コマシャク 駒尺 +コマジャク 駒尺 +コマジュ 駒寿(駒壽) +ゴマショ 護摩所 +ゴマジリ 胡麻尻 +コマシロ 駒城 +コマス 小桝 +コマス 小舛 +コマス 小益 +コマス 小升 +コマス 小増 +コマス 小枡 +コマズリ 駒摺 +コマセ 駒瀬 +コマセ 駒勢 +コマセ 小馬瀬 +コマタ 小俣 +コマタ 駒田 +コマタ 古俣 +コマタ 小又 +コマタ 小股 +コマタ 小亦 +コマタ 小叉 +コマタ 子俣 +コマタ 小跨 +コマタ 小俟 +コマダ 駒田 +コマダ 菰田 +コマダ 胡麻田 +コマダ 小馬田 +コマダ 小間田 +ゴマダ 胡麻田 +ゴマダ 胡摩田 +ゴマダイラ 胡摩平 +コマタカ 駒高 +コマダカ 駒高 +コマダテ 駒館 +コマダテ 駒舘 +コマダナ 駒棚 +コマタニ 駒谷(馰谷) +コマタニ 狛谷 +コマダニ 駒谷 +コマチ 小町 +ゴマチ 五町 +コマチヤ 小町谷 +コマチヤ 小町屋 +コマツ 小松 +コマツ 駒津 +コマツ 古松 +コマツ 小枩 +コマヅ 駒津 +コマツイ 小松井 +コマツオ 小松尾 +コマツカ 駒塚 +コマヅカ 駒塚 +コマツガワ 小松川 +コマツキ 駒月 +コマツギ 小松木 +コマヅキ 駒月 +コマツクラ 小松倉 +コマツケ 駒附 +コマツサキ 小松崎(小松碕) +コマツザキ 小松崎(小松碕) +コマツザキ 小松嵜 +コマツサワ 小松沢 +コマツザワ 小松沢 +コマツザワ 小松澤 +コマツシマ 小松島 +コマツシロ 小松代 +コマツゾノ 小松園 +コマツダ 小松田 +コマツダイラ 小松平 +コマツダニ 小松谷 +コマツツカ 小松塚 +コマツヅカ 小松塚 +コマツナガ 小松永 +コマツノ 小松野 +コマツバヤシ 小松林 +コマツバラ 小松原 +コマツバラ 古松原 +コマツヒラ 小松平 +コマツマル 小松丸 +コマヅメ 駒詰 +コマツモト 小松本 +コマツヤ 小松谷 +コマツヤ 小松屋 +コマツヤ 小枩谷 +コマツヤマ 小松山 +コマヅル 胡摩鶴 +ゴマツル 胡麻鶴 +ゴマヅル 胡麻鶴 +コマツワ 駒津和 +コマデ 駒出 +コマデラ 駒寺 +コマト 小的 +コマド 湖間戸 +ゴマドウ 護摩堂 +コマドメ 駒留 +コマナカ 駒中 +コマニシ 小間西 +コマニシ 駒西 +コマニワ 駒庭 +コマネ 駒根 +コマノ 駒野 +コマノベ 駒延 +コマノベ 高麗辺 +コマノメ 駒野目 +コマノヤ 駒谷 +コマノヤ 駒野谷 +コマバ 駒場 +コマバ 小間場 +コマバ 駒馬 +コマバ 駒塲 +コマハシ 駒橋 +コマハシリ 駒走 +コマバシリ 駒走 +コマハタ 駒畠 +コマバヤシ 駒林 +コマバヤシ 狛林 +コマハラ 駒原 +コマハラ 䓔原 +コマビキ 駒引 +コマブチ 駒渕 +コママエ 小間前 +コママキ 駒牧 +コママツ 駒松 +コマミ 駒見 +コマミズ 駒水 +コマミネ 駒嶺 +コマミネ 駒峯 +コマミネ 駒峰 +コマミヤ 駒宮 +コマミヤ 小間宮 +コマムラ 駒村 +コマメ 駒目 +コマモト 駒本 +コマモト 駒元 +ゴマモト 胡麻本 +コマモノ 小間物 +コマモノヤ 小間物谷 +コマヤ 駒谷 +コマヤ 駒屋 +コマヤ 小馬谷 +コマヤ 小間屋 +コマヤ 小間谷 +コマヤマ 駒山 +コマユウ 駒勇 +コマヨシ 駒吉 +コマヨセ 駒寄 +コマリ 小鞠 +コマル 小丸 +コマル 古丸 +コマル 児丸 +コマル 兒丸 +ゴマル 五丸 +ゴマル 吾丸 +コマルヤマ 小丸山 +コマワカ 駒若 +コマワキ 駒脇 +コマワタリ 駒渡 +コマワリ 小廻 +コマン 古満 +コマン 小万 +ゴマンド 五万戸 +コミ 小見 +コミ 古味 +コミ 古見 +コミ 巨海 +コミ 来見(來見・耒見) +コミ 小味 +コミ 小美 +ゴミ 五味 +ゴミ 五見 +コミエ 込江 +コミオ 込尾 +コミオカ 込岡 +ゴミオカ 五味岡 +コミカイ 込貝 +コミガイ 込貝 +コミカド 小御門 +コミカド 古御門 +コミカド 小見門 +コミカド 古美門 +コミカド 小見角 +コミカド 小三門 +コミカワ 小見川 +コミカワ 児美川 +コミガワ 児美川 +ゴミカワ 五味川 +コミグチ 込口 +コミコ 小神子 +コミザワ 古見沢 +ゴミサワ 五味沢 +ゴミサワ 五味澤 +ゴミザワ 五味沢 +ゴミザワ 五味澤 +コミズ 古水 +コミズ 小水 +コミズナイ 小水内 +コミゾ 小溝 +コミゾ 古溝 +ゴミゾ 後溝 +コミタ 込田 +コミタ 小見田 +コミタ 小味田 +ゴミタ 五味田 +ゴミタ 五味多 +コミタニ 小見谷 +コミチ 小路 +コミチ 小道 +コミチ 小通 +コミチバ 小道場 +コミチャ 込茶 +コミツ 古光 +コミツ 小光 +コミツ 小満 +コミデラ 小見寺 +コミト 込戸 +コミト 小見戸 +コミト 小美戸 +コミト 古水戸 +コミドウ 込堂 +コミドウ 小美堂 +コミドリ 小緑 +コミドリ 小翠 +コミドリ 小翆 +コミナ 小皆 +コミナト 小湊 +コミナト 米湊 +コミナト 小港 +コミナミ 小南 +コミナミ 古南 +コミナミ 小美浪 +コミナミ 小見波 +コミナミ 湖南 +コミナミ 子南 +コミナミダテ 小南館 +コミナミダテ 小南舘 +コミネ 小峰 +コミネ 小峯 +コミネ 小嶺 +コミネ 古峰 +コミネ 小宮根 +コミネ 古峯 +コミノ 小美濃 +コミノ 小美野 +コミノ 小見野 +コミノ 小簑(小簔) +コミノ 小蓑 +コミノ 込野 +ゴミノモト 五味之本 +ゴミハラ 五味原 +コミブチ 小味渕 +コミブチ 小味淵 +ゴミブチ 五味淵 +ゴミブチ 五味渕 +ゴミモト 五味本 +コミヤ 小宮 +コミヤ 古宮 +コミヤ 籠宮 +コミヤ 篭宮 +コミヤ 込宮 +コミヤ 込谷 +コミヤ 小宮谷 +コミヤ 胡宮 +コミヤ 黄宮 +ゴミヤ 五宮 +コミヤザワ 小宮沢 +コミヤザワ 小宮澤 +コミヤジ 小宮路 +コミヤジ 小宮地 +コミヤダ 小宮田 +コミヤタニ 小宮谷 +コミヤバヤシ 小宮林 +コミヤマ 小宮山 +コミヤマ 込山 +コミヤマ 小見山 +コミヤマ 籠山 +コミヤマ 児見山(兒見山) +コミヤマ 小味山 +コミヤマ 古宮山 +コミヤマ 古見山 +コミヤマ 小深山 +コミヤマ 古美山 +コミヤマ 児宮山 +コミヤマ 古味山 +コミヤマ 小美山 +ゴミョウ 五明 +ゴミョウ 後明 +ゴミョウダ 五明田 +コミワ 古味輪 +コムカイ 小向 +コムカイ 小武海 +コムカイ 小向井 +コムカイ 小迎 +コムカエ 小迎 +コムカエ 小向得 +コムカエモリ 小迎森 +コムギ 小麦 +コムギカワ 小麦川 +コムギサキ 小麦崎 +コムギザキ 小麦崎 +コムギタ 小麦田(小麥田) +コムク 小椋 +コムスビ 小結 +コムタ 小牟田 +コムタ 小無田 +コムネ 小宗 +コムヤマ 小武山 +コムラ 小椋 +コムラ 小村 +コムラ 古村 +コムラ 香村 +コムラ 小邑 +コムラ 小邨 +ゴムラ 後村 +ゴムラ 五村 +コムライ 小村井 +コムラカタ 小村方 +コムラサキ 小紫 +コムラサキ 小村崎 +コムラタ 小村田 +コムラタニ 小村谷 +コムレ 小牟礼 +コムレ 小牟禮 +コムレ 子牟礼 +コムロ 小室 +コムロ 古室 +コムロ 粉室 +コムロ 児室 +コムロ 篭宅(籠宅) +コムロヤマ 小室山 +コメ 米 +コメ 小目 +コメイ 米井 +ゴメイ 五明 +ゴメイ 五名 +ゴメイ 吾明 +コメイエ 米家 +コメイジ 古明地 +コメイジ 古明治 +コメイチ 古明地 +コメイヂ 古明地 +コメイマ 米今 +コメイリ 米入 +コメエ 米衛(米衞) +コメオカ 米岡 +コメガエ 米替 +コメカド 米門 +コメカネ 米金 +コメカミ 米上 +コメカミ 米神 +コメカワ 米川 +コメガワ 米川 +コメキ 米木 +コメキュウ 米久 +コメクラ 米蔵 +コメザキ 米崎 +コメサワ 米澤 +コメザワ 米澤 +コメシ 小飯 +コメジ 古明地 +コメシタ 米下 +コメシマ 米島 +コメショウ 米庄 +コメス 米須 +コメセ 米世 +コメタ 米田 +コメダ 米田 +コメダシ 米出 +コメタニ 米谷 +コメタニ 込谷 +コメタニ 米渓 +コメタニ 米溪 +コメダニ 米谷 +コメチ 古明地 +コメツギ 米次 +コメヅミ 米積 +コメトウ 米藤 +コメドオリ 米通 +コメナカ 米中 +コメナガ 米長 +コメナミ 米浪 +コメネ 米根 +コメノ 米野 +コメノ 米納 +コメノ 米埜 +コメノイ 米ノ井 +コメノイ 米野井 +コメノウ 米納 +コメハナ 米花 +コメハナ 米華 +コメバヤシ 米林 +コメハラ 米原 +コメヒラ 米平 +コメマス 米桝 +コメムシ 米虫 +コメムス 米蒸 +コメムラ 米村 +コメモ 米茂 +コメモト 米本 +コメモト 米元 +コメヤ 米谷 +コメヤ 米屋 +コメヤ 古目谷 +コメヤ 米矢 +コメヤ 小目谷 +コメヤス 米安 +コメヤマ 米山 +コメヨシ 米吉 +コメヨシ 米由 +コメヨシ 米好 +コメラ 小米良 +コメン 古免 +コモイケ 菰池 +コモイケ 小茂池 +コモイケ 蒋池 +コモイケ 薦池 +コモウ 菰生 +コモウ 古望 +コモウ 古毛 +コモオ 粉生 +コモオカ 薦岡 +コモオカ 菰岡 +コモガサコ 茭ケ迫 +コモカタ 菰方 +コモガワ 小茂川 +コモグチ 菰口 +コモグチ 茭口 +コモグチ 薦口 +コモザワ 菰沢(菰澤) +コモシキ 菰敷 +コモシタ 菰下 +コモシマ 菰島 +コモジリ 小茂尻 +コモタ 薦田 +コモタ 菰田 +コモタ 小茂田 +コモタ 古茂田 +コモタ 籠田 +コモダ 薦田 +コモダ 菰田 +コモダ 小茂田 +コモダ 古茂田 +コモダ 篭田 +コモダ 籠田 +コモダ 蒋田 +コモダ 子茂田 +コモダ 䓔田 +コモチ 菰池 +コモチ 小持 +コモチ 小餅 +コモチドメ 小持留 +コモチバ 菰千葉 +コモチヤ 小餅谷 +コモデ 小茂出 +コモト 古本 +コモト 小本 +コモト 古元 +コモト 小元 +コモト 胡本 +コモト 固本 +コモト 湖本 +コモト 子本 +ゴモト 後本 +ゴモト 五本 +コモドウ 古毛堂 +コモトリ 小茂鳥 +コモドリ 小茂鳥 +コモニシ 菰西 +コモノ 薦野 +コモノ 菰野 +コモノ 蒋野(蔣野) +コモノ 小物 +コモノヤ 小物谷 +コモハラ 菰原 +コモブチ 菰渕 +コモブチ 薦渕 +コモブチ 菰淵 +コモリ 小森 +コモリ 古森 +コモリ 小守(小垨) +コモリ 古守 +コモリ 子守 +コモリ 児森(兒森) +コモリ 小盛 +コモリ 児守 +コモリ 小毛利 +ゴモリ 護守 +ゴモリ 後守 +コモリザワ 小森沢 +コモリソノ 小森園 +コモリゾノ 小森園 +コモリタ 小森田 +コモリタ 籠田 +コモリダ 小森田 +コモリダ 籠田 +コモリタニ 籠谷 +コモリバヤシ 小森林 +コモリバヤシ 小守林 +コモリミヤ 小森宮 +コモリヤ 小森谷 +コモリヤ 篭谷 +コモリヤ 籠谷 +コモリヤ 小守谷 +コモリヤ 籠屋 +コモリヤ 古森谷 +コモリヤマ 小森山 +コモロ 小室 +コモロ 小師 +コモロ 小諸 +コモン 小門 +コモン 古門 +コモングチ 小門口 +コモンゼン 小門前 +コモンマエ 小門前 +コヤ 小谷 +コヤ 古谷 +コヤ 古屋 +コヤ 古家 +コヤ 小屋 +コヤ 木屋 +コヤ 小矢 +コヤ 胡屋 +コヤ 粉家 +コヤ 小弥 +コヤ 古耶 +コヤ 固屋 +コヤ 姑射 +コヤ 湖屋 +コヤ 小舎 +ゴヤ 呉屋 +ゴヤ 後野 +ゴヤ 胡屋 +ゴヤ 呉谷 +ゴヤ 五谷 +ゴヤ 五屋 +ゴヤ 吾屋 +コヤイシ 小家石 +コヤイヅ 小柳津 +コヤイデ 小柳出 +コヤウチ 小谷内 +コヤウチ 古谷内 +コヤエ 小八重 +コヤオカ 小屋岡 +コヤカイチ 小屋開地 +コヤガイト 小屋垣内 +コヤガキ 小屋垣 +コヤカシロ 小八ケ代 +コヤガシロ 小八ケ代 +コヤカタ 古舘 +コヤギ 小柳 +コヤギ 小八木 +コヤギ 小谷木 +コヤク 小薬 +コヤク 小藥 +コヤグチ 小屋口 +コヤクマル 小役丸 +コヤケ 小宅 +コヤケ 古宅 +コヤケ 神宅 +コヤケヤマ 小焼山 +コヤゴ 古家後 +コヤゴ 古屋後 +コヤゴシ 小屋越 +コヤサキ 小矢崎 +コヤザキ 小谷崎 +コヤサコ 小屋迫 +コヤザワ 小矢沢(小矢澤) +コヤシキ 古屋敷 +コヤシキ 小屋敷 +ゴヤシキ 後屋敷 +コヤジマ 小矢島 +コヤジマ 紺屋嶋 +コヤジマ 古谷島 +コヤジマ 紺屋島 +コヤス 子安 +コヤス 小安 +コヤス 小保 +コヤス 古安 +コヤス 児安 +コヤス 児保 +コヤス 小易 +コヤスナガ 小安永 +コヤスミ 小休 +コヤセ 小谷瀬 +コヤセ 古屋瀬 +コヤセ 小屋瀬 +コヤタ 小谷田 +コヤタ 古谷田 +コヤタ 小矢田 +コヤタ 古屋田 +コヤタ 小屋田 +コヤダ 小谷田 +コヤダ 古谷田 +コヤダ 小矢田 +コヤダ 古屋田 +コヤダ 小屋田 +コヤダイラ 小家平 +コヤタニ 小屋谷 +コヤチ 小谷内 +コヤチ 小谷地 +コヤチ 古谷内 +コヤチ 此谷内 +コヤツ 小谷津 +コヤツ 古谷津 +コヤヅ 小谷津 +コヤド 神宿 +コヤド 小宿 +コヤナ 小梁 +コヤナ 昆陽名 +コヤナカ 小谷中 +コヤナカ 古屋仲 +コヤナガワ 小梁川 +コヤナギ 小柳 +コヤナギ 古柳 +コヤナギ 幸柳 +コヤナツ 小柳津 +コヤナヅ 小柳津 +コヤネ 小屋根 +コヤノ 小谷野 +コヤノ 古谷野 +コヤノ 児矢野 +コヤノ 小屋野 +コヤノ 古屋野 +コヤノ 古家野 +コヤノ 小矢野 +コヤノ 児屋野 +コヤノ 古矢野 +コヤノ 古埜 +コヤノ 古谷埜 +コヤノ 小家野 +コヤバ 小屋場 +コヤハタ 小屋畑 +コヤハタ 小矢畑 +コヤバタ 小屋端 +コヤハラ 小屋原 +コヤハラ 小谷原 +コヤバラ 小谷原 +コヤブ 小薮 +コヤブ 小藪 +コヤブ 小籔 +コヤブ 古藪 +コヤベ 小谷部 +コヤマ 小山 +コヤマ 古山 +コヤマ 児山 +コヤマ 越山 +コヤマ 湖山 +コヤマ 岨 +コヤマ 固山 +コヤマ 黄山 +コヤマ 故山 +コヤマ 兒山 +コヤマ 粉山 +コヤマ 弧山 +コヤマ 子山 +コヤマ 扈山 +ゴヤマ 五山 +コヤマイシ 小山石 +コヤマカワ 小山川 +コヤマガワ 小山川 +コヤマギシ 小山岸 +コヤマグチ 小山口 +コヤマザキ 小山崎 +コヤマジ 小山路 +コヤマシタ 小山下 +コヤマタ 小山田 +コヤマダ 小山田 +コヤマダ 古山田 +コヤマダニ 小山谷 +コヤマチ 小屋町 +コヤマツ 小屋松 +コヤマツ 小谷松 +コヤマツ 小家松 +コヤマテ 小山手 +コヤマト 小倭 +コヤマド 小山戸 +コヤモト 紺屋本 +コヤモト 小屋本 +コヤモト 小谷本 +コヤモト 古屋本 +コヤリ 小鑓 +コヤリ 小鎗 +ゴユ 御油 +コユウ 古結 +コユウ 小遊 +ゴユデ 五由出 +コユバ 小弓場 +コユハラ 小湯原 +コユバラ 小湯原 +コユミ 古弓 +コユミ 小弓 +コユミカワ 小弓川 +コユミバ 小弓場 +コユリ 小由里 +コユワイ 小祝 +コヨウ 小用 +コヨウ 小要 +コヨウ 小陽 +コヨウ 古要 +ゴヨウ 五葉 +ゴヨウ 伍用 +ゴヨウギ 五葉木 +ゴヨウダニ 五葉谷 +コヨオ 越尾 +コヨケ 午除 +コヨサキ 小代崎 +コヨシ 小吉 +コヨシ 古吉 +コヨシ 子吉 +コヨシ 古好 +コヨシカワ 小吉川 +コヨシダ 小吉田 +コヨセ 古寄 +コヨタ 小代田 +コヨダ 小代田 +コヨツカ 小余塚 +コヨヅカ 小余塚 +コヨネ 小米 +コヨモギ 小艾 +ゴラ 五良 +コライ 古来(古來) +ゴライ 五来(五來) +ゴライ 牛来(牛來・牛耒) +ゴライ 午来(午來・午耒) +ゴライ 五耒 +コラサキ 小楽崎(小樂崎) +コラザキ 小楽崎(小樂崎) +ゴラシマ 五良島 +コラタ 古良田 +コリイケ 小利池 +ゴリエ 五利江 +ゴリエ 五里江 +ゴリカミ 五里守 +ゴリガワラ 五里川原 +コリキ 小力 +ゴリク 五陸 +コリシゲ 凝重 +ゴリチ 五里地 +ゴリヤ 鮴谷 +ゴリュウ 牛流 +ゴリュウカンダ 五龍神田 +コリュウヅ 小柳津 +コリョウ 古了 +ゴリョウ 御領 +ゴリョウ 五領 +ゴリョウスイ 五良水 +ゴリョウソノ 御領園 +ゴリョウゾノ 御領園 +ゴリョウダ 五領田 +ゴリョウハラ 御領原 +ゴリョウバラ 御領原 +ゴリン 五輪 +ゴリン 五林 +コレ 是 +コレイ 是井 +コレイシ 是石 +コレウラ 是浦 +コレエダ 是枝 +コレオカ 是岡 +コレカタ 是方 +コレカド 是角 +コレカネ 是兼 +コレカネ 是金 +コレカワ 是川 +コレキ 是木 +コレキヨ 是清 +コレクニ 是国 +コレクニ 是國 +コレコダ 是此田 +コレサ 是佐 +コレサダ 是貞 +コレサダ 是定 +コレサワ 是沢 +コレサワ 是澤 +コレザワ 是沢 +コレザワ 是澤 +コレシゲ 是重 +コレシゲ 是繁 +コレシタ 是下 +コレシマ 是島 +コレスエ 是末 +コレスミ 惟住 +コレズミ 惟住 +コレズミ 是住 +コレタ 是田 +コレダ 是田 +コレタカ 惟高 +コレタカ 是高 +コレタケ 是竹 +コレタダ 是忠 +コレタニ 是谷 +コレチカ 是近 +コレツ 是津 +コレツキ 是月 +コレツグ 是次 +コレツネ 是常 +コレツネ 是恒 +コレツネ 此経 +コレト 是時 +コレトウ 是洞 +コレトウ 惟任 +コレトウ 是藤 +コレドウ 是洞 +コレトシ 是利 +コレトモ 是友 +コレナガ 是永 +コレナガ 伊永 +コレナガ 惟永 +コレナガ 是長 +コレナリ 是成 +コレノブ 是信 +コレノリ 是則 +コレヒサ 伊久 +コレヒサ 是久 +コレヒラ 是平 +コレヒロ 是広 +コレヒロ 是廣 +コレマサ 是政 +コレマツ 是松 +コレミツ 是光 +コレムラ 惟村 +コレムラ 是村 +コレモト 是本 +コレモト 是元 +コレモリ 是森 +コレモリ 是盛 +コレヤ 是谷 +コレヤス 是安 +コレヤス 惟康 +コレヤマ 是山 +コレユキ 是行 +コレヨシ 是吉 +コロ 上良 +ゴロ 後呂 +ゴロ 五呂 +コロイシ 転石 +コロイシ 頃石 +コロイシ 古路石 +コロイシ 轉石 +ゴロウ 伍楼(伍樓) +ゴロウ 五老 +ゴロウ 五郎 +ゴロウ 砙礫 +ゴロウ 俉樓 +ゴロウオ 五郎尾 +ゴロウカイ 五老海 +ゴロウカワ 五郎川 +ゴロウガワ 五郎川 +ゴロウザ 五郎三 +ゴロウジ 五郎地 +ゴロウジマ 五郎島 +ゴロウダイ 五郎大 +ゴロウタニ 五郎谷 +ゴロウベ 五郎部 +ゴロウマル 五郎丸 +ゴロウミズ 五郎水 +ゴロウヤ 五郎谷 +ゴロオカ 後呂岡 +ゴロカワ 五郎川 +ゴロガワ 五郎川 +コロキ 古路木 +コロキ 頃木 +コロク 小禄 +コロク 小六 +コロク 古六 +コロク 古録 +コロスエ 頃末 +コロスエ 頃未 +コロダ 来田 +コロダ 來田 +コロダテ 小呂館 +コロダテ 小呂舘 +コロツネ 頃常 +コロバ 木呂場 +コロハシ 頃橋 +ゴロハタ 五郎畑 +コロビシ 転石 +ゴロベ 五郎部 +ゴロマル 五郎丸 +コロメ 衣目 +コロメガワ 衣目川 +コロモ 衣 +コロモカワ 衣川 +コロモガワ 衣川 +コロモダ 衣田 +コロモハラ 衣原 +コロモヤ 衣谷 +コロヤス 頃安 +コロヤス 項安 +コロン 鼓呂雲 +コワ 古和 +コワ 小和 +コワ 小輪 +ゴワ 後和 +コワイタ 小和板 +コワカ 小若 +コワカメ 小若女 +コワカメ 子若女 +コワキ 小脇 +コワキ 児脇 +コワグチ 強口 +コワグチ 小和口 +コワグチ 古和口 +コワクツ 小圷 +コワザキ 剛崎 +コワシ 小鷲 +コワシ 強 +コワセ 小長谷 +コワセ 小和瀬 +コワセ 強瀬 +コワセ 小輪瀬 +コワセ 小早瀬 +コワセ 小早稲 +コワタ 小幡 +コワタ 木幡 +コワタ 小渡 +コワタ 小綿 +コワタ 古和田 +コワタ 木綿 +コワタ 小和多 +コワダ 小和田 +コワダ 古和田 +コワダ 強田 +コワタニ 剛谷 +コワタリ 小渡 +コワタリ 古渡 +ゴワミヤ 五和宮 +コワヤ 古和谷 +コワリ 小割 +コワリ 古割 +コワリ 古和利 +コワン 小湾 +コン 今 +コン 近 +コン 昆 +コン 金 +コン 根 +コン 紺 +コンイ 紺井 +コンイチ 紺一 +コンイッコウ 紺一向 +コンオカ 紺岡 +コンカキ 紺掻 +コンカワ 紺川 +コンキ 紺木 +ゴンギョウ 権業(權業) +ゴンゲン 権現 +ゴンゲン 権元 +ゴンゲン 権軒(權軒) +ゴンゲン 權現 +ゴンゲンドウ 権現堂(權現堂) +ゴンゲンメン 権現免 +ゴンゲンリョウ 権現領(權現領) +ゴンゴ 言後 +コンコウ 金光 +コンコウ 紺孝 +コンゴウ 金剛 +コンゴウ 近郷 +コンコウジ 金小路 +コンゴウジ 金剛寺 +コンゴウジ 金剛地 +コンゴウジ 金小路 +コンゴウジョウ 金剛乗 +コンゴウセ 金剛瀬 +コンゴウセ 金剛背 +コンゴウチ 金剛地 +コンゴウマル 金剛丸 +コンザ 紺座 +ゴンザ 権座 +ゴンザ 権左 +ゴンザ 権坐 +コンサカ 紺阪 +コンザキ 紺崎 +コンサコ 紺迫 +コンザワ 紺沢(紺澤) +コンジ 紺地 +ゴンジ 権次 +コンジキ 近喰 +コンジマ 紺島 +コンシャ 紺社 +コンジャ 近者 +コンジャ 今社 +ゴンジャ 権蛇(權蛇) +ゴンシュウイン 権執印 +コンショウ 近正 +コンジョウ 今城 +コンジョウ 紺上 +ゴンショウ 権正 +ゴンショウ 権庄 +ゴンショウ 權正 +ゴンジョウ 権丈 +ゴンジョウ 権上 +ゴンジョウ 言上 +ゴンジン 権神 +ゴンスイ 言水 +ゴンズイ 権随(権隨) +ゴンズイ 権隋 +コンセ 紺世 +ゴンセ 権世 +コンセイ 金生 +コンセイ 紺清 +コンセン 金仙 +コンソウ 魂相 +コンゾウ 金蔵 +コンゾウ 近造 +コンゾウ 金像 +コンゾウ 金藏 +ゴンソウ 勤桑 +コンゾウイン 金蔵院 +ゴンソク 勤息 +コンタ 今田 +コンタ 近田 +コンタ 根田 +コンタ 紺田 +コンタ 紺多 +コンダ 金田 +コンダ 今田 +コンダ 近田 +コンダ 根田 +コンダ 誉田 +コンダ 紺田 +コンダ 昆田 +コンダ 譽田 +コンダ 紺多 +ゴンタ 権田 +ゴンダ 権田 +ゴンダ 權田 +ゴンダ 権太 +ゴンダ 厳田 +コンタイ 金胎 +ゴンダイ 権代 +ゴンダイ 權代 +コンダイジ 今大地 +コンダイボウ 渾大防 +コンタイラ 今平 +ゴンダイラ 権平 +ゴンダイラ 權平 +コンタキ 金滝 +コンタニ 神谷 +コンタニ 紺谷 +コンタニ 近谷 +ゴンタニ 権谷(權谷) +ゴンタメ 権為 +コンチ 紺地 +コンヂ 紺地 +ゴンツガワ 権津川 +ゴンデ 権出(權出) +コンデン 近田 +コンド 神門 +コンド 今度 +コンド 近土 +コンド 今渡 +コンド 近戸 +コンド 金土 +コンド 紺渡 +コンド 近渡 +コンド 紺戸 +ゴンド 権度 +コントウ 近東 +コンドウ 近藤 +コンドウ 金藤 +コンドウ 今藤 +コンドウ 今道 +コンドウ 金銅 +コンドウ 今東 +コンドウ 金堂 +コンドウ 近堂 +コンドウ 金道 +コンドウ 近道 +コンドウ 紺藤 +コンドウ 根東 +コンドウ 近東 +コンドウ 紺道 +コンドウ 金筒 +コンドウ 建道 +コンドウ 紺堂 +コンドウ 建藤 +コンドウ 金通 +コンドウ 今桐 +コンドウ 今登 +コンドウ 今桃 +コンドウ 今堂 +コンドウ 昆藤 +ゴントウ 権頭 +ゴンドウ 権藤 +ゴンドウ 権頭 +ゴンドウ 権堂 +ゴンドウ 権東 +ゴンドウ 權藤 +ゴンドウ 權頭 +ゴンドウ 權堂 +コントク 坤徳 +コンナイ 金内 +コンナイ 近内 +コンナイ 根内 +コンナイ 今内 +ゴンナイ 権内 +ゴンナガ 権永 +ゴンナヅ 権名津(權名津) +コンナミ 近並 +ゴンナミ 権並 +ゴンナミ 權並 +ゴンネ 言根 +コンノ 今野 +コンノ 紺野 +コンノ 金野 +コンノ 近野 +コンノ 昆野 +コンノ 今埜 +コンノ 近埜 +コンノ 崑野 +コンノ 金之 +コンノ 昆埜 +コンノ 紺ノ +コンノ 紺乃 +ゴンノ 権野 +ゴンノ 言野 +ゴンノ 權野 +コンノウ 近能 +コンノウ 近納 +コンノウ 金王 +ゴンノウ 権納 +ゴンノカミ 権守 +ゴンノカミ 權守 +ゴンノシン 権之進 +コンバ 金場 +コンバ 今場 +コンパ 紺羽 +ゴンパ 権八 +ゴンバタ 権畑 +コンバラ 紺原 +コンパル 今春 +コンパル 金春 +ゴンビ 言美 +ゴンビン 権瓶 +コンブ 根布 +コンブ 昆布 +ゴンブ 権部 +コンブヤ 昆布屋 +コンブヤマ 昆布山 +コンベ 今部 +コンペイ 今平 +ゴンペイ 権瓶 +コンボ 根保 +コンボ 近保 +コンポ 近保 +ゴンボ 権保 +ゴンボリ 権堀(權堀) +ゴンボリ 権掘 +コンマ 根間 +コンマ 近間 +コンマ 小馬 +コンマ 今駒 +コンマ 金馬 +コンマ 今間 +コンマ 近馬 +コンマ 金万(金萬) +コンマ 金間 +コンマ 根馬 +コンマチ 米町 +コンマン 金万(金萬) +コンミョウ 近名 +コンムラ 紺村 +コンモト 紺本 +コンモト 紺元 +コンモリ 近森 +ゴンモリ 権守 +ゴンモリ 權守 +コンヤ 紺谷 +コンヤ 紺屋 +コンヤ 近谷 +コンヤ 紺家 +コンヤ 紺矢 +コンヤ 紺箭 +ゴンヤ 権谷(權谷) +ゴンヤス 権安 +コンヤゾノ 紺屋園 +コンヤゾノ 紺屋囿 +コンヤマ 今山 +コンヤマ 紺山 +コンヤマチ 紺屋町 +コンユ 蒟油 +コンヨウ 昆陽 +コンライ 紺頼 +コンライ 今来 +コンライ 今來 +コンリキ 金力 +サアイ 佐合 +サアラ 茶新 +サイ 斎 +サイ 佐井 +サイ 斉 +サイ 齋 +サイ 左居 +サイ 才 +サイ 栽 +サイ 齊 +サイ 佐居 +サイ 佐伊 +サイ 宰井 +サイ 採 +サイ 祭 +サイ 斉井 +サイ 佐為 +サイ 嵯維 +ザイ 財 +ザイ 在井 +サイアイ 䖝合 +サイアド 西阿十 +サイイ 斎井 +サイイ 斉井 +ザイイ 材井 +サイイキ 西域 +サイイチ 才一 +サイイン 斎院 +サイイン 斉院 +サイイン 齋院 +サイイン 齊院 +サイウチ 斉内 +サイウチ 歳内 +サイウチ 才内 +サイウチ 斎内 +サイウチ 齊内 +サイウラ 斎浦 +サイウラ 斉浦 +サイウラ 齋浦 +サイエ 斉江(齊江) +サイエ 斎江 +サイエ 齋江 +サイエンジ 西園寺 +サイオ 斉尾 +サイオ 斎尾 +サイオ 才尾 +サイオ 齋尾 +サイオ 財尾 +サイオ 齊尾 +サイオウ 西王 +サイオウジ 西王地 +サイオカ 斉岡 +サイオカ 才岡 +サイオカ 斎岡(齋岡) +サイオンジ 西園寺 +サイオンジ 斉穏寺 +サイオンジ 齊穏寺 +サイカ 雑賀 +サイカ 西家 +サイカ 斉賀 +サイカ 斎賀 +サイカ 財賀 +サイカ 齋賀 +サイカ 西花 +サイカ 斉下 +サイカ 雜賀 +サイカ 斎下 +サイカ 斉鹿(齊鹿) +サイカ 斎鹿 +サイカ 斉加 +サイカ 才荷 +サイカ 斎加 +サイカ 齋下 +サイカ 齋加 +サイカ 齋鹿 +サイカ 齊下 +サイカ 齊加 +サイガ 雑賀 +サイガ 西河 +サイガ 斉賀 +サイガ 斎賀 +サイガ 西賀 +サイガ 才賀 +サイガ 財賀 +サイガ 齋賀 +サイガ 最賀 +サイガ 済賀(濟賀) +サイガ 雜賀 +サイガ 斎鹿 +サイガ 齊賀 +サイガ 佐井賀 +サイガ 西駕 +サイガ 戈賀 +サイガ 齋鹿 +サイガ 槯賀 +サイカイ 西海 +サイカイ 西改 +サイカイシ 西海石 +サイカイシ 西海枝 +サイカイジ 西海持 +サイカイチ 西海知 +サイカイヤ 西海谷 +サイカク 西角 +サイガサキ 才賀崎 +サイカシ 才加志 +サイガセ 斉ケ瀬 +サイカチ 槐 +サイカチ 皀 +サイカチ 西海知 +サイカチ 西海枝 +サイカチ 西海土 +サイカチ 才勝 +サイカチ 西海持 +サイカチ 西海士 +サイカチ 西海地 +サイカツ 西勝 +サイカツ 斎勝(齋勝) +サイカツ 才勝 +サイカツ 斉勝 +サイカツ 西葛 +サイカツ 齊勝 +サイカド 才門 +サイカネ 才兼 +サイガノ 西ケ野 +サイガハラ 斉ケ原(齊ケ原) +サイガハラ 斎ケ原 +サイガハラ 斉賀原 +サイカミ 妻神 +サイカミ 才神 +サイガミ 妻神 +サイガミ 才神 +サイガミ 才上 +サイガヤ 才賀屋 +サイカワ 西川 +サイカワ 斎川 +サイカワ 才川 +サイカワ 斉川 +サイカワ 犀川 +サイカワ 宰川 +サイカワ 齋川 +サイカワ 歳川 +サイカワ 齊川 +サイカワ 妻川 +サイカワ 佐井川 +サイカワ 采川 +サイカワ 斉河 +サイカワ 斎河 +サイカワ 際川 +サイカワ 崔川 +サイカワ 戈川 +サイガワ 西川 +サイガワ 斎川 +サイガワ 才川 +サイガワ 齋川 +ザイカワ 在川 +ザイカワ 財川 +サイカン 斎官 +サイカン 斉官(齊官) +サイカン 齋官 +サイガン 西願 +サイガン 西岸 +サイガン 才鴈 +サイガン 才雁 +サイガン 才願 +ザイカン 財官 +サイガンジ 西願寺 +サイキ 佐伯 +サイキ 斎木 +サイキ 斉木 +サイキ 細木 +サイキ 西城 +サイキ 西木 +サイキ 才木 +サイキ 佐生 +サイキ 齋木 +サイキ 齊木 +サイキ 済木 +サイキ 佐長 +サイキ 斉喜 +サイキ 斉城 +サイキ 斎城 +サイキ 斎喜 +サイキ 佐井木 +サイキ 才記 +サイキ 西喜 +サイキ 西岐 +サイキ 齋喜 +サイキ 再起 +サイキ 祭城 +サイキ 祭木 +サイキ 齋城 +サイキ 齊城 +サイキ 左伊木 +サイキ 彩木 +サイキ 済喜 +サイキ 済城 +サイキ 祭貴 +サイキ 菜木 +サイキ 斉記 +サイキ 斉伯 +サイキ 税木 +サイキ 戈木 +サイキ 濟木 +サイキ 齊喜 +サイキ 才気 +サイキ 斎伯 +サイキ 齋記 +サイキ 齋伯 +ザイキ 材木 +ザイキ 財木(戝木) +ザイキ 財城 +ザイキ 財来 +ザイキ 材寄 +サイキュウ 斉宮 +サイキョウ 斉京 +サイキョウ 西京 +サイキョウ 西教 +サイキョウ 斎京 +サイキョウ 齊京 +サイキョウ 齋京 +サイギョウ 西行 +サイギョウヤ 西行谷 +サイク 細工 +サイクサ 三枝 +サイクサ 七種 +サイグサ 三枝 +サイグサ 七種 +サイグサ 三技 +サイグチ 才口 +サイクドウ 細工藤 +サイクボ 西窪 +サイクマ 佐井熊 +サイクヤ 細工谷 +サイクヤ 細工屋 +サイケ 斉家 +ザイケ 在家 +ザイケ 財家 +サイケイ 斎慶 +サイケイ 斉馨 +サイケイ 斉慶 +サイケイ 齊慶 +サイゲンジ 西元寺 +サイコ 西古 +サイコ 西湖 +サイコ 斉古 +サイコ 齋古 +サイゴ 西後 +サイゴ 斉梧 +サイゴ 斉悟 +サイゴ 齊梧 +サイゴ 齋梧 +ザイコ 在古 +サイコウ 西光 +サイコウ 才光 +サイコウ 西幸 +サイコウ 西皐 +サイゴウ 西郷 +サイゴウ 斉郷 +サイゴウ 斉江(齊江) +サイゴウ 斎江 +サイゴウ 細郷 +サイゴウ 才郷 +サイゴウ 齋郷 +サイゴウ 齋江 +サイゴウ 催郷 +サイゴウ 斎郷 +サイゴウ 西合 +サイゴウ 齊郷 +サイゴウ 墔郷 +ザイゴウ 在郷 +サイコウジ 西光寺 +サイコウジ 西向寺 +サイコク 西国 +サイコク 西國 +サイゴク 西極 +サイゴク 西國 +ザイコクジ 在国寺 +ザイコクジ 在國寺 +サイゴサワ 斎五沢 +サイゴサワ 斎五澤 +サイゴサワ 斉五沢 +サイゴサワ 齋五澤 +サイコダ 西粉田 +サイコン 斉根 +サイサカ 斎坂 +サイサカ 斉坂 +サイサカ 齋坂 +サイサカ 齊坂 +サイザキ 才崎 +サイザキ 雑崎 +サイザキ 財崎 +サイサコ 才迫 +サイザワ 才沢 +サイザワ 才澤 +サイザワ 採沢(採澤) +サイシ 斉子 +サイシ 斎子 +サイシ 西指 +サイシ 齋子 +サイジ 才治 +サイジ 斉二 +サイシキ 才式 +サイシタ 斉下 +サイシタ 斎下 +サイシタ 才下 +サイシタ 齋下 +サイシタ 齊下 +サイジマ 才島 +サイジマ 采島 +サイジマ 斎島 +サイジマ 斉島 +サイシュ 最首 +サイシュ 祭主 +サイシュウ 西周 +サイシュウ 才揖 +サイジュウ 真重 +サイショ 税所 +サイショ 最所 +サイショ 才所 +サイショ 斉所 +サイショ 宰所 +サイショ 斎所 +サイショ 穝所 +サイショ 最初 +サイショ 税初 +サイショ 樶所 +サイショ 齋所 +サイショ 齊所 +サイジョ 税所 +ザイショ 在所 +ザイショ 財処 +ザイショ 財所 +サイショウ 西勝 +サイショウ 最相 +サイショウ 西生 +サイショウ 西正 +サイショウ 宰相 +サイショウ 斎正 +サイショウ 最勝 +サイショウ 最生 +サイショウ 斉正 +サイショウ 齋正 +サイショウ 斎生 +サイショウ 斉生 +サイショウ 齊正 +サイジョウ 最上 +サイジョウ 西條 +サイジョウ 西条 +サイジョウ 西城 +サイジョウ 西庄 +サイジョウ 斉城 +サイジョウ 西篠 +サイジョウ 斎上 +サイジョウ 才上 +サイジョウ 斎条 +サイジョウ 西照 +サイジョウ 祭城 +サイジョウ 西浄 +サイジョウ 西性 +サイジョウ 斉上 +サイジョウ 齊城 +サイジョウ 斎條 +サイジョウ 斉条 +サイジョウ 斉條 +サイジョウ 齋上 +サイジョウ 齋條 +サイジョウ 齊上 +サイジョウ 齊條 +サイジョウ 西絛 +サイショウジ 最勝寺 +サイショウリン 最勝林 +サイシン 西信 +サイシン 斉信 +サイシン 才新 +サイシン 斉心(齊心) +サイシン 斎信 +サイシン 斎心 +サイシン 齋信 +サイシン 齊信 +サイス 西須 +サイス 斉子 +サイス 斎須 +サイス 斉須(齊須) +サイス 齋須 +サイス 斎数(齋数・齋數) +サイス 斉数(齊数・齊數) +サイス 西済 +サイス 才須 +サイスウ 斎数(齋数・齋數) +サイスウ 斉数(齊数・齊數) +サイセ 細勢 +サイゼ 西瀬 +サイセイ 西性 +サイゼン 西前 +サイゼン 才善 +サイゼン 斉前 +ザイゼン 財前 +ザイゼン 在前 +サイソウ 最相 +サイソウ 宰相 +サイゾノ 才園 +サイタ 西田 +サイタ 細田 +サイタ 幸田 +サイタ 斎田 +サイタ 斉田 +サイタ 才田 +サイタ 財田 +サイタ 税田 +サイタ 齋田 +サイタ 齊田 +サイタ 済田 +サイタ 最田 +サイタ 祭田 +サイタ 采田 +サイタ 佐井田 +サイタ 再田 +サイタ 採田 +サイタ 彩田 +サイタ 濟田 +サイタ 斎多 +サイダ 西田 +サイダ 細田 +サイダ 幸田 +サイダ 斎田 +サイダ 斉田 +サイダ 才田 +サイダ 財田 +サイダ 税田 +サイダ 齋田 +サイダ 齊田 +サイダ 済田 +サイダ 宰田 +サイダ 祭田 +サイダ 采田 +サイダ 佐井田 +サイダ 再田 +サイダ 西井田 +サイダ 座田 +サイダ 戈田 +サイダ 濟田 +ザイタ 財田 +ザイタ 在田 +サイタイ 西袋 +サイタカ 斉高 +サイタカ 才高 +サイタカ 斎高 +サイタカ 齋高 +サイタケ 斎竹 +サイタケ 才竹 +サイタケ 斉竹 +サイタケ 齋竹 +サイタニ 才谷 +サイタニ 斉谷 +サイタニ 斎谷(齋谷) +サイタニ 財谷 +サイタニガワ 済谷川 +サイタニガワ 濟谷川 +サイタマ 埼玉 +サイタマ 崔玉 +サイチ 最知 +サイチ 才市 +サイチ 斎地 +サイチ 齋地 +サイチ 㝡知 +サイチ 才知 +サイチ 才智 +サイチ 斉地 +サイヂ 才治 +ザイチョウ 在長 +サイツ 西津 +サイツ 才津(戈津) +サイツ 斎津 +サイツ 斎通 +サイツ 斉通 +サイツ 齊通 +サイヅ 才津(戈津) +ザイツ 財津 +ザイツ 才津(戈津) +ザイツ 在津 +ザイツ 材津 +ザイツ 戝津 +サイツカ 才塚 +サイヅカ 才塚 +サイツジ 才辻 +サイツハラ 才津原 +サイヅバラ 才津原 +サイデ 佐出 +サイデ 斎出 +サイデ 齋出 +サイデラ 才寺 +サイデラ 斎寺 +サイデラ 斉寺 +サイテン 西天 +サイト 西戸 +サイト 斉戸 +サイト 西都 +サイト 西途 +サイト 斎戸 +サイト 佐糸 +サイト 済渡 +サイト 齋戸 +サイト 齊戸 +サイド 道祖土 +サイド 西土 +サイド 斉土 +サイド 才戸 +サイド 齊土 +サイトウ 斎藤 +サイトウ 斉藤 +サイトウ 齋藤(齏藤) +サイトウ 齊藤 +サイトウ 西島 +サイトウ 西藤 +サイトウ 西塔 +サイトウ 西東 +サイトウ 才藤 +サイトウ 西頭 +サイトウ 済藤 +サイトウ 齋籐 +サイトウ 歳桃 +サイトウ 齊籐 +サイトウ 西洞 +サイトウ 妻藤 +サイトウ 斎当(齋當) +サイトウ 斎籐 +サイトウ 細藤 +サイトウ 斉当 +サイトウ 犀藤 +サイトウ 西当 +サイトウ 薺藤 +サイトウ 佐囲東 +サイトウ 再東 +サイトウ 歳藤 +サイトウ 斎東 +サイトウ 在藤 +サイトウ 濟藤 +サイトウ 西當 +サイトウ 齎藤 +サイトウ 佐居東 +サイトウ 再藤 +サイトウ 才頭 +サイトウ 斎塔 +サイトウ 細東 +サイトウ 裁頭 +サイトウ 剤藤 +サイトウ 財藤 +サイトウ 柴燈 +サイトウ 西塘 +サイトウ 斉東 +サイトウ 斉當 +サイトウ 斉籐 +サイトウ 崔藤 +サイトウ 濟籐 +サイトウ 齋東 +サイトウ 薺籐 +サイトウ 齊當 +サイトウ 佐井藤 +サイトウ 采東 +サイドウ 西藤 +サイドウ 西道 +サイドウ 西堂 +サイドウ 西洞 +サイドウ 斉道 +サイドウ 斎道 +サイドウ 斉堂 +サイドウ 齋道 +サイドウ 齊道 +ザイトウ 在藤 +ザイトウ 財藤 +ザイトウ 財頭 +サイドウグチ 西道口 +サイトウビ 斎藤日 +ザイトク 財徳 +サイナ 齊名(斉名) +サイナカ 斎中 +サイナカ 斉中 +ザイナカ 在仲 +サイナソノ 才名園 +サイナゾノ 才名園 +サイニ 斉二 +サイニ 斎二(齋二) +サイネイ 載寧 +サイネン 西念 +サイネン 才念 +サイノ 斎野 +サイノ 才野 +サイノ 斉野 +サイノ 齋野 +サイノ 才納 +サイノ 齊野 +サイノ 菜野 +サイノ 歳野 +ザイノ 材野 +サイノウ 道祖尾 +サイノウ 西能 +サイノウ 道祖 +サイノウ 斉能(齊能) +サイノウ 斎能 +サイノウ 才納 +サイノウ 才能 +サイノウ 齋能 +サイノウチ 斉ノ内(齊ノ内) +サイノウチ 才之内 +サイノウチ 斎内 +サイノウチ 才ノ内 +サイノウチ 斎之内 +サイノウチ 斉之内(齊之内) +サイノウチ 斎ノ内 +サイノオ 道祖尾 +サイノオ 道租尾 +サイノカミ 妻神 +サイノカミ 才之神 +サイノカミ 才ノ神 +サイノカミ 妻ノ神 +サイノキ 才野木 +サイノキ 西野木 +サイノキ 才ノ木 +サイノショウ 田結庄 +サイノセ 才野瀬 +サイノタニ 戈野谷 +サイノト 才峠 +サイノハラ 才野原 +サイノヒラ 斉野平 +サイノヒラ 斉之平 +サイノヒラ 才ノ平 +サイノヒラ 齊之平 +サイノヒラ 斎之平 +サイノヒラ 斉ノ平 +サイノヒラ 齊野平 +サイノヒラ 斎野平(齋野平) +サイノモト 才ノ元 +サイノモト 才ノ本 +サイノモト 戈ノ元 +サイノワキ 幸脇 +サイハ 細波 +サイバ 西馬 +サイバ 斎場 +サイバ 斉場 +サイバ 才場 +サイバ 齋場 +サイバ 済場 +サイバ 薺場 +サイバ 齊場 +サイハタ 才畑 +サイハナ 才花 +サイバヤシ 才林 +サイハラ 西原 +サイハラ 才原 +サイハラ 財原 +サイハラ 斉原 +サイハラ 哉原 +サイハラ 祭原 +サイハラ 宰原 +サイハラ 材原 +サイハラ 蔡原 +サイハラ 斎原(齋原) +サイハラ 裁原 +サイハラ 崔原 +サイハラ 齊原 +サイハラ 栽原 +サイバラ 西原 +サイバラ 才原 +サイバラ 財原 +サイバラ 斉原 +ザイハラ 財原 +サイヒ 西肥 +サイフ 西府 +ザイブ 財部 +ザイブ 戝部 +サイフク 西福 +サイフク 才福 +サイブツ 西仏 +サイブツ 西佛 +サイフヤ 財布屋 +サイベ 斉部(齊部) +サイベ 斎部 +サイベ 最部 +サイベ 齋部 +サイベ 㝡部 +ザイベ 財部 +サイホ 西保 +サイホ 才穂 +サイホ 才保 +サイホウ 西方 +サイホウ 西訪 +ザイホウ 財方 +サイホウイ 西方井 +サイホウジ 西方路 +サイホウジ 西法司 +サイマ 西馬 +サイマ 財間 +サイマ 斉間 +サイマ 斎間 +サイマ 才間 +サイマ 済間 +サイマ 齊間 +サイマ 齋間 +サイマ 細磨 +サイマ 才馬 +サイマ 財馬 +ザイマ 在間 +ザイマ 財満(財滿) +ザイマ 財間 +ザイマ 財馬 +ザイマ 戝満 +サイマキ 才巻 +サイマツ 才松 +サイマツ 細末 +サイマル 西丸 +サイマル 才丸 +サイマル 斎丸 +サイマル 斉丸 +サイマル 齋丸 +サイマル 齊丸 +ザイマン 財満(財滿) +サイミ 細見 +サイミ 細美 +サイミ 斉見 +サイミ 才見 +サイミ 斎見 +サイミ 齋見 +サイミツ 才満 +サイミヤ 斉宮 +サイミヤ 斎宮 +サイミヤ 才宮(戈宮) +サイミヤ 齋宮 +サイミョウ 西明 +サイミョウ 最明 +サイミョウ 再名生 +サイミョウジ 斉明寺(齊明寺) +サイミョウジ 西明寺 +サイミョウジ 斎明寺 +サイミョウジ 齋明寺 +サイミョウジ 西明地 +サイム 宰務 +サイムサ 才無佐 +サイムサ 才無左 +サイムラ 才村 +サイムラ 斎村 +サイムラ 斉村 +サイムラ 雑村(雜村) +サイムラ 崔村 +サイムラ 齋村 +ザイムラ 財邑 +サイメ 才目 +ザイメ 財目 +サイメイ 西明 +サイメイジ 最明治 +サイメン 西面 +サイモ 才茂 +ザイモ 財茂 +サイモウ 西毛 +ザイモク 材木 +ザイモクヤ 材木谷 +サイモト 幸本 +サイモト 才本 +サイモト 斉本 +サイモト 崔本 +サイモト 才元 +サイモト 祭本 +サイモト 最本 +サイモト 斎本(齋本) +サイモト 載本 +サイモト 催本 +サイモト 斉元 +サイモト 道祖本 +サイモト 再本 +サイモト 塞本 +サイモト 済本 +サイモト 雑本 +サイモト 税本 +サイモト 戈本 +サイモト 齋元(斎元) +サイモト 蔡本 +サイモト 齊元 +サイモト 齊本 +ザイモト 材本 +ザイモト 財本 +サイモリ 斉森 +サイモリ 才守 +サイモリ 斎森 +サイモリ 齋森 +サイモン 才門 +サイモン 西紋 +サイモン 斎門 +サイモン 柴門 +サイモン 佐井門 +サイモン 斉門 +サイモン 齋門 +サイモン 齊門 +サイヤマ 斎山 +サイヤマ 斉山 +サイヤマ 催山 +サイヤマ 崔山 +サイヤマ 齋山 +サイヤマ 齊山 +サイヨシ 斎吉 +サイヨシ 斉吉 +サイラ 斉良 +サイラ 斎良 +サイラ 戈良 +サイラ 齊良 +サイライ 西来(西來) +サイライ 蔡来 +サイライジ 西来路 +サイライジ 西耒路 +サイラク 西楽(西樂) +サイリキ 才力 +サイリョウ 西良 +サイリョウ 才料 +サイリョウ 西領 +サイリンジ 最林寺 +サイリンジ 西林寺 +サイレイダ 祭礼田(祭禮田) +サイレンジ 西連寺 +サイレンジ 西連地 +サイレンジ 西蓮寺 +サイレンチ 西連地 +サイレンチ 西蓮地 +サイレンヂ 西連地 +ザイロ 在路 +サイワイ 幸 +サイワイ 栄祝 +サイワイヤ 幸谷 +サイワカ 宰若 +サイワキ 斉脇(齊脇) +サイワキ 才脇 +サイワキ 斎脇 +サイワキ 歳脇 +サイワキ 齋脇 +サウジ 佐氏 +サウス 佐臼 +サウダ 左右田 +サウチ 佐内 +サウチ 左右内 +サウトメ 五月女 +ザウマ 座馬 +サウラ 相浦 +サウラ 佐浦 +サエ 佐江 +サエキ 佐伯 +サエキ 栄木 +サエキ 三枝木 +サエキ 佐柄木 +サエキ 佐江木 +サエキ 作伯 +サエキ 冴来 +サエギ 三枝木 +サエクサ 三枝 +サエクサ 七種 +サエグサ 三枝 +サエグサ 七種 +サエダ 小枝 +サエダ 佐枝 +サエダ 道祖田 +サエダ 佐衛田(佐衞田) +サエダ 佐永田 +サエダ 左枝 +サエダ 佐江田 +サエトウ 佐枝藤 +サエモト 塞本 +サエモンサブロウ 左衛門三郎 +サエン 佐円 +サエン 佐園 +サエン 佐圓 +サエンマ 佐縁馬 +サオ 佐尾 +サオ 竿尾 +サオ 左尾 +サオ 竿 +サオ 棹 +サオイ 佐生 +サオウ 佐応 +サオウ 左応 +サオウラ 竿浦 +サオオ 竿尾 +サオカ 佐岡 +サオコギ 竿漕 +サオサキ 竿崎 +サオサキ 竿先 +サオザキ 竿崎 +サオシタ 竿下 +サオシロ 竿代 +サオタ 竿田 +サオダ 佐保田 +サオダ 竿田 +サオダイ 棹台 +サオタニ 竿谷 +サオトメ 五月女 +サオトメ 早乙女 +サオトメ 竿留 +サオトメ 早月女 +サオトメ 棹登米 +サオドメ 竿留 +サオトメザカ 𣍲坂 +サオノ 竿野 +サオモト 竿本 +サオモト 棹本 +ザオヤ 座親 +サオヤマ 佐尾山 +サオヤマ 竿山 +サオヤマ 棹山 +サオリ 佐織 +サオリ 左織 +サオリ 小織 +サオリ 佐折 +サオリダ 佐織田 +サカ 坂 +サカ 阪 +サカ 佐加 +サカ 佐嘉 +サガ 嵯峨 +サガ 佐賀 +サガ 相賀 +サガ 砂賀 +サガ 瑳峨 +サガ 磋硪 +サガ 佐我 +サガ 嵯我 +サガ 左賀 +サガ 酒賀 +サガ 嵳峩 +サガ 嶬峨 +ザガ 坐臥 +サカアシ 坂足 +サカイ 酒井 +サカイ 坂井 +サカイ 境 +サカイ 堺 +サカイ 栄 +サカイ 阪井 +サカイ 逆井 +サカイ 左海 +サカイ 境井 +サカイ 堺井 +サカイ 酒居 +サカイ 栄井 +サカイ 坂居 +サカイ 佐貝 +サカイ 界 +サカイ 佐海 +サカイ 酒伊 +サカイ 阪居 +サカイ 栄居(榮居) +サカイ 左貝 +サカイ 差海 +サカイ 佐加伊 +サカイ 左甲斐 +サカイ 佐加井 +サカイ 佐嘉伊 +サカイ 沙海 +サカイ 酒飯 +サカイ 坡伊 +サカイ 榮井 +サカイ 洒井 +サガイ 佐貝 +サガイ 佐賀井 +サガイ 嵯峨井 +サガイ 寒河井 +サガイ 左貝 +サカイウチ 境内 +サカイエ 坂家 +サカイエ 堺栄 +サカイガイチ 境垣内 +サカイガキ 堺垣 +サカイガワ 境川 +サカイギ 境木 +サカイグチ 境口 +サカイグチ 堺口 +サカイケ 酒池 +サカイケ 坂池 +サカイザワ 境沢 +サカイザワ 堺沢 +サカイザワ 堺澤 +サカイザワ 境澤 +サカイシ 坂石 +サカイズミ 酒泉 +サカイズミ 栄泉 +サカイタ 堺田 +サカイダ 境田 +サカイダ 坂井田 +サカイダ 堺田 +サカイダ 酒井田 +サカイダ 阪井田 +サカイタニ 堺谷 +サカイタニ 境谷 +サカイタニ 左海谷 +サカイダニ 堺谷 +サカイダニ 境谷 +サカイダニ 阪井谷 +サカイチ 坂市 +サカイチ 酒市 +サカイチ 境地 +サカイデ 坂出 +サカイデ 酒出 +サカイデ 阪出 +サカイデ 境出 +サカイネ 坂稲 +サカイノ 境野 +サカイノ 堺野 +サカイノサワ 坂井野沢(坂井野澤) +サカイバシ 境橋 +サカイハラ 境原 +サカイハラ 堺原 +サカイハラ 酒井原 +サカイハラ 坂井原 +サカイバラ 境原 +サカイバラ 堺原 +サカイバラ 酒井原 +サカイバラ 坂井原 +サカイフジ 境藤 +サカイベ 堺部 +サカイホリ 境堀 +サカイボリ 境堀 +サカイボリ 堺堀 +サカイマツ 境松 +サカイメ 境目 +サカイメ 堺目 +サカイモト 堺本 +サカイモト 境本 +サカイモト 境元 +サカイヤ 堺谷 +サカイヤ 境谷 +サカイヤ 栄谷 +サカイヤ 堺屋 +サカイヤ 境屋 +サカイヤ 境家 +サカイヤ 榮谷 +サカイヤマ 盛山 +サカイヤマ 境山 +サカイヤマ 坂井山 +サカイリ 坂入 +サカイリ 酒入 +サカイリ 坂圦 +サカイリ 堺入 +サカイリ 境入 +サカイリ 阪入 +サカイワ 坂岩 +サカイワキ 境脇 +サカウエ 坂上 +サカウエ 阪上 +サカウエ 酒上 +サカウエ 坂植 +サカウエ 阪植 +サカウエダ 坂上田 +サカウシ 坂牛 +サカウチ 坂内 +サカウチ 阪内 +サカウチ 境内 +サカウラ 坂浦 +サカウラ 阪浦 +サカウラ 阪裏 +サカエ 栄 +サカエ 寒河江 +サカエ 坂江 +サカエ 榮 +サカエ 坂恵(坂惠) +サカエ 阪江 +サカエ 酒栄 +サカエ 坂栄 +サカエ 酒江 +サカエ 酒衛 +サカエ 境江 +サカエ 栄江 +サカエ 阪衛 +サカエ 佐替 +サカエ 坂榮 +サカエ 阪栄 +サカエ 酒得 +サガエ 寒河江 +サガエ 寒江 +サガエ 寒川江 +サガエ 佐賀枝 +サカエイ 堺栄 +サカエイワ 栄岩 +サカエウチ 境内 +サカエギ 栄木 +サカエギ 榮木 +サカエザキ 栄崎 +サカエタ 栄田 +サカエダ 境田 +サカエダ 栄田 +サカエダ 栄枝 +サカエダ 坂枝 +サカエダ 榮田 +サカエダ 酒枝 +サカエダ 榮枝 +サカエタニ 栄谷 +サカエダニ 栄谷 +サカエダニ 榮谷 +サカエデ 栄出 +サカエハラ 栄原 +サカエハラ 榮原 +サカエバラ 栄原 +サカエバラ 榮原 +サカエベ 栄部 +サカエマツ 栄松 +サカエムラ 栄村 +サカエムラ 榮村 +サカエモト 栄本 +サカエモト 栄元 +サカエヤ 栄谷 +サカエヤ 栄屋 +サカエヤ 榮屋 +サカエヤマ 栄山 +サカエヤマ 榮山 +サカオ 坂尾 +サカオ 阪尾 +サカオ 酒尾 +サカオ 坂生 +サカオ 酒百 +サカオカ 坂岡 +サカオカ 阪岡 +サガオカ 佐賀岡 +サカオク 阪奥 +サカオク 坂奥 +サカオリ 坂折 +サカオリ 酒折 +サカカ 坂加 +サカガ 坂賀 +サカガイト 坂垣内 +サカガキ 坂垣 +サカガキ 坂柿 +サカガキ 阪垣 +サカガキ 阪柿 +サカガシラ 坂頭 +サカガシラ 阪頭 +サカカド 坂角 +サカガミ 坂上 +サカガミ 阪上 +サカガミ 坂神 +サカガミ 酒上 +サカガミ 阪神 +サカガメ 坂亀 +サカカリ 坂狩 +サカガリ 坂狩 +サカガワ 坂川 +サカガワ 酒川 +サカガワ 阪川 +サカガワ 佐賀川 +サカキ 榊 +サカキ 坂木 +サカキ 神木 +サカキ 栄木 +サカキ 酒木 +サカキ 阪木 +サカキ 境木 +サカキ 賢木 +サカキ 酒樹 +サカキ 坂城 +サカキ 榮木 +サカキ 坂喜 +サカキ 榊木 +サカキ 彭城 +サカキ 酒城 +サカキ 佐柿 +サカギ 坂木 +サカギ 坂城 +サガキ 佐垣 +サガキ 佐賀木 +サカキイ 榊井 +サカキエダ 榊枝 +サカキザワ 榊沢(榊澤) +サカギシ 坂岸 +サカキシタ 榊下 +サカキタ 榊田 +サカキタ 坂北 +サカキダ 榊田 +サカキダ 坂木田 +サカキタニ 榊谷 +サカキダニ 榊谷 +サカキノ 榊野 +サカキバヤシ 榊林 +サカキハラ 榊原 +サカキハラ 坂木原 +サカキバラ 榊原 +サカキバラ 坂木原 +サカキヒラ 榊平 +サカキマ 榊間 +サカキモト 榊本 +サカキモト 榊元 +サカキモリ 榊森 +サカキヤ 榊谷 +サカキヤマ 榊山 +サカキョウ 坂京 +サカグチ 坂口 +サカグチ 阪口 +サカグチ 酒口 +サガグチ 嵯峨口 +サカグチヤ 坂口屋 +サカクニ 尺一 +サカクボ 坂久保 +サカグマ 坂熊 +サカクラ 坂倉 +サカクラ 阪倉 +サカクラ 酒倉 +サカクラ 坂蔵 +サカグリ 坂栗 +サカケ 砂掛 +サカゲ 坂毛 +サカゲン 坂元 +サカコウ 酒匂 +サカゴエ 坂越 +サカコシ 坂越 +サカコシ 坂腰 +サカゴシ 坂越 +サカゴシ 坂腰 +サカゴシ 酒越 +サカゴシ 阪越 +サガザ 嵯峨座 +サカサイ 逆井 +サカサイ 坂斎 +サカサイ 坂斉 +サカサイ 坂才 +サカサイ 坂齊 +サカサイ 坂佐井 +サカサイ 坂齋 +サカザオ 坂垰 +サカサカ 坂々 +サカザキ 坂崎 +サカザキ 阪崎 +サカザキ 酒崎 +サカザキ 坂嵜 +サカザキ 坂埼 +サカザキ 阪嵜 +サガサキ 相崎(相嵜) +サガサキ 嵯峨崎 +サカサク 酒作 +サカサザワ 逆沢 +サカサト 坂里 +サカザワ 酒沢 +サカザワ 坂沢 +サカザワ 酒澤 +サカザワ 坂澤 +サカシ 酒師 +サカジ 坂地 +サカジ 坂路 +サカジ 阪路 +サカジ 阪地 +サカジ 坂治 +サカシタ 坂下 +サカシタ 阪下 +サカシタ 酒下 +サカシタ 境下 +サカシマ 坂島 +サカシマ 坂嶋 +サカシマ 阪島 +サカシマ 酒島 +サカシマ 酒嶋 +サカショウ 坂庄 +サカジョウ 坂上 +サカジョウ 阪上 +ザガシラ 座賀白 +サカシリ 坂尻 +サカジリ 坂尻(坂㞍) +サカジリ 阪尻 +サカジリ 阪後 +サカジリ 坂後 +サカシロ 坂代 +サカシロ 坂白 +サカシロ 榮代 +サガシロ 座賀白 +サカズキ 盃 +サカズキヤ 盃屋 +サカズキヤ 觴谷 +サカズミ 坂角 +サカズメ 坂爪 +サカズメ 坂詰 +サカセ 坂瀬 +サカセ 逆瀬 +サカセ 阪瀬 +サカセカワ 酒瀬川 +サカセガワ 逆瀬川 +サカセガワ 酒瀬川 +サガセキ 佐賀関 +サカソ 坂曽 +サカゾノ 坂園 +サカタ 坂田 +サカタ 阪田 +サカタ 酒田 +サカタ 佐方 +サカタ 相方 +サカタ 酒多 +サカタ 佐嘉田 +サカタ 左方 +サカタ 坂多 +サカタ 佐片 +サカタ 坂駄 +サカタ 坂夛 +サカダ 坂田 +サガタ 相田 +サガタ 佐方 +サガタ 佐潟 +サガタ 相方 +サガタ 佐泻 +サガタ 嵯峨田 +サガタ 佐賀田 +サガタ 佐瀉 +サガタ 佐形 +サガタ 佐片 +サカダイ 坂大 +サカタカ 坂高 +サカタカ 阪高 +サカタケ 坂竹 +サカタニ 酒谷 +サカタニ 坂谷 +サカタニ 堺谷 +サカタニ 境谷 +サカタニ 阪谷 +サカタニ 盛谷 +サカタニ 佐下谷 +サカダニ 坂谷 +サカタモ 坂樟 +サカタヤ 坂田谷 +サカタヤ 坂田屋 +サカタヤ 酒田屋 +サカチ 坂地 +サカチ 酒地 +サカヂ 坂地 +サカチヨ 坂千代 +サカチョウ 坂頂 +サカツ 坂津 +サカツギ 坂次 +サカツジ 坂辻 +サカツジ 阪辻 +サカツネ 坂常 +サカツボ 坂坪 +サカツマ 坂妻 +サカツマ 阪妻 +サカヅマ 坂妻 +サカヅミ 坂積 +サカツメ 坂爪 +サカツメ 坂詰 +サカツメ 阪詰 +サカツメ 阪爪 +サカツメ 酒誥 +サカヅメ 坂爪 +サカヅメ 坂詰 +サカヅメ 酒詰 +サカヅメ 阪詰 +サカヅメ 阪爪 +サカヅメ 坂誥 +サカテ 坂手 +サカテ 阪手 +サカデ 坂出 +サカデ 阪出 +サカデラ 坂寺 +サカト 坂戸 +サカト 阪戸 +サカト 坂登 +サカト 酒戸 +サカド 坂戸 +サカド 坂門 +サカド 沙加戸 +サカトウ 坂東 +サカトウ 坂藤 +サカトウ 坂頭 +サカトウ 阪藤 +サカトウ 坂当(坂當) +サカトク 酒徳 +サカトミ 坂富 +サカトメ 坂留 +サカドメ 坂留 +サカトモ 坂友 +サカトリ 坂取 +サカナ 肴 +サカナ 坂名 +サカナ 坂那 +サカナイ 坂内 +サカナイ 坂名井 +サカナエ 坂苗 +サカナカ 坂中 +サカナカ 阪中 +サカナカ 坂仲 +サカナガ 坂永 +サカナガ 阪永 +サカナガ 阪長 +サカナガ 酒永 +サカナガ 坂長 +サカナクラ 肴倉 +サカナグラ 肴倉 +サカナシ 坂梨 +サカナシ 阪梨 +サカナシ 坂無 +サカナシ 阪無 +サカナバ 肴場 +サカナミ 坂浪 +サカナヤ 肴屋 +サカナリ 坂成 +サカナリ 阪成 +サカニシ 坂西 +サカニシ 阪西 +サカニワ 坂庭 +サカニワ 酒庭 +サカニワ 坂丹羽 +サカニワ 阪庭 +サカヌシ 坂主 +サカヌシ 酒主 +サカヌマ 坂沼 +サカネ 坂根 +サカネ 阪根 +サカネ 佐金 +サカネ 栄根(榮根) +サカネ 坂祢 +サカネ 酒根 +サガネ 嵯峨根 +サガネ 相根 +サガネ 佐金 +サガネ 佐賀根 +サガネ 嵯我根 +サカノ 坂野 +サカノ 阪野 +サカノ 酒野 +サカノ 佐可野 +サカノ 坂埜 +サカノ 佐加野 +サガノ 嵯峨野 +サガノ 佐賀野 +サガノ 佐ケ野 +サガノ 嵯峨濃 +サカノイ 坂野井 +サカノイ 坂之井 +サカノイ 坂ノ井 +サカノウ 坂能 +サカノウエ 坂上 +サカノウエ 阪上 +サカノウエ 坂之上 +サカノウエ 坂ノ上 +サカノウエ 坂野上 +サカノウエ 阪之上 +サカノウエ 阪ノ上 +サカノウチ 坂之内 +サカノシタ 坂之下 +サカノシタ 坂ノ下 +サカノシタ 坂野下 +サカノシタ 阪ノ下 +サカノシタ 阪之下 +サカノベ 坂廼辺 +サカノベ 坂廼邉 +サカノベ 坂迺辺 +サカノボウ 坂ノ坊 +サカノワキ 坂ノ脇 +サカバ 坂場(坂塲) +サカバ 坂庭 +サカバ 阪場 +サカバ 酒葉 +サカバ 酒場 +サカバ 坂葉 +サカハシ 坂橋 +サカハシ 坂端 +サカハタ 坂畑 +サカハタ 阪畑 +サカバタ 坂端 +サカハチ 坂八 +サカハマ 阪浜 +サカバヤシ 坂林 +サカバヤシ 酒林 +サカバヤシ 阪林 +サカバヤシ 帘 +サカハラ 坂原 +サカハラ 阪原 +サガハラ 嵯峨原 +サガハラ 佐賀原 +サカバン 坂番 +サカヒ 酒樋 +ザカビ 座嘉比 +ザカビ 座加比 +サカヒラ 坂平 +サカヒラ 坡平 +サカフ 酒府 +サカフジ 坂藤 +サカフジ 阪藤 +サカフジ 逆藤 +サカフタ 坂蓋 +サカフダ 坂不田 +サカベ 坂部 +サカベ 刑部 +サカベ 阪部 +サカベ 酒部 +サカベ 坂辺(坂邉) +サカベ 阪辺(阪邊) +サカベ 坂邊 +サカベ 酒辺(酒邊) +サカベ 堺部 +サカマ 坂間 +サカマ 阪間 +サカマ 坂馬 +サカマエ 坂前 +サカマキ 坂巻 +サカマキ 酒巻 +サカマキ 坂牧 +サカマキ 坂槙 +サカマキ 阪牧 +サカマキ 坂蒔 +サカマキ 坂槇 +サカマキ 阪巻 +サカマキ 榊巻 +サカマキ 逆巻 +サカマキ 坂卷 +サカマキ 酒牧 +サカマタ 坂又 +サカマタ 坂俣 +サカマチ 坂待 +サカマチ 坂町 +サカマツ 坂松 +サカマツ 酒松 +サカマツ 坂枩 +サカマツ 阪松 +サカマル 坂丸 +サカマワリ 坂廻 +サカミ 酒見 +サカミ 坂見 +サカミ 酒美 +サカミ 坂三 +サガミ 相模 +サガミ 佐上 +サガミ 佐神 +サガミ 佐賀見 +サガミ 佐賀美 +サガミ 左神 +サガミ 瑳峨見 +サガミ 相美 +サガミ 嵯峨見 +サカミズ 坂水 +サカミズ 逆水 +サカミチ 坂道 +サカミツ 酒光 +サカミツ 坂光 +サカミネ 坂峯 +サカミネ 阪峯 +サカミネ 坂峰 +サカミヤ 坂宮 +サカムキ 坂向 +サカムタ 坂牟田 +サカムネ 坂宗 +サカムラ 坂村 +サカムラ 酒村 +サカムラ 阪村 +サガムラ 佐賀村 +サカムロ 坂室 +サカモ 坂茂 +サカモト 坂本 +サカモト 阪本 +サカモト 坂元 +サカモト 酒本 +サカモト 阪元 +サカモト 酒元 +サカモト 栄元 +サカモト 﨏本 +サカモト 隥本 +サカモトヤ 阪本谷 +サカモトヤ 坂本屋 +サカモトヤ 坂本谷 +サカモリ 坂森 +サカモリ 阪森 +サカモリ 酒森 +サカモリ 坂守 +サカモリ 酒盛 +サカヤ 酒谷 +サカヤ 坂谷 +サカヤ 阪谷 +サカヤ 酒屋 +サカヤ 坂屋 +サカヤ 昌谷 +サカヤ 坂矢 +サカヤ 坂家 +サカヤ 坂哉 +サカヤ 酒家 +サカヤ 坂弥 +サカヤ 栄屋 +サガヤ 相谷 +サガヤ 嵯峨谷 +サカヤウチ 坂谷内 +サカヤチ 坂谷内 +サカヤナギ 坂柳 +サカヤナギ 阪柳 +サカヤブ 坂薮 +サカヤブ 坂藪 +サカヤブ 阪藪 +サカヤマ 坂山 +サカヤマ 栄山 +サカヤマ 境山 +サカヤマ 阪山 +サカヤマ 榮山 +サガヤマ 下山 +サガヤマ 嵯峨山 +サガヤマ 佐賀山 +サガヤマ 佐ケ山 +サカヨケ 坂除 +サカヨシ 坂吉 +サカヨダ 阪依田 +サカヨリ 酒寄 +サカヨリ 坂寄 +サカヨリ 坂従 +サカヨリ 酒依 +サカヨリ 坂從 +サカヨリ 阪寄 +サカヨリ 阪従 +サカヨリ 酒従 +サガラ 相良 +サガラ 相楽 +サガラ 佐柄 +サガラ 讃良(讚良) +サガラ 相樂 +サガラ 佐良 +サガラ 佐加良 +サガラ 相柄 +サガラ 左柄 +サガラ 佐賀良 +サガラ 佐伽羅 +サガラ 艸楽 +サガラヤ 相良屋 +サカリ 盛 +サカリ 栄利(榮利) +サカリ 坂理 +サカリ 坂利 +サカリ 佐仮 +サガリ 佐賀里 +サガリ 嵯峨里 +サカリキ 坂力 +サカリタニ 盛谷 +サカリダニ 盛谷 +サカリバ 盛葉 +サガリフジ 下り藤(下リ藤) +サガリマツ 下り松 +サカリン 坂厘 +サカワ 佐川 +サカワ 酒匂 +サカワ 坂和 +サカワ 酒勾 +サカワ 坂輪 +サカワ 酒和 +サカワ 阪和 +サカワ 酒輪 +サガワ 瀬川 +サガワ 佐川 +サガワ 砂川 +サガワ 寒川 +サガワ 左川 +サガワ 狭川 +サガワ 佐河 +サガワ 茶川 +サガワ 嵯川 +サガワ 沙川 +サガワ 狹川 +サガワイ 寒川井 +サガワエ 寒河江 +サカワガワ 酒匂川 +サカワガワ 酒勾川 +サカワキ 坂脇 +サカワキ 阪脇 +サガワダ 佐川田 +サカン 目 +サカン 属 +サカン 左官 +サカン 佐官 +サガン 目 +サカンゾウ 属増 +サカンタニ 左官谷 +サキ 茶木 +サキ 崎 +サキ 佐木 +サキ 佐喜 +サキ 先 +サキ 左木 +サキ 嵜 +サキ 佐樹 +サキ 先規 +サギ 鷺 +サギ 左木 +サギ 佐義 +ザキ 座木 +サキイ 崎井 +サキイ 嵜井 +サキイエ 先家 +サキイエ 崎家 +サキイケ 崎池 +サギイケ 鷺池 +サキイシ 崎石 +サキイデ 崎出 +サキウエ 崎上 +サキウエノ 崎上野 +サキウチ 崎内 +サキウチ 先内 +サギウチ 鷺内 +サキウラ 崎浦 +サキウラ 先浦 +サキエ 崎江 +サキエキ 崎浴 +サキエダ 崎枝 +サキエダ 咲枝 +サキオ 崎尾 +サキオ 咲尾 +サキオ 崎生 +サキオ 先尾 +サキオカ 崎岡 +サキオカ 先岡 +サキオカ 嵜岡 +サギオカ 鷺岡 +サキオキ 先沖 +サキオリ 先織 +サキガ 咲賀 +サキガミ 崎上 +サキガミ 崎神 +サキガミ 嵜上 +サキカワ 崎川 +サキカワ 先川 +サキカワ 咲川 +サキカワ 佐木川 +サキカワ 嵜川 +サキガワ 崎川 +サキガワ 先川 +サキガワ 咲川 +サキガワ 佐木川 +サキガワ 嵜川 +サギカワ 鷺川 +サキガワラ 先川原 +サキギ 碕木 +サキグチ 崎口 +サキグチ 嵜口 +サキクボ 崎久保 +サキコヤマ 先小山 +サキサカ 匂坂 +サキサカ 向坂 +サキサカ 崎坂 +サキサカ 向阪 +サキサカ 崎阪 +サキザカ 崎坂 +サギサカ 匂坂 +サギサカ 向坂 +サギサカ 鷺坂 +サギサカ 鷺阪 +サギサカ 勾坂 +サギサカ 匂阪 +サキザキ 佐木崎 +サギサキ 鷺崎 +サキサコ 崎迫 +サキサコ 嵜迫 +サキサコ 埼迫 +サキザコ 崎迫 +サキサト 崎里 +サギサワ 鷺沢 +サギサワ 鷺澤 +サキジ 崎地 +サキシオ 崎塩 +サキシゲ 崎重 +サキシタ 崎下 +サキシマ 崎島 +サキシマ 崎嶋 +サキシマ 嵜嶋 +サギシマ 鷺島 +サギシマ 鷺嶋 +サギシマ 白鷺洲 +サキジョウ 崎上 +サキシロ 先城 +サキシロ 崎代 +サキシンタニ 崎新谷 +サギス 鷺巣 +サキスカ 崎須賀 +サキスカ 崎須家 +サキセ 崎瀬 +サキゾノ 崎園 +サキゾノ 崎薗 +サキタ 崎田 +サキタ 開田 +サキタ 先田 +サキタ 咲田 +サキタ 嵜田 +サキタ 佐木田 +サキダ 崎田 +サキダ 先田 +サギタ 鷺田 +サキタカ 崎高 +サキタカシナ 崎高科 +サキタグチ 先田口 +サキタニ 崎谷 +サキタニ 鉾谷 +サキタニ 先谷 +サキタニ 咲谷 +サギタニ 鷺谷 +サギタニ 鷺溪 +サキタマ 崎玉 +サキダラ 先低 +サキヂ 崎地 +サキツ 崎津 +サキツ 佐橘 +サキツキ 先槻 +サキヅキ 先槻 +サキヅキ 先附 +サキヅメ 崎詰 +サキヅル 崎水流 +サキテ 崎手 +サキデ 崎出 +サキト 崎戸 +サキト 先低 +サキト 先砥 +サキドイ 崎土居 +サキトウ 前刀 +サキナ 先名 +サギナ 佐義名 +サギナオ 鷺直 +サキナカ 崎中 +サキナカ 先中 +サキナカ 嵜中 +サキナガ 崎永(嵜永) +サキナガ 崎長 +サキナガ 先永 +サキナダ 先灘 +サキナダ 崎灘 +サキナワ 向縄 +サギナワ 向縄 +サギナワ 向繩 +サキニシ 崎西 +サギヌマ 鷺沼 +サキネ 崎根 +サキノ 崎野 +サキノ 先野 +サキノ 嵜野 +サキノ 咲野 +サキノ 埼野 +サギノ 鷺野 +サギノウエ 鷺之上 +サギノタニ 鷺ノ谷 +サキノノ 先野々 +サキノハマ 先野浜(先野濱) +サキノブ 崎信 +サギノモリ 鷺ノ森 +サギノヤ 鷺谷 +サギノヤ 鷺野谷 +サギハシ 鷺橋 +サキハタ 崎畑 +サキハナ 咲花 +サキハナ 先花 +サキハナ 崎花 +サキハマ 崎浜 +サキハマ 崎濱 +サキハマ 先浜 +サキハマ 先濱 +サキハマ 嵜浜 +サキハマ 嵜濵 +サキハラ 崎原 +サキハラ 先原 +サキハラ 埼原 +サキハラ 嵜原 +サキハラ 楸原 +サギハラ 鷺原 +サキヒサ 先久 +サキヒラ 崎平 +サキヒロ 崎広 +サキヒロ 崎廣 +サキブ 崎生 +サキフジ 崎藤 +サキベ 崎辺(崎邉) +サキベ 崎部 +サキベ 崎邊 +サキベ 嵜辺 +サキボリ 先堀 +サキマ 崎間 +サキマ 咲間 +サキマ 佐喜真 +サキマ 先間 +サキマ 佐喜間 +サキマ 佐喜眞 +サキマ 崎摩 +サキマ 埼間 +サキマエ 崎前 +サキマエ 先前 +サキマツ 崎松 +サキマル 崎丸 +サキミ 崎見 +ザキミ 座喜味 +サキミズル 崎水流 +サキミチ 崎道 +サキミツ 先光 +サギミヤ 鷺宮 +サキムカイ 崎向 +サキムキ 崎向 +サキムラ 崎村 +サキムラ 向村 +サキムラ 先村 +サキムラ 咲村 +サキムラ 嵜村 +サギムラ 鷺村 +サキモト 崎本 +サキモト 崎元 +サキモト 先本 +サキモト 咲本 +サキモト 嵜本 +サキモト 佐喜本 +サキモト 嵜元 +サギモト 鷺本 +サキモリ 崎森 +サキモリ 先森 +サキモリ 佐木森 +サギモリ 鷺森 +サキモン 崎門 +サキヤ 崎谷 +サキヤ 先谷 +サキヤ 先矢 +サキヤ 桜木谷(櫻木谷) +サキヤ 崎屋 +サキヤ 崎弥 +サギヤ 鷺谷 +サキヤブ 崎薮 +サキヤマ 向山 +サキヤマ 崎山 +サキヤマ 先山 +サキヤマ 栄山 +サキヤマ 咲山 +サキヤマ 嵜山 +サキヤマ 碕山 +サキヤマ 榮山 +サキヤマ 佐木山 +サキヤマ 左木山 +サキヤマ 埼山 +サキヤマ 茶臼山 +サギヤマ 鷺山 +ザキヤマ 埼山 +サキュウ 佐久 +サキョ 佐居 +サキョウ 佐京 +サキョウ 左京 +サキヨコ 崎横 +サキヨシ 向吉 +サギリ 佐桐 +サギリ 狭霧 +サク 佐久 +サク 作 +サク 朔 +サク 柵 +サク 策 +ザク 座久 +サクアミ 佐久網 +サクアミ 作阿弥 +サクアミ 作網 +サクイ 作井 +サクイ 佐久井 +サクイ 作意 +サクイシ 作石 +サクウチ 作内 +サクエ 作江 +サクエ 作栄(作榮) +サクオ 作尾 +サクオカ 作岡 +サクカ 作花 +サクカ 作家 +サクカ 咲賀 +サクガヒラ 作ケ平 +サクカワ 佐久川 +サクカワ 作川 +サクガワ 佐久川 +サクガワ 作川 +サクガワ 咲川 +サクギ 柵木 +サククラ 作倉 +サクコ 作古 +サクサ 佐草 +サクサイ 作才 +サクサベ 作佐部 +サクサベ 作左部 +サクサベ 作佐辺 +サクザワ 作澤 +サクジ 作治 +サクジ 作次 +サクシゲ 作重 +サクシタ 作下 +サクシマ 作島 +サクシマ 作嶋 +サクシマ 佐久島 +サクシマ 佐久嶋 +サクジマ 作島 +サクジマ 佐久嶋 +サクジュ 咲寿 +サクジョウ 作城 +サクタ 迫田 +サクタ 作田 +サクタ 佐久田 +サクタ 咲田 +サクダ 作田 +サクダ 佐久田 +サクダ 咲田 +サクダ 柵田 +サクダ 左久田 +サクダイ 作台 +サクタニ 作谷 +サクタニ 咲谷 +サクダワラ 作俵 +サクチ 作地 +サクチ 佐久知 +サクチ 𢌞口 +サグチ 佐口 +サグチ 左口 +サクヅ 作津 +サクデ 作出 +サクトウ 作藤 +サクドウ 作道 +サクトリ 作取 +サクナ 佐久名 +サクナイ 作内 +サクナカ 窄中 +サクナカ 作中 +サクナガ 作永 +サクナガ 作長 +サクナミ 作並 +サクニ 佐国(佐國) +サクヌマ 作沼 +サクノ 作野 +サクノ 迫野 +サクノ 咲野 +サクノ 作埜 +サクノ 佐久野 +サクノウ 作能 +サクノウ 作農 +サクバ 作場 +サクハタ 作畠 +サクバタ 作畠 +サクバタ 作畑 +サクハナ 作花 +サクハナ 咲花 +サクバヤシ 作林 +サクハラ 作原 +サクハラ 佐久原 +サクハラ 柞原 +サクヒサ 作久 +サクヒラ 作平 +サクヒロ 作広 +サクベ 作部 +サクベヤ 作部屋 +サクボ 佐久保 +サクボ 作保 +サクマ 佐久間 +サクマ 作間 +サクマ 佐熊 +サクマ 咲間 +サクマ 佐久真 +サクマ 作馬 +サクマ 佐々間 +サクマ 佐久眞 +サクマ 左久間 +サクマ 昨間 +サクマ 佐久馬 +サクマ 佐隈 +サクマ 左熊 +サクマ 作磨 +サクマ 作満 +サクマ 咲摩 +サクマ 作久間 +サクマエ 作前 +サクマス 作増 +サクミ 佐久美 +サクミ 作見 +サクミ 作美 +サクミ 佐久見 +サクミチ 作道 +サクミヤ 作宮 +サクムラ 作村 +サクメ 佐久目 +サクモ 左雲 +サクモ 祥雲 +サクモト 作本 +サクモト 佐久本 +サクモト 作元 +サクモト 咲本 +サクモト 作久本 +サクモリ 作森 +サクモリ 作守 +サクモリ 佐久盛 +サクヤ 作屋 +サクヤ 作家 +サクヤマ 作山 +サクヤマ 柞山 +サクヤマ 柵山 +サクヤマ 佐久山 +サクヤマ 咲山 +サクヨシ 作吉 +サクラ 佐倉 +サクラ 桜 +サクラ 櫻 +サクラ 砂倉 +サクラ 作倉 +サクラ 佐久良 +サクラ 佐蔵(佐藏) +サクラ 左倉 +サクラ 作良 +サクラ 佐鞍 +サクライ 桜井 +サクライ 櫻井 +サクライ 佐倉井 +サクライ 桜居 +サクライ 柵瀬 +サクライ 櫻居 +サクライシ 桜石(櫻石) +サクラウ 桜卯 +サクラウチ 桜内 +サクラウチ 桜打(櫻打) +サクラウチ 櫻内 +サクラエ 桜栄 +サクラエ 桜江(櫻江) +サクラエ 櫻栄 +サクラエ 櫻榮 +サクラエダ 桜枝 +サクラエダ 櫻枝 +サクラオ 桜尾 +サクラオ 櫻尾 +サクラオカ 桜岡 +サクラオカ 櫻岡 +サクラガヒラ 桜ケ平 +サクラカワ 桜川 +サクラカワ 櫻川 +サクラガワ 桜川 +サクラガワ 櫻川 +サクラガワ 桜河 +サクラキ 桜木 +サクラキ 櫻木 +サクラギ 桜木 +サクラギ 櫻木 +サクラキチ 桜吉 +サクラキチ 櫻吉 +サクラグチ 桜口 +サクラクボ 桜久保 +サクラクボ 桜窪 +サクラコウジ 桜小路 +サクラコウジ 桜糀 +サクラコウジ 櫻小路 +サクラコウジ 櫻糀 +サクラゴウチ 桜河内 +サクラゴウチ 櫻河内 +サクラゴシ 桜越 +サクラザカ 桜坂 +サクラザキ 桜崎 +サクラザキ 佐倉崎 +サクラザキ 櫻崎 +サクラサコ 櫻迫 +サクラサワ 桜沢 +サクラサワ 櫻澤 +サクラサワ 櫻沢 +サクラサワ 桜澤 +サクラザワ 桜沢 +サクラザワ 櫻澤 +サクラザワ 櫻沢 +サクラザワ 桜澤 +サクラジ 桜地 +サクラシタ 桜下 +サクラシタ 櫻下 +サクラジマ 桜島 +サクラジマ 櫻島 +サクラセ 桜瀬(櫻瀬) +サクラタ 桜多 +サクラダ 桜田 +サクラダ 櫻田 +サクラダ 纓田 +サクラダ 佐倉田 +サクラダイ 桜台 +サクラダイ 櫻台 +サクラタケ 桜武 +サクラタニ 桜谷 +サクラタニ 櫻谷 +サクラダニ 桜谷 +サクラダニ 櫻谷 +サクラダン 桜段(櫻段) +サクラト 桜戸(櫻戸) +サクラドウ 桜堂(櫻堂) +サクラナカ 桜中 +サクラナカ 櫻中 +サクラナガ 桜永(櫻永) +サクラナガ 佐倉永 +サクラニワ 桜庭 +サクラネ 桜根 +サクラネ 櫻根 +サクラノ 桜野 +サクラノ 櫻野 +サクラバ 桜庭 +サクラバ 櫻庭 +サクラバ 桜場 +サクラバ 櫻場(櫻塲) +サクラバ 桜羽 +サクラバ 桜葉 +サクラバ 櫻羽 +サクラバシ 桜橋 +サクラバシ 櫻橋 +サクラハタ 桜畑(櫻畑) +サクラバタ 桜畠 +サクラバタ 櫻畠 +サクラバナ 桜花(櫻花) +サクラハバ 桜羽場 +サクラハマ 桜浜 +サクラバヤシ 桜林 +サクラバヤシ 櫻林 +サクラハラ 桜原 +サクラハラ 櫻原 +サクラバラ 桜原 +サクラバラ 櫻原 +サクラバル 櫻原 +サクラビ 桜美(櫻美) +サクラブ 桜武 +サクラブ 櫻武 +サクラブチ 桜渕(櫻渕) +サクラブチ 桜淵(櫻淵) +サクラベ 櫻部 +サクラマ 桜間 +サクラマ 櫻間 +サクラマタ 桜又 +サクラマタ 櫻又 +サクラマチ 桜町 +サクラマチ 櫻町 +サクラマツ 桜松(櫻松) +サクラミ 桜美(櫻美) +サクラミヤ 桜宮(櫻宮) +サクラメ 桜目 +サクラモト 桜本 +サクラモト 櫻本 +サクラモト 桜元 +サクラモト 櫻元 +サクラモリ 桜森 +サクラモリ 櫻森 +サクラヤ 桜谷 +サクラヤ 櫻谷 +サクラヤ 桜屋 +サクラヤ 佐倉谷 +サクラヤシキ 桜屋敷 +サクラヤシキ 桜谷敷(櫻谷敷) +サクラヤシキ 櫻屋敷 +サクラヤマ 桜山 +サクラヤマ 櫻山 +サクラユ 桜湯 +ザクロ 柘榴 +サクワ 佐桑 +サゲ 提 +サケイ 酒井 +サゲイシ 提石 +サゲイシ 堤石 +サゲイワ 下岩 +サゲガミ 提髪 +サゲガミ 堤髪 +サケカワ 酒川 +サケカワ 鮭川 +サケガワ 酒川 +サケガワ 鮭川 +サケグチ 酒口 +サゲグチ 提口 +サケサカ 酒坂 +サゲサカ 提坂 +サゲサカ 堤坂 +サケサク 酒作 +サケザワ 酒沢 +サケシタ 酒下 +サケシマ 酒嶋 +サゲシマ 下嶋(下嶌) +サゲシマ 提島 +サゲシマ 提嶋 +サゲシマ 堤島 +サゲシマ 堤嶋 +サゲズル 提水流 +サケタ 酒田 +サケタ 酒多 +サケダ 酒田 +サケタニ 酒谷 +サゲト 下戸 +サゲド 下戸 +サケナガ 酒永 +サケノ 酒野 +サケノベ 鮭延 +サゲハシ 提箸 +サゲハシ 提橋 +サゲハシ 佐下橋 +サゲハシ 堤箸 +サゲハシ 下ケ橋 +サゲハシ 堤橋 +サゲハシ 捧箸 +サゲハリ 提針 +サゲハリ 降梁 +サゲハリ 堤針 +サケミ 酒見 +サケムラ 酒村 +サケモト 酒本 +サケモト 酒元 +サケヤ 酒谷 +サゲヤ 提谷 +サゲヤマ 提山 +サゲンタ 佐源太 +サゲンダ 佐源田 +サコ 迫 +サコ 佐古 +サコ 硲 +サコ 砂子 +サコ 左古 +サコ 佐子 +サコ 浴 +サコ 砂 +サコ 峪 +サコ 砂古 +サコ 左子 +サコ 左居 +サコ 窄 +サコ 嶝 +サコ 佐小 +サコ 﨏 +サコ 作古 +サコ 佐故 +サコ 佐狐 +サコ 佐湖 +サコ 砂湖 +サコ 隥 +サゴ 佐護 +サゴ 佐後 +サゴ 佐伍 +ザコ 座古 +ザコ 雑喉 +ザコ 雑古 +ザコ 坐古 +ザコ 雑子 +ザコ 㘴古 +ザコ 雜古 +ザゴ 座吾 +サコアイ 峪合 +サコイ 迫井 +サコイ 佐古井 +サコイ 佐鯉 +サゴイ 砂井 +サゴイ 佐合井 +サコイシ 硲石 +サコウ 酒匂 +サコウ 酒向 +サコウ 佐光 +サコウ 左高 +サコウ 佐孝 +サコウ 佐高 +サコウ 佐向 +サコウ 酒勾 +サコウ 佐甲 +サコウ 左向 +サコウ 佐幸 +サコウ 佐香 +サコウ 左鴻 +サコウ 酒生 +サコウ 佐神 +サコウ 酒迎 +サコウ 廻口 +サコウ 佐糠 +サコウ 左孝 +サコウ 酒瓜 +サコウ 酒勺 +サコウ 酒句 +サゴウ 佐合 +サゴウ 左合 +サゴウ 佐郷 +サゴウ 左郷 +サゴウ 茶郷 +ザコウ 雑喉 +ザコウ 雜喉 +ザコウジ 座光寺 +ザコウジ 坐光寺 +サコウダ 佐幸田 +サコウチ 迫内 +サコウチ 﨏内 +サゴウヤ 佐郷谷 +サゴウヤ 佐郷屋 +サコウラ 迫浦 +サコエ 迫江 +サコエキ 迫浴 +サコオ 迫尾 +サコオ 岶尾 +サコオ 佐古尾 +サコオカ 佐古岡 +サコオカ 迫岡 +サコオク 迫奥 +サコオリ 佐郡 +サゴオリ 佐郡 +サコガイチ 迫垣内 +サコガシラ 窄頭 +サコガシラ 迫頭 +サコガミ 迫上 +サコカワ 迫川 +サコガワ 迫川 +サコガワ 佐子川 +サコガワ 﨏川 +サコガワ 佐古川 +サコガワ 廻川 +サコガワ 峪川 +サコギ 迫木 +サコグチ 迫口 +サコグチ 窄口 +サコグチ 峪口 +サコグチ 嶝口 +サコグチ 浴口 +サコグチ 硲口 +サコグチ 佐古口 +サコグチ 砂古口 +サコグチ 山谷口 +サコゴシ 迫越 +サコシ 坂越 +サコシ 佐越 +サコジ 迫地 +サコジ 硲地 +サゴシ 佐越 +サゴシ 砂越 +サコシタ 迫下 +サコシタ 佐古下 +サコジリ 迫尻 +サコゾノ 迫園 +サコタ 迫田(廹田) +サコタ 佐古田 +サコタ 﨏田 +サコタ 硲田 +サコタ 佐小田 +サコタ 左古田 +サコタ 逧田 +サコタ 佐幸田 +サコダ 迫田 +サコダ 佐古田 +サコダ 﨏田 +サコダ 硲田 +サコダ 廻田 +サコダ 佐小田 +サコダ 峪田 +サコダ 左古田 +サコダ 佐子田 +サコダ 逧田 +サコダ 岶田 +サコダ 佐幸田 +ザコタ 座小田 +サコダテ 酒人立 +サコタニ 迫谷 +サコタニ 佐古谷 +ザコタニ 雑喉谷 +ザコタニ 座古谷 +ザコタニ 雑候谷 +サコチ 迫地 +サコツボ 迫坪 +サコトミ 迫富 +サコドメ 迫留 +サコナカ 迫中 +サコナカ 窄中 +サコナカ 峪中 +サコナガ 迫永 +サコニシ 迫西 +サコヌマ 迫沼 +サコネ 迫根 +サコノ 迫野(廹野) +サコノ 佐古野 +サコノ 窄野 +サコノウエ 迫之上 +サコノオカ 迫ノ岡 +サコハタ 迫畑 +サコハタ 浴畑 +サコハタ 𡶡畑 +サコハタ 迫畠 +サコハタ 﨏畑 +サコバタ 迫畑 +サコバヤシ 浴林 +サコハラ 迫原 +サコハラ 峪原 +サコヒラ 迫平 +サコヒロ 迫広 +サコフジ 佐古藤 +サコブン 迫分 +サコベ 迫部 +サコマ 迫間 +サコマ 左迫間 +サコマ 佐迫間 +サコマエ 迫前 +サコマス 迫桝 +サコマル 迫丸 +サコミズ 迫水 +サコムラ 迫村 +サコモト 迫本 +サコモト 廻本 +サコモト 迫元 +サコモト 佐古本 +サコモト 硲本 +サコモリ 迫森 +サコヤ 迫屋 +サコヤ 迫矢 +サゴヤ 佐郷谷 +ザコヤ 雑喉谷(雜喉谷) +ザコヤ 雑喉屋(雜喉屋) +サコヤマ 迫山 +サコヤマ 佐子山 +サコヤマ 佐古山 +サコヤマ 窄山 +サコワキ 迫脇 +サコン 左近 +サコン 佐近 +サコン 佐金 +サコン 左今 +サコン 佐紺 +サコン 佐今 +サコン 左坤 +サコン 左紺 +サコンサク 左近作 +サコンシ 左近士 +サコンジ 左近司 +サコンジ 左近士 +サコンジュ 左近充 +サコンジュ 左近允 +サコンジュウ 左近充 +サコンジュウ 左近允 +サコンジョウ 左近允 +サコンジョウ 左近上 +サコンダ 左近田 +サコンダ 佐近田 +サコンド 左近戸 +ササ 佐々 +ササ 笹 +ササ 左々 +ササ 佐佐 +ササ 作々 +ササ 楽々 +サザ 佐々 +サザ 左座 +サザ 佐座 +サザ 左坐 +ササイ 笹井 +ササイ 佐々井 +ササイ 篠井 +ササイ 酒々井 +ササイ 佐才 +サザイ 佐斉(佐齊) +サザイ 佐斎 +ササイケ 笹池 +ササイシ 笹石 +ササイチ 佐々市 +ササイベ 雀部 +ササウチ 笹内 +ササウチ 佐々内 +ササウラ 笹浦 +ササウラ 佐々浦 +ササウラ 笹裏 +ササウラ 楽々浦 +ササエ 佐々江 +ササエ 笹江 +ササエダ 笹枝 +ササオ 笹尾 +ササオ 笹生 +ササオ 佐々尾 +ササオ 篠尾 +ササオ 佐々生 +ササオ 笹男 +ササオイ 笹生 +ササオカ 笹岡 +ササオカ 佐々岡 +ササオカ 篠岡 +ササオキ 篠置 +ササカ 佐坂 +ササカ 笹下 +ササカ 笹賀 +ササカ 笹鹿 +ササカ 佐阪 +ササカ 左坂 +ササカ 笹香 +ササカ 篠賀 +ササガ 笹賀 +ササガ 篠賀 +ササガキ 笹垣 +ササガケ 笹掛 +ササガサコ 笹ケ迫 +ササガセ 篠ケ瀬 +ササガセ 笹ケ瀬 +ササカタ 笹方 +ササガタ 笹方 +ササガタ 笹形 +ササカド 佐々門 +ササカネ 笹金 +ササガネ 笹金 +ササカベ 笹壁 +ササカベ 篠壁 +ササガメ 笹亀 +ササカワ 笹川 +ササカワ 佐々川 +ササカワ 笹河 +ササガワ 笹川 +ササガワ 篠川 +ササガワ 佐々川 +ササガワ 笹河 +ササキ 佐々木 +ササキ 笹木 +ササキ 篠木 +ササキ 佐崎 +ササキ 佐佐木 +ササキ 鷦鷯 +ササキ 佐々城 +ササキ 左崎 +ササキ 佐々貴 +ササキ 佐々生 +ササキ 篠笥 +ササキ 笹氣 +ササキ 左々木 +ササキ 沙々木 +ササキ 笹気 +ササキ 笹記 +ササキ 笹城 +ササギ 笹木 +サザキ 佐崎 +サザキ 左崎 +サザキ 左嵜 +サザキ 佐嵜 +ササギシ 笹岸 +ササキド 笹城戸 +ササキハラ 佐々木原 +ササキハラ 笹木原 +ササキバラ 佐々木原 +ササキバラ 笹木原 +ササクサ 笹草(笹艸) +ササグチ 笹口 +ササグチ 佐々口 +ササクボ 笹久保 +ササクマ 笹隈 +ササクマ 笹熊 +ササグマ 笹隈 +ササクラ 笹倉 +ササクラ 篠倉 +ササクラ 佐々倉 +ササグラ 佐々倉 +ササグリ 笹栗 +ササゲ 捧 +ササゲ 笹外 +ササコ 笹子 +ササコ 笹古 +ササコ 篠子 +ササゴ 笹子 +ササゴ 笹古 +ササゴ 篠子 +ササゴ 笹後 +ササコシ 笹越 +ササゴシ 笹越 +ササザキ 笹崎 +ササザキ 佐々崎 +ササザキ 笹嵜 +サササコ 笹硲 +ササザワ 篠沢 +ササザワ 笹沢 +ササザワ 篠澤 +ササザワ 笹澤 +ササジ 笹治 +ササジ 笹次 +ササジ 笹路 +ササジ 佐々治 +ササジ 佐々士 +ササシゲ 佐々繁 +ササシゲ 笹重 +ササシゲ 佐々重 +ササシタ 笹下 +ササシマ 笹嶋 +ササジマ 笹島 +ササジマ 笹嶋 +ササジマ 篠島 +ササジマ 篠嶋 +ササジマ 佐々島 +ササジョウ 佐々城 +ササセ 笹瀬 +ササゾノ 笹園 +ササソリ 笹反 +ササタ 篠田 +ササタ 笹田 +ササタ 佐々田 +ササダ 篠田 +ササダ 笹田 +ササダ 佐々田 +ササダ 佐佐田 +ササダイ 笹代 +ササダイラ 笹平 +ササダオ 笹垰 +ササタケ 笹竹 +ササタケ 佐々竹 +ササダテ 笹館 +ササダテ 笹舘 +ササタニ 笹谷 +ササタニ 佐々谷 +ササチ 笹地 +ササチ 佐々知 +ササチカ 笹近 +ササツ 笹津 +ササヅ 笹津 +ササツカ 佐々塚 +ササツカ 笹塚 +ササツカ 笹墳 +ササヅカ 佐々塚 +ササヅカ 笹塚 +ササツキ 笹月 +ササヅキ 笹月 +ササデ 笹出 +ササド 笹土 +ササドウ 笹堂 +ササトミ 笹冨 +ササトミ 笹富 +ササドミ 笹冨 +ササナカ 笹中 +ササナカ 佐々中 +ササナガ 笹永 +ササナガ 笹長 +ササナベ 篠辺 +ササナベ 篠邊 +ササナベ 篠邉 +ササナミ 笹浪 +ササナミ 笹波 +ササナミ 佐々波 +ササナミ 佐々浪 +ササナミ 佐々並 +ササナミ 篠浪 +サザナミ 小波 +サザナミ 漣 +サザナミ 薄波 +サザナミ 佐々波 +サザナミ 淪 +ササニシ 笹西 +ササヌキ 笹貫 +ササヌマ 笹沼 +ササネ 笹根 +ササノ 笹野 +ササノ 佐々野 +ササノ 篠野 +ササノ 笹埜 +ササノ 篠埜 +ササノイ 笹野井 +ササノイケ 笹之池 +ササノウチ 笹之内 +ササノウチ 笹ノ内 +ササノグチ 笹野口 +ササノマ 笹ノ間 +ササバ 笹波 +ササバ 笹葉 +ササバ 笹場 +ササバ 佐々葉 +ササハシ 笹橋 +ササハタ 笹畑 +ササハタ 佐々畑 +ササバタ 笹畑 +ササハナ 笹花 +ササハナ 笹鼻 +ササバヤシ 笹林 +ササハラ 篠原 +ササハラ 笹原 +ササハラ 佐々原 +ササバラ 笹原 +ササヒラ 笹平 +ササフ 佐々布 +ササフ 笹布 +ササブ 笹生 +ササブ 佐々布 +ササフジ 佐々藤 +ササフチ 笹渕 +ササフチ 笹淵 +ササブチ 笹渕 +ササブチ 笹淵 +ササベ 笹部 +ササベ 篠部 +ササベ 雀部 +ササベ 佐々部 +ササベ 笹辺(笹邉) +ササベ 佐々辺(佐々邉) +ササベ 萑部 +ササベ 佐々邊 +ササベ 笹邊 +ササホラ 笹洞 +ササマ 笹間 +ササマ 佐々間 +ササマエ 笹前 +ササマキ 笹巻 +ササマタ 笹俣 +ササマタ 笹又 +ササマタ 笹亦 +ササマタ 笹股 +ササマチ 笹町 +ササマツ 笹松 +ササマツ 佐々松 +ササマル 笹丸 +ササミ 笹見 +ササミ 佐々見 +ササミツ 笹光 +ササミネ 笹峯 +ササミネ 笹峰 +ササミネ 笹嶺 +ササミネ 笹岑 +ササムラ 笹村 +ササムラ 篠村 +ササムラ 佐々村 +ササムロ 笹室 +ササメ 笹目 +ササメコ 笹目子 +ササモト 笹本 +ササモト 篠本 +ササモト 佐々本 +ササモト 笹元 +ササモト 笹源 +ササモト 䈎元 +ササモリ 笹森 +ササモリ 篠森 +ササモリ 佐々森 +ササモリ 笹盛 +ササヤ 笹谷 +ササヤ 笹屋 +ササヤ 佐々家 +ササヤ 笹家 +ササヤ 笹々谷 +ササヤ 笹弥 +ササヤ 笹矢 +ササヤチ 笹谷内 +ササヤブ 笹薮(笹藪) +ササヤマ 笹山 +ササヤマ 篠山 +ササヤマ 密山 +ササヤマ 佐々山 +ササヤマ 山 +ササヨシ 笹芳 +ササヨシ 笹吉 +ササラ 佐々良 +ササラ 笹羅 +ササラ 笹良 +ササラ 筅 +ササラ 簓 +サザラシ 九石 +ササリ 佐々利 +ササワ 佐沢 +ササワ 佐澤 +サザワ 佐沢 +サザワ 佐澤 +サザワ 左沢 +サザワ 左澤 +ササワキ 笹脇 +ササワタ 笹渡 +ササワタリ 笹渡 +サザンカ 三々賀 +サシ 佐子 +サシ 佐志 +サシ 佐師 +サシ 指 +サシ 差司 +サシ 左司 +サシ 左氏 +サジ 佐治 +サジ 佐次 +サジ 佐地 +サジ 左路 +サジ 佐事 +サジ 左地 +サジ 佐司 +サジ 佐冶 +サジ 佐路 +サジ 左次 +サジ 察時 +サシエ 指江 +サシオ 指尾 +サシオ 差尾 +サシオカ 指岡 +サシカ 佐鹿 +サシガ 指賀 +サジカ 佐鹿 +サシガクボ 差ケ久保 +サシカタ 指方 +サシカタ 差形 +サシカタ 指形 +サシガネ 曲尺 +サシガネ 尺金 +サシカワ 指川 +サジカワ 佐次川 +サシキ 桟敷 +サシキ 佐敷 +サシキ 佐鋪 +サジキ 桟敷 +サジキ 佐直 +サジキ 佐敷 +サジキ 佐舗(佐舖) +サジキ 左治木 +サジキ 棧敷 +サジキ 佐治木 +サジキ 佐式 +サジキ 左直 +サジキ 佐二木 +サジキ 佐鋪 +サジキ 左舗 +サシキノ 桟敷野 +サジキノ 桟敷野 +サジキハラ 桟原 +サジキハラ 棧原 +サジキハラ 桟敷原 +サジキバラ 桟原 +サジキバラ 棧原 +サシキヤ 佐敷屋 +サジキヨ 佐次清 +サシクビ 指首 +サシクボ 差久保 +サシクマ 指熊 +サシサキ 指崎 +サシザキ 指崎 +サシザワ 指沢 +サシザワ 指澤 +サシタ 指田 +サシタ 佐下 +サシダ 指田 +サシダ 佐次田 +サシダ 刺田 +サシダ 佐志田 +サジタ 佐次田 +サシタニ 指谷 +サシデ 指出 +サシデ 差出 +サシナカ 指中 +サシナミ 差波 +サシノ 指野 +サシノ 佐篠 +サシノ 刺野 +サシバ 指場 +サシハタ 指籏(指簱) +サシハタ 指旗 +サシハタ 差畑 +サシハラ 指原 +サシハラ 佐志原 +サシヒラ 指平 +ザシボウ 座主坊 +サシマ 幸島 +サシマ 佐島 +サシマ 佐嶋 +サシマ 差間 +サシマ 左島 +サシマ 指間 +サジマ 佐島 +サジマ 佐嶋 +サジマ 左島 +サジマ 佐嶌 +サシマタ 刺又 +サシミ 差海 +サシムラ 指村 +サシモト 指本 +サシモト 差本 +サジモト 佐次本 +サシモノ 指物 +サシモノヤ 指物谷 +サシヤ 指谷 +サシヤマ 指山 +サシュウハラ 佐周原 +サジュン 左順 +サショウ 笹生 +サショウ 佐生 +サショウ 佐粧 +サショウ 左少 +サショウ 佐星 +サショウ 佐少 +サジョウ 嵯城 +サジョウ 佐城 +サジョウ 佐條 +サジョウ 佐条 +サジョウ 佐定 +ザショウ 座正 +サシロ 佐城 +サシワ 指輪 +サス 佐須 +ザス 座主 +ザス 座守 +サスエ 指江 +サスエ 佐末 +サスエ 嵯末 +サスオ 指尾 +サスオ 差生 +サスガ 流石 +サスガ 貴家 +サスガ 佐菅 +サスガ 刺賀 +サスガ 佐管 +サズカ 佐塚 +サズカワ 幸津川 +サスダ 刺田 +サスダ 佐須田 +サスミ 佐須見 +サズミ 佐住 +サセ 佐瀬 +サセ 佐生 +サセ 佐世 +サゼ 佐瀬 +サゼ 佐是 +サゼ 鎖是 +サセイ 佐生 +サセガワ 佐世川 +サセベ 佐瀬部 +サゼン 佐善 +サゼン 左膳 +サソ 佐生 +サソ 佐曽 +サソイチ 誘市 +サソウ 笹生 +サソウ 佐宗 +サソウ 佐生 +サソウ 三倉 +サソウ 佐相 +サソウ 哘 +サソウ 砂生 +サソウ 佐草 +サソウ 佐々布 +サソウ 篠生 +サソウ 佐想 +サソウ 佐布 +サソウ 左草 +サソウ 佐増 +サソウ 佐佐布 +サソウ 佐崇 +サソウ 佐双 +サソウ 佐荘 +サソウ 佐雙 +サソウザキ 哘崎(哘嵜) +サソオ 笹生 +サソギ 佐曽木 +サソザキ 哘崎(哘嵜) +サソダ 佐曽田 +サソヤ 佐曽谷 +サソヤ 佐曾谷 +サソラ 佐曽羅 +サソリ 佐曽利(佐曾利) +サタ 佐田 +サタ 佐多 +サタ 左田 +サタ 佐太 +サタ 沙汰 +サダ 佐田 +サダ 猿田 +サダ 佐多 +サダ 定 +サダ 貞 +サダ 左田 +サダ 完 +ザダ 座田 +サダイ 定井 +サダイ 定居 +サダイ 貞井 +サダイエ 定家 +サダイケ 定池 +サダイケ 貞池 +サダイシ 定石 +サダイシ 貞石 +サダイジ 佐大路 +サダイリ 貞入 +サダイリ 定入 +サダイワ 貞岩 +サダウチ 貞内 +サタウラ 佐多浦 +サタオ 佐田尾 +サダオ 佐田尾 +サダオ 貞尾 +サダオ 定尾 +サダオカ 定岡 +サダオカ 貞岡 +サタカ 左高 +サタカ 佐高 +サタカ 佐多賀 +サタガ 佐多賀 +サダカ 左高 +サダカ 佐高 +サダカ 貞賀 +サダカ 定賀 +サダカ 貞閑 +サダガ 貞賀 +サダガ 定賀 +サダカゲ 定影 +サダカゲ 貞蔭 +サダガサキ 三段崎 +サダカタ 貞方 +サダカタ 定方 +サダカタ 定形 +サダカタ 貞形 +サダカネ 貞包 +サダカネ 定金 +サダカネ 定兼 +サダカネ 貞金 +サダカネ 貞兼 +サダガネ 定金 +サダガネ 貞金 +サダカミ 貞神 +サダカリ 貞苅 +サダカリ 貞刈 +サダカワ 貞川 +サタキ 佐滝 +サタキ 左滝 +サタキ 佐太木 +サタキ 佐瀧 +サタキ 左瀧 +サダキ 貞木 +サダキ 定木 +サダキ 定来 +サダキヨ 貞清 +サダキヨ 定清 +サダキョウ 定京 +サタクニ 佐田国 +サダクニ 貞国 +サダクニ 定国 +サダクニ 佐田国 +サダクニ 貞國 +サダクニ 佐田國 +サダクニ 定國 +サダクマ 貞熊 +サタケ 佐竹 +サタケ 佐武 +サタケ 狭武(狹武) +サタケ 左武 +サタケ 早猛 +サタケ 佐多家 +サタケ 左竹 +サタケダ 佐竹田 +サダシゲ 貞重 +サダシゲ 定繁 +サダシマ 貞島 +サダシマ 定島 +サダシマ 貞嶋 +サダシマ 定嶋 +サダジマ 貞嶋 +サダスエ 貞末 +サダスエ 定末 +サダスギ 定杉 +サダズミ 定住 +サダズミ 貞住 +サダタ 定田 +サダタ 貞田 +サダタキ 貞滝 +サダタキ 貞瀧 +サタタニ 佐田谷 +サダタニ 貞谷 +サダタニ 定谷 +サダタニ 佐田谷 +サタチ 佐立 +サタチ 佐達 +サダチ 佐立 +サダチ 左達 +サダチ 佐達 +サダチカ 貞近 +サダチカ 定近 +サダチョウ 貞長 +サダツカ 定塚 +サダヅカ 定塚 +サダツキ 定月 +サダツグ 定次 +サダツナ 貞縄 +サダツナ 貞綱 +サダツネ 定常 +サダツネ 貞常 +サタテ 佐立 +サダテ 佐立 +サダテ 左館 +サダテ 左舘 +サダテ 佐館(佐舘) +サダトウ 定藤 +サダトウ 貞任 +サダトウ 貞藤 +サダトウ 貞東 +サダトウ 定籐 +サダトキ 定時 +サダトキ 貞時 +サダトク 貞徳 +サダトシ 貞利 +サダトシ 定利 +サダトシ 定歳 +サダトシ 定敏 +サダトミ 貞富 +サダトミ 定富(定冨) +サダトミ 佐田富 +サダトミ 貞冨 +サダトメ 定留 +サダトモ 貞友 +サダトモ 定友 +サダトモ 佐田友 +サダナ 貞名 +サダナオ 定直 +サダナカ 貞中 +サダナカ 定仲 +サダナカ 定中 +サダナガ 貞永 +サダナガ 定永 +サダナガ 貞長 +サダナミ 定浪 +サダナリ 定成 +サダナワ 貞縄 +サタニ 佐谷 +サタニ 左谷 +ザタニ 座谷 +サタノ 佐田野 +サタノ 左田野 +サダノ 定野 +サダノ 貞野 +サダノ 佐田野 +サダノ 左田野 +サダノ 定𡌛 +サダノブ 定延 +サダノブ 定信 +サダノブ 貞信 +サダノリ 貞乗 +サダハシ 定橋 +サダハラ 貞原 +サダハラ 定原 +サダヒサ 定久 +サダヒサ 貞久 +サダヒサ 佐田久 +サダヒデ 定秀 +サタヒラ 佐多平 +サダヒラ 定平 +サダヒラ 貞平 +サダヒラ 貞比良 +サダヒロ 貞広 +サダヒロ 貞弘 +サダヒロ 貞廣 +サダヒロ 定広 +サダヒロ 定廣 +サダフサ 定房 +サダフジ 定藤 +サダフジ 貞藤 +サダマサ 定政 +サダマサ 貞政 +サダマス 貞益 +サダマス 貞升 +サダマス 貞舛 +サダマツ 貞松 +サダマツ 定松 +サダマル 貞丸 +サダマル 定丸 +サダミ 定見 +サダミズ 定水 +サダミチ 定道 +サダミツ 貞光 +サダミツ 定光 +サダミツ 貞満 +サダミネ 定峰 +サダミョウ 貞明 +サダミョウ 貞名 +サダムネ 貞宗 +サダムネ 定宗 +サダムネ 定棟 +サダムラ 定村 +サダムラ 貞村 +サダムラ 奠邑 +サダメ 定 +サダモチ 貞持 +サダモト 定本 +サダモト 貞本 +サダモト 定元 +サダモト 貞元 +サダモト 貞許 +サダモト 佐田元 +サダモト 左田本 +サダモリ 定森 +サダモリ 貞森 +サダモリ 定盛 +サダモリ 貞守 +サダモリ 貞盛 +サダモリ 定守 +サダヤ 貞谷 +サダヤ 定谷 +サダヤス 貞安 +サダヤス 定保 +サダヤス 貞保 +サダヤス 定安 +サダヤマ 完山 +サダヤマ 定山 +サダヤマ 貞山 +サダヤマ 佐田山 +サダヤマ 禎山 +サダユキ 定行 +サダユキ 定雪 +サダユキ 貞行 +サダヨシ 定由 +サダヨシ 貞吉 +サダヨシ 定好 +サダヨシ 貞由 +サダヨリ 貞頼 +サダリ 定利 +サタル 佐太留 +サダワキ 定脇 +サダンダ 佐段田 +サチ 幸 +サチ 佐知 +サチ 佐地 +サチ 左地 +サヂ 佐地 +サチガイ 佐違 +サチカワ 幸川 +サチノ 幸野 +サチハラ 幸原 +サチモト 幸本 +サチモト 幸元 +サチヤ 幸家 +サチュウ 佐中 +サチュウ 左中 +サチョウ 佐長 +サツ 札 +サツ 佐津 +サツ 薩 +サヅ 佐津 +サツイ 薩井 +サツウ 佐通 +サッカ 目 +サッカ 属 +サッカ 作花 +サッカ 咲花 +サッカ 粟冠 +サッカ 眼目 +サッカ 作家 +サッカ 雑花(雜花) +サッカ 咲賀 +サッカ 作華 +サッカ 眠目 +サッカ 屬 +サツカ 佐塚 +サヅカ 佐塚 +サツカワ 薩川 +サツカワ 佐津川 +サツカワ 札川 +サツキ 皐月 +サツキ 砂月 +サツキ 札木 +サツキ 五月 +サツキ 佐築 +サツキ 左着 +サツキ 薩木 +サツキダ 五月田 +サツキビ 五月日 +サツキメ 五月女 +ザツコ 雑子 +サッサ 佐々 +サッサ 左雨 +サッサ 颯佐 +サッサ 薩佐 +サッサ 薩砂 +サッサ 佐ツ々 +サッサ 早雨 +サツサ 颯佐 +サツサ 薩佐 +サッサノ 颯々野 +サツザワ 薩澤 +サッタ 颯田 +サッタ 薩田 +サッタ 薩埵 +サツタ 颯田 +サツタ 薩田 +サツダ 札田 +サツタニ 札谷 +サツタニ 薩谷 +サツノ 薩野 +サツノ 薩埜 +ザツノ 雑野 +サッパ 颯波 +サッピナイ 薩日内 +サツマ 薩摩 +サツマ 佐津間 +サツマ 薩間 +サツマ 薩麻 +サツマ 薩广 +サツマエ 左津前 +サツマバヤシ 薩摩林 +サツマヤ 薩摩谷 +サツミ 薩美 +サツミ 薩見 +サツモト 薩本 +サツヤ 薩谷 +サツライ 薩来(薩來) +サツライ 薩耒 +サテ 左手 +サテ 佐手 +サデン 佐伝 +サデン 左伝 +サト 里 +サト 郷 +サト 佐登 +サド 佐渡 +サド 佐戸 +サド 佐土 +サド 佐度 +サド 佐登 +サド 左戸 +サド 左土 +サド 佐同 +サトイ 里井 +サトイ 里居 +サトイ 佐戸井 +サドイ 佐戸井 +サドイ 佐土井 +サトイエ 郷家 +サトイシ 里石 +サトウ 佐藤 +サトウ 佐東 +サトウ 左藤 +サトウ 左東 +サトウ 佐棟 +サトウ 佐当(佐當) +サトウ 砂藤 +サトウ 佐登 +サトウ 佐籐 +サトウ 砂糖 +サトウ 左登 +サトウ 沙藤 +サトウ 砂東 +サトウ 佐等 +サドウ 佐道 +サドウ 佐堂 +サドウ 左同 +サドウ 左道 +サトウゲ 佐峠 +サトウザワ 佐藤沢(佐藤澤) +サトウチ 里内 +サトウブ 甘蔗生 +サトウモト 砂糖元 +サトウヤマ 佐藤山 +サトウラ 里浦 +サトエ 里栄 +サトオ 里緒 +サトオ 里尾 +サトオ 里雄 +サトオカ 里岡 +サトオカ 聚岳 +サトオキ 里沖 +サトガシラ 里頭 +サトカタ 里方 +サトガタ 里形 +サトガタ 里方 +サトガミ 里上 +サトガミ 里神 +サトカワ 里川 +サトカワ 佐戸川 +サトガワ 里川 +サトガワ 佐戸川 +サドガワ 佐戸川 +サドガワ 佐渡川 +サトキ 里木 +サトギワ 里際 +サトグチ 里口 +サトグチ 佐戸口 +サトクラ 里倉 +サトコ 里子 +ザトコ 座床 +サトザキ 里崎 +サトサワ 里澤 +サトザワ 里沢 +サトザワ 里澤 +サトジ 里路 +サトジ 里地 +サトシゲ 里重 +サドシタ 佐土下 +サトシマ 里島 +サトジマ 里島 +サトジマ 里嶋 +サドシマ 佐渡島 +サドシマ 佐土島 +サドシマ 佐土嶋 +サドシマ 佐渡嶋 +サドジマ 佐渡島 +サトシロ 里城 +サトス 禅洲 +サトセ 里瀬 +サドセ 佐土瀬 +サトゾノ 里園 +サトゾノ 里薗 +サトダ 里田 +サトダテ 里館 +サトダテ 里舘 +サトタニ 里谷 +サトダニ 里谷 +サドタニ 佐土谷 +サトデ 里出 +サトトミ 里富 +サドトモ 佐渡友 +サトナカ 里中 +サトナカ 里仲 +サトナガ 里永 +サトナベ 里鍋 +サトニシ 里西 +サトヌマ 里沼 +サトネ 佐藤根 +サトネ 佐土根 +サトノ 里野 +サトノ 里埜 +サドノ 左殿 +サトノソノ 里之園 +サトノブ 里信 +サトハマ 里浜 +サトバヤシ 里林 +サトハラ 里原 +サドハラ 佐土原 +サドハラ 佐渡原 +サトビ 佐飛 +サトヒサ 郷久 +サトヒラ 里平 +サドヒラ 佐土平 +サトヒロ 里広 +サトフカ 里深 +サトブカ 里深 +サトベ 里部 +サトホ 郷保 +サトボウ 里坊 +サトマ 里麻 +サトマサ 里正 +サトミ 里見 +サトミ 里美 +サトミ 里富 +サトミ 郷実 +サトミ 里水 +サトミチ 里道 +サトミツ 里光 +サトミヤ 里宮 +サトムネ 里宗 +サトムラ 里村 +サトムラ 里邑 +サトムラ 里邨 +サドムラ 佐渡村 +サトモ 里茂 +サトモト 里本 +サトモト 里元 +サトモト 砂糖元 +サドモト 佐渡本 +サトモリ 里森 +サトモリ 里盛 +サトヤ 里谷 +サトヤ 里屋 +サドヤ 佐渡谷 +サドヤ 佐土谷 +サドヤ 佐渡屋 +サドヤ 佐戸谷 +サトヤス 里保 +サトヤマ 佐渡山 +サトヤマ 里山 +サトヤマ 佐藤山 +サドヤマ 佐渡山 +サトヨシ 里吉 +サトヨシ 里美 +サトヨシ 里芳 +サトリ 佐鳥 +サトリ 佐取 +サトリ 左部 +サトワ 里和 +サトワキ 里脇 +サドワラ 佐土原 +サナ 佐名 +サナ 真 +サナ 佐奈 +サナ 眞 +サナイ 讃井(讚井) +サナイ 佐内 +サナイ 真井 +サナイ 眞井 +サナイ 左内 +サナイ 讃内 +サナイ 真居 +サナエ 早苗 +サナオ 真尾 +サナオ 眞尾 +サナカ 佐中 +サナカ 佐仲 +サナカ 左中 +サナガ 佐長 +サナガ 佐永 +サナガシ 三貫納 +サナガワ 真川 +サナガワ 佐名川 +サナガワ 眞川 +サナガワ 佐那川 +サナキ 佐名木 +サナキ 佐奈喜 +サナキ 佐奈木 +サナギ 真木 +サナギ 佐薙 +サナギ 真城 +サナギ 眞木 +サナギ 佐柳 +サナギ 佐名木 +サナギ 佐奈喜 +サナギ 眞城 +サナギ 佐奈木 +サナグチ 眞口 +サナザワ 真沢 +サナザワ 真澤 +サナザワ 眞澤 +サナセ 真瀬 +サナダ 真田 +サナダ 眞田 +サナダ 左奈田 +サナダ 真多(眞多) +サナダ 佐奈田 +サナダ 佐名田 +サナダ 眞那田 +サナダイ 眞田井 +サナタケ 真竹 +サナタケ 眞竹 +サナダジマ 真田島 +サナタニ 佐南谷 +サナツグ 真孫(眞孫) +サナテ 佐名手 +サナベ 真辺 +サナベ 佐辺 +サナベ 眞辺 +サナベ 佐邊 +サナベ 佐邉 +サナミ 佐波 +サナミ 真見 +サナミ 佐南 +サナミ 佐楢見 +サナミ 左波 +サナミ 眞見 +ザナミ 座波 +サナモト 真本 +サナヤス 真安(眞安) +サナヤマ 真山 +サナヤマ 眞山 +サナヨシ 真吉(眞吉) +サナヨリ 真頼 +サナリ 佐成 +サナリ 左成 +サナリヤ 佐成屋 +サニシ 佐西 +サヌイ 讃井(讚井) +サヌカ 佐怒賀 +サヌガ 佐怒賀 +サヌキ 佐貫 +サヌキ 讃岐(譛岐) +サヌキ 佐抜(佐拔) +サヌキ 左貫 +サヌキ 讃木 +サヌキダ 佐貫田 +サヌキダ 讃岐田 +サヌキヤ 讃岐谷 +ザヌシ 座主 +サヌマ 佐沼 +サヌラ 讃良(讚良) +サネ 実 +サネ 實 +サネ 佐根 +サネ 核 +サネイ 実井 +サネイ 實井 +サネイシ 実石 +サネイシ 實石 +サネオカ 実岡 +サネオカ 實岡 +サネカタ 実方 +サネカタ 實方 +サネカネ 実兼 +サネカネ 實兼 +サネカワ 実川 +サネカワ 實川 +サネキヨ 実清 +サネクラ 実倉 +サネザキ 実崎 +サネサダ 実貞 +サネザワ 実沢(實澤) +サネザワ 實沢 +サネシゲ 実重 +サネシゲ 實重 +サネシゲ 実繁 +サネシゲ 實繁 +サネシタ 実下(實下) +サネシマ 実島 +サネシマ 實島 +サネジマ 実島 +サネジマ 實島 +サネダ 実田 +サネダ 實田 +サネチカ 実近 +サネチカ 實近 +サネツネ 実常 +サネトウ 実藤 +サネトウ 實藤 +サネトウ 核藤 +サネトシ 実歳 +サネトシ 実利 +サネトシ 實歳 +サネトミ 実富 +サネトモ 実友(實友) +サネノブ 実延 +サネノブ 実信 +サネノブ 實延 +サネノブ 實信 +サネハラ 実原 +サネハラ 實原 +サネヒサ 実久 +サネヒサ 實久 +サネヒラ 実平 +サネヒラ 實平 +サネヒロ 実広 +サネフジ 実藤 +サネフジ 實藤 +サネマサ 実政 +サネマサ 実正 +サネマサ 實政 +サネマス 実升 +サネマス 實升 +サネマツ 実松 +サネマツ 實松 +サネマル 真丸 +サネミツ 実光 +サネミツ 真光 +サネミツ 實光 +サネミツ 眞光 +サネムラ 実村 +サネムラ 實村 +サネモト 実本 +サネモト 實本 +サネモト 真元 +サネモリ 実森 +サネモリ 実守(實守) +サネモリ 實森 +サネヤス 実安 +サネヤス 真安(眞安) +サネヤス 實安 +サネヤス 実保 +サネヤマ 実山 +サネヨシ 実吉 +サネヨシ 実好 +サネヨシ 實吉 +サネヨシ 真吉(眞吉) +サネヨシ 實好 +サノ 佐野 +サノ 砂野 +サノ 茶野 +サノ 佐能 +サノ 左納 +サノ 左野 +サノ 佐埜 +サノ 佐濃 +サノイ 佐之井 +サノウ 佐納 +サノウ 佐能 +サノウ 左納 +サノウ 佐農 +サノウ 左農 +サノウチ 佐野内 +サノカワ 佐野川 +サノガワ 佐野川 +サノガワヤ 佐野川谷 +サノガワヤ 佐ノ川谷 +サノキ 佐野木 +サノキ 佐ノ木 +サノキ 佐軒 +サノギ 佐野木 +サノグチ 佐野口 +サノクラ 佐野倉 +サノサカ 佐野坂 +サノシマ 佐野島 +サノセ 佐之瀬 +サノセ 佐野瀬 +サノダ 佐野田 +サノチ 佐後 +サノブ 佐信 +サノマ 佐野間 +サノマチ 佐野町 +サノミネ 佐野峯 +サノミネ 佐野峰 +サノムネ 佐野棟 +サノムラ 佐野村 +サノモト 佐野本 +サノヤ 佐野屋 +サノヤマ 真山 +サノヤマ 眞山 +サハ 佐波 +サバ 佐波 +サバ 佐羽 +サバ 佐場 +サバ 鯖 +ザハ 座波 +ザハ 座覇 +サハイ 砂盃 +サバエ 鯖江 +サバオ 佐羽尾 +サハク 佐伯 +サバク 三八九 +サハコ 佐波古 +サハシ 佐橋 +サハシ 猿橋 +サハシ 左橋 +サハシ 佐槁 +サバシ 佐橋 +サバシリ 鯖尻 +サハセ 佐長谷 +サハセ 佐巴勢 +サバセ 佐橋 +サバセ 鯖瀬 +サバセ 佐長谷 +サバセ 佐波瀬 +サバセ 佐巴勢 +サハタ 佐畑 +サハタ 左畑 +サバタ 左畑 +サバタ 鯖田 +サバタケ 佐畠 +サバタニ 鯖谷 +サバト 鯖戸 +ザハナ 謝花 +サバナイ 佐羽内 +サハネ 佐羽 +サバネ 佐羽根 +サバノ 佐場野 +サバブチ 鯖渕 +サバヤ 鯖屋 +サバヤシ 佐林 +サハラ 佐原 +サハラ 砂原 +サハラ 左原 +サハラ 沙原 +サビ 佐飛 +サビ 左尾 +サビ 佐毘 +サビカワ 錆川 +サビシロ 淋代 +サビタニ 錆谷 +サヒナイ 佐比内 +サヒラ 佐平 +サヒロ 佐広 +サヒロ 佐廣 +サフ 佐布 +サブ 佐武 +サブ 佐分 +サブ 左部 +サフク 佐復 +サブサワ 寒風沢 +サブサワ 寒風澤 +サブタ 佐部田 +サブチ 佐渕 +サブト 佐太 +サフミ 佐文 +サブリ 佐分 +サブリ 佐分利 +サブリ 佐部利 +サブリ 佐份利 +サブリ 三分利 +サブリ 左振 +サブロウ 三良 +サブロウザコ 三郎迫 +サブロウマル 三郎丸 +サブロウマル 三丸 +サブロウマル 三良丸 +サベ 佐部 +サベ 佐辺 +サベ 佐邊 +サベ 佐邉 +サヘイ 左屏 +サヘキ 佐伯 +サベットウ 佐別当 +サベットウ 佐別當 +サホ 佐保 +サホ 佐舗(佐舖) +サホ 佐穂 +サボ 佐保 +サホイ 佐保井 +サボイ 佐保井 +サホガワ 佐保川 +サホシロ 佐保城 +サホタ 佐保田 +サホダ 佐保田 +サボタ 佐保田 +サホノ 佐保埜 +サホノ 佐保野 +サホヤマ 佐保山 +サボヤマ 佐保山 +サホリ 佐堀 +サホリ 佐掘 +サボリ 佐堀 +サマ 佐馬 +サマ 佐間 +サマ 左間 +ザマ 座間 +ザマ 座馬 +ザマ 坐間 +ザマ 㘴間 +ザマ 㘴馬 +サマエ 佐前 +サマキ 左巻 +サマキ 佐巻 +サマタ 佐俣 +サマタ 佐復 +サマタ 佐間田 +サマタ 佐股 +サマダ 佐間田 +サマツ 佐松 +サマノ 佐間野 +サマノ 佐馬野 +ザマミ 座間味 +サマヤマ 佐間山 +サマル 佐丸 +サミ 佐味 +サミ 佐美 +サミ 佐見 +サミ 沙弥 +サミカワ 佐味川 +サミカワ 左三川 +サミズ 三水 +サミズ 佐水 +サミソ 佐美三 +サミゾ 三溝 +サミゾ 佐溝 +サミゾ 左溝 +サミソウ 佐美三 +サミゾウ 佐美三 +サミダ 佐見田 +サミタニ 佐味谷 +サミチ 佐道 +サミツ 佐光 +サミツ 佐見津 +サミツ 左光 +サミヤ 佐宮 +サムカワ 寒川 +サムカワイ 寒川井 +サムサワ 寒沢 +サムサワ 寒風沢 +サムサワ 寒澤 +サムサワ 寒風澤 +サムザワ 寒沢 +サムザワ 寒澤 +サムタ 佐無田 +サムタ 佐牟田 +サムネ 佐宗 +サムネ 佐棟 +サムネ 実宗 +サムネ 實宗 +サムノ 寒野 +サムラ 佐村 +サムラ 茶村 +サムラ 左村 +サムライガネ 侍金 +サムライゾノ 侍園 +サムラキ 佐村木 +サムラギ 佐村木 +サムラゴウチ 佐村河内 +サムラダ 佐村田 +サムロ 佐室 +サメ 佐名 +サメ 佐目 +サメ 鮫 +サメイ 佐名 +サメイ 覚井(覺井) +サメイ 醒井 +サメガイ 鮫ケ井 +サメガイ 鮫貝 +サメガイ 醒ケ井 +サメカワ 鮫川 +サメグチ 鮫口 +サメザワ 鮫沢 +サメザワ 鮫澤 +サメシマ 鮫島 +サメシマ 鮫嶋 +サメシマ 実島 +サメジマ 鮫島 +サメジマ 鮫嶋 +サメタ 鮫田 +サメダ 鮫田 +サメノクチ 鮫ノ口 +サメブチ 鮫渕(鮫淵) +サメムラ 鮫村 +サメモト 鮫元 +サメヤ 鮫谷 +サモ 佐茂 +サモチ 佐持 +サモト 佐本 +サモト 佐元 +サモト 左本 +ザモト 座本 +サモリ 佐守 +サモリ 佐森 +サモン 佐門 +サモン 左門 +サモンジ 左文字 +サヤ 佐谷 +サヤ 道祖 +サヤ 佐矢 +サヤ 佐屋 +サヤ 沙也 +サヤガミ 清上 +サヤキ 鞘木 +サヤギ 鞘木 +サヤグチ 佐谷口 +サヤシ 鞘師 +ザヤス 座安 +サヤト 佐谷戸 +サヤド 佐谷戸 +サヤナギ 佐柳 +サヤノ 鞘野 +サヤノ 佐谷野 +サヤノ 佐矢野 +サヤノ 左谷野 +サヤマ 佐山 +サヤマ 細山 +サヤマ 猿山 +サヤマ 茶山 +サヤマ 左山 +サヤマ 狭山 +サヤマ 讃山 +サヤマ 崔山 +サヤマ 狹山 +サヤマ 皐山 +ザヤマ 座山 +サヤモト 鞘本 +サヤモト 道祖本 +サヤモト 佐矢本 +サヤワキ 鞘脇 +サヤンセト 道祖瀬戸 +サユウ 左右 +サユウダ 左右田 +サヨ 佐世 +サヨ 小夜 +サヨウ 佐用 +サヨウ 作用 +サヨダニ 佐用谷 +サヨリ 佐寄 +サラ 皿良 +サラ 佐良 +サラ 左良 +サライ 新井 +サライ 皿井 +サライ 更井 +サライ 澵井 +サライ 佐来(佐耒) +サライ 佐來 +サライ 左良井 +サライエ 新家 +サライエ 更家 +サライエ 皿家 +サライエ 佐良家 +サライケ 皿池 +サラウエ 皿上 +サラウミ 皿海 +サラエ 更江 +サラエ 更ヱ +サラエ 皿江 +サラエ 更エ +サラオカ 更岡 +サラカイ 皿海 +サラカイ 皿貝 +サラガイ 皿海 +サラガイ 皿谷 +サラガイ 皿貝 +サラキ 皿木 +サラキ 更木 +サラキ 佐良木 +サラサ 更紗 +サラサワ 皿澤 +サラサワ 更澤(更沢) +サラザワ 皿沢 +サラザワ 皿澤 +サラシ 晒 +サラシオ 晒尾 +サラシギ 晒木 +サラシタニ 晒谷 +サラシナ 更科 +サラシナ 晒名 +サラシナ 更級 +サラシナ 晒科 +サラシノ 晒野 +サラシノ 曝野 +サラシノ 瀑野 +サラシマ 皿嶋 +サラシマ 皿島 +サラシヤ 晒谷 +サラシヤ 晒屋 +サラスエ 皿末 +サラタ 皿田 +サラタ 更田 +サラダ 皿田 +サラダ 更田 +サラタニ 更谷 +サラタニ 皿谷 +サラド 佐良土 +サラナガ 更永 +サラニシ 更西 +サラノ 皿野 +サラブクロ 皿袋 +サラモト 皿本 +サラヤ 更谷 +サラヤ 皿谷 +サラヤ 更家 +サラヤ 更屋 +サラヤ 皿屋 +サラヤ 皿家 +サラヤ 佐良家 +サラヤシキ 更屋敷 +サラヤマ 皿山 +サラヤマ 更山 +サララ 皿良 +サリ 左利 +サリイシ 去石 +サリカワ 去川 +サリタ 去田 +サリバン 佐理伴 +サリョウ 佐梁 +サルイ 猿井 +サルイシ 去石 +サルイシ 猿石 +サルオギ 猿荻 +サルオシ 猿押 +サルカ 猿賀 +サルガ 猿賀 +サルガ 申賀 +サルカイ 猿飼 +サルガイ 猿養 +サルガク 猿楽 +サルガク 猿樂 +サルガサワ 猿ケ沢 +サルガサワ 猿ケ澤 +サルカタ 猿方 +サルガミ 申神 +サルガヤ 猿賀谷 +サルカワ 猿川 +サルカワ 去川 +サルカワ 申川 +サルカワ 申河 +サルキ 猿木 +サルキ 申木 +サルグチ 猿口 +サルクラ 猿倉 +サルゲ 猿毛 +サルコ 猿子 +サルサワ 猿沢 +サルサワ 猿澤 +サルシマ 猿島 +サルタ 猿田 +サルタ 申田 +サルタ 去田 +サルタキ 猿滝 +サルタキ 猿瀧 +サルダテ 猿舘 +サルダテ 猿館 +サルタニ 猿谷 +サルタニ 申谷 +サルノ 猿野 +サルハシ 猿橋 +サルハシ 申橋 +サルハシリ 猿走 +サルバシリ 猿走 +サルハタ 申畑 +ザルハタ 笊畑 +サルバミ 猿喰 +サルバヤシ 猿林 +サルバヤシ 申林 +サルハラ 猿原 +サルバン 猿喰 +サルボウ 猿棒 +サルマ 左留間 +サルマ 去間 +サルマル 猿丸 +サルミダ 猿見田 +サルムカイ 猿向 +サルメ 猿女 +サルモト 猿本 +サルヤ 猿谷 +サルヤ 申谷 +サルヤ 猿屋 +サルヤマ 猿山 +サルヨシ 猿吉 +サルワ 申輪 +サルワタシ 猿渡 +サルワタリ 猿渡 +ザレ 座礼(座禮) +ザレイ 座礼(座禮) +サレオ 佐礼尾 +サレオ 佐禮尾 +ザレオ 砂連尾 +サロウド 佐良土 +ザロオク 座呂奥 +ザロオク 㘴呂奥 +サワ 沢 +サワ 澤 +サワ 佐波 +サワ 佐和 +サワ 皐 +サワ 左巴 +ザワ 和 +ザワ 坐和 +ザワ 座和 +サワアイ 沢合 +サワアイ 澤合 +サワイ 沢井 +サワイ 澤井 +サワイ 沢居 +サワイ 沢飯 +サワイ 澤居 +サワイ 澤飯 +サワイイ 沢飯 +サワイイ 澤飯 +サワイケ 沢池 +サワイケ 澤池 +サワイシ 沢石 +サワイシ 澤石 +サワイズミ 沢泉 +サワイズミ 澤泉 +サワイデ 沢出 +サワイデ 澤出 +サワイリ 沢入 +サワイリ 澤入 +サワイリ 沢圦 +サワウチ 沢内 +サワウチ 澤内 +サワウミ 沢海 +サワウミ 澤海 +サワウラ 沢浦 +サワウラ 澤浦 +サワエ 沢江 +サワエ 澤江 +サワエ 沢永 +サワエ 澤永 +サワエイ 沢栄 +サワエイ 澤栄 +サワエダ 沢枝 +サワエダ 澤枝 +サワオ 沢尾 +サワオ 澤尾 +サワオカ 沢岡 +サワオカ 澤岡 +サワオク 沢奥 +サワオク 澤奥 +サワガキ 沢柿(澤柿) +サワガシラ 沢頭 +サワガシラ 澤頭 +サワカゼ 沢風 +サワガタ 沢潟 +サワガタ 澤潟 +サワカブ 沢株 +サワカブ 澤株 +サワカミ 沢上 +サワカミ 澤上 +サワカミ 澤紙 +サワガミ 沢上 +サワガミ 澤上 +サワカメ 沢亀 +サワカメ 澤亀 +サワカワ 沢川 +サワカワ 澤川 +サワキ 沢木 +サワキ 佐脇 +サワキ 澤木 +サワキ 左脇 +サワキ 沢城 +サワキ 沢樹 +サワキ 澤樹 +サワキ 澤城 +サワギシ 沢岸 +サワギシ 澤岸 +サワキタ 沢北(澤北) +サワグイ 沢畔 +サワグチ 沢口 +サワグチ 澤口 +サワクボ 沢久保 +サワクボ 澤久保 +サワクマ 沢熊 +サワクマ 澤熊 +サワクラ 沢倉 +サワクラ 澤倉 +サワクリ 沢栗 +サワクリ 澤栗 +サワグリ 沢栗 +サワグリ 澤栗 +サワグリ 沢畔 +サワグリ 澤畔 +サワケ 佐分 +サワコシ 沢越 +サワコシ 澤越 +サワコシ 沢腰 +サワコシ 澤腰 +サワゴシ 沢越 +サワゴシ 澤越 +サワサ 澤佐 +サワサ 沢佐 +サワザ 沢座(澤座) +サワサカ 沢坂 +サワサカ 澤坂 +サワサキ 沢崎 +サワサキ 澤崎 +サワサキ 沢嵜 +サワザキ 沢崎 +サワザキ 澤崎 +サワザキ 沢嵜 +サワザキ 澤嵜 +サワサト 沢里 +サワサト 澤里 +サワザト 澤里 +サワシ 沢岻 +サワシ 澤岻 +サワシ 沢志(澤志) +サワジ 沢地 +サワジ 澤地 +サワジ 沢路 +サワジ 沢治 +サワジ 澤路 +サワシゲ 沢重 +サワシゲ 澤重 +サワシタ 沢下 +サワシタ 澤下 +サワシマ 沢島 +サワシマ 澤島 +サワシマ 澤嶋 +サワシマ 沢嶋 +サワジマ 沢島 +サワジマ 澤島 +サワジマ 澤嶋 +サワジマ 沢嶋 +サワジリ 沢尻 +サワジリ 澤尻 +サワシロ 沢代 +サワシロ 沢城 +サワシロ 澤代 +サワスギ 澤杉 +サワズミ 沢住 +サワズミ 澤住 +サワセ 沢瀬 +サワセ 澤瀬 +サワセ 沢勢 +サワセ 澤勢 +サワゾエ 沢添 +サワゾエ 澤添 +サワゾノ 澤園 +サワゾノ 沢園 +サワタ 沢田 +サワタ 澤田 +サワタ 沢多 +サワタ 澤多 +サワダ 沢田 +サワダ 澤田 +サワダ 佐和田 +サワダ 沢多 +サワダ 砂和田 +サワダ 澤多 +サワダ 茶和田 +サワタイシ 沢田石 +サワタイシ 澤田石 +サワダイシ 沢田石 +サワダイシ 澤田石 +サワタキ 沢滝 +サワタキ 沢瀧 +サワタキ 澤滝 +サワタキ 澤瀧 +サワタケ 沢武 +サワタケ 沢竹 +サワタケ 澤竹 +サワタケ 澤武 +サワダテ 沢館(澤館) +サワダテ 沢舘 +サワダテ 澤舘 +サワタニ 沢谷 +サワタニ 澤谷 +サワタリ 猿渡 +サワタリ 佐渡 +サワタリ 沢渡 +サワタリ 澤渡 +サワタリ 去渡 +サワタリ 讃渡 +サワチ 沢地 +サワチ 澤地 +サワチ 澤池 +サワヂ 澤地 +サワチカ 沢近 +サワチカ 澤近 +サワツ 沢津 +サワツ 澤津 +サワヅ 沢津 +サワヅ 澤津 +サワツカ 澤塚 +サワツカ 沢塚 +サワヅカ 澤塚 +サワツガワ 沢津川 +サワツガワ 澤津川 +サワツハシ 沢津橋 +サワツバシ 沢津橋 +サワツバシ 澤津橋 +サワデ 沢出 +サワデ 澤出 +サワト 沢登 +サワト 澤登 +サワト 沢戸 +サワト 澤戸 +サワト 澤砥 +サワド 沢渡 +サワド 澤渡 +サワド 沢戸 +サワド 澤戸 +サワトウ 沢頭 +サワトウ 澤頭 +サワトミ 沢冨 +サワトミ 澤富 +サワトメ 沢留 +サワトメ 澤留 +サワナカ 沢中 +サワナカ 澤中 +サワナガ 沢永 +サワナガ 澤永 +サワナミ 沢波 +サワナミ 沢浪(澤浪) +サワナミ 澤波 +サワナリ 沢成 +サワナリ 沢生 +サワナリ 澤成 +サワニシ 沢西 +サワニシ 澤西 +サワヌマ 沢沼 +サワネ 沢根 +サワネ 澤根 +サワノ 沢野 +サワノ 澤野 +サワノ 沢埜 +サワノ 澤埜 +サワノ 澤ノ +サワノイ 沢野井 +サワノイ 沢ノ井 +サワノイ 澤野井 +サワノイ 沢之井 +サワノイ 澤ノ井 +サワノウ 沢農(澤農) +サワノウエ 沢ノ上(澤ノ上) +サワノボリ 沢登 +サワノボリ 澤登 +サワノボル 澤登 +サワノムカイ 沢之向 +サワノムカイ 澤之向 +サワバ 沢葉(澤葉) +サワハシ 沢橋 +サワハシ 澤橋 +サワハシ 佐和橋 +サワハタ 沢畑 +サワハタ 沢畠 +サワハタ 澤畑 +サワハタ 澤畠 +サワハタ 沢幡 +サワハタ 澤幡 +サワハタ 沢端 +サワハタ 澤端 +サワバタ 沢端 +サワバタ 澤端 +サワハラ 沢原 +サワハラ 澤原 +サワヒサ 沢久 +サワヒサ 澤久 +サワヒラ 沢平 +サワヒラ 澤平 +サワヒラキ 沢開 +サワヒラキ 澤開 +サワビラキ 沢開 +サワヒロ 沢広 +サワヒロ 澤廣 +サワブ 沢武 +サワブ 澤生 +サワブ 澤武 +サワブキ 沢吹 +サワブキ 澤吹 +サワフジ 沢藤 +サワフジ 澤藤 +サワフチ 澤渕 +サワブチ 沢渕 +サワブチ 沢淵(澤淵) +サワベ 沢辺 +サワベ 沢部 +サワベ 澤辺 +サワベ 澤部 +サワベ 澤邊 +サワベ 澤邉 +サワベ 沢邊 +サワベ 沢邉 +サワマ 沢間 +サワマ 澤間 +サワマタ 沢又 +サワマタ 澤又 +サワマツ 沢松 +サワマツ 澤松 +サワマル 沢丸 +サワマル 澤丸 +サワミ 沢見 +サワミ 沢海 +サワミ 澤見 +サワミ 澤海 +サワミ 沢味 +サワミ 沢巳(澤巳) +サワミ 沢己 +サワミ 澤味 +サワミズ 沢水 +サワミズ 澤水 +サワミヤ 沢宮(澤宮) +サワムカイ 沢向 +サワムカイ 澤向 +サワムタ 沢牟田 +サワムタ 澤牟田 +サワムラ 沢村 +サワムラ 澤村 +サワムラ 沢邑 +サワムラ 澤邑 +サワムラ 沢邨 +サワメ 沢目 +サワメ 澤目 +サワモ 沢面(澤面) +サワモト 沢本 +サワモト 澤本 +サワモト 沢元 +サワモト 澤元 +サワモリ 沢森 +サワモリ 澤森 +サワモリ 澤守 +サワモリ 沢守 +サワヤ 沢谷 +サワヤ 澤谷 +サワヤ 沢矢 +サワヤ 沢屋 +サワヤ 澤屋 +サワヤ 澤矢 +サワヤギ 沢柳 +サワヤギ 澤柳 +サワヤシキ 沢屋敷 +サワヤシキ 澤屋敷 +サワヤス 沢安 +サワヤス 澤安 +サワヤナギ 沢柳 +サワヤナギ 澤柳 +サワヤマ 沢山 +サワヤマ 澤山 +サワヤマ 佐和山 +サワヨ 沢与(澤與) +サワヨシ 沢吉(澤吉) +サワヨシ 沢芳 +サワラ 佐原 +サワラ 讃良(讚良) +サワラ 早良 +サワラ 鰆 +サワラ 沢良 +サワラギ 椹木 +サワラギ 沢良木 +サワラギ 椹 +サワラギ 澤良木 +サワラギ 沢原宜(澤原宜) +サワラギ 沢良宜 +サワラメ 鰆目 +サワリョウ 沢両(澤両) +サワレン 沢蓮 +サワワキ 沢脇 +サワワキ 澤脇 +サワワタリ 沢渡 +サワワタリ 澤渡 +サン 参 +サンイチ 産一 +サンイン 山陰 +サンオ 三尾 +サンオウ 山王 +サンオウ 三王 +サンオウジ 三王寺 +サンオウドウ 山王堂 +サンカ 三箇 +サンカ 三家 +サンカ 三鹿 +サンカ 三ケ +サンカ 三荷 +サンカ 三可 +サンガ 三箇 +サンガ 三家 +サンガ 三賀 +サンガ 三加 +サンガ 三個 +サンガ 三ケ +ザンカ 残華 +サンカイ 三海 +サンカイ 山海 +サンカイ 三貝 +サンガイ 三階 +サンガイマツ 三階松 +サンカク 三角 +サンガツダ 三月田 +サンカメ 三亀 +サンカワ 寒川 +サンカワ 三川 +サンカワ 参川 +サンガワ 山川 +サンガワ 寒川 +サンガワ 三川 +サンガワ 参川 +サンガワラ 三川原 +サンギ 三義 +サンキュウ 三久 +サンキヨ 三清 +サンキョウ 三京 +サンキョウ 山境 +サンギョウジ 三行地 +サンギョウチ 三行地 +サンギョク 算旭 +サンギリ 三桐 +サンク 三九 +サング 三宮 +サング 三具 +サングウ 三宮 +サングウ 山宮 +サングウ 参宮 +サンケ 三家 +サンゲン 三軒 +サンゲンダニ 三間谷 +サンゲンヤ 三間谷 +サンゲンヤ 三軒家 +サンゲンヤ 三軒谷 +サンゲンヤ 三軒屋 +サンコ 三鈷 +サンコ 三古 +サンコ 三小 +サンゴ 山後 +サンゴ 三五 +サンゴ 珊瑚 +サンゴ 三後 +サンゴ 三伍 +サンゴ 三吾 +サンコウ 三光 +サンコウ 三功 +サンゴウ 山郷 +サンゴウ 三郷 +サンゴウ 参郷 +サンコウイン 三光院 +サンコウジ 三光寺 +サンゴウドウ 三合堂 +サンコウボウ 三光坊 +サンコウロウ 三光楼 +サンゴク 三石 +サンゴク 山国 +サンコダ 三小田 +サンザイ 三才 +サンザイ 三在 +サンサイマチ 三才町 +サンサカ 三坂 +サンサワ 三沢 +サンサワ 三澤 +サンザワ 参沢(参澤) +サンシ 三枝 +サンシ 三四 +サンジ 山地 +サンジ 三治 +サンジ 三路 +サンシキ 桟敷 +サンジキ 桟敷 +サンジキ 山敷 +サンジキ 棧敷 +サンシゲ 三重 +サンシチ 三七 +サンシャ 三者 +サンシャドコロ 三社所 +サンジュウガリ 三十刈 +サンジュウガリ 三十苅 +サンショウ 三昌 +サンショウ 三姓 +サンショウ 三省 +サンジョウ 三上 +サンジョウ 山上 +サンジョウ 三条 +サンジョウ 三條 +サンジョウ 三城 +サンジョウ 山条 +サンジョウ 山桝 +サンジョウ 三丈 +サンジョウ 参上 +サンジョウ 山畳(山疊) +サンショウギ 三升木 +サンジョウニシ 三条西 +サンジョウニシ 三條西 +サンジョウバ 三条場 +サンジョウバ 三條場 +サンジョウバシ 三条橋 +サンジョウバタ 三升畑 +サンジョウバタ 三舛畑 +サンジョウメ 三條目 +サンジョウメ 三条目 +サンジョウヤ 三条谷 +サンジョウヤ 三條谷 +サンスイ 山水 +サンズイ 三随(三隨) +サンセ 三瀬 +サンセ 三畝 +サンセイ 三清 +サンゼン 三膳 +サンゼン 三前 +サンゼン 三仙 +サンゼン 三千 +サンソウ 三双 +サンタ 三田 +サンタ 三太 +サンダ 三田 +サンダ 産田 +サンダ 参田 +サンダ 三駄 +サンダ 讃田 +サンダイ 三代 +サンダイ 山台 +サンダイ 山臺 +サンダイジ 三大寺 +サンタカ 三高 +サンタゾノ 三反園 +サンダヤ 三田谷 +サンタン 三反 +サンダン 三反 +サンダン 山段 +サンダン 三段 +サンタンゾノ 三反園 +サンタンダ 三反田 +サンダンバタ 三反畑 +サンダンバタケ 三反畑 +サンチ 三地 +サンチカ 三近 +サンチョウ 三丁 +サンチョウメ 三丁目 +サンツカ 三塚 +サンデン 三伝(三傳) +サンデン 三傅 +サント 三戸 +サント 三登 +サンド 三戸 +サンド 三度 +サンド 山渡 +サントウ 山藤 +サントウ 三藤 +サントウ 山東 +サントウ 三登 +サントウ 山頭 +サントウ 三東 +サンドウ 山藤 +サンドウ 山道 +サンドウ 三藤 +サンドウ 山東 +サンドウ 山洞 +サンドウ 三堂 +サンドウ 三道 +サンドウ 山同 +サンドウ 山銅 +サンドウチ 三堂地 +サントウヤ 三達屋 +サントキ 山時 +サントク 三徳 +サントクヤ 三徳屋 +サントス 三渡洲 +サントス 三都主 +サンドヒガシ 山戸東 +サントミ 三富 +サントミ 三冨 +サントモリ 山外森 +サンナイ 山内 +サンナイ 三内 +サンナカ 三中 +サンナガ 山永 +サンナカニシ 三中西 +サンナカワ 三那川 +サンナガワ 三那川 +サンナベ 参鍋 +サンナミ 三浪 +サンナミ 三波 +サンナン 山南 +サンニ 三二 +サンニュウ 三入 +サンノ 山野 +サンノ 三野 +サンノ 三埜 +サンノ 讃野 +サンノウ 山王 +サンノウ 山納 +サンノウ 三王 +サンノウ 三納 +サンノウ 参納 +サンノウ 讃納 +サンノウドウ 山王堂 +サンノウマル 山王丸 +サンノキョウ 三ノ京 +サンノセ 三之瀬 +サンノト 三ノ戸 +サンノハザマ 三迫 +サンノブ 三信 +サンノヘ 三戸 +サンノマル 三ノ丸 +サンノマル 三の丸 +サンノマル 三之丸 +サンノミヤ 三宮 +サンノミヤ 三野宮 +サンノミヤ 三ノ宮 +サンノミヤ 参宮 +サンノミヤ 三之宮 +サンノミヤ 三の宮 +サンノミヤ 參宮 +サンバ 三羽 +サンバ 三馬 +サンバ 三場 +サンパ 三羽 +サンバイ 三盃 +サンバイ 三杯 +サンパイ 三盃 +サンバヤシ 三林 +サンバラ 寒原 +サンバラ 三荊 +サンバン 三番 +サンピ 三比 +サンビャク 三百 +サンビャクガリ 三百苅 +サンビャクダ 三百田 +サンピョウ 三俵 +サンビン 三瓶 +サンブ 三部 +サンブ 三歩 +サンブ 三分 +サンプ 三府 +サンブイチ 三分一 +サンブイチ 三歩一 +サンブイッショ 三分一所 +サンフクジ 三福寺 +サンブツ 三仏 +サンブツ 三佛 +サンベ 三瓶 +サンベ 三部 +サンベ 三辺 +サンベ 三邉 +サンベ 三邊 +サンペ 三瓶 +サンペ 三戸 +サンベイ 三瓶 +サンペイ 三瓶 +サンペイ 三平 +サンペイ 三幣 +サンペイ 三弊 +サンポ 三保 +サンポ 山保 +サンボウ 三宝(三寶) +サンボウ 三坊 +サンボウ 三包 +サンボウ 三寳 +サンポウ 三方 +サンポウ 三宝(三寶) +サンボン 三本 +サンボンウルシ 三本漆 +サンボンギ 三本木 +サンボンジ 三品寺 +サンボンジ 山本寺 +サンポンジ 三品寺 +サンボンスガ 三本菅 +サンボンスギ 三本杉 +サンボンスゲ 三本菅 +サンボンスゲ 三本管 +サンボンチク 三本竹 +サンボンマツ 三本松 +サンボンヤナギ 三本柳 +サンマ 三間 +サンマ 三馬 +サンマ 三摩 +ザンマ 座間 +ザンマ 三間 +ザンマ 残間 +ザンマ 座馬 +ザンマ 残熊 +ザンマ 残馬 +ザンマ 殘間 +サンマイジ 三枚地 +サンマイドウ 三枚堂 +サンマイバシ 三枚橋 +サンマイヤマ 三枚山 +サンマエ 三前 +サンマル 三丸 +サンミ 三味 +サンミ 三見 +サンミ 三美 +サンミ 三身 +サンミ 参三 +サンミヤ 三宮 +サンミヤ 参宮 +サンミョウ 三妙 +サンモト 産本 +サンモリ 三森 +サンモリ 三盛 +サンモンジ 三文字 +サンヤ 山谷 +サンヤ 三屋 +サンヤ 三夜 +サンヤマ 三山 +サンヨウ 三用 +サンヨウ 三楊 +サンヨウシ 算用子 +サンリ 三里 +サンリュウ 三竜 +サンリョウ 三龍 +サンリョウ 三凌 +サンリンドウ 山林堂 +サンロク 山禄 +サンワ 三輪 +シ 志 +シア 四阿 +シアイ 仕合 +シアキ 塩飽 +シアキ 仕明 +シアク 塩飽 +シアケ 仕明 +ジアミ 地網 +ジアラシ 地嵐 +シアワセ 仕合 +ジアン 地庵 +ジアン 地案 +ジアン 寺菴 +ジアンゲ 寺庵下 +シイ 四井 +シイ 椎 +シイ 四位 +シイ 師 +シイ 椎井 +シイ 志井 +シイ 四伊 +シイ 四夷 +シイ 推井 +シイ 志伊 +シイ 志位 +シイ 施井 +ジイ 地井 +シイイ 椎井 +シイウエザト 後上里 +シイエ 椎江 +シイオ 椎尾 +シイガイ 椎貝 +シイガモト 椎ケ本 +シイカワ 椎川 +シイカワハナ 後川花 +シイキ 椎木 +シイギ 椎木 +シイク 椎久 +シイク 推久 +シイグチ 椎口 +シイクマ 椎熊 +シイザキ 椎崎(椎嵜) +シイズ 椎須 +シイタ 椎田 +シイダ 椎田 +シイダ 志井田 +シイタケニシ 後嵩西 +シイタダ 後田多 +シイタニ 椎谷 +シイタモリ 後田盛 +シイチ 私市 +シイチ 志市 +シイツ 椎津 +シイヅ 椎津 +シイヅ 推津 +シイツカ 椎塚 +シイヅカ 椎塚 +シイヅカ 稚塚 +シイヅメ 椎爪 +シイデ 椎出 +シイナ 椎名 +シイナ 推名 +シイナ 椎奈 +シイナ 信伊奈 +シイナ 稚名 +シイネ 椎根 +シイノ 椎野 +シイノ 推野 +シイノキ 椎木 +シイバ 椎葉 +シイバ 椎場 +シイバ 推葉 +シイバエ 椎八重 +シイハシ 椎橋 +シイバシ 椎橋 +シイハタ 椎畑 +シイバタ 椎畑 +シイハマ 後浜 +シイハマ 後濱 +シイバヤシ 椎林 +シイハラ 椎原 +シイバラ 椎原 +シイヒラ 椎平 +シイマ 椎間 +シイマド 椎窓 +シイムラ 椎村 +シイモト 椎本 +シイモリ 椎森 +シイヤ 椎谷 +シイヤ 椎屋 +シイヤ 詩谷 +シイヤ 推屋 +シイヤ 推谷 +シイヤマ 椎山 +シイラ 志伊良 +シイレ 仕入 +シイレ 四位例 +シイレ 志伊礼 +シウダ 紫生田 +シウチ 志内 +シウチ 志宇知 +シウチ 氏内 +ジウチ 地内 +ジウチ 治内 +シウラ 子浦 +シウラ 志浦 +シウラ 士浦 +シウン 紫雲 +シエ 嗣江 +シェイク 星玖 +シエン 枝園 +シオ 塩 +シオ 志尾 +シオ 子浦 +シオ 四尾 +シオ 司尾 +ジオ 地黄 +ジオ 治尾 +シオアキ 塩飽 +シオアク 塩飽 +シオイ 塩井(鹽井) +シオイ 汐井 +シオイ 潮井 +シオイ 鹵井 +シオイカリ 汐碇 +シオイカワ 塩井川 +シオイガワ 塩井川 +シオイガワ 潮井川 +シオイケ 塩生 +シオイケ 汐池 +シオイケ 塩池 +シオイシ 塩石 +シオイデ 塩出 +シオイリ 塩入 +シオイリ 汐入 +シオイリ 潮入 +シオイリガタニ 塩入ケ谷 +シオイリタニ 塩入谷 +シオイリダニ 塩入谷 +シオイリヤ 塩入谷 +ジオウ 地黄 +シオウチ 塩内 +シオウテン 四王天 +シオウデン 四王天 +シオウミ 塩海 +シオウメ 塩梅 +シオウラ 塩浦 +シオエ 塩江 +シオエ 汐江 +シオエ 潮江 +シオオ 塩尾 +シオオカ 塩岡 +シオカ 師岡 +シオカ 塩家 +シオカ 四岡 +シオカ 詩丘 +シオカ 恣岡 +シオガ 塩賀 +シオカイ 塩貝 +シオカイ 汐海 +シオカイ 塩加井 +シオガイ 塩谷 +シオガイ 塩貝 +シオガキ 塩垣 +シオガシラ 塩頭 +シオカタ 塩形 +シオガタ 塩形 +シオカネ 塩金 +シオガマ 塩釜 +シオガマ 塩竃 +シオガマ 塩竈 +シオカミ 潮上 +シオカミ 塩上 +シオガミ 潮上 +シオガミ 塩上 +シオカラマツ 塩唐松 +シオカリ 塩苅 +シオカリ 塩刈 +シオカリ 四百苅 +シオガリ 塩苅 +シオカワ 塩川 +シオカワ 汐川 +シオカワ 塩河 +シオカワ 志保川 +シオカワ 潮川 +シオガワ 塩川 +シオキ 塩木 +シオギ 塩木 +シオク 志奥 +シオグチ 塩口 +シオグチ 汐口 +シオグチ 潮口 +シオクミ 塩組 +シオクミ 塩汲 +シオクラ 塩倉 +シオグリ 塩栗 +シオケ 塩毛 +シオコ 潮湖 +シオゴ 汐後 +シオゴウ 塩合 +シオコシ 塩越 +シオゴシ 塩越 +シオサ 塩佐 +シオザ 塩座 +シオサカ 塩坂 +シオサカ 塩阪 +シオサカイ 塩境 +シオザカイ 塩境 +シオサキ 塩崎 +シオサキ 潮崎 +シオサキ 汐崎 +シオサキ 塩先 +シオサキ 塩嵜 +シオサキ 汐先 +シオサキ 潮先 +シオザキ 塩崎 +シオザキ 潮崎 +シオザキ 汐崎 +シオザキ 塩嵜 +シオザキ 汐先 +シオザキ 志尾崎 +シオザキ 塩埼 +シオザキ 汐埼 +シオサコ 塩迫 +シオサト 塩郷 +シオサト 塩里 +シオサワ 塩沢 +シオサワ 塩澤 +シオザワ 塩沢 +シオザワ 塩澤 +シオザワ 志保沢 +シオザワ 汐沢 +シオザワ 志保澤 +シオザワ 汐澤 +シオシ 塩士 +シオシ 塩志 +シオジ 塩路 +シオジ 塩地 +シオジ 塩治 +シオジ 塩士 +シオジ 潮路 +シオシゲ 汐重 +シオシタ 潮下 +シオシタ 塩下 +シオジマ 塩島 +シオジマ 塩嶋 +シオジマ 塩嶌 +シオジリ 塩尻 +シオジリ 潮尻 +シオズ 塩津 +シオズカ 塩塚 +シオスギ 塩杉 +シオズミ 塩住 +シオズミ 塩澄 +シオズル 塩水流 +シオセ 塩瀬 +シオセ 汐瀬 +シオセ 潮瀬 +シオタ 塩田 +シオタ 潮田 +シオタ 汐田 +シオタ 紫尾田 +シオタ 志尾田 +シオタ 塩多 +シオタ 鹽田 +シオダ 塩田 +シオダ 潮田 +シオダ 志尾田 +シオダ 塩多 +シオダ 子浦田 +シオダ 潮多 +シオタカ 塩高 +シオタキ 塩滝(塩瀧) +シオタケ 塩竹 +シオタニ 塩谷 +シオタニ 汐谷 +シオタニ 潮谷 +シオタリ 塩足 +シオダワラ 塩俵 +シオチ 塩地 +シオチ 潮地 +シオヂ 塩地 +シオツ 塩津 +シオツ 潮津 +シオツ 汐津 +シオヅ 塩津 +シオヅ 志甫津 +シオツカ 塩塚 +シオツカ 塩柄(塩抦) +シオツカ 塩宦 +シオヅカ 塩塚 +シオヅカ 潮塚 +シオツキ 塩月 +シオツキ 汐月 +シオツキ 塩附 +シオツキ 潮月 +シオツキ 塩築 +シオツキ 塩付 +シオヅキ 塩月 +シオツグ 塩次 +シオツボ 塩坪 +シオツル 塩鶴 +シオヅル 塩鶴 +シオヅル 塩水流 +シオテ 塩手 +シオデ 塩出 +シオデ 塩手 +シオデ 潮出 +シオデラ 塩寺 +シオドメ 塩留 +シオドメ 汐留 +シオドメ 潮留 +シオナ 塩穴 +シオナカ 塩中 +シオナカ 汐中 +シオナカ 潮中 +シオナガ 塩永 +シオナガ 潮永 +シオナガ 塩長 +シオナリ 塩成 +シオニシ 塩西 +シオニュウ 塩生 +シオヌマ 塩沼 +シオネ 塩根 +シオネリ 塩練 +シオノ 塩野(鹽野) +シオノ 塩生 +シオノ 潮野 +シオノ 汐野 +シオノ 志生野 +シオノイ 塩野井 +シオノイリ 塩野入 +シオノイリ 塩之入 +シオノイリ 塩ノ入 +シオノコウジ 塩小路 +シオノサキ 塩野崎 +シオノザキ 塩野崎 +シオノザキ 塩ノ崎 +シオノメ 塩野目 +シオノヤ 塩谷 +シオノヤ 塩野谷 +シオノヤ 塩ノ谷 +シオノヤ 塩之谷 +シオハタ 塩畑 +シオハタ 塩幡 +シオハタ 塩旗 +シオハマ 塩浜 +シオハマ 塩濱 +シオハマ 潮浜(潮濱) +シオハマ 塩羽間 +シオハマ 汐浜 +シオバヤシ 塩林 +シオハラ 塩原 +シオハラ 汐原 +シオバラ 塩原 +シオヒラ 潮平 +シオヒラ 塩平 +シオフク 塩福 +シオブチ 塩渕 +シオベ 塩部 +シオベ 塩辺 +シオベ 塩邊 +シオマ 塩間 +シオマ 塩真(塩眞) +シオマキ 汐巻 +シオマス 塩増 +シオマチ 汐待 +シオマツ 塩松 +シオミ 塩見(鹽見) +シオミ 潮見 +シオミ 汐見 +シオミ 塩味 +シオミ 潮海 +シオミ 塩海 +シオミ 塩三 +シオミ 塩美 +シオミズ 塩水 +シオミズ 潮水 +シオミチ 塩道 +シオミツ 塩満(塩滿) +シオミツ 汐満(汐滿) +シオミツ 潮満 +シオミツ 塩光 +シオミヤ 塩宮 +シオムキ 塩向 +シオムラ 塩村 +シオムラ 潮村 +シオムロ 塩室 +シオモチ 汐持 +シオモト 塩本 +シオモト 汐元 +シオモト 塩元 +シオモト 志尾本 +シオモリ 塩森 +シオモリ 塩盛 +シオヤ 塩谷 +シオヤ 塩屋 +シオヤ 塩冶 +シオヤ 汐谷 +シオヤ 塩家 +シオヤ 潮屋 +シオヤ 潮谷 +シオヤ 塩矢 +シオヤス 塩安 +シオヤス 塩保 +シオヤソノ 塩屋園 +シオヤゾノ 塩屋園 +シオヤマ 塩山 +シオヤマ 汐山 +シオヤマ 潮山 +シオヤマ 臨山 +シオユ 塩湯 +シオヨケ 汐除 +シオヨシ 塩芳 +シオリ 枝折 +シオリ 四折 +シオリ 汐折 +シオワキ 塩脇 +シオワケ 汐別 +シオン 塩音 +シオン 四恩 +ジオン 治恩 +シカ 四家 +シカ 鹿 +シカ 四日 +シカ 志鹿 +シカ 紫花 +シカ 次嘉 +シガ 志賀 +シガ 四家 +シガ 滋賀 +シガ 志鹿 +シガ 施賀 +ジカ 治家 +シカイ 四海 +シカイ 鹿井 +シカイ 四家井 +シカイ 芝海 +シカイ 鹿居 +シカイ 糸海 +シカウチ 鹿内 +シカウミ 鹿海 +シカウラ 鹿浦 +シカウラ 四ケ浦 +シガウラ 志賀浦 +シカエ 鹿江 +シカエ 志賀江 +シカオ 鹿尾 +シカオカ 鹿岡 +シカガマ 鹿釜(鹿釡) +シカガリ 鹿狩 +シカガワ 鹿川 +シカガワ 竺川 +シカキ 志柿 +シカキ 鹿木 +シカギ 鹿木 +シガキ 志垣 +シガキ 紫垣 +シガキ 志柿 +シガキ 仕垣 +シガキ 鹿垣 +シカギシ 鹿岸 +シカク 四角 +シカク 始閣 +シガク 志賀久 +シガク 志学 +シガク 志學 +ジカク 自覚 +シカクイ 鹿喰 +シカグチ 鹿口 +シガグチ 志賀口 +シカクボ 鹿久保 +シカクマ 鹿熊 +シカクメ 四角目 +シカクラ 鹿倉 +シカゴシ 鹿越 +シカザキ 鹿崎 +シガサキ 志賀崎 +シカサト 鹿里 +シカザワ 鹿沢 +シカザワ 鹿澤 +シカシ 鹿士 +シカジマ 鹿島 +シカショ 四ケ所 +シカス 四十洲 +シカセ 鹿瀬 +シカゼ 志風 +シカゾノ 鹿園 +シカゾノ 鹿苑 +シカタ 四方 +シカタ 鹿田 +シカタ 志方 +シカタ 紫加田 +シカタ 志形 +シカタ 四ケ田 +シカタ 鹿多 +シカダ 鹿田 +シガタ 志形 +シガタ 志潟 +ジカタ 地方 +ジガタ 地形 +シカタキ 鹿滝(鹿瀧) +シカダキ 鹿滝(鹿瀧) +シカタケ 鹿嶽 +シカタニ 鹿谷 +シガタニ 志賀谷 +シカツ 鹿津 +シカツカ 鹿塚 +シカツノ 鹿角 +シカヅメ 鹿爪 +シカト 鹿戸 +シカド 鹿戸 +シカナイ 鹿内 +シカナエ 詩叶 +シカナベ 鹿鍋 +シカナミ 鹿波 +シガナミ 志賀浪 +ジガナメ 寺要 +シカヌキ 鹿貫 +シカヌマ 鹿沼 +ジガネ 地金 +シカノ 鹿野 +シカノ 四ケ野 +シカノ 鹿埜 +シガノ 志賀野 +シカノウチ 鹿ノ内 +シカノマタ 鹿又 +シカノヤ 鹿野谷 +シカノリ 鹿乗(鹿乘) +シカバ 鹿場 +シカハマ 鹿浜 +シカハマ 鹿濱 +シカバヤシ 鹿林 +シカハラ 鹿原 +シガハラ 志賀原 +シガハラ 信ケ原 +シカマ 鹿間 +シカマ 四釜 +シカマ 色摩 +シカマ 志鎌 +シカマ 四竃 +シカマ 志釜 +シカマ 鹿摩 +シカマ 鹿釜(鹿釡) +シカマ 四竈 +シカマ 飾磨 +シカマ 飾間 +シカマ 志佳摩 +シカマ 而摩 +シカマ 鹿真 +シカマ 飾麻 +シカマ 飾万 +シカマ 飾萬 +シカマ 錺間 +シガマ 志鎌 +シガマ 志釜 +ジガマ 地釜 +シカマタ 鹿又 +シカマタ 鹿股 +シカマツ 鹿松 +シカマツ 飾万津 +シガマツ 志賀松 +シカミ 爾見 +シカミ 紙上 +シカミ 鹿見 +シガミ 紙上 +ジカミ 地神 +ジガミ 樹神 +ジガミ 地神 +ジガミ 地紙 +ジガミ 地上 +シカムネ 鹿宗 +シカムラ 鹿村 +シガムラ 志賀村 +シカムロ 鹿室 +シカメ 鹿目 +シカモト 鹿本 +シカモリ 鹿森 +シカモリ 鹿籠 +シカモリ 飾森 +シカヤ 鹿谷 +シカヤ 鹿屋 +シカヤ 四日谷 +シガヤ 志萱 +シガヤ 志賀谷 +シカヤブ 鹿籔 +シカヤマ 鹿山 +シガラキ 信楽(信樂) +シガラキ 神楽 +シガラキ 神樂 +シガラミ 柵 +シガラミ 据 +シカワ 志川 +シカワ 四川 +シカワ 紫川 +シガワ 志川 +シガワ 紫川 +ジカワ 十川 +ジカワ 次川 +シカワタリ 鹿渡 +シカン 鹿肝 +シカン 志寒 +ジカン 自閑 +ジカン 慈観 +ジガン 慈眼 +シカンジ 志観寺 +シカンド 鹿人 +シキ 志岐 +シキ 式 +シキ 四木 +シキ 志貴 +シキ 志気 +シキ 敷 +シキ 鋪 +シキ 氏木 +シキ 四鬼 +シキ 志喜 +シキ 四季 +シキ 志記 +シキ 士貴 +シキ 志紀 +シキ 志氣 +シキ 色 +シギ 信貴 +シギ 四木 +シギ 鴫 +シギ 志儀 +ジキ 慈耆 +ジギ 治儀 +シキイ 式井 +シキイ 敷井 +シキイ 色井 +シキイ 式居 +シキイシ 敷石 +シギイシ 鴫石 +シキウチ 志岐内 +シキウチ 志木内 +シキオ 式尾 +シキオ 椎木尾 +シキカワ 色川 +シキグチ 飾口 +シキクラ 鋪倉 +シキサイ 飾西 +シキサワ 式沢 +シキサワ 式澤 +シキザワ 式沢 +シキザワ 式澤 +シキシ 色紙 +シキシ 式司 +シキジ 敷地 +シキジ 式地 +ジキシ 直指 +シキシマ 敷島 +シキシマ 敷嶋 +シキシマ 式島 +シキシマ 式嶋 +シギシマ 鴫島 +シギシマ 鴫嶋 +シキジヤ 敷地屋 +シキショウ 式庄 +ジキショウ 直正 +シキスイ 敷水 +シキタ 敷田 +シキタ 式田 +シキタ 鋪田 +シキタ 色田 +シキタ 舗田 +シキタ 志木田 +シキダ 敷田 +シキダ 式田 +シキダ 鋪田 +シキダ 志木田 +シギタ 鴫田 +シキタエ 敷妙 +シキタニ 敷谷 +シキタニ 式谷 +シキタニ 色谷 +シギタニ 鴫谷 +シキチ 敷地 +シキチ 式地 +シキチ 敷知 +シキツ 敷津 +シキツナ 式綱 +シキド 敷戸 +ジキドウ 食堂 +ジキドウ 直堂 +シキトミ 敷富 +シキトミ 敷冨 +シキナ 識名 +シキナ 敷名 +シキナ 織名 +シキナカ 敷中 +シキナミ 敷浪 +シキナミ 敷波 +シキネ 敷根 +シキネ 式根 +シキネ 鋪根 +シキノ 鋪野 +シキノ 敷野 +シキノ 式野 +シキノ 舗野(舖野) +シキノ 色野 +シギノ 鴫野 +シギノ 信貴野 +シキバ 式場 +シキバ 鋪場 +ジキバ 食場 +シギハタ 鴫畑 +シギハマ 鴫浜 +シギハマ 鴫濱 +シギハラ 鴫原 +ジキハラ 直原 +シキヒ 敷樋 +シキヒラ 敷平 +シキヒロ 敷広 +シキブ 式部 +シキブ 色部 +シキベ 式部 +シキマチ 式町 +シキマチ 敷町 +シキミ 式見 +シキミ 食見 +シキミ 色見 +シキミヤ 敷宮 +シキムラ 敷村 +シキムラ 式村 +シキムラ 鋪村 +シギムラ 鴫村 +シキモト 敷本 +シキモト 色本 +シキモト 式本 +シギモト 鴫本 +ジキモト 直本 +シキモリ 式守 +シキモリ 式森 +シキモリ 飾森 +シキヤ 志喜屋 +シキヤ 敷矢 +シキヤ 鋪屋 +シキヤ 鋪谷 +シギヤ 鴫谷 +シキヤマ 敷山 +シギヤマ 鴫山 +ジキュウ 自休 +シキョウ 止境 +シキョウ 四鏡 +シギョウ 執行 +シギョウ 志行 +シギョウ 執業 +ジキョウ 治京 +ジギョウ 地行 +シキリ 仕切 +ジギリ 地切 +シク 珠玖 +シク 志久 +ジク 竺 +ジグ 地倶 +シクウ 司空 +ジクカワ 竺川 +ジクゾノ 軸園 +ジクゾノ 軸薗 +シグタ 四宮田 +シクタニ 宿谷 +ジクタニ 軸谷 +シグチ 司口 +ジグチ 地口 +シクナイ 志久内 +ジクナガ 竺長 +シクナミ 宿波 +シクノ 宿野 +ジクハラ 竺原 +ジクハラ 軸原 +シクボ 志久保 +シクボ 志窪 +シクボウ 宿坊 +シクマ 志熊 +シクマ 四熊 +シクマ 志久間 +シグマ 志熊 +シグマ 四熊 +シグマ 雌熊 +ジクマエ 次久前 +ジクマル 軸丸 +ジクマル 治久丸 +ジクミ 軸見 +シクヤ 宿谷 +ジクヤ 軸屋 +シクラ 四倉 +シクラ 志倉 +シクラ 四蔵 +シクラ 紫倉 +シクラ 四藏 +シグラ 志倉 +シグラ 四蔵 +シクリ 宿利 +シクリ 宿里 +ジクリ 地久里 +シグレ 時雨 +シグロ 仕黒 +シクワ 宿輪 +シケ 四家 +シケ 志家 +シゲ 重 +シゲ 茂 +シゲ 繁 +ジケ 寺家 +ジケ 地家 +ジケ 持家 +ジゲ 地下 +ジゲ 地家 +ジゲ 治下 +シゲイ 重井 +シゲイ 繁井 +シゲイ 茂井 +シゲイ 滋井 +ジケイ 寺境 +シゲイエ 重家 +シゲイエ 繁家 +シゲイシ 重石 +シゲイシ 繁石 +シゲイズミ 茂泉 +シゲイズミ 重泉 +シゲイズミ 繁泉 +シゲイナ 重稲 +シゲイネ 重稲 +シゲイリ 重入 +シゲイワ 重岩 +シゲイワ 茂岩 +シゲウチ 茂内 +シゲウチ 重内 +シゲウチ 繁内 +シゲウラ 重浦 +シゲウラ 茂浦 +シゲウラ 繁浦 +シゲエ 重江 +シゲエダ 重枝 +シゲオ 木尾 +シゲオ 繁尾 +シゲオ 重尾 +シゲオ 茂尾 +シゲオカ 重岡 +シゲオカ 繁岡 +シゲオカ 茂岡 +シゲオカ 滋岡 +シゲオミ 重臣 +シゲガキ 茂垣 +シゲカネ 重兼 +シゲカネ 重金 +シゲカネ 茂兼 +シゲカミ 重神 +シゲカミ 重上 +シゲカワ 重川 +シゲカワ 茂川 +シゲカワ 重河 +シゲカワ 菁川 +シゲキ 茂木 +シゲキ 重木 +シゲキ 繁木 +シゲキ 繁芸 +シゲキ 繁藝 +シゲキヨ 重清 +シゲキヨ 茂清 +シゲクサ 重草 +シゲクニ 重国 +シゲクニ 重國 +シゲクニ 繁国 +シゲクニ 繁國 +シゲクラ 重倉 +シゲクラ 茂倉 +シゲクラ 繁倉 +シゲコシ 重越 +シゲサカ 重坂 +シゲサカ 重阪 +シゲサキ 茂崎 +シゲサキ 重崎 +シゲザキ 茂崎 +シゲザキ 重崎 +シゲザキ 繁崎 +シゲサコ 重迫 +シゲサダ 重定 +シゲサダ 繁定 +シゲサト 重里 +シゲザネ 重実 +シゲザネ 重實 +シゲサワ 繁沢 +シゲサワ 重沢 +シゲサワ 繁澤 +シゲサワ 重澤 +シゲサワ 滋沢 +シゲサワ 滋澤 +シゲザワ 繁沢 +シゲザワ 重沢 +シゲザワ 繁澤 +シゲザワ 重澤 +シゲザワ 滋澤 +シゲジ 繁治 +シゲシタ 重下 +シゲシタ 繁下 +シゲシタ 茂下 +シゲシマ 重島 +シゲシマ 茂島 +シゲシマ 重嶋 +シゲジマ 重嶋 +シゲシロ 重城 +シゲシロ 重白 +シゲス 重巣 +シゲスエ 重末 +シゲスエ 茂末 +シゲスギ 重杉 +シゲスミ 重住 +シゲズミ 重住 +シゲズミ 茂角 +シゲズミ 繁住 +シゲソウ 重僧 +シゲゾノ 重薗 +シゲゾノ 重園 +シゲタ 重田 +シゲタ 繁田 +シゲタ 茂田 +シゲタ 滋田 +シゲタ 重太 +シゲタ 茂太 +シゲタ 繁多 +シゲダ 重田 +シゲダイ 重台 +シゲタカ 重高 +シゲタカ 繁高 +シゲタケ 繁竹 +シゲタケ 重竹 +シゲタケ 重武 +シゲタテ 重立 +シゲタテ 蕃建 +シゲタニ 重谷 +シゲタニ 茂谷 +シゲタニ 新家谷 +シゲタニ 繁谷 +シゲタニ 新行谷 +シゲタルイ 重垂井 +シゲチ 重地 +シゲチ 茂地 +シゲチ 繁地 +シゲチカ 重近 +シゲチカ 重親 +シゲツ 重津 +シゲツ 指月 +シゲツカ 重塚 +シゲツグ 重次 +シゲツナ 重綱 +シゲツネ 重常 +シゲツボ 重坪 +シゲツラ 重面 +シゲト 重藤 +シゲト 茂渡 +シゲト 繁戸 +シゲト 重戸 +シゲド 重土 +シゲトウ 重藤 +シゲトウ 茂藤 +シゲトウ 繁藤 +シゲトウ 重頭 +シゲトウ 重東 +シゲドウ 重藤 +シゲトク 重徳 +シゲトシ 重歳 +シゲトシ 重利 +シゲトシ 重年 +シゲトミ 重富 +シゲトミ 重冨 +シゲトミ 重留 +シゲトミ 繁富 +シゲトミ 繁冨 +シゲトミ 茂富 +シゲトミ 滋富 +シゲドミ 重富 +シゲドミ 重冨 +シゲトメ 重留 +シゲドメ 重留 +シゲトモ 重友 +シゲトモ 繁友 +シゲトモ 重共 +シゲトモ 茂友 +シゲトヨ 重豊 +シゲナイ 茂内 +シゲナカ 重中 +シゲナカ 茂中 +シゲナカ 繁中 +シゲナガ 重永 +シゲナガ 繁永 +シゲナガ 重水 +シゲナガ 重長 +シゲナガ 茂永 +シゲナガ 重命 +シゲナミ 繁浪 +シゲナミ 重並 +シゲナミ 重南 +シゲナリ 重成 +シゲナリ 茂成 +シゲナリ 繁成 +シゲナリ 茂業 +シゲナリ 薫成 +シゲナワ 繁縄 +シゲナワ 繁繩 +シゲネ 重根 +シゲノ 重野 +シゲノ 茂野 +シゲノ 滋野 +シゲノ 繁野 +シゲノ 重乃 +シゲノ 滋埜 +シゲノイ 滋井 +シゲノイ 滋野井 +シゲノキ 重軒 +シゲノブ 重信 +シゲノブ 重延 +シゲノブ 繁延 +シゲノブ 繁信 +シゲノヤ 繁野谷 +シゲノリ 重乗 +シゲノリ 重則 +シゲハシ 重橋 +シゲハタ 重畠 +シゲハタ 繁畑 +シゲハタ 重畑 +シゲハタケ 重畠 +シゲハマ 重浜(重濱) +シゲバヤシ 茂林 +シゲバヤシ 重林 +シゲハラ 茂原 +シゲハラ 重原 +シゲハラ 繁原 +シゲハラ 樸原 +シゲハリ 繁張 +シゲハル 重春 +シゲヒサ 重久 +シゲヒサ 茂久 +シゲヒラ 重平 +シゲヒラ 繁平 +シゲヒロ 重広 +シゲヒロ 重弘 +シゲヒロ 重廣 +シゲフク 重福 +シゲフク 茂福 +シゲフサ 重房 +シゲフジ 重藤 +シゲフジ 茂藤 +シゲフジ 繁藤 +シゲブチ 重淵 +シゲブチ 重渕 +シゲベ 重部 +シゲホ 繁保 +シゲマ 志慶真 +シゲマ 重間 +シゲマ 志慶眞 +シゲマサ 重政 +シゲマサ 繁昌 +シゲマサ 繁政 +シゲマサ 重正 +シゲマシ 重増 +シゲマス 繁桝 +シゲマス 重舛 +シゲマス 重益 +シゲマス 繁益 +シゲマス 重増 +シゲマス 重桝 +シゲマタ 茂又 +シゲマツ 重松 +シゲマツ 繁松 +シゲマツ 茂松 +シゲマツ 滋松 +シゲマル 重丸 +シゲミ 重見 +シゲミ 茂見 +シゲミ 重実 +シゲミ 茂美 +シゲミ 重美 +シゲミ 繁見 +シゲミ 繁実 +シゲミ 繁實 +シゲミズ 重水 +シゲミズ 繁水 +シゲミチ 重道 +シゲミチ 繁道 +シゲミツ 重光 +シゲミツ 重満 +シゲミツ 繁光 +シゲミツ 重三 +シゲミツ 重充 +シゲミヤ 繁宮 +シゲミヤ 重宮 +シゲミヤ 茂宮 +シゲムネ 重宗 +シゲムネ 重棟 +シゲムネ 繁宗 +シゲムラ 重村 +シゲムラ 茂村 +シゲムラ 繁村 +ジケムラ 寺家村 +シゲモ 重茂 +シゲモチ 重用 +シゲモト 重本 +シゲモト 重元 +シゲモト 繁本 +シゲモト 茂本 +シゲモト 繁元 +シゲモト 茂元 +シゲモト 滋元 +シゲモト 蕃本 +シゲモリ 重森 +シゲモリ 重盛 +シゲモリ 茂森 +シゲモリ 繁森 +シゲモリ 薫森 +シゲモリ 藩守 +シゲモリ 重守 +シゲヤ 重谷 +シゲヤ 茂谷 +シゲヤ 繁谷 +ジケヤ 寺家谷 +シゲヤス 重安 +シゲヤス 重康 +シゲヤス 重保 +シゲヤス 繁安 +シゲヤマ 重山 +シゲヤマ 茂山 +シゲヤマ 繁山 +シゲヤマ 滋山 +シゲユキ 重行 +シゲユキ 繁行 +シゲユキ 重之 +シゲヨシ 重吉 +シゲヨシ 繁吉 +シゲヨシ 重儀 +シゲヨシ 重好 +シゲヨシ 重芳 +シゲヨシ 繁好 +シゲヨシ 茂好 +シゲヨシ 茂由 +シゲリ 重里 +シゲリ 茂利 +シゲリ 繁里 +シゲリ 茂里 +シゲリキ 重力 +シゲリマツ 茂り松 +シゲル 茂 +シゲル 繁 +シゲワカ 重若 +シケン 四間 +ジケン 自見 +ジゲン 自見 +ジゲン 地現 +ジゲン 慈眼 +シケンチョウ 四間丁 +シケンハラ 志堅原 +シケンバラ 志堅原 +シケンバル 志堅原 +シケンマチ 四軒町 +シケンヤ 四軒家 +シコ 仕子 +シコ 司子 +シコ 志子 +ジコ 児子 +ジゴ 地後 +シコウ 志幸 +シコウ 仕幸 +シゴウ 紫合 +ジコウ 慈幸 +ジコウ 寺光 +ジコウ 時耕 +ジコウ 地幸 +ジコウジ 慈光寺 +シゴカ 新後閑 +シコク 四国 +シコク 四國 +シコク 紫谷 +シゴク 至極 +ジコク 地石 +シコシ 四越 +シコタ 志子田 +シコタ 志小田 +シコダ 志子田 +シコダ 志小田 +シコチャ 醜茶 +シコネ 重根 +シゴノサコ 志後野迫 +シコロ 真路 +シコロヤマ 錣山 +シサ 志佐 +シサイ 志斎(志齋) +シサイ 志済(志濟) +シサイ 志斉 +シサイ 志齊 +ジサイ 地斎 +ジサイ 持斎 +ジサイ 持齋 +ジサイ 持斉 +ジサイ 地斉 +ジサイ 地齋 +ジザイ 自在 +シサイケ 志佐池 +シサイタニ 四斎谷 +シサイタニ 四斉谷 +シサイタニ 四齊谷 +ジザイマル 自在丸 +シサカ 四坂 +シザカ 獅坂 +ジサカ 地阪 +ジサカ 地坂 +シザキ 指崎 +シザキ 志崎 +ジサキ 地崎 +シサク 四作 +シサワ 志沢 +シサワ 志澤 +シサワ 宍粟 +シザワ 志沢 +シザワ 志澤 +シザワ 始沢 +シザワ 始澤 +シザワ 四沢 +シザワ 四澤 +ジザワ 次沢 +ジザワ 次澤 +シシ 獅子 +シジ 志治 +シジ 志道 +シジ 志字 +シジ 志次 +シジ 志冶 +ジシ 地子 +ジシ 慈氏 +シシイ 宍井 +シシイ 獅子井 +シシイ 完井 +シシイシ 猪石 +シシウチ 獅子内 +シシウチ 猪内 +シシウチ 鹿討 +シシウラ 宍浦 +シシオウ 獅子王 +シシオカ 完岡 +シシカ 師子鹿 +シシカ 獅々鹿 +シシガ 獅々賀 +シシガ 完賀 +シシカイ 宍甘 +シシカイ 完甘 +シシガイ 宍甘 +シシガイ 宍貝 +シシガセ 鹿ケ瀬 +シシカド 師子角 +シシキ 志々木 +シシキ 宍木 +シジキ 志自岐 +シジキ 志食 +シジキ 志々岐 +ジシキュウ 地子給 +シシキリ 猪切 +シシク 獅子吼 +シシクイ 鹿喰 +シシクイ 宍喰 +シシグチ 獅子口 +シシクノ 宍喰野 +シシクラ 宍倉 +シシクラ 猪倉 +シシクラ 獅子倉 +シシクラ 完倉 +シシクラ 肉倉 +シシクラ 獅倉 +シシクラ 猊倉 +シシクラ 獅々倉 +シシコ 宍籠(宍篭) +シシコミ 猪込 +シシゴミ 猪込 +シシザキ 獅子崎 +シシジマ 獅子島 +シシジマ 獅々島 +シシダ 猪田 +シシダ 宍田 +シシダ 志々田 +シシダ 獅子田 +シシダ 完田 +シシダ 獅々田 +シシダ 師資田 +シシダ 獅田 +シシダ 師々田 +ジシタ 地下 +シシタニ 猪谷 +シシタニ 獅子谷 +シシタニ 獅々谷 +シシツカ 宍塚 +シシツグ 宍継 +シシト 宍戸 +シシド 宍戸 +シシド 完戸 +シシド 完土 +シシド 猪戸 +シシド 獅々戸 +シシド 穴戸 +シシド 獅戸 +シシド 獅子戸 +シシド 宍土 +シシドウ 宍道 +シシドウ 獅子堂 +シシドウ 鹿道 +シシドウ 師子堂 +シシトモ 獅々友 +シシナイ 獅子内 +シシナイ 獅々内 +シシナシ 犱梨 +シシノ 宍野 +シシノ 獅子野 +シシノ 獅野 +シシノ 穴野 +シシノ 師子野 +シシバ 紫芝 +シシバ 志々場 +シシバ 神々𢌞 +シシハタ 獅畑 +シシハナ 猪鼻 +シシハラ 獅子原 +シシハラ 獅々原 +シシベ 猪部 +シジボ 四十坊 +シシボリ 獅々堀 +シシボリ 獅子堀 +シシボリ 獅々掘 +シシマ 四島 +シシマ 四嶋 +シシマ 紫島 +シジマ 四十万 +シジマ 四島 +シジマ 四嶋 +ジシマ 治島 +シジマヤ 四十万谷(四十萬谷) +シシミ 志々見 +シシミ 獅々見 +シジミ 蜆 +シシミネ 獅峰 +シシミネ 獅峯 +シシムラ 宍村 +シシムロ 宍室 +シシメ 志々目 +シシメ 獅子目 +シシメ 志志目 +シシモト 四至本 +シシモト 志師本 +シシモト 獅子元 +シシャ 師社 +シシャ 四車 +シシャ 志社 +シシヤ 猪谷 +シシヤ 獅子谷 +ジシャ 寺社 +ジシャ 次社 +シシャク 四尺 +ジシャゲ 寺社下 +シシヤマ 獅子山 +シシヤマ 獅山 +シジュ 志受 +シジュ 志寿 +シジュウ 四十 +ジシュウ 地衆 +ジジュウ 次重 +シジュウイ 四十井 +シジュウク 四十九 +シジュウタニ 四十谷 +シジュウヅカ 四十塚 +シジュウボウ 四十坊 +シジュウヤマ 四十山 +シジョウ 四條 +シジョウ 四条 +シジョウ 司城 +シジョウ 四篠 +シジョウ 志条 +ジショウ 慈性 +ジショウ 自生 +ジショウ 地庄 +シジラヤ 縬屋 +ジシロ 地白 +ジジワ 時々輪 +ジジワ 治々和 +ジシン 自信 +シズ 静 +シズ 志津 +シズ 志都 +シスイ 泗水 +シズイ 静井 +シズイ 閑井 +シズイ 静居 +シズイ 靜井 +シズイシ 清水石 +シズウチ 静内 +シズウチ 雫内 +シズウラ 静浦 +シズオカ 静岡 +シズカ 静 +シズカ 閑 +シズカ 靜 +シズガ 静賀 +シズカイ 静井 +シズガミ 清水上 +シズカワ 静川 +シズカワ 賎川 +シズカワ 雫川 +シズカワ 靜川 +シズキ 志築 +シズキ 静木 +シズキ 志津城 +シズク 雫 +シズクイシ 雫石 +シズクサ 滴草 +シズクダ 雫田 +シズサワ 沈沢 +シズシマ 静島 +シズタ 志津田 +シズタ 鎮田 +シズタ 静田 +シズタニ 静谷 +シズタニ 鎮谷 +シズナガ 静永 +シズナガ 靜永 +シズナミ 鎮波 +シズナミ 静波 +シズノ 静野 +シズノ 閑野 +シズノ 志津野 +シズノ 鎮野 +シズノ 閉野 +シズノ 鎭野 +シズノ 靜野 +シズハタ 賎機 +シズハタ 賤機 +シズハタ 志豆機 +シズハタ 鎮籏 +シズハラ 静原 +シズハラ 鎮原 +シズマ 静間 +シズマ 四十万 +シズマ 志津馬 +シズマ 靜間 +シズマ 静馬 +シスミ 四住 +シズミ 志積 +シズミ 静海(靜海) +シズミ 静観 +シズミ 靜観 +シズミツ 静光 +シズムラ 清水村 +シズムラ 静村 +シズメ 鎮目 +シズメ 鎭目 +シズメ 鎮 +シズメ 靜目 +シズモト 静本(靜本) +シズモリ 静森 +シズヤ 静谷 +シズヤ 静屋 +シズヤ 靜家 +シズヤ 靜谷 +シズヤマ 鎮山 +シズヤマ 静山 +シズリ 志津里 +シズリ 静里 +シセ 至勢 +シセイ 至勢 +シセイ 四静 +シセキ 始関 +シセキ 四関 +シセキ 志関 +シセキ 紫関 +シセキ 司関 +シセキ 司跡 +シセキ 柴関 +シセン 志泉 +シゼン 紫前 +シゼン 自然 +ジゾウ 地蔵 +ジゾウ 地造 +ジゾウ 地藏 +ジゾウドウ 地蔵堂 +ジゾウドウ 地藏堂 +ジゾウハラ 地蔵原 +ジゾウバラ 地蔵原 +ジゾウモト 地蔵本 +ジゾウヤマ 地蔵山 +ジソジ 二十二 +シソン 志尊 +シタ 志多 +シタ 舌 +シダ 志田 +シダ 信田 +シダ 信太 +シダ 次田 +シダ 至田 +シダ 師田 +シダ 四田 +シダ 志太 +シダ 志多 +シダ 仕田 +シダ 飼田 +シダ 歯朶 +シダ 司田 +シダ 史陀 +シダ 支田 +ジタ 治田 +ジダ 治田 +シダイ 司代 +ジダイ 地代 +ジダイ 地大 +ジダイショ 地代所 +シタイダ 下井田 +シタウチ 下内 +シタウツボ 下苧坪 +シタウツボ 下荢坪 +シタウツボ 下𡧃坪 +シタウネ 下畦 +シタウネ 下采 +シタウラ 下浦 +シタエゴ 下江後 +シタエダ 下枝 +シタエビス 下夷 +シタオ 下尾 +シダオ 歯朶尾 +シダオ 志田尾 +シタオイ 下老 +シタオオゾノ 下大薗 +シタオオボラ 下大洞 +シタオカ 下岡 +シダオカ 志田岡 +シタオコシ 下起 +シタカ 志鷹 +シタガウチ 下垣内 +シタガキ 下垣 +シタカキウチ 下垣内 +シタカジ 下梶 +シタカタ 下方 +シタガミ 下神 +シタガミ 下上 +シダカミ 志田上 +シタカワ 下川 +シタガワ 下川 +シタカワチ 下河内 +シタカワラ 舌川原 +シタキ 下木 +シタキ 志多木 +シタク 四宅 +シタグイ 胡 +シタクボ 下久保 +シタクボ 下窪 +シタクモ 下雲 +シタクラ 下倉 +シタクラ 下蔵 +シタクリ 下栗 +シタグロ 下黒 +シタサカ 下坂 +シタサキ 舌崎 +シタザキ 下崎 +シタザキ 舌崎 +シタサコ 下迫 +シタシオミ 下塩見 +シタシオミ 下汐見 +シタシキ 下舗 +シタシゲ 下重 +シタジッコク 下拾石 +シタシバ 下柴 +シタシマ 下島 +シタシマ 下嶋(下嶌) +シタジマ 下島 +シタジマ 下嶋(下嶌) +シタシミズ 下清水 +シタシモ 下霜 +シタショウ 下正 +シタシロ 下城 +シタスエ 下末 +シタソネ 下曽根 +シタダ 下田 +シタダ 志多田 +シタタカラ 下宝(下寶) +シタタニ 下谷 +シタダニ 下谷 +シタチ 下知 +シダチ 志立 +シタツ 四達 +シダツ 志達 +シタツボ 下坪 +シタテ 仕立 +シタテ 志立 +シタテ 仕舘 +シタテ 仕館 +シタテ 士堅 +シタテ 士竪 +シタデ 下出 +シタデラ 下寺 +シタトク 下徳 +シタナカ 下中 +シタナカ 下仲 +シタナカ 仕田中 +シタニ 四谷 +シタニ 志谷 +シダニ 四谷 +ジタニ 自谷 +シタニシ 下西 +シタノ 下野 +シタノ 志多野 +シタノ 舌野 +シダノ 志田野 +シタノマ 下野間 +シタバ 下羽 +シタバ 志太波 +シタバ 下場 +シタバ 舌歯 +シタハク 志多伯 +シタハシ 下橋 +シタバタケ 下畠 +シタハネ 下刎 +シタババ 下馬場 +シタハマ 下浜 +シタバヤシ 下林 +シタハラ 下原 +シダハラ 志田原 +シダハラ 仕田原 +シダハラ 歯朶原 +シダハラ 䒳原 +シタバライ 下払 +シタバライ 下拂 +シタヒガシ 下東 +シタヒラ 下平 +シタフジ 下藤 +シダフジ 志田藤 +シタベツ 下別 +シタボ 下保 +シタボウ 下坊 +シタボウ 下防 +シタボウジ 下房地 +シタホド 下程 +シタホラ 下洞 +シタホリ 下堀 +シタボリ 下堀 +シタマ 舌間 +シダマ 師玉 +シタマエ 下前 +シタマチ 下町 +シタマツ 下松 +シタマヤマ 下間山 +シタミ 下見 +シタミ 志民 +シタミ 下美 +シタミガワ 下見川 +シタミセ 下見世 +シタミゾ 下溝 +シタミチ 下道 +シタミツ 下光 +シタミツ 下満(下滿) +シタミヤ 下宮 +シタムカイ 下向 +シタムカイ 下向井 +シタムラ 下村 +シタムラ 下タ村(タはカタカナ) +シタムラ 下多村 +シタムラ 下夕村(夕は漢字) +シタモト 下元 +シタモト 下本 +シタモリ 下森 +シタヤ 下谷 +シタヤ 下家 +シタヤ 下屋 +シタヤシキ 下屋敷 +シタヤシキ 下屋鋪 +シタヤスンバ 下休場 +シタヤナギ 下柳 +シタヤブ 下薮 +シタヤブ 下藪 +シタヤマ 下山 +シダヤマ 志田山 +シダヤマ 歯朶山 +シタラ 設楽 +シタラ 設樂 +シダラ 設楽 +シダラ 設樂 +シダラク 設楽 +シタレ 四垂 +シダレ 四垂 +シタワキ 下脇 +シダワラ 四俵 +シダワラ 志俵 +シタン 士反 +シタン 四丹 +シタン 土反 +ジダンジ 自檀地 +シタンダ 四反田 +シチ 志知 +シチ 志智 +ジチ 慈地 +ジチ 茲地 +シチイエ 七家 +シチウミ 七海 +シチカショ 七ケ所 +シチカド 七角 +シチカワ 七川 +シチカワ 七河 +シチク 七宮 +シチク 紫竹 +シチク 志築 +シチグ 七宮 +シチクラ 七倉 +シチクロ 七黒 +シチケン 七間 +シチケン 七軒 +シチゲン 七間 +シチザ 七座 +シチサワ 七澤 +シチザワ 七沢 +シチザワ 七澤 +シチジ 七字 +シチシマ 七島 +シチジマ 志知島 +シチシャ 七社 +シチジュウガリ 七十刈(七十苅) +シチジョウ 七條 +シチジョウ 七条 +シチジョウ 七丈 +シチジョウ 七帖 +シチジョウ 七絛 +シチタ 七田 +シチダ 七田 +シチタカ 七高 +シチタケ 七竹 +シチタニ 七谷 +シチド 七度 +シチドウ 七堂 +シチトク 七徳 +シチナミ 七波 +シチノ 七野 +シチノウ 七納 +シチノヘ 七戸 +シチノミヤ 七宮 +シチハラ 七原 +シチヒョウ 七俵 +シチブ 七分 +シチベ 七辺(七邊) +シチホ 七歩 +シチホウ 七宝(七寳) +シチミ 七海 +シチミ 七味 +シチミヤ 七宮 +シチメキ 七目木 +シチヤマタニ 七山谷 +シチヤマヤ 七山谷 +ジチュウ 寺中 +シチリ 七里 +シチリ 七理 +シチリ 七利 +シチリョウガワ 七良川 +シチリョウサコ 七良浴 +シチルイ 七類 +シチロ 七呂 +シチロウマル 七郎丸 +シチロサコ 七良浴 +シヅ 志津 +ジツ 実 +ジツ 實 +ジツイ 実井 +ジツイ 實井 +ジツイキ 日域 +ジツイシ 実石 +ジツイシ 實石 +シツオ 失尾 +ジツオカ 実岡 +ジツオカ 實岡 +シヅカ 志塚 +ジツガキ 実柿 +シッカケ 尻懸 +ジツカタ 実方 +ジツカタ 實方 +ジツカタ 実形 +ジツカタ 實形 +ジツカネ 実兼 +ジツカネ 實兼 +シツカワ 後川 +シツカワ 漆川 +シヅカワ 志津川 +ジツカワ 実川 +ジツカワ 實川 +シツキ 志築 +シヅキ 志築 +シヅキ 志筑 +シヅキ 志津木 +シヅキ 志月 +ジツキ 実木 +ジヅキ 地搗 +ジヅキ 地附 +ジツギリ 実桐 +ジツギリ 實桐 +シヅク 志築 +シヅク 志筑 +ジツクニ 実国(實國) +ジツクマ 実熊(實熊) +ジツゲツ 日月 +ジッコイ 執行 +シッコウ 執行 +ジッコウ 執行 +ジッコウ 実光 +ジッコウ 實光 +ジッコク 十石 +シツザキ 漆崎 +ジツザキ 実崎 +ジツザキ 實崎 +ジツザワ 実沢(實澤) +ジツシタ 実下(實下) +ジッショウ 実正 +ジッショウ 實正 +ジツスエ 実末(實末) +ジッソウ 実相 +ジッソウイン 実相院 +ジッソウジ 実相寺 +シッタ 悉陀 +シツタ 志津田 +シヅタ 志津田 +シヅタ 士津田 +ジッタ 実田 +ジッタ 實田 +ジツタ 実田 +ジツタ 實田 +ジツダ 実田 +ジツダ 實田 +シツタカ 室高 +ジッタニ 実谷 +ジッタニ 實谷 +ジツタニ 実谷 +ジツタニ 實谷 +シッチ 悉知 +シッチ 出地 +シッチ 悉地 +ジツチカ 実近 +ジツヅミ 実積 +シットウ 出頭 +シツトウ 出頭 +ジットウ 実藤 +ジットウ 実藤 +ジットウ 實藤 +ジットウ 実透 +ジツトウ 實藤 +ジツトウ 実籐(實籐) +ジットク 十徳 +ジツトシ 実歳 +ジツトシ 実才 +ジツトシ 實歳 +ジツナリ 実成 +ジツナリ 實成 +シヅノ 志津野 +ジツノ 実野 +ジツノ 實野 +ジツノブ 実延 +ジツノブ 實延 +ジツハラ 実原 +ジツハラ 實原 +ジツヒサ 実久 +ジツヒサ 實久 +ジツヒラ 実平 +ジツヒラ 實平 +ジツヒロ 実広 +ジツヒロ 實廣 +ジツフジ 実藤 +ジツフジ 實藤 +ジツフチ 實渕 +シツボ 士坪 +シツボ 志坪 +シッポウ 七宝(七寳) +ジッポウ 実宝(實寳) +ジッポウ 実法 +ジッポウイン 実法院(實法院) +シヅマ 志津馬 +シヅマ 靜間 +シヅマ 志津間 +ジツマサ 実政 +ジツマサ 實政 +ジツマツ 実松 +ジツマツ 實松 +ジツマル 実丸 +シツミ 七海 +シヅミ 志積 +ジツミツ 実光 +ジツミツ 實光 +ジツミヤ 実宮 +ジツムラ 実村 +ジツムラ 實村 +ジツムラ 実邑 +シヅメ 鎮目 +ジツモト 実本 +ジツモト 實本 +ジツモリ 実森 +ジツモリ 実盛 +ジツモリ 実守(實守) +ジツモリ 實森 +ジツモリ 實盛 +ジツヤス 実安 +ジツヤス 實安 +ジツヤマ 実山 +ジツヤマ 實山 +ジツヨシ 実吉 +ジツヨシ 實吉 +シヅリ 志津里 +シヅリ 志津利 +シヅル 志鶴 +シテ 志手 +シデ 志手 +シデ 幣(弊) +シデ 茲出 +シデ 幤 +シデ 四手 +シデ 志出 +シテイ 四手井 +シデイ 四手井 +シデノウチ 幣ノ内 +シデハラ 幣原 +シデモリ 志手盛 +シデモリ 肆手盛 +ジテン 地天 +シト 志渡 +シト 四斗 +シド 四戸 +シド 志戸 +シド 志渡 +シド 志度 +シド 四度 +ジト 地戸 +ジドイ 地土井 +シトウ 紫藤 +シトウ 市東 +シトウ 志藤 +シトウ 紫桃 +シトウ 師藤 +シトウ 四藤 +シトウ 司東 +シトウ 仕藤 +シトウ 刺刀 +シトウ 至当 +シトウ 四籐 +シトウ 志籐 +シトウ 柴桃 +シドウ 紫藤 +シドウ 志藤 +シドウ 志道 +シドウ 師藤 +シドウ 四藤 +シドウ 宍粟 +シドウ 仕道 +シドウ 四道 +シドウ 四堂 +シドウ 子道 +シドウ 志籐 +ジトウ 次藤 +ジトウ 地頭 +ジトウ 地藤 +ジトウ 慈道 +ジトウ 治藤 +ジトウ 地当(地當) +ジドウ 慈道 +ジドウ 地堂 +ジトウエ 地頭江 +シドウジ 四童子 +シドウジ 志堂寺 +ジトウショ 地頭所 +ジドウショ 地頭所 +ジトウソノ 地頭薗 +ジトウソノ 地頭園 +ジトウゾノ 地頭薗 +ジトウゾノ 地頭園 +ジドウゾノ 地頭薗 +ジトウダイ 地頭代 +ジトウホウ 地頭方 +シトオカ 志戸岡 +シドオカ 志戸岡 +シドオカ 志渡岡 +シトギ 粢 +シトキシ 四戸岸 +シトギシ 四戸岸 +シトキデン 粢田 +シトギデン 粢田 +シトク 四徳 +ジトク 地徳 +ジトク 治徳 +ジトク 自徳 +シトザワ 志渡沢 +シトザワ 志渡澤 +シドザワ 志度沢 +シトダ 志戸田 +シドタニ 志度谷 +シドチ 志土地 +シトト 一青 +シトトミ 志土富 +シトベ 四斗辺 +シトベ 四斗邊 +ジトホウ 地頭方 +シトマ 志苫 +シトマ 志戸摩 +シトマエ 志戸前 +シトミ 蔀(篰) +シトミ 志富 +シトミ 侍留 +シトミ 四富(四冨) +シトミ 志冨 +シドミ 蔀(篰) +シトモト 志戸本 +シドモト 志戸本 +シトリ 倭文 +シトリ 志鳥 +シトリ 委文 +シドリ 倭文 +シドリ 志鳥 +シドリ 委文 +シナ 階 +シナ 四七 +シナ 志奈 +シナ 品 +シナイ 品居 +シナウチ 科内 +シナエ 品衛 +シナオ 志直 +シナオ 品尾 +シナオカ 品岡 +シナオカ 等岳 +シナガセ 品ケ瀬 +シナカワ 品川 +シナガワ 品川 +シナガワ 信川 +シナキ 品木 +シナクサ 品草 +シナグチ 品口 +シナザワ 品沢 +シナザワ 品澤 +シナザワ 科沢(科澤) +シナシ 尻無 +シナジ 品治 +シナジ 品地 +シナシハマ 尻無浜 +シナシハマ 尻無濱 +シナスエ 品末 +シナズガワ 不死川 +シナズミ 品角 +シナタ 品田 +シナタ 科田 +シナダ 笹田 +シナダ 品田 +シナダ 信田 +シナダ 科田 +シナタケ 品竹 +シナタニ 品谷 +シナダニ 品谷 +シナタマ 品玉 +シナダマ 品玉 +シナチ 品地 +シナト 階戸 +シナノ 信濃 +シナノ 信野 +シナノ 品野 +シナノ 科野 +シナノ 仕名野 +シナノ 科埜 +シナノ 信乃 +シナノガワ 信濃川 +シナノコウジ 信濃小路 +シナノヤ 信濃屋 +シナハマ 尻無浜 +シナハマ 尻無濱 +シナハラ 品原 +シナハル 品治 +シナヒラ 品平 +シナベ 品部 +シナベ 科部 +ジナボウ 地名坊 +シナホリ 品堀 +シナミ 志波 +シナミ 志並 +シナミ 志浪 +シナムラ 品村 +シナモト 品本 +シナヤ 品矢 +シナヤマ 品山 +シナワキ 品脇 +シナワタリ 品渡 +シナンタニ 指南谷 +ジニシ 地西 +ジヌシ 地主 +ジヌシゾノ 地主園 +ジネダ 治根田 +シネハ 標葉 +ジネン 自念 +シノ 小竹 +シノ 柴野 +シノ 篠 +シノ 志野 +シノ 示野 +シノ 士野 +シノ 四野 +シノ 止野 +シノ 紫野 +シノ 志埜 +シノ 筱 +シノ 史野 +シノ 紫乃 +ジノ 地野 +シノアキ 東明 +シノアキ 信明 +シノイ 篠井 +シノイケ 篠池 +シノウ 篠生 +シノウ 柴生 +シノウ 志農 +シノウ 司農 +シノウ 士農 +シノウチ 篠内 +シノウラ 篠浦 +シノエ 四戸 +シノエ 篠江 +シノオ 篠尾 +シノオカ 篠岡 +シノオカ 筱岡 +シノガキ 篠垣 +シノガサワ 篠ケ沢(篠ケ澤) +シノガセ 篠ケ瀬 +シノガミ 篠上 +シノガヤ 篠ケ谷 +シノカワ 篠川 +シノカワ 篠河 +シノキ 椎木 +シノキ 篠木 +シノキ 志貴 +シノキ 志野木 +シノキ 凌木 +シノキ 筿木 +シノギ 篠木 +シノギ 凌 +シノギ 志野木 +シノギ 東鬼 +シノギ 篠儀 +シノキオ 椎木尾 +シノキタ 篠北 +シノグチ 篠口 +シノクボ 忍久保 +シノクボ 篠窪 +シノクマ 篠隈 +シノクマ 篠熊 +シノクラ 篠倉 +シノグリ 篠栗 +シノゴ 篠後 +シノゴウ 篠郷 +シノサカ 篠坂 +シノサキ 篠崎 +シノザキ 篠崎 +シノザキ 信崎 +シノザキ 篠嵜(筱嵜) +シノザキ 志野崎 +シノザキ 篠埼 +シノザキ 忍崎 +シノザキ 筿崎 +シノザキ 蓧崎 +シノザクラ 信桜(信櫻) +シノササ 篠笹 +シノサワ 篠沢 +シノサワ 篠澤 +シノザワ 篠沢 +シノザワ 篠澤 +シノジ 篠地 +シノシタ 篠下 +シノジマ 篠島 +シノジマ 篠嶋 +シノズカ 篠塚 +シノズミ 篠住 +シノセ 篠瀬 +シノタ 篠田 +シノダ 篠田 +シノダ 笹田 +シノダ 信田 +シノダ 信太 +シノダ 忍田 +シノダ 信多 +シノダ 筱田 +シノタケ 篠竹 +シノタニ 篠谷 +シノタニ 忍谷 +シノチ 篠地 +シノツ 篠津 +シノヅ 篠津 +シノツカ 篠塚 +シノヅカ 篠塚 +シノヅカ 士濃塚 +シノツメ 篠爪 +シノヅメ 篠爪 +シノト 篠戸 +シノトウ 篠藤 +シノトウ 篠遠 +シノトオ 篠遠 +シノナガ 篠永 +シノヌマ 篠沼 +シノネ 篠根 +シノノ 篠野 +シノノイ 篠井 +シノノイ 篠之井 +シノノメ 東雲 +シノハ 篠葉 +シノバ 篠場 +シノハタ 篠畑 +シノハタ 篠端 +シノハタ 篠端 +シノバタ 篠畑 +シノハナ 篠花 +シノバヤシ 篠林 +シノハラ 篠原 +シノハラ 信原 +シノハラ 志野原 +シノハラ 筿原 +シノハラ 四ノ原 +シノハラ 志濃原 +シノハラ 筱原 +シノハラ 條原 +シノバラ 篠原 +ジノハラ 次野原 +シノヒラ 篠平 +シノブ 信夫 +シノブ 忍 +シノブ 資延 +シノブ 篠生 +シノブ 筱生 +シノブエ 篠笛 +シノフジ 篠藤 +シノブダニ 忍谷 +シノヘ 四戸 +シノベ 篠部 +シノベ 信部 +シノベ 篠辺 +シノベ 篠邊 +シノベ 篠邉 +シノボリ 四登 +シノマ 篠間 +シノマエ 篠前 +シノマキ 篠巻 +シノマタ 篠又 +シノマチ 篠町 +シノマル 篠丸 +シノミ 四野見 +シノミ 篠見 +シノミヤ 四宮 +シノミヤ 篠宮 +シノミヤ 四ノ宮 +シノミヤ 四之宮 +シノミヤ 四野宮 +シノミヤ 信宮 +シノミヤ 四の宮 +シノムラ 篠村 +シノムラ 篠邨 +シノムラ 志野村 +シノメ 篠目 +シノモト 篠本 +シノモト 篠元 +シノモリ 篠森 +シノヤ 篠谷 +シノヤ 忍谷 +シノヤ 篠矢 +シノヤマ 篠山 +シノワキ 篠脇 +シバ 芝 +シバ 柴 +シバ 榛葉 +シバ 志波 +シバ 斯波 +シバ 司馬 +シバ 志場 +シバ 紫葉 +シバ 紫波 +シバ 司波 +シバ 志葉 +シバ 清波 +シバ 柴葉 +シバ 欺波 +シバ 四葉 +シバ 志羽 +シバ 祇場 +シバアイ 芝合 +シバイ 芝井 +シバイ 柴井 +シバイ 芝居 +シバイ 柴居 +シバイエ 柴家 +シバイケ 芝池 +シバイズミ 柴泉 +シバイチ 芝一 +シバイリ 芝入 +シバイリ 柴入 +シバウ 芝生 +シバウ 柴生 +シバウエ 芝上 +シバウジ 芝氏 +シバウタ 柴生田 +シバウダ 芝生田 +シバウチ 柴内 +シバウチ 芝内 +シバウミ 芝海 +シバウラ 柴浦 +シバウラ 芝浦 +シバエ 柴栄(柴榮) +シバエ 芝江 +シバエ 柴江 +シバオ 柴尾 +シバオ 芝尾 +シバオ 芝生 +シバオ 柴生 +シバオイ 芝生 +シバオカ 柴岡 +シバオカ 芝岡 +シバオク 柴奥 +シバオリ 柴折 +シバカイ 柴海 +シバガキ 柴垣 +シバガキ 芝垣 +シバガキ 柴墻 +シバガサ 柴笠 +シバカド 柴門 +シバカミ 芝上 +シバガミ 芝上 +シバガヤ 柴ケ谷 +シバカリ 柴刈 +シバカリ 柴苅 +シバカワ 柴川 +シバカワ 芝川 +シバキ 柴木 +シバキ 芝木 +シバキ 志葉木 +シバキ 紫木 +シバギシ 芝岸 +シバキタ 柴北 +シバキタ 芝北 +シバキリ 柴切 +シバキリ 芝切 +シバキリ 柴伐 +シバキリ 芝伐 +シハク 志伯 +シハク 志白 +シハク 志羽久 +シバクキ 柴久喜 +シバクサ 柴草 +シバクサ 芝草 +シバクチ 柴口 +シバグチ 芝口 +シバグチ 柴口 +シバクラ 柴倉 +シバクラ 芝倉 +シバクルマ 柴車 +シバコ 柴戸 +シバコウジ 芝小路 +シバコシ 芝越 +シバコヤ 柴小屋 +シバコヤ 柴小谷 +シバサカ 柴坂 +シバサカ 芝坂 +シバサカ 柴阪 +シバサキ 柴崎 +シバサキ 芝崎 +シバサキ 柴嵜 +シバサキ 芝先 +シバサキ 芝嵜 +シバサキ 柴埼 +シバサキ 紫崎 +シバサキ 芝埼 +シバザキ 柴崎 +シバザキ 芝崎 +シバザキ 柴嵜 +シバザキ 芝嵜 +シバサク 柴作 +シバサコ 柴迫 +シバサト 柴里 +シバサワ 柴沢 +シバサワ 柴澤 +シバサワ 芝沢 +シバサワ 芝澤 +シバザワ 柴澤 +シバジ 芝地 +シバジ 柴地 +シバシタ 芝下 +シバシタ 柴下 +シバシマ 柴島 +シバシマ 芝島 +シバジマ 柴島 +シバシロ 柴代 +シバズミ 柴住 +シバセ 柴瀬 +シバセ 芝勢 +シバセキ 芝関 +シハタ 四畑 +シバタ 柴田 +シバタ 芝田 +シバタ 新発田 +シバタ 芝波田 +シバタ 柴多 +シバタ 紫田 +シバタ 司馬田 +シバタ 四馬田 +シバタ 芝多 +シバタ 新發田 +シバダイ 柴代 +シバダイ 柴台 +シバダイ 柴臺 +シバダイラ 柴平 +シバダイラ 芝平 +シバタカ 芝高 +シバタカ 柴高 +シバタカ 芝鷹 +シバタキ 芝滝 +シバタキ 芝瀧 +ジバタケ 地畠 +シバタテ 柴立 +シバタテ 柴建 +シバタニ 柴谷 +シバタニ 芝谷 +シバチ 芝地 +シバツ 柴津 +シバツカ 芝塚 +シバヅカ 芝塚 +シバヅカ 柴塚 +シバツグ 芝嗣 +シバツジ 芝辻 +シバツジ 柴辻 +シバツジ 芝築地 +シバツチ 柴土 +シバツチ 芝土 +シバデ 芝出 +シバト 柴戸 +シバト 芝戸 +シバトウ 柴藤 +シバトウ 芝藤 +シバトウ 芝頭 +シバトウゲ 柴峠 +シバトコ 柴床 +シバトコ 芝床 +シバトミ 柴富 +シバトミ 柴冨 +シバナ 芝名 +シバナイ 柴内 +シバナカ 柴中 +シバナカ 芝中 +シバナガ 柴永 +シバナミ 柴波 +シバニ 柴丹 +シバニシ 芝西 +シバニシ 柴西 +シバヌシ 柴主 +シバヌマ 柴沼 +シバヌマ 芝沼 +シバネ 標葉 +シバネ 芝根 +シバノ 柴野 +シバノ 芝野 +シバノ 紫野 +シバノ 芝埜 +シバノキ 芝軒 +シバハギ 柴萩 +シバハシ 柴橋 +シバハシ 芝橋 +シバハタ 芝端 +シバハタ 芝畑 +シバハナ 芝花 +シバハナ 芝鼻 +シバハナ 柴端 +シバハマ 芝浜 +シババヤシ 柴林 +シババヤシ 芝林 +シバハラ 柴原 +シバハラ 芝原 +シバハラ 志波原 +シバヒキ 柴引 +シバヒキ 紫引 +シバヒラキ 芝開 +シバビラキ 芝開 +シバフ 柴生 +シバフキ 芝吹 +シバブキ 芝吹 +シバフジ 柴藤 +シバフジ 芝藤 +シバフチ 芝淵 +シバブチ 柴渕 +シバブチ 芝淵 +シバブチ 芝渕 +シバベ 柴部 +シバマ 芝間 +シバマ 柴間 +シバマエ 芝前 +シバマタ 柴又 +シバマル 柴丸 +シバマル 芝丸 +シバミチ 柴道 +シバミネ 柴嶺 +シバミネ 芝峰 +シバミネ 柴峰 +シバミネ 柴峯 +シバミヤ 柴宮 +シバミヤ 芝宮 +シバムラ 柴村 +シバムラ 芝村 +シバムラ 柴邨 +シバモト 芝本 +シバモト 柴本 +シバモト 芝元 +シバモト 柴元 +シバモリ 柴森 +シバヤ 柴谷 +シバヤ 芝谷 +シバヤ 柴屋 +シバヤ 柴矢 +シバヤ 芝家 +シバヤシ 斯林 +シバヤナギ 柴柳 +シバヤナギ 芝柳 +シバヤブ 柴薮(柴藪) +シバヤマ 柴山 +シバヤマ 芝山 +シバヤマ 紫山 +シバユキ 柴行 +シバヨシ 芝好 +シハラ 紫原 +シハラ 志原 +シバワカ 柴若 +シバワキ 芝脇 +シヒ 志比 +シビ 紫尾 +シビ 志比 +シヒカワ 志比川 +シビキ 柴引 +ジビキ 地引 +ジビキ 地曳 +ジビキ 地曵 +ジビキ 地挽 +ジビキ 字引 +ジビキ 地疋 +シビタ 紫尾田 +シビタ 志比田 +シビタ 柴尾田 +シヒチ 四七 +シヒナ 志比奈 +シヒャクガリ 四百刈 +シヒャクガリ 四百苅 +シヒャクメ 四百目 +シヒラ 志平 +シヒラ 四平 +ジヒラ 地平 +シフ 志布 +シブ 志部 +シブ 渋(澁) +シブ 志武 +ジブ 治部 +ジブ 治武 +ジブ 地部 +ジブ 次部 +ジブ 地武 +シブアン 渋庵 +シブアン 澁庵 +シブイ 渋井 +シブイ 澁井 +シブイチ 四分一 +シブイチ 渋市 +シブイチ 四歩一 +シブイチ 澁市 +シフウ 志風 +シブウタ 渋生田 +シブエ 渋江 +シブエ 澁江 +シブオ 渋尾 +シブオカ 渋岡 +シブガキ 渋柿(澁柿) +シブカミ 渋紙 +シブカワ 渋川 +シブカワ 澁川 +シブカワ 渋河 +シブキ 渋木 +シブキ 澁木 +ジフク 地福 +ジフク 地布久 +シブクチ 渋口 +シブグチ 渋口(澁口) +シブクラ 渋倉(澁倉) +シブクワ 渋鍬(澁鍬) +シブクワ 渋桑 +シブサ 渋佐 +シブサ 澁佐 +シブサカ 渋坂(澁坂) +シブサワ 渋沢 +シブサワ 渋澤 +シブサワ 澁澤 +シブサワ 澁沢 +シブシ 志布志 +シブシ 渋志 +シブシタ 渋下 +シブシタ 澁下 +シブセ 渋瀬 +シフタ 志冨田 +シブタ 渋田 +シブタ 澁田 +シブタ 志冨田 +シブタ 紫冨田 +シブタ 志富田 +シブタ 紫富田 +シブタ 柴冨田 +ジブタ 治部田 +ジブタ 慈父田 +ジブタ 次部田 +ジブタ 地部田 +シブタケ 渋武 +シブタケ 澁武 +シブタニ 渋谷 +シブタニ 澁谷 +シブタニ 四分谷 +シブタミ 渋田見 +シブタミ 渋民 +シブタミ 澁田見 +シブタレ 渋垂 +シブタレ 澁垂 +シブチ 四渕 +シブチ 四淵 +ジブツ 持仏 +ジブツ 持佛 +シブトウ 渋藤(澁藤) +シブドウ 渋洞 +シブナシ 渋梨子(澁梨子) +シブナシ 渋梨 +シフネ 志船 +シブネ 志船 +シブネ 志舩 +シブノ 渋野 +シブノ 澁野 +ジブノ 治部野 +シブハ 渋葉(澁葉) +シブハラ 渋原 +シブハラ 澁原 +シブヒサ 渋久(澁久) +シブマ 渋間 +シブマ 澁間 +シブムラ 渋村(澁村) +シブヤ 渋谷 +シブヤ 澁谷 +シブヤ 渋屋 +シブヤ 志部谷 +シブヤ 種物谷 +シブヤ 渋矢 +シブヤ 澁屋 +シブヤマ 渋山 +シブヤマ 澁山 +シブロ 澁路(渋路) +シベ 志部 +シベ 志辺 +ジベ 治部 +シヘイ 四平 +シヘイ 仕平 +シヘイドウ 始平堂 +シホ 志甫 +シホ 志保 +シホ 子甫 +シホ 志穂 +シボイ 志保井 +シボイシ 志保石 +シホイリ 志保入 +シホウ 四方 +シボウ 芝生 +ジホウ 持宝 +ジホウ 字宝 +シボウタ 柴生田 +シボウタ 思坊田 +シホウテン 四方天 +シホウデン 四方伝 +シホウドウ 四方堂 +シホウヤマ 四方山 +シボオタ 柴生田 +シホキ 志甫木 +シホサワ 志保沢 +シホザワ 志保沢 +シホザワ 志保澤 +シボサワ 志保沢 +シボサワ 萎沢 +シボサワ 志保澤 +シボサワ 萎澤 +シホタ 四方田 +シホタ 志保田 +シホダ 志保田 +シボタ 志保田 +シホノ 志保野 +シホハラ 志保原 +シボハラ 志保原 +シホミ 志保見 +シホヤ 志甫谷 +シホヤ 志保谷 +シボヤ 志母谷 +シホヤマ 志保山 +シボラ 萎羅 +シボラ 志洞 +シボリタニ 絞谷 +シボリノ 絞野 +シホンギ 四本木 +シホンマツ 四本松 +シマ 島 +シマ 嶋 +シマ 志摩 +シマ 司馬 +シマ 嶌 +シマ 志磨 +シマ 志馬 +シマ 志満 +シマ 志間 +シマ 志真 +シマ 志麻 +シマ 紫摩 +シマ 志万 +シマ 志广 +シマ 嶼 +シマ 陦(隯) +シマアサ 島朝 +シマイ 島井 +シマイ 島居 +シマイ 嶋井 +シマイ 縞居 +シマイ 嶋居 +シマイ 志摩井 +シマイ 嶌井 +シマイエ 嶋家 +シマイエ 島家 +シマイケ 嶋池 +シマイケ 島池 +シマイシ 島石 +シマイダ 四枚田 +シマイチ 嶋市 +シマイチ 島市 +シマイワ 島岩 +シマウジ 島氏 +シマウチ 島内 +シマウチ 嶋内 +シマウチ 嶌内 +シマウラ 島浦 +シマウラ 嶋浦(嶌浦) +シマウラヤ 嶋浦屋 +シマエ 嶋江 +シマエ 島江 +シマオ 島尾 +シマオ 嶋尾 +シマオ 島雄 +シマオ 島生 +シマオ 嶋生 +シマオ 嶋雄 +シマオウ 島王 +シマオウギ 島扇 +シマオカ 島岡 +シマオカ 嶋岡 +シマオカ 嶌岡 +シマカ 島香 +シマカ 嶋加 +シマカ 嶋香 +シマガ 島賀 +シマガイ 島谷 +シマガイ 嶋谷 +シマガイト 島垣内 +シマガキ 島垣 +シマガキ 嶋垣 +シマカケ 島掛 +シマカゲ 島影 +シマカゲ 嶋影 +シマカゲ 島陰 +シマカゲ 嶌影 +シマガシラ 島頭(嶋頭) +シマカタ 島方 +シマカタ 嶋方 +シマカタ 島片 +シマガタ 島方 +シマガタ 島形 +シマガタ 嶋形 +シマカツ 島勝 +シマカド 島角 +シマカネ 島金 +シマガネ 島金 +シマカミ 島上 +シマカミ 嶋上 +シマガミ 島上 +シマガミ 嶋上 +シマガヤ 嶋谷 +シマカワ 島川 +シマカワ 嶋川 +シマカワ 嶌川 +シマカワ 島河 +シマガワ 島川 +シマキ 島木 +シマキ 嶋木 +シマキ 嶌生 +シマキ 洲木 +シマキ 島喜 +シマキ 島記 +シマキ 島来 +シマキ 嶋城 +シマギ 島木 +シマキタ 嶋北 +シマキタ 島北 +シマグチ 島口 +シマグチ 嶋口 +シマグチ 嶌口 +シマクラ 島倉 +シマクラ 嶋倉(嶌倉) +シマコ 島子 +シマゴ 島子 +シマゴ 島児 +シマゴ 嶋児 +シマゴ 島兒 +シマゴ 嶋子 +シマゴ 嶌子 +シマコシ 島越 +シマコシ 嶋越 +シマコシ 嶌越 +シマサ 嶋佐 +シマサ 島佐 +シマサカ 嶋坂 +シマサカ 島坂 +シマサキ 島崎 +シマサキ 嶋崎 +シマサキ 島嵜 +シマサキ 嶌崎 +シマサキ 島先 +シマサキ 嶌嵜 +シマサキ 嶋先 +シマサキ 嶋嵜 +シマザキ 島崎 +シマザキ 嶋崎 +シマザキ 島嵜 +シマザキ 嶌崎 +シマザキ 嶌嵜 +シマザキ 嶋嵜 +シマザキ 島埼 +シマザキ 嶋埼 +シマサク 嶋作 +シマサク 島作 +シマザコ 島迫 +シマサシ 嶋指 +シマサト 島里 +シマザト 島里 +シマザト 嶋里 +シマサワ 島沢 +シマサワ 島澤 +シマサワ 嶋澤 +シマザワ 島沢 +シマザワ 島澤 +シマザワ 嶋沢 +シマザワ 嶋澤 +シマジ 島地 +シマジ 嶋地 +シマジ 島次 +シマジ 嶋司 +シマジ 嶋路 +シマジ 島路 +シマジ 嶋治 +シマシゲ 島重 +シマシタ 島下 +シマシタ 嶋下 +シマジリ 島尻 +シマジリ 嶋尻 +シマス 島須 +シマズ 島津 +シマズ 嶋津 +シマズ 嶌津 +シマズ 島寿 +シマズ 島豆 +シマズ 島図 +シマズ 嶋寿 +シマズ 嶌頭 +シマズ 嶋壽 +シマズイ 島居 +シマズイ 縞居 +シマスエ 島居 +シマスエ 島末 +シマスエ 嶋末 +シマスエ 嶌末 +シマズエ 島居 +シマズエ 島末 +シマズエ 嶋末 +シマズミ 島住 +シマズミ 島隅 +シマズミ 嶋住 +シマズヤ 島津屋 +シマセ 島瀬 +シマセ 嶋瀬 +シマセ 島世 +シマゼキ 島関 +シマソエ 島添 +シマゾエ 島添 +シマゾエ 嶋添 +シマゾノ 島薗 +シマタ 島田 +シマタ 嶋田 +シマタ 島多 +シマダ 島田 +シマダ 嶋田 +シマダ 嶌田 +シマダ 島多(島夛) +シマダ 隝田 +シマダ 嶋多(嶋夛) +シマダ 縞田 +シマダ 市万田 +シマダ 志馬田 +シマダ 志摩田 +シマダ 斯真田 +シマダ 斯眞田 +シマダ 嶼田 +シマタイ 島袋 +シマダイ 島台 +シマタカ 島高 +シマタカ 嶋高 +シマタキ 島滝 +シマタキ 島瀧 +シマタケ 島竹 +シマタケ 島武 +シマタケ 嶋竹 +シマタテ 嶋立 +シマダテ 島立 +シマダテ 嶋立 +シマタニ 島谷 +シマタニ 嶋谷 +シマタニ 嶌谷 +シマタニ 縞谷 +シマダヤ 島田屋 +シマダヤ 島田谷 +シマチ 島地 +シマチ 嶋地 +シマヂ 嶋地 +シマツ 島津 +シマツ 嶋津 +シマツ 嶌津 +シマヅ 島津 +シマヅ 嶋津 +シマヅ 嶌津 +シマヅ 志満津 +シマヅ 嶹津 +シマヅエ 島津江 +シマツカ 島塚 +シマツジ 島辻 +シマヅツ 島筒 +シマヅヤ 島津屋 +シマデ 島出 +シマデ 嶋出 +シマデラ 嶋寺 +シマデラ 島寺 +シマト 島戸 +シマト 嶋戸 +シマト 島途 +シマド 島戸 +シマド 嶋戸 +シマド 嶋渡 +シマド 島渡 +シマドイ 島樋 +シマトウ 島藤 +シマトウ 島当 +シマトウ 島當 +シマトウ 島籐 +シマトシ 島利 +シマトミ 島富(嶋富) +シマナ 島名 +シマナ 嶋名 +シマナ 司馬名 +シマナ 嶌名 +シマナカ 島中 +シマナカ 嶋中 +シマナカ 島仲 +シマナカ 嶋仲 +シマナカ 嶌中 +シマナガ 島永 +シマナガ 島長 +シマナガ 嶋長 +シマナガ 嶋永 +シマナミ 島並 +シマナミ 島波 +シマナリ 島也 +シマニ 島仁 +シマニ 嶋仁 +シマニシ 島西 +シマニシ 嶋西 +シマヌキ 島貫 +シマヌキ 嶋貫 +シマヌキ 島抜 +シマヌキ 島拔 +シマヌキ 嶌貫 +シマネ 島根 +シマネ 嶋根 +シマネ 島子 +シマネ 嶌根 +シマノ 島野 +シマノ 嶋野 +シマノ 嶌野 +シマノ 島埜 +シマノ 嶋埜 +シマノ 島乃 +シマノ 嶌𡌛 +シマノウエ 島ノ上 +シマノウエ 島之上 +シマノウチ 島内 +シマノウチ 嶋内 +シマノウチ 嶋之内 +シマノウチ 島ノ内 +シマノウチ 島埜内 +シマノウチ 島之内 +シマノウチ 嶋ノ内 +シマノエ 島ノ江 +シマノエ 島の江 +シマノエ 嶋ノ江 +シマノエ 島之江 +シマノカミ 島ノ上 +シマノキ 島軒 +シマノキ 嶋之木 +シマバ 嶋羽 +シマバ 島場 +シマバ 嶋場(嶌場) +シマハシ 島橋 +シマハシ 嶋橋 +シマバシ 嶋橋 +シマハタ 島畑 +シマハタ 島端 +シマハタ 嶋畑 +シマバタ 島端 +シマハナ 島鼻 +シマバヤシ 島林 +シマバヤシ 嶋林 +シマハラ 島原 +シマハラ 嶋原 +シマハラ 嶌原 +シマバラ 島原 +シマバラ 嶋原 +シマヒロ 島広(島廣) +シマヒロ 嶋広 +シマフク 島福 +シマブク 島袋 +シマフクロ 島袋 +シマブクロ 島袋 +シマブクロ 嶋袋 +シマフジ 島藤 +シマフジ 嶋藤 +シマフジ 嶌藤 +シマフチ 島渕 +シマブチ 島渕 +シマブチ 島淵 +シマベ 島部 +シマベ 島辺(島邉) +シマベ 島邊 +シマベ 嶋部 +シマベ 嶋辺 +シマホシ 島星 +シマホリ 嶌堀(島堀) +シママキ 島巻 +シママキ 嶋巻 +シママツ 島松 +シママツ 嶋松 +シママル 島丸 +シママワリ 島廻 +シマミ 島見 +シマミ 嶋見 +シマミチ 島道 +シマミチ 嶋道 +シマミツ 島光 +シマミネ 島峰(嶋峰) +シマミネ 島峯 +シマミネ 嶌峰 +シマミヤ 嶋宮 +シマミヤ 島宮 +シマムコ 島向 +シマムコウ 島向 +シマムネ 島宗(嶋宗) +シマムラ 島村 +シマムラ 嶋村 +シマムラ 嶌村 +シマムラ 志磨村 +シマムラ 島邑 +シマムラ 嶋邨 +シマムラ 嶋邑 +シマムラ 四万村 +シマムラ 志間村 +シマムラ 志摩村 +シマムラ 志摩邑 +シマムラ 嶹村 +シマメグリ 島廻 +シマメグリ 島巡 +シマメグリ 嶋廻 +シマモト 島本 +シマモト 嶋本 +シマモト 島元 +シマモト 嶋元 +シマモト 嶌本 +シマモト 縞本 +シマモリ 島森 +シマモリ 島守 +シマモリ 嶋守 +シマモリ 嶋森 +シマモリ 島盛 +シマモリ 嶌森 +シマモリ 嶌守 +シマヤ 島谷 +シマヤ 嶋谷 +シマヤ 嶋屋 +シマヤ 嶋矢 +シマヤ 島屋 +シマヤ 島矢 +シマヤ 嶌谷 +シマヤ 島箭 +シマヤ 嶌屋 +シマヤシキ 島屋敷 +シマヤナギ 嶋柳 +シマヤブ 島薮 +シマヤマ 島山 +シマヤマ 嶋山 +シマヨシ 嶋吉 +シマヨシ 島吉 +シマヨリ 島寄 +シマリ 嶋利 +シマリ 島利 +シマル 四丸 +シマル 志丸 +ジマル 地丸 +シマワキ 島脇 +シマワキ 嶋脇 +シミ 志見 +ジミ 自見 +ジミ 地美 +シミジ 清次 +シミズ 清水 +シミズ 志水 +シミズ 冷水 +シミズ 真水 +シミズ 清泉 +シミズ 師水 +シミズ 眞水 +シミズ 四水 +シミズ 士水 +シミズ 志美津 +シミズ 設水 +シミズ 瀏 +シミズ 㵮 +シミズイ 清水井 +シミズイケ 清水池 +シミズイシ 清水石 +シミズオカ 清水岡 +シミズカシラ 清水頭 +シミズガシラ 清水頭 +シミズガミ 清水上 +シミズカワ 清水川 +シミズガワ 清水川 +シミズグチ 清水口 +シミズグチ 志水口 +シミズサコ 清水迫 +シミズサワ 清水沢 +シミズサワ 清水澤 +シミズシマ 清水嶋 +シミズシマ 清水島 +シミズタ 清水田 +シミズダ 清水田 +シミズタニ 清水谷 +シミズダニ 清水谷 +シミズノ 清水野 +シミズハタ 清水端 +シミズハタ 清水畑 +シミズバタ 清水端 +シミズバタ 清水畑 +シミズヒラ 清水平 +シミズベ 清水辺(清水邉) +シミズボウ 清水坊 +シミズメ 清水目 +シミズモト 清水基 +シミズモト 清水本 +シミズヤ 清水谷 +シミズヤ 清水屋 +シミズヤマ 清水山 +シミチ 四道 +ジミチ 地道 +シミヅ 清水 +シミヅ 志水 +シミヅ 清三津 +ジミネ 地峰 +ジミネ 地峯 +シミヤ 四宮 +シミヤ 志宮 +シミヤ 司宮 +ジミョウ 持明 +ジミョウイン 持明院 +ジム 治武 +シムタ 紫牟田 +シムタ 志牟田 +シムタ 四牟田 +シムタ 柴牟田 +ジムタ 爾牟田 +シムラ 志村 +シムラ 新村 +シムラ 種村 +シムラ 清村 +シムラ 紫村 +シムラ 四村 +シムラ 進村 +シムラ 師村 +シムラ 志邨 +シムラ 司村 +シムラ 使村 +シムラ 志邑 +シムラ 施村 +ジムラ 地村 +ジムラ 治村 +ジムロ 字室 +シメ 七五三 +シメ 志馬 +シメ 注連 +シメ 志免 +シメ 志目 +シメ 示 +シメ 〆 +シメイ 仕明 +シメガキ 〆垣 +シメカケ 七五三掛 +シメカケ 占掛 +シメガケ 七五三掛 +シメカワ 締川 +シメカワ 住連川 +シメキ 標 +シメキ 七五三木 +シメキ 〆木 +シメキ 志女木 +シメキ 志免木 +シメキ 締木 +シメキ 卜木 +シメギ 標 +シメギ 七五三木 +シメギ 〆木 +シメギ 志女木 +シメサキ 〆崎 +シメザキ 〆崎 +シメザキ 示崎 +シメザワ 示沢 +シメザワ 注連沢 +シメザワ 注連澤 +シメタ 〆田 +シメタ 七五三田 +シメダ 〆田 +シメダ 卜田 +シメダ 志目田 +シメタニ 〆谷 +シメタニ 清女谷 +シメツグ 締次 +シメノ 示野 +シメノ 〆野 +シメノ 占野 +シメノ 七五三野 +シメノ 注連野 +シメノ 主馬野 +シメノ 四女野 +シメノ 志明野 +シメノ 𨕫野 +シメノウチ 注連内 +シメノキ 住連木 +シメハシ 貫橋 +シメバリ 絞張 +シメムラ 示村 +シメモト 〆本 +シメモト 注連本 +シメモリ 示森 +ジメン 地面 +ジメンジ 治面地 +ジメンヂ 治面地 +シモ 下 +シモ 志茂 +シモ 下茂 +シモ 霜 +シモ 志毛 +シモ 司茂 +シモ 下モ +シモアオキ 下青木 +シモアカ 下赤 +シモアカショ 下赤所 +シモアキ 下秋 +シモアサ 下浅 +シモアラ 下荒 +シモアライソ 下荒磯 +シモアリムラ 下有村 +シモイ 下井 +シモイ 下位 +シモイ 下居 +シモイ 霜井 +シモイ 下飯 +シモイイ 下飯 +シモイイザカ 下飯坂 +シモイイノ 下飯野 +シモイエ 下家 +シモイクラ 下伊倉 +シモイクラ 下井倉 +シモイケ 下池 +シモイケダ 下池田 +シモイケヤマ 下入ケ山 +シモイシ 下石 +シモイシ 霜石 +シモイシカワ 下石川 +シモイシザカ 下石坂 +シモイシハタ 下石畑 +シモイシハラ 下石原 +シモイシミ 下石見 +シモイズ 下伊豆 +シモイズミ 下泉 +シモイズミ 下出水 +シモイセキ 下井関 +シモイタ 下井田 +シモイダ 下井田 +シモイタニ 下井谷 +シモイチ 下市 +シモイチゴ 下市後 +シモイチゾノ 下市園 +シモイチノミヤ 下一ノ宮 +シモイデ 下出 +シモイデ 霜出 +シモイデ 下井手 +シモイデ 下出手 +シモイド 下井戸 +シモイナバ 下稲葉 +シモイネ 下稲 +シモイノ 下飯野 +シモイマニシ 下今西 +シモイマベップ 下今別府 +シモイリサ 下入佐 +シモイワ 下岩 +シモウ 志毛 +シモウ 下生 +シモウエ 下上 +シモウサ 下總 +シモウジ 下氏 +シモウシオ 下牛尾 +シモウシオ 下潮 +シモウシロ 下後 +シモウス 下薄 +シモウスキ 下宇宿 +シモウセ 下鵜瀬 +シモウチ 下内 +シモウチ 下打 +シモウチダ 下内田 +シモウツボ 下苧坪 +シモウツボ 下荢坪 +シモウツボ 下宇坪 +シモウトウゲ 下宇峠(下宇垰) +シモウネ 下畦 +シモウネ 下釆 +シモウラ 下浦 +シモウラ 霜浦 +シモウラ 下裏 +シモウルシ 下漆 +シモエ 下江 +シモエ 下重 +シモエ 霜江 +シモエゴ 下江後 +シモエズ 下絵図 +シモエダ 下枝 +シモエノオ 下酔尾 +シモエノオ 下醉尾 +シモエビス 下夷 +シモオ 下尾 +シモオ 霜尾 +シモオオカワ 下大川 +シモオオクボ 下大久保 +シモオオサコ 下大迫 +シモオオサワ 下大沢 +シモオオサワ 下大澤 +シモオオサワ 下太沢 +シモオオゾノ 下大園 +シモオオゾノ 下大薗 +シモオオタ 下大田 +シモオオテラ 下大寺 +シモオオボラ 下大洞 +シモオオマエ 下大前 +シモオオヤ 下大屋 +シモオカ 下岡 +シモオカ 霜岡 +シモオキ 下沖 +シモオキ 下置 +シモオク 下奥 +シモオケ 下桶 +シモオザキ 下尾崎 +シモオダ 下小田 +シモオノダ 下小野田 +シモオロ 下苙 +シモカ 下加 +シモカ 下嘉 +シモガ 下賀 +シモカイ 下飼 +シモカイ 下開 +シモガイ 下谷 +シモガイ 下雅意 +シモカイショ 下会所(下會所) +シモガイショ 下会所(下會所) +シモカイショウ 下会所(下會所) +シモガイチ 下垣内 +シモガイツ 下垣津 +シモガイテ 下飼手 +シモカイト 下海戸 +シモガイト 下垣内 +シモガイト 下垣外 +シモガイトウ 下垣内 +シモガウチ 下垣内 +シモカガワ 下香川 +シモカギ 下鍵 +シモガキ 下垣 +シモガキ 霜垣 +シモガキ 下柿 +シモガキ 霜柿 +シモカキウチ 下垣内 +シモガキウチ 下垣内 +シモガキナルミ 下垣鳴海 +シモカキモト 下柿元 +シモカキモト 下垣元 +シモカキモト 下柿本 +シモカケ 下掛 +シモカゲ 下影 +シモカゲ 下蔭 +シモカゲ 下陰 +シモカゲ 下隠 +シモカサ 下笠 +シモガサ 下笠 +シモカジ 下梶 +シモカジ 下鍛治 +シモカジ 下鍛冶 +シモカジ 下家地 +シモカジ 下鍜治 +シモカジヤ 下梶谷 +シモカゼ 下風 +シモカタ 下方 +シモカタ 下形 +シモカタ 霜方 +シモガタ 下方 +シモガタ 下形 +シモガタ 下潟 +シモカタノ 下片野 +シモカツ 下勝 +シモカド 下門 +シモカド 下角 +シモカド 霜門 +シモカド 下加土 +シモカネ 下兼 +シモカネ 下金 +シモガネ 下兼 +シモカネクリ 下兼操 +シモガフジ 下ケ藤 +シモカマ 下釜 +シモガマ 下釜 +シモカミ 下神 +シモカミ 下上 +シモガミ 下神 +シモガミ 下上 +シモガミ 霜上 +シモカモ 下加茂 +シモカヤ 下茅 +シモカリ 下仮 +シモカリ 下假 +シモカリヤ 下仮屋(下假屋) +シモカリヤ 下狩谷 +シモカワ 下川 +シモカワ 下河 +シモカワ 霜川 +シモカワ 枝茂川 +シモガワ 下川 +シモガワ 下河 +シモガワ 下側 +シモカワジ 下川路 +シモカワチ 下河内 +シモカワト 下川戸 +シモカワト 下川渡 +シモカワトコ 下川床 +シモカワドコ 下川床 +シモカワハラ 下川原 +シモカワベ 下河辺 +シモカワベ 下川部 +シモカワベ 下川辺(下川邉) +シモカワベ 下河部 +シモカワベ 下河邊 +シモカワベ 下河邉 +シモカワベ 下川邊 +シモカワミチ 下河道 +シモカワラ 下川原 +シモカワラ 下河原 +シモガワラ 下川原 +シモガワラ 下河原 +シモカンダ 下神田 +シモガンナ 下鉄穴 +シモキ 下木 +シモギク 下菊 +シモキサキ 下木崎 +シモキザキ 下木崎 +シモキシ 下岸 +シモギシ 下岸 +シモキタ 下北 +シモキタニ 下木谷 +シモキド 下木戸 +シモキハラ 下木原 +シモキヤ 下木屋 +シモキョウ 下京 +シモキョウダ 下京田 +シモギリ 下桐 +シモギリ 下切 +シモクガキ 下工垣 +シモクサ 下草 +シモクシ 下串 +シモグシ 下串 +シモクス 下楠 +シモクズ 下葛 +シモクスゾノ 下楠薗 +シモクスゾノ 下楠園 +シモクダ 下久田 +シモクチ 下口 +シモグチ 下口 +シモグチヤ 下口谷 +シモクニ 下国 +シモクニ 下國 +シモグニ 下国 +シモクネ 下久根 +シモクネ 下久祢(下久禰) +シモクボ 下久保 +シモクボ 下窪 +シモクマ 下熊 +シモクマ 下隈 +シモクモ 下雲 +シモクラ 下倉 +シモクラ 霜倉 +シモクラ 下蔵 +ジモクラ 地木楽(地木樂) +シモクリ 下栗 +シモクリ 下庫理 +シモグリ 下栗 +シモグロ 下黒 +シモクロサワ 下黒沢(下黒澤) +シモクワタ 下桑田 +シモクワダ 下桑田 +シモクワヤ 下桑谷 +シモケ 下家 +シモケ 下毛 +シモゲン 下源 +シモゴ 下護 +シモコウ 下公 +シモコウ 下甲 +シモゴウ 下郷 +シモコウゲ 下高下 +シモコウジ 下小路 +シモコウジ 下糀 +シモコウジ 下荒地 +シモコウジン 下荒神 +シモコウチ 下河内 +シモゴウチ 下垣内 +シモゴウチ 下河内 +シモコウノキ 下神納木 +シモコウノギ 下神納木 +シモコウベ 下河辺 +シモコウベ 下河部 +シモコウベ 下河邊 +シモコウベ 下河邉 +シモコウモ 下幸茂 +シモコウヤ 下桑谷 +シモコウラ 下小浦 +シモコウロ 下高呂 +シモコエダ 下越田 +シモゴオリ 下郡 +シモゴオリ 霜凍 +シモコオリヤマ 下郡山 +シモコガワ 下小川 +シモコクラ 下小倉 +シモコシ 霜越 +シモコシ 下越 +シモコシ 下腰 +シモゴシ 霜越 +シモコシキマチ 下甑町 +シモコシダ 下越田 +シモコジョウ 下小城 +シモコセ 下小瀬 +シモコゾノ 下小薗 +シモコゾノ 下小園 +シモコダ 下小田 +シモコダチ 下古立 +シモコヅル 下小鶴 +シモコバ 下木場 +シモコバ 下古場 +シモコマキ 下小牧 +シモゴミ 下込 +シモゴメ 下込 +シモコヤ 下小家 +シモゴリョウ 下御領 +シモコン 下紺 +シモゴンヤ 下権谷(下權谷) +シモサ 下佐 +シモザ 下座 +シモサカ 下坂 +シモサカ 下阪 +シモサカ 霜阪 +シモサカ 志茂坂 +シモサカ 霜坂 +シモサカイ 下境 +シモサカイ 下酒井 +シモザカイ 下境 +シモサカイダ 下境田 +シモサカイダ 下堺田 +シモサカモト 下坂元 +シモサカモト 下坂本 +シモサカモト 下阪本 +シモサキ 下崎 +シモサキ 霜崎 +シモサキ 下嵜 +シモサキ 下先 +シモサキ 霜嵜 +シモザキ 下崎 +シモザキ 霜崎 +シモザキ 下嵜 +シモザクラ 下桜(下櫻) +シモサコ 下迫 +シモサコ 下窄 +シモサコ 下佐粉 +シモサコ 下硲 +シモサコ 下浴 +シモサコ 下佐古 +シモサコ 下嶝(下隥) +シモザコ 下迫 +シモサコダ 下迫田 +シモサコン 下左近 +シモササ 下笹 +シモサダ 下佐田 +シモサダ 下貞 +シモサダ 下定 +シモサト 下里 +シモサト 下郷 +シモサト 霜里 +シモザト 下里 +シモザト 下郷 +シモサラヤ 下更屋 +シモサワ 下沢 +シモサワ 下澤 +シモザワ 下沢 +シモザワ 下澤 +シモザワ 霜沢 +シモザワ 霜澤 +シモサワダ 下沢田 +シモサワダ 下澤田 +シモシ 下司 +シモジ 下地 +シモジ 下司 +シモジ 下路 +シモジ 下治 +シモシオ 下塩 +シモシオイリ 下塩入 +シモシキリョウ 下敷領 +シモシキリョウ 下敷頒 +シモシゲ 下重 +シモシゲ 下茂 +シモシタ 霜下 +シモシタ 下舌 +シモジッコク 下拾石 +シモジトウショ 下地頭所 +シモシバ 下芝 +シモシマ 下嶋(下嶌) +シモシマ 下志万 +シモジマ 下島 +シモジマ 下嶋(下嶌) +シモジマ 霜島 +シモジマ 下志万 +シモシマノ 下島野 +シモシミズ 下清水 +シモジャナ 下謝名 +シモジュウ 下重 +シモジュウ 霜重 +シモジュク 下宿 +シモショウ 下庄 +シモジョウ 下条 +シモジョウ 下條 +シモジョウ 下城 +シモジョウ 下門 +シモジョウ 下篠 +シモジョウ 下茂門 +シモジョウ 下絛 +シモジョウ 下亟 +シモショウハラ 下正原 +シモジョウミチ 下條道 +シモジョウミチ 下条道 +シモシライシ 下白石 +シモシラキ 下白木 +シモジリ 下尻 +シモシロ 下城 +シモシロ 下代 +シモシン 下新 +シモジン 下陳 +シモジン 下陣 +シモシンバラ 下新原 +シモス 下須 +シモズ 下津 +シモスエ 下末 +シモスカ 下須賀 +シモスガ 下須賀 +シモスキ 下薄 +シモスギ 下杉 +シモスギキ 下杉木 +シモスサキ 下須崎 +シモスザキ 下須崎 +シモズマ 下妻 +シモスミ 下角 +シモズミ 下住 +シモズミ 下隅 +シモズル 下水流 +シモセ 下瀬 +シモセ 下世 +シモセ 下畝 +シモセイダ 下清田 +シモセガワ 下瀬川 +シモセキ 下関 +シモゼキ 下関 +シモセコ 下世古 +シモセチ 下畝地 +シモゾウザ 下造座 +シモソエダ 下副田 +シモソオガワ 下曽小川 +シモソコガワ 下曾小川 +シモソコガワ 下曽小川 +シモソネ 下曽根 +シモソネ 下曾根 +シモソネ 下曾禰 +シモソネ 下曽禰 +シモソノ 下園 +シモゾノ 下園 +シモゾノ 下薗 +シモソヤマ 下曽山 +シモソヤマ 下曾山 +シモソラ 下空 +シモソリ 下反 +シモゾリ 下反 +シモタ 下田 +シモタ 霜田 +シモタ 霜多 +シモタ 下タ +シモダ 下田 +シモダ 霜田 +シモダ 下多 +シモダ 下駄 +シモダ 下夕 +シモダ 志茂田 +シモタイ 下平 +シモタイ 下帯(下帶) +シモダイ 下代 +シモダイ 下台 +シモダイ 下臺 +シモダイク 下大工 +シモダイチョウ 下大長 +シモタイラ 下平 +シモダイラ 下平 +シモダイラ 下田平 +シモタオ 下峠 +シモタオ 下田尾 +シモダオ 下田尾 +シモタカ 下高 +シモタカタニ 下高谷 +シモタカハラ 下高原 +シモタカマキ 下高牧 +シモタカヤマ 下高山 +シモタキ 下滝 +シモタキ 下瀧 +シモタケ 下竹 +シモタケ 下嶽 +シモタケ 霜竹 +シモタケ 下岳 +シモダケ 下嶽 +シモタケハラ 下竹原 +シモタザカ 下太坂 +シモタザワ 下田沢 +シモタシロ 下田代 +シモタダ 下忠 +シモタタラ 下鑪 +シモタタラ 下鈩 +シモタツ 下多津 +シモダテ 下館 +シモダテ 下舘 +シモダテ 下立 +シモタナカ 下田中 +シモタニ 下谷 +シモダニ 下谷 +シモタニダ 下谷田 +シモダネ 下種 +シモダバ 下駄場 +シモタハラ 下田原 +シモタヒラ 下田平 +シモタビラ 下田平 +シモダヒラ 下田平 +シモタマ 下玉 +シモダマ 下玉 +シモタマリ 下玉利 +シモタムラ 下タ村 +シモタヤ 下田屋 +シモダヤ 下田屋 +シモダレ 下垂 +シモタワ 下田和 +シモダワ 下田和 +シモダン 下段 +シモダン 下団 +シモチ 下地 +シモヂ 下地 +シモチカ 下親 +シモチャ 下茶 +シモチャヤ 下茶谷 +シモツ 下津 +シモツ 霜津 +シモヅ 下津 +シモツウラ 下津浦 +シモツエ 下津江 +シモツカ 下司 +シモツカ 下塚 +シモヅカ 下塚 +シモツカサ 下司 +シモツギ 下次 +シモツグ 下次 +シモツクエ 下机 +シモツサ 下津佐 +シモツサ 下津左 +シモツジ 下辻 +シモツジ 霜辻 +シモツタ 下章 +シモツチ 下土 +シモツチハシ 下土橋 +シモツチバシ 下土橋 +シモツヌキ 下津貫 +シモツハマ 下津浜(下津濱) +シモツボ 下坪 +シモツマ 下間 +シモツマ 下妻 +シモヅマ 下間 +シモヅマ 下妻 +シモヅマ 下津間 +シモツマガリ 下津曲 +シモツヤ 下津谷 +シモツヤ 下津屋 +シモツリ 下釣 +シモツル 下鶴 +シモヅル 下鶴 +シモヅル 下水流 +シモテ 下手 +シモテ 霜手 +シモデ 下出 +シモデ 霜出 +シモデ 下手 +シモデグチ 下出口 +シモデヤ 下出谷 +シモデラ 下寺 +シモテンマ 下天摩(下天广) +シモテンマ 下天満 +シモデンヤ 下田谷 +シモト 四元 +シモト 四本 +シモト 下戸 +シモト 下登 +シモト 下砥 +シモト 志本 +シモト 資元 +シモド 下戸 +ジモト 地本 +ジモト 持本 +シモトイ 下問 +シモドイ 下土井 +シモドイ 下土居 +シモドイ 下問 +シモトウ 下東 +シモトウ 下遠 +シモドウ 下堂 +シモトウゲ 下峠 +シモドウソノ 下堂薗 +シモドウゾノ 下堂薗 +シモドウゾノ 下堂園 +シモトウノ 下遠野 +シモドウマエ 下堂前 +シモトオ 下遠 +シモトオノ 下遠野 +シモドオリ 下通 +シモトク 下徳 +シモトクベ 下徳辺 +シモトソ 下唐湊 +シモトチ 下戸地 +シモトチタナ 下栃棚 +シモトチダナ 下栃棚 +シモトナリ 下戸成 +シモドナリ 下戸成 +シモドノ 下殿 +シモトマイ 下斗米 +シモトミ 下斗米 +シモトメ 下斗米 +シモトメ 下留 +シモドメ 下留 +シモトモ 下友 +シモトヨドメ 下豊留 +シモトリ 霜鳥 +シモトリ 下鳥 +シモトリ 下酉 +シモトリ 下取 +シモトリ 霜取 +シモドリ 霜鳥 +シモドリ 下鳥 +シモナイ 下モ内 +シモナイ 下毛内 +シモナイジ 下内侍 +シモナオ 下猶 +シモナカ 下中 +シモナカ 下仲 +シモナカ 霜中 +シモナガ 下永 +シモナガ 霜永 +シモナガ 下長 +シモナカシャ 下中者 +シモナガセ 下永瀬 +シモナカゾノ 下中園 +シモナガタ 下永田 +シモナカタニ 下仲谷 +シモナガネ 下長根 +シモナカノ 下中野 +シモナガノ 下長野 +シモナカムラ 下中村 +シモナガヨシ 下永吉 +シモナサコ 下名迫 +シモナシ 下奈志 +シモナシ 下無 +シモナシ 下梨 +シモナベ 下鍋 +シモナミ 下波 +シモナリ 下成 +シモナル 下成 +シモナル 下鳴 +シモナワ 下縄 +シモニ 下仁 +シモニイ 下新 +シモニイ 下二井 +シモニイダ 下新井田 +シモニイダ 下新田 +シモニイハラ 下新原 +シモニシ 下西 +シモニシキダ 下錦田 +シモニシクボ 下西窪 +シモニシゾノ 下西園 +シモニシノソノ 下西ノ園 +シモニシノソノ 下西之園 +シモヌマ 下沼 +シモヌリ 下温湯 +シモヌル 下温湯 +シモヌルユ 下温湯 +シモネ 下根 +シモネ 下祢 +シモノ 下野 +シモノ 霜野 +シモノ 下農 +シモノ 下埜 +シモノ 志茂野 +シモノ 下之 +シモノ 下濃 +シモノ 下廼(下迺) +シモノ 下茂野 +シモノウ 下農 +シモノウ 下生 +シモノウエ 下ノ上 +シモノウチ 下之内 +シモノエ 下野江 +シモノカド 下之門 +シモノカド 下之角 +シモノカド 下ノ角 +シモノカワ 下野川 +シモノキ 下ノ木 +シモノジリ 下野尻 +シモノセキ 下関 +シモノセキ 下ノ関 +シモノソノ 下之薗 +シモノソノ 下之園 +シモノソノ 下ノ園 +シモノソノ 下ノ薗 +シモノソノ 下野園 +シモノソノ 下の薗 +シモノゾノ 下之薗 +シモノゾノ 下之園 +シモノソン 下之園 +シモノダン 下之段 +シモノダン 下ノ段 +シモノダン 下野段 +シモノツ 下野津 +シモノト 下野戸 +シモノハラ 下ノ原 +シモノハラ 下之原 +シモノハラ 下野原 +シモノヒラ 下野平 +シモノヒラ 下ノ平 +シモノボウ 下ノ坊 +シモノボウ 下之坊 +シモノボウ 下野坊 +シモノホリ 下ノ堀 +シモノホリ 下之堀 +シモノボリ 下登 +シモノボル 下登 +シモノマ 下野間 +シモノムラ 下ノ村 +シモノモト 下ノ本 +シモノヤ 下野谷 +シモハ 下羽 +シモバ 下羽 +シモバ 下場 +シモハエ 下八重 +シモハカマダ 下袴田 +シモハギ 下萩 +シモハギハラ 下萩原 +シモハコイシ 下箱石 +シモハザ 下㹦 +シモハシ 下橋 +シモハシ 下端 +シモハシバ 下橋場 +シモハセ 下長谷 +シモハタ 下畑 +シモハタ 下畠 +シモバタ 下畑 +シモバタ 下端 +シモハタダ 下畠田 +シモハチ 下八 +シモバチ 下鉢 +シモハチジリ 下八尻 +シモハツボ 下羽坪 +シモハナ 下花 +シモハナ 下鼻 +シモババ 下馬場 +シモハマ 下浜 +シモハマ 下濱 +シモバヤシ 下林 +シモハヤシヤマ 下林山 +シモバヤシヤマ 下林山 +シモハラ 下原 +シモハラ 霜原 +シモハライ 下払 +シモハライ 下拂 +シモバライ 下払 +シモバライ 下拂 +シモハラグチ 下原口 +シモハラダ 下原田 +シモハル 下春 +シモバル 下原 +シモヒ 下樋 +シモヒカゲ 下日蔭 +シモヒガシ 下東 +シモヒキジ 下引地 +シモヒゴシ 下吹越 +シモヒサ 下久 +シモヒサヨシ 下久吉 +シモヒダ 下飛田 +シモヒナタ 下日向 +シモヒョウ 下俵 +シモヒラ 下平 +シモヒラ 霜平 +シモヒラオ 下平尾 +シモヒラキ 下平木 +シモビラキ 下開 +シモヒラクマ 下平熊 +シモヒラセ 下平瀬 +シモヒロ 下広 +シモヒロ 下廣 +シモフエ 下笛 +シモフカサコ 下深迫 +シモフカサワ 下深沢 +シモフキゴエ 下吹越 +シモフキゴシ 下吹越 +シモフク 下福 +シモフサ 下総 +シモフサ 下房 +シモフサ 下總 +シモフシ 下伏 +シモフジ 下藤 +シモフジ 霜藤 +シモフセ 下伏 +シモブセ 下伏 +シモブチ 下渕 +シモブチ 下淵 +シモフネ 下船 +シモフリ 霜降 +シモフリ 下振 +シモフルタ 霜古田 +シモフルタチ 下古立 +シモフルタニ 下古谷 +シモフルヤ 下古谷 +シモフレ 下触 +シモフレ 霜触(霜觸) +シモフレ 下觸 +シモベ 下部 +シモベ 下辺(下邉) +シモベ 下屏 +シモベ 下邊 +シモベツ 下別 +シモベップ 下別府 +シモホ 下保 +シモホウ 下宝(下寶) +シモボウ 下坊 +シモボウ 下防 +シモボウエ 下坊江 +シモボウジ 下房地 +シモホキ 下保木 +シモホギ 下甫木 +シモホシ 下星 +シモホシザキ 下星崎 +シモホシバ 下星場 +シモホダ 下保田 +シモホノキ 下穂木 +シモホリ 下堀 +シモホリ 下掘 +シモボリ 下堀 +シモホンジ 下本地 +シモマ 下間 +シモマ 下澗 +シモマイ 下舞 +シモマエ 下前 +シモマエゾノ 下前園 +シモマエダ 下前田 +シモマエハラ 下前原 +シモマエバラ 下前原 +シモマキ 下牧 +シモマキセ 下牧瀬 +シモマス 下枡 +シモマス 下桝 +シモマスダ 下益田 +シモマタ 下又 +シモマチ 下町 +シモマツ 下松 +シモマッカ 下真下 +シモマツセ 下松瀬 +シモマツバエ 下松八重 +シモマツヤ 下松谷 +シモマツヤエ 下松八重 +シモマテ 下档 +シモマニイ 下真新 +シモマニワ 下馬庭 +シモマヤマ 下間山 +シモマルハタ 下丸畑 +シモマン 下万 +シモマン 下萬 +シモミ 下見 +シモミ 下美 +シモミ 霜見 +シモミズキ 下水木 +シモミセ 下見世 +シモミセ 下店 +シモミゾ 下溝 +シモミゾグチ 下溝口 +シモミチ 下道 +シモミツ 下光 +シモミツ 下満(下滿) +シモミナミ 下南 +シモミナミデ 下南出 +シモミネ 下峰 +シモミネ 下峯 +シモミネ 霜峯 +シモミヤ 下宮 +シモミヤジ 下宮路 +シモミヤゾノ 下宮園 +シモミヤゾノ 下宮薗 +シモミョウ 下名 +シモミョウズ 下名主 +シモムカイ 下向 +シモムカイ 下向井 +シモムキ 下向 +シモムギ 下麦 +シモムギ 下麥 +シモムシキ 下無敷 +シモムタ 下牟田 +シモムラ 下村 +シモムラ 霜村 +シモムラ 下邨 +シモムラ 下邑 +シモムロ 下室 +シモメ 下目 +シモモチハラ 下餅原 +シモモト 下元 +シモモト 下本 +シモモト 下許 +シモモリ 下森 +シモモロ 下諸 +シモヤ 下谷 +シモヤ 下家 +シモヤ 下屋 +シモヤ 下矢 +シモヤウチ 下谷内 +シモヤエ 下八重 +シモヤカワ 下八川 +シモヤシキ 下屋敷 +シモヤシキ 下屋鋪 +シモヤジリ 下八尻 +シモヤシロ 下社 +シモヤス 下保 +シモヤス 下安 +シモヤスバ 下休場 +シモヤチ 下谷内 +シモヤチ 下谷地 +シモヤツキ 下矢突 +シモヤドグチ 下宿口 +シモヤナ 下簗 +シモヤナ 下梁 +シモヤナギ 下柳 +シモヤナギタ 下柳田 +シモヤナギダ 下柳田 +シモヤハラ 下矢原 +シモヤブ 下籔 +シモヤブ 下薮 +シモヤブ 下藪 +シモヤブイ 下籔井 +シモヤブイ 下藪居 +シモヤマ 下山 +シモヤマ 霜山 +シモヤマ 志茂山 +シモヤマイ 下山井 +シモヤマシタ 下山下 +シモヤマダ 下山田 +シモヤマネ 下山根 +シモヤマノ 下山野 +シモユ 下湯 +シモユウナ 下遊名 +シモユカワ 下湯川 +シモユキタ 下湯北 +シモユセ 下湯瀬 +シモヨコ 下横 +シモヨシ 下吉 +シモヨッカイチ 下四日市 +シモラ 下良 +シモラ 下羅 +シモラ 霜良 +シモラク 下楽 +シモリ 下利 +シモリ 志森 +シモリク 下陸 +シモワキ 下脇 +シモワキタ 下脇田 +シモワケ 下分 +シモワサ 下和佐 +シモワダ 下和田 +シモワタリ 下渡 +シモン 緇門 +シモンジョ 下所 +シモンミョウ 下名 +シヤ 志谷 +ジャアナ 蛇穴 +ジャイケ 蛇池 +シャウラ 社浦 +ジャエン 蛇園 +シャカ 釈迦 +シャカ 釋迦 +シャガ 謝賀 +シャカイン 釈迦院 +シャカク 車角 +シャカゴオリ 釈迦郡 +シャカゴオリ 釋迦郡 +ジャガサキ 蛇ケ崎 +シャカタ 社方 +シャカタ 瀉方 +シャガタ 泻形 +シャガタ 瀉形 +シャカト 釈迦戸 +シャカド 釈迦戸 +シャカド 釈加戸(釋加戸) +シャカド 釋迦戸 +シャカドウ 釈迦堂 +シャカドウ 釋迦堂 +シャカノ 釈迦野(釋迦野) +シャカノ 釈河野 +シャカノ 釋河野 +ジャガハナ 蛇ケ鼻 +シャガワ 舎川 +シャガワ 社川 +ジャガワ 蛇川 +シャク 釈 +シャク 釋 +シャク 尺 +ジャクアン 雀庵 +シャクイ 酌井 +シャクイ 杓井 +シャクイ 杓居 +シャクイ 釈囲 +シャクイ 釋圍 +シャグウジ 社宮司 +シャクゴウチ 酌河内 +シャクサイ 尺采 +シャクザイ 尺釆 +シャクシ 杓子 +シャクシ 釈氏 +シャクシ 釋氏 +シャクシ 釈子 +シャクシ 尺司 +シャクシ 釋子 +シャクシオ 杓子尾 +シャクシヤ 杓子屋 +シャクシュ 釈種 +シャクシュ 釋種 +シャクシロ 赤代 +シャクスイ 釈水(釋水) +シャクズイ 釈随 +シャクセ 杓瀬(扚瀬) +シャクタ 尺田 +シャクダ 尺田 +シャクダ 杓田 +シャクダイ 勺代 +シャクタニ 杓谷 +ジャグチ 蛇口 +シャクツイ 赤対 +シャクツイ 赤對 +シャクデン 杓伝 +シャクド 赤土 +シャクド 尺戸 +シャクド 尺土 +シャクトウ 赤藤 +シャクドウ 赤藤 +シャクドウ 赤銅 +ジャクドウ 雀堂 +シャクナガ 釈永(釋永) +シャクナガ 尺長 +シャクナガ 杓永 +ジャクネン 若年 +ジャクネン 若念 +シャクノ 釈野(釋野) +シャクノ 杓野 +シャクノ 尺野 +ジャクミョウ 積明 +シャクモト 笏本 +シャクモト 釈本 +シャクヤ 杓谷 +シャケ 社家 +シヤケ 四家 +シヤケ 初宿 +シャケマ 社家間 +シャコ 車古 +ジャコ 蛇子 +ジャコウ 蛇好 +ジャコウ 麝香 +シャコウチ 社河内 +シャゴウチ 社河内 +シャコジ 社古地 +シャゴジ 社古地 +シャゴツ 射号津 +シャゴツ 射號津 +ジャサコ 蛇迫 +シャザワ 社沢 +シャザワ 社澤 +シャザワ 車沢 +シャザワ 車澤 +シャジ 社地 +シャシキ 謝敷 +シャシキ 射敷 +シャジキ 謝敷 +ジャシキ 謝敷 +ジャジキ 謝敷 +ジャジマ 蛇島 +ジャジマ 麝嶋 +ジャジマ 蛇嶋 +ジャジマ 麝島 +シャシャビ 謝々比 +シャタ 車多 +ジャタイ 蛇平 +シャタニ 車谷 +ジャタニ 蛇谷 +シャタリ 捨田利 +シャダリ 捨田利 +シャチ 社地 +シャッカベ 砂壁 +シャヅキ 赤築 +シャッケ 釈家 +シャトウ 社藤 +シャトウ 社頭 +シャトウ 車頭 +シャトウ 社籐 +シャトウ 車東 +シャトリ 車取 +シャナ 謝名 +シャナ 遮那 +ジャナ 謝名 +シャナイ 社内 +シヤナギ 四柳 +シャナダ 舎奈田 +ジャナドウ 謝名堂 +ジャナモト 謝名元 +ジャヌキ 蛇抜 +ジャヌマ 蛇沼 +シャノ 車野 +シャノ 舎野 +シャノ 車埜 +シャノウ 社納 +ジャノメ 蛇目 +ジャノメ 蛇ノ目 +ジャバシリ 蛇走 +ジャバタ 蛇端 +シャハナ 謝花 +シャバナ 謝花 +ジャハナ 謝花 +ジャバナ 謝花 +ジャハミ 蛇蝮 +ジャバミ 蛇場見 +ジャバミ 蛇喰 +ジャハラ 蛇原 +ジャブチ 蛇淵 +ジャブチ 蛇渕 +シヤマ 市山 +シヤマ 志山 +シヤマ 司山 +シヤマ 四山 +ジヤマ 次山 +ジヤマ 字山 +ジャマル 蛇丸 +シャミ 沙味 +シャミ 闍弥 +シャミ 闍彌 +ジャミ 蛇見 +シャミヒ 社御比 +シャム 社務 +シャムタ 車無田 +シャムラ 謝村 +ジャモチ 蛇持 +シャモト 社本 +ジャモト 蛇本 +シャモリ 社森 +ジャモリ 蛇森 +シャヤ 車谷 +シャリキ 車力 +シャリクラ 舎利倉(舍利倉) +シャリダ 舎里田 +シャリョウ 社領 +ジャレオ 砂連尾 +ジュ 寿 +ジュアサ 寿浅 +ジュアサ 壽浅(壽淺) +シユウ 志勇 +ジュウアミ 十阿弥 +ジュウアミ 十阿彌 +ジュウアミ 重網 +ジュウイチ 十一 +ジュウイチヤ 十一家 +ジュウイチヤ 十一谷 +ジュウイッカ 十一家 +シュウイン 執印 +シュウウラ 周浦 +シュウエイ 周栄 +シュウエイ 周榮 +シュウオ 周尾 +ジュウオ 拾尾 +ジュウオウ 十王 +ジュウオウジ 十王寺 +ジュウオウダテ 十王館 +ジュウオウダテ 十王舘 +シュウカ 集下 +シュウカイ 集貝 +シュウガイ 集貝 +ジュウカク 十角 +ジュウガメ 十亀 +シュウカワ 周川 +ジュウカワ 十河 +ジュウカワ 十川 +シュウカン 周管 +シュウカンジ 周観地 +シュウキ 秀城 +シュウキ 周木 +シュウギソノ 祝儀園 +シュウギョウ 修行 +ジュウクナミ 十九波 +ジュウクロキ 重黒木 +ジュウクロギ 重黒木 +シュウケ 修家 +シュウケ 周家 +シュウケ 秀毛 +ジュウケイ 重慶 +シュウサ 周佐 +ジュウサ 重左 +ジュウサ 重佐 +ジュウザ 重三 +シュウサイ 周才 +ジュウサカ 重坂 +ジュウザカ 重坂 +シュウサク 周作 +ジュウサコン 十佐近 +ジュウサコン 十左近 +ジュウサン 十三 +シュウシ 周詞 +シュウジ 集治(集冶) +シュウジ 周治 +シュウジ 周詞 +シュウジ 集路 +シュウジ 舛次 +ジュウシ 出牛 +ジュウジ 寿時 +ジュウジ 十字 +ジュウジ 壽時 +ジュウシマ 重島 +ジュウショ 住所 +シュウショウ 宗正 +ジュウジョウ 重城 +ジュウジョウ 重条 +ジュウジョウ 十条 +ジュウジョウ 重條 +ジュウス 重巣 +ジュウスギ 重杉 +シュウセ 周世 +ジュウゼン 十前 +シュウゼンジ 修繕寺 +シュウゼンジ 周善寺 +ジュウソ 十楚 +ジュウソウ 重走 +ジュウゾウジ 十蔵寺 +ジュウゾノ 重薗 +シュウタ 習田 +シュウタ 周田 +シュウタ 集田 +シュウタ 衆田 +シュウダ 習田 +シュウダ 周田 +ジュウタ 重田 +ジュウタ 十田 +ジュウダ 重田 +ジュウダ 十田 +シュウダイ 宗台(宗臺) +ジュウダイ 十代 +ジュウダイ 重臺 +シュウタニ 周谷 +シュウチ 須知 +シュウチ 集地 +シュウチ 周知 +ジュウチョウ 従長 +ジュウチョウ 從長 +シュウツ 周津 +シュウデン 集田 +シュウデン 修田 +シュウデン 周伝 +シュウト 周戸 +シュウト 衆徒 +シュウド 周戸 +シュウド 清土 +シュウド 周度 +シュウトウ 周藤 +シュウトウ 周東 +シュウドウ 周藤 +シュウドウ 集堂 +シュウドウ 秀働 +シュウドウ 秋堂 +ジュウドウ 重堂 +シュウトク 秀徳 +ジュウトメ 重留 +シュウドリ 就鳥 +ジュウトリ 十鳥 +ジュウナ 重名 +シュウナイ 周内 +ジュウナカ 十中 +シュウナン 秀南 +ジュウニ 十二 +ジュウニ 従二 +ジュウニ 從二 +ジュウニショ 十二所 +ジュウニチョウ 十二町 +ジュウニチョウ 十二丁 +ジュウニノ 十二野 +ジュウニバヤシ 十二林 +ジュウニムラ 十二村 +ジュウニヤ 十二谷 +ジュウニヤ 従二谷 +ジュウニヤク 十二役 +ジュウニリ 十二里 +ジュウネン 十念 +シュウノ 秀野 +シュウノ 周野 +ジュウノ 重野 +ジュウノ 十野 +シュウノウ 収納 +ジュウバ 十場 +ジュウバシ 重橋 +シュウハラ 周原 +ジュウバル 十原 +ジュウビシ 十菱 +ジュウブ 十部 +ジュウフク 重福 +シュウホウ 周宝 +シュウホウ 周寳 +シュウマ 周磨 +ジュウマ 重間 +ジュウマツ 十松 +ジュウマツ 住松 +ジュウマン 十万 +ジュウマン 十萬 +シュウミ 洲見 +ジュウミ 十見 +シュウムラ 周村 +ジュウメン 重面 +シュウモト 周本 +シュウモト 修本 +ジュウモン 重門 +ジュウモンジ 十文字 +ジュウモンジ 重文字 +ジュウモンチ 十門地 +シュウヤ 終夜 +ジュウヤク 十役 +ジュウヤマ 重山 +ジュウラ 寿浦(壽浦) +ジュウラク 十楽 +ジュウラク 重楽(重樂) +ジュウラクジ 十楽寺 +シュウリ 修理 +ジュウリ 重里 +ジュウリョウザワ 十良沢 +ジュウリョウザワ 十良澤 +ジュウリンジ 重林寺 +ジュウレンジ 十連地 +ジュウロウ 十郎 +ジュウロウ 十良 +ジュウロウ 重郎 +ジュウロウ 重良 +ジュウロウザワ 十良澤 +シュウワ 周輪 +シュウワキ 集𪚲 +シュウワキ 𠍱𪚲 +ジュエン 寿円 +ジュエン 壽圓 +ジュオ 寿尾(壽尾) +ジュカイ 寿海(壽海) +ジュガク 寿岳 +ジュガミ 樹神 +シュガメ 朱亀 +シュカワ 朱川 +ジュキ 寿木 +シュギョウ 執行 +シュギョウ 修行 +シュギョウ 修業 +シュク 宿久 +シュク 珠玖 +シュク 珠久 +シュク 宿 +シュクイ 宿井 +シュクイン 宿院 +シュクオカ 宿岡 +シュクグチ 宿口 +シュクサイ 淑済 +シュクザキ 宿崎 +シュクサワ 宿沢 +シュクザワ 宿沢 +シュクザワ 宿澤 +シュクシマ 宿島 +シュクタ 宿田 +シュクダ 宿田 +ジュクタ 熟田 +シュクタニ 宿谷 +シュクタニ 縮谷 +シュクデ 宿出 +シュクナ 宿名 +シュクナミ 宿南 +シュクナミ 宿波 +ジュクナミ 十九波 +シュクニシ 宿西 +シュクノ 宿野 +シュクノベ 宿野部 +シュクノベ 宿野辺 +シュクハラ 宿原 +ジュクハラ 宿原 +シュクベ 祝部 +シュクボ 宿母 +シュクマヤ 宿間谷 +シュクミネ 祝嶺 +シュクモ 宿茂 +シュクモリ 宿森 +シュクヤ 宿谷 +シュクヤ 宿屋 +シュクリ 宿利 +シュクリ 宿里 +シュクリ 宿理 +シュクワ 宿輪 +シュケ 朱家 +シュケ 珠家 +ジュゲ 樹下 +ジュケイ 寿慶 +ジュケイ 壽慶 +シュゴ 守護 +シュコウ 酒迎 +シュコウ 珠光 +ジュコウ 寿孝 +ジュコウ 寿光 +ジュザキ 壽崎 +シュザヤ 朱鞘 +シュザワ 珠沢(珠澤) +シュザワ 首澤 +シュシ 酒司 +シュシ 酒肆 +シュジ 種治 +シュジ 主侍 +ジュジ 寿時 +ジュジ 壽時 +シュジモト 主地本 +シュジャク 朱雀 +ジュショウ 壽昌 +ジュズ 珠数 +ジュズ 珠數 +シュズイ 守随 +シュズイ 守隨 +シュセキ 手跡 +シュゼンジ 朱膳寺 +シュゼンジ 修善寺 +シュゾウ 酒造 +シュダ 朱田 +シュダ 首田 +シュダイ 首代 +ジュダイ 寿台 +ジュダイ 壽臺 +シュダカ 首高 +シュタニ 主谷 +シュタラ 修多羅 +シュツウ 朱通 +ジュッコク 十石 +シュッセ 出世 +ジュツセ 術勢 +シュッタ 習田 +シュッチ 出地 +シュット 出雲 +シュツド 出渡 +シュットウ 出頭 +ジュップ 十府 +シュツボ 珠坪 +シュデ 主出 +シュド 朱戸 +シュトウ 首藤 +シュトウ 周藤 +シュトウ 主藤 +シュトウ 首籐 +シュトウ 朱桃 +シュトウ 執頭 +シュトウ 主頭 +シュトウ 朱藤 +シュトウ 首東 +シュドウ 首藤 +シュドウ 主藤 +シュドウ 朱通 +シュドウ 首籐 +シュドウ 酒道 +シュドウ 酒藤 +シュドウ 首道 +ジュトウ 寿藤 +ジュトウ 壽藤 +ジュトク 寿徳 +ジュトク 壽徳 +シュナガ 首長 +ジュノ 寿野 +ジュノ 樹野 +ジュノ 壽野 +シュノオ 首野尾 +シュノリ 守法 +シュハマ 主浜 +シュハマ 主濱 +シュハラ 主原 +シュビキ 首尾木 +ジュフク 寿福 +ジュフク 壽福 +ジュフクイン 寿福院(壽福院) +シュフノ 周布野 +シュフモト 周布本 +シュミヤ 朱宮 +ジュミョウ 寿命 +ジュミョウ 壽命 +シュムタ 朱牟田 +シュムラ 種村 +シュメ 主馬 +ジュメイ 寿明 +シュメノ 主馬野 +シュモト 朱本 +ジュモンジ 寿文字 +シュヤ 朱谷 +シュヤ 朱矢 +ジュヤナギ 寿柳 +ジュヤナギ 壽柳 +シュヤマ 朱山 +ジュヤマ 寿山 +ジュヤマ 壽山 +シュラク 酒楽 +ジュラク 寿楽(壽樂・壽楽) +ジュラクイン 受楽院 +シュリ 首里 +シュリタ 修理田 +ジュリョウ 受領 +ジュリョウ 寿量(壽量) +シュレスタ 守礼寿多 +ジュロウ 寿老(壽老) +シュワリ 種昂 +シュワルツ 主和津 +シュン 俊 +シュン 峻 +ジュン 潤 +ジュン 順 +ジュン 淳 +ジュンイ 順井 +ジュンカ 儁侃 +ジュンキ 準規 +ジュンキョウジ 順教寺 +ジュンクウ 純空 +ジュンケ 順毛 +シュンケイ 春慶 +ジュンサイ 順西 +シュンショウ 春正 +ジュンセン 順船 +ジュンタ 順田 +ジュンダ 順田 +シュンチョウロウ 春潮楼 +シュント 春戸 +シュントウ 春藤 +シュンドウ 春藤 +シュンドウ 俊藤 +シュンドウ 春堂 +シュンドウ 俊道 +シュンドウ 偆道 +ジュンドウ 順藤 +ジュンドウ 順道 +ジュントク 順徳 +ジュンニシ 順西 +ジュンプウ 順風 +ジュンモト 順本 +ジュンヤス 順安 +ジュンヨシ 順吉 +ショウ 庄 +ショウ 松 +ショウ 荘 +ショウ 正 +ショウ 尚 +ショウ 昌 +ショウ 敞 +ショウ 莊 +ショウ 翔 +ショウ 諸宇 +ジョウ 城 +ジョウ 篠 +ジョウ 定 +ジョウ 条 +ジョウ 條 +ジョウ 情 +ジョウ 丈 +ジョウ 刁 +ショウアミ 正阿弥 +ショウアミ 正阿彌 +ジョウアン 城庵 +ジョウアン 浄安 +ショウイ 正井 +ショウイ 庄井 +ショウイ 聖居 +ジョウイ 上井 +ジョウイ 城井 +ジョウイ 丈居 +ジョウイエ 城家 +ショウイケ 菖池 +ジョウイケ 丈池 +ジョウイケ 城池 +ジョウイシ 城石 +ジョウイシ 定石 +ショウイチ 菖一 +ショウイチ 正一 +ショウイチ 正市 +ジョウイチ 城市 +ジョウイチ 城一 +ジョウイチ 上一 +ショウイチゾノ 正市園 +ショウイリキ 正入木 +ジョウイワ 城岩 +ショウイン 正印 +ショウイン 正因 +ショウウチ 庄内 +ジョウウチ 城内 +ショウウン 祥雲 +ジョウウンテン 上運天 +ショウエ 庄江 +ジョウエ 城江 +ジョウエ 定江 +ショウエイ 正永 +ショウエイ 松榮 +ジョウエイ 定栄 +ジョウエイ 城永 +ジョウエイ 定榮 +ジョウエイ 常栄 +ジョウエイ 浄永 +ジョウエイ 定衛 +ショウエン 正円 +ショウエン 正圓 +ジョウエン 上円 +ジョウエン 上圓 +ジョウエンジ 浄円寺 +ジョウオ 城尾 +ジョウオ 城生 +ジョウオンジ 城音寺 +ショウカ 荘加 +ショウカ 生賀 +ショウカ 庄下 +ショウカ 生嘉 +ショウカ 商家 +ショウカ 庄加 +ショウカ 莊加 +ショウガ 生賀 +ショウガ 庄賀 +ショウガ 正賀 +ショウガ 勝賀 +ジョウカ 城下 +ジョウカ 上下 +ジョウカ 上加 +ジョウカ 常家 +ジョウカ 城加 +ジョウガ 城賀 +ショウカイ 正海 +ショウカイ 性海 +ショウガイ 正堺 +ジョウカイ 上海 +ジョウカイ 城海 +ショウガイト 庄垣内 +ジョウガイト 上垣内 +ショウガキ 正垣 +ショウガキ 庄垣 +ショウガキ 正墻 +ジョウカギ 上鍵 +ジョウガキ 城垣 +ジョウガキ 状書 +ショウカキウチ 庄垣内 +ショウガキウチ 庄垣内 +ショウカク 正角 +ショウカク 正覚 +ショウカク 少覚 +ショウカク 正覺 +ショウガク 正覚 +ショウガク 正學 +ジョウカク 上角 +ジョウカク 城角 +ジョウガサキ 城ケ崎 +ジョウガサキ 城ケ埼 +ジョウカジ 定梶 +ショウガセ 勝賀瀬 +ジョウガソノ 城ケ園 +ショウガタ 庄形 +ジョウガタキ 城ケ滝 +ジョウガタキ 城ケ瀧 +ジョウガタニ 上ケ谷 +ジョウガタニ 城ケ谷 +ショウガヅカ 生姜塚 +ジョウガツジ 城ケ辻 +ショウガツタニ 正月谷 +ショウガノ 勝賀野 +ジョウガノ 城ケ野 +ジョウガハナ 城ケ端 +ジョウガハラ 城ケ原 +ジョウガヒラ 城ケ平 +ジョウガフキ 上ケ吹 +ジョウガマ 城釜 +ショウガミ 正神 +ショウガミネ 正ケ峯 +ショウガミネ 正ケ峰 +ジョウガミネ 城ケ峰 +ジョウガモト 城賀本 +ショウカワ 正川 +ショウカワ 庄川 +ショウカワ 荘川 +ショウガワ 正川 +ジョウカワ 條川 +ジョウカワ 条川 +ジョウカワ 浄川 +ジョウカワ 定川 +ジョウガワ 上川 +ジョウガワラ 城川原 +ショウガン 正元 +ショウガン 正願 +ジョウカン 上間 +ジョウカン 浄閑(淨閑) +ジョウカン 上官 +ジョウカン 上勧 +ジョウカン 上澗 +ジョウカン 城勘 +ジョウカン 錠貫 +ジョウガン 上岸 +ジョウガン 城岸 +ジョウガン 成願 +ジョウガン 上願 +ショウガンジ 正願地 +ショウガンジ 正願寺 +ショウキ 小木 +ショウキ 正木 +ショウキ 笑喜 +ショウキ 庄木 +ショウキ 将基 +ショウキ 晶貴 +ショウキ 將基 +ジョウキ 上木 +ジョウキ 城木 +ジョウキ 定木 +ジョウキ 常喜 +ジョウギ 定木 +ジョウギ 常喜 +ジョウギク 城聞 +ショウキツ 少橘 +ショウギハラ 正儀原 +ショウギメン 将基面 +ショウキュウ 正久 +ジョウキュウ 上久 +ジョウキョウ 上恐 +ショウギン 正銀 +ジョウキン 上金 +ジョウキン 城近 +ショウキンジ 正金寺 +ショウク 正工 +ジョウグ 浄弘(淨弘) +ショウグチ 将口(將口) +ショウグチ 庄口 +ジョウグチ 上口 +ジョウグチ 城口 +ジョウグチ 丈口 +ショウクボ 庄窪 +ショウクラ 庄倉 +ジョウクラ 城倉 +ショウゲ 庄下 +ショウゲ 正下 +ショウゲ 正化 +ショウゲ 称解(稱解) +ジョウケ 上家 +ジョウケ 城家 +ジョウケ 情家 +ジョウゲ 上下 +ジョウゲ 錠解 +ショウケイ 正慶 +ショウケイ 庄慶 +ショウケイ 紹慶 +ジョウケイ 常慶 +ジョウケイ 浄慶 +ジョウケイ 上慶 +ジョウケイ 淨慶 +ジョウケダ 上化田 +ショウゲツ 松月 +ショウゲツ 正月 +ジョウゲツ 上月 +ジョウゲツ 城月 +ショウケン 正見 +ショウゲン 正源 +ショウゲン 正元 +ショウゲン 庄源 +ショウゲン 正玄 +ショウゲン 正現 +ショウゲン 生源 +ジョウケン 上見 +ジョウケン 浄謙(淨謙) +ジョウゲン 上源 +ジョウゲン 常玄 +ジョウゲン 条元 +ショウゲンジ 生源寺 +ショウゲンジ 正源司 +ショウゲンジ 正源寺 +ジョウゲンジ 常間地 +ショウコ 庄古 +ショウゴ 正後 +ショウゴ 庄後 +ジョウコ 上古 +ジョウコ 城古 +ジョウゴ 城後 +ショウコウ 正光 +ショウコウ 商光 +ジョウコウ 上甲 +ジョウコウ 常光 +ジョウコウ 上光 +ジョウコウ 城向 +ジョウコウ 城光 +ジョウコウ 浄光 +ジョウコウ 城甲 +ジョウコウ 常幸 +ジョウコウ 丈光 +ジョウコウ 上香 +ジョウコウ 定講 +ジョウコウ 淨光 +ショウコウジ 松向寺 +ショウコウジ 正光寺 +ジョウコウジ 城光寺 +ジョウコウジ 常光寺 +ジョウコウジ 城光治 +ショウコウチ 小河内 +ジョウコク 上黒 +ジョウコクイン 常国院 +ジョウコシ 城越 +ジョウゴシ 城腰 +ジョウゴシ 上腰 +ジョウコデン 上古殿 +ショウゴメ 正込 +ショウゴモリ 庄籠 +ショウゴモリ 正込 +ショウゴモリ 庄篭 +ショウコンジ 正根寺 +ショウコンチ 正根知 +ショウザ 正座 +ジョウザ 城座 +ジョウサイ 城西 +ジョウサイ 上才 +ショウサカ 正坂 +ジョウサカ 上坂 +ジョウサカ 城坂 +ジョウザカ 上坂 +ジョウザカ 城坂 +ショウザカイ 正堺 +ショウザカイ 庄境 +ショウサキ 庄崎(庄嵜) +ショウザキ 庄崎(庄嵜) +ショウザキ 正崎 +ショウザキ 正嵜 +ジョウサキ 上崎 +ジョウサキ 城崎 +ジョウサキ 城嵜 +ジョウザキ 上崎 +ジョウザキ 城崎 +ショウサク 少作 +ショウサク 昇作 +ジョウサク 定作 +ショウザコ 正迫 +ジョウサコ 城迫 +ジョウサコ 丈迫 +ジョウサコ 城浴 +ショウザワ 正沢(正澤) +ジョウザワ 城沢 +ジョウザワ 城澤 +ショウシ 荘子 +ショウシ 商史 +ショウジ 庄司 +ショウジ 東海林 +ショウジ 庄子 +ショウジ 小路 +ショウジ 荘司 +ショウジ 正司 +ショウジ 正路 +ショウジ 生地 +ショウジ 昌子 +ショウジ 正治 +ショウジ 生子 +ショウジ 障子 +ショウジ 勝治 +ショウジ 小司 +ショウジ 正地 +ショウジ 少路 +ショウジ 庄治 +ショウジ 荘子 +ショウジ 勝二 +ショウジ 庄路 +ショウジ 精進 +ショウジ 東海枝 +ショウジ 小治 +ショウジ 昌司 +ショウジ 将司 +ショウジ 昇地 +ショウジ 正寿 +ショウジ 庄地 +ショウジ 莊司 +ショウジ 正寺 +ショウジ 生次 +ショウジ 政司 +ショウジ 正士 +ショウジ 正志 +ショウジ 正次 +ショウジ 正示 +ショウジ 生司 +ショウジ 圧司 +ショウジ 小地 +ショウジ 床司 +ショウジ 鐘司 +ショウジ 鐘治 +ショウジ 生治 +ショウジ 將司 +ショウジ 尚司 +ショウジ 昭司 +ジョウシ 城市 +ジョウシ 城子 +ジョウシ 城使 +ジョウシ 上志 +ジョウシ 定師 +ジョウシ 條紫 +ジョウジ 上地 +ジョウジ 城地 +ジョウジ 上路 +ジョウジ 定地 +ジョウジ 条時 +ジョウジ 條時 +ショウジアイ 小路合 +ショウジガミ 障子上 +ショウジガワ 障子川 +ショウジキ 正直 +ジョウシキ 条敷(條敷) +ジョウジキ 定直 +ショウジグチ 小路口 +ショウジグチ 障子口 +ショウジケン 庄司見 +ショウジザワ 庄司沢 +ショウジザワ 庄司澤 +ショウジゾノ 正司園 +ショウシタ 庄下 +ショウシダ 障子田 +ショウジダ 障子田 +ジョウシタ 城下 +ジョウシタ 丈下 +ジョウジタ 上次田 +ショウジナガ 小路永 +ショウジノ 庄司野 +ショウジバタ 正地畠 +ショウジバタケ 庄地畠 +ショウジバラ 小地原 +ショウシマ 正島 +ショウジマ 生島 +ショウジマ 生嶋 +ショウジマ 庄島 +ショウジマ 庄嶋 +ショウジマ 正島 +ショウジマ 生嶌 +ショウジマ 舛島 +ショウジマ 正嶋 +ショウジマ 荘島 +ジョウシマ 上島 +ジョウシマ 上嶋 +ジョウシマ 城島 +ジョウシマ 定島 +ジョウシマ 定嶋 +ジョウジマ 上島 +ジョウジマ 上嶋 +ジョウジマ 城島 +ジョウジマ 條島 +ジョウジマ 城嶋 +ジョウジマ 定島 +ジョウジマ 乗島 +ジョウジマ 丈島 +ジョウジマ 城嶌 +ジョウジマ 情島 +ショウジマル 小路丸 +ショウシャ 正者 +ショウジャ 正者 +ショウジャ 精舎 +ショウジヤ 小路谷 +ジョウシャ 城者 +ジョウシャ 錠者 +ジョウシャ 定者 +ジョウシャ 上者 +ジョウシャ 定舎 +ジョウジャ 錠者 +ジョウジャ 定蛇 +ジョウジャ 上者 +ジョウジャ 定舎 +ショウシャク 正尺 +ショウジャク 将積 +ショウジャク 正尺 +ショウジャク 將積 +ショウジュ 松寿 +ショウジュ 正寿 +ショウジュ 尚樹 +ショウジュ 松壽 +ショウジュ 正壽 +ショウジュ 摂受(攝受) +ショウジュウ 正重 +ショウジュウ 正住 +ジョウシュウ 上洌 +ジョウジュウ 上重 +ジョウジュウ 城重 +ショウショ 正所 +ショウジョ 荘所 +ジョウショ 上所 +ジョウショ 城所 +ショウジョウ 正城 +ショウジョウ 猩々 +ショウジョウ 庄条 +ショウジョウ 庄條 +ショウジョウ 正条 +ショウジョウ 正條(正絛) +ジョウショウ 常少 +ジョウショウ 浄聖 +ジョウショウ 条生 +ジョウジョウ 上條 +ジョウジョウ 城定 +ジョウジョウ 亟々 +ジョウジョウ 城条 +ジョウジョウ 条々 +ジョウジョウ 條々 +ジョウジョウ 上烝(上焏) +ジョウジョウ 城條 +ショウジョウヤ 猖々谷 +ショウジリ 庄尻 +ショウシン 正信 +ショウシン 正心 +ショウシン 正真(正眞) +ジョウシン 上新 +ジョウシン 常信 +ジョウシン 上信 +ジョウシン 城信 +ショウス 正司 +ショウズ 小津 +ショウズ 生水 +ショウズ 正津 +ショウズ 小豆 +ショウズ 生頭 +ショウズ 少数 +ショウズ 庄津 +ショウズ 正図(正圖) +ジョウス 城須 +ショウズイ 生水 +ショウズイ 勝瑞 +ショウズイ 正瑞 +ショウズイ 祥瑞 +ショウズイ 正随(正隨) +ショウズイ 正端 +ショウスウ 少数 +ショウスエ 庄末 +ショウスエ 庄未 +ショウズカ 昇塚 +ジョウズカ 定塚 +ジョウズカ 城塚 +ショウズガワ 小豆川 +ショウズグチ 生水口 +ショウスケ 正祐 +ショウズザワ 小豆沢 +ショウズシマ 小豆島 +ショウズシマ 小豆嶋 +ショウズデ 生水出 +ショウズハラ 小豆原 +ショウズミ 庄寿見 +ショウセ 庄瀬 +ショウセ 庄勢 +ショウゼ 生瀬 +ジョウセ 上瀬 +ショウセイ 正清 +ジョウセイ 城生 +ジョウセイ 常清 +ジョウセイ 條生 +ショウゼヤ 生瀬谷 +ショウセン 性全 +ショウセン 承先 +ショウゼン 小善 +ショウゼン 少前 +ショウゼン 性全 +ショウゼン 正善 +ショウゼン 聖前 +ショウゼン 正膳 +ジョウセン 上仙 +ジョウセン 定仙 +ジョウセン 浄泉 +ジョウセン 淨泉 +ジョウセン 城仙 +ジョウゼン 城前 +ジョウゼン 上善 +ジョウゼン 浄善 +ショウセンジ 正泉寺 +ジョウセンジ 上仙地 +ジョウソウ 上湊 +ショウゾウジ 正蔵寺 +ジョウソク 丈束 +ジョウゾノ 城園 +ショウタ 正田 +ショウタ 庄田 +ショウタ 庄太 +ショウタ 正多 +ショウダ 小田 +ショウダ 生田 +ショウダ 勝田 +ショウダ 正田 +ショウダ 庄田 +ショウダ 荘田 +ショウダ 照田 +ショウダ 敞田 +ショウダ 将田(將田) +ショウダ 鐘田 +ショウダ 少田 +ショウダ 昇田 +ショウダ 粧田 +ショウダ 性田 +ショウダ 莊田 +ショウダ 湘田 +ショウダ 章田 +ジョウタ 上田 +ジョウタ 城田 +ジョウタ 丈田 +ジョウタ 条田 +ジョウタ 譲田 +ジョウダ 定田 +ショウタイ 正躰 +ショウダイ 小代 +ショウダイ 正代 +ショウダイ 小岱 +ショウダイ 勝代 +ショウダイ 尚台 +ジョウタイ 常泰 +ジョウタイ 上泰 +ジョウダイ 上代 +ジョウダイ 城代 +ジョウダイ 城台 +ジョウダイ 上台(上臺) +ジョウダイ 城弟 +ジョウダイ 城臺(城薹) +ジョウダイ 城第 +ショウタカ 昇高 +ジョウタキ 上滝 +ジョウタキ 上瀧 +ショウタケ 庄武 +ジョウタケ 城竹 +ジョウタツ 丈達 +ジョウタツ 上達 +ショウダテ 庄館 +ショウダテ 庄舘 +ショウタニ 庄谷 +ショウタニ 少谷 +ジョウタニ 上谷 +ジョウタニ 城谷 +ジョウタニ 場谷 +ジョウタニ 常谷 +ジョウタニ 畳谷 +ジョウタニ 条谷 +ジョウタニ 丈谷 +ジョウタニ 條谷 +ショウダヒラ 庄田平 +ショウダヤマ 正田山 +ジョウダン 上段 +ジョウダン 上団(上團) +ショウチ 菖池 +ショウチ 昇地 +ショウチ 勝知 +ジョウチ 城地 +ジョウチ 除地 +ジョウチ 状地 +ジョウチ 上知 +ショウチク 松竹 +ショウチク 正竹 +ジョウチャ 上茶 +ショウツ 正津 +ショウヅ 生水 +ショウヅ 正津 +ショウツウ 正通 +ジョウツウ 常通 +ショウヅカ 昇塚 +ジョウツカ 城塚 +ジョウツカ 丈束 +ジョウヅカ 定塚 +ジョウヅカ 上塚 +ジョウヅカ 城塚 +ジョウヅカ 定司 +ジョウヅクリ 定作 +ショウツボ 庄坪 +ジョウヅメ 城詰 +ジョウヅメ 錠詰(錠誥) +ジョウヅメ 常詰 +ジョウヅメ 定詰 +ショウテ 正手 +ショウデ 正手 +ショウデ 正出 +ショウデ 庄出 +ジョウテ 上手 +ショウデン 正伝 +ショウデン 正傳 +ジョウテン 上天 +ジョウデン 城田 +ジョウデン 定田 +ショウト 正戸 +ショウト 庄戸 +ショウド 清土 +ショウド 正渡 +ショウド 庄戸 +ジョウト 城戸 +ジョウト 上戸 +ジョウト 上斗 +ジョウト 上登 +ジョウド 城戸 +ジョウド 浄土 +ジョウド 城土 +ジョウド 常門 +ジョウドイ 上土井 +ジョウドイ 城土井 +ショウトウ 正藤 +ショウトウ 正東 +ショウトウ 正当 +ショウトウ 正頭 +ショウドウ 正藤 +ショウドウ 庄堂 +ショウドウ 正道 +ショウドウ 庄藤 +ショウドウ 正堂 +ショウドウ 勝堂 +ショウドウ 将堂 +ショウドウ 菖藤 +ショウドウ 鐘堂 +ショウドウ 將道 +ジョウトウ 上東 +ジョウトウ 上藤 +ジョウトウ 上当 +ジョウトウ 上當 +ジョウトウ 城頭 +ジョウドウ 上堂 +ジョウドウ 城道 +ショウドウジ 正道寺 +ジョウドオリ 常通 +ショウトク 正徳 +ショウトク 聖徳 +ショウトク 少徳 +ジョウトク 常徳 +ジョウトク 浄徳 +ジョウトク 上徳 +ジョウトク 焏徳 +ジョウトク 城徳 +ジョウトク 定徳 +ジョウトク 淨徳 +ジョウトク 烝徳 +ジョウトク 丞徳 +ジョウドジ 浄土寺 +ショウドシマ 小豆島 +ショウドノ 正殿 +ジョウナ 常名 +ショウナイ 庄内 +ショウナイ 生内 +ショウナイ 正内 +ショウナイ 少内 +ジョウナイ 城内 +ジョウナイ 上内 +ジョウナイ 錠内 +ジョウナイ 浄内 +ジョウナイ 条内 +ジョウナイ 條内 +ショウナイヤ 庄内谷 +ジョウナオ 城直 +ショウナカ 正中 +ショウナカ 荘中 +ショウナカ 庄中 +ショウナカ 笑中 +ショウナガ 正長 +ジョウナカ 城中 +ショウナゴ 少名子 +ジョウナリ 城成 +ショウナン 生南 +ジョウナン 上南 +ジョウナン 城南 +ショウニ 勝二 +ショウニ 少弐 +ショウニ 小児 +ショウニ 少貳 +ショウニ 少貮 +ショウニシ 正西 +ジョウニシ 上西 +ジョウニン 上仁 +ジョウニン 上人 +ショウネ 生根 +ジョウネ 上根 +ジョウネ 城根 +ジョウネ 上禰 +ジョウネン 上念 +ジョウネン 常念 +ジョウネン 城念 +ジョウネン 浄念 +ジョウネン 上年 +ジョウネン 淨念 +ショウノ 生野 +ショウノ 庄野 +ショウノ 正野 +ショウノ 荘野 +ショウノ 醤野 +ショウノ 荘埜 +ショウノ 正埜 +ショウノ 菖野 +ショウノ 庄埜 +ショウノ 将野 +ショウノ 庄ノ +ショウノ 昌野 +ショウノ 鐘野 +ショウノ 莊埜 +ショウノ 昭野 +ジョウノ 城野 +ジョウノ 情野 +ジョウノ 城生 +ジョウノ 條野 +ジョウノ 城埜 +ジョウノ 条野 +ジョウノ 上能 +ジョウノ 丈野 +ジョウノ 浄野 +ジョウノ 城生野 +ジョウノ 焏野 +ジョウノ 野 +ジョウノ 錠野 +ジョウノ 淨野 +ジョウノ 烝野 +ジョウノ 條乃 +ショウノウ 正能 +ショウノウ 庄納 +ショウノウ 松納 +ショウノウ 生能 +ジョウノウ 上農 +ジョウノウ 城生 +ジョウノウ 城納 +ジョウノウ 上能 +ショウノウエ 荘野上 +ジョウノウエ 城ノ上 +ジョウノウチ 城内 +ジョウノウチ 城之内 +ジョウノウチ 城ノ内 +ジョウノウチ 常ノ内 +ジョウノオ 城尾 +ジョウノオ 城之尾 +ジョウノクチ 城ノ口 +ジョウノグチ 城野口 +ショウノコシ 正ノ腰 +ショウノコシ 正腰 +ジョウノコシ 城越 +ジョウノコシ 城腰 +ジョウノコシ 城生越 +ショウノザキ 正野崎 +ショウノザキ 庄野崎 +ジョウノシタ 城之下 +ジョウノシタ 城ノ下 +ジョウノシタ 上ノ下 +ジョウノシタ 上之下 +ジョウノソノ 城之園 +ジョウノソノ 城之薗 +ジョウノソノ 城ノ園 +ジョウノツカ 城塚 +ジョウノハナ 城之鼻 +ジョウノミチ 上ノ道 +ショウノヤ 庄野屋 +ジョウノリ 上乗 +ショウハ 荘羽 +ショウバ 小場 +ジョウバ 上羽 +ジョウバ 上馬 +ショウハク 正白 +ショウバコ 正箱 +ショウハタ 正畑 +ショウハタ 庄畑 +ショウハタ 庄畠 +ジョウハタ 上畑 +ショウバタケ 正畑 +ショウバタケ 正畠 +ショウハチ 庄八 +ジョウバチ 上鉢 +ショウハツ 正初 +ジョウハナ 城鼻 +ショウバヤシ 正林 +ショウバヤシ 庄林 +ショウバヤシ 荘林 +ショウバヤシ 生林 +ジョウバヤシ 上林 +ジョウバヤシ 城林 +ショウハラ 正原 +ショウハラ 庄原 +ショウハラ 昌原 +ショウハラ 匠原 +ショウハラ 荘原 +ショウハラ 称原(稱原) +ショウバラ 庄原 +ショウバラ 荘原 +ショウバラ 称原(稱原) +ジョウハラ 焏原 +ジョウハラ 蒸原 +ジョウハラ 丞原 +ジョウハラ 烝原 +ジョウバラ 上原 +ジョウバラ 城原 +ジョウハン 上半 +ショウヒ 松扉 +ジョウビ 城尾 +ジョウヒラ 上平 +ジョウヒラ 城平 +ショウヒロ 正広(正廣) +ジョウヒロ 常広 +ジョウヒロ 定広 +ジョウヒロ 常廣 +ショウブ 菖蒲 +ショウブ 小部 +ショウブ 生部 +ショウブ 正部 +ショウブ 庄部 +ショウブ 正生 +ショウブ 正歩 +ショウブ 正武 +ジョウフ 上符 +ジョウフ 上不 +ジョウフ 上布 +ジョウブ 常風 +ショウブイケ 菖蒲池 +ショウブイケ 菖池 +ショウフウ 松風 +ショウブオク 菖蒲奥 +ショウブカワ 菖蒲川 +ショウブカワ 正部川 +ショウブガワ 菖蒲川 +ショウフク 正福 +ショウフク 庄福 +ジョウフク 城福 +ジョウフク 常福 +ジョウフク 浄福 +ショウフクジ 正福寺 +ショウブケ 正部家 +ショウブケ 正武家 +ショウフサ 生父佐 +ショウブサコ 菖蒲迫 +ショウブサコ 正武迫 +ショウブザコ 菖蒲迫 +ショウブザコ 正武迫 +ショウブザコ 菖蒲廻 +ショウブサワ 菖蒲澤 +ショウブザワ 菖蒲沢 +ショウブザワ 勝負沢 +ショウブザワ 勝負澤 +ショウブザワ 菖蒲澤 +ショウフダ 正札 +ショウフダ 正夫田 +ショウブタ 菖蒲田 +ショウブダ 菖蒲田 +ショウブダ 正武田 +ショウブタニ 菖蒲谷 +ショウブダニ 菖蒲谷 +ジョウブツ 城物 +ショウブヤ 菖蒲谷 +ショウブル 正古 +ショウブン 正分 +ジョウブン 上分 +ショウブンコ 勝文子 +ショウベ 生部 +ジョウベ 条辺(条邊) +ジョウベ 條辺 +ジョウヘイ 城平 +ジョウベットウ 定別当 +ジョウベットウ 定別當 +ショウホ 正保 +ショウホ 荘保 +ショウホ 小歩 +ショウボ 正保 +ショウボ 正甫 +ジョウホ 上保 +ジョウホ 常保 +ショウホウ 正宝 +ショウホウ 正法 +ショウホウ 正方 +ショウホウ 正寶 +ショウホウ 正寳 +ジョウホウ 城宝 +ジョウホウ 上法 +ジョウホウ 城方 +ジョウホウ 常法 +ジョウホウ 城寶 +ジョウホウ 城寳 +ジョウボウ 上坊 +ジョウボウ 浄坊 +ショウホウイン 正法院 +ショウホウジ 正法地 +ショウボウジ 正坊地 +ジョウホウジ 浄法寺 +ジョウホウジ 常法寺 +ジョウホウジ 淨法寺 +ジョウボウジ 浄法寺 +ジョウボウジ 上坊寺 +ジョウボウジ 淨法寺 +ショウホウチ 正法地 +ジョウボシ 上星 +ショウボリ 庄堀 +ジョウボリ 城堀 +ジョウボンデン 定標 +ジョウマ 城間 +ジョウマ 上間 +ジョウマ 丈間 +ジョウマイ 城米 +ショウマエ 正前 +ジョウマエ 城前 +ジョウマエ 常前 +ジョウマエ 錠前 +ジョウマス 定益 +ショウマタ 正又 +ショウマチ 正町 +ジョウマツ 徐松 +ショウマツモト 正松本 +ショウマル 正丸 +ジョウマル 城丸 +ジョウマル 上丸 +ショウマン 正満 +ショウマン 庄満 +ジョウマン 上万 +ジョウマン 上萬 +ジョウマン 定満 +ショウミ 正見 +ショウミ 庄見 +ショウミ 小美 +ショウミ 正美 +ショウミ 正味 +ショウミ 正弥(正彌) +ジョウミ 城美 +ジョウミ 浄見 +ジョウミ 上己 +ジョウミ 上巳 +ジョウミ 紹美 +ショウミズ 正水 +ショウミツ 正光 +ジョウミドウ 城御堂 +ジョウミネ 城峯 +ジョウミャク 静脈 +ジョウミョウ 城明 +ジョウミョウ 常明 +ジョウムタ 上牟田 +ショウムラ 正村 +ショウムラ 庄村 +ショウムラ 荘村 +ショウムラ 床村 +ジョウムラ 上村 +ジョウムラ 城村 +ジョウムラ 定村 +ジョウムラ 饒村 +ジョウムラ 丞村 +ジョウムラ 亟村 +ジョウメイ 上銘 +ショウメン 正面 +ジョウメン 定免 +ジョウメン 上面 +ジョウメン 定面 +ショウモ 庄毛 +ショウモト 正本 +ショウモト 庄本 +ショウモト 昌本 +ショウモト 章本 +ショウモト 姓本 +ジョウモト 上本 +ジョウモト 城本 +ジョウモト 上元 +ジョウモト 城元 +ジョウモト 錠本 +ジョウモト 條本 +ショウモリ 庄盛 +ショウモリ 鐘森 +ショウモリ 庄森 +ジョウモリ 城森 +ジョウモリ 城守 +ショウモン 庄門 +ショウモンジ 松門字 +ショウモンジ 松門寺 +ジョウモンジ 上文司 +ショウヤ 勝谷 +ショウヤ 勝屋 +ショウヤ 庄谷 +ショウヤ 正谷 +ショウヤ 庄屋 +ショウヤ 昌谷 +ショウヤ 庄矢 +ショウヤ 觴谷 +ジョウヤ 城谷 +ジョウヤ 常谷 +ジョウヤ 畳谷 +ジョウヤ 城家 +ジョウヤ 条谷 +ジョウヤ 定谷 +ジョウヤ 状家 +ショウヤウチ 庄谷内 +ジョウヤシキ 城屋敷 +ジョウヤブ 城籔 +ジョウヤブ 城薮(城藪) +ショウヤマ 庄山 +ショウヤマ 生山 +ショウヤマ 昌山 +ショウヤマ 正山 +ショウヤマ 荘山 +ショウヤマ 尚山 +ショウヤマ 承山 +ショウヤマ 圧山 +ジョウヤマ 上山 +ジョウヤマ 城山 +ジョウヤマ 浄山 +ショウユ 醤油 +ジョウユウ 定祐 +ジョウユウ 上祐 +ショウユヤ 醤油屋 +ジョウヨウ 上用 +ジョウラ 上良 +ジョウライ 上来 +ショウラク 正楽 +ショウラク 正樂 +ジョウラク 上楽 +ジョウラク 常楽(常樂) +ジョウラク 城楽 +ジョウラク 上樂 +ジョウラク 条楽 +ショウラクイ 正楽井(正樂井) +ショウラクジ 正楽寺 +ショウラクジ 正楽地(正樂地) +ジョウラクジ 常楽寺 +ショウリ 生利 +ショウリ 勝利 +ショウリ 正理 +ショウリキ 正力 +ショウリキ 勝力 +ジョウリキ 城力 +ジョウリク 上陸 +ショウリケン 松里軒 +ショウリュウジ 正立寺 +ショウリュウジ 青龍寺 +ジョウリョウ 上領 +ジョウリョウ 城領 +ショウリン 正林 +ジョウリン 盛林 +ショウリンジ 昌林寺 +ジョウリンボウ 常林坊 +ジョウリンボウ 上林房 +ジョウリンボウ 浄琳坊 +ショウレイ 庄礼 +ショウレイ 庄禮 +ショウレン 正連 +ジョウレン 定連 +ジョウレン 城連 +ジョウレン 条連 +ショウレンザン 正連山 +ショウロ 正路 +ショウロ 正露 +ジョウロク 丈六 +ショウロジ 正呂地 +ショウワ 尚和 +ショウワ 正和 +ショウワ 昭和 +ショウワキ 正脇 +ジョウワキ 城脇 +ショカ 諸家 +ショガ 所賀 +ショガミ 書上 +ジョガモト 城賀本 +ショカワ 塩川 +ショカワ 所川 +ショガワ 所河 +ショガワ 所川 +ジョガワ 除川 +ショキタ 諸喜田 +ショキダ 諸喜田 +ジョキュウ 如休 +ショク 植 +ショクタ 喰田 +ショクダ 喰田 +ショクラ 諸蔵 +ジョゲン 如見 +ショコ 初古 +ショコク 諸国 +ショコク 諸國 +ショザワ 所沢 +ショザワ 所澤 +ジョサワ 如沢 +ジョザワ 如沢 +ジョザワ 如澤 +ショシ 所司 +ショジ 所司 +ショジ 諸事 +ショシダ 小志田 +ショシネ 所神根 +ショシハラ 所司原 +ジョシブン 女子分 +ジョスイ 徐水 +ジョスイ 如水 +ジヨセ 地寄 +ジョセボ 乗正房 +ショダ 所田 +ジョダ 徐田 +ショダイ 初代 +ショダイ 所代 +ショタニ 所谷 +ショトウ 小藤 +ショドウ 初道 +ショトクジ 諸徳寺 +ジョナン 如南 +ジョノツカ 城塚 +ショノワキ 諸野脇 +ショハタ 所畑 +ジョフク 徐福 +ショホウ 所方 +ショミカワ 諸見川 +ショミジャ 諸見謝 +ショミタ 諸見田 +ショムラ 初村 +ショムラ 所村 +ジョムラ 除村 +ショムロ 諸室 +ジョモン 除門 +ショヤ 所谷 +ショヤマ 所山 +ジョヤマ 徐山 +ジョヤマ 如山 +ショロジ 正呂地 +ジョロバタ 女良畑 +シラ 志羅 +シラ 志良 +シラアト 白後 +シラアヤ 白綾 +シライ 白井 +シライ 白居 +シライ 白飯 +シライ 志良以 +シライ 白猪 +シライ 白伊 +ジライ 侍来 +シライケ 白池 +シライシ 白石 +シライソ 白磯 +シライタ 白板 +シライダ 白井田 +シライチ 白市 +シライト 白糸 +シライハラ 白井原 +シライワ 白岩 +シラウシ 白牛 +シラウチ 白内 +シラウメ 白梅 +シラウラ 白浦 +シラエ 白江 +シラエ 白栄 +シラエ 白榮 +シラエダ 白枝 +シラオ 白尾 +シラオウ 白応 +シラオカ 白岡 +シラオカワ 白男川 +シラオガワ 白男川 +シラオギ 白荻 +シラオク 白奥 +シラオヤ 白尾谷 +シラカ 白鹿 +シラガ 白神 +シラガ 白髪 +シラガ 白鹿 +シラガ 白賀 +シラカイ 白貝 +シラガイ 白貝 +シラカキ 白垣 +シラカキ 白柿 +シラガキ 白垣 +シラガキ 白柿 +シラガサワ 白ケ沢 +シラガサワ 白ケ澤 +シラカシ 白樫 +シラカシ 白柏 +シラカズ 白数 +シラカセ 白綛 +シラカタ 白方 +シラカタ 白潟 +シラカタ 白形 +シラカタ 白片 +シラカタ 白瀉 +シラガタ 白潟 +シラカド 白角 +シラカネ 白銀 +シラカネ 白金 +シラカネ 白兼 +シラガネ 白銀 +シラガネ 白金 +シラガネ 銀 +シラカバ 白椛 +シラカバ 白樺 +シラカハラ 白河原 +シラカベ 白壁 +シラカミ 白神 +シラカミ 白上 +シラカミ 白髪 +シラカミ 白紙 +シラガミ 白神 +シラガミ 白上 +シラガミ 白髪 +シラカワ 白川 +シラカワ 白河 +シラカワ 白側 +シラカワダ 白川田 +シラカワハラ 白川原 +シラカワベ 白川部 +シラカワベ 白河部 +シラカワラ 白河原 +シラキ 白木 +シラキ 新良貴 +シラキ 白城 +シラキ 白記 +シラキ 素木 +シラキ 白榊 +シラキ 白樹 +シラギ 白木 +シラキカワ 白木川 +シラキガワ 白木川 +シラギク 白菊 +シラキザワ 白木沢 +シラキザワ 白木澤 +シラギシ 白岸 +シラキハラ 白木原 +シラキヤ 白木屋 +シラク 白久 +シラク 白楽 +シラク 白句 +シラク 志楽 +シラク 白勺 +シラク 白陸 +シラク 白樂 +ジラク 地楽 +シラクサ 白草 +シラクサ 白日 +シラグチ 白口 +シラクニ 白国 +シラクニ 白國 +シラクニ 白邦 +シラクボ 白窪 +シラクマ 白熊 +シラクラ 白倉 +シラゲ 白毛 +シラゲヤマ 白米山 +シラコ 白子 +シラコウジ 白小路 +シラコシ 白越 +シラコダ 白粉田 +シラコマ 白駒 +シラサ 白佐 +シラサ 白沙 +シラサイ 白斉 +シラサカ 白坂 +シラサカ 白阪 +シラサカキ 白榊 +シラサキ 白崎 +シラサキ 白嵜 +シラサキ 白佐木 +シラサギ 白鷺 +シラザキ 白崎 +シラサコ 白迫 +シラサゴ 白砂 +シラサヤ 白鞘 +シラサワ 白沢 +シラサワ 白澤 +シラザワ 白沢 +シラザワ 白澤 +シラジ 白地 +シラシキ 白敷 +シラシゲ 白重 +シラシタ 白下 +シラシマ 白島 +シラシマ 白嶋 +シラショウジ 白庄司 +シラス 白須 +シラス 白数 +シラス 白洲 +シラス 白數 +シラス 白寿 +シラス 白州 +シラスカ 白須賀 +シラスガ 白須賀 +シラスギ 白杉 +シラスナ 白砂 +シラスマ 白須間 +シラスミ 白炭 +シラセ 白瀬 +シラセ 白勢 +シラソ 白惣 +シラソウ 白相 +シラソウ 白惣 +シラソウズ 白寒水 +シラタ 白田 +シラタ 白太 +シラタ 白他 +シラタ 白多 +ジラタ 地良田 +シラタイ 白鯛 +シラタカ 白鷹 +シラタカ 白高 +シラタキ 白滝 +シラタキ 白瀧 +シラタケ 白武 +シラタケ 白竹 +シラタケ 白岳 +シラタケ 白嶽 +シラタテ 白館 +シラタニ 白谷 +シラタマ 白玉 +シラチ 白地 +シラチク 白築 +シラツ 白津 +シラヅ 白津 +シラツカ 白塚 +シラツカヤマ 白塚山 +シラツキ 白築 +シラツキ 白附 +シラツギ 白次 +シラヅキ 白築 +シラツグ 白次 +シラツジ 白辻 +シラツチ 白土 +シラツユ 白露 +シラツル 白鶴 +シラテ 白手 +シラデ 白出 +シラト 白土 +シラト 白戸 +シラト 白渡 +シラド 白土 +シラトウ 白藤 +シラトウ 白塔 +シラドウ 志良堂 +シラドウ 白道 +シラトモ 白友 +シラトリ 白鳥 +シラトリ 白取 +シラナ 白名 +シラナガ 白永 +シラナガ 白長 +シラナミ 白波 +シラナミ 白瀚 +シラナミ 白浪 +シラニ 白仁 +シラニシ 白西 +シラニタ 白仁田 +シラニタ 白似田 +シラニッタ 白新田 +シラヌカ 白糠 +シラヌキ 白貫 +シラヌシ 白主 +シラヌマ 白沼 +シラネ 白根 +シラネ 白子 +シラネザワ 白根沢 +シラネザワ 白根澤 +シラノ 白野 +シラノ 白埜 +シラノブ 白信 +シラハ 白羽 +シラハ 白葉 +シラハイ 白灰 +シラハシ 白橋 +シラハシ 白箸 +シラハセ 白波瀬 +シラハセ 白土師 +シラハゼ 白土師 +シラハゼ 白櫨 +シラハゼ 白米花 +シラハゼ 白枦 +シラハタ 白幡 +シラハタ 白畑 +シラハタ 白旗 +シラハタ 白籏(白簱) +シラハタ 白畠 +シラハタ 白旛 +シラハダ 白肌 +シラハナ 白花 +シラハネ 白羽根 +シラハバ 白幅 +シラハマ 白浜 +シラハマ 白濱 +シラバヤシ 白林 +シラハラ 白原 +シラハリ 白針 +シラヒゲ 白髭 +シラヒゲ 白鬚 +シラヒサ 白久 +シラビョウシ 白拍子 +シラヒラ 白平 +シラフ 白府 +シラフク 白福 +シラフジ 白藤 +シラフタ 白蓋 +シラブチ 白渕 +シラブチ 白淵 +シラフネ 白船 +シラベ 調 +シラベ 白部 +シラホ 白保 +シラホ 白袋 +シラホシ 白星 +シラホリ 白堀 +シラマ 白間 +シラマ 白曼 +シラマエ 白前 +シラマサ 白砂 +シラマサ 白政 +シラマタ 白又 +シラマツ 白松 +シラマヤ 白厩 +シラマル 四良丸 +ジラマル 次郎丸 +ジラマル 次良丸 +シラマン 白曼 +シラミ 白見 +シラミズ 白水 +シラミネ 白峰 +シラミネ 白峯 +シラミネ 白嶺 +シラムラ 白村 +シラメ 白目 +シラモト 白本 +シラモト 白元 +シラモト 白源 +シラモモ 白桃 +シラモリ 白森 +シラヤ 白谷 +シラヤ 白矢 +シラヤ 白屋 +シラヤ 白舎 +シラヤナギ 白柳 +シラヤマ 白山 +シラヤマ 志羅山 +シラユ 白湯 +シラユキ 白雪 +シラヨシ 白吉 +シラヨネ 白米 +シラヨリ 白寄 +シラワ 白和 +シラワ 白輪 +シラワタリ 白渡 +シラワチ 白輪地 +シリイ 尻井 +シリイケ 尻池 +シリイシ 尻石 +シリエ 尻江 +シリエダ 尻枝 +シリキ 知気 +シリグチ 尻口 +シリタカ 尻高 +シリタカザワ 尻高沢 +シリタカザワ 尻高澤 +シリタニ 尻谷 +シリデン 尻田 +シリナシ 尻無 +シリナシハマ 尻無浜 +シリナシハマ 尻無濱 +シリビキ 尻引 +シリヤ 尻谷 +シリヤ 尻屋 +シリヤ 尻家 +シルシガワ 印河 +シルテ 知手 +シレイ 志礼 +シレイ 至令 +シレイ 四礼(四禮) +シレイ 志禮 +シレイダ 志礼田 +シレダ 志礼田 +シレダ 志禮田 +シレン 志連 +シレン 枝連 +シロ 城 +シロ 代 +シロ 白 +シロ 白露 +シロ 志路 +シロアザミ 白薊 +シロアヤ 白綾 +シロイ 白井 +シロイ 城井 +シロイ 城居 +シロイエ 城家 +シロイシ 白石 +シロイシ 城石 +シロイシタ 白石田 +シロイシダ 白石田 +シロイチ 城市 +シロイチ 代市 +シロイワ 白岩 +ジロウ 治良 +ジロウ 次郎 +ジロウガイチ 次郎垣内 +ジロウカキウチ 次郎垣内 +ジロウガキウチ 次郎垣内 +ジロウザ 治良座 +ジロウザ 治郎座 +ジロウジマ 次郎島 +ジロウジマ 次郎嶋 +シロウズ 白水 +シロウゾノ 四郎園 +シロウダ 四郎田 +シロウチ 城内 +ジロウチ 次郎内 +ジロウボウ 次郎坊 +シロウマ 白馬 +ジロウマ 次郎間 +シロウマル 四郎丸 +シロウマル 四良丸 +シロウマル 司郎丸 +ジロウマル 次郎丸 +ジロウマル 治郎丸 +ジロウマル 次良丸 +ジロウマル 二郎丸 +ジロウマン 次郎万 +ジロウマン 次郎萬 +シロウラ 城浦 +シロウラ 白浦 +シロエ 白江 +シロエ 城江 +シロエダ 白枝 +シロオ 城尾 +シロオ 城生 +シロオカ 城岡 +シロオギ 白荻 +シロガイ 城貝 +シロガイチ 城垣内 +シロガウチ 城垣内 +シロガウチ 城河内 +シロガキ 城垣 +シロガキ 城墻 +シロカシ 白樫 +シロカゼ 城風 +シロカタ 白形 +シロカド 城門 +シロカネ 白銀 +シロカネ 白金 +シロカネ 白兼 +シロカネ 城金 +シロガネ 白銀 +シロガネ 白金 +シロガネ 銀 +シロガネ 城金 +シロガネヤ 白銀屋 +シロカミ 白神 +シロカミ 城上 +シロガミ 城上 +シロカワ 白川 +シロカワ 城川 +シロキ 白木 +シロキ 城木 +シロキ 代木 +シロキ 銀木 +シロキ 代喜 +シロキサワ 白木沢 +シロキザワ 白木沢 +シロキザワ 白木澤 +シロキタ 城北 +シロキハラ 白木原 +シロキヤ 白木谷 +シロク 白久 +ジロク 次呂久 +ジロク 次六 +シロクチ 城口 +シログチ 城口 +シログチ 代口 +シロクニ 城国 +シロクマ 白熊 +シロクラ 白倉 +シロクラ 城倉 +シロクラ 代蔵 +シロクラ 代倉 +シロコ 白子 +シロコ 城子 +シロコウジ 白小路 +シロゴウチ 城河内 +シロコシ 城越 +シロコシ 城腰 +シロコダ 白子田 +シロコマ 白駒 +シロコヤマ 白子山 +シロザ 城座 +シロザイ 代財 +シロサカ 白坂 +シロサカ 城坂 +シロサカ 城阪 +シロサキ 白崎 +シロサキ 城崎 +シロサキ 代崎 +シロザキ 白崎 +シロザキ 城崎 +シロザキ 白嵜 +シロサゴ 白砂 +シロサダ 城定 +シロサワ 白沢 +シロサワ 白澤 +シロサワ 城沢 +シロサワ 城澤 +シロシタ 城下 +シロシタ 白下 +シロシマ 城島 +シロシマ 白島 +シロシマ 城嶋 +シロシマ 白嶋 +ジロシマ 治郎島 +シロショ 城所 +シロシロ 白代 +シロズ 白水 +シロスカ 白須賀 +シロスギ 城杉 +シロスナ 白砂 +シロズミ 代住 +シロセ 白瀬 +シロセ 白勢 +シロセ 城瀬 +シロゼン 城全 +シロゾエ 城添 +シロタ 白田 +シロタ 城田 +シロタ 代田 +シロタ 白太 +ジロダ 治郎田 +シロタエ 白妙 +シロタキ 城滝 +シロタケ 白竹 +シロタケ 城武 +シロタテ 城立 +シロタニ 白谷 +シロタニ 城谷 +シロタニ 代谷 +シロタマ 白玉 +シロチ 城地 +シロチカ 城近 +シロツ 白津 +シロツ 城津 +シロツカ 城塚 +シロヅカ 城塚 +シロツキ 白築 +シロツキ 城月 +シロツキ 白坏 +シロツキ 白月 +シロツバキ 白椿 +シロツメ 城詰 +シロヅメ 城詰 +シロデ 城出 +シロデラ 城寺 +シロト 城戸 +シロト 白土 +シロト 白戸 +ジロド 治郎堂 +シロトノ 城殿 +シロトリ 白鳥 +シロトリ 白取 +シロトリ 城取 +シロトリ 城鳥 +シロナカ 城中 +シロナガ 城永 +シロナガ 城長 +ジロナカ 自露中 +シロナガス 城永須 +シロニシ 城西 +シロニタ 白仁田 +シロニタ 白似田 +シロニタ 城仁田 +シロニッタ 白新田 +シロネ 白根 +シロネ 城根 +シロノ 城野 +シロノ 白野 +シロノ 城埜 +シロノ 白埜 +シロノウチ 城之内 +シロノキ 城之木 +シロノクチ 城ノ口 +シロノブ 城信 +シロノマエ 城之前 +シロノワキ 城ノ脇 +シロノワキ 城之脇 +シロハ 白羽 +シロハシ 白橋 +シロハセ 白波瀬 +シロハタ 白幡 +シロハタ 白畑 +シロハタ 城畑 +シロハタ 城端 +シロハタ 城籏 +シロハナ 白花 +シロハナ 城鼻 +シロハマ 白濱 +シロバヤシ 城林 +シロハラ 白原 +シロハラ 城原 +シロヒゲ 白髭 +シロヒサ 白久 +シロヒラ 城平 +シロフク 城福 +シロフタ 白蓋 +シロベ 白部 +シロベ 城部 +シロベ 城辺 +ジロボウ 次郎坊 +シロマ 城間 +シロマ 白間 +ジロマ 次郎間 +シロマエ 城前 +シロマサ 白政 +シロマツ 白松 +シロマツ 城松 +シロマヤ 白厩 +シロマル 城丸 +シロマル 白丸 +ジロマル 次郎丸 +ジロマル 治郎丸 +ジロマル 次良丸 +シロミ 城美 +シロミ 銀鏡 +シロミ 白見 +シロミ 城見 +シロミズ 白水 +シロミズ 城水 +シロミチ 城道 +シロミツ 城光 +シロミネ 白峰 +シロミヤ 白宮 +シロムカイ 城向 +シロムラ 城村 +シロムラ 白村 +シロメ 白目 +シロモ 白茂 +シロモト 城本 +シロモト 白本 +シロモト 城元 +シロモト 代本 +シロモト 白元 +シロモリ 城森 +シロモリ 城守 +シロヤ 白谷 +シロヤ 城谷 +シロヤ 代谷 +シロヤ 城家 +シロヤ 城屋 +シロヤ 白屋 +シロヤナギ 白柳 +シロヤマ 城山 +シロヤマ 白山 +シロヤマ 代山 +シロユキ 白雪 +シロヨネ 白米 +シロワ 城和 +シロワケ 城分 +シワ 志波 +シワ 斯波 +シワ 志和 +シワ 紫和 +シワ 紫波 +シワ 柴和 +シワキ 四脇 +シワキ 志和木 +シワク 塩飽 +シワク 塩泡 +シワク 志和久 +シワチ 志和知 +シワチ 志和池 +シワチ 志和地 +シワハシ 志和橋 +シワバシ 志和橋 +シワムラ 志和村 +シワヤ 志和屋 +シワヤマ 志和山 +ジワリ 地割 +シン 秦 +シン 新 +シン 進 +シン 真 +シン 信 +シン 針 +シン 眞 +シン 奏 +シン 伸 +シン 蓁 +ジン 神 +ジン 陣 +ジン 仁 +ジン 陳 +シンアオキ 新青木 +シンアキ 信明 +シンアミ 新網 +シンアリドメ 新有留 +シンイ 新井 +シンイ 新居 +シンイ 真井 +シンイ 眞井 +ジンイ 甚伊 +シンイケ 新池 +シンイケタニ 新池谷 +ジンイチ 陣一 +シンイデ 新出 +シンイン 神院 +シンウエ 新上 +シンウシゴメ 新牛込 +シンウチ 新内 +ジンウチ 陣内 +シンウネ 新畦 +シンエ 新江 +シンエ 新恵(新惠) +ジンエ 神恵(神惠) +シンエイ 新栄 +シンエイ 真栄(真榮) +シンエイ 新榮 +シンエイ 神栄 +シンエイ 眞榮 +シンエダ 新枝 +シンエビス 新胡 +シンオ 真尾 +シンオ 新尾 +シンオ 進尾 +ジンオ 神尾 +ジンオ 陳尾 +ジンオ 甚尾 +ジンオ 陣尾 +シンオカ 新岡 +ジンオカ 陳岡 +ジンオカ 甚岡 +シンオキ 新沖 +シンオギ 新荻 +シンオク 新奥 +シンオダ 新小田 +シンカ 真下 +シンカ 新家 +シンカ 眞下 +シンカ 神家 +シンカ 親家 +シンガ 信賀 +シンガ 進賀 +シンガ 新鹿 +シンガ 新賀 +シンガ 新加 +ジンカ 神花 +ジンガ 神賀 +ジンガ 神過 +ジンガ 甚賀 +シンカイ 新海 +シンカイ 新開 +シンカイ 新貝 +シンカイ 深海 +シンカイ 真貝 +シンカイ 新飼 +シンカイ 新改 +シンカイ 新階 +シンカイ 神開 +シンカイ 真海(眞海) +シンカイ 新界 +シンカイ 真開 +シンカイ 信開 +シンカイ 新解 +シンカイ 眞貝 +シンカイ 慎改 +シンカイ 神界 +シンカイ 愼改 +シンカイ 信海 +シンガイ 新谷 +シンガイ 新海 +シンガイ 新開 +シンガイ 新貝 +シンガイ 真貝 +シンガイ 真谷 +シンガイ 新飼 +シンガイ 新改 +シンガイ 新階 +シンガイ 新粥 +シンガイ 新鎧 +シンガイ 真開 +シンガイ 眞貝 +シンガイ 眞開 +ジンカイ 神開 +ジンガイ 神開 +ジンガイ 陣貝 +シンガイト 新垣内 +シンカイヤ 新開谷 +シンガエ 新ケ江 +ジンガオ 陳ケ尾 +ジンガオ 陣ケ尾 +ジンガオカ 陣ケ岡 +ジンガオカ 陳岡 +ジンガオカ 陣岡 +シンカキ 新垣 +シンガキ 新垣 +シンガキ 神垣 +シンガキ 新嘉喜 +シンカキウチ 新垣内 +シンカク 新角 +シンカク 新覚 +シンガク 進学 +シンカジ 真梶 +シンカジ 眞梶 +シンカド 新門 +シンカド 新角 +シンカド 新河戸 +シンカネコ 新金子 +シンカマ 新釜 +ジンガマ 陣鎌 +シンカミ 新上 +シンガミ 新上 +ジンガミ 陣上 +シンガヤ 新谷 +シンガヤ 新ケ谷 +シンカワ 新川 +シンカワ 親川 +シンカワ 信川 +シンカワ 真川 +シンカワ 新河 +シンカワ 晋川 +シンカワ 進川 +シンカワ 眞川 +シンカワ 晋河 +ジンカワ 神川 +ジンカワ 陣川 +ジンカワ 甚川 +ジンカワ 陳川 +ジンガワ 神川 +シンカワタ 新川田 +シンカワダ 新川田 +シンカワトコ 新川床 +シンカワトコ 新川庄 +ジンカン 甚観 +シンキ 真木 +シンキ 新木 +シンキ 信貴 +シンキ 眞木 +シンキ 進木 +シンキ 新喜 +シンキ 新記 +ジンキ 神亀 +ジンギ 仁義 +ジンギシ 陣岸 +シンキモト 新木本 +シンキュウ 新久 +シンキュウ 新休 +シンキュウ 真旧 +シンキョ 新居 +シンキョウ 新京 +シンギョウ 新行 +シンギョウ 信行 +シンギョウ 真行 +シンギョウウチ 新行内 +シンキョウジ 真教寺 +シンギョウジ 新行内 +シンギョウジ 真行寺 +シンギョウジ 新行寺 +シンギョウジ 眞行寺 +シンギョウチ 新行内 +シンギョウヂ 新行内 +シンギョウヤ 新行谷 +シンギョク 新玉 +シンギン 新銀 +シンク 神久 +シンク 新工 +シング 神宮 +シング 新具 +ジンク 甚久 +ジンク 甚九 +シングウ 新宮 +シングウ 神宮 +シングウ 真宮 +シングウ 信宮 +ジングウ 神宮 +シングウジ 神宮寺 +ジングウシ 神宮司 +ジングウジ 神宮司 +ジングウジ 神宮寺 +ジングウジ 神宮字 +ジングウジ 神宮路 +ジングウジ 神宮氏 +ジングウジ 神宮時 +ジングウジ 神宮次 +シングウバラ 新宮原 +シングウリョウ 新宮領 +シングチ 新口 +ジングチ 陣口 +ジングチ 甚口 +シンクボ 新久保 +シンクボ 新窪 +ジンクボ 神久保 +シンクマ 新熊 +シンクマチ 新九町 +シンクラ 新倉 +シンクラ 新蔵 +シンクラ 新藏 +シンクラ 進倉 +シングラ 新蔵 +シングラ 新藏 +シングリョウ 新宮領 +シンクロ 新黒 +シンケ 新家 +シンケ 新毛 +シンケ 神家 +シンケタニ 新家谷 +シンケダニ 新家谷 +シンケツ 神結 +シンゲツ 神月 +シンゲツ 新月 +シンケヤ 新家谷 +シンゲヤ 新家谷 +シンゲン 神元 +シンゲン 進元 +シンコ 新子 +シンコ 新古 +シンコ 新胡 +シンコ 真粉 +シンコ 振古 +シンコ 真古 +シンゴ 新後 +シンゴ 真後 +シンゴ 新吾 +シンゴ 振五 +シンゴ 眞後 +ジンコ 甚古 +ジンゴ 仁後 +ジンゴ 神後 +ジンゴ 甚五 +ジンゴ 甚吾 +ジンゴ 陣後 +シンコウ 真光 +シンコウ 信耕 +シンコウ 新光 +シンコウ 新甲 +シンコウ 眞光 +シンゴウ 新郷 +シンゴウ 新号 +ジンコウ 陣香 +シンコウイ 新向井 +シンコウジ 真光寺 +ジンコウジ 神向寺 +シンコウド 新河戸 +シンゴク 新極 +シンコクラ 新小倉 +シンコシ 新越 +シンゴシ 新越 +シンコダ 新小田 +ジンゴダ 甚吾田 +シンコタニ 新子谷 +シンコタニ 新古谷 +ジンコマ 陣駒 +ジンゴロ 神頃 +シンコン 新紺 +シンサ 新佐 +シンザ 神座 +シンザ 新座 +シンザ 新佐 +ジンザ 神座 +ジンザ 甚佐 +ジンザ 神坐(神㘴) +ジンザ 陣座 +シンサイ 新才 +シンサイ 心斉 +シンザイ 新西 +ジンサイ 神西 +ジンザイ 神西 +ジンザイ 神在 +ジンザイ 陣在 +シンザイケ 新在家 +シンサエダ 新佐枝 +シンサカ 真坂 +シンサカ 新坂 +シンサカ 新酒 +シンサカ 眞坂 +シンザカ 新坂 +シンザカ 新酒 +シンサカウエ 新坂上 +シンザカヤ 真酒谷 +シンザキ 新崎 +シンザキ 新嵜 +シンザキ 新先 +ジンサキ 陣崎 +ジンザキ 陣崎 +シンサク 新作 +シンサク 新柵 +シンサク 信作 +シンサコ 新迫 +シンサコ 新佐古 +シンザコ 新迫 +シンサト 新里 +シンザト 新里 +シンサワ 新沢 +シンサワ 新澤 +シンサワ 真沢 +シンサワ 眞澤 +シンザワ 新沢 +シンザワ 新澤 +シンザワ 真沢 +ジンザワ 甚沢 +シンサワツ 新沢津 +シンサワツ 新澤津 +シンザン 新山 +シンザンオウ 新山王 +シンシ 進士 +シンシ 新司 +シンシ 新志 +シンジ 新地 +シンジ 進士 +シンジ 新治 +シンジ 宍道 +シンジ 榛地 +シンジ 新路 +シンジ 真治 +シンジ 信次 +シンジ 進司 +シンジ 臣司 +シンジ 新持 +シンジ 慎次 +シンジ 新字 +シンジ 新次 +シンジ 愼次 +シンジ 眞治 +ジンジ 神事 +シンシキ 新敷 +シンシク 神宿 +シンシタ 新下 +シンシダ 新信田 +シンシバ 新芝 +シンシバ 新柴 +シンシハラ 新四原 +シンシマ 新島 +シンジマ 新島 +シンシャ 新舎(新舍) +ジンシャ 神車 +ジンジャ 神社 +シンジャク 新尺 +シンシュ 新主 +シンジュ 真珠 +シンジュ 眞珠 +シンジュウ 新重 +シンジュク 新宿 +シンジョ 神所 +ジンジョ 神所 +ジンジョ 神処(神處) +シンショウ 新庄 +シンショウ 真正 +シンショウ 新章 +シンショウ 眞正 +シンジョウ 新城 +シンジョウ 新庄 +シンジョウ 神成 +シンジョウ 真城 +シンジョウ 新上 +シンジョウ 新生 +シンジョウ 新条 +シンジョウ 新正 +シンジョウ 新荘 +シンジョウ 進上 +シンジョウ 新條 +シンジョウ 神城 +シンジョウ 新定 +シンジョウ 真常(眞常) +シンジョウ 真浄 +シンジョウ 眞城 +シンジョウ 新性 +シンジョウ 慎城 +シンジョウ 真庄 +シンジョウ 親上 +ジンジョウ 甚上 +ジンジョウ 陣条 +ジンジョウ 陳城 +シンジョウタニ 新庄谷 +シンジョウダニ 新庄谷 +シンジョウボウ 真乗坊(眞乗坊・眞乘坊) +シンジョウヤ 新庄屋 +シンジョウヤ 新城谷 +シンジン 新甚 +シンス 新須 +シンズ 新図 +ジンス 甚洲 +シンスイ 深水 +シンスイ 新水 +ジンスイ 神水 +シンスギ 新杉 +ジンスケ 陳祐 +ジンスケ 陣祐 +シンスルガ 新駿河 +シンセ 神瀬 +シンセ 新瀬 +シンセイ 信清 +シンセイ 神生 +シンセイ 新清 +ジンセイ 神生 +シンセキ 新関 +シンセキ 新堰 +シンゼキ 新関 +シンゼキ 新堰 +シンセコ 新迫 +シンセン 新堰 +シンゼン 新膳 +シンセンジ 秦泉寺 +シンゼンジ 秦泉寺 +シンゼンジ 泰泉寺 +ジンセンジ 秦泉寺 +ジンゼンジ 秦泉寺 +シンソ 新祖 +シンゾウ 新蔵 +シンゾウ 新造 +シンゾウ 真造 +シンゾウ 新藏 +シンゾウ 新噌 +シンゾウ 進蔵 +シンゾウ 眞造 +シンゾウブチ 新蔵淵 +シンゾウブチ 新蔵渕 +ジンゾエ 陣副 +ジンゾエ 陳副 +シンゾノ 新園 +ジンゾノ 陳園 +シンタ 新田 +シンタ 信田 +シンタ 信太 +シンタ 新多 +シンダ 信太 +ジンタ 甚田 +ジンタ 仁多 +ジンダ 神田 +ジンダ 甚田 +ジンダ 陣田 +ジンダ 仁多 +シンタイ 新帯(新帶) +シンタイ 新田井 +シンダイ 新田井 +ジンダイ 神代 +ジンダイ 陣代 +シンタカ 新高 +シンタキ 新滝 +シンタキ 新瀧 +シンタク 新宅 +シンタク 真宅(眞宅) +シンタク 新卓 +シンタク 進宅 +シンタク 新託 +シンタクヤ 新宅谷 +シンタケ 新竹 +シンタケ 新武 +シンタケ 眞竹 +ジンタケ 陣竹 +ジンタケ 陣武 +シンタダニ 新田谷 +シンダチ 信達 +シンダチヤ 信達谷 +シンダチヤ 新達谷 +シンタテ 新立 +シンタテ 新館 +シンタテ 新舘 +シンタテ 新楯 +シンダテ 新立 +シンダテ 新館 +シンダテ 新舘 +シンダテ 新楯 +ジンタテ 神立 +ジンダテ 陣立 +シンタニ 新谷 +シンタニ 真谷 +シンタニ 進谷 +シンタニ 申谷 +シンタニ 眞谷 +シンタニ 薪谷 +ジンタニ 神谷 +ジンタニ 甚谷 +シンタマチ 新田町 +シンタミ 新田見 +シンタヤ 新田谷 +シンチ 新地 +シンチ 榛地 +シンチ 進地 +ジンチ 神地 +シンチカ 新近 +ジンチク 神竹 +シンチャ 新茶 +シンチュウ 新中 +シンチュウ 真忠(眞忠) +シンチョウ 新町 +シンチョウ 新長 +シンチョウ 神張 +ジンチョウ 神長 +ジンチョウダテ 人長舘 +シンツ 新津 +シンヅ 新図 +シンツウ 進通 +シンツウ 真通(眞通) +ジンツウ 神通 +ジンヅウ 神通 +ジンツウガワ 神通川 +シンツジ 新辻 +シンツボ 新坪 +シンツボ 新津保 +シンツル 新鶴 +シンツルタ 新鶴田 +シンツルダ 新鶴田 +シンテ 新手 +シンデ 新出 +シンデ 進出 +ジンデ 神出 +ジンデ 陣出 +ジンデ 神手 +ジンデ 甚出 +ジンテイ 亭 +シンデミズ 新出水 +シンデラ 新寺 +シンテン 新典 +シンデン 新田 +シンデン 神殿 +シンデン 新伝 +シンデン 新傳 +ジンデン 神田 +シンテンジ 新天寺 +シンデンヤ 新田谷 +シント 新戸 +シント 進戸 +シント 進登 +シント 新登 +シンド 新戸 +シンド 深渡 +シンド 進戸 +シンド 真土 +シンド 新土 +シンド 神土 +シンド 神奴 +シンド 新度 +シンド 進土 +ジンド 神土 +シンドイ 新土居 +シンドイ 新土井 +ジンドイ 陣土井 +シントウ 進藤 +シントウ 新藤 +シントウ 神藤 +シントウ 真藤 +シントウ 信藤 +シントウ 新塘 +シントウ 新東 +シントウ 眞藤 +シントウ 辛藤 +シンドウ 進藤 +シンドウ 新藤 +シンドウ 神藤 +シンドウ 新堂 +シンドウ 新道 +シンドウ 真藤 +シンドウ 信藤 +シンドウ 神道 +シンドウ 神頭 +シンドウ 真道 +シンドウ 真銅 +シンドウ 新頭 +シンドウ 眞藤 +シンドウ 進籐 +シンドウ 新銅 +シンドウ 神童 +シンドウ 進東 +シンドウ 眞道 +シンドウ 新洞 +シンドウ 新途 +シンドウ 晋道 +シンドウ 深堂 +シンドウ 進堂 +シンドウ 眞銅 +シンドウ 伸藤 +シンドウ 新籐 +シンドウ 神堂 +シンドウ 神籐 +シンドウ 親道 +シンドウ 進導 +シンドウ 進道 +ジントウ 陣東 +ジンドウ 神藤 +ジンドウ 仁藤 +ジンドウ 神道 +ジンドウ 神東 +ジンドウ 陳東 +ジンドウ 仁同 +ジンドウ 陣東 +シントウマ 新藤間 +シンドオリ 新通 +シントク 新徳 +ジントク 神徳 +シントミ 新富 +シントミ 新冨 +シントミ 親富 +シントメ 新留 +シントメ 新畄 +シンドメ 新留 +シントモ 新塘 +シントモ 新友 +シンドモ 新塘 +シントヨ 新豊 +ジントリ 陣取 +シンナ 新名 +シンナイ 新内 +シンナイ 真内 +シンナイ 眞内 +ジンナイ 陣内 +ジンナイ 神内 +ジンナイ 陳内 +ジンナイ 甚内 +シンナエ 新苗 +シンナカ 新中 +シンナガ 新長 +シンナガ 新永 +ジンナカ 神中 +シンナカザキ 新中崎 +シンナカス 新中須 +シンナシ 真名志 +シンナシ 犱梨 +シンナベ 新鍋 +シンナミ 真並 +シンニシ 新西 +シンニュウ 新入 +シンニョ 真如 +シンニョ 眞如 +ジンニン 神人 +シンヌマダテ 新沼館 +シンヌマダテ 新沼舘 +シンノ 秦 +シンノ 神野 +シンノ 真野 +シンノ 新野 +シンノ 秦野 +シンノ 眞野 +シンノ 信野 +シンノ 進野 +シンノ 晋野 +シンノ 慎野 +シンノ 愼野 +ジンノ 神野 +ジンノ 神農 +ジンノ 陣野 +ジンノ 甚野 +ジンノ 神納 +ジンノ 仁野 +ジンノ 陳野 +ジンノ 神能 +ジンノ 神埜 +ジンノ 陣ノ +シンノウ 新納 +シンノウ 神農 +シンノウ 神納 +シンノウ 新濃 +シンノウ 新農 +シンノウ 神濃 +ジンノウ 神農 +ジンノウ 神納 +ジンノウ 神能 +シンノウイン 心王院 +ジンノウエ 陣上 +ジンノウシロ 陣之後 +ジンノウシロ 陳之後 +ジンノウチ 陣内 +ジンノウチ 陣之内 +ジンノウチ 陣ノ内 +ジンノウチ 陳之内 +ジンノウチ 陳ノ内 +シンノオ 新野尾 +シンノキ 神木 +シンノキ 進木 +シンノダ 新野田 +ジンノハラ 陣野原 +ジンノハラ 陳野原 +シンノブ 新信 +シンノボリ 新幟 +シンハ 榛葉 +シンバ 榛葉 +シンバ 新葉 +シンバ 新羽 +シンバ 新場 +シンバ 真場 +シンバ 真馬(眞馬) +シンバ 棒葉 +ジンバ 神馬 +ジンバ 神場 +ジンバ 陣場 +ジンバ 陳場 +ジンバ 神羽 +ジンバ 治部袋 +ジンバ 陳馬 +シンパク 親泊 +シンパク 新泊 +シンパク 新白 +シンハシ 新枦(新櫨) +シンバシ 新橋 +シンバシ 新枦(新櫨) +シンバシ 真橋(眞橋) +シンハタ 新畑 +シンハタ 新畠 +シンバタ 新畑 +シンバタ 新畠 +シンバタ 真畠 +シンパタ 新畑 +シンバタケ 新畠 +シンパチ 新八 +シンパチ 新鉢 +ジンパチ 神初 +ジンパツ 神初 +シンハツボ 新羽坪 +シンババ 新馬場 +シンハマ 新浜 +シンハマ 新濱 +シンハマワキ 新浜脇 +シンバヤシ 新林 +シンバヤシ 進林 +シンバヤシ 榛林 +ジンバヤシ 神林 +ジンバヤシ 陣林 +シンハラ 新原 +シンバラ 新原 +ジンバラ 陣原 +シンバル 新原 +シンヒラ 新平 +シンヒロ 新広 +シンヒロ 新廣 +シンブ 新武 +シンブ 新分 +シンブ 新歩 +ジンブ 神部 +ジンブ 陣武 +シンブイチ 新歩一 +ジンプウ 神風 +シンフク 新福 +シンプク 新福 +シンフクトメ 新福留 +シンフクドメ 新福留 +シンブチ 新渕 +シンブチ 新淵 +シンブツ 新仏 +シンブツ 新佛 +シンフツカイチ 新二日市 +シンフネ 新船 +シンフネ 新舩 +シンベ 新部 +ジンベ 陣兵 +ジンベイ 陣兵 +シンベツ 新別 +ジンペン 神変 +シンボ 新保 +シンボ 神保 +シンボ 真保 +シンボ 新穂 +シンボ 新甫 +シンボ 眞保 +シンボ 新発 +シンボ 新穗 +シンポ 新保 +シンポ 神保 +シンポ 真保 +シンポ 新穂 +シンポ 新甫 +シンポ 眞保 +シンポ 信保 +シンポ 新歩 +シンポ 振甫 +シンポ 新舗 +ジンボ 神保 +ジンボ 仁保 +ジンポ 神保 +シンポイチ 新歩一 +シンボウ 新穂 +シンボウ 新房 +シンボウ 辛坊 +シンボウ 新坊 +シンボウ 新防 +シンポウ 神宝 +シンポウ 進邦 +シンポウ 神寳 +シンポウ 新宝 +シンポウ 真法 +シンポウ 神寶 +ジンボウ 神保 +ジンボウ 神宝 +ジンボウ 神棒 +ジンボウ 神房 +ジンボウ 神寳 +シンボク 新木 +シンボク 新北 +シンボク 森朴 +シンボヤ 新保谷 +シンボヤ 新保屋 +シンホリ 新堀 +シンボリ 新堀 +シンボリ 新掘 +シンマ 新間 +シンマ 真間 +シンマ 眞間 +ジンマ 神馬 +ジンマ 神間 +ジンマ 神麻 +シンマイ 新舞 +シンマキ 新槙 +シンマキ 新牧 +シンマゴメ 新馬込 +シンマサ 新政 +シンマス 新増 +シンマス 新舛 +シンマス 新升 +シンマチ 新町 +シンマツ 新松 +ジンマツ 陣松 +シンマル 新丸 +シンマル 真丸 +シンミ 新美 +シンミ 新見 +シンミ 真見 +シンミ 親見 +シンミ 新味 +シンミズ 新水 +シンミチ 新道 +シンミチ 新路 +シンミチ 新途 +シンミツ 新満 +シンミツ 心光 +シンミツ 新光 +シンミドウ 新御堂 +シンミナミ 新南 +シンミヤ 新宮 +シンミョウ 新名 +シンミョウ 新明 +ジンミョウ 神明 +シンミョウズ 新名主 +シンムカイ 新向 +シンムラ 新村 +シンムラ 榛村 +シンムラ 進村 +ジンムラ 神村 +シンムラヤ 新村谷 +ジンムロ 甚室 +シンメ 新名 +シンメ 新目 +シンメ 真目 +シンメ 眞目 +ジンメ 甚目 +シンメイ 新名 +シンメイ 新明 +シンメイ 神明 +シンメイ 神名 +シンメイ 真明 +シンメイ 進明 +シンメイ 震明 +シンメイ 眞明 +ジンメイ 神明 +シンメイマエ 神明前 +シンメン 新免 +シンメン 信免 +シンメン 神免 +シンモウ 新毛 +シンモト 新本 +シンモト 信本 +シンモト 新元 +シンモト 真本 +シンモト 進本 +シンモト 眞本 +シンモト 辛本 +ジンモト 甚本 +シンモリ 新森 +シンモリ 新盛 +シンモリ 真盛 +シンモリ 新守 +ジンモリ 神森 +ジンモリ 陣森 +シンモン 神門 +シンモン 新門 +ジンモン 神門 +ジンモン 陣門 +シンヤ 新谷 +シンヤ 新家 +シンヤ 新屋 +シンヤ 新宅 +シンヤ 榛葉 +シンヤ 真家 +シンヤ 新矢 +シンヤ 真谷 +シンヤ 真屋 +シンヤ 新舎(新舍) +シンヤ 標葉 +シンヤ 進谷 +シンヤ 進矢 +シンヤ 眞家 +シンヤ 榛谷 +シンヤ 眞谷 +ジンヤ 神谷 +ジンヤ 陣谷 +ジンヤ 陣矢 +ジンヤ 陣屋 +ジンヤ 陣家 +シンヤガイト 新谷垣内 +シンヤコ 新家子 +シンヤシキ 新屋敷 +シンヤシキ 新屋鋪 +シンヤス 新安 +シンヤマ 新山 +シンヤマ 真山 +シンヤマ 信山 +シンヤマ 晋山 +シンヤマ 慎山 +ジンヤマ 陣山 +ジンヤマ 陳山 +シンヤマダ 新山田 +シンユ 新湯 +シンヨ 神余 +シンヨ 新余 +シンヨウ 信耀 +シンヨウ 晋陽 +シンヨウ 新用 +シンヨウヤ 新用谷 +シンヨシ 新吉 +シンヨシ 新好 +シンヨシヤ 新吉屋 +シンラ 新良 +シンラ 新羅 +シンラク 信楽(信樂) +シンラク 新楽(新樂) +シンラク 真楽 +シンラク 眞楽 +シンリ 新里 +シンリ 真利 +シンリキ 神力 +シンリキ 新力 +ジンリキ 神力 +シンリュウ 信竜 +シンリュウ 信隆 +シンリュウジ 真龍寺 +シンリュウジ 眞龍寺 +シンリョウ 神領 +ジンリョウ 神領 +ジンレン 神連 +シンロ 新路 +シンロ 真路 +シンワキ 新脇 +ジンワキ 神脇 +ジンワキ 陣脇 +シンワシ 新鷲 +シンワダ 新和田 +ス 巣 +ス 酢 +スアイ 須合 +スアキ 壽秋(寿秋) +スアマ 須天 +スアミ 須網 +スアミ 須綱 +スアミ 簾編 +スイ 須井 +スイ 主井 +スイ 栖井 +ズイ 頭井 +ズイアン 随安 +スイイ 推井 +ズイイ 随井 +スイイチ 吹一 +スイオ 翠尾 +スイカワ 推川 +ズイキ 瑞木 +ズイキ 随木 +ズイキ 隨木 +ズイギョウ 随行 +ズイギョウ 隨行 +ズイギョウ 隋行 +スイギョタニ 水魚谷 +スイゲツ 水月 +スイゲツ 酔月 +スイケン 水軒 +スイコウ 水光 +スイコウ 水香 +スイコウ 水甲 +ズイコウ 随行 +ズイコウ 隨行 +スイサカ 吸坂 +スイシ 水師 +スイシャ 水車 +スイシャ 水舎 +スイシュ 水主 +スイジョウ 水上 +ズイショウ 瑞松 +スイズ 水津 +スイズミ 須泉 +スイセキ 水関 +ズイセン 瑞泉 +スイタ 水田 +スイタ 吹田 +スイタ 翠田 +スイダ 水田 +スイタニ 水谷 +スイチ 水地 +スイチ 須一 +スイツ 水津 +スイツ 推津 +スイヅ 水津 +スイヅ 杉津 +スイデ 水出 +スイト 水戸 +スイト 水渡 +スイド 燧土 +スイトウ 水藤 +スイトウ 出納 +スイトウ 水頭 +スイドウ 出納 +スイドウ 水道 +スイドウ 水洞 +スイドウ 水堂 +ズイトク 瑞徳 +スイナ 推名 +ズイナガ 随永 +スイネン 隋念 +ズイネン 随念 +ズイネン 隨念 +スイノ 推野 +スイノウ 水納 +スイハラ 吸原 +スイバラ 水原 +ズイハラ 隨原 +ズイハラ 随原 +ズイハラ 隋原 +スイブン 水分 +スイミ 水海 +スイモン 水門 +スイヤ 推谷 +ズイヤマ 瑞山 +スイラ 水良 +スイラク 水落 +ズイリン 随林 +ズイリン 隨林 +スウチ 須内 +スウチ 須知 +スウド 数土(數土) +スウド 数度 +スウトウ 数藤 +スウトウ 數藤 +スウドウ 数藤 +スウノウ 数納(數納) +スウホウ 数宝(數寳) +スウメン 数面 +スウラ 寿浦(壽浦) +スウラ 須浦 +スエ 須江 +スエ 末 +スエ 陶 +スエ 諏江 +スエ 須恵 +スエ 寿恵 +スエ 須惠 +スエアキ 末秋 +スエイ 末井 +スエイ 季井 +スエイシ 居石 +スエイシ 末石 +スエイシ 据石 +スエイチ 末一 +スエイワ 末岩 +スエウチ 末内 +スエウミ 末海 +スエウラ 末浦 +スエオ 末尾 +スエオ 陶尾 +スエオカ 末岡 +スエガ 末賀 +スエカゲ 末陰 +スエカゲ 末影 +スエカシ 末柏 +スエカタ 末方 +スエカド 末角 +スエカド 末門 +スエカネ 末包 +スエカネ 末金 +スエカネ 末兼 +スエガネ 末金 +スエガネ 末兼 +スエカマ 末釜 +スエガマ 末釜 +スエカミ 末上 +スエカミ 末神 +スエガミ 末上 +スエガミ 末神 +スエガラ 末柄 +スエカワ 末川 +スエカワ 末河 +スエキ 末木 +スエキ 末岐 +スエキ 居樹 +スエキ 陶木 +スエキ 数枝木 +スエキチ 末吉 +スエキヨ 末清 +スエグチ 末口 +スエクニ 末国 +スエクニ 陶国 +スエクニ 末國 +スエクニ 陶國 +スエクボ 末窪 +スエクラ 末倉 +スエサ 末佐 +スエサカ 末坂 +スエサキ 末崎 +スエザキ 末崎 +スエザキ 末嵜 +スエザキ 未崎 +スエサコ 末迫 +スエサダ 末定 +スエサダ 末貞 +スエサト 末里 +スエザネ 末実 +スエザネ 末實 +スエサワ 末沢 +スエサワ 末澤 +スエザワ 末沢 +スエザワ 末澤 +スエジ 末地 +スエシゲ 末重 +スエシゲ 末繁 +スエシタ 末下 +スエシマ 末島 +スエシマ 末嶋 +スエジマ 末島 +スエジマ 末嶋 +スエジマ 寿江島(壽江島) +スエシロ 季白 +スエスガ 末菅 +スエスギ 末杉 +スエズミ 末住 +スエセ 末瀬 +スエゾノ 末園 +スエタ 末田 +スエダ 末田 +スエダ 陶田 +スエタカ 尾高 +スエタカ 末高 +スエタカ 季高 +スエタカ 末鷹 +スエタキ 末滝 +スエタキ 末瀧 +スエタケ 末武 +スエタケ 末竹 +スエタケ 季武 +スエタニ 末谷 +スエチカ 末近 +スエツ 末津 +スエヅ 末津 +スエツカ 末塚 +スエツギ 末次 +スエツギ 末継 +スエツグ 末次 +スエツグ 末継 +スエツグ 末続 +スエツグ 末續 +スエツグ 未継 +スエツナ 末綱 +スエツネ 末常 +スエヅミ 居積 +スエヅミ 末積 +スエツル 末鶴 +スエト 末戸 +スエトウ 末藤 +スエドオリ 末通 +スエトキ 末時 +スエトク 末徳 +スエトシ 末利 +スエトシ 末歳 +スエトミ 末富 +スエトミ 末冨 +スエトミ 季富 +スエドミ 末富 +スエドミ 末冨 +スエトメ 末留 +スエドメ 末留 +スエトモ 末友 +スエトモ 末朋 +スエナカ 末中 +スエナカ 末仲 +スエナガ 末永 +スエナガ 末長 +スエナガ 未永 +スエナミ 末次 +スエナミ 末浪 +スエナミ 末並 +スエナリ 末成 +スエニシ 末西 +スエノ 末野 +スエノ 陶野 +スエノブ 末延 +スエノブ 末信 +スエノブ 陶延 +スエバ 末羽 +スエハタ 末畑 +スエハナ 末花 +スエバヤシ 末林 +スエハラ 末原 +スエヒサ 末久 +スエヒサ 陶久 +スエヒラ 末平 +スエヒラ 季平 +スエヒロ 末広 +スエヒロ 末廣 +スエヒロ 末弘 +スエヒロ 未広 +スエヒロ 季広 +スエフク 末福 +スエフサ 末房 +スエフジ 末藤 +スエフジ 末富士 +スエフジ 末冨士 +スエベ 末部 +スエマ 尾万 +スエマサ 末政 +スエマサ 末正 +スエマス 末益 +スエマス 末増 +スエマス 末舛 +スエマス 末桝 +スエマツ 末松 +スエマツ 居松 +スエマツ 季松 +スエマツ 寿栄松(壽榮松) +スエマツ 未松 +スエマル 末丸 +スエミ 末味 +スエミズ 末水 +スエミチ 末道 +スエミチ 末通 +スエミツ 末光 +スエミツ 末満(末滿) +スエミネ 末峰 +スエミネ 末峯 +スエミヤ 末宮 +スエムネ 末宗 +スエムネ 末棟 +スエムラ 末村 +スエムラ 寿恵村(壽惠村) +スエムラ 陶村 +スエモト 末本 +スエモト 末元 +スエモリ 末森 +スエモリ 末盛 +スエモリ 居森 +スエモリ 末守 +スエモリ 陶守 +スエモリ 季盛 +スエヤ 末谷 +スエヤ 末屋 +スエヤス 末安 +スエヤマ 陶山 +スエヤマ 末山 +スエユキ 末行 +スエヨシ 末吉 +スエヨシ 末良 +スエヨシ 末葭 +スエヨシ 末好 +スエヨシ 末芳 +スエヨシ 末善 +スエヨシ 未吉 +スエワカ 末若 +スエワキ 末脇 +ズオ 洲尾 +スオウ 周防 +スオウ 須応 +スオウ 周央 +ズオウ 頭応 +ズオウ 頭應 +スオウハラ 周防原 +スオウヤ 周防屋 +スオカ 寿岡 +スオカ 壽岡 +スオバラ 周防原 +スオヤ 周防屋 +スカ 須賀 +スカ 須加 +スカ 洲家 +スガ 菅 +スガ 須賀 +スガ 清 +スガ 菅家 +スガ 管 +スガ 須加 +スガ 寿賀 +スガ 壽賀 +スガ 管河 +スガ 洲 +スガ 洲賀 +スガ 須鹿 +スガアリ 菅有 +スカイ 須貝 +スカイ 須加井 +スカイ 須海 +スガイ 菅井 +スガイ 須貝 +スガイ 水貝 +スガイ 須賀井 +スガイ 菅居 +スガイ 管井 +スガイ 須階 +スガイ 酉井 +スガイ 酉水 +スガイ 須飼 +スガイ 洲貝 +スガイ 栖養 +スガイケ 菅池 +スガイズミ 菅泉 +スガイワ 菅岩 +スガイン 須賀院 +スガウ 菅生 +スガウエ 菅上 +スカウチ 須河内 +スガウチ 須河内 +スガウチ 菅内 +スガウチ 管内 +スガウメ 菅梅 +スガウラ 須賀浦 +スガウラ 菅浦 +スガエ 菅江 +スガエ 菅枝 +スガオ 菅生 +スガオ 菅尾 +スガオ 須加尾 +スガオ 管生 +スガオ 管尾 +スガオ 須賀尾 +スガオイ 菅生 +スガオイ 管生 +スガオカ 菅岡 +スガオカ 管岡 +スガカ 菅峨 +スガカ 菅賀 +スガカタ 菅形 +スガガタ 菅形 +スガガヤ 管ケ谷 +スカガワ 須賀川 +スカガワ 須加川 +スガカワ 菅川 +スガカワ 菅河 +スガキ 菅木 +スガキ 苣木 +スガキ 須垣 +スガキ 菅城 +スガキタ 菅北 +スガグチ 菅口 +スカゴ 巣籠 +スガサ 須笠 +スガサカ 菅坂 +スガサカ 菅坡 +スカサキ 須加崎 +スガサキ 菅崎 +スガサキ 須加崎 +スガサキ 洲賀崎 +スガサキ 須ケ崎 +スガサキ 寿賀崎(壽賀崎) +スガサキ 須賀崎 +スガサキ 菅嵜 +スガザキ 菅崎 +スガザキ 洲賀崎 +スガザキ 寿賀崎(壽賀崎) +スガサダ 菅貞 +スガサハラ 菅佐原 +スガサワ 菅沢 +スガサワ 菅澤 +スガサワ 管沢 +スガサワ 須賀沢 +スガサワ 須賀澤 +スガサワ 管澤 +スガザワ 菅沢 +スガザワ 菅澤 +スガザワ 須賀沢 +スガサワラ 菅佐原 +スガサワラ 須笠原 +スガシ 須貸 +スガシタ 菅下 +スガシマ 菅嶋 +スガシマ 菅島 +スガシマ 菅嶌 +スガジマ 菅嶋 +スガジマ 菅島 +スガジマ 管島 +スガジマ 菅嶌 +スガジョウ 菅條 +スガシラ 須頭 +スガセ 菅生 +スガセ 菅瀬 +スガセ 管生 +スカタ 須方 +スカダ 須賀田 +スガタ 菅田 +スガタ 須賀田 +スガタ 管田 +スガタ 須方 +スガタ 姿 +スガタ 須加田 +スガタ 菅多 +スガタ 眇田 +スガタカ 菅高 +スガタケ 菅竹 +スガタニ 菅谷 +スガタニ 管谷 +スガタニ 須賀谷 +スガタニ 菅渓(管渓) +スガタニ 菅溪 +スガタミ 姿見 +スガチ 菅地 +スガツキ 菅付 +スガツケ 菅付 +スガツケ 管付 +スガト 菅戸 +スガト 管戸 +スガトウ 菅藤 +スガドウ 菅洞 +スガナ 菅名 +スカナカ 須賀中 +スガナカ 須賀中 +スガナカ 菅中 +スガナガ 菅長 +スガナガ 管長 +スガナミ 菅波 +スガナミ 菅浪 +スガナミ 管波 +スガナミ 菅並 +スガナリ 菅成 +スガニワ 菅庭 +スガヌマ 菅沼 +スガヌマ 管沼 +スガヌマ 須賀沼 +スガヌマタ 菅沼田 +スガネ 菅根 +スガネ 須金 +スガネ 数金 +スガネ 管根 +スカノ 須加野 +スガノ 菅野 +スガノ 管野 +スガノ 須賀野 +スガノ 須加野 +スガノ 菅埜 +スガノ 菅納 +スガノ 寿賀野(壽賀野) +スガノ 管埜 +スガノウ 菅納 +スガノサワ 菅ノ沢 +スガノサワ 菅ノ澤 +スガノブ 菅信 +スガノブ 菅延 +スガノマタ 菅野又 +スガノマタ 菅ノ又 +スガノヤ 菅谷 +スガノヤ 菅野谷 +スガノヤ 菅之屋 +スガノヤ 菅野屋 +スガノヤ 菅ノ谷 +スガハシ 菅橋 +スガハタ 菅畑 +スガハチ 菅鉢 +スガハマ 菅浜(菅濱) +スガバヤシ 菅林 +スガハラ 菅原 +スガハラ 管原 +スガハラ 須賀原 +スガハラ 簀河原 +スガハラ 須ケ原 +スガハラ 須加原 +スガヒサ 菅久 +スガヒロ 菅広(菅廣) +スガフジ 菅藤 +スガベ 菅辺 +スガベ 管部 +スガホ 清穂 +スガマ 須釜 +スガマ 菅間 +スガマ 洲鎌 +スガマ 洌鎌(冽鎌) +スガマ 須鎌 +スガマ 須ケ間 +スガマ 須蒲 +スガマ 菅蒲 +スガマ 州鎌 +スガマ 管間 +スガマタ 菅又 +スガマタ 菅俣 +スガマタ 菅股 +スガマタ 管又 +スガマタ 菅叉 +スガマツ 菅松 +スガミ 洲上 +スガミ 須上 +スガミ 菅見 +スガミ 管見 +スガミズ 菅水 +スガミツ 菅光 +スガミヤ 菅宮 +スガムタ 須ケ牟田 +スガムタ 菅牟田 +スガムラ 菅村 +スガムラ 管村 +スガモ 須鴨 +スガモ 巣鴨 +スカモト 洲加本 +スガモト 菅本 +スガモト 菅元 +スガモト 須賀本 +スガモト 管本 +スガモト 寿賀本 +スガモリ 菅森 +スガモリ 須賀森 +スガヤ 菅谷 +スガヤ 菅家 +スガヤ 管家 +スガヤ 管谷 +スガヤ 菅ケ谷 +スガヤ 菅屋 +スガヤ 須賀谷 +スガヤ 周嘉谷 +スガヤ 須萱 +スガヤウチ 菅谷内 +スガヤス 菅安 +スガヤチ 菅谷内 +スガヤマ 菅山 +スガヤマ 須賀山 +スガヤマ 数賀山 +スガヨ 菅与 +スガヨシ 菅昌 +スガル 須軽 +スカワ 須川 +スカワ 須河 +スカワ 寿川 +スカワ 洲川 +スカワ 壽川 +スガワ 須川 +スガワ 菅川 +スガワ 須河 +スガワ 栖川 +スガワ 素川 +スガワ 数川(數川) +スガワ 菅河 +スガワ 寿川 +スガワ 洲川 +スガワ 洲河 +スガワ 菅和 +スガワ 陶川 +スガワ 数河 +スガワ 杏川 +スガワ 管川 +スガワ 諏川 +スガワ 巣河 +スガワ 壽川 +スガワ 數河 +ズカワ 頭川 +ズガワ 頭川 +スガワキ 菅脇 +スガワタリ 氷渡 +スガワラ 菅原 +スガワラ 管原 +スガワラ 須賀原 +スガワラ 簀河原 +スガワラ 須ケ原 +スガワラ 須加原 +スガワラ 菅家原 +スキ 須木 +スキ 寿木 +スキ 鋤 +スギ 杉 +スギ 椙 +ズキ 頭鬼 +スギアイ 杉八合 +スギアシ 杉足 +スギイ 杉井 +スギイ 杉居 +スギイ 杉慰 +スギイ 椙井 +スギイケ 杉池 +スギイシ 杉石 +スギイチ 杉市 +スギウ 杉生 +スギウエ 杉上 +スギウチ 杉内 +スギウラ 杉浦 +スギウラ 椙浦 +スギウラ 杉裏 +スキエ 鋤柄 +スギエ 杉江 +スギエ 椙江 +スギエ 杉恵(杉惠) +スギエダ 杉枝 +スギオ 杉尾 +スギオ 杉生 +スギオ 椙尾 +スギオイ 杉生 +スギオカ 杉岡 +スギオカ 椙岡 +スギオカ 杉丘 +スギオミ 杉臣 +スキオヤ 薄尾屋 +スギカ 杉香 +スギガキ 杉垣 +スギカタ 杉方 +スギカタ 杉形 +スギカド 杉角 +スギカネ 杉金 +スギカミ 杉上 +スギガミ 杉上 +スキカラ 鋤柄 +スキガラ 鋤柄 +スギカワ 杉川 +スギカワ 杉河 +スギキ 杉木 +スギキ 椙木 +スギキ 杉貴 +スギク 杉久 +スギグチ 杉口 +スギクボ 杉久保 +スギクボ 杉窪 +スギクラ 杉倉 +スギコト 杉琴 +スギザ 杉座 +スギサカ 杉坂 +スギサカ 杉阪 +スキサキ 鋤崎 +スキサキ 鋤先 +スキザキ 鋤崎 +スギサキ 杉崎 +スギサキ 杉嵜 +スギサキ 椙崎 +スギサキ 杉埼 +スギサキ 杉先 +スギザキ 杉崎 +スギザキ 杉嵜 +スギザキ 椙崎 +スギサコ 杉迫 +スギサコン 杉左近 +スギサダ 杉貞 +スギサト 杉里 +スキザワ 鋤沢 +スキザワ 鋤澤 +スギサワ 杉沢 +スギサワ 杉澤 +スギサワ 椙沢 +スギサワ 椙澤 +スギザワ 杉沢 +スギザワ 杉澤 +スギシタ 杉下 +スギシタ 椙下 +スギシマ 杉島 +スギシマ 杉嶋 +スギシマ 椙島 +スギシマ 杉嶌 +スギシマ 椙嶋 +スギジマ 杉島 +スギショ 杉所 +スギスエ 杉末 +スギスナ 杉砂 +スギズル 杉水流 +スギセ 杉生 +スギセ 杉瀬 +スキゾノ 鋤園 +スギソノ 杉園 +スギゾノ 杉園 +スギゾノ 杉薗 +スキタ 鋤田 +スキタ 耜田 +スキタ 寿喜多 +スキダ 鋤田 +スギタ 杉田 +スギタ 椙田 +スギタ 杉多 +スギタ 過田 +スギダ 杉田 +スギタイラ 杉平 +スギダイラ 杉平 +スギタカ 杉高 +スギタキ 杉滝 +スギタキ 杉瀧 +スギタケ 杉岳 +スギタケ 杉竹 +スギタチ 杉立 +スギダチ 杉立 +スギタツ 杉立 +スギタツ 杉達 +スギタテ 杉立 +スギタテ 杉館 +スギタテ 杉舘 +スギタテ 杉建 +スギダテ 杉館 +スギダテ 杉舘 +スキタニ 鋤谷 +スギタニ 杉谷 +スギタニ 椙谷 +スギタニ 杉渓 +スギタヤ 杉田屋 +スギタワ 杉峠 +スキチ 地 +スギツエ 杉杖 +スギツカ 杉塚 +スギヅカ 杉塚 +スギヅル 杉水流 +スギテラ 杉寺 +スギト 杉戸 +スギト 過外 +スギトウ 杉藤 +スギトウ 杉東 +スギトウ 椙藤 +スギドウ 杉道 +スギドノ 杉殿 +スギトマリ 杉泊 +スギドマリ 杉泊 +スギトミ 杉富 +スギトモ 杉友 +スギナ 杉名 +スギナカ 杉中 +スギナガ 杉永 +スギナガ 杉長 +スギナミ 杉並 +スギナリ 杉形 +スギニシ 杉西 +スギヌマ 杉沼 +スギネ 杉根 +スキノ 鋤野 +スキノ 鋤納 +スギノ 杉野 +スギノ 杉能 +スギノ 椙野 +スギノ 杉埜 +スギノ 杉乃 +スキノウ 鋤納 +スギノウ 杉能 +スギノウエ 杉ノ上 +スギノウチ 杉之内 +スギノウチ 杉ノ内 +スギノオ 杉之尾 +スギノオ 杉野尾 +スギノキ 杉木 +スギノキ 杉ノ木 +スギノシタ 杉之下 +スギノシタ 杉ノ下 +スギノシタ 杉乃下 +スギノハラ 杉原 +スギノハラ 杉之原 +スギノハラ 椙原 +スギノハラ 杉野原 +スギノハラ 杉ノ原 +スギノブ 杉信 +スギノブ 杉延 +スギノベ 杉辺 +スギノマ 杉之間 +スギノメ 杉目 +スギノメ 椙目 +スギノメ 杉妻 +スギノメ 杉野目 +スギノメ 杉ノ目(杉の目) +スギノメ 杉之目 +スギノモト 杉野本 +スギノモリ 杉野森 +スギノモリ 椙杜 +スギノヤ 杉野谷 +スギバ 杉場 +スキハシ 漉橋 +スギハシ 杉橋 +スギハシ 椙橋 +スギハシ 杉箸 +スギハタ 杉畑 +スギハタ 杉畠 +スギハタ 杉端 +スギババ 杉馬場 +スギハマ 杉浜 +スギバヤシ 杉林 +スギハラ 杉原 +スギハラ 椙原 +スギハライ 杉原井 +スギヒサ 杉久 +スギヒラ 杉平 +スギヒロ 杉広(杉廣) +スギヒロ 杉弘 +スギヒロ 椙弘 +スギフ 椙生 +スギフジ 杉藤 +スギフチ 杉渕 +スギブチ 杉渕 +スギブチ 杉淵 +スギフネ 杉船(杉舩) +スギベ 杉部 +スギベ 過部 +スギホ 杉保 +スギホリ 杉堀 +スギマ 杉間 +スギマエ 杉前 +スギマサ 杉政 +スギマサ 杉正 +スギマタ 杉俣 +スギマタ 杉全 +スギマチ 杉町 +スギマツ 杉松 +スギマル 杉丸 +スキマワ 鋤馬把 +スギマン 杉万 +スギミ 杉見 +スギミズ 杉水 +スギミツ 杉光 +スギミネ 杉峰 +スギミネ 杉峯 +スギミヤ 杉宮 +スギムネ 椙棟 +スギムラ 杉村 +スギムラ 椙村 +スギムラ 杉邨 +スギムラ 杉邑 +スギメ 杉目 +スギモ 杉茂 +スギモチ 杉持 +スキモト 鋤本 +スキモト 鋤元 +スギモト 杉本 +スギモト 杉元 +スギモト 椙本 +スギモト 椙元 +スギモリ 杉森 +スギモリ 椙森 +スギモリ 杉守 +スギモリ 杉盛 +スギモリ 椙守 +スキヤ 数寄屋 +スギヤ 杉谷 +スギヤ 椙谷 +スギヤ 杉屋 +スギヤ 杉矢 +スギヤ 椙屋 +スギヤキ 杉焼 +スギヤギ 杉柳 +スギヤシキ 杉屋敷 +スギヤス 杉安 +スギヤス 杉保 +スギヤナギ 杉柳 +スギヤブ 杉薮 +スギヤブ 杉籔 +スキヤマ 鋤山 +スギヤマ 杉山 +スギヤマ 椙山 +スギヤマ 榲山 +スギヤマダ 杉山田 +スギュウ 杉生 +スギョウ 須堯 +スギョウ 須尭 +スギョウ 須行 +スギヨシ 杉吉 +スキラ 耒楽 +スキラ 耒樂 +スギワカ 杉若 +スギワキ 杉脇 +スギワケ 杉分 +スギワラ 杉原 +スクイ 救 +スクイ 須久井 +スクイソ 漉磯 +スクイダ 救田 +スグタ 直田 +スグチ 須口 +スグチ 洲口 +スグチ 直地 +スグチ 数口(數口) +スグナリ 直成 +スクネ 宿称 +スグノ 直箟 +スグノ 直箆 +スグマチ 直町 +スクミ 宿弥 +スグミ 巣組 +スクモ 栖雲 +スクモタ 粠田 +スクモダ 粠田 +スクモタ 粭田 +スグリ 村主 +スグリ 須栗 +スグリ 直里 +スグリ 素栗 +スクリバ 須栗場 +スグル 村主 +スグル 過 +スグルダ 勝田 +スグレ 勝 +スグロ 勝呂 +スグロ 須黒 +スグロ 巣黒 +スケ 佐 +スケ 寿系 +スゲ 菅 +スケイ 寿系 +スケイ 助井 +スケイ 須計 +スケイ 祐井 +スケイ 壽系 +スケイシ 助石 +スケイツ 資逸 +スケウチ 助内 +スケオ 祐尾 +スゲオ 菅生 +スゲオイ 菅生 +スケオカ 助岡 +スゲカタ 菅方 +スケカネ 助金 +スゲガヤ 菅ケ谷 +スケカワ 助川 +スケカワ 祐川 +スケカワ 鮏川 +スケカワ 鮭川 +スケガワ 助川 +スケガワ 祐川 +スケガワ 鮏川 +スケガワ 介川 +スケガワ 鮭川 +スケガワ 佑川 +スケガワ 鮏河 +スゲカワ 菅川 +スケキ 助木 +スケキヨ 助清 +スケク 助工 +スケグチ 助口 +スケクニ 助国(助國) +スゲクラ 菅蔵 +スケサ 助佐 +スケザ 助座 +スケザキ 助崎 +スケサコ 助迫 +スケサダ 助定 +スケサダ 祐定 +スケサダ 助貞 +スケザネ 助実 +スケザネ 祐実(祐實) +スケザネ 祐真 +スケザネ 助實 +スケサミ 助佐美 +スケザワ 助沢 +スケザワ 助澤 +スゲサワ 菅沢 +スゲサワ 菅澤 +スゲサワ 管沢 +スゲサワ 莎沢(莎澤) +スゲザワ 菅沢 +スゲザワ 菅澤 +スゲザワ 管澤 +スケシゲ 助重 +スケシタ 祐下 +スケシマ 祐島 +スケシマ 助島(助嶋) +スケシマ 助島(助嶋) +スケジマ 祐島 +スケスエ 祐末 +スゲソウ 管惣 +スゲソウ 菅惣 +スケタ 助田 +スケタ 祐田 +スケダ 助田 +スケダ 輔田 +スゲタ 菅田 +スゲタ 管田 +スゲタ 須毛田 +スゲダ 菅田 +スケダイ 助代 +スケダイ 助台(助臺) +スケダイ 祐代 +スケタケ 輔老 +スケタニ 助谷 +スケツカ 助塚 +スケツネ 祐恒 +スケトウ 助藤 +スケトウ 助籐 +スケトモ 助友 +スケトモ 助供 +スケトラ 助寅 +スケナ 助名 +スケナ 祐名 +スケナカ 介中 +スケナカ 助中 +スケナガ 助永 +スケナガ 祐永 +スケナガ 助長 +スケナリ 祐成 +スケナリ 助成 +スケノ 助野 +スケノ 祐野 +スケノ 輔野 +スケノ 資野 +スゲノ 菅野 +スゲノ 菅埜 +スケノブ 資延 +スケノブ 助信 +スケノブ 輔信 +スケノブ 祐延 +スケノベ 資延 +スゲノヤ 菅谷 +スゲノヤ 菅屋 +スケノリ 助乗(助乘) +スケノリ 助則 +スケハタ 助畑 +スケハラ 助原 +スケハラ 祐原 +スゲハラ 須毛原 +スケヒラ 助平 +スケヒラ 助飛羅 +スケヒラ 輔平 +スケヒロ 助広 +スケヒロ 助廣 +スケヒロ 介弘 +スケヒロ 助弘 +スケマ 助間 +スケマサ 助政 +スケマツ 助松 +スケマツ 祐松 +スケマツ 祐末 +スケミチ 助道 +スケミツ 助光 +スケミツ 祐光 +スケミヤ 助宮 +スケムネ 祐宗 +スケムネ 助宗 +スケムネ 資宗 +スケムラ 助村 +スケムラ 資村 +ズケムラ 瑞慶村 +ズケムラ 端慶村 +スケモト 祐本 +スケモト 助本 +スケモト 助元 +スケモリ 祐森 +スケモリ 助森 +スケモリ 祐盛 +スケモリタ 助守田 +スケヤス 助安 +スケヤス 祐安 +スケヤス 祐保 +ズケヤマ 瑞慶山 +スケヨシ 助吉 +ズケラン 瑞慶覧(瑞慶覽) +ズケラン 瑞ケ覧 +スコ 須子 +スコ 須古 +スコ 須小 +スゴ 須吾 +スコイ 須古井 +スコウ 須甲 +スコウ 須向 +スコウ 須行 +スゴウ 菅生 +スゴウ 須郷 +スゴウ 須合 +スゴウ 周郷 +スゴウ 諏合 +スゴウ 管生 +スゴウ 諏郷 +スゴウ 洲合 +スゴウ 数合 +スゴウ 巣河 +スゴウ 巣合 +スゴウ 州合 +ズコウ 頭高 +スゴウタ 須郷多 +スゴウタ 須郷田 +スゴウダ 須郷田 +スゴウチ 須河内 +スゴオ 菅生 +スコギ 寸古幾 +スゴサワ 双沢(双澤) +スゴシ 数越 +ズコシ 図越(圖越) +ズゴシ 図越(圖越) +スゴタ 須郷多 +スゴダ 須郷多 +スゴダ 須郷田 +スゴハタ 双畑 +スコボシ 須古星 +スゴモリ 巣籠 +スゴモリ 巣子守 +スゴモリ 巣篭 +スゴヤ 菅生屋 +スコヤカ 健 +スサ 諏訪 +スサ 須佐 +スサ 諏佐 +スサ 周産 +ズサ 図佐 +ズサ 圖左 +スサイ 須斎 +スサイ 須斉(須齊) +スサイ 須齋 +スサイ 須佐井 +ズサイ 図斎(圖齋) +ズサイ 図斉 +スサカ 諏坂 +スザカ 須坂 +スザカ 簾坂 +スサガワ 苆川 +スサキ 須崎 +スサキ 洲崎 +スサキ 鷲崎 +スサキ 寿崎 +スサキ 酢崎 +スサキ 汀 +スサキ 洌崎 +スサキ 須嵜 +スサキ 洲嵜 +スサキ 周崎 +スサキ 壽崎 +スサキ 洲岬 +スサキ 壽嵜 +スザキ 須崎 +スザキ 洲崎 +スザキ 鷲崎 +スザキ 寿崎 +スザキ 酢崎 +スザキ 洌崎 +スザキ 須嵜 +スザキ 洲嵜 +スザキ 州崎 +スザキ 壽崎 +スザキ 洲岬 +スザキ 諏崎 +スザキ 素崎 +スザキ 寿埼 +スザキ 州嵜 +スザキ 諏先 +スザキ 須埼 +スザキ 壽嵜 +スザキ 洌嵜 +スサキヤ 寿咲谷 +スザク 朱雀 +スザクイ 朱雀井 +スザクノ 朱雀野 +スサト 寿里(壽里) +スサノ 苆野 +スサミ 須佐美 +スサミ 須佐見 +スサミ 周参見 +スサミ 遊見 +スサミ 須左美 +スサモリ 寿盛 +スサモリ 壽盛 +スザワ 須沢 +スザワ 須澤 +スザワ 諏沢 +スザワ 洲沢 +スザワ 諏澤 +スザワ 洲澤 +スザワ 州沢 +スザワ 陶沢 +ズザン 頭山 +スシ 寿司 +スジ 筋 +ズシ 図師 +ズシ 図子 +ズシ 厨子 +ズシ 図司 +ズシ 都志 +ズシ 頭師 +ズシ 辻子 +ズシ 圖師 +ズシ 頭士 +ズシ 頭司 +ズシ 厨司 +ズシ 圖子 +ズシ 豆子 +ズシ 圖司 +ズシ 寿士 +ズシ 図末 +スシイ 鮓井 +ズシイ 厨井 +ズシイ 頭士井 +ズシイ 厨子井 +スジウラ 筋浦 +スジカイ 筋誡 +スジガシラ 筋頭 +スジカワ 筋川 +スジシ 筋師 +スジセ 筋瀬 +スシタ 須下 +スシダ 須志田 +スシダ 須子田 +スシダ 鮓田 +スジタ 筋田 +スジタ 須地田 +ズシダ 図子田(圖子田) +ズシダ 図志田(圖志田) +スシタニ 鮓谷 +ズシデン 図師田(圖師田) +スジナガ 筋永 +スジノ 筋野 +スシハラ 須志原 +スジハラ 筋原 +スジヘラ 筋箟 +スジヘラ 筋篦 +スジマ 筋間 +スシモト 鮓本 +スジモト 筋本 +スジャク 朱雀 +ズショ 調所 +ズショ 図書 +ズショ 図所(圖所) +ズショ 圖書 +スショウ 寿昌 +ズショウ 頭庄 +スズ 鈴 +スズ 珠洲 +スズ 数津 +スズアキ 鈴秋 +ススイ 須々井 +スズイ 鈴井 +スズイ 酒々井 +スズイ 鈴居 +スズイ 涼井 +スズイケ 鈴池 +スズイシ 鈴石 +スズウチ 鈴内 +スズウラ 鈴浦 +スズウラ 鈴裏 +スズエ 鈴江 +スズエ 鈴枝 +スズエ 鈴永 +スズエ 鈴衛 +スズエ 鈴得 +スズエ 鈴栄(鈴榮) +ズスエ 図末 +スズエダ 鈴枝 +スズオ 鈴尾 +スズオカ 鈴岡 +スズオキ 鈴置 +スズオキ 鈴沖 +スズオク 鈴奥 +ススガ 煤賀 +スズカ 鈴鹿 +スズカ 鈴下 +スズカ 鈴賀 +スズカ 鈴加 +スズガキ 鈴垣 +スズカケ 鈴掛 +スズカサ 涼笠 +スズカゼ 涼風 +スズカタ 鈴形 +スズカネ 鈴金 +スズガミネ 鈴ケ嶺 +スズカモ 鈴鴨 +ススガヤ 煤ケ谷 +ススガヤ 煤々谷 +スズカヤマ 鈴鹿山 +スズカワ 鈴川 +スズカワ 錫川 +スズカワ 寿々川 +スズカワ 鈴河 +ススキ 鈴木 +ススキ 薄 +ススキ 薄木 +ススキ 須々木 +ススキ 進来(進來) +ススキ 寿々木 +ススキ 渚鋤 +ススキ 周々木 +ススキ 須須木 +ススギ 鈴木 +ススギ 雪 +スズキ 鈴木 +スズキ 須々木 +スズキ 鱸 +スズキ 寿松木 +スズキ 進来(進來) +スズキ 錫木 +スズキ 鐸木 +スズキ 寿々木 +スズキ 鈴記 +スズキ 鈴樹 +スズキ 鈴城 +スズキ 鈴来(鈴耒) +スズキ 鈴々木 +スズキ 壽松木 +スズキ 寿洲貴 +スズキ 寿数喜 +スズキ 涼木 +スズキ 鈴喜 +スズキ 鈴紀 +スズキ 鈴酒 +スズキ 魲 +スズギ 鈴義 +ススキオ 薄尾 +ススキオヤ 薄尾屋 +ススキタ 薄田 +ススキダ 薄田 +ススキダ 鈴木田 +スズキタ 鈴木田 +スズキダ 鈴木田 +スズキネ 鈴杵 +ススキノ 薄野 +ススキヤ 薄谷 +スズキリ 鈴切 +スズキリ 錫切 +スズグチ 鈴口 +スズクナ 鈴久名 +スズクボ 鈴久保 +スズクマ 鈴熊 +スズクラ 鈴倉 +スズコ 鈴子 +スズサカ 鈴坂 +スズサキ 鈴崎 +スズサワ 鈴沢 +スズサワ 鈴澤 +スズシ 鈴士 +スズシカ 鈴鹿 +スズシタ 鈴下 +スズシノ 鈴志野 +スズシノ 凉野 +スズシマ 鈴島 +スズシマ 鈴嶋 +スズシマ 鈴嶌 +スズショウ 鈴庄 +スズスエ 鈴未 +スズセイ 鈴清 +スズセキ 鈴関 +ススタ 須々田 +ススタ 煤田 +ススタ 須須田 +ススダ 須々田 +ススダ 煤田 +スズタ 鈴田 +スズタキ 鈴滝 +スズタケ 錫武 +スズタケ 鈴武 +スズタテ 鈴立 +スズタニ 鈴谷 +スズタニ 錫谷 +スズデ 鈴出 +スズト 鈴土 +スズド 鈴土 +スズトウ 鈴東 +スズトウ 鈴藤 +スズトミ 鈴富 +スズナイ 鈴内 +スズナカ 鈴中 +スズナガ 鈴永 +スズナミ 鱸南 +スズノ 鈴野 +スズノ 雀野 +スズノ 涼野 +ズズノキ 珠数木 +スズノセ 鈴野瀬 +スズノヤ 鈴の家 +スズハタ 鈴畑 +スズハラ 鈴原 +スズヒガシ 鈴東 +スズヒラ 鈴平 +スズヒロ 鈴広 +スズフジ 鈴藤 +スズマ 鈴間 +ススマゴ 煤孫 +スズマサ 鈴政 +スズマツ 凉松 +スズマツ 涼松 +スズマヤ 鈴間屋 +スズマル 鈴丸 +ススミ 須々美 +ススミ 須澄 +スズミ 鈴見 +スズミ 数住 +スズミ 須泉 +スズミ 數住 +スズミギ 凉木 +スズミツ 鈴光 +スズミヤ 鈴宮 +ススム 進 +ススム 晋 +スズムラ 鈴村 +スズムラ 錫村 +ススメ 前 +スズメガノ 雀ケ野 +スズメジ 雀地 +スズメチ 雀地 +スズメドウ 雀堂 +スズモ 鈴茂 +スズモ 鈴雲 +ススモト 煤本 +スズモト 鈴本 +スズモト 錫本 +スズモト 鈴元 +スズモリ 鈴森 +ススヤ 煤谷 +スズヤ 鈴谷 +スズヤ 鈴屋 +スズヤ 錫谷 +ススヤマ 勧山 +ススヤマ 勸山 +スズヤマ 鈴山 +スズヤマ 涼山 +スズヨシ 鈴吉 +スズリ 硯 +スズリ 鈴里 +スズリ 硯里 +スズリイシ 硯石 +スズリカワ 硯川 +スズリタ 硯田 +スズリダ 硯田 +スズリミ 硯見 +スズリヤ 硯谷 +スズリヤマ 硯山 +スズワ 鈴倭 +スセ 巣瀬 +スセ 周世 +スセイ 須清 +スセキ 須関 +スセキ 栖関 +スセハラ 周世原 +スソ 須曽 +スソ 須曾 +スソノ 須曽野 +スソノ 裾野 +スソワケ 裾分 +スタ 須田 +スタ 須多 +スタ 壽田 +スダ 須田 +スダ 隅田 +スダ 菅田 +スダ 信太 +スダ 周田 +スダ 寿田 +スダ 酢田 +スダ 須多 +スダ 栖田 +スダ 巣田 +スダ 諏田 +スダ 壽田 +スダ 須太 +スダ 寿多 +スダ 簀田 +スダイ 須代 +スダカ 首高 +スダカ 駿高 +スダカ 巣鷹 +スダカ 須高 +スダキ 須田木 +スダジマ 須田島 +スダチ 巣立 +スダテ 巣立 +スタニ 須谷 +スタニ 酢谷 +スタニ 寿谷 +スタニ 酸谷 +スタニ 洲谷 +スタニ 壽谷 +スダニ 須谷 +スダニ 酢谷 +スダニ 寿谷 +スダニ 壽谷 +スダマ 須玉 +スダマ 角玉 +スダムラ 須田村 +スダヤマ 須田山 +スタルノ 壽田琉之 +スダレ 簾 +スダレサカ 簾坂 +スダレハタ 簾畑 +スダレバタ 簾畑 +スタンレイ 須丹礼 +スチ 須知 +スチ 須智 +スヅ 須津 +スデジ 摺出寺 +ステノ 捨野 +スト 須戸 +スト 簀戸 +スト 須都 +スド 須戸 +スド 簀戸 +スド 数土(數土) +スド 洲戸 +スド 数度 +スド 数戸 +ストウ 須藤 +ストウ 首藤 +ストウ 周藤 +ストウ 周東 +ストウ 数藤 +ストウ 主藤 +ストウ 次藤 +ストウ 須籐 +ストウ 須東 +ストウ 簾藤 +ストウ 數藤 +ストウ 周籐 +ストウ 須島 +ストウ 数登 +スドウ 須藤 +スドウ 首藤 +スドウ 周藤 +スドウ 周東 +スドウ 数藤 +スドウ 主藤 +スドウ 次藤 +スドウ 角道 +スドウ 須籐 +スドウ 須東 +スドウ 須頭 +スドウ 寿藤 +スドウ 簾藤 +スドウ 数胴(數胴) +スドウ 諏藤 +スドウ 数度 +スドウ 守藤 +スドウ 洲藤 +スドウ 須道 +スドウ 首頭 +スドウ 數藤 +スドウ 銖藤 +スドウ 数戸 +スドウ 壽藤 +スドウ 周遠 +スドウ 酢藤 +ストキ 寿時 +ストキ 壽時 +スドコ 須床 +スドコ 寿床 +スナ 砂 +スナ 沙 +スナ 須那 +スナ 須名 +スナイ 須内 +スナイ 砂井 +スナイ 巣内 +スナイ 諏内 +スナイケ 砂池 +スナイシ 砂石 +スナイリ 砂入 +スナウ 砂生 +スナウチ 砂内 +スナウラ 砂浦 +スナエ 砂江 +スナオ 直 +スナオ 砂尾 +スナオ 須直 +スナオカ 砂岡 +スナオク 砂奥 +スナオシ 砂押 +スナカ 砂賀 +スナカ 須中 +スナガ 須永 +スナガ 須長 +スナガ 砂賀 +スナガ 砂永 +スナガ 砂長 +スナガ 寿永(壽永) +スナガ 洲永 +スナガ 巣永 +スナカネ 砂金 +スナガネ 砂金 +スナカベ 砂壁 +スナカミ 砂上 +スナガミ 砂上 +スナガリ 砂刈 +スナガレ 砂流 +スナカワ 砂川 +スナカワ 砂河 +スナガワ 砂川 +スナガワ 砂河 +スナキ 砂木 +スナグチ 砂口 +スナクラ 砂倉 +スナコ 砂子 +スナゴ 砂子 +スナゴ 砂古 +スナゴウ 砂合 +スナコザカ 砂子坂 +スナゴザカ 砂子阪 +スナコザワ 砂子沢 +スナコザワ 砂子澤 +スナコシ 砂越 +スナゴシ 砂越 +スナコセ 砂子勢 +スナコタ 砂子田 +スナコダ 砂子田 +スナコダ 砂小田 +スナゴダ 砂子田 +スナコバ 砂子場 +スナコハラ 砂小原 +スナコマ 砂子間 +スナコマ 砂小間 +スナゴヤ 砂後谷 +スナサカ 砂坂 +スナザカ 砂坂 +スナサキ 砂崎 +スナザキ 砂崎 +スナザキ 砂岬 +スナサワ 砂沢 +スナサワ 砂澤 +スナザワ 砂沢 +スナザワ 砂澤 +スナジ 砂地 +スナズカ 砂塚 +スナセ 砂瀬 +スナセキ 砂関 +スナゼキ 砂関 +スナタ 砂田 +スナタ 沙田 +スナダ 砂田 +スナダイラ 砂平 +スナタケ 砂嶽 +スナタケ 砂岳 +スナダケ 砂嶽 +スナタニ 砂谷 +スナチ 砂地 +スナヅ 砂津 +スナツカ 砂塚 +スナヅカ 砂塚 +スナツキ 砂月 +スナツチ 砂土 +スナツボ 砂坪 +スナテ 沙手 +スナテ 砂手 +スナト 砂戸 +スナドイ 砂土居 +スナトマリ 砂泊 +スナドマリ 砂泊 +スナドメ 砂留 +スナドメ 砂溜 +スナトリ 砂取 +スナドリ 漁 +スナナガ 砂永 +スナナガ 砂長 +スナニワ 砂庭 +スナノ 砂野 +スナノ 砂埜 +スナハ 砂葉 +スナバ 砂場 +スナバ 砂庭 +スナハシ 砂橋 +スナハシリ 砂走 +スナバシリ 砂走 +スナハセ 砂走 +スナハセ 砂長谷 +スナハセ 砂馳 +スナハタ 砂畑 +スナハタ 砂畠 +スナバタ 砂畑 +スナバタ 砂端 +スナハチ 則 +スナハマ 砂浜 +スナハマ 砂濱 +スナハラ 砂原 +スナハラ 沙原 +スナヒラ 砂平 +スナヒロ 砂広 +スナヒロ 砂廣 +スナベ 砂辺 +スナベ 砂邊 +スナベ 砂部 +スナベ 砂邉 +スナホラ 砂洞 +スナホリ 砂堀 +スナボリ 砂堀 +スナマ 砂間 +スナマチ 砂町 +スナミ 角南 +スナミ 須浪 +スナミ 砂見 +スナミ 須波 +スナミ 陶浪 +スナミ 寿南 +スナミ 洲浪 +スナミ 砂浪 +スナミ 洲波 +スナミ 須並 +スナミ 陶南 +スナミチ 砂道 +スナミツ 砂光 +スナミネ 砂嶺 +スナミヤ 砂宮 +スナムラ 砂村 +スナメリ 砂明利 +スナモト 砂本 +スナモト 砂元 +スナモリ 砂森 +スナモリ 砂守 +スナモリ 砂盛 +スナヤ 砂谷 +スナヤシキ 砂屋敷 +スナヤマ 砂山 +スナワキ 砂脇 +スナワダ 砂和田 +スナワタリ 砂渡 +スナワチ 則 +スヌマ 須沼 +スネヤ 強矢 +スネヤ 強谷 +スノ 須野 +スノ 寿野 +スノ 酢野 +スノ 巣野 +スノ 壽野 +スノ 洲野 +スノウ 須能 +スノウ 数納(數納) +スノウエ 洲上 +スノウエ 須ノ上 +スノウチ 須之内 +スノウチ 簾内 +スノウチ 須内 +スノウチ 洲之内 +スノウチ 則内 +スノウチ 須ノ内 +スノウチ 巣之内 +スノウチ 州之内 +スノウチ 廉内 +スノキ 橘木 +スノキ 巣木 +スノサキ 洲崎 +スノサキ 洲嵜 +スノサキ 須野崎 +スノセ 須納瀬 +スノセ 巣瀬 +スノダ 須野田 +スノダ 寿乃田(壽乃田) +スノト 洲野戸 +スノト 州野戸 +スノハラ 篠原 +スノハラ 春原 +スノハラ 須野原 +スノハラ 鷲原 +スノハラ 須ノ原 +スノハラ 須之原 +スノベ 須之部 +スノマタ 須ノ又 +スノミヤ 洲宮 +スバ 須場 +スハギ 鈴萩 +スバコ 須箱 +スバタ 寿畑(壽畑) +スバナ 須鼻 +スバナ 須花 +スハマ 洲浜 +スハマ 須浜 +スハマ 洲濱 +スハマ 州浜(州濱) +スハマ 須濱 +スバヤシ 須林 +スハラ 春原 +スハラ 須原 +スハラ 栖原 +スハラ 数原 +スハラ 主原 +スハラ 寿原 +スハラ 素原 +スハラ 酢原 +スハラ 巣原 +スハラ 壽原 +スハラ 數原 +スハラ 洲原 +スハラ 諏原 +スハラ 陶原 +スハリ 巣張 +スバリ 巣張 +スビラ 須平 +スフ 周布 +スブ 数歩 +スブチ 須渕 +スブチ 洲渕 +スブチ 寿渕(壽渕) +スブチ 須淵 +スブチ 寿淵 +スブチ 洲淵 +スブネ 洲船 +スベ 須部 +スホ 須保 +スホウ 周防 +スホウ 数宝(數寳) +スマ 須磨 +スマ 須摩 +スマ 須間 +スマ 酢馬 +スマ 須麻 +スマ 栖間 +スマ 寿満 +スマ 洲間 +スマ 須麿 +スマ 須广 +スマ 壽満 +スマオカ 須磨岡 +スマオカ 須摩岡 +スマキ 洲巻 +スマキ 洌巻 +スマザキ 須磨崎 +スマス 須増 +スマタ 須股 +スマタ 須又 +スマタ 須亦 +スマダ 角田 +スマダ 寿真田 +スマダ 須磨田 +スマタニ 須磨谷 +スマタニ 須摩谷 +スマツキ 寿松木 +スマツキ 壽松木 +スマノ 角野 +スマブチ 須摩渕 +スマブチ 須摩淵 +スマブチ 須磨渕(須磨淵) +スマル 須丸 +スミ 角 +スミ 鷲見 +スミ 住 +スミ 隅 +スミ 須見 +スミ 墨 +スミ 数見 +スミ 炭 +スミ 澄 +スミ 寿見 +スミ 寿美 +スミ 須美 +スミ 数味 +スミ 壽見 +スミ 純 +スミ 壽美 +スミアケ 住明 +スミアナ 角穴 +スミイ 角井 +スミイ 住井 +スミイ 隅井 +スミイ 角居 +スミイ 炭井 +スミイ 墨井 +スミイ 住居 +スミイ 澄井 +スミイ 棲井 +スミイ 寿美井 +スミイエ 住家 +スミイエ 炭家 +スミイシ 角石 +スミイシ 住石 +スミウエ 住上 +スミウチ 隅内 +スミウチ 住内 +スミウラ 純浦 +スミウラ 角浦 +スミウラ 住浦 +スミエ 住江 +スミエ 角江 +スミエ 墨江 +スミエ 住栄(住榮) +スミエ 澄江 +スミエ 隅江 +スミエ 墨絵(墨繪) +スミエ 住得 +スミエ 炭恵(炭惠) +スミエ 炭江 +スミエダ 住枝 +スミオ 角尾 +スミオ 住尾 +スミオオトリイ 角大鳥居 +スミオカ 住岡 +スミオカ 角岡 +スミオカ 隅岡 +スミオカ 墨岡 +スミオカ 澄岡 +スミオカ 炭岡 +スミオカ 純岡 +スミオカ 純丘 +スミオカダ 住岡田 +スミオキ 角沖 +スミオク 住奥 +スミオケ 角桶 +スミカ 住家 +スミガイ 角貝 +スミガイチ 隅垣内 +スミガイト 角垣内 +スミガキ 隅垣 +スミガキ 角垣 +スミガキ 住垣 +スミガキ 角柿 +スミガキウチ 隅垣内 +スミカサ 墨笠 +スミカツ 角勝 +スミカド 角門 +スミカネ 住金 +スミカネ 澄兼 +スミカマ 炭竃 +スミカマ 炭釜 +スミカマ 炭竈 +スミカマ 住釜 +スミカマ 炭鎌 +スミガマ 炭竃 +スミガマ 炭釜 +スミガマ 炭竈 +スミガマ 炭窯 +スミガミ 角上 +スミカワ 角川 +スミカワ 澄川 +スミカワ 住川 +スミカワ 隅川 +スミカワ 済川 +スミカワ 墨川 +スミカワ 炭川 +スミカワ 濟川 +スミガワ 澄川 +スミガワ 隅川 +スミガワ 角河 +スミキ 角木 +スミキ 隅木 +スミキ 住木 +スミキ 炭木 +スミキタ 角北 +スミキヨ 住清 +スミグチ 角口 +スミグチ 住口 +スミグチ 炭口 +スミクマ 角熊 +スミクラ 角倉 +スミクラ 隅倉 +スミクラ 炭倉 +スミクラ 住倉 +スミクラ 隅蔵(隅藏) +スミクラ 炭蔵 +スミコ 隅子 +スミコウ 住香 +スミコウチ 隅河内 +スミコシ 隅越 +スミコシ 角越 +スミゴシ 角越 +スミコマ 住駒 +スミサ 住佐 +スミサカ 隅坂 +スミサカ 住坂 +スミサキ 角崎 +スミサキ 炭崎 +スミサキ 墨崎 +スミサキ 角㟢 +スミザキ 角崎 +スミザキ 炭崎 +スミザキ 住崎 +スミザキ 墨崎 +スミザキ 隅崎 +スミサダ 住貞 +スミサダ 住定 +スミサト 住里 +スミサワ 住沢 +スミサワ 角沢 +スミサワ 住澤 +スミサワ 角澤 +スミサワ 隅沢 +スミサワ 隅澤 +スミザワ 住沢 +スミザワ 住澤 +スミザワ 隅澤 +スミザワ 炭沢 +スミザワ 炭澤 +スミシ 住司 +スミジ 角地 +スミジ 隅地 +スミジ 住路 +スミシゲ 住重 +スミシゲ 隅重 +スミシゲ 澄重 +スミシタ 角下 +スミシタ 住下 +スミシャ 住舎 +スミズ 隅水 +スミセ 角瀬 +スミセ 住瀬 +スミソウ 住相 +スミゾエ 住添 +スミソノ 角園 +スミゾノ 角園 +スミゾノ 角囿 +スミタ 角田 +スミタ 住田 +スミタ 隅田 +スミタ 澄田 +スミタ 炭田 +スミタ 墨田 +スミタ 炭多 +スミタ 寿美田(壽美田) +スミタ 純田 +スミタ 湫田 +スミダ 角田 +スミダ 住田 +スミダ 隅田 +スミダ 澄田 +スミダ 炭田 +スミダ 墨田 +スミダ 純田 +スミダイ 住大 +スミタカ 住高 +スミダガワ 隅田川 +スミダガワ 角田川 +スミタク 住宅 +スミタケ 角竹 +スミタケ 須弥岳 +スミタダ 住忠 +スミタニ 角谷 +スミタニ 住谷 +スミタニ 炭谷 +スミタニ 隅谷 +スミタニ 墨谷 +スミタニ 澄谷 +スミタニ 寿美谷(壽美谷) +スミダニ 住谷 +スミダヤ 住田谷 +スミチ 角地 +スミチ 隅地 +スミチカ 住近 +スミツジ 角辻 +スミツジ 住辻 +スミデ 角出 +スミデ 住出 +スミデ 澄出 +スミデ 隅出 +スミト 角戸 +スミト 住戸 +スミト 角登 +スミト 住登 +スミド 墨土 +スミトウ 角藤 +スミトウ 住藤 +スミトク 住徳 +スミトコ 炭床 +スミトコ 角床 +スミトコ 炭常 +スミトミ 角富 +スミトミ 炭富 +スミトモ 住友 +スミトモ 角友 +スミトモ 墨友 +スミトモ 隅友 +スミトモ 住鞆 +スミトモ 澄友 +スミナ 角名 +スミナカ 角中 +スミナカ 住中 +スミナカ 隅中 +スミナカ 炭中 +スミナガ 住永 +スミナガ 角永 +スミナガ 隅永 +スミナガ 澄長 +スミナガ 炭永 +スミナミ 住浪 +スミナリ 住成 +スミニ 角二 +スミノ 角野 +スミノ 住野 +スミノ 隅野 +スミノ 炭野 +スミノ 隅埜 +スミノ 角埜 +スミノ 澄野 +スミノ 須箕 +スミノイ 住ノ井 +スミノウエ 角之上 +スミノウエ 角ノ上 +スミノエ 住江 +スミノエ 住ノ江 +スミノエ 住之江 +スミノクラ 角倉 +スミノクラ 隅倉 +スミノクラ 墨野倉 +スミノクラ 角之倉 +スミノソノ 角之園 +スミノハラ 炭之原 +スミノブ 住信 +スミノヤ 住野谷 +スミハジ 住羽地 +スミハタ 住畑 +スミハタ 住畠 +スミハマ 住浜 +スミバヤシ 墨林 +スミバヤシ 住林 +スミハラ 角原 +スミハラ 住原 +スミハラ 隅原 +スミハラ 炭原 +スミハラ 墨原 +スミヒ 角樋 +スミヒサ 住久 +スミヒラ 住平 +スミヒロ 住広 +スミヒロ 角広 +スミヒロ 隅広 +スミヒロ 住廣 +スミヒロ 炭広(炭廣) +スミヒロ 角廣 +スミヒロ 隅廣 +スミフク 住福 +スミブチ 角渕 +スミボウ 隅防 +スミマツ 住松 +スミミヤ 住宮 +スミムラ 角村 +スミムラ 住村 +スミムラ 炭村 +スミムラ 隅村 +スミムラ 澄村 +スミムラ 墨村 +スミモト 住本 +スミモト 角本 +スミモト 炭本 +スミモト 住元 +スミモト 隅本 +スミモト 隅元 +スミモト 澄本 +スミモト 炭元 +スミモト 墨本 +スミモト 済本 +スミモリ 住森 +スミヤ 角谷 +スミヤ 住谷 +スミヤ 角屋 +スミヤ 炭谷 +スミヤ 隅谷 +スミヤ 墨谷 +スミヤ 角矢 +スミヤ 炭屋 +スミヤ 角家 +スミヤ 隅屋 +スミヤ 住屋 +スミヤ 住家 +スミヤ 墨屋 +スミヤ 住矢 +スミヤ 住舎 +スミヤ 炭家 +スミヤ 炭矢 +スミヤ 隈谷 +スミヤ 墨矢 +スミヤ 栖宮 +スミヤキ 炭焼 +スミヤシキ 角屋敷 +スミヤス 住安 +スミヤマ 角山 +スミヤマ 住山 +スミヤマ 炭山 +スミヤマ 隅山 +スミヤマ 墨山 +スミヨシ 住吉 +スミヨシ 炭吉 +スミヨシ 住好 +スミヨシ 墨吉 +スミヨシタニ 住吉谷 +スミヨシヤ 住吉谷 +スミヨシヤ 住吉屋 +スミヨシヤマ 住吉山 +スミヨリ 住寄 +スミワ 住和 +スミワカ 住若 +スミワキ 角脇 +スミワキ 住脇 +スムラ 須村 +スムラ 寿村 +スムラ 洲村 +スムラ 栖村 +スムラ 寸村 +スムラ 周村 +スムラ 州村 +スムラ 壽村 +スムロ 須室 +スメラギ 皇 +スモウ 相撲 +スモウ 角力 +スモウヤマ 角力山 +スモウリ 水廻 +スモゲ 住母家 +スモダ 李田 +スモト 須本 +スモト 洲本 +スモト 数元(數元) +スモト 寿本 +スモト 巣元 +スモト 楉 +スモト 州本 +スモト 栖本 +スモト 須基 +スモト 須元 +スモト 壽本 +ズモト 頭本 +ズモト 豆本 +スモハラ 李原 +スモハラ 須茂原 +スモモ 李 +スモモ 洲桃 +スモモ 須百 +スモモギ 李木 +スモモサワ 李澤 +スモモザワ 李沢 +スモモザワ 李澤 +スモモダニ 李谷 +スモヤマ 角力山 +スモヤマ 守茂山 +スモリ 巣守 +スモリ 陶守 +スモリ 寿盛 +スモリ 須森 +スモリ 巣森 +スモリ 寿守(壽守) +スモリ 洲盛 +スモリ 壽盛 +スヤ 須谷 +スヤ 酢谷 +スヤ 数矢 +スヤ 酢屋 +スヤ 寿谷 +スヤ 酢矢 +スヤサキ 須夜崎 +スヤス 須安 +スヤトウ 酢矢藤 +スヤマ 須山 +スヤマ 陶山 +スヤマ 巣山 +スヤマ 寿山 +スヤマ 隅山 +スヤマ 数山(數山) +スヤマ 周山 +スヤマ 嵩山 +スヤマ 酢山 +スヤマ 珠山 +スヤマ 壽山 +スヤマ 洲山 +スヤマ 栖山 +スヤマ 諏山 +スヤマ 州山 +スヤマ 寸山 +スヤマ 簀山 +ズヤマ 頭山 +スヤリ 須鎗 +スヤリ 須鑓 +スリ 摺 +ズリ 頭利 +スリイシ 摺石 +スリウス 摺臼 +スリカベ 研壁 +ズリカワ 摺川 +スリキ 摺木 +スリザキ 摺崎 +スリサワ 摺沢 +スリサワ 摺澤 +スリザワ 摺沢 +スリザワ 摺澤 +スリジ 摺寺 +スリタ 摺田 +スリタテ 摺建 +スリデ 摺出 +スリデジ 摺出寺 +スリデラ 摺寺 +スリブチ 摺淵 +スリモト 摺本 +ズリヤマ 崩山 +スルガ 駿河 +スルガ 摺河 +スルガサキ 駿ケ崎 +スルガサキ 駿河崎 +スルガヤ 駿河谷 +スルカワ 駿川 +スルカワ 須留川 +スルキ 摺木 +スルキ 槢木 +スルグチ 駿口 +スルコ 𣑑子 +スルサキ 摺崎 +スルジ 駿地 +スルスミ 磨墨 +スルタ 駿田 +スルダ 駿田 +スルタニ 駿谷 +スルドウ 駿同 +スルハラ 須留原 +スルブチ 摺渕 +スルミ 駿見 +スルモト 摺元 +スルヤ 駿谷 +スルヤ 寿瑠屋 +スロ 須呂 +スワ 諏訪 +スワ 斯波 +スワ 周防 +スワ 須和 +スワ 須波 +スワ 諏方 +スワ 須羽 +スワ 須輪 +スワ 狭訪 +スワ 諏和 +スワ 陬波 +スワ 陬防 +スワ 挾訪 +スワイ 諏訪井 +スワキ 洲脇 +スワキ 諏訪木 +スワキ 須脇 +スワキ 州脇 +スワク 密涌 +スワサカ 諏訪坂 +スワザキ 諏訪崎 +スワシタ 諏訪下 +スワゾノ 諏訪園 +スワゾノ 諏訪薗 +スワタ 諏訪田 +スワタ 諏訪多 +スワダ 諏訪田 +スワダ 須和田 +スワダ 砂和田 +スワト 諏訪戸 +スワド 諏訪戸 +スワナ 須和名 +スワナイ 諏訪内 +スワノ 諏訪野 +スワバヤシ 諏訪林 +スワハラ 諏訪原 +スワバラ 諏訪原 +スワベ 諏訪部 +スワベ 諏訪辺(諏訪邊) +スワベ 須和部 +スワベ 諏訪邉 +スワマ 諏訪間 +スワマエ 諏訪前 +スワムラ 諏訪村 +スワメン 諏訪免 +スワモト 諏訪本 +スワモト 諏訪元 +スワヤマ 諏訪山 +スワワキ 諏訪脇 +スンイ 寸為 +スンガ 寸賀 +スンコシ 寸越 +スンセキ 寸石 +スンダ 寸田 +スンデン 寸田 +スンド 寸土 +スントウ 駿藤 +スントウ 駿東 +スンバラ 寸原 +スンムラ 寸村 +スンワ 寸和 +セ 瀬 +セ 勢 +セ 背 +セア 瀬亜 +セアシ 背足 +セアラシ 瀬嵐 +セイ 清 +セイ 瀬井 +セイ 勢井 +セイ 勢 +セイ 生 +セイ 情 +セイ 精 +ゼイ 是井 +セイイ 清井 +セイイケ 清池 +セイイケ 盛池 +セイイシ 清石 +セイイチ 勢一 +セイウン 清雲 +セイエイ 清栄(清榮) +セイエン 青園 +セイエン 精園 +セイオ 清尾 +セイオウ 清王 +セイオク 姓億 +セイカ 清家 +セイガ 生賀 +セイガ 青河 +セイカイ 西海 +セイカイ 青海 +セイカイ 清海 +セイカイ 生海 +セイカイ 静海(靜海) +セイガイ 青海 +セイガエ 清替 +セイカク 清角 +セイカク 清覚(清覺) +セイガク 清角 +セイカワ 清川 +セイカワ 生川 +セイガワ 清川 +セイガン 西願 +セイキ 清木 +セイキ 勢木 +セイキ 清喜 +セイキ 生喜 +セイキ 勢起 +セイキ 晴城 +セイキ 正気 +セイキ 清起 +セイキョウ 成京 +セイグチ 葎口 +セイグチ 葏口 +セイケ 清家 +セイケ 清池 +セイケ 盛池 +セイケ 勢家 +セイケ 生家 +セイケ 清華 +セイケイ 清慶 +セイゲンジ 生源寺 +セイゲンジ 清玄寺 +セイゲンダイ 精元大 +セイコ 清古 +セイコ 勢古 +セイゴ 生子 +セイゴ 清吾 +セイゴ 清護 +セイコウ 清光 +セイコウ 精広 +セイコウ 精廣 +セイコウ 誠光 +セイゴウ 勢合 +セイゴウ 青郷 +セイゴウ 盛郷 +ゼイコウ 税光 +セイコウイン 清光院 +セイコバ 清木場 +セイサ 清佐 +セイザ 清座 +セイザ 清佐 +セイザ 清左 +セイザ 星座 +セイサイ 誓斎 +セイサイ 誓斉 +セイザキ 清崎 +セイサコ 清迫 +セイザコ 清迫 +セイザワ 清沢 +セイザワ 清澤 +セイシ 勢司 +セイシ 勢子 +セイシ 勢志 +セイシ 清石 +セイシ 瀬石 +セイシ 勢石 +セイシ 勢至 +セイジ 清治 +セイジ 清地 +セイジ 清司 +セイジ 清次 +セイジ 清寺 +セイシマ 清島 +セイシマ 清嶋(清嶌) +セイシマ 精島 +セイジマ 精嶋 +セイシュ 清酒 +セイシュウヤ 勢州谷 +ゼイショ 税所 +セイショウ 清正 +セイジョウ 正条 +セイジョウ 聖生 +セイジョウ 正條(正絛) +セイジョウ 清城 +セイジョウ 清浄 +セイジョウ 清淨 +セイジョウ 聖城 +セイジョウ 聖成 +セイシン 清心 +セイシン 清神 +セイジン 清神 +セイスイ 勢水 +セイゼン 清善 +セイソ 西祖 +セイソウ 清宗 +セイゾウ 清造 +セイタ 清田 +セイタ 勢田 +セイタ 清板 +セイタ 背板 +セイタ 脊板 +セイダ 生田 +セイダ 清田 +セイダ 勢田 +セイダ 清陀 +セイダ 精田 +ゼイダ 汭田 +セイタイ 青泰 +セイダイ 清代 +セイタイバシ 聖代橋 +セイタニ 清谷 +セイダマル 勢溜 +セイチ 生地 +セイチ 世一 +セイチ 清地 +セイチ 勢一 +セイチ 星地 +ゼイデ 税出 +セイテン 清天 +セイト 清戸 +セイド 清土 +セイトウ 清藤 +セイトウ 青藤 +セイトウ 政東 +セイトウ 清東 +セイトウ 清籐 +セイドウ 清藤 +セイドウ 清道 +セイドウ 勢堂 +セイドウ 誠道 +セイドウ 清堂 +セイトク 清徳 +セイトク 政徳 +セイナガ 成長 +セイノ 清野 +セイノ 青野 +セイノ 情野 +セイノ 制野 +セイノ 姓農 +セイノ 清埜 +セイノウ 清納 +セイノウ 静納 +セイノヤ 清野谷 +セイノヤマ 清野山 +セイバヤシ 生林 +セイハラ 勢原(㔟原) +セイフ 西府 +セイフ 清符 +セイフク 清福 +セイベ 清部 +セイホウ 清宝 +セイマ 勢馬 +セイマ 清間 +セイマ 清麻 +セイマサ 清政 +セイマツ 清末 +セイマル 清丸 +セイマン 勢万 +セイミ 清見 +セイミ 勢見 +セイミツ 清光 +セイミヤ 清宮 +セイメイ 清明 +セイモト 清本 +セイモト 生本 +セイモリ 生盛 +セイヤ 征矢 +セイヤ 清谷 +セイヤ 清矢 +セイヤ 勢屋 +セイヤ 盛也 +セイヤマ 青山 +セイヤマ 盛山 +セイヤマ 清山 +セイヤマ 精山 +セイユウ 清勇 +セイヨウ 青陽 +セイラ 清良 +セイライ 清良井 +セイラク 成楽 +セイラク 清楽 +セイラク 静楽 +セイラシ 生良志 +セイリ 清利 +セイリキ 勢力 +セイリキ 清力 +セイリュウ 清生 +セイリュウ 青龍 +セイリュウ 聖生 +セイリュウ 清流 +セイリュウ 青竜 +セイリュウ 星生 +セイリョウ 清涼 +セイリョウ 清凉 +セイリョウ 勢料 +セイレ 瀬例 +セイレイジ 清嶺地 +セイロウ 清老 +セイロク 征録 +セイワ 清和 +セイワ 生和 +セイワ 世和 +セイワ 誠和 +セイワダ 清和田 +セウエ 瀬上 +セウチ 瀬内 +セウミ 瀬海 +セウラ 瀬浦 +セエナカ 瀬江仲 +セオ 瀬尾 +セオ 妹尾 +セオ 清尾 +セオ 背尾 +セオ 脊尾 +セオ 世尾 +セオ 世雄 +セオ 瀬生 +セオ 勢尾 +セオ 清雄 +セオウ 世応 +セオウ 世王 +セオウ 世應 +セオウ 瀬王 +セオカ 畝岡 +セオカ 瀬岡 +セオタニ 妹尾谷 +セオト 瀬音 +セオノ 瀬尾野 +セガ 瀬賀 +セガ 世賀 +セガ 勢賀 +ゼガ 是賀 +セカイ 瀬海 +セカイ 世界 +セカイ 世貝 +セガイ 瀬涯 +セガイ 瀬貝 +セガキ 世垣 +セガキ 瀬垣 +セガタ 瀬形 +セガタ 瀬片 +セガタ 瀬肩 +セガタ 瀬方 +セガヌマ 瀬ケ沼 +セガミ 瀬上 +セガミ 勢上 +セガミ 世上 +セガヤ 瀬ケ谷 +セガラ 勢柄 +セカリョウ 世嘉良 +セカワ 瀬川 +セガワ 谷川 +セガワ 瀬川 +セガワ 清川 +セガワ 生川 +セガワ 妹川 +セガワ 畝川 +セガワ 勢川 +セガワ 牲川 +セガワ 瀬河 +セガワ 背川 +セガワ 世川 +セガワ 脊川 +セガワ 世河 +セキ 関 +セキ 瀬木 +セキ 積 +セキ 石 +セキ 碩 +セキ 世木 +セキ 堰 +セキ 釈 +セキ 關 +セキ 釋 +セキ 勢木 +セキ 勢喜 +セキ 磧 +セキ 赤 +セキ 世喜 +セキ 瀬喜 +セキ 昔 +セキ 績 +セギ 清木 +セギ 瀬木 +セギ 世木 +セギ 堰 +セギ 千木 +セギ 世儀 +ゼキ 是木 +ゼギ 是木 +セキアイ 堰合 +セキアイ 関合 +セキイ 関井 +セキイ 関位 +セキイ 関居 +セキイ 關井 +セキイシ 関石 +セキイト 関糸 +セキイワ 関岩 +セキウジ 関氏 +セキウチ 関内 +セキウチ 堰内 +セキウチ 積内 +セキウラ 関浦 +セキエ 関江 +セキオ 関尾(關尾) +セキオカ 関岡(關岡) +セキオカ 積岡 +セキオダ 関小田 +セキガハマ 関ケ浜 +セキガハラ 関ケ原 +セキカミ 関上 +セキガミ 関上 +セキガミ 磧上 +セキガミ 堰上 +セキカワ 関川 +セキカワ 関河 +セキカワ 堰川 +セキカワ 昔川 +セキカワ 關川 +セキガワ 関川 +セキガワ 赤川 +セキガワ 関河 +セキガワ 昔川 +セキガワ 關川 +セキクチ 関口 +セキグチ 関口 +セキグチ 堰口 +セキグチ 關口 +セキグチ 椹口 +セキグチ 析口 +セキグチ 積口 +セキクマ 関熊 +セキグロ 関黒 +セキゴウチ 積河内 +セキコシ 関越 +セキコン 関昆 +セキサイ 尺釆 +セキサカ 関坂 +セキサキ 関崎 +セキザキ 関崎 +セキザキ 関埼 +セキザキ 関嵜 +セキサダ 席定 +セキサワ 関沢 +セキサワ 関澤 +セキザワ 関沢 +セキザワ 関澤 +セキザワ 堰沢 +セキザワ 堰澤 +セキザワ 世木沢 +セキザワ 世木澤 +セキザワ 關澤 +セキシ 釈氏 +セキシ 昔志 +セキジ 石司 +セキジ 関次 +セキジ 関路 +セキシタ 関下 +セギシタ 堰下(椻下) +セキシマ 関島 +セキシマ 関嶋 +セキシマ 積島 +セキジマ 関島 +セキジマ 関嶋 +セキジマ 積島 +セキショウ 石匠 +セキジョウ 赤城 +セキジョウ 石城 +セキシロ 堰代 +セキシロ 関城 +セキシロ 堰城 +セキシロ 関志路 +セキスエ 関末 +セキズカ 関塚(關塚) +セキスギ 関杉(關杉) +セキズミ 関角 +セキズミ 関澄 +セキゼン 赤前 +セキゼン 積善 +セキゾエ 関添 +セキタ 関田 +セキタ 尺田 +セキタ 世木田 +セキタ 堰田 +セキタ 責田 +セキタ 關田 +セキダ 関田 +セキダ 尺田 +セキダ 世木田 +セキダ 關田 +セキタツ 関達 +セキタニ 関谷 +セキタニ 關谷 +セキダン 関段 +セキチ 関地 +セキツカ 関塚(關塚) +セキヅカ 関塚(關塚) +セキヅカ 堰塚 +セキテラ 関寺 +セキデラ 関寺 +セキト 関戸 +セキド 関戸 +セキド 石戸 +セキド 赤土 +セキド 關戸 +セキトウ 関藤 +セキトウ 石東 +セキトウ 潟東 +セキトウ 関頭 +セキトウ 関籐 +セキトウ 關藤 +セキドウ 石堂 +セキドウ 関藤 +セキドウ 赤銅 +セキドウ 関堂 +セキドウ 石筒 +セキトク 関徳 +セキトミ 関富 +セキトミ 関冨 +セキトメ 関留 +セキトモ 関友 +セキトヤ 関戸谷 +セキトリ 関取 +セキナ 関名 +セキナ 昔奈 +セキナカ 関中 +セキナガ 関永 +セキナダ 関灘 +セキナミ 関浪 +セキナミ 関波 +セキニシ 関西 +セキヌキ 関貫 +セキヌマ 関沼 +セキネ 関根 +セキネ 關根 +セキネ 堰根 +セキネ 瀬木根 +セキネ 碩根 +セキネイ 関根井 +セキノ 関野 +セキノ 赤野 +セキノ 昔農 +セキノ 釈野(釋野) +セキノ 碩野 +セキノ 積野 +セキノ 關野 +セキノ 関乃 +セキノ 瀬木野 +セギノ 千木野 +セキノウ 昔農 +セキノウ 関能 +セキノウチ 関の内 +セキノウミ 関之海 +セキノオ 関之尾 +セキノダイ 関之台 +セキノハタ 堰野端 +セキノベ 関延 +セキノヤマ 関野山 +セキノヤマ 関之山 +セキバ 関場(關場) +セキバ 関羽 +セキハシ 関橋(關橋) +セキハタ 関端 +セキハタ 堰端 +セキハタ 関畑 +セキバタ 関端 +セキハチ 堰八 +セキハマ 関浜(関濱) +セキハラ 関原 +セキハラ 積原 +セキハラ 關原 +セキヒサ 関久 +セキヒサ 積久 +セキヒラ 関平 +セキヒロ 関広 +セキフジ 関藤 +セキフダ 関札 +セキベ 関部 +セキベ 赤部 +セキボリ 関堀 +セキボリ 關堀 +セキマ 関間 +セキマタ 関亦(關亦) +セキマタ 関俣 +セキマチ 関町 +セキマツ 関松 +セキミ 堰見 +セキミ 関見 +セキミズ 関水 +セキミツ 積光 +セキミツ 関光 +セキミツ 関満 +セキミヤ 関宮 +セキミヤ 昔宮 +セキムカイ 関向 +セキムカイ 堰向 +セキムラ 関村(關村) +セキムラ 関邨 +セキムロ 寂室 +セキメ 関目(關目) +セキメン 堰免 +セキモ 関茂 +セキモト 関本 +セキモト 関元 +セキモト 磧本 +セキモト 堰本 +セキモト 關本 +セキモト 関基 +セキモト 積本 +セキモト 碩本 +セキモリ 関森 +セキモリ 関守 +セキモリ 関盛 +セキモリ 磧守 +セキヤ 関谷 +セキヤ 石谷 +セキヤ 関屋 +セキヤ 関矢 +セキヤ 赤谷 +セキヤ 関家(關家) +セキヤ 石屋 +セキヤ 関哉 +セキヤ 磧谷 +セキヤ 関弥 +セキヤ 関舎 +セキヤ 瀬木谷 +セキヤ 關屋 +セキヤ 關谷 +セキヤ 積家 +セキヤマ 関山 +セキヤマ 積山 +セキヤマ 碩山 +セキヨシ 関吉 +セキヨシ 関芳 +セキライ 関来 +セキラク 堰楽(堰樂) +セギリ 瀬切 +セギリ 世桐 +セキリュウ 石龍 +セキリュウ 赤竜 +セキリュウ 赤龍 +セキリョウ 石陵 +セキワ 関和 +セキワ 関輪 +セギワ 瀬涯 +セギワ 瀬際 +セキワキ 関脇 +セクズ 瀬屑 +セグチ 瀬口 +セグチ 勢口 +セグチ 脊口 +セグチ 背口 +セクボ 瀬窪 +セクボ 背久保 +セグマ 瀬熊 +セクラ 瀬倉 +セグラ 瀬倉 +セグロ 背黒 +セグロ 瀬黒 +セグロ 脊黒 +セコ 迫 +セコ 世古 +セコ 瀬古 +セコ 勢子 +セコ 背古 +セコ 勢古 +セコ 脊古 +セコ 瀬子 +セコ 世子 +セコウ 詍高 +セコウ 施向 +セコウ 世耕 +セコウ 瀬鴻 +セゴウ 瀬合 +セゴウ 瀬郷 +セゴウ 勢合 +セゴウ 勢郷 +セゴエ 瀬越 +セコグチ 世古口 +セコグチ 瀬古口 +セコグチ 勢古口 +セコグチ 清湖口 +セコグチ 世子口 +セコザワ 瀬古沢 +セコザワ 瀬古澤 +セゴシ 瀬越 +セゴシ 勢越 +セコタ 迫田 +セコヒラ 迫平 +セコムネ 世古宗 +セザ 瀬座 +セサイ 瀬斉 +セサイ 瀬齋 +セザイ 瀬在 +セザイ 瀬斎 +セザイマル 瀬在丸 +セサカ 世坂 +セサキ 瀬崎 +セサキ 世佐木 +セサキ 瀬先 +セザキ 瀬崎 +セザキ 清崎 +セザキ 瀬嵜 +セザキ 妹崎 +セサコ 瀬迫 +セザコ 瀬迫 +セザコ 畝迫 +セザワ 瀬沢 +セザワ 瀬澤 +セザワ 妹沢 +セザワ 妹澤 +セシ 勢子 +セシ 勢志 +セシ 瀬師 +セシ 瀬志 +セジ 瀬路 +セジキ 世直 +セシタ 瀬下 +セシマ 瀬島 +セシマ 勢島 +セジマ 瀬島 +セジマ 瀬嶋 +セジマ 勢島 +セジマ 妹島 +セジマ 勢嶋 +セシメ 勢〆 +セシメ 瀬〆 +セシモ 瀬下 +セシモ 瀬霜 +セジモ 瀬下 +セシモト 瀬志本 +セシャケ 瀬社家 +セジヤマ 瀬治山 +セシュヤマ 世取山 +セジリ 瀬尻 +セシロ 瀬城 +セスミ 瀬角 +セズミ 瀬角 +セズミ 瀬住 +セセ 瀬々 +セセ 世瀬 +セセ 勢瀬 +セセ 瀬瀬 +ゼゼ 瀬々 +ゼゼ 膳所 +ゼゼ 瀬瀬 +ゼゼ 長膳 +セセイ 瀬々井 +セセキ 勢石 +セセクラ 瀬々倉 +セセナ 瀬々奈 +セソコ 瀬底 +セゾコ 瀬底 +セタ 清田 +セタ 瀬田 +セタ 勢田 +セタ 畝田 +セタ 世田 +セタ 勢多 +セタ 清多 +セタ 世多 +セタ 妹田 +セタ 瀬多 +セダ 清田 +セダ 瀬田 +セダ 勢田 +セダ 世田 +セタイ 瀬田井 +セタイシ 瀬田石 +セタカ 瀬高 +セタカ 畝高 +セダカ 瀬高 +セダカ 瀬嵩 +セタガワ 瀬田川 +セタキ 瀬滝 +セタケ 瀬嵩 +セダケ 瀬嵩 +セタダニ 畝田谷 +セダナ 瀬棚 +セタニ 瀬谷 +セタニ 清谷 +セダニ 清谷 +セタマツ 瀬田松 +セチ 瀬知 +セチ 畝地 +セチバル 世知原 +セチヤマ 瀬地山 +セチワ 設和 +セツ 瀬津 +セツ 説 +セツ 勢津 +セツ 世津 +セツ 成津 +セツ 岊 +ゼツ 是津 +ゼツ 舌 +セツイエ 節家 +セッカ 石家 +セッカ 石過 +セッカ 拙家 +セツガ 節賀 +セツガ 摂賀 +セヅカ 瀬塚 +セツカワ 節川 +セツキナイ 瀬月内 +セックダ 節句田 +セックデン 節句田 +セヅクリ 勢造 +セッコ 雪古 +セツコ 雪古 +ゼッコ 舌古 +ゼツコ 舌古 +セツジマ 節島 +セッシュウ 摂州 +セッソウ 雪草 +セッタ 説田 +セッタ 摂田 +セッタ 攝田 +セツタ 雪田 +セツタ 説田 +セツタ 節田 +セツタ 摂田 +セツダ 説田 +セツダ 節田 +セツダ 摂田 +セツダ 瀬津田 +セツダ 攝田 +セツダ 設田 +セッタイ 摂待 +セッタイ 接待 +セッタイ 攝待 +セッツ 摂津 +セッツ 攝津 +セツツ 瀬筒 +セヅツ 瀬筒 +ゼッツ 是津 +ゼッツ 舌津 +セツネ 瀬恒 +セツノ 清津野 +セツハラ 節原 +セツマサ 節政 +セツマル 瀬津丸 +セツマル 節丸 +セツミ 瀬津美 +セヅメ 瀬詰 +セヅメ 瀬爪 +セツヤ 世津谷 +セツヤス 節安 +セツヤマ 摂山 +セツラク 設楽 +セツワ 節和 +セデイ 瀬出井 +セト 瀬戸 +セト 背戸 +セト 世戸 +セト 勢登 +セト 瀬渡 +セト 世登 +セト 勢戸 +セト 清戸 +セト 脊戸 +セト 勢渡 +セト 門廻 +セト 世渡 +セト 瀬登 +セト 背渡 +セド 瀬戸 +セド 背戸 +セド 瀬渡 +セド 清土 +セド 脊戸 +セド 勢渡 +セド 門廻 +セド 勢頭 +セド 瀬度 +セド 瀬土 +セトイ 瀬戸井 +セトウ 瀬藤 +セトウ 瀬筒 +セトウ 瀬頭 +セトウ 勢藤 +セトウ 妹藤 +セトウ 瀬東 +セトウ 瀬籐 +セトウ 瀬涛 +セトウ 瀬濤 +セトウ 背藤 +セドウ 瀬藤 +セドウ 瀬堂 +セドウ 瀬道 +ゼトウ 是洞 +セトウエ 瀬戸上 +セトウジ 瀬戸宇治 +セトウチ 瀬戸内 +セトウラ 瀬戸浦 +セトオ 瀬戸尾 +セトオカ 瀬戸岡 +セドオカ 後岡 +セドオカ 瀬戸岡 +セトガイチ 瀬戸垣内 +セトガイチ 背戸開地 +セトガイチ 脊戸開地 +セトガウチ 瀬戸垣内 +セトガキ 瀬戸垣 +セトカネ 背戸兼(脊戸兼) +セトガネ 背戸兼(脊戸兼) +セトガミ 瀬戸上 +セトカワ 瀬戸川 +セトガワ 瀬戸川 +セトガワ 背戸川 +セトガワ 脊戸川 +セドカワ 瀬戸川 +セドガワ 瀬堂川 +セトカワウチ 背戸川内 +セトキ 勢塒 +セトクチ 瀬戸口 +セトグチ 瀬戸口 +セトグチ 世戸口 +セドグチ 瀬戸口 +セトクボ 後久保 +セドクボ 後久保 +セトクマ 瀬戸熊 +セトグマ 瀬戸熊 +セトケ 瀬戸家 +セドコウ 後幸 +セトゴウチ 背戸川内 +セトサカ 瀬戸坂 +セトサキ 瀬戸崎 +セトザキ 瀬戸崎 +セトシタ 瀬戸下 +セドシタ 瀬戸下 +セトシマ 瀬戸島 +セトジマ 瀬戸島 +セトジマ 瀬戸嶋 +セトジマ 世戸島 +セトジリ 瀬戸尻 +セトセ 瀬戸瀬 +セトダ 瀬戸田 +セトダ 背戸田 +セトダ 脊戸田 +セトタニ 瀬戸谷 +セトダニ 瀬戸谷 +セトドイ 背戸土井(脊戸土井) +セトナカ 瀬戸中 +セトナガ 瀬戸長 +セトニシ 瀬戸西 +セトネ 瀬戸根 +セトノ 瀬戸野 +セドノ 瀬殿 +セトノウエ 瀬戸ノ上 +セトバヤシ 瀬戸林 +セトハラ 後原 +セトハラ 世戸原 +セトハラ 瀬戸原 +セドハラ 後原 +セドバラ 後原 +セトヒガシ 瀬戸東 +セドヒラ 後平 +セトマ 瀬戸間 +セトマス 瀬戸升 +セトマル 瀬戸丸 +セトミツ 瀬戸光 +セトムラ 瀬戸村 +セトメ 瀬留 +セドメ 瀬留 +セトモト 瀬戸本 +セドモト 瀬戸本 +セトヤ 瀬戸谷 +セトヤ 瀬戸屋 +セトヤナギ 背戸柳 +セトヤナギ 脊戸柳 +セトヤマ 瀬戸山 +セトヤマ 脊戸山 +セトヤマ 背戸山 +セドヤマ 瀬戸山 +セトリヤマ 世取山 +セトワキ 瀬戸脇 +セナ 瀬名 +セナ 瀬那 +セナガ 世永 +セナガ 瀬長 +セナガ 施永 +セナガ 瀬永 +セナデ 背出 +セナハ 瀬名波 +セナハタ 瀬名畑 +セナミ 瀬名波 +セナミ 瀬波 +セナミ 瀬浪 +セナミ 世並 +セナミ 瀬並 +セナリ 瀬成 +セナリタ 瀬成田 +セニ 仙仁 +ゼニ 銭 +ゼニイ 銭井 +ゼニオ 銭尾 +ゼニオカ 銭岡 +ゼニオカ 錢岡 +ゼニガミ 銭神(錢神) +ゼニガミ 銭上 +ゼニカメ 銭亀(錢亀) +ゼニガメ 銭亀(錢亀) +ゼニガメ 銭瓶 +ゼニカワ 銭川 +ゼニグチ 銭口 +ゼニサカ 銭坂 +ゼニサワ 銭沢 +ゼニサワ 銭澤 +ゼニザワ 銭沢 +ゼニザワ 銭澤 +ゼニタ 銭田 +ゼニタ 錢田 +ゼニダ 銭田 +ゼニダイ 銭台 +ゼニタカ 銭高(錢高) +ゼニダカ 銭高(錢高) +ゼニタニ 銭谷 +ゼニタニ 錢谷 +ゼニヅカ 銭塚 +ゼニツボ 銭坪 +ゼニノ 銭野 +ゼニノ 錢野 +ゼニハナ 銭花 +ゼニバナ 銭花 +ゼニバヤシ 銭林 +ゼニハラ 銭原 +ゼニヒロ 銭広 +ゼニヒロ 銭廣 +ゼニブクロ 銭袋 +ゼニマル 銭丸 +ゼニムラ 銭村 +ゼニメ 銭目 +ゼニモト 銭本 +ゼニモト 銭元 +ゼニモリ 銭盛 +ゼニヤ 銭谷 +ゼニヤ 銭屋 +ゼニヤ 錢屋 +ゼニヤ 錢谷 +ゼニヤマ 銭山 +セヌキ 瀬貫 +ゼヌキ 銭貫 +セヌマ 瀬沼 +セノ 瀬野 +セノ 瀬能 +セノ 勢能 +セノ 勢野 +セノ 背野(脊野) +セノ 勢濃 +セノ 施野 +セノ 世野 +セノ 妹野 +セノウ 瀬尾 +セノウ 妹尾 +セノウ 瀬能 +セノウ 勢能 +セノウ 瀬納 +セノウ 妹能 +セノウ 勢濃 +セノウ 勢納 +セノウ 瀬濃 +セノウ 姓納 +セノウエ 瀬上 +セノウエ 瀬ノ上 +セノウエ 瀬之上 +セノウエ 瀬の上 +セノウチ 瀬内 +セノウチ 瀬ノ内 +セノウチ 瀬之内 +セノウラ 瀬浦 +セノウラ 瀬野浦 +セノオ 瀬尾 +セノオ 妹尾 +セノオ 瀬野尾 +セノオ 脊尾 +セノオ 瀬ノ尾 +セノオ 瀬能尾 +セノカワ 瀬野川 +セノキ 瀬廼木 +セノキ 瀬野木 +セノキ 瀬迺木 +セノクチ 瀬之口 +セノクチ 瀬ノ口 +セノクチ 瀬の口 +セノグチ 瀬之口 +セノグチ 瀬ノ口 +セノグチ 瀬野口 +セノシタ 瀬下 +セノタ 瀬ノ田 +セノダ 瀬野田 +セノブ 畝延 +セノマ 瀬之間 +セノモト 瀬之本 +セバ 瀬場 +セバ 勢羽 +セハタ 瀬畑 +セハタ 瀬端 +セハタ 瀬畠 +セハタ 勢籏(㔟簱) +セハタ 勢旗 +セハタ 勢畑 +セバタ 瀬畑 +セバタ 瀬端 +セバタ 瀬畠 +セバタ 畝畑 +セハナ 瀬端 +セハマ 瀬浜 +セハマ 瀬濱 +セバヤシ 瀬林 +セハラ 瀬原 +セハラ 畦原 +セハラ 勢原 +セハラ 妹原 +セバラ 瀬原 +セハラダ 瀬原田 +ゼヒ 是非 +セヒラ 瀬平 +セビラ 瀬平 +セブ 世歩 +セブチ 瀬渕 +セブチ 瀬淵 +セベ 瀬部 +セベ 瀬辺 +セベ 瀬邊 +セベ 瀬邉 +セホウシ 瀬法司 +セホウジ 瀬法司 +セホリ 瀬堀 +セボリ 瀬堀 +セマ 瀬間 +セマ 勢馬 +セマ 勢間 +セマイシ 狭石(狹石) +セマサ 瀬政 +セマチ 瀬町 +セマト 狭戸 +セマトオ 狭戸尾 +セマル 瀬丸 +セミ 瀬見 +セミ 勢見 +セミ 蝉 +セミ 瀬味 +セミ 世見 +セミイ 瀬見井 +セミイ 瀬美井 +セミオ 蝉尾 +セミオカ 蝉岡 +セミカワ 蝉川 +セミカワ 蟬川 +セミズ 瀬水 +セミズ 勢水 +セミゾ 背溝 +セミゾ 瀬溝 +セミタニ 蝉谷 +セミツ 瀬光 +セミヅカ 蝉塚 +セミヅキ 勢見月 +セミツヒロ 世光弘 +セミヒラ 蝉平 +セミマル 蝉丸 +セミモト 蝉本 +セミヤ 瀬宮 +セミヤ 世宮 +セムラ 瀬村 +セムラ 勢村 +セムロ 瀬室 +セメ 瀬目 +セメダ 責田 +セメヤ 清女谷 +セモト 畝本 +セモト 瀬本 +セモト 瀬元 +セモト 世本 +セモリ 瀬森 +セモリ 瀬守 +セヤ 瀬谷 +セヤ 勢屋 +セヤ 瀬屋 +セヤザキ 瀬谷崎 +セヤス 世安 +セヤス 瀬安 +セヤナギ 瀬柳 +セヤマ 瀬山 +セヤマ 清山 +セヤマ 妹山 +セヤマ 勢山 +セヤマ 背山 +セヤマ 脊山 +セヤマ 施山 +セヤマ 世山 +セラ 世良 +セラ 瀬良 +セラ 世羅 +セラ 瀬羅 +セラ 勢良 +セラ 勢羅 +セラ 妹良 +セライ 瀬来(瀬來) +セライ 世来 +セライ 世良井 +セラカキ 瀬良垣 +セラガキ 瀬良垣 +セラク 瀬楽(瀬樂) +セラタ 世良田 +セラタ 瀬良田 +セラタ 世羅田 +セラダ 世良田 +セラダ 瀬良田 +セラダ 世羅田 +セリ 世利 +セリ 瀬利 +セリ 善利 +セリ 谷利 +セリ 瀬理 +セリ 瀬里 +セリ 善理 +セリ 芹 +セリ 世理 +セリイ 芹井 +セリウ 芹生 +セリウチ 芹内 +セリエ 芹江 +セリオ 芹生 +セリオカ 芹岡 +セリカコ 芹加古 +セリガノ 芹ケ野 +セリカワ 芹川 +セリカワ 糴川 +セリキャク 勢理客 +セリクチ 芹口 +セリグチ 芹口 +セリザキ 瀬里崎 +セリサワ 芹沢 +セリサワ 芹澤 +セリザワ 芹沢 +セリザワ 芹澤 +セリザワ 瀬里沢 +セリザワ 瀬里澤 +セリタ 芹田 +セリタ 瀬利田 +セリダ 芹田 +セリノ 芹野 +セリハラ 芹原 +セリフ 芹生 +セリマチ 瀬理町 +セリモト 芹本 +セリヤマ 芹山 +セリュウ 芹生 +セリュウ 瀬立 +セリョウ 瀬領 +セレイ 勢禮(勢礼) +セロク 世六 +セワ 瀬和 +セワイ 瀬和居 +セワキ 瀬脇 +セワケ 瀬分 +セワタリ 瀬渡 +セワリ 細割 +セン 千 +セン 仙 +セン 専 +セン 誉 +ゼン 善 +ゼン 膳 +ゼン 禅 +センイ 仙井 +ゼンイン 禅院 +ゼンイン 禪院 +センオウ 銭王 +センオウシ 泉王子 +ゼンオカ 善岡 +センカ 仙花 +センガ 千賀 +センガ 仙賀 +センガ 仙河 +ゼンカ 善加 +センカイ 仙海 +ゼンカイ 前海 +ゼンカイ 善海 +センガイト 千垣内 +ゼンカメ 膳亀 +ゼンガメ 膳亀 +ゼンガメ 銭亀(錢亀) +センガリ 千刈 +センカワ 千川 +センカワ 先川 +センカワ 仙川 +センガワ 仙川 +ゼンカワ 善川 +ゼンカワ 全川 +センガン 千貫 +センガン 千眼 +センガン 仙貫 +センキ 千木 +センギ 千木 +センギ 仙木 +ゼンキ 善木 +ゼンキ 膳亀 +ゼンキ 前鬼 +センギク 千菊 +センキュウ 先久 +ゼンキュウ 善久 +センキョウ 千京 +ゼンキョウ 善教 +ゼンギョウ 善行 +ゼンギョウジ 善行地 +センギョク 扇玉 +センクラ 仙倉 +センクロ 仙黒 +センケ 千家 +センゲ 千家 +センゲ 先家 +ゼンケ 善家 +ゼンゲ 善家 +センゲツ 仙月 +センゲン 仙元 +センゲン 僊元 +センコ 千古 +センゴ 千後 +ゼンコ 前古 +ゼンゴ 前後 +センコウ 専光 +センコウ 川后 +センコウ 仙幸 +センゴウ 千郷 +センゴウ 千合 +ゼンコウ 善光 +ゼンコウ 膳光 +ゼンコウ 善幸 +ゼンゴウ 前郷 +センコウシ 千光士 +センコウジ 千光士 +センコウジ 専光寺 +センコウジ 千光寺 +センコウジ 先光寺 +ゼンコウジ 善光寺 +センゴク 仙石 +センゴク 扇谷 +センゴク 千石 +センゴク 仙谷 +センゴク 仙国 +センゴク 僊石 +センゴク 仙國 +センゴク 千斛 +センゴクダニ 千石谷 +センザ 仙座 +ゼンザ 前座 +ゼンザ 銭座 +センサイ 千歳 +センサイ 仙済 +センサイ 仙斎 +センサイ 仙齋 +センサイ 専斉 +センザイ 千歳 +センザイ 千財 +センザイ 仙才 +センザイ 仙斉 +センザイ 千才 +センザイ 千載 +センザイ 千戝 +ゼンサイ 善才 +ゼンサイ 善斉(善齊) +ゼンサイ 善斎 +ゼンサイ 全斉 +ゼンザイ 善財(善戝) +ゼンザイ 善哉 +センザイマル 千財丸 +センザイマル 千歳丸 +センザカ 千阪 +センザカ 仙坂 +センサキ 千先 +センザキ 先崎 +センザキ 千崎 +センザキ 仙崎 +センザキ 泉崎 +センザキ 千先 +センザキ 専崎 +センザキ 線崎 +センザキ 先嵜 +センザキ 千嵜 +センザキ 僊崎 +センザワ 泉沢 +センザワ 泉澤 +センザワ 千沢 +センザワ 千澤 +センザワ 仙沢 +センザワ 仙澤 +ゼンザワ 銭澤 +ゼンザワ 膳沢 +センジ 仙次 +センジ 千司 +ゼンシ 膳師 +ゼンシ 善志 +ゼンジ 前地 +ゼンジ 前寺 +ゼンジ 前司 +ゼンジ 善治 +センシキ 仙敷 +ゼンシゲ 善重 +センジマ 仙島 +センジマル 千寺丸 +センジマル 千地丸 +センシャ 千車 +センジャク 千尺 +センジャク 千沢口 +センジャク 千澤口 +ゼンジャク 善積 +センシュ 千手 +センジュ 千住 +センジュ 千手 +センジュ 千寿(千壽) +センシュウ 千秋 +センシュウ 専修 +センジュウ 千住 +センジュウ 千重 +ゼンジュウ 善住 +センショウ 千正 +センショウ 専称(専稱) +センショウ 泉松 +センジョウ 先生 +センジョウ 千條 +センジョウ 先城 +センジョウ 泉上 +センジョウ 千丈 +センジョウ 千条 +センジョウ 仙城 +センジョウ 千烝(千焏) +センジョウ 千絛 +ゼンショウ 善生 +ゼンショウ 善勝 +ゼンショウ 善正 +ゼンショウ 前正 +ゼンショウ 禅正(禪正) +ゼンジョウ 善定 +ゼンジョウ 禅定 +ゼンジョウ 前条 +ゼンジョウ 善上 +センジンヤマ 先陣山 +センス 扇子 +センズ 千手 +センスイ 泉水 +センスイ 仙水 +センスイ 先水 +センスイ 千水 +センズイ 泉水 +センズイ 泉対 +センズイ 泉津井 +センズイ 泉對 +センスギ 千杉 +センズワ 千頭和 +ゼンセ 膳瀬 +センセキ 仙石 +センソ 先曽 +センゾ 先祖 +センソウ 千艘 +ゼンソウハラ 善相原 +センゾク 千足 +センゾク 千速 +センゾク 千束 +センゾク 千僧供 +センゾクダニ 洗足谷 +センタ 千田 +センタ 仙田 +センタ 専田(專田) +センタ 仙太 +センダ 千田 +センダ 泉田 +センダ 船田 +センダ 仙田 +センダ 銭田 +センダ 専田(專田) +センダ 撰田 +センダ 千駄 +センダ 千旦 +センダ 煎田 +センダ 千且 +センダ 泉多 +ゼンタ 善田 +ゼンタ 銭田 +ゼンダ 善田 +ゼンダ 銭田 +ゼンダ 全田 +ゼンダ 膳田 +ゼンダ 錢田 +センダイ 千代 +センダイ 仙台 +センダイ 仙代 +センダイ 仙臺 +センダイ 仙題 +センダイヤ 千代谷 +センダイヤ 仙台谷 +ゼンダイラ 善平 +センタキ 千滝 +センタク 仙宅 +センダグチ 千田口 +センダチ 先達 +センダチ 先立 +センダチ 仙立 +センダツ 先達 +センダツ 先立 +センダツ 仙達 +ゼンタナ 膳棚 +ゼンダナ 膳棚 +センタニ 扇谷 +センタニ 銭谷 +センタニ 千谷 +センタニ 仙谷 +ゼンタニ 銭谷 +センダヤ 千田谷 +センタヤマ 仙田山 +センダヤマ 仙田山 +センダン 栴檀 +センダン 千檀 +センチ 泉地 +センヂ 千地 +ゼンチ 前地 +ゼンチク 善竹 +センチョウ 仙長 +センチョウ 千町 +センチョウ 仙丁 +ゼンチョウ 善長 +センツイ 泉対 +センツイ 泉津井 +センツイ 泉對 +ゼンツウ 善通 +ゼンヅカ 善塚 +ゼンツジ 善辻 +センツル 千鶴 +センヅワ 千頭和 +センテ 千手 +センテイ 泉亭 +センデヤ 先出谷 +ゼンデラ 前寺 +センデン 泉伝 +セント 専徒 +セント 專徒 +センド 仙土 +センド 仙度 +センド 千土 +セントウ 川東 +セントウ 仙頭 +セントウ 千藤 +セントウ 善塔 +セントウ 専頭 +セントウ 泉頭 +セントウ 専当 +セントウ 洗湯 +セントウ 先東 +セントウ 仙当 +セントウ 専當(專當) +センドウ 仙頭 +センドウ 仙道 +センドウ 千藤 +センドウ 川頭 +センドウ 船藤 +センドウ 千堂 +センドウ 仙藤 +センドウ 専頭 +センドウ 泉頭 +センドウ 専当 +センドウ 千同 +センドウ 潜道 +センドウ 船頭 +センドウ 先藤 +センドウ 千道 +センドウ 専當(專當) +ゼントウ 前東 +ゼントウ 前藤 +ゼントウ 善塔 +ゼントウ 善当 +ゼントウ 善藤 +ゼントウ 善當 +ゼンドウ 善道 +ゼンドウ 善藤 +セントウダ 仙洞田 +センドウタ 仙洞田 +センドウダ 仙洞田 +セントク 千徳 +セントク 仙徳 +セントク 専徳 +ゼントク 善徳 +ゼントク 全徳 +セントクイン 専徳院 +センナ 仙名 +センナ 先名 +センナ 千名 +ゼンナ 善名 +ゼンナ 善那 +センナイ 仙内 +センナイ 泉内 +センナカ 千中 +センナミ 仙浪 +ゼンナミ 善波 +ゼンナミ 善浪 +ゼンナミ 全並 +ゼンナミ 善並 +センナリ 千成 +センナリ 先成 +センナリ 千生 +センニ 仙仁 +センニチ 千日 +センニチザカ 千日坂 +センニュウ 仙入 +ゼンニュウ 善入 +ゼンニョ 善如 +ゼンニョウジ 善如寺 +ゼンニョジ 善如寺 +センニン 仙人 +センネン 千年 +センネンバラ 千年原 +センノ 千野 +センノ 仙野 +センノ 専能 +センノ 専野 +センノ 竱廼 +センノ 竱迺 +センノ 銑野 +ゼンノ 善野 +ゼンノ 禅野(禪野) +ゼンノ 全野 +センノウ 先納 +センノウ 専能 +センノウ 仙納 +センノウ 專能 +ゼンノウ 善納 +ゼンノウジ 善能寺 +センノキ 仙ノ木 +センノキ 仙之木 +センノキ 千ノ木 +センノザ 宣野座 +センノス 千巣 +センノス 千之巣 +センノハラ 千野原 +センノモト 千ノ本 +センノモト 千之本 +センバ 仙波 +センバ 船場 +センバ 千羽 +センバ 千馬 +センバ 千場(千塲) +センバ 仙葉 +センバ 仙場 +センバ 仙庭 +センバ 銭場 +センバ 舟場 +センバ 泉波 +センバ 千把 +センバ 先馬 +センバ 先場 +センバ 戦場 +センバ 舩場 +センバ 杣場 +センバ 杣塲 +ゼンバ 前場 +ゼンバ 善波 +ゼンバ 善場(善塲) +ゼンバ 膳場 +センパク 阡陌 +ゼンバナ 善端 +センバヤシ 千林 +ゼンバヤシ 善林 +センハラ 仙原 +センバラ 千原 +ゼンバラ 全原 +センビキ 千疋 +センビョウ 千俵 +ゼンヒラ 善平 +センブ 千歩 +センブ 仙部 +ゼンブ 善部 +ゼンブ 膳夫 +センフク 千福 +センプク 仙福 +センプク 千福 +センプク 泉福 +センプク 専福 +ゼンフク 善福 +ゼンプク 善福 +センフクジ 千福地 +センブツ 千仏 +ゼンブツ 前仏 +ゼンブツ 前佛 +センベ 千部 +ゼンベ 善部 +センボ 泉保 +センボ 千保 +センポ 泉保 +センポ 千保 +センポ 仙保 +センポ 専甫 +ゼンボ 善甫 +ゼンポ 善甫 +センボウ 千房 +センボウ 先坊 +センボウ 千棒 +センボウ 仙坊 +センボウ 千坊 +センボウ 仙防 +センボウ 専坊 +ゼンボウ 善坊 +ゼンポウ 善方 +ゼンポウ 善宝 +ゼンポウ 膳法 +ゼンポウ 善寳 +センボギ 千保木 +センボク 仙北 +センボク 仙木 +センボク 泉北 +センボクヤ 仙北谷 +センボクヤ 仙北屋 +センボシ 千星 +センボン 千本 +センボンギ 千本木 +センボンマツ 千本松 +センマ 千馬 +センマ 千間 +センマ 扇間 +センマチ 千町 +センマツ 千松 +センマル 千丸 +センマル 仙丸 +ゼンマン 善万 +センミツ 仙光 +センミョウ 仙名 +センミョウ 泉名 +センミョウ 専名 +ゼンミョウ 善明 +ゼンミョウ 善名 +センミョウジ 泉明寺 +センムラ 仙村 +ゼンムラ 善村 +センメ 千目 +ゼンメイ 善明 +ゼンモサ 善茂砂 +ゼンモサク 善茂作 +ゼンモシャ 善茂砂 +センモト 千本 +センモト 仙本 +ゼンモト 善本 +ゼンモト 全本 +センモリ 千森 +センヤ 泉谷 +センヤ 千谷 +センヤ 千屋 +センヤ 仙谷 +ゼンヤ 銭谷 +ゼンヤ 前屋 +ゼンヤ 善谷 +ゼンヤ 全屋 +センヤナギ 仙柳 +センヤマ 千山 +センヨ 千代 +センヨ 仙誉 +センヨ 仙譽 +ゼンヨウ 善用 +ゼンヨウシ 善養司 +ゼンヨウジ 善養寺 +ゼンリ 善利 +ゼンリ 善理 +センリウチ 千里内 +ゼンリク 善陸 +センリュウ 千竜 +センリュウ 千龍 +センリン 仙林 +センルイ 泉類 +ソ 楚 +ソアイ 曾合 +ソアイ 硤合 +ソアイ 曽合 +ソアキ 曽明 +ソアシ 曽足 +ソイ 副 +ソイ 曽井 +ソイカワ 添川 +ソイズミ 添泉 +ソイズミ 祖泉 +ソイズミ 曽泉 +ソイタ 添田 +ソイダ 添田 +ソイダ 副田 +ソイダ 惣伊田 +ソイチ 祖一 +ソイヤ 添谷 +ソイリ 鼠入 +ソウ 宗 +ソウ 薮 +ソウ 藪 +ソウ 荘 +ソウ 相 +ソウ 曽宇 +ソウ 莊 +ソウ 曾宇 +ソウ 掃 +ソウ 鞘佑 +ゾウ 蔵 +ゾウ 藏 +ソウアイ 相合 +ゾウアン 蔵庵 +ソウイ 相井 +ソウイ 草井 +ソウイチ 惣市 +ソウイン 宗院 +ソウウチ 走内 +ソウエ 惣江 +ソウエン 宗円 +ソウエン 宗圓 +ソウエン 荘園 +ソウエン 宗園 +ソウエン 荘圓 +ソウカ 荘加 +ソウカ 相嘉 +ソウカ 左右加 +ソウガ 相賀 +ソウガ 惣賀 +ソウガ 宗我 +ソウガ 宗賀 +ゾウカ 造賀 +ゾウガ 造賀 +ソウカイ 宗海 +ソウガミ 雙上 +ソウカワ 寒川 +ソウカワ 宗川 +ソウカワ 惣川 +ソウカワ 双川 +ソウカワ 𣷺川(㵤川) +ソウガワ 寒川 +ソウガワ 惣川 +ソウカン 宗官 +ソウキ 左右木 +ソウキ 惣木 +ソウギ 三木 +ソウギク 双菊 +ソウグチ 宗口 +ソウグチ 荘口 +ソウグチ 惣口 +ソウグモ 宗雲 +ソウクラ 宗倉 +ソウクラ 惣蔵 +ソウクラ 惣藏 +ゾウクラ 造倉 +ソウクリ 早栗 +ソウグリ 早栗 +ソウケ 総毛 +ソウケイ 惣慶 +ソウケジマ 笽島 +ソウケタニ 籅谷 +ソウケタニ 𥫣谷 +ソウゲン 惣元 +ソウゲン 宗玄 +ソウコ 相古 +ゾウゴ 蔵五 +ゾウゴ 藏五 +ソウゴウ 草郷 +ソウゴウ 惣郷 +ソウゴウ 双郷(雙郷) +ゾウゴウ 蔵合(藏合) +ソウコウジ 総麹 +ソウゴヤ 相合谷 +ソウゴン 荘厳 +ソウサ 宗佐 +ソウサ 匝瑳 +ソウサ 惣佐 +ソウサ 匝嵯 +ソウサ 双佐 +ソウザ 総三 +ソウザ 宗座 +ソウザ 蒼佐 +ソウザ 蒼座 +ゾウザ 蔵座 +ゾウザ 左座 +ゾウザ 造座 +ゾウザ 藏座 +ゾウザ 蔵坐(藏坐) +ソウザキ 宗崎 +ソウザキ 惣崎 +ソウザキ 左右崎 +ソウザキ 荘崎 +ゾウサク 造作 +ソウサコ 早迫 +ソウザワ 相沢 +ソウザワ 相澤 +ソウシ 荘子 +ソウシ 宗司 +ソウシ 双紙 +ソウジ 荘司 +ソウジ 相地 +ソウジ 惣路 +ソウジ 壮子 +ソウジ 惣次 +ゾウシ 造士 +ゾウシキ 蔵敷 +ゾウシキ 雑敷(雜敷) +ゾウシキ 雑色 +ゾウシキ 雜色 +ソウシマ 惣島 +ソウシマ 笽島 +ソウジマ 惣島 +ソウジマ 崇島 +ソウジマ 総島 +ゾウシマ 蔵島 +ゾウシマ 藏島 +ソウジュ 双樹 +ソウジュウ 抓揉 +ソウショ 荘所 +ソウジョウ 惣城 +ソウジョウ 走上 +ソウジョウ 宗条 +ソウジョウ 宗條 +ソウジョウ 惣定 +ゾウジョウ 蔵条 +ゾウジョウ 蔵條 +ゾウジョウ 藏條 +ソウジョウブン 惣上分 +ソウシン 宗心 +ソウシン 宗進 +ソウズ 相津 +ソウズ 寒水 +ソウズ 双須 +ソウズ 僧都 +ソウズ 双津 +ソウズ 左右都 +ソウスイ 惣水 +ソウズイ 惣水 +ソウズイ 相瑞 +ソウズシ 想厨子 +ソウスミ 惣角 +ソウスミ 相墨 +ソウズミ 惣角 +ソウズミ 相墨 +ソウズミ 摠墨 +ゾウズミ 造住 +ソウズヤマ 寒水山 +ソウセイ 蒼生 +ソウセキ 惣石 +ソウゼン 宗前 +ソウゼン 相前 +ソウゼン 惣前 +ゾウセン 造船 +ゾウゾウ 造々 +ソウタ 相田 +ソウタ 早田 +ソウタ 宗田 +ソウタ 左右田 +ソウタ 惣田 +ソウタ 草田 +ソウタ 双田 +ソウタ 雙田 +ソウタ 総田 +ソウダ 相田 +ソウダ 早田 +ソウダ 宗田 +ソウダ 左右田 +ソウダ 惣田 +ソウダ 草田 +ソウダ 造田 +ソウダ 荘田 +ソウダ 想田 +ソウダ 双田 +ソウダ 操田 +ソウダ 寒田 +ソウダ 雙田 +ソウダ 崇田 +ソウダ 総田 +ソウダ 佐右田 +ソウダ 惣多 +ソウダ 總田 +ゾウタ 造田 +ゾウダ 造田 +ソウダイ 惣台(惣臺) +ソウダイ 相台(相臺) +ソウダイ 惣代 +ソウダイ 双代 +ソウタニ 惣谷 +ソウタニ 摠谷 +ゾウタニ 象谷 +ソウタバタ 惣田畑 +ソウタヤ 惣田谷 +ソウチ 相知 +ソウチ 相地 +ソウチ 左右知 +ソウチ 佐八 +ソウチ 創地 +ソウチ 双知 +ソウチ 走内 +ソウチ 雙知 +ソウヂ 相地 +ゾウチ 蔵地 +ゾウチ 藏地 +ソウツ 惣津 +ソウヅ 相津 +ソウヅ 惣津 +ソウヅ 僧都 +ソウヅ 双津 +ソウヅ 左右津 +ソウヅ 左右都 +ソウヅ 宗津 +ソウヅ 僧津 +ソウヅ 僧頭 +ゾウツ 増津 +ゾウツ 増都 +ソウツカ 惣司 +ソウツカ 宗塚 +ソウツカ 惣塚 +ソウヅカ 宗塚 +ソウヅカ 惣塚 +ソウヅケ 惣附 +ソウツダ 早津田 +ゾウツボ 象坪 +ソウテ 蒦手 +ソウデ 早出 +ソウデ 惣出 +ソウテイ 宗亭 +ソウテイ 草亭 +ソウデン 宗伝 +ソウト 想都 +ソウド 惣戸 +ソウド 惣土 +ソウドウ 双道 +ソウドウ 惣道 +ソウトク 宗得 +ソウトク 宗徳 +ソウトメ 五月女 +ソウトメ 早乙女 +ソウトメ 五乙女 +ソウトメザカ 𣍲坂 +ソウナ 惣名 +ソウナイ 宗内 +ソウナイ 惣内 +ソウナカ 惣中 +ソウナカ 荘中 +ソウネ 総根 +ソウノ 草野(艸野) +ソウノ 宗野 +ソウノ 相野 +ソウノ 荘野 +ソウノ 素野 +ソウノ 惣野 +ソウノ 操野 +ソウノ 荘埜 +ソウノ 僧野 +ソウノ 惣埜 +ソウノ 荘乃 +ソウノウ 繰納 +ソウノダイ 惣野代 +ソウノダイ 相野台(相野臺) +ソウノダイ 竿台 +ソウノダイ 惣之代 +ソウノハラ 沢原 +ソウノハラ 澤原 +ソウノリ 惣則 +ソウバ 早場 +ソウハタ 惣畑 +ソウハチ 惣八 +ソウハマ 惣浜 +ソウバヤシ 荘林 +ソウハラ 草原 +ソウハラ 宗原 +ソウハラ 双原 +ソウハラ 荘原 +ソウハラ 宋原 +ソウハラ 惣原 +ソウバラ 双原 +ソウバル 草原 +ソウビキ 惣引 +ゾウブ 造武 +ソウフク 早福 +ソウフク 惣福 +ソウフク 相福 +ソウフク 宗福 +ソウフクワキ 惣福脇 +ソウフジ 惣藤 +ゾウブチ 蔵渕 +ゾウブチ 蔵淵 +ゾウブチ 藏淵 +ソウベ 惣部 +ゾウベ 雑部(雜部) +ソウボウ 惣坊 +ソウボク 惣卜 +ソウホラ 惣洞 +ソウボラ 惣洞 +ソウマ 相馬 +ソウマ 草間 +ソウマ 早馬 +ソウマ 相間 +ソウマ 惣馬 +ソウマ 惣間 +ソウマ 曾間 +ソウマイ 相米 +ソウマエ 宗前 +ソウマエ 相前 +ソウマエ 惣前 +ソウマタニ 相馬谷 +ソウマン 惣万 +ソウマン 宗万 +ソウマン 惣萬 +ソウミ 相見 +ソウミ 沢海 +ソウミ 澤海 +ソウミ 宗美 +ソウミ 総見 +ソウミツ 惣光 +ソウミツ 荘光 +ソウミネ 灌峰 +ソウミヤ 宗宮 +ソウミヤ 相宮 +ソウミョウ 惣明 +ソウミョウ 惣名 +ソウミョウ 宗明 +ソウムタ 草牟田 +ソウムラ 宗村 +ソウムラ 草村 +ソウムラ 荘村 +ソウムラ 惣村 +ソウムラ 総村 +ソウムラ 綜村 +ソウメイ 曽明 +ソウメン 素麺 +ゾウメン 蔵面(藏面) +ゾウメン 造免 +ゾウメン 象面 +ソウモト 惣本 +ソウモト 宋本 +ソウモト 想本 +ソウモリ 宗森 +ソウモリ 惣守 +ソウモン 惣門 +ソウヤ 増谷 +ソウヤ 曽谷 +ソウヤ 惣谷 +ソウヤ 荘谷 +ソウヤ 宗家 +ソウヤ 曽宇谷 +ソウヤマ 相山 +ソウヤマ 早山 +ソウヤマ 宗山 +ソウヤマ 惣山 +ソウヤマ 荘山 +ソウヤマ 曹山 +ゾウヤマ 雑山 +ゾウユウ 造勇 +ソウヨシ 宗吉 +ソウラ 祖浦 +ソウラク 宗楽(宗樂) +ソウラク 惣楽(惣樂) +ゾウラク 蔵楽 +ゾウラク 藏楽 +ゾウラク 藏樂 +ソウリ 惣宇利 +ソウリ 双里(雙里) +ソウリ 僧理 +ゾウリキ 造力 +ゾウリキ 蔵力 +ソウリョウ 惣領 +ソウリョウ 総領 +ソウリョウ 總領 +ソウリン 宗林 +ソウリンボウ 惣林坊 +ソウロ 草露 +ゾウロク 蔵録 +ソウワ 宗和 +ソウワ 相輪 +ソウワ 相和 +ソウワ 双和 +ソウワ 惣輪 +ソウワ 宗輪 +ソウワキ 惣脇 +ソエ 副 +ソエ 添 +ソエ 曽江 +ソエ 曾江 +ソエイ 曽江井 +ソエイシ 添石 +ソエオカ 添岡 +ソエカワ 添川 +ソエガワ 添川 +ソエキ 添木 +ソエゴウ 添郷 +ソエザワ 添沢 +ソエシゲ 副重 +ソエシマ 副島 +ソエシマ 添島 +ソエジマ 副島 +ソエジマ 添島 +ソエジマ 副嶋 +ソエジマ 添嶋 +ソエズミ 添泉 +ソエズミ 副角 +ソエタ 添田 +ソエダ 添田 +ソエダ 副田 +ソエダ 副枝 +ソエタカ 添高 +ソエタニ 添谷 +ソエダニ 添谷 +ソエノ 添野 +ソエノ 副野 +ソエノサワ 添ノ沢 +ソエノサワ 添ノ澤 +ソエハタ 添畠 +ソエハタ 添畑 +ソエハラ 添原 +ソエマツ 副松 +ソエモト 添本 +ソエモリ 添盛 +ソエヤ 添谷 +ソエヤマ 副山 +ソオ 曽尾 +ソオカワ 曾小川 +ソオカワ 曽小川 +ソオキ 左右木 +ソオズ 寒水 +ソオダ 早田 +ソオダ 宗田 +ソオダ 左右田 +ゾオダ 造田 +ソオデ 早出 +ソオトメ 五月女 +ソオトメ 早乙女 +ソオベ 祖生部 +ソオリ 曾織(曽織) +ソガ 曽我 +ソガ 曾我 +ソガ 曽賀 +ソガ 増家 +ソガ 蘇我 +ソガ 宗我 +ソガ 曾賀 +ソガ 蘇河 +ソガ 曹我 +ソガ 礎我 +ソカイ 祖開 +ソカイ 租開 +ソガイ 曽我井 +ソガイ 曽貝 +ソガイ 曾我井 +ソガイ 曾貝 +ソガイシ 曽我石 +ソガイシ 曾我石 +ソガオ 曾我尾 +ソガオ 曽我尾 +ソガカ 曽我賀 +ソガタ 曽方 +ソガタ 曾方 +ソガタ 曽我田 +ソガノ 曽賀野 +ソガノ 曽我野 +ソガノ 曾我野 +ソガノ 曾賀野 +ソガハタ 曽ケ端 +ソガハタ 曾ケ端 +ソガハラ 蘇我原 +ソガハラ 蘓我原 +ソカベ 曽我部 +ソカベ 曾我部 +ソカベ 會我部 +ソガベ 曽我部 +ソガベ 曾我部 +ソガベ 曾我辺(曾我邊) +ソガベ 宗我部 +ソガベ 曽我辺(曽我邉) +ソガベ 曹我部 +ソガミ 祖上 +ソガミ 曽我見 +ソガミ 曽我美 +ソガミ 宗上 +ソガミ 曾我美 +ソガメ 十亀 +ソガメ 曽亀 +ソガメ 曾亀 +ソガモト 曽我本 +ソガヤ 曽谷 +ソカワ 曽川 +ソガワ 十河 +ソガワ 寒川 +ソガワ 十川 +ソガワ 曽川 +ソガワ 祖川 +ソガワ 曾川 +ソガワ 走川 +ソガワ 素川 +ソガワ 祖月輪 +ソガワ 租川 +ソガワ 蘇川 +ソキ 曽木 +ソキ 釋 +ソギ 曽木 +ソギ 曾木 +ソギ 枌 +ソギ 曽祇 +ソギオ 枌尾 +ソギオカ 枌岡 +ソギタニ 枌谷 +ソギノ 枌野 +ソギハラ 枌原 +ソギモト 枌本 +ソギヤマ 枌山 +ソク 束 +ソクオウ 速応 +ソクオウ 速應 +ソクオカ 束岡 +ソクカワ 束川 +ソクガワ 束川 +ソクガワ 束河 +ソクザ 則座 +ソクサイ 息才 +ソクサイ 息戈 +ソクシロ 即城 +ソクセキ 即席 +ソクダ 束田 +ソクドウ 足道 +ソクナガ 速永 +ソクノ 息野 +ゾクマイ 続米(續米) +ゾクマス 属増 +ソクラ 曽倉 +ソクラ 曾倉 +ソケイ 祖慶 +ソケイ 惣慶 +ソケイ 曽慶 +ソケイ 曾慶 +ソゲノ 枌野 +ソケン 祖堅 +ソコ 底 +ソゴウ 十河 +ソゴウ 十川 +ソゴウ 十合 +ソゴウ 楚郷 +ソゴウ 曾郷 +ソゴウ 曽郷 +ソコオシ 底押 +ソゴシ 曽越 +ソゴシ 曾越 +ソコタ 底田 +ソコダ 底田 +ソコハラ 底原 +ソコビキ 低引 +ソコミズ 底水 +ソサ 曾佐 +ソサ 曽佐 +ソサカ 楚坂 +ソサカ 楚阪 +ソサカ 曽坂 +ソザキ 曽崎 +ソザキ 曾碕(曽碕) +ソザワ 曽沢 +ソザワ 曽澤(曾澤) +ソシ 曾雌 +ソシ 曽雌 +ソシ 曾子 +ソシ 祖師 +ソシ 曾師 +ソシ 曽子 +ソシ 曾志(曽志) +ソシ 曾紙 +ソシ 曽師 +ソジ 曽爾 +ソジ 曾爾 +ソシキ 祖式 +ソシキ 祖敷 +ソシザキ 曾志崎 +ソシザキ 曽志崎 +ソシノ 曾篠 +ソシノ 曽篠 +ソジマ 租島 +ソシロ 十代 +ソシロダ 十代田 +ソセ 曽瀬 +ソセキ 曽碩 +ソセダ 曾世田 +ソソギ 淋 +ソソギ 曾々木 +ソソギ 曽々木 +ソソミネ 潅峰 +ソソミネ 潅峯 +ソソミネ 灌峰 +ソソミネ 灌峯 +ソソリ 直下 +ソタ 曽田 +ソタ 曾田 +ソタ 祖田 +ソタ 祖多 +ソタ 租多 +ソダ 曽田 +ソダ 曾田 +ソダ 祖田 +ソダ 蘇田 +ソダ 素田 +ソダ 楚田 +ソダ 租田 +ソダテ 孚育 +ソタニ 曽谷 +ソタニ 曾谷 +ソタニ 祖谷 +ソタニ 素谷 +ソタニ 鼡谷 +ソダニ 曽谷 +ソダニ 曾谷 +ソダニ 素谷 +ソチ 曾地 +ソチ 曽地 +ソチ 祖地 +ソツ 素都 +ソツ 帥 +ソッカ 束花 +ソツカ 曽束 +ソツカ 曾塚 +ソツカ 曽塚 +ソッタ 反田 +ソッタ 卒田 +ソツダ 卒田 +ソツマ 卒間 +ソデ 外 +ソデ 走出 +ソデ 袖 +ソデ 曽出 +ソデ 岨手 +ソデ 祖出 +ソデイ 袖井 +ソデウラ 袖浦 +ソデオカ 袖岡 +ソデガイチ 袖ケ市 +ソデガウラ 袖ケ浦 +ソデガキ 袖垣 +ソデガミ 袖上 +ソデカワ 袖川 +ソデキ 袖木 +ソデギ 袖木 +ソデグチ 袖口 +ソデコダ 袖子田 +ソデサキ 袖崎 +ソデサキ 袖裂 +ソデサキ 袖嵜 +ソデザキ 袖崎 +ソデサワ 袖沢 +ソデサワ 袖澤 +ソデザワ 袖沢 +ソデザワ 袖澤 +ソデシタ 袖下 +ソデシマ 袖島 +ソデシマ 袖嶋 +ソデジョウ 袖城 +ソデタ 袖田 +ソデタイ 袖平 +ソデタツ 袖達 +ソデタニ 袖澗 +ソデタニ 袖谷 +ソテツ 蘇鉄(蘓鉄) +ソテツモト 蘇鉄本 +ソデナカ 袖中 +ソデナガ 袖長 +ソデナガ 袖永 +ソデナカイ 袖中居 +ソデノ 袖野 +ソデノ 袖之 +ソデバヤシ 袖林 +ソデムラ 袖村 +ソデモト 袖本 +ソデモリ 袖森 +ソデヤ 袖屋 +ソデヤマ 外山 +ソデヤマ 袖山 +ソデヨシ 袖吉 +ソデワキ 袖脇 +ソデン 祖伝 +ソデン 祖傳 +ソト 外 +ソト 曾戸 +ソト 曽戸 +ソトアカ 外赤 +ソトイ 外井 +ソトイケ 外池 +ソトイシ 外石 +ソトイワネ 外岩根 +ソトウチ 外内 +ソトウミ 外海 +ソトウラ 外浦 +ソトウラ 外裏 +ソトオ 外尾 +ソトオカ 外岡 +ソトオサ 外筬 +ソトオバラ 外尾原 +ソトオンボウ 外音防 +ソトガイ 外飼 +ソトガキ 外垣 +ソトカク 外角 +ソトガク 外角 +ソトカワ 外川 +ソトガワ 外川 +ソトカワウチ 外川内 +ソトキ 外木 +ソトギ 外義 +ソトグチ 外口 +ソトグチ 外戸口 +ソトクボ 外久保 +ソトクラ 外蔵 +ソトゴシ 外越 +ソトコバ 外木場(外木塲) +ソトザキ 外崎 +ソトサワ 外沢 +ソトサワ 外澤 +ソトザワ 外沢 +ソトザワ 外澤 +ソトシタ 外下 +ソトジマ 外島 +ソトジマ 外嶋 +ソトジョウ 外城 +ソトシロ 外城 +ソトゾノ 外園 +ソトゾノ 外薗 +ソトダ 外田 +ソトタイ 外平 +ソトダテ 外館 +ソトダテ 外舘 +ソトダテ 外立 +ソトタニ 外谷 +ソトチ 外地 +ソトヅカ 外塚 +ソトデ 外手 +ソトニシ 外西 +ソトノ 外野 +ソトノサワ 外ノ沢 +ソトハサ 外枷 +ソトハタ 外畑 +ソトバタ 外畑 +ソトハマ 外浜 +ソトハマ 外濱 +ソトバヤシ 外林 +ソトハラ 外原 +ソトヒラ 外平 +ソトベ 外部 +ソトヘボ 外枦保(外櫨保) +ソトホリ 外堀 +ソトボリ 外堀 +ソトマ 外間 +ソトマエハラ 外前原 +ソトマツ 外松 +ソトマル 外丸 +ソトミ 外海 +ソトミネ 外峯 +ソトミネ 外峰 +ソトミネ 外嶺 +ソトムラ 外村 +ソトヤ 外谷 +ソトヤ 外矢 +ソトヤシキ 外屋敷 +ソトヤチ 外谷地 +ソトヤナギ 外柳 +ソトヤマ 外山 +ソトワ 外輪 +ソトワ 外和 +ソトワダ 外和田 +ソナ 曽奈 +ソナ 祖納 +ソナエ 備 +ソナエ 備江 +ソナガ 曹永 +ソナミ 楚南 +ソナミ 曽波 +ソナミ 素波 +ソナミ 曾波 +ソナモト 祖納元 +ソナレ 磯馴 +ソナン 楚南 +ソニシ 噌西 +ソニワ 曽庭 +ソネ 曽根 +ソネ 曾根 +ソネ 曽祢 +ソネ 祖根 +ソネ 曽禰 +ソネ 曾禰 +ソネ 宗根 +ソネ 曾祢 +ソネ 曽称 +ソネ 素根 +ソネ 僧根 +ソネ 孫根 +ソネイ 曾根井 +ソネイ 曽根井 +ソネウラ 埣浦 +ソネオカ 曽根岡 +ソネオカ 曾根岡 +ソネカツ 曽根勝 +ソネカワ 曽根川 +ソネカワ 曾根川 +ソネガワ 曽根川 +ソネガワ 曾根川 +ソネザキ 曽根崎 +ソネザキ 曾根崎 +ソネザキ 曽根嵜(曾根嵜) +ソネザワ 曽根沢 +ソネザワ 曾根澤 +ソネシタ 曽根下 +ソネタ 曽根田 +ソネタ 曾根田 +ソネタ 椊田 +ソネタ 枠田 +ソネダ 曽根田 +ソネダ 曾根田 +ソネダ 埇田 +ソネダ 埆田 +ソネタカ 曽根高(曾根高) +ソネツカ 埣塚 +ソネヅカ 埣塚 +ソネヅカ 曽根塚 +ソネツジ 曽根辻 +ソネハラ 曽根原 +ソネハラ 曾根原 +ソネハラ 崇原 +ソネハラ 曽禰原 +ソネハラ 曽祢原 +ソネハラ 會根原 +ソネモト 曽根本 +ソネモト 曾根本 +ソネモト 曽根元 +ソネワキ 曽根脇 +ソノ 園 +ソノ 曽野 +ソノ 薗 +ソノ 素野 +ソノ 岨野 +ソノ 爾 +ソノ 曾野 +ソノ 苑 +ソノ 其野 +ソノ 蘓野 +ソノイ 園井 +ソノイ 薗井 +ソノイケ 園池 +ソノイケ 其池 +ソノイデ 薗出 +ソノウ 園生 +ソノウエ 園上 +ソノウチ 園内 +ソノウチ 薗内 +ソノウラ 園浦 +ソノウラ 其浦 +ソノウラ 薗浦 +ソノエ 園江 +ソノオ 園尾 +ソノオ 園生 +ソノオ 園雄 +ソノオ 薗尾 +ソノオカ 園岡 +ソノカ 園可 +ソノガシラ 薗頭 +ソノガシラ 園頭 +ソノカミ 其上 +ソノガミ 園上 +ソノガミ 其上 +ソノカワ 園川 +ソノカワ 後川 +ソノカワ 薗川 +ソノカワ 其川 +ソノカワ 苑川 +ソノガワ 後川 +ソノキ 園木 +ソノキ 園城 +ソノキ 蘇木 +ソノキ 其木 +ソノキ 苑樹 +ソノキ 曽ノ木 +ソノギ 園木 +ソノギ 蘇木 +ソノギ 彼杵 +ソノクイ 園杭 +ソノグチ 園口 +ソノグチ 薗口 +ソノクラ 園倉 +ソノケ 園家 +ソノサカ 園坂 +ソノサキ 園崎 +ソノサキ 薗崎 +ソノサキ 彼崎 +ソノザキ 園崎 +ソノザキ 薗崎 +ソノザキ 園嵜 +ソノサト 園里 +ソノジ 園路 +ソノシタ 園下 +ソノジマ 園島 +ソノシロ 園城 +ソノソ 園曽 +ソノソ 園曾 +ソノタ 園田 +ソノタ 其田 +ソノダ 園田 +ソノダ 薗田 +ソノダ 其田 +ソノダ 苑田 +ソノダ 囿田 +ソノダ 曾野田 +ソノダ 曽野田 +ソノタキ 園滝 +ソノタキ 園瀧 +ソノタケ 其竹 +ソノタニ 園谷 +ソノタニ 其谷 +ソノツ 其都 +ソノツカ 園塚 +ソノヅカ 園塚 +ソノデ 園出 +ソノナカ 園中 +ソノノ 園野 +ソノハタ 園畠 +ソノハタ 園畑 +ソノハタ 薗畠 +ソノハタ 薗畑 +ソノハタ 其畑 +ソノバタ 園畠 +ソノバタ 園畑 +ソノバタ 薗畑 +ソノハナ 園花 +ソノバヤシ 園林 +ソノバヤシ 薗林 +ソノハラ 園原 +ソノハラ 其原 +ソノハラ 苑原 +ソノハラ 薗原 +ソノフチ 園渕(園淵) +ソノベ 園部 +ソノベ 薗部 +ソノベ 園辺(園邉) +ソノベ 薗辺(薗邉) +ソノベ 曽野部 +ソノベ 其部 +ソノベ 園延 +ソノベ 曾野部 +ソノベ 園邊 +ソノベ 苑部 +ソノベ 蘇野辺 +ソノベ 蘓野邉 +ソノマタ 園又 +ソノマチ 其町 +ソノミチ 園道 +ソノミヤ 園宮 +ソノムラ 園村 +ソノムラ 薗村 +ソノムラ 其村 +ソノモト 園本 +ソノモト 園元 +ソノモト 苑本 +ソノヤ 相野谷 +ソノヤ 園屋 +ソノヤ 園家 +ソノヤシキ 園屋敷 +ソノヤマ 園山 +ソノヤマ 其山 +ソノヤマ 薗山 +ソノヤマ 囿山 +ソノワ 其輪 +ソノワ 園和 +ソノワキ 其脇 +ソハ 曽羽 +ソバ 曽場 +ソバ 峙 +ソバ 曽波 +ソバ 曾場(曾塲) +ソバイシ 卒場石 +ソバオ 曽場尾 +ソバガキ 側垣 +ソバキリ 蕎麦切 +ソバギリ 蕎麦切 +ソバシマ 傍島 +ソバシマ 傍嶋 +ソバシマ 側島(側嶋) +ソバジマ 傍島 +ソバジマ 傍嶋 +ソバジマ 側島(側嶋) +ソバタ 傍田 +ソバタ 蕎麦田(蕎麥田) +ソバタ 蘇畑 +ソバタ 蘓畑 +ソバダ 傍田 +ソバタカ 側高 +ソバタニ 蕎麦谷 +ソバナ 素花 +ソバハラ 蕎原 +ソバハラヤ 蕎原屋 +ソハマ 祖浜 +ソハマ 祖濱 +ソバミ 側見 +ソハラ 曽原 +ソハラ 曾原 +ソハラ 蘇原 +ソハラ 蘓原 +ソハラ 蕎原 +ソハラ 麁原 +ソヒラ 祖平 +ソブ 蘇武 +ソブ 曽部 +ソブ 蘓武 +ソフエ 祖父江 +ソブエ 祖父江 +ソブエ 曽不江 +ソブエ 租父江 +ソフカワ 曽布川 +ソフカワ 曾布川 +ソフカワ 祖父川 +ソブカワ 曽布川 +ソブカワ 曾布川 +ソブカワ 曽武川 +ソブガワ 曽布川 +ソブガワ 會布川 +ソフク 曽福 +ソフク 祖福 +ソブク 曽福 +ソブク 曾福 +ソフニ 祖父尼 +ソフモト 祖父元 +ソベ 曽部 +ソベ 曾部 +ソボ 素保 +ソボイ 祖母井 +ソボウラ 祖母浦 +ソボガ 祖母賀 +ソボニタ 祖母仁田 +ソマ 杣 +ソマ 蘇馬 +ソマイ 仙井 +ソマイ 杣井 +ソマガニシ 杣ケ西 +ソマカワ 杣川 +ソマガワ 杣川 +ソマキ 杣木 +ソマザキ 杣崎 +ソマザワ 杣沢 +ソマザワ 杣澤 +ソマタ 杣田 +ソマタ 曽又 +ソマダ 杣田 +ソマタニ 杣谷 +ソマツ 杣津 +ソマヅ 杣津 +ソマデ 杣出 +ソマド 杣戸 +ソマトモ 杣友 +ソマトリ 杣取 +ソマドリ 杣取 +ソマノ 杣野 +ソマノショウ 杣庄 +ソマハタ 杣畑 +ソマバヤシ 杣林 +ソマハラ 杣原 +ソマモト 杣本 +ソマヤ 杣谷 +ソマヤマ 杣山 +ソマヨ 杣与 +ソミグチ 早水口 +ソミズ 曽水 +ソミズ 素水 +ソミヤ 曽宮 +ソミヤ 曾宮 +ソミヤ 素宮 +ソムカイ 惣向 +ソムカワ 曽武川 +ソムカワ 曾武川 +ソムラ 曽村 +ソムラ 曾村 +ソムラ 素村 +ソムラ 蘓村 +ソメ 染 +ソメイ 染井 +ソメイ 曽明 +ソメイ 染伊 +ソメイシ 染石 +ソメウラ 染浦 +ソメオカ 染岡 +ソメカワ 染川 +ソメカワ 染河 +ソメガワ 染川 +ソメキ 染木 +ソメクラ 染倉 +ソメコ 染小 +ソメゴウ 染郷 +ソメザキ 染崎 +ソメザワ 染沢(染澤) +ソメジ 染次 +ソメシマ 染島 +ソメジマ 染島 +ソメセ 染瀬 +ソメタ 染田 +ソメダ 染田 +ソメタニ 染谷 +ソメタヤ 染田屋 +ソメテ 染手 +ソメナカ 染中 +ソメノ 染野 +ソメノヤ 染野谷 +ソメハ 染葉 +ソメハ 染羽 +ソメバ 染葉 +ソメハシ 染橋 +ソメバヤシ 染林 +ソメハラ 染原 +ソメビシ 染菱 +ソメミチ 染道 +ソメミヤ 染宮 +ソメムラ 染村 +ソメモト 染本 +ソメモリ 染森 +ソメヤ 染谷 +ソメヤ 染矢 +ソメヤ 染屋 +ソメヤ 染也 +ソメヤマ 染山 +ソメワケ 染分 +ソモト 素本 +ソモト 祖下 +ソヤ 征矢 +ソヤ 曽谷 +ソヤ 曽屋 +ソヤ 祖谷 +ソヤ 曽家 +ソヤ 祖家 +ソヤ 曾屋 +ソヤ 曽矢 +ソヤ 曾家 +ソヤ 曾矢 +ソヤ 蘇谷 +ソヤギミ 十八公 +ソヤノ 征矢野 +ソヤハラ 曾谷原(曽谷原) +ソヤマ 曽山 +ソヤマ 曾山 +ソヤマ 祖山 +ソヤマ 楚山 +ソヤマ 襲山 +ソヤマ 岨山 +ソヤマ 蘇山 +ソヤムラ 曾谷村(曽谷村) +ソヨウ 蘇要 +ソヨギ 梵 +ソヨシマ 曾与島 +ソヨシマ 曽与島(曽與島) +ソヨジマ 曾代島 +ソヨジマ 曽代島 +ソヨジマ 曽与島(曽與島) +ソヨダ 十代田 +ソヨダ 曽余田 +ソヨダ 曽世田 +ソラ 空 +ソラ 曽良 +ソラ 楚良 +ソラ 曾羅 +ソラ 祖羅 +ソラ 素羅 +ソライ 空井 +ソライ 徂徠 +ソライ 蘇来 +ソライエ 空家 +ソライケ 空池 +ソライズミ 空泉 +ソラウエ 空上 +ソラオ 空尾 +ソラオカ 空岡 +ソラオカ 曾良岡 +ソラオカ 曽良岡 +ソラオト 空韻 +ソラガ 上賀 +ソラガウチ 空垣内 +ソラガキウチ 空垣内 +ソラカゼ 空風 +ソラカド 空門 +ソラカワ 空川 +ソラキ 天木 +ソラキ 空木 +ソラグチ 空口 +ソラクボ 空久保 +ソラクマ 空熊 +ソラコウチ 空河内 +ソラゴウチ 空河内 +ソラサキ 空先 +ソラサキ 空崎 +ソラザキ 空崎 +ソラサワ 空沢 +ソラサワ 空澤 +ソラザワ 空澤 +ソラジ 空地 +ソラシタ 空下 +ソラジョ 空処 +ソラジョ 空處 +ソラタ 空田 +ソラダ 空田 +ソラタニ 空谷 +ソラチ 空地 +ソラチ 空知 +ソラテ 空手 +ソラト 空戸 +ソラナカ 空中 +ソラナカ 曾良中(曽良中) +ソラニシ 空西 +ソラノ 空野 +ソラバ 空場 +ソラハシ 空橋 +ソラハタ 空畑 +ソラハナ 空華 +ソラハマ 空浜 +ソラバヤシ 空林 +ソラマ 空間 +ソラマス 空増 +ソラミ 空見 +ソラミネ 空峰 +ソラミネ 空峯 +ソラムネ 空宗 +ソラモト 空本 +ソラモト 空元 +ソラモリ 空森 +ソラヤマ 空山 +ソラワキ 空脇 +ソリ 曽利 +ソリ 蘇理 +ソリ 曽里 +ソリ 反 +ソリ 素利 +ソリ 曾利 +ソリ 蘓理 +ソリ 楚里 +ソリアノ 曽利吾乃 +ソリオカ 反岡 +ソリキ 反木 +ソリタ 反田 +ソリタ 輪田 +ソリタ 返田 +ソリタ 曽利田 +ソリタ 曽里田 +ソリタ 橇田 +ソリタ 曾利田 +ソリタ 曾里田 +ソリダ 反田 +ソリダ 輪田 +ソリダ 刺田 +ソリダ 曽利田 +ソリダ 曽里田 +ソリダ 祖利田 +ソリダ 剃田 +ソリダ 剌田 +ソリハシ 反橋 +ソリヒサ 曽利久 +ソリマチ 反町 +ソリマチ 﨤町 +ソリマチ 返町 +ソリメ 反り目 +ソリメ 反リ目 +ソリメ 祖利目 +ソリメ 反目 +ソリモト 反本 +ソリヨシ 反吉 +ソレマツ 夫松 +ソロ 宗呂 +ソロイ 揃 +ソロイダ 揃田 +ソロエ 揃江 +ソロジ 曽路地 +ソロジ 輪地 +ソロジ 曹路地 +ソロリ 曽路里 +ソロリ 曽呂利 +ソロリ 曽呂里 +ソワ 曽和 +ソワ 宗和 +ソワ 岨 +ソワ 曽羽 +ソワ 十和 +ソワ 峙 +ソワ 曾和 +ソワ 曽波 +ソワ 曽輪 +ソワ 楚輪 +ソワ 楚和 +ソワ 租和 +ソワ 素和 +ソワ 草羽 +ソワ 曾羽 +ソワ 曾波 +ソワ 曾波 +ソワ 曾輪 +ソワ 曾和 +ソワ 祖和 +ソワ 素輪 +ソワ 蘇和 +ソワ 蘓和 +ソワシタ 岨下 +ソワダ 曽和田 +ソワナカ 岨中 +ソワノ 岨野 +ソンク 孫工 +ソンジョウ 村城 +ソンセ 尊瀬 +ソンタ 孫田 +ソンダ 孫田 +ソンダ 尊田 +ソンタニ 尊谷 +ソントウ 村東 +ソンドウ 尊藤 +ソンニュウ 孫入 +ソンニュウ 尊入 +ソンノ 尊野 +ソンノウ 尊能 +ソンパチ 尊鉢 +ソンポ 尊保 +ソンマ 尊馬 +タ 田 +ダア 駄阿 +タアゲ 田揚 +タアゴ 他阿呉 +タアライ 田荒井 +タイ 田井 +タイ 泰 +タイ 多井 +タイ 太 +タイ 太井 +タイ 鯛 +タイ 田居 +タイ 太居 +タイ 但井 +タイ 田結 +タイ 伹井 +タイ 多居 +タイ 対(對) +ダイ 台(薹) +ダイ 代 +ダイ 臺 +ダイ 大 +タイアミ 体阿弥 +タイアミ 体阿彌 +タイアミ 鯛網 +タイアミ 躰阿弥 +タイアン 太安 +ダイアン 大安 +ダイアン 大庵 +タイイ 泰井 +タイイ 泰居 +タイイ 𣳾井 +ダイイ 台井 +ダイイグチ 大井口 +ダイイン 大院 +ダイウチ 台内(臺内) +タイエ 田家 +タイエ 太江 +ダイエイ 大栄 +ダイエン 大円 +タイエンチョウ 泰円澄 +タイエンチョウ 泰園澄 +タイエンチョウ 泰圓澄 +ダイエンボウ 大円坊 +ダイオ 大尾 +ダイオウ 大王 +ダイオウマル 大王丸 +ダイオオジ 大雄寺 +タイオカ 体岡 +ダイオカ 大岡 +ダイオキ 台沖(臺沖) +ダイオク 大屋 +タイカ 鯛家 +タイガ 大賀 +タイガ 太賀 +タイガ 大雅 +ダイカ 大家 +タイカイ 大海 +タイカイ 大快 +ダイカイ 大海 +ダイカイ 大開 +ダイカイ 大快 +ダイカイジ 大海寺 +タイガイチ 泰垣内 +ダイカク 大角 +ダイガク 大学 +ダイガク 台岳 +ダイガク 大學 +ダイカクチ 大角地 +ダイガセ 大河瀬 +タイカツ 鯛勝 +ダイカツ 大勝 +ダイカワ 大川 +ダイカワ 台川(臺川) +ダイガンマル 大鴈丸(大雁丸) +タイキ 大木 +タイキ 対喜(對喜) +ダイキ 大木 +ダイキ 大亀 +ダイキ 大喜 +ダイキ 台木(臺木・薹木) +ダイキ 大貴 +ダイキチ 大吉 +ダイキュウ 大久 +ダイキュウ 大給 +ダイキュウ 大休 +ダイキュウ 代久 +ダイキュウジ 大休寺 +タイギョ 大漁 +ダイキョ 大居 +ダイキョウ 大鏡 +ダイキョウ 大京 +ダイキョウジ 大京寺 +ダイギョウジ 大行司 +ダイキョク 大極 +ダイキン 大欣 +タイク 多幾 +ダイク 大久 +ダイク 大工 +ダイク 大丘 +ダイク 大九 +ダイク 大句 +ダイク 代工 +ダイク 台区 +ダイグウジ 大宮司 +ダイグウジ 代宮司 +ダイクジ 大工地 +ダイクゾノ 大工園 +ダイクタニ 大工谷 +タイグチ 鯛口 +ダイグチ 大口 +ダイグチ 代口 +ダイクハラ 大工原 +ダイクバラ 大工原 +ダイクマチ 大工町 +ダイクヤ 大工谷 +ダイクヤ 大工屋 +ダイクヤ 大工舎 +タイケ 大家 +タイケ 田池 +ダイケ 大家 +タイケイ 大慶 +タイゲツ 対月 +タイゲン 太源 +ダイゲン 大源 +ダイゲン 大玄 +ダイゲンジ 大源寺 +タイコ 平子 +タイコ 大胡 +タイコ 大古 +タイコ 太古 +タイコ 太鼓 +タイコ 大鼓 +タイコ 太皷 +タイコ 大皷 +ダイコ 大古 +ダイコ 大湖 +ダイゴ 醍醐 +ダイゴ 大胡 +ダイゴ 大後 +ダイゴ 大庫 +ダイゴ 太期 +ダイゴ 大伍 +ダイゴ 大后 +ダイゴ 大期 +ダイゴ 大五 +ダイゴ 大語 +ダイゴ 太呉 +ダイゴ 代古 +ダイゴ 大護 +ダイゴ 大梧 +ダイゴ 醍湖 +タイコイシ 大鼓石 +タイコイシ 大皷石 +タイコウ 太向 +タイコウ 大甲 +タイコウ 太幸 +タイコウ 大孝 +タイコウ 太閤 +ダイコウ 大工 +ダイコウ 大幸 +ダイコウ 大光 +ダイコウ 大興 +ダイゴウ 大郷 +タイコウジ 大光司 +ダイコウジ 大光寺 +ダイゴウジ 大郷司 +タイコウボウ 太公望 +ダイコク 大黒 +ダイコク 大極 +ダイコク 大國 +ダイコク 大穀 +ダイコク 大殻 +ダイゴク 大極 +ダイコクガワ 大谷川 +ダイコクシ 大黒司 +ダイコクヤ 大黒谷 +ダイコクヤ 大黒屋 +タイコジ 太鼓地 +タイコジ 太皷地 +ダイゴシ 台越(臺越) +タイコバ 太鼓場 +ダイコハラ 大小原 +ダイゴホウ 大悟法 +ダイゴボウ 大悟法 +タイコヤ 太鼓矢 +ダイゴン 大権 +ダイコンヤ 大根谷 +タイサ 太佐 +ダイザ 台座 +ダイザ 台坐 +ダイサイ 大西 +ダイサカ 大坂 +ダイサカ 台坂(臺坂) +ダイサカ 代阪 +タイザキ 對崎 +ダイサキ 大崎 +タイサク 多井作 +ダイサク 大作 +タイザワ 田井沢 +タイザワ 泰沢 +タイザワ 泰澤 +タイザワ 田井澤 +タイシ 大司 +タイシ 太子 +タイシ 田石 +タイシ 多石 +タイシ 太井子 +タイシ 泰志 +タイジ 泰地 +タイジ 太地 +タイジ 田井治 +タイジ 鯛治 +タイジ 大志 +ダイシ 大士 +ダイシ 大師 +ダイシ 台司 +ダイシ 大四 +ダイジ 大慈 +タイシタ 泰下 +タイシダ 太子田 +ダイシダ 太子田 +タイシドウ 太子堂 +ダイシドウ 大師堂 +タイジマ 鯛島 +タイジマ 泰島 +ダイシマ 代島 +ダイシマ 代嶋 +ダイジマ 代島 +タイシャ 大社 +タイシャ 大赦 +ダイジャ 大蛇 +タイシャク 大釈 +タイシャク 大釋 +タイシャク 帝釈 +タイシャク 帝釋 +ダイシャク 大釈 +ダイシャク 大釋 +ダイシャク 大繹 +ダイジャモリ 大蛇森 +タイジュ 大寿 +タイシュウ 大刕 +ダイジュウ 第十 +ダイジュウ 代重 +タイジュドウ 太寿堂 +タイジュドウ 大寿堂 +タイショ 大所 +タイショウ 大正 +タイショウ 大将 +タイショウ 大小 +タイジョウ 諦乗 +ダイショウ 大聖 +ダイショウ 大性 +ダイショウ 大祥 +ダイショウ 大姓 +ダイジョウ 大城 +ダイジョウ 大上 +ダイジョウ 大條 +ダイジョウ 大条 +ダイジョウ 大篠 +ダイジョウ 大丈 +ダイジョウゴ 大上戸 +ダイジョウゴン 大成権 +タイショウジ 大正路 +タイショウジ 大正寺 +ダイショウジ 大聖寺 +ダイショウジ 大誠寺 +ダイショウジ 大笑事 +ダイジョウジ 大乗寺 +ダイショウジヤ 大聖寺谷 +タイショウズル 大正水流 +タイショウヅル 大正水流 +ダイショウハラ 大小原 +ダイジョウメン 大上免 +ダイシン 大新 +ダイシン 第新 +ダイジン 大神 +タイズミ 田泉 +ダイズモト 大豆本 +タイセ 鯛瀬 +タイセ 大世 +ダイセ 大勢 +ダイセン 大仙 +ダイゼン 大善 +ダイゼン 大膳 +ダイゼンノスケ 大膳亮 +ダイソウ 大相 +ダイゾウ 台蔵(台藏・臺蔵・臺藏) +ダイゾウ 代蔵 +タイタ 田板 +タイダ 泰田 +タイダ 対田 +タイダ 多飯田 +タイダ 紿田 +タイダ 多井田 +タイダ 退田 +タイダ 鯛田 +タイダ 對田 +ダイタ 大田 +ダイタ 代田 +ダイダ 大田 +ダイダ 代田 +ダイダ 台田 +ダイダ 臺田 +ダイダイ 大代 +ダイダイ 代々 +ダイダイ 橙 +ダイダイキ 橙木 +ダイタクドウ 大澤堂 +タイタニ 太谷 +タイタニ 鯛谷 +ダイタニ 大谷 +ダイタニ 代谷 +ダイタニ 台谷(臺谷) +タイチ 泰地 +タイチ 太地 +タイチ 田井地 +タイチ 対知 +タイチ 田一 +タイチ 田市 +タイチ 對知 +タイチ 泰池 +タイヂ 泰地 +ダイチ 大知 +ダイチギ 大地木 +ダイチョウ 大長 +ダイチョウ 大丁 +タイヅ 鯛津 +ダイツウ 大通 +タイツリ 鯛釣 +タイデ 田出 +タイデラ 太寺 +タイテン 鯛天 +ダイテン 大天 +ダイデン 大伝 +ダイデン 大傳 +タイド 田井戸 +ダイト 大戸 +ダイト 大都 +ダイド 大戸 +タイトウ 帯刀 +タイトウ 田井東 +タイトウ 太藤 +タイトウ 対東 +タイトウ 対藤 +タイトウ 泰藤 +タイトウ 帶刀 +タイトウ 對藤 +タイドウ 泰道 +ダイトウ 大東 +ダイトウ 大藤 +ダイトウ 大当 +ダイトウ 大頭 +ダイトウ 大塔 +ダイトウ 大登 +ダイトウ 大當 +ダイトウ 大刀 +ダイトウ 大唐 +ダイトウ 大籐 +ダイトウ 台当 +ダイドウ 大道 +ダイドウ 大藤 +ダイドウ 大洞 +ダイドウ 大堂 +ダイドウ 大同 +ダイドウ 大童 +ダイドウ 大銅 +ダイドウ 太洞 +ダイドウ 台堂(薹堂) +ダイドウ 大動 +ダイドウグチ 大道口 +ダイドウジ 大道寺 +ダイドウジ 大導寺 +タイトウダ 帯刀田 +ダイトク 大徳 +ダイトクヤ 大徳屋 +ダイドコロ 台所 +タイトリ 鯛取 +ダイナ 大奈 +タイナカ 田井中 +タイナカ 平中 +タイナカ 泰中 +タイナカ 対中 +タイナカ 太中 +タイナカ 胎中 +タイナカ 多井中 +タイナカ 鯛中 +タイナカ 躰中 +タイナカ 太仲 +タイナカ 對中 +タイナカ 堆中 +タイナカ 𣳾中 +タイナガ 躰長 +ダイナカ 大中 +ダイナカ 提中 +ダイナカ 台中 +ダイナカ 台仲 +ダイナカ 提仲 +ダイナカ 䑓中 +タイナワ 鯛縄 +タイナワ 鯛繩 +ダイナン 大南 +ダイニ 大仁 +ダイニ 大二 +ダイニチ 大日 +ダイニュウ 代入 +ダイニン 大仁 +ダイネンジ 大念寺 +タイノ 田井野 +タイノ 田井能 +ダイノ 台野 +ダイノ 代野 +ダイノ 臺野 +タイノウ 田井野 +タイノウ 田井能 +ダイノウ 台納 +ダイノウエ 台上 +タイノショウ 田結庄 +タイノショウ 田結荘 +タイノソン 台之尊(臺之尊) +ダイノソン 台之尊(臺之尊) +ダイノブ 台信 +ダイノブ 臺信 +ダイバ 大畠 +ダイバ 台場 +ダイバ 代場 +ダイバ 臺場 +タイハク 太白 +タイハク 大白 +ダイハタ 大畑 +ダイハタ 代畑 +ダイバタ 大畑 +ダイバタケ 大畠 +タイハラ 鯛原 +ダイハラ 台原(臺原) +ダイバン 大盤 +ダイヒサ 大久 +ダイヒサ 大悲山 +タイフ 大府 +タイフ 大符 +ダイフ 題府 +ダイフ 大封 +ダイブ 大部 +ダイフウ 大封 +ダイフク 大福 +ダイブゾノ 大部薗 +ダイブツ 題仏 +ダイブツ 題佛 +ダイベ 台部 +タイヘイ 太平 +タイヘイ 泰平 +タイホ 太甫 +ダイホ 大保 +ダイボ 大保 +タイホウ 大鵬 +ダイホウ 大宝 +ダイボウ 大坊 +ダイボウ 大棒 +ダイボウ 大傍 +タイホウイン 大宝院 +ダイホジ 大保寺 +タイマ 当麻 +タイマ 大間 +タイマ 當間 +タイマ 当摩 +タイマ 當麻 +タイマ 対間 +タイマ 當摩 +タイマ 泰間 +タイマ 對間 +タイマ 太間 +タイマ 太麻 +タイマ 泰磨 +タイマ 太磨 +タイマ 𣳾磨 +タイマ 𣳾麿 +ダイマ 大間 +ダイマ 大満 +タイマツ 明松 +タイマツ 泰松 +ダイマツ 大松 +ダイマル 大丸 +ダイマル 台丸 +ダイマル 大圓 +ダイマルヤ 台丸谷 +ダイマルヤ 大丸谷 +ダイマルヤ 臺丸谷 +ダイマン 大万 +ダイマン 大萬 +ダイミ 代見 +ダイミョウ 大明 +ダイミョウ 代名 +ダイミョウジ 大明地 +タイムラ 田井村 +ダイメ 大目 +ダイモ 大茂 +ダイモウ 大毛 +タイモト 泰本 +ダイモト 大本 +ダイモト 代本 +ダイモト 台本 +ダイモト 代元 +ダイモト 臺本 +ダイモン 大門 +ダイモン 大文 +ダイモン 大紋 +ダイモン 代門 +ダイモンジ 大文字 +ダイモンジヤ 大文字屋 +タイヤ 鯛谷 +タイヤ 待夜 +タイヤ 鯛家 +ダイヤ 大谷 +ダイヤ 大矢 +ダイヤ 大家 +ダイヤ 代谷 +ダイヤ 台谷(臺谷) +ダイヤ 台屋 +ダイヤクジ 大役寺 +ダイヤス 大安 +タイヤマ 泰山 +ダイヤマ 代山 +ダイヨ 台代(臺代) +タイヨウ 大陽 +タイヨウ 太洋 +タイヨウ 大洋 +ダイヨウ 大用 +ダイヨウ 大陽 +タイヨウジ 大陽寺 +タイヨウジ 太陽寺 +タイヨウジ 太養寺 +タイヨウロウ 太陽楼 +タイヨシ 平葭 +ダイヨシ 大由 +タイラ 平 +タイラ 平良 +タイラ 田平 +タイラ 大良 +タイラ 多比良 +タイラ 平等 +タイラ 太平 +タイラ 太良 +タイラ 泰良 +タイラ 多伊良 +タイラ 多以良 +タイラ 泰羅 +タイラ 台良 +タイラ 呈 +タイラ 大蘿 +タイラ 平伊良 +タイラ 汰伊羅 +タイラ 坦 +ダイラ 大良 +ダイラ 太良 +ダイラ 台良 +ダイラ 臺良 +タイラカ 坦ケ +タイラギ 平木 +タイラク 大楽 +タイラク 平久 +タイラク 太楽 +タイラク 泰楽 +タイラク 平楽(平樂) +タイラク 大樂 +タイラク 袋楽 +タイラク 泰樂 +ダイラク 大楽 +ダイラク 大樂 +ダイラクイン 大楽院 +ダイラクイン 大樂院 +タイラコ 平子 +タイラダテ 平館 +タイラダテ 平舘 +タイラフネ 平船(平舩) +タイラブネ 平船(平舩) +タイラブネ 平舟 +タイラモト 平本 +ダイリ 大利 +ダイリキ 大力 +ダイリキヤ 大力屋 +ダイリュウ 大龍 +タイリョウ 大漁 +ダイリョウ 大領 +ダイリン 大輪 +ダイレン 大連 +タイロ 太路 +タイロク 大録 +ダイロク 大録 +ダイロク 大六 +ダイロクノ 大六野 +タウ 多宇 +タウエ 田上 +タウエ 田植 +タウタ 田歌 +タウチ 田内 +タウチ 多内 +タウチ 田打 +タウチカワ 田内川 +タウチガワ 田内川 +タウミ 田海 +タウメ 田梅 +タウラ 田浦 +タウラ 太浦 +タウラ 田裏 +タエ 田江 +タエ 多恵 +タエ 多江 +タエシマ 妙島 +タエシマ 妙嶋 +タエス 太恵須 +タエダ 田枝 +タエナカ 妙中 +タエノ 多衛野 +タエマ 当摩 +タエマ 妙摩 +タエマ 多恵馬 +タエミ 玅見 +タエラ 妙楽 +タエン 田縁 +タエン 田椽 +タエン 田 +タオ 田尾 +タオ 峠 +タオ 垰 +タオ 太尾 +タオ 多尾 +タオイ 田老 +タオイ 峠井 +タオイ 垰井 +タオウ 田王 +タオウ 田翁 +タオオカ 峠岡 +タオオカ 垰岡 +タオカ 田岡 +タオカ 峠岡 +タオカ 多岡 +タオカ 垰岡 +タオカ 田丘 +タオキ 田沖 +タオキ 峠木 +タオク 田奥 +タオグチ 垰口 +タオグチ 峠口 +タオゴシ 峠越 +タオゴシ 垰越 +タオサカ 垰坂 +タオザキ 垰崎 +タオザキ 峠崎 +タオサマル 田長丸 +タオシタ 垰下 +タオシタ 峠下 +タオシタ 太尾下 +タオシタ 田尾下 +タオジリ 垰尻 +タオダ 垰田 +タオダ 峠田 +タオダ 太尾田 +タオダ 多尾田 +タオダ 田尾田 +タオダ 田尾多 +タオタニ 峠谷 +タオツチ 峠土 +タオナカ 峠中 +タオネ 垰根 +タオノ 垰野 +タオノ 峠野 +タオノウチ 峠之内 +タオノシタ 垰野下 +タオハタ 垰畑 +タオハラ 峠原 +タオハラ 垰原 +タオヒロ 峠広 +タオヒロ 垰広 +タオマエ 峠前 +タオムラ 垰村 +タオムラ 峠村 +タオモ 田面 +タオモテ 田面 +タオモテ 田表 +タオモト 垰本(垰夲) +タオモト 峠本 +タオモト 峠元 +タオモト 田尾本 +タオモト 垰始 +タオモリ 垰森 +タオヤ 峠谷 +タオヤ 垰谷 +タオヤマ 垰山 +タオヤマ 峠山 +タオリ 田下 +タオリ 田居 +タカ 多賀 +タカ 高 +タカ 多鹿 +タカ 隆 +タカ 鷹 +タカ 多加 +タカ 尭 +タカ 堯 +タカ 多嘉 +タカ 田嘉 +タカ 多可 +タガ 多賀 +タガ 田賀 +タガ 多家 +タガ 多河 +タガ 田香 +タガ 𥶡 +タガ 夛賀 +ダガ 駄賀 +タカアイ 鷹合 +タカアイ 高合 +タカアキ 高明 +タカアキ 高顕(高顯) +タカアサ 高朝 +タカアシ 高足 +タカアシ 高葭 +タカアシ 高葮 +タカアゼ 高畦 +タカアゼ 高畔 +タカアゼ 高畴(高疇) +タカアタ 高阿田 +タカアダ 高阿田 +タカアマ 高天 +タカアラ 高荒 +タカアリ 高有 +タカイ 高井 +タカイ 高居 +タカイ 鷹居 +タカイ 高位 +タカイ 鷹井 +タカイ 孝井 +タカイ 田加井 +タカイ 高伊 +タカイ 高衣 +タカイ 高飯 +タガイ 田貝 +タガイ 多賀井 +タガイ 互 +タガイ 互井 +タガイ 田外 +タガイ 田海 +タガイ 多貝 +タガイ 田飼 +タガイ 田加井 +タガイ 田賀井 +タカイエ 高家 +タカイエ 鷹家 +タカイケ 高池 +タカイザワ 高井沢 +タカイシ 高石 +タカイシ 鷹石 +タカイズミ 高泉 +タカイソ 高磯 +タカイソ 高礒 +タカイダ 高井田 +タカイチ 高市 +タカイチ 高一 +タカイデ 高出 +タガイト 田垣内 +タガイト 多賀糸 +タガイト 田賀糸 +タカイネ 高稲 +タガイノ 互野 +タカイラ 高井良 +タカイラ 高以良 +タカイラ 高以来(高以耒・高以來) +タカイワ 高岩 +タカウ 高卯 +タカウ 高宇 +タカウ 高夘 +タカウエ 高上 +タカウエ 高植 +タカウオ 高魚 +タカウジ 高氏 +タカウジ 鷹氏 +タカウス 高薄 +タカウチ 高内 +タカウチ 鷹内 +タカウチ 高宇知 +タカウマ 高馬 +タカウマ 鷹馬 +タカウラ 高浦 +タカウラ 鷹浦 +タカエ 高江 +タカエ 高永 +タカエ 高栄 +タカエ 鷹江 +タカエ 高榮 +タカエ 鷹衛 +タカエ 鷹枝 +タガエ 田替 +ダカエ 抱江 +タカエイ 高栄 +タカエガラ 高江柄 +タカエコウ 高永甲 +タカエス 高江洲 +タカエス 高江州 +タカエス 高江洌 +タカエダ 高枝 +タカエダ 鷹枝 +タガエトウ 田替藤 +タカエノキ 高榎 +タカオ 高尾 +タカオ 高雄 +タカオ 鷹尾 +タカオ 竹生 +タカオ 田香 +タカオ 高生 +タカオ 嵩尾 +タカオ 鷹雄 +タカオ 高男 +タガオ 田顔 +タカオカ 高岡 +タカオカ 高丘 +タカオカ 孝岡 +タカオカ 鷹岡 +タカオカ 高岳 +タカオカ 高生加 +タカオカ 嵩岡 +タカオカ 萬岳 +タカオキ 高沖 +タカオキ 高置 +タカオク 高奥 +タカオシ 鷹押 +タカオチ 高落 +タカオチ 高尾知 +タカオノ 高尾野 +タカオノ 高小野 +タカオブシ 鷹尾伏 +タカオヤ 高尾屋 +タカオヤ 高尾谷 +タカオヤマ 高尾山 +タカオリ 高折 +タカガ 高賀 +タカカイ 高階 +タカカイ 高開 +タカガイ 高階 +タカガイ 高貝 +タカガイ 鷹谷 +タカガイ 高買 +タカガイ 高開 +タカガイト 高垣内 +タカガウチ 高ケ内 +タカガキ 高垣 +タカガキ 高柿 +タカガキ 高蠣 +タカガキ 嵩垣 +タカカゲ 鷹影 +タカガケ 高懸 +タカガケ 高掛 +タカカサ 高笠 +タカガサ 高笠 +タカカジ 高梶 +タカカゼ 高風 +タカカタ 高方 +タカカツ 高勝 +タカカド 高角 +タカカド 高門 +タカガネ 高金 +タカガハラ 高河原 +タカガミ 高上 +タカガミ 高神 +タカガメ 高亀 +タカカモ 高鴨 +タカカモ 高賀茂 +タカカモ 高加茂 +タカカワ 高川 +タカガワ 高川 +タカガワ 高河 +タカガワ 高閑者 +タカガワ 鷹川 +タカガワハラ 高川原 +タカガワラ 高瓦 +タカキ 高木 +タカキ 高城 +タカキ 鷹木 +タカキ 都木 +タカキ 尚 +タカキ 高樹 +タカキ 高貴 +タカキ 多加喜 +タカキ 高記 +タカキ 邵城 +タカギ 高木 +タカギ 高城 +タカギ 鷹木 +タカギ 都木 +タカギ 高儀 +タカギ 高来 +タカギ 高榎 +タカギ 堂城 +タカギ 高樹 +タカギ 高貴 +タカギ 喬木 +タカギ 鷹来 +タカギ 聳城 +タカギ 高義 +タカギ 高來 +タカギ 鷹樹 +タカギ 田加木 +タカギ 邵城 +タカギ 鷹喜 +タガキ 田垣 +タガキ 太垣 +タカギシ 高岸 +タカキタ 高北 +タカキダ 高木田 +タカギタ 高北 +タカギダ 高木田 +タカキバ 高木場 +タカギハラ 高木原 +タカギモト 高木元 +タカキュウ 高久 +タカギリ 高桐 +タカキワ 高際 +タカキワ 高木和 +タカギワ 高際 +タカギワ 高木和 +タカク 高久 +タカク 田角 +タカク 高工 +タカク 田覚 +タカク 喬久 +タカグ 高具 +タガク 田覚 +タカグイ 高杭 +タカクサ 高草 +タカクサ 高艸 +タカクサキ 高草木 +タカクサギ 高草木 +タカクシ 高串 +タカクス 高楠 +タカクタ 高久田 +タカクダ 高久田 +タカグチ 高口 +タカクニ 高国 +タカクニ 高國 +タカクノ 高久野 +タカクボ 高窪 +タカクボ 高久保 +タガクボ 田ケ久保 +タカクマ 高熊 +タカグマ 高熊 +タカクモ 高雲 +タカグモ 崇雲 +タカクラ 高倉 +タカクラ 高蔵 +タカクラ 大下倉 +タカクラ 高藏 +タカクラ 鷹倉 +タカクラ 高庫 +タカクラ 嵩倉 +タカクリ 高栗 +タカクリ 高操 +タカグリ 高栗 +タカクロ 高黒 +タカグロ 高黒 +タカクワ 高桑 +タカクワ 高鍬 +タカケ 高家 +タカケイ 高慶 +タカコ 高子 +タカコ 鷹子 +タカゴ 高子 +タカゴ 高後 +タカコウ 鷹幸 +タカコウ 高孝 +タカコウ 鷹好 +タカゴウ 鷹合 +タカゴウ 高郷 +タカゴエ 高越 +タカコシ 高越 +タカゴシ 高越 +タカゴロモ 高衣 +タカサ 高佐 +タカサ 高左 +タカサイ 高斎 +タカサイ 高斉 +タカサイ 高齋 +タカザイク 高細工 +タカサオ 高棹 +タカサオ 高竿 +タカサカ 高坂 +タカサカ 高阪 +タカサカ 鷹阪 +タカサキ 高崎 +タカサキ 高嵜 +タカサキ 鷹崎 +タカサキ 高先 +タカサキ 高咲 +タカサキ 高碕 +タカザキ 高崎 +タカザキ 高嵜 +タカザキ 鷹崎 +タカサク 高作 +タカサクラ 高桜 +タカサクラ 高砂倉 +タカサクラ 高櫻 +タカザクラ 高桜 +タカザクラ 高櫻 +タカサコ 高迫 +タカサコ 高﨏 +タカサゴ 高砂 +タカサゴ 高砂子 +タカサゴ 高硲 +タカサゴヤ 高砂谷 +タカサト 高里 +タカザト 高里 +タカザト 嵩里 +タカザネ 高実 +タカザネ 高實 +タカサハラ 高笠原 +タカサヤ 高佐屋 +タカザル 高猿 +タカサワ 高沢 +タカサワ 高澤 +タカサワ 鷹沢 +タカサワ 鷹澤 +タカザワ 高沢 +タカザワ 高澤 +タカザワ 鷹沢 +タカザワ 鷹澤 +タカサワラ 高笠原 +タカサン 高三 +タカシ 高 +タカシ 高司 +タカシ 高師 +タカシ 高子 +タカシ 高士 +タカシ 嵩 +タカシ 高志 +タカシ 尚 +タカシ 隆 +タカシ 尭 +タカシ 堯 +タカシ 孝 +タカシ 崟 +タカシ 孝志 +タカシ 尚師 +タカシ 隆司 +タカシ 隆志 +タカジ 高地 +タカジ 高司 +タカジ 高次 +タカジ 高志 +タカジ 高治 +タカシ 昂師 +タカシオ 高塩 +タカシオ 高汐 +タカシオ 高潮 +タカシカ 高鹿 +タカシキ 高敷 +タカシゲ 高重 +タカシゲ 高茂 +タカシゲ 高繁 +タカシゲ 鷹繁 +タカシタ 高下 +タカシタ 鷹下 +タカジッコ 高実子 +タカジツコ 高実子 +タカジツコ 高實子 +タカシデ 高幣 +タカシナ 高階 +タカシナ 高品 +タカシナ 高科 +タカシノ 高篠 +タカシバ 高柴 +タカシバ 高芝 +タカシブ 高志武 +タカシホ 高志保 +タカシマ 高島 +タカシマ 高嶋 +タカシマ 鷹島 +タカシマ 高嶌 +タカシマ 鷹嶋 +タカシマ 崇島 +タカシマ 隆島 +タカシマ 崇嶋 +タカシマ 嵩島 +タカシマ 孝島 +タカシマ 高隝 +タカジマ 高嶋 +タカシマダ 高島田(高嶋田) +タカシミズ 高清水 +タカシメ 高〆 +タカショ 高所 +タカショウ 高正 +タカショウ 高庄 +タカショウ 高昌 +タカショウ 高祥 +タカジョウ 高城 +タカジョウ 高上 +タカジョウ 鷹匠 +タカシラ 田頭 +タガシラ 田頭 +タカシリ 高尻 +タカジリ 高尻 +タカシロ 高城 +タカシロ 高代 +タカシロ 鷹城 +タカス 高須 +タカス 鷹巣 +タカス 高祖 +タカス 高巣 +タカス 高子 +タカス 高栖 +タカス 高洲 +タカス 鷹栖 +タカス 高主 +タカス 高寿 +タカス 高州 +タカス 多賀須 +タカス 高壽 +タカズ 高都 +タカズ 鷹頭 +タカズ 田数 +タカスエ 高末 +タカスカ 高須賀 +タカスカ 高須加 +タカスガ 高須賀 +タカスガ 高菅 +タカスギ 高杉 +タカスギ 隆杉 +タカスギ 高椙 +タカスゴ 高数後 +タカススキ 高薄 +タカスダ 高䒳 +タカスナ 高砂 +タカズナ 高砂 +タカスミ 高住 +タカスミ 高済 +タカスミ 高角 +タカスミ 高墨 +タカスミ 高濟 +タカズミ 高住 +タカズミ 高済 +タカズミ 高澄 +タカセ 高瀬 +タカセ 高世 +タカセ 高清 +タカセ 高勢 +タカセ 高畝 +タカセキ 高堰 +タカセキ 高関 +タカセコ 高迫 +タカセヤ 高瀬屋 +タカセヤ 高瀬谷 +タカソ 高祖 +タカソ 高僧 +タカソ 高曽 +タカソウ 高宗 +タカソウ 高相 +タカソウ 高僧 +タカソウ 鷹左右 +タカソウ 高左右 +タカソウ 高惣 +タカソエ 高添 +タカゾエ 高添 +タカソデ 高袖 +タカソネ 高曽根 +タカソネ 高曾根 +タカソノ 高園 +タカゾノ 高園 +タカソノベ 高園部 +タカタ 高田 +タカタ 田方 +タカタ 鷹田 +タカタ 高多 +タカタ 田片 +タカタ 多方(夛方) +タカタ 鷹多 +タカタ 高他 +タカダ 高田 +タカダ 尊田 +タカダ 鷹田 +タカダ 高多 +タカダ 孝田 +タガタ 田形 +タガタ 田方 +タガタ 田片 +タガタ 田潟 +タガタ 多賀田 +タガタ 多形 +タカダイシ 高田石 +タカダイラ 高平 +タカタキ 高滝(高瀧) +タカダギ 高田木 +タカタケ 高武 +タカタケ 高竹 +タカタチ 高舘 +タカダチ 高舘 +タカダチ 高達 +タカタテ 高館 +タカタテ 高舘 +タカダテ 高館 +タカダテ 高舘 +タカダテ 高達 +タカタニ 高谷 +タカタニ 鷹谷 +タカタニ 隆谷 +タカタニ 崇谷 +タガタニ 多賀谷 +タカタハラ 高田原 +タカタマ 高玉 +タカタマ 高珠 +タカダマ 高玉 +タカタヤ 高田谷 +タカダヤ 高田谷 +タカダヤ 高田屋 +タカタル 高樽 +タカダン 高段 +タカチ 高地 +タカチ 高知 +タカチ 高智 +タカチオ 高知尾 +タカチオ 高智尾 +タカチカ 高近 +タカチノ 高地野 +タカチホ 高千穂 +タカチホ 高智穂 +タカチホ 高知穂 +タカチュウ 高忠 +タカチヨ 高千代 +タカチョウ 高蝶 +タカツ 高津 +タカツ 高都 +タカツ 鷹津 +タカツイ 高津井 +タカツオ 高津尾 +タカツカ 高塚 +タカツカ 高司 +タカツカ 高務 +タカツカ 高墳 +タカツカ 鷹塚 +タカヅカ 高塚 +タカツカサ 高司 +タカツカサ 高務 +タカツカサ 鷹司 +タカツキ 高月 +タカツキ 高槻 +タカツキ 高附 +タカツキ 高築 +タカツキ 高杯 +タカツキ 高付 +タカツギ 高次 +タカツグ 高次 +タカツグ 高継 +タカツジ 高辻 +タカツジ 高都持 +タカツジ 隆辻 +タカツチ 高土 +タカツチ 高槌 +タカツツ 高筒 +タカツツミ 高堤 +タカツト 高津戸 +タカツド 高津戸 +タカツナ 高綱 +タカツネ 高常 +タカツノ 高角 +タカツバキ 高椿 +タカツハラ 高津原 +タカツボ 高坪 +タカツマ 高妻 +タカツメ 高詰 +タカヅメ 高詰 +タカツユ 高露 +タカツラ 高面 +タカツル 高鶴 +タカテ 高手 +タカデ 高出 +タカテヤマ 高手山 +タカテラ 高寺 +タカデラ 高寺 +タカデラ 嵩寺 +タカテル 鷹照 +タカト 高戸 +タカト 高都 +タカト 高登 +タカド 高戸 +タカド 高土 +タガト 多賀戸 +タカトイ 高樋 +タカドイ 高樋 +タカドイ 高土居 +タカドイ 高土井 +タカトウ 高藤 +タカトウ 高頭 +タカトウ 高遠 +タカトウ 高東 +タカトウ 高筒 +タカトウ 高任 +タカトウ 高当 +タカトウ 鷹藤 +タカドウ 高道 +タカドウ 高堂 +タガドウ 多賀堂 +タカドウヤ 高堂谷 +タカトオ 高遠 +タカトキ 高時 +タカトギ 高研 +タカトギ 高硎 +タカトク 高徳 +タカトク 尚徳 +タカトコ 高牀 +タカトジ 高都持 +タカトチ 高土地 +タカトノ 高殿 +タカドノ 高殿 +タカトミ 高富 +タカトミ 高冨 +タカトミ 高臣 +タカトヤ 高塒 +タカトヤ 高戸谷 +タカトリ 高取 +タカトリ 鷹取 +タカトリ 高鳥 +タカトリ 高諏 +タカトリ 高酉 +タカトリ 鷹鳥 +タカトリゲ 高鳥毛 +タカトリヤ 鷹鳥屋 +タカナ 高名 +タカナ 高那 +タカナ 高奈 +タガナ 多賀名 +タカナエ 高苗 +タカナカ 高中 +タカナカ 高仲 +タカナカ 鷹中 +タカナガ 高永 +タカナガ 高長 +タカナガネ 高長根 +タカナシ 高梨 +タカナシ 高無 +タカナシ 高梨子 +タカナシ 小鳥遊 +タカナシ 高奈師 +タカナベ 高鍋 +タカナベ 高辺 +タカナベ 高邉 +タカナミ 高波 +タカナミ 高浪 +タカナミ 高並 +タカナリ 高成 +タカナリタ 高成田 +タカナワ 高輪 +タカナワ 高縄 +タカナワ 高索 +タカナワ 高畷 +タカナワ 高繩 +タカニ 高荷 +タカニ 高仁 +タカニ 高丹 +タカニシ 高西 +タカニシ 鷹西 +タカニワ 高庭 +タカヌキ 高貫 +タカヌシ 高主 +タカヌマ 高沼 +タカネ 高根 +タカネ 高子 +タガネ 田金 +タガネ 多賀根 +タガネ 田兼 +タカネオ 高根尾 +タカネザワ 高根沢 +タカネザワ 高根澤 +タカノ 高野 +タカノ 鷹野 +タカノ 高埜 +タカノ 高納 +タカノ 高濃 +タカノ 鷹埜 +タカノ 隆野 +タカノ 高ノ +タカノ 嵩野 +タカノ 多賀能 +タカノ 高能 +タカノ 鷹𡌛 +タガノ 多賀野 +タガノ 田賀農 +タガノ 多賀能 +タガノ 夛賀野 +タカノウ 高納 +タカノウ 高能 +タカノウチ 高野内 +タカノウラ 高野浦 +タカノオ 高野尾 +タカノキ 鷹ノ木 +タカノクチ 高之口 +タカノクラ 高野倉 +タカノサワ 高野沢 +タカノサワ 高野澤 +タカノザワ 高野沢 +タカノザワ 高野澤 +タカノシ 高野子 +タカノシ 高熨示 +タカノシ 高熨斗 +タカノス 鷹栖 +タカノス 鷹野主 +タカノセ 高野瀬 +タカノセ 高之瀬 +タカノセ 高ノ瀬 +タカノナ 高野名 +タカノハ 鷹羽 +タカノハシ 鷹觜 +タカノハシ 鷹箸 +タカノハシ 高野橋 +タカノハシ 鷹嘴 +タカノハシ 鷹橋 +タカノハシ 鷹𥖧 +タカノハタ 高野畑 +タカノハラ 鷹野原 +タカノハラ 高ノ原 +タカノブ 高信 +タカノブ 高延 +タカノブ 高申 +タカノベ 高延 +タカノベ 高野辺 +タカノマ 竹迴間 +タカノミヤ 高野宮 +タカノヤ 高野谷 +タカノヤマ 高野山 +タカノヤマ 高ノ山 +タカノリ 高徳 +タカノリ 高乗 +タカノリ 高乘 +タカハ 高羽 +タカハ 鷹羽 +タカバ 高波 +タカバ 高羽 +タカバ 高場(高塲) +タカバ 竹迫 +タカバ 鷹羽 +タカバ 鷹場 +タカバ 高葉 +タカバ 竹廻間 +タカハエ 高八重 +タカハエ 高生 +タカハギ 高萩 +タカハシ 高橋 +タカハシ 高階 +タカハシ 鷹觜 +タカハシ 鷹箸 +タカハシ 孝橋 +タカハシ 鷹嘴 +タカハシ 鷹橋 +タカハシ 高槁 +タカハシ 高端 +タカハシ 鷹啄 +タカハシ 喬橋 +タカハシ 鷹羽司 +タカハシ 高梁 +タカハシ 嵩橋 +タカハシ 鷹梁 +タカバシ 高橋 +タガハシ 多賀橋 +タカハセ 高長谷 +タカハタ 高畑 +タカハタ 高畠 +タカハタ 高旗 +タカハタ 高籏(高簱) +タカハタ 高幡 +タカハタ 高機 +タカハタ 高憧 +タカバタ 高畑 +タカバタ 高畠 +タカハタケ 高畑 +タカハタケ 高畠 +タカハタゲ 高畑下 +タカバタケ 高畑 +タカバタケ 高畠 +タカハチ 高蜂 +タカハチ 高八 +タカハチ 高鉢 +タカバチ 高蜂 +タカハッケ 高八卦 +タカハナ 高花 +タカハナ 高鼻 +タカハネ 高羽 +タカバネ 高羽 +タカハマ 高浜 +タカハマ 高濱 +タカハマ 鷹浜 +タカハマ 鷹濱 +タカハヤ 高早 +タカバヤシ 高林 +タカバヤシ 鷹林 +タカバヤシ 天林 +タカハラ 高原 +タカハラ 嵩原 +タガハラ 田ケ原 +タガハラ 田川原 +タガハラ 多賀原 +タカハリ 高張 +タカハリ 鷹梁 +タカハル 高治 +タカハル 高春 +タカヒ 高樋 +タカヒ 高日 +タカヒ 高比 +タカヒ 高陽 +タカヒコ 高彦 +タカヒサ 高久 +タカヒサ 孝久 +タカヒサ 隆久 +タカヒザ 高比座 +タカビシ 高菱 +タカヒデ 高秀 +タカヒナ 高雛 +タカヒラ 高平 +タカヒラ 高比良 +タカヒラ 高比来(高比耒) +タカヒラ 高比羅 +タカヒロ 高広 +タカヒロ 高廣 +タカヒロ 鷹広 +タカヒロ 高宏 +タカヒロ 高弘 +タカフ 高風 +タカブ 高部 +タカブ 高夫 +タカブキ 高吹 +タカフク 高福 +タカフシ 高伏 +タカフジ 高藤 +タカフジ 高富士 +タカフジ 高冨士 +タカフジ 高籐 +タカフジ 鷹藤 +タカフジ 隆藤 +タカフタ 高蓋 +タカブタ 高蓋 +タカフチ 高渕 +タカフチ 高淵 +タカブチ 高渕 +タカブチ 高淵 +タカブチ 高渊 +タカヘ 高弊 +タカベ 高部 +タカベ 高辺 +タカベ 高倍 +タカベ 多賀部 +タカベ 鷹部 +タカベ 高塀 +タカベ 高邊 +タカベ 高邉 +タカヘイ 高幣(高幤) +タカヘイ 鷹塀 +タカヘイ 高塀 +タカベヤ 鷹部屋 +タカホ 高保 +タカホ 高穂 +タカホ 高甫 +タカボウ 高房 +タカボウ 高坊 +タカボウ 高防 +タカホコ 鷹架 +タカホコ 高鉾 +タカホシ 高星 +タカボシ 高星 +タカホソ 高細 +タカボソ 高細 +タカホタ 高法田 +タカホリ 高堀 +タカボリ 高堀 +タカマ 高間 +タカマ 高天 +タカマ 高真(高眞) +タカマ 高磨 +タカマ 高麻 +タカマエ 高前 +タカマエダ 高前田 +タカマガリ 高曲 +タカマキ 高巻 +タカマキ 高牧 +タカマギ 高間木 +タカマサ 高正 +タカマサ 高政 +タカマサ 貴正 +タカマサ 賞雅 +タカマス 高増 +タカマス 高升 +タカマス 高舛 +タカマス 高桝 +タカマタ 鷹股 +タカマタ 高又 +タカマダテ 高間館 +タカマダテ 高間舘 +タカマチ 高町 +タカマツ 高松 +タカマツ 鷹松 +タカマツ 高枩 +タカマツヤ 高松屋 +タカマル 高丸 +タカマン 高満 +タカミ 田上 +タカミ 高見 +タカミ 鷹見 +タカミ 高味 +タカミ 高美 +タカミ 高三 +タカミ 高実 +タカミ 鷹美 +タカミ 高海 +タカミ 高實 +タガミ 田上 +タガミ 田頭 +タガミ 田神 +タガミ 太上 +タガミ 多上 +タカミコ 高実子 +タカミコ 高實子 +タカミサワ 高見沢 +タカミサワ 高見澤 +タカミザワ 高見沢 +タカミザワ 高見澤 +タカミザワ 高味沢(高味澤) +タカミズ 高水 +タカミズマ 高三潴 +タカミセ 高見世 +タカミセ 高見勢 +タカミゾ 高溝 +タカミダテ 高見館 +タカミダテ 高見舘 +タカミチ 高道 +タカミチ 天屯 +タカミツ 高光 +タカミツ 高満 +タカミツ 高密 +タカミドウ 高御堂 +タカミドウ 高見堂 +タカミドリ 高縁 +タカミドリ 高緑 +タカミナミ 高南 +タカミネ 高嶺 +タカミネ 高峰 +タカミネ 高峯 +タカミネ 高実子 +タカミネ 鷹峰 +タカミネ 高領 +タカミネ 嵩嶺 +タカミノ 高三野 +タカミヤ 高宮 +タカミヤ 崇宮 +タカミヤ 嵩宮 +タカミヤ 鷹宮 +タカミヤギ 高宮城 +タカミヤシロ 高宮城 +タカム 高務 +タカムカイ 高向 +タカムキ 高向 +タカムク 高椋 +タカムク 高向 +タカムシ 高虫 +タカムネ 高宗 +タカムネ 高旨 +タカムネ 高棟 +タカムラ 高村 +タカムラ 篁 +タカムラ 高落 +タカムラ 高邑 +タカムラ 鷹村 +タカムラ 孝村 +タカムラ 田加村 +タカムラ 箼 +タカムレ 高群 +タカムレ 高牟礼 +タカムレ 高牟禮 +タカムロ 高室 +タカメ 高目 +タカモ 高茂 +タカモ 高藻 +タカモ 高最 +タカモク 高杢 +タカモチ 高持 +タカモト 高本 +タカモト 高元 +タカモト 鷹本 +タカモト 嵩本 +タカモト 貴元 +タカモト 高基 +タカモト 崇本 +タカモト 鷹元 +タカモト 奉日本 +タカモト 誉本 +タガモト 多賀本 +タカモリ 高森 +タカモリ 高盛 +タカモリ 高守 +タカモリ 鷹森 +タカモリ 孝森 +タカモレ 高毛礼(高毛禮) +タカモロ 高師 +タカヤ 高谷 +タカヤ 高屋 +タカヤ 高家 +タカヤ 高矢 +タカヤ 鷹屋 +タカヤ 鷹谷 +タカヤ 多加谷 +タカヤ 高八 +タカヤ 高宅 +タカヤ 多可谷 +タガヤ 田谷 +タガヤ 多賀谷 +タガヤ 多谷 +タガヤ 多ケ谷 +タガヤ 田ケ谷 +タガヤ 多加谷 +タガヤ 田賀谷 +タガヤ 達谷窟 +タガヤ 多賀屋 +タガヤ 夛ケ谷 +タガヤ 夛賀谷 +タカヤエ 高八重 +タカヤギ 高柳 +タガヤシ 耕 +タカヤシキ 高屋敷 +タカヤシキ 高屋鋪 +タカヤシキ 高屋舗 +タカヤシキ 鷹屋敷 +タガヤシロ 多賀社 +タカヤス 高安 +タカヤス 高保 +タガヤス 耕 +タカヤスミ 鷹休 +タカヤナギ 高柳 +タカヤナギ 鷹柳 +タカヤナギ 高楊 +タカヤブ 高藪 +タカヤブ 高薮 +タカヤブ 高籔 +タカヤベ 高矢部 +タカヤマ 高山 +タカヤマ 多嘉山 +タカヤマ 嵩山 +タカヤマ 孝山 +タカヤマ 鷹山 +タカヤマ 卓山 +タカヤマ 陟山 +タカヤマ 嶸山 +タカヤマショウ 高山正 +タカヤマノ 高山野 +タカヤマベ 高山邊(高山辺) +タカヨシ 高良 +タカヨシ 高吉 +タカヨシ 高好 +タカヨシヤ 高吉屋 +タカヨセ 高寄 +タカヨリ 高寄 +タカラ 高良 +タカラ 宝 +タカラ 多嘉良 +タカラ 高羅 +タカラ 財 +タカラ 用 +タカラ 寳 +タカラ 多賀良 +タカラ 寶 +タガラ 田柄 +タカライ 宝井 +タカライ 高来 +タカライ 宝居(寳居) +タカライ 寶井 +タカライ 寶居 +タカライ 寳井 +タカライシ 宝石 +タカライシ 寳石 +タカラエ 宝栄(宝榮・寶榮) +タカラエ 宝江 +タカラオカ 宝岡 +タカラオカ 寶岡 +タカラガキ 宝垣 +タカラガワ 宝川(寳川) +タカラガワ 財川 +タカラガワ 寶川 +タカラキ 宝樹 +タカラギ 宝来 +タカラギ 宝木(寳木) +タカラギ 宝生(寶生・寳生) +タカラギ 宝城 +タカラギ 宝樹 +タカラギ 宝起 +タカラギ 宝喜(寳喜) +タカラギ 寶木 +タカラギ 寳生 +タカラコ 宝子(寶子) +タカラサキ 宝崎(寶崎) +タカラサワ 宝沢(宝澤) +タカラサワ 寳澤 +タカラザワ 宝沢(宝澤) +タカラザワ 寶澤 +タカラザワ 寳澤 +タカラシマ 宝島 +タカラジマ 宝島(寶島) +タカラジマ 宝嶋 +タカラジマ 寳島 +タガラス 田烏 +タカラダ 宝田 +タカラダ 財田 +タカラダ 寶田 +タカラダ 寳田 +タカラダ 宝多(寶多) +タカラダ 寳多 +タカラダ 戝田 +タカラバ 宝場 +タカラバシ 宝橋 +タカラバヤシ 宝林 +タカラフジ 宝藤 +タカラフジ 寶藤 +タカラベ 財部 +タカラベ 宝部(寳部) +タカラベ 宝辺(寳邉) +タカラベ 戝部 +タカラベ 財辺(財邉) +タカラムラ 宝村(寳村・寶村) +タカラモト 宝本 +タカラモリ 宝森(寳森・寶森) +タカラヤ 宝谷 +タカラヤ 寶谷 +タカラヤシキ 宝屋敷(寶屋敷・寳屋敷) +タカラヤマ 宝山(寶山) +タカラヤマ 寳山 +タカリ 高利 +タカリ 田苅 +タガリ 田雁 +タガリ 田鴈 +タカリキ 高力 +タカリコ 田苅子 +タガリコ 田苅子 +タガリコ 田刈子 +タカリュウ 高龍 +タカリョウ 高領 +タカワ 田川 +タカワ 高輪 +タカワ 高和 +タガワ 田川 +タガワ 多川 +タガワ 田河 +タガワ 太川 +タガワ 多河 +タガワ 多皮 +タガワ 田側 +タガワ 夛川 +タガワウチ 田河内 +タカワキ 高脇 +タカワキ 鷹阪 +タカワシ 高鷲 +タカワタリ 高渡 +タガワチ 田河内 +タカワラ 鷹藁 +タガワラ 田川原 +タガワラ 田河原 +タガン 田雁 +タカンド 高筒 +タカンドウ 高堂 +タカンドウ 高筒 +タキ 滝 +タキ 高城 +タキ 立木 +タキ 瀧 +タキ 多喜(夛喜) +タキ 多木 +タキ 田木 +タキ 多気 +タキ 太城 +タキ 多岐 +タキ 多氣 +タキ 多紀 +タキ 太木 +タキ 田喜 +タキ 多幾 +タキ 多記 +タキ 太喜 +タキ 太記 +タキ 田記 +タギ 多木 +タギ 田木 +タギ 田儀 +タギ 多岐 +タギ 多儀 +タギ 多幾 +ダキ 駄木 +タキアキ 滝明 +タキアキ 瀧明 +タキイ 滝井 +タキイ 瀧井 +タキイ 滝居 +タキイ 多喜井 +タキイ 瀧居 +タキイエ 滝家 +タキイケ 滝池(瀧池) +タキイサミ 滝勇 +タキイシ 滝石 +タキイシ 瀧石 +ダキイシ 抱石 +タキイズミ 瀧泉 +タキイチ 滝市 +タキイワ 滝岩(瀧岩) +ダキイワ 抱岩 +タキウ 武生 +タキウエ 滝上 +タキウエ 瀧上 +タキウチ 滝内 +タキウチ 瀧内 +タキウチ 滝打 +タキウチ 瀧打 +タキウラ 滝浦 +タキウラ 瀧浦 +タキエ 滝江 +タキエ 瀧江 +ダキエ 抱江 +タキオ 滝尾 +タキオ 瀧尾 +タキオカ 滝岡 +タキオカ 瀧岡 +タキオク 滝奥(瀧奥) +タキオト 滝音 +タキオト 瀧音 +タキガ 滝賀 +タキガ 瀧賀 +タキガイト 滝垣内 +タキガウラ 滝ケ浦 +タキカギ 滝鍵(瀧鍵) +タキガサキ 滝ケ崎(滝ケ嵜) +タキガサキ 瀧ケ崎 +タキガシラ 滝頭 +タキガシラ 瀧頭 +タキガタ 滝方 +タキガタ 瀧方 +タキガハナ 瀧ケ花 +タキガハナ 滝ケ花 +タキガハナ 龍ケ花 +タキガヒラ 滝ケ平 +タキガヒラ 瀧ケ平 +タキカミ 滝上 +タキカミ 瀧上 +タキガミ 滝上 +タキガミ 瀧上 +タキガヤマ 滝ケ山(瀧ケ山) +タキガヤマ 瀧个山 +タキカワ 滝川 +タキカワ 瀧川 +タキカワ 多喜川 +タキガワ 滝川 +タキガワ 瀧川 +タキガワ 多喜川 +タキガワ 多岐川 +タキガワ 瀑布川 +タキガワ 滝河 +タキギ 薪 +タキギ 滝木 +タキギキ 瀧聞 +タキギク 滝聞 +タキギク 瀧聞 +タキギシ 滝岸 +タキギシ 瀧岸 +タキキタ 滝北 +タキキタ 瀧北 +タキギタ 瀧北 +タキギヤ 薪谷 +タキギリ 滝桐 +タキギリ 瀧桐 +タギク 多菊 +タキグチ 滝口 +タキグチ 瀧口 +タキグチ 炬口 +タキグチ 涔口 +タキグチ 太岐口 +タキクボ 滝窪(瀧窪) +タキクマ 滝熊 +タキクマ 瀧熊 +タキクラ 滝倉 +タキクラ 瀧倉 +タキゴ 滝後 +タキコウ 滝幸 +タキコシ 滝越 +タキコシ 瀧腰 +タキゴシ 滝腰 +タキゴシ 瀧腰 +タキサカ 滝坂 +タキサカ 滝阪 +タキサカ 瀧坂 +タキサカ 瀧阪 +タキサキ 滝崎 +タキサキ 瀧崎 +タキザキ 滝崎 +タキザキ 瀧崎 +タキザキ 瀧嵜 +タキサコ 滝迫 +タキサコ 瀧迫 +タキサダ 滝貞 +タキサワ 滝沢 +タキサワ 滝澤 +タキサワ 瀧澤 +タキサワ 瀧沢 +タキザワ 滝沢 +タキザワ 滝澤 +タキザワ 瀧澤 +タキザワ 瀧沢 +タキザワ 涔沢 +タキザワ 涔澤 +タギシ 田岸 +タギシ 𦩂(𦩘) +タキシゲ 滝重 +タキシタ 滝下 +タキシタ 瀧下 +タキシタ 竜下 +タキシマ 滝島 +タキシマ 滝嶋 +タキシマ 瀧島 +タキシマ 瀧嶋(瀧嶌) +タキシマ 滝嶌 +タキジマ 滝島 +タキジマ 滝嶋 +タキジマ 瀧島 +タキジマ 瀧嶋(瀧嶌) +タキジョウ 滝上 +タキジョウ 瀧上 +タキジリ 滝尻 +タキジリ 瀧尻 +タキシロ 滝代(瀧代) +タキシロ 滝城 +タキシン 滝新 +タキスエ 滝末 +タキスエ 瀧末 +タキスミ 瀧住 +タキスミ 滝清 +タキズミ 滝住 +タキズミ 瀧住 +タキセ 滝瀬 +タキセ 瀧瀬 +タキセン 滝仙 +タキソウ 多喜荘 +タキタ 滝田 +タキタ 田北 +タキタ 瀧田 +タキタ 多喜田 +タキタ 夛喜田 +タキダ 滝田 +タキダ 瀧田 +タキダ 多喜田 +タギタ 田北 +タギタ 多喜田 +タキダイ 多喜代 +タキダイラ 滝平 +タキダイラ 瀧平 +タキタニ 滝谷 +タキタニ 瀧谷 +タキダニ 滝谷 +タキダニ 瀧谷 +タキチ 田喜知 +タキチ 滝地(瀧地) +タキツ 滝津 +タキツ 滝都 +タキツ 瀧津 +タキツ 瀧都 +タキツカ 滝塚 +タキツカ 瀧塚 +タキヅカ 滝塚 +タキヅカ 瀧塚 +タキツネ 滝常(瀧常) +タキツボ 滝坪 +タキツボ 瀧坪 +タキツメ 滝爪 +タキヅメ 滝爪 +タキデラ 滝寺(瀧寺) +タキテル 滝照 +タキト 滝戸 +タキト 瀧戸 +タキド 滝戸 +タキド 瀧戸 +タキトウ 滝藤 +タキトウ 瀧藤 +タキトウ 滝籐 +タキドウウチ 滝童内 +タキトウゲ 瀧峠 +タキナイ 滝内 +タキナイ 瀧内 +タキナカ 滝中 +タキナカ 瀧中 +タキナガ 滝永 +タキナガ 瀧永 +タキナミ 滝波 +タキナミ 滝浪 +タキナミ 瀧浪 +タキナミ 瀧波 +タキニシ 滝西 +タキニシ 瀧西 +タキニシ 隴西 +タキヌマ 滝沼 +タキネ 滝根 +タキネ 瀧根 +タキノ 滝野 +タキノ 瀧野 +タキノ 滝埜 +タキノ 多喜乃 +タキノ 滝能 +タキノ 多喜野 +タキノ 瀧埜 +タキノ 瀧能 +タキノイリ 滝之入(瀧之入) +タキノウエ 瀧上 +タキノウエ 滝ノ上 +タキノウエ 瀧之上 +タキノウエ 滝之上 +タキノウエ 瀧ノ上 +タキノウチ 滝ノ内(瀧ノ内) +タキノウチ 滝之内 +タキノウチ 瀧之内 +タキノガミ 瀧ノ上 +タキノガワ 滝野川 +タキノクチ 滝野口 +タキノグチ 滝野口 +タキノサワ 滝野沢 +タキノサワ 滝野澤 +タキノサワ 瀧野沢 +タキノサワ 瀧野澤 +タキノザワ 滝野沢 +タキノザワ 滝野澤 +タキノセ 滝野瀬 +タキノセ 瀧野瀬 +タキノベ 滝辺 +タキノミ 滝呑 +タキノミ 瀧呑 +タキノワキ 滝之脇 +タキノワキ 瀧之脇 +タキバ 滝場 +タキバ 滝葉(瀧葉) +タキバ 瀧場 +タキハシ 滝橋 +タキハタ 滝端 +タキハタ 滝畑 +タキハタ 滝畠(瀧畠) +タキハタ 瀧端 +タキハタ 瀧畑 +タキバタ 滝端 +タキバタ 瀧端 +タキバタ 多喜端 +タキハナ 滝花 +タキハナ 滝鼻 +タキハナ 瀧花 +タキハナ 滝華 +タキハナ 瀧華 +タキハナ 瀧鼻 +タキバナ 滝花 +タキバナ 瀧花 +タキハマ 滝浜(瀧濱) +タキバヤシ 滝林 +タキバヤシ 瀧林 +タキハラ 滝原 +タキハラ 瀧原 +タキバラ 滝原 +タキヒ 滝日 +タキヒ 瀧日 +タキヒサ 滝久(瀧久) +タキヒラ 滝平 +タキヒラ 棏平 +タキヒラ 瀧平 +タキヒロ 滝広(滝廣) +タキヒロ 瀧廣 +タキフカ 滝深 +タキフカ 瀧深 +タキフジ 滝藤 +タキフジ 瀧藤 +タキブチ 滝渕 +タキブチ 瀧渕 +タキブチ 滝淵 +タキフネ 滝船 +タキベ 滝辺 +タキマ 滝間 +タキマエ 滝前 +タキマエ 瀧前 +タキマガリ 滝曲 +タキマサ 滝政 +タキマサ 瀧政 +タキマタ 滝又(瀧又) +タキマチ 滝町 +タキミ 滝見 +タキミ 田公 +タキミ 瀧見 +タギミ 田公 +タキミズ 滝水 +タキミズ 瀧水 +タキミヤ 滝宮 +タキミヤ 瀧宮 +タキムネ 滝宗 +タキムラ 滝村 +タキムラ 瀧村 +タキモト 滝本 +タキモト 瀧本 +タキモト 滝元 +タキモト 瀧元 +タキモト 太木本 +タキモト 多喜本 +タキモト 滝源 +タキモト 瀧源 +ダキモト 嶽本 +タキモリ 滝森 +タキモリ 瀧森 +タキヤ 滝谷 +タキヤ 瀧谷 +タキヤ 滝屋 +タキヤ 瀧屋 +タキヤス 滝安 +タキヤス 瀧安 +タキヤチ 滝谷内 +タキヤナギ 滝柳 +タキヤナギ 瀧柳 +タキヤブ 滝薮(瀧籔) +タキヤマ 滝山 +タキヤマ 瀧山 +タキヤマ 多幾山 +ダキヤマ 抱山 +タキヤマダ 滝山田(瀧山田) +タキュウ 田久 +タキュウ 武生 +タキュウ 武弓 +タキユウ 滝遊 +タキユキ 滝雪 +タキョウ 田京 +タキョウ 田境 +タキョウ 竹境 +タギョウ 田行 +タキヨシ 滝吉 +タキヨシ 瀧吉 +タキリ 田伐 +タギリ 田切 +タギリ 田伐 +タギリ 田桐 +タギリ 多桐 +タギワ 田際 +タキワキ 滝脇 +タキワキ 瀧脇 +タキワタリ 滝渡 +タキワタリ 瀧渡 +タク 多久(夛久) +タク 宅 +タク 卓 +タク 度 +タクイ 宅井 +タクイ 工位 +タグイ 田杭 +タクイシ 宅石 +タクエ 大工廻 +タクエ 大工迴 +タクエ 宅江 +タクカワ 宅川 +タクガワ 宅川 +タクキ 鐸木 +タクキ 田久喜 +タクサ 田草 +タクサガワ 田草川(田艸川) +タグサガワ 田草川(田艸川) +タクザキ 宅崎 +ダクザク 大工廻 +タクサリ 田鎖 +タクサリ 多久佐里 +タグサリ 田鎖 +タクシ 沢岻 +タクシ 澤岻 +タクシ 沢紙 +タクシ 沢志(澤志) +タクシ 澤紙 +タクシ 択岻 +タクシゲ 宅重 +タクシマ 多久島 +タクシマ 宅島 +タクシマ 宅嶋 +タクシマ 度島 +タクシマ 多久嶋 +タクシマ 宅嶌 +タクシマ 度嶋 +タクシマ 夛久島 +タクジマ 宅島 +ダクジャク 大工廻 +タクセ 宅瀬 +タクセ 田久世 +タクタ 宅田 +タクタ 多久田 +タクタ 卓田 +タクタ 詫田 +タクダ 宅田 +タクダ 多久田 +タクダ 匠田 +タクチ 田口 +タクチ 卓地 +タグチ 田口 +タグチ 多口 +タグチ 太口 +ダグチ 駄口 +タグチタニ 田口谷 +タグチダニ 田口谷 +タクナガ 宅永 +タクナガ 度長 +タクナミ 宅波 +タクニ 田国(田國) +タクノ 宅野 +タクノ 多久野 +タクノ 度野 +タクハラ 宅原 +タクヒ 田久日 +タクビ 田首 +タクヒロ 工広 +タクヒロ 工廣 +タクベ 宅部 +タクボ 田窪 +タクボ 田久保 +タクボウ 宅坊 +タクマ 田熊 +タクマ 宅間 +タクマ 詫間 +タクマ 詫摩 +タクマ 琢磨 +タクマ 田隈 +タクマ 宅万 +タクマ 詫磨 +タクマ 多久間 +タクマ 多熊 +タクマ 託間 +タクマ 託摩 +タクマ 卓間 +タクマ 琢間 +タクマ 詫麻 +タクマ 匠間 +タクマ 宅摩 +タクマ 宅磨 +タクマ 宅萬 +タクマ 託麻 +タクマ 詫广 +タクマ 卓馬 +タグマ 田熊 +タグマ 田隈 +タグマ 多熊 +タクマイ 沢米 +タクマイ 澤米 +タクマス 宅増 +タクマン 宅万 +タクマン 宅萬 +タクミ 内匠 +タクミ 宅見 +タクミ 工 +タクミ 沢見 +タクミ 能 +タクミ 匠 +タクミ 宅美 +タクミ 侘美 +タクミ 田組 +タクミ 多久美 +タクミ 巧 +タクミ 田久見 +タクミ 託見 +タクミ 田汲 +タクミ 工匠 +タクミ 多久見 +タクミ 宅味 +タクミ 太組 +タクミ 田久美 +タクミ 佗美 +タグミ 田組 +タクミウチ 匠内 +タクミガイト 工垣内 +タクミズ 宅水 +タクミダ 工田 +タクミヤ 内匠屋 +タクミヤ 宅宮 +タクミョウ 宅明 +タクミョウ 琢明 +タクムネ 工宗 +タクモト 宅本 +タクモリ 宅森 +タクラ 田倉 +タクラ 田蔵 +タクラ 多倉 +タクラ 太倉 +タクラ 田藏 +タケ 武 +タケ 田家 +タケ 嶽 +タケ 竹 +タケ 岳 +タケ 嵩 +タケ 多計 +タケ 田毛 +タゲ 田家 +タゲ 田外 +タゲ 多気 +タゲ 多氣 +ダケ 嶽 +ダケ 岳 +ダケ 嵩 +ダケ 獄 +タケアキ 武明 +タケアラ 竹荒 +タケアラ 武荒 +タケアラ 猛新 +タケイ 武井 +タケイ 竹井 +タケイ 武居 +タケイ 竹居 +タケイ 手計 +タケイ 竹位 +タケイ 丈井 +タケイ 武位 +タケイ 岳井 +タケイ 多計為 +タケイ 竹囲 +タゲイ 多芸 +タゲイ 多藝 +タケイケ 竹池 +タケイシ 武石 +タケイシ 竹石 +タケイシ 建石 +タケイシ 嶽石 +タケイシ 岳石 +ダケイシ 嶽石 +ダケイシ 獄石 +タケイズミ 竹泉 +タケイタ 竹板 +タケイダ 竹居田 +タケイチ 武市 +タケイチ 竹市 +タケイチ 竹一 +タケイチ 武一 +タケイマ 竹今 +タケイリ 竹入 +タケイリ 武入 +タケイリ 竹射 +タケイワ 竹岩 +タケイワ 武岩 +タケウ 竹生 +タケウ 武生 +タケウ 武宇 +タケウエ 竹上 +タケウエ 武上 +タケウエ 竹植 +タケウジ 竹氏 +タケウジ 武氏 +タケウジ 竹宇治 +タケウダ 竹生田 +タケウチ 竹内 +タケウチ 武内 +タケウチ 建内 +タケウチ 嶽内 +タケウチ 内 +タケウチ 岳内 +タケウネ 竹采 +タケウネ 竹釆 +タケウマ 竹馬 +タケウマ 武馬 +タケウミ 武海 +タケウラ 竹浦 +タケウラ 武浦 +タケエ 武江 +タケエ 竹江 +タケエ 武衛(武衞) +タケエ 竹衛 +タケエダ 竹枝 +タケエダ 武枝 +タケオ 竹尾 +タケオ 竹生 +タケオ 武尾 +タケオ 武生 +タケオ 武雄 +タケオ 岳尾 +タケオ 猛尾 +タケオ 嵩尾 +タケオ 武黄 +タケオ 嶽尾 +タケオイ 竹生 +タケオカ 竹岡 +タケオカ 武岡 +タケオカ 竹丘 +タケオカ 竹岳 +タケオカ 武岳 +タケオカ 嶽岡 +タケオキ 竹沖 +タケオク 竹奥 +タケオダ 竹生田 +タケオハラ 嶽小原 +タケオバラ 岳小原 +タケオリ 竹折 +タケガ 竹賀 +タケガイ 竹貝 +タケガキ 竹垣 +タケガキウチ 竹垣内 +タケカク 竹角 +タケカサ 武笠 +タケガサ 武笠 +タケカタ 武方 +タケカタ 嶽肩 +タケカタ 武像 +タケガタ 武方 +タケガタ 竹形 +タケガタ 嶽肩 +タケガタ 岳肩 +タケガタ 獄肩 +タケカド 竹門 +タケカド 武門 +タケガナル 竹箇平 +タケガハナ 竹ケ鼻 +タケガハナ 竹ケ端 +タケガハラ 竹ケ原 +タケカブ 竹株 +タケガマ 嶽釜 +タケガマ 岳釜 +タケガマ 獄釜 +タケカミ 竹上 +タケガミ 竹上 +タケガミ 武上 +タケガミ 竹神 +タケガミ 武神 +タケカメヤ 竹亀谷 +タケカリ 武苅 +タケカワ 竹川 +タケカワ 武川 +タケカワ 竹河 +タケカワ 武河 +タケカワ 嶽川 +タケガワ 竹川 +タケガワ 武川 +タケガワ 岳川 +タケガワ 嶽川 +タケキ 竹木 +タケキ 武気(武氣) +タケキ 武木 +タケキ 嶽木 +タケキ 竹来 +タケギ 竹木 +タケキシ 竹岸 +タケギシ 竹岸 +タケキタ 武木田 +タケキタ 竹北 +タケキタ 竹木田 +タケキタ 武喜田 +タケキタ 嶽北 +タケキダ 武木田 +タケキダ 竹木田 +タケキバ 嶽木場 +タケキヨ 竹清 +タケキヨ 武清 +タケクサ 武種 +タケクチ 竹口 +タケグチ 竹口 +タケグチ 武口 +タケグチ 炬口 +タケグチ 岳口 +タケクニ 竹国 +タケクニ 竹國 +タケグニ 竹国 +タケグニ 竹國 +タケクボ 竹久保 +タケクマ 武隈 +タケクマ 竹熊 +タケクマ 竹隈 +タケクマ 武熊 +タケクマ 武隅 +タケグマ 竹熊 +タケクラ 竹倉 +タケクラ 竹蔵 +タケクラ 武倉 +タケクラ 竹藏 +タケクロ 武黒 +タケグロ 武黒 +タケコ 竹子 +タケコウ 竹厚 +タケゴウ 竹郷 +タケゴウチ 竹河内 +タケコシ 竹腰 +タケコシ 竹越 +タケコシ 武越 +タケゴシ 竹腰 +タケゴシ 竹越 +タケゴシ 武腰 +タケコマ 竹駒 +タケサ 武佐 +タケサ 竹佐 +タケザイ 竹財 +タケサカ 竹坂 +タケサカ 武坂 +タケサカ 嶽坂 +タケサカ 岳坂 +タケサカ 竹阪 +タケサキ 竹崎 +タケサキ 武崎 +タケサキ 嶽崎 +タケサキ 竹嵜 +タケザキ 竹崎 +タケザキ 武崎 +タケザキ 嶽崎 +タケザキ 岳崎 +タケザキ 竹嵜 +タケザキ 竹埼 +タケサコ 竹迫 +タケザコ 竹迫 +タケサシ 竹差 +タケサダ 武貞 +タケサダ 竹定 +タケサダ 竹貞 +タケサト 竹里 +タケザト 竹里 +タケザト 嵩里 +タケザト 武里 +タケサワ 竹沢 +タケサワ 竹澤 +タケサワ 武沢 +タケサワ 武澤 +タケザワ 竹沢 +タケザワ 竹澤 +タケザワ 武沢 +タケザワ 武澤 +タケザワ 田家沢(田家澤) +タケザワ 岳沢(岳澤) +タケザワ 嶽沢 +タケザワ 嶽澤 +タケシ 武 +タケシ 武士 +タケシ 武子 +タケシ 武枝 +タケシ 武志 +タケシ 竹志 +タケシ 武司 +タケシ 竹子 +タケシ 筒石 +タケジ 竹治 +タケジ 竹次 +タケジ 竹路 +タケシカ 武鹿 +タケシゲ 竹重 +タケシゲ 武重 +タケシゲ 竹繁 +タケシゲ 武繁 +タケシゲ 武茂 +タケシゲ 竹茂 +タケシタ 竹下 +タケシタ 武下 +タケシタ 岳下 +タケシタ 嵩下 +タケシタ 嶽下 +タケシタ 竹志田 +タケシダ 竹志田 +ダケシタ 岳下 +ダケシタ 嵩下 +ダケシタ 嶽下 +タケシナ 竹科 +タケシバ 竹柴 +タケシバ 竹芝 +タケシバ 武柴 +タケシハラ 武士原 +タケシマ 竹島 +タケシマ 竹嶋 +タケシマ 武島 +タケシマ 武嶋 +タケシマ 竹嶌 +タケシマ 嵩島 +タケジマ 竹島 +タケジマ 竹嶋 +タケジマ 武島 +タケジマ 武嶋 +タケジョウ 竹条 +タケジョウ 竹條 +タケショウジ 竹小路 +タケジリ 竹尻 +タケシロ 竹城 +タケシロ 竹代 +タケシロ 武城 +タケシン 竹心 +タケス 竹須 +タケズ 武図 +タケスエ 武居 +タケスエ 武末 +タケスエ 竹末 +タケスエ 竹居 +タケスエ 竹未 +タケスギ 竹杉 +タケスズメ 竹雀 +タケステ 武捨 +タケスミ 竹住 +タケズミ 武住 +タケズミ 竹角 +タケセ 竹瀬 +タケセ 武瀬 +タケセ 竹背 +タケセコ 竹迫 +タケソウ 竹宗 +タケゾエ 竹添 +タケゾエ 武副 +タケゾエ 武添 +タケソト 竹外 +タケソノ 竹園 +タケソノ 篁園 +タケゾノ 竹園 +タケゾノ 竹薗 +タケゾノ 武園 +タケタ 武田 +タケタ 竹田 +タケタ 竹多(竹夛) +タケタ 武多 +タケタ 嶽田 +タケダ 武田 +タケダ 竹田 +タケダ 竹多(竹夛) +タケダ 岳田 +タケダ 建田 +タケダ 丈田 +タケダ 武多 +タケダ 嵩田 +タケダ 建多 +タケダ 多気田(多氣田) +タケダイ 竹大 +タケタオ 竹垰 +タケタカ 竹高 +タケダガワ 武田川 +タケダキ 竹抱 +タケダタニ 竹田谷 +タケダチ 竹達 +タケダチ 竹立 +タケタツ 竹田津 +タケタツ 竹達 +タケタヅ 竹田津 +タケダツ 竹田津 +タケタニ 竹谷 +タケタニ 武谷 +タケタニ 竹渓 +タケタニ 竹溪 +タケタニ 岳谷 +タケダニ 竹谷 +タケタバ 竹把 +タケタバ 竹束 +タケタバ 武束 +タケダハラ 竹田原 +タケダヤ 竹田谷 +タケタワ 武多和 +タケチ 武市 +タケチ 武智 +タケチ 武知 +タケチ 竹治 +タケチ 竹地 +タケチ 武地 +タケチ 竹知 +タケチ 竹智 +タケチ 嵩地 +タケチ 威知 +タケツ 竹津 +タケツ 武津 +タケヅ 武図 +タケツカ 竹塚 +タケツカ 武塚 +タケツカ 岳塚 +タケツカ 竹束 +タケヅカ 竹塚 +タケヅカ 武塚 +タケヅカ 岳塚 +タケツギ 武次 +タケツギ 竹次 +タケツグ 武次 +タケツグ 竹次 +タケツジ 竹辻 +タケツジ 武辻 +タケツツミ 竹堤 +タケヅツミ 竹堤 +タケツナ 竹綱 +タケツネ 竹常 +タケツメ 竹爪 +タケヅメ 竹詰 +タケツル 竹鶴 +タケデ 嶽出 +ダケデ 嶽出 +タケト 竹戸 +タケドイ 竹土井 +タケトウ 武藤 +タケトウ 竹藤 +タケトウ 岳藤 +タケトウ 竹当 +タケトウ 竹當 +タケドウ 竹洞 +タケドウ 竹堂 +タケトクヤマ 竹徳山 +タケトシ 竹歳 +タケトシ 武利 +タケトミ 武富 +タケトミ 武冨 +タケトミ 竹富 +タケトミ 丈富 +タケトミ 竹冨 +タケトミ 武臣 +タケドミ 武富 +タケドミ 武冨 +タケトメ 竹留 +タケドメ 竹留 +タケトモ 武知 +タケトモ 竹友 +タケトモ 武友 +タケトモ 嶽友 +タケトラ 竹虎 +タケナ 竹名 +タケナ 武名 +タケナエ 竹苗 +タケナエ 武苗 +タケナオ 武直 +タケナカ 竹中 +タケナカ 武中 +タケナカ 武仲 +タケナカ 竹仲 +タケナカ 竹半 +タケナカ 岳中 +タケナガ 竹永 +タケナガ 武永 +タケナガ 長永 +タケナガ 武長 +タケナガ 竹長 +タケナガ 尺長 +タケナカジマ 竹中島 +タケナミ 竹浪 +タケナミ 竹並 +タケナミ 武南 +タケナミ 武波 +タケナミ 竹次 +タケナミ 竹波 +タケナミ 武並 +タケナミ 武浪 +タケナミ 竹竝 +タケナミ 武濤 +タケナリ 竹成 +タケナワ 竹縄 +タケナワ 武縄 +タケナワ 竹繩 +タケナワ 武繩 +タケニシ 竹西 +タケニシ 嵩西 +タケニシ 武西 +タケヌキ 竹貫 +タケヌキ 竹抜 +タケヌマ 武沼 +タケヌマ 竹沼 +タケネ 竹根 +タケネザワ 竹根沢 +タケネザワ 竹根澤 +タケノ 竹野 +タケノ 武野 +タケノ 岳野 +タケノ 嶽野 +タケノ 竹埜 +タケノ 笨 +タケノ 嵩野 +タケノ 猛野 +ダケノ 嶽野 +ダケノ 獄野 +ダケノ 嶽ノ +タケノイ 竹ノ井 +タケノイ 竹之井 +タケノイ 竹野井 +タケノイリ 竹野入 +タケノイリ 竹ノ入 +タケノウ 竹能 +タケノウエ 竹ノ上 +タケノウエ 竹之上 +タケノウエ 武ノ上 +タケノウエ 竹野上 +タケノウジ 武野氏 +タケノウチ 竹内 +タケノウチ 武内 +タケノウチ 竹之内 +タケノウチ 竹ノ内 +タケノウチ 竹野内 +タケノウチ 武ノ内 +タケノウチ 武野内 +タケノウチ 武之内 +タケノウチ 竹の内 +タケノカブ 竹ノ株 +タケノキシン 竹之木進 +タケノクチ 炬口 +タケノクマ 竹之熊 +タケノクマ 竹之隈 +タケノコ 竹ノ子 +タケノコ 竹の子 +タケノコシ 竹腰 +タケノコシ 竹之越 +タケノコダ 笋田 +タケノコダ 筝田 +タケノシタ 竹之下 +タケノシタ 竹ノ下 +タケノシタ 竹野下 +タケノタニ 竹ノ谷 +タケノナカ 竹ノ中 +タケノナカ 竹之中 +タケノノ 竹野々 +タケノハタ 竹ノ畑 +タケノハタ 竹之畑 +タケノハナ 竹ノ鼻 +タケノハラ 竹野原 +タケノブ 武信 +タケノブ 竹信 +タケノブ 竹延 +タケノブ 竹廷 +タケノブ 武延 +タケノベ 竹延 +タケノマエ 竹之前 +タケノマタ 竹股 +タケノモト 竹ノ本 +タケノモリ 武之森 +タケノヤ 武谷 +タケノヤ 竹ノ谷 +タケノヤ 竹野谷 +タケノヤ 武野谷 +タケノヤ 竹ノ家 +タケノヤ 竹の家 +タケノヤ 竹の谷 +タケノヤ 竹ノ矢 +タケノヤ 竹之矢 +タケノヤマ 竹之山 +タケノヤマ 竹ノ山 +タケノリ 武乗 +タケノリ 武則 +タケノリ 竹則 +タケノリ 竹乗 +タケノワキ 竹ノ脇 +タケハ 竹葉 +タケバ 武者 +タケバ 竹馬 +タケバ 竹葉 +タケバ 竹場 +タケバ 武半 +タケハザマ 竹廻間 +タケハシ 竹橋 +タケハシ 武橋 +タケハタ 竹端 +タケハタ 竹畑 +タケハタ 竹畠 +タケバタ 竹端 +タケバタ 竹畑 +タケハツ 武発 +タケハナ 竹花 +タケハナ 竹鼻 +タケハナ 竹端 +タケハナ 武塙 +タケハナ 武花 +タケハナ 竹華 +タケバナ 竹花 +タケハマ 竹浜 +タケハマ 竹濱 +タケハヤシ 竹林 +タケバヤシ 竹林 +タケバヤシ 武林 +タケハラ 竹原 +タケハラ 武原 +タケハラ 嵩原 +タケハラ 岳原 +タケハラザキ 竹原崎 +タケハラダ 竹原田 +タケハラヤ 竹原屋 +タケハル 竹治 +タケハル 竹春 +タケヒ 武樋 +タケヒ 竹樋 +タケヒ 竹日 +タケビ 竹備 +タケヒサ 武久 +タケヒサ 竹久 +タケビシ 武菱 +タケビシ 竹菱 +タケヒラ 竹平 +タケヒラ 武平 +タケヒラ 茸平 +タケヒロ 竹広 +タケヒロ 武広 +タケヒロ 竹弘 +タケヒロ 武廣 +タケヒロ 竹廣 +タケヒロ 武弘 +タケフ 竹生 +タケフ 武生 +タケブ 武分 +タケブ 竹武 +タケフサ 竹房 +タケフシ 竹節 +タケフジ 武藤 +タケフジ 竹藤 +タケフジ 岳藤 +タケブシ 竹節 +タケフタ 竹蓋(竹葢) +タケブタ 竹蓋(竹葢) +タケフチ 武淵 +タケブチ 竹渕 +タケブチ 竹淵 +タケブチ 武淵 +タケブチ 武渕 +タケフミ 武文 +タケベ 武部 +タケベ 建部 +タケベ 竹部 +タケベ 竹辺 +タケベ 武辺(武邊) +タケベ 岳辺 +タケベ 竹邊 +タケベ 竹邉 +タケベ 嶽部 +タケベ 岳邊 +タケベ 竹鄭 +タケベ 武邉 +タケホ 建穂 +タケボソ 竹細 +タケホラ 竹洞 +タケホリ 武堀 +タケマ 竹間 +タケマ 武馬 +タケマ 武間 +タケマ 岳間 +タケマエ 竹前 +タケマエ 武前 +タケマキ 竹巻 +タケマキ 竹蒔 +タケマサ 武政 +タケマサ 武正 +タケマサ 竹政 +タケマサ 竹雅 +タケマサ 竹正 +タケマス 竹増 +タケマス 竹升 +タケマス 竹益 +タケマス 竹舛 +タケマス 竹桝 +タケマタ 竹俣 +タケマタ 竹股 +タケマタ 竹又 +タケマタ 武俣 +タケマチ 竹町 +タケマツ 竹松 +タケマツ 武末 +タケマツ 武松 +タケマル 竹丸 +タケマル 武丸 +タケマワリ 竹廻 +タケミ 竹見 +タケミ 竹味 +タケミ 武見 +タケミ 竹身 +タケミ 健 +タケミ 竹視 +タケミ 武美 +タケミ 竹美 +タケミ 武味 +タケミカ 武甕 +タケミチ 武道 +タケミチ 竹道 +タケミチ 嶽道 +タケミチ 岳道 +タケミツ 竹光 +タケミツ 武光 +タケミツ 武満 +タケミツ 竹満 +タケミネ 竹峰 +タケミネ 岳峰 +タケミネ 竹峯 +タケミヤ 武宮 +タケミヤ 竹宮 +タケミョウ 竹明 +タケムネ 竹宗 +タケムラ 竹村 +タケムラ 武村 +タケムラ 竹邑 +タケムラ 嶽村 +タケムラ 武邑 +タケムラ 竹邨 +タケムラ 岳村 +タケムラ 武邨 +タケムレ 竹牟礼 +タケムレ 竹牟禮 +タケムレ 竹ム礼 +タケムロ 竹室 +タケモチ 武用 +タケモチ 武持 +タケモト 竹本 +タケモト 武本 +タケモト 竹元 +タケモト 武元 +タケモト 嶽本 +タケモト 岳本 +タケモト 嵩元 +タケモト 嵩本 +タケモト 岳元 +タケモト 嶽元 +タケモト 獄本 +タケモト 武基 +ダケモト 嶽本 +ダケモト 嵩本 +タケモリ 竹森 +タケモリ 武森 +タケモリ 竹盛 +タケモリ 武盛 +タケモリ 竹守 +タケモリ 武守 +タケモリ 嶽森 +タケモリ 獄盛 +タケモリ 嶽盛 +タケモリ 獄森 +タケモン 竹門 +タケヤ 竹谷 +タケヤ 武谷 +タケヤ 竹屋 +タケヤ 竹矢 +タケヤ 竹家 +タケヤ 武矢 +タケヤ 竹舎 +タケヤ 武屋 +タケヤ 武箭 +ダケヤ 嵩谷 +タケヤエ 竹屋江 +タケヤス 竹安 +タケヤス 武安 +タケヤス 竹保 +タケヤス 武保 +タケヤチ 竹谷内 +タケヤブ 竹薮 +タケヤブ 竹藪 +タケヤブ 竹籔 +タケヤマ 竹山 +タケヤマ 武山 +タケヤマ 嶽山 +タケヤマ 岳山 +タケヤマ 孟山 +ダケヤマ 嶽山 +ダケヤマ 嵩山 +タケヤリ 武鑓 +タケヤリ 武鎗 +タケヤリ 竹鎗 +タケヤリ 竹鑓 +タケヤリ 武槍 +タケユカ 武畽 +タケユキ 竹行 +タケユミ 武弓 +タケヨシ 武良 +タケヨシ 武吉 +タケヨシ 竹吉 +タケヨシ 竹好 +タケヨシ 竹由 +タケヨシ 武善 +タケラ 竹良 +タケワ 武輪 +タケワ 竹輪 +タケワ 竹和 +タケワカ 竹若 +タケワカ 武若 +タケワキ 竹脇 +タケワキ 武脇 +タケワキ 武分 +タケワケ 武分 +タケワリ 竹割 +タゲン 田元 +タゲン 田玄 +タコ 田子 +タコ 多胡 +タコ 多湖(夛湖) +タコ 太古 +タコ 太子 +タコ 多古 +タコ 蛸 +タゴ 田子 +タゴ 多胡 +タゴ 多湖(夛湖) +タゴ 田胡 +タゴ 田後 +タゴ 太子 +タゴ 田古 +タゴ 田悟 +タゴ 田児 +タゴ 田湖 +タゴ 多吾 +タゴ 夛胡 +タコイ 蛸井 +タコウ 田向 +タコウ 田高 +タコウ 竹生 +タコウ 田幸 +タコウ 田光 +タコウ 高向 +タコウ 田香 +タコウ 多功 +タコウ 田耕 +タコウ 多幸 +タゴウ 多胡 +タゴウ 多湖(夛湖) +タゴウ 田郷 +タゴウ 田合 +タゴウ 田江 +タゴウ 多郷 +タゴウオカ 田郷岡 +タゴウカ 田郷岡 +タコウダ 竹生田 +タコウダ 田高田 +タゴウチ 田子内 +タゴウチ 田河内 +タコウラ 田高良 +タゴエ 田肥 +タゴオ 多湖(夛湖) +タゴオカ 田郷岡 +タゴオリ 田郡 +タコガワ 蛸川 +タコガワ 田子川 +タコガワ 田古川 +タゴク 田極 +タゴシ 田越 +タゴシ 田腰 +タコシマ 蛸島 +タコシマ 田古島 +タコシマ 蛸嶋 +タコシマ 多胡島 +タコジマ 蛸島 +タコジマ 田古島 +タコジマ 蛸嶋 +タコジマ 多胡島 +タコジマ 田古嶋 +タゴシマ 田子島 +タゴシマヤ 田子島屋 +タコセ 蛸背 +タコセ 蛸瀬 +タコタ 田子多 +タコダ 多小田 +タコタニ 蛸谷 +タコタニ 多小谷 +タコツミ 蛸積 +タコヅミ 蛸積 +タゴト 田毎 +タコナイ 田子内 +タコネ 田子根 +タコノウチ 蛸之内 +タコベ 田古部 +タコボシ 蛸星 +タコマエ 太古前 +タゴメ 多米 +タゴメ 田米 +タゴメ 田込 +タゴモリ 田籠 +タゴモリ 田子森 +タゴモリ 田篭 +タゴモリ 田龍 +タコヤ 蛸谷 +タゴヤ 田子谷 +タゴヤ 田頃家 +タゴヤシ 田肥 +タゴヤマ 田子山 +タコラ 田古良 +タコリ 田古里 +タコリ 田古利 +タゴリ 田古里 +タサ 太佐 +タサ 太左 +タサイ 田西 +タサイ 太斎 +タサイ 田才 +タサイ 太細 +タサイ 太斉 +タサイ 田斉 +タサイ 太齋 +タサイ 太才 +タサイ 太齊 +タサイ 田済 +タサイ 田斎(田齋) +タサイ 田齊 +タザイ 田財 +ダサイ 太宰 +ダサイ 太斎 +ダサイ 太細 +ダサイ 太斉 +ダサイ 太齋 +ダサイ 太才 +ダサイ 太歳 +ダサイ 太齊 +ダサイ 駄斉 +ダザイ 太宰 +ダザイ 太斎 +ダザイ 太細 +ダザイ 太斉 +ダザイ 太齋 +ダザイ 太歳 +ダザイ 大宰 +タサカ 田坂 +タサカ 田阪 +タサカ 多坂 +タザカ 田坂 +タザカ 田阪 +タサキ 田崎 +タサキ 太崎 +タサキ 田先 +タサキ 田嵜 +タサキ 多崎(多嵜) +タサキ 太嵜 +タザキ 田崎 +タザキ 太崎 +タザキ 田先 +タザキ 田嵜 +タザキ 田埼 +タサク 田作 +タザコ 田迫 +タサト 田里 +タサト 多里 +タザト 田里 +タザマ 田間 +タサワ 田澤 +タザワ 田沢 +タザワ 田澤 +タザワ 多沢(夛澤) +タザワ 多澤 +ダサワ 駄沢(駄澤) +ダザワ 駄沢(駄澤) +タシ 田志 +タシ 田士 +タシ 田仕 +タジ 田路 +タジ 田地 +タジ 太治 +タジ 田治(田冶) +タジ 多地 +タジ 田次 +タジ 多次 +タジ 多司 +タジ 丹比 +タジイ 但井 +タジイ 田地井 +タシオ 田塩 +タジオ 但尾(伹尾) +タジオカ 但岡 +タシカ 多鹿 +タシカ 田鹿 +タシガ 多志賀 +タジカ 田近 +タジカ 多鹿 +タジカ 田鹿 +タジカラ 田力 +タシカワ 田志川 +タジカワ 田地川 +タジカワ 多治川 +タジカワ 夛治川 +タジキ 田食 +タジク 田軸 +タシグチ 田志口 +タシゲタ 田重田 +タシタ 田下 +タジタ 但田 +タジツ 田実 +タジツ 田實 +タジナ 田品 +タジナカ 但中 +タシノ 田篠 +タジノ 但野 +タジノ 田地野 +タジノ 太治野 +タシバ 田芝 +タジハタ 田地畑 +タジヒ 多治比 +タジヒ 丹治比 +タジヒ 田治比 +タシブ 田染 +タシブ 田渋 +タシブ 田澁 +タシマ 田島 +タシマ 田嶋 +タシマ 田嶌 +タシマ 多嶋 +タシマ 多志満 +タジマ 田島 +タジマ 田嶋 +タジマ 但馬 +タジマ 多島 +タジマ 田嶌 +タジマ 太島 +タジマ 田隝 +タジマ 多嶋 +タジマ 太嶋 +タジマ 丹嶋 +タジマ 多司馬 +タジマ 但島 +タジマ 田陦 +タジマ 伹馬 +タジマ 田隯 +タジマ 夛島 +タジマ 夛嶋 +タジマ 田嶼 +タシマダ 多嶋田 +タシマダ 多島田 +タジマル 但丸 +タジミ 丹治 +タジミ 多治見 +タジミ 但見 +タジミ 田治見 +タジミ 多治美 +タジミ 田二見 +タジミ 多次見 +タジミ 伹見 +タジミ 夛治見 +タジムラ 但村 +タジメ 田治米 +タシモ 田下 +タジモト 但本(伹本) +タシャナカ 田舎中 +タジュ 多寿 +タジュウタ 田重田 +タジユキ 田地行 +タシュマツ 田主松 +タショ 田所 +タショウ 田生 +タショウ 多昌 +タショウジ 田正司 +タショウジ 田小路 +タジヨシ 但吉(伹吉) +タジリ 田尻(田㞍) +タジリカ 田尻下 +タジリヤ 田尻谷 +タシロ 田代 +タシロ 田城 +タシロ 多城 +タシロ 太城 +タシロ 多代 +タシロ 田白 +タシロ 太代 +タシン 田新 +タジンダ 多神田 +タス 多須 +タスエ 田末 +タスキ 田耕 +タスキ 田鋤 +タスギ 田杉 +タスク 佐 +タズケ 田附 +タズケ 田付 +ダスゼ 出樋 +タズネキ 尋木 +タズネギ 尋木 +タズノキ 尋木 +タズハラ 田津原 +タズハラ 田鶴原 +タズマ 田妻 +タスミ 田角 +タスミ 田隅 +タスミ 多炭 +タスミ 手角 +タスミ 田須美 +タズミ 田角 +タズミ 田積 +タズミ 田住 +タズミ 田隅 +タズミ 但住(伹住) +タズミ 田墨 +タセ 高瀬 +タセ 多勢 +タセ 田瀬 +タセ 田勢 +タセ 田畝 +タセイ 田井 +タセイ 多勢 +タセイ 田制 +タセイ 田勢 +タゼキ 田堰 +タセダ 多瀬田 +タソ 田曽 +タソ 田曾 +タゾイ 田副 +タゾウ 田雑 +タゾウ 田蔵 +タゾウ 多造 +タゾウ 太造 +タゾウ 田藏 +タゾウ 田雜 +タゾエ 田添 +タゾエ 田副 +タソガワ 田草川(田艸川) +タソコ 田底 +タゾコ 田底 +タソダ 多曽田(多曾田) +タソト 田外 +タゾノ 田園 +タゾノ 多園 +タゾメ 田染 +タタ 多田 +タタ 多々 +タダ 太田 +タダ 多田 +タダ 但田 +タダ 田多 +タダ 夛田 +タダ 唯 +タダ 他田 +タダ 只 +タダ 多々 +タダ 太多 +タダ 田々 +タダ 惟 +タダ 多多 +タダ 多陀 +タダ 多桗(多垜) +タダ 田夛 +タダ 夛々 +タダ 伹田 +タダアリ 唯有 +タタイ 田多井 +タタイ 多田井 +タタイ 多々井 +タタイ 田々井 +タタイ 堪井 +タタイ 田タ井 +タダイ 正井 +タダイ 只井 +タダイ 多田井 +タダイ 唯井 +タダイ 多々井 +タダイ 忠井 +ダタイ 駄田井 +タダイシ 只石 +タダイシ 忠石 +タダイデ 多田出 +タダウチ 忠内 +タダウチ 多々内 +タダウチ 多田内 +タダウチ 唯内 +タダウチ 只内 +タダウミ 忠海 +タダウラ 只浦 +タダウラ 唯浦 +タタエ 湛 +タダオ 只尾 +タダオ 多田尾 +タダオ 忠尾 +タダオカ 忠岡 +タダオカ 唯岡 +タダオカ 多々岡 +タダオカ 只岡 +タタカ 田高 +タダカ 田高 +タダガキ 忠垣 +タダカラ 田宝 +タタカワ 多々川 +タダカワ 直川 +タダカワ 只川 +タダカワ 多田川 +タダカワ 但川(伹川) +タダガワ 直川 +タダガワ 只川 +タタキ 多々木 +タタキ 叩 +タタキ 田滝 +タタキ 擲 +タダキ 但木 +タダキ 只木 +タダキ 唯木 +タダキ 多々木 +タダキ 忠木 +タダキ 伹木 +タダキ 田々木 +タダキ 祇樹 +タダクマ 多田隈(夛田隈) +タダクマ 只隈 +タダクマ 只熊 +タダクマ 忠隈 +タダクマ 多々隈 +タダクマ 太田隈 +タタケ 田竹 +タダコシ 只腰 +タダコシ 只越 +タダサ 只佐 +タダサ 只左 +タタサキ 多々崎 +タダシ 直 +タダシキ 唯敷 +タダシゲ 只重 +タダシゲ 忠重 +タダシマ 忠島 +タダシマ 忠嶋 +タダシマ 唯島 +タダス 糺 +タダス 唯須 +タダスエ 忠末 +タダスギ 唯杉 +タタズミ 佇 +タダズミ 忠住 +タダスヤ 糺谷 +タダセ 忠瀬 +タタゾノ 田多園 +タダタ 但田 +タダチ 忠地 +タダチ 田立 +タダチ 直地 +タダチ 多々地 +タダツ 忠津 +タダツ 只津 +タダツ 多田津 +タダツ 太田津 +タダテ 田立 +タダテ 田館 +タダテ 田舘 +タダトモ 只友 +タダナガ 忠永 +タタナベ 田田辺 +タダナワ 只縄 +タダナワ 只繩 +タダナワ 忠縄 +タダナワ 忠繩 +タタニ 田谷 +タタニ 多谷 +タタニ 太谷 +タタニ 他谷 +タタニ 夛谷 +タダニ 田谷 +タダニ 多谷 +タダネ 唯根 +タタノ 多々納 +タタノ 多々野 +タタノ 多田納 +タタノ 太々野 +タダノ 只野 +タダノ 但野 +タダノ 多々納 +タダノ 多田野 +タダノ 唯野 +タダノ 多々野 +タダノ 只埜 +タダノ 多田納 +タダノ 伹野 +タダノ 忠野 +タダノ 田多野 +タダノ 多多納 +タダノ 多多野 +タダノ 太々野 +タダノ 田々野 +タダノ 夛々野 +タダノ 誾野 +タダノ 㓇野 +タタノウ 多々納 +タタノウ 多多納 +タダノウ 多々納 +タダノウ 多田納 +タダノウ 多多納 +タダノブ 只信 +タダノブ 忠信 +タダハラ 多々原 +タダハラ 忠原 +タダヒサ 多田久 +タダヒラ 忠平 +タダヒラ 只平 +タダフジ 忠藤 +タダフジ 唯藤 +タタベ 田々辺(田々邉) +タタベ 田々部 +タダマ 田玉 +タダマ 唯間 +タダマサ 忠政 +タダマサ 只政 +タダマツ 只松 +タダマツ 唯松 +タタミ 多々見 +タタミ 畳 +タタミ 多々美 +タタミ 多田見 +タタミ 田々美 +タタミ 田民 +タタミ 多民 +タタミ 疊 +タタミ 畳見 +タタミ 多多見 +タタミ 太民 +タダミ 忠海 +タダミ 忠見 +タダミ 唯見 +タダミ 只見 +タダミ 多田見 +タタミイワ 畳岩 +タタミサシ 畳指 +タタミサシ 疊指 +タタミダ 畳田(疊田) +タタミタニ 畳谷 +タタミタニ 疊谷 +タタミダニ 畳谷 +タタミダニ 疊谷 +タダミネ 只峰 +タタミノ 畳野 +タタミヤ 畳谷 +タタミヤ 畳屋(疊屋) +タタミヤ 畳家 +タタミヤ 田々宮 +タタミヤ 疊家 +タタミヤ 疂谷 +タダムネ 只宗 +タダムラ 忠村 +タダムラ 多田村 +タダムラ 只村 +タダモト 忠本 +タダモト 多田元 +タダモト 只本 +タダモリ 只森 +タダヤ 多田谷 +タダヤ 唯谷 +タダヤス 只安 +タダヤス 忠保 +タダヤス 只保 +タダヤス 唯保 +タダヤマ 忠山 +タダヨシ 唯吉 +タタラ 多々良 +タタラ 多田羅 +タタラ 鑪 +タタラ 鈩 +タタラ 多々羅 +タタラ 多田良 +タタラ 田多羅 +タタラ 田多良 +タタラ 多多良 +タタラ 田々楽(田々樂) +タタラ 田々羅 +タタラ 田々良 +タダラ 多田羅 +タダラ 田多羅 +タダラ 只羅 +タタライ 田足井 +タタラガサキ 鑪ケ崎 +タタラガサキ 鈩ケ崎 +タタラザコ 鈩迫(鑪迫) +タタラダニ 鈩谷 +タタラノ 鑪野 +タタラノ 鈩野 +タタラマエ 鈩前(鑪前) +タチ 城 +タチ 舘 +タチ 館 +タチ 田地 +タチ 達 +タチ 太地 +タチ 多地 +タチ 立 +タチ 裁 +タチ 太知 +タチ 多知 +タチ 太刀 +タチ 達知 +タチ 太智 +タチ 多智 +タチ 刀 +タチ 田知 +タヂ 田地 +タチアイ 立会 +タチアイ 立合 +タチイ 立井 +タチイ 舘井 +タチイ 立居 +タヂイ 田地井 +タチイシ 立石 +タチイズミ 立泉 +タチイリ 立入 +タチイリ 建入 +タチイワ 立岩 +タチウエ 太刀上 +タチウス 立臼 +タチウチ 舘内 +タチウチ 釼内 +タチウチ 太刀内 +タチウラ 立浦 +タチウラ 太刀浦 +タチエ 立江 +タチエ 館江 +タチエ 舘江 +タチエ 立幣 +タチエダ 立枝 +タチオ 立尾 +タチオカ 立岡 +タチオカ 舘岡 +タチオカ 太刀岡 +タチオノ 立小野 +タチカ 田近 +タチガ 立賀 +タヂカ 田近 +タチガイ 立貝 +タチカケ 太刀掛 +タチカケ 立掛 +タチカベ 立壁 +タチカミ 舘上 +タチカミ 刀上 +タチガミ 立上 +タチガミ 館上 +タチガミ 舘上 +タチガミ 刀上 +タチガミ 太刀上 +タチカメ 立亀 +タチガメ 立亀 +タチガヤ 立ケ谷 +タチガラ 立柄 +タヂカラ 田力 +タチカワ 立川 +タチカワ 太刀川 +タチカワ 達川 +タチカワ 舘川 +タチカワ 刀川 +タチカワ 建川 +タチカワ 田地川 +タチカワ 立河 +タチカワ 多知川 +タチカワ 大刀川 +タチカワ 田智川 +タヂカワ 田地川 +タチカワメ 立川目 +タチキ 立木 +タチキ 建木 +タチギ 立木 +タチギ 立儀 +タチギキ 立聞 +タチキリ 立切 +ダチク 駄竹 +タチクイ 立久井 +タチクラ 立蔵 +タチクラ 立倉 +タチクラ 立藏 +タチコウ 立光 +タチコヤマ 立子山 +タチゴリ 朔晦 +タチサキ 立崎 +タチザキ 立崎 +タチザキ 舘崎 +タチサコ 立迫 +タチザコ 立迫 +タチサワ 立沢 +タチサワ 立澤 +タチザワ 立沢 +タチザワ 立澤 +タチザワ 太刀沢 +タチシタ 舘下 +タチシマ 舘島 +タチシロ 立白 +タチスギ 立杉 +タチズミ 立住 +タチゾノ 立薗 +タチゾノ 立園 +タチタ 立田 +タチタ 舘田 +タチダ 立田 +タチダ 舘田 +タチダ 舘太 +タチタニ 立谷 +タチタニ 舘谷 +タチタニ 橘谷 +タチダニ 舘谷 +タチチョウ 立町 +タチヅカ 立塚 +タチドコロ 立所 +タチナオ 立直 +タチナカ 立中 +タチナカ 舘中 +タチナガ 立永 +タチナミ 立浪 +タチナミ 立波 +タチナリ 立成 +タチネ 立根 +タチノ 立野 +タチノ 館野 +タチノ 舘野 +タチノ 太刀野 +タチノ 館農 +タチノ 刀野 +タヂノ 田地野 +タチノウ 刀納 +タチノウ 立能 +タチノオカ 立野岡 +タチバ 立場 +タチバ 立羽 +タチバガワ 立場川 +タチハタ 立畠 +タチハタ 立畑 +タチバタ 立畑 +タチバタケ 立畠 +タチバタケ 立畑 +タチハナ 橘 +タチハナ 立花 +タチバナ 橘 +タチバナ 立花 +タチバナ 舘花 +タチバナ 館花 +タチバナ 多智花 +タチバナ 舘鼻 +タチバナ 田知花 +タチバナ 立端 +タチバナ 立華 +タチバナ 橘樹 +タチバナ 多知花 +タチバナ 太智花 +タチバナキ 橘木 +タチバナギ 橘木 +タチバナゾノ 橘薗 +タチバナゾノ 橘園 +タチバナダ 橘田 +タチバナモト 橘元 +タチバナヤ 橘谷 +タチバナヤ 橘屋 +タチバミ 立喰 +タチバヤ 立早 +タチバヤシ 舘林 +タチハラ 立原 +タチハラ 舘原 +タチハラ 館原 +タチハラ 太刀原 +タチバンダ 橘田 +タチヒサ 舘久 +タチヒラ 立平 +タチブキ 立吹 +タチフク 立福 +タチフジ 立藤 +タチベ 建部 +タチベ 立部 +タチホコ 太刀鉾 +タチホリ 立堀 +タチボリ 立堀 +タチマツ 立松 +タチマル 立丸 +タチミ 立見 +タチミゾ 立溝 +タチミチ 立道 +タチムラ 立村 +タチムラ 館村 +タチムラ 舘村 +タチムラ 竪村 +タチメ 立目 +タチモト 立元 +タチモト 立本 +タチモト 田知本 +タチモト 舘本 +タチモト 舘元 +タチモリ 立森 +タチモリ 舘盛 +タチモリ 舘森 +タチモリ 館盛 +タチモリ 日月 +タチヤ 立谷 +タチヤ 舘谷 +タチヤ 館谷 +タチヤ 立屋 +タチヤ 立矢 +タチヤシキ 立屋敷 +タチヤナギ 立柳 +タチヤマ 立山 +タチヤマ 館山 +タチヤマ 舘山 +タチヤマ 刀山 +タチヤマ 太刀山 +タチユキ 田知行 +タチユキ 田地行 +タチヨ 田千代 +タチョウ 田長 +タチョウ 田丁 +タチョウ 多長 +タチヨウ 立用 +タチョウマル 田長丸 +タチワ 立和 +タチワキ 立脇 +タチワキ 刀脇 +タチワダ 立和田 +タチワナ 立和名 +ダチンバ 駄賃場 +タツ 龍 +タツ 竜 +タツ 達 +タツ 辰 +タツ 立 +タツ 樹 +タヅ 田津 +タヅ 多津 +ダツ 脱 +ダヅ 太津 +タツアナ 立穴 +タツアラシ 辰嵐 +タツイ 辰井 +タツイ 立井 +タツイ 龍井 +タツイ 竜井 +タツイ 龍揖 +タツイ 達伊 +タツイ 辰亥 +タツイ 龍居 +タツイ 竜居 +タツイ 竜揖 +タツイ 立位 +タツイケ 竜池 +タツイケ 龍池 +タツイシ 立石 +タツイシ 達石 +タツイシ 龍石 +タツイシ 竜石 +タツイシ 辰石 +タツイチ 辰市 +タツイワ 龍岩 +タツイワ 辰岩 +タツイワ 竜岩 +タツウマ 辰馬 +タツウミ 立海 +タツウラ 辰浦 +タヅウラ 田鶴浦 +タツエ 竜江 +タツオ 立尾 +タツオ 辰尾 +タツオ 龍尾 +タツオ 竜尾 +タツオカ 立岡 +タツオカ 辰岡 +タツオカ 竜岡 +タツオカ 龍岡 +タツオカ 達岡 +タツオカ 龍丘 +タツオキ 龍興 +タツオキ 竜興 +タツオク 辰奥 +タツカ 達家 +タツカ 田塚 +タツカ 達可 +タツカ 逹可 +タツガ 達賀 +タヅカ 田塚 +タヅカ 田束 +タツガエ 龍ケ江 +タツガエ 竜ケ江 +タツガキ 立垣 +タツガシラ 辰頭 +タツガシラ 竜首 +タツガシラ 龍首 +タツカベ 立壁 +タツカミ 立神 +タツカミ 龍神 +タツカミ 立上 +タツカミ 達紙 +タツガミ 立神 +タツガミ 竜神 +タツガミ 龍神 +タツガミ 立上 +タツガミ 達紙 +タツガミ 辰上 +タツガミ 立髪 +タツカワ 立川 +タツカワ 達川 +タツカワ 辰川 +タツカワ 龍川 +タツカワ 竜川 +タツカワ 立河 +タツカワ 龍河 +タツカワ 竜河 +タツガワ 立川 +タツガワ 辰川 +タツガワ 龍川 +タツキ 立木 +タツキ 田附 +タツキ 田付 +タツキ 達城 +タツキ 多月 +タツキ 田月 +タツキ 太附 +タツキ 建木 +タツキ 達木 +タツキ 辰喜 +タツキ 竜木 +タツキ 多附 +タツキ 田築 +タツキ 龍城 +タツキ 辰木 +タツキ 竜城 +タツキ 龍木 +タツギ 立木 +タツギ 達城 +タツギ 田次 +タヅキ 田附 +タヅキ 田付 +タヅキ 田月 +タヅキ 太月 +タツグチ 辰口 +タツグチ 竜口 +タツグチ 龍口 +タツグチ 達口 +タヅクリ 田造 +タツケ 田附 +タツケ 田付 +タツケ 達家 +タツケ 太附 +タヅケ 田附 +タヅケ 田付 +タヅケ 太附 +タッコ 田子 +タツコ 達子 +タッコウ 達孝 +タツコウ 立光 +タツコシ 竜腰(龍腰) +タツコシ 龍越 +タツコヤマ 立子山 +タツザ 立座 +タツサカ 達坂 +タツザキ 立崎 +タツザキ 竜崎 +タツザキ 龍崎 +タツザキ 達崎 +タツザキ 辰崎 +タツサワ 立沢 +タツサワ 立澤 +タツサワ 辰澤 +タツザワ 立沢 +タツザワ 立澤 +タツザワ 竜沢 +タツザワ 辰沢 +タツザワ 龍澤 +タツザワ 龍沢 +タツザワ 竜澤 +タツザワ 辰澤 +タツザワ 達沢 +タツジ 多辻 +タツシゲ 辰重 +タツシゲ 辰繁 +タツシタ 達下 +タツシタ 辰下 +タツシマ 立島 +タツシマ 辰島 +タツシマ 立嶋 +タツシマ 辰嶋 +タツシマ 達島 +タツジマ 辰島 +タツジリ 辰尻 +タツジリ 辰尻 +タツシロ 達城 +タツスエ 龍末 +タツズエ 龍末 +タツズミ 辰住 +タツセ 立瀬 +タッソ 達曽 +タッソ 達増 +タツゾノ 龍園 +タッソベ 達曽部 +タッタ 立田 +タッタ 竜田 +タツタ 立田 +タツタ 竜田 +タツタ 龍田 +タツタ 辰田 +タツタ 達田 +タツタ 田蔦 +タツタ 田津田 +タツダ 立田 +タツダ 竜田 +タツダ 龍田 +タツダ 辰田 +タツダ 達田 +タツダ 多津田 +タツダイ 立台(立臺) +タツタニ 立谷 +タツタニ 辰谷 +タツタニ 達谷 +タツタニ 龍谷 +タツタニ 龍渓 +タツタニ 竜渓 +タツタニ 龍溪 +タツタニ 龍谿 +タツタニ 逹谷 +タツダニ 龍渓 +タツダニ 龍溪 +タツダン 辰段 +タツチ 田土 +タツヅカ 竜塚 +タツヅカ 龍塚 +タツヅキ 田続 +タツヅキ 田續 +タッツケ 立附 +タツツケ 立附 +タツド 立土 +タツトウ 立唐 +タツトウ 達藤 +タツトミ 達富 +タツトミ 達冨 +タツトミ 立富 +タツトミ 立冨 +タツトラ 辰寅 +タツナカ 達中 +タツナカ 竜中 +タツナガ 立永 +タツナガ 竜永 +タツナガ 龍永 +タツナミ 立浪 +タツナミ 立波 +タツナミ 竜波 +タツナミ 龍波 +タツナリ 立成 +タツニ 辰仁 +タツニシ 辰西 +タツヌマ 辰沼 +タツヌマ 竜沼 +タツヌマ 龍沼 +タヅネ 田常 +タツノ 立野 +タツノ 辰野 +タツノ 竜野 +タツノ 龍野 +タツノ 田角 +タツノ 達野 +タツノ 樹野 +タツノ 辰ノ +タツノ 辰濃 +タヅノ 田角 +タツノクチ 竜口 +タツノクチ 龍口 +タツノクチ 辰ノ口 +タツノクチ 竜ノ口 +タツノクチ 龍ノ口 +タツノグチ 竜口 +タツノベ 立延 +タツハシ 達橋 +タツハシ 辰橋 +タツハタ 辰畑 +タツハナ 龍花 +タツハナ 竜花 +タツハナ 竜鼻 +タツハマ 辰浜 +タツハマ 辰濱 +タヅハマ 田鶴浜 +タツバミ 竜波見 +タツバミ 龍波見 +タツバヤシ 達林 +タツバヤシ 辰林 +タツバヤシ 龍林(竜林) +タツハラ 立原 +タツハラ 田津原 +タツハラ 辰原 +タツハラ 田鶴原 +タツハラ 龍原 +タツハラ 竜原 +タツハラ 達原 +タヅハラ 田津原 +タヅハラ 田鶴原 +タツヒゲ 達髭 +タツヒデ 辰英 +タツヒラ 立平 +タツヒロ 辰広 +タツブチ 竜淵 +タツブチ 竜渕 +タツブチ 龍淵 +タツブチ 龍渕 +タツベ 竜辺 +タツボ 田坪 +タツボ 田壷 +タツボウ 立棒 +タツホシ 炟星 +タツホリ 辰堀 +タツボリ 立堀 +タツボリ 龍堀 +タツボリ 辰堀 +タツボリ 竜堀 +タツマ 立間 +タツマ 辰馬 +タツマ 達磨 +タツマ 達摩 +タツマ 立麻 +タツマ 達間 +タツマ 辰間 +タツマ 田妻 +タツマ 辰満 +タツマ 立磨 +タツマ 達广 +タヅマ 田妻 +タツマル 辰丸 +タツミ 辰巳 +タツミ 巽 +タツミ 辰己 +タツミ 立見 +タツミ 辰見 +タツミ 竜見 +タツミ 龍見 +タツミ 辰 +タツミ 立身 +タツミ 龍満(龍滿) +タツミ 達見 +タツミ 辰已 +タツミ 多津美 +タツミ 震 +タツミ 竜美 +タツミ 達身 +タツミ 辰身 +タツミ 立巳 +タツミ 龍湖 +タツミ 多津見 +タツミ 田津見 +タツミ 田鶴見 +タツミ 立己 +タツミ 立美 +タツミ 竜己 +タツミ 竜泉 +タツミ 竜味(龍味) +タツミ 竜巳 +タツミ 龍海 +タツミ 龍泉 +タツミ 龍美 +タツミ 龍巳 +タツミ 龍已 +タヅミ 田積 +タヅミ 多積 +タツミカワ 巽川 +タツミグチ 巽口 +タツミサゴ 辰巳砂 +タツミジ 龍見地 +タツミタニ 辰己谷 +タツミタニ 辰巳谷 +タツミチ 立道 +タツミチ 竜見地 +タツミチ 龍見地 +タツミネ 辰峯 +タツミノ 辰巳野 +タツミノ 辰己野 +タツミヤ 辰宮 +タツミヤ 竜宮 +タツミヤ 巽谷 +タツミヤ 龍宮 +タツミヤ 辰己屋 +タツミヤ 達宮 +タツミヤ 辰巳屋 +タツム 田積 +タツムラ 辰村 +タツムラ 立村 +タツムラ 龍村 +タツムラ 竜村 +タツムラ 達村 +タツムロ 竜室 +タツメ 立目 +タヅメ 田爪 +タヅメ 田詰 +タツモト 立元 +タツモト 立本 +タツモト 辰本 +タツモト 辰本 +タツモト 辰元 +タツモト 竜本 +タツモト 龍本 +タツモト 達本 +タツモト 龍元 +タツモト 竜元 +タツモト 逹本 +タツモリ 立盛 +タツモリ 辰森 +タツモリ 龍守 +タツヤ 立谷 +タツヤ 達家 +タツヤ 竜谷 +タツヤ 達谷 +タツヤ 建矢 +タツヤ 辰家 +タツヤ 龍谷 +タツヤ 立矢 +タツヤ 竜八 +タツヤ 龍八 +タヅヤ 田鶴谷 +タツヤナギ 立柳 +タツヤナギ 辰柳 +タツヤマ 立山 +タツヤマ 龍山 +タツヤマ 竜山 +タツヤマ 達山 +タツヤマ 辰山 +タツヨシ 辰吉 +タツラ 田貫 +タヅラ 田面 +タツリ 竜里 +タツリ 龍里 +タツリキ 辰力 +タヅル 田鶴 +タツルハマ 田鶴濱 +タヅルハマ 田鶴濱 +タツワ 竜輪 +タツワ 龍輪 +タツワキ 立脇 +タツワキ 達脇 +タツワキ 辰脇 +タテ 舘 +タテ 館 +タテ 楯 +タテ 立 +タテ 建 +タテ 竪 +タテ 田手 +タテ 経 +タテ 堅 +タテ 立テ +タテ 盾 +タテ 經 +タデ 田出 +タデ 田手 +タデ 蓼 +ダテ 伊達 +ダテ 舘 +ダテ 館 +ダテ 達 +ダテ 伊逹 +タテアイ 館合 +タテアイ 舘合 +タテアキ 立秋 +タテイ 立井 +タテイ 建井 +タテイ 舘井 +タテイ 館井 +タテイ 楯井 +タテイケ 館池(舘池) +タテイシ 立石 +タテイシ 建石 +タテイシ 館石 +タテイシ 舘石 +タテイシ 楯石 +タテイシ 竪石 +タテイシ 盾石 +タテイシ 碣石 +タテイシ 健石 +タテイズミ 立泉 +タテイズミ 館泉 +タテイズミ 舘泉 +タテイチ 舘市 +タテイチ 館市 +タテイバ 立居場 +タテイリ 立入 +タテイリ 建入 +タテイリ 舘入 +タテイリ 館入 +タテイリ 達入 +タテイワ 立岩 +タテイワ 建岩 +タテイワ 竪岩 +タテイワ 館巌 +タテイワ 館厳 +タテイワ 舘巖 +タテイワ 楯岩 +タテウチ 舘内 +タテウチ 館内 +タテウチ 蓼内 +タテウチ 建内 +タテウチ 立内 +タデウチ 蓼内 +タテウマ 立馬 +タテウラ 立浦 +タテウラ 館浦 +タテウラ 舘浦 +タテエ 立栄 +タテエ 舘江 +タテエン 立円(立圓) +タテオ 立尾 +タテオ 建尾 +タテオ 舘尾 +タテオ 館尾 +タテオ 楯尾 +タデオ 蓼尾 +タテオカ 立岡 +タテオカ 館岡 +タテオカ 舘岡 +タテオカ 楯岡 +タテオカ 建岡 +ダテオカ 伊達岡 +タテオガワ 立小川 +タテオケ 立桶 +タテオノ 立小野 +タテガイ 立開 +タテガイ 立貝 +タテガイ 建貝 +タテガキ 立垣 +タテガサワ 舘ケ沢 +タテガサワ 館ケ沢(館ケ澤) +タテガサワ 舘ケ澤 +タテガタ 館形 +タテガタ 舘形 +タテカベ 立壁 +タテカベ 建壁 +タテカベ 帯壁 +タテカミ 建守 +タテガミ 立神 +タテガミ 立上 +タテガミ 館上 +タテガミ 建守 +タテガミ 舘上 +タテガミ 達紙 +タテガミ 立髪 +タテガミ 建神 +タテガミ 鬣 +タテガメ 立亀 +タテカワ 立川 +タテカワ 舘川 +タテカワ 建川 +タテカワ 館川 +タテカワ 楯川 +タテカワ 立河 +タテカワ 竪川 +タテカワ 堅川 +タテガワ 立川 +タデカワ 蓼川 +ダテガワ 伊達川 +タテキ 立木 +タテキ 建木 +タテキ 楯木 +タテキ 竪木 +ダテキ 伊達木 +タテギシ 竪岸 +ダテキュウ 達久 +タテグ 立具 +タテグ 建具 +タテグチ 建口 +タテグチ 立口 +タテグチ 館口 +タテグチ 舘口 +タテクボ 立久保 +タテクラ 立蔵 +タテクラ 立倉 +タテクラ 立藏 +タテクワ 立鍬 +タテコ 立小 +タテゴ 舘後 +タテコウ 立光 +タテコウジ 舘小路 +タテコウジ 館小路 +タテコガワ 立小川 +タテコガワ 立子川 +タテコシ 館越 +タテコシ 舘越 +タテゴシ 舘越 +タテゴシ 館腰 +タテゴシ 舘腰 +タテサカ 館坂 +タテサカ 舘坂 +タテサカ 立坂 +タテサキ 舘崎 +タテザキ 立崎 +タテザキ 館崎 +タテザキ 舘崎 +タテザキ 館嵜 +ダテザキ 達崎 +ダテザキ 伊達崎 +タテサク 立作 +タテサコ 立迫 +タテサダ 立貞 +タテサト 立里 +タテサワ 舘沢 +タテサワ 館沢 +タテサワ 舘澤 +タテサワ 館澤 +タテザワ 立沢 +タテザワ 立澤 +タテザワ 舘沢 +タテザワ 館沢 +タテザワ 舘澤 +タテザワ 館澤 +タテザワ 楯沢(楯澤) +タテシ 立志 +タテシタ 舘下 +タテシタ 館下 +タテシタ 達下 +タテシタ 立下 +タテシナ 蓼科 +タテシマ 立島 +タテシマ 立嶋 +タテシマ 建島 +タテシマ 舘島 +タテシマ 館島 +タテシマ 建嶋 +タテジマ 立島 +タテジマ 立嶋 +タテジマ 建島 +タテジマ 舘島 +タテジョウ 楯条 +タテショウジ 立小路 +タテシロ 立白 +タテスギ 立杉 +タテスミ 立住 +タテズミ 立住 +タテゾノ 立薗 +タテゾノ 立園 +タテゾノ 楯薗 +タテタ 立田 +タテダ 立田 +タテダ 館田 +タテダ 舘田 +タテダ 建田 +タテダ 楯田 +タテダ 帯刀田 +タテダ 竪田 +ダテダ 伊達田 +タテタニ 立谷 +タテタニ 舘谷 +タテチ 立地 +タテチョウ 立町 +タテツ 立津 +タテヅカ 立塚 +タテヅキ 竪月 +タテツケ 立附 +タテツジ 立辻 +タテデラ 館寺(舘寺) +タテドウ 館洞 +タテドウ 舘洞 +タテドオリ 立通 +タテドコ 立床 +タテナイ 蓼内 +タテナオ 立直 +タテナカ 立中 +タテナガ 立長 +タテナミ 立浪 +タテナミ 楯列 +タテニシキ 達錦 +タテニシキ 立錦 +タテヌキ 楯貫 +タテヌマ 蓼沼 +タテヌマ 舘沼 +タテヌマ 館沼 +タテヌマ 建沼 +タデヌマ 蓼沼 +タテノ 立野 +タテノ 館野 +タテノ 舘野 +タテノ 竪野 +タテノ 建野 +タテノ 館農 +タテノ 楯野 +タテノ 舘農 +タテノ 楯能 +ダテノ 伊達野 +タテノイ 立野井 +タテノウチ 舘内 +タテノウチ 館内 +タテノウチ 館野内 +タデノウチ 蓼之内 +タテバ 立場 +タテバ 竪場 +タテバ 立羽 +タテバ 舘場 +タテバ 館場 +タテバ 立葉 +タデバ 蓼場 +タテバコ 立箱 +タテハシ 立橋 +タデハシ 田出橋 +タテハタ 立畠 +タテハタ 立畑 +タテハタ 建畠 +タテハタ 館畑 +タテハタ 竪畠 +タテハタ 舘畑 +タテハタ 堅畠 +タテハタ 建畑 +タテハタ 竪畑 +タテバタ 立畠 +タテバタ 立畑 +タテバタケ 立畠 +タテバタケ 竪畠 +タテバタケ 竪畑 +タテハナ 舘花 +タテハナ 館花 +タテハナ 舘鼻 +タテハナ 館鼻 +タテハバ 立幅 +タテハマ 立浜 +タテハマ 立濱 +タテバヤシ 立林 +タテバヤシ 舘林 +タテバヤシ 館林 +タテバヤシ 建林 +タテバヤシ 達林 +タテバヤシ 楯林 +タテバヤシ 循林 +タテバヤシ 竪林 +タテハラ 立原 +タテハラ 蓼原 +タテハラ 舘原 +タテハラ 建原 +タテハラ 竪原 +タテハラ 田手原 +タデハラ 蓼原 +タテヒサ 館久 +タテヒサ 舘久 +タテヒラ 立平 +タテヒラ 建平 +タテビラキ 立開 +タテフク 立福 +タテフク 立服 +タテフジ 立藤 +タテフジ 館藤 +タテフジ 舘藤 +タテフル 立古 +タテブロ 建風呂 +タテベ 建部 +タテベ 立部 +タテベ 立辺 +タテベ 健部 +タテベ 建辺 +タテベ 帯辺 +タテベ 帯邊 +タテベ 帯邉 +タテベ 立邊 +タテホ 建穂 +タテボウ 立棒 +タテホラ 館洞 +タテホラ 舘洞 +タテボラ 館洞 +タテボラ 舘洞 +タテボリ 立堀 +タテマ 立間 +タテマエ 館前 +タテマエ 舘前 +タテマエ 立前 +タテマキ 立牧 +タテマクラ 立枕 +ダテマサ 館政 +ダテマサ 舘政 +タテマス 立増 +タテマタ 舘又 +タテマタ 舘股 +タテマタ 館又 +タテマチ 立町 +タデマチ 蓼町 +タテマツ 立松 +タテマツ 館松 +タテマツ 舘松 +タテマツ 建松 +タテマツ 立枩 +タテマル 立丸 +タデマル 蓼丸 +タテミ 立見 +タテミ 建見 +タテミ 楯身 +タテミ 館美 +タテミ 舘美 +タテミズ 立水 +タテミゾ 立溝 +タテミチ 立道 +タテミチ 竪道(豎道) +タテミチ 館道 +タテミチ 建道 +タテミチ 堅道 +タテミチ 建路 +タテミチ 舘道 +ダテミチ 伊達道 +タテミツ 立光 +タテミヤ 建宮 +タテムカイ 館向 +タテムカイ 舘向 +タテムラ 立村 +タテムラ 館村 +タテムラ 舘村 +タテムラ 建村 +タテムラ 楯村 +タデムラ 多出村 +タテモト 立元 +タテモト 立本 +タテモト 建元 +タテモト 建本 +タテモト 舘本 +タテモト 竪本 +タテモト 館本 +タテモト 楯本 +タテモト 竪元 +タテモト 館元 +タテモト 堅元 +タデモト 蓼本 +タテモリ 立森 +タテモリ 建守 +タテモリ 舘盛 +タテモリ 舘森 +タテモリ 館盛 +タテモリ 館森 +タテヤ 舘谷 +タテヤ 竪谷 +タテヤ 館谷 +タテヤ 建矢 +タテヤ 立屋 +タテヤ 建家 +タテヤ 楯谷 +タテヤ 豎谷 +タデヤ 田出谷 +タテヤナギ 立柳 +タテヤナギ 館柳 +タテヤナギ 舘柳 +タテヤブ 立藪 +タテヤブ 立薮 +タテヤマ 立山 +タテヤマ 館山 +タテヤマ 舘山 +タテヤマ 竪山(豎山) +タテヤマ 建山 +タテヤマ 嶽山 +タテヤマ 堅山 +タテヤマ 健山 +タテヤマ 楯山 +タテヤマ 縦山 +ダテヤマ 館山 +ダテヤマ 舘山 +ダテヤマ 伊達山 +タテヨシ 立吉 +タテヨシ 建吉 +タテラ 田寺 +タデラ 田寺 +タテワカ 立若 +タテワキ 帯刀 +タテワキ 立脇 +タテワキ 館脇 +タテワキ 舘脇 +タテワキ 建脇 +タテワキ 立分 +タテワキ 帶刀 +タテワキ 堅帯 +タテワキ 帯刃 +タテワケ 立分 +タテワナ 立和名 +タド 田戸 +タド 田渡 +タド 田門 +タド 田土 +タド 多戸 +タド 多渡 +タド 多度 +タトウ 田頭 +タトウ 多東 +タトウ 田遠 +タトウ 多藤 +タトウ 田東 +タドウ 田頭 +タドウ 田堂 +タトオ 田遠 +タトオカ 田戸岡 +タドオカ 田戸岡 +タドオシ 田通 +タドオリ 田通 +タトク 田徳 +タドコ 田床 +タトコロ 田所 +タドコロ 田所 +タドコロ 田処 +タドコロ 田處 +タドコロ 田攸 +タトチ 田杼 +タドチ 田杼 +タドツ 多度津 +タドノ 田殿 +タトベ 田土部 +タトミ 多富 +タトミ 田冨 +タドミ 田富 +タドミ 田冨 +タドメ 多留 +タドメ 田留 +タトリ 田鳥 +タドリ 田鳥 +タナ 田名 +タナ 棚 +タナ 多那 +タナ 田那 +タナ 夛那 +ダナ 田名 +タナアミ 田名網 +タナアミ 棚網 +タナアミ 店網 +タナイ 田内 +タナイ 棚井 +タナイ 多名井 +タナイ 田名井 +タナイケ 棚池 +タナイケ 田奈池 +タナウエ 棚上 +タナウチ 棚内 +タナエ 田苗 +タナエ 種植 +タナエ 棚江 +タナエ 多苗 +タナエミ 田苗見 +タナオ 棚尾 +タナオカ 棚岡 +タナカ 田中 +タナカ 田仲 +タナカ 太中 +タナカ 多中 +タナカ 多名賀 +タナカ 他中 +タナカ 田名加 +タナカ 多仲 +タナガ 田長 +タナガ 田永 +タナカイ 田中井 +タナガイト 棚垣外 +タナガキ 棚垣 +タナカジ 田中地 +タナカシマ 田中島 +タナカジマ 田中島 +タナカジマ 田中嶋 +タナカジマ 田仲島 +タナカジマ 田仲嶋 +タナカダ 田中田 +タナガタ 棚潟 +タナカダテ 田中舘 +タナカダテ 田中館 +タナカマル 田中丸 +タナカミ 棚上 +タナガミ 棚上 +タナカヤ 田中屋 +タナカヤシキ 田中屋敷 +タナカワ 棚川 +タナガワ 棚川 +タナキ 棚木 +タナギ 棚木 +タナキハラ 棚木原 +タナグチ 棚口 +タナクボ 棚窪 +タナクラ 棚倉 +タナゴ 田名後 +タナサ 棚佐 +タナサキ 棚崎 +タナサキ 棚嵜 +タナザキ 棚崎 +タナサワ 棚沢 +タナサワ 棚澤 +タナザワ 棚沢 +タナザワ 棚澤 +タナシ 端無 +タナセ 棚瀬 +タナセ 田名瀬 +タナセ 種瀬 +タナセ 多那瀬 +タナダ 棚田 +タナダ 店田 +タナダ 田名田 +タナダ 多奈田 +タナダ 田灘 +タナダ 田奈田 +タナダ 棚多 +タナタニ 棚谷 +タナツグ 棚次 +タナデ 田名出 +タナナリ 棚成 +タナノ 棚野 +タナバ 田名場 +タナバ 種那場 +タナバ 棚場 +タナバ 店場 +タナハシ 棚橋 +タナハシ 店橋 +タナハシ 柵橋 +タナハシ 田奈橋 +タナハシ 田名橋 +タナハシ 棚 +タナハシ 棚端 +タナハシ 田那橋 +タナバシ 棚橋 +タナハタ 棚畑 +タナバタ 七夕 +タナバヤシ 棚林 +タナハラ 棚原 +タナハラ 柵原 +タナハラ 田名原 +タナバラ 棚原 +タナハル 棚治 +タナビキ 田靡 +タナヒラ 棚平 +タナヒレ 棚鰭 +タナブ 田名部 +タナベ 田辺 +タナベ 田部 +タナベ 田邊 +タナベ 田邉 +タナベ 田名部 +タナベ 田鍋 +タナベ 田名辺 +タナベ 棚辺 +タナベ 種部 +タナベ 棚部 +タナベ 田那辺 +タナベ 田那部 +タナベ 七部 +タナベ 多鍋 +タナベ 田南部 +タナベ 田名邉 +タナベ 多名部 +タナベ 棚邉 +タナベ 店部 +タナベ 多奈部 +タナベ 棚邊 +タナベ 田那邉 +タナベ 田名邊 +タナベヤ 田辺屋 +タナベヤマ 田辺山 +タナボ 田面 +タナマチ 棚町 +タナミ 田波 +タナミ 多並 +タナミ 田並 +タナミ 田浪 +タナミ 田苗見 +タナミ 田名見 +タナミ 田濤 +タナミ 棚見 +タナミ 田涛 +タナミ 田竝 +タナムラ 種村 +タナムラ 棚村 +タナムラ 田那村 +タナムラ 店村 +タナムラ 多奈村 +タナモト 棚本 +タナモト 棚元 +タナモリ 棚森 +タナヤ 棚谷 +タナヤ 棚家 +タナヤ 棚矢 +タナヤマ 棚山 +タナリ 田形 +タナリ 田成 +タナワ 店曲 +タナワ 田縄 +タナワ 田繩 +タニ 谷 +タニ 峪 +タニ 田仁 +タニ 渓 +タニ 谿 +タニ 溪 +タニ 多児 +タニ 礀 +タニ 多仁 +タニ 田荷 +タニ 澗 +タニ 太仁 +タニアイ 谷合 +タニアイ 谷相 +タニアイ 谷会 +タニアラシ 谷嵐 +タニイ 谷井 +タニイ 谷生 +タニイ 谷猪 +タニイ 谷為 +タニイ 谷居 +タニイ 谷位 +タニイ 渓井 +タニイ 溪井 +タニイエ 谷家 +タニイケ 谷池 +タニイシ 谷石 +タニイズミ 谷泉 +タニイチ 谷一 +ダニイデ 谷出 +タニイワ 谷岩 +タニウ 谷生 +タニウエ 谷上 +タニウチ 谷内 +タニウチ 渓内 +タニウチダ 谷内田 +タニウメ 谷梅 +タニウラ 谷浦 +タニウラ 谷裏 +タニエ 谷江 +タニオ 谷尾 +タニオ 谷生 +タニオカ 谷岡 +タニオカ 澗岡 +タニオカ 渓岡 +タニオキ 谷沖 +タニオク 谷奥(谷奧) +タニオト 谷音 +タニカ 谷加 +タニガ 谷賀 +タニカイ 谷開 +タニガイ 谷貝 +タニガイチ 谷垣内 +タニガイト 谷垣内 +タニカガ 谷利 +タニガキ 谷垣 +タニガキ 谷柿 +タニガキウチ 谷垣内 +タニガキウチ 谷境内 +タニガクボ 谷ケ久保 +タニガクボ 谷ケ窪 +タニカケ 谷掛 +タニカゲ 谷蔭 +タニガケ 谷掛 +タニガサキ 谷ケ崎 +タニガシラ 谷頭 +タニカセ 谷綛 +タニカゼ 谷風 +タニカタ 谷方 +タニカタ 谷片 +タニカツ 谷勝 +タニカド 谷角 +タニカド 谷門 +タニカネ 谷兼 +タニガマ 谷釜 +タニカミ 谷上 +タニガミ 谷上 +タニガミ 谷神 +タニガミ 溪神 +タニカメ 谷亀 +タニカワ 谷川 +タニカワ 谷河 +タニカワ 溪川 +タニガワ 谷川 +タニガワ 谷河 +タニガワヤ 谷川屋 +タニカワラ 谷川原 +タニガワラ 谷川原 +タニキ 谷木 +タニギシ 谷岸 +タニキタ 谷北 +タニキヨ 谷清 +タニギリ 谷桐 +タニギワ 谷際 +タニギン 谷銀 +タニクチ 谷口 +タニグチ 谷口 +タニグチ 渓口 +タニグチ 澗口 +タニグチ 溪口 +タニグチ 谿口 +タニグチ 谷久知 +タニグチヒラノ 谷口平野 +タニクニ 谷国 +タニクニ 谷國 +タニクボ 谷久保 +タニクボ 谷窪 +タニクラ 谷倉 +タニグルマ 谷車 +タニクロ 谷黒 +タニグロ 谷黒 +タニゲン 谷源 +タニコ 谷古 +タニゴ 谷後 +タニゴウ 谷郷 +タニゴウチ 谷川内 +タニコシ 谷越 +タニコシ 谷腰 +タニゴシ 谷越 +タニゴメ 谷米 +タニサ 谷佐 +タニサイ 谷塞 +タニサカ 谷坂 +タニサカ 谷阪 +タニザカ 谷坂 +タニサキ 谷崎 +タニサキ 谷向 +タニサキ 谷先 +タニサキ 谷嵜 +タニザキ 谷崎 +タニザキ 谷向 +タニザキ 谷嵜 +タニザキ 渓崎 +タニザキ 谷埼 +タニザキ 溪崎 +タニサケ 谷酒 +タニサコ 谷迫 +タニササ 谷笹 +タニサダ 谷定 +タニサダ 谷貞 +タニサダ 谷佐田 +タニサト 谷里 +タニザト 谷里 +タニサワ 谷沢 +タニサワ 谷澤 +タニザワ 谷沢 +タニザワ 谷澤 +タニシ 田西 +タニシ 田螺 +タニジ 谷地 +タニジ 谷治 +タニシカ 谷鹿 +タニシキ 谷敷 +タニシキ 谷舗 +タニシゲ 谷重 +タニシゲ 谷繁 +タニシタ 谷下 +タニシマ 谷島 +タニシマ 谷嶋 +タニジマ 谷島 +タニショ 谷所 +タニジョ 谷所 +タニショウ 谷生 +タニジョウ 谷上 +タニジョウ 谷城 +タニジョウ 谷條 +タニショウジ 谷小路 +タニジリ 谷尻 +タニシロ 谷城 +タニス 谷栖 +タニズ 谷津 +タニスエ 谷末 +タニスガ 谷菅 +タニスギ 谷杉 +タニスジ 谷筋 +タニスミ 谷角 +タニスミ 谷隅 +タニズミ 谷住 +タニズミ 谷隅 +タニズメ 谷詰 +タニセ 谷瀬 +タニセキ 谷関 +タニゼキ 谷関 +タニゾエ 谷添 +タニゾエ 谷沿 +タニソコ 谷塞 +タニソコ 谷底 +タニゾノ 谷園 +タニタ 谷田 +タニダ 谷田 +タニダ 澗田 +タニダ 谷多 +タニタカ 谷高 +タニタカ 谷孝 +タニタメ 谷為 +タニタメ 谷爲 +タニチ 谷地 +タニチ 谷池 +タニチ 谷知 +タニヂ 谷地 +タニチャ 谷茶 +タニツ 谷津 +タニヅ 谷津 +タニツカ 谷塚 +タニツカ 谷束 +タニヅカ 谷塚 +タニツジ 谷辻 +タニツボ 谷坪 +タニヅメ 谷詰 +タニツル 谷鶴 +タニテ 谷手 +タニデ 谷出 +タニデ 谷手 +タニテツ 谷鉄 +タニト 谷戸 +タニド 谷戸 +タニトウ 谷藤 +タニトウ 谷東 +タニドウ 谷堂 +タニドオリ 谷通 +タニドコロ 谷所 +タニトシ 谷利 +タニドノ 谷殿 +タニトミ 谷富 +タニトミ 谷冨 +タニドミ 谷冨 +タニトモ 谷友 +タニナ 谷名 +タニナイ 谷内 +タニナカ 谷中 +タニナカ 谷仲 +タニナカ 渓中 +タニナカ 溪中 +タニナガ 谷永 +タニナガ 谷長 +タニナミ 谷波 +タニナリ 谷成 +タニナリ 谷也 +タニニシ 谷西 +タニネ 谷根 +タニノ 谷野 +タニノ 谷埜 +タニノ 谷之 +タニノウエ 谷ノ上 +タニノウエ 谷之上 +タニノウチ 谷之内 +タニノウチ 谷ノ内 +タニノガミ 谷ノ上 +タニノキ 谷之木 +タニノキ 谷ノ木 +タニノキ 谷の木 +タニノクチ 谷之口 +タニノクチ 谷ノ口 +タニノグチ 谷ノ口 +タニノダ 谷野田 +タニノブ 谷延 +タニノブ 谷信 +タニノミヤ 谷野宮 +タニバ 谷場 +タニハギ 谷萩 +タニハシ 谷橋 +タニハタ 谷畑 +タニハタ 谷端 +タニハタ 谷畠 +タニハタ 谷幡 +タニハタ 谷畔 +タニバタ 谷畑 +タニバタ 谷端 +タニハナ 谷花 +タニハナ 谿花 +タニバヤシ 谷林 +タニハラ 谷原 +タニヒガシ 谷東 +タニヒサ 谷久 +タニヒラ 谷平 +タニヒロ 谷広 +タニヒロ 谷廣 +タニヒロ 谷弘 +タニブ 谷生 +タニフク 谷福 +タニフジ 谷藤 +タニブチ 谷渕 +タニブチ 谷淵 +タニブチ 澗渕 +タニブチ 澗淵 +タニベ 谷部 +タニベ 谷辺(谷邉) +タニベ 谷邊 +タニホ 谷保 +タニボ 谷保 +タニボウ 谷坊 +タニマ 谷間 +タニマ 渓間(溪間) +タニマイ 谷舞 +タニマエ 谷前 +タニマキ 谷牧 +タニマキ 谷槙(谷槇) +タニマサ 谷政 +タニマサ 谷昌 +タニマス 谷増 +タニマタ 谷全 +タニマタ 谷俣 +タニマチ 谷町 +タニマツ 谷松 +タニマル 谷丸 +タニミズ 谷水 +タニミチ 谷道 +タニミチ 谷路 +タニミツ 谷光 +タニミツ 谷満 +タニミネ 谷峰 +タニミネ 谷峯 +タニミヤ 谷宮 +タニムカイ 谷向 +タニムキ 谷向 +タニムネ 谷宗 +タニムラ 谷村 +タニムラ 谷邑 +タニムラ 渓村 +タニムラ 谷邨 +タニムラ 溪村 +タニムロ 谷室 +タニメ 谷目 +タニモト 谷本 +タニモト 谷元 +タニモト 渓本 +タニモト 溪本 +タニモリ 谷森 +タニモリ 谷守 +タニモリ 谷盛 +タニヤ 谷屋 +タニヤ 谷矢 +タニヤ 谷家 +タニヤ 谷谷 +タニヤ 田二谷 +タニヤ 溪谷 +タニヤギ 谷屋義 +タニヤシキ 谷屋舗 +タニヤス 谷保 +タニヤス 谷安 +タニヤブ 谷藪 +タニヤマ 谷山 +タニヤマ 溪山 +タニヤマ 渓山 +タニヨシ 谷吉 +タニヨシ 谷好 +タニリ 谷利 +タニワ 谷輪 +タニワ 谷和 +タニワ 田庭 +タニワ 谷羽 +タニワカ 谷若 +タニワキ 谷脇(谷𦚰) +タニワキ 谷分 +タニワケ 谷分 +タニワタシ 谷渡 +タニワタリ 谷渡 +タニンジョ 谷所 +タヌキ 田貫 +タヌキハラ 狸原 +タヌク 田抜 +タヌシ 田主 +タヌマ 田沼 +タネ 種 +タネ 種子 +タネ 多根 +タネ 田根 +タネ 多祢 +タネ 太根 +タネ 多称 +タネ 多禰 +タネイ 種井 +タネイ 多根井 +タネイ 夛根井 +タネイエ 種家 +タネイケ 種池 +タネイシ 種石 +タネイチ 種市 +タネイネ 種稲 +タネウラ 種浦 +タネオ 種生 +タネオ 種子尾 +タネオ 種尾 +タネオイ 種生 +タネオカ 種岡 +タネガシマ 種子島 +タネガシマ 種ケ島 +タネガシマ 種ケ嶋 +タネガシマ 種子嶋 +タネカネ 種兼 +タネカワ 種川 +タネガワ 種川 +タネガワ 種河 +タネキ 種木 +タネキ 種帰(種歸) +タネキヨ 種清 +タネグ 種具 +タネクサ 種草 +タネクサ 胤草 +タネクサ 胤艸 +タネクサ 種艸 +タネグサ 種草 +タネグチ 種口 +タネクボ 種窪 +タネクラ 種倉 +タネクラ 種蔵 +タネゲ 種毛 +タネコ 種子 +タネゴ 種五 +タネサ 種佐 +タネサカ 種坂 +タネサキ 種崎 +タネザキ 種崎 +タネサダ 種定 +タネサト 種里 +タネサワ 種沢 +タネサワ 種澤 +タネザワ 種沢 +タネザワ 種澤 +タネザワ 胤沢 +タネザワ 胤澤 +タネジ 種治 +タネシタ 種下 +タネシマ 種島 +タネジリ 種尻 +タネスエ 胤末 +タネセ 種瀬 +タネタ 種田 +タネダ 種田 +タネダ 種子田 +タネタニ 種谷 +タネツグ 種継 +タネト 種戸 +タネナカ 種中 +タネナガ 種子永 +タネナガ 種永 +タネノ 種野 +タネノ 種子野 +タネノブ 種延 +タネバ 種場 +タネハシ 種橋 +タネハタ 種畑 +タネバヤシ 種林 +タネハラ 種原 +タネヒサ 種久 +タネヒラ 種平 +タネヒロ 種広 +タネヒロ 種廣 +タネフサ 種房 +タネフジ 種藤 +タネベ 種部 +タネマ 種間 +タネミツ 種光 +タネムネ 種子宗 +タネムラ 種村 +タネムラ 種邑 +タネモ 種茂 +タネモ 種毛 +タネモト 種本 +タネモト 種元 +タネモリ 胤森 +タネモリ 種森 +タネモリ 種盛 +タネヤ 種谷 +タネヤ 種屋 +タネヤマ 種山 +タネヤマ 実山 +タネヤマ 實山 +タネヤマ 胤山 +タネヨシ 種吉 +タネワタ 種綿 +タノ 田野 +タノ 太野 +タノ 多野 +タノ 田埜 +タノ 田濃 +タノイ 田井 +タノイ 田野井 +タノイ 田之井 +タノイ 田ノ井 +タノイエ 田家 +タノイリ 田野入 +タノイリ 田埜入 +タノイリ 田ノ入 +タノウ 田生 +タノウ 田能 +タノウ 多納 +タノウ 田濃 +タノウ 太農 +タノウ 田納 +タノウ 田農 +タノウエ 田上 +タノウエ 田之上 +タノウエ 田ノ上 +タノウエ 田野上 +タノウチ 田内 +タノウチ 田之内 +タノウチ 田野内 +タノウチ 田ノ内 +タノウラ 田浦 +タノウラ 田ノ浦 +タノウラ 田之浦 +タノウラ 田野浦 +タノエ 田之江 +タノオ 田之尾 +タノオ 田野尾 +タノオ 田ノ尾 +タノオカ 田ノ岡 +タノオカ 田野岡 +タノオカ 田之岡 +タノオキ 田野沖 +タノガキ 太野垣 +タノカシラ 田之頭 +タノガシラ 田之頭 +タノカゼ 田の風 +タノカゼ 田野風 +タノカミ 田上 +タノカミ 田之上 +タノカミ 田野上 +タノガミ 田之上 +タノガミ 田野上 +タノギ 多野木 +タノクチ 田野口 +タノクチ 田之口 +タノクチ 田ノ口 +タノグチ 田野口 +タノグチ 田之口 +タノグチ 田ノ口 +タノクボ 田ノ窪 +タノクラ 田倉 +タノクラ 田野倉 +タノクラ 田之倉 +タノクラ 田ノ倉 +タノサキ 田野崎 +タノサキ 田ノ崎 +タノサキ 田之崎 +タノザキ 田野崎 +タノサコ 田野迫 +タノサワ 田ノ沢(田ノ澤) +タノザワ 田野沢 +タノザワ 田野澤 +タノシ 憑子 +タノシタ 田下 +タノシタ 田ノ下 +タノシタ 田野下 +タノシタ 田之下 +タノシマ 田野島 +タノシマ 田之島 +タノシモ 田下 +タノシリ 田野尻 +タノジリ 田野尻 +タノジリ 田之尻 +タノジリ 田ノ尻 +タノシロ 田野城 +タノセ 田野瀬 +タノセ 田ノ瀬 +タノソト 田外 +タノタ 田野多 +タノダ 田野田 +タノダ 田野太 +タノタカ 田高 +タノナカ 田野中 +タノナカ 田之中 +タノハタ 田之畑 +タノハタ 田ノ畑 +タノハタ 田野畑 +タノハタ 田野端 +タノハタ 田之端 +タノハマ 田野浜(田野濱) +タノハラ 田野原 +タノハラ 田ノ原 +タノハラ 田之原 +タノヒラ 田野平 +タノヒラ 田ノ平 +タノフチ 田之縁 +タノベ 田野辺 +タノベ 田野邊 +タノベ 田野邉 +タノホ 田野保 +タノマ 田野間 +タノマチ 棚町 +タノマル 田野丸 +タノミ 田野実 +タノミ 田野實 +タノムラ 田能村 +タノムラ 田野村 +タノムラ 田之村 +タノムロ 田之室 +タノムロ 田ノ室 +タノモ 頼母 +タノモキ 頼母木 +タノモギ 頼母木 +タノモト 田ノ本 +タノモト 田ノ元 +タノモト 田野本 +タノモト 田之元 +タノモト 田之本 +タノワキ 田之脇 +タノワキ 田ノ脇 +タバ 田場 +タバ 田葉 +タバ 多葉 +タバ 多場 +タバ 田馬 +ダバ 駄場 +ダバ 太場(太塲) +ダバ 駄馬 +タバイ 田葉井 +タバイ 多葉井 +タバイ 煙井 +タバオカ 煙岡 +タバオカ 太場岡 +ダバオカ 駄場岡 +タバカワ 田場川 +タバガワ 田場川 +タハコ 多筥 +タバコ 煙草 +タバコ 多筥 +タバコ 煙艸 +タバコ 把子 +タバコ 夛筥 +タバコ 莨 +タバコタニ 煙草谷 +タバコダニ 煙草谷 +タバコダニ 莨谷 +タバコモリ 煙草森 +タバコヤ 煙草谷 +タバコヤ 莨谷 +タバコヤ 煙谷 +タバコヤ 煙草屋 +タバサキ 煙崎 +ダバサキ 駄場崎 +ダバザキ 駄場崎 +タバサミ 田狭 +タハシ 田橋 +タバシ 田端 +タバシ 田橋 +タバシ 多橋 +タバシネ 束稲 +タハタ 田畑 +タハタ 田端 +タハタ 太幡 +タハタ 田旗 +タバタ 田畑 +タバタ 田端 +タバタ 田畠 +タバタ 田幡 +タバタ 太幡 +タバタ 多羽田 +タバタ 多幡 +タバタ 田羽多 +タバタ 多畑 +タバタ 田旗 +タバタ 多葉田 +タバタ 把田 +タバタ 多端 +タバタ 煙田 +タバタ 太葉田 +タバタ 田羽田 +タバタ 田瑞 +タバタ 田波多 +タバタ 田溿 +タバタ 抱田 +タバタ 夛葉田 +タバタケ 田畑 +タバタケ 田畠 +タバタニ 莨谷 +タハツ 田初 +タバナ 田花 +タバナ 田華 +ダバナカ 駄場中 +タバニシ 多葉西 +タバネ 田羽 +タババ 田馬場 +タバハラ 煙原 +タハマ 田浜 +タハマ 田濱 +タハミ 多波見 +タバムラ 多葉村 +タバモト 多羽本 +ダバモト 駄場元 +タバヤシ 田林 +タバヤシ 多林 +タハラ 田原 +タハラ 太原 +タハラ 多原 +タハラ 俵原 +タバラ 田原 +タバラ 太原 +ダハラ 駄原 +タハラグチ 田原口 +タハラサコ 田原迫 +タハラザコ 田原迫 +タハラダニ 田原谷 +タハラバル 田原春 +タバリ 田張 +タハル 田春 +タバル 田原 +ダバル 駄原 +タバルザコ 田原迫 +タヒ 多斐 +タビ 足日 +タビ 多比 +タビイ 足袋井 +タビイ 旅井 +タビイチ 多飛市 +タビカワ 旅川 +タビカワ 旅河 +タビキ 田引 +タビキ 多比木 +タビサワ 旅沢(旅澤) +タビタ 旅田 +タビタニ 旅谷 +タビヌキ 足袋抜 +タビノキ 樟 +タビノキ 樟木 +タヒラ 田平 +タヒラ 多比良 +タヒラ 太平 +タヒラ 多比羅 +タヒラ 多平 +タヒラ 田比良 +タビラ 田平 +タビラキ 田開 +タヒロ 田広 +タヒロ 田弘 +タヒロ 田廣 +ダビンソン 妥敏尊 +タフ 太布 +タフ 多富 +タフ 袋布 +タフ 多冨 +タフ 多布 +タブ 多武 +タブ 椨 +タブ 多富 +タブ 田武 +タブ 田夫 +タブオ 田布尾 +タブカ 田深 +タブキ 田吹 +タブキ 椨木 +タブキ 田泓 +タフク 田副 +タフク 田福 +タフク 多福 +タブクロ 田袋 +タフサ 田房 +タブサ 田房 +タブサ 田総 +タブサ 田總 +タブサ 太房 +タブサダニ 髻谷 +タフジ 田藤 +タブシ 田伏 +タブシ 田節 +タフセ 田伏 +タブセ 田伏 +タブセ 田臥 +タブセ 田布施 +タブタ 田部田 +タブチ 田渕 +タブチ 田淵 +タブチ 田縁 +タブチ 多淵 +タブチ 太渕 +タブチ 田扶地 +タブチ 田渊 +タブチガワ 田渕川 +タブチガワ 田淵川 +タブト 田太 +タブノ 多武野 +タブノキ 樟 +タブノキ 椨木 +タブノキ 天竺桂 +タブミ 田文 +タブモト 樚本 +タブモト 椨元 +タブモト 椨本 +タフリ 田振 +タブリ 田振 +タフル 田古 +タフル 多古 +タベ 田辺 +タベ 田部 +タベ 田邊 +タベ 田邉 +タベ 多部(夛部) +タベ 多辺 +タベ 田倍 +タベイ 田部井 +タベイ 田辺井 +タベガイ 田部谷 +タベガヤ 田部ケ谷 +タベタ 多部田 +タベタ 田部田 +タベタ 多辺田 +タベタ 給田 +タベタ 田部多 +タベタ 多邊田 +タベタ 多邉田 +タベタ 夛部田 +タベタ 夛辺田 +タベヤ 田部谷 +タベヤ 田辺谷(田邉谷) +タベリ 田縁 +タホ 田保 +タホ 田甫 +タホ 多保 +タホ 田穂(田穗) +タボ 田保 +タボ 田甫 +タボ 多保 +ダホ 陀保 +タホウ 田宝 +タホウ 多宝(多寳・多寶) +タホウイン 多宝院(多寳院) +タボカミ 田母神 +タボガミ 田母神 +タボガミ 多母髪 +タボガミ 田母上 +タボシン 田保新 +タボタ 多保田 +タボハシ 田保橋 +タホラ 田洞 +タホリ 田堀 +タホリ 多堀 +タボリ 田堀 +タボリ 多堀 +タマ 田間 +タマ 玉 +タマ 玉麻 +タマ 多間 +タマ 田摩 +タマ 多満 +タマ 田真 +タマ 田广 +ダマ 多間 +ダマ 駄間 +ダマ 打間 +タマアリ 玉有 +タマイ 玉井 +タマイ 田舞 +タマイ 玉伊 +タマイ 玉居 +タマイ 多満井 +タマイ 珠井 +タマイ 珠居 +タマイエ 玉家 +タマイケ 玉池 +タマイケ 霊池 +タマイコ 玉居子 +タマイゴ 玉居子 +タマイシ 玉石 +タマイズミ 玉泉 +タマイチ 玉一 +タマイワ 玉岩 +タマウ 玉生 +タマウエ 玉上 +タマウチ 玉内 +タマウラ 玉浦 +タマエ 玉江 +タマエ 玉栄 +タマエ 田前 +タマエ 玉衛 +タマエ 玉榮 +タマエ 玉得 +タマエイ 玉栄 +タマエダ 玉枝 +タマオ 玉尾 +タマオ 玉生 +タマオ 玉応 +タマオ 玉緒 +タマオ 玉應 +タマオウ 玉応 +タマオウ 玉應 +タマオカ 玉岡 +タマオカ 玉崗 +タマオカ 玉丘 +タマオカ 瑞岡 +タマオカ 瑞岳 +タマオカ 霊岳 +タマオキ 玉置 +タマオキ 玉沖 +タマオキ 玉起 +タマオギ 玉男木 +タマオク 玉奥 +タマガ 玉賀 +タマガイ 玉飼 +タマガキ 玉垣 +タマガキ 玉柿 +タマカケ 玉懸 +タマカケ 玉掛 +タマガケ 玉懸 +タマガケ 玉掛 +タマカシ 玉柏 +タマカジ 玉梶 +タマガタ 玉県 +タマカミ 玉上 +タマガミ 玉上 +タマガミ 玉神 +タマカワ 玉川 +タマカワ 玉河 +タマカワ 多摩川 +タマガワ 玉川 +タマガワ 玉河 +タマガワ 多摩川 +タマガワ 珠川 +タマキ 玉城 +タマキ 玉置 +タマキ 玉木 +タマキ 田巻 +タマキ 田牧 +タマキ 楡木 +タマキ 玉生 +タマキ 環 +タマキ 玉貫 +タマキ 玉樹 +タマキ 田槙 +タマキ 玉記 +タマキ 玉来 +タマキ 玉暉 +タマキ 玉貴 +タマキ 玉亀 +タマキ 多満城 +タマキ 田卷 +タマキ 玉気 +タマキ 玉杵 +タマキ 玉氣 +タマキ 玉耒 +タマキ 珠城 +タマキ 瑞樹 +タマキ 多巻 +タマキ 多牧 +タマキ 田槇 +タマキ 瑶樹 +タマキ 瑤樹 +タマキ 田蒔 +タマギ 玉木 +タマギク 玉菊 +タマギシ 瓊岸 +タマキタ 玉北 +タマクシ 玉串 +タマクシ 玉櫛 +タマグシ 玉串 +タマグスク 玉城 +タマグチ 玉口 +タマクニ 玉国 +タマクニ 玉國 +タマクボ 玉久保 +タマクマ 玉熊 +タマクラ 玉倉 +タマクラ 霊鞍 +タマコ 玉古 +タマゴイシ 玉子石 +タマコウリ 玉高利 +タマコシ 玉越 +タマコシ 玉腰 +タマゴシ 玉越 +タマゴシ 玉腰 +タマサカ 玉坂 +タマサキ 玉崎 +タマサキ 霊崎 +タマサキ 玉嵜 +タマサキ 玉咲 +タマサキ 玉前 +タマザキ 玉崎 +タマザキ 玉嵜 +タマサク 玉作 +タマザクラ 玉桜 +タマザクラ 玉櫻 +タマサコ 玉硲 +タマサコ 玉浴 +タマサダ 玉貞 +タマサダ 玉定 +タマサト 玉里 +タマザト 玉里 +タマサワ 玉沢 +タマサワ 玉澤 +タマザワ 玉沢 +タマザワ 玉澤 +タマザワ 瑞沢(瑞澤) +タマシ 田増 +タマジ 玉地 +タマシゲ 玉重 +タマシゲ 玉繁 +タマシタ 玉下 +タマシマ 玉島 +タマシマ 玉嶋 +タマシマ 珠島 +タマショウ 玉正 +タマシロ 玉城 +タマシロ 玉代 +タマス 田増 +タマス 田益 +タマス 田舛 +タマスミ 玉角 +タマズミ 玉住 +タマズミ 玉積 +タマセ 玉瀬 +タマセ 玉勢 +タマゼキ 玉関 +タマソ 玉祖 +タマゾノ 玉園 +タマタ 玉田 +タマタ 田又 +タマタ 田俣 +タマタ 田叉 +タマダ 玉田 +タマダ 多間田 +タマダ 瑞田 +タマダ 霊田 +タマダ 瓊田 +タマダイ 玉台 +タマダイ 玉臺 +タマタキ 玉滝 +タマタキ 玉瀧 +タマダテ 玉館 +タマダテ 玉舘 +タマタニ 玉谷 +タマタニ 琳谷 +タマダニ 玉谷 +タマダニ 溜谷 +タマダン 玉段 +タマチ 田町 +タマチ 玉地 +タマチ 玉池 +タマヂ 玉地 +タマツ 玉津 +タマツ 田松 +タマツ 多松 +タマツカ 玉塚 +タマツキ 玉槻 +タマツクリ 玉造 +タマツクリ 玉作 +タマヅクリ 玉造 +タマツシマ 玉津島 +タマツチ 玉土 +タマツボ 玉坪 +タマヅミ 玉積 +タマテ 玉手 +タマテ 珠手 +タマデ 玉出 +タマデラ 瑶寺 +タマデラ 瑤寺 +タマト 玉登 +タマト 玉戸 +タマド 玉土 +タマトシ 玉利 +タマトミ 玉富 +タマドメ 玉留 +タマトリ 玉鳥 +タマナ 玉名 +タマナイ 玉内 +タマナカ 玉中 +タマナガ 玉永 +タマナガ 玉長 +タマナハ 玉那覇(玉那霸) +タマナリ 玉成 +タマニウ 玉生 +タマニシ 玉西 +タマニュウ 玉生 +タマヌキ 玉貫 +タマヌシ 玉主 +タマネ 玉根 +タマノ 玉野 +タマノ 玉生 +タマノ 瑞野 +タマノ 珠野 +タマノ 玉乃 +タマノイ 玉野井 +タマノイ 玉ノ井 +タマノイ 玉乃井 +タマノウエ 玉野上 +タマノウチ 玉之内 +タマノウチ 玉ノ内 +タマノエ 玉上 +タマノキ 玉ノ木 +タマノサト 玉ノ里 +タマノハラ 玉ノ原 +タマノヤ 珠乃屋 +タマハ 玉羽 +タマバ 霊場 +タマハシ 玉橋 +タマハチ 玉八 +タマハマ 玉浜(玉濱) +タマバヤシ 玉林 +タマバヤシ 珠林 +タマハラ 玉原 +タマハル 玉春 +タマヒ 玉樋 +タマヒサ 玉久 +タマヒデ 瑞秀 +タマヒラ 玉平 +タマヒロ 玉広 +タマヒロ 玉廣 +タマブ 玉生 +タマフジ 玉藤 +タマフチ 玉扶持 +タマブチ 玉渕 +タマブチ 珠渕 +タマブチ 玉淵 +タマブチ 珠淵 +タマフネ 玉舟 +タマフネ 玉船 +タマフリ 玉振 +タマボコ 玉鉾 +タマホセ 玉保世 +タマホリ 玉堀 +タママ 玉真 +タママ 玉眞 +タママキ 玉巻 +タママキ 玉牧 +タママツ 玉松 +タママツ 霊松 +タママル 玉丸 +タマミ 玉見 +タマミズ 玉水 +タマミツ 玉光 +タマミツ 瑞光 +タマミネ 玉峰 +タマミネ 玉峯 +タマミヤ 玉宮 +タマムシ 玉虫 +タマムシ 玉蟲 +タマムラ 玉村 +タマムラ 玉邑 +タマムラ 珠村 +タマムラ 王村 +タマムラ 霊群 +タマムロ 圭室 +タマメ 玉目 +タマモト 玉本 +タマモト 玉元 +タマモト 珠本 +タマモリ 玉森 +タマモリ 玉盛 +タマモリ 玉守 +タマモリ 玉護 +タマヤ 玉谷 +タマヤ 玉屋 +タマヤ 玉舎(玉舍) +タマヤ 玉家 +タマヤ 玉矢 +タマヤ 玉宅 +タマヤナギ 玉柳 +タマヤマ 玉山 +タマヤマ 霊山 +タマヤマ 珠山 +タマヨシ 玉好 +タマヨシ 玉吉 +タマヨシ 玉芳 +タマヨセ 玉寄 +タマヨセ 玉代勢 +タマヨセ 玉寄勢 +タマヨリ 玉寄 +タマリ 玉利 +タマリ 溜 +タマリ 玉里 +タマリ 玉理 +タマリ 田万里 +タマリ 多満里 +タマリ 田鞠 +タマリエ 溜衛 +タマリオ 溜尾 +タマリシマ 溜島 +タマリチ 玉利地 +タマリバタ 溜畑 +タマリブチ 溜渕 +タマリブチ 溜淵 +タマリミズ 溜水 +タマリムラ 溜村 +タマル 田丸 +タマル 溜 +タマル 多丸 +タマル 玉留 +タマル 太丸 +タマル 大円 +タマル 田円 +タマル 田圓 +タマルシマ 溜島 +タマルダニ 田丸谷 +タマルブチ 溜渕 +タマルヤ 溜谷 +タマルヤ 溜箭 +タマルヤ 田丸屋 +タマワカ 玉若 +タマワキ 玉脇 +タマワケ 玉分 +タマワシ 玉鷲 +タマワシ 霊鷲 +タマワリ 田廻 +タマワリ 玉割 +タマン 田万 +タマン 田萬 +タミ 民 +タミ 田見 +タミ 多見 +タミ 田味 +タミアキ 民秋 +タミイ 民井 +タミウチ 民内 +タミオ 堧水尾 +タミオカ 民岡 +タミカド 民門 +タミキ 民木 +タミキ 民喜 +タミクサ 民草 +タミサト 民里 +タミザネ 民実(民實) +タミサワ 民沢(民澤) +タミザワ 民沢(民澤) +タミシゲ 民繁 +タミシタ 民下 +タミズ 田水 +タミタ 民田 +タミダ 民田 +タミタニ 民谷 +タミチ 田路 +タミチ 田道 +ダミチ 駄道 +タミツ 田光 +タミツ 田満 +タミツジ 民辻 +タミナガ 民永 +タミナガ 民長 +タミナト 田港 +タミナミ 田南 +タミニシ 民西 +タミネ 田峰 +タミノ 民野 +タミノ 田蓑 +タミノ 多見野 +タミノ 田簑 +タミノ 民農 +タミヒサ 民久 +タミムラ 民村 +タミモト 民本 +タミモト 多海本 +タミモト 民幹 +タミモリ 民守 +タミヤ 田宮 +タミヤ 民谷 +タミヤ 多宮 +タミヤ 民家 +タミヤ 多見谷 +タミヤ 民屋 +タミヤ 民宮 +タミヤ 民宅 +タミヤス 民安 +タミワ 民輪 +タムカイ 田向 +タムカイ 田迎 +タムカエ 田迎 +タムキ 田向 +タムギ 田麦 +タムギ 田麥 +タムコ 田向 +タムコウ 田向 +タムネ 田宗 +タムラ 田村 +タムラ 多村(夛村) +タムラ 田邨 +タムラ 田邑 +タムラ 太村 +タムラ 他村 +タムラ 多武良 +タムラ 多邨 +タムラサキ 田村崎 +タムラザキ 田村崎 +タムラヤ 田村谷 +タムロ 田室 +タムロ 屯 +タメ 多米 +タメ 田米 +タメ 為 +タメ 爲 +タメアキ 為明(爲明) +タメイ 為井 +タメイ 溜井 +タメイ 爲井 +タメイエ 為家(爲家) +タメイケ 溜池 +タメイシ 為石 +タメイシ 爲石 +タメオ 為尾 +タメオカ 為岡 +タメオカ 爲岡 +タメカ 為家(爲家) +タメガ 為賀 +タメガイ 田部井 +タメガイ 為我井 +タメガイ 為谷 +タメガイ 為貝 +タメガイ 集貝 +タメガイ 田米開 +タメガイ 為ケ井 +タメガイ 爲我井 +タメガイ 爲貝 +タメガイ 溜貝 +タメガイ 爲谷 +タメカズ 為数(爲數) +タメカズ 為數 +タメカズ 爲数 +タメカネ 為金 +タメカネ 爲金 +タメガヤ 為谷 +タメガヤ 為ケ谷 +タメガヤ 溜ケ谷 +タメガヤ 爲ケ谷 +タメカワ 為川 +タメカワ 溜川 +タメカワ 爲川 +タメガワ 溜川 +タメキ 為木 +タメキ 為貴 +タメキ 爲木 +タメキタ 溜北 +タメキヨ 為清 +タメキヨ 爲清 +タメグチ 溜口 +タメグチ 為口 +タメグチ 為口 +タメクニ 為国 +タメクニ 為國 +タメクニ 爲国 +タメクニ 爲國 +タメクミ 為汲 +タメクリ 為栗 +タメクリ 爲栗 +タメグリ 為栗 +タメグリ 爲栗 +タメゴ 為後 +タメゴ 爲後 +タメサ 為佐(爲佐) +タメサキ 為崎 +タメサキ 爲崎 +タメザキ 為崎 +タメサダ 為定 +タメサダ 為貞 +タメサダ 爲定 +タメザネ 為実 +タメザネ 爲實 +タメザネ 為實 +タメザネ 爲実 +タメザワ 為沢(爲沢) +タメザワ 為澤(爲澤) +タメジ 為治 +タメシキ 為敷 +タメシゲ 為重 +タメシゲ 爲重 +タメシタ 為下 +タメシタ 爲下 +タメシマ 為島 +タメシマ 爲島 +タメジマ 溜島 +タメス 為須 +タメスイ 為水(爲水) +タメスエ 為末 +タメスエ 為季 +タメスエ 爲季 +タメスエ 爲末 +タメズミ 為角 +タメソウ 為壮 +タメタ 為田 +タメタ 爲田 +タメダ 為田 +タメダ 溜田 +タメダ 多米田 +タメダ 爲田 +タメタカ 為高 +タメタニ 為谷 +タメタニ 爲谷 +タメチカ 為近 +タメチカ 爲近 +タメヅミ 為積(爲積) +タメトウ 為藤 +タメトウ 為頭 +タメトウ 爲藤 +タメナカ 為中 +タメナガ 為永 +タメナガ 為長 +タメナガ 爲永 +タメナリ 為成 +タメナリ 爲成 +タメニシ 為西 +タメニシ 爲西 +タメノ 為野 +タメノ 溜野 +タメノブ 為延 +タメノリ 為則 +タメノリ 為乗(爲乗) +タメノリ 爲則 +タメバ 為羽 +タメハシ 為橋 +タメバタ 為端 +タメヒサ 為久 +タメヒサ 爲久 +タメヒラ 為平 +タメヒラ 爲平 +タメヒロ 為広 +タメヒロ 為廣 +タメヒロ 爲広 +タメヒロ 爲廣 +タメヒロ 溜広 +タメフク 為福(爲福) +タメフサ 為房 +タメフサ 爲房 +タメフジ 為藤 +タメフジ 爲藤 +タメマエ 溜前 +タメマサ 為政 +タメマサ 爲政 +タメミズ 為水(爲水) +タメミツ 為光 +タメミツ 爲光 +タメムラ 為村 +タメムラ 爲村 +タメモト 為本 +タメモト 為元(爲元) +タメモト 爲本 +タメモト 溜本 +タメモリ 為森 +タメヤ 為谷 +タメヤ 為矢 +タメヤ 爲谷 +タメヤス 為保 +タメヤス 為安(爲安) +タメヤス 矯安 +タメヤス 爲保 +タメヤマ 為山 +タメユキ 為行(爲行) +タメヨリ 為頼 +タメヨリ 爲頼 +タメワキ 為脇 +タモ 田茂 +タモ 田藻 +タモイ 田茂井 +タモウ 玉生 +タモウ 賜 +タモウ 賚 +タモカミ 田母神 +タモカミ 多母髪 +タモガミ 田母神 +タモガミ 多母髪 +タモガミ 田最上 +タモガミ 田母上 +タモガミ 田毋神 +タモキ 田面木 +タモキ 𣕚木 +タモギ 田面木 +タモチ 多持 +タモチ 田持 +ダモチ 蛇持 +タモツ 保 +タモツ 保津 +タモツ 値 +タモツ 存 +タモト 田本 +タモト 田元 +タモト 多本 +タモト 多元 +ダモト 駄本 +タモトイ 袂井 +タモナイ 田茂内 +タモノ 太茂野 +タモノ 田母野 +タモノキ 田面木 +タモノキ 𣕚野木 +タモミ 田籾 +タモヤマ 田面山 +タモヤマ 田茂山 +タモリ 田森 +タモリ 田守 +タモリ 田盛 +タモリ 多森 +タモリ 太森 +タモリ 太司 +タモン 多門 +タモン 田門 +タモン 多聞 +タモンイン 多門院 +タモンジ 多門寺 +タヤ 田谷 +タヤ 田屋 +タヤ 田家 +タヤ 田矢 +タヤ 多谷 +タヤ 多屋 +タヤ 他谷 +タヤ 旅 +タヤ 旅家 +タヤ 太矢 +タヤ 多養 +タヤ 他屋 +タヤ 多矢 +タヤウチ 田谷内 +タヤウチ 田屋内 +タヤオカ 太屋岡 +タヤガキ 太野垣 +タヤグラ 田櫓 +タヤケ 田宅 +タヤシキ 田屋敷 +タヤシキ 田屋舗 +タヤス 田保 +タヤス 田安 +タヤス 太安 +タヤス 陀安 +タヤスザワ 田保沢 +タヤダテ 田屋舘 +タヤダテ 田屋館 +タヤチ 田谷内 +タヤナカ 田舎中 +タヤナギ 田柳 +タヤノ 田谷野 +タヤノ 田家野 +タヤハラ 田屋原 +タヤマ 田山 +タヤマ 多山 +タヤマ 太山 +タヤマ 夛山 +タヤマジ 田山地 +タヤマチ 田山地 +タヤマヂ 田山地 +タヤモト 多谷本 +タユ 田湯 +タユイ 田結 +タユイショウ 田結庄 +タユイノショウ 田結荘 +タユウ 太夫 +タユウボリ 大夫堀 +タユキ 田幸 +タユキ 田行 +タユモト 太夫本 +タヨシ 田吉 +タヨシ 田宜 +タヨシ 田好 +タヨシ 田宣 +タヨダ 多代田 +タヨモ 太与茂 +タヨリ 田寄 +タヨリ 田頼 +タラ 多良 +タラ 太良 +タラ 多羅 +タラ 田羅 +タラ 田良 +タラオ 多羅尾 +タラオ 多良尾 +タラオ 田良尾 +タラオ 太良尾 +タラオカ 多羅岡 +タラカワ 財川 +タラカワ 戝川 +タラキ 太良木 +タラキ 多良木 +タラキ 大良木 +タラキタ 柞木田 +タラキダ 柞木田 +タラサワ 桜沢 +タラサワ 多羅沢 +タラサワ 桵沢 +タラサワ 桜澤 +タラサワ 棕沢 +タラサワ 多羅澤 +タラサワ 多良澤 +タラサワ 樰沢 +タラサワ 桵澤 +タラサワ 棕澤 +タラサワ 樰澤 +タラサワ 鱈沢 +タラシマ 田良島 +タラスキ 田羅鋤 +タラチネ 父母 +タラバ 鱈場 +タラハラ 俵原 +タラハラ 田羅原 +タラハラ 田良原 +タラベ 多良部 +タラマ 多良間 +タラマ 田羅間 +タラマ 多羅間 +タラミダテ 田良美舘 +タリ 田利 +タリ 多里 +タリ 多利 +ダリ 多利 +ダリ 夛利 +タリカド 足門 +タリキ 田力 +タリキ 他力 +タリキノ 他力野 +タリサワ 足沢 +タリサワ 足澤 +タリュウモト 太柳元 +タリョウマル 太良丸 +タル 樽 +タル 多留 +タル 多畄 +ダル 達 +タルイ 樽井 +タルイ 垂井 +タルイ 樽家 +タルイ 捶井 +タルイ 垂伊 +タルイ 多留井 +タルイ 樽居 +タルイ 埀井 +タルイ 棰井 +タルイシ 垂石 +タルイシ 樽石 +タルイシ 埀石 +タルイシ 棰石 +タルウミ 樽海 +タルエ 樽栄 +タルエ 樽榮 +タルオ 樽尾 +タルオカ 樽岡 +タルカド 樽角 +タルカド 垂門(埀門) +タルカド 樽門 +タルカミ 樽上 +タルカワ 樽川 +タルキ 樽木 +タルキ 足木 +タルキ 垂木 +タルキ 多留木 +タルグチ 樽口 +タルグチ 垂口(埀口) +タルサ 樽佐 +タルサキ 樽崎 +タルサコ 垂迫 +タルサワ 足沢 +タルサワ 樽沢 +タルサワ 垂沢 +タルサワ 足澤 +タルサワ 樽澤 +タルサワ 垂澤 +タルザワ 樽沢 +タルザワ 樽澤 +タルシタ 樽下 +タルシマ 樽島 +タルシマ 樽嶋 +タルゾノ 樽園 +タルタ 樽田 +タルダ 樽田 +タルタニ 樽谷 +タルタニ 垂谷 +タルタニ 多留谷 +タルチャ 樽茶 +タルツ 樽津 +タルツカ 樽塚 +タルヅカ 樽塚 +タルトコ 樽床 +タルナガ 垂永 +タルノ 樽野 +タルノ 垂野 +タルノ 埀野 +タルフル 樽古 +タルベ 樽部 +タルベ 樽辺 +タルホ 足穂 +タルマ 柞磨 +タルマ 樽磨 +タルマ 樽馬 +ダルマ 達磨 +ダルマ 達摩 +タルマサ 樽政 +タルマタ 垂又 +タルミ 樽見 +タルミ 垂水 +タルミ 垂見(埀見) +タルミ 樽美 +タルミ 樽海 +タルミ 垂 +タルミ 樽味 +タルミ 多留見(夛留見) +タルミ 田留見 +タルミ 足水 +タルミ 多留美 +タルミズ 垂水 +タルミズ 樽水 +タルミツ 樽光 +タルミヤ 樽宮 +タルムラ 樽村 +タルモト 樽本 +タルモト 太柳元 +タルモト 樽元 +タルモリ 樽森 +タルヤ 樽谷 +タルヤ 樽屋 +タルヤ 樽家 +タルヤ 垂谷 +タルヤ 樽矢 +タルヤマ 樽山 +タルヤマ 垂山 +タルヨシ 樽好 +タルワキ 垂脇 +タルワキ 樽脇 +タレ 垂 +タレイ 垂井 +タレイシ 垂石 +タレウチ 垂内 +タレカド 垂門(埀門) +タレカド 誰角 +タレキ 垂木 +タレサワ 垂沢 +タレサワ 垂澤 +タレシタ 垂下 +タレノ 垂野 +タレノウチ 垂ノ内 +タレミズ 垂水 +タレヤナギ 垂柳 +タレワキ 垂脇 +タロ 多呂 +タロ 田呂 +タロウ 田老 +タロウ 太漏 +タロウウラ 太郎浦 +タロウザワ 田郎沢 +タロウダ 太郎田 +タロウダチ 太郎館 +タロウボウ 太良坊 +タロウボウ 太郎坊 +タロウマル 太郎丸 +タロウマル 田郎丸 +タロウラ 太郎良 +タロウラ 太郎浦 +タロウラ 多郎浦 +タロウラ 大郎良 +タロハタ 多郎畑 +タロマル 田呂丸 +タロラ 太郎良 +タワ 峠 +タワ 田和 +タワ 多和 +タワ 垰 +タワ 田輪 +タワ 乢 +タワキ 田脇 +タワシタ 岫下 +タワセ 田和瀬 +タワタ 多和田 +タワタ 田綿 +タワタ 夛和田 +タワダ 多和田 +タワダ 垰田 +タワダ 峠田 +タワダ 太和田 +タワダ 田和田 +タワタリ 田渡 +タワツジ 田和辻 +タワモト 垰本(垰夲) +タワモト 峠本 +タワモト 多和本 +タワラ 田原 +タワラ 俵 +タワラ 多原 +タワラ 俵原 +タワライ 俵井 +タワライシ 俵石 +タワラギ 俵木 +タワラグチ 俵口 +タワラグチ 田原口 +タワラザカ 俵坂 +タワラサキ 俵崎 +タワラザキ 俵崎 +タワラサコ 俵迫 +タワラザコ 俵迫 +タワラダ 俵田 +タワラタニ 俵谷 +タワラダニ 俵谷 +タワラツミタ 俵積田 +タワラツミダ 俵積田 +タワラヅミタ 俵積田 +タワラツンダ 俵積田 +タワラハタ 俵畑 +タワラハラ 俵原 +タワラマチ 俵町 +タワラモト 俵本 +タワラモト 俵元 +タワラモトヤ 俵本谷 +タワラヤ 俵谷 +タワラヤ 俵屋 +タワラヤ 俵家 +タワラヤ 俵箭 +タワラヤ 俵矢 +タワラヤマ 俵山 +タワリ 田割 +タン 丹 +タン 檀 +タン 笪 +ダン 段 +ダン 団 +ダン 檀 +ダン 壇 +ダン 旦 +ダン 團 +ダン 弾 +ダン 淡 +ダン 暖 +ダン 男 +タンアミ 丹阿弥 +タンイ 丹井 +ダンイ 団井 +ダンイ 團井 +タンウチ 丹内 +ダンウラ 檀浦 +ダンウラ 段浦 +ダンウラ 壇浦 +ダンウラ 柤浦 +タンオ 丹尾 +ダンオウ 段王 +ダンオカ 檀岡 +タンガ 丹賀 +タンガ 丹花 +タンガ 旦過 +タンガ 丹鍬 +タンガ 旦花 +タンカイ 淡海 +ダンガイト 段垣内 +タンガキ 丹柿 +ダンガキ 段垣 +ダンガミ 段上 +ダンガミ 団上 +ダンガミ 團上 +タンカワ 丹川 +タンカワ 淡河 +タンガワ 丹川 +ダンガワ 段川 +タンカワモト 丹川元 +タンキ 旦木 +タンキ 丹喜 +タンキ 丹気 +タンキ 丹氣 +タンギ 丹木 +タンギ 旦木 +ダンキ 段木 +ダンキ 談岐 +ダンギ 段木 +ダンギ 談儀 +ダンギ 談議 +ダンギ 談義 +タンキク 丹菊 +タンギク 丹菊 +ダンギショ 談義所 +ダンギショ 談議所 +タンキタ 丹北 +タンキョウ 丹京 +タングチ 反口 +ダングチ 段口 +ダングリ 団栗 +ダングリ 團栗 +タンケ 丹家 +タンケ 谷家 +タンゲ 丹下 +タンゲ 田家 +タンゲ 丹家 +タンゲ 淡下 +ダンケ 段家 +タンケイ 丹慶 +タンゲザカ 丹下坂 +タンゴ 丹後 +タンゴ 丹呉 +タンゴ 田後 +タンゴ 反後 +タンゴ 丹后 +タンゴ 丹古 +タンゴ 丹吾 +ダンゴ 団子 +ダンゴ 團子 +ダンゴイシ 団子石 +ダンゴイシ 團子石 +タンゴウ 丹郷 +タンゴウ 丹合 +ダンコウ 団孝(團孝) +タンゴク 丹黒 +タンコシ 淡越 +タンゴダ 丹後田 +タンゴタニ 丹後谷 +タンゴヤ 丹後谷 +タンサカ 丹阪 +ダンザカ 段坂 +タンザキ 丹崎 +ダンザキ 檀崎 +ダンザキ 達崎 +ダンザキ 壇崎 +ダンザキ 段崎 +タンサコ 反迫 +ダンサコ 団迫 +ダンサコ 團迫 +タンザワ 丹沢 +タンザワ 丹澤 +タンザン 丹山 +タンジ 丹治 +タンジ 丹司 +タンジ 丹地 +タンジ 丹路 +タンジ 丹冶 +タンジ 丹次 +ダンシ 段子 +タンシゲ 丹重 +ダンシタ 段下 +タンジマ 丹島 +タンジマ 丹嶋 +タンジマ 丹嶌 +タンショ 丹所 +タンジョ 丹所 +タンジョ 谷所 +タンショウ 丹生 +タンショウ 丹正 +タンジョウ 丹生 +タンジョウ 丹上 +タンジョウ 丹正 +タンジョウ 淡成 +ダンショウ 段床 +ダンショウ 段証(段證) +ダンジョウ 檀上 +ダンジョウ 段上 +ダンジョウ 壇上 +ダンジョウ 団上 +ダンジョウ 段城 +ダンジョウ 團上 +ダンジョウ 弾正 +ダンジョウバラ 弾正原(彈正原) +ダンシロ 段代 +タンシン 丹新 +ダンスイ 暖水 +ダンズカ 段塚 +タンセイ 丹生 +タンソウ 湛増 +タンソウ 丹宗 +タンゾウ 丹蔵 +タンダ 反田 +タンダ 丹田 +タンダ 但田 +タンダ 短田 +タンダ 丹多 +ダンタ 段田 +ダンタ 団田 +ダンダ 段田 +ダンダ 檀田 +ダンダ 団田 +ダンダ 壇田 +ダンダ 團田 +タンダイ 丹代 +タンダイ 旦代 +タンダイ 丹台 +タンダイ 旦平 +ダンダイ 段題 +タンタカ 田高 +タンタニ 丹谷 +タンダニ 丹谷 +ダンタニ 段谷 +タンチ 丹地 +タンヂ 丹治 +ダンチュウ 段中 +タンチョウ 丹頂 +タンツカ 丹塚 +ダンツカ 団塚 +ダンツカ 段塚 +ダンツカ 弾塚 +ダンヅカ 団塚 +ダンヅカ 段塚 +ダンヅカ 弾塚 +ダンヅカ 團塚 +ダンヅカ 彈塚 +ダンツジ 壇辻 +ダンツジ 檀辻 +タンデ 丹出 +ダンテイ 団貞 +タンド 谷戸 +タンド 丹戸 +タンド 丹土 +タンド 丹渡 +タンド 丹度 +タントウ 丹藤 +タントウ 丹党 +タンドウ 丹藤 +タンドウ 反頭 +タンドウ 丹籐 +ダントウ 段当 +ダンドウ 団藤(團藤) +ダンドウ 段堂 +ダンドウ 旦道 +ダントク 檀特 +ダントコ 段床 +ダンドコ 段床 +ダンドコ 檀床 +タンドコロ 丹所 +タンナ 丹那 +タンナイ 丹内 +タンナカ 反中 +タンナカ 淡中 +タンナカ 談中 +ダンナカ 段中 +ダンナジ 旦那寺 +タンナワ 淡輪 +タンナン 丹南 +タンニュウ 丹生 +タンネ 丹根 +タンノ 丹野 +タンノ 但野 +タンノ 淡野 +タンノ 旦野 +タンノ 丹埜 +タンノ 反野 +タンノ 且野 +タンノ 丹農 +ダンノ 団野 +ダンノ 段野 +ダンノ 檀野 +ダンノ 淡野 +ダンノ 旦野 +ダンノ 團野 +ダンノ 壇野 +ダンノ 柤野 +タンノウ 丹能 +タンノウ 反納 +タンノウ 丹農 +ダンノウエ 段ノ上 +ダンノウエ 檀之上 +ダンノウエ 段之上 +ダンノウラ 檀浦 +ダンノウラ 壇浦 +ダンノウラ 檀ノ浦 +ダンノシタ 段ノ下 +ダンノシタ 段之下 +ダンノシタ 段野下 +ダンノハラ 団之原 +ダンノハラ 檀ノ原 +ダンノハラ 弾野原 +ダンノハラ 團之原 +ダンノハラ 彈野原 +ダンノヒラ 段之平 +タンノブ 反信 +タンノワ 淡輪 +タンバ 丹羽 +タンバ 丹波 +タンバ 丹場 +タンバ 丹葉 +タンバ 反葉 +タンバ 丹馬 +タンパ 丹波 +タンパ 谷波 +タンバシ 丹橋 +タンバジ 丹波地 +タンバタ 反畑 +タンバタ 反端 +ダンバタ 段畑 +ダンバタ 段畠 +タンバヤ 丹波屋 +タンバヤシ 丹林 +ダンバヤシ 段林 +ダンバヤシ 檀林 +タンバラ 丹原 +ダンバラ 檀原 +ダンバラ 段原 +ダンバラ 団原(團原) +ダンバラ 壇原 +ダンバラ 旦原 +ダンビラ 段平 +タンブ 𦿸父 +タンプ 反怖 +タンプ 反布 +ダンブチ 段渕 +タンベ 丹部 +タンベ 旦部 +タンベ 且部 +タンホ 丹保 +タンボ 丹保 +タンボ 反保 +タンボ 田方 +タンボ 畝 +タンボ 田保 +タンボ 田甫 +タンボ 反甫 +タンボ 端保 +タンボ 丹甫 +タンボ 多武保 +タンボ 反圃 +タンボ 旦保 +タンボ 田圃 +タンボ 丹圃 +タンボ 丹穂 +タンボ 旦暮 +タンポ 丹保 +タンポ 反保 +タンポ 田甫 +タンポ 反甫 +タンポ 端保 +タンポ 丹甫 +タンポ 反怖 +タンポ 旦保 +タンポ 短保 +タンボウ 反房 +タンポウ 丹法 +タンポウ 反方 +ダンボク 段木 +タンボハシ 田保橋 +ダンボリ 段堀 +タンマ 丹間 +ダンマ 達广 +タンマチ 反町 +タンマツ 丹松 +ダンマツ 段松 +ダンマル 団丸 +タンミツ 丹光 +タンミヤ 丹宮 +ダンムラ 段村 +ダンムラ 団村 +ダンムラ 團村 +タンモト 丹本 +タンモト 淡本 +ダンモト 段本 +ダンモト 檀本 +ダンモト 壇本 +タンモリ 丹森 +タンヤ 丹谷 +タンヤ 旦谷 +ダンヤ 檀谷 +ダンヤ 段谷 +ダンヤ 談谷 +ダンヤス 段安 +タンヤマ 丹山 +ダンヤマ 談山 +ダンヨシ 段吉 +タンリュウ 丹竜 +タンワ 淡輪 +チ 千 +チ 地 +チアキ 千明 +チアキ 千秋 +チアキ 千穐 +チアキ 地明 +チアキ 智明 +チアシ 千足 +チアヤ 千綾 +チアラシ 千嵐 +チアリ 智有 +チイ 地井 +チイ 千井 +チイ 知井 +チイサガタ 小県 +チイシ 地石 +チイノ 千井野 +チイロ 千色 +チウエ 地上 +チウチ 地内 +チウミ 地海 +チウラ 千浦 +チウラ 地浦 +チウラ 知浦 +チエ 千江 +チエ 知恵 +チエダ 千枝 +チエン 知苑 +チオ 千尾 +チオ 地尾 +チオウ 地王 +チオカ 地岡 +チオマツ 千百松 +チオヤマ 千応山 +チオヤマ 千應山 +チカ 近 +チカ 地下 +チカ 親 +チカ 値賀 +チカ 知賀 +チガ 千賀 +チガ 値賀 +チガ 知賀 +チカアト 親跡 +チカアラシ 近嵐 +チカイ 近井 +チカイ 千貝 +チカイ 地海 +チカイ 千海 +チカイ 誓 +チガイ 千貝 +チガイ 違 +チカイケ 近池 +チカイシ 力石 +チカイシ 近石 +チカイズミ 近泉 +チガイダニ 違谷 +チガイミチ 違道 +チカウエ 近上 +チカウチ 近内 +チカウラ 近浦 +チガウラ 千賀浦 +チカエ 近江 +チカエ 近枝 +チカオ 近尾 +チカオカ 近岡 +チカカネ 近兼 +チカガネ 近兼 +チカガネ 近金 +チカガミ 周神 +チカガワ 近川 +チカガワ 近河 +チカキ 隣 +チカキ 近木 +チカキ 近記 +チカギ 近木 +チカキヨ 近清 +チカクイ 近喰 +チカグチ 近口 +チカクニ 近国 +チカクニ 近國 +チカクハラ 千覚原 +チカクラ 近倉 +チカコシ 近越 +チカゴシ 近越 +チカサ 近左 +チカサ 近佐 +チカサ 千笠 +チカサカ 近坂 +チカサカ 近阪 +チカザキ 近崎 +チガサキ 千ケ崎 +チガサキ 近崎 +チガサキ 茅ケ崎 +チガサキ 千が崎 +チカサコ 近迫 +チカサコ 近廻 +チカザコ 近迫 +チカサダ 近貞 +チカサト 親里 +チカザネ 近実 +チカサワ 近沢 +チカサワ 近澤 +チカザワ 近沢 +チカザワ 近澤 +チカシゲ 近重 +チカシタ 近下 +チカシマ 近島 +チカシマ 近嶋(近嶌) +チカジマ 近島 +チカジマ 近嶋(近嶌) +チカスエ 近末 +チカスナ 近砂 +チカズミ 近角 +チカズミ 近住 +チカセ 近勢 +チカセ 近瀬 +チカソウ 近宗 +チカソウ 近惣 +チカゾエ 近添 +チカタ 近田 +チカタ 智片 +チカタ 近多 +チカタ 地方 +チカダ 近田 +ヂガタ 地形 +チカタニ 近谷 +チカタニ 力谷 +チカダヤ 近田谷 +チカツ 千勝 +チカツ 近津 +チカヅ 近津 +チカツジ 近辻 +チカツネ 近常 +チカト 親跡 +チカトウ 近頭 +チカトシ 近俊 +チカトシ 近年 +チカトモ 近友 +チカナカ 地下中 +チカナガ 近永 +チカナガ 近長 +チカナミ 近浪 +チカナリ 近成 +チカナワ 近縄 +チカニ 近仁 +チカニシ 近西 +チガネ 千金 +チカノ 近野 +チカノ 千鹿野 +チカノブ 近信 +チカノブ 近延 +チカノリ 近乗 +チカバ 近馬 +チカバ 近葉 +チカバ 近場 +チカハシ 近橋 +チカハタ 近畑 +チカハタ 近幡 +チカバヤシ 近林 +チカハラ 千川原 +チカハラ 近原 +チガハラ 千川原 +チカヒサ 近久 +チカヒラ 近平 +チカヒロ 近広 +チカヒロ 近弘 +チカヒロ 近廣 +チカフジ 近藤 +チカベ 近部 +チカホリ 近堀 +チカマ 近間 +チカマ 近馬 +チカマ 千竃(千𥧄) +チカマ 千釜 +チカマ 千蒲 +チカマ 千竈 +チカマ 近万 +チガマ 千釜 +チガマ 千蒲 +チガマ 千竈 +ヂガマ 地釜 +チカマサ 近政 +チカマツ 近松 +チカマツ 親松 +チカマル 近丸 +チカマワリ 近廻 +チカミ 千頭 +チカミ 近見 +チカミ 千神 +チカミ 近美 +チカミ 知神 +チガミ 千頭 +チガミ 千神 +チガミ 地神 +チガミ 地上 +チガミ 千上 +チガミ 知神 +ヂガミ 地神 +ヂガミ 地紙 +チカミズ 近水 +チカミチ 近道 +チカミツ 近光 +チカミヤ 近宮 +チカムネ 近棟 +チカムネ 近宗 +チカムラ 近村 +チカモチ 近持 +チカモト 近本 +チカモト 力元 +チカモト 近祖 +チカモリ 近森 +チカモリ 近盛 +チカヤ 近谷 +チカヤス 近安 +チカヤス 近保 +チカヤマ 近山 +チカヤマ 誓山 +チカユキ 近行 +チカヨシ 近吉 +チカラ 力 +チカラ 主税 +チカラ 知加良 +チカライシ 力石 +チカラシ 近嵐 +チガラシ 近嵐 +チカラユミ 力弓 +チガリ 千苅 +チカワ 千川 +チカワ 地川 +チカワ 千河 +チガワ 千川 +チガワ 地川 +チガワラ 千川原 +チキ 地木 +チギ 千木 +チギサキ 千木崎 +チギザキ 千木崎 +チキタ 千北 +チキタ 知北 +チキタ 千喜田 +チキダ 智木田 +チギタ 千北 +チギノ 千木野 +チギホ 千木穂 +チキュウ 知久 +チキョウ 知京 +チキョウ 地京 +チギョウ 地行 +チキラ 千木良 +チキラ 千吉良 +チキラ 千喜良 +チギラ 千明 +チギラ 千木良 +チギラ 千吉良 +チギラ 千喜良 +チギラ 千装 +チギラ 千金楽 +チギラ 千輝 +チギラ 千金良 +チキリ 千切 +チキリ 知桐 +チキリ 千桐 +チキリ 榺 +チギリ 千切 +チギリ 知桐 +チギリ 契里 +チギリ 地切 +チギリ 千桐 +チギリ 知切 +チギリ 千木里 +チギリ 滕 +チキリヤ 千切谷 +チギリヤ 千切谷 +チク 知久 +チク 竹 +チク 築 +チク 竺 +チク 知工 +チグ 地倶 +チグ 地具 +チクアミ 竹網 +チクアミ 筑網 +チクアン 竹庵 +チクアン 竹菴 +チクイ 筑井 +チクイ 築井 +チクイエ 築家 +チクウチ 筑内 +チクオ 築尾 +チクオ 筑尾 +チクガワ 筑川 +チクガワ 竹川 +チクガン 巌 +チクガン 巖 +チクガン 竹巖 +チクキ 筑木 +チクキ 築木 +チクギ 筑木 +チクギ 筑城 +チクゲン 竹玄 +チクゴ 筑後 +チクゴ 竺悟 +チクゴ 築後 +チクゴウ 筑郷 +チクゴダニ 築後谷 +チクゴヤ 筑後谷 +チクサ 千種 +チクサ 千草 +チクサ 竺沙 +チクサ 千艸 +チグサ 千種 +チグサ 千草 +チクサカ 筑阪 +チクサカ 筑坂 +チクザキ 築崎 +チクザワ 築沢 +チクシ 筑紫 +チクシ 築紫 +チクシ 竹枝 +チクシ 竹志 +チクシ 竹士 +チクシ 筑子 +チクジ 築地 +チクジ 筑地 +チクシマ 築島 +チクシマ 筑島 +チクシマ 知久島 +チクジョウ 築城 +チクジョウ 竹条 +チクジョウ 竹條 +チクスイ 竹水 +チクセ 筑瀬 +チクセ 築瀬 +チクセ 竹勢 +チクゼン 筑前 +チクゼンヤ 筑前谷 +チクゼンヤ 筑前屋 +チクゾエ 築添 +チクゾノ 築園 +チクタ 築田 +チクタ 筑田 +チクダ 竹田 +チクダ 築田 +チクダ 筑田 +チクダ 知久田 +チクダ 千久田 +チクダイラ 知久平 +チクダテ 築館 +チクダテ 築舘 +チクダテ 築達 +チクタニ 築谷 +チクタニ 千久谷 +チクチ 築地 +チクチ 筑地 +チクチ 築池 +チクヂ 築地 +チクヂ 筑地 +チグチ 地口 +チグチ 千口 +チグチ 違口 +チグチ 智口 +チクチハラ 築地原 +チクツナ 竹網 +チクデ 築出 +チクテイ 竹亭 +チクド 竺土 +チクトウ 竹藤 +チクドウ 竹堂 +チクナガ 築永 +チクニ 千国 +チクニ 千國 +チクノ 築野 +チクノ 筑野 +チクバ 竹馬 +チクバ 筑波 +チクバ 筑葉 +チクハシ 築橋 +チクハナ 築花 +チクハマ 筑浜 +チクハマ 筑濱 +チクバヤシ 築林 +チクハラ 築原 +チクヒ 築樋 +チクブ 竹生 +チクボ 築保 +チクボウ 竹坊 +チクマ 竹間 +チクマ 竹馬 +チクマ 筑摩(筑广) +チクマ 筑間 +チクマ 知久馬 +チクマ 千熊 +チクマ 千久間 +チクマ 知久間 +チクマ 地久間 +チクマ 築間 +チクマ 築摩 +チクマ 築磨 +チクマ 竹万 +チクマ 竹萬 +チクマ 筑磨 +チクマル 筑丸 +チクミ 千酌 +チクムラ 筑村 +チクモト 竹本 +チクモト 築本 +チクモト 筑本 +チクモト 筑元 +チクヤマ 築山 +チクヤマ 筑山 +チクヤマ 竺山 +チクラ 地蔵 +チクラ 千倉 +チクラ 千蔵 +チクラ 地藏 +チクラ 千藏 +チクリ 地久里 +チクリ 竹裏 +チクリンジ 竹林地 +チケ 地家 +チケ 知家 +チゲ 智下 +ヂケ 地家 +ヂゲ 地下 +チケン 知見 +チケン 地見 +チゲン 地現 +チケンジ 知見寺 +チケンジ 千見寺 +チコ 地小 +ヂコ 地子 +ヂゴ 地後 +チゴイ 地後井 +チコウ 知光 +チコウ 千香 +チコウ 知公 +チコウ 地幸 +チコウ 千光 +チコウ 知幸 +チゴシ 遅越 +チゴシ 地越 +チコシマ 知古嶋 +チコシマ 知古島 +チゴジマ 千児島 +チゴタキ 千後滝 +チゴタキ 千後瀧 +チゴドウ 児堂(兒堂) +チゴノ 児野 +チゴノ 兒野 +チゴマツ 児松 +チゴヤマ 児山 +チサ 千佐 +チサイ 地斎 +チサイ 地斉 +チサイ 地齋 +チサイ 地齊 +ヂサイ 地齋 +チサカ 千坂 +チサカ 千阪 +チサカ 地阪 +チサカ 地坂 +チサカ 知坂 +チサキ 樗木 +チサキ 地崎 +チサキ 知崎 +チサキ 苣木 +チサキ 知嵜 +チサキ 地嵜 +チザキ 千崎 +チザキ 地崎 +チザキ 知崎 +ヂサキ 地崎 +チサク 地作 +チザクラ 千桜 +チザクラ 千櫻 +チサコ 地迫 +チザコ 地迫 +チサダ 苣田 +チサト 千里 +チサト 地里 +チサノ 苣野 +チサハラ 苣原 +チザワ 遅沢 +チザワ 千沢 +チザワ 遅澤 +チザワ 千澤 +チザワ 知沢 +チザワ 遲澤 +チジ 千地 +チジ 知地 +チジ 知字 +チジ 知路 +チジ 智治 +チジイシ 千々石 +チジイワ 千々岩 +チジイワ 千地岩 +チシキ 知識 +チシキ 地職 +チシキ 知敷 +チジキ 千々木 +ヂシキュウ 地子給 +チシタ 地下 +チシナ 千品 +チシバ 地柴 +チシマ 千島 +チシマ 千嶋 +チシマ 地島 +チシマ 千隝 +チシマ 千嶌 +チシマ 地嶋 +チジマツ 千々松 +チジマツ 千治松 +チシャ 智者 +チシャキ 樗木 +チシャダ 苣田 +チシュ 地主 +チシュウ 地衆 +チジュウ 地住 +チショ 地所 +チジョウ 千條 +チジョウ 千条 +チシロ 千代 +チシロ 地代 +チシロ 地白 +チシロ 千城 +ヂシロ 地白 +チジワ 千々岩 +チジワ 千々和 +チズイ 千頭井 +チスガ 千菅 +チスガ 千管 +チズカ 遅塚 +チズキ 地搗 +チズミ 千住 +チズミ 地住 +チスワ 千須和 +チズワ 千頭和 +チズワ 千須和 +チセキ 地石 +チソウ 地宗 +チゾウ 地蔵 +チゾウ 地藏 +ヂゾウ 地蔵 +ヂゾウ 地造 +ヂゾウ 地藏 +ヂゾウハラ 地蔵原 +チゾウマル 地蔵丸 +チゾエ 地添 +チソク 千足 +チタ 智多 +チタ 知多 +チダ 千田 +チダ 地田 +チダ 智田 +チダ 知田 +チダ 地多 +チダ 智多 +チダ 千多 +チダ 地夛 +チダ 稚田 +ヂダ 治田 +チダイ 地代 +チダイ 地大 +ヂダイ 地代 +チタカ 知高 +チタカ 地高 +チダカ 千高 +チダカ 地高 +チタケ 千丈 +チダチ 千舘 +チダチ 千達 +チダチ 知立 +チダテ 地舘 +チダテ 地館 +チタニ 千谷 +チタニ 地谷 +チダニ 千谷 +チダニ 智谷 +チタネ 千種 +チタマ 千玉 +チヂ 千地 +チヂ 知地 +チチイ 乳井 +チチイシ 千々石 +チチイシ 千千石 +チヂイシ 千々石 +チヂイワ 千々岩 +チヂイワ 千知岩 +チヂイワ 千地岩 +チチオ 父尾 +チチカワ 父川 +チチカワ 乳川 +チチキ 千々木 +チヂキ 千々木 +チチクボ 乳久保 +チチダ 知々田 +チチダ 父田 +チチダ 知知田 +チヂナミ 千々波 +チチネ 乳根 +チヂノ 千々野 +チチハラ 乳原 +チチブ 秩父 +チチブ 千々布 +チチブ 千々部 +チチブ 知知夫 +チヂマツ 千々松 +チヂマツ 千治松 +チヂマツ 千知松 +チヂマツ 千千松 +チヂマツ 千智松 +チヂミ 縮 +チヂムラ 千々村 +チヂヤ 千々谷 +チチリ 知地理 +チヂワ 千々岩 +チヂワ 千々和 +チヂワ 千々波 +チヂワ 千々輪 +チヂワ 千千波 +チヂワ 千千輪 +チヂワ 千千和 +チヂワ 千知波 +チヂワ 千智岩 +チヅイ 千津井 +チヅカ 遅塚 +チヅカ 千束 +チヅカ 千塚 +チヅカ 千柄 +チヅカ 千朿 +チヅカ 千抦 +チヅキ 千月 +チヅキ 地搗 +チヅキ 地附 +チヅル 千鶴 +チヅワ 千頭和 +チテマ 千手間 +チテン 地天 +チデン 千伝(千傳) +チト 地戸 +チド 知土 +チド 地土 +ヂト 地戸 +チドイ 地土井 +チトウ 千藤 +チトウ 地藤 +チトウ 千東 +チトウ 千籐 +チトウ 知藤 +チドウ 千藤 +チドウ 千東 +チドウ 知童 +ヂトウ 地頭 +ヂトウ 地藤 +ヂトウエ 地頭江 +ヂトウダイ 地頭代 +ヂトウホウ 地頭方 +チトク 地徳 +チトク 知禿 +チトク 智徳 +ヂトク 地徳 +チトセ 千歳 +チトセ 千年 +チトセ 千登勢 +チトセハラ 千年原 +チトセマル 千歳丸 +チトセヤ 千年屋 +ヂトホウ 地頭方 +チトモ 千知 +チトラ 千虎 +チドリ 千鳥 +チナ 知名 +チナイ 智内 +チナイ 地内 +チナイシ 知名石 +チナカ 地中 +ヂナカ 地中 +チナハラ 千名原 +チナボウ 地名坊 +チナミ 因 +チナミ 千波 +チナミ 千並 +チナリ 千成 +チニシ 地西 +チヌキ 千貫 +チヌシ 地主 +チヌシ 池主 +ヂヌシ 地主 +チネ 茅根 +チネ 千根 +チネン 知念 +チネン 地念 +チネン 智念 +チノ 茅野(茅埜) +チノ 千野 +チノ 知野 +チノ 地野 +チノ 智野 +チノ 血野 +チノ 千埜 +チノウ 地濃 +チノウ 知能 +チノウ 千能 +チノウエ 地の上 +チノキ 千之木 +チノシオ 地の塩 +チノタ 地野田 +チノダ 千野田 +チノダ 地野田 +チノネ 茅根 +チノネ 千野根 +チノネ 知野根 +チノネ 茅野根 +チノハラ 千野原 +チノベ 千野辺 +チノミ 知野見 +チノミ 地海 +チバ 千葉 +チバ 千羽 +チバ 千馬 +チバ 千場(千塲) +チバ 知場 +チバ 地場 +チバ 千波 +チバ 地葉 +チバ 智葉 +チバ 智者 +チバ 知葉 +チバ 千盤 +チバ 智羽 +チバイ 千葉井 +チバサキ 千葉崎 +チバザキ 千葉崎 +チバザクラ 千葉桜(千葉櫻) +チハシ 地橋 +チバシ 地橋 +チハタ 千畑 +チバタ 千畑 +チバタ 千端 +チバタ 地畑 +チバト 千葉東 +チバトウ 千葉東 +チハナ 知花 +チバナ 知花 +チバナ 地花 +チバナ 地花 +チバナ 地鼻 +チバハラ 千葉原 +チハマ 千浜 +チハマ 地浜 +チハマ 地濱 +チハマ 千濱 +チハヤ 千早 +チハヤ 千速 +チハヤ 茅早 +チバヤシ 千林 +チバヤマ 千葉山 +チハラ 千原 +チハラ 茅原 +チハラ 地原 +チハラ 知原 +チハラ 智原 +チハラ 血原 +チハラ 茆原 +チハラ 知波羅 +チバラ 地原 +チハラダ 茅原田 +チハラヤ 茅原屋 +チビキ 千引 +チビキ 千曳 +ヂビキ 地引 +ヂビキ 地曳 +ヂビキ 地曵 +ヂビキ 地挽 +ヂヒキバ 地引場 +チヒラ 知平 +チヒラ 地平 +チヒロ 千尋 +チヒロ 千広 +チヒロ 千廣 +チフ 千布 +チブ 千布 +チブ 地部 +チブ 智夫 +チブカ 乳深 +チフキ 地吹 +チフク 地福 +チフク 知福 +ヂフク 地福 +チフサ 千房 +チフネ 千船(千舩) +チブリ 千振 +チブリ 知振 +チベ 地辺 +チベ 千部 +チベ 地邊 +チベ 地邉 +チホギ 千保木 +チボシ 千星 +チホマツ 千百松 +チマ 千馬 +チマ 千間 +チマ 千万 +チマキ 地巻 +チマキ 粽 +チマキダ 粽田 +チマス 千桝 +チマス 知舛 +チマス 知桝 +チマス 知升 +チマタ 街 +チマタ 千股 +チマタ 知又 +チマチ 地町 +チマツ 千松 +チマル 千丸 +ヂマル 地丸 +チミ 知見 +チミ 千味 +チミキ 千三木 +チミチ 地道 +チムラ 千村 +チムラ 地村 +チムラ 千邑 +チムラ 知村 +チムロ 千室 +チメイ 地名 +チモト 千本 +チモト 地本 +チモト 知本 +チモト 地元 +チモト 知元 +チモト 智本 +チモト 秩本 +チモリ 千守 +チモリ 千森 +チモリ 地守 +チモリ 地森 +チモリ 茅守 +チャ 茶 +チヤ 千谷 +チヤ 千屋 +チヤ 血矢 +チヤ 千矢 +チヤ 智谷 +チャイ 茶位 +チャイ 茶井 +チャイシ 茶石 +チャイン 茶院 +チャウラ 茶浦 +チャウリ 茶売(茶賣) +チャエン 茶園 +チャエン 茶円 +チャエン 茶圓 +チャエン 茶薗 +チャエン 茶縁 +チャオカ 茶岡 +チャオキ 茶置 +チャガイト 茶垣内 +チャガワ 茶川 +チャキ 茶木 +チャキ 茶城 +チャキ 茶樹 +チャギ 茶木 +チャキダ 茶木田 +チャキタニ 茶木谷 +チャキハラ 茶木原 +チャキヒラ 茶木平 +チャギヒラ 茶木平 +チャキュウ 茶久 +チャク 着 +チャクトウ 着藤 +チャクトウ 着籐 +チャクノウ 着能 +チャクモト 着本 +チャクラ 茶倉 +チャグリ 茶栗 +チャケ 茶家 +チャコウ 茶弘 +チャザ 茶座 +チャサカ 茶坂 +チャシカワ 茶志川 +チャシマ 茶島 +チャジマ 茶島 +チャジマ 茶嶋 +チヤジョウ 知屋城 +チャジリ 茶尻 +チャシロ 茶城 +チャシン 茶新 +チヤス 千安 +チャセン 茶筌 +チャゾノ 茶園 +チャゾノ 茶薗 +チャダ 茶田 +チャタケ 茶竹 +チャタテバ 茶立場 +チャタニ 茶谷 +チャダニ 茶谷 +チャタヒラ 茶田平 +チャチ 茶地 +チャチャ 茶々 +チャチン 茶珍 +チャチン 茶珎 +チャド 茶戸 +チャトウ 茶藤 +チャトウ 茶登 +チャドウ 茶堂 +チャトコ 茶床 +チャトミ 茶富 +チャナカ 茶中 +チャナベ 茶鍋 +チャノ 茶野 +チャノ 茶埜 +チャノウ 茶納 +チャノキ 茶木 +チャノキ 茶野木 +チャノキ 茶之木 +チャノキ 茶ノ木 +チャノキ 茶の木 +チャノシタ 茶野下 +チャノハラ 茶之原 +チャノマエ 茶ノ前 +チャノマエ 茶の前 +チャノミ 茶呑 +チャバシ 茶橋 +チャバタ 茶畑 +チャバタ 茶幡 +チャバタ 茶端 +チャバタケ 茶畑 +チャバタケ 茶畠 +チャバナ 茶花 +チャバヤシ 茶林 +チャハラ 茶原 +チャバラ 茶原 +チャヒラ 茶平 +チャブネ 茶船 +チャベス 茶辺須 +チャマ 茶間 +チヤマ 地山 +チヤマ 千山 +チヤマ 知山 +チヤマ 智山 +チヤマ 痴山 +チャムラ 茶村 +チャムロ 茶室 +チャメン 茶免 +チャモト 茶本 +チャモト 茶元 +チャモリ 茶森 +チャヤ 茶谷 +チャヤ 茶屋 +チャヤガイト 茶谷垣内 +チャヤガイト 茶屋垣外 +チャヤダ 茶屋田 +チャヤノ 茶屋野 +チャヤバ 茶屋場 +チャヤバナ 茶屋鼻 +チャヤハラ 茶谷原 +チャヤハラ 茶屋原 +チャヤマ 茶山 +チャヤミチ 茶屋道 +チャヤモト 茶屋本 +チャヤモト 茶谷本 +チャヤモト 茶屋元 +チャヨシ 茶吉 +チャワラ 茶原 +チャワンヤ 茶碗谷 +チャワンヤ 茶碗野 +チュウ 忠 +チュウエ 忠恵 +チュウカ 中加 +チュウカイ 忠海 +チュウガンジ 中元寺 +チュウガンジ 中願寺 +チュウガンジ 仲元寺 +チュウガンジ 忠願寺 +チュウキョウ 中鏡 +チュウグウジ 中宮寺 +チュウクラ 中倉 +チュウグン 中郡 +チュウグン 中軍 +チュウゲンジ 中元寺 +チュウゲンジ 仲元寺 +チュウコ 中古 +チュウゴ 中後 +チュウゴウ 中郷 +チュウゴン 中言 +チュウザ 中座 +チュウザワ 忠沢 +チュウザワ 忠澤 +チュウシ 中司 +チュウジ 中司 +チュウジ 中地 +チュウシダイ 中士代 +チュウジマ 忠島 +チュウジマ 忠嶋 +チュウシャ 中社 +チュウショ 中所 +チュウジョ 中所 +チュウジョ 忠女 +チュウジョウ 中条 +チュウジョウ 中上 +チュウジョウ 中條 +チュウジョウ 中城 +チュウジョウ 仲條 +チュウジョウ 仲条 +チュウジョウ 中絛 +チュウジョウヤ 中条屋 +チュウジョウヤ 中條屋 +チュウゼンジ 中善寺 +チュウタ 忠田 +チュウダ 中田 +チュウダ 忠田 +チュウタニ 忠谷 +チュウダン 中段 +チュウテイ 忠貞 +チュウトウ 中頭 +チュウトウ 忠藤 +チュウドウ 中堂 +チュウナイ 中内 +チュウナバヤシ 仲納林 +チュウナバヤシ 中名林 +チュウノウ 中納 +チュウバ 中馬 +チュウバ 中場 +チュウバチ 中鉢 +チュウバチ 忠鉢 +チュウバチ 仲鉢 +チュウバチ 昼八 +チュウバチ 晝八 +チュウヘイシ 中瓶子 +チュウマ 中馬 +チュウマエ 中前 +チュウマン 中馬 +チュウマン 中満 +チュウマン 中万 +チュウマン 中滿 +チュウマン 中萬 +チュウミョウ 中名 +チュウメン 中面 +チュウヤ 忠谷 +チュウヤ 中夜 +チュウリキ 中力 +チュウレイ 中礼 +チュウレイ 中禮 +チュウロウ 中老 +チユキ 千行 +チヨ 千代 +チョウ 長 +チョウ 張 +チョウ 朝 +チョウ 丁 +チョウ 帳 +チョウ 頂 +チョウ 蝶 +チョウ 庁 +チョウ 徴 +チョウ 廳 +チヨウ 千陽 +チョウアイ 長合 +チョウアイ 長愛 +チョウアミ 長網 +チョウアミ 長阿弥(長阿彌) +チョウイ 長井 +チョウイ 丁井 +チョウイン 長院 +チョウエイ 長栄 +チョウエイ 長榮 +チョウカ 長賀 +チョウカ 長加 +チョウガ 長賀 +チョウカイ 鳥海 +チョウカイ 長界 +チョウカイ 畳開 +チョウガサカ 丁ケ阪 +チョウガハラ 長ケ原 +チョウカワ 長川 +チョウカワ 趙川 +チョウカン 丁官 +チョウキ 長木 +チョウギ 長木 +チョウギ 長義 +チョウギ 長儀 +チョウギ 丁義 +チョウキュウ 長久 +チョウキュウジ 長久寺 +チョウギョウジ 長行事 +チョウギョウジ 長行司 +チョウギン 丁銀 +チョウグチ 長口 +チョウケ 長家 +チョウケイ 長慶 +チョウケイジ 長慶寺 +チョウコ 長子 +チョウコ 潮湖 +チョウゴ 長後 +チョウゴウ 長合 +チョウコウジ 長興寺 +チョウサ 帖佐 +チョウサ 長佐 +チョウサ 帳佐 +チョウザ 長座 +チョウサコン 丁左近 +チョウザン 丁山 +チョウシ 丁子 +チョウシ 調子 +チョウシ 町支 +チョウシ 長子 +チョウシ 銚子 +チョウシ 蝶子 +チョウシ 調枝 +チョウジ 帖地 +チョウジ 丁子 +チョウジ 長治 +チョウジ 長路 +チョウジ 長司 +チョウジ 丁字 +チョウジ 帳地 +チョウシタニ 丁子谷 +チョウシダニ 丁子谷 +チョウシダニ 長子谷 +チョウシハラ 丁子原 +チョウジマ 長島 +チョウジャ 長者 +チョウジヤ 丁子谷 +チョウジヤ 丁字谷 +チョウジャクボ 長者久保 +チョウジャハラ 長者原 +チョウジャモリ 長者森 +チョウジュ 長寿(長壽) +チョウショ 調所 +チョウジョウ 重畳 +チョウジョウ 長条 +チョウジョウ 長條 +チョウショウイン 長松院 +チョウショウジ 長正路 +チョウシン 丁新 +チョウジン 長神 +チョウズ 長頭 +チョウズイ 長水 +チョウスケ 長助 +チョウスケザワ 長助沢(長助澤) +チョウセイ 長生 +チョウセイ 蝶勢 +チョウセイ 長静 +チョウセンジ 長泉地 +チョウゼンジ 超善寺 +チョウソ 長曽 +チョウソ 長曾 +チョウソウ 朝増 +チョウソカベ 長曽我部 +チョウソカベ 長曾我部 +チョウソカベ 長宗我部 +チョウソガベ 長曽我部 +チョウタ 長田 +チョウダ 長田 +チョウダ 町田 +チョウダ 丁田 +チョウダ 蝶多 +チョウタニ 長谷 +チョウチ 帖地 +チョウヂ 帖地 +チョウチョウ 蝶々 +チョウツカ 丁塚 +チョウヅカ 丁塚 +チョウツボ 長坪 +チョウツボ 丁坪 +チョウトウ 長東 +チョウドウ 長藤 +チョウドウ 張堂 +チョウトク 長徳 +チョウトクダニ 長徳谷 +チョウドメ 長留 +チョウドリ 蝶採 +チョウナ 長名 +チョウナイ 長内 +チョウナガ 長永 +チョウナヅカ 丁名塚 +チョウナバヤシ 蝶名林 +チョウナン 長南 +チョウヌマ 銚沼 +チョウネ 長根 +チョウノ 長野 +チョウノ 蝶野 +チョウノ 丁野 +チョウノ 長濃 +チョウノ 眺野 +チョウノウ 張能 +チョウバ 丁場 +チョウハシ 長橋 +チョウハタ 丁畑 +チョウバタ 丁畑 +チョウハマ 長浜 +チョウハマ 長濱 +チョウハラ 長原 +チョウバラ 長原 +チョウフ 長府 +チョウフク 長福 +チョウフタニ 長府谷 +チョウベタニ 長部谷 +チョウベヤ 長部谷 +チョウホウ 長宝 +チョウホウイン 長宝院 +チョウホウジ 長峰寺(長峯寺) +チョウマ 長間 +チョウマツ 長松 +チョウマツケン 長松軒 +チョウマバヤシ 蝶間林 +チョウマル 長丸 +チョウムラ 長村 +チョウムラ 丁村 +チョウメイ 長命 +チョウメイ 長明 +チョウモト 長本 +チョウモン 丁門 +チョウヤ 長谷 +チョウヤ 挺屋 +チョウヤ 蝶谷 +チョウヤマ 長山 +チョウヤマ 帳山 +チョウヨウ 長養 +チョウヨウ 長陽 +チヨウラ 千代浦 +チョウラク 長楽 +チョウラク 長樂 +チョウリ 長理 +チョウリキ 長力 +チョウリュウジ 長龍寺 +チョウロウ 長老 +チョウロク 長録 +チヨオカ 千代岡 +チヨカワ 千代川 +チヨキ 千代木 +チヨギ 千代木 +チョク 猪口 +チョクシ 勅使 +チョクシ 猪口志 +チョクシ 勅丁 +チョクシガワラ 勅使瓦 +チヨクボ 千代窪 +チヨクラ 千代倉 +チヨコリ 千代樵 +チヨサカ 千代坂 +チヨサキ 千代崎 +チヨザキ 千代崎 +チヨザワ 千代沢 +チヨザワ 千代澤 +チヨシ 天勝 +チヨシ 地吉 +チヨジマ 千代島 +チヨズミ 千代住 +チヨセ 地寄 +チヨセ 千代世 +ヂヨセ 地寄 +チヨゾノ 千代薗 +チヨゾノ 千代園 +チヨダ 千代田 +チヨタニ 千代谷 +チヨダニ 千代谷 +チヨタンダ 千代反田 +チョッキ 一寸木 +チヨヅル 千代鶴 +チヨドメ 千代留 +チヨナガ 千代永 +チヨニシオ 千代西尾 +チヨノ 千代野 +チヨノブ 千代延 +チヨノベ 千代延 +チヨハラ 千代原 +チヨフジ 千代藤 +チヨマ 千代間 +チヨマサ 千代政 +チヨマツ 千代松 +チヨマツ 千百松 +チヨマル 千代丸 +チヨムラ 千代村 +チヨモト 千代本 +チヨモリ 千代森 +チヨモリ 千代盛 +チヨヤ 千代谷 +チヨヤマ 千代山 +チラ 千良 +チラク 地樂 +チラミ 地良見 +チラン 知覧 +チリ 千里 +チリ 知里 +チリイ 縮井 +チリウチ 千里内 +チリオカ 塵岡 +チリカワ 知利川 +チリキ 知気 +チリキ 千力 +チリキリ 芥切 +チリギリ 芥切 +チリク 千里久 +チリグチ 知里口 +チリハマ 塵浜 +チリハマ 塵濱 +チリハマ 千利浜 +チリハマ 千利濱 +チリフ 池鯉鮒 +チリフジ 二十里 +チリョウ 知領 +チリョウ 地領 +チルマ 知留間 +チワ 千輪 +チワ 智和 +チワ 知和 +チワイ 知和井 +チワキ 千脇 +チワキ 知脇 +チワキ 血脇 +チワキ 地脇 +チワキ 地湧 +チワキ 智脇 +チワキ 池湧 +チワケ 血分 +チワケ 地分 +チワタ 千綿 +チワタリ 地渡 +チワヤ 千巌 +チワヤ 千巖 +チワリ 千割 +チンギョウ 珍行 +チンザイ 鎮西 +チンザイ 珍斉 +チンサカ 珍坂 +チンザカ 珍坂 +チンザン 鎮山 +チンジ 鎮寺 +チンジュ 鎮守 +チンジュ 鎭守 +チンジュ 珍珠 +チンショウ 陳暁 +チンゼイ 鎮西 +チンゼイ 鎭西 +チンゼイ 鎮静 +チンダ 珍田 +チンダ 陳田 +チンダ 鎮田 +チンダ 鎭田 +チンダイ 陳代 +チンタニ 珍谷 +チンドウ 珍道 +チンドウ 珎道 +チンナ 珍名 +チンナミ 鎮波 +チンナミ 珍並 +チンナミ 鎮浪 +チンナミ 鎭浪 +チンバラ 椿原 +チンバラ 陳原 +チンベ 珍部 +チンポウ 珎宝 +チンマ 賃馬 +チンユウ 陳祐 +ツ 津 +ツアキ 津秋 +ツアキ 都秋 +ツアキ 津穐 +ツイ 津井 +ツイ 津居 +ツイカミムラ 後神村 +ツイカワ 対川 +ツイキ 立木 +ツイキ 築城 +ツイキ 対木 +ツイキ 筑城 +ツイキ 對木 +ツイギ 筑城 +ツイコバシガワ 後小橋川 +ツイザキ 対崎 +ツイザキ 對崎 +ツイシ 津石 +ツイジ 築地 +ツイジ 筑地 +ツイシゲ 対重(對重) +ツイジハラ 築地原 +ツイシュ 堆朱 +ツイスギ 潰杉 +ツイダ 対田 +ツイダ 津井田 +ツイダ 對田 +ツイダメ 津井溜 +ツイチハラ 築地原 +ツイドウ 築道 +ツイトミムラ 後富村 +ツイドメ 津井溜 +ツイナシ 対梨 +ツイナシ 對梨 +ツイノ 対野 +ツイノ 對野 +ツイヒジ 対比地 +ツイヒジ 築比地 +ツイヒジ 筑比地 +ツイヒジ 對比地 +ツイヒジ 六十里 +ツイヒヂ 築比地 +ツイヒヂ 對比地 +ツイマジ 後真地(後眞地) +ツウエン 通円 +ツウエン 通縁 +ツウキ 通木 +ツウザキ 通崎 +ツウザン 通山 +ツウジ 通事 +ツウジ 通次 +ツウジ 通自 +ツウショウ 通正 +ツウゼン 通善 +ツウチ 津内 +ツウデン 通伝 +ツウデン 通傳 +ツウドウ 通堂 +ツウドウ 通銅 +ツウノ 通野 +ツウバ 通場 +ツウメ 津梅 +ツウメ 都楳 +ツウヤ 通谷 +ツウヤマ 通山 +ツウラ 津浦 +ツウリキ 通力 +ツエ 津江 +ツエ 津恵 +ツエ 津会 +ツエイケ 杖池 +ツエオカ 崩岡 +ツエオカ 圯岡 +ツエグチ 杖口 +ツエグチ 崩口 +ツエコ 杖子 +ツエサキ 杖崎 +ツエサキ 潰崎 +ツエサキ 杖先 +ツエザキ 杖崎 +ツエシタ 杖下 +ツエジリ 杖尻 +ツエジリ 津江尻 +ツエダ 杖田 +ツエダ 潰田 +ツエダ 津枝 +ツエダ 津江田 +ツエダ 崩田 +ツエダ 圯田 +ツエタキ 潰滝 +ツエタキ 潰瀧 +ツエタニ 杖谷 +ツエタニ 崩谷 +ツエヅキ 津江月 +ツエナカ 崩中 +ツエヌキ 杖抜 +ツエノ 津江野 +ツエノ 杖野 +ツエノウエ 杖之上 +ツエノクボ 杖野久保 +ツエハラ 杖原 +ツエハラ 潰原 +ツエムネ 杖宗 +ツエムネ 崩宗 +ツエムラ 杖村 +ツエモト 津江本 +ツエモト 杖本 +ツオ 津尾 +ヅオウ 頭応 +ツオカ 津岡 +ツオカ 通岡 +ツカ 塚 +ツカ 柄 +ツカ 津家 +ツカ 津加 +ツガ 津賀 +ツガ 栂 +ツガ 都賀 +ツガ 津加 +ツガ 都香 +ツガ 津荷 +ツカアナ 塚穴 +ツカイ 塚井 +ツガイ 番 +ツガイ 番井 +ツガイ 津貝 +ツカイエ 塚家 +ツカイシ 塚石 +ツガイヤマ 番山 +ツカウ 塚生 +ツカウエ 塚上 +ツカウチ 塚内 +ツカウネ 塚畝 +ツカウラ 塚浦 +ツカオ 塚尾 +ツカオ 束尾 +ツカオ 塚大 +ツガオ 津賀尾 +ツカオカ 塚岡 +ツカオカ 束岡 +ツガオカ 栂岡 +ツカガタ 塚形 +ツカガミ 塚上 +ツカガメ 塚亀 +ツカガワ 塚川 +ツカキ 塚木 +ツカギ 塚木 +ツカギ 庄喜 +ツガキ 津垣 +ツカギシ 塚岸 +ツカキタ 塚北 +ツカキハラ 束木原 +ツカクチ 塚口 +ツカグチ 塚口 +ツカクボ 塚窪 +ツカクラ 塚倉 +ツカゴエ 塚越 +ツカコシ 塚越 +ツカコシ 塚腰 +ツカコシ 柄越 +ツカゴシ 塚越 +ツカゴシ 塚腰 +ツカサ 政 +ツカサ 宰務 +ツカサ 司 +ツカサ 宰 +ツカサ 塚狭(塚狹) +ツカサキ 塚崎 +ツカサキ 司城 +ツカサキ 柄崎 +ツカサキ 墳崎 +ツカサキ 塚嵜 +ツカザキ 塚崎 +ツカザキ 柄崎 +ツカザキ 墳崎 +ツカザキ 塚嵜 +ツカザキ 塚埼 +ツカザキ 塚碕 +ツカザキ 束崎 +ツカサコ 塚迫 +ツカサダ 塚定 +ツカサト 塚里 +ツカサワ 塚澤 +ツカザワ 塚沢 +ツカザワ 塚澤 +ツカザン 津嘉山 +ツカジ 塚地 +ツカシタ 塚下 +ツカシタ 墳下 +ツカシタ 司下 +ツカシマ 塚島 +ツカシマ 塚嶋 +ツカジマ 塚島 +ツカセ 塚瀬 +ツカゾエ 塚副 +ツカゾノ 塚園 +ツカタ 塚田 +ツカタ 束田 +ツカタ 津堅 +ツカタ 津方 +ツカダ 塚田 +ツカダ 束田 +ツカダ 柄田 +ツカダ 津嘉田 +ツカダ 津賀田 +ツカダ 磦田 +ツカダ 津家田 +ツカダ 冢田 +ツガタ 津堅 +ツガタ 津賀田 +ツガタ 津潟 +ツガタ 都賀田 +ツカダイラ 塚平 +ツカタニ 塚谷 +ツカツキ 塚月 +ツカツキ 調月 +ツカヅキ 塚月 +ツカツネ 塚常 +ツカデ 塚出 +ツカドメ 塚留 +ツカナカ 塚中 +ツカナガ 塚永 +ツガニ 津蟹 +ツカニシ 塚西 +ツガヌマ 津賀沼 +ツカネ 塚根 +ツカネ 束 +ツガネ 津金 +ツガネ 津兼 +ツガネ 津賀根 +ツガネ 栂根 +ツガネサワ 津金沢 +ツガネサワ 津金澤 +ツガネザワ 津金沢 +ツガネザワ 津金澤 +ツカノ 塚野 +ツカノ 束野 +ツカノ 柄野 +ツガノ 栂野 +ツカノメ 塚目 +ツカノメ 柄目 +ツカノメ 塚ノ目 +ツカノメ 塚野目 +ツカバ 塚羽 +ツカバサミ 塚挟 +ツカハシ 塚橋 +ツカハタ 塚畑 +ツカハチ 塚八 +ツカハネ 塚羽 +ツカハマ 塚浜 +ツカバヤシ 塚林 +ツカハラ 塚原 +ツカハラ 束原 +ツカハラ 津ケ原 +ツカハラ 墳原 +ツカハラ 都加原 +ツカハラ 柄原 +ツガハラ 津ケ原 +ツガハラ 津賀原 +ツカヒラ 塚平 +ツカヒロ 塚広(塚廣) +ツガフネ 告船 +ツカベ 塚辺(塚邊) +ツカベ 塚部 +ツカベ 塚邉 +ツカマ 塚間 +ツガマ 津釜 +ツカマエ 塚前 +ツカマエ 束前 +ツカマサ 塚正 +ツカマス 塚升 +ツカマチ 塚町 +ツカマツ 塚松 +ツカマツ 束松 +ツカミ 塚見 +ツガミ 津上 +ツガミ 津神 +ツカミズ 塚水 +ツカムラ 塚村 +ツカムラ 束村 +ツガムラ 栂村 +ツガムラ 津賀村 +ツカメ 塚目 +ツカメ 柄目 +ツカモト 塚本 +ツカモト 塚元 +ツカモト 柄本 +ツカモト 墳本 +ツカモト 束元 +ツカモト 束本 +ツカモト 津下本 +ツカモリ 塚盛 +ツカヤ 塚谷 +ツガヤ 津ケ谷 +ツガヤス 栂安 +ツカヤマ 津嘉山 +ツカヤマ 塚山 +ツガヤマ 津賀山 +ツカヨシ 塚由 +ツガリ 津狩 +ツガル 津軽 +ツガル 津輕 +ツガルイシ 津軽石(津輕石) +ツガルヤ 津軽屋 +ツガルヤ 津軽谷 +ツカレ 津彼 +ツカワ 津川 +ツカワ 塚輪 +ツガワ 津川 +ツガワ 十川 +ツガワ 都川 +ツガワ 対川 +ツガワ 都河 +ツガワ 對川 +ツガワ 積川 +ツガワ 津河 +ヅカワ 頭川 +ヅガワ 頭川 +ツカワキ 塚脇 +ツカワキ 柄脇 +ツカワケ 塚分 +ツキ 槻 +ツキ 築 +ツキ 津木 +ツキ 月 +ツギ 津木 +ツキアイ 突合 +ツキアケ 月明 +ツキアシ 月足 +ツキアシ 月脚 +ツキアタリ 突当(突當) +ツキアテ  突当(突當) +ツキアナ 築穴 +ツキイ 月井 +ツギイ 次井 +ツキイエ 築家 +ツキイシ 月石 +ツギイシ 次石 +ツギイシ 継石 +ツキイズミ 月泉 +ツキイヤマ 築井山 +ツキイワ 月岩 +ツギイワ 継岩 +ツギウエ 椄植 +ツキウダ 月生田 +ツキウチ 月内 +ツキウミ 月海 +ツキウラ 月浦 +ツキエ 月江 +ツキオ 月尾 +ツキオ 槻尾 +ツキオカ 月岡 +ツキオカ 槻岡 +ツキオカ 築岡 +ツキオカ 月丘 +ツギオカ 継岡 +ツギオカ 次岡 +ツギオカ 継丘 +ツキオキ 突沖 +ツキオリ 月居 +ツキオリ 月折 +ツギカ 次賀 +ツギガ 次賀 +ツキガシラ 搗頭 +ツキガセ 月ケ瀬 +ツキガタ 月形 +ツキガタ 月方 +ツキカド 月門 +ツキガホラ 月ケ洞 +ツキカワ 月川 +ツキガワ 月川 +ツギカワ 次川 +ツキカワラ 槻川原 +ツキガワラ 槻川原 +ツキギ 槻木 +ツキギ 月木 +ツキギ 筑城 +ツキギ 規木 +ツギキ 次木 +ツギキ 継木 +ツギキ 接木 +ツキキザワ 槻木沢 +ツキギザワ 槻木澤 +ツキキリ 築切 +ツキグマ 月隈 +ツキコウジ 月小路 +ツキサカ 月坂 +ツキサカ 築坂 +ツキサカ 月阪 +ツキザカ 月坂 +ツキザキ 月崎 +ツキザキ 着崎 +ツキサコ 月迫 +ツキサダ 築貞 +ツキサト 月里 +ツキサワ 月沢 +ツキサワ 槻沢 +ツキサワ 月澤 +ツキサワ 槻木澤 +ツキサワ 築澤 +ツキサワ 槻澤 +ツキザワ 築沢 +ツキザワ 月沢 +ツキザワ 槻木沢 +ツキザワ 月澤 +ツキザワ 築澤 +ツキジ 築地 +ツキジ 筑地 +ツキジ 月時 +ツキジ 月地 +ツキジ 筑治 +ツキジシン 築地新 +ツキシタ 月下 +ツキジハラ 築地原 +ツキシマ 築島 +ツキシマ 月島 +ツキシマ 築嶋 +ツキシマ 月嶋 +ツキシマ 月嶹 +ツキシマ 附島 +ツキジマ 築島 +ツギシマ 次島 +ツキジョウ 月城 +ツキシロ 築城 +ツキシロ 月城 +ツキシロ 月代 +ツキズエ 月末 +ツキズミ 月澄 +ツキセ 槻瀬 +ツキセ 月瀬 +ツキゾエ 築添 +ツキタ 附田 +ツキタ 月田 +ツキタ 槻田 +ツキタ 突田 +ツキダ 附田 +ツキダ 月田 +ツキダ 築田 +ツキダ 槻田 +ツキダ 突田 +ツギタ 次田 +ツギタ 継田 +ツギタ 続田 +ツギタ 續田 +ツキタク 槻宅 +ツキタテ 築館 +ツキタテ 槻舘 +ツキタテ 築舘 +ツキダテ 月館 +ツキダテ 月舘 +ツキダテ 築館 +ツキダテ 槻舘 +ツキダテ 槻館 +ツキダテ 築舘 +ツキタニ 築谷 +ツキタニ 槻谷 +ツキタニ 月谷 +ツキタニ 月渓(月溪) +ツキダニ 築谷 +ツギタニ 次谷 +ツギタニ 継谷 +ツキタリ 月足 +ツキチ 築地 +ツキヂ 築地 +ツキヂ 筑地 +ツキヅ 月津 +ツキデ 築出 +ツキデ 月出 +ツキデ 突出 +ツキデ 附出 +ツギトミ 次富 +ツキトメ 築留 +ツキトモ 月共 +ツキナガ 月永 +ツキナガ 月長 +ツキナガ 築永 +ツキナミ 月波 +ツキナミ 月浪 +ツキナミ 槻並 +ツキナリ 月成 +ツキナワ 月縄 +ツキナワ 月繩 +ツキヌキ 築貫 +ツキヌキ 月貫 +ツキヌキ 突貫 +ツキノ 月野 +ツギノ 継野 +ツギノ 次野 +ツキノイ 月ノ井 +ツキノキ 槻木 +ツキノキ 月野木 +ツキノキ 月木 +ツキノキ 月ノ木 +ツキノキ 月退 +ツキノキ 樛木 +ツキノギ 月野木 +ツキノキサワ 槻木沢 +ツキノキサワ 槻ノ木沢(槻ノ木澤) +ツキノキサワ 槻木澤 +ツキノキザワ 槻木沢 +ツキノキザワ 槻ノ木沢 +ツキノキザワ 槻木澤 +ツキノワ 月輪 +ツキノワ 月野和 +ツキバ 月葉 +ツキハシ 月橋 +ツキハシ 槻橋 +ツキハシ 築橋 +ツギハシ 次橋 +ツギハシ 續橋 +ツキハナ 月花 +ツキハマ 月浜(月濱) +ツキバヤシ 槻林 +ツキバヤシ 月林 +ツキバヤシ 築林 +ツキハラ 月原 +ツギハラ 次原 +ツキヒ 築樋 +ツキヒジ 築比地 +ツキヒジ 筑比地 +ツギヒロ 次広 +ツギヒロ 次廣 +ツキフジ 月藤 +ツキフジ 築藤 +ツギフジ 次藤 +ツキボシ 月星 +ツキホラ 月洞 +ツキマ 槻間 +ツキマ 月間 +ツキマタ 月俣 +ツキマタ 月又 +ツキマタ 月俟 +ツキマチ 月待 +ツキマツ 月松 +ツギマツ 次松 +ツギマツ 継松 +ツキマワシ 突廻 +ツキミ 月見 +ツキミサト 月見里 +ツキミツ 月光 +ツキミネ 月峯(月峰) +ツキミヤ 月宮 +ツキムラ 月村 +ツキムラ 築村 +ツキムラ 月邨 +ツキムラ 槻村 +ツギムラ 次村 +ツキモウシ 突廻 +ツキモチ 月持 +ツキモト 月本 +ツキモト 月元 +ツキモト 築本 +ツキモト 着本 +ツキモト 槻本 +ツキモト 搗本 +ツキモト 就本 +ツギモト 次本 +ツギモト 継本 +ツギモト 次元 +ツキモリ 月森 +ツキモリ 月守 +ツキモリ 築森 +ツキモリ 月盛 +ツギモリ 次森 +ツキヤ 築谷 +ツキヤ 槻谷 +ツキヤ 附家 +ツギヤ 次屋 +ツキヤス 月安 +ツキヤマ 築山 +ツキヤマ 月山 +ツキヤマ 槻山 +ツキヤマ 筑山 +ツキヤマ 突山 +ツギヤマ 次山 +ツギヤマ 継山 +ツキユキ 月雪 +ツキョウ 津京 +ツキヨシ 月吉 +ツキヨシ 月芳 +ツキヨシ 月善 +ツキリ 月李 +ツキワ 月輪 +ツキワケ 築別 +ツク 筑 +ツク 津久 +ツク 就 +ツグ 継(繼) +ツクアナ 築穴 +ツクイ 津久井 +ツクイ 出井 +ツクイ 筑井 +ツクイ 築井 +ツクイ 佃井 +ツクイ 津久居 +ツクイ 撞井 +ツクイ 都久井 +ツクイ 搗井 +ツクイ 舂井 +ツグイ 次井 +ツグイ 津久家 +ツグイエ 次家 +ツクイチ 卓地 +ツクイヤマ 津久井山 +ツグイワ 継岩 +ツクウラ 津久浦 +ツクウラ 十九浦 +ツクウラ 津九浦 +ツクエ 机 +ツクエ 津久江 +ツグエ 津久家 +ツグエダ 継枝 +ツクエタニ 机谷 +ツクエチ 卓地 +ツクエチ 机地 +ツクエモト 机元 +ツクオ 踞尾 +ツクオ 踞屋 +ツグクニ 継国(繼國) +ツグサ 津草 +ツクシ 筑紫 +ツクシ 築紫 +ツクシ 土筆 +ツクシ 築柴 +ツクシ 筑柴 +ツクシアキ 筑紫秋 +ツクシタ 筑下 +ツクシダ 尽田(盡田) +ツクシマ 築島 +ツクシロ 築城 +ツクタ 附田 +ツクタ 営田 +ツクタ 營田 +ツクタ 營田 +ツクダ 佃 +ツクダ 作田 +ツクダ 附田 +ツクダ 築田 +ツクダ 筑田 +ツクダ 津久田 +ツクダ 突田 +ツクダ 営田 +ツクダ 佃田 +ツクダ 付田 +ツクダ 九十田 +ツクダ 紹田 +ツクダ 舂田 +ツクダ 𣇃田 +ツグタ 次田 +ツグタ 継田 +ツクダテ 築館 +ツクダテ 築舘 +ツクタニ 築谷 +ツクタニ 九十谷 +ツクタニ 筑谷 +ツクダノ 佃野 +ツクダヤ 佃屋 +ツクダヤ 佃谷 +ツグチ 津口 +ヅグチ 洞口 +ツクデ 築出 +ツクト 津久戸 +ツクド 筑土 +ツクトノ 津久登野 +ツクトノ 津久登能 +ツクナガ 突永 +ツグナガ 嗣永 +ツクナミ 突浪 +ツクニ 津国 +ツクニ 津國 +ツクネ 築根 +ツクネ 筑根 +ツクノ 築野 +ツグノ 継野 +ツクバ 筑波 +ツクバ 築波 +ツクバ 築羽 +ツクバ 津久場 +ツグハラ 次原 +ツグハラ 継原 +ツクヒジ 筑肱 +ツクヒジ 築肱 +ツクベ 築部 +ツクマ 津隈 +ツクマ 津熊 +ツクマ 筑間 +ツクマ 津久間 +ツクマ 即真 +ツクマ 津隅 +ツグマ 津隈 +ツクミ 津汲 +ツクミ 津久美 +ツクミ 九十三 +ツクミ 津久見 +ツグミ 津組 +ツグミ 鶇(鶫) +ツグミヤ 継宮 +ツグムネ 続宗 +ツグムネ 續宗 +ツクモ 九十九 +ツクモ 津雲 +ツクモ 白 +ツクモ 築茂 +ツクモ 津久茂 +ツクモ 江蒲 +ツグモ 津雲 +ツクモサワ 九十九沢 +ツクモサワ 九十九澤 +ツクモダ 九十九田 +ツクモト 築本 +ツクモト 突元 +ツクモト 踞本 +ツグモト 継本 +ツクモリ 九十九里 +ツクヤ 津久家 +ツグヤ 継谷 +ツクヤマ 筑山 +ツクヤマ 都久山 +ツクラ 都倉 +ツクラ 津倉 +ツグラ 津倉 +ツグラ 津蔵 +ツクリ 村主 +ツクリ 造 +ツクリダ 造田 +ツクリバ 造場 +ツクリミチ 作道 +ツクリミチ 造道 +ツクリヤ 造谷 +ツクリヤマ 造山 +ツクワ 筑和 +ツケ 附 +ツゲ 柘植 +ツゲ 津下 +ツゲ 告 +ツゲ 柘 +ツゲ 黄楊 +ツゲ 拓植 +ツゲ 津家 +ツゲ 津毛 +ツゲ 詫 +ツゲ 柘桂 +ツゲ 黄揚 +ツゲ 柘 +ツゲ 都解 +ツゲイ 告井 +ツゲイ 柘植井 +ツゲウエ 柘上 +ツゲウマ 告馬 +ツゲウラ 柘浦 +ツケオカ 付岡 +ツゲガミ 柘上 +ツゲガミ 告上 +ツゲカワ 告川 +ツゲカワ 柘川 +ツゲガワ 黄楊川 +ツケギ 附木 +ツゲキ 槻木 +ツゲグチ 告口 +ツゲクワ 告鍬 +ツゲサカ 告坂 +ツゲシタ 告下 +ツケシバ 附柴 +ツケシバ 附芝 +ツケシロ 付城 +ツゲセ 告瀬 +ツケダ 附田 +ツゲタ 告田 +ツゲナカ 告中 +ツケノ 附野 +ツゲノ 柘野 +ツゲノ 告野 +ツゲノ 柘植野 +ツゲハタ 告畑 +ツゲハラ 柘原 +ツゲハラ 告原 +ツゲホリ 告堀 +ツゲマ 告馬 +ツゲマツ 告松 +ツゲミ 告見 +ツゲミゾ 告溝 +ツゲミヤ 告宮 +ツゲモト 柘本 +ツゲモト 告本 +ツゲモリ 告森 +ツケヤナギ 附柳 +ツケヤネ 附屋根 +ツゲヤマ 柘山 +ツゲヤマ 告山 +ツゲヤマ 柘植山 +ツゲヨシ 告吉 +ツゲワキ 告脇 +ツケン 津堅 +ツケンジョウ 津堅門 +ツゴイ 津吾井 +ツコウ 貫 +ツゴウ 津郷 +ツゴウ 都郷 +ヅコウ 頭高 +ツコシ 津越 +ツゴシ 津越 +ツゴダ 都合田 +ツゴモリ 津籠 +ツゴモリ 津篭 +ツサ 津佐 +ツサカ 津坂 +ツサカ 津阪 +ツザカ 津坂 +ツザカ 津阪 +ツザカ 都坂 +ツサキ 津崎 +ツサキ 角崎 +ツサキ 津先 +ツサキ 津嵜 +ツザキ 津崎 +ツザキ 澤崎 +ツザキ 角崎 +ツザキ 都崎 +ツザキ 對崎 +ツザキ 津嵜 +ツザキ 都嵜 +ツサト 津里 +ツザワ 津沢 +ツザワ 津澤 +ツシ 都志 +ツシ 津司 +ツシ 津志 +ツシ 津氏 +ツジ 辻 +ツジ 逵 +ツジ 都地 +ツジ 津路 +ツジ 津地 +ツジ 津司 +ツジ 都司 +ツジ 街 +ツジ 津寺 +ツジ 津知 +ツジ 津氏 +ツジ 都子 +ツジ 都路 +ツジ 津次 +ツジ 津治 +ツジ 都治 +ヅシ 図師 +ヅシ 図司 +ヅシ 都志 +ヅシ 圖師 +ツジアイ 辻合 +ツジアラシ 辻嵐 +ツジイ 辻井 +ツジイ 逵井 +ツジイ 辻居 +ツジイエ 辻家 +ツジイケ 辻池 +ツジイシ 辻石 +ツジイチ 辻市 +ツジイデ 辻出 +ツジウエ 辻上 +ツジウジ 辻氏 +ツジウチ 辻内 +ツジウラ 辻浦 +ツジウラ 辻裏 +ツジウラ 辻占 +ツジエ 辻永 +ツジエ 辻江 +ツジエ 辻栄 +ツジエ 辻榮 +ツジエイ 辻永 +ツジエイ 辻栄 +ツシオ 対尾 +ツシオ 津塩 +ツシオ 津汐 +ツシオ 對尾 +ツジオ 辻尾 +ツジオ 辻生 +ツジオカ 辻岡 +ツジオカ 巷岡 +ツジオカ 逵岡 +ツジオク 辻奥 +ツジガイト 辻垣内 +ツジカキ 辻柿 +ツジガキ 辻垣 +ツジガキ 辻柿 +ツジガタイ 辻ケ平 +ツジカド 辻角 +ツジガドウ 辻ケ堂 +ツジカネ 辻兼 +ツジカミ 辻上 +ツジカミ 辻神 +ツジガミ 辻上 +ツジカワ 辻川 +ツジカワ 十川 +ツジカワ 辻河 +ツジガワ 辻川 +ツジキ 辻木 +ツジキタ 辻北 +ツジギワ 辻極 +ツジギワ 辻際 +ツジク 都竹 +ツジクチ 辻口 +ツジグチ 辻口 +ツジクニ 辻国 +ツジクボ 辻窪 +ツジクラ 辻倉 +ツジコ 辻子 +ツジゴウ 辻郷 +ツジコマ 辻駒 +ツジサカ 辻坂 +ツジサカ 辻阪 +ツジサキ 辻崎 +ツジザキ 辻崎 +ツジサト 辻里 +ツジサワ 辻沢 +ツジサワ 辻澤 +ツジザワ 辻沢 +ツジシタ 辻下 +ツジシバ 辻芝 +ツジシマ 辻嶋 +ツジシマ 辻島 +ツジショウ 辻生 +ツジシン 辻新 +ツジセ 辻瀬 +ツジセキ 辻関 +ツジゾノ 辻囿 +ツジゾノ 辻園 +ツシタ 津下 +ツシタ 対田 +ツシタ 都下 +ツシタ 對田 +ツシダ 津志田 +ツジタ 辻田 +ツジタ 逵田 +ツジタ 辻他 +ツジタカ 辻高 +ツジタク 辻宅 +ツジタケ 辻岳 +ツジタケ 辻武 +ツジタケ 辻竹 +ツジタニ 辻谷 +ツジツカ 辻塚 +ツジヅカ 辻塚 +ツジツグ 辻次 +ツジデ 辻出 +ツジト 辻戸 +ツジトウ 辻藤 +ツジトウ 辻東 +ツジドウ 辻堂 +ツジトミ 辻富 +ツジナカ 辻中 +ツジナカ 辻仲 +ツジナカ 逵中 +ツジナガ 辻永 +ツジナミ 辻並 +ツジニシ 辻西 +ツジネ 辻根 +ツジノ 辻野 +ツジノ 辻埜 +ツジノ 辻ノ +ツジノウエ 辻之上 +ツジノウエ 辻ノ上 +ツジノウチ 辻ノ内 +ツジノウチ 辻之内 +ツジノウチ 辻の内 +ツジノショ 辻之所 +ツジノモト 辻野本 +ツジハシ 辻橋 +ツジハタ 辻畑 +ツジハタ 辻端 +ツジハタ 辻畠 +ツジバタ 辻端 +ツジハナ 辻花 +ツジハナ 辻鼻 +ツジハナ 辻葩 +ツジハマ 辻浜 +ツジハマ 辻濱 +ツジバヤシ 辻林 +ツジハラ 辻原 +ツジハラ 逵原 +ツジヒガシ 辻東 +ツジヒサ 辻久 +ツジヒラ 辻平 +ツジヒロ 辻広 +ツジヒロ 辻廣 +ツジフチ 辻渕 +ツジブチ 辻淵 +ツジブチ 辻渕 +ツジベ 辻部 +ツジベ 辻邊(辻辺) +ツジベ 辻邉 +ツジボウ 辻坊 +ツジボリ 辻堀 +ツシマ 対馬 +ツシマ 津島 +ツシマ 津嶋 +ツシマ 對馬 +ツシマ 対島(対嶋) +ツシマ 対間 +ツシマ 都島(都嶋) +ツシマ 津嶌 +ツシマ 對間 +ツシマ 對島 +ツシマ 津洲 +ツシマ 對嶋 +ツジマ 辻間 +ツジマ 辻満 +ツジマエ 辻前 +ツジマキ 辻巻 +ツジマタ 辻又 +ツジマツ 辻松 +ツジマル 辻丸 +ツシミ 都志見 +ツジミ 辻見 +ツジミチ 辻道 +ツジムネ 辻宗 +ツシムラ 対村 +ツジムラ 辻村 +ツジムラ 逵村 +ツジムラ 辻邑 +ツジムラ 辻邨 +ツシモト 対本 +ツシモト 津志本 +ツジモト 辻本 +ツジモト 辻元 +ツジモト 逵本 +ツジモリ 辻森 +ツジモリ 辻盛 +ツジヤ 辻谷 +ツジヤ 辻屋 +ツジヤ 辻家 +ツジヤマ 辻山 +ツジョウ 津城 +ツジヨコ 辻横 +ツジヨネ 辻米 +ツシロ 津城 +ツシロ 津代 +ツジワキ 辻脇 +ツジワケ 辻分 +ツス 津須 +ツスエ 津末 +ツズエ 津末 +ツズキ 都筑 +ツズキ 筑木 +ツズキハシ 続橋 +ツズラ 廿楽 +ツズラハラ 黒葛原 +ツセ 津瀬 +ツセ 津勢 +ツゾメ 都染 +ツタ 津田 +ツタ 蔦 +ツタ 津多 +ツタ 蘿 +ツダ 津田 +ツダ 都田 +ツダ 津多 +ツタイ 蔦井 +ツタイ 伝井 +ツタイ 津田井 +ツタイ 傳井 +ツタイシ 伝石 +ツタイシ 傳石(傅石) +ツタイチ 蔦市 +ツタウラ 蔦浦 +ツタエ 伝 +ツタエ 傳 +ツタエ 蔦江 +ツタエ 傅 +ツタエ 伝江(傳江) +ツタエダ 傳田 +ツタオ 蔦尾 +ツタオカ 蔦岡 +ツタカ 津高 +ツダカ 津高 +ツダカ 津田賀 +ツダカ 都高 +ツタガキ 蔦垣 +ツタカベ 蔦壁 +ツタガヤ 蔦ケ谷 +ツタカワ 蔦川 +ツタガワ 蔦川 +ツタガワ 伝川 +ツタガワ 傅川 +ツタガワ 傳川 +ツダガワ 津田川 +ツタキ 蔦木 +ツタキ 津滝 +ツタキ 津瀧 +ツタギ 蔦木 +ツタグチ 蔦口 +ツタケ 都竹 +ツタケ 津武 +ツタザワ 蔦沢 +ツタザワ 蔦澤 +ツタシマ 蔦島 +ツタジマ 蔦島 +ツタジマ 蔦嶋 +ツタダ 蔦田 +ツタタニ 蔦谷 +ツタダニ 蔦谷 +ツダタニ 津田谷 +ツダチ 津立 +ツタナカ 蔦中 +ツタナガ 蔦永 +ツタニ 津谷 +ツタニ 蔦谷 +ツタニ 都谷 +ツダニ 津谷 +ツダニ 都谷 +ツタノ 蔦野 +ツダノ 津田野 +ツタバ 津田葉 +ツタハマ 蔦浜(蔦濱) +ツタバヤシ 蔦林 +ツタハラ 蔦原 +ツタフジ 伝藤 +ツタホ 蔦保 +ツダマ 津玉 +ツタマキ 蔦巻 +ツタミ 津民 +ツタミ 蔦見 +ツタムネ 蔦宗 +ツタムラ 蔦村 +ツタムラ 伝村 +ツタムラ 傳村 +ツタモト 蔦本 +ツタモリ 蔦森 +ツタヤ 蔦谷 +ツタヤ 伝谷 +ツタヤ 蔦屋 +ツタヤ 津田谷 +ツタヤ 傳谷 +ツタヤマ 蔦山 +ツタヨシ 蔦芳 +ツタワ 津田和 +ツダワ 津田和 +ツチ 津地 +ツチ 土 +ツチ 槌 +ツチ 津知 +ツヂ 辻 +ツヂ 都地 +ツヂ 津地 +ツチアイ 土合 +ツヂアイ 辻合 +ツチアカ 土赤 +ツチアキ 土明 +ツチアナ 土穴 +ツチイ 土井 +ツチイ 土居 +ツチイ 槌井 +ツチイ 槌居 +ツチイエ 槌家 +ツチイケ 土池 +ツチイズ 土井豆 +ツチイチ 槌市 +ツチイヅ 土射津 +ツチイデ 土出 +ツチイリ 槌入 +ツチイワ 土岩 +ツチウキ 土浮 +ツチウチ 土内 +ツチウラ 土浦 +ツチエ 土江 +ツチエ 土工 +ツチエ 槌江 +ツチオ 土尾 +ツチオ 槌尾 +ツチオカ 土岡 +ツチオカ 槌岡 +ツチガ 槌賀 +ツチガ 土賀 +ツチガウチ 土ケ内 +ツチカゼ 土風 +ツチカタ 土形 +ツチガテ 土ケ手 +ツチカド 土門 +ツチカド 土角 +ツチカネ 土金 +ツチガネ 土金 +ツチガハタ 土ケ端 +ツチカベ 土壁 +ツチカマ 土釜 +ツチガマ 土釜 +ツチガミ 土上 +ツチカメ 土亀 +ツチガメ 土亀 +ツチカワ 土川 +ツチカワ 土河 +ツチカワ 槌川 +ツチキ 土木 +ツチキ 槌木 +ツチキリ 土切 +ツヂク 都竹 +ツチクイ 土喰 +ツチクサ 土草 +ツチグチ 土口 +ツチクボ 土窪 +ツチクラ 土倉 +ツチクラ 地蔵 +ツチクラ 土蔵 +ツチクラ 土藏 +ツチグルマ 土車 +ツチクレ 土喰 +ツチグロ 土黒 +ツチクワ 土桑 +ツチコ 土子 +ツチコ 土古 +ツチサカ 土坂 +ツチサカ 土阪 +ツチサキ 土崎 +ツチサキ 土先 +ツチザキ 土崎 +ツチザキ 槌崎 +ツチサク 土作 +ツチサワ 土沢 +ツチサワ 土澤 +ツチザワ 土沢 +ツチザワ 土澤 +ツチジ 土次 +ツチシオ 土塩 +ツチシタ 土下 +ツチシマ 土島 +ツチシマ 土嶋 +ツチジマ 土島 +ツチジマ 土嶋 +ツチシミズ 土清水 +ツチシロ 土代 +ツチセト 土瀬戸 +ツチタ 土田 +ツチダ 土田 +ツチダ 槌田 +ツチダ 追田 +ツチダ 土多 +ツチダ 津知田 +ツチダ 槌多 +ツチダ 鎚田 +ツヂタ 辻田 +ツチタカ 土高 +ツチダテ 土館 +ツチダテ 土舘 +ツチタナ 土棚 +ツチダナ 土棚 +ツチタニ 土谷 +ツチタニ 槌谷 +ツチダネ 土田子 +ツチヅカ 土塚 +ツチデ 土手 +ツチデ 土出 +ツチト 土戸 +ツチド 土戸 +ツチトイ 土樋 +ツチドイ 土樋 +ツチドウ 土堂 +ツチトコ 土床 +ツチトミ 土富 +ツチドメ 土留 +ツチトリ 土取 +ツチトリバ 土取場 +ツチナイ 土内 +ツチナカ 土中 +ツチナガ 土永 +ツチナガ 槌永 +ツチナガ 土長 +ツチナリ 土成 +ツチニシ 槌西 +ツチノ 土野 +ツチノ 槌野 +ツチノウ 槌納 +ツチノエイ 戊亥 +ツチノベ 土辺 +ツチバ 土場 +ツチハシ 土橋 +ツチハシ 槌橋 +ツチバシ 土橋 +ツチハタ 土畑 +ツチハタ 土端 +ツチハナ 土花 +ツチハマ 土浜 +ツチハマ 土濱 +ツチバヤシ 土林 +ツチバヤシ 槌林 +ツチハラ 土原 +ツチハラ 槌原 +ツチヒサ 土久 +ツチヒラ 土平 +ツチヒロ 土広 +ツチヒロ 槌広 +ツチヒロ 槌廣 +ツチヒロ 土弘 +ツチヒロ 土廣 +ツチフジ 土藤 +ツチブシ 土伏 +ツチブチ 土渕 +ツチブチ 土淵 +ツチベ 土辺(土邊) +ツチホ 土保 +ツチボラ 土洞 +ツチホリ 土堀 +ツチマ 槌間 +ツチマツ 土松 +ツチマル 土丸 +ツチマルヤ 土丸谷 +ツチミ 土見 +ツチミカド 土御門 +ツチミチ 槌道 +ツチミチ 土道 +ツチミネ 土嶺 +ツチムネ 土棟 +ツチムラ 土村 +ツヂムラ 辻村 +ツチムロ 土室 +ツチモチ 土持 +ツチモト 土本 +ツチモト 槌本 +ツチモト 土元 +ツチモト 椎本 +ツチモト 土基 +ツチモト 土許 +ツチモリ 土森 +ツチモリ 土守 +ツチヤ 土屋 +ツチヤ 土谷 +ツチヤ 槌谷 +ツチヤ 槌屋 +ツチヤ 土家 +ツチヤ 槌矢 +ツチヤ 挺屋 +ツチヤ 土矢 +ツチヤ 槌家 +ツチヤ 鎚谷 +ツチヤ 土也 +ツチヤ 土椰 +ツチヤ 二十八 +ツチヤ 梃屋 +ヅチヤ 槌谷 +ツチヤガイト 土屋垣内 +ツチヤス 土保 +ツチヤマ 土山 +ツチヤマ 槌山 +ツチヨセ 土寄 +ツチワキ 土脇 +ツチワタ 土綿 +ツチワタリ 土渡 +ツツ 筒 +ツツ 津々 +ツツイ 筒井 +ツツイ 筒居 +ツツイ 堤井 +ツツイ 躑井 +ツツイ 筒猪 +ツツイ 筒威 +ツツイケ 津々池 +ツヅイケ 続池(續池) +ツヅイケ 津々池 +ツツイシ 筒石 +ツツイズミ 筒泉 +ツツウマ 筒馬 +ツツウラ 筒浦 +ツツウラ 津々浦 +ツヅウラ 廿浦 +ツヅウラ 十九浦 +ツツエ 筒江 +ツツオ 筒尾 +ツヅオ 続麻(續麻) +ツヅオ 十九百 +ツヅカ 津々日 +ツヅカ 津塚 +ツヅガハラ 黒葛原 +ツツカワ 筒川 +ツツキ 都築 +ツツキ 都筑 +ツツキ 筒木 +ツツキ 津々木 +ツヅキ 都築 +ツヅキ 仲 +ツヅキ 都筑 +ツヅキ 続木 +ツヅキ 都竹 +ツヅキ 続 +ツヅキ 津々木 +ツヅキ 筑木 +ツヅキ 都々木 +ツヅキ 續 +ツヅキ 續木 +ツヅキ 綴木 +ツヅキ 綴喜 +ツヅキ 辻築 +ツヅキ 都築木 +ツヅキイシ 続石 +ツヅキイシ 續石 +ツヅキダ 続田 +ツヅキダ 續田 +ツヅキタニ 続谷 +ツヅキダニ 続谷 +ツヅキダニ 續谷 +ツヅキハシ 続橋 +ツヅキハシ 續橋 +ツヅキハシ 綴橋 +ツヅキバシ 続橋 +ツヅキバシ 續橋 +ツヅキヤ 続谷 +ツヅキヤマ 続山 +ツヅキヤマ 續山 +ツヅク 都築 +ツヅク 都筑 +ツヅク 都竹 +ツヅク 続 +ツヅク 續 +ツヅク 続葛 +ツヅクイシ 続石 +ツヅクイシ 續石 +ツヅクシ 続子(續子) +ツツグチ 筒口 +ツツゴウ 筒香 +ツツサキ 筒崎 +ツツザキ 筒崎 +ツツザワ 筒沢 +ツツザワ 筒澤 +ツツジ 筒治 +ツツジ 津辻 +ツツジ 躑躅 +ツツジ 津々治 +ツツジ 筒路 +ツツシオ 筒塩 +ツツジオ 都々地尾 +ツツシマ 筒島 +ツツシマ 筒嶋 +ツツジモリ 躑躅森 +ツツダ 筒田 +ツツタケ 筒竹 +ツツタニ 津々谷 +ツツドリ 筒鳥 +ツツヌキ 筒貫 +ツツノ 筒野 +ツヅノ 都野 +ツヅノ 廿野 +ツヅノ 津々野 +ツヅノ 都々野 +ツヅノ 野 +ツツバ 筒場 +ツツハラ 筒原 +ツヅハラ 黒葛原 +ツツブチ 筒渕 +ツツブチ 筒淵 +ツツマエ 筒前 +ツツマル 筒丸 +ツツミ 堤 +ツツミ 塘 +ツツミ 提 +ツツミ 津々見 +ツツミ 鼓 +ツツミ 隄 +ツツミ 筒見 +ツツミ 筒泉 +ツツミ 包 +ツツミ 津々美 +ツツミ 堤見 +ツツミ 津積 +ツツミ 筒美 +ツヅミ 鼓 +ツヅミ 皷 +ツヅミ 都積 +ツツミウチ 堤内 +ツツミガミ 堤上 +ツツミカワ 堤川 +ツツミガワ 堤側 +ツヅミカワ 鼓川 +ツツミグチ 堤口 +ツツミコシ 堤腰 +ツツミゴシ 堤腰 +ツツミサカ 堤坂 +ツツミザキ 堤崎 +ツツミザワ 堤沢 +ツツミシタ 堤下 +ツツミショウ 堤荘 +ツツミジリ 堤尻 +ツツミズ 筒水 +ツツミゾエ 堤添 +ツツミダ 堤田 +ツツミダ 鼓田(皷田) +ツヅミダ 鞁田 +ツヅミダ 鼓田(皷田) +ツツミタケ 堤竹 +ツツミタニ 堤谷 +ツツミダニ 堤谷 +ツヅミタニ 皷谷 +ツツミナイ 堤内 +ツツミナカ 堤中 +ツツミノ 堤野 +ツツミノ 堤之 +ツツミノ 提野 +ツヅミノ 鼓野 +ツヅミノ 皷野 +ツツミノウチ 堤ノ内 +ツツミバタ 堤端 +ツツミハナ 堤花 +ツツミバヤシ 堤林 +ツツミハラ 堤原 +ツツミマチ 堤町 +ツツミモト 堤本 +ツツミヤ 堤谷 +ツツミヤマ 包山 +ツツミヤマ 堤山 +ツツモト 筒本 +ツツヤ 筒屋 +ツツヤ 筒谷 +ツツヤマ 筒山 +ツヅヤマ 葛山 +ツツラ 津々良 +ツヅラ 廿楽 +ツヅラ 黒葛 +ツヅラ 葛篭 +ツヅラ 葛籠 +ツヅラ 津々良 +ツヅラ 甘楽 +ツヅラ 津々楽(津々樂) +ツヅラ 廿樂 +ツヅラ 葛龍 +ツヅラガワ 黒葛川 +ツヅラヌキ 葛貫 +ツヅラヌキ 葛籠貫 +ツヅラヌキ 葛篭貫 +ツヅラヌキ 葛籠抜 +ツヅラノ 黒葛野 +ツヅラハラ 黒葛原 +ツヅラバラ 黒葛原 +ツヅラヒラ 黒葛平 +ツヅラヤマ 葛篭山(葛籠山) +ツヅリ 綴 +ツヅリキ 綴木 +ツヅリギ 綴木 +ツヅルキ 綴木 +ツヅルキ 綴喜 +ツヅルギ 綴木 +ツヅレギ 綴木 +ツツロ 津々路 +ツヅロ 津々路 +ツデ 都出 +ツデ 津出 +ツテヒラ 土会平 +ツデラ 津寺 +ツト 津戸 +ツト 津門 +ツド 津戸 +ツトウ 伝 +ツトウ 津藤 +ツトウ 傳 +ツドウ 津藤 +ツドウ 都藤 +ツドオリ 都通 +ツドコロ 都所 +ツトミ 都富 +ツトミ 津富 +ツトミ 都冨 +ツドミ 都富 +ツトム 勉 +ツトメ 津留 +ツドメ 津留 +ツドメ 津止 +ツトヤマ 苞山 +ツトリバ 津取場 +ツナ 綱 +ツナ 津名 +ツナイ 綱井 +ツナイグチ 津内口 +ツナウチ 綱内 +ツナウマ 縄馬 +ツナオ 綱尾 +ツナオカ 綱岡 +ツナカ 津中 +ツナガ 津永 +ツナガ 津長 +ツナカケ 綱掛 +ツナカゲ 綱影 +ツナカネ 綱兼 +ツナカミ 綱上 +ツナカワ 綱川 +ツナカワ 綱河 +ツナガワ 綱川 +ツナガワ 綱河 +ツナキ 綱木 +ツナキ 津奈木 +ツナギ 綱木 +ツナギ 繋 +ツナギ 津奈木 +ツナギ 緤 +ツナギウマ 繋馬 +ツナギシ 綱岸 +ツナキリ 綱切 +ツナギリ 綱切 +ツナサキ 綱崎 +ツナザキ 綱崎 +ツナサワ 綱沢 +ツナサワ 綱澤 +ツナザワ 綱沢 +ツナザワ 綱澤 +ツナシタ 綱下 +ツナシマ 綱島 +ツナシマ 綱嶋(綱嶌) +ツナジマ 綱島 +ツナジマ 綱嶋(綱嶌) +ツナセ 綱瀬 +ツナタ 綱田 +ツナダ 綱田 +ツナダ 津灘 +ツナタニ 綱谷 +ツナデ 綱手 +ツナデ 綱出 +ツナドウ 綱頭 +ツナトリ 綱取 +ツナナカ 綱中 +ツナナガ 綱永 +ツナノ 綱野 +ツナバ 綱場 +ツナビキ 綱引 +ツナフジ 綱藤 +ツナブチ 綱渕 +ツナブチ 綱淵 +ツナミ 角南 +ツナミ 津波 +ツナミ 津浪 +ツナミ 都並 +ツナミヤ 綱宮 +ツナムラ 綱村 +ツナメ 綱目 +ツナモト 綱本 +ツナモト 綱元 +ツナモリ 綱森 +ツナヤ 綱谷 +ツナヤ 綱屋 +ツナヤマ 綱山 +ツナリ 津成 +ツナワキ 綱脇 +ツナワキ 綱分 +ツナワケ 綱分 +ツヌキ 津貫 +ツネ 常 +ツネ 津根 +ツネ 恒 +ツネアキ 経明 +ツネアキ 常秋 +ツネイ 常井 +ツネイシ 恒石 +ツネイシ 常石 +ツネイシ 経石 +ツネイズミ 常泉 +ツネイタ 常板 +ツネウチ 常内 +ツネウラ 常浦 +ツネエダ 常枝 +ツネオ 常尾 +ツネオカ 常岡 +ツネオカ 恒岡 +ツネカ 津祢鹿 +ツネカ 津根鹿 +ツネカ 津禰鹿 +ツネカ 津弥鹿 +ツネカ 津稱鹿 +ツネガ 常賀 +ツネガ 恒賀 +ツネカゲ 常陰(常隂) +ツネカズ 常数 +ツネカド 常門 +ツネカネ 常包 +ツネカネ 常兼 +ツネカワ 恒川 +ツネカワ 常川 +ツネカワ 恒河 +ツネキ 常木 +ツネキ 恒木 +ツネキ 常喜 +ツネキ 常城 +ツネキ 恒枝 +ツネギ 常木 +ツネギ 恒木 +ツネギ 恒儀 +ツネキヨ 常清 +ツネクニ 常国 +ツネクニ 常國 +ツネクニ 恒国(恒國) +ツネクニ 経国 +ツネサキ 恒崎 +ツネザキ 恒崎 +ツネザキ 常崎 +ツネサダ 常定 +ツネサダ 常貞 +ツネザワ 経沢 +ツネザワ 常沢 +ツネザワ 常澤 +ツネザワ 経澤 +ツネザワ 經澤 +ツネシカ 津根鹿 +ツネシゲ 常重 +ツネシタ 常下 +ツネシマ 常島 +ツネシロ 常城 +ツネスエ 恒末 +ツネスエ 常末 +ツネズカ 常塚 +ツネズネ 常恒 +ツネスミ 常住 +ツネスミ 常澄 +ツネズミ 常住 +ツネズミ 恒住 +ツネズミ 常角 +ツネズミ 常澄 +ツネタ 常田 +ツネタ 経田(經田) +ツネタ 恒田 +ツネダ 常田 +ツネダ 経田(經田) +ツネダ 恒田 +ツネダ 常多 +ツネタカ 常高 +ツネタカ 経隆 +ツネタケ 常武 +ツネタニ 常谷 +ツネタニ 経谷 +ツネヅカ 経塚 +ツネヅカ 常塚 +ツネツグ 恒次 +ツネツグ 常次 +ツネヅネ 常恒 +ツネト 常戸 +ツネトウ 常藤 +ツネトウ 恒藤 +ツネトウ 恒任 +ツネトウ 恒籐 +ツネトウ 経遠(經遠) +ツネトオ 経遠(經遠) +ツネトオ 恒遠 +ツネトク 常徳 +ツネトシ 常俊 +ツネトミ 常富 +ツネトミ 恒冨 +ツネトミ 常冨 +ツネトミ 恒富 +ツネドミ 常富 +ツネドミ 恒冨 +ツネドミ 常冨 +ツネドミ 恒富 +ツネトモ 常友 +ツネトモ 恒友 +ツネナガ 常永 +ツネナガ 常長 +ツネナガ 恒永 +ツネナガ 恒良 +ツネナリ 恒成 +ツネナリ 常成 +ツネニシ 常西 +ツネノ 常野 +ツネノキ 常軒 +ツネノブ 常信 +ツネハシ 常橋 +ツネハタ 常畑 +ツネバヤシ 常林 +ツネハラ 常原 +ツネハラ 恒原 +ツネヒサ 常久 +ツネヒサ 恒久 +ツネヒラ 常平 +ツネヒロ 常広 +ツネヒロ 経広 +ツネヒロ 常廣 +ツネヒロ 恒広 +ツネヒロ 常弘 +ツネヒロ 経廣 +ツネヒロ 恒弘 +ツネヒロ 恒廣 +ツネヒロ 毎広 +ツネヒロ 經廣 +ツネフカ 常深 +ツネフジ 常藤 +ツネフジ 恒藤 +ツネマサ 常政 +ツネマス 常増 +ツネマス 恒益 +ツネマス 常倍 +ツネマチ 常間地 +ツネマツ 常松 +ツネマツ 恒松 +ツネマル 常丸 +ツネミ 常見 +ツネミ 常深 +ツネミ 恒見 +ツネミ 常味 +ツネミ 常察 +ツネミチ 常道 +ツネミツ 常光 +ツネミツ 恒光 +ツネミネ 常峰 +ツネミネ 常峯 +ツネミヤ 恒宮 +ツネミヤ 常宮 +ツネムネ 常宗 +ツネムラ 常村 +ツネムラ 恒村 +ツネメ 経女 +ツネモチ 常持 +ツネモト 常本 +ツネモト 恒本 +ツネモト 恒元 +ツネモト 経本 +ツネモト 常元 +ツネモリ 常森 +ツネモリ 常守 +ツネモリ 恒森 +ツネモリ 恒盛 +ツネモリ 常盛 +ツネモリ 経森 +ツネモリ 経盛 +ツネヤ 常谷 +ツネヤ 恒屋 +ツネヤ 恒谷 +ツネヤ 恒矢 +ツネヤス 常安 +ツネヤス 恒安 +ツネヤマ 常山 +ツネヤマ 法山 +ツネヤマ 経山 +ツネユキ 常行 +ツネユキ 恒行 +ツネユキ 常雪 +ツネヨシ 恒吉 +ツネヨシ 常吉 +ツネヨシ 常賀 +ツネヨシ 常好 +ツネワキ 常脇 +ツノ 角 +ツノ 津野 +ツノ 都野 +ツノ 築野 +ツノ 都濃 +ツノ 津埜 +ツノイ 角井 +ツノイ 津ノ井 +ツノイ 都野井 +ツノイ 募井 +ツノイケ 角池 +ツノイシ 角石 +ツノウ 都能 +ツノウ 津能 +ツノウエ 角上 +ツノウチ 角内 +ツノウラ 角浦 +ツノウラ 津之浦 +ツノウラ 津ノ浦 +ツノエ 津江 +ツノエ 津之江 +ツノオ 角尾 +ツノオ 津野尾 +ツノオカ 角岡 +ツノオキ 角沖 +ツノオリ 角折 +ツノカ 角鹿 +ツノガ 角鹿 +ツノカイ 角皆 +ツノガイ 角皆 +ツノガイ 角替 +ツノガイ 角貝 +ツノカエ 角替 +ツノガエ 角替 +ツノガキ 角垣 +ツノカケ 角掛 +ツノガケ 角掛 +ツノカネ 角金 +ツノガネ 角金 +ツノカミ 角上 +ツノカミ 角守 +ツノガミ 角上 +ツノガヤ 角ケ谷 +ツノカワ 角川 +ツノガワ 角川 +ツノキ 角木 +ツノクニ 津国 +ツノクニ 津國 +ツノクニ 角国 +ツノクニ 津ノ国 +ツノクニ 津の国 +ツノクニ 津ノ國 +ツノクニヤ 都野國屋(都野国屋) +ツノクマ 津隈 +ツノクマ 角熊 +ツノクマ 津野熊 +ツノゴウ 津之郷 +ツノサカ 角坂 +ツノサキ 津ノ崎 +ツノザキ 角崎 +ツノザキ 津野崎 +ツノザワ 角沢 +ツノザワ 角澤 +ツノジ 角地 +ツノジ 津野地 +ツノジ 津之地 +ツノシタ 津之下 +ツノシマ 津野島 +ツノスエ 津末 +ツノセ 角瀬 +ツノセ 津野瀬 +ツノセ 都野瀬 +ツノタ 角田 +ツノダ 角田 +ツノダ 津野田 +ツノダ 都野田 +ツノダ 津ノ田 +ツノダ 津之田 +ツノダ 田 +ツノタケ 角竹 +ツノタニ 角谷 +ツノチ 津之地 +ツノチ 津ノ地 +ツノヂ 角地 +ツノヂ 津之地 +ツノツ 角津 +ツノヅ 角津 +ツノナミ 角波 +ツノニシ 角西 +ツノハズ 角筈 +ツノハラ 角原 +ツノブチ 角渕 +ツノブチ 角淵 +ツノフリ 角振 +ツノベ 津野辺(津野邉) +ツノベ 津野邊 +ツノマキ 角巻 +ツノマチ 角町 +ツノミ 津野見 +ツノミ 津野美 +ツノミヤ 角宮 +ツノミヤ 都宮 +ツノムラ 角村 +ツノムラ 角邑 +ツノモト 角本 +ツノモリ 角森 +ツノモリ 角守 +ツノモリ 都野守 +ツノモリ 津野森 +ツノモリ 都野森 +ツノヤ 角谷 +ツノヤマ 角山 +ツノリ 津乗 +ツノリ 津乘 +ツハ 津波 +ツハ 津覇 +ツハ 津羽 +ツバ 津波 +ツバ 津覇 +ツバ 鍔 +ツバ 津羽 +ツバ 津場 +ツバ 津庭 +ツバ 津葉 +ツバイ 椿井 +ツバイ 津梅 +ツバイ 鍔井 +ツバイ 都梅 +ツバイ 津葉井 +ツバイ 椿居 +ツバイ 椿紅 +ツハギ 津萩 +ツバキ 椿 +ツバキ 鍔木 +ツバキ 津葉木 +ツバキ 椿木 +ツバキウチ 椿内 +ツバキオ 椿尾 +ツバキガイト 椿垣内 +ツバキガワ 椿川 +ツバキクラ 椿倉 +ツバキサカ 椿坂 +ツバキサカ 椿阪 +ツバキザカ 椿坂 +ツバキザカ 椿阪 +ツバキザキ 椿崎 +ツバキサワ 椿沢 +ツバキザワ 椿沢 +ツバキザワ 椿澤 +ツバキジ 椿地 +ツバキシタ 椿下 +ツバキスギ 椿杉 +ツバキタ 椿田 +ツバキダ 椿田 +ツバキダテ 椿館 +ツバキタニ 椿谷 +ツバキダニ 椿谷 +ツバキド 椿土 +ツバキノ 椿野 +ツバキハラ 椿原 +ツバキマツ 椿松 +ツバキモト 椿本 +ツバキモト 椿元 +ツバキモリ 椿森 +ツバキヤ 椿谷 +ツバキヤ 椿屋 +ツバキヤマ 椿山 +ツバキワケ 椿分 +ツバクラ 津波倉 +ツバクロショウジ 燕昇司 +ツハコ 津波古 +ツバサ 翅 +ツバサカ 椿坂 +ツバサカ 鍔坂 +ツハシ 津橋 +ツハタ 津幡 +ツハタ 津端 +ツハタ 津畑 +ツハタ 津秦 +ツバタ 津幡 +ツバタ 津端 +ツバタ 津畑 +ツバタ 鍔田 +ツバタ 津羽田 +ツバタニ 燕谷 +ツハナ 津花 +ツバナ 津花 +ツバネ 椿根 +ツバハラ 椿原 +ツバハラ 鍔原 +ツハマ 津浜 +ツハマ 津濱 +ツバメ 燕 +ツバモト 椿本 +ツバモト 鍔本 +ツバモト 津葉本 +ツバヤ 鍔屋 +ツバヤ 鍔谷 +ツバヤシ 津林 +ツバヤマ 鍔山 +ツバヤマ 津場山 +ツハラ 津原 +ツハリ 津張 +ツバリ 津張 +ツバル 津原 +ツヒラ 津平 +ツビラ 津平 +ツブ 津武 +ツブキ 津吹 +ツブキ 粒木 +ツフク 津布久 +ツフク 津福 +ツブク 津布久 +ツブク 津吹 +ツブク 津布工 +ツブク 津福 +ツフコ 津府子 +ツブコ 津布子 +ツブコ 津府子 +ツブサ 津房 +ツブサ 具 +ツブサキ 粒崎 +ツブタ 粒田 +ツブタキ 潰滝 +ツブタキ 潰瀧 +ツブタニ 粒谷 +ツブチ 津渕 +ツブテイシ 礫石 +ツブネ 津舟 +ツブハリ 粒針 +ツブミ 粒見 +ツブヤマ 粒山 +ツフラ 津布良 +ツブラ 螺良 +ツブラ 円 +ツブラ 粒良 +ツブラ 圓 +ツブラ 津布楽 +ツブラ 粒羅 +ツブラ 津布樂 +ツブラ 粒楽 +ツブライ 粒来(粒耒) +ツブライ 円井 +ツブライ 圓井 +ツブライ 粒來 +ツブライケ 円池 +ツブラオカ 円岡 +ツブラオカ 圓岡 +ツブラギ 円木(圓木) +ツブラヤ 円谷 +ツブラヤ 圓谷 +ツブロ 津風呂 +ツベ 津辺 +ツベ 津邉 +ツボ 坪 +ツボ 津保 +ツボ 壷 +ツボ 壺 +ツボイ 坪井 +ツボイ 壷井 +ツボイ 壺井 +ツボイ 坪居 +ツボイ 坪意 +ツボイ 津保井 +ツボイケ 坪池 +ツボイシ 坪石 +ツボイリ 坪入 +ツボウエ 坪上 +ツボウチ 坪内 +ツボウチ 壷内 +ツボウチ 壺内 +ツボウチ 壼内 +ツボウラ 坪浦 +ツボエ 坪江 +ツボエ 坪栄 +ツボエ 壷江 +ツボオ 坪尾 +ツボオカ 坪岡 +ツボカ 坪香 +ツボカネ 坪金 +ツボガネ 坪金 +ツボカミ 坪上 +ツボガミ 坪上 +ツボカワ 坪川 +ツボカワ 坪河 +ツボカワ 壷河 +ツボカワ 壷川 +ツボカワ 壺川 +ツボキ 坪木 +ツボキタ 坪北 +ツボク 津保久 +ツボクタ 坪久田 +ツボクダ 坪久田 +ツボグチ 坪口 +ツボクラ 坪倉 +ツボクラ 壷倉 +ツボクラ 壺倉 +ツボコ 坪子 +ツボコウ 坪光 +ツボゴウ 坪郷 +ツボサ 坪佐 +ツボサカ 坪坂 +ツボサカ 壷阪 +ツボサカ 壷坂 +ツボサカ 壺阪 +ツボサカ 壺坂 +ツボサキ 坪崎 +ツボサキ 壷崎 +ツボサキ 壺崎 +ツボザキ 坪崎 +ツボサワ 坪沢 +ツボサワ 坪澤 +ツボジ 坪地 +ツボジ 坪治 +ツボシゲ 坪重 +ツボシタ 坪下 +ツボシマ 坪島 +ツボシマ 坪嶋 +ツボジマ 坪嶋 +ツボジリ 坪尻 +ツボスミ 坪住 +ツボゾエ 坪副 +ツボタ 坪田 +ツボタ 壷田 +ツボタ 局田 +ツボタ 坪多 +ツボタ 壺田 +ツボダ 坪田 +ツボタニ 坪谷 +ツボタニ 壷谷 +ツボタニ 壺谷 +ツボチ 坪地 +ツボチャ 坪茶 +ツボツカ 坪塚 +ツボヅカ 坪塚 +ツボナカ 坪中 +ツボナカ 壷中 +ツボナカ 壺中 +ツボニシ 坪西 +ツボニワ 坪庭 +ツボヌマ 坪沼 +ツボネ 坪根 +ツボネ 局 +ツボネ 坪禰 +ツボネ 津保根 +ツボネ 坪祢 +ツボノ 坪野 +ツボノ 壷野 +ツボノウ 坪能 +ツボノウエ 坪上 +ツボノウエ 坪ノ上 +ツボノウチ 坪之内 +ツボノウチ 坪ノ内 +ツボノウチ 坪野内 +ツボノマツ 坪野松 +ツボノヤ 坪野谷 +ツボバヤシ 壷林(壺林) +ツボバヤシ 坪林 +ツボハラ 坪原 +ツボヒラ 坪平 +ツボマツ 坪松 +ツボミ 四月朔日 +ツボミ 坪見 +ツボミ 莟 +ツボミ 壷見 +ツボミズ 坪水 +ツボミツ 坪光 +ツボムラ 坪村 +ツボモト 坪本 +ツボモト 壷本 +ツボモト 坪元 +ツボモリ 坪森 +ツボヤ 坪谷 +ツボヤ 壷屋 +ツボヤ 坪屋 +ツボヤ 壷谷 +ツボヤ 壺屋 +ツボヤ 坪矢 +ツボヤ 壺谷 +ツボヤ 坪家 +ツボヤマ 坪山 +ツボヤマ 壷山 +ツボヤマ 壺山 +ツボライ 坪来 +ツボリ 坪利 +ツボリ 津堀 +ツボワ 坪和 +ツマ 津間 +ツマ 都間 +ツマ 津馬 +ツマアリ 妻有 +ツマイ 妻井 +ツマオカ 津間岡 +ツマカ 妻鹿 +ツマガキ 妻垣 +ツマカタ 妻方 +ツマガタ 妻形 +ツマカミ 妻神 +ツマガリ 津曲 +ツマガリ 妻苅(妻刈) +ツマカワ 妻川 +ツマキ 妻木 +ツマキ 津牧 +ツマギ 妻木 +ツマギ 妻岐 +ツマギ 妻城 +ツマクラ 妻倉 +ツマゴ 妻籠 +ツマサカ 裙坂 +ツマサキ 妻崎 +ツマザキ 妻崎 +ツマザワ 妻沢 +ツマザワ 妻澤 +ツマシカ 妻鹿 +ツマシゲ 妻重 +ツマシナ 妻科 +ツマシマ 妻島 +ツマシマ 妻嶋 +ツマジマ 妻島 +ツマジマ 妻嶋 +ツマセ 妻瀬 +ツマタ 妻田 +ツマダ 妻田 +ツマダテ 妻達 +ツマタニ 妻谷 +ツマチ 津町 +ツマト 妻戸 +ツマトリ 妻鳥 +ツマドリ 妻鳥 +ツマナミ 妻波 +ツマヌマ 妻沼 +ツマノ 妻野 +ツマビラ 一二 +ツマヒロ 津間広(津間廣) +ツマブキ 妻夫木 +ツマミチ 妻道 +ツマモト 裙本 +ツマモト 姜本 +ツマモト 妻本 +ツマモト 津間本 +ツマヤ 妻屋 +ツマユ 妻由 +ツマル 都丸 +ツマル 津丸 +ツミキ 積木 +ツミタ 積田 +ツミタ 摘田 +ツミダ 積田 +ツミネ 積根 +ツミモリ 積森 +ツミヤ 都宮 +ツミヤマ 積山 +ツム 紡車 +ツムガ 積賀 +ツムキ 積木 +ツムキ 津向 +ツムギ 積木 +ツムギ 津麦 +ツムギ 津向 +ツムギ 紬 +ツムギワ 積際 +ツムジ 積治 +ツムジ 街風 +ツムダ 紡車田 +ツムネ 津旨 +ツムラ 辻村 +ツムラ 津村 +ツムラ 都村 +ツムラ 積良 +ツムラ 津邑 +ツムラ 津邨 +ツムライ 円井 +ツムライ 圓井 +ツムライ 津村井 +ツムラヤ 円谷 +ツムラヤ 圓谷 +ツムロ 津室 +ツメ 爪 +ツメイシ 詰石 +ツメカワ 爪川 +ツメサカ 詰坂 +ツメサカ 爪坂 +ツメタ 爪田 +ツメタ 詰田 +ツメダ 爪田 +ツメダ 詰田 +ツメナガ 爪長 +ツメノ 爪野 +ツメハシ 爪橋 +ツメバヤシ 爪林 +ツメマル 爪丸 +ツメマル 詰丸 +ツメミツ 詰光 +ツモウ 津毛 +ツモタニ 津茂谷 +ツモチ 津持 +ツモト 津本 +ツモト 津元 +ツモト 湊元 +ツモト 都本 +ツモヤ 津茂谷 +ツモリ 津守 +ツモリ 津森 +ツモリ 都守 +ツモリ 都森 +ツヤ 津谷 +ツヤ 光沢 +ツヤ 津屋 +ツヤ 光澤 +ツヤ 通谷 +ツヤカワ 津谷川 +ツヤシマ 艶島 +ツヤダ 津矢田 +ツヤナ 津梁 +ツヤナギ 津柳 +ツヤマ 津山 +ツヤマ 都山 +ツユ 栗花落 +ツユ 露 +ツユウチ 露内 +ツユオカ 露岡 +ツユキ 露木 +ツユキ 築城 +ツユキ 筑城 +ツユキ 津行 +ツユキ 津雪 +ツユキ 露雪 +ツユクサ 露草 +ツユクシ 露久志 +ツユグチ 露口 +ツユクボ 露久保 +ツユサキ 露崎 +ツユサキ 露嵜 +ツユサキ 露先 +ツユザキ 露崎 +ツユザキ 露嵜 +ツユザキ 潰崎 +ツユシゲ 露重 +ツユシゲ 露繁 +ツユダ 露田 +ツユタニ 露谷 +ツユチ 露地 +ツユヅメ 露詰 +ツユナシ 露無 +ツユナシ 露梨 +ツユナル 露成 +ツユノ 露野 +ツユハナ 露花 +ツユハラ 露原 +ツユミネ 露峰 +ツユミネ 露峯 +ツユム 露無 +ツユムラ 露村 +ツユモト 露本 +ツユモト 露元 +ツユリ 栗花落 +ツヨシ 津吉 +ツヨシ 都世子 +ツヨシ 都吉 +ツヨセ 強瀬 +ツラ 連 +ツラシマ 貫島 +ツラヌキ 貫 +ツリ 釣 +ツリ 津里 +ツリイ 釣井 +ツリイエ 釣家 +ツリイシ 釣石 +ツリウラ 釣浦 +ツリウン 釣運 +ツリオカ 釣岡 +ツリガ 釣賀 +ツリカネ 釣兼 +ツリガマ 釣釜 +ツリガミ 釣上 +ツリカワ 釣川 +ツリキ 釣木 +ツリキサワ 釣木沢 +ツリキサワ 釣木澤 +ツリザオ 釣竿 +ツリサキ 釣崎 +ツリサキ 釣嵜 +ツリザキ 釣崎 +ツリサワ 釣沢 +ツリサワ 釣澤 +ツリザワ 釣沢 +ツリザワ 釣澤 +ツリシマ 釣島 +ツリタ 釣田 +ツリダシ 釣出 +ツリタニ 釣谷 +ツリタニ 鉤谷 +ツリダン 釣段 +ツリツヅミ 釣鼓 +ツリツヅミ 釣皷 +ツリテ 釣手 +ツリデ 釣出 +ツリナガ 釣永 +ツリノ 釣野 +ツリバ 釣場 +ツリフジ 二十里 +ツリフネ 釣船 +ツリフネ 釣舟 +ツリフネ 釣舩 +ツリベ 釣部 +ツリマキ 釣巻 +ツリマキ 鉤巻 +ツリミ 釣見 +ツリモト 釣本 +ツリモト 釣元 +ツリヤ 釣谷 +ツリヤ 釣屋 +ツリヤ 釣矢 +ツリヤマ 釣山 +ツリュウ 釣流 +ツリュウ 鉤流 +ツリラク 釣楽 +ツル 鶴 +ツル 津留 +ツル 水流 +ツル 都留 +ツル 都瑠 +ツル 津畄 +ツル 弦 +ツル 都畄 +ツルイ 鶴井 +ツルイ 釣井 +ツルイ 鶴居 +ツルイ 抅井 +ツルイ 弦井 +ツルイ 敦井 +ツルイケ 鶴池 +ツルイシ 鶴石 +ツルイズミ 鶴泉 +ツルイチ 鶴市 +ツルウチ 鶴内 +ツルウラ 鶴浦 +ツルエ 鶴江 +ツルエ 鶴栄 +ツルエ 鶴衛 +ツルエ 釣餌 +ツルエイ 鶴栄 +ツルオ 鶴尾 +ツルオカ 鶴岡 +ツルオカ 寉岡 +ツルオカ 鶴皐 +ツルオカ 敦岡 +ツルオカ 弦岡 +ツルオカ 鶴𦊆 +ツルガ 敦賀 +ツルガ 鶴賀 +ツルガ 鶴我 +ツルガ 釣賀 +ツルガ 鶴家 +ツルガ 孰賀 +ツルガ 敦加 +ツルカイ 鶴飼 +ツルカイ 鶴貝 +ツルガイ 鶴谷 +ツルガイ 鶴飼 +ツルガイ 鶴貝 +ツルガオカ 鶴ケ岡 +ツルガオカ 鶴ケ丘 +ツルガクボ 鶴ケ久保 +ツルガサキ 鶴ケ崎 +ツルカジ 鶴梶 +ツルガセキ 鶴ケ関 +ツルガノ 鶴ケ野 +ツルカミ 鶴上 +ツルガミ 鶴上 +ツルガミネ 鶴ケ峯 +ツルカメ 鶴亀 +ツルガヤ 鶴谷 +ツルガヤ 鶴ケ谷 +ツルガヤ 敦賀谷 +ツルガヤ 鶴賀谷 +ツルガヤ 敦賀屋 +ツルカワ 鶴川 +ツルカワ 霍川 +ツルカワ 弦川 +ツルカワ 敦川 +ツルカワ 鶴河 +ツルカワウチ 鶴川内 +ツルカワヤ 鶴川屋 +ツルキ 鶴木 +ツルキ 鶴来 +ツルキ 弦木 +ツルキ 釣木 +ツルキ 鶴來 +ツルギ 鶴木 +ツルギ 鶴来 +ツルギ 劔(劒) +ツルギ 剣 +ツルギ 剱 +ツルギ 釼 +ツルギ 鶴城 +ツルギ 刀儀 +ツルギ 鶴來 +ツルギ 寉来 +ツルギザワ 釣木沢 +ツルギザワ 釣木澤 +ツルギジ 剱地 +ツルギジ 釼地 +ツルギダ 剱田 +ツルギダ 剣田 +ツルギダ 釼田 +ツルギダ 劔田 +ツルギダ 劒田 +ツルギチ 剱地 +ツルギチ 剣地 +ツルギチ 釼地 +ツルギチ 劔地 +ツルギヤ 釼谷 +ツルギヤ 鶴来谷 +ツルギヤ 剱谷 +ツルキリ 鶴切 +ツルキリ 弦切 +ツルキリ 弦桐 +ツルキリ 寉切 +ツルク 鶴久 +ツルグチ 鶴口 +ツルグチ 霍口 +ツルクボ 鶴窪 +ツルクマ 鶴熊 +ツルコ 鶴子 +ツルゴウ 鶴郷 +ツルコオ 鶴小尾 +ツルコシ 鶴越 +ツルコヤ 鶴小屋 +ツルゴヤ 鶴小屋 +ツルサオ 鶴棹 +ツルサカ 鶴坂 +ツルサカ 鶴阪 +ツルサキ 鶴崎 +ツルサキ 津留崎(津畄崎) +ツルサキ 釣崎 +ツルサキ 鶴嵜 +ツルサキ 津留嵜 +ツルサキ 都留崎 +ツルザキ 鶴崎 +ツルザキ 津留崎(津畄崎) +ツルサコ 鶴迫 +ツルサコ 鶴追 +ツルサシ 鶴指 +ツルサト 鶴里 +ツルサワ 鶴沢 +ツルサワ 敦沢 +ツルサワ 鶴澤 +ツルサワ 敦澤 +ツルサワ 霍沢(霍澤) +ツルザワ 鶴沢 +ツルザワ 鶴澤 +ツルシ 鶴師 +ツルシイン 四十九院 +ツルシゲ 鶴重 +ツルシタ 鶴下 +ツルシバ 鶴柴 +ツルシマ 鶴島 +ツルシマ 鶴嶋 +ツルシマ 釣島 +ツルシマ 弦嶋 +ツルシマ 鶴嶌 +ツルシマ 敦島 +ツルシマ 敦嶋 +ツルシマ 寉島 +ツルジョウ 鶴城 +ツルシロ 鶴代 +ツルス 鶴巣 +ツルスミ 鶴住 +ツルセ 鶴瀬 +ツルセ 鶴背(鶴脊) +ツルゾエ 水流添 +ツルゾエ 鶴添 +ツルゾエ 鶴副 +ツルゾノ 鶴園 +ツルゾノ 鶴薗 +ツルゾノ 水流園 +ツルゾノ 水流薗 +ツルタ 鶴田 +ツルタ 霍田 +ツルタ 釣田 +ツルタ 寉田 +ツルタ 弦田 +ツルタ 津留田 +ツルタ 敦田 +ツルタ 水流田 +ツルダ 鶴田 +ツルダ 霍田 +ツルダ 寉田 +ツルダ 弦田 +ツルタカ 鶴高 +ツルタケ 鶴竹 +ツルタケ 鶴武 +ツルタニ 鶴谷 +ツルタニ 釣谷 +ツルチ 鶴地 +ツルヅカ 鶴塚 +ツルト 鶴戸 +ツルド 鶴戸 +ツルトウ 鶴頭 +ツルドノ 鶴殿 +ツルトメ 鶴留 +ツルドメ 鶴留 +ツルナガ 鶴長 +ツルナガ 鶴永 +ツルナガ 敦永 +ツルナリ 鶴成 +ツルニシ 鶴西 +ツルヌマ 鶴沼 +ツルネン 弦念 +ツルノ 鶴野 +ツルノ 鶴埜 +ツルノ 霍野 +ツルノイ 鶴野井 +ツルノソノ 鶴之園 +ツルノソノ 鶴之薗 +ツルノダ 鶴野田 +ツルハ 鶴羽 +ツルハ 鶴葉 +ツルバ 鶴場 +ツルハシ 鶴橋 +ツルハシ 鶴嘴 +ツルハシ 鶴端 +ツルハシ 弦橋 +ツルハタ 鶴畑 +ツルハマ 鶴浜 +ツルハマ 鶴濱 +ツルハミ 鶴喰 +ツルバミ 鶴喰 +ツルハヤ 鶴早 +ツルバヤシ 鶴林 +ツルバヤシ 津留林 +ツルハラ 鶴原 +ツルバラ 鶴原 +ツルハラタニ 鶴原谷 +ツルハラヤ 鶴原谷 +ツルヒガシ 鶴東 +ツルヒサ 鶴久 +ツルフサ 鶴房 +ツルフジ 鶴藤 +ツルフチ 鶴淵 +ツルフチ 鶴渕 +ツルブチ 鶴淵 +ツルブチ 鶴渕 +ツルベ 釣瓶 +ツルベ 釣部 +ツルホ 鶴保 +ツルボウ 鶴房 +ツルホリ 鶴堀 +ツルボリ 鶴堀 +ツルマ 鶴間 +ツルマ 鶴馬 +ツルマ 霍間 +ツルマキ 弦巻 +ツルマキ 弦牧 +ツルマキ 弦卷 +ツルマキ 釣巻 +ツルマキ 鶴巻(鶴卷) +ツルマキ 鶴蒔 +ツルマキ 鶴牧 +ツルマキ 鶴槙(鶴槇) +ツルマキ 敦巻 +ツルマス 鶴増 +ツルマス 鶴桝 +ツルマチ 鶴町 +ツルマツ 鶴松 +ツルマル 水流丸 +ツルマル 鶴丸 +ツルミ 津留見 +ツルミ 津畄見 +ツルミ 釣見 +ツルミ 鶴海 +ツルミ 鶴見 +ツルミ 鶴身 +ツルミ 鶴味 +ツルミ 敦見 +ツルミ 蔓見 +ツルミ 寉見 +ツルミ 霍見 +ツルミズ 鶴水 +ツルミチ 鶴道 +ツルミネ 鶴峰 +ツルミネ 鶴峯 +ツルミヤ 鶴宮 +ツルムネ 鶴旨 +ツルムネ 鶴宗 +ツルムラ 津留村 +ツルムラ 鶴村 +ツルムラ 霍村 +ツルメ 鶴目 +ツルモト 弦元 +ツルモト 弦本 +ツルモト 釣本 +ツルモト 鶴元 +ツルモト 鶴本 +ツルモト 霍本 +ツルモリ 鶴森 +ツルヤ 弦谷 +ツルヤ 釣谷 +ツルヤ 鶴屋 +ツルヤ 鶴家 +ツルヤ 鶴舎 +ツルヤ 鶴谷 +ツルヤ 敦谷 +ツルヤマ 鶴山 +ツルヤマ 霍山 +ツルユミ 弦弓 +ツルヨシ 鶴吉 +ツルワ 鶴羽 +ツルワ 鶴輪 +ツルワ 鶴和 +ツルワカ 鶴若 +ツレイシ 連石 +ツレオ 連尾 +ツレカワ 連川 +ツレシオ 連汐 +ツレタ 連田 +ツレナミ 連波 +ツレノ 連野 +ツレミズ 連水 +ツレヤマ 連山 +ツロ 津呂 +ツロ 津路 +ツロ 津露 +ツロウ 津老 +ツロハシ 津呂橋 +ツロモト 津呂本 +ツワ 津和 +ツワキ 津脇 +ツワコ 津波古 +ツワザキ 津和崎 +ツワザキ 津和嵜 +ツワダ 津和田 +ツワタリ 津渡 +ツワノ 津和野 +ツワモト 津輪元 +ツワモト 津和本 +テアイ 手合 +デアイ 出合 +デアイ 出会 +デアイ 出相 +デアイ 出會 +デアイ 出逢 +デアイバ 出合場 +テアライ 手洗 +テイ 定 +テイ 貞 +テイ 禎 +テイ 手井 +テイ 亭 +テイ 廷 +テイ 帝井 +デイ 出井 +デイ 出居 +デイ 出樋 +デイ 出伊 +テイイ 堤井 +デイエ 出家 +テイエキ 逓駅 +テイオカ 貞岡 +テイカ 堤下 +テイカ 貞家 +テイコウ 貞孝 +テイシ 手石 +デイシ 出石 +テイシカタ 手石方 +テイシマ 亭島 +テイシマ 亭嶋 +テイジマ 禎島 +テイジマ 亭島 +テイショウ 貞照 +テイジョウ 堤上 +テイジョウ 渟城 +テイダ 禎田 +テイダ 偵田 +デイチ 出市 +テイテイ 廷々(廷廷) +テイト 帝都 +テイトウ 棣棠 +デイトウ 泥藤 +デイドウ 泥堂 +テイバ 庭坂 +テイムラ 禎村 +テイモト 鄭本 +テイヤマ 丁山 +テイラ 定良 +デウシ 出牛 +テウチ 手打 +デウチ 出内 +デウミ 出海 +デウラ 出浦 +デエ 出江 +テオ 手尾 +デオ 出尾 +デオ 出雄 +デオカ 出岡 +デオキ 出沖 +デオン 出温 +テカ 樋嘉 +テガ 手賀 +テガ 手鹿 +テガ 手下 +テガイ 手貝 +デカイ 出海 +デガイ 出貝 +デガイト 出垣内 +デガキ 出垣 +デガシラ 出頭 +デカド 出角 +テガネ 手金 +デカマ 出竃 +デカマ 出竈 +デガマ 出竃 +デガマ 出釜 +デガマ 出竈 +デガミ 出上 +デカモ 出構 +テガラ 手柄 +デガラ 出柄 +テカワ 天川 +テカワ 手川 +テガワ 天川 +テガワ 手川 +デカワ 出川 +デカワ 出河 +デガワ 出川 +デガワ 出河 +デガワラ 出河原 +テキ 手木 +デキ 出来 +デキ 出木 +デキ 出岐 +デキ 出來 +デキ 出耒 +デギ 出木 +デキウラ 出木浦 +デキオ 出来尾 +デキオカ 出木岡 +デキオカ 出来岡 +デキガイ 出木谷 +デキガイ 出来谷 +デギシ 出岸 +デキシマ 出来島(出來島) +デキシマ 出来嶋(出來嶋) +デキジマ 出来島(出來島) +デキシャ 出木舎 +デキス 出来須 +デキス 出來須 +デキタ 出来田(出來田・出耒田) +デキタ 出木田 +デキタニ 出木谷 +デキタニ 出来谷 +デキタニ 出來谷 +デキデン 出来田(出來田・出耒田) +テキドウ 適藤 +デキノ 出木野 +デキノ 出来野 +デキバ 出木場 +デキハラ 出木原 +デキマチ 出来町 +デキムラ 出来村 +デキモト 出来本 +デキモト 出来元 +デキヤ 出木谷 +デキヤ 出来谷 +デキヤ 出来屋 +デキヤ 出來谷 +デキヤマ 出来山 +デキヤマ 出木山 +デク 出久 +テグシ 手串 +テグチ 手口 +デクチ 出口 +デグチ 出口 +デグチ 出久地 +デクネ 出久根 +デクボ 出窪 +テクラ 手倉 +テグラ 手倉 +デクラ 出倉 +デクラ 出倉 +デクラ 出蔵 +デクラ 出藏 +デグラ 出蔵 +デグラ 出藏 +テクラモリ 手倉森 +テグラモリ 手倉森 +テグリ 手操 +テグリ 手繰 +デグリ 出栗 +デグルマ 出車 +テグワ 手桑 +テコ 手古 +テコ 手小 +テゴ 手子 +デコウ 出孝 +デコウジ 出麹 +テゴエ 手越 +テゴシ 手越 +デゴシ 出越 +デザオ 出竿 +テサカ 手坂 +デサカ 出坂 +テサキ 手崎 +テザキ 手崎 +デサキ 出崎 +デサキ 出先 +デサキ 出嵜 +デザキ 出崎 +デサク 出作 +テザワ 手沢 +テザワ 手澤 +デサワ 出澤 +デザワ 出沢 +デザワ 出澤 +テシ 勅使 +テシ 弟子 +デジ 出路 +デシオ 出塩 +テシカ 手鹿 +テジカ 手鹿 +テシカハラ 勅使河原 +テシガハラ 勅使河原 +テシガハラ 勅使川原 +テシガハラ 勅使ケ原 +テシガハラ 敕使河原 +テシガワ 勅使川 +テシガワラ 勅使河原 +テシガワラ 勅使川原 +テシガワラ 勅使瓦 +テシガワラ 勅使原 +テシガワラ 勅史河原 +デシクボ 出志久保 +テシタ 手下 +デシタ 出下 +デジタ 出下 +テシナ 手科 +テジナ 手科 +テシバ 手柴 +テシベ 徹邊(徹辺) +テシマ 豊島(豐島) +テシマ 手島 +テシマ 手嶋 +テシマ 豊嶋 +テシマ 手嶌 +テシマ 天島 +テジマ 手島 +テジマ 手嶋 +テジマ 手嶌 +デシマ 出島 +デジマ 出島 +デジマ 出嶋 +デジマ 出嶌 +テシマノ 手島野 +テシマノ 手嶋野 +デシマル 弟子丸 +デシミズ 出清水 +デジリ 出尻 +テシロ 手代 +テシロ 手城 +テシロキ 手代木 +テシロギ 手代木 +テシロモリ 手代森 +デスイ 出水 +テズカ 手塚 +テズカ 手束 +テゼニ 手銭 +テゼニ 手錢 +テセン 手銭 +テセン 手錢 +テゼン 手銭 +テゼン 手錢 +デセン 出仙 +デソウザ 太倉坐 +テゾノ 樋園 +デタ 出田 +デダ 出田 +デダイコ 出太鼓 +テタカ 樋高 +テダカ 樋高 +デタケ 出竹 +デタチ 出立 +デダチ 出立 +デタナ 出棚 +テタニ 手谷 +テダニ 手谷 +デタニ 出谷 +テダレ 手垂 +デタンポ 出丹保 +テチカワラ 鉄地河原 +テチガワラ 鉄地河原 +テチガワラ 鉄地川原 +テツ 鉄 +テツ 鐵(鐡) +テツ 銕 +テツ 徹 +テツ 哲 +テツアナ 鉄穴 +テツイ 鉄井(鐡井) +テツイ 鐵井 +テツイシ 鉄石(鐵石) +テツイワ 鉄岩(鐵岩) +テツイワ 鐡岩 +テツオ 鉄尾 +テツオ 銕尾 +テツオ 鐵尾 +テツオウ 哲翁 +テツオカ 鉄岡(鐵岡) +テツカ 手塚 +テツカ 手束 +テツガ 鉄賀 +テヅカ 手塚 +テヅカ 手束 +テヅカ 手捲 +テヅカ 手墳 +デツカ 出塚 +デヅカ 出塚 +テツカワ 鉄川 +テツカワ 鐵川 +テツカワ 銕川 +テツキ 鉄木 +テヅキ 手月 +デヅキ 出月 +テツグ 鉄具 +テツグ 鐵具 +テツクサ 鉄艸(鐡艸) +テツグチ 鉄口 +テツグチ 鐵口 +テツクラ 鉄倉 +テツクラ 鐵倉 +デヅクリ 出作 +テツグルマ 鉄車 +デッケ 出家 +デッコ 出ツ古 +デッコウ 出孝 +テツサカ 鉄阪 +テツサキ 鉄崎(鉄嵜) +テツザキ 鉄崎(鉄嵜) +テツサシ 鉄指 +テツザワ 鉄沢 +テツザワ 鉄澤 +テツザワ 鐵澤 +テツシタ 鉄下 +テツシマ 鉄島 +テツシマ 徹島 +テツジマ 鉄島 +テツジュウ 鉄重(鐡重・鐵重) +デッショ 出ツ所 +テッセキ 鉄石(鐵石) +デッセン 出仙 +テツダ 鉄田 +テツダ 鐵田 +テツタニ 鉄谷 +テツタニ 鐵谷 +テツタニ 銕谷 +テヅチ 手槌 +テツチカワハラ 鉄地河原 +テツチカワハラ 鉄地川原 +テッチカワラ 鉄地河原 +テッチガワラ 鉄地川原 +テッチュウ 鉄柱 +テツト 鉄戸(鐡戸) +テツド 鉄戸(鐡戸) +テットウ 鉄東 +テツトメ 鉄留 +テツドメ 鉄留 +テヅナ 手綱 +テツナガ 鉄永 +テツノ 鉄野 +テツノ 鐵野 +デヅノ 出津野 +テツハ 鉄羽 +テツハシ 鉄橋(鐵橋) +テツバヤシ 鉄林 +テツハラ 鉄原(鐵原) +テツベ 徹邊(徹辺) +テッポウ 鉄炮 +テッポウ 鉄砲 +テッポウ 鉄鉋 +テッポウツカ 鉄炮塚 +テッポウヅカ 鉄炮塚 +テッポウヅカ 鉄砲塚 +テツマス 鉄増 +テツマス 鉄升 +テツマル 鉄丸(鐡丸) +テツミ 鉄見 +テツミ 鐵見 +テツミ 鐡見 +テツミヤ 鉄宮(鐵宮) +テツムラ 鉄村 +テツモト 鉄本(鐡本) +テツモト 鐵本 +テツモト 銕本 +テツモリ 鉄森 +テツヤ 鉄谷 +テツヤ 鉄矢(鐵矢) +テツヤ 鉄屋(鐡屋) +テツヤ 鉄家(鐡家) +テツヤ 鐵屋 +テツヤ 鐵谷 +テツヤキ 鉄焼 +テツヤマ 鉄山(鐵山) +テツヤマ 銕山 +テツヤマ 鐡山 +テツラ 鉄羅(鐵羅) +テツラ 手面 +テヅラ 手面 +テテ 廷々(廷廷) +テト 手戸 +テド 手戸 +テド 手渡 +デト 出戸 +デト 出途 +デドコロ 出所 +テドコン 手登根 +テトネ 手登根 +デトハシ 出戸端 +デトハタ 出戸端 +デトバタ 出戸端 +デトミ 出富 +テトリ 手取 +テドリ 手取 +テドリヤ 手取屋 +テナカ 手仲 +デナカ 出中 +デナガ 出永 +テナベ 手辺 +デナミ 出波 +テナワ 手縄 +デナワ 出繩 +デナワ 出縄 +デニシ 出西 +デヌマ 出沼 +テノ 手野 +デノ 出野 +テノウ 手納 +デノウ 出納 +デノカミ 出野上 +デノガミ 出野上 +テノクチ 樋之口 +テノクチ 樋ノ口 +デノクチ 出ノ口 +デノクチ 出之口 +テノネ 手野根 +デハ 出葉 +デバ 出羽 +デバ 出葉 +デバ 出場 +テハイ 手拝 +テハイ 手拜 +テバカ 手計 +テバカリ 手計 +デハシ 出橋 +デバシ 出橋 +デハタ 出畑 +デバタ 出畑 +デバタ 出端 +デバナ 出花 +デハマ 出浜 +デハマ 出濱 +テバヤシ 手林 +デバヤシ 出林 +テハラ 手原 +デハラ 出原 +デハリ 出張 +デハリ 出開 +デバリ 出張 +デハル 出春 +デハレ 出晴 +テビ 手皮 +テビカ 手光 +デヒデ 出秀 +テヒラ 手平 +テビラ 手平 +デヒラ 出平 +デビラ 傳平 +デヒロ 出広 +デヒロ 出廣 +デフジ 出藤 +デブチ 出渕 +デブチ 出淵 +デフネ 出船 +デブン 出分 +テベ 手辺(手邊・手邉) +テホ 手穂 +デホ 出保 +デホリ 出堀 +デボリ 出堀 +テマ 手間 +デマ 出間 +デマエ 出前 +テマチ 手町 +デマチ 出町 +デマチ 出待 +テマモト 手間本 +テマル 手丸 +デマル 出丸 +デマント 出満富 +デミ 出見 +テミズ 手水 +デミズ 出水 +テミズガワ 手水川 +デミズガワ 出水川 +デミセ 出店 +デミセ 出見世 +デミチ 出路 +デミチ 出道 +デミツ 出光 +デミナミ 出南 +テミノ 手蓑 +テミノ 手見野 +テミノ 手簑 +デミヤ 出宮 +テムカイ 手向 +デムカイ 出向井 +デムカイ 出向 +デムラ 出村 +デムラ 出邑 +デムラタニ 出村谷 +デムラヤ 出村谷 +テムロ 手室 +デメ 出目 +テモチ 手持 +デモト 出本 +デモト 出元 +デモリ 出森 +デモン 出門 +デヤ 出谷 +デヤ 出家 +デヤ 出屋 +デヤシキ 出屋敷 +デヤシキ 出家鋪 +テヤナギ 手柳 +テヤマ 手山 +デヤマ 出山 +デユ 出湯 +テラ 寺 +テラアト 寺跡 +テライ 寺井 +テライ 寺居 +テライエ 寺家 +テライケ 寺池 +テライシ 寺石 +テライズミ 寺泉 +テライチ 寺一 +テライデ 寺出 +テライヤ 寺井屋 +テラウ 寺生 +テラウエ 寺上 +テラウシ 寺牛 +テラウジ 寺氏 +テラウチ 寺内 +テラウラ 寺浦 +テラウラ 寺裏 +テラエ 寺江 +テラオ 寺尾 +テラオ 寺生 +テラオカ 寺岡 +テラオキ 寺沖 +テラオク 寺奥 +テラガ 寺賀 +テラガイト 寺垣内 +テラガウチ 寺垣内 +テラガキ 寺垣 +テラガキ 寺柿 +テラカキウチ 寺垣内 +テラカク 寺角 +テラカゴ 寺篭 +テラカゴ 寺籠 +テラカジ 寺鍛冶 +テラカジ 寺鍛治 +テラカジ 寺鍜治 +テラカタ 寺方 +テラカタ 寺片 +テラガタ 寺県 +テラガタ 寺縣 +テラカド 寺門 +テラカド 寺角 +テラカド 寺神戸 +テラカミ 寺上 +テラカミ 寺神 +テラガミ 寺上 +テラガミ 寺神 +テラカワ 寺川 +テラカワ 寺河 +テラガワ 寺川 +テラガワ 寺河 +テラキ 寺木 +テラギ 寺儀 +テラギ 寺義 +テラキシ 寺岸 +テラギシ 寺岸 +テラキタ 寺北 +テラギワ 寺際 +テラクチ 寺口 +テラグチ 寺口 +テラクボ 寺久保 +テラクボ 寺窪 +テラクラ 寺倉 +テラゴ 寺後 +テラゴウチ 寺河内 +テラコウベ 寺神戸 +テラコシ 寺越 +テラコシ 寺腰 +テラゴシ 寺腰 +テラサイモト 寺才元 +テラサイモト 寺才本 +テラサカ 寺坂 +テラサカ 寺阪 +テラサキ 寺崎 +テラサキ 寺前 +テラサキ 寺嵜 +テラサキ 寺岬 +テラザキ 寺崎 +テラサク 寺迫(寺廹) +テラサコ 寺迫(寺廹) +テラザコ 寺迫(寺廹) +テラサシ 寺莿 +テラサト 寺里 +テラサワ 寺沢 +テラサワ 寺澤 +テラサワ 照沢 +テラザワ 寺沢 +テラザワ 寺澤 +テラサワグチ 寺沢口 +テラシ 寺師 +テラシ 寺司 +テラシ 照 +テラシ 赫 +テラジ 寺地 +テラジ 寺司 +テラジ 寺次 +テラジ 寺主 +テラジ 寺治 +テラジ 寺路 +テラシオ 寺塩 +テラシキ 寺敷 +テラシゲ 寺重 +テラシタ 寺下 +テラシチ 寺七 +テラシマ 寺島 +テラシマ 寺嶋 +テラシマ 寺嶌 +テラジマ 寺島 +テラジマ 寺嶋 +テラジマ 寺嶌 +テラショウ 寺生 +テラジリ 寺尻 +テラス 照 +テラス 寺栖 +テラス 寺須 +テラスエ 寺末 +テラスミ 寺角 +テラスミ 寺墨 +テラズミ 寺住 +テラズミ 寺墨 +テラセ 寺瀬 +テラセ 寺世 +テラセ 寺背 +テラセコ 寺迫(寺廹) +テラソ 寺曽 +テラゾエ 寺添 +テラソト 寺外 +テラソノ 寺園 +テラソノ 寺薗 +テラゾノ 寺園 +テラゾノ 寺薗 +テラソバ 寺側 +テラソマ 寺杣 +テラタ 寺田 +テラダ 寺田 +テラダイ 寺代 +テラダイ 寺台 +テラダイラ 寺平 +テラタキ 寺滝 +テラタケ 寺竹 +テラタテ 寺舘 +テラダテ 寺舘 +テラダテ 寺館 +テラダテ 寺立 +テラダテ 寺建 +テラタニ 寺谷 +テラタニ 寺渓 +テラダヤ 寺田谷 +テラダン 寺段 +テラチ 寺地 +テラヂ 寺地 +テラツ 寺津 +テラヅ 寺津 +テラツカ 寺塚 +テラヅカ 寺塚 +テラツジ 寺辻 +テラツボ 寺坪 +テラデ 寺出 +テラト 寺戸 +テラド 寺戸 +テラド 寺土 +テラドイ 寺土井 +テラトウ 寺東 +テラドウ 寺堂 +テラトコ 寺床 +テラナ 寺名 +テラナカ 寺中 +テラナガ 寺永 +テラナガ 寺長 +テラナガネ 寺長根 +テラナミ 寺南 +テラニ 寺二 +テラニシ 寺西 +テラニシ 手良西 +テラヌシ 寺主 +テラヌマ 寺沼 +テラネ 寺根 +テラノ 寺野 +テラノ 寺農 +テラノ 寺埜 +テラノウ 寺農 +テラノシタ 寺野下 +テラノシタ 寺ノ下 +テラノダン 寺野段 +テラノブ 寺延 +テラノベ 寺延 +テラハイ 寺拝 +テラハシ 寺橋 +テラハシ 寺端 +テラハタ 寺畑 +テラハタ 寺畠 +テラハタ 寺端 +テラバタ 寺端 +テラバタケ 寺畠 +テラハナ 寺鼻 +テラハナ 寺花 +テラハマ 寺浜 +テラハマ 寺濱 +テラバヤシ 寺林 +テラハラ 寺原 +テラバル 寺原 +テラヒガシ 寺東 +テラヒラ 寺平 +テラヒロ 寺広(寺廣) +テラブ 寺生 +テラフク 寺福 +テラフジ 寺藤 +テラブン 寺分 +テラベ 寺部 +テラベ 寺辺(寺邉) +テラベ 寺邊 +テラボウ 寺坊 +テラホカ 寺外 +テラホラ 寺洞 +テラホリ 寺堀 +テラボリ 寺堀 +テラマ 寺馬 +テラマ 寺間 +テラマ 寺真(寺眞) +テラマエ 寺前 +テラマサ 寺政 +テラマス 寺増 +テラマス 寺升 +テラマチ 寺町 +テラマツ 寺松 +テラマル 寺丸 +テラマワリ 寺廻 +テラミ 寺見 +テラミ 寺美 +テラミチ 寺道 +テラミツ 寺光 +テラミナミ 寺南 +テラミネ 寺峰(寺峯) +テラムカイ 手良向 +テラムラ 寺村 +テラムラ 寺邑 +テラムラ 手良村 +テラメン 寺面 +テラモト 寺本 +テラモト 寺元 +テラモリ 寺森 +テラモリ 寺守 +テラモン 寺門 +テラヤ 寺谷 +テラヤ 寺家 +テラヤ 寺屋 +テラヤ 寺矢 +テラヤシキ 寺屋敷 +テラヤチ 寺谷内 +テラヤマ 寺山 +テラヨコ 寺横 +テラヨシ 寺吉 +テラワ 寺輪 +テラワカ 寺若 +テラワキ 寺脇 +テラワキ 寺分 +テラワキ 手良脇 +テラワケ 寺分 +テラワケ 寺訳(寺譯) +デリハ 出利葉 +テル 輝 +テル 暉 +テルイ 照井 +テルイ 輝井 +テルウチ 照内 +テルウチ 輝内 +テルオ 輝尾 +テルオ 照尾 +テルオカ 照岡 +テルオカ 輝岡 +テルオカ 暉峻 +テルカド 照門 +テルカワ 照川 +テルカワ 輝川 +テルキ 光木 +テルキ 照木 +テルキナ 照喜名 +テルキナ 照喜納 +テルゴ 照後 +テルサキ 照崎 +テルサワ 照沢 +テルサワ 照澤 +テルシタ 照下 +テルシマ 照島 +テルシマ 照嶋 +テルシマ 照嶌 +テルシン 照信 +テルセ 照瀬 +テルタ 照田 +テルツキ 照月 +テルド 照戸 +テルトキ 照時 +テルナガ 照永 +テルニシ 輝西 +テルヌマ 照沼 +テルバヤシ 照林 +テルハラ 照原 +テルヒ 照日 +テルヒラ 輝平 +テルヒラ 照平 +テルミ 照海 +テルミチ 曄道 +テルミツ 照光 +テルミネ 照峰 +テルモト 照本 +テルモト 輝本 +テルモト 照元 +テルモト 暉本 +テルモト 輝元 +テルヤ 照屋 +テルヤ 照谷 +テルヤ 照哉 +テルヤス 晄安 +テルヤス 晄晏 +テルヤマ 照山 +テルヨシ 輝吉 +テロウ 手老 +テロウチ 手呂内 +デロマチ 出呂町 +デワ 出羽 +デワ 出葉 +デワ 出和 +デワキ 出分 +デワキ 出脇 +デワケ 出分 +デワサワ 出羽沢 +デワサワ 出羽澤 +デワザワ 出羽澤 +デワノ 出羽野 +テン 天 +デン 伝 +デン 田 +デン 傳 +デン 傅 +テンイチ 天一 +テンオウ 天王 +テンガ 天賀 +テンカイ 天下井 +テンカジ 天花寺 +テンカツ 天勝 +テンカワ 天川 +テンガン 天願 +テンキュウ 天久 +テンキュウ 天休 +テンギュウ 天牛 +テンキョウ 天京 +テンギョク 天玉 +テンク 天句 +テンク 天工 +テングイシ 天狗石 +テングキ 天狗木 +テンクモ 天雲 +デンケイ 田計 +テンゲイジ 天花寺 +テンゲジ 天花寺 +テンコ 天古 +テンゴ 天後 +デンゴ 田悟 +テンコウ 天光 +テンコウ 天幸 +テンコウ 天高 +テンコウ 天孝 +テンゴウ 天郷 +デンコウ 伝幸(傳幸) +デンサ 伝佐(傳佐) +テンサカ 天坂 +テンサカ 天阪 +デンサカ 伝坂 +テンザキ 天崎 +デンサキ 伝崎(傳崎) +デンシ 伝四 +テンジク 天竺 +テンジクカツラ 天竺桂 +テンシマ 天島 +テンシャ 天社 +デンショ 殿所 +テンショウ 天正 +テンショウ 転正(轉正) +テンジョウ 天井 +テンジョウ 天上 +デンショウ 伝庄(傳庄) +デンジョウ 伝城 +デンジョウ 伝条 +デンジョウ 伝條 +デンジョウ 傳城 +テンシン 天新 +テンシン 天信 +テンジン 天神 +テンジン 天甚 +テンジンキ 天神木 +テンジンゾノ 天神園 +テンジンバヤシ 天神林 +テンジンバル 天神原 +テンジンヤマ 天神山 +デンス 伝須 +テンスイ 天水 +テンズイザン 天瑞山 +テンスケ 天助 +デンズミ 伝住 +デンズミ 傅住 +デンズミ 傳住 +テンセイイン 天聖院 +テンゼン 天前 +テンゾウ 天造 +テンダ 天田 +テンダ 点田 +テンダ 點田 +デンタ 伝田 +デンタ 傳田 +デンダ 伝田 +デンダ 傳田 +デンダ 傅田 +デンダイ 伝代 +テンタク 天宅 +テンタニ 天谷 +デンタニ 伝谷 +デンタニ 傳谷 +テンチ 天地 +デンチダ 伝地多(傳地多) +デンチョウ 伝長(傳長) +テンツボ 天坪 +テンデ 天前 +デンデン 傳田 +テント 天渡 +テンド 天堵 +テントウ 天藤 +テントウ 天筒 +テントウ 点頭 +テントウ 点東 +テントウ 點東 +テンドウ 天童 +テンドウ 天藤 +テンドウ 天道 +テンドウ 天堂 +テンドウ 転堂 +デンドウ 田頭 +デンドウ 伝刀 +デンドウ 伝道 +デンドウ 田遠 +デンドウ 傳刀 +デンドウ 傅刀 +デンドウ 傅道 +デンドウ 傳道 +デンドオ 田遠 +テントク 天徳 +テントク 点得 +テントクジ 天徳寺 +テントラ 天寅 +テンナイ 天内 +デンナイ 伝内 +デンナミ 伝並 +テンナン 天南 +テンニチ 天日 +テンネン 天然 +テンノ 天野 +テンノ 奠乃 +デンノ 田野 +デンノ 伝野 +デンノ 傳野 +デンノ 傅野 +テンノウ 天納 +テンノウ 天能 +デンノウ 伝農 +デンノウ 伝能(傳能) +デンノウ 傳農 +テンノウザワ 天王沢(天王澤) +テンノウジ 天王地 +テンノウジ 天王寺 +テンノウジタニ 天王寺谷 +テンノウジダニ 天王寺谷 +テンノウジヤ 天王寺谷 +テンノカワ 𧲸革 +テンノカワ 天野川 +テンノツジ 天之辻 +テンノミ 天呑 +テンノミヤ 天野宮 +テンノミヤ 天之宮 +テンバ 天羽 +テンバ 天場(天塲) +デンバ 伝羽 +テンパク 天白 +テンバタ 天畠 +デンヒラ 田平 +デンヒラ 伝平 +デンヒラ 傳平 +デンビラ 田平 +テンヒロ 天広 +テンヒロ 天廣 +テンビン 天秤 +テンプク 天福 +デンフク 伝福 +デンフク 傳福 +デンプク 伝福 +デンプク 傳福 +テンポ 天保 +テンポ 転保 +デンボ 伝保 +デンポ 伝甫 +デンポ 伝保 +デンポ 傅甫 +デンポ 傳甫 +デンポ 傳保 +テンボウ 天坊 +テンポウ 天法 +デンボウ 傳法 +デンボウ 傳寳 +デンポウ 伝法 +デンポウ 伝宝(傳宝・傳寶) +デンポウ 傳法 +デンポウ 傅法 +デンポウ 傳寳 +デンポウジ 伝法寺 +デンポウジ 傳法寺 +デンポウヤ 伝法谷 +デンポウヤ 傳法谷 +デンポウヤ 傅法谷 +テンポウリン 転法輪 +テンポウリン 轉法輪 +テンマ 天満(天滿) +テンマ 天間 +テンマ 天摩(天广) +テンマ 天麻 +テンマ 天磨 +テンマ 転馬(轉馬) +テンマ 天眞 +テンマ 天真 +テンマ 天馬 +デンマ 伝馬 +デンマ 傳馬 +デンマ 傅馬 +テンマダテ 天間館 +テンマダテ 天間舘 +テンマド 天満戸 +テンマヤ 天満屋 +テンマヤ 天満谷 +テンマヤシキ 天満屋敷 +テンマル 天丸 +テンマン 天満(天滿) +テンマンヤ 天満谷 +テンマンヤシキ 天満屋敷 +テンマンヤシキ 天間屋敷 +デンミ 伝見 +テンミズ 天水 +テンミョウ 天明 +テンミョウ 天命 +デンミョウジ 伝明地 +デンミョウジ 伝明寺 +デンミョウジ 傳明地 +テンミョウヤ 天明屋 +テンムラ 天村 +テンメイ 天明 +テンメイヤ 天明屋 +テンモウ 天毛 +テンモク 天目 +テンモト 天本 +テンモト 天元 +テンヤ 天谷 +デンヤ 伝谷 +デンヤ 傅谷 +デンヤ 傳谷 +テンヤク 天薬 +テンヤマ 天山 +テンラ 天良 +テンライ 天雷 +テンリ 天利 +デンリ 伝里 +デンリ 傳里 +テンリャク 典略 +テンリュウ 天竜 +テンリュウ 天龍 +ト 戸 +ドアイ 土合 +ドアイ 道合 +ドアイ 渡合 +ドアイ 度合 +トアキ 戸明 +トアケ 十朱 +トアミ 頓阿弥 +ドアミ 道網 +ドアミ 土網 +ドアン 土庵 +トイ 土肥 +トイ 戸井 +トイ 渡井 +トイ 都井 +トイ 外井 +トイ 樋 +トイ 問 +トイ 登井 +トイ 問井 +ドイ 土井 +ドイ 筒井 +ドイ 土居 +ドイ 土肥 +ドイ 戸井 +ドイ 道井 +ドイイケ 土井池 +ドイウチ 土井内 +ドイウチ 土居内 +ドイウラ 土井浦 +トイエ 十家 +ドイオカ 土井岡 +ドイオカ 土居岡 +ドイガキ 土井垣 +ドイガキウチ 土井垣内 +ドイガミ 土井上 +トイカワ 樋川 +トイカワ 問川 +トイカワ 戸井川 +トイガワ 樋川 +トイガワ 戸井川 +ドイカワ 土井川 +ドイカワ 土居河 +ドイカワ 土居川 +ドイガワ 土井川 +ドイギシ 土居岸 +トイグチ 戸井口 +トイグチ 渡井口 +トイグチ 問口 +トイグチ 筧口 +ドイグチ 土井口 +ドイグチ 土肥口 +トイケ 外池 +ドイケ 土池 +ドイケ 土井池 +ドイゴウチ 土井垣内 +トイサカ 問坂 +トイサキ 戸井崎 +トイザキ 樋崎 +トイザキ 戸井崎 +ドイサキ 土居崎 +ドイザキ 土斐崎 +ドイザキ 土居崎 +ドイサコ 土井迫 +トイサワ 樋沢 +トイサワ 樋澤 +トイザワ 樋沢 +トイザワ 樋澤 +トイシ 戸石 +トイシ 砥石 +トイシ 外石 +トイシ 登石 +トイシ 斗石 +トイシ 渡石 +ドイシ 土石 +ドイジ 土井地 +ドイジ 土居地 +トイシカワ 戸石川 +トイシカワ 砥石川 +トイシガワ 戸石川 +トイシガワ 研川 +トイシガワ 土石川 +ドイシゲ 土居重 +ドイシゲ 土井重 +トイシタ 樋下 +ドイシタ 土井下 +ドイシタ 土居下 +トイシタニ 砥谷 +トイシダニ 砥谷 +トイシバ 問芝 +ドイジリ 土井尻 +トイズミ 戸泉 +トイズミ 樋泉 +ドイズミ 土泉 +ドイゾエ 土井添 +トイタ 樋田 +トイタ 戸井田 +トイタ 戸板 +トイタ 筧田 +トイタ 問田 +トイタ 砥板 +トイダ 樋田 +トイダ 戸井田 +トイダ 土井田 +トイダ 筧田 +トイダ 問田 +ドイタ 土井田 +ドイタ 据田 +ドイタ 𡍄田 +ドイダ 土井田 +ドイダ 土居田 +トイタニ 問谷 +トイタニ 樋谷 +トイダニ 樋谷 +ドイタニ 土井谷 +トイチ 十一 +トイチ 十市 +トイチ 都市 +トイチ 辻市 +トイチ 戸市 +ドイチ 土市 +ドイチ 土一 +トイツ 戸井津 +トイヅメ 樋爪 +トイヅメ 樋詰 +トイヅメ 筧爪 +トイヅメ 戸井詰 +トイデ 戸出 +トイデ 都出 +トイデ 砥出 +トイデ 登出 +ドイトミ 土井富 +トイナカ 筧中 +トイナガ 樋永 +トイナガ 戸井永 +ドイナカ 土井中 +ドイナガ 土井長 +ドイネ 土井根 +トイノ 樋野 +ドイノ 土肥野 +ドイノ 土居野 +ドイノ 土井野 +ドイノウチ 土居ノ内 +ドイノブ 土井信 +トイハタ 問端 +トイバタ 樋端 +ドイハタ 土井畑 +ドイバタ 土井畑 +トイバナ 樋端 +トイハラ 樋原 +トイハラ 戸井原 +トイバラ 樋原 +ドイハラ 土井原 +ドイハラ 土居原 +ドイハラ 土肥原 +ドイバラ 土井原 +ドイフジ 土井藤 +トイマ 戸井間 +ドイマサ 土井政 +ドイマル 土井丸 +ドイミツ 土井光 +トイモト 樋本 +トイモト 筧本 +トイモト 問本 +トイモト 戸井本 +トイモト 渡井本 +ドイモト 土井本 +ドイモト 土居本 +ドイモリ 土居森 +トイヤ 問谷 +トイヤ 問屋 +トイヤ 問矢 +トイヤマ 問山 +ドイヤマ 土井山 +ドイラ 土井良 +トイリ 戸入 +ドイワキ 土井脇 +ドイワキ 土居脇 +トウ 東 +トウ 藤 +トウ 党 +トウ 當 +トウ 棟 +トウ 桃宇 +トウ 黨 +トウ 刀 +トウ 籐 +トウ 燈 +トウ 塔 +ドウ 堂 +ドウ 道 +ドウ 銅 +ドウアト 堂跡 +ドウアミ 道網 +トウアン 藤庵 +ドウアン 堂安 +トウイ 東井 +トウイ 遠井 +トウイ 東居 +ドウイ 道井 +ドウイ 洞井 +ドウイ 堂井 +ドウイシ 堂石 +トウイチ 東一(東壱) +トウイチボウ 東一坊 +トウイチボウ 東一昉 +トウイワ 東岩 +トウイン 藤院 +トウイン 東院 +トウウ 東宇 +ドウウエ 堂上 +トウウチ 当内 +トウウチ 當内 +ドウウチ 洞内 +ドウウチ 堂内 +ドウウネ 堂畝 +ドウウマ 堂馬 +トウウラ 東浦 +ドウウラ 堂浦 +ドウウラ 堂裏 +トウエ 戸上 +トウエ 東江 +トウエ 遠江 +トウエ 当江 +トウエ 當江 +ドウエ 道江 +トウエイ 藤栄 +トウエイ 東永 +トウエイ 桐栄(桐榮) +トウエイ 藤榮 +ドウエイ 道永 +トウエン 桃園 +トウエン 戸円(戸圓) +トウエン 東円 +ドウエン 道円 +ドウエン 道圓 +トウオ 塔尾 +ドウオ 堂尾 +トウオカ 東岡 +トウオカ 塔岡 +ドウオカ 堂岡 +トウオガワ 東小川 +トウオク 東奥 +ドウオン 道音 +トウカ 藤家 +トウカ 東歌 +トウカ 董家 +トウガ 藤賀 +トウガ 東河 +トウガ 冬賀 +トウガ 東賀 +ドウカ 堂加 +ドウカ 道過 +ドウガ 堂賀 +ドウガ 道賀 +トウカイ 東海 +ドウカイ 百海 +ドウカイ 道海 +ドウカイ 道貝 +ドウガイ 道貝 +ドウガイ 洞外 +トウカイエ 東海枝 +トウカイチ 十日市 +ドウガイチ 堂垣内 +ドウガイト 道垣内 +ドウガイト 堂垣戸 +トウカイヤ 東海谷 +トウカイリン 東海林 +ドウガウチ 堂河内 +ドウガウチ 道垣内 +ドウガウチ 堂垣内 +トウカエ 東海枝 +ドウガオ 堂ケ尾 +トウガキ 東垣 +ドウガキ 堂垣 +ドウガキ 堂柿 +トウガキウチ 東垣内 +ドウガキウチ 道垣内 +ドウガキナイ 堂垣内 +トウカク 東角 +トウカク 東覚(東覺) +トウガク 東学 +ドウカク 道角 +ドウカク 堂角 +ドウカク 道格 +ドウカクダ 堂角田 +トウガサ 唐笠 +トウガサキ 東ケ崎(東ケ嵜) +トウガサキ 塔ケ崎 +トウガサキ 東ケ埼 +ドウガサキ 堂ケ崎 +ドウガサワ 堂ケ沢 +ドウガサワ 堂ケ澤 +トウガシ 藤樫 +トウガシマ 東ケ島 +ドウガセ 洞ケ瀬 +ドウカタ 道方 +トウガネ 当金 +トウガネ 東金 +トウガネ 當金 +ドウガネ 銅金 +ドウガハナ 堂ケ端 +ドウガハラ 堂ケ原 +ドウガヒラ 堂ケ平 +ドウガマ 銅釜 +トウカミ 東上 +トウガミ 東上 +ドウガミ 堂上 +トウカワ 東川 +トウカワ 当川 +トウカワ 當川 +トウガワ 東川 +トウガワ 騰川 +ドウカワ 道川 +ドウカワ 堂川 +ドウカワ 洞川 +ドウカワ 銅川 +ドウガワ 道川 +ドウガワ 堂川 +ドウガワチ 堂河内 +トウカン 東閑 +トウガン 東岸 +ドウカン 道菅 +ドウカン 道官 +ドウカン 道勧 +ドウカン 堂官 +ドウカン 堂閑 +ドウカン 道寛 +ドウカン 道貫 +ドウカン 道閑 +ドウカン 道管 +ドウカン 堂棺 +ドウカン 道勘 +ドウカン 道観 +ドウガン 道願 +ドウガン 堂岸 +ドウガン 道貫 +ドウガン 堂願 +トウキ 唐木 +トウキ 東木 +トウキ 登喜 +トウキ 遠木 +トウキ 東鬼 +トウキ 陶器 +トウキ 登記 +トウキ 東帰 +トウキ 當木 +トウキ 当喜 +トウキ 當喜 +トウキ 当岐 +トウギ 東儀 +トウギ 当木 +トウギ 當木 +トウギ 東偽 +ドウキ 道木 +ドウキ 道喜 +ドウキ 銅城 +ドウキ 道鬼 +ドウキ 銅木 +ドウキ 堂木 +ドウギ 道木 +トウギシ 東岸 +ドウギシ 堂岸 +ドウキタ 堂北 +トウキュウ 東久 +ドウキュウ 道久 +ドウキュウ 道休 +ドウキュウ 道旧(道舊) +トウキョウ 東京 +ドウキョウ 道京 +ドウキョウ 同京 +ドウキョウ 道教 +ドウギョウジリ 同形尻 +トウギョク 東旭 +トウキン 当金 +トウキン 頭巾 +トウキン 東金 +トウキン 頭金 +トウキン 當金 +トウキン 當巾 +トウギン 当銀 +トウギン 當銀 +トウギン 常銀 +ドウギン 銅銀 +トウク 藤九 +トウグ 当具 +トウグ 藤具 +トウグ 當具 +ドウク 道工 +ドウグ 道具 +トウグウ 東宮 +トウクス 藤楠 +ドウグダニ 道具谷 +トウグチ 東口 +トウグチ 筒口 +ドウグチ 洞口 +ドウグチ 道口 +ドウグチ 堂口 +ドウグチ 筒口 +ドウグチ 鉛口 +ドウグチ 銅口 +トウクニ 遠国 +ドウクニ 堂国 +ドウクニ 堂國 +トウクボ 東久保 +トウクボ 東窪 +ドウクボ 堂久保 +ドウクボ 堂窪 +トウクラ 藤倉 +トウクラ 東倉 +トウクラ 等倉 +ドウグロ 堂黒 +トウグン 東郡 +トウケ 藤家 +トウケ 東家 +トウゲ 峠 +トウゲ 垰 +トウゲ 東家 +トウゲ 唐下 +トウゲ 藤解 +トウゲ 藤花 +トウゲ 塔下 +トウゲ 当毛 +トウゲ 峠ヶ +ドウケ 道家 +ドウケ 堂家 +ドウゲ 道下 +ドウゲ 堂下 +ドウゲ 道解 +トウケイ 桐渓 +トウケイ 東渓 +トウゲイ 東迎 +トウゲイ 峠井 +ドウケイ 道慶 +ドウケイ 洞鶏 +ドウケイ 洞鷄 +ドウケイ 洞雞 +トウゲウラ 峠浦 +トウゲグチ 峠口 +トウゲサカ 峠坂 +トウゲザカ 峠坂 +トウゲサキ 峠崎 +トウゲザキ 峠崎 +トウゲシタ 峠下 +トウゲダ 峠田 +トウゲダオ 峠垰 +トウゲダテ 峠舘 +トウゲダテ 峠館 +トウゲタニ 峠谷 +トウゲダニ 峠谷 +トウゲツ 藤月 +トウゲナカ 峠中 +トウゲハラ 峠原 +トウゲモト 峠元 +トウゲヤ 峠谷 +トウゲヤマ 峠山 +トウケン 東軒 +トウゲン 東源 +トウゲン 東現 +トウゲン 東権 +ドウケン 道券 +ドウゲン 道元 +ドウゲン 道源 +ドウゲン 道言 +ドウゲン 銅玄 +ドウゲン 道玄 +トウコ 東狐 +トウコ 東古 +トウコ 東孤 +トウコ 東湖 +トウゴ 藤後 +トウゴ 東後 +トウゴ 東后 +トウゴ 藤吾 +トウゴ 十五 +トウゴ 島後 +トウゴ 東護 +トウゴ 棟語 +トウゴ 藤五 +トウゴ 唐吾 +トウゴ 籐後 +ドウコ 道古 +ドウコ 銅子 +ドウコ 堂故 +ドウゴ 堂後 +ドウゴ 道後 +トウコウ 東口 +トウコウ 東岡 +トウコウ 東光 +トウコウ 東向 +トウコウ 藤稿 +トウコウ 東耕 +トウコウ 東猴 +トウコウ 東候 +トウコウ 東功 +トウゴウ 東郷 +トウゴウ 十河 +トウゴウ 東江 +トウゴウ 藤郷 +トウゴウ 十合 +トウゴウ 稲郷 +トウゴウ 東合 +トウゴウ 当郷 +トウゴウ 當郷 +トウゴウ 當合 +ドウコウ 道幸 +ドウコウ 洞江 +ドウコウ 道光 +ドウゴウチ 堂河内 +ドウゴウチ 道垣内 +トウコク 東谷 +トウゴク 東国 +トウゴシ 遠越 +トウゴシ 東越 +ドウコシ 堂腰 +ドウコシ 堂越 +ドウゴシ 堂腰 +ドウゴシ 堂越 +ドウコジマ 道小島 +ドウゴミ 堂込 +ドウゴメ 堂込 +ドウゴモリ 堂込 +ドウゴモリ 堂籠 +ドウゴモリ 堂龍 +ドウゴモリ 堂篭 +ドウゴモリ 道込 +ドウゴヤ 道後屋 +ドウコロ 道頃 +トウゴン 東権 +ドウコン 道紺 +ドウゴン 道言 +トウサ 藤佐 +トウサ 豆佐 +トウザ 当座 +トウザ 當座 +ドウザ 銅座 +トウザイ 東西 +ドウサイ 道斉 +ドウサイ 道済 +ドウサイ 道才 +ドウサイ 道斎 +ドウサイ 道齊 +トウサカ 登坂 +トウサカ 東坂 +トウサカ 遠坂 +トウサカ 東阪 +トウサカ 刀坂 +トウサカ 唐坂 +トウサカ 当坂(當坂) +トウザカ 東坂 +トウザカ 東阪 +ドウサカ 堂坂 +ドウサカ 道坂 +ドウサカ 堂阪 +ドウサカ 道阪 +ドウサカ 銅坂 +ドウザカ 堂坂 +ドウザカ 堂阪 +トウサカキ 東榊 +トウサキ 藤崎 +トウサキ 東崎 +トウサキ 塔崎 +トウサキ 党崎 +トウサキ 黨崎 +トウザキ 東崎 +トウザキ 塔崎 +トウザキ 党崎 +トウザキ 塘崎 +トウザキ 冬崎 +ドウサキ 堂崎 +ドウサキ 同崎 +ドウサキ 銅崎 +ドウザキ 堂崎 +ドウザキ 道崎 +ドウザキ 堂嵜 +ドウザキ 銅崎 +トウサク 当作(當作) +トウサコ 塔迫 +トウサコ 東佐古 +トウザコ 東迫 +ドウサコ 堂迫 +ドウサコ 道迫 +トウザト 遠里 +トウサハラ 藤佐原 +トウサワ 東沢 +トウサワ 東澤 +トウサワ 遠沢 +トウザワ 東沢 +トウザワ 東澤 +ドウサン 道三 +ドウザン 堂山 +ドウザン 銅山 +トウシ 唐司 +トウシ 東使 +トウシ 東志 +トウシ 藤士 +トウシ 簏 +トウシ 東市 +トウシ 東枝 +トウジ 田路 +トウジ 東地 +トウジ 藤次 +トウジ 通事 +トウジ 東司 +トウジ 唐司 +トウジ 冬至 +トウジ 杜氏 +トウジ 藤司 +トウジ 牡司 +トウジ 当時 +トウジ 導寺 +ドウシ 道志 +ドウジ 道地 +ドウジ 堂路 +ドウジ 道司 +ドウジ 堂寺 +ドウジ 童子 +ドウジ 道次 +トウジガモリ 当寺ケ盛 +トウジガモリ 當寺ケ盛 +ドウジガモリ 堂寺ケ盛 +トウジガワ 当寺河 +トウジクボ 当時久保 +トウジクボ 當時久保 +トウシタ 塔下 +ドウシタ 堂下 +トウジタニ 唐治谷 +ドウシチ 堂七 +トウジツ 東実 +トウシバ 東芝 +ドウシバ 堂芝 +トウシマ 藤島 +トウシマ 東島 +トウシマ 遠島 +トウシマ 遠嶋(遠嶌) +トウシマ 当島 +トウシマ 當島 +トウシマ 東嶌 +トウジマ 東島 +トウジマ 遠島 +トウジマ 遠嶋(遠嶌) +トウジマ 東嶋 +トウジマ 頭島 +トウジマ 答島 +トウジマ 塔島(塔嶌) +トウジマ 統島 +ドウジマ 道島 +ドウジマ 道嶋 +ドウジマ 堂島 +ドウジマ 銅島 +ドウジマ 堂嶋 +トウシミズ 藤志水 +トウジモリ 当寺盛 +トウジモリ 当時盛 +トウジモリ 當寺盛 +トウシャ 藤社 +トウシャ 当舎 +トウシャ 當舎 +トウシャ 籐社 +トウジヤ 唐治谷 +トウジュ 東樹 +トウジュウ 当重 +トウジュウ 東重 +トウジュウ 当住(當住) +トウジュウ 當重 +ドウジュン 道順 +トウショ 東所 +トウショ 当所(當所) +ドウショ 堂処 +ドウショ 堂所 +トウショウ 東松 +トウショウ 藤正 +トウショウ 東生 +トウショウ 東庄 +トウショウ 東照 +トウショウ 東正 +トウショウ 当正 +トウショウ 當正 +トウジョウ 東条 +トウジョウ 東條 +トウジョウ 藤城 +トウジョウ 東城 +トウジョウ 東上 +トウジョウ 藤乗 +トウジョウ 藤條 +トウジョウ 藤条 +トウジョウ 登城 +トウジョウ 東篠 +トウジョウ 東生 +トウジョウ 棟上 +トウジョウ 東定 +トウジョウ 東浄 +トウジョウ 東絛 +トウジョウ 洞城 +トウジョウ 東淨 +トウジョウ 当城 +トウジョウ 統場 +トウジョウ 藤乘 +トウジョウ 籐乗 +トウジョウ 籐乘 +ドウショウ 道正 +ドウショウ 同姓 +ドウジョウ 道上 +ドウジョウ 道場 +ドウジョウ 堂上 +ドウジョウ 道城 +ドウジョウ 堂城 +ドウジョウ 銅城 +ドウジョウ 堂丈 +ドウジョウ 洞城 +ドウジョウ 道浄 +トウショウジ 東照寺 +トウショウジ 東正路 +トウジョウベップ 東上別符 +ドウジリ 堂尻 +ドウシロ 堂代 +トウシン 東新 +トウシン 東真 +トウシン 登神 +トウシン 東眞 +トウシン 当新 +トウジン 唐仁 +ドウシン 道心 +ドウシンバシ 堂新橋 +トウジンバラ 唐仁原 +トウス 唐須 +トウズ 当津 +ドウス 道須 +ドウズ 道頭 +トウスエ 東末 +トウズカ 東塚 +トウスケ 任介 +トウスケ 藤助 +トウスジ 塔筋 +トウズミ 藤住 +トウズミ 東住 +トウズミ 藤泉 +ドウズミ 銅住 +ドウズミ 道住 +トウセ 東瀬 +トウセ 当瀬 +トウセ 遠勢 +トウセ 當瀬 +トウセ 遠瀬 +ドウセ 道瀬 +ドウセ 堂瀬 +トウセイ 東生 +トウセイ 東清 +ドウセイ 道姓 +ドウセイ 道清 +トウセキ 東石 +ドウセキ 道関 +トウセン 東泉 +トウセン 東仙 +トウセン 藤仙 +トウゼン 東膳 +トウゼン 東漸 +ドウセン 道仙 +ドウセン 道先 +ドウセン 銅銭 +ドウゼン 堂前 +ドウゼン 道前 +ドウゼン 同前 +ドウゼン 道善 +ドウソ 道祖 +ドウソ 導𡏄 +トウゾエ 塘添 +ドウゾエ 堂添 +ドウソダ 道祖田 +ドウソデン 道祖田 +ドウソノ 堂園 +ドウソノ 堂薗 +ドウゾノ 堂園 +ドウゾノ 堂薗 +ドウゾノ 道園 +ドウゾノ 堂囿 +トウソン 東村 +トウソン 当尊 +トウソン 當尊 +トウタ 遠田 +トウタ 当田 +トウタ 塔田 +トウダ 東田 +トウダ 遠田 +トウダ 任田 +トウダ 当田 +トウダ 塘田 +トウダ 燈田 +トウダ 當田 +トウダ 塔田 +トウダ 刀田 +トウダ 頭田 +トウダ 等田 +トウダ 糖田 +トウダ 橙田 +ドウタ 堂田 +ドウダ 道田 +ドウダ 堂田 +ドウダ 洞田 +トウダイ 東岱 +トウダイ 東代 +トウダイ 燈台 +トウダイ 当代 +トウダイ 當代 +ドウタイ 道躰 +ドウタイ 道体 +ドウタイ 道體 +トウダイジ 東大寺 +ドウタカ 堂高 +トウタキ 東滝 +トウタキ 東瀧 +トウタケ 藤武 +トウタケ 遠竹 +トウタケ 藤竹 +トウタケ 遠武 +トウタケ 遠獄 +トウダケ 遠岳 +ドウタケ 堂嶽 +トウダテ 東館 +トウダテ 東舘 +トウタニ 東谷 +トウタニ 唐谷 +トウタニ 刀谷 +トウタニ 遠谷 +トウタニ 当谷(當谷) +トウタニ 塔谷 +ドウタニ 堂谷 +ドウタヌキ 洞田貫 +ドウダヌキ 洞田貫 +ドウタレ 堂垂 +ドウダレ 堂垂 +ドウタン 道丹 +ドウダン 堂段 +トウチ 登内 +トウチ 戸内 +トウチ 東地 +トウチ 斗内 +トウチ 十市 +トウチ 当内 +トウチ 塘地 +トウチ 藤地 +トウチ 東落 +トウチ 頭地 +トウチ 當内 +ドウチ 堂地 +ドウチ 道地 +ドウチ 道智 +ドウチ 同地 +ドウチ 堂知 +トウチカ 遠近 +トウチカ 藤近 +トウチカ 東近 +ドウチュウ 道中 +ドウチュウウチ 道中内 +ドウチョウ 同町 +ドウチョク 銅直 +ドウチン 道鎮 +ドウチン 堂珍 +ドウチン 道珍 +ドウチン 道鎭 +トウツ 東津 +トウツ 当津 +トウツ 當津 +ドウツ 道津 +ドウヅ 道津 +トウツカ 遠塚 +トウツカ 東塚 +トウヅカ 東塚 +トウヅカヤ 遠塚谷 +ドウツキ 銅突 +トウツジ 東辻 +トウツジ 藤辻 +トウツネ 東常 +ドウツボ 堂坪 +トウツラ 東面 +トウデ 東出 +ドウテ 道手 +ドウデ 道出 +ドウデ 堂出 +ドウテイ 道庭 +トウテツ 東鉄 +トウデラ 東寺 +ドウテラ 堂寺 +ドウデラ 堂寺 +トウテン 当天(當天) +トウデン 東田 +ドウデン 道伝 +ドウデン 堂伝 +ドウデン 道傳(道傅) +ドウデン 銅伝(銅傳) +トウト 東都 +トウド 東度 +トウド 藤土 +トウド 東渡 +ドウド 堂土 +トウドウ 藤堂 +トウドウ 東藤 +トウドウ 東堂 +トウドウ 登藤 +トウドウ 東道 +トウドウ 東頭 +トウドウ 藤東 +トウドウ 籐堂 +トウドウ 東等 +トウドウ 任堂 +トウドウ 藤当 +トウドウ 藤桐 +トウドウ 登籐 +トウドウ 当堂 +トウドウ 当道 +トウドウ 藤當 +トウドウ 滔々 +トウドウ 唐堂 +トウドウ 東童 +ドウトウ 道藤 +ドウトウ 堂東 +ドウトウ 堂藤 +ドウトウ 洞筒 +ドウトウ 道東 +ドウトウ 堂当 +ドウトウ 堂當 +ドウドウ 百々 +ドウドウ 堂道 +ドウドウ 銅道 +ドウドウ 同道 +ドウドウ 堂々 +ドウドウ 道堂 +ドウドウ 道々 +ドウドウ 動道 +ドウドウ 同々 +ドウドウ 道同 +ドウドウ 銅堂 +ドウドウ 働々 +ドウドウ 童銅 +ドウドウ 銅々 +トウドウチ 遠々内 +トウドウウチ 遠々内 +トウトク 藤得 +ドウトク 道徳 +ドウトク 堂徳 +ドウトク 道篤 +ドウトコ 堂床 +トウトミ 遠富 +トウトミ 東富(東冨) +ドウトミ 堂富 +トウドリ 十鳥 +トウナイ 藤内 +トウナイ 東内 +トウナイ 唐内 +トウナイ 籐内 +ドウナイ 洞内 +ドウナイ 道内 +ドウナエ 道苗 +ドウナオ 銅直 +トウナカ 東中 +トウナカ 当仲 +トウナカ 燈中 +トウナカ 當仲 +トウナカ 灯中 +トウナガ 東長 +ドウナカ 堂中 +トウナシ 唐梨子 +トウナミ 当波 +トウナミ 當波 +トウナミ 東波 +トウナン 東南 +トウナン 藤南 +トウニシ 遠西 +トウニシ 東西 +ドウニシ 堂西 +ドウニワ 洞庭 +ドウニワ 道庭 +ドウニワ 堂庭 +トウネ 藤根 +トウネ 東根 +トウネ 峠根 +ドウネ 堂根 +ドウネン 道念 +ドウネン 堂念 +トウノ 藤野 +トウノ 東野 +トウノ 遠野 +トウノ 東埜 +トウノ 当野 +トウノ 投野 +トウノ 塔野 +トウノ 塔尾 +トウノ 十野 +トウノ 唐野 +トウノ 當野 +トウノ 登埜 +トウノ 嶝野 +トウノ 等農 +トウノ 陶野 +トウノ 東乃 +トウノ 峠野 +ドウノ 道野 +ドウノ 堂野 +ドウノ 堂埜 +ドウノ 洞野 +ドウノ 銅野 +トウノウ 東納 +トウノウ 等農 +トウノウ 東農 +トウノウエ 塔ノ上 +トウノウエ 塔上 +ドウノウエ 堂上 +ドウノウエ 堂之上 +ドウノウエ 堂ノ上 +トウノウチ 峠之内 +ドウノウチ 堂内 +ドウノウチ 堂ノ内 +ドウノウラ 堂ノ浦 +トウノエ 遠江 +トウノエ 遠ノ江 +トウノオ 東尾 +ドウノオ 堂ノ尾 +トウノオカ 塔岡 +トウノオカ 塔野岡 +トウノオカ 塔之岡 +トウノキ 唐木 +トウノキ 東木 +ドウノクチ 堂ノ口 +トウノサカ 当野坂 +ドウノサキ 堂野崎 +トウノシ 唐司 +トウノシタ 峠野下 +ドウノシタ 堂下 +ドウノシタ 堂ノ下 +ドウノシタ 堂之下 +トウノス 鴇巣 +トウノス 唐司 +トウノス 鵫巣 +トウノス 鶇巣 +ドウノセ 堂ノ瀬 +ドウノセ 堂の瀬 +ドウノマエ 堂野前 +ドウノマエ 堂之前 +ドウノマエ 堂ノ前 +ドウノモト 堂ノ本 +ドウノモト 堂之本 +ドウノモト 堂野元 +ドウノモト 堂ノ元 +トウノヤ 東野谷 +ドウノワキ 堂ノ脇 +ドウノワキ 堂之脇 +トウハ 洞派 +トウバ 藤庭 +トウバ 東場 +ドウバ 道端 +ドウバ 道場 +ドウバ 洞庭 +ドウバ 堂場 +トウバイ 東梅 +トウバエ 東八重 +トウハク 東泊 +ドウハク 道白 +ドウハク 銅白 +トウハシ 東橋 +ドウハシ 堂端 +ドウハシ 堂橋 +トウハタ 東畑 +トウハタ 東端 +トウハタ 遠畑 +トウハタ 峠畑 +トウバタ 東畑 +トウバタ 東端 +ドウハタ 堂端 +ドウハタ 堂畑 +ドウバタ 道端 +ドウバタ 堂端 +ドウバタ 堂畑 +トウハチ 藤八 +トウハナ 塔鼻 +ドウハナ 堂端 +ドウハナ 堂鼻 +ドウハナ 堂花 +ドウバナ 堂鼻 +ドウバナ 道花 +トウハマ 東浜 +トウハマ 東濱 +ドウハマ 堂浜 +ドウハマ 堂濱 +トウバヤシ 東林 +トウバヤシ 当林 +ドウバヤシ 道林 +ドウバヤシ 堂林 +ドウバヤシ 洞林 +トウハラ 東原 +トウハラ 桃原 +トウハラ 遠原 +トウハラ 唐原 +トウハラ 当原 +トウハラ 當原 +トウハラ 塔原 +トウバラ 藤原 +トウバラ 東原 +トウバラ 遠原 +ドウハラ 道原 +ドウハラ 堂原 +ドウバラ 道原 +トウハル 塔春 +トウバル 桃原 +トウバル 唐原 +トウバル 当原 +トウバル 當原 +トウヒ 遠飛 +トウヒグチ 東樋口 +トウヒラ 東平 +ドウヒラ 堂平 +トウフ 東府 +トウブ 藤部 +トウブ 東武 +トウフウ 道風 +ドウフウ 道風 +トウフク 東福 +ドウフク 堂福 +トウフクジ 東福寺 +トウフタニ 豆腐谷 +トウブチ 東渕 +トウブチ 東淵 +ドウブチ 洞渕 +ドウフツ 道仏 +ドウブツ 道仏 +ドウブツ 道佛 +ドウブツ 堂仏 +ドウブツ 堂佛 +ドウフリ 道振 +トウベ 藤部 +トウベ 遠部 +トウベ 東部 +トウベ 籐部 +トウヘイ 藤平 +トウヘイ 東平 +トウヘイゾウ 藤平蔵 +ドウベタ 銅直 +トウベチ 東辺地(東邊地) +トウベットウ 当別当 +トウベットウ 當別當 +トウヘンジ 東辺地(東邊地) +トウホ 東保 +トウホ 東穂(東穗) +トウボ 東保 +トウボ 東穂(東穗) +トウボ 東甫 +ドウホ 道保 +ドウボ 道保 +トウホウ 東方 +トウホウ 東宝 +トウホウ 藤邦 +トウボウ 東方 +トウボウ 当房 +トウボウ 當房 +トウボウ 東房 +トウボウ 東坊 +トウボウ 富房 +トウボウ 唐坊 +ドウホウ 道方 +ドウホウ 道法 +ドウホウ 堂鳳 +トウホウダ 東方田 +トウボエ 問覚 +トウボエ 問覺 +トウホク 東北 +トウボク 東木 +トウボク 橙木 +ドウボトケ 道仏 +ドウボラ 道洞 +ドウボラ 堂洞 +トウボリ 遠堀 +ドウホリ 道堀 +トウマ 藤間 +トウマ 当間 +トウマ 当麻 +トウマ 当真 +トウマ 當間 +トウマ 東間 +トウマ 遠間 +トウマ 當真 +トウマ 当摩 +トウマ 當麻 +トウマ 當眞 +トウマ 東馬 +トウマ 當摩 +トウマ 唐真(唐眞) +トウマ 藤馬 +トウマ 稲摩 +トウマ 問馬 +トウマ 東麻 +トウマ 籐間 +トウマ 冬麻 +トウマ 唐間 +トウマ 唐馬 +トウマ 塔間 +トウマ 当マ +トウマ 当馬(當馬) +トウマ 当磨 +トウマ 当广 +トウマ 当眞 +トウマ 頭間 +トウマ 當磨 +トウマ 富真 +トウマ 富摩 +ドウマ 堂馬 +ドウマ 道間 +ドウマ 堂間 +ドウマ 同馬 +トウマイ 玉米 +トウマエ 東前 +トウマエ 通前 +トウマエ 塔前 +トウマエ 当前 +トウマエ 當前 +ドウマエ 堂前 +ドウマエ 道前 +ドウマエ 同前 +ドウマエ 筒前 +ドウマエ 銅前 +トウマキ 東牧 +トウマス 藤桝 +トウマス 藤舛 +トウマス 籐舛 +トウマタ 東俣 +ドウマタ 道又 +トウマツ 藤松 +トウマツ 東松 +トウマツ 遠松 +トウマツ 等松 +トウマル 藤丸 +トウマル 東丸 +トウマル 十丸 +ドウマル 筒丸 +ドウマル 堂丸 +トウマン 東万 +ドウマン 道満 +ドウマン 堂満 +ドウマン 道滿 +トウミ 遠見 +トウミ 田海 +トウミ 遠海 +トウミ 唐箕 +トウミ 任海 +トウミ 東美 +ドウミ 道見 +ドウミ 百海 +ドウミ 堂見 +ドウミ 道味 +ドウミキ 百成 +ドウミチ 堂道 +ドウミチ 同道 +ドウミツ 堂満 +ドウミツ 道光 +ドウミツ 堂滿 +トウミネ 遠峰 +トウミネ 東峰 +トウミネ 東峯 +トウミネ 遠峯 +トウミネ 唐峯 +トウミネ 遠嶺 +ドウミネ 堂峰 +ドウミネ 堂峯 +トウミヤ 東宮 +トウミヤ 遠宮 +トウミヤ 当宮 +トウミヤ 當宮 +ドウミヤ 堂宮 +トウミョウ 東明 +トウミョウ 藤明 +トウミョウ 東名 +トウミョウ 燈明 +トウミョウ 灯明 +ドウミョウ 道明 +ドウミョウウチ 道明内 +トウミョウダ 燈明田 +ドウムカイ 堂向 +トウムキ 塔向 +トウムラ 東村 +トウムラ 当村 +トウムラ 塔村 +トウムラ 燈村 +トウムラ 當村 +トウムラ 東邑 +ドウムラ 道村 +ドウムラ 堂村 +ドウムラ 同村 +トウメ 当銘 +トウメ 當銘 +トウメ 東目 +トウメ 当目(當目) +トウメ 富銘 +ドウメ 堂目 +トウメイ 当銘 +トウメイ 當銘 +トウメイ 東明 +トウメイ 東溟 +ドウメイ 道明 +ドウメキ 百目鬼 +ドウメキ 百目木 +ドウメキ 百成 +ドウメキ 道目木 +トウメツカ 遠目塚 +ドウメン 堂免 +ドウメン 道面 +ドウメン 堂面 +ドウメン 道免 +ドウメン 同免 +ドウメンキ 同免木 +ドウメンギ 同免木 +ドウモウ 銅網 +トウモト 東本 +トウモト 東元 +トウモト 塔本 +トウモト 登本 +トウモト 豆本 +トウモト 嶝本 +トウモト 当本 +トウモト 塔元 +トウモト 搭本 +トウモト 當本 +ドウモト 堂本 +ドウモト 堂下 +ドウモト 道本 +ドウモト 堂元 +ドウモト 道元 +ドウモト 銅本 +トウモリ 藤森 +トウモリ 東森 +トウモリ 東盛 +トウモリ 十森 +トウモリ 桃盛 +トウモリ 当森(當森) +ドウモリ 堂森 +ドウモリ 土森 +ドウモリ 堂守 +トウモン 東門 +ドウモン 堂門 +トウモングチ 東門口 +トウモンダ 東門田 +トウヤ 藤谷 +トウヤ 東野 +トウヤ 東谷 +トウヤ 遠矢 +トウヤ 東矢 +トウヤ 東家 +トウヤ 刀谷 +トウヤ 遠谷 +トウヤ 遠屋 +トウヤ 十屋 +ドウヤ 堂谷 +ドウヤ 銅谷 +ドウヤ 洞谷 +ドウヤ 道屋 +ドウヤ 堂屋 +ドウヤ 銅屋 +ドウヤ 銅家 +ドウヤ 銅冶 +ドウヤ 堂八 +ドウヤウチ 堂谷内 +ドウヤウチ 道谷内 +トウヤク 十役 +トウヤク 遠役 +ドウヤシキ 堂屋敷 +ドウヤス 堂安 +ドウヤチ 堂谷 +ドウヤチ 堂谷内 +ドウヤチ 道谷内 +トウヤマ 遠山 +トウヤマ 藤山 +トウヤマ 東山 +トウヤマ 陶山 +トウヤマ 当山 +トウヤマ 當山 +トウヤマ 豊山 +トウヤマ 登山 +トウヤマ 頭山 +トウヤマ 唐山 +トウヤマ 塔山 +トウヤマ 橙山 +トウヤマ 籐山 +ドウヤマ 堂山 +ドウヤマ 道山 +ドウヤマ 銅山 +ドウヤマ 動山 +トウヤマサキ 東山崎 +トウヤマザキ 東山崎 +ドウユ 堂湯 +ドウユウ 道勇 +ドウユウ 道遊 +トウユミ 唐弓 +ドウヨ 道余 +トウヨウ 東洋 +トウヨウ 東耀 +トウヨウ 東陽 +ドウヨウ 道用 +ドウヨウ 堂用 +トウヨシ 唐芳 +トウヨシ 東葭 +トウヨシ 桃吉 +トウラ 東浦 +トウラ 東良 +トウラ 外浦 +トウラ 戸浦 +トウラ 東等 +トウラ 東羅 +ドウラ 道羅 +トウライ 唐来(唐來) +トウライ 東来(東來) +トウライ 唐耒 +トウリ 通 +トウリ 東里 +トウリ 当利(當利) +トウリ 通里 +トウリ 刀利 +トウリ 桃里 +トウリ 藤利 +ドウリ 道利 +ドウリ 道理 +ドウリ 導利 +トウリキ 東力 +トウリキ 等力 +トウリキ 藤力 +トウリザワ 通沢(通澤) +トウリシミズ 通清水 +トウリヤマ 通山 +トウリュウ 東流 +トウリュウダニ 当流谷 +トウリュウダニ 當流谷 +ドウリョウ 堂領 +トウリン 東林 +トウリン 桃林 +ドウリン 道林 +ドウリン 道厘 +ドウレイ 洞嶺 +トウレンジ 東連寺 +トウレンジ 東蓮寺 +トウロ 塘路 +トウロ 藤路 +ドウロ 道路 +トウロギ 東呂木 +トウロク 藤六 +トウロク 当六 +ドウロク 堂六 +ドウワ 道和 +ドウワ 道輪 +トウワカ 東若 +トウワキ 東脇 +トウワキ 灯脇 +トウワキ 燈脇 +ドウワキ 堂脇 +トウワク 東涌 +トエ 戸江 +ドエ 土江 +ドエ 土恵 +ドエイ 土永 +ドエイ 土栄(土榮) +トエダ 戸枝 +トエダ 十枝 +トエダ 土江田 +トエダ 十重田 +ドエダ 土江田 +トエン 戸円(戸圓) +ドエン 土遠 +トオ 戸尾 +トオイ 東井 +トオイ 遠井 +トオイ 戸笈 +トオイワ 遠井和 +トオエ 遠江 +トオエダ 遠枝 +トオオカ 東岡 +トオオンナ 東恩納 +トオカイチ 十日市 +トオカガミ 遠鑑 +トオカミ 遠上 +トオガミ 遠上 +トオカヤ 十日谷 +トオカワ 遠川 +トオキ 遠木 +トオギ 東儀 +トオキタ 遠北 +トオグチ 遠口 +トオクニ 遠国 +トオクニ 遠國 +トオクボ 東久保 +トオゲ 峠 +トオゴウ 十河 +トオゴシ 遠越 +トオサカ 遠坂 +トオザカ 遠坂 +トオサキ 遠崎 +トオザキ 遠崎 +トオサコ 遠迫 +トオサト 遠里 +トオサワ 遠沢 +トオサワ 遠澤 +トオザワ 遠澤 +トオシ 簏 +トオジ 田路 +トオジ 通事 +トオシナイ 遠子内 +トオシマ 遠島 +トオシマ 遠嶋(遠嶌) +トオジマ 遠島 +トオジマ 遠嶋(遠嶌) +トオシヤ 簏谷 +トオセ 遠勢 +トオセ 遠瀬 +トオタ 遠田 +トオダ 遠田 +トオダ 任田 +トオダ 十田 +トオタケ 遠竹 +トオタケ 遠武 +トオタケ 遠岳 +トオタケ 遠嶽 +トオダケ 遠岳 +トオタニ 遠谷 +トオチ 遠池 +トオチ 東落 +トオチカ 遠近 +トオチカ 藤近 +トオツカ 遠塚 +トオツカ 十塚 +トオヅカ 遠塚 +トオツカタニ 遠塚谷 +トオヅカタニ 遠塚谷 +トオツカヤ 遠塚谷 +トオヅカヤ 遠塚谷 +トオトウミ 遠江 +トオトミ 遠江 +トオトミ 遠富 +トオニシ 遠西 +トオノ 東恩納 +トオノ 遠野 +トオノ 遠乃 +トオノエ 遠江 +トオノエ 遠ノ江 +トオハシ 遠橋 +トオハタ 遠畑 +トオハラ 遠原 +トオバラ 遠原 +トオバル 遠原 +トオベ 遠部 +トオベ 遠辺 +トオボエ 問覚 +トオボリ 遠堀 +トオマ 遠間 +トオマサ 遠政 +トオマタ 遠又 +トオマツ 遠松 +トオミ 遠見 +トオミ 遠海 +トオミイシ 遠見石 +トオミズ 遠水 +トオミツ 遠光 +トオミネ 遠峰 +トオミネ 東峯 +トオミネ 遠峯 +トオミネ 遠嶺 +トオミヤ 遠宮 +トオメ 当目(當目) +トオメツカ 遠目塚 +トオメヅカ 遠目塚 +トオモト 塔本 +トオモリ 遠森 +トオヤ 遠矢 +トオヤ 遠谷 +トオヤ 遠屋 +トオヤク 十役 +トオヤク 遠役 +トオヤマ 遠山 +トオヤマ 通山 +トオリ 通 +トオリイワ 通岩 +トオリサカ 通阪 +トオリサカ 通坂 +トオリザワ 通沢(通澤) +トオリシミズ 通清水 +トオリスジ 通筋 +トオリダ 通田 +トオリド 通戸 +トオリドウ 通堂 +トオリバタ 通畠 +トオリモン 通門 +トオリヤマ 通山 +トオル 通 +トオル 亨 +トオル 透 +トオル 融 +トオルタニ 通谷 +トカ 登家 +トガ 栂 +トガ 戸賀 +トガ 都賀 +トガ 門叶 +トガ 問可 +トガ 斗賀 +トガ 渡加 +トカイ 渡海 +トカイ 外海 +トカイ 戸貝 +トガイ 栂井 +トガイ 兎谷 +トガイ 戸貝 +ドカイ 土海 +ドカイ 土開 +ドガイト 道垣内 +トカイヤ 渡海谷 +トガエリ 十返 +トガオ 栂尾 +トガキ 栂木 +トガキ 戸垣 +ドカク 土角 +トガクシ 戸隠 +ドガグチ 堂ケ口 +トカケ 戸掛 +トガサカ 栂坂 +トガサキ 戸ケ崎(戸ケ嵜) +トガサキ 戸賀崎 +トガサキ 栂崎 +トガサキ 栂嵜 +トガサワ 戸賀沢 +トガサワ 斗ケ沢 +トガサワ 戸賀澤 +トガサワ 斗ケ澤 +トガサワ 戸ケ沢 +ドガサワ 堂ケ澤 +トカジ 戸梶 +トガシ 富樫 +トガシ 冨樫 +トガシ 藤樫 +トガシ 戸柏 +トガシ 戸樫 +トカシキ 渡嘉敷 +トカシキ 渡ケ敷 +トカシキ 渡加敷 +トガシキ 渡嘉敷 +トカシマ 戸鹿島 +トガシマ 戸鹿島 +トガシマ 渡鹿島 +トカズ 十一 +トカゼ 戸風 +トガセ 栂瀬 +トガセ 戸賀瀬 +トガセ 戸ケ瀬 +トガゾノ 栂園 +トガタ 戸方 +トガタニ 栂谷 +トカド 戸門 +トカナイ 門叶 +トガナミ 栂並 +トガニ 十蟹 +トカネ 兜金 +トガネ 戸金 +トカノ 戸叶 +トカノ 都鹿野 +トガノ 戸叶 +トガノ 栂野 +トガノ 門叶 +トガノ 戸鹿野 +トカノウ 戸叶 +トガノウ 戸叶 +トガノオ 栂野尾 +トガノキ 栂木 +トガノキ 枚栂木 +トガノキ 𣏤栂木 +ドガハナ 土ケ端 +ドガハナ 堂ケ端 +トガハラ 土河原 +トガハラ 栂原 +トガマ 敏鎌 +ドガマ 土釜 +トガマエ 戸構 +トカミ 戸上 +トカミ 砥上 +トカミ 冨上 +トカミ 戸神 +トカミ 十神 +トガミ 戸上 +トガミ 砥上 +トガミ 冨上 +トガミ 土上 +トガミ 富上 +トガミ 戸神 +トガミ 富加見 +トガミ 冨加見 +トガミ 外上 +トガミ 登上 +ドガミ 堂上 +ドガミ 土上 +トガムラ 栂村 +トガメ 十亀 +トガメ 戸亀 +トガメ 登亀 +トガモト 栂本 +トガモリ 栂森 +トガヤ 登ケ谷 +トガヤ 都賀谷 +トガヤチ 栂谷内 +トガヤマ 斗賀山 +トカリ 戸苅 +トカリ 戸加里 +トカリ 戸狩 +トカリ 戸借 +トガリ 戸苅 +トガリ 外狩 +トガリ 戸ケ里 +トガリ 戸加里 +トガリ 尖 +トガリ 戸狩 +トガリ 戸河里 +トガリ 戸借 +トガリ 戸賀里 +トガリ 渡苅 +トガリ 戸刈 +トガリ 鋒 +トガリ 戸鹿里 +トガリ 渡刈 +トガル 戸軽 +トカワ 戸川 +トカワ 外川 +トガワ 戸川 +トガワ 外川 +トガワ 東川 +トガワ 十河 +トガワ 十川 +トガワ 土川 +トガワ 登川 +トガワ 渡川 +トガワ 都川 +トガワ 騰川 +トガワ 砥川 +トガワ 土河 +トガワ 外河 +トガワ 兎川 +トガワ 外側 +トガワ 杜川 +トガワ 戸河 +トガワ 栂輪 +ドガワ 土川 +トガワヤ 戸川屋 +トキ 土岐 +トキ 土生 +トキ 斎 +トキ 戸来 +トキ 時 +トキ 都木 +トキ 外木 +トキ 齋 +トキ 鴇 +トキ 戸木 +トキ 釋 +トキ 登喜 +トキ 登木 +トキ 土城 +トキ 登岐 +トキ 土亀 +トキ 斗鬼 +トキ 解 +トキ 戸岐 +トキ 戸來 +トキ 土枝 +トキ 鴾 +トキ 鴞 +トキ 度紀 +トギ 土岐 +トギ 冨木 +トギ 利 +トギ 戸木 +トギ 研 +トギ 磨 +トギ 登木 +トギ 硎 +トギ 登岐 +ドキ 土岐 +ドキ 土器 +ドキ 土木 +ドキ 土城 +ドキ 土記 +ドキ 土宜 +ドギ 土岐 +トキアイ 時合 +トキアン 時庵 +トキイ 時井 +トキイ 時位 +トギイ 研井 +トギイシ 研石 +トキウネ 時畦 +トキウラ 時浦 +トキエ 時計 +トキエ 時得 +トキエダ 時枝 +トキオ 時尾 +トキオ 釈尾 +トキオ 釈臣 +トキオ 釋尾 +トギオ 研尾 +トキオカ 時岡 +トキオカ 土岐岡 +トキオカ 鴇岡 +トギオカ 研岡 +トキカズ 時数(時數) +トキカネ 時兼 +トキカネ 時鐘 +トキカワ 時川 +トキカワ 土岐川 +トキガワ 時川 +トキガワ 土岐川 +トキガワ 解川 +トギカワ 研川 +トキグチ 登木口 +トキクニ 時国 +トキクニ 時國 +トキクラ 土岐倉 +トキクラ 時倉 +トキコウ 時耕 +トキコヤマ 時子山 +トキサ 時佐 +トキサキ 時崎 +トキサキ 鴇崎(鴇嵜) +トキザキ 時崎 +トキザキ 鴇崎(鴇嵜) +トキサダ 時貞 +トキサト 時里 +トキザネ 時実 +トキザネ 時實 +トキザネ 時真 +トキサワ 時沢 +トキサワ 時澤 +トキサワ 鴇沢 +トキサワ 土岐沢(土岐澤) +トキザワ 時沢 +トキザワ 時澤 +トキザワ 常沢 +トキザワ 鴇沢 +トキザワ 常澤 +トキザワ 土岐沢(土岐澤) +トキザワ 鴇澤 +トキシ 時仕 +トキシ 時志 +トギシ 登岸 +ドギシ 土岸 +トキシゲ 時重 +トキシゲ 時繁 +トキシタ 時下 +トギシタ 斗巍下 +トキスエ 時末 +トキスギ 時杉 +トキセ 迅瀬 +トキソウ 時惣 +トキゾノ 時園 +ドキゾノ 土器薗 +ドキゾノ 土器園 +トキタ 時田 +トキタ 斎田 +トキタ 鴇田 +トキタ 常田 +トキタ 齋田 +トキタ 戸木田 +トキタ 戸北 +トキタ 土岐田 +トキタ 解田 +トキタ 土木田 +トキタ 鴾田 +トキタ 戸貴田 +トキタ 朱鷺田 +トキタ 鴘田 +トキダ 時田 +トキダ 鴇田 +トキダ 常田 +トキダ 戸木田 +トキダ 解田 +トギタ 磨田 +トギタ 研田 +トキタカ 時高 +トキタケ 時武 +トキダテ 時館 +トキダテ 時舘 +トキタニ 時谷 +トギタニ 研谷 +トギタニ 砥谷 +トギタニ 硎谷 +トキツ 時津 +トキツ 鯨津 +トキツカ 時塚 +ドキテ 土器手 +トキト 時任 +トキド 時戸 +トキトウ 時任 +トキトウ 時藤 +トキトモ 時友 +トキトリ 時鳥 +トキナガ 時永 +トキナガ 時長 +トキナリ 釈成 +トキニワ 時庭 +トキノ 時野 +トキノ 解野 +トギノ 磨野 +トギノ 硎野 +トギノ 研野 +トキノス 鴇巣 +トキノタニ 時野谷 +トキノブ 時信 +トキノブ 時延 +トキノヤ 時野谷 +トキノリ 時乗(時乘) +トキハ 時葉 +トキバヤシ 時林 +トキハラ 時原 +トキヒサ 時久 +トキヒラ 時平 +トギヒラ 磨平 +トキヒロ 時広 +トキヒロ 時弘 +トキヒロ 時廣 +トキフジ 時藤 +トキフダ 時札 +トキマ 時間 +トキマサ 時政 +トキマサ 時正 +トキマス 時増 +トキマツ 時松 +トキマツ 時待 +トキマル 時丸 +トキミ 時見 +トキミ 釈水(釋水) +トキミズ 時水 +トキミツ 時光 +トギミツ 硎光 +トキミネ 時峯 +トキムネ 時宗 +トキムラ 時村 +トキメ 時女 +トキメ 時目 +トキモト 時本 +トキモト 時元 +トギモト 研本 +トギモト 硎元 +トキモリ 時盛 +トキモリ 時森 +トキモリ 時守 +トキヤ 時谷 +トキヤ 鴇矢 +トキヤ 時矢 +トキヤ 釈舎(釋舎・釋舍) +トキヤ 鴇谷 +トギヤ 研谷 +トギヤ 利谷 +トギヤ 磨谷 +トギヤ 研屋 +トギヤ 硎屋 +トギヤ 硎谷 +トギヤ 磨家 +トギヤ 研矢 +トギヤ 磨矢 +トギヤ 硎家 +トギヤ 硎矢 +ドキヤ 土器屋 +トキヤス 時安 +トキヤマ 時山 +トキヤマ 土岐山 +トギヤマ 砥山 +トギヤマ 研山 +ドキュウ 土久 +トキヨ 戸清 +トキヨシ 時吉 +トキヨシ 鯨吉 +トキヨリ 時頼 +トギリ 戸切 +トギリ 鑓利 +トキリョウ 斉料 +トキワ 常盤 +トキワ 青葉 +トキワ 常葉 +トキワ 常磐 +トキワ 常和 +トキワ 時和 +トギワ 研和 +トキワイ 常盤井 +トキワイ 常磐井 +トキワギ 常盤木 +トキワノ 常盤野 +トキワヤマ 常盤山 +ドキン 土金 +トク 徳 +トク 禿 +トク 篤 +トク 得 +トク 督 +ドグ 土具 +トクアミ 徳網 +トクアン 徳庵 +トクイ 徳井 +トクイ 得居 +トクイ 得井 +トクイ 徳居 +トクイ 得猪 +トクイエ 徳家 +トクイシ 徳石 +トクイズミ 徳泉 +トクイチ 徳市 +トクイチ 徳一 +トクイネ 徳稲 +トクイワ 徳岩 +トクウ 徳生 +トクウエ 徳植 +トクウチ 徳内 +トクウミ 徳海 +トクウメ 徳梅 +トクウラ 徳浦 +トクエ 徳江 +トクエ 徳衛 +トクオ 徳尾 +トクオ 徳応 +トクオ 徳應 +トクオイ 徳生 +トクオウ 徳王 +トクオウ 徳応 +トクオウ 徳應 +トクオウマル 徳王丸 +トクオカ 徳岡 +トクオカ 土久岡 +トクオカ 徳岳 +トクオカ 篤岡 +トクオカ 得岡 +トクオカ 徳丘 +トクオノ 徳尾野 +トクオミ 徳臣 +トクオリ 徳織 +トクカ 徳家 +トクガ 徳賀 +トクガキ 徳垣 +トクガサキ 徳ケ崎 +トクカタ 徳方 +トクカツ 徳勝 +トクカネ 徳金 +トクガミ 徳上 +トクガミ 得上 +トクカワ 徳河 +トクガワ 徳川 +トクガワ 十九川 +トクガワ 渡久川 +トクガワ 徳河 +トクガワ 戸久河 +トクガワ 篤川 +トクガワ 禿河 +トクガワ 禿川 +トクギ 徳木 +トクギ 徳義 +トクキヨ 徳清 +トクギョウ 徳行 +トククラ 徳倉 +トククラ 徳蔵(徳藏) +トクケ 徳家 +トクコ 篤子 +ドクコ 独古 +トクコウ 徳光 +トクコウ 徳好 +トクコダ 徳小田 +トクサ 徳差 +トクサ 木賊 +トクサ 戸草 +トクサ 徳佐 +トクサ 渡草 +トクザ 徳座 +トグサ 戸草 +トクサカ 徳坂 +トクサカ 徳久阪 +トクサガワ 木賊川 +トクサキ 徳崎 +トクサキ 徳嵜 +トクザキ 徳崎 +トクザキ 徳嵜 +トクサコ 徳迫 +トクサシ 徳差 +トクサダ 徳貞 +トクサダ 徳佐田 +トクサト 徳里 +トクザト 徳里 +トクサナイ 戸草内 +トクザネ 徳実 +トクサヤ 徳佐屋 +トクサリ 戸鎖 +トグサリ 戸鎖 +トクサワ 徳沢 +トクサワ 徳澤 +トクザワ 徳沢 +トクザワ 徳澤 +トクザワ 得沢 +トクシ 禿子 +トクシ 禿氏 +トクジ 渡久地 +トクジ 徳地 +トクジ 得字 +トクジ 徳治 +トクシク 徳宿 +トクシゲ 徳重 +トクシゲ 徳茂 +トクシゲ 得重 +トクシゲ 徳繁 +トクシタ 徳下 +トクジタニ 徳地谷 +トクシマ 徳島 +トクシマ 徳嶋 +トクシマ 徳嶌 +ドクシマ 毒島 +トクジヤ 徳地屋 +トクシュク 徳宿 +トクショウ 徳生 +トクショウ 徳正 +トクショウ 徳庄 +トクジョウ 徳門 +トクジョウ 徳上 +トクジョウ 徳城 +トクジラ 外鯨 +トクシロ 徳城 +トクス 徳楠 +トクズ 土葛 +トクズ 徳図 +トクスエ 徳末 +トクスエ 禿末 +トクスミ 徳澄 +トクスミ 徳住 +トクスミ 徳炭 +トクズミ 徳澄 +トクズミ 徳住 +トクズミ 徳角 +トクズミ 徳積 +トクセ 徳世 +トクセ 徳瀬 +トクセ 戸久世 +トクセ 徳勢 +トクセイ 徳生 +トクセイ 得政 +トクゼン 徳善 +トクゾエ 徳添 +トクゾノ 徳園 +トクタ 徳田 +トクタ 得田 +トクタ 徳多 +トクダ 徳田 +トクダ 得田 +トクダ 篤田 +トクダ 徳多 +トクダイジ 徳大寺 +トクダイジ 徳大路 +トクタカ 徳嵩 +トクタカ 徳高 +トクタケ 徳武 +トクタケ 徳竹 +トクタケ 徳嵩 +トクタケ 徳嶽 +トクタケ 得竹 +トクタニ 徳谷 +トクチ 渡久地 +トクチ 徳地 +トクチ 得地 +トクチ 得知 +トクチ 徳知 +トクヂ 徳地 +トグチ 東口 +トグチ 渡久地 +トグチ 戸口 +トグチ 渡口 +トグチ 渡具知 +トグチ 外口 +トグチ 登口 +トグチ 土口 +トグチ 渡久知 +トグチ 渡具地 +ドグチ 筒口 +ドグチ 土口 +トクチダ 戸口田 +トグチダ 戸口田 +トクチヤ 徳地屋 +トクチヨ 徳千代 +トクチョウ 徳長 +トクチン 徳珍 +トクツ 得津 +トクツ 徳津 +トクツギ 徳次 +トクツネ 徳常 +トクテ 特手 +トクデラ 徳寺 +トクテル 徳照 +トクド 徳土 +トクドウ 徳堂 +トクトミ 徳富 +トクトミ 徳冨 +トクトミ 得富 +トクドミ 徳富 +トクドミ 徳冨 +トクドミ 得冨 +トクトメ 徳留 +トクドメ 徳留 +トクナ 徳名 +トクナカ 徳中 +トクナカ 得中 +トクナガ 徳永 +トクナガ 得永 +トクナガ 徳長 +トクナガ 督永 +トクナガ 篤永 +トクナガ 徳奈賀 +トクナミ 徳浪 +トクナミ 徳波 +トクナミ 十九波 +トクナミ 徳並 +トクナリ 徳成 +トクナン 徳南 +トクニ 戸国 +トクニ 戸國 +トクニシ 徳西 +トクネ 徳根 +トクノ 得能 +トクノ 徳野 +トクノ 得野 +トクノ 徳埜 +トクノ 犢野 +トクノウ 得能 +トクノウ 徳能 +トクノウ 徳納 +トクノウ 得納 +トクノモト 徳野本 +トクハシ 徳橋 +トクハシ 徳槁 +トクハタ 徳畑 +トクハマ 徳浜 +トクハマ 徳濱 +トクバヤシ 徳林 +トクバヤシ 禿林 +トクハラ 徳原 +トクハラ 得原 +トクバラ 徳原 +トクヒ 徳日 +トクビ 徳備 +トクヒガ 徳比嘉 +トクヒサ 徳久 +トクヒラ 徳平 +トクヒラ 得平 +トクヒラ 渡久平 +トクヒラ 淂平 +トクヒロ 徳弘 +トクヒロ 徳広 +トクヒロ 徳廣 +トクヒロ 徳浩 +トクフジ 徳藤 +トクフチ 徳渕 +トクフチ 徳淵 +トクブチ 徳渕 +トクブチ 徳淵 +トクブツ 徳物 +トクベ 徳部 +トクホ 徳保 +トクホ 徳穂 +トクボ 徳保 +トクボ 十久保 +トクホウ 徳方 +トクマ 徳間 +トクマ 戸熊 +トグマ 戸熊 +トクマエ 徳前 +トクマサ 徳政 +トクマサ 徳正 +トクマス 徳増 +トクマス 徳升 +トクマス 徳舛 +トクマス 徳益 +トクマス 徳桝 +トクマス 徳枡 +トクマツ 徳松 +トクマツ 得松 +トクマル 徳丸 +トクマル 得丸 +トクマン 徳満 +トクマン 徳万 +トクマン 徳滿 +トクマン 徳萬 +トクミ 徳見 +トクミ 徳海 +トクミ 徳水 +トクミ 徳美 +トクミ 徳味 +トクミ 登久美 +トクミ 徳三 +トクミズ 徳水 +トクミチ 徳道 +トクミツ 徳光 +トクミツ 徳満 +トクミツ 得光 +トクミネ 徳嶺 +トクミネ 徳峰 +トクミネ 徳峯 +トクミヤ 徳宮 +トクミョウ 徳明 +トクムネ 徳宗 +トクムラ 徳村 +トクムラ 得村 +トクムラ 徳邑 +トクモ 徳毛 +トクモ 徳茂 +トグモ 戸雲 +トクモウ 徳毛 +トクモチ 徳持 +トクモツ 徳持 +トクモト 徳本 +トクモト 徳元 +トクモト 得本 +トクモト 徳用 +トクモト 篤本 +トクモト 十九本 +トクモリ 徳森 +トクモリ 徳盛 +トクモリ 徳守 +トクモン 徳門 +トクヤ 徳谷 +トクヤ 徳家 +トクヤ 徳屋 +トクヤ 徳矢 +トクヤス 徳安 +トクヤマ 徳山 +トクヤマ 渡久山 +トクヤマ 得山 +トクヤマ 悳山 +トクヤマ 篤山 +トクヨ 徳予 +トクヨ 徳豫 +トクヨシ 徳吉 +トクヨシ 得利 +トクヨセ 徳寄 +トクラ 戸倉 +トクラ 土倉 +トクラ 十倉 +トクラ 都倉 +トクラ 徳倉 +トクラ 利倉 +トクラ 徳良 +トクラ 登倉 +トクラ 土蔵 +トクラ 計倉 +トクラ 徳蔵(徳藏) +トクラ 土庫 +トクラ 斗蔵 +トクラ 土藏 +トクラ 外倉 +トクラ 得楽 +トクラ 杜倉 +トグラ 戸倉 +トグラ 都倉 +トグラ 登倉 +トグラ 戸蔵(戸藏) +ドクラ 土倉 +トクラカワ 戸倉川 +トクラガワ 戸倉川 +トクラク 徳楽 +トクラク 徳樂 +トクリ 徳利 +トクリ 土久里 +トクリ 土栗 +トグリ 戸栗 +トクリキ 徳力 +トクリキ 得力 +トクレイ 徳礼 +トクレイ 徳禮 +トクレン 徳連 +トクロ 戸黒 +トグロ 戸黒 +トグロ 精廬 +トグロ 精盧 +トクワ 徳和 +トクワカ 徳若 +トクワキ 徳脇 +トクワメ 徳和目 +トケ 戸毛 +トゲ 戸毛 +トケイ 時計 +トケイジ 渡慶次 +トゲサワ 斗ケ沢 +トケシ 渡慶次 +トケシ 渡ケ次 +トケジ 渡慶次 +トケジ 渡慶治 +トゲツ 吐月 +トゲドノ 遂殿 +トゲモト 桐原本 +トコ 床 +トコ 登古 +ドゴ 土後 +トコイ 床井 +トコイ 常井 +トコイシ 床石 +トコイタ 床板 +トコウ 都甲 +トコウ 斗光 +トコウ 登光 +トゴウ 渡会 +トゴウ 都甲 +トゴウ 渡會 +トゴウ 都合 +トゴウ 都郷 +トゴウ 戸郷 +トゴウ 渡合 +トゴウ 戸合 +ドコウ 土工 +ドコウ 土光 +ドコウ 土公 +ドコウ 土幸 +トコウラ 床浦 +トゴエ 戸越 +トゴエ 外越 +トゴエ 渡越 +トコエダ 床枝 +トコエダ 常枝 +トコオ 床尾 +トコオ 戸小尾 +トコオカ 床岡 +トコカワ 床川 +トコザクラ 床桜 +トコザクラ 床櫻 +トコシマ 床島 +トコシマ 床嶋 +トコジマ 床島 +トコジマ 床嶋 +トコシュク 床宿 +トコスミ 徃住 +トコスミ 往住 +トコズミ 常角 +トコズミ 徃住 +トコタ 床田 +トコダ 床田 +トコダ 戸子田 +トコダイ 戸子台(戸子臺) +トコダイ 戸子薹 +トコダイ 戸小台 +トコタニ 床谷 +トコツメ 床爪 +トコヅメ 床爪 +トコナギ 常諾 +トコナツ 床夏 +トコナベ 床鍋 +トコナベ 床辺 +トコナベ 床那部 +トコナミ 床次 +トコナミ 床並 +トコナミ 床波 +トコナミ 床浪 +トコニシ 床西 +トコノ 床野 +トコハラ 床原 +トコヒラ 床平 +トコボ 床坊 +トコボウ 床坊 +トコマ 床間 +トコモト 床本 +トコモト 床元 +トコヤマ 常山 +トコヤマ 時子山 +トコヤマ 床山 +トコヨ 常世 +トコヨタ 常世田(常丗田) +トコヨダ 常世田(常丗田) +トコロ 野呂 +トコロ 所 +トコロ 野老 +トコロ 戸頃 +トコロ 処 +トコロ 山老 +トコロ 處 +トコロ 嵡 +トコロ 床呂 +トコロ 土小呂 +トゴロ 戸頃 +トコロガイチ 所開地 +トコロガイチ 所垣内 +トコロクボ 所久保 +トコロサキ 所崎(所嵜) +トコロザキ 所崎(所嵜) +トコロサワ 所沢 +トコロザワ 所沢 +トコロザワ 所澤 +トコロダ 所田 +トコロタニ 所谷 +トコロダニ 所谷 +トコロダニ 處谷 +トコロヅ 薢津 +トコロヅキ 所付 +トコロヅキ 所附 +トコロノ 所埜 +トコロヤ 薢屋 +トコロヤマ 野老山 +トコワケ 床分 +トサ 土佐 +トサ 戸佐 +トサ 登佐 +トサ 途佐 +トサ 土左 +トサイ 土佐井 +ドザイク 土細工 +トサウチ 土佐内 +トサオカ 土佐岡 +トサカ 登坂 +トサカ 戸坂 +トサカ 土坂 +トサカ 登阪 +トサカ 兜坂 +トサカ 都坂 +トサカ 戸阪 +トサカ 鳥坂 +トサカ 砥坂 +トサカ 兠坂 +トザカ 登坂 +トザカ 戸坂 +トザカ 兜坂 +ドサカ 土坂 +ドサカ 土阪 +トサガワ 土佐川 +トサキ 外崎 +トサキ 戸崎 +トサキ 土崎 +トサキ 登崎 +トサキ 涛崎 +トサキ 戸咲 +トサキ 戸嵜 +トサキ 外嵜 +トサキ 途崎 +トサキ 土佐木 +トサキ 濤崎 +トザキ 外崎 +トザキ 戸崎 +トザキ 土崎 +トザキ 登崎 +トザキ 渡崎 +トザキ 戸嵜 +トザキ 斗崎 +トザキ 濤崎 +ドサキ 土崎 +ドザキ 土崎 +トザサ 戸笹 +トサシ 戸刺 +トサジ 土佐路 +トサダ 土佐田 +トサダ 戸定 +トサタニ 土佐谷 +トサダニ 土佐谷 +トザト 外里 +トサノ 土佐野 +トサバヤシ 土佐林 +トサマ 戸佐間 +トザマ 戸座間 +トサヤ 土佐谷 +トサヤ 土佐屋 +トサワ 戸澤 +トザワ 戸沢 +トザワ 戸澤 +トザワ 兎沢 +トザワ 斗沢 +トザワ 土澤 +トザワ 兎澤 +トザワ 都沢 +トザワ 渡沢 +トザワ 都澤 +トザワ 登沢 +トザワ 登澤 +トザワ 外沢 +トザワ 斗澤 +トザワ 渡澤 +トザワ 外澤 +トザワ 杜澤 +トザワ 杜沢 +ドサワ 土澤 +ドザワ 土沢 +ドザワ 土澤 +トシ 利 +トシ 渡士 +トシ 俊 +トシ 杜師 +トシ 登師 +トシ 都枝 +トシ 利志 +トジ 都地 +トジ 登地 +トジ 戸司 +トジ 戸地 +ドシ 土師 +トシウメ 年梅 +トシエ 年恵 +トシエ 利江 +トシオ 兎子尾 +トシオ 利尾 +トシオ 塗師尾 +トシオ 兔子尾 +トシオカ 利岡 +トシオカ 年岡 +トシオカ 歳岡 +トシオカ 寿岡 +トシオカ 俊岡 +トシオカ 東司丘 +トシカゲ 敏蔭 +トシカゲ 敏陰 +トシカネ 歳兼 +トシガミ 年神 +トシガミ 寿上 +トシガミ 壽上 +トシカワ 利川 +トシカワ 歳川 +トシカワ 渡志川 +トシカワ 年川 +トシキ 戸敷 +トシキ 利木 +トシキ 年木 +トジキ 戸敷 +トジキ 戸鋪 +トシキヨ 年清 +トシキヨ 歳清 +トシクニ 利国 +トシクニ 歳国 +トシクニ 利國 +トシクニ 歳國 +トシクニ 年国 +トジクボ 當時久保 +トシクラ 利倉 +トジコ 閉篭 +トジコ 閉籠 +トシザキ 俊崎 +トシザキ 簏崎 +トシザネ 歳実 +トシザネ 歳實 +トシザワ 俊沢 +トシザワ 俊澤 +トシシゲ 利重 +トシジマ 歳嶋 +トシジマ 歳島 +トシズエ 年末 +トシズエ 利末 +トシズミ 年澄 +トシタ 戸下 +トシタ 俊田 +トシダ 土志田 +トシダ 利田 +トシダ 土信田 +トシダ 歳田 +トシダ 土士田 +トシダ 東西田 +トシダ 年田 +トシダ 土師田 +トシダ 十志田 +トシダ 十信田 +トシダ 土至田 +ドシタ 土志田 +ドシタ 土信田 +ドシダ 土志田 +ドシダ 土信田 +ドシダ 土士田 +ドシダ 土師田 +トシタニ 利谷 +トシタニ 歳谷 +トジタニ 唐治谷 +トシツグ 年次 +トシツナ 年綱 +トシツネ 歳常 +トシトウ 年藤 +トシトウ 歳藤 +トシトク 年徳 +トシトクヤ 歳徳屋 +トシトクヤ 年徳谷 +トシトモ 年友 +トシナ 戸階 +トシナ 年名 +トシナイ 十枝内 +トシナイ 遠子内 +トシナガ 寿 +トシナガ 年永 +トシナガ 壽 +トシナガ 利長 +トシナガ 俊長 +トシナガ 歳永 +トシナガ 歳長 +トシナミ 利波 +トシナミ 利浪 +トシナリ 俊成 +トシナリ 歳成 +トシナワ 年縄 +トシナワ 年繩 +トシノ 俊野 +トシノ 戸篠 +トシノ 歳納 +トシノ 年野 +トシノ 利野 +トシノ 歳野 +トシノ 都子野 +トジノ 戸治野 +トシノウ 歳納 +トシノブ 利信 +トシハラ 歳原 +トシハラ 利原 +トシハラ 俊原 +トシヒデ 歳秀 +トシヒラ 歳平 +トシヒロ 歳弘 +トシヒロ 利広 +トシヒロ 利弘 +トシヒロ 利廣 +トシフジ 年藤 +トシベ 利部 +トシマ 豊島(豐島) +トシマ 豊嶋 +トシマ 戸島 +トシマ 戸嶋 +トシマ 外島 +トシマ 渡島 +トシマ 土島 +トシマ 十島 +トシマ 登島 +トシマ 都島(都嶋) +トシマ 登嶋 +トシマ 外嶋 +トシマ 戸嶌 +トシマ 利島 +トシマ 利嶋 +トシマ 渡嶋 +トシマ 外嶌 +トシマ 載間 +トシマ 年未 +トジマ 戸島 +トジマ 戸嶋 +トジマ 外島 +トジマ 十島 +トジマ 登島 +トジマ 登嶋 +トジマ 外嶋 +トジマ 戸嶌 +トジマ 砥島 +トジマ 砥嶋 +ドシマ 土島 +ドシマ 土嶋 +ドジマ 土島 +ドジマ 土嶋 +トシマエ 年前 +トシマサ 俊正 +トシマス 年増 +トシマツ 年末 +トシミ 年見 +トシミ 都志見 +トシミ 利見 +トシミ 土清水 +トシミグチ 年見口 +トシミズ 利水 +トシミズ 年水 +トシミツ 利光 +トシミツ 年光 +トシミツ 利満 +トシミツ 歳光 +トシミヤ 利宮 +トシムネ 年宗 +トシムラ 利村 +トシモト 年本 +トシモト 利元 +トシモト 利本 +トシモト 歳本 +トシモリ 歳森 +トシモリ 年森 +トシモリ 敏森 +トシモリ 利守 +トシモリ 年盛 +トシモリ 利森 +トシヤ 利谷 +トシヤ 利屋 +トシヤ 篩谷 +ドシャ 土砂 +トシヤス 利安 +トシヤス 歳安 +トシヤス 敏安 +トシヤマ 利山 +トシヤマ 俊山 +トシヤマ 舜山 +トシユキ 利行 +トシユキ 歳行 +トジョウ 戸城 +トジョウ 外城 +トジョウ 登城 +トジョウ 登条(登條) +ドショウ 土性 +ドジョウ 土定 +ドジョウガワ 堂城川 +ドショウダ 道正田 +トシヨシ 年吉 +トシラ 歳良 +トジリ 戸尻 +ドジリ 土尻 +トシロ 戸城 +トシロ 年代 +トシロ 十代 +トシロ 戸代 +ドシロ 土代 +トシロザワ 戸代沢 +トシロザワ 戸代澤 +トス 鳥巣 +トス 鳥栖 +トス 戸須 +トス 戸寿(戸壽) +トズ 鳥巣 +トズ 戸津 +トズカ 戸塚 +トスギ 戸杉 +トスダ 戸須田 +トスミ 十住 +トズミ 戸住 +トセ 戸瀬 +トセ 外勢 +ドセ 土勢 +ドセ 土瀬 +トセキ 十石 +トセキ 都関 +トセノ 東瀬野 +トソ 十都 +トソ 戸曾 +トソ 戸曽 +トソ 十祖 +トゾノ 外園 +ドゾノ 土園 +トダ 富田 +トダ 戸田 +トダ 土田 +トダ 冨田 +トダ 都田 +トダ 外田 +トダ 登田 +トダ 十田 +トダ 渡田 +トダ 兎田 +トダ 杜多 +トダ 計田 +トダ 砥田 +トダ 砺田 +トダ 刀田 +ドタ 土田 +ドダ 土田 +トダイ 戸台(戸臺) +ドダイ 土代 +トタカ 戸高 +トダカ 戸高 +トダカ 斗高 +トダガワ 戸田川 +トダギシ 戸田岸 +トタケ 都竹 +トダサワ 戸田沢 +トダサワ 戸田澤 +トダシロ 戸田代 +トダテ 外館 +トダテ 外舘 +トダテ 戸館 +トダテ 戸舘 +ドダテ 土館 +ドダテ 土舘 +トダナ 土棚 +トタニ 戸谷 +トダニ 戸谷 +トダマ 登玉 +トダマ 戸玉 +トダマ 十玉 +トダヤマ 戸田山 +ドタレ 堂垂 +トチ 都地 +トチ 土地 +トチ 登地 +トチ 栃 +トチ 戸知 +トチ 杤 +トヂ 都地 +ドチ 土地 +トチアキ 栩秋 +トチイ 栃井 +トチイ 東地井 +トチイ 檪井(櫟井) +トチウチ 栃内 +トチウチ 栩内 +トチウラ 櫟浦 +トチウラ 檪浦 +トチオ 栃尾 +トチオ 橡尾 +トチオ 杤尾 +トチオ 像尾 +トチオカ 栃岡 +トチオカ 杤岡 +トチオカ 櫟岡 +トチオカ 檪岡 +トチオリ 栃折 +トチガイト 朽垣内 +トチガイト 杤垣内 +トチガオカ 栃ケ岡 +トチカネ 栩兼 +トチガネ 栃金(杤金) +トチカワ 栃川 +トチカワ 栩川 +トチカワ 土地川 +トチカワ 橡川 +トチカワ 杤川 +トチキ 栃木 +トチキ 栩木 +トチキ 都知木 +トチキ 杤木 +トチキ 杼木 +トチギ 栃木 +トチギ 栩木 +トチギ 都知木 +トチギ 枋木 +トチギ 橡木 +トチギ 杤木 +トチギ 杼木 +トチク 都竹 +ドチク 土築 +トチクボ 栃久保 +トチクボ 栃窪 +トチクボ 杼窪 +トチクボ 杤久保 +トチクボ 栩窪 +トチクボ 栩久保 +トチクラ 栃倉 +トチサカ 栩坂 +トチサキ 栃崎 +トチザキ 栃崎 +トチサコ 栃迫 +トチサコ 枋迫 +トチサワ 栃沢 +トチザワ 栃沢 +トチザワ 栃澤 +トチシカ 栃眞賀 +トチシタ 栃下(杤下) +トチシマ 栃島 +トチダ 栃田 +トチダ 杤田 +トチダ 栩田 +トチタナ 栃棚 +トチタニ 栃谷 +トチタニ 枋谷 +トチタニ 戸知谷 +トチタニ 杤谷 +トチタニ 栩谷 +トチタニ 橡谷 +トチタニ 杼谷 +トチダニ 杤谷 +トチナイ 栃内 +トチナイ 栩内 +トチナイ 杤内 +トチナカ 栩中 +トチノ 栩野 +トチノ 栃野 +トチノキ 橡木 +トチバ 栃羽 +トチハタ 土地畑 +トチハタ 杤畠(栃畠) +トチバヤシ 栃林 +トチハラ 栃原 +トチハラ 栩原 +トチハラ 杼原 +トチハラ 杤原 +トチハラ 櫔原 +トチバラ 栩原 +トチヒラ 栃平(杤平) +トチヒラ 栩平 +トチヒラ 朽平 +トチフジ 栃藤 +トチフジ 杤藤 +トチボラ 栃洞 +トチボリ 栃堀 +トチボリ 杤堀 +トチマカ 栃真賀 +トチマル 栃丸(杤丸) +トチミゾ 土地溝 +トチムラ 栃村 +トチムラ 檪村 +トチムラ 杼村 +トチムラ 櫟村 +トチムラ 橡村 +トチモト 栃本 +トチモト 檪本 +トチモト 栃元 +トチモト 杤本 +トチモト 栩本 +トチモト 橡本 +トチモト 杼元 +トチモト 櫟本 +トチモト 朽本 +トチモト 杼本 +トチモリ 杼森 +トチモリ 栃森 +トチヤ 栃谷 +トチヤ 杤谷 +トチヤ 栃屋 +トチヤ 橡谷 +トチヤブ 栃薮 +トチヤブ 栃籔 +トチヤブ 栃藪 +トチヤマ 栃山 +トチヤマ 栩山 +トチヤマ 杤山 +トチヤマ 杼山 +トチヤマ 枋山 +トチュウ 途中 +トツ 戸津 +トツ 十都 +トツ 十津 +トヅ 戸津 +トヅ 十津 +トツイ 戸津井 +トツイ 土津井 +トツカ 戸塚 +トツカ 富塚 +トツカ 外塚 +トツカ 十塚 +トツカ 十束 +トツカ 十握 +トツカ 砥抦 +トツカ 十司 +トヅカ 戸塚 +トヅカ 富塚 +トヅカ 冨塚 +トヅカ 外塚 +トヅカ 砥抦 +ドヅカ 土塚 +トツカワ 戸津川 +トツカワ 十津川 +トツカワ 都津川 +トツカワ 土津川 +トツカワ 突川 +トツガワ 戸津川 +トツガワ 十津川 +トツガワ 都津川 +トツガワ 登津川 +トツギ 戸次 +トツギ 土次 +トツギ 戸継 +トツグ 戸次 +トッコ 東狐 +ドッコ 独古 +ドッコ 独鈷 +ドッコ 獨古 +ドッコ 獨鈷 +トッコウ 時耕 +トッコウ 取香 +トツサキ 戸津崎 +トツザキ 戸津崎 +ドツタ 土津田 +ドット 動音 +トットツ 突々 +トツトツ 突々 +トットリ 鳥取 +トットリ 十鳥 +トットリ 執取 +トットリ 取鳥 +トットリベ 鳥取部 +トツネ 戸恒 +トヅネ 戸恒 +トッパタ 鳥羽田 +トッパダ 鳥羽田 +トテ 迚 +トデ 戸出 +トデ 都出 +トデ 戸手 +ドテ 土手 +ドテ 登手 +ドテ 土堤 +ドデ 土出 +ドテウチ 堤内 +ドテウチ 土手内 +ドテウチ 土堤内 +ドテガワ 土手川 +ドテガワ 土手側 +ドテグチ 土手口 +ドテシタ 堤下 +ドテシタ 土手下 +ドテゾエ 土手添 +ドテヅカ 土手塚 +ドテナカ 土手中 +トテノ 迚野 +ドテノ 土手野 +ドテハラ 土手原 +ドテモト 堤本 +ドテモト 土手本 +ドテヤ 土手谷 +トテヤマ 十手山 +トド 百々 +トド 戸土 +ドド 百々 +ドド 百百 +ドド 闐闐 +トドウ 登藤 +トドウ 戸堂 +トドウ 渡頭 +ドトウ 土堂 +ドトウ 土東 +ドトウ 洞筒 +ドトウ 土塔 +ドトウ 土党 +ドドウ 堂道 +トトウゲ 登峠 +トトカワ 都外川 +トトガワ 都外川 +トドカワ 都外川 +トドガワ 都外川 +トトキ 十時 +トトキ 十々木 +トトキ 十十木 +トトキ 木 +トドキ 十時 +トドキ 藤々木 +トドキ 届木 +トドキ 塗々木 +トドコ 戸床 +トドコロ 富所 +トドコロ 外処 +トドコロ 戸所 +トドコロ 外所 +トドコロ 冨所 +トドコロ 都所 +トドコロ 外處 +トドシマ 魹島 +トトダ 斗々田 +トドノ 椴野 +ドドミ 百々海 +トドメ 留目 +ドドメキ 百々米木 +トトリ 十鳥 +トトリ 都鳥 +トトリ 戸取 +トドリ 十鳥 +トドリ 都鳥 +トドリ 戸取 +トドリキ 等々力(等等力) +トトリベ 鳥取部 +ドドロ 百々路 +トドロイ 轟井 +トドロキ 轟 +トドロキ 轟木(軣木) +トドロキ 等々力(等等力) +トドロキ 舎利弗 +トドロキ 軣 +トドロキ 舍利弗 +トドロキノウエ 轟之上 +トドロキハラ 轟原 +トドロハラ 轟原 +トドロバラ 轟原 +トドロバル 轟原 +トナ 戸奈 +トナ 戸名 +トナ 十七 +トナ 十名 +トナイ 戸内 +トナイ 斗内 +トナイ 兎内 +ドナイ 土内 +トナイザワ 斗内沢 +トナエ 都苗 +トナオ 戸奈尾 +トナカ 渡仲 +トナカ 渡中 +トナカ 戸中 +トナカ 戸仲 +トナカ 兎中 +トナカ 都中 +トナガ 戸永 +トナガ 戸長 +トナガ 斗永 +トナガ 登永 +ドナカ 土中 +トナキ 渡名喜 +トナキ 登那木 +トナギ 鳥名木 +トナギ 登梛 +トナシ 唐梨子 +トナセ 戸納瀬 +トナベ 藤辺(藤邉) +トナベ 十七部 +トナミ 砺波 +トナミ 戸波 +トナミ 外海 +トナミ 利波 +トナミ 礪波 +トナミ 渡並 +トナミ 戸浪 +トナミ 富波 +トナミ 当波 +トナミ 冨波 +トナミ 外波 +トナミ 冨浪 +トナミ 當波 +トナミ 戸並 +トナミ 励波 +トナミ 十南 +トナミ 殿南 +トナミ 渡浪 +トナミ 砥波 +トナミ 土浪 +トナミ 栃波 +トナミ 富浪 +トナメ 十七女 +トナリ 戸成 +トナリ 隣 +トナリ 戸鳴 +トナリ 都成 +トナリ 斗成 +トナリ 渡成 +トナリ 登成 +トナリ 十七里 +トナリイ 隣井 +トナリガイチ 隣垣内 +トナリガキ 隣垣 +トナリカキウチ 隣垣内 +トナリヤ 隣谷 +トナル 戸成 +トナル 戸鳴 +トニシ 戸西 +トニハラ 唐仁原 +トニムラ 十二村 +トニワ 戸庭 +トヌマ 戸沼 +ドヌマ 土沼 +トネ 刀根 +トネ 刀祢 +トネ 東根 +トネ 利根 +トネ 戸根 +トネ 刀禰 +トネ 登根 +トネ 刀称 +トネ 頭根 +トネ 刀弥 +トネ 渡根 +トネ 東畝 +トネ 東稔 +トネ 戸禰 +トネ 戸祢 +トネ 舎 +トネ 鳥鼠 +トネ 斗根 +トネ 刀稱 +トネ 刀楠 +トネアキ 刀祢明 +トネガワ 利根川 +トネガワ 舎川 +トネガワ 戸根川 +トネガワ 刀根川 +トネガワ 十根川 +トネガワ 舍川 +トネキ 渡木 +トネキ 戸根木 +トネギ 渡木 +トネギ 戸根木 +トネギ 渡根木 +トネギ 利根木 +トネサク 東根作 +トネザワ 利根沢 +トネザワ 利根澤 +トネダ 刀祢田 +トネダ 刀禰田 +トネダ 利根田 +トネダチ 刀祢館 +トネダチ 刀禰館 +トネヒラ 刀祢平 +トネヒラ 刀禰平 +トネヤ 戸根谷 +トネヤ 刀祢谷 +トネヤ 刃禰谷 +トネヤ 利根屋 +トネヤマ 利根山 +トネヤマ 戸根山 +トネリ 戸練 +トネリ 舎人 +トネリ 渡錬 +トノ 戸野 +トノ 登野 +トノ 登埜 +トノ 殿 +トノ 戸堅 +トノ 登能 +トノイ 殿井 +トノイ 直宿 +トノイケ 外池 +トノイケ 外ノ池 +トノイケ 土野池 +トノイケ 殿池 +トノイソ 外磯 +トノイソ 外礒 +トノウ 斗納 +トノウ 殿納 +トノウ 戸能 +トノウ 唱 +トノウ 戸納 +トノウエ 戸上 +トノウエ 殿上 +トノウエ 渡植 +ドノウエ 堂上 +ドノウエ 土上 +トノウチ 登内 +トノウチ 戸内 +トノウチ 殿内 +トノウチ 外内 +トノウチ 斗内 +トノウチ 外之内 +トノウチ 登之内 +トノウチ 戸ノ内 +トノウチ 戸之内 +トノウラ 外浦 +トノウラ 殿浦 +トノエ 遠衛 +トノエ 外江 +トノエ 遠衞 +トノエ 殿江 +トノオ 塔尾 +トノオ 殿尾 +トノオ 殿生 +トノオカ 外岡 +トノオカ 殿岡 +トノオカ 戸ノ岡 +トノオカ 外ノ岡 +トノカイ 殿界 +トノカイ 殿貝 +トノガイ 外海 +トノガイ 殿谷 +トノガイ 殿界 +トノガイ 殿貝 +トノガイチ 殿垣内 +トノガイト 殿垣内 +トノガウチ 殿垣内 +トノガキ 殿垣 +トノガキ 殿柿 +トノカキウチ 殿垣内 +トノガキウチ 殿垣内 +トノガシタ 殿ケ下 +トノカツ 殿勝 +トノガミ 殿上 +トノガヤ 殿下屋 +トノカワ 殿川 +トノカワ 戸野川 +トノカワ 都野川 +トノカワ 殿河 +トノガワ 殿川 +トノガワ 戸野川 +トノガワ 都野川 +トノガワ 殿河 +トノキ 外木 +トノキ 登野城 +トノキ 殿木 +トノキ 殿城 +トノギ 外木 +トノギ 登野城 +トノギ 殿木 +トノキタ 殿北 +トノキド 殿木戸 +トノクチ 戸野口 +トノクチ 戸之口 +トノクチ 殿口 +トノグチ 戸野口 +ドノクチ 道口 +トノクラ 戸野倉 +トノクラ 殿倉 +トノケ 外除 +トノコ 渡子 +トノコウチ 殿河内 +トノゴウチ 殿河内 +トノサカ 殿坂 +トノサキ 外崎 +トノサキ 殿崎 +トノサキ 戸ノ崎 +トノサキ 殿嵜 +トノザキ 外崎 +トノザキ 殿崎 +トノザキ 戸ノ崎 +トノザキ 外埼 +トノサコ 殿迫(殿廹) +トノシキ 殿敷 +トノシゲ 殿重 +トノシタ 塔下 +トノシタ 殿下 +トノシタ 戸ノ下 +トノシタ 灯下 +トノシタ 燈下 +ドノシタ 堂下 +トノシバ 殿芝 +トノシマ 殿島 +トノショウ 土野庄 +トノシロ 登野城 +トノシロ 殿城 +トノシロ 殿代 +ドノシロ 道城 +トノズカ 殿塚 +トノズカ 土濃塚 +トノズカ 戸野塚 +トノセ 外瀬 +トノソノ 殿園 +トノゾノ 殿園 +トノダ 殿田 +トノダ 戸野田 +トノタニ 殿谷 +トノタニ 戸野谷 +トノチ 外内 +トノヂ 殿地 +トノツカ 外塚 +トノツカ 殿塚 +トノツカ 土濃塚 +トノツカ 戸野塚 +トノヅカ 外塚 +トノヅカ 殿塚 +トノヅカ 土濃塚 +トノヅカ 戸野塚 +トノヅカ 殿墳 +トノトコロ 殿所 +トノドコロ 殿所 +トノニシ 殿西 +ドノハシ 百橋 +トノハタ 殿畑 +トノハタ 殿畠 +トノバヤシ 殿林 +トノハラ 殿原 +トノハラ 登野原 +トノハラ 戸野原 +トノヒガシ 殿東 +トノヒラ 殿平 +トノヒロ 戸野広(戸野廣) +トノヒロ 殿広 +トノベ 戸野部 +トノベ 戸ノ部 +トノベ 戸延 +トノベ 戸野辺 +トノベ 殿部 +トノホラ 戸之洞 +トノホリ 殿堀 +トノボリ 戸登 +トノマエ 殿前 +ドノマエ 堂野前 +トノマキ 外牧 +トノマチ 殿待 +トノミ 主海 +トノミ 富海 +トノミ 殿見 +トノミ 冨海 +トノミズ 殿水 +トノミョウ 殿明 +トノムラ 外村 +トノムラ 殿村 +トノムラ 戸野村 +トノムラ 戸埜村 +トノムラ 外野村 +トノムラ 殿邑 +トノムラ 斗村 +トノムラ 東野村 +トノメ 十ノ目 +トノモ 殿最 +トノモト 塔本 +トノモト 殿本 +トノモト 戸野本 +トノモト 殿元 +トノモト 戸ノ本 +トノモリ 殿守 +トノモリ 殿森 +トノモリ 主森 +トノモリ 登野盛 +トノモリ 殿護 +トノヤ 殿谷 +トノヤ 戸野谷 +トノヤ 殿納屋 +トノヤマ 殿山 +トノリ 時乗(時乘) +トノワキ 殿脇 +トハ 戸破 +トバ 鳥羽 +トバ 戸羽 +トバ 戸波 +トバ 鳥場 +トバ 冨波 +トバ 外波 +トバ 外羽 +トバ 鳥波 +トバ 戸場 +トバ 計羽 +トバ 戸葉 +ドバ 土場 +トハシ 都橋 +トバシ 土橋 +トバシ 都橋 +トバシ 鳥觜 +トバシ 戸橋 +ドハシ 土橋 +ドバシ 土橋 +トハシラ 戸柱 +トバシラ 戸柱 +トバセ 鳥羽瀬 +トバタ 戸畑 +トバタ 鳥羽田 +トバタ 戸端 +トバタ 戸幡 +ドハタ 土畑 +ドバタ 土畑 +ドバタ 土畠 +ドバタ 土幡 +トハナ 戸花 +トハナ 戸鼻 +トバナ 戸花 +トバナ 戸鼻 +トバナ 外花 +ドハナ 土花 +ドバナ 土鼻 +トバノ 鳥羽野 +トハヤ 戸早 +トバヤ 鳥羽谷 +トバヤシ 外林 +トバヤシ 戸林 +トバヤシ 十林 +ドバヤシ 土林 +トバヤマ 鳥羽山 +トバヤマ 外波山 +トハラ 戸原 +トハラ 都原 +トハラ 登原 +トバラ 都原 +トバラ 登原 +トバライ 兎拂 +トハリ 戸張 +トバリ 戸張 +トバリ 帳 +トバリ 登張 +トヒ 土肥 +トヒ 戸肥 +トヒ 戸樋 +トヒ 都鄙 +トビ 登日 +トビ 鳶 +トビ 飛 +ドヒ 土肥 +ドヒ 土日 +トビイ 飛井 +トビイエ 飛家 +トビイシ 飛石 +トビイワ 鳶岩 +トビウチ 飛内 +トビウメ 飛梅 +トビオ 鳶尾 +トビオカ 飛岡 +トビオチ 飛落 +トビカ 飛賀 +トビガキ 飛柿 +トビカキウチ 飛垣内 +トビガス 鳶ケ巣 +トビカワ 飛川 +トビカワ 鳶川 +トビキ 戸引 +トビキ 戸匹 +トビキ 飛木 +トビク 飛工 +トビグチ 飛口 +トビグチ 鳶口 +ドヒグチ 土肥口 +トビクマ 飛熊 +トビコシ 飛越 +トビサ 飛佐 +トビサカ 飛坂 +トビサカ 鳶坂 +トビサキ 飛崎 +トビサキ 鴟崎 +トビサコ 飛峪 +トビサト 飛里 +トビサワ 飛沢 +トビサワ 飛澤 +トビサワ 鳶沢(鳶澤) +トビザワ 飛沢 +トビザワ 飛澤 +トビシタ 飛下 +トビシマ 飛島 +トビシマ 飛嶋 +トビシマ 鳶島 +トビス 鳶巣 +トビス 飛子 +トビス 飛栖 +トビセ 飛世 +トビセ 飛瀬 +トビタ 飛田 +トビタ 鳶田 +トビタカ 飛鷹 +トビタケ 飛武 +トビタニ 飛谷 +トビタニ 鳶谷 +トビチ 飛地 +トビツカ 飛塚 +トビヅカ 飛塚 +トヒツナ 登日綱 +トビト 飛渡 +トビト 飛戸 +トビナ 飛奈 +トビナ 鳶那 +トビナイ 飛内 +トビナガ 飛永 +トビネ 鳶根 +トビノ 飛野 +トビノ 鳶野 +ドヒノ 土肥野 +トビノブ 飛延 +トビハヤシ 飛林 +トビバヤシ 飛林 +トビハラ 飛原 +ドヒハラ 土肥原 +トビマツ 飛松 +トビムラ 飛村 +トビモト 鳶本 +ドヒモト 土肥元 +トヒヤ 戸樋谷 +トビヤ 飛家 +トビヤ 飛屋 +トビヤス 飛安 +トビヤス 鳶保 +トビヤマ 飛山 +トヒョウ 戸兵 +トヒラ 都平 +トヒラ 戸平 +トビラキ 戸開 +ドヒワ 土樋輪 +トビワタリ 飛渡 +トブ 都生 +ドブ 土部 +ドフク 土福 +トブクロ 戸袋 +トブシ 戸伏 +トフセ 戸伏 +トブセ 戸伏 +トフタニ 豆腐谷 +ドブチ 土渕 +ドブチ 土淵 +トフノ 登婦野 +トベ 戸部 +トベ 戸辺 +トベ 戸邉 +トベ 戸邊 +トベ 十倍 +トベ 戸兵 +トベ 都部 +トベ 都辺 +ドベ 土部 +ドベイ 土塀 +トヘクラ 藤平蔵 +トヘゾウ 藤平蔵 +トヘダ 藤平田 +トベタ 戸部田 +トベチ 苫地 +トホ 渡保 +ドホ 土保 +ドボク 土木 +トボケ 戸保家 +トボシ 戸星 +トボシ 斗星 +トボヤ 戸保家 +トホリ 砥堀 +トボリ 戸堀 +トボリ 砥堀 +トボリ 砥掘 +ドボリ 土堀 +トマ 外間 +トマ 戸澗 +トマ 戸間 +トマ 苫 +トマ 笘 +トマ 都馬 +トマ 戸摩 +ドマ 土間 +ドマ 土馬 +トマイ 斗米 +トマイ 笘居 +トマイ 苫井 +トマイ 笘井 +トマイ 苫居 +トマイ 戸真伊 +トマエ 戸前 +トマエ 鳥前 +トマオ 笘尾 +トマガイ 戸間替 +トマガエ 戸間替 +トマガヒラ 笘ケ平 +トマガヒラ 苫ケ平 +トマガヤマ 泊ケ山 +トマカワ 笘川 +トマカワ 苫川 +トマキ 戸巻 +トマキ 戸蒔 +トマキ 戸牧 +トマグチ 笘口(苫口) +トマゴウ 蓬郷 +トマゴウ 篷郷 +トマサ 戸政 +トマサ 登間佐 +トマサカ 苫坂 +トマザワ 苫澤(笘澤) +トマシタ 苫下(笘下) +トマシノ 苫篠 +トマシノ 笘篠 +トマシマ 笘島(苫島) +トマス 戸増 +トマス 斗升 +トマス 斗舛 +トマス 斗桝 +ドマス 土増 +トマダ 苫田 +トマダ 戸馬田 +トマタニ 苫谷 +トマタニ 笘谷 +トマチ 戸町 +トマツ 戸松 +トマツ 富松 +トマツ 冨松 +トマツ 外松 +トマツ 十松 +トマツ 登松 +トマツ 渡松 +ドマツ 土松 +トマツリ 戸祭 +トマツリ 都祭 +トマナ 苫名 +トマノ 苫野 +トマノ 笘野 +トマハラ 苫原 +トマハラ 笘原 +トマヒロ 笘廣 +トマブチ 苫渕 +トマベチ 苫米地 +トマベチ 笘米地 +トマミ 苫見 +トマミ 笘見 +トマモト 笘本 +トマモト 苫本 +トマヤ 苫谷 +トマヤ 笘谷 +トマヤ 笘屋 +トマヤ 苫屋 +トマリ 泊 +トマリ 渡真利 +トマリ 泊里 +トマリ 泊り +トマリ 戸鞠 +トマリ 渡眞利 +トマリ 泊利 +トマリイケミ 泊池味 +トマリイワ 泊岩 +トマリウチ 泊内 +トマリガヤマ 泊ケ山 +トマリカワ 泊川 +トマリグチ 泊口 +トマリザワ 泊沢 +トマリザワ 泊澤 +トマリデ 泊出 +トマリノ 泊野 +トマリムラ 泊村 +トマリヤ 泊谷 +トマル 泊 +トマル 都丸 +トマル 戸丸 +トマル 外丸 +トマル 登丸 +トマル 東丸 +トマル 渡丸 +トミ 富 +トミ 冨 +トミ 登美 +トミ 十三 +トミ 戸見 +トミ 登見 +ドミ 土味 +トミアイ 冨合 +トミアキ 富秋 +トミアキ 冨秋 +トミイ 富井 +トミイ 冨井 +トミイ 富居 +トミイ 冨居 +トミイエ 富家 +トミイエ 冨家 +トミイケ 富池 +トミイシ 富石 +トミイシ 冨石 +トミイタ 富板 +トミイタ 冨板 +トミイワ 富岩(冨岩) +トミウカ 富宇加 +トミウカ 冨宇加 +トミウガ 富宇賀 +トミウガ 冨宇賀 +トミウチ 富内 +トミウチ 冨内 +トミウラ 富浦 +トミウラ 冨浦 +トミエ 富永 +トミエ 冨江 +トミエ 富江 +トミエ 冨栄 +トミエ 富栄 +トミエ 富恵 +トミエ 富惠 +トミエ 冨恵(冨惠) +トミエイ 富栄 +トミオ 富尾 +トミオ 冨尾 +トミオ 冨生 +トミオカ 富岡 +トミオカ 冨岡 +トミオカ 富岳 +トミオカ 冨丘 +トミオカ 富丘 +トミオカ 冨岳 +トミオギ 富尾木 +トミオギ 冨尾木 +トミオク 富奥 +トミオク 冨奥 +トミカ 富家 +トミカ 冨賀 +トミカ 富賀 +トミガ 冨賀 +トミガ 富賀 +トミガキ 富垣 +トミガキ 冨垣 +トミカシ 富樫 +トミカシ 冨樫 +トミガシ 富樫 +トミガシ 冨樫 +トミガセ 冨賀瀬 +トミガセ 富賀瀬 +トミカタ 富方 +トミカド 富門 +トミガハラ 冨ケ原 +トミガハラ 富ケ原 +トミカミ 冨上 +トミカミ 富上 +トミガミ 冨上 +トミガミ 富上 +トミカワ 富川 +トミカワ 冨川 +トミカワ 臣川 +トミカワ 璒美川 +トミカワ 冨河 +トミキ 富木 +トミキ 冨木 +トミキ 富来(富耒) +トミキ 冨来 +トミキ 冨來 +トミキ 頓木 +トミキ 富來 +トミキュウ 富久 +トミキヨ 富清 +トミキヨ 冨清 +トミク 富久 +トミク 冨久 +トミク 富来(富耒) +トミク 冨来 +トミク 冨工 +トミク 富工 +トミク 冨耒 +トミクダ 富久田 +トミクダ 冨久田 +トミグチ 富口 +トミグチ 冨口 +トミクニ 富国(富國) +トミクボ 富窪 +トミクボ 富久保 +トミクラ 富倉 +トミクラ 冨倉 +トミケ 富家 +トミケ 冨家 +トミコシ 富越 +トミサ 冨狭 +トミサカ 富坂 +トミサカ 富阪 +トミサカ 冨坂 +トミサカ 冨阪 +トミサキ 富崎 +トミサキ 冨崎 +トミサキ 富向(冨向) +トミサキ 富嵜 +トミサキ 冨嵜 +トミザキ 富崎 +トミザキ 冨崎 +トミサケ 富酒 +トミサケ 冨酒 +トミサコ 冨迫 +トミサコ 富迫 +トミサダ 富貞 +トミサダ 冨貞 +トミサト 冨里 +トミサト 富里 +トミサト 豊見里 +トミザト 富里 +トミザト 豊見里 +トミサワ 富沢 +トミサワ 富澤 +トミサワ 冨沢 +トミサワ 冨澤 +トミザワ 富沢 +トミザワ 富澤 +トミザワ 冨沢 +トミザワ 冨澤 +トミシ 冨士 +トミジ 冨地 +トミシカ 富鹿 +トミシカ 冨鹿 +トミシゲ 富重 +トミシゲ 冨重 +トミシゲ 富繁 +トミシゲ 冨繁 +トミシタ 富下 +トミシタ 冨下 +トミシマ 豊島(豐島) +トミシマ 富島 +トミシマ 冨島 +トミシマ 冨嶋 +トミシマ 富嶋 +トミシマ 戸見嶋 +トミジマ 富島 +トミジマ 冨島 +トミジマ 冨嶋 +トミジマ 富嶋 +トミシュク 富宿 +トミショ 富所 +トミシロ 豊見城 +トミシロ 富城 +トミシロ 冨城 +トミシロ 富代 +トミス 戸簾 +トミズ 戸水 +トミズ 富水 +トミズ 冨水 +トミズカ 富塚 +トミズカ 冨塚 +トミスギ 富杉 +トミスナ 冨砂(富砂) +トミズミ 冨住 +トミズミ 富住 +トミズル 富水流(冨水流) +トミセ 富瀬 +トミセ 冨瀬 +トミゼン 冨善 +トミソコ 富底 +トミゾノ 富園(冨園) +トミゾノ 富薗 +トミタ 富田 +トミタ 冨田 +トミタ 頓田 +トミタ 冨多 +トミタ 富多 +トミタ 富太 +トミタ 冨見田 +トミダ 富田 +トミダ 冨田 +トミタカ 富高 +トミタカ 冨高 +トミダカ 富高 +トミタガワ 冨田川 +トミタガワ 富田川 +トミタク 冨宅 +トミタク 富宅 +トミタケ 富武 +トミタケ 富嶽 +トミタケ 冨竹 +トミタケ 冨武 +トミタテ 富館 +トミタテ 富舘 +トミタニ 富谷 +トミタニ 冨谷 +トミタヤ 富田谷 +トミチ 富地 +トミチ 冨地 +トミヂ 冨地 +トミチカ 富近 +トミチカ 冨近 +トミチク 冨築 +トミツ 戸光 +トミツカ 富塚 +トミツカ 冨塚 +トミツカ 富司 +トミツカ 冨司 +トミヅカ 富塚 +トミヅカ 冨塚 +トミヅキ 富築 +トミヅキ 冨築 +トミツグ 富次 +トミツグ 冨次 +トミツナ 冨綱(富綱) +トミヅミ 富積 +トミツル 冨鶴 +トミヅル 富鶴 +トミヅル 冨鶴 +トミヅル 富水流(冨水流) +トミテ 冨手 +トミテ 富手 +トミドウ 富堂 +トミドウ 冨堂 +トミトコロ 富所 +トミドコロ 富所 +トミドコロ 冨所 +トミドコロ 富処 +トミドコロ 冨処 +トミトリ 富取 +トミトリ 冨取 +トミナ 富菜 +トミナ 富名 +トミナ 冨菜 +トミナ 冨名 +トミナカ 冨中 +トミナカ 富中 +トミナカ 冨仲(富仲) +トミナガ 富永 +トミナガ 冨永 +トミナガ 富長 +トミナガ 冨長 +トミナガ 臣永 +トミナガ 豊見永 +トミナミ 富波 +トミナミ 冨波 +トミナミ 斗南 +トミナミ 冨並 +トミナミ 冨浪 +トミナミ 富並 +トミナリ 富成 +トミナリ 冨成 +トミニシ 富西 +トミニシ 冨西 +トミヌキ 富貫 +トミヌキ 冨貫 +トミヌシ 富主 +トミヌシ 冨主 +トミノ 富野 +トミノ 冨野 +トミノ 富能(冨能) +トミノイ 富野井 +トミノイ 冨野井 +トミノウ 富能(冨能) +トミノコウジ 富小路(冨小路) +トミノモリ 富森 +トミノモリ 冨森 +トミハ 富羽 +トミハ 冨羽 +トミバ 富場 +トミバ 冨場 +トミハシ 富橋 +トミハタ 富畑 +トミハタ 冨畑 +トミハナ 頓花 +トミハマ 富浜 +トミハマ 富濱 +トミバヤシ 富林 +トミバヤシ 冨林 +トミハラ 富原 +トミハラ 冨原 +トミハラ 拾三原 +トミハリ 富張 +トミハリ 冨張 +トミハル 富春 +トミハル 冨春 +トミヒサ 富久 +トミヒサ 冨久 +トミヒラ 富平 +トミヒラ 冨平 +トミヒラ 頓平 +トミヒレ 富領 +トミヒロ 富廣 +トミヒロ 冨広 +トミヒロ 富広 +トミヒロ 富弘 +トミヒロ 冨弘 +トミヒロ 冨廣 +トミフク 冨福 +トミフク 富福 +トミフジ 冨藤 +トミフジ 富藤 +トミベ 冨部 +トミベ 富部 +トミホ 富穂 +トミマ 富磨 +トミマサ 富政 +トミマサ 冨政 +トミマス 富増 +トミマス 冨増 +トミマス 富桝 +トミマス 冨舛 +トミマス 冨桝 +トミマス 富舛 +トミマス 富枡 +トミマス 冨益 +トミマツ 富松 +トミマツ 冨松 +トミマル 富丸 +トミマル 冨丸 +トミミズ 富水 +トミミズ 冨水 +トミミツ 冨満 +トミミツ 富満 +トミミツ 富光 +トミミツ 冨光 +トミミツ 冨滿 +トミミネ 富峰 +トミミネ 富嶺(冨嶺) +トミミネ 冨峯 +トミミヤ 富宮 +トミムラ 富村 +トミムラ 冨村 +トミムロ 富室 +トミムロ 冨室 +トミモチ 富持 +トミモト 富本 +トミモト 冨本 +トミモト 富元 +トミモト 豊見本 +トミモト 冨元 +トミモリ 富森 +トミモリ 冨森 +トミモリ 富盛 +トミモリ 豊見盛 +トミモリ 臣守 +トミモリ 冨盛 +トミモリ 富守 +トミモリ 冨守 +トミヤ 富谷 +トミヤ 冨谷 +トミヤ 富家 +トミヤ 頓宮 +トミヤ 冨家 +トミヤ 富弥 +トミヤ 富屋 +トミヤ 冨屋 +トミヤ 冨弥 +トミヤ 渡海谷 +トミヤ 戸宮 +トミヤ 冨矢 +トミヤ 富也 +トミヤ 富矢 +トミヤ 冨彌 +トミヤス 富安 +トミヤス 冨安 +トミヤス 冨康 +トミヤス 富保 +トミヤス 冨保 +トミヤス 富康 +トミヤド 冨宿 +トミヤド 富宿 +トミヤブ 富藪 +トミヤブ 冨薮 +トミヤマ 富山 +トミヤマ 冨山 +トミヤマ 豊見山 +トミヤマ 兎耳山 +トミヤマ 戸見山 +トミヤマ 富見山 +トミヨシ 冨吉 +トミヨシ 富吉 +トミヨシ 富好 +トミヨシ 富芳 +トミヨシ 冨好 +トミヨシ 冨芳 +トミヨリ 冨依 +トミヨリ 富依 +トミラク 富楽 +トミラク 冨楽(冨樂) +トミワ 富和 +トミワキ 富脇 +トミワキ 冨脇 +トムカイ 戸向 +トムラ 戸村 +トムラ 外村 +トムラ 東村 +トムラ 渡村 +トムラ 登村 +トムラ 戸邨 +トムラ 十村 +トムラ 外邨 +トムロ 戸室 +トメ 當銘 +トメ 登米 +トメ 留 +トメイ 留井 +トメイカリ 留碇 +トメオカ 留岡 +トメオキ 留置 +トメオク 留奥 +トメガイ 溜貝 +トメカワ 留河 +トメカワ 留川 +トメガワ 留河 +トメキ 留置 +トメキ 留木 +ドメキ 轟 +ドメキ 百目鬼 +ドメキ 百目木 +トメグチ 留口 +トメサカイ 止境 +トメサキ 留崎 +トメザキ 留崎 +トメシマ 留島 +トメスエ 留末 +トメタ 留田 +トメダ 留田 +トメダ 藤米田 +トメタカ 留高 +トメナカ 留中 +トメナガ 留永 +トメノ 留野 +トメバ 留場 +トメハタ 留畑 +トメハラ 止原 +トメベ 止部 +トメマツ 留松 +トメムラ 留村 +トメモト 留本 +トメモリ 留守 +トメモリ 留森 +トメモリ 留盛 +トメヤス 留安 +トメヤマ 留山 +トメヨシ 留吉 +トメワケ 留分 +トモ 塘 +トモ 鞆 +トモ 友 +トモ 知 +トモ 靹 +トモアキ 共明 +トモイ 友井 +トモイ 艫居 +トモイ 伴井 +トモイ 知井 +トモイ 友居 +トモイ 鞆井 +トモイ 舮居 +トモイ 智井 +トモイ 塘居 +トモイ 艫井 +トモイカリ 友碇 +トモイガワ 友井川 +トモイケ 友池 +トモイシ 友石 +トモイダ 友井田 +トモウチ 塘内 +トモウラ 友浦 +トモウラ 知浦 +トモウラ 鞆浦 +トモエ 巴 +トモエ 友江 +トモエ 友恵 +トモエ 友栄 +トモエ 鞆江 +トモエガワ 巴川 +トモエダ 友枝 +トモエヤ 巴谷 +トモエヤマ 巴山 +トモオ 友尾 +トモオ 友生 +トモオカ 友岡 +トモオカ 塘岡 +トモオカ 鞆岡 +トモカゲ 友景 +トモカゲ 友影 +トモカズ 友数 +トモカズ 友員 +トモカタ 友方 +トモカネ 友金 +トモカネ 友兼 +トモガネ 友金 +トモカミ 友上 +トモガミ 友上 +トモカワ 友川 +トモカワ 巴川 +トモカワ 鞆川 +トモカワ 供川 +トモカワ 塘川 +トモカワ 友河 +トモキ 友木 +トモキ 鞆来 +トモギク 友菊 +トモキヤ 友木屋 +トモキヨ 友清 +トモキヨ 鞆清 +トモク 鞆工 +トモクサ 友草 +トモグチ 塘口 +トモグチ 友口 +トモクニ 友国 +トモクニ 朝国 +トモクニ 友國 +トモクニ 朝國 +トモクボ 友久保 +トモクラ 友倉 +トモクラ 知倉 +トモグリ 友栗 +トモサ 友佐 +トモザ 友座 +トモサカ 友坂 +トモサカ 塘坂 +トモサキ 友崎 +トモサキ 塘崎 +トモザキ 友崎 +トモザキ 塘崎 +トモサダ 友定 +トモサダ 友貞 +トモサト 朋里 +トモザネ 友実 +トモザネ 友實 +トモザネ 友真(友眞) +トモサワ 友沢 +トモサワ 友澤 +トモザワ 友沢 +トモザワ 友澤 +トモザワ 朋沢(朋澤) +トモシ 友師 +トモシゲ 友重 +トモシゲ 朝重 +トモシゲ 友繁 +トモシタ 友下 +トモシマ 伴島 +トモシマ 友島 +トモシマ 友嶋 +トモショウ 友正 +トモショウ 鞆正 +トモジリ 友尻 +トモスエ 友末 +トモスエ 朝末 +トモスギ 友杉 +トモスギ 友椙 +トモズミ 友住 +トモセ 友瀬 +トモセ 友生 +トモゾエ 友添 +トモゾエ 塘添 +トモゾメ 友染 +トモタ 友田 +トモタ 伴田 +トモタ 共田 +トモタ 朋田 +トモダ 友田 +トモダ 朝田 +トモダ 伴田 +トモダ 共田 +トモダ 智田 +トモダ 供田 +トモダ 塘田 +トモダ 巴田 +トモダ 鞆田 +トモダ 朋田 +トモタカ 友高 +トモタキ 友滝 +トモタキ 友瀧 +トモタケ 友竹 +トモタケ 朝武 +トモタケ 渡守武 +トモタケ 友武 +トモタニ 友谷 +トモタニ 鞆谷 +トモタニ 伴谷 +トモタニ 靹谷 +トモタリ 知足 +トモチ 友知 +トモチ 十持 +トモチ 友地 +トモチカ 友近 +トモツ 鞆津 +トモツカ 友塚 +トモヅカ 友塚 +トモツギ 友次 +トモツグ 友次 +トモツケ 友附 +トモツナ 友綱 +トモヅナ 友綱 +トモヅナ 鞆綱 +トモツネ 友常 +トモデ 鞆出 +トモト 戸本 +トモト 登本 +ドモト 土本 +トモトキ 友時 +トモトシ 友利 +トモトシ 友歳 +トモトシ 友才 +トモトミ 友富 +トモトミ 友冨 +トモトラ 友虎 +トモナ 知名 +トモナ 友名 +トモナオ 友直 +トモナカ 塘中 +トモナカ 友中 +トモナガ 友永 +トモナガ 朝長 +トモナガ 朝永 +トモナガ 塘永 +トモナガ 友長 +トモナガ 供長 +トモナガ 鞆永 +トモナリ 友成 +トモナリ 友斉(友齊) +トモナリ 兎毛成 +トモナリ 友齋 +トモナル 友鳴 +トモナワ 友縄 +トモニシ 友西 +トモノ 伴野 +トモノ 友野 +トモノ 朝野 +トモノ 友生 +トモノ 供野 +トモノ 鞆野 +トモノ 塘野 +トモノウ 友納 +トモノクチ 塘之口 +トモノブ 友延 +トモノブ 友信 +トモノベ 友延 +トモノリ 友則 +トモハ 智羽 +トモハタ 塘端 +トモバヤシ 伴林 +トモバヤシ 塘林 +トモバヤシ 友林 +トモハラ 友原 +トモハラ 塘原 +トモヒサ 知久 +トモヒサ 友久 +トモヒラ 知平 +トモヒラ 友平 +トモヒロ 友広 +トモヒロ 友廣 +トモヒロ 友弘 +トモフサ 鞆 +トモフサ 友房 +トモフサ 靹 +トモフサ 鞆総 +トモフサ 鞆總 +トモフジ 友藤 +トモブチ 友渕 +トモブチ 友淵 +トモベ 友部 +トモベ 友辺(友邉) +トモベ 知部 +トモベ 伴辺 +トモベ 友邊 +トモマエ 友前 +トモマキ 友巻 +トモマサ 友政 +トモマサ 友正 +トモマサ 朋政 +トモマツ 友松 +トモミ 知見 +トモミ 友実 +トモミズ 友水 +トモミチ 友道 +トモミツ 友光 +トモミツ 伴光 +トモミツ 鞆光 +トモミネ 友峯 +トモミネ 友峰 +トモムネ 友宗 +トモムラ 友村 +トモムラ 供村 +トモムラ 塘村 +トモモト 友本 +トモモト 塘本 +トモモリ 友森 +トモモリ 友盛 +トモモリ 友守 +トモモリ 鞆森 +トモヤ 友谷 +トモヤ 鞆谷 +トモヤ 鞆屋 +トモヤ 友屋 +トモヤス 友安 +トモヤス 友保 +トモヤス 鞆安 +トモヤマ 巴山 +トモヤマ 友山 +トモヤマ 伴山 +トモユキ 友行 +トモヨシ 友好 +トモヨシ 友善 +トモヨシ 友吉 +トモヨシ 友葭 +トモヨシ 友義 +トモヨセ 友寄 +トモヨリ 友寄 +トモラ 友良 +トモリ 友利 +トモリ 戸森 +トモリ 土森 +トモリ 渡守 +トモリ 供利 +トモリ 登森 +トモリ 戸守 +トモリ 都守 +トモリ 登守 +トモリ 十森 +トモリ 登盛 +トモロ 戸諸 +トモン 外門 +ドモン 土門 +トヤ 戸谷 +トヤ 鳥谷 +トヤ 外谷 +トヤ 戸屋 +トヤ 戸矢 +トヤ 鳥屋 +トヤ 鳥家 +トヤ 都谷 +トヤ 登谷 +トヤ 戸家 +トヤ 戸舎(戸舍) +トヤ 十屋 +ドヤ 土谷 +トヤオ 鳥屋尾 +トヤオ 鳥谷尾 +トヤオ 鳥尾 +ドヤオ 土屋尾 +トヤガワ 戸谷川 +トヤギリ 外矢切 +トヤコシ 鳥谷越 +トヤサキ 戸矢崎 +トヤザキ 戸矢崎 +トヤザキ 戸矢埼 +トヤサワ 戸谷澤 +トヤザワ 戸谷沢 +トヤザワ 戸谷澤 +トヤタ 戸谷田 +トヤダ 戸谷田 +トヤツカ 戸谷塚 +トヤナゴ 鳥屋子 +トヤノ 鳥屋野 +トヤバ 外谷場(外谷塲) +トヤハラ 鳥屋原 +トヤバラ 鳥屋原 +トヤバラ 鳥屋ケ原 +トヤベ 鳥谷部 +トヤベ 鳥屋部 +トヤマ 外山 +トヤマ 富山 +トヤマ 冨山 +トヤマ 戸山 +トヤマ 豊山 +トヤマ 登山 +トヤマ 砥山 +トヤマ 兜山 +トヤマ 渡山 +トヤマ 都山 +トヤマ 十山 +トヤマ 斗山 +トヤマ 砺山 +トヤマ 礪山 +トヤマ 計山 +トヤマ 兎山 +トヤマ 塗山 +ドヤマ 土山 +ドヤマ 度山 +トヤミネ 鳥谷峰 +トヤミネ 鳥谷峯 +トヤモリ 都谷森 +トユキ 頓行 +トユダ 樋田 +トヨ 豊 +トヨ 外余 +トヨアキ 豊穐 +トヨアキ 豊秋 +トヨアサ 豊朝 +トヨアシ 豊芦 +トヨイ 豊井 +トヨイク 豊幾 +トヨイケ 豊池 +トヨイシ 豊石 +トヨイズミ 豊泉 +ドヨウ 土用 +トヨウジ 豊用寺 +ドヨウシタ 土用下 +トヨウチ 豊内 +トヨウミ 豊海 +トヨウラ 豊浦 +トヨエダ 豊枝 +トヨエビス 豊胡 +トヨオ 豊生 +トヨオカ 豊岡 +トヨオカ 登世岡 +トヨオカ 十八日 +トヨカ 豊加 +トヨガ 豊賀 +トヨカイ 豊開 +トヨカイ 豊買 +トヨカタ 豊方 +トヨカマ 豊釜 +トヨガマ 豊釜 +トヨガミ 豊上 +トヨカワ 豊川 +トヨガワ 豊川 +ドヨガワ 土代川 +トヨキ 豊城 +トヨキ 豊木 +トヨキ 豊喜 +トヨキタ 豊北 +トヨキハラ 豊暉原 +トヨクサ 豊種 +トヨグチ 豊口 +トヨクニ 豊国 +トヨクニ 豊國 +トヨクラ 豊倉 +トヨクラ 豊蔵 +トヨクラ 豊藏 +トヨクワ 豊桑 +トヨコ 豊子 +トヨザ 豊座 +トヨサカ 豊坂 +トヨサカ 豊栄 +トヨサカ 豊榮 +トヨサキ 豊崎 +トヨサキ 豊咲 +トヨサキ 豊嵜 +トヨザキ 豊崎 +トヨサク 豊作 +トヨサダ 豊貞 +トヨサト 豊里 +トヨサト 豊郷 +トヨザト 豊里 +トヨザネ 豊実 +トヨザネ 豊實 +トヨサワ 豊沢 +トヨサワ 豊澤 +トヨザワ 豊沢 +トヨザワ 豊澤 +トヨシ 豊吉 +トヨシ 戸由 +トヨシ 戸好 +トヨシ 豊志 +トヨジ 豊治 +ドヨシ 土由 +トヨシゲ 豊重 +トヨシタ 樋下 +トヨシタ 豊下 +トヨシバ 豊柴 +トヨシバ 豊芝 +トヨシマ 豊島(豐島) +トヨシマ 豊嶋 +トヨシマ 豊嶌 +トヨシマ 樋島 +トヨシロ 豊城 +トヨス 豊栖 +トヨス 豊洲 +トヨス 豊州 +トヨスギ 豊杉 +トヨスミ 豊住 +トヨスミ 豊隅 +トヨスミ 豊鷲見 +トヨズミ 豊泉 +トヨズミ 豊住 +トヨズミ 豊隅 +トヨズミ 豊角 +トヨズミ 豊澄 +トヨズミ 樋住 +トヨズミ 豊鷲見 +トヨズミ 豊済 +トヨセ 豊瀬 +トヨセ 豊世 +トヨゾノ 豊園 +トヨタ 豊田 +トヨタ 豐田 +トヨダ 豊田 +トヨダ 樋田 +トヨダ 豐田 +トヨタカ 豊高 +トヨタケ 豊竹 +トヨタケ 豊武 +トヨタケ 豊岳(豐岳) +トヨタケ 豊嶽 +トヨタテ 豊立 +トヨタニ 豊谷 +トヨタニ 戸代谷 +トヨタマ 豊玉 +トヨタミ 豊民 +トヨチ 豊地 +トヨツ 豊津 +トヨツカ 豊塚 +トヨツジ 豊辻 +トヨデラ 豊寺 +トヨトシ 豊歳 +トヨトミ 豊富 +トヨトミ 豊冨 +トヨトミ 豊臣 +トヨトメ 豊留 +トヨドメ 豊留 +トヨトリ 豊鳥 +トヨナカ 豊中 +トヨナカ 豊仲 +トヨナガ 豊永 +トヨナガ 豊長 +トヨナガムラ 豊永村 +トヨナミ 豊浪 +トヨナリ 豊成 +トヨニシ 豊西 +トヨヌマ 豊沼 +トヨネ 登米 +トヨネ 豊根 +トヨネ 豊米 +トヨノ 豊野 +トヨノ 豊納 +トヨノウ 豊納 +トヨノタニ 豊野谷 +トヨノリ 豊則 +トヨバ 樋場 +トヨバ 豊場 +トヨハシ 豊橋 +トヨハタ 豊畑 +トヨハタ 豊秦 +トヨハタ 豊幡 +トヨハマ 豊浜 +トヨハマ 豊濱 +トヨバヤシ 豊林 +トヨハラ 豊原(豐原) +トヨハラ 戸代原 +トヨヒ 豊日 +トヨヒサ 豊久 +トヨヒデ 豊秀 +トヨヒラ 豊平 +トヨヒロ 豊広 +トヨヒロ 豊廣 +トヨフク 豊福 +トヨフジ 豊藤 +トヨフル 豊古 +トヨベ 豊辺(豊邊) +トヨベ 豊部 +トヨホ 豊穂 +トヨホカ 豊外 +トヨマ 豊間 +トヨマ 登米 +トヨマ 豊馬 +トヨマエ 豊前 +トヨマキ 豊巻 +トヨマキ 豊卷 +トヨマサ 豊政 +トヨマス 豊増 +トヨマス 豊桝 +トヨマス 豊枡 +トヨマツ 豊松 +トヨマネ 豊間根 +トヨマル 豊丸 +トヨミ 豊海 +トヨミ 豊見 +トヨミ 豊味 +トヨミ 豊美 +トヨミサカ 豊見坂 +トヨミズ 豊水 +トヨミチ 豊道 +トヨミツ 豊満(豐満・豊滿) +トヨミネ 豊峰 +トヨミネ 豊峯 +トヨミヤ 豊宮 +トヨムラ 豊村 +トヨモト 樋本 +トヨモト 豊本 +トヨモト 豊元 +ドヨモト 土与本 +ドヨモト 土與本 +トヨモリ 豊森 +トヨモリ 豊守 +トヨモリ 豊盛 +トヨヤマ 豊山 +トヨヨシ 豊吉 +トヨヨシ 豊好 +トヨヨシ 豊由 +トヨラ 豊良 +トヨワカ 豊若 +トラ 虎 +トライ 戸来 +トライ 渡来 +トライ 虎井 +トライ 寅井 +トライ 戸來 +トライ 虎居 +トライ 乕井 +トライシ 虎石 +トライチ 寅市 +トライワ 虎岩 +トライワ 寅岩 +トライワ 乕岩 +トライワ 寅磐 +トラオ 虎尾 +トラオ 寅尾 +トラオ 乕尾 +トラオカ 虎岡 +トラオカ 寅岡 +トラオカ 虎丘 +トラオカ 乕丘 +トラガイ 寅貝 +トラガイト 寅垣内 +トラガグチ 寅ケ口 +トラガミ 虎上 +トラカワ 虎川 +トラカワ 寅川 +トラギク 刁菊 +トラキヨ 虎清 +トラグチ 虎口 +トラグチ 寅口 +トラクマ 虎熊 +トラサワ 虎沢 +トラサワ 虎澤 +トラサワ 寅沢 +トラサワ 十良澤 +トラサワ 寅澤 +トラザワ 虎沢 +トラザワ 虎澤 +トラザワ 寅澤 +トラジ 虎地 +トラシマ 虎島(虎嶋) +トラシマ 寅嶋(寅島) +トラセ 虎瀬 +トラセ 乕瀬 +トラタ 乕田 +トラタ 虎田 +トラタ 寅田 +トラダ 乕田 +トラダ 虎田 +トラダ 寅田 +トラタケ 虎竹 +トラタニ 虎谷 +トラタニ 寅谷 +トラタニ 乕谷 +トラタニ 虎溪(虎渓) +トラタニ 乕溪 +トラチ 虎地 +トラツ 虎津 +トラト 虎渡 +トラト 虎戸 +トラトリ 虎取 +トラニシ 虎西 +トラノ 寅野 +トラノ 虎野 +トラノ 乕野 +トラバヤシ 虎林 +トラバヤシ 寅林 +トラバリ 寅巴里 +トラマ 虎間 +トラマ 乕間 +トラマエ 虎前 +トラマツ 寅松 +トラマツ 乕松 +トラマツ 虎松 +トラマル 寅丸 +トラマル 虎丸 +トラミ 虎見 +トラモト 虎本 +トラモト 寅本 +トラヤ 虎谷 +トラヤ 寅谷 +トラヤ 虎屋 +トラヤ 寅屋 +トラヤ 乕屋 +トラヤ 寅矢 +トラヤシキ 寅屋敷 +トラヤマ 虎山 +トラヤマ 寅山 +トラヨシ 虎吉 +トラワカ 虎若 +トラワカ 乕若 +トラワカ 寅若 +トラワキ 虎餘 +トラワタリ 虎渡 +トリ 登里 +トリ 鳥 +トリアイ 鳥合 +トリアシ 鳥脚 +トリイ 鳥居 +トリイ 鳥井 +トリイ 取違 +トリイ 取井 +トリイ 華表 +トリイ 酉井 +トリイ 花表 +トリイ 莱表 +トリイエ 酉家 +トリイオオジ 鳥居大路 +トリイガハラ 鳥井ケ原 +トリイガワ 鳥居川 +トリイグチ 鳥井口 +トリイコウジ 鳥居小路 +トリイザキ 鳥井崎 +トリイシ 鳥石 +トリイダ 鳥井田 +トリイツカ 鳥居塚 +トリイヅカ 鳥居塚 +トリイド 鳥井戸 +トリイバ 鳥居場 +トリイバシ 鳥居橋 +トリイハラ 鳥井原 +トリイハラ 鳥居原 +トリイバラ 鳥井原 +トリイミナミ 鳥居南 +トリイモト 鳥井本 +トリイモト 鳥居本 +トリイモト 鳥井元 +トリイヤマ 鳥井山 +トリイレ 鳥入 +トリイワ 鳥岩 +トリイワキ 鳥井脇 +トリウ 鳥生 +トリウエ 鳥上 +トリウシ 鳥牛 +トリウチ 鳥内 +トリウチ 鶏内 +トリウチ 鳥打 +トリウミ 鳥海 +トリウミ 取海 +トリウラ 鳥浦 +トリエ 執柄 +トリエ 鳥江 +トリエダ 鳥枝 +トリオ 鳥尾 +トリオ 取尾 +トリオカ 鳥岡 +トリオカ 酉岡 +トリオク 鳥奥 +トリオチ 鳥落 +トリカ 取香 +トリカイ 鳥海 +トリカイ 鳥飼 +トリカイ 鳥養 +トリガイ 鳥飼 +トリガイ 鳥養 +トリガイ 鳥貝 +トリカエ 取替 +トリガキ 鳥垣 +トリカキウチ 鳥垣内 +トリカタ 鳥潟 +トリカタ 鳥形 +トリガタ 鳥潟 +トリガタ 鳥形 +トリガタ 鳥泻 +トリカマ 取釜 +トリガミ 鳥上 +トリカワ 鳥川 +トリカワ 土利川 +トリカワ 酉川 +トリキ 鳥木 +トリギシ 鳥岸 +トリキリ 鳥切 +トリキリ 取切 +トリグチ 鳥口 +トリグチ 取口 +トリクビ 鳥首 +トリクラ 鳥倉 +トリゲ 鳥毛 +トリゲダニ 鳥毛谷 +トリコエ 鳥越 +トリゴエ 鳥越 +トリゴエ 取越 +トリコシ 鳥越 +トリコシ 取越 +トリコシ 酉越 +トリゴシ 鳥越 +トリゴシ 酉越 +トリサカ 鳥坂 +トリサカ 鳥阪 +トリサカ 取坂 +トリサキ 鳥崎 +トリザキ 鳥崎 +トリサコン 鳥佐近(鳥左近) +トリサト 鳥里 +トリザト 鳥里 +トリサワ 鳥沢 +トリサワ 鳥澤 +トリサワ 酉澤 +トリザワ 鳥沢 +トリザワ 鳥澤 +トリジ 鳥路 +トリシマ 鳥島 +トリシマ 鳥嶋 +トリシマ 取島 +トリシマ 取嶋(取嶌) +トリジリ 鳥尻 +トリス 鳥巣 +トリス 鳥栖 +トリズカ 鳥塚 +トリズミ 鳥住 +トリセ 鳥瀬 +トリゾエ 鳥添 +トリタ 鳥田 +トリタ 部田 +トリタ 取田 +トリタ 酉田 +トリタ 鶏田 +トリダ 鳥田 +トリダ 部田 +トリダ 取田 +トリタケ 鳥竹 +トリタチ 鳥立 +トリダテ 鶏建 +トリタニ 鳥谷 +トリタニ 部谷 +トリタニ 取谷 +トリタマリ 鳥集 +トリダマリ 鳥集 +トリチガイ 取違 +トリツ 登立 +トリツ 鳥津 +トリヅ 鳥津 +トリツカ 鳥塚 +トリヅカ 鳥塚 +トリツキ 取附 +トリツキ 取付 +トリツギ 取次 +トリツギ 鳥次 +トリツグ 鳥次 +トリツボ 鳥坪 +トリデ 取出 +トリデ 鳥出 +トリトウ 鳥当 +トリトウ 鳥頭 +トリトウ 鳥當 +トリドウ 鳥堂 +トリドノ 鳥殿 +トリドメ 取溜 +トリナカ 鳥中 +トリナガ 鳥永 +トリナデ 鳥撫 +トリナリ 鳥成 +トリニワ 鳥庭 +トリヌキ 酉抜 +トリネ 鳥根 +トリノ 鳥野 +トリノ 土利野 +トリノウミ 鳥海 +トリノウミ 鳥之海 +トリノウミ 鳥ノ海 +トリノウミ 鳥の海 +トリノミ 鳥野見 +トリハ 鳥羽 +トリバ 鳥羽 +トリバ 鳥場 +トリハシ 鳥橋 +トリハタ 鳥畑 +トリハタ 鳥羽田 +トリバタケ 鳥畑 +トリバタケ 鳥畠 +トリハバ 鳥羽々 +トリハマ 鳥浜 +トリハマ 鳥濱 +トリバミ 鳥喰 +トリバヤ 鳥羽家 +トリバヤシ 鳥林 +トリハラ 鳥原 +トリヒラ 鳥平 +トリヒロ 鳥廣 +トリブチ 鳥渕 +トリブチ 鳥淵 +トリブチ 取渕(取淵) +トリベ 鳥部 +トリベ 鳥辺 +トリベ 鳥邊 +トリベ 鳥邉 +トリマエ 鳥前 +トリマキ 鳥牧 +トリマス 取桝 +トリマス 取枡 +トリマチ 鳥町 +トリマツ 鳥松 +トリマメ 鳥豆 +トリマル 鳥丸 +トリマル 酉丸 +トリミ 鳥見 +トリミ 鳥実 +トリミ 鳥實 +トリミズ 鳥水 +トリミズ 酉水 +トリミツ 鳥光 +トリミツ 取光 +トリミヤ 鳥宮 +トリムラ 鳥村 +トリメ 鳥目 +トリモト 鳥本 +トリモト 鳥元 +トリモト 取本 +トリモト 酉本 +トリモリ 取森 +トリヤ 鳥谷 +トリヤ 部谷 +トリヤ 鳥屋 +トリヤ 鳥家 +トリヤ 登利谷 +トリヤ 取屋 +トリヤ 登利屋 +トリヤ 酉家 +トリヤウチ 鳥谷内 +トリヤオ 鳥谷尾 +トリヤオ 鳥尾 +トリヤクボ 鳥屋窪 +トリヤコシ 鳥谷越 +トリヤザキ 鳥谷崎 +トリヤバラ 鳥屋原 +トリヤベ 鳥谷部 +トリヤベ 鳥屋部 +トリヤベ 鳥矢部 +トリヤマ 鳥山 +トリヤマ 鳳山 +トリュウ 鳥生 +トリュウ 鳥龍 +トリュウ 鳥竜 +トリュウダニ 当流谷 +トリヨシ 鳥吉 +トリワ 鳥羽 +トリワ 酉和 +トリワキ 鳥脇 +トリワキ 酉脇 +トロ 土路 +トロ 都路 +ドロ 泥 +ドロ 土呂 +ドロカワ 泥川 +トロキ 十露木 +ドロザキ 泥崎 +トロス 都呂須 +ドロチカ 泥近 +ドロノキ 土木 +トロブ 土路生 +ドロフネ 泥舟 +トワ 土庵 +トワ 戸和 +トワ 十八 +ドワ 土輪 +トワキ 戸脇 +トワジ 十輪地 +トワタ 砥綿 +トワタ 戸渡 +トワダ 十和田 +トワタリ 唐渡 +トワタリ 戸渡 +トワタリ 都渡 +ドワタリ 土渡 +トンアミ 頓阿弥 +トンカ 頓花 +ドンガ 頓花 +ドンガ 頓華 +ドンカイ 呑海 +トンキョウ 頓京 +トングウ 頓宮 +ドングリ 団栗 +ドンゲ 道下 +ドンコウ 呑香 +トンサイゴク 頓西国 +ドンジ 殿地 +トンショ 頓所 +トンショ 遁所 +ドンジョウ 土定 +トンダ 富田 +トンダ 冨田 +トンダ 頓田 +トンダ 福當 +トンダ 屯田 +トンダガワ 富田川 +トンタニ 問谷 +ドント 鈍渡 +ドンド 鈍渡 +ドンド 闐々 +ドンド 闐闐 +トンドコロ 頓所 +トンドコロ 遁所 +トンナ 頓名 +トンノ 頓野 +トンバナ 頓花 +トンバラ 頓原 +トンベ 冨部 +トンベ 富部 +トンベ 頓部 +トンベ 富辺 +トンボウ 富房 +ドンボウ 鈍宝 +トンミツ 冨満 +トンミヤ 頓宮 +トンヤ 問谷 +ナ 那 +ナアイ 名合 +ナアライ 名洗 +ナアリ 名有 +ナイ 内 +ナイカ 内賀 +ナイキ 内木 +ナイキ 内記 +ナイキ 内貴 +ナイキ 内樹 +ナイキ 内喜 +ナイギ 内儀 +ナイザ 内座 +ナイシ 内司 +ナイジ 内司 +ナイジュウ 内重 +ナイショウ 内正 +ナイジョウ 内城 +ナイジョウ 内條 +ナイジョウ 内条 +ナイシロ 苗代 +ナイセイ 内生 +ナイゼン 内膳 +ナイゼン 内全 +ナイタニ 内谷 +ナイチュウ 内柱 +ナイデ 名出 +ナイトウ 内藤 +ナイトウ 内東 +ナイトウ 内騰 +ナイトウ 内洞 +ナイトウ 内籐 +ナイドウ 内洞 +ナイホ 内保 +ナイミ 内見 +ナイメン 内免 +ナイメン 内面 +ナイヤ 納屋 +ナウエ 名上 +ナウチ 名内 +ナウチ 名打 +ナウラ 名浦 +ナエ 苗 +ナエイ 苗井 +ナエカ 苗加 +ナエガ 苗加 +ナエカワ 苗川 +ナエキ 苗木 +ナエクラ 苗倉 +ナエザワ 苗沢 +ナエシブ 苗渋 +ナエシマ 苗島 +ナエシロ 苗代 +ナエシロサコ 苗代迫 +ナエシロザコ 苗代迫 +ナエゾノ 苗園 +ナエタ 苗田 +ナエダ 苗田 +ナエテ 苗手 +ナエトコ 苗床 +ナエハタ 苗畑 +ナエボ 苗保 +ナエマツ 苗松 +ナエムラ 苗村 +ナエヤマ 苗山 +ナオ 浪越 +ナオ 直 +ナオ 奈尾 +ナオ 名尾 +ナオ 尚 +ナオ 猶 +ナオイ 直井 +ナオイ 名生 +ナオイ 猶井 +ナオイ 直居 +ナオイリ 直入 +ナオウ 名王 +ナオウチ 直内 +ナオウミ 直海 +ナオエ 直江 +ナオエ 尚永 +ナオエ 直枝 +ナオエ 直永 +ナオエ 猶江 +ナオオカ 直岡 +ナオオカ 猶岡 +ナオカズ 直一 +ナオカミ 直上 +ナオカワ 直川 +ナオキ 直木 +ナオキ 猶木 +ナオキ 直喜 +ナオキ 尚樹 +ナオキ 直樹 +ナオキ 尚木 +ナオグチ 猶口 +ナオサ 直佐 +ナオサカ 直坂 +ナオサキ 猶崎(猶嵜) +ナオサキ 猶埼 +ナオザキ 猶崎(猶嵜) +ナオザキ 直崎 +ナオサダ 猶貞 +ナオサト 直里 +ナオサワ 直沢 +ナオシ 直志 +ナオジ 直地 +ナオシタ 直下 +ナオシマ 直島 +ナオシマ 直嶋 +ナオシマ 直嶌 +ナオジマ 直島 +ナオタ 直田 +ナオタ 尚田 +ナオダ 直田 +ナオタカ 直高 +ナオタニ 直谷 +ナオタニ 猶谷 +ナオチ 直地 +ナオツ 直津 +ナオツカ 直塚 +ナオツカ 猶塚 +ナオトリ 直鳥 +ナオナガ 直長 +ナオノ 直野 +ナオノ 猶野 +ナオバ 猶場 +ナオバヤシ 直林 +ナオハラ 直原 +ナオハラ 猶原 +ナオハラ 尚原 +ナオヒロ 直弘 +ナオマサ 直正 +ナオマチ 直町 +ナオマツ 直松 +ナオマツ 猶松 +ナオミ 直海 +ナオミ 直見 +ナオミネ 直峯 +ナオミヤ 直宮 +ナオムラ 直村 +ナオムラ 猶村 +ナオムラ 尚村 +ナオモト 直本 +ナオモト 猶本 +ナオモト 直元 +ナオモト 尚本 +ナオヤ 直谷 +ナオヤマ 直山 +ナオヤマ 尚山 +ナオユキ 直之 +ナオヨシ 直吉 +ナオラ 直良 +ナオリ 直理 +ナカ 中 +ナカ 仲 +ナカ 名嘉 +ナカ 那賀 +ナカ 那珂 +ナカ 名賀 +ナカ 奈加 +ナカ 奈賀 +ナカ 名加 +ナカ 南賀 +ナカ 仲嘉 +ナカ 奈河 +ナカ 名佳 +ナガ 長 +ナガ 那賀 +ナガ 永 +ナガ 名賀 +ナガ 奈賀 +ナカアイ 中合 +ナガアイ 永合 +ナカアカ 中赤 +ナカアキ 仲秋 +ナカアキ 中明 +ナカアキ 中秋 +ナガアキ 長明 +ナガアキ 永秋 +ナカアジ 中阿地 +ナガアシ 長芦 +ナガアシ 長足 +ナカアゼ 中畔 +ナカアタリ 中当(中當) +ナカアチ 中阿地 +ナカアヂ 中阿地 +ナカアミ 中網 +ナガアミ 長網 +ナカアラ 中荒 +ナガアラ 長荒 +ナカアライ 中新井 +ナカアライ 中荒井 +ナカアライ 中新居 +ナカアラエ 中荒江 +ナガアラシ 長嵐 +ナカアラシロ 仲新城 +ナカイ 中井 +ナカイ 中居 +ナカイ 仲井 +ナカイ 仲居 +ナカイ 中飯 +ナカイ 中伊 +ナカイ 中位 +ナカイ 中猪 +ナカイ 那加井 +ナガイ 永井 +ナガイ 長井 +ナガイ 長 +ナガイ 永 +ナガイ 長居 +ナガイ 永居 +ナガイ 永射 +ナガイ 長位 +ナガイ 長医 +ナガイ 長伊 +ナガイ 長意 +ナカイイ 中飯 +ナカイイダ 中飯田 +ナカイエ 中家 +ナカイエ 仲家 +ナガイエ 長家 +ナガイエ 永家 +ナカイガミ 中井上 +ナカイガワ 中井川 +ナガイキ 長生 +ナガイグチ 永井口 +ナカイケ 中池 +ナカイケ 仲池 +ナガイケ 永池 +ナガイケ 長池 +ナガイケ 長生 +ナカイザワ 中井沢 +ナカイザワ 中井澤 +ナカイシ 中石 +ナカイシ 仲石 +ナカイシ 名賀石 +ナガイシ 永石 +ナガイシ 長石 +ナガイシ 名賀石 +ナガイシクラ 長石倉 +ナカイシダ 中石田 +ナカイシバシ 中石橋 +ナカイズミ 中泉 +ナカイズミ 仲泉 +ナガイズミ 永泉 +ナガイズミ 長泉 +ナカイソ 中磯 +ナカイソ 中礒 +ナガイソ 永磯 +ナガイソ 長礒 +ナカイタ 中板 +ナカイダ 中井田 +ナガイダ 永井田 +ナカイタニ 中井谷 +ナカイチ 中市 +ナカイチ 中一 +ナカイチ 仲市 +ナガイチ 永市 +ナガイチ 長市 +ナガイチ 長一 +ナガイチ 永一 +ナカイチゴ 中市後 +ナカイツ 中逸 +ナカイデ 中出 +ナカイデ 仲出 +ナカイデ 中井手 +ナガイデ 長出 +ナカイデガワ 仲出川 +ナカイド 中井戸 +ナカイド 中居戸 +ナカイネ 中稲 +ナカイネ 中稻 +ナガイノ 永井野 +ナカイバヤシ 中居林 +ナカイベ 仲伊部 +ナカイマ 仲井間 +ナカイマ 仲井真 +ナカイマ 中今 +ナカイマ 仲井眞 +ナカイムキ 中居向 +ナカイリ 中入 +ナカイリチ 中入地 +ナカイワ 中岩 +ナカイワ 仲岩 +ナガイワ 永岩 +ナガイワ 長岩 +ナカイワモチ 中岩持 +ナカインキョ 中隠居 +ナカウ 中右 +ナカウエ 中上 +ナカウエ 仲上 +ナカウエ 中植 +ナカウエ 仲植 +ナガウエ 永上 +ナガウエ 長上 +ナカウエザト 仲上里 +ナカウエジョウ 仲上門 +ナカウエノ 中上野 +ナカウケ 中請 +ナカウサ 仲宇佐 +ナカウジ 中宇地 +ナカウジ 中氏 +ナカウジ 仲氏 +ナガウシ 長牛 +ナカウシロ 中後 +ナカウチ 中内 +ナカウチ 仲内 +ナカウチ 中宇地 +ナカウチ 名河内 +ナカウチ 中打 +ナカウヂ 中宇地 +ナガウチ 長内 +ナガウチ 永内 +ナカウチダ 中内田 +ナカウツキ 中打木 +ナカウツギ 中打木 +ナカウツリ 中移 +ナカウネ 中畝 +ナカウネ 中畦 +ナカウネ 中宇根 +ナカウネ 中宇禰 +ナカウネ 中宇祢 +ナカウネ 中塢 +ナガウネ 長畦 +ナガウネ 長畝 +ナカウマ 中馬 +ナカウマ 仲馬 +ナカウミ 中湖 +ナカウミ 中海 +ナガウミ 永海 +ナガウミ 長海 +ナカウメ 中梅 +ナカウラ 中浦 +ナカウラ 中裏 +ナカウラ 仲浦 +ナガウラ 長浦 +ナガウラ 永浦 +ナカエ 中江 +ナカエ 中永 +ナカエ 仲江 +ナカエ 中栄 +ナカエ 中恵 +ナカエ 中得 +ナカエ 仲栄 +ナカエ 仲絵 +ナカエ 中衛 +ナカエ 仲衛 +ナカエ 中惠 +ナカエ 中榮 +ナカエ 仲得 +ナカエ 奈下恵 +ナガエ 長江 +ナガエ 永江 +ナガエ 長柄 +ナガエ 長永 +ナガエ 長家 +ナガエ 長栄 +ナガエ 永栄 +ナガエ 永柄 +ナガエ 永恵(永惠) +ナガエ 長衛 +ナガエ 長榮 +ナガエ 永枝 +ナガエ 永榮 +ナカエイ 中永 +ナカエイ 中栄 +ナカエイ 中榮 +ナガエイ 長永 +ナガエイ 永栄 +ナカエガワ 仲江川 +ナカエガワ 中江川 +ナカエキ 中浴 +ナガエキ 長浴 +ナガエキ 長嶧(長𡵸) +ナガエキ 永浴 +ナガエキ 長﨏 +ナカエズ 中絵図 +ナカエダ 中枝 +ナカエダ 中江田 +ナガエダ 長枝 +ナカエビス 中夷 +ナカエビス 中胡 +ナカエマ 仲栄真 +ナカエマ 仲栄眞 +ナカエマ 仲江間 +ナカエマ 仲榮真 +ナカエマ 仲榮眞 +ナカオ 中尾 +ナカオ 仲尾 +ナカオ 中生 +ナカオ 中雄 +ナカオ 中緒 +ナガオ 長尾 +ナガオ 永尾 +ナガオ 長雄 +ナガオ 長生 +ナガオ 永雄 +ナガオ 長翁 +ナガオ 長央 +ナガオ 長応 +ナガオ 長王 +ナガオ 奈賀尾 +ナカオイダ 中老田 +ナカオウジ 中大路 +ナカオウジ 中王子 +ナカオウジ 中王寺 +ナカオオクボ 中大窪 +ナカオオジ 中大路 +ナカオオソコ 仲大底 +ナカオオタニ 中大谷 +ナカオオミネ 仲大嶺 +ナカオオモリ 仲大盛 +ナカオカ 中岡 +ナカオカ 仲岡 +ナカオカ 中丘 +ナカオカ 中生加 +ナガオカ 長岡 +ナガオカ 永岡 +ナガオカ 永丘 +ナガオカ 臥竜岡 +ナガオカ 臥龍岡 +ナカオガミ 中尾上 +ナガオカヤ 長岡谷 +ナカオキ 中沖 +ナカオキ 中興 +ナガオキ 長沖 +ナガオキ 長置 +ナカオク 中奥 +ナカオク 仲奥 +ナガオク 永奥 +ナガオク 長奥 +ナカオケ 中桶 +ナガオケ 永桶 +ナガオケ 長桶 +ナカオサ 仲長 +ナカオサ 中筬 +ナガオサ 永長 +ナガオサ 永翁 +ナガオサ 長総 +ナカオシ 仲尾次 +ナカオジ 仲尾次 +ナカオタ 中尾田 +ナカオダ 中小田 +ナガオダ 長小田 +ナカオチ 中落 +ナカオネ 中尾根 +ナカオノダ 中小野田 +ナカオバラ 中麻原 +ナカオミ 中臣 +ナガオモ 長面 +ナカオモテ 仲表 +ナガオモテ 長表 +ナカオモヤ 中面谷 +ナカオヤマ 中尾山 +ナガオリ 永織 +ナカガ 仲嘉 +ナカガ 中賀 +ナカガイ 中貝 +ナカガイチ 中垣内 +ナカガイト 中垣内 +ナカガイト 仲垣内 +ナカガウチ 中垣内 +ナカガウチ 中河内 +ナカカギ 中鍵 +ナカガキ 中垣 +ナカガキ 仲垣 +ナガガキ 長垣 +ナカガキウチ 中垣内 +ナカカジ 中梶 +ナカカジ 中鍛治 +ナカカジ 中鍛冶 +ナカカゼ 中風 +ナカガタ 中潟 +ナカガタ 中方 +ナガカタ 長潟 +ナガカタ 長方 +ナガガタ 長潟 +ナガガタ 永潟 +ナガカツ 永勝 +ナカカド 中角 +ナカカド 中門 +ナカカド 仲門 +ナカカネ 中兼 +ナカガネ 中兼 +ナカガネ 中金 +ナカガネ 仲兼 +ナガカネ 永金 +ナカカネク 仲兼久 +ナカガネク 仲兼久 +ナカガハラ 中川原 +ナカカマ 中釜 +ナカガマ 中釜 +ナガカマ 長鎌 +ナカカミ 中神 +ナカガミ 中上 +ナカガミ 中神 +ナカガミ 仲上 +ナカガミ 仲神 +ナカガミ 中紙 +ナカガミ 中髪 +ナカガミ 中督 +ナガカミ 長神 +ナガカミ 永上 +ナガカミ 長上 +ナガカミ 永神 +ナガガミ 永上 +ナカガミガワ 中上川 +ナカカメ 仲亀 +ナカガメ 仲亀 +ナカガメ 中亀 +ナカガラ 中柄 +ナガカリ 永仮 +ナカカリヤ 中仮屋 +ナカカルマイ 中軽米 +ナカカワ 中川 +ナカカワ 仲川 +ナカガワ 中川 +ナカガワ 仲川 +ナカガワ 中河 +ナカガワ 仲河 +ナカガワ 中側 +ナカガワ 那賀川 +ナカガワ 仲側 +ナガカワ 永川 +ナガカワ 長川 +ナガカワ 長河 +ナカガワウチ 中川内 +ナカガワサイ 中川西 +ナカカワジ 中川路 +ナカガワジ 中川路 +ナカガワチ 中川内 +ナカガワニシ 中川西 +ナカカワハラ 中川原 +ナカガワハラ 中川原 +ナカガワラ 中川原 +ナカガワラ 中河原 +ナカガワラ 中瓦 +ナガカワラ 長川原 +ナカガンナ 中金名 +ナカキ 中木 +ナカキ 仲木 +ナカキ 仲喜 +ナカギ 中城 +ナカギ 中木 +ナカギ 仲木 +ナカギ 仲義 +ナカギ 仲儀 +ナカギ 中儀 +ナガキ 永木 +ナガキ 長木 +ナガキ 長岐 +ナガキ 永喜 +ナガキ 長生 +ナガキ 長城 +ナガキ 名垣 +ナガキ 永城 +ナガキ 長記 +ナガキ 永岐 +ナガキ 長喜 +ナガキウラ 名垣浦 +ナカギク 中菊 +ナカギシ 中岸 +ナカギシ 仲岸 +ナガギシ 長岸 +ナカキタ 中北 +ナカキタ 中来田(中來田) +ナカキタ 仲北 +ナカキタ 中喜多 +ナカキタ 中耒田 +ナカキダ 中来田(中來田) +ナカギタ 中北 +ナカギタ 中来田(中來田) +ナガキタ 長北 +ナガキタ 永喜多 +ナカキタウラ 仲北浦 +ナカキチ 中吉 +ナカキド 中木戸 +ナカキハラ 中木原 +ナカキムラ 中木村 +ナカキヤ 中木屋 +ナカギヤ 中木屋 +ナガキヤ 長木谷 +ナガキヨ 長清 +ナガキヨ 永清 +ナカギリ 中桐 +ナカギリ 中切 +ナカギリ 仲桐 +ナカク 中工 +ナガク 長久 +ナガク 永久 +ナガク 長楽 +ナガクイ 永久井 +ナカクキ 中久喜 +ナカクキ 中茎 +ナカクキ 中久木 +ナカクキ 中岫 +ナカクキ 中莖 +ナカクキ 仲久木 +ナカクギ 中久木 +ナカクギ 中釘 +ナカグキ 中茎 +ナカグキ 中岫 +ナカグキ 中莖 +ナガクサ 永草 +ナガクサ 長草 +ナガクサ 長艸 +ナカクシ 中串 +ナカグシ 中串 +ナカグシ 仲後 +ナカクス 中楠 +ナカグス 中楠 +ナカグチ 中口 +ナカグチ 仲口 +ナガグチ 永口 +ナガグチ 長口 +ナカクニ 中国 +ナカクニ 中國 +ナカグニ 中國 +ナガクニ 永国(永國) +ナカクネ 中久根 +ナカクボ 中久保 +ナカクボ 中窪 +ナカクボ 仲久保 +ナカクボ 仲窪 +ナガクボ 長久保 +ナガクボ 永久保 +ナガクボ 長窪 +ナガクボ 永窪 +ナカクマ 中熊 +ナカクマ 中隈 +ナカグマ 中熊 +ナカグマ 中隈 +ナガクマ 永隈 +ナカグミ 中組 +ナカクラ 中倉 +ナカクラ 仲倉 +ナカクラ 中蔵 +ナカクラ 中藏 +ナガクラ 長倉 +ナガクラ 永倉 +ナガクラ 永蔵 +ナガクラ 永藏 +ナカグリ 中栗 +ナカクロ 中黒 +ナカグロ 中畔 +ナカグロ 中黒 +ナガクロ 永黒 +ナガクロ 長畔 +ナガグロ 長畔 +ナカクロシマ 仲黒島 +ナガケ 長宅 +ナカゲン 中源 +ナカコ 仲子 +ナカコ 中子 +ナカコ 中湖 +ナカコ 中粉 +ナカゴ 中後 +ナカコウ 中公 +ナカコウ 中功 +ナカゴウ 中郷 +ナカゴウ 中合 +ナガコウ 長行 +ナカコウゲ 中高下 +ナカコウジ 中小路 +ナカコウジ 中川路 +ナカコウジ 仲小路 +ナカコウジ 中高路 +ナカコウチ 中河内 +ナカゴウチ 中垣内 +ナカゴウチ 中河内 +ナカゴエ 中越 +ナカゴオリ 中郡 +ナカコガ 中古賀 +ナカコガ 中古閑 +ナカコガワ 中小川 +ナカコシ 中越 +ナカコシ 中腰 +ナカゴシ 中越 +ナカゴシ 中腰 +ナガコシ 長越 +ナカゴシキ 中甑 +ナカコジョウ 中小城 +ナカコダ 中小田 +ナカコノ 中小野 +ナカコバ 中木場 +ナカコバ 中古場 +ナカコハラ 中小原 +ナカコバラ 中小原 +ナカコバル 中小原 +ナカコマキ 中小牧 +ナカコミ 中込 +ナカコミ 中古味 +ナカゴミ 中込 +ナカコメ 中込 +ナカゴメ 中込 +ナカゴメ 中米 +ナカゴヤ 仲古谷 +ナカゴヤ 中古谷 +ナカサ 仲佐 +ナカサ 中佐 +ナカサ 中左 +ナカザ 仲座 +ナカザ 中座 +ナカザ 名嘉座 +ナガサ 永佐 +ナガサ 長狭 +ナカサイ 中斉 +ナカサイ 中斎 +ナカサイ 中才 +ナカサイ 中済(中濟) +ナカサイ 中財 +ナカサイ 仲才 +ナカサイ 中犀 +ナカサイ 中齋 +ナカサイ 中齊 +ナカサイ 仲斉 +ナカザイ 中斉 +ナカザイ 中財 +ナカザイ 仲財 +ナカザイ 中齊 +ナカサオ 中棹 +ナガサオ 長棹 +ナガサオ 長竿 +ナガサオ 永棹 +ナガサオ 永竿 +ナガサオ 長悼 +ナカサカ 中坂 +ナカサカ 中阪 +ナカザカ 中坂 +ナガサカ 長坂 +ナガサカ 永坂 +ナガサカ 長阪 +ナガサカ 永阪 +ナカサキ 中崎 +ナカサキ 中嵜 +ナカサキ 仲崎(仲嵜) +ナカサキ 中咲 +ナカザキ 中崎 +ナカザキ 中嵜 +ナカザキ 仲崎(仲嵜) +ナガサキ 長崎 +ナガサキ 永崎 +ナガサキ 長嵜 +ナガサキ 長先 +ナガサキ 長埼 +ナガサギ 長鷺 +ナガサキヤ 長崎屋 +ナカサク 中作 +ナガサク 永作 +ナガサクラ 長桜 +ナカサゲ 中提 +ナカサコ 中迫 +ナカサコ 中浴 +ナカサコ 中佐古 +ナカサコ 中砂 +ナカサコ 中硲 +ナカサコ 中﨏 +ナカサコ 中嶒 +ナカサコ 中隥 +ナカサゴ 中砂 +ナカザコ 中迫 +ナガサコ 長迫 +ナガサコ 長廻(長迴) +ナガサコ 長栄 +ナガサコ 永迫(永廹) +ナガサコ 永嶒 +ナガサコ 永佐子 +ナガサコ 長佐古 +ナガサコ 長嶝 +ナガサコ 永廻 +ナガサコ 長硲 +ナガサコ 長峪 +ナガサコ 長榮 +ナカザサ 中笹 +ナカザシ 中指 +ナカサダ 中定 +ナガサダ 長定 +ナカサト 中里 +ナカサト 仲里 +ナカサト 中佐藤 +ナカザト 中里 +ナカザト 仲里 +ナカザト 中郷 +ナガサト 永里 +ナガサト 長郷 +ナガサト 長里 +ナカサトウ 中佐藤 +ナカサトミ 中里見 +ナカザトミ 中里見 +ナカサラ 仲皿 +ナカサワ 中沢 +ナカサワ 中澤 +ナカサワ 仲沢 +ナカサワ 仲澤 +ナカザワ 中沢 +ナカザワ 中澤 +ナカザワ 仲沢 +ナカザワ 仲澤 +ナガサワ 長沢 +ナガサワ 長澤 +ナガサワ 永沢 +ナガサワ 永澤 +ナガザワ 長澤 +ナカサワヤマ 中澤山 +ナガサワラ 長笠原 +ナカシ 中司 +ナカシ 中志 +ナカジ 中司 +ナカジ 中路 +ナカジ 仲地 +ナカジ 中地 +ナカジ 中治 +ナカジ 仲治 +ナカジ 仲路 +ナカジ 名嘉地 +ナガシ 永志 +ナガジ 長治 +ナガジ 永治 +ナガジ 永二 +ナガジ 長地 +ナガジ 長路 +ナガシイ 永椎 +ナカシオ 中塩 +ナカシオ 中潮 +ナカジオ 中塩 +ナガシオ 長塩 +ナガシオ 永塩 +ナガシオ 永汐 +ナガシオ 長汐 +ナカシオジ 中塩路 +ナカシオヤ 中塩屋 +ナカシカ 中鹿 +ナカシキ 中鋪 +ナカシキ 中敷 +ナカシキ 仲敷 +ナカシキ 中志貴 +ナカシキ 中舗 +ナカジキ 中食 +ナガシキ 長鋪 +ナガシキ 長敷 +ナガシキ 長舗 +ナガシギ 長鴫 +ナカシキリョウ 中敷領 +ナカジク 中軸 +ナカシゲ 中重 +ナカシゲ 中繁 +ナカシゲ 仲重 +ナカシゲ 中茂 +ナガシゲ 永重 +ナガシゲ 長重 +ナガシゲ 永繁 +ナガシゲ 長繁 +ナカシズ 中静 +ナカシズ 中靜 +ナカシズカ 中静 +ナカシズカ 中靜 +ナカシタ 中下 +ナカシタ 仲下 +ナガシタ 長下 +ナガシタ 永下 +ナガシダ 永志田 +ナカシチ 中七 +ナカジッコク 中拾石 +ナカシナ 中科 +ナカジネ 仲字根 +ナカシノ 中篠 +ナガシノ 長篠 +ナカシノサコ 中篠迫 +ナカシノザコ 中篠迫 +ナカシバ 中芝 +ナカシバ 中柴 +ナカシバ 仲柴 +ナガシバ 長柴 +ナガシバ 長芝 +ナガシバ 永柴 +ナカシブ 中渋(中澁) +ナカシマ 中島 +ナカシマ 中嶋 +ナカシマ 仲島 +ナカシマ 中嶌 +ナカシマ 仲嶋 +ナカシマ 仲嶌 +ナカシマ 那賀島 +ナカシマ 中司馬 +ナカジマ 中島 +ナカジマ 中嶋 +ナカジマ 仲島 +ナカジマ 中嶌 +ナカジマ 仲嶋 +ナカジマ 中陦 +ナカジマ 仲嶌 +ナカジマ 那賀島 +ナカジマ 中隯 +ナカジマ 中路間 +ナカジマ 那賀嶋 +ナガシマ 長島 +ナガシマ 永島 +ナガシマ 長嶋 +ナガシマ 永嶋 +ナガシマ 永嶌 +ナガシマ 長嶌 +ナガシマ 良島 +ナカシマダ 中島田 +ナカシマダ 中嶋田 +ナガシマダ 永島田 +ナカジマヤ 中島谷 +ナカシミズ 中清水 +ナガシミズ 長清水 +ナカシモ 中霜 +ナカシモ 仲志茂 +ナカシモウラ 中下浦 +ナカシャ 中舎 +ナカシャ 中社 +ナカシャ 中者 +ナカシャ 中射 +ナカシャ 中車 +ナカシャ 中舍 +ナカジュウ 中重 +ナカジュウ 中十 +ナカシュク 中倏 +ナカジュク 中宿 +ナカジュン 仲順 +ナカショ 中所 +ナカジョ 中所 +ナカショウ 中正 +ナカショウ 中生 +ナカショウ 仲正 +ナカショウ 中庄 +ナカショウ 中勝 +ナカショウ 中荘 +ナカジョウ 中条 +ナカジョウ 中上 +ナカジョウ 中條 +ナカジョウ 中城 +ナカジョウ 半場 +ナカジョウ 仲條 +ナカジョウ 仲条 +ナカジョウ 仲門 +ナカジョウ 中絛 +ナカジョウ 仲篠 +ナカジョウ 仲城 +ナガショウ 長正 +ナカショウジ 中小路 +ナカショウジ 中庄司 +ナカショウジ 仲小路 +ナカショウジ 中正司 +ナカショウジ 中小司 +ナカショウジ 中障子 +ナカショウジ 仲正路 +ナカショウジ 中小次 +ナカショウタニ 中庄谷 +ナカショウヤ 中庄谷 +ナカシラホ 仲白保 +ナカジリ 中尻 +ナカシロ 中城 +ナカシロ 中代 +ナカシロ 仲代 +ナカシロ 中白 +ナカシロ 仲城 +ナガシロ 長代 +ナガシロ 永代 +ナガシロ 長城 +ナガシロ 永城 +ナガシロ 長白 +ナカシン 仲真 +ナカシン 中新 +ナカシン 仲眞 +ナカシン 中進 +ナカジン 中陳 +ナカジン 中陣 +ナカシンジョウ 仲新城 +ナカシンジョウ 仲新門 +ナカシンダ 中新田 +ナカシンチ 中新地 +ナカシンデ 中新出 +ナカシンデン 中新田 +ナカス 中須 +ナカス 中洲 +ナカス 仲須 +ナカス 中洌 +ナカス 中州 +ナカス 中栖 +ナカス 仲次 +ナカズ 仲須 +ナカズ 中頭 +ナカズ 中図(中圖) +ナガス 長洲 +ナガス 長須 +ナガス 永須 +ナガス 長州 +ナガス 長主 +ナカスエ 中末 +ナガスエ 永末 +ナガスエ 長末 +ナカスカ 中須賀 +ナカスカ 中宿 +ナカスカ 中須加 +ナカスカ 中数賀 +ナカスカ 中管 +ナカスカ 中壽賀 +ナカスガ 中須賀 +ナカスガ 中寿賀 +ナカスガ 中数賀 +ナカスガ 中菅 +ナカスガ 中壽賀 +ナガスカ 長須賀 +ナガスガ 永菅 +ナガスガ 永管 +ナガスガ 長菅 +ナカスギ 中杉 +ナカスギ 仲杉 +ナガスキ 長鋤 +ナガスギ 永杉 +ナガスギ 長杉 +ナカスジ 中筋 +ナカスジ 仲筋 +ナガスズ 長鈴 +ナカスダ 中須田 +ナカステ 中捨 +ナカスナ 中砂 +ナガスナ 長砂 +ナガスナ 永砂 +ナカスマ 中須磨 +ナカズマ 中妻 +ナカスミ 中住 +ナカスミ 中角 +ナカスミ 中澄 +ナカスミ 中済(中濟) +ナカスミ 中隅 +ナカスミ 中墨 +ナカスミ 仲角 +ナカズミ 中住 +ナカズミ 中角 +ナカズミ 中澄 +ナカズミ 中済(中濟) +ナカズミ 中隅 +ナカズミ 仲住 +ナカズミ 中墨 +ナカズミ 仲角 +ナガスミ 永住 +ナガスミ 長住 +ナガスミ 長澄 +ナガスミ 長角 +ナガスミ 永隅 +ナガスミ 永澄 +ナガズミ 永住 +ナガズミ 長住 +ナガズミ 長澄 +ナガズミ 永澄 +ナガズミ 永角 +ナカズル 中水流 +ナカセ 中瀬 +ナカセ 中畝 +ナカセ 仲瀬 +ナカセ 中世 +ナカセ 中生 +ナカセ 中勢 +ナカセ 中清 +ナカセ 中背 +ナカセ 仲世 +ナカゼ 中陳 +ナガセ 長瀬 +ナガセ 永瀬 +ナガセ 長勢 +ナガセ 長生 +ナガセ 長清 +ナガセ 永清 +ナガセ 那俄性 +ナガセ 永勢 +ナガセ 長世 +ナガセ 永世 +ナガセ 長脊 +ナガセ 長背 +ナガセ 那俄牲 +ナガセ 那我性 +ナカセイ 中生 +ナカセキ 中関 +ナカセキ 中堰 +ナカゼキ 中関 +ナガセキ 永関 +ナガセキ 長関 +ナカセコ 中世古 +ナカセコ 中迫 +ナカセコ 中瀬古 +ナカセコ 仲世古 +ナカゼコ 中世古 +ナカゼコ 仲世古 +ナカセチ 中畝地 +ナカセヂ 中畝地 +ナカセト 中瀬戸 +ナカセド 中瀬戸 +ナカゼニ 中銭 +ナカセラ 中世良 +ナカセン 中仙 +ナカセン 中千 +ナカセンドウ 中仙道 +ナカソ 中曽 +ナカソ 中祖 +ナカソ 中所 +ナカソ 中曾 +ナカソ 中楚 +ナカソ 仲噌 +ナカソ 仲曽 +ナカソ 中租 +ナカソ 仲曾 +ナガソ 長宗 +ナガソ 長曽 +ナガソ 永曽 +ナガソ 長祖 +ナガソ 長曾 +ナカソウ 中宗 +ナカソウ 中惣 +ナガソウ 長宗 +ナガソウ 永草 +ナガソウ 長相 +ナガソウ 永相 +ナカゾエ 中添 +ナガソエ 長副 +ナガソエ 永添 +ナガソエ 長添 +ナガゾエ 長副 +ナガゾエ 永添 +ナガゾエ 長添 +ナカソギ 中枌 +ナカソコ 仲底 +ナガソコ 長底 +ナカソネ 仲宗根 +ナカソネ 中曽根 +ナカソネ 中曾根 +ナカソネ 中宗根 +ナカソネ 仲曽根 +ナカソネ 中曽祢 +ナカソネ 中曾祢 +ナカソネ 中曽称 +ナカソネ 中曽禰 +ナカソネ 仲曾根 +ナカゾネ 仲宗根 +ナガソネ 長曽根 +ナカソノ 中園 +ナカソノ 中薗 +ナカソノ 中囿 +ナカソノ 中其 +ナカゾノ 中園 +ナカゾノ 中薗 +ナカゾノ 中囿 +ナカゾノ 中苑 +ナガソノ 永園 +ナガソノ 長薗 +ナガソノ 永薗 +ナガソノ 長園 +ナガゾノ 永園 +ナガゾノ 長薗 +ナガゾノ 永薗 +ナカソラ 中空 +ナカゾラ 中空 +ナカゾリ 中剃 +ナカタ 中田 +ナカタ 仲田 +ナカタ 中多 +ナカタ 中駄 +ナカタ 名方 +ナカタ 仲太 +ナカダ 中田 +ナカダ 仲田 +ナカダ 中多 +ナカダ 中駄 +ナガタ 永田 +ナガタ 長田 +ナガタ 長多 +ナガタ 永多 +ナガタ 長太 +ナガタ 詠田 +ナガタ 長朶 +ナガダ 永田 +ナガダ 長田 +ナカタイ 中平 +ナカダイ 中平 +ナカダイ 中台 +ナカダイ 中代 +ナカダイ 中臺 +ナカダイ 中太 +ナカダイ 仲代 +ナカダイ 仲台 +ナカダイ 中薹 +ナカダイ 仲大 +ナカダイ 仲臺 +ナカタイラ 中平 +ナカダイラ 中平 +ナカダイラ 仲平 +ナカダイラ 仲平良 +ナガタエ 長妙 +ナカタオ 中峠 +ナカタオ 中垰 +ナカタカ 中高 +ナカタカ 仲高 +ナガタカ 永高 +ナガタカ 長高 +ナカタキ 中滝 +ナカタキ 中瀧 +ナガタキ 長滝 +ナガタキ 永滝 +ナガタキ 長瀧 +ナガタキ 永瀧 +ナガタキダニ 長滝谷 +ナガタキヤ 長滝谷 +ナガタキヤ 長瀧谷 +ナカタク 中宅 +ナカタクマ 中宅間 +ナカタケ 中武 +ナカタケ 中竹 +ナカタケ 中嶽 +ナカタケ 仲武 +ナカタケ 中岳 +ナカタケ 仲嵩 +ナカタケ 中獄 +ナカダケ 中武 +ナカダケ 中嶽 +ナカダケ 中岳 +ナガタケ 永長 +ナガタケ 長竹 +ナガタケ 永武 +ナガタケ 永竹 +ナガタケ 長岳 +ナガタケ 永全 +ナカタジマ 中田島 +ナカタダ 中唯 +ナガタダ 長只 +ナカタチ 中刀 +ナカダチ 中舘 +ナカダチ 中立 +ナカダチ 仲達 +ナカダチ 中達 +ナカダチ 中逹 +ナカタツ 中達 +ナカタテ 中舘 +ナカタテ 中館 +ナカタテ 中楯 +ナカダテ 中舘 +ナカダテ 中館 +ナカダテ 中楯 +ナカダテ 中立 +ナカダテ 中達 +ナカダテ 仲館 +ナカダテ 中建 +ナカダテ 仲舘 +ナカダテ 仲立 +ナカタナ 中棚 +ナカダナ 中棚 +ナカタニ 中谷 +ナカタニ 仲谷 +ナカタニ 半谷 +ナカタニ 中渓 +ナカタニ 中溪 +ナカダニ 中谷 +ナカダニ 仲谷 +ナガタニ 長谷 +ナガタニ 永谷 +ナガタニ 豅 +ナガタニ 永渓 +ナガタニ 永溪 +ナカタニウチ 中谷内 +ナガタヒラ 永田平 +ナカタマエ 仲玉栄(仲玉榮) +ナガタマエ 永玉栄(永玉榮) +ナカタマリ 中玉利 +ナカタヤ 中田谷 +ナガタヤ 長田谷 +ナガタヤ 永田屋 +ナカダン 中段 +ナカチ 仲地 +ナカチ 中地 +ナカチ 中池 +ナカチ 中知 +ナカチ 名嘉地 +ナカチ 中智 +ナカチ 中千 +ナカチ 仲知 +ナカチ 仲智 +ナカヂ 中路 +ナカヂ 中地 +ナガチ 永地 +ナガチ 長地 +ナガヂ 永治 +ナカチカ 中近 +ナカチャ 中茶 +ナカチヤマ 中知山 +ナカチヨ 中千代 +ナカチョウ 中長 +ナカチョウ 仲長 +ナカチョウ 中丁 +ナガチョウ 長丁 +ナカツ 中津 +ナカツ 仲津 +ナカツ 中都 +ナガツ 長津 +ナガツ 永津 +ナカツイ 中津井 +ナカツイ 中対 +ナカツイ 中對 +ナカツウミ 中津海 +ナカツエ 中枝 +ナカツエ 中津江 +ナカツオ 中津尾 +ナカツカ 中塚 +ナカツカ 中司 +ナカツカ 中務 +ナカツカ 中束 +ナカツカ 仲塚 +ナカツカ 中柄 +ナカツカ 中墳 +ナカヅカ 中塚 +ナカヅカ 中司 +ナカヅカ 中務 +ナガツカ 長塚 +ナガツカ 永塚 +ナガツカ 長束 +ナガツカ 永墓 +ナガツカ 永束 +ナカツカサ 中司 +ナカツカサ 中務 +ナカツカサ 中官 +ナカツカサ 中師 +ナガツカサ 長司 +ナカツカワ 中津川 +ナカツガワ 中津川 +ナカツキ 中附 +ナカツキ 中月 +ナカツキ 中付 +ナカツギ 中次 +ナカツギ 中継 +ナカツギ 仲次 +ナガツギ 永次 +ナガツギ 長次 +ナガツグ 永次 +ナガツグ 長次 +ナガツグ 長続 +ナガツグ 暢孫 +ナカツクエ 中机 +ナカツクマ 仲築間 +ナカツクマ 中津隈 +ナカツクマ 中津熊 +ナカツクリ 中造 +ナカツケ 中附 +ナカツジ 中辻 +ナカツジ 仲辻 +ナカツジ 中逵 +ナガツジ 長辻 +ナガツジ 永辻 +ナカツセ 中津瀬 +ナカツタ 中蔦 +ナカツチ 中土 +ナカツツミ 中堤 +ナガツナ 長綱 +ナガツナ 永綱 +ナカツネ 中常 +ナガツネ 長恒 +ナガツネ 永津根 +ナカツノ 中角 +ナカツノ 中津野 +ナカツバタ 中津畑 +ナカツハマ 中津浜 +ナカツハマ 中津濱 +ナカツハラ 中津原 +ナカツボ 中坪 +ナカツボ 中壷 +ナカツボ 中壺 +ナガツボ 長坪 +ナカツマ 中間 +ナカツマ 中妻 +ナカツマ 仲妻 +ナカヅマ 中妻 +ナガツマ 長妻 +ナガツマ 永妻 +ナカツミ 中積 +ナカツミ 中津海 +ナカヅミ 中積 +ナガツミ 永積 +ナガヅミ 永積 +ナガヅミ 長積 +ナカツヤマ 中津山 +ナカツユ 中露 +ナガツユ 永露 +ナカツラ 中面 +ナカツリ 中釣 +ナカツル 中津留 +ナカツル 中鶴 +ナカツル 中水流 +ナカツル 中都留 +ナカツル 中寉 +ナカツル 仲津留 +ナカヅル 中鶴 +ナカヅル 中水流 +ナカヅル 中寉 +ナガツル 長鶴 +ナカツルマ 中鶴間 +ナカテ 中手 +ナカデ 中出 +ナカデ 仲出 +ナガテ 長手 +ナガテ 永手 +ナガデ 長出 +ナカテイ 中亭 +ナカテガワ 仲手川 +ナカデガワ 仲出川 +ナカデグチ 中出口 +ナカデミズ 中出水 +ナカテラ 中寺 +ナカデラ 中寺 +ナカデン 中伝 +ナガデン 永伝 +ナカト 中戸 +ナカト 仲渡 +ナカト 仲戸 +ナカト 中登 +ナカト 中都 +ナカト 中跡 +ナカド 中戸 +ナカド 中土 +ナカド 中角 +ナカド 仲戸 +ナガト 長門 +ナガト 永戸 +ナガト 長戸 +ナガト 長渡 +ナガト 永登 +ナガト 長登 +ナガト 永門 +ナガト 永都 +ナガト 長途 +ナガト 長燈 +ナガト 長都 +ナカドイ 中土井 +ナカドイ 中土居 +ナカドイ 仲問 +ナガドイ 長土居 +ナガトイシ 長門石 +ナカトウ 中藤 +ナカトウ 中東 +ナカトウ 中塔 +ナカトウ 仲藤 +ナカトウ 仲唐 +ナカトウ 中塘 +ナカドウ 中道 +ナカドウ 中堂 +ナガトウ 永藤 +ナガトウ 長藤 +ナガトウ 永東 +ナガトウ 長東 +ナガトウ 長当 +ナガドウ 長堂 +ナガドウ 永洞 +ナカトウゲ 中峠 +ナカドウゾノ 中堂園 +ナカドウゾノ 中堂薗 +ナカトウバル 仲桃原 +ナガトオ 長遠 +ナガトオシ 長通 +ナカドオリ 中通 +ナガトオリ 長通 +ナガドオリ 長通 +ナガドオリ 永通 +ナカトガワ 中戸川 +ナカトガワ 仲戸川 +ナカトキ 中時 +ナガトキ 永時 +ナカトク 中徳 +ナカトク 中督 +ナカトクサリ 中戸鎖 +ナカトクモリ 仲徳盛 +ナカドコロ 中所 +ナカトシ 中俊 +ナガトシ 永利 +ナガトシ 長利 +ナカトセ 中渡瀬 +ナカトチ 中栃 +ナカトチ 中朽 +ナカトチ 中杤 +ナガトチ 永地 +ナカトナリ 中隣 +ナカドナリ 中隣 +ナカドノ 中殿 +ナガトノ 長殿 +ナカトビ 中飛 +ナカトマリ 仲泊 +ナカドマリ 仲泊 +ナカドマリ 中泊 +ナカトミ 中富 +ナカトミ 中臣 +ナカトミ 中冨 +ナカトミ 仲富(仲冨) +ナカドミ 中富 +ナカドミ 中冨 +ナガトミ 永富 +ナガトミ 永冨 +ナガトミ 長富 +ナガトミ 長冨 +ナガトミ 永宝 +ナガドミ 永富 +ナガドミ 永冨 +ナガドミ 長富 +ナガドミ 長冨 +ナカトメ 中留 +ナカドメ 中留 +ナガトメ 永留 +ナガトメ 長留 +ナガトメ 永畄 +ナガドメ 永留 +ナカトモ 中友 +ナカドモ 中塘 +ナガトモ 長友 +ナガトモ 永友 +ナガトモ 長侶 +ナガトモ 永塘 +ナカトモヤス 中友安 +ナカトヤ 中登屋 +ナガトヤ 長門谷 +ナガトヨ 永豊 +ナカトヨトメ 中豊留 +ナカトヨドメ 中豊留 +ナカトリ 中鳥 +ナガトリ 長鳥 +ナガトリ 永鳥 +ナガトリ 永取 +ナガトロ 長戸路 +ナガトロ 長瀞 +ナガトロ 永淀 +ナガトロ 長土呂 +ナガナ 長名 +ナガナ 永名 +ナカナイジ 中内侍 +ナガナエ 長苗 +ナカナオ 中名生 +ナカナガ 中永 +ナカナガ 中長 +ナカナガ 仲永 +ナガナカ 永中 +ナガナカ 永仲 +ナカナガタ 中永田 +ナカナダ 中灘 +ナカナベ 中鍋 +ナカナミ 中南 +ナカナミ 中並 +ナカナミ 中波 +ナカナミ 中浪 +ナカナミ 仲波 +ナガナミ 長南 +ナガナミ 永波 +ナガナミ 長並 +ナガナリ 永成 +ナガナワ 長縄 +ナガナワ 永縄 +ナガナワ 長繩 +ナガナワ 永繩 +ナカナン 中南 +ナカニ 中二 +ナカニ 中荷 +ナガニ 永二 +ナガニ 永仁 +ナカニイ 中新 +ナカニイダ 中新井田 +ナカニイハラ 中新原 +ナカニイヤ 中新屋 +ナカニザワ 中仁沢 +ナカニザワ 中仁澤 +ナカニシ 中西 +ナカニシ 仲西 +ナガニシ 長西 +ナガニシ 永西 +ナカニシキ 中錦 +ナカニシデ 中西出 +ナカニヤ 中仁谷 +ナカニヤ 仲仁谷 +ナカニワ 中庭 +ナカニワ 仲庭 +ナカヌキ 中貫 +ナカヌシ 仲主 +ナカヌシ 中主 +ナカヌノ 中布 +ナカヌマ 中沼 +ナカヌマ 仲沼 +ナガヌマ 長沼 +ナガヌマ 永沼 +ナカネ 中根 +ナカネ 仲根 +ナカネ 中祢 +ナカネ 仲祢 +ナカネ 中禰 +ナガネ 長根 +ナガネ 永根 +ナガネオ 長根尾 +ナガネヤマ 長根山 +ナカノ 中野(中墅) +ナカノ 仲野 +ナカノ 中埜 +ナカノ 中納 +ナカノ 中農 +ナカノ 中能 +ナカノ 仲埜 +ナカノ 中𡌛 +ナカノ 中ノ +ナカノ 中濃 +ナカノ 中之 +ナカノ 那加野 +ナカノ 中廼 +ナカノ 中迺 +ナカノ 仲𡌛 +ナガノ 長野 +ナガノ 永野 +ナガノ 長能 +ナガノ 長埜 +ナガノ 永納 +ナガノ 永埜 +ナガノ 長濃 +ナガノ 奈賀野 +ナガノ 永𡌛 +ナガノ 長納 +ナガノ 那賀野 +ナカノイン 中院 +ナカノウ 中納 +ナカノウ 中農 +ナカノウ 中能 +ナカノウ 中濃 +ナガノウ 長能 +ナガノウ 長納 +ナカノウエ 中ノ上 +ナカノウエ 中之上 +ナカノウエ 中野上 +ナカノウチ 中野内 +ナカノウチ 中ノ内 +ナカノウチ 中之内 +ナカノウチ 仲野内 +ナカノウラ 中之浦 +ナガノウラ 長野浦 +ナカノエ 中野江 +ナカノオ 中野尾 +ナカノカミ 中ノ神 +ナカノガワ 中野川 +ナガノカワ 永野川 +ナガノガワ 永野川 +ナカノコ 仲子 +ナカノコ 中ノ子 +ナカノコ 中野子 +ナカノコ 中の子 +ナカノサイ 中野西 +ナカノサキ 中ノ崎 +ナカノザキ 中野崎 +ナカノサコ 中之迫 +ナカノサワ 中野沢(中野澤) +ナカノジ 中野地 +ナカノシタ 中野下 +ナカノシマ 中能島 +ナカノショ 中之所 +ナカノショウ 中之庄 +ナカノショウヤ 中之庄谷 +ナカノジリ 中野尻 +ナカノセ 中ノ瀬 +ナカノセ 中之瀬 +ナカノセ 中の瀬 +ナカノソノ 中之薗 +ナカノソノ 中之園 +ナカノソノ 中ノ園 +ナカノゾノ 中之薗 +ナカノゾノ 中之園 +ナカノダ 中野田 +ナガノダ 永野田 +ナカノタニ 中野谷 +ナガノツ 長野津 +ナカノテ 中野手 +ナカノドウ 中ノ堂 +ナカノトノ 中ノ殿 +ナカノドノ 中ノ殿 +ナカノハタ 中ノ端 +ナカノハラ 中ノ原 +ナガノハラ 永野原 +ナカノブ 中信 +ナカノブ 仲信 +ナカノブ 中延 +ナガノブ 永延 +ナガノブ 長信 +ナガノブ 長延 +ナカノボウ 中ノ坊 +ナカノボウ 中之坊 +ナガノボリ 長登 +ナカノマ 中野間 +ナカノマ 中之間 +ナカノマ 仲野間 +ナガノマ 永野間 +ナガノマ 永ノ間 +ナガノマ 長野間 +ナカノマエ 中之前 +ナカノマタ 中ノ又 +ナカノマチ 中野町 +ナカノマル 中之丸 +ナカノミヤ 中宮 +ナカノミヤ 中之宮 +ナカノミョウ 中名生 +ナカノムラ 中野村 +ナカノメ 中目 +ナカノメ 中野目 +ナカノメ 中ノ目 +ナカノメ 中の目 +ナカノモリ 中ノ森 +ナカノモリ 中之森 +ナカノヤ 仲野谷 +ナカノヤ 中野谷 +ナカノヤ 中ノ谷 +ナカノヤ 中之谷 +ナカノヤ 中野屋 +ナガノヤ 長野谷 +ナガノヤ 長野屋 +ナカノリ 中野利 +ナカノリ 中乗 +ナカノリ 中野里 +ナガノリ 長法 +ナカノワタリ 中野渡 +ナカノワタリ 中埜渡 +ナカノワタリ 中ノ渡 +ナカハ 中葉 +ナカハ 中羽 +ナカバ 中 +ナカバ 中場 +ナカバ 中葉 +ナカバ 中羽 +ナカバ 半 +ナカバ 央 +ナカバ 仲葉 +ナガバ 長場 +ナガバ 永場 +ナカバイ 半井 +ナガハカ 永墓 +ナカハカマダ 中袴田 +ナカハギ 中萩 +ナカハゲ 中兀 +ナカバサミ 中狭 +ナカバサミ 中挟 +ナカバサミ 中挾 +ナカバサミ 中狹 +ナカハシ 中橋 +ナカハシ 仲橋 +ナカハシ 中箸 +ナカハシ 中槁 +ナカバシ 中橋 +ナガハシ 長橋 +ナガハシ 永橋 +ナガハシ 長端 +ナガハシ 長階 +ナガハシ 長槁 +ナガハス 永蓮 +ナカハタ 中畑 +ナカハタ 中畠 +ナカハタ 仲畑 +ナカハタ 中幡 +ナカハタ 中端 +ナカハタ 仲畠 +ナカハタ 中波田 +ナカバタ 中端 +ナガハタ 長畑 +ナガハタ 永幡 +ナガハタ 永畑 +ナガハタ 長幡 +ナガハタ 長畠 +ナガハタ 永畠 +ナガハタ 長端 +ナガハタ 永籏 +ナガハタ 永旗 +ナガバタ 長端 +ナカバタケ 中畠 +ナガハタケ 長畠 +ナガバタケ 長畠 +ナカハチ 中鉢 +ナカハチ 仲鉢 +ナカバチ 中鉢 +ナカバチ 仲鉢 +ナカハチゴ 中八児 +ナカハツ 中初 +ナカハナ 中花 +ナカハナ 中鼻 +ナカハナ 中華 +ナカハナ 仲波名 +ナカバナ 中端 +ナガハナ 長花 +ナカハナダ 中花田 +ナカハネ 中刎 +ナカバネ 半根 +ナカババ 中馬場 +ナガハバ 長幅 +ナガハバ 長巾 +ナカハマ 中浜 +ナカハマ 中濱 +ナカハマ 仲浜 +ナカハマ 仲濱 +ナガハマ 長浜 +ナガハマ 永浜 +ナガハマ 長濱 +ナガハマ 永濱 +ナカハマダ 中浜田 +ナガハマヤ 長浜谷 +ナガハマヤ 長浜屋 +ナガハマヤ 長濱谷 +ナカハヤ 中早 +ナカバヤシ 中林 +ナカバヤシ 仲林 +ナガバヤシ 長林 +ナガバヤシ 永林 +ナカハラ 中原 +ナカハラ 仲原 +ナカハラ 名嘉原 +ナガハラ 永原 +ナガハラ 長原 +ナガハラ 名荷原 +ナカハライ 中払 +ナカハライ 中拂 +ナカハラダ 中原田 +ナカハリ 中張 +ナカハリ 中播 +ナカバリ 中張 +ナガハリ 長張 +ナガハリ 長針 +ナカハル 中春 +ナカハル 中晴 +ナカバル 中原 +ナガハル 永治 +ナガハル 永春 +ナガハル 長春 +ナカバン 中坂 +ナカバン 仲坂 +ナカヒ 中樋 +ナカヒ 仲肥 +ナカヒ 中火 +ナカヒ 中桧 +ナカヒ 中檜 +ナカヒウラ 中日裏 +ナカヒガシ 中東 +ナカヒガシ 仲東 +ナガヒコ 長彦 +ナカヒサ 中久 +ナガヒサ 長久 +ナガヒサ 永久 +ナガヒサ 永寿(永壽) +ナカヒト 中人 +ナカヒナ 中日奈 +ナガヒメ 長姫 +ナカヒラ 中平 +ナカヒラ 仲平 +ナカヒラ 中比良 +ナカヒラ 中平等 +ナカヒラ 仲平良 +ナガヒラ 永平 +ナガヒラ 長平 +ナガヒラ 長平良 +ナカヒラタ 中平田 +ナカヒロ 中広 +ナカヒロ 中廣 +ナカヒロ 中弘 +ナガヒロ 永広 +ナガヒロ 長広 +ナガヒロ 長弘 +ナガヒロ 永廣 +ナガヒロ 長廣 +ナガヒロ 永弘 +ナカブカ 中深 +ナカフカサコ 中深迫 +ナガフカタ 長深田 +ナガフカダ 長深田 +ナカフク 中福 +ナガフク 永福 +ナカフクシマ 中福島 +ナガブクロ 長袋 +ナカフサ 中房 +ナガフサ 長房 +ナガフサ 永房 +ナガフサ 長總 +ナカフシ 仲伏 +ナカフシ 中伏 +ナカフジ 中藤 +ナカフジ 仲藤 +ナカブシ 仲伏 +ナカブシ 中歩師 +ナガフジ 永藤 +ナガフジ 長藤 +ナガフジ 永富士 +ナガフジ 永冨士 +ナカフシキ 中伏木 +ナカフタミ 仲二見 +ナカフチ 中渕 +ナカブチ 中渕 +ナカブチ 中淵 +ナガフチ 永渕 +ナガフチ 永淵 +ナガフチ 長渕 +ナガフチ 長淵 +ナガブチ 永渕 +ナガブチ 永淵 +ナガブチ 長渕 +ナガブチ 長淵 +ナカフッタ 中振田 +ナカフナイ 仲舟井 +ナカフナキ 中船木 +ナカフナキ 中舟木 +ナカフナツ 中船津(中舩津) +ナカフネ 中船 +ナガフネ 長船 +ナガフネ 長舟 +ナガフネ 永船(永舩) +ナカフミ 中文 +ナカフリ 中振 +ナカフリ 中布利 +ナカフル 中古 +ナカフル 仲古 +ナカブロ 中風呂 +ナカブン 中分 +ナカベ 中部 +ナカベ 中辺(中邊) +ナカベ 仲部 +ナガベ 長部 +ナガベ 永辺 +ナガベ 永部 +ナカベップ 中別府 +ナカベヤ 中部屋 +ナカベヤ 中部谷 +ナカヘン 中返 +ナカホ 中保 +ナカホ 仲保 +ナカホ 中穂 +ナカボ 中保 +ナカボ 仲保 +ナガホ 永穂(永穗) +ナガホ 長穂 +ナガホ 永保 +ナカボウ 中坊 +ナカボウ 中防 +ナカホギ 中甫木 +ナガホコ 長鉾 +ナカホシ 中星 +ナカボシ 中星 +ナカホシバ 中干場 +ナカホソ 中細 +ナカホド 仲程 +ナカホド 中程 +ナカホノキ 中甫木 +ナカホラ 中洞 +ナカボラ 中洞 +ナガホラ 永洞 +ナガホラ 長洞 +ナカホリ 中堀 +ナカホリ 中掘 +ナカホリ 仲堀 +ナカボリ 中堀 +ナガホリ 長堀 +ナガホリ 永堀 +ナガホリ 長掘 +ナガボリ 長堀 +ナカマ 中間 +ナカマ 仲間 +ナカマ 中馬 +ナカマ 名嘉真 +ナカマ 仲摩 +ナカマ 仲真 +ナカマ 半間 +ナカマ 中摩 +ナカマ 中真 +ナカマ 中磨 +ナカマ 名嘉眞 +ナカマ 仲眞 +ナカマ 中澗 +ナカマ 中眞 +ナカマ 仲磨 +ナカマ 仲麻 +ナカマ 名嘉間 +ナガマ 長間 +ナガマ 永間 +ナガマ 長馬 +ナカマエ 中前 +ナカマエ 仲前 +ナガマエ 長前 +ナガマエ 永前 +ナカマエジョウ 仲前門 +ナカマエゾノ 中前園 +ナカマエダ 中前田 +ナカマガセ 中曲瀬 +ナカマキ 中牧 +ナカマキ 中巻 +ナカマキ 中槙(中槇) +ナガマキ 永牧 +ナカマゴエ 中馬越 +ナカマサ 中正 +ナカマサ 仲正 +ナカマサ 中政 +ナガマサ 永正 +ナガマサ 長政 +ナガマサ 長正 +ナガマサ 永昌 +ナガマサ 永政 +ナカマシ 仲真次(仲眞次) +ナカマス 中増 +ナカマス 中舛 +ナカマス 仲桝 +ナカマス 仲舛 +ナカマス 中益 +ナカマス 中桝 +ナカマス 中枡 +ナカマス 仲升 +ナカマス 仲増 +ナカマス 中升 +ナカマス 仲枡 +ナガマス 永益 +ナガマス 長増 +ナガマス 長升 +ナカマタ 中俣 +ナカマタ 仲俣 +ナカマタ 中股 +ナカマタ 仲又 +ナカマタ 中又 +ナガマタ 長又 +ナガマタ 長俣 +ナカマチ 中町 +ナカマチ 仲町 +ナガマチ 長町 +ナガマチ 永町 +ナカマツ 仲松 +ナカマツ 中松 +ナガマツ 永松 +ナガマツ 長松 +ナカマツオ 中松尾 +ナカマツマエ 中松前 +ナガマツヤ 長松谷 +ナカマニワ 中間庭 +ナカマヤ 中間谷 +ナカマル 中丸 +ナカマル 仲丸 +ナカマルオ 中円尾(中圓尾) +ナカマルキ 中丸木 +ナカマロ 中麿 +ナカマワリ 中廻 +ナカマン 中万 +ナカミ 中水 +ナカミ 中見 +ナカミ 中美 +ナカミ 仲見 +ナガミ 永見 +ナガミ 長見 +ナガミ 永海 +ナガミ 長神 +ナガミ 長水 +ナガミ 詠 +ナガミ 永美 +ナガミ 名上 +ナガミ 流水 +ナガミ 永味 +ナガミ 長美 +ナガミ 長三 +ナカミカド 中御門 +ナカミカワ 中三川 +ナカミカワ 仲三河 +ナカミガワ 中三川 +ナカミガワ 仲見川 +ナカミガワ 中見川 +ナカミガワ 仲三河 +ナカミガワ 中上川 +ナカミズ 中水 +ナガミズ 永水 +ナガミズ 長水 +ナカミセ 中店 +ナカミセ 中三瀬 +ナカミゾ 中溝 +ナガミゾ 永溝 +ナガミゾ 長溝 +ナカミチ 中道 +ナカミチ 中路 +ナカミチ 仲道 +ナカミチ 中通 +ナガミチ 長通 +ナガミチ 長道 +ナガミチ 永通 +ナガミチ 長路 +ナガミチ 永道 +ナカミツ 中満 +ナカミツ 中光 +ナカミツ 仲光 +ナカミツ 中滿 +ナガミツ 長光 +ナガミツ 永光 +ナガミツ 永満 +ナガミツ 長満 +ナカミデ 中巳出 +ナカミデ 中己出 +ナガミドリ 永緑 +ナカミナト 中港 +ナカミナト 中湊 +ナカミナミ 中南 +ナカミナミ 仲南 +ナカミネ 仲嶺 +ナカミネ 中峰 +ナカミネ 中峯 +ナカミネ 中嶺 +ナカミネ 中岑 +ナカミネ 仲峰 +ナカミネ 仲峯 +ナカミネ 名嘉嶺 +ナガミネ 長嶺 +ナガミネ 長峰 +ナガミネ 永峰 +ナガミネ 永峯 +ナガミネ 長峯 +ナガミネ 永嶺 +ナガミネ 永岑 +ナガミネ 永領 +ナガミネ 長領 +ナガミネ 長岑 +ナカミヤ 中宮 +ナカミヤ 仲宮 +ナガミヤ 永宮 +ナガミヤ 長宮 +ナカミョウ 中明 +ナカミョウ 中名 +ナカミョウズ 中名主 +ナカム 中務 +ナカムカイ 中向 +ナカムカイ 中迎 +ナカムカイ 中向井 +ナカムカエ 中迎 +ナカムキ 中向 +ナカムギ 中麦 +ナカムシカベ 中虫壁 +ナカムジナ 中狢 +ナカムタ 中牟田 +ナカムタ 中無田 +ナガムタ 永牟田 +ナカムネ 中宗 +ナカムネ 仲宗 +ナガムネ 長棟 +ナガムネ 長宗 +ナガムネ 永宗 +ナガムネ 永棟 +ナカムラ 中村 +ナカムラ 仲村 +ナカムラ 中邑 +ナカムラ 中邨 +ナカムラ 名嘉村 +ナカムラ 仲邑 +ナカムラ 仲邨 +ナガムラ 長村 +ナガムラ 永村 +ナガムラ 長邑 +ナカムラヤ 中村谷 +ナカムレ 中牟礼 +ナカムレ 中牟禮 +ナガムレ 永牟礼 +ナカムロ 中室 +ナカメ 中目 +ナカメ 中明 +ナガメ 永目 +ナガメ 詠 +ナガメ 長目 +ナカメイ 中明 +ナカモ 中面 +ナカモ 中茂 +ナカモ 名嘉毛 +ナガモ 永茂 +ナカモウ 名嘉毛 +ナカモチ 仲持 +ナガモチ 永持 +ナガモチ 長持 +ナガモテ 長表 +ナカモト 中本 +ナカモト 中元 +ナカモト 仲本 +ナカモト 仲元 +ナカモト 名嘉元 +ナカモト 中許 +ナカモト 中夲 +ナカモト 仲求 +ナガモト 長本 +ナガモト 永本 +ナガモト 永元 +ナガモト 長元 +ナガモト 長基 +ナガモト 長源 +ナカモトタニ 中本谷 +ナカモノ 中者 +ナカモリ 中森 +ナカモリ 仲森 +ナカモリ 仲盛 +ナカモリ 中盛 +ナカモリ 中守 +ナガモリ 永森 +ナガモリ 長森 +ナガモリ 永盛 +ナガモリ 永守 +ナガモリ 長守 +ナカモンデ 中門出 +ナカヤ 中谷 +ナカヤ 中屋 +ナカヤ 仲谷 +ナカヤ 中矢 +ナカヤ 中家 +ナカヤ 仲矢 +ナカヤ 中舎 +ナカヤ 仲屋 +ナカヤ 仲家 +ナカヤ 中弥 +ナカヤ 中夜 +ナカヤ 中箭 +ナカヤ 中彌 +ナカヤ 中舍 +ナカヤ 仲舎 +ナカヤ 楠香谷 +ナガヤ 長谷 +ナガヤ 長屋 +ナガヤ 永谷 +ナガヤ 永冶 +ナガヤ 長家 +ナガヤ 永家 +ナガヤ 永屋 +ナガヤ 永治 +ナガヤ 長矢 +ナガヤ 永矢 +ナガヤ 名賀谷 +ナカヤウチ 中谷内 +ナカヤシキ 中屋敷 +ナカヤシキ 中屋鋪 +ナガヤシキ 長屋敷 +ナカヤシロ 中矢代 +ナカヤス 中安 +ナカヤス 中易 +ナカヤス 中保 +ナカヤス 仲保 +ナカヤス 仲安 +ナカヤス 中康 +ナカヤス 中昜 +ナガヤス 永易 +ナガヤス 永安 +ナガヤス 長安 +ナガヤス 長保 +ナガヤス 永保 +ナガヤス 永康 +ナカヤチ 中谷内 +ナカヤチ 中谷地 +ナカヤチ 仲谷内 +ナガヤチ 長谷地 +ナカヤチゴ 中八児 +ナカヤド 中宿 +ナカヤナギ 中柳 +ナガヤナギ 永柳 +ナカヤノ 中矢野 +ナカヤハラ 中屋原 +ナカヤブ 中薮 +ナカヤブ 中藪 +ナカヤブ 中籔 +ナカヤブ 仲薮 +ナカヤブ 仲藪 +ナガヤブ 永薮 +ナガヤブ 永籔 +ナガヤブ 永藪 +ナカヤマ 中山 +ナカヤマ 仲山 +ナカヤマ 名嘉山 +ナガヤマ 永山 +ナガヤマ 長山 +ナガヤマ 那賀山 +ナガヤマ 修山 +ナカヤマダ 中山田 +ナカヤリ 中谷里 +ナカユ 中湯 +ナガユ 永湯 +ナカユウ 中宥 +ナカユキ 仲行 +ナガユキ 長行 +ナカユヒラ 中湯平 +ナガユミ 長弓 +ナカヨ 中与 +ナカヨ 中與 +ナガヨ 長代 +ナガヨ 長与 +ナガヨ 永代 +ナガヨ 長與 +ナガヨ 長輿 +ナガヨ 長興 +ナカヨウ 中陽 +ナガヨウ 永用 +ナカヨウボ 中養母 +ナカヨク 中能 +ナカヨコ 中横 +ナカヨシ 中吉 +ナカヨシ 仲吉 +ナカヨシ 中由 +ナカヨシ 仲由 +ナカヨシ 仲与志 +ナカヨシ 中芳 +ナガヨシ 永吉 +ナガヨシ 長吉 +ナガヨシ 永芳 +ナガヨシ 永由 +ナガヨシ 長葭 +ナガヨシ 長義 +ナガヨシ 永好 +ナガヨシ 永義 +ナガヨシ 長昌 +ナガヨシ 長葮 +ナカヨネ 仲与根(仲與根) +ナカヨネ 仲米 +ナカヨリ 中寄 +ナカラ 中良 +ナガラ 長柄 +ナガラ 長楽 +ナガラ 長良 +ナガラ 永良 +ナガラ 乍 +ナガラ 奈柄 +ナガラ 名柄 +ナガラ 長羅 +ナカライ 半井 +ナカライ 伴井 +ナガラキ 長良木 +ナガラク 長楽 +ナガラク 長樂 +ナガラシ 長嵐 +ナカリ 中利 +ナカリ 中理 +ナカリ 仲利 +ナガリ 長利 +ナカリキ 中力 +ナカリュウ 中竜 +ナカリュウ 中龍 +ナガレ 流 +ナガレ 永礼 +ナガレ 永禮 +ナガレアイ 流合 +ナガレオ 流尾 +ナガレカワ 流川 +ナガレガワ 流川 +ナガレギ 流木 +ナガレスギ 流杉 +ナガレタ 流田 +ナガレダ 流田 +ナガレタニ 流谷 +ナガレダニ 流谷 +ナガレデ 流出 +ナガレハ 流羽 +ナガレメ 流目 +ナガレモリ 流森 +ナガレヤ 流矢 +ナガレヤシキ 流屋敷 +ナガレヤマ 流山 +ナガレワタリ 流渡 +ナガレワリ 流割 +ナガロ 長櫓 +ナガロ 長艫 +ナカロッカク 中六角 +ナカワ 中和 +ナガワ 南川 +ナガワ 長川 +ナガワ 名川 +ナガワ 長和 +ナガワ 奈川 +ナガワ 那川 +ナカワカ 仲若 +ナガワカ 長若 +ナカワキ 中脇(中𦚰) +ナカワキ 中刀 +ナガワキ 永脇 +ナガワキ 長脇 +ナカワケ 中分 +ナカワケ 中別 +ナカワダ 中和田 +ナガワタ 長綿 +ナガワダ 永和田 +ナカワタシ 中渡 +ナカワタセ 中渡瀬 +ナカワタリ 中渡 +ナガワタリ 永渡 +ナカワノ 中和野 +ナガワラ 永藁 +ナガワラ 長藁 +ナガワリ 永割 +ナカン 中閑 +ナカンカリ 仲村柄 +ナカンダイラ 中平 +ナカンダカリ 仲村渠 +ナカンダカリ 中村渠 +ナカンダカレ 仲村渠 +ナカンドウ 中堂 +ナカンラカリ 仲村渠 +ナキ 梛木 +ナキ 名木 +ナギ 南木 +ナギ 梛木 +ナギ 凪 +ナギ 名木 +ナギ 奈木 +ナギ 那木 +ナギ 梛 +ナギ 南義 +ナギ 南祇 +ナギ 泙 +ナギ 椰木 +ナギウラ 諾浦 +ナギオ 梛尾 +ナギオ 椰尾 +ナギカワ 梛川 +ナギサ 渚 +ナギサ 名木佐 +ナギサワ 渚沢 +ナギサワ 渚澤 +ナギサワ 薙沢 +ナギサワ 薙澤 +ナギサワ 那樹沢 +ナギシバ 崩紫 +ナキジン 今帰仁 +ナキタ 名木田 +ナギタ 名木田 +ナギナタ 長刀 +ナギノ 梛野 +ナギノ 薙野 +ナギノ 奈木野 +ナギノ 投野 +ナギノ 名木野 +ナギノ 泙野 +ナギノ 南木野 +ナキバ 名木葉 +ナギハシ 名木橋 +ナギハシ 梛橋 +ナギハラ 梛原 +ナギハラ 泙原 +ナギマエ 崩前 +ナギミ 南君 +ナギモト 泙本 +ナキヤマ 南金山 +ナギヤマ 梛山 +ナギヤマ 名木山 +ナギヤマ 椰山 +ナキラ 奈鬼羅 +ナギラ 柳楽 +ナギラ 柳浦 +ナギラ 奈義良 +ナギラ 柳樂 +ナギラ 梛良 +ナギラ 奈喜良 +ナギラ 櫟良 +ナギラ 𣟿良 +ナキリ 名切 +ナキリ 百鬼 +ナキリ 奈切 +ナキリ 名桐 +ナキリ 菜切 +ナキリ 奈桐 +ナギリ 名切 +ナギリ 名桐 +ナギリ 菜切 +ナキリモト 名切元 +ナクイ 名久井 +ナグサ 名草 +ナグサ 南草 +ナグサ 南艸 +ナグサ 南種 +ナグサ 名種 +ナグサ 名艸 +ナグチ 南口 +ナグチ 名口 +ナグチ 那口 +ナクボ 名窪 +ナグモ 南雲 +ナグモ 奈雲 +ナグモ 名雲 +ナグモ 那雲 +ナグモ 南曇 +ナクラ 名倉 +ナクラ 奈倉 +ナクラ 那倉 +ナクラ 名蔵(名藏) +ナグラ 名倉 +ナグラ 奈倉 +ナグラ 那倉 +ナグラ 奈蔵 +ナグラ 南倉 +ナグラ 納蔵 +ナグロ 名黒 +ナグワ 南桑 +ナグワ 名桑 +ナゲイシ 投石 +ナゲシ 長押 +ナゲノ 投野 +ナゲノ 投埜 +ナゲモト 投元 +ナゲヤマ 投山 +ナコ 名古 +ナコ 名子 +ナコ 奈古 +ナゴ 名古 +ナゴ 名護 +ナゴ 名子 +ナゴ 長太 +ナゴ 奈古 +ナゴ 南居 +ナゴ 名呉 +ナゴ 奈呉 +ナゴ 名後 +ナゴ 名胡 +ナコウ 名幸 +ナゴウ 長郷 +ナゴウ 永合 +ナゴウ 名合 +ナゴウ 長合 +ナゴウ 名郷 +ナコウゲ 名高下 +ナコウサイ 中河西 +ナコウシ 長牛 +ナコウジ 名小路 +ナゴウネ 名郷根 +ナゴエ 名越 +ナゴエ 奈呉江 +ナコシ 名越 +ナコシ 長牛 +ナコシ 名超 +ナコジ 名古路 +ナゴシ 名越 +ナゴシ 長牛 +ナゴジ 名古路 +ナコジヤ 名小路谷 +ナコセ 名古瀬 +ナコソ 名古曽 +ナコソ 名古曾 +ナコソ 勿来 +ナゴタ 名古田 +ナゴタ 名護田 +ナゴダ 名古田 +ナゴタニ 名古谷 +ナゴネ 名郷根 +ナゴネ 名古根 +ナゴヒラ 名子平 +ナゴヤ 名越 +ナゴヤ 名古屋 +ナゴヤ 名児耶 +ナゴヤ 名古谷 +ナゴヤ 名護屋 +ナゴヤ 奈古屋 +ナゴヤ 名子屋 +ナゴヤ 那小屋 +ナゴヤ 那古屋 +ナゴヤ 名古家 +ナゴヤ 名古弥 +ナゴヤ 名護谷 +ナゴヤ 名児屋 +ナゴヤ 名兒耶 +ナゴヤマ 名護山 +ナゴロ 名頃 +ナサ 奈佐 +ナサ 那佐 +ナサ 何左 +ナザ 名座 +ナサカ 名坂 +ナサカ 名阪 +ナサキ 南向 +ナサギ 名鷺 +ナザキ 名崎 +ナサコ 名迫 +ナサコ 奈迫 +ナサダ 名定 +ナサデ 那佐出 +ナサト 名里 +ナザト 名里 +ナサハラ 名佐原 +ナサハラ 奈佐原 +ナザワ 名沢 +ナザワ 名澤 +ナシ 梨子 +ナシ 梨 +ナシイ 梨井 +ナシオ 名塩 +ナシオ 梨尾 +ナシオカ 梨岡 +ナシカ 名鹿 +ナシガセ 梨ケ瀬 +ナシカワ 梨川 +ナシキ 梨木 +ナシキ 梨子木 +ナシコシタ 梨子下 +ナシザキ 梨崎 +ナシザワ 梨沢 +ナシザワ 梨澤 +ナシタ 梨田 +ナシタ 名下 +ナシダ 梨子田 +ナシダ 梨田 +ナシダ 無田 +ナジタ 奈地田 +ナシタニ 梨谷 +ナシノ 梨野 +ナシノ 那志野 +ナシノキ 梨木 +ナシノキ 梨子木 +ナシノキ 梨ノ木 +ナシバ 梨羽 +ナシハタ 梨畑 +ナシハラ 梨原 +ナシハラ 奈子原 +ナジハラ 南指原 +ナジハラ 奈治原 +ナシマ 名島 +ナシマ 名嶋 +ナシマ 奈島 +ナシマ 菜嶋 +ナシマ 奈嶋 +ナシマ 名嶌 +ナジマ 名島 +ナジマ 南島 +ナジマ 名嶋 +ナジマ 奈島 +ナジマ 菜嶋 +ナジマ 菜島 +ナシムラ 梨村 +ナシムラ 梨子村 +ナジメ 納米 +ナシモト 梨本 +ナシモト 梨元 +ナシモト 梨子本 +ナシモリ 梨森 +ナシヤ 梨谷 +ナシヤマ 梨山 +ナシロ 名城 +ナシロ 苗代 +ナシロ 名代 +ナシロ 納代 +ナシロ 奈城 +ナシロ 奈代 +ナシロザワ 苗代沢 +ナシロザワ 苗代澤 +ナシロハバ 苗代幅 +ナシロハバ 苗代巾 +ナシワ 梨和 +ナシワ 梨羽 +ナシワキ 梨脇 +ナジワラ 南指原 +ナス 那須 +ナス 奈須 +ナス 南寿 +ナス 名須 +ナス 茄子 +ナス 菜子 +ナス 七寸 +ナス 奈数 +ナス 南壽 +ナスイ 那須井 +ナスカ 名須賀 +ナスガ 奈須賀 +ナズカ 名塚 +ナスカワ 那須川 +ナスカワ 名須川 +ナスカワ 茄子川 +ナスカワ 奈須川 +ナスカワ 茄川 +ナスガワ 那須川 +ナズカワ 撫川 +ナスグチ 那須口 +ナスクラ 茄子倉 +ナスジ 名筋 +ナスシタ 奈須下 +ナスタ 奈須田 +ナスダ 那須田 +ナスダ 奈須田 +ナスダ 茄子田 +ナスナ 奈須那 +ナスノ 那須野 +ナスノ 奈須野 +ナスノ 茄子野 +ナスノ 奈須埜 +ナスハラ 南須原 +ナスハラ 那須原 +ナスハラ 茄子原 +ナスビダ 茄子田 +ナスミ 那住 +ナズミ 泥 +ナズミ 那住 +ナズミ 名角 +ナズミ 奈住 +ナスムラ 那須村 +ナスモト 奈須本 +ナスモト 那須本 +ナスヤ 名須谷 +ナゾウ 名蔵(名藏) +ナソカリ 七十刈(七十苅) +ナタ 名田 +ナタ 那谷 +ナタ 奈田 +ナタ 那多 +ナタ 奈多 +ナダ 名田 +ナダ 灘 +ナダ 奈田 +ナダ 那田 +ナダ 洋 +ナタアミ 屶網 +ナタイ 刀井 +ナタイ 屶納 +ナダイ 灘井 +ナダイ 名代 +ナダオ 灘尾 +ナダオカ 灘岡 +ナタオチ 鉈落 +ナタカ 名高 +ナダカ 名高 +ナダカミ 灘上 +ナダギ 灘儀 +ナダグチ 灘口 +ナタケ 名武 +ナタケ 名竹 +ナタケ 奈竹 +ナダケ 灘家 +ナダサキ 灘先 +ナダサキ 灘崎 +ナダスミ 灘住 +ナダタ 灘田 +ナダタニ 灘谷 +ナダタニ 洋谷 +ナダタニ 名田谷 +ナタチ 名達 +ナダチ 名達 +ナダチ 灘地 +ナダチ 名立 +ナダチ 名逹 +ナタツカ 刀塚 +ナタヅカ 刀塚 +ナダトモ 灘友 +ナダナカ 灘中 +ナダナミ 灘浪 +ナタニ 那谷 +ナタニ 名谷 +ナタニ 奈谷 +ナダニ 名谷 +ナタニヤ 那谷屋 +ナタネ 菜種 +ナダノ 灘野 +ナダノ 奈田野 +ナダノ 灘乃 +ナタバ 奈田羽 +ナタハシ 鉈橋 +ナダハマ 灘浜 +ナダハマ 灘濱 +ナダハラ 灘原 +ナタヒラ 名田平 +ナタベ 名田部 +ナダベ 灘部 +ナダベ 灘辺(灘邉) +ナダベ 灘邊 +ナタミ 屶網 +ナダミ 洋見 +ナダミ 灘見 +ナダミツ 灘光 +ナタミネ 鉈峰 +ナタミネ 鉈峯 +ナダムラ 灘村 +ナダモト 灘本 +ナタヤ 那田屋 +ナダヤ 灘谷 +ナダヤ 灘家 +ナダヤ 名田屋 +ナダヤマ 灘山 +ナダヨシ 灘吉 +ナダワキ 灘脇 +ナチ 名知 +ナチ 那知 +ナチ 名地 +ナチ 名智 +ナチ 那智 +ナチ 名池 +ナチ 名刀 +ナチ 奈知 +ナチ 奈智 +ナチアケ 那智明 +ナチイ 那知伊 +ナチガミ 那知上 +ナチダ 奈地田 +ナチノ 那智野 +ナチハラ 名知原 +ナツ 夏 +ナツアキ 夏秋(夏龝) +ナツアケ 夏明 +ナツイ 夏井 +ナツイ 名津井 +ナツイケ 夏池 +ナツイサカ 夏井坂 +ナツイザカ 夏井坂 +ナツイシ 夏石 +ナツウミ 夏海 +ナツウメ 夏梅 +ナツエ 夏江 +ナツカ 長束 +ナツカ 名塚 +ナツカ 夏加 +ナツガ 夏賀 +ナヅカ 名塚 +ナツカミ 夏神 +ナツガミ 夏神 +ナツカリ 夏苅 +ナツカリ 夏刈 +ナツガリ 夏苅 +ナツガリ 夏刈 +ナツカワ 夏川 +ナツカワド 夏川戸 +ナツキ 夏木 +ナツキ 夏樹 +ナツキ 夏生 +ナツギシ 夏岸 +ナツキセ 夏木瀬 +ナツギリ 夏伐 +ナツグチ 夏口 +ナツクリ 夏栗 +ナツゴエ 夏越 +ナツコシ 夏越 +ナツサカ 夏坂 +ナツザカ 夏坂 +ナツサコ 夏迫 +ナツザコ 夏迫 +ナツザワ 夏沢 +ナツジ 夏地 +ナツシマ 夏嶋 +ナツズミ 夏住 +ナツセコ 夏迫 +ナッタ 夏田 +ナツタ 夏田 +ナツダ 夏田 +ナツタニ 夏谷 +ナツド 夏戸 +ナットウ 納藤 +ナツトミ 夏富 +ナツトミ 夏冨 +ナツナギ 夏凪 +ナツナリ 夏成 +ナツヌマ 夏沼 +ナツノ 夏野 +ナツバ 夏葉 +ナツハタ 夏畑 +ナツバタ 夏畑 +ナツバヤシ 夏林 +ナツハラ 夏原 +ナツヒ 夏日 +ナツホリ 夏堀 +ナツボリ 夏堀 +ナツボリ 夏掘 +ナツマ 夏間 +ナツマヤ 夏厩 +ナツミ 夏見 +ナツミ 夏海 +ナツミズ 夏水 +ナツミヤ 夏宮 +ナツムシ 夏虫 +ナツムラ 夏村 +ナツメ 夏目 +ナツメ 棗 +ナツメ 鰀目 +ナツメ 奈爪 +ナツメダ 棗田 +ナツメダ 夏目田 +ナツモト 夏本 +ナツモリ 夏森 +ナツヤ 夏谷 +ナツヤ 夏屋 +ナツヤキ 夏焼 +ナツヤギ 夏八木 +ナツヤマ 夏山 +ナツヨシ 夏吉 +ナテ 名手 +ナテ 奈手 +ナデ 名手 +ナデ 撫 +ナデサカ 撫坂 +ナデシコ 撫子 +ナデシマ 撫島 +ナデタニ 撫谷 +ナデノ 撫野 +ナデハラ 撫原 +ナデモト 撫本 +ナデヤマ 撫山 +ナトウ 納藤 +ナトウ 名藤 +ナトウ 名東 +ナトウ 名当(名當) +ナトミ 名富 +ナトミ 名冨 +ナトヤマ 名渡山 +ナドヤマ 名渡山 +ナトリ 名取 +ナトリ 名執 +ナトリ 名鳥 +ナトリガワ 名取川 +ナナアラシ 七嵐 +ナナイ 七井 +ナナイ 名々井 +ナナイシ 七石 +ナナウミ 七海 +ナナウラ 七浦 +ナナエ 名苗 +ナナエダ 七枝 +ナナオ 七尾 +ナナオ 名直 +ナナオカ 七岡 +ナナオヤ 七尾谷 +ナナカド 七門 +ナナカマ 七釜 +ナナカマス 七釜子 +ナナカヤ 七加家 +ナナカラゲ 七搦 +ナナカワ 七川 +ナナカワ 七河 +ナナキ 那々木 +ナナキ 七々木 +ナナキタ 七木田 +ナナキダ 七木田 +ナナクサ 七種 +ナナクサ 七草 +ナナクサギ 七草木 +ナナクボ 七久保 +ナナクマ 七熊 +ナナクラ 七倉 +ナナクリ 七栗 +ナナサキ 七崎 +ナナザキ 七崎 +ナナサコ 七迫 +ナナサト 七里 +ナナサワ 七沢 +ナナサワ 七澤 +ナナザワ 七沢 +ナナザワ 七澤 +ナナシノ 七篠 +ナナシマ 七島 +ナナシマ 七嶋 +ナナシャ 七社 +ナナショウジ 七障子 +ナナスミ 七角 +ナナセ 七瀬 +ナナセ 七々瀬 +ナナセ 七世 +ナナセガワ 七瀬川 +ナナセタニ 七瀬谷 +ナナセダニ 七瀬谷 +ナナゾウシ 七蔵司(七藏司) +ナナタ 七田 +ナナダ 七田 +ナナタキ 七滝 +ナナタキ 七瀧 +ナナタニ 七谷 +ナナタワラ 七俵 +ナナタンダ 七反田 +ナナツエ 七枝 +ナナツカ 七塚 +ナナツカド 七津角 +ナナツガワ 七ツ河 +ナナツダ 七ツ田 +ナナツタニ 七ツ谷 +ナナツマチ 七ツ町 +ナナツムラ 七ツ村 +ナナツヤ 七ツ矢 +ナナツヤク 七ツ役 +ナナト 七戸 +ナナノ 七野 +ナナバヤシ 七林 +ナナハラ 七原 +ナナハラ 七々原 +ナナベ 七部 +ナナベ 七辺(七邊) +ナナホウ 七宝(七寳) +ナナホシ 七星 +ナナボシ 七星 +ナナマ 七間 +ナナマチ 七町 +ナナマツ 七松 +ナナミ 七海 +ナナミ 名波 +ナナミ 那波 +ナナミ 七見 +ナナミ 奈波 +ナナミヤ 七宮 +ナナムラ 七村 +ナナムレ 七牟礼 +ナナムレ 七牟禮 +ナナメキ 斜木 +ナナメキ 枓木 +ナナメキ 七目木 +ナナメギ 斜木 +ナナメタ 斜田 +ナナモト 七元 +ナナモト 七本 +ナナモリ 七森 +ナナモリ 斜森 +ナナヤク 七役 +ナナヤマ 七山 +ナニカワ 何川 +ナニキ 何木 +ナニザワ 名仁澤(名仁沢) +ナニシ 名西 +ナニタニ 何谷 +ナニマツ 何松 +ナニモト 何本 +ナニモリ 何盛 +ナニヨシ 何吉 +ナニワ 難波 +ナニワ 浪花 +ナニワ 浪華 +ナニワ 浪速 +ナニワ 何輪 +ナニワエ 難波江 +ナニワダ 難波田 +ナヌカイチ 七日市 +ナヌシガワ 名主川 +ナネ 那根 +ナノ 名野 +ナノカイチ 七日市 +ナノヒラ 名野平 +ナハ 名波 +ナハ 那波 +ナハ 那覇 +ナバ 名波 +ナバ 那波 +ナバ 奈波 +ナバ 名場 +ナバ 名葉 +ナバエ 難波江 +ナバキ 茸木 +ナバサマ 南波佐間 +ナハタ 名畑 +ナハタ 菜畑 +ナハタ 奈幡 +ナバタ 名畑 +ナバタ 菜畑 +ナバタ 奈幡 +ナバタ 名畠 +ナバタ 名幡 +ナバタケ 菜畑 +ナバタケ 菜畠 +ナバタニ 茸谷 +ナバタニ 名波谷 +ナハタメ 名畑目 +ナバタメ 生田目 +ナバタメ 生天目 +ナバタメ 青天目 +ナバタメ 生畑目 +ナバタメ 名畑目 +ナバタメ 天生目 +ナバタメ 天女目 +ナバタメ 那波多目 +ナハナ 菜花 +ナハナ 那花 +ナバナ 菜花 +ナバナ 那花 +ナバナ 茗花 +ナバヤ 名波谷 +ナバヤ 名波家 +ナハラ 名原 +ナハラ 菜原 +ナハラ 奈原 +ナバラ 南原 +ナバラ 名原 +ナバラ 奈原 +ナハリ 名張 +ナバリ 名張 +ナバリ 隠 +ナバル 南波留 +ナビカ 並河(竝河) +ナビカワ 奈比川 +ナビキ 名引 +ナビキ 菜引 +ナヒサ 名久 +ナヒラ 名平 +ナフジ 名藤 +ナブシ 名節 +ナブチ 名渕 +ナブチ 南渕 +ナブチ 名淵 +ナブチ 南淵 +ナフネ 名船(名舩) +ナベ 鍋 +ナベ 名部 +ナベ 奈部 +ナベ 那部 +ナベ 奈辺(奈邉) +ナベイ 鍋井 +ナベイ 辺井 +ナベイ 名部井 +ナベイケ 鍋池 +ナベイシ 鍋石 +ナベイワ 鍋岩 +ナベウチ 鍋内 +ナベウラ 鍋浦 +ナベオカ 鍋岡 +ナベカ 鍋加 +ナベカタ 鍋方 +ナベガタ 鍋潟 +ナベカマ 鍋釜 +ナベカワ 鍋川 +ナベカワ 辺川 +ナベカワ 奈部川 +ナベカワ 邊川 +ナベガワ 奈部川 +ナベカワハラ 鍋川原 +ナベガワラ 鍋川原 +ナベキ 鍋城 +ナベキ 辺木(邉木) +ナベキ 鍋木 +ナベク 鍋九 +ナベクボ 鍋久保 +ナベクラ 鍋倉 +ナベサカ 鍋坂 +ナベサキ 鍋崎 +ナベサコ 鍋迫 +ナベサワ 鍋沢 +ナベサワ 鍋澤 +ナベザワ 鍋沢 +ナベザワ 鍋澤 +ナベシ 鍋師 +ナベシタ 鍋下 +ナベシマ 鍋島 +ナベシマ 鍋嶋 +ナベシマ 鍋嶌 +ナベジマ 鍋島 +ナベシロ 鍋代 +ナベス 鍋洲 +ナベタ 鍋田 +ナベタ 辺田 +ナベタ 鍋多 +ナベタ 邉田 +ナベタ 名辺田 +ナベタニ 鍋谷 +ナベタニ 奈部谷 +ナベチ 鍋地 +ナベチョウ 鍋丁 +ナベトウ 鍋藤 +ナベトコ 鍋床 +ナベトコ 辺床 +ナベナカ 鍋中 +ナベナガ 鍋永 +ナベナシ 鍋梨 +ナベニシ 鍋西 +ナベノ 鍋野 +ナベハマ 鍋浜 +ナベハマ 鍋濱 +ナベハラ 鍋原 +ナベヒガシ 鍋東 +ナベヒラ 鍋平 +ナベヒロ 鍋広(鍋廣) +ナベムラ 鍋村 +ナベモト 鍋本 +ナベモト 鍋元 +ナベモト 辺本(邊本) +ナベモリ 鍋森 +ナベヤ 鍋谷 +ナベヤ 鍋屋 +ナベヤ 鍋矢 +ナベヤ 鍋家 +ナベヤマ 鍋山 +ナベヤマ 南辺山 +ナベヨシ 鍋吉 +ナベラ 鍋良 +ナベラ 那部良 +ナベラ 鍋羅 +ナベワリ 鍋割 +ナマ 名間 +ナマ 名真(名眞) +ナマイ 生井 +ナマイ 生居 +ナマイケ 生池 +ナマイサワ 生井沢 +ナマイサワ 生井澤 +ナマイザワ 生井沢 +ナマイザワ 生井澤 +ナマイザワ 生伊澤 +ナマイザワ 生居沢 +ナマイザワ 生居澤 +ナマイタ 生板 +ナマウオ 生魚 +ナマエ 生江 +ナマエザワ 生江沢 +ナマエダ 生枝 +ナマオ 生尾 +ナマカワ 生川 +ナマキ 生木 +ナマキダニ 生木谷 +ナマコ 海鼠 +ナマス 生巣 +ナマス 生須 +ナマズ 鯰 +ナマズイ 鯰井 +ナマズエ 鯰江 +ナマズガワ 鯰川 +ナマズゴシ 鯰越 +ナマズタ 鯰田 +ナマズタニ 鯰谷 +ナマズダニ 鯰谷 +ナマスヤ 鱠谷 +ナマセ 生瀬 +ナマタメ 生田目 +ナマタメ 生天目 +ナマタメ 生畑目 +ナマツ 生津 +ナマヅ 生津 +ナマハタメ 生畑目 +ナマリ 鉛 +ナマリ 生利 +ナマリキ 生力 +ナマリタニ 鉛谷 +ナマリヤマ 鉛山 +ナミ 波 +ナミ 並 +ナミ 浪 +ナミ 名美 +ナミアイ 波合 +ナミアイ 浪合 +ナミイ 浪井 +ナミイ 波井 +ナミイシ 浪石 +ナミイタ 浪板 +ナミイリ 波入 +ナミイワ 浪岩 +ナミウエ 浪上 +ナミウチ 浪内 +ナミウチ 浪打 +ナミウチ 波内 +ナミウチ 並内 +ナミウチ 波打 +ナミエ 浪江 +ナミエ 波江 +ナミエ 並江 +ナミエダ 波江田 +ナミエノ 波江野 +ナミオ 浪尾 +ナミオカ 浪岡 +ナミオカ 波岡 +ナミオカ 並岡 +ナミオカ 涛岡 +ナミオカ 濤岡 +ナミオト 波音 +ナミオリ 浪折 +ナミカイ 浪貝 +ナミガイ 浪貝 +ナミガイ 波貝 +ナミカゼ 波風 +ナミカゼ 浪風 +ナミカタ 行方 +ナミカタ 波形 +ナミカタ 波方 +ナミカタ 波潟 +ナミカタ 浪方 +ナミガタ 波形 +ナミガタ 波潟 +ナミガタ 浪形 +ナミガタ 浪潟 +ナミカド 波角 +ナミカネ 浪金 +ナミカワ 南川 +ナミカワ 並河(竝河) +ナミカワ 並川 +ナミカワ 浪川 +ナミカワ 波川 +ナミカワ 涛川 +ナミカワ 濤川 +ナミカワ 竝川 +ナミカワ 波河 +ナミガワラ 波瓦 +ナミキ 並木 +ナミキ 行木 +ナミキ 双木 +ナミキ 波木 +ナミキ 雙木 +ナミキ 浪木 +ナミキ 竝木 +ナミギシ 波岸 +ナミギシ 浪岸 +ナミキリ 波切 +ナミキリ 浪切 +ナミクイ 並杭 +ナミグチ 浪口 +ナミグチ 波口 +ナミコシ 浪越 +ナミコシ 波越 +ナミゴシ 波越 +ナミサ 波佐 +ナミサカ 浪坂 +ナミサキ 浪崎 +ナミサキ 波崎(波嵜) +ナミサキ 並崎 +ナミサキ 名見崎 +ナミザキ 浪崎 +ナミザキ 波崎(波嵜) +ナミザキ 涛崎 +ナミザキ 名見崎 +ナミザキ 浪嵜 +ナミザキ 濤崎 +ナミサシ 浪指 +ナミザシ 浪指 +ナミサト 並里 +ナミサト 波里 +ナミザト 並里 +ナミジ 波治 +ナミジ 浪治 +ナミジ 浪路 +ナミシオ 波汐 +ナミシタ 浪下 +ナミシマ 波島 +ナミシマ 浪島 +ナミシマ 波嶌 +ナミジマ 波島 +ナミスギ 浪杉 +ナミズミ 波済 +ナミセ 浪瀬 +ナミセ 波瀬 +ナミタ 波田 +ナミタ 並田 +ナミタ 浪田 +ナミタキ 浪瀧 +ナミタキ 浪滝 +ナミタケ 波竹 +ナミタニ 浪谷 +ナミタニ 並谷 +ナミチカ 浪近 +ナミツ 波津 +ナミツカ 波塚 +ナミヅカ 波塚 +ナミヅカ 浪塚 +ナミヅキ 波月 +ナミト 波戸 +ナミトコ 浪床 +ナミトコ 並床 +ナミトメ 波止 +ナミドメ 波止 +ナミドメ 波留 +ナミネ 波根 +ナミノ 南野 +ナミノ 波野 +ナミノ 浪野 +ナミノウエ 浪上 +ナミノウエ 波上 +ナミノエ 浪ノ江 +ナミノヒラ 波之平 +ナミノヒラ 波野平 +ナミハ 浪波 +ナミバ 並波 +ナミハナ 浪花 +ナミハラ 浪原 +ナミハラ 並原 +ナミハラ 波原 +ナミヒサ 浪久 +ナミヒラ 波平 +ナミヒラ 浪平 +ナミヒラ 並平 +ナミフサ 波房 +ナミベ 浪辺(浪邊) +ナミマ 波間 +ナミマ 浪間 +ナミマツ 並松 +ナミマツ 波松 +ナミマツ 浪松 +ナミムラ 波村 +ナミムラ 並村 +ナミモト 浪本 +ナミモト 波元 +ナミモト 浪元 +ナミモト 波本 +ナミモト 並本 +ナミヤ 南宮 +ナミヤ 奈宮 +ナミヤ 並家 +ナミヤ 波屋 +ナミヤマ 波山 +ナミヤマ 浪山 +ナミヤマ 並山 +ナミョウ 名明 +ナミヨケ 浪除 +ナミヨシ 波吉 +ナミヨシ 並吉 +ナミヨセ 浪寄 +ナミヨリ 波寄 +ナミラ 並羅 +ナミラ 並良 +ナミワ 浪波 +ナミワカ 波若 +ナミワキ 波脇 +ナミワケ 浪分 +ナム 南無 +ナム 名無 +ナムシ 菜虫 +ナムノ 南無納 +ナムラ 名村 +ナムラ 苗村 +ナムラ 南村 +ナムラ 納村 +ナムラ 奈村 +ナムラ 那村 +ナムロ 南室 +ナメイシ 滑石 +ナメウラ 滑浦 +ナメガイ 行貝 +ナメカタ 行方 +ナメカタ 滑方 +ナメカタ 行形 +ナメガタ 行方 +ナメガタ 滑方 +ナメガヤ 行谷 +ナメカワ 滑川 +ナメカワ 行川 +ナメカワ 長面川 +ナメカワ 名女川 +ナメガワ 滑川 +ナメガワ 行川 +ナメキ 行木 +ナメサワ 行沢 +ナメサワ 行澤 +ナメザワ 滑沢 +ナメザワ 行澤 +ナメシ 名飯 +ナメシダ 滑志田 +ナメタ 行田 +ナメタ 滑田 +ナメタ 洙田 +ナメタ 奈女田 +ナメダ 行田 +ナメダ 滑田 +ナメダ 洙田 +ナメタメ 生田目 +ナメハラ 滑原 +ナメマツ 名女松 +ナメラ 滑 +ナメラ 名免良 +ナメラ 奈目良 +ナメラ 滑羅 +ナメラ 滑良 +ナメラ 奈女良 +ナメラ 南免羅 +ナメラ 南面良 +ナメラ 名目良 +ナメラ 磆 +ナメラ 澾 +ナメライシ 滑石 +ナメラウジ 奈目良右治 +ナメリカワ 滑川 +ナメリサワ 滑沢 +ナメリサワ 滑澤 +ナメリザワ 滑澤 +ナメリタニ 滑谷 +ナモ 那謨 +ナモセ 南百瀬 +ナモチ 名持 +ナモト 名本 +ナモト 名元 +ナモリ 名守 +ナヤ 南谷 +ナヤ 納谷 +ナヤ 納 +ナヤ 納屋 +ナヤ 那谷 +ナヤ 納家 +ナヤ 名谷 +ナヤ 名屋 +ナヤ 納野 +ナヤ 名矢 +ナヤウチ 納屋内 +ナヤシキ 納屋敷 +ナヤマ 名山 +ナヤマ 奈山 +ナユキ 名雪 +ナユキ 名幸 +ナユキ 奈雪 +ナヨウ 名用 +ナラ 奈良 +ナラ 那良 +ナラ 南良 +ナラ 楢 +ナラ 名良 +ナライ 成相 +ナライ 奈良井 +ナライ 西風 +ナライ 楢井 +ナライ 那良伊 +ナライ 波来(波來) +ナライ 習 +ナライ 並井 +ナライダテ 西風館 +ナライダテ 西風舘 +ナラオ 奈羅尾 +ナラオ 奈良尾 +ナラオ 楢尾 +ナラオ 那羅尾 +ナラオカ 奈良岡 +ナラオカ 楢岡 +ナラガキ 奈良垣 +ナラカワ 奈良川 +ナラキ 楢木 +ナラキ 奈良木 +ナラキ 猶木 +ナラキ 棤木 +ナラキ 那良木 +ナラキノ 楢木野 +ナラギノ 楢木野 +ナラク 七楽 +ナラグチ 奈良口 +ナラコシ 奈良越 +ナラサカ 奈良坂 +ナラサキ 楢崎 +ナラサキ 奈良崎 +ナラサキ 奈良嵜 +ナラサキ 楢嵜 +ナラザキ 楢崎 +ナラザキ 奈良崎 +ナラザキ 奈良嵜 +ナラザキ 楢埼 +ナラザキ 楢嵜 +ナラサコ 奈良迫 +ナラサコ 楢迫 +ナラサコ 猶迫 +ナラサダ 奈良貞 +ナラサダ 奈良定 +ナラサワ 奈良沢 +ナラサワ 奈良澤 +ナラサワ 楢沢 +ナラシ 槩支 +ナラシ 鏟 +ナラシ 楢支 +ナラシバ 楢柴 +ナラシバ 奈良芝 +ナラシマ 楢島 +ナラシマ 奈良島 +ナラシマ 楢嶋 +ナラセ 奈良瀬 +ナラタ 奈良田 +ナラタ 楢田 +ナラダ 奈良田 +ナラダ 楢田 +ナラダテ 楢館 +ナラダテ 楢舘 +ナラダテ 栖舘 +ナラタニ 奈良谷 +ナラタニ 楢谷 +ナラヅ 𨩱津 +ナラト 楢戸 +ナラノ 奈良野 +ナラノ 猶野 +ナラノ 楢野 +ナラハ 楢葉 +ナラバ 奈良場 +ナラハシ 奈良橋 +ナラハシ 楢橋 +ナラハシ 名良橋 +ナラハシ 猶橋 +ナラハタ 楢畑 +ナラバヤシ 楢林 +ナラバヤシ 奈良林 +ナラハラ 楢原 +ナラハラ 奈良原 +ナラハラ 奈ラ原 +ナラハラ 南良原 +ナラビマツ 双松 +ナラヒラ 奈良平 +ナラフ 楢府 +ナラブ 奈良部 +ナラベ 奈良部 +ナラベ 楢部 +ナラマ 奈良間 +ナラマツ 楢松 +ナラマツ 雙松 +ナラミタテ 楢見舘 +ナラミダテ 楢見舘 +ナラミダテ 楢見館 +ナラムラ 楢村 +ナラムラ 奈良村 +ナラモト 楢本 +ナラモト 奈良本 +ナラモト 奈良元 +ナラモト 㮈本 +ナラヤ 奈良谷 +ナラヤ 奈良屋 +ナラヤ 楢屋 +ナラヤマ 楢山 +ナラヤマ 奈良山 +ナラワ 奈良輪 +ナラワ 楢和 +ナラワ 奈良和 +ナラワキ 奈良脇 +ナラワキ 猶良脇 +ナリ 成 +ナリアイ 成相 +ナリアイ 成合 +ナリアイ 業合 +ナリイ 成井 +ナリイエ 成家 +ナリイシ 成石 +ナリイワ 成岩 +ナリウ 成生 +ナリウチ 成内 +ナリウラ 成浦 +ナリエ 成江 +ナリエダ 成枝 +ナリオ 成尾 +ナリオカ 成岡 +ナリガサワ 成ケ沢 +ナリガサワ 成ケ澤 +ナリカタ 成方 +ナリカネ 成兼 +ナリカミ 成神 +ナリカミ 成上 +ナリカワ 成川 +ナリカワ 形川 +ナリカワ 成河 +ナリキ 成木 +ナリキ 成伯 +ナリキヨ 成清 +ナリキヨ 生清 +ナリクニ 成国 +ナリクニ 成國 +ナリクリ 成栗 +ナリケ 成毛 +ナリケ 成家 +ナリコ 成子 +ナリサカ 成阪 +ナリサキ 成崎 +ナリサコ 成迫 +ナリサダ 成定 +ナリサダ 成貞 +ナリサト 成里 +ナリサワ 成沢 +ナリサワ 成澤 +ナリザワ 成沢 +ナリザワ 成澤 +ナリシゲ 成重 +ナリシゲ 成繁 +ナリシゲ 成茂 +ナリシマ 成島 +ナリシマ 成嶋 +ナリスエ 成末 +ナリスミ 成住 +ナリズミ 成住 +ナリセ 成瀬 +ナリソコ 成底 +ナリゾコ 成底 +ナリタ 成田 +ナリタ 業田 +ナリタカ 成高 +ナリタケ 成竹 +ナリタニ 成谷 +ナリチ 成智 +ナリツカ 成塚 +ナリヅカ 成塚 +ナリツギ 成次 +ナリツネ 成恒 +ナリデ 成出 +ナリト 成戸 +ナリトウ 成東 +ナリトウ 成等 +ナリトク 成徳 +ナリトシ 成利 +ナリトミ 成富 +ナリトミ 成冨 +ナリドミ 成富 +ナリドミ 成冨 +ナリトモ 成友 +ナリトヨ 成豊 +ナリナカ 成中 +ナリナガ 成長 +ナリナガ 成永 +ナリノ 成野 +ナリノボウ 成之坊 +ナリハ 成羽 +ナリハタ 成畑 +ナリバヤシ 成林 +ナリハラ 成原 +ナリヒサ 成久 +ナリヒラ 成平 +ナリヒロ 成広 +ナリヒロ 成廣 +ナリフサ 成房 +ナリフジ 成藤 +ナリホ 成保 +ナリマサ 成政 +ナリマス 成増 +ナリマチ 幸待 +ナリマツ 成松 +ナリミズ 成水 +ナリミチ 成道 +ナリミツ 成光 +ナリミツ 成満 +ナリミヤ 成宮 +ナリミヤ 平宮 +ナリムネ 成宗 +ナリムラ 成村 +ナリモ 成毛 +ナリモト 成本 +ナリモト 成元 +ナリモリ 成守 +ナリヤ 成谷 +ナリヤ 成家 +ナリヤ 成矢 +ナリヤス 成安 +ナリヤマ 成山 +ナリュウ 成生 +ナリユキ 成行 +ナリヨシ 成吉 +ナリヨシ 成良 +ナリヨシ 成好 +ナル 成 +ナル 鳴 +ナル 奈留 +ナルイ 成井 +ナルイ 鳴井 +ナルイシ 成石 +ナルイシ 鳴石 +ナルイワ 鳴岩 +ナルウチ 成内 +ナルウミ 鳴海 +ナルエ 成江 +ナルエ 愛徳 +ナルエダ 成枝 +ナルオ 成尾 +ナルオ 鳴尾 +ナルオ 成生 +ナルオカ 成岡 +ナルオカ 鳴岡 +ナルカ 奈流芳 +ナルカ 鳴鹿 +ナルカゲ 成影 +ナルカマ 鳴釜 +ナルカミ 鳴神 +ナルカミ 成神 +ナルカミ 成上 +ナルカミ 鳴上 +ナルガミ 鳴神 +ナルガミ 成神 +ナルガミ 成上 +ナルカワ 成川 +ナルカワ 生川 +ナルカワ 鳴川 +ナルカワ 鳴河 +ナルカワ 成河 +ナルキ 成木 +ナルキ 生木 +ナルキ 鳴鬼 +ナルキ 成城 +ナルキ 鳴木 +ナルキヨ 成清 +ナルキヨ 生清 +ナルケ 成毛 +ナルケ 成家 +ナルケ 鳴毛 +ナルゲ 成毛 +ナルコ 成子 +ナルコ 鳴子 +ナルコ 鳴古 +ナルサカ 鳴坂 +ナルサキ 成崎 +ナルサコ 成迫 +ナルサワ 成沢 +ナルサワ 成澤 +ナルサワ 鳴沢 +ナルサワ 鳴澤 +ナルザワ 鳴澤 +ナルジ 成地 +ナルシゲ 成重 +ナルシゲ 鳴重 +ナルシマ 成島 +ナルシマ 鳴島 +ナルシマ 成嶋 +ナルシマ 鳴嶋 +ナルシマ 成嶌 +ナルシマ 鳴嶌 +ナルスエ 成末 +ナルスミ 成住 +ナルセ 成瀬 +ナルセ 成清 +ナルセ 鳴瀬 +ナルセ 成生 +ナルセ 成勢 +ナルセ 成世 +ナルセノ 鳴瀬乃 +ナルタ 成田 +ナルタ 鳴田 +ナルタカ 成高 +ナルタカ 鳴高 +ナルタキ 鳴滝 +ナルタキ 鳴瀧 +ナルタキ 成滝 +ナルタキ 成瀧 +ナルタケ 成竹 +ナルタニ 成谷 +ナルタニ 鳴谷 +ナルチ 成地 +ナルチ 成智 +ナルヂ 成地 +ナルト 鳴戸 +ナルト 成戸 +ナルト 鳴門 +ナルト 成登 +ナルトウ 成東 +ナルトキ 成時 +ナルトコ 鳴床 +ナルトミ 成富 +ナルトミ 成冨 +ナルトモ 成友 +ナルノ 成野 +ナルノ 鳴野 +ナルハシ 成橋 +ナルハシ 鳴橋 +ナルバヤシ 成林 +ナルヒサ 成久 +ナルヒラ 成平 +ナルヒロ 成広 +ナルホ 成保 +ナルマイ 成舞 +ナルマツ 鳴松 +ナルミ 鳴海 +ナルミ 成見 +ナルミ 成海 +ナルミ 成実 +ナルミ 成水 +ナルミ 鳴美 +ナルミ 成美 +ナルミ 鳴見 +ナルミ 成實 +ナルミ 生実 +ナルミ 生三 +ナルミ 生海 +ナルミ 成味 +ナルミ 生實 +ナルミチ 成道 +ナルミモト 成美本 +ナルミヤ 成宮 +ナルミヤ 鳴宮 +ナルムラ 鳴村 +ナルモ 成毛 +ナルモト 成本 +ナルモト 成元 +ナルモト 鳴本 +ナルモリ 成守 +ナルヤ 成矢 +ナルヤマ 成山 +ナルヤマ 鳴山 +ナルヨシ 成吉 +ナルヨシ 成良 +ナルヨシ 鳴好 +ナルワ 鳴輪 +ナルワ 成和 +ナルワ 成輪 +ナルワキ 鳴脇 +ナレシキ 馴敷 +ナレタ 馴田 +ナレマツ 馴松 +ナレヤマ 馴山 +ナロ 奈路 +ナロダ 奈路田 +ナワ 名和 +ナワ 名波 +ナワ 那波 +ナワ 縄 +ナワ 繩 +ナワ 那和 +ナワ 名輪 +ナワ 奈波 +ナワ 奈輪 +ナワイ 縄井 +ナワイ 繩井 +ナワエ 縄江 +ナワエ 繩江 +ナワオカ 縄岡 +ナワオカ 繩岡 +ナワカ 名若 +ナワカワ 縄川 +ナワガワ 名和川 +ナワキ 那脇 +ナワクラ 繩倉 +ナワクラ 縄倉 +ナワサキ 縄崎(縄嵜) +ナワサコ 縄迫 +ナワジ 縄司 +ナワシゲ 縄重 +ナワシゲ 繩重 +ナワシマ 繩島 +ナワシマ 縄島 +ナワシマ 繩嶋(縄嶋) +ナワシロ 苗代 +ナワシロザワ 苗代沢 +ナワシロバシ 苗代橋 +ナワシロハバ 苗代幅 +ナワセ 縄瀬 +ナワタ 縄田 +ナワタ 繩田 +ナワタ 名和田 +ナワダ 縄田 +ナワダ 名和田 +ナワタケ 縄竹 +ナワタケ 繩竹 +ナワタニ 縄谷 +ナワタニ 繩谷 +ナワタヤ 縄田屋 +ナワタヤ 繩田屋 +ナワチ 縄稚 +ナワチ 繩稚 +ナワテ 縄手 +ナワテ 畷 +ナワテ 繩手 +ナワテ 名和手 +ナワテ 索手 +ナワテ 奈和手 +ナワテ 那和手 +ナワテダニ 畷谷 +ナワナカ 縄中 +ナワノ 縄野 +ナワノ 繩野 +ナワノ 名和野 +ナワハラ 名和原 +ナワヒラ 縄平 +ナワフネ 縄船 +ナワフネ 縄舟 +ナワフネ 縄舩 +ナワマ 縄間 +ナワマキ 縄巻 +ナワマキ 縄卷 +ナワマキ 繩巻 +ナワムラ 縄村 +ナワムラ 繩村 +ナワモト 縄本 +ナワモト 繩本 +ナワヤ 縄谷 +ナワヤ 名和谷 +ナワヨシ 縄吉 +ナワラ 奈和良 +ナンイ 南居 +ナンイチ 南市 +ナンイン 南院 +ナンエ 南江 +ナンエン 南園 +ナンオ 南尾 +ナンオク 南奥 +ナンカ 南家 +ナンカ 南河 +ナンガ 南賀 +ナンカイ 南海 +ナンカイ 南開 +ナンガイ 南外 +ナンガキ 南柿 +ナンカク 南角 +ナンガク 南学(南學) +ナンガク 南岳 +ナンガクイン 南岳院 +ナンカワ 南川 +ナンカワ 南側 +ナンカン 南館 +ナンカン 南官 +ナンキ 南木 +ナンギ 南義 +ナンギ 南儀 +ナンギョ 南漁 +ナンキョウ 南京 +ナンギョウ 南業 +ナンキンザン 南金山 +ナングウ 南宮 +ナングウ 南隅 +ナングチ 南口 +ナンクモ 南雲 +ナングモ 南雲 +ナンケ 南家 +ナンケ 楠家 +ナンケ 難家 +ナンゲ 南家 +ナンコ 南湖 +ナンコ 南古 +ナンコ 南子 +ナンゴ 南後 +ナンゴ 南湖 +ナンコウ 南口 +ナンコウ 南光 +ナンコウ 南江 +ナンコウ 南向 +ナンコウ 南幸 +ナンコウ 南孝 +ナンゴウ 南郷 +ナンゴウ 永穂(永穗) +ナンゴウ 南合 +ナンコウイン 南光院 +ナンコウボウ 南光坊 +ナンゴウヤ 南郷谷 +ナンサ 南佐 +ナンサイ 南斉 +ナンサイ 南斎 +ナンサイ 南西 +ナンサイ 南齋 +ナンザイ 南斉 +ナンザイ 南斎 +ナンザイ 南齋 +ナンサカ 南坂 +ナンザカ 南坂 +ナンザキ 南崎 +ナンサコ 南迫 +ナンザワ 南沢 +ナンザワ 南澤 +ナンシ 南志 +ナンシ 南氏 +ナンジ 南路 +ナンジ 南治 +ナンジョ 南所 +ナンショウ 南庄 +ナンジョウ 南條 +ナンジョウ 南条 +ナンジョウ 南城 +ナンジョウ 南上 +ナンジョウ 楠城 +ナンジョウ 南生 +ナンジョウ 南篠 +ナンジョウ 南荘 +ナンシン 南新 +ナンスイ 南水 +ナンセ 南瀬 +ナンセ 南施 +ナンセイ 南星 +ナンセイ 南晴 +ナンセイ 南清 +ナンセキ 南石 +ナンセン 南泉 +ナンセン 南仙 +ナンソウ 南草 +ナンゾウ 南雑(南雜) +ナンダ 南田 +ナンダイ 南代 +ナンタク 南宅 +ナンダチ 南達 +ナンダテ 南立 +ナンタニ 南谷 +ナンチ 南地 +ナンデン 南殿 +ナント 南都 +ナント 南戸 +ナント 南戸 +ナンド 納戸 +ナントウ 南島 +ナントウ 南藤 +ナントウ 南東 +ナントウ 楠藤 +ナントウ 難藤 +ナントウ 南洞 +ナントウ 南任 +ナントウ 南涛 +ナントウ 南濤 +ナンドウ 南藤 +ナンドウ 楠藤 +ナンドウ 南堂 +ナンドウ 難藤 +ナンドウ 南洞 +ナンドウ 南道 +ナンニチ 南日 +ナンノ 南野 +ナンノ 南埜 +ナンバ 難波 +ナンバ 南波 +ナンバ 南場 +ナンバ 南端 +ナンバ 南葉 +ナンバ 灘波 +ナンバ 南馬 +ナンバ 南羽 +ナンバ 難場 +ナンバ 並波 +ナンバ 南塲 +ナンバ 難羽 +ナンバエ 難波江 +ナンバシ 南橋 +ナンバタ 難波田 +ナンバダ 難波田 +ナンバマ 南浜 +ナンバヤシ 南林 +ナンバラ 南原 +ナンバル 南原 +ナンピ 南日 +ナンブ 南部 +ナンブ 楠部 +ナンブ 南浮 +ナンブ 難部 +ナンブチ 南渕 +ナンブヤ 南部谷 +ナンベ 南部 +ナンベ 南辺(南邊) +ナンペイ 南平 +ナンボ 南保 +ナンポ 南保 +ナンボウ 南房 +ナンボウ 南坊 +ナンポウ 南方 +ナンポウ 南奉 +ナンポウ 南法 +ナンボク 南木 +ナンボク 南北 +ナンマ 南間 +ナンマ 南摩 +ナンマ 南磨 +ナンマツ 南松 +ナンミョウ 南明 +ナンメ 南目 +ナンメイ 南明 +ナンメン 南面 +ナンモ 南茂 +ナンモク 南木 +ナンモク 南目 +ナンモト 南本 +ナンモリ 南森 +ナンモリ 何盛 +ナンモン 南門 +ナンヤ 南谷 +ナンヤマ 南山 +ナンヨウ 南陽 +ナンヨシ 南吉 +ナンリ 南里 +ナンリ 南利 +ナンリ 南梨 +ナンリ 南理 +ナンリン 南林 +ナンリン 南隣 +ニアイ 新相 +ニイ 新 +ニイ 新井 +ニイ 新居 +ニイ 仁位 +ニイ 仁井 +ニイ 仁居 +ニイ 二位 +ニイ 二井 +ニイ 二居 +ニイアイ 新相 +ニイイ 新居 +ニイイズミ 新泉 +ニイイソ 新磯 +ニイウエ 新上 +ニイウエ 二井上 +ニイウチ 新内 +ニイウチ 仁井内 +ニイウチ 二井内 +ニイウメ 新梅 +ニイウラ 新浦 +ニイエ 仁井栄 +ニイエダ 新江田 +ニイエダ 新枝 +ニイオ 新尾 +ニイオカ 新岡 +ニイオカ 新阜 +ニイオカ 仁井岡 +ニイオカ 西岡 +ニイオカ 二井岡 +ニイオキ 新置 +ニイオダ 新小田 +ニイオリ 新居 +ニイオリ 新織 +ニイガイ 新貝 +ニイガキ 新垣 +ニイガキ 新恒 +ニイカゲ 新影 +ニイガタ 進士 +ニイガタ 新潟 +ニイガタ 新形 +ニイガタ 新方 +ニイガタ 新泻 +ニイガタヤ 新潟谷 +ニイカド 新門 +ニイガミ 新上 +ニイガミ 二井上 +ニイカワ 新井川 +ニイカワ 新居川 +ニイカワ 新川 +ニイカワ 二井川 +ニイカワ 二川 +ニイカワ 熱川 +ニイガワ 新井川 +ニイガワ 新川 +ニイキ 新亀 +ニイキ 新木 +ニイグチ 新口 +ニイグチ 西口 +ニイクニ 新国 +ニイクニ 新國 +ニイクマ 新熊 +ニイクマ 新隈 +ニイクラ 新鞍 +ニイクラ 新倉 +ニイクラ 新蔵 +ニイクラ 新藏 +ニイケ 仁池 +ニイケ 二井家 +ニイゴ 新後 +ニイサカ 新坂 +ニイザカ 新坂 +ニイザキ 新居崎 +ニイザキ 新崎 +ニイサク 新作 +ニイサト 新里 +ニイザト 新里 +ニイサワ 新沢 +ニイサワ 新澤 +ニイザワ 新沢 +ニイザワ 新澤 +ニイシ 新司 +ニイジ 新地 +ニイジ 尼寺 +ニイシゲ 新重 +ニイシマ 新島 +ニイジマ 新島 +ニイジマ 新嶋 +ニイジマ 新嶌 +ニイシロ 新城 +ニイズ 新津 +ニイズマ 新妻 +ニイズミ 新泉 +ニイズミ 仁泉 +ニイセキ 新関(新關) +ニイセキ 二井関 +ニイゼキ 新関(新關) +ニイゼキ 二位関 +ニイゼキ 二井関 +ニイソ 新磯 +ニイソエ 新添 +ニイゾエ 新添 +ニイゾノ 新園 +ニイゾノ 新薗 +ニイタ 新井田 +ニイタ 仁井田 +ニイタ 丹伊田 +ニイタ 瓊井田 +ニイダ 新井田 +ニイダ 新居田 +ニイダ 新田 +ニイダ 新飯田 +ニイダ 新夕(夕は漢字) +ニイダ 仁井田 +ニイダ 仁田 +ニイダ 丹伊田 +ニイダ 二井田 +ニイダ 瓊井田 +ニイタカ 新高 +ニイタケ 新竹 +ニイタケ 新武 +ニイダシ 荷出 +ニイタツ 新達 +ニイタテ 新舘 +ニイダテ 新舘 +ニイタニ 新谷 +ニイタニ 仁井谷 +ニイタニ 二井谷 +ニイダニ 新谷 +ニイタマ 煮玉 +ニイチ 新地 +ニイツ 新津 +ニイツ 仁居津 +ニイヅ 新津 +ニイヅカ 新塚 +ニイツマ 新妻 +ニイヅマ 新妻 +ニイツヤ 新津谷 +ニイデ 新出 +ニイデ 仁井出 +ニイデ 二井手 +ニイデタニ 新出谷 +ニイデラ 新寺 +ニイト 新戸 +ニイド 新戸 +ニイド 仁井戸 +ニイド 二井土 +ニイドイ 新土井 +ニイドイ 新土居 +ニイドノ 新殿 +ニイトミ 新富 +ニイトメ 新留 +ニイドメ 新留 +ニイトリ 新取 +ニイナ 新稲 +ニイナ 新那 +ニイナ 新納 +ニイナ 新名 +ニイナ 仁井名 +ニイナイ 新内 +ニイナイ 仁井内 +ニイナイ 二井内 +ニイナウチ 新名内 +ニイナエ 新苗 +ニイナカ 新中 +ニイナガ 新永 +ニイナガ 二位永 +ニイナダニ 新内谷 +ニイナミ 新浪 +ニイナヤ 新名谷 +ニイヌマ 新沼 +ニイネ 新根 +ニイノ 新井野 +ニイノ 新埜 +ニイノ 新納 +ニイノ 新濃 +ニイノ 新野 +ニイノ 仁井野 +ニイノ 二井野 +ニイノ 二居野 +ニイノイ 新ノ居 +ニイノウ 新納 +ニイノオ 新野尾 +ニイノブ 新居延 +ニイノベ 新延 +ニイノベ 新述 +ニイノベ 新野辺(新野邊・新野邉) +ニイノミ 新家 +ニイノミ 新海 +ニイノミ 新実 +ニイノミ 新呑 +ニイノミ 新野見 +ニイノミ 新實 +ニイバ 新井場 +ニイハシ 新橋 +ニイハタ 新畑 +ニイハマ 新浜 +ニイハマ 新濱 +ニイハマ 仁浜 +ニイバヤシ 新林 +ニイバヤシ 二井林 +ニイハラ 新原 +ニイハラ 仁井原 +ニイハラ 二井原 +ニイハラ 﨡原 +ニイバラ 新原 +ニイハリ 新治 +ニイバリ 新張 +ニイハル 新治 +ニイビエ 新比叡 +ニイヒラ 新平 +ニイヒロ 新広 +ニイヒロ 新尋 +ニイブ 新生 +ニイフジ 二井藤 +ニイブチ 新渕 +ニイベ 新部 +ニイベ 新辺 +ニイベ 仁井部 +ニイホ 新保 +ニイホ 新甫 +ニイホ 新穂 +ニイホ 新穗 +ニイホ 仁保 +ニイボ 新保 +ニイボ 新甫 +ニイボ 新穂 +ニイボ 新穗 +ニイホリ 新堀 +ニイボリ 新堀 +ニイマ 新間 +ニイマ 新今 +ニイマエ 新前 +ニイマツ 二位松 +ニイミ 新海 +ニイミ 新居見 +ニイミ 新見 +ニイミ 新実 +ニイミ 新美 +ニイミ 新實 +ニイミ 仁井見 +ニイミ 二井見 +ニイミヤ 新宮 +ニイムラ 新村 +ニイムラ 仁井村 +ニイムロ 新室 +ニイモト 新井本 +ニイモト 新元 +ニイモト 新本 +ニイモト 仁井元 +ニイモト 仁井本 +ニイモト 二井本 +ニイモリ 新森 +ニイモリ 新盛 +ニイヤ 新井谷 +ニイヤ 新屋 +ニイヤ 新家 +ニイヤ 新谷 +ニイヤ 新矢 +ニイヤ 仁居舎 +ニイヤ 二井屋 +ニイヤ 二井矢 +ニイヤシキ 新屋敷 +ニイヤス 新安 +ニイヤダ 二井屋田 +ニイヤマ 新井山 +ニイヤマ 新山 +ニイヤマ 仁井山 +ニイヤマ 二井山 +ニイラ 新楽(新樂) +ニイラ 新羅 +ニイラ 新良 +ニイリ 二杁 +ニイル 新納 +ニイロ 新色 +ニイロ 新納 +ニイロ 新呂 +ニイロ 新路 +ニイワ 新輪 +ニイワ 新和 +ニウ 仁宇 +ニウ 丹生 +ニウイシ 丹生石 +ニウエ 二上 +ニウカワ 丹生川 +ニウタ 丹生田 +ニウタニ 丹生谷 +ニウチ 仁内 +ニウメ 新梅 +ニウノヤ 丹生屋 +ニウノヤ 丹生谷 +ニウヤ 丹生谷 +ニウヤマ 丹生山 +ニウラ 新浦 +ニウラ 仁浦 +ニウラ 二浦 +ニウラオ 二浦尾 +ニエ 新江 +ニエ 二江 +ニエ 贄 +ニエカワ 牲川 +ニエカワ 贄川 +ニエカワ 熱川 +ニエカワ 川 +ニエガワ 牲川 +ニエガワ 贄川 +ニエガワ 熱川 +ニエダ 新江田 +ニエダ 新枝田 +ニエダ 仁戸田 +ニエダ 仁枝 +ニエダ 二枝 +ニエダ 熱田 +ニエダ 贄田 +ニエダ 贅田 +ニエダ 田 +ニエタニ 二重谷 +ニエダニ 二重谷 +ニオ 仁尾 +ニオ 丹生 +ニオ 丹尾 +ニオ 二尾 +ニオ 鳰 +ニオイ 香井 +ニオイ 如意 +ニオウ 仁王 +ニオウズ 仁王頭 +ニオウズ 二王頭 +ニオウドウ 二王堂 +ニオカ 新岡 +ニオカ 新阜 +ニオカ 二岡 +ニオカワ 鳰川 +ニオタニ 仁尾谷 +ニオノヤ 丹生谷 +ニオムラ 饒村 +ニオリ 新居 +ニカ 仁賀 +ニカ 二家 +ニカ 二鹿 +ニガ 仁賀 +ニカイ 仁賀井 +ニカイ 仁開 +ニカイ 仁階? +ニカイ 二改 +ニカイ 二階 +ニカイ 二貝 +ニガイ 仁賀井 +ニカイゾウ 二階蔵(二階藏) +ニカイタニ 二階谷 +ニカイド 二階戸 +ニカイドウ 仁階堂 +ニカイドウ 二階堂 +ニカイドウ 二楷堂 +ニガウリ 苦瓜 +ニカエ 二替 +ニガキ 苦木 +ニガキ 仁賀木 +ニガキ 仁垣 +ニガキ 仁柿 +ニガキ 二賀木 +ニガキ 二垣 +ニガキ 二柿 +ニカク 二角 +ニカケ 荷掛 +ニカケ 仁掛 +ニガザワ 丹賀沢 +ニガザワ 丹賀澤 +ニカタ 荷方 +ニカタ 二河田 +ニガタ 苦田 +ニガタ 仁賀田 +ニガタ 荷方 +ニガタケ 苦竹 +ニガタケ 苦嶽 +ニガタケ 仁ケ竹 +ニガタゴシ 仁方越 +ニガタニ 仁賀谷 +ニガツダ 二月田 +ニカド 二門 +ニカドリ 荷川取 +ニガナ 仁賀奈 +ニカホ 仁加保 +ニカマ 仁鎌 +ニカミ 仁上 +ニカミ 仁神 +ニカミ 丹上 +ニカミ 二上 +ニカミ 二神 +ニガミ 荷上 +ニガミ 仁紙 +ニガミ 仁上 +ニガミ 丹上 +ニガミ 二上 +ニカモト 二家本 +ニカヤ 二栢 +ニカヤ 二茅 +ニガヤ 二茅 +ニカラ 二唐 +ニガラ 二重 +ニガラ 二唐 +ニガルイ 荷軽井 +ニカルベ 荷軽部 +ニカワ 荷川 +ニカワ 仁川 +ニカワ 丹川 +ニカワ 二川 +ニガワ 仁川 +ニカワトリ 荷川取 +ニカワドリ 荷河取 +ニカワドリ 荷川取 +ニカワラ 二川原 +ニガワラ 二川原 +ニキ 新樹 +ニキ 新木 +ニキ 仁喜 +ニキ 仁木 +ニキ 仁規 +ニキ 丹生 +ニキ 二喜 +ニキ 二木 +ニキ 日木 +ニギ 仁儀 +ニギ 和 +ニギシ 仁岸 +ニギシ 二岸 +ニキシマ 仁木島 +ニキジマ 仁木島 +ニキダ 二木田 +ニギタ 饒田 +ニキモト 新木本 +ニキュウ 二久 +ニキョウ 二郷 +ニクシ 仁串 +ニクシ 二串 +ニグチ 荷口 +ニグチ 新口 +ニグチ 仁口 +ニグチ 二口 +ニクト 肉戸 +ニクド 肉戸 +ニクニ 二国 +ニクニ 二國 +ニクボ 仁久保 +ニクマ 仁熊 +ニクマ 二熊 +ニグマ 仁熊 +ニグマ 二熊 +ニクマル 仁久丸 +ニクマル 肉丸 +ニクヤマ 二久山 +ニクラ 新鞍 +ニクラ 新倉 +ニケ 二家 +ニゲメ 迯目 +ニケンタニ 二軒谷 +ニケンヤ 二軒谷 +ニコ 児子 +ニコ 仁子 +ニコ 兒子 +ニゴ 児子 +ニゴ 仁伍 +ニゴ 仁吾 +ニゴ 仁後 +ニゴ 仁子 +ニゴ 仁児 +ニゴ 二五 +ニゴ 兒子 +ニコイワ 二子岩 +ニコウ 二河 +ニゴウ 仁興 +ニゴウ 二郷 +ニコシ 二越 +ニゴシ 二越 +ニゴシマ 荷合島 +ニゴシマ 荷合嶋 +ニゴタ 二五田 +ニゴダワ 二五垰 +ニゴモト 二五元 +ニゴリ 水郡 +ニゴリイケ 濁池 +ニゴリカワ 濁川 +ニゴリカワ 渾川 +ニゴリサワ 濁沢 +ニゴリサワ 濁澤 +ニゴリザワ 濁澤 +ニゴリヌマ 濁沼 +ニゴロ 仁頃 +ニコン 仁近 +ニサ 仁佐 +ニサ 二佐 +ニサカ 荷坂 +ニサカ 荷阪 +ニサカ 仁坂 +ニサカ 丹坂 +ニサカ 丹阪 +ニサカ 二坂 +ニサカヤ 二坂谷 +ニザキ 仁崎 +ニザキ 二崎 +ニサジマ 二三島 +ニサセ 仁佐瀬 +ニサト 似里 +ニサト 仁里 +ニザミ 二三味 +ニサラギ 新佛 +ニサワ 二沢 +ニサワ 二澤 +ニザワ 仁沢 +ニザワ 仁澤 +ニザワ 二沢 +ニザワ 二澤 +ニサワセ 仁沢瀬 +ニサワタイ 二澤平 +ニサワタイラ 二澤平 +ニサワダイラ 二沢平 +ニサワダイラ 二澤平 +ニシ 仁司 +ニシ 仁士 +ニシ 仁志 +ニシ 仁紫 +ニシ 西 +ニシ 二司(ニ司) +ニシ 二四 +ニジ 二字 +ニジ 尼寺 +ニシアオキ 西青木 +ニシアキ 西秋 +ニシアキ 西明 +ニシアケ 西明 +ニシアシタニ 西芦谷 +ニシアゼ 西畔 +ニシアテ 西当 +ニシアテ 西當 +ニシアミ 西網 +ニシアラ 西新 +ニシアライ 西荒井 +ニシアライ 西新居 +ニシアラタ 西新田 +ニシアリ 西有 +ニシアリドメ 西有留 +ニシアン 西庵 +ニシイ 西位 +ニシイ 西井 +ニシイ 西居 +ニシイ 西飯 +ニシイウエ 西井上 +ニシイエ 西家 +ニシイガミ 西井上 +ニシイケ 西池 +ニシイシ 西石 +ニシイシガキ 西石垣 +ニシイズミ 西泉 +ニシイチ 西市 +ニシイツツジ 西五辻 +ニシイデ 西出 +ニシイド 西井戸 +ニシイノウエ 西井上 +ニシイリ 西入 +ニシイリノ 西入野 +ニシイワ 西岩 +ニシインキョ 西隠居 +ニシウ 西宇 +ニシウ 西生 +ニシウエ 西上 +ニシウエ 西植 +ニシウエトコ 西上床 +ニシウエハラ 西上原 +ニシウケ 西受 +ニシウジ 西宇治 +ニシウジ 西氏 +ニシウチ 西内 +ニシウネ 西宇根 +ニシウネ 西畝 +ニシウマ 西馬 +ニシウミ 西海 +ニシウメ 西梅 +ニシウラ 西浦 +ニシウラ 西占 +ニシウラ 西裏 +ニシウワトコ 西上床 +ニシエ 西栄 +ニシエ 西衛 +ニシエ 西江 +ニシエイ 西栄 +ニシエグチ 西江口 +ニシエゾノ 西江園 +ニシエダ 西枝 +ニシエノキダ 西榎田 +ニシオ 西生 +ニシオ 西尾 +ニシオ 西面 +ニシオ 西雄 +ニシオ 西應 +ニシオウ 西応 +ニシオウ 西應 +ニシオオイ 西大井 +ニシオオエダ 西大条 +ニシオオエダ 西大條 +ニシオオエダ 西大絛 +ニシオオジ 西大路 +ニシオオジョウ 西大条 +ニシオオジョウ 西大條 +ニシオオタチメ 西大立目 +ニシオオハマ 西大濱 +ニシオオマス 西大舛 +ニシオオマス 西大桝 +ニシオカ 西岡 +ニシオカ 西岳 +ニシオカ 西郊 +ニシオカ 西陸 +ニシオカ 二四岡 +ニシオカダ 西岡田 +ニシオカヤマ 西岡山 +ニシオキ 西沖 +ニシオキ 西置 +ニシオク 西奥(西奧) +ニシオクマ 西奥間 +ニシオケ 西桶 +ニシオチ 西落 +ニシオノ 西小野 +ニシオビノ 西帯野(西帶野) +ニシオフク 西尾福 +ニシオモテ 西表 +ニシオヤカワ 西親川 +ニシオリ 西織 +ニシオンジ 西陰地 +ニシオンジ 西隂地 +ニシカ 西加 +ニシカ 西家 +ニシガ 西賀 +ニシガ 西向 +ニシカイ 西海 +ニシカイ 西貝 +ニシガイ 西海 +ニシガイ 西貝 +ニシカイチ 西開地 +ニシガイチ 西ケ市 +ニシガイチ 西開地 +ニシガイチ 西垣内 +ニシガイツ 西垣津 +ニシガイト 西垣外 +ニシガイト 西垣戸 +ニシガイト 西垣内 +ニシカイドウ 西海道 +ニシガウチ 西河内 +ニシガウチ 西垣内 +ニシカギ 西鍵 +ニシガキ 西垣 +ニシガキ 西墻 +ニシガキ 西牆 +ニシカキウチ 西垣内 +ニシガキウチ 西垣内 +ニシカク 西角 +ニシカクチ 西角地 +ニシカゲ 西蔭 +ニシカゲ 西陰 +ニシカゲ 西影 +ニシガケ 西懸 +ニシカコイ 西栫 +ニシガサコ 西ケ迫 +ニシカジ 西梶 +ニシカジ 西鍛治(西鍜治) +ニシカジ 西鍛冶 +ニシカジク 西加治工 +ニシカゼ 西風 +ニシガセコ 西ケ迫 +ニシカタ 西潟 +ニシカタ 西形 +ニシカタ 西片 +ニシカタ 西方 +ニシガタ 西潟 +ニシガタ 西形 +ニシガタ 西方 +ニシカツ 西勝 +ニシカド 西角 +ニシカド 西門 +ニシカネ 西金 +ニシカネ 西兼 +ニシガネ 西金 +ニシカネモリ 西兼盛 +ニシガノ 西ケ野 +ニシガハナ 西ケ花 +ニシガハナ 西ケ塙 +ニシガハラ 西河原 +ニシガヒラキ 西ケ開 +ニシガビラキ 西ケ開 +ニシガヒロ 西ケ広(西ケ廣) +ニシカマ 西釜 +ニシガマ 西釜 +ニシカミ 西上 +ニシカミ 西神 +ニシガミ 西上 +ニシガミ 西神 +ニシガミネ 西ケ峰 +ニシガミネ 西ケ峯 +ニシカミハラ 西上原 +ニシカメ 西亀 +ニシガメ 西亀 +ニシガヤ 西ケ谷 +ニシガヤチ 西ケ谷内 +ニシカヤマ 西嘉山 +ニシカリヤ 西仮屋 +ニシカワ 仁志川 +ニシカワ 西河 +ニシカワ 西川 +ニシカワ 西側 +ニシガワ 西川 +ニシガワ 西側 +ニシカワウチ 西川内 +ニシカワジ 西川路 +ニシカワバタ 西川端 +ニシカワハラ 西川原 +ニシカワラ 西川原 +ニシガワラ 西川原 +ニシカンバラ 西上原 +ニシキ 柑子木 +ニシキ 錦 +ニシキ 錦木 +ニシキ 仁敷 +ニシキ 西機 +ニシキ 西亀 +ニシキ 西城 +ニシキ 西木 +ニシキ 西来(西來) +ニシキ 二色 +ニシキ 二敷 +ニシキイ 錦井 +ニシキイケ 錦池 +ニシキウチ 錦内 +ニシキオリ 錦織 +ニシキカワ 錦川 +ニシキガワ 錦川 +ニシキギ 錦木 +ニシキコウジ 錦小路 +ニシキコウリ 錦古里 +ニシキゴウリ 錦郡 +ニシキゴオリ 錦郡 +ニシキゴオリ 錦氷 +ニシキゴリ 錦古里 +ニシキザワ 錦沢 +ニシキザワ 錦澤 +ニシギシ 西岸 +ニシキジマ 錦島 +ニシキタ 西喜多 +ニシキタ 西北 +ニシキダ 錦田 +ニシキタニ 錦谷 +ニシキデ 錦出 +ニシキト 錦戸 +ニシキド 錦戸 +ニシキド 西城戸 +ニシキド 西木戸 +ニシキノ 錦野 +ニシキハマ 錦浜 +ニシキベ 錦部 +ニシキベ 錦辺(錦邉) +ニシキミ 錦見 +ニシキミ 錦美 +ニシキムラ 錦村 +ニシキモト 錦元 +ニシキモト 錦本 +ニシキヤ 錦谷 +ニシキヤマ 錦山 +ニシキリ 西桐 +ニシギリ 西桐 +ニシギワ 西極 +ニシギワ 西際 +ニシク 西工 +ニシクサ 西草 +ニシグチ 西口 +ニシクニ 西国 +ニシクニ 西國 +ニシクニハラ 西国原 +ニシクビ 西首 +ニシクボ 西久保 +ニシクボ 西窪 +ニシクマ 西熊 +ニシクマ 西隈 +ニシグマ 西熊 +ニシグマ 西隈 +ニシグミ 西組 +ニシクラ 西倉 +ニシクラ 西蔵 +ニシクラトウ 西蔵当(西蔵當) +ニシクラモリ 西蔵盛(西藏盛) +ニシクリ 西栗 +ニシグロ 西黒 +ニシグロ 西畔 +ニシケ 西家 +ニシゲ 二重 +ニシコ 西湖 +ニシコ 西子 +ニシゴ 西後 +ニシコウ 西河 +ニシコウ 西幸 +ニシコウジ 西小路 +ニシコウチ 西河内 +ニシゴウチ 西河内 +ニシゴウチ 西垣内 +ニシコウリ 錦織 +ニシコウリ 西郡 +ニシゴウリ 錦織 +ニシゴウリ 錦𦀗 +ニシゴウリ 西郷里 +ニシゴウリ 西郡 +ニシコオリ 錦織 +ニシコオリ 錦氷 +ニシコオリ 西郡 +ニシゴオリ 錦織 +ニシゴオリ 西郡 +ニシゴオリ 西氷 +ニシコクバル 西国原 +ニシコクバル 西國原 +ニシコクラ 西小倉 +ニシコクリョウ 西国領(西國領) +ニシコシ 西越 +ニシコシ 西腰 +ニシコジョウ 西小城 +ニシゴトウ 西神頭 +ニシコバ 西木場 +ニシコバラ 西小原 +ニシコベ 西小部 +ニシコミ 西込 +ニシゴミ 西込 +ニシコモリ 西小森 +ニシコヤ 西古家 +ニシゴヤ 西古屋 +ニシコリ 錦古里 +ニシコリ 錦織 +ニシゴリ 錦古里 +ニシゴリ 錦織 +ニシゴリ 錦𦀗 +ニシコレ 西是 +ニシザ 西座 +ニシザイケ 西在家 +ニシサカ 西坂 +ニシサカ 西阪 +ニシザカ 西坂 +ニシザカ 西阪 +ニシザカイ 西境 +ニシサキ 西崎 +ニシサキ 西先 +ニシサキ 西嵜 +ニシザキ 西咲 +ニシザキ 西崎 +ニシザキ 西碕 +ニシザキ 西嵜 +ニシザクラ 西桜 +ニシザクラ 西櫻 +ニシサコ 西佐古 +ニシサコ 西佐小 +ニシサコ 西迫 +ニシサコ 西硲 +ニシサコ 西畔 +ニシサコ 西浴 +ニシサコ 西峪 +ニシザコ 西迫 +ニシザコ 西峪 +ニシサト 西里 +ニシザト 西里 +ニシサワ 西澤 +ニシザワ 西沢 +ニシザワ 西澤 +ニシジ 西治 +ニシジ 西地 +ニシジ 西路 +ニシシゲ 西重 +ニシシタ 西下 +ニシシノ 西篠 +ニシシバ 西柴 +ニシシバ 西芝 +ニシシマ 西島 +ニシシマ 西嶋 +ニシジマ 西島 +ニシジマ 西嶋 +ニシジマ 西嶌 +ニシシマモト 西島本 +ニシシムラ 西志村 +ニシショウ 西庄 +ニシジョウ 西庄 +ニシジョウ 西条 +ニシジョウ 西門 +ニシジョウ 西條 +ニシシラホ 西白保 +ニシジリ 西尻 +ニシシロ 西代 +ニシジン 西陣 +ニシシンヤ 西新屋 +ニシス 西須 +ニシズ 西津 +ニシスエ 西末 +ニシズカ 西塚 +ニシスギ 西杉 +ニシスギヤマ 西杉山 +ニシスジ 西筋 +ニシスマ 西須摩 +ニシズミ 西角 +ニシズミ 西隅 +ニシズミ 西釈(西釋) +ニシズミ 西住 +ニシズメ 西詰 +ニシズル 西水流 +ニシズル 西鶴 +ニシスワ 西諏訪 +ニシセ 西瀬 +ニシセキ 西関 +ニシゼキ 西堰 +ニシゼキ 西関 +ニシセコ 西世古 +ニシセコ 西瀬古 +ニシセコ 西迫 +ニシゼコ 西世古 +ニシセト 西瀬戸 +ニシソ 西祖 +ニシソウズ 西寒水 +ニシゾエ 西添 +ニシソノ 西園 +ニシソノ 西薗 +ニシゾノ 西園 +ニシゾノ 西薗 +ニシゾノ 西囿 +ニシタ 仁下 +ニシタ 西多 +ニシタ 西田 +ニシタ 西夛 +ニシダ 仁志田 +ニシダ 西多 +ニシダ 西太 +ニシダ 西田 +ニシダ 西夛 +ニシタイ 西田井 +ニシタイ 西躰 +ニシダイ 西代 +ニシダイ 西台 +ニシダイ 西大 +ニシダイ 西田井 +ニシダイ 西臺 +ニシダイジョウ 西大条 +ニシダイラ 西平 +ニシタカ 西高 +ニシタカ 西鷹 +ニシタカツジ 西高辻 +ニシタキ 西滝 +ニシタキ 西瀧 +ニシタケ 西岳 +ニシタケ 西竹 +ニシタケ 西武 +ニシタケ 西嶽 +ニシダケ 西嶽 +ニシタシロ 西田代 +ニシタチ 西館 +ニシタチ 西立 +ニシタテ 西館 +ニシタテ 西舘 +ニシダテ 西館 +ニシダテ 西舘 +ニシタテノ 西立野 +ニシタナカ 西田中 +ニシタニ 西渓 +ニシタニ 西谷 +ニシタニ 西溪 +ニシダニ 西谷 +ニシタネ 西種 +ニシタネダ 西種子田 +ニシタハラ 西田原 +ニシタバル 西田原 +ニシタマ 西玉 +ニシタマエ 西玉栄(西玉榮) +ニシタマエ 西玉得 +ニシダマリ 西溜 +ニシタヤ 西田谷 +ニシタルミ 西垂水(西埀水) +ニシタルミズ 西垂水(西埀水) +ニシタワ 西田和 +ニシダン 西段 +ニシチ 西地 +ニシヂ 西地 +ニシチョウ 西丁 +ニシツ 西津 +ニシヅ 西津 +ニシツカ 西塚 +ニシヅカ 西塚 +ニシツグ 西胤 +ニジッケン 二十軒 +ニシツジ 西辻 +ニシツツミ 西堤 +ニシツツミ 西壅 +ニシヅツミ 西堤 +ニシヅツミ 西壅 +ニシツノイ 西角井 +ニシツボ 西坪 +ニシヅマ 西妻 +ニシヅミ 西積 +ニシヅメ 西詰 +ニシヅメ 西爪 +ニシツル 西鶴 +ニシヅル 西水流 +ニシヅル 西鶴 +ニシツルゾノ 西鶴園 +ニシテ 西手 +ニシデ 仁志出 +ニシデ 西手 +ニシデ 西出 +ニシテイ 西亭 +ニシデヤ 西出谷 +ニシテラ 西寺 +ニシデラ 西寺 +ニシト 西戸 +ニシト 西任 +ニシド 西戸 +ニシド 西土 +ニシドイ 西土井 +ニシドイ 西土居 +ニシトウ 西塔 +ニシトウ 西藤 +ニシトウ 西頭 +ニシトウ 西籐 +ニシトウ 西當 +ニシドウ 西堂 +ニシトウイン 西洞院 +ニシドウグチ 西道口 +ニシトウゲ 西峠 +ニシドウジ 西堂路 +ニシドウゾノ 西堂園 +ニシドコロ 西所 +ニシドノ 西殿 +ニシトバ 西鳥羽 +ニシドマリ 西泊 +ニシトミ 西臣 +ニシトミ 西富 +ニシトミ 西冨 +ニシドミ 西富 +ニジトミ 虹富 +ニシトメ 西留 +ニシドメ 西留 +ニシトモ 西知 +ニシトモ 西友 +ニシトヨ 西豊 +ニシトヨドメ 西豊留 +ニシトラ 西寅 +ニシトリ 西鳥 +ニシドリ 西鳥 +ニシナ 仁科 +ニシナ 仁品 +ニシナ 仁保 +ニシナ 西科 +ニシナ 西菜 +ニシナ 西奈 +ニシナ 西那 +ニシナ 西名 +ニシナ 西銘 +ニシナ 二科 +ニシナカ 西中 +ニシナカ 西仲 +ニシナカ 西半 +ニシナガ 西永 +ニシナガ 西長 +ニシナカガワ 西中川 +ニシナカス 西中須 +ニシナカゾノ 西中園 +ニシナカゾノ 西中薗 +ニシナカノ 西中野 +ニシナカノ 西仲野 +ニシナカマ 西中間 +ニシナカマ 西仲間 +ニシナカムラ 西中村 +ニシナカヤマ 西中山 +ニシナシ 西梨子 +ニシナダ 西灘 +ニシナベ 西鍋 +ニシナミ 西奈美 +ニシナミ 西波 +ニシナミ 西並 +ニシナミ 西浪 +ニシナリ 西成 +ニシナリ 西生 +ニシナリタ 西成田 +ニシニチョウ 西二町 +ニシヌマ 西沼 +ニシネ 西根 +ニシネジ 西稔 +ニシノ 西ノ +ニシノ 西乃 +ニシノ 西廼 +ニシノ 西埜 +ニシノ 西濃 +ニシノ 西納 +ニシノ 西野 +ニシノ 西迺 +ニシノアキ 西ノ明 +ニシノイリ 西ノ入 +ニシノイリ 西之入 +ニシノイリ 西野入 +ニシノウ 西納 +ニシノウエ 西ノ上 +ニシノウエ 西之上 +ニシノウエ 西埜植 +ニシノウエ 西野上 +ニシノウチ 西ノ内 +ニシノウチ 西之内 +ニシノウチ 西野内 +ニシノウラ 西ノ浦 +ニシノオ 西野尾 +ニシノカワ 西之川 +ニシノキ 西野木 +ニシノクビ 西ノ首 +ニシノコシ 西之腰 +ニシノシタ 西之下 +ニシノソノ 西ノ園 +ニシノソノ 西ノ薗 +ニシノソノ 西之園 +ニシノソノ 西之薗 +ニシノゾノ 西ノ園 +ニシノゾノ 西ノ薗 +ニシノゾノ 西之園 +ニシノゾノ 西之薗 +ニシノタニ 西之谷 +ニシノダン 西ノ段 +ニシノダン 西之段 +ニシノツジ 西之辻 +ニシノノ 西之野 +ニシノハナ 西野花 +ニシノハマ 西之浜(西之濱) +ニシノハラ 西ノ原 +ニシノハラ 西之原 +ニシノヒラ 西ノ平 +ニシノブ 西信 +ニシノボウ 西ノ坊 +ニシノボウ 西之坊 +ニシノマ 西野間 +ニシノマエ 西之前 +ニシノミヤ 西ノ宮 +ニシノミヤ 西宮 +ニシノミヤ 西之宮 +ニシノミヤ 西野宮 +ニシノムラ 西ノ村 +ニシノムラ 西之村 +ニシノメ 西野目 +ニシノモト 西ノ本 +ニシノヤ 西ノ谷 +ニシノヤ 西之谷 +ニシノヤ 西野谷 +ニシハ 西羽 +ニシバ 西場 +ニシハカマダ 西袴田 +ニシハギ 西萩 +ニシハシ 西橋 +ニシハシ 西端 +ニシバシ 西橋 +ニシハタ 西秦 +ニシハタ 西泰 +ニシハタ 西端 +ニシハタ 西幡 +ニシハタ 西畑 +ニシハタ 西畠 +ニシバタ 西端 +ニシバタ 西幡 +ニシバタ 西畑 +ニシバタ 西畠 +ニシバタケ 西畠 +ニシハチジョウ 西八条 +ニシハチジョウ 西八條 +ニシハテルマ 西波照間 +ニシハナ 西花 +ニシハナ 西端 +ニシハナ 西鼻 +ニシバネ 西塙 +ニシハネダ 西羽田 +ニシハバ 西幅 +ニシババ 西馬場 +ニシハマ 西浜 +ニシハマ 西濱 +ニシハマジョウ 西浜門 +ニシハヤ 西早 +ニシバヤシ 西林 +ニジバヤシ 虹林 +ニシハラ 西原 +ニシハラ 西腹 +ニシバラ 西原 +ニシハラグチ 西原口 +ニシハリ 西張 +ニシバリ 西開 +ニシバリ 西張 +ニシハル 西春 +ニシハン 西半 +ニシヒサマツ 西久松 +ニシヒラ 西平 +ニシヒラガ 西平賀 +ニシビラキ 西開 +ニシヒラタ 西平田 +ニシヒロ 西広 +ニシヒロ 西弘 +ニシヒロ 西廣 +ニシブ 西部 +ニシブエ 西笛 +ニシフカサワ 西深沢 +ニシフカサワ 西深澤 +ニシフク 西福 +ニシフクモト 西福元 +ニシブクロ 西袋 +ニシフサ 西房 +ニシフジ 西藤 +ニシブチ 西淵 +ニシブチ 西渕(西渊) +ニシフナグマ 西船隈 +ニシフル 西古 +ニシブン 西分 +ニシベ 西部 +ニシベ 西辺 +ニシベ 西邊 +ニシベットウ 西別当(西別當) +ニシベップ 西別府 +ニシベヤマ 西部山 +ニシベリ 西端 +ニシホ 西保 +ニシボ 西保 +ニシボウ 西坊 +ニシホカ 西外 +ニシホギ 西保木 +ニシボシ 西星 +ニシホテ 西保手 +ニシホラ 西洞 +ニシボラ 西洞 +ニシホリ 西堀 +ニシボリ 西掘 +ニシボリ 西堀 +ニシマ 仁島 +ニシマ 西間 +ニシマ 二島 +ニシマ 二嶋 +ニジマ 仁島 +ニシマイ 西米 +ニシマエ 西前 +ニシマエジョウ 西前門 +ニシマエダ 西前田 +ニシマエツ 西前津 +ニシマキ 西巻 +ニシマキ 西間木 +ニシマキ 西牧 +ニシマキ 西槙 +ニシマキ 西卷 +ニシマキ 西槇 +ニシマギ 西間木 +ニシマゴエ 西馬越 +ニシマサ 西政 +ニシマサ 西正 +ニシマス 西増 +ニシマタ 西股 +ニシマタ 西真田 +ニシマタ 西亦 +ニシマタ 西俣 +ニシマタ 西又 +ニシマタ 西眞田 +ニシマダ 西真田 +ニシマダ 西眞田 +ニシマチ 西町 +ニシマツ 西松 +ニシマニワ 西間庭 +ニシマル 西丸 +ニシマル 西圓 +ニシマワリ 西廻 +ニシマン 西万 +ニシマン 西萬 +ニシミ 錦見 +ニシミ 西見 +ニシミ 西美 +ニシミカド 西御門 +ニシミズ 西水 +ニシミゾ 西溝 +ニシミタテダ 西御建田 +ニシミタテダ 西御立田 +ニシミチ 西道 +ニシミツ 西光 +ニシミネ 西峰 +ニシミネ 西峯 +ニシミネ 西嶺 +ニシミヤ 西宮 +ニシミヤコ 西都 +ニシミョウ 西明 +ニシムカイ 西向 +ニシムカイ 西向井 +ニシムキ 西向 +ニシムクヒノ 西杢比野 +ニシムコ 西向 +ニシムタ 西牟田 +ニシムネ 西宗 +ニシムネ 西棟 +ニシムラ 西村 +ニシムラ 西邑 +ニシムラ 西邨 +ニシムレ 西牟礼 +ニシムレ 西牟禮 +ニシムロ 西室 +ニシムロタ 西室田 +ニシメ 西銘 +ニシメ 西目 +ニシメイ 西銘 +ニシモ 西茂 +ニシモクヒノ 西杢比野 +ニシモチダ 西持田 +ニシモト 西幹 +ニシモト 西元 +ニシモト 西本 +ニシモト 二標 +ニシモトヒダ 西本比田 +ニシモリ 西守 +ニシモリ 西森 +ニシモリ 西盛 +ニシモン 西門 +ニシモン 西紋 +ニシモングチ 西門口 +ニシモンゼン 西門前 +ニシャ 二斜 +ニシヤ 西屋 +ニシヤ 西家 +ニシヤ 西谷 +ニシヤ 西矢 +ニシヤウチ 西谷内 +ニシヤシキ 西屋敷 +ニシヤシキ 西屋舗 +ニシヤシキ 西屋鋪 +ニシヤス 西安 +ニシヤス 西保 +ニシャタニ 二社谷 +ニシヤチ 西谷地 +ニシヤチ 西谷内 +ニシヤナギ 西柳 +ニシヤブ 西薮 +ニシヤブ 西籔 +ニシヤブ 西藪 +ニシヤマ 西山 +ニシヤマ 螺山 +ニシヤマグチ 西山口 +ニシヤマダ 西山田 +ニシヤマモト 西山本 +ニシャヤ 二社谷 +ニシュウ 二宗 +ニジュウ 二重 +ニジュウダ 二十田 +ニジュウブ 二十歩 +ニジュウリ 二十里 +ニシユキ 西行 +ニシユキ 西雪 +ニジュッケン 二十軒 +ニジョウ 二上 +ニジョウ 二条 +ニジョウ 二條 +ニジョウ 仁城 +ニジョウイン 二条院 +ニジョウクボ 二条久保 +ニジョウクボ 二條久保 +ニショウジ 仁昌寺 +ニショウジ 仁正寺 +ニショウジ 二正寺 +ニシヨシ 西吉 +ニシヨシハラ 西吉原 +ニシヨツツジ 西四辻 +ニシヨネ 西米 +ニショミヤ 二所宮 +ニシヨリ 西依 +ニシヨリ 西寄 +ニシヨリ 西頼 +ニシヨリ 西倚 +ニシラ 西側 +ニシラ 西等 +ニシラ 西羅 +ニシラ 西良 +ニジラ 虹羅 +ニシライ 西来(西來) +ニシラク 西楽(西樂) +ニジリマツ 矮松 +ニシワカ 西若 +ニシワキ 西脇 +ニシワキ 西腋 +ニシワク 西涌 +ニシワク 西和久 +ニシワクガワ 西湧川 +ニシワケ 西分 +ニシワダ 西和田 +ニシワタリ 西渡 +ニシワリ 西割 +ニシンダイ 西代 +ニシントウ 西武当(西武當) +ニズ 二津 +ニスカ 仁須賀 +ニスギ 仁杉 +ニスギ 二杉 +ニスケ 仁介 +ニスケ 仁助 +ニスミ 二隅 +ニセ 二世 +ニセ 二瀬 +ニセキ 二関 +ニセン 仁専 +ニソ 二曽 +ニソ 二祖 +ニソイチ 二十一 +ニソウ 二宗 +ニソウギ 二艘木 +ニソウブネ 二艘舟 +ニゾエ 仁添 +ニソジ 二十二 +ニタ 荷田 +ニタ 似田 +ニタ 仁多 +ニタ 仁田 +ニタ 二田 +ニダ 荷田 +ニダ 仁田 +ニタイラ 仁平 +ニダイラ 仁平 +ニタオ 仁田尾 +ニタカ 荷高 +ニタカイ 似田貝 +ニタガイ 以田貝 +ニタガイ 似田貝 +ニタキ 二滝 +ニタキ 二瀧 +ニタグチ 二田口 +ニタクボ 荷田久保 +ニタクボ 仁田窪 +ニタサカ 仁田坂 +ニタザカ 仁田坂 +ニタシロ 似田代 +ニタダ 似田 +ニタダ 仁多田 +ニタダ 二多田 +ニタトウゲ 仁田峠 +ニタトリ 似鳥 +ニタドリ 似鳥 +ニタナイ 以内 +ニタナイ 似内 +ニタニ 新谷 +ニタニ 二谷 +ニタニ 仁谷 +ニタノ 仁田野 +ニタハタ 仁田畑 +ニタハラ 仁田原 +ニタハラ 二田原 +ニタバル 仁田原 +ニタバル 二田原 +ニタマ 煮玉 +ニダマ 煮玉 +ニタミ 新田見 +ニタミ 仁多見 +ニタミズ 仁田水 +ニタミズ 二田水 +ニタヤ 新田谷 +ニタヤマ 新田山 +ニタヤマ 仁田山 +ニタワキ 仁多脇 +ニタワキ 仁田脇 +ニタン 仁丹 +ニタン 二丹 +ニタン 二反 +ニダン 二段 +ニタンジ 二反地 +ニタンダ 二丹田 +ニタンダ 二反田 +ニタンチョウ 二反長 +ニタントウ 新田頭 +ニチ 仁地 +ニチガ 日我 +ニチグチ 日口 +ニチゲ 日下 +ニチサト 日里 +ニチドウ 日堂 +ニチハシ 日橋 +ニチハラ 日原 +ニチヤマ 日山 +ニチョウ 二町 +ニチョウギ 二挺木 +ニチョウギ 二梃木 +ニチョウダ 二丁田 +ニチロ 日露 +ニツ 二津 +ニツウ 二通 +ニッカ 日守 +ニツカ 二塚 +ニヅカ 荷塚 +ニヅカ 仁束 +ニヅカ 二塚 +ニッカク 日覚(日覺) +ニッカミ 日守 +ニッカワ 新川 +ニッキ 新木 +ニッキ 仁木 +ニッキ 日木 +ニツギ 二継 +ニックニ 新国 +ニックニ 新國 +ニックニ 仁国 +ニッケ 丹生附 +ニッケイ 日渓 +ニッケイシ 日下石 +ニッケシ 日下石 +ニッコウ 新幸 +ニッコウ 仁光 +ニッコウ 日光 +ニッサ 日佐 +ニッサカ 新坂 +ニッサカ 日坂 +ニッサカ 日阪 +ニッサト 新里 +ニッサト 日佐戸 +ニッサト 日里 +ニッシュ 日種 +ニッショ 西庄 +ニッショウ 西庄 +ニッショウ 西荘 +ニッショウ 日照 +ニッショウイン 日照院 +ニッタ 新タ(タはカタカナ) +ニッタ 新多 +ニッタ 新田 +ニッタ 新夕(夕は漢字) +ニッタ 仁田 +ニッタ 刃田(刄田) +ニッタ 二田 +ニッタ 日多 +ニッタ 日田 +ニッタガワ 新田川 +ニッタチ 新立 +ニッタニ 新谷 +ニッタマチ 新田町 +ニッタミ 新田見 +ニッタヤ 新田谷 +ニッチュウ 日中 +ニッテ 仁手 +ニット 日戸 +ニット 日登 +ニットウ 日塔 +ニットウ 日東 +ニットウ 日当 +ニットウ 日當 +ニットウジ 日東寺 +ニットクジ 日徳寺 +ニットノ 入戸野 +ニッパ 新葉 +ニッパシ 新橋 +ニッパシ 日橋 +ニッポン 日本 +ニデガワ 二出川 +ニト 仁戸 +ニト 二戸 +ニトイ 二問 +ニトウ 仁藤 +ニトウ 仁籐 +ニトウ 丹藤 +ニトウ 二藤 +ニトウ 二籐 +ニドウ 仁道 +ニドウ 二堂 +ニドウ 二道 +ニトウベ 二藤部 +ニトグリ 任都栗 +ニドコロ 荷所 +ニトサ 仁藤佐 +ニトダ 仁戸田 +ニドノ 二殿 +ニトベ 新戸部 +ニトベ 新渡戸 +ニトベ 仁戸部 +ニトベ 二戸部 +ニトベ 二藤部 +ニトマキ 二斗蒔 +ニトマキダ 二斗蒔田 +ニトリ 似鳥 +ニナオ 蜷尾 +ニナガ 二永 +ニナカワ 蜷川 +ニナガワ 蜷川 +ニナキ 蜷木 +ニナギ 蜷木 +ニナツ 蜷津 +ニナヤ 蜷谷 +ニネン 仁念 +ニノ 仁野 +ニノ 二野 +ニノイ 二ノ井 +ニノイ 二野井 +ニノウ 新納 +ニノウチ 仁ノ内 +ニノオカ 仁ノ岡 +ニノカタ 二ノ形 +ニノカタ 二ノ方 +ニノカタ 二之形 +ニノカタ 二之方 +ニノカタ 二方 +ニノカタ 弐方 +ニノカタ 貳方 +ニノカタ 貮方 +ニノガタ 二ノ形 +ニノカミ 二ノ上 +ニノカミ 二ノ神 +ニノカミ 二野上 +ニノカワ 二野川 +ニノキ 仁ノ木 +ニノクチ 二ノ口 +ニノクボ 二ノ久保 +ニノクラ 二ノ倉 +ニノサカ 二ノ坂 +ニノシタ 二ノ下 +ニノシタ 二野下 +ニノシロ 二ノ城 +ニノセ 二ノ瀬 +ニノセ 二の瀬 +ニノセ 二瀬 +ニノセ 二之瀬 +ニノセ 二野瀬 +ニノセキ 二ノ関 +ニノセキ 二関 +ニノタ 二ノ田 +ニノダ 二ノ田 +ニノタニ 二ノ谷 +ニノダン 二之段 +ニノト 二ノ戸 +ニノト 二野戸 +ニノハラ 二ノ原 +ニノヒラ 仁ノ平 +ニノヒラ 仁野平 +ニノブ 仁信 +ニノフミ 二ノ文 +ニノベ 二之部 +ニノヘイ 二野瓶 +ニノヘイ 二野塀 +ニノヘイ 二野屏 +ニノマル 二ノ丸 +ニノマル 二の丸 +ニノマル 二丸 +ニノミネ 二ノ峰 +ニノミネ 二峰 +ニノミヤ 荷宮 +ニノミヤ 仁宮 +ニノミヤ 二ノ宮 +ニノミヤ 二の宮 +ニノミヤ 二ノ美屋 +ニノミヤ 二宮 +ニノミヤ 二之宮 +ニノミヤ 二野宮 +ニノミヤ 弐宮 +ニノムラ 仁野村 +ニノムラ 二ノ村 +ニノモト 二ノ本 +ニノヤ 忍谷 +ニノユ 二之湯 +ニノユウ 二之夕 +ニハシ 二橋 +ニハタ 二畠 +ニハチ 仁八 +ニハマ 仁浜 +ニハマ 仁濱 +ニバヤシ 仁林 +ニハラ 仁原 +ニハラ 丹原 +ニハラ 二原 +ニハリ 仁張 +ニハリ 二張 +ニバリ 仁張 +ニハンダ 二飯田 +ニヒ 仁比 +ニヒャクジ 二百寺 +ニヒャクダ 二百田 +ニヒャクメン 弐百免 +ニヒャクメン 貮百免(貳百免) +ニヒラ 荷平 +ニヒラ 仁衡 +ニヒラ 仁平 +ニヒラ 二平 +ニヒライ 仁平井 +ニフ 丹生 +ニブ 仁部 +ニブ 丹生 +ニブ 二武 +ニブ 二部 +ニブ 二歩 +ニブ 任補 +ニフク 荷福 +ニフジ 二藤 +ニブタ 丹生田 +ニブタニ 丹生谷 +ニフネ 仁船 +ニブノ 仁豊野 +ニブノ 二部野 +ニブノ 二分野 +ニブヤ 新武屋 +ニブヤ 仁部屋 +ニブヤ 丹生屋 +ニブヤ 丹生谷 +ニブン 仁分 +ニブン 二分 +ニベ 新部 +ニベ 仁瓶 +ニベ 仁部 +ニベ 仁辺 +ニベ 丹部 +ニベ 丹辺(丹邉) +ニベ 丹邊 +ニベ 二瓶 +ニベ 二部 +ニヘイ 仁瓶 +ニヘイ 仁平 +ニヘイ 二弊? +ニヘイ 二瓶 +ニヘイ 二平 +ニヘイタ 二平太 +ニベヤ 仁部屋 +ニホ 仁保 +ニホ 丹保 +ニホ 二保 +ニホ 鳰 +ニボ 仁保 +ニホウ 二宝 +ニホウダ 二法田 +ニホカワ 鳰川 +ニホシ 二星 +ニボシ 二星 +ニホジマ 仁保島 +ニホリ 新堀 +ニホン 日本 +ニホンガキ 二本垣 +ニホンガキ 二本柿 +ニホンギ 二本樹 +ニホンギ 二本木 +ニホンギ 日本木 +ニホンスギ 二本杉 +ニホンバシ 二本橋 +ニホンマツ 二本松 +ニホンマツ 日本松 +ニホンモリ 二本森 +ニホンヤナギ 二本柳 +ニホンヤナギ 日本柳 +ニマ 爾摩 +ニマ 二摩 +ニマ 二万 +ニマイダ 二枚田 +ニマイダ 弐枚田 +ニマイダ 貮枚田 +ニマイハタ 二牧畑 +ニマイハタ 二枚畑 +ニマタ 二俣 +ニマタ 二又 +ニミネ 二峯 +ニミヤ 荷宮 +ニミヤ 仁宮 +ニミヤ 二宮 +ニムラ 荷村 +ニムラ 仁村 +ニムラ 仁邨 +ニムラ 丹村 +ニムラ 二村 +ニムラ 二邨 +ニムレ 二牟礼 +ニムレ 二牟禮 +ニモタ 仁茂田 +ニモダ 仁茂田 +ニモダ 二百田 +ニモト 仁本 +ニモト 二本 +ニモト 貮百免(貳百免) +ニモリ 二森 +ニモン 二門 +ニモンジ 二文字 +ニモンジヤ 二文字屋 +ニヤ 荷屋 +ニヤ 仁矢 +ニヤガワ 二矢川 +ニャクオウジ 若王子 +ニヤジマ 二谷島 +ニヤタ 新谷田 +ニヤダ 二矢田 +ニヤナギ 二柳 +ニヤマ 仁山 +ニヤマ 丹山 +ニヤマ 二山 +ニュウ 丹生 +ニュウ 鳰 +ニュウイ 乳井 +ニュウイシ 丹生石 +ニュウカ 入夏 +ニュウカイ 入海 +ニュウガク 入学 +ニュウガク 入學 +ニュウカワ 入川 +ニュウコウ 入交 +ニュウジ 入路 +ニュウゼン 入膳 +ニュウタ 丹生田 +ニュウタ 入田 +ニュウダ 丹生田 +ニュウダ 入田 +ニュウヅキ 入月 +ニュウドウ 入道 +ニュウドウヤマ 入道山 +ニュウノ 入野 +ニュウノヤ 丹生屋 +ニュウノヤ 丹生谷 +ニュウバ 入羽 +ニュウバ 入場 +ニュウバ 入葉 +ニュウハラ 鳰原 +ニュウバラ 鳰原 +ニュウブ 入部 +ニュウムラ 入村 +ニュウヤ 丹生谷 +ニュウヤ 入屋 +ニュウヤ 入谷 +ニュウリョウ 入料 +ニュウワ 生和 +ニユキ 煮雪 +ニョイ 如意 +ニョウジ 女寺 +ニョウムラ 饒村 +ニョサカ 如阪 +ニヨシ 二善 +ニョタ 如田 +ニョホウジ 如法寺 +ニヨムラ 饒村 +ニラ 新羅 +ニラ 新良 +ニラエ 韮江 +ニラサキ 韮崎 +ニラザキ 韮崎 +ニラサワ 韮沢 +ニラサワ 韮澤 +ニラサワ 薤沢(薤澤) +ニラザワ 韮沢 +ニラザワ 韮澤 +ニラズカ 韮塚 +ニラタニ 韮谷 +ニラツカ 韮塚 +ニラヅカ 韮塚 +ニラノ 韮野 +ニラハラ 韮原 +ニラモト 丹良本 +ニラヤマ 仁羅山 +ニラヤマ 韮山 +ニリ 仁里 +ニリ 二里 +ニリキ 二里木 +ニレ 仁礼 +ニレ 仁禮 +ニレ 二礼 +ニレ 楡 +ニレイ 仁令 +ニレイ 仁礼 +ニレイ 仁禮 +ニレイ 楡井 +ニレイ 楡居 +ニレカネ 楡金 +ニレガネ 楡金 +ニレキ 仁礼木 +ニレキ 二礼木 +ニレキ 二連木 +ニレキ 二禮木 +ニレキ 楡木 +ニレギ 楡木 +ニレタ 楡田 +ニレダ 楡田 +ニレハラ 楡原 +ニレモト 楡本 +ニレン 仁連 +ニレンギ 二連木 +ニロ 丹路 +ニロク 二六 +ニワ 荷輪 +ニワ 爾波 +ニワ 上神 +ニワ 新羽 +ニワ 新輪 +ニワ 仁羽 +ニワ 仁波 +ニワ 仁和 +ニワ 丹羽 +ニワ 丹波 +ニワ 丹輪 +ニワ 丹和 +ニワ 庭 +ニワ 二羽 +ニワ 二輪 +ニワイ 庭井 +ニワイケ 庭池 +ニワオ 庭尾 +ニワカワ 庭川 +ニワキ 庭木 +ニワグチ 丹羽口 +ニワクボ 庭久保 +ニワサキ 庭崎 +ニワザキ 庭崎 +ニワシロ 庭代 +ニワシン 庭新 +ニワセ 丹羽瀬 +ニワセ 庭瀬 +ニワタ 仁和田 +ニワタ 庭田 +ニワタ 庭和田 +ニワタ 二和田 +ニワダ 庭田 +ニワダ 庭和田 +ニワダ 二和田 +ニワタニ 上神谷 +ニワタニ 丹波谷 +ニワタニ 庭谷 +ニワタリ 二渡 +ニワツキ 庭月 +ニワツキノ 庭月野 +ニワデラ 仁和寺 +ニワトコ 庭植 +ニワトリジマ 庭鳥島 +ニワトリジマ 庭鳥嶋 +ニワノ 丹羽野 +ニワノ 庭野 +ニワバヤシ 庭林 +ニワフミ 庭文 +ニワマエ 庭前 +ニワムラ 庭村 +ニワモト 庭本 +ニワヤ 庭屋 +ニワヤマ 仁和山 +ニワヤマ 庭山 +ニン 任 +ニンギョウジ 人形寺 +ニンシ 新司 +ニンジョウ 仁城 +ニンショウジ 仁昌寺 +ニンジョウジ 仁城寺 +ニンジョウジ 仁成寺 +ニンジョウジ 忍頂寺 +ニンゼキ 忍関 +ニンタ 任田 +ニンダ 任田 +ニンチ 仁地 +ニンチョウ 人長 +ニンチョウジ 忍頂寺 +ニンデ 忍出 +ニンノ 人野 +ニンノ 仁野 +ニンバリ 仁張 +ニンブ 仁歩 +ニンベ 仁部 +ニンラ 人羅 +ヌイ 縫 +ヌイ 奴井 +ヌイカワ 縫川 +ヌイザト 貫里 +ヌイジマ 縫島 +ヌイジマ 縫嶋 +ヌイタ 縫田 +ヌイダ 縫田 +ヌイタニ 縫谷 +ヌイドノ 縫殿 +ヌイナ 奴井名 +ヌイハラ 縫原 +ヌイバリ 縫針 +ヌイベ 縫部 +ヌイムラ 縫村 +ヌイヤ 縫谷 +ヌイヤマ 縫山 +ヌウノ 縫野 +ヌエノ 鵺野 +ヌエン 野園 +ヌカ 奴賀 +ヌカ 怒賀 +ヌカ 額 +ヌカ 糠 +ヌガ 奴賀 +ヌガ 怒賀 +ヌカガ 額賀 +ヌカガ 糠賀 +ヌカガ 糠加 +ヌカガリ 額狩 +ヌカガワ 額川 +ヌカガワ 糠川 +ヌカサカ 糠坂 +ヌカザワ 糠沢 +ヌカザワ 糠澤 +ヌカタ 額田 +ヌカダ 額田 +ヌカダ 糠田 +ヌカダ 糖田 +ヌガタ 額田 +ヌカタニ 糠谷 +ヌカタニ 額谷 +ヌカツカ 糠塚 +ヌカヅカ 糠塚 +ヌカヅカ 糖塚 +ヌカノ 糖野 +ヌカノ +ヌカノブ 保延 +ヌカノブ 糠信 +ヌカノブ 糖信 +ヌカミ 額見 +ヌカミ 糠見 +ヌカミヤ 額宮 +ヌカムラ 額村 +ヌカムラ 糠村 +ヌカモト 糠本 +ヌカモリ 糠森 +ヌカモリ 糠盛 +ヌカヤ 糠谷 +ヌカヤ 額谷 +ヌカヤ 糠屋 +ヌカヤ 糖谷 +ヌカヤマ 糠山 +ヌカリ 泥濘 +ヌカリ 沼濘 +ヌカリヤ 忽滑谷 +ヌカリヤ 怱滑谷 +ヌキ 貫 +ヌキ 秡 +ヌキイ 貫井 +ヌキイ 抜井 +ヌキイ 抜居 +ヌキイ 拔井 +ヌキウシ 貫牛 +ヌキエ 貫江 +ヌキオ 貫尾 +ヌキギ 抜木 +ヌキグチ 抜口 +ヌキザキ 抜崎 +ヌキサコ 抜迫 +ヌキサコ 拔迫 +ヌキザコ 抜迫 +ヌキサト 貫里 +ヌキザワ 貫沢 +ヌキシオ 貫塩 +ヌキゾノ 貫薗 +ヌキゾノ 貫園 +ヌキタ 貫田 +ヌキタ 抜田 +ヌキタ 拔田 +ヌキタニ 抜谷 +ヌキト 貫戸 +ヌキナ 貫名 +ヌキナ 貫奈 +ヌキナ 抽那 +ヌキナ 秡銘(抜銘) +ヌキナガ 貫永 +ヌキノ 貫野 +ヌキバ 貫場 +ヌキハラ 貫原 +ヌキマ 貫間 +ヌキマ 秡間 +ヌキミズ 抜水 +ヌキモト 抜元 +ヌキヤ 抜屋 +ヌキヤマ 貫山 +ヌキヤマ 抜山 +ヌキヤマ 拔山 +ヌキヨ 貫与(貫與) +ヌキワ 貫和 +ヌキワ 貫輪 +ヌクイ 貫井 +ヌクイ 温井 +ヌクイ 抜井 +ヌクイ 明日 +ヌクイ 抽井 +ヌクイ 暖井 +ヌクイ 拔井 +ヌグイシ 拭石 +ヌクシナ 温品 +ヌクダ 温田 +ヌクタニ 温谷 +ヌクタニ 炎谷 +ヌクダニ 温谷 +ヌクヅマ 奴久妻 +ヌグツマ 奴久妻 +ヌクト 貫渡 +ヌクトウ 抽冬 +ヌクトウ 拙冬 +ヌクヒ 明日 +ヌクビ 貫尾 +ヌクミ 温水 +ヌクミ 生見 +ヌクミ 温 +ヌクミ 貫見 +ヌクミ 温見 +ヌクミズ 温水 +ヌクミズ 抜水 +ヌクモリ 温盛 +ヌクモリ 温森 +ヌクユ 温湯 +ヌサ 幣(弊) +ヌサダ 幣田 +ヌサモリ 幣守 +ヌシ 塗師 +ヌシイ 主井 +ヌシイ 塗師井 +ヌシエダ 主枝 +ヌシオカ 塗師岡 +ヌシキ 塗師木 +ヌシジマ 主島 +ヌシダ 主田 +ヌシダ 塗師田 +ヌシタニ 塗師谷 +ヌシハラ 主原 +ヌシマ 沼島 +ヌシミカド 主御門 +ヌシムラ 塗師村 +ヌシモ 塗茂 +ヌシモト 塗師本 +ヌシヤ 塗師谷 +ヌシヤマ 主山 +ヌシロ 主代 +ヌタ 奴田 +ヌタ 怒田 +ヌダ 奴田 +ヌタザワ 縵沢 +ヌタシタ 沼田下 +ヌタバ 蒐場 +ヌタハラ 奴田原 +ヌテジマ 橳島 +ヌテジマ 橳嶋(橳嶌) +ヌデシマ 橳島 +ヌデシマ 橳嶋(橳嶌) +ヌデジマ 橳島 +ヌデジマ 橳嶋(橳嶌) +ヌナミ 沼波 +ヌノ 布野 +ヌノ 布 +ヌノ 奴野 +ヌノイ 布井 +ヌノイ 布居 +ヌノイチ 布市 +ヌノイチ 布一 +ヌノウエ 布上 +ヌノウチ 布内 +ヌノウラ 布浦 +ヌノエ 布江 +ヌノエ 布栄 +ヌノオ 布尾 +ヌノガキ 布垣 +ヌノカセ 布綛 +ヌノカタ 布方 +ヌノガネ 布金 +ヌノカミ 布上 +ヌノガミ 布上 +ヌノカワ 布川 +ヌノガワ 布川 +ヌノキ 布木 +ヌノクボ 布久保 +ヌノコ 布子 +ヌノサキ 布崎 +ヌノザキ 布崎 +ヌノサク 布作 +ヌノザワ 布沢 +ヌノザワ 布澤 +ヌノシゲ 布重 +ヌノシタ 布下 +ヌノシバ 布柴 +ヌノシマ 布島 +ヌノジリ 布尻 +ヌノズミ 布住 +ヌノセ 布瀬 +ヌノタ 布田 +ヌノダ 布田 +ヌノタキ 布滝 +ヌノタニ 布谷 +ヌノダニ 布谷 +ヌノツカ 布塚 +ヌノヅカ 布塚 +ヌノツジ 布辻 +ヌノデ 布出 +ヌノドメ 布留 +ヌノノ 布野 +ヌノハシ 布橋 +ヌノハタ 布旗 +ヌノハラ 布原 +ヌノビキ 布引 +ヌノヒラ 布平 +ヌノヒロ 布広 +ヌノヒロ 布廣 +ヌノベ 布部 +ヌノマキ 布巻 +ヌノマタ 布俣 +ヌノミ 布見 +ヌノミヤ 布宮 +ヌノムラ 布村 +ヌノメ 布目 +ヌノモト 布元 +ヌノモト 布本 +ヌノヤ 布谷 +ヌノヤ 布矢 +ヌノヤ 布屋 +ヌノヤマ 布山 +ヌハ 饒波 +ヌハク 奴白 +ヌマ 沼 +ヌマ 沼間 +ヌマ 奴間 +ヌマ 湫 +ヌマイ 沼井 +ヌマイ 沼居 +ヌマイケ 沼池 +ヌマウエ 沼上 +ヌマウチ 沼内 +ヌマウラ 沼浦 +ヌマエ 沼江 +ヌマオ 沼尾 +ヌマオイ 沼生 +ヌマオカ 沼岡 +ヌマガ 沼賀 +ヌマガキ 沼垣 +ヌマガタ 沼形 +ヌマカミ 沼上 +ヌマガミ 沼上 +ヌマカワ 沼川 +ヌマガワ 沼川 +ヌマキ 沼木 +ヌマギ 沼生 +ヌマギ 沼城 +ヌマグチ 沼口 +ヌマクナイ 沼宮内 +ヌマクナイ 沼久内 +ヌマクマ 沼隈 +ヌマクラ 沼倉 +ヌマコ 沼子 +ヌマコシ 沼越 +ヌマゴシ 沼越 +ヌマサ 沼佐 +ヌマザ 沼座 +ヌマサキ 沼崎 +ヌマサキ 沼嵜 +ヌマザキ 沼崎 +ヌマザキ 沼嵜 +ヌマサキ 沼埼 +ヌマサト 沼里 +ヌマザト 沼里 +ヌマサワ 沼沢 +ヌマサワ 沼澤 +ヌマザワ 沼沢 +ヌマザワ 沼澤 +ヌマシタ 沼下 +ヌマシマ 沼島 +ヌマシマ 沼嶋 +ヌマジマ 沼島 +ヌマシマタニ 沼島谷 +ヌマシマヤ 沼島谷 +ヌマジリ 沼尻 +ヌマセ 沼瀬 +ヌマタ 沼田 +ヌマダ 沼田 +ヌマタイ 沼袋 +ヌマダイ 沼台 +ヌマダイ 沼臺 +ヌマタオ 沼田尾 +ヌマタガワ 沼田川 +ヌマタキ 沼滝 +ヌマタケ 沼竹 +ヌマタジ 沼田路 +ヌマタツ 沼達 +ヌマダテ 沼館 +ヌマダテ 沼舘 +ヌマダテ 沼達 +ヌマタニ 沼谷 +ヌマタリ 沼垂 +ヌマチ 沼知 +ヌマチ 沼地 +ヌマツ 沼津 +ヌマヅ 沼津 +ヌマナカ 沼中 +ヌマナミ 沼波 +ヌマナミ 沼浪 +ヌマニウ 沼生 +ヌマニュウ 沼生 +ヌマノ 沼野 +ヌマノイ 沼野井 +ヌマノイ 沼の井 +ヌマノウ 沼能 +ヌマノウエ 沼野上 +ヌマノウエ 沼ノ上 +ヌマハシ 沼橋 +ヌマハタ 沼畑 +ヌマハタ 沼端 +ヌマバタ 沼端 +ヌマハラ 沼原 +ヌマヒラ 沼平 +ヌマブクロ 沼袋 +ヌマブチ 沼淵 +ヌマブチ 沼渕 +ヌマベ 沼辺 +ヌマベ 沼部 +ヌマベ 沼邊 +ヌマベ 沼邉 +ヌマホ 沼保 +ヌママエ 沼前 +ヌママル 沼丸 +ヌマミチ 沼道 +ヌマミツ 沼光 +ヌマムカイ 沼向 +ヌマムラ 沼村 +ヌマモト 沼本 +ヌマモト 沼元 +ヌマモリ 沼守 +ヌマモリ 沼森 +ヌマヤ 沼谷 +ヌマヤ 沼屋 +ヌマヤマ 沼山 +ヌマリ 沼里 +ヌマワダ 沼和田 +ヌモト 沼本 +ヌモト 沼元 +ヌリ 塗 +ヌリアイ 塗合 +ヌリイ 塗井 +ヌリオカ 塗岡 +ヌリカベ 塗壁 +ヌリキ 塗木 +ヌリキ 努力 +ヌリシ 塗師 +ヌリシマ 塗島 +ヌリシモト 塗師本 +ヌリゾノ 塗園 +ヌリタ 塗田 +ヌリタニ 塗谷 +ヌリノ 塗野 +ヌリノブ 塗信 +ヌリヒロ 塗広(塗廣) +ヌリベ 塗塀 +ヌリムラ 塗村 +ヌリモト 塗本 +ヌリモノ 塗物 +ヌリモリ 塗森 +ヌリヤ 塗谷 +ヌリヤ 塗矢 +ヌリヤ 塗家 +ヌルイ 溜井 +ヌルイ 温 +ヌルキ 塗木 +ヌルキオカ 塗木岡 +ヌルユ 奴留湯 +ヌルユ 怒留湯 +ヌルユ 奴留由 +ヌルユ 奴畄湯 +ヌレイシ 濡石 +ヌレガミ 濡髪 +ヌレキ 濡木 +ヌレダ 濡田 +ヌワ 怒和 +ネアガリ 根上 +ネイ 根井 +ネイサン 寧山 +ネイシ 根石 +ネイシ 祢石 +ネイチ 根市 +ネイヤマ 寧山 +ネイロ 根井路 +ネイワ 根岩 +ネウチ 根内 +ネオ 根尾 +ネオ 根緒 +ネオイ 根生 +ネオイ 根笈 +ネオダ 根小田 +ネガ 根賀 +ネガキ 根垣 +ネガタ 根方 +ネガタ 根形 +ネカド 根角 +ネカド 根門 +ネカマ 根釜 +ネガマ 根釜 +ネガミ 根上 +ネガミ 根神 +ネガミ 子上 +ネガミヤ 根上屋 +ネガヤマ 根ケ山 +ネガワ 根川 +ネガワ 子川 +ネガワ 根河 +ネキ 根木 +ネギ 大戸 +ネギ 根木 +ネギ 祢宜 +ネギ 根宜 +ネギ 祢木 +ネギ 禰宜 +ネギ 禰木 +ネギ 根宣 +ネギ 祢宣 +ネギ 禰宣 +ネギ 称宜 +ネギ 稱木 +ネキガワ 根来川(根來川) +ネギガワ 根来川(根來川) +ネギサワ 祢宜沢(祢宜澤) +ネギシ 根岸 +ネギシマ 根木島 +ネギシマ 根木嶋 +ネキタ 根北 +ネギタ 祢宜田 +ネギタ 禰宜田 +ネギタ 祢ギ田 +ネギタ 祢宣田 +ネギタ 根喜田 +ネギタ 根木田 +ネギタ 称宜田 +ネギタ 禰宣田 +ネギタヤ 祢宜田谷(禰宜田谷) +ネギタヤ 禰宣田谷 +ネギチ 根木地 +ネキハラ 根木原 +ネギハラ 根木原 +ネギホラ 祢宜洞(禰宜洞) +ネギホラ 祢宣洞 +ネキムラ 根木村 +ネギモト 祢宜元 +ネギモト 禰宜元 +ネギモト 祢宣元 +ネギヤ 祢宜谷 +ネギヤ 子木弥(子木彌) +ネギヤ 根木屋 +ネギヤ 根木谷 +ネギヤ 禰宜谷 +ネギヤ 祢宣谷 +ネギヤマ 根木山 +ネギリダ 根切田 +ネグタ 年貢田 +ネグチ 根口 +ネクラ 根倉 +ネグラ 根倉 +ネグラ 塒 +ネコ 根子 +ネコ 根古 +ネゴ 根子 +ネコイシ 猫石 +ネコウ 根鴻 +ネゴウ 根郷 +ネコオキ 猫沖 +ネコガキ 猫垣 +ネコザキ 猫崎 +ネコシマ 猫島 +ネコジマ 猫島 +ネコズカ 猫塚 +ネコタ 猫田 +ネコタ 根小田 +ネコダ 猫田 +ネコタニ 猫谷 +ネコツカ 猫塚 +ネコヅカ 猫塚 +ネコト 猫戸 +ネゴト 音琴 +ネコニシ 猫西 +ネコハ 猫羽 +ネコバ 猫葉 +ネコハシ 猫橋 +ネコバヤシ 根古林 +ネコヒラ 猫平 +ネコブチ 猫渕 +ネコマタ 猫俣 +ネコミヤ 猫宮 +ネコムラ 猫村 +ネゴメ 根米 +ネコモト 猫本 +ネコヤ 猫矢 +ネゴヤ 根小屋 +ネゴヤ 根古谷 +ネゴヤ 根古屋 +ネコヤシキ 猫屋敷 +ネコヤス 猫安 +ネコヤダ 猫屋田 +ネコヤマ 猫山 +ネコヤマ 根小山 +ネゴロ 根来 +ネゴロ 根比 +ネゴロ 根耒 +ネゴロ 根來 +ネゴロ 根頃 +ネゴロガワ 根来川(根來川) +ネサカ 根坂 +ネサキ 根崎 +ネサキ 根嵜 +ネザキ 根崎 +ネザケ 祢酒(禰酒) +ネザケ 根酒 +ネササ 根笹 +ネザサ 根笹 +ネザト 根里 +ネザワ 根沢 +ネザワ 根澤 +ネシ 根子 +ネシ 根志 +ネシ 根師 +ネシ 根司 +ネシ 祢司 +ネジ 子師 +ネジガキ 捫垣 +ネジカネ 祢次金 +ネジカネ 捻金 +ネジガネ 祢次金 +ネジガネ 捻金 +ネジガネ 根次金 +ネジガネ 禰次金 +ネジキ 根食 +ネジキリ 根仕切 +ネシゲ 音成 +ネジシマ 根地嶋 +ネジト 根地戸 +ネシバ 根芝 +ネジハシ 捻橋 +ネジマ 子島 +ネジマ 根島 +ネシメ 禰寝(禰寢) +ネジメ 根路銘 +ネジメ 根占 +ネジメ 根〆 +ネジメ 祢占 +ネジメ 寝占 +ネジメ 禰寝(禰寢) +ネジメ 禰占 +ネジメ 祢寝(祢寢) +ネジメ 称寝 +ネジメ 寢占 +ネジョウ 根城 +ネシロ 根城 +ネス 根須 +ネズ 根津 +ネズ 祢津 +ネズ 禰津 +ネズ 根須 +ネズオ 鼠尾 +ネズオ 鼡尾 +ネスズ 根鈴 +ネスミ 根角 +ネスミ 根住 +ネズミ 根住 +ネズミタ 鼡田 +ネズミダ 鼠田 +ネズミダ 鼡田 +ネズミタニ 鼠谷 +ネズミブチ 鼠淵 +ネズミヤ 鼠家 +ネズミヤ 鼠屋 +ネズミヤ 鼡屋 +ネゼン 根前 +ネソリ 根反 +ネタ 根田 +ネダ 根田 +ネタケ 根竹 +ネダチ 根立 +ネダチ 根建 +ネダツ 根達 +ネダテ 根立 +ネダテ 根建 +ネタニ 根谷 +ネタバヤシ 根田林 +ネタビ 米多比 +ネタミ 米多比 +ネチシマ 根地島 +ネチシマ 根地嶋 +ネチト 根地戸 +ネツ 根津 +ネツ 祢津 +ネツ 禰津 +ネヅ 根津 +ネヅ 祢津 +ネヅ 禰津 +ネッカ 根家 +ネヅカ 根塚 +ネツケ 根附 +ネッコ 根子 +ネツノ 熱野 +ネップ 根符 +ネヅヤ 根津谷 +ネデフジ 子出藤 +ネトウ 根藤 +ネトナイ 根戸内 +ネナカ 根中 +ネナシ 根無 +ネナシ 根梨 +ネナミ 根波 +ネヌイ 根縫 +ネネヅ 子々津 +ネノ 根野 +ネノイ 根井 +ネノイ 子野井 +ネノイ 根ノ井 +ネノキ 根之木 +ネノキ 根ノ木 +ネノヒ 子野日 +ネノヒ 子日 +ネノビ 子延 +ネハ 禰覇 +ネハ 根波 +ネハ 祢覇 +ネハ 根羽 +ネバ 根波 +ネバ 根葉 +ネバ 直場 +ネハギ 根萩 +ネハシ 根橋 +ネバシ 根橋 +ネバタ 根畑 +ネバヤシ 根林 +ネハラ 根原 +ネバラ 根原 +ネハリ 根張 +ネヒ 根比 +ネビキ 根引 +ネビヤ 根日屋 +ネヒョウ 根兵 +ネヒラ 根平 +ネフ 根府 +ネブ 根布 +ネブイ 根布井 +ネフカ 根深 +ネブカ 根深 +ネフジ 根藤 +ネブチョウ 根布長 +ネブノキ 棔 +ネブハラ 根布原 +ネブヤ 根布谷 +ネブヤ 根布屋 +ネブヤ 根武谷 +ネフル 根古 +ネホ 根保 +ネホ 禰保 +ネマ 根間 +ネマス 根舛 +ネマツ 根松 +ネマツ 子松 +ネマワリ 根廻 +ネマワリ 根回 +ネミズ 根水 +ネミチ 根道 +ネミネ 根峯 +ネム 根無 +ネムガキ 合歓垣(合歡垣) +ネムラ 根村 +ネメザワ 根目沢 +ネメザワ 根目澤 +ネモト 根本 +ネモト 根元 +ネモト 祢元(禰元) +ネモトウチ 根本内 +ネモリ 根守 +ネモリ 根森 +ネヤ 根矢 +ネヤ 閨 +ネヤ 祢屋 +ネヤ 根谷 +ネヤ 根屋 +ネヤ 禰屋 +ネヤ 根箭 +ネヤザキ 閨崎 +ネヤザキ 根谷崎 +ネヤシマ 閨島 +ネヤタニ 閨谷 +ネヤマ 根山 +ネヨシ 子吉 +ネリ 練 +ネリ 称里 +ネリ 祢里(禰里) +ネリアイ 練合 +ネリイシ 錬石 +ネリイシ 練石 +ネリウカワ 練生川 +ネリウガワ 練生川 +ネリオ 練尾 +ネリオ 練苧 +ネリカネ 練兼 +ネリキ 練木 +ネリキ 捻木 +ネリコ 練子 +ネリタ 練田 +ネリタニ 練谷 +ネリバナ 練鼻 +ネリハラ 捻原 +ネリマ 練間 +ネリマ 練馬 +ネリヤ 練合 +ネリヤ 練谷 +ネリヤ 煉谷 +ネリュウカワ 練生川 +ネリュウガワ 練生川 +ネルソン 音流村 +ネレイ 根鈴 +ネロメ 根路銘 +ネワ 根羽 +ネンガイ 念介 +ネンガキ 念垣 +ネンギ 棯木 +ネンザイ 年財 +ネンザワ 念沢 +ネンザワ 念澤 +ネンジ 念治 +ネンジ 念冶 +ネンダイ 年代 +ネンダイ 念代 +ネンダイラ 念平 +ネンドウ 年藤 +ネンネン 年々 +ネンノ 稔野 +ネンバイ 年楳 +ネンバイ 年梅 +ネンバシ 捻橋 +ネンバラ 捻原 +ネンバラ 棯原 +ネンバリ 念張 +ネンブツ 念仏(念佛) +ネンマ 年真 +ノ 野 +ノ 埜 +ノアイ 野相 +ノアキ 野秋 +ノアキ 野明 +ノアケ 野明 +ノアミ 野網 +ノアミ 能阿弥 +ノアミ 能網 +ノアミ 能阿彌 +ノアミ 野綱 +ノアミ 野阿弥 +ノアラ 野荒 +ノイ 野井 +ノイ 能井 +ノイ 乃井 +ノイエ 野家 +ノイクラ 野井倉 +ノイケ 野池 +ノイケ 能池 +ノイシ 野石 +ノイシキ 野一色 +ノイズミ 野泉 +ノイダ 能井田 +ノイチ 乃一 +ノイチ 野市 +ノイチ 能一 +ノイチ 野一 +ノイチ 野異地 +ノイデ 野出 +ノイネ 野稲 +ノイリ 野入 +ノイリ 野杁 +ノイリ 野扖 +ノウ 納 +ノウ 能 +ノウ 乃生 +ノウ 農 +ノウ 能生 +ノウ 野宇 +ノウイ 能井 +ノウイチ 能一 +ノウウチ 農内 +ノウウラ 能浦 +ノウエ 野上 +ノウエ 納江 +ノウエイ 能栄 +ノウエンボウ 能円坊(能圓坊) +ノウカ 苗加 +ノウカ 納家 +ノウガ 納賀 +ノウガシラ 農頭 +ノウガタ 能方 +ノウガミ 農上 +ノウカワ 直川 +ノウガワ 直川 +ノウガン 能願 +ノウキ 納城 +ノウキ 農木 +ノウギ 能木 +ノウギョウ 農業 +ノウグチ 能口 +ノウグチ 納口 +ノウグチ 農口 +ノウグチ 濃口 +ノウケ 能化 +ノウコウ 濃香 +ノウザ 農座 +ノウサカ 能坂 +ノウサカ 農坂 +ノウザキ 能崎(能嵜) +ノウザキ 農崎 +ノウザキ 納崎 +ノウサク 農作 +ノウサク 能作 +ノウサト 農里 +ノウザワ 能沢 +ノウザワ 能澤 +ノウザワ 農沢 +ノウザワ 農澤 +ノウザワ 納沢 +ノウシ 野牛 +ノウシ 農士 +ノウジ 能地 +ノウシゲ 能重 +ノウシマ 能島 +ノウシマ 能嶋(能嶌) +ノウジマ 能島 +ノウジマ 納島 +ノウジマ 農島 +ノウジマ 農嶋 +ノウシュウ 能州 +ノウジュウ 能重 +ノウジュウ 能充 +ノウショ 納所 +ノウショウ 納庄 +ノウショウ 能正 +ノウショウ 能生 +ノウショウ 納生 +ノウショウ 能庄 +ノウジョウ 能城 +ノウジョウ 能条 +ノウジョウ 能條 +ノウジョウ 能星 +ノウジョウ 納上 +ノウジョウ 能丈 +ノウシン 納心 +ノウジン 能仁 +ノウス 野生須 +ノウス 野生司 +ノウス 乃生須 +ノウズ 能津 +ノウズカ 能塚 +ノウズミ 能隅 +ノウズミ 能住 +ノウズミ 能角 +ノウセ 能瀬 +ノウセイ 能生 +ノウソ 能祖 +ノウソ 農蘇(農蘓) +ノウソウ 能宗 +ノウソウ 農宗 +ノウゾエ 農添 +ノウタ 能田 +ノウダ 能田 +ノウダ 納田 +ノウダ 苗田 +ノウダ 納多 +ノウダ 能多 +ノウダ 農田 +ノウダ 濃田 +ノウタニ 納谷 +ノウダン 能弾(能彈) +ノウチ 野内 +ノウチ 能地 +ノウチ 能智 +ノウヂ 能地 +ノウヅ 能津 +ノウツカ 能塚 +ノウツカ 納塚 +ノウツカ 農塚 +ノウヅカ 能塚 +ノウヅカ 納塚 +ノウヅカ 農塚 +ノウテ 能手 +ノウテ 苗手 +ノウド 納土 +ノウトウ 納藤 +ノウトウ 納籐 +ノウドウ 納堂 +ノウトシ 能年 +ノウトミ 納富 +ノウトミ 納冨 +ノウトミ 能冨 +ノウトミ 能富 +ノウドミ 納富 +ノウドミ 納冨 +ノウドミ 能冨 +ノウドメ 納留 +ノウナカ 農中 +ノウナカ 能仲 +ノウナカ 能中 +ノウナミ 能波 +ノウニ 能仁 +ノウニシ 能西 +ノウニン 能仁 +ノウニン 農人 +ノウニン 濃人 +ノウネ 南畝 +ノウネン 南畝 +ノウネン 能年 +ノウネン 農年 +ノウノ 南野 +ノウノ 濃野 +ノウノ 能野 +ノウノ 農野 +ノウハタ 濃畑 +ノウバタ 農端 +ノウバヤシ 能林 +ノウハラ 農原 +ノウハラ 納原 +ノウハラ 能原 +ノウバラ 農原 +ノウビキ 能引 +ノウベ 納部 +ノウボリ 能堀 +ノウマ 能間 +ノウマ 野馬 +ノウマ 縄間 +ノウマ 農間 +ノウマ 濃間 +ノウマイ 納米 +ノウマタ 能又 +ノウマチ 能町 +ノウマツ 能松 +ノウマル 能丸 +ノウマン 能満 +ノウミ 能美 +ノウミ 能見 +ノウミ 納見 +ノウミ 野海 +ノウミ 乃美 +ノウミ 能海 +ノウミ 能味 +ノウミ 納身 +ノウミ 農見 +ノウミ 農海 +ノウミ 濃見 +ノウミヤ 能宮 +ノウミヤ 農宮 +ノウム 納夢 +ノウム 能武 +ノウムラ 能村 +ノウムラ 納村 +ノウムラ 農村 +ノウモト 納本 +ノウモト 農本 +ノウモト 能本 +ノウモト 濃本 +ノウモト 納元 +ノウモリ 能森 +ノウモリ 農守 +ノウヤ 納谷 +ノウヤ 納屋 +ノウヤ 能谷 +ノウヤマ 能山 +ノウヤマ 農山 +ノウヤマ 納山 +ノウラ 野浦 +ノウラ 能浦 +ノウリョウ 能令 +ノウロ 能呂 +ノウワキ 農脇 +ノエ 野家 +ノエ 野江 +ノエイ 能栄 +ノエダ 野枝 +ノオ 乃生 +ノオ 野尾 +ノオ 能生 +ノオエ 納江 +ノオカ 野岡 +ノオダ 能田 +ノオトミ 納富 +ノオノ 南野 +ノオノ 濃野 +ノオモ 野小生 +ノオモテ 野表 +ノカ 野底 +ノカ 野加 +ノガ 苗加 +ノガ 野賀 +ノカイ 野界 +ノガイ 野替 +ノガイ 野飼 +ノガイ 野界 +ノガイト 野垣内 +ノカイドウ 野海道 +ノガエ 野替 +ノガキ 野垣 +ノカク 野角 +ノガク 野角 +ノカゲ 野影 +ノガケ 野掛 +ノカジマ 能鹿島 +ノガシラ 野頭 +ノガシラ 農頭 +ノガセ 野鹿瀬 +ノカタ 野方 +ノガタ 野方 +ノガタ 野形 +ノガタ 野潟 +ノガタ 野片 +ノガタ 野賀田 +ノカド 野首 +ノガネ 野金 +ノカミ 野上 +ノガミ 野上 +ノガミ 野神 +ノガミ 能上 +ノガミ 農上 +ノガミ 埜上 +ノガミ 乃上 +ノガミダ 野上田 +ノガミネ 野ケ峯 +ノガミネ 野ケ峰 +ノカメ 野亀 +ノガメ 野亀 +ノガモト 野ケ本 +ノカヤ 野萱 +ノガヤ 野萱 +ノガヤマ 野ケ山 +ノガリ 野刈 +ノガリ 野苅 +ノカリヤ 野苅家 +ノガリヤ 野苅家 +ノガリヤ 野刈家 +ノカワ 野川 +ノガワ 野川 +ノガワ 直川 +ノガワ 能川 +ノガワ 野河 +ノガワ 埜川 +ノキ 野木 +ノキ 能城 +ノキ 軒 +ノキ 乃木 +ノキ 納城 +ノギ 野木 +ノギ 能城 +ノギ 野城 +ノギ 乃木 +ノギ 野儀 +ノギ 能木 +ノギ 禾 +ノギ 納城 +ノギ 埜木 +ノギ 能義 +ノギ 野喜 +ノギイ 野木井 +ノギク 野菊 +ノキグチ 軒口 +ノギシ 野岸 +ノキシタ 軒下 +ノキタ 野北 +ノキタ 軒田 +ノキタ 䅏田 +ノキダ 軒田 +ノギタ 野北 +ノギタ 乃木田 +ノギタ 及木田 +ノキタニ 軒谷 +ノキナ 軒名 +ノギヌマ 野木沼 +ノキノ 軒野 +ノギノ 禾野 +ノキバ 能木場 +ノキバ 軒端 +ノキバ 野木場 +ノキバタ 軒端 +ノキハラ 軒原 +ノギハラ 野木原 +ノキムラ 野木村 +ノキムラ 軒村 +ノギムラ 野木村 +ノギムラ 穖村 +ノギモト 禾本 +ノギモリ 野木森 +ノキヤマ 軒山 +ノギヤマ 野木山 +ノギリ 野切 +ノギリ 野桐 +ノギワ 野際 +ノギワ 野極 +ノギワ 野涯 +ノギワ 野渥 +ノギワ 野木和 +ノク 能久 +ノクオ 野久尾 +ノグキ 野茎 +ノグサ 野草 +ノクチ 野口 +ノグチ 野口 +ノグチ 埜口 +ノグチ 能口 +ノグチ 納口 +ノグチ 農口 +ノグチ 乃口 +ノグチ 濃口 +ノグチ 𡌛口 +ノグチハラ 野口原 +ノグチバラ 野口原 +ノグニ 野国 +ノグニ 野國 +ノクビ 野首 +ノクビ 野久尾 +ノクボ 野久保 +ノクボ 野窪 +ノクラ 野倉(埜倉) +ノクラ 能倉 +ノグラ 野倉(埜倉) +ノグリ 野栗 +ノグロ 野黒 +ノグロミ 野黒美 +ノクワ 野桑 +ノグワ 野桑 +ノゲ 野下 +ノゲ 野毛 +ノゲザキ 芒崎 +ノケラ 野螻 +ノケラ 野蝼 +ノゲラ 野蝼 +ノコ 野古 +ノコ 野小 +ノゴ 野吾 +ノゴウ 野郷 +ノコザキ 鋸崎 +ノコシ 残 +ノゴシ 野越 +ノゴシ 野腰 +ノコシマツ 残松 +ノコタ 残田 +ノコタ 鋸田 +ノゴミ 野込 +ノゴミ 乃込 +ノゴメ 能米 +ノコヤ 野子谷 +ノゴヤ 野子谷 +ノゴヤ 野小谷 +ノサ 能佐 +ノサ 野佐 +ノサオ 野竿 +ノザオ 野竿 +ノサカ 野坂 +ノサカ 野阪 +ノサカ 乃坂 +ノサカ 能坂 +ノサカ 埜坂 +ノザカ 野坂 +ノザカ 野阪 +ノザカ 乃坂 +ノザカ 能坂 +ノサガケ 野左掛(野佐掛) +ノサキ 野崎 +ノサキ 野嵜 +ノサキ 野碕 +ノサキ 野咲 +ノザキ 野崎 +ノザキ 野嵜 +ノザキ 能崎(能嵜) +ノザキ 埜崎 +ノザキ 農崎 +ノザキ 野碕 +ノザキ 野埼 +ノザキ 埜嵜 +ノザキ 苗崎 +ノサク 野作 +ノザクラ 野桜 +ノザクラ 野櫻 +ノサコ 野迫 +ノザコ 野迫 +ノサコン 野左近 +ノサコン 野佐近 +ノザサ 野笹 +ノサダ 野定 +ノサト 野里 +ノザト 野里 +ノザネ 野左根 +ノザネ 野佐根 +ノサワ 野沢 +ノサワ 野澤 +ノザワ 野沢 +ノザワ 野澤 +ノザワ 能沢 +ノザワ 能澤 +ノザワ 埜沢 +ノザワ 農沢 +ノザワ 埜澤 +ノザワ 農澤 +ノザワイ 野沢井 +ノシ 熨斗 +ノシ 野志 +ノジ 野地 +ノジ 野路 +ノジ 能地 +ノジ 野子 +ノジ 野治 +ノジ 能治 +ノジ 野事 +ノジ 野次 +ノジイ 野路井 +ノジオカ 野地岡 +ノジカ 野鹿 +ノジカワ 野地川 +ノシゲ 野重 +ノジサキ 野地崎 +ノシタ 野下 +ノシタ 埜下 +ノジタ 野地田 +ノシタニ 野志谷 +ノシタニ 熨斗谷 +ノシノ 野篠 +ノシバ 能芝 +ノシバ 野芝 +ノシバ 野柴 +ノシヒロ 野士広 +ノシマ 野島 +ノジマ 野島 +ノジマ 野嶋 +ノジマ 能島 +ノジマ 能嶋(能嶌) +ノジマ 野嶌 +ノジマ 埜島 +ノジマ 廼島 +ノジマ 埜嶋 +ノジマ 𡌛島 +ノジマ 𡌛嶋 +ノシモト 野師本 +ノジモト 野地本 +ノジモト 野地元 +ノシュ 野首 +ノジョウ 能条 +ノジョウ 野条 +ノジョウ 野條 +ノシラ 野白 +ノジリ 野尻 +ノジリ 埜尻 +ノジリ 野知里 +ノジリノ 野尻野 +ノシロ 能城 +ノシロ 能代 +ノシロ 野城 +ノシロ 苗代 +ノシロ 野代 +ノシロ 野白 +ノジロ 野城 +ノジロ 野白 +ノシロガワ 能代川 +ノシロダ 苗代田 +ノシロヤ 能代谷 +ノシロヤ 野代谷 +ノジン 野陳 +ノス 野須 +ノズ 野津 +ノズ 能津 +ノズ 野頭 +ノズ 野須 +ノズイ 野瑞 +ノスエ 野末 +ノズエ 野末 +ノズエ 野未 +ノスガ 野菅 +ノスギ 野杉 +ノズキ 野月 +ノスジ 野筋 +ノズハラ 野津原 +ノズマ 野妻 +ノズミ 野角 +ノズミ 野住 +ノズミ 野積 +ノセ 野瀬 +ノセ 能勢 +ノセ 能瀬 +ノセ 野勢 +ノセ 乃生 +ノセ 埜瀬 +ノセ 能政 +ノセ 能生 +ノセ 野世 +ノセ 野生 +ノセ 能世 +ノセ 納瀬 +ノセ 乃勢 +ノセ 及生 +ノゼ 野畦 +ノセイ 野瀬井 +ノセキ 野関 +ノセキ 能関 +ノゼキ 野関 +ノセダ 野瀬田 +ノセタニ 野世渓 +ノセタニ 野世溪 +ノセヤマ 能勢山 +ノセヤマ 野瀬山 +ノソ 能祖 +ノソ 野曽 +ノソ 能租 +ノソ 野曾 +ノゾイ 及位 +ノソウ 能宗 +ノソウ 野宗 +ノゾエ 野添 +ノゾエ 野副 +ノゾエ 濃添 +ノソギ 野曽木 +ノゾキ 莅戸 +ノゾキ 及位 +ノゾキ 除 +ノゾキ 覗 +ノゾキイワ 覗岩 +ノゾキド 莅戸 +ノゾキノ 覗埜 +ノゾキブチ 覗渕 +ノソコ 野底 +ノゾコ 野底 +ノソバ 野曽場 +ノソハラ 野曽原(野曾原) +ノゾミ 臨 +ノゾミ 覗見 +ノゾミ 望 +ノゾミ 臨海 +ノタ 野田 +ノタ 乃田 +ノダ 野田 +ノダ 能田 +ノダ 納田 +ノダ 埜田 +ノダ 乃田 +ノダ 納多 +ノダ 能多 +ノダ 能弾(能彈) +ノダイ 野代 +ノダイ 乃台 +ノダイラ 野平 +ノダオ 野田尾 +ノタカ 野高 +ノダカ 野高 +ノタガシラ 野田頭 +ノダカシラ 野田頭 +ノダガシラ 野田頭 +ノダガミ 野田上 +ノダガヤ 野田ケ谷 +ノタキ 野滝 +ノタキ 野瀧 +ノタグチ 野田口 +ノダグチ 野田口 +ノタケ 野竹 +ノタケ 野武 +ノタケ 野嶽 +ノタケ 野岳 +ノダケ 野竹 +ノダケ 野嶽 +ノダケ 野岳 +ノダケ 埜多家 +ノダケ 野嵩 +ノダケ 野獄 +ノタケウチ 野竹内 +ノダサカ 野田坂 +ノタザワ 野田沢 +ノタザワ 野田澤 +ノダサワ 野田沢 +ノダサワ 野田澤 +ノダテ 野館 +ノダテ 野舘 +ノタニ 野谷 +ノタニ 能谷 +ノダニ 野谷 +ノダニ 能谷 +ノタベ 野田部 +ノダマ 野玉 +ノダムラ 野田村 +ノダモト 野田元 +ノダモト 野田本 +ノダヤ 野田谷 +ノタヤマ 野田山 +ノダヤマ 野田山 +ノチ 野地 +ノチ 能地 +ノチ 野知 +ノヂ 野地 +ノヂ 野路 +ノヂ 能地 +ノチイデ 後出 +ノチオカ 後岡 +ノチカ 野近 +ノヂカ 野近 +ノチカワ 後川 +ノヂカワ 野地川 +ノチザワ 後沢 +ノチジマ 後島 +ノチセ 後瀬 +ノチダ 後田 +ノチデ 後出 +ノチノ 後野 +ノチムラ 後村 +ノチモト 後本 +ノチヤマ 後山 +ノチリ 野知里 +ノツ 野津 +ノツ 箆津 +ノツ 篦津 +ノヅ 野津 +ノヅ 能津 +ノヅ 野頭 +ノヅエ 野津江 +ノヅカ 野塚 +ノツキ 野月 +ノツキ 野付 +ノツキ 野附 +ノヅキ 野月 +ノツキタイラ 野月平 +ノツキダイラ 野月平 +ノヅキダイラ 野月平 +ノツキヒラ 野月平 +ノツケ 乗附(乘附) +ノツケ 野附 +ノツケ 秉附 +ノツダ 野津田 +ノツチ 野土 +ノツチ 能土 +ノヅチ 野土 +ノヅツ 野筒 +ノツヅキ 野続 +ノッテ 野津手 +ノツテ 野津手 +ノヅテ 野津手 +ノツハラ 野津原 +ノヅハラ 野津原 +ノツバル 野津原 +ノヅマ 野妻 +ノツマタ 野ツ俣 +ノヅミ 野積 +ノツモト 野津本 +ノツヤマ 野津山 +ノヅヤマ 野津山 +ノヅラ 野面 +ノヅル 野鶴 +ノテ 野手 +ノテ 能手 +ノデ 野手 +ノデ 野出 +ノデ 能出 +ノデキ 野出木 +ノデラ 野寺 +ノト 能登 +ノト 能戸 +ノト 野戸 +ノト 能渡 +ノト 納戸 +ノト 能任 +ノト 野登 +ノト 能都 +ノト 能土 +ノト 能塒 +ノト 能門 +ノト 農登 +ノト 野遠 +ノト 野外 +ノト 衲 +ノド 野土 +ノトイ 能登井 +ノトウ 野藤 +ノトウ 野頭 +ノトウ 能任 +ノトウ 能藤 +ノトウ 納藤 +ノトウ 埜藤 +ノトウ 野塔 +ノトガミ 能登上 +ノトカワ 能登川 +ノトガワ 能登川 +ノトキ 野登木 +ノトク 野徳 +ノトコ 野床 +ノトザキ 能登崎 +ノトジ 能登路 +ノトダ 能登田 +ノドノ 野殿 +ノトハラ 能登原 +ノドハラ 咽原 +ノトベ 能登部 +ノトムラ 能登村 +ノトモ 野友 +ノドモト 咽本 +ノトヤ 能登谷 +ノトヤ 能登屋 +ノトヤ 野土谷 +ノトヤ 野戸谷 +ノトヤ 野登谷 +ノトヤ 能戸谷 +ノドヤ 野土谷 +ノトヤマ 能登山 +ノトリ 野鳥 +ノナ 野名 +ノナカ 野中(墅中) +ノナカ 野仲 +ノナカ 埜中 +ノナカ 農中 +ノナカ 能仲 +ノナカ 濃中 +ノナカ 埜仲 +ノナガ 野永 +ノナガ 野長 +ノナガセ 野長瀬 +ノナミ 野波 +ノナミ 野並 +ノナミ 沼波 +ノナミ 饒波 +ノナミ 野浪 +ノナミ 能波 +ノニ 能仁 +ノニウ 能仁宇 +ノニシ 野西 +ノニワ 野庭 +ノヌシ 野主 +ノネ 野根 +ノネヤマ 野根山 +ノノ 濃野 +ノノ 野々 +ノノ 能々 +ノノ 埜々 +ノノ 野野 +ノノイ 野々井 +ノノイチ 野々市 +ノノイチヤ 野々市谷 +ノノウ 野能 +ノノウエ 野々上 +ノノウエ 野之上 +ノノウチ 野々内 +ノノウチ 布々内 +ノノウチ 埜々内 +ノノウチ 埜野内 +ノノウチ 野野内 +ノノウラ 野々浦 +ノノオ 野々尾 +ノノガキ 野々垣 +ノノガキ 野野垣 +ノノガミ 野々上 +ノノカワ 野々川 +ノノガワ 野々川 +ノノキ 野々木 +ノノギ 野々木 +ノノクチ 野々口 +ノノグチ 野々口 +ノノグチ 野ノ口 +ノノグチ 野之口 +ノノクマ 野々熊 +ノノサキ 野々崎 +ノノザキ 野々崎 +ノノシタ 野々下 +ノノシタ 埜下 +ノノシタ 埜々下 +ノノシリ 野々尻 +ノノジリ 野々尻 +ノノセ 野々瀬 +ノノダ 野々田 +ノノダ 野野田 +ノノタオ 野々垰 +ノノトウ 野々峠 +ノノハラ 野々原 +ノノヒラ 野々平 +ノノヒロ 野々広(野々廣) +ノノベ 野々部 +ノノマタ 野々俣 +ノノマツ 野々松 +ノノミ 野々見 +ノノミヤ 野宮 +ノノミヤ 野々宮 +ノノムラ 野々村(野野村) +ノノムラ 野の村 +ノノムラ 野乃村 +ノノメ 野々目 +ノノモト 野々本 +ノノヤ 野々屋 +ノノヤマ 野々山 +ノノヤマ 埜々山 +ノノヤマ 野乃山 +ノノヤマ 野之山 +ノノワキ 野々脇 +ノハ 野波 +ノハ 饒波 +ノバ 野場 +ノバエ 野栄 +ノハギ 野萩 +ノバク 野白 +ノハシ 野端 +ノハシ 野橋 +ノバシ 野橋 +ノバシリ 野走 +ノハタ 野畑 +ノハタ 野畠 +ノバタ 野畑 +ノバタ 野端 +ノバタ 野畠 +ノバタ 農端 +ノバタ 埜畑 +ノバタケ 野畠 +ノバナ 野花 +ノバナ 野塙 +ノハマ 野浜 +ノハマ 野濱 +ノバヤシ 野林 +ノバヤシ 埜林 +ノバヤシ 乃林 +ノバヤシ 箟林 +ノハラ 野原 +ノハラ 農原 +ノバラ 野原 +ノハラウチ 野原内 +ノハリ 野張 +ノバリ 野張 +ノビ 野首 +ノビ 野火 +ノビキ 野引 +ノビキ 野挽 +ノヒサ 野久 +ノヒナ 饒平名 +ノヒラ 野平 +ノビラ 野平 +ノビラキ 野開 +ノビラキ 能開 +ノヒロ 野広 +ノヒロ 野廣 +ノブ 野部 +ノブ 延 +ノブ 延生 +ノブ 野武 +ノブ 信 +ノブ 乃生 +ノブ 野生 +ノブアキ 信秋 +ノブアシ 延足 +ノブイ 信井 +ノブイ 延井 +ノブイ 伸居 +ノブイ 伸井 +ノブイ 信居 +ノブイ 宣井 +ノブイ 陳井 +ノブイワ 信岩 +ノブウジ 信氏 +ノブエ 信江 +ノブエ 延江 +ノブエ 信恵 +ノブエダ 信枝 +ノブオ 信尾 +ノブオ 延尾 +ノブオカ 信岡 +ノブオカ 延岡 +ノブカ 延賀 +ノブカ 野深 +ノブガイ 延谷 +ノブガキ 信垣 +ノブカタ 信方 +ノブカタ 延片 +ノブカタ 延形 +ノブカタ 延方 +ノブカネ 延兼 +ノブカネ 信包 +ノブカネ 延金 +ノブカネ 述金 +ノブカネ 信金 +ノブカネ 信兼 +ノブカミ 信上 +ノブカワ 信川 +ノブカワ 延川 +ノブカワ 延河 +ノブキ 信木 +ノブキ 延木 +ノブキ 野吹 +ノブキヨ 信清 +ノブキヨ 延清 +ノブキヨ 延青 +ノフク 野福 +ノブグチ 延口 +ノブクニ 信国 +ノブクニ 信國 +ノブクニ 延国(延國) +ノブクミ 信組 +ノブケ 信家 +ノフサ 野房 +ノブサ 野房 +ノブサ 信佐 +ノブサカ 信坂 +ノブサカ 延坂 +ノブサキ 信崎 +ノブサキ 延崎 +ノブサコ 信迫 +ノブサダ 信定 +ノブサダ 信貞 +ノブサト 信里 +ノブサト 延里 +ノブザネ 信実(信實) +ノブサワ 信沢 +ノブサワ 信澤 +ノブサワ 延沢 +ノブサワ 延澤 +ノブサワ 伸沢 +ノブサワ 伸澤 +ノブザワ 延沢 +ノブザワ 延澤 +ノフジ 野藤 +ノフジ 埜藤 +ノブシ 野伏 +ノブシゲ 信重 +ノブシタ 信下 +ノブシタ 延下 +ノブシマ 延島 +ノブシマ 信島 +ノブシマ 延嶋 +ノブシマ 信嶋 +ノブシロ 宣城 +ノブスエ 信末 +ノブスエ 延末 +ノブスナ 信砂 +ノブセ 信瀬 +ノブセ 野布瀬 +ノブソウ 信宗 +ノブタ 信田 +ノブタ 信太 +ノブタ 延田 +ノブタ 述田 +ノブタ 伸田 +ノブタ 野武田 +ノブタカ 信高 +ノブタケ 延武 +ノブタケ 信武 +ノブタニ 信谷 +ノブタニ 延谷 +ノブタネ 信種 +ノブチ 野渕 +ノブチ 延地 +ノブチ 野淵 +ノブチ 野渊 +ノブチカ 延近 +ノブチカ 信近 +ノブツカ 延塚 +ノブツカ 信塚 +ノブヅカ 延塚 +ノブツギ 延次 +ノブツグ 信次 +ノブツネ 信常 +ノブツネ 延常 +ノブト 信戸 +ノブトウ 信藤 +ノブトウ 延藤 +ノブトウ 信東 +ノブトウ 信頭 +ノブトウ 延籐 +ノブトキ 延時 +ノブトキ 信時 +ノブトシ 信歳 +ノブドノ 信殿 +ノブトモ 信友 +ノブトモ 信朝 +ノブトモ 延友 +ノブナカ 信中 +ノブナガ 信永 +ノブナガ 延永 +ノブナガ 信長 +ノブナガ 設永 +ノブナガ 演永 +ノブナリ 信成 +ノブニシ 信西 +ノブネ 信根 +ノブノ 延野 +ノブハタ 信畑 +ノブハラ 延原 +ノブハラ 信原 +ノブハラ 宣原 +ノブハラ 申原 +ノブハル 信治 +ノブヒ 延日 +ノブヒサ 信久 +ノブヒラ 信平 +ノブヒラ 延平 +ノブヒロ 延広 +ノブヒロ 信広 +ノブヒロ 延廣 +ノブヒロ 信廣 +ノブフサ 信房 +ノブマサ 信政 +ノブマサ 信正 +ノブマツ 信松 +ノブミツ 延満 +ノブミヤ 信宮 +ノブムラ 信村 +ノブモト 信本 +ノブモト 延本 +ノブモト 延元 +ノブモト 信元 +ノブモト 宣本 +ノブモト 宣元 +ノブモリ 信森 +ノブヤス 延安 +ノブヤス 信安 +ノブヤス 信保 +ノブヤマ 延山 +ノブヤマ 信山 +ノブヤマ 宣山 +ノブヨ 延与 +ノブヨシ 延吉 +ノブヨシ 信吉 +ノブヨシ 信好 +ノブリュウ 信竜 +ノブリュウ 信龍 +ノブロ 野風呂 +ノベ 野辺 +ノベ 野部 +ノベ 延 +ノベ 野邊 +ノベ 饒辺 +ノベ 野邉 +ノベ 埜辺(埜邊) +ノベ 納部 +ノベ 埜邉 +ノベアシ 延足 +ノベオカ 延岡 +ノベカタ 延片 +ノベカネ 延金 +ノベカワ 延川 +ノベサワ 延沢 +ノベサワ 延澤 +ノベザワ 延沢 +ノベザワ 延澤 +ノヘジ 野辺地 +ノヘジ 野邊地 +ノヘジ 野邉地 +ノベジ 野辺地 +ノベシマ 延島 +ノベシマ 延嶋 +ノベシロ 延城 +ノベタ 延田 +ノベタ 野辺田(野邉田) +ノベタ 野邊田 +ノベタニ 延谷 +ノヘチ 野辺地 +ノベチ 野辺地 +ノベチ 延地 +ノベチ 野邊地 +ノベチ 野邉地 +ノベツ 野別 +ノベトキ 延時 +ノベナ 野辺名 +ノベヌマ 野辺沼 +ノベノ 延野 +ノベハラ 延原 +ノベフジ 延藤 +ノベマツ 延松 +ノベマツ 陳松 +ノベムラ 延村 +ノベモト 延本 +ノベモト 述本 +ノベヤス 延安 +ノベヤマ 延山 +ノホ 野甫 +ノホ 野保 +ノボ 野模 +ノボキ 登木 +ノボタチ 登立 +ノボト 野坊戸 +ノホリ 野堀 +ノボリ 登 +ノボリ 昇 +ノボリ 野堀 +ノボリ 登里 +ノボリ 登利 +ノボリ 幟 +ノボリ 登り +ノボリ 能堀 +ノボリ 野掘 +ノボリオ 上尾 +ノボリオ 登尾 +ノボリカワ 登川 +ノボリカワ 幟川 +ノボリキ 登木 +ノボリグチ 登口 +ノボリグチ 登リ口 +ノボリグチ 登り口 +ノボリサカ 登坂 +ノボリサカ 登阪 +ノボリザカ 登坂 +ノボリザカ 上り坂 +ノボリサコ 登佐古 +ノボリサト 登里 +ノボリザト 登里 +ノボリセ 登瀬 +ノボリタ 登田 +ノボリダ 登田 +ノボリタチ 登立 +ノボリタテ 登立 +ノボリタテ 幟立 +ノボリタテ 幟建 +ノボリダテ 幟立 +ノボリタマ 登玉 +ノボリト 登戸 +ノボリハシ 登橋 +ノボリハヤシ 登林 +ノボリバヤシ 登林 +ノボリミチ 登道 +ノボリミチ 登路 +ノボリモト 登本 +ノボリヤ 登家 +ノボリヤ 登矢 +ノボリヤマ 登山 +ノボリヤマ 登り山 +ノボリヤマ 幟山 +ノボリュウ 登竜 +ノボリュウ 登龍 +ノボル 登 +ノボル 昇 +ノボル 野保留 +ノマ 野間(墅間) +ノマ 乃万 +ノマ 野馬 +ノマ 埜間 +ノマ 埜真 +ノマ 埜馬 +ノマ 野真 +ノマ 𡌛間 +ノマイ 野間井 +ノマエ 野前 +ノマカワウチ 野間川内 +ノマキ 野牧 +ノマキ 野巻 +ノマグチ 野間口 +ノマサ 野正 +ノマサ 野政 +ノマサキ 野間崎 +ノマザキ 野間崎 +ノマス 野間須 +ノマタ 野俣 +ノマタ 野間田 +ノマタ 野又 +ノマタ 野亦 +ノマタ 野股 +ノマタ 能又 +ノマタ 野叉 +ノマタ 野復 +ノマダ 野間田 +ノマチ 野町 +ノマツ 野松 +ノマノ 野間野 +ノマモト 野間元 +ノマモト 野間本 +ノマヤ 野間屋 +ノマル 野丸 +ノミ 能見 +ノミ 野見 +ノミ 野海 +ノミ 乃美 +ノミ 能味 +ノミ 野美 +ノミ 飲 +ノミ 鑿 +ノミカワ 呑川 +ノミグチ 呑口 +ノミサワ 呑沢(呑澤) +ノミザワ 能美沢(能美澤) +ノミズ 野水 +ノミズ 𡌛水 +ノミゾ 野溝 +ノミタ 呑田 +ノミダ 呑田 +ノミタニ 呑谷 +ノミチ 野道 +ノミツ 野満(野滿) +ノミノ 呑野 +ノミハラ 呑原 +ノミムラ 呑村 +ノミヤ 野宮 +ノミヤ 能宮 +ノミヤ 農宮 +ノミヤマ 野見山 +ノミヤマ 許山 +ノミヤマ 呑山 +ノミヤマ 野美山 +ノミヤマ 吸山 +ノミヤマ 能美山 +ノミワラ 呑原 +ノムキ 野向 +ノムラ 野村(𡌛村) +ノムラ 能村 +ノムラ 野邑 +ノムラ 埜村 +ノムラ 乃村 +ノムラ 納村 +ノムラ 野邨 +ノムラ 埜邑 +ノムラ 埜邨 +ノムラ 濃村 +ノムラ 能邨 +ノムラ 野屯 +ノムラジマ 野村島 +ノムラジマ 野村嶋 +ノムロ 野室 +ノモ 野毛 +ノモ 野母 +ノモ 野茂 +ノモオ 野小生 +ノモダ 農望田 +ノモダ 野毛田 +ノモテ 野表 +ノモト 野本 +ノモト 野元 +ノモト 埜下 +ノモト 納本 +ノモト 農本 +ノモト 埜本 +ノモト 能本 +ノモト 能元 +ノモト 𡌛本 +ノモトボリ 野元堀 +ノモリ 野守 +ノモリ 能森 +ノモリ 野森 +ノモリ 埜森 +ノモリ 能守 +ノヤ 納谷 +ノヤ 野谷 +ノヤ 野矢 +ノヤ 野屋 +ノヤ 埜谷 +ノヤキ 野焼 +ノヤシキ 野屋敷 +ノヤス 野安 +ノヤマ 野山 +ノヨ 野与 +ノヨ 野與 +ノヨセ 野寄 +ノヨダ 能代田 +ノヨリ 野寄 +ノヨリ 野依 +ノヨリ 野頼 +ノラ 野良 +ノリ 野里 +ノリ 則 +ノリ 野理 +ノリ 法 +ノリ 乗 +ノリ 海苔 +ノリ 程 +ノリ 謙 +ノリ 範 +ノリ 野利 +ノリ 憲 +ノリ 糊 +ノリアゲ 乗上 +ノリイ 規井 +ノリイ 乗井(乘井) +ノリイ 則井 +ノリイ 糊井 +ノリイ 法井 +ノリイエ 則家 +ノリイケ 乗池 +ノリイシ 乗石 +ノリイズミ 法泉 +ノリウチ 則内 +ノリエダ 則枝 +ノリオ 則尾 +ノリオ 則生 +ノリオカ 則岡 +ノリオカ 乗岡(乘岡) +ノリオカ 法岡 +ノリオカ 範岡 +ノリカエ 乗替 +ノリカゲ 乗影 +ノリカネ 則包 +ノリカネ 乗金(乘金) +ノリカネ 法兼 +ノリカネ 則兼 +ノリカネ 乗兼(乘兼) +ノリカネ 則金 +ノリガネ 乗金(乘金) +ノリカミ 乗上 +ノリガミ 乗上 +ノリカワ 乗川 +ノリカワ 則川 +ノリカワ 法川 +ノリカワ 則皮 +ノリカワ 乘川 +ノリキ 乗木(乘木) +ノリキ 法木 +ノリキ 則木 +ノリキ 野力 +ノリキヨ 則清 +ノリキヨ 範浄(範淨) +ノリキョウ 乗京(乘京) +ノリグチ 乗口 +ノリグチ 乘口 +ノリクニ 範国 +ノリクニ 範國 +ノリクモ 法雲 +ノリクラ 乗鞍 +ノリクラ 糊倉 +ノリクラ 乗倉 +ノリクラ 法倉 +ノリゴエ 乗越 +ノリコシ 乗越(乘越) +ノリサキ 乗崎 +ノリサダ 則定 +ノリサダ 則貞 +ノリサダ 乗貞 +ノリサダ 法貞 +ノリサダ 乗定 +ノリザネ 範実 +ノリサワ 法沢 +ノリサワ 法澤 +ノリザワ 法沢 +ノリザワ 法澤 +ノリシゲ 乗重 +ノリシゲ 教重 +ノリシゲ 範重 +ノリシゲ 則重 +ノリシマ 法島 +ノリシマ 則島 +ノリシマ 法嶋 +ノリシマ 謙島 +ノリスエ 則末 +ノリスエ 乗末 +ノリスエ 乘末 +ノリスギ 乗杉(乘杉) +ノリズキ 法月 +ノリズミ 乗住 +ノリゾエ 乗添(乘添) +ノリタ 車田 +ノリタ 乗田 +ノリタ 法田 +ノリタ 則田 +ノリタ 糊田 +ノリタ 乘田 +ノリタ 範田 +ノリタ 野利田 +ノリタケ 則武 +ノリタケ 則竹 +ノリタケ 乗竹(乘竹) +ノリタケ 法武 +ノリタケ 範岳 +ノリタケ 法岳 +ノリタケ 㳒武 +ノリタテ 乗立(乘立) +ノリタニ 糊谷 +ノリタニ 乗谷 +ノリチ 乗地 +ノリチカ 則近 +ノリツキ 法月 +ノリツギ 則次 +ノリヅキ 法月 +ノリヅキ 則月 +ノリツグ 則次 +ノリツグ 乗次 +ノリツグ 乘次 +ノリツケ 乗附(乘附) +ノリツケ 乗付 +ノリツネ 則常 +ノリツネ 野里常 +ノリツネ 乗常(乘常) +ノリツネ 法常 +ノリヅミ 法積 +ノリトウ 則藤 +ノリトウ 乗藤 +ノリトウ 則頭 +ノリトウ 乘藤 +ノリトシ 則俊 +ノリトミ 乗富(乘富) +ノリトミ 乗冨(乘冨) +ノリドミ 乗富(乘富) +ノリドミ 乗冨(乘冨) +ノリトモ 則友 +ノリトモ 乗友(乘友) +ノリナ 法名 +ノリナオ 則直 +ノリナカ 法中 +ノリナガ 則永 +ノリナガ 則長 +ノリナガ 乗永(乘永) +ノリナガ 法永 +ノリノ 則野 +ノリノブ 則信 +ノリハシ 法橋 +ノリハシ 乗橋 +ノリハタ 法幡 +ノリハナ 法花 +ノリハマ 乗浜(乘浜) +ノリハマ 乗濱(乘濱) +ノリバヤシ 法林 +ノリハラ 乗原 +ノリハラ 法原 +ノリヒサ 則久 +ノリヒサ 乗久 +ノリヒデ 乗秀(乘秀) +ノリヒラ 紀平 +ノリヒロ 則広 +ノリフサ 則房 +ノリフサ 乗房 +ノリフジ 則藤 +ノリフジ 乗藤 +ノリフネ 乗船(乘船) +ノリフネ 乗舟 +ノリマサ 則政 +ノリマサ 乗政 +ノリマサ 則正 +ノリマツ 乗松 +ノリマツ 則松 +ノリマツ 乘松 +ノリミ 教海 +ノリミズ 法水 +ノリミツ 則光 +ノリミツ 乗光 +ノリミツ 則満 +ノリミツ 乘光 +ノリミネ 乗峯(乘峯) +ノリミネ 乗峰 +ノリミネ 乗嶺 +ノリムネ 則宗 +ノリムネ 法旨 +ノリムネ 乗宗 +ノリムネ 法宗 +ノリムラ 法村 +ノリムラ 則村 +ノリムラ 乗村(乘村) +ノリメ 野里女 +ノリモト 乗本 +ノリモト 則本 +ノリモト 法元 +ノリモト 法本 +ノリモト 則元 +ノリモト 紀元 +ノリモト 宣本 +ノリモト 乗元 +ノリモト 野利本 +ノリモト 乘本 +ノリモト 佱元 +ノリモト 範本 +ノリモノ 乗物 +ノリモリ 則盛 +ノリヤ 糊谷 +ノリヤ 乗矢 +ノリヤス 則安 +ノリヤス 乗安 +ノリヤス 法安 +ノリヤス 軌保 +ノリヤス 則保 +ノリヤス 乘安 +ノリヤス 䡄保 +ノリヤマ 法山 +ノリヤマ 乗山 +ノリヤマ 乘山 +ノリユキ 則行 +ノリユキ 乗行(乘行) +ノリヨシ 法吉 +ノリヨシ 則吉 +ノリヨシ 法由 +ノリワ 法輪 +ノロ 野呂 +ノロ 野路 +ノロ 野露 +ノロ 能呂 +ノロウチ 野呂内 +ノロキ 埜路木 +ノロサコ 野老迫 +ノロセ 野呂瀬 +ノロタ 野呂田 +ノロタ 野老田 +ノロダ 野呂田 +ノワ 能和 +ノワ 野和 +ノワキ 野脇 +ノワキ 能脇 +ノワキ 野分 +ノワダ 野和田 +ノワタリ 野渡 +ノワタリ 能渡 +ノワタリ 埜渡 +ノワラ 野藁 +ノンダ 呑田 +ノンタニ 呑谷 +ノンバラ 呑原 +バ 場 +ハアイ 羽合 +バアイ 場合 +パアク 巴亜久 +パアク 波握 +ハアリ 羽有 +ハイ 羽衣 +ハイ 拝 +ハイ 葉井 +ハイ 灰 +ハイ 俳 +バイ 唄 +バイ 馬医 +バイ 倍 +バイ 馬醫 +ハイイ 灰井 +バイエ 場家 +ハイオ 灰尾 +バイオウ 梅鴬 +バイオウ 梅鶯 +ハイオカ 灰岡 +ハイカ 拝加 +ハイガ 灰賀 +ハイガ 拝賀 +バイカ 梅花 +ハイガキ 灰垣 +ハイカケ 灰掛 +ハイカタ 灰方 +ハイカタ 拝形 +ハイカタ 拜形 +ハイガノ 灰鹿野 +ハイガミ 拝上 +ハイカワ 配川 +ハイカワ 灰川 +ハイカワ 佩川 +ハイカワ 榛川 +ハイカワ 拝川 +バイガン 倍巌 +ハイキ 早岐 +ハイキ 拝生 +ハイキ 拝木 +ハイキ 拜木 +ハイグチ 灰口 +ハイケ 服池 +ハイゲ 灰毛 +バイケ 梅宅 +バイケイ 梅渓 +バイゲツ 梅月 +ハイゴウ 拝郷 +ハイゴウ 拜郷 +バイコウ 梅香 +バイコウ 貝江 +バイコウ 貝光 +ハイサ 羽井佐 +ハイサ 灰佐 +ハイサキ 拝崎 +ハイサキ 灰崎 +ハイサキ 灰咲 +ハイザキ 拝崎 +ハイザキ 灰崎 +ハイザキ 拝嵜 +ハイザキ 拜崎 +ハイザワ 灰澤(灰沢) +ハイシ 羽石 +ハイシ 葉石 +ハイシ 拝師 +ハイシ 拝志 +ハイシ 拝司(拜司) +ハイシ 拝詞 +ハイシ 拜師 +ハイシ 拜志 +ハイシ 拜詞 +ハイジ 拝司(拜司) +バイジ 梅地 +バイシキ 梅敷 +ハイシタ 芸下 +ハイシマ 蓜島 +ハイシマ 配島 +ハイジマ 蓜島 +ハイジマ 配島 +ハイジマ 朏島 +ハイジマ 灰島 +ハイジマ 拝島 +ハイジマ 配嶋 +ハイジマ 蓜嶋 +バイジュ 梅寿(梅壽) +バイショウ 倍賞 +バイショウ 倍償 +ハイズカ 灰塚 +ハイズミ 羽泉 +ハイズミ 灰住 +ハイセ 灰瀬 +ハイソ 羽磯 +ハイソト 灰外 +ハイタ 拝田 +ハイタ 羽板 +ハイダ 灰田 +ハイダ 拝田 +ハイダ 拜田 +ハイダ 羽井田 +ハイダイ 灰台 +ハイタカ 灰高 +ハイタカ 拝高 +ハイダテ 南風立 +ハイタニ 灰谷 +ハイタニ 拝谷 +ハイタマ 灰玉 +ハイタマタイ 灰玉平 +ハイタマダイラ 灰玉平 +ハイチ 拝地(拜地) +ハイチ 羽市 +ハイツカ 灰塚 +ハイヅカ 灰塚 +ハイヅカ 生柄 +ハイデン 拜殿 +ハイト 葉糸 +ハイト 拝戸 +ハイト 灰戸 +ハイト 拜戸 +バイド 梅戸 +ハイトウ 拝藤 +ハイトウ 灰藤 +ハイトウ 配藤 +ハイトウ 拝頭 +ハイトウ 拜藤 +ハイドウ 拝藤 +ハイドウ 拜藤 +バイトウ 梅藤 +バイトウ 梅籐 +ハイトコ 灰床 +ハイナカ 拝中 +ハイニシ 灰西 +ハイニワ 灰庭 +ハイネ 拝根 +ハイノ 生野 +ハイノ 灰野 +ハイノ 拝野 +ハイノ 配野 +ハイノ 南風野 +ハイノ 半井野 +ハイノ 羽井野 +ハイノ 蠅野 +ハイノ 蝿野 +ハイノ 拜野 +ハイノ 沛野 +バイノ 唄野 +バイノ 倍野 +ハイノクチ 閉伊口 +ハイバ 榛葉 +ハイバ 灰庭 +ハイハラ 灰原 +ハイハラ 拝原 +ハイハラ 拜原 +ハイバラ 羽原 +ハイバラ 生原 +ハイバラ 埴原 +ハイバラ 灰原 +ハイバラ 南風原 +ハイバラ 榛原 +ハイバラ 拝原 +ハイバラ 蝿原(蠅原) +ハイバラ 配原 +ハイバラ 拜原 +ハイブチ 灰渕 +ハイムラ 拝村 +ハイモト 灰本 +ハイヤ 灰谷 +ハイヤ 灰屋 +ハイヤマ 灰山 +ハイヤマ 配山 +バイラク 梅落 +バイリン 梅林 +バイリンジ 梅林寺 +ハイロ 葉色 +バイロ 場色 +ハイワ 羽岩 +ハイン 吐院 +ハウタ 葉歌 +ハウチ 葉内 +ハウチ 羽伐 +ハウラ 半浦 +ハウラ 羽浦 +ハウル 葉潤 +ハエ 羽江 +ハエ 南風 +バエ 馬栄(馬榮) +ハエイワ 栄岩 +ハエイワ 生岩 +ハエイワ 榮岩 +ハエウチ 生内 +ハエオ 八重尾 +ハエコシ 這越 +ハエザト 南風里 +ハエダ 蠅田 +ハエダ 蝿田 +ハエダ 栟田 +ハエダテ 南風立 +ハエヅカ 生柄 +ハエナリ 南風成 +ハエニワ 蝿庭 +ハエニワ 蠅庭 +ハエヌキ 萠抜(萌抜) +ハエヌキ 萠拔 +ハエノ 生野 +ハエノ 波江野 +ハエノ 南風野 +ハエノ 蠅野 +ハエノ 蝿野 +ハエノウチ 生内 +ハエハラ 南風原 +ハエバラ 南風原 +ハエバル 南風原 +ハエマツ 生松 +ハエミ 南風見 +ハエムラ 栄村 +ハエモト 栄本 +ハエモト 南風本 +ハエモリ 南風盛 +ハオ 八百 +ハオ 羽尾 +ハオカ 羽岡 +ハオカベ 葉岡部 +ハオト 羽音 +ハオリ 羽織 +ハオリヤ 羽織屋 +ハガ 芳賀 +ハガ 羽賀 +ハガ 羽下 +ハガ 垪和 +ハガ 芳我 +ハガ 葉賀 +ハガ 波賀 +ハガ 塀和 +ハガ 椪 +ハガ 羽我 +ハガ 祝賀 +ハカイ 羽階 +ハガイ 羽谷 +ハガイ 羽飼 +ハガイ 羽貝 +ハガイ 羽賀井 +ハガイト 羽垣内 +バガウチ 場垣内 +ハガキ 羽柿 +ハカク 羽角 +ハカゲ 葉影 +ハカコシ 墓越 +ハカゴシ 墓越 +ハガサキ 羽ケ崎 +ハカシタ 墓下 +ハカセ 葉加瀬 +ハカタ 博田 +ハカタ 羽方 +ハカタ 博多(博夛) +ハカタ 波方 +ハカタ 伯田 +ハカタ 墓田 +ハカタ 羽片 +ハカタ 計田 +ハカタ 葉方 +ハカタ 伯方 +ハカタ 波賀多 +ハガタ 羽方 +ハガタ 波方 +ハガタ 羽賀田 +ハガタ 羽片 +ハガタ 波片 +ハガタ 葉方 +ハガタ 羽形 +ハカタヤ 博多屋 +ハガタヤマ 羽形山 +ハガヌマ 芳賀沼 +ハガネ 羽金 +ハガネ 釼 +ハガネ 羽兼 +ハガネ 葉金 +ハガネ 鋼鉄(鋼鐵) +ハガネ 刃金(刄金) +ハガネ 鋼 +ハカノ 墓野 +ハガノ 波賀野 +ハカベ 伯ケ部 +ハカベ 羽壁 +ハカベ 波壁 +ハカマ 袴 +ハガマ 羽釜 +ハカマエ 墓前 +ハカマキ 袴着 +ハカマギ 袴着 +ハカマザ 袴座 +ハカマタ 袴田 +ハカマダ 袴田 +ハカマダ 羽鎌田 +ハカマタニ 袴谷 +ハカマダニ 袴谷 +ハカマダレ 袴垂 +ハカマツカ 袴塚 +ハカマヅカ 袴塚 +ハカマヤ 袴谷 +ハカマヤ 袴矢 +ハカマヤ 袴家 +ハカミ 袴見 +ハガミ 葉上 +ハガミ 羽上 +バガミ 馬上 +ハカモト 博本 +ハカモト 墓本 +ハガヤ 芳谷 +ハガヤ 羽谷 +ハカヤチ 墓谷内 +ハカヤマ 博山 +ハカリ 計 +ハカリ 秤 +ハカリ 議 +ハカリ 図 +ハカリ 量 +ハガリ 葉狩 +ハガリ 羽雁 +ハカリイシ 計石 +ハカリクラ 計倉 +ハカリダニ 計谷 +ハカリダニ 斗谷 +ハカリノ 計野 +ハカリヤ 計屋 +ハカリヤ 秤谷 +ハカリヤ 秤屋 +ハカリヤ 計谷 +ハカワ 波川 +ハガワ 芳川 +ハガワ 羽川 +ハガワ 巴川 +ハガワ 羽河 +ハガワ 彼川 +バガワ 馬川 +ハキ 羽木 +ハキ 波木 +ハキ 葉木 +ハギ 八木 +ハギ 萩 +ハギ 羽木 +ハギ 波木 +ハギ 葉木 +ハギ 羽儀 +ハキアイ 吐合 +ハキイ 波木井 +ハギイ 波木井 +ハギイ 萩井 +ハギイ 波木居 +ハギイケ 萩池 +ハギイワ 剥岩 +ハギイワ 萩岩 +ハギウ 萩生 +ハギウエ 萩上 +ハギウダ 萩生田 +ハギウダ 萩宇田 +ハギウチ 萩内 +ハギウラ 萩浦 +ハギエ 流合 +ハギエダ 萩枝 +ハギオ 萩尾 +ハギオ 萩生 +ハギオイ 萩生 +ハギオイタ 萩生田 +ハギオカ 萩岡 +ハギオダ 萩小田 +ハギオダ 萩尾田 +ハギオリ 萩折 +ハギカミ 萩上 +ハギカワ 萩川 +ハギグチ 萩口 +ハギクボ 萩久保 +ハギクラ 萩倉 +ハギコバ 萩木場(萩木塲) +ハギサカ 萩坂 +ハギサカイ 萩境 +ハギサキ 萩崎 +ハギサキ 萩嵜 +ハギザキ 萩崎 +ハギザキ 萩嵜 +ハギサコ 萩迫 +ハギサト 萩里 +ハギザト 萩里 +ハギサワ 萩沢 +ハギサワ 萩澤 +ハギサワ 葉木沢 +ハギザワ 萩沢 +ハギザワ 萩澤 +ハギシタ 萩下 +ハギシマ 萩島 +ハギシマ 萩嶋 +ハギシマ 萩嶌 +ハギショウ 萩庄 +ハギス 萩巣 +ハギスミ 萩隅 +ハキタ 吐田 +ハギタ 萩田 +ハギタ 波北 +ハギタ 芳木田 +ハギダ 萩田 +ハギダイ 萩台 +ハギダイ 萩臺 +ハギダイラ 萩平 +ハギタニ 萩谷 +ハギツカ 萩塚 +ハギヅカ 萩塚 +ハキヅメ 掃詰 +ハギトウ 萩藤 +ハギナカ 萩中 +ハギナガ 萩永 +ハギナガ 脛永 +ハギニワ 萩庭 +ハギヌマ 萩沼 +ハギネ 萩根 +ハギノ 萩野 +ハギノ 萩埜 +ハギノウチ 萩之内 +ハギノサキ 萩ノ崎 +ハギノシタ 萩野下 +ハギノマ 萩野間 +ハギノマエ 萩ノ前 +ハギノマエ 萩之前 +ハギノモリ 萩森 +ハギノヤ 萩谷 +ハギノヤ 萩野谷 +ハギノヤ 萩ノ谷 +ハギノヤ 萩野矢 +ハギノヤ 萩野屋 +ハギノワキ 萩ノ脇 +ハギノワキ 萩の脇 +ハギハシ 萩橋 +ハギハラ 萩原 +ハギハラ 蘒原 +ハギヒラ 萩平 +ハギベ 萩部 +ハギマ 萩間 +ハギマエ 萩前 +ハギミネ 萩峯 +ハギミネ 萩嶺 +ハギムラ 萩村 +ハギモト 萩本 +ハギモト 萩元 +ハギモト 羽木本 +ハキモリ 掃守 +ハギモリ 萩森 +ハギモリ 萩守 +ハギヤ 萩谷 +ハギヤ 萩屋 +ハギヤ 萩家 +ハギヤ 萩矢 +ハギヤス 萩保 +ハギヤマ 萩山 +ハギュウ 萩生 +ハギュウダ 萩生田 +ハギユキ 萩行 +ハギョウ 羽行 +ハキラ 羽明 +ハキリ 羽切 +ハキリ 波切 +ハギリ 羽切 +ハギリ 波切 +ハギリ 葉桐 +ハギワ 萩輪 +ハギワキ 兀脇 +ハギワキ 萩脇 +ハギワタリ 萩渡 +ハギワラ 萩原 +ハギワラ 蘒原 +ハギワラ 羽木原 +ハク 白 +ハク 白玖 +ハク 葉久 +ハク 伯 +ハク 博 +バク 模 +バク 場工 +ハクイ 白井 +ハクイ 伯井 +ハクイ 羽喰 +ハクイ 羽咋 +ハクイ 博井 +ハクイ 波食 +ハクイ 箔井 +ハグイ 羽喰 +ハグイ 羽杭 +ハクイシ 白石 +ハクウン 白雲 +ハクオウ 白鶯 +ハクオウ 白鴬 +ハクオウ 白央 +ハクカワ 伯川 +ハクガワ 伯川 +ハクギ 伯儀 +ハクギン 白銀 +ハクグリ 白栗 +ハクゴク 白極 +ハクザ 白座 +ハグサ 蛇草 +ハグサ 葉草 +ハグサ 羽草 +ハグサ 蛇艸 +ハクサワ 白沢 +ハクサワ 白澤 +ハクザワ 白澤 +ハクザン 白山 +ハクザン 伯山 +ハクシ 白子 +ハクシマ 白島 +ハクスイ 白水 +ハクスイ 伯水 +ハクセイ 白清 +ハクセン 白泉 +ハクゼン 白善 +ハクタ 迫田 +ハクタ 白田 +ハクタ 博田 +ハクタ 伯田 +ハクダ 白田 +バクタ 麦田 +ハクタニ 白谷 +ハクタニ 伯谷 +ハクタニ 箔谷 +ハグチ 羽口 +ハグチ 葉口 +バグチ 場口 +ハクチョウ 白鳥 +ハクツル 白鶴 +ハクト 白戸 +ハクト 白都 +ハクトウ 白藤 +ハクトウ 白頭 +ハクノ 白野 +ハクノ 伯野 +ハクノ 泊野 +ハクバ 薄葉 +ハクバ 白馬 +ハクハタ 白畠 +ハクハラ 白原 +ハクヒサ 博久 +ハクベ 伯部 +ハクベ 伯ケ部 +ハクホウ 白鳳 +ハクホウ 白鵬 +ハクマ 白間 +ハグマ 羽熊 +ハクマイ 白米 +ハクマエ 白前 +ハクマサ 白政 +ハクマタ 白又 +ハクマル 白丸 +ハクマン 白曼 +ハクミ 伯美 +ハクミツ 白光 +ハクムラ 白村 +ハクモト 白本 +ハクモト 伯本 +ハクモト 箔本 +ハクヤ 白谷 +ハクヤ 泊谷 +ハクヤ 薄谷 +ハクヤ 箔谷 +バクヤ 麦谷 +ハクヤマ 吐山 +ハクラ 土倉 +ハクラ 羽倉 +ハクラ 葉倉 +ハクラ 白良 +ハグラ 土倉 +ハグラ 羽倉 +ハクライ 舶来 +ハクラク 白楽 +ハクラク 白樂 +ハグリ 羽栗 +ハグリ 葉栗 +ハクリュウ 白竜 +ハクロ 白露 +ハグロ 歯黒 +ハグロ 羽黒 +バクロダ 馬喰田 +ハケ 羽毛 +ハケ 八毛 +ハケ 波毛 +バケ 場家 +ハゲオ 兀尾 +ハゲコシ 兀越 +ハゲシタ 兀下 +ハゲシタ 峐下 +ハゲシタ 禿下 +ハゲシタ 屼下 +ハケタ 羽毛田 +ハケタ 八桁 +ハケダ 羽毛田 +ハゲツカ 兀塚 +ハゲヅカ 兀塚 +ハゲノシタ 屼ノ下 +ハゲノシタ 屼の下 +ハゲハシ 兀橋 +ハゲミ 底 +ハゲミ 励 +ハゲミ 勵 +ハゲヤマ 兀山 +ハゲヤマ 峐山 +ハコ 箱 +ハコ 波古 +ハコ 葉古 +ハコイ 箱井 +ハコイ 羽古井 +ハコイエ 箱家 +ハコイシ 箱石 +ハコイワ 箱岩 +ハコウ 波光 +バゴウ 場合 +バゴウ 馬郷 +ハコエ 箱江 +ハコオカ 箱岡 +ハコオロシ 箱卸 +ハコガミ 箱上 +ハコカワ 箱川 +ハコガワ 箱川 +ハコキ 箱木 +ハコギ 箱木 +ハコギ 函城 +ハコギ 凾城 +ハコサキ 箱崎 +ハコザキ 箱崎 +ハコザキ 筥崎(筥嵜) +ハコザワ 箱沢 +ハコジ 箱司 +バコシ 馬越 +ハコシマ 箱島 +ハコシマ 箱嶋 +ハコシマ 箱嶌 +ハコジマ 箱島 +ハコジマ 箱嶋 +ハコジョウ 箱上 +ハコセ 箱瀬 +ハコタ 箱田 +ハコダ 箱田 +ハコダ 羽子田 +ハコダ 八甲田 +ハコダテ 函館 +ハコダテ 箱館 +ハコダテ 箱舘 +ハコダテ 凾館 +ハコタニ 箱谷 +ハコタニ 波来谷 +ハコネ 箱根 +ハコバヤシ 箱林 +ハコビ 運 +ハコベ 箱部 +ハコマル 箱丸 +ハコミヤ 箱宮 +ハコムネ 箱棟 +ハコモト 箱本 +ハコモリ 箱守 +ハコモリ 箱森 +ハコヤ 箱谷 +ハコヤ 箱家 +ハコヤナギ 箱柳 +ハコヤマ 箱山 +ハゴロモ 羽衣 +ハサ 波佐 +ハサ 葉佐 +ハサ 羽佐 +ハザ 波佐 +ハザ 羽座 +ハザ 波座 +ハサイ 葉佐井 +ハサオ 波佐尾 +ハザオカ 羽座岡 +ハサカ 羽坂 +ハサカ 葉坂 +ハサカ 羽阪 +ハサカ 葉阪 +ハザカ 羽坂 +ハザカ 葉坂 +ハザガワ 羽座川 +ハサキ 羽崎 +ハサキ 端崎 +ハサキ 波崎(波嵜) +ハザキ 羽崎 +ハザキ 破崎 +バサキ 馬崎 +バサキ 場崎 +バサキ 場先 +バザキ 馬崎 +バザキ 場崎 +ハサグチ 狭口 +ハサコ 羽迫 +ハサコ 端迫 +ハサコ 狭子 +ハサコ 羽佐古 +ハサコ 狭古 +ハサコ 葉迫 +ハザコ 羽迫 +ハザコ 狭子 +ハザコ 狹子 +ハザシ 羽指 +ハサシタ 枷下 +ハサダ 羽佐田 +ハサダ 架田 +ハサダ 狭田 +ハサダ 羽左田 +ハサダ 波早田 +ハサダ 狹田 +ハサダ 权田 +ハザタ 𨑕田 +ハサタニ 架谷 +ハサタニ 波佐谷 +ハサド 挾土 +ハサド 挟土 +ハザト 羽里 +ハザノ 硲野 +ハサバ 枷場 +ハサバ 架場 +ハサバ 狭場(狹場) +ハサバ 波佐場 +ハサバ 挟場 +ハサバ 挾場 +ハザバ 狭場(狹場) +ハサマ 迫 +ハサマ 狭間 +ハサマ 迫間 +ハサマ 挾間 +ハサマ 波佐間 +ハサマ 狹間 +ハサマ 挟間 +ハザマ 迫 +ハザマ 間 +ハザマ 狭間 +ハザマ 硲 +ハザマ 迫間 +ハザマ 挾間 +ハザマ 羽間 +ハザマ 陌間 +ハザマ 波佐間 +ハザマ 波左間 +ハザマ 狹間 +ハザマ 玻座真(玻座眞) +ハザマ 挟間 +ハザマ 羽佐間 +ハザマ 羽左間 +ハザマ 架間 +ハザマ 礀 +ハザマ 硲間 +ハザマ 廻間 +ハザマ 羽様 +ハザマ 峡 +ハザマ 狭 +ハザマ 馳間 +ハザマ 玻座間 +ハザマ 波座真 +ハサマダ 狭間田 +ハサマダ 挾間田 +ハサマダ 挟間田 +ハザマダ 狭間田 +ハザマダ 挾間田 +ハザマダ 挟間田 +ハサミ 八社宮 +ハサミダニ 挟谷 +ハサミダニ 挾谷 +ハサモト 波佐本 +ハサモト 挾本 +ハザモト 波佐本 +ハサヤ 架谷 +ハザワ 羽沢 +ハザワ 羽澤 +ハザワ 葉沢 +ハザワ 葉澤 +バザワ 馬澤 +ハサン 波山 +ハシ 土師 +ハシ 橋 +ハシ 端 +ハシ 枦 +ハシ 櫨 +ハシ 波止 +ハシ 波紫 +ハシ 吐師 +ハシ 箸 +ハシ 波志 +ハシ 羽紫 +ハシ 觜 +ハジ 土師 +ハジ 羽地 +ハジ 枦 +ハジ 櫨 +ハジ 吐師 +ハジ 波治 +ハジ 士師 +ハジ 羽次 +バシ 馬司 +バジ 馬路 +バジ 馬地 +ハシイ 橋井 +ハシイ 走井 +ハシイ 端井 +ハシイ 橋居 +ハシイエ 橋家 +ハシウエ 橋上 +ハシウエ 梯上 +ハシウエ 橋植 +ハシウチ 橋内 +ハシウド 間人 +ハシウメ 橋梅 +ハシウラ 橋浦 +ハシウリ 橋瓜 +ハシエダ 橋枝 +ハシオ 橋尾 +ハシオ 箸尾 +ハシオ 走尾 +ハシオカ 橋岡 +ハシオカ 端岡 +ハシオカ 橋丘 +ハシオク 橋奥 +ハシオタニ 箸尾谷 +ハシオダニ 箸尾谷 +ハシオリ 橋折 +ハシガ 橋向 +ハジカ 初鹿 +ハジカ 羽鹿 +ハシカイ 橋階 +ハシガイ 梯谷 +ハシガイト 橋垣戸 +ハシガキ 橋垣 +ハシガキ 橋柿 +ハシカケ 橋掛 +ハシガサコ 橋ケ迫 +ハシカタ 箸方 +ハシカタ 橋方 +ハシカタ 箸片 +ハシガタ 橋形 +ハジカノ 初鹿野 +ハシカベ 橋壁 +ハシカミ 橋上 +ハシカミ 階上 +ハシガミ 橋上 +ハシガミ 階上 +ハジカミ 薑 +ハシガヤ 橋ケ谷 +ハシガヤ 梯谷 +ハシカワ 橋川 +ハシカワ 端川 +ハシキ 枦木 +ハシキ 橋木 +ハシキ 端木 +ハシキタ 橋北 +ハシキハラ 枦木原 +ハシギワ 橋際 +ハシク 橋工 +ハシグチ 橋口 +ハシグチ 端口 +ハシグチ 槁口 +ハシクニ 橋国 +ハシクニ 橋國 +ハシクマダ 橋熊田 +ハシクラ 橋倉 +ハシクラ 端倉 +ハシクラ 箸蔵 +ハシクラ 槁倉 +ハシグラ 橋倉 +ハシコ 橋子 +ハシゴ 階子 +ハシゴエ 橋越 +ハシコミ 枦込 +ハシサカ 橋坂 +ハシサカ 橋阪 +ハシザカ 橋坂 +ハシザカ 端坂 +ハシサキ 橋崎 +ハシサキ 端崎 +ハシザキ 橋崎 +ハシザキ 端崎 +ハシザキ 走崎 +ハシザキ 橋嵜 +ハシザキ 觜崎 +ハシサケ 橋酒 +ハシザケ 橋酒 +ハシサコ 橋迫 +ハシサコ 橋佐古 +ハシザコ 橋迫 +ハシサト 橋里 +ハシザト 橋里 +ハシザワ 橋沢 +ハシザワ 橋澤 +ハシジ 端地 +ハシシタ 橋下 +ハシシバ 橋芝 +ハシジマ 橋島 +ハシジマ 橋嶋 +ハシジョウ 端浄 +ハシジリ 橋尻 +ハシシン 橋新 +ハシズ 橋津 +ハシスギ 橋杉 +ハシズナ 橋砂 +ハシズミ 橋角 +ハシズミ 橋積 +ハシズミ 橋住 +ハシズミ 橋隅 +ハシズメ 橋爪 +ハシズメ 橋詰 +ハシズメ 橋都 +ハシズメ 槁詰 +ハシセコ 橋迫 +ハシゾエ 橋添 +ハシゾノ 橋園 +ハシタ 橋田 +ハシタ 羽下 +ハシタ 坡下 +ハシタ 枦田 +ハシダ 橋田 +ハシダ 端田 +ハシダ 櫨田 +ハシダ 枦田 +ハシダイ 橋台 +ハシダイ 橋臺 +ハシタカ 橋高 +ハシダカ 橋高 +ハシダシ 走出 +ハシタテ 橋立 +ハシタテ 外立 +ハシダテ 橋立 +ハシダテ 外立 +ハシダテ 橋達 +ハシダテ 橋建 +ハシタニ 橋谷 +ハシタニ 端谷 +ハシタニ 長子谷 +ハシダン 枦段 +ハシヂ 端地 +ハシチカ 端近 +ハシツ 橋津 +ハシヅ 橋都 +ハシヅ 橋津 +ハジツ 羽実 +ハジツ 羽實 +ハシツカ 橋塚 +ハシヅカ 橋塚 +ハシヅカ 箸塚 +ハシヅミ 橋積 +ハシツメ 橋爪 +ハシツメ 橋詰 +ハシヅメ 橋爪 +ハシヅメ 橋詰 +ハシヅメ 橋都 +ハシヅメ 端詰 +ハシヅメ 橋誥 +ハシヅメ 槁爪 +ハシヅヤ 橋津谷 +ハシデ 走出 +ハシデ 橋出 +ハシデ 橋手 +ハシテラ 橋寺 +ハシデラ 橋寺 +ハシト 橋戸 +ハシド 橋戸 +ハシド 橋渡 +ハシド 橋度 +ハシド 端戸 +ハシトコ 橋床 +ハシドコ 橋床 +ハシトミ 橋富 +ハシトミ 橋冨 +ハシトミ 半蔀 +ハシドミ 橋富 +ハシドミ 橋冨 +ハシトメ 橋留 +ハシナカ 橋中 +ハシナカ 箸中 +ハシナガ 橋長 +ハシナガ 橋永 +ハシナミ 橋波 +ハシナミ 橋並 +ハシナヤ 橋納谷 +ハシニシ 橋西 +ハシヌマ 橋沼 +ハシネ 橋根 +ハシノ 橋野 +ハシノ 端野 +ハシノ 橋埜 +ハシノ 土師野 +ハシノ 箸野 +ハシノ 槁野 +ハジノ 土師野 +ハシノウエ 橋上 +ハシノキ 枦木 +ハシノクチ 橋之口 +ハシノクチ 橋ノ口 +ハシノグチ 橋之口 +ハシノグチ 橋ノ口 +ハシノツメ 橋之爪 +ハシノブ 橋信 +ハシノモト 橋ノ本 +ハシノリ 一法 +ハシバ 橋場 +ハシバ 榛葉 +ハシバ 羽柴 +ハシバ 端場 +ハシバ 橋端 +ハシバ 波柴 +ハシバ 葉柴 +ハシバ 橋羽 +ハシバ 羽芝 +ハシバ 端羽 +ハシバ 橋波 +ハシバ 櫨場(櫨塲) +ハシバ 橋馬 +ハシバ 橋葉 +ハシバ 橋塲 +ハシバ 棒葉 +ハシパ 橋端 +ハシハタ 橋端 +ハシハタ 橋畑 +ハシハタ 橋秦 +ハシバタ 橋端 +ハジハタ 櫨畑 +ハシハマ 橋浜(橋濱) +ハシバミ 榛 +ハシハヤタ 端早田 +ハシハラ 橋原 +ハシハラ 梁原 +ハシハラ 端原 +ハジハラ 土師原 +ハシヒラ 橋平 +ハシヒロ 橋広(橋廣) +ハシベ 橋部 +ハシベ 橋辺 +ハシベ 走辺 +ハシベ 橋邊 +ハシベ 橋邉 +ハシベ 走邊 +ハシボウ 橋傍 +ハシボリ 橋堀 +ハシマ 飯島 +ハシマ 橋間 +ハシマ 羽島 +ハシマ 羽嶋 +ハシマ 端島 +ハシマ 覇島 +ハシマ 波嶋 +ハシマ 箸間 +ハジマ 羽島 +ハジマ 羽嶋 +ハジマ 弭間 +ハジマ 葉島 +ハシマエ 橋前 +ハシマサ 橋正 +ハシマル 橋丸 +ハシマワリ 橋廻 +ハシミ 橋見 +ハシミゾ 橋溝 +ハシミツ 橋満(橋滿) +ハシムカイ 橋向 +ハシムキ 橋向 +ハシムコ 橋向 +ハシムコウ 橋向 +ハシムラ 橋村 +ハシムラ 端村 +ハシメ 橋目 +ハジメ 元 +ハジメ 一 +ハジメ 朔 +ハジメ 魁 +ハジメサワ 始沢 +ハジメサワ 始澤 +ハジメタ 始田 +ハジメダ 始田 +ハシモト 橋本 +ハシモト 橋元 +ハシモト 橋下 +ハシモト 端本 +ハシモト 枦元 +ハシモト 箸本 +ハシモト 枦本 +ハシモト 槁本 +ハシモト 端元 +ハシモト 觜本 +ハシモト 土師元 +ハジモト 櫨本 +ハシモトダニ 橋本谷 +ハシモトヤ 橋本屋 +ハシモリ 橋森 +ハシモリ 橋守 +ハシモリヤ 橋守屋 +ハシヤ 橋谷 +ハシヤ 端谷 +ハシヤ 橋屋 +ハシヤ 箸屋 +ハシヤ 橋弥 +ハシヤ 橋矢 +ハシヤ 橋彌 +ハジャケ 羽者家 +ハシヤタ 橋谷田 +ハシヤダ 橋谷田 +ハシヤダ 橋矢田 +ハシヤマ 枦山 +ハシヤマ 端山 +ハシヤマ 橋山 +ハジヤマ 枦山 +ハシユイ 橋結 +ハジュウ 羽重 +バシュウダ 場集田 +バシュク 馬宿 +バショ 馬所 +バショ 場所 +バショ 厩所 +ハショウ 羽生 +ハジョウ 羽城 +バショウ 芭蕉 +バショウ 馬生 +バショウ 場勝 +バショウ 場正 +バショウ 馬庄 +バジョウ 馬上 +バジョウエン 馬乗園(馬乘園) +ハジョウタ 羽上田 +ハジョウダ 羽上田 +バショウマツ 場生松 +バショウミヤ 芭蕉宮 +バショウメ 馬上免 +ハシヨシ 橋吉 +ハシラ 柱 +ハシライ 柱井 +ハシラオ 柱尾 +ハシラタニ 柱谷 +ハシラダニ 柱谷 +ハシラノ 柱野 +ハシラマツ 柱松 +ハシラモト 柱本 +ハシラヤマ 柱山 +ハシリ 走 +ハシリ 走り +ハシリ 走里 +ハジリ 羽尻 +ハジリ 波尻 +バジリ 馬尻 +ハシリイ 走井 +ハシリウラ 走浦 +ハシリカワ 走川 +ハシリサカ 走坂 +ハシリザキ 走崎 +ハシリデ 走出 +ハシロ 羽白 +ハシロ 羽代 +ハシロ 羽城 +ハジロ 羽白 +ハジロ 羽代 +ハシワ 橋和 +ハシワカ 橋若 +ハシワキ 橋脇 +ハシワタ 橋渡 +ハシワダ 橋和田 +ハシワタリ 橋渡 +ハス 蓮 +ハズ 羽豆 +ハズ 幡豆 +ハズ 幡頭 +ハズ 万豆 +ハズ 萬豆 +ハスイ 蓮井 +ハスイ 蓮居 +ハスイ 蓮容 +ハズイ 筈井 +ハスイケ 蓮池 +ハスイケ 𨂊池 +ハスウエ 蓮上 +ハスウジ 蓮氏 +ハスウラ 蓮浦 +ハスエ 蓮江 +ハスエ 葉末 +ハズエ 葉末 +ハスオ 蓮尾 +ハスオ 蓬尾 +ハスオ 蓮生 +ハズオ 筈尾 +ハスオカ 蓮岡 +ハスカ 蓮香 +ハスガタ 蓮潟 +ハスガタ 蓮形 +ハスガヤ 蓮ケ谷 +ハスカワ 蓮川 +ハズキ 筈木 +バスギ 馬杉 +ハズク 波津久 +ハスクマ 蓮阿 +ハスコ 蓮子 +ハスコ 蓬子 +ハスザワ 蓮沢(蓮澤) +ハスシ 蓮子 +ハスシタ 蓮下 +ハスズミ 蓮住 +ハスタ 蓮田 +ハスダ 蓮田 +ハスダ 荷田 +ハスダ 波須田 +ハスタニ 蓮谷 +ハスタニ 蓮渓 +ハズタニ 筈谷 +ハスタネ 蓮胤 +ハスデラ 蓮寺 +ハスナカ 蓮中 +ハスナガ 蓮長 +ハスナミ 蓮波 +ハスヌマ 蓮沼 +ハスノ 蓮野 +ハスノカ 蓮香 +ハスバ 蓮場 +ハスバ 荷葉 +ハスバヤシ 蓮林 +ハスハラ 蓮原 +ハスブチ 蓮渕 +ハスホ 蓮保 +ハスマ 蓮間 +ハズマ 弭間 +ハスマル 蓮丸 +ハスミ 蓮見 +ハスミ 蓮実 +ハスミ 羽角 +ハスミ 荷見 +ハスミ 羽澄 +ハスミ 羽住 +ハスミ 羽隅 +ハスミ 波澄 +ハスミ 蓮實 +ハスミ 葉住 +ハスミ 蓮水 +ハズミ 羽角 +ハズミ 羽澄 +ハズミ 羽住 +ハズミ 羽隅 +ハズミ 筈見 +ハズミ 波積 +ハズミ 葉済 +ハズミ 葉住 +ハズミ 筈箕 +ハスミズ 蓮水 +ハスムネ 蓮宗 +ハスムラ 蓮村 +ハスムロ 蓮室 +ハスモト 蓮本 +ハスモト 蓮元 +ハスモト 蓬本 +ハズモト 筈元 +ハスヤ 蓮谷 +ハスヤ 蓮舎 +ハスヤ 芙家 +ハスヤマ 蓮山 +ハズヤマ 筈山 +ハズレ 端 +ハスワ 蓮輪 +ハスワ 蓮把 +ハスワ 蓮杷 +ハセ 長谷 +ハセ 土師 +ハセ 初瀬 +ハセ 八瀬 +ハセ 羽瀬 +ハセ 波瀬 +ハセ 馳 +ハセ 羽勢 +ハセ 粶(粶) +ハセ 波勢 +ハセ 葉瀬 +ハセ 破瀬 +ハゼ 土師 +ハゼ 枦 +ハゼ 櫨 +ハゼ 𥽜 +ハセアイ 長谷合 +ハセイ 長谷井 +ハセイ 波瀬井 +ハセイ 波青 +ハゼイ 櫨井 +ハゼイ 枦井 +ハセオ 長谷尾 +ハセオ 長谷雄 +ハセオ 馳尾 +ハセオ 長谷生 +ハセオカ 長谷岡 +ハゼオカ 枦岡(櫨岡) +ハセオドリ 流踊 +ハセガキ 葉瀬垣 +ハセカワ 長谷川 +ハセカワ 長谷河 +ハセガワ 長谷川 +ハセガワ 初瀬川 +ハセガワ 馳川 +ハセガワ 走川 +ハセガワ 沙魚川 +ハセガワ 長谷河 +ハセガワ 櫨川 +ハセガワ 枦川 +ハセガワ 糠川 +ハセガワ 八瀬河 +ハセガワ 羽瀬川 +ハセガワ 波瀬川 +ハセガワ 泊瀬川 +ハセガワ 早谷川 +ハセガワ 長瀬川 +ハセガワ 八瀬川 +ハセガワ 葉瀬川 +ハゼカワ 沙魚川 +ハゼカワ 櫨川 +ハゼカワ 枦川 +ハセキ 土赤 +ハセキ 破石 +ハゼキ 枦木 +ハゼキ 櫨木 +ハゼキ 羽関 +ハセグチ 長谷口 +ハゼグチ 枦口 +ハセクラ 支倉 +ハセコ 羽迫 +ハセサカ 長谷坂 +ハセサカ 長谷阪 +ハセザカ 長谷坂 +ハセザカ 長谷阪 +ハセザキ 長谷崎 +ハセザキ 波瀬崎 +ハセザキ 羽瀬崎(羽瀬嵜) +ハセザキ 馳嵜 +ハセザワ 長谷沢 +ハセザワ 長谷澤 +ハセザワ 馳沢 +ハセザワ 馳澤 +ハゼシタ 枦下(櫨下) +ハセジマ 長谷島 +ハセジマ 長谷嶋 +ハセダ 羽生田 +ハセダ 長谷田 +ハセダ 馳田 +ハセダ 羽世田 +バセダ 芭瀬田 +ハセダカ 長谷高 +ハセダカ 長谷高 +ハセチ 長谷地 +ハセツ 長谷津 +ハセヅカ 長谷塚 +ハセデ 長谷出 +ハセトウ 長谷藤 +ハセドウ 長川堂 +ハセナカ 長谷中 +ハゼナカ 櫨中 +ハセヌマ 長谷沼 +ハセノ 長谷野 +ハゼノ 櫨野 +ハゼノ 枦野 +ハゼノキ 枦木 +ハゼノキ 櫨木 +ハゼノキ 穂木 +ハセバ 長谷場 +ハセバ 長谷波 +ハセバ 枦場 +ハセバ 櫨場(櫨塲) +ハセバ 羽瀬場 +ハゼハタ 櫨畑 +ハゼハタ 枦畑 +ハゼバタ 櫨畑 +ハゼバヤシ 櫨林 +ハゼバヤシ 枦林 +ハセハラ 羽瀬原 +ハセハラ 長谷原 +ハゼハラ 櫨原 +ハゼハラ 枦原 +ハセヒラ 馳平 +ハゼフチ 枦渕 +ハゼブチ 枦渕 +ハゼブチ 枦淵 +ハセベ 長谷部 +ハセベ 支部 +ハセベ 忰部 +ハセベ 馳部 +ハセベ 初瀬部 +ハセボ 長谷保 +ハセマ 長谷馬 +ハセミ 長谷見 +ハセミ 長谷美 +ハセムラ 長谷村 +ハゼムラ 櫨村 +ハゼムラ 枦村 +ハセメ 長谷目 +ハセモト 長谷本 +ハゼモト 枦元 +ハゼモト 櫨本 +ハゼモト 枦本 +ハゼモト 櫨元 +ハセモリ 葉勢森 +ハセヤ 長谷屋 +ハセヤ 長瀬谷 +ハセヤマ 長谷山 +ハセヤマ 波瀬山 +ハセヤマ 八世山 +ハゼヤマ 枦山 +ハゼヤマ 櫨山 +ハセヨリ 馳寄 +ハソカワ 破磯川 +ハソベ 羽曽部 +ハソベ 羽曾部 +ハソベ 長曽部 +ハソベ 長曾部 +ハソメ 羽染 +ハゾメ 羽染 +ハゾラ 羽昊 +ハタ 畑 +ハタ 秦 +ハタ 羽田 +ハタ 八田 +ハタ 畠 +ハタ 波多 +ハタ 波田 +ハタ 端 +ハタ 羽太 +ハタ 幡 +ハタ 籏 +ハタ 泰 +ハタ 葉田 +ハタ 漢 +ハタ 羽多 +ハタ 旗 +ハタ 幡多 +ハタ 機 +ハタ 八多 +ハタ 䄅 +ハタ 榛 +ハタ 奏 +ハタ 羽夛 +ハタ 波夛 +ハタ 䅈 +ハダ 秦 +ハダ 羽田 +ハダ 波多 +ハダ 波田 +ハダ 葉田 +ハダ 羽多 +ハダ 派田 +バタ 場田(塲田) +バダ 馬田 +バダ 場田(塲田) +ハタアナ 秦穴 +ハタイ 畑井 +ハタイ 幡井 +ハタイ 畠井 +ハタイ 端井 +ハタイ 秦井 +ハタイ 葉泰 +バタイ 馬袋 +バタイ 馬躰 +バタイ 馬体 +ハタイザコ 畑井迫 +ハタイシ 畑石 +ハタイシ 畠石 +ハタイタ 畑板 +ハタイダ 畑井田 +ハタイデ 幡出 +ハタウエ 畑上 +ハタウチ 畑内 +ハタウチ 畠内 +ハタウラ 畑浦 +ハタウラ 羽田浦 +ハタエ 波多江 +ハタエ 畑江 +ハタエ 畠江 +ハタエ 幡江 +ハタエ 波田江 +ハタエ 籏江(簱江) +ハタエダ 廿枝 +ハタエダ 畑枝 +ハタエダ 畠枝 +ハタオ 畑尾 +ハタオ 旗生 +ハタオ 畠尾 +ハタオ 羽多尾 +ハタオ 畠生 +ハタオカ 畑岡 +ハタオカ 畠岡 +ハタオカ 秦岡 +ハタオカ 籏岡 +ハタオカ 旗岡 +ハタカ 畑賀 +ハタカ 羽高 +ハタカ 畑加 +ハタガ 畑賀 +ハタガキ 畑垣 +ハタガキ 幡垣 +ハタガキ 畠垣 +ハタガキ 旗垣 +ハタガキ 籏垣 +ハタカケ 幡掛 +ハタガサコ 畑ケ迫 +ハタガシラ 畑頭 +ハタガシラ 畠頭 +ハダカノ 裸野 +ハタカマ 幡鎌 +ハタカミ 畠上 +ハタガミ 畑上 +ハタガミ 幡上 +ハタガミ 播上 +ハタガミ 畠上 +ハタガヤ 畑ケ谷 +ハタカワ 畑川 +ハタカワ 幡川 +ハタカワ 旗川 +ハタカワ 畠川 +ハタガワ 畑川 +ハタガワ 幡川 +ハタガワ 幟川 +ハタガワ 旗川 +ハタガワ 畠河 +ハタガワ 畠川 +ハタガワ 八多川 +ハタキ 畑木 +ハタキ 畠木 +ハタキ 羽滝(羽瀧) +ハタキ 畑帰 +ハタギ 畑木 +ハタギ 幡木 +ハダキ 葉抱 +ハダキ 羽滝(羽瀧) +ハタギシ 畑岸 +ハタキヤ 廿木屋 +ハタキヤマ 畑木山 +ハタギワ 畑際 +ハタクイ 幡杭 +ハタクス 畑楠 +ハタグチ 畑口 +ハタグチ 畠口 +ハタグチ 端口 +ハタグチ 秦口 +ハタクニ 羽田国 +ハタクボ 畠久保 +ハタクボ 畑窪 +ハタクボ 畑久保 +ハタグロ 畠黒 +ハタケ 畠 +ハタケ 羽竹 +ハタケ 葉武 +ハタケ 畑毛 +ハタケ 畑ケ +ハタケ 畠ケ +ハタケ 畠毛 +ハタケザワ 畑沢 +ハタケザワ 畠澤 +ハタケタ 圃田 +ハタケダ 畑田 +ハタケダ 畠田 +ハタケダ 圃田 +ハタケダテ 畠舘 +ハタケダテ 畠館 +ハタケナカ 畑中 +ハタケナカ 畠中 +ハタケナカ 畑ケ中 +ハタケナカ 畠ケ中 +ハタケホリ 畠堀 +ハタケボリ 畠堀 +ハタケモト 畠本 +ハタケヤマ 畠山 +ハタケヤマ 畑山 +ハタケヤマ 畑ケ山 +ハタケヤマ 圃山 +ハタコ 畑古 +ハタゴ 畑後 +ハタゴウチ 畑河内 +ハタコシ 波多腰 +ハタコシ 畑越 +ハタコシ 波田腰 +ハタコシ 波夛腰 +ハタゴシ 波多腰 +ハタゴシ 畑腰 +ハタサ 畑佐 +ハタサカ 畠坂 +ハタサカ 幡坂 +ハタサカ 畑坂 +ハタサカ 畑阪 +ハタサキ 畑崎 +ハタサキ 畑先 +ハタサキ 幢崎 +ハタサキ 籏先 +ハタザキ 畑崎 +ハタザキ 籏崎 +ハタザキ 旗崎 +ハタザキ 畠崎 +ハタサコ 畑迫 +ハタサコ 畠迫 +ハタサト 畠里 +ハタサワ 畑沢 +ハタサワ 畠沢 +ハタサワ 畑澤 +ハタサワ 畠澤 +ハタザワ 畑沢 +ハタザワ 畠沢 +ハタザワ 畑澤 +ハタザワ 畠澤 +ハタシ 幡司 +ハタジ 畑地 +ハタジ 幡司 +ハタジ 幡地 +ハタジ 羽田地 +ハタジ 秦地 +ハタシタ 畑下 +ハタシタ 畠下 +ハタシタ 端下 +ハタシマ 畑島 +ハタシマ 旗島(籏島) +ハタシマ 畑嶋 +ハタシマ 畠島 +ハタシマ 畠嶋 +ハタシマ 旗嶋 +ハタシマ 幡島 +ハタジマ 畑島 +ハタジマ 旗島(籏島) +ハタジマ 畑嶋 +ハタジマ 畠島 +ハタジマ 旗嶋 +ハタジリ 畑尻 +ハタシン 幡新 +ハタスエ 畑末 +ハタズミ 畑澄 +ハタセ 畑瀬 +ハタセ 畠瀬 +ハタセ 籏瀬 +ハタセ 果瀬 +ハタセ 旗瀬 +ハタセ 波多瀬 +ハタセ 幡瀬 +ハダセ 肌勢 +ハダセ 肌瀬 +ハタゾエ 畑添 +ハタゾエ 畠添 +ハタタ 畑田 +ハタダ 畑田 +ハタダ 畠田 +ハタダ 幡田 +ハタダ 端田 +ハタダ 幡多 +ハタダ 旗田 +ハタダ 秦田 +ハタダテ 端館 +ハタタニ 畑谷 +ハタタニ 幡谷 +ハタタニ 旗谷 +ハタタニ 畠谷 +ハタタニ 機谷 +ハタダニ 畑谷 +ハタダニ 機谷 +ハタダヤ 畠田谷 +ハタダン 畑段 +ハタチ 羽立 +ハタチ 畑地 +ハタチ 幡地 +ハタチ 波田地 +ハタチ 籏智 +ハタチ 廿千 +ハタチ 羽舘 +ハタチ 羽達 +ハタチ 旗智 +ハタチ 廿 +ハタチ 籏知 +ハタチ 廿地 +ハタヂ 幡地 +ハダチ 羽立 +ハダチ 波田地 +ハダチ 秦地 +ハタチヤ 派谷 +ハタツ 畑津 +ハタヅ 畑津 +ハタツカ 幡司 +ハタツカサ 幡司 +ハダツキ 肌附 +ハタツジ 畑辻 +ハタテ 羽立 +ハタテ 旗手 +ハタテ 幡手 +ハタテ 畑手 +ハタテ 籏手 +ハタデ 幡手 +ハタデ 畑出 +ハダテ 羽立 +ハタト 畑戸 +ハタド 畑戸 +ハタトウ 畠等 +ハタナ 畑名 +ハタナ 秦名 +ハタナ 泰穴 +ハタナ 畑奈 +ハダナ 葉棚 +ハタナイ 畑内 +ハタナカ 畑中 +ハタナカ 畠中 +ハタナカ 幡中 +ハタナカ 畑仲 +ハタナカ 圃中 +ハタナカ 畠仲 +ハタナカ 羽田中 +ハタナカ 旗中 +ハタナカ 端中 +ハタナカ 籏中 +ハタナガ 幡永 +ハタナミ 幡南 +ハタナリ 畑成 +ハタニ 羽谷 +ハタニ 波谷 +ハタニ 葉谷 +ハタニ 羽渓 +ハタニ 羽溪 +ハダニ 羽谷 +ハダニ 波谷 +バタニ 馬谷 +バタニ 場谷 +ハタニシ 畑西 +ハタネ 畑根 +ハタネ 旗根 +ハタネ 波種 +ハタノ 波多野 +ハタノ 羽田野 +ハタノ 畑野 +ハタノ 秦野 +ハタノ 幡野 +ハタノ 波田野 +ハタノ 畠野 +ハタノ 端野 +ハタノ 羽多野(羽夛野) +ハタノ 籏野 +ハタノ 旗野 +ハタノ 泰野 +ハタノ 榛野 +ハタノ 破田野 +ハタノ 葉多野 +ハタノ 葉田野 +ハタノ 波夛野 +ハタノ 畑農 +ハタノ 葉多埜 +ハタノ 羽多埜 +ハタノ 畑埜 +ハタノ 波田埜 +ハタノ 機野 +ハタノ 将野 +ハタノ 波多埜 +ハタノ 破多野 +ハタノ 畠埜 +ハタノ 籏埜 +ハダノ 波多野 +ハダノ 羽田野 +ハダノ 秦野 +ハダノ 波田野 +ハダノ 羽多野(羽夛野) +ハダノ 裸野 +ハダノ 肌野 +ハダノ 波夛野 +ハダノ 硲野 +ハダノ 肌埜 +ハタノウ 畑農 +ハタノヤ 畑野谷 +ハタバ 端場 +ハタバ 幡場 +ハタハシ 畑橋 +ハタハシ 端橋 +ハタバタ 畑端 +ハタバタケ 畑畠 +ハタバヤシ 畑林 +ハタハラ 畑原 +ハタハラ 籏原 +ハタハラ 旗原 +ハタバラ 畑原 +ハタバラ 幡原 +ハタバラ 畠原 +ハタヒラ 畠平 +ハタヒラ 畑平 +ハタヒラ 坡平 +ハタヒロ 畑広(畑廣) +ハタブ 旗生 +ハタブ 幡生 +ハタブ 畑生 +ハタブ 幡歩 +ハタブ 籏生 +ハタブ 籏武 +ハタフク 畠腹 +ハタフク 畑福 +ハタフク 籏福 +ハタフク 旗福 +ハタフジ 畠藤 +ハタブチ 畑淵 +ハタベ 畑辺 +ハタベ 畑部 +ハタベ 幡部 +ハタベ 波多部 +ハタベ 波多辺(波多邉) +ハタベ 畑邊 +ハタベ 畑邉 +ハタボウ 端坊 +ハタホコ 幡鉾 +ハタホコ 籏鉾 +ハタホリ 畑堀 +ハタホリ 畠堀 +ハタホリ 畑掘 +ハタボリ 畑堀 +ハタボリ 畠堀 +ハタマ 畑間 +ハタマ 波多間 +ハタマ 畠間 +ハタマ 波田間 +ハダマ 葉玉 +ハダマ 波多間 +ハダマ 波田間 +ハダマ 羽玉 +ハダマ 波玉 +ハダマ 羽田間 +ハタマエ 畑前 +ハタマタ 将亦(將亦) +ハタマチ 籏町 +ハタマチ 旗町 +ハタマル 幡丸 +ハタミ 播田実(播田實) +ハタミ 畑見 +ハタミ 旗見 +ハタミ 畠見 +ハタミ 播田見 +ハタミ 幡田実(幡田實) +ハタミチ 畑道 +ハタミチ 畠道 +ハタミネ 畑峯 +ハタミヤ 幡宮 +ハタミヤ 畑宮 +ハタムネ 畠宗 +ハタムラ 畑村 +ハタムラ 端村 +ハタムラ 畠村 +ハダメ 甚目 +ハタモチ 旗持 +ハタモチ 籏持 +ハタモチ 幟持 +ハタモト 畑本 +ハタモト 幡本 +ハタモト 畠本 +ハタモト 端本 +ハタモト 畑元 +ハタモト 旗本 +ハタモト 籏本(簱本) +ハタモト 幡基 +ハタモト 秦本 +ハタモト 旙本 +ハタモリ 畑森 +ハタモリ 畑守 +ハタモリ 畠盛 +ハタモリ 畠森 +ハタモリ 秦森 +ハタモリ 幡盛 +ハタモリ 畠守 +ハタヤ 畑谷 +ハタヤ 幡谷 +ハタヤ 端谷 +ハタヤ 旗谷 +ハタヤ 畠谷 +ハタヤ 籏谷 +ハタヤ 畑屋 +ハタヤ 畑矢 +ハタヤ 旗屋 +ハタヤ 羽田谷 +ハタヤ 秦谷 +ハタヤ 畠屋 +ハタヤ 畠舎 +ハタヤ 機谷 +ハタヤ 幡矢 +ハタヤ 旗家 +ハタヤ 幡屋 +ハタヤ 畑家 +ハタヤ 籏屋 +ハタヤス 幡保 +ハタヤス 畠保 +ハタヤチ 畑谷内 +ハタヤマ 畠山 +ハタヤマ 畑山 +ハタヤマ 端山 +ハタヤマ 幡山 +ハタヤマ 籏山 +ハタヤマ 旙山 +ハタヤマ 旛山 +ハタヤマ 旗山 +ハタヤマ 秦山 +ハタヨシ 幡吉 +ハタヨシ 畠吉 +ハタヨシ 畑吉 +ハタラキ 働 +ハタリ 畑里 +ハタレイ 籏礼 +ハタレイ 籏禮 +ハタワキ 畑脇 +バダン 馬段 +ハチ 羽地 +ハチ 鉢 +ハチ 蜂 +バチ 馬地 +バチ 場地 +ハチイ 八井 +ハチウエ 鉢上 +ハチウチ 鉢内 +ハチウマ 八馬 +ハチウラ 八浦 +ハチエ 八柄 +ハチオ 八尾 +ハチオ 蜂尾 +ハチオウジ 八黄地 +ハチオウジ 八王子 +ハチオウジ 八王地 +ハチオカ 八岡 +ハチオカ 鉢岡 +ハチオシ 八尾師 +ハチカ 蜂箇 +ハチガ 八賀 +ハチガ 蜂賀 +バチカ 場知賀 +ハチガクボ 八ケ窪 +ハチガサキ 蜂ケ崎 +ハチカジ 鉢鍛治 +ハチガタ 鉢形 +ハチカネ 鉢金 +ハチガミ 鉢上 +ハチカワ 八川 +ハチカワ 八河 +ハチカワ 蜂川 +ハチカワ 鉢川 +ハチキ 八木 +ハチキ 鉢木 +ハチキ 蜂木 +ハチクボ 八久保 +ハチクボ 八窪 +ハチクボ 鉢窪 +ハチクラ 八倉 +ハチケ 八家 +ハチケン 八軒 +ハチケンヤ 八軒屋 +ハチゴウ 八郷 +ハチコク 八石 +ハチサカ 八坂 +ハチサカ 八阪 +ハチサキ 八崎 +ハチザキ 八崎 +ハチサコ 鉢迫 +ハチザワ 八澤 +ハチジョウ 八条 +ハチジョウ 八丈 +ハチジョウ 八條 +ハチジョウ 八篠 +ハチジョウ 八絛 +ハチジリ 八尻 +ハチジン 八陣 +ハチジン 八陳 +ハチス 蜂須 +ハチス 蜂巣 +ハチス 蓮 +ハチス 八須 +ハチス 鉢須 +ハチス 蜂単 +ハチスカ 蜂須賀 +ハチスカ 八須賀 +ハチスガ 蜂須賀 +ハチスワ 八寿八(八壽八) +ハチタ 八田 +ハチダ 八田 +ハチダ 鉢田 +ハチタオ 八垰 +ハチタニ 蜂谷 +ハチタニ 八谷 +ハチタンダ 八反田 +ハチツカ 八塚 +ハチヅカ 八塚 +ハチトリ 八鳥 +ハチノ 八野 +ハチノ 鉢野 +ハチノ 蜂野 +ハチノエ 八戸 +ハチノタ 八野田 +ハチノダ 八野田 +ハチノヘ 八戸 +ハチハマ 八浜 +ハチハマ 八濱 +ハチヒラ 八平 +ハチベットウ 八別当 +ハチベットウ 八別當 +ハチホンギ 八本木 +ハチマ 八馬 +ハチマ 八間 +ハチマエ 八前 +ハチマキ 鉢巻 +ハチマタ 八又 +ハチマル 八丸 +ハチマン 八幡 +ハチマン 八万 +ハチマン 八萬 +ハチマンリョウ 八幡領 +ハチミ 鉢見 +ハチミネ 鉢嶺 +ハチミネ 鉢峰 +ハチミネ 鉢峯 +ハチミヤ 八宮 +ハチムラ 八村 +ハチムラ 鉢村 +ハチムレ 八牟礼 +ハチムレ 八牟禮 +ハチモト 鉢本 +ハチモリ 八森 +ハチモンジ 八文字 +ハチヤ 蜂谷 +ハチヤ 八谷 +ハチヤ 蜂屋 +ハチヤ 蜂矢 +ハチヤ 八矢 +ハチヤ 八家 +ハチヤ 八屋 +ハチヤ 鉢谷 +ハチヤク 八役 +ハチヤナギ 八柳 +ハチヤマ 八山 +ハチュウダ 羽中田 +ハチヨ 八与 +ハチヨ 八與 +ハチョウ 長鳥 +ハチリ 八里 +ハチリキ 八力 +ハチロ 鉢呂 +ハチロウ 鉢蝋 +ハチロウ 鉢蠟 +ハチロウダ 八郎田 +ハチワカ 八若 +ハツ 発 +ハツ 初 +ハツ 發 +ハヅ 羽豆 +ハヅ 波津 +ハヅ 羽津 +ハヅ 初津 +ハツアラシ 初嵐 +ハツイ 初井 +ハツイ 髪井 +ハツイチ 初一 +ハツイワ 祖岩 +ハツウミ 初海 +ハツウラ 初浦 +ハヅエ 葉杖 +ハツオカ 初岡 +ハッカ 八家 +ハッカ 八箇 +ハッカ 八荷 +ハヅカ 羽塚 +ハッカイ 八海 +ハツガイ 初谷 +ハツガイ 初貝 +バッカイ 白蓋 +ハツカイワ 廿日岩 +ハツカイワ 甘日岩 +ハッカク 八角 +ハツカデ 廿日出 +ハツカノ 初鹿野 +ハツガノ 初鹿野 +ハツカミ 初神 +ハツガヤ 初谷 +ハツガヤ 初ケ谷 +ハツカリ 初雁 +ハツカワ 初川 +ハヅガワ 羽津川 +ハツキ 羽月 +ハツキ 初木 +ハツキ 巴月 +ハヅキ 羽月 +ハヅキ 巴月 +ハヅキ 葉月 +ハッキン 白金 +ハック 白駒 +ハツク 波津久 +ハツク 硑 +ハヅク 波津久 +バヅクリ 場作 +ハッケ 八家 +ハッケ 流合 +バッケ 場家 +ハッケイ 八京 +ハッケイ 八景 +ハッコ 八乕 +ハッコウ 八講 +ハッコウ 八構 +バッコマ 漠駒 +ハッサカ 八坂 +ハツサカ 初坂 +ハツサカ 初阪 +ハッサキ 八崎 +ハツサキ 八崎 +ハツサキ 初崎 +ハツザキ 初崎 +ハツザキ 服崎 +ハッサク 八朔 +ハツサワ 初沢 +ハツサワ 初澤 +ハツザワ 初沢 +ハツザワ 初澤 +ハッシ 蓮子 +ハッシ 発師 +ハツシ 蓮子 +ハツジ 初治 +ハツジ 羽辻 +ハツシオ 初塩 +ハツシオ 初汐 +ハツシカ 初鹿 +ハツシバ 初芝 +ハツシバ 初柴 +ハツシマ 初島 +ハツシマ 初嶋 +ハツシマ 初嶌 +ハッシャク 八尺 +ハッシュウ 八周 +ハッショウ 八性 +ハツシルシ 八符 +ハツセ 初瀬 +ハツセ 初世 +ハッセイ 八声(八聲) +ハツセオ 初瀬尾 +ハツセガワ 初瀬川 +ハツセダ 初瀬田 +ハッセン 八千 +ハッタ 八田 +ハッタ 初田 +ハッタ 治田 +ハッタ 服田 +ハッタ 発田 +ハッタ 八太 +ハッタ 八多 +ハッタ 治多 +ハッタ 發田 +ハッタ 冶田 +ハツタ 八田 +ハツタ 初田 +ハツダ 初田 +ハッタイ 八田井 +ハッタニ 八谷 +ハツタニ 初谷 +ハツダニ 八谷 +ハッタハ 八田羽 +ハッタハラ 八田原 +ハッタボリ 八田堀 +ハッタワ 八田羽 +ハッタワラ 八田原 +ハッタン 八反 +ハッタン 八段 +ハッタン 八丹 +ハッタンジ 八反地 +ハッタンダ 八反田 +ハッタンチ 八反地 +ハッタンマル 八反丸 +ハツチ 羽土 +ハヅチ 羽土 +ハッチョウ 八町 +ハッチョウ 八丁 +ハッチョウ 八長 +ハッチョウ 八朝 +ハッチョウ 八張 +ハッチョウジ 八丁地 +ハッチョウノ 八丁野 +ハッチョウメ 八丁目 +ハツヅカ 初塚 +ハッテ 八手 +ハツテ 初手 +ハツデ 発出 +ハツデ 發出 +ハット 八斗 +ハツト 初都 +ハットウ 八藤 +ハットウ 八塔 +ハットウ 八東 +ハットモ 八友 +ハットリ 服部 +ハットリ 八鳥 +ハットリ 初鳥 +ハットリ 這禽 +ハットリ 八取 +ハットリ 腹部 +ハットリ 初取 +ハットリ 神服 +ハットリ 服鳥 +ハットリ 服取 +ハツトリ 初鳥 +ハツナガ 初永 +ハツナミ 初波 +ハツネ 初根 +ハツネ 初音 +ハツノ 初野 +ハツノ 波津野 +ハツノリ 発乗 +ハッパ 八羽 +ハツハラ 初原 +ハツハラ 蓁原 +ハッポウ 八方 +ハッポウヤ 八甫谷 +ハッポヤ 八甫谷 +ハツマ 初馬 +ハヅマ 弭間 +ハツマタ 初又 +ハツマタ 初叉 +ハツマタ 初亦 +ハツミ 初見 +ハツミ 波津見 +ハヅミ 波積 +ハヅミ 波津見 +ハツミチ 初道 +ハツムラ 初村 +ハツモト 初本 +ハツモト 初元 +ハヅモト 羽津本 +ハツモリ 初森 +ハツモリ 初盛 +ハツヤ 初谷 +ハツヤ 初矢 +ハツヤド 初宿 +ハツヤマ 初山 +ハツヤマ 羽出山 +ハツユキ 初行 +ハヅル 羽鶴 +ハデ 羽出 +ハデイシ 波出石 +ハデギ 羽出木 +ハデシゲ 羽出重 +ハデジリ 葉手尻 +ハデバ 羽出場 +ハテハタ 八手幡 +ハデハラ 羽手原 +ハテマタ 八手又 +ハテマタ 八手亦 +ハテムラ 羽手村 +ハデモト 波出本 +ハデヤマ 羽出山 +ハテルマ 波照間 +ハデワラ 羽手原 +バテン 馬殿 +バデン 馬殿 +ハト 波戸 +ハト 鳩 +ハト 波止 +ハト 羽戸 +ハト 破戸 +ハト 羽斗 +ハト 葉戸 +ハド 羽土 +バト 馬戸 +ハトイ 鳩井 +ハトイシ 鳩石 +ハトウ 羽藤 +ハトウ 波頭 +ハトウ 波藤 +ハトウ 羽当 +ハトウ 羽東 +ハトウ 葉騰 +ハトウ 波東 +ハトウ 波涛(波濤) +ハトウ 羽當 +バトウ 馬頭 +バトウ 馬藤 +バドウ 馬道 +ハトウエ 波戸上 +ハトウチ 波戸内 +ハトオカ 鳩岡 +ハトオカ 波戸岡 +ハトカイ 鳩飼 +ハトガイ 鳩貝 +ハトガイ 鳩飼 +ハトガキ 鳩垣 +ハトガミ 波戸上 +ハトガヤ 鳩ケ谷 +ハトカワ 鳩川 +ハトグチ 波戸口 +ハトグチ 鳩口 +ハトコ 波床 +ハトサキ 波戸崎 +ハトサキ 鳩崎(鳩嵜) +ハトザキ 波戸崎 +ハトザキ 鳩崎(鳩嵜) +ハトザキ 涛崎 +ハトザキ 波涛崎 +ハトザキ 濤崎 +バトザキ 馬戸崎 +ハトザワ 鳩沢 +ハトザワ 鳩澤 +ハトシマ 鳩島 +ハトジマ 鳩島 +ハトセ 波戸瀬 +ハトダ 鳩田 +ハトタニ 鳩谷 +ハトナリ 鳩成 +ハトネ 波戸根 +ハトネ 鳩根 +ハトネ 波当根(波當根) +ハトノ 鳩野 +バドノ 馬殿 +ハトバ 波戸場 +ハトバ 鳩場 +ハトバ 鳩羽 +ハトハラ 鳩原 +ハトベ 鳩部 +ハトベ 波戸辺 +ハトベ 波戸邉 +ハトマ 鳩間 +ハトミ 羽富 +ハトミ 羽冨 +ハトミ 葉富 +ハトムラ 波戸村 +ハトムラ 鳩村 +ハトモト 波戸元 +ハトモト 波戸本 +ハトモト 波止元 +ハトモト 鳩本 +ハトモト 羽戸本 +ハトモリ 鳩森 +ハトヤ 鳩谷 +ハトヤ 鳩宿 +ハトヤド 鳩宿 +ハトヤマ 鳩山 +ハトリ 羽鳥 +ハトリ 羽取 +ハトリ 葉鳥 +ハドリ 羽鳥 +バトリ 馬鳥 +ハトワキ 鳩脇 +ハナ 端 +ハナ 花 +ハナ 鼻 +ハナ 端名 +ハナ 葉名 +ハナ 波奈 +ハナ 羽奈 +ハナ 羽名 +ハナアサ 花麻 +ハナイ 花井 +ハナイ 華井 +ハナイ 端井 +ハナイ 葉内 +ハナイ 英井 +ハナイ 波奈井 +ハナイエ 花家 +ハナイカ 花烏賊 +ハナイケ 花池 +ハナイシ 花石 +ハナイシ 華石 +ハナイズミ 花泉 +ハナイチ 花市 +ハナイワ 花岩 +ハナウエ 花上 +ハナウエ 花植 +ハナウチ 花内 +ハナウミ 花海 +ハナウラ 花浦 +ハナウラ 端浦 +ハナエ 花江 +ハナエ 花栄(花榮) +ハナエ 華江 +ハナエキ 花浴 +ハナエダ 花枝 +ハナオ 花尾 +ハナオ 花生 +ハナオ 華尾 +ハナオイ 花生 +ハナオウ 花王 +ハナオカ 花岡 +ハナオカ 華岡 +ハナオカ 鼻岡 +ハナオカ 花丘 +ハナオカ 華丘 +ハナオノ 花小野 +ハナオリ 花折 +ハナカ 花香 +ハナカ 土中 +ハナガ 羽永 +バナカ 場中(塲中) +バナカ 馬中 +ハナカイ 花開 +ハナガキ 花垣 +ハナガキ 華垣 +ハナカゲ 花蔭 +ハナカゲ 鼻影 +ハナカゴ 花篭 +ハナカゴ 花籠 +ハナガサキ 花ケ崎(花ケ埼) +ハナガサキ 花ケ前 +ハナガサコ 花ケ迫 +ハナカタ 羽中田 +ハナカタ 花方 +ハナカダ 羽中田 +ハナガタ 花形 +ハナガタ 花方 +ハナガネ 花金 +ハナカマ 花釜 +ハナガマ 花釜 +ハナカミ 花上 +ハナガミ 花上 +ハナガミ 花神 +ハナカメ 花亀 +ハナカワ 花川 +ハナカワ 花河 +ハナカワ 華川 +ハナカワ 泗川 +ハナキ 花木 +ハナキ 花城 +ハナキ 花喜 +ハナキ 花樹 +ハナキ 花紀 +ハナキ 華樹 +ハナギ 花木 +ハナギ 花城 +ハナキウチ 花木内 +ハナギシ 花岸 +ハナキタ 花北 +ハナキリ 花桐 +ハナギリ 花桐 +ハナクサ 花草 +ハナグチ 花口 +ハナグチ 端口 +ハナクマ 花熊 +ハナクマ 花隈 +ハナクマ 鼻熊 +ハナグマ 花熊 +ハナグマ 花隈 +ハナクラ 花倉 +ハナクラ 花蔵 +ハナグリ 花栗 +ハナグルマ 花車 +ハナケ 花家 +ハナゲ 鼻毛 +ハナゲ 花毛 +ハナコ 花子 +ハナコシ 花越 +ハナサカ 花坂 +ハナサカ 花阪 +ハナサカ 塙阪 +ハナサキ 花崎 +ハナサキ 花咲 +ハナサキ 鼻崎 +ハナサキ 鼻先 +ハナサキ 花嵜 +ハナサキ 華崎 +ハナサキ 鼻嵜 +ハナサキ 岬崎 +ハナザキ 花崎 +ハナザキ 鼻崎 +ハナザキ 端崎 +ハナザキ 花嵜 +ハナザキ 華崎 +ハナサト 花里 +ハナサト 華学 +ハナザト 花里 +ハナサワ 花沢 +ハナサワ 花澤 +ハナザワ 花沢 +ハナザワ 花澤 +ハナザワ 華沢 +ハナザワ 華澤 +ハナシ 葉梨 +ハナシ 端無 +ハナシ 花志 +ハナシ 噺 +ハナシ 咄 +ハナシゲ 花重 +ハナシタ 花下 +ハナシタ 咄下 +ハナシタ 端下 +ハナシマ 花島 +ハナシマ 花嶋 +ハナジマ 花島 +ハナジマ 花嶋 +ハナジリ 花尻 +ハナジリ 葉名尻 +ハナシロ 花城 +ハナシロ 玻名城 +ハナシロ 波名城 +ハナシロ 英城 +ハナシロ 玻那城 +ハナズカ 花塚 +ハナズミ 花積 +ハナズミ 花角 +ハナズミ 花住 +ハナセ 花瀬 +ハナゾエ 花添 +ハナソト 花外 +ハナゾノ 花園 +ハナゾノ 華園 +ハナゾノ 花薗 +ハナゾノ 花圃 +ハナゾノ 花苑 +ハナゾメ 花染 +ハナタ 花田 +ハナダ 花田 +ハナダ 端田 +ハナダ 華田 +ハナダ 鼻田 +ハナダ 英田 +ハナダ 芲田 +ハナダ 縹 +ハナタカ 花高 +ハナタカ 鼻高 +ハナタチ 花立 +ハナタツ 花立 +ハナタテ 花立 +ハナダテ 花立 +ハナダテ 花舘 +ハナダテ 花館 +ハナダテ 華立 +ハナタナ 花棚 +ハナダナ 花棚 +ハナタニ 花谷 +ハナタニ 華谷 +ハナタニ 花渓 +ハナタニ 花溪 +ハナタニ 鼻谷 +ハナダニ 花谷 +ハナチバ 鼻知場 +ハナツ 波奈津 +ハナツカ 花塚 +ハナヅカ 花塚 +ハナツボ 花坪 +ハナヅマ 花妻 +ハナツミ 花摘 +ハナヅミ 花積 +ハナツヤ 花津谷 +ハナテ 花手 +ハナデ 花出 +ハナト 花戸 +ハナト 花登 +ハナト 鼻戸 +ハナト 花土 +ハナト 端戸 +ハナト 花当(花當) +ハナト 鼻渡 +ハナト 鼻登 +ハナト 花斗 +ハナト 花渡 +ハナド 花戸 +ハナド 花土 +ハナド 波奈土 +ハナドウ 花堂 +ハナトク 花篤 +ハナトシ 花利 +ハナトモ 鼻智 +ハナトヨ 花豊 +ハナナカ 花中 +ハナナガイ 花長井 +ハナナシ 花梨 +ハナヌキ 花貫 +ハナネ 端根 +ハナネ 花根 +ハナノ 花野 +ハナノ 端野 +ハナノ 華野 +ハナノ 鼻野 +ハナノイ 花野井 +ハナノイ 花ノ井 +ハナノイ 華埜井 +ハナノウチ 花之内 +ハナノウチ 花ノ内 +ハナノウチ 花野内 +ハナノエ 花之枝 +ハナノエダ 花之枝 +ハナノキ 花ノ木 +ハナノキ 花野木 +ハナノキ 花乃木 +ハナノキ 花之木 +ハナノキ 鼻野木 +ハナノギ 花野木 +ハナノギ 鼻野木 +ハナバ 端場 +ハナハシ 花橋 +ハナハシ 鼻橋 +ハナバシ 花橋 +ハナハタ 花畑 +ハナハタ 花幡 +ハナバタ 花畑 +ハナバタ 花畠 +ハナバタケ 花畑 +ハナバタケ 花畠 +ハナハチ 花八 +ハナバヤシ 花林 +ハナハラ 花原 +ハナバラ 花原 +ハナバル 花原 +ハナヒサ 花久 +ハナビシ 花菱 +ハナヒラ 花平 +ハナビラ 花平 +ハナヒロ 華広 +ハナヒロ 華廣 +ハナブ 花生 +ハナブ 花布 +ハナフサ 花房 +ハナフサ 英 +ハナフサ 華房 +ハナフサ 花補佐 +ハナフサ 蕚 +ハナブサ 花房 +ハナブサ 栄 +ハナブサ 纐纈 +ハナブサ 英 +ハナブサ 華房 +ハナブサ 花補佐 +ハナブサ 花栄 +ハナブサ 萃房 +ハナブサ 萼 +ハナフジ 花藤 +ハナブシ 鼻節 +ハナブチ 花渕 +ハナブチ 花淵 +ハナベ 花部 +ハナベ 花辺(花邉) +ハナホ 花穂 +ハナホサ 花補佐 +ハナマエ 花前 +ハナマキ 花巻 +ハナマキ 花卷 +ハナマス 花増 +ハナマス 花桝 +ハナマス 花升 +ハナマタ 花俣 +ハナマタ 花又 +ハナマチ 花待 +ハナマチ 鼻町 +ハナマチ 花町 +ハナマツ 花松 +ハナマツ 花俟 +ハナマル 花丸 +ハナマル 花円 +ハナマル 花圓 +ハナミ 花見 +ハナミ 土海 +ハナミ 花海 +ハナミ 波並 +ハナミ 葉波 +ハナミ 花実 +ハナミ 羽浪 +ハナミ 花實 +ハナミズ 花水 +ハナミチ 花道 +ハナミツ 花光 +ハナミツ 花満 +ハナミツ 花蜜 +ハナミツ 花密 +ハナミドウ 花見堂 +ハナミネ 花峯 +ハナミネ 花峰 +ハナミヤ 花宮 +ハナムラ 花村 +ハナムラ 花邑 +ハナムラ 㮈村 +ハナムラ 華村 +ハナムラ 捺村 +ハナムレ 花牟礼 +ハナムレ 花牟禮 +ハナムロ 花室 +ハナメン 花面 +ハナモ 花茂 +ハナモト 花本 +ハナモト 花元 +ハナモト 端本 +ハナモト 華本 +ハナモト 鼻本 +ハナモト 鼻元 +ハナモト 岬本 +ハナモト 華元 +ハナモト 波那本 +ハナモリ 花森 +ハナモリ 花盛 +ハナモリ 花守 +ハナモリ 端森 +ハナヤ 花谷 +ハナヤ 花屋 +ハナヤ 端谷 +ハナヤ 花家 +ハナヤ 花矢 +ハナヤ 花弥 +ハナヤ 花箭 +ハナヤギ 花柳 +ハナヤス 花安 +ハナヤマ 花山 +ハナヤマ 端山 +ハナヤマ 華山 +ハナヤマ 鼻山 +ハナヨシ 花吉 +ハナヨシ 花好 +ハナヨシ 花芳 +ハナリ 羽成 +ハナリ 葉成 +ハナレ 離 +ハナレイシ 離石 +ハナレイワ 放岩 +ハナワ 塙 +ハナワ 花輪 +ハナワ 鼻和 +ハナワ 花和 +ハナワ 花曲 +ハナワ 華輪 +ハナワ 鼻輪 +ハナワカ 花若 +ハナワキ 花脇 +ハナワサカ 塙阪 +ハナワシタ 塙下 +ハナワダ 塙田 +ハナワタリ 花渡 +ハナワヤ 塙谷 +ハニ 羽仁 +ハニ 埴 +ハニ 波爾 +ハニ 波示 +ハニウ 羽生 +ハニウ 羽二生 +ハニウ 埴生 +ハニウダ 羽生田 +ハニウダ 羽入田 +ハニオカ 埴岡 +ハニサキ 埴崎 +ハニザキ 埴崎 +ハニサワ 埴沢 +ハニサワ 埴澤 +ハニシ 葉西 +ハニタ 埴田 +ハニタ 半仁田 +ハニダ 埴田 +ハニタニ 埴谷 +ハニヅカ 羽二塚 +ハニノ 埴野 +ハニハラ 埴原 +ハニブチ 埴渕 +ハニブチ 埴淵 +ハニベ 土部 +ハニベ 埴部 +ハニムラ 埴村 +ハニヤ 埴谷 +ハニヤマ 埴山 +ハニュウ 羽生 +ハニュウ 羽二生 +ハニュウ 羽入 +ハニュウ 埴生 +ハニュウ 波入 +ハニュウ 破入 +ハニュウダ 羽生田 +ハニュウダ 羽入田 +ハニワ 羽庭 +ハニワ 埴和 +バニワ 馬庭 +ハニワラ 埴原 +ハヌキ 葉貫 +ハヌマ 羽沼 +ハネ 羽根 +ハネ 波根 +ハネ 刎 +ハネアシ 羽足 +ハネイ 羽根井 +ハネイ 羽井 +ハネイシ 羽石 +ハネイシ 羽根石 +ハネイシ 拮石 +ハネエ 羽江 +ハネオ 羽尾 +ハネオ 羽根尾 +ハネオカ 羽岡 +ハネオカ 羽子岡 +ハネオカ 羽根岡 +ハネガツジ 刎ケ辻 +ハネカワ 羽川 +ハネカワ 羽根川 +ハネガワ 羽根川 +ハネキ 羽根木 +ハネキ 桔木 +ハネギ 羽根木 +ハネサカ 塙阪 +ハネサカ 羽根坂 +ハネサカ 塙坂 +ハネジ 羽地 +ハネジ 羽路 +ハネジ 羽根地 +ハネジ 伴根地 +ハネシタ 羽下 +ハネタ 羽田 +ハネタ 羽根田 +ハネタ 羽子田 +ハネタ 羽祢田 +ハネタ 羽禰田 +ハネタ 刎田 +ハネダ 羽田 +ハネダ 羽根田 +ハネダ 羽太 +ハネダ 羽子田 +ハネダ 羽祢田 +ハネダ 羽禰田 +ハネダ 刎田 +ハネダ 波根田 +ハネダ 羽称田 +ハネチ 羽地 +ハネチ 伴根地 +ハネヂ 羽地 +ハネヂ 羽根地 +ハネツカ 羽塚 +ハネヅカ 羽塚 +ハネテ 羽根手 +ハネト 羽斗 +ハネナカ 羽中 +ハネバヤシ 羽林 +ハネハラ 羽原 +ハネヒラ 塙平 +ハネブチ 羽根渕 +ハネブチ 羽根淵 +ハネモト 刎本 +ハネモト 塙本 +ハネモト 刎元 +ハネヤマ 羽山 +ハネヨシ 羽吉 +ハネヨシ 羽根吉 +ハネヨシ 羽佳 +ハノ 羽野 +ハノ 土野 +ハノ 杷野 +ハノ 波野 +ハノ 埴野 +ハノ 把野 +ハノ 葉野 +バノ 馬野 +バノ 場野 +ハノウ 羽納 +ハノウ 波能 +ハノウエ 葉上 +ハノウラ 葉野浦 +ハノキサワ 柧木沢 +ハノキザワ 柧木沢 +ハノキザワ 柧木澤(枛木澤) +ハノシマ 羽野島 +ハノチ 羽後 +ハノマキ 羽野牧 +ハバ 八幡 +ハバ 羽場 +ハバ 幅 +ハバ 羽馬 +ハバ 巾 +ハバ 端場 +ハバ 波場(波塲) +ハバ 八葉 +ハバ 坡場 +ハバ 羽波 +ハバ 羽塲 +ババ 馬場 +ババ 馬塲 +ババ 場々 +ババ 場場 +ババ 馬々 +ババイ 馬場井 +ババイケ 馬場池 +ハバウエ 幅上 +ハバウエ 端場上 +ババウエ 馬場上 +ハバウチ 羽場内 +ハバウチ 幅内 +ハバウチ 巾内 +ババウチ 馬場内 +ハバオ 幅尾 +ババオ 馬場尾 +ババオカ 馬場岡 +ハハカベ 波々伯部 +ハハカベ 母壁 +ハハカベ 波々壁 +ハバカミ 幅上 +ハバガミ 幅上 +ババガミ 馬場上 +ハバカリ 葉計 +ハバカリ 羽計 +ハバキ 鎺 +ハバギシ 幅岸 +ハバグチ 幅口 +ババクチ 馬場口 +ババグチ 馬場口 +ハハクラ 母倉 +ハバゴメ 幅米 +ハバサキ 幅崎 +ハバサキ 羽場崎 +ハバサキ 巾崎 +ハバザキ 幅崎 +ハバザキ 羽場崎 +ハバザキ 巾崎 +ハバザキ 幅嵜 +ババサキ 馬場崎(馬塲崎) +ババサキ 馬場先 +ババサキ 馬場嵜 +ババザキ 馬場崎(馬塲崎) +ババサコ 馬場迫 +ハバシ 羽橋 +ハバシタ 幅下 +ハバシタ 巾下 +ババシタ 馬場下 +ババシバ 馬場芝 +ハバシマ 巾島 +ハバシマ 巾嶋 +ババゾエ 馬場添 +ババソノ 馬場園 +ババゾノ 馬場園 +ババゾノ 馬場薗 +ハバタ 幅田 +ハバタ 羽畑 +ハバタ 羽端 +ハバタ 巾田 +ハバタ 葉畑 +ハバタ 幅多 +ババタ 馬場田 +ハバタテ 幅舘 +ハバタニ 端谷 +ハハデ 母出 +ハバデ 幅出 +ハバデラ 幅寺 +ハバナカ 幅中 +ハバノ 幅野 +ハバノ 巾野 +ババノ 馬場野 +ハバノウエ 幅之上 +ババハタ 馬場畑 +ババハラ 馬場原 +ハハベ 波々部 +ババミ 馬場見 +ハバムラ 巾村 +ババメ 馬場目 +ババモト 馬場本 +ハバヤ 幅屋 +ハバヤ 幅谷 +ババヤ 馬場谷 +ハバヤシ 葉林 +ハバラ 羽原 +ハバラ 葉原 +ババワキ 馬々脇(馬馬脇) +ハビキノ 羽曳野 +ハビラ 坡平 +ハヒロ 羽広 +ハヒロ 羽廣 +ハビロ 羽広 +ハビロ 葉広 +ハビロ 羽廣 +ハビロ 葉廣 +ハブ 羽生 +ハブ 土生 +ハブ 羽部 +ハブ 波部 +ハブ 埴生 +ハブ 垣生 +ハブ 植生 +ハブ 吐生 +ハブイ 土生井 +ハブイ 土生居 +ハフカ 羽深 +ハブカ 羽深 +ハブカワ 土生川 +ハブキ 羽吹 +ハブキ 葉葺 +ハブキ 土生木 +ハブキ 葉吹 +ハブキ 羽二木 +ハブサワ 羽生沢 +ハブセ 羽夫瀬 +ハブタ 羽生田 +ハブタ 羽太 +ハブタ 土生田 +ハブタ 羽重田 +ハブタニ 土生谷 +ハブチ 羽渕 +ハブチ 羽淵 +ハフツ 羽布津 +ハフツ 羽仏 +ハブツ 土生都 +ハブツ 羽布津 +ハブツ 土生津 +ハブツ 羽物 +ハブツ 羽生津 +ハブツ 羽佛 +ハブト 羽太 +ハブト 羽武戸 +ハブト 羽蚋 +ハブナガ 鱧永 +ハフリ 祝 +ハブリ 刃振 +ハベ 羽部 +ハベ 波部 +ハベ 羽辺 +ハベ 波辺 +バベ 馬部 +バヘイ 馬塀 +ハボ 英保 +ハボシ 羽星 +ハマ 浜 +ハマ 濱 +ハマ 波間 +ハマ 羽馬 +ハマ 羽間 +ハマ 破魔 +ハマ 羽磨 +ハマ 波磨 +ハマ 波馬 +ハマ 波摩 +ハマ 波満 +ハマ 浜間 +ハマ 葉満 +ハマアキ 浜秋 +ハマアキ 濱秋 +ハマアラツ 浜荒津 +ハマアラツ 濱荒津 +ハマイ 浜井 +ハマイ 濱井 +ハマイ 浜飯(濱飯) +ハマイ 浜伊 +ハマイ 浜居 +ハマイ 賓井 +ハマイイ 浜飯(濱飯) +ハマイエ 浜家 +ハマイエ 濱家 +ハマイケ 浜池 +ハマイケ 濱池 +ハマイシ 浜石 +ハマイシ 濱石 +ハマイソ 浜磯 +ハマイソ 浜礒 +ハマイソ 濱磯 +ハマイソ 濱礒 +ハマイタ 浜板(濱板) +ハマイチ 浜市 +ハマイチ 濱市 +ハマイバ 浜井場 +ハマイバ 濱井場 +ハマイワ 浜岩 +ハマウエ 浜上 +ハマウエ 濱上 +ハマウジ 浜氏 +ハマウジ 濱氏 +ハマウジ 濵氏 +ハマウズ 浜渦 +ハマウズ 濱渦 +ハマウズ 浜宇津(濱宇津) +ハマウチ 浜内 +ハマウチ 濱内 +ハマウヅ 浜宇津(濱宇津) +ハマウミ 浜海 +ハマウラ 浜浦 +ハマウラ 濱浦 +ハマエ 浜江 +ハマエ 濱江 +ハマエン 浜縁 +ハマエン 濱縁 +ハマオ 浜尾 +ハマオ 濱尾 +ハマオ 浜生 +ハマオ 濱生 +ハマオカ 浜岡 +ハマオカ 濱岡 +ハマオキ 浜沖 +ハマオキ 濱沖 +ハマオギ 浜荻 +ハマオギ 濱荻 +ハマオク 浜奥(濱奥) +ハマオモテ 浜面 +ハマオヤ 浜親(濱親) +ハマカ 浜鍜 +ハマカ 濱鍜 +ハマガ 浜賀(濱賀) +ハマガイ 浜貝 +ハマガイ 濱貝 +ハマガキ 浜垣 +ハマガキ 濱垣 +ハマガキウチ 浜垣内 +ハマガキウチ 濱垣内 +ハマカケ 浜欠 +ハマカケ 濱欠 +ハマカジ 浜梶 +ハマカジ 浜鍛 +ハマカジ 浜鍛治 +ハマカジ 浜鍛冶(濱鍛冶) +ハマカジ 濱鍛 +ハマガシラ 浜頭 +ハマガシラ 濱頭 +ハマカゼ 濱風(浜風) +ハマカタ 浜方 +ハマカタ 浜片 +ハマカタ 濱方 +ハマカタ 濱片 +ハマガタ 浜形 +ハマガタ 浜潟 +ハマガタ 濱形 +ハマガタ 浜瀉 +ハマガタ 濱潟 +ハマカド 浜門 +ハマカド 浜角 +ハマカド 濱門 +ハマカド 濱角 +ハマカミ 浜上 +ハマカミ 濱上 +ハマガミ 浜上 +ハマガミ 濱上 +ハマカワ 浜川 +ハマカワ 濱川 +ハマカワ 濱河 +ハマカワ 浜河 +ハマガワ 浜川 +ハマガワ 濱川 +ハマガワ 浜側(濱側) +ハマキ 浜木 +ハマキ 濱木 +ハマキ 浜城 +ハマギシ 浜岸 +ハマギシ 濱岸 +ハマキタ 浜北 +ハマキタ 濱北 +ハマギリ 浜桐 +ハマギリ 濱桐 +ハマギワ 浜際(濱際) +ハマギワ 浜涯(濱涯) +ハマグチ 浜口 +ハマグチ 濱口 +ハマグチヤ 浜口屋(濱口屋) +ハマクニ 浜国 +ハマクボ 浜窪 +ハマクボ 浜久保 +ハマクボ 濱窪 +ハマクボ 濱久保 +ハマグミ 浜組 +ハマクラ 浜倉 +ハマクラ 濱倉 +ハマグリ 蛤 +ハマグリ 浜栗 +ハマグリ 浜操 +ハマグリ 濱操 +ハマクワ 浜鍬 +ハマコ 浜子 +ハマコ 濱子 +ハマゴ 浜子 +ハマゴ 濱子 +ハマコウジ 浜小路 +ハマコウジ 濱小路 +ハマコガ 浜古賀 +ハマコガ 濱古賀 +ハマコシ 浜越 +ハマコマ 浜駒(濱駒) +ハマサカ 浜坂 +ハマサカ 濱坂 +ハマサカ 浜阪(濱阪) +ハマサカイ 浜境(濱境) +ハマサキ 浜崎 +ハマサキ 濱崎 +ハマサキ 浜咲 +ハマサキ 浜先 +ハマサキ 濱嵜 +ハマサキ 浜嵜 +ハマサキ 浜嵜 +ハマサキ 濱咲 +ハマサキ 濱先 +ハマサキ 浜埼 +ハマサキ 濱埼 +ハマサキ 濱碕 +ハマザキ 浜崎 +ハマザキ 濱崎 +ハマザキ 濱嵜 +ハマサコ 浜迫 +ハマサコ 浜窄 +ハマサコ 濱迫 +ハマサコ 濱窄 +ハマサト 浜里 +ハマサト 濱里 +ハマザト 浜里 +ハマザト 濱里 +ハマサブ 浜佐部 +ハマサワ 浜沢 +ハマサワ 濱澤 +ハマザワ 浜沢 +ハマザワ 濱澤 +ハマザワ 浜澤 +ハマザワ 濱沢 +ハマシ 浜師 +ハマジ 浜地 +ハマジ 濱地 +ハマジ 浜路 +ハマジ 浜治 +ハマジ 濱治(濱冶) +ハマジ 濱路 +ハマジ 浜司(濱司) +ハマシゲ 浜重 +ハマシゲ 濱重(濵重) +ハマシタ 浜下 +ハマシタ 濱下 +ハマシマ 浜島 +ハマシマ 濱島 +ハマシマ 濱嶋 +ハマシマ 浜嶋 +ハマシマ 賓島 +ハマジマ 浜島 +ハマジマ 濱島 +ハマジマ 濱嶋 +ハマジマ 浜嶋 +ハマジマ 飯万島 +ハマジマ 浜嶌 +ハマジマ 濱嶌 +ハマショウ 浜正 +ハマショウ 濱正 +ハマジョウ 浜門 +ハマジョウ 浜条(濱条) +ハマジョウ 浜條 +ハマジョウ 濱門 +ハマジョウ 濱條 +ハマショウジ 浜小路 +ハマショウジ 濱小路 +ハマシリ 浜尻 +ハマシリ 濱尻 +ハマジリ 浜尻 +ハマジリ 濱尻 +ハマシロ 浜城 +ハマシン 浜新 +ハマス 浜洲 +ハマス 濱洲 +ハマス 浜須 +ハマス 浜州 +ハマス 浜洌 +ハマス 濱州 +ハマス 濱須 +ハマスナ 浜砂 +ハマスナ 濱砂 +ハマスミ 浜住 +ハマスミ 濱住 +ハマズミ 浜住 +ハマズミ 濱住 +ハマセ 浜瀬 +ハマセ 濱瀬 +ハマセ 浜政 +ハマセ 濱政 +ハマソウ 濱操 +ハマゾエ 浜添 +ハマゾエ 浜副(濱副) +ハマゾエ 濱添 +ハマソト 浜外 +ハマソト 濱外 +ハマゾノ 浜園 +ハマゾノ 濱園 +ハマゾノ 浜薗 +ハマゾノ 濱薗 +ハマタ 浜田 +ハマタ 濱田 +ハマタ 浜多 +ハマタ 濱多 +ハマダ 浜田 +ハマダ 濱田 +ハマダ 浜多 +ハマダ 葉間田 +ハマダ 田 +ハマダ 濱多 +ハマダ 葉満田 +ハマタイラ 浜平 +ハマタイラ 濱平 +ハマダオ 浜田尾(濱田尾) +ハマタカ 浜高 +ハマタカ 濱高 +ハマタキ 浜滝(濱滝) +ハマタケ 浜武 +ハマタケ 浜竹 +ハマタケ 濱武 +ハマタケ 浜高家 +ハマタケ 濱竹 +ハマダテ 浜館(濱館) +ハマダテ 浜舘 +ハマダテ 濱舘 +ハマタニ 浜谷 +ハマタニ 濱谷 +ハマタニ 蛤谷 +ハマチ 浜地 +ハマチ 濱地 +ハマチ 浜池 +ハマチ 浜知 +ハマチ 濵知 +ハマヂ 浜地 +ハマヂ 濱地 +ハマチカ 浜近 +ハマチカ 濱近 +ハマチヨ 浜千代 +ハマチヨ 濱千代 +ハマチョウ 浜町 +ハマチョウ 浜長 +ハマツ 浜津 +ハマツ 濱津 +ハマヅ 浜津 +ハマヅ 濱津 +バマツ 場松 +ハマツカ 浜塚 +ハマツカ 濱塚 +ハマヅカ 浜塚 +ハマヅカ 濱塚 +ハマツキ 浜月(濱月) +ハマツキ 浜付 +ハマツキ 濱付 +ハマツジ 浜辻 +ハマツジ 濱辻 +ハマヅメ 浜詰 +ハマヅメ 浜爪(濱爪) +ハマヅメ 濱詰 +ハマテ 浜手 +ハマテ 濱手 +ハマデ 浜出 +ハマデ 濱出 +ハマデグチ 浜出口(濱出口) +ハマト 浜戸 +ハマト 浜登 +ハマト 濱戸 +ハマト 浜都 +ハマト 濱登 +ハマド 浜戸 +ハマド 濱戸 +ハマトウ 浜頭 +ハマトウ 浜藤 +ハマトウ 浜東 +ハマトウ 濱藤 +ハマドウ 浜堂 +ハマトコ 浜床 +ハマドノ 浜殿 +ハマトミ 浜富 +ハマトミ 濱冨 +ハマナ 浜名 +ハマナ 濱名 +ハマナ 浜菜 +ハマナカ 浜中 +ハマナカ 濱中 +ハマナカ 浜仲 +ハマナカ 濱仲 +ハマナガ 浜永 +ハマナガ 浜長 +ハマナガ 濱永 +ハマナガ 濱長 +ハマナミ 浜浪 +ハマナミ 浜波 +ハマナミ 濱波 +ハマナミ 濱浪 +ハマナリ 浜也(濱也) +ハマナワテ 浜畷 +ハマニ 浜二 +ハマニ 濱二 +ハマニシ 浜西 +ハマニシ 濱西 +ハマヌマ 浜沼 +ハマネ 浜根 +ハマネ 濱根 +ハマノ 浜野 +ハマノ 濱野 +ハマノ 浜埜 +ハマノ 濱埜 +ハマノ 浜濃 +ハマノ 汀埜 +ハマノイ 浜野井 +ハマノイ 濱ノ井(浜ノ井) +ハマノウ 浜納 +ハマノウ 濱納 +ハマノウエ 浜之上 +ハマノウエ 浜ノ上 +ハマノウエ 浜野上 +ハマノウエ 濱ノ上 +ハマノウエ 濱之上 +ハマノウエ 濱野上 +ハマノウチ 浜野内(濱野内) +ハマノソノ 浜ノ園 +ハマノソノ 濱ノ園 +ハマノヤ 浜野谷 +ハマノヤ 濱野谷 +ハマノワ 浜野和 +ハマバ 浜場 +ハマバ 浜波 +ハマバ 濱場 +ハマバ 濱波 +ハマハギ 浜萩(濱萩) +ハマハシ 浜橋 +ハマハシ 濱橋 +ハマバシ 浜橋 +ハマバシリ 浜走 +ハマバシリ 濱走 +ハマハタ 浜畑 +ハマハタ 浜端 +ハマハタ 濱畑 +ハマハタ 濱端 +ハマハタ 浜畠 +ハマハタ 濱畠 +ハマバタ 浜畑 +ハマバタ 浜端 +ハマバタ 濱畑 +ハマバタ 濱端 +ハマバタケ 浜畠 +ハマハナ 浜花 +ハマバヤシ 浜林 +ハマバヤシ 濱林 +ハマハラ 浜原 +ハマハラ 濱原 +ハマヒガ 浜比嘉 +ハマヒガ 濱比嘉 +ハマヒガ 浜比加 +ハマヒラ 浜平 +ハマヒラ 濱平 +ハマビラ 濱平 +ハマヒロ 浜広(浜廣) +ハマヒロ 濱廣 +ハマフク 浜福 +ハマフク 濱福 +ハマフジ 浜藤 +ハマフジ 濱藤 +ハマフチ 濱渕 +ハマブチ 浜渕 +ハマブチ 濱渕 +ハマブチ 浜淵 +ハマブチ 濱縁 +ハマブチ 濱淵 +ハマベ 浜辺 +ハマベ 浜部 +ハマベ 濱邊 +ハマベ 濱部 +ハマベ 濱辺 +ハマベ 濱邉 +ハマベ 浜邊 +ハマベ 浜邉 +ハマホリ 浜堀 +ハマホリ 濱堀 +ハママエ 浜前 +ハママエ 濱前 +ハママエ 濵前 +ハママス 浜増(濱増) +ハママチ 浜町 +ハママチ 濱町 +ハママツ 浜松 +ハママツ 濱松 +ハマミ 浜見 +ハマミ 濱見 +ハマミズ 浜水 +ハマミズ 濱水 +ハマミチ 浜道 +ハマミチ 濱道 +ハマミツ 浜満 +ハマミツ 濱満 +ハマミナト 浜湊 +ハマミナト 濱湊 +ハマミヤ 浜宮 +ハマムカ 濱向 +ハマムカイ 浜向 +ハマムカイ 濱向 +ハマムキ 浜向 +ハマムキ 濱向 +ハマムラ 浜村 +ハマムラ 濱村 +ハマムロ 浜室 +ハマムロ 濱室 +ハマモト 浜本 +ハマモト 濱本 +ハマモト 浜元 +ハマモト 濱元 +ハマモリ 浜守 +ハマモリ 浜森 +ハマモリ 濱森 +ハマモリ 浜盛 +ハマモリ 濱守 +ハマモリ 濱盛 +ハマヤ 浜谷 +ハマヤ 浜屋 +ハマヤ 濱谷 +ハマヤ 浜家 +ハマヤ 濱屋 +ハマヤ 浜矢 +ハマヤ 濱家 +ハマヤ 濱矢 +ハマヤ 蛤谷 +ハマヤウチ 浜谷内(濱谷内) +ハマヤシキ 浜屋敷 +ハマヤシキ 濱屋敷 +ハマヤス 浜安 +ハマヤス 浜保 +ハマヤス 濱安 +ハマヤス 濱保 +ハマヤチ 浜谷内(濱谷内) +ハマヤマ 浜山 +ハマヤマ 濱山 +ハマユウ 浜遊 +ハマユウ 濱遊 +ハマユキ 浜行 +ハマユキ 濱行 +ハマユミバ 浜弓場 +ハマユミバ 濱弓場 +ハマヨウ 浜陽 +ハマヨシ 浜吉 +ハマヨシ 濱吉 +ハマヨセ 浜寄(濱寄) +ハマヨツ 浜四津 +ハマヨツ 濱四津 +ハマワキ 浜脇 +ハマワキ 濱脇 +ハマワタリ 浜渡 +ハマワタリ 濱渡 +ハミ 波見 +ハミダ 長深田 +バミョウ 姥妙 +ハム 羽牟 +ハムラ 羽村 +ハムラ 端村 +ハムラ 波村 +ハムラ 羽邑 +ハムラ 葉村 +ハムロ 羽室 +ハムロ 葉室 +ハムロ 土室 +バメ 場目 +バメン 馬面 +ハモ 葉茂 +ハモ 鱧 +ハモウ 羽毛 +ハモウ 破毛 +ハモダ 羽毛田 +ハモタニ 鱧谷 +ハモチ 羽持 +ハモツ 羽物 +ハモツ 羽生津 +ハモト 葉本 +ハモト 坡下 +ハモト 羽本 +バモト 場本 +バモト 塲本 +ハモナガ 鱧永 +ハモノ 鱧野 +ハモヤ 鱧屋 +ハモヤマ 波母山 +ハモリ 羽森 +ハモリ 羽守 +ハモロ 羽諸 +ハヤ 羽矢 +ハヤ 羽谷 +ハヤ 早 +ハヤ 芳養 +バヤ 場谷 +バヤ 場家 +ハヤアキ 速開 +ハヤアサ 早朝 +ハヤアシ 早足 +ハヤイ 早井 +ハヤイ 速井 +ハヤイシ 早石 +ハヤイシ 速石 +ハヤイズミ 早泉 +ハヤイネ 早稲 +ハヤウチ 早内 +ハヤウマ 早馬 +ハヤウメ 早梅 +ハヤオ 早尾 +ハヤオカ 早岡 +ハヤガ 早賀 +ハヤガキ 早垣 +ハヤカシ 早柏 +ハヤカシ 早貸 +ハヤカシ 早借 +ハヤカシ 早樫 +ハヤカゼ 早風 +ハヤカゼ 速風 +ハヤカタ 速形 +ハヤカタ 早形 +ハヤカタ 早方 +ハヤカタ 速方 +ハヤカネ 早兼 +ハヤガネ 早金 +ハヤガネ 早兼 +ハヤガネ 早鉦 +ハヤガネ 早鐘 +ハヤカミ 早上 +ハヤガメ 早亀 +ハヤカリ 早狩 +ハヤカリ 早猟 +ハヤガリ 早猟 +ハヤガリ 爬揚 +ハヤカワ 早川 +ハヤカワ 早河 +ハヤカワ 速川 +ハヤキ 早木 +ハヤキ 隼木 +ハヤキ 早起 +ハヤクサ 早草 +ハヤグチ 早口 +ハヤクニ 速国(速國) +ハヤクマ 早久間 +ハヤクマ 早熊 +ハヤクモ 早雲 +ハヤクラ 早倉 +ハヤグリ 早栗 +ハヤコ 早子 +ハヤコウ 早幸 +ハヤコシ 林越 +ハヤコシ 早越 +ハヤゴシ 早越 +ハヤサ 早佐 +ハヤサカ 早坂 +ハヤサカ 早阪 +ハヤザカ 早坂 +ハヤサキ 早崎 +ハヤサキ 林崎 +ハヤサキ 早咲 +ハヤサキ 早嵜 +ハヤサキ 早先 +ハヤザキ 早崎 +ハヤザキ はr +ハヤサコ 早迫 +ハヤサコ 早佐古 +ハヤサダ 早定 +ハヤサワ 早沢 +ハヤサワ 早澤 +ハヤザワ 早沢 +ハヤザワ 早澤 +ハヤシ 林 +ハヤシ 森 +ハヤシ 早矢仕 +ハヤシ 早志 +ハヤシ 早司 +ハヤシ 林志 +ハヤシ 晨 +ハヤシ 早師 +ハヤシ 早矢士 +ハヤシ 速司 +ハヤシイ 林井 +ハヤシイシ 林石 +ハヤシウチ 林内 +ハヤシオ 林尾 +ハヤシオ 早塩 +ハヤシオカ 林岡 +ハヤシガイト 林垣内 +ハヤシガキ 林垣 +ハヤシガタニ 林ケ谷 +ハヤシガネ 林金 +ハヤシカミ 林上 +ハヤシガミ 林上 +ハヤシカワ 林川 +ハヤシギ 林木 +ハヤシギシ 林岸 +ハヤシグチ 林口 +ハヤシクラ 林倉 +ハヤシグラ 林倉 +ハヤシゲ 早重 +ハヤシコシ 林越 +ハヤシゴシ 林腰 +ハヤシサカ 林阪 +ハヤシザキ 林崎 +ハヤシザキ 林嵜 +ハヤシザキ 林埼 +ハヤシザコ 林迫 +ハヤシザワ 林沢 +ハヤシジ 林地 +ハヤシシタ 林下 +ハヤシジマ 林島 +ハヤシショウ 林庄 +ハヤシジリ 林尻 +ハヤシゾエ 林添 +ハヤシゾノ 林園 +ハヤシゾノ 林薗 +ハヤシタ 林田 +ハヤシタ 林下 +ハヤシタ 早下 +ハヤシダ 林田 +ハヤシタケ 林竹 +ハヤシタニ 林谷 +ハヤシダニ 林谷 +ハヤシツジ 林辻 +ハヤシデ 林出 +ハヤシデラ 林寺 +ハヤシド 林戸 +ハヤシドウ 林堂 +ハヤシドノ 林殿 +ハヤシナカ 林中 +ハヤシヌマ 林沼 +ハヤシネ 林根 +ハヤシノ 林野 +ハヤシノ 林埜 +ハヤシノ 林能 +ハヤシノウチ 林ノ内 +ハヤシノシタ 林之下 +ハヤシノシタ 林野下 +ハヤシノシタ 林ノ下 +ハヤシバ 林飛 +ハヤシバ 林葉 +ハヤシハラ 林原 +ハヤシバラ 林原 +ハヤシヒラ 林平 +ハヤシベ 林部 +ハヤシベ 林辺(林邊・林邉) +ハヤシマ 早島 +ハヤシマ 早嶋 +ハヤシマ 林間 +ハヤジマ 早島 +ハヤシマツ 林松 +ハヤシマル 林丸 +ハヤシミ 林見 +ハヤシムラ 林村 +ハヤシモト 林本 +ハヤシモト 林元 +ハヤシモリ 林森 +ハヤシヤ 林谷 +ハヤシヤ 林屋 +ハヤシヤ 林家 +ハヤシヤマ 林山 +ハヤショウ 早生 +ハヤジリ 早尻 +ハヤシワキ 林脇 +ハヤス 速寿 +ハヤスギ 早杉 +ハヤスケ 早助 +ハヤスズ 早鈴 +ハヤズミ 早泉 +ハヤセ 早瀬 +ハヤセ 早勢 +ハヤセ 瀬 +ハヤセ 隼瀬 +ハヤセ 林瀬 +ハヤセ 速瀬 +ハヤセ 早世 +ハヤセガワ 早瀬川 +ハヤセト 早瀬戸 +ハヤソ 早曽 +ハヤゾエ 早副 +ハヤゾノ 早園 +ハヤタ 林田 +ハヤタ 早田 +ハヤタ 隼田 +ハヤタ 速田 +ハヤタ 速多 +ハヤタカ 早高 +ハヤタキ 早滝(早瀧) +ハヤタケ 早竹 +ハヤタケ 早武 +ハヤタケ 早笋 +ハヤダテ 早立 +ハヤダテ 速館 +ハヤタニ 早谷 +ハヤタニ 速谷 +バヤチ 場谷内 +ハヤツ 早津 +ハヤツ 速津 +ハヤツカ 早塚 +ハヤツキ 早月 +ハヤテ 早手 +ハヤデ 早出 +ハヤト 早戸 +ハヤト 早渡 +ハヤト 隼人 +ハヤト 羽屋戸 +ハヤト 速渡 +ハヤト 早人 +ハヤトウ 早藤 +ハヤトウ 速藤 +ハヤトウ 早頭 +ハヤトウ 早東 +ハヤドオリ 早通 +ハヤトマ 早苫 +ハヤトミ 早富 +ハヤトミ 早冨 +ハヤトモ 早友 +ハヤトリ 早取 +ハヤナ 早名 +ハヤナガ 早永 +ハヤナギ 葉柳 +ハヤナダ 早灘 +ハヤナミ 早浪 +ハヤナリ 早生 +ハヤノ 早野 +ハヤノ 隼野 +ハヤノ 速野 +ハヤノセ 早ノ瀬 +ハヤノリ 早乗 +ハヤバ 早羽 +ハヤハシ 早橋 +ハヤハマ 早浜(早濱) +ハヤバヤシ 早林 +ハヤハラ 早原 +ハヤバラ 早原 +ハヤヒ 早樋 +ハヤヒ 早日 +ハヤヒサ 早久 +ハヤヒト 早日渡 +ハヤヒラ 早平 +ハヤフク 早福 +ハヤフサ 早房 +ハヤブサ 早房 +ハヤブサ 隼 +ハヤフジ 早藤 +ハヤフジ 速藤 +ハヤフチ 早渕 +ハヤフチ 早淵 +ハヤブチ 早渕 +ハヤブチ 早淵 +ハヤフネ 早船 +ハヤフネ 早舩 +ハヤフネ 早舟 +ハヤベ 早部 +ハヤベ 早辺 +ハヤマ 羽山 +ハヤマ 葉山 +ハヤマ 端山 +ハヤマ 早山 +ハヤマ 巴山 +ハヤマ 林山 +ハヤマ 早間 +ハヤマ 早馬 +ハヤマ 半山 +ハヤマ 波山 +ハヤマ 早麻 +ハヤマ 吐山 +ハヤマ 速山 +ハヤマ 苞山 +ハヤマ 坡山 +ハヤマ 竒山 +ハヤマキ 早馬木 +ハヤマゾノ 羽山薗 +ハヤマゾノ 羽山園 +ハヤマツ 早松 +ハヤマル 早丸 +ハヤミ 速水 +ハヤミ 早見 +ハヤミ 早水 +ハヤミ 頓宮 +ハヤミ 速見 +ハヤミ 早弓 +ハヤミ 林見 +ハヤミ 早速 +ハヤミ 早味 +ハヤミ 逸民 +ハヤミ 早海 +ハヤミズ 速水 +ハヤミズ 早水 +ハヤミズ 逸水 +ハヤミチ 早道 +ハヤミチ 速道 +ハヤミチ 速路 +ハヤミツ 早光 +ハヤムラ 早村 +ハヤメ 早目 +ハヤメ 速目 +ハヤモト 早本 +ハヤモト 早元 +ハヤモト 速基 +ハヤモリ 早森 +ハヤヤマ 早山 +ハヤユミ 早弓 +ハヤワキ 早脇 +ハヤワケ 早分 +ハヤワタリ 早渡 +ハユカ 羽床 +ハヨウ 葉養 +ハヨシ 羽吉 +ハラ 原 +ハラ 羽良 +ハラ 波羅 +ハラ 波良 +ハラ 破良 +ハラ 壙 +ハライ 原井 +ハライ 払井 +ハライ 拂井 +ハライカワ 秡川 +ハライカワ 原井川 +ハライカワ 祓川 +ハライカワ 払川 +ハライカワ 拂川 +ハライガワ 原井川 +ハライケ 原池 +ハライシ 孕石 +ハライシ 原石 +ハライダ 払田 +ハライダ 拂田 +ハライチ 原市 +ハライヤマ 払山 +ハライヤマ 拂山 +ハライワ 秡輪 +ハラウエ 原上 +ハラウチ 原内 +ハラウマ 原馬 +ハラウラ 原浦 +ハラエ 原衛 +ハラエ 原江 +ハラオ 原尾 +ハラオ 原生 +ハラオカ 原岡 +ハラオビ 腹帯 +ハラガ 原賀 +ハラガイチ 原垣内 +ハラガウチ 原垣内 +ハラガキ 原垣 +ハラガキウチ 原垣内 +ハラカジ 原梶 +ハラガシラ 原頭 +ハラカミ 原神 +ハラガミ 原上 +ハラカワ 原川 +ハラカワ 原河 +ハラキ 原木 +ハラキ 原城 +ハラキ 原黄 +ハラギ 原木 +バラキ 茨木 +ハラキタ 原北 +ハラクチ 原口 +ハラグチ 原口 +ハラクニ 原国 +ハラクニ 原國 +ハラグニ 原国 +ハラグニ 原國 +ハラクマ 原熊 +ハラゲ 原毛 +ハラコ 原子 +ハラコ 腹子 +ハラゴ 原後 +ハラゴウ 原郷 +ハラゴウチ 原垣内 +ハラコシ 原越 +ハラコン 原紺 +ハラサカ 原坂 +ハラサキ 原崎 +ハラサキ 服崎 +ハラサキ 原先 +ハラサキ 原嵜 +ハラザキ 原崎 +ハラザキ 服崎 +ハラサコ 原迫 +ハラサコ 原廻 +ハラササ 原笹 +ハラサワ 原沢 +ハラサワ 原澤 +ハラザワ 原沢 +ハラザワ 原澤 +バラサワ 荊沢 +バラサワ 茨沢 +バラサワ 荊澤 +バラサワ 茨澤 +バラザワ 荊沢 +バラザワ 荊澤 +ハラジ 原地 +ハラシゲ 原重 +ハラシタ 原下 +ハラシダ 原信田 +ハラシナ 原科 +ハラシナ 原品 +ハラシナイ 原子内 +ハラシノ 原篠 +ハラシマ 原島 +ハラシマ 原嶋 +ハラシマ 原嶌 +ハラジマ 原島 +ハラジマ 原嶋 +バラシマ 茨島 +バラジマ 茨島 +ハラジョウ 原上 +ハラジョウ 原条 +ハラジリ 原尻 +ハラシロ 原城 +ハラズミ 原住 +ハラセ 原瀬 +ハラセ 原勢 +ハラセ 原背(原脊) +ハラゾエ 原添 +ハラソノ 原園 +ハラソノ 原囿 +ハラゾノ 原園 +ハラゾノ 原薗 +ハラゾノ 原囿 +ハラタ 原田 +ハラタ 原多 +ハラダ 原田 +ハラダ 服田 +ハラダ 原良田 +ハラダ 頗羅堕 +ハラダ 腹田 +バラタ 茨田 +バラダ 茨田 +ハラダイ 原代 +ハラダグチ 原田口 +ハラタケ 原武 +ハラタケ 原竹 +ハラタニ 原谷 +ハラダヒラ 原田平 +ハラチ 原地 +ハラツ 原津 +ハラツカ 原塚 +ハラヅカ 原塚 +ハラデ 原出 +ハラデラ 原寺 +ハラト 原戸 +ハラド 原土 +バラト 茨戸 +ハラトウ 原藤 +ハラドノ 原殿 +ハラトミ 原富 +ハラトミ 原冨 +ハラドミ 原富 +ハラドミ 原冨 +ハラトメ 原留 +ハラドメ 原留 +ハラナ 原名 +ハラナカ 原中 +ハラナカ 原仲 +ハラナガ 原永 +ハラニシ 原西 +ハラヌマ 原沼 +ハラネ 原根 +ハラネ 原禰 +ハラネ 原祢 +ハラノ 原野 +ハラノ 原納 +ハラノ 原埜 +バラノ 茨野 +ハラノウ 原納 +ハラノウ 原農 +ハラノウシロ 原ノ後 +ハラノウシロ 原之後 +ハラノシタ 原之下 +ハラノソノ 原之園 +ハラノソノ 原之薗 +ハラノソノ 原ノ園 +ハラノゾノ 原之薗 +ハラノゾノ 原ノ園 +ハラノムラ 原之村 +ハラノヤ 原野谷 +ハラハシ 原橋 +ハラハタ 原畑 +ハラハタ 原畠 +ハラバタ 原畠 +ハラハマ 原浜(原濱) +ハラバヤシ 原林 +ハラヒガシ 原東 +ハラフジ 原藤 +ハラフジ 服藤 +ハラブチ 原渕 +ハラブチ 原淵 +ハラベ 原部 +ハラベ 原辺(原邊) +ハラベ 腹部 +ハラマ 原間 +ハラマ 原馬 +ハラマイ 原間井 +ハラマエ 原前 +ハラマキ 服巻 +ハラマキ 原槙 +ハラマキ 腹巻 +ハラマキ 原巻 +ハラマキ 原槇 +ハラマキ 服卷 +ハラマチ 原町 +ハラマツ 原松 +ハラミ 原見 +ハラミ 孕 +ハラミイシ 孕石 +ハラミカワ 孕川 +ハラミズ 原水 +ハラミツ 原光 +ハラミツ 波羅密 +ハラミョウ 原明 +ハラムラ 原村 +ハラメ 原目 +ハラモ 原茂 +ハラモト 原本 +ハラモト 原元 +ハラモリ 原森 +ハラヤ 原谷 +ハラヤ 原屋 +ハラヤ 原弥 +ハラヤ 原矢 +ハラヤシキ 原屋敷 +ハラヤマ 原山 +ハラヨシ 原吉 +ハラヨシダ 原良田 +ハララ 原良 +ハラワキ 原脇 +ハリ 開 +ハリ 張 +ハリ 播 +ハリ 羽里 +ハリ 発 +ハリ 波里 +ハリ 針 +ハリ 畭 +ハリ 巴里 +ハリ 葉利 +ハリ 波理 +ハリ 羽利 +ハリ 葉里 +ハリ 波利 +ハリイ 播井 +ハリイ 針井 +ハリイ 張井 +ハリイ 波利井 +ハリイケ 針池 +ハリイシ 張石 +ハリイシ 針石 +ハリウ 針生 +ハリウラ 針浦 +ハリエ 張江 +ハリエ 針江 +ハリエ 針重 +ハリオ 針生 +ハリオ 針尾 +ハリオ 張尾 +ハリオ 畭尾 +ハリオカ 播岡 +ハリオカ 針岡 +ハリオカ 張丘 +ハリオカ 張岡 +ハリオジマ 針尾島 +ハリカイ 張替 +ハリカイ 針替 +ハリカイ 針貝 +ハリカイ 張貝 +ハリガイ 張替 +ハリガイ 針谷 +ハリガイ 張谷 +ハリガイ 針替 +ハリガイ 針貝 +ハリガイ 張貝 +ハリガイ 張ケ井 +ハリカエ 張替 +ハリカエ 針替 +ハリガエ 張替 +ハリガエ 針替 +ハリカゴ 張篭 +ハリカゴ 張籠 +ハリカネ 播金 +ハリガネ 針金 +ハリガネ 播金 +ハリガネヤ 針金屋 +ハリガネヤ 針金谷 +ハリガヤ 針谷 +ハリガヤ 針ケ谷 +ハリガヤ 張ケ谷 +ハリガヤ 張谷 +ハリガヨ 張ケ代 +ハリカワ 張川 +ハリカワ 播川 +ハリカワ 針川 +ハリカワ 榛川 +ハリキ 針木 +ハリキ 梁木 +ハリキ 榛木 +ハリキ 張木 +ハリキ 播木 +ハリキタ 針北 +ハリグチ 播口 +ハリグチ 針口 +ハリグチ 張口 +ハリクボ 針久保 +ハリコ 張籠 +ハリコウ 針幸 +ハリサキ 針崎 +ハリサキ 張崎 +ハリサコ 張迫 +ハリサワ 梁沢 +ハリサワ 針沢(針澤) +ハリサワ 張沢 +ハリサワ 梁澤 +ハリジ 播治 +ハリシゲ 播重 +ハリシタ 針下 +ハリシマ 播島 +ハリシマ 張島 +ハリセ 梁瀬 +ハリタ 張田 +ハリタ 針田 +ハリタ 播田 +ハリタ 幡田 +ハリタ 榛田 +ハリタ 針多 +ハリタ 鍼田 +ハリタケ 張岳 +ハリタテ 針立 +ハリタニ 針谷 +ハリタニ 張谷 +ハリタニ 播谷 +ハリタニ 梁谷 +ハリタヤ 張田谷 +ハリチョウ 張丁 +ハリツカ 針塚 +ハリヅカ 針塚 +ハリツジ 針辻 +ハリト 張戸 +ハリトミ 張富 +ハリナガ 針長 +ハリナガ 張永 +ハリナガ 播永 +ハリナミ 針浪 +ハリニシ 張西 +ハリノ 播野 +ハリノ 張野 +ハリノ 開野 +ハリノ 針野 +ハリノ 波里野 +ハリバ 針場 +ハリバ 張場 +ハリバヤシ 張林 +ハリハラ 針原 +ハリハラ 榛原 +ハリハラ 張原 +ハリハラ 播原 +ハリバラ 針原 +ハリヒサ 張久 +ハリフチ 針淵 +ハリフチ 針渕 +ハリブチ 張渕 +ハリマ 播磨 +ハリマ 播摩 +ハリマ 張間 +ハリマ 針間 +ハリマ 播間 +ハリマ 張磨 +ハリマ 張摩 +ハリマ 梁間 +ハリマ 針馬 +ハリマ 播馬 +ハリマ 播麿 +ハリマ 波利摩 +ハリマ 榛間 +ハリマ 張真 +ハリマ 播真(播眞) +ハリマ 播广 +ハリマ 幡摩 +ハリマ 幡磨 +ハリマ 針磨 +ハリマタニ 播磨谷 +ハリマダニ 播磨谷 +ハリマヤ 播磨谷 +ハリマヤ 播磨屋 +ハリマヤ 播摩谷(播广谷) +ハリマヤ 針間矢 +ハリマヤ 播摩屋 +ハリミ 播見 +ハリミチ 針道 +ハリミチ 張道 +ハリミツ 張光 +ハリミヤ 針宮 +ハリムラ 播村 +ハリムラ 針村 +ハリムラ 張村 +ハリモ 針茂 +ハリモチ 針持 +ハリモト 張本 +ハリモト 播本 +ハリモト 梁本 +ハリモト 針本 +ハリモト 播元 +ハリモト 張元 +ハリモト 針元 +ハリモト 畭元 +ハリモト 橎本 +ハリヤ 針谷 +ハリヤ 張谷 +ハリヤ 播谷 +ハリヤ 針屋 +ハリヤ 張矢 +ハリヤマ 針山 +ハリヤマ 張山 +ハリヤマ 梁山 +ハリヤマ 播山 +ハリヤマサワ 張山沢 +ハリヤマザワ 張山沢 +ハリヤマザワ 張山澤 +ハリュウ 針生 +ハリュウ 波立 +ハリュウ 羽竜 +ハリュウ 羽龍 +ハリョウ 巴陵 +ハリヨシ 張吉 +ハリヨシ 針吉 +ハリワラ 針原 +ハル 開 +ハル 春 +ハル 波留 +ハル 治 +ハルアキ 春秋 +ハルアケ 春明 +ハルイ 温井 +ハルイ 春井 +ハルイ 治居 +ハルイ 治井 +ハルイエ 晴家 +ハルイシ 春石 +ハルウチ 春内 +ハルウミ 春海 +ハルエ 春江 +ハルオ 春尾 +ハルオカ 春岡 +ハルオカ 治岡 +ハルオカ 晴岡 +ハルガ 春賀 +ハルカイチ 春貝地 +ハルガイチ 春貝地 +ハルカゼ 春風 +ハルカネ 春兼 +ハルカネ 治金 +ハルガネ 治金 +ハルカミ 春上 +ハルカワ 東川 +ハルカワ 春川 +ハルカワ 陽川 +ハルカワ 治川 +ハルカワ 晴川 +ハルキ 春木 +ハルキ 春貴 +ハルキ 春城 +ハルキ 晴気 +ハルキ 春樹 +ハルキ 晴木 +ハルキ 晴氣 +ハルキ 陽木 +ハルキダニ 春木谷 +ハルキバ 春木場 +ハルキヤ 春木屋 +ハルクチ 春口 +ハルグチ 春口 +ハルクニ 春国 +ハルクニ 春國 +ハルケ 晴気 +ハルケ 晴氣 +ハルコマ 春駒 +ハルサ 春佐 +ハルサキ 春崎 +ハルサキ 春嵜 +ハルサト 春里 +ハルサワ 榛沢 +ハルサワ 榛澤 +ハルサワ 春沢 +ハルサワ 春澤 +ハルサワ 治沢 +ハルシゲ 春重 +ハルシタ 春下 +ハルシマ 春島 +ハルシマ 治島 +ハルシマ 春嶋 +ハルスエ 春末 +ハルズミ 春住 +ハルセ 春瀬 +ハルゾエ 春添 +ハルゾノ 春園 +ハルゾノ 春薗 +ハルタ 春田 +ハルタ 治田 +ハルタ 治多 +ハルタ 榛田 +ハルタ 春多 +ハルタ 晴田 +ハルダ 春田 +ハルタカ 春高 +ハルタキ 春滝 +ハルタキ 春瀧 +ハルタケ 治武 +ハルタケ 春竹 +ハルタケ 春武 +ハルタニ 春谷 +ハルタニ 治谷 +ハルチ 晴智 +ハルチカ 春近 +ハルツグ 春次 +ハルツミ 春摘 +ハルデ 春出 +ハルト 春戸 +ハルトミ 春冨 +ハルナ 春名 +ハルナ 春菜 +ハルナ 榛名 +ハルナ 春那 +ハルナカ 春中 +ハルナガ 春永 +ハルナガ 治良 +ハルナガ 春長 +ハルナガ 晴永 +ハルナミ 春浪 +ハルナリ 春成 +ハルノ 春野 +ハルノ 晴野 +ハルノ 治野 +ハルバ 榛葉 +ハルハタ 春畑 +ハルハナ 春花 +ハルバヤシ 春林 +ハルハラ 春原 +ハルハラ 晴原 +ハルバラ 春原 +ハルヒ 春樋 +ハルヒサ 春久 +ハルビュウ 春別府 +ハルフク 治福 +ハルフジ 春藤 +ハルベ 治部 +ハルベ 春辺 +ハルベップ 春別府 +ハルペン 春遍 +ハルマ 春間 +ハルマ 春馬 +ハルマキ 晴柀 +ハルマキ 晴披 +ハルマシ 春増 +ハルマチ 春町 +ハルマツ 春松 +ハルミ 春見 +ハルミ 春海 +ハルミ 春美 +ハルミチ 春道 +ハルミツ 春光 +ハルミネ 晴峯 +ハルミネ 晴嶺 +ハルミヤ 春宮 +ハルムラ 春村 +ハルメ 春芽 +ハルモト 春本 +ハルモト 春元 +ハルモリ 春森 +ハルヤ 治谷 +ハルヤギ 春柳 +ハルヤマ 春山 +ハルヤマ 晴山 +ハルヤマ 治山 +ハルヤマ 榛山 +ハルヤマ 遥山 +ハルヤマ 遙山 +ハルヨシ 春吉 +ハルヨシ 春好 +ハルヨシ 春芳 +ハルワ 春和 +ハルワカ 春若 +ハレ 晴 +ハレ 波連 +ハレアキ 晴明 +ハレサク 晴佐久 +ハレサワ 晴沢 +ハレサワ 晴澤 +ハレタ 晴田 +ハレマ 晴間 +ハレマキ 晴柀 +ハレマキ 晴披 +ハレヤマ 晴山 +ハレン 波連 +ハロ 波呂 +ハロ 破呂 +ハワ 垪和 +ハワイ 羽合 +ハワカ 葉若 +ハワカベ 羽若部 +ハン 藩 +バン 坂 +バン 伴 +バン 塙 +バン 阪 +バン 番 +バン 幡 +バン 播 +バン 判 +バン 藩 +バン 磐 +バン 墫 +バン 鷭 +バン 晩 +バン 蕃 +バン 鑁 +ハンイ 半井 +バンイ 番井 +バンイ 伴井 +ハンイノ 半井野 +バンイン 坂隠 +ハンウラ 半浦 +バンウラ 番浦 +バンカ 番家 +バンガ 番賀 +ハンカイ 半海 +ハンガイ 板谷 +ハンガイ 半谷 +ハンガイ 飯開 +ハンガイ 榛谷 +バンカイ 伴海 +ハンガイシ 半下石 +ハンガイシ 半が石 +ハンガイシ 半ケ石 +ハンカワ 半川 +バンカワ 番川 +ハンガン 判官 +ハンギ 半木 +バンキ 盤木 +バンキ 伴木 +バンキ 万亀 +バンキ 番木 +バンキ 萬亀 +ハンギヤ 判木屋 +バンキュウ 万久 +バンキヨ 番清 +ハンギョウ 萩行 +バンキン 坂金 +ハンクイ 半杭 +ハングイ 半杭 +バングチ 番口 +バンクラ 番倉 +ハンケ 判家 +ハンゲ 半夏 +ハンゲイシ 半下石 +ハンコ 飯古 +バンコ 番戸 +バンコウ 万幸 +バンコク 万国 +バンコク 萬国 +ハンザ 半座 +ハンザ 半左 +バンザ 番座 +バンザイ 坂西 +バンザイ 阪西 +バンザイ 万歳 +バンザイ 萬歳 +バンザイ 伴在 +バンザイ 万才 +バンザイ 板西 +バンザイ 坂齋 +バンザイ 萬才 +バンザイ 萬財 +ハンザイケ 繁在家 +ハンサカ 半坂 +ハンザカ 半坂 +ハンザカ 半阪 +バンサカ 塙阪 +バンサカ 番坂 +ハンサキ 飯崎 +ハンザキ 半崎 +ハンザキ 飯崎 +ハンザキ 吐前 +ハンザキ 吐崎 +ハンザキ 飯嵜 +バンザキ 盤崎 +ハンサク 飯作 +バンサク 番作 +ハンサコ 半浴 +バンザシ 盤指 +ハンサワ 半沢 +ハンサワ 半澤 +ハンザワ 半沢 +ハンザワ 半澤 +ハンザワ 榛沢 +ハンザワ 榛澤 +ハンザワ 繁沢 +ハンザワ 判沢 +ハンザワ 繁澤 +ハンザワ 判澤 +ハンザワ 棒沢 +バンサワ 番沢 +バンザワ 番沢 +バンザワ 鴋沢 +バンザワ 番澤 +バンザワ 鴋澤 +バンザワ 晩沢 +バンザン 盤山 +ハンシ 半司 +ハンジ 判治 +ハンジ 繁地 +ハンジ 伴治 +ハンジ 半治 +バンジ 万治 +バンジ 萬治 +バンジ 絆地 +バンジ 伴地 +バンジ 番字 +バンシタ 番下 +バンシャ 万砂 +バンシャ 萬砂 +バンジャ 伴邪 +バンジャク 盤若 +バンジュ 万寿 +バンジュ 萬寿 +バンジュ 萬壽 +バンシュウ 万洲 +バンジュウ 番重 +バンショ 番所 +バンショ 番処 +バンジョ 盤所 +ハンジョウ 繁昌 +ハンジョウ 半情 +ハンジョウ 繁盛 +バンショウ 番匠 +バンショウ 万正 +バンショウ 萬正 +バンショウ 播正 +バンショウ 盤匠 +バンショウ 萬松 +バンジョウ 番場(番塲) +バンジョウ 番匠 +バンジョウ 幡上 +バンジョウ 番条 +バンジョウ 万城 +バンジョウ 坂城 +バンジョウ 萬上 +バンジョウ 番庄 +バンジョウ 播上 +バンジョウ 番上 +バンジョウ 番城 +バンジョウ 万上 +バンジョウ 萬城 +バンジョウ 番定 +バンジョウ 番條 +バンジョウ 萬匠 +バンジョウ 伴丈 +バンジョウ 伴城 +バンジョウ 番正 +バンジョウ 盤杖 +バンショウタニ 番匠谷 +バンショウダニ 番匠谷 +ハンジョウノ 半上野 +バンショウヤ 番匠谷 +バンジョウヤ 番匠谷 +バンジョウヤ 坂上谷 +バンジョウヤ 阪上谷 +バンスイ 番水 +バンズイ 幡随 +バンズイ 幡隋 +バンズイ 伴瑞 +バンズイ 番隨(番随) +ハンスケ 半洲毛 +ハンセ 半瀬 +バンセ 伴瀬 +ハンセイ 半晴 +バンセイ 万世 +バンセイ 萬世 +バンゾウ 伴蔵 +バンゾノ 番園 +ハンタ 飯田 +ハンタ 半田 +ハンタ 繁多 +ハンタ 範多 +ハンダ 飯田 +ハンダ 半田 +ハンダ 阪田 +ハンダ 繁田 +ハンダ 反田 +ハンダ 伴田 +ハンダ 判田 +ハンダ 磐田 +ハンダ 吐田 +ハンダ 繁多 +ハンダ 判多 +ハンダ 範田 +ハンダ 藩田 +バンダ 伴田 +バンダ 番田 +バンダ 晩田 +バンダ 磻田 +ハンダイ 半代 +バンダイ 万代 +バンダイ 萬代 +バンダイ 坂大 +バンダイ 番代 +バンダイラ 番平 +バンダテ 番舘 +ハンタニ 半谷 +ハンタニ 判谷 +バンタニ 萬谷 +バンタニ 番谷 +バンタニ 伴谷 +ハンダヤマ 半田山 +ハンヂ 判治 +バンチ 番地 +バンチ 伴地 +バンチョウ 番長 +ハンヅカ 半塚 +ハンツキ 半月 +バンヅメ 番詰 +バンデ 番出 +バンデン 晩田 +ハント 伴戸 +ハンド 半戸 +ハンド 半渡 +バント 番途 +バンド 播戸 +バンド 伴戸 +バンド 伴登 +バンド 般戸 +バンド 番度 +バンド 番土 +バンド 盤戸 +ハンドウ 半藤 +ハンドウ 飯銅 +ハンドウ 飯藤 +ハンドウ 楾 +ハンドウ 坂堂 +ハンドウ 阪堂 +ハンドウ 半道 +ハンドウ 飯堂 +ハンドウ 判藤 +ハンドウ 飯道 +バントウ 坂東 +バントウ 板東 +バンドウ 坂東 +バンドウ 板東 +バンドウ 阪東 +バンドウ 坂藤 +バンドウ 伴藤 +バンドウ 万藤 +バンドウ 坂堂 +バンドウ 阪堂 +バンドウ 番藤 +バンドウ 伴登 +バンドウ 畔堂 +バンドウ 幡東 +バンドウ 伴道 +バンドウ 判藤 +バンドウ 藩藤 +バンドウ 番道 +バンドウ 橎堂 +バンドウジマ 坂東島 +バンドウバシ 坂東橋 +バンドウバシ 板東橋 +バンドバシ 坂東橋 +バンドヒラ 番戸平 +ハンドマリ 半泊 +バンドメ 番留 +ハンナ 繁名 +ハンナ 半那 +ハンナ 波武名 +ハンナ 半名 +ハンナイ 半内 +バンナイ 坂内 +バンナイ 伴内 +バンナイ 阪内 +バンナイ 番内 +バンナイ 板内 +バンナエ 伴苗 +ハンナカ 半中 +ハンナガ 半永 +バンナカ 伴仲 +バンナカ 伴中 +バンナカ 判中 +バンナカ 番中 +ハンナミ 半波 +ハンナミ 幡南 +ハンニタ 半仁田 +ハンニチ 半日 +ハンニャ 般若 +ハンニャ 盤若 +ハンヌキ 半貫 +ハンネ 半根 +ハンノ 坂野 +ハンノ 伴野 +ハンノ 阪野 +ハンノ 半野 +ハンノ 判野 +ハンノ 墫野 +ハンノ 半ノ +ハンノ 半埜 +バンノ 坂野 +バンノ 伴野 +バンノ 板野 +バンノ 阪野 +バンノ 幡野 +バンノ 番野 +バンノ 判野 +バンノ 阪納 +バンノ 盤野 +バンノ 阪埜 +バンノ 伴埜 +ハンノウ 半能 +バンノウ 番能 +バンノウ 阪納 +バンノウ 伴能 +バンノウ 坂納 +バンノウチ 伴ノ内 +バンノウチ 伴の内 +バンノウチ 伴之内 +ハンノウラ 半浦 +ハンノエ 飯橋 +ハンノキ 榿 +バンノキ 伴之木 +バンノキ 番野木 +ハンノキザワ 榿沢 +ハンノキザワ 榿澤 +ハンノダ 半野田 +ハンバ 半場 +ハンバ 半羽 +ハンバ 半波 +ハンバ 半塲 +バンバ 馬場 +バンバ 番場(番塲) +バンバ 坂場 +バンバ 伴場(伴塲) +バンバ 万場 +バンバ 万羽 +バンバ 萬羽 +バンバ 馬塲 +バンバ 番馬 +バンバ 万葉 +バンバ 萬葉 +バンバ 𣆶葉 +バンバ 伴庭 +バンバ 晩葉 +ハンパク 榛白 +ハンパク 半白 +ハンバタ 半畑 +ハンバヤシ 半林 +バンバヤシ 伴林 +ハンバラ 半原 +バンバラ 番原 +バンフク 万福 +バンフク 萬福 +ハンベ 半辺 +ハンベ 半部 +ハンベ 半邊 +ハンベ 半邉 +ハンポ 半保 +ハンマ 半間 +バンマ 播磨 +ハンマイバ 飯米場 +ハンマエ 判前 +バンミ 万実(萬実) +バンミ 万實 +バンミ 萬實 +ハンミネ 半嶺 +ハンミョウ 半明 +ハンミョウ 半妙 +ハンムラ 半村 +ハンメ 班目 +ハンモク 飯木 +ハンモト 半本 +バンモト 番本 +バンモト 万元 +ハンヤ 半谷 +ハンヤ 半矢 +ハンヤ 般谷 +バンヤ 万谷 +バンヤ 萬谷 +バンヤ 番屋 +バンヤ 番家 +バンヤ 番矢 +ハンヤク 繁益 +ハンヤマ 半山 +バンヤマ 番山 +ハンヨウ 半揚 +バンライ 万来 +バンライ 萬来(萬來) +バンリ 万里 +バンリ 萬里 +バンリュウ 伴流 +バンリュウ 幡竜(幡龍) +ハンリョウ 飯料 +ハンリン 般林 +ヒ 日 +ビ 美 +ヒアイ 日合 +ヒアイ 肥合 +ヒアキ 日秋 +ヒアケダ 干明田 +ヒアサ 日浅(日淺) +ヒアサ 日朝 +ヒアシ 火脚 +ヒアシ 日足 +ヒアシ 日脚 +ヒアタリ 日当 +ヒアタリ 日當 +ヒアテ 日当 +ヒアテ 日當 +ヒアワ 部粟 +ヒイ 樋井 +ヒイ 比井 +ヒイケ 日池 +ヒイケ 樋池 +ヒイシ 火石 +ヒイズミ 樋泉 +ヒイズミ 旭泉 +ヒイズミ 日泉 +ヒイデ 日出 +ヒイドメ 吹留 +ヒイラギ 柊 +ヒイラギ 柊木 +ヒイラギサワ 柊澤 +ヒイラギサワ 柊沢 +ヒイラギザワ 柊澤 +ヒイラギザワ 柊沢 +ヒイラギダニ 柊谷 +ヒイラギヤ 柊屋 +ヒイロ 日色 +ヒウ 日宇 +ヒウエ 樋上 +ヒウエ 火上 +ヒウガ 日向 +ヒウガジ 日向寺 +ヒウガノ 日向野 +ヒウケ 日生下 +ヒウケ 日請 +ヒウゲ 日生下 +ヒウゾン 日雨孫 +ヒウチ 樋内 +ヒウチ 燧 +ヒウチ 日内 +ヒウチイシ 火打石 +ヒウチイシ 火擲石 +ヒウマ 日馬 +ヒウラ 日浦 +ヒウラ 樋浦 +ヒウラ 日裏 +ヒウラ 比浦 +ヒウラ 火浦 +ヒウラ 檜浦 +ヒウラ 樋裏 +ヒウラ 桧浦 +ヒウラ 非浦 +ビウラ 美浦 +ヒウラタ 日浦田 +ヒウラダ 日浦田 +ヒエ 日栄 +ヒエ 樋栄(樋榮) +ヒエ 稗 +ヒエ 日榮 +ヒエ 比江 +ヒエ 日江 +ヒエイ 日永 +ヒエイ 樋江井 +ヒエイ 日栄 +ヒエイ 日江井 +ヒエイ 樋栄(樋榮) +ヒエイ 日榮 +ヒエイ 比叡 +ヒエイ 桶江井 +ヒエイ 日恵井 +ヒエイ 比榮 +ヒエイダ 日永田 +ヒエカタ 稗方 +ヒエガタ 稗方 +ヒエキ 稗木 +ヒエサカ 稗坂 +ヒエザワ 稗沢 +ヒエシマ 比江島 +ヒエシマ 稗島 +ヒエシマ 日衛島(日衛嶋) +ヒエジマ 比江島 +ヒエジマ 稗島 +ヒエジマ 比恵島(比惠島) +ヒエジマ 比江嶋 +ヒエジマ 稗嶋 +ヒエジマ 日衛島(日衛嶋) +ヒエタ 稗田 +ヒエタ 冷田 +ヒエダ 稗田 +ヒエダ 日永田 +ヒエダ 檜枝 +ヒエダ 桧枝 +ヒエダ 日枝 +ヒエダ 比枝 +ヒエダ 比延田 +ヒエタニ 比叡谷 +ヒエナイ 稗内 +ヒエナエ 稗苗 +ヒエヌキ 稗貫 +ヒエノ 日恵野(日惠野) +ヒエノ 稗野 +ヒエハタ 稗畠 +ヒエハタ 稗畑 +ヒエハタ 稗圃 +ヒエバタ 稗畠 +ヒエバタ 稗畑 +ヒエバタケ 稗畠 +ヒエムラ 稗村 +ヒエモト 稗本 +ヒエモリ 比江森 +ヒオ 桧尾 +ヒオ 日尾 +ヒオ 樋尾 +ヒオ 檜尾 +ヒオ 肥尾 +ヒオ 飛尾 +ヒオ 肥生 +ビオ 昆尾 +ヒオカ 飛岡 +ヒオカ 日岡 +ヒオカ 樋岡 +ヒオカ 肥岡 +ヒオカ 火岡 +ヒオキ 日置 +ヒオキ 日沖 +ヒオキ 火置 +ヒオキ 氷置 +ヒオキ 旭置 +ヒオク 樋屋 +ヒオダ 日小田 +ヒオドシ 火威 +ヒオノ 比尾野 +ヒオモ 日面 +ヒカ 比嘉 +ヒカ 比果 +ヒガ 比嘉 +ヒガ 日向 +ヒガ 比賀 +ヒガ 日賀 +ヒガ 比果 +ビカ 備家 +ヒカイ 樋廻 +ヒカイ 日改 +ヒカイ 日開 +ヒカイ 肥海 +ヒカイ 樋開 +ヒガイ 日改 +ヒガイ 樋貝 +ヒガイ 日開 +ヒガイ 檜貝 +ヒガイ 日賀井 +ヒガイ 日貝 +ヒガイ 干貝 +ヒガイ 桧貝 +ヒガイ 肥海 +ヒガイ 氷貝 +ビカイ 備海 +ヒガイノ 日開野 +ヒカイハラ 比貝原 +ヒカイハラ 飛開原 +ヒガエ 比賀江 +ヒガエ 日替 +ヒガオンナ 東恩納 +ヒガオンナ 東恩名 +ヒガカド 比嘉門 +ヒガキ 桧垣 +ヒガキ 檜垣 +ヒガキ 日垣 +ヒガキ 菱垣 +ヒガキ 樋垣 +ヒガキ 飛垣 +ヒガキ 日墻 +ヒガキ 飛柿 +ヒガクボ 日ケ久保 +ヒガクレ 日隠 +ヒカケ 樋掛 +ヒカケ 日掛 +ヒカゲ 日景 +ヒカゲ 日影 +ヒカゲ 日蔭 +ヒカゲ 日陰 +ヒガケ 樋掛 +ヒガケ 桧掛 +ヒガケ 檜掛 +ヒカケダ 樋掛田 +ヒカゲダテ 日影舘 +ヒカゲダテ 日影館 +ヒカゲダテ 日景館 +ヒカゲノ 日蔭野 +ヒカゲノ 日影野 +ヒカゲモイ 日蔭茂井 +ヒカサ 日笠 +ヒカサ 樋笠 +ヒカサ 暈 +ヒガサ 日笠 +ヒガサ 樋笠 +ヒガサ 暈 +ヒガサ 日傘 +ヒカサヤマ 日笠山 +ヒガサヤマ 日笠山 +ヒカシ 日樫 +ヒカシ 氷樫 +ヒガシ 東 +ヒガシ 日樫 +ヒガシ 東志 +ヒガシ 樋樫 +ヒガシ 日下志 +ヒガシ 日河岸 +ヒガシ 日賀志 +ヒガシ 干河岸 +ヒガシアシタニ 東芦谷 +ヒガシアシダニ 東芦谷 +ヒガシアソウバラ 東麻生原 +ヒガシアラカワ 東新川 +ヒガシアラシロ 東新城 +ヒガシアラヤ 東新家 +ヒガシイ 東井 +ヒガシイ 東居 +ヒガシイウエ 東井上 +ヒガシイケ 東池 +ヒガシイズミ 東泉 +ヒガシイソカワ 東五十川 +ヒガシイソガワ 東五十川 +ヒガシイデ 東出 +ヒガシイナバ 東稲葉 +ヒガシイノウエ 東井上 +ヒガシイムタ 東伊牟田 +ヒガシイリキ 東入来 +ヒガシイリキ 東入來 +ヒガシイワイ 東岩井 +ヒガシウエ 東上 +ヒガシウエサト 東上里 +ヒガシウエザト 東上里 +ヒガシウエジョウ 東上門 +ヒガシウサト 東宇里 +ヒガシウチ 東内 +ヒガシウチハラ 東内原 +ヒガシウネ 東畝 +ヒガシウメ 東梅 +ヒガシウラ 東浦 +ヒガシウラ 東裏 +ヒガシウワトコ 東上床 +ヒガシエ 東江 +ヒガシエキ 東𡵸 +ヒガシエノキダ 東榎田 +ヒガシオ 東尾 +ヒガシオウジ 東王地 +ヒガシオオジ 東大路 +ヒガシオオゾノ 東大園 +ヒガシオオゾノ 東大薗 +ヒガシオオタ 東太田 +ヒガシオオタ 東大田 +ヒガシオオノ 東大野 +ヒガシオオハマ 東大浜 +ヒガシオオミネ 東大嶺 +ヒガシオオモリ 東大森 +ヒガシオカ 東岡 +ヒガシオガワ 東小川 +ヒガシオキ 東沖 +ヒガシオク 東奥 +ヒガシオノ 東小野 +ヒガシオンジ 東陰地 +ヒガシオンナ 東恩納 +ヒガシカ 東家 +ヒガシガイト 東垣内 +ヒガシガイト 東垣外 +ヒガシガイトウ 東垣内 +ヒガシガキ 東垣 +ヒガシカゲ 東影 +ヒガシカゼ 東風 +ヒガシカタ 東方 +ヒガシガタ 東方 +ヒガシガタ 東潟 +ヒガシカツラギ 東桂木 +ヒガシカド 東角 +ヒガシカドグチ 東門口 +ヒガシカナミネ 東金嶺 +ヒガシカネク 東兼久 +ヒガシカビラ 東川平 +ヒガシガマエ 東構 +ヒガシカヤマ 東嘉弥真 +ヒガシカヤマ 東嘉彌真 +ヒガシカリヤ 東仮屋 +ヒガシカリヤ 東假屋 +ヒガシカワ 東川 +ヒガシカワ 東河 +ヒガシガワ 東川 +ヒガシガワ 東側 +ヒガシカワウチ 東川内 +ヒガシカワカミ 東川上 +ヒガシカワヒラ 東川平 +ヒガシカワラ 東川原 +ヒガシキ 東木 +ヒガシギ 東木 +ヒガシキヤ 東木谷 +ヒガシキンジョウ 東金城 +ヒガシク 東九 +ヒガシクジョウ 東九條 +ヒガシクセ 東久世 +ヒガシクゼ 東久世 +ヒガシグチ 東口 +ヒガシクニ 東邦 +ヒガシクニ 東国 +ヒガシクニ 東久邇 +ヒガシクボ 東久保 +ヒガシクボ 東窪 +ヒガシクラ 東倉 +ヒガシクラモリ 東蔵盛(東藏盛) +ヒガシクロシマ 東黒島 +ヒガシケ 東家 +ヒガシコウジ 東小路 +ヒガシコクバル 東国原 +ヒガシコクバル 東國原 +ヒガシコソノ 東小薗 +ヒガシコソノ 東小園 +ヒガシコゾノ 東小薗 +ヒガシコゾノ 東小園 +ヒガシゴトウ 東後藤 +ヒガシコバ 東木場 +ヒガシサカ 東坂 +ヒガシサカ 東阪 +ヒガシザキ 東崎 +ヒガシサキハラ 東崎原 +ヒガシザクラ 東桜 +ヒガシザクラ 東櫻 +ヒガシサコ 東迫 +ヒガシサコ 東峪 +ヒガシザコ 東迫 +ヒガシザト 東里 +ヒガシサワ 東沢 +ヒガシサワ 東澤 +ヒガシザワ 東沢 +ヒガシザワ 東澤 +ヒガシサンジョウ 東三条 +ヒガシジ 東地 +ヒガシジ 東路 +ヒガシシタ 東下 +ヒガシシバ 東芝 +ヒガシシマ 東島 +ヒガシジマ 東島 +ヒガシジマ 東嶋 +ヒガシショウ 東庄 +ヒガシジョウ 東条 +ヒガシジョウ 東條 +ヒガシシロカネ 東白金 +ヒガシジロク 東次呂久 +ヒガシシンカワ 東新川 +ヒガシスジ 東筋 +ヒガシセ 東瀬 +ヒガシセコ 東世古 +ヒガシゼコ 東世古 +ヒガシセト 東瀬戸 +ヒガシゾエ 東添 +ヒガシソノ 東園 +ヒガシゾノ 東園 +ヒガシゾノ 東薗 +ヒガシゾノ 東苑 +ヒガシタ 東田 +ヒガシダ 東田 +ヒガシダイグウ 東代宮 +ヒガシダイラ 東平 +ヒガシタキ 東滝 +ヒガシタキ 東瀧 +ヒガシタケニシ 東嵩西 +ヒガシタケニシ 東竹西 +ヒガシダテ 東館 +ヒガシダテ 東舘 +ヒガシタナカ 東田中 +ヒガシタニ 東谷 +ヒガシダニ 東谷 +ヒガシタニグチ 東谷口 +ヒガシタマモリ 東玉盛 +ヒガシタモリ 東田盛 +ヒガシタルミ 東垂水(東埀水) +ヒガシタルミズ 東垂水(東埀水) +ヒガシヂ 東地 +ヒガシツ 東津 +ヒガシヅカ 東塚 +ヒガシツジ 東辻 +ヒガシツジノ 東辻野 +ヒガシツツミ 東堤 +ヒガシツツミ 東提 +ヒガシヅツミ 東堤 +ヒガシツノイ 東角井 +ヒガシヅメ 東爪 +ヒガシツル 東鶴 +ヒガシツル 東水流 +ヒガシヅル 東鶴 +ヒガシヅル 東水流 +ヒガシツルゾノ 東鶴園 +ヒガシテ 東手 +ヒガシデ 東出 +ヒガシド 東戸 +ヒガシドウゾノ 東堂園 +ヒガシトクミネ 東徳嶺 +ヒガシドマリ 東泊 +ヒガシドメ 東留 +ヒガシナカ 東中 +ヒガシナカ 東仲 +ヒガシナガ 東永 +ヒガシナカオ 東中尾 +ヒガシナカガワ 東中川 +ヒガシナカザト 東仲里 +ヒガシナカス 東中須 +ヒガシナカゾノ 東中園 +ヒガシナカゾノ 東中薗 +ヒガシナガタ 東長田 +ヒガシナカノ 東中野 +ヒガシナガハマ 東長浜(東長濱) +ヒガシナカミチ 東中道 +ヒガシナカムラ 東中村 +ヒガシナカムラ 東仲村 +ヒガシナカヤ 東中屋 +ヒガシナカヨネ 東仲与根(東仲與根) +ヒガシナダ 東灘 +ヒガシナリソコ 東成底 +ヒガシニタ 東仁田 +ヒガシニチョウ 東二町 +ヒガシネ 東根 +ヒガシノ 東野 +ヒガシノ 東埜 +ヒガシノ 東濃 +ヒガシノ 東乃 +ヒガシノ 東𡌛 +ヒガシノソノ 東之園 +ヒガシノゾノ 東之薗 +ヒガシノヤ 東野谷 +ヒガシバ 東芝 +ヒガシハギハラ 東萩原 +ヒガシハギワラ 東萩原 +ヒガシハタ 東畑 +ヒガシハタ 東端 +ヒガシハタ 東畠 +ヒガシバタ 東畑 +ヒガシバタ 東端 +ヒガシバタ 東畠 +ヒガシババ 東馬場(東馬塲) +ヒガシハマ 東浜 +ヒガシハマ 東濱 +ヒガシバヤシ 東林 +ヒガシハラ 東原 +ヒガシバラ 東原 +ヒガシハラグチ 東原口 +ヒガシバル 東原 +ヒガシビ 東日 +ヒガシヒラ 東平 +ヒガシフカサワ 東深沢 +ヒガシフカサワ 東深澤 +ヒガシフカザワ 東深澤 +ヒガシフシミ 東伏見 +ヒガシブチ 東渕 +ヒガシブチ 東淵 +ヒガシフナミチ 東舟道 +ヒガシフナミチ 東船道 +ヒガシベ 東部 +ヒガシベップ 東別府 +ヒガシホ 東保 +ヒガシボウジョウ 東坊城 +ヒガシホキ 東保木 +ヒガシボラ 東洞 +ヒガシホリ 東堀 +ヒガシボリ 東堀 +ヒガシホンジ 東本地 +ヒガシマ 東島 +ヒガシマ 東間 +ヒガジマ 東島 +ヒガシマエ 東前 +ヒガシマキ 東牧 +ヒガシマキ 東槙 +ヒガシマキ 東槇 +ヒガシマキノ 東牧野 +ヒガシマキハラ 東巻原 +ヒガシマキハラ 東牧原 +ヒガシマサ 東昌 +ヒガシマタ 東又 +ヒガシマチ 東町 +ヒガシマツ 東松 +ヒガシマル 東丸 +ヒガシミズ 東水 +ヒガシミタテダ 東御建田 +ヒガシミチ 東道 +ヒガシミネ 東峰 +ヒガシミネ 東峯 +ヒガシミネ 東嶺 +ヒガシミヤ 東宮 +ヒガシムカイ 東向 +ヒガシムキ 東向 +ヒガシムクヒノ 東杢比野 +ヒガシムラ 東村 +ヒガシムラ 東邨 +ヒガシメ 東目 +ヒガシモト 東本 +ヒガシモト 東元 +ヒガシモモ 東桃 +ヒガシモリ 東森 +ヒガシモリ 東盛 +ヒガシモングチ 東門口 +ヒガシヤ 東谷 +ヒガシヤ 東屋 +ヒガシヤ 東矢 +ヒガシヤ 東家 +ヒガシヤ 東舎 +ヒガシヤシキ 東屋敷 +ヒガシヤチ 東谷内 +ヒガシヤナギ 東柳 +ヒガシヤブ 東薮(東籔) +ヒガシヤブ 東藪 +ヒガシヤマ 東山 +ヒガシヤマザキ 東山崎 +ヒガシヤマモリ 東山盛 +ヒガジョウ 比嘉門 +ヒガシヨシ 東吉 +ヒガシヨシハラ 東吉原 +ヒガシヨツヤナギ 東四柳 +ヒガシヨナハ 東与那覇 +ヒガシヨナハ 東與那覇 +ヒガシヨネモリ 東米盛 +ヒガシラ 東良 +ヒガシラ 東頭 +ヒガシラ 東等 +ヒガシラ 日頭 +ヒガシワキ 東脇 +ヒガシワダ 東和田 +ヒガシワラビ 東蕨 +ヒカズタニ 日数谷 +ヒカズダニ 日数谷 +ヒカズヤ 日数谷 +ヒガセ 東瀬 +ヒガセ 東勢 +ヒカタ 日方 +ヒカタ 樋片 +ヒガタ 干潟 +ヒガタ 日潟 +ヒガタ 日賢 +ヒガタ 干瀉 +ヒガタ 日形 +ヒガタ 樋方 +ヒカタイ 日形井 +ヒガタニ 飛ケ谷 +ヒカツ 樋勝 +ヒカツ 日勝 +ヒガネ 比金 +ヒガネ 日金 +ヒカノ 日下野 +ヒガノ 東野 +ヒガノ 日向野 +ヒガノ 日賀野 +ヒガノ 日下野 +ヒガノ 氷鉋 +ヒガノ 永鉋 +ヒガノ 飛賀野 +ヒカハラ 日箇原 +ヒカベ 日下部 +ヒガマル 日ケ丸 +ヒカミ 樋上 +ヒカミ 氷上 +ヒカミ 日上 +ヒカミ 比上 +ヒカミ 火神 +ヒカミ 日神美 +ヒガミ 樋上 +ヒガミ 氷上 +ヒガミ 日上 +ヒガミ 比上 +ヒガミ 火神 +ヒガミ 日神 +ヒガミ 肥上 +ヒカミヤマ 日神山 +ヒガメ 東目 +ヒガモイ 日陰茂井 +ヒガモン 比嘉門 +ヒガヤ 飛ケ谷 +ヒガヤ 檜ケ谷 +ヒガヤ 桧ケ谷 +ヒカユ 比家由 +ヒガラ 日柄 +ヒカリ 光 +ヒカリ 晄 +ヒカワ 樋川 +ヒカワ 飛川 +ヒカワ 桧皮 +ヒカワ 肥川 +ヒカワ 日川 +ヒカワ 陽川 +ヒカワ 檜皮 +ヒカワ 桧川 +ヒカワ 氷川 +ヒカワ 檜川 +ヒカワ 飛河 +ヒカワ 辺川 +ヒカワ 火川 +ヒカワ 日河 +ヒカワ 披川 +ヒカワ 坡川 +ヒガワ 樋川 +ヒガワ 日川 +ヒガワ 陽川 +ヒガワ 桧川 +ヒガワ 檜川 +ヒガワ 秘川 +ヒカワスミ 簸川角 +ヒカン 被官 +ヒガンダ 干岸田 +ヒキ 日置 +ヒキ 比企 +ヒキ 比気 +ヒキ 樋木 +ヒキ 日岐 +ヒキ 日木 +ヒキ 比氣 +ヒキ 挽 +ヒキ 飛気(飛氣) +ヒキ 飛木 +ヒキ 引 +ヒキ 比木 +ヒキ 疋 +ヒキ 匹 +ヒキアミ 引網 +ヒキイシ 引石 +ビキイシ 蛙石 +ヒキウチ 昆木内 +ヒキウチ 挽内 +ヒキウネ 引宇根 +ヒキウマ 引馬 +ヒキウラ 引浦 +ヒキエ 日置江 +ヒキオ 引尾 +ヒキオチ 引落 +ヒキカタ 引方 +ヒキギ 引木 +ヒキギ 曳木 +ヒキギ 曵木 +ヒキグチ 引口 +ヒキコシ 引越 +ヒキサカ 引坂 +ヒキザキ 樋木崎 +ヒキジ 引地 +ヒキジ 挽地 +ヒキジ 引字 +ヒキジ 引寺 +ヒギシ 披岸 +ヒキシオ 曳汐(曵汐) +ヒキシキバヤシ 引敷林 +ヒキシマ 疋島 +ヒキシマ 疋嶋 +ヒキジリ 引尻 +ヒキゾウ 引象 +ヒキタ 疋田 +ヒキタ 引田 +ヒキタ 匹田 +ヒキタ 曳田 +ヒキタ 挽田 +ヒキタ 曵田 +ヒキタ 蟇田 +ヒキタ 比喜多 +ヒキタ 飛喜多 +ヒキタ 比喜田 +ヒキダ 疋田 +ヒキダ 引田 +ヒキダ 匹田 +ヒキダ 曳田 +ヒキダ 挽田 +ヒキダ 曵田 +ヒキダ 飛木田 +ヒキタニ 引谷 +ヒキタニ 疋谷 +ヒキタニ 挽谷 +ヒキチ 引地 +ヒキチ 曳地 +ヒキチ 挽地 +ヒキチ 曵地 +ヒキチ 弓地 +ヒキヂ 引地 +ヒキツ 疋津 +ヒキヅ 疋津 +ヒキツジ 引辻 +ヒキツチ 引土 +ヒキツナ 引綱 +ヒキデ 疋出 +ヒキデラ 引寺 +ヒキド 引土 +ヒキド 引戸 +ヒキナミ 引波 +ヒキナリ 曵成 +ヒキヌマ 曳沼 +ヒキヌマ 曵沼 +ヒキヌマ 引沼 +ヒキノ 引野 +ヒキノ 曳野 +ヒキノ 挽野 +ヒキノ 比企野 +ヒキノ 疋野 +ヒキノ 匹野 +ヒキノ 曵野 +ヒキノ 曳埜 +ヒキバ 引場(引塲) +ヒキハシ 引橋 +ヒキハラ 引原 +ヒキハラ 曳原 +ヒキハラ 曵原 +ヒキフジ 引藤 +ヒキマ 引間 +ヒキマ 引馬 +ヒキマ 曵間 +ヒキマ 曳間 +ヒキマ 曳馬 +ヒキマ 曳摩 +ヒキマ 比企間 +ヒキマタ 引又 +ヒキマチ 曳町 +ヒキミ 疋見 +ヒキミズ 引水 +ヒキムラ 曳村 +ヒキムラ 引村 +ヒキムラ 曵村 +ヒキメ 蟇目 +ヒキモチ 引持 +ヒキモト 引本 +ヒキモト 挽本 +ヒキモト 匹本 +ヒキヤ 引谷 +ヒキヤ 引屋 +ヒキヤシキ 引屋敷 +ヒキヤマ 引山 +ヒキリ 肥喜里 +ヒギリ 日切 +ヒギリ 日限 +ヒキワケ 挽分 +ヒキン 比金 +ヒキン 昆金 +ヒグサ 日種 +ヒクタ 低田 +ヒグチ 樋口 +ヒグチ 火口 +ヒグチ 日口 +ヒグチ 肥口 +ヒグチ 飛口 +ヒグチ 檜口 +ヒグチ 桧口 +ヒグチ 比口 +ヒグチ 鄙口 +ビグチ 美口 +ヒグチウチ 火口内 +ヒグチヤマ 火口山 +ヒクマ 日隈 +ヒクマ 樋熊 +ヒクマ 引馬 +ヒグマ 日隈 +ヒグマ 樋熊 +ヒグマ 日熊 +ヒグマ 氷熊 +ヒクラ 日倉 +ヒクラ 飛倉 +ヒグラ 日倉 +ヒグラシ 日暮 +ヒグラシ 寒蝉 +ヒグルマ 日車 +ヒグレ 日暮 +ヒケ 比毛 +ヒケ 日毛 +ヒケ 飛毛 +ヒケ 比家 +ヒゲ 髭 +ヒゲ 比毛 +ヒゲ 日毛 +ヒゲ 肥下 +ヒゲ 比下 +ヒゲイ 飛芸(飛藝) +ヒゲウコン 髭右近 +ヒゲウチ 髭内 +ヒケシ 火消 +ヒケジ 飛計路 +ヒゲシロ 髭白 +ヒケタ 引田 +ヒゲタ 日下田 +ヒゲタ 樋下田 +ヒゲタ 樋桁 +ヒゲタ 髭田 +ヒゲタ 肥毛田 +ヒゲタニ 比毛谷 +ヒケノ 比毛野 +ヒゲノ 髭野 +ヒゲムラ 髭村 +ヒゲモト 髭本 +ヒゲヤマ 日下山 +ヒゲワケ 髭分 +ヒコ 彦 +ヒコ 肥子 +ヒコ 比湖 +ヒゴ 肥後 +ヒゴ 比護 +ヒゴ 比後 +ヒゴ 肥后 +ヒゴ 日吾 +ヒゴ 日後 +ヒゴ 肥吾 +ヒコイ 彦井 +ヒゴイ 肥後井 +ヒコウエ 彦上 +ヒコエ 彦江 +ヒコエ 彦工 +ヒコエ 彦エ +ヒコエ 彦ヱ +ヒコエダ 彦枝 +ヒゴオリ 樋郡 +ヒコカワ 彦川 +ヒコガワ 彦川 +ヒコクボ 彦久保 +ヒコサカ 彦坂 +ヒコサカ 彦阪 +ヒコサキ 比古咲 +ヒゴサキ 肥後崎(肥後嵜) +ヒコザワ 彦沢 +ヒコジ 彦次 +ヒコジ 彦路 +ヒゴシ 日越 +ヒゴシ 肥越 +ヒゴシ 樋越 +ヒコシマ 彦島 +ヒコセ 彦瀬 +ヒコソ 彦素 +ヒコソウ 彦惣 +ヒゴゾノ 平後園 +ヒコタ 彦田 +ヒコタ 日小田 +ヒコタ 比古田 +ヒコダ 彦田 +ヒコダ 日小田 +ヒコダ 比古田 +ヒゴタ 肥後田 +ヒコタケ 彦竹 +ヒコタニ 彦谷 +ヒコタニ 肥子谷 +ヒゴタニ 肥後谷 +ヒコデ 彦出 +ヒコナギ 彦凪 +ヒコネ 彦根 +ヒコノ 彦野 +ヒコノ 日此 +ヒゴノ 肥後野 +ヒコノウエ 彦ノ上 +ヒゴハシ 肥後橋 +ヒゴバシ 肥後橋 +ヒコベ 彦部 +ヒコマ 彦間 +ヒコマエ 彦前 +ヒコミ 日古見 +ヒゴムラ 肥後村 +ヒコメン 彦面 +ヒコモト 彦本 +ヒゴモト 肥後本 +ヒコモリ 彦森 +ヒコヤ 彦谷 +ヒコヤ 比古矢 +ヒゴヤ 肥後谷 +ヒゴヤ 肥後屋 +ヒコヤマ 彦山 +ヒコヤマ 古桧山 +ヒコヨシ 彦由 +ヒサ 比佐 +ヒサ 久 +ヒサ 檜佐 +ヒサ 桧佐 +ヒサ 日佐 +ヒサ 此佐 +ヒザ 日座 +ヒザ 檜座 +ヒザ 飛座 +ヒザ 日㘴 +ヒザ 日 +ヒザ 肥坐 +ヒザ 飛坐 +ヒザ 飛㘴 +ヒザ 桧座 +ヒサアキ 久秋 +ヒサアキ 久穐 +ヒサアキ 久明 +ヒサアリ 久有 +ヒサイ 久井 +ヒサイ 久居 +ヒザイ 膝井 +ヒサイケ 久池 +ヒサイシ 久石 +ビサイジ 美才治 +ヒサイズミ 久泉 +ヒサイタ 久板 +ヒサイチ 久一 +ヒサイチ 久市 +ヒサイバル 久井原 +ヒサウチ 久内 +ヒサウラ 久浦 +ヒサエ 久江 +ヒサエ 久重 +ヒサエダ 久枝 +ヒサオ 久尾 +ヒサオ 久生 +ヒサオウ 久翁 +ヒサオカ 久岡 +ヒサオク 久奥 +ヒサカ 久下 +ヒサカ 日坂 +ヒサカ 日栄 +ヒサカ 飛坂 +ヒサカ 樋坂 +ヒサカ 日阪 +ヒサカ 氷坂 +ヒサカ 飛阪 +ヒサカ 桧阪 +ヒサカ 檜阪 +ヒサガ 久賀 +ヒザカ 日坂 +ビサカ 昆沙賀 +ヒサガイ 久貝 +ヒサガエ 久替 +ヒザカエ 日榮 +ヒサカゼ 瓢風 +ヒサカタ 久方 +ヒサカタ 久形 +ヒサカツ 久勝 +ヒサカド 久門 +ヒサカネ 久兼 +ヒサカネ 久金 +ヒサカベ 久壁 +ヒサガミ 久上 +ヒサガヤ 久ケ谷 +ヒサカワ 久川 +ヒサカワ 久河 +ヒサガワ 久川 +ヒサキ 久木 +ヒサキ 久喜 +ヒサキ 樋崎 +ヒサキ 日崎 +ヒサキ 楸 +ヒサキ 久樹 +ヒサキ 樋先 +ヒサキ 陽向 +ヒサギ 久木 +ヒサギ 楸 +ヒザキ 樋崎 +ヒザキ 日崎 +ヒザキ 檜崎(檜嵜) +ヒザキ 桧崎 +ヒザキ 桧嵜 +ヒザキ 飛嵜 +ヒサキタ 久北 +ヒサキダ 楸田 +ヒサギノ 榎野 +ヒサキハラ 楸原 +ヒサキヨ 久清 +ヒサク 桧作 +ヒサク 檜作 +ヒサクニ 久国 +ヒサクニ 久國 +ヒサクラ 久蔵(久藏) +ヒサクラ 久倉 +ヒサクラ 寿倉 +ヒサクロ 久黒 +ヒサゲツカ 久下塚 +ヒサゲン 久源 +ヒサコ 日迫 +ヒサコ 久子 +ヒサゴ 久後 +ヒサゴ 瓢 +ヒザコ 日迫 +ヒササカ 久坂 +ヒササキ 久佐木 +ヒサザキ 久崎 +ヒサザキ 久嵜 +ヒササダ 久貞 +ヒサザト 久里 +ヒサザワ 久沢 +ヒサザワ 久澤 +ヒサシ 久 +ヒサシ 久志 +ヒサシ 久司 +ヒサシ 日指 +ヒサシ 庇 +ヒサシ 彌 +ヒサジ 久司 +ヒサジ 久治 +ヒサシキ 久敷 +ヒサシク 久宿 +ヒサシゲ 久重 +ヒサシゲ 久繁 +ヒサジシ 久宍 +ヒサシタ 久下 +ヒサシバ 久柴 +ヒサシバ 久芝 +ヒサシマ 久島 +ヒサシマ 久嶋 +ヒサシマ 寿島 +ヒサジマ 久島 +ヒサジマ 久嶋 +ヒサジマ 久嶌 +ヒサジマ 寿島 +ヒサシュク 久宿 +ヒサスエ 久末 +ヒサスエ 久未 +ヒサズミ 久住 +ヒサズミ 久積 +ヒサズミ 久澄 +ヒサズミ 久角 +ヒサズミ 久隅 +ヒサゾメ 久染 +ヒサタ 久田 +ヒサダ 久田 +ヒサダ 悲佐田 +ヒサダ 肥佐多 +ヒサタカ 久高 +ヒサタカ 壽孝 +ヒサタキ 久滝 +ヒサタキ 久瀧 +ヒサタケ 久武 +ヒサタケ 久竹 +ヒザタテ 膝舘 +ヒザタテ 膝館 +ヒザダテ 膝館 +ヒサタニ 久谷 +ヒサチ 久地 +ヒサツ 久津 +ヒサツカ 久塚 +ヒサツギ 久次 +ヒザツキ 膝附(膝付) +ヒサツグ 久次 +ヒサツグ 久継 +ヒサツナ 久綱 +ヒサツネ 久恒 +ヒサツネ 久常 +ヒサツバキ 久椿 +ヒサヅマ 久妻 +ヒサツミ 久積 +ヒサヅミ 久積 +ヒサヅメ 久詰 +ヒサト 久斗 +ヒサト 日里 +ヒサト 久戸 +ヒサト 日佐戸 +ヒサド 久戸 +ヒザト 日里 +ヒサトウ 久藤 +ヒサトオ 久遠 +ヒサトク 久徳 +ヒサトシ 久歳 +ヒサトミ 久富 +ヒサトミ 久冨 +ヒサドミ 久富 +ヒサドミ 久冨 +ヒサトメ 久留 +ヒサドメ 久留 +ヒサトヨ 久豊 +ヒサナカ 久中 +ヒサナガ 久永 +ヒサナガ 久長 +ヒサナギ 久名木 +ヒサナベ 久鍋 +ヒサナリ 久成 +ヒサノ 久野 +ヒサノ 比佐野 +ヒサノ 久ノ +ヒサノブ 久延 +ヒサノブ 久信 +ヒサノベ 久延 +ヒサノリ 久徳 +ヒサバ 久場 +ヒサバエ 久栄 +ヒサバヤシ 久林 +ヒサハラ 久原 +ヒサハラ 寿原 +ヒサハラ 壽原 +ヒサヒラ 久平 +ヒサビラ 久平 +ヒサヒロ 久弘 +ヒサフジ 久藤 +ヒサフル 久古 +ヒサベ 久部 +ヒサホリ 久堀 +ヒサボリ 久堀 +ヒサマ 久間 +ヒサマサ 久昌 +ヒサマツ 久松 +ヒサマツ 寿松 +ヒサマツ 壽松 +ヒサマル 久丸 +ヒサミ 久水 +ヒサミ 久見 +ヒサミズ 久水 +ヒサミチ 久道 +ヒサミツ 久光 +ヒサミツ 久満 +ヒサミナト 久湊 +ヒサミネ 久峯 +ヒサムネ 久宗 +ヒサムラ 久村 +ヒサムラ 寿村 +ヒサモチ 久持 +ヒサモト 久本 +ヒサモト 亀元 +ヒサモト 久元 +ヒサモト 寿本 +ヒサモト 寿元 +ヒサモリ 久森 +ヒサモリ 久守 +ヒサモリ 寿盛 +ヒサモリ 久盛 +ヒサヤ 久谷 +ヒサヤ 久屋 +ヒサヤス 久安 +ヒサヤス 壽安 +ヒサヤナギ 久柳 +ヒサヤブ 久薮 +ヒサヤブ 久藪 +ヒサヤマ 久山 +ヒサヤマ 寿山 +ヒサヤマ 壽山 +ヒサユキ 久行 +ヒサユキ 久幸 +ヒサユク 久行 +ヒサヨシ 久芳 +ヒサヨシ 久吉 +ヒサヨシ 久好 +ヒサヨシ 久善 +ヒサリ 久利 +ヒサワ 樋沢 +ヒサワ 久和 +ヒサワ 樋澤 +ヒサワ 日澤 +ヒザワ 飛沢 +ヒザワ 樋沢 +ヒザワ 飛澤 +ヒザワ 日沢 +ヒザワ 樋澤 +ヒザワ 日澤 +ヒザワ 比沢 +ヒザワ 檜沢 +ヒザワ 氷沢(氷澤) +ヒザワ 檜澤 +ヒザワ 比澤 +ヒザワ 桧沢 +ヒザワ 昆沢(昆澤) +ヒザワ 桧澤 +ヒサワケ 久分 +ヒシ 菱 +ヒシ 比志 +ヒジ 日出 +ヒジ 臂 +ヒジ 樋地 +ヒジ 比地 +ヒジ 小童 +ヒジ 飛地 +ヒジ 比治 +ヒジ 非治 +ヒジ 樋路 +ヒジ 氷治 +ヒシイ 菱井 +ヒシイ 菱伊 +ヒジイ 肘井 +ヒシイケ 菱池 +ヒシエ 菱江 +ヒシオ 菱尾 +ヒシオカ 菱岡 +ヒジオカ 肱岡 +ヒジオカ 比地岡 +ヒジオカ 肘岡 +ヒジオカ 肬岡 +ヒジオリ 臂折 +ヒジカイ 文違 +ヒシガエ 菱ケ江 +ヒシガキ 菱垣 +ヒシカタ 菱形 +ヒジカタ 土方 +ヒジカタ 泥方 +ヒジカタ 肱方 +ヒジカタ 土片 +ヒジカタ 肬方 +ヒジカド 土門 +ヒシカリ 菱刈 +ヒシカワ 菱川 +ヒシカワ 菱河 +ヒジカワ 土川 +ヒジカワ 聖川 +ヒジカワ 泥川 +ヒジカワ 肱川 +ヒシキ 菱木 +ヒシキ 日紫喜 +ヒシキ 飛鋪 +ヒシキ 日柴喜 +ヒシキ 日敷 +ヒシキ 樋敷 +ヒシキ 日紫鬼 +ヒシキ 日柴鬼 +ヒシキ 飛舗 +ヒシキ 菱城 +ヒシギ 菱木 +ヒジキ 日食 +ヒジキ 日直 +ヒジキ 比舗 +ヒジキガワ 枅川 +ヒシクラ 菱倉 +ヒシクラ 菱蔵 +ヒジクロ 肱黒 +ヒジクロ 土黒 +ヒジクロ 比地黒 +ヒジグロ 肱黒 +ヒシコト 菱事 +ヒシサキ 菱崎 +ヒシザキ 菱崎 +ヒシサワ 菱澤 +ヒシサワ 菱沢 +ヒシザワ 菱澤 +ヒシザワ 菱沢 +ヒジシタ 肱下 +ヒシジマ 比志島 +ヒシジマ 菱島 +ヒシジマ 菱嶋 +ヒジシマ 肘島 +ヒジシリ 聖尻 +ヒシタ 日下 +ヒシタ 菱田 +ヒシタ 平下 +ヒシタ 樋下 +ヒシダ 菱田 +ヒジタ 泥田 +ヒシタニ 菱谷 +ヒジタニ 聖谷 +ヒシヅ 飛志津 +ヒジツ 肥実(肥實) +ヒジツラ 土面 +ヒシド 菱戸 +ヒシナ 斐品 +ヒシナ 菱科 +ヒシナカ 菱中 +ヒシヌマ 菱沼 +ヒシノ 菱野 +ヒジノ 土野 +ヒシバ 樋柴 +ヒジハラ 比地原 +ヒシマ 日島 +ヒシマ 比島 +ヒシマ 菱間 +ヒシマ 肥嶋 +ヒジマ 稗島 +ヒジマ 日島 +ヒジマ 肥島 +ヒジマ 肥嶋 +ヒジマ 火島 +ビシマ 備嶋 +ヒジマガリ 臂曲 +ヒシミ 菱見 +ヒシミズ 菱水 +ヒシムラ 菱村 +ヒシモ 日下 +ヒシモト 菱本 +ヒジモト 肱元 +ヒジモト 肱本 +ヒジモト 日時本 +ヒシャ 比舎 +ヒシャ 樋者 +ヒシヤ 菱谷 +ヒシヤ 熊取谷 +ヒシヤ 菱屋 +ヒシヤ 菱矢 +ヒシヤ 菱家 +ヒジヤ 土屋 +ヒジヤ 泥谷 +ヒジヤ 小童谷 +ヒジヤ 比知屋 +ヒジヤ 日地谷 +ヒジヤ 日出谷 +ヒジヤ 肘谷 +ビシャ 比砂 +ビシャガ 毘沙賀 +ビシャゴ 鴻 +ヒシヤマ 菱山 +ヒジヤマ 日出山 +ビシャマル 昆沙丸 +ビシャリ 毘舎利 +ビシュ 備酒 +ビショウ 備生 +ビショウ 微笑 +ビショウ 美正 +ビジョウザン 眉丈山 +ビジョヒラ 美女平 +ヒジリ 樋尻 +ヒジリ 聖 +ヒジリ 日退 +ヒジリ 日聖 +ヒジリ 日尻 +ヒジリ 飛尻 +ヒジリイワ 聖岩 +ヒジリカワ 聖川 +ヒジリサワ 聖沢 +ヒジリサワ 聖澤 +ヒジリダ 日尻田 +ヒジリタニ 聖谷 +ヒジリヤマ 聖山 +ヒシロ 樋代 +ヒシロ 日城 +ヒス 日須 +ヒスイ 轡水 +ヒズエ 桧杖 +ヒズエ 檜杖 +ヒズカ 肥塚 +ビスタ 比須田 +ヒスミ 日角 +ヒスミ 日隅 +ヒズミ 日角 +ヒズミ 日隅 +ヒズミ 日住 +ヒズメ 日詰(日誥) +ヒズメ 樋爪 +ヒズメ 樋詰 +ヒズメ 晦日 +ヒズメ 日爪 +ヒズメ 蹄 +ヒズメ 日極 +ヒセ 日生 +ヒセ 樋瀬 +ビセ 備瀬 +ヒセキ 比石 +ヒセキ 樋関 +ヒゼキ 日関 +ヒゼン 肥前 +ヒゼン 比前 +ビゼン 尾前 +ビゼン 備前 +ビゼン 備全 +ビゼンジマ 備前島 +ビゼンヤ 備前谷 +ヒソ 比曽 +ヒゾエ 日添 +ヒゾノ 樋園 +ヒソメ 日首 +ヒタ 肥田 +ヒタ 日田 +ヒタ 桧田 +ヒタ 檜田 +ヒダ 飛田 +ヒダ 肥田 +ヒダ 稗田 +ヒダ 樋田 +ヒダ 日田 +ヒダ 飛弾 +ヒダ 緋田 +ヒダ 桧田 +ヒダ 檜田 +ヒダ 陽田 +ヒダ 比田 +ヒダ 飛騨 +ヒダ 飛彈 +ヒダ 披田 +ヒダ 飛多 +ヒダ 火田 +ヒダ 氷田 +ヒダ 斐田 +ヒダ 秘多 +ヒダ 肥多 +ビタ 尾田 +ビダ 尾田 +ヒタイ 比田井 +ヒダイ 比田井 +ヒダイ 樋代 +ヒダイ 日台 +ヒダイ 干鯛 +ヒダイ 干台(干臺) +ヒダイ 千台 +ヒダイ 日田井 +ヒダイ 日臺 +ヒタウチ 日田内 +ヒダウチ 日田内 +ヒダオ 干田尾 +ヒタオカ 比多岡 +ヒタカ 日高 +ヒタカ 樋高 +ヒタカ 飛鷹 +ヒタカ 飛高 +ヒタカ 肥高 +ヒタカ 日鷹 +ヒタカ 氷高 +ヒダカ 日高 +ヒダカ 樋高 +ヒダカ 飛鷹 +ヒダカ 飛高 +ヒダカ 肥高 +ヒダカ 桧高 +ヒダカ 日鷹 +ヒダカ 檜高 +ヒダカ 氷高 +ヒダカ 比高 +ヒダカ 比多賀 +ヒダカ 飛多下 +ヒタカツ 比田勝 +ヒダカツ 比田勝 +ヒダカヤ 日高谷 +ヒダキ 肥田木 +ヒダキ 火焚 +ヒタク 日宅 +ヒタケ 日嶽(日岳) +ヒタチ 常陸 +ヒタチ 日達 +ヒタチ 月出 +ヒタチ 日立 +ヒダチ 日達 +ヒダチ 旭立 +ヒダチ 檜立 +ヒタチヤ 常陸谷 +ヒタニ 部谷 +ヒタニ 日谷 +ヒタニ 桧谷 +ヒタニ 樋谷 +ヒタニ 檜谷 +ヒタニ 肥谷 +ヒタニ 火谷 +ヒタニ 日渓 +ヒタニ 比谷 +ヒタニ 氷谷 +ヒタニ 日溪 +ヒダニ 部谷 +ヒダニ 日谷 +ヒダニ 桧谷 +ヒダニ 樋谷 +ヒダニ 檜谷 +ヒダニ 肥谷 +ヒダニ 比谷 +ヒダニ 枇谷 +ビタニ 備谷 +ヒダネ 日種 +ヒタノ 肥田野 +ヒタノ 飛田野 +ヒタノ 日田野 +ヒダノ 肥田野 +ヒダノ 飛田野 +ヒダノ 飛弾野 +ヒダノ 披田野 +ヒダノ 肥田埜 +ヒダノ 飛彈野 +ヒダノ 飛騨野 +ヒダマ 日玉 +ヒダムラ 飛弾村 +ヒダヤマ 飛騨山 +ヒダリ 左 +ヒダリ 左リ +ヒダリサワ 左沢 +ヒダリサワ 左澤 +ヒダリザワ 左澤 +ヒダリトモ 左伴 +ヒダワ 飛田和 +ヒチ 樋地 +ヒヂ 樋地 +ヒヂ 日地 +ヒチカワ 七川 +ヒチカワ 七河 +ヒチク 七宮 +ヒチク 七竹 +ヒチクロ 比知黒 +ヒチグロ 比知黒 +ヒチサカ 七坂 +ヒチジョウ 七條 +ヒチジョウ 七条 +ヒチタ 七田 +ヒチダ 七田 +ヒチタカ 七高 +ヒチドウ 七堂 +ヒチノ 七野 +ヒチベ 七辺(七邊) +ヒチヤ 比知屋 +ヒチヤ 日地谷 +ヒヂヤ 比知屋 +ヒヂヤ 日地谷 +ビチュウ 備中 +ヒチリ 七里 +ヒチリ 七理 +ヒチワ 飛知和 +ヒチワ 飛知輪 +ヒツ 比津 +ヒツ 日津 +ヒツ 樋津 +ヒヅ 比津 +ヒツイシ 櫃石 +ヒツウミ 七海 +ヒヅエ 檜杖 +ヒツオカ 櫃岡 +ヒツカ 肥塚 +ヒヅカ 肥塚 +ヒヅカ 飛塚 +ヒヅカ 日塚 +ヒツグチ 櫃口 +ヒヅクリ 桧作 +ヒヅクリ 檜作 +ヒツジ 日辻 +ヒツジグチ 未口 +ヒツジダニ 未谷 +ヒツタ 櫃田 +ヒツタ 日伝(日傳) +ヒツタ 日傅 +ヒツダ 櫃田 +ヒヅタ 日伝(日傳) +ヒヅチ 日土 +ヒヅチ 飛土 +ビッチュウ 備中 +ヒツノウエ 櫃ノ上 +ヒツノウエ 櫃之上 +ヒツボ 比坪 +ヒッポウ 筆宝 +ヒツマ 櫃間 +ヒヅマ 日妻 +ヒツミ 七海 +ヒツメ 日詰(日誥) +ヒツメ 火爪 +ヒヅメ 日詰(日誥) +ヒヅメ 樋爪 +ヒヅメ 樋詰 +ヒヅメ 晦日 +ヒヅメ 肥爪 +ヒヅメ 日爪 +ヒヅメ 蹄 +ヒヅメ 日極 +ヒヅメ 火爪 +ヒヅメ 筧爪 +ヒヅメ 火詰 +ヒヅメ 飛詰 +ヒヅメ 桶爪 +ヒツモト 櫃本 +ヒツユ 日露 +ヒツワリ 櫃割 +ヒデ 秀 +ヒデ 日出 +ヒデイ 英井 +ヒデイ 秀井 +ヒデイシ 秀石 +ヒデウチ 秀内 +ヒデウラ 秀浦 +ヒデオカ 秀岡 +ヒデオカ 英岡 +ヒデカタ 秀方 +ヒデガラ 日出柄 +ヒデカワ 秀川 +ヒデキ 日出木 +ヒデグチ 秀口 +ヒデグチ 日出口 +ヒデクマ 秀熊 +ヒデクラ 秀倉 +ヒデコウ 日出幸 +ヒデサカ 秀坂 +ヒデサキ 秀崎 +ヒデサト 秀里 +ヒデサワ 秀沢 +ヒデサワ 秀澤 +ヒデシマ 秀島 +ヒデシマ 秀嶋 +ヒデシマ 日出島 +ヒデシマ 日出嶋 +ヒデジマ 秀島 +ヒデジマ 秀嶋 +ヒデジマ 日出島 +ヒデジマ 日出嶋 +ヒデセ 秀瀬 +ヒデタ 秀田 +ヒデタカ 秀高 +ヒデタケ 秀岳 +ヒデタケ 英武 +ヒデタニ 秀谷 +ヒデナガ 秀永 +ヒデノ 秀野 +ヒデノイ 秀能井 +ヒデハラ 英原 +ヒデヒラ 秀平 +ヒデヒラ 秀衡 +ヒデヒラ 日出平 +ヒデマ 日出間 +ヒデマ 秀間 +ヒデムラ 秀村 +ヒデモト 英本 +ヒデモト 秀本 +ヒデモリ 秀森 +ヒデヤ 秀谷 +ヒデヤ 日出谷 +ヒデヤス 秀安 +ヒデヤマ 日出山 +ヒデヤマ 秀山 +ヒデヤマ 英山 +ヒデヨシ 秀吉 +ヒデラ 日寺 +ヒデリタ 日照田 +ヒテル 日輝 +ヒト 飛戸 +ヒド 飛渡 +ヒド 日戸 +ヒド 肥土 +ヒド 比戸 +ビト 美戸 +ヒトウ 樋藤 +ヒトウ 飛登 +ヒトウ 肥東 +ヒドウ 日堂 +ヒドウ 樋道 +ヒドウ 樋堂 +ビトウ 尾藤 +ビトウ 美藤 +ビトウ 尾登 +ビトウ 尾頭 +ビトウ 備藤 +ビトウ 美頭 +ビトウ 尾東 +ビトウ 尾籐 +ビトウ 美籐 +ヒトウジ 一氏 +ヒトウラ 仁浦 +ヒトエ 一重 +ヒトエダ 一枝 +ヒトオサ 人長 +ヒトオリ 委文 +ヒトカタ 人形 +ヒトガタ 人形 +ヒトカベ 人首 +ヒトカワ 仁川 +ヒトキ 一木 +ヒトキ 一樹 +ヒトキ 日時 +ヒトキデン 粢田 +ヒトクチ 一口 +ヒトクライ 人位 +ヒトクワタ 一鍬田 +ヒトクワダ 一鍬田 +ヒトコト 一言 +ヒトサト 人里 +ヒトシ 等 +ヒトシ 一視 +ヒトシ 均 +ヒトジ 人知 +ヒトシオ 一入 +ヒトスガ 仁菅 +ヒトスギ 一杉 +ヒトスギ 仁杉 +ヒトセ 一瀬 +ヒトセ 人瀬 +ヒトツイ 一井 +ヒトツイ 一ツ井 +ヒトツイシ 一ツ石 +ヒトツイシ 壱ツ石 +ヒトツイシ 壹ツ石 +ヒトツウジ 一ツ氏 +ヒトツエダ 一枝 +ヒトツカブト 一兜 +ヒトツキ 一木 +ヒトツキ 一ツ木 +ヒトツギ 一ツ木 +ヒトツゴ 一ツ子 +ヒトツゴウ 一郷 +ヒトツダ 一ツ田 +ヒトツダ 一津田 +ヒトツデン 粢田 +ヒトツバ 一葉 +ヒトツバシ 一橋 +ヒトツバシ 一ツ橋 +ヒトツバシ 榷 +ヒトツボ 一坪 +ヒトツマチ 一ツ町 +ヒトツマチ 一町 +ヒトツマツ 一松 +ヒトツマツ 一ツ松 +ヒトツモトマツ 一ツ本松 +ヒトツモリ 一森 +ヒトツモリ 一ツ森 +ヒトツヤ 一家 +ヒトツヤ 一ツ谷 +ヒトツヤ 一ツ矢 +ヒトツヤ 一ツ家 +ヒトツヤ 一ツ屋 +ヒトツヤ 一津屋 +ヒトツヤ 一舎 +ヒトツヤ 一津谷 +ヒトツヤ 一津矢 +ヒトツヤナギ 一柳 +ヒトツヤナギ 一ツ柳 +ヒトツヤマ 一ツ山 +ヒトツワタリ 一ツ渡 +ヒトト 一青 +ヒトニシ 人西 +ヒトノマ 人之間 +ヒトバシリ 人走 +ヒトハネ 一刎 +ヒドヒラ 比土平 +ヒトフジ 一藤 +ヒトフデ 一筆 +ヒトベ 人部 +ヒトボ 人母 +ヒトボシ 火燈 +ヒトマル 人丸 +ヒトミ 人見 +ヒトミ 蔀(篰) +ヒトミ 一見 +ヒトミ 倭文 +ヒトミ 仁見 +ヒトミ 樋富 +ヒトミ 日富 +ヒトミ 桶富 +ヒトミ 人美 +ヒトミ 仁美 +ヒトミ 眸 +ヒトメ 人目 +ヒドメ 樋留 +ヒトモ 日友 +ヒトモト 一本 +ヒトモト 一元 +ヒトヨ 人与 +ヒトヨシ 人吉 +ヒトラ 人羅 +ヒトリ 委文 +ヒトリジマ 独島 +ヒトロ 人魯 +ヒドロ 干泥 +ヒナ 日向 +ヒナ 日名 +ヒナ 日南 +ヒナ 比名 +ヒナ 雛 +ヒナ 毘奈 +ヒナ 日那 +ヒナ 比奈 +ヒナイ 比内 +ヒナイカワ 鬚川 +ヒナイジ 日内地 +ヒナイチ 日内地 +ヒナウチ 日名内 +ヒナエ 稗苗 +ヒナオカ 比奈岡 +ヒナオカ 陽岡 +ヒナオカ 雛岡 +ヒナカ 日中 +ヒナカ 肥中 +ヒナガ 日永 +ヒナガ 比永 +ヒナガ 樋永 +ヒナカタ 雛形 +ヒナガタ 日永田 +ヒナガタ 雛形 +ヒナカワ 日名川 +ヒナカワ 雛川 +ヒナガワ 日名川 +ヒナガワ 日南川 +ヒナキ 雛木 +ヒナグチ 日名口 +ヒナクボ 雛窪 +ヒナクラ 雛倉 +ヒナコ 日名子 +ヒナコ 雛子 +ヒナゴ 日名子 +ヒナサコ 雛迫 +ヒナサダ 日名貞 +ヒナサト 鄙里 +ヒナザト 鄙里 +ヒナザワ 雛沢 +ヒナシ 火脚 +ヒナジ 日名地 +ヒナジ 比奈地 +ヒナジ 雛司 +ヒナズミ 日南住 +ヒナセ 日生 +ヒナタ 日向 +ヒナタ 日当 +ヒナタ 日南 +ヒナタ 日南田 +ヒナタ 日當 +ヒナタ 雛田 +ヒナタ 日名田 +ヒナタ 比奈田 +ヒナタ 日那田 +ヒナタ 向陽 +ヒナタ 比那田 +ヒナタ 暄 +ヒナダ 日南田 +ヒナダ 雛田 +ヒナダ 比奈田 +ヒナダ 比那田 +ヒナタケ 雛竹 +ヒナタセ 日当瀬 +ヒナタセ 日當瀬 +ヒナタゼ 日当瀬 +ヒナタゼ 日當瀬 +ヒナタニ 雛谷 +ヒナタマ 雛玉 +ヒナタヤ 雛田谷 +ヒナチ 日名地 +ヒナチ 比奈地 +ヒナヂ 日名地 +ヒナツ 日夏 +ヒナツ 肥夏 +ヒナヅル 雛鶴 +ヒナナリ 雛成 +ヒナノ 雛埜 +ヒナノ 雛野 +ヒナハタ 日向端 +ヒナハラ 雛原 +ヒナハラ 比南原 +ヒナヒラ 雛平 +ヒナミ 日南 +ヒナミ 日並 +ヒナミ 檜並(桧並) +ヒナモト 雛元 +ヒナモト 日南本 +ヒナモト 雛本 +ヒナモト 比奈本 +ヒナモリ 雛森 +ヒナヤスミ 日南休 +ヒナヤマ 鄙山 +ヒナヤマ 日南山 +ヒナリ 日成 +ヒナワ 火縄 +ヒナン 日南 +ヒニシ 日西 +ヒニシ 桧西 +ヒニシ 檜西 +ヒヌキ 日貫 +ヒヌキ 樋抜 +ヒヌマ 肥沼 +ヒヌマ 日沼 +ヒヌマ 樋沼 +ヒネ 日根 +ヒネイ 日根居 +ヒネタニ 日根谷 +ヒネノ 日根野 +ヒネノタニ 日根野谷 +ヒネノヤ 日根野谷 +ヒネノヤ 日根ノ谷 +ヒネノヤ 日根埜谷 +ヒネリバラ 捻原 +ヒノ 日野 +ヒノ 昆野 +ヒノ 樋野 +ヒノ 檜野 +ヒノ 桧野 +ヒノ 飛野 +ヒノ 肥野 +ヒノ 旭野 +ヒノ 日埜 +ヒノ 氷野 +ヒノ 脾野 +ヒノ 比野 +ヒノ 火野 +ヒノ 陽野 +ビノ 備野 +ヒノイ 樋井 +ヒノイ 檜井 +ヒノイ 桧井 +ヒノイシ 日野石 +ヒノイシ 日石 +ヒノイデ 樋出 +ヒノウ 日納 +ヒノウ 比能 +ビノウ 尾納 +ヒノウエ 樋上 +ヒノウエ 日野上 +ヒノウエ 樋ノ上 +ヒノウエ 樋之上 +ヒノウエ 檜上 +ヒノウチ 日之内 +ヒノウチ 樋之内 +ヒノウチ 樋ノ内 +ヒノウチ 檜内 +ヒノウラ 樋浦 +ヒノウラ 日野浦 +ヒノウラ 火之浦 +ヒノウラ 樋ノ浦 +ヒノウラ 日之裏 +ヒノウラ 火ノ浦 +ヒノウラ 火の浦 +ヒノウラ 樋之浦 +ヒノオ 桧尾 +ヒノオ 日野尾 +ヒノオカ 旭岡 +ヒノオカ 日野岡 +ヒノオカ 日ノ岡 +ヒノオカ 日野岳 +ヒノオカ 桧岡 +ヒノオカ 檜岡 +ヒノオダ 日小田 +ヒノカミ 日野上 +ヒノガミ 日野上 +ヒノカワ 火ノ川 +ヒノカワ 日野川 +ヒノカワ 桧野皮 +ヒノカワ 檜野皮 +ヒノカワスミ 日野川角 +ヒノキ 桧 +ヒノキ 桧木 +ヒノキ 檜 +ヒノキ 檜木 +ヒノキ 樋木 +ヒノキ 比之木 +ヒノキオ 桧尾 +ヒノキオ 檜尾 +ヒノキザカ 桧坂 +ヒノキザカ 檜坂 +ヒノキダ 桧田 +ヒノキダ 檜田 +ヒノキダ 桧木田 +ヒノキダ 檜木田 +ヒノキダイラ 桧平(檜平) +ヒノキタニ 桧谷 +ヒノキタニ 檜谷 +ヒノキダニ 桧谷 +ヒノキダニ 檜谷 +ヒノキヅル 桧鶴 +ヒノキヅル 檜鶴 +ヒノキノ 檜野 +ヒノキノ 桧野 +ヒノキハラ 檜原 +ヒノキハラ 桧原 +ヒノキバラ 檜原 +ヒノキモト 桧本 +ヒノキモト 檜本 +ヒノキモリ 檜森 +ヒノキヤ 桧谷 +ヒノキヤ 檜谷 +ヒノキヤマ 檜山 +ヒノキヤマ 桧山 +ヒノクチ 樋之口 +ヒノクチ 樋ノ口 +ヒノクチ 日野口 +ヒノクチ 火ノ口 +ヒノクチ 火野口 +ヒノクチ 火の口 +ヒノクチ 閘 +ヒノグチ 樋之口 +ヒノグチ 樋ノ口 +ヒノグチ 日野口 +ヒノグチ 樋野口 +ヒノクマ 日隈 +ヒノクマ 日熊 +ヒノクマ 檜前 +ヒノクマ 桧前 +ヒノクラ 日之蔵 +ヒノケ 樋ケ +ヒノサカ 火野坂 +ヒノザキ 日野崎 +ヒノサコ 火之迫 +ヒノサコ 日ノ迫 +ヒノサコ 日之迫 +ヒノサコ 日野迫 +ヒノサワ 日沢 +ヒノサワ 日野沢 +ヒノサワ 日ノ沢 +ヒノサワ 日澤 +ヒノサワ 日野澤 +ヒノサワ 日の沢 +ヒノサワ 日ノ澤 +ヒノザワ 日野澤 +ヒノシタ 日下 +ヒノシタ 樋下 +ヒノシタ 日野下 +ヒノシタ 日ノ下 +ヒノシタ 檜下 +ヒノシタ 比野下 +ヒノシタ 桧下 +ヒノシマ 日野島 +ヒノスギ 日野杉 +ヒノスギ 日の杉 +ヒノセ 日生 +ヒノダ 日小田 +ヒノダ 日野田 +ヒノタニ 日谷 +ヒノタニ 桧谷 +ヒノタニ 檜谷 +ヒノタニ 日野谷 +ヒノタニ 日溪 +ヒノチ 日野地 +ヒノツ 樋之津 +ヒノツ 樋津 +ヒノツキ 日野月 +ヒノツボ 日野坪 +ヒノツメ 旭爪 +ヒノデ 日出 +ヒノデ 日野出 +ヒノデ 杲 +ヒノデ 日ノ出 +ヒノデ 日の出 +ヒノデ 日之出 +ヒノデ 暘 +ヒノト 日戸 +ヒノト 日野戸 +ヒノト 日ノ戸 +ヒノトザワ 丁沢 +ヒノトマエ 閘前 +ヒノナガ 樋永 +ヒノニシ 日之西 +ヒノニシ 日ノ西 +ヒノニシ 日野西 +ヒノネ 日野根 +ヒノバヤシ 日野林 +ヒノハラ 日原 +ヒノハラ 日野原 +ヒノハラ 樋原 +ヒノハラ 檜原 +ヒノハラ 桧原 +ヒノハラ 平野原 +ヒノハラ 日ノ原 +ヒノハラ 日の原 +ヒノハラ 日之原 +ヒノヒラ 日平 +ヒノヒラ 日野平 +ヒノヒラ 比野平 +ヒノブ 日信 +ヒノフジ 肥野藤 +ヒノベ 日延 +ヒノボリ 日登 +ヒノボリ 日登利 +ヒノマ 日野間 +ヒノマ 樋間 +ヒノマエ 閘前 +ヒノマル 日丸 +ヒノミ 火ノ見 +ヒノミ 日野見 +ヒノミズ 樋水 +ヒノミズ 日野水 +ヒノミズ 樋ノ水 +ヒノミゾ 日野溝 +ヒノミヤ 火宮 +ヒノミヤ 樋宮 +ヒノミヤ 火野宮 +ヒノミヤ 日野宮 +ヒノミヤ 樋ノ宮 +ヒノムラ 樋野村 +ヒノムラ 日野村 +ヒノメ 日野目 +ヒノモト 樋本 +ヒノモト 桧本 +ヒノモト 日本 +ヒノモト 日元 +ヒノモト 日野本 +ヒノモト 檜本 +ヒノモト 樋之本 +ヒノモト 樋野本 +ヒノモト 日ノ本 +ヒノモト 樋之元 +ヒノモリ 日野森 +ヒノモリ 旭森 +ヒノヤ 樋谷 +ヒノヤ 日野谷 +ヒノヤ 日野屋 +ヒノヤマ 日野山 +ヒノヤマ 桧ノ山 +ヒノワ 日輪 +ヒハ 日和 +ヒバ 樋場 +ヒバ 飛葉 +ヒバイ 飛梅 +ヒバカリ 日計 +ヒバカリ 比計 +ヒバコ 火箱 +ヒバサ 火狭(火狹) +ヒバサミ 樋廻 +ヒバシ 日橋 +ヒバタ 日端 +ヒバタ 日畑 +ヒバタ 樋端 +ヒバタ 日幡 +ヒバタ 樋畑 +ヒバタ 樋畠 +ヒバタ 桧畑 +ヒバナ 日花 +ヒバナ 桧鼻 +ヒバナ 檜鼻 +ヒバナ 煓 +ヒハマ 桧浜(檜濱) +ヒバヤシ 日林 +ヒバヤシ 檜林 +ヒバヤシ 桧林 +ヒハラ 日原 +ヒハラ 樋原 +ヒハラ 檜原 +ヒハラ 桧原 +ヒハラ 比原 +ヒハラ 火原 +ヒハラ 飛原 +ヒハラ 肥原 +ヒバラ 日原 +ヒバラ 樋原 +ヒバラ 檜原 +ヒバラ 桧原 +ヒバラ 比原 +ヒバラ 火原 +ビハラ 備原 +ヒバリ 雲雀 +ヒバリ 戸破 +ヒバリタ 雲雀田 +ヒバリノ 鸙野 +ヒバリノ 鷁野 +ヒバル 檜原 +ヒバル 陽原 +ヒビ 日比 +ヒビ 日 +ヒビ 日日 +ヒビ 日竎 +ヒビ 日々 +ヒビ 日 +ヒビ 比日 +ヒビ 非非 +ヒビ 非々 +ヒビイ 𥞩井 +ヒビウ 日比生 +ヒビウ 日比宇 +ヒビオ 日比生 +ヒビキ 響 +ヒビキ 枇々木 +ヒビキ 日引 +ヒビキ 樋引 +ヒビキ 日疋 +ヒビキオ 響尾 +ヒビキナミ 響波 +ヒビキヤ 響谷 +ヒビタニ 日比谷 +ヒビタニ 日々谷 +ヒビノ 日比野(日比埜) +ヒビノ 日々野 +ヒビノ 日尾野 +ヒビノ 日備野 +ヒビノ 響野 +ヒビノ 比日野 +ヒビノ 毘比野 +ヒビハラ 日比原 +ヒビヤ 日比谷 +ヒビヤ 響谷 +ヒビヤ 日々谷 +ヒビヤ 比日谷 +ヒビラ 日平 +ヒヒラギ 比々羅木 +ヒビラキ 日開 +ヒフ 一二 +ヒフ 干布 +ビフ 上別府 +ヒブセ 火伏 +ヒフミ 一二三 +ヒフミ 比夫見 +ヒフミ 比文 +ヒベ 日部 +ヒベ 樋部 +ヒボ 日保 +ヒマ 日馬 +ヒマ 飛間 +ヒマエ 日前 +ヒマエ 樋前 +ヒマガ 日間賀 +ヒマキ 日巻 +ヒマキ 桧槙 +ヒマキ 檜巻 +ヒマキ 檜槙(檜槇) +ヒマタ 日俣 +ヒマタ 日又 +ヒマチ 樋町 +ヒマツ 比松 +ヒマツ 日松 +ヒマル 日丸 +ヒマル 火丸 +ヒマワリ 樋廻 +ヒマワリ 日廻 +ヒマン 肥満 +ヒミ 氷見 +ヒミ 日美 +ヒミ 日見 +ヒミ 比見 +ヒミ 飛見 +ヒミズ 日水 +ヒミズ 樋水 +ヒミタニ 氷見谷 +ヒミチ 日道 +ヒミツ 日満 +ヒミネ 日峰 +ヒミノ 氷見野 +ヒミヤ 樋宮 +ヒミヤ 氷見谷 +ヒミヤマ 氷見山 +ヒムカイ 日向 +ヒムカイ 樋向 +ヒムカシ 日昔 +ヒムラ 日村 +ヒムラ 樋村 +ヒムラ 肥村 +ヒムラ 桧村 +ヒムラ 檜村 +ヒムラ 火村 +ヒムラ 干村 +ヒムラ 披村 +ヒムラ 比村 +ヒムロ 氷室 +ヒムロ 日室 +ヒムロ 檜室 +ヒムロ 桧室 +ヒムロ 樋室 +ヒムロ 火室 +ヒムロ 肥室 +ヒメ 比米 +ヒメ 姫 +ヒメイ 姫井 +ヒメイ 姫居 +ヒメイケ 姫池 +ヒメイシ 姫石 +ヒメイワ 姫岩 +ヒメウチ 姫内 +ヒメウラ 姫浦 +ヒメオ 姫尾 +ヒメオカ 姫岡 +ヒメガサコ 姫ケ迫 +ヒメカワ 姫川 +ヒメガワラ 姫川原 +ヒメキ 姫木 +ヒメギ 姫城 +ヒメグリ 姫廻 +ヒメコマツ 姫子松 +ヒメコマツ 姫小松 +ヒメサカ 姫坂 +ヒメサキ 姫崎 +ヒメザキ 姫崎 +ヒメザト 姫里 +ヒメサワ 姫沢 +ヒメザワ 姫澤 +ヒメジ 姫路 +ヒメジ 姫治 +ヒメジ 姫地 +ヒメシマ 姫嶋 +ヒメシマ 姫島 +ヒメジマ 姫嶋 +ヒメジマ 姫島 +ヒメタ 姫田 +ヒメダ 姫田 +ヒメダ 肥目田 +ヒメタニ 姫谷 +ヒメツグ 姫次 +ヒメヌマ 姫沼 +ヒメノ 姫野 +ヒメハラ 姫原 +ヒメマツ 姫松 +ヒメミ 姫見 +ヒメミヤ 姫宮 +ヒメミヤ 比売宮 +ヒメムラ 姫村 +ヒメモト 姫本 +ヒメモト 姫元 +ヒモ 日茂 +ヒモウ 比毛 +ヒモト 樋本 +ヒモト 樋元 +ヒモト 日本 +ヒモト 肥本 +ヒモト 比本 +ヒモト 陽本 +ヒモト 枇本 +ヒモト 緋本 +ビモト 備本 +ヒモノ 桧物 +ヒモノ 檜物 +ヒモノ 火物 +ヒモノ 干物 +ヒモノ 紐野 +ヒモノヤ 桧物谷 +ヒモノヤ 檜物谷 +ヒモモト 紐本 +ヒモリ 桧森 +ヒモリ 檜森 +ヒモリ 日森 +ヒモリ 日守 +ヒモリ 樋森 +ヒモリ 樋守 +ヒモリ 火森 +ヒモリ 日盛 +ヒモリ 比森 +ヒモロ 日諸 +ヒヤ 部谷 +ヒヤ 樋谷 +ヒヤ 肥谷 +ヒヤ 比屋 +ヒヤ 飛矢 +ヒヤ 比谷 +ヒヤ 飛家 +ヒヤ 火矢 +ヒヤウチ 樋谷内 +ヒヤオカ 冷岡 +ヒヤオカ 部谷岡 +ヒヤカワ 冷川 +ヒヤカワ 日矢川 +ヒヤキ 日焼 +ヒャクイ 百井 +ヒャクイチ 百市 +ヒャクカイ 百海 +ヒャクコク 百石 +ヒャクサイ 百済 +ヒャクサイ 百濟 +ヒャクサカ 百坂 +ヒャクサワ 百沢 +ヒャクサワ 百澤 +ヒャクザワ 百澤 +ヒャクシマ 百島 +ヒャクシマ 百嶋 +ヒャクジュ 百寿 +ヒャクソク 百束 +ヒャクタ 百田 +ヒャクダ 百田 +ヒャクダイ 百代 +ヒャクタケ 百武 +ヒャクタケ 百岳 +ヒャクタケ 百竹 +ヒャクタニ 百谷 +ヒャクヅカ 百塚 +ヒャクツボ 百坪 +ヒャクド 百度 +ヒャクドウ 百道 +ヒャクドウ 百堂 +ヒャクトミ 百富 +ヒャクトミ 百冨 +ヒャクドミ 百留 +ヒャクトメ 百留 +ヒャクドメ 百留 +ヒャクトリ 百鳥 +ヒャクナ 百名 +ヒャクナカ 百中 +ヒャクナリ 百成 +ヒャクノ 百野 +ビャクノ 百野 +ヒャクバイ 百倍 +ヒャクハタ 百畑 +ヒャクバタケ 百畑 +ヒャクブ 百歩 +ヒャクベ 百部 +ヒャクマ 百間 +ヒャクマダ 百間田 +ヒャクマチ 百町 +ヒャクマツ 百松 +ヒャクマル 百丸 +ヒャクマン 百万(百萬) +ヒャクムラ 百村 +ヒャクメ 百目 +ヒャクモト 百本 +ヒャクモト 百元 +ヒャクヤ 百谷 +ヒヤケ 一宅 +ヒヤケ 日焼 +ヒヤゴン 比屋根 +ヒヤザキ 飛矢崎 +ヒヤジ 飛矢地 +ビヤジマ 美谷島 +ビヤジマ 美谷嶋 +ヒヤシミズ 冷清水 +ヒヤジョウ 比屋定 +ヒヤチ 飛矢地 +ヒャッカ 百花 +ヒャッカイ 百海 +ヒャッカン 百貫 +ヒャッケン 百軒 +ヒャッケンダニ 百間谷 +ヒャッコク 百石 +ヒヤナギ 日柳 +ヒヤネ 比屋根 +ヒヤノサワ 冷野沢 +ヒヤハラ 冷原 +ヒヤマ 檜山 +ヒヤマ 陶山 +ヒヤマ 桧山 +ヒヤマ 樋山 +ヒヤマ 日山 +ヒヤマ 飛山 +ヒヤマ 肥山 +ヒヤマ 火山 +ヒヤマ 比山 +ヒヤマ 旭山 +ヒヤマ 部山 +ヒヤマ 燿山 +ヒヤマ 緋山 +ビヤマ 麋山 +ヒヤミズ 冷水 +ヒヤムタ 冷牟田 +ヒヤモト 檜谷本 +ヒヤモリ 部谷森 +ヒヤワ 部粟 +ビュウ 上別府 +ヒュウガ 日向 +ビュウガ 辨官 +ヒュウガジ 日向寺 +ヒュウガセ 日向瀬 +ヒュウガノ 日向野 +ヒュウガノ 日向埜 +ヒュウケ 日生下 +ヒヨ 日余 +ヒョウ 兵 +ヒョウ 瓢 +ヒヨウ 日用 +ヒョウイ 兵井 +ヒョウイ 兵伊 +ヒョウエ 兵江 +ヒョウエ 兵恵 +ヒョウエ 表江 +ヒョウエ 兵衛 +ヒョウエ 俵家 +ヒョウエ 兵工 +ヒョウエ 兵惠 +ヒョウエン 兵延 +ヒョウガ 兵賀 +ビョウガ 鋲賀 +ビョウガ 屏賀 +ヒョウカイ 氷海 +ヒョウガタニ 兵ケ谷 +ヒョウガミ 俵上 +ヒョウカワ 俵川 +ヒョウキ 俵木 +ヒョウキ 表木 +ヒョウギ 表木 +ヒョウギ 兵木 +ヒョウグ 表具 +ヒョウグチ 俵口 +ヒョウクラ 兵倉 +ヒョウゲ 兵毛 +ヒョウゴ 兵庫 +ヒョウゴ 兵後 +ヒョウゴ 瓢子 +ヒョウゴ 兵子 +ヒョウゴ 兵吾 +ヒョウゴウ 兵郷 +ヒョウゴウチ 表河内 +ヒョウゴタニ 兵庫谷 +ヒョウゴダニ 兵庫谷 +ヒョウゴヤ 兵庫谷 +ヒョウゴヤ 兵庫屋 +ヒョウサ 兵佐 +ヒョウサカ 兵坂 +ヒョウザキ 兵崎 +ヒョウサワ 兵沢 +ヒョウサワ 兵澤 +ヒョウザワ 兵沢 +ヒョウザワ 兵澤 +ヒョウシ 兵士 +ヒョウシグチ 表紙口 +ヒョウジョウ 表上 +ヒョウス 兵主 +ヒョウゾウ 兵三 +ヒョウソコ 兵底 +ヒョウタ 兵田 +ヒョウタ 俵田 +ヒョウダ 表田 +ヒョウダ 兵田 +ヒョウダ 俵田 +ヒョウダ 兵多 +ヒョウタニ 俵谷 +ヒョウタニ 表谷 +ヒョウタニ 兵谷 +ヒョウタンイシ 兵丹石 +ヒョウチ 兵地 +ヒョウチ 俵地 +ヒョウチ 表地 +ヒョウヅ 兵津 +ヒョウド 兵渡 +ヒョウド 兵土 +ヒョウトウ 兵頭 +ヒョウトウ 兵藤 +ヒョウトウ 兵東 +ヒョウドウ 兵頭 +ヒョウドウ 兵藤 +ヒョウドウ 兵動 +ヒョウドウ 兵働 +ヒョウドウ 兵道 +ヒョウドウ 俵藤 +ヒョウドウ 兵等 +ヒョウドウ 兵東 +ヒョウドウ 俵頭 +ヒョウドウ 俵道 +ヒョウドウ 表藤 +ヒョウドウ 兵堂 +ヒョウドウ 兵籐 +ビョウドウ 平等 +ビョウドウジ 平等路 +ヒョウトコ 兵床 +ヒョウナイ 俵内 +ヒョウナガ 兵永 +ヒョウノ 表野 +ヒョウノ 兵野 +ヒョウノ 氷野 +ヒョウノ 瓢野 +ヒョウノ 兵埜 +ヒョウノ 俵野 +ヒョウノタニ 表野谷 +ヒョウブ 兵部 +ビョウブ 屏風 +ヒョウヘイ 兵平 +ヒョウボリ 兵堀 +ヒョウマ 兵間 +ヒョウマ 兵馬 +ヒョウマン 俵満 +ヒョウマン 兵万 +ヒョウミ 氷見 +ヒョウムラ 表村 +ヒョウモト 俵本 +ヒョウモト 兵本 +ヒョウモト 表本 +ヒョウモリ 俵盛 +ヒョウモリ 俵森 +ヒョウヤ 俵谷 +ヒョウヤ 表谷 +ヒョウヤ 氷谷 +ヒョウヤマ 俵山 +ヒョウヤマ 兵山 +ヒョウリ 表利 +ヒョウレン 兵連 +ヒヨカワ 日与川 +ヒヨカワ 日與川 +ヒヨキ 日能 +ヒヨク 比翼 +ヒヨケ 火除 +ヒヨシ 比嘉 +ヒヨシ 日吉 +ヒヨシ 日好 +ヒヨシ 樋吉 +ヒヨシ 日芳 +ヒヨシ 日巡 +ヒヨシ 比義 +ヒヨシ 肥吉 +ヒヨシ 檜吉 +ヒヨシ 旭吉 +ヒヨシ 日新 +ヒヨシ 桧吉 +ヒヨシダ 日吉田 +ヒヨシヤ 日吉屋 +ヒヨシヤマ 日吉山 +ヒヨダ 飛与田 +ヒヨモリ 比与森 +ヒヨモリ 比予森 +ヒヨモリ 比豫森 +ヒヨモリ 比與森 +ヒヨヤマ 日代山 +ヒヨリ 日和 +ヒヨリヤマ 日和山 +ヒラ 平 +ヒラ 平良 +ヒラ 比良 +ヒラ 飛良 +ヒラ 日良 +ヒラ 比羅 +ヒラアキ 平昭 +ヒラアキ 平明 +ヒライ 平井 +ヒライ 平居 +ヒライ 平位 +ヒライ 開井 +ヒライ 比良井 +ヒライ 飛来 +ヒライ 平伊 +ヒライ 平意 +ヒライエ 平家 +ヒライケ 平池 +ヒライシ 平石 +ヒライズミ 平泉 +ヒライズミ 平出水 +ヒライソ 平磯 +ヒライソ 平礒 +ヒライチ 平市 +ヒライデ 平出 +ヒライデ 平井出 +ヒライナ 平井名 +ヒライヤ 平井谷 +ヒライリ 平入 +ヒライワ 平岩 +ヒラウ 平生 +ヒラウ 平宇 +ヒラウエ 平上 +ヒラウシ 平牛 +ヒラウチ 平内 +ヒラウチ 開内 +ヒラウネ 平畝(平畒) +ヒラウマ 平馬 +ヒラウミ 平海 +ヒラウメ 平梅 +ヒラエ 平江 +ヒラエ 平永 +ヒラエ 平得 +ヒラエ 平衛 +ヒラオ 平尾 +ヒラオ 平生 +ヒラオ 平緒 +ヒラオオジ 平大路 +ヒラオカ 平岡 +ヒラオカ 比良岡 +ヒラオカ 比羅岡 +ヒラオカ 平丘 +ヒラオカ 平岳 +ヒラオカエ 平岡江 +ヒラオキ 平沖 +ヒラオク 平奥 +ヒラカ 平賀 +ヒラカ 平家 +ヒラカ 平加 +ヒラカ 平鹿 +ヒラガ 平賀 +ヒラガイチ 平垣内 +ヒラガイト 平垣内 +ヒラガウチ 平垣内 +ヒラガキ 平垣 +ヒラガキ 平柿 +ヒラカキウチ 平垣内 +ヒラガキウチ 平垣内 +ヒラガクラ 平ケ倉 +ヒラカケ 平掛 +ヒラカタ 平方 +ヒラカタ 平形 +ヒラカタ 平片 +ヒラカタ 平潟 +ヒラカタ 平泻 +ヒラガタ 平形 +ヒラカド 平門 +ヒラカネ 平金 +ヒラカネ 平兼 +ヒラガネ 平金 +ヒラガネ 平兼 +ヒラガネ 平包 +ヒラガマ 平釜 +ヒラカミ 平上 +ヒラカミ 平神 +ヒラカミ 平紙 +ヒラガミ 平上 +ヒラガミ 平神 +ヒラガミ 平紙 +ヒラカワ 平川 +ヒラカワ 平河 +ヒラカワウチ 平河内 +ヒラガワラ 平瓦 +ヒラキ 平木 +ヒラキ 開 +ヒラキ 平城 +ヒラキ 発 +ヒラキ 開キ +ヒラキ 比良木 +ヒラキ 平黄 +ヒラギ 平木 +ヒラギ 平城 +ヒラギ 柊 +ヒラギ 平義 +ヒラギ 柊木 +ヒラキウチ 開内 +ヒラキグチ 開口 +ヒラキザワ 開沢 +ヒラキザワ 開澤 +ヒラギシ 平岸 +ヒラキタ 平北 +ヒラキダ 開田 +ヒラキダニ 開谷 +ヒラギタニ 柊谷 +ヒラギダニ 柊谷 +ヒラキノ 開野 +ヒラギノ 平儀野 +ヒラギノ 柊木野 +ヒラキバ 平木場 +ヒラキバラ 開原 +ヒラキモト 開本 +ヒラギモト 柊本 +ヒラキヤ 開屋 +ヒラク 開 +ヒラク 平工 +ヒラク 平久 +ヒラク 比楽 +ヒラク 比樂 +ヒラク 日楽(日樂) +ヒラクイ 平久井 +ヒラクエ 平久江 +ヒラクエ 開江 +ヒラクシ 平櫛 +ヒラグシ 平櫛 +ヒラクチ 平口 +ヒラグチ 平口 +ヒラクチヤマ 平口山 +ヒラグチヤマ 平口山 +ヒラクニ 平国 +ヒラクニ 平國 +ヒラクボ 平久保 +ヒラクボ 平窪 +ヒラクマ 平隈 +ヒラクマ 平熊 +ヒラクラ 平倉 +ヒラクリ 平栗 +ヒラグリ 平栗 +ヒラクワ 平桑 +ヒラケ 平化 +ヒラコ 平子 +ヒラコ 平古 +ヒラコ 平児 +ヒラゴ 平吾 +ヒラゴ 平後 +ヒラコウ 平光 +ヒラゴウ 平郷 +ヒラコウチ 平河内 +ヒラゴウチ 平垣内 +ヒラゴオリ 平郡 +ヒラコシ 平越 +ヒラコシ 平腰 +ヒラコセ 平小瀬 +ヒラコソ 平社 +ヒラコダ 平子田 +ヒラコダマ 平児玉 +ヒラコバ 平古場 +ヒラコバ 平木場 +ヒラコバ 平小場 +ヒラコバ 平木塲 +ヒラサ 平佐 +ヒラサ 平沙 +ヒラサ 平紗 +ヒラザ 平座 +ヒラサイ 平財 +ヒラサイ 平蔡 +ヒラサカ 平坂 +ヒラサカ 平阪 +ヒラサキ 平崎 +ヒラサキ 平嵜 +ヒラザキ 平崎 +ヒラサク 平作 +ヒラサクラ 平櫻 +ヒラザクラ 平桜 +ヒラザクラ 平櫻 +ヒラサコ 平迫 +ヒラサコ 平硲 +ヒラサコ 平浴 +ヒラサゴ 平砂 +ヒラサタ 平佐田 +ヒラサタ 平佐多 +ヒラサダ 平佐田 +ヒラサダ 平貞 +ヒラサト 平里 +ヒラサワ 平沢 +ヒラサワ 平澤 +ヒラザワ 平沢 +ヒラザワ 平澤 +ヒラサワツ 平沢津 +ヒラサワツ 平澤津 +ヒラジ 平治 +ヒラジ 平路 +ヒラシオ 平塩 +ヒラシキ 平敷 +ヒラシキ 平識 +ヒラシキ 平職 +ヒラシキ 平舗 +ヒラシゲ 平重 +ヒラシゲ 平繁 +ヒラシタ 平下 +ヒラシバ 平柴 +ヒラシバ 平芝 +ヒラシマ 平島 +ヒラシマ 平嶋 +ヒラシマ 平嶌 +ヒラジマ 平島 +ヒラジマ 平嶋 +ヒラシミズ 平清水 +ヒラジョウ 平城 +ヒラジリ 平尻 +ヒラシン 平新 +ヒラスエ 平末 +ヒラスカ 平須賀 +ヒラスガ 平須賀 +ヒラスギ 平杉 +ヒラスナ 平砂 +ヒラスナ 平沙 +ヒラスミ 平住 +ヒラスミ 平角 +ヒラズミ 平住 +ヒラズミ 平角 +ヒラズル 平水流 +ヒラセ 平瀬 +ヒラセ 平生 +ヒラセ 平勢(平㔟) +ヒラセ 平世 +ヒラセ 平稲 +ヒラセ 平清 +ヒラセト 平瀬戸 +ヒラセド 平瀬戸 +ヒラソウズ 平早水 +ヒラゾエ 平添 +ヒラゾノ 平園 +ヒラゾノ 比良園 +ヒラタ 平田 +ヒラタ 開田 +ヒラタ 枚田 +ヒラタ 比良田 +ヒラタ 平太 +ヒラタ 平多 +ヒラタ 衡田 +ヒラタ 坦田 +ヒラタ 比良多 +ヒラタイ 平体 +ヒラタイ 平躰 +ヒラダイ 平代 +ヒラタカ 平高 +ヒラタキ 平滝 +ヒラタキ 平瀧 +ヒラタケ 平竹 +ヒラタケ 平武 +ヒラタダ 平忠 +ヒラタテ 平館 +ヒラタテ 平舘 +ヒラダテ 平館 +ヒラダテ 平舘 +ヒラタニ 平谷 +ヒラダヒラ 平々 +ヒラタマ 平玉 +ヒラタヤ 平田谷 +ヒラチ 平地 +ヒラチカ 平親 +ヒラチヤ 平地屋 +ヒラツ 平津 +ヒラツカ 平塚 +ヒラツカ 平墳 +ヒラヅカ 平塚 +ヒラツジ 平辻 +ヒラツチ 平土 +ヒラツナ 平綱 +ヒラツボ 平坪 +ヒラテ 平手 +ヒラデ 平出 +ヒラデン 平田 +ヒラト 平戸 +ヒラト 平都 +ヒラド 平戸 +ヒラド 平土 +ヒラドイ 平土井 +ヒラトウ 平藤 +ヒラトウ 平等 +ヒラトウゲ 平峠 +ヒラトオ 平遠 +ヒラドオリ 平通 +ヒラトキ 平時 +ヒラトコ 平床 +ヒラトチ 平栃 +ヒラトミ 平富 +ヒラトミ 平冨 +ヒラトメ 平留 +ヒラドメ 平留 +ヒラトモ 平伴 +ヒラナ 平名 +ヒラナ 平兮 +ヒラナ 平奈 +ヒラナイ 平内 +ヒラナカ 平中 +ヒラナカ 平仲 +ヒラナガ 平永 +ヒラナガ 平長 +ヒラナベ 平鍋 +ヒラナミ 平波 +ヒラナミ 平南 +ヒラナミ 平浪 +ヒラナメ 平滑 +ヒラニシ 平西 +ヒラニタ 平仁田 +ヒラヌカ 平糠 +ヒラヌキ 平抜 +ヒラヌマ 平沼 +ヒラネ 平根 +ヒラノ 平野 +ヒラノ 平能 +ヒラノ 平埜 +ヒラノ 比良野 +ヒラノ 平之 +ヒラノイ 平野井 +ヒラノウ 平能 +ヒラノウエ 平ノ上 +ヒラノウチ 平ノ内 +ヒラノウチ 平之内 +ヒラノウチ 平野内 +ヒラノソノ 平之園 +ヒラノニシ 平野西 +ヒラノハラ 平野原 +ヒラノブ 平信 +ヒラノベ 平延 +ヒラノマエ 平野前 +ヒラノヤ 平野谷 +ヒラノヤ 平ノ谷 +ヒラノヤマ 平之山 +ヒラバ 平場 +ヒラバ 平葉 +ヒラハエ 平八重 +ヒラバエ 平生 +ヒラバエ 平八重 +ヒラバエ 平碰 +ヒラバエ 平碆 +ヒラハシ 平橋 +ヒラハタ 平畑 +ヒラハタ 平畠 +ヒラハタ 平幡 +ヒラハタ 平端 +ヒラバタ 平畑 +ヒラバタ 平畠 +ヒラハタケ 平畑 +ヒラハタケ 平畠 +ヒラバタケ 平畠 +ヒラハマ 平浜 +ヒラハマ 平濱 +ヒラハヤ 平早 +ヒラハヤ 平碆 +ヒラバヤ 平碆 +ヒラバヤシ 平林 +ヒラハラ 平原 +ヒラハラ 櫟原 +ヒラバラ 平原 +ヒラハル 平春 +ヒラバル 平原 +ヒラヒサ 平久 +ヒラフキ 平吹 +ヒラブキ 平吹 +ヒラフク 平福 +ヒラフク 比良幅 +ヒラフジ 平藤 +ヒラブチ 平渕 +ヒラフネ 平船(平舩) +ヒラフネ 平舟 +ヒラフミ 平文 +ヒラベ 平部 +ヒラボシ 平星 +ヒラホリ 平堀 +ヒラボリ 平堀 +ヒラマ 平間 +ヒラマ 平馬 +ヒラマ 平麻 +ヒラマ 比良間 +ヒラマエ 平前 +ヒラマキ 平牧 +ヒラマキ 平槙 +ヒラマキ 平槇 +ヒラマサ 平昌 +ヒラマス 平増 +ヒラマス 平升 +ヒラマス 平舛 +ヒラマス 平桝 +ヒラマチ 平町 +ヒラマツ 平松 +ヒラマツ 比良松 +ヒラマツダイ 平松大 +ヒラマル 平丸 +ヒラミ 平見 +ヒラミ 平海 +ヒラミ 平巳 +ヒラミ 平美 +ヒラミ 平己 +ヒラミ 平身 +ヒラミズ 平水 +ヒラミチ 平道 +ヒラミチ 平通 +ヒラミツ 平光 +ヒラミツ 平満 +ヒラミナミ 平南 +ヒラミネ 平峰 +ヒラミネ 平峯 +ヒラミネ 平嶺 +ヒラミヤ 平宮 +ヒラムカイ 平向 +ヒラムキ 平向 +ヒラムネ 平棟 +ヒラムラ 平村 +ヒラムラ 平邑 +ヒラムレ 平牟礼 +ヒラムレ 平牟禮 +ヒラムロ 平室 +ヒラメ 平目 +ヒラモト 平本 +ヒラモト 平元 +ヒラモト 比良元 +ヒラモリ 平森 +ヒラモリ 平盛 +ヒラモリ 平守 +ヒラヤ 平谷 +ヒラヤ 平家 +ヒラヤ 平屋 +ヒラヤ 平矢 +ヒラヤエ 平八重 +ヒラヤシキ 平屋敷 +ヒラヤス 平安 +ヒラヤス 平康 +ヒラヤスナ 平安名 +ヒラヤナギ 平柳 +ヒラヤブ 平薮 +ヒラヤブ 平藪 +ヒラヤブ 平籔 +ヒラヤマ 平山 +ヒラヤマ 平安山 +ヒラヤマ 比良山 +ヒラヤマ 衡山 +ヒラヤマ 日羅山 +ヒラユ 平湯 +ヒラヨシ 平良 +ヒラヨシ 平吉 +ヒラヨシ 平葭 +ヒラヨシ 平義 +ヒラヨシ 平芳 +ヒラヨシ 平葦 +ヒラヨシ 平好 +ヒララ 平良 +ヒララギ 平良木 +ヒラリ 平利 +ヒラリ 平理 +ヒラレン 平連 +ヒラロ 平魯 +ヒラワ 平和 +ヒラワ 平輪 +ヒラワカ 平若 +ヒラワキ 平脇 +ヒラワケ 平訳 +ヒラワケ 平譯 +ヒラワタ 平渡 +ヒラワタ 平綿 +ヒラワダ 平和田 +ヒラワタシ 平渡 +ヒラワタリ 平渡 +ビリカワ 備里川 +ヒリキ 日力 +ヒリュウ 飛竜 +ヒリュウ 飛龍 +ビリン 美淋 +ヒル 日留 +ヒル 比留 +ヒルイ 比留井 +ヒルイ 蛭井 +ヒルイケ 蛭池 +ヒルオ 日比生 +ヒルオカ 昼岡 +ヒルオカ 晝岡 +ヒルカ 蛭可 +ヒルガミ 昼神 +ヒルガヤ 蛭ケ谷 +ヒルカワ 蛭川 +ヒルカワ 比留川 +ヒルカワ 肥留川 +ヒルカワ 昼河 +ヒルカワ 昼川 +ヒルカワ 日留川 +ヒルカワ 晝河 +ヒルカワ 晝川 +ビルカワ 尾留川 +ヒルキ 比留木(比畄木) +ヒルコ 蛭子 +ヒルコイ 蛭子井 +ヒルコタニ 蛭子谷 +ヒルコダニ 蛭子谷 +ヒルサカ 蛭坂 +ヒルサキ 蛭崎 +ヒルサワ 蛭沢 +ヒルサワ 昼沢(晝沢・晝澤) +ヒルサワ 比留沢 +ヒルサワ 比留澤 +ヒルサワ 蛭澤 +ヒルザワ 蛭沢 +ヒルザワ 比留澤 +ヒルザワ 蛭澤 +ヒルタ 蛭田 +ヒルタ 昼田 +ヒルタ 比留田 +ヒルタ 晝田 +ヒルタ 日留田 +ヒルタ 非留田 +ヒルダ 蛭田 +ヒルダ 昼田 +ヒルダ 晝田 +ヒルタニ 蛭谷 +ビルタニ 毘盧谷 +ヒルナカ 昼仲(晝仲) +ヒルナギ 蛭薙 +ヒルナミ 蛭波 +ヒルヌマ 蛭沼 +ヒルノ 蛭野 +ヒルノ 昼埜 +ヒルノ 昼野 +ヒルバ 昼場 +ヒルバ 晝場 +ヒルマ 比留間 +ヒルマ 蛭間 +ヒルマ 昼間 +ヒルマ 肥留間 +ヒルマ 晝間 +ヒルマ 昼馬 +ヒルマ 飛留間 +ヒルマ 蛙間 +ヒルマ 比晋間 +ヒルマ 晝馬 +ヒルマ 畫間 +ヒルマチ 蛭町 +ビルマチ 美留町(美畄町) +ヒルミ 蛭海 +ヒルムタ 蛭牟田 +ヒルモ 蛭藻 +ヒルモト 蛭本 +ヒルヤ 蛭谷 +ビレイ 美麗 +ヒレオカ 鰭岡 +ヒレサキ 鰭崎 +ヒレサキ 鰭嵜 +ヒレザキ 比連崎 +ヒレザキ 鰭崎 +ヒレンザキ 比連崎 +ヒレンザキ 比蓮崎 +ヒロ 広 +ヒロ 廣 +ヒロ 弘 +ヒロ 枇榔 +ヒロ 飛呂 +ヒロ 比呂 +ヒロアキ 広明 +ヒロアキ 廣明 +ヒロアキ 広秋 +ヒロイ 広井 +ヒロイ 廣井 +ヒロイ 広居 +ヒロイ 弘井 +ヒロイ 拾井 +ヒロイ 廣居 +ヒロイ 日路井 +ヒロイ 廣飯 +ヒロイイ 広飯 +ヒロイイ 廣飯 +ヒロイエ 広家 +ヒロイケ 広池 +ヒロイケ 廣池 +ヒロイシ 広石 +ヒロイシ 廣石 +ヒロイシ 弘石 +ヒロイワ 広岩 +ヒロイワ 弘岩 +ヒロイワ 廣岩 +ビロウ 枇榔 +ビロウ 檳榔 +ヒロウジ 広氏 +ヒロウジ 廣氏 +ヒロウジ 広宇次 +ヒロウジ 広宇治(廣宇治) +ヒロウチ 広内 +ヒロウチ 廣内 +ヒロウチ 弘内 +ヒロウミ 広海 +ヒロウミ 弘海 +ヒロウミ 廣海 +ヒロウメ 広梅(廣梅) +ヒロウラ 広浦 +ヒロウラ 弘浦 +ヒロウラ 廣浦 +ヒロエ 広江 +ヒロエ 廣江 +ヒロエ 広恵 +ヒロエ 広エ +ヒロエ 廣恵 +ヒロエ 廣惠 +ヒロエダ 広枝 +ヒロエダ 廣枝 +ヒロオ 広尾 +ヒロオ 廣尾 +ヒロオ 拾雄 +ヒロオ 弘生 +ヒロオカ 広岡 +ヒロオカ 廣岡 +ヒロオカ 弘岡 +ヒロオカ 広陵(廣陵) +ヒロオカ 広丘 +ヒロオク 広奥 +ヒロオク 弘奥 +ヒロオク 廣奥 +ヒロオケ 広桶 +ヒロガ 広賀 +ヒロガ 廣賀 +ヒロカイト 広海渡 +ヒロカガ 広利 +ヒロカガ 廣利 +ヒロガキ 広垣 +ヒロガキ 廣垣 +ヒロカタ 広方 +ヒロカタ 廣方 +ヒロカド 広門 +ヒロカド 廣門 +ヒロカド 広角 +ヒロカド 廣角 +ヒロカネ 広兼 +ヒロカネ 廣兼 +ヒロカネ 広金 +ヒロカネ 弘兼 +ヒロカネ 廣金 +ヒロカネ 弘金 +ヒロカネ 廣廉 +ヒロガネ 広兼 +ヒロガネ 廣兼 +ヒロガネ 広金 +ヒロガネ 廣金 +ヒロカミ 広上 +ヒロカミ 広神 +ヒロカミ 廣上 +ヒロカミ 廣神 +ヒロガミ 広上 +ヒロガミ 広神 +ヒロガミ 廣上 +ヒロガミ 廣神 +ヒロカリ 広刈 +ヒロカリ 広苅 +ヒロカリ 廣苅 +ヒロガリ 広狩(廣狩) +ヒロガリ 広猟(廣猟) +ヒロカワ 広川 +ヒロカワ 廣川 +ヒロカワ 弘川 +ヒロカワ 広河 +ヒロカワ 洪川 +ヒロカワ 官川 +ヒロカワ 裕川 +ヒロカワ 廣河 +ヒロガワラ 広河原 +ヒロキ 広木 +ヒロキ 廣木 +ヒロキ 尋木 +ヒロキ 広亀(廣亀) +ヒロキ 広城 +ヒロキ 廣城 +ヒロクチ 廣口 +ヒログチ 広口 +ヒログチ 廣口 +ヒロクニ 広国(廣国) +ヒロクニ 弘国 +ヒロクニ 廣國 +ヒロクボ 広久保(廣久保) +ヒロクラ 広倉 +ヒロクラ 弘藏(弘蔵) +ヒロコ 広子 +ヒロコ 廣子 +ヒロコウ 広幸(廣幸) +ヒロコウジ 廣小路(広小路) +ヒロゴオリ 広郡 +ヒロゴオリ 廣郡 +ヒロコシ 広越 +ヒロコシ 廣越 +ヒロサカ 広坂 +ヒロサカ 広阪 +ヒロサカ 廣坂 +ヒロサカ 廣阪 +ヒロサキ 広崎 +ヒロサキ 廣崎 +ヒロサキ 廣前 +ヒロサキ 広嵜 +ヒロサキ 弘崎 +ヒロサキ 弘前 +ヒロサキ 廣嵜 +ヒロザキ 広崎 +ヒロザキ 廣崎 +ヒロサク 広作(廣作) +ヒロサコ 広佐古 +ヒロサコ 広迫 +ヒロサコ 廣佐古 +ヒロサダ 広貞 +ヒロサダ 廣貞 +ヒロサト 広里 +ヒロサト 廣里 +ヒロザネ 広実 +ヒロザネ 弘実 +ヒロザネ 廣實 +ヒロザネ 広實 +ヒロザネ 弘實 +ヒロザネ 廣実 +ヒロサワ 広沢 +ヒロサワ 廣澤 +ヒロサワ 廣沢 +ヒロサワ 広澤 +ヒロサワ 弘澤 +ヒロサワ 洪沢 +ヒロザワ 広沢 +ヒロザワ 廣澤 +ヒロザワ 廣沢 +ヒロザワ 広澤 +ヒロザワ 弘沢 +ヒロザワ 弘澤 +ヒロシ 広 +ヒロシ 廣 +ヒロシ 寛 +ヒロシ 広司 +ヒロシ 寛司 +ヒロシ 博 +ヒロシ 廣司 +ヒロシ 広志 +ヒロジ 広地 +ヒロジ 広路 +ヒロジ 廣路 +ヒロシカ 広鹿 +ヒロシカ 廣鹿 +ヒロシゲ 広重 +ヒロシゲ 廣重 +ヒロシゲ 弘重 +ヒロシゲ 広繁 +ヒロシゲ 広滋 +ヒロシゲ 広茂 +ヒロシゲ 廣繁 +ヒロシゲ 弘繁 +ヒロシゲ 弘茂 +ヒロシゲ 廣滋 +ヒロシゲ 廣茂 +ヒロシタ 広下 +ヒロシタ 弘下 +ヒロシタ 廣下 +ヒロシバ 広芝 +ヒロシバ 弘芝 +ヒロシバ 廣芝 +ヒロシマ 広島 +ヒロシマ 広嶋 +ヒロシマ 廣島 +ヒロシマ 廣嶋 +ヒロシマ 弘島 +ヒロシマ 弘嶋 +ヒロシマ 寛島(寛嶋) +ヒロシマ 宏洲 +ヒロシマ 広嶌 +ヒロシマ 広嶼(廣嶼) +ヒロシマ 裕島 +ヒロシマ 廣嶌 +ヒロシマヤ 広島屋 +ヒロシマヤ 廣島屋 +ヒロシロ 広城 +ヒロス 広須 +ヒロズ 広津 +ヒロスエ 広末 +ヒロスエ 廣末 +ヒロスエ 弘末 +ヒロスエ 広未 +ヒロスギ 広杉 +ヒロスナ 広砂 +ヒロスナ 廣砂 +ヒロスミ 広住 +ヒロスミ 廣住 +ヒロスミ 広角 +ヒロスミ 広隅 +ヒロスミ 寛澄 +ヒロスミ 広済 +ヒロスミ 廣角 +ヒロスミ 廣隅 +ヒロスミ 廣濟 +ヒロスミ 昊澄 +ヒロズミ 広住 +ヒロズミ 廣住 +ヒロズミ 広済 +ヒロズミ 寛住 +ヒロセ 広瀬 +ヒロセ 廣瀬 +ヒロセ 弘瀬 +ヒロセ 弘末 +ヒロセ 広世 +ヒロセ 広清 +ヒロセ 広畝 +ヒロセ 弘世 +ヒロセ 広勢 +ヒロセ 裕勢 +ヒロセ 廣世 +ヒロセ 廣畝 +ヒロセ 廣勢 +ヒロセ 廣清 +ヒロセイ 広清 +ヒロセイ 廣清 +ヒロソ 広曽 +ヒロソコ 広底 +ヒロソコ 廣底 +ヒロタ 広田 +ヒロタ 廣田 +ヒロタ 弘田 +ヒロタ 博田 +ヒロタ 広多 +ヒロタ 尋田 +ヒロタ 廣多 +ヒロダ 廣田 +ヒロダイラ 広平 +ヒロタカ 広高 +ヒロタカ 廣高 +ヒロタカ 広隆 +ヒロタカ 弘高 +ヒロタカ 廣隆 +ヒロタキ 広滝 +ヒロタキ 廣瀧 +ヒロタキ 廣滝 +ヒロタキ 広瀧 +ヒロタケ 広竹(廣竹) +ヒロタケ 広武(廣武) +ヒロタケ 廣丈 +ヒロタニ 広谷 +ヒロタニ 廣谷 +ヒロタニ 弘谷 +ヒロタニ 寛谷 +ヒロタネ 弘胤 +ヒロタネ 弘種 +ヒロタマ 広玉 +ヒロダン 広段(廣段) +ヒロチ 広地 +ヒロチ 廣地 +ヒロチ 広知 +ヒロチ 弘地 +ヒロチカ 広近 +ヒロチカ 廣近 +ヒロチョウ 広長 +ヒロチョウ 廣長 +ヒロツ 広津 +ヒロツ 弘津 +ヒロツ 廣津 +ヒロツカ 広塚 +ヒロツカ 廣塚 +ヒロツグ 広次 +ヒロツグ 廣次 +ヒロツジ 広辻 +ヒロツジ 廣辻 +ヒロツナ 広綱 +ヒロツナ 廣綱 +ヒロツネ 広常 +ヒロツネ 広恒 +ヒロツネ 廣常 +ヒロツネ 廣経 +ヒロツネ 廣恒 +ヒロツラ 広連 +ヒロツル 広津留 +ヒロツル 廣津留 +ヒロツル 広鶴 +ヒロデ 広出 +ヒロデ 廣出 +ヒロト 広戸 +ヒロト 廣戸 +ヒロド 広戸 +ヒロド 廣戸 +ヒロトウ 広藤 +ヒロトウ 廣藤 +ヒロトウ 広東 +ヒロトウ 広籐 +ヒロトウ 廣東 +ヒロトシ 広歳(廣歳) +ヒロトシ 弘利 +ヒロトミ 広富 +ヒロトミ 廣富 +ヒロトミ 広冨 +ヒロトミ 廣冨 +ヒロトモ 広友 +ヒロトモ 弘友 +ヒロトモ 廣友 +ヒロナイ 広内 +ヒロナイ 廣内 +ヒロナオ 広直 +ヒロナオ 廣直 +ヒロナカ 弘中 +ヒロナカ 広中 +ヒロナカ 廣中 +ヒロナカ 広仲 +ヒロナカ 廣仲 +ヒロナカ 弘仲 +ヒロナガ 広永 +ヒロナガ 広長 +ヒロナガ 弘永 +ヒロナガ 廣永 +ヒロナガ 廣長 +ヒロナガ 弘長 +ヒロナミ 広波(廣波) +ヒロナミ 広南(廣南) +ヒロニシ 広西 +ヒロニシ 廣西 +ヒロニシ 弘西 +ヒロニワ 広庭 +ヒロニワ 廣庭 +ヒロヌマ 広沼 +ヒロヌマ 廣沼 +ヒロネ 広根 +ヒロネ 廣根 +ヒロノ 広野 +ヒロノ 廣野 +ヒロノ 広納 +ヒロノ 弘野 +ヒロノ 弘埜 +ヒロノ 廣納 +ヒロノ 博野 +ヒロノ 宏乃 +ヒロノ 日露野 +ヒロノウ 広納 +ヒロノウ 広能 +ヒロノウ 廣納 +ヒロノウ 廣能 +ヒロノウチ 広之内 +ヒロノブ 広信 +ヒロノブ 廣信 +ヒロノベ 広延(廣延) +ヒロハ 広羽 +ヒロハ 広波(廣波) +ヒロハ 広葉 +ヒロハ 廣羽 +ヒロハ 廣葉 +ヒロバ 広場 +ヒロバ 広羽 +ヒロバ 廣羽 +ヒロバ 廣場 +ヒロハク 広白(廣白) +ヒロハシ 広橋 +ヒロハシ 廣橋 +ヒロハシ 宏橋 +ヒロハシ 弘橋 +ヒロハタ 広畑 +ヒロハタ 廣畑 +ヒロハタ 広幡 +ヒロハタ 広畠 +ヒロハタ 廣幡 +ヒロハタ 弘畑 +ヒロハタ 広鰭 +ヒロハタ 廣畠 +ヒロハタ 弘畠 +ヒロハタ 広端 +ヒロハタ 廣端 +ヒロハタ 廣鰭 +ヒロバタ 廣畑 +ヒロバタ 廣畠 +ヒロハナ 広花 +ヒロハナ 廣花 +ヒロハナ 廣華 +ヒロハマ 広浜 +ヒロハマ 廣濱 +ヒロハマ 広濱 +ヒロハマ 弘浜 +ヒロハマ 廣浜 +ヒロバヤシ 広林 +ヒロバヤシ 宏林 +ヒロバヤシ 廣林 +ヒロハラ 広原 +ヒロハラ 廣原 +ヒロハラ 弘原 +ヒロハラ 曠原 +ヒロヒ 広比 +ヒロヒ 廣比 +ヒロビキ 広引 +ヒロビキ 廣引 +ヒロヒサ 広久 +ヒロフサ 広房 +ヒロフサ 廣房 +ヒロフジ 広藤 +ヒロフジ 廣藤 +ヒロフジ 弘藤 +ヒロフチ 広渕 +ヒロフチ 廣淵 +ヒロブチ 広渕 +ヒロブチ 広淵 +ヒロブチ 廣淵 +ヒロブチ 廣渕 +ヒロフネ 広船 +ヒロフネ 広舟 +ヒロフネ 廣船 +ヒロベ 広部 +ヒロベ 廣部 +ヒロベ 広辺 +ヒロベ 広比 +ヒロベ 弘部 +ヒロベ 廣比 +ヒロベ 廣辺(廣邉) +ヒロベ 廣邊 +ヒロボラ 広洞(廣洞) +ヒロマ 広間 +ヒロマ 廣間 +ヒロマ 弘間 +ヒロマエ 広前 +ヒロマエ 廣前 +ヒロマサ 広政 +ヒロマサ 廣政 +ヒロマサ 広正 +ヒロマサ 弘政 +ヒロマサ 廣正 +ヒロマス 広増 +ヒロマス 広升(廣升) +ヒロマス 広桝 +ヒロマス 廣増 +ヒロマチ 広町 +ヒロマチ 廣町 +ヒロマツ 広松 +ヒロマツ 廣松 +ヒロマツ 弘松 +ヒロマル 広丸 +ヒロミ 広見 +ヒロミ 広海 +ヒロミ 廣見 +ヒロミ 弘実 +ヒロミ 弘海 +ヒロミ 廣海 +ヒロミ 弘實 +ヒロミズ 広水 +ヒロミチ 広道 +ヒロミチ 廣道 +ヒロミツ 弘光 +ヒロミツ 広光 +ヒロミツ 廣光 +ヒロミネ 広峰 +ヒロミネ 広峯 +ヒロミネ 廣峰 +ヒロミネ 廣峯 +ヒロミネ 廣嶺 +ヒロミヤ 広宮 +ヒロミヤ 廣宮 +ヒロム 弘 +ヒロムラ 広村 +ヒロムラ 廣村 +ヒロメ 広目 +ヒロメ 広芽 +ヒロメ 廣芽 +ヒロメ 廣目 +ヒロモト 広本 +ヒロモト 廣本 +ヒロモト 広元 +ヒロモト 弘本 +ヒロモト 弘元 +ヒロモト 廣元 +ヒロモト 洪本 +ヒロモリ 広森 +ヒロモリ 廣森 +ヒロモリ 広盛 +ヒロモリ 広守 +ヒロモリ 廣盛 +ヒロヤ 広谷 +ヒロヤ 廣谷 +ヒロヤ 広屋 +ヒロヤ 廣屋 +ヒロヤス 広安 +ヒロヤス 広保 +ヒロヤス 弘保 +ヒロヤス 廣安 +ヒロヤス 廣保 +ヒロヤス 広康(廣康) +ヒロヤマ 広山 +ヒロヤマ 廣山 +ヒロヤマ 弘山 +ヒロヤマ 寛山 +ヒロユキ 広行 +ヒロユキ 廣行 +ヒロヨシ 広吉 +ヒロヨシ 廣吉 +ヒロヨシ 広芳 +ヒロヨシ 広好 +ヒロヨシ 弘宜 +ヒロヨシ 弘吉 +ヒロヨシ 廣芳 +ヒロリ 広理(廣理) +ヒロワ 広和 +ヒロワ 廣和 +ヒロワカ 広若 +ヒロワカ 廣若 +ヒロワキ 広脇 +ヒロワキ 廣脇 +ヒロワタリ 広渡 +ヒロワタリ 廣渡 +ヒワ 日和 +ヒワ 桧皮 +ヒワ 檜皮 +ヒワ 火和 +ヒワ 肥和 +ヒワ 檜波 +ビワ 枇杷 +ビワ 琵琶 +ビワ 批杷 +ヒワガミ 日和上 +ヒワキ 樋脇 +ヒワキ 枇杷木 +ヒワキ 日脇 +ヒワキ 檜脇 +ヒワキ 桧脇 +ビワキ 枇杷木 +ビワキ 批杷木 +ビワギシ 枇杷岸 +ヒワサ 日和佐 +ビワサカ 琵琶坂 +ビワサカ 枇杷阪 +ヒワサキ 日和崎 +ヒワタ 樋渡 +ヒワタ 日和田 +ヒワタ 鶸田 +ヒワダ 桧田 +ヒワダ 桧皮 +ヒワダ 檜田 +ヒワダ 日和田 +ヒワダ 檜皮 +ヒワダ 檜和田 +ヒワダ 桧和田 +ヒワダ 鶸田 +ヒワダ 肥和田 +ヒワダ 檜波田 +ヒワダ 桧波田 +ヒワダ 檜皮田 +ビワタ 枇杷田 +ビワタ 批把田 +ビワタ 枇把田 +ビワタ 美和田 +ビワダ 枇杷田 +ヒワダ 桧皮田 +ヒワタシ 樋渡 +ヒワタシ 日渡 +ヒワタシ 飛渡 +ヒワタシ 肥渡 +ヒワタニ 比和谷 +ヒワタニ 桧皮谷(檜皮谷) +ビワタニ 枇杷谷 +ヒワタリ 樋渡 +ヒワタリ 日渡 +ヒワタリ 飛渡 +ヒワタリ 氷渡 +ヒワタリ 桧渡(檜渡) +ビワトモ 枇杷友 +ヒワノ 比和野 +ヒワノ 日和野 +ヒワノ 肥和野 +ビワハシ 枇杷橋 +ヒワハラ 日和原 +ビワハラ 枇杷原 +ビワモト 枇杷本 +ヒワラ 檜原 +ヒワラ 桧原 +ヒン 賓 +ビンカイ 備海 +ビンギョ 備魚 +ビングシ 鬢櫛 +ビンゴ 備後 +ヒンコウジ 牝小路 +ビンゴウチ 備後内 +ビンサキ 鬢崎 +ビンシュ 備酒 +ビンダ 便田 +ビンナカ 備中 +ビンナカ 備仲 +ビンモト 便元 +ブア 無安 +フアカ 普赤 +フアミ 浮網 +フイ 不井 +ブイ 武井 +フウキ 富貴 +フウキ 冨貴 +フウキ 豊貴 +フウサカ 風坂 +フウサワ 風沢 +フウサワ 風澤 +フウシュク 冨宿 +フウシュク 富宿 +フウタイ 風袋 +フウタガワ 風田川 +フウデン 風殿 +フウト 風戸 +フウト 風斗 +フウトウ 風当 +フウトウ 風藤 +フウトウ 風當 +フウドウ 楓堂 +フウノ 風野 +フウノ 風能 +フウノウ 風能 +フウラ 布浦 +フエ 笛 +フエ 父恵 +ブエ 武衛(武衞) +フエイ 笛井 +ブエイ 武衛(武衞) +フエオカ 笛岡 +フエカワ 笛川 +フエキ 笛木 +フエキ 殖木 +フエキ 布益 +フエクリ 殖栗 +フエグリ 殖栗 +フエサカ 笛坂 +フエシ 笛至 +フエタ 笛田 +フエタ 殖田 +フエダ 笛田 +フエダ 布江田 +フエトウ 不破勝 +フエノ 府栄野 +フエノ 笛野 +フエノ 府榮野 +フエノト 笛野戸 +フエバ 笛場 +フエモト 笛本 +フオカ 府岡 +フカ 富家 +フカ 冨家 +フカ 深 +フガ 府賀 +フカイ 深井 +フカイ 深居 +フカイ 桴海 +ブガイ 武鎧 +フカイケ 深池 +フカイザワ 深井沢 +フカイザワ 深井澤 +フカイシ 深石 +フカウチ 深内 +フカウミ 深海 +フカウメ 深梅 +フカウラ 深浦 +フカエ 深江 +フカオ 深尾 +フカオウ 深応 +フカオウ 深應 +フカオカ 深岡 +フカオク 深奥 +フカガイ 深谷 +フカガイ 深貝 +フカガキ 深垣 +フカガサコ 深ケ迫 +フカガタ 深潟 +フカガヤ 深萱 +フカガワ 深川 +フカガワ 深河 +フカガワダニ 深川谷 +フカキ 深木 +フカキ 深来(深來) +フカキ 深城 +フカキ 深喜 +フカキ 深耒 +フカギ 深来(深來) +フカギ 深城 +フカクサ 深草 +フカクサ 深艸 +フカグサ 深草 +フカグサ 深艸 +フカクシ 深串 +フカグチ 深口 +フカグチ 鱶口 +フカクラ 深蔵 +フカクラ 深倉 +フカクラ 深藏 +フカゲ 深毛 +フカサ 深佐 +フガサ 否笠 +フガサ 不笠 +フカサカ 深坂 +フカサカ 深阪 +フカサキ 深崎 +フカザキ 深崎 +フカサク 深作 +フカサコ 深迫 +フカサワ 深沢 +フカサワ 深澤 +フカザワ 深沢 +フカザワ 深澤 +フカサワグチ 深沢口(深澤口) +フカシ 深志 +フカジ 深治 +フカジ 深地 +フカシバ 深芝 +フカシマ 深島 +フカシマ 深嶋 +フカジマ 深島 +フカジマ 深嶋 +フカシロ 深代 +フカス 深須 +フカス 深栖 +フカス 冨加須 +フカスキ 深耕 +フカスギ 深杉 +フカズミ 深栖 +フカセ 深瀬 +フカセコ 深迫 +フカセコ 深世古 +フカタ 深田 +フカダ 深田 +ブカタ 武像 +フカダイ 深代 +フカタキ 深滝 +フカタキ 深瀧 +フカタニ 深谷 +フカタミ 深民 +フカツ 深津 +フカツ 武津 +フカツ 冨加津 +フカツ 深柄 +フカツ 普勝 +フカツ 深抦 +フカツ 富加津 +フカヅ 深津 +フカヅ 冨加津 +フカデ 深出 +フカト 深戸 +フカド 深戸 +フカドウ 深道 +フカドオリ 深通 +フカトシ 深利 +フカトシ 深年 +フカナ 深名 +フカニシ 深西 +フカヌマ 深沼 +フカネ 深根 +フガネ 府金 +フガネ 符金 +フカノ 深野 +フカノキ 深野木 +フカノキ 深ノ木 +フカノギ 深野木 +フカハタ 深畑 +フカバヤシ 深林 +フカハラ 深原 +フカハラ 布花原 +フカヒ 深日 +フカヒラ 深平 +フカブチ 深渕 +フカベ 深部 +フカベ 深辺 +フカホド 深程 +フカホリ 深堀 +フカホリ 深掘 +フカボリ 深堀 +フカマ 深間 +フカマウチ 深間内 +フカマキ 深牧 +フカマス 深増 +フカマチ 深町 +フカマツ 深松 +フカミ 深見 +フカミ 深水 +フカミ 深海 +フカミ 深美 +フカミ 冨賀見 +フカミ 富加見 +フカミ 深味 +フカミ 冨加見 +フカミ 富賀見 +フカミ 冨加美 +フカミ 不可三 +フカミ 富加美 +フカミ 深親 +フガミ 普神 +フガミ 府上 +フカミズ 深水 +フカミゾ 深溝 +フカミチ 深道 +フカミチ 深通 +フカミツ 深光 +フカミドリ 深緑 +フカミナト 深港 +フカミヤ 深宮 +フカムラ 深村 +フカモチ 深持 +フカモト 深本 +フカモト 深元 +フカモリ 深森 +フカヤ 深谷 +フカヤ 冨谷 +フカヤ 深屋 +フカヤ 深家 +フカヤ 布河谷 +フカヤガワ 深谷川 +フカヤブ 深薮 +フカヤブ 深籔 +フカヤブ 深藪 +フカヤマ 深山 +フカヨ 深代 +フカヨシ 深吉 +フカワ 深川 +フカワ 布川 +フカワ 富川 +フカワ 府川 +フカワ 冨川 +フカワ 普川 +フカワ 扶川 +フカワ 深和 +フカワ 符川 +フカワ 不川 +フカワ 婦川 +フガワ 府川 +フガワ 苻川 +ブカワ 武川 +ブカワ 部川 +フカワタセ 深渡瀬 +フカワタリ 深渡 +フキ 婦木 +フキ 蕗 +フキ 布木 +フキ 府木 +フキ 普喜 +フキ 富貴 +フキ 冨貴 +フキ 吹気(吹氣) +フキ 吹 +フキ 不喜 +フキ 冨喜 +フキ 冨気(冨氣) +フギ 不木 +フキアケ 吹明 +フキアゲ 吹上 +フキアゲ 吹揚 +フキアゲ 吹挙(吹擧) +フキイ 吹井 +フキイ 蕗井 +フキイ 冨貴井 +フキイシ 吹石 +フキイシ 葺石 +フキウラ 吹浦 +フキエ 吹江 +フキガイ 吹貝 +フキガサコ 吹ケ迫 +フキガミ 吹上 +フキガミ 蕗上 +フキコシ 吹越 +フキサカ 吹坂 +フキザキ 柊崎 +フキサコ 柊迫 +フキサコ 福貴迫 +フキザコ 福貴迫 +フキザコ 吹迫 +フキサワ 吹沢 +フキサワ 吹澤 +フキサワ 富貴沢 +フキサワ 冨貴沢 +フキサワ 冨貴澤 +フキサワ 冨貴澤 +フキサワ 富貴澤 +フキザワ 吹沢 +フキザワ 吹澤 +フキザワ 蕗沢 +フキザワ 冨貴沢 +フキザワ 冨貴澤 +フキザワ 蕗澤 +フキシマ 福貴島 +フキシマ 冨貴島 +フキジマ 福貴島 +フキソ 吹曽 +フキタ 吹田 +フキタ 冨木田 +フキタ 柊田 +フキタ 冨貴田 +フキタ 福貴田 +フキタ 蕗田 +フキタ 富貴田 +フキタ 福喜田 +フキダ 吹田 +フキダ 柊田 +フキタニ 吹谷 +フキタニ 蕗谷 +フキチ 吹地 +フキツカ 冨貴塚 +フキツカ 富貴塚 +フキヅカ 冨貴塚 +フキツケ 吹付 +フキツケ 吹附 +フキツケ 付附 +フキデ 吹出 +フキト 吹戸 +フキトウ 吹藤 +フキトミ 吹冨 +フキドメ 吹留 +フキナカ 吹中 +フキヌキ 吹抜 +フキノ 吹野 +フキノ 生城山 +フキノ 蕗野 +フキノ 柊野 +フキノト 吹ノ戸 +フキバ 吹場 +フキハタ 吹畠 +フキハラ 吹原 +フキハラ 蕗原 +フキハラ 柊原 +フキハラ 富貴原(冨貴原) +フキハル 吹春 +フキモト 吹本 +フキモト 柊元 +フキモト 吹元 +フキモト 葺本 +フキモト 冨貴本 +フキヤ 吹谷 +フキヤ 蕗谷 +フキヤ 吹屋 +フキヤ 吹矢 +フキヤ 葺屋 +フキヤマ 柊山 +フキヤマ 吹山 +フキョウ 不京 +フキヨセ 吹寄 +フキワケ 吹訳 +フキワケ 吹譯 +フキン 布金 +フキンバラ 冨金原 +フキンバラ 吹金原 +フキンバラ 富金原 +フク 福 +フク 富久 +フクアキ 福明 +フクアミ 福網 +フクアリ 福有 +フクイ 福井 +フクイ 福居 +フクイ 福飯 +フクイ 副井 +フクイ 福意 +フクイ 復井 +フクイ 服井 +フクイ 福伊 +フクイエ 福家 +フクイケ 福池 +フクイシ 福石 +フクイズミ 福泉 +フクイダ 福井田 +フクイダニ 福井谷 +フクイチ 福市 +フクイチ 福一 +フクイモ 福芋 +フクイヤ 福井谷 +フクイリ 福入 +フクイワ 福岩 +ブクイワ 伏岩 +フクウエ 福上 +フクウチ 福内 +フクウミ 福海 +フクウラ 福浦 +フクエ 福江 +フクエ 福栄 +フクエ 福恵(福惠) +フクエ 福榮 +フクエ 福衛 +フクエイ 福榮 +フクエダ 福枝 +フクエン 福円 +フクエン 福圓 +フクオ 福尾 +フクオ 福生 +フクオ 冨久尾 +フクオ 福雄 +フクオ 富久尾 +フクオイ 福負 +フクオウ 福王 +フクオウ 福応 +フクオウ 福應 +フクオウジ 福王寺 +フクオウジ 福王子 +フクオカ 福岡 +フクオカ 福岳 +フクオカ 腹岡 +フクオカ 服岡 +フクオカ 福丘 +フクオカヤ 福岡屋 +フクオドリ 福躍 +フクカ 福加 +フクガ 福賀 +フクカイ 福海 +フクガイ 福貝 +フクガイチ 福垣内 +フクガウチ 福垣内 +フクガキ 福垣 +フクガキウチ 福垣内 +フクカゲ 福景 +フクガサキ 福ケ崎 +フクガサコ 福ケ迫 +フクカゼ 吹風 +フクガタ 福形 +フクカド 福門 +フクガノ 福ケ野 +フクカマ 福鎌 +フクガマ 福釜 +フクガミ 福上 +フクガミ 福神 +フクカメ 福亀 +フクカワ 福川 +フクカワ 福河 +フクカワ 冨久川 +フクガワ 福川 +フクガワラ 福川原 +フクキ 福木 +フクキ 福貴 +フクキ 福喜 +フクギ 福木 +フクギ 福城 +フクキタ 福喜多 +フクキタ 福北 +フクギタ 福来 +フクキヤ 福木屋 +フクキュウ 福久 +フクキヨ 福清 +フククサ 福草 +フクグチ 福口 +フクグチヤマ 福口山 +フククラ 福倉 +フククラ 福蔵 +フクケイ 福慶 +フクゲン 福元 +フクゴウ 福郷 +フクコシ 福越 +フクゴシ 福越 +フクゴモリ 福籠 +フクゴモリ 福篭 +フクサ 福佐 +フクザ 福座 +フクサカ 福坂 +フクサカ 福阪 +フクサキ 福崎 +フクサキ 福嵜 +フクザキ 福崎 +フクザキ 福嵜 +フクザキ 服崎 +フクサク 福迫 +フクサクラ 福桜(福櫻) +フクザクラ 福桜(福櫻) +フクサコ 福迫 +フクザコ 福迫 +フクサダ 福定 +フクサダ 福貞 +フクサト 福里 +フクサト 譜久里 +フクザト 福里 +フクザト 譜久里 +フクザト 普久里 +フクサワ 福沢 +フクサワ 福澤 +フクザワ 福沢 +フクザワ 福澤 +フクシ 福士 +フクシ 福司 +フクシ 福止 +フクジ 福地 +フクジ 福治 +フクジ 福路 +フクジ 福字 +フクシカ 福鹿 +フクシゲ 福重 +フクシゲ 福繁 +フクシタ 福下 +フクシナ 福品 +フクシバ 福芝 +フクシマ 福島 +フクシマ 副島 +フクシマ 福嶋 +フクシマ 福嶌 +フクシマ 譜久島 +フクシマ 服島 +フクジマ 福島 +フクシマヤ 福島屋 +フクシヤマ 福司山 +フクジュ 福寿 +フクジュ 福壽 +フクジュ 福聚 +フクシュウ 福集 +フクジュウ 福重 +フクシュク 福宿 +フクジュヤ 福寿谷 +フクショ 福所 +フクショウ 福生 +フクショウ 福正 +フクショウ 福庄 +フクジョウ 福条 +フクジョウ 福條 +フクジョウ 福状 +フクジョウジ 福成寺 +フクシロ 福代 +フクシロ 福城 +フクシン 福新 +フクジン 福神 +フクジンヤ 福神屋 +フクスエ 福末 +フクスガ 福菅 +フクスミ 福角 +フクスミ 福隅 +フクスミ 福炭 +フクズミ 福住 +フクズミ 福泉 +フクズミ 福角 +フクズミ 福積 +フクズミ 福澄 +フクズミ 福隅 +フクズミ 吹角 +フクズミ 副住 +フクセ 福世 +フクセ 福瀬 +フクセ 福勢 +フクセ 富久世 +フクセ 冨久世 +フクセコ 福迫 +フクセン 福泉 +フクゼン 福善 +フクゾウ 福造 +フクゾエ 福添 +フクゾノ 福園 +フクゾノ 福薗 +フクゾノ 福囿 +フクタ 福田 +フクタ 福多 +フクタ 服多 +フクタ 福夛 +フクダ 福田 +フクダ 副田 +フクダ 服田 +フクダ 福多 +フクダ 富久田 +フクダ 服多 +フクダイラ 福平 +フクタカ 福高 +フクダガワ 福田川 +フクタキ 福滝 +フクタキ 福瀧 +フクタケ 福武 +フクタケ 福竹 +フクダテ 福館 +フクダテ 福舘 +フクタニ 福谷 +フクタニ 福渓(福溪) +フクダマ 福玉 +フクダメ 福溜 +フクダヤ 福田谷 +フクダヤ 福田屋 +フクタン 福丹 +フクチ 福地 +フクチ 福池 +フクチ 福知 +フクチ 福智 +フクチ 覆地 +フクチイン 福智院 +フクチモト 福地本 +フクチヤマ 福智山 +フクツ 福津 +フクツカ 福塚 +フクヅカ 福塚 +フクツギ 福次 +フクヅキ 福月 +フクツジ 福辻 +フクツナ 福綱 +フクツボ 福坪 +フクヅミ 福積 +フクテ 福手 +フクテラ 福寺 +フクデラ 福寺 +フクデン 福伝 +フクデン 福傅 +フクデン 福傳 +フクデンジ 福田寺 +フクト 福戸 +フクド 福土 +フクド 福戸 +フクトウ 服藤 +フクトウ 福藤 +フクトウ 福東 +フクトウ 福當 +フクトウ 福当 +フクトウ 福籐 +フクドウ 福堂 +フクトク 福徳 +フクトシ 福歳 +フクドノ 福殿 +フクドマリ 福泊 +フクトミ 福富 +フクトミ 福冨 +フクドミ 福富 +フクドミ 福冨 +フクトメ 福留 +フクトメ 福富 +フクドメ 福留 +フクトモ 福友 +フクトヤマ 福戸山 +フクトヨ 福豊 +フクトリ 福取 +フクナ 福名 +フクナカ 福中 +フクナカ 福仲 +フクナガ 福永 +フクナガ 福長 +フクナガ 冨久長 +フクナベ 福辺(福邊) +フクナベ 福邉 +フクナミ 福波 +フクナミ 福浪 +フクナミ 福並 +フクナリ 福成 +フクニシ 福西 +フクニワ 福庭 +フクネ 福根 +フクノ 福野 +フクノ 福納 +フクノ 副野 +フクノ 福埜 +フクノ 服野 +フクノウ 福納 +フクノウエ 福之上 +フクノウエ 福ノ上 +フクノエ 福之江 +フクノベ 福辺(福邊) +フクノベ 福延 +フクハ 福羽 +フクバ 福場 +フクバ 福庭 +フクバ 福波 +フクバ 福羽 +フクバ 福葉 +フクハシ 福橋 +フクハタ 福畑 +フクハタ 福畠 +フクバタケ 福畠 +フクハマ 福浜 +フクハマ 福濱 +フクバヤシ 福林 +フクハラ 福原 +フクハラ 普久原 +フクハラ 譜久原 +フクハラ 福服 +フクハラ 服原 +フクバラ 福原 +フクハル 福春 +フクヒサ 福久 +フクヒラ 福平 +フクヒロ 福広 +フクヒロ 福廣 +フクブクロ 福袋 +フクフジ 福藤 +フクベ 福部 +フクベ 福辺(福邊) +フクベ 瓢 +フクベ 服平 +フクベ 腹部 +フクベ 福邉 +フクベップ 福別府 +フクホ 福保 +フクボ 布久保 +フクボ 福母 +フクホリ 福堀 +フクホリ 福掘 +フクボリ 福堀 +フクマ 福間 +フクマ 福馬 +フクマ 福真 +フクマ 副馬 +フクマ 福眞 +フクマ 福摩 +フクマ 普久間 +フクマエ 福前 +フクマキ 服巻 +フクマキ 福巻 +フクマサ 福政 +フクマサ 福正 +フクマシ 福増 +フクマス 福増 +フクマス 福桝 +フクマス 福益 +フクマス 福舛 +フクマス 福升 +フクマス 福枡 +フクマス 富久増 +フクマス 冨久増 +フクマタ 福俣 +フクマツ 福松 +フクマル 福丸 +フクマル 福圓 +フクマルヤ 福丸屋 +フクマン 福万 +フクマン 副万 +フクミ 福見 +フクミ 福海 +フクミ 福味 +フクミ 福美 +フクミ 副見 +フクミズ 福水 +フクミゾ 福溝 +フクミタ 福三田 +フクミツ 福光 +フクミツ 福満 +フクミツ 復光 +フクミツ 含満 +フクミツ 福滿 +フクミツ 福充 +フクミネ 福嶺 +フクミネ 譜久嶺 +フクミネ 福峯 +フクミネ 普久嶺 +フクミネ 福峰 +フクミヤ 福宮 +フクミョウ 福明 +フクムラ 福村 +フクムラ 譜久村 +フクムラ 福邑 +フクムラ 服村 +フクムロ 福室 +フクメ 福目 +フクメイ 福明 +フクメン 服免 +フクモ 福母 +フクモ 福毛 +フクモ 福面 +フクモチ 福持 +フクモト 福本 +フクモト 福元 +フクモト 復本 +フクモト 含本 +フクモト 諸久元 +フクモト 譜久元 +フクモト 服本 +フクモト 普久本 +フクモリ 福森 +フクモリ 福盛 +フクモリ 福守 +フクモリ 譜久盛 +フクモリタ 福盛田 +フクヤ 福谷 +フクヤ 福家 +フクヤ 福屋 +フクヤ 福矢 +フクヤ 福舎 +フクヤス 福安 +フクヤド 福宿 +フクヤブ 福薮 +フクヤブ 福籔 +フクヤマ 福山 +フクヤマ 譜久山 +フクヤマ 二久山 +フクヤマ 服山 +フクヤマ 冨久山 +フクヤマ 普久山 +フクユ 福湯 +フクユウ 福祐 +フクヨ 福代 +フクヨ 福与 +フクヨ 福世 +フクヨ 福與 +フクヨ 福興 +フクヨ 福予 +フクヨ 福輿 +フクヨ 福豫 +フクヨウ 福用 +フクヨシ 福吉 +フクヨシ 福良 +フクヨシ 福好 +フクヨシ 福芳 +フクヨシ 福由 +フクヨネ 福米 +フクヨリ 福頼 +フクヨリ 福寄 +フクヨリ 福依 +フクラ 福良 +フクラ 福羅 +フクラ 吹浦 +フクラ 福楽 +フクラ 袋良 +フクラ 布倉 +ブクラ 分倉 +フクライ 福来 +フクライ 福來 +フクラトウゲ 福良峠 +フクリ 福里 +フクリ 譜久里 +フクリ 福利 +フクリキ 福力 +フクロ 袋 +フクロ 福呂 +フクロイ 袋井 +フクロエ 袋江 +フクロク 福禄 +フクロク 福録 +フクログチ 袋口 +フクロザキ 袋崎 +フクロジ 袋路 +フクロジリ 袋尻 +フクロズミ 袋住 +フクロセ 袋瀬 +フクロダ 袋田 +フクロダテ 袋舘 +フクロタニ 袋谷 +フクロダニ 袋谷 +フクロチ 袋地 +フクロノ 袋野 +フクロハタ 袋畑 +フクロハタ 袋畠 +フクロベ 袋辺 +フクロモト 袋本 +フクロヤ 袋谷 +フクロヤ 袋屋 +フクロヤマ 袋山 +フクワ 福和 +フクワカ 福若 +フクワキ 福脇 +フクワケ 福分 +フクワダ 福和田 +フクワタリ 福渡 +フケ 福家 +フケ 富家 +フケ 冨家 +フケ 冨宅 +フケ 浮気 +フケ 泓 +フケ 普家 +フケ 浮池 +フケ 富宅 +フケ 布家 +フケ 吹ケ +フケイ 吹毛井 +フケイ 更居 +フケイ 不計 +フケイ 富計 +ブケオ 武家尾 +フケガミ 泓上 +フケガワ 泓川 +フゲシ 鳳気至 +フゲシ 鳳至 +フケタ 更田 +フケタ 泓田 +フケダ 更田 +フケダ 泓田 +フケダ 吹ケ田 +フケダ 湗田 +フケダ 澍田 +フケノ 泓野 +フケハラ 更原 +フケハラ 泓原 +フケバル 布花原 +フケモト 泓本 +フケン 普見 +フゲン 普賢 +フゲン 普現 +フゲンジ 普賢寺 +フゴ 不後 +フゴ 府後 +フゴ 普後 +フコウ 普光 +フゴウ 富居 +フゴウ 冨居 +ブコウ 武孝 +ブゴウ 武郷 +フコウイン 普光院 +フコウエ 普光江 +フコウジョウ 普光上 +フコウズ 深水 +フコウノ 深野 +フコサ 不虚作 +フコシ 不越 +フゴシ 府越 +フゴタ 畚田 +フゴタニ 畚谷 +フゴノ 畚野 +フサ 房 +フサ 芳 +フサ 布佐 +フサ 富佐 +ブサ 武佐 +フサウチ 房内 +フサエダ 房枝 +フサオ 房尾 +フサオカ 房岡 +フサカ 符阪 +フサカ 苻阪 +フサカ 符坂 +フサカ 苻坂 +ブサカ 武坂 +フサガキ 房垣 +フサカワ 房川 +フサガワ 房川 +フサキ 房木 +フザキ 妖崎 +フザキ 妋崎 +フササキ 房前 +フサザキ 房前 +フサザキ 房崎 +フサザキ 総崎 +フサザキ 總崎 +フサダ 房田 +フサダ 英田 +フサタテ 房立 +フサダテ 房立 +フサタニ 房谷 +フサツネ 房常 +フサト 冨里 +フサト 富里 +フサトガワ 冨里川 +フサトミ 房富 +フサトモ 房友 +フサナガ 房永 +フサノ 房野 +フサノブ 房延 +フサノボリ 房登 +フサバヤシ 房林 +フサハラ 房原 +フサマ 房間 +フサマエ 房前 +フサマツ 房松 +フサミツ 房光 +フサムネ 房宗 +フサムラ 房村 +フサモト 房本 +フサヤ 房家 +フサヤス 房安 +フサヤマ 総山 +フサヤマ 房山 +フサヤマ 總山 +フサワ 布沢 +フザワ 布沢 +フザワ 布澤 +フザワ 麸沢 +フザワ 麸澤 +フザワ 麩沢 +フザワ 麩澤 +ブザワ 武沢 +ブザワ 武澤 +フシ 布柴 +フシ 節 +フシ 伏 +フシ 布士 +フジ 藤 +フジ 冨士 +フジ 富士 +フジ 不二 +フジ 冨子 +フジ 婦士 +フジ 富路 +フジ 冨司 +フジ 冨路 +フジアキ 藤明 +フジアラ 藤荒 +フシイ 伏井 +フシイ 伏居 +フジイ 藤井 +フジイ 藤居 +フジイ 葛井 +フジイ 冨士井 +フジイ 富士井 +フジイ 藤猪 +フジイ 藤飯 +フジイ 藤伊 +フジイ 不二井 +フジイ 藤位 +フジイ 富士居 +フジイ 冨士居 +フジイ 藤ヰ +フジイ 藤懿 +フジイ 不二葦 +フジイエ 藤家 +フジイキ 藤域 +フジイケ 藤池 +フジイケ 冨士池 +フジイケ 富士池 +フジイシ 藤石 +フジイタ 藤板 +フジイタ 藤井田 +フジイダ 藤井田 +フジイモト 藤井本 +フジイヤマ 藤井山 +フジイワ 藤岩 +フジウ 藤生 +フジウ 藤宇 +フジウ 藤栩 +フジウエ 藤上 +フジウエ 藤植 +フジウチ 藤内 +フジウネ 藤畝 +フシウラ 伏浦 +フジウラ 藤浦 +フジウラ 藤裏 +フシエ 伏江 +フジエ 藤江 +フジエ 藤枝 +フジエ 藤栄 +フジエ 藤恵 +フジエ 富士栄(富士榮) +フジエ 冨士栄 +フジエ 藤榎 +フジエ 藤会 +フジエ 藤榮 +フジエ 藤絵 +フジエ 藤會 +フジエ 藤惠 +フジエ 藤朶 +フジエキ 藤浴 +フジエダ 藤枝 +フジエダ 藤條 +フジエダ 冨士枝 +フジエダ 富士枝 +フシオ 伏尾 +フジオ 藤尾 +フジオ 藤生 +フジオ 藤雄 +フジオ 藤隠 +フジオ 冨士尾 +フジオ 富士尾 +フジオ 籐尾 +フジオイ 藤生 +フジオウ 藤王 +フジオオジ 藤大路 +フシオカ 伏岡 +フジオカ 藤岡 +フジオカ 富士岡 +フジオカ 藤丘 +フジオカ 冨士岡 +フジオカ 藤岳 +フジオカ 藤陵 +フジオキ 藤沖 +フジオギ 藤雄木 +フジオト 藤音 +フジカ 藤家 +フジカ 藤賀 +フジカ 藤香 +フジガ 藤賀 +ブシカ 武鹿 +フジカイ 藤貝 +ブシガイト 武士垣外 +フジガエ 藤ケ枝 +フジカキ 藤垣 +フジガキ 藤垣 +フジカケ 藤掛 +フジカケ 藤懸 +フジカケ 藤欠 +フジカゲ 藤景 +フジカゲ 富士蔭 +フジカゲ 冨士蔭 +フジカサ 藤笠 +フジガサキ 藤ケ崎(藤ケ嵜) +フジカシ 藤樫 +フジカタ 藤方 +フジカタ 藤形 +フジカツ 藤勝 +フジカド 藤門 +フジカド 不二門 +フジカネ 藤曲 +フジカネ 藤兼 +フジカネ 藤金 +フジカネ 冨士金 +フジカブ 藤株 +フジカミ 藤上 +フジカミ 富士上 +フジガミ 藤上 +フジカメ 藤亀 +フジガメ 藤亀 +フジガモリ 藤ケ森 +フジガヤ 藤ケ谷 +フシカワ 伏川 +フジカワ 藤川 +フジカワ 藤河 +フジカワ 冨士川 +フジカワ 富士川 +フジカワ 不二川 +フジガワ 藤側 +フシキ 伏木 +フシキ 伏喜 +フシキ 布志木 +フシキ 節木 +フシギ 伏木 +フジキ 藤木 +フジキ 藤城 +フジキ 藤来 +フジキ 藤記 +フジキ 藤樹 +フジキ 冨士木 +フジキ 藤鬼 +フジキ 藤喜 +フジキ 不二樹 +フジキ 不二木 +フジキ 富士木 +フジギシ 藤岸 +フシキダ 伏木田 +フジキタ 藤北 +フシキノ 伏木野 +フジキワ 藤極 +フジギワ 藤極 +フジクス 藤楠 +フジグチ 藤口 +フジクニ 藤国(藤國) +フジクボ 藤久保 +フジクボ 藤窪 +フジクマ 藤熊 +フジクラ 藤倉 +フジクラ 藤蔵 +フジクラ 富士庫 +フジクラ 扶滋倉 +フシグリ 伏栗 +フシクロ 伏黒 +フシグロ 伏黒 +フジクロ 藤黒 +フジケ 藤家 +フジコ 藤古 +フジコ 藤子 +フジゴ 藤後 +フジコウゲ 藤河家 +フジゴエ 藤肥 +フジコシ 藤越 +フジコシ 富士越 +フジコシ 冨士越 +フジコソ 藤社 +フジザ 藤座 +フジサイ 藤斎 +フジサイ 藤斉 +フジサイ 藤齊 +フジサオ 藤竿 +フジサカ 藤坂 +フジサカ 藤阪 +フジサカ 富士坂 +フジサカ 冨士坂 +フシザキ 伏崎(伏嵜) +フジサキ 藤崎 +フジサキ 藤咲 +フジサキ 藤嵜 +フジサキ 冨士崎 +フジサキ 富士崎 +フジサキ 不二崎 +フジサキ 藤埼 +フジサキ 藤先 +フジザキ 藤崎 +フジサク 藤咲 +フジサク 藤作 +フジサコ 藤迫 +フジササ 藤笹 +フジサダ 藤定 +フジサダ 藤貞 +フシサト 伏里 +フジサト 藤里 +フジザネ 藤実 +フジザネ 藤實 +フジサワ 藤沢 +フジサワ 藤澤 +フジサワ 桾澤 +フジサワ 冨士澤 +フジサワ 冨士沢 +ブシザワ 武士沢 +ブシザワ 武士澤 +フジシ 藤士 +フジシ 藤支 +フジシカ 藤鹿 +フジシゲ 藤重 +フジシゲ 藤繁 +フシシタ 伏下 +フジシタ 藤下 +フジシナ 藤科 +フジシバ 藤柴 +フジシバ 藤芝 +フジシマ 藤島 +フジシマ 藤嶋 +フジシマ 藤嶌 +フジシマ 冨士島 +フジシャ 藤社 +フジシロ 藤代 +フジシロ 藤城 +フジシロ 藤白 +フジシロ 冨士代 +フジシロ 富士代 +フジシン 藤信 +フジシン 藤新 +フジスエ 藤末 +フジスエ 冨士末 +フジスエ 藤季 +フジスエ 藤裔 +フジスエ 富士末 +ブシスエ 武士末 +フシズカ 伏塚 +フジスナ 藤砂 +フジスミ 藤住 +フジスミ 藤角 +フジスミ 藤隅 +フジセ 藤生 +フジセ 藤瀬 +フジセ 富士瀬 +フジセ 藤世 +フジセ 冨士瀬 +フジセキ 藤関(藤關) +フジゼキ 藤関(藤關) +フジソ 藤曽 +フジソウ 藤宗 +フジソエ 藤添 +フジゾエ 藤添 +フジソノ 藤園 +フジゾノ 藤園 +フシタ 伏田 +フシタ 鮒子田 +フシタ 伏多 +フシタ 鮒子多 +フシダ 伏田 +フシダ 鮒子田 +フシダ 臥田 +フジタ 藤田 +フジタ 冨士田 +フジタ 富士田 +フジタ 藤多 +フジタ 潭田 +ブシタ 武士田 +ブシダ 武士田 +ブシダ 仏師田 +ブシダ 佛師田 +フジダイ 藤大 +フジダイ 富士大 +フジダイ 冨士大 +フジタカ 藤高 +フジタカ 藤鷹 +フジタカ 冨士鷹 +フジタカ 富士鷹 +フジタキ 藤滝 +フジタキ 藤瀧 +フジタケ 藤武 +フジタケ 藤竹 +フジタケ 藤嶽 +フジタケ 藤岳 +フジタチ 藤立 +フジタツ 藤達 +フジタテ 藤舘 +フジタテ 藤館 +フジタテ 藤立 +フジダテ 藤舘 +フジタナ 藤棚 +フシタニ 伏谷 +フジタニ 藤谷 +フジタニ 冨士谷 +フジタニ 富士谷 +フジタニ 藤渓 +フジタニ 富士渓 +フジタニ 藤溪 +フジタニ 富士湲 +フジタニ 富士溪 +フジタマ 藤玉 +フジタヤ 藤田屋 +フジチ 藤知 +フジチカ 藤近 +フシツ 伏津 +フジツ 藤津 +フシヅカ 伏塚 +フジツカ 藤塚 +フジツカ 藤墳 +フジツカ 藤束 +フジヅカ 藤塚 +フジツキ 藤槻 +フジツク 藤附 +フジツグ 藤次 +フジツグ 藤続 +フジツグ 藤嗣 +フジツグ 藤續 +フジツナ 藤綱 +フジツボ 藤坪 +フジツボ 藤壷 +フジツボ 藤壺 +フジツマ 藤妻 +フジヅメ 藤詰 +フジツル 藤敦 +フジツル 籐敦 +フジヅル 蔓 +フジデ 藤出 +フジテラ 藤寺 +フジト 藤戸 +フジト 藤門 +フジト 藤渡 +フジト 藤土 +フジト 不二門 +フジト 冨士登 +フジト 藤登 +フジト 藤都 +フジト 富士登 +フジトウ 藤東 +フジトウ 藤当 +フジドウ 藤堂 +フジトキ 藤時 +フジトビ 藤飛 +フジトミ 藤富 +フジトミ 藤冨 +フジトモ 藤友 +フジトモ 藤巴 +フジトリ 藤鳥 +フジナ 藤名 +フジナ 冨士名 +フジナイ 藤内 +フジナオ 藤直 +フシナカ 伏中 +フジナカ 藤中 +フジナカ 藤仲 +フジナカ 冨士中 +フジナガ 藤永 +フジナガ 藤長 +フジナガ 冨士永 +フジナガ 富士永 +フジナミ 藤波 +フジナミ 藤浪 +フジナミ 藤並 +フジナミ 藤涛 +フジナミ 藤濤 +フジナミ 富士波 +フジナリ 藤成 +フジナリ 冨士成 +フジナリ 富士成 +フジナワ 藤縄 +フジナワ 藤繩 +フジナワ 冨士縄 +フジナワ 富士繩(富士縄) +フジナワ 冨士繩 +フシニシ 伏西 +フジニシ 藤西 +フジニワ 藤庭 +フシヌキ 伏貫 +フジヌキ 藤貫 +フジヌキ 藤抜 +フジヌキ 藤樌 +フジヌシ 藤主 +フジヌマ 藤沼 +フシネ 伏根 +フジネ 藤根 +フジネ 冨士根 +フジネ 富士根 +フジネイ 藤根井 +フシノ 伏野 +フシノ 節野 +フシノ 椹野 +フジノ 藤野 +フジノ 冨士野 +フジノ 富士野 +フジノ 藤埜 +フジノ 藤乃 +フジノ 冨士埜 +フジノ 藤農 +フジノ 布路野 +フジノイ 藤ノ井 +フジノイ 藤野井 +フジノイ 藤乃井 +フジノウ 藤納 +フジノウジ 藤之氏 +フジノキ 藤ノ木 +フジノキ 藤野木 +フジノキ 藤の木 +フジノト 藤野戸 +フジノハラ 藤之原 +フジノハラ 藤野原 +フジノハラ 藤ノ原 +フジノハラ 藤埜原 +フシノブ 伏信 +フジノブ 藤信 +フジノブ 藤延 +フジノベ 藤延 +フジノマキ 藤乃巻 +フジノモト 藤野本 +フジノモリ 藤森 +フジノヤ 藤野屋 +フジノヤ 藤野谷 +フジノリ 藤範 +フジノリ 藤則 +フジノリ 藤法 +フシバ 伏葉 +フシバ 伏場 +フジハ 藤葉 +フジバ 藤場 +フジハシ 藤橋 +フジハタ 藤畑 +フジハタ 藤畠 +フジハタ 藤旗 +フジハタ 藤幡 +フジバタ 藤畑 +フジバタ 藤端 +フジハナ 藤花 +フジハマ 藤浜 +フジハマ 冨士浜 +フジハマ 藤濱 +フジハマ 富士浜 +フジハマ 冨士濱 +フジハヤシ 藤林 +フジバヤシ 藤林 +フジバヤシ 富治林 +フシハラ 伏原 +フシハラ 節原 +フシハラ 不死原 +フジハラ 藤原 +フジハラ 冨士原 +フジハラ 富士原 +フジハラ 不二原 +フジハラ 布志原 +フジハラ 藤葉良 +フジハラ 藤腹 +ブシハラ 武士原 +フシハル 伏春 +フジハル 藤春 +フジヒコ 藤彦 +フジヒサ 藤久 +フジヒデ 藤秀 +フシヒラ 伏平 +フジヒラ 藤平 +フジヒラ 富士平 +フジヒラ 冨士平 +フジヒロ 藤広 +フジヒロ 藤弘 +フジヒロ 藤廣 +フシフ 伏婦 +フジフチ 藤渕 +フジブチ 藤渕 +フジブチ 藤淵 +フジブチ 冨士渕 +フジフル 藤古 +フジベ 藤部 +フジベ 藤辺(藤邉) +フジベ 藤邊 +フシベナイ 伏部内 +フシマ 伏間 +フシマ 不島 +フシマ 不嶋 +フシマ 普嶋 +フジマ 藤間 +フジマ 藤馬 +フジマ 藤麻 +フジマ 藤真 +フシマエ 伏間江 +フジマエ 藤前 +フジマガリ 藤曲 +フジマキ 藤巻 +フジマキ 藤牧 +フジマキ 富士巻 +フジマキ 藤収 +フジマキ 藤卷 +フジマキ 藤纒 +フジマサ 藤政 +フジマサ 藤正 +フジマス 藤升 +フジマス 藤増 +フジマス 藤桝 +フジマス 藤枡 +フジマタ 藤又 +フジマタ 藤俣 +ブシマタ 武士俣 +ブシマタ 武志俣 +フジマツ 藤松 +フジマツ 冨士松 +フジマツ 富士松 +フジマル 藤丸 +フシミ 伏見 +フシミ 節見 +フジミ 藤見 +フジミ 富士見 +フジミ 藤海 +フジミ 藤実 +フジミ 藤身 +フジミ 冨士見 +フジミ 藤三 +フジミ 藤美 +フジミ 藤實 +フジミ 不二見 +フシミズ 伏水 +フジミズ 富士水 +フジミチ 富士道 +フジミチ 藤道 +フジミチ 藤通 +フジミチ 冨士道 +フジミツ 藤光 +フジミツ 藤満 +フジミツ 冨士光 +フジミネ 藤峰 +フジミネ 藤嶺 +フジミネ 藤峯 +フジミノ 藤箕 +フシミヤ 伏見谷 +フシミヤ 伏見屋 +フジミヤ 藤宮 +フジムコ 藤向 +フジムネ 藤宗 +フシムラ 伏村 +フジムラ 藤村 +フジムラ 藤邨 +フジムラ 冨士村 +フジムラ 藤邑 +フジムラ 富士村 +フジムロ 藤室 +フジメ 藤目 +フジメ 藤明 +フジメ 藤芽 +フジモ 藤茂 +フジモチ 富士持 +フシモト 伏本 +フジモト 藤本 +フジモト 藤元 +フジモト 藤下 +フジモト 冨士本 +フジモト 富士本 +フジモト 冨士元 +フジモト 藤基 +フジモト 富士元 +フジモト 藤茂登 +フジモト 扶持本 +フジモト 藤幹 +フジモト 藤源 +フジモト 藤夲 +フジモト 籐本 +フジモリ 藤森 +フジモリ 藤盛 +フジモリ 藤守 +フジモリ 冨士森 +フジモリ 富士盛 +フジモリ 冨士盛 +フジモリ 藤護 +フジモリ 富士森 +フジモン 藤門 +フシヤ 伏屋 +フシヤ 伏谷 +フジヤ 藤谷 +フジヤ 藤家 +フジヤ 藤屋 +フジヤ 冨士谷 +フジヤ 富士谷 +フジヤ 藤矢 +フジヤ 藤弥(藤彌) +フジヤ 富士屋 +フジヤ 冨士屋 +フジヤス 藤安 +フジヤス 藤保 +フジヤナギ 藤柳 +フジヤブ 藤薮 +フジヤブ 藤藪 +フジヤブ 藤籔 +フシヤマ 伏山 +フジヤマ 藤山 +フジヤマ 不二山 +フジヤマ 冨士山 +フジヤマ 富士山 +フジュウ 藤生 +フジユキ 藤幸 +フジユキ 藤行 +フシュク 冨宿 +フシュク 富宿 +フショ 冨所 +フショウ 普照 +フショウ 富生 +ブジョウ 武城 +フジヨシ 藤吉 +フジヨシ 藤好 +フジヨシ 藤由 +フジヨシ 藤芳 +フジヨシ 藤善 +フジヨシ 藤義 +フジライ 藤来 +フジライ 藤來 +フシロ 伏代 +フジロク 藤六 +フジロク 藤録 +フジワ 藤輪 +フジワ 藤和 +フジワ 冨士和 +フジワ 富士和 +フジワカ 藤若 +フシワキ 伏脇 +フジワキ 藤脇 +フジワケ 藤分 +フジワタリ 藤渡 +フジワラ 藤原 +フジワラ 冨士原 +フジワラ 富士原 +フジワラ 藤藁 +フジワラ 不二原 +フジワラ 不死原 +フジワラ 籐原 +ブズ 武図 +フスキ 福宿 +フスク 賦句 +フスク 賦勺 +ブスジマ 毒島 +ブスジマ 毒嶋 +ブスジマ 毒嶌 +フスマ 伏間 +フスマエ 伏間江 +フスマダ 襖田 +フスミ 布角 +フセ 布施 +フセ 布瀬 +フセ 富施 +フセ 布勢 +フセ 扶瀬 +フセ 普世 +フセ 不施 +フセイシ 伏石 +フセイン 布施院 +フセカワ 布施川 +フセカワ 伏川 +フセガワ 布施川 +フセガワ 布瀬川 +フセガワ 伏川 +フセガワ 府瀬川 +フセキ 伏木 +フセキ 布施木 +フセギ 伏木 +フセギ 布施木 +フセギ 防木 +フセギ 防 +ブセキ 武関 +フセジマ 伏島 +フセジマ 伏嶋 +フセダ 伏田 +フセダ 布施田 +フセタニ 伏谷 +フセタニ 布施谷 +フセノ 伏野 +フセノ 布施野 +フセヤ 伏屋 +フセヤ 伏谷 +フセヤ 布施谷 +フセヤ 布瀬谷 +フセヤ 布施屋 +フセン 賦船 +フセン 賦舩 +フソ 扶蘓 +フソウ 扶蘇 +ブソウ 武曽 +ブゾウジマ 武蔵島 +フソコ 冨底 +フタ 布田 +フタ 府田 +フタ 蓋 +フダ 布田 +フダ 札 +フダ 府田 +フダ 不田 +フダ 歩田 +フダ 符田 +フタアナ 二穴 +フタイ 二井 +フタイ 不退 +フダイ 布台(布臺) +フダイ 夫代 +フダイ 普代 +ブタイ 舞台 +フタイシ 二石 +フタイワ 二岩 +フダウチ 札内 +フタウラ 二浦 +フタエ 二重 +フタエサク 二重作 +フタエダ 二枝 +フタエタニ 二重谷 +フタエダニ 二重谷 +フタオ 二尾 +フタオカ 二岡 +フダオカ 札岡 +フタオモテ 二面 +フタカ 府高 +フダカ 府高 +フタガキ 二柿 +フタカタ 二方 +フタカタ 二片 +ブタカタ 豊田方 +フタカド 二角 +フタカブ 二株 +フタカミ 二神 +フタカミ 二上 +フタガミ 二神 +フタガミ 二上 +フタカワ 二川 +フタカワ 双川 +フタガワ 二川 +フタガワ 双川 +フタガワ 風田川 +フタガワ 二タ川 +フタガワ 二夕川 +フタガワ 布田川 +フダカワ 札川 +フダガワ 札川 +フタカワメ 二川目 +フタキ 二木 +フタギ 二木 +フダキ 札木 +フタク 二九 +フタクシ 二串 +フタクチ 二口 +フタグチ 二口 +フタクチヤ 二口谷 +フタグリ 二栗 +フタゴ 二子 +フタゴイシ 二子石 +フタコシ 二越 +フタシマ 二島 +フタシマ 二嶋 +フタジマ 二島 +フタジマ 二嶋 +フタシロ 双城 +フタシロ 双代 +フタスギ 二杉 +フタスギ 二椙 +フタセ 二瀬 +フタセガワ 二瀬川 +フタタ 二田 +フタダ 二田 +フダタテ 札立 +フタタニ 二谷 +フダタニ 札谷 +フタツ 二津 +ブタツ 武立 +フタツイ 二井 +フタツイ 二ツ井 +フタツイケ 二ツ池 +フタツイシ 二石 +フタツイシ 二ツ石 +フタツカ 二塚 +フタヅカ 二塚 +フタツカミ 二ツ神 +フタツガミ 二ツ神 +フタツガメ 二ツ亀 +フタツカワ 二川 +フタツカワ 二ツ川 +フタツガワ 二川 +フタツガワ 二ツ川 +フタツキ 二木 +フタツキ 二ツ木 +フタツキ 二タ月 +フタツキ 弐月 +フタツギ 二木 +フタツギ 二ツ木 +フタツギ 二ツ城 +フタツギ 二次 +フタツサコ 二ツ迫 +フダツジ 札辻 +フタツデラ 二ツ寺 +フタツノ 二ツ野 +フタツハシ 二ツ橋 +フタツバシ 二橋 +フタツバシ 二ツ橋 +フタツボ 二坪 +フタツマタ 二俣 +フタツマチ 二ツ町 +フタツモリ 二ツ森 +フタツヤ 二谷 +フタツヤ 二ツ谷 +フタツヤ 二ツ矢 +フタツヤ 二家 +フタツヤ 二ツ屋 +フタツヤ 二ツ家 +フタツヤ 二っ家 +フタツヤ 二津谷 +フタツヤナギ 二ツ柳 +フタツヤマ 二山 +フタツヤマ 二ツ山 +フダドウ 札堂 +フタナ 二名 +フタナガ 二永 +フタナミ 二浪 +フタニ 麸谷 +フタニ 麩谷 +ブタニ 蒲谷 +ブタニ 部谷 +フダヌキ 札抜 +フタノ 二野 +フダノ 札野 +フダノ 札埜 +フダノウチ 札ノ内 +フダノキ 札ノ木 +フダノキ 札軒 +フダノツジ 札ノ辻 +フタバ 二葉 +フタバ 二羽 +フタバ 二場 +フタバ 二馬 +フタバ 嫩 +フタバ 双葉 +フダバ 札場 +フダバ 札葉 +フダバ 札塲 +フタハシ 二橋 +フタハシ 二階 +フタハシラ 二柱 +フタハタ 二幡 +フタバタケ 二畑 +フタバタケ 二畠 +フタバヤシ 二林 +フダハラ 布田原 +フタホシ 二星 +フタボシ 二星 +フタマ 二馬 +フタマ 二間 +フタマセ 二間瀬 +フタマタ 二俣 +フタマタ 二又 +フタマタ 二股 +フタマタ 弐又 +フタマタ 貳又 +フタマタ 二叉 +フタマタ 二亦 +フタマタ 貮又 +フタマタ 二俟 +フタマタガワ 二又川 +フタマタガワ 二叉川 +フタマチ 二町 +フタマツ 二松 +フタマツ 双松 +フタマド 二間戸 +フタマド 二窓 +フタミ 二見 +フタミ 二タ見(タはカタカナ) +フタミ 二夕見(夕は漢字) +フタミ 二味 +フタミ 双見 +フタミ 二三 +フタミタニ 二見谷 +フタミダニ 二見谷 +フタミヤ 二宮 +フタミヤ 二見谷 +フタミヤ 二見屋 +フタムラ 二村 +フタムラ 二タ村 +フタムレ 二牟礼 +フタムレ 二牟禮 +フタメ 二目 +フタモト 二本 +フタモト 二元 +フタモト 二基 +フダモト 札本 +フダモト 札元 +フタモリ 二森 +フタモリ 蓋盛 +フタモリ 双森 +フタヤ 二谷 +フタヤ 二家 +フタヤ 二矢 +フタヤブ 二薮 +フタヤマ 二山 +フタヤマ 双山 +フダヤマ 札山 +フダユキ 札雪 +フタラ 二荒 +フタワカ 二若 +フダワキ 札脇 +フタワタリ 二渡 +フダン 不断 +フチ 渕 +フチ 淵 +フチ 泓 +フチ 不知 +フチ 縁 +ブチ 武知 +フチアイ 淵合 +フチアイ 渕合 +フチイ 渕井 +フチイ 淵井 +フチイ 淵居 +フヂイ 藤井 +フチイズミ 淵泉 +フチウエ 渕上(渊上) +フチウエ 淵上 +フチウチ 淵内 +フチウチ 渕内 +フチエ 淵江 +フチエ 渕江 +フヂエダ 藤枝 +フチオカ 渕岡 +フチオカ 淵岡 +フヂオカ 藤岡 +フチガイ 淵貝(渕貝) +フチカミ 渕上(渊上) +フチカミ 淵上 +フチガミ 渕上(渊上) +フチガミ 淵上 +フチカワ 淵川 +フチカワ 渕川 +フチカワ 渕側 +フチキ 渕木 +フチキ 淵木 +フヂキ 藤木 +フチグチ 渕口 +フチグチ 淵口 +フチクラ 渕倉 +フチサキ 渕崎 +フチサキ 淵崎 +フチサキ 渕先 +フチサキ 淵先 +フチザキ 渕崎 +フチザキ 淵崎 +フチザキ 渕嵜 +フチサワ 渕沢 +フチサワ 淵沢 +フチサワ 渕澤 +フチサワ 淵澤 +フチザワ 渕沢 +フチザワ 淵沢 +フチザワ 渕澤 +フチザワ 淵澤 +フチシタ 淵下 +フチシタ 渕下 +フチジマ 淵島 +フチジマ 渕島 +フチジリ 渕尻(淵尻) +フチセ 渕瀬 +フチセ 淵瀬 +フチゾノ 淵園 +フチゾノ 渕園 +フチタ 渕田 +フチタ 淵田 +フチダ 渕田 +フチダ 淵田 +フヂタ 藤田 +フヂチカ 藤近 +フヂツカ 藤塚 +フチト 渕戸 +フチナ 渕名 +フチナ 淵名 +フチナガ 布知永 +フチナミ 渕浪 +フチナミ 淵浪 +フチナミ 渕波(淵波) +フチネ 渕根 +フチノ 渕野 +フチノ 淵野 +フチノウエ 渕上(渊上) +フチノウエ 淵上 +フチノウエ 渕之上 +フチノウエ 淵之上 +フチノウエ 渕ノ上 +フチノウエ 淵ノ上 +フチノウエ 淵の上 +フチノカミ 渕之上 +フチノカミ 渕ノ上 +フチノカミ 淵ノ上 +フチノカワ 渕ノ側 +フチハシ 淵橋 +フチハシ 渕橋 +フチハタ 渕端 +フチハタ 淵端 +フチハタ 渕畑 +フチハラ 渕原 +フチハラ 淵原 +フチベ 渕辺(渕邉) +フチベ 淵辺 +フチベ 淵部(渕部) +フチベ 淵邊 +フチベ 淵邉 +フチベ 渕返 +フチベ 渕邊 +フチベップ 渕別府 +フチベップ 淵別府 +ブチマル 駮丸 +フチミ 渕見 +フチミ 淵見 +フチムカイ 渕向 +フチムカイ 淵向 +フチムラ 渕村 +フチムラ 淵村 +フチモト 渕本 +フチモト 淵本 +フチモト 渕元 +フチモト 扶持本 +フチモト 淵元 +フヂモト 藤本 +フヂモト 藤元 +フチヤ 渕矢(淵矢) +フチヤ 渕谷 +フチャク 冨着 +フチャク 富着 +フチヤナギ 渕柳 +フチヤナギ 淵柳 +フチヤマ 渕山 +フチヤマ 淵山 +フヂヤマ 藤山 +フチュウ 府中 +フチュウヤ 府中谷 +フチュウヤ 府中屋 +フチワキ 渕脇 +フチワキ 淵脇 +フチワケ 渕別(淵別) +フヂワラ 藤原 +フツ 布津 +ブツイ 仏井 +ブツイ 佛井 +ブツエン 仏円 +ブツエン 佛圓 +ブツエン 佛円 +ブツエン 仏園 +ブツエン 仏圓 +ブッカ 佛華 +フッカイ 福海 +フツカイチ 二日市 +フツカイチ 二日一 +フツガノ 蓬野 +フツガノ 蓬ケ野 +ブツカワ 佛川 +ブツカワ 仏川 +ブツガン 仏願 +ブツガン 佛願 +フッキ 福貴 +フツキ 夫津木 +ブッキ 仏器 +ブッキョウ 仏京 +ブッキョウ 佛京 +フッキリ 吹切 +ブツグ 仏具 +ブツグ 佛具 +フッケ 福家 +ブッコウ 仏光 +フッコシ 吹越 +ブッサカ 仏坂 +ブッサカ 佛坂 +ブツサカ 佛坂 +ブッサキ 仏崎 +ブッサキ 佛崎 +ブツサキ 仏崎 +ブツサキ 佛崎 +ブツザキ 仏崎 +ブツザキ 佛崎 +フツザワ 普津沢 +フツザワ 普津澤 +ブッシ 仏子(佛子) +ブッシ 佛師 +ブツシタ 仏下 +ブツシタ 佛下 +ブツジマ 仏島(佛島) +ブッショウ 仏性 +ブッショウ 仏生 +ブッショウ 佛性 +ブッショウ 佛生 +ブッショウ 佛姓(仏姓) +ブツジョウ 仏常 +ブツジョウ 佛常 +ブツゼン 仏前 +フッタ 振田 +フツタ 弗田 +フツダ 布津田 +フツダ 冨津田 +ブッタ 佛田 +ブッタ 仏田 +ブツダ 佛田 +ブツダ 仏田 +フツノ 蓬野 +フツハラ 蓬原 +ブツハラ 仏原 +ブツハラ 佛原 +ブツミョウ 仏明 +ブツミョウ 佛明 +ブツモト 仏本 +ブツモト 佛本 +ブツヤ 仏谷 +ブツヤ 佛谷 +フツラ 府津羅 +フテ 布手 +フデ 筆 +フテイ 布袋 +フデイ 筆井 +フデウジ 筆氏 +フデウチ 筆内 +フデオカ 筆岡 +フデグチ 筆口 +フデサカ 筆坂 +フデサキ 筆崎 +フデシマ 筆島 +フデソメ 筆染 +フデタ 筆田 +フデタニ 筆谷 +フデツカ 筆塚 +フデヅカ 筆塚 +フデナガ 筆永 +フデノ 筆野 +フデバヤシ 筆林 +フデマエ 筆前 +フデムラ 筆村 +フデモト 筆本 +フデヤ 筆谷 +フデヤ 筆矢 +フデヤス 筆保 +フデヤス 筆安 +フデヤマ 筆山 +フデヨシ 筆吉 +フデラ 布寺 +フデワキ 筆脇 +フテンマ 普天間 +フト 太 +フト 富土 +フト 布戸 +フト 風斗 +フト 不戸 +フトイ 太井 +フトウ 布藤 +フトウ 不藤 +フトウ 風登 +フトウ 芙頭 +フトウ 富登 +フトウ 富東 +フトウ 布籐 +フトウ 麸東 +フドウ 不動 +フドウ 布藤 +フドウ 不藤 +フドウ 府藤 +フドウ 不働 +フドウ 富銅 +フドウ 府道 +フドウ 腐頭 +ブトウ 武藤 +ブトウ 武籐 +ブドウ 武道 +ブドウ 武堂 +フドウイワ 不動岩 +フドウイン 不動院 +フドウギ 不動木 +フドウジ 不動寺 +フドウジ 不動地 +フドウタ 不動田 +フドウダ 不動田 +フドウドウ 不動堂 +ブドウハラ 葡萄原 +フトオ 太尾 +フトカミ 太上 +フトガワラ 太河原 +フトコロ 懐 +フトシ 太志 +フトシマ 太島 +フトジマ 太島 +フトセ 太瀬 +フトタ 太田 +フトナカ 太中 +フトナカ 太仲 +フトナガネ 太長根 +フトノ 太野 +フトノ 太布 +フトノ 冨戸野 +フドノ 不殿 +フドノ 不動野 +フドノ 冨戸野 +フドノ 府殿 +フドノ 富戸野 +フトハシ 太箸 +フトミ 太見 +フトミ 布富 +フトミ 布冨 +フトヤマ 太山 +フトユ 太湯 +フトラ 太等 +フトリ 太 +フトリ 太利 +フトリ 肥 +フドリ 府鳥 +フナ 船 +フナ 舟 +フナ 符名 +フナ 鮒 +ブナ 武奈 +フナイ 船井 +フナイ 舟井 +フナイ 府内 +フナイ 舩井 +フナイ 鮒井 +フナイ 船居 +ブナイ 武内 +フナイエ 船家 +フナイケ 鮒池 +フナイシ 船石 +フナイシ 舟石 +フナイシ 舩石 +フナイソ 船磯(舩磯) +フナイタ 船板(舩板) +フナイタ 舟板 +フナイリ 船入(舩入) +フナイワ 船岩(舩岩) +フナウキ 舟浮 +フナウキ 船浮 +フナウチ 船内 +フナウラ 船浦 +フナエ 船江 +フナエ 舟江 +フナエ 舩江 +フナオ 舟生 +フナオ 船生 +フナオ 船尾 +フナオ 舟尾 +フナオ 舩尾 +フナオイ 舟生 +フナオイ 船生 +フナオカ 船岡 +フナオカ 舟岡 +フナオカ 舩岡 +フナオカ 船岳 +フナオカ 鮒岡 +フナオカ 舟丘 +フナオカ 舩岳 +フナオキ 船起 +フナオキ 船置 +フナオク 船奥 +フナオク 舩奥 +フナオサ 船長 +ブナカ 武中 +フナガイ 舟貝 +フナガキ 船垣 +フナガキ 舩垣 +フナガクレ 船隠 +フナカケ 舟掛 +フナガサキ 舟ケ崎 +フナガサコ 船ケ迫 +フナガサワ 船ケ沢(船ケ澤) +フナカタ 船方(舩方) +フナガタ 船形 +フナガタ 舟形 +フナガタニ 船ケ谷 +フナガネ 舟金 +フナカミ 船上 +フナカミ 舟上 +フナカミ 舩上 +フナガミ 船上 +フナガミ 舩上 +フナガヤマ 船ケ山(舩ケ山) +フナカワ 船川 +フナカワ 舟川 +フナカワ 舩川 +フナカワ 船河 +フナガワ 船川 +フナガワ 舩川 +フナガワラ 船河原 +フナキ 船木 +フナキ 舟木 +フナキ 舩木 +フナキ 船城(舩城) +フナキ 船寄(舩寄) +フナキ 舟城 +フナキ 舟喜 +フナキ 船樹 +フナキ 船来(舩來) +フナキ 普奈木 +フナキ 舩樹 +フナギ 船木 +フナギ 舩木 +フナギ 船城(舩城) +フナキサコ 船木迫 +フナキサコ 舩木迫 +フナキタ 船北(舩北) +フナギラ 船明 +フナキリ 船切 +フナキン 舟金 +フナクサ 船草 +フナクシ 船串(舩串) +フナクシ 舟串 +フナグチ 船口(舩口) +フナグチ 舟口 +フナクボ 舟久保 +フナクボ 船久保 +フナクボ 舟窪 +フナクボ 船窪(舩窪) +フナクボ 舩久保 +フナグマ 船隈 +フナクラ 古波蔵 +フナクラ 船倉 +フナクラ 舟倉 +フナクラ 船蔵(船藏) +フナクラ 舩倉 +フナクラ 舩蔵 +フナクラ 舩藏 +フナクラベ 船競 +フナコ 舟子 +フナコ 船古 +フナコ 舩古 +フナゴ 船後(舩後) +フナコウ 船工 +フナコウ 船公 +フナコエ 舟越 +フナゴエ 舟越 +フナコシ 船越 +フナコシ 舟越 +フナコシ 舩越 +フナコシ 富名腰 +フナコシ 冨名腰 +フナコシ 舟腰 +フナコシ 船腰(舩腰) +フナゴシ 船越 +フナゴシ 舟越 +フナゴシ 舩越 +フナコシヤ 船越谷(舩越谷) +フナコダ 鮒子田 +フナサカ 船坂 +フナサカ 舟坂 +フナサカ 舩坂 +フナサカ 船阪 +フナサカ 舟阪 +フナサカ 舩阪 +フナサキ 船崎 +フナサキ 舟崎 +フナサキ 舩崎 +フナサキ 船先(舩先) +フナサキ 船嵜(舩嵜) +フナサキ 舟嵜 +フナザキ 船崎 +フナザキ 舟崎 +フナザキ 舩崎 +フナザキ 船嵜(舩嵜) +フナサク 船迫 +フナサコ 船迫 +フナサコ 舟浴 +フナサコ 舩迫 +フナサコ 船廻 +フナサコ 船佐古 +フナサコ 船浴 +フナザシ 篙 +フナサト 舟里 +フナサワ 船澤 +フナサワ 舟澤 +フナサワ 舩澤 +フナザワ 船沢 +フナザワ 舟沢 +フナザワ 船澤 +フナザワ 舟澤 +フナザワ 舩澤 +ブナサワ 樗沢 +ブナサワ 樗澤 +ブナザワ 樗沢 +ブナザワ 樗澤 +フナジ 船路 +フナジ 舩路 +フナシゲ 船重 +フナシタ 船下 +フナシタ 舟下 +フナシマ 船島 +フナシマ 舟島 +フナシマ 舩島 +フナシマ 船嶋(舩嶋) +フナジマ 船島 +フナジマ 舟嶋 +フナジマ 舩島 +フナショ 船所 +フナショ 舟所 +フナショク 船職 +フナジリ 船尻 +フナシロ 船城(舩城) +フナシロ 船代 +フナズ 船津 +フナスギ 舟杉 +フナスギ 船杉(舩杉) +フナズミ 舟積 +フナズミ 船住 +フナセ 舟生 +フナセ 船瀬 +フナセ 舟瀬 +フナセ 船勢 +フナセ 舩瀬 +フナセ 船背 +フナセ 舩脊 +フナセコ 船迫 +フナゾウ 船造(舩造) +フナソコ 船底(舩底) +フナソコ 舟底 +フナタ 船田 +フナタ 舟田 +フナタ 鮒田 +フナタ 舩田 +フナダ 船田 +フナダ 舟田 +フナダ 鮒田 +フナダ 舩田 +フナダ 船多 +フナダイ 船台(船臺) +フナダイク 船大工(舩大工) +フナタケ 舟竹 +フナタケ 船竹 +フナタニ 船谷 +フナタニ 舟谷 +フナタニ 鮒谷 +フナタニ 船渓(船溪) +フナタニ 舩谷 +フナダニ 舟谷 +フナチ 舟知 +フナツ 船津 +フナツ 舟津 +フナツ 舩津 +フナヅ 船津 +フナヅ 舟津 +フナヅ 舩津 +フナツカ 船塚 +フナツカ 舟塚 +フナヅカ 船塚 +フナヅカ 舟塚 +フナヅカ 舩塚 +フナツガワ 舟津川 +フナツキ 船附 +フナツキ 船着 +フナツキ 舟槻 +フナツキ 船槻 +フナツキ 舩附 +フナツキ 船築(舩築) +フナツキ 舩槻 +フナツクリ 船造(舩造) +フナヅクリ 船造(舩造) +フナツケ 船付 +フナツナ 船綱 +フナツボ 舟坪 +フナツマル 船津丸 +フナツマル 舩津丸 +フナツマル 舟津丸 +フナヅミ 船積 +フナヅミ 舟積 +フナヅミ 舩積 +フナツヤ 船津屋 +フナツヤ 舩津屋 +フナデ 船出 +フナテダニ 船手谷 +フナデラ 船寺 +フナト 船戸 +フナト 船渡 +フナト 舟戸 +フナト 舩戸 +フナト 舟渡 +フナト 船登(舩登) +フナト 舩渡 +フナト 船砥(舩砥) +フナト 岐 +フナト 舟登 +フナト 舟涛 +フナト 舟濤 +フナト 船都 +フナト 船門(舩門) +フナド 船戸 +フナド 船渡 +フナド 舟戸 +フナド 舩戸 +フナド 舟渡 +フナトウ 船藤 +フナトウ 舩藤 +フナドウ 船堂 +フナトガワ 船渡川 +フナトガワ 船戸川 +フナトガワ 船度川 +フナトガワ 舩渡川 +フナトコ 船床 +フナトミ 船富 +フナトミ 船冨 +フナトミ 船宝 +フナトミ 舩冨 +フナトミ 舟宝(舟寳) +フナトミ 舟寶 +フナトミ 舩富 +フナトメ 船留(舩留) +フナナカ 船中 +フナナミ 舟波 +フナナミ 船浪(舩浪) +フナナミ 船波 +フナナミ 舩波 +フナナリ 舟成 +フナネ 舟根 +フナネ 船根 +フナノ 船野 +フナノ 舟野 +フナノ 舩野 +フナノカワ 舟ノ川 +フナノカワ 舟之川 +フナノカワ 船之川 +フナバ 船場 +フナバ 船迫 +フナバ 舟場 +フナバ 舟迫 +フナバ 船波 +フナバ 船端 +フナバ 舩場 +フナバ 舩迫 +フナバ 舟羽 +フナハザマ 船迫 +フナバサマ 船迫 +フナバサマ 舟迫 +フナハシ 船橋 +フナハシ 舟橋 +フナハシ 舩橋 +フナハシ 鮒橋 +フナハシ 船梁(舩梁) +フナハシ 船槁 +フナバシ 船橋 +フナバシ 舟橋 +フナバシ 舩橋 +フナハタ 舟幡 +フナハタ 船幡(舩幡) +フナハタ 船畑 +フナバタ 船端 +フナハマ 船浜 +フナバヤシ 舟林 +フナバヤシ 船林 +フナバヤシ 舩林 +フナハラ 船原 +フナハラ 舟原 +フナハラ 舩原 +フナバラ 船原 +フナバラ 舩原 +フナバリ 船張 +フナヒキ 船引 +フナビキ 船曳 +フナビキ 船引 +フナビキ 舟引 +フナビキ 船曵 +フナビキ 舟曳(舟曵) +フナビキ 舩曳 +フナビキ 舩曵 +フナビキ 舩引 +フナヒラ 船平 +フナベ 舟部 +フナベ 舟辺 +フナベ 船辺 +フナホ 船穂(舩穂) +フナホラ 舟洞 +フナボラ 舟洞 +フナボリ 舟掘 +フナボリ 舟堀 +フナマ 船間 +フナマ 舟間 +フナマ 舩間 +フナマタ 船亦 +フナマチ 船町 +フナマチ 舟町 +フナマツ 船松 +フナマヤ 船間屋 +フナミ 船見 +フナミ 舟見 +フナミ 舟波 +フナミ 舩見 +フナミ 符波 +フナミズ 船水 +フナミズ 舟水 +フナミズ 舩水 +フナミチ 船道 +フナミチ 舟道 +フナミチ 舟路 +フナミツ 船満 +フナミツ 舩満 +フナミヤ 船宮 +フナムラ 船村 +フナムラ 舟村 +フナムラ 舟邑 +フナムラ 鮒村 +フナムラ 舩村 +フナメン 船面 +フナモ 舟茂 +フナモ 鮒藻 +フナモト 船本 +フナモト 舟本 +フナモト 船元 +フナモト 舩本 +フナモト 舟元 +フナモト 舩元 +フナモリ 船守 +フナモリ 舟守 +フナモリ 船盛(舩盛) +フナモリ 船森 +フナモリ 舟森 +フナモリ 舩守 +フナモリ 舩森 +フナヤ 船谷 +フナヤ 船屋(舩屋) +フナヤ 舟谷 +フナヤ 船矢(舩矢) +フナヤ 舟屋 +フナヤチ 船谷内 +フナヤナギ 船柳 +フナヤマ 船山 +フナヤマ 舟山 +フナヤマ 舩山 +フナヨシ 船吉 +フナヨシ 舩吉 +フナヨセ 船寄(舩寄) +フナヨセ 舟寄 +フナヨリ 船寄(舩寄) +フナワキ 船脇(舩脇) +フナワタシ 船渡 +フナワタシ 舟渡 +フナワタリ 船渡 +フナワタリ 舟渡 +フナワタリ 舩渡 +フナワタリ 船度 +フニウ 舟生 +フニウ 船生 +フニウ 舩生 +ブニウ 豊丹生 +ブニウチ 歩仁内 +ブニナイ 歩仁内 +フニュウ 藤生 +フニュウ 舟生 +フニュウ 船生 +フニュウ 普入 +フニュウ 舩生 +ブニュウ 豊饒 +ブニュウ 豊丹生 +ブニョウ 豊饒 +フネ 船 +フネ 舩 +フネガサワ 船ケ沢 +フネキ 船木 +フネダ 船田 +フネノ 船野 +フネノ 舩野 +フネミズ 船水 +フノ 布野 +フノ 府野 +フノ 附野 +フノ 不野 +フノ 布埜 +ブノ 武野 +フノウ 布能 +フノウ 布生 +ブノウ 舞能 +フノキ 朴木 +フノボリ 五六 +フバ 不破 +フバサミ 文挾 +フバサミ 文狭 +フバサミ 文挟 +フハモト 不破本 +フハラ 富原 +フハラ 冨原 +フブキ 雪吹 +フベ 冨部 +フベ 富部 +フベ 布部 +フベ 封戸 +フベツ 不別 +フボ 父母 +フボイシ 父母石 +フボイン 父母院 +フマ 夫馬 +フマ 府馬 +フマ 布間 +フマ 府間 +ブマ 武馬 +ブマ 武間 +フミ 文 +フミ 富美 +フミ 冨美 +フミアキ 文明 +フミイ 文井 +フミイリ 文入 +フミイワ 文岩 +フミエ 踏江 +フミオカ 文岡 +フミガキ 文垣 +フミカワ 文川 +フミキ 文木 +フミクラ 文倉 +フミクラ 文蔵 +フミクラ 文庫 +フミクラ 文藏 +フミコミ 踏込 +フミサワ 文沢 +フミサワ 文澤 +フミザワ 文沢 +フミザワ 文澤 +フミシ 二三四 +フミシマ 二三島 +フミシロ 文城 +フミゾノ 文園 +フミタ 文田 +フミタ 府味田 +フミタツ 踏脱 +フミタニ 文谷 +フミツキ 文月 +フミナカ 文中 +フミナガ 文永 +フミナシ 文梨 +フミナリ 文成 +フミノ 文野 +フミノモリ 文野森 +フミハラ 文原 +フミヒラ 文平 +フミブチ 文渕 +フミムラ 文村 +フミムロ 文室 +フミモト 文元 +フミモト 文本 +フミモト 富美本 +フミモリ 文森 +フミヤ 夫宮 +フミヤマ 文山 +フミワケ 踏分 +ブムラ 部村 +フムロ 文室 +フムロ 不室 +フメ 布目 +フメ 不免 +フメイ 普明 +フメノ 冨米野 +フメノ 富米野 +フメヤ 布目谷 +フモト 麓 +フモト 府本 +フモト 杯本 +フモト 普本 +フモト 阜本 +フモト 抔本 +フモトガワ 麓川 +フモトヤ 麓屋 +フモリ 普森 +フモン 普門 +フモン 不聞 +フヤ 府屋 +ブヤ 武谷 +フヤダ 普山田 +フヤマ 布山 +フヤマ 麸山 +フヤマ 府山 +フヤマ 普山 +フヤマ 阜山 +フヤマ 汾山 +フヤマ 麩山 +ブヤマ 武山 +フヤマダ 普山田 +フユイ 冬井 +フユイズミ 冬泉 +フユウメ 冬梅 +フユカワ 冬川 +フユキ 冬木 +フユキ 殖木 +フユキ 冬城 +フユサワ 冬沢 +フユサワ 冬澤 +フユシバ 冬柴 +フユシマ 冬島 +フユタ 冬田 +フユツメ 冬爪 +フユヅメ 冬爪 +フユトウ 冬頭 +フユノ 冬野 +フユヒロ 冬広 +フユヒロ 冬廣 +フユベ 冬部 +フユムラ 冬村 +フユムロ 冬室 +フユヤマ 冬山 +フヨウ 芙蓉 +ブヨウ 武用 +ブラ 武良 +フラク 富楽 +フラク 冨楽(冨樂) +フラシャ 富良謝 +フラノ 富良野 +フラン 弗蘭 +フリイ 降井 +ブリオカ 鰤岡 +フリオチ 振落 +フリカド 振角 +フリカド 振角 +フリカワ 冨里川 +フリカワ 振川 +フリキ 振木 +フリコマ 降駒 +フリソデ 振袖 +フリタ 古田 +フリタ 降田 +フリタニ 風里谷 +ブリタニ 鰤谷 +フリツ 振津 +フリツチ 振槌 +フリハタ 降旗 +フリハタ 降幡 +フリハタ 降籏(降簱) +フリハタ 振旗 +フリハタ 布利幡 +フリハタ 降畑 +フリハタ 振籏 +フリハラ 振原 +フリモト 振本 +フリヤ 降矢 +フリヤ 降屋 +ブリヤ 鰤谷 +フリュウ 不流 +ブリョウ 武陵 +ブリョウ 武領 +フリヨシ 振吉 +フリワケ 振分 +フル 古 +フル 布留 +フルアト 古跡 +フルアン 古庵 +フルイ 古井 +フルイ 古居 +フルイ 降井 +フルイ 振井 +フルイエ 古家 +フルイガミ 古井神 +フルイケ 古池 +フルイシ 古石 +フルイズミ 古泉 +フルイタ 古板 +フルイダ 古井田 +フルイチ 古市 +フルイチ 古都 +フルイチ 古一 +フルイデ 古出 +フルイト 古糸 +フルイド 古井戸 +フルイワ 古岩 +フルウケ 古請 +フルウタ 古宇田 +フルウダ 古宇田 +フルウチ 古内 +フルウネ 古畝 +フルウマ 古馬 +フルウミ 古海 +フルウメ 古梅 +フルエ 古家 +フルエ 古江 +フルエ 古永 +フルエ 古衛 +フルエ 古恵 +フルエダ 古枝 +フルエビス 古胡 +フルオ 古尾 +フルオ 降雄 +フルオオウチ 古大内 +フルオカ 古岡 +フルオカ 古阜 +フルオキ 古沖 +フルオク 古奥 +フルオヤ 古尾谷 +ブルガ 舞龍我 +フルガイ 古谷 +フルガイ 古貝 +フルガイチ 古垣内 +フルガイト 古垣内 +フルガイト 古垣外 +フルカキ 古垣 +フルガキ 古垣 +フルガキ 古柿 +フルカク 古角 +フルカゲ 古蔭 +フルカコイ 古栫 +フルカタ 古堅 +フルカツ 古勝 +フルカド 古門 +フルカド 古角 +フルカネ 古金 +フルガネ 古金 +フルカマ 古鎌 +フルカミ 古上 +フルガミ 古上 +フルカヤ 古萱 +フルガヤチ 古ケ谷内 +フルカワ 古川 +フルカワ 古河 +フルカワ 布留川 +フルカワ 舊川(旧川) +フルガワ 古川 +フルガワ 布留川 +フルカワゾノ 古川園 +フルカワト 古川戸 +フルカワド 古川戸 +フルカワバタ 古川端 +フルカワハラ 古川原 +フルカワヤ 古川谷 +フルカワラ 古川原 +フルガワラ 古川原 +フルキ 古木 +フルキ 古城 +フルキ 振木 +フルキ 故木 +フルキ 古起 +フルキ 旧木 +フルキ 古帰(古歸) +フルギ 古木 +フルキタ 古北 +フルキド 古城戸 +フルキド 古城門 +フルキナ 古木名 +フルキミ 古卿 +フルキミ 古君 +フルキョウ 古京 +フルクサ 古草 +フルクシ 古櫛 +フルグシ 古櫛 +フルグチ 古口 +フルクニ 古国 +フルクボ 古久保 +フルクボ 古窪 +フルクマ 古熊 +フルクラ 古倉 +フルクラ 古蔵 +フルクラ 古藏 +フルクワ 古桑 +フルケ 古家 +フルケン 古堅 +フルゲン 古堅 +フルコ 古子 +フルコ 古府 +フルコ 古胡 +フルコ 古庫 +フルコ 古湖 +フルコ 古小 +フルコウ 古国府 +フルコウ 古甲 +フルゴウ 古郷 +フルコウジ 古小路 +フルコウチ 古河内 +フルゴウリ 古郡 +フルコオリ 古郡 +フルゴオリ 古郡 +フルコシ 古越 +フルコダ 古小田 +フルコミ 古込 +フルゴリ 古郡 +フルサ 古佐 +フルサカ 古坂 +フルサカ 古阪 +フルサキ 古崎 +フルサキ 古嵜 +フルサク 古作 +フルサケ 古酒 +フルサコ 古迫 +フルサダ 古定 +フルサチ 古幸 +フルサト 古里 +フルサワ 古沢 +フルサワ 古澤 +フルサワ 旧沢 +フルサワ 旧澤 +フルザワ 古沢 +フルザワ 古澤 +フルジ 古次 +フルシオ 古塩 +フルシカ 古鹿 +フルジク 古軸 +フルシゲ 古重 +フルシタ 古下 +フルシバ 古芝 +フルシマ 古島 +フルシマ 古嶋 +フルシマ 古嶌 +フルシモ 古霜 +フルショウ 古庄 +フルショウ 古荘 +フルショウ 古性 +フルショウ 古正 +フルショウ 古姓 +フルショウ 古匠 +フルショウ 古圧 +フルショウ 古莊 +フルジョウ 古城 +フルジョウ 古条 +フルジョウ 古條 +フルシロ 古城 +フルシロ 古代 +フルス 古巣 +フルスエ 古末 +フルスギ 古杉 +フルスミ 古角 +フルスミ 古住 +フルズミ 古住 +フルズミ 古隅 +フルセ 古瀬 +フルセ 古勢 +フルセキ 古関(古關) +フルセコ 古迫 +フルセン 古仙 +フルソウ 古荘 +フルソウ 古相 +フルソオ 古曾尾 +フルソオ 古曽尾 +フルソノ 古園 +フルソノ 古薗 +フルゾノ 古園 +フルゾノ 古薗 +フルゾノ 古囿 +フルタ 古田 +フルタ 降田 +フルタ 富留田 +フルタ 冨留田 +フルダ 古田 +フルタカ 古高 +フルタカ 古鷹 +フルタキ 古滝 +フルタキ 古瀧 +フルタク 古宅 +フルタグチ 古田口 +フルタケ 古武 +フルタケ 古竹 +フルタチ 古館 +フルタチ 古舘 +フルタチ 古立 +フルタチ 古達 +フルダチ 古館 +フルダチ 古舘 +フルタツ 古達 +フルタテ 古館 +フルタテ 古舘 +フルタテ 古立 +フルダテ 古館 +フルダテ 古舘 +フルダテ 古立 +フルタニ 古谷 +フルタニ 旧谷 +フルタニ 降谷 +フルタニ 舊谷 +フルタニ 古渓 +フルタニ 布留谷 +フルタマ 古玉 +フルチ 古池 +フルチ 古地 +フルツ 古津 +フルツ 古都 +フルツ 振津 +フルツカ 古塚 +フルヅカ 古塚 +フルツキ 古月 +フルヅキ 古月 +フルツジ 古辻 +フルツチ 古土 +フルツチ 振槌 +フルツツミ 古堤 +フルツツミ 古提 +フルヅツミ 古堤 +フルツボ 古坪 +フルテ 古手 +フルデ 古手 +フルデ 古出 +フルテラ 古寺 +フルデラ 古寺 +フルト 古門 +フルト 古戸 +フルト 古渡 +フルト 古殿 +フルト 古土 +フルト 古度 +フルド 古土 +フルドイ 古土井 +フルドイ 古土居 +フルトウ 古藤 +フルトウ 古頭 +フルドウ 古堂 +フルトク 古徳 +フルトコ 古床 +フルトチ 古栃 +フルトノ 古殿 +フルドノ 古殿 +フルドマリ 古泊 +フルトミ 古富 +フルトミ 古冨 +フルドミ 古冨 +フルトモ 古友 +フルトモ 古塘 +フルトヨ 古豊 +フルトリ 古鳥 +フルトリイ 古鳥井 +フルナ 古名 +フルナイ 古内 +フルナカ 古仲 +フルナカ 古中 +フルナガ 古長 +フルナガ 古永 +フルナミ 古波 +フルニシ 古西 +フルニワ 古庭 +フルヌシ 古主 +フルヌマ 古沼 +フルネ 古根 +フルノ 古野 +フルノ 古埜 +フルノ 古能 +フルノウ 古納 +フルノブ 古信 +フルハ 古羽 +フルハシ 古橋 +フルハシ 旧橋(舊橋) +フルハシ 古槁 +フルハタ 古畑 +フルハタ 降旗 +フルハタ 降幡 +フルハタ 降籏 +フルハタ 古幡 +フルハタ 古旗 +フルハタ 古畠 +フルハタ 古籏 +フルハタ 古波田 +フルハチ 古八 +フルハマ 古浜 +フルハマ 古濱 +フルバヤシ 古林 +フルバヤシ 旧林 +フルバヤシ 奮林 +フルハラ 古原 +フルヒ 古樋 +フルビキ 古曳 +フルビキ 古曵 +フルヒラ 古平 +フルヒロ 古広 +フルヒロ 古廣 +フルフ 古府 +フルフォード 古歩道 +フルフジ 古藤 +フルブチ 古渕 +フルブチ 古淵 +フルベ 古部 +フルベ 古辺(古邊) +フルベップ 古別府 +フルホ 古保 +フルボ 古保 +フルボウ 古坊 +フルボウ 古防 +フルボリ 古堀 +フルマ 古馬 +フルマ 古間 +フルマイ 古米 +フルマイ 古舞 +フルマエ 古前 +フルマキ 古牧 +フルマキ 古間木 +フルマキ 古巻 +フルマキ 古槙 +フルマキ 古槇 +フルマギ 古間木 +フルマジ 古間地 +フルマス 古益 +フルマス 古桝 +フルマス 古枡 +フルマタ 古俣 +フルマチ 古町 +フルマツ 古松 +フルマヤ 古厩(古廏) +フルマヤ 古廐 +フルミ 古味 +フルミ 古見 +フルミ 古海 +フルミ 古箕 +フルミ 不留美 +フルミ 故見 +フルミズ 古水 +フルミゾ 古溝 +フルミタ 古見田 +フルミチ 古道 +フルミチ 古路 +フルミツ 古満 +フルミドウ 古御堂 +フルミドウ 古見堂 +フルミナト 古湊 +フルミナト 古港 +フルミネ 古峰 +フルミヤ 古宮 +フルミヤ 布留宮 +フルミヤ 冨留宮 +フルミヤ 富留宮 +フルミヤ 旧宮 +フルムラ 古村 +フルムラ 古邑 +フルムロ 古室 +フルモチ 古用 +フルモト 古本 +フルモト 古元 +フルモト 布留本 +フルモリ 古森 +フルモリ 古守 +フルモン 古門 +フルヤ 古谷 +フルヤ 古屋 +フルヤ 古家 +フルヤ 古矢 +フルヤ 降矢 +フルヤ 振屋 +フルヤ 古箭 +フルヤ 降屋 +フルヤ 風呂矢 +フルヤ 古舎 +フルヤ 降谷 +フルヤ 舊谷 +フルヤ 布留谷 +フルヤシキ 古屋敷 +フルヤシキ 古屋鋪 +フルヤシキ 古邸 +フルヤシキ 古屋舗 +フルヤス 古安 +フルヤド 古宿 +フルヤブ 古薮 +フルヤブ 古藪 +フルヤマ 古山 +フルユキ 古行 +フルヨ 古代 +フルヨシ 古吉 +フルワ 古和 +フルワ 古輪 +フルワキ 古脇 +フルワタ 古渡 +フルワタリ 古渡 +フルワン 古椀 +フレ 触 +フレ 振 +フレ 觸 +フレイゾノ 触井園 +フレイゾノ 觸井園 +フレサワ 触沢(触澤) +フレサワ 觸澤 +フロ 風呂 +ブロ 武呂 +フロイ 風呂井 +フロウ 不老 +フロウエ 風呂上 +フロウチ 風呂内 +フロウチ 不老地 +フロガミ 風呂上 +フロカワ 風呂川 +フロク 府録 +ブロク 伏鹿 +フロサコ 風呂迫 +フロシタ 風呂下 +フロタ 風呂田 +フロタ 風炉田 +フロダ 風呂田 +フロタニ 風呂谷 +フロチ 不老地 +フロナカ 風呂中 +フロノ 風呂野 +フロノウエ 風呂ノ上 +フロハシ 風呂橋 +フロミ 風呂見 +フロミツ 風呂光 +フロモト 風呂本 +フロモト 冨路本 +フロモト 風呂元 +フロヤ 風呂矢 +フロヤマ 風呂山 +フワ 不破 +フワ 府玻 +フワ 冨和 +フワ 富和 +フワ 府和 +フワ 普和 +フワ 不波 +フワ 風和 +ブワ 武和 +フワサキ 普輪崎 +フワザキ 普輪崎 +フワノ 不破野 +フワノ 不波野 +フワマ 不破間 +フワモト 不破本 +ブンエイ 文栄 +ブンエイ 文榮 +ブンキ 分木 +ブンキ 文城 +ブンキ 文木 +ブンギ 分木 +ブンギョク 分玉 +ブンケ 分家 +ブンコ 分校 +ブンコ 文庫 +ブンゴ 豊後 +ブンゴ 文後 +ブンコウ 分校 +ブンゴヤ 豊後屋 +ブンサイ 分才 +ブンザイ 分才 +ブンジ 分寺 +ブンジョウ 文城 +ブンズイ 文随 +ブンズイ 文隨 +ブンセン 文仙 +ブンセン 文選 +ブンゾウ 分造 +フンゾノ 分園 +ブンタ 文田 +ブンダ 文田 +ブンダ 分田 +ブンダイ 文大 +ブンデン 分田 +ブンデン 文傳 +フンドウ 分銅 +ブントウ 豊東 +ブントウ 文藤 +ブンドウ 分銅 +ブンドウ 分藤 +ブンドウ 豊東 +ブンドウ 文堂 +ブンドウ 分道 +ブンドウ 文藤 +ブンドウ 文道 +ブンドウ 文東 +ブントク 文徳 +ブンナカ 文中 +ブンネ 分根 +ブンノ 文野 +ブンノ 豊 +ブンノ 分野 +ブンノウ 文能 +ブンノモリ 文野森 +ブンバイ 分枝 +ブンフク 文福 +ブンボリ 文堀 +ブンマ 武間 +ブンマ 文馬 +ブンマツ 分松 +ブンメイ 分明 +ブンモト 文元 +ブンヤ 文屋 +ブンヤ 文谷 +ブンヤ 文室 +ブンヤ 文箭 +ブンヤ 文弥 +ブンヤマ 文山 +ブンリ 文理 +ブンリョウ 分領 +ブンリン 分林 +ブンリン 文林 +ヘアワ 部粟 +ヘアンザン 平安山 +ヘアンナ 平安名 +ヘイ 幣(弊) +ヘイ 屏 +ヘイ 幤 +ヘイ 閉伊 +ベイ 部井 +ヘイアンザ 平安座 +ヘイアンザン 平安山 +ヘイアンジ 平安寺 +ヘイアンナ 平安名 +ヘイウチ 塀内 +ヘイウチ 幣内 +ヘイウチ 幤内 +ベイカ 米花 +ベイグ 部井久 +ヘイグチ 平口 +ヘイケ 平家 +ヘイゲン 平源 +ヘイゴゾノ 平後園 +ヘイサ 兵佐 +ヘイシ 瓶子 +ヘイシ 幣司 +ヘイジ 幣次 +ヘイシマ 平島 +ヘイジマ 平島 +ヘイジマ 幣島 +ヘイジマ 塀島 +ヘイショウ 平生 +ヘイジョウ 平城 +ヘイシン 平親 +ヘイゼイ 平生 +ヘイセン 平仙 +ヘイゾウ 平蔵 +ヘイダ 平田 +ヘイダイ 平代 +ヘイタク 平宅 +ヘイダニ 平谷 +ヘイタミ 兵丹 +ヘイチ 平地 +ヘイツギ 幣次 +ヘイツグ 幣次 +ヘイツグ 弊次 +ヘイトウ 平藤 +ヘイトク 平徳 +ヘイナイ 平内 +ヘイノウチ 平ノ内 +ヘイノウチ 幣之内 +ヘイノウチ 屏之内 +ヘイハタ 幣旗 +ヘイバタケ 平畠 +ヘイバラ 幣原 +ヘイブ 平部 +ヘイホウ 兵法 +ヘイマ 平間 +ヘイマ 平馬 +ヘイモト 塀本 +ヘイヤ 塀谷 +ヘイラ 平良 +ヘイラク 平楽(平樂) +ヘイラクジ 平楽寺(平樂寺) +ヘカタ 辺方(邉方) +ヘガワ 平川 +ベカワ 部川 +ベカワ 辺川 +ベカワ 邊川 +ヘキ 日置 +ヘギ 枌 +ヘキゾノ 辺木園 +ヘキゾノ 辺木薗(邉木薗) +ヘキゾノ 邊木園 +ヘキムラ 碧村 +ヘキヤマ 碧山 +ヘクラ 幣倉 +ヘグリ 平郡 +ヘグリ 平群 +ヘゴザキ 萇崎 +ヘゴノ 萇野 +ヘサカ 部坂 +ヘサキ 舳崎 +ヘサキ 艗 +ヘシキ 平敷 +ヘシキ 平識 +ヘシキ 平織 +ヘシキリ 辺志切(邉志切) +ヘシキリ 邊志切 +ベシタ 辺下 +ヘタ 辺田 +ヘタ 部田 +ヘタ 邉田 +ヘタ 邊田 +ヘダ 辺田 +ヘダ 邉田 +ヘダ 邊田 +ヘタニ 部谷 +ヘタニ 辺谷 +ヘダニ 部谷 +ヘツ 辺津(邉津) +ヘツ 邊津 +ヘヅ 辺津(邉津) +ベツイ 別井 +ベツイン 別院 +ベッカ 別火 +ベッカー 別華 +ベッカク 別角 +ベツカワ 別川 +ヘツギ 戸次 +ベッキ 戸次 +ベッキ 別城 +ベッキ 別木 +ベッキ 別技 +ベツキ 別木 +ベツキ 別技 +ベツギ 戸次 +ベツギョウ 別行 +ベック 別宮 +ベックヤ 鼈宮谷 +ベッケ 別家 +ベッコウヤ 鼈甲屋 +ベッシ 別枝 +ベッシ 別司 +ベッシ 別紙 +ベツシゲ 別重 +ベツシバ 別芝 +ベツシマ 別島 +ベッシャ 別車 +ベッショ 別所 +ベッショ 別処 +ベッショ 別處 +ベッショウ 別生 +ベッショウ 別小 +ベツジョウ 別城 +ベッショウチ 別所内 +ベッソ 別曽(別曾) +ベッソ 別祖 +ベッソウ 別宗 +ベッソウ 別惣 +ベッソウ 別荘 +ベッタ 別田 +ベツタ 別田 +ベツダ 別田 +ベツダン 別段 +ベッチャク 別役 +ベットウ 別当 +ベットウ 別當 +ベットウ 別頭 +ベットウ 別東 +ベットウ 別筒 +ベツトウ 別當 +ベットウヤシキ 別当屋敷 +ベツナガ 別永 +ベツナワ 別縄 +ベツノ 別野 +ベツノウ 別納 +ベツノウ 別能 +ベツヒロ 別広 +ベツヒロ 別廣 +ベップ 別府 +ベップ 別部 +ベップ 別符 +ベップゴメ 別府込 +ベップゾノ 別府園 +ベッポ 別保 +ベツマタ 別又 +ベツミヤ 別宮 +ベツムラ 別村 +ベツメイ 別名 +ベツモト 別本 +ベツモリ 別森 +ベツヤク 別役 +ペテ 辺泥 +ペティ 辺泥 +ヘド 辺土 +ベトウ 部当 +ベトウ 部當 +ヘドキ 平戸木 +ベナ 部奈 +ベニ 紅 +ベニイ 紅井 +ベニウラ 紅浦 +ベニカワ 紅川 +ベニコ 紅粉 +ベニサカ 紅坂 +ベニサワ 紅沢 +ベニセ 紅瀬 +ベニタ 紅田 +ベニタニ 紅谷 +ベニデ 紅出 +ベニトウ 紅藤 +ベニノ 紅野 +ベニバヤシ 紅林 +ベニムラ 紅邑 +ベニモト 紅本 +ベニモリ 紅盛 +ベニヤ 紅谷 +ベニヤ 紅屋 +ベニヤ 紅家 +ベニヤ 紅粉谷 +ベニヤ 紅矢 +ベニヤマ 紅山 +ベノキ 辺野喜 +ベノキ 邊野喜 +ヘノマツ 舳松 +ヘノミネ 舳峰 +ヘノミネ 舳峯 +ヘバラ 部原 +ヘバラ 辺原 +ヘバル 辺春 +ヘバル 辺原 +ヘバル 邊原 +ヘバル 邊春 +ヘバル 邉原 +ヘバル 邉春 +ベハル 辺春 +ベハル 邊春 +ベハル 邉春 +ヘビイシ 蛇石 +ヘビイワ 蛇岩 +ヘビカワ 蛇川 +ヘビグチ 蛇口 +ヘビサワ 蛇沢 +ヘビサワ 蛇澤 +ヘビシマ 蛇島 +ヘビシマ 蛇嶋 +ヘビタ 蛇田 +ヘビツカ 蛇塚 +ヘビヅカ 蛇塚 +ヘビハラ 蛇原 +ヘビヤマ 蛇山 +ベフ 別府 +ベフ 部府 +ベベコ 遍々古 +ベベコ 辺々古 +ヘボキ 辺母木(邊母木) +ヘボキ 辺保木 +ヘミ 逸見 +ヘムキ 辺牟木(邊牟木) +ヘムギ 辺麦 +ベムラ 部村 +ヘヤ 部谷 +ヘヤ 部屋 +ヘヤ 部家 +ヘヤ 部矢 +ヘヤウチ 部屋内 +ヘヤウラ 部屋浦 +ベヤマ 部山 +ヘヤミツ 部谷光 +ヘヤモト 部屋本 +ヘヤモト 部谷元 +ヘヤモト 部谷本 +ヘヤモト 辺谷本 +ヘヤモト 邊谷本 +ヘラ 部良 +ヘライ 戸来 +ヘライ 箆伊 +ヘライ 篦伊 +ヘライ 戸來 +ヘライ 戸耒 +ヘラモト 部良本 +ヘリカワ 縁川 +ヘリムシロ 縁筵 +ヘリムシロ 縁莚 +ヘリモト 縁本 +ヘワ 辺輪 +ベン 弁 +ベン 辨 +ベン 便 +ベンカイ 弁開 +ベンカイ 辨開 +ベンカン 弁官 +ベンカン 辨官 +ヘンキ 辺城 +ベンキ 弁木 +ベンキ 辨木 +ヘンキャク 返脚 +ペンギン 辺銀 +ヘンザ 平安座 +ヘンザ 片座 +ベンザキ 弁崎 +ベンザキ 辨崎 +ヘンザン 平安山 +ヘンジョウ 遍照 +ベンジョウ 弁上 +ベンジョウ 弁条 +ベンスイ 辨吹 +ヘンタ 辺田 +ヘンタ 邉田 +ヘンタ 邊田 +ヘンダ 辺田 +ヘンダ 邉田 +ヘンダ 邊田 +ベンテン 弁天 +ベンテン 辨天 +ヘンド 辺土 +ヘンド 邊土 +ベンド 𣘸 +ベンドウ 𣘸 +ヘントナ 辺土名 +ヘントナ 邊土名 +ヘントナ 平土名 +ヘンナ 平安名 +ヘンノ 辺野 +ベンノ 弁野 +ベンノ 辨野 +ベンノウ 弁納 +ベンノウ 辨納 +ベンハタ 弁畑 +ベンハタ 辨畑 +ベンバタ 辨畑 +ヘンボ 辺保 +ヘンボ 邊保 +ヘンポ 辺保 +ヘンミ 逸見 +ヘンミ 辺見 +ヘンミ 片見 +ヘンミ 邊見 +ヘンミ 邉見 +ヘンミ 辺美 +ヘンミ 返見 +ベンモリ 弁森 +ベンモリ 辨森 +ヘンヤ 辺弥 +ベンヤ 弁谷 +ベンヤ 辨谷 +ヘンヤキ 辺焼 +ホ 帆 +ホ 穂 +ホアキ 帆秋 +ホアキ 保明 +ホアシ 帆足 +ホアシ 保足 +ホアシ 甫足 +ホアシ 保芦 +ホイ 保井 +ホイ 帆井 +ホイズミ 穂泉 +ホイズミ 保泉 +ホイズミ 補泉 +ホイダ 穂井田 +ホイダ 補陀 +ホイダ 保井田 +ホイタニ 杪谷 +ホイチ 保市 +ホイン 保院 +ホウ 豊 +ホウ 保 +ホウ 鳳 +ホウ 甫 +ボウ 坊 +ボウ 房 +ボウ 防 +ホウアミ 豊阿弥 +ホウアン 法安 +ホウイ 宝意(寶意) +ボウイ 坊井 +ボウイケ 坊池 +ホウウズ 宝渦 +ボウウチ 坊内 +ホウエ 宝得 +ホウエイ 宝栄(宝榮・寶榮) +ホウエイ 宝永(寳永・寶永) +ホウエイ 寳榮 +ホウエン 方円 +ホウオウ 鳳凰 +ボウオカ 坊岡 +ボウオク 坊奥 +ホウカ 宝華 +ホウガ 芳賀 +ホウガ 法元 +ホウガ 宝賀(寶賀) +ホウガ 法亢 +ホウガイ 螺 +ボウガイト 坊垣内 +ボウガウチ 坊垣内 +ボウガウチ 坊ケ内 +ボウガキ 坊垣 +ボウガキウチ 坊垣内 +ホウカク 法覚 +ホウカク 宝閣 +ホウカク 法覺 +ホウカク 寶閣 +ホウカク 寳閣 +ホウガク 豊岳(豐岳) +ホウガク 宝学(寳學) +ホウガサコ 芳ケ迫 +ボウガサコ 坊ケ迫 +ボウガサワ 坊ケ澤 +ボウガシマ 坊ケ島 +ホウカタ 宝方 +ボウカタ 棒方 +ボウガタ 坊ケ田 +ボウガタニ 防ケ谷 +ホウガノ 芳ケ野 +ホウカベ 波々伯部 +ホウカベ 宝壁(寳壁・寶壁) +ホウカベ 方壁 +ホウカベ 波伯部 +ホウカベ 方ケ部 +ホウガラ 方柄 +ホウカワ 宝川(寳川) +ホウカワ 寶川 +ボウカワ 坊川 +ボウカワ 防川 +ボウカワチ 坊河内 +ホウカン 宝官(寶官・寳官) +ホウカン 法官 +ホウガン 宝官(寶官・寳官) +ホウガン 法官 +ホウキ 保木 +ホウキ 伯耆 +ホウキ 法貴 +ホウキ 宝木(寳木) +ホウキ 宝亀 +ホウキ 法木 +ホウキ 宝城 +ホウキ 法喜 +ホウキ 方木 +ホウキ 箒 +ホウキ 伯木 +ホウキ 宝寄 +ホウキ 寳亀 +ホウキ 宝喜(寳喜) +ホウキ 蜂起 +ホウキ 寶亀 +ホウキ 嵭寄 +ホウギ 法木 +ホウギ 母木 +ボウキ 坊木 +ボウキ 傍木 +ホウキタ 伯耆田 +ホウキダ 伯耆田 +ホウキハラ 宝木原(寳木原) +ホウキハラ 朴木原 +ホウキハラ 寶木原 +ホウキバラ 伯耆原 +ホウキバラ 宝木原(寳木原) +ホウキモト 掃本 +ホウキヤマ 宝寄山(寳寄山) +ホウキヤマ 箒山 +ホウキヤマ 寶寄山 +ホウキョ 宝居(寳居) +ホウキョ 寶居 +ホウキョウ 法橋 +ホウキョウ 宝鏡(寳鏡) +ホウキョウ 鳳京 +ホウキョウ 方京 +ホウキョウ 法教 +ホウキョウ 宝京 +ホウキョウ 法京 +ホウギョウ 法行 +ホウギョウ 豊行 +ホウギョウ 北行 +ホウギョク 宝玉(寳玉) +ホウギリ 鳳桐 +ホウキン 宝金(寳金) +ホウキン 方金 +ホウキン 寶金 +ホウク 宝久 +ボウク 保久 +ホウグチ 宝口 +ホウクボ 宝窪 +ホウクワ 法桑 +ホウケ 保家 +ホウケ 穂毛 +ホウゲ 宝毛(寶毛) +ボウゲ 坊下 +ホウゲツ 宝月(寶月) +ホウゲツ 方月 +ホウゲツ 寳月 +ホウケン 宝剣 +ホウケン 宝剱 +ホウケン 宝劔(寳劔) +ホウケン 宝劒 +ホウゲン 法元 +ホウゲン 法眼 +ホウコ 宝壷 +ホウコ 宝壺(寶壺) +ボウゴ 防後 +ボウゴ 防護 +ボウコイ 坊古居 +ホウコウ 法幸 +ホウコウ 法光 +ホウゴウ 蓬郷 +ホウゴウ 篷郷 +ホウコウイ 宝光井(寶光井) +ホウコウイン 法光院 +ホウコウザン 宝光山 +ボウゴシ 防越 +ホウサイ 法西 +ホウサイ 法才 +ホウサイ 縫采 +ホウサカ 芳坂 +ホウサカ 宝坂(寳坂) +ホウサカ 法坂 +ボウサカ 坊坂 +ホウサキ 宝崎(寶崎) +ホウサキ 法崎 +ホウサキ 寳崎 +ホウザキ 芳崎 +ホウザキ 宝崎(寶崎) +ホウザキ 法崎 +ホウザキ 鳳崎 +ホウザキ 宝埼 +ホウザキ 放崎 +ホウザキ 法嵜 +ホウザキ 寳崎 +ボウサキ 棒崎 +ボウザキ 嵭崎 +ボウサク 坊作 +ホウサコ 宝迫 +ホウサコ 寶迫 +ボウサコ 坊迫 +ホウサノ 柞野 +ホウサヤマ 柞山 +ホウサワ 宝沢(宝澤) +ホウサワ 法沢 +ホウサワ 法澤 +ホウサワ 寶沢 +ホウザワ 朴沢 +ホウザワ 宝沢(宝澤) +ホウザワ 朴澤 +ホウザワ 寶澤 +ホウザワ 寳澤 +ボウザワ 坊沢 +ホウザン 宝山(寶山) +ホウザン 保山 +ホウザン 寳山 +ホウシ 傍士 +ホウシ 方志 +ホウシ 芳司 +ホウシ 法師 +ホウシ 蓬茨 +ホウジ 傍士 +ホウジ 宝地 +ホウジ 保地 +ホウジ 芳司 +ホウジ 宝示 +ホウジ 放示 +ホウジ 法地 +ホウジ 坊寺 +ホウジ 宝寺 +ホウジ 放寺 +ホウジ 寶示 +ホウジ 寶地 +ボウシ 傍士 +ボウシ 帽子 +ボウジ 傍士 +ホウジアン 法事庵 +ホウジオカ 法寺岡 +ボウシタ 坊下 +ボウシタ 保下 +ホウジタニ 放寺谷 +ホウシト 法師人 +ホウシト 芳士戸 +ホウシト 芳志戸 +ホウシト 芳土戸 +ホウシド 法師人 +ホウシド 宝示戸 +ホウシド 芳士戸 +ホウシド 芳志戸 +ホウシド 芳師渡 +ホウシド 寶示戸 +ホウシド 寳示戸 +ホウジト 宝示戸 +ホウジト 宝珠戸 +ホウジト 寶示戸 +ホウジト 寳示戸 +ホウジド 芳寺戸 +ホウシハマ 法師浜(法師濱) +ホウシマ 法島 +ホウシマ 宝島 +ホウシマ 法嶋 +ホウシマ 寳島 +ホウシマ 寳嶋 +ホウジマ 法島 +ホウジマ 宝島 +ホウジマ 宝嶋 +ホウジマ 法嶋 +ボウジマ 傍島 +ホウシマル 宝子丸(寶子丸) +ホウシマル 法師丸 +ホウシマル 寳子丸 +ホウシャク 宝積 +ホウシャク 宝尺(寶尺) +ホウシャク 方尺 +ホウシャク 寶積 +ホウシャク 方釈 +ホウシャク 寳尺 +ホウシャク 寳積 +ホウジャク 方尺 +ホウシヤマ 宝珠山(寳珠山) +ホウシヤマ 宝子山(寶子山) +ホウシヤマ 法師山 +ホウシヤマ 寶珠山 +ホウシヤマ 寳子山 +ボウシヤマ 帽子山 +ホウシュ 奉守 +ホウジュ 宝珠 +ホウジュ 宝寿 +ホウジュ 奉寿 +ホウジュ 寳珠 +ホウジュアン 法寿庵 +ボウシュウ 房州 +ボウシュウ 房洲 +ホウジュト 宝珠戸 +ホウシュヤマ 宝珠山(寳珠山) +ホウシュヤマ 寶珠山 +ホウジュヤマ 宝珠山(寳珠山) +ホウジュヤマ 寶珠山 +ホウジュヤマ 宝殊山 +ホウショ 宝諸 +ホウショ 法所 +ホウショ 奉書 +ホウショ 寶諸 +ホウショ 寳諸 +ボウショ 坊所 +ホウショウ 保正 +ホウショウ 宝生(寶生・寳生) +ホウショウ 法正 +ホウショウ 蓬生 +ホウショウ 宝正(寳正) +ホウショウ 宝勝(寶勝) +ホウショウ 宝性 +ホウショウ 奉生 +ホウショウ 芳匠 +ホウジョウ 北条 +ホウジョウ 北條 +ホウジョウ 北城 +ホウジョウ 放生 +ホウジョウ 豊城 +ホウジョウ 保正 +ホウジョウ 方城 +ホウジョウ 宝城 +ホウジョウ 法上 +ホウジョウ 保条 +ホウジョウ 宝上 +ホウジョウ 方丈 +ホウジョウ 放上 +ホウジョウ 北篠 +ホウジョウ 北絛 +ホウジョウ 宝定 +ホウジョウ 法城 +ホウジョウ 鳳城 +ホウジョウ 宝条 +ホウジョウ 奉城 +ホウジョウ 法定 +ホウジョウ 鳳条 +ホウジョウ 寳上 +ホウジョウ 寳城 +ホウジョウ 包城 +ホウジョウ 邦城 +ボウジョウ 坊上 +ボウジョウ 坊城 +ホウジョウエ 放生会(放生會) +ホウジョウジ 法城寺 +ホウシロ 保城 +ホウジロ 喰代 +ホウシン 法心 +ホウシン 奉新 +ホウジン 宝神 +ホウジン 寳神 +ホウス 宝珠 +ホウス 寳珠 +ホウズ 宝渦 +ホウスイ 法水 +ホウスイ 豊水 +ホウスイ 宝水 +ホウズミ 宝積 +ホウズミ 八月朔日 +ホウズミ 宝角(寶角・寳角) +ホウズミ 宝住 +ホウズミ 芳炭 +ホウズミ 寳住 +ホウセイ 法正 +ホウセイ 宝勢(寶勢) +ホウセキ 宝積 +ホウセキ 宝関(寳関) +ホウセキ 寳積 +ホウセン 宝泉 +ホウセン 宝川(寳川) +ホウセン 宝船 +ホウセン 法泉 +ホウセン 法専 +ホウセン 宝仙 +ホウセン 宝専 +ホウセン 寶泉 +ホウセン 寶船 +ホウセン 寶舩(寳舩) +ホウセン 寳泉 +ホウセン 法銭 +ホウゼン 保前 +ホウゼン 宝前 +ホウセンジ 法泉寺 +ホウセンボウ 宝泉坊 +ホウソ 法蘇 +ホウソ 法蘓 +ホウソウ 保宗 +ホウゾウ 宝蔵(寳蔵・寶蔵) +ホウゾウ 宝藏(寳藏・寶藏) +ホウゾウ 法蔵 +ホウゾウイン 宝蔵院 +ホウゾウジ 宝蔵寺(寶蔵寺) +ホウゾウジ 宝藏寺(寶藏寺) +ホウゾウジ 宝蔵地 +ホウゾウジ 寳藏寺 +ホウゾノ 宝園(寶園) +ボウゾノ 坊薗 +ボウゾノ 房園(房薗) +ボウゾノ 坊園 +ホウタ 宝田 +ホウタ 方田 +ホウタ 寶田 +ホウタ 寳田 +ホウダ 保田 +ホウダ 宝田 +ホウダ 祝田 +ホウダ 方田 +ホウダ 法田 +ホウダ 喰田 +ホウダ 寶田 +ホウダ 寳田 +ボウタ 保田 +ボウタ 坊田 +ボウタ 棒田 +ボウダ 保田 +ボウダ 坊田 +ボウダ 房田 +ボウダ 棒田 +ボウダ 帽田 +ボウダ 防田 +ホウタイ 布袋 +ホウダイ 宝代 +ホウダイ 蓬台 +ホウダイ 逢台 +ホウダイ 保代 +ホウダイ 蓬臺 +ホウダイ 寶代 +ホウダイ 寳代 +ホウダイジ 宝代地(寳代地) +ホウダイジ 法代地 +ホウダイジ 宝大寺 +ホウダイジ 寶代地 +ホウダイラ 宝平 +ホウダイラ 寳平 +ホウタツ 宝達 +ホウタツ 寶達 +ホウダツ 宝達 +ホウダツ 寶達 +ホウダツ 寳達 +ホウタニ 宝谷(寳谷) +ホウタニ 法谷 +ホウタニ 方谷 +ホウタニ 寶谷 +ホウダニ 法谷 +ホウダニ 寶谷 +ボウタニ 棒谷 +ボウタニ 坊谷 +ボウダマ 防玉 +ホウチ 芳地 +ホウチ 宝地 +ホウチ 保地 +ホウチ 宝池(寳池) +ホウチ 放地 +ホウチ 宝智 +ホウチ 法地 +ホウチ 寶地 +ホウチ 寶池 +ホウチ 寳地 +ボウチ 坊地 +ボウチ 房地 +ボウチ 防地 +ホウチガイ 方違 +ホウチト 宝地戸(寳地戸) +ホウチド 宝地戸(寳地戸) +ホウチュウ 宝中 +ホウチョウ 庖刀 +ホウチョウ 庖丁 +ホウチン 宝珍 +ホウチン 保珍 +ホウチン 宝珎(寶珎・寳珎) +ホウチン 寶珍 +ホウツカ 宝都賀 +ホウヅカ 宝塚 +ホウヅカ 寶塚 +ホウツキ 面 +ホウツキ 宝槻 +ホウツキ 寶槻 +ホウツキ 寳槻 +ボウヅクリ 坊作 +ホウヅチ 宝槌(寳槌) +ホウヅマ 宝妻 +ホウヅミ 宝積 +ホウヅミ 寶積 +ホウヅミ 寳積 +ホウデ 洞出 +ホウデ 放出 +ホウデ 宝出 +ボウテ 棒手 +ボウデ 保出 +ボウデ 坊出 +ボウデ 房出 +ホウデン 法伝 +ホウデン 法傳 +ボウデン 坊伝 +ボウデン 坊傳 +ホウデンジ 法伝寺 +ホウト 法戸 +ホウド 法土 +ホウド 宝土 +ホウド 法戸 +ホウトウ 方藤 +ホウトウ 葆東 +ホウドウ 方堂 +ホウドウ 法堂 +ホウドウ 宝道 +ホウドウ 法道 +ホウトウゲ 朴峠 +ホウドウジ 法道寺 +ホウトク 宝徳(寳徳) +ホウトク 寶徳 +ホウドジ 法土寺 +ホウナイ 宝内 +ボウナカ 坊中 +ボウナン 坊南 +ホウニシ 芳西 +ボウニシ 坊西 +ホウニン 法忍 +ホウネン 豊年 +ホウノ 芳野 +ホウノ 宝野 +ホウノ 法野 +ホウノ 蓬野 +ホウノ 寶野 +ホウノ 寳野 +ボウノ 坊野 +ボウノ 房野 +ボウノ 保野 +ボウノ 坊農 +ボウノ 防野 +ホウノウ 宝納(寳納) +ホウノウ 寶納 +ボウノウ 坊農 +ボウノウ 坊濃 +ボウノウチ 坊ノ内 +ホウノキ 朴木 +ホウノキ 厚木 +ホウノキ 厚朴 +ホウノキ 宝ノ木 +ホウノキダ 朴田 +ホウノキダテ 朴舘 +ホウノキダテ 朴館 +ホウノキダニ 朴谷 +ボウノシタ 坊ノ下 +ボウノシタ 坊之下 +ボウノソノ 坊之園 +ホウノタニ 法野谷 +ボウノモト 坊之本 +ボウノモト 坊の本 +ホウハシ 法橋 +ホウハシ 方橋 +ホウハナ 法花 +ホウバナ 法花 +ホウハラ 芳原 +ホウバラ 芳原 +ボウハラ 坊原 +ボウビ 棒火 +ボウヒキ 棒引 +ホウフク 宝福(寳福) +ホウフク 法福 +ホウフク 寶福 +ホウベン 方便 +ホウボ 宝保(寳保) +ホウボ 寶保 +ボウボシ 棒星 +ホウマ 放馬 +ボウマエ 坊前 +ホウマサ 法正 +ホウマツ 宝松 +ホウマン 宝満(宝滿) +ホウマン 寶満(寶滿) +ホウマン 寳満 +ホウマン 寳滿 +ホウミ 宝見 +ホウミゾ 宝溝 +ホウミョウ 宝明(寶明) +ホウミョウ 法名 +ホウミョウ 法妙 +ボウムカイ 坊向 +ボウムキ 坊向 +ホウムラ 法村 +ホウムラ 法邑 +ホウムラ 宝村(寳村・寶村) +ボウムラ 坊村 +ホウモチ 宝持(寶持) +ホウモチ 寳持 +ホウモツ 宝持(寶持) +ホウモト 宝本 +ホウモト 法元 +ホウモト 法本 +ボウモト 棒本 +ボウモト 坊本 +ホウモリ 法守 +ホウモリ 法森 +ホウモン 宝門(寳門) +ホウヤ 保谷 +ホウヤ 宝谷(寳谷) +ホウヤ 朴谷 +ホウヤ 寶谷 +ホウヤ 鵬谷 +ボウヤ 保谷 +ボウヤ 棒谷 +ボウヤ 保屋 +ホウヤギ 宝柳(寳柳) +ホウヤシキ 宝屋敷 +ボウヤシキ 坊屋敷 +ボウヤシキ 坊屋鋪 +ボウヤシキ 坊屋舗 +ホウヤマ 法山 +ホウヤマ 宝山(寶山) +ホウヤマ 鳳山 +ホウヤマ 苞山 +ホウヤマ 包山 +ボウヤマ 坊山 +ホウヨウ 法用 +ホウヨウ 奉養 +ホウヨウ 朴養 +ホウラ 保浦 +ボウラ 坊良 +ホウライ 蓬莱 +ホウライ 宝来 +ホウライ 蓬来(蓬來) +ホウライ 寶来 +ホウライ 逢来 +ホウライ 逢莱 +ホウライ 宝莱 +ホウライ 宝耒 +ホウライ 蓬菜 +ホウライ 蓬耒 +ホウライ 寶莱 +ホウライ 寶來 +ホウライ 寶耒 +ホウライ 寳来 +ホウライ 寳來 +ホウライ 寳耒 +ホウライタニ 蓬莱谷 +ホウライヤ 蓬莱谷 +ホウライヤ 蓬来谷 +ホウラク 宝楽 +ホウラク 方楽 +ホウラク 寶樂 +ホウラク 寳樂 +ホウリ 祝 +ホウリ 祝部 +ホウリ 宝利 +ホウリ 宝里(寳里) +ホウリ 宝理(寶理・寳理) +ホウリ 芳里 +ホウリ 法理 +ホウリ 法利 +ホウリ 法里 +ホウリ 祝子 +ホウリ 賓利 +ホウリ 鳳利 +ホウリ 寶利 +ホウリ 寳利 +ホウリキ 宝力(寳力) +ホウリキ 法力 +ホウリュウ 法隆 +ホウリュウ 宝龍(寳龍) +ホウリュウ 宝立 +ホウリュウ 宝竜 +ホウリュウ 砲流 +ホウリュウ 炮流 +ホウリュウイン 法龍院(法竜院) +ホウリュウジ 法隆寺 +ホウリョウ 法量 +ホウリョウ 法両 +ホウリョウザキ 法霊崎(法㚑崎) +ホウリョウザキ 法量崎 +ホウリョウダ 法領田 +ホウリン 法林 +ホウレン 法連 +ホウロク 鉋六 +ホウロク 法録 +ホウワ 宝輪 +ホウワ 芳輪 +ホエ 帆江 +ホエギ 吠木 +ホエタニ 杪谷 +ホエモ 保栄茂(保榮茂) +ホオ 保尾 +ホオカベ 波々伯部 +ホオカベ 佐伯部 +ホオガミ 伯々上 +ホオザワ 朴沢 +ホオザワ 朴澤 +ホオジロ 喰代 +ホオツキ 面 +ホオノキ 朴木 +ホオノキ 厚木 +ホオノキ 鳳木 +ホオリ 祝部 +ホカ 外 +ホカ 補伽 +ホカ 保家 +ホガ 保賀 +ホカアカ 外赤 +ホカアタリ 外当(外當) +ホカイ 外井 +ホカイ 保海 +ホカイケ 外池 +ホカイワト 外岩戸 +ホカイワド 外岩戸 +ホカウラ 外浦 +ホカオ 外尾 +ホカカリヤ 外仮屋 +ホガキ 穂垣 +ホガキ 保垣 +ホガキ 穗垣 +ホカキド 外城戸 +ホカク 帆角 +ホカク 保格 +ホカグチ 外口 +ホカクボ 外窪 +ホカゲ 帆影 +ホカゲ 帆景 +ホガサコ 芳ケ迫 +ホカジョウ 外城 +ホガシワ 法柏 +ホカセ 外勢 +ホカゼ 帆風 +ホカソノ 外園 +ホカゾノ 外園 +ホカゾノ 外薗 +ホカゾノ 外囿 +ホカダ 外田 +ホカタケ 外竹 +ホカタネダ 外種子田 +ホカタネダ 外種田 +ホカツ 法華津 +ホカツ 法花津 +ホカツネミ 外恒見 +ホカト 外戸 +ホカニシ 外西 +ホカノ 外野 +ホガノ 母ケ野 +ホカハラ 外原 +ホガフチ 保ケ淵 +ホガフチ 保ケ渕 +ホカベ 保ケ部 +ホカベ 保日部 +ホカベ 保ケ辺(保ケ邊) +ホカベ 保下部 +ホカホノキ 外甫木 +ホカホリ 外堀 +ホカボリ 外堀 +ホカマ 外間 +ホカマエダ 外前田 +ホカマキ 外牧 +ホカマジョウ 外間門 +ホガミ 布上 +ホガミ 保上 +ホガミ 穂上 +ホカミヤ 外宮 +ホカムラ 外村 +ホカムロ 外室 +ホカモト 外本 +ホカヤ 外屋 +ホカヤシキ 外屋敷 +ホカヤマ 外山 +ホガラ 朗 +ホカリ 穂苅 +ホカリ 帆苅 +ホカリ 保苅 +ホカリ 穂刈 +ホカリ 帆刈 +ホカリ 保刈 +ホカリ 甫仮 +ホカリ 外里 +ホカリ 帆加利 +ホカリ 穗刈 +ホカリ 穗苅 +ホガリ 穂苅 +ホガリ 帆苅 +ホガリ 保苅 +ホガリ 穂刈 +ホガリ 帆刈 +ホガリ 保刈 +ホカワ 保川 +ホカワ 穂川 +ホガワ 保川 +ホガワ 穂川 +ホキ 保木 +ホキ 甫木 +ホキ 保城 +ホキ 穂木 +ホキ 保喜 +ホキ 浦鬼 +ホギ 保木 +ホギ 甫木 +ホギ 穂木 +ホキイ 保木井 +ホキグチ 保木口 +ホキグチ 保気口(保氣口) +ホキシタ 保木下 +ホキタ 帆北 +ホキタ 穂北 +ホキノ 保木野 +ホキノウエ 洞ノ上 +ホキノウエ 帆木ノ上 +ホキノウエ 帆木の上 +ホキノウエ 帆木上 +ホキヒラ 保木平 +ホキモト 保木本 +ホキモト 甫喜本 +ホキモト 掃本 +ホキモト 甫木元 +ホキモト 𡵅本 +ホキモト 保木元 +ホギモト 保木本 +ホキヤマ 穂岐山 +ホキヤマ 甫喜山 +ホキヤマ 保木山 +ホキヤマ 甫木山 +ホキヤマ 穗岐山 +ホキワキ 保木脇 +ホク 保久 +ボクイ 朴井 +ホクウエ 保久上 +ホクエ 北江 +ホクゴ 北後 +ホクゴウ 北郷 +ホクコク 北国 +ホクシュ 北守 +ホクショウ 北荘 +ホクジョウ 北条 +ホクジョウ 北條 +ホクシン 北辰 +ボクタ 木田 +ボクタ 朴田 +ボクダ 木田 +ホクチ 北地 +ホグチ 穂口(穗口) +ホグチ 保口 +ホクツ 補沓 +ホクト 北斗 +ホクトウ 北東 +ホクナン 北南 +ホクネ 北子 +ホクハラ 保久原 +ボクハラ 朴原 +ボクハラ 樸原 +ホクバル 保久原 +ボクハン 卜半 +ホクボ 北保 +ホクムラ 保久村 +ボクムラ 朴村 +ホクメン 北面 +ホクモト 北本 +ボクモト 朴本 +ホクモリ 保久盛 +ボクヤマ 朴山 +ホクヨウ 北陽 +ホクラ 保倉 +ホクラ 穂倉 +ボクラ 卜蔵 +ボクラ 卜倉 +ボクラ 卜藏 +ボクラ 木蔵 +ボクラ 木藏 +ホクレイ 北嶺 +ホグロ 保黒 +ホケ 保家 +ホケ 保毛 +ホケ 穂毛 +ホケズ 法化図 +ホケツ 法華津 +ホケツ 法花津 +ホケヅ 法華津 +ホケヅ 保毛津 +ホコ 保古 +ホコ 鉾 +ホコ 戟 +ホコイ 鉾井 +ホコイシ 鉾石 +ホコイワ 鉾岩 +ホコウラ 鉾浦 +ホゴオリ 保郡 +ホコキ 鉾木 +ホコギ 鉾木 +ホコサキ 鉾崎 +ホコサキ 鋒崎 +ホコサキ 鉾碕 +ホコザキ 鉾崎 +ホコザキ 鋒崎 +ホコシタ 鉾下 +ホコシロ 鋒城 +ホコタ 鉾田 +ホコダ 鉾田 +ホコダ 鋒田 +ホコタチ 鉾立 +ホコタテ 鉾立 +ホコタテ 鉾建 +ホコダテ 鉾立 +ホコダテ 鉾建 +ホコダテ 鉾館 +ホコダテ 鋒楯 +ホコタニ 鉾谷 +ホコタニ 鋒谷 +ホコネ 鉾根 +ホコノキ 鉾木 +ホコノハラ 鉾之原 +ホコバヤシ 鉾林 +ホコハラ 鉾原 +ホコマル 鉾丸 +ホコモト 鉾本 +ホコヤ 鉾屋 +ホコヤ 鋒屋 +ホコヤマ 鋒山 +ホコヤマ 鉾山 +ホコラ 洞 +ホサイン 歩嵯胤 +ホサイン 宝財院 +ホサカ 保坂 +ホサカ 穂坂 +ホサカ 保阪 +ホサカ 甫坂 +ホサカ 穂阪 +ホサカ 帆坂 +ホサカ 穗坂 +ホサカ 穗阪 +ホザカ 保坂 +ホザカ 穂坂 +ホサキ 保崎 +ホサキ 穂崎 +ホサキ 帆先 +ホサキ 穂先 +ホザキ 保崎 +ホザキ 穂崎 +ホザキ 帆崎 +ホサコ 穂迫(穗迫) +ホサコ 保迫 +ホサヤマ 柞山 +ホザワ 保沢 +ホザワ 保澤 +ホザワ 褒沢 +ホザワ 褒澤 +ホザン 保山 +ホシ 星 +ホシ 保志 +ホシ 帆士 +ホシ 保子 +ホシ 保司 +ホシ 保士 +ホシ 穂志 +ホジ 保地 +ホジ 保路 +ホシアイ 星合 +ホシアキ 星明 +ホシアン 星庵 +ホシイ 星井 +ホシイ 干飯 +ホシイ 糒 +ホシイ 干井 +ホシイ 星居 +ホシイズミ 星泉 +ホシイダ 星井田 +ホシイワ 保志岩 +ボジイワ 暮地岩 +ホシウラ 星浦 +ホシエ 星衛 +ホシエ 星江 +ホシオ 星尾 +ホシオ 穂入 +ホシオカ 星岡 +ホシオカ 星丘 +ホジオカ 法寺岡 +ホシカ 星加 +ホシガ 星賀 +ホシガ 欲賀 +ホシガ 干賀 +ホシカド 保志門 +ホシカネ 星金 +ホシガミ 星上 +ホシガミ 干上 +ホシガミ 星神 +ホシカメ 星亀 +ホシカヤ 干鰯谷 +ホシカヤ 星加屋 +ホシカワ 星川 +ホシカワ 干川 +ホシカワ 星河 +ホシカワ 星州 +ホシキ 星木 +ホシクキ 星久木 +ホシクボ 星久保 +ホシクマ 星隈 +ホシクマ 星熊 +ホシクラ 星倉 +ホシコ 星子 +ホシゴエ 星越 +ホシコシ 星越 +ホシコシ 干越 +ホシゴシ 干越 +ホシサカ 星坂 +ホシサキ 星先 +ホシザキ 星崎 +ホシザキ 星先 +ホシザキ 星嵜 +ホシサシ 星指 +ホシサト 星里 +ホシザト 星里 +ホシザワ 星沢 +ホシザワ 星澤 +ホシシタ 星下 +ホシシバ 星芝 +ホシジマ 星島 +ホシジョウ 保志条 +ホシズミ 星住 +ホシタ 星田 +ホシタ 干田 +ホシタ 穂下 +ホシダ 星田 +ホシダ 干田 +ボシタ 保下 +ホシタカ 干高 +ホシタケ 星武 +ホシタニ 星谷 +ホシタニ 干谷 +ホシツ 星津 +ホシヅ 星津 +ホシヅカ 星塚 +ホシヅキ 星月 +ホシデ 星出 +ホシト 法師人 +ホシト 星戸 +ホジト 宝示戸 +ホジト 保知戸 +ホシドウ 星銅 +ホシトク 星徳 +ボシドマリ 母子泊 +ホシナ 保科 +ホシナ 星名 +ホシナ 保志名 +ホシナ 星奈 +ホシナ 法信 +ホシナ 穂科 +ホシナカ 星中 +ホシナカ 星仲 +ホシナガ 星長 +ホシナガ 星永 +ホシナミ 斗南 +ホシナミ 星次 +ホシナミ 星波 +ホシネ 星根 +ホシノ 星野 +ホシノ 干野 +ホシノ 星埜 +ホシノ 星乃 +ホシノ 斗野 +ホシノ 保志野 +ホシノ 星志野 +ホシノ 星能 +ホシノ 穂志野 +ホシノイ 星野井 +ホシノウチ 星之内 +ホシノオ 星野尾 +ホシノクロ 星野黒 +ホシノブ 星信 +ホシノボリ 皨昇 +ホシノミヤ 星宮 +ホシノミヤ 星ノ宮 +ホシノヤ 星野谷 +ホシノヤ 星ノ谷 +ホシバ 干場 +ホシバ 星場 +ホシバ 保志場 +ホシバ 潟場(瀉場) +ホシバ 干塲 +ホシバ 穂芝 +ホシハタ 星畑 +ホシハタ 干畠 +ホシハタ 干畑 +ホシバタ 星畑 +ホシハラ 星原 +ホシバリ 干張 +ホシヒラ 星平 +ホシフミ 星文 +ホシマ 保島 +ホシマ 星間 +ホジマ 保島 +ホジマ 穂島 +ホジマ 穂嶋 +ホシマル 星丸 +ホシミ 星見 +ホシミズ 干水 +ホシミツ 星光 +ホシミヤ 星宮 +ホシムネ 星宗 +ホシムラ 星村 +ホシムレ 星簇 +ホシムレ 星牟礼(星牟禮) +ホジメ 宝治米 +ホシモト 星本 +ホシモト 星元 +ホシモト 干元 +ホシモト 干本 +ホシモノ 干物 +ホシモリ 星守 +ホシモリ 星盛 +ホシャ 保社 +ホシヤ 星谷 +ホシヤ 星屋 +ホシヤ 干谷 +ホシヤス 星安 +ホシヤマ 星山 +ホシヤマ 干山 +ホジュ 保寿(保壽) +ホジュト 宝珠戸 +ホショウ 保正 +ホショウ 保昌 +ホジョウ 保城 +ホジョウ 保上 +ホジョウ 保条 +ホジョウ 保條 +ホシロ 保城 +ホシロ 帆代 +ホシロ 星呂 +ホシワキ 星脇 +ホスギ 保杉 +ホズキ 保月 +ホスミ 八角 +ホスミ 保住 +ホズミ 穂積 +ホズミ 八角 +ホズミ 保泉 +ホズミ 保住 +ホズミ 保積 +ホズミ 宝積 +ホズミ 八月朔日 +ホズミ 保栖 +ホズミ 保角 +ホズミ 八月一日 +ホズミ 穂住 +ホズミ 八朔日 +ホセイ 保清 +ホセイン 保世院 +ホセキ 保関 +ホセン 保仙 +ホソ 細 +ホソアイ 細合 +ホソイ 細井 +ホソイ 細居 +ホソイ 保曾井(保曽井) +ホソイケ 細池 +ホソイシ 細石 +ホソイト 細糸 +ホソイド 細井戸 +ホソイリ 細入 +ホゾウ 保蔵 +ボソウ 母倉 +ホソウチ 細内 +ホソウミ 細海 +ホソウメ 細梅 +ホソウラ 細浦 +ホソエ 細江 +ホソエ 細杖 +ホソエガワ 細江川 +ホソオ 細尾 +ホソオカ 細岡 +ホソオキ 細沖 +ホソカイ 細貝 +ホソカイ 細海 +ホソカイ 細界 +ホソガイ 細貝 +ホソガキ 細垣 +ホソカネ 細金 +ホソカネ 細包 +ホソガネ 細金 +ホソカミ 細上 +ホソガミ 細上 +ホソカヤ 細萱 +ホソガヤ 細萱 +ホソガヤ 細ケ谷 +ホソガリ 細狩 +ホソカワ 細川 +ホソカワ 細河 +ホソカワ 保曽川 +ホソキ 細木 +ホソギ 細木 +ホソギシ 細岸 +ホソキハラ 細木原 +ホソキバラ 細木原 +ボソク 拇速 +ホソグチ 細口 +ホソクニ 細国 +ホソクニ 細國 +ホソクボ 細窪 +ホソクボ 細久保 +ホソクラ 細倉 +ホソコウジ 細小路 +ホソゴエ 細越 +ホソゴエザワ 細越沢 +ホソゴエザワ 細越澤 +ホソコシ 細越 +ホソゴシ 細越 +ホソコシザワ 細越沢 +ホソコシザワ 細越澤 +ホソコシヤマ 細越山 +ホソサカ 細坂 +ホソザキ 細崎 +ホソサコ 細迫 +ホソサコ 細峪 +ホソザコ 細峪 +ホソサワ 細沢 +ホソサワ 細澤 +ホソザワ 細沢 +ホソザワ 細澤 +ホソジ 細字 +ホソジ 細路 +ホソジ 細地 +ホソシタ 細下 +ホソシマ 細島 +ホソジマ 細島 +ホソジマ 臍島 +ホソジマ 細嶋 +ホソジリ 細尻 +ホソスギ 細杉 +ホソスナ 細砂 +ホソズミ 細住 +ホソセ 細瀬 +ホソセ 細勢 +ホソゾノ 細園 +ホソゾノ 細薗 +ホソタ 細田 +ホソダ 細田 +ホソタカ 細高 +ホソタキ 細瀧 +ホソタケ 細竹 +ホソタニ 細谷 +ホソタニ 細渓 +ホソタニ 細溪 +ホソダニ 細谷 +ホソダワ 細垰 +ホソツ 細津 +ホソツカ 細束 +ホソヅカ 細束 +ホソツジ 細辻 +ホソツボ 細坪 +ホソド 細戸 +ホソド 細土 +ホソトウゲ 細峠 +ホソナ 細名 +ホソナカ 細中 +ホソナガ 細永 +ホソナガ 細長 +ホソナガ 保曾永 +ホソナミ 細波 +ホソナミ 細浪 +ホソニシ 細西 +ホソヌノ 細布 +ホソヌマ 細沼 +ホソネ 細根 +ホソノ 細野 +ホソノ 穂園 +ホソノ 細埜 +ホゾノ 穂園 +ホゾノ 保園 +ホゾノ 穗園 +ホソノメ 細目 +ホソノヤ 細野谷 +ホソバ 細羽 +ホソバ 細葉 +ホソバ 細場 +ホソハシ 細橋 +ホソハタ 細畑 +ホソハタ 細畠 +ホソハタ 細機 +ホソバタ 細畑 +ホソバタ 細畠 +ホソバタ 細機 +ホソハマ 細浜(細濱) +ホソバミ 細羽見 +ホソハラ 細原 +ホソヒラ 細平 +ホソヒロ 細広 +ホソブチ 細淵 +ホソブチ 細渕 +ホソベ 細部 +ホソボラ 細洞 +ホソホリ 細堀 +ホソボリ 細堀 +ホソボリ 細掘 +ホソマ 細間 +ホソマ 細馬 +ホソマチ 細町 +ホソマツ 細松 +ホソマル 細丸 +ホソミ 細見 +ホソミ 細美 +ホソミ 細海 +ホソミ 細身 +ホゾミ 八月朔日 +ホソミズ 細水 +ホソミゾ 細溝 +ホソミチ 細道 +ホソミチ 細径 +ホソミツ 細光 +ホソムラ 細村 +ホソメ 細目 +ホソモト 細本 +ホソモト 細元 +ホソモノ 細物 +ホソモミ 細樅 +ホソモリ 細森 +ホソヤ 細谷 +ホソヤ 細矢 +ホソヤ 細屋 +ホソヤ 細家 +ホソヤジ 細谷地 +ホソヤシキ 細屋敷 +ホソヤチ 細谷地 +ホソヤナギ 細柳 +ホソヤマ 細山 +ホソヤマダ 細山田 +ホソリ 細里 +ホソロギ 細呂木 +ホソロギヤ 細呂木谷 +ホソワキ 細脇 +ホソワリ 細割 +ホソン 保尊 +ホタ 保田 +ホタ 穂田(穗田) +ホタ 甫田 +ホダ 保田 +ホダ 穂田(穗田) +ホダ 補陀 +ホダ 保多 +ホダ 歩田 +ホダ 補田 +ボタ 甫田 +ボダ 母田 +ホタイ 保田井 +ボダイ 菩提 +ボダイギ 保大木 +ボダイジ 菩提寺 +ボダイジ 菩堤寺 +ボダイノ 菩提野 +ホタカ 保高 +ホタカ 穂高 +ホタカ 帆高 +ホタカ 穂鷹(穗鷹) +ホダカ 保高 +ホダカ 穂高 +ホダカ 帆高 +ホダカ 穂鷹(穗鷹) +ホタダ 穂多田 +ホタダ 保多田 +ホタチ 保立 +ホタツ 保達 +ホタテ 保立 +ホタテ 甫立 +ホダテ 保立 +ホダテ 甫立 +ホタニ 保谷 +ホタニ 穂谷(穗谷) +ホタニ 帆谷 +ホタニ 䑺谷 +ホタニ 歩谷 +ホダニ 保谷 +ボタニ 暮谷 +ホダマ 帆玉 +ホタモリ 保田盛 +ホタモリ 保多盛 +ホタルハラ 蛍原 +ホタルハラ 螢原 +ホタルバラ 蛍原 +ホタルバラ 螢原 +ホダレ 穂垂 +ボタン 牡丹 +ホチ 保地 +ホチ 保知 +ホチ 保智 +ボチ 保智 +ボチイワ 暮地岩 +ホチト 保知戸 +ホチド 保知戸 +ボチモト 暮地本 +ホチヤ 保地谷 +ホヅ 保津 +ホヅ 保都 +ホッカ 法花 +ホッカ 法華 +ホツカ 穂束(穗束) +ホヅカ 穂束(穗束) +ホヅカ 穂塚 +ホッカイ 北海 +ボッカイ 渤海 +ホッカンジ 北寒寺 +ホツキ 保月 +ホヅキ 保月 +ホッキョウ 法橋 +ホッキリカワ 堀切川 +ホッキリガワ 堀切川 +ホック 北句 +ホッケ 法花 +ホッケ 法華 +ボッケ 北下 +ホッケツ 法花津 +ホッケヅ 法華津 +ホッケドウ 法花堂 +ホッコウ 北向 +ホッコク 北国 +ホッコク 北國 +ホッコクヤ 北国谷(北國谷) +ホッサカ 発坂(發坂) +ホツシタ 𡶒下 +ホッショウ 法性 +ホッシン 法身 +ホッセキ 北関 +ホッタ 堀田 +ホッタ 発田 +ホッタ 掘田 +ホッタ 發田 +ホツダ 穂津田 +ホッタイ 堀田井 +ホッタザワ 堀田沢(堀田澤) +ホッチ 堀地 +ホッチ 発知 +ホッチ 発地 +ホッチ 発智 +ホッチ 發知 +ホッチ 發智 +ホッチ 掘地 +ホッチ 發地 +ホツチ 發知 +ホツボ 母坪 +ボツボ 母坪 +ホッポウ 北方 +ホヅマ 秀真 +ホヅマ 秀眞 +ホツミ 穂積 +ホツミ 浦海 +ホヅミ 穂積 +ホヅミ 保積 +ホヅミ 宝積 +ホヅミ 八月朔日 +ホヅミ 穗積 +ホヅミ 葆積 +ホヅミ 穂穙 +ホテ 保手 +ホデ 甫出 +ホデ 保出 +ホテイ 布袋 +ホテイダ 布袋田 +ホテイヤ 布袋屋 +ホテキ 保滌 +ホテギ 仏木 +ホテギ 佛木 +ホテダ 保手田 +ホテハマ 保手浜 +ホテハマ 保手濱 +ホテヤ 布袋屋 +ホテヤ 布袋谷 +ホテン 甫天 +ホト 保戸 +ホド 程 +ホド 保土 +ホトイシ 帆戸石 +ホトウ 保東 +ホトウ 穂藤(穗藤) +ホトウ 保藤 +ホドウ 穂道 +ホドウ 保堂 +ホドウチ 程内 +ホドオ 程尾 +ホドオカ 程岡 +ホドガネ 程兼 +ホドカミ 程上 +ホドカワ 程川 +ホトギ 補伽 +ホトギ 仏木 +ホトギ 佛木 +ホトギ 缶 +ホドキ 程木 +ホドグチ 程口 +ホドクマ 程熊 +ホトケ 仏 +ホトケ 佛 +ホトケイシ 仏石 +ホトケイシ 佛石 +ホトケザカ 仏坂 +ホトケザカ 佛坂 +ホトケダ 佛田 +ホトケダ 仏田 +ホトケダオ 仏峠 +ホトケダニ 仏谷 +ホトケダニ 佛谷 +ホトケダワ 佛峠 +ホトケバラ 仏原 +ホトケバラ 佛原 +ホトケフチ 佛淵 +ホトケブチ 仏淵 +ホトケブチ 仏渕 +ホトケブチ 佛淵 +ホトケブチ 佛渕 +ホトケヤマ 仏山 +ホトケヤマ 佛山 +ホトザワ 保土沢 +ホトザワ 保土澤 +ホドサワ 保土沢 +ホドサワ 保土澤 +ホドシマ 程島 +ホドシマ 程嶋 +ホドジマ 程島 +ホドズカ 程塚 +ホトタ 保土田 +ホトタ 穂戸田(穗戸田) +ホトダ 保戸田 +ホトダ 保土田 +ホトダ 穂戸田(穗戸田) +ホトダ 保登田 +ホドタ 程田 +ホドタ 保土田 +ホドダ 程田 +ホドダ 保土田 +ホトヅカ 保戸塚 +ホドツカ 程塚 +ホドツカ 保土塚 +ホドヅカ 程塚 +ホドヅカ 保戸塚 +ホドヅカ 保土塚 +ホドツキ 程月 +ホドヅキ 程月 +ホドノ 程野 +ホトハラ 蛍原 +ホトハラ 穂登原 +ホドハラ 程原 +ホドハラ 保土原 +ホドマ 程間 +ホトミ 保富 +ホドメ 甫留 +ホドヤ 程谷 +ホトヤマ 保戸山 +ホドヤマ 程山 +ホドヤマ 保渡山 +ホドヤマ 保土山 +ホドヨシ 程吉 +ホドヨシ 程能 +ホトリ 辺 +ホトリ 阿 +ホトリ 邊 +ホトリ 邉 +ホトリネ 辺根 +ホナカ 甫中 +ホナガ 保永 +ホナガ 補永 +ホナガ 穂永(穗永) +ホナミ 穂波(穗波) +ホナミ 穂浪(穗浪) +ホナミ 穂並 +ホナミ 帆波 +ホナミ 穂竝(穗竝) +ホナミ 穗並 +ホニシ 保西 +ホニシ 帆西 +ホニワ 保庭 +ホネタ 骨田 +ホネダ 骨田 +ホネタニ 骨谷 +ホノ 保野 +ホノ 穂野 +ホノウエ 穂之上(穗之上) +ホノキ 甫木 +ホノキ 穂木 +ホノキ 厚朴 +ホノキ 甫ノ木 +ホノキダ 朴田 +ホノブ 本母 +ホノベ 保延 +ホノミ 穂見 +ホノミゾ 室溝 +ホハシ 保橋 +ホバタ 穂畑 +ホバタケ 穂畑 +ホバナ 保花 +ホバヤシ 保林 +ホハラ 穂原(穗原) +ホバラ 保原 +ホバラ 穂原(穗原) +ホビキ 帆引 +ホヒラ 保平 +ホフク 保福 +ホボ 保母 +ホボ 保浦 +ホボ 保々 +ホボ 帆保 +ホボ 粗 +ホボ 穂保 +ホボ 保甫 +ホボ 保方 +ホボ 甫母 +ホホウ 保宝 +ホボウ 保房 +ホホカベ 波々伯部 +ホホツキ 面 +ホボリ 保堀 +ホマエ 保前 +ホマエ 帆前 +ホマエ 穂前 +ホマキ 帆巻 +ホマツ 保松 +ホマル 穂丸 +ホマレ 誉 +ホマレカワ 誉川 +ホマレコウジ 誉功路 +ホマレダ 誉田 +ホマン 穂満 +ホマン 穂滿 +ホマン 穗満 +ホマン 穗滿 +ホミ 保見 +ホミ 浦海 +ホミ 保美 +ホミズ 甫水 +ホミツ 穂満 +ホミヤ 保宮 +ホムラ 本村 +ホムラ 布村 +ホムラ 保村 +ホムラ 穂村(穗村) +ホムラ 甫村 +ホムロ 保室 +ホメイ 保明 +ホメキ 法女木 +ホメモト 保米本 +ホモト 保本 +ホモト 穂本 +ホモト 甫本 +ホモト 帆本 +ホモト 穂元 +ホモト 穗本 +ホモリ 穂森 +ホモリ 甫守 +ホモリ 穂盛 +ホモリ 穗森 +ホヤ 保谷 +ホヤ 穂谷(穗谷) +ホヤシタ 穂屋下(穗屋下) +ホヤナギ 保柳 +ホヤノ 保屋野 +ホヤノ 穂谷野 +ホヤノ 梅干野 +ホヤノ 保谷野 +ホヤノ 梅千野 +ホヤノ 穗谷野 +ホヤマ 穂山(穗山) +ホヤマ 保山 +ホヤマ 帆山 +ホヤマ 補山 +ホヤマツ 保屋松 +ホユウ 保勇 +ホヨウ 保要 +ホヨシ 保吉 +ホヨシ 保楊枝 +ホヨセ 穂寄 +ホラ 洞 +ホラ 保良 +ボラ 鰡 +ホライ 洞井 +ホラウチ 洞内 +ホラオ 洞尾 +ホラオク 洞奥 +ホラガイ 洞谷 +ホラガイ 螺 +ホラガイト 洞垣内 +ホラガキ 洞垣 +ホラガミ 洞上 +ホラギリ 洞桐 +ホラグチ 洞口 +ホラゲ 洞下 +ホラゲ 洞毛 +ホラサキ 洞崎 +ホラサキ 洞先 +ホラザキ 洞崎 +ホラサワ 洞沢 +ホラサワ 洞澤 +ホラジ 洞地 +ホラシタ 洞下 +ホラタ 洞田 +ホラダ 洞田 +ホラタニ 洞谷 +ホラチ 洞地 +ホラデ 洞出 +ホラド 洞戸 +ホラナイ 洞内 +ホラノ 洞野 +ホラノクチ 洞ノ口 +ホラノグチ 洞ノ口 +ホラヒラ 洞平 +ホラミズ 洞水 +ホラモト 洞本 +ホラヤ 洞谷 +ホラヤ 洞家 +ホラヤマ 洞山 +ホラヤマ 螺山 +ホリ 堀 +ホリ 保利 +ホリ 保里 +ホリ 掘 +ホリ 芳里 +ホリ 保理 +ホリ 隍 +ホリ 壕 +ホリ 甫里 +ボリ 母里 +ボリ 母理 +ホリアイ 堀合 +ホリイ 堀井 +ホリイ 堀居 +ホリイ 掘井 +ホリイエ 堀家 +ホリイケ 堀池 +ホリイケ 掘池 +ホリイシ 堀石 +ホリイズミ 堀泉 +ホリイチ 堀一 +ホリウエ 堀上 +ホリウチ 堀内 +ホリウチ 堀打 +ホリウチ 湟打 +ホリウチ 掘内 +ホリウミ 堀海 +ホリエ 堀江 +ホリエ 保理江 +ホリエ 掘江 +ホリエ 堀栄 +ホリエ 塹江 +ホリエ 堀恵 +ホリエ 堀榮 +ホリエヤ 堀江屋 +ホリオ 堀尾 +ホリオ 掘尾 +ホリオ 堀生 +ホリオカ 堀岡 +ホリオカ 掘岡 +ホリオク 堀奥 +ホリガ 堀賀 +ホリガキ 堀垣 +ホリカケ 堀欠 +ホリカゴ 堀籠 +ホリカゴ 堀篭 +ホリカネ 堀金 +ホリカネ 堀兼 +ホリカネ 掘金 +ホリガネ 堀金 +ホリガネ 掘金 +ホリカミ 堀上 +ホリガミ 堀上 +ホリカメ 堀亀 +ホリガメ 堀亀 +ホリカワ 堀川 +ホリカワ 堀河 +ホリカワ 掘川 +ホリカワ 湟川 +ホリカワ 保里川 +ホリガワ 堀川 +ホリカン 堀貫 +ホリキ 堀木 +ホリキ 掘木 +ホリキ 堀起 +ホリキ 堀城 +ホリキタ 堀北 +ホリキダ 堀木田 +ホリキリ 堀切 +ホリキリ 掘切 +ホリキリカワ 堀切川 +ホリキリガワ 堀切川 +ホリキリゾノ 堀切園 +ホリギワ 堀際 +ホリクチ 堀口 +ホリグチ 堀口 +ホリグチ 掘口 +ホリクビ 堀首 +ホリクマ 堀熊 +ホリケ 堀家 +ホリケ 堀毛(掘毛) +ホリケ 掘家 +ホリゲ 堀毛(掘毛) +ホリコ 堀子 +ホリコ 堀古 +ホリコ 堀小 +ホリゴ 堀後 +ホリコウ 堀向 +ホリコシ 堀越 +ホリコシ 掘越 +ホリコシ 堀腰 +ホリゴシ 堀越 +ホリコミ 堀込 +ホリゴミ 堀込 +ホリコメ 堀米 +ホリコメ 堀込 +ホリゴメ 堀米 +ホリゴメ 堀込 +ホリゴメ 堀籠 +ホリゴメ 堀篭 +ホリゴメ 掘米 +ホリゴメ 掘篭 +ホリゴメ 掘込 +ホリゴメ 掘籠 +ホリゴメ 堀蘢 +ホリゴメ 掘龍 +ホリサカ 堀坂 +ホリサカ 堀阪 +ホリサカ 掘坂 +ホリサキ 堀崎 +ホリサキ 堀埼 +ホリサキ 堀嵜 +ホリザキ 堀崎 +ホリザキ 堀嵜 +ホリサコ 堀迫 +ホリサト 堀里 +ホリサワ 堀沢 +ホリサワ 堀澤 +ホリサワ 掘沢 +ホリザワ 堀沢 +ホリザワ 堀澤 +ホリシ 堀士 +ホリシゲ 堀重 +ホリシタ 堀下 +ホリシタ 掘下 +ホリシマ 堀島 +ホリシマ 堀嶋 +ホリジマ 堀島 +ホリシミズ 堀清水 +ホリジリ 堀尻 +ホリシロ 堀代 +ホリス 堀壽 +ホリスエ 堀末 +ホリスギ 堀杉 +ホリスギ 掘杉 +ホリスジ 堀筋 +ホリスミ 堀角 +ホリスミ 堀澄 +ホリズミ 堀住 +ホリズミ 堀角 +ホリズミ 堀澄 +ホリセ 堀瀬 +ホリソエ 堀添 +ホリゾエ 堀添 +ホリゾエ 掘添 +ホリソコ 堀底 +ホリゾノ 堀苑 +ホリゾノ 堀園 +ホリタ 堀田 +ホリタ 掘田 +ホリダイラ 堀平 +ホリタカ 堀高 +ホリタケ 堀竹 +ホリタサワ 堀田沢(堀田澤) +ホリタザワ 堀田沢(堀田澤) +ホリタテ 堀立 +ホリタテ 堀館 +ホリタテ 堀舘 +ホリタテ 掘立 +ホリタニ 堀谷 +ホリダン 堀段 +ホリチ 堀地 +ホリチカ 堀近 +ホリツ 堀津 +ホリツカ 堀束 +ホリツギ 堀次 +ホリツグ 堀次 +ホリツジ 堀辻 +ホリツネ 堀常 +ホリヅメ 堀詰 +ホリデ 堀出 +ホリト 堀戸 +ホリト 堀渡 +ホリド 堀土 +ホリトウ 堀藤 +ホリトウ 堀籐 +ホリトミ 堀富 +ホリドメ 堀留 +ホリドメ 掘留 +ホリトモ 堀友 +ホリナ 堀名 +ホリナイ 堀内 +ホリナカ 堀中 +ホリナガ 堀永 +ホリナガ 堀長 +ホリニシ 堀西 +ホリヌキ 堀抜 +ホリヌキ 堀貫 +ホリヌキ 堀拔 +ホリヌキ 掘抜 +ホリネ 堀根 +ホリノ 堀野 +ホリノ 堀埜 +ホリノ 堀納 +ホリノ 湟野 +ホリノ 掘野 +ホリノ 堀ノ +ホリノウ 堀納 +ホリノウエ 堀之上 +ホリノウエ 堀ノ上 +ホリノウエ 堀野上 +ホリノウチ 堀内 +ホリノウチ 堀之内 +ホリノウチ 堀ノ内 +ホリノウチ 掘之内 +ホリノウチ 堀の内 +ホリノウチ 堀野内 +ホリノエ 堀ノ江 +ホリノエ 掘之江 +ホリノエ 堀之江 +ホリノキタ 堀之北 +ホリノクチ 堀之口 +ホリノクチ 堀ノ口 +ホリノグチ 堀之口 +ホリノシタ 堀ノ下 +ホリノソノ 堀之薗 +ホリノソノ 堀ノ薗 +ホリノゾノ 堀之園 +ホリノダン 堀之段 +ホリノブ 堀信 +ホリノベ 堀野辺 +ホリノマル 堀之丸 +ホリバ 堀場 +ホリバ 堀葉 +ホリバ 堀庭 +ホリバ 掘場 +ホリバ 堀馬 +ホリバ 堀塲 +ホリハシ 湟橋 +ホリハタ 堀端 +ホリハタ 堀畑 +ホリハタ 掘畑 +ホリバタ 堀端 +ホリバタ 堀畑 +ホリハマ 堀浜(堀濱) +ホリバヤシ 堀林 +ホリバヤシ 掘林 +ホリハラ 堀原 +ホリヒト 堀人 +ホリヒラ 堀平 +ホリヒラ 掘平 +ホリフジ 堀藤 +ホリフチ 堀渕 +ホリフチ 堀淵 +ホリブチ 堀渕 +ホリブチ 堀淵 +ホリベ 堀部 +ホリベ 堀辺 +ホリベ 堀邊 +ホリベ 掘部 +ホリベ 堀邉 +ホリボ 堀保 +ホリマ 堀間 +ホリマイ 堀米 +ホリマイ 掘米 +ホリマエ 掘前 +ホリマエ 堀前 +ホリマサ 堀正 +ホリマス 堀益 +ホリマチ 堀町 +ホリマツ 堀松 +ホリミ 堀見 +ホリミ 堀味 +ホリミズ 堀水 +ホリミゾ 堀溝 +ホリミツ 堀光 +ホリミネ 堀峰 +ホリミヤ 堀宮 +ホリムカイ 堀向 +ホリムキ 堀向 +ホリムラ 堀村 +ホリメ 堀明 +ホリメ 保利免 +ホリモ 堀毛(掘毛) +ホリモト 堀本 +ホリモト 堀元 +ホリモト 掘本 +ホリモト 湟本 +ホリヤ 堀家 +ホリヤ 堀谷 +ホリヤ 彫谷 +ホリヤ 堀屋 +ホリヤ 堀矢 +ホリヤシキ 堀屋敷 +ホリヤス 堀安 +ホリヤマ 堀山 +ホリヤマ 掘山 +ホリユキ 堀行 +ホリヨシ 堀吉 +ホリヨシ 堀良 +ホリワキ 堀脇 +ホリワキ 掘脇 +ホレイ 保礼 +ホレイ 保禮 +ホロ 保呂 +ホロ 幌 +ホロイワ 袰岩 +ホロイワ 幌岩 +ホロイワ 縨岩 +ホロクサ 保呂草 +ホロジ 保路地 +ホロタ 母良田 +ホロタ 袰田 +ホロタ 保呂田 +ホロタカ 袰高 +ホロチ 袰地 +ホロヌシ 袰主 +ホロノ 袰野 +ホロムラ 幌村 +ホロヤ 袰屋 +ホロワタ 袰綿 +ホワシ 帆鷲 +ホン 本 +ホンアミ 本阿弥(本阿彌) +ホンイ 本井 +ホンイシダ 本石田 +ホンイズミ 本泉 +ホンイデン 本位田 +ホンイデン 本井伝 +ホンイデン 本位傳 +ホンイデン 本井傳 +ホンウチ 本内 +ホンエ 本江 +ホンエン 本圓(本円) +ホンカ 本加 +ホンガ 本賀 +ホンカイ 本開 +ホンガキウチ 本垣内 +ホンガク 本覚 +ホンガシ 本樫 +ホンカタヤマ 本片山 +ホンガマ 本釜 +ホンガマ 本竃(本竈) +ホンカワ 本川 +ホンカワ 本河 +ホンガワ 本川 +ホンガワラ 本瓦 +ホンガン 本元 +ホンガン 本願 +ホンキ 本木 +ホンキ 本岐 +ボンキ 盆木 +ホンキュウ 本久 +ホンキュウ 本弓 +ホンキョウ 本京 +ホンギョウ 本行 +ホング 本宮 +ホングウ 本宮 +ホンクラ 本蔵 +ホンクラ 本藏 +ホンケ 本家 +ホンケ 本計 +ホンケ 本卦 +ホンケ 本毛 +ホンゲ 本下 +ホンケイ 本計 +ホンケイ 品慶 +ホンゲイ 本慶 +ホンゲン 本元 +ホンコ 本小 +ホンゴ 本江 +ホンゴ 本後 +ボンコ 盆子 +ホンコウ 本光 +ホンコウ 本孝 +ホンゴウ 本郷 +ホンゴウ 北郷 +ホンゴウ 本江 +ホンゴウ 本合 +ホンゴウ 奔剛 +ホンゴウ 本剛 +ホンゴウヤ 本郷谷 +ホンゴク 本国 +ボンコハラ 盆子原 +ボンコバラ 盆子原 +ボンゴバラ 盆子原 +ホンサ 本佐 +ホンザ 本座 +ホンサカ 本阪 +ホンサキ 本崎 +ホンザキ 本崎 +ホンザキ 本咲 +ホンザキ 本嵜 +ホンサコ 本迫 +ホンザコ 本迫 +ホンザネ 本実 +ホンサワ 本沢 +ホンサワ 本澤 +ホンザワ 本沢 +ホンザワ 本澤 +ホンジ 本地 +ホンジ 品治 +ホンジ 本司 +ホンジ 本治 +ホンシオ 本塩 +ホンジガワ 本地川 +ボンシタ 盆下 +ホンシマ 本島(本嶌) +ホンジュ 本寿 +ホンジュ 本壽 +ホンシュク 本宿 +ホンジュク 本宿 +ホンジョ 本所 +ホンジョ 本庶 +ホンショウ 本庄 +ホンショウ 本荘 +ホンショウ 本勝 +ホンショウ 本正 +ホンジョウ 本庄 +ホンジョウ 本城 +ホンジョウ 本荘 +ホンジョウ 本条 +ホンジョウ 本所 +ホンジョウ 本條 +ホンジョウ 本上 +ホンジョウ 本勝 +ホンジョウ 本浄 +ホンジョウ 本生 +ホンジョウ 本定 +ホンジョウ 本庶 +ホンジョウ 本匠 +ホンジョウ 本祥 +ホンジョウ 本莊 +ホンジョウ 本淨 +ボンジョウ 盆城 +ホンショウヤ 本庄屋 +ホンジョウヤ 本城谷 +ホンジョウヤ 本庄谷 +ホンジョウヤ 本荘谷 +ホンジョウヤ 本庄屋 +ホンジョウヤ 本城屋 +ホンジン 本陣 +ホンズ 本図 +ホンズ 本圖 +ホンズミ 本泉 +ホンズミ 本住 +ホンセ 本瀬 +ホンセ 本勢 +ホンセイ 本清 +ホンソウ 本惣 +ホンゾウ 本蔵 +ホンゾウ 本造 +ホンゾウ 本藏 +ホンタ 本田 +ホンタ 本多(夲多) +ホンダ 本田 +ホンダ 本多(夲多) +ホンダ 誉田 +ホンダ 本夛 +ホンダ 譽田 +ホンダ 誉多 +ホンダ 譽多 +ボンダ 盆田 +ホンダイ 本台 +ホンタイラ 本平 +ホンダイラ 本平 +ホンタオ 本垰 +ホンタキ 本滝 +ホンタキ 本瀧 +ホンタケ 本竹 +ホンタケ 本武 +ホンタニ 本谷 +ホンダニ 本谷 +ホンタマ 本玉 +ホンダマ 本玉 +ホンダヤマ 本田山 +ホンタン 本丹 +ホンチ 本地 +ホンヂ 本地 +ホンヂ 品治 +ホンヂ 品地 +ホンチガワ 本地川 +ホンヂガワ 本地川 +ホンチュウ 本忠 +ホンチョウ 本長 +ホンチョウ 本調 +ホンチョウ 本丁 +ホンチョウ 本銚 +ホンツ 本津 +ホンヅ 本図 +ホンヅ 本津 +ホンテ 本手 +ホンデ 本出 +ホンデ 本手 +ボンデ 盆出 +ホンデラ 本寺 +ホンデン 本殿 +ホンデン 本伝 +ホンデン 本傳 +ホント 本戸 +ホント 本登 +ホンド 本戸 +ホンド 本土 +ホンド 本渡 +ホンド 本登 +ホンド 本砥 +ホントウ 本藤 +ホントウ 本東 +ホントウ 本登 +ホンドウ 本堂 +ホンドウ 本藤 +ホンドウ 本道 +ホンドウ 本東 +ホンドウ 本同 +ホンドウ 本遠 +ホンドウ 本銅 +ホンドウ 本導 +ホントウチ 本東地 +ホンドウチ 本東地 +ホントク 本徳 +ホンナ 本名 +ホンナ 本那 +ホンナイザワ 本内沢 +ホンナベタ 本鍋田 +ホンナミ 本波 +ホンナミ 本並 +ホンナミ 本浪 +ホンナミ 本阿弥(本阿彌) +ホンネ 本根 +ホンノ 本野 +ホンノ 本埜 +ボンノ 盆野 +ホンノウ 本濃 +ホンノウ 本応 +ホンバ 本葉 +ホンバ 本場 +ホンバタ 本畑 +ホンバタ 本畠 +ホンバヤシ 本林 +ホンバラ 本原 +ホンバン 本伴 +ホンブ 本部 +ホンプ 本富 +ホンブツ 本仏(本佛) +ホンベ 本部 +ホンボ 本保 +ホンボ 本母 +ホンポ 本保 +ホンボウ 本坊 +ホンボウ 本房 +ホンボウ 本棒 +ホンボウ 本防 +ホンポウ 本方 +ホンポウイン 本法院 +ホンボリ 本堀 +ホンマ 本間 +ホンマ 本馬 +ホンマ 本摩 +ホンマ 本麻 +ホンマ 本真 +ホンマキ 本牧 +ホンマサ 本政 +ホンマチ 本街 +ホンマツ 本松 +ホンマル 本丸 +ホンミ 本美 +ホンミョウ 本名 +ホンミョウ 本明 +ホンムラ 本村 +ホンメ 本目 +ホンメイ 本名 +ホンメイ 本明 +ホンモ 本茂 +ホンモウ 本望 +ホンモク 本牧 +ホンモチ 本持 +ホンモト 本元 +ホンヤ 本谷 +ホンヤ 本家 +ホンヤシキ 本屋敷 +ホンヨ 本誉 +ホンヨコヤマ 本横山 +ホンリ 本里 +ホンリュウ 本竜 +ホンリュウ 本立 +ホンリュウ 本龍 +ホンリョウ 本領 +ホンリョウ 本良 +ホンレイ 本霊 +マアイ 間合 +マアケ 真明 +マアケ 眞明 +マアリ 真有 +マアリ 眞有 +マイ 真井 +マイ 麻井 +マイ 舞 +マイ 間井 +マイ 眞井 +マイ 磨伊 +マイ 真位 +マイイシ 舞石 +マイエ 真家 +マイエ 前家 +マイエ 眞家 +マイオ 麻殖生 +マイオ 麻植生 +マイオサ 舞筬 +マイガタ 舞潟 +マイカワ 妹川 +マイカワ 毎川 +マイキ 舞木 +マイクサ 舞草 +マイクマ 毎熊 +マイグマ 毎熊 +マイグマ 毎隈 +マイケ 真池 +マイザ 毎座 +マイサカ 舞坂 +マイサワ 米沢 +マイサワ 米澤 +マイザワ 米沢 +マイザワ 毎沢 +マイザワ 舞沢(舞澤) +マイザワ 毎澤 +マイシ 真石 +マイシ 間石 +マイシ 眞石 +マイシギ 舞鴫 +マイシマ 舞島 +マイジマ 舞島 +マイズミ 真泉(眞泉) +マイズミ 間泉 +マイゾノ 舞薗 +マイゾノ 舞園 +マイタ 米田 +マイタ 蒔田 +マイタ 舞田 +マイタ 毎田 +マイタ 真板 +マイタ 間板 +マイタ 眞板 +マイタ 舞多 +マイダ 前田 +マイダ 米田 +マイダ 舞田 +マイダ 毎田 +マイダ 間井田 +マイダ 真井田(眞井田) +マイダイ 舞台 +マイタカ 毎高 +マイタケ 舞嶽 +マイタチ 舞立 +マイダチ 舞立 +マイタニ 米谷 +マイタニ 舞谷 +マイタニ 間井谷 +マイヅル 舞鶴 +マイデ 舞出 +マイド 毎度 +マイトコ 毎床 +マイトコ 舞床 +マイドコ 毎床 +マイナカ 舞中 +マイナガ 舞永 +マイノ 舞野 +マイノ 毎野 +マイハラ 前原 +マイハラ 舞原 +マイハラ 毎原 +マイバラ 米原 +マイバラ 舞原 +マイバラ 毎原 +マイモト 毎本 +マイモリ 毎森 +マイヤ 米谷 +マイヤ 舞矢 +マイヤマ 舞山 +マイヤマ 毎山 +マイユミ 舞弓 +マイラ 舞良 +マイワ 真岩 +マイワ 眞岩 +マウ 真羽 +マウエ 馬上 +マウエ 摩上 +マウタニ 間苧谷 +マウチ 馬内 +マウチ 真内 +マウチ 間内 +マウチ 麻内 +マウツボ 真苧坪 +マウネ 真宇根(眞宇根) +マウラ 真浦 +マウラ 間浦 +マウラ 眞浦 +マウリ 馬瓜 +マエ 前 +マエ 万江 +マエ 馬江 +マエ 間永 +マエ 間江 +マエ 間恵 +マエ 真江 +マエ 摩江 +マエアラ 前新 +マエアラシロ 前新城 +マエアワクラ 前粟蔵 +マエアワクラ 前粟藏 +マエイ 前井 +マエイ 前伊 +マエイエ 前家 +マエイケ 前池 +マエイケミ 前池味 +マエイシ 前石 +マエイシガキ 前石垣 +マエイシノ 前石野 +マエイズミ 前泉 +マエイタ 前板 +マエイチ 前市 +マエイチオカ 前市岡 +マエイデ 前井出 +マエイデ 前井手 +マエイレイジョウ 前伊礼門 +マエイワ 前岩 +マエウエ 前上 +マエウエザト 前上里 +マエウエジョウ 前上門 +マエウエシロ 前上城 +マエウケモリ 前請盛 +マエウチ 前内 +マエウチハラ 前内原 +マエウネ 前宇根 +マエウネソコ 前宇根底 +マエウマ 前馬 +マエウミ 前海 +マエウラ 前浦 +マエエ 前江 +マエエ 前衛 +マエエダ 前江田 +マエエダ 前枝 +マエエビス 前夷 +マエオ 前尾 +マエオ 前大 +マエオオジ 前大路 +マエオオマス 前大舛 +マエオオミチ 前大道 +マエオカ 前岡 +マエオキ 前沖 +マエオク 前奥 +マエオモテ 前表 +マエガ 前賀 +マエガイチ 前垣内 +マエガイト 前垣内 +マエガウチ 前垣内 +マエカガワ 前鹿川 +マエガキ 前垣 +マエカキウチ 前垣内 +マエガキウチ 前垣内 +マエカク 前角 +マエカクチ 前角地 +マエガサコ 前ケ迫 +マエカジ 前梶 +マエガシ 前樫 +マエガシラ 前頭 +マエカタ 前方 +マエガタ 前潟 +マエガタ 前瀉 +マエカツ 前勝 +マエカド 前門 +マエカド 前角 +マエカド 前上門 +マエガナ 前我名 +マエカネ 前金 +マエガネ 前金 +マエカネク 前兼久 +マエガネク 前兼久 +マエカホ 前嘉保 +マエガマ 前釜 +マエカミ 前上 +マエガミ 前上 +マエガミ 前神 +マエカラ 前加良 +マエカワ 前川 +マエカワ 前河 +マエカワ 前側 +マエカワ 満恵川 +マエカワ 満惠川 +マエガワ 前川 +マエガワ 前河 +マエガワ 前側 +マエガワ 満惠川 +マエカワウチ 前河内 +マエカワウチ 前川内 +マエカワジリ 前川尻 +マエカワチ 前河内 +マエカワハラ 前川原 +マエカワラ 前川原 +マエカワラ 前河原 +マエカワラ 前瓦 +マエガワラ 前川原 +マエガワラ 前河原 +マエキ 真栄城 +マエキ 前城 +マエキ 前木 +マエキ 真栄喜 +マエキ 眞榮城 +マエキ 前喜 +マエキ 前鬼 +マエキ 眞榮喜 +マエギ 真江木 +マエギシ 前岸 +マエキタ 前北 +マエキバ 前木場 +マエギリ 前切 +マエグチ 前口 +マエクニ 前国 +マエクニ 前國 +マエクニトウ 前国藤 +マエクボ 前久保 +マエクボ 前窪 +マエクマ 前隈 +マエグマ 前隈 +マエクラ 前倉 +マエクラ 前蔵 +マエグルマ 前車 +マエグロ 前畔 +マエクロシマ 前黒島 +マエケ 前家 +マエコウ 前甲 +マエコウチ 前幸地 +マエゴウチ 前垣内 +マエゴウチ 前河内 +マエコシ 前越 +マエゴシ 前越 +マエコダ 前小田 +マエゴト 前河土 +マエコノ 前此 +マエコバ 前木場 +マエコヤ 前小屋 +マエザ 前座 +マエサカ 前坂 +マエサカ 前阪 +マエサカイ 前佐嘉伊 +マエサキ 前崎 +マエサキ 前嵜 +マエサキ 前先 +マエサキ 前岬 +マエザキ 前崎 +マエザキ 前嵜 +マエサゲ 前提 +マエサコ 前迫 +マエサコ 前砂 +マエサコ 前𡶡 +マエサコ 前硲 +マエサコ 前﨏 +マエザコ 前迫 +マエサダ 前定 +マエサダ 前貞 +マエサト 前里 +マエサト 真栄里 +マエサト 真榮里 +マエサト 眞栄里 +マエサト 眞榮里 +マエザト 前里 +マエザト 真栄里 +マエザト 真榮里 +マエザト 眞栄里 +マエザト 眞榮里 +マエサラ 前更 +マエザリョウ 前座領 +マエサワ 前沢 +マエサワ 前澤 +マエザワ 前沢 +マエザワ 前澤 +マエジ 前地 +マエシキ 前敷 +マエシゲ 前重 +マエシタ 前下 +マエシバ 前芝 +マエシバ 前柴 +マエシブ 前渋 +マエシブ 前澁 +マエシマ 前島 +マエシマ 前嶋 +マエシマ 前嶌 +マエジマ 前島 +マエジマ 前嶋 +マエジマ 前嶌 +マエショ 前所 +マエジョウ 前門 +マエジョウ 前上 +マエジョウ 前條(前条) +マエショウジ 前小路 +マエシロ 真栄城 +マエシロ 前城 +マエシロ 前代 +マエシロ 眞榮城 +マエシロ 真榮城 +マエシロ 眞栄城 +マエシン 前新 +マエシンジョウ 前新城 +マエシンモン 前新門 +マエシンヤ 前新屋 +マエス 前須 +マエスエ 前末 +マエスエムネ 前末宗 +マエスカ 前須賀 +マエスギ 前杉 +マエスナ 前砂 +マエスミ 前角 +マエズミ 前角 +マエズミ 前住 +マエズル 前水流 +マエセ 前瀬 +マエセ 前勢 +マエセキ 前関 +マエゼキ 前関 +マエセト 前背戸(前脊戸) +マエソ 前楚 +マエゾエ 前添 +マエソコ 前底 +マエソノ 前園 +マエソノ 前薗 +マエゾノ 前園 +マエゾノ 前薗 +マエゾノ 前囿 +マエソバ 前岨 +マエソマ 前岨 +マエソリ 前反 +マエゾリ 前反 +マエソワ 前岨 +マエタ 前田 +マエタ 前多(前夛) +マエダ 前田 +マエダ 前多(前夛) +マエダ 真栄田 +マエダ 前江田 +マエダ 眞栄田 +マエダ 前甸 +マエダ 間枝 +マエダ 眞榮田 +マエダ 真枝(眞枝) +マエダ 真榮田 +マエダ 真江田(眞江田) +マエダイ 前代 +マエタオ 前峠 +マエタオ 前垰 +マエダオ 前峠 +マエタカ 前高 +マエダガワ 前田河 +マエタキ 前滝 +マエタキ 前瀧 +マエタケ 前竹 +マエタケ 前岳 +マエタケ 前嵩 +マエダケ 前岳 +マエタケダ 前武田 +マエタケニシ 前嵩西 +マエダコ 前田河 +マエダコウ 前田河 +マエタジマ 前田島 +マエダタニ 前田谷 +マエタナハラ 前棚原 +マエタニ 前谷 +マエタバ 前田場 +マエタハラ 前田原 +マエダマ 前玉 +マエタモリ 前田盛 +マエダモリ 前田盛 +マエタヤ 前田谷 +マエタル 前樽 +マエダン 前段 +マエチ 前地 +マエヂ 前地 +マエチョウダ 前丁田 +マエツ 前津 +マエヅ 前津 +マエツカ 前塚 +マエヅカ 前塚 +マエツジ 前辻 +マエツボ 前坪 +マエヅムネ 前津宗 +マエツル 前鶴 +マエヅル 前鶴 +マエヅル 前霍 +マエテ 前手 +マエデ 前出 +マエデラ 前寺 +マエト 前戸 +マエドイ 前土井 +マエドイ 前土居 +マエトウ 前東 +マエトウ 前藤 +マエトウ 前当 +マエトウ 前當 +マエドウ 前堂 +マエドウ 前藤 +マエトウゲ 前峠 +マエトキ 前時 +マエトク 前徳 +マエトクヒガ 前徳比嘉 +マエトコ 前床 +マエドコ 前床 +マエドコロ 前所 +マエトサ 前土佐 +マエトシ 前利 +マエドノ 前殿 +マエトノシロ 前登野城 +マエドヒ 前土肥 +マエドマリ 前泊 +マエトミ 前富(前冨) +マエトモ 前友 +マエトモ 前塘 +マエドンチ 前鈍内 +マエナ 前名 +マエナカ 前中 +マエナカ 前仲 +マエナガ 前永 +マエナガ 前長 +マエナカオ 前中尾 +マエナカザト 前仲里 +マエナカジョウ 前仲門 +マエナミ 前波 +マエナミ 前浪 +マエナミ 前南 +マエナミ 前並 +マエナリ 前成 +マエニシ 前西 +マエニシハラ 前西原 +マエヌマ 前沼 +マエネ 前根 +マエネ 前祢 +マエノ 前野(前𡌛) +マエノ 前納 +マエノ 前埜 +マエノ 間江野 +マエノウ 前納 +マエノソノ 前之園(前之薗) +マエノソノ 前ノ園 +マエノゾノ 前之園(前之薗) +マエノハマ 前之浜 +マエノハマ 前之濱 +マエノハラ 前之原 +マエノブ 前信 +マエノブ 前延 +マエノボウ 前坊 +マエノボウ 前ノ坊 +マエバ 前場 +マエバ 前波 +マエバ 前羽 +マエバ 前馬 +マエバ 前葉 +マエバ 前庭 +マエハシ 前橋 +マエバシ 前橋 +マエハタ 前畑 +マエハタ 前畠 +マエハタ 前端 +マエバタ 前畑 +マエバタ 前畠 +マエバタ 前端 +マエハタケ 前畠 +マエバタケ 前畠 +マエハトマ 前鳩間 +マエハナ 前花 +マエハナ 前鼻 +マエハネ 前羽 +マエハマ 前浜 +マエハマ 前濱 +マエハマジョウ 前浜門(前濱門) +マエハマモリ 前浜盛 +マエバヤシ 前林 +マエハラ 前原 +マエバラ 前原 +マエバラ 真恵原(眞惠原) +マエヒガ 前比嘉 +マエヒガシ 前東 +マエヒサ 前久 +マエヒラ 前平 +マエヒラ 真栄平 +マエヒラ 眞榮平 +マエヒラ 真榮平 +マエヒラ 眞栄平 +マエヒロ 前広 +マエヒロ 前廣 +マエフサト 前冨里 +マエフサト 前富里 +マエフジ 前藤 +マエブチ 前渕 +マエブチ 前淵 +マエフナミチ 前船道 +マエフネ 前船 +マエベ 前部 +マエベヤ 前部屋 +マエホ 前保 +マエボ 前保 +マエボウ 前坊 +マエボウ 前防 +マエホカマ 前外間 +マエボトケ 前仏 +マエホリ 前堀 +マエホリ 前掘 +マエボリ 前堀 +マエマ 前間 +マエマタ 前亦 +マエマツ 前松 +マエマツダ 前松田 +マエミ 前見 +マエミイジョウ 前新門 +マエミゾ 前溝 +マエミチ 前道 +マエミツ 前満 +マエミツ 前光 +マエミツモリ 前三盛 +マエミナミ 前南 +マエミネ 前峰 +マエミネ 前峯 +マエミネ 前岑 +マエミヤ 前宮 +マエミョウリキ 前明力 +マエムカイ 前迎 +マエムコウ 前向 +マエムタ 前牟田 +マエムラ 前村 +マエムロ 前室 +マエメ 前芽 +マエモ 前茂 +マエモク 前杢 +マエモト 前本 +マエモト 前元 +マエモリ 前森 +マエモリ 前盛 +マエモリタ 前森田 +マエモンド 前門戸 +マエヤ 前谷 +マエヤ 前屋 +マエヤ 前家 +マエヤ 前矢 +マエヤシキ 前屋敷 +マエヤシキ 前屋舗 +マエヤス 前保 +マエヤスイ 前安井 +マエヤチ 前谷内 +マエヤツ 前谷津 +マエヤヅ 前谷津 +マエヤナギ 前柳 +マエヤブ 前籔 +マエヤブ 前薮 +マエヤブ 前藪 +マエヤマ 前山 +マエヤマダ 前山田 +マエヨコ 前横 +マエヨコヤマ 前横山 +マエヨシ 前吉 +マエラ 前良 +マエリクロ 前陸路 +マエワキ 前脇 +マエワダ 前和田 +マエントウ 前武当 +マエントウ 前武當 +マオ 真尾 +マオ 万尾 +マオ 眞尾 +マオ 萬尾 +マオ 間尾 +マオカ 満岡 +マオカ 真岡 +マオカ 眞岡 +マオカ 馬峠 +マオク 真奥 +マオタニ 間苧谷 +マオタニ 門苧谷 +マオダニ 間苧谷 +マオロシ 馬下 +マオロシ 馬卸 +マカ 真賀(眞賀) +マガ 真賀(眞賀) +マガ 馬賀 +マガ 間賀 +マガ 馬把 +マガ 馬杷 +マカイ 真貝 +マカイ 真加井(眞加井) +マガイ 真貝 +マガイ 間海 +マガイ 馬替 +マガイ 馬養 +マガイ 曲井 +マカイノ 馬飼野 +マガイノ 馬飼野 +マガエ 馬替 +マガエシ 馬返 +マガキ 曲木 +マガキ 真垣 +マガキ 籬 +マガキ 間垣 +マガキ 笆 +マガキ 摩垣 +マガキ 眞垣 +マカグチ 真ケ口 +マガグチ 真賀口 +マガケ 真駈 +マガサキ 真崎 +マガサワ 曲沢 +マガサワ 曲澤 +マカジ 曲梶 +マガシキ 間ケ敷 +マカス 間ケ数 +マカズ 真一 +マガスミ 真霞 +マカセ 任勢 +マガセ 曲瀬 +マガセガワ 曲瀬川 +マカタ 真方 +マカタ 眞方 +マカタ 間方 +マカタ 馬形 +マカタ 馬方 +マカタ 真力田 +マカダ 間加田 +マカダ 真加田 +マガタ 真方 +マガタ 曲田 +マガタ 間形 +マガタ 眞方 +マガタ 間片 +マガタ 真形 +マガタ 間方 +マガタ 間賀田 +マガタ 勾田 +マガタ 馬形 +マガタ 澗潟 +マガタ 馬方 +マガタ 真ケ田 +マガタ 真県(眞縣・真縣) +マガタ 眞ケ田 +マガタ 眞形 +マガタケ 曲竹 +マカタニ 萬力谷 +マガタニ 曲谷 +マガタニ 万ケ谷 +マガタニ 萬ケ谷 +マカタヤマ 真方山 +マカタヤマ 眞方山 +マガタヤマ 眞方山 +マカド 真角 +マカド 馬門 +マカド 真門 +マカド 間門 +マカド 眞角 +マカド 眞門 +マガト 曲戸 +マカナイ 蒔苗 +マカナエ 蒔苗 +マガヌマ 曲沼 +マカネ 眞金 +マガネ 真金 +マガネ 眞金 +マガノ 曲野 +マカビ 真嘉比(眞嘉比) +マカブ 澗株 +マカベ 真壁 +マカベ 眞壁 +マカベ 間壁 +マカベ 馬壁 +マカベ 真加部 +マカベ 間ケ部 +マカベ 間賀部 +マカベ 間下部 +マカベ 間河部 +マカベ 真ケ部 +マカベ 真賀部(眞賀部) +マカベ 眞加部 +マガミ 馬上 +マガミ 真上 +マガミ 真神 +マガミ 馬神 +マガミ 間神 +マガミ 眞上 +マガミ 眞神 +マカヤ 真茅 +マカヤ 眞茅 +マガヤ 眞茅 +マカラ 真柄 +マカラ 眞柄 +マガラ 真柄 +マガラ 麻柄 +マガラ 眞柄 +マガラ 間柄 +マカリ 真狩 +マカリ 間狩 +マカリ 馬狩 +マカリ 真苅 +マカリ 真加理 +マカリ 真雁 +マガリ 曲 +マガリ 鈎 +マガリ 曲里 +マガリ 真賀里 +マガリ 鉤 +マガリ 間狩 +マガリ 回 +マガリ 曲り +マガリ 眞賀里 +マガリ 眞苅 +マガリオ 曲尾 +マガリカジ 曲梶 +マガリカワ 曲川 +マガリキ 曲木 +マガリサコ 曲迫 +マガリサワ 曲沢 +マガリサワ 曲澤 +マガリタ 曲田 +マガリダ 曲田 +マガリツジ 曲辻 +マガリテ 曲手 +マガリデ 曲出 +マガリド 曲戸 +マガリフチ 曲渕 +マガリフチ 曲淵 +マガリブチ 曲渕 +マガリブチ 曲淵 +マガリミチ 曲道 +マガリヤ 曲谷 +マガリヤチ 曲谷地 +マガリヤマ 曲山 +マカワ 真川 +マカワ 眞川 +マガワ 真川 +マガワ 間川 +マガワ 眞川 +マガワ 真河 +マガワ 眞河 +マカンダ 眞神田(真神田) +マキ 牧 +マキ 真木 +マキ 槙 +マキ 槇 +マキ 万木 +マキ 馬木 +マキ 巻 +マキ 巻木 +マキ 満木 +マキ 真城 +マキ 眞木 +マキ 萬木 +マキ 麻木 +マキ 馬着 +マキ 間木 +マキ 馬来 +マキ 真喜 +マキ 真期 +マキ 槙木 +マキ 牧木 +マキ 真貴 +マキ 眞城 +マキ 蒔 +マキ 満喜 +マキ 眞喜 +マキ 槇木 +マキ 真宜 +マキ 真枝(眞枝) +マキ 薪 +マキ 馬來 +マキ 卷 +マキ 眞期 +マキ 真樹 +マギ 真木 +マギ 眞木 +マギ 間木 +マキイ 牧井 +マキイ 槙井 +マキイ 巻井 +マキイ 槇井 +マキイ 牧伊 +マキイシ 牧石 +マキイシ 槙石 +マキイシ 槇石 +マキウ 槙宇 +マキウエ 巻上 +マキウエ 牧上 +マキウチ 牧内 +マキウチ 槙内 +マキウチ 巻内 +マキウチ 蒔内 +マキウチ 槇内 +マキウチ 間木内 +マキウチ 真木内 +マキウネ 槙畝(槇畝) +マキウラ 牧浦 +マキウラ 薪浦 +マキウラ 槙浦 +マキウラ 槇浦 +マキエ 牧江 +マキエ 槙得(槇得) +マキエ 牧絵 +マキエ 牧繪 +マキエダ 槙枝 +マキエダ 牧枝 +マキエダ 槇枝 +マキオ 槙尾 +マキオ 牧尾 +マキオ 槇尾 +マキオ 巻尾 +マキオ 慎尾 +マキオ 槙雄(槇雄) +マキオカ 牧岡 +マキオカ 槙岡 +マキオカ 槇岡 +マキオク 槙奥(槇奥) +マキオチ 牧落 +マキガ 槙賀(槇賀) +マキガキ 牧垣 +マキカタ 牧方 +マキガタオ 槙ケ垰(槇ケ垰) +マキガトウゲ 槙ケ垰(槇ケ垰) +マキガノ 牧ケ野 +マキガミ 巻上 +マキガミ 牧上 +マキガヤ 牧ケ谷 +マキカワ 牧川 +マキカワ 槙川 +マキカワ 巻川 +マキカワ 槇川 +マキガワ 牧川 +マキガワ 槙川 +マキガワ 巻川 +マキガワ 槇川 +マキキ 巻木 +マキギ 巻木 +マキギ 牧木 +マキギ 薪木 +マキクサ 牧草 +マキグサ 牧草 +マキグチ 牧口 +マキグチ 巻口(卷口) +マキグチ 槙口 +マキグチ 槇口 +マキクボ 牧窪 +マキクボ 槙窪 +マキクボ 槇窪 +マキクマ 綣熊 +マキコ 牧子 +マキゴウ 巻郷 +マキサカ 牧坂 +マキサカ 槙坂 +マキサカ 槇坂 +マキサカ 巻坂 +マキサカ 真木坂 +マキザカ 牧坂 +マキザカ 巻坂 +マキザカ 真木坂 +マキザキ 牧崎 +マキザキ 蒔崎 +マキザキ 巻崎 +マキザキ 牧碕 +マキザキ 牧嵜 +マキサコ 牧迫 +マキサコ 槙迫 +マキサコ 槇迫 +マキザコ 牧迫 +マキサト 牧里 +マキサヤ 巻鞘 +マキサワ 槇沢 +マキサワ 槙澤 +マキザワ 牧沢 +マキザワ 槙沢 +マキザワ 牧澤 +マキザワ 槇沢 +マキザワ 巻沢 +マキザワ 槙澤 +マキザワ 槇澤 +マキザワ 愼澤 +マキシ 真喜志 +マキシ 牧志 +マキシ 眞喜志 +マギシ 真岸(眞岸) +マギシ 曲師 +マキシオ 薪塩 +マキシオ 澵塩 +マキシゲ 牧重 +マキシタ 牧下 +マキシタ 巻下 +マキシタ 槙下 +マキシタ 真木下(眞木下) +マキシタ 槇下 +マキシマ 牧島 +マキシマ 巻島 +マキシマ 槙島 +マキシマ 牧嶋 +マキシマ 巻嶋(巻嶌) +マキシマ 槇島 +マキシマ 槙嶋 +マキシマ 牧嶌 +マキシマ 槇嶋 +マキジマ 巻島 +マキジマ 槙島 +マキジマ 牧嶋 +マキジマ 巻嶋(巻嶌) +マキジマ 槇島 +マギシヤマ 馬岸山 +マキジョウ 牧門 +マキスナ 巻砂 +マキスミ 牧角 +マキズミ 牧角 +マキズミ 牧住 +マキセ 牧瀬 +マキゾエ 牧添 +マキゾエ 蒔添 +マキソノ 巻苑 +マキゾノ 牧園 +マキゾノ 牧薗 +マキタ 牧田 +マキタ 蒔田 +マキタ 槙田 +マキタ 巻田 +マキタ 槇田 +マキタ 真北 +マキタ 真木田 +マキタ 巻多 +マキタ 慎田 +マキタ 真貴田 +マキタ 薪田 +マキタ 牧多 +マキタ 眞北 +マキダ 牧田 +マキダ 蒔田 +マキダ 槙田 +マキダ 巻田 +マキダ 槇田 +マキタ 柾田 +マキタイ 間木平 +マキダイ 牧大 +マギタイ 間木平 +マキダイラ 槙平 +マキダイラ 槇平 +マキタオ 槙垰 +マキタオ 槙峠 +マキタオ 槇峠 +マキタオ 槇垰 +マキダオ 槙垰 +マキダオ 槇垰 +マキタキ 槇滝 +マキタニ 牧谷 +マキタニ 槙谷 +マキタニ 槇谷 +マキヂ 牧地 +マキツカ 巻柄 +マキヅカ 槙塚 +マキヅカ 槇塚 +マキツボ 槙坪 +マキツボ 槇坪 +マキツル 牧鶴 +マキヅル 牧鶴 +マキデ 巻出 +マキデ 牧出 +マキデラ 牧寺 +マキデラ 槙寺 +マキデラ 槇寺 +マキト 牧戸 +マキト 槙戸 +マキト 槇戸 +マキド 牧戸 +マキド 槙戸 +マキド 槇戸 +マキトイ 牧問 +マキトウ 牧統 +マキドウ 巻堂 +マキドノ 槇殿 +マキナ 真境名 +マキナ 眞境名 +マキナイ 蒔苗 +マキナイ 間木内 +マキナエ 蒔苗 +マキナカ 槙中 +マキナカ 牧中 +マキナガ 槙永 +マキナガ 牧長 +マキナガ 牧永 +マキナガ 槇永 +マキニシ 槙西 +マギヌ 馬被 +マキヌシ 牧主 +マキネ 槙根(槇根) +マキノ 牧野 +マキノ 槙野 +マキノ 槇野 +マキノ 巻野 +マキノ 蒔野 +マキノ 槙納 +マキノ 間木野 +マキノ 槙埜 +マキノ 真木野 +マキノ 槇納 +マキノ 巻埜 +マキノ 牧埜 +マキノ 馬来野 +マキノ 愼野 +マキノ 眞木野 +マキノ 槇埜 +マキノウ 槙納 +マキノウ 槇納 +マキノウチ 牧之内 +マキノウチ 牧野内 +マキノウチ 巻之内 +マキノウチ 牧ノ内 +マキノクチ 牧之口 +マキノシマ 牧野嶋 +マキノシマ 牧野島 +マキノスミ 牧之角 +マキノセ 牧之瀬 +マキノセ 牧ノ瀬 +マキノセ 牧野瀬 +マキノダ 牧野田 +マキノダ 牧之田 +マキノダン 牧之段 +マキノダン 牧ノ段 +マキノハラ 槙ノ原 +マキノハラ 牧ノ原 +マキノハラ 牧野原 +マキノハラ 槇ノ原 +マキノヤ 牧野谷 +マキノヤ 牧ノ矢 +マキバ 牧羽 +マキバ 槙場 +マキバ 牧葉 +マキバ 槇場(槇塲) +マキハシ 槙橋(槇橋) +マキハタ 巻幡 +マキハタ 牧畑 +マキハタ 牧畠 +マキバタ 巻端 +マキバタケ 牧畠 +マキバヤシ 槙林 +マキバヤシ 牧林 +マキバヤシ 槇林 +マキハラ 牧原 +マキハラ 槙原 +マキハラ 槇原 +マキハラ 真木原 +マキハラ 蒔原 +マキハラ 眞木原 +マキバラ 牧原 +マキヒラ 牧平 +マキヒラ 槙平 +マキヒラ 蒔平 +マキヒラ 間木平 +マキヒラ 槇平 +マキヒロ 槙広(槇廣) +マキヒロ 牧広 +マキフジ 巻藤 +マキフジ 槙藤 +マキフチ 巻渕 +マキフチ 巻淵 +マキブチ 巻渕 +マキブチ 巻淵 +マキブチ 牧渕 +マキベ 牧部 +マキマ 牧間 +マキマエ 槙前 +マキマエ 槇前 +マキミズ 牧水 +マキミナト 牧港 +マキミネ 槙峯(槇峯) +マキミネ 槙峰 +マキミネ 槇峰 +マキミヤ 牧宮 +マキムラ 牧村 +マキムラ 槙村 +マキムラ 槇村 +マキムラ 牧邨 +マキムラ 蒔村 +マキメ 万城目 +マキモト 牧本 +マキモト 槙本 +マキモト 牧元 +マキモト 槇本 +マキモト 巻本 +マキモト 蒔本 +マキモト 槙元(槇元) +マキモト 蒔元 +マキモト 真木元 +マキモト 卷本 +マキモト 眞木元 +マキモリ 牧森 +マキモリ 槙森 +マキモリ 槇森 +マキモリ 槙盛 +マキモリ 槇盛 +マキヤ 真喜屋 +マキヤ 牧谷 +マキヤ 槙谷 +マキヤ 槇谷 +マキヤ 眞喜屋 +マキヤ 槙家 +マキヤ 槙矢(槇矢) +マキヤ 巻矢 +マキヤ 牧屋 +マキヤマ 牧山 +マキヤマ 槙山 +マキヤマ 巻山 +マキヤマ 蒔山 +マキヤマ 槇山 +マキヤマ 万亀山 +マキヤマ 真木山 +マキヤマ 填山 +マキヤマ 萬亀山 +マキヨ 真清 +マキヨ 眞清 +マキヨシ 牧吉 +マキヨセ 巻寄 +マキヨリ 牧寄 +マギラ 間明 +マキリ 真桐 +マキリ 眞桐 +マキワラ 巻藁 +マク 幕 +マク 真久 +マク 間久 +マク 満久 +マク 眞久 +マクイ 幕井 +マクウチ 幕内 +マグサ 馬草 +マグサ 麻草 +マグサハラ 馬草原 +マクサワ 幕沢 +マクザワ 幕澤 +マクジ 幕地 +マクズ 真葛 +マクタ 幕田 +マクタ 真久田 +マクタ 馬来田(馬來田) +マクダ 幕田 +マクタニ 幕谷 +マクチ 馬久地 +マグチ 間口 +マグチ 真口 +マグチ 馬口 +マグチ 澗口 +マグチ 㗴口 +マグチ 眞口 +マクニ 真国 +マクニ 眞國 +マクニヤ 万国谷 +マクニヤ 萬国谷(萬國谷) +マクビ 真首 +マクボ 間久保 +マクマ 真熊 +マグマ 真熊 +マグマ 眞熊 +マグモ 間雲 +マクヤ 幕谷 +マクラ 真倉 +マクラ 間蔵(間藏) +マクラ 万倉 +マクラ 眞倉 +マグラ 真倉 +マグラ 間蔵(間藏) +マグラ 馬倉 +マグラ 眞倉 +マクラベ 枕辺(枕邉) +マクラベ 枕邊 +マクリ 真栗 +マクリ 万久里 +マグリ 真栗 +マグロ 真黒(眞黒) +マクワ 真桑 +マクワ 眞桑 +マゲキ 曲木 +マゲシ 曲師 +マゲシ 曲子 +マゲツ 真月 +マゲムラ 曲村 +マコ 真子 +マコ 眞子 +マコ 真粉 +マゴ 真子 +マゴ 眞子 +マゴ 間吾 +マゴイ 孫井 +マコウ 真光 +マコウ 眞光 +マゴウ 摩郷 +マゴエワキ 馬越脇 +マゴオリ 馬郡 +マゴオリ 馬氷 +マゴオリ 摩郡 +マゴク 孫工 +マゴサ 孫佐 +マゴサキ 孫崎 +マゴサキ 孫嵜 +マゴザキ 孫崎 +マゴサコン 孫左近 +マコシ 馬越 +マゴシ 馬越 +マゴシ 間越 +マゴシロ 孫城 +マゴソウ 孫総 +マゴソウ 孫總 +マゴタ 孫田 +マゴタ 馬子田 +マゴダ 孫田 +マゴダイ 孫代 +マゴダイ 孫大 +マゴタケ 孫竹 +マゴタニ 孫谷 +マゴチ 麻郷地 +マコト 寔 +マゴノ 孫野 +マゴハシ 孫橋 +マゴハチ 孫八 +マゴヒラ 孫平 +マゴフク 孫福 +マゴメ 馬込 +マゴメ 馬籠 +マゴメ 真籠 +マゴメ 馬篭 +マゴメ 真篭 +マゴメ 間込 +マゴメ 眞籠 +マゴメ 真米(眞米) +マゴメ 間米 +マコモ 蒲 +マコモ 真菰 +マゴモト 孫本 +マゴヤ 孫谷 +マゴヤ 摩護谷 +マゴヤマ 孫山 +マゴリ 馬郡 +マコロ 真来(眞来) +マゴロク 孫六 +マコロベ 馬比尾 +マサ 政 +マサ 正 +マサ 昌 +マサ 間佐 +マサ 真佐 +マザ 真座 +マザ 間座 +マザ 間坐 +マザ 眞座 +マサアキ 政明 +マサアケ 正明 +マサイ 正井 +マサイ 政井 +マサイ 栄井 +マサイ 正鋳(正鑄) +マサイ 雅井 +マサイ 政居 +マサイ 正意 +マサイ 誠井 +マサイエ 政家 +マサイケ 正池 +マサイケ 政池 +マサイシ 政石 +マサイタ 正板 +マサイワ 政岩 +マサウジ 政氏 +マサウチ 正内 +マサウミ 正海 +マサウラ 昌浦 +マサウラ 政浦 +マサエ 政栄(政榮) +マサエ 正江 +マサエイ 政栄(政榮) +マサエダ 政枝 +マサオ 正尾 +マサオ 正生 +マサオ 政尾 +マサオ 柾尾 +マサオ 昌尾 +マサオカ 正岡 +マサオカ 政岡 +マサオカ 柾岡 +マサオカ 雅岡 +マサオカ 昌岡 +マサカ 真坂 +マサカ 間坂 +マサカ 眞坂 +マサカ 政家 +マサカ 政嘉 +マサカ 間阪 +マサカ 政香 +マサガ 政賀 +マザカ 間坂 +マサカイ 真昌 +マサガキ 正垣 +マサガキ 正籬 +マサカゲ 正影 +マサカゲ 政影 +マサガタニ 政ケ谷 +マサカド 正門 +マサカド 正角 +マサカド 政門 +マサカネ 政金 +マサカネ 正兼 +マサカネ 政兼 +マサカネ 正金 +マサガネ 政金 +マサガネ 正金 +マサガミ 正上 +マサガミ 政上 +マサカメ 正亀 +マサカヤ 真酒谷 +マサカリ 政狩 +マサカリ 鉞 +マサカワ 政川 +マサカワ 正川 +マサカワ 昌川 +マサカワ 柾川 +マサキ 正木 +マサキ 真木 +マサキ 真崎 +マサキ 政木 +マサキ 柾木 +マサキ 柵木 +マサキ 馬崎 +マサキ 間崎(間埼・間嵜) +マサキ 眞木 +マサキ 眞崎 +マサキ 柾 +マサキ 正城 +マサキ 真先 +マサキ 正置 +マサキ 正来 +マサキ 薜 +マサキ 昌木 +マサキ 真佐喜 +マサキ 正伯 +マサキ 正喜 +マサキ 政喜 +マサキ 麻崎 +マサキ 将木(將木) +マサキ 真砂木 +マサキ 真埼 +マサキ 真碕 +マサキ 真置 +マサキ 真伯 +マサキ 真嵜(眞嵜) +マサキ 政輝 +マサキ 正鬼 +マサキ 正來 +マサキ 馬先 +マサキ 万佐木 +マサキ 眞佐喜 +マサキ 眞先 +マサキ 雅木 +マザキ 真崎 +マザキ 馬崎 +マザキ 間崎(間埼・間嵜) +マザキ 眞崎 +マザキ 真嵜(眞嵜) +マサキヤ 政木屋 +マサキヨ 正清 +マサキヨ 政清 +マサキリザワ 柾切沢 +マサキリザワ 柾切澤 +マサグチ 正口 +マサクニ 正国 +マサクニ 政国(政國) +マサクニ 正國 +マサクラ 政倉 +マサクラ 正倉 +マサコ 馬迫 +マサゴ 真砂 +マサゴ 真子 +マサゴ 眞砂 +マサゴ 正子 +マサゴ 政後 +マサゴ 政子 +マサゴ 摩砂 +マザコ 馬迫 +マサゴメ 正込 +マサゴヤ 真砂谷 +マサゴヤ 眞砂谷 +マサザキ 政崎 +マサザキ 昌崎 +マサザワ 正沢(正澤) +マサジ 政治 +マサシカ 政鹿 +マサシゲ 政重 +マサシゲ 正重 +マサシゲ 政繁 +マサシタ 正下 +マサジマ 政島 +マサジマ 昌島 +マサシロ 正代 +マサシロ 政城 +マサスエ 政末 +マサズミ 将積 +マサズミ 政住 +マサズミ 正住 +マサズミ 昌角 +マサタ 政田 +マサダ 正田 +マサダ 政田 +マサダ 柾田 +マサダ 間定 +マサダ 昌田 +マサタカ 正高 +マサタキ 政滝 +マサタキ 政瀧 +マサタケ 昌武 +マサタテ 正立 +マサダテ 正立 +マサタニ 正谷 +マサタニ 政谷 +マサタニ 昌谷 +マサチ 真地 +マサチ 政地 +マサチカ 政近 +マサチカ 正近 +マサツカ 正務 +マサツカ 政塚 +マサツカ 正塚 +マサツキ 正月 +マサツキ 将月 +マサツグ 政次 +マサツジ 正辻 +マサツジ 政辻 +マサツナ 政綱 +マサヅミ 将積 +マサヅミ 將積 +マサト 正戸 +マサトウ 正藤 +マサトウ 政藤 +マサトウ 政籐 +マサトキ 政時 +マサトキ 正時 +マサドコロ 政所 +マサトシ 政年 +マサトミ 正富 +マサトミ 正冨 +マサドミ 正冨 +マサトメ 正留 +マサドメ 正留 +マサトモ 政友 +マサナ 正名 +マサナオ 正直 +マサナカ 正中 +マサナカ 政中 +マサナガ 正永 +マサナガ 政永 +マサナリ 政成 +マサナリ 正成 +マサナリ 政也 +マサニ 政二 +マサニシ 正西 +マサニシ 政西 +マサネ 正根 +マザネ 真実 +マサノ 正野 +マサノ 政野 +マサノ 真砂野 +マサノ 政埜 +マサノ 正之 +マサノ 眞砂野 +マサノブ 正信 +マサノブ 正延 +マサノブ 政信 +マサノベ 政延 +マサノヤ 政野屋 +マサバ 政場 +マサハシ 正橋 +マサハシ 政橋 +マサハタ 正畑 +マサハタ 正畠 +マサバヤシ 正林 +マサバヤシ 昌林 +マサハラ 正原 +マサハラ 昌原 +マサハラ 政原 +マサハラ 方原 +マサハル 政春 +マサヒサ 正久 +マサヒサ 政久 +マサヒラ 政平 +マサヒラ 正平 +マサヒロ 政広 +マサヒロ 正広(正廣) +マサヒロ 政廣 +マサフサ 正房 +マサフジ 正藤 +マサベ 正部 +マサベ 政辺 +マサボリ 正堀 +マサマル 政丸 +マサミ 正見 +マサミ 真佐見 +マサミ 政見 +マサミ 政実 +マサミ 政實 +マサミズ 正水 +マサミズ 政水 +マサミチ 正道 +マサミチ 政道 +マサミツ 政光 +マサミツ 正光 +マサミネ 正峯 +マサミネ 正峰 +マサミヤ 正宮 +マサムネ 正宗 +マサムネ 政宗 +マサムネ 政棟 +マサムラ 正村 +マサムラ 政村 +マサムラ 将邑 +マサムラ 昌村 +マサメ 正覚 +マサメ 真覚(眞覚) +マサモト 政本 +マサモト 正本 +マサモト 柾本 +マサモト 政元 +マサモト 昌本 +マサモト 正元 +マサモト 昌元 +マサモリ 政森 +マサモリ 正森 +マサモリ 正守 +マサモリ 正盛 +マサモリ 政守 +マサモリ 政盛 +マサヤ 柾谷 +マサヤ 政谷 +マサヤ 昌谷 +マサヤ 柾屋 +マサヤ 政家 +マサヤ 政屋 +マサヤ 柾家 +マサヤス 政安 +マサヤス 政保 +マサヤス 昌安 +マサヤス 昌保 +マサヤナギ 正柳 +マサヤマ 昌山 +マサヤマ 正山 +マサヤマ 政山 +マサユウ 正勇 +マサユキ 政行 +マサユキ 正行 +マサヨシ 正好 +マサヨシ 政吉 +マサヨシ 正吉 +マサヨシ 政義 +マサヨシ 政芳 +マサヨリ 政頼 +マサラ 真皿 +マサル 正留 +マサル 真早流 +マザワ 間沢 +マザワ 真沢(眞沢) +マザワ 間澤 +マザワ 真澤 +マザワ 眞澤 +マサワキ 正脇 +マシ 真紫 +マジ 間地 +マジ 馬路 +マジ 真地 +マジ 摩治 +マジ 間路 +マシオ 増尾 +マシオ 真尾 +マシオ 真塩 +マシオ 眞塩 +マシオ 眞尾 +マシオ 真汐(眞汐) +マシオ 馬塩 +マシオカ 増岡 +マシカ 馬鹿 +マシカワ 増川 +マシカワ 倍川 +マジカワ 交川 +マシキ 真志喜 +マシキ 益城 +マシキ 真敷 +マシキ 眞志喜 +マジキナ 真境名 +マジキナ 眞境名 +マシグチ 増口 +マシゲ 真重 +マシゲ 眞重 +マシコ 益子 +マシコ 増子 +マシコ 猿子 +マシコ 増古 +マシズ 益頭 +マシタ 益田 +マシタ 真下 +マシタ 間下 +マシタ 眞下 +マシタ 味舌 +マシダ 増田 +マシダ 猿田 +マシダ 真志田 +マシダ 倍田 +マシダ 真清田 +マシダ 眞志田 +マジタ 交田 +マシヅカ 摩志塚 +マシヅメ 猿爪 +マシト 増戸 +マシドミ 増冨 +マシドリ 真志取(眞志取) +マシネ 増根 +マシノ 増野 +マシノ 真篠 +マシノ 間篠 +マシノ 増埜 +マシノ 眞篠 +マシバ 真柴 +マシバ 間柴 +マシバ 眞柴 +マシバ 間芝 +マシバ 真芝 +マシバ 増柴 +マシバ 磨志葉 +マシハラ 増原 +マシバラ 増原 +マシブ 真渋 +マシブ 真澁 +マシブ 眞渋(眞澁) +マシホ 真志保 +マシボ 増保 +マシマ 真島 +マシマ 間島 +マシマ 真嶋 +マシマ 間嶋 +マシマ 馬島 +マシマ 馬嶋 +マシマ 眞島 +マシマ 眞嶋 +マシマ 磨島 +マシマ 真嶌(眞嶌) +マシマ 摩嶋 +マシマ 間嶌 +マジマ 真島 +マジマ 間島 +マジマ 真嶋 +マジマ 間嶋 +マジマ 馬島 +マジマ 馬嶋 +マジマ 眞島 +マジマ 眞嶋 +マジマ 磨島 +マジマ 麻島 +マジマ 摩島 +マジマ 真嶌(眞嶌) +マジマ 摩嶋 +マジマ 麻嶋 +マジマ 間縞 +マジマ 満嶌 +マシミズ 真清水 +マシミズ 眞清水 +マシムラ 増村 +マシムラ 益村 +マジメ 馬締 +マジメ 馬〆 +マシモ 真下 +マシモ 間下 +マシモ 増茂 +マシモ 眞下 +マシモ 真霜 +マシモ 間霜 +マシモ 眞霜 +マシモト 増本 +マジャ 真謝 +マジャ 間邪 +マジャ 眞謝 +マシヤマ 増山 +マシュウ 真秀 +マシュウ 眞秀 +マショウ 間正 +マショウ 間生 +マショウ 増生 +マジョウ 間丈 +マシロ 万代 +マシロ 萬代 +マシロ 真城 +マシロ 間城 +マシロ 馬城 +マシロ 眞城 +マシロ 真白 +マシロ 眞白 +マシワ 増和 +マス 益 +マス 桝 +マス 升 +マス 増 +マス 万寿 +マス 枡 +マス 鱒 +マス 舛 +マス 萬寿 +マス 萬壽 +マス 満寿 +マス 猿 +マス 摩須 +マスアキ 升明 +マスイ 増井 +マスイ 桝井 +マスイ 舛井 +マスイ 益井 +マスイ 升井 +マスイ 枡井 +マスイ 真水 +マスイ 増居 +マスイ 益居 +マスイ 真住居 +マスイ 馬酔 +マスイ 増位 +マスイ 倍井 +マスイ 桝居 +マスイ 満寿居 +マスイ 増藺 +マスイ 益位 +マスイ 升居 +マスイ 摩寿意(摩壽意) +マスイ 満壽居(滿壽居) +マスイ 枡居 +マスイエ 升家 +マスイケ 益池 +マスイケ 増池 +マスイシ 増石 +マスイシ 舛石 +マスイシ 桝石 +マスイズミ 増泉 +マスイチ 升市 +マスイチ 増市 +マスイチ 桝一 +マスイチ 舛市 +マスイチ 升一 +マスイチ 桝市 +マスイチ 枡一 +マスウ 桝宇 +マスウ 枡宇 +マスウエ 増上 +マスウチ 桝内 +マスウチ 升内 +マスウチ 枡内 +マスウチ 増内 +マスウマ 増馬 +マスウミ 益海 +マスウラ 増浦 +マスウラ 桝浦 +マスウラ 益浦 +マスウラ 桝裏 +マスエ 増江 +マスエ 増栄 +マスエ 益江 +マスエ 真末(眞末) +マスエ 益栄 +マスエ 増榮 +マスエ 桝江 +マスエダ 益枝 +マスオ 増尾 +マスオ 益尾 +マスオ 舛尾 +マスオ 桝尾 +マスオ 升尾 +マスオ 枡尾 +マスオ 増雄 +マスオカ 増岡 +マスオカ 益岡 +マスオカ 舛岡 +マスオカ 桝岡 +マスオカ 升岡 +マスオカ 枡岡 +マスカ 増家 +マスカ 桝家 +マスカ 舛家 +マスカ 枡家 +マスカ 升賀 +マスガ 増賀 +マスガ 舛賀 +マスガ 益賀 +マスガ 桝賀 +マスカガミ 桝鏡 +マスカガミ 枡鏡 +マスカガミ 升鏡 +マスガキ 増垣 +マスカケ 増掛 +マスカケ 升掛 +マスカケ 舛掛 +マスカケ 桝概 +マスカタ 升方 +マスカタ 増形 +マスカタ 桝形 +マスカタ 益形 +マスカタ 舛方 +マスカタ 桝方 +マスカタ 枡方 +マスカタ 益賀多(益賀夛) +マスカタ 枡潟 +マスガタ 升方 +マスガタ 増形 +マスガタ 桝形 +マスガタ 舛形 +マスガタ 桝潟 +マスガタ 舛潟 +マスガタ 枡形 +マスガタ 枡方 +マスガタ 益県 +マスガタ 益縣 +マスガタ 升潟 +マスガタ 升形 +マスガタ 増県 +マスガタ 増縣 +マスガタ 枡潟 +マスカド 増門 +マスカネ 増金 +マスカネ 益金 +マスカネ 舛金 +マスカネ 升金 +マスガネ 増金 +マスカミ 枡上 +マスガミ 桝上 +マスガミ 舛上 +マスガミ 増上 +マスガミ 益上 +マスガミ 枡上 +マスガミ 増神 +マスカワ 増川 +マスカワ 益川 +マスカワ 升川 +マスカワ 桝川 +マスカワ 舛川 +マスカワ 枡川 +マスカワ 益河 +マスカワ 倍川 +マスカワ 満寿川 +マスキ 一寸木 +マスキ 増木 +マスキ 益城 +マスキ 舛木 +マスキ 増喜 +マスキ 升木 +マスキ 馬酔木 +マスキ 益木 +マスキ 桝木 +マスキ 増記 +マスギ 一寸木 +マスギ 馬杉 +マスギ 真杉 +マスギ 間杉 +マスギ 真椙(眞椙) +マスギ 眞杉 +マスグチ 益口 +マスグチ 桝口 +マスグチ 増口 +マスクニ 升国 +マスクニ 益国(益國) +マスクニ 升國 +マスクラ 増倉 +マスクラ 益倉 +マスクラ 舛倉 +マスクラ 升倉 +マスクラ 桝倉 +マスクラ 桝蔵 +マスクラ 枡蔵 +マスコ 益子 +マスコ 増子 +マスコ 増古 +マスコ 舛子 +マスコウ 桝幸 +マスゴウ 桝郷 +マスサカ 増坂 +マスサカ 益坂 +マスサカ 増阪 +マスザカ 増坂 +マスサキ 増崎 +マスサキ 益崎 +マスサキ 桝崎 +マスサキ 升崎 +マスザキ 増崎 +マスザキ 益崎 +マスザキ 桝崎 +マスザキ 升崎 +マスザキ 舛崎 +マスザキ 枡崎(枡嵜) +マスザキ 益嵜 +マスザキ 増嵜 +マズサキ 先崎 +マスサコ 舛迫 +マスサコ 升迫 +マスサワ 桝沢 +マスサワ 舛澤 +マスザワ 増沢 +マスザワ 増澤 +マスザワ 舛沢 +マスザワ 升沢 +マスザワ 鱒沢 +マスザワ 桝沢 +マスザワ 枡沢 +マスザワ 升澤 +マスザワ 枡澤 +マスザワ 桝澤 +マスザワ 鱒澤 +マスザワ 益沢 +マスザワ 舛澤 +マスザワ 益澤 +マスジ 増地 +マスジ 増治 +マスジ 舛治 +マスジ 桝次 +マスシオ 増塩 +マスシオ 増汐 +マスシゲ 増茂 +マスシゲ 舛重 +マスシゲ 増重 +マスシゲ 桝重 +マスシゲ 益重 +マスシゲ 益繁 +マスシゲ 升重 +マスシゲ 舛繁 +マスシタ 増下 +マスシタ 益下 +マスシタ 舛下 +マスシタ 桝下 +マスシマ 増島 +マスシマ 増嶋 +マスシマ 益島 +マスシマ 舛島 +マスシマ 益嶋 +マスジマ 増島 +マスジマ 増嶋 +マスジマ 益島 +マスジマ 舛島 +マスジマ 升島 +マスジマ 益嶋 +マスジマ 増嶌 +マスジマ 増嶹 +マスジマ 桝島 +マスジン 舛甚 +マスジン 桝甚 +マスズガワ 真鈴川(眞鈴川) +マスズミ 増住 +マスズミ 桝隅 +マスズミ 舛角 +マスズミ 益住 +マスセ 増瀬 +マスゾエ 舛添 +マスゾエ 桝添 +マスゾエ 増添 +マスゾエ 升添 +マスゾノ 益園 +マスゾノ 益薗 +マスタ 増田 +マスタ 益田 +マスタ 桝田 +マスタ 舛田 +マスタ 升田 +マスタ 枡田 +マスダ 増田 +マスダ 益田 +マスダ 桝田 +マスダ 舛田 +マスダ 升田 +マスダ 枡田 +マスダ 真寿田(眞壽田) +マスダ 倍田 +マスダ 沙田 +マスダ 鱒田 +マスタカ 桝高 +マスタケ 増竹 +マスタケ 桝竹 +マスタケ 枡竹 +マスダテ 舛館 +マスダテ 舛舘 +マスダテ 升館 +マスダテ 升舘 +マスタニ 桝谷 +マスタニ 増谷 +マスタニ 升谷 +マスタニ 舛谷 +マスタニ 枡谷 +マスタニ 益谷 +マスタハラ 益田原 +マスダヤ 増田屋 +マスダヤ 桝田屋 +マスチ 増地 +マスチ 益地 +マスヅ 増津 +マスヅ 益津 +マスヅカ 益塚 +マスヅカ 枡塚 +マスヅキ 増月 +マスツボ 増坪 +マスデ 増出 +マスト 増戸 +マスト 益戸 +マスド 増戸 +マスド 益戸 +マストウ 増藤 +マストウ 桝藤 +マストウ 増東 +マストウ 増当 +マストウ 益頭 +マストウ 増當 +マストウ 枡藤 +マストミ 増富 +マストミ 益富 +マストミ 益冨 +マストミ 増冨 +マストミ 桝富 +マストミ 舛富 +マストミ 枡富 +マストミ 桝冨 +マストミ 舛冨 +マストミ 升富 +マスドミ 益富 +マスドミ 益冨 +マスドミ 升冨 +マストメ 益留 +マストメ 増留 +マスドメ 益留 +マスドメ 増留 +マストモ 舛友 +マストモ 舛巴 +マストモ 升巴 +マストモ 桝友 +マストリ 桝取 +マスナ 真砂 +マスナカ 増中 +マスナカ 桝中 +マスナカ 舛中 +マスナカ 益中 +マスナカ 桝仲 +マスナカ 枡中 +マスナガ 増永 +マスナガ 益永 +マスナガ 桝永 +マスナガ 舛永 +マスナガ 升永 +マスナガ 増長 +マスナガ 益長 +マスナガ 舛長 +マスナガ 枡永 +マスナガ 倍永 +マスナガ 桝長 +マスナガ 枡長 +マスナミ 増南 +マスナミ 増浪 +マスナミ 桝波 +マスナリ 増成 +マスナリ 益成 +マスナリ 舛成 +マスナリ 升成 +マスナリ 桝成 +マスニシ 増西 +マスネ 増根 +マスノ 増野 +マスノ 桝野 +マスノ 益野 +マスノ 升野 +マスノ 舛野 +マスノ 枡野 +マスノ 枡𡌛 +マスノイ 増ノ井 +マスノウチ 升ノ内 +マスノウチ 舛ノ内 +マスノウチ 桝之内 +マスノウチ 枡之内 +マスノミ 桝呑 +マスノヤ 増野谷 +マスバ 増羽 +マスバ 増場 +マスハシ 増橋 +マスハタ 増畠 +マスハナ 舛花 +マスハマ 増浜 +マスハマ 益浜(益濱) +マスハマ 増濱 +マスバヤシ 増林 +マスバヤシ 桝林 +マスハラ 増原 +マスハラ 益原 +マスハラ 桝原 +マスハラ 升原 +マスハラ 舛原 +マスハラ 枡原 +マスハル 増春 +マスヒサ 舛久 +マスヒサ 益久 +マスヒサ 升久 +マスヒラ 桝平 +マスヒラ 増平 +マスヒラ 升平 +マスヒラ 枡平 +マスヒロ 益弘 +マスヒロ 増広 +マスヒロ 舛広 +マスヒロ 升広 +マスヒロ 増弘 +マスヒロ 増廣 +マスヒロ 益広 +マスヒロ 升廣 +マスヒロ 舛廣 +マスヒロ 桝広 +マスフチ 増渕 +マスブチ 増渕 +マスブチ 増淵 +マスブチ 鱒渕 +マスブチ 鱒淵 +マスブチ 桝渕 +マスブチ 舛淵 +マスブチ 益渕 +マスブチ 桝淵 +マスブチ 舛渕 +マスブチ 益淵 +マスブチ 升淵 +マスブチ 升渕 +マスブチ 枡渕 +マスベ 舛部 +マスベ 増部 +マスホ 増保 +マスホ 増穂 +マスホシ 升星 +マスマ 増間 +マスマ 増馬 +マスマ 升間 +マスマエ 益前 +マスマタ 増亦 +マスマル 増丸 +マスマル 益丸 +マスミ 増見 +マスミ 真角 +マスミ 桝見 +マスミ 舛見 +マスミ 真住 +マスミ 升見 +マスミ 真隅(眞隅) +マスミ 真澄 +マスミ 枡見 +マスミ 益見 +マスミ 升味 +マスミ 升箕 +マスミ 倍味 +マスミ 麻住 +マスミ 桝実 +マスミ 益海 +マスミ 増実 +マスミ 増美 +マスミ 増味 +マスミ 鱒見 +マスミ 桝實 +マスミ 枡実 +マスミ 眞角 +マスミ 眞住 +マスミ 眞澄 +マスミ 眞清 +マズミ 真住 +マズミ 眞住 +マスミズ 升水 +マスミズ 増水 +マスミズ 舛水 +マスミズ 桝水 +マスミダ 真隅田 +マスミツ 益満 +マスミツ 増満(増滿) +マスミツ 桝満 +マスミツ 升光 +マスミツ 益滿 +マスミツ 舛光 +マスミヤ 増宮 +マスミヤ 益宮 +マスミヤ 桝宮 +マスムネ 桝宗 +マスムネ 舛宗 +マスムラ 増村 +マスムラ 益村 +マスムラ 桝村 +マスムラ 益邑 +マスムラ 升村 +マスムラ 舛村 +マスムラ 鱒村 +マスムラ 増邨 +マスムラ 枡村 +マスムロ 桝室 +マスモ 増茂 +マスモ 増毛 +マスモ 増百 +マスモ 益茂 +マスモト 増本 +マスモト 桝本 +マスモト 益本 +マスモト 増元 +マスモト 升本 +マスモト 舛本 +マスモト 枡本 +マスモト 舛元 +マスモト 升元 +マスモト 桝元 +マスモト 益元 +マスモト 万寿本(万壽本) +マスモト 倍本 +マスモト 枡元 +マスモトヤ 舛本屋 +マスモリ 増森 +マスモリ 舛森 +マスモリ 益森 +マスモリ 升森 +マスモリ 舛盛 +マスモリ 桝森 +マスモリ 益盛 +マスモリ 升守 +マスモリ 益守 +マスモリ 増守 +マスモリ 増盛 +マスモリ 倍盛 +マスヤ 桝谷 +マスヤ 増谷 +マスヤ 升谷 +マスヤ 舛谷 +マスヤ 舛屋 +マスヤ 桝屋 +マスヤ 枡谷 +マスヤ 益谷 +マスヤ 升屋 +マスヤ 桝矢 +マスヤ 増矢 +マスヤ 増家 +マスヤ 桝家 +マスヤ 枡屋 +マスヤ 増屋 +マスヤ 舛矢 +マスヤ 升家 +マスヤ 升也 +マスヤ 桝舎 +マスヤ 枡矢 +マスヤネ 桝屋根 +マスヤマ 増山 +マスヤマ 益山 +マスヤマ 桝山 +マスヤマ 舛山 +マスヤマ 升山 +マスヤマ 枡山 +マズヤマ 先山 +マスユキ 舛行 +マスユキ 益行 +マスユキ 益雪 +マスユキ 升行 +マスヨシ 益吉 +マスヨシ 増吉 +マスヨシ 舛吉 +マスヨシ 升吉 +マスリ 増利 +マスワ 増輪 +マスワ 増和 +マスワカ 益若 +マセ 間瀬 +マセ 真瀬 +マセ 馬瀬 +マセ 満瀬 +マセ 眞瀬 +マセ 真勢(眞勢) +マセ 摩瀬 +マゼ 間瀬 +マゼ 真瀬 +マゼ 馬瀬 +マゼ 眞瀬 +マセガキ 真瀬垣(眞瀬垣) +マセガキ 間瀬垣 +マセキ 柵木 +マセキ 真関 +マセキ 馬酔木 +マセキ 欄 +マセキ 間瀬木 +マセキ 欄木 +マセキ 真瀬木 +マセキ 眞関 +マセギ 柵木 +マセギ 間瀬木 +マゼキ 真関 +マゼキ 間関 +マゼキ 馬関 +マゼキナ 真境名 +マセグチ 間瀬口 +マセグチ 馬瀬口 +マセダ 間世田 +マセダ 間瀬田 +マセダ 真瀬田 +マセダ 真清田 +マセト 間瀬戸 +マセド 間瀬戸 +マセド 馬瀬戸 +マセド 真世土 +マセバ 間瀬羽 +マセバ 間瀬場 +マセバ 間狭(間狹) +マセヤマ 馬瀬山 +マソ 間曽 +マソ 間曾 +マゾエ 真添 +マゾク 麻続 +マソレ 真草嶺 +マソレ 眞草嶺 +マゾレ 真艸嶺 +マタ 真多(眞多) +マタ 又 +マタ 亦 +マタ 摩多 +マタ 俣 +マダ 馬田 +マダ 間田 +マダ 間多 +マダ 摩田 +マタイ 又井 +マタイ 又居 +マタイ 叉井 +マタイチ 又市 +マタウチ 又打 +マタエ 俣江 +マタエ 又江 +マタエバラ 又江原 +マタエバル 又江原 +マタオ 股尾 +マタオカ 俣岡 +マタカ 又賀 +マタカ 俣賀 +マタカ 亦賀 +マタカ 真高 +マタガ 又賀 +マタガ 俣賀 +マタガ 亦賀 +マタガ 叉賀 +マタカツ 亦勝 +マタガリ 又刈 +マタカワ 又川 +マタカワ 俣川 +マタカワ 亦川 +マタガワ 又川 +マタガワ 俣川 +マタガワ 股川 +マタキ 又木 +マタキ 俣木 +マタキ 亦木 +マタキ 叉木 +マタキ 股木 +マタギ 又木 +マタギ 俣木 +マタキチ 又吉 +マタグチ 又口 +マタクボ 級久保 +マタクラ 俣倉 +マタクロ 又畔 +マタケ 真武 +マタケ 真竹 +マタケ 眞竹 +マタケ 間竹 +マタケ 間武 +マタケ 眞武 +マタザ 又座 +マタザ 股座 +マタザ 又㘴 +マタサカ 又坂 +マタザキ 俣崎 +マタザワ 間田沢 +マタザワ 間田澤 +マタザワ 俣沢 +マタシゲ 又重 +マタシマ 俣島 +マタジマ 俣島 +マタジマ 俣嶋 +マタシロ 又城 +マタシロ 叉城 +マタセ 俣瀬 +マタセ 亦瀬 +マタソ 又曽 +マタダ 又多 +マタダ 俣田 +マタダ 又田 +マタダ 真忠(眞忠) +マタダ 亦田 +マタタニ 又谷 +マタチ 又地 +マダチ 馬立 +マダチ 真舘 +マダチ 真館(眞館) +マダチ 眞舘 +マタツカ 俣塚 +マタヅマ 俣妻 +マタテ 馬立 +マダテ 馬立 +マダテ 真舘 +マダテ 間立 +マダテ 真館(眞館) +マダテ 間館 +マダテ 間舘 +マダテ 眞舘 +マダテ 真達 +マタニ 真谷 +マタニ 麻谷 +マタニ 間谷 +マタニ 真渓 +マタニ 眞谷 +マタニ 真湲 +マタニ 真溪 +マタニ 眞溪 +マダニ 間谷 +マタネ 真種 +マタノ 俣野 +マタノ 又野 +マタノ 亦野 +マタノ 股野 +マタノ 俟野 +マタノ 満多野 +マタノ 又農 +マタノ 真田野 +マタノキ 級木 +マタノキ 极木 +マタバ 又場 +マタバ 又葉 +マタバ 又羽 +マタバ 叉羽 +マタバ 亦場 +マタハラ 又原 +マタハリ 股張 +マタヒラ 又平 +マタヒラ 俣平 +マタヒラ 亦平 +マタヒラ 叉平 +マタベ 股部 +マタベ 亦部 +マタベ 又部 +マタベ 又辺(又邊) +マタマ 真玉 +マタマ 眞玉 +マタマ 俣摩 +マタマ 又間 +マダマ 真玉 +マダマ 眞玉 +マタマハシ 真玉橋 +マタマル 又丸 +マタミ 又見 +マタミ 俣見 +マタミ 叉見 +マタミゾ 俣溝 +マタムラ 又村 +マタムラ 股村 +マタムラ 俣村 +マタムラ 叉村 +マタモト 俣本 +マタモリ 又森 +マタヤマ 俣山 +マタヤマ 又山 +マタヨシ 又吉 +マタヨシ 叉吉 +マタライ 又来 +マタライ 又耒 +マダライシ 班石 +マダラメ 斑目 +マダラメ 班目 +マダンバシ 真玉橋 +マチ 町 +マチ 間地 +マチ 真智(眞智) +マチ 磨知 +マヂ 間地 +マチアイ 待合 +マチイ 町井 +マチイ 待井 +マチイ 町居 +マチウチ 町内 +マチウラ 町浦 +マチオ 町尾 +マチオカ 町岡 +マチオカ 待岡 +マチガキ 町垣 +マチガシラ 町頭 +マチカタ 町方 +マチカミ 町上 +マチガミ 町上 +マチカワ 町川 +マチカワ 町河 +マチカワ 待川 +マチガワ 町側 +マチキ 待木 +マチキタ 町北 +マチクサ 町草 +マチグサ 町草 +マチグチ 町口 +マチコマ 町駒 +マチザキ 町崎 +マチザト 町里 +マチザワ 町沢 +マチザワ 町澤 +マチシ 町支 +マチシタ 町下 +マチシマ 町島 +マチシマ 待島(待嶋) +マチジマ 町島 +マチジマ 待島(待嶋) +マチジマ 町嶋 +マチシャク 町釈(町釋) +マチジリ 町尻 +マチズカ 町塚 +マチスジ 町筋 +マチゾノ 町園 +マチタ 町田 +マチダ 町田 +マチダ 丁田 +マチダ 待田 +マチダ 真知田 +マチダ 街田 +マチダ 真智田 +マチダ 町多 +マチダ 眞知田 +マチタニ 町谷 +マチタニ 待谷 +マチダヤ 町田屋 +マチツカ 町塚 +マチヅカ 町塚 +マチデ 町出 +マチテラ 待寺 +マチデラ 待寺 +マチド 町戸 +マチトリ 待鳥 +マチドリ 待鳥 +マチナカ 町中 +マチナガ 町永 +マチナガ 待永 +マチナガ 町長 +マチナミ 町並 +マチノ 町野 +マチノ 待野 +マチノ 万千野 +マチバ 待場 +マチバ 町羽 +マチバ 町場 +マチハタ 町畑 +マチハタ 町畠 +マチバタ 町端 +マチハナ 町花 +マチバナ 町端 +マチハラ 町原 +マチヒラ 町平 +マチブン 町分 +マチベ 町辺 +マチミズ 待水 +マチムラ 町村 +マチモト 町本 +マチモト 町元 +マチモト 待元 +マチモト 待本 +マチヤ 町屋 +マチヤ 町谷 +マチヤ 待谷 +マチヤ 町矢 +マチヤ 町家 +マチヤ 待夜 +マチヤシキ 町屋敷 +マチヤマ 町山 +マチヤマ 待山 +マチュウダ 摩中田 +マチョウ 間長 +マツ 松 +マツアイ 松会(松會) +マツアキ 松明 +マツアキ 松秋 +マツアミ 松阿弥 +マツアミ 松阿彌 +マツアリ 松有 +マツイ 松井 +マツイ 松居 +マツイ 松生 +マツイ 末井 +マツイ 松為 +マツイ 枩井 +マツイ 松位 +マツイ 真対 +マツイ 松伊 +マツイ 松猪 +マツイ 松爲 +マツイエ 松家 +マツイガワ 松井川 +マツイキ 松生 +マツイケ 松生 +マツイケ 松池 +マツイケ 枩池 +マツイシ 松石 +マツイダ 松井田 +マツイチ 松一 +マツイデ 松出 +マツイバタ 松井端 +マツイワ 松岩 +マツウ 松鵜 +マツウ 松宇 +マツウエ 松上 +マツウエ 松植 +マツウキ 松浮 +マツウチ 松内 +マツウマ 松馬 +マツウミ 松海 +マツウミ 末海 +マツウメ 松梅 +マツウラ 松浦 +マツウラ 松裏 +マツウラ 枩浦 +マツウラ 末浦 +マツエ 末永 +マツエ 松枝 +マツエ 松江 +マツエ 松栄 +マツエ 松英 +マツエ 松会(松會) +マツエ 松榮 +マツエ 末栄 +マツエイ 松栄 +マツエイ 松榮 +マツエガワ 松江川 +マツエダ 松枝 +マツオ 松尾 +マツオ 松生 +マツオ 松王 +マツオ 松雄 +マツオ 尾 +マツオ 松緒 +マツオ 松男 +マツオ 枩尾 +マツオイ 松生 +マツオウ 松王 +マツオオジ 松大路 +マツオカ 松岡(枩岡) +マツオカ 松丘 +マツオカ 松岳 +マツオカ 松尾賀 +マツオカヤ 松岡屋 +マツオク 松奥 +マツオザキ 松尾崎 +マツオザワ 松尾澤 +マツオダ 松尾田 +マツオダニ 松尾谷 +マツオチ 松落 +マツオト 松音 +マツオリ 松折 +マッカ 真下 +マッカ 眞下 +マッカ 真賀(眞賀) +マツカ 松家 +マツカ 松賀 +マツカ 松香 +マツカ 松嘉 +マツガ 松賀 +マヅカ 馬塚 +マヅカ 間塚 +マヅカ 真塚(眞塚) +マツカイ 松海 +マツガイ 松谷 +マツガイ 松海 +マツガイ 松貝 +マツガイ 松ケ井 +マツガイ 松養 +マツガウラ 松ケ浦 +マツガエ 松枝 +マツガエ 松ケ枝 +マツガキ 松垣 +マツカケ 松掛 +マツカゲ 松蔭 +マツカゲ 松影 +マツカゲ 松陰 +マツカゲ 松景 +マツカゴ 松籠 +マツカサ 松笠 +マツガサキ 松ケ崎 +マツガサコ 松ケ迫 +マツガサワ 松ケ沢(松ケ澤) +マツカシ 松柏 +マツカジ 松梶 +マツガシタ 松ケ下 +マツガシマ 松ケ島 +マツガシラ 松頭 +マツガスミ 松ケ角 +マツカゼ 松風 +マツガセ 松ケ瀬 +マツカタ 松方 +マツカタ 松形 +マツガタ 松方 +マツガタ 松形 +マツガタニ 松ケ谷 +マツカド 松門 +マツカド 松角 +マツカド 松陵 +マツガトウゲ 松ケ峠 +マツガナカ 松ケ中 +マツカネ 松金 +マツカネ 松兼 +マツカネ 松鐘 +マツガネ 松金 +マツガネ 松兼 +マツガネ 松ケ根 +マツガノ 松ケ野 +マツガノ 松ガ野 +マツガヒラ 松ケ平 +マツカミ 松上 +マツカミ 松頭 +マツカミ 松神 +マツガミ 松上 +マツガミ 松神 +マツカモト 松加本 +マツガヤ 松ケ谷 +マツカワ 松川(枩川) +マツカワ 松河 +マツカワ 馬津川 +マツカワ 松皮 +マツガワ 松川(枩川) +マツガワ 松河 +マツカワラ 松川原 +マツガワラ 松川原 +マツカワワタリ 松川渡 +マツカン 松考 +マッキ 巻木 +マツキ 松木 +マツキ 末木 +マツキ 松城 +マツキ 松樹 +マツキ 松喜 +マツギ 松木 +マツギ 真継(眞繼) +マツギ 松儀 +マツギ 馬継 +マツギ 直継 +マツギ 眞継 +マヅキ 真月 +マツギシ 松岸 +マツキゾノ 松木園 +マツキゾノ 松木薗 +マツキゾノ 松木囿 +マツキタ 松木田 +マツキタ 松北 +マツキダ 松木田 +マツキダイラ 松木平 +マツキダニ 松木谷 +マツキノミヤ 松気之宮 +マツキヒラ 松木平 +マツキヨ 松清 +マツギョ 松魚 +マツク 松久 +マツグ 真継(眞繼) +マツグ 真次 +マツグ 眞継 +マツグ 眞次 +マツクサ 松草 +マツクチ 松口 +マツグチ 松口 +マツクニ 松邦 +マツクボ 松久保 +マツクボ 松窪 +マツクマ 松隈 +マツクマ 松熊 +マツクマ 松隅 +マツグマ 松隈 +マツグマ 松熊 +マツクラ 松倉 +マツクラ 枩倉 +マツクラ 松蔵(松藏) +マツクラ 松庫 +マツグロ 松黒 +マツゲ 松毛 +マツゲタ 松下田 +マッコウ 抹香 +マツゴウ 松郷 +マツコウジ 松向寺 +マツコシ 松越 +マツコト 松琴 +マツコバ 松木場 +マツサ 松佐 +マツサカ 松坂 +マツサカ 松阪 +マツサカ 松栄 +マツサカ 松榮 +マツサカ 松峴 +マツザカ 松坂 +マツザカ 松阪 +マツザカヤ 松阪谷 +マツサガワ 松佐川 +マツサガワ 松左川 +マッサキ 先崎 +マッサキ 末崎 +マッサキ 真先 +マッサキ 全先 +マッサキ 眞先 +マツサキ 松崎 +マツサキ 先崎 +マツサキ 松嵜 +マツサキ 全先 +マツザキ 松崎 +マツザキ 末崎 +マツザキ 松嵜 +マツザキ 松埼 +マツザキ 松碕 +マツザキ 枩崎 +マツサケ 松酒 +マツザケ 松酒 +マツサコ 松迫 +マツサコ 松佐古 +マツサコ 松窄 +マツサコ 松浴 +マツザコ 松迫 +マツサコマ 松迫間 +マツサト 松里 +マツザト 松里 +マツサワ 松沢 +マツサワ 松澤 +マツザワ 松沢 +マツザワ 松澤 +マツザワ 枩沢 +マツザワ 枩澤 +マツシ 松四 +マツジ 松持 +マツジ 松地 +マツジ 松路 +マツジ 真辻(眞辻) +マツシオ 松汐 +マツシカ 松鹿 +マツシキ 松色 +マツシゲ 松重 +マツシゲ 松繁 +マツシタ 松下 +マツシタ 末下 +マツシタ 枩下 +マツシタ 下 +マツシノ 松篠 +マツシバ 松柴 +マツシバ 松芝 +マツシマ 松島 +マツシマ 松嶋 +マツシマ 松嶌 +マツシマヤ 松島屋 +マツシメ 松七五三 +マツシモダ 松下田 +マツジュ 松寿 +マツジュ 松壽 +マツショウ 松荘 +マツジョウ 松門 +マツジリ 松尻 +マツシロ 松代 +マツシロ 松城 +マツシロヤ 松代屋 +マツシン 松新 +マツシン 松真 +マツスエ 松末 +マツスエ 松未 +マツズカ 松塚 +マツスギ 松杉 +マツズミ 松住 +マツズミ 松角 +マツセ 松瀬 +マツセ 松世 +マツセ 松勢 +マツセ 松脊 +マツセ 松背 +マツセン 松千 +マツソウ 松相 +マツゾエ 松添 +マツソノ 松園 +マツソノ 松薗 +マツゾノ 松園 +マツゾノ 松薗 +マッタ 松田 +マッタ 茨田 +マッタ 全田 +マツタ 松田 +マツタ 松多 +マツタ 枩田 +マツダ 松田 +マツダ 松多 +マツダ 枩田 +マツダイ 松代 +マツダイ 松台 +マツダイ 末代 +マツダイ 松大 +マツダイ 松臺 +マツダイラ 松平 +マツタカ 松高 +マツタカ 松鷹 +マツタカ 松隆 +マツタキ 松滝 +マツタケ 松竹 +マツタケ 松武 +マツタケ 松岳 +マツダケ 松岳 +マツタケヤ 松竹谷 +マツダシマ 松田島 +マッタツ 廻立 +マツタテ 松舘 +マツタテ 松立 +マツダテ 松館 +マツダテ 松舘 +マツダテ 松立 +マッタニ 松谷 +マツタニ 松谷 +マツタニ 松渓 +マツタニ 松溪 +マツタニ 枩谷 +マツダニ 松谷 +マツタハラ 松田原 +マツタヤ 松田谷 +マツダヤ 松田谷 +マツダワラ 松俵 +マツチ 真土 +マツチ 松地 +マツチ 眞土 +マツチカ 松近 +マツヅ 松津 +マツツカ 松塚 +マツヅカ 松塚 +マツヅキ 松月 +マツツジ 松辻 +マツツナ 松綱 +マツツネ 松常 +マツツユ 松露 +マツツル 松鶴 +マツヅル 松鶴 +マツテ 松手 +マツデ 松出 +マツテラ 松寺 +マツデラ 松寺 +マツデラ 待寺 +マツト 松戸 +マツト 松登 +マツト 松百 +マツド 松戸 +マツド 松土 +マットウ 松任 +マツトウ 松藤(枩藤) +マツトウ 松任 +マツトウ 松頭 +マツトウ 松百 +マツドウ 松藤(枩藤) +マツドウ 松堂 +マツドウ 松胴 +マツトウゲ 松峠 +マットウヤ 松任谷 +マットウヤ 松任屋 +マツトウヤ 松任谷 +マツトク 松徳 +マツトミ 松富 +マツトミ 松冨 +マツドミ 松富 +マツドミ 松冨 +マツトメ 松留 +マツドメ 松留 +マツトモ 松友 +マットリ 待鳥 +マツトリ 待鳥 +マツトリ 松鳥 +マツナ 松名 +マツナ 松那 +マツナイ 松内 +マツナエ 松苗 +マツナオ 松直 +マツナカ 松中 +マツナカ 松仲 +マツナガ 松永(枩永) +マツナガ 松長 +マツナガネ 松長根 +マツナギ 馬緤 +マツナギ 松梛 +マツナギ 松奈木 +マツナシ 松梨 +マツナセ 松名瀬 +マツナダ 松灘 +マツナミ 松波 +マツナミ 松浪 +マツナミ 松並(松竝) +マツナミ 松涛 +マツナミ 松南 +マツナミ 松濤 +マツナミキ 松並木 +マツナリ 松成 +マツナワ 松縄 +マツナワ 松繩 +マツニ 松仁 +マツニ 松二 +マツニシ 松西 +マツニシ 枩西 +マツヌマ 松沼 +マツネ 松根 +マツネ 真常(眞常) +マツノ 松野 +マツノ 松能 +マツノ 真津野 +マツノ 松埜 +マツノ 松乃 +マツノ 松之 +マツノ 松農 +マツノ 松𡌛 +マツノ 枩埜 +マツノ 枩野 +マツノ 眞津野 +マツノイ 松ノ井 +マツノイ 松野井 +マツノウ 松能 +マツノウチ 松之内 +マツノウチ 松ノ内 +マツノウチ 松野内 +マツノウラ 松之浦 +マツノオ 松野尾 +マツノオ 松ノ尾 +マツノオ 松之尾 +マツノオ 松の尾 +マツノキ 松木 +マツノキ 松ノ木 +マツノキ 松之木 +マツノキ 松野木 +マツノキ 松軒 +マツノギ 松野木 +マツノギ 松禾 +マツノゴウ 松野郷 +マツノサコ 松之迫 +マツノシタ 松野下 +マツノシタ 松ノ下 +マツノシタ 松之下 +マツノシャ 松之舎 +マツノダイラ 松野平 +マツノタニ 松ノ谷 +マツノダン 松之段(松ノ段) +マツノハナ 松端 +マツノヒラ 松野平 +マツノヒラ 松之平 +マツノブ 松延 +マツノブ 松信 +マツノブ 松廷 +マツノベ 松延 +マツノベ 松廼辺 +マツノモト 松之本 +マツノモト 松野本 +マツノモト 松ノ元 +マツノヤ 松野谷 +マツノワキ 松の脇 +マツバ 松葉 +マツバ 松波 +マツバ 松場(松塲) +マツバ 松羽 +マツバ 松馬 +マツバ 枩場 +マツバ 枩葉 +マツバイ 松葉井 +マツバエ 松栄 +マツバエ 松八重 +マツバエ 松榮 +マツバグチ 松葉口 +マツバサ 松葉佐 +マツバサ 松羽佐 +マツハシ 松橋 +マツハシ 松端 +マツハシ 松槁 +マツハシ 松嶠 +マツバシ 松橋 +マツバセ 松橋 +マツバセ 松葉瀬 +マツハタ 松畑 +マツハタ 松端 +マツハタ 松畠 +マツハタ 松圃 +マツバタ 松端 +マツハナ 松花 +マツハナ 松鼻 +マツハバ 松巾 +マツババ 松馬場 +マツハマ 松浜 +マツハマ 松濱 +マツバヤ 松葉谷 +マツバヤ 松葉屋 +マツバヤシ 松林(枩林) +マツハラ 松原 +マツバラ 松原 +マツバラ 末原 +マツバラ 枩原 +マツヒ 松日 +マツヒサ 松久 +マツヒサ 松寿 +マツビシ 松菱 +マツヒビ 松日比 +マツヒメ 松姫 +マツヒラ 松平 +マツヒラ 松比良 +マツヒラ 松日楽 +マツヒラ 松日樂 +マツヒロ 松広 +マツヒロ 松廣 +マツヒロ 松弘 +マツヒロヤ 松広屋 +マツヒロヤ 松廣屋 +マツブ 松生 +マツブ 松布 +マツフサ 松房 +マツフジ 松藤(枩藤) +マツフジ 松富士 +マツブシ 松伏 +マツブチ 松渕 +マツブチ 松淵 +マツフネ 松舟 +マツフネ 松船 +マツフル 松古 +マツブロ 松風呂 +マツベ 松部 +マツベ 松辺 +マツホ 松帆 +マツホ 松保 +マツホ 松甫 +マツボ 松保 +マツボ 松穂(松穗) +マッポウ 末法 +マツボシ 松干 +マツホド 松程 +マツホリ 松堀 +マツボリ 松堀 +マツマ 松間 +マツマ 松満 +マツマエ 松前 +マツマエヤ 松前谷 +マツマエヤ 松前屋 +マツマサ 松政 +マツマタ 松股 +マツマル 松丸 +マツマロ 松麿 +マツミ 松見 +マツミ 松実 +マツミ 松海 +マツミ 松實 +マツミ 松味 +マツミ 末海 +マツミ 松三 +マツミ 松身 +マツミ 松美 +マツミ 松未 +マツミ 梥見 +マツミズ 松水 +マツミドリ 松緑 +マツミナミ 松南 +マツミネ 松峯 +マツミネ 松嶺 +マツミネ 松峰 +マツミヤ 松宮 +マツムコ 松向 +マツムコウ 松向 +マツムネ 松宗 +マツムネ 松棟 +マツムラ 松村 +マツムラ 松邨 +マツムラ 松邑 +マツムラ 枩村 +マツムラ 枩邑 +マツムロ 松室 +マツメ 松目 +マヅメ 馬詰(馬誥) +マツメイ 松明 +マツモ 松茂 +マツモチ 松持 +マツモト 松本 +マツモト 松元 +マツモト 枩本(梥本) +マツモト 松茂渡 +マツモト 松夲 +マツモト 茉本 +マツモトヤマ 松本山 +マツモラ 松茂良 +マツモリ 松森 +マツモリ 松盛 +マツモリ 松守 +マツモンジ 松門寺 +マツヤ 松谷 +マツヤ 松家 +マツヤ 松屋 +マツヤ 松矢 +マツヤ 松舎 +マツヤエ 松八重 +マツヤス 松安 +マツヤチ 松谷内 +マツヤナギ 松柳 +マツヤマ 松山 +マツヤマ 枩山 +マツユキ 松雪 +マツユキ 松行 +マツヨ 松代 +マツヨ 松世 +マツヨシ 末吉 +マツヨシ 松吉 +マツヨシ 松好 +マツヨシ 松芳 +マツヨシ 松由 +マツヨシ 松義 +マツラ 松浦 +マツラ 松良 +マツラ 松羅 +マツラ 真面(眞面) +マツラ 真貫 +マツリダ 祭田 +マツリュウ 松竜 +マツリュウ 松龍 +マヅル 真鶴 +マヅル 眞鶴 +マツルギ 真釼(眞釼) +マツロウ 松籠 +マツワ 松和 +マツワ 松輪 +マツワカ 松若 +マツワキ 松脇 +マツワケ 松分 +マツワタリ 松渡 +マツワリ 松割 +マテ 真手 +マテ 眞手 +マテ 萬里 +マテ 間叮 +マデ 真出 +マテノ 間手野 +マデノコウジ 万里小路 +マデノコウジ 萬里小路 +マテハラ 間手原 +マデラ 真寺 +マデラ 眞寺 +マト 間戸 +マト 的 +マト 麻戸 +マド 間戸 +マトイ 的井 +マトイ 的射 +マドイ 窓井 +マトイケ 的池 +マトイシ 的石 +マトイタ 的板 +マトイバ 的射場 +マドイワ 窓岩 +マトウ 真藤 +マトウ 間藤 +マトウ 眞藤 +マトウ 綶 +マトウ 間東 +マトウ 真当(真當) +マトウ 間籐 +マトウ 摩騰 +マドウ 間遠 +マドウ 間堂 +マトウゲ 間峠 +マトウチ 的打 +マトエ 的衛 +マトオ 的尾 +マドオ 間遠 +マドオカ 窓岡 +マドカ 円 +マドカ 圓 +マドカ 円日(圓日) +マドカ 窓香 +マトガタ 的形 +マトカワ 的川 +マトガワ 的川 +マドカワ 窓川 +マドギ 円城 +マドギ 圓城 +マドコロ 間所 +マドコロ 間処 +マドコロ 真所(眞所) +マドコロ 政処 +マドコロ 満所 +マドコロ 麻所 +マドコロ 間處 +マトザキ 的崎 +マトジ 的地 +マトシロ 的代 +マトダ 的田 +マトダニ 間戸谷 +マトテ 的手 +マトノ 真野 +マトノ 的野 +マトノ 真殿 +マトノ 眞野 +マトノ 的埜 +マトノ 眞殿 +マトノ 的之 +マドノ 真殿 +マドノ 馬殿 +マドノ 眞殿 +マドノ 間殿 +マトノヤ 的野屋 +マトバ 的場 +マトバ 的羽 +マトバ 間戸場 +マトバ 的馬 +マトバ 馬戸場 +マトバ 的葉 +マトバ 的塲 +マドバ 窓場 +マトハヤ 的早 +マトハラ 真戸原 +マトハラ 眞戸原 +マドハラ 窓原 +マトミ 真富(眞富) +マトムラ 的村 +マトメ 圓 +マトメ 馬止 +マドメ 馬止 +マトモト 的本 +マトヤ 的矢 +マトヤ 的屋 +マトヤマ 的山 +マトリ 真鳥 +マトリ 馬鳥 +マトリ 間取 +マトリ 真取 +マトリ 眞鳥 +マトリ 馬取 +マドレ 真艸嶺 +マナ 真菜 +マナ 眞菜 +マナ 間名 +マナ 真奈 +マナ 真名 +マナイ 真井 +マナイ 真名井 +マナイ 眞井 +マナイ 真内 +マナイ 眞内 +マナイ 眞名井 +マナカ 間中 +マナカ 真中 +マナカ 満仲(滿仲) +マナカ 真仲 +マナカ 間仲 +マナカ 眞中 +マナカ 眞仲 +マナガ 間永 +マナガ 真長 +マナガキ 真名垣(眞名垣) +マナキ 馬男木 +マナキ 馬奈木 +マナギ 馬男木 +マナギ 馬奈木 +マナコ 真子 +マナコ 真名子 +マナコ 眞子 +マナコ 麻那古 +マナコ 眞名子 +マナコ 真那子 +マナコ 真奈子 +マナゴ 真砂 +マナゴ 真子 +マナゴ 砂子 +マナゴ 真名子 +マナゴ 眞砂 +マナゴ 眞子 +マナゴ 麻那古 +マナゴ 眞名子 +マナゴ 真那子 +マナザキ 眞崎 +マナジリ 眦 +マナセ 眞瀬 +マナセ 曲直瀬 +マナセ 真名瀬(眞名瀬) +マナダ 真田 +マナダ 眞田 +マナダ 真名田(眞名田) +マナツ 真津 +マナヅ 真津 +マナヅル 真鶴 +マナヅル 眞鶴 +マナノ 真名野(眞名野) +マナブ 学 +マナベ 真鍋 +マナベ 真部 +マナベ 真辺 +マナベ 間部 +マナベ 眞鍋 +マナベ 間辺 +マナベ 間鍋 +マナベ 眞部 +マナベ 眞辺 +マナベ 真邉 +マナベ 真邊 +マナベ 曲直部 +マナベ 眞邊 +マナベ 眞邉 +マナベ 間名部 +マナベ 間邊 +マナベ 間邉 +マナベ 曲直 +マナベ 真名部 +マナミ 真見 +マナミ 間普 +マナミ 馬波 +マニ 真新 +マニ 摩尼 +マニ 満仁 +マニザキ 満仁崎 +マニシ 馬西 +マニシ 真西 +マニタ 真仁田 +マニタ 間仁田 +マニタ 馬仁田 +マニタ 眞仁田 +マニュウ 間生 +マニュウダ 真生田(眞生田) +マニワ 馬庭 +マニワ 間庭 +マニワ 真庭 +マニワ 摩庭 +マニワ 万庭 +マニワ 眞庭 +マヌマ 真沼(眞沼) +マネイ 真根井 +マネキ 招 +マネヤマ 間根山 +マネヤマ 万年山(萬年山) +マノ 真野 +マノ 間野 +マノ 馬野 +マノ 眞野 +マノ 磨野 +マノ 真埜(眞埜) +マノ 写野 +マノ 真𡌛 +マノウ 真能 +マノウ 真納 +マノウ 間納 +マノウ 眞能 +マノウチ 間野内 +マノカワ 間之川 +マノクチ 間之口 +マノクボ 間野窪 +マノシロ 馬城 +マノセ 間ノ瀬 +マノセ 真之瀬 +マノダ 間野田 +マノダ 真野田 +マノベ 真延(眞延) +マノボリ 馬登 +マノムラ 間野村 +マノメ 馬目 +マノメ 真野目 +マノメ 間野目 +マノメ 眞野目 +マバ 馬場 +マハシ 馬橋 +マハシ 間橋 +マハシ 真橋(眞橋) +マハシ 間端 +マバシ 馬橋 +マバシ 間橋 +マバシ 真橋(眞橋) +マハタ 真畑 +マハタ 真幡(眞幡) +マハタ 真秦 +マハタ 眞秦 +マハタ 眞畑 +マハタキ 真幡木(眞幡木) +マハナ 真𡽶 +マハナ 眞𡽶 +マハナ 真鼻 +マハナ 眞鼻 +マハナシ 馬放 +マハマ 真浜 +マハマ 眞浜 +マハマ 眞濱 +マハラ 馬原 +マハラ 真原 +マハラ 馬服 +マハラ 間原 +マハラ 眞原 +マバラ 馬原 +マバラ 真原 +マバラ 馬服 +マバラ 間原 +マバリ 澗張 +マヒガシ 間東 +マヒガシ 真東 +マヒコ 間彦 +マヒデ 真秀 +マヒデ 眞秀 +マヒト 真人 +マヒラ 間平 +マビラ 間平 +マブ 真部 +マブ 間普 +マブグチ 間賦口 +マブグチ 儲口 +マフジ 真藤 +マフジ 眞藤 +マブシ 真伏(眞伏) +マブシ 間伏 +マフジコ 真藤子 +マフジコ 眞藤子 +マブセ 馬伏 +マブチ 馬渕 +マブチ 馬淵 +マブチ 間渕 +マブチ 曲渕 +マブチ 間淵 +マブチ 真渕 +マブチ 真淵(眞淵) +マブチ 満渕 +マブチ 満淵 +マブチ 澗渕 +マブチ 磨渕 +マブチ 澗淵 +マブチ 馬渊 +マブチ 麻布地 +マブチ 眞渕 +マブニ 摩文仁 +マフネ 真船 +マフネ 間船 +マフネ 馬船(馬舩) +マフネ 眞船 +マフネ 真舩 +マフネ 間舩 +マフネ 真舟 +マフネ 馬舟 +マフネ 問船 +マフネ 眞舩 +マブネ 真船 +マブネ 間船 +マブネ 馬船(馬舩) +マブネ 眞船 +マブネ 真舩 +マブネ 眞舩 +マベ 真部 +マベ 間部 +マベ 馬部 +マベ 間辺 +マベ 眞部 +マベ 間邉 +マヘイ 馬塀 +マヘダ 前田 +マホ 真穂(眞穂) +マホエ 真保栄(眞保榮) +マホニイ 真歩仁 +マホリ 馬堀 +マホリ 馬掘 +ママ 真間 +ママ 侭 +ママ 万々 +ママ 眞間 +ママ 儘 +ママイ 生井 +ママキ 馬巻 +ママキ 間々木 +ママシタ 間々下 +ママシタ 儘下 +ママシタ 侭下 +ママセ 間々瀬 +ママタ 侭田 +ママタ 間々田(間間田) +ママタ 儘田 +ママタ 真々田 +ママダ 侭田 +ママダ 間々田(間間田) +ママダ 儘田 +ママダ 真々田 +ママダ 継田 +ママダ 真間田 +ママダ 儘多 +ママダ 眞々田 +ママナカ 墹仲 +ママベ 真々部(眞々部) +ママベ 継辺 +マミ 真見 +マミ 磨見 +マミ 眞見 +マミ 間見 +マミ 万見 +マミイ 真実井(眞實井) +マミウダ 大豆生田 +マミウダ 豆生田 +マミウダ 大豆田 +マミウダ 真生田(眞生田) +マミエ 間見江 +マミオダ 間明田 +マミザキ 馬見崎 +マミシン 馬見新 +マミズ 真水 +マミズ 馬水 +マミズ 間水 +マミズ 眞水 +マミタ 馬見田 +マミチ 真道 +マミチ 間道 +マミツ 磨樒 +マミツ 磨蜜 +マミツカ 馬見塚 +マミツカ 狸塚 +マミヅカ 馬見塚 +マミヅカ 狸塚 +マミヅカ 貍塚 +マミナミ 真南(眞南) +マミネ 真峰(眞峰) +マミネ 真峯(眞峯) +マミネ 間峰 +マミネ 間嶺 +マミノ 間簑 +マミノ 間箕 +マミヤ 間宮 +マミヤ 真谷 +マミヤ 真宮 +マミヤ 馬宮 +マミヤ 萬宮 +マミヤ 眞谷 +マミヤ 間見谷 +マミヤ 万宮 +マミヤ 眞宮 +マミョウ 間明 +マミョウ 馬明 +マミョウダ 間明田 +マムネ 真宗 +マムネ 真棟 +マムラ 真村 +マムラ 間村 +マムラ 馬村 +マムラ 眞村 +マムロ 真室 +マムロ 間室 +マムロ 眞室 +マメ 馬目 +マメ 豆 +マメアラ 豆荒 +マメイ 豆井 +マメイタ 豆板 +マメウダ 豆生田 +マメオカ 豆岡 +マメガノ 豆ケ野 +マメガラ 豆柄 +マメカワ 豆川 +マメコシ 豆越 +マメゴシ 豆越 +マメサキ 豆崎 +マメザキ 豆崎 +マメサヤ 豆鞘 +マメザワ 豆沢 +マメザワ 豆澤 +マメシロ 豆白 +マメタ 豆田 +マメタ 豆多 +マメダ 豆田 +マメダ 間明田 +マメダ 大豆田 +マメタニ 豆谷 +マメツカ 豆塚 +マメヅカ 豆塚 +マメドウ 大豆堂 +マメナリ 豆成 +マメノ 豆野 +マメハタ 豆畑 +マメハラ 豆原 +マメムラ 大豆村 +マメムラ 豆村 +マメモト 豆本 +マメヤ 豆谷 +マメヤマ 豆山 +マメワカ 豆若 +マモト 真本 +マモト 真許(眞許) +マモト 眞本 +マモト 慎本 +マモナカ 幻中 +マモリ 守 +マモリ 間森 +マモリ 真守 +マモリ 馬守 +マモリ 眞守 +マモリサキ 守崎 +マモリザキ 守崎 +マモリタ 守田 +マモル 衛 +マヤ 真家 +マヤ 真屋 +マヤ 真矢 +マヤ 眞家 +マヤ 眞屋 +マヤ 磨家 +マヤ 眞矢 +マヤ 真耶 +マヤ 磨矢 +マヤカ 真也加 +マヤグチ 間屋口 +マヤス 真安(眞安) +マヤナギ 真柳 +マヤナギ 眞柳 +マヤハシ 厩橋 +マヤハラ 馬屋原 +マヤハラ 馬谷原 +マヤマ 間山 +マヤマ 真山 +マヤマ 眞山 +マヤモト 厩本 +マユ 摩湯 +マユスミ 黛 +マユズミ 黛 +マユミ 真弓 +マユミ 間弓 +マユミ 眞弓 +マユミ 舞弓 +マユミ 眉見 +マユミ 馬弓 +マユミ 麻弓 +マユミダ 真弓田 +マユミダ 眞弓田 +マユヤマ 繭山 +マユヤマ 眉山 +マヨイ 間宵 +マヨイ 間霄 +マヨシ 真吉(眞吉) +マリ 真利 +マリ 眞利 +マリ 萬里 +マリ 鞠 +マリ 満利 +マリイ 鞠井 +マリオ 鞠尾 +マリカワ 鞠川 +マリカワ 万里川(萬里川) +マリカワ 鞠河 +マリコ 鞠子 +マリコ 真利子 +マリコ 鞠古 +マリコ 間利子 +マリコ 眞利子 +マリコウジ 万里小路 +マリコダニ 鞠子谷 +マリサキ 万里崎 +マリザキ 万里崎 +マリザキ 萬里崎 +マリゾノ 鞠園 +マリタニ 真里谷 +マリタニ 真利谷(眞利谷) +マリタニ 眞里谷 +マリト 真理人 +マリノ 万利乃(萬利乃) +マリヤ 真里谷 +マリヤ 真理谷(眞理谷) +マリヤマ 鞠山 +マリヤマ 毬山 +マリュウ 真流(眞流) +マル 丸 +マルイ 丸井 +マルイ 円井 +マルイ 圓井 +マルイ 丸居 +マルイ 円居 +マルイ 丸伊 +マルイ 圓居 +マルイイ 丸飯 +マルイエ 丸家 +マルイケ 丸池 +マルイケ 円池 +マルイシ 丸石 +マルイズミ 丸泉 +マルイチ 丸一 +マルイチ 丸市 +マルイチ 円一 +マルイチ 圓一 +マルイド 丸井戸 +マルイワ 丸岩 +マルウチ 丸内 +マルウメ 丸梅 +マルウラ 丸浦 +マルエ 丸江 +マルエ 丸衛 +マルエキ 丸益 +マルエビ 丸海老 +マルオ 丸尾 +マルオ 円尾 +マルオ 圓尾 +マルオ 丸王 +マルオ 丸応(丸應) +マルオ 丸雄 +マルオウ 丸王 +マルオカ 丸岡 +マルオカ 円岡 +マルオカ 圓岡 +マルオカ 丸岳 +マルオカ 円丘(圓丘) +マルオノ 丸小野 +マルカ 丸賀 +マルカ 丸加 +マルガ 丸賀 +マルガ 円賀 +マルカイ 丸開 +マルガイチ 丸垣内 +マルカサ 丸笠 +マルガサ 丸笠 +マルカタ 丸形 +マルガタ 丸形 +マルガタ 丸潟 +マルカド 丸角 +マルカネ 丸金 +マルカミ 丸上 +マルガミ 丸上 +マルカメ 丸亀 +マルカワ 丸川 +マルカワ 丸河 +マルキ 丸木 +マルキ 円城 +マルキ 丸喜 +マルキ 丸樹 +マルキ 丸貴 +マルキ 円木(圓木) +マルギ 丸儀 +マルクサ 丸草 +マルクス 丸楠 +マルクチ 丸口 +マルグチ 丸口 +マルグチ 圓口 +マルクニ 丸国 +マルクニ 丸國 +マルクボ 丸久保 +マルクマ 丸熊 +マルクマ 丸隈 +マルクラ 円倉(圓倉) +マルクラ 丸倉 +マルケ 丸毛 +マルゲ 丸毛 +マルケン 丸剱 +マルケン 丸釼 +マルコ 丸子 +マルコ 円子 +マルコ 丸小 +マルコ 圓子 +マルコ 丸児 +マルコ 丸古 +マルコウ 丸幸 +マルコシ 丸越 +マルコメ 丸米 +マルゴメ 丸米 +マルコヤマ 丸小山 +マルサ 丸佐 +マルサカ 丸坂 +マルサキ 丸崎 +マルサキ 丸嵜 +マルザキ 丸崎 +マルササ 丸笹 +マルザサ 丸笹 +マルサワ 丸沢 +マルサワ 丸澤 +マルザワ 丸沢 +マルザワ 丸澤 +マルジ 丸次 +マルジ 丸治 +マルシゲ 丸茂 +マルシゲ 丸重 +マルシゲ 丸繁 +マルシタ 丸下 +マルシチ 丸七 +マルシマ 丸島 +マルシマ 丸嶋 +マルシマ 丸嶌 +マルシマ 円島 +マルシマ 圓島 +マルシミズ 丸清水 +マルジュウ 丸十 +マルジョウ 丸城 +マルシロ 丸代 +マルシン 丸新 +マルス 丸栖 +マルスエ 丸末 +マルスガ 丸菅 +マルスギ 丸杉 +マルスミ 丸角 +マルスミ 丸住 +マルズミ 丸住 +マルセ 丸瀬 +マルセ 丸勢 +マルセ 丸世 +マルセキ 丸関 +マルゼキ 丸関 +マルゼニ 丸銭 +マルゼン 丸銭 +マルゾエ 丸添 +マルタ 丸田 +マルタ 円田 +マルタ 圓田 +マルタ 丸太 +マルダイ 丸大 +マルタカ 丸高 +マルタケ 丸岳 +マルタケ 丸竹 +マルタケ 丸武 +マルタニ 丸谷 +マルタニ 円谷 +マルタニ 圓谷 +マルタニ 満留谷 +マルタマ 丸玉 +マルタミ 丸民 +マルタヤ 丸田谷 +マルダン 丸段 +マルチ 丸地 +マルツ 丸津 +マルツカ 丸塚 +マルヅカ 丸塚 +マルツキ 丸月 +マルツギ 丸次 +マルヅキ 丸月 +マルツジ 丸辻 +マルツボ 丸坪 +マルツル 丸鶴 +マルヅル 丸鶴 +マルデン 丸伝 +マルデン 丸傳 +マルト 丸登 +マルト 丸戸 +マルドウ 丸堂 +マルトク 丸徳 +マルトミ 丸宝 +マルトミ 丸富 +マルナカ 丸中 +マルナカ 丸仲 +マルナカ 圓中 +マルナカ 円中 +マルナガ 丸永 +マルナガ 丸長 +マルナゲ 丸投 +マルナミ 丸浪 +マルニ 丸二 +マルニシ 丸西 +マルネ 丸根 +マルノ 丸野 +マルノ 円野 +マルノ 丸埜 +マルノ 圓野 +マルノウチ 丸之内 +マルノウチ 丸野内 +マルノウチ 丸ノ内 +マルノウチ 丸乃内 +マルノベ 円延 +マルハ 丸芳 +マルバ 円場 +マルバ 丸場 +マルバ 丸葉 +マルバエ 丸碆 +マルハシ 丸橋 +マルハシ 丸箸 +マルハシ 円橋 +マルハシ 圓橋 +マルバシ 丸橋 +マルバシラ 丸柱 +マルハタ 丸畑 +マルハタ 丸畠 +マルバタ 丸畑 +マルハト 丸鳩 +マルバト 丸鳩 +マルハナ 丸花 +マルハマ 丸浜 +マルハマ 丸濱 +マルバヤシ 丸林 +マルバヤシ 圓林 +マルハラ 丸原 +マルビ 丸備 +マルヒサ 丸久 +マルビシ 丸菱 +マルヒラ 丸平 +マルヒロ 丸広 +マルフク 丸福 +マルフジ 丸藤 +マルブチ 丸渕 +マルブチ 丸淵 +マルホ 丸穂 +マルマス 丸舛 +マルマタ 丸又 +マルマチ 丸町 +マルミ 円見 +マルミ 丸見 +マルミ 円生 +マルミ 圓見 +マルミ 圓生 +マルミ 丸身 +マルミズ 丸水 +マルミチ 丸道 +マルミツ 丸光 +マルミツ 丸満 +マルミネ 丸峯 +マルミネ 丸嶺 +マルミネ 丸峰 +マルミネ 丸領 +マルミヤ 丸宮 +マルムラ 丸村 +マルメ 丸目 +マルメ 円目 +マルメ 圓目 +マルメ 丸馬 +マルモ 丸茂 +マルモ 丸毛 +マルモ 丸藻 +マルモ 丸最 +マルモト 丸本 +マルモト 丸元 +マルモト 円本 +マルモト 圓本 +マルモノ 丸物 +マルモリ 丸森 +マルヤ 丸谷 +マルヤ 丸屋 +マルヤ 圓谷 +マルヤ 丸矢 +マルヤ 丸家 +マルヤ 満留谷 +マルヤ 満類屋 +マルヤス 丸安 +マルヤブ 丸籔(丸薮) +マルヤマ 丸山 +マルヤマ 円山 +マルヤマ 圓山 +マルヤマウチ 丸山内 +マルヤマタニ 丸山谷 +マルヤマノ 丸山野 +マルヨ 丸与 +マルヨ 丸與 +マルヨシ 丸吉 +マルリュウ 丸龍 +マルリュウ 丸竜 +マルワカ 丸若 +マルワカ 円若 +マルワカ 圓若 +マレタマ 稀玉 +マロ 磨 +マロ 麿 +マロ 磨呂 +マロ 麻呂 +マロヤマ 麿山 +マワキ 真脇 +マワキ 間脇 +マワキ 眞脇 +マワケ 真分(眞分) +マワシ 真鷲 +マワタ 真綿 +マワタチ 廻立 +マワタチ 迴立 +マワタリ 馬渡 +マワタリ 真渡 +マワタリ 眞渡 +マワリ 廻 +マワリカド 廻角 +マワリダ 廻田 +マワリタチ 廻立 +マワリタテ 廻立 +マワリダテ 廻立 +マワリド 廻戸 +マワリブチ 回渕(囬渕) +マワリブチ 廻渕 +マワリブチ 廻淵 +マワリミチ 回り道(囬り道) +マワリミチ 回道 +マワリミチ 廻り道 +マワリミチ 廻道 +マワリモト 廻本 +マン 萬 +マン 万 +マンアミ 万阿弥 +マンイ 万井 +マンイ 萬井 +マンエ 万江 +マンエイ 万永 +マンエイ 萬永 +マンオ 万尾 +マンオ 萬尾 +マンオカ 萬岡 +マンオク 萬奥 +マンカ 萬家 +マンガ 万賀 +マンガ 萬賀 +マンガ 萬我(万我) +マンカイ 万開 +マンガイ 萬谷 +マンガタニ 万ケ谷 +マンガハラ 萬ケ原 +マンガミ 萬上 +マンガリ 萬狩 +マンガリ 万狩 +マンカワ 万川 +マンカワ 萬川 +マンガン 萬貫 +マンガンジ 万願寺 +マンガンジ 萬願寺 +マンキ 万木 +マンキ 萬木 +マンキ 万喜(萬喜) +マンキ 万亀 +マンキ 萬亀 +マンギ 万木 +マンギ 萬木 +マンキュウ 万久 +マンキュウ 萬久 +マンギョウ 万行 +マンギョウ 萬行 +マンギョク 万玉 +マンギョク 萬玉 +マンキン 万金 +マンキン 萬金 +マンクモ 万雲 +マンクモ 萬雲 +マンクラ 万倉 +マンケイ 万慶 +マンケイ 萬慶 +マンゲツ 満月 +マンゲツ 万月 +マンコウ 万公 +マンゴウ 万合 +マンゴエ 満越 +マンゴク 万石 +マンゴク 満極 +マンゴク 萬石 +マンコシ 万越(萬越) +マンサイ 萬歳 +マンサイ 万才 +マンサイ 萬才 +マンザイ 万歳 +マンザイ 萬歳 +マンザイ 万財 +マンザイ 万戈 +マンザキ 万崎 +マンザキ 萬崎(萬嵜) +マンザワ 万沢 +マンザワ 萬澤 +マンザワ 万澤 +マンザワ 萬沢 +マンザンカ 卍山下 +マンジ 万治 +マンジ 萬治 +マンジ 万字 +マンジ 万事 +マンジ 万司 +マンジ 万子 +マンジ 満字 +マンジ 萬事 +マンジ 萬字 +マンシオ 万塩 +マンジュ 万寿 +マンジュ 萬寿 +マンジュ 萬壽 +マンジュウ 満仲(滿仲) +マンジュウ 万十 +マンジュモト 万寿本(万壽本) +マンショウ 満生(滿生) +マンジョウ 万城 +マンジョウ 萬條 +マンジョウ 万丈 +マンジョウ 萬上 +マンジョウ 万条 +マンジョウ 満城 +マンジョウ 万條 +マンジョウメ 万城目 +マンジョウメ 萬城目 +マンシロ 万代 +マンシロ 万代呂 +マンズ 萬津 +マンスイ 万水 +マンスイ 萬水 +マンセ 満瀬 +マンセ 万瀬 +マンセ 萬瀬 +マンセイ 満生 +マンセキ 万関 +マンセキ 萬関 +マンゼキ 萬関 +マンゼン 万膳 +マンゼン 万善 +マンゼン 万前 +マンゼン 萬膳 +マンゾウ 萬造 +マンゾウジ 万造寺 +マンゾウジ 萬造寺 +マンソク 万束 +マンソク 萬束 +マンゾク 満足 +マンゾク 萬束 +マンゾク 万足 +マンタ 万田 +マンタ 萬田 +マンダ 満田 +マンダ 万田 +マンダ 萬田 +マンダ 茨田 +マンダイ 万代 +マンダイ 萬代 +マンダイ 万袋 +マンダイ 萬台 +マンダイジ 万代寺 +マンダイジ 萬代寺 +マンダイラ 万平 +マンダイラ 萬平 +マンタケ 萬竹 +マンダチ 万立 +マンダチ 萬立 +マンタニ 万谷 +マンタニ 萬谷 +マンタニ 満谷 +マンタノ 満多野 +マンタバ 万束 +マンタバ 萬束 +マンチ 万地 +マンチュウ 万仲 +マンチュウ 万中 +マンチュウ 萬中 +マンヅ 万津 +マンヅカ 萬束 +マンデ 万出 +マント 万戸 +マント 萬戸 +マンド 万戸 +マンド 萬戸 +マンド 万度(萬度) +マントウ 万藤 +マンドウ 満藤 +マンドウ 万藤 +マンドウ 萬藤 +マンドウ 万道 +マンドウ 萬道 +マンドウ 萬燈 +マンドウ 万灯 +マンドウ 万燈 +マントク 万徳 +マントク 萬徳 +マントク 満徳 +マントコロ 政所 +マンドコロ 政所 +マンドコロ 万所 +マンドコロ 満処 +マンドコロ 満所 +マンドコロ 万処 +マンドコロ 萬所 +マンドコロ 満處 +マンドコロ 滿處 +マンドコロ 萬処 +マンドコロ 萬處 +マンドノ 万殿 +マンナ 満名 +マンナ 万名 +マンナオ 万直 +マンナカ 真中 +マンナカ 満仲(滿仲) +マンナカ 眞中 +マンナガ 万永 +マンナガ 萬永 +マンナミ 万波 +マンナミ 万浪 +マンナミ 萬浪 +マンナミ 萬波 +マンナミ 万並(万竝) +マンナリ 万成 +マンナリ 萬成 +マンネン 万年 +マンネン 萬年 +マンノ 万野 +マンノ 萬野 +マンノ 満野(滿野) +マンノ 万ノ +マンノ 万埜 +マンノ 万𡌛 +マンノウ 満濃 +マンノウ 萬濃 +マンノウ 万濃 +マンノウ 万納 +マンノウ 萬納 +マンノウジ 萬納寺 +マンノウジ 万納寺 +マンバ 万波 +マンバ 万場 +マンバ 万羽 +マンバ 萬羽 +マンバ 萬場 +マンバ 万庭 +マンバ 万葉 +マンバ 萬波 +マンバ 萬葉 +マンバ 満羽 +マンビョウ 万俵(萬俵) +マンヒロ 万広 +マンヒロ 万廣 +マンブ 万歩(萬歩) +マンフク 萬福 +マンプク 万福 +マンプク 萬福 +マンプク 満福 +マンプクジ 万福寺 +マンベ 万辺(万邊・万邉) +マンベ 万部 +マンベ 萬部 +マンベ 萬辺 +マンボ 満保(滿保) +マンポ 満保(滿保) +マンポ 万保(萬保) +マンボウ 万方(萬方) +マンボウ 萬宝 +マンポウ 万宝 +マンポウ 萬宝 +マンポウ 萬寶 +マンポウ 萬寳 +マンマル 幡丸 +マンマル 万丸 +マンマン 万々 +マンミ 万実(萬実) +マンミ 万見 +マンミ 萬實 +マンミツ 万光 +マンミツ 萬光 +マンミョウジ 満明寺 +マンモト 満本 +マンモト 万本 +マンモト 萬本 +マンモリ 万森 +マンヤ 万谷 +マンヤ 萬谷 +マンヤ 万屋 +マンヤ 萬屋 +マンヤマ 万山 +マンヤマ 萬山 +マンヨシ 万好 +マンヨシ 萬好 +マンラク 万楽 +マンリ 万里 +マンリ 萬里 +マンリキ 万力 +マンリキ 萬力 +マンリキヤ 万力谷 +マンリキヤ 万力屋(萬力屋) +マンリキヤ 萬力谷 +マンリョウ 万両 +マンリョウ 萬両 +ミアイ 三合 +ミアカシ 御明 +ミアキ 三明 +ミアキ 三秋 +ミアキ 見明 +ミアキ 見秋 +ミアケ 三宅 +ミアケ 三明 +ミアケ 見明 +ミアケ 美明 +ミアゲ 見上 +ミアサ 三浅 +ミアシ 三足 +ミアタリ 見当 +ミアタリ 見當 +ミアマ 三甘 +ミアラ 三荒 +ミアラシ 明嵐 +ミイ 三井 +ミイ 三居 +ミイ 三位 +ミイ 御井 +ミイ 美井 +ミイク 美育 +ミイクラ 三井倉 +ミイケ 三池 +ミイケ 御池 +ミイケダ 三池田 +ミイサコ 箕迫 +ミイシ 三石 +ミイシ 実石 +ミイシ 實石 +ミイジ 新地 +ミイシマ 三井島 +ミイショ 三井所 +ミイショ 三位所 +ミイジョウ 新門 +ミイズミ 美泉 +ミイタ 三井田 +ミイダ 箕田 +ミイダ 三井田 +ミイダ 見井田 +ミイチ 見市 +ミイチ 三市 +ミイチ 見一 +ミイチカワ 美市川 +ミイツ 三井津 +ミイデラ 三井寺 +ミイト 三糸 +ミイド 三井戸 +ミイナ 三井名 +ミイノ 箕野 +ミイノ 美井野 +ミイハラ 三井原 +ミイバラ 箕原 +ミイミ 美見 +ミイヤ 新屋 +ミイリ 美入 +ミイリ 実入 +ミイワ 三岩 +ミウエ 見植 +ミウス 箕臼 +ミウチ 三内 +ミウチ 身内 +ミウチ 見内 +ミウチ 箕内 +ミウチ 美内 +ミウチ 箕打 +ミウチ 御内 +ミウチ 味内 +ミウネ 三宇根 +ミウネ 三畦 +ミウマ 三馬 +ミウマ 巳午 +ミウミ 三海 +ミウミ 見海 +ミウラ 三浦 +ミウラ 箕浦 +ミウラ 神浦 +ミウラ 見浦 +ミウラ 美浦 +ミウラ 三裏 +ミウラ 身浦 +ミウラ 弥浦 +ミウラ 水卜 +ミウラ 美裏 +ミエ 三枝 +ミエ 弥栄 +ミエ 三重 +ミエ 三江 +ミエ 彌榮 +ミエ 美恵 +ミエ 彌栄 +ミエ 莧 +ミエイ 三栄 +ミエガワ 三永川 +ミエキ 三枝木 +ミエキ 三枝樹 +ミエザキ 三枝崎 +ミエダ 三枝 +ミエニシ 御縁 +ミエノ 三重野 +ミエブ 三重生 +ミエボリ 三重堀 +ミエマツ 三枝松 +ミエマツ 三重松 +ミオ 三尾 +ミオ 見尾 +ミオ 美尾 +ミオ 三生 +ミオ 三緒 +ミオ 美遠 +ミオウ 三大 +ミオウ 美王 +ミオウギ 巳扇 +ミオウギ 己扇 +ミオカ 三岡 +ミオカ 実岡 +ミオカ 美岡 +ミオカ 見岡 +ミオカ 己岡 +ミオカ 巳岡 +ミオガリ 三百苅 +ミオカワ 澪川 +ミオガワ 三尾川 +ミオキ 見置 +ミオキ 三沖 +ミオキ 御沖 +ミオケ 三桶 +ミオタ 三百田 +ミオタ 見尾田 +ミオタニ 三尾谷 +ミオタニ 見尾谷 +ミオタニ 美尾谷 +ミオノ 三尾野 +ミオノ 美尾野 +ミオノヤ 三尾谷 +ミオノヤ 美尾谷 +ミオハラ 三尾原 +ミオモ 三尾母 +ミオヤ 三尾谷 +ミオヤ 見尾谷 +ミオリ 三折 +ミカ 三賀 +ミカ 三加 +ミガ 三賀 +ミガ 見賀 +ミカイ 三海 +ミカイ 三階 +ミカイ 瓶井 +ミカイ 三貝 +ミカイ 三界 +ミカガミ 見鏡 +ミカガワ 甕川 +ミカキ 三垣 +ミカギ 三鑰 +ミカギ 御鍵 +ミカギ 三ケ木 +ミカギ 三ヵ木 +ミカギ 三鍵 +ミガキ 三垣 +ミガキ 磨 +ミガキ 見垣 +ミガキダ 磨田 +ミカケ 見掛 +ミカゲ 三日月 +ミカゲ 御影 +ミカゲ 三影 +ミカゲ 見陰 +ミカゲ 見影 +ミカゲ 三蔭 +ミカサ 三笠 +ミカサ 身笠 +ミカサキ 三ケ崎 +ミカサギ 三笠木 +ミカザキ 三ケ崎 +ミカザキ 三叚崎 +ミカザキ 三カ崎 +ミカサヤ 三笠屋 +ミカシマ 三ケ島 +ミカシマ 三ケ嶋 +ミカシマ 三箇島 +ミカジマ 三ケ島 +ミカジマ 三ケ嶋 +ミカジマ 三箇島 +ミカジリ 三ケ尻 +ミカジリ 三日尻 +ミカジリ 三河尻 +ミカジリ 三箇尻 +ミカズキ 朏 +ミカズキ 三ケ月 +ミカズラ 三葛 +ミカセ 御家瀬 +ミカタ 実方 +ミカタ 三方 +ミカタ 三ケ田 +ミカタ 味方 +ミカタ 見形 +ミカタ 見方 +ミカタ 實方 +ミカタ 三潟 +ミカタ 箕形 +ミカタ 見片 +ミカタ 味形 +ミカタ 三日田 +ミカタ 三賢 +ミカタ 三県 +ミカタ 三縣 +ミカダ 三ケ田 +ミカダ 三日田 +ミガタ 三潟 +ミカツ 味勝 +ミカヅ 三ケ津 +ミカツキ 三日月 +ミカヅキ 三日月 +ミカヅキ 朏 +ミカヅキ 三ケ月 +ミカヅキ 朏魄 +ミカヅラ 三葛 +ミカド 三角 +ミカド 三門 +ミカド 見角 +ミカド 御門 +ミカド 見門 +ミカド 三廉 +ミカドメ 三門明 +ミカナギ 御巫 +ミカネ 実兼 +ミカネ 実金 +ミカネ 三金 +ミカネ 實金 +ミカネ 實兼 +ミカノ 三甲野 +ミカノ 三ケ野 +ミカノ 三鹿野 +ミカノハラ 三ケ野原 +ミカノハラ 瓶原 +ミカハラ 三ケ原 +ミカハラ 三河原 +ミカベ 三壁 +ミカベ 三ケ部 +ミカマ 三鎌 +ミカマダ 三釜田 +ミカミ 三上 +ミカミ 水上 +ミカミ 見上 +ミカミ 三神 +ミカミ 三守 +ミカミ 見神 +ミカミ 味上 +ミカミ 三紙 +ミカミ 巳上 +ミカミ 弥上 +ミカミ 己上 +ミカミ 美上 +ミカミ 御上 +ミカミ 民上 +ミカミ 已上 +ミガミ 三上 +ミカミヤマ 三上山 +ミカミヤマ 三神山 +ミカムラ 御神村 +ミカムリ 見冠 +ミカメ 三瓶 +ミカメ 三亀 +ミカモ 美甘 +ミカモ 三鴨 +ミカモ 三加茂 +ミカモ 美鴨 +ミカモト 三家本 +ミカモト 御神本 +ミカモト 三ケ本 +ミカモト 三賀本 +ミカモリ 三賀森 +ミカモリ 三ケ森 +ミカヤマ 三ケ山 +ミカヤマ 三箇山 +ミカヤマ 三賀山 +ミカワ 三河 +ミカワ 三川 +ミカワ 美川 +ミカワ 箕川 +ミカワ 見川 +ミカワ 参川 +ミカワ 参河 +ミカワ 御川 +ミカワ 美河 +ミカワ 王川 +ミカワ 見河 +ミカワ 身川 +ミガワ 箕川 +ミカワイ 三河井 +ミカワウチ 三河内 +ミカワグチ 三河口 +ミカワシマ 三河島 +ミカワジマ 三河嶋 +ミカワタニ 三河谷 +ミカン 美柑 +ミカン 三甘 +ミカン 蜜柑 +ミカン 樒柑 +ミカン 櫁柑 +ミカンヤマ 樒柑山 +ミカンヤマ 櫁柑山 +ミカンヤマ 蜜柑山 +ミキ 三木 +ミキ 三樹 +ミキ 三鬼 +ミキ 三城 +ミキ 御木 +ミキ 造酒 +ミキ 酒造 +ミキ 見木 +ミキ 三喜 +ミキ 三亀 +ミキ 幹 +ミキ 美木 +ミキ 三生 +ミキ 神酒 +ミキ 味木 +ミキ 見喜 +ミキ 御喜 +ミキ 美貴 +ミキ 味喜 +ミキ 三岐 +ミキ 美喜 +ミキ 美記 +ミキ 見機 +ミキ 御城 +ミキ 三帰 +ミキ 三記 +ミキ 三貴 +ミキ 実貴 +ミキ 実樹 +ミキ 実城 +ミキ 実浄(實淨) +ミキ 實城 +ミキ 糝木 +ミキ 己城 +ミギ 右 +ミキイ 神酒井 +ミギイ 右井 +ミギウマ 右馬 +ミギウメ 右梅 +ミキエ 幹江 +ミキエ 三木江 +ミギカド 右門 +ミギサキ 右崎 +ミキザワ 神酒澤 +ミギシ 三岸 +ミギシタ 右下 +ミギシマ 右島(右嶋) +ミキタ 三木田 +ミキタ 幹田 +ミキタ 三喜田 +ミキタ 御喜田 +ミキタ 三北 +ミキタ 見喜田 +ミキタ 酒造田 +ミキタ 造酒田 +ミキダ 三木田 +ミキダ 幹田 +ミギタ 右田 +ミギタカ 右高 +ミキタニ 三木谷 +ミギタニ 右谷 +ミギテラ 右寺 +ミギデラ 右寺 +ミキト 幹戸 +ミキド 幹戸 +ミギナリ 右成 +ミキノ 三木野 +ミギノ 右野 +ミギハシ 右橋 +ミキハタ 三喜畑 +ミギハタ 右畑 +ミキハラ 三木原 +ミギハラ 右原 +ミギマツ 右松 +ミギミ 右見 +ミキモト 三木本 +ミキモト 御木本 +ミキモト 御酒本 +ミキモト 三樹元 +ミキモト 三木元 +ミギモト 右本 +ミキヤ 三木谷 +ミキヤ 御器谷 +ミキヤ 三木屋 +ミキヤ 御喜家 +ミキヤ 三木家 +ミギヤ 右谷 +ミギヤ 右屋 +ミキヤマ 幹山 +ミキヤマ 三亀山 +ミギヤマ 右山 +ミキュウ 三久 +ミギワ 汀 +ミクサ 三草 +ミクサ 三艸 +ミクシ 三串 +ミクス 三楠 +ミクズ 三葛 +ミクズキ 三葛木 +ミクチ 三口 +ミクチ 美口 +ミグチ 水口 +ミグチ 三口 +ミグチ 美口 +ミグチ 箕口 +ミグチ 見口 +ミグチ 味口 +ミグチ 巳口 +ミクツ 御沓 +ミクヅキ 美久月 +ミクニ 三国 +ミクニ 三國 +ミクニ 見国 +ミクニ 三九二 +ミクニ 美国 +ミクニ 見國 +ミクニ 美國 +ミクニデ 三国出 +ミクニヤ 三国谷 +ミクニヤ 三国屋 +ミクニヤ 三國谷 +ミクニヤ 三國屋 +ミクボ 三窪 +ミクボ 三久保 +ミクボ 味窪 +ミクマ 三熊 +ミクマ 実熊(實熊) +ミクマ 三隈 +ミクモ 三雲 +ミクモ 御雲 +ミグモ 三雲 +ミクラ 三倉 +ミクラ 御倉 +ミクラ 御蔵 +ミクラ 三蔵 +ミクラ 見倉 +ミクラ 美久羅 +ミクラ 御藏 +ミクラ 実倉 +ミクリ 三栗 +ミクリ 三厨 +ミクリ 御栗 +ミクリ 実操(實操) +ミクリノ 三栗野 +ミクリヤ 御厨 +ミクリヤ 三厨 +ミクリヤ 三栗谷 +ミクリヤ 三栗屋 +ミクリヤ 三栗家 +ミクリヤ 三廚 +ミクルベ 三廻部 +ミクルベ 三𢌞部 +ミクロ 三黒 +ミグロ 見黒 +ミグロエ 三黒江 +ミケ 三家 +ミケ 三毛 +ミケカド 三毛門 +ミケタ 三ケ田 +ミケダ 三ケ田 +ミコ 神子 +ミコ 御子 +ミコ 御古 +ミゴウ 御郷 +ミゴウ 見合 +ミゴウ 御江 +ミゴウ 御合 +ミコウジ 御糀 +ミコウチ 三河内 +ミコエ 三声 +ミコエ 三聲 +ミコオ 御幸尾 +ミコガイ 御子貝 +ミコガイ 神子谷 +ミコガミ 御子神 +ミコガミ 神子上 +ミコカワウチ 御子川内 +ミコガワウチ 御子川内 +ミコサワ 神子沢 +ミコザワ 神子沢 +ミコザワ 神子澤 +ミコシ 見越 +ミコシ 三腰 +ミコシ 御輿 +ミコシ 箕越 +ミコシ 三越 +ミコシ 美越 +ミコシ 巳越 +ミコシ 己越 +ミコシ 御興 +ミコシ 箕腰 +ミゴシ 見越 +ミコシバ 御子柴 +ミコシバ 御小柴 +ミコシバ 神子柴 +ミコシバ 御子芝 +ミコソ 神子素 +ミコタ 三小田 +ミコタ 神子田 +ミコタ 見小田 +ミコダ 三小田 +ミコダ 神子田 +ミコダ 見小田 +ミコタカ 神子高 +ミコト 神子戸 +ミコト 水琴 +ミコマ 三駒 +ミコミ 見込 +ミコメ 見米 +ミコヤ 三古谷 +ミコヤマ 三箇山 +ミサ 美佐 +ミサ 三佐 +ミザ 神座 +ミザ 美座 +ミザ 見座 +ミザ 御座 +ミザ 美坐 +ミザ 美㘴 +ミサイ 溝祭 +ミサイジ 美才治 +ミサイズ 美斉津 +ミサイズ 美細津 +ミサイズ 美斎津(美齋津) +ミサイズ 美齊津 +ミサイツ 美斎津(美齋津) +ミサイヅ 美斉津 +ミサイヅ 美細津 +ミサイヅ 美斎津(美齋津) +ミサイヅ 美齊津 +ミサオ 三竿 +ミサオ 操 +ミサオ 御竿 +ミサオ 三佐尾 +ミサオ 三棹 +ミサオ 水棹 +ミサオ 美總穗 +ミザオカ 御座岡 +ミサカ 三坂 +ミサカ 三阪 +ミサカ 美坂 +ミサカ 見坂 +ミサカ 味酒 +ミサカ 見阪 +ミサカ 美阪 +ミザガイト 見座垣内 +ミザガイトウ 見座垣内 +ミサカキ 三榊 +ミサカワ 三佐川 +ミサガワ 三佐川 +ミサキ 三崎 +ミサキ 見崎 +ミサキ 御前 +ミサキ 美崎 +ミサキ 御崎 +ミサキ 岬 +ミサキ 実崎 +ミサキ 箕崎 +ミサキ 三前 +ミサキ 身崎 +ミサキ 三嵜 +ミサキ 味崎 +ミサキ 御嵜 +ミサキ 美咲 +ミサキ 見先 +ミサキ 見嵜 +ミサキ 三先 +ミサキ 美佐木 +ミサキ 巳嵜 +ミザキ 三崎 +ミザキ 見崎 +ミザキ 御崎 +ミサキヤ 三崎屋 +ミサク 美作 +ミサク 巳作 +ミサケ 味酒 +ミサコ 三迫 +ミサコ 実迫(實迫) +ミサゴ 三砂 +ミサゴ 見砂 +ミササ 三笹 +ミササ 御笹 +ミササ 箕笹 +ミササガワ 三佐々川 +ミサザキ 三佐崎 +ミサシ 美佐志 +ミサシ 三差 +ミサシ 美差 +ミサダ 下田 +ミサダ 見定 +ミサダ 美佐田 +ミサダ 見貞 +ミサダ 見佐田 +ミザタ 見座田 +ミサヂ 見坐地 +ミサト 美里 +ミサト 三里 +ミサト 見里 +ミサト 御郷 +ミサト 美郷 +ミサトウ 三佐藤 +ミサホ 美佐保 +ミサホ 三佐保 +ミサマ 三狭間 +ミサワ 三沢 +ミサワ 三澤 +ミサワ 見沢 +ミサワ 見澤 +ミサワ 実沢(實澤) +ミサワ 美沢 +ミサワ 御澤 +ミサワ 美澤 +ミサワ 御沢 +ミサワ 三佐和 +ミサワ 参沢(参澤) +ミサワ 實沢 +ミザワ 三沢 +ミザワ 三澤 +ミザワ 見澤 +ミザワ 美澤 +ミサワヤ 見沢谷 +ミサワヤ 見澤谷 +ミシ 美志 +ミシオ 三塩 +ミシオ 見汐 +ミシオ 見潮 +ミシオ 見塩 +ミシオ 御塩 +ミシオ 美潮 +ミジオカ 短岡 +ミシク 御宿 +ミシク 三宿 +ミシゲ 三重 +ミシタ 三下 +ミシタ 実下(實下) +ミシタ 三志多 +ミシタ 見下 +ミシナ 三品 +ミシナ 三科 +ミシナ 三階 +ミシナ 三志奈 +ミシバ 三柴 +ミシバ 三芝 +ミシマ 三島 +ミシマ 三嶋 +ミシマ 美島 +ミシマ 実島 +ミシマ 見島 +ミシマ 三縞 +ミシマ 三嶌 +ミシマ 見嶋 +ミシマ 美嶋 +ミシマ 未至磨 +ミシマ 御縞 +ミシマ 實島 +ミシマ 三州 +ミシマ 三洲 +ミシマ 参島 +ミシマキ 三島木 +ミシマキ 三嶋木 +ミシマギ 三島木 +ミシュク 御宿 +ミシュク 三宿 +ミシュク 見宿 +ミジュク 三宿 +ミショウ 御庄 +ミショウ 見正 +ミショウ 御正 +ミショウ 御荘 +ミショウヤマ 御正山 +ミシリ 見知 +ミシロ 三代 +ミシロ 見城 +ミシロ 三城 +ミシロ 御代 +ミシロ 美代 +ミシロ 見代 +ミシロ 巳城 +ミジン 見陣 +ミス 三須 +ミス 三栖 +ミス 翠 +ミス 簾 +ミス 深須 +ミス 見須 +ミス 三簾 +ミス 御須 +ミス 水須 +ミス 三頭 +ミス 御簾 +ミス 三寿(三壽) +ミス 美須 +ミス 翆 +ミズ 水 +ミズアイ 水合 +ミズアイ 水相 +ミズアシ 水足 +ミズアシ 水芦 +ミズアシ 水蘆 +ミズアナ 水穴 +ミズアライ 水洗 +ミスイ 三簾 +ミスイ 味水 +ミズイ 水井 +ミズイ 水位 +ミズイ 水偉 +ミズイ 水緯 +ミズイ 水居 +ミズイ 瑞井 +ミズイエ 水家 +ミズイケ 水池 +ミズイシ 水石 +ミズイデ 水出 +ミズイデ 水井手 +ミズイリ 水入 +ミズイワ 水岩 +ミズイワ 瑞岩 +ミズイワタ 水岩田 +ミズウエ 水植 +ミズウケ 水請 +ミズウジ 水氏 +ミズウジ 水姓 +ミスウチ 簾内 +ミズウチ 水内 +ミズウマ 水馬 +ミズウミ 水海 +ミズウミ 湖 +ミズウラ 水浦 +ミスエ 実末 +ミスエ 三末 +ミズエ 水江 +ミズエ 水会 +ミズエダ 水枝 +ミズエダニ 水枝谷 +ミスオ 翠尾 +ミスオ 簾尾 +ミズオ 水尾 +ミズオ 水王 +ミズオカ 水岡 +ミズオチ 水落 +ミズオト 水音 +ミスガ 三菅 +ミズカイ 水貝 +ミズカイ 水飼 +ミズカイ 水海 +ミズガイ 水谷 +ミズガイ 水貝 +ミズカガ 水利 +ミズカキ 水柿 +ミズカキ 水書 +ミズガキ 水垣 +ミズガキ 水柿 +ミズガキ 水書 +ミズカケ 水掛 +ミズガサコ 水ケ迫 +ミズガシ 水菓子 +ミズガシラ 水頭 +ミズカタ 水方 +ミズガタニ 水ケ谷 +ミズカド 水門 +ミズカネ 水兼 +ミズカネ 水金 +ミズカブ 水株 +ミズガホ 水ケ保 +ミズカミ 水上 +ミズカミ 水神 +ミズガミ 水上 +ミズガミ 水賀美 +ミズガメ 水亀 +ミズカモ 水鴨 +ミズカワ 水川 +ミズカワ 水河 +ミズカワ 瑞川 +ミスギ 三杉 +ミスギ 見杉 +ミスギ 三寸木 +ミズキ 水木 +ミズキ 水城 +ミズキ 瑞木 +ミズキ 水筑 +ミズキ 売豆紀 +ミズキ 水気 +ミズキ 湖岐 +ミズキ 水樹 +ミズキ 水氣 +ミズキ 賣豆紀 +ミズギシ 水岸 +ミズキタ 水北 +ミズキリ 水切 +ミズクキ 水茎 +ミズクサ 水草 +ミズクサ 水艸 +ミズクチ 水口 +ミズグチ 水口 +ミズクニ 水国 +ミズクニ 水國 +ミズクボ 水久保 +ミズクボ 水窪 +ミズクラ 水倉 +ミズクラ 水庫 +ミズクラ 水蔵 +ミズクリ 水繰 +ミズクレ 水呉 +ミズクロ 水黒 +ミスゲ 三菅 +ミズコ 水子 +ミズコ 水粉 +ミズコウ 水河 +ミズコウ 水光 +ミズコウ 水幸 +ミズゴオリ 水郡 +ミズコシ 水越 +ミズコシ 水漉 +ミズコシ 水腰 +ミズコセ 水小瀬 +ミズコダ 水小田 +ミズサオ 水棹 +ミズサカ 水坂 +ミズサカ 水阪 +ミズサキ 水崎 +ミズサキ 水嵜 +ミズザキ 水崎 +ミズサコ 水迫 +ミズサワ 水沢 +ミズサワ 水澤 +ミズサワ 瑞沢(瑞澤) +ミズシ 水主 +ミズシ 水師 +ミズシ 水凌 +ミズシ 水志 +ミズシ 水侍 +ミズシ 水四 +ミズジ 水治 +ミズジ 水路 +ミズシゲ 水重 +ミズシタ 水下 +ミズシナ 水品 +ミズシナ 水科 +ミズシナ 水信 +ミズシノ 水篠 +ミズシマ 水島 +ミズシマ 水嶋 +ミズシマ 水嶌 +ミズシマ 水嶼 +ミズシマ 美津島 +ミズシマ 瑞島 +ミズシリ 水尻 +ミズジリ 水尻 +ミズシロ 水城 +ミズシロ 水代 +ミズシロ 水白 +ミズス 水須 +ミズスギ 水杉 +ミズスナ 水砂 +ミズスミ 水澄 +ミズセ 水瀬 +ミズセ 水清 +ミズセ 水勢 +ミズセ 水生 +ミズセイ 水生 +ミズセキ 水関 +ミズゼキ 水関 +ミズセダ 水清田 +ミズゾエ 水添 +ミスタ 簾田 +ミスタ 翠田 +ミスダ 簾田 +ミスダ 三須田 +ミズタ 水田 +ミズタ 水多 +ミズタカ 水高 +ミズタキ 水滝 +ミズタキ 水瀧 +ミズタケ 水竹 +ミズタケ 水岳 +ミスタニ 簾谷 +ミスタニ 三栖谷 +ミズタニ 水谷 +ミズタニ 水渓 +ミズタニ 水溪 +ミズタニ 三頭谷 +ミズタネ 水胤 +ミズタマ 水玉 +ミズタマリ 水溜 +ミズタミ 水民 +ミズタメ 水溜 +ミズタリ 水足 +ミズタル 水垂 +ミズタル 水樽 +ミスダレ 三簾 +ミズタレ 水垂 +ミズチ 水池 +ミズチ 水地 +ミズチ 水智 +ミズチ 水知 +ミズツ 水津 +ミズツキ 水月 +ミズツキ 水附 +ミズツギ 水次 +ミズツグ 水次 +ミズツボ 水坪 +ミズデ 水出 +ミズト 水戸 +ミズト 水登 +ミズトウ 水藤 +ミズドウ 水堂 +ミズトキ 水時 +ミズドノ 水殿 +ミズトミ 水富 +ミズトミ 水冨 +ミズトメ 水留 +ミズトメ 水止 +ミズドメ 水留 +ミズトモ 水友 +ミズトモ 水共 +ミズトリ 水鳥 +ミズトリ 水取 +ミズトリ 水掫 +ミズドリ 水鳥 +ミスナ 三砂 +ミスナ 見砂 +ミスナ 見須奈 +ミズナ 水名 +ミスナガ 簾長 +ミズナカ 水中 +ミズナガ 水流 +ミズナガ 水永 +ミズナガ 水長 +ミズナシ 水梨 +ミズナシ 水無 +ミズナシ 水梨子 +ミズナミ 水波 +ミズナミ 水浪 +ミズナミ 水並 +ミズナラ 水楢 +ミズナリ 水成 +ミズナル 水成 +ミズナワ 水縄 +ミズニシ 水西 +ミズニワ 水庭 +ミズヌシ 水主 +ミズヌマ 水沼 +ミズネ 水根 +ミスノ 御簾納 +ミスノ 簾野 +ミスノ 翠簾野 +ミスノ 御廉納 +ミスノ 御簾野 +ミズノ 水野 +ミズノ 水埜 +ミズノ 水納 +ミズノ 瑞野 +ミズノ 水嚢 +ミズノ 水𡌛 +ミズノ 美津濃 +ミスノウ 御簾納 +ミズノウ 水納 +ミズノウエ 水ノ上 +ミズノウエ 水野上 +ミズノウエ 水之上 +ミズノウラ 水之浦(水ノ浦) +ミズノエ 水之江 +ミズノエ 水ノ江 +ミズノエ 水の江 +ミズノエ 水野江 +ミズノエ 水野得 +ミズノオ 水野尾 +ミズノクラ 水野倉 +ミズノブ 水信 +ミズノブ 水延 +ミズノマ 水野間 +ミズノミ 水呑 +ミズノモト 水野元 +ミズノヤ 水谷 +ミズノヤ 水野谷 +ミズノヤ 水納谷 +ミズノヤ 水野屋 +ミズハ 水羽 +ミズバ 水場 +ミズバ 水葉 +ミズハキ 水吐 +ミズハシ 水橋 +ミズハシ 水端 +ミスハタ 簾畑 +ミズハタ 水畑 +ミズハタ 水端 +ミズバタ 水端 +ミズハマ 水浜 +ミズハミ 水喰 +ミズハヤ 水早 +ミズハヤ 水速 +ミズバヤシ 水林 +ミズハラ 水原 +ミズハラ 瑞原 +ミズヒ 水樋 +ミズヒキ 水引 +ミズヒキ 水挽 +ミズヒラ 水平 +ミズヒロ 水広 +ミズヒロ 水弘 +ミズヒロ 水廣 +ミズフカ 水深 +ミズフサ 水房 +ミズフジ 水藤 +ミズフチ 水渕 +ミズブチ 水渕 +ミズブチ 水淵 +ミズフネ 水船 +ミズフネ 水舟 +ミズフネ 水舩 +ミズベ 水辺 +ミズベ 水邊 +ミズベ 水邉 +ミズホ 瑞穂 +ミズホ 水穂 +ミズホ 水保 +ミズホソ 水細 +ミズボソ 水細 +ミズホリ 水堀 +ミズホリ 水掘 +ミズボリ 水堀 +ミスマ 三須磨 +ミズマ 水間 +ミズマ 水摩 +ミズマ 水馬 +ミズマ 三潴 +ミズマ 水真 +ミズマ 水澗 +ミズマ 三豬 +ミズマ 水磨 +ミズマキ 水巻 +ミズマキ 水牧 +ミズマサ 水正 +ミズマサ 水政 +ミズマシ 水増 +ミズマス 水益 +ミズマス 水増 +ミスマダ 三角田 +ミズマタ 水俣 +ミズマチ 水町 +ミズマツ 水松 +ミズマル 水丸 +ミスミ 三角 +ミスミ 三隅 +ミスミ 三住 +ミスミ 三澄 +ミスミ 美澄 +ミスミ 三墨 +ミスミ 実隅 +ミスミ 美住 +ミスミ 美棲 +ミスミ 巳角 +ミスミ 公事 +ミズミ 水見 +ミズミ 水味 +ミスミゾノ 三角園 +ミスミダ 三角田 +ミスミダ 三隅田 +ミズミツ 水光 +ミズミヤ 水宮 +ミズムカイ 水向 +ミズムラ 水村 +ミズモ 水毛 +ミズモ 水藻 +ミズモ 水雲 +ミズモチ 水持 +ミスモト 三栖本 +ミズモト 水本 +ミズモト 水元 +ミズモリ 水守 +ミズモリ 水森 +ミズモリ 水盛 +ミズモリ 水漏 +ミズモリ 瑞森 +ミズモン 水門 +ミスヤ 翠簾屋 +ミズヤ 水谷 +ミズヤ 水家 +ミズヤ 水屋 +ミズヤ 水矢 +ミズヤ 水宅 +ミズヤウチ 水谷内 +ミズヤス 水安 +ミズヤチ 水谷内 +ミズヤブ 水薮 +ミズヤマ 水山 +ミズヤマ 瑞山 +ミズユキ 流 +ミズユキ 水行 +ミズヨケ 水除 +ミズヨシ 水吉 +ミズヨシ 水由 +ミズヨリ 水寄 +ミズロク 水六 +ミズワ 水和 +ミズワキ 水脇 +ミズワケ 水分 +ミセ 三瀬 +ミセ 見世 +ミセ 見瀬 +ミセ 美勢 +ミセ 美世 +ミセ 見勢 +ミセ 三勢 +ミセ 店 +ミセイ 御姓 +ミセイ 見勢井 +ミセイ 店居 +ミセオ 美世尾 +ミセカ 三瀬下 +ミセガワ 三世川 +ミセキ 三関 +ミセキ 御石 +ミセクサ 三節草 +ミセザキ 店崎 +ミセダ 見世田 +ミセタニ 店谷 +ミセノ 店野 +ミセマチ 三瀬町 +ミセモト 店元 +ミセモト 店本 +ミセモト 見勢本 +ミセン 美仙 +ミソ 味噌 +ミゾ 溝 +ミソイ 味噌井 +ミゾイ 溝井 +ミゾイリ 溝入 +ミソウ 三宗 +ミソウ 美曹 +ミソウ 美荘 +ミゾウエ 溝上 +ミゾウチ 溝内 +ミゾウラ 溝浦 +ミソエ 三添 +ミゾエ 溝江 +ミゾエ 三添 +ミソオ 三十尾 +ミゾオ 溝尾 +ミゾオカ 溝岡 +ミゾオク 溝奥 +ミゾオチ 溝落 +ミソカ 晦日 +ミソカ 三十日 +ミゾカ 溝賀 +ミゾガイ 溝貝 +ミゾガキ 溝垣 +ミゾカネ 溝兼 +ミゾカミ 溝上 +ミゾカミ 溝神 +ミゾガミ 溝上 +ミゾガミ 溝神 +ミソカリ 三十苅 +ミゾカワ 溝川 +ミゾカワ 溝河 +ミゾガワ 溝川 +ミゾガワ 溝側 +ミソギ 三十木 +ミソギ 裸 +ミゾキ 溝木 +ミゾキタ 溝北 +ミゾギワ 溝際 +ミゾクイ 溝杭 +ミゾグイ 溝杭 +ミゾグイ 溝抗 +ミゾクチ 溝口 +ミゾグチ 溝口 +ミゾクニ 溝国 +ミゾクニ 溝國 +ミゾクボ 溝久保 +ミゾクマ 溝隈 +ミゾクロ 溝黒 +ミゾグロ 溝黒 +ミソコ 美底 +ミゾコシ 溝越 +ミゾコシ 溝腰 +ミゾゴシ 溝越 +ミゾサカ 溝坂 +ミゾサキ 溝崎 +ミソサク 味噌作 +ミソサク 美曽作 +ミソサク 美曾作 +ミゾシタ 溝下 +ミゾシナ 溝品 +ミゾシマ 溝島 +ミゾシマ 溝嶋 +ミゾシリ 溝尻 +ミゾジリ 溝尻 +ミゾスギ 溝杉 +ミゾソエ 溝添 +ミゾゾエ 溝添 +ミソダ 三曽田 +ミゾタ 溝田 +ミゾタ 溝多 +ミソタニ 美曽谷 +ミソタニ 味噌谷 +ミゾタニ 溝谷 +ミゾツギ 溝次 +ミゾツラ 溝行 +ミゾテ 溝手 +ミゾトミ 溝富 +ミゾトメ 溝留 +ミゾナカ 溝中 +ミゾナガ 溝永 +ミゾニシ 溝西 +ミゾネ 溝根 +ミソノ 御園 +ミソノ 御園生 +ミソノ 味園 +ミソノ 三園 +ミソノ 弥園 +ミソノ 美園 +ミソノ 御苑 +ミソノ 三薗 +ミソノ 御薗 +ミソノ 味曽野 +ミソノ 彌園 +ミソノ 三曾野 +ミソノ 三其 +ミソノ 聖園 +ミソノ 味噌野 +ミソノ 味曾野 +ミゾノ 溝野 +ミゾノ 溝之 +ミソノイ 御園井 +ミソノウ 御園生 +ミソノウ 御蘭生 +ミソノウ 御薗生 +ミゾノウエ 溝ノ上 +ミゾノウエ 溝之上 +ミソノオ 御園生 +ミソノオ 御薗生 +ミゾノクチ 溝ノ口 +ミゾノベ 溝延 +ミゾハシ 溝端 +ミゾハシ 溝橋 +ミゾハタ 溝端 +ミゾハタ 溝畑 +ミゾハタ 溝畠 +ミゾハタ 溝羽田 +ミゾハタ 溝幡 +ミゾバタ 溝端 +ミゾバタ 溝畑 +ミゾハナ 溝花 +ミゾハマ 溝浜 +ミゾハラ 溝原 +ミゾヒサ 溝久 +ミゾヒラ 溝平 +ミゾヒロ 溝広 +ミゾヒロ 溝廣 +ミゾフチ 溝渕 +ミゾブチ 溝渕 +ミゾブチ 溝淵 +ミゾブチ 溝縁 +ミゾベ 溝部 +ミゾベ 溝辺 +ミゾベ 溝邊 +ミゾベ 溝邉 +ミソマ 三十間 +ミゾマ 溝間 +ミゾマエ 溝前 +ミゾマサ 溝正 +ミゾマタ 溝俣 +ミゾミ 溝見 +ミゾミチ 溝道 +ミゾムカイ 溝向 +ミソメ 見初 +ミソメ 見染 +ミソメ 三染 +ミゾモト 溝本 +ミゾモト 溝元 +ミゾモリ 溝森 +ミソヤ 見楚谷 +ミゾヤ 溝谷 +ミソヤマ 味噌山 +ミゾヤマ 溝山 +ミゾヨリ 溝依 +ミゾロ 溝曽路 +ミゾロキ 溝呂木 +ミゾロキ 御菩薩木 +ミゾロギ 溝呂木 +ミゾロギ 三尋木 +ミゾロギ 三改木 +ミゾロケ 御菩薩池 +ミゾワキ 溝脇 +ミタ 三田 +ミタ 箕田 +ミタ 見田 +ミタ 美田 +ミタ 味田 +ミタ 御田 +ミタ 三多 +ミタ 美多 +ミタ 蛇田 +ミダ 箕田 +ミダ 見田 +ミダ 弥陀 +ミダ 巳田 +ミタイ 三田井 +ミタオ 三田尾 +ミタカ 三高 +ミタカ 見高 +ミタカ 三峰 +ミタカ 見鷹 +ミタガハナ 美多賀鼻 +ミタガミ 三田上 +ミタカラ 三宝(三寶) +ミタキ 三滝 +ミタキ 見滝(見瀧) +ミタキ 三瀧 +ミタキ 御滝 +ミタク 美宅 +ミタケ 三竹 +ミタケ 三岳 +ミタケ 三嶽 +ミタケ 三武 +ミタケ 御嶽 +ミタケ 見竹 +ミタケ 御岳 +ミタケ 見岳 +ミタケ 見武 +ミタケ 見嶽 +ミタケ 御獄 +ミタケ 三獄 +ミタケ 三諾 +ミタサキ 三反崎 +ミタザキ 三反崎 +ミタサコ 三田迫 +ミタジ 三田地 +ミダシ 見出 +ミタジリ 三田尻 +ミタゾノ 三反園 +ミタダ 三多田 +ミタタニ 三田谷 +ミタチ 三田地 +ミタチ 御舘 +ミタチ 御立 +ミタチ 神舘 +ミタチ 神館 +ミタチ 見達 +ミタチ 御館 +ミタチ 三立 +ミタチ 三館 +ミタチ 三舘 +ミタチ 三田池 +ミタツ 三達 +ミタツ 三龍 +ミタテ 見立 +ミタテ 御舘 +ミタテ 御立 +ミタテ 見舘 +ミタテ 見達 +ミタテ 三立 +ミタテ 三蓼 +ミタデ 味蓼 +ミタテザカ 見立坂 +ミタテダ 御立田 +ミタテダ 御舘田 +ミタテヤ 見立屋 +ミタテラ 三田寺 +ミタデラ 三田寺 +ミタデラ 御田寺 +ミタナガ 三反長 +ミタニ 神谷 +ミタニ 三谷 +ミタニ 深谷 +ミタニ 見谷 +ミタニ 美谷 +ミタニ 味谷 +ミタニ 箕谷 +ミタニ 実谷 +ミタニ 三谿 +ミタニ 己谷 +ミタニ 三𧮾 +ミタニ 巳谷 +ミタニ 實谷 +ミタニ 三渓 +ミタニ 参谷 +ミタニ 未谷 +ミタニハラ 三谷原 +ミタニヤマ 三谷山 +ミタネ 三種 +ミタノ 三田野 +ミタノ 見田野 +ミタノ 美田野 +ミタビ 三田美 +ミタビ 三 +ミタビヤ 御旅屋 +ミタベ 三田部 +ミタマ 三玉 +ミタマ 見玉 +ミタマ 海琳 +ミタマ 三珠 +ミタマ 美玉 +ミタマ 霊 +ミタマヤマ 身玉山 +ミタミ 三多見 +ミタムラ 三田村 +ミタムラ 御田村 +ミタムラ 見田村 +ミタムラ 味田村 +ミタムラ 美田村 +ミタムラ 三多村 +ミタヤ 三田谷 +ミダヤマ 弥蛇山 +ミタライ 御手洗 +ミタライ 観盥 +ミタライ 御盥 +ミタライ 三洗 +ミタライヤ 御手洗屋 +ミタラシ 御手洗 +ミダレバシ 乱橋 +ミダン 美談 +ミタンザキ 三反崎 +ミタンダ 三反田 +ミチ 道 +ミチ 味知 +ミチ 美智 +ミチ 路 +ミチアイ 道合 +ミチアキ 道明 +ミチイ 道井 +ミチイエ 道家 +ミチイチ 道市 +ミチウエ 道上 +ミチウエ 道植 +ミチウチ 道内 +ミチウミ 道海 +ミチウラ 道浦 +ミチウラ 道裏 +ミチエ 道江 +ミチエダ 道枝 +ミチオ 道尾 +ミチオカ 道岡 +ミチオキ 道沖 +ミチオク 道奥 +ミチオク 路奥 +ミチオト 道音 +ミチガシラ 道頭 +ミチカゼ 道風 +ミチカタ 道方 +ミチカド 道角 +ミチカネ 道金 +ミチカミ 道上 +ミチガミ 道上 +ミチカヤ 道萱 +ミチカワ 道川 +ミチカワ 路川 +ミチカワ 通川 +ミチカワ 道河 +ミチカワウチ 道川内 +ミチカワヤ 道川屋 +ミチキ 道木 +ミチキ 道喜 +ミチキ 路木 +ミチギシ 道岸 +ミチキタ 道北 +ミチキュウ 道給 +ミチクダ 道久田 +ミチグチ 道口 +ミチクボ 道窪 +ミチクラ 道倉 +ミチゴエ 道越 +ミチコシ 道越 +ミチコシ 道腰 +ミチゴシ 道越 +ミチコジマ 道小島 +ミチサ 道狭 +ミチサカ 道坂 +ミチサカ 通阪 +ミチサカ 道阪 +ミチザカ 道坂 +ミチサキ 道崎 +ミチザキ 道崎 +ミチサコ 道迫 +ミチサワ 三地沢 +ミチサワ 三地澤 +ミチザワ 道沢 +ミチザワ 道澤 +ミチジ 道治 +ミチシオ 満汐(滿汐) +ミチシオ 道塩 +ミチシゲ 道重 +ミチシゲ 道繁 +ミチシタ 道下 +ミチシマ 道島 +ミチシマ 道嶋 +ミチシマ 通島 +ミチジマ 道島 +ミチジマ 道嶋 +ミチジリ 道尻 +ミチシロ 道城 +ミチシロ 道白 +ミチス 道須 +ミチスエ 道末 +ミチスジ 道筋 +ミチスジ 通筋 +ミチセ 道瀬 +ミチセキ 道関 +ミチゼキ 道関 +ミチゾエ 道添 +ミチゾエ 道副 +ミチゾノ 道園 +ミチタ 道田 +ミチダ 満田 +ミチダ 道田 +ミチダ 三千田 +ミチタカ 道高 +ミチタカ 道尭(道堯) +ミチタケ 道竹 +ミチタツ 道辰 +ミチタニ 道谷 +ミチヅ 道津 +ミチツカ 道塚 +ミチヅカ 道塚 +ミチヅカ 満束 +ミチツグ 道次 +ミチツジ 道辻 +ミチツタ 道蔦 +ミチツナ 道綱 +ミチテ 道手 +ミチドイ 道土井 +ミチドウ 道堂 +ミチナエ 道苗 +ミチナカ 道中 +ミチナカ 道仲 +ミチナカ 途中 +ミチナガ 道永 +ミチナガ 道長 +ミチナリ 道成 +ミチニシ 道西 +ミチニワ 道庭 +ミチヌキ 道貫 +ミチヌマ 道沼 +ミチネ 道根 +ミチノ 道野 +ミチノ 道埜 +ミチノ 道能 +ミチノ 路野 +ミチノウシロ 道之後 +ミチノシタ 道ノ下 +ミチノシタ 道の下 +ミチノシタ 道野下 +ミチノハタ 道野畑 +ミチノブ 道信 +ミチノベ 道辺(道邊) +ミチノマエ 道之前 +ミチバ 道場 +ミチバ 道庭 +ミチバサミ 道鋏 +ミチハシ 道端 +ミチハシ 道橋 +ミチハタ 道端 +ミチハタ 道畑 +ミチハタ 道籏 +ミチハタ 道旗 +ミチハタ 道畠 +ミチハタ 通畑 +ミチバタ 道端 +ミチバタ 道畑 +ミチバタ 道籏 +ミチバタ 道旗 +ミチバタ 道畠 +ミチバタ 通端 +ミチハナ 道端 +ミチハナ 頓花 +ミチハナ 道花 +ミチハマ 道浜 +ミチバヤシ 道林 +ミチハラ 道原 +ミチヒサ 道久 +ミチヒラ 道平 +ミチヒロ 道広 +ミチヒロ 道廣 +ミチヒロ 道寛 +ミチヒロ 道弘 +ミチフク 道福 +ミチフサ 道房 +ミチフジ 道藤 +ミチブチ 道淵 +ミチブチ 道渕 +ミチフデ 道筆 +ミチフリ 道振 +ミチベ 道辺(道邊) +ミチベ 道部 +ミチマ 道間 +ミチマエ 道前 +ミチマサ 道正 +ミチマサ 道政 +ミチマタ 道又 +ミチマタ 道股 +ミチマタ 道亦 +ミチマチ 道町 +ミチマル 道丸 +ミチミ 道見 +ミチミヤ 道宮 +ミチムカイ 道向 +ミチムコ 道向 +ミチムコウ 道向 +ミチムネ 道宗 +ミチムラ 道村 +ミチムラ 通村 +ミチモト 道本 +ミチモト 道元 +ミチモリ 道盛 +ミチモリ 道森 +ミチモリ 道守 +ミチヤ 道家 +ミチヤ 道谷 +ミチヤ 道屋 +ミチヤ 三知矢 +ミチヤス 満保(滿保) +ミチヤス 道安 +ミチヤブ 道薮(道藪) +ミチヤブ 道籔 +ミチヤマ 光山 +ミチヤマ 道山 +ミチヤマ 通山 +ミチヤマ 三千山 +ミチユキ 道幸 +ミチユキ 道行 +ミチヨシ 道吉 +ミチヨシ 岐美 +ミチヨリ 道寄 +ミチワ 道輪 +ミチワキ 道脇 +ミチワケ 道訳 +ミチワケ 道譯 +ミチワケ 道分 +ミツ 光 +ミツ 満 +ミツ 三津 +ミツ 見津 +ミツ 密 +ミツ 三ツ +ミツ 美津 +ミツ 蔤 +ミツアシ 三足 +ミツイ 三井 +ミツイ 光井 +ミツイ 三ツ井 +ミツイ 満井(滿井) +ミツイ 三津井 +ミツイ 三居 +ミツイ 密井 +ミツイ 光居 +ミツイ 満居 +ミツイ 三ツ居 +ミツイ 光移 +ミツイ 三都井 +ミツイ 満以 +ミツイ 密居 +ミツイ 蜜井 +ミヅイ 水井 +ミツイエ 光家 +ミツイキ 満生 +ミツイケ 三ツ池 +ミツイシ 三石 +ミツイシ 三ツ石 +ミツイシ 光石 +ミツイシ 満石 +ミツイシ 蜜石 +ミツイシ 三津石 +ミツイシ 密石 +ミツイシ 三つ石 +ミツイシ 滿石 +ミヅイシ 水石 +ミツイズミ 三ツ泉 +ミツイダ 三井田 +ミツイワ 三岩 +ミツイワ 三ツ岩 +ミツウ 美通 +ミツウチ 光内 +ミツウラ 三浦 +ミツウラ 光浦 +ミツウラ 三ツ浦 +ミツウラ 満浦 +ミツウラ 蜜浦 +ミツエ 三枝 +ミツエ 満江 +ミツエ 光江 +ミツエ 三ツ江 +ミツエ 三津江 +ミツエ 三恵 +ミツエ 三惠 +ミツエダ 三枝 +ミツエダ 光枝 +ミツエダ 満枝 +ミツオ 三尾 +ミツオ 満尾 +ミツオ 満生 +ミツオ 光尾 +ミツオ 三ツ尾 +ミツオ 滿尾 +ミツオ 三津尾 +ミツオウ 光応 +ミツオウ 光應 +ミツオウギ 三ツ扇 +ミツオカ 光岡 +ミツオカ 三岡 +ミツオカ 満岡 +ミツオカ 密岡 +ミツオカ 三ツ岡 +ミツオカ 蜜岡 +ミツオカ 光岳 +ミツオカ 光丘 +ミツオカ 滿岡 +ミツオキ 光沖 +ミツオギ 三荻 +ミヅオチ 水落 +ミツカ 三塚 +ミツカ 三津家 +ミツカ 見塚 +ミツカ 三ツ家 +ミツカ 三束 +ミツガ 三賀 +ミヅカ 三塚 +ミヅカ 見塚 +ミツカイ 水飼 +ミッカイチ 三日市 +ミツガシラ 三頭 +ミツガシワ 三柏 +ミツカゼ 光風 +ミツカド 光門 +ミツカド 光角 +ミツカド 三ツ角 +ミツカネ 光金 +ミツカネ 光兼 +ミツカネ 三鐘 +ミツカミ 満上 +ミツカミ 光上 +ミツカミ 滿上 +ミツガミ 満上 +ミツガミ 光上 +ミヅカミ 水上 +ミツカワ 三川 +ミツカワ 光川 +ミツカワ 三ツ川 +ミツカワ 三津川 +ミツカワ 満川 +ミツカワ 密川 +ミツカワ 櫁川 +ミツカワ 光河 +ミツカワ 樒川 +ミツカワ 満河 +ミツカワ 蜜川 +ミツガワ 三川 +ミヅカワ 水川 +ミツキ 三木 +ミツキ 三ツ木 +ミツキ 満木 +ミツキ 光木 +ミツキ 三津木 +ミツキ 御調 +ミツキ 見月 +ミツキ 三附 +ミツキ 三槻 +ミツキ 密城 +ミツキ 観月 +ミツキ 参木 +ミツキ 三月 +ミツキ 三築 +ミツキ 三調 +ミツキ 満来 +ミツキ 密木 +ミツキ 滿木 +ミツギ 三木 +ミツギ 三ツ木 +ミツギ 三次 +ミツギ 三樹 +ミツギ 満木 +ミツギ 光木 +ミツギ 貢 +ミツギ 三津木 +ミツギ 光城 +ミツギ 鑑継 +ミツギ 密城 +ミツギ 参木 +ミツギ 見次 +ミツギ 見継 +ミツギ 身次 +ミツギ 巳継 +ミヅキ 見月 +ミヅキ 観月 +ミヅキ 見築 +ミヅキ 深月 +ミツキダ 三月田 +ミツキヨ 光清 +ミツギリ 三桐 +ミツグ 三続 +ミツクイ 三杭 +ミツクチ 三口 +ミツクチ 三ツ口 +ミツグチ 三口 +ミツグチ 三ツ口 +ミツグチ 美津口 +ミツグチ 満口 +ミツグチ 蜜口 +ミヅクチ 水口 +ミヅグチ 水口 +ミツクデ 光来出(光來出) +ミツクニ 光国 +ミツクニ 三ツ国 +ミツクニ 光國 +ミツクニ 三津国(三津國) +ミツクニ 三ツ國 +ミツクヌギ 三椚 +ミツクボ 満窪 +ミツクボ 満久保 +ミツクラ 満倉(滿倉) +ミツクラ 三ツ倉 +ミツクラ 光倉 +ミツクリ 三栗 +ミツクリ 箕作 +ミツクリ 箕造 +ミツクリ 光造 +ミツクリ 巳造 +ミツグロ 光黒 +ミツクワノ 光桑野 +ミツケ 見附 +ミツケ 見付 +ミツケ 三附 +ミツコウジ 三小牛 +ミツコウチ 三河内 +ミツゴウチ 三河内 +ミツコシ 水越 +ミツコシ 三越 +ミツコシ 満越 +ミツコシ 三津越 +ミヅコシ 水越 +ミツサカ 光阪 +ミヅサカ 水坂 +ミツサキ 満先 +ミツザキ 光崎 +ミツザキ 満崎(滿崎) +ミツザキ 三ツ崎 +ミツザキ 満嵜 +ミツサダ 光定 +ミツサダ 光貞 +ミツサト 光里 +ミツザネ 光実 +ミツザネ 光真 +ミツザネ 光實 +ミツザネ 光眞 +ミツサワ 三沢 +ミツサワ 光澤 +ミツサワ 三ツ澤 +ミツザワ 三沢 +ミツザワ 三澤 +ミツザワ 光沢 +ミツザワ 光澤 +ミツザワ 満沢 +ミツザワ 蜜沢 +ミツザワ 三ツ沢 +ミツザワ 三津沢(三津澤) +ミツザワ 三ツ澤 +ミツザワ 密沢 +ミツザワ 満澤 +ミツザワ 蜜澤 +ミヅサワ 水沢 +ミヅサワ 水澤 +ミツジ 三辻 +ミツジ 三逵 +ミツシオ 満塩 +ミツシオ 満潮 +ミツシオ 満汐(滿汐) +ミツシオ 三ツ汐 +ミツシゲ 満重 +ミツシゲ 光重 +ミツシタ 光下 +ミツシタ 三下 +ミツシタ 満下 +ミツシバ 三柴 +ミツシマ 光島 +ミツシマ 満島 +ミツシマ 光嶋 +ミツシマ 満嶋 +ミツシマ 密島 +ミツシマ 三ツ島 +ミツシマ 美津島 +ミツシマ 三津島 +ミツシマ 光嶌 +ミツシマ 三ツ嶋 +ミツシマ 密嶋 +ミツシマ 滿島 +ミツシマ 滿嶋 +ミツジマ 光島 +ミヅシマ 水島 +ミヅシマ 美津島 +ミッショウ 密照 +ミツシロ 三城 +ミツシロ 光城 +ミツシロ 密城 +ミツシロ 光代 +ミツスエ 光末 +ミツズカ 三塚 +ミツスギ 三杉 +ミツスギ 光杉 +ミツスギ 三ツ杉 +ミツズミ 光墨 +ミツセ 三瀬 +ミツセ 光瀬 +ミツセ 満瀬 +ミツセ 光勢 +ミツセ 三ツ瀬 +ミツゼキ 三関 +ミツゾエ 満添 +ミツゾノ 満園 +ミツゾノ 満薗 +ミツゾノ 満囿 +ミツゾノ 滿園 +ミツゾノ 滿薗 +ミッタ 三田 +ミッタ 光田 +ミッタ 満田 +ミツタ 光田 +ミツタ 満田 +ミツタ 三津田 +ミツタ 密田 +ミツタ 蜜田 +ミツタ 光多 +ミツタ 美蔦 +ミツタ 光太 +ミツタ 滿田 +ミツダ 三田 +ミツダ 光田 +ミツダ 満田 +ミツダ 三津田 +ミツダ 密田 +ミツダ 三ツ田 +ミツダ 見津田 +ミツダ 蜜田 +ミツダ 光多 +ミツダ 満多 +ミツダ 滿田 +ミヅタ 水田 +ミツタカ 光高 +ミツタキ 光滝(光瀧) +ミツタキ 三ツ滝 +ミッタケ 三岳 +ミツタケ 光武 +ミツタケ 三岳 +ミツタケ 満武 +ミツタケ 光竹 +ミツタケ 滿武 +ミツタニ 三谷 +ミツタニ 三津谷 +ミツタニ 三ツ谷 +ミツタニ 光谷 +ミツタニ 満谷 +ミツタニ 密谷 +ミツタニ 蜜谷 +ミツタニ 光峪 +ミヅタニ 水谷 +ミツタマ 満玉 +ミヅタマリ 水溜 +ミツチ 三土 +ミツツカ 三塚 +ミツツカ 三束 +ミツヅカ 三塚 +ミツヅカ 光塚 +ミツヅカ 三ツ塚 +ミツヅカ 三束 +ミツヅカ 満束 +ミツツジ 三辻 +ミツツジ 光辻 +ミツツジ 三ツ辻 +ミツツネ 光常 +ミツツミ 三堤 +ミツヅミ 三鼓 +ミツヅミ 三皷 +ミツデ 三ツ出 +ミツデ 三津出 +ミツテラ 三寺 +ミツテラ 三ツ寺 +ミツデラ 三寺 +ミツデラ 三ツ寺 +ミツデラ 光寺 +ミツト 光戸 +ミツトウ 光藤 +ミツドウ 光藤 +ミツドウ 三堂 +ミツトシ 光年 +ミツトミ 光富 +ミツトミ 光冨 +ミツトミ 満富(滿富) +ミツトミ 満冨(滿冨) +ミツドミ 光富 +ミツドミ 光冨 +ミツトメ 三留 +ミツトメ 満留 +ミツトメ 滿留 +ミツドメ 三留 +ミツドメ 満留 +ミツドメ 滿留 +ミツトモ 光友 +ミツトモ 満友 +ミツナ 満名 +ミツナカ 満仲(滿仲) +ミツナカ 三中 +ミツナカ 光中 +ミツナカ 満中 +ミツナカ 三ツ中 +ミツナカ 三津中 +ミツナガ 光永 +ミツナガ 満永 +ミツナガ 三永 +ミツナガ 光長 +ミツナガ 三長 +ミツナガ 満長 +ミツナガ 三津永 +ミツナガ 滿永 +ミツナシ 三梨 +ミツナシ 三ツ梨 +ミツナベ 三鍋 +ミツナミ 三並 +ミツナミ 光浪 +ミツナミ 三浪 +ミツナミ 三波 +ミツナミ 三ツ浪 +ミツナミ 三竝 +ミツナリ 光成 +ミツナリ 三成 +ミツニシ 光西 +ミツヌシ 光主 +ミツヌマ 三ツ沼 +ミツネ 光根 +ミツネ 光恒 +ミツノ 三野 +ミツノ 光野 +ミツノ 三ツ野 +ミツノ 満野(滿野) +ミツノ 三津野 +ミツノ 密野 +ミツノ 光能 +ミヅノ 水野 +ミツノイ 光野井 +ミツノウ 光納 +ミツノブ 光延 +ミツノブ 光信 +ミツノベ 光延 +ミツノリ 光法 +ミツバ 三羽 +ミツバ 三葉 +ミツバ 光葉 +ミツバ 光場 +ミツバ 光波 +ミツハシ 三橋 +ミツハシ 三ツ橋 +ミツハシ 三觜 +ミツハシ 三津橋 +ミツハシ 光橋 +ミツハシ 三嘴 +ミツハシ 三箸 +ミツハタ 光畑 +ミツハタ 光畠 +ミツハタ 満畑 +ミツハタ 三ツ畑 +ミツハタ 光籏 +ミツバタケ 光畠 +ミツハナ 光栄(光榮) +ミツハマ 三ツ浜 +ミツハマ 三ツ濱 +ミツハマ 三津浜 +ミツバヤシ 三林 +ミツバヤシ 光林 +ミツバヤシ 三ツ林 +ミツバヤシ 満林 +ミツバヤシ 三津林 +ミツバヤシ 密林 +ミツハラ 光原 +ミツハラ 三津原 +ミツハラ 満原 +ミツハラ 密原 +ミツハラ 密波羅 +ミツハラ 蜜原 +ミツハラ 蜜波羅 +ミツハラ 滿原 +ミツビキ 三引 +ミツビキ 三曳(三曵) +ミツビキ 光引 +ミツヒサ 光久 +ミツヒダ 光飛田 +ミツヒラ 三平 +ミツヒラ 光平 +ミツヒラ 満平 +ミツヒラ 三ツ平 +ミツヒロ 光広 +ミツヒロ 光弘 +ミツヒロ 三ツ広 +ミツヒロ 光廣 +ミツヒロ 三ツ廣 +ミツヒロ 三広 +ミツフサ 光英 +ミツフジ 三藤 +ミツフジ 光藤 +ミツフジ 光冨士 +ミツブチ 三淵 +ミツブチ 三渕 +ミツベ 三部 +ミツベ 光部 +ミツホ 満保(滿保) +ミツボ 三坪 +ミツボ 三壷 +ミツボ 三壺 +ミツホシ 三星 +ミツボシ 三星 +ミツボシ 三ツ星 +ミツボシ 光星 +ミツホリ 三堀 +ミツホリ 三ツ堀 +ミツボリ 三堀 +ミツボリ 三ツ堀 +ミツボリ 三掘 +ミツボリ 光堀 +ミツマ 三間 +ミツマ 三馬 +ミツマ 三津間 +ミツマ 満間 +ミツマ 三ツ間 +ミツマ 三潴 +ミツマ 三満 +ミツマ 三妻 +ミツマ 光間 +ミツマ 美津馬 +ミツマ 滿間 +ミヅマ 水間 +ミヅマ 水馬 +ミヅマ 三潴 +ミヅマ 三瀦 +ミツマエ 三前 +ミツマエ 光前 +ミツマキ 三巻 +ミツマキ 光巻 +ミツマキ 三ツ巻 +ミツマサ 光正 +ミツマス 光増 +ミツマス 光益 +ミツマス 満益 +ミツマタ 三俣 +ミツマタ 三股 +ミツマタ 三又 +ミツマタ 三ツ股 +ミツマタ 光又 +ミツマタ 光亦 +ミツマタ 三ツ俣 +ミツマタ 光股 +ミツマタ 三ツ又 +ミツマタ 光俣 +ミツマチ 光町 +ミツマツ 三松 +ミツマツ 光松 +ミツマツ 三ツ松 +ミツマツ 満松 +ミツマル 三丸 +ミツマル 満丸 +ミツマル 光丸 +ミツマル 三ツ丸 +ミツマル 滿丸 +ミツマン 光満 +ミツミ 満身 +ミツミ 満見 +ミツミ 光見 +ミツミズ 三水 +ミツミゾ 三溝 +ミツミゾ 三ツ溝 +ミツミネ 光峰 +ミツミネ 三峰 +ミツミネ 三ツ峰 +ミツミネ 三峯 +ミツミヤ 光宮 +ミツムネ 光宗 +ミツムネ 三宗 +ミツムネ 三棟 +ミツムネ 晃宗 +ミツムラ 三村 +ミツムラ 光村 +ミツムラ 三ツ村 +ミツムラ 満村 +ミツムラ 三津村 +ミツムラ 密村 +ミツムラ 滿村 +ミツムラ 三ツ邑 +ミヅムラ 水村 +ミツメ 三ツ目 +ミツメ 三津目 +ミツメ 三目 +ミツメ 満目 +ミツモチ 光用 +ミツモチ 光持 +ミツモチ 三ツ持 +ミツモチ 満持 +ミツモチ 光待 +ミツモト 三本 +ミツモト 光本 +ミツモト 光元 +ミツモト 密本 +ミツモト 満本 +ミツモト 三ツ本 +ミツモト 三元 +ミツモト 満元 +ミツモト 三ツ元 +ミツモト 蜜本 +ミツモト 三津本 +ミヅモト 水本 +ミヅモト 水元 +ミツモリ 三森 +ミツモリ 光森 +ミツモリ 三ツ森 +ミツモリ 三守 +ミツモリ 光守 +ミツモリ 三盛 +ミツモリ 光盛 +ミツモリ 満森 +ミツモリ 三津守 +ミツモロ 三師 +ミツモン 密門 +ミツヤ 三谷 +ミツヤ 三矢 +ミツヤ 三津谷 +ミツヤ 三ツ谷 +ミツヤ 三屋 +ミツヤ 三ツ矢 +ミツヤ 光谷 +ミツヤ 三家 +ミツヤ 光家 +ミツヤ 満谷 +ミツヤ 三ツ屋 +ミツヤ 三津家 +ミツヤ 密谷 +ミツヤ 三津屋 +ミツヤ 三廼 +ミツヤ 満屋 +ミツヤ 三津矢 +ミツヤ 三箭 +ミツヤ 三迺 +ミツヤ 滿屋 +ミツヤス 光安 +ミツヤス 満保(滿保) +ミツヤス 光保 +ミツヤス 満安 +ミツヤス 光易 +ミツヤナギ 三柳 +ミツヤナギ 三ツ柳 +ミツヤマ 光山 +ミツヤマ 三山 +ミツヤマ 満山 +ミツヤマ 三津山 +ミツヤマ 密山 +ミツヤマ 三ツ山 +ミツヤマ 蜜山 +ミツヤマ 御都山 +ミツユ 三露 +ミツユキ 満行 +ミツユキ 光行 +ミツユキ 三行 +ミツヨ 三世 +ミツヨ 三余(三餘) +ミツヨシ 光吉 +ミツヨシ 満吉 +ミツヨシ 光好 +ミツヨシ 光芳 +ミツヨシ 光善 +ミツヨセ 三寄 +ミツヨセ 三ツ寄 +ミツヨリ 光頼 +ミツラ 光楽 +ミツラ 光樂 +ミツル 満 +ミツル 三鶴 +ミツル 盈 +ミツルヤ 三弦谷 +ミツワ 三輪 +ミツワ 三和 +ミツワ 三羽 +ミツワ 光輪 +ミツワ 三津輪 +ミツワカ 光若 +ミツワカ 満若 +ミテキ 三手木 +ミテクラ 見手倉 +ミテラ 三寺 +ミテラ 見寺 +ミテラ 味寺 +ミテラ 美寺 +ミデラ 三寺 +ミデラ 見寺 +ミテル 見光 +ミト 水戸 +ミト 三戸 +ミト 三登 +ミト 三津 +ミト 水門 +ミト 見戸 +ミト 美登 +ミト 三刀 +ミト 美戸 +ミト 水渡 +ミト 弥登 +ミト 光戸 +ミト 味土 +ミト 三計 +ミト 三都 +ミド 見土 +ミトイ 水戸井 +ミドイ 三土井 +ミトウ 三藤 +ミトウ 実藤 +ミトウ 美藤 +ミトウ 水藤 +ミトウ 見藤 +ミトウ 三東 +ミトウ 實藤 +ミトウ 美頭 +ミトウ 味藤 +ミトウ 美登 +ミトウ 見当 +ミトウ 三刀 +ミトウ 御藤 +ミトウ 見當 +ミトウ 御任 +ミトウ 美桃 +ミトウ 躬藤 +ミトウ 見籐 +ミドウ 御堂 +ミドウ 三堂 +ミドウ 美堂 +ミドウ 見道 +ミドウ 三僮 +ミドウ 味道 +ミドウオカ 御堂岡 +ミトウカ 三十日 +ミドウガイチ 御堂開地 +ミドウゴウチ 御堂河内 +ミドウシマ 御堂島 +ミドウジマ 御堂島 +ミドウチ 御堂地 +ミドウマエ 御堂前 +ミドウマル 御堂丸 +ミトオ 三十尾 +ミトオカ 三十日 +ミトオカ 三戸岡 +ミトオカ 水戸岡 +ミドオカ 御堂岡 +ミトオシ 見通 +ミトオシ 見当押(見當押) +ミトオリ 見通 +ミトオリ 三通 +ミトオリダ 三通田 +ミトカワ 水戸川 +ミトガワ 水戸川 +ミトキ 三時 +ミトク 三徳 +ミトグチ 水戸口 +ミトグチ 三戸口 +ミトコ 御床 +ミドゴウチ 御堂河内 +ミトシ 見年 +ミトシ 三年 +ミトジ 水戸路 +ミトジリ 三戸尻 +ミトセ 水戸瀬 +ミトセ 三戸瀬 +ミトダ 三戸田 +ミトダ 水戸田 +ミトテ 三戸手 +ミトデ 三戸手 +ミドテ 三土手 +ミトナカ 神戸中 +ミトノ 水戸野 +ミドノ 緑埜 +ミドノ 緑野 +ミトノヤ 御殿谷 +ミドノヤ 御殿谷 +ミトベ 水戸部 +ミトベ 三戸部 +ミトベ 水戸辺(水戸邉・水戸邊) +ミトベ 三戸辺(三戸邉) +ミトマ 三苫 +ミトマ 三笘 +ミトミ 三富 +ミトミ 三冨 +ミトミ 見富 +ミトミ 見冨 +ミトミ 三戸見 +ミトミ 美富 +ミトミ 味富 +ミトミ 味冨 +ミトメ 三留 +ミトメ 見留 +ミトメ 水戸目 +ミドメ 三留 +ミトモ 三友 +ミトモ 御供 +ミトモ 見供 +ミトモ 御友 +ミトモ 見友 +ミトモ 三共 +ミトモ 御共 +ミトモ 三巴 +ミトモリ 三戸森 +ミトモリ 水戸守 +ミトヤ 三刀屋 +ミトヤ 三刀谷 +ミトヤ 三戸谷 +ミトヤ 水戸屋 +ミトヤ 水戸谷 +ミトヨ 三戸代 +ミトラ 巳寅 +ミトリ 見鳥 +ミトリ 見取 +ミトリ 実取 +ミトリ 三通 +ミトリ 美取 +ミトリ 實取 +ミドリ 翠 +ミドリ 緑 +ミドリ 見鳥 +ミドリ 見取 +ミドリ 美鳥 +ミドリ 見酉 +ミドリ 碧 +ミドリカド 緑門 +ミドリカミ 緑上 +ミドリカワ 緑川 +ミドリカワ 翠川 +ミドリカワ 水鳥川 +ミドリカワ 緑河 +ミドリカワ 三鳥川 +ミドリカワ 碧川 +ミドリガワ 緑川 +ミドリギ 緑樹 +ミドリゲ 緑毛 +ミドリタ 翠田 +ミドリタ 緑田 +ミドリタニ 緑谷 +ミドリノ 緑野 +ミドリハラ 緑原 +ミドリマ 緑間 +ミドリマツ 緑松 +ミドリヤ 緑谷 +ミドリヤマ 緑山 +ミトロ 美登路 +ミトロ 三戸呂 +ミドロ 美土路 +ミドロ 美登路 +ミドロ 見土路 +ミドロ 水泥 +ミドロ 箕土路 +ミナ 美奈 +ミナアイ 皆合 +ミナイ 薬袋(藥袋) +ミナイ 南井 +ミナイ 御薬袋 +ミナイ 皆井 +ミナイ 美奈井 +ミナイシ 南石 +ミナイデ 南出 +ミナウチ 皆内 +ミナウラ 皆浦 +ミナエ 御苗 +ミナエ 御薬袋 +ミナオ 皆尾 +ミナオ 源尾 +ミナオ 美尚 +ミナオカ 南岡 +ミナオカ 皆岡 +ミナオカ 南丘 +ミナカ 三中 +ミナカ 三仲 +ミナカ 箕中 +ミナカ 御中 +ミナガ 三永 +ミナガ 見永 +ミナガ 三長 +ミナガ 皆賀 +ミナガキ 南小柿 +ミナガセ 皆ケ瀬 +ミナカタ 南方 +ミナカタ 皆方 +ミナカタ 南形 +ミナガタ 南形 +ミナカツ 皆勝 +ミナカミ 水上 +ミナカミ 皆上 +ミナカミ 皆神 +ミナカミ 源上 +ミナガミ 水上 +ミナカワ 皆川 +ミナカワ 南川 +ミナカワ 蜷川 +ミナカワ 源川 +ミナカワ 美奈川 +ミナカワ 皆河 +ミナガワ 皆川 +ミナガワ 南川 +ミナガワ 水川 +ミナガワ 蜷川 +ミナガワ 源川 +ミナガワ 美奈川 +ミナガワ 皆河 +ミナガワ 美那川 +ミナガワ 水無川 +ミナガワ 美名川 +ミナキ 皆木 +ミナキ 南木 +ミナキ 三奈木 +ミナキ 三名木 +ミナギ 皆木 +ミナギ 南木 +ミナギ 三奈木 +ミナギ 三名木 +ミナクチ 水口 +ミナクチ 南口 +ミナクチ 皆口 +ミナクチ 源口 +ミナクチ 水無口 +ミナグチ 水口 +ミナグチ 南口 +ミナグチ 皆口 +ミナグチ 源口 +ミナグチ 水名口 +ミナグチ 水無口 +ミナグチ 美名口 +ミナクボ 皆久保 +ミナクラ 皆倉 +ミナグロ 皆黒 +ミナゴエ 皆越 +ミナコシ 皆越 +ミナコシ 南越 +ミナゴシ 皆越 +ミナゴメ 皆米 +ミナサキ 南崎 +ミナサキ 皆崎 +ミナサコ 皆迫 +ミナササ 皆笹 +ミナサト 皆里 +ミナサワ 皆沢 +ミナサワ 皆澤 +ミナザワ 皆沢 +ミナザワ 皆澤 +ミナシ 三梨 +ミナジ 皆地 +ミナシマ 皆島 +ミナシマ 皆嶋 +ミナジマ 皆島 +ミナジマ 皆嶋 +ミナズミ 水澄 +ミナセ 水無瀬 +ミナセ 皆瀬 +ミナセ 南瀬 +ミナゾエ 皆添 +ミナタ 皆田 +ミナタ 三名田 +ミナダ 皆田 +ミナタニ 南谷 +ミナタニ 湊谷 +ミナタニ 皆谷 +ミナダニ 南谷 +ミナチ 皆地 +ミナヂ 皆地 +ミナツキ 皆月 +ミナツキ 水月 +ミナヅキ 皆月 +ミナト 湊 +ミナト 港 +ミナト 津 +ミナト 皆戸 +ミナト 三奈戸 +ミナト 尹戸 +ミナトイ 港井 +ミナトイシ 港石 +ミナトイシ 湊石 +ミナトウ 皆藤 +ミナトウラ 湊浦 +ミナトガワ 湊川 +ミナトガワ 港川 +ミナトグチ 湊口 +ミナトグチ 港口 +ミナトザキ 湊崎 +ミナトザキ 港崎 +ミナトザキ 湊先 +ミナトジョウ 湊城 +ミナトダ 湊田 +ミナトダ 港田 +ミナトダニ 湊谷 +ミナトダニ 港谷 +ミナトノ 港野 +ミナトバ 湊場 +ミナトバシ 港橋 +ミナトハラ 湊原 +ミナトベ 湊辺 +ミナトミチ 港道 +ミナトムラ 湊村 +ミナトモト 湊本 +ミナトヤ 湊谷 +ミナトヤ 湊屋 +ミナトヤ 港谷 +ミナトヤ 港屋 +ミナトヤマ 湊山 +ミナトヨ 咸豊 +ミナノ 皆野 +ミナノカワ 皆野川 +ミナノガワ 皆野川 +ミナバ 皆葉 +ミナバ 皆波 +ミナバ 皆場 +ミナハシ 南端 +ミナハシ 南橋 +ミナハシ 皆橋 +ミナハラ 皆原 +ミナハラ 源原 +ミナハラ 見奈原 +ミナヒラ 皆平 +ミナヒラ 咸平 +ミナヒロ 皆広(皆廣) +ミナフジ 皆藤 +ミナブチ 南渕 +ミナフミ 南文 +ミナベ 三部 +ミナベ 三鍋 +ミナベ 三辺 +ミナベ 見辺 +ミナベ 美辺(美邊・美邉) +ミナベ 三邉 +ミナベ 皆部 +ミナベ 見邊 +ミナベ 見邉 +ミナベ 三邊 +ミナマサ 皆政 +ミナマタ 水俣 +ミナマタ 派 +ミナマツ 皆松 +ミナミ 南 +ミナミ 皆見 +ミナミ 三並 +ミナミ 見並 +ミナミ 見波 +ミナミ 三浪 +ミナミ 美並 +ミナミ 美浪 +ミナミ 三波 +ミナミ 見浪 +ミナミ 巳波 +ミナミ 陽 +ミナミ 己波 +ミナミ 味波 +ミナミ 皆巳 +ミナミ 見奈美 +ミナミ 美波 +ミナミ 巳浪 +ミナミ 皆美 +ミナミ 己浪 +ミナミ 皆己 +ミナミ 皆已 +ミナミ 三那三 +ミナミ 南見 +ミナミ 味浪 +ミナミ 已浪 +ミナミアリタ 南有田 +ミナミイ 南井 +ミナミイ 南居 +ミナミイケ 南池 +ミナミイノウエ 南井上 +ミナミイノウエ 南井之上 +ミナミイワ 南岩 +ミナミウエ 南上 +ミナミウエダ 南上田 +ミナミウチ 南内 +ミナミウラ 南浦 +ミナミウラ 南裏 +ミナミエ 南江 +ミナミオ 南尾 +ミナミオオジ 南大路 +ミナミオオタニ 南大谷 +ミナミオオツ 南大津 +ミナミオオバヤシ 南大林 +ミナミオカ 南岡 +ミナミオカ 南丘 +ミナミガイチ 南垣内 +ミナミガイト 南垣内 +ミナミガイトウ 南垣内 +ミナミガキ 南垣 +ミナミガキ 南柿 +ミナミカゲ 南蔭 +ミナミカタ 南方 +ミナミガタ 南方 +ミナミガタ 南形 +ミナミガタ 南潟 +ミナミカツ 南勝 +ミナミカワ 南川 +ミナミカワ 南河 +ミナミガワ 南川 +ミナミガワ 南側 +ミナミガワ 南河 +ミナミキ 南木 +ミナミギ 南木 +ミナミギシ 南岸 +ミナミキョウゴク 南京極 +ミナミギワ 南極 +ミナミグチ 南口 +ミナミクニ 南国 +ミナミクボ 南久保 +ミナミクロサワ 南黒沢(南黒澤) +ミナミコウジ 南小路 +ミナミサ 南佐 +ミナミサカ 南坂 +ミナミサカ 南阪 +ミナミザカ 南坂 +ミナミザカ 南阪 +ミナミサカモト 南阪本 +ミナミサカモト 南坂本 +ミナミサキ 南崎 +ミナミサキ 南埼 +ミナミザキ 南崎 +ミナミザキ 南嵜 +ミナミサコ 南迫 +ミナミサコ 南浴 +ミナミザコ 南迫 +ミナミササザキ 南笹崎 +ミナミサト 南里 +ミナミザト 南里 +ミナミサワ 南沢 +ミナミサワ 南澤 +ミナミザワ 南沢 +ミナミザワ 南澤 +ミナミジ 南地 +ミナミシタ 南下 +ミナミシマ 南島 +ミナミシマ 南嶋 +ミナミジマ 南島 +ミナミジマ 南嶋 +ミナミショウガク 南正覚(南正覺) +ミナミシン 南新 +ミナミズ 皆水 +ミナミズメ 南詰 +ミナミセ 南瀬 +ミナミセコ 南迫 +ミナミソノ 南園 +ミナミソノ 南薗 +ミナミゾノ 南園 +ミナミゾノ 南薗 +ミナミタ 南田 +ミナミダ 南田 +ミナミダイラ 南平 +ミナミタカ 南高 +ミナミダカ 南高 +ミナミタケ 南竹 +ミナミタテ 南舘 +ミナミタテ 南館 +ミナミダテ 南舘 +ミナミダテ 南館 +ミナミダテ 南達 +ミナミタニ 南谷 +ミナミダニ 南谷 +ミナミタマリ 南玉利 +ミナミツ 南津 +ミナミツ 皆光 +ミナミツカ 南塚 +ミナミヅカ 南塚 +ミナミツジ 南辻 +ミナミツボ 南坪 +ミナミヅメ 南詰 +ミナミツル 南鶴 +ミナミヅル 南鶴 +ミナミテ 南手 +ミナミデ 南出 +ミナミデラ 南寺 +ミナミドイ 南土居 +ミナミドウ 南堂 +ミナミトウゲ 南峠 +ミナミドテ 南土手 +ミナミナカ 南中 +ミナミナカミチ 南中道 +ミナミノ 南野 +ミナミノ 南埜 +ミナミノ 南濃 +ミナミノソノ 南之園 +ミナミノソノ 南ノ園 +ミナミノハラ 南之原 +ミナミバエ 南八重 +ミナミハシ 南橋 +ミナミバシ 南橋 +ミナミハタ 南畑 +ミナミハタ 南端 +ミナミバタ 南畑 +ミナミバタ 南端 +ミナミハツボ 南羽坪 +ミナミハバ 南幅 +ミナミハバ 南巾 +ミナミハマ 南浜 +ミナミハマ 南濱 +ミナミバヤシ 南林 +ミナミハラ 南原 +ミナミヒサマツ 南久松 +ミナミヒラ 南平 +ミナミフチ 南淵 +ミナミブチ 南渕 +ミナミブチ 南淵 +ミナミボウジョウ 南坊城 +ミナミホウノキ 南朴木 +ミナミホリ 南堀 +ミナミボリ 南堀 +ミナミマエ 南前 +ミナミマガリ 南曲 +ミナミマゴエ 南馬越 +ミナミムカイ 南向 +ミナミムラ 南村 +ミナミムレ 南牟礼(南牟禮) +ミナミモト 南本 +ミナミモト 南元 +ミナミモリ 南森 +ミナミヤ 南谷 +ミナミヤ 南家 +ミナミヤ 南屋 +ミナミヤ 南舎 +ミナミヤエ 南八重 +ミナミヤシキ 南屋敷 +ミナミヤブ 南藪 +ミナミヤマ 南山 +ミナミル 皆見 +ミナミワキ 南脇 +ミナムラ 南村 +ミナムラ 皆村 +ミナモト 水本 +ミナモト 源 +ミナモト 水元 +ミナモト 南本 +ミナモト 皆本 +ミナモト 皆元 +ミナモト 湊本 +ミナモト 南元 +ミナモト 源本 +ミナモト 源元 +ミナモト 渞 +ミナモト 港元 +ミナモト 美那元 +ミナモト 咸本 +ミナモト 三名本 +ミナモト 灥 +ミナモトガワ 源川 +ミナモリ 皆森 +ミナモリ 皆盛 +ミナモリ 水精 +ミナヤマ 皆山 +ミナヤマ 僉山 +ミナヨシ 皆吉 +ミナヨシ 源吉 +ミナヨシ 皆芳 +ミナリ 三成 +ミナリ 実成 +ミナリ 實成 +ミナリ 箕成 +ミナリ 参成 +ミナル 御鳴 +ミナロ 皆呂 +ミナワ 三縄 +ミナワ 三繩 +ミナワタリ 皆渡 +ミニュウ 三入 +ミニュウ 美入 +ミニワ 御庭 +ミニン 美仁 +ミヌキノ 三貫納 +ミヌサ 三幣 +ミヌマ 三沼 +ミヌマ 美沼 +ミネ 峯 +ミネ 峰 +ミネ 三根 +ミネ 嶺 +ミネ 美根 +ミネ 岑 +ミネ 見根 +ミネ 美禰 +ミネ 美祢 +ミネ 美弥 +ミネイ 嶺井 +ミネイ 峯井 +ミネイ 峰井 +ミネイシ 嶺石 +ミネイシ 峯石 +ミネイシ 峰石 +ミネイワ 峯岩 +ミネウ 峯宇 +ミネウ 峰宇 +ミネウエ 峯上 +ミネウジ 峯氏 +ミネウシロ 峯後 +ミネウチ 峰内 +ミネウチ 峯内 +ミネウラ 峯浦 +ミネウラ 峰浦 +ミネエ 峰江 +ミネエダ 峯枝 +ミネオ 峰尾 +ミネオ 峯尾 +ミネオ 三根生 +ミネオ 嶺尾 +ミネオ 峰雄 +ミネオ 岑尾 +ミネオイ 三根生 +ミネオカ 峰岡 +ミネオカ 峯岡 +ミネオカ 峠岡 +ミネオカ 嶺岡 +ミネガイト 峯垣内 +ミネガイト 峰垣外 +ミネガイト 峯垣外 +ミネガキ 峯垣 +ミネガキ 峰垣 +ミネカゲ 嶺蔭 +ミネカゲ 峯影 +ミネカズ 峰数 +ミネカネ 峰金 +ミネカネ 峯金 +ミネカミ 峯上 +ミネガミ 峯上 +ミネガミ 峰上 +ミネガミ 峰神 +ミネガミ 峯神 +ミネカワ 登川 +ミネカワ 峯川 +ミネカワ 峰川 +ミネカワ 嶺川 +ミネガワ 峯川 +ミネキ 峯木 +ミネキ 嶺木 +ミネキ 峰木 +ミネキシ 峯岸 +ミネキシ 峰岸 +ミネキシ 嶺岸 +ミネギシ 峯岸 +ミネギシ 峰岸 +ミネギシ 嶺岸 +ミネギシ 峰㟁 +ミネギシ 峯㟁 +ミネキタ 峯北 +ミネグチ 峯口 +ミネグチ 峰口 +ミネクボ 峰久保 +ミネクボ 峯久保 +ミネクラ 嶺倉 +ミネコシ 峯越 +ミネコシ 峰越 +ミネゴシ 峯越 +ミネゴシ 峰越 +ミネサ 峯佐 +ミネサ 峯左 +ミネサカ 峯坂 +ミネサカ 峰坂 +ミネサカ 峰阪 +ミネサカ 峰嶺(峯嶺) +ミネザカ 峯坂 +ミネサキ 峯崎 +ミネサキ 峰崎(峰埼) +ミネサキ 嶺崎 +ミネサキ 峯嵜 +ミネサキ 峰咲 +ミネザキ 峯崎 +ミネザキ 峰崎(峰埼) +ミネザキ 嶺崎 +ミネザキ 峯嵜 +ミネサコ 峯砂 +ミネサコ 峯迫 +ミネサワ 峰沢 +ミネサワ 嶺沢 +ミネサワ 峯沢 +ミネサワ 峯澤 +ミネサワ 峰澤 +ミネサワ 嶺澤 +ミネザワ 峰沢 +ミネザワ 峯沢 +ミネザワ 峯澤 +ミネザワ 峰澤 +ミネザワ 嶺澤 +ミネジ 峰地 +ミネジ 峯地 +ミネジ 岑地 +ミネシゲ 峯重 +ミネシゲ 峰重 +ミネシゲ 嶺重 +ミネシタ 峯下 +ミネシタ 峰下 +ミネシタ 嶺下 +ミネシバ 峯芝 +ミネシバ 峯柴 +ミネシマ 峰島 +ミネシマ 峯島 +ミネシマ 峯嶋 +ミネシマ 峰嶋 +ミネシマ 嶺島 +ミネシマ 峯嶌 +ミネシマ 峰嶌 +ミネジマ 峰島 +ミネジマ 峯島 +ミネジマ 峯嶋 +ミネジマ 峰嶋 +ミネジマ 峯嶌 +ミネジョウ 峯城 +ミネシロ 峯城 +ミネシロ 峰城 +ミネスエ 峰末 +ミネスギ 峯杉 +ミネスナ 峰砂 +ミネセ 峯瀬 +ミネセ 峰瀬 +ミネゾエ 峰添 +ミネゾエ 峯添 +ミネソノ 峯園 +ミネソノ 峰園 +ミネゾノ 峯園 +ミネタ 峯田 +ミネタ 峰田 +ミネタ 嶺田 +ミネタ 岑田 +ミネダ 峯田 +ミネダ 峰田 +ミネダ 嶺田 +ミネダ 岑田 +ミネタカ 峰高 +ミネタカ 峯高 +ミネタキ 峰滝 +ミネタキ 峯滝 +ミネタキ 峯瀧 +ミネタケ 峰竹 +ミネタケ 峯竹 +ミネタニ 峯谷 +ミネタニ 峰谷 +ミネタマ 峯玉 +ミネチカ 峯近 +ミネチカ 峰近 +ミネヅカ 峯塚 +ミネヅミ 峯積 +ミネヅミ 峰積 +ミネデ 嶺出 +ミネト 峯戸 +ミネト 峰戸 +ミネトウ 峰当 +ミネトウ 峯当 +ミネドウ 峰堂 +ミネトキ 峰時 +ミネトク 峰得 +ミネトク 峯得 +ミネトシ 峯俊(峰俊) +ミネトマ 峯苫 +ミネトマ 峰苫 +ミネトマツ 峯戸松 +ミネトマツ 峰戸松 +ミネトモ 峯友 +ミネトモ 峰友 +ミネナカ 峯中 +ミネナカ 峰中 +ミネナガ 峰永 +ミネナガ 峯永 +ミネナガ 岑永 +ミネニシ 峯西 +ミネノ 峰野 +ミネノ 峯野 +ミネノ 嶺野 +ミネノ 岑野 +ミネノイ 峯ノ井 +ミネノリ 嶺乗 +ミネハタ 峯畑 +ミネハタ 峰畑 +ミネハタ 峰籏 +ミネハタ 峯畠 +ミネハタ 峯籏 +ミネハタ 岑畑 +ミネバヤシ 峯林 +ミネバヤシ 峰林 +ミネハラ 峰原 +ミネハラ 峯原 +ミネハル 峰晴 +ミネヒサ 峰久(峯久) +ミネヒラ 峰平 +ミネヒラ 峯平 +ミネヒロ 峰広(峰廣) +ミネヒロ 峯広 +ミネフサ 峯房 +ミネフサ 峰房 +ミネフジ 峯藤 +ミネフジ 峰藤 +ミネフジ 嶺藤 +ミネベ 峯部 +ミネマ 嶺間 +ミネマ 峰間 +ミネマ 峯間 +ミネマサ 峰政 +ミネマサ 峯政 +ミネマツ 峰松 +ミネマツ 峯松 +ミネマル 峯丸 +ミネマワリ 峯廻 +ミネマワリ 峰廻 +ミネマワリ 峰回 +ミネミ 峰見 +ミネミ 峯見 +ミネミズ 峯水 +ミネミズ 峰水 +ミネミツ 峯光 +ミネミツ 峰光 +ミネムラ 峯村 +ミネムラ 峰村 +ミネムラ 嶺村 +ミネムラ 峯邑 +ミネムラ 岑村 +ミネムラ 峰邑 +ミネモト 峯本 +ミネモト 峰本 +ミネモト 峯元 +ミネモト 峰元 +ミネモト 嶺本 +ミネモト 嶺元 +ミネモト 岑本 +ミネモリ 峯森 +ミネモリ 峰森 +ミネモリ 峰守 +ミネヤ 峯谷 +ミネヤ 三根谷 +ミネヤス 峰安 +ミネヤマ 峯山 +ミネヤマ 峰山 +ミネヤマ 嶺山 +ミネヤマ 岑山 +ミネヤマ 三根山 +ミネユキ 峰雪 +ミネユキ 峰行 +ミネユキ 峯雪 +ミネヨシ 峯吉 +ミネヨシ 峰吉 +ミネヨシ 岑吉 +ミネヨシ 峯秀 +ミネワキ 峰脇 +ミネワキ 嶺脇 +ミネワキ 峯脇 +ミネンゴ 己年後 +ミネンゴ 巳年後 +ミノ 三野 +ミノ 美濃 +ミノ 美野 +ミノ 見野 +ミノ 蓑 +ミノ 箕野 +ミノ 味野 +ミノ 身野 +ミノ 簑 +ミノ 巳野 +ミノ 味埜 +ミノ 三廼 +ミノ 美農 +ミノ 己野 +ミノ 箕 +ミノ 三乃 +ミノ 簔 +ミノイ 美濃井 +ミノイ 見ノ井 +ミノイ 美農井 +ミノイ 箕井 +ミノイケ 御影池 +ミノウ 美濃 +ミノウ 美納 +ミノウ 美能 +ミノウ 味生 +ミノウ 味能 +ミノウエ 己之上 +ミノウエ 美之上 +ミノウエ 巳之上 +ミノウチ 箕内 +ミノウチ 蓑内 +ミノウチ 簑内 +ミノウチ 箕打 +ミノウラ 箕浦 +ミノウラ 蓑浦 +ミノウラ 美濃浦 +ミノウラ 簑浦 +ミノウラ 三ノ浦 +ミノウラ 見ノ浦 +ミノウラ 見之浦 +ミノウラ 美之浦 +ミノウラ 箕裏 +ミノウラ 簔浦 +ミノエツ 己之越 +ミノオ 蓑毛 +ミノオ 箕曲 +ミノオ 箕尾 +ミノオ 箕面 +ミノオ 美濃尾 +ミノオ 蓑尾 +ミノオカ 箕岡 +ミノオカ 美濃岡 +ミノオカ 蓑岡 +ミノオカ 簑岡 +ミノオカ 三野岡 +ミノガイト 蓑垣内 +ミノガキ 美濃垣 +ミノカタ 蓑方 +ミノカタ 箕形 +ミノガタ 箕形 +ミノカミ 美ノ上 +ミノカミ 三ノ上 +ミノガミ 美ノ上 +ミノガミ 蓑上 +ミノカワ 箕川 +ミノカワ 美濃川 +ミノカワ 蓑川 +ミノカワ 三濃川 +ミノカワ 美野川 +ミノカワ 簑川 +ミノガワ 美濃川 +ミノキ 三軒 +ミノキ 見ノ木 +ミノキ 簑木 +ミノクチ 巳之口 +ミノクチ 美之口 +ミノクチ 己之口 +ミノグチ 蓑口 +ミノグチ 美濃口 +ミノグチ 簑口 +ミノグチ 箕口 +ミノグチ 水野口 +ミノグチ 美野口 +ミノグチ 箕ノ口 +ミノグチ 簔口 +ミノクラ 箕倉 +ミノケ 蓑毛 +ミノゲ 蓑毛 +ミノゲ 美濃毛 +ミノコシ 箕越 +ミノコシ 美越 +ミノコシ 美濃越 +ミノコシ 見之越 +ミノコシ 見野越 +ミノコシ 蓑越 +ミノコダニ 美濃子谷 +ミノサキ 蓑崎 +ミノサキ 箕崎 +ミノサキ 美濃崎 +ミノサキ 箕面崎(箕面嵜) +ミノザキ 蓑崎 +ミノザキ 簑崎 +ミノサク 箕作 +ミノサコ 箕迫 +ミノサワ 箕沢 +ミノサワ 箕澤 +ミノザワ 箕澤 +ミノジ 蓑地 +ミノジ 美濃地 +ミノシタ 簑下 +ミノシタ 蓑下 +ミノシタ 箕下 +ミノシマ 蓑島 +ミノシマ 簑島 +ミノシマ 美濃島 +ミノシマ 箕島 +ミノシマ 箕嶋 +ミノシマ 蓑嶋 +ミノシマ 美濃嶋 +ミノシマ 三野島 +ミノシマ 簔島 +ミノシマ 簑嶋 +ミノシロ 蓑代 +ミノシロ 簑城(簔城) +ミノシロ 蓑城 +ミノセ 巳ノ瀬 +ミノセ 見野瀬 +ミノセ 三野瀬 +ミノセ 美濃瀬 +ミノセ 己ノ瀬 +ミノゾエ 蓑添 +ミノゾエ 簑添 +ミノソコ 箕底 +ミノタ 蓑田 +ミノタ 箕田 +ミノタ 簑田 +ミノタ 簔田 +ミノダ 蓑田 +ミノダ 箕田 +ミノダ 簑田 +ミノダ 美野田 +ミノダ 美濃田 +ミノダ 三野田 +ミノダ 簔田 +ミノダ 実能田 +ミノダ 美能田 +ミノダ 稔田 +ミノダ 實能田 +ミノタニ 美濃谷 +ミノタニ 箕谷 +ミノタニ 蓑谷 +ミノタニ 美ノ谷 +ミノタニ 簑谷 +ミノタニ 三野谷 +ミノタニ 美野谷 +ミノダニ 蓑谷 +ミノチ 水内 +ミノチ 美濃地 +ミノヂ 美濃地 +ミノツ 蓑津 +ミノツ 美濃津 +ミノツ 簑津 +ミノヅマ 蓑妻 +ミノヅマ 簑妻 +ミノテ 蓑手 +ミノテ 簑手 +ミノテ 箕手 +ミノデ 美濃出 +ミノニシ 箕西 +ミノノ 蓑野 +ミノハ 美濃羽 +ミノハ 蓑羽 +ミノハ 箕葉 +ミノハ 蓑葉 +ミノハ 簑葉 +ミノハタ 箕畑 +ミノハタ 蓑畑 +ミノハナ 巳鼻 +ミノバヤシ 箕林 +ミノバヤシ 美濃林 +ミノハラ 簑原 +ミノハラ 蓑原 +ミノハラ 箕原 +ミノハラ 三野原 +ミノハラ 簔原 +ミノハラ 美濃原 +ミノブ 見延 +ミノブ 身延 +ミノブ 蓑夫 +ミノベ 美濃部 +ミノベ 見延 +ミノベ 蓑部 +ミノベ 美濃辺(美濃邊) +ミノベ 箕部 +ミノベ 美野部 +ミノベ 見野部 +ミノベ 簑部 +ミノベ 美ノ辺(美ノ邊) +ミノベ 美延 +ミノベ 美濃邉 +ミノベ 箕延 +ミノホシ 蓑干 +ミノホシ 蓑星 +ミノホラ 蓑洞 +ミノホラ 簑洞 +ミノボリ 実登 +ミノマタ 美濃又 +ミノミ 味呑 +ミノミヤ 蓑宮 +ミノミヤ 簔宮 +ミノムタ 蓑牟田 +ミノムタ 簑牟田 +ミノムラ 実村 +ミノムラ 箕村 +ミノムラ 三野村 +ミノムラ 美濃村 +ミノムラ 簑村 +ミノモ 蓑毛 +ミノモ 蓑茂 +ミノモ 簑毛 +ミノモ 箕面 +ミノモ 簑茂 +ミノモ 簔毛 +ミノモ 䒾毛 +ミノモウ 簑毛 +ミノモト 箕本 +ミノモト 美濃本 +ミノモト 美野本 +ミノモト 三之本 +ミノモト 三野本 +ミノモト 美ノ本 +ミノモト 蓑本 +ミノモト 簑本 +ミノヤ 美濃谷 +ミノヤ 箕谷 +ミノヤ 蓑谷 +ミノヤ 美濃屋 +ミノヤ 美ノ谷 +ミノヤ 簑谷 +ミノヤ 三野谷 +ミノヤ 箕矢 +ミノヤ 美農谷 +ミノヤ 箕屋 +ミノヤ 蓑屋 +ミノヤ 簑屋 +ミノヤ 簔谷 +ミノヤマ 箕山 +ミノヤマ 美濃山 +ミノヤマ 蓑山 +ミノラ 箕浦 +ミノリ 見乗 +ミノリ 三乗(三乘) +ミノリ 熟 +ミノリ 御法 +ミノリ 法雨 +ミノリカワ 御法川 +ミノリヤマ 熟山 +ミノル 実 +ミノル 實 +ミノワ 箕輪 +ミノワ 蓑輪 +ミノワ 簑輪 +ミノワ 美濃輪 +ミノワ 蓑和 +ミノワ 美濃羽 +ミノワ 三野輪 +ミノワ 美野輪 +ミノワ 三ノ輪 +ミノワ 美濃和 +ミノワ 美輪 +ミノワ 味野和 +ミノワ 簑和(簔和) +ミノワ 箕曲 +ミノワ 簔輪 +ミノワ 蓑羽 +ミノワ 簑羽 +ミノワ 三の輪 +ミノワ 美ノ輪 +ミノワ 三之輪 +ミノワキ 箕脇 +ミノワダ 簑和田 +ミノワダ 蓑和田 +ミノワダ 箕輪田 +ミノワダ 簔和田 +ミノワラダ 蓑藁田(簑藁田) +ミバ 己波 +ミバ 三葉 +ミバ 三場 +ミバエ 実生 +ミバエ 實生 +ミハシ 三橋 +ミハシ 三觜 +ミハシ 三階 +ミハシ 箕箸 +ミハシ 御橋 +ミハシ 三嘴 +ミハシ 三槁 +ミハタ 御幡 +ミハタ 三畑 +ミハタ 三幡 +ミハタ 御畑 +ミハタ 美籏 +ミハタ 美旗 +ミハタ 見畑 +ミハタ 御旗 +ミハタ 御籏 +ミハタ 三畠 +ミハタ 御播 +ミハタ 身畑 +ミハナ 巳鼻 +ミハナ 三華 +ミハマ 三浜 +ミハマ 美浜 +ミハマ 三濱 +ミハマ 神浜(神濱) +ミハマ 美濱 +ミハヤ 造隼 +ミハヤ 水速 +ミハヤシ 三林 +ミハヤシ 御林 +ミバヤシ 三林 +ミバヤシ 見林 +ミバヤシ 美林 +ミハラ 三原 +ミハラ 水原 +ミハラ 見原 +ミハラ 実原 +ミハラ 美原 +ミハラ 御原 +ミハラ 實原 +ミハラ 柞原 +ミハラ 身原 +ミハラ 巳原 +ミハラカジ 三原鍛治 +ミハラダ 三原田 +ミハラヅメ 三原詰 +ミハラマツ 三原松 +ミハラヤ 三原屋 +ミハリ 見張 +ミハリ 三張 +ミハル 三明 +ミハル 三春 +ミハル 三治 +ミハル 見春 +ミビキ 三引 +ミヒラ 三平 +ミヒラ 実平 +ミヒラ 見平 +ミヒラ 美平 +ミヒロ 見広(見廣) +ミヒロギ 三尋木 +ミブ 壬生 +ミブ 三歩 +ミブ 三生 +ミブ 三扶 +ミフカ 身深 +ミブカ 身深 +ミブカワ 壬生川 +ミフク 御福 +ミフク 三福 +ミブクラ 壬生倉 +ミフサ 三房 +ミフジ 三藤 +ミフジ 見藤 +ミフジ 三富士 +ミフジ 三冨士 +ミブシ 三武士 +ミフジダ 三藤田 +ミブタ 民部田 +ミブタ 壬生田 +ミフチ 三淵 +ミフチ 三渕 +ミブチ 三淵 +ミブチ 三渕 +ミブチ 実渕 +ミブチ 実淵(實淵) +ミブチ 實渕 +ミブチ 実渊(實渊) +ミブツカ 壬生塚 +ミフデ 御筆 +ミフネ 三船 +ミフネ 御船 +ミフネ 三舩 +ミフネ 美船 +ミフネ 御舩 +ミフネ 三舟 +ミフネ 美舟 +ミフネ 見船 +ミフネ 美舩 +ミフネ 御舟 +ミフネ 神船 +ミフル 御古 +ミフル 三古 +ミベ 三部 +ミヘイ 三瓶 +ミホ 三保 +ミホ 美保 +ミホ 三穂 +ミホ 見保 +ミホ 三甫 +ミボ 三母 +ミホイチ 三歩一 +ミホキ 三保木 +ミホギ 三保木 +ミホシ 三星 +ミボシ 三星 +ミホタ 三保田 +ミホタニ 三保谷 +ミホド 三程 +ミホノ 三穂野(三穗野) +ミホノ 三保野 +ミホハラ 神保原 +ミホバラ 神保原 +ミホマツ 三本松 +ミホヤ 三保谷 +ミホヤ 三保家 +ミホリ 三堀 +ミホリ 御堀 +ミボロ 御母衣 +ミマ 美馬 +ミマ 水間 +ミマ 三間 +ミマ 三馬 +ミマ 美間 +ミマ 三摩 +ミマ 味間 +ミマ 美麻 +ミマ 見間 +ミマ 美摩 +ミマエ 三前 +ミマエ 見前 +ミマエ 美前 +ミマキ 三牧 +ミマキ 御牧 +ミマキ 三巻 +ミマキ 箕牧 +ミマキ 三槙(三槇) +ミマサ 三政 +ミマサカ 美作 +ミマサカ 美間坂 +ミマサク 美作 +ミマシ 三増 +ミマジ 三間地 +ミマス 三桝 +ミマス 三舛 +ミマス 三枡 +ミマス 見増 +ミマス 三升 +ミマス 三増 +ミマス 箕桝 +ミマスギ 三升木 +ミマスギ 三舛木 +ミマスヤ 三升谷 +ミマスヤ 三舛谷 +ミマセ 三間瀬 +ミマタ 三俣 +ミマタ 三股 +ミマタ 三又 +ミマタ 巳亦 +ミマタ 己亦 +ミマタ 三朕 +ミマタ 美又 +ミマタ 已亦 +ミマチ 三町 +ミマチ 見真地(見眞地) +ミマチ 三待 +ミマツ 未松 +ミマツ 実松 +ミマツ 三松 +ミマツ 實松 +ミマツ 美松 +ミマツ 見松 +ミマツ 味松 +ミマツ 巳松 +ミマナ 任那 +ミマモト 美馬本 +ミマヤ 御厩 +ミマヤ 三間屋 +ミマヤ 御馬舎 +ミマヤ 御廐 +ミマヤゾノ 御厩園 +ミマル 三丸 +ミマンダ 三満田 +ミミ 美見 +ミミ 耳 +ミミイ 耳井 +ミミウラ 耳浦 +ミミカネ 耳兼 +ミミカワ 耳川 +ミミズカ 耳塚 +ミミタ 耳田 +ミミダ 耳田 +ミミツカ 耳塚 +ミミヅカ 耳塚 +ミミドウ 耳道 +ミミノ 耳野 +ミミヤ 三宮 +ミムネ 三宗 +ミムラ 三村 +ミムラ 味村 +ミムラ 見村 +ミムラ 美村 +ミムラ 御村 +ミムラ 実村 +ミムラ 箕村 +ミムラ 三邨 +ミムラ 見邨 +ミムラ 三邑 +ミムラ 弥村 +ミムラ 覧村 +ミムラ 實村 +ミムラ 巳村 +ミムラタ 三村田 +ミムラダ 三村田 +ミムロ 三室 +ミムロ 御室 +ミムロ 見室 +ミムロト 三室戸 +ミムロド 三室戸 +ミメ 見目 +ミメイ 三明 +ミモウ 水毛生 +ミモダ 三百田 +ミモト 三本 +ミモト 味元 +ミモト 実本 +ミモト 見本 +ミモト 見元 +ミモト 味本 +ミモト 箕本 +ミモト 美本 +ミモト 御本 +ミモト 身本 +ミモト 巳本 +ミモトギ 三本木 +ミモミ 実籾 +ミモミ 實籾 +ミモリ 三森 +ミモリ 御守 +ミモリ 三守 +ミモリ 三盛 +ミモリ 見森 +ミモリ 味森 +ミモロ 三師 +ミヤ 三谷 +ミヤ 宮 +ミヤ 三矢 +ミヤ 三屋 +ミヤ 美谷 +ミヤ 三家 +ミヤ 味谷 +ミヤ 見矢 +ミヤ 美矢 +ミヤ 見家 +ミヤ 箕屋 +ミヤアキ 宮明 +ミヤアキ 宮秋 +ミヤアケ 宮明 +ミヤアト 宮後 +ミヤアリ 宮有 +ミヤイ 宮井 +ミヤイ 宮居 +ミヤイ 見屋井 +ミヤイケ 宮池 +ミヤイシ 宮石 +ミヤイタ 宮板 +ミヤイチ 宮一 +ミヤイチ 宮市 +ミヤイト 宮糸 +ミヤイリ 宮入 +ミヤウエ 宮上 +ミヤウエ 宮植 +ミヤウジ 宮宇地 +ミヤウジ 宮氏 +ミヤウジ 宮宇治 +ミヤウシロ 宮後 +ミヤウチ 宮内 +ミヤウチ 宮宇地 +ミヤウチ 宮谷内 +ミヤウチ 水谷内 +ミヤウチ 宮裡 +ミヤウヂ 宮宇地 +ミヤウチゴ 宮内後 +ミヤウラ 宮浦 +ミヤウラ 宮裏 +ミヤエ 宮江 +ミヤエ 宮栄(宮榮) +ミヤエダ 宮枝 +ミヤオ 宮尾 +ミヤオ 宮生 +ミヤオ 都尾 +ミヤオイ 宮負 +ミヤオイ 宮尾井 +ミヤオウ 宮応 +ミヤオウ 宮應 +ミヤオウ 宮王 +ミヤオウ 宮鷹 +ミヤオカ 宮岡 +ミヤオカ 宮岳 +ミヤオカ 宮丘 +ミヤオカ 宮𦊆 +ミヤオキ 宮沖 +ミヤオク 宮奥 +ミヤオリ 宮折 +ミヤガ 宮ケ +ミヤガ 宮賀 +ミヤカイ 宮階 +ミヤカイ 宮飼 +ミヤガイ 宮谷 +ミヤガイ 宮階 +ミヤガイ 宮外 +ミヤガイ 宮飼 +ミヤガイツ 宮垣津 +ミヤガウチ 宮垣内 +ミヤガキ 宮垣 +ミヤガキツ 宮垣津 +ミヤカク 宮角 +ミヤカゲ 宮景 +ミヤカゲ 宮蔭 +ミヤガサキ 宮ケ崎 +ミヤガサキ 宮賀崎 +ミヤガサコ 宮ケ迫 +ミヤカゼ 宮風 +ミヤカタ 宮方 +ミヤガタ 宮形 +ミヤガタニ 宮ケ谷 +ミヤガタニ 宮加谷 +ミヤガチョウ 宮ケ丁 +ミヤカツ 宮勝 +ミヤカド 宮角 +ミヤカド 宮門 +ミヤガナカ 宮ケ中 +ミヤカネ 宮金 +ミヤカネ 宮兼 +ミヤガネ 宮金 +ミヤカノ 宮鹿野 +ミヤガノ 宮ケ野 +ミヤガノ 宮鹿野 +ミヤガハラ 宮ケ原 +ミヤカミ 宮上 +ミヤガミ 宮上 +ミヤガヤ 宮ケ谷 +ミヤカワ 宮川 +ミヤカワ 宮河 +ミヤガワ 宮川 +ミヤガワ 宮河 +ミヤガワ 三宅川 +ミヤガワ 宮側 +ミヤガワ 三谷川 +ミヤガワ 水谷川 +ミヤキ 宮城 +ミヤキ 宮木 +ミヤキ 見矢木 +ミヤキ 味八木 +ミヤキ 宮喜 +ミヤキ 宮気(宮氣) +ミヤキ 宮規 +ミヤキ 宮錦 +ミヤキ 三八木 +ミヤキ 三矢城 +ミヤギ 宮城 +ミヤギ 宮木 +ミヤギ 宮儀 +ミヤギ 見矢木 +ミヤギ 宮岐 +ミヤギサワ 三八木沢(三八木澤) +ミヤギシ 宮岸 +ミヤギシマ 宮城島(宮城嶋) +ミヤギシマ 宮城嶌 +ミヤキタ 宮北 +ミヤギタニ 宮城谷 +ミヤギノ 宮城野 +ミヤギワ 宮際 +ミヤクサ 宮艸 +ミヤクサ 宮草 +ミヤクシ 宮串 +ミヤクジ 宮久地 +ミヤクス 宮楠 +ミヤグス 宮楠 +ミヤグスク 宮城 +ミヤクチ 宮口 +ミヤクヂ 宮久地 +ミヤグチ 宮口 +ミヤクニ 宮国 +ミヤクニ 宮國 +ミヤクニ 宮邦 +ミヤグニ 宮国 +ミヤグニ 宮國 +ミヤクビ 宮首 +ミヤクボ 宮久保 +ミヤクボ 宮窪 +ミヤグマ 宮熊 +ミヤクラ 宮倉 +ミヤケ 三宅 +ミヤケ 宮家 +ミヤケ 宮宅 +ミヤケ 三毛 +ミヤケ 宮毛 +ミヤケ 宮慶 +ミヤケ 美宅 +ミヤケ 屯倉 +ミヤゲ 土産 +ミヤケイ 宮慶 +ミヤケガワ 三宅川 +ミヤゲタ 土産田 +ミヤゲダ 土産田 +ミヤケナカ 宮ケ中 +ミヤコ 都 +ミヤコ 宮古 +ミヤコ 宮子 +ミヤコ 京都 +ミヤコ 宮幸 +ミヤコ 三朝 +ミヤコ 都古 +ミヤゴ 宮後 +ミヤコイシ 都石 +ミヤコウ 宮康 +ミヤゴウ 宮郷 +ミヤコウジ 宮小路 +ミヤゴエ 宮越 +ミヤコガワ 都川 +ミヤコグチ 都口 +ミヤコザカ 都坂 +ミヤコザワ 都沢 +ミヤコザワ 都澤 +ミヤコシ 宮越 +ミヤコシ 宮腰 +ミヤコジ 都地 +ミヤゴシ 宮越 +ミヤゴシ 宮腰 +ミヤコジマ 都島(都嶋) +ミヤコシヤ 宮腰屋 +ミヤコダ 京田 +ミヤコダ 都田 +ミヤコダニ 都谷 +ミヤコフジ 都冨士 +ミヤコマツ 都松 +ミヤサ 宮佐 +ミヤサ 宮狭(宮狹) +ミヤザ 宮座 +ミヤサカ 宮坂 +ミヤサカ 宮阪 +ミヤサカ 宮堺 +ミヤザカ 宮坂 +ミヤザカイ 宮堺 +ミヤサキ 宮崎 +ミヤサキ 宮前 +ミヤサキ 宮嵜 +ミヤサキ 宮先 +ミヤサキ 宮咲 +ミヤザキ 宮崎 +ミヤザキ 宮前 +ミヤザキ 宮嵜 +ミヤザキ 宮碕 +ミヤザキ 宮咲 +ミヤザキ 宮埼 +ミヤサク 宮作 +ミヤサコ 宮迫 +ミヤサコ 宮廻(宮𢌞) +ミヤサコ 宮回 +ミヤサコ 宮佐古 +ミヤサコ 宮追 +ミヤサコ 宮逧 +ミヤサコ 宮廽 +ミヤザコ 宮迫 +ミヤザコ 宮廻(宮𢌞) +ミヤサダ 宮定 +ミヤサト 宮里 +ミヤサト 宮郷 +ミヤザト 宮里 +ミヤザト 宮郷 +ミヤサワ 宮沢 +ミヤサワ 宮澤 +ミヤザワ 宮沢 +ミヤザワ 宮澤 +ミヤザワ 三谷沢 +ミヤザワ 三谷澤 +ミヤシ 宮司 +ミヤシ 宮子 +ミヤシ 宮仕 +ミヤシ 宮師 +ミヤシ 宮士 +ミヤジ 宮地 +ミヤジ 宮路 +ミヤジ 宮治 +ミヤジ 宮司 +ミヤジ 宮道 +ミヤジ 宮次 +ミヤジ 宮仕 +ミヤジ 宮字 +ミヤジ 宮冶 +ミヤシカ 宮鹿 +ミヤジキ 宮食 +ミヤシゲ 宮重 +ミヤシゲ 宮繁 +ミヤシタ 宮下 +ミヤシナ 宮階 +ミヤシバ 宮芝 +ミヤシマ 宮島 +ミヤシマ 宮嶋 +ミヤジマ 宮島 +ミヤジマ 宮嶋 +ミヤジマ 美谷島 +ミヤジマ 宮嶌 +ミヤジマ 三矢島 +ミヤジュ 宮寿(宮壽) +ミヤショウ 宮庄 +ミヤショウ 宮正 +ミヤジョウ 宮城 +ミヤジョウ 宮条 +ミヤジョウ 宮條 +ミヤジリ 宮後 +ミヤジリ 宮尻 +ミヤシロ 宮城 +ミヤシロ 宮代 +ミヤシロ 都城 +ミヤシン 宮新 +ミヤス 美安 +ミヤス 三安 +ミヤス 宮洲 +ミヤズ 宮津 +ミヤスエ 宮末 +ミヤスガ 宮管 +ミヤズカ 宮塚 +ミヤスギ 宮杉 +ミヤズミ 宮住 +ミヤズミ 宮澄 +ミヤズミ 宮隅 +ミヤセ 宮瀬 +ミヤセ 宮清 +ミヤセ 宮畝 +ミヤゼキ 宮関 +ミヤセコ 宮世古 +ミヤソウ 宮宗 +ミヤゾエ 宮副 +ミヤゾエ 宮添 +ミヤゾエ 美谷添 +ミヤソネ 宮曽根 +ミヤソノ 宮園 +ミヤソノ 宮薗 +ミヤソノ 宮囿 +ミヤソノ 宮苑 +ミヤゾノ 宮園 +ミヤゾノ 宮薗 +ミヤゾノ 宮囿 +ミヤタ 宮田 +ミヤタ 都田 +ミヤタ 宮多 +ミヤタ 三屋田 +ミヤタ 三矢田 +ミヤダ 宮田 +ミヤダ 宮多 +ミヤダイ 宮代 +ミヤダイ 宮台 +ミヤダイ 宮臺 +ミヤダイ 宮谷台 +ミヤダイラ 宮平 +ミヤタカ 宮高 +ミヤタキ 宮滝 +ミヤタキ 宮瀧 +ミヤタケ 宮武 +ミヤタケ 宮竹 +ミヤタチ 宮達 +ミヤタツ 宮達 +ミヤダテ 宮館 +ミヤダテ 宮舘 +ミヤダテ 宮立 +ミヤタニ 宮谷 +ミヤタニ 宮渓 +ミヤダニ 宮谷 +ミヤタニウチ 宮谷内 +ミヤチ 宮地 +ミヤチ 宮池 +ミヤチ 宮智 +ミヤヂ 宮地 +ミヤヂ 宮路 +ミヤヂ 宮治 +ミヤチカ 宮近 +ミヤチゴ 宮内後 +ミヤチヨ 宮千代 +ミヤツ 宮津 +ミヤツ 宮都 +ミヤヅ 宮津 +ミヤツカ 宮司 +ミヤツカ 宮塚 +ミヤヅカ 宮塚 +ミヤツカサ 宮司 +ミヤツキ 宮月 +ミヤツグ 宮次 +ミヤツゲ 宮告 +ミヤツジ 宮辻 +ミヤツチ 宮土 +ミヤツボ 宮坪 +ミヤヅメ 宮詰 +ミヤテ 宮手 +ミヤデ 宮出 +ミヤテラ 宮寺 +ミヤデラ 宮寺 +ミヤト 宮戸 +ミヤト 宮登 +ミヤト 宮都 +ミヤド 宮戸 +ミヤド 御宿 +ミヤトウ 宮藤 +ミヤトウ 宮東 +ミヤトウ 宮当 +ミヤトウ 宮當 +ミヤトウ 宮頭 +ミヤドウ 宮道 +ミヤドウ 宮堂 +ミヤトキ 宮時 +ミヤトコ 宮床 +ミヤトコロ 宮所 +ミヤドコロ 宮所 +ミヤトダ 宮戸田 +ミヤトミ 宮富 +ミヤトミ 宮臣 +ミヤトミ 宮冨 +ミヤドメ 宮留 +ミヤトモ 宮智 +ミヤトリ 宮鳥 +ミヤナ 宮奈 +ミヤナ 宮名 +ミヤナカ 宮中 +ミヤナカ 宮仲 +ミヤナガ 宮永 +ミヤナガ 宮良 +ミヤナガ 宮長 +ミヤナギ 三柳 +ミヤナギ 宮凪 +ミヤナギ 美柳 +ミヤナベ 宮鍋 +ミヤナミ 宮南 +ミヤナミ 宮波 +ミヤナリ 宮成 +ミヤナリ 宮名利 +ミヤナル 宮成 +ミヤニシ 宮西 +ミヤヌマ 宮沼 +ミヤネ 宮根 +ミヤノ 宮野 +ミヤノ 宮埜 +ミヤノ 見矢野 +ミヤノ 三谷野 +ミヤノ 宮納 +ミヤノ 宮能 +ミヤノイリ 宮野入 +ミヤノイリ 宮ノ入 +ミヤノウ 宮納 +ミヤノウエ 宮之上 +ミヤノウエ 宮ノ上 +ミヤノウチ 宮之内 +ミヤノウチ 宮野内 +ミヤノウチ 宮ノ内 +ミヤノオ 宮野尾 +ミヤノオ 宮ノ尾 +ミヤノオ 宮之尾 +ミヤノオト 宮野音 +ミヤノガワ 宮野川 +ミヤノキ 宮軒 +ミヤノクビ 宮野首 +ミヤノクビ 宮之首 +ミヤノコシ 宮ノ腰 +ミヤノコシ 宮之腰 +ミヤノサト 宮野里 +ミヤノシタ 宮ノ下 +ミヤノシタ 宮之下 +ミヤノシタ 宮野下 +ミヤノシタ 宮の下 +ミヤノジョウ 宮城 +ミヤノハタ 宮ノ畑 +ミヤノハナ 宮野鼻 +ミヤノハラ 宮之原 +ミヤノハラ 宮ノ原 +ミヤノハラ 宮野原 +ミヤノハラ 宮の原 +ミヤノブ 宮信 +ミヤノマエ 宮之前 +ミヤノマエ 宮ノ前 +ミヤノマエ 宮野前 +ミヤノモト 宮之元 +ミヤノモト 宮之本 +ミヤノモリ 宮野森 +ミヤノヤ 宮野谷 +ミヤノワキ 宮之脇 +ミヤノワキ 宮ノ脇 +ミヤバ 宮葉 +ミヤバ 宮馬 +ミヤバ 宮場 +ミヤバ 宮羽 +ミヤハシ 宮橋 +ミヤバシラ 宮柱 +ミヤハタ 宮畑 +ミヤハタ 宮端 +ミヤハタ 宮幡 +ミヤハタ 宮畠 +ミヤバタ 宮畑 +ミヤバタ 宮端 +ミヤハナ 宮花 +ミヤハナ 宮鼻 +ミヤハマ 宮浜 +ミヤハマ 宮濱 +ミヤバヤシ 宮林 +ミヤハラ 宮原 +ミヤバラ 宮原 +ミヤハラダ 宮原田 +ミヤハル 宮春 +ミヤヒガシ 宮東 +ミヤヒサ 宮久 +ミヤヒラ 宮平 +ミヤヒロ 宮広 +ミヤヒロ 宮廣 +ミヤブ 宮分 +ミヤブ 三薮 +ミヤブ 宮夫 +ミヤブ 三籔 +ミヤブ 三藪 +ミヤフク 宮福 +ミヤフクロ 宮袋 +ミヤブクロ 宮袋 +ミヤフサ 宮房 +ミヤフジ 宮藤 +ミヤフチ 宮渕 +ミヤブチ 宮渕 +ミヤブチ 宮淵 +ミヤブチ 宮縁 +ミヤフネ 宮舟 +ミヤブロ 宮風呂 +ミヤベ 宮部 +ミヤベ 宮辺 +ミヤベ 宮邊 +ミヤベ 宮邉 +ミヤホ 宮保 +ミヤホ 宮穂 +ミヤホ 宮穗 +ミヤボ 宮保 +ミヤボウ 宮坊 +ミヤホラ 宮洞 +ミヤホリ 宮堀 +ミヤボリ 宮堀 +ミヤマ 深山 +ミヤマ 三山 +ミヤマ 宮間 +ミヤマ 美山 +ミヤマ 見山 +ミヤマ 御山 +ミヤマ 実山 +ミヤマ 弥山 +ミヤマ 味山 +ミヤマ 観山 +ミヤマ 宮馬 +ミヤマ 實山 +ミヤマ 宮磨 +ミヤマ 宮麻 +ミヤマ 宮广 +ミヤマ 己山 +ミヤマ 巳山 +ミヤマエ 宮前 +ミヤマキ 宮牧 +ミヤマキ 宮巻 +ミヤマグチ 三山口 +ミヤマサ 宮政 +ミヤマス 宮増 +ミヤマチ 宮町 +ミヤマツ 宮松 +ミヤマル 宮丸 +ミヤマル 三家丸 +ミヤマワリ 宮廻(宮𢌞・宮廽) +ミヤミ 宮三 +ミヤミズ 宮水 +ミヤミチ 宮道 +ミヤミツ 宮光 +ミヤムカイ 宮向 +ミヤムカイ 宮向井 +ミヤムキ 宮向 +ミヤムコ 宮向 +ミヤムネ 宮宗 +ミヤムラ 宮村 +ミヤムレ 宮牟礼(宮牟禮) +ミヤムロ 宮室 +ミヤモチ 宮持 +ミヤモト 宮本 +ミヤモト 宮元 +ミヤモト 三矢本 +ミヤモト 三谷本 +ミヤモト 宮基 +ミヤモト 見屋本 +ミヤモト 都元 +ミヤモリ 宮森 +ミヤモリ 宮守 +ミヤモリ 宮杜 +ミヤモリ 宮盛 +ミヤヤ 宮谷 +ミヤヤ 宮屋 +ミヤヤウチ 宮谷内 +ミヤヤシキ 宮屋敷 +ミヤヤス 宮安 +ミヤヤチ 宮谷内 +ミヤヤナギ 宮柳 +ミヤヤマ 宮山 +ミヤヤマ 三谷山 +ミヤユミ 宮弓 +ミヤヨシ 宮良 +ミヤヨシ 宮吉 +ミヤラ 宮良 +ミヤリ 宮利 +ミヤリョウ 宮領 +ミヤワ 宮輪 +ミヤワキ 宮脇 +ミヤワキ 美谷脇 +ミヤワキ 宮傍 +ミヤワケ 宮分 +ミヤワケ 宮訳 +ミヤワケ 宮譯 +ミヤワダ 宮和田 +ミヤンジョウ 宮城 +ミユキ 幸 +ミユキ 御幸 +ミユキ 三行 +ミユキ 見雪 +ミユキ 三幸 +ミユキ 深雪 +ミユキ 美幸 +ミユキ 美行 +ミユキ 目幸 +ミユミ 見弓 +ミヨ 三代 +ミヨ 御代 +ミヨ 見代 +ミヨイ 明井 +ミヨイ 名井 +ミョウ 明 +ミョウ 名生 +ミヨウ 名生 +ミョウイ 明井 +ミョウイ 名井 +ミョウイ 苗井 +ミョウイ 妙井 +ミョウイ 明意 +ミョウイ 茗井 +ミョウイシ 明石 +ミョウイチ 妙一 +ミョウエイ 明栄 +ミョウエン 明円 +ミョウエン 明圓 +ミョウエン 明園 +ミョウエンゾノ 妙円園 +ミョウエンゾノ 妙円薗 +ミョウエンゾノ 妙圓園 +ミョウエンゾノ 妙圓薗 +ミョウカ 名化 +ミョウガ 明賀 +ミョウガ 明日 +ミョウガ 茗荷 +ミョウガ 名賀 +ミョウガ 冥賀 +ミョウガ 冥加 +ミョウガ 茗加 +ミョウガ 茗茄 +ミョウカイ 明貝 +ミョウカイ 明海 +ミョウカイ 明界 +ミョウガイ 明貝 +ミョウカク 明角 +ミョウカク 名角 +ミョウガサコ 名ケ迫 +ミョウガサコ 茗ケ迫 +ミョウガタニ 茗荷谷 +ミョウガタニ 明ケ谷 +ミョウガタニ 茗ケ谷 +ミョウガダニ 茗荷谷 +ミョウガダニ 茗ケ谷 +ミョウガノ 明鹿野 +ミョウガハラ 茗ケ原 +ミョウガハラ 茗荷原 +ミョウガヤ 妙加谷 +ミョウガヤ 妙賀谷 +ミョウカワ 明川 +ミョウカワ 妙川 +ミョウカン 明官 +ミョウカン 明翫 +ミョウカン 明貫 +ミョウカン 明閑 +ミョウガン 明翫 +ミョウガン 妙願 +ミョウガン 名願 +ミョウキ 妙木 +ミョウギ 名木 +ミョウギ 妙木 +ミョウクウ 明空 +ミョウケイ 明慶 +ミョウケイ 明景 +ミョウケン 妙見 +ミョウケン 明見 +ミョウゲン 明元 +ミョウゲン 妙玄 +ミョウケンザコ 妙見迫 +ミョウケンジ 妙見寺 +ミョウゴ 明後 +ミョウコウ 明光 +ミョウコウイン 明光院 +ミョウコウジ 妙光寺 +ミョウゴジ 妙護寺 +ミョウゴジ 妙護地 +ミョウサキ 明崎 +ミョウザキ 明崎 +ミョウサク 茗作 +ミョウジ 明地 +ミョウジ 明時 +ミョウジ 明事 +ミョウジツ 明実 +ミョウシマ 茗島 +ミョウジマ 妙島 +ミョウシュ 明主 +ミョウショウ 明正 +ミョウショウ 明照 +ミョウショウ 明姓 +ミョウジョウ 明星 +ミョウジョウ 名生 +ミョウジョウ 明城 +ミョウジョウ 明上 +ミョウジョウ 明定 +ミョウジョウ 明浄 +ミョウショウジ 明正寺 +ミョウジョウヤマ 明上山 +ミョウシン 明新 +ミョウシン 明心 +ミョウジン 明神 +ミョウジン 明仁 +ミョウズ 明豆 +ミョウスエ 明末 +ミョウズゾノ 名頭薗 +ミョウセ 明瀬 +ミョウセイ 明星 +ミョウセイ 妙清 +ミョウセキ 明関 +ミョウセタ 妙瀬田 +ミョウセン 明先 +ミョウセン 明仙 +ミョウゼン 明前 +ミョウゼン 明全 +ミョウダ 明田 +ミョウダ 名田 +ミョウダ 妙田 +ミョウダ 茗田 +ミョウダイ 明代 +ミョウダイ 妙代 +ミョウタニ 妙谷 +ミョウチ 明地 +ミョウチ 名智 +ミョウチ 妙智 +ミョウチン 明珍 +ミョウチン 明鎮 +ミョウチン 妙珍 +ミョウチン 明陳 +ミョウチン 明珎 +ミョウツエ 明杖(明仗) +ミョウツゾノ 名頭薗 +ミョウトイシ 夫婦石 +ミョウトイワ 夫婦岩 +ミョウドウ 明道 +ミョウドウ 明堂 +ミョウドウ 名東 +ミョウドウ 明東 +ミョウトク 明徳 +ミョウトク 名徳 +ミョウトゾノ 名頭園 +ミョウトン 明頓 +ミョウナイ 明内 +ミョウネン 明念 +ミョウノ 名野 +ミョウバ 明庭 +ミョウバタケ 明畠 +ミョウハラ 茗原 +ミョウフク 明福 +ミョウブダニ 明歩谷 +ミョウホウジ 明法寺 +ミョウマエ 明前 +ミョウムラ 明村 +ミョウムラ 妙村 +ミョウモト 妙本 +ミョウヨウ 明用 +ミョウヨシ 明吉 +ミョウラク 明楽 +ミョウラク 名楽(名樂) +ミョウラク 明樂 +ミョウリ 明理 +ミョウリュウ 妙立 +ミョウリン 明林 +ミョウリン 妙林 +ミョウレイ 明礼 +ミョウレイ 明禮 +ミョウレン 明連 +ミョウレン 名連 +ミョウワ 明和 +ミヨカワ 三代川 +ミヨカワ 御代川 +ミヨカワ 澪川 +ミヨカワ 見世川 +ミヨカワ 美代川 +ミヨカワ 漂川 +ミヨカワ 御氏川 +ミヨガワ 三代川 +ミヨガワ 美代川 +ミヨキ 三代木 +ミヨキ 妙木 +ミヨキ 三与木 +ミヨキ 味代木 +ミヨキ 三與木 +ミヨク 明空 +ミヨケ 美除 +ミヨケ 明景 +ミヨコ 三横 +ミヨコロ 三横呂 +ミヨザキ 三代崎 +ミヨサワ 三代沢 +ミヨサワ 三代澤 +ミヨシ 三好 +ミヨシ 三吉 +ミヨシ 三次 +ミヨシ 三善 +ミヨシ 三芳 +ミヨシ 三由 +ミヨシ 実吉 +ミヨシ 三膳 +ミヨシ 美好 +ミヨシ 見吉 +ミヨシ 身吉 +ミヨシ 美吉 +ミヨシ 見好 +ミヨシ 三良 +ミヨシ 味吉 +ミヨシ 實吉 +ミヨシ 味好 +ミヨシ 三義 +ミヨシ 三美 +ミヨシ 見義 +ミヨシ 三芦 +ミヨシ 見由 +ミヨシ 三慶 +ミヨシ 実義 +ミヨシ 実善 +ミヨシ 美誉志(美譽志) +ミヨシ 實義 +ミヨシ 實善 +ミヨシダ 美吉田 +ミヨシダ 実好田 +ミヨシダニ 三吉谷 +ミヨシノ 三吉野 +ミヨシノ 三芳野 +ミヨシノ 三好野 +ミヨジマ 妙島 +ミヨシヤ 三吉矢 +ミヨジン 明神 +ミヨスエ 明末 +ミヨセ 明瀬 +ミヨセ 三寄 +ミヨセ 三代瀬 +ミヨセタ 妙瀬田 +ミヨタ 御代田 +ミヨタ 三代田 +ミヨダ 御代田 +ミヨタニ 御代谷 +ミヨチ 三代地 +ミヨツエ 明杖 +ミヨツソノ 名頭薗 +ミヨデ 御代出 +ミヨドリ 美代取 +ミヨノ 三代野 +ミヨハシ 聖代橋 +ミヨハラ 茗原 +ミヨモト 妙本 +ミヨモリ 三代森 +ミヨリ 三縁 +ミヨリ 見寄 +ミラツ 見良津 +ミラヤマ 美良山 +ミランダ 美蘭田 +ミリキタニ 三力谷 +ミリキダニ 三力谷 +ミリン 美淋 +ミリン 美林 +ミル 海松 +ミルシマ 見島 +ミルタニ 看谷 +ミルノ 見ル野 +ミルノ 瞰野 +ミルバヤシ 見林 +ミルマチ 美留町(美畄町) +ミレバ 見連場 +ミロ 美路 +ミロク 弥勒 +ミロク 美録 +ミロク 三録 +ミロク 弥勤 +ミロク 見録 +ミロク 彌勒 +ミロクイン 弥勒院 +ミロクイン 弥勤院 +ミロクジ 弥勒寺 +ミロクジ 弥勒地 +ミロクジ 彌勒寺 +ミロクジ 彌勒地 +ミロツ 見呂津 +ミロツ 美呂津 +ミワ 三輪 +ミワ 三和 +ミワ 美和 +ミワ 三羽 +ミワ 巳波 +ミワ 己波 +ミワ 美輪 +ミワ 三葉 +ミワ 参輪 +ミワ 三輸 +ミワ 神々 +ミワ 釼羽 +ミワウラ 三輪浦 +ミワカ 美若 +ミワカ 味若 +ミワキ 三脇 +ミワキ 三輪木 +ミワケ 三訳 +ミワケ 見分 +ミワケ 三譯 +ミワケイチ 三分一 +ミワタ 三輪田 +ミワタ 三和田 +ミワタ 三綿 +ミワタ 実綿 +ミワタ 美和田 +ミワダ 三輪田 +ミワダ 三和田 +ミワタシ 見渡 +ミワタニ 三輪谷 +ミワタリ 三渡 +ミワデ 三輪出 +ミワノ 三輪野 +ミワハシ 三輪橋 +ミワモト 神元 +ミワヤ 三輪谷 +ミワヤ 三輪屋 +ミワヤマ 三和山 +ミワヤマ 三輪山 +ミンザン 民山 +ミンタ 民田 +ミンダ 民田 +ミンドウ 明東 +ミントク 民徳 +ミンブ 民部 +ミンブタ 民部田 +ミンポウ 民法 +ミンマ 三馬 +ムイ 武井 +ムイ 撫井 +ムイ 無井 +ムイカイチ 六日市 +ムエ 無江 +ムカイ 向井 +ムカイ 向 +ムカイ 迎 +ムカイ 向居 +ムカイ 迎井 +ムカイ 向日 +ムカイ 迎居 +ムカイ 迎伊 +ムカイ 向伊 +ムカイアケト 向明戸 +ムカイアケド 向明戸 +ムカイアゼチ 向畦地 +ムカイイワ 向岩 +ムカイウチ 向内 +ムカイウラ 向浦 +ムカイエ 向江 +ムカイエ 向家 +ムカイオ 向尾 +ムカイオク 向奥 +ムカイオリト 向折戸 +ムカイガイト 向垣内 +ムカイガキ 向垣 +ムカイカキウチ 向垣内 +ムカイガサ 向笠 +ムカイガシラ 向頭 +ムカイカド 向門 +ムカイガミ 向上 +ムカイカワ 向川 +ムカイガワ 向川 +ムカイガワ 迎川 +ムカイカワト 向川戸 +ムカイガワト 向川戸 +ムカイカワラ 向川原 +ムカイガワラ 向川原 +ムカイガワラ 向河原 +ムカイグチ 向口 +ムカイクボ 向久保 +ムカイクボ 向窪 +ムカイゴウチ 向垣内 +ムカイコマギ 向駒木 +ムカイゴメ 向米 +ムカイサカ 向坂 +ムカイサカ 向阪 +ムカイザカ 向坂 +ムカイザカ 向阪 +ムカイザキ 向崎 +ムカイサコ 向迫 +ムカイザコ 向迫 +ムカイサト 迎里 +ムカイザト 迎里 +ムカイザト 向里 +ムカイザワ 向澤 +ムカイジ 向井地 +ムカイジ 向地 +ムカイシキ 向敷 +ムカイシバ 向柴 +ムカイジマ 向島(向嶌) +ムカイジマ 向嶋 +ムカイショ 向所 +ムカイジョ 向所 +ムカイジョ 向井所 +ムカイジョウ 向城 +ムカイジョウ 向条(向條) +ムカイゾノ 向園(向薗) +ムカイダ 向田 +ムカイダ 迎田 +ムカイダ 向井田 +ムカイタイ 向平 +ムカイダイ 向台 +ムカイダイラ 向平 +ムカイタケ 向竹 +ムカイダテ 向舘 +ムカイダテ 向館 +ムカイタニ 向谷 +ムカイタニ 向井谷 +ムカイダニ 向谷 +ムカイチ 向井地 +ムカイチ 向地 +ムカイチ 向市 +ムカイヅ 向津 +ムカイツボ 向坪 +ムカイヅラ 向面 +ムカイヅル 向鶴 +ムカイテ 向手 +ムカイデ 向出 +ムカイデ 向手 +ムカイデ 迎出 +ムカイドウ 向堂 +ムカイトウゲ 向峠 +ムカイドノ 向殿 +ムカイドノ 向井殿 +ムカイナカ 向仲 +ムカイナカ 向井中 +ムカイナカ 向井仲 +ムカイナカ 向中 +ムカイナカノ 向中野 +ムカイナリ 向成 +ムカイナル 向成 +ムカイニシ 向西 +ムカイネ 向根 +ムカイノ 向野 +ムカイノ 迎野 +ムカイノ 向井野 +ムカイノゲ 向野下 +ムカイハシ 向橋 +ムカイバシ 向橋 +ムカイハタ 向畑 +ムカイハタ 向井畑 +ムカイハタケ 向畑 +ムカイバタケ 向畑 +ムカイハマ 向浜 +ムカイハマ 向濱 +ムカイバヤシ 向林 +ムカイハラ 向原 +ムカイハラ 向井原 +ムカイバラ 向原 +ムカイバラ 向井原 +ムカイヒガシ 向東 +ムカイヒラ 向平 +ムカイヒラ 向イ平 +ムカイベ 迎辺 +ムカイボウ 向坊 +ムカイホシバ 向井干場 +ムカイボラ 向洞 +ムカイマチ 迎町 +ムカイミネ 向峯 +ムカイミネ 向峰 +ムカイミヤ 向宮 +ムカイムラ 向村 +ムカイモト 向本 +ムカイモト 向井元 +ムカイヤ 向谷 +ムカイヤ 向家 +ムカイヤシキ 向屋敷 +ムカイヤチ 向谷地 +ムカイヤチ 向谷内 +ムカイヤブ 向薮 +ムカイヤマ 向山 +ムカイヤマ 迎山 +ムカイヤマ 向井山 +ムカイヤマグチ 向山口 +ムカイラ 向井良 +ムカイラ 向良 +ムカウエ 向上 +ムカウラ 向浦 +ムカエ 向 +ムカエ 迎 +ムカエ 向江 +ムカエ 向永 +ムカエ 無替 +ムカエガキ 迎垣 +ムカエガワ 迎川 +ムカエグチ 迎口 +ムカエクボ 向窪 +ムカエクボ 迎窪 +ムカエザト 迎里 +ムカエダ 迎田 +ムカエタニ 向谷 +ムカエダニ 迎谷 +ムカエノ 迎野 +ムカエハタ 迎畑 +ムカエバヤシ 迎林 +ムカエマチ 迎町 +ムカエムラ 向江村 +ムカエヤマ 迎山 +ムカエワキ 向江脇 +ムカオ 向尾 +ムカオク 向奥 +ムカサ 武笠 +ムカサ 向笠 +ムカサ 六笠 +ムカサ 向佐 +ムカサ 穆佐 +ムカセ 向瀬 +ムカダ 向田 +ムカダイ 向台 +ムカタカ 向高 +ムカタケ 向竹 +ムカタケ 武加竹 +ムカタケ 武加武 +ムカツ 向津 +ムカデ 百足 +ムカデヤマ 百足山 +ムカド 六門 +ムカトウゲ 向峠 +ムカナガ 向永 +ムカノ 向野 +ムカノ 向埜 +ムカノ 武鹿野 +ムカバ 行騰 +ムカヒ 向日 +ムカヒラ 向平 +ムカマ 六釜 +ムカムラ 六ケ村 +ムカモト 向本 +ムカヤウチ 向谷内 +ムカヤブ 向薮 +ムカヤブ 向藪 +ムカヤマ 向山 +ムカリ 無雁 +ムカリ 無鳫 +ムカワ 武川 +ムカワ 六川 +ムカワ 務川 +ムカワ 夢川 +ムカワ 無川 +ムカワ 武河 +ムカワキ 向脇 +ムキ 牟岐 +ムギ 麦 +ムギ 牟木 +ムギ 鵡戯 +ムギイ 麦居(麥居) +ムギイ 麦井(麥井) +ムギイシ 麦石 +ムギイシ 麥石 +ムギウダ 麦生田 +ムギウダ 麥生田 +ムギオ 麦生 +ムギオ 麦尾 +ムギオ 麥生 +ムギクラ 麦倉 +ムギクラ 麥倉 +ムギサワ 麦沢 +ムギサワ 麦澤 +ムギサワ 麥沢 +ムギサワ 麥澤 +ムギシマ 麦島 +ムギシマ 麦嶋 +ムギシマ 麥島 +ムギシマ 麥嶋 +ムキタ 向田 +ムキダ 向田 +ムギタ 麦田 +ムギタ 麥田 +ムギタニ 麦谷 +ムギタニ 麥谷 +ムギタリ 麦足 +ムギツカ 麦塚(麥塚) +ムキノ 向野 +ムギノ 麦野(麥野) +ムギバヤシ 麦林 +ムギハラ 麦原 +ムギヒラ 麦平 +ムギフミ 麦踏 +ムギフミ 麥踏 +ムギホ 麦穂 +ムギマ 麦間 +ムギモト 麦本 +ムギモト 麦元 +ムギヤ 麦谷 +ムギヤ 麦屋 +ムギヤ 麥屋 +ムギヤ 麥谷 +ムギヤマ 武儀山 +ムギヤマ 麦山 +ムク 椋 +ムク 鉾久 +ムク 牟久 +ムクイ 椋井 +ムクイ 椋居 +ムクウラ 椋浦 +ムクオ 椋尾 +ムクガイチ 椋開地 +ムクキ 椋木 +ムクギ 椋木 +ムクゲ 椋毛 +ムクゲ 槿 +ムクゲハラ 槿原 +ムクザワ 椋澤 +ムクザワ 椋沢 +ムクシ 六串 +ムクシタ 椋下 +ムクシナ 無垢品 +ムクジュ 椋樹 +ムクゾノ 椋園 +ムクタ 向田 +ムクタ 椋田 +ムクタ 剥田 +ムクダ 椋田 +ムクダ 剥田 +ムクダイ 椋代 +ムグチ 陸口 +ムクナ 椋名 +ムクナシ 椋梨 +ムクノ 向野 +ムクノ 椋野 +ムクノ 椋埜 +ムクノキ 椋木 +ムクノキ 椋 +ムクバヤシ 椋林 +ムクハラ 椋原 +ムクヒラ 椋平 +ムクボウ 椋棒 +ムクミ 六与 +ムクミ 六與 +ムクミ 六興 +ムクムラ 椋村 +ムクメ 椋目 +ムクモト 椋本 +ムクモト 椋元 +ムクヤマ 椋山 +ムグラ 葎 +ムクラグチ 葎口 +ムクラグチ 葏口 +ムクラサコ 葎迫 +ムクラザコ 葎迫 +ムグラジマ 葎嶋(葎島) +ムクリュウ 椋龍 +ムクリュウ 椋立 +ムクリュウ 椋竜 +ムグルマ 六車 +ムクロジ 椋露地 +ムケダ 向田 +ムコ 武庫 +ムコイエ 向家 +ムコイワ 向岩 +ムコウ 向 +ムコウイワ 向岩 +ムコウウチ 向内 +ムコウガイチ 向垣内 +ムコウガキウチ 向垣内 +ムコウガワ 向川 +ムコウギシ 向岸 +ムコウグチ 向口 +ムコウサカ 向坂 +ムコウサカ 向阪 +ムコウザカ 向坂 +ムコウザキ 向崎 +ムコウザト 向里 +ムコウザワ 向沢 +ムコウザワ 向澤 +ムコウジ 向地 +ムコウジ 向日路 +ムコウシタ 向下 +ムコウシバ 向柴 +ムコウシバ 向芝 +ムコウジマ 向島(向嶌) +ムコウジマ 向嶋 +ムコウシミズ 向志水 +ムコウジョウ 向城 +ムコウセ 向瀬 +ムコウゾノ 向囿 +ムコウゾノ 向園(向薗) +ムコウゾン 向囿 +ムコウタ 向田 +ムコウダ 向田 +ムコウダイ 向台 +ムコウタカ 向高 +ムコウダカ 向高 +ムコウタニ 向谷 +ムコウダニ 向谷 +ムコウダン 向段 +ムコウチ 向地 +ムコウチ 向内 +ムコウヅ 向津 +ムコウデ 向出 +ムコウドイ 向土井 +ムコウノ 向野 +ムコウハタ 向畑 +ムコウハタ 向畠 +ムコウバタ 向畑 +ムコウバタ 向畠 +ムコウバヤシ 向林 +ムコウハラ 向原 +ムコウバラ 向原 +ムコウバル 向原 +ムコウヒラ 向平 +ムコウフカサワ 向深沢 +ムコウフカサワ 向深澤 +ムコウフジハラ 向藤原 +ムコウフジワラ 向藤原 +ムコウホリ 向堀 +ムコウボリ 向堀 +ムコウマツ 向松 +ムコウムラ 向村 +ムコウモト 向本 +ムコウモリ 向森 +ムコウヤ 向家 +ムコウヤ 向矢 +ムコウヤス 向保 +ムコウヤチ 向谷内 +ムコウヤブ 向藪 +ムコウヤマ 向山 +ムコウヤマグチ 向山口 +ムコウヨシ 向吉 +ムコウラ 向浦 +ムコエ 向江 +ムコオ 向尾 +ムコオオノ 向大野 +ムコガイチ 向垣内 +ムコガワ 向川 +ムコガワ 武庫川 +ムコグチ 向口 +ムコサカ 向坂 +ムコサカ 向阪 +ムコザワ 向沢 +ムコザワ 向澤 +ムコシタ 向下 +ムコシバ 向柴 +ムコシバ 向芝 +ムコセ 向瀬 +ムコタ 向田 +ムコダ 向田 +ムコタカ 向高 +ムコダカ 向高 +ムコタニ 向谷 +ムコナガ 向永 +ムコネ 向根 +ムコノ 向野 +ムコノセ 向野瀬 +ムコハタ 向畑 +ムコハタ 向畠 +ムコバタ 向畑 +ムコバタ 向畠 +ムコハマ 向浜 +ムコハマ 向濱 +ムコハラ 向原 +ムコヤチ 向谷内 +ムコヤマ 向山 +ムコヤマ 武庫山 +ムコヨシ 向吉 +ムサ 武佐 +ムサ 撫佐 +ムサ 無佐 +ムサカ 六平 +ムサカ 六坂 +ムサキ 六崎(六碕) +ムササ 無笹 +ムサシ 武蔵 +ムサシ 武藏 +ムサシ 武差 +ムサシガワ 武蔵川 +ムサシジマ 武蔵島 +ムサシノ 武蔵野(武藏野) +ムサシハラ 武蔵原 +ムサシマル 武蔵丸 +ムサシヤ 武蔵谷 +ムサシヤ 武蔵屋 +ムザン 無山 +ムシ 蒸 +ムシアキ 虫明 +ムシアキ 蟲明 +ムシアケ 虫明 +ムシアケ 蟲明 +ムシアゲ 虫上 +ムシウ 虫生 +ムシカ 六鹿 +ムシカ 虫賀 +ムシカ 虫鹿 +ムシカ 武鹿 +ムシガ 虫賀 +ムシガ 虫鹿 +ムシカベ 虫壁 +ムシカミ 虫上 +ムシカリ 虫狩 +ムシジマ 虫島 +ムシタニ 虫谷 +ムジナガワ 狢川 +ムジナサワ 狢沢 +ムジナサワ 狢澤 +ムジナザワ 狢澤 +ムシノ 蒸野 +ムシノ 虫野 +ムシベ 虫辺 +ムシベ 虫邉 +ムシモト 虫本 +ムシャ 武者 +ムシャ 武舎 +ムシャ 武捨 +ムシャ 武車 +ムシャコウジ 武者小路 +ムシャノ 武者野 +ムシャノコウジ 武者小路 +ムシュウ 武生 +ムシュウ 無州 +ムシュウ 虫生 +ムショウガヤ 無生ケ谷 +ムシロ 莚 +ムシロイ 莚井 +ムシロダ 莚田 +ムシロヒラ 莚平 +ムジン 無尽(無盡) +ムジン 無神 +ムスビ 結 +ムスビマツ 結松 +ムスミ 六角 +ムスミヤ 六角屋 +ムセキ 無関 +ムソ 武曽 +ムソウ 武曽 +ムソウ 武曾 +ムソウ 無相 +ムソウ 武壮 +ムソガリ 六十苅 +ムソタ 六十田 +ムソタ 六十谷 +ムソタニ 六十谷 +ムソリ 六十里 +ムタ 牟田 +ムタ 無田 +ムタ 俗多 +ムダ 六田 +ムタイ 務台(務臺) +ムタガミ 無田上 +ムタガミ 牟田神 +ムタカミニシ 牟田神西 +ムタガミニシ 牟田神西 +ムタカミヒガシ 牟田神東 +ムタガミヒガシ 牟田神東 +ムタグチ 牟田口 +ムタザキ 牟田崎 +ムタシマ 牟田島 +ムタジマ 牟田島 +ムタソノ 牟田園 +ムタゾノ 牟田園 +ムダタニ 牟田谷 +ムタニ 六谷 +ムタハラ 牟田原 +ムタバル 牟田原 +ムタベ 牟田部 +ムチ 鞭 +ムチキ 鞭木 +ムチナ 無地名 +ムチマ 鞭馬 +ムチメ 鞭目 +ムチャク 無着 +ムチャッカ 無着下 +ムツ 陸 +ムツ 睦 +ムツ 陸奥 +ムツ 六 +ムツイ 六井 +ムツイ 六津井 +ムツイシ 六ツ石 +ムツウラ 六浦 +ムツウラ 陸浦 +ムツウラ 睦浦 +ムツエダ 六枝 +ムツオ 六尾 +ムツオ 六雄 +ムツオカ 六岡 +ムツオカ 武津岡 +ムツガ 六鹿 +ムツカド 陸門 +ムツカド 睦門 +ムツカワ 六川 +ムツカワ 睦川 +ムツガワ 六川 +ムツキ 睦月 +ムヅキ 正月 +ムツグチ 陸口 +ムツグチ 睦口 +ムツクラ 六倉 +ムツグルマ 六車 +ムツサキ 六崎(六碕) +ムツザキ 六崎(六碕) +ムツザキ 六ツ崎 +ムツジ 六辻 +ムツシカ 六鹿 +ムツシマ 睦島 +ムツタ 陸田 +ムツダ 六田 +ムツダ 陸田 +ムツダ 睦田 +ムツダ 陸奥田 +ムツタニ 睦谷 +ムツヅカ 六塚 +ムツナ 六名 +ムツナ 六ツ名 +ムツナガ 陸永 +ムツナガ 睦永 +ムツノ 陸野 +ムツノ 六野 +ムツノ 睦野 +ムツノキ 六軒 +ムツノブ 六信 +ムツマ 六万(六萬) +ムツマタ 睦又 +ムツミ 睦見 +ムツミ 六ツ見 +ムツミネ 六峰(六峯) +ムツムネ 六宗 +ムツムロ 六室 +ムツモリ 六ツ森 +ムツヤク 六ツ役 +ムツヤマ 六山 +ムツヨシ 睦好 +ムツレ 六連 +ムツロ 無津呂 +ムツロ 陸路 +ムテキ 無敵 +ムテキ 武手木 +ムト 武都 +ムト 無徒 +ムトウ 武藤 +ムトウ 無藤 +ムトウ 武東 +ムトウ 六藤 +ムトウ 夢藤 +ムトウ 武籐 +ムトウ 牟藤 +ムドウ 夢道 +ムドウジ 無道寺 +ムトウヤ 武藤谷 +ムトベ 六人部 +ムトベ 六戸部 +ムトリイシ 六人石 +ムナオカ 宗岡 +ムナカ 撫中 +ムナカ 務中 +ムナカ 務仲 +ムナカタ 宗像 +ムナカタ 棟方 +ムナカタ 宗形 +ムナカタ 宗方 +ムナカタ 宗片 +ムナカタ 棟形 +ムナカタ 棟渡 +ムナカタ 胸形 +ムナカタ 宗源 +ムナカネ 宗兼 +ムナモト 宗本 +ムナワタリ 棟渡 +ムネ 宗 +ムネ 棟 +ムネイ 棟居 +ムネイ 宗井 +ムネイシ 宗石 +ムネイシ 棟石 +ムネウチ 宗内 +ムネエダ 宗枝 +ムネオ 棟尾 +ムネオ 宗尾 +ムネオ 棟雄 +ムネオカ 宗岡 +ムネオカ 棟岡 +ムネガキ 宗垣 +ムネカゲ 宗景 +ムネカゲ 棟影 +ムネカズ 宗数 +ムネカタ 宗像 +ムネカタ 棟方 +ムネカタ 宗形 +ムネカタ 宗方 +ムネカタ 宗片 +ムネカタ 棟形 +ムネカタ 胸方 +ムネカタ 崇像 +ムネカド 棟加登 +ムネカネ 宗兼 +ムネカネ 宗金 +ムネカネ 宗包 +ムネカネ 棟兼 +ムネカワ 宗川 +ムネカワ 棟川 +ムネカワ 宗河 +ムネキ 宗木 +ムネキヨ 宗清 +ムネキヨ 棟清 +ムネキョウ 宗京 +ムネグチ 棟口 +ムネクニ 宗国 +ムネクニ 宗國 +ムネグミ 胸組 +ムネコシ 宗越 +ムネサキ 宗崎 +ムネザキ 宗崎 +ムネサダ 宗貞 +ムネサダ 宗定 +ムネサダ 宗佐田 +ムネサト 宗里 +ムネザネ 宗実 +ムネザネ 宗實 +ムネサワ 宗沢 +ムネサワ 宗澤 +ムネザワ 宗沢 +ムネザワ 宗澤 +ムネシゲ 宗重 +ムネシゲ 棟重 +ムネシタ 宗下 +ムネシマ 宗島 +ムネシマ 宗嶋 +ムネジマ 宗島 +ムネジリ 宗尻 +ムネスエ 棟居 +ムネスエ 宗末 +ムネスエ 棟末 +ムネスギ 棟杉 +ムネスケ 宗助 +ムネゾエ 宗添 +ムネタ 宗田 +ムネタ 棟田 +ムネタ 崇田 +ムネダ 宗田 +ムネダ 棟田 +ムネダ 崇田 +ムネダ 旨田 +ムネタカ 宗高 +ムネタカ 棟高 +ムネタカ 宗隆 +ムネタキ 宗滝 +ムネタキ 宗瀧 +ムネタケ 宗武 +ムネタケ 宗竹 +ムネタダ 宗忠 +ムネタニ 宗谷 +ムネチカ 宗近 +ムネチカ 棟近 +ムネヅカ 宗塚 +ムネツグ 宗次 +ムネツグ 宗接 +ムネツグ 宗続 +ムネツグ 宗續 +ムネツナ 宗綱 +ムネト 宗戸 +ムネトウ 宗藤 +ムネトウ 宗東 +ムネトウ 宗籐 +ムネトウ 棟東 +ムネトキ 宗時 +ムネトシ 宗利 +ムネトシ 宗俊 +ムネトシ 宗歳 +ムネトモ 宗友 +ムネトモ 棟朝 +ムネトモ 棟友 +ムネナカ 宗仲 +ムネナカ 宗中 +ムネナガ 宗永 +ムネナガ 胸永 +ムネナガ 棟長 +ムネナガ 宗長 +ムネナガ 棟永 +ムネニシ 宗西 +ムネノ 宗野 +ムネノ 棟野 +ムネノブ 宗信 +ムネノブ 宗延 +ムネノリ 宗則 +ムネハ 棟羽 +ムネハシ 宗橋 +ムネハス 宗蓮 +ムネハタ 宗畑 +ムネハラ 宗原 +ムネハラ 棟原 +ムネヒサ 棟久 +ムネヒサ 宗久 +ムネヒラ 宗平 +ムネヒラ 棟平 +ムネヒロ 宗広 +ムネヒロ 宗廣 +ムネヒロ 棟広 +ムネヒロ 棟廣 +ムネヒロ 胸広 +ムネヒロ 宗弘 +ムネフク 胸福 +ムネフサ 宗房 +ムネフジ 宗藤 +ムネベ 宗部 +ムネマサ 宗政 +ムネマサ 宗正 +ムネマサ 棟政 +ムネマツ 宗松 +ムネミツ 宗光 +ムネミヤ 宗宮 +ムネムラ 宗村 +ムネモト 宗本 +ムネモト 胸元 +ムネモト 宗元 +ムネモト 棟本 +ムネモト 棟元 +ムネモリ 宗森 +ムネモリ 宗盛 +ムネモリ 宗守 +ムネモリ 棟森 +ムネモリ 旨森 +ムネヤス 宗安 +ムネヤス 棟安 +ムネヤス 宗保 +ムネヤス 棟保 +ムネヤマ 宗山 +ムネヤマ 旨山 +ムネヤマ 棟山 +ムネヤマ 心山 +ムネユキ 宗行 +ムネユキ 宗雪 +ムネユキ 旨行 +ムネヨシ 宗吉 +ムネヨシ 宗好 +ムノ 武野 +ムハンマド 無半麻土 +ムブチ 武渕 +ムマイ 六厩 +ムマヤ 六厩 +ムモ 武茂 +ムヤ 撫養 +ムヤマ 六山 +ムヤリ 六鎗 +ムラ 村 +ムラ 武良 +ムラ 邑 +ムラ 無良 +ムラアイ 村合 +ムラアト 村跡 +ムライ 村井 +ムライ 村居 +ムライ 村家 +ムライ 邑井 +ムライ 邨井 +ムライ 武良井 +ムライ 邨居 +ムライエ 村家 +ムライケ 村池 +ムライシ 村石 +ムライシ 邑石 +ムライズミ 村泉 +ムライソ 村磯 +ムライソ 村礒 +ムライタ 村井田 +ムライダ 村井田 +ムライチ 村市 +ムラウチ 村内 +ムラウチ 六楽内 +ムラウラ 村浦 +ムラエ 村江 +ムラエ 村栄(村榮) +ムラエ 村恵(村惠) +ムラエイ 村永 +ムラエダ 村枝 +ムラオ 村尾 +ムラオ 村生 +ムラオ 村防 +ムラオ 邨生 +ムラオ 村往 +ムラオ 村雄 +ムラオ 邑尾 +ムラオ 邨尾 +ムラオカ 村岡 +ムラオカ 邑岡 +ムラオク 村奥 +ムラオサ 村長 +ムラオロシ 村卸 +ムラカ 村家 +ムラカ 村加 +ムラガ 村賀 +ムラガキ 村垣 +ムラガキウチ 村垣内 +ムラカク 村角 +ムラカゲ 村陰 +ムラカシ 村樫 +ムラカジ 村梶 +ムラカタ 村形 +ムラカタ 村方 +ムラカタ 村片 +ムラカタ 村賀多 +ムラガタ 村形 +ムラカド 村角 +ムラカド 村門 +ムラカネ 村兼 +ムラカネ 村金 +ムラカミ 村上 +ムラカミ 邑上 +ムラカミ 邨上 +ムラカミ 村神 +ムラカミ 村頭 +ムラカミ 邑神 +ムラカメ 村亀 +ムラカワ 村川 +ムラカワ 村河 +ムラカワ 邑川 +ムラカワ 邨川 +ムラガワ 村側 +ムラキ 村木 +ムラキ 村城 +ムラキ 邑木 +ムラギ 村儀 +ムラキシ 村岸 +ムラギシ 村岸 +ムラキタ 村北 +ムラギミ 村君 +ムラキヨ 村清 +ムラクキ 村久木 +ムラクギ 村釘 +ムラクシ 村串 +ムラクシ 村櫛 +ムラグシ 村串 +ムラクチ 村口 +ムラグチ 村口 +ムラグチ 邑口 +ムラクニ 村国 +ムラクニ 村國 +ムラクボ 村久保 +ムラクモ 村雲 +ムラゲ 村外 +ムラコ 村古 +ムラコ 村子 +ムラコシ 村越 +ムラコシ 村輿 +ムラコソ 村社 +ムラコソ 村杜 +ムラサ 村佐 +ムラサイ 村斎 +ムラサイ 村斉 +ムラサカ 村坂 +ムラサカ 村阪 +ムラサキ 村崎 +ムラサキ 紫 +ムラサキ 邑崎 +ムラサキ 村先 +ムラサキ 村嵜 +ムラサキ 村岬 +ムラザキ 村崎 +ムラサキノ 紫野 +ムラサキヤ 紫屋 +ムラサコ 村迫 +ムラサコ 村﨏 +ムラサコ 村廻 +ムラサシ 村刺 +ムラサト 村里 +ムラザト 村里 +ムラザネ 村実 +ムラザネ 村實 +ムラサメ 村雨 +ムラサヤ 村鞘 +ムラサワ 村沢 +ムラサワ 村澤 +ムラサワ 邑沢 +ムラサワ 邨沢(邨澤) +ムラザワ 村沢 +ムラザワ 村澤 +ムラザワ 邑澤 +ムラシ 村司 +ムラジ 村地 +ムラジ 連 +ムラジ 村治 +ムラジ 村司 +ムラジ 村路 +ムラシキ 村敷 +ムラシゲ 村重 +ムラシゲ 村繁 +ムラシゲ 村蕃 +ムラシタ 村下 +ムラシマ 村島 +ムラシマ 村嶋 +ムラシマ 村嶌 +ムラシマ 邨島 +ムラシモ 村下 +ムラシモ 村霜 +ムラジュ 村寿 +ムラジュ 村壽 +ムラジリ 村尻 +ムラシロ 村城 +ムラシン 村新 +ムラスエ 村末 +ムラスギ 村杉 +ムラスギ 村椙 +ムラススム 村勧 +ムラスミ 村角 +ムラスミ 村住 +ムラズミ 村角 +ムラズミ 村住 +ムラセ 村瀬 +ムラセ 邨瀬 +ムラセ 邑瀬 +ムラセ 村勢 +ムラセキ 村関 +ムラゼキ 村関 +ムラソエ 村添 +ムラゾエ 村添 +ムラソト 村外 +ムラタ 村田 +ムラタ 邑田 +ムラタ 邨田 +ムラタ 村太 +ムラタ 村多 +ムラタ 睦良田 +ムラダ 村田 +ムラダイ 村大 +ムラタカ 村高 +ムラタキ 村滝 +ムラタキ 村瀧 +ムラタケ 村竹 +ムラタケ 村武 +ムラダテ 村館 +ムラダテ 村舘 +ムラタニ 村谷 +ムラタヤ 村田谷 +ムラチ 村地 +ムラチ 村知 +ムラチ 村池 +ムラチ 邑地 +ムラツ 村津 +ムラツ 邑津 +ムラツカ 村塚 +ムラツギ 村次 +ムラツグ 村次 +ムラツグ 邨次 +ムラツジ 村辻 +ムラツチ 村土 +ムラツバキ 村椿 +ムラヅメ 村詰 +ムラテ 村手 +ムラデ 村出 +ムラト 村戸 +ムラトウ 村藤 +ムラトウ 村東 +ムラトチ 村栃 +ムラトミ 村富 +ムラトミ 村冨 +ムラトメ 村留 +ムラドメ 村留 +ムラトモ 村友 +ムラトリ 村鳥 +ムラトリ 村取 +ムラナ 村奈 +ムラナ 村名 +ムラナカ 村中 +ムラナカ 村仲 +ムラナカ 邑中 +ムラナカ 村奈嘉 +ムラナカ 邨中 +ムラナガ 村永 +ムラナガ 村長 +ムラナカタ 村中田 +ムラナカダ 村中田 +ムラナミ 村並 +ムラナミ 村波 +ムラナミ 村浪 +ムラナミ 邑並 +ムラニシ 村西 +ムラヌキ 村貫 +ムラヌシ 村主 +ムラノ 村野 +ムラノ 村埜 +ムラノ 邑野 +ムラノ 邨野 +ムラノイ 村野井 +ムラノブ 村信 +ムラバ 村場 +ムラハシ 村橋 +ムラハシ 村端 +ムラハシ 邑橋 +ムラハシ 村槁 +ムラハシ 邨橋 +ムラハタ 村端 +ムラハタ 村畑 +ムラハタ 村畠 +ムラハタ 村蕃 +ムラバタ 村端 +ムラハナ 村端 +ムラハナ 村花 +ムラハマ 村浜 +ムラハマ 村濱 +ムラバヤシ 村林 +ムラバヤシ 邑林 +ムラハラ 村原 +ムラヒガシ 村東 +ムラヒラ 村平 +ムラフク 村福 +ムラフジ 村藤 +ムラフト 村太 +ムラベ 村部 +ムラベ 村辺(村邉) +ムラベ 村邊 +ムラホ 村穂 +ムラホカ 村外 +ムラホリ 村堀 +ムラマ 村間 +ムラマ 村馬 +ムラマエ 村前 +ムラマキ 村牧 +ムラマキ 村蒔 +ムラマキ 村槙 +ムラマキ 村槇 +ムラマサ 村正 +ムラマサ 村政 +ムラマス 村益 +ムラマツ 村松 +ムラマツ 邑松 +ムラマツ 邨松 +ムラマツ 村枩 +ムラマル 村丸 +ムラマン 村万 +ムラミ 村見 +ムラミチ 村道 +ムラミツ 村光 +ムラミヤ 村宮 +ムラモチ 村持 +ムラモト 村本 +ムラモト 村元 +ムラモト 邑本 +ムラモト 邑元 +ムラモト 邑十 +ムラモリ 村守 +ムラモリ 村森 +ムラヤ 村谷 +ムラヤ 村屋 +ムラヤ 邨谷 +ムラヤ 村矢 +ムラヤス 村安 +ムラヤス 紫安 +ムラヤマ 村山 +ムラヤマ 邨山 +ムラヤマ 邑山 +ムラヤマ 群山 +ムラヤマ 𨛗山 +ムラユウ 村勇 +ムラユキ 村行 +ムラヨシ 村吉 +ムラヨセ 村寄 +ムラワ 村和 +ムラワカ 村若 +ムラワキ 村脇 +ムラワキ 邑脇 +ムリョウ 無量 +ムリョウイ 無量井 +ムリョウエ 無量江 +ムリョウコウジ 無量小路 +ムリョウザキ 無量崎 +ムリョウバヤシ 無量林 +ムリョウヤ 無量谷 +ムルイ 武類 +ムルイ 武留井 +ムルイ 無類 +ムルイ 無類井 +ムルイ 無留井(無畄井) +ムレ 牟礼 +ムレ 牟禮 +ムレ 武連 +ムレ 群 +ムレイ 牟礼 +ムレイ 牟禮 +ムレイ 群居 +ムレタ 群田 +ムロ 室 +ムロ 武呂 +ムロ 無漏 +ムロイ 室井 +ムロイエ 室家 +ムロイシ 室石 +ムロイチ 室市 +ムロイワ 室岩 +ムロウ 室生 +ムロウチ 室内 +ムロウメ 室梅 +ムロウラ 室浦 +ムロエ 室江 +ムロオ 室尾 +ムロオカ 室岡 +ムロカ 室加 +ムロガ 室賀 +ムロガ 室加 +ムロガ 室我 +ムロガイト 室垣内 +ムロガキ 室垣 +ムロカサ 室笠 +ムロカド 室門 +ムロカミ 室上 +ムロガミ 室上 +ムロカワ 室川 +ムロカワ 室河 +ムロキ 室木 +ムロキ 榁木 +ムロキ 室城 +ムロキタ 室北 +ムログチ 室口 +ムロクボ 室久保 +ムロコシ 室越 +ムロコシ 室腰 +ムロサカ 室坂 +ムロサキ 室崎 +ムロザキ 室崎 +ムロサク 室作 +ムロサワ 室沢 +ムロサワ 室澤 +ムロザワ 室澤 +ムロシ 室志 +ムロジ 室寺 +ムロシゲ 室重 +ムロシゲ 室茂 +ムロシタ 室下 +ムロシマ 室島 +ムロズカ 室塚 +ムロスギ 室杉 +ムロズミ 室住 +ムロズミ 室積 +ムロズミ 室角 +ムロズミ 室澄 +ムロセ 室瀬 +ムロセ 室生 +ムロソノ 室園 +ムロゾノ 室園 +ムロゾノ 室薗 +ムロタ 室田 +ムロタ 榁田 +ムロタ 六呂田 +ムロタ 無漏田 +ムロダ 室田 +ムロタカ 室高 +ムロタケ 室武 +ムロタツ 室達 +ムロタツ 室辰 +ムロダテ 室館 +ムロダテ 室舘 +ムロタニ 室谷 +ムロタニ 室渓(室溪) +ムロチ 室地 +ムロツ 室津 +ムロツカ 室塚 +ムロヅカ 室塚 +ムロツキ 室月 +ムロヅキ 室月 +ムロツネ 室常 +ムロヅミ 室積 +ムロト 室戸 +ムロト 室人 +ムロドノ 室殿 +ムロトミ 室富 +ムロトミ 室臣 +ムロトミ 室冨 +ムロトメ 室留 +ムロナカ 室中 +ムロナガ 室永 +ムロナガ 室長 +ムロナダ 室洋 +ムロナミ 室波 +ムロネ 室根 +ムロノ 室野 +ムロノイ 室野井 +ムロノソノ 室之園 +ムロノソノ 室ノ園 +ムロハシ 室橋 +ムロハタ 室端 +ムロハタ 室畑 +ムロハマ 室浜 +ムロハマ 室濱 +ムロバヤシ 室林 +ムロハラ 室原 +ムロヒサ 室久 +ムロブ 室賦 +ムロフシ 室伏 +ムロフシ 室節 +ムロブシ 室伏 +ムロブセ 室伏 +ムロホシ 室星 +ムロボシ 室星 +ムロマエ 室前 +ムロマキ 室巻 +ムロマチ 室町 +ムロマツ 室松 +ムロミ 室見 +ムロミズ 室水 +ムロミネ 室峰 +ムロミネ 室峯 +ムロミヤ 室宮 +ムロムラ 室村 +ムロモト 室本 +ムロモト 室元 +ムロモト 榁本 +ムロヤ 室谷 +ムロヤ 室屋 +ムロヤ 室矢 +ムロヤ 室家 +ムロヤ 無量谷 +ムロヤ 室弥 +ムロヤス 室安 +ムロヤチ 室谷内 +ムロヤマ 室山 +ムロワキ 室脇 +メアラシ 明嵐 +メイ 目井 +メイ 免井 +メイ 茗井 +メイアラシ 明嵐 +メイアン 明暗 +メイイ 明井 +メイオ 命尾 +メイガ 明賀 +メイカイ 明界 +メイカク 明角 +メイガク 明学 +メイカタ 銘形 +メイガタ 銘形 +メイカリ 銘苅 +メイキ 名木 +メイキ 明木 +メイキ 明生 +メイキ 茗木 +メイギ 名木 +メイキアン 明木庵 +メイキョウ 名鏡 +メイケ 女池 +メイケイ 明景 +メイゲツ 名月 +メイゲツイン 明月院 +メイケン 銘釼 +メイケン 名剣 +メイケン 銘剣 +メイゴ 明午 +メイサイチ 明才地 +メイサキ 明崎 +メイサク 明作 +メイジ 明治 +メイジ 明路 +メイジ 明字 +メイジュ 明受 +メイシュウ 明周 +メイシュウ 明刕 +メイシュウ 明劦 +メイショ 名所 +メイショウ 明正 +メイジョウ 名城 +メイジョウ 明城 +メイジン 明神 +メイセ 明瀬 +メイセキ 明石 +メイセキ 明関 +メイダ 明田 +メイダ 銘田 +メイチ 明智 +メイチ 明地 +メイチ 明知 +メイチョウ 命長 +メイチン 明珍 +メイチン 明珎 +メイツゾノ 名頭園 +メイト 明登 +メイトク 明徳 +メイトマ 命苫 +メイナ 明名 +メイニン 明仁 +メイバコ 明箱 +メイハラ 姪原 +メイフ 命婦 +メイフク 明福 +メイラク 明楽 +メイラク 明樂 +メイリ 明利 +メイワ 明和 +メウチ 明地 +メウツリ 目移 +メウラ 和布浦 +メウラ 女浦 +メオ 名生 +メオ 明尾 +メオ 目尾 +メオウ 目王 +メオトイケ 女夫池 +メオトイワ 夫婦岩 +メオトギ 目乙木 +メオトスギ 娚杉 +メオトゾノ 名頭薗 +メガ 妻鹿 +メガ 女鹿 +メガ 目賀 +メガ 目叶 +メガ 女賀 +メガ 雌鹿 +メカグチ 女鹿口 +メガグチ 女鹿口 +メガサワ 女ケ沢 +メガサワ 女ケ澤 +メカタ 目片 +メカタ 目加田 +メカタ 米加田 +メカタ 女鹿田 +メカタ 目方 +メカタ 米ケ田 +メカタ 目堅 +メカタ 目形 +メカタ 目加多 +メカダ 目加田 +メカダ 女鹿田 +メガタ 米加田 +メガタ 目賀田 +メガタ 目形 +メガタ 米賀多 +メガタ 芽形 +メガタ 米賀田 +メガタ 目賀多 +メガタ 目賀夛 +メガダテ 女鹿館 +メガダテ 女鹿舘 +メガタニ 目ケ谷 +メガネ 目鏡 +メガノ 目叶 +メガノ 女鹿野 +メガマ 目釜 +メカリ 銘苅 +メカル 銘苅 +メカル 銘刈 +メカワ 女川 +メカワ 目川 +メガワ 女川 +メガワ 目川 +メキ 目木 +メキ 女木 +メキ 芽木 +メギ 目木 +メギ 女木 +メギ 芽木 +メグシ 目串 +メグス 目楠 +メクタ 目久田 +メクチ 馬久地 +メクボ 目久保 +メグミ 恵 +メグミ 惠 +メグミ 恵見(惠見) +メグミ 目久美 +メグミ 恩 +メグミ 芽組 +メグラ 目倉 +メグリ 廻 +メグリ 巡 +メグリ 迴 +メグリオ 廻尾 +メグリカミ 廻神(𢌞神) +メグリガミ 廻神(𢌞神) +メグリキ 回木 +メグリダ 巡田 +メグリヤ 廻谷 +メグリヤ 回谷 +メグリヤ 𢌞谷 +メグリヤ 廻矢 +メグリヤ 迴矢 +メグリヤ 廽谷 +メグロ 目黒 +メクワ 目桑 +メゴ 目後 +メコチ 免古地 +メサカ 目坂 +メサカ 目阪 +メサキ 目崎 +メサキ 目嵜 +メザキ 目崎 +メザキ 眼崎 +メサク 目迫 +メサク 目佐久 +メサク 目廹 +メサシ 目差 +メザシ 目差 +メサワ 女澤 +メザワ 目沢 +メザワ 女沢 +メザワ 目澤 +メザワ 女澤 +メザン 免山 +メシ 飯 +メシアイ 飯合 +メシイ 飯井 +メシカワ 飯川 +メシコ 召古 +メシダ 召田 +メシチ 目七 +メシヅカ 飯塚 +メシノ 飯野 +メシノ 食野 +メシマ 目島 +メジマ 目島 +メシモト 召本 +メシロ 真栄城 +メジロ 目代 +メジロ 目伯 +メスギ 目杉 +メズキ 売豆紀 +メズキ 賣豆紀 +メスダ 召田 +メスダ 目須田 +メズラシ 珍 +メセ 目瀬 +メセキ 目関 +メタ 米田 +メタ 目田 +メダイ 目代 +メタカ 目高 +メタカ 目鷹 +メダカ 目高 +メタキ 女滝 +メタキ 女瀧 +メタニ 目谷 +メタヒ 米多比 +メタビ 米多比 +メチカ 目近 +メツギ 目次 +メヅキ 売豆紀 +メツケ 目附 +メヅラ 目面 +メデ 目出 +メデ 芽出 +メト 目戸 +メド 目戸 +メドウ 目堂 +メトキ 目時 +メドキ 目時 +メトク 目徳 +メドコ 目床 +メトシ 目年 +メトリ 妻鳥 +メトリ 目鳥 +メトリ 目取 +メドリ 妻鳥 +メドリ 雌 +メトリマ 目取真 +メトリマ 目取眞 +メドリマ 目取真 +メトルマ 目取真 +メトルマ 目取眞 +メドルマ 目取真 +メドルマ 目取間 +メドルマ 目取眞 +メナ 目七 +メナ 目名 +メナカ 目仲 +メナガタ 目名形 +メナワ 目縄 +メヌキ 目貫 +メヌキ 目抜 +メヌマ 目沼 +メノ 米野 +メノ 目野 +メノ 芽野 +メノウ 目能 +メハタ 目秦 +メバタ 目幡 +メハラ 目原 +メハル 目春 +メブキ 芽蕗 +メボソ 目細 +メマガリ 目曲 +メミタ 目見田 +メミダ 目見田 +メムラ 芽村 +メメサワ 目々沢 +メメサワ 目々澤 +メメザワ 目々沢 +メメザワ 目々澤 +メメザワ 米々沢 +メメザワ 米々澤 +メメザワ 目目沢 +メメザワ 目目澤 +メモガミ 目面上 +メモト 目本 +メヤ 女屋 +メヤ 目谷 +メヤケ 目宅 +メヤス 目泰 +メヤナギ 女柳 +メヤマ 目山 +メラ 米良 +メラ 目良 +メラ 目羅 +メラ 女良 +メラ 目等 +メラ 布良 +メリ 銘里 +メレン 目連 +メンケ 毛受 +メンサカ 免坂 +メンザワ 面沢 +メンザワ 面澤 +メンジュ 毛受 +メンジュ 免取 +メンジュ 氈受 +メンジョ 毛受 +メンジョウ 毛受 +メンジョウ 校條 +メンジョウ 校条 +メンジョウ 面上 +メンジョウ 面条 +メンジョウ 面條 +メンゾノ 面園 +メンタ 免田 +メンダ 面田 +メンダ 免田 +メンダイ 面代 +メンタキ 免滝 +メンタキ 免瀧 +メンタニ 面谷 +メンテ 面手 +メンテ 免手 +メンデ 免出 +メンデ 面出 +メンデン 免田 +メントリ 妻鳥 +メントリ 免取 +メンドリ 妻鳥 +メンドリ 免取 +メンドリ 女鳥 +メンドリ 免鳥 +メンナミ 面波 +メンノ 面ノ +メンノウ 免農 +メンバタ 面畑 +メンマツ 面松 +メンヤ 面谷 +メンヤ 面家 +メンヤ 面屋 +メンヤ 面矢 +メンヨウ 免養 +メンライ 面来 +モアイ 百合 +モアイ 百相 +モイ 毛井 +モイ 茂居 +モイエ 茂家 +モイシ 茂石 +モイズミ 茂泉 +モイチ 茂市 +モイデ 萠出 +モウイ 毛井 +モウイシ 舞石 +モウウエ 馬上 +モウエ 馬上 +モウギ 舞木 +モウギ 望木 +モウギ 毛木 +モウコ 望戸 +モウサカ 毛阪 +モウシ 孟子 +モウシギ 舞鴫 +モウダ 望陀 +モウタイ 馬渡 +モウチ 毛知 +モウチョウ 毛鳥 +モウヅ 毛津 +モウツキ 望月 +モウヅナ 毛綱 +モウトウ 毛藤 +モウトウ 毛頭 +モウナイ 毛内 +モウノ 毛野 +モウラ 生浦 +モウラ 茂浦 +モウラグチ 茂浦口 +モウリ 毛利 +モウリ 茂利 +モウリ 母利 +モウリ 守利 +モウリ 藻利 +モウリ 模利 +モウリ 毛里 +モウリ 摸利 +モウリモト 毛利元 +モウリョウ 舞良 +モウル 毛留 +モエイ 茂栄 +モエギ 萌黄 +モエクイ 燃杭 +モエダ 毛江田 +モエデ 萠出 +モエデ 萌出 +モエハラ 本前原 +モエワキ 燃脇 +モオリ 毛利 +モオリ 毛織 +モカ 茂家 +モガキ 茂垣 +モガキ 藻垣 +モガタ 藻形 +モカミ 最上 +モガミ 最上 +モガミ 茂上 +モガミ 毛上 +モガミ 最紙 +モガミ 茂神 +モガミガワ 最上川 +モガミダ 最上田 +モガミヤ 最上谷 +モガミヤ 最上屋 +モカリ 茂刈 +モカリ 茂苅 +モガリ 茂刈 +モガリ 茂苅 +モカワ 藻川 +モガワ 茂川 +モガワ 最川 +モガワ 藻川 +モガワ 㝡川 +モキ 茂木 +モキ 毛木 +モギ 茂木 +モギ 望木 +モギ 毛木 +モギ 茂幾 +モギタ 茂木田 +モギタテ 茂木立 +モク 杢 +モク 木工 +モクイ 木井 +モクウチ 杢内 +モクオ 杢尾 +モクオ 杢生 +モクゲ 槿 +モクザワ 木沢 +モクザワ 木澤 +モクシ 茂串 +モクシ 杢師 +モクシ 杢子 +モグシ 茂串 +モグシ 茂櫛 +モクシゲ 杢重 +モクショウ 木匠 +モクゾウ 杢三 +モクタ 杢田 +モクタ 茂久田 +モクダ 杢田 +モクダ 茂久田 +モクダイ 目代 +モクダイ 杢代 +モクダイ 杢大 +モクタニ 杢谷 +モクデ 杢出 +モクナカ 杢中 +モクノ 杢野 +モクノキ 椋 +モクハラ 目原 +モクハラ 杢原 +モクヒト 目等 +モクホ 杢保 +モクボ 杢保 +モクボク 杢木 +モクミ 杢三 +モクメ 杝 +モグモ 百雲 +モクモト 杢本 +モクモト 木工本 +モクモト 杢元 +モクヤ 杢屋 +モクヤス 杢保 +モクレイ 杢例 +モクロ 木露 +モクロジ 木欒子 +モゴエ 茂越 +モゴエ 藻越 +モコデ 茂古沼 +モコヌマ 茂古沼 +モザイ 茂在 +モサカ 毛阪 +モサキ 茂崎 +モザキ 茂崎 +モザワ 茂沢 +モザワ 茂澤 +モジ 門司 +モジ 文字 +モジ 茂治 +モジ 茂地 +モジ 茂司 +モジイ 茂字井 +モシオ 藻塩 +モジカワ 綟川 +モシノ 若野 +モジマ 茂島 +モジマ 茂嶋 +モジマ 藻島 +モジヤマ 茂士山 +モショウ 茂松 +モス 毛洲 +モス 毛須 +モスエ 茂末 +モズエ 茂末 +モズオ 鵙尾 +モズタニ 鵙谷 +モスミ 茂澄 +モズミ 茂住 +モズミ 茂澄 +モズミ 最住(㝡住) +モズメ 茂津目 +モズメ 物集女 +モズメ 物集 +モセ 茂瀬 +モセノ 茂瀬野 +モソロ 茂曽路 +モタ 茂田 +モダ 茂田 +モタイ 甕 +モタイ 罍 +モタイ 茂田井 +モタイ 母袋 +モタイ 罇 +モタイ 茂岱 +モダシ 萠出 +モダシ 萌出 +モタニ 茂谷 +モタニ 毛谷 +モタニ 母谷 +モタニ 藻谷 +モダニ 母谷 +モダニ 望渓(望溪) +モタヤマ 茂田山 +モチ 餅 +モチ 茂地 +モチ 用 +モチ 茂知 +モチ 毛千 +モチ 餠 +モチイ 餅井 +モチイ 持井 +モチイ 用 +モチイ 餠井 +モチイケ 黐池 +モチイシ 持石 +モチイダ 餅井田 +モチオ 持尾 +モチオカ 望岡 +モチオカ 望丘 +モチガキ 持垣 +モチガキ 餅柿 +モチカケ 持掛 +モチガセ 用瀬 +モチカネ 持金 +モチカワ 餅川 +モチカワ 持川 +モチキ 持木 +モチキ 望木 +モチキ 餅木 +モチギ 持木 +モチク 茂筑 +モチク 茂築 +モチクラ 持倉 +モチゴエ 餅越 +モチコシ 餅越 +モチゴメ 餅米 +モチザイ 持麾 +モチザキ 餅崎 +モチザキ 持崎 +モチザワ 用沢(用澤) +モチザワ 持沢 +モチザワ 持澤 +モチザワ 餅沢 +モチジ 持地 +モチジ 持持 +モチシゲ 餅重 +モチシタ 持下 +モチジマ 持島 +モチシロ 持城 +モチスエ 持末 +モチズカ 持塚 +モチズキ 望月 +モチタ 持田 +モチタ 餅田 +モチタ 糯田 +モチダ 持田 +モチダ 餅田 +モチダ 望田 +モチダ 用田 +モチダ 糯田 +モチダ 百千田 +モチダ 餠田 +モチタテ 持舘 +モチタテ 持立 +モチダテ 持舘 +モチダテ 持立 +モチダテ 持館 +モチタニ 餅谷 +モチタニ 持谷 +モチヂ 持地 +モチヅカ 持塚 +モチヅキ 望月 +モチヅキ 持月 +モチヅキ 餅月 +モチヅキ 餅搗 +モチデン 餅田 +モチド 望戸 +モチトク 持徳 +モチトミ 持冨 +モチトミ 持富 +モチドミ 持冨 +モチトメ 持留 +モチドメ 持留 +モチナガ 持永 +モチナガ 望永 +モチナガ 餅永 +モチナガ 持長 +モチニシ 持西 +モチヌシ 持主 +モチヌシ 望主 +モチノ 望野 +モチノ 茂知野 +モチノ 餅野 +モチノベ 持延 +モチノミヤ 餅野宮 +モチバ 持場 +モチハシ 持橋 +モチハシ 持箸 +モチハシ 望橋 +モチハタ 糯畑 +モチバヤシ 持林 +モチハラ 餅原 +モチハラ 持原 +モチハラ 糯原 +モチハラ 餠原 +モチヒラ 持平 +モチブク 茂福 +モチマ 持摩 +モチマス 持増 +モチマツ 用松 +モチマツ 持松 +モチマル 持丸 +モチマル 餅丸 +モチミゾ 持溝 +モチミツ 持光 +モチムラ 持村 +モチモト 持本 +モチモト 持元 +モチヤ 餅谷 +モチヤ 持屋 +モチヤ 茂知矢 +モチヤス 持安 +モチヤマ 持山 +モチヤマ 望山 +モチヤマ 用山 +モチヤマ 餅山 +モチョウ 毛鳥 +モチヨシ 持吉 +モツオ 物応(物應) +モッカ 杢家 +モツカ 茂塚 +モヅカ 茂塚 +モツキ 保木 +モッコウ 木香 +モッコウ 木工 +モツザイ 持麾 +モツジ 持地 +モツジ 万辻 +モッタテ 持舘 +モッタテ 持立 +モッタテ 持館 +モッタテ 持建 +モッテ 物袋 +モヅナ 毛綱 +モヅメ 茂津目 +モデ 茂手 +モテイ 持井 +モテキ 茂木 +モテキ 茂手木 +モテギ 茂木 +モテギ 茂手木 +モテギ 茂出木 +モテギ 𢰝木 +モデキ 茂出木 +モデギ 茂出木 +モテヤマ 茂手山 +モト 本 +モト 元 +モト 茂登 +モト 素 +モト 毛登 +モド 百戸 +モド 茂戸 +モトア 本阿 +モトアキ 本明 +モトアキ 元秋 +モトアキバ 元秋葉 +モトアミ 本網 +モトアミ 元網 +モトアリ 本有 +モトイ 元井 +モトイ 本井 +モトイ 泉井 +モトイ 本居 +モトイ 基 +モトイ 本告 +モトイ 基井 +モトイ 元居 +モトイ 本射 +モトイ 宗意 +モトイ 元位 +モトイ 本伊 +モトイ 本結 +モトイエ 本家 +モトイエ 元家 +モトイキ 元生 +モトイギ 本猪木 +モトイケ 本池 +モトイケ 元生 +モトイケ 元池 +モトイケ 本生 +モトイシ 本石 +モトイシ 元石 +モトイシ 基石 +モトイズミ 本泉 +モトイズミ 元泉 +モトイソ 本磯 +モトイソ 本礒 +モトイチ 本市 +モトイチ 元市 +モトイネ 元稲 +モトイワ 本岩 +モトウ 茂藤 +モトウ 毛藤 +モドウ 茂道 +モトウエ 元上 +モトウエ 元植 +モトウジ 元氏 +モトウス 本臼 +モトウス 元臼 +モトウチ 本内 +モトウチ 元内 +モトウネ 本畝 +モトウメ 本梅 +モトウメ 元梅 +モトウラ 本浦 +モトウラ 元浦 +モトウリ 元売 +モトエ 本江 +モトエ 元永 +モトエ 元栄 +モトエ 元江 +モトエ 基江 +モトエ 求衛 +モトエ 元故 +モトエ 元榮 +モトエ 本枝 +モトエイ 元栄 +モトエビス 元戎 +モトオ 元尾 +モトオ 本尾 +モトオ 元雄 +モトオ 本生 +モトオカ 本岡 +モトオカ 元岡 +モトオカ 基岡 +モトオキ 本沖 +モトオチ 本落 +モトオリ 本吉 +モトオリ 本居 +モトオリ 本告 +モトオリ 本折 +モトオリ 元折 +モトガイト 元垣内 +モトガキ 元垣 +モトカゲ 本影 +モトカシ 本樫 +モトカジ 本梶 +モトカジ 本鍛治 +モトガシ 本樫 +モトカシワ 元柏 +モトカゼ 元風 +モトカタ 元方 +モトカタ 本方 +モトカタヤマ 本片山 +モトカツ 元勝 +モトカド 本門 +モトカネ 元兼 +モトカネ 元金 +モトカネ 本兼 +モトカミ 元上 +モトガミ 本上 +モトガミ 元上 +モトガミ 本神 +モトガミ 元神 +モトガヤ 本萱 +モトカリヤ 本仮屋(本假屋) +モトカワ 本川 +モトカワ 元川 +モトカワ 本河 +モトカワ 元河 +モトガワ 本川 +モトガワラ 本瓦 +モトキ 茂木 +モトキ 元木 +モトキ 本木 +モトキ 本城 +モトキ 根木 +モトキ 元起 +モトキ 元城 +モトキ 端木 +モトキ 本鬼 +モトキ 蘓来 +モトギ 茂木 +モトギ 元木 +モトギ 本木 +モトギ 本儀 +モトキザワ 元木沢 +モトキザワ 元木澤 +モトギシ 本岸 +モトキシタ 本木下 +モトキタ 本北 +モトキミダ 本君田 +モトギモ 本肝 +モトキヨ 本清 +モトクイ 元杭 +モトクギ 本釘 +モトクサノ 本草野 +モトグチ 本口 +モトクチョウ 本九町 +モトクニ 元国 +モトクニ 本国 +モトクニ 元國 +モトクニ 本國 +モトクボ 元久保 +モトクボ 本久保 +モトクボ 本窪 +モトクボタ 本窪田 +モトグミ 本組 +モトクラ 本倉 +モトクラ 本蔵 +モトクラ 元倉 +モトクラ 本藏 +モトグラ 本蔵 +モトグラ 本藏 +モトクルマダ 本車田 +モトコイデ 元小出 +モトゴエ 元越 +モトコシ 本越 +モトコシ 元越 +モトゴシ 本越 +モトゴシ 元越 +モトゴヤ 本古谷 +モトコンヤ 元紺谷 +モトサ 元佐 +モトサ 本佐 +モトザ 元座 +モトサカ 本坂 +モトサカ 元坂 +モトサカ 本阪 +モトサカ 源栄 +モトサカ 元阪 +モトサキ 本崎 +モトサキ 元崎(元嵜) +モトザキ 本崎 +モトザキ 元崎(元嵜) +モトザキ 本嵜 +モトサク 本作 +モトサコ 本迫 +モトサコ 元迫 +モトザコ 本迫 +モトサダ 本貞 +モトサト 本里 +モトザト 本里 +モトザネ 本真 +モトザネ 本眞 +モトサワ 本沢 +モトサワ 本澤 +モトサワ 元沢 +モトサワ 元澤 +モトザワ 本沢 +モトザワ 本澤 +モトザワ 元沢 +モトザワ 元澤 +モトザワ 許沢 +モトジ 本地 +モトジ 元治 +モトジ 元地 +モトジ 泉二 +モトジ 本司 +モトジ 元二 +モトシオ 本塩 +モトシク 本宿 +モトシク 本宿 +モトシゲ 元重 +モトシゲ 本重 +モトシゲ 元茂 +モトシゲ 元繁 +モトシゲ 本繁 +モトシゲ 本茂 +モトシタ 本下 +モトシタ 元下 +モトシマ 本島(本嶌) +モトシマ 元島 +モトシマ 本嶋 +モトシマ 元嶋 +モトジマ 本島(本嶌) +モトジマ 元島 +モトジマ 本嶋 +モトジマ 元嶋 +モトジマ 元嶌 +モトシミズ 元清水 +モトシュク 本宿 +モトジュク 本宿 +モトジュク 元宿 +モトジョウ 元城 +モトショウヤ 元庄矢 +モトシロ 本城 +モトシロミズ 本白水 +モトジン 泉仁 +モトス 本巣 +モトス 元洲 +モトズ 本図 +モトズ 本圖 +モトスエ 本末 +モトスガ 本管 +モトスガ 元管 +モトスガ 元菅 +モトスガ 本菅 +モトズカ 本塚 +モトスギ 本杉 +モトスギ 元杉 +モトスギ 本椙 +モトスケ 元祐 +モトスナ 元砂 +モトスナ 本砂 +モトスネヤ 本強矢 +モトスミ 元住 +モトスミ 本角 +モトズミ 本住 +モトズミ 元住 +モトズミ 本角 +モトズミ 本炭 +モトスワ 本諏訪 +モトセ 本瀬 +モトセ 元生 +モトセ 元妹 +モトセキ 元関 +モトセコ 本迫 +モトセト 本瀬戸 +モトソコ 本底 +モトゾノ 本園 +モトゾノ 本薗 +モトゾノ 元園 +モトダ 本田 +モトダ 元田 +モトダ 許田 +モトダ 基田 +モトダ 始田 +モトダ 元多 +モトダ 元太 +モトダイラ 本平 +モトタカ 本高 +モトダカ 本高 +モトタカヤ 本高屋 +モトタキ 本滝 +モトタキ 本瀧 +モトタケ 本竹 +モトタケ 本武 +モトタケ 元武 +モトダテ 本館 +モトダテ 本舘 +モトタニ 本谷 +モトタニ 元谷 +モトダニ 本谷 +モトダニ 元谷 +モトダネ 本種 +モトタハラ 本田原 +モトタマリ 本溜 +モトダマリ 本溜 +モトチ 本地 +モトチ 藻登知 +モトチカ 本近 +モトチカ 元親 +モトチカ 元近 +モトチカワ 本地川 +モトチガワ 本地川 +モトツ 元津 +モトヅ 元津 +モトツカ 本塚 +モトツカ 元塚 +モトヅカ 本塚 +モトヅカ 元塚 +モトツグ 本告 +モトツグ 元次 +モトツジ 元辻 +モトヅツミ 元堤 +モトツナ 本綱 +モトヅナ 元綱 +モトツネ 本常 +モトツネ 基常 +モトツネ 元恒 +モトツバキ 元椿 +モトデ 本出 +モトデ 本手 +モトデラ 本寺 +モトデラ 元寺 +モトド 本戸 +モトド 元戸 +モトドイ 元土肥 +モトドヒ 元土肥 +モトドミ 本富 +モトナ 元名 +モトナオ 本直 +モトナカ 本中 +モトナカ 元中 +モトナカ 本仲 +モトナカ 元仲 +モトナガ 元永 +モトナガ 本永 +モトナガ 元長 +モトナガ 本長 +モトナガ 基永 +モトナカジマ 本中島 +モトナカノ 本中野 +モトナガレ 元流 +モトナベ 本鍋 +モトナミ 本波 +モトナミ 本並 +モトナミ 本浪 +モトナミ 元波 +モトナリ 元成 +モトナリ 本成 +モトニ 元二 +モトニ 本仁 +モトニシ 本西 +モトニシ 元西 +モトヌキ 元抜 +モトヌシ 元主 +モトネ 元根 +モトノ 本野 +モトノ 元野 +モトノ 求野 +モトノ 基野 +モトノキ 元野木 +モトノブ 本信 +モトノブ 元信 +モトノブ 本延 +モトノミ 元呑 +モトバ 元場 +モトバ 本葉 +モトハギ 本萩 +モトハシ 本橋 +モトハシ 元橋 +モトハシ 本槁 +モトハセ 本長谷 +モトハタ 本幡 +モトハタ 本畑 +モトハタ 元畑 +モトバタ 本畑 +モトハタケナカ 本畠中 +モトハナ 元花 +モトババ 本馬場 +モトハマ 元浜(元濱) +モトハマ 本浜 +モトハマ 本濱 +モトバヤシ 本林 +モトバヤシ 元林 +モトハラ 本原 +モトハラ 元原 +モトハラ 求原 +モトハリ 本針 +モトハル 元春 +モトハル 本春 +モトヒ 元樋 +モトヒ 本日 +モトヒガシ 本東 +モトヒコ 本彦 +モトヒサ 本久 +モトヒサ 元久 +モトヒダ 元日田 +モトヒダ 本比田 +モトヒダ 元飛騨 +モトヒデ 本秀 +モトヒラ 元平 +モトヒラ 本平 +モトヒラ 原平 +モトヒロ 元広 +モトヒロ 本広 +モトヒロ 元廣 +モトヒロ 本廣 +モトヒロ 本弘 +モトブ 本部 +モトブ 本袋 +モトフク 本福 +モトフサ 本房 +モトフサ 元房 +モトフジ 本藤 +モトフジ 元藤 +モトフジ 茂戸藤 +モトブチ 元渕 +モトブチ 本渕 +モトブチ 元淵 +モトブチ 本淵 +モトフツカイチ 本二日市 +モトフナサカ 本舩坂(本船坂) +モトフネ 元船 +モトフロ 元風呂 +モトブロ 元風呂 +モトベ 本部 +モトベ 元部 +モトボウ 本坊 +モトボウ 本房 +モトホシオ 本干尾 +モトホリ 本堀 +モトホリ 元堀 +モトホリ 本掘 +モトマエ 本前 +モトマサ 本政 +モトマサ 元正 +モトマチ 本町 +モトマチ 元町 +モトマツ 本松 +モトマツ 元松 +モトマル 元丸 +モトミ 本見 +モトミ 元見 +モトミ 本海 +モトミズ 元水 +モトミズ 本水 +モトミチ 元道 +モトミツ 元満 +モトミツ 本光 +モトミツ 元光 +モトミツ 本満 +モトミナミ 本南 +モトミネ 元峯 +モトミネ 本峯 +モトミヤ 本宮 +モトミヤ 元宮 +モトミヤ 許宮 +モトミヤ 源宮 +モトミヤ 茂都宮 +モトムネ 元宗 +モトムラ 本村 +モトムラ 元村 +モトムラ 基村 +モトムラ 本邑 +モトムラ 許村 +モトムラ 本邨 +モトムロ 本室 +モトメ 本目 +モトメ 求 +モトメ 求馬 +モトメ 元目 +モトモチ 元持 +モトモチ 本持 +モトモリ 本森 +モトモリ 元森 +モトモリ 本守 +モトモリ 本盛 +モトモリ 元盛 +モトモリ 基森 +モトヤ 本谷 +モトヤ 元谷 +モトヤ 元家 +モトヤ 元矢 +モトヤ 本屋 +モトヤ 元屋 +モトヤ 本矢 +モトヤウチ 本谷内 +モトヤジ 元屋地 +モトヤシキ 本屋敷 +モトヤシキ 元屋敷 +モトヤス 本保 +モトヤス 元安 +モトヤス 本安 +モトヤス 本康 +モトヤス 許安 +モトヤチ 本谷内 +モトヤチ 元谷内 +モトヤナギ 本柳 +モトヤナギ 元柳 +モトヤブ 元籔 +モトヤブ 元薮 +モトヤブ 元藪 +モトヤマ 本山 +モトヤマ 元山 +モトヤマ 完山 +モトヤマ 許山 +モトヤマ 基山 +モトヤマ 毛登山 +モトヤマ 苞山 +モトヤマ 固山 +モトヤマ 茂登山 +モトヤマ 素山 +モトヤマサキ 本山崎 +モトユイ 元結 +モトユキ 元行 +モトヨコヤマ 本横山 +モトヨシ 本吉 +モトヨシ 元吉 +モトヨシ 元良 +モトヨシ 本好 +モトヨシ 元芳 +モトヨシ 元由 +モトヨシ 本良 +モトヨシ 元好 +モトヨシ 本芳 +モトヨシ 本由 +モトヨシ 本葭 +モトヨシハラ 本吉原 +モトヨシヤ 本吉谷 +モトラ 元良 +モトリ 元利 +モトリ 茂登利 +モトリ 毛登利 +モトロク 本禄 +モトワ 本羽 +モトワカ 本若 +モトワキ 元脇 +モトワキ 本脇 +モトワキ 元和木 +モナイ 毛内 +モナカ 茂中 +モニシ 海西 +モニワ 茂庭 +モヌキ 茂貫 +モノ 物 +モノイ 物井 +モノイ 藻井 +モノウ 最能 +モノウ 桃生 +モノエ 物江 +モノエ 物永 +モノエイ 物永 +モノオ 物応(物應) +モノガミ 物上 +モノカワ 物加波 +モノカワ 物河 +モノダネ 物種 +モノナガ 物永 +モノノベ 物部 +モノノベ 物延 +モノノベ 物野部 +モノフミ 物史 +モノベ 物部 +モノベ 物延 +モノミ 物見 +モノモウシ 物申 +モノヤ 物屋 +モノリ 最乗 +モハタ 茂畑 +モバヤシ 茂林 +モハラ 茂原 +モハラ 毛原 +モハラ 茂腹 +モハラ 藻原 +モハラ 母原 +モハラ 茂膓 +モバラ 茂原 +モバル 百原 +モビキ 百引 +モフサ 毛房 +モブチ 藻淵 +モマイ 百合 +モマイ 百相 +モマタ 茂又 +モマタ 茂俣 +モマタ 茂叉 +モミ 茂見 +モミ 籾 +モミ 椴 +モミ 最見 +モミイ 籾井 +モミイ 揉井 +モミイ 椴井 +モミイ 籾居 +モミウチ 籾内 +モミウチ 椴内 +モミウチ 樅内 +モミウラ 籾浦 +モミエ 籾江 +モミオカ 籾岡 +モミガキ 籾垣 +モミキ 籾木 +モミキ 樅木 +モミキ 椴木 +モミキ 椵木 +モミギ 籾木 +モミクラ 籾倉 +モミクラ 籾蔵(籾藏) +モミサコ 籾迫 +モミジ 楓 +モミジ 紅葉 +モミジカワ 楓川 +モミジガワ 楓川 +モミシタ 籾下 +モミジヤ 紅葉谷 +モミジヤマ 楓山 +モミタ 籾田 +モミタ 樅田 +モミタ 椵田 +モミダ 籾田 +モミダ 椴田 +モミタニ 籾谷 +モミタニ 椴谷 +モミナガ 籾永 +モミノ 樅野 +モミノキ 樅木 +モミノキ 椴木 +モミノキ 椵木 +モミノミ 籾実(籾實) +モミハラ 樅原 +モミハラ 籾原 +モミモト 椴本 +モミモト 籾本 +モミヤ 籾谷 +モミヤマ 籾山 +モミヤマ 樅山 +モミヤマ 椴山 +モミヤマ 粟山 +モミヤマ 椵山 +モムラ 茂村 +モムラ 百村 +モメキ 百目木 +モメン 木綿 +モメン 毛綿 +モメンタニ 木綿谷 +モメンダニ 木綿谷 +モメンヤ 木綿谷 +モメンヤ 毛綿谷 +モモ 百々 +モモ 百 +モモ 桃 +モモイ 桃井 +モモイ 百井 +モモイ 百衣 +モモイシ 百石 +モモウ 桃宇 +モモウ 桃生 +モモウチ 桃内 +モモウミ 百海 +モモウラ 百浦 +モモエ 百枝 +モモエ 桃枝 +モモエ 桃江 +モモエ 百江 +モモエダ 百枝 +モモエダ 桃枝 +モモオ 桃尾 +モモオ 桃生 +モモオ 百尾 +モモオカ 百岡 +モモカ 百家 +モモガ 百我 +モモガキ 百垣 +モモカツ 百勝 +モモガミ 百上 +モモガラ 桃柄 +モモカリ 百刈 +モモカワ 百川 +モモカワ 桃川 +モモキ 桃木 +モモキ 百木 +モモキ 桃城 +モモキ 百々亀 +モモキタ 桃北 +モモキタ 百北 +モモキノ 桃木野 +モモキノ 百木野 +モモゲ 百毛 +モモサカ 桃坂 +モモサカ 百坂 +モモサカ 百々坂 +モモサキ 百崎 +モモサキ 桃崎 +モモサキ 桃嵜 +モモザキ 百崎 +モモザキ 桃崎 +モモザキ 桃嵜 +モモザネ 桃実(桃實) +モモサワ 桃沢 +モモサワ 百沢 +モモサワ 桃澤 +モモサワ 百澤 +モモザワ 桃沢 +モモザワ 百沢 +モモザワ 桃澤 +モモザワ 百澤 +モモシ 百師 +モモジ 百地 +モモジ 百代 +モモジ 百々路 +モモジ 百次 +モモジ 百治 +モモシタ 桃下 +モモシマ 百島 +モモシマ 百嶋 +モモジマ 百島 +モモシロ 桃城 +モモズ 百都 +モモズミ 百済 +モモズミ 桃住 +モモズミ 百積 +モモズミ 百々済 +モモセ 百瀬 +モモセ 百生 +モモセ 桃瀬 +モモセ 百々瀬 +モモセ 桃世 +モモゼ 百瀬 +モモゾノ 桃園 +モモゾノ 桃薗 +モモタ 百田 +モモタ 桃田 +モモダ 百田 +モモダ 桃田 +モモタケ 百武 +モモタケ 百丈 +モモタニ 桃谷 +モモタニ 百谷 +モモタニ 百渓 +モモタニ 百々谷 +モモタニ 桃渓 +モモタニ 百溪 +モモタリ 百足 +モモチ 百地 +モモツ 百津 +モモツ 桃津 +モモツ 百都 +モモヅ 百津 +モモヅ 桃津 +モモツカ 百塚 +モモツカ 百束 +モモツカ 桃塚 +モモヅカ 百塚 +モモヅカ 桃塚 +モモヅカ 百々塚 +モモヅカ 百百塚 +モモツジ 桃辻 +モモデ 百出 +モモト 百戸 +モモトミ 百富 +モモトミ 百冨 +モモドミ 百富 +モモドミ 百冨 +モモトリ 百鳥 +モモドリ 百鳥 +モモナ 百名 +モモナカ 百中 +モモナガ 百永 +モモナガ 百長 +モモナミ 百南 +モモナリ 百成 +モモヌキ 百貫 +モモネ 桃根 +モモノ 桃野 +モモノ 百野 +モモノ 百々野 +モモノ 百濃 +モモノイ 桃井 +モモノエ 百枝 +モモノエ 桃枝 +モモノキ 桃木 +モモノヤ 百谷 +モモハシ 百橋 +モモハタ 百畑 +モモバヤシ 桃林 +モモハラ 桃原 +モモハラ 百原 +モモハル 百春 +モモヒ 百日 +モモヒラ 桃平 +モモマチ 百町 +モモミ 百海 +モモミ 桃実 +モモミナミ 百南 +モモムラ 百村 +モモムラ 桃村 +モモモト 百本 +モモモト 桃本 +モモヤ 桃谷 +モモヤマ 桃山 +モモヤマ 百山 +モヤ 母谷 +モヤ 茂屋 +モヤ 母家 +モヤマ 茂山 +モヨシ 茂吉 +モヨリ 藻寄 +モライダ 貰田 +モラタ 茂良田 +モリ 森 +モリ 毛利 +モリ 盛 +モリ 守 +モリ 茂利 +モリ 母里 +モリ 杜 +モリ 茂里 +モリ 母利 +モリ 茂理 +モリ 最里 +モリ 毛里 +モリ 護 +モリアイ 森合 +モリアイ 盛合 +モリアイ 森相 +モリアイ 守合 +モリアキ 森明 +モリアキ 森秋 +モリアケ 森明 +モリアサ 森朝 +モリアン 森庵 +モリイ 森井 +モリイ 森居 +モリイ 守井 +モリイ 盛井 +モリイ 森位 +モリイ 守居 +モリイ 森伊 +モリイ 毛利井 +モリイ 盛飯 +モリイエ 守家 +モリイエ 森家 +モリイキ 森生 +モリイケ 森池 +モリイケ 森生 +モリイケ 盛池 +モリイケ 守池 +モリイシ 森石 +モリイシ 守石 +モリイシ 盛石 +モリイシダ 盛石田 +モリイズミ 森泉 +モリイズミ 守泉 +モリイズミ 森井泉 +モリイズミ 盛泉 +モリイチ 盛一 +モリイチ 森一 +モリイチ 守一 +モリイチ 森市 +モリイデ 森出 +モリイト 森糸 +モリイワ 森岩 +モリイワ 守岩 +モリイワ 盛岩 +モリウ 盛生 +モリウ 守生 +モリウエ 森上 +モリウエ 森植 +モリウエ 盛植 +モリウジ 森氏 +モリウチ 森内 +モリウチ 守内 +モリウチ 盛内 +モリウネ 森畦 +モリウネ 森畝 +モリウマ 森馬 +モリウミ 森海 +モリウメ 森梅 +モリウラ 森浦 +モリウラ 森裏 +モリウラ 守浦 +モリエ 森江 +モリエ 盛永 +モリエ 守江 +モリエ 森栄 +モリエ 盛江 +モリエ 森恵 +モリエ 森柄 +モリエ 森惠 +モリエ 森榮 +モリエイ 森栄 +モリエイ 森榮 +モリエキ 森浴 +モリエダ 森枝 +モリエン 森圓 +モリエン 森円 +モリオ 森尾 +モリオ 森生 +モリオ 守尾 +モリオ 盛生 +モリオ 盛尾 +モリオ 守生 +モリオウ 森王 +モリオカ 森岡 +モリオカ 盛岡 +モリオカ 守岡 +モリオカ 森丘 +モリオカ 守丘 +モリオカ 杜岡 +モリオキ 守興 +モリオキ 森沖 +モリオキ 盛興 +モリオキ 森興 +モリオキ 守沖 +モリオク 森奥 +モリオケ 森桶 +モリカ 森賀 +モリカ 守家 +モリカ 森加 +モリガ 森賀 +モリガ 守賀 +モリカイ 森貝 +モリカイ 森開 +モリカイ 森階 +モリガイ 森貝 +モリガイ 森階 +モリカギ 森鍵 +モリガキ 森垣 +モリガキウチ 森垣内 +モリガキナイ 森垣内 +モリカク 森角 +モリカゲ 森蔭 +モリカゲ 森影 +モリカゲ 森景 +モリカゲ 森陰 +モリカゲ 盛影 +モリカサ 森笠 +モリガサキ 森ケ崎 +モリカシ 森柏 +モリカズ 森数 +モリカズ 森數 +モリカタ 森方 +モリカツ 森勝 +モリカド 森門 +モリガドウ 守ケ洞 +モリカネ 森兼 +モリカネ 森金 +モリカネ 盛兼 +モリカネ 守金 +モリカマ 森鎌 +モリカミ 森上 +モリカミ 守上 +モリカミ 森神 +モリカミ 守神 +モリカミ 毛利上 +モリガミ 森上 +モリガミ 守上 +モリガミ 盛上 +モリガミ 森神 +モリガミ 守神 +モリガミ 毛利上 +モリガヤマ 森ケ山 +モリカワ 森川 +モリカワ 盛川 +モリカワ 守川 +モリカワ 森河 +モリカワ 毛利川 +モリカワ 杜川 +モリカワ 守河 +モリカワ 茂里川 +モリガワ 森側 +モリガワラ 森河原 +モリキ 森木 +モリキ 守木 +モリキ 森生 +モリキ 盛喜 +モリキ 守城 +モリキ 森喜 +モリキ 盛貴 +モリキ 護城 +モリキ 守帰 +モリキ 盛城 +モリキ 盛木 +モリギシ 森岸 +モリキゾノ 森木園 +モリキタ 森北 +モリキタ 森木田 +モリキタ 守北 +モリキダ 森木田 +モリキュウ 森久 +モリキヨ 森清 +モリキヨ 盛清 +モリキョウ 森京 +モリキリ 森切 +モリギワ 森際 +モリク 森久 +モリクス 森楠 +モリクチ 森口 +モリグチ 森口 +モリグチ 守口 +モリグチ 盛口 +モリグチ 森利口 +モリクニ 森国 +モリクニ 森國 +モリクニ 護国 +モリクニ 護邦 +モリクニ 保国 +モリクニ 守邦 +モリクニ 盛国 +モリクニ 護國 +モリクニ 守国 +モリクニ 保國 +モリクボ 森久保 +モリクボ 森窪 +モリクマ 森熊 +モリクマ 盛熊 +モリクラ 森倉 +モリクラ 守倉 +モリクリ 森栗 +モリクロ 森黒 +モリコ 森子 +モリコ 森小 +モリコ 森古 +モリゴ 森後 +モリゴウ 森合 +モリコウチ 森河内 +モリゴウチ 森河内 +モリコシ 森越 +モリコシ 森腰 +モリコシ 守越 +モリコシ 盛越 +モリコシ 杜腰 +モリコネ 盛小根 +モリコネ 盛小禰 +モリザオ 森竿 +モリサカ 森坂 +モリサカ 森阪 +モリサカ 森栄 +モリサカ 守坂 +モリサカ 森榮 +モリサキ 森崎 +モリサキ 盛崎 +モリサキ 森嵜 +モリサキ 守崎 +モリサキ 守先 +モリサキ 森先 +モリサキ 森埼 +モリサキ 森碕 +モリサキ 森咲 +モリサキ 杜崎 +モリザキ 森崎 +モリザキ 盛崎 +モリザキ 森嵜 +モリサク 森作 +モリサク 守作 +モリザクラ 森桜 +モリザクラ 森櫻 +モリサコ 森迫 +モリサコ 盛迫 +モリサコ 森隥 +モリザコ 森迫 +モリササ 森笹 +モリサダ 森貞 +モリサダ 森定 +モリサダ 盛定 +モリサダ 盛貞 +モリサト 森里 +モリサト 守里 +モリサト 盛里 +モリザネ 森実 +モリザネ 森實 +モリザネ 守実 +モリザネ 盛実 +モリザネ 守實 +モリザネ 盛實 +モリサワ 森沢 +モリサワ 森澤 +モリサワ 守沢 +モリサワ 盛沢 +モリサワ 守澤 +モリサワ 盛澤 +モリザワ 森沢 +モリザワ 森澤 +モリザワ 守沢 +モリザワ 守澤 +モリジ 森治 +モリジ 森路 +モリシゲ 森重 +モリシゲ 守重 +モリシゲ 盛重 +モリシゲ 森繁 +モリシゲ 森茂 +モリシゲ 守繁 +モリシタ 森下 +モリシタ 守下 +モリシタ 盛下 +モリシタ 杜下 +モリシタ 毛利下 +モリシタハラ 森下原 +モリシタバラ 森下原 +モリシマ 森島 +モリシマ 森嶋 +モリシマ 盛島(盛嶋) +モリシマ 守島 +モリシマ 森嶌 +モリシマ 守嶋 +モリジマ 森島 +モリジマ 森嶋 +モリシャ 守舎 +モリショウ 森生 +モリジリ 森尻 +モリシロ 守城 +モリシロ 森城 +モリシロ 森白 +モリシン 森新 +モリス 森須 +モリス 森栖 +モリスエ 森末 +モリスエ 守末 +モリスエ 森未 +モリスエ 盛末 +モリズカ 森塚 +モリスギ 森杉 +モリスギ 森椙 +モリスナ 盛砂 +モリスミ 森住 +モリスミ 森角 +モリスミ 森澄 +モリズミ 森泉 +モリズミ 森住 +モリズミ 森角 +モリズミ 森澄 +モリズミ 守住 +モリズミ 森済 +モリズミ 森積 +モリズミ 森隅 +モリズミ 守角 +モリズミ 守留 +モリズミ 盛住 +モリズミ 盛純 +モリズミ 盛澄 +モリセ 森瀬 +モリセ 森清 +モリセ 森生 +モリセ 森勢 +モリセ 盛生 +モリセ 守瀬 +モリセ 杜瀬 +モリソウ 森宗 +モリゾエ 森添 +モリゾエ 森副 +モリソデ 守袖 +モリソト 森外 +モリソノ 森園 +モリソノ 森薗 +モリゾノ 森園 +モリゾノ 森薗 +モリゾノ 盛園 +モリゾノ 森囿 +モリタ 森田 +モリタ 守田 +モリタ 盛田 +モリタ 森多 +モリタ 毛利田 +モリタ 盛多 +モリタ 護田 +モリタ 茂利田 +モリタ 守多 +モリタ 杜田 +モリダ 森田 +モリダイラ 森平 +モリタカ 森高 +モリタカ 盛高 +モリタカ 守高 +モリタキ 森滝 +モリタキ 森瀧 +モリタキ 銛滝 +モリタク 森宅 +モリタケ 森竹 +モリタケ 盛武 +モリタケ 森武 +モリタケ 守武 +モリタケ 森岳 +モリタダ 森忠 +モリタチ 森立 +モリタニ 森谷 +モリタニ 守谷 +モリタニ 盛谷 +モリタネ 森種 +モリタマ 森玉 +モリタヤ 森田谷 +モリタン 森反 +モリチ 森地 +モリチ 森知 +モリチカ 森近 +モリツ 森津 +モリツ 守津 +モリヅ 森津 +モリツカ 森塚 +モリツカ 守塚 +モリツカ 杜塚 +モリヅカ 森塚 +モリツキ 森月 +モリツキ 守月 +モリツギ 森次 +モリツギ 盛次 +モリヅキ 森月 +モリヅキ 守月 +モリヅキ 盛月 +モリツグ 森次 +モリツグ 森継 +モリツグ 盛次 +モリツグ 守次 +モリツグ 森続 +モリツジ 森辻 +モリツタ 森蔦 +モリツチ 森槌 +モリツナ 森綱 +モリツナ 盛綱 +モリツネ 森常 +モリツネ 森恒 +モリツボ 森坪 +モリツボ 盛坪 +モリヅミ 森積 +モリヅメ 森詰 +モリデ 森出 +モリデ 森代 +モリテラ 森寺 +モリデラ 森寺 +モリテン 森天 +モリト 森戸 +モリト 盛戸 +モリト 守都 +モリト 守戸 +モリド 森戸 +モリド 森土 +モリド 守主 +モリドイ 森土井 +モリトウ 森藤 +モリトウ 森東 +モリトウ 盛藤 +モリトウ 森当 +モリトウ 森任 +モリドウ 森銅 +モリトキ 守時 +モリトキ 盛一 +モリトキ 森時 +モリトク 森徳 +モリトシ 森年 +モリドノ 守殿 +モリトミ 守富 +モリトミ 森富 +モリトミ 森冨 +モリトミ 守冨 +モリドミ 森富 +モリトメ 森留 +モリトメ 漏留 +モリドメ 森留 +モリドメ 盛留 +モリトモ 森友 +モリトモ 守友 +モリトモ 盛友 +モリトヨ 森豊 +モリナ 森名 +モリナ 森庵 +モリナ 森奈 +モリナカ 森中 +モリナカ 守中 +モリナカ 盛中 +モリナカ 森仲 +モリナカ 守仲 +モリナガ 森永 +モリナガ 守永 +モリナガ 森長 +モリナガ 盛永 +モリナガ 守長 +モリナガ 盛長 +モリナガ 守良 +モリナダ 森灘 +モリナミ 森南 +モリナミ 森並 +モリナミ 森波 +モリナリ 森成 +モリニシ 森西 +モリニシ 守西 +モリニブ 森鳰 +モリヌキ 森貫 +モリヌシ 森主 +モリネ 森根 +モリネ 盛根 +モリノ 森野 +モリノ 守野 +モリノ 盛野 +モリノ 守能 +モリノ 森埜 +モリノ 森能 +モリノ 牡野 +モリノ 毛利野 +モリノウ 守能 +モリノウ 森能 +モリノウエ 森之上 +モリノウエ 森ノ上 +モリノウチ 森ノ内 +モリノカミ 森上 +モリノキ 森ノ木 +モリノシタ 森野下 +モリノシタ 森之下 +モリノシタ 盛ノ下 +モリノハラ 森野原 +モリノブ 森信 +モリノブ 森延 +モリノベ 森延 +モリノベ 森野辺(森野邊) +モリノムカイ 森ノ向 +モリノモト 森之本 +モリノモト 森ノ本 +モリノリ 守法 +モリバ 森場 +モリバ 森馬 +モリハギ 森萩 +モリハシ 森橋 +モリハシ 守橋 +モリハシ 盛橋 +モリハタ 森畑 +モリハタ 森畠 +モリハタ 森端 +モリハタ 守畠 +モリハタ 森幡 +モリバタ 森畠 +モリバタ 森端 +モリバタケ 森畠 +モリハナ 森鼻 +モリハナ 森花 +モリハマ 森浜 +モリハマ 森濱 +モリバヤシ 森林 +モリバヤシ 盛林 +モリハラ 森原 +モリハラ 盛原 +モリハラ 守原 +モリハラ 杜原 +モリヒガシ 森東 +モリヒサ 森久 +モリヒサ 盛久 +モリヒサ 守久 +モリヒョウ 森表 +モリヒラ 森平 +モリヒラ 森比良 +モリヒロ 森広 +モリヒロ 森廣 +モリヒロ 森弘 +モリヒロ 守広 +モリヒロ 守弘 +モリヒロ 盛弘 +モリヒロ 守廣 +モリフク 森福 +モリフサ 盛房 +モリフサ 森房 +モリフジ 森藤 +モリフジ 盛藤 +モリフジ 毛利藤 +モリフチ 森渕 +モリブチ 森淵 +モリブチ 森渕 +モリベ 森部 +モリベ 守部 +モリベ 森辺(森邉) +モリベ 森邊 +モリベ 毛利部 +モリホウ 森峰 +モリホリ 森堀 +モリマ 森馬 +モリマ 森間 +モリマ 守真 +モリマ 森麻 +モリマエ 森前 +モリマサ 森政 +モリマサ 森正 +モリマサ 守政 +モリマサ 盛政 +モリマサ 森柾 +モリマス 森増 +モリマス 盛舛 +モリマタ 森亦 +モリマチ 森町 +モリマチ 盛町 +モリマツ 森松 +モリマツ 守松 +モリマツ 盛松 +モリミ 森実 +モリミ 森實 +モリミ 森見 +モリミ 森海 +モリミズ 森水 +モリミズ 漏水 +モリミゾ 森溝 +モリミチ 守道 +モリミチ 森道 +モリミツ 森光 +モリミツ 森満 +モリミツ 盛満 +モリミツ 守光 +モリミツ 盛光 +モリミツ 守満 +モリミツ 毛利光 +モリミツ 森滿 +モリミツ 盛滿 +モリミネ 森峰 +モリミネ 森嶺 +モリミヤ 森宮 +モリミヤ 守宮 +モリミヤ 盛宮 +モリミョウ 森明 +モリムカイ 森向 +モリムネ 森宗 +モリムネ 森棟 +モリムネ 森旨 +モリムラ 森村 +モリムラ 守村 +モリムラ 盛村 +モリモ 森茂 +モリモト 森本 +モリモト 森下 +モリモト 森元 +モリモト 守本 +モリモト 盛本 +モリモト 杜本 +モリモト 盛元 +モリモト 守元 +モリモト 森源 +モリヤ 守屋 +モリヤ 森谷 +モリヤ 守谷 +モリヤ 森屋 +モリヤ 守矢 +モリヤ 守家 +モリヤ 盛谷 +モリヤ 森家 +モリヤ 盛屋 +モリヤ 森矢 +モリヤ 森舎(森舍) +モリヤ 盛矢 +モリヤ 盛家 +モリヤシキ 森屋敷 +モリヤス 森安 +モリヤス 守安 +モリヤス 森保 +モリヤス 盛安 +モリヤス 守泰 +モリヤマ 森山 +モリヤマ 守山 +モリヤマ 盛山 +モリヤマ 護山 +モリヤマ 杜山 +モリヤマ 毛利山 +モリュウ 守生 +モリユキ 森行 +モリユキ 守行 +モリユキ 森雪 +モリヨ 盛与 +モリヨコ 森横 +モリヨシ 森吉 +モリヨシ 盛吉 +モリヨシ 森好 +モリヨシ 守吉 +モリヨシ 森芳 +モリヨシ 森由 +モリヨシ 森義 +モリヨシ 杜芳 +モリヨシ 杜吉 +モリワカ 森若 +モリワキ 森脇 +モリワキ 森分 +モリワキ 守分 +モリワキ 守脇 +モリワキ 盛脇 +モリワキ 森和木 +モリワキ 森𦚰 +モリワケ 森分 +モリワケ 守分 +モルタ 漏田 +モレイラ 盛礼良 +モレイラ 茂怜羅 +モレミズ 漏水 +モロ 茂呂 +モロ 毛呂 +モロ 諸 +モロ 師 +モロ 茂籠 +モロ 茂篭 +モロ 舞良 +モロ 茂路 +モロ 毛篭 +モロ 毛路 +モロ 毛籠 +モロアキ 諸明 +モロイ 諸井 +モロイ 師井 +モロイ 茂呂居 +モロイ 毛呂井 +モロイグチ 両井口 +モロイケ 師池 +モロイシ 諸石 +モロイズミ 諸泉 +モロイリ 師入 +モロイワ 諸岩 +モロウ 茂籠 +モロウ 茂篭 +モロウ 毛篭 +モロウ 毛籠 +モロエ 諸江 +モロオ 師尾 +モロオ 諸尾 +モロオカ 諸岡 +モロオカ 師岡 +モロオカ 両岡 +モロガ 諸我 +モロガ 諸鹿 +モロガ 諸家 +モロガ 諸賀 +モロカジ 諸鍛治(諸鍜治) +モロカジ 諸鍛冶 +モロカタ 宝方 +モロカド 諸角 +モロカミ 諸上 +モロガミ 諸上 +モロカワ 諸川 +モロカワ 両川 +モロカワ 師川 +モロカワ 諸河 +モロキ 萬木 +モロキ 諸木 +モロキ 衆樹 +モロキ 両城 +モロギ 諸木 +モロギシ 諸岸 +モロキタ 諸喜田 +モロキタ 諸喜多 +モロクズ 諸葛 +モログチ 諸口 +モロクニ 諸国 +モロクニ 諸國 +モロクマ 諸隈 +モロクマ 諸熊 +モロクマ 諸隅 +モログマ 諸熊 +モロコシ 諸越 +モロコシ 唐土 +モロコシ 唐士 +モロサ 諸佐 +モロサカ 諸坂 +モロサキ 師崎 +モロサキ 諸崎 +モロザキ 師崎 +モロザキ 諸崎 +モロサト 諸里 +モロサワ 諸沢 +モロサワ 諸澤 +モロサワ 両沢 +モロサワ 両澤 +モロサワ 茂呂沢 +モロサワ 茂呂澤 +モロザワ 諸沢 +モロザワ 諸澤 +モロジ 諸治 +モロシマ 諸島 +モロシマ 諸嶋 +モロスギ 諸杉 +モロスミ 諸角 +モロズミ 両角 +モロズミ 諸角 +モロズミ 諸澄 +モロズミ 諸墨 +モロズミ 諸住 +モロズミ 師角 +モロセ 諸瀬 +モロタ 諸田 +モロタ 師田 +モロタ 茂呂田 +モロタ 漏田 +モロタ 諸多 +モロダ 諸田 +モロダ 師田 +モロダ 茂呂田 +モロタケ 茂呂竹 +モロタケ 諸武 +モロタニ 諸谷 +モロヅカ 諸塚 +モロツキ 諸月 +モロヅミ 諸積 +モロト 諸戸 +モロト 諸頭 +モロトウ 諸頭 +モロトミ 諸富 +モロトミ 諸冨 +モロトミ 師富 +モロドミ 諸富 +モロドミ 諸冨 +モロドミ 師富 +モロトメ 諸留 +モロドメ 諸留 +モロナカ 諸中 +モロナガ 諸永 +モロヌキ 諸貫 +モロネ 諸根 +モロノ 諸野 +モロノウ 諸農 +モロハク 諸白 +モロハシ 諸橋 +モロハシ 師橋 +モロハシ 緒橋 +モロハシ 諸槁 +モロバシ 諸橋 +モロバヤシ 諸林 +モロハラ 諸原 +モロビシ 諸菱 +モロヒラ 諸平 +モロフサ 諸房 +モロフシ 諸伏 +モロフシ 諸節 +モロフジ 諸藤 +モロホシ 諸星 +モロホシ 師星 +モロボシ 諸星 +モロボラ 諸洞 +モロマサ 諸正 +モロマチ 諸町 +モロマツ 諸松 +モロミ 諸見 +モロミカワ 諸見川 +モロミガワ 諸見川 +モロミサト 諸見里 +モロミザト 諸見里 +モロミジャ 諸見謝 +モロミチ 諸道 +モロムギ 諸麦 +モロムギ 諸麥 +モロモチ 諸持 +モロモト 諸本 +モロモト 諸元 +モロヤ 諸谷 +モロヤ 諸屋 +モロヤマ 諸山 +モロヤマ 師山 +モロユ 諸遊 +モロユウ 諸遊 +モロヨシ 諸吉 +モロヨセ 諸寄 +モロワ 諸和 +モワイズミ 茂和泉 +モン 門 +モンウチ 門内 +モンエ 本江 +モンカ 門家 +モンガキ 門垣 +モンガミ 門上 +モンカワ 門川 +モンカワ 紋川 +モンカワ 門河 +モンギ 門木 +モングチ 門口 +モンザイ 門西 +モンザイ 門斎 +モンザイ 門斉 +モンサカ 門坂 +モンサカ 紋阪 +モンサカ 紋坂 +モンザカ 紋阪 +モンザキ 門崎 +モンザキ 門埼 +モンザワ 門沢 +モンザワ 門澤 +モンサン 門三 +モンジ 門司 +モンジ 文字 +モンジ 文司 +モンジ 門路 +モンジャク 門雀 +モンジヤマ 文字山 +モンジュ 文珠 +モンジュ 文殊 +モンジュ 文寿 +モンジュ 文壽 +モンジュ 門主 +モンジュウショ 問註所 +モンジュガワ 文珠川 +モンジュジ 文珠寺 +モンジュシロウ 文珠四郎 +モンジュシロウ 文殊四郎 +モンジョ 門所 +モンジョウ 門上 +モンジョウ 門城 +モンジョウ 門條 +モンジョウ 門条 +モンセ 門瀬 +モンセ 門世 +モンセキ 門石 +モンゼン 門前 +モンゼン 門善 +モンゾノ 門三野 +モンタ 門田 +モンタ 紋田 +モンダ 門田 +モンダ 紋田 +モンタニ 門谷 +モンタニ 紋谷 +モンタワ 門乢 +モンチ 門地 +モンチュウジョ 問註所 +モンチョウ 門長 +モンツウ 門通 +モンヅツミ 門包 +モンテ 門手 +モンデ 門出 +モンデ 門手 +モンデラ 門寺 +モンデン 文伝 +モンデン 門田 +モンデン 門伝 +モンデン 問田 +モンデン 門傳 +モンデン 門傅 +モント 門戸 +モンド 門戸 +モンド 門土 +モントウ 門東 +モンドウ 門藤 +モンドリ 水取 +モンドリ 水掫 +モンナ 門奈 +モンナ 門名 +モンナ 門那 +モンナイ 門内 +モンナカ 門中 +モンナガ 門永 +モンナガ 門長 +モンニュウ 門丹生 +モンネギ 門根木 +モンノ 門野 +モンノ 門埜 +モンノ 紋野 +モンノウエ 門野上 +モンノウチ 門野内 +モンバ 門場 +モンバ 紋羽 +モンバ 紋波 +モンバシ 門橋 +モンバヤシ 門林 +モンバラ 門原 +モンブ 文分 +モンベ 門部 +モンベツ 門別 +モンマ 門馬 +モンマ 門間 +モンマ 門真 +モンマ 門眞 +モンマ 紋間 +モンマエ 門前 +モンマサ 門政 +モンマス 門桝 +モンマス 門枡 +モンマル 門丸 +モンミチ 門道 +モンヤ 門谷 +モンヤ 紋谷 +モンヤ 門家 +モンリ 門利 +ヤアサ 八朝 +ヤアナ 八穴 +ヤイ 矢井 +ヤイ 屋井 +ヤイ 矢居 +ヤイキ 矢生 +ヤイザワ 八井沢 +ヤイシ 矢石 +ヤイシ 弥石 +ヤイタ 矢板 +ヤイタ 八板 +ヤイタ 矢井田 +ヤイダ 焼田(燒田) +ヤイダ 矢井田 +ヤイダ 八井田 +ヤイタバシ 矢板橋 +ヤイチ 家市 +ヤイリ 矢入 +ヤイロ 八色 +ヤウキ 家浮 +ヤウジ 弥氏 +ヤウタ 矢歌 +ヤウチ 谷内 +ヤウチ 矢内 +ヤウチ 箭内 +ヤウチ 屋内 +ヤウチ 八内 +ヤウチダ 谷内田 +ヤウチハラ 矢内原 +ヤウチバラ 矢内原 +ヤウマ 八馬 +ヤウラ 矢浦 +ヤウラ 八浦 +ヤエ 八戸 +ヤエ 八重 +ヤエ 八江 +ヤエイシ 八重石 +ヤエオ 八重尾 +ヤエオカ 八重岡 +ヤエガキ 八重垣 +ヤエガキ 八重桓 +ヤエガシ 八重樫 +ヤエガシ 八重柏 +ヤエカシワ 八重柏 +ヤエガシワ 八重柏 +ヤエカド 八重門 +ヤエカワ 八重川 +ヤエガワ 八重川 +ヤエキ 八役 +ヤエキ 八重木 +ヤエグチ 八重口 +ヤエクラ 八重倉 +ヤエザ 八重座 +ヤエザキ 八重崎 +ヤエザクラ 八重桜(八重櫻) +ヤエサワ 八重沢 +ヤエサワ 八重澤 +ヤエザワ 八重沢 +ヤエザワ 八重澤 +ヤエシタ 八重下 +ヤエシマ 八重島 +ヤエシマ 八重嶋 +ヤエシマ 八重嶌 +ヤエジマ 八重島 +ヤエジマ 八重嶋 +ヤエシロ 八重代 +ヤエタ 八重田 +ヤエダ 八重田 +ヤエダケ 八重嶽 +ヤエダケ 八重岳 +ヤエツ 八重津 +ヤエヅ 八重津 +ヤエネリ 八重練 +ヤエノ 八重野 +ヤエノ 八丈野 +ヤエノ 八戸野 +ヤエハシ 八重橋 +ヤエハタ 八重畑 +ヤエハタ 八重幡 +ヤエハラ 八重原 +ヤエミ 八重見 +ヤエモト 八重元 +ヤエモト 八重本 +ヤエモリ 八重森 +ヤエモリ 八重盛 +ヤエヤマ 八重山 +ヤオ 八尾 +ヤオ 矢尾 +ヤオ 八百 +ヤオ 屋尾 +ヤオイ 矢追 +ヤオイ 八百井 +ヤオイ 矢生 +ヤオイ 矢尾井 +ヤオイ 八尾井 +ヤオイタ 矢尾板 +ヤオイタ 八百板 +ヤオイタ 八尾板 +ヤオイチ 八百市 +ヤオウ 八王 +ヤオエダ 八百枝 +ヤオカ 矢岡 +ヤオカワ 八百川 +ヤオガワ 八百川 +ヤオキ 家興 +ヤオキ 八百城 +ヤオキ 八百木 +ヤオキ 八起 +ヤオギ 八本木 +ヤオク 矢奥 +ヤオコウ 八百幸 +ヤオサ 八筬 +ヤオサカ 八尾坂 +ヤオサカ 八百坂 +ヤオシ 八尾師 +ヤオシタ 八百下 +ヤオシロ 八百代 +ヤオタ 八百田 +ヤオタ 矢尾田 +ヤオタ 八尾田 +ヤオダ 八百田 +ヤオタニ 八百谷 +ヤオタニ 八尾谷 +ヤオタニ 矢尾谷 +ヤオタニ 家尾谷 +ヤオチ 矢落 +ヤオチ 矢尾知 +ヤオトメ 八乙女 +ヤオナカ 八百中 +ヤオノ 八尾野 +ヤオノ 八百野 +ヤオハラ 八百原 +ヤオミ 八百三 +ヤオムラ 八尾村 +ヤオムラ 八百村 +ヤオモト 八百本 +ヤオヤ 八百屋 +ヤオヤマ 八百山 +ヤオリ 矢折 +ヤカ 屋嘉 +ヤカ 八家 +ヤカ 家加 +ヤガ 屋我 +ヤガ 八賀 +ヤガ 矢賀 +ヤカイ 谷貝 +ヤガイ 矢谷 +ヤガイ 谷貝 +ヤガイ 矢貝 +ヤガイ 矢飼 +ヤガイ 屋貝 +ヤガイ 谷開 +ヤガイ 矢ケ井 +ヤガイ 矢外 +ヤガキ 矢垣 +ヤカケ 矢掛 +ヤカゲ 矢景 +ヤカゲ 八影 +ヤカゲ 矢影 +ヤガケ 矢掛 +ヤガサ 矢笠 +ヤガサキ 矢ケ崎(矢ケ嵜) +ヤガサキ 谷ケ崎 +ヤガサキ 矢我崎 +ヤカシラ 矢頭 +ヤガシラ 矢頭 +ヤガシラ 家頭 +ヤカシロ 八ケ代 +ヤガシロ 八ケ代 +ヤガシロ 谷ケ城 +ヤガシワ 箭柏 +ヤガシワ 八柏 +ヤカズ 矢数(矢數) +ヤガセ 矢ケ瀬 +ヤカタ 舘 +ヤカタ 館 +ヤカタ 矢形 +ヤカタ 八方 +ヤカタ 屋形 +ヤカタ 家形 +ヤカタ 矢方 +ヤカタ 屋方 +ヤカタ 家方 +ヤカタ 屋片 +ヤガタ 矢形 +ヤガタ 屋形 +ヤガタ 家形 +ヤガタ 屋ケ田 +ヤガタ 輻形 +ヤガタオ 矢賀垰 +ヤカタギ 舘木 +ヤガタニ 矢賀谷 +ヤカタバ 屋形場 +ヤガネ 矢金 +ヤガネ 屋金 +ヤガハラ 谷川原 +ヤガハラ 矢箟原 +ヤカヒ 屋嘉比 +ヤカビ 屋嘉比 +ヤカブ 屋嘉部 +ヤカブ 八蕪 +ヤカベ 矢ケ部 +ヤカベ 矢加部 +ヤカベ 屋嘉部 +ヤカベ 矢壁 +ヤカベ 矢賀部 +ヤカベ 矢可部 +ヤカベ 八壁 +ヤカベ 屋賀部 +ヤカベ 八加部 +ヤガベ 矢ケ部 +ヤカマ 八鎌 +ヤカマ 八釜 +ヤカミ 矢上 +ヤカミ 八神 +ヤカミ 八上 +ヤガミ 谷上 +ヤガミ 矢上 +ヤガミ 八神 +ヤガミ 矢神 +ヤガミ 八上 +ヤガミ 屋上 +ヤガミ 谷神 +ヤガミ 矤上 +ヤガミ 家神 +ヤガミ 弥上 +ヤガムラ 矢ケ村 +ヤカメ 八亀 +ヤカメ 矢亀 +ヤガメ 谷亀 +ヤガメ 家亀 +ヤガメ 屋亀 +ヤガヤ 矢賀谷 +ヤガラ 八柄 +ヤガラ 矢柄 +ヤガラ 箭柄 +ヤガラ 矢ケ良 +ヤガラキ 家柄木 +ヤカワ 矢川 +ヤカワ 八川 +ヤガワ 谷川 +ヤガワ 矢川 +ヤガワ 八川 +ヤガワ 谷河 +ヤガワ 箭川 +ヤガワ 八河 +ヤガワ 弥川 +ヤガワ 矢河 +ヤガワラ 谷川原 +ヤカン 家神 +ヤキ 八木 +ヤキ 矢貴 +ヤキ 屋喜 +ヤギ 八木 +ヤギ 矢木 +ヤギ 屋宜 +ヤギ 家城 +ヤギ 八城 +ヤギ 矢城 +ヤギ 屋木 +ヤギ 谷木 +ヤギ 矢儀 +ヤギ 箭木 +ヤギ 矢来(矢來) +ヤギ 屋宣 +ヤギ 八鬼 +ヤギ 矢貴 +ヤギ 屋喜 +ヤギ 山宜 +ヤギ 八樹 +ヤギイ 楊井 +ヤギイ 八木井 +ヤギイ 八幾井 +ヤキイシ 焼石 +ヤギウ 柳生 +ヤギウ 柳父 +ヤギウチ 柳内 +ヤギウラ 柳浦 +ヤキオ 焼尾(燒尾) +ヤギオ 柳尾 +ヤギオ 八木尾 +ヤキオカ 焼岡 +ヤギオカ 柳岡 +ヤギオカ 八木岡 +ヤキガイ 焼貝 +ヤキガヤ 八木ケ谷 +ヤギガヤ 八木ケ谷 +ヤギサワ 柳沢 +ヤギサワ 柳澤 +ヤギサワ 八木沢 +ヤギサワ 八木澤 +ヤギサワ 矢木沢 +ヤギサワ 矢木澤 +ヤギザワ 八木沢 +ヤギシ 矢岸 +ヤギシ 八木司 +ヤキシオ 焼塩 +ヤギシタ 柳下 +ヤギシタ 八木下 +ヤギシマ 八木島 +ヤギシマ 耶岐島 +ヤキタ 焼田(燒田) +ヤキタ 矢北 +ヤキタ 屋北 +ヤキダ 焼田(燒田) +ヤギタ 柳田 +ヤギタ 八木田 +ヤギタ 矢北 +ヤギタ 矢木田 +ヤギタ 矢儀田 +ヤギダイラ 八木平 +ヤキタニ 焼谷 +ヤギタニ 八木谷 +ヤキツギ 焼継 +ヤギト 八木戸 +ヤキナカ 焼中 +ヤギニワ 八木庭 +ヤギヌマ 柳沼 +ヤギヌマ 八木沼 +ヤギノ 柳野 +ヤギノ 八木野 +ヤギノ 矢木野 +ヤギバ 八木場 +ヤギハシ 八木橋 +ヤギハシ 柳橋 +ヤギハシ 矢木橋 +ヤギバシ 八木橋 +ヤギバヤシ 楊林 +ヤギハラ 柳原 +ヤギハラ 八木原 +ヤギハラ 谷木原 +ヤギハラ 矢木原 +ヤギマキ 八木巻 +ヤキモト 焼本 +ヤギモト 柳本 +ヤギモト 柳元 +ヤギモト 八木本 +ヤギモリ 八木森 +ヤキヤ 焼家 +ヤキヤマ 焼山 +ヤギヤマ 八木山 +ヤキュウ 八久 +ヤギュウ 柳生 +ヤギュウ 柳父 +ヤギュウ 矢生 +ヤギュウ 野牛 +ヤギュウ 柳牛 +ヤギュウ 谷牛 +ヤギュウ 八久 +ヤギュウダ 柳生田 +ヤキョウ 八京 +ヤギヨシ 柳吉 +ヤギラ 柳楽 +ヤギリ 矢切 +ヤギリ 八切 +ヤギリ 矢桐 +ヤキレ 八切 +ヤギワラ 八木原 +ヤク 夜久 +ヤク 八九 +ヤグ 矢具 +ヤクイ 薬井(藥井) +ヤクウチ 薬内(藥内) +ヤクオ 薬王(藥王) +ヤクオウ 薬王(藥王) +ヤクオウジ 薬王寺(藥王寺) +ヤクオウジュ 薬王樹 +ヤクカワ 役川 +ヤクガワ 役川 +ヤクサシ 弥久刺 +ヤクサシ 矢久指 +ヤクサヤマ 矢草山 +ヤグサヤマ 矢草山 +ヤクザワ 薬沢 +ヤクザワ 薬澤(藥澤) +ヤクシ 薬師 +ヤクシ 薬司 +ヤクシ 薬子 +ヤクシ 約仕 +ヤクシ 薬志 +ヤクシ 藥師 +ヤグシ 八串 +ヤクシイン 薬師院(藥師院) +ヤクシウラ 薬師浦 +ヤクシガワ 薬師川 +ヤクシガワ 藥師川 +ヤクシゲ 役重 +ヤクシジ 薬師寺 +ヤクシジ 薬師神(藥師神) +ヤクシジ 薬師地 +ヤクシジ 薬師時 +ヤクシジ 藥師寺 +ヤクシジン 薬師神(藥師神) +ヤクシダ 薬師田 +ヤクシダ 藥師田 +ヤクシドウ 薬師堂(藥師堂) +ヤグシマ 矢具島 +ヤクシマル 薬師丸 +ヤクシムラ 薬師村 +ヤクシヤマ 薬師山 +ヤクシュ 薬種 +ヤクジュ 薬寿 +ヤクシンジ 薬真寺 +ヤクシンジ 薬眞寺 +ヤクシンジ 藥真寺 +ヤクシンジ 藥眞寺 +ヤクスエ 弥久末(彌久末) +ヤクタ 役田 +ヤクタ 薬田 +ヤクダ 役田 +ヤクタニ 薬谷(藥谷) +ヤクタニ 役谷 +ヤグチ 谷口 +ヤグチ 矢口 +ヤグチ 家口 +ヤグチ 屋口 +ヤクデン 役田 +ヤクナイ 薬内(藥内) +ヤクニ 八国(八國) +ヤクノ 役野 +ヤクノ 薬野 +ヤグノ 矢具野 +ヤクボ 矢久保 +ヤクボ 八久保 +ヤクボ 弥久保 +ヤクボ 八窪 +ヤクボ 家久保 +ヤクボ 彌久保 +ヤクマ 八熊 +ヤクマ 矢久間 +ヤグマ 矢熊 +ヤグマ 八熊 +ヤグマ 谷隈 +ヤグマ 矢隈 +ヤクマル 薬丸 +ヤクマル 藥丸 +ヤクモ 八雲 +ヤクモ 耶雲 +ヤグモ 八雲 +ヤクモイ 八雲井 +ヤクモト 薬本 +ヤクヤマ 役山 +ヤクラ 矢倉 +ヤクラ 八倉 +ヤクラ 家倉 +ヤグラ 矢倉 +ヤグラ 八倉 +ヤグラ 家倉 +ヤグラ 櫓 +ヤグラ 屋藏(屋蔵) +ヤクラマキ 八倉巻 +ヤグラマキ 八倉巻 +ヤグラモト 櫓元 +ヤグラヤ 矢倉屋 +ヤグリ 八栗 +ヤグルマ 矢車 +ヤグルマ 八車 +ヤグロ 矢黒 +ヤクワ 八鍬 +ヤグワ 八鍬 +ヤケ 矢毛 +ヤケイシ 焼石 +ヤケイシ 矢毛石 +ヤケオ 焼尾(燒尾) +ヤケオカ 焼岡 +ヤゲサワ 谷下沢 +ヤゲザワ 谷下沢 +ヤゲザワ 谷下澤 +ヤケスギ 焼杉 +ヤゲゾウ 谷下沢 +ヤケタ 八桁 +ヤケダ 焼田(燒田) +ヤゲタ 八下田 +ヤゲタ 谷下田 +ヤゲタ 八桁 +ヤゲタ 屋ケ田 +ヤゲタ 矢下田 +ヤゲタ 矢ケ田 +ヤケナ 屋慶名 +ヤケノ 焼野 +ヤケヒロ 焼広(焼廣) +ヤケマル 焼丸 +ヤケモト 焼本 +ヤケヤ 焼谷 +ヤケヤマ 焼山 +ヤゲン 薬研 +ヤゲンジ 彌源治 +ヤゲンジ 八源寺 +ヤゲンジ 薬研地 +ヤゲンジ 弥源治 +ヤゲンジ 薬研寺 +ヤゲンダ 矢研田 +ヤコ 八子 +ヤコ 箭子 +ヤコ 矢子 +ヤコ 谷古 +ヤゴ 矢後 +ヤゴ 八子 +ヤゴ 谷後 +ヤゴ 家後 +ヤゴ 野吾 +ヤゴ 矢子 +ヤゴ 屋子 +ヤゴ 屋後 +ヤゴ 弥五 +ヤコウ 谷古宇 +ヤコウ 矢古宇 +ヤコウ 八高 +ヤコウ 矢向 +ヤコウ 矢光 +ヤコウ 夜光 +ヤコウ 八光 +ヤコウ 八國生(八国生) +ヤコウ 矢功 +ヤゴウ 矢後 +ヤゴウ 矢郷 +ヤゴウ 矢合 +ヤゴウ 家合 +ヤゴウ 矢号 +ヤゴウ 八合 +ヤゴウラ 御秡如 +ヤゴオリ 弥郡 +ヤコグマ 八子熊 +ヤコシ 矢越 +ヤコシ 八越 +ヤゴシ 矢越 +ヤゴシ 家越 +ヤコジマ 矢古島 +ヤコジマ 矢古嶋 +ヤゴシマ 野牛島 +ヤゴシマ 野牛嶋 +ヤゴシマ 野午島 +ヤゴシマ 野午嶋 +ヤゴタ 矢五田 +ヤゴタ 矢吾田 +ヤゴト 位高 +ヤゴミ 矢込 +ヤゴメ 谷米 +ヤゴメ 矢込 +ヤゴメ 家込 +ヤゴロ 矢頃 +ヤゴロウマル 弥五郎丸(彌五郎丸) +ヤゴロウマル 八五郎丸 +ヤサ 弥左(彌左) +ヤサ 矢佐 +ヤサ 弥佐 +ヤザ 矢座 +ヤザ 家座 +ヤサイコ 家才子 +ヤサカ 八坂 +ヤサカ 矢坂 +ヤサカ 谷坂 +ヤサカ 八阪 +ヤサカ 矢阪 +ヤサカワ 弥三川(彌三川) +ヤサガワ 弥三川(彌三川) +ヤサキ 矢崎 +ヤサキ 八崎 +ヤサキ 矢嵜 +ヤサキ 矢裂 +ヤサキ 矢先 +ヤザキ 矢崎 +ヤザキ 八崎 +ヤザキ 屋崎 +ヤザキ 矢嵜 +ヤザキ 箭崎 +ヤザキ 矢裂 +ヤザキ 八嵜 +ヤザキ 弥崎 +ヤサク 矢作 +ヤサコ 矢迫 +ヤザコ 矢迫(矢廹) +ヤサシ 夜差 +ヤサシ 矢指 +ヤサシモト 矢指本 +ヤサス 弥三須 +ヤサダ 矢定 +ヤサト 八里 +ヤザネ 矢実(矢實) +ヤザネ 野佐根 +ヤサマ 矢佐間 +ヤザマ 矢間 +ヤザマ 矢狭 +ヤザマ 矢佐間 +ヤザマ 矢桟間 +ヤザマ 矢狹 +ヤサワ 矢沢 +ヤサワ 矢澤 +ヤサワ 八澤 +ヤザワ 矢沢 +ヤザワ 谷沢 +ヤザワ 矢澤 +ヤザワ 谷澤 +ヤザワ 八沢 +ヤザワ 八澤 +ヤザワ 屋沢 +ヤザワ 屋澤 +ヤシ 安士 +ヤシ 家志 +ヤジ 谷地 +ヤジ 矢次 +ヤジ 矢治 +ヤジ 矢地 +ヤジ 家治 +ヤジ 谷治 +ヤジ 八道 +ヤジ 屋地 +ヤジ 家次 +ヤジ 谷路 +ヤジ 家路 +ヤジ 矢路 +ヤジ 八字 +ヤジ 矢司 +ヤシオ 八汐 +ヤシオ 八塩 +ヤシオ 八潮 +ヤジオカ 屋地岡 +ヤシカ 谷鹿 +ヤシカ 八鹿 +ヤジカ 谷鹿 +ヤジカワ 矢路川 +ヤシキ 屋敷 +ヤシキ 矢敷 +ヤシキ 屋鋪 +ヤシキ 谷敷 +ヤシキ 矢舗(矢舖) +ヤシキ 矢鋪 +ヤシキ 屋舗(屋舖) +ヤシキ 家鋪 +ヤシキ 矢式 +ヤシキ 家舗 +ヤシキ 家式 +ヤシキ 家敷 +ヤシキ 八敷 +ヤシキ 屋式 +ヤシキ 谷鋪 +ヤシキ 野柴木 +ヤシキ 屋職 +ヤシキダ 屋敷田 +ヤシキダ 矢舗田 +ヤシキダニ 屋敷谷 +ヤシキノ 屋敷野 +ヤシキヒラ 屋敷平 +ヤシキムラ 屋敷村 +ヤシゲ 八重 +ヤシゲ 弥重 +ヤシゲ 彌重 +ヤシタ 矢下 +ヤシタ 屋下 +ヤシナ 八品 +ヤシバ 矢芝 +ヤシバ 矢柴 +ヤシマ 矢島 +ヤシマ 八島 +ヤシマ 矢嶋 +ヤシマ 谷島 +ヤシマ 八嶋 +ヤシマ 谷嶋 +ヤシマ 屋島 +ヤシマ 矢嶌 +ヤシマ 八洲 +ヤシマ 八嶌 +ヤシマ 屋嶋 +ヤジマ 矢島 +ヤジマ 八島 +ヤジマ 矢嶋 +ヤジマ 谷島 +ヤジマ 八嶋 +ヤジマ 谷嶋 +ヤジマ 家島 +ヤジマ 屋島 +ヤジマ 矢嶌 +ヤジマ 弥島 +ヤジマ 屋嶋 +ヤジマ 箭島 +ヤジマ 谷嶌 +ヤジマ 彌島 +ヤシモダ 矢下田 +ヤジモト 屋地元 +ヤジュウ 八重 +ヤジュウロウ 弥十郎 +ヤジリ 矢尻 +ヤシロ 八代 +ヤシロ 矢代 +ヤシロ 屋代 +ヤシロ 家城 +ヤシロ 八城 +ヤシロ 野城 +ヤシロ 矢城 +ヤシロ 社 +ヤシロ 屋城 +ヤシロ 谷城 +ヤシロ 谷代 +ヤシロ 弥城(彌城) +ヤシロ 家代 +ヤシロ 社城 +ヤシロ 冶城 +ヤシロ 弥代 +ヤシロ 陽城 +ヤシロギ 矢白木 +ヤシロギ 社樹 +ヤシロダ 八代田 +ヤシロダ 社田 +ヤシロダイ 八代醍 +ヤシロタニ 八代谷 +ヤシロダニ 八代谷 +ヤシロヤチ 社谷内 +ヤシン 矢新 +ヤジン 夜陣 +ヤス 安 +ヤス 八須 +ヤス 野洲 +ヤス 矢須 +ヤス 安士 +ヤス 野洌 +ヤス 屋須 +ヤス 野州 +ヤズ 谷津 +ヤズ 矢頭 +ヤズ 家寿 +ヤスアキ 安明 +ヤスアキ 安秋 +ヤスアミ 安阿弥(安阿彌) +ヤスイ 安井 +ヤスイ 安居 +ヤスイ 保井 +ヤスイ 保居 +ヤスイ 泰井 +ヤスイ 安威 +ヤスイ 康井 +ヤスイ 保位 +ヤスイ 昜居 +ヤスイエ 保家 +ヤスイエ 安家 +ヤスイケ 安池 +ヤスイケ 保池 +ヤスイシ 休石 +ヤスイシ 安石 +ヤスイダ 安井田 +ヤスイワ 安岩 +ヤスイワ 安居和 +ヤスウジ 安氏 +ヤスウジ 安姓 +ヤスウミ 安海 +ヤスウミ 保海 +ヤスウミ 康海 +ヤスウラ 保浦 +ヤスウラ 案浦 +ヤスウラ 安浦 +ヤスウラオカ 安浦岡 +ヤスエ 安江 +ヤスエ 泰江 +ヤスエ 安栄 +ヤスエ 保江 +ヤスエ 安恵(安惠) +ヤスエ 矢末 +ヤスエ 安榮 +ヤスエ 保恵 +ヤスエダ 安枝 +ヤスエダ 保枝 +ヤスオ 安保 +ヤスオ 安尾 +ヤスオ 保尾 +ヤスオカ 安岡 +ヤスオカ 保岡 +ヤスオカ 安陵 +ヤスオカ 泰岡 +ヤスオカ 泰丘 +ヤスオカ 八宗岡 +ヤスカ 安家 +ヤスガ 矢菅 +ヤスガ 安賀 +ヤズカ 矢塚 +ヤスカガ 安加賀 +ヤスカガワ 安カ川(カはカタカナ) +ヤスカガワ 安ケ川 +ヤスカガワ 安力川(力は漢字) +ヤスカガワ 安か川 +ヤスガキ 安垣 +ヤスカゲ 安影 +ヤスカゲ 安蔭 +ヤスカゼ 安風 +ヤスカタ 安形 +ヤスカタ 安方 +ヤスカタ 安酸 +ヤスカタ 安片 +ヤスガタ 安形 +ヤスガダイラ 安ケ平 +ヤスカネ 安周 +ヤスガネ 安懸 +ヤスガヒラ 安ケ平 +ヤスカミ 安上 +ヤスガミ 安上 +ヤスガミ 安神 +ヤスカワ 安川 +ヤスカワ 保川 +ヤスカワ 安河 +ヤスカワ 泰川 +ヤスカワ 康川 +ヤスガワ 安川 +ヤスカワウチ 安河内 +ヤスカワチ 安河内 +ヤスキ 安木 +ヤスキ 保木 +ヤスキ 安喜 +ヤスキ 安来(安來) +ヤスキ 安樹 +ヤスギ 安木 +ヤスギ 保木 +ヤスギ 八杉 +ヤスギ 矢杉 +ヤスギ 安来(安來) +ヤスキタ 安北 +ヤスキヨ 安清 +ヤスグチ 安口 +ヤスクニ 安国 +ヤスクニ 安國 +ヤスクニ 保国 +ヤスクニ 泰国 +ヤスクニ 保國 +ヤスクモ 安雲 +ヤスクラ 保倉 +ヤスクラ 安蔵 +ヤスクラ 安倉 +ヤスクラ 保蔵 +ヤスクラ 安藏 +ヤスクラ 保久良 +ヤスクリ 安栗 +ヤスグリ 安栗 +ヤスゲ 矢菅 +ヤスゲ 矢管 +ヤスコ 安子 +ヤスコウチ 安河内 +ヤスコウチ 安川内 +ヤスゴウチ 安河内 +ヤスコレ 安是 +ヤスサ 安佐 +ヤスザ 安座 +ヤスサカ 安坂 +ヤスザカ 安坂 +ヤスサキ 安崎 +ヤスザキ 保崎 +ヤスザキ 安崎 +ヤスサコ 安迫 +ヤスサト 安里 +ヤスザト 安里 +ヤスザネ 安実 +ヤスザネ 安實 +ヤスザネ 保実(保實) +ヤスザワ 安沢 +ヤスザワ 安澤 +ヤスザワ 保沢 +ヤスザワ 保澤 +ヤスシ 安士 +ヤスジ 保地 +ヤスシゲ 安重 +ヤスシタ 安下 +ヤスシタ 保下 +ヤスシマ 安島 +ヤスシマ 安嶋 +ヤスシマ 保島 +ヤスジマ 安島 +ヤスジマ 安嶋 +ヤスジマ 保島 +ヤスジマ 保嶋 +ヤスズカ 安塚 +ヤスズミ 安住 +ヤスズミ 安栖 +ヤスズミ 安澄 +ヤスタ 安田 +ヤスタ 保田 +ヤスタ 安多 +ヤスタ 保多 +ヤスダ 安田 +ヤスダ 保田 +ヤスダ 按田 +ヤスダ 泰田 +ヤスダ 安多 +ヤスダ 康田 +ヤスダ 保多 +ヤスダ 矢須田 +ヤスダ 家寿多(家壽多) +ヤスダ 靖田 +ヤスダ 休田 +ヤスダ 八寿田 +ヤスダイ 安台 +ヤスダイラ 安平 +ヤスタカ 安高 +ヤスタケ 安武 +ヤスタケ 安竹 +ヤスタケ 保竹 +ヤスタケ 保武 +ヤスタケ 安岳 +ヤスタダ 安只 +ヤスダテ 安舘 +ヤスダテ 安館 +ヤスタニ 保谷 +ヤスタニ 安谷 +ヤスタニ 康谷 +ヤスタニ 安谿 +ヤスタニヤ 安谷屋 +ヤズチ 矢土 +ヤスチカ 安近 +ヤスヅカ 安塚 +ヤスツグ 安次 +ヤスツネ 安恒 +ヤスツネ 安常 +ヤスデ 安出 +ヤスデ 保出 +ヤスデラ 安寺 +ヤスト 安戸 +ヤスド 安戸 +ヤストコ 安床 +ヤストミ 安富 +ヤストミ 安冨 +ヤストミ 保富 +ヤストミ 康富 +ヤストミ 保冨 +ヤスドミ 安富 +ヤスドミ 安冨 +ヤストメ 安留 +ヤスドメ 安留 +ヤストモ 安友 +ヤストモ 保智 +ヤストモ 康友 +ヤストモ 保友 +ヤストヨ 安豊 +ヤスナ 保名 +ヤスナ 安那 +ヤスナ 安名 +ヤスナカ 安中 +ヤスナカ 安仲 +ヤスナカ 泰中 +ヤスナカ 保中 +ヤスナガ 安永 +ヤスナガ 保永 +ヤスナガ 安長 +ヤスナガ 泰永 +ヤスナガ 康永 +ヤスナガ 易永 +ヤスナガ 保長 +ヤスナガ 昜永 +ヤスナミ 安並 +ヤスナミ 安波 +ヤスナミ 安浪 +ヤスナミ 休波 +ヤスナリ 安成 +ヤスナリ 保成 +ヤスナリ 康成 +ヤスニシ 安西 +ヤスニワ 安庭 +ヤスネ 安根 +ヤスノ 安野 +ヤスノ 安納 +ヤスノ 保野 +ヤスノ 泰野 +ヤスノ 康野 +ヤスノ 楊野 +ヤスノウ 安納 +ヤスノキ 安野木 +ヤスノブ 安延 +ヤスノブ 安信 +ヤスノブ 保信 +ヤスノベ 安延 +ヤスノリ 安則 +ヤスノリ 康乗(康乘) +ヤスバ 安場 +ヤスバ 休場(休塲) +ヤスバ 安庭 +ヤスバ 安葉 +ヤスバ 安馬 +ヤスバ 易葉 +ヤスハタ 安畑 +ヤスバヤシ 安林 +ヤスハラ 安原 +ヤスハラ 保原 +ヤスハラ 康原 +ヤスハラ 泰原 +ヤスヒ 安日 +ヤスヒコ 安彦 +ヤスヒサ 安久 +ヤスヒサ 保久 +ヤスヒラ 安平 +ヤスヒラ 保平 +ヤスヒラ 易平 +ヤスヒル 安昼 +ヤスヒロ 安広 +ヤスヒロ 安廣 +ヤスヒロ 保広 +ヤスヒロ 康広 +ヤスフク 安福 +ヤスフク 保福 +ヤスフサ 安房 +ヤスフジ 安藤 +ヤスブチ 安渕 +ヤスベ 安部 +ヤスホ 安保 +ヤスホ 安甫 +ヤスボ 安保 +ヤスボラ 保洞 +ヤスマ 安間 +ヤスマ 安摩 +ヤスマ 保間 +ヤスマ 矢須間 +ヤスマゴ 安孫 +ヤスマサ 安政 +ヤスマス 安増 +ヤスマス 泰増 +ヤスマツ 安松 +ヤスマツ 泰松 +ヤスマツ 康松 +ヤスマツタニ 安松谷(安枩谷) +ヤスマツヤ 安松谷(安枩谷) +ヤスマル 安丸 +ヤスミ 安宅 +ヤスミ 八角 +ヤスミ 安見 +ヤスミ 安味 +ヤスミ 八隅 +ヤスミ 矢住 +ヤスミ 保見 +ヤスミ 八住 +ヤスミ 休 +ヤスミ 屋住 +ヤスミ 保美 +ヤスミ 安美 +ヤスミ 易水 +ヤスミ 休見 +ヤスミ 矢角 +ヤスミ 矢隅 +ヤズミ 八隅 +ヤズミ 矢住 +ヤズミ 八住 +ヤズミ 屋住 +ヤズミ 矢積 +ヤスミイシ 休石 +ヤスミズ 安水 +ヤスミチ 保道 +ヤスミツ 安光 +ヤスミツ 保光 +ヤスミドウ 休堂 +ヤスミネ 安峯 +ヤスミネ 安峰 +ヤスミネ 安嶺 +ヤスミバ 休場(休塲) +ヤスミヤ 安宮 +ヤスミヤ 休宮 +ヤスムネ 安宗 +ヤスムネ 保宗 +ヤスムネ 安旨 +ヤスムネ 安棟 +ヤスムラ 安村 +ヤスムラ 保村 +ヤスムラ 康村 +ヤスムラ 泰村 +ヤスムラ 安邨 +ヤスムロ 安室 +ヤスモ 安雲 +ヤスモ 安毛 +ヤスモチ 安持 +ヤスモチ 保持 +ヤスモト 安本 +ヤスモト 安元 +ヤスモト 保本 +ヤスモト 康本 +ヤスモト 保元 +ヤスモト 安泉 +ヤスモト 八須元 +ヤスモト 靖本 +ヤスモリ 安森 +ヤスモリ 安守 +ヤスモリ 安盛 +ヤスモリ 保森 +ヤスモリ 安護 +ヤスモリ 康守 +ヤスモロ 安諸 +ヤスヤ 安屋 +ヤスヤ 保冶 +ヤスヤマ 安山 +ヤスヤマ 泰山 +ヤスヤマ 保山 +ヤスヤマ 康山 +ヤスユキ 安行 +ヤスヨシ 安吉 +ヤスヨシ 安好 +ヤスラ 保良 +ヤスラ 安良 +ヤスラオカ 安良岡 +ヤスラオカ 安楽岡(安樂岡) +ヤスラオカ 安羅岡 +ヤスラカ 安良賀 +ヤスラギ 安良城 +ヤスリ 保利 +ヤスロカ 安路賀 +ヤスワカ 安若 +ヤスワキ 保脇 +ヤスワタリ 安渡 +ヤスンバ 休場(休塲) +ヤセ 八瀬 +ヤセ 矢瀬 +ヤセ 矢勢 +ヤゼ 矢是 +ヤセオ 八瀬尾 +ヤセダ 八畝田 +ヤセバヤシ 八瀬林 +ヤセベ 八瀬辺(八瀬邉) +ヤセヤマ 八瀬山 +ヤソ 八十 +ヤソ 矢三 +ヤソ 矢曽 +ヤソウ 矢宗 +ヤソウ 八惣 +ヤゾウ 家蔵 +ヤソオ 弥十郎 +ヤソオカ 八十岡 +ヤソカワ 八十川 +ヤソカワ 八十河 +ヤソガワ 八十川 +ヤソギ 八十木 +ヤソシナ 八十科 +ヤソシマ 八十島 +ヤソシマ 八十嶋 +ヤソジマ 八十島 +ヤソジマ 八十嶋 +ヤソズミ 八十住 +ヤソセ 八十瀬 +ヤソタ 八十田 +ヤソダ 八十田 +ヤソタニ 弥三谷 +ヤソデ 八十出 +ヤソノ 弥園 +ヤソハチ 八十八 +ヤソハマ 八十浜(八十濱) +ヤソハラ 八十原 +ヤソヒロ 八十広 +ヤソブ 八十歩 +ヤソメ 八染 +ヤソヤマ 八十山 +ヤタ 野田 +ヤタ 矢田 +ヤタ 谷田 +ヤタ 屋田 +ヤタ 弥田 +ヤタ 箭田 +ヤタ 彌田 +ヤタ 矢多 +ヤダ 野田 +ヤダ 矢田 +ヤダ 八田 +ヤダ 谷田 +ヤダ 屋田 +ヤダ 弥田 +ヤダ 箭田 +ヤダ 彌田 +ヤダ 矢多 +ヤタイ 八明 +ヤダイ 矢代 +ヤタウチ 谷田内 +ヤダウラ 矢田浦 +ヤタカ 家高 +ヤタカ 谷高 +ヤタカ 矢高 +ヤダカ 家高 +ヤダカ 矢高 +ヤタガイ 八谷 +ヤタガイ 谷田貝 +ヤタガイ 矢田貝 +ヤタガイ 矢田谷 +ヤタガイ 八田谷 +ヤタガイ 谷田海 +ヤタガヤ 矢田ケ谷 +ヤタガワ 谷田川 +ヤタガワ 矢田川 +ヤタガワ 谷田河 +ヤタガワ 箭田川 +ヤタキ 矢滝 +ヤタキ 矢瀧 +ヤタグ 矢田具 +ヤタケ 矢竹 +ヤタケ 矢武 +ヤタケ 箭竹 +ヤタケ 弥武(彌武) +ヤタケ 八竹 +ヤタケ 矢岳 +ヤダケ 矢岳 +ヤタゴウ 矢田郷 +ヤタサキ 矢田崎 +ヤタザキ 矢田崎 +ヤタザワ 谷田沢 +ヤダチ 矢達 +ヤダツ 矢達 +ヤタテ 矢立 +ヤタテ 矢館 +ヤタテ 矢舘 +ヤダテ 矢館 +ヤダテ 矢舘 +ヤタニ 八谷 +ヤタニ 矢谷 +ヤタニ 家谷 +ヤタニ 矢田谷 +ヤタニ 弥谷 +ヤタニ 屋谷 +ヤタニ 八渓 +ヤダニ 八谷 +ヤダニ 矢谷 +ヤダニ 家谷 +ヤダニ 矢田谷 +ヤタヌシ 矢田主 +ヤタネ 屋種 +ヤタノ 八田野 +ヤタノ 矢田野 +ヤタバ 八田羽 +ヤタベ 谷田部 +ヤタベ 矢田部 +ヤタベ 八田部 +ヤタベ 矢田辺 +ヤタベ 谷田辺 +ヤタベ 矢多部 +ヤタボリ 矢田堀 +ヤタボリ 八田堀 +ヤダマ 矢玉 +ヤタミ 谷田海 +ヤタメ 矢田目 +ヤタメ 谷田目 +ヤダメ 矢田目 +ヤタモリ 矢田森 +ヤタヤ 矢田谷 +ヤタヤマ 矢田山 +ヤチ 谷内 +ヤチ 谷地 +ヤチ 谷池 +ヤチ 矢地 +ヤチ 谷知 +ヤチ 屋地 +ヤチ 家千 +ヤチ 矢知 +ヤチ 萢 +ヤヂ 谷地 +ヤヂ 矢地 +ヤチウネ 谷地畝 +ヤチエ 谷内江 +ヤチオ 谷内尾 +ヤチガイ 矢違 +ヤチガシラ 谷地頭 +ヤチカミ 谷内上 +ヤチガミ 谷内上 +ヤチカワ 谷内川 +ヤチク 八竹 +ヤチグチ 谷内口 +ヤチゴ 八児(八兒) +ヤチコウ 谷地幸 +ヤチコジマ 八千古嶋 +ヤチコジマ 八千古島 +ヤチサカ 谷内坂 +ヤチザカ 谷内坂 +ヤチシタ 谷内下 +ヤチタ 谷内田 +ヤチタ 谷地田 +ヤチダ 谷内田 +ヤチダ 谷地田 +ヤチダ 八千田 +ヤチタテ 谷地舘 +ヤチダテ 谷地館 +ヤチダテ 谷地舘 +ヤチデ 谷内出 +ヤチナカ 谷地中 +ヤチナカ 萢中 +ヤチヌマ 谷地沼 +ヤチノ 谷内野 +ヤチバタ 谷地端 +ヤチマエ 谷内前 +ヤチマタ 谷地又 +ヤチマタ 八地又 +ヤチムカイ 谷地向 +ヤチムカイ 谷内向 +ヤチムキ 谷地向 +ヤチムラ 谷地村 +ヤチモト 谷地元 +ヤチモト 谷内元 +ヤチモリ 谷地森 +ヤチヤマ 谷内山 +ヤチュウダ 谷中田 +ヤチュウダ 弥忠田 +ヤチヨ 八千代 +ヤツ 谷津 +ヤツ 八津 +ヤヅ 谷津 +ヤヅ 矢津 +ヤツイ 谷井 +ヤツイ 八ツ井 +ヤツイ 八井 +ヤツイシ 八石 +ヤツイワ 八岩 +ヤツイワ 八ツ岩 +ヤツウ 矢通 +ヤツウラ 八ツ浦 +ヤツエ 八杖 +ヤツオ 八尾 +ヤツオ 谷尾 +ヤツオ 八津尾 +ヤツオ 八ツ尾 +ヤツオカ 八岡 +ヤツカ 八塚 +ヤツカ 八束 +ヤツカ 谷塚 +ヤツカ 矢塚 +ヤツガ 八ツ賀 +ヤヅカ 八塚 +ヤヅカ 矢塚 +ヤツガキ 八垣 +ヤツガケ 八懸 +ヤツガケ 八掛 +ヤッカフ 八ケ婦 +ヤツカワ 八川 +ヤツカワ 八津川 +ヤツカワ 八河 +ヤツキ 八木 +ヤツキ 屋附 +ヤツキ 八記 +ヤツキ 八槻 +ヤツキ 八樹 +ヤツキ 矢附 +ヤツギ 八木 +ヤツギ 矢次 +ヤツギ 谷城 +ヤツギ 谷次 +ヤツギ 八次 +ヤツギ 矢継 +ヤツギ 八ツ木 +ヤツギ 屋次 +ヤツグ 矢次 +ヤツグチ 八津口 +ヤツクラ 谷津倉 +ヤツクラ 八鞍 +ヤツクラ 八津倉 +ヤッコ 八子 +ヤッコ 奴 +ヤツコシ 八越 +ヤツサカ 八坂 +ヤツザキ 八崎 +ヤツザキ 八ツ崎 +ヤツザキ 八嵜 +ヤツシ 八司 +ヤツジ 矢辻 +ヤツジ 八辻 +ヤツシゲ 八ツ繁 +ヤツシマ 八島 +ヤツシマ 八嶋 +ヤツシロ 八代 +ヤツシロ 八城 +ヤツシロ 八ツ代 +ヤツシロ 八つ代 +ヤツズカ 八束 +ヤツズカ 八ツ塚 +ヤツタ 八田 +ヤツダ 八田 +ヤツダ 谷田 +ヤツダ 矢津田 +ヤツダ 谷津田 +ヤツダ 八ツ田 +ヤツダ 谷ツ田 +ヤツダ 八津田 +ヤツタニ 八津谷 +ヤツチ 矢土 +ヤヅチ 矢土 +ヤヅツ 矢筒 +ヤツツカ 八塚 +ヤツツカ 八ツ塚 +ヤツヅカ 八塚 +ヤツヅカ 八束 +ヤツヅカ 八ツ塚 +ヤツド 八度 +ヤツナガ 八永 +ヤツナミ 八並 +ヤツナミ 八波 +ヤツナミ 八浪 +ヤツナミ 八ツ波 +ヤツネ 弥常 +ヤツネ 彌常 +ヤツノ 谷野 +ヤツハシ 八橋 +ヤツハシ 八ツ橋 +ヤツハシ 八津橋 +ヤツハタ 捌幡 +ヤツバヤシ 八林 +ヤツフサ 八房 +ヤツフジ 八藤 +ヤツフジ 八ツ藤 +ヤツブチ 八淵 +ヤツボ 矢壷 +ヤツボ 矢壺 +ヤツボシ 八ツ星 +ヤツボシ 八星 +ヤツマキ 八牧 +ヤツマタ 八津又 +ヤツマタ 八俣 +ヤヅミ 矢積 +ヤツミネ 八ツ峰 +ヤツミミ 八耳 +ヤツムラ 矢都村 +ヤツメン 八面 +ヤツモト 八本 +ヤツモト 八ツ本 +ヤツモト 八元 +ヤツモト 八ツ元 +ヤツモリ 八森 +ヤツモンジ 八文字 +ヤツヤ 八谷 +ヤツヤク 八ツ役 +ヤツヤナギ 八柳 +ヤツヤナギ 八ツ柳 +ヤツヤマ 八山 +ヤツヤマ 八ツ山 +ヤツリ 八釣 +ヤヅル 矢鶴 +ヤツルギ 八釼 +ヤツルギ 八剱 +ヤツルギ 八剣 +ヤツルギ 八劔(八劒) +ヤツルギ 八釖 +ヤデ 矢出 +ヤテハタ 八手幡 +ヤテマタ 八手亦 +ヤテラ 矢寺 +ヤデラ 矢寺 +ヤデン 矢伝(矢傳) +ヤト 谷戸 +ヤト 矢戸 +ヤト 矢渡 +ヤド 宿 +ヤド 屋戸 +ヤトイチ 雇地 +ヤドイワ 宿岩 +ヤトウ 谷藤 +ヤトウ 矢頭 +ヤトウ 矢藤 +ヤトウ 谷頭 +ヤトウ 八藤 +ヤトウ 弥藤 +ヤトウ 弥頭 +ヤトウ 箭頭 +ヤトウ 弥登 +ヤトウ 八登 +ヤトウ 矢垰 +ヤトウ 屋藤 +ヤトウ 八頭 +ヤトウ 矢峠 +ヤトウ 矢籐 +ヤトウゲ 八峠 +ヤトウゴ 八藤後 +ヤトウジ 八頭司 +ヤトウマル 八藤丸 +ヤドウマル 矢動丸 +ヤドオリ 矢通 +ヤドカ 宿賀 +ヤトギ 八戸木 +ヤトギ 矢都木 +ヤトク 矢徳 +ヤドグチ 宿口 +ヤトコ 矢床 +ヤトコロ 屋所 +ヤトコロ 八所 +ヤトコロ 矢所 +ヤドコロ 谷所 +ヤドコロ 屋所 +ヤドコロ 矢所 +ヤドシロ 宿城 +ヤトダ 矢戸田 +ヤドタニ 宿谷 +ヤトネ 谷根 +ヤトノ 谷野 +ヤドヒサ 宿久 +ヤドマエ 宿前 +ヤドマツ 宿松 +ヤトミ 弥富 +ヤトミ 矢富 +ヤトミ 矢冨 +ヤトミ 家富 +ヤトミ 弥冨 +ヤトミ 彌富 +ヤトミ 彌冨 +ヤトミ 八富 +ヤドミ 弥富 +ヤドミ 矢富 +ヤドミ 矢冨 +ヤドミ 弥冨 +ヤドミ 宿見 +ヤドミ 彌冨 +ヤドムラ 宿村 +ヤトメ 矢留 +ヤドメ 矢留 +ヤドメ 宿女 +ヤトモ 八朝 +ヤドモト 宿本 +ヤドヤ 宿谷 +ヤドヤ 宿屋 +ヤトリ 八鳥 +ヤトリ 矢取 +ヤトリ 矢鳥 +ヤドリ 宿利 +ヤドリ 宿里 +ヤドリハラ 宿利原 +ヤナ 簗 +ヤナ 梁 +ヤナ 八名 +ヤナ 魚梁 +ヤナ 矢奈 +ヤナイ 谷内 +ヤナイ 柳井 +ヤナイ 矢内 +ヤナイ 箭内 +ヤナイ 野内 +ヤナイ 柳内 +ヤナイ 梁井 +ヤナイ 楊井 +ヤナイ 屋内 +ヤナイ 家内 +ヤナイ 簗井 +ヤナイ 柳居 +ヤナイ 箭井 +ヤナイエ 柳家 +ヤナイグチ 谷内口 +ヤナイケ 柳池 +ヤナイケ 屋名池 +ヤナイズミ 柳泉 +ヤナイダ 柳田 +ヤナイダ 柳井田 +ヤナイタニ 柳井谷 +ヤナイダニ 柳井谷 +ヤナイヅ 柳津 +ヤナイヅ 柳井津 +ヤナイヅミ 柳泉 +ヤナイド 柳井戸 +ヤナイハラ 矢内原 +ヤナイハラ 柳井原 +ヤナイバラ 矢内原 +ヤナウチ 柳内 +ヤナウラ 柳浦 +ヤナウラ 梁浦 +ヤナウラ 簗浦 +ヤナエ 柳江 +ヤナエ 谷苗 +ヤナエ 家苗 +ヤナオ 柳尾 +ヤナオカ 柳岡 +ヤナオカ 梁岡 +ヤナカ 谷中 +ヤナカ 家中 +ヤナカ 谷仲 +ヤナカ 矢中 +ヤナカ 矢仲 +ヤナカ 屋仲 +ヤナカ 屋中 +ヤナカ 弥中(彌中) +ヤナカ 箭中 +ヤナガ 弥永 +ヤナガ 矢永 +ヤナガ 八長 +ヤナガ 彌永 +ヤナガ 矢長 +ヤナガ 弥長 +ヤナガキ 柳垣 +ヤナガサ 柳笠 +ヤナガセ 柳瀬 +ヤナガセ 柳ケ瀬 +ヤナガセ 柳河瀬 +ヤナガセ 柳賀瀬 +ヤナガツボ 柳坪 +ヤナカミ 柳上 +ヤナガミ 柳上 +ヤナガミズ 柳ケ水 +ヤナカワ 柳川 +ヤナカワ 梁川 +ヤナカワ 簗川 +ヤナガワ 柳川 +ヤナガワ 梁川 +ヤナガワ 柳河 +ヤナガワ 簗川 +ヤナガワ 楊川 +ヤナガワ 梁河 +ヤナガワ 矢名川 +ヤナガワ 楊河 +ヤナガワ 𥱋川 +ヤナガワセ 柳川瀬 +ヤナガワヤ 柳川屋 +ヤナキ 梁木 +ヤナキ 簗木 +ヤナギ 柳 +ヤナギ 梁木 +ヤナギ 柳木 +ヤナギ 簗木 +ヤナギ 八名木 +ヤナギ 野柳 +ヤナギ 矢泙 +ヤナギ 楊木 +ヤナギイ 柳井 +ヤナギイシ 柳石 +ヤナギイズミ 柳泉 +ヤナギイタ 柳板 +ヤナギウチ 柳内 +ヤナギウラ 柳浦 +ヤナギエ 柳衛 +ヤナギエダ 柳枝 +ヤナギオ 柳尾 +ヤナギオオジ 柳大路 +ヤナギオカ 柳岡 +ヤナギカワ 柳川 +ヤナギガワ 柳川 +ヤナギクイダ 柳杭田 +ヤナギグイダ 柳杭田 +ヤナギグチ 柳口 +ヤナギクボ 柳久保 +ヤナギクボ 柳窪 +ヤナギコウ 柳幸 +ヤナギコウ 柳香 +ヤナギサカ 柳坂 +ヤナギザカ 柳坂 +ヤナギサキ 柳崎 +ヤナギサキ 柳咲 +ヤナギザキ 柳崎 +ヤナギサコ 柳迫 +ヤナギサト 柳里 +ヤナギサワ 柳沢 +ヤナギサワ 柳澤 +ヤナギザワ 柳沢 +ヤナギザワ 柳澤 +ヤナギサワヤ 柳沢屋 +ヤナギシズ 柳静 +ヤナギシズク 柳雫 +ヤナギシタ 柳下 +ヤナギシマ 柳島 +ヤナギシマ 柳嶋 +ヤナギジマ 柳島 +ヤナギズル 柳水流 +ヤナギセ 柳瀬 +ヤナギセ 柳世 +ヤナギソ 柳曽 +ヤナギソ 柳蘓 +ヤナギソノ 柳園(柳薗) +ヤナギゾノ 柳園(柳薗) +ヤナキタ 柳北 +ヤナギタ 柳田 +ヤナギタ 柳多 +ヤナギタ 柳木田 +ヤナギダ 柳田 +ヤナギダ 柳太 +ヤナギタイ 柳平 +ヤナギタイラ 柳平 +ヤナギダイラ 柳平 +ヤナギタケ 柳武 +ヤナギタテ 柳館 +ヤナギタテ 柳舘 +ヤナギダテ 柳館 +ヤナギダテ 柳舘 +ヤナギダテ 柳立 +ヤナギタニ 柳谷 +ヤナギダニ 柳谷 +ヤナギダレ 柳垂 +ヤナギツ 柳津 +ヤナギヅ 柳津 +ヤナギツボ 柳坪 +ヤナギヅメ 柳詰 +ヤナギツル 柳鶴 +ヤナギヅル 柳鶴 +ヤナギデラ 柳寺 +ヤナギド 柳戸 +ヤナギドウ 柳堂 +ヤナギヌマ 柳沼 +ヤナギネ 柳根 +ヤナギノ 柳野 +ヤナギノ 柳ノ +ヤナギノ 柳農 +ヤナギノウチ 柳之内 +ヤナギハ 柳葉 +ヤナギバ 柳場 +ヤナギバ 柳葉 +ヤナギバコ 柳箱 +ヤナギハシ 柳橋 +ヤナギハシ 楊箸 +ヤナギハシ 柳箸 +ヤナギバシ 柳橋 +ヤナギバシ 楊箸 +ヤナギバシ 橋 +ヤナギバシ 柳箸 +ヤナギハタ 柳畑 +ヤナギハナ 柳花 +ヤナギハマ 柳浜 +ヤナギバヤシ 柳林 +ヤナギハラ 柳原 +ヤナギハラ 楊原 +ヤナギハラ 桺原 +ヤナギバラ 柳原 +ヤナギヒデ 柳秀 +ヤナギヒラ 柳平 +ヤナギブチ 柳渕 +ヤナギブチ 柳淵 +ヤナギブロ 柳風呂 +ヤナギベップ 柳別府 +ヤナギボウ 柳坊 +ヤナギホリ 柳堀 +ヤナギボリ 柳堀 +ヤナギマチ 柳町 +ヤナギマツ 柳松 +ヤナギマル 柳丸 +ヤナギミチ 柳道 +ヤナギムラ 柳村 +ヤナギムロ 柳室 +ヤナギモト 柳本 +ヤナギモト 柳元 +ヤナギモリ 柳森 +ヤナギヤ 柳谷 +ヤナギヤ 柳屋 +ヤナギヤ 柳矢 +ヤナギヤチ 柳谷内 +ヤナギヤマ 柳山 +ヤナギワタリ 柳渡 +ヤナギワラ 柳原 +ヤナクイダ 柳杭田 +ヤナグイダ 柳杭田 +ヤナグチ 柳口 +ヤナグチ 簗口 +ヤナクラ 柳倉 +ヤナグラ 柳倉 +ヤナゴ 柳子 +ヤナゴウ 柳郷 +ヤナサカ 柳坂 +ヤナサキ 梁崎 +ヤナザキ 柳崎 +ヤナザキ 簗崎 +ヤナサコ 柳迫 +ヤナサコ 簗迫 +ヤナサワ 柳澤 +ヤナサワ 梁澤 +ヤナザワ 柳沢 +ヤナザワ 柳澤 +ヤナザワ 梁沢 +ヤナザワ 梁澤 +ヤナジ 柳路 +ヤナジ 梁次 +ヤナジ 梁治 +ヤナシタ 柳下 +ヤナシマ 梁島 +ヤナシマ 簗島 +ヤナシマ 簗嶋 +ヤナシマ 梁嶋 +ヤナシマ 矢名島 +ヤナジマ 簗嶋 +ヤナシミズ 柳清水 +ヤナセ 柳瀬 +ヤナセ 簗瀬 +ヤナセ 梁瀬 +ヤナセ 柳清 +ヤナセ 箙瀬 +ヤナセ 矢那瀬 +ヤナセ 柳勢 +ヤナセ 瀬 +ヤナセ 𥱋瀬 +ヤナセコ 柳迫 +ヤナソ 柳曽 +ヤナタ 簗田 +ヤナタ 梁田 +ヤナダ 柳田 +ヤナダ 簗田 +ヤナダ 梁田 +ヤナダ 家名田 +ヤナダ 矢灘 +ヤナタケ 柳武 +ヤナタケ 柳竹 +ヤナタニ 簗谷 +ヤナダニ 柳谷 +ヤナチ 梁池 +ヤナチ 柳池 +ヤナチ 梁地 +ヤナチ 簗地 +ヤナツ 柳津 +ヤナツボ 柳坪 +ヤナヅメ 柳詰 +ヤナヅメ 簗詰 +ヤナデラ 柳寺 +ヤナドオリ 柳通 +ヤナトリ 梁取 +ヤナトリ 簗取 +ヤナドリ 梁取 +ヤナドリ 簗取 +ヤナドリ 柳取 +ヤナドリ 柳通 +ヤナドリ 柳鳥 +ヤナノ 梁野 +ヤナバ 簗場 +ヤナバ 柳場 +ヤナバ 柳葉 +ヤナバ 梁場 +ヤナバ 矢名葉 +ヤナバ 簗塲 +ヤナハシ 柳橋 +ヤナハシ 八七橋 +ヤナバシ 柳橋 +ヤナハマ 柳浜 +ヤナハマ 栁濱 +ヤナハラ 柳原 +ヤナハラ 梁原 +ヤナヒラ 柳平 +ヤナヒロ 柳弘 +ヤナブ 柳父 +ヤナブチ 柳渕 +ヤナブチ 柳淵 +ヤナブチ 梁淵 +ヤナベ 矢辺 +ヤナベ 柳辺 +ヤナベ 矢鍋 +ヤナベ 簗部 +ヤナベ 柳部 +ヤナベ 家鍋 +ヤナベ 矢邉 +ヤナベ 梁部 +ヤナベ 柳邊 +ヤナベ 柳邉 +ヤナミ 八並 +ヤナミ 八波 +ヤナミ 八浪 +ヤナミ 矢浪 +ヤナミ 屋並 +ヤナミ 箭浪 +ヤナミ 矢波 +ヤナミ 家並 +ヤナミ 箭波 +ヤナミサワ 柳見沢 +ヤナミサワ 柳美沢 +ヤナミサワ 柳美澤 +ヤナムラ 柳村 +ヤナムラ 梁村 +ヤナムラ 谷内村 +ヤナモト 柳本 +ヤナモト 柳元 +ヤナモト 梁本 +ヤナモト 梁元 +ヤナモト 簗本 +ヤナモリ 柳森 +ヤナモリ 梁守 +ヤナヤマ 柳山 +ヤナリ 屋成 +ヤナリ 矢成 +ヤナリ 家成 +ヤナル 矢鳴 +ヤナレ 家馴 +ヤナワキ 簗脇 +ヤナワキ 梁脇 +ヤナワケ 柳分 +ヤニシ 矢西 +ヤニタ 矢仁田 +ヤニュウ 谷入 +ヤニワ 矢庭 +ヤヌキ 矢貫 +ヤヌマ 矢沼 +ヤネ 矢根 +ヤネ 家根 +ヤネ 屋根 +ヤネ 谷根 +ヤネ 屋祢 +ヤネ 家祢 +ヤネ 屋禰 +ヤネ 家禰 +ヤネ 家彌 +ヤネウチ 屋根内 +ヤネウチ 家根内 +ヤネカワ 家根川 +ヤネグチ 家根口 +ヤネサ 屋祢佐 +ヤネサ 屋根佐 +ヤネシタ 屋根下 +ヤネシタ 屋祢下 +ヤネシタ 屋称下 +ヤネタ 屋根田 +ヤネダ 屋根田 +ヤネダ 家根田 +ヤネタニ 家根谷 +ヤネタニ 屋根谷 +ヤネナカ 屋根中 +ヤネハシ 家根橋 +ヤネハラ 家根原 +ヤネヒロ 矢根広 +ヤネムラ 家根村 +ヤネモト 屋根本 +ヤネモト 家根本 +ヤネモト 屋祢本 +ヤネヤ 家根谷 +ヤネヤ 屋根谷 +ヤノ 矢野 +ヤノ 谷野 +ヤノ 箭野 +ヤノ 八野 +ヤノ 矢納 +ヤノ 矢能 +ヤノ 矢埜 +ヤノ 屋野 +ヤノ 家野 +ヤノ 箟 +ヤノ 矢農 +ヤノ 矢之 +ヤノ 弥野 +ヤノ 彌野 +ヤノ 椰野 +ヤノイ 八野井 +ヤノウ 矢納 +ヤノウ 矢能 +ヤノウ 家納 +ヤノウ 矢農 +ヤノウ 屋納 +ヤノウ 八納 +ヤノウ 野納 +ヤノウ 弥納 +ヤノウエ 矢野上 +ヤノウチ 矢野内 +ヤノウラ 矢ノ浦 +ヤノオ 矢野尾 +ヤノガミ 矢ノ上 +ヤノカワ 矢野川 +ヤノカワ 矢ノ川 +ヤノガワ 矢野川 +ヤノガワ 矢ノ川 +ヤノキ 矢之貴 +ヤノキ 矢ノ木 +ヤノキ 矢ノ貴 +ヤノクチ 矢野口 +ヤノクチ 矢ノ口 +ヤノグチ 矢野口 +ヤノグチ 矢ノ口 +ヤノクラ 矢ノ倉 +ヤノクラ 矢野倉 +ヤノサカ 矢野坂 +ヤノサキ 矢ノ崎 +ヤノサキ 矢野崎 +ヤノザキ 矢野崎 +ヤノサワ 矢ノ沢 +ヤノサワ 矢の沢 +ヤノサワ 矢野澤 +ヤノザワ 矢野沢 +ヤノザワ 矢野澤 +ヤノシ 矢ノ師 +ヤノシタ 矢野下 +ヤノシタ 矢ノ下 +ヤノシタ 矢の下 +ヤノシマ 矢ノ島 +ヤノシマ 矢野島 +ヤノシロ 箭代 +ヤノダ 八野田 +ヤノタカ 矢之高 +ヤノタニ 矢ノ谷 +ヤノト 矢ノ登 +ヤノトウ 矢野東 +ヤノドウ 矢野堂 +ヤノナカ 矢ノ中 +ヤノネ 矢野根 +ヤノネ 矢ノ根 +ヤノハラ 矢箆原 +ヤノハラ 矢野原 +ヤノハラ 矢箟原 +ヤノハラ 屋野原 +ヤノハラ 矢篦原 +ヤノヒラ 矢野平 +ヤノブ 矢延 +ヤノブ 矢信 +ヤノブ 家信 +ヤノベ 矢延 +ヤノベ 弥延 +ヤノベ 彌延 +ヤノホ 矢方 +ヤノホウ 矢方 +ヤノマ 矢野間 +ヤノマ 矢野馬 +ヤノマル 屋野丸 +ヤノムカイ 矢ノ向 +ヤノメ 矢野目 +ヤノメ 矢ノ目 +ヤノメ 矢之目 +ヤノメ 矢目 +ヤノメ 矢の目 +ヤノモト 矢野元 +ヤノモト 家野本 +ヤノモト 矢ノ本 +ヤノモト 矢野本 +ヤノモリ 矢野森 +ヤバ 八馬 +ヤバ 矢場 +ヤバ 矢羽 +ヤハギ 矢作 +ヤハギ 矢萩 +ヤハギ 矢矧 +ヤハギ 谷萩 +ヤハギ 八作 +ヤハギ 矢羽木 +ヤハギ 矢削 +ヤハゲ 八羽毛 +ヤハシ 矢橋 +ヤハシ 八橋 +ヤバシ 矢橋 +ヤハシリ 矢走 +ヤハズ 矢括 +ヤハズ 箭筈 +ヤハズ 八筈 +ヤハズ 矢筈 +ヤハズ 八括 +ヤハズノ 矢筈野 +ヤバセ 八橋 +ヤバセ 矢走 +ヤバセ 矢場瀬 +ヤバセ 矢馳 +ヤハタ 八幡 +ヤハタ 谷畑 +ヤハタ 矢羽田 +ヤハタ 矢幡 +ヤハタ 矢畑 +ヤハタ 八畑 +ヤハタ 矢羽多 +ヤハタ 八端 +ヤハタ 八旗 +ヤハタ 谷幡 +ヤハタ 八波田 +ヤハタ 八畠 +ヤハタ 矢旗 +ヤハタ 八籏 +ヤバタ 谷畑 +ヤバタ 矢羽田 +ヤバタ 矢幡 +ヤバタ 矢端 +ヤバタ 矢畑 +ヤバタ 矢場田 +ヤハタガキ 八幡垣 +ヤハタギ 八幡木 +ヤハタケ 八畠 +ヤハタノ 八幡野 +ヤハタバラ 八幡原 +ヤハタヤ 八幡屋 +ヤハチ 矢八 +ヤハチ 彌八 +ヤハナ 矢花 +ヤバナ 矢花 +ヤハナシ 矢放 +ヤバネ 矢羽根 +ヤハノ 矢羽野 +ヤハバ 矢羽々 +ヤハバ 矢幅 +ヤハバ 矢羽羽 +ヤハマ 八浜 +ヤハマ 矢浜 +ヤバヤシ 屋林 +ヤハラ 谷原 +ヤハラ 矢原 +ヤハラ 箭原 +ヤハラ 八原 +ヤバラ 谷原 +ヤバラ 矢原 +ヤバラ 屋原 +ヤハラダ 谷原田 +ヤハリ 八張 +ヤハリ 矢張 +ヤバリ 八張 +ヤバリ 矢張 +ヤハンダ 矢半田 +ヤビキ 矢引 +ヤビキ 矢挽 +ヤビキ 箭引 +ヤビキ 矢曳 +ヤヒク 屋比久 +ヤビク 屋比久 +ヤビク 矢比久 +ヤヒコ 谷彦 +ヤヒコ 矢彦 +ヤヒコザワ 矢彦沢(矢彦澤) +ヤヒサ 屋久 +ヤヒツ 矢櫃 +ヤビツ 矢櫃 +ヤヒロ 八尋 +ヤヒロ 八広 +ヤヒロ 屋広 +ヤヒロ 八廣 +ヤヒロブチ 八尋渕 +ヤヒロブチ 八尋淵 +ヤフ 矢府 +ヤブ 矢部 +ヤブ 薮 +ヤブ 藪 +ヤブ 養父 +ヤブ 籔 +ヤブ 屋部 +ヤブ 矢武 +ヤブ 弥武(彌武) +ヤブ 矢不 +ヤブ 屋武 +ヤブ 八夫 +ヤブ 野府 +ヤブイ 薮井 +ヤブイ 藪井 +ヤブイ 籔井 +ヤブイ 野夫井 +ヤブウエ 薮上 +ヤブウエ 藪上 +ヤブウエ 薮植 +ヤブウエ 籔植 +ヤブウエ 藪植 +ヤブウチ 薮内 +ヤブウチ 藪内 +ヤブウチ 籔内 +ヤブウマ 籔馬 +ヤブウラ 薮裏 +ヤブウラ 籔裏 +ヤブエ 薮江 +ヤブエ 藪江 +ヤブオカ 薮岡 +ヤブオカ 藪岡 +ヤブオシ 藪押 +ヤブオシ 薮押 +ヤブオシ 籔押 +ヤブガキ 薮垣(藪垣) +ヤブガキ 籔垣 +ヤブカゲ 薮影 +ヤブカゲ 藪影 +ヤブガサキ 薮ケ崎 +ヤブガサキ 籔ケ崎 +ヤブガサキ 藪ケ崎 +ヤブカネ 薮兼 +ヤブカネ 藪兼 +ヤブカミ 薮上 +ヤブカミ 藪上 +ヤブカミ 籔上 +ヤブガミ 薮上 +ヤブガミ 藪上 +ヤブカワ 薮川 +ヤブカワ 籔川 +ヤブカワ 藪川 +ヤブキ 矢吹 +ヤブキ 薮木 +ヤブキ 矢葺 +ヤブキ 藪木 +ヤブキ 薮亀 +ヤブキ 藪亀 +ヤブキ 箭吹 +ヤブキ 籔木 +ヤブキ 屋葺 +ヤブキ 屋吹 +ヤブキ 谷吹 +ヤブキ 八吹 +ヤブキ 籔亀 +ヤブキシ 籔岸 +ヤブギシ 薮岸 +ヤブギシ 藪岸 +ヤブキタ 藪北 +ヤブギワ 薮際 +ヤブグチ 薮口 +ヤブグチ 藪口 +ヤブグチ 籔口 +ヤブコシ 薮越 +ヤブコシ 薮腰 +ヤブコシ 藪越 +ヤブコシ 籔腰 +ヤブコシ 藪腰 +ヤブコシ 籔越 +ヤブサ 矢房 +ヤブサカ 薮坂(藪坂) +ヤブサカ 薮阪 +ヤブサキ 藪崎 +ヤブサキ 薮崎 +ヤブサキ 八武崎 +ヤブサキ 籔崎 +ヤブサキ 薮嵜 +ヤブサキ 藪嵜 +ヤブザキ 藪崎 +ヤブザキ 薮崎 +ヤブサコ 薮嶒 +ヤブサコ 籔嶒 +ヤブサメ 鏑流馬 +ヤブサワ 薮沢 +ヤフジ 八藤 +ヤブシ 矢伏 +ヤブシタ 薮下 +ヤブシタ 藪下 +ヤブシタ 籔下 +ヤブシマ 籔島 +ヤブシマ 藪島(薮島) +ヤフセ 矢伏 +ヤブセ 矢伏 +ヤブセ 八伏 +ヤフソ 屋富祖 +ヤフソ 屋冨祖 +ヤフソ 屋富租 +ヤフソ 屋冨租 +ヤブゾエ 薮添 +ヤブゾエ 籔添 +ヤブゾエ 藪添 +ヤブタ 薮田 +ヤブタ 藪田 +ヤブタ 籔田 +ヤブタニ 薮谷 +ヤブタニ 藪谷 +ヤブタニ 籔谷 +ヤブチ 矢淵 +ヤブチ 矢渕 +ヤブチ 屋淵 +ヤブチ 屋渕 +ヤブチ 薮地 +ヤブチ 籔地 +ヤブチ 藪地 +ヤブツカ 藪塚 +ヤブツカ 薮塚 +ヤブツカ 籔塚 +ヤブヅカ 藪塚 +ヤブヅカ 薮塚 +ヤブツジ 薮辻 +ヤブツジ 藪辻 +ヤブデ 薮出 +ヤブデ 籔出 +ヤブトコ 薮床 +ヤブナカ 薮中 +ヤブナカ 藪中 +ヤブナカ 籔中 +ヤブナカ 藪仲 +ヤブナカ 薮仲 +ヤブナカ 薮名香(藪名香) +ヤブナカ 籔仲 +ヤブナガ 薮長(藪長) +ヤブナガ 藪永(薮永) +ヤブナミ 薮波 +ヤブナミ 薮並 +ヤブナミ 藪並 +ヤブニシ 薮西 +ヤブニシ 藪西 +ヤフネ 矢船 +ヤフネ 八舟 +ヤフネ 八船 +ヤフネ 矢舟 +ヤフネ 矢舩 +ヤブネ 薮根 +ヤブネ 矢船 +ヤブネ 藪根 +ヤブネ 籔根 +ヤブノ 薮野 +ヤブノ 藪野 +ヤブノ 籔野 +ヤブノ 薮納(藪納) +ヤブノ 薮ノ(藪ノ) +ヤブノウ 薮納(藪納) +ヤブノウチ 薮ノ内 +ヤブノウチ 薮之内 +ヤブノウチ 籔之内 +ヤブノウチ 藪ノ内 +ヤブノウチ 藪之内 +ヤブノシタ 薮ノ下 +ヤブノモト 薮之本 +ヤブノモト 薮ノ本 +ヤブノモト 藪之本 +ヤブハシ 藪端 +ヤブハタ 薮端 +ヤブハタ 籔端 +ヤブハタ 藪端 +ヤブハナ 薮花 +ヤブハナ 籔花 +ヤブハナ 藪花 +ヤブバヤシ 薮林 +ヤブバヤシ 藪林 +ヤブバヤシ 籔林 +ヤブハラ 薮原 +ヤブハラ 藪原 +ヤブハラ 籔原 +ヤブフチ 薮渕 +ヤブフチ 籔渕(籔淵) +ヤブホリ 薮堀 +ヤブホリ 籔堀 +ヤブマ 藪馬 +ヤブマエ 薮前 +ヤブマエ 藪前 +ヤブミ 薮見 +ヤブミ 籔見 +ヤブミ 藪見 +ヤブムラ 薮村 +ヤブモト 薮本 +ヤブモト 籔本 +ヤブモト 藪本 +ヤブモト 薮元 +ヤブモト 藪元 +ヤブモト 籔元 +ヤブヤ 薮谷 +ヤブヤ 藪谷 +ヤブヤマ 薮山 +ヤブヤマダ 薮山田 +ヤブヤマダ 藪山田 +ヤフル 矢普留 +ヤブワキ 薮脇 +ヤブワキ 藪脇 +ヤブワキ 籔脇 +ヤベ 矢部 +ヤベ 八戸 +ヤベ 谷部 +ヤベ 屋部 +ヤベ 矢辺 +ヤベ 八部 +ヤベ 家辺 +ヤベ 家部 +ヤベ 夜部 +ヤベ 屋辺 +ヤベ 矢屏 +ヤベ 谷郶 +ヤベ 矢邉 +ヤベ 家邊 +ヤベ 家邉 +ヤベ 八辺 +ヤベ 矢邊 +ヤヘイ 野平 +ヤベイ 矢部井 +ヤベカワ 矢部川 +ヤベタ 矢部田 +ヤベノ 谷部野 +ヤベノ 八部野 +ヤホ 矢帆 +ヤボ 屋保 +ヤホコ 矢鉾 +ヤホダ 屋舗田 +ヤボラ 家洞 +ヤボリ 矢堀 +ヤマ 山 +ヤマ 矢間 +ヤマ 矢問 +ヤマア 山阿 +ヤマアイ 山合 +ヤマアイ 山相 +ヤマアキ 山秋 +ヤマアケ 山明 +ヤマアサ 山浅 +ヤマアシ 山足 +ヤマアタリ 山当 +ヤマアト 山跡 +ヤマイ 山井 +ヤマイ 山居 +ヤマイエ 山家 +ヤマイケ 山池 +ヤマイシ 山石 +ヤマイズミ 山泉 +ヤマイセ 山伊勢 +ヤマイタ 山板 +ヤマイチ 山市 +ヤマイチ 山一 +ヤマイデ 山出 +ヤマイマ 山今 +ヤマイリ 山入 +ヤマイワ 山岩 +ヤマウ 山卯 +ヤマウエ 山上 +ヤマウエ 山植 +ヤマウジ 山氏 +ヤマウチ 山内 +ヤマウチ 山打 +ヤマウツリ 山移 +ヤマウネ 山畦 +ヤマウバ 山姥 +ヤマウミ 山海 +ヤマウメ 山梅 +ヤマウラ 山浦 +ヤマウラ 山裏 +ヤマエ 山江 +ヤマエ 山栄 +ヤマエイ 山営 +ヤマエダ 山枝 +ヤマエモリ 山衛守 +ヤマオ 山尾 +ヤマオ 山王 +ヤマオ 山雄 +ヤマオイ 山老 +ヤマオイ 山生 +ヤマオウ 山王 +ヤマオウマル 山王丸 +ヤマオオジ 山大路 +ヤマオカ 山岡 +ヤマオカ 山丘 +ヤマオキ 山沖 +ヤマオキ 山置 +ヤマオク 山奥 +ヤマオダ 山小田 +ヤマオツ 山乙 +ヤマオト 山音 +ヤマオモテ 山表 +ヤマオリ 山折 +ヤマカ 山家 +ヤマカ 山鹿 +ヤマカ 山香 +ヤマカ 山加 +ヤマカ 山佳 +ヤマガ 山家 +ヤマガ 山賀 +ヤマガ 山鹿 +ヤマガ 山我 +ヤマガ 山香 +ヤマガ 山佳 +ヤマガ 山荷 +ヤマカイ 山貝 +ヤマガイ 山貝 +ヤマガイチ 山垣内 +ヤマガイト 山垣内 +ヤマガキ 山垣 +ヤマガキ 山柿 +ヤマガキウチ 山垣内 +ヤマカク 山角 +ヤマカケ 山懸 +ヤマカゲ 山影 +ヤマカゲ 山蔭 +ヤマカゲ 山陰 +ヤマカゲ 山景 +ヤマガケ 山懸 +ヤマカジ 山梶 +ヤマカジ 山鍛治 +ヤマガジョウ 山ケ城 +ヤマガシラ 山頭 +ヤマガシロ 山ケ城 +ヤマカズ 山数 +ヤマカセ 山綛 +ヤマカゼ 山風 +ヤマカタ 山形 +ヤマカタ 山方 +ヤマカタ 山片 +ヤマカタ 山肩 +ヤマガタ 山形 +ヤマガタ 山県 +ヤマガタ 山縣 +ヤマガタ 山方 +ヤマガタ 山片 +ヤマガタ 山懸 +ヤマガタ 山肩 +ヤマガタ 山潟 +ヤマガタ 山泻 +ヤマガタ 山像 +ヤマガタヤ 山形谷 +ヤマガタヤ 山形屋 +ヤマカツ 山勝 +ヤマカド 山門 +ヤマカド 山角 +ヤマカネ 山金 +ヤマガノ 山ケ野 +ヤマガハナ 山ケ鼻 +ヤマカベ 山下部 +ヤマカベ 山壁 +ヤマカベ 山鹿辺(山鹿邊) +ヤマカミ 山上 +ヤマカミ 山神 +ヤマガミ 山上 +ヤマガミ 山神 +ヤマカメ 山亀 +ヤマガメ 山亀 +ヤマガヤ 山家谷 +ヤマガラ 山柄 +ヤマカワ 山川 +ヤマカワ 山河 +ヤマカワ 八間川 +ヤマガワ 山川 +ヤマガワ 山側 +ヤマガン 山元 +ヤマキ 山城 +ヤマキ 八巻 +ヤマキ 山木 +ヤマキ 山来(山耒) +ヤマキ 矢巻 +ヤマキ 八牧 +ヤマキ 山喜 +ヤマキ 山奇 +ヤマキ 山鬼 +ヤマキ 八槙 +ヤマキ 八槇 +ヤマキ 山橲 +ヤマキ 八卷 +ヤマキ 山巻 +ヤマキ 山岐 +ヤマキ 山季 +ヤマキ 山樹 +ヤマキ 山來 +ヤマキ 山竒 +ヤマキ 八万木 +ヤマキ 矢牧 +ヤマギ 山岸 +ヤマギ 山城 +ヤマギ 山木 +ヤマギ 山樹 +ヤマキシ 山岸 +ヤマギシ 山岸 +ヤマギシ 山崖 +ヤマギシ 山㟁 +ヤマキタ 山北 +ヤマキタ 山木田 +ヤマキタ 山喜多(山喜夛) +ヤマキタ 山来多 +ヤマキダ 山木田 +ヤマキド 山木戸 +ヤマキド 山城戸 +ヤマキリ 山切 +ヤマキリ 山桐 +ヤマギリ 山切 +ヤマギリ 山桐 +ヤマキワ 山際 +ヤマキワ 山極 +ヤマギワ 山際 +ヤマギワ 山極 +ヤマギワ 山究 +ヤマク 山来(山耒) +ヤマク 山來 +ヤマグスク 山城 +ヤマクセ 山久瀬 +ヤマクチ 山口 +ヤマグチ 山口 +ヤマグチ 山久地 +ヤマグチダニ 山口谷 +ヤマグチヤ 山口屋 +ヤマグチヤ 山口谷 +ヤマクテ 山久手 +ヤマクニ 山国 +ヤマクニ 山國 +ヤマクビ 山首 +ヤマクボ 山久保 +ヤマクボ 山窪 +ヤマクマ 山隈 +ヤマクマ 山熊 +ヤマグマ 山隈 +ヤマグマ 山熊 +ヤマクラ 山倉 +ヤマクラ 山蔵 +ヤマクリ 山栗 +ヤマグリ 山栗 +ヤマクロ 山黒 +ヤマクロ 山畔 +ヤマグロ 山黒 +ヤマクワ 山桑 +ヤマクワ 山鍬 +ヤマケ 山家 +ヤマケ 山毛 +ヤマケ 山宅 +ヤマゲ 山毛 +ヤマゲ 山華 +ヤマゲシ 山罌粟 +ヤマゲン 山元 +ヤマコ 山子 +ヤマコ 山古 +ヤマコ 山小 +ヤマゴ 山河 +ヤマゴ 山後 +ヤマゴ 山子 +ヤマコウ 山河 +ヤマゴウ 山郷 +ヤマゴウチ 山垣内 +ヤマゴエ 山越 +ヤマゴオリ 山郡 +ヤマコザワ 山子沢(山子澤) +ヤマコシ 山越 +ヤマコシ 山腰 +ヤマゴシ 山越 +ヤマゴシ 山腰 +ヤマコセ 山小瀬 +ヤマサ 山佐 +ヤマサ 弥政 +ヤマサ 矢政 +ヤマサ 彌政 +ヤマザ 山座 +ヤマサカ 山坂 +ヤマサカ 山阪 +ヤマサキ 山崎 +ヤマサキ 山嵜 +ヤマサキ 山先 +ヤマサキ 山前 +ヤマサキ 山咲 +ヤマサキ 山碕 +ヤマサキ 山岬 +ヤマサキ 山佐木 +ヤマザキ 山崎 +ヤマザキ 山嵜 +ヤマザキ 山先 +ヤマザキ 山咲 +ヤマザキ 山碕 +ヤマザキ 山岬 +ヤマザキ 屋馬崎 +ヤマザキ 山 +ヤマザキ 山埼 +ヤマザキ 山㟢 +ヤマザキヤ 山崎屋 +ヤマサク 山作 +ヤマサコ 山迫 +ヤマザコ 山迫 +ヤマサト 山里 +ヤマサト 山郷 +ヤマザト 山里 +ヤマザト 山郷 +ヤマサリ 山去 +ヤマサワ 山沢 +ヤマサワ 山澤 +ヤマザワ 山沢 +ヤマザワ 山澤 +ヤマサワツ 山澤津 +ヤマザワツ 山沢津 +ヤマザワツ 山澤津 +ヤマシ 山師 +ヤマシ 山仕 +ヤマジ 山路 +ヤマジ 山地 +ヤマジ 山道 +ヤマジ 山次 +ヤマジ 山司 +ヤマジ 山持 +ヤマジ 山治(山冶) +ヤマシオ 山塩 +ヤマシカ 山鹿 +ヤマシキ 山舗(山舖) +ヤマシキ 山敷 +ヤマシゲ 山重 +ヤマシゲ 山士家 +ヤマシゲ 山繁 +ヤマシゲ 山茂 +ヤマシタ 山下 +ヤマシタ 山志田 +ヤマシダ 山信田 +ヤマシダ 山志田 +ヤマシダ 山紫田 +ヤマシタヤ 山下谷 +ヤマシチ 山七 +ヤマシナ 山科 +ヤマシナ 山品 +ヤマシナ 山階 +ヤマシナ 山信 +ヤマシノ 山篠 +ヤマジノ 山路野 +ヤマシバ 山柴 +ヤマシブ 山渋(山澁) +ヤマシマ 山島 +ヤマシマ 山嶋 +ヤマジマ 山島 +ヤマジマ 山嶋 +ヤマシミズ 山清水 +ヤマジュク 山宿 +ヤマショウ 山荘 +ヤマショウ 山正 +ヤマショウ 山庄 +ヤマジョウ 山上 +ヤマジョウ 山条 +ヤマジョウ 山條 +ヤマジョウ 山荘 +ヤマジョウ 山丈 +ヤマショウジ 山庄司 +ヤマショウジ 山小路 +ヤマジリ 山尻 +ヤマシロ 山城 +ヤマシロ 山代 +ヤマシロ 山白 +ヤマシロ 山背 +ヤマシロ 矢摩城(矢广城) +ヤマシロ 矢磨城 +ヤマシロダニ 山代谷 +ヤマシロヤ 山城屋 +ヤマシロヤ 山代屋 +ヤマシロヤ 山城谷 +ヤマシン 山新 +ヤマシン 山真 +ヤマス 弥益 +ヤマス 山須 +ヤマス 山巣 +ヤマス 彌益 +ヤマズ 山集 +ヤマズイ 山居 +ヤマズイ 山瑞 +ヤマスエ 山末 +ヤマズエ 山崩 +ヤマスガ 山菅 +ヤマスガ 山管 +ヤマスガタ 山姿 +ヤマスギ 山杉 +ヤマスゲ 山菅 +ヤマスジ 山筋 +ヤマスソ 山裾 +ヤマスダ 山須田 +ヤマスミ 山住 +ヤマスミ 山角 +ヤマスミ 山澄 +ヤマズミ 山住 +ヤマズミ 山角 +ヤマズミ 山澄 +ヤマズミ 山隅 +ヤマズミ 山積 +ヤマズミ 山炭 +ヤマセ 山瀬 +ヤマセ 山勢 +ヤマセ 山生 +ヤマセ 山世 +ヤマセ 山清 +ヤマセ 山脊 +ヤマセキ 山関 +ヤマゼキ 山関 +ヤマソ 山岨 +ヤマゾイ 山添(山𣷹) +ヤマソエ 山添(山𣷹) +ヤマゾエ 山添(山𣷹) +ヤマゾエ 山副 +ヤマソト 山外 +ヤマゾノ 山園 +ヤマゾノ 山薗 +ヤマソバ 山岨 +ヤマソワ 山岨 +ヤマタ 山田 +ヤマタ 山多 +ヤマタ 家股 +ヤマタ 矢俣 +ヤマダ 山田 +ヤマダ 矢満田 +ヤマダ 山多 +ヤマダイ 山台 +ヤマダイ 山臺 +ヤマダイラ 山平 +ヤマタカ 山高 +ヤマダカ 山高 +ヤマダガリ 山田狩 +ヤマタキ 山滝 +ヤマタキ 山瀧 +ヤマダキ 山抱 +ヤマタケ 山竹 +ヤマタケ 山岳 +ヤマタケ 山武 +ヤマタケ 山嶽 +ヤマダジ 山田寺 +ヤマダシマ 山田島 +ヤマダジマ 山田島 +ヤマタツ 山達 +ヤマタテ 山楯 +ヤマダテ 山館 +ヤマダテ 山舘 +ヤマダテ 山達 +ヤマタニ 山谷 +ヤマダハラ 山田原 +ヤマタマ 山玉 +ヤマダヤ 山田谷 +ヤマダヤ 山田屋 +ヤマタリ 山足 +ヤマチ 山地 +ヤマチ 八町 +ヤマチ 山池 +ヤマチ 山知 +ヤマヂ 山地 +ヤマチカ 山近 +ヤマチヨ 山千代 +ヤマチョウ 山長 +ヤマチョウシ 山瓶子 +ヤマツ 山津 +ヤマツ 八松 +ヤマツ 矢松 +ヤマヅ 山津 +ヤマツイ 山対 +ヤマツカ 山塚 +ヤマツカ 山司 +ヤマヅカ 山塚 +ヤマツキ 山月 +ヤマツギ 山次 +ヤマヅキ 山附 +ヤマツグ 山次 +ヤマツジ 山辻 +ヤマツタ 山蔦 +ヤマツダ 山津田 +ヤマツチ 山土 +ヤマツボ 山壷 +ヤマヅミ 山積 +ヤマツラ 山頬 +ヤマヅラ 山頬 +ヤマヅラ 山面 +ヤマテ 山手 +ヤマデ 山出 +ヤマデヤ 山出谷 +ヤマテラ 山寺 +ヤマデラ 山寺 +ヤマテル 山照 +ヤマト 大和 +ヤマト 山戸 +ヤマト 山門 +ヤマト 倭 +ヤマト 山登 +ヤマト 山外 +ヤマト 山砥 +ヤマト 和 +ヤマト 矢的 +ヤマト 屋麻戸 +ヤマト 家満登 +ヤマト 山斗 +ヤマト 山都 +ヤマト 八的 +ヤマト 大倭 +ヤマド 山戸 +ヤマド 山門 +ヤマド 山土 +ヤマドイ 山土井 +ヤマトウ 山藤 +ヤマトウ 山當 +ヤマトエ 大和江 +ヤマトオ 山遠 +ヤマトガワ 大和川 +ヤマトキ 山時 +ヤマトキ 日本貴 +ヤマトギ 山磨 +ヤマトギ 山砥 +ヤマトク 山徳 +ヤマトク 山篤 +ヤマトコ 山床 +ヤマトザキ 大和崎 +ヤマトシ 山俊 +ヤマトジ 大和地 +ヤマトスギ 大和杉 +ヤマトダ 山戸田 +ヤマトダ 倭田 +ヤマトダニ 大和谷 +ヤマトヂ 大和地 +ヤマトミ 山富 +ヤマトミ 山冨 +ヤマドミ 山富 +ヤマトモ 山友 +ヤマトヤ 大和谷 +ヤマトヤ 大和屋 +ヤマトヤ 大和矢 +ヤマトヤマ 大和山 +ヤマトヨ 山登代 +ヤマトリ 山取 +ヤマドリ 山鳥 +ヤマドリ 山取 +ヤマナ 山名 +ヤマナ 山那 +ヤマナ 山奈 +ヤマナエ 山苗 +ヤマナオ 山直 +ヤマナカ 山中 +ヤマナカ 山仲 +ヤマナガ 山永 +ヤマナガ 山長 +ヤマナカシマ 山中島 +ヤマナカジマ 山中島 +ヤマナカジマ 山中嶋 +ヤマナカヤ 山中谷 +ヤマナシ 山梨 +ヤマナシ 月見里 +ヤマナタ 山名田 +ヤマナダ 山名田 +ヤマナミ 山並 +ヤマナミ 山南 +ヤマナミ 山波 +ヤマナミ 山次 +ヤマナミ 嶂南 +ヤマナリ 山成 +ヤマナン 山南 +ヤマニ 山仁 +ヤマニ 山二 +ヤマニ 山児 +ヤマニシ 山西 +ヤマニシキ 山錦 +ヤマニタ 山新田 +ヤマニハ 山入端 +ヤマヌキ 山貫 +ヤマヌシ 山主 +ヤマヌハ 山入端 +ヤマヌマ 山沼 +ヤマネ 山根 +ヤマネ 山子 +ヤマネ 山音 +ヤマネガワ 山根川 +ヤマネキ 山根木 +ヤマネギ 山根木 +ヤマノ 山野 +ヤマノ 山納 +ヤマノ 山埜 +ヤマノ 山農 +ヤマノイ 山野井 +ヤマノイ 山井 +ヤマノイ 山ノ井 +ヤマノイ 山之井 +ヤマノイ 山埜井 +ヤマノイ 山の井 +ヤマノイ 山野居 +ヤマノイシ 山ノ石 +ヤマノウ 山納 +ヤマノウ 山能 +ヤマノウエ 山上 +ヤマノウエ 山之上 +ヤマノウエ 山野上 +ヤマノウエ 山ノ上 +ヤマノウジ 山之氏 +ヤマノウチ 山内 +ヤマノウチ 山之内 +ヤマノウチ 山ノ内 +ヤマノウチ 山野内 +ヤマノウチ 山の内 +ヤマノエ 山之江 +ヤマノエ 山野江 +ヤマノカワ 山ノ川 +ヤマノカワ 山之川 +ヤマノカワ 山野川 +ヤマノキ 山野木 +ヤマノクチ 山之口 +ヤマノクチ 山ノ口 +ヤマノクチ 山野口 +ヤマノグチ 山之口 +ヤマノコシ 山之腰 +ヤマノコシ 山ノ腰 +ヤマノコシ 山之越 +ヤマノサキ 山ノ先 +ヤマノシタ 山野下 +ヤマノシタ 山ノ下 +ヤマノシタ 山之下 +ヤマノジョウ 山之城 +ヤマノダ 山野田 +ヤマノテラ 山野寺 +ヤマノデラ 山野寺 +ヤマノデラ 山ノ寺 +ヤマノハ 山端 +ヤマノハ 山入端 +ヤマノハ 山之端 +ヤマノハ 山饒覇 +ヤマノハナ 山ノ鼻 +ヤマノハナ 山野鼻 +ヤマノヒラ 山ノ平 +ヤマノヒラ 山之平 +ヤマノブ 山信 +ヤマノベ 山辺 +ヤマノベ 山野辺 +ヤマノベ 山邊 +ヤマノベ 山邉 +ヤマノベ 山廼辺 +ヤマノベ 山野邊 +ヤマノベ 山延 +ヤマノベ 山野部 +ヤマノベ 山野邉 +ヤマノベ 山ノ辺 +ヤマノベ 山ノ邉 +ヤマノベ 山廼邊 +ヤマノベ 山廼邉 +ヤマノボウ 山之坊 +ヤマノマル 山ノ丸 +ヤマノメ 山野目 +ヤマノメ 山目 +ヤマノモト 山野本 +ヤマノモト 山之元 +ヤマノリ 山則 +ヤマノリ 山乗(山乘) +ヤマハ 山羽 +ヤマハ 山波 +ヤマハ 山葉 +ヤマバ 山羽 +ヤマバ 山場 +ヤマハイ 山灰 +ヤマハエ 山生 +ヤマハク 山白 +ヤマハシ 山端 +ヤマハシ 山橋 +ヤマハシリ 山走 +ヤマバシリ 山走 +ヤマハタ 山端 +ヤマハタ 山畑 +ヤマハタ 山畠 +ヤマハタ 山幡 +ヤマハタ 山葉多 +ヤマバタ 山端 +ヤマバタ 山畑 +ヤマハチ 山八 +ヤマハツ 山初 +ヤマハナ 山端 +ヤマハナ 山花 +ヤマハナ 山鼻 +ヤマハナ 山塙 +ヤマバナ 山端 +ヤマバナ 山塙 +ヤマハネ 山羽 +ヤマハマ 山浜 +ヤマハマ 山濱 +ヤマバヤシ 山林 +ヤマハラ 山原 +ヤマバラ 山原 +ヤマハル 山春 +ヤマヒ 山火 +ヤマヒ 山日 +ヤマヒ 山樋 +ヤマビ 山火 +ヤマビ 山日 +ヤマヒガシ 山東 +ヤマヒキ 山引 +ヤマビキ 山引 +ヤマビコ 山彦 +ヤマヒサ 山久 +ヤマヒダ 山肥田 +ヤマヒデ 山秀 +ヤマヒャク 山百 +ヤマヒラ 山平 +ヤマヒラ 山比羅 +ヤマビラキ 山開 +ヤマヒロ 山広 +ヤマヒロ 山廣 +ヤマブキ 山吹 +ヤマブキ 山府木 +ヤマブキ 山葺 +ヤマフク 山福 +ヤマフジ 山藤 +ヤマブシ 山伏 +ヤマフチ 山渕 +ヤマフチ 山淵 +ヤマブチ 山渕 +ヤマブチ 山淵 +ヤマブチ 山縁 +ヤマフネ 山船 +ヤマフネ 山舩 +ヤマフロ 山風呂 +ヤマブロ 山風呂 +ヤマベ 山辺 +ヤマベ 山家 +ヤマベ 山部 +ヤマベ 山邊 +ヤマベ 山邉 +ヤマベリ 山端 +ヤマホ 山保 +ヤマホカ 山外 +ヤマホシ 山星 +ヤマボシ 山星 +ヤマホリ 山堀 +ヤマホリ 山掘 +ヤマボリ 山堀 +ヤママ 山間 +ヤママエ 山前 +ヤママキ 山牧 +ヤママキ 山巻 +ヤママサ 山柾 +ヤママス 山枡 +ヤママス 山桝 +ヤママス 山増 +ヤママチ 山町 +ヤママツ 山松 +ヤママル 山丸 +ヤママワリ 山廻 +ヤマミ 山見 +ヤマミ 山美 +ヤマミ 山三 +ヤマミサカ 山見坂 +ヤマミサカ 山見阪 +ヤマミズ 山水 +ヤマミゾ 山溝 +ヤマミチ 山道 +ヤマミチ 山通 +ヤマミツ 山光 +ヤマミドリ 山緑 +ヤマミナミ 山南 +ヤマミネ 山峰 +ヤマミネ 山峯 +ヤマミネ 山嶺 +ヤマミバ 山見場 +ヤマミヤ 山宮 +ヤマムカ 山向 +ヤマムカイ 山向 +ヤマムタ 山牟田 +ヤマムラ 山村 +ヤマムラ 山邑 +ヤマムラ 山邨 +ヤマムロ 山室 +ヤマメ 山目 +ヤマモ 山茂 +ヤマモウリ 山毛利 +ヤマモク 山杢 +ヤマモト 山本 +ヤマモト 山元 +ヤマモト 山許 +ヤマモト 山夲 +ヤマモト 山基 +ヤマモトヤ 山本屋 +ヤマモリ 山森 +ヤマモリ 山守 +ヤマモリ 山盛 +ヤマモリ 山毛利 +ヤマモロ 山諸 +ヤマヤ 山谷 +ヤマヤ 山家 +ヤマヤ 山屋 +ヤマヤ 山矢 +ヤマヤス 山安 +ヤマヨ 山与 +ヤマヨ 山豫 +ヤマヨ 山與 +ヤマヨシ 山吉 +ヤマヨシ 山佳 +ヤマヨシ 山芳 +ヤマヨシ 山葭 +ヤマヨセ 山寄 +ヤマライ 山来(山耒) +ヤマリ 山理 +ヤマリク 山陸 +ヤマリョウ 山領 +ヤマリョウ 山良 +ヤマリン 山林 +ヤマロク 山六 +ヤマワ 山和 +ヤマワカ 山若 +ヤマワキ 山脇(山𦚰) +ヤマワキ 山分 +ヤマワキ 山腋 +ヤマワク 山涌 +ヤマワケ 山分 +ヤマワケ 山訳 +ヤマワケ 山譯 +ヤマワシ 山鷲 +ヤマンタ 矢満田 +ヤマンダ 矢満田 +ヤミクモ 闇雲 +ヤミグモ 闇雲 +ヤミチ 八道 +ヤミヤ 八宮 +ヤムカイ 谷向 +ヤムカイ 矢向 +ヤムキ 八向 +ヤムギ 矢麦 +ヤムギ 矢麥 +ヤムネ 矢宗 +ヤムラ 谷村 +ヤムラ 矢村 +ヤムラ 八村 +ヤムラ 弥村 +ヤムロ 矢室 +ヤムロ 矢袋 +ヤメ 矢目 +ヤモウ 矢毛 +ヤモオカ 谷茂岡 +ヤモチ 矢持 +ヤモト 矢本 +ヤモト 家本 +ヤモト 八本 +ヤモト 矢元 +ヤモト 箭本 +ヤモト 谷許 +ヤモト 屋本 +ヤモト 弥元 +ヤモト 八元 +ヤモト 弥本 +ヤモト 彌元 +ヤモト 彌本 +ヤモトギ 八本木 +ヤモリ 矢守 +ヤモリ 八森 +ヤモリ 家守 +ヤモリ 家森 +ヤモリ 矢森 +ヤモリ 矢盛 +ヤモリ 屋森 +ヤモリ 弥森 +ヤモリ 家盛 +ヤヤ 矢谷 +ヤヤ 良 +ヤヤ 谷々 +ヤヤ 谷谷 +ヤヤナギ 矢柳 +ヤヤナギ 屋柳 +ヤヤベ 良辺 +ヤヤベ 良邊 +ヤヤベ 良邉 +ヤヤマ 矢山 +ヤヤマ 屋山 +ヤヤマ 弥山 +ヤヤマ 彌山 +ヤヤモリ 良盛 +ヤユミ 矢弓 +ヤヨイ 弥生 +ヤヨイ 彌生 +ヤヨウ 矢用 +ヤヨザキ 屋代崎 +ヤヨシ 弥吉 +ヤヨシ 矢吉 +ヤヨシ 彌吉 +ヤヨシ 矢好 +ヤヨタ 八代田 +ヤヨダ 八代田 +ヤヨタニ 八代谷 +ヤラ 屋良 +ヤラ 矢良 +ヤライ 矢来(矢來) +ヤラカミ 矢良上 +ヤラブ 屋良部 +ヤリ 鑓 +ヤリ 鎗 +ヤリ 矢利 +ヤリ 矢里 +ヤリイ 鎗井 +ヤリイ 鎗居 +ヤリイ 鑓井 +ヤリウチ 鎗内 +ヤリエ 鎗柄 +ヤリオ 鎗尾 +ヤリク 矢陸 +ヤリコウジ 鑓小路 +ヤリコウチ 鑓河内 +ヤリゴウチ 鑓河内 +ヤリサワ 遣沢(遣澤) +ヤリタ 鎗田 +ヤリタ 鑓田 +ヤリタ 槍田 +ヤリタ 遣田 +ヤリタニ 鎗谷 +ヤリト 槍戸 +ヤリド 鎗戸 +ヤリノ 鎗野 +ヤリノ 槍野 +ヤリノ 鑓野 +ヤリノメ 鑓野目 +ヤリノメ 鎗目 +ヤリノメ 鎗野目 +ヤリバ 鎗場 +ヤリマル 鎗丸 +ヤリミズ 鑓水 +ヤリミズ 鎗水 +ヤリミズ 遣水 +ヤリミズ 槍水 +ヤリミズ 鎚水 +ヤリミゾ 鑓溝 +ヤリミツ 鎗光 +ヤリミツ 鑓光 +ヤリメ 鎗目 +ヤリモト 鎗本 +ヤリモト 鑓本 +ヤリヤ 鎗屋 +ヤリヤ 鑓屋 +ヤリヤマ 鎗山 +ヤリワケ 鎗分 +ヤリワケ 鑓分 +ヤリワケ 遣分 +ヤルセ 遣瀬 +ヤロク 弥六 +ヤロク 弥録(彌録) +ヤロク 矢録 +ヤロク 彌六 +ヤワ 八輪 +ヤワカ 八若 +ヤワタ 八幡 +ヤワタ 矢幡 +ヤワタ 矢渡 +ヤワタ 矢和田 +ヤワタ 八和田 +ヤワタ 八綿 +ヤワタ 八波田 +ヤワタ 屋和田 +ヤワタ 屋渡 +ヤワタ 八籏 +ヤワタ 矢和多 +ヤワダ 矢和田 +ヤワダ 八和田 +ヤワタアキヤマ 八幡秋山 +ヤワタガキ 八幡垣 +ヤワタシ 矢渡 +ヤワタヤ 八幡谷 +ヤワタリ 矢渡 +ヤワタリ 八渡 +ヤンカワ 袰川 +ヤンナイ 箭内 +ヤンベ 山家 +ユ 柚 +ユ 湯 +ユアサ 湯浅 +ユアサ 湯朝 +ユアサ 湯淺 +ユアサ 油浅(油淺) +ユアサ 由浅 +ユアサ 柚浅 +ユアサザキ 湯浅崎 +ユイ 油井 +ユイ 由井 +ユイ 湯井 +ユイ 由比 +ユイ 唯 +ユイ 柚井 +ユイ 勇伊 +ユイ 由居 +ユイガ 唯我 +ユイガハマ 由比ケ浜(由比ケ濱) +ユイカワ 結川 +ユイキ 結木 +ユイササ 結笹 +ユイシマ 結島 +ユイズミ 湯泉 +ユイゼ 唯是 +ユイゾノ 由井園 +ユイゾノ 由井薗 +ユイタ 結田 +ユイタ 結多 +ユイダ 結田 +ユイチ 挙市 +ユイトウ 由比藤 +ユイナダ 遊井名田 +ユイナワ 結繩 +ユイナワ 結縄 +ユイナン 結南 +ユイネ 唯根 +ユイノ 唯野 +ユイノ 結野 +ユイノ 由井野 +ユイハマ 由比浜 +ユイハマ 由井浜 +ユイハマ 由比濱 +ユイハラ 油井原 +ユイハラ 由井原 +ユイハラ 由比原 +ユイボソ 結細 +ユイマ 維摩 +ユイヤマ 唯山 +ユイワタ 結綿 +ユウ 柚 +ユウ 湯 +ユウ 由宇 +ユウ 祐 +ユウ 佑 +ユウ 遊 +ユウ 夕 +ユウ 由羽 +ユウイ 勇伊 +ユウイ 勇井 +ユウイ 遊井 +ユウイチ 熊一 +ユウウチ 勇内 +ユウエン 結縁 +ユウエン 結緑 +ユウオ 勇尾 +ユウオカ 祐岡 +ユウオカ 結岡 +ユウオリ 宥下 +ユウカ 勇家 +ユウガ 勇我 +ユウガ 偸伽 +ユウガキ 柚垣 +ユウガキ 遊垣 +ユウカゲ 祐影 +ユウカネ 勇金 +ユウカミ 勇上 +ユウガミ 勇上 +ユウカリ 有加利 +ユウカワ 祐川 +ユウカワ 勇川 +ユウカワ 遊川 +ユウカワ 夕川 +ユウガワ 夕川 +ユウキ 結城 +ユウキ 柚木 +ユウキ 有木 +ユウキ 行木 +ユウキ 油木 +ユウキ 由木 +ユウキ 遊木 +ユウキ 遊亀 +ユウキ 湯城 +ユウキ 雄城 +ユウキ 勇木 +ユウキ 遊喜 +ユウキ 由城 +ユウキ 結木 +ユウキ 夕木 +ユウキ 勇樹 +ユウキ 祐木 +ユウキ 祐耆 +ユウキ 夕季 +ユウキ 悠木 +ユウキ 有紀 +ユウキ 猶喜 +ユウギ 遊戯 +ユウキヤマ 結城山 +ユウギリ 由桐 +ユウグチ 湧口 +ユウクラ 有倉 +ユウケイ 幽経 +ユウケイ 幽渓 +ユウケイ 幽溪 +ユウゲツ 由月 +ユウケン 由見 +ユウゲン 勇元 +ユウゲン 祐源 +ユウコク 幽谷 +ユウサ 遊佐 +ユウサ 勇左 +ユウザ 遊座 +ユウザ 遊㘴 +ユウザキ 勇崎 +ユウザキ 結崎 +ユウサク 遊作 +ユウザン 勇山 +ユウシ 勇士 +ユウジ 湯治 +ユウジ 由地 +ユウジ 勇次 +ユウシタ 祐下 +ユウシタ 夕下 +ユウシマ 祐島 +ユウシマ 勇島 +ユウジマ 祐島 +ユウジマ 夕島 +ユウジマ 勇島 +ユウジマ 祐嶋 +ユウジョウボウ 祐乗坊 +ユウシン 祐信 +ユウシン 雄心 +ユウスイ 由水 +ユウセキ 油石 +ユウセン 祐仙 +ユウセン 祐泉 +ユウセン 遊仙 +ユウゼン 熊膳 +ユウゼン 友膳 +ユウソウ 勇惣 +ユウゾノ 柚園 +ユウタ 油田 +ユウタ 結田 +ユウタ 勇田 +ユウタ 夕田 +ユウタ 祐田 +ユウダ 由田 +ユウダ 遊田 +ユウダ 結田 +ユウダ 勇田 +ユウダ 夕田 +ユウダ 柚田 +ユウダ 紫合 +ユウダ 祐田 +ユウタニ 油谷 +ユウタニ 祐谷 +ユウタニ 勇谷 +ユウタニ 遊谷 +ユウタニ 優谷 +ユウチ 由地 +ユウチ 勇内 +ユウチ 勇知 +ユウヂ 勇地 +ユウチョウ 遊長 +ユウチョウ 湯張 +ユウヅ 遊津 +ユウヅカ 遊塚 +ユウヅカ 勇塚 +ユウツジ 祐辻 +ユウデ 夕出 +ユウデン 遊田 +ユウト 勇都 +ユウトウ 祐東 +ユウドウ 有働 +ユウドウ 遊道 +ユウトク 祐徳 +ユウトク 勇徳 +ユウナイヤマ 勇内山 +ユウナガ 夕永 +ユウナガ 勇永 +ユウノ 祐野 +ユウノ 柚野 +ユウノ 勇野 +ユウノ 裕野 +ユウノキ 柚ノ木 +ユウノキ 柚之木 +ユウバ 弓場 +ユウハク 祐伯 +ユウハシ 遊橋 +ユウハタ 遊畑 +ユウバヤシ 勇林 +ユウハラ 勇原 +ユウバリ 游張 +ユウヒ 由肥 +ユウヒ 夕日 +ユウヒラ 柚平 +ユウブ 勇生 +ユウフク 祐福 +ユウベ 夕部 +ユウベ 遊部 +ユウヘイ 裕平 +ユウボク 柚木 +ユウマ 遊馬 +ユウマ 遊間 +ユウマ 遊磨 +ユウミ 勇見 +ユウミ 勇海 +ユウミヤ 勇宮 +ユウムカイ 夕向 +ユウムキ 夕向 +ユウムラ 祐村 +ユウムラ 勇村 +ユウメイ 猶明 +ユウメン 湯面 +ユウメン 遊免 +ユウメン 宥免 +ユウメン 湯免 +ユウメン 油免 +ユウモト 勇元 +ユウモト 柚本 +ユウモト 祐本 +ユウモト 勇本 +ユウモリ 祐森 +ユウヤ 湯谷 +ユウヤ 祐谷 +ユウヤ 柚谷 +ユウヤ 遊谷 +ユウヤ 遊屋 +ユウヤ 裕谷 +ユウヤマ 柚山 +ユウラ 湯浦 +ユウラ 油浦 +ユウラク 友楽 +ユウリ 友利 +ユウリ 勇利 +ユウリョウ 祐領 +ユウリン 有隣 +ユエ 由衛 +ユエ 湯江 +ユエ 湯恵 +ユエダ 故田 +ユオ 湯尾 +ユオ 祐尾 +ユオ 油尾 +ユオカ 湯岡 +ユオカ 柚岡 +ユオケ 湯桶 +ユガ 柚賀 +ユガ 瑜伽 +ユガ 由賀 +ユガキ 柚垣 +ユガキ 湯垣 +ユガキ 遊垣 +ユカタ 油形 +ユカツ 床津 +ユカド 湯門 +ユガハラ 柚原 +ユカミ 湯上 +ユカミ 由上 +ユカミ 油上 +ユカミ 遊上 +ユガミ 湯上 +ユガミ 由上 +ユガミ 油上 +ユガミ 柚上 +ユガミ 遊上 +ユガミダニ 湯上谷 +ユカヤ 由茅 +ユガヤ 由茅 +ユカリ 弓狩 +ユガリ 弓狩 +ユカワ 湯川 +ユカワ 祐川 +ユカワ 由川 +ユカワ 油川 +ユカワ 湯河 +ユカワ 遊川 +ユカワ 柚川 +ユカワ ユ川 +ユガワ 湯川 +ユガワ 由川 +ユガワ 温川 +ユキ 柚木 +ユキ 幸 +ユキ 行 +ユキ 由木 +ユキ 湯木 +ユキ 雪 +ユキ 由岐 +ユキ 靭 +ユキ 涌喜 +ユキ 靱 +ユギ 柚木 +ユギ 由木 +ユキアイ 行合 +ユキアシ 行足 +ユキアラシ 雪嵐 +ユキイ 雪井 +ユキイ 行井 +ユキイリ 雪入 +ユキイリ 行入 +ユキウエ 雪上 +ユキウメ 行梅 +ユキウラ 雪浦 +ユキエ 雪江 +ユキエ 靭負(靱負) +ユキエ 幸恵 +ユキエダ 行枝 +ユキエダ 雪枝 +ユキオ 由木尾 +ユキオ 靭尾(靱尾) +ユキオ 雪尾 +ユキオ 柚木尾 +ユキオカ 雪岡 +ユキオカ 行岡 +ユキガイ 行貝 +ユキガキ 行堵 +ユキガキ 雪垣 +ユキガシラ 雪頭 +ユキカタ 行方 +ユキカド 由喜門 +ユキガミ 行上 +ユキカワ 行川 +ユキガワ 行川 +ユキサキ 柚木崎 +ユキザキ 柚木崎 +ユキサコ 行迫 +ユキサダ 行定 +ユキサダ 雪定 +ユキサダ 行貞 +ユキサダ 雪貞 +ユキサト 行里 +ユキザネ 行実 +ユキザネ 行實 +ユキサワ 行沢 +ユキサワ 行澤 +ユキサワ 樰沢 +ユキザワ 行沢 +ユキザワ 行澤 +ユキザワ 幸沢 +ユキザワ 雪沢 +ユキザワ 雪澤 +ユキザワ 幸澤 +ユギサワ 柚木沢 +ユギサワ 柚木澤 +ユキシゲ 幸重 +ユキシゲ 行重 +ユキシタ 雪下 +ユキシタ 幸下 +ユキシマ 幸島 +ユキシマ 雪島 +ユキシマ 幸嶋 +ユキシマ 雪嶋 +ユキシマ 行島 +ユキシマ 行嶋 +ユキシロ 雪城 +ユキスギ 雪杉 +ユキスミ 幸住 +ユキゾノ 柚木園 +ユキタ 幸田 +ユキタ 行田 +ユキタ 雪田 +ユキタ 油木田 +ユキタ 湯北 +ユキダ 幸田 +ユキダ 行田 +ユキダ 雪田 +ユキタケ 行武 +ユキタケ 雪竹 +ユキタケ 行竹 +ユキタツ 雪辰 +ユキタニ 行谷 +ユキタニ 雪谷 +ユキタニ 由岐谷 +ユキチカ 行近 +ユキヅカ 幸塚 +ユキツネ 行常 +ユキト 幸人 +ユキトウ 行藤 +ユキトキ 行時 +ユキトシ 行俊 +ユキトシ 行年 +ユキドマリ 行泊 +ユキトミ 行富 +ユキトミ 行冨 +ユキトミ 雪富 +ユキトミ 雪冨 +ユキトモ 行友 +ユキトモ 往友 +ユキナカ 由岐中 +ユキナガ 幸長 +ユキナガ 雪永 +ユキナガ 行永 +ユキナガ 行長 +ユキナリ 行成 +ユキナリ 行形 +ユキナワ 行繩 +ユキナワ 行縄 +ユキナワ 雪縄 +ユキナワ 雪繩 +ユキノ 幸野 +ユキノ 雪野 +ユキノ 行野 +ユキノ 湯木野 +ユキノウラ 雪ノ浦 +ユキノブ 行延 +ユキノブ 行信 +ユキノリ 行徳 +ユキノリ 行則 +ユキハシ 行橋 +ユキハタ 雪畑 +ユキバヤシ 行林 +ユキハラ 柚木原 +ユキハラ 雪原 +ユキハラ 行原 +ユキヒサ 行久 +ユキヒラ 行平 +ユキヒラ 雪平 +ユキヒロ 行広 +ユキヒロ 行弘 +ユキヒロ 行廣 +ユキヒロ 雪広 +ユキヒロ 雪廣 +ユキフキ 雪吹 +ユキフジ 行藤 +ユキブチ 雪渕 +ユキフネ 行船 +ユキフネ 行舩 +ユキマサ 行正 +ユキマサ 行政 +ユキマサ 雪正 +ユキマチ 行待 +ユキマツ 幸松 +ユキマツ 行松 +ユキマツ 雪松 +ユキマツ 行枩 +ユキマル 雪丸 +ユキミ 雪見 +ユキミズ 雪水 +ユキミツ 行光 +ユキミツ 雪光 +ユキミネ 雪峰 +ユキミヤ 行京 +ユキムネ 行宗 +ユキムネ 行旨 +ユキムネ 雪宗 +ユキムラ 幸村 +ユキムラ 行村 +ユキムラ 雪村 +ユキムロ 雪室 +ユキモト 行本 +ユキモト 雪本 +ユキモト 幸本 +ユキモト 行元 +ユキモト 雪元 +ユキモト 行基 +ユキモト 往本 +ユキモリ 行森 +ユキモリ 雪森 +ユキモリ 行守 +ユキモリ 雪盛 +ユキモン 由喜門 +ユキヤ 行谷 +ユキヤ 雪谷 +ユキヤ 雪矢 +ユキヤ 雪屋 +ユキヤ 雪家 +ユキヤス 行安 +ユキヤス 行保 +ユキヤス 徃安 +ユキヤマ 雪山 +ユキヤマ 晋山 +ユキヤマ 柚木山 +ユキヤマ 行山 +ユキヤマ 遊亀山 +ユキヨシ 行吉 +ユキヨシ 雪吉 +ユキヨシ 行好 +ユギリ 由桐 +ユキワキ 柚木脇 +ユク 行 +ユクエ 行衛 +ユクエダ 行枝 +ユクオカ 行岡 +ユクカワ 行川 +ユクキ 行木 +ユクシゲ 行重 +ユクシマ 行島 +ユクシマ 行嶋 +ユクスエ 行末 +ユクタ 行田 +ユクタ 往田 +ユクタ 徃田 +ユクダ 行田 +ユクタケ 行武 +ユクタケ 行竹 +ユクチ 湯口 +ユグチ 湯口 +ユグチ 柚口 +ユグチ 堰口 +ユグチ 湧口 +ユグチ 油口 +ユグチ 遊口 +ユグチ 抽口 +ユグチ 由口 +ユクトミ 行冨 +ユクトモ 行友 +ユクナガ 行永 +ユクノ 行野 +ユクヒサ 行久 +ユクヒロ 行広 +ユクヒロ 行弘 +ユクヒロ 行廣 +ユクベ 行部 +ユクボ 湯窪 +ユクボ 柚久保 +ユクマツ 行松 +ユクミ 湯汲 +ユクミ 往見 +ユクミ 徃見 +ユクミツ 行光 +ユクムネ 行宗 +ユクムラ 行村 +ユクモト 行本 +ユクモト 行元 +ユクモト 行基 +ユクヤス 往安 +ユクヤマ 行山 +ユクヨシ 行吉 +ユクラ 湯倉 +ユグリ 湯栗 +ユゲ 弓削 +ユゲ 湯下 +ユゲ 弓家 +ユゲ 油下 +ユゲ 由家 +ユゲ 湯毛 +ユゲ 由解 +ユゲタ 弓削田 +ユゲタ 弓削多 +ユゲタ 弓家田 +ユゲタ 弓気田(弓氣田) +ユゲタ 弓削夛 +ユゲツ 由月 +ユゲン 湯源 +ユコ 湯子 +ユゴウ 油江 +ユゴウ 湯郷 +ユゴシ 湯越 +ユサ 遊佐 +ユサ 湯佐 +ユサ 由佐 +ユサ 油佐 +ユサ 遊左 +ユザ 油座 +ユザ 湯座 +ユザ 遊座 +ユザ 遊坐 +ユザ 湯坐 +ユザ 湯㘴 +ユザ 油坐 +ユザイ 湯在 +ユサカ 湯坂 +ユサカ 湯阪 +ユサキ 湯崎(湯嵜) +ユザキ 湯崎(湯嵜) +ユザキ 油崎 +ユザキ 柚崎 +ユサキノ 湯嵜野 +ユザキノ 湯崎野 +ユザト 湯里 +ユサワ 湯沢 +ユザワ 湯沢 +ユザワ 湯澤 +ユザワ 由沢 +ユザワ 柚沢 +ユザワ 遊沢 +ユザワ 由澤 +ユザワ 遊澤 +ユザワ 油沢 +ユザワ 勇沢 +ユザワ 柚澤 +ユジ 湯地 +ユジ 湯治 +ユジ 由地 +ユジ 湯池 +ユジ 油治 +ユシオ 湯塩 +ユシタ 湯下 +ユシタ 柚下 +ユシタ 由下 +ユシナ 油科 +ユシナ 油品 +ユシマ 湯島 +ユシマ 油島 +ユシマ 由島 +ユシマ 湯嶋 +ユシマ 油嶋 +ユジマ 湯島 +ユシヤ 熊取谷 +ユジリ 湯尻 +ユシロ 湯城 +ユス 柚須 +ユズ 油津 +ユズ 柚津 +ユズ 湯頭 +ユズイ 柚井 +ユズエ 柚江 +ユズガミ 柚上 +ユスカワ 梼川(檮川) +ユスキ 梼木 +ユスキ 檮木 +ユスキ 湯次 +ユズキ 柚木 +ユズキ 柞木 +ユズキザキ 柚木崎 +ユズグチ 柚口 +ユズタ 柚田 +ユスダニ 遊子谷 +ユズタニ 柚谷 +ユズドウ 湯通堂 +ユズナカ 柚中 +ユズノ 柚野 +ユスノキ 柞木 +ユズノキ 柞木 +ユズハ 柚葉 +ユズハナ 柚花 +ユスハラ 梼原 +ユスハラ 檮原 +ユズハラ 柚原 +ユズムラ 柚村 +ユズメ 湯詰 +ユズモト 柚本 +ユスヤマ 梼山 +ユスヤマ 檮山 +ユズヤマ 柚山 +ユズリ 譲 +ユズリ 禅 +ユズリ 禪 +ユズリオ 譲尾 +ユズリハ 杠 +ユズリハ 楪 +ユズリハ 𣜿 +ユズリハ 杜 +ユズリハ 杠葉 +ユズリハ 譲葉 +ユズリハ 楪葉 +ユズリハ 讓葉 +ユズリハラ 譲原 +ユズリハラ 讓原 +ユズリヤ 譲矢 +ユズリヤ 譲谷 +ユセ 湯瀬 +ユセ 柚瀬 +ユセ 油瀬 +ユセ 勇勢 +ユゼ 湯瀬 +ユゼ 湯生 +ユセキ 湯石 +ユソウ 勇惣 +ユタ 湯田 +ユタ 油田 +ユダ 湯田 +ユダ 油田 +ユダ 由田 +ユダ 遊田 +ユダ 柚田 +ユダイ 油台 +ユタカ 豊 +ユタカ 湯高 +ユタカ 綽 +ユダサカ 湯田坂 +ユタゾノ 湯田園 +ユダゾノ 湯田園 +ユダチ 湯立 +ユダテ 弓立 +ユダテ 弓達 +ユタニ 油谷 +ユタニ 湯谷 +ユタニ 由谷 +ユタニ 柚谷 +ユダニ 湯谷 +ユタニサコ 湯谷迫 +ユダヒラ 湯田平 +ユタン 湯丹 +ユチ 湯地 +ユチ 由地 +ユチ 湯池 +ユチ 油地 +ユヂ 湯地 +ユツ 湯津 +ユヅ 油津 +ユヅ 柚津 +ユヅキ 湯月 +ユツドウ 湯通堂 +ユヅメ 湯詰 +ユヅリハラ 譲原 +ユデ 湯出 +ユデ 油出 +ユデガワ 湯出川 +ユデガワ 湯手川 +ユテグチ 由手口 +ユデグチ 湯出口 +ユデハラ 湯出原 +ユト 湯戸 +ユド 湯戸 +ユド 油戸 +ユド 由土 +ユトウ 湯藤 +ユトウ 由藤 +ユトウ 油藤 +ユトウ 由籐 +ユドウ 湯藤 +ユトク 湯徳 +ユドノ 湯殿 +ユトリ 柚鳥 +ユナカ 湯中 +ユナモチ 弓納持 +ユナヤマ 勇内山 +ユヌキ 湯貫 +ユヌマ 湯沼 +ユネ 湯根 +ユネ 柚根 +ユノ 湯野 +ユノ 油野 +ユノ 柚野 +ユノウ 油納 +ユノウエ 湯上 +ユノウエ 湯之上 +ユノウエ 湯ノ上 +ユノウエ 柚之上 +ユノエ 湯の恵 +ユノエ 湯ノ恵(湯ノ惠) +ユノカミ 湯之上 +ユノカミ 勇ノ上 +ユノカミ 涌上 +ユノカミ 湯の上 +ユノガミ 湯之上 +ユノガミ 湯ノ上 +ユノカワ 湯野川 +ユノカワ 温泉川 +ユノカワ 湯泉川 +ユノキ 柚木 +ユノキ 柚ノ木 +ユノキ 勇野喜 +ユノキ 油野木 +ユノキ 湯ノ木 +ユノキ 湯野喜 +ユノキザキ 柚木崎 +ユノキゾノ 柚木園 +ユノキハラ 柚木原 +ユノクチ 湯ノ口 +ユノクチ 湯之口 +ユノグチ 湯ノ口 +ユノゲ 弓能家 +ユノサコ 湯ノ迫 +ユノサコ 湯之迫 +ユノサワ 湯野沢 +ユノサワ 湯野澤 +ユノシタ 柚下 +ユノシタ 湯之下 +ユノシマ 由野島 +ユノジリ 湯野尻 +ユノセ 湯瀬 +ユノタニ 湯ノ谷 +ユノタニ 湯之谷 +ユノタニ 柚ノ谷 +ユノト 湯之戸 +ユノハラ 柚原 +ユノハラ 湯之原 +ユノハラ 柚之原 +ユノマエ 湯前 +ユノマエ 湯之前 +ユノマエ 湯ノ前 +ユノミチ 湯之道 +ユノミヤ 湯野宮 +ユノミヤ 湯之宮 +ユノムラ 湯村 +ユノムラ 柚村 +ユノムラ 湯野村 +ユノメ 湯目 +ユノメ 湯ノ目 +ユノメ 湯の目 +ユノモト 湯ノ元 +ユノワキ 湯之脇 +ユバ 弓場 +ユバ 湯場 +ユバ 弓庭 +ユバ 湯葉 +ユバ 柚場 +ユバ 湯庭 +ユバイ 弓場井 +ユバカミ 弓場上 +ユバサキ 湯場崎 +ユバザキ 湯場崎 +ユハシ 湯橋 +ユハシ 油橋 +ユハズ 𢎭 +ユハタ 湯畑 +ユバタ 湯畑 +ユバタ 湯端 +ユバモト 弓場元 +ユバモト 湯場元 +ユバヤシ 油林 +ユハラ 湯原 +ユハラ 柚原 +ユハラ 油原 +ユハラ 由原 +ユバラ 湯原 +ユハラギ 由原木 +ユヒ 由比 +ユヒ 由肥 +ユヒ 油比 +ユヒ 湯日 +ユヒガハマ 由比ケ浜(由比ケ濱) +ユビグチ 指口 +ユビスイ 指吸 +ユビタ 指田 +ユビタニ 指谷 +ユビノ 指野 +ユヒハマ 由比浜 +ユヒラ 湯平 +ユフ 油布 +ユフ 由布 +ユブキ 雪吹 +ユブタ 湯蓋 +ユブタ 湯葢 +ユブチ 由淵 +ユブチ 由渕 +ユフネ 湯舟 +ユフネ 湯船 +ユブネ 湯舟 +ユブネ 湯船 +ユベ 遊部 +ユホラ 柚洞 +ユボラ 柚洞 +ユマ 湯間 +ユマエ 湯前 +ユマキ 湯槙 +ユマキ 湯槇 +ユマタ 湯又 +ユマチ 湯町 +ユマモリ 湯守 +ユマル 湯丸 +ユミ 弓 +ユミ 由見 +ユミ 由美 +ユミイ 弓井 +ユミオ 弓尾 +ユミオカ 弓岡 +ユミカケ 弓掛 +ユミカリ 弓狩 +ユミカワ 弓川 +ユミキ 弓木 +ユミキタ 弓気田(弓氣田) +ユミキタ 弓北 +ユミキタ 弓気多 +ユミキダ 弓木田 +ユミキノ 弓木野 +ユミグチ 弓口 +ユミクラ 弓倉 +ユミケタ 弓桁 +ユミゲタ 弓桁 +ユミコシ 弓越 +ユミザ 弓座 +ユミサカ 弓坂 +ユミサキ 弓崎 +ユミサキ 弓先 +ユミザキ 弓崎 +ユミサシ 弓指 +ユミサワ 弓沢 +ユミサワ 弓澤 +ユミシタ 弓下 +ユミシマ 弓島 +ユミシマ 弓嶋 +ユミショウ 弓庄 +ユミズ 湯水 +ユミセ 弓瀬 +ユミセ 弓勢 +ユミゾ 湯溝 +ユミタ 弓田 +ユミダ 弓田 +ユミタケ 弓武 +ユミタテ 弓立 +ユミタテ 弓達 +ユミダテ 弓達 +ユミタニ 弓谷 +ユミタニ 弓渓 +ユミタニ 弓溪 +ユミヅカ 弓束 +ユミヅル 弓弦 +ユミテ 弓手 +ユミデ 弓出 +ユミト 弓戸 +ユミドコ 弓床 +ユミトリ 弓取 +ユミトリ 弓鳥 +ユミナカ 弓中 +ユミナカ 弓仲 +ユミナガ 弓長 +ユミナガ 弓永 +ユミナミ 弓波 +ユミナモチ 弓納持 +ユミネ 湯峯 +ユミネ 湯峰 +ユミネ 湯岑 +ユミノ 弓野 +ユミノ 弓埜 +ユミノキ 弓樹 +ユミノケ 弓能家 +ユミノモチ 弓納持 +ユミバ 弓場 +ユミバ 弓塲 +ユミハタ 弓畑 +ユミハマ 弓浜(弓濱) +ユミバヤシ 弓林 +ユミハラ 弓原 +ユミハリ 弓張 +ユミマ 弓間 +ユミマチ 弓町 +ユミモト 弓本 +ユミモト 弓元 +ユミヤ 弓矢 +ユミヤ 弓谷 +ユミヤ 湯宮 +ユミヤ 弓屋 +ユミヤマ 弓山 +ユミラ 弓良 +ユムラ 湯村 +ユムラ 柚村 +ユムラ 油村 +ユムラ 湯邨 +ユムロ 湯室 +ユメ 夢 +ユメダ 夢田 +ユメデラ 夢寺 +ユメノ 夢野 +ユメン 湯面 +ユメン 湯免 +ユメン 油免 +ユモト 湯本 +ユモト 由本 +ユモト 湯元 +ユモト 油本 +ユモト 柚本 +ユモト 輸本 +ユモト 柚元 +ユモリ 湯森 +ユモリ 柚森 +ユヤ 熊野 +ユヤ 油谷 +ユヤ 湯谷 +ユヤ 湯屋 +ユヤ 湯矢 +ユヤグチ 湯屋口 +ユヤサコ 湯谷迫 +ユヤタニ 湯家谷 +ユヤマ 湯山 +ユヤマ 柚山 +ユヤマ 諭山 +ユヤマ 兪山 +ユヤミドウ 熊野御堂 +ユラ 由良 +ユラ 油良 +ユラ 涌羅 +ユラ 由羅 +ユラキ 由良木 +ユラギ 由良木 +ユラタ 由良田 +ユラノ 由良野 +ユリ 由利 +ユリ 百合 +ユリ 由里 +ユリ 油利 +ユリ 友里 +ユリ 由理 +ユリ 遊里 +ユリ 岼 +ユリエ 淘江 +ユリオカ 百合岡 +ユリカワ 百合川 +ユリキ 油利木 +ユリクサ 百合草 +ユリグサ 百合草 +ユリグチ 百合口 +ユリサワ 百合沢 +ユリサワ 百合澤 +ユリザワ 百合澤 +ユリシマ 百合嶋 +ユリシマ 百合島 +ユリゾノ 百合園(百合薗) +ユリタ 百合田 +ユリタ 動田 +ユリダ 百合田 +ユリツナ 百合綱 +ユリトウ 百合藤 +ユリナカ 百合中 +ユリナガ 百合永 +ユリナガ 百合長 +ユリノ 百合野 +ユリノ 𠷡野 +ユリバヤシ 百合林 +ユリフジ 百合藤 +ユリミチ 遊里道 +ユリモト 百合本 +ユリモト 圦本 +ユリモト 由里本 +ユリモト 揺本 +ユリヤ 由利谷 +ユリヤマ 百合山 +ユルエ 淘江 +ユルエ 陶江 +ユルエ 由類江 +ユルカ 緩鹿 +ユルキ 柚留木 +ユルキ 汰木 +ユルキ 由留木 +ユルギ 万木 +ユルギ 萬木 +ユルギ 柚留木 +ユルギ 由留木 +ユルギ 動木 +ユルサ 由留佐 +ユルジリ 尻 +ユルス 免 +ユルヅメ 緩詰 +ユルデ 由留出 +ユルベ 由留部(由畄部) +ユルミ 䌂見 +ユルリ 緩利 +ユワキ 湯脇 +ユンデ 弓手 +ユンバ 弓場 +ユンベ 弓部 +ヨ 与 +ヨアケ 夜明 +ヨイ 宵 +ヨイオ 吉尾 +ヨイタ 与板(與板) +ヨイダ 宵田 +ヨイタニ 宵谷 +ヨイチ 世一 +ヨイチ 代市 +ヨイチ 与市 +ヨイチ 與市 +ヨイチサコ 与一迫(與一迫) +ヨイチザコ 与一迫(與一迫) +ヨイチゾノ 与市園 +ヨイチゾノ 與市園 +ヨイチマエ 与市前(與市前) +ヨイツ 与都 +ヨイツ 與都 +ヨイナラ 四十八願 +ヨイナラ 宵奈良 +ヨイノマ 宵野間 +ヨイモト 吉本 +ヨウ 陽 +ヨウ 養 +ヨウ 遥 +ヨウ 陽宇 +ヨウアン 養安 +ヨウアン 養庵 +ヨウイネ 用稲 +ヨウエ 陽江 +ヨウエ 養会(養會) +ヨウオカ 陽岡 +ヨウオク 陽奥 +ヨウカ 養日 +ヨウカ 八日 +ヨウカイ 用皆 +ヨウカイ 要海 +ヨウカイ 要堺 +ヨウカイ 容貝 +ヨウカイ 用階 +ヨウガイ 用貝 +ヨウガイ 用皆 +ヨウガイ 要海 +ヨウガイ 要害 +ヨウガイ 用害 +ヨウガイ 容貝 +ヨウガイ 用海 +ヨウカイチ 八日市 +ヨウカイチヤ 八日市屋 +ヨウカイチヤ 八日市谷 +ヨウガウチ 要垣内 +ヨウガキウチ 要垣内 +ヨウカク 養覚(養覺) +ヨウカク 要覚 +ヨウガク 養学 +ヨウガク 養學 +ヨウカゾノ 八日囿 +ヨウカゾノ 八日園 +ヨウガチ 要垣内 +ヨウカワ 陽川 +ヨウカワ 用川 +ヨウカワ 要川 +ヨウキ 用木 +ヨウキ 要木 +ヨウキ 揚紀 +ヨウギ 要木 +ヨウゲン 要源 +ヨウゲン 陽源 +ヨウゴ 余戸 +ヨウコウ 影向 +ヨウザキ 要崎 +ヨウサダ 溶定 +ヨウザワ 用沢(用澤) +ヨウザン 曜山 +ヨウジ 楊枝 +ヨウジ 庸司 +ヨウジ 揚枝 +ヨウシゲ 要重 +ヨウシタ 用下 +ヨウシナ 用品 +ヨウジマ 要島 +ヨウジャク 要若 +ヨウショウ 用正 +ヨウスイ 用水 +ヨウスイ 養水 +ヨウスイグチ 用水口 +ヨウスイゲン 用水原 +ヨウスイハラ 用水原 +ヨウスギ 陽杉 +ヨウセ 用瀬 +ヨウセイ 養性 +ヨウセキ 養碩 +ヨウセキ 用石 +ヨウソ 養祖 +ヨウタ 養田 +ヨウタ 要田 +ヨウタ 用田 +ヨウタ 陽田 +ヨウダ 山田 +ヨウダ 誉田 +ヨウダ 養田 +ヨウダ 要田 +ヨウダ 葉田 +ヨウダ 用田 +ヨウダ 陽田 +ヨウダ 漸田 +ヨウダ 楊田 +ヨウダオオジ 山田大路 +ヨウタツ 用達 +ヨウタニ 陽谷 +ヨウチ 陽地 +ヨウチ 要地 +ヨウチ 遥地 +ヨウチ 遙地 +ヨウツ 養津 +ヨウツ 要津 +ヨウデン 用伝 +ヨウド 要戸 +ヨウド 要土 +ヨウド 用土 +ヨウトウ 要藤 +ヨウドウ 要藤 +ヨウドウ 踊堂 +ヨウドウ 養藤 +ヨウドウ 養道 +ヨウドノ 用殿 +ヨウナガ 要永 +ヨウネ 要根 +ヨウノ 丁野 +ヨウノ 要野 +ヨウノマル 用之丸 +ヨウハタ 養畑 +ヨウハラ 楊原 +ヨウハラ 養原 +ヨウハラ 用原 +ヨウハラ 陽原 +ヨウフ 養父 +ヨウフクジ 要福地 +ヨウヘイ 用平 +ヨウボ 養母 +ヨウマツ 用松 +ヨウマツ 養松 +ヨウマル 用丸 +ヨウミナ 用皆 +ヨウムラ 用村 +ヨウムラ 要村 +ヨウメイ 要明 +ヨウメイ 用名 +ヨウメン 用免 +ヨウモト 用元 +ヨウモト 陽本 +ヨウモト 用本 +ヨウモト 要元 +ヨウモン 要門 +ヨウヤマ 陽山 +ヨウヤマ 揚山 +ヨウヤマ 楊山 +ヨウユウ 陽遊 +ヨウラ 四浦 +ヨウラ 与浦 +ヨウリキ 要力 +ヨウロ 丁 +ヨウロウ 養老 +ヨウロゴ 丁子 +ヨエ 余江 +ヨエダ 四重田 +ヨエモンサ 右衛門佐 +ヨオダ 養王田 +ヨカゼ 与風(與風) +ヨカタ 四方 +ヨカタ 與賀田 +ヨカタ 四潟 +ヨガタ 与賀田 +ヨガタ 與賀田 +ヨカタニ 四ケ谷 +ヨカド 世門 +ヨガミ 与上 +ヨカリョウ 世嘉良 +ヨカワ 余川 +ヨカワ 与川 +ヨカワ 世川 +ヨカワ 與川 +ヨカワ 宜川 +ヨカワ 宣川 +ヨカワ 余河 +ヨカワ 与河(與河) +ヨガワ 余川 +ヨガワ 与川 +ヨガワ 與川 +ヨキ 依期 +ヨキ 与喜 +ヨギ 与儀 +ヨギ 與儀 +ヨギ 与木 +ヨギ 輿儀 +ヨギ 興儀 +ヨギ 余木 +ヨギ 与義 +ヨギ 輿木 +ヨギ 與木 +ヨギ 譽儀 +ヨギアシ 過足 +ヨキシオ 能塩 +ヨキタ 与北 +ヨキタ 與北 +ヨギタ 余喜多 +ヨギタ 与喜多 +ヨギタ 與喜多 +ヨキタニ 斧谷 +ヨキチ 与吉 +ヨキナタ 斧鉈 +ヨキノ 能野 +ヨキモト 余木元 +ヨキモト 與喜元 +ヨクガワ 沃川 +ヨクタ 与久田 +ヨクタ 與久田 +ヨクダ 与久田 +ヨクダ 與久田 +ヨグチ 与口 +ヨグチ 與口 +ヨクニ 与国(與国) +ヨクボ 餘久保 +ヨクボ 余久保 +ヨクミチ 能道 +ヨクモト 浴本 +ヨクモト 浴元 +ヨクヤマ 浴山 +ヨクラ 与倉 +ヨクラ 與倉 +ヨクラ 興倉 +ヨグラ 与倉 +ヨグラ 與倉 +ヨグロ 余黒 +ヨケ 吉行 +ヨケ 除 +ヨケ 餘家 +ヨケ 余家 +ヨゲ 与下 +ヨゲ 與下 +ヨケイ 代慶 +ヨケイ 余慶 +ヨケイ 餘慶 +ヨケイシ 除石 +ヨケウチ 除内 +ヨケガクチ 除ケ口 +ヨケガミ 除上 +ヨケガワ 除川 +ヨケダ 除田 +ヨケノ 除野 +ヨケハラ 除原 +ヨケムラ 除村 +ヨケムラ 防村 +ヨケモト 除本 +ヨコ 余湖 +ヨコ 横 +ヨゴ 余語 +ヨゴ 余吾 +ヨゴ 与語 +ヨゴ 余湖 +ヨゴ 余郷 +ヨゴ 余合 +ヨゴ 與語 +ヨゴ 与吾(與吾) +ヨゴ 余悟 +ヨゴ 与後 +ヨゴ 餘語 +ヨゴ 与呉 +ヨゴ 餘吾 +ヨゴ 興語 +ヨゴ 余伍 +ヨゴ 余呉 +ヨゴ 輿語 +ヨゴ 與呉 +ヨゴ 與後 +ヨゴ 與護 +ヨコアイ 横合 +ヨコアジロ 横網代 +ヨコイ 横井 +ヨコイ 横居 +ヨコイエ 横家 +ヨコイカワ 横井川 +ヨコイガワ 横井川 +ヨコイシ 横石 +ヨコイチ 横市 +ヨコイデ 横井手 +ヨコイナイ 横井内 +ヨコイヤマ 横井山 +ヨコイワ 横岩 +ヨコウ 余公 +ヨゴウ 余吾 +ヨゴウ 余郷 +ヨゴウ 余合 +ヨゴウ 与合 +ヨコウエ 横上 +ヨコウス 横臼 +ヨコウダ 代高田 +ヨコウチ 横内 +ヨコウチ 横打 +ヨコウネ 横畝 +ヨコウマ 横馬 +ヨコウラ 横浦 +ヨコエ 横江 +ヨコエガワ 横江川 +ヨコオ 横尾 +ヨコオ 横生 +ヨコオウジ 横大路 +ヨコオオジ 横大路 +ヨコオカ 横岡 +ヨコオク 横奥 +ヨコオチ 横落 +ヨコガイ 横貝 +ヨコガイチ 横垣内 +ヨコガキ 横垣 +ヨコガキ 横柿 +ヨコガケ 横欠 +ヨコガミ 横上 +ヨコカワ 横川 +ヨコカワ 横河 +ヨコガワ 横川 +ヨコガワ 横河 +ヨコキ 横木 +ヨコギ 横木 +ヨコギ 横儀 +ヨコキシザワ 横岸沢 +ヨコキシザワ 横岸澤 +ヨコギシザワ 横岸沢 +ヨコギシザワ 横岸澤 +ヨコキタ 横北 +ヨコグシ 横串 +ヨコグチ 横口 +ヨコクボ 横窪 +ヨコクボ 横久保 +ヨコクメ 横粂 +ヨコグモ 横雲 +ヨコクラ 横倉 +ヨココウジ 横小路 +ヨコゴシ 横越 +ヨコゴシ 横超 +ヨコゴシ 横腰 +ヨコゴシヤ 横越谷 +ヨコサ 横佐 +ヨコザ 横座 +ヨコサカ 横坂 +ヨコサカ 横阪 +ヨコサキ 横崎 +ヨコザキ 横崎 +ヨコサコ 横佐古 +ヨコサト 横里 +ヨコザト 横里 +ヨコサワ 横沢 +ヨコサワ 横澤 +ヨコザワ 横沢 +ヨコザワ 横澤 +ヨゴサワ 与五沢(与五澤) +ヨゴサワ 與五澤(輿五澤) +ヨゴサワ 與五沢 +ヨゴサワ 与吾沢 +ヨゴサワ 興五澤 +ヨコサワタ 横澤田 +ヨコサワダ 横沢田 +ヨコサワダ 横澤田 +ヨコシ 余越 +ヨコシ 横士 +ヨコジ 横地 +ヨコジ 横路 +ヨコジ 横治 +ヨコジ 横字 +ヨコシキ 横式 +ヨコシゲ 横繁 +ヨコシゲ 横重 +ヨコシタ 横下 +ヨコシバ 横芝 +ヨコシマ 横島 +ヨコシマ 横嶋 +ヨコシマ 横嶌 +ヨコジマ 横島 +ヨコジマ 横嶋 +ヨコショウ 横正 +ヨコショウジ 横小路 +ヨコショウジ 横障子 +ヨコシロ 横白 +ヨコシロ 横城 +ヨコス 横洲 +ヨコス 横須 +ヨコス 横州 +ヨコスカ 横須賀 +ヨコスカ 横須加 +ヨコズカ 横塚 +ヨコスギ 横杉 +ヨコズキ 横鋤 +ヨコズミ 横角 +ヨコズミ 横住 +ヨコセ 横瀬 +ヨコセ 横畝 +ヨコセキ 横関(横關) +ヨコゼキ 横関(横關) +ヨコゼキ 横堰 +ヨコゼニ 横銭 +ヨコソウチ 横左内 +ヨコソネ 横曾根(横曽根) +ヨコタ 横田 +ヨコタ 与古田 +ヨコタ 與古田 +ヨコタ 与小田(與小田) +ヨコタ 横多 +ヨコダ 横田 +ヨコダ 与古田 +ヨコダ 與古田 +ヨコダ 与小田(與小田) +ヨコダ 興古田 +ヨコダ 輿古田 +ヨコダイドウ 横大道 +ヨコタガワ 横田川 +ヨコタキ 横滝 +ヨコタキ 横瀧 +ヨコタケ 横竹 +ヨコタケ 横武 +ヨコタケ 横岳 +ヨコタチ 横田地 +ヨコタテ 横立 +ヨコダテ 横館 +ヨコダテ 横舘 +ヨコダナ 横棚 +ヨコタニ 横谷 +ヨコダニ 横谷 +ヨコタン 横丹 +ヨコダン 横段 +ヨコチ 横地 +ヨコチ 横知 +ヨコヂ 横地 +ヨコチョウ 横丁 +ヨコツ 横津 +ヨコツカ 横塚 +ヨコヅカ 横塚 +ヨコツジ 横辻 +ヨコツツミ 横堤 +ヨコヅツミ 横堤 +ヨコツボ 横坪 +ヨコヅミ 横積 +ヨコヅメ 横詰 +ヨコテ 横手 +ヨコデ 横出 +ヨコテイ 横亭 +ヨコデラ 横寺 +ヨコデン 横伝(横傳) +ヨコト 横戸 +ヨコド 横土 +ヨコトビ 横飛 +ヨコドリ 横取 +ヨコナカ 横中 +ヨコナガ 横長 +ヨコナガ 横永 +ヨコナダ 横灘 +ヨコナデ 横撫 +ヨコナミ 横南 +ヨコナミ 横並 +ヨコナミ 横浪 +ヨコナワ 横縄 +ヨコニシ 横西 +ヨコヌキ 横貫 +ヨコヌマ 横沼 +ヨコネ 横根 +ヨコノ 横野 +ヨコノミ 横呑 +ヨコハ 横葉 +ヨコハ 横羽 +ヨコバ 横場 +ヨコハギ 横佩 +ヨコハギ 横萩 +ヨコハシ 横橋 +ヨコハタ 横畠 +ヨコハタ 横畑 +ヨコバタ 横畠 +ヨコバタ 横畑 +ヨコバタケ 横畠 +ヨコババ 横馬場 +ヨコハマ 横浜 +ヨコハマ 横濱 +ヨコバヤシ 横林 +ヨコハラ 横原 +ヨコハリ 横張 +ヨコバリ 横張 +ヨコヒガシ 横東 +ヨコヒキ 横引 +ヨコビキ 横引 +ヨコヒサ 横久 +ヨコヒラ 横平 +ヨコフケ 横更 +ヨコフジ 横藤 +ヨコフジタ 横藤田 +ヨコブチ 横淵 +ヨコブチ 横渕 +ヨコベ 横部 +ヨコベ 横辺(横邊) +ヨコホリ 横堀 +ヨコボリ 横堀 +ヨコマ 横間 +ヨコマエ 横前 +ヨコマキ 横巻 +ヨコマク 横幕 +ヨコマクラ 横枕 +ヨコマス 横増 +ヨコマス 横枡 +ヨコマチ 横町 +ヨコマツ 横松 +ヨコマル 横丸 +ヨコミ 横見 +ヨコミズ 横水 +ヨコミセ 横見瀬 +ヨコミセ 横店 +ヨコミゾ 横溝 +ヨコミゾ 横構 +ヨコミチ 横道 +ヨコミチ 横路 +ヨコミチ 横通 +ヨコミツ 横光 +ヨコミツ 与古光 +ヨコミツ 横満 +ヨコミツ 與古光 +ヨコミナミ 横南 +ヨコミネ 横峯 +ヨコミネ 横峰 +ヨコミネ 横岑 +ヨコミヤ 横宮 +ヨコムカイ 横向 +ヨコムネ 横宗 +ヨコムラ 横村 +ヨコムロ 横室 +ヨコメ 横目 +ヨゴメ 余米 +ヨコモト 横本 +ヨコモト 横元 +ヨコモリ 横森 +ヨコモリ 横守 +ヨコヤ 横谷 +ヨコヤ 横矢 +ヨコヤ 横家 +ヨコヤ 横屋 +ヨコヤガイト 横屋垣内 +ヨコヤシキ 横屋敷 +ヨコヤナギ 横柳 +ヨコヤブ 横薮(横藪) +ヨコヤブ 横籔 +ヨコヤマ 横山 +ヨコユ 横湯 +ヨコロ 横路 +ヨコロ 余頃 +ヨコロ 横呂 +ヨゴロ 余頃 +ヨコワ 横輪 +ヨコワタ 横渡 +ヨコワタリ 横渡 +ヨコワリ 横割 +ヨサ 與三 +ヨサ 与謝 +ヨザ 与座 +ヨザ 與座 +ヨザ 余座 +ヨザ 興座 +ヨザ 輿座 +ヨサイ 与斎 +ヨサイ 与斉 +ヨサイ 与齊 +ヨサイ 輿斎 +ヨサイ 輿齊 +ヨサイ 與斎 +ヨサイ 與齋 +ヨサイ 與齊 +ヨザイ 余財 +ヨサオカ 与佐岡 +ヨサオカ 與佐岡 +ヨサカ 与坂 +ヨサカ 與坂 +ヨザキ 与崎 +ヨザキ 余崎(余嵜) +ヨザキ 與崎 +ヨサコ 与迫(與迫) +ヨサダ 与佐田(與佐田) +ヨサノ 与三野 +ヨサノ 与謝野 +ヨサノ 與三野 +ヨサノ 興謝野 +ヨサノ 與謝野 +ヨサモト 与三本 +ヨサモト 與三本 +ヨザワ 与沢 +ヨザワ 與澤 +ヨザワ 余沢 +ヨザワ 世沢 +ヨザワ 与澤 +ヨザワ 與沢 +ヨザワ 餘澤 +ヨサンテ 与三手 +ヨシ 吉 +ヨシ 義 +ヨシ 芳 +ヨシ 喜 +ヨシ 嘉 +ヨシ 葭 +ヨシ 良 +ヨシ 佳 +ヨシ 賀 +ヨシ 由 +ヨシ 儀 +ヨジ 与治 +ヨジ 与路 +ヨシアイ 吉相 +ヨシアイ 吉合 +ヨシアキ 吉秋 +ヨシアサ 吉朝 +ヨシアラ 吉新 +ヨシアラ 吉荒 +ヨシイ 吉井 +ヨシイ 由井 +ヨシイ 喜井 +ヨシイ 吉居 +ヨシイ 好井 +ヨシイ 芳井 +ヨシイ 由比 +ヨシイ 良井 +ヨシイ 吉位 +ヨシイ 義井 +ヨシイ 香井 +ヨシイ 吉氷 +ヨシイ 由居 +ヨシイ 葭井 +ヨシイ 義居 +ヨシイ 芳居 +ヨシイ 吉伊 +ヨシイ 善井 +ヨシイエ 吉家 +ヨシイエ 義家 +ヨシイギ 吉井木 +ヨシイケ 吉池 +ヨシイケ 芳池 +ヨシイケ 由池 +ヨシイケ 芦池 +ヨシイシ 吉石 +ヨシイズミ 吉泉 +ヨシイズミ 芳泉 +ヨシイチ 吉市 +ヨシイデ 吉出 +ヨシイデ 芳出 +ヨシイリ 義煎 +ヨシイワ 吉岩 +ヨシウエ 吉上 +ヨシウエ 吉植 +ヨシウジ 吉氏 +ヨシウダ 吉宇田 +ヨシウチ 吉内 +ヨシウチ 芦内 +ヨシウチ 葭内 +ヨシウチ 芳内 +ヨシウミ 吉海 +ヨシウメ 吉梅 +ヨシウラ 吉浦 +ヨシウラ 芦浦 +ヨシウラ 義浦 +ヨシウラ 好浦 +ヨシウラ 芳浦 +ヨシウラ 由浦 +ヨシエ 吉江 +ヨシエ 吉枝 +ヨシエ 義江 +ヨシエ 吉栄 +ヨシエ 葭江 +ヨシエ 吉得 +ヨシエ 義栄 +ヨシエ 好江 +ヨシエ 由栄 +ヨシエ 由榮 +ヨシエダ 吉枝 +ヨシオ 吉尾 +ヨシオ 芳尾 +ヨシオ 吉雄 +ヨシオ 由雄 +ヨシオ 由尾 +ヨシオ 吉生 +ヨシオ 善尾 +ヨシオ 良雄 +ヨシオカ 吉岡 +ヨシオカ 芳岡 +ヨシオカ 喜岡 +ヨシオカ 好岡 +ヨシオカ 善岡 +ヨシオカ 義岡 +ヨシオカ 葭岡 +ヨシオカ 芦岡 +ヨシオカ 能岡 +ヨシオカ 由岡 +ヨシオカ 美岡 +ヨシオカ 芳陵 +ヨシオカ 良岡 +ヨシオカ 佳岡 +ヨシオカ 嘉岡 +ヨシオカ 吉丘 +ヨシオカ 吉小神 +ヨシオカ 吉崗 +ヨシオカ 葮岡 +ヨシオカヤ 吉岡屋 +ヨシオキ 吉沖 +ヨシオキ 義沖 +ヨシオク 吉奥 +ヨシオリ 吉織 +ヨシカ 吉賀 +ヨシカ 吉鹿 +ヨシカ 吉加 +ヨシカ 芳家 +ヨシカ 吉香 +ヨシカ 善加 +ヨシガ 芳賀 +ヨシガ 吉賀 +ヨシカイ 吉開 +ヨシカイ 吉海 +ヨシカイ 吉貝 +ヨシカイ 吉戒 +ヨシカイ 吉飼 +ヨシガイ 吉谷 +ヨシガイ 吉開 +ヨシガイ 吉海 +ヨシガイ 吉貝 +ヨシカイエ 吉海江 +ヨシガイト 吉垣内 +ヨシガウラ 葭ケ浦 +ヨシカエ 吉加江 +ヨシガエ 吉ケ江 +ヨシガエ 吉加江 +ヨシガキ 吉垣 +ヨシガキ 芳垣 +ヨシガサキ 吉ケ崎 +ヨシガサコ 芳ケ迫 +ヨシガサワ 吉ケ沢 +ヨシガサワ 吉ケ澤 +ヨシガシマ 吉ケ島 +ヨシガシマ 吉ケ嶋 +ヨシカズ 嘉数(嘉數) +ヨシガセ 寄ケ瀬 +ヨシカタ 善方 +ヨシカタ 吉形 +ヨシカタ 吉方 +ヨシカタ 能方 +ヨシカタ 芳形 +ヨシカタ 良方 +ヨシカタ 芳片 +ヨシカタ 芳潟 +ヨシガタ 吉形 +ヨシカツ 吉勝 +ヨシカド 吉門 +ヨシカド 芳門 +ヨシカド 吉角 +ヨシカネ 吉兼 +ヨシカネ 吉金 +ヨシカネ 芳金 +ヨシカネ 義金 +ヨシカネ 慶金 +ヨシカネ 義兼 +ヨシカネ 善金 +ヨシカネ 芳鐘 +ヨシカネ 由金 +ヨシカネ 吉謙 +ヨシガネ 吉金 +ヨシガネ 義金 +ヨシガハラ 芦ケ原 +ヨシガベップ 吉ケ別府 +ヨシガベップ 吉ケ別符 +ヨシカミ 由上 +ヨシカミ 吉上 +ヨシカミ 芳上 +ヨシガミ 由上 +ヨシガミ 吉上 +ヨシガミ 芳上 +ヨシガミ 吉神 +ヨシガミ 善上 +ヨシガヤ 吉ケ谷 +ヨシガヤチ 葭谷内 +ヨシカワ 吉川 +ヨシカワ 芦川 +ヨシカワ 芳川 +ヨシカワ 好川 +ヨシカワ 吉河 +ヨシカワ 由川 +ヨシカワ 美川 +ヨシカワ 良川 +ヨシカワ 葭川 +ヨシカワ 義川 +ヨシカワ 幸川 +ヨシカワ 嘉川 +ヨシカワ 善川 +ヨシカワ 慶川 +ヨシカワ 宜川 +ヨシカワ 義河 +ヨシカワ 吉皮 +ヨシカワ 宣川 +ヨシカワ 良河 +ヨシカワ 霊河 +ヨシガワ 吉川 +ヨシカン 吉管 +ヨシカン 吉貫 +ヨシキ 吉木 +ヨシキ 吉識 +ヨシキ 吉城 +ヨシキ 吉敷 +ヨシキ 芳木 +ヨシキ 好木 +ヨシキ 吉規 +ヨシキ 宜喜 +ヨシキ 吉舗 +ヨシキ 芳樹 +ヨシキ 吉喜 +ヨシキ 吉機 +ヨシキ 吉貴 +ヨシキ 義木 +ヨシキ 吉岐 +ヨシキ 吉祇 +ヨシキ 吉樹 +ヨシキ 吉鋪 +ヨシキ 慶木 +ヨシキ 好城 +ヨシギ 吉木 +ヨシギ 吉儀 +ヨシギ 吉祇 +ヨシキタ 吉北 +ヨシキタ 嘉喜田 +ヨシキダニ 吉木谷 +ヨシキヨ 吉清 +ヨシキワ 吉際 +ヨシギワ 吉際 +ヨシグチ 吉口 +ヨシグチ 好口 +ヨシグチ 芳口 +ヨシクニ 吉国 +ヨシクニ 吉國 +ヨシクニ 義国 +ヨシクニ 喜国(喜國) +ヨシクニ 善国(善國) +ヨシクニ 芳邦 +ヨシクニ 義國 +ヨシクボ 吉久保 +ヨシクボ 吉窪 +ヨシクボ 由久保 +ヨシクミ 吉汲 +ヨシクラ 吉倉 +ヨシクラ 芳倉 +ヨシクラ 善倉 +ヨシクラ 由倉 +ヨシクラ 芳蔵 +ヨシクラ 義倉 +ヨシクラ 吉蔵 +ヨシクラ 芳藏 +ヨシクワ 吉桑 +ヨシコ 吉子 +ヨシコウ 吉幸 +ヨシゴウ 吉郷 +ヨシゴエ 吉越 +ヨシコシ 吉越 +ヨシコシ 芳越 +ヨシサカ 吉坂 +ヨシサカ 吉阪 +ヨシサカ 芳坂 +ヨシザカ 吉坂 +ヨシザカ 吉阪 +ヨシサキ 吉崎 +ヨシサキ 悳埼 +ヨシザキ 吉崎 +ヨシザキ 芳崎 +ヨシザキ 能崎(能嵜) +ヨシザキ 吉嵜 +ヨシザキ 好崎 +ヨシザキ 吉祥 +ヨシザキ 義崎 +ヨシザキ 葭崎 +ヨシザキ 由崎 +ヨシザキ 良崎 +ヨシサキヤ 吉崎屋 +ヨシザキヤ 吉崎屋 +ヨシサク 吉作 +ヨシザクラ 吉櫻 +ヨシサコ 吉迫 +ヨシサコ 吉廻 +ヨシサコ 由迫 +ヨシサコ 吉廹 +ヨシザコ 吉迫 +ヨシザコ 吉廻 +ヨシザコ 由迫 +ヨシサダ 吉貞 +ヨシサト 吉里 +ヨシサト 由里 +ヨシサト 吉郷 +ヨシサト 善里 +ヨシザト 吉里 +ヨシザト 美里 +ヨシザト 善里 +ヨシザネ 吉実 +ヨシザネ 吉真 +ヨシザネ 吉實 +ヨシザネ 吉眞 +ヨシサワ 吉沢 +ヨシサワ 吉澤 +ヨシザワ 吉沢 +ヨシザワ 吉澤 +ヨシザワ 芳沢 +ヨシザワ 芳澤 +ヨシザワ 義沢 +ヨシザワ 義澤 +ヨシザワ 由沢 +ヨシザワ 好沢 +ヨシザワ 由澤 +ヨシザワ 葭沢 +ヨシザワ 吉㚖 +ヨシザワ 善沢 +ヨシザワ 慶澤 +ヨシザワ 好澤 +ヨシザワ 葭澤 +ヨシジ 吉地 +ヨシジ 吉治 +ヨシジ 吉路 +ヨシシカ 吉鹿 +ヨシシキ 吉敷 +ヨシシゲ 吉重 +ヨシシゲ 芳重 +ヨシシゲ 吉繁 +ヨシシゲ 由繁 +ヨシシタ 吉下 +ヨシシタ 吉舌 +ヨシシバ 吉柴 +ヨシジマ 吉島 +ヨシジマ 吉嶋 +ヨシジマ 芳島 +ヨシジマ 義嶋 +ヨシジマ 吉嶌 +ヨシシミズ 吉清水 +ヨシジョウ 吉條 +ヨシシロ 吉代 +ヨシズ 吉津 +ヨシズ 芳須 +ヨシズ 吉須 +ヨシスエ 吉末 +ヨシスエ 義末 +ヨシスエ 好末 +ヨシスエ 芳末 +ヨシズエ 吉末 +ヨシズカ 吉塚 +ヨシスギ 吉杉 +ヨシスジ 吉筋 +ヨシズミ 吉住 +ヨシズミ 吉積 +ヨシズミ 善積 +ヨシズミ 吉栖 +ヨシズミ 義積 +ヨシズミ 善住 +ヨシズミ 吉角 +ヨシズミ 芳住 +ヨシズミ 吉澄 +ヨシズミ 善澄 +ヨシズミ 芳炭 +ヨシズミ 妙泉 +ヨシズミ 吉墨 +ヨシズミ 好住 +ヨシズミ 芳角 +ヨシズミ 由住 +ヨシズル 吉鶴 +ヨシセ 吉瀬 +ヨシゾエ 吉添 +ヨシゾエ 吉副 +ヨシゾエ 芳添 +ヨシゾエ 美添 +ヨシソノ 吉薗 +ヨシゾノ 吉薗 +ヨシゾノ 吉園 +ヨシゾノ 与市園 +ヨシゾノ 喜園 +ヨシタ 吉田 +ヨシタ 芳田 +ヨシタ 由田 +ヨシタ 好田 +ヨシタ 葭田 +ヨシタ 賀田 +ヨシタ 吉多 +ヨシタ 葭多 +ヨシタ 吉太 +ヨシダ 吉田 +ヨシダ 芦田 +ヨシダ 喜田 +ヨシダ 芳田 +ヨシダ 由田 +ヨシダ 好田 +ヨシダ 慶田 +ヨシダ 葭田 +ヨシダ 嘉田 +ヨシダ 良田 +ヨシダ 義田 +ヨシダ 賀田 +ヨシダ 吉多 +ヨシダ 与四田 +ヨシダ 誉士太 +ヨシダ 与子田 +ヨシダ 佳田 +ヨシダ 好多 +ヨシダ 芳多 +ヨシダ 由多 +ヨシダ 與四田 +ヨシダ 與子田 +ヨシダ 愿田 +ヨシダイラ 善平 +ヨシダイラ 芳平 +ヨシタカ 吉高 +ヨシタカ 吉鷹 +ヨシタカ 吉隆 +ヨシタカ 義高 +ヨシタカ 義鷹 +ヨシダガタ 吉田形 +ヨシタキ 吉滝 +ヨシタキ 吉瀧 +ヨシタキ 芳滝 +ヨシタケ 吉武 +ヨシタケ 吉竹 +ヨシタケ 儀武 +ヨシタケ 芳竹 +ヨシタケ 芳武 +ヨシタケ 善竹 +ヨシタケ 義武 +ヨシタケ 吉岳 +ヨシタケ 好竹 +ヨシタケ 好武 +ヨシタダ 芳忠 +ヨシタダ 吉忠 +ヨシダタミ 吉畳 +ヨシタチ 吉舘 +ヨシタツ 義達 +ヨシタツ 吉竜(吉龍) +ヨシタテ 吉立 +ヨシダテ 吉館 +ヨシダテ 吉舘 +ヨシタニ 吉谷 +ヨシタニ 芳谷 +ヨシタニ 由谷 +ヨシタニ 葭谷 +ヨシタニ 善谷 +ヨシタニ 吉渓 +ヨシタニ 吉澗 +ヨシタニ 吉溪 +ヨシタニ 穆谷 +ヨシタニ 良谷 +ヨシタネ 吉種 +ヨシタマ 吉玉 +ヨシダヤ 吉田谷 +ヨシダヤ 吉田屋 +ヨシダヤ 吉田矢 +ヨシチ 吉地 +ヨシチカ 吉近 +ヨシツ 吉津 +ヨシヅ 吉津 +ヨシヅ 葦津 +ヨシヅ 芳津 +ヨシツカ 吉塚 +ヨシツカ 吉束 +ヨシヅカ 吉塚 +ヨシヅカ 喜塚 +ヨシヅカ 良塚 +ヨシヅカ 義墳 +ヨシツギ 吉次 +ヨシヅキ 吉月 +ヨシヅキ 徳月 +ヨシツグ 吉次 +ヨシツグ 吉嗣 +ヨシツグ 吉続(吉續) +ヨシツグ 吉継 +ヨシツグ 好次 +ヨシツナ 吉綱 +ヨシツネ 義経 +ヨシツネ 好恒 +ヨシツネ 義常 +ヨシツネ 義經 +ヨシツバキ 吉椿 +ヨシヅミ 吉積 +ヨシヅミ 善積 +ヨシヅミ 義積 +ヨシツラ 善連 +ヨシツル 吉鶴 +ヨシヅル 吉鶴 +ヨシデ 吉出 +ヨシト 吉戸 +ヨシド 吉戸 +ヨシド 吉度 +ヨシド 由戸 +ヨシトウ 吉藤 +ヨシドウ 吉堂 +ヨシトキ 吉時 +ヨシトク 吉徳 +ヨシトク 由徳 +ヨシトシ 吉利 +ヨシトシ 吉年 +ヨシトシ 吉歳 +ヨシトシ 賀利 +ヨシトミ 吉富 +ヨシトミ 吉冨 +ヨシトミ 宜志富 +ヨシトミ 由富(由冨) +ヨシトミ 義富 +ヨシトミ 芳富 +ヨシトミ 好富 +ヨシトミ 好冨 +ヨシトミ 佳富 +ヨシトミ 佳冨 +ヨシトミ 宣志富 +ヨシドミ 吉富 +ヨシドミ 吉冨 +ヨシドミ 由富(由冨) +ヨシドミ 嘉富 +ヨシトメ 吉留(吉畄) +ヨシトメ 吉止 +ヨシドメ 吉留(吉畄) +ヨシドメ 佳留 +ヨシトモ 良知 +ヨシトモ 吉友 +ヨシトモ 義友 +ヨシトモ 芳友 +ヨシトモコウ 吉友高 +ヨシナ 吉名 +ヨシナ 与品 +ヨシナ 義名 +ヨシナ 與品 +ヨシナエ 吉苗 +ヨシナオ 吉直 +ヨシナカ 吉中 +ヨシナカ 吉仲 +ヨシナカ 芳中 +ヨシナカ 芳仲 +ヨシナカ 芦中 +ヨシナカ 好中 +ヨシナカ 義仲 +ヨシナカ 由中 +ヨシナカ 葭中 +ヨシナカ 葭仲 +ヨシナカ 義中 +ヨシナガ 吉永 +ヨシナガ 吉長 +ヨシナガ 義永 +ヨシナガ 慶長 +ヨシナガ 好永 +ヨシナガ 良永 +ヨシナガ 光長 +ヨシナガ 芳永 +ヨシナガ 由永 +ヨシナガ 嘉永 +ヨシナガ 幸永 +ヨシナガ 善永 +ヨシナガ 好長 +ヨシナガ 芳長 +ヨシナガ 義長 +ヨシナダ 吉灘 +ヨシナミ 善波 +ヨシナミ 吉浪 +ヨシナミ 吉波 +ヨシナミ 善浪 +ヨシナミ 良波 +ヨシナミ 由波 +ヨシナミ 吉並 +ヨシナミ 由浪 +ヨシナミ 好並 +ヨシナミ 芳浪 +ヨシナリ 吉成 +ヨシナリ 吉馴 +ヨシナリ 善成 +ヨシナリ 芳成 +ヨシナレ 吉馴 +ヨシニシ 吉西 +ヨシヌマ 吉沼 +ヨシヌマ 芳沼 +ヨシネ 吉根 +ヨシネ 芳根 +ヨシネ 由根 +ヨシノ 吉野 +ヨシノ 芳野 +ヨシノ 芦野 +ヨシノ 慶野 +ヨシノ 能野 +ヨシノ 義野 +ヨシノ 好野 +ヨシノ 由野 +ヨシノ 吉能 +ヨシノ 吉埜 +ヨシノ 葭野 +ヨシノ 宜野 +ヨシノ 吉納 +ヨシノ 宣野 +ヨシノ 能埜 +ヨシノ 芳埜 +ヨシノウ 吉能 +ヨシノウチ 芳之内 +ヨシノウチ 吉野内 +ヨシノウチ 芳ノ内 +ヨシノウラ 葭ノ浦 +ヨシノガワ 吉野川 +ヨシノソノ 吉ノ薗 +ヨシノソノ 吉之薗 +ヨシノソノ 吉ノ園 +ヨシノソノ 吉之園 +ヨシノタニ 吉野谷 +ヨシノブ 吉信 +ヨシノブ 吉延 +ヨシノブ 芳信 +ヨシノベ 吉延 +ヨシノベ 吉野部 +ヨシノベ 吉野辺 +ヨシノミ 吉呑 +ヨシノモト 吉ノ元 +ヨシノモト 吉之元 +ヨシノヤ 吉野谷 +ヨシノヤ 吉ノ谷 +ヨシノヤ 吉納谷 +ヨシノヤ 吉野屋 +ヨシノヤマ 吉野山 +ヨシノリ 義則 +ヨシハ 吉羽 +ヨシバ 吉羽 +ヨシバ 吉葉 +ヨシバ 吉場 +ヨシバ 葭葉 +ヨシバ 吉波 +ヨシバ 吉柴 +ヨシバ 由波 +ヨシバ 与芝 +ヨシバ 嘉場 +ヨシバ 芦場 +ヨシバ 與芝 +ヨシバ 葭場 +ヨシバ 葮葉 +ヨシハシ 吉橋 +ヨシバシ 吉橋 +ヨシハタ 吉畑 +ヨシハタ 吉畠 +ヨシハタ 吉幡 +ヨシバタ 吉端 +ヨシハナ 吉花 +ヨシハマ 吉浜 +ヨシハマ 吉濱 +ヨシハマ 由浜 +ヨシバヤシ 吉林 +ヨシバヤシ 芳林 +ヨシバヤシ 葭林 +ヨシハラ 吉原 +ヨシハラ 葭原 +ヨシハラ 芳原 +ヨシハラ 美原 +ヨシハラ 良原 +ヨシハラ 義原 +ヨシハラ 嘉原 +ヨシハラ 由原 +ヨシハラ 善原 +ヨシハラ 好原 +ヨシハラ 世次原 +ヨシハル 吉春 +ヨシヒ 吉氷 +ヨシヒ 吉日 +ヨシビキ 吉引 +ヨシヒコ 吉彦 +ヨシヒサ 吉久 +ヨシヒサ 義久 +ヨシヒサ 佳久 +ヨシヒデ 吉秀 +ヨシヒト 能仁 +ヨシヒラ 吉平 +ヨシヒラ 善平 +ヨシヒラ 義平 +ヨシヒラ 喜平 +ヨシヒラ 与志平 +ヨシヒラ 好平 +ヨシヒラ 葭平 +ヨシヒラ 與志平 +ヨシヒロ 吉弘 +ヨシヒロ 吉広 +ヨシヒロ 吉廣 +ヨシヒロ 義広 +ヨシヒロ 善弘 +ヨシヒロ 好博 +ヨシヒロ 好廣 +ヨシフ 吉府 +ヨシフク 吉福 +ヨシフサ 吉房 +ヨシフジ 吉藤 +ヨシフジ 由藤 +ヨシフジ 芳藤 +ヨシフジ 好藤 +ヨシブチ 吉淵 +ヨシブチ 吉渕 +ヨシフナ 吉船 +ヨシベ 吉部 +ヨシベ 珍部 +ヨシベ 吉辺 +ヨシホ 吉保 +ヨシホリ 吉堀 +ヨシボリ 吉堀 +ヨシマ 儀間 +ヨシマ 吉間 +ヨシマ 義間 +ヨシマ 余島 +ヨシマ 与島 +ヨシマ 吉真 +ヨシマ 與島 +ヨシマ 芳間 +ヨシマ 与嶋 +ヨシマ 好間 +ヨシマ 與嶋 +ヨジマ 余島 +ヨジマ 与島 +ヨジマ 余嶋 +ヨジマ 與島 +ヨシマキ 吉巻 +ヨシマサ 吉政 +ヨシマサ 吉正 +ヨシマサ 義政 +ヨシマサ 吉昌 +ヨシマス 吉増 +ヨシマス 吉益 +ヨシマス 吉桝 +ヨシマス 吉舛 +ヨシマス 吉枡 +ヨシマタ 吉俣 +ヨシマチ 吉町 +ヨシマチ 由町 +ヨシマツ 吉松 +ヨシマツ 嘉松 +ヨシマツ 芳松 +ヨシマツ 義松 +ヨシマツ 吉枩 +ヨシマヤ 吉満屋 +ヨシマル 吉丸 +ヨシマル 芳丸 +ヨシミ 吉見 +ヨシミ 能美 +ヨシミ 能見 +ヨシミ 妙見 +ヨシミ 嘉 +ヨシミ 吉味 +ヨシミ 美見 +ヨシミ 由見 +ヨシミ 好見 +ヨシミ 芳見 +ヨシミ 吉美 +ヨシミ 芦見 +ヨシミ 義見 +ヨシミ 善見 +ヨシミ 好美 +ヨシミ 禧美 +ヨシミ 吉巳 +ヨシミ 好実 +ヨシミズ 吉水 +ヨシミズ 由水 +ヨシミズ 吉清水 +ヨシミズ 美水 +ヨシミズ 義水 +ヨシミズ 芳水 +ヨシミチ 吉道 +ヨシミツ 吉満 +ヨシミツ 吉光 +ヨシミツ 好光 +ヨシミツ 義満 +ヨシミツ 義光 +ヨシミツ 好満 +ヨシミツ 吉滿 +ヨシミツ 由光 +ヨシミネ 吉峰 +ヨシミネ 吉峯 +ヨシミネ 吉嶺 +ヨシミネ 良峰 +ヨシミネ 良峯 +ヨシミネ 歓峯(歡峯) +ヨシミネ 歓峰 +ヨシミネ 吉岑 +ヨシミネ 好峰 +ヨシミネ 好峯 +ヨシミネ 善峰 +ヨシミヤ 吉宮 +ヨシミヤ 好宮 +ヨシミヤ 義宮 +ヨシミヤ 吉見谷 +ヨシムキ 吉向 +ヨシムタ 吉牟田 +ヨシムタ 吉無田 +ヨシムネ 吉宗 +ヨシムネ 吉棟 +ヨシムラ 吉村 +ヨシムラ 嘉村 +ヨシムラ 芳村 +ヨシムラ 能村 +ヨシムラ 義村 +ヨシムラ 芦村 +ヨシムラ 好村 +ヨシムラ 由村 +ヨシムラ 善村 +ヨシムラ 吉邨 +ヨシムラ 葭村 +ヨシムラ 吉邑 +ヨシムラ 良村 +ヨシムラ 芳邨 +ヨシムラ 佳村 +ヨシムラ 慶村 +ヨシムラ 芳邑 +ヨシムラ 余志村 +ヨシムラ 葮村 +ヨシムレ 吉牟礼 +ヨシムレ 吉牟禮 +ヨシムロ 吉室 +ヨシメ 嘉目 +ヨシメキ 吉目木 +ヨシメン 吉免 +ヨシモ 吉母 +ヨシモ 善最 +ヨシモチ 吉持 +ヨシモチ 吉用 +ヨシモト 吉本 +ヨシモト 吉元 +ヨシモト 四元 +ヨシモト 芳本 +ヨシモト 嘉本 +ヨシモト 由本 +ヨシモト 好本 +ヨシモト 善本 +ヨシモト 義本 +ヨシモト 葭本 +ヨシモト 由元 +ヨシモト 良元 +ヨシモト 芦本 +ヨシモト 義元 +ヨシモト 賀本 +ヨシモト 良本 +ヨシモト 昌本 +ヨシモト 佳元 +ヨシモト 宜本 +ヨシモト 喜元 +ヨシモト 慶本 +ヨシモト 善元 +ヨシモト 義基 +ヨシモト 美素 +ヨシモト 義根 +ヨシモト 芳元 +ヨシモト 嘉元 +ヨシモト 宣本 +ヨシモト 持元 +ヨシモト 佳本 +ヨシモト 義源 +ヨシモト 義始 +ヨシモト 好元 +ヨシモト 霊元 +ヨシモト 葮本 +ヨシモトヤ 吉本屋 +ヨシモリ 吉森 +ヨシモリ 吉盛 +ヨシモリ 芳森 +ヨシモリ 吉守 +ヨシモリ 吉毛利 +ヨシモリ 義盛 +ヨシモリ 由森 +ヨシモリ 好森 +ヨシモリ 葭森 +ヨシモリ 義森 +ヨシモリ 慶森 +ヨシヤ 吉谷 +ヨシヤ 吉屋 +ヨシヤ 吉家 +ヨシヤ 芳谷 +ヨシヤ 由谷 +ヨシヤ 葭谷 +ヨシヤ 葭矢 +ヨシヤ 芳屋 +ヨシヤ 吉矢 +ヨシヤ 吉弥(吉彌) +ヨシヤ 葭家 +ヨシヤ 葮家 +ヨシヤガワ 吉谷川 +ヨシヤギ 吉八木 +ヨシヤス 吉安 +ヨシヤス 葭安 +ヨシヤチ 吉谷地 +ヨシヤチ 葭谷内 +ヨシヤマ 吉山 +ヨシヤマ 嘉山 +ヨシヤマ 芳山 +ヨシヤマ 佳山 +ヨシヤマ 義山 +ヨシヤマ 慶山 +ヨシヤマ 能山 +ヨシヤマ 善山 +ヨシヤマ 霊山 +ヨシヤマ 芦山 +ヨシヤマ 好山 +ヨシヤマ 良山 +ヨシヤマ 葭山 +ヨシヤマ 由山 +ヨシヤマ 愿山 +ヨシユキ 吉行 +ヨシユミ 善弓 +ヨジョウ 四條 +ヨジョウ 四条 +ヨシラ 吉良 +ヨシラク 吉楽 +ヨシラク 吉樂 +ヨシロ 吉路 +ヨシロ 世代 +ヨシロ 予城 +ヨシロ 豫城 +ヨシワ 吉和 +ヨシワ 吉輪 +ヨシワ 芳輪 +ヨシワカ 義若 +ヨシワカ 吉若 +ヨシワキ 吉脇 +ヨシワキ 芳脇 +ヨシワケ 芳訳 +ヨシワケ 芳譯 +ヨシワダ 吉和田 +ヨシワタリ 吉渡 +ヨシワラ 吉原 +ヨシワラ 芳原 +ヨスイ 余水 +ヨスエ 代居 +ヨスエ 代末 +ヨズエ 代居 +ヨスギ 四杉 +ヨスケ 除補 +ヨスケ 余助 +ヨスケ 餘助 +ヨスズ 四鈴 +ヨスミ 四角 +ヨセ 世瀬 +ヨセ 余瀬 +ヨセ 代情 +ヨセイダ 寄井田 +ヨセカワ 寄川 +ヨセガワ 与世川 +ヨセザト 与世里(與世里) +ヨセジマ 寄島 +ヨセジマ 寄嶋 +ヨセダ 寄田 +ヨセダ 与世田 +ヨセダ 與世田 +ヨセタニ 寄谷 +ヨセデ 寄出 +ヨセハラ 与世原(與世原) +ヨセヒラ 与世平(與世平) +ヨセマチ 寄町 +ヨセマチ 四畝町 +ヨセモト 寄元 +ヨセモリ 寄森 +ヨセモリ 与世盛 +ヨセヤマ 与世山 +ヨセヤマ 與世山 +ヨゼン 余膳 +ヨソ 四十 +ヨソイ 与曽井(與曾井) +ヨソイ 與曽井 +ヨソイ 与三井 +ヨソイ 四十井 +ヨソイ 与曾井 +ヨソウ 与宗 +ヨゾウ 余増 +ヨソエ 四十栄 +ヨソエ 四十榮 +ヨソオイ 粧 +ヨソオカ 四十岡 +ヨソカワ 與三川 +ヨソカワ 与三川 +ヨソガワ 与三川 +ヨソジ 余所地 +ヨソズミ 四十住 +ヨソダ 外田 +ヨソダ 四十田 +ヨソダ 与十田 +ヨソダ 与曽田(與曽田) +ヨソダ 与曾田 +ヨソヅカ 四十塚 +ヨソナラ 四十八願 +ヨソノ 四十野 +ヨソミヤ 四十宮 +ヨソヤマ 四十山 +ヨタ 依田 +ヨダ 依田 +ヨダ 代田 +ヨダ 余田 +ヨダ 与田 +ヨダ 與田 +ヨダ 世田 +ヨダ 餘田 +ヨダ 輿田 +ヨタオ 与太夫 +ヨタガイト 与多垣内(與多垣内) +ヨタガキウチ 与多垣内(與多垣内) +ヨタニ 余谷 +ヨタニ 与谷 +ヨタニ 與谷 +ヨタニ 餘谷 +ヨタブン 余多分 +ヨタブン 餘多分 +ヨタワラ 四俵 +ヨダワラ 四俵 +ヨダワラ 世俵 +ヨチ 余地 +ヨツ 四津 +ヨヅ 四津 +ヨヅ 与津 +ヨツイ 四井 +ヨツイ 四位 +ヨツイ 四ツ井 +ヨツイ 四居 +ヨツイ 四ツ居 +ヨツイ 四維 +ヨツイ 四津井 +ヨツイ 四飯 +ヨツイ 肆井 +ヨツイカリ 四ツ碇 +ヨツイカリ 四碇 +ヨツイダ 四ツ井田 +ヨツイダ 四井田 +ヨツウジ 四氏 +ヨツエダ 四枝 +ヨッカ 四日 +ヨッカイチ 四日市 +ヨツカド 四ツ門 +ヨツカド 四門 +ヨツカマ 四ツ釜 +ヨツガマ 四ツ釜 +ヨツカワ 四川 +ヨツカワ 四津川 +ヨツキ 四木 +ヨツキ 四ツ木 +ヨツギ 四木 +ヨツギ 世継 +ヨツギ 代継 +ヨツギ 代次 +ヨツギ 四ツ木 +ヨツギ 世続 +ヨツクラ 四倉 +ヨツクラ 四ツ倉 +ヨツクリ 四栗 +ヨツグリ 四栗 +ヨツグルマ 四ツ車 +ヨツジ 四辻 +ヨツシカ 四鹿 +ヨツシマ 四ツ島 +ヨツシマ 四ツ嶋 +ヨツセキ 四関 +ヨツセキ 四ツ関 +ヨツゼキ 四関 +ヨツゼキ 四ツ関 +ヨツダ 四田 +ヨツダ 四ツ田 +ヨツダ 四津田 +ヨツタキ 四ツ滝 +ヨツタキ 四ツ瀧 +ヨツダケ 四ツ岳 +ヨツダケ 四ツ嶽 +ヨツタニ 四谷 +ヨツタニ 四ツ谷 +ヨツタニ 四津谷 +ヨツヅカ 四塚 +ヨツヅカ 四ツ塚 +ヨッツジ 四辻 +ヨツツジ 四辻 +ヨツツジ 四ツ辻 +ヨツツジ 四衢 +ヨツナガ 四ツ永 +ヨツノヤ 乗 +ヨツノヤチ 乗智 +ヨツハシ 四橋 +ヨツハシ 四ツ橋 +ヨツハシ 四つ橋 +ヨツバヤシ 四林 +ヨツフジ 四藤 +ヨツマタ 四俣 +ヨツミ 四海 +ヨツミチ 四ツ路 +ヨツムラ 四ツ村 +ヨツメ 四ツ目 +ヨツメ 四つ目 +ヨツモト 四元 +ヨツモト 四本 +ヨツモト 四下 +ヨツヤ 四家 +ヨツヤ 四谷 +ヨツヤ 四ツ谷 +ヨツヤ 肆矢 +ヨツヤ 四津谷 +ヨツヤ 四ツ家 +ヨツヤ 四ツ屋 +ヨツヤ 四屋 +ヨツヤ 肆谷 +ヨツヤ 世津谷 +ヨツヤク 四役 +ヨツヤク 四ツ役 +ヨツヤナギ 四柳 +ヨツヤナギ 四ツ柳 +ヨツワケ 四ツ分 +ヨデン 依田 +ヨデン 余田 +ヨデン 余伝 +ヨデン 世伝 +ヨデン 余傅 +ヨデン 余傳 +ヨト 世登 +ヨト 四十 +ヨト 与戸(與戸) +ヨト 餘戸 +ヨト 余戸 +ヨド 淀 +ヨド 与戸(與戸) +ヨド 餘戸 +ヨドイ 淀井 +ヨトウ 世登 +ヨトウ 四藤 +ヨトウ 与藤 +ヨトウ 與藤 +ヨトエ 四十栄 +ヨドエ 淀江 +ヨトオリ 四通 +ヨトオリダ 四通田 +ヨドカド 淀門 +ヨドカネ 淀金 +ヨドカワ 淀川 +ヨドガワ 淀川 +ヨドキ 淀木 +ヨドギシ 四戸岸 +ヨドグチ 淀口 +ヨドゴウチ 淀河内 +ヨドサワ 淀沢 +ヨドサワ 淀澤 +ヨドザワ 淀澤 +ヨドシ 吉年 +ヨドセ 淀瀬 +ヨドタニ 淀谷 +ヨドデン 淀田 +ヨドナワ 淀縄 +ヨドナワ 淀繩 +ヨドナワ 淀名和 +ヨドノ 淀野 +ヨドハラ 淀原 +ヨドヒラ 淀平 +ヨドブチ 淀淵 +ヨドブチ 淀渕 +ヨドミ 淀見 +ヨドミズ 淀水 +ヨドムラ 淀村 +ヨドモト 淀本 +ヨドモリ 淀森 +ヨドヤ 淀谷 +ヨドヤ 淀屋 +ヨトリ 世取 +ヨトリヤマ 世取山 +ヨトリヤマ 世鳥山 +ヨドワタリ 淀渡 +ヨナ 与那 +ヨナ 與那 +ヨナ 与名 +ヨナ 興那 +ヨナ 輿那 +ヨナ 與名 +ヨナイ 米内 +ヨナイ 寄内 +ヨナイグチ 米内口 +ヨナイザワ 米内沢 +ヨナイヤマ 米内山 +ヨナオ 与猶 +ヨナオ 與猶 +ヨナガ 世永 +ヨナガ 代永 +ヨナガ 餘永 +ヨナガ 代長 +ヨナガ 余永 +ヨナガ 与永 +ヨナガ 與永 +ヨナカワ 米川 +ヨナクニ 与那国 +ヨナクニ 與那國 +ヨナグニ 与那国 +ヨナグニ 與那国 +ヨナグニ 與那國 +ヨナゴ 米子 +ヨナザワ 米澤 +ヨナシタ 与那下 +ヨナシタ 與那下 +ヨナシロ 与那城 +ヨナシロ 與那城 +ヨナシロ 世名城 +ヨナシロ 興那城 +ヨナシロ 与名城(與名城) +ヨナズ 米津 +ヨナヅ 米津 +ヨナハ 与那覇 +ヨナハ 與那覇 +ヨナハ 輿那覇 +ヨナハ 興那覇 +ヨナハナ 与那花(與那花) +ヨナハラ 与那原 +ヨナハラ 與那原 +ヨナハラ 興那原 +ヨナバル 與那原 +ヨナミ 世並 +ヨナミ 世浪 +ヨナミ 世波 +ヨナミネ 与那嶺 +ヨナミネ 與那嶺 +ヨナミネ 輿那嶺 +ヨナミネ 興那嶺 +ヨナミネ 米峰 +ヨナミヤ 世並屋 +ヨナモト 米本 +ヨナモト 与名本(與名本) +ヨナモト 要名本 +ヨナモト 与那元 +ヨナヤマ 米内山 +ヨナワ 与縄 +ヨナワ 余縄 +ヨナワ 与繩 +ヨナワ 與縄 +ヨニシ 余西 +ヨニシ 夜西 +ヨニシ 与西(與西) +ヨネ 米 +ヨネ 世根 +ヨネ 要根 +ヨネイ 米井 +ヨネイシ 米石 +ヨネイズミ 米泉 +ヨネイチ 米一 +ヨネイマ 米今 +ヨネウエ 米上 +ヨネウジ 米氏 +ヨネウチ 米内 +ヨネウチヤマ 米内山 +ヨネウラ 米浦 +ヨネエ 米江 +ヨネエ 米衛(米衞) +ヨネオ 米尾 +ヨネオ 米生 +ヨネオカ 米岡 +ヨネオカ 米丘 +ヨネオク 米奥 +ヨネカ 米花 +ヨネガキ 米垣 +ヨネカタ 米加田 +ヨネカネ 米金 +ヨネガヤ 米ケ谷 +ヨネカワ 米川 +ヨネガワ 米川 +ヨネキ 米木 +ヨネキ 米城 +ヨネキ 米来 +ヨネギシ 米岸 +ヨネキタ 米北 +ヨネキヅ 米木津 +ヨネキュウ 米久 +ヨネクタ 米久田 +ヨネグチ 米口 +ヨネクボ 米窪 +ヨネクボ 米久保 +ヨネクラ 米倉 +ヨネクラ 米蔵 +ヨネクラ 米藏 +ヨネコ 米子 +ヨネザ 米座 +ヨネサカ 米坂 +ヨネサカ 米阪 +ヨネサキ 米崎 +ヨネサキ 米嵜 +ヨネザキ 米崎 +ヨネザキ 米埼 +ヨネザキ 米嵜 +ヨネサク 米咲 +ヨネサコ 米迫 +ヨネサト 米里 +ヨネザト 米里 +ヨネサワ 米沢 +ヨネサワ 米澤 +ヨネザワ 米沢 +ヨネザワ 米澤 +ヨネザワヤ 米沢谷 +ヨネザワヤ 米沢屋 +ヨネザワヤ 米澤谷 +ヨネジ 米地 +ヨネジ 米司 +ヨネシゲ 米重 +ヨネシタ 米下 +ヨネシマ 米島 +ヨネシマ 米嶋 +ヨネシマ 米嶌 +ヨネジマ 米島 +ヨネジマ 米嶋 +ヨネショウ 米正 +ヨネシロ 米城 +ヨネシロ 米代 +ヨネス 米須 +ヨネズ 米津 +ヨネズ 米頭 +ヨネスカ 米須賀 +ヨネスギ 米杉 +ヨネズミ 米積 +ヨネズミ 米住 +ヨネズミ 米隅 +ヨネズミ 米澄 +ヨネセ 米世 +ヨネセ 米勢 +ヨネセ 米瀬 +ヨネソ 米所 +ヨネゾノ 米園 +ヨネゾノ 米薗 +ヨネタ 米田 +ヨネタ 米多 +ヨネダ 米田 +ヨネダ 米陀 +ヨネダ 米多 +ヨネダ 余根田 +ヨネダ 米夛 +ヨネタケ 米竹 +ヨネタケ 米嵩 +ヨネタニ 米谷 +ヨネタマリ 米玉利 +ヨネチ 米地 +ヨネヂ 米地 +ヨネチカ 米近 +ヨネツ 米津 +ヨネヅ 米津 +ヨネツカ 米塚 +ヨネヅカ 米塚 +ヨネツキ 米月 +ヨネツギ 米次 +ヨネツグ 米次 +ヨネツジ 米辻 +ヨネツバキ 米椿 +ヨネヅミ 米積 +ヨネデ 米出 +ヨネト 米戸 +ヨネド 米戸 +ヨネトウ 米藤 +ヨネドウ 米堂 +ヨネトク 米徳 +ヨネトミ 米富 +ヨネトミ 米冨 +ヨネドメ 米留 +ヨネナカ 米中 +ヨネナガ 米良 +ヨネナガ 米永 +ヨネナガ 米長 +ヨネナミ 米波 +ヨネヌマ 米沼 +ヨネノ 米野 +ヨネノ 米𡌛 +ヨネノウ 米納 +ヨネノブ 米延 +ヨネハギ 米萩 +ヨネハク 米白 +ヨネバク 米麦 +ヨネハシ 米橋 +ヨネハタ 米畑 +ヨネハナ 米花 +ヨネハマ 米浜 +ヨネハマ 米濱 +ヨネバヤシ 米林 +ヨネハラ 米原 +ヨネヒサ 米久 +ヨネヒラ 米平 +ヨネヒロ 米広(米廣) +ヨネフク 米福 +ヨネフジ 米藤 +ヨネベ 米部 +ヨネマサ 米正 +ヨネマス 米増 +ヨネマス 米桝 +ヨネマス 米益 +ヨネマス 米舛 +ヨネマス 米升 +ヨネマス 米枡 +ヨネマタ 米又 +ヨネマチ 米町 +ヨネマツ 米松 +ヨネマル 米丸 +ヨネミズ 米水 +ヨネミチ 米道 +ヨネミチ 米通 +ヨネミツ 米満 +ヨネミツ 米光 +ヨネミツ 米滿 +ヨネムシ 米虫 +ヨネムシ 米蒸 +ヨネムラ 米村 +ヨネムラ 世根村 +ヨネメ 米女 +ヨネモチ 米持 +ヨネモチ 米望 +ヨネモチ 米餅 +ヨネモト 米本 +ヨネモト 米元 +ヨネモト 与根本(與根本) +ヨネモリ 米森 +ヨネモリ 米盛 +ヨネモリ 米守 +ヨネヤ 米谷 +ヨネヤ 米屋 +ヨネヤ 米家 +ヨネヤ 米矢 +ヨネヤ 米弥 +ヨネヤス 米安 +ヨネヤマ 米山 +ヨネヨシ 米吉 +ヨネヨシ 米由 +ヨネラ 米良 +ヨネワ 米和 +ヨネワキ 米脇 +ヨネワク 米涌 +ヨネワケ 米分 +ヨノ 余野 +ヨノ 与野 +ヨノ 四野 +ヨノ 夜野 +ヨノ 與野 +ヨノ 餘野 +ヨノ 与ノ(與ノ) +ヨノイ 余井 +ヨノイ 与野井 +ヨノイチ 世ノ一 +ヨノウ 米納 +ヨノウエ 世ノ上 +ヨノウヅ 米納津 +ヨノキ 余野木 +ヨノキ 与野木 +ヨノキ 鰀貴 +ヨノキ 與野木 +ヨノキ 餘野木 +ヨノギ 余野木 +ヨノギ 餘野木 +ヨノキダ 楊木田 +ヨノクマ 与熊 +ヨノシタ 世ノ下 +ヨノダ 夜野田 +ヨノベ 余野部 +ヨノミ 余海 +ヨノムラ 与之村 +ヨノメ 鰀目 +ヨノモト 与能本 +ヨノモト 世ノ本 +ヨノモト 與能本 +ヨノヤマ 与野山 +ヨハ 饒波 +ヨハ 与羽 +ヨハ 與羽 +ヨハゼ 与羽瀬 +ヨハゼ 與羽瀬 +ヨバタ 与畑(與畑) +ヨバタ 与畠 +ヨバナ 代花 +ヨハラ 庵原 +ヨハラ 与原 +ヨハラ 余原 +ヨハラ 與原 +ヨビイシ 呼石 +ヨビカワ 呼川 +ヨビサカ 呼坂 +ヨビタ 喚田 +ヨビノ 呼野 +ヨビモト 呼元 +ヨビヤマ 喚山 +ヨヒラ 余平 +ヨヒロ 四広 +ヨヒロ 四廣 +ヨフウ 予風 +ヨフウ 豫風 +ヨブコ 呼子 +ヨブサカ 呼坂 +ヨフネ 夜船(夜舩) +ヨブノ 呼野 +ヨヘナ 饒平名 +ヨヘナ 饒辺名 +ヨヘナ 余平名 +ヨヘナ 鐃平名 +ヨヘン 饒辺 +ヨヘン 饒邊 +ヨホ 余保 +ヨボ 余保 +ヨホタ 与保田 +ヨマ 余間 +ヨマイダ 四枚田 +ヨマサリ 世増 +ヨマス 余舛 +ヨマス 餘舛 +ヨマス 余桝 +ヨマセ 世間瀬 +ヨマチ 與町 +ヨマチダ 四町田 +ヨミ 夜見 +ヨミ 与味 +ヨミ 誉美 +ヨミタンザン 読谷山(讀谷山) +ヨミツ 依光 +ヨミツ 世満 +ヨミネ 与嶺 +ヨミネ 與嶺 +ヨミハラ 代美原 +ヨミヤ 余宮 +ヨミヤ 豫宮 +ヨミヤマ 読谷山(讀谷山) +ヨミヤマ 読山 +ヨムラ 余村 +ヨムラ 四村 +ヨムラ 与村 +ヨムラ 四邨 +ヨメガネ 嫁兼 +ヨメサカ 嫁阪 +ヨメダ 嫁田 +ヨメタダ 四目忠 +ヨメタニ 娌谷 +ヨモ 四方 +ヨモ 与茂 +ヨモ 四坊 +ヨモ 余百 +ヨモカワ 四方川 +ヨモギ 蓬 +ヨモギ 蓬生 +ヨモギ 艾 +ヨモギサワ 蓬沢 +ヨモギサワ 蓬澤 +ヨモギサワ 艾沢 +ヨモギサワ 艾澤 +ヨモギザワ 蓬沢 +ヨモギザワ 蓬澤 +ヨモギタ 蓬田 +ヨモギダ 蓬田 +ヨモギハタ 蓬畑 +ヨモギハラ 艾原 +ヨモク 与杢 +ヨモサ 右衛門佐 +ヨモサ 与茂佐 +ヨモジ 四方路 +ヨモシロ 四方城 +ヨモタ 四方田 +ヨモタ 四百田 +ヨモタ 余茂田(餘茂田) +ヨモダ 四方田 +ヨモダ 四万田 +ヨモダ 与茂田(與茂田) +ヨモチ 世持 +ヨモト 代本 +ヨモト 与本 +ヨモト 與本 +ヨモノ 四茂野 +ヨモヤ 四方谷 +ヨモヤマ 四方山 +ヨモリ 世森 +ヨモン 余門 +ヨモン 与門 +ヨヤス 与安 +ヨヤス 世安 +ヨヤス 與安 +ヨヤマ 与山 +ヨヤマ 夜山 +ヨヤマ 與山 +ヨヤマ 予山 +ヨヤマ 余山 +ヨヤマ 豫山 +ヨヨギ 代々城 +ヨヨギ 代々木 +ヨラ 与良 +ヨラ 與良 +ヨラ 興良 +ヨリ 頼 +ヨリ 寄 +ヨリアイ 寄合 +ヨリアミ 依網 +ヨリイ 寄井 +ヨリイシ 寄石 +ヨリウメ 撰梅 +ヨリエ 寄江 +ヨリエ 寄恵 +ヨリオ 寄尾 +ヨリオカ 依岡 +ヨリオカ 頼岡 +ヨリオカ 寄岡 +ヨリガセ 寄ケ瀬 +ヨリカド 頼角 +ヨリカド 寄門 +ヨリカネ 頼金 +ヨリカネ 寄金 +ヨリカネ 寄兼 +ヨリカネ 頼兼 +ヨリカネ 依兼 +ヨリカネ 依包 +ヨリカネ 従金 +ヨリガネ 頼兼 +ヨリカミ 寄神 +ヨリガミ 寄神 +ヨリガミ 寄上 +ヨリカワ 寄川 +ヨリカワ 寄河 +ヨリキ 寄木 +ヨリキ 頼木 +ヨリキ 依木 +ヨリキ 与力 +ヨリキ 寄気(寄氣) +ヨリキ 余力 +ヨリグチ 寄口 +ヨリクニ 寄国 +ヨリクニ 頼国 +ヨリクニ 寄國 +ヨリクニ 頼國 +ヨリサキ 寄崎 +ヨリサダ 頼定 +ヨリサダ 寄貞 +ヨリサダ 撰定 +ヨリサダ 寄定 +ヨリサダ 頼貞 +ヨリサト 依里 +ヨリザネ 頼実 +ヨリザネ 寄実 +ヨリザネ 頼實 +ヨリサワ 頼沢 +ヨリサワ 頼澤 +ヨリシゲ 頼重 +ヨリシゲ 寄重 +ヨリシタ 寄下 +ヨリシマ 寄島 +ヨリシマ 頼島 +ヨリスエ 頼末 +ヨリスナ 寄砂 +ヨリズミ 頼住 +ヨリズミ 寄住 +ヨリセ 寄瀬 +ヨリタ 依田 +ヨリタ 寄田 +ヨリタ 頼田 +ヨリタカ 寄高 +ヨリタカ 頼高 +ヨリタカ 頼尊 +ヨリタテ 寄立 +ヨリタニ 寄谷 +ヨリタマ 寄玉 +ヨリチ 頼地 +ヨリチカ 頼近 +ヨリチカ 寄親 +ヨリツネ 頼経 +ヨリツネ 頼常 +ヨリツネ 頼經 +ヨリヅメ 寄詰 +ヨリトウ 寄東 +ヨリトミ 頼富 +ヨリトミ 頼冨 +ヨリトメ 寄留 +ヨリドメ 寄留 +ヨリトモ 寄友 +ヨリトモ 頼朝 +ヨリトモ 頼友 +ヨリナ 寄名 +ヨリナイ 寄内 +ヨリナカ 寄中 +ヨリナカ 頼仲 +ヨリナガ 頼永 +ヨリナガ 寄永 +ヨリナガ 頼長 +ヨリノ 寄能 +ヨリノ 従野 +ヨリノ 頼野 +ヨリノ 寄野 +ヨリノ 余利野 +ヨリノ 餘利野 +ヨリノ 從野 +ヨリノウ 寄能 +ヨリノブ 頼信 +ヨリノリ 頼則 +ヨリバ 寄場 +ヨリハシ 寄橋 +ヨリバヤシ 寄林 +ヨリハラ 寄原 +ヨリヒサ 頼久 +ヨリヒラ 寄平 +ヨリヒロ 頼広 +ヨリヒロ 頼廣 +ヨリヒロ 寄広(寄廣) +ヨリフサ 自房 +ヨリフサ 頼房 +ヨリフジ 依藤 +ヨリフジ 寄藤 +ヨリフジ 頼藤 +ヨリベ 寄辺 +ヨリベ 寄邊 +ヨリマエ 頼前 +ヨリマサ 頼政 +ヨリマサ 頼正 +ヨリマサ 寄政 +ヨリマツ 寄松 +ヨリマツ 頼松 +ヨリミ 頼実 +ヨリミ 頼美 +ヨリミズ 寄水 +ヨリミツ 依光 +ヨリミツ 頼光 +ヨリミツ 寄光 +ヨリミツ 寄満 +ヨリムネ 寄宗 +ヨリムラ 寄村 +ヨリモチ 寄持 +ヨリモト 寄本 +ヨリモト 頼本 +ヨリモト 寄元 +ヨリモト 依本 +ヨリモト 依元 +ヨリモト 頼元 +ヨリモリ 寄森 +ヨリヤ 頼谷 +ヨリヤス 頼安 +ヨリヤス 寄保 +ヨリヨシ 依吉 +ヨロ 丁 +ヨロイ 万井 +ヨロイ 萬井 +ヨロイ 鎧 +ヨロイサカ 鎧坂 +ヨロイザカ 鎧坂 +ヨロイザワ 鎧沢 +ヨロイダカ 鎧高 +ヨロイツカ 鎧塚 +ヨロイヅカ 鎧塚 +ヨロウキ 万浮 +ヨロウキ 萬浮 +ヨロエ 万重 +ヨロカワ 萬川 +ヨロキ 萬木 +ヨロギ 萬木 +ヨロズ 萬 +ヨロズ 万 +ヨロズイ 万井 +ヨロズイ 萬井 +ヨロズオカ 万岡 +ヨロズオカ 萬岡 +ヨロズタニ 万谷 +ヨロズヤ 万谷 +ヨロズヤ 萬谷 +ヨロズヤ 万屋 +ヨロズヤ 萬屋 +ヨロズヤ 萬家 +ヨロズヤ 万家 +ヨロズヤ 萬矢 +ヨロズヤ 万矢 +ヨロズヨ 萬代 +ヨロセ 万瀬 +ヨロセ 萬瀬 +ヨロヅ 萬 +ヨワイ 齢 +ヨンマイダ 四枚田 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/ja/data/numbers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/digit.tsv new file mode 100644 index 0000000..d0bdca3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/digit.tsv @@ -0,0 +1,9 @@ +一 1 +二 2 +三 3 +四 4 +五 5 +六 6 +七 7 +八 8 +九 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/dot.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/dot.tsv new file mode 100644 index 0000000..c15a4cd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/dot.tsv @@ -0,0 +1 @@ +点 . \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/hundred.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/hundred.tsv new file mode 100644 index 0000000..a58eff3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/hundred.tsv @@ -0,0 +1 @@ +百 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/hundred_digit.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/hundred_digit.tsv new file mode 100644 index 0000000..0cbd132 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/hundred_digit.tsv @@ -0,0 +1,9 @@ +百一 101 +百二 102 +百三 103 +百四 104 +百五 105 +百六 106 +百七 107 +百八 108 +百九 109 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/sign.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/sign.tsv new file mode 100644 index 0000000..41f0611 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/sign.tsv @@ -0,0 +1,4 @@ +正 + +プラス + +プラスマイナス ± +マイナス - \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/teen.tsv new file mode 100644 index 0000000..3b4370e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/teen.tsv @@ -0,0 +1,10 @@ +十 10 +十一 11 +十二 12 +十三 13 +十四 14 +十五 15 +十六 16 +十七 17 +十八 18 +十九 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/thousands.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/thousands.tsv new file mode 100644 index 0000000..e37d2bf --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/thousands.tsv @@ -0,0 +1,9 @@ +千 +万 +亿 +兆 +京 +垓 +秭 +穰 +沟 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/ties.tsv new file mode 100644 index 0000000..365df8b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/ties.tsv @@ -0,0 +1,8 @@ +二十 2 +三十 3 +四十 4 +五十 5 +六十 6 +七十 7 +八十 8 +九十 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/ja/data/numbers/zero.tsv new file mode 100644 index 0000000..ed5707f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/numbers/zero.tsv @@ -0,0 +1,2 @@ +〇 0 +零 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/ja/data/ordinals/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/ja/data/ordinals/digit.tsv new file mode 100644 index 0000000..d035cb7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/ordinals/digit.tsv @@ -0,0 +1,9 @@ +第一 1 +第二 2 +第三 3 +第四 4 +第五 5 +第六 6 +第七 7 +第八 8 +第九 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/ordinals/teen.tsv b/fun_text_processing/inverse_text_normalization/ja/data/ordinals/teen.tsv new file mode 100644 index 0000000..6e22447 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/ordinals/teen.tsv @@ -0,0 +1,10 @@ +第十 10 +第十一 11 +第十二 12 +第十三 13 +第十四 14 +第十五 15 +第十六 16 +第十七 17 +第十八 18 +第十九 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/ordinals/ties.tsv b/fun_text_processing/inverse_text_normalization/ja/data/ordinals/ties.tsv new file mode 100644 index 0000000..3c5bf09 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/ordinals/ties.tsv @@ -0,0 +1,9 @@ +第二十 2 +第三十 3 +第四十 4 +第五十 5 +第六十 6 +第七十 7 +第八十 8 +第九十 9 +第百 10 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/ja/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ja/data/time/minute_to.tsv b/fun_text_processing/inverse_text_normalization/ja/data/time/minute_to.tsv new file mode 100644 index 0000000..edab4d5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/time/minute_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 diff --git a/fun_text_processing/inverse_text_normalization/ja/data/time/time_suffix.tsv b/fun_text_processing/inverse_text_normalization/ja/data/time/time_suffix.tsv new file mode 100644 index 0000000..b39a9ef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/time/time_suffix.tsv @@ -0,0 +1,8 @@ +p m p.m. +pm p.m. +p.m. +p.m p.m. +am a.m. +a.m. +a.m a.m. +a m a.m. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/time/time_zone.tsv b/fun_text_processing/inverse_text_normalization/ja/data/time/time_zone.tsv new file mode 100644 index 0000000..3e0ade4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t diff --git a/fun_text_processing/inverse_text_normalization/ja/data/time/to_hour.tsv b/fun_text_processing/inverse_text_normalization/ja/data/time/to_hour.tsv new file mode 100644 index 0000000..5adb48d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/time/to_hour.tsv @@ -0,0 +1,12 @@ +一 12 +二 1 +三 2 +四 3 +五 4 +六 5 +七 6 +八 7 +九 8 +十 9 +十一 10 +十二 11 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/ja/data/whitelist.tsv new file mode 100644 index 0000000..0931c95 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/data/whitelist.tsv @@ -0,0 +1,4322 @@ +e.g. 例えば +dr. 博士 +mr. 紳士 +mrs. 逃す +st. saint +7-eleven セブンイレブン +es3 e s 三 +s&p s and p +ASAP a s a p +AT&T a t and t +LLP l l p +b to b B2B +b to c B2C +c to c C2C +c to b C2B +億 億 +兆 兆 +ps三 ps3 +ps四 ps4 +ATM エーティーエム +十数か二十 十数か二十 +幸四郎 幸四郎 +白雪姫と七人のこびと 白雪姫と七人のこびと +AKB48 AKB48 +七夕 七夕 +千夜一夜 千夜一夜 +三百六十行 三百六十行 +十五の月 十五の月 +冷凍三足 冷凍三足 +三十年河東 三十年河東 +三十年河西 三十年河西 +千年後 千年後 +五月天 五月天 +安倍晋三 安倍晋三 +小泉純一郎 小泉純一郎 +山本五十六 山本五十六 +裕一 裕一 +優一 優一 +太一 太一 +雄一 雄一 +泰一 泰一 +金田一 金田一 +三宅健 三宅健 +国分太一 国分太一 +東郷平八郎 東郷平八郎 +石田三成 石田三成 +山内一豊 山内一豊 +渋沢栄一 渋沢栄一 +土方歳井 土方歳井 +二宮金次郎 二宮金次郎 +小津安二郎 小津安二郎 +本田宗一郎 本田宗一郎 +佐藤一郎 佐藤一郎 +一郎 一郎 +二郎 二郎 +三郎 三郎 +四郎 四郎 +五郎 五郎 +六郎 六郎 +七郎 七郎 +一の上 一の上 +一の倉 一の倉 +一の口 一の口 +一の坪 一の坪 +一の宮 一の宮 +一の渡 一の渡 +一の瀬 一の瀬 +一の谷 一の谷 +一の関 一の関 +一ツ井 一ツ井 +一ツ子 一ツ子 +一ツ家 一ツ家 +一ツ屋 一ツ屋 +一ツ山 一ツ山 +一ツ木 一ツ木 +一ツ本松 一ツ本松 +一ツ松 一ツ松 +一ツ柳 一ツ柳 +一ツ森 一ツ森 +一ツ橋 一ツ橋 +一ツ氏 一ツ氏 +一ツ渡 一ツ渡 +一ツ田 一ツ田 +一ツ町 一ツ町 +一ツ矢 一ツ矢 +一ツ石 一ツ石 +一ツ谷 一ツ谷 +一ノ世 一ノ世 +一ノ井 一ノ井 +一ノ倉 一ノ倉 +一ノ勢 一ノ勢 +一ノ原 一ノ原 +一ノ口 一ノ口 +一ノ名 一ノ名 +一ノ坪 一ノ坪 +一ノ子 一ノ子 +一ノ字 一ノ字 +一ノ宮 一ノ宮 +一ノ尾 一ノ尾 +一ノ山 一ノ山 +一ノ川 一ノ川 +一ノ戸 一ノ戸 +一ノ木 一ノ木 +一ノ木戸 一ノ木戸 +一ノ本 一ノ本 +一ノ枝 一ノ枝 +一ノ橋 一ノ橋 +一ノ沢 一ノ沢 +一ノ清 一ノ清 +一ノ渡 一ノ渡 +一ノ澤 一ノ澤 +一ノ瀬 一ノ瀬 +一ノ田 一ノ田 +一ノ矢 一ノ矢 +一ノ穂 一ノ穂 +一ノ谷 一ノ谷 +一ノ間 一ノ間 +一ノ関 一ノ関 +一丁田 一丁田 +一丁畑 一丁畑 +一万田 一万田 +一上 一上 +一下 一下 +一与 一与 +一世 一世 +一丸 一丸 +一乃瀬 一乃瀬 +一久 一久 +一久保 一久保 +一之上 一之上 +一之宮 一之宮 +一之木 一之木 +一之森 一之森 +一之沢 一之沢 +一之澤 一之澤 +一之瀬 一之瀬 +一之谷 一之谷 +一乗 一乗 +一乘 一乘 +一事 一事 +一井 一井 +一仏 一仏 +一伊達 一伊達 +一住連 一住連 +一佛 一佛 +一作 一作 +一倉 一倉 +一元 一元 +一光 一光 +一児島 一児島 +一兜 一兜 +一入 一入 +一内 一内 +一円 一円 +一冨 一冨 +一刀 一刀 +一分片 一分片 +一刈 一刈 +一刎 一刎 +一前 一前 +一力 一力 +一勢 一勢 +一北 一北 +一十林 一十林 +一原 一原 +一又 一又 +一双 一双 +一反田 一反田 +一口 一口 +一司 一司 +一吉 一吉 +一后 一后 +一向 一向 +一味 一味 +一和 一和 +一和多 一和多 +一和田 一和田 +一噌 一噌 +一圓 一圓 +一地 一地 +一坂 一坂 +一坊 一坊 +一坊寺 一坊寺 +一坪 一坪 +一垣 一垣 +一城 一城 +一堂 一堂 +一場 一場 +一塚 一塚 +一塲 一塲 +一増 一増 +一天満谷 一天満谷 +一好 一好 +一宅 一宅 +一宇 一宇 +一守 一守 +一安 一安 +一定 一定 +一宝 一宝 +一宮 一宮 +一家 一家 +一富 一富 +一富士 一富士 +一寳 一寳 +一寶 一寶 +一寸木 一寸木 +一寺 一寺 +一尺八寸 一尺八寸 +一尾 一尾 +一居 一居 +一山 一山 +一岐 一岐 +一岡 一岡 +一岩 一岩 +一峯寺 一峯寺 +一峰 一峰 +一峰寺 一峰寺 +一島 一島 +一崎 一崎 +一嶋 一嶋 +一嶌 一嶌 +一川 一川 +一布 一布 +一幡 一幡 +一平 一平 +一広 一広 +一庵 一庵 +一廣 一廣 +一廼穂 一廼穂 +一式 一式 +一弛 一弛 +一徳 一徳 +一心 一心 +一志 一志 +一恩 一恩 +一戸 一戸 +一振 一振 +一政 一政 +一文字 一文字 +一斗 一斗 +一新 一新 +一方井 一方井 +一方隅 一方隅 +一明 一明 +一星 一星 +一最 一最 +一期 一期 +一期崎 一期崎 +一木 一木 +一木戸 一木戸 +一本 一本 +一本島 一本島 +一本嶋 一本嶋 +一本木 一本木 +一本杉 一本杉 +一本松 一本松 +一本柳 一本柳 +一本槍 一本槍 +一本鎗 一本鎗 +一杉 一杉 +一村 一村 +一条 一条 +一来 一来 +一松 一松 +一林 一林 +一枚田 一枚田 +一枝 一枝 +一柳 一柳 +一柿 一柿 +一栄 一栄 +一桐 一桐 +一桝 一桝 +一條 一條 +一棟 一棟 +一森 一森 +一植庵 一植庵 +一楽 一楽 +一樂 一樂 +一樋 一樋 +一樹 一樹 +一橋 一橋 +一氏 一氏 +一水 一水 +一永 一永 +一沢 一沢 +一河 一河 +一泉 一泉 +一津屋 一津屋 +一津田 一津田 +一津矢 一津矢 +一津谷 一津谷 +一浦 一浦 +一海 一海 +一渡 一渡 +一湊 一湊 +一溝 一溝 +一滴 一滴 +一澤 一澤 +一瀬 一瀬 +一玖 一玖 +一瓢 一瓢 +一田 一田 +一田山 一田山 +一由 一由 +一甲 一甲 +一町 一町 +一町田 一町田 +一畝 一畝 +一番ケ瀬 一番ケ瀬 +一番合戦 一番合戦 +一番屋 一番屋 +一番星 一番星 +一登 一登 +一百野 一百野 +一盃森 一盃森 +一盛 一盛 +一真 一真 +一矢 一矢 +一石 一石 +一社 一社 +一神 一神 +一笠 一笠 +一筆 一筆 +一箭 一箭 +一篠 一篠 +一籏 一籏 +一糸 一糸 +一美 一美 +一羽 一羽 +一老 一老 +一肩 一肩 +一脇 一脇 +一與 一與 +一興 一興 +一舎 一舎 +一色 一色 +一色田 一色田 +一芝 一芝 +一華 一華 +一萬田 一萬田 +一葉 一葉 +一薮 一薮 +一藁 一藁 +一藤 一藤 +一藤木 一藤木 +一蝶 一蝶 +一見 一見 +一視 一視 +一角 一角 +一言 一言 +一谷 一谷 +一貫坂 一貫坂 +一貫田 一貫田 +一越 一越 +一路 一路 +一身 一身 +一軸 一軸 +一迫 一迫 +一道 一道 +一適 一適 +一邨 一邨 +一郎丸 一郎丸 +一郡 一郡 +一部 一部 +一郷 一郷 +一都 一都 +一里塚 一里塚 +一里山 一里山 +一里越 一里越 +一重 一重 +一野 一野 +一野坪 一野坪 +一野本 一野本 +一野瀬 一野瀬 +一野谷 一野谷 +一野辺 一野辺 +一野邊 一野邊 +一針 一針 +一釣 一釣 +一鉄 一鉄 +一鍬田 一鍬田 +一鏡 一鏡 +一鐵 一鐵 +一門 一門 +一間 一間 +一関 一関 +一關 一關 +一阪 一阪 +一阿 一阿 +一陣 一陣 +一階 一階 +一霍 一霍 +一青 一青 +一面 一面 +一願 一願 +一香 一香 +一馬 一馬 +一駒 一駒 +一高 一高 +一鬼 一鬼 +一鷓 一鷓 +一鷹 一鷹 +七々原 七々原 +七々木 七々木 +七々瀬 七々瀬 +七ケ所 七ケ所 +七ツ役 七ツ役 +七ツ村 七ツ村 +七ツ河 七ツ河 +七ツ田 七ツ田 +七ツ町 七ツ町 +七ツ矢 七ツ矢 +七ツ谷 七ツ谷 +七丈 七丈 +七世 七世 +七久保 七久保 +七五三 七五三 +七五三掛 七五三掛 +七五三木 七五三木 +七五三田 七五三田 +七五三野 七五三野 +七井 七井 +七俵 七俵 +七倉 七倉 +七元 七元 +七分 七分 +七利 七利 +七加家 七加家 +七十刈 七十刈 +七十苅 七十苅 +七原 七原 +七反田 七反田 +七呂 七呂 +七味 七味 +七坂 七坂 +七堂 七堂 +七塚 七塚 +七夕 七夕 +七字 七字 +七宝 七宝 +七宮 七宮 +七家 七家 +七寳 七寳 +七尾 七尾 +七尾谷 七尾谷 +七山 七山 +七山谷 七山谷 +七岡 七岡 +七島 七島 +七崎 七崎 +七嵐 七嵐 +七嶋 七嶋 +七川 七川 +七帖 七帖 +七度 七度 +七座 七座 +七役 七役 +七徳 七徳 +七戸 七戸 +七搦 七搦 +七日市 七日市 +七星 七星 +七木田 七木田 +七本 七本 +七村 七村 +七条 七条 +七松 七松 +七林 七林 +七枝 七枝 +七栗 七栗 +七條 七條 +七森 七森 +七楽 七楽 +七歩 七歩 +七沢 七沢 +七河 七河 +七波 七波 +七津角 七津角 +七浦 七浦 +七海 七海 +七滝 七滝 +七澤 七澤 +七瀧 七瀧 +七瀬 七瀬 +七瀬川 七瀬川 +七瀬谷 七瀬谷 +七熊 七熊 +七牟礼 七牟礼 +七牟禮 七牟禮 +七理 七理 +七田 七田 +七町 七町 +七目木 七目木 +七石 七石 +七社 七社 +七種 七種 +七竹 七竹 +七篠 七篠 +七納 七納 +七絛 七絛 +七良川 七良川 +七良浴 七良浴 +七草 七草 +七草木 七草木 +七蔵司 七蔵司 +七藏司 七藏司 +七見 七見 +七角 七角 +七谷 七谷 +七軒 七軒 +七辺 七辺 +七迫 七迫 +七邊 七邊 +七郎丸 七郎丸 +七部 七部 +七里 七里 +七野 七野 +七釜 七釜 +七釜子 七釜子 +七門 七門 +七間 七間 +七障子 七障子 +七類 七類 +七高 七高 +七黒 七黒 +万 万 +万々 万々 +万ケ谷 万ケ谷 +万ノ 万ノ +万丈 万丈 +万上 万上 +万世 万世 +万両 万両 +万並 万並 +万中 万中 +万丸 万丸 +万久 万久 +万久里 万久里 +万亀 万亀 +万亀山 万亀山 +万事 万事 +万井 万井 +万代 万代 +万代呂 万代呂 +万代寺 万代寺 +万仲 万仲 +万佐木 万佐木 +万保 万保 +万俵 万俵 +万倉 万倉 +万元 万元 +万光 万光 +万公 万公 +万処 万処 +万出 万出 +万利乃 万利乃 +万前 万前 +万力 万力 +万力屋 万力屋 +万力谷 万力谷 +万十 万十 +万千野 万千野 +万司 万司 +万合 万合 +万名 万名 +万善 万善 +万喜 万喜 +万国 万国 +万国谷 万国谷 +万地 万地 +万城 万城 +万城目 万城目 +万埜 万埜 +万場 万場 +万塩 万塩 +万壽本 万壽本 +万好 万好 +万子 万子 +万字 万字 +万宝 万宝 +万実 万実 +万宮 万宮 +万家 万家 +万實 万實 +万寿 万寿 +万寿本 万寿本 +万尾 万尾 +万屋 万屋 +万山 万山 +万岡 万岡 +万崎 万崎 +万川 万川 +万平 万平 +万年 万年 +万年山 万年山 +万幸 万幸 +万広 万広 +万度 万度 +万庭 万庭 +万廣 万廣 +万徳 万徳 +万慶 万慶 +万戈 万戈 +万成 万成 +万我 万我 +万戸 万戸 +万所 万所 +万才 万才 +万方 万方 +万月 万月 +万木 万木 +万本 万本 +万束 万束 +万条 万条 +万来 万来 +万條 万條 +万森 万森 +万楽 万楽 +万正 万正 +万歩 万歩 +万歳 万歳 +万殿 万殿 +万水 万水 +万永 万永 +万江 万江 +万沢 万沢 +万治 万治 +万波 万波 +万津 万津 +万洲 万洲 +万浪 万浪 +万浮 万浮 +万澤 万澤 +万濃 万濃 +万瀬 万瀬 +万灯 万灯 +万燈 万燈 +万狩 万狩 +万玉 万玉 +万田 万田 +万直 万直 +万矢 万矢 +万石 万石 +万砂 万砂 +万福 万福 +万福寺 万福寺 +万立 万立 +万竝 万竝 +万納 万納 +万納寺 万納寺 +万羽 万羽 +万膳 万膳 +万葉 万葉 +万藤 万藤 +万行 万行 +万袋 万袋 +万見 万見 +万谷 万谷 +万豆 万豆 +万財 万財 +万賀 万賀 +万越 万越 +万足 万足 +万辺 万辺 +万辻 万辻 +万造寺 万造寺 +万道 万道 +万邉 万邉 +万邊 万邊 +万部 万部 +万里 万里 +万里小路 万里小路 +万里崎 万里崎 +万里川 万里川 +万重 万重 +万野 万野 +万金 万金 +万開 万開 +万関 万関 +万阿弥 万阿弥 +万雲 万雲 +万願寺 万願寺 +万𡌛 万𡌛 +丈六 丈六 +三々賀 三々賀 +三つ石 三つ石 +三の丸 三の丸 +三の宮 三の宮 +三の輪 三の輪 +三カ崎 三カ崎 +三ケ 三ケ +三ケ原 三ケ原 +三ケ尻 三ケ尻 +三ケ山 三ケ山 +三ケ島 三ケ島 +三ケ崎 三ケ崎 +三ケ嶋 三ケ嶋 +三ケ月 三ケ月 +三ケ木 三ケ木 +三ケ本 三ケ本 +三ケ森 三ケ森 +三ケ津 三ケ津 +三ケ田 三ケ田 +三ケ部 三ケ部 +三ケ野 三ケ野 +三ケ野原 三ケ野原 +三ツ 三ツ +三ツ中 三ツ中 +三ツ丸 三ツ丸 +三ツ井 三ツ井 +三ツ俣 三ツ俣 +三ツ倉 三ツ倉 +三ツ元 三ツ元 +三ツ出 三ツ出 +三ツ又 三ツ又 +三ツ口 三ツ口 +三ツ国 三ツ国 +三ツ國 三ツ國 +三ツ堀 三ツ堀 +三ツ塚 三ツ塚 +三ツ家 三ツ家 +三ツ寄 三ツ寄 +三ツ寺 三ツ寺 +三ツ尾 三ツ尾 +三ツ居 三ツ居 +三ツ屋 三ツ屋 +三ツ山 三ツ山 +三ツ岡 三ツ岡 +三ツ岩 三ツ岩 +三ツ峰 三ツ峰 +三ツ島 三ツ島 +三ツ崎 三ツ崎 +三ツ嶋 三ツ嶋 +三ツ川 三ツ川 +三ツ巻 三ツ巻 +三ツ平 三ツ平 +三ツ広 三ツ広 +三ツ廣 三ツ廣 +三ツ扇 三ツ扇 +三ツ持 三ツ持 +三ツ星 三ツ星 +三ツ木 三ツ木 +三ツ本 三ツ本 +三ツ杉 三ツ杉 +三ツ村 三ツ村 +三ツ松 三ツ松 +三ツ林 三ツ林 +三ツ柳 三ツ柳 +三ツ梨 三ツ梨 +三ツ森 三ツ森 +三ツ橋 三ツ橋 +三ツ汐 三ツ汐 +三ツ江 三ツ江 +三ツ池 三ツ池 +三ツ沢 三ツ沢 +三ツ沼 三ツ沼 +三ツ泉 三ツ泉 +三ツ浜 三ツ浜 +三ツ浦 三ツ浦 +三ツ浪 三ツ浪 +三ツ溝 三ツ溝 +三ツ滝 三ツ滝 +三ツ澤 三ツ澤 +三ツ濱 三ツ濱 +三ツ瀬 三ツ瀬 +三ツ田 三ツ田 +三ツ畑 三ツ畑 +三ツ目 三ツ目 +三ツ矢 三ツ矢 +三ツ石 三ツ石 +三ツ股 三ツ股 +三ツ角 三ツ角 +三ツ谷 三ツ谷 +三ツ辻 三ツ辻 +三ツ邑 三ツ邑 +三ツ野 三ツ野 +三ツ間 三ツ間 +三ノ上 三ノ上 +三ノ丸 三ノ丸 +三ノ京 三ノ京 +三ノ宮 三ノ宮 +三ノ戸 三ノ戸 +三ノ浦 三ノ浦 +三ノ輪 三ノ輪 +三ヵ木 三ヵ木 +三丁 三丁 +三丁目 三丁目 +三七 三七 +三丈 三丈 +三上 三上 +三上山 三上山 +三下 三下 +三与木 三与木 +三世 三世 +三世川 三世川 +三並 三並 +三中 三中 +三中西 三中西 +三串 三串 +三丸 三丸 +三乃 三乃 +三久 三久 +三久保 三久保 +三之丸 三之丸 +三之宮 三之宮 +三之本 三之本 +三之瀬 三之瀬 +三之輪 三之輪 +三乗 三乗 +三乘 三乘 +三九 三九 +三九二 三九二 +三亀 三亀 +三亀山 三亀山 +三二 三二 +三五 三五 +三井 三井 +三井倉 三井倉 +三井原 三井原 +三井名 三井名 +三井寺 三井寺 +三井島 三井島 +三井戸 三井戸 +三井所 三井所 +三井津 三井津 +三井田 三井田 +三京 三京 +三仏 三仏 +三仙 三仙 +三代 三代 +三代地 三代地 +三代崎 三代崎 +三代川 三代川 +三代木 三代木 +三代森 三代森 +三代沢 三代沢 +三代澤 三代澤 +三代瀬 三代瀬 +三代田 三代田 +三代野 三代野 +三仲 三仲 +三伍 三伍 +三伝 三伝 +三位 三位 +三位所 三位所 +三住 三住 +三佐 三佐 +三佐々川 三佐々川 +三佐保 三佐保 +三佐和 三佐和 +三佐尾 三佐尾 +三佐崎 三佐崎 +三佐川 三佐川 +三佐藤 三佐藤 +三余 三余 +三佛 三佛 +三保 三保 +三保家 三保家 +三保木 三保木 +三保田 三保田 +三保谷 三保谷 +三保野 三保野 +三信 三信 +三俣 三俣 +三俵 三俵 +三倉 三倉 +三個 三個 +三傅 三傅 +三傳 三傳 +三僮 三僮 +三元 三元 +三先 三先 +三光 三光 +三光坊 三光坊 +三光寺 三光寺 +三光楼 三光楼 +三光院 三光院 +三入 三入 +三八九 三八九 +三八木 三八木 +三八木沢 三八木沢 +三八木澤 三八木澤 +三共 三共 +三其 三其 +三具 三具 +三内 三内 +三冨 三冨 +三冨士 三冨士 +三凌 三凌 +三刀 三刀 +三刀屋 三刀屋 +三刀谷 三刀谷 +三分 三分 +三分一 三分一 +三分一所 三分一所 +三分利 三分利 +三前 三前 +三力谷 三力谷 +三功 三功 +三加 三加 +三加茂 三加茂 +三勢 三勢 +三包 三包 +三北 三北 +三十刈 三十刈 +三十尾 三十尾 +三十日 三十日 +三十木 三十木 +三十苅 三十苅 +三十間 三十間 +三千 三千 +三千山 三千山 +三千田 三千田 +三升 三升 +三升木 三升木 +三升畑 三升畑 +三升谷 三升谷 +三原 三原 +三原屋 三原屋 +三原松 三原松 +三原田 三原田 +三原詰 三原詰 +三原鍛治 三原鍛治 +三厨 三厨 +三又 三又 +三友 三友 +三双 三双 +三反 三反 +三反園 三反園 +三反崎 三反崎 +三反田 三反田 +三反畑 三反畑 +三反長 三反長 +三叚崎 三叚崎 +三口 三口 +三古 三古 +三古谷 三古谷 +三可 三可 +三合 三合 +三合堂 三合堂 +三吉 三吉 +三吉矢 三吉矢 +三吉谷 三吉谷 +三吉野 三吉野 +三名木 三名木 +三名本 三名本 +三名田 三名田 +三吾 三吾 +三味 三味 +三和 三和 +三和山 三和山 +三和田 三和田 +三品 三品 +三品寺 三品寺 +三善 三善 +三喜 三喜 +三喜田 三喜田 +三喜畑 三喜畑 +三嘴 三嘴 +三四 三四 +三国 三国 +三国出 三国出 +三国屋 三国屋 +三国谷 三国谷 +三國 三國 +三國屋 三國屋 +三國谷 三國谷 +三園 三園 +三土 三土 +三土井 三土井 +三土手 三土手 +三在 三在 +三地 三地 +三地沢 三地沢 +三地澤 三地澤 +三坂 三坂 +三坊 三坊 +三坪 三坪 +三垣 三垣 +三城 三城 +三埜 三埜 +三堀 三堀 +三堂 三堂 +三堂地 三堂地 +三堤 三堤 +三場 三場 +三塚 三塚 +三塩 三塩 +三増 三増 +三墨 三墨 +三壁 三壁 +三声 三声 +三壷 三壷 +三壺 三壺 +三壽 三壽 +三多 三多 +三多村 三多村 +三多田 三多田 +三多見 三多見 +三夜 三夜 +三大 三大 +三大寺 三大寺 +三太 三太 +三奈戸 三奈戸 +三奈木 三奈木 +三好 三好 +三好野 三好野 +三妙 三妙 +三妻 三妻 +三姓 三姓 +三宅 三宅 +三宅川 三宅川 +三宇根 三宇根 +三守 三守 +三安 三安 +三宗 三宗 +三宝 三宝 +三室 三室 +三室戸 三室戸 +三宮 三宮 +三家 三家 +三家丸 三家丸 +三家本 三家本 +三宿 三宿 +三寄 三寄 +三富 三富 +三富士 三富士 +三寳 三寳 +三寶 三寶 +三寸木 三寸木 +三寺 三寺 +三寿 三寿 +三尋木 三尋木 +三小 三小 +三小牛 三小牛 +三小田 三小田 +三尾 三尾 +三尾原 三尾原 +三尾川 三尾川 +三尾母 三尾母 +三尾谷 三尾谷 +三尾野 三尾野 +三居 三居 +三屋 三屋 +三屋田 三屋田 +三山 三山 +三山口 三山口 +三岐 三岐 +三岡 三岡 +三岩 三岩 +三岳 三岳 +三岸 三岸 +三峯 三峯 +三峰 三峰 +三島 三島 +三島木 三島木 +三崎 三崎 +三崎屋 三崎屋 +三嵜 三嵜 +三嶋 三嶋 +三嶋木 三嶋木 +三嶌 三嶌 +三嶽 三嶽 +三川 三川 +三川原 三川原 +三州 三州 +三差 三差 +三巴 三巴 +三巻 三巻 +三市 三市 +三師 三師 +三帰 三帰 +三幡 三幡 +三幣 三幣 +三平 三平 +三年 三年 +三幸 三幸 +三広 三広 +三府 三府 +三度 三度 +三廉 三廉 +三廚 三廚 +三廻部 三廻部 +三廼 三廼 +三弊 三弊 +三引 三引 +三弦谷 三弦谷 +三張 三張 +三影 三影 +三待 三待 +三後 三後 +三徳 三徳 +三徳屋 三徳屋 +三志多 三志多 +三志奈 三志奈 +三恵 三恵 +三惠 三惠 +三慶 三慶 +三成 三成 +三戸 三戸 +三戸代 三戸代 +三戸口 三戸口 +三戸呂 三戸呂 +三戸尻 三戸尻 +三戸岡 三戸岡 +三戸手 三戸手 +三戸森 三戸森 +三戸瀬 三戸瀬 +三戸田 三戸田 +三戸見 三戸見 +三戸谷 三戸谷 +三戸辺 三戸辺 +三戸邉 三戸邉 +三戸部 三戸部 +三房 三房 +三手木 三手木 +三才 三才 +三才町 三才町 +三扶 三扶 +三技 三技 +三折 三折 +三掘 三掘 +三摩 三摩 +三改木 三改木 +三政 三政 +三文字 三文字 +三方 三方 +三日尻 三日尻 +三日市 三日市 +三日月 三日月 +三日田 三日田 +三昌 三昌 +三明 三明 +三星 三星 +三春 三春 +三時 三時 +三曳 三曳 +三曵 三曵 +三曽田 三曽田 +三曾野 三曾野 +三月 三月 +三月田 三月田 +三朕 三朕 +三朝 三朝 +三木 三木 +三木元 三木元 +三木原 三木原 +三木家 三木家 +三木屋 三木屋 +三木本 三木本 +三木江 三木江 +三木田 三木田 +三木谷 三木谷 +三木野 三木野 +三末 三末 +三本 三本 +三本木 三本木 +三本杉 三本杉 +三本松 三本松 +三本柳 三本柳 +三本漆 三本漆 +三本竹 三本竹 +三本管 三本管 +三本菅 三本菅 +三杉 三杉 +三村 三村 +三村田 三村田 +三束 三束 +三条 三条 +三条場 三条場 +三条橋 三条橋 +三条目 三条目 +三条西 三条西 +三条谷 三条谷 +三杭 三杭 +三杯 三杯 +三東 三東 +三松 三松 +三林 三林 +三枚地 三枚地 +三枚堂 三枚堂 +三枚山 三枚山 +三枚橋 三枚橋 +三枝 三枝 +三枝崎 三枝崎 +三枝木 三枝木 +三枝松 三枝松 +三枝樹 三枝樹 +三枡 三枡 +三柏 三柏 +三染 三染 +三柳 三柳 +三柴 三柴 +三栄 三栄 +三栖 三栖 +三栖本 三栖本 +三栖谷 三栖谷 +三栗 三栗 +三栗家 三栗家 +三栗屋 三栗屋 +三栗谷 三栗谷 +三栗野 三栗野 +三根 三根 +三根山 三根山 +三根生 三根生 +三根谷 三根谷 +三桐 三桐 +三桝 三桝 +三桶 三桶 +三條 三條 +三條場 三條場 +三條目 三條目 +三條西 三條西 +三條谷 三條谷 +三梨 三梨 +三棟 三棟 +三森 三森 +三棹 三棹 +三椚 三椚 +三楊 三楊 +三楠 三楠 +三榊 三榊 +三槁 三槁 +三槇 三槇 +三槙 三槙 +三槻 三槻 +三横 三横 +三横呂 三横呂 +三樹 三樹 +三樹元 三樹元 +三橋 三橋 +三次 三次 +三武 三武 +三武士 三武士 +三歩 三歩 +三歩一 三歩一 +三段 三段 +三段崎 三段崎 +三母 三母 +三比 三比 +三毛 三毛 +三毛門 三毛門 +三水 三水 +三永 三永 +三永川 三永川 +三江 三江 +三池 三池 +三池田 三池田 +三沖 三沖 +三沢 三沢 +三河 三河 +三河井 三河井 +三河内 三河内 +三河原 三河原 +三河口 三河口 +三河尻 三河尻 +三河島 三河島 +三河嶋 三河嶋 +三河谷 三河谷 +三治 三治 +三沼 三沼 +三波 三波 +三洗 三洗 +三津 三津 +三津中 三津中 +三津井 三津井 +三津出 三津出 +三津原 三津原 +三津国 三津国 +三津國 三津國 +三津守 三津守 +三津家 三津家 +三津尾 三津尾 +三津屋 三津屋 +三津山 三津山 +三津島 三津島 +三津川 三津川 +三津木 三津木 +三津本 三津本 +三津村 三津村 +三津林 三津林 +三津橋 三津橋 +三津永 三津永 +三津江 三津江 +三津沢 三津沢 +三津浜 三津浜 +三津澤 三津澤 +三津田 三津田 +三津目 三津目 +三津矢 三津矢 +三津石 三津石 +三津谷 三津谷 +三津越 三津越 +三津輪 三津輪 +三津野 三津野 +三津間 三津間 +三洲 三洲 +三浅 三浅 +三浜 三浜 +三浦 三浦 +三浪 三浪 +三海 三海 +三淵 三淵 +三添 三添 +三清 三清 +三渓 三渓 +三渕 三渕 +三渡 三渡 +三渡洲 三渡洲 +三満 三満 +三満田 三満田 +三溝 三溝 +三滝 三滝 +三潟 三潟 +三潴 三潴 +三澄 三澄 +三澤 三澤 +三濃川 三濃川 +三濱 三濱 +三瀦 三瀦 +三瀧 三瀧 +三瀬 三瀬 +三瀬下 三瀬下 +三瀬町 三瀬町 +三熊 三熊 +三牧 三牧 +三狭間 三狭間 +三獄 三獄 +三玉 三玉 +三王 三王 +三王寺 三王寺 +三珠 三珠 +三瓶 三瓶 +三甘 三甘 +三生 三生 +三用 三用 +三甫 三甫 +三田 三田 +三田上 三田上 +三田井 三田井 +三田地 三田地 +三田寺 三田寺 +三田尻 三田尻 +三田尾 三田尾 +三田村 三田村 +三田池 三田池 +三田美 三田美 +三田谷 三田谷 +三田迫 三田迫 +三田部 三田部 +三田野 三田野 +三由 三由 +三甲野 三甲野 +三町 三町 +三界 三界 +三畑 三畑 +三留 三留 +三畝 三畝 +三畠 三畠 +三畦 三畦 +三番 三番 +三登 三登 +三百 三百 +三百田 三百田 +三百苅 三百苅 +三皷 三皷 +三盃 三盃 +三盛 三盛 +三目 三目 +三省 三省 +三県 三県 +三矢 三矢 +三矢城 三矢城 +三矢島 三矢島 +三矢本 三矢本 +三矢田 三矢田 +三知矢 三知矢 +三石 三石 +三砂 三砂 +三社所 三社所 +三神 三神 +三神山 三神山 +三福 三福 +三福寺 三福寺 +三秋 三秋 +三科 三科 +三程 三程 +三種 三種 +三穂 三穂 +三穂野 三穂野 +三穗野 三穗野 +三窪 三窪 +三立 三立 +三竜 三竜 +三竝 三竝 +三竹 三竹 +三竿 三竿 +三笘 三笘 +三笠 三笠 +三笠屋 三笠屋 +三笠木 三笠木 +三笹 三笹 +三箇 三箇 +三箇尻 三箇尻 +三箇山 三箇山 +三箇島 三箇島 +三箭 三箭 +三箸 三箸 +三節草 三節草 +三築 三築 +三簾 三簾 +三籔 三籔 +三糸 三糸 +三納 三納 +三紙 三紙 +三続 三続 +三綿 三綿 +三緒 三緒 +三縁 三縁 +三縄 三縄 +三縞 三縞 +三縣 三縣 +三繩 三繩 +三美 三美 +三義 三義 +三羽 三羽 +三者 三者 +三聲 三聲 +三股 三股 +三脇 三脇 +三腰 三腰 +三膳 三膳 +三與木 三與木 +三舘 三舘 +三舛 三舛 +三舛木 三舛木 +三舛畑 三舛畑 +三舛谷 三舛谷 +三舟 三舟 +三舩 三舩 +三船 三船 +三良 三良 +三良丸 三良丸 +三艸 三艸 +三芝 三芝 +三芦 三芦 +三芳 三芳 +三芳野 三芳野 +三苫 三苫 +三草 三草 +三荊 三荊 +三荒 三荒 +三荷 三荷 +三荻 三荻 +三菅 三菅 +三華 三華 +三葉 三葉 +三葛 三葛 +三葛木 三葛木 +三蓼 三蓼 +三蔭 三蔭 +三蔵 三蔵 +三薗 三薗 +三薮 三薮 +三藤 三藤 +三藤田 三藤田 +三藪 三藪 +三行 三行 +三行地 三行地 +三裏 三裏 +三見 三見 +三角 三角 +三角園 三角園 +三角田 三角田 +三觜 三觜 +三計 三計 +三記 三記 +三訳 三訳 +三調 三調 +三諾 三諾 +三譯 三譯 +三谷 三谷 +三谷原 三谷原 +三谷山 三谷山 +三谷川 三谷川 +三谷本 三谷本 +三谷沢 三谷沢 +三谷澤 三谷澤 +三谷野 三谷野 +三谿 三谿 +三豬 三豬 +三貝 三貝 +三貫納 三貫納 +三貴 三貴 +三賀 三賀 +三賀山 三賀山 +三賀本 三賀本 +三賀森 三賀森 +三賢 三賢 +三越 三越 +三足 三足 +三路 三路 +三身 三身 +三軒 三軒 +三軒家 三軒家 +三軒屋 三軒屋 +三軒谷 三軒谷 +三輪 三輪 +三輪出 三輪出 +三輪屋 三輪屋 +三輪山 三輪山 +三輪木 三輪木 +三輪橋 三輪橋 +三輪浦 三輪浦 +三輪田 三輪田 +三輪谷 三輪谷 +三輪野 三輪野 +三輸 三輸 +三辺 三辺 +三辻 三辻 +三近 三近 +三迫 三迫 +三迺 三迺 +三通 三通 +三通田 三通田 +三逵 三逵 +三道 三道 +三達 三達 +三達屋 三達屋 +三邉 三邉 +三邊 三邊 +三邑 三邑 +三那三 三那三 +三那川 三那川 +三邨 三邨 +三郎丸 三郎丸 +三郎迫 三郎迫 +三部 三部 +三郷 三郷 +三都 三都 +三都主 三都主 +三都井 三都井 +三里 三里 +三重 三重 +三重堀 三重堀 +三重松 三重松 +三重生 三重生 +三重野 三重野 +三野 三野 +三野原 三野原 +三野宮 三野宮 +三野岡 三野岡 +三野島 三野島 +三野本 三野本 +三野村 三野村 +三野瀬 三野瀬 +三野田 三野田 +三野谷 三野谷 +三野輪 三野輪 +三金 三金 +三釜田 三釜田 +三鈷 三鈷 +三録 三録 +三鍋 三鍋 +三鍵 三鍵 +三鎌 三鎌 +三鐘 三鐘 +三鑰 三鑰 +三長 三長 +三門 三門 +三門明 三門明 +三間 三間 +三間地 三間地 +三間屋 三間屋 +三間瀬 三間瀬 +三間谷 三間谷 +三関 三関 +三阪 三阪 +三附 三附 +三隅 三隅 +三隅田 三隅田 +三隈 三隈 +三階 三階 +三階松 三階松 +三随 三随 +三隨 三隨 +三雲 三雲 +三露 三露 +三須 三須 +三須田 三須田 +三須磨 三須磨 +三頭 三頭 +三頭谷 三頭谷 +三餘 三餘 +三館 三館 +三馬 三馬 +三駄 三駄 +三駒 三駒 +三高 三高 +三鬼 三鬼 +三鳥川 三鳥川 +三鴨 三鴨 +三鶴 三鶴 +三鹿 三鹿 +三鹿野 三鹿野 +三黒 三黒 +三黒江 三黒江 +三鼓 三鼓 +三龍 三龍 +三𢌞部 三𢌞部 +三𧮾 三𧮾 +上一 上一 +上万 上万 +上三 上三 +上三信 上三信 +上三地 上三地 +上三垣 上三垣 +上三路 上三路 +上八重 上八重 +上四元 上四元 +下一ノ宮 下一ノ宮 +下万 下万 +下二井 下二井 +下八 下八 +下八尻 下八尻 +下八川 下八川 +下八重 下八重 +下四日市 下四日市 +下志万 下志万 +下松八重 下松八重 +不二 不二 +不二井 不二井 +不二原 不二原 +不二山 不二山 +不二崎 不二崎 +不二川 不二川 +不二木 不二木 +不二樹 不二樹 +不二葦 不二葦 +不二見 不二見 +不二門 不二門 +不可三 不可三 +与一迫 与一迫 +与三井 与三井 +与三川 与三川 +与三手 与三手 +与三本 与三本 +与三野 与三野 +与五沢 与五沢 +与五澤 与五澤 +与十田 与十田 +与四田 与四田 +世ノ一 世ノ一 +世一 世一 +世六 世六 +中一 中一 +中七 中七 +中万 中万 +中三川 中三川 +中三瀬 中三瀬 +中二 中二 +中八児 中八児 +中六角 中六角 +中十 中十 +中千 中千 +中千代 中千代 +丸一 丸一 +丸七 丸七 +丸二 丸二 +丸十 丸十 +乃一 乃一 +乃万 乃万 +久一 久一 +久七 久七 +久万 久万 +久万寿 久万寿 +久万川 久万川 +久万沢 久万沢 +久万澤 久万澤 +久万田 久万田 +久八 久八 +久百々 久百々 +乙二 乙二 +九々 九々 +九ノ池 九ノ池 +九ノ里 九ノ里 +九万原 九万原 +九万田 九万田 +九之坪 九之坪 +九之池 九之池 +九乗 九乗 +九井 九井 +九会田 九会田 +九住 九住 +九佐 九佐 +九保 九保 +九俵 九俵 +九内 九内 +九冨 九冨 +九刕 九刕 +九十九沢 九十九沢 +九十九澤 九十九澤 +九十九田 九十九田 +九十九里 九十九里 +九十歩 九十歩 +九十田 九十田 +九十谷 九十谷 +九千房 九千房 +九原 九原 +九反 九反 +九反田 九反田 +九司 九司 +九合 九合 +九喜 九喜 +九坪 九坪 +九城 九城 +九埜 九埜 +九堀 九堀 +九家 九家 +九富 九富 +九尾 九尾 +九山 九山 +九岡 九岡 +九島 九島 +九嶋 九嶋 +九川 九川 +九平 九平 +九座 九座 +九後 九後 +九徳 九徳 +九志田 九志田 +九戸 九戸 +九手 九手 +九折 九折 +九日 九日 +九星 九星 +九曜 九曜 +九會田 九會田 +九木 九木 +九木田 九木田 +九木野 九木野 +九本 九本 +九村 九村 +九条 九条 +九東 九東 +九栗 九栗 +九條 九條 +九次米 九次米 +九沢 九沢 +九河 九河 +九法 九法 +九津見 九津見 +九浦 九浦 +九海 九海 +九渡 九渡 +九澤 九澤 +九猪 九猪 +九玉 九玉 +九田 九田 +九町 九町 +九目 九目 +九矢 九矢 +九石 九石 +九社前 九社前 +九穂 九穂 +九笹 九笹 +九綱 九綱 +九翟 九翟 +九能 九能 +九良 九良 +九良賀野 九良賀野 +九良野 九良野 +九萬原 九萬原 +九藤 九藤 +九蘭 九蘭 +九角 九角 +九護 九護 +九谷 九谷 +九谷田 九谷田 +九貫 九貫 +九賀 九賀 +九軒 九軒 +九郎丸 九郎丸 +九郎座 九郎座 +九郎明川 九郎明川 +九郎田 九郎田 +九郷 九郷 +九里 九里 +九里山 九里山 +九里田 九里田 +九重 九重 +九重地 九重地 +九重谷 九重谷 +九重路 九重路 +九野 九野 +九野坂 九野坂 +九野木 九野木 +九野里 九野里 +九門 九門 +九間 九間 +九頭 九頭 +九頭竜 九頭竜 +九頭竜坂 九頭竜坂 +九頭見 九頭見 +九頭龍 九頭龍 +九頭龍坂 九頭龍坂 +九首見 九首見 +九高 九高 +九鬼 九鬼 +九鬼丸 九鬼丸 +二っ家 二っ家 +二の丸 二の丸 +二の宮 二の宮 +二の瀬 二の瀬 +二タ川 二タ川 +二タ月 二タ月 +二タ村 二タ村 +二タ見 二タ見 +二ツ亀 二ツ亀 +二ツ井 二ツ井 +二ツ城 二ツ城 +二ツ家 二ツ家 +二ツ寺 二ツ寺 +二ツ屋 二ツ屋 +二ツ山 二ツ山 +二ツ川 二ツ川 +二ツ木 二ツ木 +二ツ柳 二ツ柳 +二ツ森 二ツ森 +二ツ橋 二ツ橋 +二ツ池 二ツ池 +二ツ町 二ツ町 +二ツ矢 二ツ矢 +二ツ石 二ツ石 +二ツ神 二ツ神 +二ツ谷 二ツ谷 +二ツ迫 二ツ迫 +二ツ野 二ツ野 +二ノ上 二ノ上 +二ノ下 二ノ下 +二ノ丸 二ノ丸 +二ノ久保 二ノ久保 +二ノ井 二ノ井 +二ノ倉 二ノ倉 +二ノ原 二ノ原 +二ノ口 二ノ口 +二ノ坂 二ノ坂 +二ノ城 二ノ城 +二ノ宮 二ノ宮 +二ノ峰 二ノ峰 +二ノ形 二ノ形 +二ノ戸 二ノ戸 +二ノ文 二ノ文 +二ノ方 二ノ方 +二ノ本 二ノ本 +二ノ村 二ノ村 +二ノ瀬 二ノ瀬 +二ノ田 二ノ田 +二ノ神 二ノ神 +二ノ美屋 二ノ美屋 +二ノ谷 二ノ谷 +二ノ関 二ノ関 +二丁田 二丁田 +二万 二万 +二三味 二三味 +二三四 二三四 +二三島 二三島 +二上 二上 +二世 二世 +二串 二串 +二丸 二丸 +二丹 二丹 +二丹田 二丹田 +二久 二久 +二久山 二久山 +二之夕 二之夕 +二之宮 二之宮 +二之形 二之形 +二之方 二之方 +二之段 二之段 +二之湯 二之湯 +二之瀬 二之瀬 +二之部 二之部 +二五元 二五元 +二五垰 二五垰 +二五田 二五田 +二井 二井 +二井上 二井上 +二井内 二井内 +二井原 二井原 +二井土 二井土 +二井家 二井家 +二井屋 二井屋 +二井屋田 二井屋田 +二井山 二井山 +二井岡 二井岡 +二井川 二井川 +二井手 二井手 +二井本 二井本 +二井林 二井林 +二井田 二井田 +二井矢 二井矢 +二井藤 二井藤 +二井見 二井見 +二井谷 二井谷 +二井野 二井野 +二井関 二井関 +二亦 二亦 +二位 二位 +二位松 二位松 +二位永 二位永 +二位関 二位関 +二佐 二佐 +二保 二保 +二俟 二俟 +二俣 二俣 +二元 二元 +二六 二六 +二出川 二出川 +二分 二分 +二分野 二分野 +二十歩 二十歩 +二十田 二十田 +二十軒 二十軒 +二十里 二十里 +二原 二原 +二又 二又 +二又川 二又川 +二叉 二叉 +二叉川 二叉川 +二反 二反 +二反地 二反地 +二反田 二反田 +二反長 二反長 +二口 二口 +二口谷 二口谷 +二司 二司 +二名 二名 +二味 二味 +二和田 二和田 +二唐 二唐 +二問 二問 +二善 二善 +二喜 二喜 +二四岡 二四岡 +二国 二国 +二國 二國 +二坂 二坂 +二坂谷 二坂谷 +二坪 二坪 +二垣 二垣 +二基 二基 +二堂 二堂 +二場 二場 +二塚 二塚 +二夕川 二夕川 +二夕見 二夕見 +二多田 二多田 +二子 二子 +二子岩 二子岩 +二子石 二子石 +二字 二字 +二宗 二宗 +二宝 二宝 +二宮 二宮 +二家 二家 +二家本 二家本 +二尾 二尾 +二居 二居 +二居野 二居野 +二山 二山 +二岡 二岡 +二岩 二岩 +二岸 二岸 +二峯 二峯 +二峰 二峰 +二島 二島 +二崎 二崎 +二嶋 二嶋 +二川 二川 +二川原 二川原 +二川目 二川目 +二幡 二幡 +二平 二平 +二平太 二平太 +二弊? 二弊? +二張 二張 +二戸 二戸 +二戸部 二戸部 +二所宮 二所宮 +二挺木 二挺木 +二摩 二摩 +二改 二改 +二敷 二敷 +二文字 二文字 +二文字屋 二文字屋 +二斗蒔 二斗蒔 +二斗蒔田 二斗蒔田 +二斜 二斜 +二方 二方 +二日一 二日一 +二日市 二日市 +二星 二星 +二曽 二曽 +二替 二替 +二月田 二月田 +二木 二木 +二木田 二木田 +二本 二本 +二本垣 二本垣 +二本木 二本木 +二本杉 二本杉 +二本松 二本松 +二本柳 二本柳 +二本柿 二本柿 +二本森 二本森 +二本樹 二本樹 +二本橋 二本橋 +二杁 二杁 +二杉 二杉 +二村 二村 +二条 二条 +二条久保 二条久保 +二条院 二条院 +二松 二松 +二林 二林 +二枚田 二枚田 +二枚畑 二枚畑 +二枝 二枝 +二柱 二柱 +二柳 二柳 +二柿 二柿 +二栗 二栗 +二栢 二栢 +二株 二株 +二梃木 二梃木 +二條 二條 +二條久保 二條久保 +二森 二森 +二椙 二椙 +二楷堂 二楷堂 +二標 二標 +二橋 二橋 +二次 二次 +二正寺 二正寺 +二武 二武 +二歩 二歩 +二段 二段 +二殿 二殿 +二永 二永 +二江 二江 +二沢 二沢 +二沢平 二沢平 +二河 二河 +二河田 二河田 +二法田 二法田 +二津 二津 +二津谷 二津谷 +二浦 二浦 +二浦尾 二浦尾 +二浪 二浪 +二渡 二渡 +二滝 二滝 +二澤 二澤 +二澤平 二澤平 +二瀧 二瀧 +二瀬 二瀬 +二瀬川 二瀬川 +二熊 二熊 +二片 二片 +二牟礼 二牟礼 +二牟禮 二牟禮 +二牧畑 二牧畑 +二王堂 二王堂 +二王頭 二王頭 +二瓶 二瓶 +二田 二田 +二田原 二田原 +二田口 二田口 +二田水 二田水 +二町 二町 +二畑 二畑 +二畠 二畠 +二百寺 二百寺 +二百田 二百田 +二目 二目 +二矢 二矢 +二矢川 二矢川 +二矢田 二矢田 +二石 二石 +二礼 二礼 +二礼木 二礼木 +二社谷 二社谷 +二祖 二祖 +二神 二神 +二禮木 二禮木 +二科 二科 +二穴 二穴 +二窓 二窓 +二籐 二籐 +二継 二継 +二羽 二羽 +二股 二股 +二艘木 二艘木 +二艘舟 二艘舟 +二色 二色 +二若 二若 +二茅 二茅 +二荒 二荒 +二葉 二葉 +二薮 二薮 +二藤 二藤 +二藤部 二藤部 +二見 二見 +二見屋 二見屋 +二見谷 二見谷 +二角 二角 +二谷 二谷 +二谷島 二谷島 +二貝 二貝 +二賀木 二賀木 +二越 二越 +二軒谷 二軒谷 +二輪 二輪 +二通 二通 +二連木 二連木 +二道 二道 +二邨 二邨 +二郎丸 二郎丸 +二部 二部 +二部野 二部野 +二郷 二郷 +二里 二里 +二里木 二里木 +二重 二重 +二重作 二重作 +二重谷 二重谷 +二野 二野 +二野上 二野上 +二野下 二野下 +二野井 二野井 +二野塀 二野塀 +二野宮 二野宮 +二野屏 二野屏 +二野川 二野川 +二野戸 二野戸 +二野瀬 二野瀬 +二野瓶 二野瓶 +二門 二門 +二間 二間 +二間戸 二間戸 +二間瀬 二間瀬 +二関 二関 +二隅 二隅 +二階 二階 +二階堂 二階堂 +二階戸 二階戸 +二階蔵 二階蔵 +二階藏 二階藏 +二階谷 二階谷 +二面 二面 +二飯田 二飯田 +二馬 二馬 +二鹿 二鹿 +五の井 五の井 +五の坪 五の坪 +五ケ山 五ケ山 +五ケ市 五ケ市 +五ケ谷 五ケ谷 +五ノ上 五ノ上 +五ノ井 五ノ井 +五ノ坪 五ノ坪 +五ノ田 五ノ田 +五ノ谷 五ノ谷 +五丁 五丁 +五丁森 五丁森 +五万戸 五万戸 +五三 五三 +五上 五上 +五下 五下 +五丸 五丸 +五丹 五丹 +五之治 五之治 +五乙女 五乙女 +五井 五井 +五井山 五井山 +五井淵 五井淵 +五井渕 五井渕 +五井野 五井野 +五代 五代 +五代儀 五代儀 +五伝木 五伝木 +五位 五位 +五位堂 五位堂 +五位塚 五位塚 +五位尾 五位尾 +五位淵 五位淵 +五位渕 五位渕 +五位野 五位野 +五來 五來 +五傳木 五傳木 +五内川 五内川 +五冨利 五冨利 +五刀 五刀 +五分木 五分木 +五利江 五利江 +五前 五前 +五加 五加 +五勝出 五勝出 +五十井 五十井 +五十井田 五十井田 +五十代 五十代 +五十住 五十住 +五十免 五十免 +五十公野 五十公野 +五十内 五十内 +五十刈 五十刈 +五十右 五十右 +五十君 五十君 +五十地 五十地 +五十場 五十場 +五十子 五十子 +五十実 五十実 +五十實 五十實 +五十山田 五十山田 +五十峯 五十峯 +五十峰 五十峰 +五十島 五十島 +五十崎 五十崎 +五十嵐 五十嵐 +五十嶋 五十嶋 +五十嶺 五十嶺 +五十川 五十川 +五十州 五十州 +五十幡 五十幡 +五十木 五十木 +五十村 五十村 +五十栖 五十栖 +五十森 五十森 +五十棲 五十棲 +五十樓 五十樓 +五十殿 五十殿 +五十沢 五十沢 +五十洲 五十洲 +五十澤 五十澤 +五十玉 五十玉 +五十田 五十田 +五十畑 五十畑 +五十畠 五十畠 +五十石 五十石 +五十立 五十立 +五十苅 五十苅 +五十谷 五十谷 +五十貝 五十貝 +五十部 五十部 +五十里 五十里 +五十里屋 五十里屋 +五十野 五十野 +五十鈴 五十鈴 +五十鈴川 五十鈴川 +五十風 五十風 +五十香 五十香 +五升田 五升田 +五升目 五升目 +五反 五反 +五反分 五反分 +五反地 五反地 +五反田 五反田 +五反田屋 五反田屋 +五古 五古 +五名 五名 +五呂 五呂 +五味 五味 +五味之本 五味之本 +五味原 五味原 +五味多 五味多 +五味岡 五味岡 +五味川 五味川 +五味本 五味本 +五味沢 五味沢 +五味淵 五味淵 +五味渕 五味渕 +五味澤 五味澤 +五味田 五味田 +五和宮 五和宮 +五唐 五唐 +五喜田 五喜田 +五坊 五坊 +五坪 五坪 +五城 五城 +五堂 五堂 +五大 五大 +五大院 五大院 +五天 五天 +五太代 五太代 +五太子 五太子 +五字 五字 +五孝 五孝 +五安 五安 +五安城 五安城 +五官 五官 +五定 五定 +五宝 五宝 +五宮 五宮 +五家 五家 +五寧 五寧 +五寳 五寳 +五寶 五寶 +五対 五対 +五對 五對 +五屋 五屋 +五山 五山 +五岩 五岩 +五峯 五峯 +五島 五島 +五島屋 五島屋 +五崎 五崎 +五嵐 五嵐 +五嵐川 五嵐川 +五嶋 五嶋 +五嶋屋 五嶋屋 +五嶌 五嶌 +五川 五川 +五師 五師 +五幣 五幣 +五幤 五幤 +五平地 五平地 +五幾谷 五幾谷 +五座 五座 +五庵 五庵 +五弊 五弊 +五弓 五弓 +五影 五影 +五影堂 五影堂 +五得 五得 +五徳 五徳 +五戸 五戸 +五所 五所 +五所尾 五所尾 +五所村 五所村 +五所野尾 五所野尾 +五拾免 五拾免 +五敷 五敷 +五斗 五斗 +五斗田 五斗田 +五斗蒔 五斗蒔 +五日市 五日市 +五明 五明 +五明田 五明田 +五智 五智 +五月 五月 +五月女 五月女 +五月日 五月日 +五月田 五月田 +五木 五木 +五木本 五木本 +五木田 五木田 +五木谷 五木谷 +五本 五本 +五本上 五本上 +五本木 五本木 +五本松 五本松 +五村 五村 +五条 五条 +五条堀 五条堀 +五条川 五条川 +五条方 五条方 +五来 五来 +五東 五東 +五林 五林 +五枚橋 五枚橋 +五枝 五枝 +五枡本 五枡本 +五桝本 五桝本 +五條 五條 +五條堀 五條堀 +五條歩 五條歩 +五次 五次 +五歩一 五歩一 +五歩市 五歩市 +五歩池 五歩池 +五殿 五殿 +五水井 五水井 +五江淵 五江淵 +五江渕 五江渕 +五沢 五沢 +五泉 五泉 +五津 五津 +五浦 五浦 +五海 五海 +五瀬 五瀬 +五熊 五熊 +五王 五王 +五瓶 五瓶 +五田 五田 +五由出 五由出 +五町 五町 +五町森 五町森 +五畑 五畑 +五畿田 五畿田 +五百 五百 +五百久 五百久 +五百井 五百井 +五百住 五百住 +五百倉 五百倉 +五百原 五百原 +五百城 五百城 +五百尾 五百尾 +五百山 五百山 +五百島 五百島 +五百崎 五百崎 +五百川 五百川 +五百扇 五百扇 +五百旗部 五百旗部 +五百旗頭 五百旗頭 +五百木 五百木 +五百森 五百森 +五百沢 五百沢 +五百澤 五百澤 +五百瀬 五百瀬 +五百田 五百田 +五百目 五百目 +五百磐 五百磐 +五百竹 五百竹 +五百籏頭 五百籏頭 +五百蔵 五百蔵 +五百藏 五百藏 +五百路 五百路 +五百部 五百部 +五百野 五百野 +五百雀 五百雀 +五石 五石 +五社 五社 +五社谷 五社谷 +五神 五神 +五福 五福 +五穀 五穀 +五端 五端 +五筒 五筒 +五箇 五箇 +五箇谷 五箇谷 +五箇野 五箇野 +五籐 五籐 +五網 五網 +五老 五老 +五老海 五老海 +五耒 五耒 +五舛出 五舛出 +五舛目 五舛目 +五艘 五艘 +五良 五良 +五良島 五良島 +五良水 五良水 +五色 五色 +五荘 五荘 +五葉 五葉 +五葉木 五葉木 +五葉谷 五葉谷 +五藤 五藤 +五行 五行 +五見 五見 +五角 五角 +五谷 五谷 +五貝 五貝 +五貫 五貫 +五賀 五賀 +五軒家 五軒家 +五軒浜 五軒浜 +五軒濱 五軒濱 +五軒矢 五軒矢 +五輪 五輪 +五辺 五辺 +五辻 五辻 +五通 五通 +五道 五道 +五邉 五邉 +五郎 五郎 +五郎三 五郎三 +五郎丸 五郎丸 +五郎地 五郎地 +五郎大 五郎大 +五郎尾 五郎尾 +五郎島 五郎島 +五郎川 五郎川 +五郎水 五郎水 +五郎畑 五郎畑 +五郎谷 五郎谷 +五郎部 五郎部 +五郡 五郡 +五酔 五酔 +五里地 五里地 +五里守 五里守 +五里川原 五里川原 +五里江 五里江 +五重目 五重目 +五野 五野 +五野上 五野上 +五野井 五野井 +五閑 五閑 +五間 五間 +五間岩 五間岩 +五間長 五間長 +五関 五関 +五阿味 五阿味 +五阿弥 五阿弥 +五阿彌 五阿彌 +五陸 五陸 +五雲寺 五雲寺 +五領 五領 +五領田 五領田 +五頭 五頭 +五香 五香 +五香屋 五香屋 +五鬼上 五鬼上 +五鬼助 五鬼助 +五鬼田 五鬼田 +五鬼継 五鬼継 +五鹿 五鹿 +五龍神田 五龍神田 +井ノ一 井ノ一 +井一 井一 +井二 井二 +仁八 仁八 +今一 今一 +今八幡 今八幡 +仲三河 仲三河 +仲二見 仲二見 +伊万里 伊万里 +伊三木 伊三木 +伊三部 伊三部 +伊三野 伊三野 +伊五沢 伊五沢 +伊五澤 伊五澤 +伊千 伊千 +伍十川 伍十川 +休万 休万 +伝四 伝四 +佐二木 佐二木 +佐八 佐八 +佐美三 佐美三 +余百 余百 +倉八 倉八 +倉富二 倉富二 +儀万 儀万 +儀三武 儀三武 +元二 元二 +入一 入一 +入万 入万 +入不二 入不二 +八つ代 八つ代 +八ケ代 八ケ代 +八ケ婦 八ケ婦 +八ケ窪 八ケ窪 +八ツ井 八ツ井 +八ツ代 八ツ代 +八ツ元 八ツ元 +八ツ塚 八ツ塚 +八ツ尾 八ツ尾 +八ツ山 八ツ山 +八ツ岩 八ツ岩 +八ツ峰 八ツ峰 +八ツ崎 八ツ崎 +八ツ役 八ツ役 +八ツ星 八ツ星 +八ツ木 八ツ木 +八ツ本 八ツ本 +八ツ柳 八ツ柳 +八ツ橋 八ツ橋 +八ツ波 八ツ波 +八ツ浦 八ツ浦 +八ツ田 八ツ田 +八ツ繁 八ツ繁 +八ツ藤 八ツ藤 +八ツ賀 八ツ賀 +八丁 八丁 +八丁地 八丁地 +八丁目 八丁目 +八丁野 八丁野 +八七橋 八七橋 +八万 八万 +八万木 八万木 +八丈 八丈 +八丈野 八丈野 +八上 八上 +八下田 八下田 +八与 八与 +八世山 八世山 +八並 八並 +八串 八串 +八丸 八丸 +八丹 八丹 +八久 八久 +八久保 八久保 +八乕 八乕 +八乙女 八乙女 +八九 八九 +八亀 八亀 +八五郎丸 八五郎丸 +八井 八井 +八井沢 八井沢 +八井田 八井田 +八京 八京 +八代 八代 +八代田 八代田 +八代谷 八代谷 +八代醍 八代醍 +八伏 八伏 +八住 八住 +八作 八作 +八俣 八俣 +八倉 八倉 +八倉巻 八倉巻 +八元 八元 +八光 八光 +八児 八児 +八兒 八兒 +八内 八内 +八切 八切 +八別当 八別当 +八別當 八別當 +八前 八前 +八剣 八剣 +八剱 八剱 +八劒 八劒 +八劔 八劔 +八力 八力 +八加部 八加部 +八十 八十 +八十住 八十住 +八十八 八十八 +八十出 八十出 +八十原 八十原 +八十山 八十山 +八十岡 八十岡 +八十島 八十島 +八十嶋 八十嶋 +八十川 八十川 +八十広 八十広 +八十木 八十木 +八十歩 八十歩 +八十河 八十河 +八十浜 八十浜 +八十濱 八十濱 +八十瀬 八十瀬 +八十田 八十田 +八十科 八十科 +八千 八千 +八千代 八千代 +八千古島 八千古島 +八千古嶋 八千古嶋 +八千田 八千田 +八卷 八卷 +八原 八原 +八又 八又 +八友 八友 +八反 八反 +八反丸 八反丸 +八反地 八反地 +八反田 八反田 +八取 八取 +八司 八司 +八合 八合 +八名 八名 +八名木 八名木 +八向 八向 +八吹 八吹 +八周 八周 +八和田 八和田 +八品 八品 +八国 八国 +八国生 八国生 +八國 八國 +八國生 八國生 +八地又 八地又 +八坂 八坂 +八垣 八垣 +八垰 八垰 +八城 八城 +八塔 八塔 +八塚 八塚 +八塩 八塩 +八壁 八壁 +八声 八声 +八壽八 八壽八 +八多 八多 +八多川 八多川 +八太 八太 +八夫 八夫 +八子 八子 +八子熊 八子熊 +八字 八字 +八宗岡 八宗岡 +八宮 八宮 +八家 八家 +八富 八富 +八寿八 八寿八 +八寿田 八寿田 +八尋 八尋 +八尋淵 八尋淵 +八尋渕 八尋渕 +八尺 八尺 +八尻 八尻 +八尾 八尾 +八尾井 八尾井 +八尾坂 八尾坂 +八尾師 八尾師 +八尾村 八尾村 +八尾板 八尾板 +八尾田 八尾田 +八尾谷 八尾谷 +八尾野 八尾野 +八屋 八屋 +八山 八山 +八岡 八岡 +八岩 八岩 +八峠 八峠 +八島 八島 +八崎 八崎 +八嵜 八嵜 +八嶋 八嶋 +八嶌 八嶌 +八川 八川 +八巻 八巻 +八幡 八幡 +八幡原 八幡原 +八幡垣 八幡垣 +八幡屋 八幡屋 +八幡木 八幡木 +八幡秋山 八幡秋山 +八幡谷 八幡谷 +八幡野 八幡野 +八幡領 八幡領 +八平 八平 +八幾井 八幾井 +八広 八広 +八度 八度 +八廣 八廣 +八張 八張 +八影 八影 +八役 八役 +八性 八性 +八惣 八惣 +八懸 八懸 +八戸 八戸 +八戸木 八戸木 +八戸野 八戸野 +八房 八房 +八所 八所 +八手 八手 +八手亦 八手亦 +八手又 八手又 +八手幡 八手幡 +八括 八括 +八掛 八掛 +八敷 八敷 +八文字 八文字 +八斗 八斗 +八方 八方 +八旗 八旗 +八日 八日 +八日囿 八日囿 +八日園 八日園 +八日市 八日市 +八日市屋 八日市屋 +八日市谷 八日市谷 +八明 八明 +八星 八星 +八景 八景 +八月朔日 八月朔日 +八朔 八朔 +八朔日 八朔日 +八朝 八朝 +八木 八木 +八木ケ谷 八木ケ谷 +八木下 八木下 +八木井 八木井 +八木原 八木原 +八木司 八木司 +八木場 八木場 +八木尾 八木尾 +八木山 八木山 +八木岡 八木岡 +八木島 八木島 +八木巻 八木巻 +八木平 八木平 +八木庭 八木庭 +八木戸 八木戸 +八木本 八木本 +八木森 八木森 +八木橋 八木橋 +八木沢 八木沢 +八木沼 八木沼 +八木澤 八木澤 +八木田 八木田 +八木谷 八木谷 +八木野 八木野 +八本 八本 +八本木 八本木 +八杉 八杉 +八村 八村 +八杖 八杖 +八束 八束 +八条 八条 +八東 八東 +八松 八松 +八板 八板 +八林 八林 +八柄 八柄 +八柏 八柏 +八染 八染 +八柳 八柳 +八栗 八栗 +八桁 八桁 +八條 八條 +八森 八森 +八槇 八槇 +八構 八構 +八槙 八槙 +八槻 八槻 +八樹 八樹 +八橋 八橋 +八次 八次 +八武崎 八武崎 +八段 八段 +八毛 八毛 +八永 八永 +八汐 八汐 +八江 八江 +八沢 八沢 +八河 八河 +八波 八波 +八波田 八波田 +八津 八津 +八津倉 八津倉 +八津又 八津又 +八津口 八津口 +八津尾 八津尾 +八津川 八津川 +八津橋 八津橋 +八津田 八津田 +八津谷 八津谷 +八洲 八洲 +八浜 八浜 +八浦 八浦 +八浪 八浪 +八海 八海 +八淵 八淵 +八渓 八渓 +八渡 八渡 +八源寺 八源寺 +八潮 八潮 +八澤 八澤 +八濱 八濱 +八瀬 八瀬 +八瀬尾 八瀬尾 +八瀬山 八瀬山 +八瀬川 八瀬川 +八瀬林 八瀬林 +八瀬河 八瀬河 +八瀬辺 八瀬辺 +八瀬邉 八瀬邉 +八熊 八熊 +八牟礼 八牟礼 +八牟禮 八牟禮 +八牧 八牧 +八王 八王 +八王地 八王地 +八王子 八王子 +八甫谷 八甫谷 +八田 八田 +八田井 八田井 +八田原 八田原 +八田堀 八田堀 +八田羽 八田羽 +八田谷 八田谷 +八田部 八田部 +八田野 八田野 +八甲田 八甲田 +八町 八町 +八畑 八畑 +八畝田 八畝田 +八畠 八畠 +八登 八登 +八百 八百 +八百三 八百三 +八百下 八百下 +八百中 八百中 +八百井 八百井 +八百代 八百代 +八百原 八百原 +八百坂 八百坂 +八百城 八百城 +八百屋 八百屋 +八百山 八百山 +八百川 八百川 +八百市 八百市 +八百幸 八百幸 +八百木 八百木 +八百本 八百本 +八百村 八百村 +八百板 八百板 +八百枝 八百枝 +八百田 八百田 +八百谷 八百谷 +八百野 八百野 +八的 八的 +八矢 八矢 +八石 八石 +八社宮 八社宮 +八神 八神 +八穴 八穴 +八窪 八窪 +八端 八端 +八竹 八竹 +八符 八符 +八筈 八筈 +八筬 八筬 +八箇 八箇 +八篠 八篠 +八籏 八籏 +八納 八納 +八絛 八絛 +八綿 八綿 +八羽 八羽 +八羽毛 八羽毛 +八耳 八耳 +八聲 八聲 +八與 八與 +八舟 八舟 +八船 八船 +八色 八色 +八若 八若 +八荷 八荷 +八萬 八萬 +八葉 八葉 +八蕪 八蕪 +八藤 八藤 +八藤丸 八藤丸 +八藤後 八藤後 +八角 八角 +八記 八記 +八講 八講 +八谷 八谷 +八賀 八賀 +八起 八起 +八越 八越 +八車 八車 +八軒 八軒 +八軒屋 八軒屋 +八輪 八輪 +八辺 八辺 +八辻 八辻 +八道 八道 +八郎田 八郎田 +八部 八部 +八部野 八部野 +八郷 八郷 +八里 八里 +八重 八重 +八重下 八重下 +八重代 八重代 +八重倉 八重倉 +八重元 八重元 +八重原 八重原 +八重口 八重口 +八重垣 八重垣 +八重尾 八重尾 +八重山 八重山 +八重岡 八重岡 +八重岳 八重岳 +八重島 八重島 +八重崎 八重崎 +八重嶋 八重嶋 +八重嶌 八重嶌 +八重嶽 八重嶽 +八重川 八重川 +八重幡 八重幡 +八重座 八重座 +八重木 八重木 +八重本 八重本 +八重柏 八重柏 +八重桓 八重桓 +八重桜 八重桜 +八重森 八重森 +八重樫 八重樫 +八重橋 八重橋 +八重櫻 八重櫻 +八重沢 八重沢 +八重津 八重津 +八重澤 八重澤 +八重田 八重田 +八重畑 八重畑 +八重盛 八重盛 +八重石 八重石 +八重練 八重練 +八重見 八重見 +八重野 八重野 +八重門 八重門 +八野 八野 +八野井 八野井 +八野田 八野田 +八釖 八釖 +八釜 八釜 +八釣 八釣 +八釼 八釼 +八鍬 八鍬 +八鎌 八鎌 +八長 八長 +八間 八間 +八間川 八間川 +八阪 八阪 +八陣 八陣 +八陳 八陳 +八隅 八隅 +八雲 八雲 +八雲井 八雲井 +八面 八面 +八鞍 八鞍 +八須 八須 +八須元 八須元 +八須賀 八須賀 +八頭 八頭 +八頭司 八頭司 +八馬 八馬 +八高 八高 +八鬼 八鬼 +八鳥 八鳥 +八鹿 八鹿 +八黄地 八黄地 +六ケ村 六ケ村 +六ツ名 六ツ名 +六ツ崎 六ツ崎 +六ツ役 六ツ役 +六ツ森 六ツ森 +六ツ石 六ツ石 +六ツ見 六ツ見 +六万 六万 +六与 六与 +六串 六串 +六井 六井 +六人石 六人石 +六人部 六人部 +六信 六信 +六倉 六倉 +六十田 六十田 +六十苅 六十苅 +六十谷 六十谷 +六十里 六十里 +六厩 六厩 +六名 六名 +六呂田 六呂田 +六坂 六坂 +六塚 六塚 +六宗 六宗 +六室 六室 +六尾 六尾 +六山 六山 +六岡 六岡 +六峯 六峯 +六峰 六峰 +六崎 六崎 +六川 六川 +六平 六平 +六戸部 六戸部 +六日市 六日市 +六枝 六枝 +六楽内 六楽内 +六津井 六津井 +六浦 六浦 +六田 六田 +六碕 六碕 +六笠 六笠 +六與 六與 +六興 六興 +六萬 六萬 +六藤 六藤 +六角 六角 +六角屋 六角屋 +六谷 六谷 +六車 六車 +六軒 六軒 +六辻 六辻 +六連 六連 +六野 六野 +六釜 六釜 +六鎗 六鎗 +六門 六門 +六雄 六雄 +六鹿 六鹿 +兵万 兵万 +兵三 兵三 +兼八 兼八 +内一 内一 +内之八重 内之八重 +内八重 内八重 +円一 円一 +初一 初一 +前三盛 前三盛 +副万 副万 +加三 加三 +加九 加九 +加二倉 加二倉 +加二谷 加二谷 +加五元 加五元 +加千須 加千須 +加百 加百 +加篭六 加篭六 +加籠六 加籠六 +勘七 勘七 +勘六野 勘六野 +勝二 勝二 +勢一 勢一 +勢万 勢万 +北一 北一 +北七 北七 +北八 北八 +北八代 北八代 +十々木 十々木 +十ノ目 十ノ目 +十一家 十一家 +十一谷 十一谷 +十七夜月 十七夜月 +十七女 十七女 +十七部 十七部 +十七里 十七里 +十中 十中 +十丸 十丸 +十久保 十久保 +十九川 十九川 +十九本 十九本 +十九波 十九波 +十九浦 十九浦 +十九百 十九百 +十亀 十亀 +十二丁 十二丁 +十二役 十二役 +十二所 十二所 +十二村 十二村 +十二林 十二林 +十二町 十二町 +十二谷 十二谷 +十二里 十二里 +十二野 十二野 +十代 十代 +十代田 十代田 +十住 十住 +十佐近 十佐近 +十信田 十信田 +十倉 十倉 +十倍 十倍 +十八公 十八公 +十六原 十六原 +十六沢 十六沢 +十六澤 十六澤 +十前 十前 +十十木 十十木 +十南 十南 +十原 十原 +十司 十司 +十合 十合 +十名 十名 +十和 十和 +十和田 十和田 +十場 十場 +十塚 十塚 +十字 十字 +十家 十家 +十屋 十屋 +十山 十山 +十島 十島 +十川 十川 +十左近 十左近 +十市 十市 +十府 十府 +十役 十役 +十徳 十徳 +十志田 十志田 +十念 十念 +十手山 十手山 +十持 十持 +十握 十握 +十文字 十文字 +十日市 十日市 +十日谷 十日谷 +十朱 十朱 +十村 十村 +十束 十束 +十条 十条 +十松 十松 +十林 十林 +十枝 十枝 +十枝内 十枝内 +十根川 十根川 +十森 十森 +十楚 十楚 +十楽 十楽 +十楽寺 十楽寺 +十河 十河 +十津 十津 +十津川 十津川 +十玉 十玉 +十王 十王 +十王寺 十王寺 +十王舘 十王舘 +十王館 十王館 +十田 十田 +十石 十石 +十祖 十祖 +十神 十神 +十良 十良 +十良沢 十良沢 +十良澤 十良澤 +十菱 十菱 +十萬 十萬 +十蔵寺 十蔵寺 +十蟹 十蟹 +十見 十見 +十角 十角 +十輪地 十輪地 +十返 十返 +十連地 十連地 +十郎 十郎 +十部 十部 +十都 十都 +十重田 十重田 +十野 十野 +十門地 十門地 +十阿弥 十阿弥 +十阿彌 十阿彌 +十露木 十露木 +十鳥 十鳥 +千々和 千々和 +千々岩 千々岩 +千々布 千々布 +千々木 千々木 +千々村 千々村 +千々松 千々松 +千々波 千々波 +千々石 千々石 +千々谷 千々谷 +千々輪 千々輪 +千々部 千々部 +千々野 千々野 +千が崎 千が崎 +千ケ崎 千ケ崎 +千ノ木 千ノ木 +千ノ本 千ノ本 +千丈 千丈 +千三木 千三木 +千上 千上 +千且 千且 +千並 千並 +千中 千中 +千丸 千丸 +千久田 千久田 +千久谷 千久谷 +千久間 千久間 +千之巣 千之巣 +千之木 千之木 +千之本 千之本 +千井 千井 +千井野 千井野 +千京 千京 +千仏 千仏 +千代 千代 +千代世 千代世 +千代丸 千代丸 +千代住 千代住 +千代倉 千代倉 +千代原 千代原 +千代反田 千代反田 +千代園 千代園 +千代坂 千代坂 +千代山 千代山 +千代岡 千代岡 +千代島 千代島 +千代崎 千代崎 +千代川 千代川 +千代延 千代延 +千代政 千代政 +千代木 千代木 +千代本 千代本 +千代村 千代村 +千代松 千代松 +千代森 千代森 +千代樵 千代樵 +千代永 千代永 +千代沢 千代沢 +千代浦 千代浦 +千代澤 千代澤 +千代田 千代田 +千代留 千代留 +千代盛 千代盛 +千代窪 千代窪 +千代薗 千代薗 +千代藤 千代藤 +千代西尾 千代西尾 +千代谷 千代谷 +千代野 千代野 +千代間 千代間 +千代鶴 千代鶴 +千伝 千伝 +千住 千住 +千佐 千佐 +千保 千保 +千保木 千保木 +千俵 千俵 +千倉 千倉 +千傳 千傳 +千僧供 千僧供 +千先 千先 +千光 千光 +千光士 千光士 +千光寺 千光寺 +千児島 千児島 +千切 千切 +千切谷 千切谷 +千刈 千刈 +千利浜 千利浜 +千利濱 千利濱 +千割 千割 +千力 千力 +千勝 千勝 +千北 千北 +千千和 千千和 +千千松 千千松 +千千波 千千波 +千千石 千千石 +千千輪 千千輪 +千原 千原 +千口 千口 +千古 千古 +千台 千台 +千司 千司 +千合 千合 +千吉良 千吉良 +千同 千同 +千名 千名 +千名原 千名原 +千味 千味 +千品 千品 +千喜田 千喜田 +千喜良 千喜良 +千国 千国 +千國 千國 +千土 千土 +千地 千地 +千地丸 千地丸 +千地岩 千地岩 +千坂 千坂 +千坊 千坊 +千垣内 千垣内 +千城 千城 +千埜 千埜 +千堂 千堂 +千場 千場 +千塚 千塚 +千塲 千塲 +千壽 千壽 +千多 千多 +千守 千守 +千安 千安 +千室 千室 +千家 千家 +千寺丸 千寺丸 +千寿 千寿 +千尋 千尋 +千尺 千尺 +千尾 千尾 +千屋 千屋 +千山 千山 +千島 千島 +千崎 千崎 +千嵐 千嵐 +千嵜 千嵜 +千嶋 千嶋 +千嶌 千嶌 +千巌 千巌 +千巖 千巖 +千川 千川 +千川原 千川原 +千巣 千巣 +千布 千布 +千年 千年 +千年原 千年原 +千年屋 千年屋 +千広 千広 +千廣 千廣 +千引 千引 +千後 千後 +千後滝 千後滝 +千後瀧 千後瀧 +千徳 千徳 +千応山 千応山 +千應山 千應山 +千成 千成 +千戝 千戝 +千房 千房 +千手 千手 +千手間 千手間 +千才 千才 +千把 千把 +千抦 千抦 +千振 千振 +千斛 千斛 +千日 千日 +千日坂 千日坂 +千旦 千旦 +千早 千早 +千明 千明 +千星 千星 +千智岩 千智岩 +千智松 千智松 +千曳 千曳 +千月 千月 +千木 千木 +千木崎 千木崎 +千木穂 千木穂 +千木良 千木良 +千木里 千木里 +千木野 千木野 +千本 千本 +千本木 千本木 +千本松 千本松 +千朿 千朿 +千杉 千杉 +千村 千村 +千束 千束 +千条 千条 +千東 千東 +千松 千松 +千林 千林 +千枝 千枝 +千柄 千柄 +千根 千根 +千桐 千桐 +千桜 千桜 +千桝 千桝 +千條 千條 +千棒 千棒 +千森 千森 +千檀 千檀 +千櫻 千櫻 +千正 千正 +千歩 千歩 +千歳 千歳 +千歳丸 千歳丸 +千水 千水 +千江 千江 +千沢 千沢 +千沢口 千沢口 +千河 千河 +千治松 千治松 +千波 千波 +千津井 千津井 +千浜 千浜 +千浦 千浦 +千海 千海 +千滝 千滝 +千澤 千澤 +千澤口 千澤口 +千濱 千濱 +千烝 千烝 +千焏 千焏 +千熊 千熊 +千玉 千玉 +千生 千生 +千田 千田 +千田口 千田口 +千田谷 千田谷 +千町 千町 +千畑 千畑 +千疋 千疋 +千登勢 千登勢 +千百松 千百松 +千盤 千盤 +千目 千目 +千眼 千眼 +千矢 千矢 +千知 千知 +千知岩 千知岩 +千知松 千知松 +千知波 千知波 +千石 千石 +千石谷 千石谷 +千神 千神 +千福 千福 +千福地 千福地 +千秋 千秋 +千種 千種 +千穐 千穐 +千竃 千竃 +千竈 千竈 +千竜 千竜 +千端 千端 +千笠 千笠 +千管 千管 +千籐 千籐 +千絛 千絛 +千綾 千綾 +千綿 千綿 +千羽 千羽 +千股 千股 +千能 千能 +千脇 千脇 +千舘 千舘 +千舩 千舩 +千船 千船 +千艘 千艘 +千良 千良 +千色 千色 +千艸 千艸 +千苅 千苅 +千草 千草 +千菅 千菅 +千菊 千菊 +千葉 千葉 +千葉井 千葉井 +千葉原 千葉原 +千葉山 千葉山 +千葉崎 千葉崎 +千葉東 千葉東 +千葉桜 千葉桜 +千葉櫻 千葉櫻 +千蒲 千蒲 +千蔵 千蔵 +千藏 千藏 +千藤 千藤 +千虎 千虎 +千行 千行 +千装 千装 +千見寺 千見寺 +千覚原 千覚原 +千谷 千谷 +千貝 千貝 +千財 千財 +千財丸 千財丸 +千貫 千貫 +千賀 千賀 +千賀浦 千賀浦 +千足 千足 +千車 千車 +千載 千載 +千輝 千輝 +千輪 千輪 +千速 千速 +千道 千道 +千達 千達 +千邑 千邑 +千部 千部 +千郷 千郷 +千酌 千酌 +千里 千里 +千里久 千里久 +千里内 千里内 +千重 千重 +千野 千野 +千野原 千野原 +千野根 千野根 +千野田 千野田 +千野辺 千野辺 +千金 千金 +千金楽 千金楽 +千金良 千金良 +千釜 千釜 +千間 千間 +千阪 千阪 +千陽 千陽 +千隝 千隝 +千須和 千須和 +千頭 千頭 +千頭井 千頭井 +千頭和 千頭和 +千香 千香 +千馬 千馬 +千駄 千駄 +千高 千高 +千鳥 千鳥 +千鶴 千鶴 +千鹿野 千鹿野 +千龍 千龍 +千𥧄 千𥧄 +升一 升一 +南八重 南八重 +南百瀬 南百瀬 +参三 参三 +古一 古一 +古三庄 古三庄 +古伊万里 古伊万里 +古八 古八 +古六 古六 +古家一 古家一 +可二生 可二生 +合六 合六 +吉八木 吉八木 +吹一 吹一 +味八木 味八木 +善万 善万 +喜三 喜三 +四つ橋 四つ橋 +四つ目 四つ目 +四の宮 四の宮 +四ケ所 四ケ所 +四ケ浦 四ケ浦 +四ケ田 四ケ田 +四ケ谷 四ケ谷 +四ケ野 四ケ野 +四ツ井 四ツ井 +四ツ井田 四ツ井田 +四ツ倉 四ツ倉 +四ツ分 四ツ分 +四ツ塚 四ツ塚 +四ツ家 四ツ家 +四ツ居 四ツ居 +四ツ屋 四ツ屋 +四ツ岳 四ツ岳 +四ツ島 四ツ島 +四ツ嶋 四ツ嶋 +四ツ嶽 四ツ嶽 +四ツ役 四ツ役 +四ツ木 四ツ木 +四ツ村 四ツ村 +四ツ柳 四ツ柳 +四ツ橋 四ツ橋 +四ツ永 四ツ永 +四ツ滝 四ツ滝 +四ツ瀧 四ツ瀧 +四ツ田 四ツ田 +四ツ目 四ツ目 +四ツ碇 四ツ碇 +四ツ谷 四ツ谷 +四ツ路 四ツ路 +四ツ車 四ツ車 +四ツ辻 四ツ辻 +四ツ釜 四ツ釜 +四ツ門 四ツ門 +四ツ関 四ツ関 +四ノ原 四ノ原 +四ノ宮 四ノ宮 +四七 四七 +四万村 四万村 +四万田 四万田 +四下 四下 +四丸 四丸 +四丹 四丹 +四之宮 四之宮 +四井 四井 +四井田 四井田 +四伊 四伊 +四位 四位 +四位例 四位例 +四住 四住 +四作 四作 +四俣 四俣 +四俵 四俵 +四倉 四倉 +四元 四元 +四冨 四冨 +四分谷 四分谷 +四十万谷 四十万谷 +四十九院 四十九院 +四十井 四十井 +四十住 四十住 +四十八願 四十八願 +四十内 四十内 +四十坊 四十坊 +四十塚 四十塚 +四十宮 四十宮 +四十山 四十山 +四十岡 四十岡 +四十崎 四十崎 +四十川 四十川 +四十木 四十木 +四十本 四十本 +四十栄 四十栄 +四十榮 四十榮 +四十沢 四十沢 +四十洲 四十洲 +四十澤 四十澤 +四十物 四十物 +四十物谷 四十物谷 +四十田 四十田 +四十竹 四十竹 +四十萬谷 四十萬谷 +四十谷 四十谷 +四十野 四十野 +四反田 四反田 +四国 四国 +四國 四國 +四坂 四坂 +四坊 四坊 +四垂 四垂 +四堂 四堂 +四塚 四塚 +四夷 四夷 +四女野 四女野 +四季 四季 +四宅 四宅 +四宮 四宮 +四宮田 四宮田 +四家 四家 +四家井 四家井 +四富 四富 +四尺 四尺 +四尾 四尾 +四居 四居 +四屋 四屋 +四山 四山 +四岡 四岡 +四島 四島 +四嶋 四嶋 +四川 四川 +四平 四平 +四広 四広 +四度 四度 +四廣 四廣 +四役 四役 +四徳 四徳 +四恩 四恩 +四戸 四戸 +四戸岸 四戸岸 +四手 四手 +四手井 四手井 +四折 四折 +四斉谷 四斉谷 +四斎谷 四斎谷 +四斗 四斗 +四斗辺 四斗辺 +四斗邊 四斗邊 +四方 四方 +四方伝 四方伝 +四方城 四方城 +四方堂 四方堂 +四方天 四方天 +四方山 四方山 +四方川 四方川 +四方田 四方田 +四方谷 四方谷 +四方路 四方路 +四日市 四日市 +四日谷 四日谷 +四月朔日 四月朔日 +四木 四木 +四本 四本 +四本木 四本木 +四本松 四本松 +四杉 四杉 +四村 四村 +四条 四条 +四林 四林 +四枚田 四枚田 +四枝 四枝 +四柳 四柳 +四栗 四栗 +四條 四條 +四橋 四橋 +四歩一 四歩一 +四氏 四氏 +四水 四水 +四沢 四沢 +四津 四津 +四津井 四津井 +四津川 四津川 +四津田 四津田 +四津谷 四津谷 +四浦 四浦 +四海 四海 +四淵 四淵 +四渕 四渕 +四潟 四潟 +四澤 四澤 +四熊 四熊 +四牟田 四牟田 +四王天 四王天 +四田 四田 +四町田 四町田 +四畑 四畑 +四畝町 四畝町 +四登 四登 +四百刈 四百刈 +四百田 四百田 +四百目 四百目 +四百苅 四百苅 +四目忠 四目忠 +四碇 四碇 +四礼 四礼 +四禮 四禮 +四竃 四竃 +四竈 四竈 +四童子 四童子 +四篠 四篠 +四籐 四籐 +四維 四維 +四脇 四脇 +四至本 四至本 +四良丸 四良丸 +四茂野 四茂野 +四葉 四葉 +四蔵 四蔵 +四藏 四藏 +四藤 四藤 +四衢 四衢 +四角 四角 +四角目 四角目 +四谷 四谷 +四越 四越 +四車 四車 +四軒家 四軒家 +四軒町 四軒町 +四辻 四辻 +四通 四通 +四通田 四通田 +四道 四道 +四達 四達 +四邨 四邨 +四郎丸 四郎丸 +四郎園 四郎園 +四郎田 四郎田 +四重田 四重田 +四野 四野 +四野宮 四野宮 +四野見 四野見 +四釜 四釜 +四鈴 四鈴 +四鏡 四鏡 +四門 四門 +四間 四間 +四間丁 四間丁 +四関 四関 +四阿 四阿 +四静 四静 +四飯 四飯 +四馬田 四馬田 +四鬼 四鬼 +四鹿 四鹿 +四齊谷 四齊谷 +国ノ十 国ノ十 +國ノ十 國ノ十 +圓一 圓一 +土一 土一 +坂三 坂三 +坂八 坂八 +坂千代 坂千代 +城一 城一 +堀一 堀一 +堂七 堂七 +堂八 堂八 +堂六 堂六 +堰八 堰八 +塚八 塚八 +塩三 塩三 +増百 増百 +夏八木 夏八木 +大万 大万 +大三 大三 +大三和 大三和 +大三島 大三島 +大三川 大三川 +大三輪 大三輪 +大九 大九 +大二 大二 +大五 大五 +大八児 大八児 +大八木 大八木 +大六 大六 +大六野 大六野 +大千里 大千里 +大四 大四 +大志万 大志万 +天一 天一 +奇二 奇二 +奥一 奥一 +妙一 妙一 +孫八 孫八 +孫六 孫六 +宅万 宅万 +守一 守一 +安千谷 安千谷 +宗万 宗万 +宮一 宮一 +宮三 宮三 +宮千代 宮千代 +家千 家千 +寺一 寺一 +寺七 寺七 +寺二 寺二 +小一原 小一原 +小万 小万 +小三田 小三田 +小三門 小三門 +小二又 小二又 +小二田 小二田 +小二里 小二里 +小八ケ代 小八ケ代 +小八木 小八木 +小八田 小八田 +小八重 小八重 +小六 小六 +小千田 小千田 +小千谷 小千谷 +小四郎丸 小四郎丸 +小椎八重 小椎八重 +小田二 小田二 +尺一 尺一 +尾一 尾一 +尾万 尾万 +山一 山一 +山七 山七 +山三 山三 +山二 山二 +山八 山八 +山六 山六 +山千代 山千代 +山百 山百 +岡一 岡一 +岡野一 岡野一 +岩三 岩三 +岩八重 岩八重 +川七 川七 +川九 川九 +工一 工一 +左三川 左三川 +左衛門三郎 左衛門三郎 +市万田 市万田 +市六 市六 +布一 布一 +平八重 平八重 +庄八 庄八 +廿千 廿千 +弐百免 弐百免 +弥三川 弥三川 +弥三谷 弥三谷 +弥三須 弥三須 +弥五 弥五 +弥五郎丸 弥五郎丸 +弥六 弥六 +弥十郎 弥十郎 +彌三川 彌三川 +彌五郎丸 彌五郎丸 +彌八 彌八 +彌六 彌六 +当六 当六 +後一 後一 +従二 従二 +従二谷 従二谷 +從二 從二 +徳一 徳一 +徳万 徳万 +徳三 徳三 +徳千代 徳千代 +志万 志万 +悪七 悪七 +惣万 惣万 +惣八 惣八 +扇一 扇一 +才一 才一 +押三見 押三見 +拾三原 拾三原 +振五 振五 +政二 政二 +文殊四郎 文殊四郎 +文珠四郎 文珠四郎 +斉二 斉二 +斉五沢 斉五沢 +斎二 斎二 +斎五沢 斎五沢 +斎五澤 斎五澤 +新九町 新九町 +新二日市 新二日市 +新八 新八 +新四原 新四原 +新歩一 新歩一 +昼八 昼八 +晝八 晝八 +朝一 朝一 +朝三 朝三 +木一 木一 +木三田 木三田 +木佐一 木佐一 +末一 末一 +本九町 本九町 +本二日市 本二日市 +杉万 杉万 +杉八合 杉八合 +村万 村万 +杢三 杢三 +東一 東一 +東一坊 東一坊 +東一昉 東一昉 +東万 東万 +東三条 東三条 +東九 東九 +東九條 東九條 +東二町 東二町 +東五十川 東五十川 +東八重 東八重 +東四柳 東四柳 +松一 松一 +松七五三 松七五三 +松三 松三 +松二 松二 +松八重 松八重 +松千 松千 +松四 松四 +松百 松百 +板八 板八 +枡一 枡一 +栗三 栗三 +桝一 桝一 +梅千野 梅千野 +森一 森一 +椎八重 椎八重 +楠八重 楠八重 +権八 権八 +樫八重 樫八重 +橘八重 橘八重 +次六 次六 +次郎万 次郎万 +正一 正一 +武一 武一 +毛千 毛千 +水六 水六 +水四 水四 +永一 永一 +永二 永二 +江六前 江六前 +池一 池一 +池三津 池三津 +沖二 沖二 +河二 河二 +河千泰 河千泰 +河千田 河千田 +泉二 泉二 +津九浦 津九浦 +浜二 浜二 +浜千代 浜千代 +浜四津 浜四津 +清三津 清三津 +源九 源九 +源五郎丸 源五郎丸 +源六 源六 +濱二 濱二 +濱千代 濱千代 +濱四津 濱四津 +熊一 熊一 +猪八重 猪八重 +玉一 玉一 +玉八 玉八 +甚九 甚九 +甚五 甚五 +生一 生一 +生三 生三 +産一 産一 +田一 田一 +田万 田万 +田万里 田万里 +田二見 田二見 +田二谷 田二谷 +田千代 田千代 +百々 百々 +百々亀 百々亀 +百々坂 百々坂 +百々塚 百々塚 +百々海 百々海 +百々済 百々済 +百々瀬 百々瀬 +百々米木 百々米木 +百々谷 百々谷 +百々路 百々路 +百々野 百々野 +百丈 百丈 +百上 百上 +百中 百中 +百丸 百丸 +百井 百井 +百代 百代 +百元 百元 +百冨 百冨 +百出 百出 +百刈 百刈 +百勝 百勝 +百北 百北 +百千田 百千田 +百南 百南 +百原 百原 +百合 百合 +百合中 百合中 +百合口 百合口 +百合園 百合園 +百合山 百合山 +百合岡 百合岡 +百合島 百合島 +百合嶋 百合嶋 +百合川 百合川 +百合本 百合本 +百合林 百合林 +百合永 百合永 +百合沢 百合沢 +百合澤 百合澤 +百合田 百合田 +百合綱 百合綱 +百合草 百合草 +百合薗 百合薗 +百合藤 百合藤 +百合野 百合野 +百合長 百合長 +百名 百名 +百地 百地 +百坂 百坂 +百坪 百坪 +百垣 百垣 +百堂 百堂 +百塚 百塚 +百家 百家 +百富 百富 +百寿 百寿 +百尾 百尾 +百山 百山 +百岡 百岡 +百岳 百岳 +百島 百島 +百崎 百崎 +百嶋 百嶋 +百川 百川 +百市 百市 +百師 百師 +百度 百度 +百引 百引 +百成 百成 +百我 百我 +百戸 百戸 +百春 百春 +百木 百木 +百木田 百木田 +百木野 百木野 +百本 百本 +百村 百村 +百束 百束 +百松 百松 +百枝 百枝 +百橋 百橋 +百次 百次 +百武 百武 +百歩 百歩 +百毛 百毛 +百永 百永 +百江 百江 +百沢 百沢 +百治 百治 +百津 百津 +百浦 百浦 +百海 百海 +百済 百済 +百渓 百渓 +百溪 百溪 +百澤 百澤 +百濃 百濃 +百濟 百濟 +百瀬 百瀬 +百生 百生 +百田 百田 +百町 百町 +百畑 百畑 +百留 百留 +百百塚 百百塚 +百目 百目 +百目木 百目木 +百目鬼 百目鬼 +百相 百相 +百石 百石 +百積 百積 +百竹 百竹 +百花 百花 +百萬 百萬 +百衣 百衣 +百谷 百谷 +百貫 百貫 +百足 百足 +百足山 百足山 +百軒 百軒 +百道 百道 +百部 百部 +百都 百都 +百里 百里 +百野 百野 +百長 百長 +百間 百間 +百間田 百間田 +百間谷 百間谷 +百雲 百雲 +百鬼 百鬼 +百鳥 百鳥 +盛一 盛一 +目七 目七 +直一 直一 +真一 真一 +矢三 矢三 +矢五田 矢五田 +矢八 矢八 +石三 石三 +石五 石五 +祖一 祖一 +神一 神一 +神八 神八 +福一 福一 +福万 福万 +福三田 福三田 +秋三 秋三 +秋山八幡 秋山八幡 +種五 種五 +竒二 竒二 +竜八 竜八 +竹一 竹一 +竹万 竹万 +米一 米一 +紀三井 紀三井 +紺一 紺一 +紺一向 紺一向 +総三 総三 +羽二塚 羽二塚 +羽二木 羽二木 +羽二生 羽二生 +聞一 聞一 +能一 能一 +與一迫 與一迫 +與三 與三 +與三川 與三川 +與三本 與三本 +與三野 與三野 +與五沢 與五沢 +與五澤 與五澤 +與四田 與四田 +興五澤 興五澤 +芝一 芝一 +花八 花八 +荒二井 荒二井 +菊一 菊一 +菊万 菊万 +菊千 菊千 +菖一 菖一 +菰千葉 菰千葉 +蔵五 蔵五 +藏五 藏五 +藤三 藤三 +藤九 藤九 +藤五 藤五 +藤八 藤八 +藤六 藤六 +西万 西万 +西二町 西二町 +西五辻 西五辻 +西八条 西八条 +西八條 西八條 +西四辻 西四辻 +西阿十 西阿十 +見一 見一 +規矩一 規矩一 +角一 角一 +角七 角七 +角三 角三 +角二 角二 +角五 角五 +谷一 谷一 +貮百免 貮百免 +貳百免 貳百免 +賀篭六 賀篭六 +賀籠六 賀籠六 +越三 越三 +輿五澤 輿五澤 +近万 近万 +運万 運万 +道三 道三 +邑十 邑十 +郷万 郷万 +郷六 郷六 +酒百 酒百 +重三 重三 +野一 野一 +野一色 野一色 +金一 金一 +金七 金七 +金万 金万 +金三津 金三津 +金五 金五 +金田一 金田一 +釜一 釜一 +鉋六 鉋六 +鍋九 鍋九 +長一 長一 +長三 長三 +門三 門三 +門三野 門三野 +阿万 阿万 +阿万瀬 阿万瀬 +阿万田 阿万田 +阿万野 阿万野 +阿二 阿二 +阿千輪 阿千輪 +陣一 陣一 +須一 須一 +須百 須百 +飯万島 飯万島 +飾万 飾万 +飾万津 飾万津 +高一 高一 +高二 高二 +高三 高三 +高三潴 高三潴 +高三野 高三野 +高八 高八 +高八卦 高八卦 +高八重 高八重 +高千代 高千代 +高千穂 高千穂 +鬼ケ一 鬼ケ一 +鬼一 鬼一 +鬼十 鬼十 +鹿篭六 鹿篭六 +鹿籠六 鹿籠六 +齋二 齋二 +齋五澤 齋五澤 +龍八 龍八 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/graph_utils.py b/fun_text_processing/inverse_text_normalization/ja/graph_utils.py new file mode 100644 index 0000000..644a0ae --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/graph_utils.py @@ -0,0 +1,143 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from pynini import Far +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") + +# French frequently compounds numbers with hyphen. +delete_hyphen = pynutil.delete(pynini.closure("-", 0, 1)) +insert_hyphen = pynutil.insert("-") + +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) + + +def generator_main(file_name: str, graphs: Dict[str, pynini.FstLike]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + + Args: + fst: input fst + + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/inverse_text_normalization/ja/ja_itn_test_expected.txt b/fun_text_processing/inverse_text_normalization/ja/ja_itn_test_expected.txt new file mode 100644 index 0000000..f207d87 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/ja_itn_test_expected.txt @@ -0,0 +1,20 @@ +ps3,ps4,ATM,十数か二十,幸四郎,白雪姫と七人のこびと,七夕,千夜一夜,三百六十行,十五の月,冷凍三足,三十年河東,三十年河西,千年後,五月天,安倍晋三,小泉純一郎,山本五十六 +第1、第2、第3、第4、第5、第6、第7、第8、第9、第10、第11、第12、第13、第14、第15、第16、第17、第18、第19、第20、20、第24、24、第56、第100、第101 +で、わたしに入った原稿料からの1/5をあなたに渡すということなのだが。堅あげ愛は深く「体の1/3、1/4、1/2は堅あげになっています。 +06年4月~19年12月に日本で承認された医療機器は529件、そのうち小児用はわずか12件。 +1993年に誕生した同商品にちなみ、約30年前、20歳の頃の幸四郎の写真を公開。 +奮闘する自身の姿を収めたドキュメンタリー映画「10億円稼ぐ」(11月20日東京で公開)をPRするため東京都内で学生向けセミナーを開催。ゲストの「THE 虎舞竜」の高橋ジョージが、作詞作曲した「ロード」で印税16億円を稼いだと明かし、会場はどよめいた。 +発売の曲は220万枚を売り、高橋は印税をなんと2年で使い切ったそうだが「皆さんがカラオケで1回歌うと7円入りますし、今も年間1200万円ぐらい、黙ってても入ってきます」。何でもないようなことが幸せだったと思うと歌った曲は、とんでもない印税を生み出していて、テリーも降参。TikTokerゆりにゃ体重39kg“15kg減量”林みなほアナ。 +15日に第64回日本レコード大賞(主催日本作曲家協会)の各賞が発表されたが、これまで12年連続で優秀作品賞を受賞していたAK47はリストに入らず、記録が途絶えていた。 +開票が続くアメリカの中間選挙で複数のアメリカ主要メディアは11月16日、野党・共和党が定数435の連邦議会の下院で218議席を獲得し4年ぶりに多数派を奪還したと報じた。 +これで2021月1月に起こった連邦議会議事堂襲撃事件に関する下院の特別調査委員会は解散させられることになりそうだ。 +「昨年は新谷が本調子じゃない中で、それでもあれだけ走ってくれて助かりました」と現在の好調ぶりが伝えられていた新谷選手は11月13日に行われた東日本女子駅伝でアンカーを務め、10キロを31分08秒の区間賞で東京の逆転優勝の立役者となりました。 +フルマラソンのベストタイムは2時間40分34秒。 +久留米市では今朝一時間に92点5mmの猛烈な雨を観測一時間当たりの雨量としては1977年の統計開始以来最大です +治療を必要とする動脈管開存症のある赤ちゃんは、1500グラム未満では約30%、1000グラム未満では約50%とされる。薬で血管が閉じることも多いが、彩葉ちゃんは薬では血管が閉じなかった。668km。 +100|150|123|111|123|0|0|1|2|3|10|11|12|13|15|19|20|50|99|1200|1234|1011|1997|01234567890|123456789|102|324|100|200|1000|5000|1万|50万|1000000|4000万|6億|10億|9兆 +1679 +10086 +08613794568 +ソーシャルディス0,0,1,2,3,120,324,100,200,1000,1500,1679,5000,10000,1000000,10000000 +タンスにも遊び心326が隠されていましたが diff --git a/fun_text_processing/inverse_text_normalization/ja/ja_itn_test_input.txt b/fun_text_processing/inverse_text_normalization/ja/ja_itn_test_input.txt new file mode 100644 index 0000000..c621475 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/ja_itn_test_input.txt @@ -0,0 +1,20 @@ +ps三,ps四,ATM,十数か二十,幸四郎,白雪姫と七人のこびと,七夕,千夜一夜,三百六十行,十五の月,冷凍三足,三十年河東,三十年河西,千年後,五月天,安倍晋三,小泉純一郎,山本五十六 +第一、第二、第三、第四、第五、第六、第七、第八、第九、第十、第十一、第十二、第十三、第十四、第十五、第十六、第十七、第十八、第十九、第二十、二十、第二十四、二十四、第五十六、第百、第百一 +で、わたしに入った原稿料からの五分の一、五分の三をあなたに渡すということなのだが。堅あげ愛は深く「体の三分の一、四分の一、二分の一は堅あげになっています。 +零六年四月~一九年十二月に日本で承認された医療機器は五百二十九件、そのうち小児用はわずか十二件。 +一九九三年に誕生した同商品にちなみ、約三十年前、二十歳の頃の幸四郎の写真を公開。 +奮闘する自身の姿を収めたドキュメンタリー映画「十億円稼ぐ」(十一月二十日東京で公開)をPRするため東京都内で学生向けセミナーを開催。ゲストの「THE 虎舞竜」の高橋ジョージが、作詞作曲した「ロード」で印税十六億円を稼いだと明かし、会場はどよめいた。 +発売の曲は二百二十万枚を売り、高橋は印税をなんと二年で使い切ったそうだが「皆さんがカラオケで一回歌うと七円入りますし、今も年間一千二百万円ぐらい、黙ってても入ってきます」。何でもないようなことが幸せだったと思うと歌った曲は、とんでもない印税を生み出していて、テリーも降参。TikTokerゆりにゃ体重三十九キロ“十五キロ減量”林みなほアナ。 +十五日に第六十四回日本レコード大賞(主催日本作曲家協会)の各賞が発表されたが、これまで十二年連続で優秀作品賞を受賞していたAK四十七はリストに入らず、記録が途絶えていた。 +開票が続くアメリカの中間選挙で複数のアメリカ主要メディアは十一月十六日、野党・共和党が定数四百三十五の連邦議会の下院で二百十八議席を獲得し四年ぶりに多数派を奪還したと報じた。 +これで二〇二一月一月に起こった連邦議会議事堂襲撃事件に関する下院の特別調査委員会は解散させられることになりそうだ。 +「昨年は新谷が本調子じゃない中で、それでもあれだけ走ってくれて助かりました」と現在の好調ぶりが伝えられていた新谷選手は十一月十三日に行われた東日本女子駅伝でアンカーを務め、十キロを三十一分〇八秒の区間賞で東京の逆転優勝の立役者となりました。 +フルマラソンのベストタイムは二時間四十分三十四秒。 +久留米市では今朝一時間に九十二点五ミリの猛烈な雨を観測一時間当たりの雨量としては千九百七十七年の統計開始以来最大です +治療を必要とする動脈管開存症のある赤ちゃんは、一千五グラム未満では約三十パーセント、一千グラム未満では約五十パーセントとされる。薬で血管が閉じることも多いが、彩葉ちゃんは薬では血管が閉じなかった。六百六十八キロメートル。 +百|百五十|百二十三|百十一|一百二十三|〇|零|一|二|三|十|十一|十二|十三|十五|十九|二十|五十|九十九|一千二|一千二百三十四|千十一|千九百九十七|〇一二三四五六七八九零|一二三四五六七八九|百二|三百二十四|一百|二百|一千|五千|一万|五十万|一百万|四千万|六億|十億|九兆 +一千六百七十九 +一〇〇八六 +〇八六一三七九四五六八 +ソーシャルディス〇,零,一,二,三,百二,三百二十四,一百,二百,一千,一千五百,一千六百七十九,五千,一万,一百万,一千万 +タンスにも遊び心三百二十六が隠されていましたが diff --git a/fun_text_processing/inverse_text_normalization/ja/ja_unit_test.tsv b/fun_text_processing/inverse_text_normalization/ja/ja_unit_test.tsv new file mode 100644 index 0000000..7af970f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/ja_unit_test.tsv @@ -0,0 +1,20 @@ +ps三,ps四,ATM,十数か二十,幸四郎,白雪姫と七人のこびと,七夕,千夜一夜,三百六十行,十五の月,冷凍三足,三十年河東,三十年河西,千年後,五月天,安倍晋三,小泉純一郎,山本五十六 ps3,ps4,ATM,十数か二十,幸四郎,白雪姫と七人のこびと,七夕,千夜一夜,三百六十行,十五の月,冷凍三足,三十年河東,三十年河西,千年後,五月天,安倍晋三,小泉純一郎,山本五十六 +第一、第二、第三、第四、第五、第六、第七、第八、第九、第十、第十一、第十二、第十三、第十四、第十五、第十六、第十七、第十八、第十九、第二十、二十、第二十四、二十四、第五十六、第百、第百一 第1、第2、第3、第4、第5、第6、第7、第8、第9、第10、第11、第12、第13、第14、第15、第16、第17、第18、第19、第20、20、第24、24、第56、第100、第101 +で、わたしに入った原稿料からの五分の一、五分の三をあなたに渡すということなのだが。堅あげ愛は深く「体の三分の一、四分の一、二分の一は堅あげになっています。 で、わたしに入った原稿料からの1/5をあなたに渡すということなのだが。堅あげ愛は深く「体の1/3、1/4、1/2は堅あげになっています。 +零六年四月~一九年十二月に日本で承認された医療機器は五百二十九件、そのうち小児用はわずか十二件。 06年4月~19年12月に日本で承認された医療機器は529件、そのうち小児用はわずか12件。 +一九九三年に誕生した同商品にちなみ、約三十年前、二十歳の頃の幸四郎の写真を公開。 1993年に誕生した同商品にちなみ、約30年前、20歳の頃の幸四郎の写真を公開。 +奮闘する自身の姿を収めたドキュメンタリー映画「十億円稼ぐ」(十一月二十日東京で公開)をPRするため東京都内で学生向けセミナーを開催。ゲストの「THE 虎舞竜」の高橋ジョージが、作詞作曲した「ロード」で印税十六億円を稼いだと明かし、会場はどよめいた。 奮闘する自身の姿を収めたドキュメンタリー映画「10億円稼ぐ」(11月20日東京で公開)をPRするため東京都内で学生向けセミナーを開催。ゲストの「THE 虎舞竜」の高橋ジョージが、作詞作曲した「ロード」で印税16億円を稼いだと明かし、会場はどよめいた。 +発売の曲は二百二十万枚を売り、高橋は印税をなんと二年で使い切ったそうだが「皆さんがカラオケで一回歌うと七円入りますし、今も年間一千二百万円ぐらい、黙ってても入ってきます」。何でもないようなことが幸せだったと思うと歌った曲は、とんでもない印税を生み出していて、テリーも降参。TikTokerゆりにゃ体重三十九キロ“十五キロ減量”林みなほアナ。 発売の曲は220万枚を売り、高橋は印税をなんと2年で使い切ったそうだが「皆さんがカラオケで1回歌うと7円入りますし、今も年間1200万円ぐらい、黙ってても入ってきます」。何でもないようなことが幸せだったと思うと歌った曲は、とんでもない印税を生み出していて、テリーも降参。TikTokerゆりにゃ体重39kg“15kg減量”林みなほアナ。 +十五日に第六十四回日本レコード大賞(主催日本作曲家協会)の各賞が発表されたが、これまで十二年連続で優秀作品賞を受賞していたAK四十七はリストに入らず、記録が途絶えていた。 15日に第64回日本レコード大賞(主催日本作曲家協会)の各賞が発表されたが、これまで12年連続で優秀作品賞を受賞していたAK47はリストに入らず、記録が途絶えていた。 +開票が続くアメリカの中間選挙で複数のアメリカ主要メディアは十一月十六日、野党・共和党が定数四百三十五の連邦議会の下院で二百十八議席を獲得し四年ぶりに多数派を奪還したと報じた。 開票が続くアメリカの中間選挙で複数のアメリカ主要メディアは11月16日、野党・共和党が定数435の連邦議会の下院で218議席を獲得し4年ぶりに多数派を奪還したと報じた。 +これで二〇二一月一月に起こった連邦議会議事堂襲撃事件に関する下院の特別調査委員会は解散させられることになりそうだ。 これで2021月1月に起こった連邦議会議事堂襲撃事件に関する下院の特別調査委員会は解散させられることになりそうだ。 +「昨年は新谷が本調子じゃない中で、それでもあれだけ走ってくれて助かりました」と現在の好調ぶりが伝えられていた新谷選手は十一月十三日に行われた東日本女子駅伝でアンカーを務め、十キロを三十一分〇八秒の区間賞で東京の逆転優勝の立役者となりました。 「昨年は新谷が本調子じゃない中で、それでもあれだけ走ってくれて助かりました」と現在の好調ぶりが伝えられていた新谷選手は11月13日に行われた東日本女子駅伝でアンカーを務め、10キロを31分08秒の区間賞で東京の逆転優勝の立役者となりました。 +フルマラソンのベストタイムは二時間四十分三十四秒。 フルマラソンのベストタイムは2時間40分34秒。 +久留米市では今朝一時間に九十二点五ミリの猛烈な雨を観測一時間当たりの雨量としては千九百七十七年の統計開始以来最大です 久留米市では今朝一時間に92点5mmの猛烈な雨を観測一時間当たりの雨量としては1977年の統計開始以来最大です +治療を必要とする動脈管開存症のある赤ちゃんは、一千五グラム未満では約三十パーセント、一千グラム未満では約五十パーセントとされる。薬で血管が閉じることも多いが、彩葉ちゃんは薬では血管が閉じなかった。六百六十八キロメートル。 治療を必要とする動脈管開存症のある赤ちゃんは、1500グラム未満では約30%、1000グラム未満では約50%とされる。薬で血管が閉じることも多いが、彩葉ちゃんは薬では血管が閉じなかった。668km。 +百|百五十|百二十三|百十一|一百二十三|〇|零|一|二|三|十|十一|十二|十三|十五|十九|二十|五十|九十九|一千二|一千二百三十四|千十一|千九百九十七|〇一二三四五六七八九零|一二三四五六七八九|百二|三百二十四|一百|二百|一千|五千|一万|五十万|一百万|四千万|六億|十億|九兆 100|150|123|111|123|0|0|1|2|3|10|11|12|13|15|19|20|50|99|1200|1234|1011|1997|01234567890|123456789|102|324|100|200|1000|5000|1万|50万|1000000|4000万|6億|10億|9兆 +一千六百七十九 1679 +一〇〇八六 10086 +〇八六一三七九四五六八 08613794568 +ソーシャルディス〇,零,一,二,三,百二,三百二十四,一百,二百,一千,一千五百,一千六百七十九,五千,一万,一百万,一千万 ソーシャルディス0,0,1,2,3,120,324,100,200,1000,1500,1679,5000,10000,1000000,10000000 +タンスにも遊び心三百二十六が隠されていましたが タンスにも遊び心326が隠されていましたが \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/ja/taggers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/ja/taggers/cardinal.py new file mode 100644 index 0000000..5203093 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/cardinal.py @@ -0,0 +1,242 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import pynini +from pynini import accep, cross, string_file, union +from pynini.lib.pynutil import delete, insert, add_weight +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_CHAR, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil +import unicodedata + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. minus twenty three -> cardinal { integer: "23" negative: "-" } } + Numbers below thirteen are not converted. + """ + + def __init__(self, enable_standalone_number: bool = True, enable_0_to_9: bool = True): + super().__init__(name="cardinal", kind="classify") + self.enable_standalone_number = enable_standalone_number + self.enable_0_to_9 = enable_0_to_9 + zero = string_file(get_abs_path("data/numbers/zero.tsv")) + digit = string_file(get_abs_path("data/numbers/digit.tsv")) + hundred_digit = string_file(get_abs_path("data/numbers/hundred_digit.tsv")) + sign = string_file(get_abs_path("data/numbers/sign.tsv")) + dot = string_file(get_abs_path("data/numbers/dot.tsv")) + ties = string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = string_file(get_abs_path("data/numbers/teen.tsv")) + + addzero = insert("0") + digits = zero | digit # 0 ~ 9 + teen = graph_teen + teen |= cross("十", "1") + (digit | addzero) + tens = ties + addzero | (ties + (digit | addzero)) + + hundred = ( + digit + + delete("百") + + ( + tens + | teen + | add_weight(zero + digit, 0.1) + | add_weight(digit + addzero, 0.5) + | add_weight(addzero**2, 1.0) + ) + ) + hundred |= cross("百", "1") + ( + tens + | teen + | add_weight(zero + digit, 0.1) + | add_weight(digit + addzero, 0.5) + | add_weight(addzero**2, 1.0) + ) + hundred |= hundred_digit + + thousand = ( + (hundred | teen | tens | digits) + + delete("千") + + ( + hundred + | add_weight(zero + tens, 0.1) + | add_weight(addzero + zero + digit, 0.5) + | add_weight(digit + addzero**2, 0.8) + | add_weight(addzero**3, 1.0) + ) + ) + ten_thousand = ( + (thousand | hundred | teen | tens | digits) + + delete("万") + + ( + thousand + | add_weight(zero + hundred, 0.1) + | add_weight(addzero + zero + tens, 0.5) + | add_weight(addzero + addzero + zero + digit, 0.5) + | add_weight(digit + addzero**3, 0.8) + | add_weight(addzero**4, 1.0) + ) + ) + + hundred_thousand = ( + (ten_thousand | thousand | hundred | teen | tens | digits) + + delete("十万") + + ( + ten_thousand + | add_weight(zero + thousand, 0.1) + | add_weight(addzero + zero + hundred, 0.5) + | add_weight(addzero + addzero + zero + tens, 0.5) + | add_weight(addzero**3 + zero + digit, 0.5) + | add_weight(digit + addzero**4, 0.8) + | add_weight(addzero**5, 1.0) + ) + ) + + million = ( + (hundred_thousand | ten_thousand | thousand | hundred | teen | tens | digits) + + delete("百万") + + ( + hundred_thousand + | add_weight(zero + ten_thousand, 0.1) + | add_weight(addzero + zero + thousand, 0.5) + | add_weight(addzero + addzero + zero + hundred, 0.5) + | add_weight(addzero**3 + zero + tens, 0.5) + | add_weight(addzero**4 + zero + digit, 0.5) + | add_weight(digit + addzero**5, 0.8) + | add_weight(addzero**6, 1.0) + ) + ) + # 1亿 + hundred_million = ( + (million | hundred_thousand | ten_thousand | thousand | hundred | teen | tens | digits) + + delete("億") + + ( + add_weight(zero + million, 0.1) + | add_weight(addzero + zero + hundred_thousand, 0.5) + | add_weight(addzero**2 + zero + ten_thousand, 0.5) + | add_weight(addzero**3 + zero + thousand, 0.5) + | add_weight(addzero**4 + hundred, 0.5) + | add_weight(addzero**5 + tens, 0.5) + | add_weight(addzero**6 + digit, 0.5) + | add_weight(digit + addzero**7, 0.8) + | add_weight(addzero**8, 1.0) + ) + ) + # 1兆 + hundred_billion = ( + ( + hundred_million + | million + | hundred_thousand + | ten_thousand + | thousand + | hundred + | teen + | tens + | digits + ) + + delete("兆") + + ( + add_weight(addzero**3 + zero + hundred_million, 0.1) + | add_weight(addzero**4 + zero + million, 0.5) + | add_weight(addzero**5 + zero + hundred_thousand, 0.5) + | add_weight(addzero**6 + zero + ten_thousand, 0.5) + | add_weight(addzero**7 + zero + thousand, 0.5) + | add_weight(addzero**8 + hundred, 0.5) + | add_weight(addzero**9 + tens, 0.5) + | add_weight(addzero**10 + digit, 0.5) + | add_weight(digit + addzero**11, 0.8) + | add_weight(addzero**12, 1.0) + ) + ) + # 1.11, 1.01 + number = ( + digits | teen | tens | hundred | thousand | ten_thousand | hundred_thousand | million + ) + # number = digits | teen | tens | hundred | thousand | ten_thousand | hundred_thousand | million | hundred_million | hundred_billion + # 兆/亿 + number = (number + accep("兆") + delete("零").ques).ques + ( + number + accep("億") + delete("零").ques + ).ques + number | (number + accep("兆") + delete("〇").ques).ques + ( + number + accep("億") + delete("〇").ques + ).ques + number + + number = sign.ques + number + (dot + digits.plus).ques + self.number = number.optimize() + self.digits = digits.optimize() + + # cardinal string like 127.0.0.1, used in ID, IP, etc. + cardinal = digit.plus + (dot + digits.plus).plus + # float number like 1.11 + cardinal |= number + dot + digits.plus + # cardinal string like 110 or 12306 or 13125617878, used in phone + cardinal |= digits**3 | digits**5 | digits**10 | digits**11 | digits**12 + # cardinal string like 23 + if self.enable_standalone_number: + if self.enable_0_to_9: + cardinal |= number + else: + number_two_plus = ( + (digits + digits.plus) + | teen + | tens + | hundred + | thousand + | ten_thousand + | hundred_thousand + | million + | hundred_million + | hundred_billion + ) + cardinal |= number_two_plus + labels_exception = [""] + graph_exception = pynini.union(*labels_exception) + + self.graph_no_exception = cardinal + self.graph = (pynini.project(cardinal, "input") - graph_exception.arcsort()) @ cardinal + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("マイナス", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() + + # ######## + graph_hundred = pynini.cross("百", "") + graph_a_hundred_digit_component = pynini.union(pynini.cross("百", "10") + digit) + graph_one_hundred_component = pynini.union(pynini.cross("百", "100")) + graph_hundred_ties_component = pynini.cross("百", "1") + pynini.union( + graph_teen | pynutil.insert("00"), + (ties | pynutil.insert("0")) + (digit | pynutil.insert("0")), + ) + graph_hundred_component = pynini.union(digit + graph_hundred, pynutil.insert("0")) + graph_hundred_component += pynini.union( + graph_teen | pynutil.insert("00"), + (ties | pynutil.insert("0")) + (digit | pynutil.insert("0")), + ) + graph_hundred_component = ( + graph_hundred_component + | graph_a_hundred_digit_component + | graph_one_hundred_component + | graph_hundred_ties_component + ) + # + graph_hundred_component_at_least_one_none_zero_digit = graph_hundred_component @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/date.py b/fun_text_processing/inverse_text_normalization/ja/taggers/date.py new file mode 100644 index 0000000..37689be --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/date.py @@ -0,0 +1,159 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + +graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")).optimize() +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize() +ties_graph = pynini.string_file(get_abs_path("data/numbers/ties.tsv")).optimize() + + +def _get_month_graph(): + """ + Transducer for month, e.g. march -> march + """ + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + return month_graph + + +def _get_ties_graph(): + """ + Transducer for 20-99 e.g + twenty three -> 23 + """ + graph = ties_graph + (delete_space + graph_digit | pynutil.insert("0")) + return graph + + +def _get_range_graph(): + """ + Transducer for decades (1**0s, 2**0s), centuries (2*00s, 1*00s), millennia (2000s) + """ + graph_ties = _get_ties_graph() + graph = (graph_ties | graph_teen) + delete_space + pynini.cross("百", "00s") + graph |= pynini.cross("二", "2") + delete_space + pynini.cross("千", "000s") + graph |= ( + (graph_ties | graph_teen) + + delete_space + + (pynini.closure(DAMO_ALPHA, 1) + (pynini.cross("ies", "y") | pynutil.delete("s"))) + @ (graph_ties | pynini.cross("十", "10")) + + pynutil.insert("s") + ) + graph @= pynini.union("1", "2") + DAMO_DIGIT + DAMO_DIGIT + DAMO_DIGIT + "s" + return graph + + +def _get_year_graph(): + """ + Transducer for year, e.g. twenty twenty -> 2020 + """ + + def _get_digits_graph(): + zero = pynini.cross((pynini.accep("〇") | pynini.accep("零")), "0") + graph = zero + delete_space + graph_digit + graph.optimize() + return graph + + def _get_thousands_graph(): + graph_ties = _get_ties_graph() + graph_hundred_component = ( + graph_digit + delete_space + pynutil.delete("百") + ) | pynutil.insert("0") + graph_hundred_component |= (pynini.cross("百", "1")) | pynutil.insert("0") + graph = ( + graph_digit + + delete_space + + pynutil.delete("千") + + delete_space + + graph_hundred_component + + delete_space + + (graph_teen | graph_ties) + ) + graph |= ( + pynini.cross("千", "1") + + delete_space + + graph_hundred_component + + delete_space + + (graph_teen | graph_ties) + ) + + return graph + + graph_ties = _get_ties_graph() + graph_digits = _get_digits_graph() + graph_thousands = _get_thousands_graph() + year_graph = ( + # 20 19, 40 12, 2012 - assuming no limit on the year + (graph_teen + delete_space + (graph_ties | graph_digits | graph_teen)) + | (graph_ties + delete_space + (graph_ties | graph_digits | graph_teen)) + | graph_thousands + ) + year_graph.optimize() + return year_graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. january fifth twenty twelve -> date { month: "january" day: "5" year: "2012" preserve_order: true } + e.g. the fifth of january twenty twelve -> date { day: "5" month: "january" year: "2012" preserve_order: true } + e.g. twenty twenty -> date { year: "2012" preserve_order: true } + + Args: + ordinal: OrdinalFst + """ + + def __init__(self, ordinal: GraphFst): + super().__init__(name="date", kind="classify") + + ordinal_graph = ordinal.graph + year_graph = _get_year_graph() + YEAR_WEIGHT = 0.001 + year_graph = pynutil.add_weight(year_graph, YEAR_WEIGHT) + month_graph = _get_month_graph() + + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + + day_graph = ( + pynutil.insert('day: "') + pynutil.add_weight(ordinal_graph, -0.7) + pynutil.insert('"') + ) + graph_year = ( + delete_extra_space + + pynutil.insert('year: "') + + pynutil.add_weight(year_graph, -YEAR_WEIGHT) + + pynutil.insert('"') + ) + optional_graph_year = pynini.closure( + graph_year, + 0, + 1, + ) + graph_mdy = month_graph + ( + (delete_extra_space + day_graph) + | graph_year + | (delete_extra_space + day_graph + graph_year) + ) + graph_dmy = ( + pynutil.delete("the") + + delete_space + + day_graph + + delete_space + + pynutil.delete("of") + + delete_extra_space + + month_graph + + optional_graph_year + ) + graph_year = ( + pynutil.insert('year: "') + (year_graph | _get_range_graph()) + pynutil.insert('"') + ) + + final_graph = graph_mdy | graph_dmy | graph_year + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/ja/taggers/decimal.py new file mode 100644 index 0000000..1e79196 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/decimal.py @@ -0,0 +1,102 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + numbers = cardinal_up_to_hundred @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + suffix = pynini.union( + "万", "百万", "千万", "億" "十億", "trillion", "quadrillion", "quintillion", "sextillion" + ) + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + + delete_extra_space + + pynutil.insert('quantity: "') + + (suffix | "千") + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. minus twelve point five o o six billion -> decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } + e.g. one billion -> decimal { integer_part: "1" quantity: "billion" } + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_decimal = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_decimal |= ( + pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + | pynini.cross("零", "0") + | pynini.cross("〇", "0") + ) + + graph_decimal = pynini.closure(graph_decimal + delete_space) + graph_decimal + self.graph = graph_decimal + + point = pynutil.delete("点") + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("マイナス", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + point + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/ja/taggers/electronic.py new file mode 100644 index 0000000..dfd13a6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/electronic.py @@ -0,0 +1,103 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_ALPHA, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. c d f one at a b c dot e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("ドット", ".") + username = ( + alpha_num + pynini.closure(delete_extra_space + accepted_username) + ) | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + username = pynutil.insert('username: "') + username + pynutil.insert('"') + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete("at") + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("w w w", "www"), "www") + protocol_start = ( + pynini.cross("h t t p", "http") | pynini.cross("h t t p s", "https") + ) + pynini.cross( + "コロンスラッシュスラッシュ", "://" # colon slash slash + ) + # .com, + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + ( + domain + | pynini.closure( + accepted_username + delete_extra_space, + ) + + accepted_username + ) + ) + + protocol_default = ( + ( + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + ) + + pynini.closure(ending, 1) + ).optimize() + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + protocol_default + ).optimize() + + protocol |= ( + pynini.closure(protocol_end + delete_extra_space + process_dot, 0, 1) + protocol_default + ) + + protocol = pynutil.insert('protocol: "') + protocol.optimize() + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/ja/taggers/fraction.py new file mode 100644 index 0000000..5ae4a00 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/fraction.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + insert_space, + DAMO_CHAR, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + e.g. 2 phần 3 -> tokens { fraction { numerator: "2" denominator: "3" } } + e.g. 2 trên 3 -> tokens { fraction { numerator: "2" denominator: "3" } } + e.g. 2 chia 3 -> tokens { fraction { numerator: "2" denominator: "3" } } + + Args: + cardinal: OrdinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="fraction", kind="classify") + + graph_cardinal = cardinal.graph_no_exception + graph_four = pynini.cross("クォーター", "4") # quarter + + denominator = ( + pynutil.insert('denominator: "') + (graph_cardinal | graph_four) + pynutil.insert('"') + ) + fraction_component = pynutil.delete(pynini.union("分の", "割る")) + numerator = pynutil.insert('numerator: "') + graph_cardinal + pynutil.insert('"') + + graph_fraction_component = denominator + insert_space + fraction_component + numerator + + self.graph_fraction_component = graph_fraction_component + + graph = graph_fraction_component + graph = graph.optimize() + self.final_graph_wo_negative = graph + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("マイナス", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph = optional_graph_negative + graph + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/measure.py b/fun_text_processing/inverse_text_normalization/ja/taggers/measure.py new file mode 100644 index 0000000..8b0be1f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/measure.py @@ -0,0 +1,110 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. minus twelve kilograms -> measure { negative: "true" cardinal { integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_unit = pynini.string_file(get_abs_path("data/measurements.tsv")) + graph_unit_singular = graph_unit # singular -> abbr + graph_unit_plural = graph_unit_singular # plural -> abbr + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("マイナス", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_singular = graph_unit_singular + unit_plural = graph_unit_plural + unit_misc = pynutil.insert("/") + pynutil.delete("每") + delete_space + graph_unit_singular + + unit_singular = ( + pynutil.insert('units: "') + + ( + unit_singular + | unit_misc + | pynutil.add_weight(unit_singular + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + unit_plural = ( + pynutil.insert('units: "') + + ( + unit_plural + | unit_misc + | pynutil.add_weight(unit_plural + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_decimal |= ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + # + delete_extra_space + + unit_plural + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "一") @ cardinal_graph) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + pynini.cross("一", "1") + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "一") @ cardinal_graph) + + pynutil.insert('"') + + pynutil.insert(" }") + + unit_singular + ) + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/money.py b/fun_text_processing/inverse_text_normalization/ja/taggers/money.py new file mode 100644 index 0000000..63e2c14 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/money.py @@ -0,0 +1,108 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + # get_singulars, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. twelve dollars and five cents -> money { integer_part: "12" fractional_part: 05 currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + # add support for missing hundred (only for 3 digit numbers) + # "one fifty" -> "one hundred fifty" + with_hundred = pynini.compose( + pynini.closure(DAMO_NOT_SPACE) + pynini.accep(" ") + pynutil.insert("百") + DAMO_SIGMA, + pynini.compose(cardinal_graph, DAMO_DIGIT**3), + ) + cardinal_graph |= with_hundred + graph_decimal_final = decimal.final_graph_wo_negative + + unit = pynini.string_file(get_abs_path("data/currency.tsv")) + unit_singular = pynini.invert(unit) + unit_plural = unit_singular + # unit_plural = get_singulars(unit_singular) + + graph_unit_singular = ( + pynutil.insert('currency: "') + convert_space(unit_singular) + pynutil.insert('"') + ) + graph_unit_plural = ( + pynutil.insert('currency: "') + convert_space(unit_plural) + pynutil.insert('"') + ) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + # twelve dollars (and) fifty cents, zero cents + cents_standalone = ( + pynutil.insert('fractional_part: "') + + pynini.union( + pynutil.add_weight(((DAMO_SIGMA - "一") @ cardinal_graph), -0.7) + @ add_leading_zero_to_double_digit + + delete_space + + pynutil.delete("セント"), # cent + pynini.cross("一", "01") + delete_space + pynutil.delete("セント"), # cent + ) + + pynutil.insert('"') + ) + + optional_cents_standalone = pynini.closure( + delete_space + + pynini.closure(pynutil.delete("と") + delete_space, 0, 1) # and + + insert_space + + cents_standalone, + 0, + 1, + ) + # twelve dollars fifty, only after integer + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('fractional_part: "') + + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "一") @ cardinal_graph) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_plural + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_integer |= ( + pynutil.insert('integer_part: "') + + pynini.cross("一", "1") + + pynutil.insert('"') + + delete_extra_space + + graph_unit_singular + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_decimal = graph_decimal_final + delete_extra_space + graph_unit_plural + graph_decimal |= pynutil.insert('currency: "$" integer_part: "0" ') + cents_standalone + final_graph = graph_integer | graph_decimal + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/ja/taggers/ordinal.py new file mode 100644 index 0000000..6803811 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/ordinal.py @@ -0,0 +1,55 @@ +import pynini +from pynini import cross +from pynini.lib.pynutil import delete, insert, add_weight +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import DAMO_CHAR, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + e.g. thirteenth -> ordinal { integer: "13" } + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="ordinal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")) + ties = pynini.string_file(get_abs_path("data/ordinals/ties.tsv")) + teen = pynini.string_file(get_abs_path("data/ordinals/teen.tsv")) + zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + hundred_digit = pynini.string_file(get_abs_path("data/numbers/hundred_digit.tsv")) + addzero = insert("0") + tens = ties + addzero | (digit + delete("十") + (digit | addzero)) + hundred = ( + digit + + delete("百") + + ( + tens + | teen + | add_weight(zero + digit, 0.1) + | add_weight(digit + addzero, 0.5) + | add_weight(addzero**2, 1.0) + ) + ) + hundred |= cross("百", "1") + ( + tens + | teen + | add_weight(zero + digit, 0.1) + | add_weight(digit + addzero, 0.5) + | add_weight(addzero**2, 1.0) + ) + hundred |= hundred_digit + + ordinal = digit | teen | tens | hundred + graph = pynini.closure(DAMO_CHAR, 1) + ordinal + + self.graph = graph @ cardinal_graph + final_graph = pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/preprocessor.py b/fun_text_processing/inverse_text_normalization/ja/taggers/preprocessor.py new file mode 100644 index 0000000..2c66ed3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/preprocessor.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import DAMO_SIGMA, GraphFst +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from pynini.lib import pynutil + + +class PreProcessor(GraphFst): + def __init__( + self, + halfwidth_to_fullwidth: bool = True, + ): + super().__init__(name="PreProcessor", kind="processor") + + graph = pynini.cdrewrite("", "", "", DAMO_SIGMA) + + if halfwidth_to_fullwidth: + halfwidth_to_fullwidth_graph = pynini.string_file( + get_abs_path("data/char/halfwidth_to_fullwidth.tsv") + ) + graph @= pynini.cdrewrite(halfwidth_to_fullwidth_graph, "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/ja/taggers/punctuation.py new file mode 100644 index 0000000..7c79ac8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~、。,!【】「」《》¥()——・" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/ja/taggers/telephone.py new file mode 100644 index 0000000..192ff18 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/telephone.py @@ -0,0 +1,150 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_ALNUM, + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +def get_serial_number(cardinal): + """ + any alphanumerical character sequence with at least one number with length greater equal to 3 + """ + digit = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT) + character = digit + sequence = character + pynini.closure(character, 2) + sequence = sequence @ (pynini.closure(DAMO_ALNUM) + DAMO_DIGIT + pynini.closure(DAMO_ALNUM)) + return sequence.optimize() + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + one two three one two three five six seven eight -> { number_part: "123-123-5678" } + + This class also support card number and IP format. + "one two three dot one double three dot o dot four o" -> { number_part: "123.133.0.40"} + + "three two double seven three two one four three two one four three double zero five" -> + { number_part: 3277 3214 3214 3005} + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="telephone", kind="classify") + # country code, number_part, extension + digit_to_str = ( + pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize()) + # | pynini.cross("0", pynini.union("o")).optimize() + | pynini.cross("0", pynini.union("〇", "零")).optimize() + ) + + str_to_digit = pynini.invert(digit_to_str) + + double_digit = pynini.union( + *[ + pynini.cross( + pynini.project(str(i) @ digit_to_str, "output") + + pynini.accep(" ") + + pynini.project(str(i) @ digit_to_str, "output"), + pynutil.insert("double ") + pynini.project(str(i) @ digit_to_str, "output"), + ) + for i in range(10) + ] + ) + double_digit.invert() + + # to handle cases like "one twenty three" + two_digit_cardinal = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT**2) + double_digit_to_digit = ( + pynini.compose(double_digit, str_to_digit + pynutil.delete(" ") + str_to_digit) + | two_digit_cardinal + ) + + single_or_double_digit = ( + pynutil.add_weight(double_digit_to_digit, -0.0001) | str_to_digit + ).optimize() + single_or_double_digit |= ( + single_or_double_digit + + pynini.closure( + pynutil.add_weight(pynutil.delete(" ") + single_or_double_digit, 0.0001) + ) + ).optimize() + + number_part = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + number_part = ( + pynutil.insert('number_part: "') + number_part.optimize() + pynutil.insert('"') + ) + + cardinal_option = pynini.compose(single_or_double_digit, DAMO_DIGIT ** (2, 3)) + + country_code = ( + pynutil.insert('country_code: "') + + pynini.closure(pynini.cross("プラス ", "+"), 0, 1) # plus + + ( + (pynini.closure(str_to_digit + pynutil.delete(" "), 0, 2) + str_to_digit) + | cardinal_option + ) + + pynutil.insert('"') + ) + + optional_country_code = pynini.closure( + country_code + pynutil.delete(" ") + insert_space, 0, 1 + ).optimize() + graph = optional_country_code + number_part + + # credit card number + space_four_digits = insert_space + DAMO_DIGIT**4 + credit_card_graph = pynini.compose( + single_or_double_digit, DAMO_DIGIT**4 + space_four_digits**3 + ).optimize() + graph |= ( + pynutil.insert('number_part: "') + credit_card_graph.optimize() + pynutil.insert('"') + ) + + # SSN + ssn_graph = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**2 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + graph |= pynutil.insert('number_part: "') + ssn_graph.optimize() + pynutil.insert('"') + + # ip + digit_or_double = ( + pynini.closure(str_to_digit + pynutil.delete(" "), 0, 1) + double_digit_to_digit + ) + digit_or_double |= double_digit_to_digit + pynini.closure( + pynutil.delete(" ") + str_to_digit, 0, 1 + ) + digit_or_double |= str_to_digit + (pynutil.delete(" ") + str_to_digit) ** (0, 2) + digit_or_double |= cardinal_option + digit_or_double = digit_or_double.optimize() + + ip_graph = digit_or_double + (pynini.cross(" 点 ", ".") + digit_or_double) ** 3 # dot + + graph |= pynutil.insert('number_part: "') + ip_graph.optimize() + pynutil.insert('"') + graph |= ( + pynutil.insert('number_part: "') + + pynutil.add_weight(get_serial_number(cardinal=cardinal), weight=0.0001) + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/time.py b/fun_text_processing/inverse_text_normalization/ja/taggers/time.py new file mode 100644 index 0000000..ee92f8e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/time.py @@ -0,0 +1,140 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path, num_to_word +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. twelve thirty -> time { hours: "12" minutes: "30" } + e.g. twelve past one -> time { minutes: "12" hours: "1" } + e.g. two o clock a m -> time { hours: "2" suffix: "a.m." } + e.g. quarter to two -> time { hours: "1" minutes: "45" } + e.g. quarter past two -> time { hours: "2" minutes: "15" } + e.g. half past two -> time { hours: "2" minutes: "30" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + suffix_graph = pynini.string_file(get_abs_path("data/time/time_suffix.tsv")) + time_zone_graph = pynini.invert(pynini.string_file(get_abs_path("data/time/time_zone.tsv"))) + to_hour_graph = pynini.string_file(get_abs_path("data/time/to_hour.tsv")) + minute_to_graph = pynini.string_file(get_abs_path("data/time/minute_to.tsv")) + + # only used for < 1000 thousand -> 0 weight + cardinal = pynutil.add_weight(CardinalFst().graph_no_exception, weight=-0.7) + + labels_hour = [num_to_word(x) for x in range(0, 24)] + labels_minute_single = [num_to_word(x) for x in range(1, 10)] + labels_minute_double = [num_to_word(x) for x in range(10, 60)] + + graph_hour = pynini.union(*labels_hour) @ cardinal + + graph_minute_single = pynini.union(*labels_minute_single) @ cardinal + graph_minute_double = pynini.union(*labels_minute_double) @ cardinal + graph_minute_verbose = pynini.cross("半", "30") | pynini.cross( + "クォーター", "15" + ) # half, quarter + oclock = pynini.cross(pynini.union("時", "o' clock", "o clock", "o'clock", "oclock"), "") + + final_graph_hour = pynutil.insert('hours: "') + graph_hour + pynutil.insert('"') + graph_minute = ( + oclock + pynutil.insert("00") + | pynutil.delete(pynini.union("〇", "零")) + delete_space + graph_minute_single + | graph_minute_double + ) + final_suffix = ( + pynutil.insert('suffix: "') + convert_space(suffix_graph) + pynutil.insert('"') + ) + final_suffix = delete_space + insert_space + final_suffix + final_suffix_optional = pynini.closure(final_suffix, 0, 1) + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + # five o' clock + # two o eight, two thirty five (am/pm) + # two pm/am + graph_hm = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minute + + pynutil.insert('"') + ) + # 10 past four, quarter past four, half past four + graph_m_past_h = ( + pynutil.insert('minutes: "') + + pynini.union(graph_minute_single, graph_minute_double, graph_minute_verbose) + + pynutil.insert('"') + + delete_extra_space + + final_graph_hour + ) + + graph_quarter_time = ( + pynutil.insert('minutes: "') + + pynini.cross("クォーター", "45") # quarter + + pynutil.insert('"') + + delete_space + + pynutil.delete(pynini.union("から", "to", "till")) # to, till + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + ) + + graph_m_to_h_suffix_time = ( + pynutil.insert('minutes: "') + + ((graph_minute_single | graph_minute_double).optimize() @ minute_to_graph) + + pynutil.insert('"') + + pynini.closure( + delete_space + + pynutil.delete(pynini.union("分", "min", "mins", "minute", "minutes")), + 0, + 1, + ) + + delete_space + + pynutil.delete(pynini.union("から", "to", "till")) # to, till + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + + final_suffix + ) + + graph_h = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + (pynutil.insert("00") | graph_minute) + + pynutil.insert('"') + + final_suffix + + final_time_zone_optional + ) + final_graph = ( + (graph_hm | graph_m_past_h | graph_quarter_time) + + final_suffix_optional + + final_time_zone_optional + ) + final_graph |= graph_h + final_graph |= graph_m_to_h_suffix_time + + final_graph = self.add_tokens(final_graph.optimize()) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/ja/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..67bb0cd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/tokenize_and_classify.py @@ -0,0 +1,123 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.ja.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ja.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.ja.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.ja.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.ja.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.ja.taggers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.ja.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.ja.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.ja.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.ja.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.ja.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.ja.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.ja.taggers.word import WordFst +from fun_text_processing.inverse_text_normalization.ja.taggers.preprocessor import PreProcessor +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + GraphFst, + DAMO_SIGMA, + delete_extra_space, + delete_space, + generator_main, + insert_space, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__( + self, + cache_dir: str = None, + overwrite_cache: bool = False, + enable_standalone_number: bool = True, + enable_0_to_9: bool = True, + ): + super().__init__(name="tokenize_and_classify", kind="classify") + self.convert_number = enable_standalone_number + self.enable_0_to_9 = enable_0_to_9 + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_ja_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + cardinal = CardinalFst(self.convert_number, self.enable_0_to_9) + cardinal_graph = cardinal.fst + + fraction = FractionFst(cardinal) + fraction_graph = fraction.fst + + ordinal = OrdinalFst(cardinal) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst(ordinal=ordinal).fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + preprocessor = PreProcessor(halfwidth_to_fullwidth=True).fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst(cardinal).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.09) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + graph = token_plus_punct + pynini.closure( + pynini.union(insert_space, delete_extra_space) + token_plus_punct + ) + + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") + + self.token_plus_punct = token_plus_punct.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/ja/taggers/whitelist.py new file mode 100644 index 0000000..5bc0408 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ja.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/taggers/word.py b/fun_text_processing/inverse_text_normalization/ja/taggers/word.py new file mode 100644 index 0000000..3fc4915 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/taggers/word.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_NOT_SPACE, + GraphFst, + DAMO_CHAR, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + DAMO_NOT_SPACE + pynutil.insert('"') + + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/utils.py b/fun_text_processing/inverse_text_normalization/ja/utils.py new file mode 100644 index 0000000..38a95ba --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/utils.py @@ -0,0 +1,33 @@ +import os +from typing import Union + +import inflect + +_inflect = inflect.engine() + + +def num_to_word(x: Union[str, int]): + """ + converts integer to spoken representation + + Args + x: integer + + Returns: spoken representation + """ + if isinstance(x, int): + x = str(x) + x = _inflect.number_to_words(str(x)).replace("-", " ").replace(",", "") + return x + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/cardinal.py new file mode 100644 index 0000000..522692a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/cardinal.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + DAMO_CHAR, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + """ + + def __init__(self): + # enable_standalone_number: bool = True, + # enable_0_to_9: bool = True): + super().__init__(name="cardinal", kind="verbalize") + # self.enable_standalone_number = enable_standalone_number + # self.enable_0_to_9 = enable_0_to_9 + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + # if self.enable_standalone_number: + # if self.enable_0_to_9: + # else: + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/date.py new file mode 100644 index 0000000..87fcc13 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/date.py @@ -0,0 +1,70 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "january" day: "5" year: "2012" preserve_order: true } -> february 5 2012 + date { day: "5" month: "january" year: "2012" preserve_order: true } -> 5 february 2012 + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + + # month (day) year + graph_mdy = ( + month + + pynini.closure(delete_extra_space + day, 0, 1) + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + # (day) month year + graph_dmy = ( + pynini.closure(day + delete_extra_space, 0, 1) + + month + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = (graph_mdy | year | graph_dmy) + delete_space + optional_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/decimal.py new file mode 100644 index 0000000..cc69c0f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/decimal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/electronic.py new file mode 100644 index 0000000..7e674c5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/fraction.py new file mode 100644 index 0000000..c1bb028 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/fraction.py @@ -0,0 +1,47 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + DAMO_SIGMA, + delete_extra_space, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction, + e.g. fraction { numerator: "2" denominator: "3" } } -> 2/3 + e.g. fraction { numerator: "20" denominator: "3" negative: "true"} } -> 2/3 + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + numerator = ( + pynutil.delete('numerator: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + + denominator = ( + pynutil.insert("/") + + pynutil.delete('denominator: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = (numerator + delete_space + denominator).optimize() + + # numerator = pynutil.delete('numerator: "') + DAMO_NOT_QUOTE + pynutil.delete('"') + # + # denominator = ( + # pynutil.delete('denominator: "') + # + DAMO_NOT_QUOTE + # + pynutil.delete('"') + # ) + # + # graph = (numerator + pynutil.insert("/") + denominator).optimize() + + self.numbers = graph + delete_tokens = self.delete_tokens(optional_sign + graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/measure.py new file mode 100644 index 0000000..a9f6448 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/measure.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/money.py new file mode 100644 index 0000000..142008b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/money.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> $12.05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/ordinal.py new file mode 100644 index 0000000..0458859 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/ordinal.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" } -> 13th + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + # convert_rest = pynutil.insert("第", weight=0.01) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynutil.insert("第", weight=0.01) + # + DAMO_NOT_QUOTE + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + # convert_hundred = pynini.cross("第百", "第100") + # convert_eleven = pynini.cross("11", "十一") + # convert_twelve = pynini.cross("12", "十二") + # convert_thirteen = pynini.cross("13", "第十三") + # convert_one = pynini.cross("1", "第一") + # convert_two = pynini.cross("2", "第二") + # convert_three = pynini.cross("3", "第三") + + # suffix = pynini.cdrewrite( + # convert_hundred + # # convert_eleven + # # | convert_twelve + # # | convert_thirteen + # # | convert_one + # # | convert_two + # # | convert_three, + # "", + # "[EOS]", + # DAMO_SIGMA, + # ) + # graph = graph @ suffix + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/telephone.py new file mode 100644 index 0000000..ec28d5d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/telephone.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_country_code = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" "), + 0, + 1, + ) + delete_tokens = self.delete_tokens(optional_country_code + number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/time.py new file mode 100644 index 0000000..1b69664 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/time.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "12" minutes: "30" } -> 12:30 + time { hours: "1" minutes: "12" } -> 01:12 + time { hours: "2" suffix: "a.m." } -> 02:00 a.m. + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + suffix = ( + delete_space + + insert_space + + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + zone = ( + delete_space + + insert_space + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + graph = ( + hour @ add_leading_zero_to_double_digit + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + optional_suffix + + optional_zone + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/verbalize.py new file mode 100644 index 0000000..3a373e4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/verbalize.py @@ -0,0 +1,51 @@ +from fun_text_processing.inverse_text_normalization.ja.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.ja.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + fraction = FractionFst() + fraction_graph = fraction.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | fraction_graph + | measure_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/verbalize_final.py new file mode 100644 index 0000000..d16450f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.ja.verbalizers.word import WordFst +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/whitelist.py new file mode 100644 index 0000000..f0ba564 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ja/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/ja/verbalizers/word.py new file mode 100644 index 0000000..66f2bf1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ja/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ja.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/__init__.py b/fun_text_processing/inverse_text_normalization/ko/__init__.py new file mode 100644 index 0000000..e780245 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.ko.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.ko.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/ko/clean_eval_data.py b/fun_text_processing/inverse_text_normalization/ko/clean_eval_data.py new file mode 100644 index 0000000..e975bf5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/clean_eval_data.py @@ -0,0 +1,384 @@ +from argparse import ArgumentParser +from typing import List + +import regex as re +from fun_text_processing.text_normalization.data_loader_utils import ( + EOS_TYPE, + Instance, + load_files, + training_data_to_sentences, +) + + +""" +This file is for evaluation purposes. +filter_loaded_data() cleans data (list of instances) for inverse text normalization. Filters and cleaners can be specified for each semiotic class individually. +For example, normalized text should only include characters and whitespace characters but no punctuation. + Cardinal unnormalized instances should contain at least one integer and all other characters are removed. +""" + + +class Filter: + """ + Filter class + + Args: + class_type: semiotic class used in dataset + process_func: function to transform text + filter_func: function to filter text + + """ + + def __init__(self, class_type: str, process_func: object, filter_func: object): + self.class_type = class_type + self.process_func = process_func + self.filter_func = filter_func + + def filter(self, instance: Instance) -> bool: + """ + filter function + + Args: + filters given instance with filter function + + Returns: True if given instance fulfills criteria or does not belong to class type + """ + if instance.token_type != self.class_type: + return True + return self.filter_func(instance) + + def process(self, instance: Instance) -> Instance: + """ + process function + + Args: + processes given instance with process function + + Returns: processed instance if instance belongs to expected class type or original instance + """ + if instance.token_type != self.class_type: + return instance + return self.process_func(instance) + + +def filter_cardinal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_cardinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[^0-9]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_ordinal_1(instance: Instance) -> bool: + ok = re.search(r"(st|nd|rd|th)\s*$", instance.un_normalized) + return ok + + +def process_ordinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[,\s]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_decimal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_decimal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_measure_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_measure_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"m2", "m²", un_normalized) + un_normalized = re.sub(r"(\d)([^\d.\s])", r"\1 \2", un_normalized) + normalized = re.sub(r"[^a-z\s]", "", normalized) + normalized = re.sub(r"per ([a-z\s]*)s$", r"per \1", normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_money_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_money_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"a\$", r"$", un_normalized) + un_normalized = re.sub(r"us\$", r"$", un_normalized) + un_normalized = re.sub(r"(\d)m\s*$", r"\1 million", un_normalized) + un_normalized = re.sub(r"(\d)bn?\s*$", r"\1 billion", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_time_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_time_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r": ", ":", un_normalized) + un_normalized = re.sub(r"(\d)\s?a\s?m\s?", r"\1 a.m.", un_normalized) + un_normalized = re.sub(r"(\d)\s?p\s?m\s?", r"\1 p.m.", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_plain_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_plain_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_punct_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_punct_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_date_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_date_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_letters_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_letters_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_verbatim_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_verbatim_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_digit_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_digit_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_telephone_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_telephone_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_electronic_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_electronic_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_fraction_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_fraction_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_address_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_address_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +filters = [] +filters.append( + Filter(class_type="CARDINAL", process_func=process_cardinal_1, filter_func=filter_cardinal_1) +) +filters.append( + Filter(class_type="ORDINAL", process_func=process_ordinal_1, filter_func=filter_ordinal_1) +) +filters.append( + Filter(class_type="DECIMAL", process_func=process_decimal_1, filter_func=filter_decimal_1) +) +filters.append( + Filter(class_type="MEASURE", process_func=process_measure_1, filter_func=filter_measure_1) +) +filters.append(Filter(class_type="MONEY", process_func=process_money_1, filter_func=filter_money_1)) +filters.append(Filter(class_type="TIME", process_func=process_time_1, filter_func=filter_time_1)) + +filters.append(Filter(class_type="DATE", process_func=process_date_1, filter_func=filter_date_1)) +filters.append(Filter(class_type="PLAIN", process_func=process_plain_1, filter_func=filter_plain_1)) +filters.append(Filter(class_type="PUNCT", process_func=process_punct_1, filter_func=filter_punct_1)) +filters.append( + Filter(class_type="LETTERS", process_func=process_letters_1, filter_func=filter_letters_1) +) +filters.append( + Filter(class_type="VERBATIM", process_func=process_verbatim_1, filter_func=filter_verbatim_1) +) +filters.append(Filter(class_type="DIGIT", process_func=process_digit_1, filter_func=filter_digit_1)) +filters.append( + Filter(class_type="TELEPHONE", process_func=process_telephone_1, filter_func=filter_telephone_1) +) +filters.append( + Filter( + class_type="ELECTRONIC", process_func=process_electronic_1, filter_func=filter_electronic_1 + ) +) +filters.append( + Filter(class_type="FRACTION", process_func=process_fraction_1, filter_func=filter_fraction_1) +) +filters.append( + Filter(class_type="ADDRESS", process_func=process_address_1, filter_func=filter_address_1) +) +filters.append(Filter(class_type=EOS_TYPE, process_func=lambda x: x, filter_func=lambda x: True)) + + +def filter_loaded_data(data: List[Instance], verbose: bool = False) -> List[Instance]: + """ + Filters list of instances + + Args: + data: list of instances + + Returns: filtered and transformed list of instances + """ + updates_instances = [] + for instance in data: + updated_instance = False + for fil in filters: + if fil.class_type == instance.token_type and fil.filter(instance): + instance = fil.process(instance) + updated_instance = True + if updated_instance: + if verbose: + print(instance) + updates_instances.append(instance) + return updates_instances + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument( + "--input", help="input file path", type=str, default="./en_with_types/output-00001-of-00100" + ) + parser.add_argument("--verbose", help="print filtered instances", action="store_true") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + file_path = args.input + + print("Loading training data: " + file_path) + instance_list = load_files([file_path]) # List of instances + filtered_instance_list = filter_loaded_data(instance_list, args.verbose) + training_data_to_sentences(filtered_instance_list) diff --git a/fun_text_processing/inverse_text_normalization/ko/data/charactor.tsv b/fun_text_processing/inverse_text_normalization/ko/data/charactor.tsv new file mode 100644 index 0000000..dadd731 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/charactor.tsv @@ -0,0 +1,57 @@ +% 퍼센트 +# 파운드 += 등호 +@ 골뱅이 +≥ 보다 크거나 같음 +≤ 보다 작거나 같음 +≠ 부등호 +≈ 근삿값 +± 플러스마이너스 +× 곱셈기호 +Α 알파 +Β 베타 +Γ 감마 +Δ 델타 +Ε 엡실론 +Ζ 제타 +Θ 세타 +Ι 이오타 +Κ 카파 +∧ 람다 +Μ 뮤 +Ν 뉴 +Ξ 크시 +Ο 오미크론 +∏ 파이 +Ρ 로 +∑ 싱마 +Τ 타우 +Υ 입실론 +Φ 피 +Χ 키 +Ψ 프시 +Ω 오메가 +α 알파 +β 베타 +γ 감마 +δ 델타 +ε 엡실론 +ζ 제타 +η 에타 +θ 세타 +ι 이오타 +κ 카파 +λ 람다 +μ 뮤 +ν 뉴 +ξ 크시 +ο 오미크론 +π 파이 +ρ 로 +σ 싱마 +τ 타우 +υ 입실론 +φ 피 +χ 키 +ψ 프시 +ω 오메가 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/currency.tsv b/fun_text_processing/inverse_text_normalization/ko/data/currency.tsv new file mode 100644 index 0000000..08a0c12 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/currency.tsv @@ -0,0 +1,34 @@ +$ 달러 +$ 미국 달러 +$ 미국 달러 +£ 영국 파운드 +€ 유로 +₩ 원 +nzd 뉴질랜드 달러 +rs 루피 +chf 스위스 프랑 +dkk 덴마크 크로네 +fim 핀란드 마르카 +aed 아랍 에미리트 디르함 +¥ 엔 +czk 체코 코루나 +mro 모리타니 우기야 +pkr 파키스탄 루피 +crc 코스타리카 콜론 +hk$ 홍콩 달러 +npr 네팔 루피 +awg 아루반 플로린 +nok 노르웨이 크로네 +tzs 탄자니아 실링 +sek 스웨덴 크로나 +cyp 키프로스 파운드 +sar 사우디 리얄 +cve 케이프 베르데 에스쿠도 +rsd 세르비아 디나르 +dm 독일 마크 +shp 세인트 헬레나 파운드 +php 필리핀 페소 +cad 캐나다 달러 +ssp 남수단 파운드 +scr 세이셸 루피 +mvr 몰디브 루피야 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/day.tsv b/fun_text_processing/inverse_text_normalization/ko/data/day.tsv new file mode 100644 index 0000000..ef6d0e2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/day.tsv @@ -0,0 +1,31 @@ +일일 01 +이일 02 +삼일 03 +사일 04 +오일 05 +육일 06 +칠일 07 +팔일 08 +구일 09 +십일 10 +십일일 11 +십이일 12 +십삼일 13 +십사일 14 +십오일 15 +십육일 16 +십칠일 17 +십팔일 18 +십구일 19 +이십일 20 +이십일일 21 +이십이일 22 +이십삼일 23 +이십사일 24 +이십오일 25 +이십육일 26 +이십칠일 27 +이십팔일 28 +이십구일 29 +삼십일 30 +삼십일일 31 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/day_inherent.tsv b/fun_text_processing/inverse_text_normalization/ko/data/day_inherent.tsv new file mode 100644 index 0000000..fff6f06 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/day_inherent.tsv @@ -0,0 +1,17 @@ +하루 01 +이틀 02 +사흘 03 +나흘 04 +닷새 05 +엿새 06 +이레 07 +여드래 08 +아흐레 09 +열흘 10 +열하루 11 +열이틀 12 +열사흘 13 +스무날 20 +스무하루 21 +스무아흐레 29 +그믐 30 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/ko/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ko/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/ko/data/electronic/domain.tsv new file mode 100644 index 0000000..207a14a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/electronic/domain.tsv @@ -0,0 +1,10 @@ +com +uk +fr +net +br +in +ru +de +it +ai diff --git a/fun_text_processing/inverse_text_normalization/ko/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/ko/data/electronic/server_name.tsv new file mode 100644 index 0000000..ca7f97b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast +google diff --git a/fun_text_processing/inverse_text_normalization/ko/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/ko/data/electronic/symbols.tsv new file mode 100644 index 0000000..8fb04bd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/electronic/symbols.tsv @@ -0,0 +1,22 @@ +. 점 +- 대시 +- 하이픈 +_ 밑줄 +! 느낌표 +# 숫자 기호 +$ 달러 기호 +% 퍼센트 기호 +& 앰퍼샌드 +' 인용하다 +* 별표 ++ 플러스 +/ 슬래시 += 등호 +? 물음표 +^ 곡절 악센트 +` 오른쪽 작은따옴표 +{ 왼쪽 중괄호 +| 세로 막대 +} 오른쪽 중괄호 +~ 물결표 +, 반점 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/measurements.tsv b/fun_text_processing/inverse_text_normalization/ko/data/measurements.tsv new file mode 100644 index 0000000..bfb92e3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/measurements.tsv @@ -0,0 +1,90 @@ +μm 마이크로미터 +mm 밀리미터 +cm 센치미터 +km 킬로미터 +mm² 평방밀리미터 +cm² 평방센치미터 +dm² 평방데시미터 +m² 평방미터 +km² 평방킬로미터 +mm³ 세제곱 밀리미터 +cm³ 세제곱 센치미터 +dm³ 세제곱 데시미터 +m³ 세제곱 미터 +km³ 세제곱 킬로미터 +μg 마이크로그램 +mg 밀리그램 +kg 킬로그램 +msec 밀리초 +sec 초 +hr 시간 +m/s 미터매초 +km/h 킬로미터매시 +mph 마일시간 +bit/s 비트매초 +byte/s 바이트매초 +% 퍼센트 +° 도 +℃ 섭씨 +℉ 화씨 +kcal 킬로칼로리 +fl.oz 액량 온스 +F/m 파라미터 +g/l 그램매리터 +g/mL 그램매밀리미터 +hz 헤르츠 +khz 킬로헤르츠 +mhz 메가헤르츠 +ghz 기가헤르츠 +km/h 길로미터매시 +kw·h 킬로와트시 +ml 밀리리터 +mg/ml 밀리그램매밀리리터 +mg/l 밀리그램매리터 +mA 밀리 암페어 +mA⋅h 밀리 암페어시 +mol 몰 +Ω·m 옴표 +S/m 일미터당 일센스 +tsp 티스푼 +μA 마이크로 암페어 +Ω 오메가 +kPa 킬로파스칼 +mmHg 밀리미터 수은주 +Vol 볼륨 +cc 입방 센티미터 +rpm 분당 횟 수 +bpm 분당 박자 수 +px 픽셀 +V 볼트 +kV 킬로볼트 +ha 헥타르 +ac 에이커 +ct 캐럿 +L 리터 +gal 갤런 +mol 몰 +pa 파스칼 +mpa 메가파스칼 +mA 밀리암페어 +mAh 밀리암페어시 +in 인치 +ft 피트 +yd 야드 +nm 나노미터 +m 미터 +dm 데시미터 +g 그램 +KB 킬로바이트 +MB 메가바이트 +GB 기가바이트 +TB 테라바이트 +hp 마력 +db 데시벨 +J 줄 +kJ 킬로줄 +oz 온스 +kw 킬로와트 +min 분 +sec 초 +cal 칼로리 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/months.tsv b/fun_text_processing/inverse_text_normalization/ko/data/months.tsv new file mode 100644 index 0000000..34db0f4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/months.tsv @@ -0,0 +1,14 @@ +일월 01 +이월 02 +삼월 03 +사월 04 +오월 05 +육월 06 +유월 06 +칠월 07 +팔월 08 +구월 09 +십월 10 +시월 10 +십일월 11 +십이월 12 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/ko/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit.tsv new file mode 100644 index 0000000..9871cb9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit.tsv @@ -0,0 +1,9 @@ +일 1 +이 2 +삼 3 +사 4 +오 5 +육 6 +칠 7 +팔 8 +구 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_digit.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_digit.tsv new file mode 100644 index 0000000..abd05b9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_digit.tsv @@ -0,0 +1,9 @@ +하나 1 +둘 2 +셋 3 +넷 4 +다섯 5 +여섯 6 +일곱 7 +여덟 8 +아홉 9 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_others.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_others.tsv new file mode 100644 index 0000000..b347950 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_others.tsv @@ -0,0 +1,7 @@ +여든아홉 89 +예순셋 63 +쉰여덟 58 +서른다섯 35 +스물일곱 27 +열둘 27 +열하나 11 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_teens.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_teens.tsv new file mode 100644 index 0000000..80e059f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_teens.tsv @@ -0,0 +1,9 @@ +열 10 +스물 20 +서른 30 +마흔 40 +쉰 50 +예순 60 +일흔 70 +여든 80 +아흔 90 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_teens_without_zero.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_teens_without_zero.tsv new file mode 100644 index 0000000..f8ce81b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_inherent_teens_without_zero.tsv @@ -0,0 +1,9 @@ +열 1 +스물 2 +서른 3 +마흔 4 +쉰 5 +예순 6 +일흔 7 +여든 8 +아흔 9 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_teens.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_teens.tsv new file mode 100644 index 0000000..d62b5a9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_teens.tsv @@ -0,0 +1,9 @@ +십 10 +이십 20 +삼십 30 +사십 40 +오십 50 +육십 60 +칠십 70 +팔십 80 +구십 90 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_teens_without_zero.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_teens_without_zero.tsv new file mode 100644 index 0000000..f31bab1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/digit_teens_without_zero.tsv @@ -0,0 +1,9 @@ +십 1 +이십 2 +삼십 3 +사십 4 +오십 5 +육십 6 +칠십 7 +팔십 8 +구십 9 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/dot.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/dot.tsv new file mode 100644 index 0000000..9f2da9f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/dot.tsv @@ -0,0 +1 @@ +점 . diff --git a/fun_text_processing/inverse_text_normalization/ko/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/ko/data/numbers/zero.tsv new file mode 100644 index 0000000..091fd88 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/numbers/zero.tsv @@ -0,0 +1 @@ +영 0 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/ko/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ko/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/ko/data/ordinals/digit.tsv new file mode 100644 index 0000000..4b7fc24 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/ordinals/digit.tsv @@ -0,0 +1,9 @@ +first one +second two +third three +fourth four +fifth five +sixth sixth +seventh seven +eighth eight +ninth nine \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/ordinals/teen.tsv b/fun_text_processing/inverse_text_normalization/ko/data/ordinals/teen.tsv new file mode 100644 index 0000000..496fefc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/ordinals/teen.tsv @@ -0,0 +1 @@ +twelfth twelve \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/suppletive.tsv b/fun_text_processing/inverse_text_normalization/ko/data/suppletive.tsv new file mode 100644 index 0000000..115460a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/suppletive.tsv @@ -0,0 +1,83 @@ +deer +fish +sheep +foot feet +goose geese +man men +mouse mice +tooth teeth +woman women +won +child children +ox oxen +wife wives +wolf wolves +analysis analyses +criterion criteria +lbs +focus foci +percent +hertz +kroner krone +inch inches +calory calories +yen +megahertz +gigahertz +kilohertz +hertz +CC +c c +horsepower +hundredweight +kilogram force kilograms force +mega siemens +revolution per minute revolutions per minute +mile per hour miles per hour +megabit per second megabits per second +square foot square feet +kilobit per second kilobits per second +degree Celsius degrees Celsius +degree Fahrenheit degrees Fahrenheit +ATM +AU +BQ +CC +CD +DA +EB +EV +F +GB +G +GL +GPA +GY +HA +H +HL +GP +HS +KB +KL +KN +KT +KV +LM +MA +MA +MB +MC +MF +M +MM +MS +MV +MW +PB +PG +PS +S +TB +YB +ZB \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/ko/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/hours.tsv b/fun_text_processing/inverse_text_normalization/ko/data/time/hours.tsv new file mode 100644 index 0000000..51441f6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/hours.tsv @@ -0,0 +1,12 @@ +한시 01 +두시 02 +세시 03 +네시 04 +다섯시 05 +여섯시 06 +일곱시 07 +여덟시 08 +아홉시 09 +열시 10 +열한시 11 +열두시 12 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/minute_to.tsv b/fun_text_processing/inverse_text_normalization/ko/data/time/minute_to.tsv new file mode 100644 index 0000000..edab4d5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/minute_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/minutes.tsv b/fun_text_processing/inverse_text_normalization/ko/data/time/minutes.tsv new file mode 100644 index 0000000..63b3ec0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/minutes.tsv @@ -0,0 +1,59 @@ +일분 01 +이분 02 +삼분 03 +사분 04 +오분 05 +육분 06 +칠분 07 +팔분 08 +구분 09 +십분 10 +십일분 11 +십이분 12 +십삼분 13 +십사분 14 +십오분 15 +십육분 16 +십칠분 17 +십팔분 18 +십구분 19 +이십분 20 +이십일분 21 +이십이분 22 +이십삼분 23 +이십사분 24 +이십오분 25 +이십육분 26 +이십칠분 27 +이십팔분 28 +이십구분 29 +삼십분 30 +삼십일분 31 +삼십이분 32 +삼십삼분 33 +삼십사분 34 +삼십오분 35 +삼십육분 36 +삼십칠분 37 +삼십팔분 38 +삼십구분 39 +사십분 40 +사십일분 41 +사십이분 42 +사십삼분 43 +사십사분 44 +사십오분 45 +사십육분 46 +사십칠분 47 +사십팔분 48 +사십구분 49 +오십분 50 +오십일분 51 +오십이분 52 +오십삼분 53 +오십사분 54 +오십오분 55 +오십육분 56 +오십칠분 57 +오십팔분 58 +오십구분 59 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/seconds.tsv b/fun_text_processing/inverse_text_normalization/ko/data/time/seconds.tsv new file mode 100644 index 0000000..f731e5b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/seconds.tsv @@ -0,0 +1,59 @@ +일초 01 +이초 02 +삼초 03 +사초 04 +오초 05 +육초 06 +칠초 07 +팔초 08 +구초 09 +십초 10 +십일초 11 +십이초 12 +십삼초 13 +십사초 14 +십오초 15 +십육초 16 +십칠초 17 +십팔초 18 +십구초 19 +이십초 20 +이십일초 21 +이십이초 22 +이십삼초 23 +이십사초 24 +이십오초 25 +이십육초 26 +이십칠초 27 +이십팔초 28 +이십구초 29 +삼십초 30 +삼십일초 31 +삼십이초 32 +삼십삼초 33 +삼십사초 34 +삼십오초 35 +삼십육초 36 +삼십칠초 37 +삼십팔초 38 +삼십구초 39 +사십초 40 +사십일초 41 +사십이초 42 +사십삼초 43 +사십사초 44 +사십오초 45 +사십육초 46 +사십칠초 47 +사십팔초 48 +사십구초 49 +오십초 50 +오십일초 51 +오십이초 52 +오십삼초 53 +오십사초 54 +오십오초 55 +오십육초 56 +오십칠초 57 +오십팔초 58 +오십구초 59 diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/time_suffix.tsv b/fun_text_processing/inverse_text_normalization/ko/data/time/time_suffix.tsv new file mode 100644 index 0000000..b39a9ef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/time_suffix.tsv @@ -0,0 +1,8 @@ +p m p.m. +pm p.m. +p.m. +p.m p.m. +am a.m. +a.m. +a.m a.m. +a m a.m. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/time_zone.tsv b/fun_text_processing/inverse_text_normalization/ko/data/time/time_zone.tsv new file mode 100644 index 0000000..3e0ade4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t diff --git a/fun_text_processing/inverse_text_normalization/ko/data/time/to_hour.tsv b/fun_text_processing/inverse_text_normalization/ko/data/time/to_hour.tsv new file mode 100644 index 0000000..1b006ea --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/time/to_hour.tsv @@ -0,0 +1,12 @@ +one 12 +two 1 +three 2 +four 3 +five 4 +six 5 +seven 6 +eigh 7 +nine 8 +ten 9 +eleven 10 +twelve 11 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/ko/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/ko/data/whitelist.tsv new file mode 100644 index 0000000..7eed41e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/data/whitelist.tsv @@ -0,0 +1,12 @@ +e.g. for example +dr. doctor +mr. mister +mrs. misses +st. saint +7-eleven seven eleven +es3 e s three +s&p s and p +ASAP a s a p +AT&T a t and t +LLP l l p +ATM a t m diff --git a/fun_text_processing/inverse_text_normalization/ko/graph_utils.py b/fun_text_processing/inverse_text_normalization/ko/graph_utils.py new file mode 100644 index 0000000..3091083 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/graph_utils.py @@ -0,0 +1,209 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from pynini import Far +from pynini.examples import plurals +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +delete_zero_or_one_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE, 0, 1)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") +delete_preserve_order = pynini.closure( + pynutil.delete(" preserve_order: true") + | (pynutil.delete(' field_order: "') + DAMO_NOT_QUOTE + pynutil.delete('"')) +) + +suppletive = pynini.string_file(get_abs_path("data/suppletive.tsv")) +# _v = pynini.union("a", "e", "i", "o", "u") +_c = pynini.union( + "b", + "c", + "d", + "f", + "g", + "h", + "j", + "k", + "l", + "m", + "n", + "p", + "q", + "r", + "s", + "t", + "v", + "w", + "x", + "y", + "z", +) +_ies = DAMO_SIGMA + _c + pynini.cross("y", "ies") +_es = DAMO_SIGMA + pynini.union("s", "sh", "ch", "x", "z") + pynutil.insert("es") +_s = DAMO_SIGMA + pynutil.insert("s") + +graph_plural = plurals._priority_union( + suppletive, + plurals._priority_union(_ies, plurals._priority_union(_es, _s, DAMO_SIGMA), DAMO_SIGMA), + DAMO_SIGMA, +).optimize() + +SINGULAR_TO_PLURAL = graph_plural +PLURAL_TO_SINGULAR = pynini.invert(graph_plural) +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) +MIN_NEG_WEIGHT = -0.0001 +MIN_POS_WEIGHT = 0.0001 + + +def generator_main(file_name: str, graphs: Dict[str, "pynini.FstLike"]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def get_plurals(fst): + """ + Given singular returns plurals + + Args: + fst: Fst + + Returns plurals to given singular forms + """ + return SINGULAR_TO_PLURAL @ fst + + +def get_singulars(fst): + """ + Given plural returns singulars + + Args: + fst: Fst + + Returns singulars to given plural forms + """ + return PLURAL_TO_SINGULAR @ fst + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + + Args: + fst: input fst + + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/.cardinal.py.swo b/fun_text_processing/inverse_text_normalization/ko/taggers/.cardinal.py.swo new file mode 100644 index 0000000..af311d4 Binary files /dev/null and b/fun_text_processing/inverse_text_normalization/ko/taggers/.cardinal.py.swo differ diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/ko/taggers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/ko/taggers/cardinal.py new file mode 100644 index 0000000..6f21d15 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/cardinal.py @@ -0,0 +1,142 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_ALPHA, + DAMO_SIGMA, + DAMO_DIGIT, + DAMO_SPACE, + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. minus twenty three -> cardinal { integer: "23" negative: "-" } } + Numbers below thirteen are not converted. + """ + + def __init__(self): + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_teens_without_zero = pynini.string_file( + get_abs_path("data/numbers/digit_teens_without_zero.tsv") + ) + graph_teens = pynini.string_file(get_abs_path("data/numbers/digit_teens.tsv")) + + graph_inh_digit = pynini.string_file(get_abs_path("data/numbers/digit_inherent_digit.tsv")) + graph_inh_teen_without_zero = pynini.string_file( + get_abs_path("data/numbers/digit_inherent_teens_without_zero.tsv") + ) + graph_inh_teen = pynini.string_file(get_abs_path("data/numbers/digit_inherent_teens.tsv")) + graph_inh_teen_others = pynini.string_file( + get_abs_path("data/numbers/digit_inherent_others.tsv") + ) + + graph_less_hundred_num_inh_p1 = graph_inh_teen_without_zero + graph_inh_digit + graph_less_hundred_num_inh = pynini.union( + graph_inh_teen, graph_less_hundred_num_inh_p1, graph_inh_teen_others + ) + + graph_less_hundred_num_p1 = graph_teens_without_zero + graph_digit + graph_less_hundred_num = pynini.union(graph_less_hundred_num_p1, graph_teens) + + # digits + addzero = pynutil.insert("0") + zero = graph_zero + digits_combine = graph_digit | graph_inh_digit | zero + digits = graph_digit | zero + digit = graph_digit + + # teens + teens_combine = graph_less_hundred_num | graph_less_hundred_num_inh + # teens = graph_less_hundred_num + teens = teens_combine + + # hundred, #백 单位 百 + hundred = ( + digit + + pynutil.delete("백") + + ( + teens + | pynutil.add_weight(zero + digit, 0.1) + | pynutil.add_weight(digit + addzero, 0.5) + | pynutil.add_weight(addzero**2, 1.0) + ) + ) + + graph_hundred_component_at_least_one_none_zero_digit = hundred @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) + + ##thousand 천 千单位 + thousand = ( + (hundred | teens | digits) + + pynutil.delete("천") + + ( + hundred + | pynutil.add_weight(zero + teens, 0.1) + | pynutil.add_weight(addzero + zero + digit, 0.5) + | pynutil.add_weight(digit + addzero**2, 0.8) + | pynutil.add_weight(addzero**3, 1.0) + ) + ) + + ##만 单位万 + ten_thousand = ( + (thousand | hundred | teens | digits) + + pynutil.delete("만") + + pynini.cross(" ", "").ques + + ( + thousand + | pynutil.add_weight(zero + hundred, 0.1) + | pynutil.add_weight(addzero + zero + teens, 0.5) + | pynutil.add_weight(addzero + addzero + zero + digit, 0.5) + | pynutil.add_weight(digit + addzero**3, 0.8) + | pynutil.add_weight(addzero**4, 1.0) + ) + ) + + ##조, 单位兆, 억, 单位亿 + number = digits | teens | hundred | thousand | ten_thousand + + ## ques is equal to pynini.closure(, 0, 1) + number = ( + (number + pynini.accep("조").ques + pynini.cross(" ", "").ques).ques + + (number + pynini.accep("억").ques + pynini.cross(" ", "").ques).ques + + number + ) + + graph = ( + number + | graph_less_hundred_num_inh + | graph_inh_digit + | graph_inh_teen + | graph_inh_teen_others + ) + # labels_exception = [num_to_word(x) for x in range(0, 13)] + labels_exception = ["zzzzzzzzz"] + graph_exception = pynini.union(*labels_exception) + + self.graph_no_exception = graph + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("마이너스", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/date.py b/fun_text_processing/inverse_text_normalization/ko/taggers/date.py new file mode 100644 index 0000000..870bfaa --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/date.py @@ -0,0 +1,95 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + +graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")).optimize() +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize() +graph_digit_inh = pynini.string_file( + get_abs_path("data/numbers/digit_inherent_digit.tsv") +).optimize() + + +def _get_month_graph(): + """ + Transducer for month, e.g. march -> march + """ + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + # print(month_graph) + return month_graph + + +def _get_day_graph(): + """ + Transducer for month, e.g. march -> march + """ + day_graph_num = pynini.string_file(get_abs_path("data/day.tsv")) + day_graph_inh = pynini.string_file(get_abs_path("data/day_inherent.tsv")) + day_graph = pynini.union(day_graph_num, day_graph_inh) + # print(day_graph) + return day_graph + + +def _get_year_graph(): + """ + Transducer for year, e.g. twenty twenty -> 2020 + """ + digit = graph_digit | graph_digit_inh + zero = graph_zero + year_graph_4num = digit + (digit | zero) ** 3 + year_graph_2num = digit**2 + + year_graph = pynini.union(year_graph_4num, year_graph_2num) + return year_graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. january fifth twenty twelve -> date { month: "january" day: "5" year: "2012" preserve_order: true } + e.g. the fifth of january twenty twelve -> date { day: "5" month: "january" year: "2012" preserve_order: true } + e.g. twenty twenty -> date { year: "2012" preserve_order: true } + Args: + ordinal: OrdinalFst + """ + + def __init__(self): + super().__init__(name="date", kind="classify") + + year_graph = _get_year_graph() + pynini.accep("년") + YEAR_WEIGHT = 0.001 + year_graph = ( + pynutil.insert('year: "') + + pynutil.add_weight(year_graph, YEAR_WEIGHT) + + pynutil.insert('"') + ) + # year_graph_space = pynutil.insert("year: \"") + pynutil.add_weight(year_graph, YEAR_WEIGHT) + pynutil.insert("\"") + pynutil.insert(" ") + # year_graph = pynutil.insert("year: \"") + year_graph + pynutil.insert("\"") + + MONTH_WEIGHT = -0.001 + month_graph = _get_month_graph() + pynini.cross("", "월") + # month_graph = pynutil.insert("month: \"") + pynutil.add_weight(month_graph, MONTH_WEIGHT) + pynutil.insert("\"") + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + # month_graph_space = pynutil.insert("month: \"") + month_graph + pynutil.insert("\"") + pynutil.insert(" ") + + day_graph = _get_day_graph() + pynini.cross("", "일") + DAY_WEIGHT = -0.7 + # day_graph = pynutil.insert("day: \"") + pynutil.add_weight(day_graph, DAY_WEIGHT) + pynutil.insert("\"") + day_graph = pynutil.insert('day: "') + day_graph + pynutil.insert('"') + # day_graph_space = pynutil.insert("day: \"") + day_graph + pynutil.insert("\"") + pynutil.insert(" ") + + graph_ymd = year_graph + delete_space + month_graph + delete_space + day_graph + graph_md = month_graph + delete_space + day_graph + graph_ym = year_graph + delete_space + month_graph + + final_graph = graph_ymd | graph_md | graph_ym | year_graph | month_graph | day_graph + + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/ko/taggers/decimal.py new file mode 100644 index 0000000..9cbecd1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/decimal.py @@ -0,0 +1,101 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + numbers = cardinal_up_to_hundred @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + # "만", "백만", "천만", "억", "조", 万、百万、千万、亿、兆 + # 천 千 + suffix = pynini.union("만", "백만", "천만", "억", "조") + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + + delete_extra_space + + pynutil.insert('quantity: "') + + (suffix | "천") + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. minus twelve point five o o six billion -> decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } + e.g. one billion -> decimal { integer_part: "1" quantity: "billion" } + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_decimal = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_decimal |= pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + + graph_decimal = pynini.closure(graph_decimal) + self.graph = graph_decimal + + ##마이너스 负 + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("마이너스", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + + # 점 点 + graph_integer = ( + pynutil.insert('integer_part: "') + + cardinal_graph + + pynutil.delete("점") + + pynutil.insert('"') + ) + + final_graph_wo_sign = graph_integer + pynini.cross(" ", " ") + graph_fractional + + final_graph = optional_graph_negative + delete_space + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/ko/taggers/electronic.py new file mode 100644 index 0000000..f65e717 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/electronic.py @@ -0,0 +1,100 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_ALPHA, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. c d f one at a b c dot e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("점", ".") + username = ( + alpha_num + pynini.closure(delete_extra_space + accepted_username) + ) | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + username = pynutil.insert('username: "') + username + pynutil.insert('"') + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete("에서") + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("w w w", "www"), "www") + protocol_start = ( + pynini.cross("h t t p", "http") | pynini.cross("h t t p s", "https") + ) + pynini.cross(" 콜론 슬래시 슬래시 ", "://") + # .com, + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + ( + domain + | pynini.closure( + accepted_username + delete_extra_space, + ) + + accepted_username + ) + ) + + protocol_default = ( + ( + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + ) + + pynini.closure(ending, 1) + ).optimize() + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + protocol_default + ).optimize() + + protocol |= ( + pynini.closure(protocol_end + delete_extra_space + process_dot, 0, 1) + protocol_default + ) + + protocol = pynutil.insert('protocol: "') + protocol.optimize() + pynutil.insert('"') + graph |= protocol + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/ko/taggers/fraction.py new file mode 100644 index 0000000..b57aed5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/fraction.py @@ -0,0 +1,53 @@ +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + convert_space, + delete_space, + delete_extra_space, + DAMO_SIGMA, + DAMO_CHAR, + DAMO_SPACE, +) +import pynini +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="fraction", kind="classify") + # integer_part # numerator # denominator + + graph_cardinal = cardinal.graph_no_exception + + # without the integerate part + # 分子 + numerator = pynutil.insert('numerator: "') + graph_cardinal + pynutil.insert('"') + # 分母 + denominator = ( + pynutil.insert('denominator: "') + + graph_cardinal + + pynutil.delete("분의") + + pynutil.insert('"') + ) + + ## + graph_fraction_component = denominator + pynini.cross(" ", " ") + numerator + + self.graph_fraction_component = graph_fraction_component + + graph = graph_fraction_component + graph = graph.optimize() + self.final_graph_wo_negative = graph + + ##负 + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("마이너스", '"true"') + DAMO_SPACE, 0, 1 + ) + + graph = optional_graph_negative + graph + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/measure.py b/fun_text_processing/inverse_text_normalization/ko/taggers/measure.py new file mode 100644 index 0000000..9e9ace5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/measure.py @@ -0,0 +1,64 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. minus twelve kilograms -> measure { negative: "true" cardinal { integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + decimal_graph = decimal.final_graph_wo_negative + + unit_graph = pynini.string_file(get_abs_path("data/measurements.tsv")) + + graph_unit = pynini.invert(unit_graph) # singular -> abbr + + ## 마이너 负 + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("마이너", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_units = pynutil.insert('units: "') + graph_unit + pynutil.insert('"') + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal_graph + + pynutil.insert(" }") + + delete_extra_space + + graph_units + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + cardinal_graph + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + graph_units + ) + + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/money.py b/fun_text_processing/inverse_text_normalization/ko/taggers/money.py new file mode 100644 index 0000000..9f1bad9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/money.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. twelve dollars and five cents -> money { integer_part: "12" fractional_part: 05 currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + decimal_graph = decimal.final_graph_wo_negative + + unit = pynini.string_file(get_abs_path("data/currency.tsv")).invert() + + graph_unit = pynutil.insert('currency: "') + unit + pynutil.insert('"') + + graph_integer = ( + pynutil.insert('integer_part: "') + + cardinal_graph + + pynutil.insert('"') + + delete_extra_space + + graph_unit + ) + + graph_decimal = decimal_graph + pynutil.insert(" ") + graph_unit + + final_graph = graph_integer | graph_decimal + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/ko/taggers/punctuation.py new file mode 100644 index 0000000..1edb9ac --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = ",.?" # here, we only support three type of punctuation + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/ko/taggers/telephone.py new file mode 100644 index 0000000..4a8343c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/telephone.py @@ -0,0 +1,79 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_ALNUM, + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +def get_serial_number(cardinal): + """ + any alphanumerical character sequence with at least one number with length greater equal to 3 + """ + digit = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT) + character = digit | DAMO_ALPHA + sequence = character + pynini.closure(pynutil.delete(" ") + character, 2) + sequence = sequence @ (pynini.closure(DAMO_ALNUM) + DAMO_DIGIT + pynini.closure(DAMO_ALNUM)) + return sequence.optimize() + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + one two three one two three five six seven eight -> { number_part: "123-123-5678" } + + This class also support card number and IP format. + "one two three dot one double three dot o dot four o" -> { number_part: "123.133.0.40"} + + "three two double seven three two one four three two one four three double zero five" -> + { number_part: 3277 3214 3214 3005} + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="telephone", kind="classify") + # country code, number_part, extension + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_dot = pynini.string_file(get_abs_path("data/numbers/dot.tsv")) + + graph_digits = graph_digit | graph_zero + + phone_number_graph = graph_digits**9 | graph_digits**10 | graph_digits**11 + + country_code = ( + pynutil.insert('country_code: "') + + pynini.closure(pynini.cross("더한", "+"), 0, 1) + + (pynini.closure(graph_digits, 0, 2) + graph_digits) + + pynutil.insert('"') + ) + + optional_country_code = pynini.closure( + country_code + pynutil.delete(" ") + insert_space, 0, 1 + ).optimize() + + grpah_phone_number = ( + pynutil.insert('number_part: "') + phone_number_graph + pynutil.insert('"') + ) + + graph = optional_country_code + grpah_phone_number + + # ip + ip_graph = graph_digit.plus + (graph_dot + graph_digits.plus).plus + + graph |= pynutil.insert('number_part: "') + ip_graph.optimize() + pynutil.insert('"') + graph |= ( + pynutil.insert('number_part: "') + + pynutil.add_weight(get_serial_number(cardinal=cardinal), weight=0.0001) + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/time.py b/fun_text_processing/inverse_text_normalization/ko/taggers/time.py new file mode 100644 index 0000000..f814ca5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/time.py @@ -0,0 +1,96 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path, num_to_word +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. twelve thirty -> time { hours: "12" minutes: "30" } + e.g. twelve past one -> time { minutes: "12" hours: "1" } + e.g. two o clock a m -> time { hours: "2" suffix: "a.m." } + e.g. quarter to two -> time { hours: "1" minutes: "45" } + e.g. quarter past two -> time { hours: "2" minutes: "15" } + e.g. half past two -> time { hours: "2" minutes: "30" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + suffix_graph = pynini.string_file(get_abs_path("data/time/time_suffix.tsv")) + time_zone_graph = pynini.invert(pynini.string_file(get_abs_path("data/time/time_zone.tsv"))) + + hour_graph = pynini.string_file(get_abs_path("data/time/hours.tsv")) + minute_graph = pynini.string_file(get_abs_path("data/time/minutes.tsv")) + second_graph = pynini.string_file(get_abs_path("data/time/seconds.tsv")) + + # only used for < 1000 thousand -> 0 weight + # cardinal = pynutil.add_weight(CardinalFst().graph_no_exception, weight=-0.7) + + graph_hour = hour_graph + graph_minute = minute_graph + graph_second = second_graph + + final_graph_hour = pynutil.insert('hours: "') + graph_hour + pynutil.insert('"') + + final_suffix = ( + pynutil.insert('suffix: "') + convert_space(suffix_graph) + pynutil.insert('"') + ) + final_suffix = delete_space + insert_space + final_suffix + final_suffix_optional = pynini.closure(final_suffix, 0, 1) + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_hm = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minute + + pynutil.insert('"') + ) + + graph_hms = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minute + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('seconds: "') + + graph_second + + pynutil.insert('"') + ) + + graph_h = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + (pynutil.insert("00") | graph_minute) + + pynutil.insert('"') + + final_suffix + + final_time_zone_optional + ) + + final_graph = (graph_hm | graph_hms) + final_suffix_optional + final_time_zone_optional + + final_graph |= graph_h + + final_graph = self.add_tokens(final_graph.optimize()) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/ko/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..015321c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/tokenize_and_classify.py @@ -0,0 +1,102 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.ko.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ko.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.ko.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.ko.taggers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.ko.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.ko.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.ko.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.ko.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.ko.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.ko.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.ko.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.ko.taggers.word import WordFst +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_ko_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + fraction = FractionFst(cardinal) + fraction_graph = fraction.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst().fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst(cardinal).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/ko/taggers/whitelist.py new file mode 100644 index 0000000..97733ae --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.ko.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/taggers/word.py b/fun_text_processing/inverse_text_normalization/ko/taggers/word.py new file mode 100644 index 0000000..5fa7a9e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/utils.py b/fun_text_processing/inverse_text_normalization/ko/utils.py new file mode 100644 index 0000000..c073d63 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/utils.py @@ -0,0 +1,64 @@ +import csv +import os +from typing import Union + +import inflect + +_inflect = inflect.engine() + + +def num_to_word(x: Union[str, int]): + """ + converts integer to spoken representation + Args + x: integer + Returns: spoken representation + """ + if isinstance(x, int): + x = str(x) + x = _inflect.number_to_words(str(x)).replace("-", " ").replace(",", "") + return x + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path + + +def load_labels(abs_path): + """ + loads relative path file as dictionary + + Args: + abs_path: absolute path + + Returns dictionary of mappings + """ + label_tsv = open(abs_path, encoding="utf-8") + labels = list(csv.reader(label_tsv, delimiter="\t")) + return labels + + +def augment_labels_with_punct_at_end(labels): + """ + augments labels: if key ends on a punctuation that value does not have, add a new label + where the value maintains the punctuation + + Args: + labels : input labels + Returns: + additional labels + """ + res = [] + for label in labels: + if len(label) > 1: + if label[0][-1] == "." and label[1][-1] != ".": + res.append([label[0], label[1] + "."] + label[2:]) + return res diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/cardinal.py new file mode 100644 index 0000000..4acadc6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/date.py new file mode 100644 index 0000000..cd9ab10 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/date.py @@ -0,0 +1,86 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "january" day: "5" year: "2012" preserve_order: true } -> february 5 2012 + date { day: "5" month: "january" year: "2012" preserve_order: true } -> 5 february 2012 + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynutil.insert(" ") + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynutil.insert(" ") + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynutil.insert(" ") + ) + + # month (day) year + graph_mdy = ( + month + + pynini.closure(delete_extra_space + day, 0, 1) + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + # (day) month year + graph_dmy = ( + pynini.closure(day + delete_extra_space, 0, 1) + + month + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + # year month day + graph_ymd = year + month + day + + # month day + graph_md = month + day + + # year month + graph_ym = year + month + + # add some grammars + final_graph = ( + (graph_mdy | year | graph_dmy | graph_ymd | graph_md | graph_ym | month | day) + + delete_space + + optional_preserve_order + ) + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/decimal.py new file mode 100644 index 0000000..e9ee603 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/decimal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/electronic.py new file mode 100644 index 0000000..4acfe3f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/fraction.py new file mode 100644 index 0000000..5dd7cdc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/fraction.py @@ -0,0 +1,41 @@ +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) + +import pynini +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction, + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + numerator = ( + pynutil.delete("numerator:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + denominator = ( + pynutil.delete("denominator:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = ( + optional_sign + numerator + delete_space + pynutil.insert("/") + denominator + ).optimize() + self.numbers = graph + delete_tokens = self.delete_tokens(optional_sign + graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/measure.py new file mode 100644 index 0000000..2dd25f7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/measure.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + pynutil.insert(" ") + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/money.py new file mode 100644 index 0000000..572cc11 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/money.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> $12.05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/ordinal.py new file mode 100644 index 0000000..f6c9de5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/ordinal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" } -> 13th + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + convert_eleven = pynini.cross("11", "11th") + convert_twelve = pynini.cross("12", "12th") + convert_thirteen = pynini.cross("13", "13th") + convert_one = pynini.cross("1", "1st") + convert_two = pynini.cross("2", "2nd") + convert_three = pynini.cross("3", "3rd") + convert_rest = pynutil.insert("th", weight=0.01) + + suffix = pynini.cdrewrite( + convert_eleven + | convert_twelve + | convert_thirteen + | convert_one + | convert_two + | convert_three + | convert_rest, + "", + "[EOS]", + DAMO_SIGMA, + ) + graph = graph @ suffix + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/telephone.py new file mode 100644 index 0000000..e0c475a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/telephone.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_country_code = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" "), + 0, + 1, + ) + delete_tokens = self.delete_tokens(optional_country_code + number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/time.py new file mode 100644 index 0000000..26bbc26 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/time.py @@ -0,0 +1,92 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "12" minutes: "30" } -> 12:30 + time { hours: "1" minutes: "12" } -> 01:12 + time { hours: "2" suffix: "a.m." } -> 02:00 a.m. + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + # hour + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + # minute + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + # seconds + second = ( + pynutil.delete("seconds:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + + suffix = ( + delete_space + + insert_space + + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + zone = ( + delete_space + + insert_space + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + + # hms + graph_hms = ( + (hour @ add_leading_zero_to_double_digit) + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + delete_space + + pynutil.insert(":") + + second + ) + # hm + graph_hm = ( + (hour @ add_leading_zero_to_double_digit) + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + ) + + graph = (graph_hms | graph_hm) + optional_suffix + optional_zone + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/verbalize.py new file mode 100644 index 0000000..91960d8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/verbalize.py @@ -0,0 +1,51 @@ +from fun_text_processing.inverse_text_normalization.ko.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.ko.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + fraction = FractionFst() + fraction_graph = fraction.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | decimal_graph + | fraction_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/verbalize_final.py new file mode 100644 index 0000000..cc67060 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.ko.verbalizers.word import WordFst +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/whitelist.py new file mode 100644 index 0000000..654ef2e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ko/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/ko/verbalizers/word.py new file mode 100644 index 0000000..3243520 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ko/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.ko.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/__init__.py b/fun_text_processing/inverse_text_normalization/pt/__init__.py new file mode 100644 index 0000000..427ceec --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.pt.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.pt.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/pt/data/__init__.py b/fun_text_processing/inverse_text_normalization/pt/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/pt/data/currency_plural.tsv b/fun_text_processing/inverse_text_normalization/pt/data/currency_plural.tsv new file mode 100644 index 0000000..a89a763 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/currency_plural.tsv @@ -0,0 +1,5 @@ +€ euros +£ libras esterlinas +US$ dólares americanos +$ dólares +R$ reais \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/currency_singular.tsv b/fun_text_processing/inverse_text_normalization/pt/data/currency_singular.tsv new file mode 100644 index 0000000..9ec77dc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/currency_singular.tsv @@ -0,0 +1,5 @@ +€ euro +£ libra esterlina +US$ dólar americano +$ dólar +R$ real \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/pt/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/pt/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/pt/data/electronic/domain.tsv new file mode 100644 index 0000000..ea547b8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/electronic/domain.tsv @@ -0,0 +1,26 @@ +com +es +uk +fr +net +br +in +ru +de +it +edu +co +ar +bo +cl +co +ec +fk +gf +fy +pe +py +sr +ve +uy +pt \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/pt/data/electronic/server_name.tsv new file mode 100644 index 0000000..34ab709 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/electronic/server_name.tsv @@ -0,0 +1,11 @@ +gmail g mail +gmail +nvidia n vidia +nvidia +outlook +hotmail +yahoo +aol +live +msn +live \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/pt/data/electronic/symbols.tsv new file mode 100644 index 0000000..690a9ca --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/electronic/symbols.tsv @@ -0,0 +1,6 @@ +. ponto +- traço +- hífen +_ traço baixo +_ underscore +/ barra \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/measurements_plural.tsv b/fun_text_processing/inverse_text_normalization/pt/data/measurements_plural.tsv new file mode 100644 index 0000000..6d2684a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/measurements_plural.tsv @@ -0,0 +1,56 @@ +h horas +min minutos +s segundos +ms milissegundos +ns nanossegundos +μs microssegundos +t toneladas +kg quilos +kg quilogramas +g gramas +mg miligramas +μm micrômetros +nm nanômetros +mm milímetros +cm centímetros +cm² centímetros quadrado +cm³ centímetros cúbico +m metros +m² metros quadrados +m³ metros cúbicos +km quilômetros +km² quilômetros quadrados +ha hectares +kph quilômetros por hora +mph milhas por hora +m/s metros por segundo +l litros +ml mililitros +kgf quilogramas forças +kgf quilogramas força +% por cento +°F fahrenheit +°C celsius +°F graus fahrenheit +°C graus celsius +Hz hertz +kHz quilo hertz +MHz mega hertz +GHz giga hertz +W watts +kW quilowatts +MW megawatts +GW gigawatts +Wh watts hora +kWh quilowatts hora +MWh megawatts hora +GWh gigawatts hora +kV quilovolts +V volts +mV milivolts +A amperes +mA miliamperes +rpm rotações por minuto +db decibéis +cal calorias +kcal quilocalorias diff --git a/fun_text_processing/inverse_text_normalization/pt/data/measurements_singular.tsv b/fun_text_processing/inverse_text_normalization/pt/data/measurements_singular.tsv new file mode 100644 index 0000000..bf7320e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/measurements_singular.tsv @@ -0,0 +1,55 @@ +h hora +min minuto +s segundo +ms milissegundo +ns nanossegundo +μs microssegundo +t tonelada +kg quilo +kg quilograma +g grama +mg miligrama +μm micrômetro +nm nanômetro +mm milímetro +cm centímetro +cm² centímetro quadrado +cm³ centímetro cúbico +m metro +m² metro quadrado +m³ metro cúbico +km quilômetro +km² quilômetro quadrado +ha hectare +kph quilômetro por hora +mph milha por hora +m/s metro por segundo +l litro +ml mililitro +kgf quilograma força +% por cento +°F fahrenheit +°C celsius +°F grau fahrenheit +°C grau celsius +Hz hertz +kHz quilo hertz +MHz mega hertz +GHz giga hertz +W watt +kW quilowatt +MW megawatt +GW gigawatt +Wh watt hora +kWh quilowatt hora +MWh megawatt hora +GWh gigawatt hora +kV quilovolt +V volt +mV milivolt +A ampere +mA miliampere +rpm rotação por minuto +db decibel +cal caloria +kcal quilocaloria diff --git a/fun_text_processing/inverse_text_normalization/pt/data/months.tsv b/fun_text_processing/inverse_text_normalization/pt/data/months.tsv new file mode 100644 index 0000000..ed1cf8d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/months.tsv @@ -0,0 +1,12 @@ +janeiro +fevereiro +março +abril +maio +junho +julho +agosto +setembro +outubro +novembro +dezembro diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/pt/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/pt/data/numbers/digit.tsv new file mode 100644 index 0000000..fda1b63 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/digit.tsv @@ -0,0 +1,11 @@ +um 1 +uma 1 +dois 2 +duas 2 +três 3 +quatro 4 +cinco 5 +seis 6 +sete 7 +oito 8 +nove 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/hundreds.tsv b/fun_text_processing/inverse_text_normalization/pt/data/numbers/hundreds.tsv new file mode 100644 index 0000000..ff06089 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/hundreds.tsv @@ -0,0 +1,17 @@ +cento 1 +duzentos 2 +duzentas 2 +trezentos 3 +trezentas 3 +quatrocentos 4 +quatrocentas 4 +quinhentos 5 +quinhentas 5 +seiscentos 6 +seiscentas 6 +setecentos 7 +setecentas 7 +oitocentos 8 +oitocentas 8 +novecentos 9 +novecentas 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/onehundred.tsv b/fun_text_processing/inverse_text_normalization/pt/data/numbers/onehundred.tsv new file mode 100644 index 0000000..1b5f9fa --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/onehundred.tsv @@ -0,0 +1 @@ +cem 100 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/pt/data/numbers/teen.tsv new file mode 100644 index 0000000..6bc21cc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/teen.tsv @@ -0,0 +1,11 @@ +dez 10 +onze 11 +doze 12 +treze 13 +catorze 14 +quatorze 14 +quinze 15 +dezesseis 16 +dezessete 17 +dezoito 18 +dezenove 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/pt/data/numbers/ties.tsv new file mode 100644 index 0000000..63ff93c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/ties.tsv @@ -0,0 +1,8 @@ +vinte 2 +trinta 3 +quarenta 4 +cinquenta 5 +sessenta 6 +setenta 7 +oitenta 8 +noventa 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/twenties.tsv b/fun_text_processing/inverse_text_normalization/pt/data/numbers/twenties.tsv new file mode 100644 index 0000000..c72178c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/twenties.tsv @@ -0,0 +1,9 @@ +vinte um 21 +vinte dois 22 +vinte três 23 +vinte quatro 24 +vinte cinco 25 +vinte seis 26 +vinte sete 27 +vinte oito 28 +vinte nove 29 diff --git a/fun_text_processing/inverse_text_normalization/pt/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/pt/data/numbers/zero.tsv new file mode 100644 index 0000000..c479272 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/numbers/zero.tsv @@ -0,0 +1 @@ +zero 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/pt/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/digit.tsv new file mode 100644 index 0000000..ad97cc4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/digit.tsv @@ -0,0 +1,18 @@ +primeiro 1 +primeira 1 +segundo 2 +segunda 2 +terceiro 3 +terceira 3 +quarto 4 +quarta 4 +quinto 5 +quinta 5 +sexto 6 +sexta 6 +sétimo 7 +sétima 7 +oitavo 8 +oitava 8 +nono 9 +nona 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/ordinals/hundreds.tsv b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/hundreds.tsv new file mode 100644 index 0000000..b7b15ee --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/hundreds.tsv @@ -0,0 +1,28 @@ +centésimo 1 +centésima 1 +ducentésimo 2 +ducentésima 2 +tricentésimo 3 +tricentésima 3 +trecentésimo 3 +trecentésima 3 +quadringentésimo 4 +quadringentésima 4 +quingentésimo 5 +quingentésima 5 +sexcentésimo 6 +sexcentésima 6 +seiscentésimo 6 +seiscentésima 6 +septingentésimo 7 +septingentésima 7 +setingentésimo 7 +setingentésima 7 +octingentésimo 8 +octingentésima 8 +octogentésimo 8 +octogentésima 8 +noningentésimo 9 +noningentésima 9 +nongentésimo 9 +nongentésima 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/ordinals/ties.tsv b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/ties.tsv new file mode 100644 index 0000000..55c4c4e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/ordinals/ties.tsv @@ -0,0 +1,20 @@ +décimo 1 +décima 1 +vigésimo 2 +vigésima 2 +trigésimo 3 +trigésima 3 +quadragésimo 4 +quadragésima 4 +quinquagésimo 5 +quinquagésima 5 +sexagésimo 6 +sexagésima 6 +septuagésimo 7 +septuagésima 7 +setuagésimo 7 +setuagésima 7 +octogésimo 8 +octogésima 8 +nonagésimo 9 +nonagésima 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/pt/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/pt/data/time/hour_to_am.tsv b/fun_text_processing/inverse_text_normalization/pt/data/time/hour_to_am.tsv new file mode 100644 index 0000000..c22366b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/time/hour_to_am.tsv @@ -0,0 +1 @@ +1 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/time/hour_to_pm.tsv b/fun_text_processing/inverse_text_normalization/pt/data/time/hour_to_pm.tsv new file mode 100644 index 0000000..548045d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/time/hour_to_pm.tsv @@ -0,0 +1 @@ +1 12 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/time/hours_to.tsv b/fun_text_processing/inverse_text_normalization/pt/data/time/hours_to.tsv new file mode 100644 index 0000000..5742d59 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/time/hours_to.tsv @@ -0,0 +1,23 @@ +0 23 +2 1 +3 2 +4 3 +5 4 +6 5 +7 6 +8 7 +9 8 +10 9 +11 10 +12 11 +13 12 +14 13 +15 14 +16 15 +17 16 +18 17 +19 18 +20 19 +21 20 +22 21 +23 22 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/time/minutes_to.tsv b/fun_text_processing/inverse_text_normalization/pt/data/time/minutes_to.tsv new file mode 100644 index 0000000..d8516a9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/time/minutes_to.tsv @@ -0,0 +1,59 @@ +01 59 +02 58 +03 57 +04 56 +05 55 +06 54 +07 53 +08 52 +09 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 09 +52 08 +53 07 +54 06 +55 05 +56 04 +57 03 +58 02 +59 01 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/time/time_suffix_am.tsv b/fun_text_processing/inverse_text_normalization/pt/data/time/time_suffix_am.tsv new file mode 100644 index 0000000..95394d7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/time/time_suffix_am.tsv @@ -0,0 +1,2 @@ +da madrugada da madrugada +da manhã da manhã \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/time/time_suffix_pm.tsv b/fun_text_processing/inverse_text_normalization/pt/data/time/time_suffix_pm.tsv new file mode 100644 index 0000000..18c7c99 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/time/time_suffix_pm.tsv @@ -0,0 +1,2 @@ +da tarde da tarde +da noite da noite \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/pt/data/whitelist.tsv new file mode 100644 index 0000000..bd82088 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/data/whitelist.tsv @@ -0,0 +1,5 @@ +segunda-feira segunda feira +terça-feira terça feira +quarta-feira quarta feira +quinta-feira quinta feira +sexta-feira sexta feira \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/pt/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/pt/taggers/cardinal.py new file mode 100644 index 0000000..8521e2a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/cardinal.py @@ -0,0 +1,397 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + DAMO_WHITE_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. menos veintitrés -> cardinal { negative: "-" integer: "23"} + This class converts cardinals up to (but not including) "un cuatrillón", + i.e up to "one septillion" in English (10^{24}). + Cardinals below ten are not converted (in order to avoid + "vivo em uma casa" --> "vivo em 1 casa" and any other odd conversions.) + + Although technically Portuguese grammar requires that "e" only comes after + "10s" numbers (ie. "trinta", ..., "noventa"), these rules will convert + numbers even with "e" in an ungrammatical place (because "e" is ignored + inside cardinal numbers). + e.g. "mil e uma" -> cardinal { integer: "1001"} + e.g. "cento e uma" -> cardinal { integer: "101"} + """ + + def __init__(self, use_strict_e=False): + """ + :param use_strict_e: When True forces to have the separator "e" in the right places + """ + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + graph_one_hundred = pynini.string_file(get_abs_path("data/numbers/onehundred.tsv")) + graph_hundreds = pynini.string_file(get_abs_path("data/numbers/hundreds.tsv")) + + graph = None + + if not use_strict_e: + graph_hundred_component = graph_hundreds | pynutil.insert("0") + graph_hundred_component += delete_space + graph_hundred_component += pynini.union( + graph_twenties | graph_teen | pynutil.insert("00"), + (graph_ties | pynutil.insert("0")) + + delete_space + + (graph_digit | pynutil.insert("0")), + ) + graph_hundred_component = pynini.union(graph_hundred_component, graph_one_hundred) + + graph_hundred_component_at_least_one_none_zero_digit = graph_hundred_component @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + + graph_thousands = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("mil"), + pynutil.insert("001") + + pynutil.delete("mil"), # because we say 'mil', not 'hum mil' + pynutil.insert("000", weight=0.01), + ) + + graph_milhoes = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("milhão") | pynutil.delete("milhões")), + pynutil.insert("000", weight=0.01), + ) + + graph_bilhoes = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("bilhão") | pynutil.delete("bilhões")), + pynutil.insert("000", weight=0.01), + ) + + graph_trilhoes = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("trilhão") | pynutil.delete("trilhões")), + pynutil.insert("000", weight=0.01), + ) + + graph_quatrilhoes = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("quatrilhão") | pynutil.delete("quatrilhões")), + pynutil.insert("000", weight=0.01), + ) + + graph_quintilhoes = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("quintilhão") | pynutil.delete("quintilhões")), + pynutil.insert("000", weight=0.01), + ) + + graph_sextilhoes = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + (pynutil.delete("sextilhão") | pynutil.delete("sextilhões")), + pynutil.insert("000", weight=0.01), + ) + + graph = pynini.union( + graph_sextilhoes + + delete_space + + graph_quintilhoes + + delete_space + + graph_quatrilhoes + + delete_space + + graph_trilhoes + + delete_space + + graph_bilhoes + + delete_space + + graph_milhoes + + delete_space + + graph_thousands + + delete_space + + graph_hundred_component, + graph_zero, + ) + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + graph = ( + pynini.cdrewrite(pynutil.delete("e"), DAMO_SPACE, DAMO_SPACE, DAMO_SIGMA) + @ (DAMO_ALPHA + DAMO_SIGMA) + @ graph + ) + + else: + graph_e = ( + pynutil.delete(DAMO_WHITE_SPACE.plus) + + pynutil.delete("e") + + pynutil.delete(DAMO_WHITE_SPACE.plus) + ) + + graph_ties_component = pynini.union( + graph_teen | graph_twenties, + graph_ties + ((graph_e + graph_digit) | pynutil.insert("0")), + pynutil.add_weight(pynutil.insert("0") + graph_digit, 0.1), + ) @ (pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT)) + + graph_hundreds_except_hundred = ( + pynini.project(graph_hundreds, "input") - "cento" + ) @ graph_hundreds + + graph_hundred_component_prefix_e = pynini.union( + graph_one_hundred, + pynutil.add_weight(graph_hundreds_except_hundred + pynutil.insert("00"), 0.1), + pynutil.insert("0") + graph_ties_component, + ) @ (pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT)) + graph_hundred_component_prefix_e = graph_hundred_component_prefix_e.optimize() + + graph_hundred_component_no_prefix = pynini.union( + graph_hundreds + graph_e + graph_ties_component, + ) @ (pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT)) + graph_hundred_component_no_prefix = graph_hundred_component_no_prefix.optimize() + + graph_mil_prefix_e = pynini.union( + # because we say 'mil', not 'hum mil' + ( + (graph_hundred_component_prefix_e + delete_space + pynutil.delete("mil")) + | (pynutil.insert("001", weight=0.1) + pynutil.delete("mil")) + ) + + ( + (graph_e + graph_hundred_component_prefix_e) + | (delete_space + graph_hundred_component_no_prefix) + | pynutil.insert("000", weight=0.1) + ) + ) + + graph_mil_no_prefix = pynini.union( + ( + (graph_hundred_component_no_prefix + delete_space + pynutil.delete("mil")) + | pynutil.insert("000", weight=0.1) + ) + + ( + (graph_e + graph_hundred_component_prefix_e) + | (delete_space + graph_hundred_component_no_prefix) + | pynutil.insert("000", weight=0.1) + ) + ) + + graph_milhao_prefix_e = pynini.union( + ( + graph_hundred_component_prefix_e + + delete_space + + (pynutil.delete("milhão") | pynutil.delete("milhões")) + ) + + ((graph_e + graph_mil_prefix_e) | (delete_space + graph_mil_no_prefix)) + ) + + graph_milhao_no_prefix = pynini.union( + ( + ( + graph_hundred_component_no_prefix + + delete_space + + (pynutil.delete("milhão") | pynutil.delete("milhões")) + ) + | pynutil.insert("000", weight=0.1) + ) + + ((graph_e + graph_mil_prefix_e) | (delete_space + graph_mil_no_prefix)) + ) + + graph_bilhao_prefix_e = pynini.union( + ( + graph_hundred_component_prefix_e + + delete_space + + (pynutil.delete("bilhão") | pynutil.delete("bilhões")) + ) + + ((graph_e + graph_milhao_prefix_e) | (delete_space + graph_milhao_no_prefix)) + ) + + graph_bilhao_no_prefix = pynini.union( + ( + ( + graph_hundred_component_no_prefix + + delete_space + + (pynutil.delete("bilhão") | pynutil.delete("bilhões")) + ) + | pynutil.insert("000", weight=0.1) + ) + + ((graph_e + graph_milhao_prefix_e) | (delete_space + graph_milhao_no_prefix)) + ) + + graph_trilhao_prefix_e = pynini.union( + ( + graph_hundred_component_prefix_e + + delete_space + + (pynutil.delete("trilhão") | pynutil.delete("trilhões")) + ) + + ((graph_e + graph_bilhao_prefix_e) | (delete_space + graph_bilhao_no_prefix)) + ) + + graph_trilhao_no_prefix = pynini.union( + ( + ( + graph_hundred_component_no_prefix + + delete_space + + (pynutil.delete("trilhão") | pynutil.delete("trilhões")) + ) + | pynutil.insert("000", weight=0.1) + ) + + ((graph_e + graph_bilhao_prefix_e) | (delete_space + graph_bilhao_no_prefix)) + ) + + graph_quatrilhao_prefix_e = pynini.union( + ( + graph_hundred_component_prefix_e + + delete_space + + (pynutil.delete("quatrilhão") | pynutil.delete("quatrilhões")) + ) + + ((graph_e + graph_trilhao_prefix_e) | (delete_space + graph_trilhao_no_prefix)) + ) + + graph_quatrilhao_no_prefix = pynini.union( + ( + ( + graph_hundred_component_no_prefix + + delete_space + + (pynutil.delete("quatrilhão") | pynutil.delete("quatrilhões")) + ) + | pynutil.insert("000", weight=0.1) + ) + + ((graph_e + graph_trilhao_prefix_e) | (delete_space + graph_trilhao_no_prefix)) + ) + + graph_quintilhao_prefix_e = pynini.union( + ( + graph_hundred_component_prefix_e + + delete_space + + (pynutil.delete("quintilhão") | pynutil.delete("quintilhões")) + ) + + ( + (graph_e + graph_quatrilhao_prefix_e) + | (delete_space + graph_quatrilhao_no_prefix) + ) + ) + + graph_quintilhao_no_prefix = pynini.union( + ( + ( + graph_hundred_component_no_prefix + + delete_space + + (pynutil.delete("quintilhão") | pynutil.delete("quintilhões")) + ) + | pynutil.insert("000", weight=0.1) + ) + + ( + (graph_e + graph_quatrilhao_prefix_e) + | (delete_space + graph_quatrilhao_no_prefix) + ) + ) + + graph_sextilhao_prefix_e = pynini.union( + ( + graph_hundred_component_prefix_e + + delete_space + + (pynutil.delete("sextilhão") | pynutil.delete("sextilhões")) + ) + + ( + (graph_e + graph_quintilhao_prefix_e) + | (delete_space + graph_quintilhao_no_prefix) + ) + ) + + graph_sextilhao_no_prefix = pynini.union( + ( + ( + graph_hundred_component_no_prefix + + delete_space + + (pynutil.delete("sextilhão") | pynutil.delete("sextilhões")) + ) + | pynutil.insert("000", weight=0.1) + ) + + ( + (graph_e + graph_quintilhao_prefix_e) + | (delete_space + graph_quintilhao_no_prefix) + ) + ) + + graph = pynini.union( + graph_sextilhao_no_prefix, + graph_sextilhao_prefix_e, + graph_quintilhao_prefix_e, + graph_quatrilhao_prefix_e, + graph_trilhao_prefix_e, + graph_bilhao_prefix_e, + graph_milhao_prefix_e, + graph_mil_prefix_e, + graph_hundred_component_prefix_e, + graph_ties_component, + graph_zero, + ).optimize() + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + graph = graph.optimize() + self.graph_no_exception = graph + + # save self.numbers_up_to_thousand for use in DecimalFst + digits_up_to_thousand = DAMO_DIGIT | (DAMO_DIGIT**2) | (DAMO_DIGIT**3) + numbers_up_to_thousand = pynini.compose(graph, digits_up_to_thousand).optimize() + self.numbers_up_to_thousand = numbers_up_to_thousand + + # save self.numbers_up_to_million for use in DecimalFst + digits_up_to_million = ( + DAMO_DIGIT + | (DAMO_DIGIT**2) + | (DAMO_DIGIT**3) + | (DAMO_DIGIT**4) + | (DAMO_DIGIT**5) + | (DAMO_DIGIT**6) + ) + numbers_up_to_million = pynini.compose(graph, digits_up_to_million).optimize() + self.numbers_up_to_million = numbers_up_to_million + + # save self.digits_from_year for use in DateFst + digits_1_2099 = [str(digits) for digits in range(1, 2100)] + digits_from_year = (numbers_up_to_million @ pynini.union(*digits_1_2099)).optimize() + self.digits_from_year = digits_from_year + + # don't convert cardinals from zero to nine inclusive + graph_exception = pynini.project(pynini.union(graph_digit, graph_zero), "input") + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("menos", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/date.py b/fun_text_processing/inverse_text_normalization/pt/taggers/date.py new file mode 100644 index 0000000..ed247a0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/date.py @@ -0,0 +1,77 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. primeiro de janeiro -> date { day: "1" month: "janeiro" } + e.g. um de janeiro -> date { day: "1" month: "janeiro" } + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="date", kind="classify") + + digits_from_year = cardinal.digits_from_year + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + + graph_1_to_100 = pynini.union( + pynutil.insert("0") + graph_digit, + graph_twenties, + graph_teen, + (graph_ties + pynutil.insert("0")), + (graph_ties + pynutil.delete(" e ") + graph_digit), + ) + + digits_1_to_31 = [str("{:0>2d}").format(digits) for digits in range(1, 32)] + graph_1_to_31 = graph_1_to_100 @ pynini.union(*digits_1_to_31) + # can use "primeiro" for 1st day of the month + graph_1_to_31 = pynini.union(graph_1_to_31, pynini.cross("primeiro", "01")) + + day_graph = pynutil.insert('day: "') + graph_1_to_31 + pynutil.insert('"') + + month_name_graph = pynini.string_file(get_abs_path("data/months.tsv")) + month_name_graph = pynutil.insert('month: "') + month_name_graph + pynutil.insert('"') + + # vinte do oito -> 20/08 + digits_1_to_12 = [str("{:0>2d}").format(digits) for digits in range(1, 13)] + graph_1_to_12 = graph_1_to_100 @ pynini.union(*digits_1_to_12) + month_number_graph = pynutil.insert('month: "') + graph_1_to_12 + pynutil.insert('"') + + graph_dm = ( + day_graph + delete_space + pynutil.delete("de") + delete_extra_space + month_name_graph + ) + + graph_dm |= ( + day_graph + + delete_space + + pynutil.delete("do") + + delete_extra_space + + month_number_graph + + pynutil.insert(' morphosyntactic_features: "/"') + ) + + graph_year = ( + delete_space + + pynutil.delete("de") + + delete_extra_space + + pynutil.insert('year: "') + + digits_from_year + + pynutil.insert('"') + ) + graph_dmy = graph_dm + graph_year.ques + + final_graph = graph_dmy + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/pt/taggers/decimal.py new file mode 100644 index 0000000..8cec15e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/decimal.py @@ -0,0 +1,119 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_million: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_million: cardinal FST + """ + numbers = cardinal_up_to_million @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + + suffix = pynini.union( + "milhão", + "milhões", + "bilhão", + "bilhões", + "trilhão", + "trilhões", + "quatrilhão", + "quatrilhões", + "quintilhão", + "quintilhões", + "sextilhão", + "sextilhões", + ) + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + delete_extra_space + pynutil.insert('quantity: "') + suffix + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + Decimal point is either "." or ",", determined by whether "ponto" or "vírgula" is spoken. + e.g. menos um vírgula dois seis -> decimal { negative: "true" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" } + e.g. menos um ponto dois seis -> decimal { negative: "true" integer_part: "1" morphosyntactic_features: "." fractional_part: "26" } + + This decimal rule assumes that decimals can be pronounced as: + (a cardinal) + ('vírgula' or 'ponto') plus (any sequence of cardinals <1000, including 'zero') + + Also writes large numbers in shortened form, e.g. + e.g. um vírgula dois seis milhões -> decimal { negative: "false" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" quantity: "milhões" } + e.g. dois milhões -> decimal { negative: "false" integer_part: "2" quantity: "milhões" } + e.g. mil oitcentos e vinte e quatro milhões -> decimal { negative: "false" integer_part: "1824" quantity: "milhões" } + Args: + cardinal: CardinalFst + + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + # number after decimal point can be any series of cardinals <1000, including 'zero' + graph_decimal = cardinal.numbers_up_to_thousand + graph_decimal = pynini.closure(graph_decimal + delete_space) + graph_decimal + self.graph = graph_decimal + + # decimal point can be denoted by 'vírgula' or 'ponto' + decimal_point = pynini.cross("vírgula", 'morphosyntactic_features: ","') + decimal_point |= pynini.cross("ponto", 'morphosyntactic_features: "."') + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("menos", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + + cardinal_graph = cardinal.graph_no_exception | pynini.string_file( + get_abs_path("data/numbers/zero.tsv") + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + decimal_point + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.numbers_up_to_million + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.numbers_up_to_million + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/pt/taggers/electronic.py new file mode 100644 index 0000000..abe8c37 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/electronic.py @@ -0,0 +1,95 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import DAMO_ALPHA, GraphFst, insert_space +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying 'electronic' semiotic classes, i.e. + email address (which get converted to "username" and "domain" fields), + and URLS (which get converted to a "protocol" field). + e.g. c d f um arroba a b c ponto e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + e.g. dáblio dáblio dáblio a b c ponto e d u -> tokens { electronic { protocol: "www.abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("ponto", ".") + username = ( + pynutil.insert('username: "') + + alpha_num + + delete_extra_space + + pynini.closure(accepted_username + delete_extra_space) + + alpha_num + + pynutil.insert('"') + ) + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = ( + single_alphanum + | pynini.string_file(get_abs_path("data/electronic/server_name.tsv")).invert() + ) + domain = ( + single_alphanum + | pynini.string_file(get_abs_path("data/electronic/domain.tsv")).invert() + ) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete("arroba") + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("www", "w w w", "dáblio dáblio dáblio"), "www") + protocol_start = pynini.cross(pynini.union("http", "h t t p", "agá tê tê pê"), "http") + protocol_start |= pynini.cross( + pynini.union("https", "h t t p s", "agá tê tê pê ésse"), "https" + ) + protocol_start += pynini.cross(" dois pontos barra barra ", "://") + + # e.g. .com, .es + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + (domain | pynini.closure(accepted_username + delete_extra_space) + accepted_username) + ) + + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + delete_extra_space + + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + + pynini.closure(ending, 1) + ) + protocol = pynutil.insert('protocol: "') + protocol + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/measure.py b/fun_text_processing/inverse_text_normalization/pt/taggers/measure.py new file mode 100644 index 0000000..9e13973 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/measure.py @@ -0,0 +1,100 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. menos doze quilogramas -> measure { cardinal { negative: "true" integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_unit_singular = pynini.string_file( + get_abs_path("data/measurements_singular.tsv") + ).invert() + graph_unit_plural = pynini.string_file( + get_abs_path("data/measurements_plural.tsv") + ).invert() + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("menos", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_singular = convert_space(graph_unit_singular) + unit_plural = convert_space(graph_unit_plural) + unit_misc = ( + pynutil.insert("/") + + pynutil.delete("por") + + delete_space + + convert_space(graph_unit_singular) + ) + + unit_singular = ( + pynutil.insert('units: "') + + ( + unit_singular + | unit_misc + | pynutil.add_weight(unit_singular + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + unit_plural = ( + pynutil.insert('units: "') + + ( + unit_plural + | unit_misc + | pynutil.add_weight(unit_plural + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "um" - "uma") @ cardinal_graph) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + (pynini.cross("um", "1") | pynini.cross("uma", "1")) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/money.py b/fun_text_processing/inverse_text_normalization/pt/taggers/money.py new file mode 100644 index 0000000..5e5347b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/money.py @@ -0,0 +1,122 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. doze dólares e cinco centavos -> money { integer_part: "12" fractional_part: "05" currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + graph_decimal_final = decimal.final_graph_wo_negative + + unit_singular = pynini.string_file(get_abs_path("data/currency_singular.tsv")).invert() + unit_plural = pynini.string_file(get_abs_path("data/currency_plural.tsv")).invert() + + graph_unit_singular = ( + pynutil.insert('currency: "') + convert_space(unit_singular) + pynutil.insert('"') + ) + graph_unit_plural = ( + pynutil.insert('currency: "') + convert_space(unit_plural) + pynutil.insert('"') + ) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + # twelve dollars (and) fifty cents, zero cents + cents_standalone = ( + pynutil.insert('morphosyntactic_features: ","') # always use a comma in the decimal + + insert_space + + pynutil.insert('fractional_part: "') + + pynini.union( + pynutil.add_weight(((DAMO_SIGMA - "um" - "uma") @ cardinal_graph), -0.7) + @ add_leading_zero_to_double_digit + + delete_space + + pynutil.delete(pynini.union("centavos")), + pynini.cross("um", "01") + delete_space + pynutil.delete(pynini.union("centavo")), + ) + + pynutil.insert('"') + ) + + optional_cents_standalone = pynini.closure( + delete_space + + pynini.closure((pynutil.delete("com") | pynutil.delete("e")) + delete_space, 0, 1) + + insert_space + + cents_standalone, + 0, + 1, + ) + + # twelve dollars fifty, only after integer + # setenta e cinco dólares com sessenta e três ~ $75,63 + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('morphosyntactic_features: ","') # always use a comma in the decimal + + insert_space + + pynutil.insert('fractional_part: "') + + pynini.closure((pynutil.delete("com") | pynutil.delete("e")) + delete_space, 0, 1) + + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "um" - "uma") @ cardinal_graph) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_plural + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_integer |= ( + pynutil.insert('integer_part: "') + + (pynini.cross("um", "1") | pynini.cross("uma", "1")) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_singular + + (optional_cents_standalone | optional_cents_suffix) + ) + + graph_cents_standalone = pynini.union( + pynutil.insert('currency: "R$" integer_part: "0" ') + cents_standalone, + pynutil.add_weight( + pynutil.insert('integer_part: "0" ') + + cents_standalone + + delete_extra_space + + pynutil.delete("de") + + delete_space + + graph_unit_singular, + -0.1, + ), + ) + + graph_decimal = ( + graph_decimal_final + + delete_extra_space + + (pynutil.delete("de") + delete_space).ques + + graph_unit_plural + ) + graph_decimal |= graph_cents_standalone + final_graph = graph_integer | graph_decimal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/pt/taggers/ordinal.py new file mode 100644 index 0000000..2670d06 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/ordinal.py @@ -0,0 +1,78 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, GraphFst, delete_space +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + vigésimo primeiro -> ordinal { integer: "21" morphosyntactic_features: "o" } + This class converts ordinal up to "milésimo" (one thousandth) exclusive. + + Cardinals below ten are not converted (in order to avoid + e.g. "primero fez ..." -> "1º fez...", "segunda guerra mundial" -> "2ª guerra mundial" + and any other odd conversions.) + + This FST also records the ending of the ordinal (called "morphosyntactic_features"): + either "o" or "a". + + Args: + cardinal: CardinalFst + """ + + def __init__(self): + super().__init__(name="ordinal", kind="classify") + + graph_digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/ordinals/ties.tsv")) + graph_hundreds = pynini.string_file(get_abs_path("data/ordinals/hundreds.tsv")) + + ordinal_graph_union = pynini.union( + pynutil.add_weight(graph_digit, 0.4), + pynutil.add_weight( + graph_ties + ((delete_space + graph_digit) | pynutil.insert("0")), 0.2 + ), + graph_hundreds + + ((delete_space + graph_ties) | pynutil.insert("0")) + + ((delete_space + graph_digit) | pynutil.insert("0")), + ) + + accept_o_endings = DAMO_SIGMA + pynini.accep("o") + accept_a_endings = DAMO_SIGMA + pynini.accep("a") + + ordinal_graph_o = accept_o_endings @ ordinal_graph_union + ordinal_graph_a = accept_a_endings @ ordinal_graph_union + + # 'optional_numbers_in_front' have negative weight so we always + # include them if they're there + optional_in_front = ( + pynutil.add_weight(ordinal_graph_union, -0.1) + delete_space.closure() + ).closure() + graph_o_suffix = optional_in_front + ordinal_graph_o + graph_a_suffix = optional_in_front + ordinal_graph_a + + # don't convert ordinals from one to nine inclusive + graph_exception = pynini.project(pynini.union(graph_digit), "input") + graph_o_suffix = ( + pynini.project(graph_o_suffix, "input") - graph_exception.arcsort() + ) @ graph_o_suffix + graph_a_suffix = ( + pynini.project(graph_a_suffix, "input") - graph_exception.arcsort() + ) @ graph_a_suffix + + graph = ( + pynutil.insert('integer: "') + + graph_o_suffix + + pynutil.insert('"') + + pynutil.insert(' morphosyntactic_features: "o"') + ) + graph |= ( + pynutil.insert('integer: "') + + graph_a_suffix + + pynutil.insert('"') + + pynutil.insert(' morphosyntactic_features: "a"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/pt/taggers/punctuation.py new file mode 100644 index 0000000..dfe16fa --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/pt/taggers/telephone.py new file mode 100644 index 0000000..3edda64 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/telephone.py @@ -0,0 +1,125 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + um dois um dois três quatro cinco seis sete oito nove -> { number_part: "(12) 12345-6789" }. + If 11 digits are spoken, they are grouped as 2+5+4 (eg. (12) 34567-8901). + If 10 digits are spoken, they are grouped as 2+4+4 (eg. (12) 3456-7890). + If 9 digits are spoken, they are grouped as 5+4 (eg. 12345-6789). + If 8 digits are spoken, they are grouped as 4+4 (eg. 1234-5678). + In portuguese, digits are generally spoken individually, or as 2-digit numbers, + eg. "trinta e quatro oitenta e dois" = "3482", + "meia sete vinte" = "6720". + """ + + def __init__(self): + super().__init__(name="telephone", kind="classify") + + # create `single_digits` and `double_digits` graphs as these will be + # the building blocks of possible telephone numbers + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_half = pynini.cross("meia", "6") + + graph_all_digits = pynini.union(graph_digit, graph_half, graph_zero) + + single_digits = pynini.invert(graph_all_digits).optimize() + + double_digits = ( + pynini.union( + graph_teen | graph_twenties, + (graph_ties + pynutil.insert("0")), + (graph_ties + delete_space + pynutil.delete("e") + delete_space + graph_digit), + (graph_all_digits + delete_space + graph_all_digits), + ) + .invert() + .optimize() + ) + + # define `eleven_digit_graph`, `ten_digit_graph`, `nine_digit_graph`, `eight_digit_graph` + # which accept telephone numbers spoken (1) only with single digits, + # or (2) spoken with double digits (and sometimes single digits) + + # 11-digit option (2): (2) + (1+2+2) + (2+2) digits + eleven_digit_graph = ( + pynutil.delete("(") + + double_digits + + insert_space + + pynutil.delete(") ") + + single_digits + + insert_space + + double_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + # 10-digit option (2): (2) + (2+2) + (2+2) digits + ten_digit_graph = ( + pynutil.delete("(") + + double_digits + + insert_space + + pynutil.delete(") ") + + double_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + # 9-digit option (2): (1+2+2) + (2+2) digits + nine_digit_graph = ( + single_digits + + insert_space + + double_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + # 8-digit option (2): (2+2) + (2+2) digits + eight_digit_graph = ( + double_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + number_part = pynini.union( + eleven_digit_graph, ten_digit_graph, nine_digit_graph, eight_digit_graph + ) + + number_part = ( + pynutil.insert('number_part: "') + pynini.invert(number_part) + pynutil.insert('"') + ) + + graph = number_part + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/time.py b/fun_text_processing/inverse_text_normalization/pt/taggers/time.py new file mode 100644 index 0000000..4b59e76 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/time.py @@ -0,0 +1,223 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. quinze pro meio dia -> time { hours: "11" minutes: "45" } + e.g. quinze pra meia noite -> time { hours: "23" minutes: "45" } + e.g. quinze pra uma -> time { hours: "12" minutes: "45" } + e.g. dez pras duas -> time { hours: "1" minutes: "50" } + e.g. quinze pras duas -> time { hours: "1" minutes: "45" } + e.g. ao meio dia -> time { hours: "12" minutes: "00" morphosyntactic_features: "ao" } + e.g. ao meio dia e meia -> time { hours: "12" minutes: "30" morphosyntactic_features: "ao" } + e.g. ao meio dia e meio -> time { hours: "12" minutes: "30" morphosyntactic_features: "ao" } + e.g. à meia noite e quinze -> time { hours: "0" minutes: "15" morphosyntactic_features: "à" } + e.g. à meia noite e meia -> time { hours: "0" minutes: "30" morphosyntactic_features: "à" } + e.g. à uma e trinta -> time { hours: "1" minutes: "30" morphosyntactic_features: "à" } + e.g. às onze e trinta -> time { hours: "11" minutes: "30" morphosyntactic_features: "às" } + e.g. às três horas e trinta minutos -> time { hours: "3" minutes: "30" morphosyntactic_features: "às" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + + # graph_hour_to_am = pynini.string_file(get_abs_path("data/time/hour_to_am.tsv")) + # graph_hour_to_pm = pynini.string_file(get_abs_path("data/time/hour_to_pm.tsv")) + graph_hours_to = pynini.string_file(get_abs_path("data/time/hours_to.tsv")) + graph_minutes_to = pynini.string_file(get_abs_path("data/time/minutes_to.tsv")) + graph_suffix_am = pynini.string_file(get_abs_path("data/time/time_suffix_am.tsv")) + graph_suffix_pm = pynini.string_file(get_abs_path("data/time/time_suffix_pm.tsv")) + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + + graph_1_to_100 = pynini.union( + graph_digit, + graph_twenties, + graph_teen, + (graph_ties + pynutil.insert("0")), + (graph_ties + pynutil.delete(" e ") + graph_digit), + ) + + # note that graph_hour will start from 2 hours + # "1 o'clock" will be treated differently because it + # is singular + digits_2_to_23 = [str(digits) for digits in range(2, 24)] + digits_1_to_59 = [str(digits) for digits in range(1, 60)] + + graph_2_to_23 = graph_1_to_100 @ pynini.union(*digits_2_to_23) + graph_1_to_59 = graph_1_to_100 @ pynini.union(*digits_1_to_59) + graph_uma = pynini.cross("uma", "1") + + # Mapping 'horas' + graph_hour = pynutil.delete(pynini.accep("hora") + pynini.accep("s").ques) + graph_minute = pynutil.delete(pynini.accep("minuto") + pynini.accep("s").ques) + + # Mapping 'meio dia' and 'meia noite' + graph_meio_dia = pynini.cross("meio dia", "12") + graph_meia_noite = pynini.cross("meia noite", "0") + + # Mapping 'e meia' + graph_e = delete_space + pynutil.delete(" e ") + delete_space + graph_e_meia = graph_e + pynini.cross("meia", "30") + graph_e_meio = graph_e + pynini.cross("meio", "30") + + # à uma e meia -> 1:30 + # às três e meia -> 3:30 + graph_hours_at_prefix_singular = ( + pynutil.insert('morphosyntactic_features: "') + + (pynini.cross("à", "à") | pynini.cross("a", "à")) + + pynutil.insert('" ') + + delete_space + ) + graph_hours_at_singular = ( + graph_hours_at_prefix_singular + + pynutil.insert('hours: "') + + graph_uma + + pynutil.insert('"') + + (delete_space + graph_hour).ques + ) + graph_hours_at_prefix_plural = ( + pynutil.insert('morphosyntactic_features: "') + + (pynini.cross("às", "às") | pynini.cross("as", "às")) + + pynutil.insert('" ') + + delete_space + ) + graph_hours_at_plural = ( + graph_hours_at_prefix_plural + + pynutil.insert('hours: "') + + graph_2_to_23 + + pynutil.insert('"') + + (delete_space + graph_hour).ques + ) + final_graph_hour_at = graph_hours_at_singular | graph_hours_at_plural + + graph_minutes_component_without_zero = ( + graph_e + graph_1_to_59 + (delete_space + graph_minute).ques + ) + graph_minutes_component_without_zero |= ( + graph_e_meia + pynutil.delete(delete_space + pynini.accep("hora")).ques + ) + final_graph_minute = ( + pynutil.insert(' minutes: "') + + graph_minutes_component_without_zero + + pynutil.insert('"') + ) + + graph_hm = final_graph_hour_at + final_graph_minute + + # à uma hora -> 1:00 + graph_hours_at_singular_with_hour = ( + graph_hours_at_prefix_singular + + pynutil.insert('hours: "') + + graph_uma + + pynutil.insert('"') + + delete_space + + graph_hour + ) + + graph_hours_at_plural_with_hour = ( + graph_hours_at_prefix_plural + + pynutil.insert('hours: "') + + graph_2_to_23 + + pynutil.insert('"') + + delete_space + + graph_hour + ) + + graph_hm |= ( + graph_hours_at_singular_with_hour | graph_hours_at_plural_with_hour + ) + pynutil.insert(' minutes: "00"', weight=0.2) + + # meio dia e meia -> 12:30 + # meia noite e meia -> 0:30 + graph_minutes_without_zero = ( + pynutil.insert(' minutes: "') + + graph_minutes_component_without_zero + + pynutil.insert('"') + ) + graph_meio_min = ( + pynutil.insert('hours: "') + + (graph_meio_dia | graph_meia_noite) + + pynutil.insert('"') + + graph_minutes_without_zero + ) + graph_meio_min |= ( + pynutil.insert('hours: "') + + graph_meio_dia + + pynutil.insert('" minutes: "') + + graph_e_meio + + pynutil.insert('"') + ) + graph_hm |= graph_meio_min + + # às quinze para as quatro -> às 3:45 + # NOTE: case 'para à uma' ('to one') could be either 0:XX or 12:XX + # leading to wrong reading ('meio dia e ...' or 'meia noite e ...') + graph_para_a = ( + pynutil.delete("para") + | pynutil.delete("para a") + | pynutil.delete("para as") + | pynutil.delete("pra") + | pynutil.delete("pras") + ) + graph_para_o = pynutil.delete("para") | pynutil.delete("para o") | pynutil.delete("pro") + + graph_pra_min = ( + pynutil.insert('morphosyntactic_features: "') + + ( + pynini.cross("à", "à") + | pynini.cross("às", "às") + | pynini.cross("a", "à") + | pynini.cross("as", "às") + ) + + pynutil.insert('" ') + + delete_space + ) + graph_pra_min += ( + pynutil.insert('minutes: "') + + (graph_1_to_59 @ graph_minutes_to) + + pynutil.insert('" ') + + (delete_space + graph_minute).ques + ) + graph_pra_hour = ( + pynutil.insert('hours: "') + + (graph_2_to_23 @ graph_hours_to) + + pynutil.insert('"') + + (delete_space + graph_hour).ques + ) + graph_pra_hour |= ( + pynutil.insert('hours: "') + (graph_meia_noite @ graph_hours_to) + pynutil.insert('"') + ) + + graph_pra = graph_pra_min + delete_space + graph_para_a + delete_space + graph_pra_hour + + # às quinze pro meio dia -> às 11:45 + graph_pro = graph_pra_min + delete_space + graph_para_o + delete_space + graph_pro += ( + pynutil.insert(' hours: "') + (graph_meio_dia @ graph_hours_to) + pynutil.insert('"') + ) + + graph_mh = graph_pra | graph_pro + + # optional suffix + final_suffix = ( + pynutil.insert('suffix: "') + (graph_suffix_am | graph_suffix_pm) + pynutil.insert('"') + ) + final_suffix_optional = pynini.closure(delete_space + insert_space + final_suffix, 0, 1) + + final_graph = pynini.union((graph_hm | graph_mh) + final_suffix_optional).optimize() + + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/pt/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..ac84c0c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/tokenize_and_classify.py @@ -0,0 +1,102 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.pt.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.pt.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.pt.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.pt.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.pt.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.pt.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.pt.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.pt.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.pt.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.pt.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.pt.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.pt.taggers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_pt_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + + cardinal = CardinalFst(use_strict_e=True) + cardinal_graph = cardinal.fst + + ordinal_graph = OrdinalFst().fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst(cardinal=cardinal).fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst().fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.09) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.09) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/pt/taggers/whitelist.py new file mode 100644 index 0000000..2ffb438 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. usted -> tokens { name: "ud." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/taggers/word.py b/fun_text_processing/inverse_text_normalization/pt/taggers/word.py new file mode 100644 index 0000000..9758f68 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/utils.py b/fun_text_processing/inverse_text_normalization/pt/utils.py new file mode 100644 index 0000000..c6fdb74 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/utils.py @@ -0,0 +1,13 @@ +import os + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/cardinal.py new file mode 100644 index 0000000..005fae0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { negative: "-" integer: "23" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/date.py new file mode 100644 index 0000000..ef18b1b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/date.py @@ -0,0 +1,73 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { day: "1" month: "enero" preserve_order: true } -> 1 de enero + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + # day month + graph_dmy = ( + day + + delete_extra_space + + pynutil.insert("de") + + insert_space + + month + + (delete_extra_space + pynutil.insert("de") + insert_space + year).ques + ) + graph_dmy |= ( + day + + delete_space + + pynutil.insert("/") + + month + + pynutil.delete(' morphosyntactic_features: "/"') + + (delete_space + pynutil.insert("/") + year).ques + ) + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = graph_dmy + delete_space + optional_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/decimal.py new file mode 100644 index 0000000..346e15b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/decimal.py @@ -0,0 +1,56 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, + e.g. decimal { negative: "true" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" } -> -1,26 + e.g. decimal { negative: "true" integer_part: "1" morphosyntactic_features: "." fractional_part: "26" } -> -1.26 + e.g. decimal { negative: "false" integer_part: "1" morphosyntactic_features: "," fractional_part: "26" quantity: "millón" } -> 1,26 millón + e.g. decimal { negative: "false" integer_part: "2" quantity: "millones" } -> 2 millones + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + + decimal_point = pynini.cross('morphosyntactic_features: ","', ",") + decimal_point |= pynini.cross('morphosyntactic_features: "."', ".") + + fractional = ( + decimal_point + + delete_space + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/electronic.py new file mode 100644 index 0000000..bcdf689 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + e.g. tokens { electronic { protocol: "www.abc.edu" } } -> www.abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/measure.py new file mode 100644 index 0000000..b2005c3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/measure.py @@ -0,0 +1,47 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, delete_space +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { cardinal { negative: "true" integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + pynutil.insert(" ") + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/money.py new file mode 100644 index 0000000..ae8baec --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/money.py @@ -0,0 +1,31 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" morphosyntactic_features: "," fractional_part: "05" currency: "$" } -> $12,05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + insert_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/ordinal.py new file mode 100644 index 0000000..1dc3971 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/ordinal.py @@ -0,0 +1,34 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" morphosyntactic_features: "o" } -> 13º + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + replace_suffix = pynini.union( + pynini.cross(' morphosyntactic_features: "o"', "º"), + pynini.cross(' morphosyntactic_features: "a"', "ª"), + ) + + graph = graph + replace_suffix + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/telephone.py new file mode 100644 index 0000000..8c30c08 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/telephone.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/time.py new file mode 100644 index 0000000..0a408cd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/time.py @@ -0,0 +1,70 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, + e.g. time { hours: "à 1" minutes: "10" } -> à 1:10 + e.g. time { hours: "às 2" minutes: "45" } -> às 2:45 + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + + prefix = ( + pynutil.delete("morphosyntactic_features:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + delete_space + + insert_space + ) + optional_prefix = pynini.closure(prefix, 0, 1) + + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + suffix = ( + delete_space + + insert_space + + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + + graph = ( + optional_prefix + + hour + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + optional_suffix + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/verbalize.py new file mode 100644 index 0000000..f8d4263 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/verbalize.py @@ -0,0 +1,48 @@ +from fun_text_processing.inverse_text_normalization.pt.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.en.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/verbalize_final.py new file mode 100644 index 0000000..c0fc8b2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.pt.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.pt.verbalizers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/whitelist.py new file mode 100644 index 0000000..70240ef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "sexta feira" } -> "sexta-feira" + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/pt/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/pt/verbalizers/word.py new file mode 100644 index 0000000..1d33cd1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/pt/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/__init__.py b/fun_text_processing/inverse_text_normalization/ru/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/ru/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/ru/taggers/cardinal.py new file mode 100644 index 0000000..086ab4e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/cardinal.py @@ -0,0 +1,31 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_DIGIT, GraphFst, insert_space +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals, e.g. + "тысяча один" -> cardinal { integer: "1 001" } + + Args: + tn_cardinal: Text normalization Cardinal graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + + graph = tn_cardinal.cardinal_numbers_default + self.graph = graph.invert().optimize() + + optional_sign = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("минус ", '"-"') + insert_space, 0, 1 + ) + + # do not invert numbers less than 10 + graph = pynini.compose(graph, DAMO_DIGIT ** (2, ...)) + graph = optional_sign + pynutil.insert('integer: "') + graph + pynutil.insert('"') + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/date.py b/fun_text_processing/inverse_text_normalization/ru/taggers/date.py new file mode 100644 index 0000000..1de1224 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/date.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, e.g. + восемнадцатое июня две тысячи второго -> tokens { date { day: "18.06.2002" } } + + Args: + tn_date: Text normalization Date graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_date: GraphFst, deterministic: bool = True): + super().__init__(name="date", kind="classify", deterministic=deterministic) + + graph = pynini.invert(tn_date.final_graph).optimize() + graph = self.add_tokens(pynutil.insert('day: "') + graph + pynutil.insert('"')) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/decimals.py b/fun_text_processing/inverse_text_normalization/ru/taggers/decimals.py new file mode 100644 index 0000000..71a39e6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/decimals.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_SPACE, + GraphFst, + delete_extra_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. "минус три целых две десятых" -> decimal { negative: "true" integer_part: "3," fractional_part: "2" } + + Args: + tn_decimal: Text normalization Decimal graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_decimal, deterministic: bool = False): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("минус", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional_part = pynini.invert(tn_decimal.graph_fractional).optimize() + graph_integer_part = pynini.invert(tn_decimal.integer_part).optimize() + optional_graph_quantity = pynini.invert(tn_decimal.optional_quantity).optimize() + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_fractional_part + pynutil.insert('"') + ) + graph_integer = pynutil.insert('integer_part: "') + graph_integer_part + pynutil.insert('"') + optional_graph_quantity = ( + pynutil.insert('quantity: "') + optional_graph_quantity + pynutil.insert('"') + ) + optional_graph_quantity = pynini.closure( + pynini.accep(DAMO_SPACE) + optional_graph_quantity, 0, 1 + ) + + self.final_graph_wo_sign = ( + graph_integer + pynini.accep(DAMO_SPACE) + graph_fractional + optional_graph_quantity + ) + final_graph = optional_graph_negative + self.final_graph_wo_sign + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/ru/taggers/electronic.py new file mode 100644 index 0000000..f227742 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/electronic.py @@ -0,0 +1,23 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic, e.g. + "эй би собака эн ди точка ру" -> electronic { username: "ab@nd.ru" } + + Args: + tn_electronic: Text normalization Electronic graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_electronic, deterministic: bool = True): + super().__init__(name="electronic", kind="classify", deterministic=deterministic) + + graph = tn_electronic.final_graph + graph = graph.invert().optimize() + graph = pynutil.insert('username: "') + graph + pynutil.insert('"') + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/measure.py b/fun_text_processing/inverse_text_normalization/ru/taggers/measure.py new file mode 100644 index 0000000..b70fc19 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/measure.py @@ -0,0 +1,23 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure, e.g. + "два килограма" -> measure { cardinal { integer: "2 кг" } } + + Args: + tn_measure: Text normalization Cardinal graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_measure, deterministic: bool = True): + super().__init__(name="measure", kind="classify", deterministic=deterministic) + + tn_measure = tn_measure.tagger_graph_default @ tn_measure.verbalizer_graph + graph = tn_measure.invert().optimize() + graph = pynutil.insert('cardinal { integer: "') + graph + pynutil.insert('" }') + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/money.py b/fun_text_processing/inverse_text_normalization/ru/taggers/money.py new file mode 100644 index 0000000..3edd6ff --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/money.py @@ -0,0 +1,23 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money, e.g. + "два рубля" -> money { integer_part: "2 руб." } + + Args: + tn_money: Text normalization Money graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_money, deterministic: bool = True): + super().__init__(name="money", kind="classify", deterministic=deterministic) + + graph = tn_money.final_graph + graph = graph.invert().optimize() + graph = pynutil.insert('integer_part: "') + graph + pynutil.insert('"') + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/ru/taggers/ordinal.py new file mode 100644 index 0000000..8695dcb --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/ordinal.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_DIGIT, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinals, e.g. + "второе" -> ordinal { integer: "2" } } + + Args: + tn_ordinal: Text normalization Ordinal graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_ordinal: GraphFst, deterministic: bool = True): + super().__init__(name="ordinal", kind="classify", deterministic=deterministic) + + tn_ordinal = tn_ordinal.ordinal_numbers + + graph = tn_ordinal.invert().optimize() + self.graph = graph + + # do not invert numbers less than 10 + graph = pynini.compose(graph, DAMO_DIGIT ** (2, ...)) + graph = pynutil.insert('integer: "') + graph + pynutil.insert('"') + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/ru/taggers/telephone.py new file mode 100644 index 0000000..be09c99 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/telephone.py @@ -0,0 +1,23 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone, e.g. + "восемь девятьсот тринадцать девятьсот восемьдесят три пятьдесят шесть ноль один" -> telephone { number_part: "8-913-983-56-01" } + + Args: + tn_telephone: Text normalization telephone graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_telephone: GraphFst, deterministic: bool = True): + super().__init__(name="telephone", kind="classify", deterministic=deterministic) + + tn_telephone = tn_telephone.final_graph + graph = tn_telephone.invert().optimize() + graph = pynutil.insert('number_part: "') + graph + pynutil.insert('"') + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/time.py b/fun_text_processing/inverse_text_normalization/ru/taggers/time.py new file mode 100644 index 0000000..5a5f288 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/time.py @@ -0,0 +1,56 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SPACE, GraphFst +from fun_text_processing.text_normalization.ru.verbalizers.time import TimeFst as TNTimeVerbalizer +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time, e.g. + "два часа пятнадцать минут" -> time { hours: "02:15" } + + Args: + tn_time: Text Normalization Time graph + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, tn_time: GraphFst, deterministic: bool = True): + super().__init__(name="time", kind="classify", deterministic=deterministic) + + tn_time_tagger = tn_time.graph_preserve_order + tn_time_verbalizer = TNTimeVerbalizer().graph + tn_time_graph_preserve_order = pynini.compose(tn_time_tagger, tn_time_verbalizer).optimize() + graph_preserve_order = pynini.invert(tn_time_graph_preserve_order).optimize() + graph_preserve_order = ( + pynutil.insert('hours: "') + graph_preserve_order + pynutil.insert('"') + ) + + # "пятнадцать минут шестого" -> 17:15 + # Requires permutations for the correct verbalization + m_next_h = ( + pynutil.insert('minutes: "') + + pynini.invert(tn_time.minutes).optimize() + + pynutil.insert('"') + + pynini.accep(DAMO_SPACE) + + pynutil.insert('hours: "') + + pynini.invert(tn_time.increment_hour_ordinal).optimize() + + pynutil.insert('"') + ).optimize() + + # "без пятнадцати минут шесть" -> 17:45 + # Requires permutation for the correct verbalization + m_to_h = ( + pynini.cross("без ", 'minutes: "') + + pynini.invert(tn_time.mins_to_h) + + pynutil.insert('"') + + pynini.accep(DAMO_SPACE) + + pynutil.insert('hours: "') + + pynini.invert(tn_time.increment_hour_cardinal).optimize() + + pynutil.insert('"') + ) + + graph_reserve_order = m_next_h | m_to_h + graph = graph_preserve_order | graph_reserve_order + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/ru/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..6f7f231 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/tokenize_and_classify.py @@ -0,0 +1,110 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.en.taggers.word import WordFst +from fun_text_processing.inverse_text_normalization.ru.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ru.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.ru.taggers.decimals import DecimalFst +from fun_text_processing.inverse_text_normalization.ru.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.ru.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.ru.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.ru.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.ru.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.ru.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.ru.taggers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.ru.taggers.tokenize_and_classify import ( + ClassifyFst as TNClassifyFst, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_ru_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars. This might take some time...") + tn_classify = TNClassifyFst( + input_case="cased", deterministic=False, cache_dir=cache_dir, overwrite_cache=True + ) + cardinal = CardinalFst(tn_cardinal=tn_classify.cardinal) + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst(tn_ordinal=tn_classify.ordinal) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(tn_decimal=tn_classify.decimal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(tn_measure=tn_classify.measure).fst + date_graph = DateFst(tn_date=tn_classify.date).fst + word_graph = WordFst().fst + time_graph = TimeFst(tn_time=tn_classify.time).fst + money_graph = MoneyFst(tn_money=tn_classify.money).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst(tn_electronic=tn_classify.electronic).fst + telephone_graph = TelephoneFst(tn_telephone=tn_classify.telephone).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure( + pynutil.add_weight(delete_extra_space, 1.1) + token_plus_punct + ) + + graph = delete_space + graph + delete_space + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/ru/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/ru/taggers/whitelist.py new file mode 100644 index 0000000..8564ff0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/taggers/whitelist.py @@ -0,0 +1,21 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, convert_space +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelist, e.g. + "квартира" -> telephone { number_part: "кв." } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="whitelist", kind="classify", deterministic=deterministic) + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/cardinal.py new file mode 100644 index 0000000..d83043e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/cardinal.py @@ -0,0 +1,41 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing roman numerals + e.g. cardinal { integer: "1 001" } -> 1 001 + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) + + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + + graph = ( + optional_sign + + pynutil.delete('integer: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/date.py new file mode 100644 index 0000000..e1f5307 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/date.py @@ -0,0 +1,16 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { day: "02.03.89" } -> "02.03.89" + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + graph = pynutil.delete('day: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + delete_tokens = self.delete_tokens(graph.optimize()) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/decimal.py new file mode 100644 index 0000000..db730c7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/decimal.py @@ -0,0 +1,35 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "3," fractional_part: "2" } -> -3,2 + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="decimal", kind="verbalize", deterministic=deterministic) + + optional_sign = pynini.closure(pynini.cross('negative: "true" ', "-"), 0, 1) + + integer = pynutil.delete(' "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + integer_part = pynutil.delete("integer_part:") + integer + fractional_part = pynutil.delete("fractional_part:") + integer + optional_quantity = pynini.closure( + pynini.accep(DAMO_SPACE) + pynutil.delete("quantity:") + integer, 0, 1 + ) + + graph = optional_sign + integer_part + delete_space + fractional_part + optional_quantity + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/electronic.py new file mode 100644 index 0000000..585c865 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/electronic.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. electronic { username: "ab@nd.ru" } -> "ab@nd.ru" + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + + graph = ( + pynutil.delete('username: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/measure.py new file mode 100644 index 0000000..55b2d30 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/measure.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure + e.g. measure { cardinal { integer: "2 кг" } } -> "2 кг" + """ + + def __init__(self): + super().__init__(name="measure", kind="verbalize") + + graph = ( + pynutil.delete(' cardinal { integer: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + delete_space + + pynutil.delete("}") + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/money.py new file mode 100644 index 0000000..f1f376c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/money.py @@ -0,0 +1,21 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. money { integer_part: "2 руб." } -> "2 руб." + """ + + def __init__(self): + super().__init__(name="money", kind="verbalize") + + graph = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/ordinal.py new file mode 100644 index 0000000..348b3a9 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/ordinal.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal numbers + e.g. ordinal { integer: "2" } -> "2" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="ordinal", kind="verbalize", deterministic=deterministic) + + value = pynini.closure(DAMO_NOT_QUOTE) + graph = pynutil.delete('integer: "') + value + pynutil.delete('"') + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/telephone.py new file mode 100644 index 0000000..9fb3fec --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/telephone.py @@ -0,0 +1,21 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone + e.g. telephone { number_part: "8-913-983-56-01" } -> "8-913-983-56-01" + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + graph = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/time.py new file mode 100644 index 0000000..92889dd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/time.py @@ -0,0 +1,40 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time + e.g. time { hours: "02:15" } -> "02:15" + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + hour = ( + pynutil.delete("hours: ") + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + minutes = ( + pynutil.delete("minutes: ") + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph_preserve_order = ( + pynutil.delete('hours: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + + # for cases that require permutations for the correct verbalization + graph_reverse_order = hour + delete_space + pynutil.insert(":") + minutes + delete_space + + graph = graph_preserve_order | graph_reverse_order + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/verbalize.py new file mode 100644 index 0000000..a9e4aed --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/verbalize.py @@ -0,0 +1,50 @@ +from fun_text_processing.inverse_text_normalization.en.verbalizers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.time import TimeFst +from fun_text_processing.text_normalization.en.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal = OrdinalFst() + ordinal_graph = ordinal.fst + decimal = DecimalFst() + decimal_graph = decimal.fst + whitelist_graph = WhiteListFst().fst + electronic_graph = ElectronicFst().fst + money_graph = MoneyFst().fst + date_graph = DateFst().fst + measure_graph = MeasureFst().fst + telephone_graph = TelephoneFst().fst + time_graph = TimeFst().fst + + graph = ( + whitelist_graph + | cardinal_graph + | ordinal_graph + | decimal_graph + | electronic_graph + | date_graph + | money_graph + | measure_graph + | telephone_graph + | time_graph + ) + + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/ru/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/ru/verbalizers/verbalize_final.py new file mode 100644 index 0000000..05d50ca --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/ru/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.en.verbalizers.word import WordFst +from fun_text_processing.inverse_text_normalization.ru.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/run_evaluate.py b/fun_text_processing/inverse_text_normalization/run_evaluate.py new file mode 100644 index 0000000..76e6e3c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/run_evaluate.py @@ -0,0 +1,114 @@ +from argparse import ArgumentParser + +from fun_text_processing.inverse_text_normalization.inverse_normalize import InverseNormalizer +from fun_text_processing.text_normalization.data_loader_utils import ( + evaluate, + known_types, + load_files, + training_data_to_sentences, + training_data_to_tokens, +) + + +""" +Runs Evaluation on data in the format of : \t\t<`self` if trivial class or normalized text> +like the Google text normalization data https://www.kaggle.com/richardwilliamsproat/text-normalization-for-english-russian-and-polish +""" + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument("--input", help="input file path", type=str) + parser.add_argument( + "--lang", + help="language", + choices=["en", "id", "ja", "de", "es", "pt", "ru", "fr", "vi", "ko", "zh", "fil"], + default="en", + type=str, + ) + parser.add_argument( + "--cat", + dest="category", + help="focus on class only (" + ", ".join(known_types) + ")", + type=str, + default=None, + choices=known_types, + ) + parser.add_argument( + "--filter", action="store_true", help="clean data for inverse normalization purposes" + ) + return parser.parse_args() + + +if __name__ == "__main__": + # Example usage: + # python run_evaluate.py --input= --cat= --filter + args = parse_args() + if args.lang == "en": + from fun_text_processing.inverse_text_normalization.en.clean_eval_data import ( + filter_loaded_data, + ) + file_path = args.input + inverse_normalizer = InverseNormalizer() + + print("Loading training data: " + file_path) + training_data = load_files([file_path]) + + if args.filter: + training_data = filter_loaded_data(training_data) + + if args.category is None: + print("Sentence level evaluation...") + sentences_un_normalized, sentences_normalized, _ = training_data_to_sentences(training_data) + print("- Data: " + str(len(sentences_normalized)) + " sentences") + sentences_prediction = inverse_normalizer.inverse_normalize_list(sentences_normalized) + print("- Denormalized. Evaluating...") + sentences_accuracy = evaluate( + preds=sentences_prediction, labels=sentences_un_normalized, input=sentences_normalized + ) + print("- Accuracy: " + str(sentences_accuracy)) + + print("Token level evaluation...") + tokens_per_type = training_data_to_tokens(training_data, category=args.category) + token_accuracy = {} + for token_type in tokens_per_type: + print("- Token type: " + token_type) + tokens_un_normalized, tokens_normalized = tokens_per_type[token_type] + print(" - Data: " + str(len(tokens_normalized)) + " tokens") + tokens_prediction = inverse_normalizer.inverse_normalize_list(tokens_normalized) + print(" - Denormalized. Evaluating...") + token_accuracy[token_type] = evaluate( + tokens_prediction, tokens_un_normalized, input=tokens_normalized + ) + print(" - Accuracy: " + str(token_accuracy[token_type])) + token_count_per_type = { + token_type: len(tokens_per_type[token_type][0]) for token_type in tokens_per_type + } + token_weighted_accuracy = [ + token_count_per_type[token_type] * accuracy + for token_type, accuracy in token_accuracy.items() + ] + print("- Accuracy: " + str(sum(token_weighted_accuracy) / sum(token_count_per_type.values()))) + + print(" - Total: " + str(sum(token_count_per_type.values())), "\n") + + for token_type in token_accuracy: + if token_type not in known_types: + raise ValueError("Unexpected token type: " + token_type) + + if args.category is None: + c1 = ["Class", "sent level"] + known_types + c2 = ["Num Tokens", len(sentences_normalized)] + [ + token_count_per_type[known_type] if known_type in tokens_per_type else "0" + for known_type in known_types + ] + c3 = ["Denormalization", sentences_accuracy] + [ + token_accuracy[known_type] if known_type in token_accuracy else "0" + for known_type in known_types + ] + + for i in range(len(c1)): + print(f"{str(c1[i]):10s} | {str(c2[i]):10s} | {str(c3[i]):5s}") + else: + print(f"numbers\t{token_count_per_type[args.category]}") + print(f"Denormalization\t{token_accuracy[args.category]}") diff --git a/fun_text_processing/inverse_text_normalization/tl/__init__.py b/fun_text_processing/inverse_text_normalization/tl/__init__.py new file mode 100644 index 0000000..9cd5f7b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.tl.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.tl.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/tl/clean_eval_data.py b/fun_text_processing/inverse_text_normalization/tl/clean_eval_data.py new file mode 100644 index 0000000..e975bf5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/clean_eval_data.py @@ -0,0 +1,384 @@ +from argparse import ArgumentParser +from typing import List + +import regex as re +from fun_text_processing.text_normalization.data_loader_utils import ( + EOS_TYPE, + Instance, + load_files, + training_data_to_sentences, +) + + +""" +This file is for evaluation purposes. +filter_loaded_data() cleans data (list of instances) for inverse text normalization. Filters and cleaners can be specified for each semiotic class individually. +For example, normalized text should only include characters and whitespace characters but no punctuation. + Cardinal unnormalized instances should contain at least one integer and all other characters are removed. +""" + + +class Filter: + """ + Filter class + + Args: + class_type: semiotic class used in dataset + process_func: function to transform text + filter_func: function to filter text + + """ + + def __init__(self, class_type: str, process_func: object, filter_func: object): + self.class_type = class_type + self.process_func = process_func + self.filter_func = filter_func + + def filter(self, instance: Instance) -> bool: + """ + filter function + + Args: + filters given instance with filter function + + Returns: True if given instance fulfills criteria or does not belong to class type + """ + if instance.token_type != self.class_type: + return True + return self.filter_func(instance) + + def process(self, instance: Instance) -> Instance: + """ + process function + + Args: + processes given instance with process function + + Returns: processed instance if instance belongs to expected class type or original instance + """ + if instance.token_type != self.class_type: + return instance + return self.process_func(instance) + + +def filter_cardinal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_cardinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[^0-9]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_ordinal_1(instance: Instance) -> bool: + ok = re.search(r"(st|nd|rd|th)\s*$", instance.un_normalized) + return ok + + +def process_ordinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[,\s]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_decimal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_decimal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_measure_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_measure_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"m2", "m²", un_normalized) + un_normalized = re.sub(r"(\d)([^\d.\s])", r"\1 \2", un_normalized) + normalized = re.sub(r"[^a-z\s]", "", normalized) + normalized = re.sub(r"per ([a-z\s]*)s$", r"per \1", normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_money_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_money_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"a\$", r"$", un_normalized) + un_normalized = re.sub(r"us\$", r"$", un_normalized) + un_normalized = re.sub(r"(\d)m\s*$", r"\1 million", un_normalized) + un_normalized = re.sub(r"(\d)bn?\s*$", r"\1 billion", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_time_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_time_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r": ", ":", un_normalized) + un_normalized = re.sub(r"(\d)\s?a\s?m\s?", r"\1 a.m.", un_normalized) + un_normalized = re.sub(r"(\d)\s?p\s?m\s?", r"\1 p.m.", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_plain_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_plain_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_punct_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_punct_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_date_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_date_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_letters_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_letters_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_verbatim_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_verbatim_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_digit_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_digit_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_telephone_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_telephone_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_electronic_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_electronic_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_fraction_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_fraction_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_address_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_address_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +filters = [] +filters.append( + Filter(class_type="CARDINAL", process_func=process_cardinal_1, filter_func=filter_cardinal_1) +) +filters.append( + Filter(class_type="ORDINAL", process_func=process_ordinal_1, filter_func=filter_ordinal_1) +) +filters.append( + Filter(class_type="DECIMAL", process_func=process_decimal_1, filter_func=filter_decimal_1) +) +filters.append( + Filter(class_type="MEASURE", process_func=process_measure_1, filter_func=filter_measure_1) +) +filters.append(Filter(class_type="MONEY", process_func=process_money_1, filter_func=filter_money_1)) +filters.append(Filter(class_type="TIME", process_func=process_time_1, filter_func=filter_time_1)) + +filters.append(Filter(class_type="DATE", process_func=process_date_1, filter_func=filter_date_1)) +filters.append(Filter(class_type="PLAIN", process_func=process_plain_1, filter_func=filter_plain_1)) +filters.append(Filter(class_type="PUNCT", process_func=process_punct_1, filter_func=filter_punct_1)) +filters.append( + Filter(class_type="LETTERS", process_func=process_letters_1, filter_func=filter_letters_1) +) +filters.append( + Filter(class_type="VERBATIM", process_func=process_verbatim_1, filter_func=filter_verbatim_1) +) +filters.append(Filter(class_type="DIGIT", process_func=process_digit_1, filter_func=filter_digit_1)) +filters.append( + Filter(class_type="TELEPHONE", process_func=process_telephone_1, filter_func=filter_telephone_1) +) +filters.append( + Filter( + class_type="ELECTRONIC", process_func=process_electronic_1, filter_func=filter_electronic_1 + ) +) +filters.append( + Filter(class_type="FRACTION", process_func=process_fraction_1, filter_func=filter_fraction_1) +) +filters.append( + Filter(class_type="ADDRESS", process_func=process_address_1, filter_func=filter_address_1) +) +filters.append(Filter(class_type=EOS_TYPE, process_func=lambda x: x, filter_func=lambda x: True)) + + +def filter_loaded_data(data: List[Instance], verbose: bool = False) -> List[Instance]: + """ + Filters list of instances + + Args: + data: list of instances + + Returns: filtered and transformed list of instances + """ + updates_instances = [] + for instance in data: + updated_instance = False + for fil in filters: + if fil.class_type == instance.token_type and fil.filter(instance): + instance = fil.process(instance) + updated_instance = True + if updated_instance: + if verbose: + print(instance) + updates_instances.append(instance) + return updates_instances + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument( + "--input", help="input file path", type=str, default="./en_with_types/output-00001-of-00100" + ) + parser.add_argument("--verbose", help="print filtered instances", action="store_true") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + file_path = args.input + + print("Loading training data: " + file_path) + instance_list = load_files([file_path]) # List of instances + filtered_instance_list = filter_loaded_data(instance_list, args.verbose) + training_data_to_sentences(filtered_instance_list) diff --git a/fun_text_processing/inverse_text_normalization/tl/data/__init__.py b/fun_text_processing/inverse_text_normalization/tl/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/tl/data/currency.tsv b/fun_text_processing/inverse_text_normalization/tl/data/currency.tsv new file mode 100644 index 0000000..ecf5906 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/currency.tsv @@ -0,0 +1,35 @@ +$ dolyar +$ us dollar +$ united states dollar +£ british pound +€ euro +₩ nanalo +nzd new zealand dolyar +rs rupee +chf swiss franc +dkk danish kroner +fim finnish markka +aed dirham ng emirates ng arab +¥ yen +czk czech koruna +mro mauritanian ouguiya +pkr pakistani rupee +crc costa rican colon +hk$ hong kong dolyar +npr nepalese rupee +awg aruban florin +nok norwegian kroner +tzs tanzanian shilling +sek swedish kronor +cyp cypriot pound +r real +sar saudi riyal +cve cape verde escudo +rsd serbian dinar +dm markang aleman +shp saint helena pounds +php philippine peso +cad canadian dollar +ssp timog sudanese pound +scr seychelles rupee +mvr maldivian rufiyaa diff --git a/fun_text_processing/inverse_text_normalization/tl/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/tl/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/tl/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/tl/data/electronic/domain.tsv new file mode 100644 index 0000000..207a14a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/electronic/domain.tsv @@ -0,0 +1,10 @@ +com +uk +fr +net +br +in +ru +de +it +ai diff --git a/fun_text_processing/inverse_text_normalization/tl/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/tl/data/electronic/server_name.tsv new file mode 100644 index 0000000..ca7f97b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast +google diff --git a/fun_text_processing/inverse_text_normalization/tl/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/tl/data/electronic/symbols.tsv new file mode 100644 index 0000000..5be8da8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/electronic/symbols.tsv @@ -0,0 +1,22 @@ +. dot +- dash +- hyphen +_ underscore +! exclamation mark +# number sign +$ dollar sign +% percent sign +& ampersand +' quote +* asterisk ++ plus +/ slash += equal sign +? question mark +^ circumflex +` right single quote +{ left brace +| vertical bar +} right brace +~ tilde +, comma \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/tl/data/magnitudes.tsv b/fun_text_processing/inverse_text_normalization/tl/data/magnitudes.tsv new file mode 100644 index 0000000..9f30394 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/magnitudes.tsv @@ -0,0 +1,4 @@ +k libo +m milyon +b bilyon +t trilyon diff --git a/fun_text_processing/inverse_text_normalization/tl/data/measurements.tsv b/fun_text_processing/inverse_text_normalization/tl/data/measurements.tsv new file mode 100644 index 0000000..6801b7b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/measurements.tsv @@ -0,0 +1,109 @@ +f fahrenheit +c celsius +km kilometer +m meter +cm centimeter +mm millimeter +ha hectare +mi mile +m² square meter +km² square kilometer +ft foot +% percent +hz hertz +kw kilowatt +hp horsepower +mg milligram +kg kilogram +ghz gigahertz +khz kilohertz +mhz megahertz +v volt +h hour +mc mega coulomb +s second +nm nanometer +rpm revolution per minute +min minute +mA milli ampere +% per cent +kwh kilo watt hour +m³ cubic meter +mph mile per hour +tw tera watt +mv milli volt +mw megawatt +μm micrometer +" inch +tb terabyte +cc c c +g gram +da dalton +atm atmosphere +ω ohm +db decibel +ps peta second +oz ounce +hl hecto liter +μg microgram +pg petagram +gb gigabyte +kb kilobit +ev electron volt +mb megabyte +kb kilobyte +kbps kilobit per second +mbps megabit per second +st stone +kl kilo liter +tj tera joule +kv kilo volt +mv mega volt +kn kilonewton +mm megameter +au astronomical unit +yd yard +rad radian +lm lumen +hs hecto second +mol mole +gpa giga pascal +ml milliliter +gw gigawatt +ma mega ampere +kt knot +kgf kilogram force +ng nano gram +ns nanosecond +ms mega siemens +bar bar +gl giga liter +μs microsecond +da deci ampere +pa pascal +ds deci second +ms milli second +dm deci meter +dm³ cubic deci meter +amu atomic mass unit +mb megabit +mf mega farad +bq becquerel +pb petabit +mm² square millimeter +cm² square centimeter +sq mi square mile +sq ft square foot +kpa kilopascal +cd candela +tl tera liter +ms mega second +mpa megapascal +pm peta meter +pb peta byte +gwh giga watt hour +kcal kilo calory +gy gray +sv sievert +cwt hundredweight +cc c c diff --git a/fun_text_processing/inverse_text_normalization/tl/data/months.tsv b/fun_text_processing/inverse_text_normalization/tl/data/months.tsv new file mode 100644 index 0000000..d0f2f6d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/months.tsv @@ -0,0 +1,12 @@ +enero +pebrero +martsa +abril +maaaring +hunyo +hulyo +agosto +september +oktubre +nobyembre +disyembre diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/tl/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit.tsv new file mode 100644 index 0000000..42b3927 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit.tsv @@ -0,0 +1,9 @@ +isa 1 +dalawa 2 +tatlo 3 +apat 4 +lima 5 +anim 6 +pito 7 +walo 8 +siyam 9 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties.tsv new file mode 100644 index 0000000..eeec85e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties.tsv @@ -0,0 +1,9 @@ +isang 1 +dalawang 2 +tatlong 3 +apat na 4 +limang 5 +anim na 6 +pitong 7 +walong 8 +siyam na 9 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties1.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties1.tsv new file mode 100644 index 0000000..b7e57b2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties1.tsv @@ -0,0 +1,7 @@ +isang 1 +dalawang 2 +tatlong 3 +limang 5 +anim na 6 +pitong 7 +walong 8 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties2.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties2.tsv new file mode 100644 index 0000000..6e364a0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/digit_ties2.tsv @@ -0,0 +1,2 @@ +apat na 4 +siyam na 9 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/hundred.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/hundred.tsv new file mode 100644 index 0000000..240305f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/hundred.tsv @@ -0,0 +1 @@ +daan diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/teen.tsv new file mode 100644 index 0000000..7782a1f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/teen.tsv @@ -0,0 +1,18 @@ +sampu 10 +labing-isa 11 +labindalawa 12 +labintatlo 13 +labing-apat 14 +labinlima 15 +labing-anim 16 +labimpito 17 +labingwalo 18 +labinsiyam 19 +dalawampu 20 +tatlumpu 30 +apatnapu 40 +limampu 50 +animnapu 60 +pitumpu 70 +walumpu 80 +siyamnapu 90 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/thousands.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/thousands.tsv new file mode 100644 index 0000000..08d6879 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/thousands.tsv @@ -0,0 +1,22 @@ +libo +milyon +bilyon +trilyon +quadrillion +quintillion +sextillion +septillion +octillion +nonillion +decillion +undecillion +duodecillion +tredecillion +quattuordecillion +quindecillion +sexdecillion +septendecillion +octodecillion +novemdecillion +viintillion +centillion diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/ties.tsv new file mode 100644 index 0000000..7c0061a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/ties.tsv @@ -0,0 +1,8 @@ +dalawampu't 2 +tatlumpu't 3 +apatnapu't 4 +limampu't 5 +animnapu't 6 +pitumpu't 7 +walumpu't 8 +siyamnapu't 9 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/tl/data/numbers/zero.tsv new file mode 100644 index 0000000..5cd1109 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/numbers/zero.tsv @@ -0,0 +1 @@ +sero 0 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/tl/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/tl/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/tl/data/ordinals/digit.tsv new file mode 100644 index 0000000..1958816 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/ordinals/digit.tsv @@ -0,0 +1,9 @@ +una isa +pangalawang dalawa +pangatlo tatlo +ikaapat apat +ikalimang lima +ikaanim ikaanim +ikapitong pito +ikawalo walo +ikasiyam siyam diff --git a/fun_text_processing/inverse_text_normalization/tl/data/ordinals/teen.tsv b/fun_text_processing/inverse_text_normalization/tl/data/ordinals/teen.tsv new file mode 100644 index 0000000..d639eaf --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/ordinals/teen.tsv @@ -0,0 +1 @@ +ikalabindalawa labindalawa diff --git a/fun_text_processing/inverse_text_normalization/tl/data/suppletive.tsv b/fun_text_processing/inverse_text_normalization/tl/data/suppletive.tsv new file mode 100644 index 0000000..115460a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/suppletive.tsv @@ -0,0 +1,83 @@ +deer +fish +sheep +foot feet +goose geese +man men +mouse mice +tooth teeth +woman women +won +child children +ox oxen +wife wives +wolf wolves +analysis analyses +criterion criteria +lbs +focus foci +percent +hertz +kroner krone +inch inches +calory calories +yen +megahertz +gigahertz +kilohertz +hertz +CC +c c +horsepower +hundredweight +kilogram force kilograms force +mega siemens +revolution per minute revolutions per minute +mile per hour miles per hour +megabit per second megabits per second +square foot square feet +kilobit per second kilobits per second +degree Celsius degrees Celsius +degree Fahrenheit degrees Fahrenheit +ATM +AU +BQ +CC +CD +DA +EB +EV +F +GB +G +GL +GPA +GY +HA +H +HL +GP +HS +KB +KL +KN +KT +KV +LM +MA +MA +MB +MC +MF +M +MM +MS +MV +MW +PB +PG +PS +S +TB +YB +ZB \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/tl/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/tl/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/tl/data/time/minute_to.tsv b/fun_text_processing/inverse_text_normalization/tl/data/time/minute_to.tsv new file mode 100644 index 0000000..edab4d5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/time/minute_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 diff --git a/fun_text_processing/inverse_text_normalization/tl/data/time/time_suffix.tsv b/fun_text_processing/inverse_text_normalization/tl/data/time/time_suffix.tsv new file mode 100644 index 0000000..b39a9ef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/time/time_suffix.tsv @@ -0,0 +1,8 @@ +p m p.m. +pm p.m. +p.m. +p.m p.m. +am a.m. +a.m. +a.m a.m. +a m a.m. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/tl/data/time/time_zone.tsv b/fun_text_processing/inverse_text_normalization/tl/data/time/time_zone.tsv new file mode 100644 index 0000000..3e0ade4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t diff --git a/fun_text_processing/inverse_text_normalization/tl/data/time/to_hour.tsv b/fun_text_processing/inverse_text_normalization/tl/data/time/to_hour.tsv new file mode 100644 index 0000000..1b006ea --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/time/to_hour.tsv @@ -0,0 +1,12 @@ +one 12 +two 1 +three 2 +four 3 +five 4 +six 5 +seven 6 +eigh 7 +nine 8 +ten 9 +eleven 10 +twelve 11 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/tl/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/tl/data/whitelist.tsv new file mode 100644 index 0000000..7eed41e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/data/whitelist.tsv @@ -0,0 +1,12 @@ +e.g. for example +dr. doctor +mr. mister +mrs. misses +st. saint +7-eleven seven eleven +es3 e s three +s&p s and p +ASAP a s a p +AT&T a t and t +LLP l l p +ATM a t m diff --git a/fun_text_processing/inverse_text_normalization/tl/graph_utils.py b/fun_text_processing/inverse_text_normalization/tl/graph_utils.py new file mode 100644 index 0000000..1b63009 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/graph_utils.py @@ -0,0 +1,209 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from pynini import Far +from pynini.examples import plurals +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +delete_zero_or_one_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE, 0, 1)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") +delete_preserve_order = pynini.closure( + pynutil.delete(" preserve_order: true") + | (pynutil.delete(' field_order: "') + DAMO_NOT_QUOTE + pynutil.delete('"')) +) + +suppletive = pynini.string_file(get_abs_path("data/suppletive.tsv")) +# _v = pynini.union("a", "e", "i", "o", "u") +_c = pynini.union( + "b", + "c", + "d", + "f", + "g", + "h", + "j", + "k", + "l", + "m", + "n", + "p", + "q", + "r", + "s", + "t", + "v", + "w", + "x", + "y", + "z", +) +_ies = DAMO_SIGMA + _c + pynini.cross("y", "ies") +_es = DAMO_SIGMA + pynini.union("s", "sh", "ch", "x", "z") + pynutil.insert("es") +_s = DAMO_SIGMA + pynutil.insert("s") + +graph_plural = plurals._priority_union( + suppletive, + plurals._priority_union(_ies, plurals._priority_union(_es, _s, DAMO_SIGMA), DAMO_SIGMA), + DAMO_SIGMA, +).optimize() + +SINGULAR_TO_PLURAL = graph_plural +PLURAL_TO_SINGULAR = pynini.invert(graph_plural) +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) +MIN_NEG_WEIGHT = -0.0001 +MIN_POS_WEIGHT = 0.0001 + + +def generator_main(file_name: str, graphs: Dict[str, "pynini.FstLike"]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def get_plurals(fst): + """ + Given singular returns plurals + + Args: + fst: Fst + + Returns plurals to given singular forms + """ + return SINGULAR_TO_PLURAL @ fst + + +def get_singulars(fst): + """ + Given plural returns singulars + + Args: + fst: Fst + + Returns singulars to given plural forms + """ + return PLURAL_TO_SINGULAR @ fst + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + + Args: + fst: input fst + + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/tl/taggers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/tl/taggers/cardinal.py new file mode 100644 index 0000000..6beb339 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/cardinal.py @@ -0,0 +1,201 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path, num_to_word +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. minus twenty three -> cardinal { integer: "23" negative: "-" } } + Numbers below thirteen are not converted. + """ + + def __init__(self): + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + + graph_digit_ties_all = pynini.string_file(get_abs_path("data/numbers/digit_ties.tsv")) + + graph_digit_ties1 = pynini.string_file(get_abs_path("data/numbers/digit_ties1.tsv")) + graph_digit_ties2 = pynini.string_file(get_abs_path("data/numbers/digit_ties2.tsv")) + + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + + graph_teens_using_ties = graph_ties + pynini.cross(" ", "") + graph_digit + + addzero = pynutil.insert("0") + zero = graph_zero + + ##一位数 + graph_digits = graph_digit | graph_zero + digits = graph_digits + digit = graph_digit + digit_ties = graph_digit_ties1 | graph_digit_ties2 + + ##两位数 + graph_teens = graph_teen | graph_teens_using_ties + teens = graph_teens + + ##三位数, daan 百,raan 百(只有4和9的时候) + graph_hundred1 = pynutil.delete("daan") + graph_hundred2 = pynutil.delete("raan") + graph_at = pynutil.delete("at") + + delete_at = graph_at + + graph_hundred_component1 = graph_digit_ties1 + delete_space + graph_hundred1 + graph_hundred_component2 = graph_digit_ties2 + delete_space + graph_hundred2 + + graph_hundred_component = graph_hundred_component1 | graph_hundred_component2 + + hundred = (graph_hundred_component + pynutil.insert("00")) | ( + graph_hundred_component + + delete_space + + delete_at + + delete_space + + ( + teens + | pynutil.add_weight(addzero + digit, 0.1) + | pynutil.add_weight(digit + addzero, 0.5) + ) + ) + graph_hundred_component_at_least_one_none_zero_digit = hundred @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) + + ##千, libo 表示千 + thousand = ( + (hundred | teens | digit_ties) + + delete_space + + pynutil.delete("libo") + + delete_space + + ( + hundred + | (delete_at + delete_space).ques + pynutil.add_weight(addzero + teens, 0.1) + | (delete_at + delete_space).ques + pynutil.add_weight(addzero**2 + digit, 0.5) + | pynutil.add_weight(digit + addzero**2, 0.8) + | pynutil.add_weight(addzero**3, 1.0) + ) + ) + + ##百万,milyon表示百万 + # million = (((hundred | teens | digit_ties) + delete_space + pynutil.delete("milyon") | pynutil.insert("000", weight=0.1))+ delete_space + ( + # thousand + # | pynutil.add_weight(addzero + hundred, 0.1) + # | (delete_at + delete_space).ques + pynutil.add_weight(addzero**2 + teens, 0.5) + # | (delete_at + delete_space).ques + pynutil.add_weight(addzero + addzero + addzero + digit, 0.5) + # | pynutil.add_weight(digit + addzero**3, 0.8) + # | pynutil.add_weight(addzero**4, 1.0))) + + graph_million = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("milyon"), + pynutil.insert("000", weight=0.1), + ) + + ##bilyon bilyon表示十亿 + graph_billion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("bilyon"), + pynutil.insert("000", weight=0.1), + ) + + ##trilyon trilyon表示兆 + graph_trillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("trilyon"), + pynutil.insert("000", weight=0.1), + ) + + ## + graph_quadrillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("quadrilyon"), + pynutil.insert("000", weight=0.1), + ) + graph_quintillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("quintilyon"), + pynutil.insert("000", weight=0.1), + ) + graph_sextillion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("sextilyon"), + pynutil.insert("000", weight=0.1), + ) + + # + graph = pynini.union( + graph_sextillion + + delete_space + + graph_quintillion + + delete_space + + graph_quadrillion + + delete_space + + graph_trillion + + delete_space + + graph_billion + + delete_space + + graph_million + + delete_space + + thousand + + delete_space + + graph_hundred_component, + thousand, + hundred, + teens, + digits, + graph_zero, + ) + + # graph = zero | digits | teens | hundred | thousand | million + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + labels_exception = [num_to_word(x) for x in range(0, 13)] + graph_exception = pynini.union(*labels_exception) + + # graph = ( + # pynini.cdrewrite(pynutil.delete("and"), DAMO_SPACE, DAMO_SPACE, DAMO_SIGMA) + # @ (DAMO_ALPHA + DAMO_SIGMA) + # @ graph + # ) + + self.graph_no_exception = graph + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus", '"-"') + DAMO_SPACE, 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/date.py b/fun_text_processing/inverse_text_normalization/tl/taggers/date.py new file mode 100644 index 0000000..fac6f0e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/date.py @@ -0,0 +1,150 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + +graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")).optimize() +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize() +ties_graph = pynini.string_file(get_abs_path("data/numbers/ties.tsv")).optimize() + + +def _get_month_graph(): + """ + Transducer for month, e.g. march -> march + """ + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + return month_graph + + +def _get_ties_graph(): + """ + Transducer for 20-99 e.g + twenty three -> 23 + """ + graph = ties_graph + (delete_space + graph_digit | pynutil.insert("0")) + return graph + + +def _get_range_graph(): + """ + Transducer for decades (1**0s, 2**0s), centuries (2*00s, 1*00s), millennia (2000s) + """ + graph_ties = _get_ties_graph() + graph = (graph_ties | graph_teen) + delete_space + pynini.cross("hundreds", "00s") + graph |= pynini.cross("two", "2") + delete_space + pynini.cross("thousands", "000s") + graph |= ( + (graph_ties | graph_teen) + + delete_space + + (pynini.closure(DAMO_ALPHA, 1) + (pynini.cross("ies", "y") | pynutil.delete("s"))) + @ (graph_ties | pynini.cross("ten", "10")) + + pynutil.insert("s") + ) + graph @= pynini.union("1", "2") + DAMO_DIGIT + DAMO_DIGIT + DAMO_DIGIT + "s" + return graph + + +def _get_year_graph(): + """ + Transducer for year, e.g. twenty twenty -> 2020 + """ + + def _get_digits_graph(): + zero = pynini.cross((pynini.accep("oh") | pynini.accep("o")), "0") + graph = zero + delete_space + graph_digit + graph.optimize() + return graph + + def _get_thousands_graph(): + graph_ties = _get_ties_graph() + graph_hundred_component = ( + graph_digit + delete_space + pynutil.delete("hundred") + ) | pynutil.insert("0") + graph = ( + graph_digit + + delete_space + + pynutil.delete("thousand") + + delete_space + + graph_hundred_component + + delete_space + + (graph_teen | graph_ties) + ) + return graph + + graph_ties = _get_ties_graph() + graph_digits = _get_digits_graph() + graph_thousands = _get_thousands_graph() + year_graph = ( + # 20 19, 40 12, 2012 - assuming no limit on the year + (graph_teen + delete_space + (graph_ties | graph_digits | graph_teen)) + | (graph_ties + delete_space + (graph_ties | graph_digits | graph_teen)) + | graph_thousands + ) + year_graph.optimize() + return year_graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. january fifth twenty twelve -> date { month: "january" day: "5" year: "2012" preserve_order: true } + e.g. the fifth of january twenty twelve -> date { day: "5" month: "january" year: "2012" preserve_order: true } + e.g. twenty twenty -> date { year: "2012" preserve_order: true } + + Args: + ordinal: OrdinalFst + """ + + def __init__(self, ordinal: GraphFst): + super().__init__(name="date", kind="classify") + + ordinal_graph = ordinal.graph + year_graph = _get_year_graph() + YEAR_WEIGHT = 0.001 + year_graph = pynutil.add_weight(year_graph, YEAR_WEIGHT) + month_graph = _get_month_graph() + + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + + day_graph = ( + pynutil.insert('day: "') + pynutil.add_weight(ordinal_graph, -0.7) + pynutil.insert('"') + ) + graph_year = ( + delete_extra_space + + pynutil.insert('year: "') + + pynutil.add_weight(year_graph, -YEAR_WEIGHT) + + pynutil.insert('"') + ) + optional_graph_year = pynini.closure( + graph_year, + 0, + 1, + ) + graph_mdy = month_graph + ( + (delete_extra_space + day_graph) + | graph_year + | (delete_extra_space + day_graph + graph_year) + ) + graph_dmy = ( + pynutil.delete("the") + + delete_space + + day_graph + + delete_space + + pynutil.delete("of") + + delete_extra_space + + month_graph + + optional_graph_year + ) + graph_year = ( + pynutil.insert('year: "') + (year_graph | _get_range_graph()) + pynutil.insert('"') + ) + + final_graph = graph_mdy | graph_dmy | graph_year + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/tl/taggers/decimal.py new file mode 100644 index 0000000..24516f7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/decimal.py @@ -0,0 +1,99 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. one million -> integer_part: "1" quantity: "million" + e.g. one point five million -> integer_part: "1" fractional_part: "5" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + numbers = cardinal_up_to_hundred @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + suffix = pynini.union("milyon", "bilyon", "trilyon", "quadrilyon", "quintilyon", "sextilyon") + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + ) + res |= ( + decimal + + delete_extra_space + + pynutil.insert('quantity: "') + + (suffix | "libo") + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. minus twelve point five o o six billion -> decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } + e.g. one billion -> decimal { integer_part: "1" quantity: "billion" } + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_decimal = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_decimal |= pynini.string_file(get_abs_path("data/numbers/zero.tsv")) | pynini.cross( + "o", "0" + ) + + graph_decimal = pynini.closure(graph_decimal + delete_space) + graph_decimal + + self.graph = graph_decimal + + point = pynini.cross("punto", "") + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus", '"true"') + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + point + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/tl/taggers/electronic.py new file mode 100644 index 0000000..fcf7a89 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/electronic.py @@ -0,0 +1,101 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_ALPHA, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. c d f one at a b c dot e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("dot", ".") + username = ( + alpha_num + pynini.closure(delete_extra_space + accepted_username) + ) | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + username = pynutil.insert('username: "') + username + pynutil.insert('"') + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete("at") + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("w w w", "www"), "www") + protocol_start = ( + pynini.cross("h t t p", "http") | pynini.cross("h t t p s", "https") + ) + pynini.cross(" colon slash slash ", "://") + # .com, + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + ( + domain + | pynini.closure( + accepted_username + delete_extra_space, + ) + + accepted_username + ) + ) + + protocol_default = ( + ( + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + ) + + pynini.closure(ending, 1) + ).optimize() + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + protocol_default + ).optimize() + + protocol |= ( + pynini.closure(protocol_end + delete_extra_space + process_dot, 0, 1) + protocol_default + ) + + protocol = pynutil.insert('protocol: "') + protocol.optimize() + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/tl/taggers/fraction.py new file mode 100644 index 0000000..f1de69f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/fraction.py @@ -0,0 +1,11 @@ +from fun_text_processing.inverse_text_normalization.tl.graph_utils import GraphFst + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + """ + + def __init__(self): + super().__init__(name="fraction", kind="classify") + # integer_part # numerator # denominator diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/measure.py b/fun_text_processing/inverse_text_normalization/tl/taggers/measure.py new file mode 100644 index 0000000..6b4e145 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/measure.py @@ -0,0 +1,97 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. minus twelve kilograms -> measure { negative: "true" cardinal { integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_unit = pynini.string_file(get_abs_path("data/measurements.tsv")) + graph_unit_singular = pynini.invert(graph_unit) # singular -> abbr + graph_unit_plural = get_singulars(graph_unit_singular) # plural -> abbr + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("minus", '"true"') + delete_extra_space, + 0, + 1, + ) + + unit_singular = convert_space(graph_unit_singular) + unit_plural = convert_space(graph_unit_plural) + unit_misc = ( + pynutil.insert("/") + + pynutil.delete("per") + + delete_space + + convert_space(graph_unit_singular) + ) + + unit_singular = ( + pynutil.insert('units: "') + + ( + unit_singular + | unit_misc + | pynutil.add_weight(unit_singular + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + unit_plural = ( + pynutil.insert('units: "') + + ( + unit_plural + | unit_misc + | pynutil.add_weight(unit_plural + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "one") @ cardinal_graph) + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_plural + ) + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + pynini.cross("one", "1") + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/money.py b/fun_text_processing/inverse_text_normalization/tl/taggers/money.py new file mode 100644 index 0000000..822ef38 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/money.py @@ -0,0 +1,110 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. twelve dollars and five cents -> money { integer_part: "12" fractional_part: 05 currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + # add support for missing hundred (only for 3 digit numbers) + # "one fifty" -> "one hundred fifty" + with_hundred = pynini.compose( + pynini.closure(DAMO_NOT_SPACE) + + pynini.accep(" ") + + pynutil.insert("hundred ") + + DAMO_SIGMA, + pynini.compose(cardinal_graph, DAMO_DIGIT**3), + ) + cardinal_graph |= with_hundred + graph_decimal_final = decimal.final_graph_wo_negative + + unit = pynini.string_file(get_abs_path("data/currency.tsv")) + unit_singular = pynini.invert(unit) + unit_plural = get_singulars(unit_singular) + + graph_unit_singular = ( + pynutil.insert('currency: "') + convert_space(unit_singular) + pynutil.insert('"') + ) + graph_unit_plural = ( + pynutil.insert('currency: "') + convert_space(unit_plural) + pynutil.insert('"') + ) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + # twelve dollars (and) fifty cents, zero cents + cents_standalone = ( + pynutil.insert('fractional_part: "') + + pynini.union( + pynutil.add_weight(((DAMO_SIGMA - "one") @ cardinal_graph), -0.7) + @ add_leading_zero_to_double_digit + + delete_space + + pynutil.delete("cents"), + pynini.cross("one", "01") + delete_space + pynutil.delete("cent"), + ) + + pynutil.insert('"') + ) + + optional_cents_standalone = pynini.closure( + delete_space + + pynini.closure(pynutil.delete("and") + delete_space, 0, 1) + + insert_space + + cents_standalone, + 0, + 1, + ) + # twelve dollars fifty, only after integer + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('fractional_part: "') + + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "one") @ cardinal_graph) + + pynutil.insert('"') + + delete_extra_space + + graph_unit_plural + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_integer |= ( + pynutil.insert('integer_part: "') + + pynini.cross("one", "1") + + pynutil.insert('"') + + delete_extra_space + + graph_unit_singular + + (optional_cents_standalone | optional_cents_suffix) + ) + graph_decimal = graph_decimal_final + delete_extra_space + graph_unit_plural + graph_decimal |= pynutil.insert('currency: "$" integer_part: "0" ') + cents_standalone + final_graph = graph_integer | graph_decimal + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/tl/taggers/ordinal.py new file mode 100644 index 0000000..9fd1d5d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/ordinal.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import DAMO_CHAR, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + e.g. thirteenth -> ordinal { integer: "13" } + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="ordinal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + graph_digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")) + graph_teens = pynini.string_file(get_abs_path("data/ordinals/teen.tsv")) + graph = pynini.closure(DAMO_CHAR) + pynini.union( + graph_digit, graph_teens, pynini.cross("tieth", "ty"), pynini.cross("th", "") + ) + + self.graph = graph @ cardinal_graph + final_graph = pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/tl/taggers/punctuation.py new file mode 100644 index 0000000..59cd891 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/tl/taggers/telephone.py new file mode 100644 index 0000000..9c960f6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/telephone.py @@ -0,0 +1,149 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_ALNUM, + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +def get_serial_number(cardinal): + """ + any alphanumerical character sequence with at least one number with length greater equal to 3 + """ + digit = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT) + character = digit | DAMO_ALPHA + sequence = character + pynini.closure(pynutil.delete(" ") + character, 2) + sequence = sequence @ (pynini.closure(DAMO_ALNUM) + DAMO_DIGIT + pynini.closure(DAMO_ALNUM)) + return sequence.optimize() + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + one two three one two three five six seven eight -> { number_part: "123-123-5678" } + + This class also support card number and IP format. + "one two three dot one double three dot o dot four o" -> { number_part: "123.133.0.40"} + + "three two double seven three two one four three two one four three double zero five" -> + { number_part: 3277 3214 3214 3005} + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="telephone", kind="classify") + # country code, number_part, extension + digit_to_str = ( + pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize()) + | pynini.cross("0", pynini.union("o", "oh", "zero")).optimize() + ) + + str_to_digit = pynini.invert(digit_to_str) + + double_digit = pynini.union( + *[ + pynini.cross( + pynini.project(str(i) @ digit_to_str, "output") + + pynini.accep(" ") + + pynini.project(str(i) @ digit_to_str, "output"), + pynutil.insert("double ") + pynini.project(str(i) @ digit_to_str, "output"), + ) + for i in range(10) + ] + ) + double_digit.invert() + + # to handle cases like "one twenty three" + two_digit_cardinal = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT**2) + double_digit_to_digit = ( + pynini.compose(double_digit, str_to_digit + pynutil.delete(" ") + str_to_digit) + | two_digit_cardinal + ) + + single_or_double_digit = ( + pynutil.add_weight(double_digit_to_digit, -0.0001) | str_to_digit + ).optimize() + single_or_double_digit |= ( + single_or_double_digit + + pynini.closure( + pynutil.add_weight(pynutil.delete(" ") + single_or_double_digit, 0.0001) + ) + ).optimize() + + number_part = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + number_part = ( + pynutil.insert('number_part: "') + number_part.optimize() + pynutil.insert('"') + ) + + cardinal_option = pynini.compose(single_or_double_digit, DAMO_DIGIT ** (2, 3)) + + country_code = ( + pynutil.insert('country_code: "') + + pynini.closure(pynini.cross("plus ", "+"), 0, 1) + + ( + (pynini.closure(str_to_digit + pynutil.delete(" "), 0, 2) + str_to_digit) + | cardinal_option + ) + + pynutil.insert('"') + ) + + optional_country_code = pynini.closure( + country_code + pynutil.delete(" ") + insert_space, 0, 1 + ).optimize() + graph = optional_country_code + number_part + + # credit card number + space_four_digits = insert_space + DAMO_DIGIT**4 + credit_card_graph = pynini.compose( + single_or_double_digit, DAMO_DIGIT**4 + space_four_digits**3 + ).optimize() + graph |= ( + pynutil.insert('number_part: "') + credit_card_graph.optimize() + pynutil.insert('"') + ) + + # SSN + ssn_graph = pynini.compose( + single_or_double_digit, + DAMO_DIGIT**3 + + pynutil.insert("-") + + DAMO_DIGIT**2 + + pynutil.insert("-") + + DAMO_DIGIT**4, + ).optimize() + graph |= pynutil.insert('number_part: "') + ssn_graph.optimize() + pynutil.insert('"') + + # ip + digit_or_double = ( + pynini.closure(str_to_digit + pynutil.delete(" "), 0, 1) + double_digit_to_digit + ) + digit_or_double |= double_digit_to_digit + pynini.closure( + pynutil.delete(" ") + str_to_digit, 0, 1 + ) + digit_or_double |= str_to_digit + (pynutil.delete(" ") + str_to_digit) ** (0, 2) + digit_or_double |= cardinal_option + digit_or_double = digit_or_double.optimize() + + ip_graph = digit_or_double + (pynini.cross(" dot ", ".") + digit_or_double) ** 3 + + graph |= pynutil.insert('number_part: "') + ip_graph.optimize() + pynutil.insert('"') + graph |= ( + pynutil.insert('number_part: "') + + pynutil.add_weight(get_serial_number(cardinal=cardinal), weight=0.0001) + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/time.py b/fun_text_processing/inverse_text_normalization/tl/taggers/time.py new file mode 100644 index 0000000..2ee72f3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/time.py @@ -0,0 +1,139 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path, num_to_word +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. twelve thirty -> time { hours: "12" minutes: "30" } + e.g. twelve past one -> time { minutes: "12" hours: "1" } + e.g. two o clock a m -> time { hours: "2" suffix: "a.m." } + e.g. quarter to two -> time { hours: "1" minutes: "45" } + e.g. quarter past two -> time { hours: "2" minutes: "15" } + e.g. half past two -> time { hours: "2" minutes: "30" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + suffix_graph = pynini.string_file(get_abs_path("data/time/time_suffix.tsv")) + time_zone_graph = pynini.invert(pynini.string_file(get_abs_path("data/time/time_zone.tsv"))) + to_hour_graph = pynini.string_file(get_abs_path("data/time/to_hour.tsv")) + minute_to_graph = pynini.string_file(get_abs_path("data/time/minute_to.tsv")) + + # only used for < 1000 thousand -> 0 weight + cardinal = pynutil.add_weight(CardinalFst().graph_no_exception, weight=-0.7) + + labels_hour = [num_to_word(x) for x in range(0, 24)] + labels_minute_single = [num_to_word(x) for x in range(1, 10)] + labels_minute_double = [num_to_word(x) for x in range(10, 60)] + + graph_hour = pynini.union(*labels_hour) @ cardinal + + graph_minute_single = pynini.union(*labels_minute_single) @ cardinal + graph_minute_double = pynini.union(*labels_minute_double) @ cardinal + graph_minute_verbose = pynini.cross("half", "30") | pynini.cross("quarter", "15") + oclock = pynini.cross(pynini.union("o' clock", "o clock", "o'clock", "oclock"), "") + + final_graph_hour = pynutil.insert('hours: "') + graph_hour + pynutil.insert('"') + graph_minute = ( + oclock + pynutil.insert("00") + | pynutil.delete("o") + delete_space + graph_minute_single + | graph_minute_double + ) + final_suffix = ( + pynutil.insert('suffix: "') + convert_space(suffix_graph) + pynutil.insert('"') + ) + final_suffix = delete_space + insert_space + final_suffix + final_suffix_optional = pynini.closure(final_suffix, 0, 1) + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + # five o' clock + # two o eight, two thirty five (am/pm) + # two pm/am + graph_hm = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minute + + pynutil.insert('"') + ) + # 10 past four, quarter past four, half past four + graph_m_past_h = ( + pynutil.insert('minutes: "') + + pynini.union(graph_minute_single, graph_minute_double, graph_minute_verbose) + + pynutil.insert('"') + + delete_space + + pynutil.delete("past") + + delete_extra_space + + final_graph_hour + ) + + graph_quarter_time = ( + pynutil.insert('minutes: "') + + pynini.cross("quarter", "45") + + pynutil.insert('"') + + delete_space + + pynutil.delete(pynini.union("to", "till")) + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + ) + + graph_m_to_h_suffix_time = ( + pynutil.insert('minutes: "') + + ((graph_minute_single | graph_minute_double).optimize() @ minute_to_graph) + + pynutil.insert('"') + + pynini.closure( + delete_space + pynutil.delete(pynini.union("min", "mins", "minute", "minutes")), + 0, + 1, + ) + + delete_space + + pynutil.delete(pynini.union("to", "till")) + + delete_extra_space + + pynutil.insert('hours: "') + + to_hour_graph + + pynutil.insert('"') + + final_suffix + ) + + graph_h = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + (pynutil.insert("00") | graph_minute) + + pynutil.insert('"') + + final_suffix + + final_time_zone_optional + ) + final_graph = ( + (graph_hm | graph_m_past_h | graph_quarter_time) + + final_suffix_optional + + final_time_zone_optional + ) + final_graph |= graph_h + final_graph |= graph_m_to_h_suffix_time + + final_graph = self.add_tokens(final_graph.optimize()) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/tl/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..9f3073a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/tokenize_and_classify.py @@ -0,0 +1,102 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.tl.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.tl.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.tl.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.tl.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.tl.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.tl.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.tl.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.tl.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.tl.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.tl.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.tl.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.tl.taggers.word import WordFst +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_tl_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst(cardinal) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst(ordinal=ordinal).fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst(cardinal).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/tl/taggers/whitelist.py new file mode 100644 index 0000000..d555a6c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.tl.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/taggers/word.py b/fun_text_processing/inverse_text_normalization/tl/taggers/word.py new file mode 100644 index 0000000..fe2226a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/utils.py b/fun_text_processing/inverse_text_normalization/tl/utils.py new file mode 100644 index 0000000..38a95ba --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/utils.py @@ -0,0 +1,33 @@ +import os +from typing import Union + +import inflect + +_inflect = inflect.engine() + + +def num_to_word(x: Union[str, int]): + """ + converts integer to spoken representation + + Args + x: integer + + Returns: spoken representation + """ + if isinstance(x, int): + x = str(x) + x = _inflect.number_to_words(str(x)).replace("-", " ").replace(",", "") + return x + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/cardinal.py new file mode 100644 index 0000000..0c58f8c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/date.py new file mode 100644 index 0000000..91fefee --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/date.py @@ -0,0 +1,70 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "january" day: "5" year: "2012" preserve_order: true } -> february 5 2012 + date { day: "5" month: "january" year: "2012" preserve_order: true } -> 5 february 2012 + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + + # month (day) year + graph_mdy = ( + month + + pynini.closure(delete_extra_space + day, 0, 1) + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + # (day) month year + graph_dmy = ( + pynini.closure(day + delete_extra_space, 0, 1) + + month + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = (graph_mdy | year | graph_dmy) + delete_space + optional_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/decimal.py new file mode 100644 index 0000000..929db40 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/decimal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/electronic.py new file mode 100644 index 0000000..97cc9d3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/fraction.py new file mode 100644 index 0000000..6b24caf --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/fraction.py @@ -0,0 +1,10 @@ +from fun_text_processing.inverse_text_normalization.tl.graph_utils import GraphFst + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction, + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/measure.py new file mode 100644 index 0000000..c1f9da2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/measure.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + pynutil.insert(" ") + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/money.py new file mode 100644 index 0000000..816c879 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/money.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> $12.05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/ordinal.py new file mode 100644 index 0000000..c6810fb --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/ordinal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "13" } -> 13th + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + convert_eleven = pynini.cross("11", "11th") + convert_twelve = pynini.cross("12", "12th") + convert_thirteen = pynini.cross("13", "13th") + convert_one = pynini.cross("1", "1st") + convert_two = pynini.cross("2", "2nd") + convert_three = pynini.cross("3", "3rd") + convert_rest = pynutil.insert("th", weight=0.01) + + suffix = pynini.cdrewrite( + convert_eleven + | convert_twelve + | convert_thirteen + | convert_one + | convert_two + | convert_three + | convert_rest, + "", + "[EOS]", + DAMO_SIGMA, + ) + graph = graph @ suffix + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/telephone.py new file mode 100644 index 0000000..0c245e5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/telephone.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_country_code = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" "), + 0, + 1, + ) + delete_tokens = self.delete_tokens(optional_country_code + number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/time.py new file mode 100644 index 0000000..7c08347 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/time.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "12" minutes: "30" } -> 12:30 + time { hours: "1" minutes: "12" } -> 01:12 + time { hours: "2" suffix: "a.m." } -> 02:00 a.m. + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + suffix = ( + delete_space + + insert_space + + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + zone = ( + delete_space + + insert_space + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + graph = ( + hour @ add_leading_zero_to_double_digit + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + optional_suffix + + optional_zone + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/verbalize.py new file mode 100644 index 0000000..c7d47d2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/verbalize.py @@ -0,0 +1,47 @@ +from fun_text_processing.inverse_text_normalization.tl.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.tl.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/verbalize_final.py new file mode 100644 index 0000000..d7fca6e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.tl.verbalizers.word import WordFst +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/whitelist.py new file mode 100644 index 0000000..94ed9d4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/tl/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/tl/verbalizers/word.py new file mode 100644 index 0000000..485a458 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/tl/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.tl.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/__init__.py b/fun_text_processing/inverse_text_normalization/vi/__init__.py new file mode 100644 index 0000000..90d3cbc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.vi.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.vi.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/vi/data/__init__.py b/fun_text_processing/inverse_text_normalization/vi/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/data/currency.tsv b/fun_text_processing/inverse_text_normalization/vi/data/currency.tsv new file mode 100644 index 0000000..ce65d44 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/currency.tsv @@ -0,0 +1,11 @@ +$ đô +$ usd +$ đô la +$ đô la mỹ +€ euro +€ ơ rô +¥ yên +₩ won +₩ uôn +RM ringgit +₫ đồng \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/vi/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/vi/data/electronic/domain.tsv new file mode 100644 index 0000000..c56c252 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/electronic/domain.tsv @@ -0,0 +1,11 @@ +com +uk +fr +net +br +in +ru +de +it +vn +edu \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/vi/data/electronic/server_name.tsv new file mode 100644 index 0000000..4eadcaf --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/electronic/server_name.tsv @@ -0,0 +1,16 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/vi/data/electronic/symbols.tsv new file mode 100644 index 0000000..eccbe3d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/electronic/symbols.tsv @@ -0,0 +1,20 @@ +. chấm +- gạch +_ gạch dưới +_ shift gạch +_ síp gạch +! chấm than +# thăng +$ đô +% phần trăm +& và +* sao +: hai chấm ++ cộng +/ sẹc += bằng +? chấm hỏi +? hỏi chấm +^ mũ +| hoặc +, phẩy \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/magnitudes.tsv b/fun_text_processing/inverse_text_normalization/vi/data/magnitudes.tsv new file mode 100644 index 0000000..727dc56 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/magnitudes.tsv @@ -0,0 +1,5 @@ +k nghìn +k ngàn +m triệu +b tỉ +b tỷ \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/math/__init__.py b/fun_text_processing/inverse_text_normalization/vi/data/math/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/math/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/data/math/symbols.tsv b/fun_text_processing/inverse_text_normalization/vi/data/math/symbols.tsv new file mode 100644 index 0000000..2475c6e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/math/symbols.tsv @@ -0,0 +1,10 @@ +% phần trăm +& và +* nhân +* sao ++ cộng +- trừ +/ chia += bằng +^ mũ +| hoặc \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/measurements.tsv b/fun_text_processing/inverse_text_normalization/vi/data/measurements.tsv new file mode 100644 index 0000000..fa28177 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/measurements.tsv @@ -0,0 +1,185 @@ +°f fahrenheit +°f độ f +°c celsius +°c độ c +km kilomet +km ki lô met +km ki lô mét +km kilô mét +km kilo mét +m met +m mét +cm centimet +cm cen ti mét +cm xen ti mét +cm xăng ti mét +mm millimet +mm mi li mét +mm mili mét +ha hecta +ha héc ta +mi mile +m² met vuông +m² mét vuông +km² kilomet vuông +km² ki lô met vuông +km² kilo mét vuông +km² ki lô mét vuông +ft foot +% phần trăm +hz héc +hz hẹc +kw kilowatt +kw kilo watt +kw ki lô watt +kw ki lô oát +kw ki lô goát +hp mã lực +mg milligram +mg milli gram +mg mi li gram +mg mi li gam +mg mili gam +kg kilogram +kg kilo gram +kg ki lô gram +kg kilo gam +kg ki lô gam +kg kí lô +kg kí +ghz giga hẹc +ghz giga héc +ghz gi ga héc +ghz gi ga hẹc +khz kilo hẹc +khz kilo héc +khz ki lô héc +khz ki lô hẹc +mhz mega héc +mhz mega hẹc +mhz mê ga hẹc +mhz mê ga héc +v vôn +h giờ +phút phút +s giây +nm nanomet +nm nano mét +nm na nô mét +mA milli ampe +mA mi li ampe +mA mi li am pe +kwh kilowatt giờ +kwh kilo watt giờ +kwh ki lô oát giờ +kwh ki lô goát giờ +m³ met khối +m³ mét khối +cm³ centimet khối +cm³ cen ti mét khối +cm³ xen ti mét khối +cm³ xăng ti mét khối +tw tera watt +tw terawatt +tw te ra watt +tw tê ra watt +tw tê ra oát +tw tê ra goát +mv milli vôn +mv mi li vôn +mw megawatt +mw mega watt +mw mê ga watt +mw mê ga oát +mw mê ga goát +μm micromet +μm micro mét +μm muy crô mét +μm mi crô mét +μm muy cờ rô mét +μm mi cờ rô mét +inch inch +tb terabyte +tb tera byte +tb te ra byte +tb te ra bai +tb tê ra byte +tb tê ra bai +g gram +g gam +ω ohm +ω ôm +db decibel +db deci ben +db đề xi ben +μg microgram +μg micro gram +μg muy crô gram +μg micro gam +μg muy crô gam +μg muy cờ rô gam +pg petagram +pg peta gam +pg pê ta gam +gb gigabyte +gb giga byte +gb giga bai +gb gi ga byte +gb gi ga bai +mb megabyte +mb mega byte +mb mega bai +mb me ga byte +mb me ga bai +mb mê ga byte +mb mê ga bai +kb kilobyte +kb kilo byte +kb kilo bai +kb ki lô byte +kb ki lô bai +kbps kilobit trên giây +mbps megabit trên giây +kv kilovolt +kv kilo vôn +kv ki lô vôn +mv megavolt +mv mega vôn +mv me ga vôn +mv mê ga vôn +yd yard +rad radian +gpa giga pascal +gpa gi ga pascal +gw gigawatt +gw giga watt +gw gi ga watt +gw gi ga oát +ns nano giây +ns na nô giây +μs micro giây +μs muy crô giây +μs muy cờ rô giây +pa pascal +ms milli giây +ms mi li giây +dm decimet +dm đề xi mét +dm³ đề xi mét khối +dm³ decimet khối +mm² millimet vuông +mm² mi li mét vuông +cm² centimet vuông +cm² centi mét vuông +cm² xăng ti mét vuông +cm² xen ti mét vuông +pb peta byte +pb petabyte +pb pê ta byte +kcal kilocalories +kcal kilocalo +kcal ki lô calo +l lít +ml millilit +ml mili lít +ml mi li lít \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/months.tsv b/fun_text_processing/inverse_text_normalization/vi/data/months.tsv new file mode 100644 index 0000000..93da689 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/months.tsv @@ -0,0 +1,14 @@ +một 1 +hai 2 +ba 3 +tư 4 +bốn 4 +năm 5 +sáu 6 +bảy 7 +bẩy 7 +tám 8 +chín 9 +mười 10 +mười một 11 +mười hai 12 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/vi/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/vi/data/numbers/digit.tsv new file mode 100644 index 0000000..bdac5de --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/numbers/digit.tsv @@ -0,0 +1,10 @@ +một 1 +hai 2 +ba 3 +bốn 4 +năm 5 +sáu 6 +bảy 7 +bẩy 7 +tám 8 +chín 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/numbers/hundred.tsv b/fun_text_processing/inverse_text_normalization/vi/data/numbers/hundred.tsv new file mode 100644 index 0000000..b2f35ae --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/numbers/hundred.tsv @@ -0,0 +1 @@ +trăm \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/vi/data/numbers/teen.tsv new file mode 100644 index 0000000..722dc67 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/numbers/teen.tsv @@ -0,0 +1,11 @@ +mười 10 +mười một 11 +mười hai 12 +mười ba 13 +mười bốn 14 +mười lăm 15 +mười sáu 16 +mười bảy 17 +mười bẩy 17 +mười tám 18 +mười chín 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/numbers/thousands.tsv b/fun_text_processing/inverse_text_normalization/vi/data/numbers/thousands.tsv new file mode 100644 index 0000000..d2ca259 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/numbers/thousands.tsv @@ -0,0 +1,6 @@ +nghìn +triệu +tỉ +nghìn tỉ +triệu tỉ +tỉ tỉ \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/vi/data/numbers/ties.tsv new file mode 100644 index 0000000..cca1f80 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/numbers/ties.tsv @@ -0,0 +1,9 @@ +hai 2 +ba 3 +bốn 4 +năm 5 +sáu 6 +bảy 7 +bẩy 7 +tám 8 +chín 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/vi/data/numbers/zero.tsv new file mode 100644 index 0000000..70d6dcf --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/numbers/zero.tsv @@ -0,0 +1 @@ +không 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/ordinals/__init__.py b/fun_text_processing/inverse_text_normalization/vi/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/data/ordinals/digit.tsv b/fun_text_processing/inverse_text_normalization/vi/data/ordinals/digit.tsv new file mode 100644 index 0000000..a1403b7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/ordinals/digit.tsv @@ -0,0 +1,12 @@ +nhất 1 +nhì 2 +hai 2 +ba 3 +bốn 4 +tư 4 +năm 5 +sáu 6 +bảy 7 +bẩy 7 +tám 8 +chín 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/vi/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/hours.tsv b/fun_text_processing/inverse_text_normalization/vi/data/time/hours.tsv new file mode 100644 index 0000000..48e35fc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/hours.tsv @@ -0,0 +1,29 @@ +không 0 +một 1 +hai 2 +ba 3 +bốn 4 +năm 5 +sáu 6 +bảy 7 +bẩy 7 +tám 8 +chín 9 +mười 10 +mười một 11 +mười hai 12 +mười ba 13 +mười bốn 14 +mười lăm 15 +mười sáu 16 +mười bảy 17 +mười bẩy 17 +mười tám 18 +mười chín 19 +hai mươi 20 +hai mươi mốt 21 +hai mốt 21 +hai mươi hai 22 +hai hai 22 +hai mươi ba 23 +hai ba 23 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/hours_to.tsv b/fun_text_processing/inverse_text_normalization/vi/data/time/hours_to.tsv new file mode 100644 index 0000000..a562195 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/hours_to.tsv @@ -0,0 +1,25 @@ +1 0 +2 1 +3 2 +4 3 +5 4 +6 5 +7 6 +8 7 +9 8 +10 9 +11 10 +12 11 +13 12 +14 13 +15 14 +16 15 +17 16 +18 17 +19 18 +20 19 +21 20 +22 21 +23 22 +24 23 +0 23 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/hours_to_night.tsv b/fun_text_processing/inverse_text_normalization/vi/data/time/hours_to_night.tsv new file mode 100644 index 0000000..1374f45 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/hours_to_night.tsv @@ -0,0 +1,12 @@ +1 13 +2 14 +3 15 +4 16 +5 17 +6 18 +7 19 +8 20 +9 21 +10 22 +11 23 +12 0 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/minutes.tsv b/fun_text_processing/inverse_text_normalization/vi/data/time/minutes.tsv new file mode 100644 index 0000000..0d7872b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/minutes.tsv @@ -0,0 +1,118 @@ +không 0 +một 1 +hai 2 +ba 3 +bốn 4 +năm 5 +sáu 6 +bảy 7 +bẩy 7 +tám 8 +chín 9 +mười 10 +mười một 11 +mười hai 12 +mười ba 13 +mười bốn 14 +mười lăm 15 +mười sáu 16 +mười bảy 17 +mười bẩy 17 +mười tám 18 +mười chín 19 +hai mươi 20 +hai mươi mốt 21 +hai mươi hai 22 +hai mươi ba 23 +hai mươi tư 24 +hai mươi bốn 24 +hai mươi lăm 25 +hai mươi sáu 26 +hai mươi bảy 27 +hai mươi bẩy 27 +hai mươi tám 28 +hai mươi chín 29 +ba mươi 30 +ba mươi mốt 21 +ba mươi hai 22 +ba mươi ba 33 +ba mươi tư 34 +ba mươi bốn 34 +ba mươi lăm 35 +ba mươi sáu 36 +ba mươi bảy 37 +ba mươi bẩy 37 +ba mươi tám 38 +ba mươi chín 39 +bốn mươi 40 +bốn mươi mốt 41 +bốn mươi hai 42 +bốn mươi ba 43 +bốn mươi tư 44 +bốn mươi bốn 44 +bốn mươi lăm 45 +bốn mươi sáu 46 +bốn mươi bảy 47 +bốn mươi bẩy 47 +bốn mươi tám 48 +bốn mươi chín 49 +năm mươi 50 +năm mươi mốt 51 +năm mươi hai 52 +năm mươi ba 53 +năm mươi tư 54 +năm mươi bốn 54 +năm mươi lăm 55 +năm mươi sáu 56 +năm mươi bảy 57 +năm mươi bẩy 57 +năm mươi tám 58 +năm mươi chín 59 +hai mốt 21 +hai hai 22 +hai ba 23 +hai tư 24 +hai bốn 24 +hai lăm 25 +hai năm 25 +hai sáu 26 +hai bảy 27 +hai bẩy 27 +hai tám 28 +hai chín 29 +ba mốt 21 +ba hai 22 +ba ba 33 +ba tư 34 +ba bốn 34 +ba lăm 35 +ba năm 35 +ba sáu 36 +ba bảy 37 +ba bẩy 37 +ba tám 38 +ba chín 39 +bốn mốt 41 +bốn hai 42 +bốn ba 43 +bốn tư 44 +bốn bốn 44 +bốn lăm 45 +bốn năm 45 +bốn sáu 46 +bốn bảy 47 +bốn bẩy 47 +bốn tám 48 +bốn chín 49 +năm mốt 51 +năm hai 52 +năm ba 53 +năm tư 54 +năm bốn 54 +năm lăm 55 +năm năm 55 +năm sáu 56 +năm bảy 57 +năm bẩy 57 +năm tám 58 +năm chín 59 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/minutes_to.tsv b/fun_text_processing/inverse_text_normalization/vi/data/time/minutes_to.tsv new file mode 100644 index 0000000..bcb3283 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/minutes_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/time_suffix.tsv b/fun_text_processing/inverse_text_normalization/vi/data/time/time_suffix.tsv new file mode 100644 index 0000000..b39a9ef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/time_suffix.tsv @@ -0,0 +1,8 @@ +p m p.m. +pm p.m. +p.m. +p.m p.m. +am a.m. +a.m. +a.m a.m. +a m a.m. \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/vi/data/time/time_zone.tsv b/fun_text_processing/inverse_text_normalization/vi/data/time/time_zone.tsv new file mode 100644 index 0000000..3e0ade4 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t diff --git a/fun_text_processing/inverse_text_normalization/vi/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/vi/data/whitelist.tsv new file mode 100644 index 0000000..e69de29 diff --git a/fun_text_processing/inverse_text_normalization/vi/graph_utils.py b/fun_text_processing/inverse_text_normalization/vi/graph_utils.py new file mode 100644 index 0000000..644a0ae --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/graph_utils.py @@ -0,0 +1,143 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from pynini import Far +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") + +# French frequently compounds numbers with hyphen. +delete_hyphen = pynutil.delete(pynini.closure("-", 0, 1)) +insert_hyphen = pynutil.insert("-") + +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) + + +def generator_main(file_name: str, graphs: Dict[str, pynini.FstLike]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + + Args: + fst: input fst + + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/vi/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/vi/taggers/cardinal.py new file mode 100644 index 0000000..fd5deb3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/cardinal.py @@ -0,0 +1,156 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_DIGIT, + DAMO_SPACE, + GraphFst, + delete_space, +) +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. trừ hai mươi ba -> cardinal { integer: "23" negative: "-" } } + e.g. hai nghìn lẻ chín -> cardinal { integer: "2009"} } + Numbers below ten are not converted. + """ + + def __init__(self): + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) + + graph_one = pynini.cross("mốt", "1") + graph_four = pynini.cross("tư", "4") + graph_five = pynini.cross("lăm", "5") + graph_half = pynini.cross("rưỡi", "5") + graph_hundred = pynini.cross("trăm", "") + graph_ten = pynini.cross("mươi", "") + zero = pynini.cross(pynini.union("linh", "lẻ"), "0") + + optional_ten = pynini.closure(delete_space + graph_ten, 0, 1) + last_digit_exception = pynini.project(pynini.cross("năm", "5"), "input") + last_digit = pynini.union( + (pynini.project(graph_digit, "input") - last_digit_exception.arcsort()) @ graph_digit, + graph_one, + graph_four, + graph_five, + ) + + graph_hundred_ties_component = (graph_digit | graph_zero) + delete_space + graph_hundred + graph_hundred_ties_component += delete_space + graph_hundred_ties_component += pynini.union( + graph_teen, + (graph_half | graph_four | graph_one) + pynutil.insert("0"), + graph_ties + optional_ten + ((delete_space + last_digit) | pynutil.insert("0")), + zero + delete_space + (graph_digit | graph_four), + pynutil.insert("00"), + ) + graph_hundred_ties_component |= ( + pynutil.insert("0") + + delete_space + + pynini.union( + graph_teen, + graph_ties + optional_ten + delete_space + last_digit, + graph_ties + delete_space + graph_ten + pynutil.insert("0"), + zero + delete_space + (graph_digit | graph_four), + ) + ) + graph_hundred_component = graph_hundred_ties_component | ( + pynutil.insert("00") + delete_space + graph_digit + ) + + graph_hundred_component_at_least_one_none_zero_digit = graph_hundred_component @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) + graph_hundred_ties_zero = graph_hundred_ties_component | pynutil.insert("000") + + graph_thousands = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete(pynini.union("nghìn", "ngàn")), + pynutil.insert("000", weight=0.1), + ) + + graph_ten_thousand = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("vạn"), + pynutil.insert("0000", weight=0.1), + ) + + graph_ten_thousand_suffix = pynini.union( + graph_digit + delete_space + pynutil.delete(pynini.union("nghìn", "ngàn")), + pynutil.insert("0", weight=0.1), + ) + + graph_million = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete("triệu"), + pynutil.insert("000", weight=0.1), + ) + graph_billion = pynini.union( + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete(pynini.union("tỉ", "tỷ")), + pynutil.insert("000", weight=0.1), + ) + + graph = pynini.union( + graph_billion + + delete_space + + graph_million + + delete_space + + graph_thousands + + delete_space + + graph_hundred_ties_zero, + graph_ten_thousand + + delete_space + + graph_ten_thousand_suffix + + delete_space + + graph_hundred_ties_zero, + graph_hundred_component_at_least_one_none_zero_digit + + delete_space + + pynutil.delete(pynini.union("nghìn", "ngàn")) + + delete_space + + (((last_digit | graph_half) + pynutil.insert("00")) | graph_hundred_ties_zero), + graph_digit, + graph_zero, + ) + + graph = graph @ pynini.union( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT), + "0", + ) + + # don't convert cardinals from zero to nine inclusive + graph_exception = pynini.project(pynini.union(graph_digit, graph_zero), "input") + + self.graph_no_exception = graph + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + + pynini.cross(pynini.union("âm", "trừ"), '"-"') + + DAMO_SPACE, + 0, + 1, + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/date.py b/fun_text_processing/inverse_text_normalization/vi/taggers/date.py new file mode 100644 index 0000000..5110d25 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/date.py @@ -0,0 +1,170 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + +graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")).optimize() +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize() +graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")).optimize() +ties_graph = pynini.string_file(get_abs_path("data/numbers/ties.tsv")).optimize() + + +def _get_month_graph(): + """ + Transducer for month, e.g. march -> march + """ + month_graph = pynini.string_file(get_abs_path("data/months.tsv")).optimize() + return month_graph + + +def _get_ties_graph(): + """ + Transducer for 20-99 e.g + hai ba -> 23 + """ + graph_one = pynini.cross("mốt", "1") + graph_four = pynini.cross("tư", "4") + graph_five = pynini.cross("lăm", "5") + graph_ten = pynini.cross("mươi", "") + optional_ten = pynini.closure(delete_space + graph_ten, 0, 1) + + graph = pynini.union( + ties_graph + + optional_ten + + delete_space + + (graph_digit | graph_one | graph_four | graph_five), + ties_graph + delete_space + graph_ten + pynutil.insert("0"), + ) + return graph + + +def _get_year_graph(): + """ + Transducer for year, e.g. hai không hai mươi -> 2020 + """ + + def _get_digits_graph(): + zero = pynini.cross((pynini.union("linh", "lẻ")), "0") + four = pynini.cross("tư", "4") + graph = pynini.union( + zero + delete_space + (graph_digit | four), + graph_zero + delete_space + graph_digit, + ) + graph.optimize() + return graph + + def _get_hundreds_graph(graph_ties, graph_digits): + graph = ( + graph_digit + + delete_space + + pynutil.delete("trăm") + + delete_space + + (graph_teen | graph_ties | graph_digits) + ) + return graph + + def _get_thousands_graph(graph_ties, graph_digits): + graph_hundred_component = ( + (graph_digit | graph_zero) + delete_space + pynutil.delete("trăm") + ) | pynutil.insert("0") + graph = ( + graph_digit + + delete_space + + pynutil.delete(pynini.union("nghìn", "ngàn")) + + delete_space + + graph_hundred_component + + delete_space + + (graph_teen | graph_ties | graph_digits) + ) + return graph + + graph_ties = _get_ties_graph() + graph_digits = _get_digits_graph() + graph_hundreds = _get_hundreds_graph(graph_ties, graph_digits) + graph_thousands = _get_thousands_graph(graph_ties, graph_digits) + year_graph = ( + # 20 19, 40 12, 2012, 2 0 0 5, 2 0 17, 938 - assuming no limit on the year + graph_digit + + delete_space + + (graph_digit | graph_zero) + + delete_space + + (graph_teen | graph_ties | graph_digits) + | graph_thousands + | graph_hundreds + | ( + graph_digit + + pynutil.insert("0") + + delete_space + + (graph_ties | graph_digits | graph_teen) + ) + ) + year_graph.optimize() + return year_graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. mười lăm tháng một năm hai nghìn mười hai -> date { day: "15" month: "1" year: "2012" preserve_order: true } + e.g. ngày ba mốt tháng mười hai năm một chín chín chín -> date { day: "31" month: "12" year: "2012" preserve_order: true } + e.g. năm hai không hai mốt -> date { year: "2021" preserve_order: true } + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="date", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + year_graph = _get_year_graph() + YEAR_WEIGHT = 0.001 + year_graph = pynutil.add_weight(year_graph, YEAR_WEIGHT) + month_graph = _get_month_graph() + + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + month_exception = pynini.project(pynini.cross("năm", "5"), "input") + month_graph_exception = ( + pynini.project(month_graph, "input") - month_exception.arcsort() + ) @ month_graph + + day_graph = pynutil.insert('day: "') + cardinal_graph + pynutil.insert('"') + # day_suffix = pynini.union("ngày", "mùng") + # optional_day = pynini.closure(day_suffix + delete_space, 0, 1) + + graph_month = pynutil.delete("tháng") + delete_space + month_graph_exception + graph_year = ( + delete_extra_space + + pynutil.delete("năm") + + delete_extra_space + + pynutil.insert('year: "') + + pynutil.add_weight(year_graph, -YEAR_WEIGHT) + + pynutil.insert('"') + ) + optional_graph_year = pynini.closure(graph_year, 0, 1) + graph_my = pynutil.delete("tháng") + delete_space + month_graph + graph_year + graph_dmy = ( + day_graph + + delete_space + + pynutil.delete("tháng") + + delete_extra_space + + month_graph + + optional_graph_year + ) + graph_year = ( + pynutil.delete("năm") + + delete_extra_space + + pynutil.insert('year: "') + + year_graph + + pynutil.insert('"') + ) + + final_graph = (graph_dmy | graph_my | graph_month | graph_year) + pynutil.insert( + " preserve_order: true" + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/vi/taggers/decimal.py new file mode 100644 index 0000000..ed30656 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/decimal.py @@ -0,0 +1,130 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. một triệu -> integer_part: "1" quantity: "triệu" + e.g. một tỷ rưỡi -> integer_part: "1" fractional_part: "5" quantity: "tỷ" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + numbers = cardinal_up_to_hundred @ ( + pynutil.delete(pynini.closure("0")) + + pynini.difference(DAMO_DIGIT, "0") + + pynini.closure(DAMO_DIGIT) + ) + suffix = pynini.union("triệu", "tỉ", "tỷ", "vạn") + graph_four = pynini.cross("tư", "4") + graph_one = pynini.cross("mốt", "1") + graph_half = pynini.cross("rưỡi", "5") + last_digit_exception = pynini.project(pynini.cross("năm", "5"), "input") + last_digit = pynini.union( + (pynini.project(graph_digit, "input") - last_digit_exception.arcsort()) @ graph_digit, + graph_one, + graph_four, + graph_half, + ) + optional_fraction_graph = pynini.closure( + delete_extra_space + + pynutil.insert('fractional_part: "') + + (last_digit | graph_half | graph_one | graph_four) + + pynutil.insert('"'), + 0, + 1, + ) + + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('quantity: "') + + suffix + + pynutil.insert('"') + + optional_fraction_graph + ) + res |= ( + decimal + + delete_extra_space + + pynutil.insert('quantity: "') + + (suffix | "ngàn" | "nghìn") + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. âm hai hai phẩy không năm tư năm tỉ -> decimal { negative: "true" integer_part: "22" fractional_part: "054" quantity: "tỉ" } + e.g. không chấm ba lăm -> decimal { integer_part: "0" fractional_part: "35" } + e.g. một triệu rưỡi -> decimal { integer_part: "1" quantity: "triệu" fractional_part: "5" } + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_decimal = graph_digit | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_one = pynini.cross("mốt", "1") + graph_four = pynini.cross("tư", "4") + graph_five = pynini.cross("lăm", "5") + + graph_decimal = pynini.union( + graph_decimal, + graph_four, + pynini.closure(graph_decimal + delete_space, 1) + + (graph_decimal | graph_four | graph_five | graph_one), + ) + self.graph = graph_decimal + + point = pynutil.delete("chấm") | pynutil.delete("phẩy") + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + + pynini.cross(pynini.union("âm", "trừ"), '"true"') + + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer + delete_extra_space, 0, 1) + + point + + delete_extra_space + + graph_fractional + ) + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, + cardinal.graph_hundred_component_at_least_one_none_zero_digit, + ) + final_graph |= optional_graph_negative + get_quantity( + final_graph_wo_sign, + cardinal.graph_hundred_component_at_least_one_none_zero_digit, + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/vi/taggers/electronic.py new file mode 100644 index 0000000..b70afe3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/electronic.py @@ -0,0 +1,90 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_ALPHA, + GraphFst, + insert_space, +) +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. c d f một a còng a b c dot e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("chấm", ".") + username = ( + pynutil.insert('username: "') + + alpha_num + + pynini.closure(delete_extra_space + accepted_username) + + pynutil.insert('"') + ) + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + multi_domain = ( + pynini.closure(process_dot + delete_extra_space + domain + delete_extra_space) + + process_dot + + delete_extra_space + + domain + ) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + multi_domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + pynutil.delete(pynini.union("a còng", "a móc", "a vòng")) + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("w w w", "www"), "www") + protocol_start = ( + pynini.cross("h t t p", "http") | pynini.cross("h t t p s", "https") + ) + pynini.cross(" hai chấm sẹc sẹc ", "://") + # .com, + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + (domain | pynini.closure(accepted_username + delete_extra_space) + accepted_username) + ) + + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + delete_extra_space + + process_dot + + pynini.closure(delete_extra_space + accepted_username, 1) + + pynini.closure(ending, 1, 2) + ) + protocol = pynutil.insert('protocol: "') + protocol + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/vi/taggers/fraction.py new file mode 100644 index 0000000..da15c5e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/fraction.py @@ -0,0 +1,52 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + e.g. 2 phần 3 -> tokens { fraction { numerator: "2" denominator: "3" } } + e.g. 2 trên 3 -> tokens { fraction { numerator: "2" denominator: "3" } } + e.g. 2 chia 3 -> tokens { fraction { numerator: "2" denominator: "3" } } + + Args: + cardinal: OrdinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="fraction", kind="classify") + # integer_part # numerator # denominator + + graph_cardinal = cardinal.graph_no_exception + graph_four = pynini.cross("tư", "4") + + numerator = pynutil.insert('numerator: "') + graph_cardinal + pynutil.insert('"') + fraction_component = pynutil.delete(pynini.union("phần", "trên", "chia")) + denominator = ( + pynutil.insert('denominator: "') + (graph_cardinal | graph_four) + pynutil.insert('"') + ) + + graph_fraction_component = ( + numerator + delete_space + fraction_component + delete_extra_space + denominator + ) + self.graph_fraction_component = graph_fraction_component + + graph = graph_fraction_component + graph = graph.optimize() + self.final_graph_wo_negative = graph + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + + pynini.cross(pynini.union("âm", "trừ"), '"true"') + + delete_extra_space, + 0, + 1, + ) + graph = optional_graph_negative + graph + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/measure.py b/fun_text_processing/inverse_text_normalization/vi/taggers/measure.py new file mode 100644 index 0000000..9b28430 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/measure.py @@ -0,0 +1,99 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. trừ mười hai ki lô gam -> measure { negative: "true" cardinal { integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_four = pynini.cross("tư", "4") + graph_one = pynini.cross("mốt", "1") + graph_half = pynini.cross("rưỡi", "5") + + graph_unit = pynini.string_file(get_abs_path("data/measurements.tsv")) + graph_unit_singular = pynini.invert(graph_unit) # singular -> abbr + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + + pynini.cross(pynini.union("âm", "trừ"), '"true"') + + delete_extra_space, + 0, + 1, + ) + + unit_singular = convert_space(graph_unit_singular) + unit_misc = ( + pynutil.insert("/") + + pynutil.delete("trên") + + delete_space + + convert_space(graph_unit_singular) + ) + + unit_singular = ( + pynutil.insert('units: "') + + ( + unit_singular + | unit_misc + | pynutil.add_weight(unit_singular + delete_space + unit_misc, 0.01) + ) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + cardinal_graph + + pynutil.insert('"') + + pynutil.insert(" }") + + delete_extra_space + + unit_singular + ) + fraction_graph = ( + delete_extra_space + + pynutil.insert('fractional_part: "') + + (graph_digit | graph_half | graph_one | graph_four) + + pynutil.insert('"') + ) + + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + cardinal_graph + + pynutil.insert('" }') + + delete_extra_space + + unit_singular + + fraction_graph + ) + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/money.py b/fun_text_processing/inverse_text_normalization/vi/taggers/money.py new file mode 100644 index 0000000..da441b1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/money.py @@ -0,0 +1,69 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_DIGIT, + GraphFst, + convert_space, + delete_extra_space, +) +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. mười hai đô la mỹ -> money { integer_part: "12" currency: "$" } + e.g. mười phẩy chín đồng -> money { integer_part: "10.9" currency: "đ" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + graph_decimal_final = decimal.final_graph_wo_negative + graph_half = pynini.cross("rưỡi", "5") + + unit = pynini.string_file(get_abs_path("data/currency.tsv")) + unit_singular = pynini.invert(unit) + + graph_unit_singular = ( + pynutil.insert('currency: "') + convert_space(unit_singular) + pynutil.insert('"') + ) + + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + + # twelve dollars fifty, only after integer + optional_cents_suffix = pynini.closure( + delete_extra_space + + pynutil.insert('fractional_part: "') + + ( + pynutil.add_weight(cardinal_graph @ add_leading_zero_to_double_digit, -0.7) + | graph_half + ) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + cardinal_graph + + pynutil.insert('"') + + delete_extra_space + + graph_unit_singular + + optional_cents_suffix + ) + + graph_decimal = ( + graph_decimal_final + delete_extra_space + graph_unit_singular + optional_cents_suffix + ) + final_graph = graph_integer | graph_decimal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/ordinal.py b/fun_text_processing/inverse_text_normalization/vi/taggers/ordinal.py new file mode 100644 index 0000000..7ab8273 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/ordinal.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import GraphFst, delete_space +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + e.g. thứ nhất -> ordinal { integer: "1" } + """ + + def __init__(self): + super().__init__(name="ordinal", kind="classify") + + graph_digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")) + graph_ordinal = pynini.cross("thứ", "") + graph = graph_digit + + self.graph = graph + final_graph = ( + pynutil.insert('integer: "') + + graph_ordinal + + delete_space + + self.graph + + pynutil.insert('"') + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/vi/taggers/punctuation.py new file mode 100644 index 0000000..4cdfaa7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/vi/taggers/telephone.py new file mode 100644 index 0000000..1353c00 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/telephone.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import GraphFst, delete_space +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + một hai ba một hai ba năm sáu bảy tám -> { number_part: "1231235678" } + """ + + def __init__(self): + super().__init__(name="telephone", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + digit = graph_digit | graph_zero + last_digit = ( + digit | pynini.cross("mốt", "1") | pynini.cross("tư", "4") | pynini.cross("lăm", "5") + ) + + graph_number_part = pynini.closure(digit + delete_space, 2) + last_digit + number_part = pynutil.insert('number_part: "') + graph_number_part + pynutil.insert('"') + + graph = number_part + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/time.py b/fun_text_processing/inverse_text_normalization/vi/taggers/time.py new file mode 100644 index 0000000..d5d2c37 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/time.py @@ -0,0 +1,111 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. hai rưỡi -> time { hours: "2" minutes: "30" } + e.g. chín giờ kém hai mươi -> time { hours: "8" minutes: "40" } + e.g. ba phút hai giây -> time { minutes: "3" seconds: "2" } + e.g. mười giờ chín phút bốn mươi lăm giây -> time { hours: "10" minutes: "9" seconds: "45" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + graph_hours_to = pynini.string_file(get_abs_path("data/time/hours_to.tsv")) + graph_minutes_to = pynini.string_file(get_abs_path("data/time/minutes_to.tsv")) + graph_hours = pynini.string_file(get_abs_path("data/time/hours.tsv")) + graph_minutes = pynini.string_file(get_abs_path("data/time/minutes.tsv")) + time_zone_graph = pynini.invert(pynini.string_file(get_abs_path("data/time/time_zone.tsv"))) + + graph_half = pynini.cross("rưỡi", "30") + oclock = pynini.cross("giờ", "") + minute = pynini.cross("phút", "") + optional_minute = pynini.closure(delete_space + minute, 0, 1) + second = pynini.cross("giây", "") + + final_graph_hour = ( + pynutil.insert('hours: "') + graph_hours + pynutil.insert('"') + delete_space + oclock + ) + graph_minute = graph_minutes + optional_minute + graph_second = graph_minutes + delete_space + second + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + graph_hm = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + (graph_minute | graph_half) + + pynutil.insert('"') + ) + + graph_hms = ( + final_graph_hour + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minutes + + delete_space + + minute + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('seconds: "') + + graph_second + + pynutil.insert('"') + ) + + graph_ms = ( + pynutil.insert('minutes: "') + + graph_minutes + + delete_space + + minute + + pynutil.insert('"') + + delete_extra_space + + pynutil.insert('seconds: "') + + (graph_second | graph_half) + + pynutil.insert('"') + ) + + graph_hours_to_component = graph_hours @ graph_hours_to + graph_minutes_to_component = graph_minutes @ graph_minutes_to + + graph_time_to = ( + pynutil.insert('hours: "') + + graph_hours_to_component + + pynutil.insert('"') + + delete_space + + oclock + + delete_space + + pynutil.delete("kém") + + delete_extra_space + + pynutil.insert('minutes: "') + + graph_minutes_to_component + + pynutil.insert('"') + + optional_minute + ) + + final_graph = (final_graph_hour | graph_hm | graph_hms) + final_time_zone_optional + final_graph |= graph_ms + final_graph |= graph_time_to + + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/vi/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..2543568 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/tokenize_and_classify.py @@ -0,0 +1,107 @@ +import os + +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.inverse_text_normalization.vi.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.vi.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.vi.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.vi.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.vi.taggers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.vi.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.vi.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.vi.taggers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.vi.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.vi.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.vi.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.vi.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.vi.taggers.word import WordFst +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_vi_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + fraction = FractionFst(cardinal) + fraction_graph = fraction.fst + + ordinal = OrdinalFst() + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst(cardinal=cardinal).fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst().fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.05) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.08) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.09) + | pynutil.add_weight(money_graph, 1.07) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/vi/taggers/whitelist.py new file mode 100644 index 0000000..dec1f6b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import GraphFst, convert_space +from fun_text_processing.inverse_text_normalization.vi.utils import get_abs_path +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/taggers/word.py b/fun_text_processing/inverse_text_normalization/vi/taggers/word.py new file mode 100644 index 0000000..77b28ce --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/utils.py b/fun_text_processing/inverse_text_normalization/vi/utils.py new file mode 100644 index 0000000..c6fdb74 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/utils.py @@ -0,0 +1,13 @@ +import os + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/cardinal.py new file mode 100644 index 0000000..a54b4ea --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/date.py new file mode 100644 index 0000000..d87beab --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/date.py @@ -0,0 +1,67 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "1" year: "2012"} -> tháng 1 năm 2012 + date { day: "5" month: "10" year: "2021" preserve_order: true } -> 5 tháng 10 năm 2021 + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + + # (day) month year + # day month + graph_dm = day + delete_space + pynutil.insert(" tháng ") + month + graph_dmy = graph_dm + delete_space + pynutil.insert(" năm ") + year + graph_m = pynutil.insert("tháng ") + month + graph_my = pynutil.insert("tháng ") + month + delete_space + pynutil.insert(" năm ") + year + graph_y = pynutil.insert("năm ") + year + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = ( + (graph_y | graph_m | graph_dm | graph_dmy | graph_my) + + delete_space + + optional_preserve_order + ) + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/decimal.py new file mode 100644 index 0000000..595735d --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/decimal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "tỷ" } -> -12.5006 tỷ + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/electronic.py new file mode 100644 index 0000000..32cad1f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/fraction.py new file mode 100644 index 0000000..29edff5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/fraction.py @@ -0,0 +1,34 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction, + e.g. fraction { numerator: "2" denominator: "3" } } -> 2/3 + e.g. fraction { numerator: "20" denominator: "3" negative: "true"} } -> 2/3 + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + numerator = ( + pynutil.delete('numerator: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + + denominator = ( + pynutil.insert("/") + + pynutil.delete('denominator: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = (numerator + delete_space + denominator).optimize() + self.numbers = graph + delete_tokens = self.delete_tokens(optional_sign + graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/measure.py new file mode 100644 index 0000000..f4088b7 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/measure.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_CHAR, + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + graph = ( + (graph_cardinal | graph_decimal) + + delete_space + + optional_fractional + + pynutil.insert(" ") + + unit + + delete_space + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/money.py new file mode 100644 index 0000000..71de0f3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/money.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> 12.05$ + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = decimal.numbers + delete_space + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/ordinal.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/ordinal.py new file mode 100644 index 0000000..0d152d1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/ordinal.py @@ -0,0 +1,28 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "2" } -> thứ 2 + """ + + def __init__(self): + super().__init__(name="ordinal", kind="verbalize") + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = pynutil.insert("thứ ") + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/telephone.py new file mode 100644 index 0000000..bb603d6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/telephone.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "1231235678" } + -> 1231235678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/time.py new file mode 100644 index 0000000..5e3b3dc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/time.py @@ -0,0 +1,82 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "3" } -> 3h + time { hours: "12" minutes: "30" } -> 12:30 + time { hours: "1" minutes: "12" second: "22"} -> 1:12:22 + time { minutes: "36" second: "45"} -> 36p45s + time { hours: "2" zone: "gmt" } -> 2h gmt + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + second = ( + pynutil.delete("seconds:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + zone = ( + delete_space + + insert_space + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + optional_second = pynini.closure( + delete_space + pynutil.insert(":") + (second @ add_leading_zero_to_double_digit), + 0, + 1, + ) + + graph_h = hour + pynutil.insert("h") + graph_hms = ( + hour + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + optional_second + ) + graph_ms = ( + minute + + delete_space + + pynutil.insert("p") + + (second @ add_leading_zero_to_double_digit) + + pynutil.insert("s") + ) + + graph = (graph_h | graph_ms | graph_hms) + optional_zone + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/verbalize.py new file mode 100644 index 0000000..f99c31f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/verbalize.py @@ -0,0 +1,51 @@ +from fun_text_processing.inverse_text_normalization.vi.graph_utils import GraphFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.ordinal import OrdinalFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.whitelist import WhiteListFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + fraction = FractionFst() + fraction_graph = fraction.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | fraction_graph + | decimal_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/verbalize_final.py new file mode 100644 index 0000000..fe6d126 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from fun_text_processing.inverse_text_normalization.vi.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.vi.verbalizers.word import WordFst +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/whitelist.py new file mode 100644 index 0000000..4574121 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/vi/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/vi/verbalizers/word.py new file mode 100644 index 0000000..07cf189 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/vi/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.vi.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/__init__.py b/fun_text_processing/inverse_text_normalization/zh/__init__.py new file mode 100644 index 0000000..b21a931 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/__init__.py @@ -0,0 +1,7 @@ +from fun_text_processing.inverse_text_normalization.zh.taggers.tokenize_and_classify import ( + ClassifyFst, +) +from fun_text_processing.inverse_text_normalization.zh.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.verbalize_final import ( + VerbalizeFinalFst, +) diff --git a/fun_text_processing/inverse_text_normalization/zh/data/__init__.py b/fun_text_processing/inverse_text_normalization/zh/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/zh/data/days.tsv b/fun_text_processing/inverse_text_normalization/zh/data/days.tsv new file mode 100644 index 0000000..deb072a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/days.tsv @@ -0,0 +1,62 @@ +一日 01 +二日 02 +三日 03 +四日 04 +五日 05 +六日 06 +七日 07 +八日 08 +九日 09 +十日 10 +十一日 11 +十二日 12 +十三日 13 +十四日 14 +十五日 15 +十六日 16 +十七日 17 +十八日 18 +十九日 19 +二十日 20 +二十一日 21 +二十二日 22 +二十三日 23 +二十四日 24 +二十五日 25 +二十六日 26 +二十七日 27 +二十八日 28 +二十九日 29 +三十日 30 +三十一日 31 +一号 01 +二号 02 +三号 03 +四号 04 +五号 05 +六号 06 +七号 07 +八号 08 +九号 09 +十号 10 +十一号 11 +十二号 12 +十三号 13 +十四号 14 +十五号 15 +十六号 16 +十七号 17 +十八号 18 +十九号 19 +二十号 20 +二十一号 21 +二十二号 22 +二十三号 23 +二十四号 24 +二十五号 25 +二十六号 26 +二十七号 27 +二十八号 28 +二十九号 29 +三十号 30 +三十一号 31 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/electronic/__init__.py b/fun_text_processing/inverse_text_normalization/zh/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/zh/data/electronic/domain.tsv b/fun_text_processing/inverse_text_normalization/zh/data/electronic/domain.tsv new file mode 100644 index 0000000..7d80556 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/electronic/domain.tsv @@ -0,0 +1,13 @@ +com +uk +fr +net +br +in +ru +de +it +ai +edu +cn +org diff --git a/fun_text_processing/inverse_text_normalization/zh/data/electronic/server_name.tsv b/fun_text_processing/inverse_text_normalization/zh/data/electronic/server_name.tsv new file mode 100644 index 0000000..ca7f97b --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +g mail gmail +gmail +n vidia nvidia +nvidia +outlook +hotmail +yahoo +aol +gmx +msn +live +yandex +orange +wanadoo +web +comcast +google diff --git a/fun_text_processing/inverse_text_normalization/zh/data/electronic/symbols.tsv b/fun_text_processing/inverse_text_normalization/zh/data/electronic/symbols.tsv new file mode 100644 index 0000000..46c8a68 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/electronic/symbols.tsv @@ -0,0 +1,24 @@ +. 点 +- 横杠 +- 横线 +_ 下划线 +! 感叹号 +! 叹号 +# 井号 +$ dollar 符 +% 百分号 +& ampersand +' 引号 +' 单引号 +* 星号 ++ 加号 +/ 斜杆 += 等号 +? 问号 +^ circumflex +` right single quote +{ 左大括号 +| 竖线 +} 右大括号 +~ 代字号 +, 逗号 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/magnitudes.tsv b/fun_text_processing/inverse_text_normalization/zh/data/magnitudes.tsv new file mode 100644 index 0000000..3bfa484 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/magnitudes.tsv @@ -0,0 +1,4 @@ +k thousand +m million +b billion +t trillion \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/zh/data/measurements_en.tsv b/fun_text_processing/inverse_text_normalization/zh/data/measurements_en.tsv new file mode 100644 index 0000000..e045fb1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/measurements_en.tsv @@ -0,0 +1,82 @@ +原子质量 amu +巴 bar +平方厘米 cm² +立方厘米 cm³ +厘米 cm +美担 cwt +摄氏度 °C +分贝 db +立方分米 dm³ +分米 dm +英尺 ft +华氏度 °F +吉字节 gb +吉赫兹 ghz +吉帕斯卡 gpa +吉瓦时 gwh +吉瓦 gw +戈瑞 gy +小时 h +公顷 ha +赫兹 hz +千比特每秒 kbps +千比特一秒 kbps +千卡 kcal +千克力 kgf +千克 kg +千赫兹 khz +平方千米 km² +公里 km +千米 km +千米每小时 km/h +千米一小时 km/h +千帕 kpa +千瓦时 kwh +千瓦 kw +磅 lbs +平方米 m² +立方米 m³ +兆比特每秒 mbps +兆比特一秒 mbps +克 g +毫克 mg +兆赫兹 mhz +平方英里 mi² +分钟 min +英里 mi +毫升 ml +平方毫米 mm² +毫米 mm +摩尔 mol +兆帕 mpa +英里每小时 mph +英里一小时 mph +毫秒 ms +毫伏 mv +毫瓦 mw +千伏 kv +米 m +纳克 ng +纳米 nm +纳秒 ns +盎司 oz +度 º +帕斯卡 pa +皮克 pg +皮秒 ps +弧度 rad +转每分 rpm +平方英尺 sq ft +平方英里 sq mi +系沃特 sv +秒 s +太字节 tb +万亿焦耳 tj +台两 tl +伏特 v +码 yd +微克 μg +微米 μm +微秒 μs +欧米茄 ω +度 ° diff --git a/fun_text_processing/inverse_text_normalization/zh/data/measurements_zh.tsv b/fun_text_processing/inverse_text_normalization/zh/data/measurements_zh.tsv new file mode 100644 index 0000000..767307f --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/measurements_zh.tsv @@ -0,0 +1,192 @@ +年来 +年前 +年后 +年内 +年之前 +年之后 +人 +篇 +帧 +把 +封 +艘 +套 +段 +号 +匹 +张 +座 +回 +场 +尾 +条 +个 +首 +阙 +阵 +网 +炮 +顶 +丘 +棵 +只 +支 +袭 +辆 +挑 +担 +颗 +壳 +窠 +曲 +墙 +群 +腔 +砣 +座 +客 +贯 +扎 +捆 +刀 +令 +打 +手 +罗 +坡 +山 +岭 +江 +溪 +钟 +队 +单 +双 +对 +口 +头 +脚 +板 +跳 +枝 +件 +贴 +针 +线 +管 +名 +位 +身 +堂 +课 +本 +页 +家 +户 +层 +丝 +毫 +厘 +分 +钱 +斤 +担 +铢 +石 +钧 +锱 +忽 +克 +毫 +厘 +寸 +尺 +丈 +里 +寻 +常 +铺 +程 +米 +撮 +勺 +合 +升 +斗 +石 +盘 +碗 +碟 +叠 +桶 +笼 +盆 +盒 +杯 +钟 +斛 +锅 +簋 +篮 +盘 +桶 +罐 +瓶 +壶 +卮 +盏 +箩 +箱 +煲 +啖 +袋 +钵 +季 +年 +月 +日 +刻 +时 +周 +天 +秒 +旬 +纪 +岁 +世 +更 +夜 +春 +夏 +秋 +冬 +代 +伏 +辈 +丸 +泡 +粒 +颗 +幢 +堆 +条 +根 +支 +道 +面 +片 +张 +颗 +块 +架 +角 +毛 +字 +元 +两 +两米饭 +两酒 +吨 +顿 +牛 +次 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/money/code.tsv b/fun_text_processing/inverse_text_normalization/zh/data/money/code.tsv new file mode 100644 index 0000000..2eba043 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/money/code.tsv @@ -0,0 +1,117 @@ +澳元 A$ +阿联酋迪拉姆 AED +阿富汗 阿富汗尼 AFN +阿尔巴尼亚列克 ALL +荷属安的列斯盾 ANG +阿根廷比索 ARS +澳元 AUD +阿鲁巴盾 AWG +阿塞拜疆马纳特 AZN +波斯尼亚和黑塞哥维那可兑换马克 BAM +巴巴多斯元 BBD +保加利亚列弗 BGN +百慕大元 BMD +文莱达鲁萨兰国元 BND +玻利维亚玻利维亚诺 BOB +巴西雷亚尔 BRL +巴哈马元 BSD +博茨瓦纳普拉 BWP +白俄罗斯卢布 BYN +伯利兹元 BZD +加元 CAD$ +加元 CAD +瑞士法郎 CHF +智利比索 CLP +人民币 CNY +哥伦比亚比索 COP +哥斯达黎加科隆 CRC +古巴比索 CUP +捷克克朗 CZK +丹麦克朗 DKK +多米尼加共和国比索 DOP +埃及镑 EGP +欧元成员国 EUR +斐济元 FJD +福克兰群岛(马尔维纳斯)镑 FKP +英镑 GBP +根西岛镑 GGP +加纳塞地 GHS +直布罗陀镑 GIP +危地马拉格查尔 GTQ +圭亚那元 GYD +港元 HK$ +港元 HKD +洪都拉斯伦皮拉 HNL +克罗地亚库纳 HRK +匈牙利福林 HUF +印尼盾 IDR +以色列谢克尔 ILS +马恩岛英镑 IMP +印度卢比 INR +伊朗里亚尔 IRR +冰岛克朗 ISK +日元 J¥ +泽西镑 JEP +牙买加元 JMD +日元 JPY¥ +日元 JPY +吉尔吉斯斯坦索姆 KGS +柬埔寨瑞尔 KHR +朝鲜元 KPW +韩元 KRW +韩元 KRW +开曼群岛元 KYD +哈萨克斯坦腾格 KZT +老挝基普 LAK +黎巴嫩镑 LBP +斯里兰卡卢比 LKR +利比里亚元 LRD +马其顿代纳尔 MKD +摩洛哥迪拉姆 MNT +蒙古图格里克 MNT +毛里求斯卢比 MUR +墨西哥比索 MXN +马来西亚令吉 MYR +莫桑比克梅蒂卡尔 MZN +纳米比亚元 NAD +尼日利亚奈拉 NGN +尼加拉瓜科尔多瓦 NIO +挪威克朗 NOK +尼泊尔卢比 NPR +新西兰元 NZD +阿曼里亚尔 OMR +巴拿马巴尔博亚 PAB +秘鲁索尔 PEN +菲律宾比索 PHP +巴基斯坦卢比 PKR +波兰兹罗提 PLN +巴拉圭瓜拉尼 PYG +卡塔尔里亚尔 QAR +罗马尼亚列伊 RON +塞尔维亚第纳尔 RSD +俄罗斯卢布 RUB +沙特阿拉伯里亚尔 SAR +所罗门群岛元 SBD +塞舌尔卢比 SCR +瑞典克朗 SEK +新加坡元 SGD +圣赫勒拿镑 SHP +索马里先令 SOS +苏里南元 SRD +萨尔瓦多科隆 SVC +叙利亚镑 SYP +泰铢 THB +土耳其里拉 TRY +特立尼达和多巴哥元 TTD +图瓦卢元 TVD +新台币 TWD +乌克兰格里夫纳 UAH +美元 USD +乌拉圭比索 UYU +乌兹别克斯坦索姆 UZS +委内瑞拉玻利瓦尔 VEF +越南东 VND +东加勒比元 XCD +也门里亚尔 YER +南非兰特 ZAR +津巴布韦元 ZWD diff --git a/fun_text_processing/inverse_text_normalization/zh/data/money/symbol.tsv b/fun_text_processing/inverse_text_normalization/zh/data/money/symbol.tsv new file mode 100644 index 0000000..e439536 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/money/symbol.tsv @@ -0,0 +1,63 @@ +加纳塞地 ¢ +玻利维亚玻利维亚诺 $b +乌拉圭比索 $U +美元 $ +英镑 £ +英镑 £ +元 ¥ +元 ¥ +泰铢 ฿ +柬埔寨瑞尔 ៛ +哥斯达黎加科隆 ₡ +尼日利亚奈拉 ₦ +朝鲜园 ₩ +以色列谢克尔 ₪ +越南东 ₫ +欧元 € +老挝基普 ₭ +蒙古图格里克 ₮ +古巴比索 ₱ +菲律宾比索 ₱ +乌克兰格里夫纳 ₴ +印度卢比 ₹ +土耳其里拉 ₺ +卢布 ₽ +白俄罗斯卢布 Br +委内瑞拉玻利瓦尔 Bs +伯利兹元 BZ$ +巴拿马巴尔博亚 B/. +尼加拉瓜科尔多瓦 C$ +瑞士法郎 CHF +匈牙利福林 Ft +阿鲁巴盾 ƒ +巴拉圭瓜拉尼 Gs +牙买加元 J$ +捷克克朗 Kč +波斯尼亚和黑塞哥维那可兑换马克 KM +克罗地亚库纳 kn +丹麦克朗 kr +罗马尼亚列伊 lei +阿尔巴尼亚列克 Lek +洪都拉斯伦皮拉 L +莫桑比克梅蒂卡尔 MT +新台币 NT$ +博茨瓦纳普拉 P +危地马拉格查尔 Q +巴西雷亚尔 R$ +多米尼加共和国比索 RD$ +马来西亚令吉 RM +印尼盾 Rp +巴基斯坦卢比 ₨ +毛里求斯卢比 ₨ +南非兰特 R +秘鲁索尔 S/. +索马里先令 S +特立尼达和多巴哥元 TT$ +津巴布韦元 Z$ +波兰兹罗提 zł +马其顿代纳尔 ден +塞尔维亚第纳尔 Дин. +乌兹别克斯坦索姆 лв +保加利亚列弗 лв +吉尔吉斯斯坦索姆 лв +哈萨克斯坦腾格 лв diff --git a/fun_text_processing/inverse_text_normalization/zh/data/months.tsv b/fun_text_processing/inverse_text_normalization/zh/data/months.tsv new file mode 100644 index 0000000..fd7befc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/months.tsv @@ -0,0 +1,12 @@ +一月 01 +二月 02 +三月 03 +四月 04 +五月 05 +六月 06 +七月 07 +八月 08 +九月 09 +十月 10 +十一月 11 +十二月 12 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/__init__.py b/fun_text_processing/inverse_text_normalization/zh/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/digit.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/digit.tsv new file mode 100644 index 0000000..cea5c81 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/digit.tsv @@ -0,0 +1,11 @@ +一 1 +幺 1 +二 2 +两 2 +三 3 +四 4 +五 5 +六 6 +七 7 +八 8 +九 9 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/dot.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/dot.tsv new file mode 100644 index 0000000..be4e7bd --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/dot.tsv @@ -0,0 +1 @@ +点 . diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/hundred.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/hundred.tsv new file mode 100644 index 0000000..10e2b96 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/hundred.tsv @@ -0,0 +1 @@ +hundred \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/sign.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/sign.tsv new file mode 100644 index 0000000..73436c2 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/sign.tsv @@ -0,0 +1,4 @@ +正 + +正负 ± +负 - +负的 - diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/teen.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/teen.tsv new file mode 100644 index 0000000..8e60fa1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/teen.tsv @@ -0,0 +1,10 @@ +ten 10 +eleven 11 +twelve 12 +thirteen 13 +fourteen 14 +fifteen 15 +sixteen 16 +seventeen 17 +eighteen 18 +nineteen 19 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/thousands.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/thousands.tsv new file mode 100644 index 0000000..bf30542 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/thousands.tsv @@ -0,0 +1,22 @@ +thousand +million +billion +trillion +quadrillion +quintillion +sextillion +septillion +octillion +nonillion +decillion +undecillion +duodecillion +tredecillion +quattuordecillion +quindecillion +sexdecillion +septendecillion +octodecillion +novemdecillion +vigintillion +centillion \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/ties.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/ties.tsv new file mode 100644 index 0000000..d7ec82e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/ties.tsv @@ -0,0 +1,9 @@ +twenty 2 +thirty 3 +forty 4 +fourty 4 +fifty 5 +sixty 6 +seventy 7 +eighty 8 +ninety 9 \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/zh/data/numbers/zero.tsv b/fun_text_processing/inverse_text_normalization/zh/data/numbers/zero.tsv new file mode 100644 index 0000000..4b41207 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/numbers/zero.tsv @@ -0,0 +1 @@ +零 0 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/suppletive.tsv b/fun_text_processing/inverse_text_normalization/zh/data/suppletive.tsv new file mode 100644 index 0000000..115460a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/suppletive.tsv @@ -0,0 +1,83 @@ +deer +fish +sheep +foot feet +goose geese +man men +mouse mice +tooth teeth +woman women +won +child children +ox oxen +wife wives +wolf wolves +analysis analyses +criterion criteria +lbs +focus foci +percent +hertz +kroner krone +inch inches +calory calories +yen +megahertz +gigahertz +kilohertz +hertz +CC +c c +horsepower +hundredweight +kilogram force kilograms force +mega siemens +revolution per minute revolutions per minute +mile per hour miles per hour +megabit per second megabits per second +square foot square feet +kilobit per second kilobits per second +degree Celsius degrees Celsius +degree Fahrenheit degrees Fahrenheit +ATM +AU +BQ +CC +CD +DA +EB +EV +F +GB +G +GL +GPA +GY +HA +H +HL +GP +HS +KB +KL +KN +KT +KV +LM +MA +MA +MB +MC +MF +M +MM +MS +MV +MW +PB +PG +PS +S +TB +YB +ZB \ No newline at end of file diff --git a/fun_text_processing/inverse_text_normalization/zh/data/time/__init__.py b/fun_text_processing/inverse_text_normalization/zh/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/zh/data/time/hour.tsv b/fun_text_processing/inverse_text_normalization/zh/data/time/hour.tsv new file mode 100644 index 0000000..f3d0067 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/time/hour.tsv @@ -0,0 +1,34 @@ +一点 1 +两点 2 +三点 3 +四点 4 +五点 5 +六点 6 +七点 7 +八点 8 +九点 9 +零点 00 +一点 01 +两点 02 +三点 03 +四点 04 +五点 05 +六点 06 +七点 07 +八点 08 +九点 09 +十点 10 +十一点 11 +十二点 12 +十三点 13 +十四点 14 +十五点 15 +十六点 16 +十七点 17 +十八点 18 +十九点 19 +二十点 20 +二十一点 21 +二十二点 22 +二十三点 23 +二十四点 24 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/time/minute.tsv b/fun_text_processing/inverse_text_normalization/zh/data/time/minute.tsv new file mode 100644 index 0000000..66f9751 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/time/minute.tsv @@ -0,0 +1,60 @@ +半 30 +零一 01 +零二 02 +零三 03 +零四 04 +零五 05 +零六 06 +零七 07 +零八 08 +零九 09 +十 10 +十一 11 +十二 12 +十三 13 +十四 14 +十五 15 +十六 16 +十七 17 +十八 18 +十九 19 +二十 20 +二十一 21 +二十二 22 +二十三 23 +二十四 24 +二十五 25 +二十六 26 +二十七 27 +二十八 28 +二十九 29 +三十 30 +三十一 31 +三十二 32 +三十三 33 +三十四 34 +三十五 35 +三十六 36 +三十七 37 +三十八 38 +三十九 39 +四十 40 +四十一 41 +四十二 42 +四十三 43 +四十四 44 +四十五 45 +四十六 46 +四十七 47 +四十八 48 +四十九 49 +五十 50 +五十一 51 +五十二 52 +五十三 53 +五十四 54 +五十五 55 +五十六 56 +五十七 57 +五十八 58 +五十九 59 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/time/noon.tsv b/fun_text_processing/inverse_text_normalization/zh/data/time/noon.tsv new file mode 100644 index 0000000..b62cbbc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/time/noon.tsv @@ -0,0 +1,6 @@ +上午 a.m. +早上 a.m. +早晨 a.m. +下午 p.m. +晚上 p.m. +傍晚 p.m. diff --git a/fun_text_processing/inverse_text_normalization/zh/data/time/second.tsv b/fun_text_processing/inverse_text_normalization/zh/data/time/second.tsv new file mode 100644 index 0000000..3a0116a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/time/second.tsv @@ -0,0 +1,60 @@ + 00 +一秒 01 +二秒 02 +三秒 03 +四秒 04 +五秒 05 +六秒 06 +七秒 07 +八秒 08 +九秒 09 +十秒 10 +十一秒 11 +十二秒 12 +十三秒 13 +十四秒 14 +十五秒 15 +十六秒 16 +十七秒 17 +十八秒 18 +十九秒 19 +二十秒 20 +二十一秒 21 +二十二秒 22 +二十三秒 23 +二十四秒 24 +二十五秒 25 +二十六秒 26 +二十七秒 27 +二十八秒 28 +二十九秒 29 +三十秒 30 +三十一秒 31 +三十二秒 32 +三十三秒 33 +三十四秒 34 +三十五秒 35 +三十六秒 36 +三十七秒 37 +三十八秒 38 +三十九秒 39 +四十秒 40 +四十一秒 41 +四十二秒 42 +四十三秒 43 +四十四秒 44 +四十五秒 45 +四十六秒 46 +四十七秒 47 +四十八秒 48 +四十九秒 49 +五十秒 50 +五十一秒 51 +五十二秒 52 +五十三秒 53 +五十四秒 54 +五十五秒 55 +五十六秒 56 +五十七秒 57 +五十八秒 58 +五十九秒 59 diff --git a/fun_text_processing/inverse_text_normalization/zh/data/whitelist.tsv b/fun_text_processing/inverse_text_normalization/zh/data/whitelist.tsv new file mode 100644 index 0000000..7eed41e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/data/whitelist.tsv @@ -0,0 +1,12 @@ +e.g. for example +dr. doctor +mr. mister +mrs. misses +st. saint +7-eleven seven eleven +es3 e s three +s&p s and p +ASAP a s a p +AT&T a t and t +LLP l l p +ATM a t m diff --git a/fun_text_processing/inverse_text_normalization/zh/graph_utils.py b/fun_text_processing/inverse_text_normalization/zh/graph_utils.py new file mode 100644 index 0000000..9e213b8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/graph_utils.py @@ -0,0 +1,206 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from pynini import Far +from pynini.examples import plurals +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() + +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" + +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +delete_zero_or_one_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE, 0, 1)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") + +delete_preserve_order = pynini.closure( + pynutil.delete(" preserve_order: true") + | (pynutil.delete(' field_order: "') + DAMO_NOT_QUOTE + pynutil.delete('"')) +) + +suppletive = pynini.string_file(get_abs_path("data/suppletive.tsv")) +# _v = pynini.union("a", "e", "i", "o", "u") +_c = pynini.union( + "b", + "c", + "d", + "f", + "g", + "h", + "j", + "k", + "l", + "m", + "n", + "p", + "q", + "r", + "s", + "t", + "v", + "w", + "x", + "y", + "z", +) +_ies = DAMO_SIGMA + _c + pynini.cross("y", "ies") +_es = DAMO_SIGMA + pynini.union("s", "sh", "ch", "x", "z") + pynutil.insert("es") +_s = DAMO_SIGMA + pynutil.insert("s") + +graph_plural = plurals._priority_union( + suppletive, + plurals._priority_union(_ies, plurals._priority_union(_es, _s, DAMO_SIGMA), DAMO_SIGMA), + DAMO_SIGMA, +).optimize() + +SINGULAR_TO_PLURAL = graph_plural +PLURAL_TO_SINGULAR = pynini.invert(graph_plural) +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) +MIN_NEG_WEIGHT = -0.0001 +MIN_POS_WEIGHT = 0.0001 + + +def generator_main(file_name: str, graphs: Dict[str, "pynini.FstLike"]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def get_plurals(fst): + """ + Given singular returns plurals + Args: + fst: Fst + Returns plurals to given singular forms + """ + return SINGULAR_TO_PLURAL @ fst + + +def get_singulars(fst): + """ + Given plural returns singulars + Args: + fst: Fst + Returns singulars to given plural forms + """ + return PLURAL_TO_SINGULAR @ fst + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + Args: + fst: input fst + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/.cardinal.py.swp b/fun_text_processing/inverse_text_normalization/zh/taggers/.cardinal.py.swp new file mode 100644 index 0000000..f9e442b Binary files /dev/null and b/fun_text_processing/inverse_text_normalization/zh/taggers/.cardinal.py.swp differ diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/__init__.py b/fun_text_processing/inverse_text_normalization/zh/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/cardinal.py b/fun_text_processing/inverse_text_normalization/zh/taggers/cardinal.py new file mode 100644 index 0000000..6037eff --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/cardinal.py @@ -0,0 +1,127 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals + e.g. minus twenty three -> cardinal { integer: "23" negative: "-" } } + Numbers below thirteen are not converted. + """ + + def __init__(self): + super().__init__(name="cardinal", kind="classify") + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_sign = pynini.string_file(get_abs_path("data/numbers/sign.tsv")) + graph_dot = pynini.string_file(get_abs_path("data/numbers/dot.tsv")) + + addzero = pynutil.insert("0") + graph_digits = graph_digit | graph_zero + + # 单位, 十 + # 十一 + graph_teen = pynini.cross("十", "1") + (graph_digit | addzero) + + ##二十一 + graph_tens = graph_digit + pynutil.delete("十") + (graph_digit | addzero) + + # 单位, 百 + # 一百一十 一百零六 一百二十 两百 + graph_hundred = ( + graph_digit + + pynutil.delete("百") + + ( + graph_tens + | graph_teen + | pynutil.add_weight(graph_zero + graph_digit, 0.1) + | pynutil.add_weight(graph_digit + addzero, 0.5) + | pynutil.add_weight(addzero**2, 0.1) + ) + ) + + graph_hundred_component_at_least_one_none_zero_digit = graph_hundred @ ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT) + ) + + self.graph_hundred_component_at_least_one_none_zero_digit = ( + graph_hundred_component_at_least_one_none_zero_digit + ) + + # 单位, 千 + # 一千两百三十四 一千零三十四, 一千零四 一千二百 + # 五千 + graph_thousand = ( + (graph_hundred | graph_teen | graph_tens | graph_digits) + + pynutil.delete("千") + + ( + graph_hundred + | pynutil.add_weight(graph_zero + graph_tens, 0.1) + | pynutil.add_weight(addzero + graph_zero + graph_digit, 0.5) + | pynutil.add_weight(graph_digit + addzero**2, 0.8) + | pynutil.add_weight(addzero**3, 1.0) + ) + ) + + # 单位,万 + graph_ten_thousand = ( + (graph_thousand | graph_hundred | graph_teen | graph_tens | graph_digit) + + pynutil.delete("万") + + ( + graph_thousand + | pynutil.add_weight(graph_zero + graph_hundred, 0.1) + | pynutil.add_weight(addzero + graph_zero + graph_tens, 0.5) + | pynutil.add_weight(addzero + addzero + graph_zero + graph_digit, 0.5) + | pynutil.add_weight(graph_digit + addzero**3, 0.8) + | pynutil.add_weight(addzero**4, 1.0) + ) + ) + + # 单位, 亿/兆 + graph_number = ( + graph_digits + | graph_teen + | graph_tens + | graph_hundred + | graph_thousand + | graph_ten_thousand + ) + + graph_number = ( + (graph_number + pynini.accep("兆") + pynutil.delete("零").ques).ques + + (graph_number + pynini.accep("亿") + pynutil.delete("零").ques).ques + + graph_number + ) + + ##符号 + graph = graph_number + # IP + graph |= graph_digit.plus + (graph_dot + graph_digit.plus).plus + + # just fill + labels_exception = ["ttttt"] + graph_exception = pynini.union(*labels_exception) + + self.graph_no_exception = graph + + self.graph = (pynini.project(graph, "input") - graph_exception.arcsort()) @ graph + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("负", '"-"'), 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/date.py b/fun_text_processing/inverse_text_normalization/zh/taggers/date.py new file mode 100644 index 0000000..0089957 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/date.py @@ -0,0 +1,77 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).optimize() +graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")).optimize() + + +def _get_month_graph(): + """ + Transducer for month, e.g. march -> march + """ + month_graph = pynini.string_file(get_abs_path("data/months.tsv")) + return month_graph + + +def _get_day_graph(): + """ + Tranducer for day, + """ + day_graph = pynini.string_file(get_abs_path("data/days.tsv")) + return day_graph + + +def _get_year_graph(): + """ + Transducer for year, + """ + year_graph = graph_digit + (graph_digit | graph_zero) ** 3 + year_graph |= graph_digit**2 + + return year_graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, + e.g. january fifth twenty twelve -> date { month: "january" day: "5" year: "2012" preserve_order: true } + e.g. the fifth of january twenty twelve -> date { day: "5" month: "january" year: "2012" preserve_order: true } + e.g. twenty twenty -> date { year: "2012" preserve_order: true } + + Args: + ordinal: OrdinalFst + """ + + def __init__(self): + super().__init__(name="date", kind="classify") + + year_graph = _get_year_graph() + + year_graph = ( + pynutil.insert('year: "') + year_graph + pynutil.delete("年") + pynutil.insert('"') + ) + + month_graph = _get_month_graph() + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + + day_graph = _get_day_graph() + day_graph = pynutil.insert('day: "') + day_graph + pynutil.insert('"') + + graph_md = month_graph + pynutil.insert(" ") + day_graph + graph_ym = year_graph + pynutil.insert(" ") + month_graph + graph_ymd = year_graph + pynutil.insert(" ") + month_graph + pynutil.insert(" ") + day_graph + + graph_year = year_graph + + final_graph = graph_ymd | graph_ym | graph_md | graph_year + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/decimal.py b/fun_text_processing/inverse_text_normalization/zh/taggers/decimal.py new file mode 100644 index 0000000..a8e1a47 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/decimal.py @@ -0,0 +1,59 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal + e.g. minus twelve point five o o six billion -> decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } + e.g. one billion -> decimal { integer_part: "1" quantity: "billion" } + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="decimal", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_dot = pynini.string_file(get_abs_path("data/numbers/dot.tsv")) + + graph_digits = graph_digit | graph_zero + + graph_decimal = graph_digits.plus + + self.graph = graph_decimal + + point = pynini.cross("点", "") + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + + (pynini.cross("负", '"true"') | pynini.cross("负的", '"true"')) + + delete_extra_space, + 0, + 1, + ) + + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_decimal + pynutil.insert('"') + ) + graph_integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + final_graph_wo_sign = ( + pynini.closure(graph_integer, 0, 1) + point + pynutil.insert(" ") + graph_fractional + ) + + final_graph = optional_graph_negative + final_graph_wo_sign + + self.final_graph_wo_negative = final_graph_wo_sign + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/electronic.py b/fun_text_processing/inverse_text_normalization/zh/taggers/electronic.py new file mode 100644 index 0000000..02da3c5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/electronic.py @@ -0,0 +1,102 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_ALPHA, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. c d f one at a b c dot e d u -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + """ + + def __init__(self): + super().__init__(name="electronic", kind="classify") + + delete_extra_space = pynutil.delete(" ") + alpha_num = ( + DAMO_ALPHA + | pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + | pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ) + + symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).invert() + + accepted_username = alpha_num | symbols + process_dot = pynini.cross("点", ".") + username = ( + alpha_num + pynini.closure(delete_extra_space + accepted_username) + ) | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + username = pynutil.insert('username: "') + username + pynutil.insert('"') + single_alphanum = pynini.closure(alpha_num + delete_extra_space) + alpha_num + server = single_alphanum | pynini.string_file( + get_abs_path("data/electronic/server_name.tsv") + ) + domain = single_alphanum | pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + domain_graph = ( + pynutil.insert('domain: "') + + server + + delete_extra_space + + process_dot + + delete_extra_space + + domain + + pynutil.insert('"') + ) + graph = ( + username + + delete_extra_space + + (pynutil.delete("at") | pynutil.delete("艾特")) + + insert_space + + delete_extra_space + + domain_graph + ) + + ############# url ### + protocol_end = pynini.cross(pynini.union("w w w", "www"), "www") + protocol_start = ( + pynini.cross("h t t p", "http") | pynini.cross("h t t p s", "https") + ) + pynini.cross("冒号斜杆斜杠", "://") + # .com, + ending = ( + delete_extra_space + + symbols + + delete_extra_space + + ( + domain + | pynini.closure( + accepted_username + delete_extra_space, + ) + + accepted_username + ) + ) + + protocol_default = ( + ( + (pynini.closure(delete_extra_space + accepted_username, 1) | server) + | pynutil.add_weight(pynini.closure(DAMO_ALPHA, 1), weight=0.0001) + ) + + pynini.closure(ending, 1) + ).optimize() + protocol = ( + pynini.closure(protocol_start, 0, 1) + + protocol_end + + pynini.closure(pynini.cross(" ", ""), 0, 1) + + process_dot + + pynini.closure(pynini.cross(" ", ""), 0, 1) + + protocol_default + ).optimize() + + protocol |= ( + pynini.closure(protocol_end + delete_extra_space + process_dot, 0, 1) + protocol_default + ) + + protocol = pynutil.insert('protocol: "') + protocol.optimize() + pynutil.insert('"') + graph |= protocol + ######## + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/fraction.py b/fun_text_processing/inverse_text_normalization/zh/taggers/fraction.py new file mode 100644 index 0000000..9b2386e --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/fraction.py @@ -0,0 +1,57 @@ +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + convert_space, + delete_space, + delete_extra_space, + DAMO_SIGMA, + DAMO_CHAR, + DAMO_SPACE, +) + +import pynini +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="fraction", kind="classify") + # integer_part # numerator # denominator + graph_cardinal = cardinal.graph_no_exception + + # without the integerate part + # 分子 + numerator = pynutil.insert('numerator: "') + graph_cardinal + pynutil.insert('"') + # 分母 + denominator = ( + pynutil.insert('denominator: "') + + graph_cardinal + + pynutil.delete("分之") + + pynutil.insert('"') + ) + + ## + graph_fraction_component = denominator + pynutil.insert(" ") + numerator + + self.graph_fraction_component = graph_fraction_component + + graph = graph_fraction_component + graph = graph.optimize() + self.final_graph_wo_negative = graph + + ##负 + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + + (pynini.cross("负", '"true"') | pynini.cross("负的", '"true"')) + + DAMO_SPACE, + 0, + 1, + ) + + graph = optional_graph_negative + graph + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/measure.py b/fun_text_processing/inverse_text_normalization/zh/taggers/measure.py new file mode 100644 index 0000000..f6594a5 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/measure.py @@ -0,0 +1,75 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure + e.g. minus twelve kilograms -> measure { negative: "true" cardinal { integer: "12" } units: "kg" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="measure", kind="classify") + + cardinal_graph = cardinal.graph_no_exception + + graph_unit_en = pynini.string_file(get_abs_path("data/measurements_en.tsv")) + graph_unit_zh = pynini.string_file(get_abs_path("data/measurements_zh.tsv")) + graph_sign = pynini.string_file(get_abs_path("data/numbers/sign.tsv")) + + graph_units = graph_unit_en | ( + (pynini.accep("亿") | pynini.accep("兆") | pynini.accep("万")).ques + graph_unit_zh + ) + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + + (pynini.cross("负", '"true"') | pynini.cross("负的", '"true"')) + + delete_extra_space, + 0, + 1, + ) + + percent = ( + pynutil.delete("百分") + + pynutil.delete("之").ques + + (cardinal_graph | pynini.cross("百", "100")) + + pynutil.insert("%") + ) + + unit_all = pynutil.insert('units: "') + graph_units + pynutil.insert('"') + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + + pynutil.insert(" ") + + unit_all + ) + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + cardinal_graph + + pynutil.insert('"') + + pynutil.insert(" }") + + pynutil.insert(" ") + + unit_all + ) + + final_graph = subgraph_decimal | subgraph_cardinal + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/money.py b/fun_text_processing/inverse_text_normalization/zh/taggers/money.py new file mode 100644 index 0000000..548e3fc --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/money.py @@ -0,0 +1,53 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_extra_space, + delete_space, + get_singulars, + insert_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money + e.g. twelve dollars and five cents -> money { integer_part: "12" fractional_part: 05 currency: "$" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst): + super().__init__(name="money", kind="classify") + # quantity, integer_part, fractional_part, currency + + cardinal_graph = cardinal.graph_no_exception + decimal_graph = decimal.final_graph_wo_negative + graph_code = pynini.string_file(get_abs_path("data/money/code.tsv")) + graph_symbol = pynini.string_file(get_abs_path("data/money/symbol.tsv")) + + graph_unit = ( + pynutil.insert('currency: "') + (graph_code | graph_symbol) + pynutil.insert('"') + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + cardinal_graph + + pynutil.insert('"') + + pynutil.insert(" ") + + graph_unit + ) + + graph_decimal = decimal_graph + pynutil.insert(" ") + graph_unit + + final_graph = graph_integer | graph_decimal + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/punctuation.py b/fun_text_processing/inverse_text_normalization/zh/taggers/punctuation.py new file mode 100644 index 0000000..47eae03 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/punctuation.py @@ -0,0 +1,20 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import GraphFst +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + """ + + def __init__(self): + super().__init__(name="punctuation", kind="classify") + + s = "!#$%&'()*+,-./:;<=>?@^_`{|}~" + punct = pynini.union(*s) + + graph = pynutil.insert('name: "') + punct + pynutil.insert('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/telephone.py b/fun_text_processing/inverse_text_normalization/zh/taggers/telephone.py new file mode 100644 index 0000000..24efdef --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/telephone.py @@ -0,0 +1,102 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_ALNUM, + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +def get_serial_number(cardinal): + """ + any alphanumerical character sequence with at least one number with length greater equal to 3 + """ + digit = pynini.compose(cardinal.graph_no_exception, DAMO_DIGIT) + character = digit | DAMO_ALPHA + sequence = character + pynini.closure(pynutil.delete(" ") + character, 2) + sequence = sequence @ (pynini.closure(DAMO_ALNUM) + DAMO_DIGIT + pynini.closure(DAMO_ALNUM)) + return sequence.optimize() + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + one two three one two three five six seven eight -> { number_part: "123-123-5678" } + + This class also support card number and IP format. + "one two three dot one double three dot o dot four o" -> { number_part: "123.133.0.40"} + + "three two double seven three two one four three two one four three double zero five" -> + { number_part: 3277 3214 3214 3005} + + Args: + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst): + super().__init__(name="telephone", kind="classify") + # country code, number_part, extension + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + graph_dot = pynini.string_file(get_abs_path("data/numbers/dot.tsv")) + + graph_digits = graph_digit | graph_zero + + # to handle cases like "one twenty three" + phone_number_graph_w_country_code = graph_digits**11 + phone_number_graph_wo_country_code = ( + graph_digits**3 + | graph_digits**5 + | graph_digits**11 + | graph_digits**8 + | graph_digits**12 + ) + + country_code = ( + pynutil.insert('country_code: "') + + pynini.closure(pynini.cross("加", "+"), 0, 1) + + ((pynini.closure(graph_digits, 0, 2) + graph_digits)) + + pynutil.insert('"') + ) + + optional_country_code = pynini.closure(country_code + insert_space, 0, 1).optimize() + + grpah_phone_number_with_country_code = ( + pynutil.insert('number_part: "') + + pynutil.add_weight(phone_number_graph_w_country_code.optimize(), 0.1) + + pynutil.insert('"') + ) + + # grpah_phone_number_with_country_code = ( + # pynutil.insert("number_part: \"") + # + phone_number_graph_w_country_code.optimize() + # + pynutil.insert("\"") + # ) + + graph_phone_with_country_code = optional_country_code + grpah_phone_number_with_country_code + + grpah_phone_number_wo_country_code = ( + pynutil.insert('number_part: "') + + phone_number_graph_wo_country_code + + pynutil.insert('"') + ) + + # phone number + graph = graph_phone_with_country_code | grpah_phone_number_wo_country_code + + # ip + ip_graph = graph_digit.plus + (graph_dot + graph_digits.plus).plus + + graph |= pynutil.insert('number_part: "') + ip_graph.optimize() + pynutil.insert('"') + graph |= ( + pynutil.insert('number_part: "') + + pynutil.add_weight(get_serial_number(cardinal=cardinal), weight=0.0001) + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/time.py b/fun_text_processing/inverse_text_normalization/zh/taggers/time.py new file mode 100644 index 0000000..9d9acb0 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/time.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path, num_to_word +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + GraphFst, + convert_space, + delete_extra_space, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time + e.g. twelve thirty -> time { hours: "12" minutes: "30" } + e.g. twelve past one -> time { minutes: "12" hours: "1" } + e.g. two o clock a m -> time { hours: "2" suffix: "a.m." } + e.g. quarter to two -> time { hours: "1" minutes: "45" } + e.g. quarter past two -> time { hours: "2" minutes: "15" } + e.g. half past two -> time { hours: "2" minutes: "30" } + """ + + def __init__(self): + super().__init__(name="time", kind="classify") + # hours, minutes, seconds, suffix, zone, style, speak_period + + noon_graph = pynini.string_file(get_abs_path("data/time/noon.tsv")) + hour_graph = pynini.string_file(get_abs_path("data/time/hour.tsv")) + minute_graph = pynini.string_file(get_abs_path("data/time/minute.tsv")) + second_graph = pynini.string_file(get_abs_path("data/time/second.tsv")) + + final_graph = ( + (pynutil.insert('noon: "') + noon_graph + pynutil.insert('" ')).ques + + pynutil.insert('hour: "') + + hour_graph + + pynutil.insert('"') + + pynutil.insert(' minute: "') + + minute_graph + + pynutil.delete("分").ques + + pynutil.insert('"') + + (pynutil.insert(' second: "') + second_graph + pynutil.insert('"')).ques + ) + + final_graph = self.add_tokens(final_graph.optimize()) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/tokenize_and_classify.py b/fun_text_processing/inverse_text_normalization/zh/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..60139d8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/tokenize_and_classify.py @@ -0,0 +1,101 @@ +import os +import pynini +from fun_text_processing.inverse_text_normalization.zh.taggers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.zh.taggers.date import DateFst +from fun_text_processing.inverse_text_normalization.zh.taggers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.zh.taggers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.zh.taggers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.zh.taggers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.zh.taggers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.zh.taggers.punctuation import PunctuationFst +from fun_text_processing.inverse_text_normalization.zh.taggers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.zh.taggers.time import TimeFst +from fun_text_processing.inverse_text_normalization.zh.taggers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.zh.taggers.word import WordFst +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + super().__init__(name="tokenize_and_classify", kind="classify") + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "_zh_itn.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + + decimal = DecimalFst(cardinal) + decimal_graph = decimal.fst + + fraction = FractionFst(cardinal) + fraction_graph = fraction.fst + + measure_graph = MeasureFst(cardinal=cardinal, decimal=decimal).fst + date_graph = DateFst().fst + word_graph = WordFst().fst + time_graph = TimeFst().fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal).fst + whitelist_graph = WhiteListFst().fst + punct_graph = PunctuationFst().fst + electronic_graph = ElectronicFst().fst + telephone_graph = TelephoneFst(cardinal).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure(delete_extra_space + token_plus_punct) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/whitelist.py b/fun_text_processing/inverse_text_normalization/zh/taggers/whitelist.py new file mode 100644 index 0000000..3dc9db3 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/whitelist.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.utils import get_abs_path +from fun_text_processing.inverse_text_normalization.zh.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelisted tokens + e.g. misses -> tokens { name: "mrs." } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + """ + + def __init__(self): + super().__init__(name="whitelist", kind="classify") + + whitelist = pynini.string_file(get_abs_path("data/whitelist.tsv")).invert() + graph = pynutil.insert('name: "') + convert_space(whitelist) + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/taggers/word.py b/fun_text_processing/inverse_text_normalization/zh/taggers/word.py new file mode 100644 index 0000000..ac1e89a --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/taggers/word.py @@ -0,0 +1,15 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying plain tokens, that do not belong to any special class. This can be considered as the default class. + e.g. sleep -> tokens { name: "sleep" } + """ + + def __init__(self): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/utils.py b/fun_text_processing/inverse_text_normalization/zh/utils.py new file mode 100644 index 0000000..6e9d842 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/utils.py @@ -0,0 +1,68 @@ +import csv +import os +from typing import Union +import inflect + +UNIT_1e01 = "十" +UNIT_1e02 = "百" +UNIT_1e03 = "千" +UNIT_1e04 = "万" + +_inflect = inflect.engine() + + +def num_to_word(x: Union[str, int]): + """ + converts integer to spoken representation + Args + x: integer + Returns: spoken representation + """ + if isinstance(x, int): + x = str(x) + x = _inflect.number_to_words(str(x)).replace("-", " ").replace(",", "") + return x + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path + + +def load_labels(abs_path): + """ + loads relative path file as dictionary + + Args: + abs_path: absolute path + + Returns dictionary of mappings + """ + label_tsv = open(abs_path, encoding="utf-8") + labels = list(csv.reader(label_tsv, delimiter="\t")) + return labels + + +def augment_labels_with_punct_at_end(labels): + """ + augments labels: if key ends on a punctuation that value does not have, add a new label + where the value maintains the punctuation + + Args: + labels : input labels + Returns: + additional labels + """ + res = [] + for label in labels: + if len(label) > 1: + if label[0][-1] == "." and label[1][-1] != ".": + res.append([label[0], label[1] + "."] + label[2:]) + return res diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/__init__.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/cardinal.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/cardinal.py new file mode 100644 index 0000000..8e667c6 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/cardinal.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_SPACE, + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal + e.g. cardinal { integer: "23" negative: "-" } -> -23 + """ + + def __init__(self): + super().__init__(name="cardinal", kind="verbalize") + optional_sign = pynini.closure( + pynutil.delete("negative:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"'), + 0, + 1, + ) + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.numbers = graph + graph = optional_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/date.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/date.py new file mode 100644 index 0000000..11ccc38 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/date.py @@ -0,0 +1,72 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "january" day: "5" year: "2012" preserve_order: true } -> february 5 2012 + date { day: "5" month: "january" year: "2012" preserve_order: true } -> 5 february 2012 + """ + + def __init__(self): + super().__init__(name="date", kind="verbalize") + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + + graph_ymd = ( + year + + pynini.cross(" ", "年") + + month + + pynini.cross(" ", "月") + + day + + pynutil.insert("日") + ) + + graph_md = month + pynini.cross(" ", "月") + day + pynutil.insert("日") + + graph_ym = year + pynini.cross(" ", "年") + month + pynutil.insert("月") + + graph_year = year + pynutil.insert("年") + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = ( + (graph_ymd | graph_ym | graph_md | graph_year) + delete_space + optional_preserve_order + ) + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/decimal.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/decimal.py new file mode 100644 index 0000000..a9884c8 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/decimal.py @@ -0,0 +1,48 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "12" fractional_part: "5006" quantity: "billion" } -> -12.5006 billion + """ + + def __init__(self): + super().__init__(name="decimal", kind="verbalize") + optionl_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + integer = ( + pynutil.delete("integer_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_integer = pynini.closure(integer + delete_space, 0, 1) + fractional = ( + pynutil.insert(".") + + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_fractional = pynini.closure(fractional + delete_space, 0, 1) + quantity = ( + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(pynutil.insert(" ") + quantity + delete_space, 0, 1) + graph = optional_integer + optional_fractional + optional_quantity + self.numbers = graph + graph = optionl_sign + graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/electronic.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/electronic.py new file mode 100644 index 0000000..661fe97 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/electronic.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> cdf1@abc.edu + """ + + def __init__(self): + super().__init__(name="electronic", kind="verbalize") + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + protocol = ( + pynutil.delete("protocol:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = user_name + delete_space + pynutil.insert("@") + domain + graph |= protocol + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/fraction.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/fraction.py new file mode 100644 index 0000000..2b7fe44 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/fraction.py @@ -0,0 +1,41 @@ +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_space, +) + +import pynini +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction, + """ + + def __init__(self): + super().__init__(name="fraction", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-") + delete_space, 0, 1) + numerator = ( + pynutil.delete("numerator:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + denominator = ( + pynutil.delete("denominator:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph = ( + optional_sign + numerator + delete_space + pynutil.insert("/") + denominator + ).optimize() + self.numbers = graph + delete_tokens = self.delete_tokens(optional_sign + graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/measure.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/measure.py new file mode 100644 index 0000000..78fd864 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/measure.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "12" } units: "kg" } -> -12 kg + + Args: + decimal: DecimalFst + cardinal: CardinalFst + """ + + def __init__(self, decimal: GraphFst, cardinal: GraphFst): + super().__init__(name="measure", kind="verbalize") + optional_sign = pynini.closure(pynini.cross('negative: "true"', "-"), 0, 1) + unit = ( + pynutil.delete("units:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + + delete_space + ) + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + graph = (graph_cardinal | graph_decimal) + delete_space + unit + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/money.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/money.py new file mode 100644 index 0000000..74fedde --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/money.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_CHAR, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "12" fractional_part: "05" currency: "$" } -> $12.05 + + Args: + decimal: DecimalFst + """ + + def __init__(self, decimal: GraphFst): + super().__init__(name="money", kind="verbalize") + unit = ( + pynutil.delete("currency:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = unit + delete_space + decimal.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/telephone.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/telephone.py new file mode 100644 index 0000000..4755420 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/telephone.py @@ -0,0 +1,30 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "123-123-5678" } + -> 123-123-5678 + """ + + def __init__(self): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_country_code = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" "), + 0, + 1, + ) + delete_tokens = self.delete_tokens(optional_country_code + number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/time.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/time.py new file mode 100644 index 0000000..2fdc919 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/time.py @@ -0,0 +1,79 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "12" minutes: "30" } -> 12:30 + time { hours: "1" minutes: "12" } -> 01:12 + time { hours: "2" suffix: "a.m." } -> 02:00 a.m. + """ + + def __init__(self): + super().__init__(name="time", kind="verbalize") + add_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynutil.insert("0") + DAMO_DIGIT + ) + + hour = ( + pynutil.delete("hour:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minute:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + + second = ( + pynutil.delete("second:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_DIGIT, 1) + + pynutil.delete('"') + ) + + suffix = ( + delete_space + + pynutil.insert(" ") + + pynutil.delete("noon:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(suffix, 0, 1) + zone = ( + delete_space + + pynutil.insert(" ") + + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(zone, 0, 1) + graph = ( + hour @ add_leading_zero_to_double_digit + + delete_space + + pynutil.insert(":") + + (minute @ add_leading_zero_to_double_digit) + + (pynutil.insert(":") + second @ add_leading_zero_to_double_digit).ques + + optional_suffix + + optional_zone + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/verbalize.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/verbalize.py new file mode 100644 index 0000000..0f66b2c --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/verbalize.py @@ -0,0 +1,48 @@ +from fun_text_processing.inverse_text_normalization.zh.verbalizers.cardinal import CardinalFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.date import DateFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.decimal import DecimalFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.fraction import FractionFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.electronic import ElectronicFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.measure import MeasureFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.money import MoneyFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.telephone import TelephoneFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.time import TimeFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.whitelist import WhiteListFst +from fun_text_processing.inverse_text_normalization.zh.graph_utils import GraphFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + """ + + def __init__(self): + super().__init__(name="verbalize", kind="verbalize") + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + decimal = DecimalFst() + decimal_graph = decimal.fst + fraction = FractionFst() + fraction_graph = fraction.fst + measure_graph = MeasureFst(decimal=decimal, cardinal=cardinal).fst + money_graph = MoneyFst(decimal=decimal).fst + time_graph = TimeFst().fst + date_graph = DateFst().fst + whitelist_graph = WhiteListFst().fst + telephone_graph = TelephoneFst().fst + electronic_graph = ElectronicFst().fst + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | decimal_graph + | fraction_graph + | cardinal_graph + | whitelist_graph + | telephone_graph + | electronic_graph + ) + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/verbalize_final.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/verbalize_final.py new file mode 100644 index 0000000..a6ecda1 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/verbalize_final.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.inverse_text_normalization.zh.verbalizers.word import WordFst +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.lib import pynutil + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + """ + + def __init__(self): + super().__init__(name="verbalize_final", kind="verbalize") + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/whitelist.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/whitelist.py new file mode 100644 index 0000000..902b373 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/whitelist.py @@ -0,0 +1,27 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "mrs." } -> mrs. + """ + + def __init__(self): + super().__init__(name="whitelist", kind="verbalize") + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/inverse_text_normalization/zh/verbalizers/word.py b/fun_text_processing/inverse_text_normalization/zh/verbalizers/word.py new file mode 100644 index 0000000..d93db03 --- /dev/null +++ b/fun_text_processing/inverse_text_normalization/zh/verbalizers/word.py @@ -0,0 +1,29 @@ +import pynini +from fun_text_processing.inverse_text_normalization.zh.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing plain tokens + e.g. tokens { name: "sleep" } -> sleep + """ + + def __init__(self): + super().__init__(name="word", kind="verbalize") + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/__init__.py b/fun_text_processing/text_normalization/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/data_loader_utils.py b/fun_text_processing/text_normalization/data_loader_utils.py new file mode 100644 index 0000000..9b14540 --- /dev/null +++ b/fun_text_processing/text_normalization/data_loader_utils.py @@ -0,0 +1,350 @@ +import json +import re +import string +from collections import defaultdict, namedtuple +from typing import Dict, List, Optional, Set, Tuple +from unicodedata import category + +import logging + + +EOS_TYPE = "EOS" +PUNCT_TYPE = "PUNCT" +PLAIN_TYPE = "PLAIN" +Instance = namedtuple("Instance", "token_type un_normalized normalized") +known_types = [ + "PLAIN", + "DATE", + "CARDINAL", + "LETTERS", + "VERBATIM", + "MEASURE", + "DECIMAL", + "ORDINAL", + "DIGIT", + "MONEY", + "TELEPHONE", + "ELECTRONIC", + "FRACTION", + "TIME", + "ADDRESS", +] + + +def _load_kaggle_text_norm_file(file_path: str) -> List[Instance]: + """ + https://www.kaggle.com/richardwilliamsproat/text-normalization-for-english-russian-and-polish + Loads text file in the Kaggle Google text normalization file format: \t\t<`self` if trivial class or normalized text> + E.g. + PLAIN Brillantaisia + PLAIN is + PLAIN a + PLAIN genus + PLAIN of + PLAIN plant + PLAIN in + PLAIN family + PLAIN Acanthaceae + PUNCT . sil + + + Args: + file_path: file path to text file + + Returns: flat list of instances + """ + res = [] + with open(file_path, "r") as fp: + for line in fp: + parts = line.strip().split("\t") + if parts[0] == "": + res.append(Instance(token_type=EOS_TYPE, un_normalized="", normalized="")) + else: + l_type, l_token, l_normalized = parts + l_token = l_token.lower() + l_normalized = l_normalized.lower() + + if l_type == PLAIN_TYPE: + res.append( + Instance(token_type=l_type, un_normalized=l_token, normalized=l_token) + ) + elif l_type != PUNCT_TYPE: + res.append( + Instance(token_type=l_type, un_normalized=l_token, normalized=l_normalized) + ) + return res + + +def load_files(file_paths: List[str], load_func=_load_kaggle_text_norm_file) -> List[Instance]: + """ + Load given list of text files using the `load_func` function. + + Args: + file_paths: list of file paths + load_func: loading function + + Returns: flat list of instances + """ + res = [] + for file_path in file_paths: + res.extend(load_func(file_path=file_path)) + return res + + +def clean_generic(text: str) -> str: + """ + Cleans text without affecting semiotic classes. + + Args: + text: string + + Returns: cleaned string + """ + text = text.strip() + text = text.lower() + return text + + +def evaluate( + preds: List[str], labels: List[str], input: Optional[List[str]] = None, verbose: bool = True +) -> float: + """ + Evaluates accuracy given predictions and labels. + + Args: + preds: predictions + labels: labels + input: optional, only needed for verbosity + verbose: if true prints [input], golden labels and predictions + + Returns accuracy + """ + acc = 0 + nums = len(preds) + for i in range(nums): + pred_norm = clean_generic(preds[i]) + label_norm = clean_generic(labels[i]) + if pred_norm == label_norm: + acc = acc + 1 + else: + if input: + print(f"inpu: {json.dumps(input[i])}") + print(f"gold: {json.dumps(label_norm)}") + print(f"pred: {json.dumps(pred_norm)}") + return acc / nums + + +def training_data_to_tokens( + data: List[Instance], category: Optional[str] = None +) -> Dict[str, Tuple[List[str], List[str]]]: + """ + Filters the instance list by category if provided and converts it into a map from token type to list of un_normalized and normalized strings + + Args: + data: list of instances + category: optional semiotic class category name + + Returns Dict: token type -> (list of un_normalized strings, list of normalized strings) + """ + result = defaultdict(lambda: ([], [])) + for instance in data: + if instance.token_type != EOS_TYPE: + if category is None or instance.token_type == category: + result[instance.token_type][0].append(instance.un_normalized) + result[instance.token_type][1].append(instance.normalized) + return result + + +def training_data_to_sentences(data: List[Instance]) -> Tuple[List[str], List[str], List[Set[str]]]: + """ + Takes instance list, creates list of sentences split by EOS_Token + Args: + data: list of instances + Returns (list of unnormalized sentences, list of normalized sentences, list of sets of categories in a sentence) + """ + # split data at EOS boundaries + sentences = [] + sentence = [] + categories = [] + sentence_categories = set() + + for instance in data: + if instance.token_type == EOS_TYPE: + sentences.append(sentence) + sentence = [] + categories.append(sentence_categories) + sentence_categories = set() + else: + sentence.append(instance) + sentence_categories.update([instance.token_type]) + un_normalized = [ + " ".join([instance.un_normalized for instance in sentence]) for sentence in sentences + ] + normalized = [ + " ".join([instance.normalized for instance in sentence]) for sentence in sentences + ] + return un_normalized, normalized, categories + + +def post_process_punctuation(text: str) -> str: + """ + Normalized quotes and spaces + + Args: + text: text + + Returns: text with normalized spaces and quotes + """ + text = ( + text.replace("( ", "(") + .replace(" )", ")") + .replace("{ ", "{") + .replace(" }", "}") + .replace("[ ", "[") + .replace(" ]", "]") + .replace(" ", " ") + .replace("”", '"') + .replace("’", "'") + .replace("»", '"') + .replace("«", '"') + .replace("\\", "") + .replace("„", '"') + .replace("´", "'") + .replace("’", "'") + .replace("“", '"') + .replace("‘", "'") + .replace("`", "'") + .replace("- -", "--") + ) + + for punct in "!,.:;?": + text = text.replace(f" {punct}", punct) + return text.strip() + + +def pre_process(text: str) -> str: + """ + Optional text preprocessing before normalization (part of TTS TN pipeline) + + Args: + text: string that may include semiotic classes + + Returns: text with spaces around punctuation marks + """ + space_both = "[]" + for punct in space_both: + text = text.replace(punct, " " + punct + " ") + + # remove extra space + text = re.sub(r" +", " ", text) + return text + + +def load_file(file_path: str) -> List[str]: + """ + Loads given text file with separate lines into list of string. + + Args: + file_path: file path + + Returns: flat list of string + """ + res = [] + with open(file_path, "r") as fp: + for line in fp: + res.append(line) + return res + + +def write_file(file_path: str, data: List[str]): + """ + Writes out list of string to file. + + Args: + file_path: file path + data: list of string + + """ + with open(file_path, "w") as fp: + for line in data: + fp.write(line + "\n") + + +def post_process_punct(input: str, normalized_text: str, add_unicode_punct: bool = False): + """ + Post-processing of the normalized output to match input in terms of spaces around punctuation marks. + After NN normalization, Moses detokenization puts a space after + punctuation marks, and attaches an opening quote "'" to the word to the right. + E.g., input to the TN NN model is "12 test' example", + after normalization and detokenization -> "twelve test 'example" (the quote is considered to be an opening quote, + but it doesn't match the input and can cause issues during TTS voice generation.) + The current function will match the punctuation and spaces of the normalized text with the input sequence. + "12 test' example" -> "twelve test 'example" -> "twelve test' example" (the quote was shifted to match the input). + + Args: + input: input text (original input to the NN, before normalization or tokenization) + normalized_text: output text (output of the TN NN model) + add_unicode_punct: set to True to handle unicode punctuation marks as well as default string.punctuation (increases post processing time) + """ + # in the post-processing WFST graph "``" are repalced with '"" quotes (otherwise single quotes "`" won't be handled correctly) + # this function fixes spaces around them based on input sequence, so here we're making the same double quote replacement + # to make sure these new double quotes work with this function + if "``" in input and "``" not in normalized_text: + input = input.replace("``", '"') + input = [x for x in input] + normalized_text = [x for x in normalized_text] + punct_marks = [x for x in string.punctuation if x in input] + + if add_unicode_punct: + punct_unicode = [ + chr(i) + for i in range(sys.maxunicode) + if category(chr(i)).startswith("P") and chr(i) not in punct_default and chr(i) in input + ] + punct_marks = punct_marks.extend(punct_unicode) + + for punct in punct_marks: + try: + equal = True + if input.count(punct) != normalized_text.count(punct): + equal = False + idx_in, idx_out = 0, 0 + while punct in input[idx_in:]: + idx_out = normalized_text.index(punct, idx_out) + idx_in = input.index(punct, idx_in) + + def _is_valid(idx_out, idx_in, normalized_text, input): + """Check if previous or next word match (for cases when punctuation marks are part of + semiotic token, i.e. some punctuation can be missing in the normalized text)""" + return ( + idx_out > 0 + and idx_in > 0 + and normalized_text[idx_out - 1] == input[idx_in - 1] + ) or ( + idx_out < len(normalized_text) - 1 + and idx_in < len(input) - 1 + and normalized_text[idx_out + 1] == input[idx_in + 1] + ) + + if not equal and not _is_valid(idx_out, idx_in, normalized_text, input): + idx_in += 1 + continue + if idx_in > 0 and idx_out > 0: + if normalized_text[idx_out - 1] == " " and input[idx_in - 1] != " ": + normalized_text[idx_out - 1] = "" + + elif normalized_text[idx_out - 1] != " " and input[idx_in - 1] == " ": + normalized_text[idx_out - 1] += " " + + if idx_in < len(input) - 1 and idx_out < len(normalized_text) - 1: + if normalized_text[idx_out + 1] == " " and input[idx_in + 1] != " ": + normalized_text[idx_out + 1] = "" + elif normalized_text[idx_out + 1] != " " and input[idx_in + 1] == " ": + normalized_text[idx_out] = normalized_text[idx_out] + " " + idx_out += 1 + idx_in += 1 + except: + logging.debug(f"Skipping post-processing of {''.join(normalized_text)} for '{punct}'") + + normalized_text = "".join(normalized_text) + return re.sub(r" +", " ", normalized_text) diff --git a/fun_text_processing/text_normalization/de/__init__.py b/fun_text_processing/text_normalization/de/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/__init__.py b/fun_text_processing/text_normalization/de/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/electronic/__init__.py b/fun_text_processing/text_normalization/de/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/electronic/domain.tsv b/fun_text_processing/text_normalization/de/data/electronic/domain.tsv new file mode 100644 index 0000000..5738cd6 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/electronic/domain.tsv @@ -0,0 +1,9 @@ +.com punkt com +.uk punkt uk +.fr punkt fr +.net dot net +.br punkt br +.in punkt in +.ru punkt ru +.de punkt de +.it punkt it \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/electronic/server_name.tsv b/fun_text_processing/text_normalization/de/data/electronic/server_name.tsv new file mode 100644 index 0000000..c05c205 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/electronic/server_name.tsv @@ -0,0 +1,12 @@ +gmail g mail +nvidia +outlook +hotmail +yahoo +live +yandex +orange +wanadoo +web +comcast +aol \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/electronic/symbols.tsv b/fun_text_processing/text_normalization/de/data/electronic/symbols.tsv new file mode 100644 index 0000000..57a0317 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/electronic/symbols.tsv @@ -0,0 +1,20 @@ +. punkt +: doppelpunkt +- bindestrich +_ unterstrich +! ausrufezeichen +# raute +$ dollar zeichen +% prozent zeichen +& und +' apostroph +* asterisk ++ plus +/ slash += gleichheitszeichen +? fragezeichen +^ zirkumflex +{ linke klammer auf +} rechte klammer zu +~ tilde +, komma \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/fractions.tsv b/fun_text_processing/text_normalization/de/data/fractions.tsv new file mode 100644 index 0000000..50d8847 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/fractions.tsv @@ -0,0 +1,30 @@ +halb zwei +drittel drei +viertel vier +fünftel fünf +sechstel sechs +siebtel sieben +achtel acht +neuntel neun +zehntel zehn +elftel elf +zwölftel zwölf +dreizehntel dreizehn +vierzehntel vierzehn +fünfzehntel fünfzehn +sechzehntel sechzehn +siebzehntel siebzehn +achtzehntel achtzehn +neunzehntel neunzehn +zwanzigstel zwanzig +dreißigstel dreißig +vierzigstel vierzig +fünfzigstel fünfzig +sechzigstel sechzig +siebzigstel siebzig +achtzigstel achtzig +neunzigstel neunzig +hundertstel hundert +tausendstel tausend +millionstel million +milliardstel milliarde \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/measure/__init__.py b/fun_text_processing/text_normalization/de/data/measure/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/measure/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/measure/measurements.tsv b/fun_text_processing/text_normalization/de/data/measure/measurements.tsv new file mode 100644 index 0000000..8292eca --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/measure/measurements.tsv @@ -0,0 +1,82 @@ +% prozent +f fahrenheit +c celsius +°C grad celsius +°F grad fahrenheit +K kelvin +km kilometer +m meter +cm zentimeter +mm millimeter +μm mikrometer +nm nanometer +dm dezimeter +pm pikometer +hm hektometer +ha hektar +mi meile +m² quadrat meter -0.0001 +km² quadrat kilometer -0.0001 +mm² quadrat millimeter -0.0001 +cm² quadrat zentimeter -0.0001 +m³ kubik meter -0.0001 +km³ kubik kilometer -0.0001 +mm³ kubik millimeter -0.0001 +cm³ kubik zentimeter -0.0001 +m2 quadrat meter +km2 quadrat kilometer +mm2 quadrat millimeter +cm2 quadrat zentimeter +m3 kubik meter +km3 kubik kilometer +mm3 kubik millimeter +cm3 kubik zentimeter +ft fuß +g gramm +µg mikrogramm +mg milligramm +kg kilogramm +lb pfund +oz unze +cwt zentner +gr korn +dr drachne +μg mikrogramm +pg petagramm +h stunde +s sekunde +min minute +ds decisekunde +ms millisekunde +μs mikrosekunde +hz hertz +kw kilowatt +kwh kilowattstunde +ghz gigahertz +khz kilohertz +mhz megahertz +v volt +mc megacoulomb +mA milliampere +A ampere +tw terawatt +mv millivolt +mw megawatt +gw gigawatt +ω ohm +db dezibel +gb gigabyte +kb kilobit +pb petabit +mb megabyte +kb kilobyte +tb terabyte +kv kilovolt +mv megavolt +kn kilonewton +ml milliliter +l liter +ma megaampere +bar bar +kcal kilokalorie +cal kalorie \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/measure/suppletive.tsv b/fun_text_processing/text_normalization/de/data/measure/suppletive.tsv new file mode 100644 index 0000000..449d545 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/measure/suppletive.tsv @@ -0,0 +1,10 @@ +meile meilen +unze unzen +drachne drachnen +stunde stunden +sekunde sekunden +minute minuten +minute minuten +bit bits +byte bytes +kalorie kalorien \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/money/__init__.py b/fun_text_processing/text_normalization/de/data/money/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/money/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/money/currency.tsv b/fun_text_processing/text_normalization/de/data/money/currency.tsv new file mode 100644 index 0000000..fa6c618 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/money/currency.tsv @@ -0,0 +1,25 @@ +€ euro +$ dollar +$ us dollar +£ pfund +₩ won +nzd neuseeland dollar +rs rupie +chf schweizer franken +dkk dänische krone +fim finnische mark +aed dirham +¥ yen +czk tschechische krone +mro ouguiya +pkr pakistanische rupie +crc colon +hkd hong kong dollar +npr nepalesische rupee +awg aruba florin +nok norwegische krone +tzs tansania schilling +sek schwedisch krone +cyp zypern pfund +dm d-mark +dm deutsche mark \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/money/currency_minor_plural.tsv b/fun_text_processing/text_normalization/de/data/money/currency_minor_plural.tsv new file mode 100644 index 0000000..9818ee7 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/money/currency_minor_plural.tsv @@ -0,0 +1,3 @@ +$ cent +€ cent +£ pence \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/money/currency_minor_singular.tsv b/fun_text_processing/text_normalization/de/data/money/currency_minor_singular.tsv new file mode 100644 index 0000000..fe629d8 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/money/currency_minor_singular.tsv @@ -0,0 +1,3 @@ +$ cent +€ cent +£ penny \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/months/__init__.py b/fun_text_processing/text_normalization/de/data/months/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/months/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/months/abbr_to_name.tsv b/fun_text_processing/text_normalization/de/data/months/abbr_to_name.tsv new file mode 100644 index 0000000..81a3238 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/months/abbr_to_name.tsv @@ -0,0 +1,13 @@ +jan januar +feb februar +mär märz +apr april +mai mai +jun juni +jul juli +aug august +sep september +sept september +okt oktober +nov november +dez dezember \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/months/numbers.tsv b/fun_text_processing/text_normalization/de/data/months/numbers.tsv new file mode 100644 index 0000000..012afcc --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/months/numbers.tsv @@ -0,0 +1,24 @@ +1 januar +2 februar +3 märz +4 april +5 mai +6 juni +7 juli +8 august +9 september +10 oktober +11 november +12 dezember +01 januar +02 februar +03 märz +04 april +05 mai +06 juni +07 juli +08 august +09 september +10 oktober +11 november +12 dezember \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/numbers/__init__.py b/fun_text_processing/text_normalization/de/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/numbers/digit.tsv b/fun_text_processing/text_normalization/de/data/numbers/digit.tsv new file mode 100644 index 0000000..7634e5a --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/numbers/digit.tsv @@ -0,0 +1,8 @@ +zwei 2 +drei 3 +vier 4 +fünf 5 +sechs 6 +sieben 7 +acht 8 +neun 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/numbers/ones.tsv b/fun_text_processing/text_normalization/de/data/numbers/ones.tsv new file mode 100644 index 0000000..7d12cd5 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/numbers/ones.tsv @@ -0,0 +1,3 @@ +eine 1 +ein 1 +eins 1 -0.0001 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/numbers/quantities.tsv b/fun_text_processing/text_normalization/de/data/numbers/quantities.tsv new file mode 100644 index 0000000..712fe0f --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/numbers/quantities.tsv @@ -0,0 +1,12 @@ +million +millionen +milliarde +milliarden +billion +billionen +billiarde +billiarden +trillion +trillionen +trilliarde +trilliarde \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/numbers/teen.tsv b/fun_text_processing/text_normalization/de/data/numbers/teen.tsv new file mode 100644 index 0000000..854712e --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/numbers/teen.tsv @@ -0,0 +1,10 @@ +zehn 10 +elf 11 +zwölf 12 +dreizehn 13 +vierzehn 14 +fünfzehn 15 +sechzehn 16 +siebzehn 17 +achtzehn 18 +neunzehn 19 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/numbers/ties.tsv b/fun_text_processing/text_normalization/de/data/numbers/ties.tsv new file mode 100644 index 0000000..28a3f80 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/numbers/ties.tsv @@ -0,0 +1,8 @@ +zwanzig 2 +dreißig 3 +vierzig 4 +fünfzig 5 +sechzig 6 +siebzig 7 +achtzig 8 +neunzig 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/numbers/zero.tsv b/fun_text_processing/text_normalization/de/data/numbers/zero.tsv new file mode 100644 index 0000000..e27b1c6 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/numbers/zero.tsv @@ -0,0 +1 @@ +null 0 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/ordinals/__init__.py b/fun_text_processing/text_normalization/de/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/ordinals/digit.tsv b/fun_text_processing/text_normalization/de/data/ordinals/digit.tsv new file mode 100644 index 0000000..31c91f6 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/ordinals/digit.tsv @@ -0,0 +1,9 @@ +ers eins +zwei zwei +drit drei +vier vier +fünf fünf +sechs sechs +sieb sieben +ach acht +neun neun \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/ordinals/thousands.tsv b/fun_text_processing/text_normalization/de/data/ordinals/thousands.tsv new file mode 100644 index 0000000..a97b94c --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/ordinals/thousands.tsv @@ -0,0 +1,4 @@ +hunderts hundert +tausends tausend +millions million +milliards milliarde \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/ordinals/ties.tsv b/fun_text_processing/text_normalization/de/data/ordinals/ties.tsv new file mode 100644 index 0000000..4ab2bd5 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/ordinals/ties.tsv @@ -0,0 +1,8 @@ +zwanzigs zwanzig +dreißigs dreißig +vierzigs vierzig +fünfzigs fünfzig +sechzigs sechzig +siebzigs siebzig +achtzigs achtzig +neunzigs neunzig \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/time/__init__.py b/fun_text_processing/text_normalization/de/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/data/time/hour_to.tsv b/fun_text_processing/text_normalization/de/data/time/hour_to.tsv new file mode 100644 index 0000000..e681afc --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/time/hour_to.tsv @@ -0,0 +1,12 @@ +1 12 +2 1 +3 2 +4 3 +5 4 +6 5 +7 6 +8 7 +9 8 +10 9 +11 10 +12 11 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/time/hour_to_night.tsv b/fun_text_processing/text_normalization/de/data/time/hour_to_night.tsv new file mode 100644 index 0000000..b7765ac --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/time/hour_to_night.tsv @@ -0,0 +1,13 @@ +12 0 +1 13 +2 14 +3 15 +4 16 +5 17 +6 18 +7 19 +8 20 +9 21 +10 22 +11 23 +12 24 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/de/data/time/minute_to.tsv b/fun_text_processing/text_normalization/de/data/time/minute_to.tsv new file mode 100644 index 0000000..edab4d5 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/time/minute_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 diff --git a/fun_text_processing/text_normalization/de/data/time/time_zone.tsv b/fun_text_processing/text_normalization/de/data/time/time_zone.tsv new file mode 100644 index 0000000..3e0ade4 --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t diff --git a/fun_text_processing/text_normalization/de/data/whitelist.tsv b/fun_text_processing/text_normalization/de/data/whitelist.tsv new file mode 100644 index 0000000..b956ade --- /dev/null +++ b/fun_text_processing/text_normalization/de/data/whitelist.tsv @@ -0,0 +1,7 @@ +z.B. zum beispiel +d.h. dass heißt +Dr. doktor +Mr. mister +Mrs. misses +Ms. miss +Nr. nummer diff --git a/fun_text_processing/text_normalization/de/taggers/__init__.py b/fun_text_processing/text_normalization/de/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/taggers/cardinal.py b/fun_text_processing/text_normalization/de/taggers/cardinal.py new file mode 100644 index 0000000..ebe52e3 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/cardinal.py @@ -0,0 +1,215 @@ +from collections import defaultdict + +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + +AND = "und" + + +def get_ties_digit(digit_path: str, tie_path: str) -> "pynini.FstLike": + """ + getting all inverse normalizations for numbers between 21 - 100 + + Args: + digit_path: file to digit tsv + tie_path: file to tie tsv, e.g. 20, 30, etc. + Returns: + res: fst that converts numbers to their verbalization + """ + + digits = defaultdict(list) + ties = defaultdict(list) + for k, v in load_labels(digit_path): + digits[v].append(k) + digits["1"] = ["ein"] + + for k, v in load_labels(tie_path): + ties[v].append(k) + + d = [] + for i in range(21, 100): + s = str(i) + if s[1] == "0": + continue + + for di in digits[s[1]]: + for ti in ties[s[0]]: + word = di + f" {AND} " + ti + d.append((word, s)) + + res = pynini.string_map(d) + return res + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals, e.g. + "101" -> cardinal { integer: "ein hundert und zehn" } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = False): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + + graph_zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv")).invert() + graph_digit_no_one = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).invert() + graph_one = pynini.string_file(get_abs_path("data/numbers/ones.tsv")).invert() + graph_digit = graph_digit_no_one | graph_one + self.digit = (graph_digit | graph_zero).optimize() + graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")).invert() + + graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")).invert() + # separator = "." + + def tens_no_zero(): + return ( + pynutil.delete("0") + graph_digit + | get_ties_digit( + get_abs_path("data/numbers/digit.tsv"), get_abs_path("data/numbers/ties.tsv") + ).invert() + | graph_teen + | (graph_ties + pynutil.delete("0")) + ) + + def hundred_non_zero(): + return (graph_digit_no_one + insert_space | pynini.cross("1", "ein ")) + pynutil.insert( + "hundert" + ) + ( + pynini.closure(insert_space + pynutil.insert(AND, weight=0.0001), 0, 1) + + insert_space + + tens_no_zero() + | pynutil.delete("00") + ) | pynutil.delete( + "0" + ) + tens_no_zero() + + def thousand(): + return ( + hundred_non_zero() + insert_space + pynutil.insert("tausend") + | pynutil.delete("000") + ) + (insert_space + hundred_non_zero() | pynutil.delete("000")) + + optional_plural_quantity_en = pynini.closure(pynutil.insert("en", weight=-0.0001), 0, 1) + optional_plural_quantity_n = pynini.closure(pynutil.insert("n", weight=-0.0001), 0, 1) + graph_million = pynini.union( + hundred_non_zero() + + insert_space + + pynutil.insert("million") + + optional_plural_quantity_en, + pynutil.delete("000"), + ) + + graph_billion = pynini.union( + hundred_non_zero() + + insert_space + + pynutil.insert("milliarde") + + optional_plural_quantity_n, + pynutil.delete("000"), + ) + + graph_trillion = pynini.union( + hundred_non_zero() + + insert_space + + pynutil.insert("billion") + + optional_plural_quantity_en, + pynutil.delete("000"), + ) + + graph_quadrillion = pynini.union( + hundred_non_zero() + + insert_space + + pynutil.insert("billiarde") + + optional_plural_quantity_n, + pynutil.delete("000"), + ) + + graph_quintillion = pynini.union( + hundred_non_zero() + + insert_space + + pynutil.insert("trillion") + + optional_plural_quantity_en, + pynutil.delete("000"), + ) + + graph_sextillion = pynini.union( + hundred_non_zero() + + insert_space + + pynutil.insert("trilliarde") + + optional_plural_quantity_n, + pynutil.delete("000"), + ) + graph = pynini.union( + graph_sextillion + + insert_space + + graph_quintillion + + insert_space + + graph_quadrillion + + insert_space + + graph_trillion + + insert_space + + graph_billion + + insert_space + + graph_million + + insert_space + + thousand() + ) + + fix_syntax = [ + ("eins tausend", "ein tausend"), + ("eins millionen", "eine million"), + ("eins milliarden", "eine milliarde"), + ("eins billionen", "eine billion"), + ("eins billiarden", "eine billiarde"), + ] + fix_syntax = pynini.union(*[pynini.cross(*x) for x in fix_syntax]) + self.graph = ( + ((DAMO_DIGIT - "0" + pynini.closure(DAMO_DIGIT, 0)) - "0" - "1") + @ pynini.cdrewrite(pynini.closure(pynutil.insert("0")), "[BOS]", "", DAMO_SIGMA) + @ DAMO_DIGIT**24 + @ graph + @ pynini.cdrewrite(delete_space, "[BOS]", "", DAMO_SIGMA) + @ pynini.cdrewrite(delete_space, "", "[EOS]", DAMO_SIGMA) + @ pynini.cdrewrite(pynini.cross(" ", " "), "", "", DAMO_SIGMA) + @ pynini.cdrewrite(fix_syntax, "[BOS]", "", DAMO_SIGMA) + ) + self.graph |= graph_zero | pynini.cross("1", "eins") + + # self.graph = pynini.cdrewrite(pynutil.delete(separator), "", "", DAMO_SIGMA) @ self.graph + self.graph = self.graph.optimize() + + self.graph_hundred_component_at_least_one_none_zero_digit = ( + ((DAMO_DIGIT - "0" + pynini.closure(DAMO_DIGIT, 0)) - "0" - "1") + @ pynini.cdrewrite(pynini.closure(pynutil.insert("0")), "[BOS]", "", DAMO_SIGMA) + @ DAMO_DIGIT**3 + @ hundred_non_zero() + ) | pynini.cross("1", "eins") + + self.graph_hundred_component_at_least_one_none_zero_digit = ( + self.graph_hundred_component_at_least_one_none_zero_digit.optimize() + ) + + self.two_digit_non_zero = ( + pynini.closure(DAMO_DIGIT, 1, 2) + @ self.graph_hundred_component_at_least_one_none_zero_digit + ) + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/date.py b/fun_text_processing/text_normalization/de/taggers/date.py new file mode 100644 index 0000000..1c882aa --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/date.py @@ -0,0 +1,130 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + TO_LOWER, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + +graph_teen = pynini.invert(pynini.string_file(get_abs_path("data/numbers/teen.tsv"))).optimize() +graph_digit = pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv"))).optimize() +ties_graph = pynini.invert(pynini.string_file(get_abs_path("data/numbers/ties.tsv"))).optimize() +delete_leading_zero = (pynutil.delete("0") | (DAMO_DIGIT - "0")) + DAMO_DIGIT + + +def get_year_graph(cardinal: GraphFst) -> "pynini.FstLike": + """ + Returns year verbalizations as fst + + < 2000 neunzehn (hundert) (vier und zwanzig), >= 2000 regular cardinal + **00 ** hundert + + Args: + delete_leading_zero: removed leading zero + cardinal: cardinal GraphFst + """ + + year_gt_2000 = (pynini.union("21", "20") + DAMO_DIGIT**2) @ cardinal.graph + + graph_two_digit = delete_leading_zero @ cardinal.two_digit_non_zero + hundred = pynutil.insert("hundert") + graph_double_double = ( + (pynini.accep("1") + DAMO_DIGIT) @ graph_two_digit + + insert_space + + pynini.closure(hundred + insert_space, 0, 1) + + graph_two_digit + ) + # for 20** + graph_double_double |= pynini.accep("20") @ graph_two_digit + insert_space + graph_two_digit + graph = ( + graph_double_double + | (pynini.accep("1") + DAMO_DIGIT) @ graph_two_digit + + insert_space + + pynutil.delete("00") + + hundred + | year_gt_2000 + ) + return graph + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, e.g. + "01.04.2010" -> date { day: "erster" month: "april" year: "zwei tausend zehn" preserve_order: true } + "1994" -> date { year: "neunzehn vier und neuzig" } + "1900" -> date { year: "neunzehn hundert" } + + Args: + cardinal: cardinal GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool): + super().__init__(name="date", kind="classify", deterministic=deterministic) + + month_abbr_graph = load_labels(get_abs_path("data/months/abbr_to_name.tsv")) + number_to_month = pynini.string_file(get_abs_path("data/months/numbers.tsv")).optimize() + month_graph = pynini.union(*[x[1] for x in month_abbr_graph]).optimize() + month_abbr_graph = pynini.string_map(month_abbr_graph) + month_abbr_graph = ( + pynutil.add_weight(month_abbr_graph, weight=0.0001) + | ((TO_LOWER + pynini.closure(DAMO_CHAR)) @ month_abbr_graph) + ) + pynini.closure(pynutil.delete(".", weight=-0.0001), 0, 1) + + self.month_abbr = month_abbr_graph + month_graph |= (TO_LOWER + pynini.closure(DAMO_CHAR)) @ month_graph + # jan.-> januar, Jan-> januar, januar-> januar + month_graph |= month_abbr_graph + + numbers = cardinal.graph_hundred_component_at_least_one_none_zero_digit + optional_leading_zero = delete_leading_zero | DAMO_DIGIT + # 01, 31, 1 + digit_day = optional_leading_zero @ pynini.union(*[str(x) for x in range(1, 32)]) @ numbers + day = (pynutil.insert('day: "') + digit_day + pynutil.insert('"')).optimize() + + digit_month = optional_leading_zero @ pynini.union(*[str(x) for x in range(1, 13)]) + number_to_month = digit_month @ number_to_month + digit_month @= numbers + + month_name = (pynutil.insert('month: "') + month_graph + pynutil.insert('"')).optimize() + month_number = ( + pynutil.insert('month: "') + + (pynutil.add_weight(digit_month, weight=0.0001) | number_to_month) + + pynutil.insert('"') + ).optimize() + + # prefer cardinal over year + year = pynutil.add_weight(get_year_graph(cardinal=cardinal), weight=0.001) + self.year = year + + year_only = pynutil.insert('year: "') + year + pynutil.insert('"') + + graph_dmy = ( + day + + pynutil.delete(".") + + pynini.closure(pynutil.delete(" "), 0, 1) + + insert_space + + month_name + + pynini.closure(pynini.accep(" ") + year_only, 0, 1) + ) + + separators = ["."] + for sep in separators: + year_optional = pynini.closure(pynini.cross(sep, " ") + year_only, 0, 1) + new_graph = day + pynini.cross(sep, " ") + month_number + year_optional + graph_dmy |= new_graph + + dash = "-" + day_optional = pynini.closure(pynini.cross(dash, " ") + day, 0, 1) + graph_ymd = year_only + pynini.cross(dash, " ") + month_number + day_optional + + final_graph = graph_dmy + pynutil.insert(" preserve_order: true") + final_graph |= year_only + final_graph |= graph_ymd + + self.final_graph = final_graph.optimize() + self.fst = self.add_tokens(self.final_graph).optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/decimal.py b/fun_text_processing/text_normalization/de/taggers/decimal.py new file mode 100644 index 0000000..834629a --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/decimal.py @@ -0,0 +1,82 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, insert_space +from pynini.lib import pynutil + +quantities = pynini.string_file(get_abs_path("data/numbers/quantities.tsv")) + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. 1 million -> integer_part: "eine" quantity: "million" + e.g. 1.4 million -> integer_part: "eins" fractional_part: "vier" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + numbers = cardinal_up_to_hundred + + res = ( + pynutil.insert('integer_part: "') + + numbers + + pynutil.insert('"') + + pynini.accep(" ") + + pynutil.insert('quantity: "') + + quantities + + pynutil.insert('"') + ) + res |= ( + decimal + + pynini.accep(" ") + + pynutil.insert('quantity: "') + + quantities + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal, e.g. + -11,4006 billion -> decimal { negative: "true" integer_part: "elf" fractional_part: "vier null null sechs" quantity: "billion" preserve_order: true } + 1 billion -> decimal { integer_part: "eins" quantity: "billion" preserve_order: true } + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + + graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")).invert() + graph_digit |= pynini.string_file(get_abs_path("data/numbers/zero.tsv")).invert() + graph_digit |= pynini.cross("1", "eins") + self.graph = graph_digit + pynini.closure(insert_space + graph_digit).optimize() + + point = pynutil.delete(",") + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + + self.graph_fractional = ( + pynutil.insert('fractional_part: "') + self.graph + pynutil.insert('"') + ) + self.graph_integer = ( + pynutil.insert('integer_part: "') + cardinal.graph + pynutil.insert('"') + ) + final_graph_wo_sign = self.graph_integer + point + insert_space + self.graph_fractional + + self.final_graph_wo_negative = final_graph_wo_sign | get_quantity( + final_graph_wo_sign, cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + final_graph = optional_graph_negative + self.final_graph_wo_negative + final_graph += pynutil.insert(" preserve_order: true") + + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/electronic.py b/fun_text_processing/text_normalization/de/taggers/electronic.py new file mode 100644 index 0000000..62df591 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/electronic.py @@ -0,0 +1,64 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: email addresses + e.g. "abc@hotmail.com" -> electronic { username: "abc" domain: "hotmail.com" preserve_order: true } + e.g. "www.abc.com/123" -> electronic { protocol: "www." domain: "abc.com/123" preserve_order: true } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="classify", deterministic=deterministic) + + dot = pynini.accep(".") + accepted_common_domains = [ + x[0] for x in load_labels(get_abs_path("data/electronic/domain.tsv")) + ] + accepted_common_domains = pynini.union(*accepted_common_domains) + accepted_symbols = [x[0] for x in load_labels(get_abs_path("data/electronic/symbols.tsv"))] + accepted_symbols = pynini.union(*accepted_symbols) - dot + accepted_characters = pynini.closure(DAMO_ALPHA | DAMO_DIGIT | accepted_symbols) + + # email + username = ( + pynutil.insert('username: "') + + accepted_characters + + pynutil.insert('"') + + pynini.cross("@", " ") + ) + domain_graph = accepted_characters + dot + accepted_characters + domain_graph = pynutil.insert('domain: "') + domain_graph + pynutil.insert('"') + domain_common_graph = ( + pynutil.insert('domain: "') + + accepted_characters + + accepted_common_domains + + pynini.closure( + (accepted_symbols | dot) + pynini.closure(accepted_characters, 1), 0, 1 + ) + + pynutil.insert('"') + ) + graph = (username + domain_graph) | domain_common_graph + + # url + protocol_start = pynini.accep("https://") | pynini.accep("http://") + protocol_end = pynini.accep("www.") + protocol = protocol_start | protocol_end | (protocol_start + protocol_end) + protocol = pynutil.insert('protocol: "') + protocol + pynutil.insert('"') + graph |= protocol + insert_space + (domain_graph | domain_common_graph) + self.graph = graph + + final_graph = self.add_tokens(self.graph + pynutil.insert(" preserve_order: true")) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/fraction.py b/fun_text_processing/text_normalization/de/taggers/fraction.py new file mode 100644 index 0000000..fca1af3 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/fraction.py @@ -0,0 +1,42 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + "23 4/6" -> + fraction { integer: "drei und zwanzig" numerator: "vier" denominator: "sechs" preserve_order: true } + + Args: + cardinal: cardinal GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal, deterministic: bool = True): + super().__init__(name="fraction", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph + + self.optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + self.integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + self.numerator = ( + pynutil.insert('numerator: "') + + cardinal_graph + + pynini.cross(pynini.union("/", " / "), '" ') + ) + self.denominator = pynutil.insert('denominator: "') + cardinal_graph + pynutil.insert('"') + + self.graph = ( + self.optional_graph_negative + + pynini.closure(self.integer + pynini.accep(" "), 0, 1) + + self.numerator + + self.denominator + ) + + graph = self.graph + pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/measure.py b/fun_text_processing/text_normalization/de/taggers/measure.py new file mode 100644 index 0000000..3142345 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/measure.py @@ -0,0 +1,185 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_NON_BREAKING_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + insert_space, +) +from pynini.examples import plurals +from pynini.lib import pynutil + +unit_singular = pynini.string_file(get_abs_path("data/measure/measurements.tsv")) +suppletive = pynini.string_file(get_abs_path("data/measure/suppletive.tsv")) + + +def singular_to_plural(): + # plural endung n/en maskuline Nomen mit den Endungen e, ent, and, ant, ist, or + _n = DAMO_SIGMA + pynini.union("e") + pynutil.insert("n") + _en = ( + DAMO_SIGMA + + pynini.union( + "ent", "and", "ant", "ist", "or", "ion", "ik", "heit", "keit", "schaft", "tät", "ung" + ) + + pynutil.insert("en") + ) + _nen = DAMO_SIGMA + pynini.union("in") + (pynutil.insert("e") | pynutil.insert("nen")) + _fremd = DAMO_SIGMA + pynini.union("ma", "um", "us") + pynutil.insert("en") + # maskuline Nomen mit den Endungen eur, ich, ier, ig, ling, ör + _e = DAMO_SIGMA + pynini.union("eur", "ich", "ier", "ig", "ling", "ör") + pynutil.insert("e") + _s = DAMO_SIGMA + pynini.union("a", "i", "o", "u", "y") + pynutil.insert("s") + + graph_plural = plurals._priority_union( + suppletive, pynini.union(_n, _en, _nen, _fremd, _e, _s), DAMO_SIGMA + ).optimize() + + return graph_plural + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure, e.g. + "2,4 oz" -> measure { cardinal { integer_part: "zwei" fractional_part: "vier" units: "unzen" preserve_order: true } } + "1 oz" -> measure { cardinal { integer: "zwei" units: "unze" preserve_order: true } } + "1 million oz" -> measure { cardinal { integer: "eins" quantity: "million" units: "unze" preserve_order: true } } + This class also converts words containing numbers and letters + e.g. "a-8" —> "a acht" + e.g. "1,2-a" —> "ein komma zwei a" + + Args: + cardinal: CardinalFst + decimal: DecimalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__( + self, cardinal: GraphFst, decimal: GraphFst, fraction: GraphFst, deterministic: bool = True + ): + super().__init__(name="measure", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph + + graph_unit_singular = convert_space(unit_singular) + graph_unit_plural = graph_unit_singular @ pynini.cdrewrite( + convert_space(suppletive), "", "[EOS]", DAMO_SIGMA + ) + optional_graph_negative = pynini.closure("-", 0, 1) + + graph_unit_denominator = ( + pynini.cross("/", "pro") + pynutil.insert(DAMO_NON_BREAKING_SPACE) + graph_unit_singular + ) + + optional_unit_denominator = pynini.closure( + pynutil.insert(DAMO_NON_BREAKING_SPACE) + graph_unit_denominator, + 0, + 1, + ) + + unit_plural = ( + pynutil.insert('units: "') + + (graph_unit_plural + (optional_unit_denominator) | graph_unit_denominator) + + pynutil.insert('"') + ) + + unit_singular_graph = ( + pynutil.insert('units: "') + + ((graph_unit_singular + optional_unit_denominator) | graph_unit_denominator) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + decimal.fst + insert_space + pynini.closure(pynutil.delete(" "), 0, 1) + unit_plural + ) + + subgraph_cardinal = ( + (optional_graph_negative + (pynini.closure(DAMO_DIGIT) - "1")) @ cardinal.fst + + insert_space + + pynini.closure(pynutil.delete(" "), 0, 1) + + unit_plural + ) + + subgraph_cardinal |= ( + (optional_graph_negative + pynini.accep("1")) + @ cardinal.fst + @ pynini.cdrewrite(pynini.cross("eins", "ein"), "", "", DAMO_SIGMA) + + insert_space + + pynini.closure(pynutil.delete(" "), 0, 1) + + unit_singular_graph + ) + + subgraph_fraction = ( + fraction.fst + insert_space + pynini.closure(pynutil.delete(" "), 0, 1) + unit_plural + ) + + cardinal_dash_alpha = ( + pynutil.insert('cardinal { integer: "') + + cardinal_graph + + pynutil.delete("-") + + pynutil.insert('" } units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.insert('"') + ) + + alpha_dash_cardinal = ( + pynutil.insert('units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.delete("-") + + pynutil.insert('"') + + pynutil.insert(' cardinal { integer: "') + + cardinal_graph + + pynutil.insert('" }') + ) + + decimal_dash_alpha = ( + pynutil.insert("decimal { ") + + decimal.final_graph_wo_negative + + pynutil.delete("-") + + pynutil.insert(' } units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.insert('"') + ) + + decimal_times = ( + pynutil.insert("decimal { ") + + decimal.final_graph_wo_negative + + pynutil.insert(' } units: "') + + pynini.union("x", "X") + + pynutil.insert('"') + ) + + cardinal_times = ( + pynutil.insert('cardinal { integer: "') + + cardinal_graph + + pynutil.insert('" } units: "') + + pynini.union("x", "X") + + pynutil.insert('"') + ) + + alpha_dash_decimal = ( + pynutil.insert('units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.delete("-") + + pynutil.insert('"') + + pynutil.insert(" decimal { ") + + decimal.final_graph_wo_negative + + pynutil.insert(" }") + ) + + final_graph = ( + subgraph_decimal + | subgraph_cardinal + | cardinal_dash_alpha + | alpha_dash_cardinal + | decimal_dash_alpha + | decimal_times + | alpha_dash_decimal + | subgraph_fraction + | cardinal_times + ) + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/money.py b/fun_text_processing/text_normalization/de/taggers/money.py new file mode 100644 index 0000000..71ae2a3 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/money.py @@ -0,0 +1,160 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + convert_space, + insert_space, +) +from pynini.lib import pynutil + +min_singular = pynini.string_file(get_abs_path("data/money/currency_minor_singular.tsv")) +min_plural = pynini.string_file(get_abs_path("data/money/currency_minor_plural.tsv")) +maj_singular = pynini.string_file((get_abs_path("data/money/currency.tsv"))) + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money, e.g. + "€1" -> money { currency_maj: "euro" integer_part: "ein"} + "€1,000" -> money { currency_maj: "euro" integer_part: "ein" } + "€1,001" -> money { currency_maj: "euro" integer_part: "eins" fractional_part: "null null eins"} + "£1,4" -> money { integer_part: "ein" currency_maj: "pfund" fractional_part: "vierzig" preserve_order: true} + -> money { integer_part: "ein" currency_maj: "pfund" fractional_part: "vierzig" currency_min: "pence" preserve_order: true} + "£0,01" -> money { fractional_part: "ein" currency_min: "penny" preserve_order: true} + "£0,01 million" -> money { currency_maj: "pfund" integer_part: "null" fractional_part: "null eins" quantity: "million"} + + Args: + cardinal: CardinalFst + decimal: DecimalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph + graph_decimal_final = decimal.fst + + maj_singular_labels = load_labels(get_abs_path("data/money/currency.tsv")) + maj_singular_graph = convert_space(maj_singular) + maj_plural_graph = maj_singular_graph + + graph_maj_singular = ( + pynutil.insert('currency_maj: "') + maj_singular_graph + pynutil.insert('"') + ) + graph_maj_plural = ( + pynutil.insert('currency_maj: "') + maj_plural_graph + pynutil.insert('"') + ) + + optional_delete_fractional_zeros = pynini.closure( + pynutil.delete(",") + pynini.closure(pynutil.delete("0"), 1), 0, 1 + ) + graph_integer_one = ( + pynutil.insert('integer_part: "') + pynini.cross("1", "ein") + pynutil.insert('"') + ) + + # only for decimals where third decimal after comma is non-zero or with quantity + decimal_delete_last_zeros = ( + pynini.closure(DAMO_DIGIT, 1) + + pynini.accep(",") + + pynini.closure(DAMO_DIGIT, 2) + + (DAMO_DIGIT - "0") + + pynini.closure(pynutil.delete("0")) + ) + decimal_with_quantity = DAMO_SIGMA + DAMO_ALPHA + graph_decimal = ( + graph_maj_plural + + insert_space + + (decimal_delete_last_zeros | decimal_with_quantity) @ graph_decimal_final + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "1") @ cardinal_graph) + + pynutil.insert('"') + ) + + graph_integer_only = graph_maj_singular + insert_space + graph_integer_one + graph_integer_only |= graph_maj_plural + insert_space + graph_integer + + graph = (graph_integer_only + optional_delete_fractional_zeros) | graph_decimal + + # remove trailing zeros of non zero number in the first 2 digits and fill up to 2 digits + # e.g. 2000 -> 20, 0200->02, 01 -> 01, 10 -> 10 + # not accepted: 002, 00, 0, + two_digits_fractional_part = ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(pynutil.delete("0")) + ) @ ( + (pynutil.delete("0") + (DAMO_DIGIT - "0")) + | ((DAMO_DIGIT - "0") + pynutil.insert("0")) + | ((DAMO_DIGIT - "0") + DAMO_DIGIT) + ) + + graph_min_singular = pynutil.insert(' currency_min: "') + min_singular + pynutil.insert('"') + graph_min_plural = pynutil.insert(' currency_min: "') + min_plural + pynutil.insert('"') + + # format ** euro ** cent + decimal_graph_with_minor = None + for curr_symbol, _ in maj_singular_labels: + preserve_order = pynutil.insert(" preserve_order: true") + integer_plus_maj = ( + graph_integer + insert_space + pynutil.insert(curr_symbol) @ graph_maj_plural + ) + integer_plus_maj |= ( + graph_integer_one + insert_space + pynutil.insert(curr_symbol) @ graph_maj_singular + ) + # non zero integer part + integer_plus_maj = (pynini.closure(DAMO_DIGIT) - "0") @ integer_plus_maj + + graph_fractional_one = two_digits_fractional_part @ pynini.cross("1", "ein") + graph_fractional_one = ( + pynutil.insert('fractional_part: "') + graph_fractional_one + pynutil.insert('"') + ) + graph_fractional = ( + two_digits_fractional_part + @ (pynini.closure(DAMO_DIGIT, 1, 2) - "1") + @ cardinal.two_digit_non_zero + ) + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_fractional + pynutil.insert('"') + ) + + fractional_plus_min = ( + graph_fractional + insert_space + pynutil.insert(curr_symbol) @ graph_min_plural + ) + fractional_plus_min |= ( + graph_fractional_one + + insert_space + + pynutil.insert(curr_symbol) @ graph_min_singular + ) + + decimal_graph_with_minor_curr = ( + integer_plus_maj + pynini.cross(",", " ") + fractional_plus_min + ) + decimal_graph_with_minor_curr |= pynutil.add_weight( + integer_plus_maj + + pynini.cross(",", " ") + + pynutil.insert('fractional_part: "') + + two_digits_fractional_part @ cardinal.two_digit_non_zero + + pynutil.insert('"'), + weight=0.0001, + ) + + decimal_graph_with_minor_curr |= pynutil.delete("0,") + fractional_plus_min + decimal_graph_with_minor_curr = ( + pynutil.delete(curr_symbol) + decimal_graph_with_minor_curr + preserve_order + ) + + decimal_graph_with_minor = ( + decimal_graph_with_minor_curr + if decimal_graph_with_minor is None + else pynini.union(decimal_graph_with_minor, decimal_graph_with_minor_curr) + ) + + final_graph = graph | decimal_graph_with_minor + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/ordinal.py b/fun_text_processing/text_normalization/de/taggers/ordinal.py new file mode 100644 index 0000000..6481dc8 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/ordinal.py @@ -0,0 +1,37 @@ +# Adapted from https://github.com/google/TextNormalizationCoveringGrammars +# Russian minimally supervised number grammar. + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_DIGIT, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals, e.g. + "2." -> ordinal { integer: "zwei" } } + "2tes" -> ordinal { integer: "zwei" } } + + Args: + cardinal: cardinal GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic=False): + super().__init__(name="ordinal", kind="classify", deterministic=deterministic) + + cardinal_graph = cardinal.graph + endings = ["ter", "tes", "tem", "te", "ten"] + self.graph = ( + ( + pynini.closure(DAMO_DIGIT | pynini.accep(".")) + + pynutil.delete( + pynutil.add_weight(pynini.union(*endings), weight=0.0001) | pynini.accep(".") + ) + ) + @ cardinal_graph + ).optimize() + final_graph = pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/telephone.py b/fun_text_processing/text_normalization/de/taggers/telephone.py new file mode 100644 index 0000000..018d6f0 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/telephone.py @@ -0,0 +1,66 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import DAMO_DIGIT, GraphFst, insert_space +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone, which includes country code, number part and extension + + E.g + "+49 1234-1233" -> telephone { country_code: "plus neun und vierzig" number_part: "eins zwei drei vier eins zwei drei drei" preserve_order: true } + "(012) 1234-1233" -> telephone { country_code: "null eins zwei" number_part: "eins zwei drei vier eins zwei drei drei" preserve_order: true } + (0**) + + Args: + cardinal: cardinal GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="telephone", kind="classify", deterministic=deterministic) + + graph_zero = pynini.invert( + pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ).optimize() + graph_digit_no_zero = pynini.invert( + pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + ).optimize() | pynini.cross("1", "eins") + graph_digit = graph_digit_no_zero | graph_zero + + numbers_with_single_digits = pynini.closure(graph_digit + insert_space) + graph_digit + + two_digit_and_zero = (DAMO_DIGIT**2 @ cardinal.two_digit_non_zero) | graph_zero + # def add_space_after_two_digit(): + # return pynini.closure(two_digit_and_zero + insert_space) + ( + # two_digit_and_zero + # ) + + country_code = pynini.closure(pynini.cross("+", "plus "), 0, 1) + two_digit_and_zero + country_code |= ( + pynutil.delete("(") + + graph_zero + + insert_space + + numbers_with_single_digits + + pynutil.delete(")") + ) + country_code |= graph_zero + insert_space + numbers_with_single_digits + + country_code = pynutil.insert('country_code: "') + country_code + pynutil.insert('"') + + del_separator = pynini.cross(pynini.union("-", " "), " ") + # numbers_with_two_digits = pynini.closure(graph_digit + insert_space) + add_space_after_two_digit() + pynini.closure(insert_space + graph_digit) + # numbers = numbers_with_two_digits + pynini.closure(del_separator + numbers_with_two_digits, 0, 1) + numbers = numbers_with_single_digits + pynini.closure( + del_separator + numbers_with_single_digits, 0, 1 + ) + number_length = pynini.closure((DAMO_DIGIT | pynini.union("-", " ", ")", "(")), 7) + number_part = pynini.compose(number_length, numbers) + number = pynutil.insert('number_part: "') + number_part + pynutil.insert('"') + + graph = country_code + pynini.accep(" ") + number + self.graph = graph + final_graph = self.add_tokens(self.graph + pynutil.insert(" preserve_order: true")) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/time.py b/fun_text_processing/text_normalization/de/taggers/time.py new file mode 100644 index 0000000..9d5768c --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/time.py @@ -0,0 +1,94 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + GraphFst, + convert_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time, e.g. + "02:15 Uhr est" -> time { hours: "2" minutes: "15" zone: "e s t"} + "2 Uhr" -> time { hours: "2" } + "09:00 Uhr" -> time { hours: "2" } + "02:15:10 Uhr" -> time { hours: "2" minutes: "15" seconds: "10"} + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="time", kind="classify", deterministic=deterministic) + + final_suffix = pynutil.delete(" ") + pynutil.delete("Uhr") | pynutil.delete("uhr") + time_zone_graph = pynini.string_file(get_abs_path("data/time/time_zone.tsv")) + + labels_hour = [str(x) for x in range(0, 25)] + labels_minute_single = [str(x) for x in range(1, 10)] + labels_minute_double = [str(x) for x in range(10, 60)] + + delete_leading_zero_to_double_digit = ( + pynutil.delete("0") | (DAMO_DIGIT - "0") + ) + DAMO_DIGIT + + graph_hour = pynini.union(*labels_hour) + + graph_minute_single = pynini.union(*labels_minute_single) + graph_minute_double = pynini.union(*labels_minute_double) + + final_graph_hour_only = pynutil.insert('hours: "') + graph_hour + pynutil.insert('"') + final_graph_hour = ( + pynutil.insert('hours: "') + + delete_leading_zero_to_double_digit @ graph_hour + + pynutil.insert('"') + ) + final_graph_minute = ( + pynutil.insert('minutes: "') + + (pynutil.delete("0") + graph_minute_single | graph_minute_double) + + pynutil.insert('"') + ) + final_graph_second = ( + pynutil.insert('seconds: "') + + (pynutil.delete("0") + graph_minute_single | graph_minute_double) + + pynutil.insert('"') + ) + final_time_zone_optional = pynini.closure( + pynini.accep(" ") + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + # 02:30 Uhr + graph_hm = ( + final_graph_hour + + pynutil.delete(":") + + (pynutil.delete("00") | (insert_space + final_graph_minute)) + + final_suffix + + final_time_zone_optional + ) + + # 10:30:05 Uhr, + graph_hms = ( + final_graph_hour + + pynutil.delete(":") + + (pynini.cross("00", ' minutes: "0"') | (insert_space + final_graph_minute)) + + pynutil.delete(":") + + (pynini.cross("00", ' seconds: "0"') | (insert_space + final_graph_second)) + + final_suffix + + final_time_zone_optional + + pynutil.insert(" preserve_order: true") + ) + + # 2 Uhr est + graph_h = final_graph_hour_only + final_suffix + final_time_zone_optional + final_graph = (graph_hm | graph_h | graph_hms).optimize() + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/tokenize_and_classify.py b/fun_text_processing/text_normalization/de/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..52a3c92 --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/tokenize_and_classify.py @@ -0,0 +1,145 @@ +import os + +import pynini +from fun_text_processing.text_normalization.de.taggers.cardinal import CardinalFst +from fun_text_processing.text_normalization.de.taggers.date import DateFst +from fun_text_processing.text_normalization.de.taggers.decimal import DecimalFst +from fun_text_processing.text_normalization.de.taggers.electronic import ElectronicFst +from fun_text_processing.text_normalization.de.taggers.fraction import FractionFst +from fun_text_processing.text_normalization.de.taggers.measure import MeasureFst +from fun_text_processing.text_normalization.de.taggers.money import MoneyFst +from fun_text_processing.text_normalization.de.taggers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.de.taggers.telephone import TelephoneFst +from fun_text_processing.text_normalization.de.taggers.time import TimeFst +from fun_text_processing.text_normalization.de.taggers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.de.taggers.word import WordFst +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + """ + + def __init__( + self, + input_case: str, + deterministic: bool = False, + cache_dir: str = None, + overwrite_cache: bool = False, + whitelist: str = None, + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + whitelist_file = os.path.basename(whitelist) if whitelist else "" + far_file = os.path.join( + cache_dir, f"_{input_case}_de_tn_{deterministic}_deterministic{whitelist_file}.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + no_digits = pynini.closure(pynini.difference(DAMO_CHAR, DAMO_DIGIT)) + self.fst_no_digits = pynini.compose(self.fst, no_digits).optimize() + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars. This might take some time...") + + self.cardinal = CardinalFst(deterministic=deterministic) + cardinal_graph = self.cardinal.fst + + self.ordinal = OrdinalFst(cardinal=self.cardinal, deterministic=deterministic) + ordinal_graph = self.ordinal.fst + + self.decimal = DecimalFst(cardinal=self.cardinal, deterministic=deterministic) + decimal_graph = self.decimal.fst + + self.fraction = FractionFst(cardinal=self.cardinal, deterministic=deterministic) + fraction_graph = self.fraction.fst + self.measure = MeasureFst( + cardinal=self.cardinal, + decimal=self.decimal, + fraction=self.fraction, + deterministic=deterministic, + ) + measure_graph = self.measure.fst + self.date = DateFst(cardinal=self.cardinal, deterministic=deterministic) + date_graph = self.date.fst + word_graph = WordFst(deterministic=deterministic).fst + self.time = TimeFst(deterministic=deterministic) + time_graph = self.time.fst + self.telephone = TelephoneFst(cardinal=self.cardinal, deterministic=deterministic) + telephone_graph = self.telephone.fst + self.electronic = ElectronicFst(deterministic=deterministic) + electronic_graph = self.electronic.fst + self.money = MoneyFst( + cardinal=self.cardinal, decimal=self.decimal, deterministic=deterministic + ) + money_graph = self.money.fst + self.whitelist = WhiteListFst( + input_case=input_case, deterministic=deterministic, input_file=whitelist + ) + whitelist_graph = self.whitelist.fst + punct_graph = PunctuationFst(deterministic=deterministic).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.1) + | pynutil.add_weight(date_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + ) + + classify |= pynutil.add_weight(word_graph, 100) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure( + pynutil.add_weight(delete_extra_space, 1.1) + token_plus_punct + ) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + no_digits = pynini.closure(pynini.difference(DAMO_CHAR, DAMO_DIGIT)) + self.fst_no_digits = pynini.compose(self.fst, no_digits).optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/de/taggers/whitelist.py b/fun_text_processing/text_normalization/de/taggers/whitelist.py new file mode 100644 index 0000000..3253a6b --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/whitelist.py @@ -0,0 +1,52 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, convert_space +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelist, e.g. + "Mr." -> tokens { name: "mister" } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + input_file: path to a file with whitelist replacements + """ + + def __init__(self, input_case: str, deterministic: bool = True, input_file: str = None): + super().__init__(name="whitelist", kind="classify", deterministic=deterministic) + + def _get_whitelist_graph(input_case, file): + whitelist = load_labels(file) + if input_case == "lower_cased": + whitelist = [[x[0].lower()] + x[1:] for x in whitelist] + graph = pynini.string_map(whitelist) + return graph + + graph = _get_whitelist_graph(input_case, get_abs_path("data/whitelist.tsv")) + if not deterministic and input_case != "lower_cased": + graph |= pynutil.add_weight( + _get_whitelist_graph("lower_cased", get_abs_path("data/whitelist.tsv")), + weight=0.0001, + ) + + if input_file: + whitelist_provided = _get_whitelist_graph(input_case, input_file) + if not deterministic: + graph |= whitelist_provided + else: + graph = whitelist_provided + + if not deterministic: + units_graph = _get_whitelist_graph( + input_case, file=get_abs_path("data/measure/measurements.tsv") + ) + graph |= units_graph + + self.graph = graph + self.final_graph = convert_space(self.graph).optimize() + self.fst = (pynutil.insert('name: "') + self.final_graph + pynutil.insert('"')).optimize() diff --git a/fun_text_processing/text_normalization/de/taggers/word.py b/fun_text_processing/text_normalization/de/taggers/word.py new file mode 100644 index 0000000..318ba5d --- /dev/null +++ b/fun_text_processing/text_normalization/de/taggers/word.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying word. + e.g. sleep -> tokens { name: "sleep" } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/text_normalization/de/utils.py b/fun_text_processing/text_normalization/de/utils.py new file mode 100644 index 0000000..1a1f30f --- /dev/null +++ b/fun_text_processing/text_normalization/de/utils.py @@ -0,0 +1,34 @@ +import csv +import os + +import logging + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + abs_path = os.path.dirname(os.path.abspath(__file__)) + os.sep + rel_path + + if not os.path.exists(abs_path): + logging.warning(f"{abs_path} does not exist") + return abs_path + + +def load_labels(abs_path): + """ + loads relative path file as dictionary + + Args: + abs_path: absolute path + + Returns dictionary of mappings + """ + label_tsv = open(abs_path, encoding="utf-8") + labels = list(csv.reader(label_tsv, delimiter="\t")) + return labels diff --git a/fun_text_processing/text_normalization/de/verbalizers/__init__.py b/fun_text_processing/text_normalization/de/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/de/verbalizers/cardinal.py b/fun_text_processing/text_normalization/de/verbalizers/cardinal.py new file mode 100644 index 0000000..13e1810 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/cardinal.py @@ -0,0 +1,28 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinals + e.g. cardinal { integer: "zwei" } -> "zwei" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) + optional_sign = pynini.closure(pynini.cross('negative: "true" ', "minus "), 0, 1) + self.optional_sign = optional_sign + integer = pynini.closure(DAMO_NOT_QUOTE, 1) + + self.integer = pynutil.delete(' "') + integer + pynutil.delete('"') + + integer = pynutil.delete("integer:") + self.integer + self.numbers = integer + graph = optional_sign + self.numbers + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/date.py b/fun_text_processing/text_normalization/de/verbalizers/date.py new file mode 100644 index 0000000..e05525f --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/date.py @@ -0,0 +1,55 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_preserve_order, +) +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { day: "vier" month: "april" year: "zwei tausend zwei" } -> "vierter april zwei tausend zwei" + date { day: "vier" month: "mai" year: "zwei tausend zwei" } -> "vierter mai zwei tausend zwei" + + Args: + ordinal: ordinal verbalizer GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, ordinal: GraphFst, deterministic: bool = True): + super().__init__(name="date", kind="verbalize", deterministic=deterministic) + + day_cardinal = ( + pynutil.delete('day: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + day = day_cardinal @ pynini.cdrewrite( + ordinal.ordinal_stem, "", "[EOS]", DAMO_SIGMA + ) + pynutil.insert("ter") + + months_names = pynini.union( + *[x[1] for x in load_labels(get_abs_path("data/months/abbr_to_name.tsv"))] + ) + month = pynutil.delete('month: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + final_month = month @ months_names + final_month |= month @ pynini.difference(DAMO_SIGMA, months_names) @ pynini.cdrewrite( + ordinal.ordinal_stem, "", "[EOS]", DAMO_SIGMA + ) + pynutil.insert("ter") + + year = pynutil.delete('year: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + + # day month year + graph_dmy = ( + day + pynini.accep(" ") + final_month + pynini.closure(pynini.accep(" ") + year, 0, 1) + ) + graph_dmy |= final_month + pynini.accep(" ") + year + + self.graph = graph_dmy | year + final_graph = self.graph + delete_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/decimal.py b/fun_text_processing/text_normalization/de/verbalizers/decimal.py new file mode 100644 index 0000000..db4100a --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/decimal.py @@ -0,0 +1,57 @@ +import pynini +from fun_text_processing.text_normalization.de.taggers.decimal import quantities +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_preserve_order, + insert_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal, e.g. + decimal { negative: "true" integer_part: "elf" fractional_part: "vier null sechs" quantity: "billionen" } -> minus elf komma vier null sechs billionen + decimal { integer_part: "eins" quantity: "billion" } -> eins billion + + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + + delete_space = pynutil.delete(" ") + self.optional_sign = pynini.closure( + pynini.cross('negative: "true"', "minus ") + delete_space, 0, 1 + ) + self.integer = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.fractional_default = ( + pynutil.delete('fractional_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + self.fractional = pynutil.insert(" komma ") + self.fractional_default + + self.quantity = ( + delete_space + + insert_space + + pynutil.delete('quantity: "') + + quantities + + pynutil.delete('"') + ) + self.optional_quantity = pynini.closure(self.quantity, 0, 1) + + graph = self.optional_sign + ( + self.integer + self.quantity + | self.integer + delete_space + self.fractional + self.optional_quantity + ) + + self.numbers = graph + graph += delete_preserve_order + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/electronic.py b/fun_text_processing/text_normalization/de/verbalizers/electronic.py new file mode 100644 index 0000000..e8cbe5d --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/electronic.py @@ -0,0 +1,64 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_preserve_order, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. electronic { username: "abc" domain: "hotmail.com" } -> "a b c at hotmail punkt com" + -> "a b c at h o t m a i l punkt c o m" + -> "a b c at hotmail punkt c o m" + -> "a b c at h o t m a i l punkt com" + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="verbalize", deterministic=deterministic) + graph_digit_no_zero = pynini.invert( + pynini.string_file(get_abs_path("data/numbers/digit.tsv")) + ).optimize() | pynini.cross("1", "eins") + graph_zero = pynini.invert( + pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ).optimize() + graph_digit = graph_digit_no_zero | graph_zero + graph_symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).optimize() + server_common = pynini.string_file(get_abs_path("data/electronic/server_name.tsv")) + domain_common = pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + + def add_space_after_char(): + return pynini.closure(DAMO_NOT_QUOTE - pynini.accep(" ") + insert_space) + ( + DAMO_NOT_QUOTE - pynini.accep(" ") + ) + + verbalize_characters = pynini.cdrewrite(graph_symbols | graph_digit, "", "", DAMO_SIGMA) + + user_name = pynutil.delete('username: "') + add_space_after_char() + pynutil.delete('"') + user_name @= verbalize_characters + + convert_defaults = ( + pynutil.add_weight(DAMO_NOT_QUOTE, weight=0.0001) | domain_common | server_common + ) + domain = convert_defaults + pynini.closure(insert_space + convert_defaults) + domain @= verbalize_characters + + domain = pynutil.delete('domain: "') + domain + pynutil.delete('"') + protocol = ( + pynutil.delete('protocol: "') + + add_space_after_char() @ pynini.cdrewrite(graph_symbols, "", "", DAMO_SIGMA) + + pynutil.delete('"') + ) + self.graph = (pynini.closure(protocol + pynini.accep(" "), 0, 1) + domain) | ( + user_name + pynini.accep(" ") + pynutil.insert("at ") + domain + ) + delete_tokens = self.delete_tokens(self.graph + delete_preserve_order) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/fraction.py b/fun_text_processing/text_normalization/de/verbalizers/fraction.py new file mode 100644 index 0000000..e926d4b --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/fraction.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_preserve_order, + insert_space, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction + e.g. fraction { integer: "drei" numerator: "eins" denominator: "zwei" }-> drei ein halb + e.g. fraction { numerator: "vier" denominator: "zwei" } -> vier halbe + e.g. fraction { numerator: "drei" denominator: "vier" } -> drei viertel + + Args: + ordinal: ordinal GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, ordinal: GraphFst, deterministic: bool = True): + super().__init__(name="fraction", kind="verbalize", deterministic=deterministic) + + optional_sign = pynini.closure( + pynini.cross('negative: "true"', "minus ") + pynutil.delete(" "), 0, 1 + ) + change_one = pynini.cdrewrite( + pynutil.add_weight(pynini.cross("eins", "ein"), weight=-0.0001), + "[BOS]", + "[EOS]", + DAMO_SIGMA, + ) + change_numerator_two = pynini.cdrewrite( + pynini.cross("zweitel", "halbe"), "[BOS]", "[EOS]", DAMO_SIGMA + ) + integer = pynutil.delete('integer_part: "') + change_one + pynutil.delete('" ') + numerator = pynutil.delete('numerator: "') + change_one + pynutil.delete('" ') + denominator = ( + pynutil.delete('denominator: "') + + pynini.closure(DAMO_NOT_QUOTE) + @ ( + pynini.cdrewrite( + pynini.closure(ordinal.ordinal_stem, 0, 1), "", "[EOS]", DAMO_SIGMA + ) + + pynutil.insert("tel") + ) + @ change_numerator_two + + pynutil.delete('"') + ) + + integer += insert_space + pynini.closure(pynutil.insert("und ", weight=0.001), 0, 1) + + denominator_one_half = pynini.cdrewrite( + pynini.cross("ein halbe", "ein halb"), "[BOS]", "[EOS]", DAMO_SIGMA + ) + + fraction_default = (numerator + insert_space + denominator) @ denominator_one_half + + self.graph = optional_sign + pynini.closure(integer, 0, 1) + fraction_default + + graph = self.graph + delete_preserve_order + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/measure.py b/fun_text_processing/text_normalization/de/verbalizers/measure.py new file mode 100644 index 0000000..90156a5 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/measure.py @@ -0,0 +1,41 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_preserve_order, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { cardinal { integer: "zwei" units: "unzen" } } -> "zwei unzen" + measure { cardinal { integer_part: "zwei" quantity: "millionen" units: "unzen" } } -> "zwei millionen unzen" + + Args: + decimal: decimal GraphFst + cardinal: cardinal GraphFst + fraction: fraction GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__( + self, decimal: GraphFst, cardinal: GraphFst, fraction: GraphFst, deterministic: bool + ): + super().__init__(name="measure", kind="verbalize", deterministic=deterministic) + unit = pynutil.delete('units: "') + pynini.closure(DAMO_NOT_QUOTE) + pynutil.delete('"') + + graph_decimal = decimal.fst + graph_cardinal = cardinal.fst + graph_fraction = fraction.fst + + graph = (graph_cardinal | graph_decimal | graph_fraction) + pynini.accep(" ") + unit + + graph |= unit + delete_extra_space + (graph_cardinal | graph_decimal) + graph += delete_preserve_order + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/money.py b/fun_text_processing/text_normalization/de/verbalizers/money.py new file mode 100644 index 0000000..f92b392 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/money.py @@ -0,0 +1,77 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_preserve_order, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { currency_maj: "euro" integer_part: "ein"} -> "ein euro" + money { currency_maj: "euro" integer_part: "eins" fractional_part: "null null eins"} -> "eins komma null null eins euro" + money { integer_part: "ein" currency_maj: "pfund" fractional_part: "vierzig" preserve_order: true} -> "ein pfund vierzig" + money { integer_part: "ein" currency_maj: "pfund" fractional_part: "vierzig" currency_min: "pence" preserve_order: true} -> "ein pfund vierzig pence" + money { fractional_part: "ein" currency_min: "penny" preserve_order: true} -> "ein penny" + money { currency_maj: "pfund" integer_part: "null" fractional_part: "null eins" quantity: "million"} -> "null komma null eins million pfund" + + Args: + decimal: GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="verbalize", deterministic=deterministic) + + keep_space = pynini.accep(" ") + + maj = ( + pynutil.delete('currency_maj: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + min = ( + pynutil.delete('currency_min: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + fractional_part = ( + pynutil.delete('fractional_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + integer_part = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_add_and = pynini.closure(pynutil.insert("und "), 0, 1) + + # *** currency_maj + graph_integer = integer_part + keep_space + maj + + # *** currency_maj + (***) | ((und) *** current_min) + graph_integer_with_minor = ( + integer_part + + keep_space + + maj + + keep_space + + (fractional_part | (optional_add_and + fractional_part + keep_space + min)) + + delete_preserve_order + ) + + # *** komma *** currency_maj + graph_decimal = decimal.fst + keep_space + maj + + # *** current_min + graph_minor = fractional_part + keep_space + min + delete_preserve_order + + graph = graph_integer | graph_integer_with_minor | graph_decimal | graph_minor + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/ordinal.py b/fun_text_processing/text_normalization/de/verbalizers/ordinal.py new file mode 100644 index 0000000..8b37e33 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/ordinal.py @@ -0,0 +1,45 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, +) +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing roman numerals + e.g. ordinal { integer: "vier" } } -> "vierter" + -> "viertes" ... + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="ordinal", kind="verbalize", deterministic=deterministic) + graph_digit = pynini.string_file(get_abs_path("data/ordinals/digit.tsv")).invert() + graph_ties = pynini.string_file(get_abs_path("data/ordinals/ties.tsv")).invert() + graph_thousands = pynini.string_file(get_abs_path("data/ordinals/thousands.tsv")).invert() + + graph = ( + pynutil.delete('integer: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + + suffixes = pynini.union("ten", "tem", "ter", "tes", "te") + convert_rest = pynutil.insert(suffixes, weight=0.01) + self.ordinal_stem = graph_digit | graph_ties | graph_thousands + + suffix = pynini.cdrewrite( + pynini.closure(self.ordinal_stem, 0, 1) + convert_rest, + "", + "[EOS]", + DAMO_SIGMA, + ).optimize() + self.graph = pynini.compose(graph, suffix) + self.suffix = suffix + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/telephone.py b/fun_text_processing/text_normalization/de/verbalizers/telephone.py new file mode 100644 index 0000000..43a6d1d --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/telephone.py @@ -0,0 +1,40 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_preserve_order, +) +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { country_code: "plus neun und vierzig" number_part: "null eins eins eins null null null" } + -> "plus neun und vierzig null eins eins eins null null null" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="telephone", kind="verbalize", deterministic=deterministic) + + country_code = ( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + self.graph = country_code + pynini.accep(" ") + number_part + + graph = self.graph + delete_preserve_order + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/time.py b/fun_text_processing/text_normalization/de/verbalizers/time.py new file mode 100644 index 0000000..f005021 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/time.py @@ -0,0 +1,126 @@ +import pynini +from fun_text_processing.text_normalization.de.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + convert_space, + delete_preserve_order, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing electronic, e.g. + time { hours: "2" minutes: "15"} -> "zwei uhr fünfzehn" + time { minutes: "15" hours: "2" } -> "viertel nach zwei" + time { minutes: "15" hours: "2" } -> "fünfzehn nach zwei" + time { hours: "14" minutes: "15"} -> "vierzehn uhr fünfzehn" + time { minutes: "15" hours: "14" } -> "viertel nach zwei" + time { minutes: "15" hours: "14" } -> "fünfzehn nach drei" + time { minutes: "45" hours: "14" } -> "viertel vor drei" + + Args: + cardinal_tagger: cardinal_tagger tagger GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal_tagger: GraphFst, deterministic: bool = True): + super().__init__(name="time", kind="verbalize", deterministic=deterministic) + + # add weight so when using inverse text normalization this conversion is depriotized + night_to_early = pynutil.add_weight( + pynini.invert( + pynini.string_file(get_abs_path("data/time/hour_to_night.tsv")) + ).optimize(), + weight=0.0001, + ) + hour_to = pynini.invert( + pynini.string_file(get_abs_path("data/time/hour_to.tsv")) + ).optimize() + minute_to = pynini.invert( + pynini.string_file(get_abs_path("data/time/minute_to.tsv")) + ).optimize() + time_zone_graph = pynini.invert( + convert_space( + pynini.union(*[x[1] for x in load_labels(get_abs_path("data/time/time_zone.tsv"))]) + ) + ) + + graph_zero = pynini.invert( + pynini.string_file(get_abs_path("data/numbers/zero.tsv")) + ).optimize() + number_verbalization = graph_zero | cardinal_tagger.two_digit_non_zero + hour = pynutil.delete('hours: "') + pynini.closure(DAMO_DIGIT, 1) + pynutil.delete('"') + hour_verbalized = hour @ number_verbalization @ pynini.cdrewrite( + pynini.cross("eins", "ein"), "[BOS]", "[EOS]", DAMO_SIGMA + ) + pynutil.insert(" uhr") + minute = pynutil.delete('minutes: "') + pynini.closure(DAMO_DIGIT, 1) + pynutil.delete('"') + zone = pynutil.delete('zone: "') + time_zone_graph + pynutil.delete('"') + optional_zone = pynini.closure(pynini.accep(" ") + zone, 0, 1) + second = pynutil.delete('seconds: "') + pynini.closure(DAMO_DIGIT, 1) + pynutil.delete('"') + graph_hms = ( + hour_verbalized + + pynini.accep(" ") + + minute @ number_verbalization + + pynutil.insert(" minuten") + + pynini.accep(" ") + + second @ number_verbalization + + pynutil.insert(" sekunden") + + optional_zone + ) + graph_hms @= pynini.cdrewrite( + pynini.cross("eins minuten", "eine minute") + | pynini.cross("eins sekunden", "eine sekunde"), + pynini.union(" ", "[BOS]"), + "", + DAMO_SIGMA, + ) + + min_30 = [str(x) for x in range(1, 31)] + min_30 = pynini.union(*min_30) + min_29 = [str(x) for x in range(1, 30)] + min_29 = pynini.union(*min_29) + + graph_h = hour_verbalized + graph_hm = hour_verbalized + pynini.accep(" ") + minute @ number_verbalization + + graph_m_past_h = ( + minute @ min_30 @ (number_verbalization | pynini.cross("15", "viertel")) + + pynini.accep(" ") + + pynutil.insert("nach ") + # + hour @ number_verbalization + + hour + @ pynini.cdrewrite(night_to_early, "[BOS]", "[EOS]", DAMO_SIGMA) + @ number_verbalization + ) + graph_m30_h = ( + minute @ pynini.cross("30", "halb") + + pynini.accep(" ") + + hour + @ pynini.cdrewrite(night_to_early, "[BOS]", "[EOS]", DAMO_SIGMA) + @ hour_to + @ number_verbalization + ) + graph_m_to_h = ( + minute @ minute_to @ min_29 @ (number_verbalization | pynini.cross("15", "viertel")) + + pynini.accep(" ") + + pynutil.insert("vor ") + + hour + @ pynini.cdrewrite(night_to_early, "[BOS]", "[EOS]", DAMO_SIGMA) + @ hour_to + @ number_verbalization + ) + + self.graph = ( + graph_hms + | graph_h + | graph_hm + | pynutil.add_weight(graph_m_past_h, weight=0.0001) + | pynutil.add_weight(graph_m30_h, weight=0.0001) + | pynutil.add_weight(graph_m_to_h, weight=0.0001) + ) + optional_zone + delete_tokens = self.delete_tokens(self.graph + delete_preserve_order) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/de/verbalizers/verbalize.py b/fun_text_processing/text_normalization/de/verbalizers/verbalize.py new file mode 100644 index 0000000..dfd5555 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/verbalize.py @@ -0,0 +1,64 @@ +from fun_text_processing.text_normalization.de.taggers.cardinal import CardinalFst as CardinalTagger +from fun_text_processing.text_normalization.de.verbalizers.cardinal import CardinalFst +from fun_text_processing.text_normalization.de.verbalizers.date import DateFst +from fun_text_processing.text_normalization.de.verbalizers.decimal import DecimalFst +from fun_text_processing.text_normalization.de.verbalizers.electronic import ElectronicFst +from fun_text_processing.text_normalization.de.verbalizers.fraction import FractionFst +from fun_text_processing.text_normalization.de.verbalizers.measure import MeasureFst +from fun_text_processing.text_normalization.de.verbalizers.money import MoneyFst +from fun_text_processing.text_normalization.de.verbalizers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.de.verbalizers.telephone import TelephoneFst +from fun_text_processing.text_normalization.de.verbalizers.time import TimeFst +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.en.verbalizers.whitelist import WhiteListFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="verbalize", kind="verbalize", deterministic=deterministic) + cardinal_tagger = CardinalTagger(deterministic=deterministic) + cardinal = CardinalFst(deterministic=deterministic) + cardinal_graph = cardinal.fst + ordinal = OrdinalFst(deterministic=deterministic) + ordinal_graph = ordinal.fst + decimal = DecimalFst(deterministic=deterministic) + decimal_graph = decimal.fst + fraction = FractionFst(ordinal=ordinal, deterministic=deterministic) + fraction_graph = fraction.fst + date = DateFst(ordinal=ordinal) + date_graph = date.fst + measure = MeasureFst( + cardinal=cardinal, decimal=decimal, fraction=fraction, deterministic=deterministic + ) + measure_graph = measure.fst + electronic = ElectronicFst(deterministic=deterministic) + electronic_graph = electronic.fst + whitelist_graph = WhiteListFst(deterministic=deterministic).fst + money_graph = MoneyFst(decimal=decimal).fst + telephone_graph = TelephoneFst(deterministic=deterministic).fst + time_graph = TimeFst(cardinal_tagger=cardinal_tagger, deterministic=deterministic).fst + + graph = ( + cardinal_graph + | measure_graph + | decimal_graph + | ordinal_graph + | date_graph + | electronic_graph + | money_graph + | fraction_graph + | whitelist_graph + | telephone_graph + | time_graph + ) + self.fst = graph diff --git a/fun_text_processing/text_normalization/de/verbalizers/verbalize_final.py b/fun_text_processing/text_normalization/de/verbalizers/verbalize_final.py new file mode 100644 index 0000000..810a1c0 --- /dev/null +++ b/fun_text_processing/text_normalization/de/verbalizers/verbalize_final.py @@ -0,0 +1,61 @@ +import os + +import pynini +from fun_text_processing.text_normalization.de.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.verbalizers.word import WordFst +from pynini.lib import pynutil + +import logging + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__( + self, deterministic: bool = True, cache_dir: str = None, overwrite_cache: bool = False + ): + super().__init__(name="verbalize_final", kind="verbalize", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join( + cache_dir, f"de_tn_{deterministic}_deterministic_verbalizer.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["verbalize"] + logging.info(f"VerbalizeFinalFst graph was restored from {far_file}.") + else: + verbalize = VerbalizeFst(deterministic=deterministic).fst + word = WordFst(deterministic=deterministic).fst + + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + + self.fst = graph.optimize() + if far_file: + generator_main(far_file, {"verbalize": self.fst}) + logging.info(f"VerbalizeFinalFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/en/__init__.py b/fun_text_processing/text_normalization/en/__init__.py new file mode 100644 index 0000000..27a2624 --- /dev/null +++ b/fun_text_processing/text_normalization/en/__init__.py @@ -0,0 +1,3 @@ +from fun_text_processing.text_normalization.en.taggers.tokenize_and_classify import ClassifyFst +from fun_text_processing.text_normalization.en.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.text_normalization.en.verbalizers.verbalize_final import VerbalizeFinalFst diff --git a/fun_text_processing/text_normalization/en/clean_eval_data.py b/fun_text_processing/text_normalization/en/clean_eval_data.py new file mode 100644 index 0000000..8a782e9 --- /dev/null +++ b/fun_text_processing/text_normalization/en/clean_eval_data.py @@ -0,0 +1,384 @@ +from argparse import ArgumentParser +from typing import List + +import regex as re +from fun_text_processing.text_normalization.data_loader_utils import ( + EOS_TYPE, + Instance, + load_files, + training_data_to_sentences, +) + + +""" +This file is for evaluation purposes. +filter_loaded_data() cleans data (list of instances) for text normalization. Filters and cleaners can be specified for each semiotic class individually. +For example, normalized text should only include characters and whitespace characters but no punctuation. + Cardinal unnormalized instances should contain at least one integer and all other characters are removed. +""" + + +class Filter: + """ + Filter class + + Args: + class_type: semiotic class used in dataset + process_func: function to transform text + filter_func: function to filter text + + """ + + def __init__(self, class_type: str, process_func: object, filter_func: object): + self.class_type = class_type + self.process_func = process_func + self.filter_func = filter_func + + def filter(self, instance: Instance) -> bool: + """ + filter function + + Args: + filters given instance with filter function + + Returns: True if given instance fulfills criteria or does not belong to class type + """ + if instance.token_type != self.class_type: + return True + return self.filter_func(instance) + + def process(self, instance: Instance) -> Instance: + """ + process function + + Args: + processes given instance with process function + + Returns: processed instance if instance belongs to expected class type or original instance + """ + if instance.token_type != self.class_type: + return instance + return self.process_func(instance) + + +def filter_cardinal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_cardinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[^0-9]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_ordinal_1(instance: Instance) -> bool: + ok = re.search(r"(st|nd|rd|th)\s*$", instance.un_normalized) + return ok + + +def process_ordinal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r"[,\s]", "", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_decimal_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_decimal_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_measure_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_measure_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"m2", "m²", un_normalized) + un_normalized = re.sub(r"(\d)([^\d.\s])", r"\1 \2", un_normalized) + normalized = re.sub(r"[^a-z\s]", "", normalized) + normalized = re.sub(r"per ([a-z\s]*)s$", r"per \1", normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_money_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_money_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + un_normalized = re.sub(r",", "", un_normalized) + un_normalized = re.sub(r"a\$", r"$", un_normalized) + un_normalized = re.sub(r"us\$", r"$", un_normalized) + un_normalized = re.sub(r"(\d)m\s*$", r"\1 million", un_normalized) + un_normalized = re.sub(r"(\d)bn?\s*$", r"\1 billion", un_normalized) + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_time_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_time_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r": ", ":", un_normalized) + un_normalized = re.sub(r"(\d)\s?a\s?m\s?", r"\1 a.m.", un_normalized) + un_normalized = re.sub(r"(\d)\s?p\s?m\s?", r"\1 p.m.", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_plain_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_plain_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_punct_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_punct_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_date_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_date_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + un_normalized = re.sub(r",", "", un_normalized) + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_letters_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_letters_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_verbatim_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_verbatim_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_digit_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_digit_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_telephone_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_telephone_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_electronic_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_electronic_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_fraction_1(instance: Instance) -> bool: + ok = re.search(r"[0-9]", instance.un_normalized) + return ok + + +def process_fraction_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +def filter_address_1(instance: Instance) -> bool: + ok = True + return ok + + +def process_address_1(instance: Instance) -> Instance: + un_normalized = instance.un_normalized + normalized = instance.normalized + normalized = re.sub(r"[^a-z ]", "", normalized) + return Instance( + token_type=instance.token_type, un_normalized=un_normalized, normalized=normalized + ) + + +filters = [] +filters.append( + Filter(class_type="CARDINAL", process_func=process_cardinal_1, filter_func=filter_cardinal_1) +) +filters.append( + Filter(class_type="ORDINAL", process_func=process_ordinal_1, filter_func=filter_ordinal_1) +) +filters.append( + Filter(class_type="DECIMAL", process_func=process_decimal_1, filter_func=filter_decimal_1) +) +filters.append( + Filter(class_type="MEASURE", process_func=process_measure_1, filter_func=filter_measure_1) +) +filters.append(Filter(class_type="MONEY", process_func=process_money_1, filter_func=filter_money_1)) +filters.append(Filter(class_type="TIME", process_func=process_time_1, filter_func=filter_time_1)) + +filters.append(Filter(class_type="DATE", process_func=process_date_1, filter_func=filter_date_1)) +filters.append(Filter(class_type="PLAIN", process_func=process_plain_1, filter_func=filter_plain_1)) +filters.append(Filter(class_type="PUNCT", process_func=process_punct_1, filter_func=filter_punct_1)) +filters.append( + Filter(class_type="LETTERS", process_func=process_letters_1, filter_func=filter_letters_1) +) +filters.append( + Filter(class_type="VERBATIM", process_func=process_verbatim_1, filter_func=filter_verbatim_1) +) +filters.append(Filter(class_type="DIGIT", process_func=process_digit_1, filter_func=filter_digit_1)) +filters.append( + Filter(class_type="TELEPHONE", process_func=process_telephone_1, filter_func=filter_telephone_1) +) +filters.append( + Filter( + class_type="ELECTRONIC", process_func=process_electronic_1, filter_func=filter_electronic_1 + ) +) +filters.append( + Filter(class_type="FRACTION", process_func=process_fraction_1, filter_func=filter_fraction_1) +) +filters.append( + Filter(class_type="ADDRESS", process_func=process_address_1, filter_func=filter_address_1) +) +filters.append(Filter(class_type=EOS_TYPE, process_func=lambda x: x, filter_func=lambda x: True)) + + +def filter_loaded_data(data: List[Instance], verbose: bool = False) -> List[Instance]: + """ + Filters list of instances + + Args: + data: list of instances + + Returns: filtered and transformed list of instances + """ + updates_instances = [] + for instance in data: + updated_instance = False + for fil in filters: + if tl.class_type == instance.token_type and tl.filter(instance): + instance = fil.process(instance) + updated_instance = True + if updated_instance: + if verbose: + print(instance) + updates_instances.append(instance) + return updates_instances + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument( + "--input", help="input file path", type=str, default="./en_with_types/output-00001-of-00100" + ) + parser.add_argument("--verbose", help="print filtered instances", action="store_true") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + file_path = args.input + + print("Loading training data: " + file_path) + instance_list = load_files([file_path]) # List of instances + filtered_instance_list = filter_loaded_data(instance_list, args.verbose) + training_data_to_sentences(filtered_instance_list) diff --git a/fun_text_processing/text_normalization/en/data/__init__.py b/fun_text_processing/text_normalization/en/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/address/__init__.py b/fun_text_processing/text_normalization/en/data/address/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/address/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/address/address_word.tsv b/fun_text_processing/text_normalization/en/data/address/address_word.tsv new file mode 100644 index 0000000..2e9e716 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/address/address_word.tsv @@ -0,0 +1,14 @@ +st Street +street Street +expy Expressway +fwy Freeway +hwy Highway +dr Drive +ct Court +ave Avenue +av Avenue +cir Circle +blvd Boulevard +alley Alley +way Way +jct Junction \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/address/state.tsv b/fun_text_processing/text_normalization/en/data/address/state.tsv new file mode 100644 index 0000000..921704f --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/address/state.tsv @@ -0,0 +1,52 @@ +Alabama AL +Alaska AK +Arizona AZ +Arkansas AR +California CA +Colorado CO +Connecticut CT +Delaware DE +Florida FL +Georgia GA +Hawaii HI +Idaho ID +Illinois IL +Indiana IN +Indiana IND +Iowa IA +Kansas KS +Kentucky KY +Louisiana LA +Maine ME +Maryland MD +Massachusetts MA +Michigan MI +Minnesota MN +Mississippi MS +Missouri MO +Montana MT +Nebraska NE +Nevada NV +New Hampshire NH +New Jersey NJ +New Mexico NM +New York NY +North Carolina NC +North Dakota ND +Ohio OH +Oklahoma OK +Oregon OR +Pennsylvania PA +Rhode Island RI +South Carolina SC +South Dakota SD +Tennessee TN +Tennessee TENN +Texas TX +Utah UT +Vermont VT +Virginia VA +Washington WA +West Virginia WV +Wisconsin WI +Wyoming WY \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/date/__init__.py b/fun_text_processing/text_normalization/en/data/date/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/date/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/date/day.tsv b/fun_text_processing/text_normalization/en/data/date/day.tsv new file mode 100644 index 0000000..ef8dd7a --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/date/day.tsv @@ -0,0 +1,31 @@ +one +two +three +four +five +six +seven +eight +nine +ten +eleven +twelve +thirteen +fourteen +fifteen +sixteen +seventeen +eighteen +nineteen +twenty +twenty one +twenty two +twenty three +twenty four +twenty five +twenty six +twenty seven +twenty eight +twenty nine +thirty +thirty one \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/date/month_abbr.tsv b/fun_text_processing/text_normalization/en/data/date/month_abbr.tsv new file mode 100644 index 0000000..e70e410 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/date/month_abbr.tsv @@ -0,0 +1,12 @@ +jan january +feb february +mar march +apr april +jun june +jul july +aug august +sep september +sept september +oct october +nov november +dec december diff --git a/fun_text_processing/text_normalization/en/data/date/month_name.tsv b/fun_text_processing/text_normalization/en/data/date/month_name.tsv new file mode 100644 index 0000000..1c05ac0 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/date/month_name.tsv @@ -0,0 +1,12 @@ +january +february +march +april +may +june +july +august +september +october +november +december diff --git a/fun_text_processing/text_normalization/en/data/date/month_number.tsv b/fun_text_processing/text_normalization/en/data/date/month_number.tsv new file mode 100644 index 0000000..f0cacd5 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/date/month_number.tsv @@ -0,0 +1,24 @@ +1 january +2 february +3 march +4 april +5 may +6 june +7 july +8 august +9 september +10 october +11 november +12 december +01 january +02 february +03 march +04 april +05 may +06 june +07 july +08 august +09 september +10 october +11 november +12 december \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/date/year_suffix.tsv b/fun_text_processing/text_normalization/en/data/date/year_suffix.tsv new file mode 100644 index 0000000..8c799dd --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/date/year_suffix.tsv @@ -0,0 +1,16 @@ +A. D AD +A.D AD +a. d AD +a.d AD +a. d. AD +a.d. AD +B. C BC +B.C BC +b. c BC +b.c BC +A. D. AD +A.D. AD +B. C. BC +B.C. BC +b. c. BC +b.c. BC diff --git a/fun_text_processing/text_normalization/en/data/electronic/__init__.py b/fun_text_processing/text_normalization/en/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/electronic/domain.tsv b/fun_text_processing/text_normalization/en/data/electronic/domain.tsv new file mode 100644 index 0000000..0e7042c --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/electronic/domain.tsv @@ -0,0 +1,12 @@ +.com dot com +.org dot org +.gov dot gov +.uk dot UK +.fr dot FR +.net dot net +.br dot BR +.in dot IN +.ru dot RU +.de dot DE +.it dot IT +.jpg dot jpeg \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/electronic/symbol.tsv b/fun_text_processing/text_normalization/en/data/electronic/symbol.tsv new file mode 100644 index 0000000..f633c77 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/electronic/symbol.tsv @@ -0,0 +1,21 @@ +. dot +- dash +_ underscore +! exclamation mark +# number sign +$ dollar sign +% percent sign +& ampersand +' quote +* asterisk ++ plus +/ slash += equal sign +? question mark +^ circumflex +` right single quote +{ left brace +| vertical bar +} right brace +~ tilde +, comma \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/measure/__init__.py b/fun_text_processing/text_normalization/en/data/measure/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/measure/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/measure/math_operation.tsv b/fun_text_processing/text_normalization/en/data/measure/math_operation.tsv new file mode 100644 index 0000000..21e72fd --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/measure/math_operation.tsv @@ -0,0 +1,8 @@ ++ plus +- minus +/ divided +÷ divided +: divided +× times +* times +· times \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/measure/unit.tsv b/fun_text_processing/text_normalization/en/data/measure/unit.tsv new file mode 100644 index 0000000..c033ab8 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/measure/unit.tsv @@ -0,0 +1,127 @@ +amu atomic mass unit +bar bar +° degree +º degree +°c degree Celsius +°C degree Celsius +ºc degree Celsius +ºC degree Celsius +℃ degree Celsius +cm2 square centimeter +cm² square centimeter +cm3 cubic centimeter +cm³ cubic centimeter +cm centimeter +cwt hundredweight +db decibel +dm3 cubic decimeter +dm³ cubic decimeter +dm decimeter +ds decisecond +°f degree Fahrenheit +°F degree Fahrenheit +℉ degree Fahrenheit +ft foot +ghz gigahertz +gw gigawatt +gwh gigawatt hour +hz hertz +" inch +kbps kilobit per second +kcal kilo calory +kgf kilogram force +kg kilogram +khz kilohertz +km2 square kilometer +km² square kilometer +km3 cubic kilometer +km³ cubic kilometer +km kilometer +kpa kilopascal +kwh kilowatt hour +kw kilowatt +kW kilowatt +lb pound +lbs pound +m2 square meter +m² square meter +m3 cubic meter +m³ cubic meter +mbps megabit per second +mg milligram +mhz megahertz +mi2 square mile +mi² square mile +mi3 cubic mile +mi³ cubic mile +cu mi cubic mile +mi mile +min minute +ml milliliter +mm2 square millimeter +mm² square millimeter +mol mole +mpa megapascal +mph mile per hour +ng nanogram +nm nanometer +ns nanosecond +oz ounce +pa pascal +% percent +rad radian +rpm revolution per minute +sq ft square foot +sq mi square mile +sv sievert +tb terabyte +tj terajoule +tl teraliter +v volt +yd yard +μg microgram +μm micrometer +μs microsecond +ω ohm +atm ATM +au AU +bq BQ +cc CC +cd CD +da DA +eb EB +ev EV +f F +gb GB +g G +gl GL +gpa GPA +gy GY +ha HA +h H +hl HL +hp GP +hs HS +kb KB +kl KL +kn KN +kt KT +kv KV +lm LM +ma MA +mA MA +mb MB +mc MC +mf MF +m M +mm MM +ms MS +mv MV +mw MW +pb PB +pg PG +ps PS +s S +tb TB +tb YB +zb ZB \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/measure/unit_alternatives.tsv b/fun_text_processing/text_normalization/en/data/measure/unit_alternatives.tsv new file mode 100644 index 0000000..77e4057 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/measure/unit_alternatives.tsv @@ -0,0 +1,43 @@ +atm atmosphere +bq becquerel +cd candela +da dalton +eb exabyte +f degree Fahrenheit +gb gigabyte +g gram +gl gigaliter +ha hectare +h hour +hl hectoliter +hp horsepower +hp horsepower +kb kilobit +kb kilobyte +ma megaampere +mA megaampere +ma milliampere +mA milliampere +mb megabyte +mc megacoulomb +mf megafarad +m meter +m minute +mm millimeter +mm millimeter +mm millimeter +ms megasecond +ms mega siemens +ms millisecond +mv millivolt +mV millivolt +mw megawatt +mW megawatt +pb petabyte +pg petagram +ps petasecond +s second +tb terabyte +tb terabyte +yb yottabyte +zb zettabyte diff --git a/fun_text_processing/text_normalization/en/data/money/__init__.py b/fun_text_processing/text_normalization/en/data/money/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/money/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/money/currency_major.tsv b/fun_text_processing/text_normalization/en/data/money/currency_major.tsv new file mode 100644 index 0000000..5201efd --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/money/currency_major.tsv @@ -0,0 +1,39 @@ +$ dollar +$ us dollar +US$ us dollar +฿ Thai Baht +£ pound +€ euro +₩ won +nzd new zealand dollar +rs rupee +chf swiss franc +dkk danish kroner +fim finnish markka +aed arab emirates dirham +¥ yen +czk czech koruna +mro mauritanian ouguiya +pkr pakistani rupee +crc costa rican colon +hk$ hong kong dollar +npr nepalese rupee +awg aruban florin +nok norwegian kroner +tzs tanzanian shilling +sek swedish kronor +cyp cypriot pound +r real +sar saudi riyal +cve cape verde escudo +rsd serbian dinar +dm german mark +shp saint helena pounds +php philippine peso +cad canadian dollar +ssp south sudanese pound +scr seychelles rupee +mvr maldivian rufiyaa +DH dirham +Dh dirham +Dhs. dirham diff --git a/fun_text_processing/text_normalization/en/data/money/currency_minor_plural.tsv b/fun_text_processing/text_normalization/en/data/money/currency_minor_plural.tsv new file mode 100644 index 0000000..a2f67b3 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/money/currency_minor_plural.tsv @@ -0,0 +1,4 @@ +$ cents +US$ cents +€ cents +£ pence \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/money/currency_minor_singular.tsv b/fun_text_processing/text_normalization/en/data/money/currency_minor_singular.tsv new file mode 100644 index 0000000..fe629d8 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/money/currency_minor_singular.tsv @@ -0,0 +1,3 @@ +$ cent +€ cent +£ penny \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/money/per_unit.tsv b/fun_text_processing/text_normalization/en/data/money/per_unit.tsv new file mode 100644 index 0000000..6548066 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/money/per_unit.tsv @@ -0,0 +1,2 @@ +/ea each +/dozen \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/number/__init__.py b/fun_text_processing/text_normalization/en/data/number/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/number/cardinal_number_name.far b/fun_text_processing/text_normalization/en/data/number/cardinal_number_name.far new file mode 100644 index 0000000..2ec6825 Binary files /dev/null and b/fun_text_processing/text_normalization/en/data/number/cardinal_number_name.far differ diff --git a/fun_text_processing/text_normalization/en/data/number/digit.tsv b/fun_text_processing/text_normalization/en/data/number/digit.tsv new file mode 100644 index 0000000..fa32979 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/digit.tsv @@ -0,0 +1,9 @@ +one 1 +two 2 +three 3 +four 4 +five 5 +six 6 +seven 7 +eight 8 +nine 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/number/fraction.tsv b/fun_text_processing/text_normalization/en/data/number/fraction.tsv new file mode 100644 index 0000000..0085ad5 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/fraction.tsv @@ -0,0 +1,18 @@ +¼ 1/4 +½ 1/2 +¾ 3/4 +⅐ 1/7 +⅑ 1/9 +⅒ 1/10 +⅓ 1/3 +⅔ 2/3 +⅕ 1/5 +⅖ 2/5 +⅗ 3/5 +⅘ 4/5 +⅙ 1/6 +⅚ 5/6 +⅛ 1/8 +⅜ 3/8 +⅝ 5/8 +⅞ 7/8 diff --git a/fun_text_processing/text_normalization/en/data/number/hundred.tsv b/fun_text_processing/text_normalization/en/data/number/hundred.tsv new file mode 100644 index 0000000..10e2b96 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/hundred.tsv @@ -0,0 +1 @@ +hundred \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/number/quantity_abbr.tsv b/fun_text_processing/text_normalization/en/data/number/quantity_abbr.tsv new file mode 100644 index 0000000..7dba4f0 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/quantity_abbr.tsv @@ -0,0 +1,10 @@ +M million +MLN million +m million +mln million +B billion +b billion +BN billion +bn billion +K thousand +k thousand \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/number/teen.tsv b/fun_text_processing/text_normalization/en/data/number/teen.tsv new file mode 100644 index 0000000..8e60fa1 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/teen.tsv @@ -0,0 +1,10 @@ +ten 10 +eleven 11 +twelve 12 +thirteen 13 +fourteen 14 +fifteen 15 +sixteen 16 +seventeen 17 +eighteen 18 +nineteen 19 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/number/thousand.tsv b/fun_text_processing/text_normalization/en/data/number/thousand.tsv new file mode 100644 index 0000000..bf30542 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/thousand.tsv @@ -0,0 +1,22 @@ +thousand +million +billion +trillion +quadrillion +quintillion +sextillion +septillion +octillion +nonillion +decillion +undecillion +duodecillion +tredecillion +quattuordecillion +quindecillion +sexdecillion +septendecillion +octodecillion +novemdecillion +vigintillion +centillion \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/number/ty.tsv b/fun_text_processing/text_normalization/en/data/number/ty.tsv new file mode 100644 index 0000000..65f9839 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/ty.tsv @@ -0,0 +1,8 @@ +twenty 2 +thirty 3 +forty 4 +fifty 5 +sixty 6 +seventy 7 +eighty 8 +ninety 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/number/zero.tsv b/fun_text_processing/text_normalization/en/data/number/zero.tsv new file mode 100644 index 0000000..a1b116c --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/number/zero.tsv @@ -0,0 +1 @@ +zero 0 diff --git a/fun_text_processing/text_normalization/en/data/ordinal/__init__.py b/fun_text_processing/text_normalization/en/data/ordinal/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/ordinal/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/ordinal/digit.tsv b/fun_text_processing/text_normalization/en/data/ordinal/digit.tsv new file mode 100644 index 0000000..4b7fc24 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/ordinal/digit.tsv @@ -0,0 +1,9 @@ +first one +second two +third three +fourth four +fifth five +sixth sixth +seventh seven +eighth eight +ninth nine \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/ordinal/teen.tsv b/fun_text_processing/text_normalization/en/data/ordinal/teen.tsv new file mode 100644 index 0000000..496fefc --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/ordinal/teen.tsv @@ -0,0 +1 @@ +twelfth twelve \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/roman/README.md b/fun_text_processing/text_normalization/en/data/roman/README.md new file mode 100644 index 0000000..398e197 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/roman/README.md @@ -0,0 +1,20 @@ +`female.tsv` - List of common female names. Copyright (c) January 1991 by Mark Kantrowitz, 4987 names, Version 1.3 (29-MAR-94) +Source: [https://www.cs.cmu.edu/Groups/AI/areas/nlp/corpora/names/female.txt](https://www.cs.cmu.edu/Groups/AI/areas/nlp/corpora/names/female.txt) + +`male.tsv` - List of common male names. Copyright (c) January 1991 by Mark Kantrowitz, 2940 names, Version 1.3 (29-MAR-94) +Source: [https://www.cs.cmu.edu/Groups/AI/areas/nlp/corpora/names/male.txt](https://www.cs.cmu.edu/Groups/AI/areas/nlp/corpora/names/male.txt) + +[Corpora Readme.txt](https://www.cs.cmu.edu/Groups/AI/areas/nlp/corpora/names/readme.txt): + +You may use the lists of names for any purpose, so long as credit is given +in any published work. You may also redistribute the list if you +provide the recipients with a copy of this README file. The lists are +not in the public domain (I retain the copyright on the lists) but are +freely redistributable. + +If you have any additions to the lists of names, I would appreciate +receiving them. + +My email address is mkant+@cs.cmu.edu. + +Mark Kantrowitz \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/roman/__init__.py b/fun_text_processing/text_normalization/en/data/roman/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/roman/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/roman/female.tsv b/fun_text_processing/text_normalization/en/data/roman/female.tsv new file mode 100644 index 0000000..4e248ce --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/roman/female.tsv @@ -0,0 +1,4998 @@ +Abagael +Abagail +Abbe +Abbey +Abbi +Abbie +Abby +Abigael +Abigail +Abigale +Abra +Acacia +Ada +Adah +Adaline +Adara +Addie +Addis +Adel +Adela +Adelaide +Adele +Adelice +Adelina +Adelind +Adeline +Adella +Adelle +Adena +Adey +Adi +Adiana +Adina +Adora +Adore +Adoree +Adorne +Adrea +Adria +Adriaens +Adrian +Adriana +Adriane +Adrianna +Adrianne +Adrien +Adriena +Adrienne +Aeriel +Aeriela +Aeriell +Ag +Agace +Agata +Agatha +Agathe +Aggi +Aggie +Aggy +Agna +Agnella +Agnes +Agnese +Agnesse +Agneta +Agnola +Agretha +Aida +Aidan +Aigneis +Aila +Aile +Ailee +Aileen +Ailene +Ailey +Aili +Ailina +Ailyn +Aime +Aimee +Aimil +Aina +Aindrea +Ainslee +Ainsley +Ainslie +Ajay +Alaine +Alameda +Alana +Alanah +Alane +Alanna +Alayne +Alberta +Albertina +Albertine +Albina +Alecia +Aleda +Aleece +Aleecia +Aleen +Alejandra +Alejandrina +Alena +Alene +Alessandra +Aleta +Alethea +Alex +Alexa +Alexandra +Alexandrina +Alexi +Alexia +Alexina +Alexine +Alexis +Alfie +Alfreda +Ali +Alia +Alica +Alice +Alicea +Alicia +Alida +Alidia +Alina +Aline +Alis +Alisa +Alisha +Alison +Alissa +Alisun +Alix +Aliza +Alla +Alleen +Allegra +Allene +Alli +Allianora +Allie +Allina +Allis +Allison +Allissa +Allsun +Ally +Allyce +Allyn +Allys +Allyson +Alma +Almeda +Almeria +Almeta +Almira +Almire +Aloise +Aloisia +Aloysia +Alpa +Alta +Althea +Alvera +Alvina +Alvinia +Alvira +Alyce +Alyda +Alys +Alysa +Alyse +Alysia +Alyson +Alyss +Alyssa +Amabel +Amabelle +Amalea +Amalee +Amaleta +Amalia +Amalie +Amalita +Amalle +Amanda +Amandi +Amandie +Amandy +Amara +Amargo +Amata +Amber +Amberly +Ambrosia +Ambur +Ame +Amelia +Amelie +Amelina +Ameline +Amelita +Ami +Amie +Amity +Ammamaria +Amy +Ana +Anabel +Anabella +Anabelle +Anais +Analiese +Analise +Anallese +Anallise +Anastasia +Anastasie +Anastassia +Anatola +Andee +Andi +Andie +Andra +Andrea +Andreana +Andree +Andrei +Andria +Andriana +Andriette +Andromache +Andromeda +Andy +Anestassia +Anet +Anett +Anetta +Anette +Ange +Angel +Angela +Angele +Angelia +Angelica +Angelika +Angelina +Angeline +Angelique +Angelita +Angelle +Angie +Angil +Angy +Ania +Anica +Anissa +Anita +Anitra +Anja +Anjanette +Anjela +Ann +Ann-Mari +Ann-Marie +Anna +Anna-Diana +Anna-Diane +Anna-Maria +Annabal +Annabel +Annabela +Annabell +Annabella +Annabelle +Annadiana +Annadiane +Annalee +Annalena +Annaliese +Annalisa +Annalise +Annalyse +Annamari +Annamaria +Annamarie +Anne +Anne-Corinne +Anne-Mar +Anne-Marie +Annecorinne +Anneliese +Annelise +Annemarie +Annetta +Annette +Anni +Annice +Annie +Annissa +Annmaria +Annmarie +Annnora +Annora +Anny +Anselma +Ansley +Anstice +Anthe +Anthea +Anthia +Antoinette +Antonella +Antonetta +Antonia +Antonie +Antonietta +Antonina +Anya +Aphrodite +Appolonia +Aprilette +Ara +Arabel +Arabela +Arabele +Arabella +Arabelle +Arda +Ardath +Ardeen +Ardelia +Ardelis +Ardella +Ardelle +Arden +Ardene +Ardenia +Ardine +Ardis +Ardith +Ardra +Ardyce +Ardys +Ardyth +Aretha +Ariadne +Ariana +Arianne +Aridatha +Ariel +Ariela +Ariella +Arielle +Arlana +Arlee +Arleen +Arlen +Arlena +Arlene +Arleta +Arlette +Arleyne +Arlie +Arliene +Arlina +Arlinda +Arline +Arly +Arlyn +Arlyne +Aryn +Ashely +Ashlee +Ashleigh +Ashlen +Ashley +Ashli +Ashlie +Ashly +Asia +Astra +Astrid +Astrix +Atalanta +Athena +Athene +Atlanta +Atlante +Auberta +Aubine +Aubree +Aubrette +Aubrey +Aubrie +Aubry +Audi +Audie +Audra +Audre +Audrey +Audrie +Audry +Audrye +Audy +Augusta +Auguste +Augustina +Augustine +Aura +Aurea +Aurel +Aurelea +Aurelia +Aurelie +Auria +Aurie +Aurilia +Aurlie +Auroora +Aurora +Aurore +Austin +Austina +Austine +Ava +Aveline +Averil +Averyl +Avie +Avis +Aviva +Avivah +Avril +Avrit +Ayn +Bab +Babara +Babette +Babita +Babs +Bambi +Bambie +Bamby +Barb +Barbabra +Barbara +Barbara-Anne +Barbaraanne +Barbe +Barbee +Barbette +Barbey +Barbi +Barbie +Barbra +Barby +Bari +Barrie +Barry +Basia +Bathsheba +Batsheva +Bea +Beatrice +Beatrisa +Beatrix +Beatriz +Beau +Bebe +Becca +Becka +Becki +Beckie +Becky +Bee +Beilul +Beitris +Bekki +Bel +Belia +Belicia +Belinda +Belita +Bell +Bella +Bellamy +Bellanca +Belle +Bellina +Belva +Belvia +Bendite +Benedetta +Benedicta +Benedikta +Benetta +Benita +Benni +Bennie +Benny +Benoite +Berenice +Beret +Berget +Berna +Bernadene +Bernadette +Bernadina +Bernadine +Bernardina +Bernardine +Bernelle +Bernete +Bernetta +Bernette +Berni +Bernice +Bernie +Bernita +Berny +Berri +Berrie +Berry +Bert +Berta +Berte +Bertha +Berthe +Berti +Bertie +Bertina +Bertine +Berty +Beryl +Beryle +Bess +Bessie +Bessy +Beth +Bethanne +Bethany +Bethena +Bethina +Betsey +Betsy +Betta +Bette +Bette-Ann +Betteann +Betteanne +Betti +Bettie +Bettina +Bettine +Betty +Bettye +Beulah +Bev +Beverie +Beverlee +Beverlie +Beverly +Bevvy +Bianca +Bianka +Biddy +Bidget +Bill +Billi +Billie +Billy +Binni +Binnie +Binny +Bird +Birdie +Birgit +Birgitta +Blair +Blaire +Blake +Blakelee +Blakeley +Blanca +Blanch +Blancha +Blanche +Blinni +Blinnie +Blinny +Bliss +Blisse +Blithe +Blondell +Blondelle +Blondie +Blondy +Blythe +Bo +Bobbette +Bobbi +Bobbie +Bobby +Bobette +Bobina +Bobine +Bobinette +Bonita +Bonnee +Bonni +Bonnie +Bonny +Brana +Brandais +Brande +Brandea +Brandi +Brandice +Brandie +Brandise +Brandy +Brea +Breanne +Brear +Bree +Breena +Bren +Brena +Brenda +Brenn +Brenna +Brett +Bria +Briana +Brianna +Brianne +Bride +Bridget +Bridgett +Bridgette +Bridie +Brier +Brietta +Brigid +Brigida +Brigit +Brigitta +Brigitte +Brina +Briney +Briny +Brit +Brita +Britaney +Britani +Briteny +Britney +Britni +Britt +Britta +Brittan +Brittany +Britte +Brittney +Brook +Brooke +Brooks +Brunella +Brunhilda +Brunhilde +Bryana +Bryn +Bryna +Brynn +Brynna +Brynne +Buffy +Bunni +Bunnie +Bunny +Burta +Cabrina +Cacilia +Cacilie +Caitlin +Caitrin +Cal +Calida +Calla +Calley +Calli +Callida +Callie +Cally +Calypso +Cam +Camala +Camel +Camella +Camellia +Cameo +Cami +Camila +Camile +Camilla +Camille +Cammi +Cammie +Cammy +Canada +Candace +Candi +Candice +Candida +Candide +Candie +Candis +Candra +Candy +Cappella +Caprice +Cara +Caralie +Caren +Carena +Caresa +Caressa +Caresse +Carey +Cari +Caria +Carie +Caril +Carilyn +Carin +Carina +Carine +Cariotta +Carissa +Carita +Caritta +Carla +Carlee +Carleen +Carlen +Carlena +Carlene +Carley +Carli +Carlie +Carlin +Carlina +Carline +Carlisle +Carlita +Carlota +Carlotta +Carly +Carlye +Carlyn +Carlynn +Carlynne +Carma +Carmel +Carmela +Carmelia +Carmelina +Carmelita +Carmella +Carmelle +Carmen +Carmina +Carmine +Carmita +Carmon +Caro +Carol +Carol-Jean +Carola +Carolan +Carolann +Carole +Carolee +Caroleen +Carolie +Carolin +Carolina +Caroline +Caroljean +Carolyn +Carolyne +Carolynn +Caron +Carree +Carri +Carrie +Carrissa +Carrol +Carroll +Carry +Cary +Caryl +Caryn +Casandra +Casey +Casi +Casia +Casie +Cass +Cassandra +Cassandre +Cassandry +Cassaundra +Cassey +Cassi +Cassie +Cassondra +Cassy +Cat +Catarina +Cate +Caterina +Catha +Catharina +Catharine +Cathe +Cathee +Catherin +Catherina +Catherine +Cathi +Cathie +Cathleen +Cathlene +Cathrin +Cathrine +Cathryn +Cathy +Cathyleen +Cati +Catie +Catina +Catlaina +Catlee +Catlin +Catrina +Catriona +Caty +Cayla +Cecelia +Cecil +Cecile +Ceciley +Cecilia +Cecilla +Cecily +Ceil +Cele +Celene +Celesta +Celeste +Celestia +Celestina +Celestine +Celestyn +Celestyna +Celia +Celie +Celina +Celinda +Celine +Celinka +Celisse +Celle +Cesya +Chad +Chanda +Chandal +Chandra +Channa +Chantal +Chantalle +Charil +Charin +Charis +Charissa +Charisse +Charita +Charity +Charla +Charlean +Charleen +Charlena +Charlene +Charline +Charlot +Charlott +Charlotta +Charlotte +Charmain +Charmaine +Charmane +Charmian +Charmine +Charmion +Charo +Charyl +Chastity +Chelsae +Chelsea +Chelsey +Chelsie +Chelsy +Cher +Chere +Cherey +Cheri +Cherianne +Cherice +Cherida +Cherie +Cherilyn +Cherilynn +Cherin +Cherise +Cherish +Cherlyn +Cherri +Cherrita +Cherry +Chery +Cherye +Cheryl +Cheslie +Chiarra +Chickie +Chicky +Chiquita +Chloe +Chloette +Chloris +Chris +Chriss +Chrissa +Chrissie +Chrissy +Christa +Christabel +Christabella +Christabelle +Christal +Christalle +Christan +Christean +Christel +Christen +Christi +Christian +Christiana +Christiane +Christie +Christin +Christina +Christine +Christy +Christyna +Chrysa +Chrysler +Chrystal +Chryste +Chrystel +Ciara +Cicely +Cicily +Ciel +Cilka +Cinda +Cindee +Cindelyn +Cinderella +Cindi +Cindie +Cindra +Cindy +Cinnamon +Cissie +Cissy +Clair +Claire +Clara +Clarabelle +Clare +Claresta +Clareta +Claretta +Clarette +Clarey +Clari +Claribel +Clarice +Clarie +Clarinda +Clarine +Clarisa +Clarissa +Clarisse +Clarita +Clary +Claude +Claudelle +Claudetta +Claudette +Claudia +Claudie +Claudina +Claudine +Clea +Clem +Clemence +Clementia +Clementina +Clementine +Clemmie +Clemmy +Cleo +Cleopatra +Clerissa +Cleva +Clio +Clo +Cloe +Cloris +Clotilda +Clovis +Codee +Codi +Codie +Cody +Coleen +Colene +Coletta +Colette +Colleen +Collete +Collette +Collie +Colline +Colly +Con +Concettina +Conchita +Concordia +Conney +Conni +Connie +Conny +Consolata +Constance +Constancia +Constancy +Constanta +Constantia +Constantina +Constantine +Consuela +Consuelo +Cookie +Cora +Corabel +Corabella +Corabelle +Coral +Coralie +Coraline +Coralyn +Cordelia +Cordelie +Cordey +Cordie +Cordula +Cordy +Coreen +Corella +Corena +Corenda +Corene +Coretta +Corette +Corey +Cori +Corie +Corilla +Corina +Corine +Corinna +Corinne +Coriss +Corissa +Corliss +Corly +Cornela +Cornelia +Cornelle +Cornie +Corny +Correna +Correy +Corri +Corrianne +Corrie +Corrina +Corrine +Corrinne +Corry +Cortney +Cory +Cosetta +Cosette +Courtenay +Courtney +Cresa +Cris +Crissie +Crissy +Crista +Cristabel +Cristal +Cristen +Cristi +Cristie +Cristin +Cristina +Cristine +Cristionna +Cristy +Crysta +Crystal +Crystie +Cyb +Cybal +Cybel +Cybelle +Cybil +Cybill +Cyndi +Cyndy +Cynthea +Cynthia +Cynthie +Cynthy +Dacey +Dacia +Dacie +Dacy +Dael +Daffi +Daffie +Daffy +Dafna +Dagmar +Dahlia +Daile +Daisey +Daisi +Daisie +Daisy +Dale +Dalenna +Dalia +Dalila +Dallas +Daloris +Damara +Damaris +Damita +Dana +Danell +Danella +Danelle +Danette +Dani +Dania +Danica +Danice +Daniel +Daniela +Daniele +Daniella +Danielle +Danika +Danila +Danit +Danita +Danna +Danni +Dannie +Danny +Dannye +Danya +Danyelle +Danyette +Daphene +Daphna +Daphne +Dara +Darb +Darbie +Darby +Darcee +Darcey +Darci +Darcie +Darcy +Darda +Dareen +Darell +Darelle +Dari +Daria +Darice +Darla +Darleen +Darlene +Darline +Darryl +Darsey +Darsie +Darya +Daryl +Daryn +Dasha +Dasi +Dasie +Dasya +Datha +Daune +Daveen +Daveta +Davida +Davina +Davine +Davita +Dawn +Dawna +Dayle +Dayna +Dea +Deana +Deane +Deanna +Deanne +Deb +Debbi +Debbie +Debbra +Debby +Debee +Debera +Debi +Debor +Debora +Deborah +Debra +Dede +Dedie +Dedra +Dee +Dee Dee +Deeann +Deeanne +Deedee +Deena +Deerdre +Dehlia +Deidre +Deina +Deirdre +Del +Dela +Delaney +Delcina +Delcine +Delia +Delila +Delilah +Delinda +Dell +Della +Delly +Delora +Delores +Deloria +Deloris +Delphina +Delphine +Delphinia +Demeter +Demetra +Demetria +Demetris +Dena +Deni +Denice +Denise +Denna +Denni +Dennie +Denny +Deny +Denys +Denyse +Deonne +Desaree +Desdemona +Desirae +Desiree +Desiri +Deva +Devan +Devi +Devin +Devina +Devinne +Devon +Devondra +Devonna +Devonne +Devora +Dew +Di +Diahann +Diamond +Dian +Diana +Diandra +Diane +Diane-Marie +Dianemarie +Diann +Dianna +Dianne +Diannne +Didi +Dido +Diena +Dierdre +Dina +Dinah +Dinnie +Dinny +Dion +Dione +Dionis +Dionne +Dita +Dix +Dixie +Dode +Dodi +Dodie +Dody +Doe +Doll +Dolley +Dolli +Dollie +Dolly +Dolora +Dolores +Dolorita +Doloritas +Dominica +Dominique +Dona +Donella +Donelle +Donetta +Donia +Donica +Donielle +Donna +Donnajean +Donnamarie +Donni +Donnie +Donny +Dora +Doralia +Doralin +Doralyn +Doralynn +Doralynne +Dorcas +Dore +Doreen +Dorelia +Dorella +Dorelle +Dorena +Dorene +Doretta +Dorette +Dorey +Dori +Doria +Dorian +Dorice +Dorie +Dorine +Doris +Dorisa +Dorise +Dorit +Dorita +Doro +Dorolice +Dorolisa +Dorotea +Doroteya +Dorothea +Dorothee +Dorothy +Dorree +Dorri +Dorrie +Dorris +Dorry +Dorthea +Dorthy +Dory +Dosi +Dot +Doti +Dotti +Dottie +Dotty +Dove +Drea +Drew +Dulce +Dulcea +Dulci +Dulcia +Dulciana +Dulcie +Dulcine +Dulcinea +Dulcy +Dulsea +Dusty +Dyan +Dyana +Dyane +Dyann +Dyanna +Dyanne +Dyna +Dynah +E'Lane +Eada +Eadie +Eadith +Ealasaid +Eartha +Easter +Eba +Ebba +Ebonee +Ebony +Eda +Eddi +Eddie +Eddy +Ede +Edee +Edeline +Eden +Edi +Edie +Edin +Edita +Edith +Editha +Edithe +Ediva +Edna +Edwina +Edy +Edyth +Edythe +Effie +Eileen +Eilis +Eimile +Eirena +Ekaterina +Elaina +Elaine +Elana +Elane +Elayne +Elberta +Elbertina +Elbertine +Eleanor +Eleanora +Eleanore +Electra +Elena +Elene +Eleni +Elenore +Eleonora +Eleonore +Elfie +Elfreda +Elfrida +Elfrieda +Elga +Elianora +Elianore +Elicia +Elie +Elinor +Elinore +Elisa +Elisabet +Elisabeth +Elisabetta +Elise +Elisha +Elissa +Elita +Eliza +Elizabet +Elizabeth +Elka +Elke +Ella +Elladine +Elle +Ellen +Ellene +Ellette +Elli +Ellie +Ellissa +Elly +Ellyn +Ellynn +Elmira +Elna +Elnora +Elnore +Eloisa +Eloise +Elonore +Elora +Elsa +Elsbeth +Else +Elsey +Elsi +Elsie +Elsinore +Elspeth +Elsy +Elva +Elvera +Elvina +Elvira +Elwina +Elwira +Elyn +Elyse +Elysee +Elysha +Elysia +Elyssa +Em +Ema +Emalee +Emalia +Emanuela +Emelda +Emelia +Emelina +Emeline +Emelita +Emelyne +Emera +Emilee +Emili +Emilia +Emilie +Emiline +Emily +Emlyn +Emlynn +Emlynne +Emma +Emmalee +Emmaline +Emmalyn +Emmalynn +Emmalynne +Emmeline +Emmey +Emmi +Emmie +Emmy +Emmye +Emogene +Emyle +Emylee +Endora +Engracia +Enid +Enrica +Enrichetta +Enrika +Enriqueta +Enya +Eolanda +Eolande +Eran +Erda +Erena +Erica +Ericha +Ericka +Erika +Erin +Erina +Erinn +Erinna +Erma +Ermengarde +Ermentrude +Ermina +Erminia +Erminie +Erna +Ernaline +Ernesta +Ernestine +Ertha +Eryn +Esma +Esmaria +Esme +Esmeralda +Esmerelda +Essa +Essie +Essy +Esta +Estel +Estele +Estell +Estella +Estelle +Ester +Esther +Estrella +Estrellita +Ethel +Ethelda +Ethelin +Ethelind +Etheline +Ethelyn +Ethyl +Etta +Etti +Ettie +Etty +Eudora +Eugenia +Eugenie +Eugine +Eula +Eulalie +Eunice +Euphemia +Eustacia +Eva +Evaleen +Evangelia +Evangelin +Evangelina +Evangeline +Evania +Evanne +Eve +Eveleen +Evelina +Eveline +Evelyn +Evette +Evey +Evie +Evita +Evonne +Evvie +Evvy +Evy +Eyde +Eydie +Fabrianne +Fabrice +Fae +Faina +Faith +Fallon +Fan +Fanchette +Fanchon +Fancie +Fancy +Fanechka +Fania +Fanni +Fannie +Fanny +Fanya +Fara +Farah +Farand +Farica +Farra +Farrah +Farrand +Fatima +Faun +Faunie +Faustina +Faustine +Fawn +Fawna +Fawne +Fawnia +Fay +Faydra +Faye +Fayette +Fayina +Fayre +Fayth +Faythe +Federica +Fedora +Felecia +Felicdad +Felice +Felicia +Felicity +Felicle +Felipa +Felisha +Felita +Feliza +Fenelia +Feodora +Ferdinanda +Ferdinande +Fern +Fernanda +Fernande +Fernandina +Ferne +Fey +Fiann +Fianna +Fidela +Fidelia +Fidelity +Fifi +Fifine +Filia +Filide +Filippa +Fina +Fiona +Fionna +Fionnula +Fiorenze +Fleur +Fleurette +Flo +Flor +Flora +Florance +Flore +Florella +Florence +Florencia +Florentia +Florenza +Florette +Flori +Floria +Florice +Florida +Florie +Florina +Florinda +Floris +Florri +Florrie +Florry +Flory +Flossi +Flossie +Flossy +Flower +Fortuna +Fortune +Fran +France +Francene +Frances +Francesca +Francesmary +Francine +Francis +Francisca +Franciska +Francoise +Francyne +Frank +Frankie +Franky +Franni +Frannie +Franny +Frayda +Fred +Freda +Freddi +Freddie +Freddy +Fredelia +Frederica +Fredericka +Fredi +Fredia +Fredra +Fredrika +Freida +Frieda +Friederike +Fulvia +Gabbey +Gabbi +Gabbie +Gabey +Gabi +Gabie +Gabriel +Gabriela +Gabriell +Gabriella +Gabrielle +Gabriellia +Gabrila +Gaby +Gae +Gael +Gail +Gale +Gale +Galina +Garland +Garnet +Garnette +Gates +Gavra +Gavrielle +Gay +Gayla +Gayle +Gayleen +Gaylene +Gaynor +Gelya +Gen +Gena +Gene +Geneva +Genevieve +Genevra +Genia +Genna +Genni +Gennie +Gennifer +Genny +Genovera +Genvieve +George +Georgeanna +Georgeanne +Georgena +Georgeta +Georgetta +Georgette +Georgia +Georgiamay +Georgiana +Georgianna +Georgianne +Georgie +Georgina +Georgine +Gera +Geralda +Geraldina +Geraldine +Gerda +Gerhardine +Geri +Gerianna +Gerianne +Gerladina +Germain +Germaine +Germana +Gerri +Gerrie +Gerrilee +Gerry +Gert +Gerta +Gerti +Gertie +Gertrud +Gertruda +Gertrude +Gertrudis +Gerty +Giacinta +Giana +Gianina +Gianna +Gigi +Gilberta +Gilberte +Gilbertina +Gilbertine +Gilda +Gill +Gillan +Gilli +Gillian +Gillie +Gilligan +Gilly +Gina +Ginelle +Ginevra +Ginger +Ginni +Ginnie +Ginnifer +Ginny +Giorgia +Giovanna +Gipsy +Giralda +Gisela +Gisele +Gisella +Giselle +Gizela +Glad +Gladi +Gladis +Gladys +Gleda +Glen +Glenda +Glenine +Glenn +Glenna +Glennie +Glennis +Glori +Gloria +Gloriana +Gloriane +Glorianna +Glory +Glyn +Glynda +Glynis +Glynnis +Godiva +Golda +Goldarina +Goldi +Goldia +Goldie +Goldina +Goldy +Grace +Gracia +Gracie +Grata +Gratia +Gratiana +Gray +Grayce +Grazia +Gredel +Greer +Greta +Gretal +Gretchen +Grete +Gretel +Grethel +Gretna +Gretta +Grier +Griselda +Grissel +Guendolen +Guenevere +Guenna +Guglielma +Gui +Guillema +Guillemette +Guinevere +Guinna +Gunilla +Gunvor +Gus +Gusella +Gussi +Gussie +Gussy +Gusta +Gusti +Gustie +Gusty +Gwen +Gwendolen +Gwendolin +Gwendolyn +Gweneth +Gwenette +Gwenn +Gwenneth +Gwenni +Gwennie +Gwenny +Gwenora +Gwenore +Gwyn +Gwyneth +Gwynne +Gypsy +Hadria +Hailee +Haily +Haleigh +Halette +Haley +Hali +Halie +Halimeda +Halley +Halli +Hallie +Hally +Hana +Hanna +Hannah +Hanni +Hannibal +Hannie +Hannis +Hanny +Happy +Harlene +Harley +Harli +Harlie +Harmonia +Harmonie +Harmony +Harri +Harrie +Harriet +Harriett +Harrietta +Harriette +Harriot +Harriott +Hatti +Hattie +Hatty +Havivah +Hayley +Hazel +Heath +Heather +Heda +Hedda +Heddi +Heddie +Hedi +Hedvig +Hedwig +Hedy +Heida +Heide +Heidi +Heidie +Helaina +Helaine +Helen +Helen-Elizabeth +Helena +Helene +Helga +Helge +Helise +Hellene +Helli +Heloise +Helsa +Helyn +Hendrika +Henka +Henrie +Henrieta +Henrietta +Henriette +Henryetta +Hephzibah +Hermia +Hermina +Hermine +Herminia +Hermione +Herta +Hertha +Hester +Hesther +Hestia +Hetti +Hettie +Hetty +Hilarie +Hilary +Hilda +Hildagard +Hildagarde +Hilde +Hildegaard +Hildegarde +Hildy +Hillary +Hilliary +Hinda +Holley +Holli +Hollie +Holly +Holly-Anne +Hollyanne +Honey +Honor +Honoria +Hope +Horatia +Hortense +Hortensia +Hulda +Hyacinth +Hyacintha +Hyacinthe +Hyacinthia +Hyacinthie +Hynda +Ianthe +Ibbie +Ibby +Ida +Idalia +Idalina +Idaline +Idell +Idelle +Idette +Ike +Ikey +Ilana +Ileana +Ileane +Ilene +Ilise +Ilka +Illa +Ilona +Ilsa +Ilse +Ilysa +Ilyse +Ilyssa +Imelda +Imogen +Imogene +Imojean +Ina +Inci +Indira +Ines +Inesita +Inessa +Inez +Inga +Ingaberg +Ingaborg +Inge +Ingeberg +Ingeborg +Inger +Ingrid +Ingunna +Inna +Ioana +Iolande +Iolanthe +Iona +Iormina +Ira +Irena +Irene +Irina +Iris +Irita +Irma +Isa +Isabeau +Isabel +Isabelita +Isabella +Isabelle +Isador +Isadora +Isadore +Isahella +Iseabal +Isidora +Isis +Isobel +Issi +Issie +Issy +Ivett +Ivette +Ivie +Ivonne +Ivory +Ivy +Izabel +Izzi +Jacenta +Jacinda +Jacinta +Jacintha +Jacinthe +Jackelyn +Jacki +Jackie +Jacklin +Jacklyn +Jackquelin +Jackqueline +Jacky +Jaclin +Jaclyn +Jacquelin +Jacqueline +Jacquelyn +Jacquelynn +Jacquenetta +Jacquenette +Jacquetta +Jacquette +Jacqui +Jacquie +Jacynth +Jada +Jade +Jaime +Jaimie +Jaine +Jaleh +Jami +Jamie +Jamima +Jammie +Jan +Jana +Janaya +Janaye +Jandy +Jane +Janean +Janeczka +Janeen +Janel +Janela +Janella +Janelle +Janene +Janenna +Janessa +Janet +Janeta +Janetta +Janette +Janeva +Janey +Jania +Janice +Janie +Janifer +Janina +Janine +Janis +Janith +Janka +Janna +Jannel +Jannelle +Janot +Jany +Jaquelin +Jaquelyn +Jaquenetta +Jaquenette +Jaquith +Jasmin +Jasmina +Jasmine +Jayme +Jaymee +Jayne +Jaynell +Jazmin +Jean +Jeana +Jeane +Jeanelle +Jeanette +Jeanie +Jeanine +Jeanna +Jeanne +Jeannette +Jeannie +Jeannine +Jehanna +Jelene +Jemie +Jemima +Jemimah +Jemmie +Jemmy +Jen +Jena +Jenda +Jenelle +Jenette +Jeni +Jenica +Jeniece +Jenifer +Jeniffer +Jenilee +Jenine +Jenn +Jenna +Jennee +Jennette +Jenni +Jennica +Jennie +Jennifer +Jennilee +Jennine +Jenny +Jeraldine +Jeralee +Jere +Jeri +Jermaine +Jerrie +Jerrilee +Jerrilyn +Jerrine +Jerry +Jerrylee +Jess +Jessa +Jessalin +Jessalyn +Jessamine +Jessamyn +Jesse +Jesselyn +Jessi +Jessica +Jessie +Jessika +Jessy +Jewel +Jewell +Jewelle +Jill +Jillana +Jillane +Jillayne +Jilleen +Jillene +Jilli +Jillian +Jillie +Jilly +Jinny +Jo +Jo Ann +Jo-Ann +Jo-Anne +JoAnn +JoAnne +Joan +Joana +Joane +Joanie +Joann +Joanna +Joanne +Joannes +Jobey +Jobi +Jobie +Jobina +Joby +Jobye +Jobyna +Jocelin +Joceline +Jocelyn +Jocelyne +Jodee +Jodi +Jodie +Jody +Joela +Joelie +Joell +Joella +Joelle +Joellen +Joelly +Joellyn +Joelynn +Joete +Joey +Johanna +Johannah +Johnette +Johnna +Joice +Jojo +Jolee +Joleen +Jolene +Joletta +Joli +Jolie +Joline +Joly +Jolyn +Jolynn +Jonell +Joni +Jonie +Jonis +Jordain +Jordan +Jordana +Jordanna +Jorey +Jori +Jorie +Jorrie +Jorry +Joscelin +Josee +Josefa +Josefina +Joselyn +Josepha +Josephina +Josephine +Josey +Josi +Josie +Joslyn +Josselyn +Josy +Jourdan +Joy +Joya +Joyan +Joyann +Joyce +Joycelin +Joye +Joyous +Juana +Juanita +Jude +Judi +Judie +Judith +Juditha +Judy +Judye +Julee +Juli +Julia +Juliana +Juliane +Juliann +Julianna +Julianne +Julie +Julienne +Juliet +Julieta +Julietta +Juliette +Julina +Juline +Julissa +Julita +Junette +Junia +Junie +Junina +Justin +Justina +Justine +Jyoti +Kacey +Kacie +Kacy +Kai +Kaia +Kaila +Kaile +Kailey +Kaitlin +Kaitlyn +Kaitlynn +Kaja +Kakalina +Kala +Kaleena +Kali +Kalie +Kalila +Kalina +Kalinda +Kalindi +Kalli +Kally +Kameko +Kamila +Kamilah +Kamillah +Kandace +Kandy +Kania +Kanya +Kara +Kara-Lynn +Karalee +Karalynn +Kare +Karee +Karel +Karen +Karena +Kari +Karia +Karie +Karil +Karilynn +Karin +Karina +Karine +Kariotta +Karisa +Karissa +Karita +Karla +Karlee +Karleen +Karlen +Karlene +Karlie +Karlotta +Karlotte +Karly +Karlyn +Karmen +Karna +Karol +Karola +Karole +Karolina +Karoline +Karoly +Karon +Karrah +Karrie +Karry +Kary +Karyl +Karylin +Karyn +Kasey +Kass +Kassandra +Kassey +Kassi +Kassia +Kassie +Kaster +Kat +Kata +Katalin +Kate +Katee +Katerina +Katerine +Katey +Kath +Katha +Katharina +Katharine +Katharyn +Kathe +Katheleen +Katherina +Katherine +Katheryn +Kathi +Kathie +Kathleen +Kathlene +Kathlin +Kathrine +Kathryn +Kathryne +Kathy +Kathye +Kati +Katie +Katina +Katine +Katinka +Katleen +Katlin +Katrina +Katrine +Katrinka +Katti +Kattie +Katuscha +Katusha +Katy +Katya +Kay +Kaycee +Kaye +Kayla +Kayle +Kaylee +Kayley +Kaylil +Kaylyn +Kee +Keeley +Keelia +Keely +Kelcey +Kelci +Kelcie +Kelcy +Kelila +Kellen +Kelley +Kelli +Kellia +Kellie +Kellina +Kellsie +Kelly +Kellyann +Kelsey +Kelsi +Kelsy +Kendra +Kendre +Kenna +Keren +Keri +Keriann +Kerianne +Kerri +Kerrie +Kerrill +Kerrin +Kerry +Kerstin +Kesley +Keslie +Kessia +Kessiah +Ketti +Kettie +Ketty +Kevina +Kevyn +Ki +Kia +Kiah +Kial +Kiele +Kiersten +Kikelia +Kiley +Kim +Kimberlee +Kimberley +Kimberli +Kimberly +Kimberlyn +Kimbra +Kimmi +Kimmie +Kimmy +Kinna +Kip +Kipp +Kippie +Kippy +Kira +Kirbee +Kirbie +Kirby +Kiri +Kirsten +Kirsteni +Kirsti +Kirstie +Kirstin +Kirstyn +Kissee +Kissiah +Kissie +Kit +Kitti +Kittie +Kitty +Kizzee +Kizzie +Klara +Klarika +Klarrisa +Konstance +Konstanze +Koo +Kora +Koral +Koralle +Kordula +Kore +Korella +Koren +Koressa +Kori +Korie +Korney +Korrie +Korry +Kourtney +Kris +Krissie +Krissy +Krista +Kristal +Kristan +Kriste +Kristel +Kristen +Kristi +Kristien +Kristin +Kristina +Kristine +Kristy +Kristyn +Krysta +Krystal +Krystalle +Krystle +Krystyna +Kyla +Kyle +Kylen +Kylie +Kylila +Kylynn +Kym +Kynthia +Kyrstin +La +Lacee +Lacey +Lacie +Lacy +Ladonna +Laetitia +Laila +Laina +Lainey +Lamb +Lana +Lane +Lanette +Laney +Lani +Lanie +Lanita +Lanna +Lanni +Lanny +Lara +Laraine +Lari +Larina +Larine +Larisa +Larissa +Lark +Laryssa +Latashia +Latia +Latisha +Latrena +Latrina +Laura +Lauraine +Laural +Lauralee +Laure +Lauree +Laureen +Laurel +Laurella +Lauren +Laurena +Laurene +Lauretta +Laurette +Lauri +Laurianne +Laurice +Laurie +Lauryn +Lavena +Laverna +Laverne +Lavina +Lavinia +Lavinie +Layla +Layne +Layney +Lea +Leah +Leandra +Leann +Leanna +Leanne +Leanor +Leanora +Lebbie +Leda +Lee +LeeAnn +Leeann +Leeanne +Leela +Leelah +Leena +Leesa +Leese +Legra +Leia +Leiah +Leigh +Leigha +Leila +Leilah +Leisha +Lela +Lelah +Leland +Lelia +Lena +Lenee +Lenette +Lenka +Lenna +Lenora +Lenore +Leodora +Leoine +Leola +Leoline +Leona +Leonanie +Leone +Leonelle +Leonie +Leonora +Leonore +Leontine +Leontyne +Leora +Leorah +Leshia +Lesley +Lesli +Leslie +Lesly +Lesya +Leta +Lethia +Leticia +Letisha +Letitia +Letta +Letti +Lettie +Letty +Leyla +Lezlie +Lia +Lian +Liana +Liane +Lianna +Lianne +Lib +Libbey +Libbi +Libbie +Libby +Licha +Lida +Lidia +Lil +Lila +Lilah +Lilas +Lilia +Lilian +Liliane +Lilias +Lilith +Lilla +Lilli +Lillian +Lillis +Lilllie +Lilly +Lily +Lilyan +Lin +Lina +Lind +Linda +Lindi +Lindie +Lindsay +Lindsey +Lindsy +Lindy +Linea +Linell +Linet +Linette +Linn +Linnea +Linnell +Linnet +Linnie +Linzy +Liora +Liorah +Lira +Lisa +Lisabeth +Lisandra +Lisbeth +Lise +Lisetta +Lisette +Lisha +Lishe +Lissa +Lissi +Lissie +Lissy +Lita +Liuka +Livia +Liz +Liza +Lizabeth +Lizbeth +Lizette +Lizzie +Lizzy +Loella +Lois +Loise +Lola +Lolande +Loleta +Lolita +Lolly +Lona +Lonee +Loni +Lonna +Lonni +Lonnie +Lora +Lorain +Loraine +Loralee +Loralie +Loralyn +Loree +Loreen +Lorelei +Lorelle +Loren +Lorena +Lorene +Lorenza +Loretta +Lorettalorna +Lorette +Lori +Loria +Lorianna +Lorianne +Lorie +Lorilee +Lorilyn +Lorinda +Lorine +Lorita +Lorna +Lorne +Lorraine +Lorrayne +Lorri +Lorrie +Lorrin +Lorry +Lory +Lotta +Lotte +Lotti +Lottie +Lotty +Lou +Louella +Louisa +Louise +Louisette +Love +Luana +Luanna +Luce +Luci +Lucia +Luciana +Lucie +Lucienne +Lucila +Lucilia +Lucille +Lucina +Lucinda +Lucine +Lucita +Lucky +Lucretia +Lucy +Luella +Luelle +Luisa +Luise +Lula +Lulita +Lulu +Luna +Lura +Lurette +Lurleen +Lurlene +Lurline +Lusa +Lust +Lyda +Lydia +Lydie +Lyn +Lynda +Lynde +Lyndel +Lyndell +Lyndsay +Lyndsey +Lyndsie +Lyndy +Lynea +Lynelle +Lynett +Lynette +Lynn +Lynna +Lynne +Lynnea +Lynnell +Lynnelle +Lynnet +Lynnett +Lynnette +Lynsey +Lysandra +Lyssa +Mab +Mabel +Mabelle +Mable +Mada +Madalena +Madalyn +Maddalena +Maddi +Maddie +Maddy +Madel +Madelaine +Madeleine +Madelena +Madelene +Madelin +Madelina +Madeline +Madella +Madelle +Madelon +Madelyn +Madge +Madlen +Madlin +Madona +Madonna +Mady +Mae +Maegan +Mag +Magda +Magdaia +Magdalen +Magdalena +Magdalene +Maggee +Maggi +Maggie +Maggy +Magna +Mahala +Mahalia +Maia +Maible +Maiga +Mair +Maire +Mairead +Maisey +Maisie +Mala +Malanie +Malcah +Malena +Malia +Malina +Malinda +Malinde +Malissa +Malissia +Malka +Malkah +Mallissa +Mallorie +Mallory +Malorie +Malory +Malva +Malvina +Malynda +Mame +Mamie +Manda +Mandi +Mandie +Mandy +Manon +Manya +Mara +Marabel +Marcela +Marcelia +Marcella +Marcelle +Marcellina +Marcelline +Marchelle +Marci +Marcia +Marcie +Marcile +Marcille +Marcy +Mareah +Maren +Marena +Maressa +Marga +Margalit +Margalo +Margaret +Margareta +Margarete +Margaretha +Margarethe +Margaretta +Margarette +Margarita +Margaux +Marge +Margeaux +Margery +Marget +Margette +Margi +Margie +Margit +Marglerite +Margo +Margot +Margret +Marguerite +Margurite +Margy +Mari +Maria +Mariam +Marian +Mariana +Mariann +Marianna +Marianne +Maribel +Maribelle +Maribeth +Marice +Maridel +Marie +Marie-Ann +Marie-Jeanne +Marieann +Mariejeanne +Mariel +Mariele +Marielle +Mariellen +Marietta +Mariette +Marigold +Marijo +Marika +Marilee +Marilin +Marillin +Marilyn +Marin +Marina +Marinna +Marion +Mariquilla +Maris +Marisa +Mariska +Marissa +Marit +Marita +Maritsa +Mariya +Marj +Marja +Marje +Marji +Marjie +Marjorie +Marjory +Marjy +Marketa +Marla +Marlane +Marleah +Marlee +Marleen +Marlena +Marlene +Marley +Marlie +Marline +Marlo +Marlyn +Marna +Marne +Marney +Marni +Marnia +Marnie +Marquita +Marrilee +Marris +Marrissa +Marry +Marsha +Marsiella +Marta +Martelle +Martguerita +Martha +Marthe +Marthena +Marti +Martica +Martie +Martina +Martita +Marty +Martynne +Mary +Marya +Maryangelyn +Maryann +Maryanna +Maryanne +Marybelle +Marybeth +Maryellen +Maryjane +Maryjo +Maryl +Marylee +Marylin +Marylinda +Marylou +Marylynne +Maryrose +Marys +Marysa +Masha +Matelda +Mathilda +Mathilde +Matilda +Matilde +Matti +Mattie +Matty +Maud +Maude +Maudie +Maura +Maure +Maureen +Maureene +Maurene +Maurine +Maurise +Maurita +Mavis +Mavra +Max +Maxi +Maxie +Maxine +Maxy +Maya +Maybelle +Mayda +Maye +Mead +Meade +Meagan +Meaghan +Meara +Mechelle +Meg +Megan +Megen +Meggan +Meggi +Meggie +Meggy +Meghan +Meghann +Mehetabel +Mei +Meira +Mel +Mela +Melamie +Melania +Melanie +Melantha +Melany +Melba +Melesa +Melessa +Melicent +Melina +Melinda +Melinde +Melisa +Melisande +Melisandra +Melisenda +Melisent +Melissa +Melisse +Melita +Melitta +Mella +Melli +Mellicent +Mellie +Mellisa +Mellisent +Mellissa +Melloney +Melly +Melodee +Melodie +Melody +Melonie +Melony +Melosa +Melva +Mercedes +Merci +Mercie +Mercy +Meredith +Meredithe +Meridel +Meridith +Meriel +Merilee +Merilyn +Meris +Merissa +Merl +Merla +Merle +Merlina +Merline +Merna +Merola +Merralee +Merridie +Merrie +Merrielle +Merrile +Merrilee +Merrili +Merrill +Merrily +Merry +Mersey +Meryl +Meta +Mia +Micaela +Michaela +Michaelina +Michaeline +Michaella +Michal +Michel +Michele +Michelina +Micheline +Michell +Michelle +Micki +Mickie +Micky +Midge +Mignon +Mignonne +Miguela +Miguelita +Mildred +Mildrid +Milena +Milicent +Milissent +Milka +Milli +Millicent +Millie +Millisent +Milly +Milzie +Mimi +Min +Mina +Minda +Mindy +Minerva +Minetta +Minette +Minna +Minni +Minnie +Minny +Minta +Miquela +Mira +Mirabel +Mirabella +Mirabelle +Miran +Miranda +Mireielle +Mireille +Mirella +Mirelle +Miriam +Mirilla +Mirna +Misha +Missie +Missy +Misti +Misty +Mitra +Mitzi +Mmarianne +Modesta +Modestia +Modestine +Modesty +Moina +Moira +Moll +Mollee +Molli +Mollie +Molly +Mommy +Mona +Monah +Monica +Monika +Monique +Mora +Moreen +Morena +Morgan +Morgana +Morganica +Morganne +Morgen +Moria +Morissa +Morlee +Morna +Moselle +Moya +Moyna +Moyra +Mozelle +Muffin +Mufi +Mufinella +Muire +Mureil +Murial +Muriel +Murielle +Myna +Myra +Myrah +Myranda +Myriam +Myrilla +Myrle +Myrlene +Myrna +Myrta +Myrtia +Myrtice +Myrtie +Myrtle +Nada +Nadean +Nadeen +Nadia +Nadine +Nadiya +Nady +Nadya +Nalani +Nan +Nana +Nananne +Nance +Nancee +Nancey +Nanci +Nancie +Nancy +Nanete +Nanette +Nani +Nanice +Nanine +Nannette +Nanni +Nannie +Nanny +Nanon +Naoma +Naomi +Nara +Nari +Nariko +Nat +Nata +Natala +Natalee +Natalia +Natalie +Natalina +Nataline +Natalya +Natasha +Natassia +Nathalia +Nathalie +Natka +Natty +Neala +Neda +Nedda +Nedi +Neely +Neila +Neile +Neilla +Neille +Nela +Nelia +Nelie +Nell +Nelle +Nelli +Nellie +Nelly +Nena +Nerissa +Nerita +Nert +Nerta +Nerte +Nerti +Nertie +Nerty +Nessa +Nessi +Nessie +Nessy +Nesta +Netta +Netti +Nettie +Nettle +Netty +Nevsa +Neysa +Nichol +Nichole +Nicholle +Nicki +Nickie +Nicky +Nicol +Nicola +Nicole +Nicolea +Nicolette +Nicoli +Nicolina +Nicoline +Nicolle +Nidia +Nike +Niki +Nikki +Nikkie +Nikoletta +Nikolia +Nil +Nina +Ninetta +Ninette +Ninnetta +Ninnette +Ninon +Nisa +Nissa +Nisse +Nissie +Nissy +Nita +Nitin +Nixie +Noami +Noel +Noelani +Noell +Noella +Noelle +Noellyn +Noelyn +Noemi +Nola +Nolana +Nolie +Nollie +Nomi +Nona +Nonah +Noni +Nonie +Nonna +Nonnah +Nora +Norah +Norean +Noreen +Norene +Norina +Norine +Norma +Norri +Norrie +Norry +Nova +Novelia +Nydia +Nyssa +Octavia +Odele +Odelia +Odelinda +Odella +Odelle +Odessa +Odetta +Odette +Odilia +Odille +Ofelia +Ofella +Ofilia +Ola +Olenka +Olga +Olia +Olimpia +Olive +Olivette +Olivia +Olivie +Oliy +Ollie +Olly +Olva +Olwen +Olympe +Olympia +Olympie +Ondrea +Oneida +Onida +Onlea +Oona +Opal +Opalina +Opaline +Ophelia +Ophelie +Oprah +Ora +Oralee +Oralia +Oralie +Oralla +Oralle +Orel +Orelee +Orelia +Orelie +Orella +Orelle +Oreste +Oriana +Orly +Orsa +Orsola +Ortensia +Otha +Othelia +Othella +Othilia +Othilie +Ottilie +Pacifica +Page +Paige +Paloma +Pam +Pamela +Pamelina +Pamella +Pammi +Pammie +Pammy +Pandora +Pansie +Pansy +Paola +Paolina +Parwane +Pat +Patience +Patrica +Patrice +Patricia +Patrizia +Patsy +Patti +Pattie +Patty +Paula +Paula-Grace +Paule +Pauletta +Paulette +Pauli +Paulie +Paulina +Pauline +Paulita +Pauly +Pavia +Pavla +Pearl +Pearla +Pearle +Pearline +Peg +Pegeen +Peggi +Peggie +Peggy +Pen +Penelopa +Penelope +Penni +Pennie +Penny +Pepi +Pepita +Peri +Peria +Perl +Perla +Perle +Perri +Perrine +Perry +Persis +Pet +Peta +Petra +Petrina +Petronella +Petronia +Petronilla +Petronille +Petunia +Phaedra +Phaidra +Phebe +Phedra +Phelia +Phil +Philipa +Philippa +Philippe +Philippine +Philis +Phillida +Phillie +Phillis +Philly +Philomena +Phoebe +Phylis +Phyllida +Phyllis +Phyllys +Phylys +Pia +Pier +Pierette +Pierrette +Pietra +Piper +Pippa +Pippy +Polly +Pollyanna +Pooh +Poppy +Portia +Pris +Prisca +Priscella +Priscilla +Prissie +Pru +Prudence +Prudi +Prudy +Prue +Prunella +Queada +Queenie +Quentin +Querida +Quinn +Quinta +Quintana +Quintilla +Quintina +Rachael +Rachel +Rachele +Rachelle +Rae +Raf +Rafa +Rafaela +Rafaelia +Rafaelita +Ragnhild +Rahal +Rahel +Raina +Raine +Rakel +Ralina +Ramona +Ramonda +Rana +Randa +Randee +Randene +Randi +Randie +Randy +Ranee +Rani +Rania +Ranice +Ranique +Ranna +Raphaela +Raquel +Raquela +Rasia +Rasla +Raven +Ray +Raychel +Raye +Rayna +Raynell +Rayshell +Rea +Reba +Rebbecca +Rebe +Rebeca +Rebecca +Rebecka +Rebeka +Rebekah +Rebekkah +Ree +Reeba +Reena +Reeta +Reeva +Regan +Reggi +Reggie +Regina +Regine +Reiko +Reina +Reine +Remy +Rena +Renae +Renata +Renate +Rene +Renee +Renel +Renell +Renelle +Renie +Rennie +Reta +Retha +Revkah +Rey +Reyna +Rhea +Rheba +Rheta +Rhetta +Rhiamon +Rhianna +Rhianon +Rhoda +Rhodia +Rhodie +Rhody +Rhona +Rhonda +Riane +Riannon +Rianon +Rica +Ricca +Rici +Ricki +Rickie +Ricky +Riki +Rikki +Rina +Risa +Rissa +Rita +Riva +Rivalee +Rivi +Rivkah +Rivy +Roana +Roanna +Roanne +Robbi +Robbie +Robbin +Robby +Robbyn +Robena +Robenia +Roberta +Robin +Robina +Robinet +Robinett +Robinetta +Robinette +Robinia +Roby +Robyn +Roch +Rochell +Rochella +Rochelle +Rochette +Roda +Rodi +Rodie +Rodina +Romola +Romona +Romonda +Romy +Rona +Ronalda +Ronda +Ronica +Ronna +Ronni +Ronnica +Ronnie +Ronny +Roobbie +Rora +Rori +Rorie +Rory +Ros +Rosa +Rosabel +Rosabella +Rosabelle +Rosaleen +Rosalia +Rosalie +Rosalind +Rosalinda +Rosalinde +Rosaline +Rosalyn +Rosalynd +Rosamond +Rosamund +Rosana +Rosanna +Rosanne +Rosario +Rose +Roseann +Roseanna +Roseanne +Roselia +Roselin +Roseline +Rosella +Roselle +Roselyn +Rosemaria +Rosemarie +Rosemary +Rosemonde +Rosene +Rosetta +Rosette +Roshelle +Rosie +Rosina +Rosita +Roslyn +Rosmunda +Rosy +Row +Rowe +Rowena +Roxana +Roxane +Roxanna +Roxanne +Roxi +Roxie +Roxine +Roxy +Roz +Rozalie +Rozalin +Rozamond +Rozanna +Rozanne +Roze +Rozele +Rozella +Rozelle +Rozina +Rubetta +Rubi +Rubia +Rubie +Rubina +Ruby +Ruella +Ruperta +Ruth +Ruthann +Ruthanne +Ruthe +Ruthi +Ruthie +Ruthy +Ryann +Rycca +Saba +Sabina +Sabine +Sabra +Sabrina +Sacha +Sada +Sadella +Sadie +Sal +Sallee +Salli +Sallie +Sally +Sallyann +Sallyanne +Salome +Sam +Samantha +Samara +Samaria +Sammy +Samuela +Samuella +Sande +Sandi +Sandie +Sandra +Sandy +Sandye +Sapphira +Sapphire +Sara +Sara-Ann +Saraann +Sarah +Sarajane +Saree +Sarena +Sarene +Sarette +Sari +Sarina +Sarine +Sarita +Sascha +Sasha +Sashenka +Saudra +Saundra +Savina +Sayre +Scarlet +Scarlett +Scotty +Sean +Seana +Secunda +Seka +Sela +Selena +Selene +Selestina +Selia +Selie +Selina +Selinda +Seline +Sella +Selle +Selma +Sena +Sephira +Serena +Serene +Shaina +Shaine +Shalna +Shalne +Shamit +Shana +Shanda +Shandee +Shandie +Shandra +Shandy +Shane +Shani +Shanie +Shanna +Shannah +Shannen +Shannon +Shanon +Shanta +Shantee +Shara +Sharai +Shari +Sharia +Sharie +Sharity +Sharl +Sharla +Sharleen +Sharlene +Sharline +Sharna +Sharon +Sharona +Sharra +Sharron +Sharyl +Shaun +Shauna +Shawn +Shawna +Shawnee +Shay +Shayla +Shaylah +Shaylyn +Shaylynn +Shayna +Shayne +Shea +Sheba +Sheela +Sheelagh +Sheelah +Sheena +Sheeree +Sheila +Sheila-Kathryn +Sheilah +Sheilakathryn +Shel +Shela +Shelagh +Shelba +Shelbi +Shelby +Shelia +Shell +Shelley +Shelli +Shellie +Shelly +Shena +Sher +Sheree +Sheri +Sherie +Sheril +Sherill +Sherilyn +Sherline +Sherri +Sherrie +Sherry +Sherye +Sheryl +Shilpa +Shina +Shir +Shira +Shirah +Shirl +Shirlee +Shirleen +Shirlene +Shirley +Shirline +Shoshana +Shoshanna +Shoshie +Siana +Sianna +Sib +Sibbie +Sibby +Sibeal +Sibel +Sibella +Sibelle +Sibilla +Sibley +Sibyl +Sibylla +Sibylle +Sidoney +Sidonia +Sidonnie +Sigrid +Sile +Sileas +Silva +Silvana +Silvia +Silvie +Simona +Simone +Simonette +Simonne +Sindee +Sinead +Siobhan +Sioux +Siouxie +Sisely +Sisile +Sissie +Sissy +Sofia +Sofie +Solange +Sondra +Sonia +Sonja +Sonni +Sonnie +Sonnnie +Sonny +Sonya +Sophey +Sophi +Sophia +Sophie +Sophronia +Sorcha +Sosanna +Stace +Stacee +Stacey +Staci +Stacia +Stacie +Stacy +Stafani +Star +Starla +Starlene +Starlin +Starr +Stefa +Stefania +Stefanie +Steffane +Steffi +Steffie +Stella +Stepha +Stephana +Stephani +Stephanie +Stephannie +Stephenie +Stephi +Stephie +Stephine +Stesha +Stevana +Stevena +Stoddard +Storey +Storm +Stormi +Stormie +Stormy +Sue +Sue-elle +Suellen +Sukey +Suki +Sula +Sunny +Sunshine +Susan +Susana +Susanetta +Susann +Susanna +Susannah +Susanne +Susette +Susi +Susie +Sussi +Susy +Suzan +Suzann +Suzanna +Suzanne +Suzetta +Suzette +Suzi +Suzie +Suzy +Suzzy +Sybil +Sybila +Sybilla +Sybille +Sybyl +Sydel +Sydelle +Sydney +Sylvia +Sylvie +Tabatha +Tabbatha +Tabbi +Tabbie +Tabbitha +Tabby +Tabina +Tabitha +Taffy +Talia +Tallia +Tallie +Tally +Talya +Talyah +Tamar +Tamara +Tamarah +Tamarra +Tamera +Tami +Tamiko +Tamma +Tammara +Tammi +Tammie +Tammy +Tamra +Tana +Tandi +Tandie +Tandy +Tani +Tania +Tansy +Tanya +Tara +Tarah +Tarra +Tarrah +Taryn +Tasha +Tasia +Tate +Tatiana +Tatiania +Tatum +Tawnya +Tawsha +Teane +Ted +Tedda +Teddi +Teddie +Teddy +Tedi +Tedra +Teena +Tella +Teodora +Tera +Teresa +TeresaAnne +Terese +Teresina +Teresita +Teressa +Teri +Teriann +Terina +Terra +Terri +Terri-Jo +Terrianne +Terrie +Terry +Terrye +Tersina +Teryl +Terza +Tess +Tessa +Tessi +Tessie +Tessy +Thalia +Thea +Theada +Theadora +Theda +Thekla +Thelma +Theo +Theodora +Theodosia +Theresa +Theresa-Marie +Therese +Theresina +Theresita +Theressa +Therine +Thia +Thomasa +Thomasin +Thomasina +Thomasine +Tia +Tiana +Tiena +Tierney +Tiertza +Tiff +Tiffani +Tiffanie +Tiffany +Tiffi +Tiffie +Tiffy +Tilda +Tildi +Tildie +Tildy +Tillie +Tilly +Tim +Timi +Timmi +Timmie +Timmy +Timothea +Tina +Tine +Tiphani +Tiphanie +Tiphany +Tish +Tisha +Tobe +Tobey +Tobi +Tobie +Toby +Tobye +Toinette +Toma +Tomasina +Tomasine +Tomi +Tomiko +Tommi +Tommie +Tommy +Toni +Tonia +Tonie +Tony +Tonya +Tootsie +Torey +Tori +Torie +Torrie +Tory +Tova +Tove +Trace +Tracee +Tracey +Traci +Tracie +Tracy +Trenna +Tresa +Trescha +Tressa +Tricia +Trina +Trish +Trisha +Trista +Trix +Trixi +Trixie +Trixy +Truda +Trude +Trudey +Trudi +Trudie +Trudy +Trula +Tuesday +Twila +Twyla +Tybi +Tybie +Tyne +Ula +Ulla +Ulrica +Ulrika +Ulrike +Umeko +Una +Ursa +Ursala +Ursola +Ursula +Ursulina +Ursuline +Uta +Val +Valaree +Valaria +Vale +Valeda +Valencia +Valene +Valenka +Valentia +Valentina +Valentine +Valera +Valeria +Valerie +Valery +Valerye +Valida +Valina +Valli +Vallie +Vally +Valma +Valry +Van +Vanda +Vanessa +Vania +Vanna +Vanni +Vannie +Vanny +Vanya +Veda +Velma +Velvet +Vena +Venita +Ventura +Venus +Vera +Veradis +Vere +Verena +Verene +Veriee +Verile +Verina +Verine +Verla +Verna +Vernice +Veronica +Veronika +Veronike +Veronique +Vi +Vicki +Vickie +Vicky +Victoria +Vida +Viki +Vikki +Vikkie +Vikky +Vilhelmina +Vilma +Vin +Vina +Vinita +Vinni +Vinnie +Vinny +Viola +Violante +Viole +Violet +Violetta +Violette +Virgie +Virgina +Virginia +Virginie +Vita +Vitia +Vitoria +Vittoria +Viv +Viva +Vivi +Vivia +Vivian +Viviana +Vivianna +Vivianne +Vivie +Vivien +Viviene +Vivienne +Viviyan +Vivyan +Vivyanne +Vonni +Vonnie +Vonny +Wallie +Wallis +Wally +Waly +Wanda +Wandie +Wandis +Waneta +Wenda +Wendeline +Wendi +Wendie +Wendy +Wenona +Wenonah +Whitney +Wileen +Wilhelmina +Wilhelmine +Wilie +Willa +Willabella +Willamina +Willetta +Willette +Willi +Willie +Willow +Willy +Willyt +Wilma +Wilmette +Wilona +Wilone +Wilow +Windy +Wini +Winifred +Winna +Winnah +Winne +Winni +Winnie +Winnifred +Winny +Winona +Winonah +Wren +Wrennie +Wylma +Wynn +Wynne +Wynnie +Wynny +Xaviera +Xena +Xenia +Xylia +Xylina +Yalonda +Yehudit +Yelena +Yetta +Yettie +Yetty +Yevette +Yoko +Yolanda +Yolande +Yolane +Yolanthe +Yonina +Yoshi +Yoshiko +Yovonnda +Yvette +Yvonne +Zabrina +Zahara +Zandra +Zaneta +Zara +Zarah +Zaria +Zarla +Zea +Zelda +Zelma +Zena +Zenia +Zia +Zilvia +Zita +Zitella +Zoe +Zola +Zonda +Zondra +Zonnya +Zora +Zorah +Zorana +Zorina +Zorine +Zsa Zsa +Zsazsa +Zulema +Zuzana +Mikako +Kaari +Gita +Geeta diff --git a/fun_text_processing/text_normalization/en/data/roman/key_word.tsv b/fun_text_processing/text_normalization/en/data/roman/key_word.tsv new file mode 100644 index 0000000..861285b --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/roman/key_word.tsv @@ -0,0 +1,6 @@ +chapter +class +part +article +section +paragraph diff --git a/fun_text_processing/text_normalization/en/data/roman/male.tsv b/fun_text_processing/text_normalization/en/data/roman/male.tsv new file mode 100644 index 0000000..08236aa --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/roman/male.tsv @@ -0,0 +1,2946 @@ +Aamir +Aaron +Abbey +Abbie +Abbot +Abbott +Abby +Abdel +Abdul +Abdulkarim +Abdullah +Abe +Abel +Abelard +Abner +Abraham +Abram +Ace +Adair +Adam +Adams +Addie +Adger +Aditya +Adlai +Adnan +Adolf +Adolfo +Adolph +Adolphe +Adolpho +Adolphus +Adrian +Adrick +Adrien +Agamemnon +Aguinaldo +Aguste +Agustin +Aharon +Ahmad +Ahmed +Ahmet +Ajai +Ajay +Al +Alaa +Alain +Alan +Alasdair +Alastair +Albatros +Albert +Alberto +Albrecht +Alden +Aldis +Aldo +Aldric +Aldrich +Aldus +Aldwin +Alec +Aleck +Alejandro +Aleks +Aleksandrs +Alessandro +Alex +Alexander +Alexei +Alexis +Alf +Alfie +Alfonse +Alfonso +Alfonzo +Alford +Alfred +Alfredo +Algernon +Ali +Alic +Alister +Alix +Allah +Allan +Allen +Alley +Allie +Allin +Allyn +Alonso +Alonzo +Aloysius +Alphonse +Alphonso +Alston +Alton +Alvin +Alwin +Amadeus +Ambros +Ambrose +Ambrosi +Ambrosio +Ambrosius +Amenhotep +Amery +Amory +Amos +Anatol +Anatole +Anatollo +Anatoly +Anders +Andie +Andonis +Andre +Andrea +Andreas +Andrej +Andres +Andrew +Andrey +Andri +Andros +Andrus +Andrzej +Andy +Angel +Angelico +Angelo +Angie +Angus +Ansel +Ansell +Anselm +Anson +Anthony +Antin +Antoine +Anton +Antone +Antoni +Antonin +Antonino +Antonio +Antonius +Antony +Anurag +Apollo +Apostolos +Aram +Archibald +Archibold +Archie +Archon +Archy +Arel +Ari +Arie +Ariel +Aristotle +Arlo +Armand +Armando +Armond +Armstrong +Arne +Arnie +Arnold +Arnoldo +Aron +Arron +Art +Arther +Arthur +Artie +Artur +Arturo +Arvie +Arvin +Arvind +Arvy +Ash +Ashby +Ashish +Ashley +Ashton +Aub +Aube +Aubert +Aubrey +Augie +Augustin +Augustine +Augusto +Augustus +Austen +Austin +Ave +Averell +Averil +Averill +Avery +Avi +Avraham +Avram +Avrom +Axel +Aylmer +Aziz +Bailey +Bailie +Baillie +Baily +Baird +Baldwin +Bancroft +Barbabas +Barclay +Bard +Barde +Barn +Barnabas +Barnabe +Barnaby +Barnard +Barnebas +Barnett +Barney +Barnie +Barny +Baron +Barr +Barret +Barrett +Barri +Barrie +Barris +Barron +Barry +Bart +Bartel +Barth +Barthel +Bartholemy +Bartholomeo +Bartholomeus +Bartholomew +Bartie +Bartlet +Bartlett +Bartolemo +Bartolomei +Bartolomeo +Barton +Barty +Bary +Basil +Batholomew +Baxter +Bay +Bayard +Beale +Bealle +Bear +Bearnard +Beau +Beaufort +Beauregard +Beck +Bela +Ben +Benedict +Bengt +Benito +Benjamen +Benjamin +Benji +Benjie +Benjy +Benn +Bennet +Bennett +Bennie +Benny +Benson +Bentley +Benton +Beowulf +Berchtold +Berk +Berke +Berkeley +Berkie +Berkley +Bernard +Bernardo +Bernd +Bernhard +Bernie +Bert +Bertie +Bertram +Bertrand +Bharat +Biff +Bill +Billie +Billy +Bing +Binky +Bishop +Bjorn +Bjorne +Blaine +Blair +Blake +Blare +Blayne +Bo +Bob +Bobbie +Bobby +Bogart +Bogdan +Boniface +Boris +Boyce +Boyd +Brad +Braden +Bradford +Bradley +Bradly +Brady +Brandon +Brandy +Brant +Brendan +Brent +Bret +Brett +Brewer +Brewster +Brian +Brice +Briggs +Brinkley +Britt +Brock +Broddie +Broddy +Broderic +Broderick +Brodie +Brody +Bronson +Brook +Brooke +Brooks +Bruce +Bruno +Bryan +Bryant +Bryce +Bryn +Bryon +Bubba +Buck +Bucky +Bud +Buddy +Burgess +Burke +Burl +Burnaby +Burt +Burton +Buster +Butch +Butler +Byram +Byron +Caesar +Cain +Cal +Caldwell +Caleb +Calhoun +Calvin +Cam +Cameron +Cammy +Carey +Carl +Carleigh +Carlie +Carlin +Carlo +Carlos +Carlton +Carlyle +Carmine +Carroll +Carson +Carsten +Carter +Cary +Caryl +Case +Casey +Caspar +Casper +Cass +Cat +Cecil +Cesar +Chad +Chadd +Chaddie +Chaddy +Chadwick +Chaim +Chalmers +Chan +Chance +Chancey +Chanderjit +Chandler +Chane +Chariot +Charles +Charleton +Charley +Charlie +Charlton +Chas +Chase +Chaunce +Chauncey +Che +Chelton +Chen +Chester +Cheston +Chet +Chev +Chevalier +Chevy +Chip +Chris +Chrissy +Christ +Christian +Christiano +Christie +Christof +Christofer +Christoph +Christophe +Christopher +Christorpher +Christos +Christy +Chrisy +Chuck +Churchill +Clair +Claire +Clancy +Clarance +Clare +Clarence +Clark +Clarke +Claude +Claudio +Claudius +Claus +Clay +Clayborn +Clayborne +Claybourne +Clayton +Cleland +Clem +Clemens +Clement +Clemente +Clemmie +Cletus +Cleveland +Cliff +Clifford +Clifton +Clint +Clinten +Clinton +Clive +Clyde +Cob +Cobb +Cobbie +Cobby +Cody +Colbert +Cole +Coleman +Colin +Collin +Collins +Conan +Connie +Connolly +Connor +Conrad +Conroy +Constantin +Constantine +Constantinos +Conway +Cooper +Corbin +Corby +Corey +Corky +Cornelius +Cornellis +Corrie +Cortese +Corwin +Cory +Cosmo +Costa +Courtney +Craig +Crawford +Creighton +Cris +Cristopher +Curt +Curtice +Curtis +Cy +Cyril +Cyrill +Cyrille +Cyrillus +Cyrus +Dabney +Daffy +Dale +Dallas +Dalton +Damian +Damien +Damon +Dan +Dana +Dane +Dani +Danie +Daniel +Dannie +Danny +Dante +Darby +Darcy +Daren +Darian +Darien +Darin +Dario +Darius +Darrel +Darrell +Darren +Darrick +Darrin +Darryl +Darth +Darwin +Daryl +Daryle +Dave +Davey +David +Davidde +Davide +Davidson +Davie +Davin +Davis +Davon +Davoud +Davy +Dawson +Dean +Deane +Del +Delbert +Dell +Delmar +Demetre +Demetri +Demetris +Demetrius +Demosthenis +Denis +Dennie +Dennis +Denny +Derby +Derek +Derick +Derk +Derrek +Derrick +Derrin +Derrol +Derron +Deryl +Desmond +Desmund +Devin +Devon +Dewey +Dewitt +Dexter +Dick +Dickey +Dickie +Diego +Dieter +Dietrich +Dillon +Dimitri +Dimitrios +Dimitris +Dimitrou +Dimitry +Dino +Dion +Dionis +Dionysus +Dirk +Dmitri +Dom +Domenic +Domenico +Dominic +Dominick +Dominique +Don +Donal +Donald +Donn +Donnie +Donny +Donovan +Dorian +Dory +Doug +Douggie +Dougie +Douglas +Douglass +Douglis +Dov +Doyle +Drake +Drew +Dru +Dryke +Duane +Dudley +Duffie +Duffy +Dugan +Duke +Dunc +Duncan +Dunstan +Durand +Durant +Durante +Durward +Dustin +Dwain +Dwaine +Dwane +Dwayne +Dwight +Dylan +Dyson +Earl +Earle +Easton +Eben +Ebeneser +Ebenezer +Eberhard +Ed +Eddie +Eddy +Edgar +Edgardo +Edie +Edmond +Edmund +Edouard +Edsel +Eduard +Eduardo +Edward +Edwin +Efram +Egbert +Ehud +Elbert +Elden +Eldon +Eli +Elias +Elihu +Elijah +Eliot +Eliott +Elisha +Elliot +Elliott +Ellis +Ellsworth +Ellwood +Elmer +Elmore +Elnar +Elric +Elroy +Elton +Elvin +Elvis +Elwin +Elwood +Elwyn +Ely +Emanuel +Emerson +Emery +Emil +Emile +Emilio +Emmanuel +Emmery +Emmet +Emmett +Emmit +Emmott +Emmy +Emory +Ender +Engelbart +Engelbert +Englebart +Englebert +Enoch +Enrico +Enrique +Ephraim +Ephram +Ephrayim +Ephrem +Er +Erasmus +Erastus +Erek +Erhard +Erhart +Eric +Erich +Erick +Erik +Erin +Erl +Ernest +Ernesto +Ernie +Ernst +Erny +Errol +Ervin +Erwin +Esau +Esme +Esteban +Ethan +Ethelbert +Ethelred +Etienne +Euclid +Eugen +Eugene +Eustace +Ev +Evan +Evelyn +Everard +Everett +Ewan +Ewart +Ez +Ezechiel +Ezekiel +Ezra +Fabian +Fabio +Fairfax +Farley +Fazeel +Federico +Felice +Felicio +Felipe +Felix +Ferd +Ferdie +Ferdinand +Ferdy +Fergus +Ferguson +Ferinand +Fernando +Fidel +Filbert +Filip +Filipe +Filmore +Finley +Finn +Fitz +Fitzgerald +Flem +Fleming +Flemming +Fletch +Fletcher +Flin +Flinn +Flint +Flipper +Florian +Floyd +Flynn +Fons +Fonsie +Fonz +Fonzie +Forbes +Ford +Forest +Forester +Forrest +Forrester +Forster +Foster +Fowler +Fox +Fran +Francesco +Francis +Francisco +Francois +Frank +Frankie +Franklin +Franklyn +Franky +Frans +Franz +Fraser +Frazier +Fred +Freddie +Freddy +Frederic +Frederich +Frederick +Frederico +Frederik +Fredric +Fredrick +Freeman +Freemon +Fremont +French +Friedric +Friedrich +Friedrick +Fritz +Fulton +Fyodor +Gabe +Gabriel +Gabriele +Gabriell +Gabriello +Gail +Gale +Galen +Gallagher +Gamaliel +Garcia +Garcon +Gardener +Gardiner +Gardner +Garey +Garfield +Garfinkel +Garold +Garp +Garret +Garrett +Garrot +Garrott +Garry +Garth +Garv +Garvey +Garvin +Garvy +Garwin +Garwood +Gary +Gaspar +Gasper +Gaston +Gav +Gaven +Gavin +Gavriel +Gay +Gayle +Gearard +Gene +Geo +Geof +Geoff +Geoffrey +Geoffry +Georg +George +Georges +Georgia +Georgie +Georgy +Gerald +Geraldo +Gerard +Gere +Gerhard +Gerhardt +Geri +Germaine +Gerold +Gerome +Gerrard +Gerri +Gerrit +Gerry +Gershom +Gershon +Giacomo +Gian +Giancarlo +Giavani +Gibb +Gideon +Giff +Giffard +Giffer +Giffie +Gifford +Giffy +Gil +Gilbert +Gilberto +Gilburt +Giles +Gill +Gilles +Ginger +Gino +Giordano +Giorgi +Giorgio +Giovanne +Giovanni +Giraldo +Giraud +Giuseppe +Glen +Glenn +Glynn +Godard +Godart +Goddard +Goddart +Godfree +Godfrey +Godfry +Godwin +Gomer +Gonzales +Gonzalo +Goober +Goose +Gordan +Gordie +Gordon +Grace +Grady +Graehme +Graeme +Graham +Graig +Grant +Granville +Greg +Gregg +Greggory +Gregor +Gregorio +Gregory +Gretchen +Griff +Griffin +Griffith +Griswold +Grove +Grover +Guido +Guillaume +Guillermo +Gunner +Gunter +Gunther +Gus +Gustaf +Gustav +Gustave +Gustavo +Gustavus +Guthrey +Guthrie +Guthry +Guy +Hadleigh +Hadley +Hadrian +Hagan +Hagen +Hailey +Hakeem +Hakim +Hal +Hale +Haleigh +Haley +Hall +Hallam +Halvard +Ham +Hamel +Hamid +Hamil +Hamilton +Hamish +Hamlen +Hamlet +Hamlin +Hammad +Hamnet +Han +Hanan +Hanford +Hank +Hannibal +Hans +Hans-Peter +Hansel +Hanson +Harald +Harcourt +Hari +Harlan +Harland +Harley +Harlin +Harman +Harmon +Harold +Harris +Harrison +Harrold +Harry +Hart +Hartley +Hartwell +Harv +Harvard +Harvey +Harvie +Harwell +Hasheem +Hashim +Haskel +Haskell +Hassan +Hastings +Hasty +Haven +Hayden +Haydon +Hayes +Hayward +Haywood +Hazel +Heath +Heathcliff +Hebert +Hector +Heinrich +Heinz +Helmuth +Henderson +Hendrick +Hendrik +Henri +Henrie +Henrik +Henrique +Henry +Herb +Herbert +Herbie +Herby +Hercule +Hercules +Herculie +Herman +Hermann +Hermon +Hermy +Hernando +Herold +Herrick +Herrmann +Hersch +Herschel +Hersh +Hershel +Herve +Hervey +Hew +Hewe +Hewet +Hewett +Hewie +Hewitt +Heywood +Hezekiah +Higgins +Hilary +Hilbert +Hill +Hillard +Hillary +Hillel +Hillery +Hilliard +Hilton +Hiralal +Hiram +Hiro +Hirsch +Hobart +Hodge +Hogan +Hollis +Holly +Homer +Horace +Horacio +Horatio +Horatius +Horst +Howard +Howie +Hoyt +Hubert +Hudson +Huey +Hugh +Hugo +Humbert +Humphrey +Hunt +Hunter +Huntington +Huntlee +Huntley +Hurley +Husain +Husein +Hussein +Hy +Hyatt +Hyman +Hymie +Iago +Iain +Ian +Ibrahim +Ichabod +Iggie +Iggy +Ignace +Ignacio +Ignacius +Ignatius +Ignaz +Ignazio +Igor +Ike +Ikey +Immanuel +Ingamar +Ingelbert +Ingemar +Inglebert +Ingmar +Ingram +Inigo +Innocent +Ira +Irvin +Irvine +Irving +Irwin +Isa +Isaac +Isaak +Isador +Isadore +Isaiah +Ishmael +Isidore +Ismail +Israel +Istvan +Ivan +Ivor +Izaak +Izak +Izzy +Jabez +Jack +Jackie +Jackson +Jacob +Jacques +Jae +Jaime +Jake +Jakob +James +Jameson +Jamey +Jamie +Jan +Janos +Janus +Jared +Jarrett +Jarvis +Jason +Jasper +Javier +Jay +Jean +Jean-Christophe +Jean-Francois +Jean-Lou +Jean-Luc +Jean-Marc +Jean-Paul +Jean-Pierre +Jeb +Jed +Jedediah +Jef +Jeff +Jefferey +Jefferson +Jeffery +Jeffie +Jeffrey +Jeffry +Jefry +Jehu +Jennings +Jens +Jephthah +Jerald +Jeramie +Jere +Jereme +Jeremiah +Jeremias +Jeremie +Jeremy +Jermain +Jermaine +Jermayne +Jerold +Jerome +Jeromy +Jerri +Jerrie +Jerrold +Jerrome +Jerry +Jervis +Jerzy +Jess +Jesse +Jessee +Jessey +Jessie +Jesus +Jeth +Jethro +Jim +Jimbo +Jimmie +Jimmy +Jo +Joab +Joachim +Joao +Joaquin +Job +Jock +Jodi +Jodie +Jody +Joe +Joel +Joey +Johan +Johann +Johannes +John +John-David +John-Patrick +Johnathan +Johnathon +Johnnie +Johnny +Johny +Jon +Jonah +Jonas +Jonathan +Jonathon +Jonny +Jordan +Jordon +Jordy +Jorge +Jory +Jose +Josef +Joseph +Josephus +Josh +Joshua +Joshuah +Josiah +Jotham +Juan +Juanita +Jud +Judah +Judas +Judd +Jude +Judith +Judson +Judy +Juergen +Jule +Jules +Julian +Julie +Julio +Julius +Justin +Justis +Kaiser +Kaleb +Kalil +Kalle +Kalman +Kalvin +Kam +Kane +Kareem +Karel +Karim +Karl +Karsten +Kaspar +Keefe +Keenan +Keene +Keil +Keith +Kellen +Kelley +Kelly +Kelsey +Kelvin +Kelwin +Ken +Kendal +Kendall +Kendrick +Kenn +Kennedy +Kenneth +Kenny +Kent +Kenton +Kenyon +Kermie +Kermit +Kerry +Kevan +Kevin +Kim +Kimball +Kimmo +Kin +Kincaid +King +Kingsley +Kingsly +Kingston +Kip +Kirby +Kirk +Kit +Klaus +Klee +Knox +Konrad +Konstantin +Kory +Kostas +Kraig +Kris +Krishna +Kristian +Kristopher +Kristos +Kurt +Kurtis +Kyle +Laird +Lamar +Lambert +Lamont +Lance +Lancelot +Lane +Langston +Lanny +Larry +Lars +Laurance +Lauren +Laurence +Laurens +Laurent +Laurie +Lawerence +Lawrence +Lawson +Lawton +Lay +Layton +Lazar +Lazare +Lazaro +Lazarus +Lazlo +Lee +Lefty +Leif +Leigh +Leighton +Leland +Lem +Lemar +Lemmie +Lemmy +Lemuel +Len +Lenard +Lennie +Lenny +Leo +Leon +Leonard +Leonardo +Leonerd +Leonhard +Leonid +Leonidas +Leopold +Leroy +Les +Lesley +Leslie +Lester +Lev +Levi +Levin +Levon +Levy +Lew +Lewis +Lex +Liam +Lin +Lincoln +Lind +Lindsay +Lindsey +Lindy +Linoel +Linus +Lion +Lionel +Lionello +Llewellyn +Lloyd +Locke +Lockwood +Logan +Lon +Lonnie +Lonny +Loren +Lorenzo +Lorne +Lorrie +Lothar +Lou +Louie +Louis +Lovell +Lowell +Lucas +Luce +Lucian +Luciano +Lucien +Lucio +Lucius +Ludvig +Ludwig +Luigi +Luis +Lukas +Luke +Luther +Lyle +Lyn +Lyndon +Lynn +Mac +Mace +Mack +Mackenzie +Maddie +Maddy +Madison +Magnum +Magnus +Mahesh +Mahmoud +Mahmud +Maison +Major +Malcolm +Manfred +Manish +Manny +Manuel +Marc +Marcel +Marcello +Marcellus +Marcelo +Marchall +Marcio +Marco +Marcos +Marcus +Marietta +Marilu +Mario +Marion +Marius +Mark +Marko +Markos +Markus +Marlin +Marlo +Marlon +Marlow +Marlowe +Marmaduke +Marsh +Marshal +Marshall +Mart +Martainn +Marten +Martie +Martin +Martino +Marty +Martyn +Marv +Marve +Marven +Marvin +Marwin +Mason +Mateo +Mathew +Mathias +Matias +Matt +Matteo +Matthaeus +Mattheus +Matthew +Matthias +Matthieu +Matthiew +Matthus +Mattias +Mattie +Matty +Maurice +Mauricio +Maurie +Maurise +Maurits +Mauritz +Maury +Max +Maxfield +Maxie +Maxim +Maximilian +Maximilien +Maxwell +Mayer +Maynard +Maynord +Mayor +Mead +Meade +Meier +Meir +Mel +Melvin +Melvyn +Menard +Mendel +Mendie +Meredeth +Meredith +Merell +Merill +Merle +Merlin +Merrel +Merrick +Merril +Merrill +Merry +Merv +Mervin +Merwin +Meryl +Meyer +Mic +Micah +Michael +Michail +Michal +Michale +Micheal +Micheil +Michel +Michele +Mick +Mickey +Mickie +Micky +Miguel +Mika +Mikael +Mike +Mikel +Mikey +Mikhail +Miles +Millicent +Milo +Milt +Milton +Mischa +Mitch +Mitchael +Mitchel +Mitchell +Moe +Mohamad +Mohamed +Mohammad +Mohammed +Mohan +Moise +Moises +Moishe +Monroe +Montague +Monte +Montgomery +Monty +Moore +Mordecai +Morgan +Morlee +Morley +Morly +Morrie +Morris +Morry +Morse +Mort +Morten +Mortie +Mortimer +Morton +Morty +Mose +Moses +Moshe +Moss +Muffin +Mugsy +Muhammad +Munmro +Munroe +Murdoch +Murdock +Murphy +Murray +Mustafa +Myke +Myles +Mylo +Myron +Nahum +Napoleon +Nat +Natale +Nate +Nathan +Nathanael +Nathanial +Nathaniel +Nathanil +Neal +Neale +Neall +Nealon +Nealson +Nealy +Ned +Neddie +Neddy +Neel +Neil +Nels +Nelsen +Nelson +Nero +Neron +Nester +Nestor +Nev +Nevil +Nevile +Neville +Nevin +Nevins +Newton +Niall +Niccolo +Nicholas +Nichole +Nichols +Nick +Nickey +Nickie +Nickolas +Nicky +Nico +Nicolas +Niels +Nigel +Niki +Nikita +Nikki +Nikolai +Nikos +Niles +Nils +Nilson +Niven +Noach +Noah +Noam +Noble +Noe +Noel +Nolan +Noland +Norbert +Norm +Norman +Normand +Normie +Norris +Northrop +Northrup +Norton +Norwood +Nunzio +Obadiah +Obadias +Oberon +Obie +Octavius +Odell +Odie +Odin +Odysseus +Olaf +Olag +Ole +Oleg +Olin +Oliver +Olivier +Olle +Ollie +Omar +Oral +Oran +Orazio +Orbadiah +Oren +Orin +Orion +Orlando +Orren +Orrin +Orson +Orton +Orville +Osbert +Osborn +Osborne +Osbourn +Osbourne +Oscar +Osgood +Osmond +Osmund +Ossie +Oswald +Oswell +Otes +Othello +Otho +Otis +Otto +Owen +Ozzie +Ozzy +Pablo +Pace +Paco +Paddie +Paddy +Padraig +Page +Paige +Pail +Palmer +Paolo +Park +Parke +Parker +Parnell +Parrnell +Parry +Parsifal +Partha +Pascal +Pascale +Pasquale +Pat +Pate +Patel +Paten +Patin +Paton +Patric +Patrice +Patricio +Patrick +Patrik +Patsy +Pattie +Patty +Paul +Paulo +Pavel +Pearce +Pedro +Peirce +Pembroke +Pen +Penn +Pennie +Penny +Penrod +Pepe +Pepillo +Pepito +Perceval +Percival +Percy +Perry +Pete +Peter +Petey +Petr +Peyter +Peyton +Phil +Philbert +Philip +Phillip +Phillipe +Phillipp +Phineas +Phip +Pierce +Pierre +Pierson +Piet +Pieter +Pietro +Piggy +Pincas +Pinchas +Pincus +Piotr +Pip +Pius +Plato +Pooh +Porter +Poul +Powell +Praneetf +Prasad +Prasun +Prent +Prentice +Prentiss +Prescott +Preston +Price +Prince +Pryce +Puff +Purcell +Putnam +Pyotr +Quent +Quentin +Quiggly +Quigly +Quigman +Quill +Quillan +Quincey +Quincy +Quinlan +Quinn +Quint +Quintin +Quinton +Quintus +Rab +Rabbi +Rabi +Rad +Radcliffe +Rafael +Rafe +Ragnar +Raimund +Rainer +Raj +Rajeev +Raleigh +Ralf +Ralph +Ram +Rameses +Ramesh +Ramon +Ramsay +Ramsey +Rand +Randal +Randall +Randell +Randi +Randie +Randolf +Randolph +Randy +Ransell +Ransom +Raoul +Raphael +Raul +Ravi +Ravil +Rawley +Ray +Raymond +Raymund +Raymundo +Raynard +Rayner +Raynor +Reagan +Red +Redford +Redmond +Reece +Reed +Rees +Reese +Reg +Regan +Regen +Reggie +Reggis +Reggy +Reginald +Reginauld +Reid +Reilly +Reinhard +Reinhold +Rem +Remington +Remus +Renado +Renaldo +Renard +Renato +Renaud +Renault +Rene +Reube +Reuben +Reuven +Rex +Rey +Reynard +Reynold +Reynolds +Reza +Rhett +Ric +Ricard +Ricardo +Riccardo +Rice +Rich +Richard +Richardo +Richie +Richmond +Richy +Rick +Rickard +Rickey +Ricki +Rickie +Ricky +Rik +Rikki +Riley +Rinaldo +Ripley +Ritch +Ritchie +Roarke +Rob +Robb +Robbert +Robbie +Robert +Roberto +Robin +Robinson +Rochester +Rock +Rockwell +Rocky +Rod +Rodd +Roddie +Roddy +Roderic +Roderich +Roderick +Roderigo +Rodge +Rodger +Rodney +Rodolfo +Rodolph +Rodolphe +Rodrick +Rodrigo +Rodrique +Rog +Roger +Rogers +Roice +Roland +Rolando +Rolf +Rolfe +Rolland +Rollin +Rollins +Rollo +Rolph +Romain +Roman +Romeo +Ron +Ronald +Ronen +Roni +Ronnie +Ronny +Roosevelt +Rory +Roscoe +Ross +Roth +Rourke +Rowland +Roy +Royal +Royce +Rube +Ruben +Rubin +Ruby +Rudd +Ruddie +Ruddy +Rudie +Rudiger +Rudolf +Rudolfo +Rudolph +Rudy +Rudyard +Rufe +Rufus +Rupert +Ruperto +Russ +Russel +Russell +Rustie +Rustin +Rusty +Rutger +Rutherford +Rutledge +Rutter +Ryan +Sal +Salem +Salim +Salman +Salmon +Salomo +Salomon +Salomone +Salvador +Salvatore +Salvidor +Sam +Sammie +Sammy +Sampson +Samson +Samuel +Samuele +Sancho +Sander +Sanders +Sanderson +Sandor +Sandro +Sandy +Sanford +Sanson +Sansone +Sarge +Sargent +Sascha +Sasha +Saul +Sauncho +Saunder +Saunders +Saunderson +Saundra +Saw +Sawyer +Sawyere +Sax +Saxe +Saxon +Say +Sayer +Sayers +Sayre +Sayres +Scarface +Schroeder +Schuyler +Scot +Scott +Scotti +Scottie +Scotty +Seamus +Sean +Sebastian +Sebastiano +Sebastien +See +Selby +Selig +Serge +Sergeant +Sergei +Sergent +Sergio +Seth +Seymour +Shadow +Shaine +Shalom +Shamus +Shamshi-Adad +Shanan +Shane +Shannan +Shannon +Shaughn +Shaun +Shaw +Shawn +Shay +Shayne +Shea +Sheff +Sheffie +Sheffield +Sheffy +Shelby +Shelden +Sheldon +Shell +Shelley +Shelton +Shem +Shep +Shepard +Shepherd +Sheppard +Shepperd +Sheridan +Sherlock +Sherlocke +Sherman +Sherwin +Sherwood +Sherwynd +Shimon +Shlomo +Sholom +Shorty +Shurlock +Shurlocke +Shurwood +Si +Sibyl +Sid +Siddhartha +Sidnee +Sidney +Siegfried +Siffre +Sig +Sigfrid +Sigfried +Sigmund +Silas +Silvain +Silvan +Silvano +Silvanus +Silvester +Silvio +Sim +Simeon +Simmonds +Simon +Simone +Sinclair +Sinclare +Sivert +Siward +Sixtus +Skell +Skelly +Skip +Skipp +Skipper +Skippie +Skippy +Skipton +Sky +Skye +Skylar +Skyler +Slade +Slim +Sloan +Sloane +Sly +Smith +Smitty +Socrates +Sol +Sollie +Solly +Solomon +Somerset +Son +Sonnie +Sonny +Sparky +Spence +Spencer +Spense +Spenser +Spike +Spiro +Spiros +Spud +Srinivas +Stacy +Staffard +Stafford +Staford +Stan +Standford +Stanfield +Stanford +Stanislaw +Stanleigh +Stanley +Stanly +Stanton +Stanwood +Stavros +Stearn +Stearne +Stefan +Stefano +Steffen +Stephan +Stephanus +Stephen +Sterling +Stern +Sterne +Steve +Steven +Stevie +Stevy +Stew +Steward +Stewart +Stig +Stillman +Stillmann +Sting +Stinky +Stirling +Stu +Stuart +Sturgis +Sullivan +Sully +Sumner +Sunny +Sutherland +Sutton +Sven +Swen +Syd +Sydney +Sylvan +Sylvester +Tab +Tabb +Tabbie +Tabby +Taber +Tabor +Tad +Tadd +Taddeo +Taddeus +Tadeas +Tailor +Tait +Taite +Talbert +Talbot +Tallie +Tally +Tam +Tamas +Tammie +Tammy +Tan +Tann +Tanner +Tanney +Tannie +Tanny +Tarrance +Tarrant +Tarzan +Tate +Taylor +Teador +Ted +Tedd +Teddie +Teddy +Tedie +Tedman +Tedmund +Tedrick +Temp +Temple +Templeton +Teodoor +Teodor +Teodorico +Teodoro +Terence +Terencio +Terrance +Terrel +Terrell +Terrence +Terri +Terrill +Terry +Thacher +Thad +Thaddeus +Thaddius +Thaddus +Thadeus +Thain +Thaine +Thane +Tharen +Thatch +Thatcher +Thaxter +Thayne +Thebault +Thedric +Thedrick +Theo +Theobald +Theodor +Theodore +Theodoric +Theophyllus +Thibaud +Thibaut +Thom +Thomas +Thor +Thorn +Thorndike +Thornie +Thornton +Thorny +Thorpe +Thorstein +Thorsten +Thorvald +Thurstan +Thurston +Tibold +Tiebold +Tiebout +Tiler +Tim +Timmie +Timmy +Timothee +Timotheus +Timothy +Tirrell +Tito +Titos +Titus +Tobe +Tobiah +Tobias +Tobie +Tobin +Tobit +Toby +Tod +Todd +Toddie +Toddy +Tom +Tomas +Tome +Tomkin +Tomlin +Tommie +Tommy +Tonnie +Tony +Tore +Torey +Torin +Torr +Torrance +Torre +Torrence +Torrey +Torrin +Torry +Town +Towney +Townie +Townsend +Towny +Trace +Tracey +Tracie +Tracy +Traver +Travers +Travis +Tray +Tre +Tremain +Tremaine +Tremayne +Trent +Trenton +Trev +Trevar +Trever +Trevor +Trey +Trip +Tristan +Troy +Truman +Tuck +Tucker +Tuckie +Tucky +Tudor +Tull +Tulley +Tully +Turner +Ty +Tybalt +Tye +Tyler +Tymon +Tymothy +Tynan +Tyrone +Tyrus +Tyson +Udale +Udall +Udell +Ugo +Ulberto +Uli +Ulick +Ulises +Ulric +Ulrich +Ulrick +Ulysses +Umberto +Upton +Urbain +Urban +Urbano +Urbanus +Uri +Uriah +Uriel +Urson +Vachel +Vaclav +Vail +Val +Valdemar +Vale +Valentin +Valentine +Valentinian +Van +Vance +Vasili +Vasilis +Vasily +Vassili +Vassily +Vaughan +Vaughn +Venkat +Verge +Vergil +Vern +Verne +Vernen +Verney +Vernon +Vernor +Vic +Vick +Victor +Vijay +Vilhelm +Vin +Vince +Vincent +Vincents +Vinnie +Vinny +Vinod +Virge +Virgie +Virgil +Virgilio +Vite +Vito +Vlad +Vladamir +Vladimir +Voltaire +Von +Wade +Wadsworth +Wain +Waine +Wainwright +Wait +Waite +Waiter +Wake +Wakefield +Wald +Waldemar +Walden +Waldo +Waldon +Waleed +Walker +Wallace +Wallache +Wallas +Wallie +Wallis +Wally +Walsh +Walt +Walter +Walther +Walton +Wang +Ward +Warde +Warden +Ware +Waring +Warner +Warren +Wash +Washington +Wat +Waverley +Waverly +Way +Waylan +Wayland +Waylen +Waylin +Waylon +Wayne +Web +Webb +Weber +Webster +Weidar +Weider +Welbie +Welby +Welch +Wells +Welsh +Wendall +Wendel +Wendell +Werner +Wes +Wesley +Weslie +West +Westbrook +Westbrooke +Westleigh +Westley +Weston +Weylin +Wheeler +Whit +Whitaker +Whitby +Whitman +Whitney +Whittaker +Wiatt +Wilber +Wilbert +Wilbur +Wilburn +Wilburt +Wilden +Wildon +Wilek +Wiley +Wilfred +Wilfrid +Wilhelm +Will +Willard +Willdon +Willem +Willey +Willi +William +Willie +Willis +Willmott +Willy +Wilmar +Wilmer +Wilson +Wilt +Wilton +Win +Windham +Winfield +Winford +Winfred +Winifield +Winn +Winnie +Winny +Winslow +Winston +Winthrop +Winton +Wit +Witold +Wittie +Witty +Wojciech +Wolfgang +Wolfie +Wolfram +Wolfy +Woochang +Woodie +Woodman +Woodrow +Woody +Worden +Worthington +Worthy +Wright +Wyatan +Wyatt +Wye +Wylie +Wyn +Wyndham +Wynn +Wynton +Xavier +Xenos +Xerxes +Xever +Ximenes +Ximenez +Xymenes +Yaakov +Yacov +Yale +Yanaton +Yance +Yancey +Yancy +Yank +Yankee +Yard +Yardley +Yehudi +Yigal +Yule +Yuri +Yves +Zach +Zacharia +Zachariah +Zacharias +Zacharie +Zachary +Zacherie +Zachery +Zack +Zackariah +Zak +Zalman +Zane +Zared +Zary +Zeb +Zebadiah +Zebedee +Zebulen +Zebulon +Zechariah +Zed +Zedekiah +Zeke +Zelig +Zerk +Zeus +Zippy +Zollie +Zolly +Zorro +Rahul +Shumeet +Vibhu diff --git a/fun_text_processing/text_normalization/en/data/roman/roman_to_spoken.tsv b/fun_text_processing/text_normalization/en/data/roman/roman_to_spoken.tsv new file mode 100644 index 0000000..971c90e --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/roman/roman_to_spoken.tsv @@ -0,0 +1,2000 @@ +I one +II two +III three +IV four +V five +VI six +VII seven +VIII eight +IX nine +X ten +XI eleven +XII twelve +XIII thirteen +XIV fourteen +XV fifteen +XVI sixteen +XVII seventeen +XVIII eighteen +XIX nineteen +XX twenty +XXI twenty one +XXII twenty two +XXIII twenty three +XXIV twenty four +XXV twenty five +XXVI twenty six +XXVII twenty seven +XXVIII twenty eight +XXIX twenty nine +XXX thirty +XXXI thirty one +XXXII thirty two +XXXIII thirty three +XXXIV thirty four +XXXV thirty five +XXXVI thirty six +XXXVII thirty seven +XXXVIII thirty eight +XXXIX thirty nine +XL forty +XLI forty one +XLII forty two +XLIII forty three +XLIV forty four +XLV forty five +XLVI forty six +XLVII forty seven +XLVIII forty eight +XLIX forty nine +L fifty +LI fifty one +LII fifty two +LIII fifty three +LIV fifty four +LV fifty five +LVI fifty six +LVII fifty seven +LVIII fifty eight +LIX fifty nine +LX sixty +LXI sixty one +LXII sixty two +LXIII sixty three +LXIV sixty four +LXV sixty five +LXVI sixty six +LXVII sixty seven +LXVIII sixty eight +LXIX sixty nine +LXX seventy +LXXI seventy one +LXXII seventy two +LXXIII seventy three +LXXIV seventy four +LXXV seventy five +LXXVI seventy six +LXXVII seventy seven +LXXVIII seventy eight +LXXIX seventy nine +LXXX eighty +LXXXI eighty one +LXXXII eighty two +LXXXIII eighty three +LXXXIV eighty four +LXXXV eighty five +LXXXVI eighty six +LXXXVII eighty seven +LXXXVIII eighty eight +LXXXIX eighty nine +XC ninety +XCI ninety one +XCII ninety two +XCIII ninety three +XCIV ninety four +XCV ninety five +XCVI ninety six +XCVII ninety seven +XCVIII ninety eight +XCIX ninety nine +C one hundred +CI one hundred one +CII one hundred two +CIII one hundred three +CIV one hundred four +CV one hundred five +CVI one hundred six +CVII one hundred seven +CVIII one hundred eight +CIX one hundred nine +CX one hundred ten +CXI one hundred eleven +CXII one hundred twelve +CXIII one hundred thirteen +CXIV one hundred fourteen +CXV one hundred fifteen +CXVI one hundred sixteen +CXVII one hundred seventeen +CXVIII one hundred eighteen +CXIX one hundred nineteen +CXX one hundred twenty +CXXI one hundred twenty one +CXXII one hundred twenty two +CXXIII one hundred twenty three +CXXIV one hundred twenty four +CXXV one hundred twenty five +CXXVI one hundred twenty six +CXXVII one hundred twenty seven +CXXVIII one hundred twenty eight +CXXIX one hundred twenty nine +CXXX one hundred thirty +CXXXI one hundred thirty one +CXXXII one hundred thirty two +CXXXIII one hundred thirty three +CXXXIV one hundred thirty four +CXXXV one hundred thirty five +CXXXVI one hundred thirty six +CXXXVII one hundred thirty seven +CXXXVIII one hundred thirty eight +CXXXIX one hundred thirty nine +CXL one hundred forty +CXLI one hundred forty one +CXLII one hundred forty two +CXLIII one hundred forty three +CXLIV one hundred forty four +CXLV one hundred forty five +CXLVI one hundred forty six +CXLVII one hundred forty seven +CXLVIII one hundred forty eight +CXLIX one hundred forty nine +CL one hundred fifty +CLI one hundred fifty one +CLII one hundred fifty two +CLIII one hundred fifty three +CLIV one hundred fifty four +CLV one hundred fifty five +CLVI one hundred fifty six +CLVII one hundred fifty seven +CLVIII one hundred fifty eight +CLIX one hundred fifty nine +CLX one hundred sixty +CLXI one hundred sixty one +CLXII one hundred sixty two +CLXIII one hundred sixty three +CLXIV one hundred sixty four +CLXV one hundred sixty five +CLXVI one hundred sixty six +CLXVII one hundred sixty seven +CLXVIII one hundred sixty eight +CLXIX one hundred sixty nine +CLXX one hundred seventy +CLXXI one hundred seventy one +CLXXII one hundred seventy two +CLXXIII one hundred seventy three +CLXXIV one hundred seventy four +CLXXV one hundred seventy five +CLXXVI one hundred seventy six +CLXXVII one hundred seventy seven +CLXXVIII one hundred seventy eight +CLXXIX one hundred seventy nine +CLXXX one hundred eighty +CLXXXI one hundred eighty one +CLXXXII one hundred eighty two +CLXXXIII one hundred eighty three +CLXXXIV one hundred eighty four +CLXXXV one hundred eighty five +CLXXXVI one hundred eighty six +CLXXXVII one hundred eighty seven +CLXXXVIII one hundred eighty eight +CLXXXIX one hundred eighty nine +CXC one hundred ninety +CXCI one hundred ninety one +CXCII one hundred ninety two +CXCIII one hundred ninety three +CXCIV one hundred ninety four +CXCV one hundred ninety five +CXCVI one hundred ninety six +CXCVII one hundred ninety seven +CXCVIII one hundred ninety eight +CXCIX one hundred ninety nine +CC two hundred +CCI two hundred one +CCII two hundred two +CCIII two hundred three +CCIV two hundred four +CCV two hundred five +CCVI two hundred six +CCVII two hundred seven +CCVIII two hundred eight +CCIX two hundred nine +CCX two hundred ten +CCXI two hundred eleven +CCXII two hundred twelve +CCXIII two hundred thirteen +CCXIV two hundred fourteen +CCXV two hundred fifteen +CCXVI two hundred sixteen +CCXVII two hundred seventeen +CCXVIII two hundred eighteen +CCXIX two hundred nineteen +CCXX two hundred twenty +CCXXI two hundred twenty one +CCXXII two hundred twenty two +CCXXIII two hundred twenty three +CCXXIV two hundred twenty four +CCXXV two hundred twenty five +CCXXVI two hundred twenty six +CCXXVII two hundred twenty seven +CCXXVIII two hundred twenty eight +CCXXIX two hundred twenty nine +CCXXX two hundred thirty +CCXXXI two hundred thirty one +CCXXXII two hundred thirty two +CCXXXIII two hundred thirty three +CCXXXIV two hundred thirty four +CCXXXV two hundred thirty five +CCXXXVI two hundred thirty six +CCXXXVII two hundred thirty seven +CCXXXVIII two hundred thirty eight +CCXXXIX two hundred thirty nine +CCXL two hundred forty +CCXLI two hundred forty one +CCXLII two hundred forty two +CCXLIII two hundred forty three +CCXLIV two hundred forty four +CCXLV two hundred forty five +CCXLVI two hundred forty six +CCXLVII two hundred forty seven +CCXLVIII two hundred forty eight +CCXLIX two hundred forty nine +CCL two hundred fifty +CCLI two hundred fifty one +CCLII two hundred fifty two +CCLIII two hundred fifty three +CCLIV two hundred fifty four +CCLV two hundred fifty five +CCLVI two hundred fifty six +CCLVII two hundred fifty seven +CCLVIII two hundred fifty eight +CCLIX two hundred fifty nine +CCLX two hundred sixty +CCLXI two hundred sixty one +CCLXII two hundred sixty two +CCLXIII two hundred sixty three +CCLXIV two hundred sixty four +CCLXV two hundred sixty five +CCLXVI two hundred sixty six +CCLXVII two hundred sixty seven +CCLXVIII two hundred sixty eight +CCLXIX two hundred sixty nine +CCLXX two hundred seventy +CCLXXI two hundred seventy one +CCLXXII two hundred seventy two +CCLXXIII two hundred seventy three +CCLXXIV two hundred seventy four +CCLXXV two hundred seventy five +CCLXXVI two hundred seventy six +CCLXXVII two hundred seventy seven +CCLXXVIII two hundred seventy eight +CCLXXIX two hundred seventy nine +CCLXXX two hundred eighty +CCLXXXI two hundred eighty one +CCLXXXII two hundred eighty two +CCLXXXIII two hundred eighty three +CCLXXXIV two hundred eighty four +CCLXXXV two hundred eighty five +CCLXXXVI two hundred eighty six +CCLXXXVII two hundred eighty seven +CCLXXXVIII two hundred eighty eight +CCLXXXIX two hundred eighty nine +CCXC two hundred ninety +CCXCI two hundred ninety one +CCXCII two hundred ninety two +CCXCIII two hundred ninety three +CCXCIV two hundred ninety four +CCXCV two hundred ninety five +CCXCVI two hundred ninety six +CCXCVII two hundred ninety seven +CCXCVIII two hundred ninety eight +CCXCIX two hundred ninety nine +CCC three hundred +CCCI three hundred one +CCCII three hundred two +CCCIII three hundred three +CCCIV three hundred four +CCCV three hundred five +CCCVI three hundred six +CCCVII three hundred seven +CCCVIII three hundred eight +CCCIX three hundred nine +CCCX three hundred ten +CCCXI three hundred eleven +CCCXII three hundred twelve +CCCXIII three hundred thirteen +CCCXIV three hundred fourteen +CCCXV three hundred fifteen +CCCXVI three hundred sixteen +CCCXVII three hundred seventeen +CCCXVIII three hundred eighteen +CCCXIX three hundred nineteen +CCCXX three hundred twenty +CCCXXI three hundred twenty one +CCCXXII three hundred twenty two +CCCXXIII three hundred twenty three +CCCXXIV three hundred twenty four +CCCXXV three hundred twenty five +CCCXXVI three hundred twenty six +CCCXXVII three hundred twenty seven +CCCXXVIII three hundred twenty eight +CCCXXIX three hundred twenty nine +CCCXXX three hundred thirty +CCCXXXI three hundred thirty one +CCCXXXII three hundred thirty two +CCCXXXIII three hundred thirty three +CCCXXXIV three hundred thirty four +CCCXXXV three hundred thirty five +CCCXXXVI three hundred thirty six +CCCXXXVII three hundred thirty seven +CCCXXXVIII three hundred thirty eight +CCCXXXIX three hundred thirty nine +CCCXL three hundred forty +CCCXLI three hundred forty one +CCCXLII three hundred forty two +CCCXLIII three hundred forty three +CCCXLIV three hundred forty four +CCCXLV three hundred forty five +CCCXLVI three hundred forty six +CCCXLVII three hundred forty seven +CCCXLVIII three hundred forty eight +CCCXLIX three hundred forty nine +CCCL three hundred fifty +CCCLI three hundred fifty one +CCCLII three hundred fifty two +CCCLIII three hundred fifty three +CCCLIV three hundred fifty four +CCCLV three hundred fifty five +CCCLVI three hundred fifty six +CCCLVII three hundred fifty seven +CCCLVIII three hundred fifty eight +CCCLIX three hundred fifty nine +CCCLX three hundred sixty +CCCLXI three hundred sixty one +CCCLXII three hundred sixty two +CCCLXIII three hundred sixty three +CCCLXIV three hundred sixty four +CCCLXV three hundred sixty five +CCCLXVI three hundred sixty six +CCCLXVII three hundred sixty seven +CCCLXVIII three hundred sixty eight +CCCLXIX three hundred sixty nine +CCCLXX three hundred seventy +CCCLXXI three hundred seventy one +CCCLXXII three hundred seventy two +CCCLXXIII three hundred seventy three +CCCLXXIV three hundred seventy four +CCCLXXV three hundred seventy five +CCCLXXVI three hundred seventy six +CCCLXXVII three hundred seventy seven +CCCLXXVIII three hundred seventy eight +CCCLXXIX three hundred seventy nine +CCCLXXX three hundred eighty +CCCLXXXI three hundred eighty one +CCCLXXXII three hundred eighty two +CCCLXXXIII three hundred eighty three +CCCLXXXIV three hundred eighty four +CCCLXXXV three hundred eighty five +CCCLXXXVI three hundred eighty six +CCCLXXXVII three hundred eighty seven +CCCLXXXVIII three hundred eighty eight +CCCLXXXIX three hundred eighty nine +CCCXC three hundred ninety +CCCXCI three hundred ninety one +CCCXCII three hundred ninety two +CCCXCIII three hundred ninety three +CCCXCIV three hundred ninety four +CCCXCV three hundred ninety five +CCCXCVI three hundred ninety six +CCCXCVII three hundred ninety seven +CCCXCVIII three hundred ninety eight +CCCXCIX three hundred ninety nine +CD four hundred +CDI four hundred one +CDII four hundred two +CDIII four hundred three +CDIV four hundred four +CDV four hundred five +CDVI four hundred six +CDVII four hundred seven +CDVIII four hundred eight +CDIX four hundred nine +CDX four hundred ten +CDXI four hundred eleven +CDXII four hundred twelve +CDXIII four hundred thirteen +CDXIV four hundred fourteen +CDXV four hundred fifteen +CDXVI four hundred sixteen +CDXVII four hundred seventeen +CDXVIII four hundred eighteen +CDXIX four hundred nineteen +CDXX four hundred twenty +CDXXI four hundred twenty one +CDXXII four hundred twenty two +CDXXIII four hundred twenty three +CDXXIV four hundred twenty four +CDXXV four hundred twenty five +CDXXVI four hundred twenty six +CDXXVII four hundred twenty seven +CDXXVIII four hundred twenty eight +CDXXIX four hundred twenty nine +CDXXX four hundred thirty +CDXXXI four hundred thirty one +CDXXXII four hundred thirty two +CDXXXIII four hundred thirty three +CDXXXIV four hundred thirty four +CDXXXV four hundred thirty five +CDXXXVI four hundred thirty six +CDXXXVII four hundred thirty seven +CDXXXVIII four hundred thirty eight +CDXXXIX four hundred thirty nine +CDXL four hundred forty +CDXLI four hundred forty one +CDXLII four hundred forty two +CDXLIII four hundred forty three +CDXLIV four hundred forty four +CDXLV four hundred forty five +CDXLVI four hundred forty six +CDXLVII four hundred forty seven +CDXLVIII four hundred forty eight +CDXLIX four hundred forty nine +CDL four hundred fifty +CDLI four hundred fifty one +CDLII four hundred fifty two +CDLIII four hundred fifty three +CDLIV four hundred fifty four +CDLV four hundred fifty five +CDLVI four hundred fifty six +CDLVII four hundred fifty seven +CDLVIII four hundred fifty eight +CDLIX four hundred fifty nine +CDLX four hundred sixty +CDLXI four hundred sixty one +CDLXII four hundred sixty two +CDLXIII four hundred sixty three +CDLXIV four hundred sixty four +CDLXV four hundred sixty five +CDLXVI four hundred sixty six +CDLXVII four hundred sixty seven +CDLXVIII four hundred sixty eight +CDLXIX four hundred sixty nine +CDLXX four hundred seventy +CDLXXI four hundred seventy one +CDLXXII four hundred seventy two +CDLXXIII four hundred seventy three +CDLXXIV four hundred seventy four +CDLXXV four hundred seventy five +CDLXXVI four hundred seventy six +CDLXXVII four hundred seventy seven +CDLXXVIII four hundred seventy eight +CDLXXIX four hundred seventy nine +CDLXXX four hundred eighty +CDLXXXI four hundred eighty one +CDLXXXII four hundred eighty two +CDLXXXIII four hundred eighty three +CDLXXXIV four hundred eighty four +CDLXXXV four hundred eighty five +CDLXXXVI four hundred eighty six +CDLXXXVII four hundred eighty seven +CDLXXXVIII four hundred eighty eight +CDLXXXIX four hundred eighty nine +CDXC four hundred ninety +CDXCI four hundred ninety one +CDXCII four hundred ninety two +CDXCIII four hundred ninety three +CDXCIV four hundred ninety four +CDXCV four hundred ninety five +CDXCVI four hundred ninety six +CDXCVII four hundred ninety seven +CDXCVIII four hundred ninety eight +CDXCIX four hundred ninety nine +D five hundred +DI five hundred one +DII five hundred two +DIII five hundred three +DIV five hundred four +DV five hundred five +DVI five hundred six +DVII five hundred seven +DVIII five hundred eight +DIX five hundred nine +DX five hundred ten +DXI five hundred eleven +DXII five hundred twelve +DXIII five hundred thirteen +DXIV five hundred fourteen +DXV five hundred fifteen +DXVI five hundred sixteen +DXVII five hundred seventeen +DXVIII five hundred eighteen +DXIX five hundred nineteen +DXX five hundred twenty +DXXI five hundred twenty one +DXXII five hundred twenty two +DXXIII five hundred twenty three +DXXIV five hundred twenty four +DXXV five hundred twenty five +DXXVI five hundred twenty six +DXXVII five hundred twenty seven +DXXVIII five hundred twenty eight +DXXIX five hundred twenty nine +DXXX five hundred thirty +DXXXI five hundred thirty one +DXXXII five hundred thirty two +DXXXIII five hundred thirty three +DXXXIV five hundred thirty four +DXXXV five hundred thirty five +DXXXVI five hundred thirty six +DXXXVII five hundred thirty seven +DXXXVIII five hundred thirty eight +DXXXIX five hundred thirty nine +DXL five hundred forty +DXLI five hundred forty one +DXLII five hundred forty two +DXLIII five hundred forty three +DXLIV five hundred forty four +DXLV five hundred forty five +DXLVI five hundred forty six +DXLVII five hundred forty seven +DXLVIII five hundred forty eight +DXLIX five hundred forty nine +DL five hundred fifty +DLI five hundred fifty one +DLII five hundred fifty two +DLIII five hundred fifty three +DLIV five hundred fifty four +DLV five hundred fifty five +DLVI five hundred fifty six +DLVII five hundred fifty seven +DLVIII five hundred fifty eight +DLIX five hundred fifty nine +DLX five hundred sixty +DLXI five hundred sixty one +DLXII five hundred sixty two +DLXIII five hundred sixty three +DLXIV five hundred sixty four +DLXV five hundred sixty five +DLXVI five hundred sixty six +DLXVII five hundred sixty seven +DLXVIII five hundred sixty eight +DLXIX five hundred sixty nine +DLXX five hundred seventy +DLXXI five hundred seventy one +DLXXII five hundred seventy two +DLXXIII five hundred seventy three +DLXXIV five hundred seventy four +DLXXV five hundred seventy five +DLXXVI five hundred seventy six +DLXXVII five hundred seventy seven +DLXXVIII five hundred seventy eight +DLXXIX five hundred seventy nine +DLXXX five hundred eighty +DLXXXI five hundred eighty one +DLXXXII five hundred eighty two +DLXXXIII five hundred eighty three +DLXXXIV five hundred eighty four +DLXXXV five hundred eighty five +DLXXXVI five hundred eighty six +DLXXXVII five hundred eighty seven +DLXXXVIII five hundred eighty eight +DLXXXIX five hundred eighty nine +DXC five hundred ninety +DXCI five hundred ninety one +DXCII five hundred ninety two +DXCIII five hundred ninety three +DXCIV five hundred ninety four +DXCV five hundred ninety five +DXCVI five hundred ninety six +DXCVII five hundred ninety seven +DXCVIII five hundred ninety eight +DXCIX five hundred ninety nine +DC six hundred +DCI six hundred one +DCII six hundred two +DCIII six hundred three +DCIV six hundred four +DCV six hundred five +DCVI six hundred six +DCVII six hundred seven +DCVIII six hundred eight +DCIX six hundred nine +DCX six hundred ten +DCXI six hundred eleven +DCXII six hundred twelve +DCXIII six hundred thirteen +DCXIV six hundred fourteen +DCXV six hundred fifteen +DCXVI six hundred sixteen +DCXVII six hundred seventeen +DCXVIII six hundred eighteen +DCXIX six hundred nineteen +DCXX six hundred twenty +DCXXI six hundred twenty one +DCXXII six hundred twenty two +DCXXIII six hundred twenty three +DCXXIV six hundred twenty four +DCXXV six hundred twenty five +DCXXVI six hundred twenty six +DCXXVII six hundred twenty seven +DCXXVIII six hundred twenty eight +DCXXIX six hundred twenty nine +DCXXX six hundred thirty +DCXXXI six hundred thirty one +DCXXXII six hundred thirty two +DCXXXIII six hundred thirty three +DCXXXIV six hundred thirty four +DCXXXV six hundred thirty five +DCXXXVI six hundred thirty six +DCXXXVII six hundred thirty seven +DCXXXVIII six hundred thirty eight +DCXXXIX six hundred thirty nine +DCXL six hundred forty +DCXLI six hundred forty one +DCXLII six hundred forty two +DCXLIII six hundred forty three +DCXLIV six hundred forty four +DCXLV six hundred forty five +DCXLVI six hundred forty six +DCXLVII six hundred forty seven +DCXLVIII six hundred forty eight +DCXLIX six hundred forty nine +DCL six hundred fifty +DCLI six hundred fifty one +DCLII six hundred fifty two +DCLIII six hundred fifty three +DCLIV six hundred fifty four +DCLV six hundred fifty five +DCLVI six hundred fifty six +DCLVII six hundred fifty seven +DCLVIII six hundred fifty eight +DCLIX six hundred fifty nine +DCLX six hundred sixty +DCLXI six hundred sixty one +DCLXII six hundred sixty two +DCLXIII six hundred sixty three +DCLXIV six hundred sixty four +DCLXV six hundred sixty five +DCLXVI six hundred sixty six +DCLXVII six hundred sixty seven +DCLXVIII six hundred sixty eight +DCLXIX six hundred sixty nine +DCLXX six hundred seventy +DCLXXI six hundred seventy one +DCLXXII six hundred seventy two +DCLXXIII six hundred seventy three +DCLXXIV six hundred seventy four +DCLXXV six hundred seventy five +DCLXXVI six hundred seventy six +DCLXXVII six hundred seventy seven +DCLXXVIII six hundred seventy eight +DCLXXIX six hundred seventy nine +DCLXXX six hundred eighty +DCLXXXI six hundred eighty one +DCLXXXII six hundred eighty two +DCLXXXIII six hundred eighty three +DCLXXXIV six hundred eighty four +DCLXXXV six hundred eighty five +DCLXXXVI six hundred eighty six +DCLXXXVII six hundred eighty seven +DCLXXXVIII six hundred eighty eight +DCLXXXIX six hundred eighty nine +DCXC six hundred ninety +DCXCI six hundred ninety one +DCXCII six hundred ninety two +DCXCIII six hundred ninety three +DCXCIV six hundred ninety four +DCXCV six hundred ninety five +DCXCVI six hundred ninety six +DCXCVII six hundred ninety seven +DCXCVIII six hundred ninety eight +DCXCIX six hundred ninety nine +DCC seven hundred +DCCI seven hundred one +DCCII seven hundred two +DCCIII seven hundred three +DCCIV seven hundred four +DCCV seven hundred five +DCCVI seven hundred six +DCCVII seven hundred seven +DCCVIII seven hundred eight +DCCIX seven hundred nine +DCCX seven hundred ten +DCCXI seven hundred eleven +DCCXII seven hundred twelve +DCCXIII seven hundred thirteen +DCCXIV seven hundred fourteen +DCCXV seven hundred fifteen +DCCXVI seven hundred sixteen +DCCXVII seven hundred seventeen +DCCXVIII seven hundred eighteen +DCCXIX seven hundred nineteen +DCCXX seven hundred twenty +DCCXXI seven hundred twenty one +DCCXXII seven hundred twenty two +DCCXXIII seven hundred twenty three +DCCXXIV seven hundred twenty four +DCCXXV seven hundred twenty five +DCCXXVI seven hundred twenty six +DCCXXVII seven hundred twenty seven +DCCXXVIII seven hundred twenty eight +DCCXXIX seven hundred twenty nine +DCCXXX seven hundred thirty +DCCXXXI seven hundred thirty one +DCCXXXII seven hundred thirty two +DCCXXXIII seven hundred thirty three +DCCXXXIV seven hundred thirty four +DCCXXXV seven hundred thirty five +DCCXXXVI seven hundred thirty six +DCCXXXVII seven hundred thirty seven +DCCXXXVIII seven hundred thirty eight +DCCXXXIX seven hundred thirty nine +DCCXL seven hundred forty +DCCXLI seven hundred forty one +DCCXLII seven hundred forty two +DCCXLIII seven hundred forty three +DCCXLIV seven hundred forty four +DCCXLV seven hundred forty five +DCCXLVI seven hundred forty six +DCCXLVII seven hundred forty seven +DCCXLVIII seven hundred forty eight +DCCXLIX seven hundred forty nine +DCCL seven hundred fifty +DCCLI seven hundred fifty one +DCCLII seven hundred fifty two +DCCLIII seven hundred fifty three +DCCLIV seven hundred fifty four +DCCLV seven hundred fifty five +DCCLVI seven hundred fifty six +DCCLVII seven hundred fifty seven +DCCLVIII seven hundred fifty eight +DCCLIX seven hundred fifty nine +DCCLX seven hundred sixty +DCCLXI seven hundred sixty one +DCCLXII seven hundred sixty two +DCCLXIII seven hundred sixty three +DCCLXIV seven hundred sixty four +DCCLXV seven hundred sixty five +DCCLXVI seven hundred sixty six +DCCLXVII seven hundred sixty seven +DCCLXVIII seven hundred sixty eight +DCCLXIX seven hundred sixty nine +DCCLXX seven hundred seventy +DCCLXXI seven hundred seventy one +DCCLXXII seven hundred seventy two +DCCLXXIII seven hundred seventy three +DCCLXXIV seven hundred seventy four +DCCLXXV seven hundred seventy five +DCCLXXVI seven hundred seventy six +DCCLXXVII seven hundred seventy seven +DCCLXXVIII seven hundred seventy eight +DCCLXXIX seven hundred seventy nine +DCCLXXX seven hundred eighty +DCCLXXXI seven hundred eighty one +DCCLXXXII seven hundred eighty two +DCCLXXXIII seven hundred eighty three +DCCLXXXIV seven hundred eighty four +DCCLXXXV seven hundred eighty five +DCCLXXXVI seven hundred eighty six +DCCLXXXVII seven hundred eighty seven +DCCLXXXVIII seven hundred eighty eight +DCCLXXXIX seven hundred eighty nine +DCCXC seven hundred ninety +DCCXCI seven hundred ninety one +DCCXCII seven hundred ninety two +DCCXCIII seven hundred ninety three +DCCXCIV seven hundred ninety four +DCCXCV seven hundred ninety five +DCCXCVI seven hundred ninety six +DCCXCVII seven hundred ninety seven +DCCXCVIII seven hundred ninety eight +DCCXCIX seven hundred ninety nine +DCCC eight hundred +DCCCI eight hundred one +DCCCII eight hundred two +DCCCIII eight hundred three +DCCCIV eight hundred four +DCCCV eight hundred five +DCCCVI eight hundred six +DCCCVII eight hundred seven +DCCCVIII eight hundred eight +DCCCIX eight hundred nine +DCCCX eight hundred ten +DCCCXI eight hundred eleven +DCCCXII eight hundred twelve +DCCCXIII eight hundred thirteen +DCCCXIV eight hundred fourteen +DCCCXV eight hundred fifteen +DCCCXVI eight hundred sixteen +DCCCXVII eight hundred seventeen +DCCCXVIII eight hundred eighteen +DCCCXIX eight hundred nineteen +DCCCXX eight hundred twenty +DCCCXXI eight hundred twenty one +DCCCXXII eight hundred twenty two +DCCCXXIII eight hundred twenty three +DCCCXXIV eight hundred twenty four +DCCCXXV eight hundred twenty five +DCCCXXVI eight hundred twenty six +DCCCXXVII eight hundred twenty seven +DCCCXXVIII eight hundred twenty eight +DCCCXXIX eight hundred twenty nine +DCCCXXX eight hundred thirty +DCCCXXXI eight hundred thirty one +DCCCXXXII eight hundred thirty two +DCCCXXXIII eight hundred thirty three +DCCCXXXIV eight hundred thirty four +DCCCXXXV eight hundred thirty five +DCCCXXXVI eight hundred thirty six +DCCCXXXVII eight hundred thirty seven +DCCCXXXVIII eight hundred thirty eight +DCCCXXXIX eight hundred thirty nine +DCCCXL eight hundred forty +DCCCXLI eight hundred forty one +DCCCXLII eight hundred forty two +DCCCXLIII eight hundred forty three +DCCCXLIV eight hundred forty four +DCCCXLV eight hundred forty five +DCCCXLVI eight hundred forty six +DCCCXLVII eight hundred forty seven +DCCCXLVIII eight hundred forty eight +DCCCXLIX eight hundred forty nine +DCCCL eight hundred fifty +DCCCLI eight hundred fifty one +DCCCLII eight hundred fifty two +DCCCLIII eight hundred fifty three +DCCCLIV eight hundred fifty four +DCCCLV eight hundred fifty five +DCCCLVI eight hundred fifty six +DCCCLVII eight hundred fifty seven +DCCCLVIII eight hundred fifty eight +DCCCLIX eight hundred fifty nine +DCCCLX eight hundred sixty +DCCCLXI eight hundred sixty one +DCCCLXII eight hundred sixty two +DCCCLXIII eight hundred sixty three +DCCCLXIV eight hundred sixty four +DCCCLXV eight hundred sixty five +DCCCLXVI eight hundred sixty six +DCCCLXVII eight hundred sixty seven +DCCCLXVIII eight hundred sixty eight +DCCCLXIX eight hundred sixty nine +DCCCLXX eight hundred seventy +DCCCLXXI eight hundred seventy one +DCCCLXXII eight hundred seventy two +DCCCLXXIII eight hundred seventy three +DCCCLXXIV eight hundred seventy four +DCCCLXXV eight hundred seventy five +DCCCLXXVI eight hundred seventy six +DCCCLXXVII eight hundred seventy seven +DCCCLXXVIII eight hundred seventy eight +DCCCLXXIX eight hundred seventy nine +DCCCLXXX eight hundred eighty +DCCCLXXXI eight hundred eighty one +DCCCLXXXII eight hundred eighty two +DCCCLXXXIII eight hundred eighty three +DCCCLXXXIV eight hundred eighty four +DCCCLXXXV eight hundred eighty five +DCCCLXXXVI eight hundred eighty six +DCCCLXXXVII eight hundred eighty seven +DCCCLXXXVIII eight hundred eighty eight +DCCCLXXXIX eight hundred eighty nine +DCCCXC eight hundred ninety +DCCCXCI eight hundred ninety one +DCCCXCII eight hundred ninety two +DCCCXCIII eight hundred ninety three +DCCCXCIV eight hundred ninety four +DCCCXCV eight hundred ninety five +DCCCXCVI eight hundred ninety six +DCCCXCVII eight hundred ninety seven +DCCCXCVIII eight hundred ninety eight +DCCCXCIX eight hundred ninety nine +CM nine hundred +CMI nine hundred one +CMII nine hundred two +CMIII nine hundred three +CMIV nine hundred four +CMV nine hundred five +CMVI nine hundred six +CMVII nine hundred seven +CMVIII nine hundred eight +CMIX nine hundred nine +CMX nine hundred ten +CMXI nine hundred eleven +CMXII nine hundred twelve +CMXIII nine hundred thirteen +CMXIV nine hundred fourteen +CMXV nine hundred fifteen +CMXVI nine hundred sixteen +CMXVII nine hundred seventeen +CMXVIII nine hundred eighteen +CMXIX nine hundred nineteen +CMXX nine hundred twenty +CMXXI nine hundred twenty one +CMXXII nine hundred twenty two +CMXXIII nine hundred twenty three +CMXXIV nine hundred twenty four +CMXXV nine hundred twenty five +CMXXVI nine hundred twenty six +CMXXVII nine hundred twenty seven +CMXXVIII nine hundred twenty eight +CMXXIX nine hundred twenty nine +CMXXX nine hundred thirty +CMXXXI nine hundred thirty one +CMXXXII nine hundred thirty two +CMXXXIII nine hundred thirty three +CMXXXIV nine hundred thirty four +CMXXXV nine hundred thirty five +CMXXXVI nine hundred thirty six +CMXXXVII nine hundred thirty seven +CMXXXVIII nine hundred thirty eight +CMXXXIX nine hundred thirty nine +CMXL nine hundred forty +CMXLI nine hundred forty one +CMXLII nine hundred forty two +CMXLIII nine hundred forty three +CMXLIV nine hundred forty four +CMXLV nine hundred forty five +CMXLVI nine hundred forty six +CMXLVII nine hundred forty seven +CMXLVIII nine hundred forty eight +CMXLIX nine hundred forty nine +CML nine hundred fifty +CMLI nine hundred fifty one +CMLII nine hundred fifty two +CMLIII nine hundred fifty three +CMLIV nine hundred fifty four +CMLV nine hundred fifty five +CMLVI nine hundred fifty six +CMLVII nine hundred fifty seven +CMLVIII nine hundred fifty eight +CMLIX nine hundred fifty nine +CMLX nine hundred sixty +CMLXI nine hundred sixty one +CMLXII nine hundred sixty two +CMLXIII nine hundred sixty three +CMLXIV nine hundred sixty four +CMLXV nine hundred sixty five +CMLXVI nine hundred sixty six +CMLXVII nine hundred sixty seven +CMLXVIII nine hundred sixty eight +CMLXIX nine hundred sixty nine +CMLXX nine hundred seventy +CMLXXI nine hundred seventy one +CMLXXII nine hundred seventy two +CMLXXIII nine hundred seventy three +CMLXXIV nine hundred seventy four +CMLXXV nine hundred seventy five +CMLXXVI nine hundred seventy six +CMLXXVII nine hundred seventy seven +CMLXXVIII nine hundred seventy eight +CMLXXIX nine hundred seventy nine +CMLXXX nine hundred eighty +CMLXXXI nine hundred eighty one +CMLXXXII nine hundred eighty two +CMLXXXIII nine hundred eighty three +CMLXXXIV nine hundred eighty four +CMLXXXV nine hundred eighty five +CMLXXXVI nine hundred eighty six +CMLXXXVII nine hundred eighty seven +CMLXXXVIII nine hundred eighty eight +CMLXXXIX nine hundred eighty nine +CMXC nine hundred ninety +CMXCI nine hundred ninety one +CMXCII nine hundred ninety two +CMXCIII nine hundred ninety three +CMXCIV nine hundred ninety four +CMXCV nine hundred ninety five +CMXCVI nine hundred ninety six +CMXCVII nine hundred ninety seven +CMXCVIII nine hundred ninety eight +CMXCIX nine hundred ninety nine +M one thousand +MI one thousand one +MII one thousand two +MIII one thousand three +MIV one thousand four +MV one thousand five +MVI one thousand six +MVII one thousand seven +MVIII one thousand eight +MIX one thousand nine +MX one thousand ten +MXI one thousand eleven +MXII one thousand twelve +MXIII one thousand thirteen +MXIV one thousand fourteen +MXV one thousand fifteen +MXVI one thousand sixteen +MXVII one thousand seventeen +MXVIII one thousand eighteen +MXIX one thousand nineteen +MXX one thousand twenty +MXXI one thousand twenty one +MXXII one thousand twenty two +MXXIII one thousand twenty three +MXXIV one thousand twenty four +MXXV one thousand twenty five +MXXVI one thousand twenty six +MXXVII one thousand twenty seven +MXXVIII one thousand twenty eight +MXXIX one thousand twenty nine +MXXX one thousand thirty +MXXXI one thousand thirty one +MXXXII one thousand thirty two +MXXXIII one thousand thirty three +MXXXIV one thousand thirty four +MXXXV one thousand thirty five +MXXXVI one thousand thirty six +MXXXVII one thousand thirty seven +MXXXVIII one thousand thirty eight +MXXXIX one thousand thirty nine +MXL one thousand forty +MXLI one thousand forty one +MXLII one thousand forty two +MXLIII one thousand forty three +MXLIV one thousand forty four +MXLV one thousand forty five +MXLVI one thousand forty six +MXLVII one thousand forty seven +MXLVIII one thousand forty eight +MXLIX one thousand forty nine +ML one thousand fifty +MLI one thousand fifty one +MLII one thousand fifty two +MLIII one thousand fifty three +MLIV one thousand fifty four +MLV one thousand fifty five +MLVI one thousand fifty six +MLVII one thousand fifty seven +MLVIII one thousand fifty eight +MLIX one thousand fifty nine +MLX one thousand sixty +MLXI one thousand sixty one +MLXII one thousand sixty two +MLXIII one thousand sixty three +MLXIV one thousand sixty four +MLXV one thousand sixty five +MLXVI one thousand sixty six +MLXVII one thousand sixty seven +MLXVIII one thousand sixty eight +MLXIX one thousand sixty nine +MLXX one thousand seventy +MLXXI one thousand seventy one +MLXXII one thousand seventy two +MLXXIII one thousand seventy three +MLXXIV one thousand seventy four +MLXXV one thousand seventy five +MLXXVI one thousand seventy six +MLXXVII one thousand seventy seven +MLXXVIII one thousand seventy eight +MLXXIX one thousand seventy nine +MLXXX one thousand eighty +MLXXXI one thousand eighty one +MLXXXII one thousand eighty two +MLXXXIII one thousand eighty three +MLXXXIV one thousand eighty four +MLXXXV one thousand eighty five +MLXXXVI one thousand eighty six +MLXXXVII one thousand eighty seven +MLXXXVIII one thousand eighty eight +MLXXXIX one thousand eighty nine +MXC one thousand ninety +MXCI one thousand ninety one +MXCII one thousand ninety two +MXCIII one thousand ninety three +MXCIV one thousand ninety four +MXCV one thousand ninety five +MXCVI one thousand ninety six +MXCVII one thousand ninety seven +MXCVIII one thousand ninety eight +MXCIX one thousand ninety nine +MC one thousand, one hundred +MCI one thousand, one hundred one +MCII one thousand, one hundred two +MCIII one thousand, one hundred three +MCIV one thousand, one hundred four +MCV one thousand, one hundred five +MCVI one thousand, one hundred six +MCVII one thousand, one hundred seven +MCVIII one thousand, one hundred eight +MCIX one thousand, one hundred nine +MCX one thousand, one hundred ten +MCXI one thousand, one hundred eleven +MCXII one thousand, one hundred twelve +MCXIII one thousand, one hundred thirteen +MCXIV one thousand, one hundred fourteen +MCXV one thousand, one hundred fifteen +MCXVI one thousand, one hundred sixteen +MCXVII one thousand, one hundred seventeen +MCXVIII one thousand, one hundred eighteen +MCXIX one thousand, one hundred nineteen +MCXX one thousand, one hundred twenty +MCXXI one thousand, one hundred twenty one +MCXXII one thousand, one hundred twenty two +MCXXIII one thousand, one hundred twenty three +MCXXIV one thousand, one hundred twenty four +MCXXV one thousand, one hundred twenty five +MCXXVI one thousand, one hundred twenty six +MCXXVII one thousand, one hundred twenty seven +MCXXVIII one thousand, one hundred twenty eight +MCXXIX one thousand, one hundred twenty nine +MCXXX one thousand, one hundred thirty +MCXXXI one thousand, one hundred thirty one +MCXXXII one thousand, one hundred thirty two +MCXXXIII one thousand, one hundred thirty three +MCXXXIV one thousand, one hundred thirty four +MCXXXV one thousand, one hundred thirty five +MCXXXVI one thousand, one hundred thirty six +MCXXXVII one thousand, one hundred thirty seven +MCXXXVIII one thousand, one hundred thirty eight +MCXXXIX one thousand, one hundred thirty nine +MCXL one thousand, one hundred forty +MCXLI one thousand, one hundred forty one +MCXLII one thousand, one hundred forty two +MCXLIII one thousand, one hundred forty three +MCXLIV one thousand, one hundred forty four +MCXLV one thousand, one hundred forty five +MCXLVI one thousand, one hundred forty six +MCXLVII one thousand, one hundred forty seven +MCXLVIII one thousand, one hundred forty eight +MCXLIX one thousand, one hundred forty nine +MCL one thousand, one hundred fifty +MCLI one thousand, one hundred fifty one +MCLII one thousand, one hundred fifty two +MCLIII one thousand, one hundred fifty three +MCLIV one thousand, one hundred fifty four +MCLV one thousand, one hundred fifty five +MCLVI one thousand, one hundred fifty six +MCLVII one thousand, one hundred fifty seven +MCLVIII one thousand, one hundred fifty eight +MCLIX one thousand, one hundred fifty nine +MCLX one thousand, one hundred sixty +MCLXI one thousand, one hundred sixty one +MCLXII one thousand, one hundred sixty two +MCLXIII one thousand, one hundred sixty three +MCLXIV one thousand, one hundred sixty four +MCLXV one thousand, one hundred sixty five +MCLXVI one thousand, one hundred sixty six +MCLXVII one thousand, one hundred sixty seven +MCLXVIII one thousand, one hundred sixty eight +MCLXIX one thousand, one hundred sixty nine +MCLXX one thousand, one hundred seventy +MCLXXI one thousand, one hundred seventy one +MCLXXII one thousand, one hundred seventy two +MCLXXIII one thousand, one hundred seventy three +MCLXXIV one thousand, one hundred seventy four +MCLXXV one thousand, one hundred seventy five +MCLXXVI one thousand, one hundred seventy six +MCLXXVII one thousand, one hundred seventy seven +MCLXXVIII one thousand, one hundred seventy eight +MCLXXIX one thousand, one hundred seventy nine +MCLXXX one thousand, one hundred eighty +MCLXXXI one thousand, one hundred eighty one +MCLXXXII one thousand, one hundred eighty two +MCLXXXIII one thousand, one hundred eighty three +MCLXXXIV one thousand, one hundred eighty four +MCLXXXV one thousand, one hundred eighty five +MCLXXXVI one thousand, one hundred eighty six +MCLXXXVII one thousand, one hundred eighty seven +MCLXXXVIII one thousand, one hundred eighty eight +MCLXXXIX one thousand, one hundred eighty nine +MCXC one thousand, one hundred ninety +MCXCI one thousand, one hundred ninety one +MCXCII one thousand, one hundred ninety two +MCXCIII one thousand, one hundred ninety three +MCXCIV one thousand, one hundred ninety four +MCXCV one thousand, one hundred ninety five +MCXCVI one thousand, one hundred ninety six +MCXCVII one thousand, one hundred ninety seven +MCXCVIII one thousand, one hundred ninety eight +MCXCIX one thousand, one hundred ninety nine +MCC one thousand, two hundred +MCCI one thousand, two hundred one +MCCII one thousand, two hundred two +MCCIII one thousand, two hundred three +MCCIV one thousand, two hundred four +MCCV one thousand, two hundred five +MCCVI one thousand, two hundred six +MCCVII one thousand, two hundred seven +MCCVIII one thousand, two hundred eight +MCCIX one thousand, two hundred nine +MCCX one thousand, two hundred ten +MCCXI one thousand, two hundred eleven +MCCXII one thousand, two hundred twelve +MCCXIII one thousand, two hundred thirteen +MCCXIV one thousand, two hundred fourteen +MCCXV one thousand, two hundred fifteen +MCCXVI one thousand, two hundred sixteen +MCCXVII one thousand, two hundred seventeen +MCCXVIII one thousand, two hundred eighteen +MCCXIX one thousand, two hundred nineteen +MCCXX one thousand, two hundred twenty +MCCXXI one thousand, two hundred twenty one +MCCXXII one thousand, two hundred twenty two +MCCXXIII one thousand, two hundred twenty three +MCCXXIV one thousand, two hundred twenty four +MCCXXV one thousand, two hundred twenty five +MCCXXVI one thousand, two hundred twenty six +MCCXXVII one thousand, two hundred twenty seven +MCCXXVIII one thousand, two hundred twenty eight +MCCXXIX one thousand, two hundred twenty nine +MCCXXX one thousand, two hundred thirty +MCCXXXI one thousand, two hundred thirty one +MCCXXXII one thousand, two hundred thirty two +MCCXXXIII one thousand, two hundred thirty three +MCCXXXIV one thousand, two hundred thirty four +MCCXXXV one thousand, two hundred thirty five +MCCXXXVI one thousand, two hundred thirty six +MCCXXXVII one thousand, two hundred thirty seven +MCCXXXVIII one thousand, two hundred thirty eight +MCCXXXIX one thousand, two hundred thirty nine +MCCXL one thousand, two hundred forty +MCCXLI one thousand, two hundred forty one +MCCXLII one thousand, two hundred forty two +MCCXLIII one thousand, two hundred forty three +MCCXLIV one thousand, two hundred forty four +MCCXLV one thousand, two hundred forty five +MCCXLVI one thousand, two hundred forty six +MCCXLVII one thousand, two hundred forty seven +MCCXLVIII one thousand, two hundred forty eight +MCCXLIX one thousand, two hundred forty nine +MCCL one thousand, two hundred fifty +MCCLI one thousand, two hundred fifty one +MCCLII one thousand, two hundred fifty two +MCCLIII one thousand, two hundred fifty three +MCCLIV one thousand, two hundred fifty four +MCCLV one thousand, two hundred fifty five +MCCLVI one thousand, two hundred fifty six +MCCLVII one thousand, two hundred fifty seven +MCCLVIII one thousand, two hundred fifty eight +MCCLIX one thousand, two hundred fifty nine +MCCLX one thousand, two hundred sixty +MCCLXI one thousand, two hundred sixty one +MCCLXII one thousand, two hundred sixty two +MCCLXIII one thousand, two hundred sixty three +MCCLXIV one thousand, two hundred sixty four +MCCLXV one thousand, two hundred sixty five +MCCLXVI one thousand, two hundred sixty six +MCCLXVII one thousand, two hundred sixty seven +MCCLXVIII one thousand, two hundred sixty eight +MCCLXIX one thousand, two hundred sixty nine +MCCLXX one thousand, two hundred seventy +MCCLXXI one thousand, two hundred seventy one +MCCLXXII one thousand, two hundred seventy two +MCCLXXIII one thousand, two hundred seventy three +MCCLXXIV one thousand, two hundred seventy four +MCCLXXV one thousand, two hundred seventy five +MCCLXXVI one thousand, two hundred seventy six +MCCLXXVII one thousand, two hundred seventy seven +MCCLXXVIII one thousand, two hundred seventy eight +MCCLXXIX one thousand, two hundred seventy nine +MCCLXXX one thousand, two hundred eighty +MCCLXXXI one thousand, two hundred eighty one +MCCLXXXII one thousand, two hundred eighty two +MCCLXXXIII one thousand, two hundred eighty three +MCCLXXXIV one thousand, two hundred eighty four +MCCLXXXV one thousand, two hundred eighty five +MCCLXXXVI one thousand, two hundred eighty six +MCCLXXXVII one thousand, two hundred eighty seven +MCCLXXXVIII one thousand, two hundred eighty eight +MCCLXXXIX one thousand, two hundred eighty nine +MCCXC one thousand, two hundred ninety +MCCXCI one thousand, two hundred ninety one +MCCXCII one thousand, two hundred ninety two +MCCXCIII one thousand, two hundred ninety three +MCCXCIV one thousand, two hundred ninety four +MCCXCV one thousand, two hundred ninety five +MCCXCVI one thousand, two hundred ninety six +MCCXCVII one thousand, two hundred ninety seven +MCCXCVIII one thousand, two hundred ninety eight +MCCXCIX one thousand, two hundred ninety nine +MCCC one thousand, three hundred +MCCCI one thousand, three hundred one +MCCCII one thousand, three hundred two +MCCCIII one thousand, three hundred three +MCCCIV one thousand, three hundred four +MCCCV one thousand, three hundred five +MCCCVI one thousand, three hundred six +MCCCVII one thousand, three hundred seven +MCCCVIII one thousand, three hundred eight +MCCCIX one thousand, three hundred nine +MCCCX one thousand, three hundred ten +MCCCXI one thousand, three hundred eleven +MCCCXII one thousand, three hundred twelve +MCCCXIII one thousand, three hundred thirteen +MCCCXIV one thousand, three hundred fourteen +MCCCXV one thousand, three hundred fifteen +MCCCXVI one thousand, three hundred sixteen +MCCCXVII one thousand, three hundred seventeen +MCCCXVIII one thousand, three hundred eighteen +MCCCXIX one thousand, three hundred nineteen +MCCCXX one thousand, three hundred twenty +MCCCXXI one thousand, three hundred twenty one +MCCCXXII one thousand, three hundred twenty two +MCCCXXIII one thousand, three hundred twenty three +MCCCXXIV one thousand, three hundred twenty four +MCCCXXV one thousand, three hundred twenty five +MCCCXXVI one thousand, three hundred twenty six +MCCCXXVII one thousand, three hundred twenty seven +MCCCXXVIII one thousand, three hundred twenty eight +MCCCXXIX one thousand, three hundred twenty nine +MCCCXXX one thousand, three hundred thirty +MCCCXXXI one thousand, three hundred thirty one +MCCCXXXII one thousand, three hundred thirty two +MCCCXXXIII one thousand, three hundred thirty three +MCCCXXXIV one thousand, three hundred thirty four +MCCCXXXV one thousand, three hundred thirty five +MCCCXXXVI one thousand, three hundred thirty six +MCCCXXXVII one thousand, three hundred thirty seven +MCCCXXXVIII one thousand, three hundred thirty eight +MCCCXXXIX one thousand, three hundred thirty nine +MCCCXL one thousand, three hundred forty +MCCCXLI one thousand, three hundred forty one +MCCCXLII one thousand, three hundred forty two +MCCCXLIII one thousand, three hundred forty three +MCCCXLIV one thousand, three hundred forty four +MCCCXLV one thousand, three hundred forty five +MCCCXLVI one thousand, three hundred forty six +MCCCXLVII one thousand, three hundred forty seven +MCCCXLVIII one thousand, three hundred forty eight +MCCCXLIX one thousand, three hundred forty nine +MCCCL one thousand, three hundred fifty +MCCCLI one thousand, three hundred fifty one +MCCCLII one thousand, three hundred fifty two +MCCCLIII one thousand, three hundred fifty three +MCCCLIV one thousand, three hundred fifty four +MCCCLV one thousand, three hundred fifty five +MCCCLVI one thousand, three hundred fifty six +MCCCLVII one thousand, three hundred fifty seven +MCCCLVIII one thousand, three hundred fifty eight +MCCCLIX one thousand, three hundred fifty nine +MCCCLX one thousand, three hundred sixty +MCCCLXI one thousand, three hundred sixty one +MCCCLXII one thousand, three hundred sixty two +MCCCLXIII one thousand, three hundred sixty three +MCCCLXIV one thousand, three hundred sixty four +MCCCLXV one thousand, three hundred sixty five +MCCCLXVI one thousand, three hundred sixty six +MCCCLXVII one thousand, three hundred sixty seven +MCCCLXVIII one thousand, three hundred sixty eight +MCCCLXIX one thousand, three hundred sixty nine +MCCCLXX one thousand, three hundred seventy +MCCCLXXI one thousand, three hundred seventy one +MCCCLXXII one thousand, three hundred seventy two +MCCCLXXIII one thousand, three hundred seventy three +MCCCLXXIV one thousand, three hundred seventy four +MCCCLXXV one thousand, three hundred seventy five +MCCCLXXVI one thousand, three hundred seventy six +MCCCLXXVII one thousand, three hundred seventy seven +MCCCLXXVIII one thousand, three hundred seventy eight +MCCCLXXIX one thousand, three hundred seventy nine +MCCCLXXX one thousand, three hundred eighty +MCCCLXXXI one thousand, three hundred eighty one +MCCCLXXXII one thousand, three hundred eighty two +MCCCLXXXIII one thousand, three hundred eighty three +MCCCLXXXIV one thousand, three hundred eighty four +MCCCLXXXV one thousand, three hundred eighty five +MCCCLXXXVI one thousand, three hundred eighty six +MCCCLXXXVII one thousand, three hundred eighty seven +MCCCLXXXVIII one thousand, three hundred eighty eight +MCCCLXXXIX one thousand, three hundred eighty nine +MCCCXC one thousand, three hundred ninety +MCCCXCI one thousand, three hundred ninety one +MCCCXCII one thousand, three hundred ninety two +MCCCXCIII one thousand, three hundred ninety three +MCCCXCIV one thousand, three hundred ninety four +MCCCXCV one thousand, three hundred ninety five +MCCCXCVI one thousand, three hundred ninety six +MCCCXCVII one thousand, three hundred ninety seven +MCCCXCVIII one thousand, three hundred ninety eight +MCCCXCIX one thousand, three hundred ninety nine +MCD one thousand, four hundred +MCDI one thousand, four hundred one +MCDII one thousand, four hundred two +MCDIII one thousand, four hundred three +MCDIV one thousand, four hundred four +MCDV one thousand, four hundred five +MCDVI one thousand, four hundred six +MCDVII one thousand, four hundred seven +MCDVIII one thousand, four hundred eight +MCDIX one thousand, four hundred nine +MCDX one thousand, four hundred ten +MCDXI one thousand, four hundred eleven +MCDXII one thousand, four hundred twelve +MCDXIII one thousand, four hundred thirteen +MCDXIV one thousand, four hundred fourteen +MCDXV one thousand, four hundred fifteen +MCDXVI one thousand, four hundred sixteen +MCDXVII one thousand, four hundred seventeen +MCDXVIII one thousand, four hundred eighteen +MCDXIX one thousand, four hundred nineteen +MCDXX one thousand, four hundred twenty +MCDXXI one thousand, four hundred twenty one +MCDXXII one thousand, four hundred twenty two +MCDXXIII one thousand, four hundred twenty three +MCDXXIV one thousand, four hundred twenty four +MCDXXV one thousand, four hundred twenty five +MCDXXVI one thousand, four hundred twenty six +MCDXXVII one thousand, four hundred twenty seven +MCDXXVIII one thousand, four hundred twenty eight +MCDXXIX one thousand, four hundred twenty nine +MCDXXX one thousand, four hundred thirty +MCDXXXI one thousand, four hundred thirty one +MCDXXXII one thousand, four hundred thirty two +MCDXXXIII one thousand, four hundred thirty three +MCDXXXIV one thousand, four hundred thirty four +MCDXXXV one thousand, four hundred thirty five +MCDXXXVI one thousand, four hundred thirty six +MCDXXXVII one thousand, four hundred thirty seven +MCDXXXVIII one thousand, four hundred thirty eight +MCDXXXIX one thousand, four hundred thirty nine +MCDXL one thousand, four hundred forty +MCDXLI one thousand, four hundred forty one +MCDXLII one thousand, four hundred forty two +MCDXLIII one thousand, four hundred forty three +MCDXLIV one thousand, four hundred forty four +MCDXLV one thousand, four hundred forty five +MCDXLVI one thousand, four hundred forty six +MCDXLVII one thousand, four hundred forty seven +MCDXLVIII one thousand, four hundred forty eight +MCDXLIX one thousand, four hundred forty nine +MCDL one thousand, four hundred fifty +MCDLI one thousand, four hundred fifty one +MCDLII one thousand, four hundred fifty two +MCDLIII one thousand, four hundred fifty three +MCDLIV one thousand, four hundred fifty four +MCDLV one thousand, four hundred fifty five +MCDLVI one thousand, four hundred fifty six +MCDLVII one thousand, four hundred fifty seven +MCDLVIII one thousand, four hundred fifty eight +MCDLIX one thousand, four hundred fifty nine +MCDLX one thousand, four hundred sixty +MCDLXI one thousand, four hundred sixty one +MCDLXII one thousand, four hundred sixty two +MCDLXIII one thousand, four hundred sixty three +MCDLXIV one thousand, four hundred sixty four +MCDLXV one thousand, four hundred sixty five +MCDLXVI one thousand, four hundred sixty six +MCDLXVII one thousand, four hundred sixty seven +MCDLXVIII one thousand, four hundred sixty eight +MCDLXIX one thousand, four hundred sixty nine +MCDLXX one thousand, four hundred seventy +MCDLXXI one thousand, four hundred seventy one +MCDLXXII one thousand, four hundred seventy two +MCDLXXIII one thousand, four hundred seventy three +MCDLXXIV one thousand, four hundred seventy four +MCDLXXV one thousand, four hundred seventy five +MCDLXXVI one thousand, four hundred seventy six +MCDLXXVII one thousand, four hundred seventy seven +MCDLXXVIII one thousand, four hundred seventy eight +MCDLXXIX one thousand, four hundred seventy nine +MCDLXXX one thousand, four hundred eighty +MCDLXXXI one thousand, four hundred eighty one +MCDLXXXII one thousand, four hundred eighty two +MCDLXXXIII one thousand, four hundred eighty three +MCDLXXXIV one thousand, four hundred eighty four +MCDLXXXV one thousand, four hundred eighty five +MCDLXXXVI one thousand, four hundred eighty six +MCDLXXXVII one thousand, four hundred eighty seven +MCDLXXXVIII one thousand, four hundred eighty eight +MCDLXXXIX one thousand, four hundred eighty nine +MCDXC one thousand, four hundred ninety +MCDXCI one thousand, four hundred ninety one +MCDXCII one thousand, four hundred ninety two +MCDXCIII one thousand, four hundred ninety three +MCDXCIV one thousand, four hundred ninety four +MCDXCV one thousand, four hundred ninety five +MCDXCVI one thousand, four hundred ninety six +MCDXCVII one thousand, four hundred ninety seven +MCDXCVIII one thousand, four hundred ninety eight +MCDXCIX one thousand, four hundred ninety nine +MD one thousand, five hundred +MDI one thousand, five hundred one +MDII one thousand, five hundred two +MDIII one thousand, five hundred three +MDIV one thousand, five hundred four +MDV one thousand, five hundred five +MDVI one thousand, five hundred six +MDVII one thousand, five hundred seven +MDVIII one thousand, five hundred eight +MDIX one thousand, five hundred nine +MDX one thousand, five hundred ten +MDXI one thousand, five hundred eleven +MDXII one thousand, five hundred twelve +MDXIII one thousand, five hundred thirteen +MDXIV one thousand, five hundred fourteen +MDXV one thousand, five hundred fifteen +MDXVI one thousand, five hundred sixteen +MDXVII one thousand, five hundred seventeen +MDXVIII one thousand, five hundred eighteen +MDXIX one thousand, five hundred nineteen +MDXX one thousand, five hundred twenty +MDXXI one thousand, five hundred twenty one +MDXXII one thousand, five hundred twenty two +MDXXIII one thousand, five hundred twenty three +MDXXIV one thousand, five hundred twenty four +MDXXV one thousand, five hundred twenty five +MDXXVI one thousand, five hundred twenty six +MDXXVII one thousand, five hundred twenty seven +MDXXVIII one thousand, five hundred twenty eight +MDXXIX one thousand, five hundred twenty nine +MDXXX one thousand, five hundred thirty +MDXXXI one thousand, five hundred thirty one +MDXXXII one thousand, five hundred thirty two +MDXXXIII one thousand, five hundred thirty three +MDXXXIV one thousand, five hundred thirty four +MDXXXV one thousand, five hundred thirty five +MDXXXVI one thousand, five hundred thirty six +MDXXXVII one thousand, five hundred thirty seven +MDXXXVIII one thousand, five hundred thirty eight +MDXXXIX one thousand, five hundred thirty nine +MDXL one thousand, five hundred forty +MDXLI one thousand, five hundred forty one +MDXLII one thousand, five hundred forty two +MDXLIII one thousand, five hundred forty three +MDXLIV one thousand, five hundred forty four +MDXLV one thousand, five hundred forty five +MDXLVI one thousand, five hundred forty six +MDXLVII one thousand, five hundred forty seven +MDXLVIII one thousand, five hundred forty eight +MDXLIX one thousand, five hundred forty nine +MDL one thousand, five hundred fifty +MDLI one thousand, five hundred fifty one +MDLII one thousand, five hundred fifty two +MDLIII one thousand, five hundred fifty three +MDLIV one thousand, five hundred fifty four +MDLV one thousand, five hundred fifty five +MDLVI one thousand, five hundred fifty six +MDLVII one thousand, five hundred fifty seven +MDLVIII one thousand, five hundred fifty eight +MDLIX one thousand, five hundred fifty nine +MDLX one thousand, five hundred sixty +MDLXI one thousand, five hundred sixty one +MDLXII one thousand, five hundred sixty two +MDLXIII one thousand, five hundred sixty three +MDLXIV one thousand, five hundred sixty four +MDLXV one thousand, five hundred sixty five +MDLXVI one thousand, five hundred sixty six +MDLXVII one thousand, five hundred sixty seven +MDLXVIII one thousand, five hundred sixty eight +MDLXIX one thousand, five hundred sixty nine +MDLXX one thousand, five hundred seventy +MDLXXI one thousand, five hundred seventy one +MDLXXII one thousand, five hundred seventy two +MDLXXIII one thousand, five hundred seventy three +MDLXXIV one thousand, five hundred seventy four +MDLXXV one thousand, five hundred seventy five +MDLXXVI one thousand, five hundred seventy six +MDLXXVII one thousand, five hundred seventy seven +MDLXXVIII one thousand, five hundred seventy eight +MDLXXIX one thousand, five hundred seventy nine +MDLXXX one thousand, five hundred eighty +MDLXXXI one thousand, five hundred eighty one +MDLXXXII one thousand, five hundred eighty two +MDLXXXIII one thousand, five hundred eighty three +MDLXXXIV one thousand, five hundred eighty four +MDLXXXV one thousand, five hundred eighty five +MDLXXXVI one thousand, five hundred eighty six +MDLXXXVII one thousand, five hundred eighty seven +MDLXXXVIII one thousand, five hundred eighty eight +MDLXXXIX one thousand, five hundred eighty nine +MDXC one thousand, five hundred ninety +MDXCI one thousand, five hundred ninety one +MDXCII one thousand, five hundred ninety two +MDXCIII one thousand, five hundred ninety three +MDXCIV one thousand, five hundred ninety four +MDXCV one thousand, five hundred ninety five +MDXCVI one thousand, five hundred ninety six +MDXCVII one thousand, five hundred ninety seven +MDXCVIII one thousand, five hundred ninety eight +MDXCIX one thousand, five hundred ninety nine +MDC one thousand, six hundred +MDCI one thousand, six hundred one +MDCII one thousand, six hundred two +MDCIII one thousand, six hundred three +MDCIV one thousand, six hundred four +MDCV one thousand, six hundred five +MDCVI one thousand, six hundred six +MDCVII one thousand, six hundred seven +MDCVIII one thousand, six hundred eight +MDCIX one thousand, six hundred nine +MDCX one thousand, six hundred ten +MDCXI one thousand, six hundred eleven +MDCXII one thousand, six hundred twelve +MDCXIII one thousand, six hundred thirteen +MDCXIV one thousand, six hundred fourteen +MDCXV one thousand, six hundred fifteen +MDCXVI one thousand, six hundred sixteen +MDCXVII one thousand, six hundred seventeen +MDCXVIII one thousand, six hundred eighteen +MDCXIX one thousand, six hundred nineteen +MDCXX one thousand, six hundred twenty +MDCXXI one thousand, six hundred twenty one +MDCXXII one thousand, six hundred twenty two +MDCXXIII one thousand, six hundred twenty three +MDCXXIV one thousand, six hundred twenty four +MDCXXV one thousand, six hundred twenty five +MDCXXVI one thousand, six hundred twenty six +MDCXXVII one thousand, six hundred twenty seven +MDCXXVIII one thousand, six hundred twenty eight +MDCXXIX one thousand, six hundred twenty nine +MDCXXX one thousand, six hundred thirty +MDCXXXI one thousand, six hundred thirty one +MDCXXXII one thousand, six hundred thirty two +MDCXXXIII one thousand, six hundred thirty three +MDCXXXIV one thousand, six hundred thirty four +MDCXXXV one thousand, six hundred thirty five +MDCXXXVI one thousand, six hundred thirty six +MDCXXXVII one thousand, six hundred thirty seven +MDCXXXVIII one thousand, six hundred thirty eight +MDCXXXIX one thousand, six hundred thirty nine +MDCXL one thousand, six hundred forty +MDCXLI one thousand, six hundred forty one +MDCXLII one thousand, six hundred forty two +MDCXLIII one thousand, six hundred forty three +MDCXLIV one thousand, six hundred forty four +MDCXLV one thousand, six hundred forty five +MDCXLVI one thousand, six hundred forty six +MDCXLVII one thousand, six hundred forty seven +MDCXLVIII one thousand, six hundred forty eight +MDCXLIX one thousand, six hundred forty nine +MDCL one thousand, six hundred fifty +MDCLI one thousand, six hundred fifty one +MDCLII one thousand, six hundred fifty two +MDCLIII one thousand, six hundred fifty three +MDCLIV one thousand, six hundred fifty four +MDCLV one thousand, six hundred fifty five +MDCLVI one thousand, six hundred fifty six +MDCLVII one thousand, six hundred fifty seven +MDCLVIII one thousand, six hundred fifty eight +MDCLIX one thousand, six hundred fifty nine +MDCLX one thousand, six hundred sixty +MDCLXI one thousand, six hundred sixty one +MDCLXII one thousand, six hundred sixty two +MDCLXIII one thousand, six hundred sixty three +MDCLXIV one thousand, six hundred sixty four +MDCLXV one thousand, six hundred sixty five +MDCLXVI one thousand, six hundred sixty six +MDCLXVII one thousand, six hundred sixty seven +MDCLXVIII one thousand, six hundred sixty eight +MDCLXIX one thousand, six hundred sixty nine +MDCLXX one thousand, six hundred seventy +MDCLXXI one thousand, six hundred seventy one +MDCLXXII one thousand, six hundred seventy two +MDCLXXIII one thousand, six hundred seventy three +MDCLXXIV one thousand, six hundred seventy four +MDCLXXV one thousand, six hundred seventy five +MDCLXXVI one thousand, six hundred seventy six +MDCLXXVII one thousand, six hundred seventy seven +MDCLXXVIII one thousand, six hundred seventy eight +MDCLXXIX one thousand, six hundred seventy nine +MDCLXXX one thousand, six hundred eighty +MDCLXXXI one thousand, six hundred eighty one +MDCLXXXII one thousand, six hundred eighty two +MDCLXXXIII one thousand, six hundred eighty three +MDCLXXXIV one thousand, six hundred eighty four +MDCLXXXV one thousand, six hundred eighty five +MDCLXXXVI one thousand, six hundred eighty six +MDCLXXXVII one thousand, six hundred eighty seven +MDCLXXXVIII one thousand, six hundred eighty eight +MDCLXXXIX one thousand, six hundred eighty nine +MDCXC one thousand, six hundred ninety +MDCXCI one thousand, six hundred ninety one +MDCXCII one thousand, six hundred ninety two +MDCXCIII one thousand, six hundred ninety three +MDCXCIV one thousand, six hundred ninety four +MDCXCV one thousand, six hundred ninety five +MDCXCVI one thousand, six hundred ninety six +MDCXCVII one thousand, six hundred ninety seven +MDCXCVIII one thousand, six hundred ninety eight +MDCXCIX one thousand, six hundred ninety nine +MDCC one thousand, seven hundred +MDCCI one thousand, seven hundred one +MDCCII one thousand, seven hundred two +MDCCIII one thousand, seven hundred three +MDCCIV one thousand, seven hundred four +MDCCV one thousand, seven hundred five +MDCCVI one thousand, seven hundred six +MDCCVII one thousand, seven hundred seven +MDCCVIII one thousand, seven hundred eight +MDCCIX one thousand, seven hundred nine +MDCCX one thousand, seven hundred ten +MDCCXI one thousand, seven hundred eleven +MDCCXII one thousand, seven hundred twelve +MDCCXIII one thousand, seven hundred thirteen +MDCCXIV one thousand, seven hundred fourteen +MDCCXV one thousand, seven hundred fifteen +MDCCXVI one thousand, seven hundred sixteen +MDCCXVII one thousand, seven hundred seventeen +MDCCXVIII one thousand, seven hundred eighteen +MDCCXIX one thousand, seven hundred nineteen +MDCCXX one thousand, seven hundred twenty +MDCCXXI one thousand, seven hundred twenty one +MDCCXXII one thousand, seven hundred twenty two +MDCCXXIII one thousand, seven hundred twenty three +MDCCXXIV one thousand, seven hundred twenty four +MDCCXXV one thousand, seven hundred twenty five +MDCCXXVI one thousand, seven hundred twenty six +MDCCXXVII one thousand, seven hundred twenty seven +MDCCXXVIII one thousand, seven hundred twenty eight +MDCCXXIX one thousand, seven hundred twenty nine +MDCCXXX one thousand, seven hundred thirty +MDCCXXXI one thousand, seven hundred thirty one +MDCCXXXII one thousand, seven hundred thirty two +MDCCXXXIII one thousand, seven hundred thirty three +MDCCXXXIV one thousand, seven hundred thirty four +MDCCXXXV one thousand, seven hundred thirty five +MDCCXXXVI one thousand, seven hundred thirty six +MDCCXXXVII one thousand, seven hundred thirty seven +MDCCXXXVIII one thousand, seven hundred thirty eight +MDCCXXXIX one thousand, seven hundred thirty nine +MDCCXL one thousand, seven hundred forty +MDCCXLI one thousand, seven hundred forty one +MDCCXLII one thousand, seven hundred forty two +MDCCXLIII one thousand, seven hundred forty three +MDCCXLIV one thousand, seven hundred forty four +MDCCXLV one thousand, seven hundred forty five +MDCCXLVI one thousand, seven hundred forty six +MDCCXLVII one thousand, seven hundred forty seven +MDCCXLVIII one thousand, seven hundred forty eight +MDCCXLIX one thousand, seven hundred forty nine +MDCCL one thousand, seven hundred fifty +MDCCLI one thousand, seven hundred fifty one +MDCCLII one thousand, seven hundred fifty two +MDCCLIII one thousand, seven hundred fifty three +MDCCLIV one thousand, seven hundred fifty four +MDCCLV one thousand, seven hundred fifty five +MDCCLVI one thousand, seven hundred fifty six +MDCCLVII one thousand, seven hundred fifty seven +MDCCLVIII one thousand, seven hundred fifty eight +MDCCLIX one thousand, seven hundred fifty nine +MDCCLX one thousand, seven hundred sixty +MDCCLXI one thousand, seven hundred sixty one +MDCCLXII one thousand, seven hundred sixty two +MDCCLXIII one thousand, seven hundred sixty three +MDCCLXIV one thousand, seven hundred sixty four +MDCCLXV one thousand, seven hundred sixty five +MDCCLXVI one thousand, seven hundred sixty six +MDCCLXVII one thousand, seven hundred sixty seven +MDCCLXVIII one thousand, seven hundred sixty eight +MDCCLXIX one thousand, seven hundred sixty nine +MDCCLXX one thousand, seven hundred seventy +MDCCLXXI one thousand, seven hundred seventy one +MDCCLXXII one thousand, seven hundred seventy two +MDCCLXXIII one thousand, seven hundred seventy three +MDCCLXXIV one thousand, seven hundred seventy four +MDCCLXXV one thousand, seven hundred seventy five +MDCCLXXVI one thousand, seven hundred seventy six +MDCCLXXVII one thousand, seven hundred seventy seven +MDCCLXXVIII one thousand, seven hundred seventy eight +MDCCLXXIX one thousand, seven hundred seventy nine +MDCCLXXX one thousand, seven hundred eighty +MDCCLXXXI one thousand, seven hundred eighty one +MDCCLXXXII one thousand, seven hundred eighty two +MDCCLXXXIII one thousand, seven hundred eighty three +MDCCLXXXIV one thousand, seven hundred eighty four +MDCCLXXXV one thousand, seven hundred eighty five +MDCCLXXXVI one thousand, seven hundred eighty six +MDCCLXXXVII one thousand, seven hundred eighty seven +MDCCLXXXVIII one thousand, seven hundred eighty eight +MDCCLXXXIX one thousand, seven hundred eighty nine +MDCCXC one thousand, seven hundred ninety +MDCCXCI one thousand, seven hundred ninety one +MDCCXCII one thousand, seven hundred ninety two +MDCCXCIII one thousand, seven hundred ninety three +MDCCXCIV one thousand, seven hundred ninety four +MDCCXCV one thousand, seven hundred ninety five +MDCCXCVI one thousand, seven hundred ninety six +MDCCXCVII one thousand, seven hundred ninety seven +MDCCXCVIII one thousand, seven hundred ninety eight +MDCCXCIX one thousand, seven hundred ninety nine +MDCCC one thousand, eight hundred +MDCCCI one thousand, eight hundred one +MDCCCII one thousand, eight hundred two +MDCCCIII one thousand, eight hundred three +MDCCCIV one thousand, eight hundred four +MDCCCV one thousand, eight hundred five +MDCCCVI one thousand, eight hundred six +MDCCCVII one thousand, eight hundred seven +MDCCCVIII one thousand, eight hundred eight +MDCCCIX one thousand, eight hundred nine +MDCCCX one thousand, eight hundred ten +MDCCCXI one thousand, eight hundred eleven +MDCCCXII one thousand, eight hundred twelve +MDCCCXIII one thousand, eight hundred thirteen +MDCCCXIV one thousand, eight hundred fourteen +MDCCCXV one thousand, eight hundred fifteen +MDCCCXVI one thousand, eight hundred sixteen +MDCCCXVII one thousand, eight hundred seventeen +MDCCCXVIII one thousand, eight hundred eighteen +MDCCCXIX one thousand, eight hundred nineteen +MDCCCXX one thousand, eight hundred twenty +MDCCCXXI one thousand, eight hundred twenty one +MDCCCXXII one thousand, eight hundred twenty two +MDCCCXXIII one thousand, eight hundred twenty three +MDCCCXXIV one thousand, eight hundred twenty four +MDCCCXXV one thousand, eight hundred twenty five +MDCCCXXVI one thousand, eight hundred twenty six +MDCCCXXVII one thousand, eight hundred twenty seven +MDCCCXXVIII one thousand, eight hundred twenty eight +MDCCCXXIX one thousand, eight hundred twenty nine +MDCCCXXX one thousand, eight hundred thirty +MDCCCXXXI one thousand, eight hundred thirty one +MDCCCXXXII one thousand, eight hundred thirty two +MDCCCXXXIII one thousand, eight hundred thirty three +MDCCCXXXIV one thousand, eight hundred thirty four +MDCCCXXXV one thousand, eight hundred thirty five +MDCCCXXXVI one thousand, eight hundred thirty six +MDCCCXXXVII one thousand, eight hundred thirty seven +MDCCCXXXVIII one thousand, eight hundred thirty eight +MDCCCXXXIX one thousand, eight hundred thirty nine +MDCCCXL one thousand, eight hundred forty +MDCCCXLI one thousand, eight hundred forty one +MDCCCXLII one thousand, eight hundred forty two +MDCCCXLIII one thousand, eight hundred forty three +MDCCCXLIV one thousand, eight hundred forty four +MDCCCXLV one thousand, eight hundred forty five +MDCCCXLVI one thousand, eight hundred forty six +MDCCCXLVII one thousand, eight hundred forty seven +MDCCCXLVIII one thousand, eight hundred forty eight +MDCCCXLIX one thousand, eight hundred forty nine +MDCCCL one thousand, eight hundred fifty +MDCCCLI one thousand, eight hundred fifty one +MDCCCLII one thousand, eight hundred fifty two +MDCCCLIII one thousand, eight hundred fifty three +MDCCCLIV one thousand, eight hundred fifty four +MDCCCLV one thousand, eight hundred fifty five +MDCCCLVI one thousand, eight hundred fifty six +MDCCCLVII one thousand, eight hundred fifty seven +MDCCCLVIII one thousand, eight hundred fifty eight +MDCCCLIX one thousand, eight hundred fifty nine +MDCCCLX one thousand, eight hundred sixty +MDCCCLXI one thousand, eight hundred sixty one +MDCCCLXII one thousand, eight hundred sixty two +MDCCCLXIII one thousand, eight hundred sixty three +MDCCCLXIV one thousand, eight hundred sixty four +MDCCCLXV one thousand, eight hundred sixty five +MDCCCLXVI one thousand, eight hundred sixty six +MDCCCLXVII one thousand, eight hundred sixty seven +MDCCCLXVIII one thousand, eight hundred sixty eight +MDCCCLXIX one thousand, eight hundred sixty nine +MDCCCLXX one thousand, eight hundred seventy +MDCCCLXXI one thousand, eight hundred seventy one +MDCCCLXXII one thousand, eight hundred seventy two +MDCCCLXXIII one thousand, eight hundred seventy three +MDCCCLXXIV one thousand, eight hundred seventy four +MDCCCLXXV one thousand, eight hundred seventy five +MDCCCLXXVI one thousand, eight hundred seventy six +MDCCCLXXVII one thousand, eight hundred seventy seven +MDCCCLXXVIII one thousand, eight hundred seventy eight +MDCCCLXXIX one thousand, eight hundred seventy nine +MDCCCLXXX one thousand, eight hundred eighty +MDCCCLXXXI one thousand, eight hundred eighty one +MDCCCLXXXII one thousand, eight hundred eighty two +MDCCCLXXXIII one thousand, eight hundred eighty three +MDCCCLXXXIV one thousand, eight hundred eighty four +MDCCCLXXXV one thousand, eight hundred eighty five +MDCCCLXXXVI one thousand, eight hundred eighty six +MDCCCLXXXVII one thousand, eight hundred eighty seven +MDCCCLXXXVIII one thousand, eight hundred eighty eight +MDCCCLXXXIX one thousand, eight hundred eighty nine +MDCCCXC one thousand, eight hundred ninety +MDCCCXCI one thousand, eight hundred ninety one +MDCCCXCII one thousand, eight hundred ninety two +MDCCCXCIII one thousand, eight hundred ninety three +MDCCCXCIV one thousand, eight hundred ninety four +MDCCCXCV one thousand, eight hundred ninety five +MDCCCXCVI one thousand, eight hundred ninety six +MDCCCXCVII one thousand, eight hundred ninety seven +MDCCCXCVIII one thousand, eight hundred ninety eight +MDCCCXCIX one thousand, eight hundred ninety nine +MCM one thousand, nine hundred +MCMI one thousand, nine hundred one +MCMII one thousand, nine hundred two +MCMIII one thousand, nine hundred three +MCMIV one thousand, nine hundred four +MCMV one thousand, nine hundred five +MCMVI one thousand, nine hundred six +MCMVII one thousand, nine hundred seven +MCMVIII one thousand, nine hundred eight +MCMIX one thousand, nine hundred nine +MCMX one thousand, nine hundred ten +MCMXI one thousand, nine hundred eleven +MCMXII one thousand, nine hundred twelve +MCMXIII one thousand, nine hundred thirteen +MCMXIV one thousand, nine hundred fourteen +MCMXV one thousand, nine hundred fifteen +MCMXVI one thousand, nine hundred sixteen +MCMXVII one thousand, nine hundred seventeen +MCMXVIII one thousand, nine hundred eighteen +MCMXIX one thousand, nine hundred nineteen +MCMXX one thousand, nine hundred twenty +MCMXXI one thousand, nine hundred twenty one +MCMXXII one thousand, nine hundred twenty two +MCMXXIII one thousand, nine hundred twenty three +MCMXXIV one thousand, nine hundred twenty four +MCMXXV one thousand, nine hundred twenty five +MCMXXVI one thousand, nine hundred twenty six +MCMXXVII one thousand, nine hundred twenty seven +MCMXXVIII one thousand, nine hundred twenty eight +MCMXXIX one thousand, nine hundred twenty nine +MCMXXX one thousand, nine hundred thirty +MCMXXXI one thousand, nine hundred thirty one +MCMXXXII one thousand, nine hundred thirty two +MCMXXXIII one thousand, nine hundred thirty three +MCMXXXIV one thousand, nine hundred thirty four +MCMXXXV one thousand, nine hundred thirty five +MCMXXXVI one thousand, nine hundred thirty six +MCMXXXVII one thousand, nine hundred thirty seven +MCMXXXVIII one thousand, nine hundred thirty eight +MCMXXXIX one thousand, nine hundred thirty nine +MCMXL one thousand, nine hundred forty +MCMXLI one thousand, nine hundred forty one +MCMXLII one thousand, nine hundred forty two +MCMXLIII one thousand, nine hundred forty three +MCMXLIV one thousand, nine hundred forty four +MCMXLV one thousand, nine hundred forty five +MCMXLVI one thousand, nine hundred forty six +MCMXLVII one thousand, nine hundred forty seven +MCMXLVIII one thousand, nine hundred forty eight +MCMXLIX one thousand, nine hundred forty nine +MCML one thousand, nine hundred fifty +MCMLI one thousand, nine hundred fifty one +MCMLII one thousand, nine hundred fifty two +MCMLIII one thousand, nine hundred fifty three +MCMLIV one thousand, nine hundred fifty four +MCMLV one thousand, nine hundred fifty five +MCMLVI one thousand, nine hundred fifty six +MCMLVII one thousand, nine hundred fifty seven +MCMLVIII one thousand, nine hundred fifty eight +MCMLIX one thousand, nine hundred fifty nine +MCMLX one thousand, nine hundred sixty +MCMLXI one thousand, nine hundred sixty one +MCMLXII one thousand, nine hundred sixty two +MCMLXIII one thousand, nine hundred sixty three +MCMLXIV one thousand, nine hundred sixty four +MCMLXV one thousand, nine hundred sixty five +MCMLXVI one thousand, nine hundred sixty six +MCMLXVII one thousand, nine hundred sixty seven +MCMLXVIII one thousand, nine hundred sixty eight +MCMLXIX one thousand, nine hundred sixty nine +MCMLXX one thousand, nine hundred seventy +MCMLXXI one thousand, nine hundred seventy one +MCMLXXII one thousand, nine hundred seventy two +MCMLXXIII one thousand, nine hundred seventy three +MCMLXXIV one thousand, nine hundred seventy four +MCMLXXV one thousand, nine hundred seventy five +MCMLXXVI one thousand, nine hundred seventy six +MCMLXXVII one thousand, nine hundred seventy seven +MCMLXXVIII one thousand, nine hundred seventy eight +MCMLXXIX one thousand, nine hundred seventy nine +MCMLXXX one thousand, nine hundred eighty +MCMLXXXI one thousand, nine hundred eighty one +MCMLXXXII one thousand, nine hundred eighty two +MCMLXXXIII one thousand, nine hundred eighty three +MCMLXXXIV one thousand, nine hundred eighty four +MCMLXXXV one thousand, nine hundred eighty five +MCMLXXXVI one thousand, nine hundred eighty six +MCMLXXXVII one thousand, nine hundred eighty seven +MCMLXXXVIII one thousand, nine hundred eighty eight +MCMLXXXIX one thousand, nine hundred eighty nine +MCMXC one thousand, nine hundred ninety +MCMXCI one thousand, nine hundred ninety one +MCMXCII one thousand, nine hundred ninety two +MCMXCIII one thousand, nine hundred ninety three +MCMXCIV one thousand, nine hundred ninety four +MCMXCV one thousand, nine hundred ninety five +MCMXCVI one thousand, nine hundred ninety six +MCMXCVII one thousand, nine hundred ninety seven +MCMXCVIII one thousand, nine hundred ninety eight +MCMXCIX one thousand, nine hundred ninety nine +MM two thousand diff --git a/fun_text_processing/text_normalization/en/data/suppletive.tsv b/fun_text_processing/text_normalization/en/data/suppletive.tsv new file mode 100644 index 0000000..115460a --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/suppletive.tsv @@ -0,0 +1,83 @@ +deer +fish +sheep +foot feet +goose geese +man men +mouse mice +tooth teeth +woman women +won +child children +ox oxen +wife wives +wolf wolves +analysis analyses +criterion criteria +lbs +focus foci +percent +hertz +kroner krone +inch inches +calory calories +yen +megahertz +gigahertz +kilohertz +hertz +CC +c c +horsepower +hundredweight +kilogram force kilograms force +mega siemens +revolution per minute revolutions per minute +mile per hour miles per hour +megabit per second megabits per second +square foot square feet +kilobit per second kilobits per second +degree Celsius degrees Celsius +degree Fahrenheit degrees Fahrenheit +ATM +AU +BQ +CC +CD +DA +EB +EV +F +GB +G +GL +GPA +GY +HA +H +HL +GP +HS +KB +KL +KN +KT +KV +LM +MA +MA +MB +MC +MF +M +MM +MS +MV +MW +PB +PG +PS +S +TB +YB +ZB \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/telephone/__init__.py b/fun_text_processing/text_normalization/en/data/telephone/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/telephone/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/telephone/ip_prompt.tsv b/fun_text_processing/text_normalization/en/data/telephone/ip_prompt.tsv new file mode 100644 index 0000000..03e2529 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/telephone/ip_prompt.tsv @@ -0,0 +1,2 @@ +IP address is +IP is \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/telephone/ssn_prompt.tsv b/fun_text_processing/text_normalization/en/data/telephone/ssn_prompt.tsv new file mode 100644 index 0000000..8bbdb9f --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/telephone/ssn_prompt.tsv @@ -0,0 +1,4 @@ +ssn is SSN is +ssn is SSN is +SSN is +SSN \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/telephone/telephone_prompt.tsv b/fun_text_processing/text_normalization/en/data/telephone/telephone_prompt.tsv new file mode 100644 index 0000000..6dcfb6c --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/telephone/telephone_prompt.tsv @@ -0,0 +1,5 @@ +call me at +reach at +reached at +my number is +hit me up at \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/time/__init__.py b/fun_text_processing/text_normalization/en/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/time/suffix.tsv b/fun_text_processing/text_normalization/en/data/time/suffix.tsv new file mode 100644 index 0000000..026a6a9 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/time/suffix.tsv @@ -0,0 +1,12 @@ +p.m. PM +p.m PM +pm PM +P.M. PM +P.M PM +PM PM +a.m. AM +a.m AM +am AM +A.M. AM +A.M AM +AM AM diff --git a/fun_text_processing/text_normalization/en/data/time/zone.tsv b/fun_text_processing/text_normalization/en/data/time/zone.tsv new file mode 100644 index 0000000..0fda042 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/time/zone.tsv @@ -0,0 +1,14 @@ +cst CST +c.s.t CST +cet CET +c.e.t CET +pst PST +p.s.t PST +est EST +e.s.t EST +pt PT +p.t PT +et ET +e.t ET +gmt GMT +g.m.t GMT diff --git a/fun_text_processing/text_normalization/en/data/whitelist/__init__.py b/fun_text_processing/text_normalization/en/data/whitelist/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/data/whitelist/alternatives.tsv b/fun_text_processing/text_normalization/en/data/whitelist/alternatives.tsv new file mode 100644 index 0000000..0ee8e2c --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/alternatives.tsv @@ -0,0 +1,45 @@ +Hon. Honorable +Mr. Mister +Mrs. Misses +Ms. Miss +Mr Mister +Mrs Misses +Ms Miss +AC air conditioning +AC air conditioner +AC air conditioners +AC alternating current +&Co. and Co. +&Co. and Company +Mon Monday +Tu Tuesday +Wed Wednesday +Th Thursday +Thur Thursday +Thurs Thursday +Fri Friday +Sat Saturday +Sun Sunday +Mon Mon +Tu Tu +Wed Wed +Th Th +Thur Thur +Thurs Thurs +Fri Fri +Sat Sat +Sun Sun += equals +# number +No. number +No number +NO number +NO. number +NO nitrogen monoxide +NO NO +NO. NO. +No. No. +No No +VOL Volume +VOL. Volume +TV Television diff --git a/fun_text_processing/text_normalization/en/data/whitelist/alternatives_all_format.tsv b/fun_text_processing/text_normalization/en/data/whitelist/alternatives_all_format.tsv new file mode 100644 index 0000000..449195c --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/alternatives_all_format.tsv @@ -0,0 +1,14 @@ +st street +st saint +dr doctor +dr drive +mt mount +sr senior +prof professor +mt mountain +sr senior +jr junior +vol volume +rd road +ave avenue +approx approximately diff --git a/fun_text_processing/text_normalization/en/data/whitelist/asr.tsv b/fun_text_processing/text_normalization/en/data/whitelist/asr.tsv new file mode 100644 index 0000000..c067e17 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/asr.tsv @@ -0,0 +1,14713 @@ +Ph.D. p h d +Hon. honorable +& and +Mt. Mount +Maj. Major +Rev. Reverend +# hash +Gov. governor +vs. versus +vs versus +dept. department +vol volume +vol. volume +bldg. building +Bldg. Building +apt. apartment +Apt. Apartment +Σ sigma +η eta +κ kappa +ω omega +σ sigma +α alpha +ν nu +δ delta +ι iota +_ underscore +% percent sign +& ampersand +* asterisk ++ plus +/ slash += equal sign +^ circumflex +{ left brace +| vertical bar +} right brace +~ tilde +ltd limited +int'l international +$ dollar +A. A. a a +A.A. a a +A.A.A. a a a +A&A a and a +AAAI a a a i +AAAM a a a m +AAAs a a a's +AAAS a a a s +AAAW a a a w +AABA a a b a +AaB a a b +A. A. B. a a b +AAB a a b +AABC a a b c +Aabo a a b o +AABP a a b p +AABW a a b w +aac a a c +AAC a a c +AACAR a a c a r +AACC a a c c +AACCUP a a c c u p +AACMI a a c m i +AACNo a a c n o +AACR a a c r +AACS a a c s +AACSB a a c s b +AACTA a a c t a +AACUPR a a c u p r +A.A.D. a a d +AADT a a d t +AADTs a a d t's +Aadu a a d u +AAEA a a e a +AAE a a e +AAERT a a e r t +AAF a a f +AAFCA a a f c a +AAFC a a f c +AAFC's a a f c's +AAFld a a f l d +AAFPOA a a f p o a +AAGPBL a a g p b l +AAHHE a a h h e +AAI a a i +AAIB a a i b +AAIP a a i p +AAK a a k +Aap a a p +AAP a a p +AAPB a a p b +AAPC a a p c +AAPEP a a p e p +AAPG a a p g +AAPM a a p m +AAPT a a p t +A.A.R.M. a a r m +A.B.A. a b a +A. B. a b +A.B. a b +A.B.A. J. a b a j +A.B.C. a b c +A. B. G. a b g +ABG a b g +ABH a b h +ABHD a b h d +Abhi a b h i +ABK a b k +abl a b l +Abl a b l +ABL a b l +ABLV a b l v +ABM a b m +ABMC a b m c +ABN a b n +ABN's a b n's +Abp a b p +ABP a b p +ABPD a b p d +ABPI a b p i +ABPN a b p n +ABPP a b p p +ABPRS a b p r s +ABPW a b p w +Abr a b r +ABR a b r +abv a b v +ABV a b v +ABW a b w +ABX a b x +Abz a b z +A.C.A. a c a +ACA a c a +A&C a and c +A. C. a c +A.C. a c +acac a c a c +Acad a c a d +ACAD a c a d +A.C.A.P. a c a p +ACAP a c a p +ACAS a c a s +ACAZ a c a z +ACBA a c b a +ACB a c b +ACBL a c b l +ACBS a c b s +ACBSP a c b s p +ACCA a c c a +ACC a c c +ACCC a c c c +ACCJ a c c j +ACC&S a c c and s +ACC's a c c's +ACCS a c c s +ACD a c d +ACDC a c d c +A.C. D.F.C. A.F.C. a c d f c a f c +A.C.E. a c e +ACF a c f +ACFE a c f e +A.C.G. a c g +ACG a c g +ACGIH's a c g i h's +A.C.H. a c h +ACH a c h +ACHP a c h p +ACHR a c h r +ACHRE a c h r e +Achs a c h's +ACHS a c h s +ACIA a c i a +ACI a c i +ACICS a c i c s +ACIGA a c i g a +ACIP a c i p +Acis a c i's +ACIS a c i s +ACLA a c l a +A.C.L. a c l +ACL a c l +A.C.L.N. a c l n +acls a c l s +ACL's a c l's +ACLS a c l s +ACLU a c l u +ACM a c m +ACMI a c m i +ACMs a c m's +ACN a c n +ACO's a c o's +AcpA a c p a +ACP a c p +AcpB a c p b +ACPI a c p i +ACPO a c p o +ACPP a c p p +ACPSEM a c p s e m +acq a c q +A&CR a and c r +ACR a c r +ACRPS a c r p s +ACSA a c s a +ACSAC a c s a c +ACSBR a c s b r +ACSCN a c s c n +ACSEL a c s e l +ACSIA a c s i a +ACSI a c s i +AcSOC a c s o c +ACSR a c s r +ACSS a c s s +ACSS's a c s s's +A.C.T. a c t +A.C.T.A.F.L. a c t a f l +acu a c u +ACU a c u +ACU's a c u's +ACUS a c u s +ACUV a c u v +ACV a c v +ACWA a c w a +AC&W a c and w +ACW a c w +ACWM a c w m +ACWS a c w s +Acy a c y +ADAA a d a a +A&D a and d +Adab a d a b +ADAC a d a c +A. D. a d +A.D. a d +A.D.A.M. adam +AdaSL a d a s l +ADATA a d a t a +ADBAC a d b a c +ADB a d b +ADBGR a d b g r +ADBICA a d b i c a +ADCA a d c a +AdC a d c +A.D.C. a d c +ADC a d c +ADCAF a d c a f +ADCC a d c c +ADC's a d c's +ADCs a d c's +ADCY a d c y +ADDA a d d a +AD&D a d and d +ADF a d f +ADF's a d f's +ADFS a d f s +ADG a d g +ADGB a d g b +ADH a d h +ADHD a d h d +ADHM a d h m +ADHS a d h s +ADIAC a d i a c +AdK a d k +ADK a d k +Adl a d l +ADL a d l +ADLL a d l l +ADLs a d l's +A.D.M.A.C. a d m a c +adm a d m +Adm a d m +ADM a d m +ADMK a d m k +admn a d m n +ADMN a d m n +ADNAC a d n a c +ADNEC a d n e c +ADNs a d n's +AdP a d p +A.D.P. a d p +ADP a d p +ADPCM a d p c m +ADPF a d p f +ADQ a d q +ADQ's a d q's +ADR a d r +ADRC a d r c +ADRP a d r p +ADRs a d r's +ADSB a d s b +ADSL a d s l +ADSR a d s r +ADSRs a d s r's +ADSs a d s's +ADT a d t +ADTG a d t g +Adwa a d w a +ADWC a d w c +ADX a d x +AEA a e a +A&E a and e +A. E. a e +A.E. a e +AEBN a e b n +A.E.C. a e c +AEC a e c +AECL a e c l +AECR a e c r +AEC's a e c's +Aed a e d +AED a e d +AEE a e e +AEF a e f +AEG a e g +A.E.G.I.S. a e g i s +aegte a e g t e +AEHL a e h l +AEIA a e i a +AEI a e i +AEIOU a e i o u +Aeka a e k a +AEK a e k +ael a e l +AEL a e l +Aema a e m a +AEM a e m +aen a e n +AEO a e o +AEPA a e p a +AEP a e p +aere a e r e +AEre a e r e +AErn a e r n +AERN a e r n +Aert a e r t +AESA a e s a +Aes a e's +AES a e s +aet a e t +AET a e t +AETC a e t c +AEU a e u +AEV a e v +AEW a e w +AEX a e x +Afa a f a +AFA a f a +af a f +Af a f +A. F. a f +A.F. a f +AF a f +Afaf a f a f +AFAP a f a p +AFB a f b +AFCA a f c a +afc a f c +A.F.C. a f c +AFC a f c +AFCEC a f c e c +AFCO a f c o +AFC's a f c's +AFCS a f c s +AFCSThe a f c s t h e +Afd a f d +AfD a f d +AfDB a f d b +AFDD a f d d +Afe a f e +AFE a f e +Aff a f f +AFF a f f +AFG a f g +AFGM a f g m +AFH a f h +AFIA a f i a +Afi a f i +AFI a f i +AFIP a f i p +Afiq a f i q +AFI's a f i's +AFJ a f j +A.F.L. a f l +AFL a f l +AFLEG a f l e g +AFLPA a f l p a +AFLP a f l p +AFL's a f l's +AFLUA a f l u a +A. F.M.A. a f m a +AFM a f m +AFMC a f m c +AFMs a f m's +AFN a f n +AFNET a f n e t +AFNOR a f n o r +AfNS a f n s +Afo a f o +AFO a f o +AFOP a f o p +AFP a f p +AFRA a f r a +Afr a f r +AFR a f r +AFRC a f r c +AFRL a f r l +AFROTC a f r o t c +AFRTS a f r t s +AFS a f s +AFSC a f s c +AFSPC a f s p c +A. F. T. a f t +AFTRA a f t r a +AFTRA's a f t r a's +AFTRS a f t r s +AFV a f v +AFW a f w +AFWS a f w s +AFX a f x +A. G. a g +A.G. a g +AGB a g b +AGC a g c +Agco a g c o +AGCO a g c o +Agda a g d a +AGD a g d +A.G.E. a g e +AGF a g f +AG&G a g and g +agg a g g +Agi a g i +AGI a g i +AGID a g i d +AGIR a g i r +Agis a g i's +A.G.J. a g j +A. G. K. a g k +AGL a g l +agli a g l i +AGM a g m +Agn a g n +AgN a g n +AGN a g n +AGNs a g n's +A.G.P. a g p +AGP a g p +AGPL a g p l +AGPS a g p s +AGPW a g p w +AGRs a g r's +AGS a g s +AGSM a g s m +Agsu a g s u +agt a g t +AGT a g t +Agte a g t e +Agu a g u +AGU a g u +AGV a g v +A.H.A. a h a +A. H. a h +A.H. a h +A. H. C. a h c +AHC a h c +AHD a h d +Ahdhra a h d h r a +AHDR a h d r +ahe a h e +Ahe a h e +AHEC a h e c +AHF a h f +Ahirs a h i r's +Ahk a h k +AHL's a h l's +AHP a h p +AHRC a h r c +AHRS a h r s +AHSAA a h s a a +Ahsa'i a h s a i +Ahta a h t a +aht a h t +AHT a h t +AHTD a h t d +Ahu a h u +Ahva a h v a +AHV a h v +AIAA a i a a +A.I.A. a i a +A&I a and i +A. I. a i +A.I. a i +AI a i +AIAP a i a p +Aias a i a's +AIAS a i a s +AIATSIS a i a t s i s +AIAW a i a w +AIAWU a i a w u +A.I.B.A. a i b a +AIB a i b +AIBO's a i b o's +AIBS a i b s +AIC a i c +AICAR a i c a r +AICC a i c c +AICCCR a i c c c r +aici a i c i +Aicme a i c m e +AICN a i c n +AICPA a i c p a +AICP a i c p +AICPS a i c p s +AICs a i c's +AICTE a i c t e +AICUF a i c u f +AIDA a i d a +AIDN a i d n +AIEC a i e c +AIEE a i e e +Aiel a i e l +AIEP a i e p +AIFA a i f a +AIF a i f +AIFB a i f b +Aife a i f e +AIFF a i f f +AIFM a i f m +AIFMD a i f m d +AiG a i g +AIG a i g +Aigis a i g i's +AIHA a i h a +AIH a i h +AIHL a i h l +AIIMS a i i m s +Aija a i j a +Aik a i k +AIK a i k +AIKR a i k r +A.I.M. a i m +AIP a i p +A.I.R. a i r +AIs a i's +AISC a i s c +AISD a i s d +AISRI a i s r i +Aist a i s t +AIST a i s t +AIT's a i t's +Aitu a i t u +Aiud a i u d +aius a i u s +AIVC a i v c +AIW a i w +AIX a i x +A. J. a j +A.J. a j +Ajba a j b a +A.J.B. a j b +AJC a j c +A.J.E. a j e +A.J.G.C. a j g c +A. J. J. a j j +A.J.K. a j k +AJK a j k +AJKF a j k f +AJL a j l +A. J. M. a j m +Ajmi a j m i +AJN a j n +AJO a j o +Ajok a j o k +A. J. P. a j p +A.J.P. a j p +AJPW a j p w +A.J.R. a j r +AJR a j r +Ajsa a j s a +A.J.S. a j s +AJS a j s +A. J. T. a j t +A.J.T. a j t +AJT a j t +Aju a j u +AJUFE a j u f e +AJUSCO a j u s c o +AJV a j v +AJW a j w +AJWRC a j w r c +Akaa a k a a +a.k.a. a k a +aka. a k a +aka a k a +Aka. a k a +Aka a k a +AKA a k a +A&K a and k +A. K. a k +A.K. a k +AK a k +AKAP a k a p +AKAPs a k a p's +akas a k a's +AKAs a k a's +AKB a k b +AKC a k c +AKCR a k c r +AKD a k d +AKG a k g +AKG's a k g's +akh a k h +AKH a k h +AKHS a k h s +AKM a k m +AKN a k n +Akpa a k p a +AKP a k p +AKPD a k p d +AKQA a k q a +AKR a k r +A.K.S. a k s +AKS a k s +Aku a k u +AKU a k u +AKW a k w +A&L a and l +A. L. a l +A.L. a l +ALDF a l d f +ALDH a l d h +ALDS a l d s +ALDT a l d t +ALFASID a l f a s i d +ALFIDI a l f i d i +ALFTP a l f t p +Alh a l h +ALH a l h +A. L. M. a l m +A.L.P. a l p +ALPG a l p g +ALR a l r +ALSC a l s c +ALSF a l s f +ALSP a l s p +ALUs a l u's +A.L.V. a l v +ALVF a l v f +ALW a l w +ALWS a l w s +AMAA a m a a +A'ma a m a +A&M a and m +a.m. a m +a.m a m +A. M. a m +A.M. a m +AMAP a m a p +AMARC a m a r c +AMAs a m a's +amb a m b +Amb a m b +AMB a m b +AmBX a m b x +A.M.C. a m c +AMC a m c +AMC's a m c's +AMCs a m c's +Amda a m d a +Amd a m d +AMD a m d +AMDH a m d h +AMDISA a m d i s a +AMD's a m d's +A.M.E. a m e +AMF a m f +AM&FM a m and f m +A. M. G. a m g +AMG a m g +AMGTV a m g t v +Amha a m h a +AMH a m h +A.M.H.S. a m h s +A. M. J. a m j +AMJ a m j +A. M. K. a m k +A.M.K. a m k +AMK a m k +aml a m l +AML a m l +Amli a m l i +AMLS a m l s +Amlwch a m l w c h +Amm a m m +A. M. M. a m m +AMM a m m +AMMAYI a m m a y i +AMMB a m m b +AMMK a m m k +AMN a m n +AMNH a m n h +AMNRL a m n r l +AM&O a m and o +AMPK a m p k +AMPL a m p l +AMP's a m p's +Ampt a m p t +AMPTP a m p t p +amr a m r +A. M. R. a m r +AMREF a m r e f +AMSA a m s a +A&M's a and m's +Ams' a m's +amsl a m s l +AMSO's a m s o's +AMSRS a m s r s +AMS's a m s's +AMSS a m s s +AMSU a m s u +Amta a m t a +amt a m t +Amt a m t +A.M.T. a m t +AMT a m t +AMTB a m t b +AMTPAT a m t p a t +Amts a m t's +AMTV a m t v +Amu a m u +AMU a m u +AMU's a m u's +A.M.V.M. a m v m +AMW a m w +AMX a m x +AMYF a m y f +A. N. a n +A.N. a n +ANB a n b +ANBO a n b o +ANC a n c +ANCC a n c c +ANC's a n c's +andFHL a n d f h l +ANDOC a n d o c +ANDP a n d p +ANDPOP a n d p o p +andPPP a n d p p p +Anej a n e j +ANELFA a n e l f a +ANF a n f +ANFIS a n f i s +ANFP's a n f p's +ANGB a n g b +ANGPTL a n g p t l +ANGRAU a n g r a u +Angti a n g t i +Angu a n g u +Anhe a n h e +ANI a n i +ANL a n l +ANM a n m +ANP a n p +ANPP a n p p +ANPR a n p r +Anr a n r +ANR a n r +ANRC a n r c +ANREF's a n r e f's +Anrep a n r e p +ANRS a n r s +ANRW a n r w +A.N.S. a n s +ANS a n s +ANSF a n s f +ANTB a n t b +ANTM a n t m +ANTV a n t v +ANUGA a n u g a +ANWB a n w b +ANX a n x +ANZ a n z +A&O a and o +AOA a o a +AOAC a o a c +A. O. a o +A.O. a o +AOB a o b +AOC a o c +AOCB a o c b +AOCCs a o c c's +AOCE a o c e +AOD a o d +Aodh a o d h +Aodla a o d l a +AODV a o d v +AOE a o e +AOGCC a o g c c +Aogo a o g o +AOH a o h +Aoke a o k e +Aoko a o k o +AOKP a o k p +Aola a o l a +Aol a o l +AOL a o l +AOL's a o l's +AOLTV a o l t v +AOM a o m +AOMC a o m c +AONB a o n b +Aone a o n e +Aoni a o n i +Aoos a o o's +AOPA a o p a +AOP a o p +aor a o r +AOR a o r +AORs a o r's +AORS a o r s +aos a o s +AoS a o s +AOS a o s +Aotus a o t u's +AOTW a o t w +aov a o v +aovf a o v f +AOWC a o w c +A&P a and p +A. P. a p +A.P. a p +APBA a p b a +APB a p b +APBL a p b l +APCA a p c a +Apc a p c +APC a p c +APCCR a p c c r +APCh a p c h +APCR a p c r +APCRDA a p c r d a +APC's a p c's +APCs a p c's +APDA a p d a +APD a p d +APDM a p d m +APEGBC a p e g b c +APFA a p f a +APF a p f +APFCT a p f c t +APFOL a p f o l +APFSDS a p f s d s +APFUTU a p f u t u +apg a p g +APG a p g +APGAW a p g a w +Aph a p h +A.P.H. a p h +APH a p h +APHEDA a p h e d a +APHL a p h l +Apiao a p i a o +Api a p i +APi a p i +API a p i +Apic a p i c +APICv a p i c v +API's a p i's +A.P.J. a p j +APJ a p j +Apl a p l +APL a p l +APLP a p l p +APLS a p l s +Aplu a p l u +APM a p m +APML a p m l +APMR a p m r +APMSO a p m s o +APN a p n +A.P.N.C. a p n c +Apphttp a p p h t t p +Appl a p p l +APPO's a p p o's +appr a p p r +Appts a p p t's +appu a p p u +Appu a p p u +APRA's a p r a's +APRC a p r c +APR's a p r's +APRS a p r s +APRST a p r s t +A&P's a and p's +Aps a p's +APs a p's +APS a p s +APSF a p s f +APSL a p s l +APTA a p t a +AP&T a p and t +APW a p w +APX a p x +APXS a p x s +Aqa a q a +AQA a q a +AQC a q c +AQI a q i +Aql a q l +AQP a q p +Aqr a q r +A&R a and r +ARA a r a +A. R. a r +A.R. a r +A.R.B. a r b +ARD a r d +ARDF a r d f +A.R.E. a r e +A.R.F. a r f +ARF a r f +A.R.G. a r g +ArgR a r g r +ARGs a r g's +ARGT a r g t +ArH a r h +ARJ a r j +ARL a r l +ARLFC a r l f c +A. R. M. a r m +ARMv a r m v +Arnd a r n d +ARNG a r n g +ARNT a r n t +A.R.P. a r p +ARQ a r q +ARTL a r t l +A.R.U. a r u +arv a r v +Arv a r v +ARV a r v +ARVD a r v d +ARVN a r v n +ARW a r w +Arwi a r w i +ARWU a r w u +A.S.A. a s a +ASA a s a +As'ad a s a d +Asai a s a i +Asao a s a o +A.s a's +A. S. a s +A.S. a s +ASAS a s a s +Asasp a s a s p +ASAU a s a u +A.S.B. a s b +ASB a s b +ASBDA a s b d a +asbl a s b l +ASBM a s b m +ASBMH a s b m h +ASBO a s b o +A.S.C. a s c +ASC a s c +ASCB a s c b +ASCE a s c e +asci a s c i +Asci a s c i +ASCP a s c p +ASCW a s c w +A.S.D. a s d +ASD a s d +ASDIC a s d i c +Asdis a s d i's +ASE a s e +ASEC a s e c +ASEE a s e e +ASEF a s e f +ASFA a s f a +ASF a s f +Asfi a s f i +ASGA a s g a +ASG a s g +ASGC a s g c +ASGE a s g e +ASGS a s g s +A. S. H. a s h +A.S.I. a s i +ASL a s l +A.S.M. a s m +ASM a s m +ASMD a s m d +ASME a s m e +ASMIK a s m i k +ASML a s m l +ASMPH a s m p h +ASMSU a s m s u +Asn a s n +ASN a s n +Aso a s o +ASO a s o +ASP a s p +ASPCA a s p c a +Aspe a s p e +ASPTS a s p t s +Asr a s r +ASR a s r +Assn a s s n +assoc a s s o c +Assoc a s s o c +ASSPs a s s p's +ASSR a s s r +Asst a s s t +ASSU a s s u +A. S. T. a s t +ASTAT a s t a t +ASTCL a s t c l +Aste a s t e +ASTE a s t e +ASTM a s t m +ASTR a s t r +Astt a s t t +A.S.U. a s u +ASU a s u +A.S.V. a s v +ASV a s v +Aswa a s w a +ASW a s w +ASX a s x +A&T a and t +atac a t a c +Atac a t a c +Atad a t a d +Ata's a t a's +Atas a t a's +ATA's a t a's +A. T. a t +A.T. a t +ATBF a t b f +ATBs a t b's +atc a t c +A.T.C. a t c +ATC a t c +atcc a t c c +ATCC a t c c +ATCDE a t c d e +ATCL a t c l +ATDC a t d c +ATF a t f +Atg a t g +ATG a t g +ATGM a t g m +ath a t h +Ath a t h +ATH a t h +ATHN a t h n +ATIA a t i a +Atia's a t i a's +Ati a t i +ATi a t i +ATI a t i +Atid a t i d +Atiiq a t i i q +Atil a t i l +ATINC a t i n c +ATIP a t i p +Atiq a t i q +Ativ a t i v +ATJ a t j +Atka a t k a +ATK a t k +ATKN a t k n +ATK's a t k's +Atl a t l +ATL a t l +Atli a t l i +ATLY a t l y +A.T.M.A. a t m a +atm a t m +Atm a t m +ATM a t m +ATMs a t m's +ATN a t n +ATO a t o +Atos a t o's +ATO's a t o's +ATOs a t o's +ATOS a t o s +ATP a t p +atpB a t p b +A.T.Q. a t q +ATR a t r +atri a t r i +Atri a t r i +ATRP a t r p +A&T's a and t's +A.T.s a t's +A.T.S. a t s +ATS a t s +ATSC a t s c +ATSDR a t s d r +AT&SF a t and s f +ATSF a t s f +ATSIC a t s i c +AT&T a t and t +attd a t t d +ATTESA a t t e s a +ATTF a t t f +AT&T's a t and t's +ATTS a t t s +ATTWI a t t w i +ATTWX's a t t w x's +ATU's a t u's +atv a t v +ATV a t v +ATV's a t v's +ATVs a t v's +ATW a t w +AtxA a t x a +ATX a t x +ATXN a t x n +A. U. a u +A.U. a u +Aub a u b +Aubl a u b l +AUC a u c +AUVs a u v's +Auw a u w +avab a v a b +AVAC a v a c +A. V. a v +A.V. a v +AVCA a v c a +AVC a v c +AVCHD a v c h d +AVCs a v c's +AVCS a v c s +AVD a v d +avg a v g +AVG a v g +AVK a v k +AVL a v l +A. V. M. a v m +AVM a v m +Avn a v n +AVN a v n +Avo a v o +AvP a v p +AVP a v p +AVR a v r +AVRs a v r's +AVSA a v s a +Avs' a v's +Avs a v's +AVS a v s +AVSM a v s m +AVU a v u +avvo a v v o +AVX a v x +Awa a w a +A. W. A. a w a +AWA a w a +A. W. A. M. a w a m +AWAs a w a's +A. W. a w +A.W. a w +A. W. B. a w b +A.W.B. a w b +AWB a w b +AWB's a w b's +A.W.C. a w c +AWC a w c +AWD a w d +A. W. F. a w f +AWG a w g +AWGIE a w g i e +AWGN a w g n +A. W. H. a w h +AWHL a w h l +AWI a w i +AWM a w m +Awo a w o +AWP a w p +AWP's a w p's +AWR a w r +AWSA a w s a +AWU a w u +Awwa a w w a +AXAF a x a f +A. X. a x +AXS a x s +AXV a x v +A. Y. a y +A.Y. a y +AYF a y f +AYK a y k +AYP a y p +A. Z. a z +A.Z. a z +AZE a z e +Azg a z g +Azi a z i +AZI a z i +AZL a z l +azm a z m +AZN a z n +AZS a z s +AZSTA's a z s t a's +AZT a z t +AzTV a z t v +Baad b a a d +BAAG b a a g +Ba'al b a a l +Baal b a a l +BAAL b a a l +Baam b a a m +Baap b a a p +ba'as b a a's +Baat b a a t +Ba'ath b a a t h +B. A. b a +B.A. b a +B&A b and a +Bac b a c +B.A.C. b a c +BAC b a c +bae b a e +Bae b a e +BAe b a e +BAE b a e +BAFA b a f a +BAF b a f +B.A.R. b a r +BARV b a r v +BASCA b a s c a +BASEC b a s e c +BASF b a s f +B.A.S.P. b a s p +BATVG b a t v g +Bauw b a u w +B'Av b a v +BAV b a v +BBA b b a +BBAG b b a g +B&B b and b +bb b b +B. B. b b +B.B. b b +BB b b +BBB b b b +bbc b b c +B.B.C. b b c +BBC b b c +BBCBBC b b c b b c +BB&CI b b and c i +BBC&PJR b b c and p j r +BBC's b b c's +B.B.D. b b d +BBDO b b d o +BBE b b e +BBF b b f +BBFC b b f c +BBFF b b f f +BBG b b g +BBH b b h +BBI b b i +BBK b b k +BBKL b b k l +BBLB b b l b +BBL b b l +BBM b b m +BBMP b b m p +BBNG b b n g +BBN's b b n's +BBO b b o +BBP b b p +BBQ'er b b q e r +B&Bs b and b's +BB&S b b and s +BBS b b s +BBSes b b s e's +BBS's b b s's +BB&T b b and t +BBT b b t +BBTV b b t v +BBU b b u +BBVA b b v a +BbvCI b b v c i +BBV's b b v's +BBWAA b b w a a +BBWA b b w a +BBWR's b b w r's +BBYA b b y a +BBYO b b y o +BCA b c a +BCAD b c a d +BCAM b c a m +BCATP b c a t p +BCBA b c b a +BCB b c b +bc b c +B. C. b c +B.C. b c +BC b c +BCCA b c c a +BCC b c c +BCCCA b c c c a +Bcci b c c i +BCCI b c c i +BCCP b c c p +BCC's b c c's +BCDA b c d a +BCD b c d +BCEA b c e a +BCE b c e +BCE's b c e's +BCF b c f +BCG b c g +BCG's b c g's +BCHL b c h l +BCHR's b c h r's +BCHS b c h s +BCI b c i +B. C. J. b c j +BCL b c l +BCLR b c l r +BCMA b c m a +BCM b c m +BCMG b c m g +BCMHS b c m h s +BCMS b c m s +BCN b c n +BCN's b c n's +BCP b c p +BCPM b c p m +BCR b c r +BCRF's b c r f's +B.C.'s b c's +BC's b c's +BCs b c's +BCS b c s +BCSC b c s c +BCSic b c s i c +BCSN b c s n +BCT b c t +BCTC b c t c +BCU b c u +BCYP b c y p +BdA b d a +BDA b d a +bd b d +B. D. b d +B.D. b d +BD b d +BDBL b d b l +BDC b d c +BDC's b d c's +BDD b d d +Bde b d e +B. D. E. b d e +BDE b d e +BDF b d f +BDI b d i +BDJ b d j +BDK b d k +BDK's b d k's +BDMI b d m i +BDN b d n +BDNF b d n f +BDO b d o +BDO's b d o's +BDOS b d o s +BDP b d p +BDR b d r +bds b d s +BDS b d s +BDSM b d s m +BdU b d u +BDU b d u +BDV b d v +B. D. W. b d w +B.E.A. b e a +B. E. b e +B.E. b e +Bedw b e d w +B.E.E. b e e +bef b e f +B.E.F. b e f +BEF b e f +BEF's b e f's +bei b e i +Bei b e i +Beih b e i h +BEIR b e i r +Beis b e i's +bej b e j +B.E.M. b e m +BEMs b e m's +BEP b e p +Ber b e r +BER b e r +Bes b e's +B.E.S. b e s +BES b e s +B.F.A. b f a +BFA b f a +bf b f +B. F. b f +B.F. b f +BF b f +BFCA b f c a +BFC b f c +BFC's b f c's +BFDG b f d g +BFES b f e s +BFF b f f +BFFs b f f's +B. F. G. b f g +BFG b f g +BFG's b f g's +BFI b f i +BFI's b f i's +BFJA b f j a +BFKL b f k l +BFL b f l +BFM b f m +BFO b f o +BFRA b f r a +BFR b f r +BFSA b f s a +BFS b f s +BFT b f t +BFU b f u +bfy b f y +BGAB b g a b +BGA b g a +BGB b g b +B. G. b g +B.G. b g +BGC b g c +BGCI b g c i +BGD b g d +BGEA b g e a +B. G. E. b g e +BGH b g h +B. G. J. S. b g j s +BGL b g l +BglII b g l i i +BGM b g m +BGP b g p +BGRA b g r a +BGR b g r +BGRC b g r c +BGRSO b g r s o +bgs b g s +B.G.S. b g s +BGS b g s +BGSU b g s u +BGT b g t +Bgy b g y +Bha b h a +B&H b and h +B. H. b h +B.H. b h +BHCC b h c c +BHDP b h d p +BH&E b h and e +Bhe b h e +BHL b h l +BHMA b h m a +BHMO b h m o +BHMs b h m's +BHMT b h m t +BHO b h o +B. H. P. b h p +BHP b h p +BHRT b h r t +BHS b h s +BHSN b h s n +BHSU b h s u +bhttp b h t t p +BHU b h u +BHUSD b h u s d +BHVS b h v s +B. I. b i +B.I. b i +Bie b i e +BIE b i e +biedt b i e d t +Biem b i e m +B.I.G. b i g +B.I.G.'s b i g's +BiH b i h +BIH b i h +B.I.O.L.A. b i o l a +B. J. b j +B.J. b j +BJCC b j c c +BJCP b j c p +BJD b j d +B.J.F. b j f +B. J. I. b j i +BJJ b j j +BJP b j p +BJP's b j p's +BJPs b j p's +BJPS b j p s +B.J.'s b j's +B.J.T. b j t +BJT b j t +BJU b j u +BJY b j y +B.K.A. b k a +B&K b and k +B. K. b k +B.K. b k +BKCa b k c a +BKC b k c +BKF b k f +BKI b k i +BKN's b k n's +BKO b k o +B.K.R. b k r +BKR b k r +BK's b k's +BKS b k s +BKT b k t +BKTV b k t v +BKV b k v +B. L. b l +B.L. b l +BL b l +BLC b l c +BLCC b l c c +BLCN b l c n +ble b l e +bleg b l e g +blev b l e v +BLG b l g +bli b l i +BLI b l i +Blla b l l a +BLL b l l +BLM b l m +BLMC b l m c +BLOU's b l o u's +BLPP b l p p +BLR b l r +BLRC b l r c +BLR&D b l r and d +B.L.S. b l s +BLS b l s +BLT b l t +BLTF b l t f +BLTs b l t's +BLV b l v +BMAA b m a a +B.M.A. b m a +BMA b m a +BMAL b m a l +BMARC b m a r c +BMA's b m a's +B&M b and m +BMB b m b +B. M. b m +B.M. b m +BMCA b m c a +B.M.C. b m c +BMC b m c +bmd b m d +BMD b m d +BME b m e +BMF b m f +BMG b m g +BMHS b m h s +bmi b m i +BMI b m i +BMIC b m i c +BMIR b m i r +BMI's b m i's +BMIT b m i t +BMJ b m j +BMK b m k +BMKG b m k g +BMMO b m m o +BMNA b m n a +BMNH b m n h +BMNP b m n p +BMO b m o +BMP b m p +BMPs b m p's +BMR b m r +BMRs b m r's +BMSA b m s a +B.M.S. b m s +BMS b m s +bmt b m t +B. M. T. b m t +B.M.T. b m t +BMT b m t +BMT's b m t's +BMU b m u +B.M.V. b m v +BMV b m v +B. M. W. b m w +BMW b m w +BMW M b m w +BMW's b m w's +BMX b m x +BNA b n a +B&N b and n +bnb b n b +BNB b n b +B. N. b n +B.N. b n +BNC b n c +BNCI b n c i +BNCM b n c m +BNCT b n c t +BND b n d +BNDY b n d y +BNET b n e t +BNF b n f +BNFL b n f l +BNI b n i +BNIC b n i c +BNL b n l +BNO b n o +BNP b n p +BNR b n r +BNRC b n r c +BNS b n s +BNSF b n s f +BNST b n s t +BNT b n t +BNU b n u +BNY b n y +BNZ b n z +Boac b o a c +BOAC b o a c +B&O b and o +B. O. b o +B.O. b o +Boc b o c +BoC b o c +BOC b o c +BOCs b o c's +BOCS b o c s +boj b o j +Boj b o j +BOJ b o j +B.O.M.B. b o m b +B&O's b and o's +B.O.S. b o s +BOYZZ b o y z z +BPA b p a +BPB b p b +bp b p +B. P. b p +B.P. b p +BP b p +BPC b p c +BPD b p d +BPER b p e r +B.P.H. b p h +BPI b p i +BPJ b p j +BPK b p k +bpl b p l +BPL b p l +B. P. M. b p m +BPM b p m +BPMN b p m n +B.P.N. b p n +BPN b p n +B.P.O. b p o +BPO b p o +BPPA b p p a +BPP b p p +BPR b p r +B.P.R.D. b p r d +BPRD b p r d +BPSA b p s a +BP's b p's +BPS b p s +BPSK b p s k +BPUP b p u p +BPV b p v +BPY b p y +B&Q b and q +BQB b q b +B. Q. b q +BRAC's b r a c's +BRAM b r a m +BRBDP b r b d p +Brbic b r b i c +B. R. b r +B.R. b r +BRBR b r b r +BRBs b r b's +BRCA b r c a +BRC b r c +BRCC b r c c +BRD b r d +BRF b r f +BRGF b r g f +BRGM b r g m +BRHS b r h s +B.R.I.C.K. b r i c k +BRK b r k +BRL b r l +BRM b r m +BRMS b r m s +BRN b r n +BRNC b r n c +Brne b r n e +Brno b r n o +BRNV b r n v +BRP b r p +BRPS b r p s +BRRA b r r a +BRS b r s +BRSCC's b r s c c's +BRT b r t +BRTs b r t's +BRTS b r t s +BRVM b r v m +BRW b r w +BRWK b r w k +Brza b r z a +BRZ b r z +brzu b r z u +brzy b r z y +Brzyk b r z y k +BSAA b s a a +B.S.A. b s a +BSA b s a +BSAC b s a c +BsaL b s a l +BSBA b s b a +BSB b s b +BSBI b s b i +B. s b's +B.'s b's +Bs b's +B. S. b s +B.S. b s +BS b s +B.S.C. b s c +BSC b s c +BSCL b s c l +bsd b s d +BSD b s d +BSDE b s d e +BSE b s e +BSET b s e t +BSFA b s f a +BSF b s f +BSG b s g +BSH b s h +BSIB b s i b +BSI b s i +BSK b s k +BSL b s l +BSM b s m +BSME b s m e +BSN b s n +BSNL b s n l +BSOG b s o g +BSPA b s p a +BSP b s p +BSPP b s p p +BSR b s r +BSRN b s r n +BSS b s s +BSU b s u +BSV b s v +BSX b s x +BTA b t a +BTAF b t a f +BTB b t b +BTBD b t b d +bt b t +B. T. b t +B.T. b t +BT b t +BTCA b t c a +BTC b t c +BTCC b t c c +BTD b t d +BTF b t f +BTG b t g +BTH b t h +BTK b t k +BTL b t l +BTM b t m +BTN b t n +BTNK b t n k +BTOB b t o b +BTO b t o +BTP b t p +BTRC b t r c +BTRDA b t r d a +Btry b t r y +btsan b t s a n +BT's b t's +BTS b t s +BTT b t t +BTU b t u +btus b t u s +BTUs b t u's +BTV b t v +B.U. b u +B.U.M. b u m +BUV b u v +BVA b v a +BVB b v b +BVB's b v b's +B. V. b v +B.V. b v +BVC b v c +BVFB b v f b +BVI b v i +BVM b v m +BVO b v o +BVR b v r +BVRC b v r c +BVT b v t +BVVL b v v l +Bwa b w a +BWAF b w a f +B&W b and w +BWB b w b +BWBR b w b r +B. W. b w +B.W. b w +B.W.C. b w c +BWC b w c +BWF b w f +BWFC b w f c +BWHBC b w h b c +B. W. I. b w i +BWI b w i +BWIR b w i r +BWO b w o +BWR b w r +BWS b w s +BWT b w t +BWTs b w t's +BWV b w v +BWW b w w +bwwtv b w w t v +Bxa b x a +BX b x +Bxe b x e +BXML b x m l +BYA's b y a's +BYB b y b +B. Y. b y +byc b y c +BYC b y c +BYD b y d +BYFC b y f c +BYG b y g +bygd b y g d +Byk b y k +byn b y n +BYOB b y o b +Byo b y o +BYO b y o +Byou b y o u +BYR b y r +Byrl b y r l +bySLC b y s l c +BYST b y s t +byt b y t +B.Y.U. b y u +BYU b y u +BYU's b y u's +BYX b y x +BYZ b y z +B.Z. b z +BZ b z +BZD b z d +bzhed b z h e d +Bzik b z i k +BZK b z k +BZP b z p +Bzyb b z y b +CAA c a a +CAAC c a a c +CAAC's c a a c's +CAAHEP c a a h e p +CAAM c a a m +CAAS c a a s +CAASE c a a s e +Caat c a a t +CAAT c a a t +C. A. c a +C.A. c a +CA c a +C&A c and a +CAC c a c +CA&CC c a and c c +CACC c a c c +CACM c a c m +Cadw c a d w +CADW c a d w +caeca c a e c a +Cae c a e +CAE c a e +C.A.F.B. c a f b +CAFTT c a f t t +C. A. G. c a g +CAG c a g +CAGM c a g m +C. A. I. c a i +C. A. J. c a j +CALUX c a l u x +CAMC c a m c +CAMLG c a m l g +C.A.M.'s c a m's +C. A. N. c a n +Capt. captain +C. A. R. c a r +cas c a s +Cas c a's +C.A.S. c a s +CAS c a s +Casc c a s c +CASC c a s c +CASD c a s d +CASF c a s f +CASG c a s g +CASQ c a s q +C. A. T. c a t +C.A.T. c a t +CATV c a t v +C.A.W. c a w +CBA c b a +CBBB c b b b +CBB c b b +CBBC c b b c +CBBS c b b s +CBCA c b c a +cb c b +C. B. c b +C.B. c b +CB c b +cbc c b c +CBC c b c +CB&CNS c b and c n s +CBC's c b c's +CBCS c b c s +CBDA c b d a +CBD c b d +CBDs c b d's +C.B.E. c b e +CBE c b e +CBEF c b e f +CBE's c b e's +CBF c b f +CBGB c b g b +CBGB's c b g b's +CBGBs c b g b's +CBG c b g +CBH c b h +CBHG c b h g +CBI c b i +CBI's c b i's +CbiXS c b i x s +CBKB c b k b +CBK c b k +CBKMT c b k m t +CBKRT c b k r t +CBL c b l +CBL's c b l's +CBM c b m +CBMS c b m s +CBN c b n +CBN's c b n's +CBNT c b n t +CBO c b o +CBOT c b o t +CBP c b p +CBPE c b p e +CB&Q c b and q +CBR c b r +CBRE c b r e +CBRN c b r n +CBRNE c b r n e +CBSA c b s a +CBs c b's +CBS c b s +C.B.S.E. c b s e +CBSE c b s e +CBS's c b s's +CBT c b t +CBTC c b t c +CBTU c b t u +CBU c b u +CBUT c b u t +CBV c b v +CBWT c b w t +CBX c b x +CBYT c b y t +CBZH c b z h +'c c +CcaA c c a a +CCAA c c a a +CCAAT c c a a t +cca c c a +Cca c c a +CCA c c a +CCAF c c a f +CCAP c c a p +CCAR c c a r +CCAS c c a s +CCB c c b +CCBCC c c b c c +CCBE c c b e +CCCA c c c a +C&C c and c +C. C. c c +C.C. c c +CCCE c c c e +CCCF c c c f +CCCP c c c p +CCC's c c c's +CCDB c c d b +CCDC c c d c +ccd c c d +CCD c c d +CCDev c c d e v +CCDI c c d i +CCDI's c c d i's +CCDM c c d m +CCDR c c d r +CCD's c c d's +CCDs c c d's +CCEd c c e d +C.C.E.D. c c e d +CCF c c f +CCFO c c f o +CCG c c g +C.C.G.S. c c g s +CCGS c c g s +CCHA c c h a +CCHC c c h c +C.C.H. c c h +CCH c c h +CCHD c c h d +CCHS c c h s +C.C.I.A.A. c c i a a +CCIAA c c i a a +CCi c c i +CCI c c i +CCID c c i d +CCIE c c i e +CCIH c c i h +CCITT c c i t t +CCJ c c j +CCK c c k +CCLC c c l c +CCL c c l +CCMA c c m a +ccm c c m +CCM c c m +CCMM c c m m +CCMP c c m p +CCMS c c m s +CCN c c n +CCNY c c n y +CCO c c o +CCOKC c c o k c +CCOO c c o o +CCOP c c o p +C.C.O.W.E. E.T.F. c c o w e e t f +CCP c c p +CCPD c c p d +CCPL c c p l +CCPN c c p n +CCP's c c p's +CCQ c c q +CCRC c c r c +CCR c c r +CCRCs c c r c's +CCRH c c r h +CCRS c c r s +CCSA c c s a +CCSC c c s c +CC's c c's +CCS c c s +CCSD c c s d +C.C.S.D.N.Y. c c s d n y +C.C.S.M. c c s m +CCSN c c s n +CCSR c c s r +CCS's c c s's +cct c c t +CCT c c t +CCTF c c t f +CCTRN c c t r n +CCTT c c t t +CCTV c c t v +CCUA c c u a +CCU c c u +ccus c c u s +CCV c c v +CCVG c c v g +C. C. W. c c w +CCWD c c w d +CDA c d a +CDAT c d a t +CDB c d b +CDBS c d b s +CDCA c d c a +C&D c and d +cdc c d c +CDC c d c +cd c d +C. D. c d +C.D. c d +CD c d +CDC's c d c's +CDDB c d d b +CD&DR c d and d r +CDE c d e +CDF c d f +CDFI c d f i +CDFW c d f w +CDH c d h +CDi c d i +CDI c d i +CDISC c d i s c +CDI's c d i's +CDK c d k +CDKN c d k n +CDL c d l +CDLI c d l i +CDLS c d l s +CDMA c d m a +CDM c d m +cDNA c d n a +cdnas c d n a s +cDNAs c d n a's +CDN c d n +CDN's c d n's +CDO c d o +CDOs c d o's +CDPC c d p c +CDP c d p +CDP's c d p's +CDPs c d p's +CD&R c d and r +CDR c d r +cds c d s +CD's c d's +CDs c d's +CDS c d s +CDSG c d s g +CDSP c d s p +CDSPCo c d s p c o +CdtA c d t a +CDT c d t +CdTe c d t e +CDTi c d t i +CDTI c d t i +CDT's c d t's +CDTV c d t v +CDTV's c d t v's +CDU c d u +CDU's c d u's +CD&V c d and v +CDV c d v +CDW c d w +CDWP c d w p +Cec c e c +CEC c e c +c'e c e +ce c e +C'e c e +Ce c e +C. E. c e +C.E. c e +CE c e +CECP c e c p +CEDA c e d a +CEDO c e d o +CEDR c e d r +CEDS c e d s +CEEBA c e e b a +CEEB c e e b +CEEH c e e h +Ceel c e e l +CEEOL c e e o l +CEESA c e e s a +CEFC c e f c +CEF c e f +Cefn c e f n +CEFP c e f p +CEFR c e f r +CEGB c e g b +C.E.G. c e g +C. E. H. c e h +CEI c e i +C&EI's c and e i's +C. E. M. c e m +C&EN c and e n +cen c e n +Cen c e n +CEN c e n +ceo c e o +C.E.O. c e o +CEO c e o +Ceol c e o l +CEOP c e o p +Ceorl c e o r l +Ceos c e o's +CEO's c e o's +CEOs' c e o's +CEOs c e o's +C.E.P. c e p +cer c e r +Cer c e r +CER c e r +CERP c e r p +CERPER c e r p e r +CERS c e r s +ces c e s +Ces c e's +C.E.S. c e s +CES c e s +CESL c e s l +CESO c e s o +CETB c e t b +C. E. T. c e t +CEV c e v +CEVCP c e v c p +CEVG c e v g +CEW c e w +Cex c e x +CeX c e x +CEX c e x +CEZ c e z +CEZMS c e z m s +CFAB c f a b +Cfa c f a +CFA c f a +CFAS c f a s +C. F. B. c f b +CFB c f b +CFBG c f b g +CFBISD c f b i s d +CFB's c f b's +C&F c and f +CFC c f c +cf c f +C. F. c f +C.F. c f +CF c f +CFC's c f c's +CFDA c f d a +CFD c f d +C.F.E. c f e +CFE c f e +CFFC c f f c +C. F. F. c f f +CFF c f f +C. F. H. c f h +CFH c f h +CFHS c f h s +CFI c f i +CFIT c f i t +CFJL c f j l +CFJR c f j r +CFL c f l +CFL's c f l's +CFM c f m +CFMEU c f m e u +CFMI c f m i +CFND c f n d +CFNY c f n y +C.F.O.A. c f o a +CFO c f o +CFOP c f o p +CFOs c f o's +CFPI c f p i +CFPL c f p l +CFQ c f q +CFRB c f r b +C.F.R. c f r +CFR c f r +CFRP c f r p +CFS c f s +CFSCI c f s c i +CFSP c f s p +CFTA c f t a +CFT c f t +CFTO c f t o +CFTR c f t r +CFTs c f t's +CFTXOP c f t x o p +CFU c f u +CFYN c f y n +CFZ c f z +CGA c g a +CGAP c g a p +CGB c g b +C&G c and g +CGCFAD c g c f a d +C. G. c g +C.G. c g +CGCRI c g c r i +CGCS c g c s +CGD c g d +CGDK c g d k +CGE c g e +CGF c g f +CGFP c g f p +CGG c g g +CGI c g i +CGIL c g i l +CGKD c g k d +cgl c g l +CGL c g l +CGP c g p +CGPM c g p m +CGPME c g p m e +CGPW c g p w +CGR c g r +CGRP c g r p +CGS c g s +CGSS c g s s +CGT c g t +CGTG c g t g +CGTIC c g t i c +CGU c g u +CGW c g w +CGW's c g w's +C.H.B. c h b +CHBM c h b m +CHBX c h b x +C&H c and h +C.H.C. c h c +C. H. c h +C.H. c h +CHCO c h c o +CHD c h d +CHDK c h d k +CHDS c h d s +CHF c h f +CHFI c h f i +C.H.G. c h g +CHGO c h g o +CHH c h h +CHHOTO c h h o t o +CHHS c h h s +Chhu c h h u +Chirs c h i r's +CHISMS c h i s m s +CHISZ c h i s z +CHK c h k +CHL c h l +CHLR c h l r +CHL's c h l's +C. H. M. c h m +CHM c h m +CHN c h n +CHP c h p +CHP'den c h p d e n +CHPs c h p's +CHPS c h p s +CHR c h r +CHRDI c h r d i +CHRGD c h r g d +C.H.S. c h s +CHS c h s +CHSE c h s e +CHT c h t +CHV c h v +CHX c h x +Chy c h y +CHYR c h y r +CIAC c i a c +Cia c i a +C.I.A. c i a +CIA c i a +CIC c i c +ci c i +Ci c i +C. I. c i +C.I. c i +CI c i +Cicic c i c i c +CICL c i c l +C.I.C.M. c i c m +CICO c i c o +CIC's c i c's +C.I.D. c i d +CIFF c i f f +CIFL c i f l +CIHE c i h e +CIHR c i h r +cii c i i +CII c i i +CIID c i i d +CIJ c i j +CIKM c i k m +C.I.L. c i l +CIL c i l +cim c i m +Cim c i m +CIM c i m +Cio c i o +C.I.O. c i o +CIO c i o +CIOs c i o's +CIOT c i o t +CIPCA c i p c a +Cip c i p +C.I.P. c i p +CIP c i p +CIPD c i p d +CIPFA c i p f a +CIPM c i p m +CISA c i s a +CISC c i s c +cis c i s +CIs c i's +CIS c i s +CITB c i t b +cit c i t +CIT c i t +CiTD c i t d +CITM c i t m +CITN c i t n +CITP c i t p +citS c i t s +CITV c i t v +CITWF c i t w f +CitX c i t x +Ciuc c i u c +Ciu c i u +CiU c i u +CIU c i u +CIUT c i u t +CIVD c i v d +CIW c i w +CIWS c i w s +CIX c i x +Cixi c i x i +CIY c i y +CIZN c i z n +CJA c j a +CJBHL c j b h l +CJCA c j c a +CJCB c j c b +CJC c j c +C. J. c j +C.J. c j +CJD c j d +C. J. E. c j e +CJFL c j f l +CJFT c j f t +CJFX c j f x +CJGC c j g c +CJGO c j g o +CJHL c j h l +CJK c j k +CJL c j l +CJLS c j l s +CJM c j m +CJNT c j n t +CJOC c j o c +CJP c j p +C. J. R. c j r +C.J.R. c j r +CJR c j r +CJSC c j s c +C. J. S. c j s +CJS c j s +CJT c j t +CJUF c j u f +CJWC c j w c +CKAC c k a c +CKC c k c +C. K. c k +C.K. c k +CK c k +CKD c k d +CKE c k e +CKLM c k l m +CKLQ c k l q +CKLW c k l w +CKS c k s +CKSO c k s o +CKVL c k v l +C. K. W. c k w +CKWK c k w k +ckx c k x +CKXX c k x x +CKY c k y +CLAC c l a c +CLA c l a +CLAS c l a s +CLBs c l b's +clc c l c +CLC c l c +cl c l +C. L. c l +C.L. c l +CL c l +CLCN c l c n +CLD c l d +Cle c l e +CLE c l e +CLF c l f +C.L.G. c l g +CLG c l g +CLHIA c l h i a +CLHS c l h s +CLI c l i +CLK c l k +cllr c l l r +CLM c l m +CLMD c l m d +CLMP c l m p +CL&N c l and n +Clo c l o +CL&P c l and p +CLP c l p +CLRC c l r c +C. L. R. c l r +C.L.R. c l r +CLR c l r +CLRK c l r k +CLSA c l s a +CLSC c l s c +CLs c l's +CLS c l s +CLT c l t +CLTD c l t d +CLTPA c l t p a +CLTs c l t's +Clu c l u +CLU c l u +CLUK c l u k +CLV c l v +Clwyd c l w y d +CLX c l x +C&MA c and m a +CMAC c m a c +C.M.A. c m a +CMA c m a +CMAL c m a l +CMAP's c m a p's +CMAS c m a s +CMAT c m a t +C.M.B. c m b +CMB c m b +CMCC c m c c +CMCCDI c m c c d i +C.M.C. c m c +CMC c m c +cm c m +C. M. c m +C.M. c m +CM c m +CMCs c m c's +CMCS c m c s +CMD c m d +Cmde c m d e +CMDISE c m d i s e +cmdr c m d r +CMEC c m e c +CME c m e +CMF c m f +CMFS c m f s +C. M. G. c m g +C.M.G. c m g +CMG c m g +CMHC c m h c +CMH c m h +CMHR c m h r +CMI c m i +CMJ c m j +CMLA c m l a +cml c m l +C.M.L. c m l +CML c m l +CMLDP c m l d p +CMLL c m l l +CMLL's c m l l's +CMM c m m +CMMI c m m i +CMMs c m m's +cmn c m n +CMO c m o +CMO's c m o's +CMPC c m p c +CMP c m p +CMPS c m p s +CMPSO c m p s o +CMPV c m p v +CMQ c m q +CMQT c m q t +C. M. R. c m r +CMR c m r +CMSAF c m s a f +C.M.S. c m s +CMS c m s +C.M.S.L. c m s l +CMT c m t +Cmte c m t e +CMT's c m t's +CMTU c m t u +CMUCL c m u c l +CMU c m u +CMU's c m u's +CMV c m v +CMVM c m v m +CMVSS c m v s s +CMWF c m w f +CMXXII c m x x i i +CMYK c m y k +CNA c n a +CNBC c n b c +CNB c n b +CNC c n c +cn c n +C. N. c n +C.N. c n +CN c n +CNC's c n c's +CND c n d +CNDL c n d l +CNEB c n e b +CNE c n e +CNF c n f +CNFE c n f e +CNFK c n f k +CNG c n g +CNI c n i +CNJ c n j +CNJF c n j f +CNK c n k +C. N. L. c n l +C.N.L. c n l +CNL c n l +CNMs c n m's +CNN c n n +CNO c n o +CNPC c n p c +CNP c n p +cnr c n r +CNR c n r +CNRMA c n r m a +CNRS c n r s +CNSA c n s a +CNs c n's +CNS c n s +CNSS c n s s +CNSW c n s w +CNTA c n t a +CNT c n t +CNTE c n t e +CNTI c n t i +CNTK c n t k +CNTN c n t n +CNTs c n t's +CNTS c n t s +CNTV c n t v +CNU c n u +Cnut's c n u t's +CNV c n v +CNVs c n v's +CNW c n w +CNWS c n w s +CNZ c n z +COA c o a +C&O c and o +C. O. c o +C.O. c o +Co. company +C.O.D. c o d +Col. colonel +C.O.M.L. c o m l +CPAC c p a c +CPA c p a +CPA's c p a's +CPB c p b +CPBL c p b l +C&P c and p +CPC c p c +cp c p +C. P. c p +C.P. c p +CP c p +CPC's c p c's +CPCs c p c's +CPCS c p c s +CPD c p d +CPDM c p d m +CPD's c p d's +CPEB c p e b +CPEC c p e c +C.P.E. c p e +CPE c p e +CPEO c p e o +CPF c p f +CPFO c p f o +CPG c p g +CPHC c p h c +CPH c p h +CPI c p i +CPIFL c p i f l +CPIM c p i m +CPI's c p i's +CPJ c p j +CPL c p l +CPLP c p l p +CPM c p m +CPN c p n +CPNI c p n i +cpo c p o +C.P.O. c p o +CPO c p o +CPOE c p o e +CPPA c p p a +CPPCC c p p c c +CPP c p p +CPPE c p p e +CPPIB c p p i b +CPPM c p p m +CPQ c p q +CPR c p r +CPRS c p r s +CPSA c p s a +CPSC c p s c +CPS c p s +CPSF c p s f +CPSK c p s k +CPSL c p s l +CPSU c p s u +CPTA c p t a +CPT c p t +CPTM c p t m +CPUC c p u c +CPU c p u +CPUID c p u i d +CPUSA c p u s a +CPUs c p u's +CPUT c p u t +CPVA c p v a +CPV c p v +CPW c p w +CQAC c q a c +CQBR c q b r +CQC c q c +cq c q +CQ c q +CQD c q d +CQDs c q d's +CQM c q m +CQO c q o +CQU c q u +C. R. A. c r a +CRA c r a +C.R.A.Z.Y. c r a z y +CRBC c r b c +CRC c r c +cr c r +C. R. c r +C.R. c r +CR c r +Cre c r e +CRE c r e +CRF c r f +CRG c r g +CRHK c r h k +CRH's c r h's +CRHS c r h s +CRJ c r j +crk c r k +Crkva c r k v a +crkve c r k v e +CRL c r l +CRLs c r l's +crm c r m +CRM c r m +CRNA c r n a +CRN c r n +Crne c r n e +Crni c r n i +Crno c r n o +CRP c r p +CRPF c r p f +CRRF c r r f +CRs c r's +CRS c r s +CRSP c r s p +CRST c r s t +CRTC c r t c +CRT c r t +CRTC's c r t c's +CRUA c r u a +CRWRC c r w r c +CRW's c r w's +CRX c r x +CSAC c s a c +csa c s a +Csa c s a +C.S.A. c s a +CSA c s a +CSAH c s a h +Csak c s a k +Csaky c s a k y +CSAR c s a r +CSAT c s a t +CSAV c s a v +CSB c s b +C&S c and s +C.S.C. c s c +CSC c s c +CSCD c s c d +CSCE c s c e +CSCR c s c r +cs c s +C.s c's +Cs c's +C. S. c s +C.S. c s +CS c s +CSC's c s c's +CSDA c s d a +CSDB c s d b +CSD c s d +CSDL c s d l +CSDN c s d n +CSDP c s d p +CSD's c s d's +CSDS c s d s +CSE c s e +C&SF c and s f +CSF c s f +CSFL c s f l +CSFSO c s f s o +CSGA c s g a +csg c s g +CSG c s g +CSG's c s g's +CSH c s h +CSHL c s h l +CSIC c s i c +CsI c s i +CSI c s i +CSIDC c s i d c +CSILUS c s i l u s +CSIO c s i o +CSIR c s i r +CSIRO c s i r o +CSis c s i's +CSIs c s i's +CSIS c s i s +CSIU c s i u +CSKA c s k a +CSKA's c s k a's +CSK c s k +CSK's c s k's +CSL c s l +CSLI c s l i +CSM c s m +CSNB c s n b +CSNBX c s n b x +CSN c s n +CSN's c s n's +CSOB c s o b +CSO c s o +CSO's c s o's +CSOs c s o's +cspA c s p a +csp c s p +CSP c s p +CSPH c s p h +CSPI c s p i +CSPRA c s p r a +CSPs c s p's +CSRA c s r a +CSR c s r +CSRS c s r s +CSRT c s r t +CSRTT c s r t t +CSSA c s s a +CSS c s s +CSSD c s s d +CSSE c s s e +CSSL c s s l +CSSNCs c s s n c's +CSSR c s s r +CSSS c s s s +CSST c s s t +CSTB c s t b +CST c s t +CSTF c s t f +CSTI c s t i +CSTS c s t s +CSUB c s u b +CSU c s u +CSU's c s u's +Csuz c s u z +CSV c s v +CSW c s w +CSWF c s w f +CSWIP c s w i p +CSWS c s w s +CSX c s x +CSX's c s x's +CSXT c s x t +C.T.A. c t a +CTA c t a +CTAF c t a f +CTARL c t a r l +CTA's c t a's +CTAs c t a's +CTBT c t b t +CTBTO c t b t o +C&T c and t +CTC c t c +ct c t +C. T. c t +C.T. c t +CT c t +CTD c t d +cte c t e +CTE c t e +CTEQ c t e q +CTF c t f +CTGF c t g f +CTI c t i +CTLA c t l a +CTL c t l +CTLLS c t l l s +CTLs c t l's +CTM c t m +CTN c t n +CTO c t o +CTP c t p +ctr c t r +CTRG c t r g +Ctrip c t r i p +CTRL c t r l +CTRP c t r p +CTR's c t r's +CTS c t s +CTSD c t s d +CTSF c t s f +CTSG c t s g +CTUC c t u c +CTU c t u +CTUG c t u g +CTU's c t u's +CTVA c t v a +ctv c t v +CTV c t v +CTV's c t v's +CTX c t x +CTZ c t z +cu c u +C. U. c u +CU c u +C.U.L. c u l +C. U. S. c u s +C. U. T. c u t +CUW c u w +Cuyp c u y p +CVA c v a +CVAK c v a k +CVARG c v a r g +CVB c v b +C&V c and v +CVC c v c +cvcp c v c p +'cv c v +cv c v +C. V. c v +C.V. c v +CV c v +CVD c v d +CVEs c v e's +CVG c v g +CVI c v i +CVJM c v j m +CVM c v m +C.V.N. c v n +CVN c v n +C.V.O. c v o +CVO c v o +CVODE c v o d e +CVOs c v o's +CVP c v p +CVR c v r +CVs c v's +CVS c v s +CVSNT c v s n t +CVT c v t +CVTs c v t's +CVV c v v +CVVHDF c v v h d f +CVW c v w +CVZ c v z +CWA c w a +CWBI c w b i +CWBL c w b l +CWC c w c +C. W. c w +C.W. c w +CWD c w d +CWDS c w d s +C. W. E. c w e +CWE c w e +Cwej c w e j +Cwele c w e l e +CWF c w f +CWGC c w g c +CWG c w g +CWI c w i +C. W. K. c w k +cwm c w m +CWM c w m +CWO c w o +CWPA c w p a +CWR c w r +cwrt c w r t +CWRU c w r u +CWSAC c w s a c +CW's c w's +CWS c w s +CWTS c w t s +CWUR c w u r +C. W. Y. c w y +CWYFL c w y f l +CXC c x c +CXCL c x c l +CXCR c x c r +C.X. c x +C. Y. c y +C.Y. c y +cyl c y l +Cyn c y n +CYOG c y o g +CyP c y p +CYP c y p +Cyrl c y r l +Cys c y's +CYS c y s +CYSK c y s k +CYSY c y s y +czci c z c i +cz c z +C.Z. c z +CZ c z +CZE c z e +CZM c z m +CZW c z w +czy c z y +DAAD d a a d +Daai d a a i +D. A. d a +D.A. d a +D&AD d and a d +D. A. H. d a h +D.A.M. d a m +D.A.N.C.E. dance +D. A. T. d a t +Dav d a v +D.A.V. d a v +DAV d a v +DAV's d a v's +dBa d b a +DBA d b a +DBC d b c +DBCS d b c s +db d b +D. B. d b +D.B. d b +DB d b +DBE d b e +DBI d b i +DBL d b l +DBLE d b l e +DBLP d b l p +DBM d b m +DBMS d b m s +DBR d b r +DB's d b's +D. B. S. d b s +DBS d b s +DBU d b u +DBYC d b y c +DBZ d b z +DCA d c a +DCAF d c a f +DCAM d c a m +DCB d c b +DCCC d c c c +DCCCD d c c c d +DCC d c c +DCCG d c c g +DCCs d c c's +D&C d and c +dc d c +D. C. d c +D.C. d c +DC d c +DCE d c e +DCFC d c f c +DCF d c f +DCG d c g +DCH d c h +DCI d c i +DCK d c k +D.C.L. d c l +DCL d c l +DCMA d c m a +DCM d c m +DCMF d c m f +DCMI d c m i +DCMS d c m s +DCO d c o +DCom d c o m +DCOM d c o m +DCP d c p +DCR d c r +D.C.'s d c's +DC's d c's +DCs d c's +DCS d c s +DCSD d c s d +DCSO d c s o +DCSPER d c s p e r +DCSS d c s s +DCTA d c t a +DCT d c t +DCU d c u +DCUO d c u o +DCUs d c u's +DDA d d a +DDB d d b +D.D.C. d d c +DDC d d c +D&D d and d +D. D. d d +D.D. d d +DDF d d f +DDG d d g +DDHH d d h h +DDi d d i +DDI d d i +DDK d d k +DDLJ d d l j +DDM d d m +DDMS d d m s +DDN d d n +DDNOS d d n o s +Ddoc d d o c +DDO d d o +DDP d d p +DDR d d r +DDRMAX d d r m a x +DDSB d d s b +D.D.S. d d s +DDS d d s +DDT d d t +DDTV d d t v +Ddu d d u +DDWFTTW d d w f t t w +DDX d d x +D.E.A.F. d e a f +Deah d e a h +DEA's d e a's +DECC d e c c +DEC d e c +DECS d e c s +DEDD d e d d +D. E. d e +D.E. d e +deg d e g +D. E. G. d e g +DEG d e g +DEH d e h +DEHP d e h p +dei d e i +Dei d e i +DeI d e i +DEI d e i +Deijm d e i j m +Deip d e i p +D. E. J. d e j +D.E.R. d e r +dez d e z +Dez d e z +Dfa d f a +DFA d f a +DFB d f b +D.F.C. d f c +DFC d f c +DFCs d f c's +D. F. d f +D.F. d f +DFD's d f d's +DfE d f e +D.F.E. d f e +DFE d f e +DfES d f e s +DFF d f f +DFG d f g +DFJ d f j +DFL d f l +DFM d f m +DFOA d f o a +DFO d f o +DFP d f p +DFPs d f p's +DFRC d f r c +DFR d f r +DFs d f's +DFS d f s +DFT d f t +DFW d f w +dfx d f x +DFX d f x +DGAC d g a c +DGA d g a +DGALS d g a l s +DGAP d g a p +DGB d g b +DGCA d g c a +DGC d g c +DGCR d g c r +D&G d and g +D. G. d g +D.G. d g +D. G. E. d g e +DGE d g e +DGERT d g e r t +DGF d g f +DGFI d g f i +DGH d g h +DGK d g k +D. G. L. R. d g l r +DGM d g m +DGMO d g m o +DGP d g p +DGPS d g p s +DGR d g r +Dha d h a +DHA d h a +DHB d h b +DHBs d h b's +DHCP d h c p +D&H d and h +dh d h +D. H. d h +D.H. d h +DH d h +DHEA d h e a +d'HEC d h e c +dhe d h e +DHE d h e +Dheku d h e k u +DHFS d h f s +DHHC d h h c +DHH d h h +DHL d h l +DHMO d h m o +DHNC d h n c +D.H.N. d h n +DHNS d h n s +Dhod d h o d +dhol d h o l +Dhol d h o l +Dhoo d h o o +Dhor d h o r +Dhou d h o u +DHP d h p +DHPH d h p h +DHQ d h q +dhr d h r +D.H.R. d h r +DHRS d h r s +DHS d h s +DHSs d h s's +DHSS d h s s +DHT d h t +DHV d h v +DHW d h w +DHX d h x +D.I. d i +DIFC d i f c +DISD d i s d +DIW d i w +DIX d i x +diy d i y +DiY d i y +D.I.Y. d i y +DIY d i y +Diyn d i y n +DIYs d i y's +D. J. A. d j a +Djam d j a m +dj d j +D. J. d j +D.J. d j +DJ d j +DJ'ed d j e d +Djem d j e m +D.J.H. d j h +Dji d j i +DJI d j i +D.J.N. d j n +Djo d j o +D'Jok d j o k +djr d j r +DJR d j r +D.J.s d j's +DJ's d j's +DJs d j's +D. J. S. d j s +D.J.T. d j t +DjVu d j v u +DJVU d j v u +DjVus d j v u's +D. J. Y. d j y +DKC d k c +D. K. d k +D.K. d k +DKI d k i +DKIM d k i m +DKK d k k +DKNY d k n y +DKPP d k p p +D. K. R. d k r +DKW d k w +dla d l a +DLA d l a +DLC d l c +DLD d l d +dl d l +D. L. d l +D.L. d l +DL d l +DLE d l e +D.L.F. d l f +DLF d l f +DLFN d l f n +DLG d l g +D. L. H. d l h +dlia d l i a +DLI d l i +DLJ d l j +DLJ's d l j's +DLK d l k +DLL d l l +DL&LR d l and l r +DLL's d l l's +DLLs d l l's +DLM d l m +DLMPST d l m p s t +dlo d l o +DLP d l p +DLPFC d l p f c +DLP's d l p's +DLR d l r +DLS d l s +DLSS d l s s +DLSU d l s u +DLSU's d l s u's +DLT d l t +DL&W d l and w +DLZ d l z +DMAA d m a a +DMA d m a +DMB d m b +DMBT d m b t +DMCA d m c a +DMCC d m c c +DMC d m c +DMCM d m c m +D.M.C.'s d m c's +D&M d and m +DMD d m d +DMDK d m d k +D. M. d m +D.M. d m +DM d m +DMDS d m d s +DMed d m e d +DM&E d m and e +DME d m e +DMF d m f +DMG d m g +DMGT d m g t +DMHS d m h s +DMI d m i +DMK d m k +DML d m l +DMN d m n +DMO d m o +DMOFD d m o f d +DMOZ d m o z +DMP d m p +DMRC d m r c +DMR d m r +DMRG d m r g +DMs d m's +DMS d m s +DMSII d m s i i +DMT d m t +DMTF d m t f +DMU d m u +DMUs d m u's +DMV d m v +DMX d m x +DMZ d m z +Dna d n a +DnA d n a +DNA d n a +DNADTC d n a d t c +DNAITV d n a i t v +DNAJA d n a j a +DNAJC d n a j c +DnaJ d n a j +DNAN d n a n +DNB d n b +DNBY d n b y +DNC d n c +DNCG d n c g +DND d n d +D. N. d n +D.N. d n +Dnepr d n e p r +dnes d n e s +Dnes d n e's +DNES d n e s +DNF d n f +DNF's d n f's +DNFs d n f's +DNG d n g +DNJO d n j o +DNKA d n k a +DNK d n k +DNM d n m +DNMT d n m t +DNP d n p +DNQ d n q +DNR d n r +DNSBLs d n s b l's +dns d n s +D.N.S. d n s +DNS d n s +DNSS d n s s +DNT d n t +DNU d n u +DNVP d n v p +D.O.A. d o a +D.O.A.'s d o a's +DOAS d o a s +D.O.B. d o b +D.O.C. d o c +DOCG d o c g +dod d o d +Dod d o d +DoD d o d +DOD d o d +D. O. d o +D.O. d o +DOD's d o d's +D.O.E. d o e +DOGNY d o g n y +DOHC d o h c +D'oh d o h +DOJ d o j +DOJ's d o j's +dok d o k +Dok d o k +domt d o m t +Domt d o m t +Dop d o p +DOP d o p +DOPR d o p r +DOSAAF d o s a a f +DOTC d o t c +dotCMS d o t c m s +DOTD d o t d +DOTP d o t p +DotSVN d o t s v n +Douw d o u w +DOW d o w +DOXO d o x o +dozd d o z d +d'OZ d o z +Dozhd d o z h d +DPAA's d p a a's +DPA d p a +DPB d p b +DPD d p d +dp d p +D. P. d p +D.P. d p +DP d p +DPG d p g +DPJ d p j +DPMA d p m a +DPM d p m +DPN d p n +DPNM d p n m +DPO d p o +dpon d p o n +DPP d p p +DPP's d p p's +DPPX d p p x +DPR d p r +DPRK d p r k +DPRK's d p r k's +DProf d p r o f +DPRP d p r p +DPRT d p r t +DPs d p's +DPS d p s +DPSS d p s s +DPSSL d p s s l +DPT d p t +DPW d p w +DPW's d p w's +DPX d p x +DPYS d p y s +D.Q. d q +DQOY d q o y +DQV d q v +DRB d r b +DRBG d r b g +DRB's d r b's +DRCA d r c a +drc d r c +DRC d r c +DRDA d r d a +DRDC d r d c +DRD d r d +Dr. doctor +D. R. d r +D.R. d r +DRG d r g +dri d r i +Dri d r i +DRI d r i +DRIs d r i's +DRITTES d r i t t e s +Driu d r i u +Driv d r i v +DRJTBC d r j t b c +DRK d r k +DRL d r l +DRLR d r l r +DRMC d r m c +D.R.M. d r m +DRM d r m +Drnis d r n i's +Dro d r o +DRO d r o +DRP d r p +Drs. doctors +DR's d r's +DRS d r s +Drska d r s k a +DRT d r t +druj d r u j +DSA d s a +DsbA d s b a +DS&BB d s and b b +DSB d s b +DSBL d s b l +D.S.C. d s c +DSC d s c +D.S.C.H. d s c h +DSCM d s c m +DSCR d s c r +DSCS d s c s +DSDB d s d b +DSD d s d +DSDM d s d m +dsDNA d s d n a +DSDP d s d p +ds d s +Ds d's +D. S. d s +D.S. d s +DS d s +DSDS d s d s +DSG d s g +DSGi d s g i +DSIC d s i c +dsi d s i +DSi d s i +DSI d s i +DSIF d s i f +DSIR d s i r +DSJ d s j +dsl d s l +D. S. L. d s l +DSL d s l +DSLR d s l r +DSMB d s m b +D.S.M. d s m +DSM d s m +DSMs d s m's +dsn d s n +D&SNGRR d and s n g r r +DSNP d s n p +D.S.O. d s o +DSO d s o +DSPA d s p a +DSP d s p +DSR d s r +DS's d s's +DSS d s s +DST d s t +dsu' d s u +DSU d s u +DSV d s v +DSW d s w +DSX d s x +DSZG d s z g +D.T.A. d t a +DTA d t a +DTC d t c +DTC's d t c's +DTCs d t c's +DTDC d t d c +DTD d t d +DTDs d t d's +D. T. d t +D.T. d t +DT&E d t and e +DTE d t e +DTEK d t e k +DTES d t e s +DTG d t g +DTH d t h +DTIC d t i c +DT&I d t and i +DTI d t i +DTLA d t l a +dtl d t l +DTL d t l +DTLLS d t l l s +DTLS d t l s +DTM d t m +DTO d t o +DTPA d t p a +DTPC d t p c +DTRA d t r a +DTR d t r +DTRS d t r s +DTs d t's +DTS d t s +DTT d t t +D.T.U. d t u +DTU d t u +DTV d t v +dty d t y +D.U. d u +dva d v a +Dva d v a +DVA d v a +DVB d v b +DVBE d v b e +DVBIC d v b i c +DVC d v c +DVCs d v c's +DVCS d v c s +dvd d v d +DVD d v d +DVD's d v d's +DVDs d v d's +dv d v +D. V. d v +D.V. d v +DV d v +dve d v e +dvfb d v f b +DVFS d v f s +DVGS d v g s +DVHS d v h s +dvi d v i +DVI d v i +dvije d v i j e +Dvin d v i n +Dvir d v i r +DVLA d v l a +DVLA's d v l a's +DVL d v l +DVM d v m +DVP d v p +DVR d v r +DVRJRBC d v r j r b c +DVR's d v r's +DVSC d v s c +DVS d v s +DVT d v t +DVV d v v +DVVT d v v t +DVWK d v w k +Dwa d w a +DWA d w a +D&W d and w +D. W. d w +D.W. d w +Dwedw d w e d w +DWET d w e t +DWF d w f +DWG d w g +D.W.H. d w h +Dwi d w i +DWI d w i +DWM d w m +DWN d w n +DWNU d w n u +DWP d w p +dwr d w r +DWR d w r +DWRFC d w r f c +DWS d w s +DWT d w t +DWTS d w t s +dwur d w u r +dxa d x a +DXA d x a +dx d x +D.X. d x +DX d x +DXED d x e d +DXers d x e r's +DXII d x i i +DXK d x k +DXR d x r +DXZ d x z +Dydd d y d d +dy d y +Dy d y +D. Y. d y +DY d y +DYFI d y f i +DYIS d y i s +DYNC d y n c +dypl d y p l +dyr d y r +DYSP d y s p +DZBB d z b b +DZB d z b +dz d z +DZEC d z e c +DZEM d z e m +dzis d z i s +DZNE d z n e +Dzog d z o g +Dzor d z o r +DZRH d z r h +DZRH's d z r h's +DZS d z s +Dzus d z u's +DZXL d z x l +DZZ d z z +EAAB e a a b +EAA e a a +EAAP e a a p +E. A. C. e a c +EAC e a c +EACEF e a c e f +EACS e a c s +EAD e a d +E. A. e a +E.A. e a +EAF e a f +EAGE e a g e +E.A.H. e a h +EAH e a h +EAI e a i +EAIE e a i e +E. A. J. e a j +EAMs e a m's +EAP e a p +E.A.R.L. e a r l +E.A.R.T.H. e a r t h +EASA e a s a +EASB e a s b +eas e a s +Eas e a's +EA's e a's +EAS e a s +Eav e a v +EAX e a x +E. B. e b +E.B. e b +EBL e b l +Ebn e b n +EBNF e b n f +EBOV e b o v +E&BR e and b r +EBR e b r +Ebru e b r u +EBS e b s +EBSL e b s l +EBT e b t +EBU e b u +EBV e b v +E.B.W. e b w +EBWs e b w's +EBZR e b z r +ECAC e c a c +ECA e c a +ECAR e c a r +ECB e c b +ECBJ e c b j +ECBL e c b l +ECCA e c c a +ECCC e c c c +ecc e c c +ECC e c c +ECCI e c c i +Eccl e c c l +ECCRFA e c c r f a +ECCW e c c w +ECD e c d +ec e c +Ec e c +E. C. e c +E.C. e c +EC e c +ece e c e +Ece e c e +ECE e c e +Ecem e c e m +ECFA e c f a +ECF e c f +ECFR e c f r +ECFU e c f u +ecg e c g +ECG e c g +ECH e c h +ECHL e c h l +ECHR e c h r +ECI e c i +ECJ e c j +ECLAC e c l a c +ECLA e c l a +ECLC e c l c +ECL e c l +ECLI e c l i +ECLSS e c l s s +ecma e c m a +ECMA e c m a +ECMC e c m c +ECMDB e c m d b +E.C.M. e c m +ECM e c m +ECMI e c m i +ECML e c m l +ECMLRUS e c m l r u s +ECMWF e c m w f +ECN e c n +ECNP e c n p +ECNs e c n's +ECNS e c n s +ECNZ e c n z +ECP&DA's e c p and d a's +ECP e c p +ECPR e c p r +ECQ e c q +ECR e c r +eCRM e c r m +ECRR e c r r +ECR's e c r's +ECSA e c s a +EC's e c's +E. C. S. e c s +E.C.S. e c s +ECS e c s +ect e c t +E. C. T. e c t +ECT e c t +ECTLO e c t l o +ECTN e c t n +ECTS e c t s +ECV e c v +ECVs e c v's +ECWA e c w a +ECW e c w +edb e d b +EDB e d b +EDC e d c +E. D. e d +E.D. e d +EDF e d f +Edh e d h +EDH e d h +edhe e d h e +EDHF e d h f +EDIB e d i b +EDI e d i +EDK e d k +EDL e d l +EDMA e d m a +EDM e d m +EDMs e d m's +EDMW e d m w +Edmx e d m x +edn e d n +Edn e d n +EDN e d n +EDP e d p +EDQH e d q h +E.D.R. e d r +EDRP e d r p +EDSA e d s a +EDSC e d s c +eds e d s +Eds e d's +E. D. S. e d s +EDS e d s +EDSP e d s p +EDTA e d t a +EDT e d t +EDVAC e d v a c +EDWDO e d w d o +Edw e d w +EDXRD e d x r d +EEA e e a +EEAF e e a f +EEAS e e a s +EEBC e e b c +Eeb e e b +EEC e e c +EECS e e c s +E. E. e e +E.E. e e +Eef e e f +EEF e e f +Eega e e g a +EEI e e i +EEI's e e i's +EEJF e e j f +EELC e e l c +eene e e n e +EEOC e e o c +EEPCO e e p c o +eep e e p +EEP e e p +EERC e e r c +EERI e e r i +Ees e e's +EES e e s +EEST e e s t +EEUU e e u u +eeuw e e u w +Eeuw e e u w +EEZs e e z's +EFA e f a +EFAS e f a s +EFCC e f c c +efc e f c +EFC e f c +EFCJ e f c j +EFD e f d +ef e f +Ef e f +E. F. e f +E.F. e f +EF e f +E. F. J. e f j +E. F. K. e f k +EFL e f l +EFM e f m +EFNB e f n b +EFPA e f p a +EFP e f p +EFQUEL e f q u e l +EFR e f r +EFRU e f r u +EFSA e f s a +eFS e f s +Efs e f's +EFSET e f s e t +EFTPOS e f t p o s +EFUA e f u a +Efu e f u +EFV e f v +EFVR e f v r +EFVS e f v s +E. F. W. e f w +EFX e f x +EFY e f y +E. G. A. e g a +EGA e g a +Egba e g b a +EGBA e g b a +EGBT e g b t +EGC e g c +EGD e g d +EGF e g f +egfl e g f l +EGFL e g f l +e.g. for example +e. g. for example +EGFR e g f r +EG&G e g and g +E. G. H. e g h +Egi e g i +EGL e g l +EGM e g m +E&GR e and g r +EGR e g r +EGREM e g r e m +EGSC e g s c +EGX e g x +egy e g y +EGY e g y +Egyl e g y l +EHAAT e h a a t +EHAs e h a's +EHC e h c +EHCI e h c i +EHD e h d +E. H. e h +E.H. e h +ehf e h f +EHF e h f +E. H. M. e h m +EHP e h p +EHRC e h r c +EHR e h r +EHS e h s +EHSH e h s h +Ehttp e h t t p +EIA e i a +EIC e i c +EiCs e i c's +EIC's e i c's +E. I. e i +E.I. e i +EIES e i e s +eIF e i f +EIF e i f +EIFF e i f f +EIF's e i f's +EIT e i t +EITI e i t i +Eitr e i t r +EITs e i t's +EIU e i u +E. J. A. e j a +EJB e j b +EJBs e j b's +EJC e j c +ej e j +E. J. e j +E.J. e j +EJ e j +E. J. H. e j h +E.J.H. e j h +EJH e j h +EJHL e j h l +EJMA e j m a +E. J. M. e j m +EJML e j m l +E. J. R. e j r +E.J.S. e j s +EJSM e j s m +EJV e j v +EKB e k b +EKBO e k b o +EKCO's e k c o's +EKD e k d +E. K. e k +E.K. e k +EKF e k f +EKG e k g +eki e k i +EKIZ e k i z +EKL e k l +EKLR e k l r +Ekma e k m a +EKNU e k n u +Ekow e k o w +eks e k s +Eks e k's +EKS e k s +E. K. U. e k u +EKU e k u +E. L. C. e l c +E. L. e l +E.L. e l +ELH e l h +ELTs e l t's +ELUs e l u's +ELV e l v +EMA e m a +EMAS e m a s +Embd e m b d +EMB e m b +eMC e m c +EMC e m c +EMD e m d +EMD's e m d's +EMDs e m d's +EMDS e m d s +Emea e m e a +EMEA e m e a +E&M e and m +E. M. e m +E.M. e m +EMF e m f +Emge e m g e +EMG e m g +EMLL e m l l +E.M.M. e m m +EMNLP e m n l p +EMP e m p +emra e m r a +EMR e m r +EMSC e m s c +E.M.S. e m s +EMTE e m t e +EMT e m t +EMV e m v +E&NA e and n a +Enas e n a's +ENAS e n a s +EnBW e n b w +ENC e n c +EncFS e n c f s +Encyc e n c y c +E.N.D. e n d +ENEC e n e c +E. N. e n +E.N. e n +Enes e n e's +engl e n g l +Engl e n g l +ENGM e n g m +Engr e n g r +Eni e n i +ENI e n i +enn e n n +Enn e n n +ENP e n p +ENR e n r +ens e n s +Ens e n's +ENS e n s +Enso e n s o +ENSO e n s o +ENTJs e n t j's +ENTP e n t p +ENTV e n t v +EOC e o c +EOC's e o c's +EoD e o d +EOD e o d +E. O. e o +E.O. e o +EOFFTV e o f f t v +EOG e o g +Eois e o i's +EOKA e o k a +eok e o k +Eole e o l e +Eol e o l +EOL e o l +Eolss e o l s's +Eom e o m +EOOW e o o w +eop e o p +eoptta e o p t t a +Eora e o r a +EOR e o r +Eorl e o r l +Eors e o r's +EOSHD e o s h d +EOTC e o t c +EOTDC e o t d c +EOU e o u +E.O.W. e o w +E&P e and p +Epe e p e +E. P. E. e p e +EPEG e p e g +ep e p +Ep e p +E. P. e p +E.P. e p +EP e p +EPF e p f +EPFL e p f l +EPG e p g +EPHAR e p h a r +EPHB e p h b +Eph e p h +EPH e p h +Ephs e p h's +EPIA e p i a +epi e p i +Epi e p i +EPI e p i +E.P.J. e p j +EPL e p l +EPLF e p l f +EPM e p m +EPOC e p o c +ePO e p o +EPO e p o +epos' e p o's +epos e p o s +Epos e p o's +EPRDF e p r d f +EPR e p r +EPRI e p r i +EPRO e p r o +EPSC e p s c +E.P.s e p's +EPT e p t +EPV e p v +EPZA e p z a +EPZ e p z +EQAO e q a o +eq e q +Eq e q +EQ e q +EQG e q g +EQN e q n +EQP e q p +EQS e q s +EQT e q t +E.R.A. e r a +ERAF e r a f +ERAU e r a u +ERCB e r c b +ERC e r c +ERCES e r c e s +ERCIM e r c i m +ERCS e r c s +E. R. D. e r d +E. R. e r +E.R. e r +ERF e r f +ERH e r h +ERJs e r j's +ERK e r k +ERP e r p +ERPM e r p m +ERPMRP e r p m r p +ERRC e r r c +E. R. R. e r r +E.R.R. e r r +ERSAR e r s a r +ERT e r t +Eru e r u +ERU e r u +ERUUF e r u u f +Eruv e r u v +Erv e r v +ERW e r w +ES3 e s three +Esa e s a +E.S.A. e s a +ESA e s a +Esam e s a m +Esa's e s a's +ESA's e s a's +Esat e s a t +ESB e s b +ESC e s c +ESCHL e s c h l +ESCs e s c's +Esd e s d +ESD e s d +ESDI e s d i +E.S.E. e s e +E. S. e s +E.S. e s +ESF e s f +ESFG e s f g +E.S.G. e s g +ESG e s g +ESGR e s g r +esi e s i +ESI e s i +ESL e s l +ESM e s m +ESMLC e s m l c +ESMT e s m t +ESNAGI e s n a g i +ESN e s n +ESPA e s p a +ESPC e s p c +ESPD e s p d +ESP e s p +espn e s p n +ESPN e s p n +ESPNhttp e s p n h t t p +ESPN's e s p n's +ESPNU e s p n u +ESPNW's e s p n w's +esq e s q +Esq e s q +Esq. esquire +Esraa e s r a a +Esra e s r a +ESRB e s r b +ESRC e s r c +Esref e s r e f +ESR e s r +ESRF e s r f +Esri e s r i +ESRI e s r i +ESSR e s s r +estd e s t d +Estd e s t d +EST e s t +ESTP e s t p +esu e s u +ESU e s u +ESU's e s u's +Esva e s v a +ESV e s v +ESWAT e s w a t +ESW e s w +Etad e t a d +ETA e t a +ETAF e t a f +ETA's e t a's +ETASU e t a s u +ETB e t b +ETBs e t b's +E.T.C. e t c +ETCO's e t c o's +ETCS e t c s +ETCSL e t c s l +ETD e t d +E. T. e t +E.T. e t +ETF e t f +ETFs e t f's +ETFS e t f s +Et'hem e t h e m +ETH e t h +Eti e t i +ETI e t i +ETIM e t i m +ETIM's e t i m's +etj e t j +ETJ e t j +ETL e t l +ETNZ e t n z +Eto e t o +ETO e t o +ETRM e t r m +ETRS e t r s +ETSEIB e t s e i b +ets e t s +Ets e t's +ET's e t's +ETs e t's +ETS e t s +ett e t t +Ett e t t +ETT e t t +Ettre e t t r e +Etts e t t's +ETU e t u +ETV e t v +Etz e t z +EUA e u a +EUB e u b +EUBs e u b's +EUBS e u b s +EUCAP e u c a p +EUCE e u c e +EUC e u c +EUCOM's e u c o m's +EUDEC e u d e c +EUD e u d +E. U. e u +E.U. e u +EU e u +eup e u p +EUP e u p +Eurwg e u r w g +EUSA e u s a +Euse e u s e +EU's e u's +EUS e u s +EUSEW e u s e w +Eusi e u s i +EUV e u v +EUX e u x +EVAAP e v a a p +EvaGT e v a g t +EVDC e v d c +EVD e v d +EVDO e v d o +E. V. e v +E.V. e v +EVEX e v e x +EVIT e v i t +evl e v l +EVL e v l +EVM e v m +Evna e v n a +EVN e v n +EVNS e v n s +evnt e v n t +E.V.O. e v o +E.V.O.L. e v o l +EVP e v p +EVR e v r +EVs e v's +EVS e v s +evv e v v +EVV e v v +Ewa's e w a's +EWD e w d +EWEB e w e b +E. W. e w +E.W. e w +EWF e w f +EWF's e w f's +Ewha e w h a +EWH e w h +E.W.K. e w k +EWLA e w l a +EWL e w l +EWO e w o +EWOs e w o's +EWP e w p +EW's e w's +EWS e w s +EWTN e w t n +Ewu e w u +EWU e w u +excl e x c l +exd e x d +E.X. e x +exhb e x h b +exh e x h +EXI e x i +EXIF e x i f +EXIN e x i n +EXL e x l +EXLM e x l m +E. X. M. e x m +Exptl e x p t l +EXR e x r +exsul e x s u l +EXT e x t +EYA e y a +EYCN e y c n +EYD e y d +E&Y e and y +E. Y. e y +EY e y +Eyk e y k +eyu e y u +Ezaa e z a a +ez e z +Ez e z +EZ e z +Ezh e z h +EZH e z h +EZO e z o +EZR e z r +EZTV e z t v +Ezu e z u +EZW e z w +Ezy e z y +Faaa f a a a +faa f a a +Faa f a a +FAA f a a +faama f a a m a +FAANP f a a n p +FabH f a b h +FABM f a b m +FabR f a b r +F.A.B.'s f a b's +F.A.C.E. f a c e +FACR f a c r +F.A.C.S. f a c s +FADD f a d d +Fadl f a d l +FADS f a d s +FAEM f a e m +fa f a +Fa f a +F. A. f a +F.A. f a +FA f a +Faf f a f +FAFG f a f g +Fafhrd f a f h r d +FAFL f a f l +F. A. G. f a g +F.A.H. f a h +fai f a i +Fai f a i +FAI f a i +FAIM f a i m +FAIP f a i p +FAIPs f a i p's +Faiq f a i q +fajn f a j n +FAK f a k +Fal f a l +FAL f a l +F.A.M.E. f a m e +F.A.M. f a m +FAQ f a q +FARC's f a r c's +FARDC f a r d c +F.A.R. f a r +farw f a r w +FASA f a s a +FASB f a s b +fasc f a s c +Fasc f a s c +fas f a s +Fas f a's +FAs f a's +F.A.S. f a s +FAS f a s +FASG f a s g +FasL f a s l +FASRE f a s r e +FATF f a t f +FAUP f a u p +FAVC f a v c +FBA f b a +FBD f b d +FBFA f b f a +F. B. f b +F.B. f b +FB f b +F.B.G.s f b g's +F.B.I. f b i +FBI f b i +FBI's f b i's +FBK f b k +FBL f b l +FBMW f b m w +FBN f b n +FBO f b o +FBOs f b o's +FBPA f b p a +FBR f b r +FBS f b s +FBSN f b s n +FBSU f b s u +FBT f b t +FCA f c a +fcb f c b +FCB f c b +FCBF f c b f +F.C.B.I. f c b i +FCBL f c b l +FCBs f c b's +F.C.C. f c c +FCC f c c +FCD f c d +F&C f and c +fc f c +F. C. f c +F.C. f c +FCF f c f +FCGR f c g r +F. C. H. f c h +F.C.H.L. f c h l +FCIAC f c i a c +FCIC f c i c +FCI f c i +FCIP f c i p +FCK f c k +FCL f c l +FCNM f c n m +FCNZ f c n z +FCO f c o +FCP f c p +F.C.P.R.E.M.I.X. f c p r e m i x +FCPS f c p s +FCRLA f c r l a +F.C.'s f c's +FC's f c's +FCS f c s +FCT f c t +FCU f c u +FCUL f c u l +FCV f c v +F. C. W. f c w +FCW f c w +FCW's f c w's +FDA f d a +FDCC f d c c +FD&C f d and c +FDCPA f d c p a +FDCPAs f d c p a's +FDD f d d +FDDI f d d i +FDE f d e +F. D. f d +F.D. f d +FDFL f d f l +FDGB f d g b +FDG f d g +FDICs f d i c's +FdI f d i +FDI f d i +FDIO f d i o +FDJ f d j +FDL f d l +FDLT f d l t +FDM f d m +FDMNES f d m n e s +FDNY f d n y +FDP f d p +FDP's f d p's +FDR f d r +FDU f d u +F. E. f e +F.E. f e +FEFK f e f k +FEFSI f e f s i +FEFY f e f y +FEG f e g +FEGs f e g's +FEP f e p +F.E.R.S. f e r s +Fes f e's +FES f e s +FFA f f a +FFAK f f a k +ffc f f c +FFC f f c +FFC's f f c's +FFDO f f d o +ff f f +F. F. f f +F.F. f f +FF f f +FFF f f f +FFG f f g +FFH f f h +FFI f f i +FFK f f k +FFL f f l +FFL's f f l's +FFME f f m e +ffm f f m +FFOM f f o m +FFP f f p +FFPIR f f p i r +FFR f f r +FFSA f f s a +FF's f f's +FFs f f's +FFS f f s +FFU f f u +FFV f f v +FFWD f f w d +FGCU f g c u +FGFA f g f a +FGF f g f +F. G. f g +F.G. f g +FGFR f g f r +FGID f g i d +fgk f g k +FGL f g l +FGM f g m +FGR f g r +FGs f g's +FGS f g s +FGU f g u +FGV f g v +F. H. A. f h a +FHA f h a +FHAR f h a r +F. H. C. f h c +FHFA f h f a +F. H. f h +F.H. f h +FHI's f h i's +FHL f h l +fhm f h m +FHM f h m +FHM's f h m's +FHQ f h q +FHSAA f h s a a +FHS f h s +FHWA f h w a +F. H. W. f h w +FIAC f i a c +fiadh f i a d h +fia f i a +FIA f i a +FIAPO f i a p o +FIA's f i a's +FIAS f i a s +FIBCO f i b c o +F. I. B. f i b +FiBL f i b l +FIBT f i b t +FIC f i c +Fi'd f i d +FIDH f i d h +F.I f +F&I f and i +F. I. f i +F.I. f i +FIFTA f i f t a +FIGC f i g c +Figl f i g l +FIH f i h +FIH's f i h's +fija f i j a +FIJL f i j l +FIK f i k +F.I.M. f i m +FIM f i m +FIMI f i m i +Fio f i o +FiO f i o +FIO f i o +F.I.R. f i r +F.I.T.T. f i t t +FIU f i u +FIVB f i v b +F. J. A. f j a +FJE f j e +F. J. f j +F.J. f j +F.J.G. f j g +FJK f j k +F. J. M. f j m +FKA f k a +FKBP f k b p +F. K. f k +F.K. f k +FKK f k k +FKL's f k l's +FKS f k s +FKY f k y +Fla f l a +FLB f l b +FLCL f l c l +FLCS f l c s +FLD f l d +FLDS f l d s +FLEC f l e c +FLE f l e +Fles f l e's +FLEST f l e s t +FLETC f l e t c +fl f l +F. L. f l +F.L. f l +FL f l +FLH f l h +fli f l i +FLI f l i +FLI's f l i's +FLL f l l +F.L.M. f l m +FLM f l m +FLNB f l n b +FLN f l n +FLP f l p +FLPP f l p p +FLQ f l q +FLRA f l r a +FLR f l r +FLRL f l r l +FLS f l s +FLSW f l s w +FLT f l t +FLTK f l t k +FLTR f l t r +FLTS f l t s +FLV f l v +FLW f l w +flyr f l y r +FMA f m a +FMARS f m a r s +FMC f m c +FMCG f m c g +FMCSA f m c s a +FMCS f m c s +FMF f m f +fm f m +F. M. f m +F.M. f m +FM f m +FMH f m h +FMHS f m h s +FMI f m i +FMJD f m j d +FMLN f m l n +FMM f m m +FMN f m n +FMNJ f m n j +FMNP f m n p +FMPA's f m p a's +FMP f m p +FMQB f m q b +FMR f m r +fMRI f m r i +FMRP f m r p +FMRU f m r u +FM's f m's +FMs f m's +FMS f m s +FMSF's f m s f's +FMSO f m s o +FMV f m v +FMW f m w +FMX f m x +FMY f m y +FNAC f n a c +F. N. A. f n a +FNA f n a +FNB f n b +FNC f n c +F. N. D. f n d +FNE f n e +F. N. f n +F.N. f n +FNIC f n i c +FNI f n i +FNLA f n l a +FNLC f n l c +FNLC's f n l c's +FNL f n l +FNO f n o +FNP f n p +FNPI f n p i +FNSEA f n s e a +FNU f n u d s a +FOF f o f +F. O. f o +FPA f p a +FPB f p b +FPC f p c +FPCP f p c p +F.P.D. f p d +FPDs f p d's +fp f p +F. P. f p +F.P. f p +FP f p +FPGA f p g a +FPGAs f p g a's +FPI f p i +FPJ f p j +FPK f p k +F. P. L. f p l +FPL f p l +FPMR f p m r +FPM&SA f p m and s a +FPO f p o +FPP f p p +FPPS f p p s +F.P.R. f p r +FPR f p r +FPSC f p s c +fps f p s +FPS f p s +FPSO f p s o +FPSs f p s's +FPTP f p t p +FPU f p u +FQAD f q a d +F.Q. f q +FRA f r a +FRA's f r a's +FRAXA f r a x a +FRB f r b +FRBNF f r b n f +FRCC f r c c +F. R. C. f r c +FRC f r c +FRCNA f r c n a +FRCP f r c p +FRCS f r c s +FRDF f r d f +F.R.D. f r d +fr f r +F. R. f r +F.R. f r +FR f r +FRFS f r f s +FRFT f r f t +FRG f r g +F.R.G.S. f r g s +F.R.H.S. f r h s +F.R.I.B.A. f r i b a +FRMN f r m n +FRMR f r m r +FRMS f r m s +F. R. P. f r p +FRP f r p +FRR f r r +F.R.S.A. f r s a +FRSA f r s a +FRSC f r s c +FRSE f r s e +frs f r s +F. R. S. f r s +F.R.S. f r s +FRS f r s +FRSL f r s l +Fru f r u +FRU f r u +FRV f r v +FRWT f r w t +Frwydr f r w y d r +FSA f s a +FSB f s b +FSC f s c +FSCS f s c s +FSE f s e +fsf f s f +FSF f s f +FSFH f s f h +FSFLA f s f l a +fs f s +F. s f's +Fs f's +F. S. f s +F.S. f s +FS f s +FSFS f s f s +FSG f s g +FSGS f s g s +FSH f s h +FSIC f s i c +FSI f s i +FSIL f s i l +FSK f s k +FSKN f s k n +FSLF f s l f +FSL f s l +FSLN f s l n +FSM f s m +FSM's f s m's +fsn f s n +FSN f s n +FSO f s o +FSP f s p +FSPS f s p s +FSR f s r +FSRU f s r u +FSSB f s s b +FSS f s s +FSSM f s s m +FSSRU f s s r u +FSSs f s s's +FST f s t +FSU f s u +FSU's f s u's +FSV f s v +FTA f t a +FTAs f t a's +F.T.B. f t b +FTC f t c +FTD f t d +FTDI f t d i +FTE f t e +FTF f t f +Ft. Fort +F. T. f t +F.T. f t +FTI f t i +FTII f t i i +FTJ f t j +FTK f t k +FTL f t l +FTM f t m +FTN f t n +FTO f t o +ftp f t p +FTP f t p +FTPI f t p i +FTPL f t p l +FTRA f t r a +FTR f t r +FtsA f t s a +FT's f t's +FTS f t s +FTT f t t +FTTH f t t h +FTUC f t u c +Ftuh f t u h +FTU's f t u's +FTV f t v +F. V. B. f v b +F. V. f v +F.V. f v +FVGM f v g m +FVHS f v h s +FVJC f v j c +FVL f v l +FVP f v p +FVW f v w +FVWM f v w m +FWAA f w a a +FWA f w a +FWCD f w c d +FWD f w d +FWE f w e +F&W f and w +F. W. f w +F.W. f w +FWH f w h +FWI f w i +FWMW f w m w +FWO f w o +fwr f w r +F.W.R. f w r +F. W. S. f w s +F.W.S. f w s +FWS f w s +FWX f w x +FXCM's f x c m's +FXE f x e +FXFL f x f l +fx f x +FX f x +FXI f x i +F.X.R. f x r +FX's f x's +FXS f x s +FXX f x x +FXX's f x x's +FXXT f x x t +Fyb f y b +FYCO f y c o +F.Y. f y +F.Y.I. f y i +FYI f y i +Fyn f y n +FYN f y n +FYP f y p +fyr f y r +F.Y.R. f y r +FYR f y r +FYT f y t +FYU f y u +Fyw f y w +FZCI f z c i +FZD f z d +F.Z. f z +FZG f z g +FZJD f z j d +FZKA f z k a +Gaac g a a c +GAAF g a a f +G.A.A. g a a +G. A. g a +G.A. g a +G.A.R. g a r +GASL g a s l +GATA g a t a +GATV g a t v +GATX g a t x +G. A. W. g a w +GBA g b a +GBAG g b a g +GBASE g b a s e +GBA's g b a's +GBB g b b +GBBI g b b i +GBCA g b c a +GBC g b c +GBCM g b c m +GBD g b d +Gbe g b e +GbE g b e +GBE g b e +G. B. g b +G.B. g b +GBGC g b g c +GBGM g b g m +GBH g b h +GBIB g b i b +GBIF g b i f +GBI g b i +GBK g b k +GBL g b l +GBMA g b m a +G. B. M. g b m +GB&NDR g b and n d r +GBP g b p +GBR g b r +GB's g b's +GBS g b s +GBV g b v +GBX g b x +GBYLA g b y l a +GCAC g c a c +GCAF g c a f +GCA g c a +G. C. B. g c b +GCB g c b +GCC g c c +GCCN g c c n +GCC's g c c's +GCCS g c c s +GCD g c d +G.C.E. g c e +GCEP g c e p +GCF g c f +G&C g and c +G. C. g c +G.C. g c +GCHQ g c h q +GCI g c i +GCIP g c i p +GCIT's g c i t's +GCIV g c i v +GCJ g c j +GCL g c l +GCMC g c m c +G.C.M. g c m +GCM g c m +GCMG g c m g +GCN g c n +GCNT g c n t +GCOEC g c o e c +GCOS g c o s +GCPD g c p d +GCPH g c p h +GCR g c r +GCRIO g c r i o +GCSE g c s e +GCSEs g c s e's +GC&SF g c and s f +GCS g c s +GCSI g c s i +GCU g c u +GCV g c v +GCVO g c v o +GCVS g c v s +GDA g d a +Gdal g d a l +GDAL g d a l +GDAP g d a p +GDB g d b +GDC g d c +GDD g d d +GDDM g d d m +GDDR g d d r +Gde g d e +G. D. F. g d f +GDF g d f +gd g d +G. D. g d +G.D. g d +GD g d +GDI g d i +G.D.L. g d l +GDN g d n +G.D.O.D. g d o d +Gdow g d o w +G.D.P. g d p +GDP g d p +GDPs g d p's +gdr g d r +GDR g d r +GDR's g d r's +GDS g d s +GDST g d s t +GDT g d t +GDV g d v +Gebr g e b r +Gebt g e b t +GEC g e c +Ged g e d +GED g e d +GEF g e f +GEGB g e g b +ge g e +G. E. g e +G.E. g e +GE g e +GEHA g e h a +GEHX g e h x +Gek g e k +G.E.M. g e m +Gen. general +G.E.O. g e o +G. E. P. g e p +geq g e q +Geu g e u +GEU g e u +Gev g e v +GeV g e v +GEV g e v +Gfa g f a +GFA g f a +GF&A g f and a +GFC g f c +GFD g f d +GFDL g f d l +GFE g f e +GFF g f f +G. F. g f +G.F. g f +GFM g f m +GFP g f p +G. F. R. g f r +GFR g f r +GFS g f s +GFSN g f s n +GFSR g f s r +GFT g f t +GFWC g f w c +GFW g f w +GFY g f y +G. G. g g +G.G. g g +G. G. J. g g j +GGL g g l +GGM g g m +GGMRC g g m r c +GGS g g s +G.H.A. g h a +GHB g h b +GHC g h c +GHD g h d +Ghe g h e +G. H. g h +G.H. g h +GHGs g h g's +Ghir g h i r +GHK g h k +GHMC g h m c +G.H.N. g h n +G.H.Q. g h q +GHQ g h q +ghra g h r a +GHR g h r +GH&SA g h and s a +GHSA g h s a +GHSFHA g h s f h a +GHS g h s +GHSR g h s r +GHSU g h s u +GHU g h u +G.H.W. g h w +GICL g i c l +Giei g i e i +GIFV g i f v +G. I. g i +G.I. g i +G.J.B. g j b +G. J. g j +G.J. g j +G. K. g k +G.K. g k +Gla g l a +GLA g l a +GLB g l b +GLBT g l b t +GLBTQ g l b t q +GLC g l c +G&L g and l +G. L. g l +G.L. g l +gli g l i +Gli g l i +GLI g l i +Glis g l i's +GLK g l k +GLL g l l +GLLI g l l i +GLM g l m +glnA g l n a +G.L.O.R.Y. g l o r y +Glos g l o's +GLRS g l r s +GLS g l s +GLT g l t +GLVC g l v c +GLX g l x +GMAC g m a c +gma g m a +GMA g m a +GMAM g m a m +GMA's g m a's +GMAT g m a t +GMB g m b +GmbH g m b h +GMBH g m b h +GMB's g m b's +GMCC g m c c +GMC g m c +GMCL g m c l +GMC's g m c's +GMDSS g m d s s +GME g m e +Gmel g m e l +GMES g m e s +GMFF g m f f +GMF g m f +GMG g m g +gm g m +G. M. g m +G.M. g m +GM g m +GMG's g m g's +gmin g m i n +GMM g m m +GMO g m o +GMOs g m o's +GMPC g m p c +GMPE g m p e +GMP g m p +GMPTE g m p t e +GMR g m r +GMRL g m r l +GM's g m's +GMs g m's +GMS g m s +gmt g m t +GMT g m t +GMTV g m t v +Gmul g m u l +GNAA g n a a +GNA g n a +gnb g n b +GNB g n b +GNCC g n c c +G. N. C. g n c +GNC g n c +G. N. g n +G.N. g n +GNL g n l +GNP&BR g n p and b r +GNPDA g n p d a +gnp g n p +GNP g n p +GNPs g n p's +GNRD g n r d +GNR g n r +GNR's g n r's +GNS g n s +GNSS g n s s +GNT g n t +G.O. g o +G.O.O.D. g o o d +GOPB g o p b +G.O.P. g o p +GOP g o p +GOPIO g o p i o +GOP's g o p's +GOQ g o q +GPA g p a +GPB g p b +G.P.C. g p c +GPC g p c +GPCR g p c r +GPCRs g p c r's +GPD g p d +GPdI g p d i +GPDSC g p d s c +GPF g p f +GPFS g p f s +G&P g and p +GPG g p g +gp g p +G. P. g p +G.P. g p +GP g p +GPGPU g p g p u +GPI g p i +GpIIb g p i i b +GPIO g p i o +GPL g p l +GPMGs g p m g's +G.P.O. g p o +GPO g p o +GPP g p p +GPRA g p r a +GPRF g p r f +GPR g p r +GPRs g p r's +GPRS g p r s +GPSC g p s c +GPS g p s +GPT g p t +GPU g p u +GPUs g p u's +GPX g p x +G. Q. g q +GQ g q +GQNYGK g q n y g k +GQ's g q's +GQT's g q t's +G.R.A.B. g r a b +grac g r a c +gra g r a +Gra g r a +GRA g r a +Grbac g r b a c +GRB g r b +GRBs g r b's +grc g r c +GRC g r c +GRCs g r c's +GRDA g r d a +GRDC g r d c +G.R.D. g r d +GRD g r d +gre g r e +Gre g r e +GRE g r e +GRF g r f +GRG g r g +gr g r +G. R. g r +G.R. g r +GR g r +GRK g r k +G.R.L. g r l +GRL g r l +GRMG g r m g +GRM g r m +GRO g r o +GRP g r p +grrl g r r l +G. R. S. g r s +GRS g r s +GRT g r t +GRU g r u +GRX g r x +Gryf g r y f +gry g r y +Gry g r y +GRY g r y +grz g r z +GSA g s a +GSAPP g s a p p +GSAS g s a s +GSB g s b +GSC g s c +GSDF g s d f +GSD g s d +G.S.E. g s e +GSE g s e +GSFC g s f c +GSF g s f +G&S g and s +GSG g s g +Gs g's +G. S. g s +G.S. g s +GS g s +GSHD g s h d +GSH g s h +GSI g s i +GSIs g s i's +GSIS g s i s +GSK g s k +GSL g s l +GSLV g s l v +GSMA g s m a +GSM g s m +GSNAS g s n a s +G. S. N. g s n +GSN g s n +GSNM g s n m +GSN's g s n's +GSO g s o +GSOM's g s o m's +GSOp g s o p +GSPC g s p c +G. S. P. g s p +GSP g s p +GSR g s r +GSSE g s s e +GSS g s s +GSSP g s s p +GSTA g s t a +G.S.T. g s t +GST g s t +GSU g s u +GSUSA g s u s a +GSVD g s v d +GSVS g s v s +GSX g s x +GTAA g t a a +GTA g t a +GTAs g t a's +GTB g t b +GTBK g t b k +GTBP g t b p +GTC g t c +GTCR g t c r +GTD g t d +GTEC g t e c +GTE g t e +GTF g t f +GTFT g t f t +GTFU g t f u +gt g t +G. T. g t +G.T. g t +GT g t +G. T. H. g t h +GTi g t i +GTI g t i +GTK g t k +GTL g t l +GTMO g t m o +G. T. O. g t o +GTO g t o +GTPBP g t p b p +GTP g t p +GTPR g t p r +GTRA g t r a +GTR g t r +GTRI g t r i +GTs g t's +GTS g t s +GTSV g t s v +GTT g t t +GTTP g t t p +GTU g t u +GTV g t v +GTW g t w +GTW's g t w's +GTX g t x +G. U. g u +G.U. g u +GUI's g u i's +GUIs g u i's +G.U.Y. g u y +GVA g v a +GVAV g v a v +GVBA g v b a +GVC g v c +G. V. g v +G.V. g v +GVHSS g v h s s +GVJZ g v j z +GVK g v k +GvpA g v p a +GVP g v p +GVRD g v r d +GVSU g v s u +GVT g v t +GVU g v u +GVVV g v v v +GVW g v w +GVWR g v w r +GWA g w a +GWB g w b +G. W. C. g w c +GWe g w e +Gwet g w e t +G.W.F. g w f +GWF g w f +gw g w +G. W. g w +G.W. g w +GW g w +G. W. H. g w h +GWHS g w h s +Gwi g w i +GWK g w k +G.W.L. g w l +GWO g w o +GWOT g w o t +gwr g w r +GWR g w r +GWR's g w r's +GW's g w's +G. W. S. g w s +GWS g w s +GWU g w u +GXG g x g +GX g x +GXP g x p +GYAN's g y a n's +GYC g y c +GYF g y f +Gy g y +G. Y. g y +GY g y +Gyn g y n +GYN g y n +Gyps g y p's +gyu g y u +Gyu g y u +GZA g z a +GZ g z +GZR g z r +HAFV h a f v +H. A. h a +H.A. h a +H&A h and a +HBA h b a +HBA's h b a's +HBBO h b b o +HBC h b c +HBCo h b c o +HBC's h b c's +HBCU h b c u +HBES h b e s +HBF h b f +HBGAs h b g a's +H. B. h b +H.B. h b +HB h b +HBI h b i +HBK h b k +HBLX h b l x +HBMP h b m p +HBO h b o +HBO's h b o's +HBPU h b p u +H&BR h and b r +HBR h b r +HBRN h b r n +HBRY h b r y +HB's h b's +HBS h b s +HBSS h b s s +HBU's h b u's +HBV h b v +HBW h b w +HCA h c a +HCAW h c a w +HCBE h c b e +HCB h c b +HCBS h c b s +HCCA h c c a +HCCB h c c b +HCCC h c c c +HCC h c c +HCDCH h c d c h +HCE h c e +HCEs h c e's +HCF h c f +H. C. G. h c g +HCGVN h c g v n +H. C. h c +H.C. h c +HC h c +HCH h c h +HCHS h c h s +HCI h c i +HCJB h c j b +hcl h c l +HCL h c l +HClO h c l o +HCMC's h c m c's +HCME h c m e +HCM h c m +HCN h c n +HCO h c o +HCoV h c o v +HCPA h c p a +H. C. P. h c p +HCP h c p +HCPs h c p's +HCR h c r +HCS h c s +HCT h c t +HCTV's h c t v's +HCUP h c u p +HCV h c v +Hcy h c y +HDAC h d a c +Hdad h d a d +hDAF h d a f +HDA h d a +HDB h d b +HDCAM h d c a m +HDC h d c +HDCP h d c p +HDD h d d +HDDs h d d's +HDFC h d f c +H.D.F. h d f +HDFM h d f m +H.D.G. h d g +HDG h d g +hd h d +H. D. h d +H.D. h d +HD h d +hdh h d h +HDi h d i +HDI h d i +HDLC h d l c +HDL h d l +HDLS h d l s +HDM h d m +HDMI h d m i +HDPE h d p e +HDP h d p +HDR h d r +HDRO h d r o +HDRR h d r r +H. E. h e +H.E. h e +hezb h e z b +Hezb h e z b +HFA h f a +HFB h f b +HFC h f c +HFCS h f c s +HFDF h f d f +HFF h f f +HFF's h f f's +H&F h and f +H. F. h f +H.F. h f +HFI h f i +H. F. J. h f j +HFNB h f n b +HFPA h f p a +HFP h f p +HFPPV h f p p v +HFRS h f r s +HFS h f s +HFTP h f t p +H.G.B. h g b +hgcA h g c a +HGC h g c +HGF h g f +hg h g +H. G. h g +H.G. h g +HG h g +HGH h g h +HGNC h g n c +HgO h g o +H. G. O. h g o +HGPIN h g p i n +HGPs h g p's +HGTV h g t v +HGTV's h g t v's +HgU h g u +HGVs h g v's +HGY h g y +HHA h h a +H. H. B. h h b +HHC h h c +HHD h h d +HHDP h h d p +HHG h h g +H&H h and h +HHHDB h h h d b +H. H. h h +H.H. h h +HHPC h h p c +HHSAA h h s a a +HHS h h s +H.H.T. h h t +H. I. h i +H.I. h i +H.I.V.E. h i v e +HIV h i v +HIY h i y +Hizb h i z b +hja h j a +HJC h j c +H. J. h j +H.J. h j +HJ h j +HJK h j k +H.J.M. h j m +HJN h j n +H. J. R. h j r +H.J.R. h j r +H. J. W. h j w +HJW h j w +HKAA h k a a +Hkam h k a m +HKB h k b +HKCEC h k c e c +HKCEE h k c e e +HKDF h k d f +HKD h k d +HKDSE h k d s e +HKFC h k f c +H&K h and k +H. K. h k +H.K. h k +HK h k +H. K. J. h k j +HKK h k k +HKMA h k m a +HKN h k n +H.K.P. h k p +HKP h k p +HKSAR h k s a r +HK's h k's +HKT h k t +HKTWU h k t w u +HKU h k u +Hla h l a +HLA h l a +HLBN h l b n +HLE h l e +HLH h l h +H. L. h l +H.L. h l +HLL h l l +HLLS h l l s +HLN h l n +HLN's h l n's +HLS h l s +HLT h l t +HLTV h l t v +Hluk h l u k +hlutr h l u t r +HLV h l v +Hly h l y +HMAC h m a c +HMA h m a +Hman h m a n +H.M.A.S. h m a s +HMAS h m a s +HMB h m b +HMC h m c +HMCS h m c s +HMDA h m d a +HMD h m d +HMDI h m d i +HMDP h m d p +HME h m e +HMEL h m e l +HMF h m f +HMGA h m g a +HMG h m g +HMGIC h m g i c +HMGN h m g n +H&M h and m +HMH h m h +hm h m +H. M. h m +H.M. h m +HM h m +HMI h m i +HMIS h m i s +HMMC h m m c +HMM h m m +HMMWV h m m w v +HMN h m n +HMNZS h m n z s +HMNZT h m n z t +HMO h m o +HMOs h m o's +HMPC h m p c +HMP h m p +HMRC h m r c +hMRE h m r e +H&M's h and m's +H. M. S. h m s +H.M.S. h m s +HMS h m s +HMSN h m s n +H.M.S.O. h m s o +HMSO h m s o +H. N. h n +H.N. h n +HNI h n i +HNK h n k +HNL h n l +HNLMS h n l m s +HNMT h n m t +HNN h n n +HNO h n o +HNS h n s +H. O. h o +H.O. h o +HPA h p a +H.P.B. h p b +hpc h p c +HPC h p c +HPCT h p c t +H. P. D. h p d +HPD h p d +HPE h p e +HPH h p h +hp h p +H. P. h p +H.P. h p +HP h p +HPI h p i +HPLC h p l c +HPL h p l +HPP h p p +HPRA h p r a +HPR h p r +HPRT h p r t +HP's h p's +HPS h p s +H. P. T. h p t +HPV h p v +HQAA h q a a +HQDA h q d a +H.Q. h q +HQ h q +HRG h r g +H&R h and r +H.R.H. h r h +HRH h r h +H. R. h r +H.R. h r +HR h r +HRK h r k +HRL h r l +HRM h r m +hroa h r o a +HRo h r o +HRO h r o +HRP h r p +HRSA h r s a +HRSA's h r s a's +HRSG h r s g +hrs h r s +HRs h r's +HRST h r s t +HRT h r t +HRV h r v +HRW h r w +HRX h r x +HSA h s a +HSAN h s a n +HSBC h s b c +HSB h s b +HSCA h s c a +HSC h s c +hscy h s c y +HSD h s d +HSDPA h s d p a +Hsee h s e e +HSE h s e +HSE's h s e's +HSF h s f +HSG h s g +HSHB h s h b +H.S.H. h s h +hs h s +Hs h's +H. S. h s +H.S. h s +HS h s +HSHS h s h s +hsi h s i +HSJ h s j +HSK h s k +HSL h s l +hSlo h s l o +H.S.M. h s m +HSM h s m +HSMR h s m r +HSN h s n +HSNY's h s n y's +HSPA h s p a +HSPA's h s p a's +HSPG h s p g +HSPH h s p h +HSP h s p +HSP's h s p's +HSPs h s p's +HSRC h s r c +HSR h s r +HSSCCT h s s c c t +HSSF h s s f +HSS h s s +HST h s t +HST's h s t's +HSTs h s t's +HSTS h s t s +hsv h s v +HSV h s v +HSX h s x +HSY h s y +HSYK's h s y k's +HSZ h s z +HTA h t a +hTAS h t a s +HTAs h t a's +htc h t c +HTC h t c +HTC's h t c's +HTGL h t g l +HTHC h t h c +ht h t +H. T. h t +H.T. h t +HT h t +HTIB h t i b +hti h t i +Htin h t i n +HTK h t k +HTLA h t l a +HTLV h t l v +HTML h t m l +HTM's h t m's +Htoo h t o o +HTPB h t p b +HTPC h t p c +HTP h t p +HtrA h t r a +HTR h t r +HTRs h t r's +HTS h t s +http h t t p +HTTP h t t p +https h t t p s +HTTPS h t t p s +HTV h t v +HTV's h t v's +Htwa h t w a +HTW h t w +HTX h t x +H. U. h u +HVC h v c +HVCs h v c's +hvcv h v c v +HVDC h v d c +hvem h v e m +Hvem h v e m +HVF h v f +HVHS h v h s +H. V. h v +H.V. h v +H.W.A. h w a +H. W. F. h w f +H. W. h w +H.W. h w +H.W.L. h w l +HWL h w l +HWM h w m +HWRT h w r t +HWT h w t +HWV h w v +hwy h w y +Hwy h w y +hxt h x t +H. Y. h y +H.Y. h y +H. Z. h z +HZ&PC h z and p c +iaaf i a a f +IAAF i a a f +IAAF's i a a f's +IAA i a a +IAAPA i a a p a +IAAP i a a p +IaaS i a a s +IAAS i a a s +IABSE i a b s e +Iaca i a c a +IACC i a c c +IACD i a c d +IAC i a c +Iacob i a c o b +IACR i a c r +IAC's i a c's +IACTs i a c t's +Iacub i a c u b +IACUC i a c u c +IACW i a c w +IAD i a d +IAD's i a d's +IAEA i a e a +IAEG i a e g +I.A.E. i a e +IAE i a e +IAF i a f +IAF's i a f's +IAG i a g +IAG's i a g's +iagt i a g t +IAHP i a h p +IAHRC i a h r c +I. A. i a +I.A. i a +I.A.M. i a m +IAO i a o +Iapa i a p a +IAPHC i a p h c +IAP i a p +iar i a r +Iar i a r +IAR i a r +IAST i a s t +IATA i a t a +I.A.T. i a t +IAT i a t +IATR i a t r +IAUC i a u c +IAUCs i a u c's +IAU i a u +IAV i a v +IAWTV i a w t v +Iax i a x +IAX i a x +Ibac i b a c +Ibaes i b a e's +IBA's i b a's +IBB i b b +IBC i b c +IBCs i b c's +IBCT i b c t +IBDA'A i b d a a +Ibda i b d a +ibdal i b d a l +IBDB i b d b +IBDE i b d e +IBD i b d +IBE i b e +IBF i b f +IBGE i b g e +IBH i b h +I. B. i b +I.B. i b +IBJJF i b j j f +IBL i b l +IBLT i b l t +IBMA's i b m a's +IBMC i b m c +Ibm i b m +I.B.M. i b m +IBM i b m +IBM's i b m's +IBMXF i b m x f +Ibne i b n e +ibn i b n +IBO i b o +IBPA i b p a +IBP i b p +Ibra i b r a +IBRA i b r a +IBRC i b r c +IBR i b r +IBRO i b r o +Ibsa i b s a +IBSA i b s a +IBSF i b s f +Ibs i b's +IBS i b s +IBSL i b s l +IBTC i b t c +iBT i b t +IBTS i b t s +Ibu i b u +IBU i b u +IBV i b v +IBWFF i b w f f +iby i b y +ICBA i c b a +ICBC i c b c +ICB i c b +ICBL i c b l +ICBM i c b m +ICBMs i c b m's +ICBP i c b p +ICBS i c b s +ICBTT i c b t t +ICCC i c c c +ICCC's i c c c's +ICCEC i c c e c +ICCF i c c f +Icche i c c h e +I.C.C. i c c +ICC i c c +ICCID i c c i d +ICCI i c c i +ICCR i c c r +ICC's i c c's +ICCS i c c s +ICCW i c c w +ICDC i c d c +ICD i c d +ICDS i c d s +I.C.E. i c e +ICFF i c f f +icf i c f +ICF i c f +ICFR i c f r +ICG i c g +ICHC i c h c +I&C i and c +ic i c +Ic i c +I. C. i c +I.C. i c +IC i c +Ici i c i +ICI i c i +ICJ i c j +ICL i c l +ICL's i c l's +ICMA i c m a +ICME i c m e +I.C.M. i c m +ICM i c m +iCN i c n +ICN i c n +Ico i c o +ICO i c o +ICOP i c o p +ICPC i c p c +ICPD i c p d +ICP i c p +ICP's i c p's +ICQ i c q +ICRC i c r c +ICRF i c r f +ICR i c r +IcRn i c r n +ICRP i c r p +ICRS i c r s +ICRW i c r w +ICSA i c s a +ICSB i c s b +ICSC i c s c +ICSE i c s e +ICSG i c s g +ics i c s +ICs i c's +ICS i c s +ICSS i c s s +ICSSR i c s s r +ICTA i c t a +ICT i c t +ICTM i c t m +ICTP i c t p +ICTSF i c t s f +ICTs i c t's +ICTS i c t s +ICTU i c t u +ICTUR i c t u r +ICTVdB i c t v d b +ICTV's i c t v's +ICTY i c t y +ICU i c u +ICUN i c u n +ICU's i c u's +ICv i c v +ICV i c v +ICVS i c v s +ICWA i c w a +ICWC i c w c +ICW i c w +ICW's i c w's +iCyt i c y t +ICZ i c z +ICZN i c z n +IDAF i d a f +IDBF i d b f +IDB i d b +IDBI i d b i +IDC i d c +Iddaa i d d a a +Idd i d d +ID'd i d d +IDEF i d e f +IDE i d e +IDFA i d f a +IDFG i d f g +IDF i d f +IDFL i d f l +IDF's i d f's +IDG i d g +I. D. H. i d h +IDH i d h +id i d +I. D. i d +I.D. i d +ID i d +Idi i d i +Idir i d i r +IDIS i d i s +IDLHs i d l h's +IDL i d l +Idm i d m +IDM i d m +IDMR i d m r +IDMS i d m s +IDNA i d n a +IDN i d n +IDNR i d n r +IDNR's i d n r's +IDPs i d p's +IDRC i d r c +IDRO i d r o +IDSA i d s a +IDSA's i d s a's +IDSF i d s f +ids i d s +ID's i d's +IDs i d's +IDV i d v +IDW i d w +IDWO i d w o +IDW's i d w's +IDx i d x +IDX i d x +IEA i e a +I.E.M. i e m +IEM i e m +I.E.S. i e s +IES i e s +i.e. that is +Ifa i f a +IFA i f a +IFBB i f b b +IFBC i f b c +I.F.B. i f b +IFCC i f c c +ifc i f c +IFC i f c +IFC's i f c's +IfF i f f +I. F. F. i f f +IFF i f f +IFFI i f f i +IFFK i f f k +Ifft i f f t +IFHA i f h a +IFHP i f h p +ifi i f i +Ifi i f i +IFI i f i +IFIP i f i p +IFIs i f i's +IFK i f k +IFLA i f l a +IFL i f l +IfM i f m +IFM i f m +IFN i f n +Ifni i f n i +IFNs i f n's +IFO i f o +Ifop i f o p +IFP i f p +IFPI i f p i +IFPRI i f p r i +IFRC i f r c +IFR i f r +IFRS i f r s +IFRSs i f r s's +IFSB i f s b +IFSC i f s c +IFSTA i f s t a +IFTA i f t a +IFTF i f t f +IFT i f t +Iga i g a +IgA i g a +IGA i g a +IGA's i g a's +IGBT i g b t +IGC i g c +IGCP i g c p +IGCSE i g c s e +IGD i g d +IGF i g f +IGFI i g f i +IGFs i g f's +IGIB i g i b +'ig i g +Ig i g +I.G. i g +IG i g +igi i g i +IGI i g i +IgM i g m +IGM i g m +IGMP i g m p +ign i g n +Ign i g n +IGN i g n +IHF i h f +IHGS i h g s +IHH i h h +Ih i h +I. H. i h +IH i h +ihi i h i +IHI i h i +IHL i h l +IHL's i h l's +IHMC i h m c +IHME i h m e +ihm i h m +ihn i h n +Ihn i h n +IHOM i h o m +Ihor i h o r +IHPK i h p k +IHRC i h r c +IHSAA i h s a a +IHSA i h s a +IHS i h s +Iht i h t +IIA i i a +IIb i i b +IIB i i b +IIc i i c +IIDC i i d c +IID i i d +IIDI i i d i +IIDS i i d s +IIDX i i d x +IIED i i e d +IIFA i i f a +IIF i i f +IIfx i i f x +Iiga i i g a +IIga i i g a +IIG i i g +IIgs i i g's +IIGs i i g's +IIGS i i g s +IIGS's i i g s's +IIHF i i h f +IIHR i i h r +IIHS i i h s +IIIA i i i a +IIIb i i i b +IIIB i i i b +IIIBy i i i b y +IIIc i i i c +IIId i i i d +IIIF i i i f +I. I. i i +I.I. i i +ija i j a +Ija i j a +IJA i j a +IJF i j f +IJGL i j g l +IJHCD i j h c d +IJHL i j h l +ij i j +I. J. i j +IJ i j +IJN i j n +Ijok i j o k +IJSB i j s b +IJSE i j s e +IJSEM i j s e m +IJS i j s +Ijui i j u i +IJVM i j v m +IKBN i k b n +IKCO i k c o +IKF i k f +Ikh i k h +I.K. i k +IKK i k k +IKL i k l +IKr i k r +Iksa i k s a +IKTA i k t a +Iku i k u +Ilbe i l b e +ILB i l b +ILC i l c +ILCS i l c s +ILD i l d +ILDIS i l d i s +ILFC i l f c +ILF i l f +IL&FS i l and f s +ili i l i +Ili i l i +ILI i l i +I. L. i l +I.L. i l +Ilm i l m +ILM i l m +ILM's i l m's +ILN i l n +ILP i l p +ILR i l r +ILRS i l r s +ilu i l u +Ilu i l u +ILU i l u +IMbd i m b d +IMBD i m b d +IMB i m b +IMCB i m c b +IMCI i m c i +imc i m c +IMC i m c +imdb i m d b +IMDb. i m d b +IMDb i m d b +IMDB i m d b +IMD i m d +IMD's i m d's +ime i m e +IME i m e +IMF i m f +IMG i m g +I&M i and m +IMI i m i +I. M. i m +I.M. i m +IMIS i m i s +IMK i m k +Iml i m l +IMMEX i m m e x +Imm i m m +Imms' i m m's +imoa i m o a +IMO's i m o's +IMPA i m p a +IMPDH i m p d h +impr i m p r +Impr i m p r +IMPSA i m p s a +IMR i m r +IMSLP i m s l p +iMSNs i m s n's +Imst i m s t +IMTA i m t a +IMT i m t +IMTV i m t v +IMUK i m u k +IMU's i m u's +IMWF i m w f +INAC i n a c +Inba i n b a +INBA i n b a +INBF i n b f +inb i n b +incl i n c l +INDC i n d c +ind i n d +Ind i n d +IND i n d +INFJ i n f j +I.N.F.O. i n f o +Infs i n f's +ING i n g +INGR i n g r +inHg i n h g +INH i n h +INI i n i +I. N. i n +I.N. i n +InlB i n l b +INL i n l +INM i n m +INPD i n p d +INPE i n p e +InP i n p +INP i n p +INPP i n p p +Inre i n r e +I.N.R.I. i n r i +INR i n r +INSB i n s b +INSDC i n s d c +INSD i n s d +Inspx i n s p x +INSS i n s s +INTF i n t f +Ints i n t's +INTs i n t's +Intu i n t u +INVA i n v a +inv i n v +INXS i n x s +INXS's i n x s's +Ioba i o b a +IOCG i o c g +IOC i o c +IOCP i o c p +IODP i o d p +IODs i o d's +IOE i o e +IOFB i o f b +IOF i o f +io. i o +io i o +.I.o. i o +Io. i o +Io i o +.IO i o +I/O i o +IO i o +Ioka i o k a +Iok i o k +IOL i o l +IoM i o m +IOM i o m +IOPI i o p i +IOP i o p +IOPs i o p's +IORG i o r g +IOR i o r +IORM i o r m +IOSA i o s a +IOSB i o s b +iOS i o s +Io's i o's +I/Os i o's +I.O.'s i o's +IOS i o s +IOSR i o s r +Iosu i o s u +IoT i o t +IOT i o t +I.O.U. i o u +IOU i o u +IoW i o w +IOW i o w +IPA i p a +IPA's i p a's +IPB i p b +IPCC i p c c +IPCC's i p c c's +IPC i p c +IPCRI i p c r i +IPCs i p c's +IPDA i p d a +IPDI i p d i +IPD i p d +IPE i p e +IPFA i p f a +IPFI i p f i +IPF i p f +IPFP i p f p +IPFW i p f w +IPG i p g +IPH i p h +ip i p +Ip i p +I.P. i p +IP i p +IPL i p l +IPMG i p m g +IPM i p m +IPNI i p n i +IPN i p n +Ipo i p o +I.P.O. i p o +IPO i p o +IPP i p p +IPPL i p p l +IPPs i p p's +IPPT i p p t +Ippu i p p u +iPPV i p p v +IPR i p r +iPSC i p s c +IPSC i p s c +iPSCs i p s c's +ipse i p s e +IPSF i p s f +iPS i p s +IPs i p's +I.P.S. i p s +IPS i p s +IPTA i p t a +IPTC i p t c +IPTG i p t g +IPT i p t +IPTL i p t l +IPTV i p t v +IPU i p u +IPUM i p u m +IPv i p v +IPWA i p w a +IPW i p w +IPX i p x +iQ i q +I.Q. i q +IQ i q +IRAC i r a c +I.R.A. i r a +IRB i r b +IRBM i r b m +IRCA i r c a +IRC i r c +IRCM i r c m +IRCTC i r c t c +IRCT i r c t +IRD i r d +IRDS i r d s +IREC i r e c +I.R.E. i r e +IRE i r e +IRFCA i r f c a +IRFC i r f c +IRF i r f +IRFU i r f u +IRGC i r g c +Irgm i r g m +IRHG i r h g +IRHT i r h t +IRIB i r i b +Irig i r i g +IRI i r i +Iril i r i l +IRIN i r i n +i'r i r +ir i r +Ir i r +I. R. i r +I.R. i r +IR i r +IRIX i r i x +Irla i r l a +IRL i r l +IRM i r m +Irmis i r m i's +IRM's i r m's +IRNE i r n e +IRN i r n +iro i r o +Iro i r o +IRO i r o +IRP i r p +IRP's i r p's +IRPS i r p s +IRQ i r q +Irra i r r a +IRRI i r r i +IRR i r r +IRs i r's +I.R.S. i r s +IRS i r s +IRSN i r s n +I.R.T. i r t +IRT i r t +iru i r u +Iru i r u +ISA i s a +ISAv i s a v +Isba i s b a +ISBA i s b a +ISBER i s b e r +ISBHF i s b h f +ISB i s b +isbn i s b n +ISBN i s b n +ISBNs i s b n's +ISBO i s b o +ISCB i s c b +ISCE i s c e +isCf i s c f +ISCI i s c i +iSC i s c +Isc i s c +ISC i s c +ISCM i s c m +ISCM's i s c m's +ISCP i s c p +ISDA i s d a +Isd i s d +ISD i s d +isdn i s d n +ISDN i s d n +ISDS i s d s +ISDT i s d t +ISFI i s f i +ISF i s f +Isgec i s g e c +ISG i s g +ISHC i s h c +ishq i s h q +Ishq i s h q +ISHS i s h s +I. S. i s +I.S. i s +ISKB i s k b +ISK i s k +Isl i s l +ISL i s l +ISMF i s m f +ISMIR i s m i r +ISMNs i s m n's +ISN i s n +ISNTUC i s n t u c +ISOGG i s o g g +ISO i s o +ISO's i s o's +I.S.P.C.K. i s p c k +ISPF i s p f +ISPI i s p i +ISP i s p +ISPL i s p l +ISPR i s p r +ISPs i s p's +Isra'il i s r a i l +Isra i s r a +ISRA i s r a +ISR i s r +ISRN i s r n +ISRO i s r o +ISRP i s r p +ISSCC i s s c c +ISSF i s s f +iss i s s +Iss i s's +ISS i s s +ISSN i s s n +ISSNs i s s n's +ISSSSP i s s s s p +ISSUU i s s u u +ISTAF i s t a f +ISTD i s t d +Isu i s u +ISU i s u +ISU's i s u's +ISWC i s w c +ISWI i s w i +ISW i s w +I.T.A. i t a +ITA i t a +ITB i t b +ITC i t c +Ite i t e +ITE i t e +ITF i t f +ITG i t g +ITHF i t h f +I.T.H.M. i t h m +ITHs i t h's +iti i t i +Iti i t i +ITI i t i +I.T. i t +itk i t k +Itk i t k +ITK i t k +ITM i t m +ITMO i t m o +ITN i t n +ITNNs i t n n's +ITN's i t n's +Itoi i t o i +ITPF i t p f +iTP i t p +ITP i t p +ITRD i t r d +Itse i t s e +ITSF i t s f +ITTF i t t f +itt i t t +ITT i t t +ITUC i t u c +Itu i t u +ITU i t u +ITV i t v +ITV's i t v's +ITWF i t w f +ITW i t w +Itz i t z +IUB i u b +I.U.C.N.B. i u c n b +Iucn i u c n +IUCN i u c n +IUCN's i u c n's +IUD i u d +IUDs i u d's +IU i u +IUT i u t +IUU i u u +Iuz i u z +IVAA i v a a +IVAW i v a w +IVB i v b +I. V. i v +I.V. i v +IVL i v l +IVLP i v l p +IVM's i v m's +IVP i v p +IVPP i v p p +IVPTC i v p t c +IVRCL i v r c l +IVs i v's +Ivu i v u +IVWA i v w a +IWA i w a +Iwas i w a's +Iwaz i w a z +IWBs i w b's +IWC i w c +IWD i w d +IWF i w f +IWFL i w f l +IWF's i w f's +IWFS i w f s +IWG i w g +IWGP i w g p +iwi i w i +iw i w +I. W. i w +IW i w +IWL i w l +IWMF i w m f +IWM i w m +IWPR i w p r +iwrg i w r g +IWRG i w r g +IWR i w r +IWRS i w r s +IWSA i w s a +iwspy i w s p y +Iwuh i w u h +IWU's i w u's +I.W.W. i w w +IWW i w w +IXA i x a +IXb i x b +IXBs i x b's +IXC i x c +IXCs i x c's +IXe i x e +IX i x +iXL i x l +IXO i x o +ixtle i x t l e +IXV i x v +Iya i y a +IYA i y a +Iyar i y a r +IYC i y c +iyem i y e m +IYHF i y h f +Iyi i y i +iy i y +I. Y. i y +I.Y. i y +IY i y +J.A.A. j a a +J. A. B. j a b +Jaf j a f +J.A.G. j a g +JAG j a g +JAIR j a i r +J. A. j a +J.A.K.E. j a k e +J. A. N. j a n +J.A.P. j a p +J.A.S. j a s +JBA j b a +JBBA j b b a +JBB j b b +JBC j b c +JBG j b g +J&B j and b +jb j b +J. B. j b +J.B. j b +JB j b +J.B.L.D. j b l d +JBL j b l +J.B.M. j b m +JBM j b m +JB's j b's +J. B. S. j b s +J.B.S. j b s +JBT j b t +JBZ j b z +JCA j c a +JCB j c b +JCC j c c +JCF j c f +JCFS j c f s +J.C.G. j c g +JCG j c g +JCGM j c g m +JCIB j c i b +JCI j c i +jcis j c i s +jc j c +J. C. j c +J.C. j c +JC j c +JCJC j c j c +J. C. L. j c l +JCPA j c p a +J. C. P. j c p +JCP j c p +JCPV j c p v +JCRB j c r b +JCR j c r +JCRs j c r's +J.C.S. j c s +JCS j c s +JCSR j c s r +JCVI j c v i +J. C. W. j c w +JCW j c w +J. D. A. j d a +JDA j d a +JDBC j d b c +JDC j d c +JdeBP j d e b p +J.D.E. j d e +JDE j d e +JDENET j d e n e t +J.D.F. j d f +JDF j d f +jdi j d i +JDI j d i +jd j d +J. D. j d +J.D. j d +JD j d +jdk j d k +JDK j d k +J.D.M. j d m +JDM j d m +JDO j d o +JDRF j d r f +J&D's j and d's +J.D.s j d's +JDT j d t +JDU j d u +JDV j d v +J. E. A. j e a +J.E.A.L. j e a l +J.E.B. j e b +J. E. C. j e c +J. E. E. j e e +J. E. j e +J.E. j e +J.F.G. j f g +JFH j f h +jf j f +J. F. j f +J.F. j f +JF j f +JFK j f k +JFN j f n +JFQA j f q a +JFS j f s +J. G. A. j g a +J.G.B. j g b +JGI j g i +J. G. j g +J.G. j g +J. G. L. j g l +JGLS j g l s +J. G. M. j g m +J.G.M. j g m +JGO j g o +JGP j g p +JGR j g r +JGR's j g r's +JGSDF j g s d f +JGTC j g t c +JGU j g u +J.H.B. j h b +JHB j h b +J. H. C. j h c +JHC j h c +JHED j h e d +J.H.F. j h f +J.H.H. j h h +jh j h +J. H. j h +J.H. j h +JH j h +JHL j h l +J. H. M. j h m +J.H.R. j h r +JHs j h's +JHS j h s +JHSVs j h s v's +JHud j h u d +JHU j h u +J. I. j i +J.I. j i +J.J.A. j j a +JJB j j b +J. J. C. j j c +J.J.G. j j g +J&J j and j +J. J. j j +J.J. j j +JJ j j +JJK j j k +J. J. L. j j l +J.J.M. j j m +J.J.N. j j n +JJN j j n +Jka j k a +JKA j k a +JKC j k c +jkd j k d +JKH j k h +J&K j and k +J.K. J. j k j +J. K. j k +J.K. j k +JK j k +JKNPP j k n p p +J. K. S. j k s +JKT j k t +jkx j k x +JKX j k x +JLA j l a +J.L.B. j l b +JLB j l b +JLC j l c +J. L. E. j l e +J.L.E. j l e +JLG j l g +JLI j l i +J. L. j l +J.L. j l +J.L.L. j l l +JLM j l m +JLO's j l o's +JLPGA j l p g a +JLP j l p +JLS j l s +JLT j l t +JMA j m a +JMBG j m b g +J.M.C. j m c +JMC j m c +J. M. D. j m d +JMD j m d +J. M. E. j m e +JMI j m i +J. M. J. j m j +J.M.J. j m j +J. M. j m +J.M. j m +JMKR j m k r +J. M. L. j m l +JML j m l +JMM j m m +JMP j m p +JMS j m s +JMU j m u +JMV j m v +J. M. W. j m w +J.M.W. j m w +JMX j m x +JNA j n a +jnb j n b +JNF j n f +JNG j n g +JNI j n i +J. N. j n +J.N. j n +JN j n +JNK j n k +J. N. L. j n l +Jno j n o +JNPT j n p t +jnr j n r +JNR j n r +JNS's j n s's +JOJ j o j +J. O. j o +J.O. j o +J.P.D.B. j p d b +J. P. F. j p f +JPF j p f +jpg j p g +JPG j p g +JPH j p h +J&P j and p +jp j p +J.P. j p +JP j p +J.P.R. j p r +J.Q. j q +JQ j q +J.R.A. j r a +JRA j r a +J.R.C. j r c +JRC j r c +J.R.E. j r e +JRG j r g +JRHU j r h u +J. R. I. j r i +J&R j and r +J. R. j r +J.R. j r +JR j r +JRJ's j r j's +Jr. junior +jr. junior +Jr junior +jr junior +JRPG j r p g +J. R. P. j r p +J. R. R. j r r +J.R.R. j r r +J.R.'s j r's +JRSP j r s p +J. R. T. j r t +JRU j r u +JRX j r x +JSA j s a +JSAP j s a p +JSA's j s a's +jsb j s b +JSCA j s c a +JSC j s c +J.S.D. j s d +JSD j s d +JSE j s e +JSF j s f +JSH j s h +Js j's +J. S. j s +J.S. j s +JS j s +J.S.K. j s k +J.S.L. j s l +JSL j s l +J. S. M. j s m +JSM j s m +JSNN j s n n +JSOC j s o c +JSO j s o +JSP j s p +JSPS j s p s +JSR j s r +JSS j s s +JSW j s w +JSW's j s w's +JSX j s x +JTA j t a +J.T.B. j t b +JTB j t b +JTC j t c +JTF j t f +JTG j t g +JTI j t i +J&T j and t +J. T. j t +J.T. j t +JT j t +JT&KW j t and k w +JTL j t l +JTO j t o +JTR j t r +JTRO j t r o +JTS j t s +JTTF j t t f +JTT j t t +JTV j t v +J. U. j u +J.U.L.I.A. j u l i a +J.V.B. j v b +JVB j v b +JVC j v c +J.V.E. j v e +JVG j v g +JVH j v h +J&V j and v +J. V. j v +J.V. j v +JV j v +JVM j v m +JVNW j v n w +JVP j v p +JVRA j v r a +JVS j v s +Jwa j w a +J. W. A. j w a +J. W. B. j w b +JWB j w b +J.W.C. U.S. j w c u s +JWHA j w h a +J.W.J. j w j +J. W. j w +J.W. j w +JWM j w m +J. W. P. j w p +JWP j w p +JWRC j w r c +J. W. S. j w s +J.W.S. j w s +JWS j w s +JWST j w s t +JWT j w t +jx j x +JX j x +J.X.W.P. j x w p +JYJ j y j +JYJ's j y j's +J. Y. j y +J.Y. j y +JY j y +Jym j y m +Jymn j y m n +JYP j y p +J. Y. S. j y s +J. Z. j z +J.Z. j z +JZ j z +K.A.A. k a a +K. A. k a +K.A. k a +K.A.N. k a n +K. A. R. k a r +K.A.S. k a s +KBBI k b b i +KBB k b b +KBCI k b c i +KBC k b c +KBCO k b c o +KBD k b d +KBE k b e +KBFC k b f c +KBFL k b f l +KBFR k b f r +KBGD k b g d +KBG k b g +KBIG k b i g +kbi k b i +K&B k and b +K. B. k b +K.B. k b +KBKR k b k r +KBKS k b k s +KBKW k b k w +KBL k b l +KBMT k b m t +KBND k b n d +KBNZ k b n z +KBO k b o +KBRC k b r c +KBR k b r +KBS k b s +KBSN k b s n +KCB k c b +KCBS k c b s +KCCC k c c c +KCCI k c c i +KCC k c c +KCCO k c c o +KCDC k c d c +K. C. D. k c d +KCD k c d +KCED k c e d +KCET k c e t +KCG k c g +KCHS k c h s +K.C.I.E. k c i e +K. C. k c +K.C. k c +KCK k c k +KCKM k c k m +KCLU k c l u +K.C.M.G. k c m g +KCMG k c m g +KCNA k c n a +KCNH k c n h +KCNJ k c n j +KCN k c n +KCNN k c n n +KCNQ k c n q +KCNV k c n v +KCPD k c p d +KCPI k c p i +KCPM k c p m +KCPQ k c p q +KCPQ's k c p q's +KCQL k c q l +KCRA k c r a +KCRC k c r c +KCRH k c r h +KCR k c r +KCRW k c r w +KCSD k c s d +KCSG k c s g +K.C.S.I. k c s i +KCSI k c s i +K.C.'s k c's +KCS k c s +KCSP k c s p +KCTD k c t d +KCT k c t +KCTL k c t l +KCTV k c t v +KCUB k c u b +KCU k c u +KCVO k c v o +KCYX k c y x +kDa k d a +KDA k d a +kdal k d a l +KDAL k d a l +KDB k d b +KDCE k d c e +KDCO k d c o +KDDG k d d g +KDDI k d d i +KDD k d d +KDE k d e +KDFW k d f w +KDFX k d f x +K. D. G. k d g +KDGS k d g s +KDHS k d h s +KDKA k d k a +K&D k and d +kd k d +K. D. k d +K.D. k d +KD k d +KDP k d p +KDPM k d p m +KDR k d r +K. D.'s k d's +K.D.'s k d's +KDS k d s +ke k e +Ke k e +K. E. k e +K.E. k e +KE k e +KFAC k f a c +KFAED k f a e d +KFAI k f a i +KFA k f a +KFBK k f b k +KFBT k f b t +KFCC k f c c +KFCD k f c d +kfc k f c +K.F.C. k f c +KFC k f c +KFC's k f c's +KFD k f d +KFDM k f d m +KFEM k f e m +KFFL k f f l +KFH k f h +KFI k f i +KFJB k f j b +K.F. k f +KFLX k f l x +KFMB's k f m b's +KFMJ k f m j +K. F. M. k f m +K.F.M. k f m +KFOR k f o r +KFQC k f q c +KFQ k f q +KFRC k f r c +KFRC's k f r c's +KFRD k f r d +KFRG k f r g +KFRH k f r h +KFRO k f r o +KFSD k f s d +KFSN k f s n +KFST k f s t +KFT k f t +KFTL k f t l +KFUM's k f u m's +KFVD k f v d +KFV k f v +KFWB k f w b +KFXO k f x o +KFYO's k f y o's +KGA k g a +K.G.B. k g b +KGB k g b +KGC k g c +KGPH k g p h +KGP k g p +KGRI k g r i +kgr k g r +KGRK k g r k +KGS k g s +kgt k g t +KGT k g t +KGTV k g t v +KgU k g u +KGU k g u +KGUN k g u n +kgv k g v +K.G.V. k g v +KGWB k g w b +KGW k g w +KHHZ k h h z +KHI k h i +Khizr k h i z r +KHJ k h j +K. H. k h +K.H. k h +KH k h +KHK k h k +KHKV k h k v +Khlav k h l a v +KHL k h l +KHL's k h l's +Khmu k h m u +KHMY k h m y +KHOJ k h o j +KHOW k h o w +KHQA k h q a +KHQ k h q +Khri k h r i +Khru k h r u +KHRW k h r w +KHSAA k h s a a +KHS k h s +KHTL k h t l +KHTZ k h t z +KHUI k h u i +KHUT k h u t +KHWI k h w i +K.I.D. k i d +K. I. k i +K.I. k i +K.I.M. k i m +KIP k i p +K.I.S.S. k i s s +KJCE k j c e +KJCT k j c t +KJEF k j e f +Kjer k j e r +KJHK k j h k +KJI k j i +KJIN k j i n +kj k j +K. J. k j +K.J. k j +KJ k j +KJKP k j k p +KJMM k j m m +KJNE k j n e +KJNW k j n w +Kjop k j o p +KJo's k j o's +KJQY k j q y +KJV k j v +KJZI k j z i +KKBL k k b l +KKBQ k k b q +KKCR k k c r +KKDA k k d a +K.K.E. k k e +KKE k k e +K. K. k k +K.K. k k +KKMC k k m c +KKMI k k m i +KKM k k m +KKMX k k m x +KKRG k k r g +KKR k k r +KKSF k k s f +KK's k k's +KKSY k k s y +KKT k k t +KLA k l a +KLBK k l b k +KLBM k l b m +KLCI k l c i +KLC k l c +KLDS k l d s +Kle k l e +KLE k l e +KLF k l f +KLGH k l g h +KLH k l h +KLK k l k +kl k l +K. L. k l +K.L. k l +KL k l +KLKS k l k s +KLLP k l l p +KLLV k l l v +KLM k l m +KLN's k l n's +KLQQ k l q q +KLQT k l q t +KLRY k l r y +KLSC k l s c +KLSD k l s d +KLS k l s +KLSX k l s x +KLT k l t +KLX k l x +KMB k m b +KMC k m c +KMD k m d +KMGO k m g o +KMGT k m g t +KMIH k m i h +KMIR k m i r +KMITL k m i t l +KMJ k m j +K&M k and m +KMK k m k +km k m +K. M. k m +K.M. k m +KM k m +KMLA k m l a +KML k m l +KMME k m m e +KMML k m m l +KMRL k m r l +KMS k m s +KMSP k m s p +KMT k m t +KMTP k m t p +KMTV k m t v +KMVA k m v a +KMXW k m x w +KMZ k m z +KNFM k n f m +KNHP k n h p +K&N k and n +kn k n +K. N. k n +K.N. k n +KN k n +KNKT k n k t +KNLA k n l a +KNMI k n m i +KNNV k n n v +KNPN k n p n +KNPR k n p r +KNPU k n p u +KNRE k n r e +KNRS k n r s +KNS k n s +KNSM k n s m +KNST k n s t +KNTH k n t h +K.N.T. k n t +KNTN k n t n +KNTU k n t u +KNVA's k n v a's +KNVB k n v b +KNVN k n v n +KNX k n x +KNXT k n x t +K.O.D. k o d +k'o k o +K. O. k o +K.O. k o +KOTC k o t c +KOTD k o t d +K.O.T. k o t +KOWL k o w l +K. P. A. C. k p a c +KPAC k p a c +KPA k p a +KPAN k p a n +KPCC k p c c +KPC k p c +KPD k p d +KPE k p e +KPIF k p i f +KPI k p i +KPIs k p i's +K&P k and p +K. P. k p +K.P. k p +KP k p +KPLC k p l c +KPL k p l +KPLZ k p l z +KPMG k p m g +KPM k p m +KPNA k p n a +KPNB k p n b +KPO k p o +Kppen k p p e n +KPPV k p p v +KPS k p s +kptm k p t m +KPTV k p t v +KPU k p u +KPVD k p v d +KPVX k p v x +KPWR k p w r +KPXE k p x e +KQA k q a +KQED k q e d +KQHN k q h n +KQKK k q k k +KQKS k q k s +KQLT k q l t +KQLZ k q l z +KQMO k q m o +KQV k q v +KQXR k q x r +KRBM k r b m +krc k r c +KRCR k r c r +KRCs k r c's +KRF k r f +KRH k r h +K.R.I.T. k r i t +K.R.I.T.'s k r i t's +Krka k r k a +KRKC k r k c +KRK k r k +kr k r +K. R. k r +K.R. k r +KR k r +KRMT k r m t +Krne k r n e +KRNS k r n s +KRNV k r n v +KROQ k r o q +kroz k r o z +Kroz k r o z +KRPS k r p s +KRRT k r r t +K. R. S. k r s +KRS k r s +KRT k r t +Kru k r u +KRU k r u +KRWC k r w c +KRX k r x +K.R.Y. k r y +KRZA k r z a +ksa k s a +KSA k s a +K. S. B. k s b +KSBW k s b w +KSBY k s b y +KSCB k s c b +KSC k s c +KSCO k s c o +KSC's k s c's +KSCS k s c s +KSDB k s d b +KSDO k s d o +KSEB k s e b +KSEG k s e g +KSE k s e +KSEQ k s e q +kset k s e t +KSET k s e t +Kseur k s e u r +Ksevt k s e v t +KSFO k s f o +KSG k s g +KSHB k s h b +KSI's k s i's +KSJR k s j r +KSKJ k s k j +KSKK k s k k +K.S.K. k s k +KSK k s k +ks k s +K. S. k s +K.S. k s +KS k s +KSLC k s l c +KSL k s l +KSLM k s l m +KSLU k s l u +KSMB k s m b +KSNR k s n r +KSNV k s n v +KSP k s p +KSPS k s p s +KSTE k s t e +KSTH k s t h +KST k s t +KSTP k s t p +KSU k s u +K.S.V. k s v +KSWD k s w d +KSWT k s w t +KSWW k s w w +KSYL k s y l +KSZR k s z r +Ktav k t a v +KTAV k t a v +KTBS k t b s +KTCC k t c c +KTC k t c +KTCZ k t c z +KTDA k t d a +KTDD k t d d +KTE k t e +KTH k t h +KT&K k t and k +kt k t +K. T. k t +K.T. k t +KT k t +KTKZ k t k z +KTLA k t l a +K. T. M. k t m +KTM k t m +KTN k t n +KTOK k t o k +KTO k t o +KTRE k t r e +KTRH k t r h +KTRK k t r k +KTR k t r +KT's k t's +KTSM k t s m +KTT k t t +KTTN k t t n +KTTV k t t v +KTU k t u +KTUM k t u m +KTVA k t v a +KTVK k t v k +KTVS k t v s +KTVT k t v t +KTVU k t v u +KTVZ k t v z +KTWD's k t w d's +KTWO k t w o +KTX k t x +KTXL k t x l +Kuaa k u a a +Kud k u d +KUFM k u f m +KUGB k u g b +kuih k u i h +K. U. k u +K.U. k u +Kutb k u t b +KUTV k u t v +KUUU k u u u +KUWL k u w l +KUYI k u y i +KVAB k v a b +KVBC k v b c +KVB k v b +K.V.G.K. k v g k +KVHV k v h v +Kvik k v i k +KVI k v i +Kvit k v i t +KVIT k v i t +KVK k v k +K. V. k v +K.V. k v +KVLO k v l o +KVLY k v l y +KVM k v m +KVMRT k v m r t +KVMX k v m x +KVNG k v n g +KVN k v n +KVP k v p +KVTV k v t v +KVVS's k v v s's +KVVV k v v v +Kvyat k v y a t +KVZ k v z +kwa k w a +KWBM k w b m +KWC k w c +KWD k w d +KWEI k w e i +kwe k w e +KWG k w g +KWJJ k w j j +KWKH k w k h +KWKW k w k w +KWMR k w m r +KWMT k w m t +KWNA k w n a +KWNK k w n k +KWOA k w o a +KWP k w p +KWPT k w p t +KWQC k w q c +KWRE k w r e +KWRU k w r u +KWSB k w s b +KWSX k w s x +KWU k w u +KWWL's k w w l's +KXAN k x a n +KXAS k x a s +KXI k x i +KXJB k x j b +KXKS k x k s +KX k x +KXLX k x l x +KXLY k x l y +KXMC k x m c +KXNA k x n a +KXOL's k x o l's +KXTA k x t a +KXTN k x t n +KXTX k x t x +KYAY k y a y +KYBE k y b e +KYEZ k y e z +KYNM k y n m +Kyse k y s e +KYSL k y s l +KYTC k y t c +kyt k y t +Kyt k y t +KYW k y w +kz k z +K. Z. k z +KZ k z +KZLZ k z l z +KZMP k z m p +KZMU k z m u +KZQX k z q x +KZZQ k z z q +L. A. G. l a g +L. A. l a +L.A.'s l a's +Lay's l a y's +L.B.A. l b a +LBA l b a +LBCC l b c c +LBC l b c +LBC's l b c's +LBE l b e +LBF l b f +LBi l b i +LBJ l b j +LBJ's l b j's +L. B. l b +L.B. l b +LB l b +LBL l b l +LBM l b m +LBN l b n +LBNL l b n l +LBP l b p +LBPs l b p's +LBR l b r +LBS l b s +LBV l b v +LBW l b w +LCAC l c a c +LCA l c a +LCAs l c a's +LCAS l c a s +L.C.B. l c b +LCBL l c b l +LCBM l c b m +lcc l c c +LCC l c c +LCCN l c c n +LCCs l c c's +LCCS l c c s +LCDB l c d b +LCD l c d +LCDP l c d p +LC&DR l c and d r +LCDR l c d r +LCDs l c d's +L.C.E. l c e +LCFC l c f c +LCF l c f +LCH l c h +LCI l c i +LCIs l c i's +L. C. l c +L.C. l c +LC l c +LCL l c l +LCMC l c m c +LCM l c m +LCMR l c m r +LCMV l c m v +lcn l c n +LCO l c o +LCP l c p +LCQ l c q +LCR l c r +LCSB l c s b +LCSC l c s c +LC's l c's +LCS l c s +LCSs l c s's +LCST l c s t +LCT l c t +LCTs l c t's +LCU l c u +LCV l c v +LCVP l c v p +LCVPs l c v p's +LCZ l c z +Lda l d a +LDA l d a +LDAP l d a p +LDB l d b +LDBV l d b v +L.D.C. l d c +LDC l d c +LDCM l d c m +LDCs l d c's +LDD l d d +LDDP l d d p +LDF l d f +LDH l d h +L.D.I. l d i +LDK l d k +L. D. l d +L.D. l d +LDL l d l +LDLR l d l r +LDM l d m +LDMR l d m r +LDN l d n +LDP l d p +LDS l d s +LDU l d u +LDV l d v +LEB l e b +L. E. l e +L.E. l e +LFA l f a +L.F.C. l f c +LFC l f c +L.F.D. l f d +LFE l f e +LFFCs l f f c's +LFF l f f +LFG l f g +LFHC l f h c +LFH l f h +L. F. l f +L.F. l f +LFL l f l +LFM l f m +LFOC l f o c +LFO l f o +LFOM l f o m +LFPB l f p b +LFP l f p +LFQD l f q d +LFRJ l f r j +LFR l f r +LFs l f's +LFS l f s +LFSRs l f s r's +LFTR l f t r +LFXA l f x a +LGA l g a +LGB l g b +LGBTI l g b t i +LGBT l g b t +LGBTQ l g b t q +LGC l g c +LGD l g d +LGI l g i +L. G. l g +L.G. l g +LG l g +LGMB l g m b +LGMs l g m's +LGN l g n +LGPL l g p l +LGPZ l g p z +LG&RDD l g and r d d +LGR l g r +LGs l g's +LGS l g s +LGTB l g t b +LGT's l g t's +LGU l g u +LGUs l g u's +LGV l g v +LGVs l g v's +Lha l h a +LHB l h b +L. H. C. l h c +LHC l h c +LHD l h d +LHFP l h f p +LHICE l h i c e +LHI l h i +L. H. l h +L.H. l h +LHMC l h m c +L.H.M. l h m +LHO l h o +L. H. P. l h p +LHP l h p +LHS l h s +LHW l h w +LHX l h x +LHY l h y +L. I. l i +L.I. l i +LJBL l j b l +Lje l j e +LJJ l j j +L. J. K. l j k +L. J. l j +L.J. l j +L.J.V. l j v +LKB l k b +LKG l k g +LKK l k k +L. K. l k +LK l k +LKL l k l +LKML l k m l +LKPR l k p r +LKRN l k r n +lks l k s +LKS l k s +LKTI l k t i +Llapi l l a p i +LLAW l l a w +L.L.B. l l b +LLB l l b +LLCC l l c c +L.L.C. l l c +LLC l l c +LLD l l d +LL.D l l d +lle l l e +LLE l l e +LLHS l l h s +lli l l i +LLI l l i +L&L l and l +LLLE l l l e +L. L. l l +L.L. l l +LL l l +LLL l l l +LLLP l l l p +LLM l l m +LLMNR l l m n r +LLPFX l l p f x +llp l l p +LLP l l p +LLPX l l p x +LLRW l l r w +LLT l l t +LLTV l l t v +llu l l u +LLVM l l v m +LLWS l l w s +LMA l m a +LMC l m c +LMCT l m c t +LMDB l m d b +LMDC l m d c +LMD l m d +LME l m e +LMFAO's l m f a o's +LMFF l m f f +LMG l m g +LMGs l m g's +LMGTE l m g t e +LMH l m h +LMHS l m h s +lm l m +L. M. l m +L.M. l m +LM l m +LMM l m m +LMP l m p +LMPs l m p's +LMQ l m q +LMQs l m q's +L.M.S. l m s +LMS l m s +LMT l m t +LMTP l m t p +LMU l m u +LMWH l m w h +LMX l m x +LnAIB l n a i b +LNA l n a +LNAV l n a v +LNBF l n b f +LNB l n b +L.N.C. l n c +LNCS l n c s +L.N.E.R. l n e r +LNER l n e r +LNFS l n f s +LNG l n g +LNH l n h +L&N l and n +L. N. l n +L.N. l n +L.O.C.'s l o c's +Lokk l o k k +l'OL l o l +L.O.L. l o l +L. O. l o +L.O. l o +L.O.V.E. l o v e +L.O.V. l o v +LOXL l o x l +LPA l p a +L.P.A.M. l p a m +LPAM l p a m +LPARs l p a r's +LPAVS l p a v s +LPBG l p b g +L.P.B. l p b +LPB l p b +LPC l p c +LPCM l p c m +LPDA l p d a +LPDR l p d r +LPE l p e +LPF l p f +LPFM l p f m +LPGA l p g a +LPG l p g +L.P.H. l p h +LPH l p h +LPI l p i +LPLA l p l a +L&P l and p +LPL l p l +lp l p +L. P. l p +L.P. l p +LP l p +L&PM l and p m +LPMN l p m n +LPMud l p m u d +LPMUD l p m u d +LPN l p n +LPO l p o +LPRP l p r p +LPSC l p s c +LP's l p's +LPs l p's +LPS l p s +LPSN l p s n +LPTB l p t b +LPThe l p t h e +LPTV l p t v +LQ l q +LRAD l r a d +LRA l r a +LRCD l r c d +LRC l r c +L.R.C.P. l r c p +LRCP l r c p +LRDG l r d g +LRG l r g +lr l r +L. R. l r +L.R. l r +LR l r +LRO l r o +L.R.P.C. l r p c +LRP l r p +LRPPRC l r p p r c +LRRI l r r i +LRRP l r r p +LRS l r s +LRTA l r t a +LRT l r t +LRTR l r t r +LRTs l r t's +LRVs l r v's +LRY l r y +LSAC l s a c +LSA l s a +LSBC l s b c +LSB l s b +LSC l s c +LSCS l s c s +LSDHH l s d h h +L.S.D. l s d +LSD l s d +LSDP l s d p +LSDs l s d's +LSE l s e +LSF l s f +LSG l s g +LSH l s h +LSi l s i +LSI l s i +LSJ l s j +LSK l s k +L.S.L. l s l +ls l s +Ls l's +L. S. l s +L.S. l s +LSM l s m +LSO l s o +LSP l s p +LSPN l s p n +LSQC l s q c +LSRI l s r i +L. S. R. l s r +LSS l s s +LSSP l s s p +LSSR l s s r +LST l s t +LSTM l s t m +LSTs l s t's +LSUA l s u a +LSU l s u +LSU's l s u's +LSVCCs l s v c c's +LSV l s v +LSWR l s w r +LTAF l t a f +L. T. B. l t b +LTB l t b +LTCF l t c f +LTCI l t c i +L. T. C. l t c +L.T.C. l t c +LTC l t c +Ltda l t d a +LTDA l t d a +Ltd. limited +LTE l t e +LTFA l t f a +LTHS l t h s +LTI l t i +LTK l t k +L&T l and t +Lt. lieutenant +LTL l t l +lt l t +L. T. l t +L.T. l t +L.T.M. l t m +LTM l t m +LTMPS l t m p s +LTN l t n +ltoh l t o h +LTP l t p +LTRPC l t r p c +LTTE l t t e +LTTR l t t r +LTU l t u +LTV l t v +L. U. l u +lv l v +L. V. l v +L.V. l v +LV l v +LVMH l v m h +LWDB l w d b +LWD l w d +LWDS l w d s +LWE l w e +LWF l w f +LWH l w h +L. W. l w +L.W. l w +L.Y. l y +L&YR l and y r +M.A.D.E. m a d e +M.A.D. m a d +M.A.J. m a j +M.A.K. m a k +M. A. m a +M.A. m a +M&A m and a +M. A. O. m a o +M.A.O. m a o +M.A.R. m a r +M.A.S.K. m a s k +M.A.S. m a s +M.A.S.S. m a s s +M.B.A. m b a +M.B.B.S. m b b s +MBBS m b b s +MBC m b c +MBC's m b c's +MBDA m b d a +MBD m b d +M.B. D.P.M. m b d p m +M.B.E. m b e +MBE m b e +Mbewu m b e w u +MBF m b f +MBFW m b f w +MBGN m b g n +MBH m b h +mbi m b i +MBI m b i +M. B. J. m b j +MBJ m b j +MBK m b k +MBL m b l +M. B. m b +M.B. m b +MBM m b m +MBNA m b n a +mBo m b o +MBO m b o +MBPJ m b p j +MBP m b p +Mbre m b r e +mbr m b r +MBR m b r +MBSE m b s e +MBSI m b s i +MBS m b s +MBTI m b t i +MBT m b t +MBU's m b u's +MBX m b x +MCAF m c a f +MCAL m c a l +M.C.A. m c a +MCA m c a +MCA's m c a's +MCAS m c a s +MCB m c b +M. C. C. m c c +M.C.C. m c c +MCC m c c +MCC's m c c's +MCCs m c c's +MCCU m c c u +MCDA m c d a +MCDC m c d c +MCD m c d +MCDM m c d m +MCE m c e +MCFA m c f a +M. C. F. m c f +MCF m c f +MCFM m c f m +MCGJCW m c g j c w +MCG m c g +MCI m c i +MCJ m c j +MCLA m c l a +MCL m c l +M. C. m c +M.C. m c +MCMC m c m c +M. C. M. m c m +MCM m c m +MCN m c n +MCO m c o +MCOT's m c o t's +MCPC m c p c +MCPI m c p i +MCP m c p +MCPON m c p o n +MCPP m c p p +MCQ m c q +MCRD m c r d +MCR m c r +MCRP m c r p +MCSBA m c s b a +MCs m c's +M.C. S. m c s +MCS m c s +MCST m c s t +MCTFS m c t f s +MCT m c t +MCTU m c t u +MCTV m c t v +MCU m c u +MCV m c v +MCVTS m c v t s +MCW m c w +mcyG m c y g +MCYO m c y o +MCZ m c z +MDAA m d a a +MDAH m d a h +MDA m d a +mdb m d b +MDB m d b +MDC m d c +MDC's m d c's +MDCs m d c's +MDCT m d c t +mdDA m d d a +MD&DI m d and d i +Mde m d e +MDE m d e +MDF m d f +MDG m d g +MDGs m d g's +MDH m d h +MDHUs m d h u's +mDia m d i a +MDIB m d i b +MDic m d i c +MDI m d i +MDJT's m d j t's +MDK m d k +mdla m d l a +MDL m d l +MDMA m d m a +md m d +M. D. m d +M.D. m d +MD m d +MDM m d m +MDNA m d n a +M.D.N. m d n +MDPD's m d p d's +MDP m d p +MDPPP m d p p p +MDPS m d p s +MDPV m d p v +MDQ m d q +MDRC m d r c +mdr m d r +MDR m d r +MDT m d t +MDV m d v +MDX m d x +M. E. m e +M.E. m e +M.E.N. m e n +M. E. P. m e p +M.F.A. m f a +MFA m f a +MFB m f b +MFCC m f c c +MFC m f c +MFCS m f c s +MFD m f d +MFDs m f d's +MFe m f e +MFF m f f +MFG m f g +MFI m f i +MFJ m f j +MFK m f k +M. F. m f +M.F. m f +MFMF m f m f +MFM m f m +MFN m f n +MFNW m f n w +MFP m f p +MFR m f r +MFS m f s +MFS's m f s's +MFTBC m f t b c +MFT m f t +MFTs m f t's +Mgadla m g a d l a +Mgal m g a l +mga m g a +Mga m g a +MGA m g a +MGB m g b +Mgbo m g b o +MGCCC m g c c c +MGC m g c +MGE m g e +MGen m g e n +MGG m g g +MGH m g h +MGIMO m g i m o +MGIT m g i t +MGJH m g j h +MGK m g k +M.G.L. m g l +M&G m and g +M. G. m g +M.G. m g +M. G. M. m g m +MGM m g m +MGM's m g m's +MGMT m g m t +M&GN m and g n +MGN m g n +MGO m g o +MGP m g p +M&GR's m and g r's +Mha m h a +M.H.A. m h a +MHA m h a +MHB's m h b's +MHC m h c +MHCs m h c's +MHD m h d +MHI m h i +MHK m h k +MH&L m h and l +MHL m h l +M&H m and h +M. H. m h +M.H. m h +Mhor m h o r +Mhow m h o w +MHPL m h p l +M.H.P. m h p +MHP m h p +MHP's m h p's +MHRA m h r a +M. H. R. m h r +MHSA m h s a +MHSC m h s c +MHS m h s +MHT m h t +M.I.A. m i a +M.I.A.'s m i a's +M.I.C.M. m i c m +M.I.H. m i h +M&I m and i +M. I. m i +M.I. m i +M.I.N. m i n +M.I.R.V. m i r v +M.I.S. m i s +M.I.T. m i t +MJAHL's m j a h l's +M.J.A. m j a +MJA m j a +MJBHA m j b h a +MJB m j b +MJC m j c +M.J.F. m j f +MJF m j f +MJG m j g +MJHL m j h l +MJHL's m j h l's +M&J m and j +M. J. m j +M.J. m j +M. J. Y. m j y +MKBHD m k b h d +MKB m k b +MKDE m k d e +MKE m k e +MKFM m k f m +MKG m k g +MKK m k k +MKMF m k m f +M. K. m k +M.K. m k +MKNG m k n g +MKP m k p +MKRN m k r n +MKs m k's +MKS m k s +MKT m k t +MKTO m k t o +MKTV m k t v +MKZ's m k z's +M.L.A. m l a +MLA m l a +MLANA m l a n a +MLAs m l a's +MLB m l b +MLBPA m l b p a +MLCA m l c a +mlc m l c +M.L.C. m l c +MLC m l c +MLCs m l c's +MLD m l d +MLE m l e +MLF m l f +mlg m l g +MLG m l g +MLH m l h +MLIA m l i a +mli m l i +MLI m l i +MLIM m l i m +MLK m l k +MLK's m l k's +Mlle m l l e +MLL m l l +MLLT m l l t +M&L m and l +M. L. m l +M.L. m l +MLM m l m +MLND m l n d +M.L.N. m l n +MLN m l n +MLPH m l p h +MLP m l p +MLPs m l p's +M. L. R. m l r +MLR m l r +MLSE m l s e +M. L. S. m l s +M.L.S. m l s +MLS m l s +MLT m l t +MLW m l w +MLWS m l w s +MM&A m m and a +M. M. J. m m j +MMK m m k +MML m m l +M&M m and m +M. M. m m +M.M. m m +MMSA m m s a +M&M's m and m's +M. M. S. m m s +MMS m m s +MMST m m s t +MMTB's m m t b's +MMTS m m t s +MMTV m m t v +MMWR m m w r +MMX m m x +MNA m n a +MNBA m n b a +MNC m n c +MNCPPC m n c p p c +MNCs m n c's +MNDM m n d m +MNDNR m n d n r +MNDO m n d o +MNDR m n d r +M&NF m and n f +MNF m n f +MNG m n g +MNI m n i +MNLA m n l a +MNLA's m n l a's +MNLF m n l f +MNM m n m +M. N. m n +M.N. m n +MNNA m n n a +MNN m n n +MNP m n p +MNPP m n p p +MNRG m n r g +MNSD m n s d +MNS m n s +MNTC m n t c +MNT m n t +MNZM m n z m +MNZ m n z +MOBKL m o b k l +MOBK m o b k +M.O.B. m o b +M.O.D. m o d +M.O.D.O.K. m o d o k +M.O.G.U.E.R.A.'s m o g u e r a's +M. O. H. m o h +M. O. m o +M.O. m o +M.O.P. m o p +M.O.R. m o r +M.O.T. m o t +MPAA m p a a +MpA m p a +MPA m p a +MPAs m p a's +MPB m p b +MPBN m p b n +MPBu m p b u +MPCA m p c a +MPCI m p c i +MPC m p c +MPD m p d +MPE m p e +MPF m p f +MPG m p g +M.P.H. m p h +MPH m p h +MP&I m p and i +MPi m p i +MPI m p i +MPIO m p i o +MPKAB m p k a b +MPLAD m p l a d +MPLA m p l a +MPL m p l +MPLMs m p l m's +MPLR m p l r +MPLS m p l s +M&P m and p +MPM m p m +M. P. m p +M.P. m p +MPO m p o +MPPJ m p p j +M.P.P. m p p +MPP m p p +MPPSC m p p s c +MPPs m p p's +MPQC m p q c +MPR m p r +MPRO m p r o +MPRP m p r p +MPRS m p r s +MPSE m p s e +MPSF m p s f +M.P.'s m p's +MP's m p's +MPs m p's +MPS m p s +MPThe m p t h e +MPT m p t +Mpu m p u +MPU m p u +MPV m p v +MPW m p w +MPZ m p z +MQM m q m +M. Q. m q +Mra m r a +MRA m r a +M. R. B. m r b +MRB m r b +MRBs m r b's +MRCB m r c b +MRCK m r c k +MRCM m r c m +MRC m r c +M.R.C.S. m r c s +MRCS m r c s +MRDC m r d c +MRD m r d +mre m r e +MRF m r f +MR&LE m r and l e +MRL m r l +Mr. mister +MRM m r m +M. R. m r +M.R. m r +mRNA m r n a +mRNAs m r n a's +MRPGM m r p g m +MRP m r p +MRPS m r p s +MRR m r r +MRSA m r s a +M.R.S.C. m r s c +Mrs. misses +MRSM m r s m +MRT m r t +MRTs m r t's +MRTS m r t s +MRTT m r t t +MRU m r u +MSAA m s a a +MSAC m s a c +MSAD m s a d +MSA m s a +M.S.A.S. m s a s +MSAW m s a w +MSB m s b +MSBO m s b o +MSBSD m s b s d +MSCC m s c c +M.S.C. m s c +MSC m s c +msd m s d +MSD m s d +MSDN m s d n +MSDS m s d s +Mse m s e +MSFC m s f c +M.S.F. m s f +MSF m s f +MSFT m s f t +MSG m s g +MSI m s i +MSJ m s j +MSK m s k +MSL m s l +M&S m and s +Ms. miss +MSML m s m l +M.S.M. m s m +MSM m s m +M. S. m s +M.S. m s +MSNBC m s n b c +MSNBC's m s n b c's +MSN m s n +MSOB m s o b +MSOM m s o m +M.S.P. m s p +MSP m s p +MSPs m s p's +MSR m s r +MSRP m s r p +MSRTC m s r t c +MSSH m s s h +MSSK m s s k +MSSMLP m s s m l p +MSSM m s s m +MSS m s s +MSTA m s t a +mst m s t +MST m s t +MSTS m s t s +MSU's m s u's +MSVCC m s v c c +MSV m s v +MSVU m s v u +MSX m s x +MSY m s y +MSZP m s z p +MTAC m t a c +Mta m t a +M.T.A. m t a +MTA m t a +MTA's m t a's +MTAs m t a's +MTBE m t b e +MTBI m t b i +MTB m t b +MTC m t c +MTDB m t d b +M.T.D. m t d +MTD m t d +MTD's m t d's +MTG m t g +MTHFR m t h f r +MTHL m t h l +MTIC m t i c +MTI m t i +MTJ m t j +MTK m t k +MTKO m t k o +M&T m and t +MTM m t m +MTMR m t m r +M. T. m t +M.T. m t +Mtor m t o r +MTOSI m t o s i +M.T.O.W. m t o w +MTPA m t p a +MTPC m t p c +MTP m t p +MTQ m t q +MTRCB m t r c b +MTRC m t r c +MTRJ m t r j +MTR m t r +M. T. S. m t s +MTS m t s +MTSU m t s u +MTTM m t t m +MTT m t t +MTU m t u +MTV m t v +MTVR m t v r +MTV's m t v's +mtvU m t v u +MTVu m t v u +MTVU m t v u +MTY m t y +MTZ m t z +MUKW m u k w +M. U. m u +MUSL m u s l +M.U.s m u's +M. U.S. m u s +MVA m v a +M. V. C. m v c +M.V.C. m v c +MVC m v c +M. V. D. m v d +MVD m v d +MVH m v h +MVK m v k +M.V.M. m v m +MVM m v m +MVMs m v m's +M. V. m v +M.V. m v +M.V.O. m v o +MVO m v o +MVP m v p +MVPs m v p's +MVPS m v p s +M.V. P.T. m v p t +MVs m v's +MVS m v s +MVSN m v s n +MVSR m v s r +MVT m v t +MVV m v v +M.W.A.M. m w a m +MWA m w a +MWC m w c +MWe m w e +M. W. E. m w e +MWF m w f +MWHL m w h l +MWIFF m w i f f +MWI m w i +MWJCHL m w j c h l +MWJHL m w j h l +M. W. J. m w j +M. W. m w +M.W. m w +M. X. m x +myb m y b +myc m y c +Myc m y c +MYC m y c +MYCN m y c n +MyDD m y d d +M. Y. m y +M.Y. m y +MySQL m y s q l +MYSQL m y s q l +MZC m z c +MZH m z h +MZM m z m +M. Z. m z +MZP m z p +MZT m z t +NAACCR n a a c c r +NAACL n a a c l +NAAC n a a c +N.A.A.C.P. n a a c p +NAACP n a a c p +NAACP's n a a c p's +N.A.C.L. n a c l +NAFBL n a f b l +NAFC n a f c +NAFC's n a f c's +NAFH n a f h +NAFI n a f i +N. A. n a +N.A. n a +NBADL n b a d l +N.B.A. n b a +NBA n b a +N.B.A.'s n b a's +NBA's n b a's +NBAs n b a's +NBCC n b c c +NBC n b c +NBC's n b c's +NBCSN n b c s n +NBDL n b d l +NBD n b d +NBFA's n b f a's +NBF n b f +NBG n b g +NBI n b i +NBK n b k +NBL n b l +N. B. n b +N.B. n b +N.B.N. n b n +NBN n b n +NBP n b p +NBQ n b q +NBR n b r +NBR's n b r's +NBSK n b s k +nbs n b s +NBS n b s +NBSP n b s p +NBTE n b t e +NBT n b t +NBTwo n b t w o +NBTY n b t y +NBW n b w +NCAAs n c a a's +NCAM n c a m +NCA n c a +NCAP n c a p +NCBC n c b c +NCBI n c b i +NCCC n c c c +NCCF n c c f +NCCMH n c c m h +NCC n c c +NCCP n c c p +NCCs n c c's +NCCS n c c s +NCCU n c c u +NCDC n c d c +NCDD's n c d d's +NCD n c d +NCES n c e s +NCFA n c f a +N.C.F. n c f +NCF n c f +NCG n c g +NCGS n c g s +NCHC n c h c +NCH n c h +NCHU n c h u +NCID n c i d +NCI n c i +NCIS n c i s +NCIS's n c i s's +NCKU n c k u +NCLB n c l b +NCLC n c l c +NCL n c l +NCLR n c l r +NCLT n c l t +NCMA n c m a +NCMC n c m c +NCMM n c m m +NCM n c m +NCMP n c m p +NCNB n c n b +N. C. n c +N.C. n c +N.C.O. n c o +NCO n c o +NCO's n c o's +NCOs n c o's +NCPA n c p a +NCPC n c p c +NCP n c p +NCPO n c p o +NCRC n c r c +NCR n c r +NCSU n c s u +NCSY n c s y +NCTA n c t a +NCTC n c t c +NCTE n c t e +NCT n c t +NCUA n c u a +NCVO n c v o +NCVS n c v s +NCVT n c v t +NCWM n c w m +NCW n c w +NDA n d a +NDE n d e +NDEP n d e p +NDFB n d f b +NDFT n d f t +N.D.G. n d g +N. D. n d +N.D. n d +N.D.N.Y. n d n y +NDPH n d p h +NDPK n d p k +N.D.P. n d p +NDP n d p +NDP's n d p's +NDRC n d r c +NDRE n d r e +NDRF n d r f +N.E.A.R. n e a r +NECW n e c w +N. E. n e +N.E. n e +N.E.R.D. n e r d +NERFU n e r f u +ner n e r +N.E.R. n e r +NER n e r +N.E.W.S.T. n e w s t +NFA n f a +NFATc n f a t c +NFAT n f a t +NFB n f b +NFB's n f b's +NFC n f c +NFC's n f c's +NFD n f d +NFEA n f e a +nfed n f e d +NFFC n f f c +NFF n f f +NFH n f h +NFHS n f h s +NFIB n f i b +NFI n f i +NFISD n f i s d +N.F.L. n f l +NFL n f l +NFLPA n f l p a +NFL's n f l's +N. F. n f +N.F. n f +NFO n f o +NFPA n f p a +NFPF n f p f +NFP n f p +NFPW n f p w +NFRS n f r s +NFS n f s +NGC n g c +Nge n g e +NGF n g f +N.G.L. n g l +N. G. n g +N.G. n g +NGO n g o +NGO's n g o's +NGOs n g o's +NGRC n g r c +N.G.R. n g r +NGR n g r +NGRR n g r r +NGS n g s +NGSS n g s s +NGST n g s t +NGTC n g t c +Nha n h a +NHA n h a +NHCEs n h c e's +NHC n h c +NHCP n h c p +NHCs n h c's +NHD n h d +NHHD n h h d +NHHI n h h i +nhi n h i +NHI n h i +NHK n h k +NHK's n h k's +N.H.L. n h l +NHM&W n h m and w +N. H. n h +N.H. n h +NHP n h p +NHPs n h p's +NHPS n h p s +NHRA n h r a +NHRC n h r c +NHSCT n h s c t +NHS n h s +NHST n h s t +NHW n h w +N.I.B.B.L.E. n i b b l e +NIBC n i b c +NIBR n i b r +N. I. n i +N.I. n i +N'I n i +N.J.A.C. n j a c +N. J. A. n j a +NJA n j a +N. J. C. n j c +NJC n j c +NJIT n j i t +N. J. M. n j m +NJM n j m +N. J. n j +N.J. n j +NJN n j n +Njoo n j o o +NJPS n j p s +NJPW n j p w +N.J.S.A. n j s a +N.J.'s n j's +NKL n k l +N. K. n k +N.K. n k +N. K. N. n k n +NKP n k p +NKP's n k p's +NKR n k r +NKT n k t +NKU n k u +nkvd n k v d +NKVD n k v d +NKVM n k v m +nkv n k v +NKX n k x +NLAES n l a e s +NLAI n l a i +NLA n l a +NLB n l b +NLCF n l c f +NLC n l c +NLCS n l c s +NLDC n l d c +NLD n l d +NLD's n l d's +NLDS n l d s +N. L. n l +N.L. n l +NLP n l p +NLRB n l r b +NLRP n l r p +NLRs n l r's +NLW n l w +NLX n l x +NMAA n m a a +NMA n m a +NMBS n m b s +NMBU n m b u +NMCA n m c a +NMCB n m c b +NMC n m c +N. M. n m +N.M. n m +NMP n m p +NMR n m r +NMRW n m r w +NMT n m t +NMU n m u +NMV n m v +NMW n m w +NNCL n n c l +NNFL n n f l +NNF n n f +N. N. n n +N.N. n n +NNSA n n s a +NNSS n n s s +NNSU n n s u +NNSW n n s w +N.O.R. n o r +NPA n p a +NPBD n p b d +NPBL n p b l +NPB n p b +NPC n p c +NPCs n p c's +NPDC n p d c +NPD n p d +NPF n p f +NPF's n p f's +NPGL n p g l +NPG n p g +NPGS n p g s +NPH n p h +NPHS n p h s +NPIM n p i m +NPI n p i +NPJ n p j +NPK n p k +NPL n p l +NPMA n p m a +NPM n p m +NPMs n p m's +N. P. n p +N.P. n p +NP n p +NPO n p o +NPP n p p +NPP's n p p's +NPRL n p r l +NPRN n p r n +NPR n p r +NPRR n p r r +NPR's n p r's +NPRSO n p r s o +NPSC n p s c +NPSG n p s g +NPSL n p s l +NP's n p's +NPs n p's +NPS n p s +NPTI n p t i +NPT n p t +NPV n p v +NPWE n p w e +NPWS n p w s +NPY n p y +NQAI n q a i +NQEA n q e a +NQHS n q h s +N. Q. n q +nri n r i +Nri n r i +NRI n r i +NRIs n r i's +NRJ n r j +NRJs n r j's +NRK n r k +NRLA n r l a +NRL n r l +NRL's n r l's +NRMA n r m a +NRM n r m +NRN n r n +nr n r +N. R. n r +N.R. n r +N.R.A. n r a +NSA n s a +NSAP n s a p +NSA's n s a's +NSB n s b +NSC n s c +NSD n s d +NSE n s e +NSFE n s f e +NSF n s f +NSFW n s f w +NSG n s g +NSI n s i +NSL n s l +NSM n s m +NSN n s n +N. S. n s +N.S. n s +NSO n s o +NSOs n s o's +NSPCC n s p c c +NSPC n s p c +NSP n s p +NSRI n s r i +NSRL n s r l +NSR n s r +NSSCD n s s c d +NSSDC n s s d c +NSS n s s +NSTA n s t a +NST n s t +NSU n s u +NSV n s v +NSVT n s v t +NSWBLF n s w b l f +NSWC n s w c +NSWCV n s w c v +NSWEC n s w e c +NSWGR n s w g r +N.S.W. n s w +NSW n s w +Nta n t a +NTA n t a +NTA's n t a's +ntb n t b +NTB n t b +NTC n t c +NTD n t d +NTFL n t f l +NTF n t f +NTI n t i +NTKF n t k f +NTL n t l +N. T. n t +N.T. n t +NTR n t r +NTR's n t r's +NTSB n t s b +NTSB's n t s b's +NTSC n t s c +NTS n t s +NTTF n t t f +NTT n t t +NTTR n t t r +NTUC n t u c +NTU n t u +NTVB n t v b +NTV n t v +ntw n t w +N.U. n u +NVA n v a +NVAO n v a o +NVC n v c +NVDA n v d a +NvDA's n v d a's +NVFC n v f c +NVGOP n v g o p +NVHJ's n v h j's +NVH n v h +NVI n v i +NVL n v l +N. V. n v +N.V. n v +NWAFU n w a f u +nwa n w a +N.W.A. n w a +NWA n w a +NWA's n w a's +N.W.F.P. n w f p +NWFP n w f p +NWMP n w m p +N&W n and w +NWN n w n +N. W. n w +N.W. n w +NWPD n w p d +N.W.P. n w p +NWP n w p +NWS n w s +N.W.T. n w t +NWT n w t +nyc n y c +N.Y.C. n y c +NYC n y c +NYC's n y c's +N.Y. G.O.P. n y g o p +N.Y.L. n y l +N. Y. n y +N.Y. n y +N.Y.P.D. n y p d +NYPD n y p d +NYPD's n y p d's +NYPL n y p l +N.Y.P. n y p +NY's n y's +N.Y.S. n y s +N.Y.S.V. n y s v +N.Y.U. n y u +NYU n y u +NYU's n y u's +NYYC n y y c +NZAID n z a i d +NZAOD n z a o d +NZCA n z c a +NZDT n z d t +NZEF n z e f +NZETC n z e t c +NZFC n z f c +NZF n z f +N'Zif n z i f +NZiK n z i k +N'Zi n z i +NZIV n z i v +NZL n z l +NZLP n z l p +N.Z. n z +NZPA n z p a +NZSAS n z s a s +NZ's n z's +NZS n z s +NZTA n z t a +N.Z.W.P.W. n z w p w +O.A.C. o a c +O. A. o a +O.A. o a +O.A.R. o a r +O.A.S. o a s +O.B.E. o b e +obl o b l +Oblt o b l t +O.B. o b +O. C. o c +O.C. o c +Octl o c t l +O.C.T. o c t +O. D. o d +O.E. o e +O.F.M. o f m +O.F. o f +ofr o f r +O.F.R. o f r +OFR o f r +O.F.T.B. o f t b +OGL o g l +O&G o and g +O. G. o g +O.G. o g +O.G.S. o g s +OGS o g s +O.H.A. o h a +O. H. o h +O.H. o h +OHV o h v +O. I. o i +O.I. o i +O. J. o j +O.J. o j +OJ o j +OJSC o j s c +OKBM o k b m +OKB o k b +OKC o k c +OK'd o k d +OKd o k d +OKD o k d +oke o k e +Oke o k e +OKH o k h +O.K.I. o k i +OKK o k k +OKM o k m +O&K o and k +O. K. o k +O.K. o k +O.L.F.A.L. o l f a l +O. L. K. o l k +O. L. o l +O.L. o l +Olo o l o +Olov o l o v +OLPC o l p c +OLPH o l p h +ols o l s +OLs o l's +OLS o l s +OLSR o l s r +OLTL o l t l +OLVT o l v t +olvwm o l v w m +olwm o l w m +OMB o m b +OMC o m c +OMCS o m c s +OMD o m d +O&MFL o and m f l +OMF o m f +omg o m g +OMG o m g +OMGs o m g's +O. M. o m +O.M. o m +OmOm o m o m +Om's o m's +OMTP o m t p +OMVG o m v g +OMW o m w +OMX o m x +ONCHR o n c h r +ONC o n c +oncu o n c u +ONDH o n d h +ond o n d +onf o n f +ONF o n f +ONGC o n g c +ONIR o n i r +ONJSC o n j s c +ONM o n m +ONMR o n m r +O. N. o n +O.N. o n +O&O o and o +OOOA o o o a +O. O. o o +O.O. o o +OO o o +OOO's o o o's +Oop o o p +OOP o o p +OOPSLA o o p s l a +oor o o r +oose o o s e +Oo's o o's +OOTP o o t p +Ootw o o t w +OOUR o o u r +OPAC o p a c +OPAG o p a g +O.P.A. o p a +OPBF o p b f +OPB o p b +OPC o p c +OPCS o p c s +OPCW o p c w +OPD o p d +O.P.I. o p i +OPIRG o p i r g +OPJHL o p j h l +OPLC o p l c +OPL o p l +OPMB o p m b +OPM o p m +OPMs o p m's +OPN o p n +O. P. o p +O.P. o p +opr o p r +Opr o p r +OPR o p r +O.R.C. o r c +ORECA o r e c a +ORFs o r f's +ORMO o r m o +ORNL o r n l +OR&N o r and n +O. R. o r +osaa o s a a +OSAA o s a a +osa o s a +Osa o s a +O.S.A. o s a +OSA o s a +O.S.B. o s b +OSB o s b +OSBs o s b's +O.S.N. o s n +OSN o s n +O. S. o s +O.S. o s +OSP o s p +OSR o s r +OSTM o s t m +O.S.T. o s t +OSTP o s t p +OSTs o s t's +osv o s v +OSV o s v +OTB o t b +OTC o t c +OTJ o t j +OTL o t l +OTMH o t m h +OTO o t o +O.T. o t +OTP o t p +OTR o t r +OTs o t's +OTS o t s +Otu o t u +OTU o t u +otv o t v +O.U. o u +OU o u +OUP o u p +OUSA o u s a +OVA's o v a's +ovca o v c a +Ovca o v c a +OVC o v c +OVC's o v c's +Ovda o v d a +OVF o v f +OVM o v m +Ovo o v o +OVO o v o +ov o v +Ov o v +O. V. o v +O.V. o v +OV o v +OVP o v p +OVS o v s +OVT o v t +OVW o v w +O.W.A. o w a +OWBT o w b t +OWCs o w c's +OWGR o w g r +OWHA's o w h a's +OWIU o w i u +OWM o w m +O. W. o w +O.W. o w +P. A. C. p a c +P. A. J. p a j +P.A.J. p a j +P. A. M. p a m +P.A.M. p a m +pa p a +P. A. p a +P.A. p a +PA p a +PAQ p a q +P.A.R. p a r +P. A. S. p a s +PBAA p b a a +PBA p b a +PBA's p b a's +PBB p b b +PBCC p b c c +pBCE p b c e +pbc p b c +P.B.C. p b c +PBF p b f +PBG p b g +PBIL p b i l +PBI p b i +PBK p b k +PBL p b l +PBM p b m +PBMR p b m r +PBO p b o +pb p b +P. B. p b +P.B. p b +PB p b +PBP p b p +PBR p b r +PBS p b s +PBT p b t +PBX p b x +PBY p b y +P. C. A. p c a +PCA p c a +PCB p c b +PCB's p c b's +PCBs p c b's +PCBS p c b s +PCC p c c +PCCS p c c s +PCCW p c c w +PCCW's p c c w's +PCDDs p c d d's +PCDHB p c d h b +PCDH p c d h +PCD p c d +PCE p c e +PCeU p c e u +PCFCL p c f c l +PCFL p c f l +PCF p c f +PCFS p c f s +PCG p c g +PCGS p c g s +PCHA p c h a +PCHA's p c h a's +P.C.H. p c h +PCH p c h +PCHR p c h r +PCIe p c i e +pci p c i +PCI p c i +PCJHL p c j h l +P. C. J. p c j +PCJ p c j +PCK p c k +PCLM p c l m +pcl p c l +PCL p c l +PCMCIA p c m c i a +PCMNO p c m n o +PCM p c m +PCMS p c m s +PCNA p c n a +PCN p c n +PcoA p c o a +PCOE p c o e +PCO p c o +pc p c +P. C. p c +P.C. p c +PC p c +PCPFL p c p f l +PCP p c p +PCPV p c p v +PCRC p c r c +PCRE p c r e +PCRev p c r e v +PCRM p c r m +PCR p c r +PCSK p c s k +PCSOM p c s o m +pcs p c s +P.C.s p c's +PC's p c's +PCTL p c t l +PCT p c t +PCTV p c t v +PCU p c u +PCU's p c u's +PCW p c w +PCX p c x +pDAB p d a b +PDAB p d a b +PDA p d a +PDAs p d a's +PDBML p d b m l +PDB p d b +pdbp p d b p +PDBsum p d b s u m +PDCI p d c i +PDC p d c +PDCPD p d c p d +PDC's p d c's +PDCs p d c's +PD&D p d and d +PDD p d d +PDE p d e +PDEs p d e's +PDES p d e s +pdf p d f +PDF p d f +PDFs p d f's +PDFT p d f t +PDGF p d g f +PDG p d g +PDHJ p d h j +PDH p d h +PDI p d i +PDJ p d j +PDK p d k +PDL p d l +PDN p d n +PDO p d o +P&D p and d +P. D. p d +P.D. p d +PD p d +PDP p d p +PDP's p d p's +PDPs p d p's +P. D. Q. p d q +PDR p d r +PDSA p d s a +PDSI p d s i +PD's p d's +PDs p d's +P.D.S. p d s +PDS p d s +PDSP p d s p +PDT p d t +P.E.I. p e i +P.E.I.'s p e i's +P.E.N. p e n +P. E. p e +P.E. p e +P.F.L. p f l +PF's p f's +PFs p f's +PFS p f s +PFU p f u +PFV p f v +PFW&C p f w and c +P.G.A. p g a +PGA p g a +PGM p g m +PGMs p g m's +PG&N p g and n +P&G p and g +P. G. p g +P.G. p g +P.G.T. p g t +PHD p h d +P. H. G. p h g +PHH p h h +PHHS p h h s +PHLF p h l f +Phlo p h l o +PHL p h l +PHN p h n +P&H p and h +P. H. p h +P.H. p h +php p h p +PHP p h p +PHPs p h p's +P.I.D.E. p i d e +P&I p and i +P. I. p i +P.I. p i +P. I. W. p i w +Piz p i z +PJB p j b +PJC p j c +PJD p j d +P. J. F. p j f +P.J.K. p j k +pj p j +P. J. p j +P.J. p j +PJ p j +PJ's p j's +PJs p j's +P.J.T. p j t +P. K. p k +P.K. p k +PK p k +PLCC p l c c +plc p l c +PLC p l c +PLC's p l c's +PLCs p l c's +P.L.O. p l o +P. L. p l +P.L. p l +PLP p l p +PLX p l x +P. M. A. p m a +PMC p m c +PMG p m g +PML p m l +PMLP p m l p +PMMA p m m a +PMMoV p m m o v +PMM p m m +PMMS p m m s +PMMT p m m t +PMOI p m o i +PMO p m o +PMPC p m p c +PMPF p m p f +p.m. p m +p.m p m +P. M. p m +P.M. p m +PM p m +PMP p m p +PMP's p m p's +PMRN p m r n +PMRO p m r o +PMR p m r +PMRR p m r r +PMSE p m s e +PMSL p m s l +PMSM p m s m +PM's p m's +PMs p m's +P. M. S. p m s +PMS p m s +PMSSY p m s s y +PMT p m t +PMVY p m v y +PMWA p m w a +PNaCl p n a c l +pna p n a +PNA p n a +Pnau p n a u +pnb p n b +PNB p n b +PNC p n c +PNE p n e +PNE's p n e's +PNEs p n e's +PNETs p n e t's +pneus p n e u s +PNFA p n f a +PNF p n f +PNGIA p n g i a +png p n g +PNG p n g +PNH p n h +PNI p n i +PNL p n l +PNL's p n l's +PNMT p n m t +PNNL p n n l +PNNs p n n's +PNoy p n o y +pn p n +P. N. p n +P.N. p n +PN p n +PNP p n p +P.N.R.A. p n r a +P.O.D. p o d +P.O.D.'s p o d's +P&O p and o +P. O. p o +P.O. p o +P.O.S. p o s +P.O.V. p o v +P.O.W. p o w +P.O.W.'s p o w's +PPACA p p a c a +PPA p p a +PPBS p p b s +PPC p p c +PPD p p d +PPE p p e +PPF p p f +PPG p p g +P&PH p and p h +PPH p p h +PPi p p i +P.P.I. p p i +PPI p p i +PPJ p p j +PPKM p p k m +PPK p p k +PPL p p l +PPM p p m +PPNB p p n b +PPN p p n +PPO p p o +P. P. p p +P.P. p p +PPRP p p r p +PPR p p r +PP's p p's +PPS p p s +PPT p p t +PPTV p p t v +PPV p p v +PPVs p p v's +PPy p p y +PQDT p q d t +PQ p q +PQQ p q q +PQ's p q's +PQS p q s +PRB p r b +PRCA p r c a +PRC p r c +PRCS p r c s +PRDM p r d m +PRD p r d +PRD's p r d's +P.R.I.M.E. p r i m e +pr p r +P. R. p r +P.R. p r +PR p r +P.S.A. p s a +P.S.C. p s c +P.S.K. p s k +PSP p s p +P. s p's +P.'s p's +Ps p's +P. S. p s +P.S. p s +PSQL p s q l +PSR p s r +PSRU p s r u +PSSA p s s a +PSSA's p s s a's +PSSAs p s s a's +PSSI p s s i +PSS p s s +PSS's p s s's +PST p s t +PSU p s u +PSV p s v +PSW p s w +pTA p t a +PTA p t a +PTA's p t a's +PTAs p t a's +PTB p t b +PTBT p t b t +PTCH p t c h +PTC p t c +Pte p t e +PTEs p t e's +PTFE p t f e +ptf p t f +PTF p t f +PTH p t h +Ptie p t i e +PTI p t i +PTI's p t i's +PTK p t k +PTLLS p t l l s +PTL p t l +PTLs p t l's +PTNNT p t n n t +Ptol p t o l +PTO p t o +PTPN p t p n +PTP p t p +pt p t +P. T. p t +P.T. p t +PT p t +PTSD p t s d +PTSE p t s e +PTS p t s +PTTGC p t t g c +PTTG p t t g +PTTOW p t t o w +PTT p t t +PTTs p t t's +PTUN p t u n +PTV p t v +PTV's p t v's +P'Twa p t w a +PTY p t y +P.U.F. p u f +Puiu p u i u +PUKKE p u k k e +PUK p u k +Pul p u l +P. U. M. p u m +PVA p v a +PVAs p v a's +PVB p v b +P.V.C. p v c +PVC p v c +PvdA p v d a +PVEM p v e m +pve p v e +PVH p v h +P.V.L. p v l +PVL p v l +PVN p v n +PVO p v o +PVP p v p +P. V. p v +P.V. p v +PV p v +pvr p v r +PVR p v r +PVRS p v r s +PVs p v's +PVS p v s +PVU p v u +PWA p w a +PWB p w b +PWC p w c +PWD p w d +PWF p w f +P. W. G. p w g +P.W.G. p w g +PWG p w g +PWI p w i +pwll p w l l +PWM p w m +P.W.O. p w o +P&W p and w +P. W. p w +P.W. p w +PW p w +Pyi p y i +PYI p y i +Pyk p y k +PYK p y k +Pyl p y l +PyL p y l +PYP p y p +P. Y. p y +Pyu p y u +Pyw p y w +Pyx p y x +PZB p z b +PZL p z l +PZP p z p +P. Z. p z +Q. A. P. q a p +QAP q a p +Q. A. q a +QA q a +Q&A q and a +Q&A's q and a's +Q&As q and a's +QbA q b a +QBE q b e +QBH q b h +QBL q b l +Q.B. q b +QB q b +Q.C.B. q c b +QCD q c d +Q.C. q c +QD q d +QDS q d s +QEA q e a +QEC q e c +Q.E.D. q e d +QED q e d +Q.E.H. q e h +Q. E. q e +Q.H.C. q h c +QHP q h p +Q.H. q h +Q.I. q i +Q. J. q j +QJ q j +Q. J. R. q j r +Q. N. q n +QPF q p f +QPFS q p f s +QPM q p m +QPO q p o +QPOs q p o's +QPP q p p +QP q p +Q.P.R. q p r +QPR q p r +QQ q q +QRL q r l +QRL's q r l's +QRNA q r n a +QROPS q r o p s +QRP q r p +QR q r +QRS q r s +QRT q r t +QRV q r v +QSAR q s a r +QSES q s e s +QSI q s i +QSL q s l +QSM q s m +QSO q s o +QST q s t +QSY q s y +QVC q v c +QVD q v d +QVM q v m +Q.V. q v +R.A.B. r a b +R. A. E. r a e +R.A.F. r a f +R.A.J. r a j +R. A. r a +R.A. r a +R&A r and a +RAV r a v +R&AW r and a w +RAZR r a z r +RBAC r b a c +RbAg r b a g +RBA r b a +RBBP r b b p +RBC r b c +RBCs r b c's +RBD r b d +RBE r b e +RBGE r b g e +RBG r b g +RBI r b i +RBIs r b i's +R. B. J. r b j +R.B.J. r b j +RBK r b k +R.B.L. r b l +RBL r b l +RBMG r b m g +RBMG's r b m g's +RBM r b m +RBMY r b m y +RBO r b o +RBP r b p +R&B r and b +R. B. r b +R.B. r b +RBR r b r +RBS r b s +RBTCO's r b t c o's +RBTH r b t h +RBWH r b w h +RBW r b w +RBX r b x +RBZ r b z +RCAC r c a c +RCAF r c a f +rca r c a +R.C.A. r c a +RCA r c a +RCA's r c a's +RCBC r c b c +RCB r c b +RCCA r c c a +RCCD r c c d +RCCL r c c l +RCCM r c c m +RCC r c c +RCI r c i +R. C. K. r c k +RCL r c l +R.C.M. r c m +RCM r c m +RCN r c n +RCPO r c p o +RCP r c p +RCPT r c p t +R&C r and c +rc r c +R. C. r c +R.C. r c +RCRD r c r d +RCR r c r +RCSB r c s b +RCS r c s +RCT r c t +RCTs r c t's +RCTS r c t s +RCTV r c t v +RCV r c v +RCW r c w +RDB r d b +RDC r d c +RDD r d d +RdE r d e +RDFC r d f c +RDF r d f +R.D.G. r d g +R&D r and d +R. D. r d +R.D. r d +R.E.A. r e a +R. E. B. r e b +R.E.D. r e d +R.E.L. r e l +R.E.M. r e m +R.E.M.'s r e m's +R.E.O. r e o +REPL r e p l +REPLs r e p l's +R.E.P. r e p +R. E. r e +R.E. r e +R.E.R. r e r +R.F.A. r f a +R.F.C. r f c +R. F. r f +R.F. r f +R. F.S. r f s +R.F.W. r f w +RFW r f w +RFX r f x +RGB r g b +RGD r g d +RGF r g f +RGG r g g +RGI r g i +RGK r g k +RGMA r g m a +RGNL r g n l +RGPH r g p h +R&G r and g +R. G. r g +R.G. r g +RGR r g r +RGS r g s +RGS's r g s's +RGTP r g t p +RGU r g u +RGV r g v +RGX r g x +R. H. C. r h c +RHC r h c +RHD r h d +RHHF r h h f +RHH r h h +RHHS r h h s +RHIBs r h i b's +RHIC r h i c +RHI r h i +Rhiw r h i w +RHK r h k +rhl r h l +RHM r h m +RhoG r h o g +Rho's r h o's +RHP r h p +R. H. r h +R.H. r h +R.H.S.J. r h s j +R. I. C. r i c +R.I.C. r i c +R. I. P. r i p +R.I.P. r i p +R&I r and i +R. I. r i +R.I. r i +riu r i u +Riu r i u +rivs r i v s +Rivu r i v u +RIXS r i x s +Rixt r i x t +RJB r j b +RJD r j d +RJE r j e +rjf r j f +RJHS r j h s +R. J. J. r j j +RJJ r j j +RJL r j l +RJN r j n +R. J. r j +R.J. r j +RJ r j +RJR r j r +RJ's r j's +RJTD r j t d +R. K. B. r k b +RKD r k d +RKI r k i +RKKA r k k a +RKL r k l +R.K.O. r k o +RKO r k o +RKO's r k o's +R. K. r k +R.K. r k +RLM r l m +RLM's r l m's +R. L. r l +R.L. r l +RL r l +RLV r l v +rly r l y +RMAF r m a f +RMAG r m a g +RMA r m a +RMB r m b +RMCH r m c h +RMCL r m c l +R.M.C. r m c +RMC r m c +RMDs r m d's +R.M.E.S. r m e s +RMFL r m f l +R.M.F. r m f +RMF r m f +RMG r m g +R. M. H. r m h +RMI r m i +RMIT r m i t +RMIT's r m i t's +RMJM r m j m +R.M.K. r m k +RMK r m k +R. M. L. r m l +RML r m l +RMLs r m l's +RMM r m m +RMP r m p +rm r m +R. M. r m +R.M. r m +RM r m +RMR r m r +RMRS r m r s +RMSD r m s d +RMSDs r m s d's +RMSE r m s e +RMs r m's +RMS r m s +R. M. W. r m w +R.M.W. r m w +RMW r m w +RMX r m x +RNAO r n a o +rna r n a +RNA r n a +RNA's r n a's +RNAs r n a's +RNAS r n a s +RNC r n c +RND r n d +RNE r n e +Rnet r n e t +RNF r n f +RNG r n g +Rnic r n i c +RNJD r n j d +RNK r n k +RNLAF r n l a f +RNLI r n l i +RNLI's r n l i's +RNNs r n n's +RNOH r n o h +RNP r n p +RNPs r n p's +RNPS r n p s +R. N. r n +R.N. r n +RN r n +R.N.R. r n r +RNZ r n z +R.O.C.K. r o c k +R.O.C. r o c +ROKMC r o k m c +ROKN r o k n +rOmpB r o m p b +Rooi r o o i +ROP r o p +R. O. r o +R.O. r o +ROVs r o v's +Roxb r o x b +Roxx r o x x +RPA r p a +RPAYC r p a y c +RPB r p b +RP&C r p and c +rpc r p c +RPC r p c +Rpe r p e +RPE r p e +RPF r p f +RPGA r p g a +rpg r p g +RPG r p g +RPG's r p g's +RPGs r p g's +RPI r p i +RPI's r p i's +RPK r p k +RPL r p l +rpm r p m +RPM r p m +RPMS r p m s +RPO r p o +RPP r p p +R. P. r p +R.P. r p +RP r p +RPs r p's +R.P.S. r p s +RPS r p s +RPT r p t +RPVE r p v e +RPV r p v +R. Q. r q +R.Q. r q +RQW r q w +rra r r a +RRA r r a +RRC r r c +RRDE r r d e +rrd r r d +Rreli r r e l i +rre r r e +RRE r r e +RRG r r g +R. R. H. r r h +RRH r r h +RRKM r r k m +R.R.K. r r k +rRNA r r n a +rRNAs r r n a's +RRN r r n +RRP r r p +R&R r and r +rr r r +R. R. r r +R.R. r r +RR r r +RRR r r r +RRSR r r s r +RRS r r s +RSAF r s a f +R. S. A. r s a +RSA r s a +RSCG r s c g +RSCJ r s c j +R.S.C. r s c +RSC r s c +RSCS r s c s +RSD r s d +RSE r s e +RSF r s f +RSFSR r s f s r +RSG r s g +RSHA r s h a +rsh r s h +RSHS r s h s +RSICC r s i c c +RSID r s i d +RSI r s i +Rsis r s i's +RSI's r s i's +RSIS r s i s +RSK r s k +RSL r s l +rsly r s l y +RsmA r s m a +RSMC r s m c +RSMI r s m i +RSML r s m l +RSM r s m +RSM's r s m's +RSNO r s n o +RSN r s n +RSNZ r s n z +R. S. O. r s o +RSO r s o +RSPB r s p b +RSPCA r s p c a +RSpec r s p e c +RSPK r s p k +RSPO r s p o +R. S. P. r s p +RSP r s p +RSR r s r +rs r s +Rs r's +R. S. r s +R.S. r s +RS r s +RSSI r s s i +R. S. S. r s s +RSS r s s +RSSSF r s s s f +RSTC r s t c +RST r s t +RSu r s u +R.S.U. r s u +RSU r s u +RSU's r s u's +RSVP r s v p +RSV r s v +RSX r s x +RTAFB r t a f b +RTA r t a +RTBF r t b f +rtb r t b +RTB r t b +RTCG's r t c g's +RTC r t c +RTCs r t c's +RTD r t d +RTEC r t e c +RTEjr r t e j r +RTeOR r t e o r +RTE r t e +RTE's r t e's +RTFB r t f b +RTFM r t f m +RTF r t f +RTF's r t f's +RTFS r t f s +RTHK r t h k +RTHK's r t h k's +RTHL r t h l +RTIP r t i p +RTI r t i +RTKL r t k l +RTK r t k +RTLM r t l m +RTL r t l +RTL's r t l's +RTML r t m l +RTMP r t m p +RTM r t m +RTN r t n +RTO r t o +RTOs r t o's +RTOS r t o s +rtPA r t p a +RTP r t p +RTR r t r +rt r t +R. T. r t +R.T. r t +RT r t +rts r t s +RTS r t s +RTS's r t s's +RTTOV r t t o v +RTT r t t +RTTY r t t y +RTUK r t u k +RTU r t u +RTVC r t v c +RTVE r t v e +RTVFBiH r t v f b i h +RTV r t v +RTVV r t v v +RTW r t w +RTXC r t x c +RTX r t x +RTZ r t z +Ruao r u a o +RUC r u c +RUC's r u c's +RUFC r u f c +Rukn r u k n +Ruk r u k +RUMC r u m c +RUNX r u n x +Rupf r u p f +Rupr r u p r +rup r u p +Rup r u p +RUP r u p +R.U.R. r u r +RUR r u r +R. U. r u +R.U. r u +RU r u +RUSD r u s d +RutB r u t b +Ruu r u u +RUV r u v +Ruwa r u w a +Ruy r u y +Ruyt r u y t +RVAR r v a r +Rvat r v a t +RVC r v c +RVCT r v c t +RVD r v d +R. V. E. r v e +RVE r v e +RVGK r v g k +R.V.G. r v g +R. V. J. r v j +R.V.J. r v j +RVM r v m +RVNG r v n g +Rvo r v o +RVO r v o +RVR r v r +R. V. r v +R.V. r v +RV r v +rvs r v s +RVTD's r v t d's +RVU r v u +rwa r w a +Rwa r w a +RWA r w a +rwb r w b +RWB r w b +RWC r w c +RWD r w d +RWDSU r w d s u +RWE r w e +RWEs r w e's +RWFC r w f c +RWIS r w i s +rwjf r w j f +R.W.R.J. r w r j +R. W. r w +R.W. r w +RW r w +RWSL r w s l +R. W. S. r w s +RWS r w s +Rxa r x a +RXL r x l +RX r x +RZR r z r +rz r z +R. Z. r z +RZ r z +RZS r z s +S.A.B. s a b +S.A.D. s a d +SAIC s a i c +Sa'id s a i d +S.A.I. s a i +SAIT's s a i t's +SAKEC s a k e c +S. A. L. s a l +S.A.P.A. s a p a +S.A.P.I. s a p i +S. A. R. s a r +S.A.R. s a r +S. A. s a +S.A. s a +SA s a +S.A.S. s a s +SAS s a s +S.A.V.A. s a v a +Saxl s a x l +Sa'yo s a y o +SAZU s a z u +SBAC's s b a c's +Sbai s b a i +S.B.A. s b a +SBA s b a +SBBK s b b k +SBB s b b +SBCM s b c m +SBCMT s b c m t +sbc s b c +SBC s b c +SBCs s b c's +SBDE s b d e +SBD s b d +SBE s b e +SBF s b f +SBI s b i +SBKP s b k p +sbk s b k +SBK s b k +SBL s b l +SBML s b m l +SBMNH s b m n h +SBM s b m +SBN s b n +SBOE s b o e +SBOL s b o l +SBOP s b o p +Sborz s b o r z +SBP s b p +SBRJ s b r j +sb s b +S. B. s b +S.B. s b +SB s b +SBSE s b s e +SBS s b s +SBS's s b s's +SBTDC s b t d c +SBT s b t +SBTU s b t u +Sbu s b u +SBU s b u +SBY s b y +SBZ s b z +S.C.A. s c a +SCA s c a +SCBA s c b a +SCB s c b +SCBWI s c b w i +SCCA s c c a +SCCA's s c c a's +SCCC s c c c +SCCI s c c i +SCCP s c c p +S.C.C. s c c +SCC s c c +scr s c r +SCR s c r +SCRs s c r's +SCRS s c r s +SCRTC s c r t c +scry s c r y +sc s c +S. C. s c +S.C. s c +SC s c +S.C.S.C. s c s c +SC's s c's +SCS s c s +SCTC s c t c +SCTE s c t e +SCTO s c t o +SCTP s c t p +SCT s c t +SCTS s c t s +SCTV s c t v +SCUAA s c u a a +Scuf s c u f +SCU's s c u's +SCW s c w +Scymn s c y m n +SD&AE s d and a e +SDAP s d a p +SDAPS s d a p s +SDA s d a +SDAS s d a s +SDASS s d a s s +SDAT s d a t +SDAX s d a x +SDB s d b +SDCC s d c c +SDCG s d c g +SDC s d c +SDDI s d d i +SDDOT s d d o t +SDD s d d +SDDS s d d s +Sdei s d e i +sde s d e +Sde s d e +SDF s d f +SDG&E s d g and e +SDHA s d h a +SDHC s d h c +SDHD s d h d +SDHHD s d h h d +SDH s d h +SDI s d i +SDJ s d j +sdk s d k +SDK s d k +SDK's s d k's +SDLC s d l c +SDLP s d l p +SDLP's s d l p's +S. D. L. s d l +S.D.N.Y. s d n y +S. D. s d +S.D. s d +SDSM&T's s d s m and t's +S. D. S. s d s +S.E.C. s e c +Sejms s e j m's +sejr s e j r +Sekl s e k l +Sek s e k +SEK s e k +S. E. s e +S.E. s e +SESL s e s l +ses s e s +Ses s e's +SEs s e's +S.E.S. s e s +SES s e s +S.E.S.'s s e s's +S.E.X. s e x +Seyh s e y h +sfadb s f a d b +SFA s f a +SFA's s f a's +Sfax s f a x +S.F.B.J. s f b j +SFB s f b +SFCC s f c c +SFCH s f c h +SFC s f c +SFDR s f d r +SFD s f d +SFE s f e +SFES s f e s +SFFAS s f f a s +SFFCo s f f c o +SFFH s f f h +SFF s f f +SFG s f g +SFI s f i +S. F. L. s f l +SFL s f l +sfn s f n +SFN s f n +SFOR s f o r +SFO s f o +SFPA s f p a +SFPD s f p d +SFP s f p +SFRA s f r a +SFRJ s f r j +SFR s f r +'sf s f +sf s f +S. F. s f +S.F. s f +SF s f +SFSG s f s g +SFSR s f s r +sfs s f s +S.F.'s s f's +SFS s f s +SFSS s f s s +SFSU s f s u +SFU s f u +SFWA s f w a +SFX s f x +SFX's s f x's +SGAE s g a e +SGAP s g a p +SGA s g a +SG&A s g and a +SGA's s g a's +sgb s g b +SGB s g b +S.G.C. s g c +SGC s g c +SGD s g d +SGE s g e +S. G. F. s g f +SGF s g f +SGH s g h +Sgip s g i p +SGI s g i +SGL s g l +sgml s g m l +SGML s g m l +SGP s g p +SGRAM s g r a m +sgra s g r a +SGR s g r +S. G. s g +S.G. s g +SGSN s g s n +SGSNs s g s n's +SGS s g s +SGSY s g s y +Sgt. sergeant +sgt s g t +SGT s g t +SGU s g u +SGV s g v +SGX s g x +SHBG s h b g +SHB s h b +SHBT s h b t +SHCA s h c a +SHC s h c +SHG s h g +SHH s h h +S.H.I.E.L.D.'s s h i e l d's +S.H.I.E.L. s h i e l +SHL s h l +Shma s h m a +SHMD s h m d +SHM s h m +SHN s h n +S. H. s h +S.H. s h +S.I.D. s i d +SIF s i f +S.I.R. s i r +S. I. s i +S.I. s i +S.I.T. s i t +SJAM s j a m +SJCH s j c h +SJC s j c +SJDA s j d a +S.J.D. s j d +sjef s j e f +SJEM s j e m +S. J. J. F. s j j f +SJK s j k +S.J.L. s j l +SJL s j l +SJM s j m +Sjon s j o n +SJPCD s j p c d +SJP s j p +SJPT s j p t +SJR s j r +SJR's s j r's +S. J. s j +S.J. s j +SJ s j +SKB s k b +SKC s k c +SKD s k d +S. K. F. s k f +SKF s k f +SKG s k g +SKH s k h +SKJ s k j +SKPC s k p c +SKP s k p +SKR s k r +SKSD s k s d +S. K. s k +S.K. s k +SK s k +S. K. S. s k s +S.L.A.A.'s s l a a's +SLAF s l a f +sla s l a +SLA s l a +SLAs s l a's +SLCO s l c o +SLC s l c +SLDL s l d l +SLD s l d +S.L.E. s l e +SLF s l f +SLG s l g +SLHS s l h s +S.L.I.F.E.R. s l i f e r +SLL s l l +SLMC s l m c +S. L. M. s l m +SLM s l m +SLN s l n +SLPIM s l p i m +SLP s l p +SLRC s l r c +SLR s l r +S&L s and l +SLS&E s l s and e +SLSF s l s f +SLSK s l s k +S. L. s l +S.L. s l +SL s l +SLS s l s +SLVR s l v r +SLV s l v +S.M.A.R.T. s m a r t +S.M.A.S.H. s m a s h +SMA s m a +SMB s m b +SMe s m e +SME s m e +SME's s m e's +SMEs s m e's +SMF s m f +SMG s m g +SMHI s m h i +SMH s m h +SmI s m i +SMI s m i +SMJR s m j r +SMK s m k +SMLS s m l s +SMMT s m m t +SMN s m n +SMNS s m n s +SMP s m p +SMP's s m p's +SMPSs s m p s's +SMPTE s m p t e +SMRJ s m r j +smr s m r +SMR s m r +S&M s and m +sm s m +S. M. s m +S.M. s m +SM s m +S.M.'s s m's +SMs s m s +S.M.S. s m s +SMS s m s +SMS's s m s's +SMSU s m s u +SMTP s m t p +S.M.T. s m t +SMT s m t +SMTV s m t v +SMU s m u +SMW s m w +SMX s m x +Smyl s m y l +SMYS s m y s +SNA s n a +SNBA s n b a +SNB s n b +SNCB s n c b +SNCC s n c c +SNCF s n c f +SNC s n c +SNDC s n d c +SND s n d +SNEP s n e p +SNESjr s n e s j r +SNES s n e s +SNET s n e t +SNF s n f +SNFU s n f u +sngle s n g l e +SNG s n g +SNK s n k +SNLA s n l a +SNL s n l +SNLS s n l s +SNMCMG s n m c m g +SNMC s n m c +SNMMA s n m m a +SNMP s n m p +SNNPR s n n p r +SNNR s n n r +SNPJ s n p j +SNP s n p +SNPs s n p's +SNRI s n r i +SNR s n r +SNSD's s n s d's +SnSe s n s e +S. N. s n +S.N. s n +SN s n +SNS s n s +S.O.E. s o e +S. O. s o +S.O. s o +Sos s o's +S.O.S. s o s +SOS s o s +Sovn s o v n +Sov s o v +SOX s o x +S. O. Y. s o y +S&P 500 s and p five hundred +S.P.A.L. s p a l +SPB s p b +SPCAs s p c a's +SPCG s p c g +SPCK s p c k +S.P.C. s p c +SPC s p c +SPDI s p d i +SPD s p d +Spe s p e +SPE s p e +SPES s p e s +SPFH s p f h +SPFL s p f l +SPF s p f +SPG s p g +SPHL s p h l +SPH s p h +SPINE's s p i n e's +SPIN's s p i n's +SPIR s p i r +SPI s p i +S.P.I.T. s p i t +SPJA s p j a +SPK s p k +SPLA s p l a +SPLC s p l c +SPL s p l +SPME s p m e +SPML s p m l +SPMRL s p m r l +SPM s p m +SPNJ s p n j +SPNM s p n m +SPNN s p n n +SPN s p n +Spoa s p o a +SPOC s p o c +SPOF s p o f +SPO s p o +SPOU s p o u +SpPIn s p p i n +SPP s p p +SPP's s p p's +SPQA s p q a +SPRL s p r l +SPRM s p r m +SPR s p r +SPRU s p r u +S&P s and p +SPSA s p s a +SPSL s p s l +S. P. s p +S.P. s p +SP s p +SP's s p's +SPs s p's +SPS s p s +SPSS s p s s +SPTA s p t a +SPT s p t +SPUC s p u c +SPUP s p u p +SPU s p u +SPUs s p u's +SPV s p v +SQA s q a +SQBB s q b b +SQI s q i +sql s q l +SQL s q l +SQM s q m +sq s q +S. Q. s q +SQ s q +Sra s r a +SRA s r a +SRAs s r a's +Srba s r b a +SRBIJA s r b i j a +Srbi s r b i +SRBOC s r b o c +SRBP s r b p +SRB s r b +SRBs s r b's +SRBY s r b y +SRCC s r c c +SRCL s r c l +SRC s r c +SRC's s r c's +SRCS s r c s +S.R.E. s r e +SRE s r e +SRFC s r f c +S.R.F. s r f +SRF s r f +S.R.G. s r g +SRG s r g +SRGs s r g's +Srhir s r h i r +SRH s r h +S. R. J. s r j +SRK s r k +SRK's s r k's +SRLGs s r l g's +S.R.L. s r l +SRL s r l +SRMC s r m c +S.R.M. s r m +SRM s r m +SRMs s r m's +Srni s r n i +SRN s r n +srp s r p +SRPT s r p t +S. R. R. s r r +SRR s r r +sr s r +S. R. s r +S.R. s r +SR s r +SRS s r s +SRT s r t +SRT's s r t's +Srul s r u l +SRU s r u +SRU's s r u's +SRV s r v +srx s r x +SRY s r y +SSAA s s a a +SSAB s s a b +SSAC s s a c +SSAR s s a r +SSA s s a +SSAs s s a's +SSBSE s s b s e +S.S.B. s s b +SSB s s b +SSCCC s s c c c +S.S.C. s s c +SSC s s c +SSCV s s c v +SSDB s s d b +SSDL s s d l +SSDP s s d p +S.S.D. s s d +SSD s s d +SSDs s s d's +SSE s s e +SSFL s s f l +SSF s s f +SSGRC s s g r c +SSG s s g +SSHSA's s s h s a's +SSH s s h +SSI s s i +SSIS s s i s +SSJA s s j a +SSKI's s s k i's +SSK s s k +SSLAM s s l a m +ssl s s l +SSL s s l +SSLT s s l t +SSME s s m e +SSM s s m +SSN s s n +SSOD s s o d +SSOF s s o f +SSO s s o +SSoSV s s o s v +SSPA s s p a +SSPH s s p h +SSPR s s p r +SSP s s p +SSPX s s p x +SSQ s s q +SSRAA s s r a a +SSRF s s r f +SSRI s s r i +SSRIs s s r i's +SSRN s s r n +SSRP s s r p +SSR s s r +S&S s and s +SSSC s s s c +SSSI s s s i +SSSR s s s r +ss s s +S. s s's +Ss s's +S. S. s s +S.S. s s +SSS s s s +SSTH s s t h +SSTL s s t l +SSTR s s t r +SST s s t +Ssu s s u +SSU s s u +SSVC s s v c +SSV s s v +SSWAHS s s w a h s +SSWC s s w c +ssw s s w +SSW s s w +SSX s s x +Ssy s s y +ST&AJ s t and a j +S.T.A.L.K.E.R. s t a l k e r +S.T.A.T.U.S. s t a t u s +STB s t b +STCC s t c c +S.T.C. s t c +STC s t c +STCW s t c w +STDP s t d p +STDs s t d's +STD s t d +STF s t f +stfv s t f v +STGs s t g's +STG s t g +STIs s t i's +STIS s t i s +STi s t i +STI s t i +STK s t k +stl s t l +S.T.L. s t l +STL s t l +STMB s t m b +STMIK s t m i k +STM's s t m's +STM s t m +STNS s t n s +STN s t n +STPI s t p i +STPNS s t p n s +STPRI s t p r i +STP s t p +S.T.R.I.D.E. s t r i d e +STRV s t r v +Stryj s t r y j +STRZ s t r z +S&T s and t +STScI s t s c i +ST's s t's +STS s t s +S. T. s t +S.T. s t +STT s t t +STVL s t v l +STVS s t v s +STV s t v +STXBP s t x b p +STX s t x +S.U.C. s u c +SUDV s u d v +suo s u o +Suo s u o +S. U. s u +SUSV s u s v +Susz s u s z +SUTs s u t's +SUT s u t +Suu s u u +SUVF s u v f +SUVs s u v's +SUV s u v +SUWN s u w n +SUW s u w +Suy s u y +Svac s v a c +svar s v a r +SVA s v a +SVB s v b +SVC s v c +SVD s v d +sve s v e +Sve s v e +SVGA s v g a +SVG s v g +SVGT s v g t +SVIA s v i a +SVM's s v m's +SVMs s v m's +SVM s v m +svn s v n +svom s v o m +SVOPC s v o p c +SVO s v o +SVP s v p +SVPW s v p w +SVSCEP s v s c e p +SVSC s v s c +SVS s v s +sv s v +S. V. s v +S.V. s v +SV s v +SVTs s v t's +SVT s v t +S.V.U. s v u +SVU s v u +SVV s v v +SVW s v w +SVYASA s v y a s a +SVZ s v z +SWABC s w a b c +SWAC s w a c +S.W.A. s w a +SWC s w c +SWD s w d +S.W.E.A.T. s w e a t +Swe s w e +SWE s w e +SWF s w f +SWG s w g +SWHL s w h l +SWHS s w h s +SWH s w h +SWJN s w j n +S. W. K. s w k +SWMRS s w m r s +SWM s w m +SWNH s w n h +SWOC s w o c +S.W.O.R.D. s w o r d +SWPA s w p a +SWPL s w p l +SWP s w p +SwRI s w r i +SWR s w r +S&W s and w +SWS s w s +sw s w +S. W. s w +S.W. s w +SW s w +SWTPC s w t p c +SWT s w t +SWWTP s w w t p +SXCT s x c t +SXN s x n +SXSW s x s w +sx s x +S.X. s x +SX s x +SXY s x y +SXZ s x z +SysML s y s m l +SysRq s y s r q +Sys s y's +SYS s y s +SysV s y s v +S. Y. s y +S.Y. s y +SyT s y t +syv s y v +Syxx s y x x +SZA s z a +Szasz s z a s z +SZDSZ s z d s z +Szer s z e r +szkic s z k i c +Szklo s z k l o +Szlak s z l a k +SzMME s z m m e +Szpir s z p i r +SZSE s z s e +sz s z +S. Z. s z +SZ s z +Szu s z u +Szyk s z y k +SZZ s z z +taf t a f +Taf t a f +TAF t a f +T.A.P. t a p +T.A.S. t a s +T. A. t a +T.A. t a +T&A t and a +TAZ t a z +TBA t b a +TBCA t b c a +TBCs t b c's +TBCS t b c s +TBD t b d +TBE t b e +TBF t b f +TBHS t b h s +TBI t b i +TBK t b k +TBL t b l +TBMA t b m a +TBMM t b m m +TBMs t b m's +T.B.M. t b m +TBM t b m +TBNJ t b n j +TBN t b n +TBP t b p +TBSC t b s c +TBS t b s +T. B. t b +T.B. t b +TB t b +TBTG t b t g +TBT t b t +TBV t b v +TBWA t b w a +TBX t b x +TCAR t c a r +TCA t c a +TCC t c c +TCDB t c d b +TCDC t c d c +TCDD t c d d +TCDOG t c d o g +TCDSB t c d s b +TCEB t c e b +T.C.E. t c e +TCE t c e +TCFAQ t c f a q +TCF t c f +TCGA t c g a +TCG t c g +TCHC t c h c +TCHRD t c h r d +TCH t c h +TCiAP t c i a p +TCI t c i +TCKs t c k's +TCLP t c l p +TCL t c l +TCM t c m +TCO t c o +TCPL t c p l +TCPMP t c p m p +TCP's t c p's +TCP t c p +TCR t c r +T. C. S. t c s +TCS t c s +tc t c +T. C. t c +T.C. t c +TC t c +TCT t c t +TCU's t c u's +TCUs t c u's +tcu t c u +TCU t c u +TCV t c v +TCWC t c w c +TCWP t c w p +TCW t c w +TDA t d a +tdb t d b +TDCC t d c c +TDCi t d c i +TDCJ t d c j +TDC's t d c's +TDC t d c +TDD t d d +TDE t d e +TDF t d f +TDH t d h +TdIF t d i f +TDI t d i +TDK t d k +TDLAS t d l a s +TDMA t d m a +TDME t d m e +TDM t d m +TDO t d o +TDP t d p +TDRS t d r s +TDR t d r +TDSB's t d s b's +TD's t d's +TDs t d's +T. D. t d +T.D. t d +TDT t d t +Teatr t e a t r +TEBD t e b d +T. E. t e +T.E. t e +TEVT t e v t +TFAP t f a p +TFAS t f a s +TFA t f a +TFC t f c +TFCU t f c u +TFF t f f +TFG t f g +T.F.H. t f h +TFH t f h +TFIH t f i h +TFIID t f i i d +TFK t f k +TFL t f l +TFM t f m +TFN t f n +TFO t f o +TFP t f p +TFR t f r +TFSA t f s a +TFSI t f s i +TFSP t f s p +TFS t f s +T&F t and f +TFTC t f t c +tf t f +T. F. t f +T.F. t f +TF t f +TFTR t f t r +TFT t f t +TFVC t f v c +TFWA t f w a +TFW t f w +TGA t g a +T. G. C. t g c +TGC t g c +tge t g e +T.G.E. t g e +TGE t g e +tgf t g f +TGF t g f +TGG t g g +TGIF t g i f +TGL t g l +TGM's t g m's +TGM t g m +TGP t g p +TGS t g s +tg t g +T. G. t g +T.G. t g +TG t g +TGVs t g v's +tgv t g v +TGV t g v +THB t h b +THCF t h c f +THC t h c +T.H.E.M. t h e m +T.H.F. t h f +THF t h f +THG t h g +THHK t h h k +T.H.I.N.K. B.I.G. t h i n k b i g +THLL t h l l +THL t h l +THMP t h m p +THM t h m +THNN t h n n +Thok t h o k +T.H.P. t h p +THQ's t h q's +THQ t h q +THR's t h r's +THR t h r +ThSe t h s e +THSR t h s r +T. H. S. t h s +T. H. t h +T.H. t h +T.H.U.N.D.E.R. t h u n d e r +THW t h w +THX t h x +TIAA t i a a +T. I. A. t i a +TIFR t i f r +TIF t i f +T.I.'s t i's +T.I. t i +Tiu t i u +tiv t i v +Tiv t i v +TIYM t i y m +Tiy's t i y's +TJFR t j f r +T.J.F. t j f +T. J. J. t j j +TJJ t j j +TJP t j p +TJRC t j r c +T. J. S. t j s +T. J. t j +T.J. t j +TJ t j +t'ju t j u +TJX t j x +tjz t j z +TKAG t k a g +TKA's t k a's +TKA t k a +T. K. B. t k b +TKD t k d +TKE t k e +TKI t k i +tko t k o +Tko t k o +TKO t k o +TKP t k p +TK's t k's +TKS t k s +tk t k +T. K. t k +T.K. t k +TK t k +TKT t k t +Tlas t l a's +TLA t l a +TLC's t l c's +TLC t l c +TlCu t l c u +TLDs t l d's +TLDS t l d s +TLD t l d +TLE t l e +TLF t l f +TLG t l g +TLH t l h +tli t l i +TLI t l i +TLM t l m +TLN t l n +tlp t l p +TLP t l p +TLRs t l r's +TLR t l r +TLs t l's +TLS t l s +TLTB t l t b +tl t l +T. L. t l +T.L. t l +TL t l +Tluk t l u k +TLU's t l u's +Tluszcz t l u s z c z +TLV t l v +TMA t m a +TMBG t m b g +TMB t m b +tmc t m c +TMC t m c +TMDL t m d l +TMD t m d +TMEM t m e m +TMF t m f +TMGs t m g's +TMG t m g +TMI t m i +TMJ t m j +T. M. M. t m m +TMMTX t m m t x +TMNT t m n t +TMOK t m o k +tmos t m o s +TMO's t m o's +TMOS t m o s +TMO t m o +TMPRSS t m p r s s +TMP t m p +tmRNA t m r n a +TMRS t m r s +TMR t m r +TMSI t m s i +TMSs t m s's +T.M.s t m's +TM's t m's +TMS t m s +tm t m +T. M. t m +T.M. t m +TM t m +T.M.T. t m t +TMT t m t +TMU t m u +TMX t m x +TMZ t m z +TNA's t n a's +TNAS t n a s +tna t n a +TNA t n a +tnbc t n b c +TNCA t n c a +TNCC t n c c +TNCDSB t n c d s b +TNC t n c +TNFA t n f a +TNFRSF t n f r s f +TNFSF t n f s f +TNF t n f +TNGHT t n g h t +TNG t n g +TNIP t n i p +TNI t n i +TNL t n l +TNMM t n m m +TNMS t n m s +TNM t n m +TNNC t n n c +TNN t n n +TNO t n o +TNPL t n p l +TNP t n p +TNQ t n q +TNRIS t n r i s +TNRP t n r p +TNR t n r +TNSDL t n s d l +TNSTC t n s t c +TNS t n s +TNTAs t n t a's +tn t n +T. N. t n +T.N. t n +TN t n +TNT's t n t's +TNT t n t +T.O.'s t o's +T. O. t o +T.O. t o +TOTP t o t p +tou t o u +Tou t o u +ToU t o u +TOU t o u +TPAC t p a c +TPAO t p a o +tPA t p a +TPA t p a +TPB t p b +TPC t p c +TPEC t p e c +TPF t p f +TPG t p g +TPH t p h +TPI t p i +TPLF t p l f +TPMS t p m s +TPM t p m +TPO t p o +TPP t p p +tpr t p r +TPR t p r +TPS t p s +tp t p +T. P. t p +T.P. t p +TP t p +TPU t p u +TPVs t p v's +TPWS t p w s +TPW t p w +TQR t q r +TQS t q s +T.Q. t q +TQ t q +tra t r a +Tra t r a +TRA t r a +TRAXX t r a x x +Trbic t r b i c +T. R. B. t r b +TRB t r b +Trcek t r c e k +TRC t r c +TRD t r d +TRFA t r f a +TRF t r f +TRG t r g +TRHS t r h s +TRH t r h +T.R.I.B.E. t r i b e +TRIZ t r i z +TrkA t r k a +TRL t r l +Trmcic t r m c i c +TRMM t r m m +T.R.M.P.A. t r m p a +T. R. M. t r m +tRNA t r n a +TRNC t r n c +TRPC t r p c +TRPM t r p m +TRPP t r p p +TRP's t r p's +TRPs t r p's +TRP t r p +TRPV t r p v +TRPY t r p y +TRSC t r s c +TRSI t r s i +trs t r s +T.R.S. t r s +TRS t r s +TRSV t r s v +tr t r +T. R. t r +T.R. t r +TR t r +TRT t r t +T.R.U. t r u +truTV t r u t v +TruTV t r u t v +Trve t r v e +TRVL t r v l +TRV t r v +TRW t r w +TRX t r x +TRZ t r z +Tsa t s a +TSA t s a +TSB t s b +TSCC t s c c +TSC t s c +TSF t s f +TSG t s g +TSH t s h +TSI t s i +tsit t s i t +Tsiv t s i v +TSJDF t s j d f +TSLA t s l a +TSLC t s l c +TSL t s l +TSN t s n +T.S.O.L. t s o l +tso t s o +Tso t s o +T.S.O. t s o +TSO t s o +TSP t s p +TSRA t s r a +TSRTC t s r t c +tsr t s r +TSR t s r +TSSA t s s a +TSS t s s +TSTA t s t a +TSTC t s t c +Ts t's +T. S. t s +T.S. t s +TS t s +TST t s t +tsus t s u s +Tsvi t s v i +TSV t s v +TSW t s w +TSX t s x +TTAB t t a b +Tta t t a +TTA t t a +TTBB t t b b +TTCP t t c p +TTC's t t c's +TTC t t c +TTDC t t d c +TTD t t d +tteok t t e o k +tte t t e +TTFF t t f f +TTHS t t h s +TTH t t h +TTI t t i +TTKG t t k g +TTKST t t k s t +TTL t t l +T.T.N. t t n +ttp t t p +TTP t t p +TTR t t r +TTS t t s +T&T t and t +T. T. t t +T.T. t t +TT t t +TTU t t u +TTV t t v +TTW t t w +TUAW t u a w +TUBB t u b b +TUDCA t u d c a +TUHUS t u h u s +TUKP's t u k p's +T'uqu t u q u +TUSCC t u s c c +TUSC t u s c +T.U. t u +TU t u +Tuzk t u z k +tvaan t v a a n +Tvam t v a m +TVARK t v a r k +tva t v a +TVA t v a +TVB's t v b's +TVB t v b +TVCM t v c m +TVC t v c +TVD t v d +TVETs t v e t's +TVE t v e +TVF t v f +TVGN t v g n +TVGOS t v g o s +TVii t v i i +TVIn t v i n +TVi t v i +TVI t v i +TVL t v l +TVMK t v m k +TVM t v m +TVN t v n +TVNZ's t v n z's +TVNZ t v n z +tvo t v o +Tvo t v o +TVO t v o +TVP t v p +TVRi t v r i +tvr t v r +TVR t v r +TVSpy t v s p y +tvs t v s +TV's t v's +TVs t v's +TVS t v s +tVTA t v t a +TVT t v t +tv t v +T. V. t v +T.V. t v +TV t v +TVXQ's t v x q's +TVXQ t v x q +TVX t v x +TWAP t w a p +TWA's t w a's +Twa t w a +TWA t w a +T. W. B. t w b +TWCS t w c s +TWC t w c +TWF t w f +Twi t w i +TWI t w i +TWK t w k +T.W.P. t w p +TWP t w p +TWR t w r +TWTs t w t's +TWT t w t +T. W. t w +T.W. t w +TW t w +T.W.U. t w u +TWU t w u +TXC t x c +TxDOT t x d o t +TXII t x i i +TXJS t x j s +TXK t x k +TXMM t x m m +TXNDC t x n d c +TXP t x p +TXTC t x t c +TXT t x t +T.X. t x +TX t x +TXU t x u +tya t y a +TYC t y c +TYIB t y i b +TYIN t y i n +Tyk t y k +Tza'ar t z a a r +Tze t z e +TZL t z l +Tzrif t z r i f +Tzuh t z u h +TZUM t z u m +Tzvi t z v i +UAAP's u a a p's +UAAP u a a p +UAB's u a b's +UAB u a b +UAC u a c +UADY u a d y +UAE's u a e's +U.A.E. u a e +UAE u a e +UAF u a f +UAHC u a h c +UAIC u a i c +UAI u a i +UALR u a l r +UAL u a l +UALVP u a l v p +UAM u a m +UANL u a n l +UAN u a n +UAOC u a o c +UAP u a p +UAR's u a r's +UARS u a r s +UAR u a r +UASLP u a s l p +UASL u a s l +Ua's u a's +UAs u a's +UAS u a s +uat u a t +U.A. u a +UA u a +UAVs u a v's +UAV u a v +U.A.W. u a w +UAW u a w +Uba u b a +UBA u b a +UBBC u b b c +UBB u b b +UbcM u b c m +UBC's u b c's +UBC u b c +UBD u b d +Ube u b e +UBE u b e +ubi u b i +Ubi u b i +U.B.I. u b i +UBI u b i +UBM's u b m's +UBM u b m +UBOS u b o s +UBO u b o +UBPR u b p r +UBP u b p +UBRE u b r e +UBRS u b r s +UB's u b's +UBS u b s +UB u b +UBU u b u +UBV u b v +UBX u b x +UCAC u c a c +Ucar u c a r +UCAR u c a r +Uca u c a +UCA u c a +UCAV u c a v +UCBH u c b h +UCBTLA u c b t l a +UCB u c b +UCCE u c c e +UCCJ u c c j +UCCS u c c s +UCC u c c +UCDA u c d a +UCDP u c d p +UCD u c d +UCF's u c f's +UCF u c f +UCG u c g +UCIEP u c i e p +UCI's u c i's +UCI u c i +UCLA's u c l a's +UCLA u c l a +UCLH u c l h +UCL u c l +Ucmak u c m a k +UCMJ u c m j +UCMMA u c m m a +UCMP u c m p +UCM u c m +Ucn u c n +UCOS u c o s +UCO u c o +UCP u c p +UCREF u c r e f +UCR u c r +UCSB u c s b +UCSC u c s c +UCSD's u c s d's +UCSD u c s d +UCSF u c s f +UCSN u c s n +uCs u c's +UCS u c s +UCTI u c t i +UCT u c t +Uc u c +U.C. u c +UC u c +Ucuncu u c u n c u +UCU u c u +UCVTS u c v t s +UCW u c w +Uczta u c z t a +UDAR u d a r +UDA's u d a's +Uda u d a +UDA u d a +UDC u d c +UDF u d f +UDG u d g +UDHR u d h r +UDICHI u d i c h i +Udit u d i t +UDK u d k +UDN u d n +Udny u d n y +UDP u d p +UDRP u d r p +UDR u d r +UDS u d s +UDTs u d t's +UDT u d t +ud u d +Ud u d +U. D. u d +UD u d +udu u d u +Udu u d u +UDYCO u d y c o +UEA u e a +UEBT u e b t +UEC u e c +Ueda's u e d a's +Uéda u e acute d a +UEFA's u e f a's +UEFA u e f a +UEFI u e f i +UEFS u e f s +UEF u e f +UEGCL u e g c l +UEI u e i +UET u e t +U. E. u e +UE u e +UFABC u f a b c +UFA's u f a's +UFCO u f c o +UFC's u f c's +UFC u f c +UFCW u f c w +UFD u f d +UFE u f e +UFF u f f +UFIA u f i a +UFIP u f i p +UFI u f i +UFJ u f j +UFL's u f l's +UFL u f l +UFM u f m +UFOFU u f o f u +UFORE u f o r e +UFO's u f o's +UFOs u f o's +Ufot u f o t +ufo u f o +Ufo u f o +UFO u f o +UFPE u f p e +UFPLS u f p l s +UFPR u f p r +UFRGS u f r g s +UFRJ u f r j +UFSB u f s b +UFSM u f s m +UF's u f's +UFS u f s +UFTP u f t p +UFT u f t +U. F. u f +UF u f +UFU u f u +UFW u f w +Uga u g a +UGA u g a +UGCCWA u g c c w a +UGC u g c +Uge u g e +UGK u g k +UGME u g m e +Ugni u g n i +UGP u g p +Ugra u g r a +Ugrszke u g r s z k e +UGS u g s +UGT u g t +Ug u g +UG u g +UHD u h d +UHF u h f +Uhha u h h a +UHMW u h m w +uhn u h n +UHOA u h o a +UHPT u h p t +UHP u h p +UHRA u h r a +UHRF u h r f +UHSAA u h s a a +UHTCs u h t c's +UHTI u h t i +Uhud u h u d +U.H. u h +uhur u h u r +UIAA u i a a +Uiam u i a m +UIA u i a +UIAW u i a w +Uibh u i b h +Uible u i b l e +UIC u i c +UID u i d +UIFL u i f l +Uig u i g +UIL u i l +UIMC u i m c +UIM u i m +UIN u i n +UIP u i p +uisae u i s a e +UISD u i s d +UiS u i s +UI's u i's +UIS u i s +UiTM u i t m +uit u i t +Uit u i t +UIT u i t +UI u i +UIV u i v +Uiy u i y +UJA u j a +UJC u j c +Ujed u j e d +UJEP u j e p +Ujsag u j s a g +UJS u j s +uj u j +U.J. u j +UJ u j +Uka u k a +UKA u k a +UKCC u k c c +UKC u k c +Ukhra u k h r a +Ukic u k i c +UKIP's u k i p's +Uki u k i +UKM u k m +UKNC u k n c +Ukoh u k o h +Uko u k o +UKPC u k p c +UKRDA's u k r d a's +UKRDA u k r d a +ukr u k r +Ukr u k r +UKR u k r +UK's u k's +UKTV's u k t v's +UKTV u k t v +Ukui u k u i +u'k u k +uk u k +Uk u k +U.K. u k +UK u k +UKUP u k u p +UKVRN u k v r n +UKW u k w +Ukwu u k w u +ULC u l c +ULDB u l d b +ULEB u l e b +ULEV u l e v +ULFA u l f a +Ulic u l i c +Ull u l l +Ulms u l m's +UL's u l's +ULS u l s +UlSU u l s u +Uluj u l u j +U.L. u l +UL u l +ulus u l u s +Ulus u l u's +ULV u l v +Ulwa u l w a +Ulwe u l w e +UMBC u m b c +Umbr u m b r +UMCC u m c c +UMC u m c +UMD u m d +umelcu u m e l c u +UMe u m e +UMF u m f +UMG u m g +UMHB u m h b +UMH u m h +UMKC's u m k c's +UMKC u m k c +UMK u m k +Umla u m l a +UML u m l +Umme u m m e +UMMSM u m m s m +UMNO's u m n o's +Umno u m n o +UMNO u m n o +UMN u m n +UMO u m o +UMPP u m p p +UMP's u m p's +Umri u m r i +UM's u m's +UMTS u m t s +UMTV u m t v +UMUC u m u c +U. M. u m +U.M. u m +UMWA's u m w a's +UMWA u m w a +UMW's u m w's +UNAB u n a b +UNAFF u n a f f +UNAH u n a h +UNAMIR u n a m i r +UNAPACK's u n a p a c k's +UNB u n b +UNCAC u n c a c +UNCAF u n c a f +UNCG's u n c g's +UNCG u n c g +UNCHE u n c h e +UNCHS u n c h s +UNCMAC u n c m a c +UNCRO u n c r o +UNC's u n c's +UNCTAD u n c t a d +UNC u n c +UNCW u n c w +UNFCCC u n f c c c +UNFICYP u n f i c y p +UNFPA u n f p a +UNFP u n f p +UNF u n f +UNFWP u n f w p +UNGC u n g c +UNHCR u n h c r +UNHRC's u n h r c's +UNH u n h +UNJLC u n j l c +Unli u n l i +UNL u n l +Unlu u n l u +UNLV u n l v +UNMCK u n m c k +UNMC u n m c +UNMEE's u n m e e's +UNMEE u n m e e +UNMIH u n m i h +UNMIK u n m i k +UNMIL u n m i l +UNMOVIC u n m o v i c +unm u n m +UNM u n m +UNNC u n n c +unnd u n n d +UNODC u n o d c +UNOMIG u n o m i g +UNPA u n p a +UNPD u n p d +UNPO u n p o +UNP u n p +UNRA u n r a +UNRSGN u n r s g n +UNRWA u n r w a +UNSCOM u n s c o m +UNSCR u n s c r +UNSC's u n s c's +UNSC u n s c +UNSh u n s h +Unst u n s t +Uns u n's +U.N.'s u n's +UNSW u n s w +UNTSO u n t s o +UNTS u n t s +Unt u n t +UNT u n t +U.N. u n +UNU u n u +UNV u n v +UNWE u n w e +UNWTO u n w t o +Unz u n z +UOCl u o c l +UODA u o d a +UofM u o f m +UOHI u o h i +Uoho u o h o +UOJCA u o j c a +UOL u o l +UOMINI u o m i n i +UoMs u o m's +UOP u o p +uORF u o r f +UOR u o r +UO's u o's +UO u o +UoW u o w +UPABA u p a b a +UPBs u p b's +UPCI u p c i +UPC u p c +UPDRS u p d r s +UPDS u p d s +Upd u p d +UPD u p d +UPEC u p e c +UPFA u p f a +UPF's u p f's +Upf u p f +UPF u p f +UPGMA u p g m a +UPHSD u p h s d +UPIN u p i n +Upir u p i r +UPI's u p i's +UPI u p i +UPLA u p l a +UPLB u p l b +UPL u p l +UPMC u p m c +UPMSS u p m s s +UPND u p n d +UPNE u p n e +UPnP u p n p +UPN u p n +UPOV u p o v +UPPP u p p p +Uppu u p p u +UPRR u p r r +UPR u p r +UPSC u p s c +U.P.S.E.B. u p s e b +UPSIDC u p s i d c +UPSID u p s i d +UPSI u p s i +UPSMF u p s m f +UPTI u p t i +UPTU u p t u +U.P. u p +UPW u p w +UPX u p x +UPyD u p y d +UQAIB u q a i b +UQAM's u q a m's +UQC u q c +U.Q.P. u q p +UQP u q p +uq u q +UQ u q +URAA u r a a +URAC u r a c +URAP u r a p +URBACT u r b a c t +URBED u r b e d +Urbz u r b z +URCL u r c l +URCSA u r c s a +URCs u r c's +URC u r c +Urdd u r d d +Urei u r e i +urf u r f +Urla u r l a +URLhttp u r l h t t p +URLs u r l's +URL u r l +URNU u r n u +UROC u r o c +URRACA u r r a c a +URSB u r s b +URSEC u r s e c +URSS u r s s +URW's u r w's +URW u r w +URZ u r z +USAACE u s a a c e +USAAC u s a a c +U.S.A.A.F. u s a a f +USAAF u s a a f +USAB u s a b +USACE u s a c e +USAC u s a c +USAFE u s a f e +USAF u s a f +USAHA u s a h a +USAID's u s a i d's +USAID u s a i d +Usal u s a l +usan u s a n +Usan u s a n +USAN u s a n +usao u s a o +USAO u s a o +USAPA u s a p a +USARPS u s a r p s +USASA u s a s a +USA's u s a's +usata u s a t a +USATF u s a t f +USAT u s a t +usa u s a +.USA u s a +U.S.A. u s a +U.S.A u s a +USA u s a +USAya u s a y a +USBA u s b a +USBC's u s b c's +USBC u s b c +USBs u s b's +USB u s b +USBWA u s b w a +USCCB u s c c b +USCF u s c f +USCGAUX u s c g a u x +USCGC u s c g c +USCG u s c g +USCHS u s c h s +Uscie u s c i e +USCIRF u s c i r f +USCIS u s c i s +USCITA u s c i t a +USCOB u s c o b +USCRP u s c r p +U.S.C.'s u s c's +USC's u s c's +USCT u s c t +U.S.C. u s c +USC u s c +USDA's u s d a's +U.S.D.A. u s d a +USDA u s d a +USDoE u s d o e +USDOJ u s d o j +USDP u s d p +USDTV u s d t v +usd u s d +USD u s d +USEER u s e e r +USENIX u s e n i x +USFbA u s f b a +USFE u s f e +USFF u s f f +USFLPA u s f l p a +USFL u s f l +USFS u s f s +USF u s f +USF&WS u s f and w s +USFWS u s f w s +USFW u s f w +USGA u s g a +U.S.G.S. u s g s +USGS u s g s +U.S. H.R. u s h r +UShs u s h's +Usia u s i a +USIA u s i a +usih u s i h +USIP's u s i p's +USIP u s i p +USISL u s i s l +USIS u s i s +USIU u s i u +USJA u s j a +USJ u s j +USLES u s l e s +USLHE u s l h e +USLMRA u s l m r a +USLTA u s l t a +USL u s l +Uslu u s l u +Usmar u s m a r +USMA u s m a +USMC M u s m c +USMCR u s m c r +USMC's u s m c's +USMC u s m c +USMLE u s m l e +USML u s m l +USMMA u s m m a +USM u s m +Usna u s n a +USNA u s n a +USNG u s n g +Usnic u s n i c +USNM u s n m +USNO u s n o +USNR u s n r +USNSCS u s n s c s +USNS u s n s +USNTDP u s n t d p +U.S.N. u s n +USN u s n +USOC's u s o c's +USOC u s o c +Usoi u s o i +Usos u s o's +Uso u s o +USO u s o +USPHL u s p h l +USPO u s p o +USPPD u s p p d +U.S.P.Q. u s p q +USPSA u s p s a +USPs u s p's +USPS u s p s +USPTA u s p t a +USPTO u s p t o +U.S.P. u s p +USP u s p +USRA u s r a +USRC u s r c +USSA u s s a +USSBA u s s b a +USSB u s s b +USSD u s s d +USSF's u s s f's +USSF u s s f +USSR's u s s r's +USSR u s s r +U.S.S.R u s s r +U.S.'s u s's +US's u s's +U.S.S. u s s +USS u s s +Usti u s t i +Ustka u s t k a +USTR's u s t r's +USTR u s t r +UST's u s t's +Usui u s u i +usum u s u m +U. S. u s +U.S. u s +Usut u s u t +USVC u s v c +Usvit u s v i t +USVI u s v i +U.S.V. u s v +USWA u s w a +USWNT's u s w n t's +USWNT u s w n t +U.S.W. u s w +USW u s w +Uta's u t a's +uta u t a +Uta u t a +UTA u t a +UTB u t b +Utca u t c a +UTC u t c +Utd's u t d's +Utd u t d +utea u t e a +UTEP u t e p +Utes u t e's +UTET u t e t +UTF u t f +Uth u t h +uti u t i +Uti u t i +UTJ u t j +UTMB u t m b +UTMF u t m f +UTM u t m +Utne u t n e +Utnur u t n u r +Uto u t o +UTO u t o +UTPB u t p b +UTP u t p +utrci u t r c i +UTRGV u t r g v +UTR u t r +utsav u t s a v +Utsav u t s a v +UTSC u t s c +UTSI u t s i +UT's u t's +UTS u t s +Utsu u t s u +UTTR u t t r +U.T. u t +Utu u t u +Utva u t v a +UTVA u t v a +UTV u t v +UUA u u a +UUCP u u c p +Uuh u u h +UUKKY u u k k y +Uul u u l +Uulu u u l u +UUP u u p +Uusi u u s i +UUs u u's +Uuto u u t o +UUT u u t +Uvac u v a c +UVB u v b +UVC u v c +Uvea u v e a +UVF u v f +UVIMB u v i m b +UVI u v i +uvnitr u v n i t r +Uvo u v o +UVT u v t +UVU u v u +U.V. u v +UV u v +UWAP u w a p +Uwasa u w a s a +UWASA u w a s a +U.W.A. u w a +UWA u w a +UWB u w b +UWC u w c +UWFi u w f i +UWF u w f +UWG u w g +UWH u w h +UWI u w i +UWM's u w m's +UWP u w p +UWRF u w r f +UWSP's u w s p's +UWSU u w s u +UW's u w's +UWS u w s +UW u w +UWW u w w +VASP v a s p +VA's v a's +V. A. v a +V.A. v a +VA v a +V&A v and a +Vav v a v +VAV v a v +Vay v a y +VBA v b a +VBBS v b b s +VBE v b e +VBI v b i +VBM v b m +VBR v b r +vb v b +V. B. v b +V.B. v b +VB v b +VCA's v c a's +VCA v c a +VCCS v c c s +VCDs v c d's +VCD v c d +VCE v c e +VCH v c h +VCIT v c i t +VCI v c i +VCJ v c j +V. C. M. v c m +VCO v c o +VCP v c p +VCQ v c q +VCRs v c r's +VCR v c r +VCSELs v c s e l's +VCSEL v c s e l +VCs v c's +VCS v c s +VCTs v c t's +VCT v c t +VCU v c u +vc v c +V. C. v c +V.C. v c +VC v c +VCXIV v c x i v +VCY v c y +VDAC v d a c +vda v d a +Vda v d a +VDCs v d c's +VDC v d c +vdiq v d i q +VDJ v d j +VDL's v d l's +VDL v d l +vdm v d m +VDM v d m +VDP v d p +VDR v d r +VDSL v d s l +VDUP v d u p +VDU v d u +V. D. v d +V.D. v d +VD v d +VDV v d v +V. D. W. v d w +vez v e z +Vez v e z +VEZ v e z +V.F.A. v f a +VFA v f a +VFC v f c +VFDS v f d s +V.F.D. v f d +VFD v f d +VFIL v f i l +VFLI v f l i +VFL's v f l's +VFL v f l +VFMC v f m c +VFM v f m +vfp v f p +vfr v f r +VFR v f r +VF's v f's +VFS v f s +VFTS v f t s +VFTX v f t x +VFU v f u +V. F. v f +V.F. v f +VF v f +VFW v f w +VFX v f x +VGA v g a +V'Ger v g e r +VGIK v g i k +VGKO v g k o +VGMA v g m a +vgmdb v g m d b +VGMDB v g m d b +VGM v g m +VGo v g o +VGP v g p +VGSCs v g s c's +VGSoM v g s o m +VGTU v g t u +VGU v g u +V. G. v g +V.G. v g +VG v g +VGV v g v +VGX v g x +VHB v h b +VHC v h c +VHD v h d +VHF v h f +VHL v h l +VHP v h p +VHR v h r +VHSL v h s l +VHS v h s +V. H. v h +VH v h +V.I.C.'s v i c's +Vict v i c t +VICT v i c t +viita v i i t a +vijf v i j f +vij v i j +Vij v i j +V.I.P.s v i p's +VIPs v i p's +V.I.P. v i p +VIP v i p +V. I. v i +V.I. v i +V. J. J. v j j +VJL v j l +VJs v j's +VJTF v j t f +V. J. v j +V.J. v j +VJ v j +VKG v k g +VKIBC's v k i b c's +V. K. N. v k n +VKOS v k o s +VKS v k s +V. K. v k +V.K. v k +VK v k +Vlah v l a h +VLA v l a +VLBA v l b a +VLBI v l b i +VLB v l b +VLCCs v l c c's +VLCS v l c s +VLC v l c +VLDB v l d b +VLDL v l d l +vlei v l e i +VLE v l e +VLEX v l e x +VLF v l f +Vlijt v l i j t +VLN v l n +VLQ v l q +VLR v l r +VLSI v l s i +VLS v l s +VLT v l t +V. L. v l +V.L. v l +VL v l +VMAs v m a's +VMAT v m a t +VMA v m a +VMCAS v m c a s +VMCM v m c m +VME v m e +VMFM v m f m +VMF v m f +VMG v m g +VMI's v m i's +VMI v m i +VMK v m k +VMM v m m +VMPS v m p s +VMS v m s +VMT v m t +vm v m +V. M. v m +V.M. v m +VM v m +VNAF v n a f +VNAV v n a v +VNCH v n c h +VNC v n c +vner v n e r +V.N.E. v n e +VNI v n i +VNO v n o +VNPT v n p t +VNQDD v n q d d +VNR v n r +VNSA v n s a +VNS v n s +VNTH v n t h +VNTR v n t r +VNU v n u +V. N. v n +V.N. v n +VN v n +V.O. v o +VO v o +Vov v o v +VOX's v o x's +Voz v o z +VPAL v p a l +VPD v p d +VPH v p h +vpis v p i s +V. P. I. v p i +VPI v p i +VPLS v p l s +VPL v p l +VPM v p m +VPNs v p n's +VPN v p n +VPO's v p o's +VPP v p p +VPRO's v p r o's +VPRO v p r o +VPS v p s +vpu v p u +V. P. v p +V.P. v p +VP v p +VQT v q t +vq v q +VQ v q +vrak v r a k +VRA v r a +Vrba v r b a +Vrbuv v r b u v +VRD v r d +Vrej v r e j +vrem v r e m +VRE v r e +VRF v r f +Vrin v r i n +VRI v r i +vrj v r j +VRLA v r l a +vrn v r n +vroee v r o e e +vrou v r o u +vrouw v r o u w +Vrouw v r o u w +VRO v r o +VRR v r r +Vrsac v r s a c +VRSA v r s a +VR's v r's +VRS v r s +Vrtis v r t i's +VRT's v r t's +VRT v r t +V&R v and r +vr v r +V. R. v r +V.R. v r +VR v r +VRV v r v +VSANs v s a n's +VSAN v s a n +VSAP's v s a p's +VSATs v s a t's +VSB's v s b's +VSB v s b +VSCP v s c p +VSC v s c +VSD v s d +Vsekh v s e k h +vse v s e +VSE v s e +VSFV v s f v +VSG v s g +VSI v s i +VSM v s m +VSNL v s n l +vso v s o +VSO v s o +VSPs v s p's +VSP v s p +VSS v s s +VSTM v s t m +VST v s t +VSU v s u +vs. versus +_vs._ versus +VSV v s v +VSW v s w +VSX v s x +vsyo v s y o +VSZ v s z +VTA v t a +VTB v t b +VTCO v t c o +VTD v t d +VTEC v t e c +VTE v t eL +Vtic v t i c +VTi v t i +VTL v t l +VTM v t m +VTR v t r +VTSK v t s k +V&T's v and t's +VTS v t s +VTU v t u +V&T v and t +VTVL v t v l +V.T. v t +VT v t +VTV v t v +Vuur v u u r +VUU v u u +V.V.B. v v b +VVCS v v c s +VVD v v d +VVIPs v v i p's +VVI v v i +VVMC v v m c +VVO v v o +VVS v v s +VVT v v t +V. V. v v +V.V. v v +VV v v +VWM v w m +VWR v w r +VW's v w's +VWs v w's +VWS v w s +VW v w +VXL v x l +VXR v x r +VX v x +Vyg v y g +vyr v y r +vy v y +VY v y +vz v z +V. Z. v z +WAAAAAGH w a a a a a g h +WAAAF w a a a f +WAAC w a a c +WAAF w a a f +WAAI w a a i +WAAV w a a v +Waay w a a y +WABB w a b b +WABC w a b c +WABD w a b d +WABG's w a b g's +WABG w a b g +W. A. C. w a c +W.A.C. w a c +Wa'il w a i l +WAIO w a i o +W.A.J. w a j +Wakf w a k f +W.A.K.O. w a k o +wa'l w a l +WANFL w a n f l +WAOK w a o k +waqf w a q f +waqt w a q t +Waqt w a q t +WAQZ w a q z +WARH w a r h +W.A.R. w a r +WASC w a s c +Wasl w a s l +WASL w a s l +W. A. S. w a s +W.A.S. w a s +Watfa w a t f a +WATL w a t l +WATW w a t w +wau w a u +Wau w a u +WAU w a u +WAVF w a v f +WAVM w a v m +W. A. w a +W.A. w a +WA w a +WAWLI w a w l i +waw w a w +WAWZ w a w z +WAYH w a y h +waza w a z a +Waza w a z a +WBAL's w b a l's +WBAM w b a m +WBA w b a +WBBL w b b l +WBBM w b b m +WBBP w b b p +WBCA w b c a +WBCN w b c n +W.B.C. w b c +WBC w b c +WBCY w b c y +WBEV w b e v +WBEZ w b e z +WBFJ w b f j +WBFO w b f o +WBF w b f +WBG w b g +WBHY w b h y +WBIC w b i c +WBIL w b i l +WBJEE w b j e e +WBKO w b k o +WBK w b k +WBLQ w b l q +WBME w b m e +WBNI w b n i +WBNX w b n x +WBON w b o n +WBO w b o +WBQC w b q c +WBRC w b r c +WBRE w b r e +WBRO w b r o +WBRZ w b r z +WBs w b's +WBS w b s +WBTI w b t i +WBT's w b t's +WBT w b t +WBTW w b t w +WBTZ w b t z +WBUR w b u r +WBVE w b v e +WBV w b v +W. B. w b +W.B. w b +WB w b +WBXH w b x h +WBZB w b z b +WBZ w b z +WCAA w c a a +WCAG w c a g +WCAU w c a u +WCA w c a +WCBA w c b a +WCBN w c b n +W&CBR w and c b r +WCBR w c b r +WCBS w c b s +WCB w c b +WCCES w c c e s +WCCG w c c g +WCCO w c c o +WCC's w c c's +WCC w c c +WCDA w c d a +WCEO w c e o +WCFL w c f l +WCF w c f +WCG w c g +WCHA w c h a +WCHL's w c h l's +WCHL w c h l +WCHS w c h s +WCHV w c h v +WCIU w c i u +WCKD w c k d +WCKY w c k y +WCLN w c l n +WCLU w c l u +WCLV w c l v +WCL w c l +WCMA w c m a +WCMC w c m c +WCMFA w c m f a +WCMH w c m h +WCMR w c m r +WCM w c m +WCNB w c n b +WCOZ w c o z +WCPO w c p o +WCPW w c p w +WCRC w c r c +WCRE w c r e +WCRL w c r l +WCSA w c s a +WCSM w c s m +WCS w c s +WCTD w c t d +WCTG w c t g +W.C.T.U. w c t u +WCTU w c t u +WCTV w c t v +WCT w c t +WCTX w c t x +WCVB's w c v b's +WCVB w c v b +WCVE w c v e +WCWA w c w a +wc w c +W. C. w c +W.C. w c +WC w c +WCWC w c w c +WCW w c w +WCXR w c x r +WCYB w c y b +WCZE w c z e +WDAF w d a f +WDA w d a +WDC w d c +WDDM w d d m +WDFN w d f n +WDF w d f +WDGY w d g y +WDH w d h +WDIA w d i a +WDIF w d i f +WDIG w d i g +WDIS w d i s +WDIV w d i v +WDJT w d j t +WDLA w d l a +WDL w d l +WDM w d m +WDNN w d n n +WDNS w d n s +WDNT w d n t +WDOK w d o k +WDO w d o +WDRE w d r e +WDR w d r +WDSE w d s e +WDSN w d s n +WDSO w d s o +WDSU w d s u +WDS w d s +WDTM w d t m +WDUQ w d u q +WDVE w d v e +WDVR w d v r +W. D. w d +W.D. w d +WDWS w d w s +WDW w d w +WDXZ w d x z +WDYZ w d y z +W. E. B. w e b +W.E.B. w e b +W. E. H. w e h +W.E.H. w e h +WEVD w e v d +WEVV w e v v +W. E. w e +W.E. w e +WEZQ w e z q +WFAA w f a a +WFAL w f a l +WFAN w f a n +WFB w f b +WFCA w f c a +WFC w f c +WFDC w f d c +WFDD w f d d +WFDF w f d f +WFDU w f d u +WFD w f d +WFGF w f g f +WFHE w f h e +W.F.H. w f h +WFH w f h +WFIKKN w f i k k n +WFIL w f i l +WFIRST w f i r s t +WFL's w f l's +WFL w f l +WFLX w f l x +WFMT w f m t +WFMU w f m u +W. F. M. w f m +WFM w f m +WF&NW w f and n w +WFNZ w f n z +WFOY w f o y +WFPC w f p c +WFPF w f p f +WFPMA w f p m a +W.F.P. w f p +WFP w f p +WFSBP w f s b p +WFS w f s +WFTDA w f t d a +WFTM w f t m +WFTV w f t v +WFT w f t +WFVA w f v a +W&F w and f +WFWA w f w a +W. F. w f +W.F. w f +WF w f +WFWM w f w m +WFXR w f x r +wga w g a +WGA w g a +WGBH w g b h +WGBI w g b i +W. G. B. w g b +WGB w g b +WGCB w g c b +W.G.C. w g c +WGC w g c +WGEM w g e m +WGFT w g f t +WGGH w g g h +WGHP w g h p +WGH w g h +WGHW w g h w +WGI w g i +WGN's w g n's +WGNT w g n t +wgn w g n +WGN w g n +WGOK w g o k +WGO w g o +WGP w g p +WGPX w g p x +WGRP w g r p +WGRT w g r t +WGRV w g r v +WGSA w g s a +WGSS w g s s +WGS w g s +WGUN w g u n +wg w g +W. G. w g +W.G. w g +WG w g +WGWW w g w w +WGZR w g z r +W.H.B. w h b +WHCA w h c a +WHCB w h c b +WHCC w h c c +W. H. C. w h c +W.H.C. w h c +WHC w h c +WHDG w h d g +WHDI w h d i +W.H.D. w h d +WHEC w h e c +WHFA w h f a +WHFM w h f m +WHFS w h f s +WHHS w h h s +W.H.H. w h h +WHJA w h j a +W.H.J. w h j +WHJY w h j y +WHKT w h k t +WHL's w h l's +WHL w h l +WHNO w h n o +WHP w h p +WHRC w h r c +WHSN w h s n +WHSS w h s s +W.H.S. w h s +WHS w h s +W. H. T. w h t +WHTZ w h t z +W&H w and h +W. H. w h +W.H. w h +WH w h +Whyld w h y l d +WHYT w h y t +W.I.B.C. w i b c +Wica w i c a +wici w i c i +WIC's w i c's +WICU w i c u +Wif w i f +WIF w i f +WIJD w i j d +Wijk w i j k +WIP w i p +W.I.S.E. w i s e +W.I.T.C.H. w i t c h +Wiwa w i w a +W. I. w i +WIXY's w i x y's +WJAL w j a l +WJAR w j a r +wjaz w j a z +WJBC w j b c +WJBF w j b f +WJBK w j b k +WJBR w j b r +WJCI w j c i +WJC w j c +WJEC w j e c +WJEF w j e f +WJER w j e r +WJET w j e t +W. J. J. O. w j j o +W.J.J.O. w j j o +WJJZ w j j z +WJKA's w j k a's +WJKA w j k a +WJKS w j k s +WJLA w j l a +WJMK w j m k +WJM w j m +WJOI w j o i +WJRD w j r d +WJR w j r +WJSC w j s c +W&J's w and j's +WJTD w j t d +WJUX w j u x +W&J w and j +W. J. w j +W.J. w j +WJ w j +WJXX w j x x +WJYL w j y l +WJYM w j y m +WJZA w j z a +WJZJ w j z j +WJZ w j z +WKAG w k a g +WKAQ w k a q +WKAR w k a r +WKA w k a +WKBD w k b d +WKBF's w k b f's +WKB w k b +WKBW w k b w +W. K. C. w k c +WKDM w k d m +WKDN w k d n +WKDZ w k d z +WKFS w k f s +W.K.H. w k h +WKH w k h +WKIK w k i k +WKIP w k i p +WKKB w k k b +WKKD w k k d +WKKZ w k k z +WKLH w k l h +WKNDS w k n d s +WKN w k n +WKQI w k q i +WKRR w k r r +WKSE w k s e +WKSM w k s m +WKSU w k s u +WKTU's w k t u's +WKTU w k t u +W.K.V. w k v +W. K. w k +W.K. w k +WKXJ w k x j +WKX w k x +WKYS's w k y s's +WKYT w k y t +WKY w k y +W.L.A.K. w l a k +WLB w l b +WLCH w l c h +W&LE w and l e +Wley w l e y +WLGH w l g h +WLH w l h +WLII w l i i +WLIR w l i r +WLJY w l j y +WLKT w l k t +WLKY w l k y +WLLM w l l m +WLNP w l n p +WLNQ w l n q +WLNS w l n s +WLPA w l p a +WLPR w l p r +WLPWR w l p w r +wlrs w l r s +WLSG w l s g +WLS w l s +WLTM w l t m +WLUK's w l u k's +WLUK w l u k +WLWC w l w c +W. L. w l +W.L. w l +WL w l +WLW w l w +WLYH's w l y h's +WLYN w l y n +WLY w l y +WLZK w l z k +WMAC w m a c +WMAG w m a g +WMAP w m a p +WMAQ w m a q +WMATA's w m a t a's +WMATA w m a t a +W.M.A. w m a +WMA w m a +WMAZ w m a z +WMBG w m b g +WMCAT w m c a t +WMCA w m c a +WMDB w m d b +WMDI w m d i +WMD w m d +WMEE w m e e +WMEN w m e n +WMET w m e t +WME w m e +WMEX w m e x +WMFC w m f c +WMFM w m f m +WMFP w m f p +W.M.F. w m f +WMF w m f +WMGF w m g f +WMG w m g +WMGY w m g y +WMHG w m h g +WMHT w m h t +WMIX w m i x +WMJR w m j r +WMJZ w m j z +WMKQ w m k q +WMKW w m k w +wml w m l +WMLW w m l w +WMLY w m l y +WMMS w m m s +W. M. M. w m m +WMNF w m n f +WMN w m n +WMOB w m o b +WMO w m o +WMRA w m r a +WMRO w m r o +WMSG w m s g +W.M.S. w m s +WMS w m s +WMTS w m t s +WMT w m t +WMTW w m t w +WMUB w m u b +WMU w m u +WMVM w m v m +WMV w m v +W&M w and m +W. M. w m +W.M. w m +WM w m +WMWM w m w m +WMXB w m x b +WMX w m x +WMYE w m y e +WMYL w m y l +WNAK w n a k +W.N.B.A. w n b a +WNBA w n b a +WNBC w n b c +WNBL w n b l +WNBR w n b r +WNB w n b +WNCN w n c n +WNC w n c +WNCX w n c x +WND w n d +WNED w n e d +WNEL w n e l +WNEM w n e m +WNEP w n e p +WNET w n e t +WNEW's w n e w's +WNEW w n e w +WNFM w n f m +WNGL w n g l +WNIT w n i t +WNJN w n j n +WNJO w n j o +WNJY w n j y +WNK w n k +WNLO w n l o +WNLU w n l u +WNL w n l +WNMX w n m x +WNO w n o +WNPT w n p t +WNRN w n r n +WNR's w n r's +WNRV w n r v +WNSH w n s h +WNSR w n s r +WNTM w n t m +WNT w n t +WNUA w n u a +WNUF w n u f +WNUSP w n u s p +WNWBL w n w b l +W. N. w n +W.N. w n +WN w n +WNWO w n w o +WNWS w n w s +WNW w n w +WNYA w n y a +WNYC's w n y c's +WNYC w n y c +WNYM w n y m +WNY w n y +WNYZ w n y z +wnzaa w n z a a +WOAA w o a a +WOAK w o a k +WOA w o a +WOC w o c +W&OD w and o d +W.O.G. w o g +WOGX's w o g x's +WOJG w o j g +WOLH w o l h +WOOM w o o m +WOPC w o p c +Worh w o r h +WOSM w o s m +W. O. w o +W.O. w o +WOWOW w o w o w +WOXY w o x y +WOZN w o z n +WPAC w p a c +WPA w p a +WPBC w p b c +WPBSA w p b s a +WPBS w p b s +WPBT w p b t +W. P. C. w p c +WPC w p c +WPDH w p d h +WPD w p d +WPFF w p f f +WPFL w p f l +WPF w p f +WPGC w p g c +WPHL w p h l +WPH w p h +WPIAL w p i a l +WPI w p i +WPIX w p i x +WPLA w p l a +WPLG w p l g +WPLS w p l s +WPMW w p m w +WPO w p o +WPPT w p p t +WPP w p p +WPRI w p r i +WPRO w p r o +WPRP w p r p +WPSC w p s c +WPSL w p s l +WPS w p s +WPTB w p t b +WPTD's w p t d's +wpt w p t +WPT w p t +WPTY w p t y +W. P. U. w p u +wp w p +W. P. w p +W.P. w p +WP w p +WPXN w p x n +WPYR w p y r +WQDE w q d e +WQHT w q h t +WQIV w q i v +WQLR w q l r +WQLZ w q l z +WQMS w q m s +WQOK w q o k +WQSO w q s o +WQSX w q s x +WQ w q +WQXI w q x i +WQXR w q x r +W. R. A. S. w r a s +WRAT w r a t +WRBU w r b u +WRCB w r c b +WRCN w r c n +WRC w r c +WRDL w r d l +Wrec w r e c +WRFD w r f d +WRFK w r f k +WRFM w r f m +WRFX w r f x +WRGO w r g o +WRGP w r g p +W. R. G. w r g +WRHA w r h a +WRHC w r h c +WRHI w r h i +W.R.I. w r i +WRKA w r k a +WRKO w r k o +WRKT w r k t +W.R.K. w r k +WRKY w r k y +WRNS w r n s +WRN w r n +WRNY w r n y +WRNZ w r n z +WROJ w r o j +WROK w r o k +WROO w r o o +WRPT w r p t +WRQQ w r q q +WRTA w r t a +WRTC w r t c +WRUV w r u v +WRU w r u +WRVL w r v l +WRVS w r v s +WRWB w r w b +W. R. w r +W.R. w r +WR w r +W.R.W. w r w +WRXT w r x t +WSAR w s a r +WSAV w s a v +W.S.A. w s a +WSA w s a +WSAZ w s a z +WSBG w s b g +WSBM w s b m +WSBT w s b t +WSB w s b +WSCA's w s c a's +WSCR w s c r +W. S. C. w s c +WSC w s c +WSDD w s d d +WSDG w s d g +WSDOT w s d o t +WSDP w s d p +WSDR w s d r +WSEG w s e g +WSEK w s e k +WSE w s e +WSFA w s f a +WSFL w s f l +WSFM w s f m +WSFS w s f s +WSFX w s f x +WSGE w s g e +WSGW w s g w +WSHL w s h l +WSHU w s h u +WSH w s h +WSIPC w s i p c +WSIS w s i s +WSJM w s j m +WSJO w s j o +WSJ w s j +WSLU w s l u +WSL w s l +WSMK w s m k +W.S.M. w s m +WSM w s m +WSNJ w s n j +WSNS w s n s +WSNT w s n t +WSN w s n +WSOF w s o f +WSOPE w s o p e +WSOP's w s o p's +WSOP w s o p +WSORR w s o r r +WSO w s o +WSOY w s o y +WSPA w s p a +WSPC w s p c +WSPD w s p d +WSPN w s p n +WSPS w s p s +WSPU w s p u +WSP w s p +WSRA w s r a +WSRE's w s r e's +WSRF w s r f +WSSA w s s a +WSSCC w s s c c +WSSSA w s s s a +WSS w s s +WSTE w s t e +WSTR w s t r +WSUA w s u a +WSUD w s u d +WSUE w s u e +WSUS w s u s +WSU w s u +WSV w s v +WSVZ w s v z +WSWI w s w i +ws w s +W. S. w s +W.S. w s +WS w s +WSW w s w +WSYN w s y n +WSYX w s y x +WTAA w t a a +WTAE w t a e +WTAF w t a f +WTAG w t a g +WTAM's w t a m's +W. T. A. w t a +WTA w t a +WTAW w t a w +WTCC w t c c +W. T. C. w t c +W.T.C. w t c +WTC w t c +WTDY w t d y +WTEL w t e l +WTEV's w t e v's +WTEV w t e v +WTF w t f +WTGB w t g b +WTHR's w t h r's +WTHS w t h s +WTIU w t i u +WTI w t i +WTIX w t i x +WTKG w t k g +WTKO w t k o +WTKR w t k r +WTKS w t k s +WTLS w t l s +WTMA w t m a +WTNH w t n h +WTN w t n +WTOP w t o p +WTO's w t o's +WTOS w t o s +WTO w t o +WTPA w t p a +WTPQ w t p q +WTR w t r +WTs w t's +WTS w t s +WTTF w t t f +WTTM w t t m +WTTs w t t's +WTT w t t +WTTW w t t w +WTTZ w t t z +WTVA w t v a +WTVC w t v c +WTVD w t v d +WTVI w t v i +WTVM w t v m +WTVU w t v u +WTVW w t v w +WTVX w t v x +WTWF w t w f +W. T. w t +W.T. w t +WT w t +WTX w t x +WUAB w u a b +WUAP w u a p +WUAs w u a's +WUC w u c +Wudl w u d l +Wuhr w u h r +Wuhu w u h u +WUKB w u k b +WUPG w u p g +WUPN w u p n +WUPZ w u p z +Wu's w u's +WUSW w u s w +WUTK w u t k +WUVC w u v c +wuv w u v +W. U. w u +Wuz w u z +WVa w v a +WVBX w v b x +WVCA w v c a +WVIT w v i t +WVJC w v j c +WVJP w v j p +WVLZ w v l z +WVNI w v n i +WVNY w v n y +W. V. O. w v o +WVO w v o +WVPA w v p a +WVPO w v p o +WVSSAC w v s s a c +WVSU w v s u +WVTU's w v t u's +WVTU w v t u +WVUE w v u e +WVU w v u +WVUW w v u w +W. V. w v +W.V. w v +WV w v +WWAA w w a a +WWAMI w w a m i +WWASP w w a s p +WWA w w a +WWAX w w a x +WWBZ w w b z +WWCD w w c d +WWC w w c +WWDB's w w d b's +WWDC w w d c +WWDR w w d r +WWD w w d +WWE's w w e's +Wwe w w e +WWE w w e +WWF's w w f's +WWF w w f +WWGC w w g c +WWHT w w h t +WWHW w w h w +WWIS w w i s +WWJP w w j p +WWKB w w k b +WWKL w w k l +WWML w w m l +WWMM w w m m +WWMX w w m x +WWMY w w m y +WWN w w n +WWNW w w n w +WWNY w w n y +WWOX w w o x +WWPG w w p g +WWP w w p +WWPW w w p w +WWRFC w w r f c +WWRV w w r v +WWSS w w s s +WWS w w s +WWTI's w w t i's +WWTI w w t i +WWTN w w t n +WWU w w u +WWVA w w v a +WWVR w w v r +WWV w w v +WWWF w w w f +WWWQ's w w w q's +W. W. w w +W.W. w w +WW w w +WWW w w w +WWWW w w w w +WWYD w w y d +WXB w x b +WXCN w x c n +WXDU w x d u +WXEL w x e l +WXIL w x i l +WXIN's w x i n's +WXIN w x i n +WXJM's w x j m's +WXJ w x j +WXN w x n +WXQW w x q w +WXTG w x t g +WXW w x w +wx w x +WX w x +W.Y. w y +WY w y +wyzc w y z c +WZBC w z b c +WZFG w z f g +WZFT w z f t +WZGC w z g c +WZJQ w z j q +WZKC w z k c +WZLR w z l r +WZLX w z l x +WZRB w z r b +WZRD w z r d +WZST w z s t +W. Z. w z +WZ w z +WZX w z x +WZZM w z z m +WZZX w z z x +xbg x b g +XBMC x b m c +XBM x b m +Xbra x b r a +XBRL x b r l +XBV x b v +XCB x c b +XCE x c e +XCMS x c m s +XCOM x c o m +XCOR x c o r +xCo x c o +XCR x c r +XCT x c t +XCVI x c v i +XCV x c v +X. C. x c +XC x c +XCX x c x +xda x d a +XDDM x d d m +XDH x d h +XDK x d k +XDRs x d r's +XDR x d r +XD's x d's +XDS x d s +X. D. x d +XD x d +Xfce x f c e +XFC x f c +XFDL x f d l +XFD x f d +XFL x f l +XFM x f m +XFS x f s +XFU x f u +xf x f +X.F. x f +XF x f +XHVFC x h v f c +xh x h +X. H. x h +XH x h +XJD x j d +XJ x j +XKE x k e +XKL x k l +xk x k +XK x k +XL x l +XMB x m b +xmc x m c +xml x m l +XML x m l +XMMS x m m s +XMPP x m p p +XMP x m p +XMRV x m r v +XMSN x m s n +XM's x m's +XMU x m u +X.M. x m +XM x m +XN x n +xO x o +X.O. x o +XO x o +XPA x p a +XPD x p d +XPe x p e +XPL x p l +XPN x p n +XP's x p's +XPS x p s +XPT x p t +XPW x p w +XP x p +X.Q. x q +XQ x q +XRCC x r c c +XRCO x r c o +XRDS x r d s +XRD x r d +XRE x r e +XR x r +XSD x s d +XSi x s i +XSI x s i +XSLT x s l t +xsr x s r +XS x s +XTB x t b +XTC x t c +XTG x t g +XTwas x t w a's +xt x t +XT x t +XVAS x v a +XV x v +XWA x w a +XWB x w b +XWF x w f +XWIS x w i s +X. W. x w +XYNU x y n u +XYP x y p +xy x y +XY x y +xyz x y z +xyZ x y z +XYZ x y z +XZ x z +Y. A. y a +Y.A. y a +YBA y b a +YBL y b l +YBNL y b n l +YBN y b n +YBR y b r +YBX y b x +Y. B. y b +Y.B. y b +YB y b +YBYS y b y s +YCC y c c +YCD y c d +ycia y c i a +ycie y c i e +YCL y c l +YCO y c o +YCU y c u +YCV y c v +yc y c +Y. C. y c +Y.C. y c +YC y c +YCYW y c y w +YDA y d a +Ydby y d b y +Yde y d e +YDG y d g +YdiB y d i b +YDK y d k +YDNC y d n c +yd y d +Y. D. y d +Y.D. y d +YD y d +Y.E. y e +YFCMD y f c m d +YFCs y f c's +YFCU y f c u +YFC y f c +yfle y f l e +YF&R y f and r +YF y f +YGB y g b +YGEX y g e x +YGLA y g l a +YGL y g l +YG's y g's +yg y g +Y. G. y g +Y.G. y g +YG y g +YHA y h a +YHWH y h w h +Y. H. y h +YH y h +YIF y i f +YIG y i g +YITP y i t p +Y. I. y i +Y.I. y i +YJO y j o +yj y j +Y. J. y j +YJ y j +Ykt y k t +Y. K. y k +Y.K. y k +YK y k +YKY y k y +Yle y l e +YLE y l e +YLF y l f +yl y l +Y. L. y l +YL y l +YMCA's y m c a's +Y.M.C.A. y m c a +YMCA y m c a +YMF y m f +Ymke y m k e +Y.M.M. y m m +YMM y m m +YMO y m o +ym y m +Y. M. y m +YM y m +yndi y n d i +Yndi y n d i +yne y n e +Yngve y n g v e +Ynis y n i's +YNK y n k +YNU y n u +yn y n +Yn y n +Y. N. y n +Y.N. y n +YN y n +Y.O. y o +YO y o +ypa y p a +YPC y p c +YPF y p f +YPG y p g +YPM y p m +YPO y p o +Y.P.P. y p p +YPP y p p +Y.P.S. y p s +YPT y p t +YPU y p u +Y.P. y p +YP y p +Y. Q. y q +YQ y q +yra y r a +Yra y r a +YRC y r c +YRF y r f +YRK y r k +YRM y r m +YRT y r t +Y&R y and r +YSK'da y s k d a +YSK'ya y s k y a +YSK y s k +YSL y s l +YSRCP y s r c p +YSR y s r +YSU's y s u's +YSU y s u +Ys y's +Y.S. y s +YS y s +YSY y s y +yta y t a +YTB y t b +Ytre y t r e +YTS y t s +YTV's y t v's +YTV y t v +Y&T y and t +Y. T. y t +Y.T. y t +YT y t +Y. V. y v +YWCA y w c a +YWC y w c +Y. W. y w +Y.Y. y y +Z. A. B. z a b +Z. A. z a +Z.A. z a +ZBC z b c +ZBS z b s +ZB z b +ZCE z c e +ZCGWM z c g w m +ZCMI z c m i +ZCTA z c t a +ZCY z c y +ZC z c +Zdar z d a r +zda z d a +ZDF z d f +ZDR z d r +Z.E.R.O. z e r o +ZFC z f c +ZFK z f k +ZFM z f m +ZFP z f p +ZFS z f s +ZFX z f x +ZF z f +ZGE z g e +ZGI z g i +zg z g +Z.G. z g +ZG z g +zh z h +Z. H. z h +Z.H. z h +ZH z h +zijn z i j n +zij z i j +Zij z i j +Z. I. z i +Z. J. z j +ZKK z k k +ZKM z k m +Z.K. z k +Z.L. z l +Z.M. z m +ZNA z n a +ZNF z n f +ZNK z n k +ZnO z n o +ZNW z n w +ZPAP z p a p +Zpav z p a v +ZPAV z p a v +ZPA z p a +ZPK z p k +Z.P. z p +ZP z p +ZQ z q +ZRC z r c +ZrI z r i +ZRK z r k +ZSC z s c +ZSE z s e +ZSF z s f +ZSG's z s g's +ZSIS z s i s +ZSL z s l +ZSO z s o +ZSSS z s s s +Zsuzsa z s u z s a +ZTE z t e +ZWYCI z w y c i +Z.W. z w +Z.X.V. z x v +Z.X. z x +ZYF z y f +Z. Y. z y +Z.Y. z y +Z. Z. z z +Z.Z. z z diff --git a/fun_text_processing/text_normalization/en/data/whitelist/ipa_symbols.tsv b/fun_text_processing/text_normalization/en/data/whitelist/ipa_symbols.tsv new file mode 100644 index 0000000..f5559c7 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/ipa_symbols.tsv @@ -0,0 +1,521 @@ +a +aoj +aəj +aː +aːʲ +aː͡j +aː͡ɨ̯ +aˤ +aˤː +a̠ +a̠ː +a̰ +a͡e +a͡i +a͡iː +a͡i̯ +a͡j +a͡o +a͡u +a͡uː +a͡u̯ +a͡w +a͡ə +a͡ɨ̯ +a͡ɪ +a͡ʊ +b +bʱ +bʲ +bː +b̥ +c +cʰ +cː +ç +d +dʲ +dː +d̥ +d̪ +d̪ʱ +d͡z +d͡zʷ +d͡zː +d͡ʑ +d͡ʒ +d͡ʒʱ +d͡ʒʲ +d͡ʒː +e +eː +eːʲ +eː͡j +ẽː +ẽ͡j̃ +e̞ +e̞ː +e̯ +e͡i +e͡iː +e͡ɨ̯ +f +fʲ +fː +h +hː +i +iəj +iəw +iʲ +iː +iːʲ +ĩː +i̥ +i̯ +i͡u +i͡ə +i͡ɛ +j +jː +j̃ +k +kʰ +kʰː +kʲ +kʲʼ +kʷ +kʷʼ +kʼ +kː +k̚ +k̚ʲ +k̟̚ +k͈ +k͡p̚ +l +lʲ +lː +l̥ +l̩ +m +mʲ +mʲː +mː +m̥ +m̩ +n +nʲ +nː +n̥ +n̩ +o +oʲ +oː +oːʲ +ò +õ͡j̃ +õ͡w̃ +o̝ +o̞ +o̞ː +o̯ +o̰ +o͡u +o͡uː +p +pʰ +pʰː +pʲ +pʷʼ +pʼ +pː +p̚ +p̚ʲ +p͈ +p͜f +p͡f +q +qʷ +qʼ +r +rʲ +rː +r̂ +r̂ː +r̥ +r̩ +s +sʰ +sʲ +sʼ +sː +s͈ +t +tʰ +tʰː +tʲ +tʷʼ +tʼ +tː +t̚ +t̪ +t̪ʰ +t͈ +t͜s +t͡s +t͡sʰ +t͡sʰː +t͡sʲ +t͡sʷ +t͡sʼ +t͡sː +t͡ɕ +t͡ɕʰ +t͡ɕ͈ +t͡ʂ +t͡ʂʼ +t͡ʃ +t͡ʃʰ +t͡ʃʰː +t͡ʃʲ +t͡ʃʷ +t͡ʃʼ +t͡ʃː +u +uəj +uʲ +uː +uːʲ +ũː +ũ͡j̃ +u̯ +u͡e +u͡i +u͡j +u͡ɔ +u͡ə +v +vʲ +vː +w +w̃ +x +xʷ +xː +y +yː +yːʲ +y̯ +z +zʲ +zː +z̥ +à +àː +á +áː +â +âː +ã +ã̠ +æ +æː +æ̀ +æ̀ː +æ̂ +æ̂ː +æ͡ɪ +æ͡ʉ +ç +è +èː +é +éː +ê +êː +ì +ìː +í +íː +î +îː +ï +ð +ò +òː +ó +óː +ô +ôː +õ +õː +õ̞ +ø +øː +øːʲ +ø̯ +ù +ùː +ú +úː +û +ûː +ā +āː +ē +ēː +ĕ +ĕ͡ə +ě +ěː +ħ +ĩ +ĩː +ī +īː +ŋ +ŋʲ +ŋ̊ +ŋ̍ +ŋ̟ +ŋ̩ +ŋ͡m +ō +ŏ +ŏ͡ə +œ +œː +œ̃ +œ͡i +œ͡iː +œ͡ʏ +ř +řː +ũ +ũː +ū +ūː +ŭ +ŭ͡ə +ǎ +ǎː +ǐ +ǐː +ǒ +ǒː +ǔ +ǔː +ǣ +ǣː +ɐ +ɐː +ɐ̃ +ɐ̃͡j̃ +ɐ̃͡w̃ +ɐ̯ +ɐ̯̯ +ɑ +ɑː +ɑ̃ +ɑ̃ː +ɒ +ɒʲ +ɒː +ɓ +ɔ +ɔː +ɔˤː +ɔ̀ +ɔ̀ː +ɔ́ +ɔ́ː +ɔ̃ +ɔ̃ː +ɔ̰ +ɔ͡i̯ +ɔ͡ə +ɔ͡ɨ̯ +ɔ͡ɪ +ɔ͡ʊ +ɕ +ɕʰ +ɕː +ɕ͈ +ɖ +ɖʱ +ɗ +ɘ +ɘː +ə +əː +əˤ +ə̀ +ə́ +ə̃ +ə̯ +ə͡u̯ +ə͡w +ə͡ɨ +ə͡ɨ̯ +ɚ +ɛ +ɛʲ +ɛː +ɛˤː +ɛ̀ +ɛ̀ː +ɛ́ +ɛ́ː +ɛ̂ +ɛ̂ː +ɛ̃ +ɛ̃ː +ɛ̄ +ɛ̄ː +ɛ̰ +ɛ͡i +ɛ͡i̯ +ɛ͡u +ɛ͡u̯ +ɛ͡ɪ +ɛ͡ʊ +ɜ +ɜː +ɝ +ɝː +ɟ +ɟː +ɟ͡ʝ +ɡ +ɡʱ +ɡʲ +ɡʷ +ɡː +ɡ̊ +ɣ +ɤ +ɥ +ɦ +ɨ +ɨəj +ɨː +ɨ̃ᵝ +ɨ̞ +ɨ̥ᵝ +ɨ̯ +ɨ͡u̯ +ɨ͡w +ɨ͡ə +ɨᵝ +ɨᵝː +ɪ +ɪː +ɪ̀ +ɪ́ +ɪ̃ +ɪ̯ +ɪ̰ +ɪ͡u̯ +ɪ͡ʊ +ɫ +ɫː +ɬ +ɬʼ +ɭ +ɮ +ɯ +ɯː +ɯ̟̃ᵝ +ɯ̟̊ᵝ +ɯ̟ᵝ +ɯ̟ᵝː +ɰ +ɰ̃ +ɰᵝ +ɱ +ɱ̩ +ɲ +ɲː +ɲ̊ +ɲ̟ +ɳ +ɴ +ɸ +ɸʷ +ɹ +ɻ +ɽ +ɽʱ +ɾ +ɾʲ +ɾː +ɾ̝̊ +ʀ +ʁ +ʁʷ +ʁː +ʂ +ʂʷ +ʃ +ʃʰ +ʃʲ +ʃʷ +ʃʷʼ +ʃʼ +ʃː +ʈ +ʈʰ +ʉ +ʉː +ʊ +ʊ̀ +ʊ́ +ʊ̃ +ʊ̯ +ʊ̯͡i +ʊ̯͡ɨ +ʊ̰ +ʋ +ʌ +ʌ̹ +ʍ +ʎ +ʏ +ʏː +ʏ̯ +ʐ +ʐʷ +ʑ +ʒ +ʒʲ +ʒʷ +ʒː +ʔ +ʔʲ +ʔʷ +ʝ +˦ˀ˥ +˦˥ +˦˧˥ +˦˩ +˧ˀ˨ +˧˦ +˧˧ +˧˨ +˧˩ +˨˩ +˨˩˦ +˨˩˨ +β +θ +χ +χʷ +χː +ḛ +ḭ +ṵ +ẽ +ẽː +ẽ̞ +‿ \ No newline at end of file diff --git a/fun_text_processing/text_normalization/en/data/whitelist/lj_speech.tsv b/fun_text_processing/text_normalization/en/data/whitelist/lj_speech.tsv new file mode 100644 index 0000000..a55a04b --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/lj_speech.tsv @@ -0,0 +1,21 @@ +Mr. mister +Mrs. misses +Dr. doctor +Drs. doctors +Co. company +Lt. lieutenant +Sgt. sergeant +St. saint +Jr. junior +Maj. major +Hon. honorable +Gov. governor +Capt. captain +Esq. esquire +Gen. general +Ltd. limited +Rev. reverend +Col. colonel +Mt. mount +Ft. fort +etc. et cetera diff --git a/fun_text_processing/text_normalization/en/data/whitelist/symbol.tsv b/fun_text_processing/text_normalization/en/data/whitelist/symbol.tsv new file mode 100644 index 0000000..6f2f8c6 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/symbol.tsv @@ -0,0 +1,23 @@ +& and +# hash +@ at +§ section +™ trademark +® registered trademark +© copyright +_ underscore +% percent sign +* asterisk ++ plus +/ slash += equal sign +^ circumflex +| vertical bar +~ tilde +$ dollar +£ pound +€ euro +₩ won +¥ yen +° degree +º degree diff --git a/fun_text_processing/text_normalization/en/data/whitelist/tts.tsv b/fun_text_processing/text_normalization/en/data/whitelist/tts.tsv new file mode 100644 index 0000000..e819247 --- /dev/null +++ b/fun_text_processing/text_normalization/en/data/whitelist/tts.tsv @@ -0,0 +1,3851 @@ +Ph.D. PHD +Hon. honorable +Mt. Mount +Maj. Major +Rev. Reverend +w/o without +a/c number account number +c/o care of +Gov. governor +vs. versus +vs versus +dept. department +prof. professor +est. estimated +vol volume +vol. volume +bldg. building +Bldg. Building +apt. apartment +Apt. Apartment +World War I World War one +World War II World War two +etc. etcetera. +SnO2 tin four oxide +dept department +HVAC H-vac +SPDR spider +ZIP zip +~ approximately +κ kappa +ω omega +α alpha +ν nu +δ delta +Δ delta +Α alpha +β beta +Β beta +χ chi +Χ chi +ε epsilon +Ε epsilon +φ phi +Φ phi +γ gamma +Γ gamma +η eta +Η eta +ι iota +Ι iota +κ kappa +Κ kappa +λ lambda +Λ lambda +μ mu +Μ mu +ν nu +Ν nu +ο omicron +Ο omicron +π pi +Π pi +θ theta +Θ theta +ρ rho +Ρ rho +σ sigma +Σ sigma +τ tau +Τ tau +υ upsilon +Υ upsilon +ω omega +Ω omega +ξ xi +Ξ xi +ψ psi +Ψ psi +ζ zeta +Ζ zeta +ltd limited +int'l international +A. D AD +A.D AD +a. d AD +a.d AD +a. d. AD +a.d. AD +B. C BC +B.C BC +b. c BC +b.c BC +A. D. AD +A.D. AD +B. C. BC +B.C. BC +b. c. BC +b.c. BC +A. A. a a +A.A. AA +A&A A and A +AAAs AAA's +AaB AAB +Aabo AABO +aac AAC +AACNo AACNO +AADTs AADT's +Aadu AADU +AAFld AAFLD +Aap AAP +A. B. AB +A.B. AB +Abhi ABHI +abl ABL +Abl ABL +Abp ABP +Abr ABR +abv ABV +Abz ABZ +A&C A and C +A. C. AC +A.C. AC +A/C AC +acac ACAC +Acad ACAD +ACC&S ACC and S +Achs ACH's +Acis ACI's +acls ACLS +ACMs ACM's +AcpA ACPA +AcpB ACPB +acq ACQ +A&CR A and CR +AcSOC ACSOC +acu ACU +AC&W AC and W +Acy ACY +A&D A and D +Adab ADAB +A. D. AD +A.D. AD +A.D.A.M. adam +AdaSL ADASL +AdC ADC +ADCs ADC's +AD&D AD and D +AdK ADK +Adl ADL +ADLs ADL's +adm ADM +Adm ADM +admn ADMN +ADNs ADN's +AdP ADP +ADRs ADR's +ADSRs ADSR's +ADSs ADS's +Adwa ADWA +A&E A and E +A. E. AE +A.E. AE +Aed AED +aegte AEGTE +Aeka AEKA +ael AEL +Aema AEMA +aen AEN +aere AERE +AEre AERE +AErn AERN +Aert AERT +Aes AE's +aet AET +Afa AFA +af AF +Af AF +A. F. AF +A.F. AF +Afaf AFAF +afc AFC +AFCSThe AFCSTHE +Afd AFD +AfD AFD +AfDB AFDB +Afe AFE +Aff AFF +Afi AFI +Afiq AFIQ +AFMs AFM's +AfNS AFNS +Afo AFO +Afr AFR +A. G. AG +A.G. AG +Agco AGCO +Agda AGDA +AG&G AG and G +agg AGG +Agi AGI +Agis AGI's +agli AGLI +Agn AGN +AgN AGN +AGNs AGN's +AGRs AGR's +Agsu AGSU +agt AGT +Agte AGTE +Agu AGU +A. H. AH +A.H. AH +Ahdhra AHDHRA +ahe AHE +Ahe AHE +Ahirs AHIR's +Ahk AHK +Ahsa'i AHSAI +Ahta AHTA +aht AHT +Ahu AHU +Ahva AHVA +A&I A and I +A. I. AI +A.I. AI +Aias AIA's +aici AICI +Aicme AICME +AICs AIC's +Aiel AIEL +Aife AIFE +AiG AIG +Aigis AIGI's +Aija AIJA +Aik AIK +AIs AI's +Aist AIST +Aitu AITU +Aiud AIUD +aius AIUS +A. J. AJ +A.J. AJ +Ajba AJBA +Ajmi AJMI +Ajok AJOK +Ajsa AJSA +Aju AJU +Akaa AKAA +a.k.a. AKA +aka. AKA +aka AKA +Aka. AKA +Aka AKA +A&K A and K +A. K. AK +A.K. AK +AKAPs AKAP's +akas AKA's +AKAs AKA's +akh AKH +Akpa AKPA +Aku AKU +A&L A and L +A. L. AL +A.L. AL +Alh ALH +ALUs ALU's +A'ma AMA +A&M A and M +a.m. AM +a.m AM +A. M. AM +A.M. AM +AMAs AMA's +amb AMB +Amb AMB +AmBX AMBX +AMCs AMC's +Amda AMDA +Amd AMD +AM&FM AM and FM +Amha AMHA +aml AML +Amli AMLI +Amlwch AMLWCH +Amm AMM +AM&O AM and O +Ampt AMPT +amr AMR +A&M's A and M's +Ams' AM's +amsl AMSL +Amta AMTA +amt AMT +Amt AMT +Amts AMT's +Amu AMU +A. N. AN +A.N. AN +andFHL ANDFHL +andPPP ANDPPP +Anej ANEJ +Angti ANGTI +Angu ANGU +Anhe ANHE +Anr ANR +Anrep ANREP +A&O A and O +A. O. AO +A.O. AO +AOCCs AOCC's +Aodh AODH +Aodla AODLA +Aogo AOGO +Aoke AOKE +Aoko AOKO +Aola AOLA +Aol AOL +Aone AONE +Aoni AONI +Aoos AOO's +aor AOR +AORs AOR's +aos AOS +AoS AOS +Aotus AOTU's +aov AOV +aovf AOVF +A&P A and P +A. P. AP +A.P. AP +Apc APC +APCh APCH +APCs APC's +apg APG +Aph APH +Apiao APIAO +Api API +APi API +Apic APIC +APICv APICV +Apl APL +Aplu APLU +Apphttp APPHTTP +Appl APPL +appr APPR +Appts APPT's +appu APPU +Appu APPU +A&P's A and P's +Aps AP's +APs AP's +AP&T AP and T +Aqa AQA +Aql AQL +Aqr AQR +A&R A and R +A. R. AR +A.R. AR +ArgR ARGR +ARGs ARG's +ArH ARH +ARMv ARMV +Arnd ARND +arv ARV +Arv ARV +Arwi ARWI +As'ad ASAD +Asai ASAI +Asao ASAO +A.s A's +A. S. AS +A.S. AS +Asasp ASASP +asbl ASBL +asci ASCI +Asci ASCI +Asdis ASDI's +Asfi ASFI +Asn ASN +Aso ASO +Aspe ASPE +Asr ASR +Assn ASSN +assoc ASSOC +Assoc ASSOC +ASSPs ASSP's +Asst ASST +Aste ASTE +Astt ASTT +Aswa ASWA +A&T A and T +atac ATAC +Atac ATAC +Atad ATAD +Ata's ATA's +Atas ATA's +A. T. AT +A.T. AT +ATBs ATB's +atc ATC +atcc ATCC +Atg ATG +ath ATH +Ath ATH +Atia's ATIA's +Ati ATI +ATi ATI +Atid ATID +Atiiq ATIIQ +Atil ATIL +Atiq ATIQ +Ativ ATIV +Atka ATKA +Atl ATL +Atli ATLI +atm ATM +Atm ATM +ATMs ATM's +Atos ATO's +ATOs ATO's +atpB ATPB +atri ATRI +Atri ATRI +A&T's A and T's +A.T.s AT's +AT&SF AT and SF +AT&T AT and T +attd ATTD +AT&T's AT and T's +atv ATV +ATVs ATV's +AtxA ATXA +A. U. AU +A.U. AU +Aub AUB +Aubl AUBL +AUVs AUV's +Auw AUW +avab AVAB +A. V. AV +A.V. AV +AVCs AVC's +avg AVG +Avn AVN +Avo AVO +AvP AVP +AVRs AVR's +Avs' AV's +Avs AV's +avvo AVVO +Awa AWA +AWAs AWA's +A. W. AW +A.W. AW +Awo AWO +Awwa AWWA +A. X. AX +A. Y. AY +A.Y. AY +A. Z. AZ +A.Z. AZ +Azg AZG +Azi AZI +azm AZM +AzTV AZTV +Baad BAAD +Ba'al BAAL +Baal BAAL +Baam BAAM +Baap BAAP +ba'as BAA's +Baat BAAT +Ba'ath BAATH +B. A. BA +B.A. BA +B&A B and A +Bac BAC +bae BAE +Bae BAE +BAe BAE +Bauw BAUW +B'Av BAV +B&B B and B +bb BB +B. B. BB +B.B. BB +bbc BBC +BB&CI BB and CI +BBC&PJR BBC and PJR +BBQ'er BBQER +B&Bs B and B's +BB&S BB and S +BBSes BBSE's +BB&T BB and T +BbvCI BBVCI +bc BC +B. C. BC +B.C. BC +Bcci BCCI +B.C.'s BC's +BCs BC's +BCSic BCSIC +BdA BDA +bd BD +B. D. BD +B.D. BD +Bde BDE +bds BDS +BdU BDU +B. E. BE +B.E. BE +Bedw BEDW +bef BEF +bei BEI +Bei BEI +Beih BEIH +Beis BEI's +bej BEJ +BEMs BEM's +Ber BER +Bes BE's +bf BF +B. F. BF +B.F. BF +BFFs BFF's +bfy BFY +B. G. BG +B.G. BG +BglII BGLII +bgs BGS +Bgy BGY +Bha BHA +B&H B and H +B. H. BH +B.H. BH +BH&E BH and E +Bhe BHE +BHMs BHM's +bhttp BHTTP +B. I. BI +B.I. BI +Bie BIE +biedt BIEDT +Biem BIEM +B.I.G.'s BIG's +BiH BIH +B. J. BJ +B.J. BJ +BJPs BJP's +B.J.'s BJ's +B&K B and K +B. K. BK +B.K. BK +BKCa BKCA +B. L. BL +B.L. BL +ble BLE +bleg BLEG +blev BLEV +bli BLI +Blla BLLA +BLR&D BLR and D +BLTs BLT's +B&M B and M +B. M. BM +B.M. BM +bmd BMD +bmi BMI +BMPs BMP's +BMRs BMR's +bmt BMT +B&N B and N +bnb BNB +B. N. BN +B.N. BN +Boac BOAC +B&O B and O +B. O. BO +B.O. BO +Boc BOC +BoC BOC +BOCs BOC's +boj BOJ +Boj BOJ +B&O's B and O's +bp BP +B. P. BP +B.P. BP +bpl BPL +B&Q B and Q +B. Q. BQ +Brbic BRBIC +B. R. BR +B.R. BR +BRBs BRB's +Brne BRNE +Brno BRNO +BRTs BRT's +Brza BRZA +brzu BRZU +brzy BRZY +Brzyk BRZYK +BsaL BSAL +B. s B's +B.'s B's +Bs B's +B. S. BS +B.S. BS +bsd BSD +bt BT +B. T. BT +B.T. BT +Btry BTRY +btsan BTSAN +btus BTUS +BTUs BTU's +B.U. BU +B. V. BV +B.V. BV +Bwa BWA +B&W B and W +B. W. BW +B.W. BW +BWTs BWT's +bwwtv BWWTV +Bxa BXA +Bxe BXE +B. Y. BY +byc BYC +bygd BYGD +Byk BYK +byn BYN +Byo BYO +Byou BYOU +Byrl BYRL +bySLC BYSLC +byt BYT +B.Z. BZ +bzhed BZHED +Bzik BZIK +Bzyb BZYB +Caat CAAT +C. A. CA +C.A. CA +C&A C and A +CA&CC CA and CC +Cadw CADW +caeca CAECA +Cae CAE +C.A.M.'s CAM's +Capt. captain +cas CAS +Cas CA's +Casc CASC +cb CB +C. B. CB +C.B. CB +cbc CBC +CB&CNS CB and CNS +CBDs CBD's +CBGBs CBGB's +CbiXS CBIXS +CB&Q CB and Q +CBs CB's +'c C +CcaA CCAA +cca CCA +Cca CCA +C&C C and C +C. C. CC +C.C. CC +ccd CCD +CCDev CCDEV +CCDs CCD's +CCEd CCED +CCi CCI +ccm CCM +CCRCs CCRC's +cct CCT +ccus CCUS +C&D C and D +cdc CDC +cd CD +C. D. CD +C.D. CD +CD&DR CD and DR +CDi CDI +cDNA CDNA +cdnas CDNAS +cDNAs CDNA's +CDOs CDO's +CDPs CDP's +CD&R CD and R +cds CDS +CDs CD's +CDSPCo CDSPCO +CdtA CDTA +CdTe CDTE +CDTi CDTI +CD&V CD and V +Cec CEC +c'e CE +ce CE +C'e CE +Ce CE +C. E. CE +C.E. CE +Ceel CEEL +Cefn CEFN +C&EI's C and EI's +C&EN C and EN +cen CEN +Cen CEN +ceo CEO +Ceol CEOL +Ceorl CEORL +Ceos CEO's +CEOs' CEO's +CEOs CEO's +cer CER +Cer CER +ces CES +Ces CE's +Cex CEX +CeX CEX +Cfa CFA +C&F C and F +cf CF +C. F. CF +C.F. CF +CFOs CFO's +CFTs CFT's +C&G C and G +C. G. CG +C.G. CG +cgl CGL +C&H C and H +C. H. CH +C.H. CH +Chhu CHHU +Chirs CHIR's +CHP'den CHPDEN +CHPs CHP's +Chy CHY +Cia CIA +ci CI +Ci CI +C. I. CI +C.I. CI +Cicic CICIC +cii CII +cim CIM +Cim CIM +Cio CIO +CIOs CIO's +Cip CIP +cis CIS +CIs CI's +cit CIT +CiTD CITD +citS CITS +CitX CITX +Ciuc CIUC +Ciu CIU +CiU CIU +Cixi CIXI +C. J. CJ +C.J. CJ +C. K. CK +C.K. CK +ckx CKX +CLBs CLB's +clc CLC +cl CL +C. L. CL +C.L. CL +Cle CLE +cllr CLLR +CL&N CL and N +Clo CLO +CL&P CL and P +CLs CL's +CLTs CLT's +Clu CLU +Clwyd CLWYD +C&MA C and MA +cm CM +C. M. CM +C.M. CM +CMCs CMC's +Cmde CMDE +cmdr CMDR +cml CML +CMMs CMM's +cmn CMN +Cmte CMTE +cn CN +C. N. CN +C.N. CN +CNMs CNM's +cnr CNR +CNs CN's +CNTs CNT's +Cnut's CNUT's +CNVs CNV's +C&O C and O +C. O. CO +C.O. CO +Co. company +Col. colonel +C&P C and P +cp CP +C. P. CP +C.P. CP +CPCs CPC's +cpo CPO +CPUs CPU's +cq CQ +CQDs CQD's +cr CR +C. R. CR +C.R. CR +Cre CRE +crk CRK +Crkva CRKVA +crkve CRKVE +CRLs CRL's +crm CRM +Crne CRNE +Crni CRNI +Crno CRNO +CRs CR's +csa CSA +Csa CSA +Csak CSAK +Csaky CSAKY +C&S C and S +cs CS +C.s C's +Cs C's +C. S. CS +C.S. CS +C&SF C and SF +csg CSG +CsI CSI +CSis CSI's +CSIs CSI's +CSOs CSO's +cspA CSPA +csp CSP +CSPs CSP's +CSSNCs CSSNC's +Csuz CSUZ +CTAs CTA's +C&T C and T +cte CTE +CTLs CTL's +ctr CTR +Ctrip CTRIP +ctv CTV +cu CU +C. U. CU +Cuyp CUYP +C&V C and V +cvcp CVCP +'cv CV +cv CV +C. V. CV +C.V. CV +CVEs CVE's +CVOs CVO's +CVs CV's +CVTs CVT's +C. W. CW +C.W. CW +Cwej CWEJ +Cwele CWELE +cwm CWM +cwrt CWRT +C.X. CX +C. Y. CY +C.Y. CY +cyl CYL +Cyn CYN +CyP CYP +Cyrl CYRL +Cys CY's +czci CZCI +cz CZ +C.Z. CZ +czy CZY +Daai DAAI +D. A. DA +D.A. DA +D&AD D and AD +D.A.N.C.E. dance +Dav DAV +dBa DBA +db DB +D. B. DB +D.B. DB +DCCs DCC's +D&C D and C +dc DC +D. C. DC +D.C. DC +DCom DCOM +D.C.'s DC's +DCs DC's +DCUs DCU's +D&D D and D +D. D. DD +D.D. DD +DDi DDI +Ddoc DDOC +Ddu DDU +Deah DEAH +D. E. DE +D.E. DE +deg DEG +dei DEI +Dei DEI +DeI DEI +Deijm DEIJM +Deip DEIP +dez DEZ +Dez DEZ +Dfa DFA +DFCs DFC's +D. F. DF +D.F. DF +DfE DFE +DfES DFES +DFPs DFP's +DFs DF's +dfx DFX +D&G D and G +D. G. DG +D.G. DG +Dha DHA +DHBs DHB's +D&H D and H +dh DH +D. H. DH +D.H. DH +d'HEC DHEC +dhe DHE +Dheku DHEKU +Dhod DHOD +dhol DHOL +Dhol DHOL +Dhoo DHOO +Dhor DHOR +Dhou DHOU +dhr DHR +DHSs DHS's +D.I. DI +diy DIY +DiY DIY +Diyn DIYN +DIYs DIY's +Djam DJAM +dj DJ +D. J. DJ +D.J. DJ +DJ'ed DJED +Djem DJEM +Dji DJI +Djo DJO +D'Jok DJOK +djr DJR +D.J.s DJ's +DJs DJ's +DjVu DJVU +DjVus DJVU's +D. K. DK +D.K. DK +dla DLA +dl DL +D. L. DL +D.L. DL +dlia DLIA +DL&LR DL and LR +DLLs DLL's +dlo DLO +DL&W DL and W +D.M.C.'s DMC's +D&M D and M +D. M. DM +D.M. DM +DMed DMED +DM&E DM and E +DMs DM's +DMUs DMU's +Dna DNA +DnA DNA +DnaJ DNAJ +D. N. DN +D.N. DN +Dnepr DNEPR +dnes DNES +Dnes DNE's +DNFs DNF's +DNSBLs DNSBL's +dns DNS +D.O.A.'s DOA's +dod DOD +Dod DOD +DoD DOD +D. O. DO +D.O. DO +D'oh DOH +dok DOK +Dok DOK +domt DOMT +Domt DOMT +Dop DOP +dotCMS DOTCMS +DotSVN DOTSVN +Douw DOUW +dozd DOZD +d'OZ DOZ +Dozhd DOZHD +dp DP +D. P. DP +D.P. DP +dpon DPON +DProf DPROF +DPs DP's +D.Q. DQ +drc DRC +Dr. doctor +D. R. DR +D.R. DR +dri DRI +Dri DRI +DRIs DRI's +Driu DRIU +Driv DRIV +Drnis DRNI's +Dro DRO +Drs. doctors +Drska DRSKA +druj DRUJ +DsbA DSBA +DS&BB DS and BB +dsDNA DSDNA +ds DS +Ds D's +D. S. DS +D.S. DS +DSGi DSGI +dsi DSI +DSi DSI +dsl DSL +DSMs DSM's +dsn DSN +D&SNGRR D and SNGRR +dsu' DSU +DTCs DTC's +DTDs DTD's +D. T. DT +D.T. DT +DT&E DT and E +DT&I DT and I +dtl DTL +DTs DT's +dty DTY +D.U. DU +dva DVA +Dva DVA +DVCs DVC's +dvd DVD +DVDs DVD's +dv DV +D. V. DV +D.V. DV +dve DVE +dvfb DVFB +dvi DVI +dvije DVIJE +Dvin DVIN +Dvir DVIR +Dwa DWA +D&W D and W +D. W. DW +D.W. DW +Dwedw DWEDW +Dwi DWI +dwr DWR +dwur DWUR +dxa DXA +dx DX +D.X. DX +DXers DXER's +Dydd DYDD +dy DY +Dy DY +D. Y. DY +dypl DYPL +dyr DYR +dz DZ +dzis DZIS +Dzog DZOG +Dzor DZOR +Dzus DZU's +E. A. EA +E.A. EA +EAMs EAM's +eas EAS +Eas EA's +Eav EAV +E. B. EB +E.B. EB +Ebn EBN +E&BR E and BR +Ebru EBRU +EBWs EBW's +ecc ECC +Eccl ECCL +ec EC +Ec EC +E. C. EC +E.C. EC +ece ECE +Ece ECE +Ecem ECEM +ecg ECG +ecma ECMA +ECNs ECN's +ECP&DA's ECP and DA's +eCRM ECRM +ect ECT +ECVs ECV's +edb EDB +E. D. ED +E.D. ED +Edh EDH +edhe EDHE +EDMs EDM's +Edmx EDMX +edn EDN +Edn EDN +eds EDS +Eds ED's +Edw EDW +Eeb EEB +E. E. EE +E.E. EE +Eef EEF +Eega EEGA +eene EENE +eep EEP +Ees EE's +eeuw EEUW +Eeuw EEUW +EEZs EEZ's +efc EFC +ef EF +Ef EF +E. F. EF +E.F. EF +eFS EFS +Efs EF's +Efu EFU +Egba EGBA +egfl EGFL +e.g. for example +e. g. for example +EG&G EG and G +Egi EGI +E&GR E and GR +egy EGY +Egyl EGYL +EHAs EHA's +E. H. EH +E.H. EH +ehf EHF +Ehttp EHTTP +EiCs EIC's +E. I. EI +E.I. EI +eIF EIF +Eitr EITR +EITs EIT's +EJBs EJB's +ej EJ +E. J. EJ +E.J. EJ +E. K. EK +E.K. EK +eki EKI +Ekma EKMA +Ekow EKOW +eks EKS +Eks EK's +E. L. EL +E.L. EL +ELTs ELT's +ELUs ELU's +Embd EMBD +eMC EMC +EMDs EMD's +Emea EMEA +E&M E and M +E. M. EM +E.M. EM +Emge EMGE +emra EMRA +E&NA E and NA +Enas ENA's +EnBW ENBW +EncFS ENCFS +Encyc ENCYC +E. N. EN +E.N. EN +Enes ENE's +engl ENGL +Engl ENGL +Engr ENGR +Eni ENI +enn ENN +Enn ENN +ens ENS +Ens EN's +Enso ENSO +ENTJs ENTJ's +EoD EOD +E. O. EO +E.O. EO +Eois EOI's +eok EOK +Eole EOLE +Eol EOL +Eolss EOLS's +Eom EOM +eop EOP +eoptta EOPTTA +Eora EORA +Eorl EORL +Eors EOR's +E&P E and P +Epe EPE +ep EP +Ep EP +E. P. EP +E.P. EP +Eph EPH +Ephs EPH's +epi EPI +Epi EPI +ePO EPO +epos' EPO's +epos EPOS +Epos EPO's +E.P.s EP's +eq EQ +Eq EQ +E. R. ER +E.R. ER +ERJs ERJ's +Eru ERU +Eruv ERUV +Erv ERV +ES3 ES three +Esa ESA +Esam ESAM +Esa's ESA's +Esat ESAT +ESCs ESC's +Esd ESD +E. S. ES +E.S. ES +esi ESI +espn ESPN +ESPNhttp ESPNHTTP +esq ESQ +Esq ESQ +Esq. esquire +Esraa ESRAA +Esra ESRA +Esref ESREF +Esri ESRI +estd ESTD +Estd ESTD +esu ESU +Esva ESVA +Etad ETAD +ETBs ETB's +E. T. ET +E.T. ET +ETFs ETF's +Et'hem ETHEM +Eti ETI +etj ETJ +Eto ETO +ets ETS +Ets ET's +ETs ET's +ett ETT +Ett ETT +Ettre ETTRE +Etts ETT's +Etz ETZ +EUBs EUB's +E. U. EU +E.U. EU +eup EUP +Eurwg EURWG +Euse EUSE +Eusi EUSI +EvaGT EVAGT +E. V. EV +E.V. EV +evl EVL +Evna EVNA +evnt EVNT +EVs EV's +evv EVV +Ewa's EWA's +E. W. EW +E.W. EW +Ewha EWHA +EWOs EWO's +Ewu EWU +excl EXCL +exd EXD +E.X. EX +exhb EXHB +exh EXH +Exptl EXPTL +exsul EXSUL +E&Y E and Y +E. Y. EY +Eyk EYK +eyu EYU +Ezaa EZAA +ez EZ +Ez EZ +Ezh EZH +Ezu EZU +Ezy EZY +Faaa FAAA +faa FAA +Faa FAA +faama FAAMA +FabH FABH +FabR FABR +F.A.B.'s FAB's +Fadl FADL +fa FA +Fa FA +F. A. FA +F.A. FA +Faf FAF +Fafhrd FAFHRD +fai FAI +Fai FAI +FAIPs FAIP's +Faiq FAIQ +fajn FAJN +Fal FAL +farw FARW +fasc FASC +Fasc FASC +fas FAS +Fas FA's +FAs FA's +FasL FASL +F. B. FB +F.B. FB +F.B.G.s FBG's +FBOs FBO's +fcb FCB +FCBs FCB's +F&C F and C +fc FC +F. C. FC +F.C. FC +F.C.'s FC's +FD&C FD and C +FDCPAs FDCPA's +F. D. FD +F.D. FD +FDICs FDIC's +FdI FDI +F. E. FE +F.E. FE +FEGs FEG's +Fes FE's +ffc FFC +ff FF +F. F. FF +F.F. FF +ffm FFM +FFs FF's +F. G. FG +F.G. FG +fgk FGK +FGs FG's +F. H. FH +F.H. FH +fhm FHM +fiadh FIADH +fia FIA +FiBL FIBL +Fi'd FID +F.I F +F&I F and I +F. I. FI +F.I. FI +Figl FIGL +fija FIJA +Fio FIO +FiO FIO +F. J. FJ +F.J. FJ +F. K. FK +F.K. FK +Fla FLA +Fles FLE's +fl FL +F. L. FL +F.L. FL +fli FLI +flyr FLYR +fm FM +F. M. FM +F.M. FM +fMRI FMRI +FMs FM's +F. N. FN +F.N. FN +F. O. FO +FPDs FPD's +fp FP +F. P. FP +F.P. FP +FPGAs FPGA's +FPM&SA FPM and SA +fps FPS +FPSs FPS's +F.Q. FQ +fr FR +F. R. FR +F.R. FR +frs FRS +Fru FRU +Frwydr FRWYDR +fsf FSF +fs FS +F. s F's +Fs F's +F. S. FS +F.S. FS +fsn FSN +FSSs FSS's +FTAs FTA's +Ft. Fort +F. T. FT +F.T. FT +ftp FTP +FtsA FTSA +Ftuh FTUH +F. V. FV +F.V. FV +F&W F and W +F. W. FW +F.W. FW +fwr FWR +fx FX +Fyb FYB +F.Y. FY +Fyn FYN +fyi FYI +fyr FYR +Fyw FYW +F.Z. FZ +Gaac GAAC +G. A. GA +G.A. GA +Gbe GBE +GbE GBE +G. B. GB +G.B. GB +GB&NDR GB and NDR +G&C G and C +G. C. GC +G.C. GC +GCSEs GCSE's +GC&SF GC and SF +Gdal GDAL +Gde GDE +gd GD +G. D. GD +G.D. GD +Gdow GDOW +GDPs GDP's +gdr GDR +Gebr GEBR +Gebt GEBT +Ged GED +ge GE +G. E. GE +G.E. GE +Gek GEK +Gen. general +geq GEQ +Geu GEU +Gev GEV +GeV GEV +Gfa GFA +GF&A GF and A +G. F. GF +G.F. GF +G. G. GG +G.G. GG +Ghe GHE +G. H. GH +G.H. GH +GHGs GHG's +Ghir GHIR +ghra GHRA +GH&SA GH and SA +Giei GIEI +G. I. GI +G.I. GI +G. J. GJ +G.J. GJ +G. K. GK +G.K. GK +Gla GLA +G&L G and L +G. L. GL +G.L. GL +gli GLI +Gli GLI +Glis GLI's +glnA GLNA +Glos GLO's +gma GMA +GmbH GMBH +Gmel GMEL +gm GM +G. M. GM +G.M. GM +gmin GMIN +GMOs GMO's +GMs GM's +gmt GMT +Gmul GMUL +gnb GNB +G. N. GN +G.N. GN +GNP&BR GNP and BR +gnp GNP +GNPs GNP's +G.O. GO +GPCRs GPCR's +GPdI GPDI +G&P G and P +gp GP +G. P. GP +G.P. GP +GpIIb GPIIB +GPMGs GPMG's +GPRs GPR's +GPUs GPU's +G. Q. GQ +grac GRAC +gra GRA +Gra GRA +Grbac GRBAC +GRBs GRB's +grc GRC +GRCs GRC's +gre GRE +Gre GRE +gr GR +G. R. GR +G.R. GR +grrl GRRL +Gryf GRYF +gry GRY +Gry GRY +grz GRZ +G&S G and S +Gs G's +G. S. GS +G.S. GS +GSIs GSI's +GSOp GSOP +GTAs GTA's +gt GT +G. T. GT +G.T. GT +GTi GTI +GTs GT's +G. U. GU +G.U. GU +GUIs GUI's +G. V. GV +G.V. GV +GvpA GVPA +GWe GWE +Gwet GWET +gw GW +G. W. GW +G.W. GW +Gwi GWI +gwr GWR +Gy GY +G. Y. GY +Gyn GYN +Gyps GYP's +gyu GYU +Gyu GYU +H. A. HA +H.A. HA +H&A H and A +HBCo HBCO +HBGAs HBGA's +H. B. HB +H.B. HB +H&BR H and BR +HCEs HCE's +H. C. HC +H.C. HC +hcl HCL +HClO HCLO +HCoV HCOV +HCPs HCP's +Hcy HCY +Hdad HDAD +hDAF HDAF +HDDs HDD's +hd HD +H. D. HD +H.D. HD +hdh HDH +HDi HDI +H. E. HE +H.E. HE +hezb HEZB +Hezb HEZB +H&F H and F +H. F. HF +H.F. HF +hgcA HGCA +hg HG +H. G. HG +H.G. HG +HgO HGO +HGPs HGP's +HgU HGU +HGVs HGV's +H&H H and H +H. H. HH +H.H. HH +H. I. HI +H.I. HI +Hizb HIZB +hja HJA +H. J. HJ +H.J. HJ +Hkam HKAM +H&K H and K +H. K. HK +H.K. HK +Hla HLA +H. L. HL +H.L. HL +Hluk HLUK +hlutr HLUTR +Hly HLY +Hman HMAN +H&M H and M +hm HM +H. M. HM +H.M. HM +HMOs HMO's +hMRE HMRE +H&M's H and M's +H. N. HN +H.N. HN +H. O. HO +H.O. HO +hpc HPC +hp HP +H. P. HP +H.P. HP +H.Q. HQ +H&R H and R +H. R. HR +H.R. HR +hroa HROA +HRo HRO +hrs HRS +HRs HR's +hscy HSCY +Hsee HSEE +hs HS +Hs H's +H. S. HS +H.S. HS +hsi HSI +hSlo HSLO +HSPs HSP's +HSTs HST's +hsv HSV +hTAS HTAS +HTAs HTA's +htc HTC +ht HT +H. T. HT +H.T. HT +hti HTI +Htin HTIN +Htoo HTOO +HtrA HTRA +HTRs HTR's +http HTTP +https HTTPS +Htwa HTWA +H. U. HU +HVCs HVC's +hvcv HVCV +hvem HVEM +Hvem HVEM +H. V. HV +H.V. HV +H. W. HW +H.W. HW +hwy HWY +Hwy HWY +hxt HXT +H. Y. HY +H.Y. HY +H. Z. HZ +HZ&PC HZ and PC +iaaf IAAF +IaaS IAAS +Iaca IACA +Iacob IACOB +IACTs IACT's +Iacub IACUB +iagt IAGT +I. A. IA +I.A. IA +Iapa IAPA +iar IAR +Iar IAR +IAUCs IAUC's +Iax IAX +Ibac IBAC +Ibaes IBAE's +IBCs IBC's +IBDA'A IBDAA +Ibda IBDA +ibdal IBDAL +I. B. IB +I.B. IB +Ibm IBM +Ibne IBNE +ibn IBN +Ibra IBRA +Ibsa IBSA +Ibs IB's +iBT IBT +Ibu IBU +iby IBY +ICBMs ICBM's +Icche ICCHE +icf ICF +I&C I and C +ic IC +Ic IC +I. C. IC +I.C. IC +Ici ICI +iCN ICN +Ico ICO +IcRn ICRN +ics ICS +ICs IC's +ICTs ICT's +ICTVdB ICTVDB +ICv ICV +iCyt ICYT +Iddaa IDDAA +Idd IDD +ID'd IDD +id ID +I. D. ID +I.D. ID +Idi IDI +Idir IDIR +IDLHs IDLH's +Idm IDM +IDPs IDP's +ids IDS +IDs ID's +IDx IDX +i.e. that is +Ifa IFA +ifc IFC +IfF IFF +Ifft IFFT +ifi IFI +Ifi IFI +IFIs IFI's +IfM IFM +Ifni IFNI +IFNs IFN's +Ifop IFOP +IFRSs IFRS's +Iga IGA +IgA IGA +IGFs IGF's +'ig IG +Ig IG +I.G. IG +igi IGI +IgM IGM +ign IGN +Ign IGN +Ih IH +I. H. IH +ihi IHI +ihm IHM +ihn IHN +Ihn IHN +Ihor IHOR +Iht IHT +IIb IIB +IIc IIC +IIfx IIFX +Iiga IIGA +IIga IIGA +IIgs IIG's +IIGs IIG's +IIIb IIIB +IIIBy IIIBY +IIIc IIIC +IIId IIID +I. I. II +I.I. II +ija IJA +Ija IJA +ij IJ +I. J. IJ +Ijok IJOK +Ijui IJUI +Ikh IKH +I.K. IK +IKr IKR +Iksa IKSA +Iku IKU +Ilbe ILBE +IL&FS IL and FS +ili ILI +Ili ILI +I. L. IL +I.L. IL +Ilm ILM +ilu ILU +Ilu ILU +IMbd IMBD +imc IMC +imdb IMDB +IMDb. IMDB +IMDb IMDB +ime IME +I&M I and M +I. M. IM +I.M. IM +Iml IML +Imm IMM +Imms' IMM's +imoa IMOA +impr IMPR +Impr IMPR +iMSNs IMSN's +Imst IMST +Inba INBA +inb INB +incl INCL +ind IND +Ind IND +Infs INF's +inHg INHG +I. N. IN +I.N. IN +InlB INLB +InP INP +Inre INRE +Inspx INSPX +Ints INT's +INTs INT's +Intu INTU +inv INV +Ioba IOBA +IODs IOD's +io. IO +io IO +.I.o. IO +Io. IO +Io IO +.IO IO +I/O IO +Ioka IOKA +Iok IOK +IoM IOM +IOPs IOP's +iOS IOS +Io's IO's +I/Os IO's +I.O.'s IO's +Iosu IOSU +IoT IOT +IoW IOW +IPCs IPC's +ip IP +Ip IP +I.P. IP +Ipo IPO +IPPs IPP's +Ippu IPPU +iPPV IPPV +iPSC IPSC +iPSCs IPSC's +ipse IPSE +iPS IPS +IPs IP's +IPv IPV +iQ IQ +I.Q. IQ +Irgm IRGM +Irig IRIG +Iril IRIL +i'r IR +ir IR +Ir IR +I. R. IR +I.R. IR +Irla IRLA +Irmis IRMI's +iro IRO +Iro IRO +Irra IRRA +IRs IR's +iru IRU +Iru IRU +ISAv ISAV +Isba ISBA +isbn ISBN +ISBNs ISBN's +isCf ISCF +iSC ISC +Isc ISC +Isd ISD +isdn ISDN +Isgec ISGEC +ishq ISHQ +Ishq ISHQ +I. S. IS +I.S. IS +Isl ISL +ISMNs ISMN's +ISPs ISP's +Isra'il ISRAIL +Isra ISRA +iss ISS +Iss IS's +ISSNs ISSN's +Isu ISU +Ite ITE +ITHs ITH's +iti ITI +Iti ITI +I.T. IT +itk ITK +Itk ITK +ITNNs ITNN's +Itoi ITOI +iTP ITP +Itse ITSE +itt ITT +Itu ITU +Itz ITZ +Iucn IUCN +IUDs IUD's +Iuz IUZ +I. V. IV +I.V. IV +IVs IV's +Ivu IVU +Iwas IWA's +Iwaz IWAZ +IWBs IWB's +iwi IWI +iw IW +I. W. IW +iwrg IWRG +iwspy IWSPY +Iwuh IWUH +IXb IXB +IXBs IXB's +IXCs IXC's +IXe IXE +iXL IXL +ixtle IXTLE +Iya IYA +Iyar IYAR +iyem IYEM +Iyi IYI +iy IY +I. Y. IY +I.Y. IY +Jaf JAF +J. A. JA +J&B J and B +jb JB +J. B. JB +J.B. JB +jcis JCIS +jc JC +J. C. JC +J.C. JC +JCRs JCR's +JdeBP JDEBP +jdi JDI +jd JD +J. D. JD +J.D. JD +jdk JDK +J&D's J and D's +J.D.s JD's +J. E. JE +J.E. JE +jf JF +J. F. JF +J.F. JF +J. G. JG +J.G. JG +jh JH +J. H. JH +J.H. JH +JHs JH's +JHSVs JHSV's +JHud JHUD +J. I. JI +J.I. JI +J&J J and J +J. J. JJ +J.J. JJ +Jka JKA +jkd JKD +J&K J and K +J. K. JK +J.K. JK +jkx JKX +J. L. JL +J.L. JL +J. M. JM +J.M. JM +jnb JNB +J. N. JN +J.N. JN +Jno JNO +jnr JNR +J. O. JO +J.O. JO +jpg JPG +J&P J and P +jp JP +J.P. JP +J.Q. JQ +J&R J and R +J. R. JR +J.R. JR +Jr. junior +jr. junior +Jr junior +jr junior +J.R.'s JR's +jsb JSB +Js J's +J. S. JS +J.S. JS +J&T J and T +J. T. JT +J.T. JT +JT&KW JT and KW +J. U. JU +J&V J and V +J. V. JV +J.V. JV +Jwa JWA +J. W. JW +J.W. JW +jx JX +J. Y. JY +J.Y. JY +Jym JYM +Jymn JYMN +J. Z. JZ +J.Z. JZ +K. A. KA +K.A. KA +kbi KBI +K&B K and B +K. B. KB +K.B. KB +K. C. KC +K.C. KC +K.C.'s KC's +kDa KDA +kdal KDAL +K&D K and D +kd KD +K. D. KD +K.D. KD +K. D.'s KD's +K.D.'s KD's +ke KE +Ke KE +K. E. KE +K.E. KE +kfc KFC +K.F. KF +kgr KGR +kgt KGT +KgU KGU +kgv KGV +Khizr KHIZR +K. H. KH +K.H. KH +Khlav KHLAV +Khmu KHMU +Khri KHRI +Khru KHRU +K. I. KI +K.I. KI +Kjer KJER +kj KJ +K. J. KJ +K.J. KJ +Kjop KJOP +KJo's KJO's +K. K. KK +K.K. KK +Kle KLE +kl KL +K. L. KL +K.L. KL +K&M K and M +km KM +K. M. KM +K.M. KM +K&N K and N +kn KN +K. N. KN +K.N. KN +k'o KO +K. O. KO +K.O. KO +KPIs KPI's +K&P K and P +K. P. KP +K.P. KP +Kppen KPPEN +kptm KPTM +krc KRC +KRCs KRC's +K.R.I.T.'s KRIT's +Krka KRKA +kr KR +K. R. KR +K.R. KR +Krne KRNE +kroz KROZ +Kroz KROZ +Kru KRU +ksa KSA +kset KSET +Kseur KSEUR +Ksevt KSEVT +ks KS +K. S. KS +K.S. KS +Ktav KTAV +KT&K KT and K +kt KT +K. T. KT +K.T. KT +Kuaa KUAA +Kud KUD +kuih KUIH +K. U. KU +K.U. KU +Kutb KUTB +Kvik KVIK +Kvit KVIT +K. V. KV +K.V. KV +Kvyat KVYAT +kwa KWA +kwe KWE +Kyse KYSE +kyt KYT +Kyt KYT +kz KZ +K. Z. KZ +L. A. LA +L.A.'s LA's +Lay's LAY's +LBi LBI +L. B. LB +L.B. LB +LBPs LBP's +LCAs LCA's +lcc LCC +LCCs LCC's +LC&DR LC and DR +LCDs LCD's +LCIs LCI's +L. C. LC +L.C. LC +lcn LCN +LCSs LCS's +LCTs LCT's +LCVPs LCVP's +Lda LDA +LDCs LDC's +L. D. LD +L.D. LD +L. E. LE +L.E. LE +LFFCs LFFC's +L. F. LF +L.F. LF +LFs LF's +LFSRs LFSR's +L. G. LG +L.G. LG +LGMs LGM's +LG&RDD LG and RDD +LGs LG's +LGUs LGU's +LGVs LGV's +Lha LHA +L. H. LH +L.H. LH +L. I. LI +L.I. LI +Lje LJE +L. J. LJ +L.J. LJ +L. K. LK +lks LKS +Llapi LLAPI +lle LLE +lli LLI +L&L L and L +L. L. LL +L.L. LL +llp LLP +llu LLU +LMGs LMG's +lm LM +L. M. LM +L.M. LM +LMPs LMP's +LMQs LMQ's +LnAIB LNAIB +L&N L and N +L. N. LN +L.N. LN +L.O.C.'s LOC's +Lokk LOKK +l'OL LOL +L. O. LO +L.O. LO +LPARs LPAR's +L&P L and P +lp LP +L. P. LP +L.P. LP +L&PM L and PM +LPMud LPMUD +LPs LP's +LPThe LPTHE +lr LR +L. R. LR +L.R. LR +LRTs LRT's +LRVs LRV's +LSDs LSD's +LSi LSI +ls LS +Ls L's +L. S. LS +L.S. LS +LSTs LST's +LSVCCs LSVCC's +Ltda LTDA +Ltd. limited +L&T L and T +Lt. lieutenant +lt LT +L. T. LT +L.T. LT +ltoh LTOH +L. U. LU +lv LV +L. V. LV +L.V. LV +L. W. LW +L.W. LW +L.Y. LY +L&YR L and YR +M. A. MA +M.A. MA +M&A M and A +Mbewu MBEWU +mbi MBI +M. B. MB +M.B. MB +mBo MBO +Mbre MBRE +mbr MBR +MCCs MCC's +M. C. MC +M.C. MC +MCs MC's +mcyG MCYG +mdb MDB +MDCs MDC's +mdDA MDDA +MD&DI MD and DI +Mde MDE +MDGs MDG's +MDHUs MDHU's +mDia MDIA +MDic MDIC +mdla MDLA +md MD +M. D. MD +M.D. MD +mdr MDR +M. E. ME +M.E. ME +MFDs MFD's +MFe MFE +M. F. MF +M.F. MF +MFTs MFT's +Mgadla MGADLA +Mgal MGAL +mga MGA +Mga MGA +Mgbo MGBO +MGen MGEN +M&G M and G +M. G. MG +M.G. MG +M&GN M and GN +M&GR's M and GR's +Mha MHA +MHCs MHC's +MH&L MH and L +M&H M and H +M. H. MH +M.H. MH +Mhor MHOR +Mhow MHOW +M.I.A.'s MIA's +M&I M and I +M. I. MI +M.I. MI +M&J M and J +M. J. MJ +M.J. MJ +M. K. MK +M.K. MK +MKs MK's +MLAs MLA's +mlc MLC +MLCs MLC's +mlg MLG +mli MLI +Mlle MLLE +M&L M and L +M. L. ML +M.L. ML +MLPs MLP's +MM&A MM and A +M&M M and M +M. M. MM +M.M. MM +M&M's M and M's +MNCs MNC's +M&NF M and NF +M. N. MN +M.N. MN +M.O.G.U.E.R.A.'s MOGUERA's +M. O. MO +M.O. MO +MpA MPA +MPAs MPA's +MPBu MPBU +MP&I MP and I +MPi MPI +MPLMs MPLM's +M&P M and P +M. P. MP +M.P. MP +MPPs MPP's +M.P.'s MP's +MPs MP's +MPThe MPTHE +Mpu MPU +M. Q. MQ +Mra MRA +MRBs MRB's +mre MRE +MR&LE MR and LE +Mr. mister +M. R. MR +M.R. MR +mRNA MRNA +mRNAs MRNA's +Mrs. misses +MRTs MRT's +msd MSD +Mse MSE +M&S M and S +Ms. miss +M. S. MS +M.S. MS +MSPs MSP's +mst MST +Mta MTA +MTAs MTA's +M&T M and T +M. T. MT +M.T. MT +Mtor MTOR +mtvU MTVU +MTVu MTVU +M. U. MU +M.U.s MU's +MVMs MVM's +M. V. MV +M.V. MV +MVPs MVP's +MVs MV's +MWe MWE +M. W. MW +M.W. MW +M. X. MX +myb MYB +myc MYC +Myc MYC +MyDD MYDD +M. Y. MY +M.Y. MY +MySQL MYSQL +M. Z. MZ +N. A. NA +N.A. NA +N.B.A.'s NBA's +NBAs NBA's +N. B. NB +N.B. NB +nbs NBS +NBTwo NBTWO +NCAAs NCAA's +NCCs NCC's +N. C. NC +N.C. NC +NCOs NCO's +N. D. ND +N.D. ND +N. E. NE +N.E. NE +ner NER +NFATc NFATC +nfed NFED +N. F. NF +N.F. NF +Nge NGE +N. G. NG +N.G. NG +NGOs NGO's +Nha NHA +NHCEs NHCE's +NHCs NHC's +nhi NHI +NHM&W NHM and W +N. H. NH +N.H. NH +NHPs NHP's +N. I. NI +N.I. NI +N'I NI +N. J. NJ +N.J. NJ +Njoo NJOO +N.J.'s NJ's +N. K. NK +N.K. NK +nkvd NKVD +nkv NKV +N. L. NL +N.L. NL +NLRs NLR's +N. M. NM +N.M. NM +N. N. NN +N.N. NN +NPCs NPC's +NPMs NPM's +N. P. NP +N.P. NP +NPs NP's +N. Q. NQ +nri NRI +Nri NRI +NRIs NRI's +NRJs NRJ's +nr NR +N. R. NR +N.R. NR +N. S. NS +N.S. NS +NSOs NSO's +Nta NTA +ntb NTB +N. T. NT +N.T. NT +ntw NTW +N.U. NU +NvDA's NVDA's +N. V. NV +N.V. NV +nwa NWA +N&W N and W +N. W. NW +N.W. NW +nyc NYC +N. Y. NY +N.Y. NY +N'Zif NZIF +NZiK NZIK +N'Zi NZI +N.Z. NZ +O. A. OA +O.A. OA +obl OBL +Oblt OBLT +O.B. OB +O. C. OC +O.C. OC +Octl OCTL +O. D. OD +O.E. OE +O.F. OF +ofr OFR +O&G O and G +O. G. OG +O.G. OG +O. H. OH +O.H. OH +O. I. OI +O.I. OI +O. J. OJ +O.J. OJ +OK'd OKD +OKd OKD +oke OKE +Oke OKE +O&K O and K +O. K. OK +O.K. OK +O. L. OL +O.L. OL +Olo OLO +Olov OLOV +ols OLS +OLs OL's +olvwm OLVWM +olwm OLWM +O&MFL O and MFL +omg OMG +OMGs OMG's +O. M. OM +O.M. OM +OmOm OMOM +Om's OM's +oncu ONCU +ond OND +onf ONF +O. N. ON +O.N. ON +O&O O and O +O. O. OO +O.O. OO +Oop OOP +oor OOR +oose OOSE +Oo's OO's +Ootw OOTW +OPMs OPM's +O. P. OP +O.P. OP +opr OPR +Opr OPR +ORFs ORF's +OR&N OR and N +O. R. OR +osaa OSAA +osa OSA +Osa OSA +OSBs OSB's +O. S. OS +O.S. OS +OSTs OST's +osv OSV +O.T. OT +OTs OT's +Otu OTU +otv OTV +O.U. OU +ovca OVCA +Ovca OVCA +Ovda OVDA +Ovo OVO +ov OV +Ov OV +O. V. OV +O.V. OV +OWCs OWC's +O. W. OW +O.W. OW +pa PA +P. A. PA +P.A. PA +pBCE PBCE +pbc PBC +pb PB +P. B. PB +P.B. PB +PCBs PCB's +PCDDs PCDD's +PCeU PCEU +PCIe PCIE +pci PCI +pcl PCL +PcoA PCOA +pc PC +P. C. PC +P.C. PC +PCRev PCREV +pcs PCS +P.C.s PC's +pDAB PDAB +PDAs PDA's +pdbp PDBP +PDBsum PDBSUM +PDCs PDC's +PD&D PD and D +PDEs PDE's +pdf PDF +PDFs PDF's +P&D P and D +P. D. PD +P.D. PD +PDPs PDP's +PDs PD's +P.E.I.'s PEI's +P. E. PE +P.E. PE +PFs PF's +PFW&C PFW and C +PGMs PGM's +PG&N PG and N +P&G P and G +P. G. PG +P.G. PG +Phlo PHLO +P&H P and H +P. H. PH +P.H. PH +php PHP +PHPs PHP's +P&I P and I +P. I. PI +P.I. PI +Piz PIZ +pj PJ +P. J. PJ +P.J. PJ +PJs PJ's +P. K. PK +P.K. PK +plc PLC +PLCs PLC's +P. L. PL +P.L. PL +PMMoV PMMOV +p.m. PM +p.m PM +P. M. PM +P.M. PM +PMs PM's +PNaCl PNACL +pna PNA +Pnau PNAU +pnb PNB +PNEs PNE's +PNETs PNET's +pneus PNEUS +png PNG +PNNs PNN's +PNoy PNOY +pn PN +P. N. PN +P.N. PN +P.O.D.'s POD's +P&O P and O +P. O. PO +P.O. PO +P.O.W.'s POW's +P&PH P and PH +PPi PPI +P. P. PP +P.P. PP +PPVs PPV's +PPy PPY +pr PR +P. R. PR +P.R. PR +P. s P's +P.'s P's +Ps P's +P. S. PS +P.S. PS +PSSAs PSSA's +pTA PTA +PTAs PTA's +Pte PTE +PTEs PTE's +ptf PTF +Ptie PTIE +PTLs PTL's +Ptol PTOL +pt PT +P. T. PT +P.T. PT +PTTs PTT's +P'Twa PTWA +Puiu PUIU +Pul PUL +PVAs PVA's +PvdA PVDA +pve PVE +P. V. PV +P.V. PV +pvr PVR +PVs PV's +pwll PWLL +P&W P and W +P. W. PW +P.W. PW +Pyi PYI +Pyk PYK +Pyl PYL +PyL PYL +P. Y. PY +Pyu PYU +Pyw PYW +Pyx PYX +P. Z. PZ +Q. A. QA +Q&A Q and A +Q&A's Q and A's +Q&As Q and A's +QbA QBA +Q.B. QB +Q.C. QC +Q. E. QE +Q.H. QH +Q.I. QI +Q. J. QJ +Q. N. QN +QPOs QPO's +Q.V. QV +R. A. RA +R.A. RA +R&A R and A +R&AW R and AW +RbAg RBAG +RBCs RBC's +RBIs RBI's +R&B R and B +R. B. RB +R.B. RB +rca RCA +R&C R and C +rc RC +R. C. RC +R.C. RC +RCTs RCT's +RdE RDE +R&D R and D +R. D. RD +R.D. RD +R.E.M.'s REM's +REPLs REPL's +R. E. RE +R.E. RE +R. F. RF +R.F. RF +R&G R and G +R. G. RG +R.G. RG +RHIBs RHIB's +Rhiw RHIW +rhl RHL +RhoG RHOG +Rho's RHO's +R. H. RH +R.H. RH +R&I R and I +R. I. RI +R.I. RI +riu RIU +Riu RIU +rivs RIVS +Rivu RIVU +Rixt RIXT +rjf RJF +R. J. RJ +R.J. RJ +R. K. RK +R.K. RK +R. L. RL +R.L. RL +rly RLY +RMDs RMD's +RMLs RML's +rm RM +R. M. RM +R.M. RM +RMSDs RMSD's +RMs RM's +rna RNA +RNAs RNA's +Rnet RNET +Rnic RNIC +RNNs RNN's +RNPs RNP's +R. N. RN +R.N. RN +rOmpB ROMPB +Rooi ROOI +R. O. RO +R.O. RO +ROVs ROV's +Roxb ROXB +Roxx ROXX +RP&C RP and C +rpc RPC +Rpe RPE +rpg RPG +RPGs RPG's +rpm RPM +R. P. RP +R.P. RP +RPs RP's +R. Q. RQ +R.Q. RQ +rra RRA +rrd RRD +Rreli RRELI +rre RRE +rRNA RRNA +rRNAs RRNA's +R&R R and R +rr RR +R. R. RR +R.R. RR +rsh RSH +Rsis RSI's +rsly RSLY +RsmA RSMA +RSpec RSPEC +rs RS +Rs R's +R. S. RS +R.S. RS +RSu RSU +rtb RTB +RTCs RTC's +RTEjr RTEJR +RTeOR RTEOR +RTOs RTO's +rtPA RTPA +rt RT +R. T. RT +R.T. RT +rts RTS +RTVFBiH RTVFBIH +Ruao RUAO +Rukn RUKN +Ruk RUK +Rupf RUPF +Rupr RUPR +rup RUP +Rup RUP +R. U. RU +R.U. RU +RutB RUTB +Ruu RUU +Ruwa RUWA +Ruy RUY +Ruyt RUYT +Rvat RVAT +Rvo RVO +R. V. RV +R.V. RV +rvs RVS +rwa RWA +Rwa RWA +rwb RWB +RWEs RWE's +rwjf RWJF +R. W. RW +R.W. RW +Rxa RXA +rz RZ +R. Z. RZ +Sa'id SAID +S. A. SA +S.A. SA +Saxl SAXL +Sa'yo SAYO +Sbai SBAI +sbc SBC +SBCs SBC's +sbk SBK +Sborz SBORZ +sb SB +S. B. SB +S.B. SB +Sbu SBU +scr SCR +SCRs SCR's +scry SCRY +sc SC +S. C. SC +S.C. SC +Scuf SCUF +Scymn SCYMN +SD&AE SD and AE +Sdei SDEI +sde SDE +Sde SDE +SDG&E SDG and E +sdk SDK +S. D. SD +S.D. SD +SDSM&T's SDSM and T's +Sejms SEJM's +sejr SEJR +Sekl SEKL +Sek SEK +S. E. SE +S.E. SE +ses SES +Ses SE's +SEs SE's +S.E.S.'s SES's +Seyh SEYH +sfadb SFADB +Sfax SFAX +SFFCo SFFCO +sfn SFN +'sf SF +sf SF +S. F. SF +S.F. SF +sfs SFS +S.F.'s SF's +SG&A SG and A +sgb SGB +Sgip SGIP +sgml SGML +sgra SGRA +S. G. SG +S.G. SG +SGSNs SGSN's +Sgt. sergeant +sgt SGT +S.H.I.E.L.D.'s SHIELD's +Shma SHMA +S. H. SH +S.H. SH +S. I. SI +S.I. SI +sjef SJEF +Sjon SJON +S. J. SJ +S.J. SJ +S. K. SK +S.K. SK +S.L.A.A.'s SLAA's +sla SLA +SLAs SLA's +S&L S and L +SLS&E SLS and E +S. L. SL +S.L. SL +SMe SME +SMEs SME's +SmI SMI +SMPSs SMPS's +smr SMR +S&M S and M +sm SM +S. M. SM +S.M. SM +S.M.'s SM's +SMs SMS +Smyl SMYL +SNESjr SNESJR +sngle SNGLE +SNPs SNP's +SnSe SNSE +S. N. SN +S.N. SN +S. O. SO +S.O. SO +Sos SO's +Sovn SOVN +Sov SOV +S&P 500 S and P five hundred +SPCAs SPCA's +Spe SPE +Spoa SPOA +SpPIn SPPIN +S&P S and P +S. P. SP +S.P. SP +SPs SP's +SPUs SPU's +sql SQL +sq SQ +S. Q. SQ +Sra SRA +SRAs SRA's +Srba SRBA +Srbi SRBI +SRBs SRB's +SRGs SRG's +Srhir SRHIR +SRLGs SRLG's +SRMs SRM's +Srni SRNI +srp SRP +sr SR +S. R. SR +S.R. SR +Srul SRUL +srx SRX +SSAs SSA's +SSDs SSD's +ssl SSL +SSoSV SSOSV +SSRIs SSRI's +S&S S and S +ss SS +S. s S's +Ss S's +S. S. SS +S.S. SS +Ssu SSU +ssw SSW +Ssy SSY +ST&AJ ST and AJ +STDs STD's +stfv STFV +STGs STG's +STIs STI's +STi STI +stl STL +Stryj STRYJ +S&T S and T +STScI STSCI +S. T. ST +S.T. ST +suo SUO +Suo SUO +S. U. SU +Susz SUSZ +SUTs SUT's +Suu SUU +SUVs SUV's +Suy SUY +Svac SVAC +svar SVAR +sve SVE +Sve SVE +SVMs SVM's +svn SVN +svom SVOM +sv SV +S. V. SV +S.V. SV +SVTs SVT's +Swe SWE +SwRI SWRI +S&W S and W +sw SW +S. W. SW +S.W. SW +sx SX +S.X. SX +SysML SYSML +SysRq SYSRQ +Sys SY's +SysV SYSV +S. Y. SY +S.Y. SY +SyT SYT +syv SYV +Syxx SYXX +Szasz SZASZ +Szer SZER +szkic SZKIC +Szklo SZKLO +Szlak SZLAK +SzMME SZMME +Szpir SZPIR +sz SZ +S. Z. SZ +Szu SZU +Szyk SZYK +taf TAF +Taf TAF +T. A. TA +T.A. TA +T&A T and A +TBCs TBC's +TBMs TBM's +tbh TBH +T. B. TB +T.B. TB +TCiAP TCIAP +TCKs TCK's +tc TC +T. C. TC +T.C. TC +TCUs TCU's +tcu TCU +tdb TDB +TDCi TDCI +TdIF TDIF +TDs TD's +T. D. TD +T.D. TD +Teatr TEATR +T. E. TE +T.E. TE +T&F T and F +tf TF +T. F. TF +T.F. TF +tge TGE +tgf TGF +tg TG +T. G. TG +T.G. TG +TGVs TGV's +tgv TGV +Thok THOK +ThSe THSE +T. H. TH +T.H. TH +T.I.'s TI's +T.I. TI +Tiu TIU +tiv TIV +Tiv TIV +Tiy's TIY's +T. J. TJ +T.J. TJ +t'ju TJU +tjz TJZ +tko TKO +Tko TKO +tk TK +T. K. TK +T.K. TK +Tlas TLA's +TlCu TLCU +TLDs TLD's +tli TLI +tlp TLP +TLRs TLR's +TLs TL's +tl TL +T. L. TL +T.L. TL +Tluk TLUK +Tluszcz TLUSZCZ +tmc TMC +TMGs TMG's +tmos TMOS +tmRNA TMRNA +TMSs TMS's +T.M.s TM's +tm TM +T. M. TM +T.M. TM +tna TNA +tnbc TNBC +TNTAs TNTA's +tn TN +T. N. TN +T.N. TN +T.O.'s TO's +T. O. TO +T.O. TO +tou TOU +Tou TOU +ToU TOU +tPA TPA +tpr TPR +tp TP +T. P. TP +T.P. TP +TPVs TPV's +T.Q. TQ +tra TRA +Tra TRA +Trbic TRBIC +Trcek TRCEK +TrkA TRKA +Trmcic TRMCIC +tRNA TRNA +TRPs TRP's +trs TRS +tr TR +T. R. TR +T.R. TR +truTV TRUTV +TruTV TRUTV +Trve TRVE +Tsa TSA +tsit TSIT +Tsiv TSIV +tso TSO +Tso TSO +tsr TSR +Ts T's +T. S. TS +T.S. TS +tsus TSUS +Tsvi TSVI +Tta TTA +tteok TTEOK +tte TTE +ttp TTP +T&T T and T +T. T. TT +T.T. TT +T'uqu TUQU +T.U. TU +Tuzk TUZK +tvaan TVAAN +Tvam TVAM +tva TVA +TVETs TVET's +TVii TVII +TVIn TVIN +TVi TVI +tvo TVO +Tvo TVO +TVRi TVRI +tvr TVR +TVSpy TVSPY +tvs TVS +TVs TV's +tVTA TVTA +tv TV +T. V. TV +T.V. TV +Twa TWA +Twi TWI +TWTs TWT's +T. W. TW +T.W. TW +TxDOT TXDOT +T.X. TX +tya TYA +Tyk TYK +Tza'ar TZAAR +Tze TZE +Tzrif TZRIF +Tzuh TZUH +Tzvi TZVI +Ua's UA's +UAs UA's +uat UAT +U.A. UA +UAVs UAV's +Uba UBA +UbcM UBCM +Ube UBE +ubi UBI +Ubi UBI +Ucar UCAR +Uca UCA +Ucmak UCMAK +Ucn UCN +uCs UC's +Uc UC +U.C. UC +Ucuncu UCUNCU +Uczta UCZTA +Uda UDA +Udit UDIT +Udny UDNY +UDTs UDT's +ud UD +Ud UD +U. D. UD +udu UDU +Udu UDU +Ueda's UEDA's +Uéda UE acute DA +U. E. UE +UFOs UFO's +Ufot UFOT +ufo UFO +Ufo UFO +U. F. UF +Uga UGA +Uge UGE +Ugni UGNI +Ugra UGRA +Ugrszke UGRSZKE +Ug UG +Uhha UHHA +uhn UHN +UHTCs UHTC's +Uhud UHUD +U.H. UH +uhur UHUR +Uiam UIAM +Uibh UIBH +Uible UIBLE +Uig UIG +uisae UISAE +UiS UIS +UiTM UITM +uit UIT +Uit UIT +Uiy UIY +Ujed UJED +Ujsag UJSAG +uj UJ +U.J. UJ +Uka UKA +Ukhra UKHRA +Ukic UKIC +Uki UKI +Ukoh UKOH +Uko UKO +ukr UKR +Ukr UKR +Ukui UKUI +u'k UK +uk UK +Uk UK +U.K. UK +Ukwu UKWU +Ulic ULIC +Ull ULL +Ulms ULM's +UlSU ULSU +Uluj ULUJ +U.L. UL +ulus ULUS +Ulus ULU's +Ulwa ULWA +Ulwe ULWE +Umbr UMBR +umelcu UMELCU +UMe UME +Umla UMLA +Umme UMME +Umno UMNO +Umri UMRI +U. M. UM +U.M. UM +Unli UNLI +Unlu UNLU +unm UNM +unnd UNND +UNSh UNSH +Unst UNST +Uns UN's +U.N.'s UN's +Unt UNT +U.N. UN +Unz UNZ +UOCl UOCL +UofM UOFM +Uoho UOHO +UoMs UOM's +uORF UORF +UoW UOW +UPBs UPB's +Upd UPD +Upf UPF +Upir UPIR +UPnP UPNP +Uppu UPPU +U.P. UP +UPyD UPYD +uq UQ +Urbz URBZ +URCs URC's +Urdd URDD +Urei UREI +urf URF +Urla URLA +URLhttp URLHTTP +URLs URL's +Usal USAL +usan USAN +Usan USAN +usao USAO +usata USATA +usa USA +.USA USA +USAya USAYA +USBs USB's +Uscie USCIE +U.S.C.'s USC's +USDoE USDOE +usd USD +USFbA USFBA +USF&WS USF and WS +UShs USH's +Usia USIA +usih USIH +Uslu USLU +Usmar USMAR +Usna USNA +Usnic USNIC +Usoi USOI +Usos USO's +Uso USO +USPs USP's +U.S.'s US's +Usti USTI +Ustka USTKA +Usui USUI +usum USUM +U. S. US +U.S. US +Usut USUT +Usvit USVIT +Uta's UTA's +uta UTA +Uta UTA +Utca UTCA +Utd's UTD's +Utd UTD +utea UTEA +Utes UTE's +Uth UTH +uti UTI +Uti UTI +Utne UTNE +Utnur UTNUR +Uto UTO +utrci UTRCI +utsav UTSAV +Utsav UTSAV +Utsu UTSU +U.T. UT +Utu UTU +Utva UTVA +Uuh UUH +Uul UUL +Uulu UULU +Uusi UUSI +UUs UU's +Uuto UUTO +Uvac UVAC +Uvea UVEA +uvnitr UVNITR +Uvo UVO +U.V. UV +Uwasa UWASA +UWFi UWFI +V. A. VA +V.A. VA +V&A V and A +Vav VAV +Vay VAY +vb VB +V. B. VB +V.B. VB +VCDs VCD's +VCRs VCR's +VCSELs VCSEL's +VCs VC's +VCTs VCT's +vc VC +V. C. VC +V.C. VC +vda VDA +Vda VDA +VDCs VDC's +vdiq VDIQ +vdm VDM +V. D. VD +V.D. VD +vez VEZ +Vez VEZ +vfp VFP +vfr VFR +V. F. VF +V.F. VF +V'Ger VGER +vgmdb VGMDB +VGo VGO +VGSCs VGSC's +VGSoM VGSOM +V. G. VG +V.G. VG +V. H. VH +V.I.C.'s VIC's +Vict VICT +viita VIITA +vijf VIJF +vij VIJ +Vij VIJ +V.I.P.s VIP's +VIPs VIP's +V. I. VI +V.I. VI +VJs VJ's +V. J. VJ +V.J. VJ +V. K. VK +V.K. VK +Vlah VLAH +VLCCs VLCC's +vlei VLEI +Vlijt VLIJT +V. L. VL +V.L. VL +VMAs VMA's +vm VM +V. M. VM +V.M. VM +vner VNER +V. N. VN +V.N. VN +V.O. VO +Vov VOV +Voz VOZ +vpis VPIS +VPNs VPN's +vpu VPU +V. P. VP +V.P. VP +vq VQ +vrak VRAK +Vrba VRBA +Vrbuv VRBUV +Vrej VREJ +vrem VREM +Vrin VRIN +vrj VRJ +vrn VRN +vroee VROEE +vrou VROU +vrouw VROUW +Vrouw VROUW +Vrsac VRSAC +Vrtis VRTI's +V&R V and R +vr VR +V. R. VR +V.R. VR +VSANs VSAN's +VSATs VSAT's +Vsekh VSEKH +vse VSE +vso VSO +VSPs VSP's +vs. versus +_vs._ versus +vsyo VSYO +VTE VT eL +Vtic VTIC +VTi VTI +V&T's V and T's +V&T V and T +V.T. VT +Vuur VUUR +VVIPs VVIP's +V. V. VV +V.V. VV +VWs VW's +Vyg VYG +vyr VYR +vy VY +vz VZ +V. Z. VZ +Waay WAAY +Wa'il WAIL +Wakf WAKF +wa'l WAL +waqf WAQF +waqt WAQT +Waqt WAQT +Wasl WASL +Watfa WATFA +wau WAU +Wau WAU +W. A. WA +W.A. WA +waw WAW +waza WAZA +Waza WAZA +WBs WB's +W. B. WB +W.B. WB +W&CBR W and CBR +wc WC +W. C. WC +W.C. WC +W. D. WD +W.D. WD +W. E. WE +W.E. WE +WF&NW WF and NW +W&F W and F +W. F. WF +W.F. WF +wga WGA +wgn WGN +wg WG +W. G. WG +W.G. WG +W&H W and H +W. H. WH +W.H. WH +Whyld WHYLD +Wica WICA +wici WICI +Wif WIF +Wijk WIJK +Wiwa WIWA +W. I. WI +wjaz WJAZ +W&J's W and J's +W&J W and J +W. J. WJ +W.J. WJ +W. K. WK +W.K. WK +W&LE W and LE +Wley WLEY +wlrs WLRS +W. L. WL +W.L. WL +wml WML +W&M W and M +W. M. WM +W.M. WM +W. N. WN +W.N. WN +wnzaa WNZAA +W&OD W and OD +Worh WORH +W. O. WO +W.O. WO +wpt WPT +wp WP +W. P. WP +W.P. WP +Wrec WREC +W. R. WR +W.R. WR +ws WS +W. S. WS +W.S. WS +WTs WT's +WTTs WTT's +W. T. WT +W.T. WT +WUAs WUA's +Wudl WUDL +Wuhr WUHR +Wuhu WUHU +Wu's WU's +wuv WUV +W. U. WU +Wuz WUZ +WVa WVA +W. V. WV +W.V. WV +Wwe WWE +W. W. WW +W.W. WW +wx WX +W.Y. WY +wyzc WYZC +W. Z. WZ +xbg XBG +Xbra XBRA +xCo XCO +X. C. XC +xda XDA +XDRs XDR's +X. D. XD +Xfce XFCE +xf XF +X.F. XF +xh XH +X. H. XH +xk XK +xmc XMC +xml XML +X.M. XM +xO XO +X.O. XO +XPe XPE +X.Q. XQ +XSi XSI +xsr XSR +XTwas XTWA's +xt XT +X. W. XW +xy XY +xyz XYZ +xyZ XYZ +Y. A. YA +Y.A. YA +Y. B. YB +Y.B. YB +ycia YCIA +ycie YCIE +yc YC +Y. C. YC +Y.C. YC +Ydby YDBY +Yde YDE +YdiB YDIB +yd YD +Y. D. YD +Y.D. YD +Y.E. YE +YFCs YFC's +yfle YFLE +YF&R YF and R +yg YG +Y. G. YG +Y.G. YG +Y. H. YH +Y. I. YI +Y.I. YI +yj YJ +Y. J. YJ +Ykt YKT +Y. K. YK +Y.K. YK +Yle YLE +yl YL +Y. L. YL +Ymke YMKE +ym YM +Y. M. YM +yndi YNDI +Yndi YNDI +yne YNE +Yngve YNGVE +Ynis YNI's +yn YN +Yn YN +Y. N. YN +Y.N. YN +Y.O. YO +ypa YPA +Y.P. YP +Y. Q. YQ +yra YRA +Yra YRA +Y&R Y and R +YSK'da YSKDA +YSK'ya YSKYA +Ys Y's +Y.S. YS +yta YTA +Ytre YTRE +Y&T Y and T +Y. T. YT +Y.T. YT +Y. V. YV +Y. W. YW +Y.Y. YY +Z. A. ZA +Z.A. ZA +Zdar ZDAR +zda ZDA +zg ZG +Z.G. ZG +zh ZH +Z. H. ZH +Z.H. ZH +zijn ZIJN +zij ZIJ +Zij ZIJ +Z. I. ZI +Z. J. ZJ +Z.K. ZK +Z.L. ZL +Z.M. ZM +ZnO ZNO +Zpav ZPAV +Z.P. ZP +ZrI ZRI +Zsuzsa ZSUZSA +Z.W. ZW +Z.X. ZX +Z. Y. ZY +Z.Y. ZY +Z. Z. ZZ +Z.Z. ZZ diff --git a/fun_text_processing/text_normalization/en/graph_utils.py b/fun_text_processing/text_normalization/en/graph_utils.py new file mode 100644 index 0000000..2cab9ee --- /dev/null +++ b/fun_text_processing/text_normalization/en/graph_utils.py @@ -0,0 +1,209 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from fun_text_processing.text_normalization.en.utils import get_abs_path +from pynini import Far +from pynini.examples import plurals +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +DAMO_CHAR = utf8.VALID_UTF8_CHAR + +DAMO_DIGIT = byte.DIGIT +DAMO_LOWER = pynini.union(*string.ascii_lowercase).optimize() +DAMO_UPPER = pynini.union(*string.ascii_uppercase).optimize() +DAMO_ALPHA = pynini.union(DAMO_LOWER, DAMO_UPPER).optimize() +DAMO_ALNUM = pynini.union(DAMO_DIGIT, DAMO_ALPHA).optimize() +DAMO_HEX = pynini.union(*string.hexdigits).optimize() +DAMO_NON_BREAKING_SPACE = "\u00A0" +DAMO_SPACE = " " +DAMO_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +DAMO_NOT_SPACE = pynini.difference(DAMO_CHAR, DAMO_WHITE_SPACE).optimize() +DAMO_NOT_QUOTE = pynini.difference(DAMO_CHAR, r'"').optimize() + +DAMO_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() +DAMO_GRAPH = pynini.union(DAMO_ALNUM, DAMO_PUNCT).optimize() + +DAMO_SIGMA = pynini.closure(DAMO_CHAR) + +delete_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE)) +delete_zero_or_one_space = pynutil.delete(pynini.closure(DAMO_WHITE_SPACE, 0, 1)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 1), " ") +delete_preserve_order = pynini.closure( + pynutil.delete(" preserve_order: true") + | (pynutil.delete(' field_order: "') + DAMO_NOT_QUOTE + pynutil.delete('"')) +) + +suppletive = pynini.string_file(get_abs_path("data/suppletive.tsv")) +# _v = pynini.union("a", "e", "i", "o", "u") +_c = pynini.union( + "b", + "c", + "d", + "f", + "g", + "h", + "j", + "k", + "l", + "m", + "n", + "p", + "q", + "r", + "s", + "t", + "v", + "w", + "x", + "y", + "z", +) +_ies = DAMO_SIGMA + _c + pynini.cross("y", "ies") +_es = DAMO_SIGMA + pynini.union("s", "sh", "ch", "x", "z") + pynutil.insert("es") +_s = DAMO_SIGMA + pynutil.insert("s") + +graph_plural = plurals._priority_union( + suppletive, + plurals._priority_union(_ies, plurals._priority_union(_es, _s, DAMO_SIGMA), DAMO_SIGMA), + DAMO_SIGMA, +).optimize() + +SINGULAR_TO_PLURAL = graph_plural +PLURAL_TO_SINGULAR = pynini.invert(graph_plural) +TO_LOWER = pynini.union( + *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)] +) +TO_UPPER = pynini.invert(TO_LOWER) +MIN_NEG_WEIGHT = -0.0001 +MIN_POS_WEIGHT = 0.0001 + + +def generator_main(file_name: str, graphs: Dict[str, "pynini.FstLike"]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +def get_plurals(fst): + """ + Given singular returns plurals + + Args: + fst: Fst + + Returns plurals to given singular forms + """ + return SINGULAR_TO_PLURAL @ fst + + +def get_singulars(fst): + """ + Given plural returns singulars + + Args: + fst: Fst + + Returns singulars to given plural forms + """ + return PLURAL_TO_SINGULAR @ fst + + +def convert_space(fst) -> "pynini.FstLike": + """ + Converts space to nonbreaking space. + Used only in tagger grammars for transducing token values within quotes, e.g. name: "hello kitty" + This is making transducer significantly slower, so only use when there could be potential spaces within quotes, otherwise leave it. + + Args: + fst: input fst + + Returns output fst where breaking spaces are converted to non breaking spaces + """ + return fst @ pynini.cdrewrite( + pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA + ) + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) diff --git a/fun_text_processing/text_normalization/en/taggers/__init__.py b/fun_text_processing/text_normalization/en/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/taggers/abbreviation.py b/fun_text_processing/text_normalization/en/taggers/abbreviation.py new file mode 100644 index 0000000..5748aa6 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/abbreviation.py @@ -0,0 +1,38 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_UPPER, GraphFst, insert_space +from pynini.lib import pynutil + + +class AbbreviationFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. "ABC" -> tokens { abbreviation { value: "A B C" } } + + Args: + whitelist: whitelist FST + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, whitelist: "pynini.FstLike", deterministic: bool = True): + super().__init__(name="abbreviation", kind="classify", deterministic=deterministic) + + dot = pynini.accep(".") + # A.B.C. -> A. B. C. + graph = DAMO_UPPER + dot + pynini.closure(insert_space + DAMO_UPPER + dot, 1) + # A.B.C. -> A.B.C. + graph |= DAMO_UPPER + dot + pynini.closure(DAMO_UPPER + dot, 1) + # ABC -> A B C + graph |= DAMO_UPPER + pynini.closure(insert_space + DAMO_UPPER, 1) + + # exclude words that are included in the whitelist + graph = pynini.compose( + pynini.difference( + pynini.project(graph, "input"), pynini.project(whitelist.graph, "input") + ), + graph, + ) + + graph = pynutil.insert('value: "') + graph.optimize() + pynutil.insert('"') + graph = self.add_tokens(graph) + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/cardinal.py b/fun_text_processing/text_normalization/en/taggers/cardinal.py new file mode 100644 index 0000000..0a3e1a4 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/cardinal.py @@ -0,0 +1,149 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + insert_space, +) +from fun_text_processing.text_normalization.en.taggers.date import get_four_digit_year_graph +from fun_text_processing.text_normalization.en.utils import get_abs_path +from pynini.examples import plurals +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals, e.g. + -23 -> cardinal { negative: "true" integer: "twenty three" } } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + + self.lm = lm + self.deterministic = deterministic + # TODO replace to have "oh" as a default for "0" + graph = pynini.Far(get_abs_path("data/number/cardinal_number_name.far")).get_fst() + self.graph_hundred_component_at_least_one_none_zero_digit = ( + pynini.closure(DAMO_DIGIT, 2, 3) | pynini.difference(DAMO_DIGIT, pynini.accep("0")) + ) @ graph + + graph_digit = pynini.string_file(get_abs_path("data/number/digit.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/number/zero.tsv")) + + single_digits_graph = pynini.invert(graph_digit | graph_zero) + self.single_digits_graph = single_digits_graph + pynini.closure( + insert_space + single_digits_graph + ) + + if not deterministic: + # for a single token allow only the same normalization + # "007" -> {"oh oh seven", "zero zero seven"} not {"oh zero seven"} + single_digits_graph_zero = pynini.invert(graph_digit | graph_zero) + single_digits_graph_oh = pynini.invert(graph_digit) | pynini.cross("0", "oh") + + self.single_digits_graph = single_digits_graph_zero + pynini.closure( + insert_space + single_digits_graph_zero + ) + self.single_digits_graph |= single_digits_graph_oh + pynini.closure( + insert_space + single_digits_graph_oh + ) + + single_digits_graph_with_commas = pynini.closure( + self.single_digits_graph + insert_space, 1, 3 + ) + pynini.closure( + pynutil.delete(",") + + single_digits_graph + + insert_space + + single_digits_graph + + insert_space + + single_digits_graph, + 1, + ) + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + + graph = ( + pynini.closure(DAMO_DIGIT, 1, 3) + + (pynini.closure(pynutil.delete(",") + DAMO_DIGIT**3) | pynini.closure(DAMO_DIGIT**3)) + ) @ graph + + self.graph = graph + self.graph_with_and = self.add_optional_and(graph) + + if deterministic: + long_numbers = pynini.compose( + DAMO_DIGIT ** (5, ...), self.single_digits_graph + ).optimize() + final_graph = plurals._priority_union( + long_numbers, self.graph_with_and, DAMO_SIGMA + ).optimize() + cardinal_with_leading_zeros = pynini.compose( + pynini.accep("0") + pynini.closure(DAMO_DIGIT), self.single_digits_graph + ) + final_graph |= cardinal_with_leading_zeros + else: + leading_zeros = pynini.compose( + pynini.closure(pynini.accep("0"), 1), self.single_digits_graph + ) + cardinal_with_leading_zeros = ( + leading_zeros + + pynutil.insert(" ") + + pynini.compose(pynini.closure(DAMO_DIGIT), self.graph_with_and) + ) + + # add small weight to non-default graphs to make sure the deterministic option is listed first + final_graph = ( + self.graph_with_and + | pynutil.add_weight(self.single_digits_graph, 0.0001) + | get_four_digit_year_graph() # allows e.g. 4567 be pronouced as forty five sixty seven + | pynutil.add_weight(single_digits_graph_with_commas, 0.0001) + | cardinal_with_leading_zeros + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + final_graph + pynutil.insert('"') + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() + + def add_optional_and(self, graph): + graph_with_and = graph + + if not self.lm: + graph_with_and = pynutil.add_weight(graph, 0.00001) + not_quote = pynini.closure(DAMO_NOT_QUOTE) + no_thousand_million = pynini.difference( + not_quote, not_quote + pynini.union("thousand", "million") + not_quote + ).optimize() + integer = ( + not_quote + + pynutil.add_weight( + pynini.cross("hundred ", "hundred and ") + no_thousand_million, -0.0001 + ) + ).optimize() + + no_hundred = pynini.difference( + DAMO_SIGMA, not_quote + pynini.accep("hundred") + not_quote + ).optimize() + integer |= ( + not_quote + + pynutil.add_weight( + pynini.cross("thousand ", "thousand and ") + no_hundred, -0.0001 + ) + ).optimize() + + optional_hundred = pynini.compose((DAMO_DIGIT - "0") ** 3, graph).optimize() + optional_hundred = pynini.compose( + optional_hundred, DAMO_SIGMA + pynini.cross(" hundred", "") + DAMO_SIGMA + ) + graph_with_and |= pynini.compose(graph, integer).optimize() + graph_with_and |= optional_hundred + return graph_with_and diff --git a/fun_text_processing/text_normalization/en/taggers/date.py b/fun_text_processing/text_normalization/en/taggers/date.py new file mode 100644 index 0000000..b5acfab --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/date.py @@ -0,0 +1,384 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + DAMO_LOWER, + DAMO_SIGMA, + TO_LOWER, + GraphFst, + delete_extra_space, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.en.utils import ( + augment_labels_with_punct_at_end, + get_abs_path, + load_labels, +) +from pynini.examples import plurals +from pynini.lib import pynutil + +graph_teen = pynini.invert(pynini.string_file(get_abs_path("data/number/teen.tsv"))).optimize() +graph_digit = pynini.invert(pynini.string_file(get_abs_path("data/number/digit.tsv"))).optimize() +ties_graph = pynini.invert(pynini.string_file(get_abs_path("data/number/ty.tsv"))).optimize() +year_suffix = load_labels(get_abs_path("data/date/year_suffix.tsv")) +year_suffix.extend(augment_labels_with_punct_at_end(year_suffix)) +year_suffix = pynini.string_map(year_suffix).optimize() + + +def get_ties_graph(deterministic: bool = True): + """ + Returns two digit transducer, e.g. + 03 -> o three + 12 -> thirteen + 20 -> twenty + """ + graph = graph_teen | ties_graph + pynutil.delete("0") | ties_graph + insert_space + graph_digit + + if deterministic: + graph = graph | pynini.cross("0", "oh") + insert_space + graph_digit + else: + graph = ( + graph + | (pynini.cross("0", "oh") | pynini.cross("0", "zero")) + insert_space + graph_digit + ) + + return graph.optimize() + + +def get_four_digit_year_graph(deterministic: bool = True): + """ + Returns a four digit transducer which is combination of ties/teen or digits + (using hundred instead of thousand format), e.g. + 1219 -> twelve nineteen + 3900 -> thirty nine hundred + """ + graph_ties = get_ties_graph(deterministic) + + graph_with_s = ( + (graph_ties + insert_space + graph_ties) + | (graph_teen + insert_space + (ties_graph | pynini.cross("1", "ten"))) + ) + pynutil.delete("0s") + + graph_with_s |= ( + (graph_teen | graph_ties) + + insert_space + + pynini.cross("00", "hundred") + + pynutil.delete("s") + ) + graph_with_s = graph_with_s @ pynini.cdrewrite( + pynini.cross("y", "ies") | pynutil.insert("s"), "", "[EOS]", DAMO_SIGMA + ) + + graph = graph_ties + insert_space + graph_ties + graph |= (graph_teen | graph_ties) + insert_space + pynini.cross("00", "hundred") + + thousand_graph = ( + graph_digit + + insert_space + + pynini.cross("00", "thousand") + + (pynutil.delete("0") | insert_space + graph_digit) + ) + thousand_graph |= ( + graph_digit + + insert_space + + pynini.cross("000", "thousand") + + pynini.closure(pynutil.delete(" "), 0, 1) + + pynini.accep("s") + ) + + graph |= graph_with_s + if deterministic: + graph = plurals._priority_union(thousand_graph, graph, DAMO_SIGMA) + else: + graph |= thousand_graph + + return graph.optimize() + + +def _get_two_digit_year_with_s_graph(): + # to handle '70s -> seventies + graph = ( + pynini.closure(pynutil.delete("'"), 0, 1) + + pynini.compose( + ties_graph + pynutil.delete("0s"), + pynini.cdrewrite(pynini.cross("y", "ies"), "", "[EOS]", DAMO_SIGMA), + ) + ).optimize() + return graph + + +def _get_year_graph(cardinal_graph, deterministic: bool = True): + """ + Transducer for year, only from 1000 - 2999 e.g. + 1290 -> twelve nineteen + 2000 - 2009 will be verbalized as two thousand. + + Transducer for 3 digit year, e.g. 123-> one twenty three + + Transducer for year with suffix + 123 A.D., 4200 B.C + """ + graph = get_four_digit_year_graph(deterministic) + graph = ( + pynini.union("1", "2") + + (DAMO_DIGIT**3) + + pynini.closure(pynini.cross(" s", "s") | "s", 0, 1) + ) @ graph + + graph |= _get_two_digit_year_with_s_graph() + + three_digit_year = ( + (DAMO_DIGIT @ cardinal_graph) + insert_space + (DAMO_DIGIT**2) @ cardinal_graph + ) + year_with_suffix = ( + (get_four_digit_year_graph(deterministic=True) | three_digit_year) + + delete_space + + insert_space + + year_suffix + ) + graph |= year_with_suffix + return graph.optimize() + + +def _get_two_digit_year(cardinal_graph, single_digits_graph): + wo_digit_year = DAMO_DIGIT ** (2) @ plurals._priority_union( + cardinal_graph, single_digits_graph, DAMO_SIGMA + ) + return wo_digit_year + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, e.g. + jan. 5, 2012 -> date { month: "january" day: "five" year: "twenty twelve" preserve_order: true } + jan. 5 -> date { month: "january" day: "five" preserve_order: true } + 5 january 2012 -> date { day: "five" month: "january" year: "twenty twelve" preserve_order: true } + 2012-01-05 -> date { year: "twenty twelve" month: "january" day: "five" } + 2012.01.05 -> date { year: "twenty twelve" month: "january" day: "five" } + 2012/01/05 -> date { year: "twenty twelve" month: "january" day: "five" } + 2012 -> date { year: "twenty twelve" } + + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool, lm: bool = False): + super().__init__(name="date", kind="classify", deterministic=deterministic) + + # january + month_graph = pynini.string_file(get_abs_path("data/date/month_name.tsv")).optimize() + # January, JANUARY + month_graph |= pynini.compose( + TO_LOWER + pynini.closure(DAMO_CHAR), month_graph + ) | pynini.compose(TO_LOWER ** (2, ...), month_graph) + + # jan + month_abbr_graph = pynini.string_file(get_abs_path("data/date/month_abbr.tsv")).optimize() + # jan, Jan, JAN + month_abbr_graph = ( + month_abbr_graph + | pynini.compose(TO_LOWER + pynini.closure(DAMO_LOWER, 1), month_abbr_graph).optimize() + | pynini.compose(TO_LOWER ** (2, ...), month_abbr_graph).optimize() + ) + pynini.closure(pynutil.delete("."), 0, 1) + month_graph |= month_abbr_graph.optimize() + + month_numbers_labels = pynini.string_file( + get_abs_path("data/date/month_number.tsv") + ).optimize() + cardinal_graph = cardinal.graph_hundred_component_at_least_one_none_zero_digit + + year_graph = _get_year_graph(cardinal_graph=cardinal_graph, deterministic=deterministic) + + # three_digit_year = (DAMO_DIGIT @ cardinal_graph) + insert_space + (DAMO_DIGIT ** 2) @ cardinal_graph + # year_graph |= three_digit_year + + month_graph = pynutil.insert('month: "') + month_graph + pynutil.insert('"') + month_numbers_graph = ( + pynutil.insert('month: "') + month_numbers_labels + pynutil.insert('"') + ) + + endings = ["rd", "th", "st", "nd"] + endings += [x.upper() for x in endings] + endings = pynini.union(*endings) + + day_graph = ( + pynutil.insert('day: "') + + pynini.closure(pynutil.delete("the "), 0, 1) + + ( + ( + (pynini.union("1", "2") + DAMO_DIGIT) + | DAMO_DIGIT + | (pynini.accep("3") + pynini.union("0", "1")) + ) + + pynini.closure(pynutil.delete(endings), 0, 1) + ) + @ cardinal_graph + + pynutil.insert('"') + ) + + two_digit_year = _get_two_digit_year( + cardinal_graph=cardinal_graph, single_digits_graph=cardinal.single_digits_graph + ) + two_digit_year = pynutil.insert('year: "') + two_digit_year + pynutil.insert('"') + + # if lm: + # two_digit_year = pynini.compose(pynini.difference(DAMO_DIGIT, "0") + DAMO_DIGIT ** (3), two_digit_year) + # year_graph = pynini.compose(pynini.difference(DAMO_DIGIT, "0") + DAMO_DIGIT ** (2), year_graph) + # year_graph |= pynini.compose(pynini.difference(DAMO_DIGIT, "0") + DAMO_DIGIT ** (4, ...), year_graph) + + graph_year = ( + pynutil.insert(' year: "') + pynutil.delete(" ") + year_graph + pynutil.insert('"') + ) + graph_year |= ( + pynutil.insert(' year: "') + + pynini.accep(",") + + pynini.closure(pynini.accep(" "), 0, 1) + + year_graph + + pynutil.insert('"') + ) + optional_graph_year = pynini.closure(graph_year, 0, 1) + + year_graph = pynutil.insert('year: "') + year_graph + pynutil.insert('"') + + graph_mdy = month_graph + ( + (delete_extra_space + day_graph) + | (pynini.accep(" ") + day_graph) + | graph_year + | (delete_extra_space + day_graph + graph_year) + ) + + graph_mdy |= ( + month_graph + + pynini.cross("-", " ") + + day_graph + + pynini.closure(((pynini.cross("-", " ") + DAMO_SIGMA) @ graph_year), 0, 1) + ) + + for x in ["-", "/", "."]: + delete_sep = pynutil.delete(x) + graph_mdy |= ( + month_numbers_graph + + delete_sep + + insert_space + + pynini.closure(pynutil.delete("0"), 0, 1) + + day_graph + + delete_sep + + insert_space + + (year_graph | two_digit_year) + ) + + graph_dmy = day_graph + delete_extra_space + month_graph + optional_graph_year + day_ex_month = (DAMO_DIGIT**2 - pynini.project(month_numbers_graph, "input")) @ day_graph + for x in ["-", "/", "."]: + delete_sep = pynutil.delete(x) + graph_dmy |= ( + day_ex_month + + delete_sep + + insert_space + + month_numbers_graph + + delete_sep + + insert_space + + (year_graph | two_digit_year) + ) + + graph_ymd = pynini.accep("") + for x in ["-", "/", "."]: + delete_sep = pynutil.delete(x) + graph_ymd |= ( + (year_graph | two_digit_year) + + delete_sep + + insert_space + + month_numbers_graph + + delete_sep + + insert_space + + pynini.closure(pynutil.delete("0"), 0, 1) + + day_graph + ) + + final_graph = graph_mdy | graph_dmy + + if not deterministic or lm: + final_graph += pynini.closure(pynutil.insert(" preserve_order: true"), 0, 1) + m_sep_d = ( + month_numbers_graph + + pynutil.delete(pynini.union("-", "/")) + + insert_space + + pynini.closure(pynutil.delete("0"), 0, 1) + + day_graph + ) + final_graph |= m_sep_d + else: + final_graph += pynutil.insert(" preserve_order: true") + + final_graph |= graph_ymd | year_graph + + if not deterministic or lm: + ymd_to_mdy_graph = None + ymd_to_dmy_graph = None + mdy_to_dmy_graph = None + md_to_dm_graph = None + + for month in [x[0] for x in load_labels(get_abs_path("data/date/month_name.tsv"))]: + for day in [x[0] for x in load_labels(get_abs_path("data/date/day.tsv"))]: + ymd_to_mdy_curr = ( + pynutil.insert('month: "' + month + '" day: "' + day + '" ') + + pynini.accep("year:") + + DAMO_SIGMA + + pynutil.delete(' month: "' + month + '" day: "' + day + '"') + ) + + # YY-MM-DD -> MM-DD-YY + ymd_to_mdy_curr = pynini.compose(graph_ymd, ymd_to_mdy_curr) + ymd_to_mdy_graph = ( + ymd_to_mdy_curr + if ymd_to_mdy_graph is None + else pynini.union(ymd_to_mdy_curr, ymd_to_mdy_graph) + ) + + ymd_to_dmy_curr = ( + pynutil.insert('day: "' + day + '" month: "' + month + '" ') + + pynini.accep("year:") + + DAMO_SIGMA + + pynutil.delete(' month: "' + month + '" day: "' + day + '"') + ) + + # YY-MM-DD -> MM-DD-YY + ymd_to_dmy_curr = pynini.compose(graph_ymd, ymd_to_dmy_curr).optimize() + ymd_to_dmy_graph = ( + ymd_to_dmy_curr + if ymd_to_dmy_graph is None + else pynini.union(ymd_to_dmy_curr, ymd_to_dmy_graph) + ) + + mdy_to_dmy_curr = ( + pynutil.insert('day: "' + day + '" month: "' + month + '" ') + + pynutil.delete('month: "' + month + '" day: "' + day + '" ') + + pynini.accep("year:") + + DAMO_SIGMA + ).optimize() + # MM-DD-YY -> verbalize as MM-DD-YY (February fourth 1991) or DD-MM-YY (the fourth of February 1991) + mdy_to_dmy_curr = pynini.compose(graph_mdy, mdy_to_dmy_curr).optimize() + mdy_to_dmy_graph = ( + mdy_to_dmy_curr + if mdy_to_dmy_graph is None + else pynini.union(mdy_to_dmy_curr, mdy_to_dmy_graph).optimize() + ).optimize() + + md_to_dm_curr = pynutil.insert( + 'day: "' + day + '" month: "' + month + '"' + ) + pynutil.delete('month: "' + month + '" day: "' + day + '"') + md_to_dm_curr = pynini.compose(m_sep_d, md_to_dm_curr).optimize() + + md_to_dm_graph = ( + md_to_dm_curr + if md_to_dm_graph is None + else pynini.union(md_to_dm_curr, md_to_dm_graph).optimize() + ).optimize() + + final_graph |= mdy_to_dmy_graph | md_to_dm_graph | ymd_to_mdy_graph | ymd_to_dmy_graph + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/decimal.py b/fun_text_processing/text_normalization/en/taggers/decimal.py new file mode 100644 index 0000000..839e9f5 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/decimal.py @@ -0,0 +1,140 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_SIGMA, + TO_UPPER, + GraphFst, + get_abs_path, +) +from pynini.lib import pynutil + +delete_space = pynutil.delete(" ") +quantities = pynini.string_file(get_abs_path("data/number/thousand.tsv")) +quantities_abbr = pynini.string_file(get_abs_path("data/number/quantity_abbr.tsv")) +quantities_abbr |= TO_UPPER @ quantities_abbr + + +def get_quantity( + decimal: "pynini.FstLike", cardinal_up_to_hundred: "pynini.FstLike", include_abbr: bool +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. 1 million -> integer_part: "one" quantity: "million" + e.g. 1.5 million -> integer_part: "one" fractional_part: "five" quantity: "million" + + Args: + decimal: decimal FST + cardinal_up_to_hundred: cardinal FST + """ + quantity_wo_thousand = pynini.project(quantities, "input") - pynini.union("k", "K", "thousand") + if include_abbr: + quantity_wo_thousand |= pynini.project(quantities_abbr, "input") - pynini.union( + "k", "K", "thousand" + ) + res = ( + pynutil.insert('integer_part: "') + + cardinal_up_to_hundred + + pynutil.insert('"') + + pynini.closure(pynutil.delete(" "), 0, 1) + + pynutil.insert(' quantity: "') + + (quantity_wo_thousand @ (quantities | quantities_abbr)) + + pynutil.insert('"') + ) + if include_abbr: + quantity = quantities | quantities_abbr + else: + quantity = quantities + res |= ( + decimal + + pynini.closure(pynutil.delete(" "), 0, 1) + + pynutil.insert('quantity: "') + + quantity + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal, e.g. + -12.5006 billion -> decimal { negative: "true" integer_part: "12" fractional_part: "five o o six" quantity: "billion" } + 1 billion -> decimal { integer_part: "one" quantity: "billion" } + + cardinal: CardinalFst + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + + cardinal_graph = cardinal.graph_with_and + cardinal_graph_hundred_component_at_least_one_none_zero_digit = ( + cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + + self.graph = cardinal.single_digits_graph.optimize() + + if not deterministic: + self.graph = self.graph | cardinal_graph + + point = pynutil.delete(".") + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + + self.graph_fractional = ( + pynutil.insert('fractional_part: "') + self.graph + pynutil.insert('"') + ) + self.graph_integer = ( + pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + ) + final_graph_wo_sign = ( + pynini.closure(self.graph_integer + pynutil.insert(" "), 0, 1) + + point + + pynutil.insert(" ") + + self.graph_fractional + ) + + quantity_w_abbr = get_quantity( + final_graph_wo_sign, + cardinal_graph_hundred_component_at_least_one_none_zero_digit, + include_abbr=True, + ) + quantity_wo_abbr = get_quantity( + final_graph_wo_sign, + cardinal_graph_hundred_component_at_least_one_none_zero_digit, + include_abbr=False, + ) + self.final_graph_wo_negative_w_abbr = final_graph_wo_sign | quantity_w_abbr + self.final_graph_wo_negative = final_graph_wo_sign | quantity_wo_abbr + + # reduce options for non_deterministic and allow either "oh" or "zero", but not combination + if not deterministic: + no_oh_zero = pynini.difference( + DAMO_SIGMA, + (DAMO_SIGMA + "oh" + DAMO_SIGMA + "zero" + DAMO_SIGMA) + | (DAMO_SIGMA + "zero" + DAMO_SIGMA + "oh" + DAMO_SIGMA), + ).optimize() + no_zero_oh = pynini.difference( + DAMO_SIGMA, + DAMO_SIGMA + pynini.accep("zero") + DAMO_SIGMA + pynini.accep("oh") + DAMO_SIGMA, + ).optimize() + + self.final_graph_wo_negative |= pynini.compose( + self.final_graph_wo_negative, + pynini.cdrewrite( + pynini.cross('integer_part: "zero"', 'integer_part: "oh"'), + DAMO_SIGMA, + DAMO_SIGMA, + DAMO_SIGMA, + ), + ) + self.final_graph_wo_negative = pynini.compose( + self.final_graph_wo_negative, no_oh_zero + ).optimize() + self.final_graph_wo_negative = pynini.compose( + self.final_graph_wo_negative, no_zero_oh + ).optimize() + + final_graph = optional_graph_negative + self.final_graph_wo_negative + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/electronic.py b/fun_text_processing/text_normalization/en/taggers/electronic.py new file mode 100644 index 0000000..26ac25f --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/electronic.py @@ -0,0 +1,89 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + get_abs_path, + insert_space, +) +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: as URLs, email addresses, etc. + e.g. cdf1@abc.edu -> tokens { electronic { username: "cdf1" domain: "abc.edu" } } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="classify", deterministic=deterministic) + + accepted_symbols = pynini.project( + pynini.string_file(get_abs_path("data/electronic/symbol.tsv")), "input" + ) + accepted_common_domains = pynini.project( + pynini.string_file(get_abs_path("data/electronic/domain.tsv")), "input" + ) + all_accepted_symbols = DAMO_ALPHA + pynini.closure( + DAMO_ALPHA | DAMO_DIGIT | accepted_symbols + ) + graph_symbols = pynini.string_file(get_abs_path("data/electronic/symbol.tsv")).optimize() + + username = ( + pynutil.insert('username: "') + + all_accepted_symbols + + pynutil.insert('"') + + pynini.cross("@", " ") + ) + domain_graph = all_accepted_symbols + pynini.accep(".") + all_accepted_symbols + DAMO_ALPHA + protocol_symbols = pynini.closure( + (graph_symbols | pynini.cross(":", "semicolon")) + pynutil.insert(" ") + ) + protocol_start = (pynini.cross("https", "HTTPS ") | pynini.cross("http", "HTTP ")) + ( + pynini.accep("://") @ protocol_symbols + ) + protocol_file_start = ( + pynini.accep("file") + insert_space + (pynini.accep(":///") @ protocol_symbols) + ) + + protocol_end = pynini.cross("www", "WWW ") + pynini.accep(".") @ protocol_symbols + protocol = ( + protocol_file_start | protocol_start | protocol_end | (protocol_start + protocol_end) + ) + + domain_graph = ( + pynutil.insert('domain: "') + + pynini.difference(domain_graph, pynini.project(protocol, "input") + DAMO_SIGMA) + + pynutil.insert('"') + ) + domain_common_graph = ( + pynutil.insert('domain: "') + + pynini.difference( + all_accepted_symbols + + accepted_common_domains + + pynini.closure( + accepted_symbols + pynini.closure(DAMO_ALPHA | DAMO_DIGIT | accepted_symbols), + 0, + 1, + ), + pynini.project(protocol, "input") + DAMO_SIGMA, + ) + + pynutil.insert('"') + ) + + protocol = pynutil.insert('protocol: "') + protocol + pynutil.insert('"') + # email + graph = username + domain_graph + # abc.com, abc.com/123-sm + graph |= domain_common_graph + # www.abc.com/sdafsdf, or https://www.abc.com/asdfad or www.abc.abc/asdfad + graph |= protocol + pynutil.insert(" ") + domain_graph + + final_graph = self.add_tokens(graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/fraction.py b/fun_text_processing/text_normalization/en/taggers/fraction.py new file mode 100644 index 0000000..08155ae --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/fraction.py @@ -0,0 +1,47 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, get_abs_path +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + "23 4/5" -> + tokens { fraction { integer: "twenty three" numerator: "four" denominator: "five" } } + "23 4/5th" -> + tokens { fraction { integer: "twenty three" numerator: "four" denominator: "five" } } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal, deterministic: bool = True): + super().__init__(name="fraction", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph + + integer = pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + numerator = ( + pynutil.insert('numerator: "') + + cardinal_graph + + (pynini.cross("/", '" ') | pynini.cross(" / ", '" ')) + ) + + endings = ["rd", "th", "st", "nd"] + endings += [x.upper() for x in endings] + optional_end = pynini.closure(pynini.cross(pynini.union(*endings), ""), 0, 1) + + denominator = ( + pynutil.insert('denominator: "') + cardinal_graph + optional_end + pynutil.insert('"') + ) + + graph = pynini.closure(integer + pynini.accep(" "), 0, 1) + (numerator + denominator) + graph |= pynini.closure( + integer + (pynini.accep(" ") | pynutil.insert(" ")), 0, 1 + ) + pynini.compose( + pynini.string_file(get_abs_path("data/number/fraction.tsv")), (numerator + denominator) + ) + + self.graph = graph + final_graph = self.add_tokens(self.graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/measure.py b/fun_text_processing/text_normalization/en/taggers/measure.py new file mode 100644 index 0000000..703ce8e --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/measure.py @@ -0,0 +1,320 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_NON_BREAKING_SPACE, + DAMO_SIGMA, + DAMO_SPACE, + DAMO_UPPER, + SINGULAR_TO_PLURAL, + TO_LOWER, + GraphFst, + convert_space, + delete_space, + delete_zero_or_one_space, + insert_space, +) +from fun_text_processing.text_normalization.en.taggers.ordinal import OrdinalFst as OrdinalTagger +from fun_text_processing.text_normalization.en.taggers.whitelist import get_formats +from fun_text_processing.text_normalization.en.utils import get_abs_path, load_labels +from fun_text_processing.text_normalization.en.verbalizers.ordinal import ( + OrdinalFst as OrdinalVerbalizer, +) +from pynini.examples import plurals +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure, suppletive aware, e.g. + -12kg -> measure { negative: "true" cardinal { integer: "twelve" } units: "kilograms" } + 1kg -> measure { cardinal { integer: "one" } units: "kilogram" } + .5kg -> measure { decimal { fractional_part: "five" } units: "kilograms" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + fraction: FractionFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__( + self, cardinal: GraphFst, decimal: GraphFst, fraction: GraphFst, deterministic: bool = True + ): + super().__init__(name="measure", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph_with_and | self.get_range(cardinal.graph_with_and) + + graph_unit = pynini.string_file(get_abs_path("data/measure/unit.tsv")) + if not deterministic: + graph_unit |= pynini.string_file(get_abs_path("data/measure/unit_alternatives.tsv")) + + graph_unit |= pynini.compose( + pynini.closure(TO_LOWER, 1) + + (DAMO_ALPHA | TO_LOWER) + + pynini.closure(DAMO_ALPHA | TO_LOWER), + graph_unit, + ).optimize() + + graph_unit_plural = convert_space(graph_unit @ SINGULAR_TO_PLURAL) + graph_unit = convert_space(graph_unit) + + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + + graph_unit2 = ( + pynini.cross("/", "per") + + delete_zero_or_one_space + + pynutil.insert(DAMO_NON_BREAKING_SPACE) + + graph_unit + ) + + optional_graph_unit2 = pynini.closure( + delete_zero_or_one_space + pynutil.insert(DAMO_NON_BREAKING_SPACE) + graph_unit2, + 0, + 1, + ) + + unit_plural = ( + pynutil.insert('units: "') + + (graph_unit_plural + optional_graph_unit2 | graph_unit2) + + pynutil.insert('"') + ) + + unit_singular = ( + pynutil.insert('units: "') + + (graph_unit + optional_graph_unit2 | graph_unit2) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + pynutil.insert("decimal { ") + + optional_graph_negative + + decimal.final_graph_wo_negative + + delete_space + + pynutil.insert(" } ") + + unit_plural + ) + + # support radio FM/AM + subgraph_decimal |= ( + pynutil.insert("decimal { ") + + decimal.final_graph_wo_negative + + delete_space + + pynutil.insert(" } ") + + pynutil.insert('units: "') + + pynini.union("AM", "FM") + + pynutil.insert('"') + ) + + subgraph_cardinal = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + ((DAMO_SIGMA - "1") @ cardinal_graph) + + delete_space + + pynutil.insert('"') + + pynutil.insert(" } ") + + unit_plural + ) + + subgraph_cardinal |= ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + pynini.cross("1", "one") + + delete_space + + pynutil.insert('"') + + pynutil.insert(" } ") + + unit_singular + ) + + unit_graph = ( + pynutil.insert('cardinal { integer: "-" } units: "') + + pynini.cross(pynini.union("/", "per"), "per") + + delete_zero_or_one_space + + pynutil.insert(DAMO_NON_BREAKING_SPACE) + + graph_unit + + pynutil.insert('" preserve_order: true') + ) + + decimal_dash_alpha = ( + pynutil.insert("decimal { ") + + decimal.final_graph_wo_negative + + pynini.cross("-", "") + + pynutil.insert(' } units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.insert('"') + ) + + decimal_times = ( + pynutil.insert("decimal { ") + + decimal.final_graph_wo_negative + + pynutil.insert(' } units: "') + + pynini.cross(pynini.union("x", "X"), "x") + + pynutil.insert('"') + ) + + alpha_dash_decimal = ( + pynutil.insert('units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynini.accep("-") + + pynutil.insert('"') + + pynutil.insert(" decimal { ") + + decimal.final_graph_wo_negative + + pynutil.insert(" } preserve_order: true") + ) + + subgraph_fraction = ( + pynutil.insert("fraction { ") + + fraction.graph + + delete_space + + pynutil.insert(" } ") + + unit_plural + ) + + address = self.get_address_graph(cardinal) + address = ( + pynutil.insert('units: "address" cardinal { integer: "') + + address + + pynutil.insert('" } preserve_order: true') + ) + + math_operations = pynini.string_file(get_abs_path("data/measure/math_operation.tsv")) + delimiter = pynini.accep(" ") | pynutil.insert(" ") + + math = ( + (cardinal_graph | DAMO_ALPHA) + + delimiter + + math_operations + + (delimiter | DAMO_ALPHA) + + cardinal_graph + + delimiter + + pynini.cross("=", "equals") + + delimiter + + (cardinal_graph | DAMO_ALPHA) + ) + + math |= ( + (cardinal_graph | DAMO_ALPHA) + + delimiter + + pynini.cross("=", "equals") + + delimiter + + (cardinal_graph | DAMO_ALPHA) + + delimiter + + math_operations + + delimiter + + cardinal_graph + ) + + math = ( + pynutil.insert('units: "math" cardinal { integer: "') + + math + + pynutil.insert('" } preserve_order: true') + ) + final_graph = ( + subgraph_decimal + | subgraph_cardinal + | unit_graph + | decimal_dash_alpha + | decimal_times + | alpha_dash_decimal + | subgraph_fraction + | address + | math + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() + + def get_range(self, cardinal: GraphFst): + """ + Returns range forms for measure tagger, e.g. 2-3, 2x3, 2*2 + + Args: + cardinal: cardinal GraphFst + """ + range_graph = cardinal + pynini.cross(pynini.union("-", " - "), " to ") + cardinal + + for x in [" x ", "x"]: + range_graph |= cardinal + pynini.cross(x, " by ") + cardinal + if not self.deterministic: + range_graph |= cardinal + pynini.cross(x, " times ") + cardinal + + for x in ["*", " * "]: + range_graph |= cardinal + pynini.cross(x, " times ") + cardinal + return range_graph.optimize() + + def get_address_graph(self, cardinal): + """ + Finite state transducer for classifying serial. + The serial is a combination of digits, letters and dashes, e.g.: + 2788 San Tomas Expy, Santa Clara, CA 95051 -> + units: "address" cardinal + { integer: "two seven eight eight San Tomas Expressway Santa Clara California nine five zero five one" } + preserve_order: true + """ + ordinal_verbalizer = OrdinalVerbalizer().graph + ordinal_tagger = OrdinalTagger(cardinal=cardinal).graph + ordinal_num = pynini.compose( + pynutil.insert('integer: "') + ordinal_tagger + pynutil.insert('"'), ordinal_verbalizer + ) + + address_num = ( + DAMO_DIGIT ** (1, 2) @ cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + address_num += insert_space + DAMO_DIGIT**2 @ ( + pynini.closure(pynini.cross("0", "zero "), 0, 1) + + cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + # to handle the rest of the numbers + address_num = pynini.compose(DAMO_DIGIT ** (3, 4), address_num) + address_num = plurals._priority_union(address_num, cardinal.graph, DAMO_SIGMA) + + direction = ( + pynini.cross("E", "East") + | pynini.cross("S", "South") + | pynini.cross("W", "West") + | pynini.cross("N", "North") + ) + pynini.closure(pynutil.delete("."), 0, 1) + + direction = pynini.closure(pynini.accep(DAMO_SPACE) + direction, 0, 1) + address_words = get_formats(get_abs_path("data/address/address_word.tsv")) + address_words = ( + pynini.accep(DAMO_SPACE) + + (pynini.closure(ordinal_num, 0, 1) | DAMO_UPPER + pynini.closure(DAMO_ALPHA, 1)) + + DAMO_SPACE + + pynini.closure(DAMO_UPPER + pynini.closure(DAMO_ALPHA) + DAMO_SPACE) + + address_words + ) + + city = pynini.closure(DAMO_ALPHA | pynini.accep(DAMO_SPACE), 1) + city = pynini.closure(pynini.accep(",") + pynini.accep(DAMO_SPACE) + city, 0, 1) + + states = load_labels(get_abs_path("data/address/state.tsv")) + + additional_options = [] + for x, y in states: + additional_options.append((x, f"{y[0]}.{y[1:]}")) + states.extend(additional_options) + state_graph = pynini.string_map(states) + state = pynini.invert(state_graph) + state = pynini.closure(pynini.accep(",") + pynini.accep(DAMO_SPACE) + state, 0, 1) + + zip_code = pynini.compose(DAMO_DIGIT**5, cardinal.single_digits_graph) + zip_code = pynini.closure( + pynini.closure(pynini.accep(","), 0, 1) + pynini.accep(DAMO_SPACE) + zip_code, + 0, + 1, + ) + + address = ( + address_num + direction + address_words + pynini.closure(city + state + zip_code, 0, 1) + ) + + address |= ( + address_num + direction + address_words + pynini.closure(pynini.cross(".", ""), 0, 1) + ) + + return address diff --git a/fun_text_processing/text_normalization/en/taggers/money.py b/fun_text_processing/text_normalization/en/taggers/money.py new file mode 100644 index 0000000..f975bdb --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/money.py @@ -0,0 +1,211 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + SINGULAR_TO_PLURAL, + GraphFst, + convert_space, + insert_space, +) +from fun_text_processing.text_normalization.en.utils import get_abs_path, load_labels +from pynini.lib import pynutil + +min_singular = pynini.string_file(get_abs_path("data/money/currency_minor_singular.tsv")) +min_plural = pynini.string_file(get_abs_path("data/money/currency_minor_plural.tsv")) +maj_singular = pynini.string_file((get_abs_path("data/money/currency_major.tsv"))) + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money, suppletive aware, e.g. + $12.05 -> money { integer_part: "twelve" currency_maj: "dollars" fractional_part: "five" currency_min: "cents" preserve_order: true } + $12.0500 -> money { integer_part: "twelve" currency_maj: "dollars" fractional_part: "five" currency_min: "cents" preserve_order: true } + $1 -> money { currency_maj: "dollar" integer_part: "one" } + $1.00 -> money { currency_maj: "dollar" integer_part: "one" } + $0.05 -> money { fractional_part: "five" currency_min: "cents" preserve_order: true } + $1 million -> money { currency_maj: "dollars" integer_part: "one" quantity: "million" } + $1.2 million -> money { currency_maj: "dollars" integer_part: "one" fractional_part: "two" quantity: "million" } + $1.2320 -> money { currency_maj: "dollars" integer_part: "one" fractional_part: "two three two" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph_with_and + graph_decimal_final = decimal.final_graph_wo_negative_w_abbr + + maj_singular_labels = load_labels(get_abs_path("data/money/currency_major.tsv")) + maj_unit_plural = convert_space(maj_singular @ SINGULAR_TO_PLURAL) + maj_unit_singular = convert_space(maj_singular) + + graph_maj_singular = ( + pynutil.insert('currency_maj: "') + maj_unit_singular + pynutil.insert('"') + ) + graph_maj_plural = pynutil.insert('currency_maj: "') + maj_unit_plural + pynutil.insert('"') + + optional_delete_fractional_zeros = pynini.closure( + pynutil.delete(".") + pynini.closure(pynutil.delete("0"), 1), 0, 1 + ) + + graph_integer_one = ( + pynutil.insert('integer_part: "') + pynini.cross("1", "one") + pynutil.insert('"') + ) + # only for decimals where third decimal after comma is non-zero or with quantity + decimal_delete_last_zeros = ( + pynini.closure(DAMO_DIGIT | pynutil.delete(",")) + + pynini.accep(".") + + pynini.closure(DAMO_DIGIT, 2) + + (DAMO_DIGIT - "0") + + pynini.closure(pynutil.delete("0")) + ) + decimal_with_quantity = DAMO_SIGMA + DAMO_ALPHA + + graph_decimal = ( + graph_maj_plural + + insert_space + + (decimal_delete_last_zeros | decimal_with_quantity) @ graph_decimal_final + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "1") @ cardinal_graph) + + pynutil.insert('"') + ) + + graph_integer_only = graph_maj_singular + insert_space + graph_integer_one + graph_integer_only |= graph_maj_plural + insert_space + graph_integer + + final_graph = (graph_integer_only + optional_delete_fractional_zeros) | graph_decimal + + # remove trailing zeros of non zero number in the first 2 digits and fill up to 2 digits + # e.g. 2000 -> 20, 0200->02, 01 -> 01, 10 -> 10 + # not accepted: 002, 00, 0, + two_digits_fractional_part = ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(pynutil.delete("0")) + ) @ ( + (pynutil.delete("0") + (DAMO_DIGIT - "0")) + | ((DAMO_DIGIT - "0") + pynutil.insert("0")) + | ((DAMO_DIGIT - "0") + DAMO_DIGIT) + ) + + graph_min_singular = pynutil.insert(' currency_min: "') + min_singular + pynutil.insert('"') + graph_min_plural = pynutil.insert(' currency_min: "') + min_plural + pynutil.insert('"') + # format ** dollars ** cent + decimal_graph_with_minor = None + integer_graph_reordered = None + decimal_default_reordered = None + for curr_symbol, _ in maj_singular_labels: + preserve_order = pynutil.insert(" preserve_order: true") + integer_plus_maj = ( + graph_integer + insert_space + pynutil.insert(curr_symbol) @ graph_maj_plural + ) + integer_plus_maj |= ( + graph_integer_one + insert_space + pynutil.insert(curr_symbol) @ graph_maj_singular + ) + + integer_plus_maj_with_comma = pynini.compose( + DAMO_DIGIT - "0" + pynini.closure(DAMO_DIGIT | pynutil.delete(",")), + integer_plus_maj, + ) + integer_plus_maj = pynini.compose(pynini.closure(DAMO_DIGIT) - "0", integer_plus_maj) + integer_plus_maj |= integer_plus_maj_with_comma + + graph_fractional_one = two_digits_fractional_part @ pynini.cross("1", "one") + graph_fractional_one = ( + pynutil.insert('fractional_part: "') + graph_fractional_one + pynutil.insert('"') + ) + graph_fractional = ( + two_digits_fractional_part + @ (pynini.closure(DAMO_DIGIT, 1, 2) - "1") + @ cardinal.graph_hundred_component_at_least_one_none_zero_digit + ) + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_fractional + pynutil.insert('"') + ) + + fractional_plus_min = ( + graph_fractional + insert_space + pynutil.insert(curr_symbol) @ graph_min_plural + ) + fractional_plus_min |= ( + graph_fractional_one + + insert_space + + pynutil.insert(curr_symbol) @ graph_min_singular + ) + + decimal_graph_with_minor_curr = ( + integer_plus_maj + pynini.cross(".", " ") + fractional_plus_min + ) + + if not deterministic: + decimal_graph_with_minor_curr |= pynutil.add_weight( + integer_plus_maj + + pynini.cross(".", " ") + + pynutil.insert('fractional_part: "') + + two_digits_fractional_part + @ cardinal.graph_hundred_component_at_least_one_none_zero_digit + + pynutil.insert('"'), + weight=0.0001, + ) + default_fraction_graph = ( + decimal_delete_last_zeros | decimal_with_quantity + ) @ graph_decimal_final + decimal_graph_with_minor_curr |= ( + pynini.closure(pynutil.delete("0"), 0, 1) + + pynutil.delete(".") + + fractional_plus_min + ) + decimal_graph_with_minor_curr = ( + pynutil.delete(curr_symbol) + decimal_graph_with_minor_curr + preserve_order + ) + + decimal_graph_with_minor = ( + decimal_graph_with_minor_curr + if decimal_graph_with_minor is None + else pynini.union( + decimal_graph_with_minor, decimal_graph_with_minor_curr + ).optimize() + ) + + if not deterministic: + integer_graph_reordered_curr = ( + pynutil.delete(curr_symbol) + integer_plus_maj + preserve_order + ).optimize() + + integer_graph_reordered = ( + integer_graph_reordered_curr + if integer_graph_reordered is None + else pynini.union( + integer_graph_reordered, integer_graph_reordered_curr + ).optimize() + ) + decimal_default_reordered_curr = ( + pynutil.delete(curr_symbol) + + default_fraction_graph + + insert_space + + pynutil.insert(curr_symbol) @ graph_maj_plural + ) + + decimal_default_reordered = ( + decimal_default_reordered_curr + if decimal_default_reordered is None + else pynini.union(decimal_default_reordered, decimal_default_reordered_curr) + ).optimize() + + # weight for SH + final_graph |= pynutil.add_weight(decimal_graph_with_minor, -0.0001) + + if not deterministic: + final_graph |= integer_graph_reordered | decimal_default_reordered + # to handle "$2.00" cases + final_graph |= pynini.compose( + DAMO_SIGMA + pynutil.delete(".") + pynini.closure(pynutil.delete("0"), 1), + integer_graph_reordered, + ) + final_graph = self.add_tokens(final_graph.optimize()) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/ordinal.py b/fun_text_processing/text_normalization/en/taggers/ordinal.py new file mode 100644 index 0000000..79dcefb --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/ordinal.py @@ -0,0 +1,46 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_DIGIT, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal, e.g. + 13th -> ordinal { integer: "thirteen" } + + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="ordinal", kind="classify", deterministic=deterministic) + + cardinal_graph = cardinal.graph + cardinal_format = pynini.closure(DAMO_DIGIT | pynini.accep(",")) + st_format = ( + pynini.closure(cardinal_format + (DAMO_DIGIT - "1"), 0, 1) + + pynini.accep("1") + + pynutil.delete(pynini.union("st", "ST")) + ) + nd_format = ( + pynini.closure(cardinal_format + (DAMO_DIGIT - "1"), 0, 1) + + pynini.accep("2") + + pynutil.delete(pynini.union("nd", "ND")) + ) + rd_format = ( + pynini.closure(cardinal_format + (DAMO_DIGIT - "1"), 0, 1) + + pynini.accep("3") + + pynutil.delete(pynini.union("rd", "RD")) + ) + th_format = pynini.closure( + (DAMO_DIGIT - "1" - "2" - "3") + | (cardinal_format + "1" + DAMO_DIGIT) + | (cardinal_format + (DAMO_DIGIT - "1") + (DAMO_DIGIT - "1" - "2" - "3")), + 1, + ) + pynutil.delete(pynini.union("th", "TH")) + self.graph = (st_format | nd_format | rd_format | th_format) @ cardinal_graph + final_graph = pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/punctuation.py b/fun_text_processing/text_normalization/en/taggers/punctuation.py new file mode 100644 index 0000000..193dca0 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/punctuation.py @@ -0,0 +1,58 @@ +import sys +from unicodedata import category + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, +) +from fun_text_processing.text_normalization.en.utils import get_abs_path, load_labels +from pynini.examples import plurals +from pynini.lib import pynutil + + +class PunctuationFst(GraphFst): + """ + Finite state transducer for classifying punctuation + e.g. a, -> tokens { name: "a" } tokens { name: "," } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="punctuation", kind="classify", deterministic=deterministic) + s = "!#%&'()*+,-./:;<=>?@^_`{|}~\"" + + punct_symbols_to_exclude = ["[", "]"] + punct_unicode = [ + chr(i) + for i in range(sys.maxunicode) + if category(chr(i)).startswith("P") and chr(i) not in punct_symbols_to_exclude + ] + + whitelist_symbols = load_labels(get_abs_path("data/whitelist/symbol.tsv")) + whitelist_symbols = [x[0] for x in whitelist_symbols] + self.punct_marks = [p for p in punct_unicode + list(s) if p not in whitelist_symbols] + + punct = pynini.union(*self.punct_marks) + punct = pynini.closure(punct, 1) + + emphasis = ( + pynini.accep("<") + + ( + ( + pynini.closure(DAMO_NOT_SPACE - pynini.union("<", ">"), 1) + + pynini.closure(pynini.accep("/"), 0, 1) + ) + | (pynini.accep("/") + pynini.closure(DAMO_NOT_SPACE - pynini.union("<", ">"), 1)) + ) + + pynini.accep(">") + ) + punct = plurals._priority_union(emphasis, punct, DAMO_SIGMA) + + self.graph = punct + self.fst = (pynutil.insert('name: "') + self.graph + pynutil.insert('"')).optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/range.py b/fun_text_processing/text_normalization/en/taggers/range.py new file mode 100644 index 0000000..21fce60 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/range.py @@ -0,0 +1,108 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + GraphFst, + convert_space, +) +from pynini.lib import pynutil + + +class RangeFst(GraphFst): + """ + This class is a composite class of two other class instances + + Args: + time: composed tagger and verbalizer + date: composed tagger and verbalizer + cardinal: tagger + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + lm: whether to use for hybrid LM + """ + + def __init__( + self, + time: GraphFst, + date: GraphFst, + cardinal: GraphFst, + deterministic: bool = True, + lm: bool = False, + ): + super().__init__(name="range", kind="classify", deterministic=deterministic) + + delete_space = pynini.closure(pynutil.delete(" "), 0, 1) + + approx = pynini.cross("~", "approximately") + + # TIME + time_graph = time + delete_space + pynini.cross("-", " to ") + delete_space + time + self.graph = time_graph | (approx + time) + + cardinal = cardinal.graph_with_and + # YEAR + date_year_four_digit = (DAMO_DIGIT**4 + pynini.closure(pynini.accep("s"), 0, 1)) @ date + date_year_two_digit = (DAMO_DIGIT**2 + pynini.closure(pynini.accep("s"), 0, 1)) @ date + year_to_year_graph = ( + date_year_four_digit + + delete_space + + pynini.cross("-", " to ") + + delete_space + + (date_year_four_digit | date_year_two_digit | (DAMO_DIGIT**2 @ cardinal)) + ) + mid_year_graph = ( + pynini.accep("mid") + + pynini.cross("-", " ") + + (date_year_four_digit | date_year_two_digit) + ) + + self.graph |= year_to_year_graph + self.graph |= mid_year_graph + + # ADDITION + range_graph = cardinal + pynini.closure(pynini.cross("+", " plus ") + cardinal, 1) + range_graph |= cardinal + pynini.closure(pynini.cross(" + ", " plus ") + cardinal, 1) + range_graph |= approx + cardinal + range_graph |= cardinal + (pynini.cross("...", " ... ") | pynini.accep(" ... ")) + cardinal + + if not deterministic or lm: + # cardinal ---- + cardinal_to_cardinal_graph = ( + cardinal + + delete_space + + pynini.cross("-", pynini.union(" to ", " minus ")) + + delete_space + + cardinal + ) + + range_graph |= cardinal_to_cardinal_graph | ( + cardinal + delete_space + pynini.cross(":", " to ") + delete_space + cardinal + ) + + # MULTIPLY + for x in [" x ", "x"]: + range_graph |= cardinal + pynini.closure( + pynini.cross(x, pynini.union(" by ", " times ")) + cardinal, 1 + ) + + for x in ["*", " * "]: + range_graph |= cardinal + pynini.closure(pynini.cross(x, " times ") + cardinal, 1) + + # supports "No. 12" -> "Number 12" + range_graph |= ( + (pynini.cross(pynini.union("NO", "No"), "Number") | pynini.cross("no", "number")) + + pynini.closure(pynini.union(". ", " "), 0, 1) + + cardinal + ) + + for x in ["/", " / "]: + range_graph |= cardinal + pynini.closure( + pynini.cross(x, " divided by ") + cardinal, 1 + ) + + self.graph |= range_graph + + self.graph = self.graph.optimize() + graph = ( + pynutil.insert('name: "') + convert_space(self.graph).optimize() + pynutil.insert('"') + ) + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/roman.py b/fun_text_processing/text_normalization/en/taggers/roman.py new file mode 100644 index 0000000..3e71cca --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/roman.py @@ -0,0 +1,110 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_ALPHA, DAMO_SIGMA, GraphFst +from fun_text_processing.text_normalization.en.utils import get_abs_path, load_labels +from pynini.lib import pynutil + + +class RomanFst(GraphFst): + """ + Finite state transducer for classifying roman numbers: + e.g. "IV" -> tokens { roman { integer: "four" } } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="roman", kind="classify", deterministic=deterministic) + + roman_dict = load_labels(get_abs_path("data/roman/roman_to_spoken.tsv")) + default_graph = pynini.string_map(roman_dict).optimize() + default_graph = pynutil.insert('integer: "') + default_graph + pynutil.insert('"') + ordinal_limit = 19 + + if deterministic: + # exclude "I" + start_idx = 1 + else: + start_idx = 0 + + graph_teens = pynini.string_map( + [x[0] for x in roman_dict[start_idx:ordinal_limit]] + ).optimize() + + # roman numerals up to ordinal_limit with a preceding name are converted to ordinal form + names = get_names() + graph = ( + pynutil.insert('key_the_ordinal: "') + + names + + pynutil.insert('"') + + pynini.accep(" ") + + graph_teens @ default_graph + ).optimize() + + # single symbol roman numerals with preceding key words (multiple formats) are converted to cardinal form + key_words = [] + for k_word in load_labels(get_abs_path("data/roman/key_word.tsv")): + key_words.append(k_word) + key_words.append([k_word[0][0].upper() + k_word[0][1:]]) + key_words.append([k_word[0].upper()]) + + key_words = pynini.string_map(key_words).optimize() + graph |= ( + pynutil.insert('key_cardinal: "') + + key_words + + pynutil.insert('"') + + pynini.accep(" ") + + default_graph + ).optimize() + + if deterministic or lm: + # two digit roman numerals up to 49 + roman_to_cardinal = pynini.compose( + pynini.closure(DAMO_ALPHA, 2), + ( + pynutil.insert('default_cardinal: "default" ') + + (pynini.string_map([x[0] for x in roman_dict[:50]]).optimize()) + @ default_graph + ), + ) + graph |= roman_to_cardinal + elif not lm: + # two or more digit roman numerals + roman_to_cardinal = pynini.compose( + pynini.difference(DAMO_SIGMA, "I"), + ( + pynutil.insert('default_cardinal: "default" integer: "') + + pynini.string_map(roman_dict).optimize() + + pynutil.insert('"') + ), + ).optimize() + graph |= roman_to_cardinal + + # convert three digit roman or up with suffix to ordinal + roman_to_ordinal = pynini.compose( + pynini.closure(DAMO_ALPHA, 3), + ( + pynutil.insert('default_ordinal: "default" ') + + graph_teens @ default_graph + + pynutil.delete("th") + ), + ) + + graph |= roman_to_ordinal + graph = self.add_tokens(graph.optimize()) + + self.fst = graph.optimize() + + +def get_names(): + """ + Returns the graph that matched common male and female names. + """ + male_labels = load_labels(get_abs_path("data/roman/male.tsv")) + female_labels = load_labels(get_abs_path("data/roman/female.tsv")) + male_labels.extend([[x[0].upper()] for x in male_labels]) + female_labels.extend([[x[0].upper()] for x in female_labels]) + names = pynini.string_map(male_labels).optimize() + names |= pynini.string_map(female_labels).optimize() + return names diff --git a/fun_text_processing/text_normalization/en/taggers/serial.py b/fun_text_processing/text_normalization/en/taggers/serial.py new file mode 100644 index 0000000..ee31f6e --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/serial.py @@ -0,0 +1,134 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, +) +from fun_text_processing.text_normalization.en.utils import get_abs_path, load_labels +from pynini.examples import plurals +from pynini.lib import pynutil + + +class SerialFst(GraphFst): + """ + This class is a composite class of two other class instances + + Args: + time: composed tagger and verbalizer + date: composed tagger and verbalizer + cardinal: tagger + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + lm: whether to use for hybrid LM + """ + + def __init__( + self, cardinal: GraphFst, ordinal: GraphFst, deterministic: bool = True, lm: bool = False + ): + super().__init__(name="integer", kind="classify", deterministic=deterministic) + + """ + Finite state transducer for classifying serial (handles only cases without delimiters, + values with delimiters are handled by default). + The serial is a combination of digits, letters and dashes, e.g.: + c325b -> tokens { cardinal { integer: "c three two five b" } } + """ + num_graph = pynini.compose(DAMO_DIGIT ** (6, ...), cardinal.single_digits_graph).optimize() + num_graph |= pynini.compose(DAMO_DIGIT ** (1, 5), cardinal.graph).optimize() + # to handle numbers starting with zero + num_graph |= pynini.compose( + pynini.accep("0") + pynini.closure(DAMO_DIGIT), cardinal.single_digits_graph + ).optimize() + # TODO: "#" doesn't work from the file + symbols_graph = pynini.string_file( + get_abs_path("data/whitelist/symbol.tsv") + ).optimize() | pynini.cross("#", "hash") + num_graph |= symbols_graph + + if not self.deterministic and not lm: + num_graph |= cardinal.single_digits_graph + # also allow double digits to be pronounced as integer in serial number + num_graph |= pynutil.add_weight( + DAMO_DIGIT**2 @ cardinal.graph_hundred_component_at_least_one_none_zero_digit, + weight=0.0001, + ) + + # add space between letter and digit/symbol + symbols = [x[0] for x in load_labels(get_abs_path("data/whitelist/symbol.tsv"))] + symbols = pynini.union(*symbols) + digit_symbol = DAMO_DIGIT | symbols + + graph_with_space = pynini.compose( + pynini.cdrewrite(pynutil.insert(" "), DAMO_ALPHA | symbols, digit_symbol, DAMO_SIGMA), + pynini.cdrewrite(pynutil.insert(" "), digit_symbol, DAMO_ALPHA | symbols, DAMO_SIGMA), + ) + + # serial graph with delimiter + delimiter = pynini.accep("-") | pynini.accep("/") | pynini.accep(" ") + if not deterministic: + delimiter |= pynini.cross("-", " dash ") | pynini.cross("/", " slash ") + + alphas = pynini.closure(DAMO_ALPHA, 1) + letter_num = alphas + delimiter + num_graph + num_letter = pynini.closure(num_graph + delimiter, 1) + alphas + next_alpha_or_num = pynini.closure(delimiter + (alphas | num_graph)) + next_alpha_or_num |= pynini.closure( + delimiter + + num_graph + + plurals._priority_union(pynini.accep(" "), pynutil.insert(" "), DAMO_SIGMA).optimize() + + alphas + ) + + serial_graph = letter_num + next_alpha_or_num + serial_graph |= num_letter + next_alpha_or_num + # numbers only with 2+ delimiters + serial_graph |= ( + num_graph + + delimiter + + num_graph + + delimiter + + num_graph + + pynini.closure(delimiter + num_graph) + ) + # 2+ symbols + serial_graph |= pynini.compose( + DAMO_SIGMA + symbols + DAMO_SIGMA, num_graph + delimiter + num_graph + ) + + # exclude ordinal numbers from serial options + serial_graph = pynini.compose( + pynini.difference(DAMO_SIGMA, pynini.project(ordinal.graph, "input")), serial_graph + ).optimize() + + serial_graph = pynutil.add_weight(serial_graph, 0.0001) + serial_graph |= ( + pynini.closure(DAMO_NOT_SPACE, 1) + + (pynini.cross("^2", " squared") | pynini.cross("^3", " cubed")).optimize() + ) + + # at least one serial graph with alpha numeric value and optional additional serial/num/alpha values + serial_graph = ( + pynini.closure((serial_graph | num_graph | alphas) + delimiter) + + serial_graph + + pynini.closure(delimiter + (serial_graph | num_graph | alphas)) + ) + + serial_graph |= pynini.compose(graph_with_space, serial_graph.optimize()).optimize() + serial_graph = pynini.compose(pynini.closure(DAMO_NOT_SPACE, 2), serial_graph).optimize() + + # this is not to verbolize "/" as "slash" in cases like "import/export" + serial_graph = pynini.compose( + pynini.difference( + DAMO_SIGMA, + pynini.closure(DAMO_ALPHA, 1) + pynini.accep("/") + pynini.closure(DAMO_ALPHA, 1), + ), + serial_graph, + ) + self.graph = serial_graph.optimize() + graph = ( + pynutil.insert('name: "') + convert_space(self.graph).optimize() + pynutil.insert('"') + ) + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/telephone.py b/fun_text_processing/text_normalization/en/taggers/telephone.py new file mode 100644 index 0000000..3b9920f --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/telephone.py @@ -0,0 +1,146 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + delete_extra_space, + delete_space, + insert_space, + plurals, +) +from fun_text_processing.text_normalization.en.utils import get_abs_path +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone, and IP, and SSN which includes country code, number part and extension + country code optional: +*** + number part: ***-***-****, or (***) ***-**** + extension optional: 1-9999 + E.g + +1 123-123-5678-1 -> telephone { country_code: "one" number_part: "one two three, one two three, five six seven eight" extension: "one" } + 1-800-GO-U-HAUL -> telephone { country_code: "one" number_part: "one, eight hundred GO U HAUL" } + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="telephone", kind="classify", deterministic=deterministic) + + add_separator = pynutil.insert(", ") # between components + zero = pynini.cross("0", "zero") + if not deterministic: + zero |= pynini.cross("0", pynini.union("o", "oh")) + digit = ( + pynini.invert(pynini.string_file(get_abs_path("data/number/digit.tsv"))).optimize() + | zero + ) + + telephone_prompts = pynini.string_file(get_abs_path("data/telephone/telephone_prompt.tsv")) + country_code = ( + pynini.closure(telephone_prompts + delete_extra_space, 0, 1) + + pynini.closure(pynini.cross("+", "plus "), 0, 1) + + pynini.closure(digit + insert_space, 0, 2) + + digit + + pynutil.insert(",") + ) + country_code |= telephone_prompts + country_code = pynutil.insert('country_code: "') + country_code + pynutil.insert('"') + country_code = ( + country_code + pynini.closure(pynutil.delete("-"), 0, 1) + delete_space + insert_space + ) + + area_part_default = pynini.closure(digit + insert_space, 2, 2) + digit + area_part = pynini.cross("800", "eight hundred") | pynini.compose( + pynini.difference(DAMO_SIGMA, "800"), area_part_default + ) + + area_part = ( + (area_part + (pynutil.delete("-") | pynutil.delete("."))) + | ( + pynutil.delete("(") + + area_part + + ( + (pynutil.delete(")") + pynini.closure(pynutil.delete(" "), 0, 1)) + | pynutil.delete(")-") + ) + ) + ) + add_separator + + del_separator = pynini.closure(pynini.union("-", " ", "."), 0, 1) + number_length = ((DAMO_DIGIT + del_separator) | (DAMO_ALPHA + del_separator)) ** 7 + number_words = pynini.closure( + (DAMO_DIGIT @ digit) + (insert_space | (pynini.cross("-", ", "))) + | DAMO_ALPHA + | (DAMO_ALPHA + pynini.cross("-", " ")) + ) + number_words |= pynini.closure( + (DAMO_DIGIT @ digit) + (insert_space | (pynini.cross(".", ", "))) + | DAMO_ALPHA + | (DAMO_ALPHA + pynini.cross(".", " ")) + ) + number_words = pynini.compose(number_length, number_words) + number_part = area_part + number_words + number_part = pynutil.insert('number_part: "') + number_part + pynutil.insert('"') + extension = ( + pynutil.insert('extension: "') + + pynini.closure(digit + insert_space, 0, 3) + + digit + + pynutil.insert('"') + ) + extension = pynini.closure(insert_space + extension, 0, 1) + + graph = plurals._priority_union( + country_code + number_part, number_part, DAMO_SIGMA + ).optimize() + graph = plurals._priority_union( + country_code + number_part + extension, graph, DAMO_SIGMA + ).optimize() + graph = plurals._priority_union(number_part + extension, graph, DAMO_SIGMA).optimize() + + # ip + ip_prompts = pynini.string_file(get_abs_path("data/telephone/ip_prompt.tsv")) + digit_to_str_graph = digit + pynini.closure(pynutil.insert(" ") + digit, 0, 2) + ip_graph = digit_to_str_graph + (pynini.cross(".", " dot ") + digit_to_str_graph) ** 3 + graph |= ( + pynini.closure( + pynutil.insert('country_code: "') + + ip_prompts + + pynutil.insert('"') + + delete_extra_space, + 0, + 1, + ) + + pynutil.insert('number_part: "') + + ip_graph.optimize() + + pynutil.insert('"') + ) + # ssn + ssn_prompts = pynini.string_file(get_abs_path("data/telephone/ssn_prompt.tsv")) + three_digit_part = digit + (pynutil.insert(" ") + digit) ** 2 + two_digit_part = digit + pynutil.insert(" ") + digit + four_digit_part = digit + (pynutil.insert(" ") + digit) ** 3 + ssn_separator = pynini.cross("-", ", ") + ssn_graph = ( + three_digit_part + ssn_separator + two_digit_part + ssn_separator + four_digit_part + ) + + graph |= ( + pynini.closure( + pynutil.insert('country_code: "') + + ssn_prompts + + pynutil.insert('"') + + delete_extra_space, + 0, + 1, + ) + + pynutil.insert('number_part: "') + + ssn_graph.optimize() + + pynutil.insert('"') + ) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/time.py b/fun_text_processing/text_normalization/en/taggers/time.py new file mode 100644 index 0000000..60c6d97 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/time.py @@ -0,0 +1,121 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + GraphFst, + convert_space, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.en.utils import ( + augment_labels_with_punct_at_end, + get_abs_path, + load_labels, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time, e.g. + 12:30 a.m. est -> time { hours: "twelve" minutes: "thirty" suffix: "a m" zone: "e s t" } + 2.30 a.m. -> time { hours: "two" minutes: "thirty" suffix: "a m" } + 02.30 a.m. -> time { hours: "two" minutes: "thirty" suffix: "a m" } + 2.00 a.m. -> time { hours: "two" suffix: "a m" } + 2 a.m. -> time { hours: "two" suffix: "a m" } + 02:00 -> time { hours: "two" } + 2:00 -> time { hours: "two" } + 10:00:05 a.m. -> time { hours: "ten" minutes: "zero" seconds: "five" suffix: "a m" } + + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="time", kind="classify", deterministic=deterministic) + suffix_labels = load_labels(get_abs_path("data/time/suffix.tsv")) + suffix_labels.extend(augment_labels_with_punct_at_end(suffix_labels)) + suffix_graph = pynini.string_map(suffix_labels) + + time_zone_graph = pynini.string_file(get_abs_path("data/time/zone.tsv")) + + # only used for < 1000 thousand -> 0 weight + cardinal = cardinal.graph + + labels_hour = [str(x) for x in range(0, 24)] + labels_minute_single = [str(x) for x in range(1, 10)] + labels_minute_double = [str(x) for x in range(10, 60)] + + delete_leading_zero_to_double_digit = (DAMO_DIGIT + DAMO_DIGIT) | ( + pynini.closure(pynutil.delete("0"), 0, 1) + DAMO_DIGIT + ) + + graph_hour = delete_leading_zero_to_double_digit @ pynini.union(*labels_hour) @ cardinal + + graph_minute_single = pynini.union(*labels_minute_single) @ cardinal + graph_minute_double = pynini.union(*labels_minute_double) @ cardinal + + final_graph_hour = pynutil.insert('hours: "') + graph_hour + pynutil.insert('"') + final_graph_minute = ( + pynutil.insert('minutes: "') + + (pynini.cross("0", "o") + insert_space + graph_minute_single | graph_minute_double) + + pynutil.insert('"') + ) + final_graph_second = ( + pynutil.insert('seconds: "') + + (pynini.cross("0", "o") + insert_space + graph_minute_single | graph_minute_double) + + pynutil.insert('"') + ) + final_suffix = ( + pynutil.insert('suffix: "') + convert_space(suffix_graph) + pynutil.insert('"') + ) + final_suffix_optional = pynini.closure(delete_space + insert_space + final_suffix, 0, 1) + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + convert_space(time_zone_graph) + + pynutil.insert('"'), + 0, + 1, + ) + + # 2:30 pm, 02:30, 2:00 + graph_hm = ( + final_graph_hour + + pynutil.delete(":") + + (pynutil.delete("00") | insert_space + final_graph_minute) + + final_suffix_optional + + final_time_zone_optional + ) + + # 10:30:05 pm, + graph_hms = ( + final_graph_hour + + pynutil.delete(":") + + (pynini.cross("00", ' minutes: "zero"') | insert_space + final_graph_minute) + + pynutil.delete(":") + + (pynini.cross("00", ' seconds: "zero"') | insert_space + final_graph_second) + + final_suffix_optional + + final_time_zone_optional + ) + + # 2.xx pm/am + graph_hm2 = ( + final_graph_hour + + pynutil.delete(".") + + (pynutil.delete("00") | insert_space + final_graph_minute) + + delete_space + + insert_space + + final_suffix + + final_time_zone_optional + ) + # 2 pm est + graph_h = ( + final_graph_hour + delete_space + insert_space + final_suffix + final_time_zone_optional + ) + final_graph = (graph_hm | graph_h | graph_hm2 | graph_hms).optimize() + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify.py b/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..0fb8221 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify.py @@ -0,0 +1,246 @@ +import os +import time + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_WHITE_SPACE, + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.taggers.abbreviation import AbbreviationFst +from fun_text_processing.text_normalization.en.taggers.cardinal import CardinalFst +from fun_text_processing.text_normalization.en.taggers.date import DateFst +from fun_text_processing.text_normalization.en.taggers.decimal import DecimalFst +from fun_text_processing.text_normalization.en.taggers.electronic import ElectronicFst +from fun_text_processing.text_normalization.en.taggers.fraction import FractionFst +from fun_text_processing.text_normalization.en.taggers.measure import MeasureFst +from fun_text_processing.text_normalization.en.taggers.money import MoneyFst +from fun_text_processing.text_normalization.en.taggers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.text_normalization.en.taggers.range import RangeFst as RangeFst +from fun_text_processing.text_normalization.en.taggers.roman import RomanFst +from fun_text_processing.text_normalization.en.taggers.serial import SerialFst +from fun_text_processing.text_normalization.en.taggers.telephone import TelephoneFst +from fun_text_processing.text_normalization.en.taggers.time import TimeFst +from fun_text_processing.text_normalization.en.taggers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.en.taggers.word import WordFst +from fun_text_processing.text_normalization.en.verbalizers.date import DateFst as vDateFst +from fun_text_processing.text_normalization.en.verbalizers.ordinal import OrdinalFst as vOrdinalFst +from fun_text_processing.text_normalization.en.verbalizers.time import TimeFst as vTimeFst +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence including punctuation. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + """ + + def __init__( + self, + input_case: str, + deterministic: bool = True, + cache_dir: str = None, + overwrite_cache: bool = False, + whitelist: str = None, + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + whitelist_file = os.path.basename(whitelist) if whitelist else "" + far_file = os.path.join( + cache_dir, + f"en_tn_{deterministic}_deterministic_{input_case}_{whitelist_file}_tokenize.far", + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars.") + + start_time = time.time() + cardinal = CardinalFst(deterministic=deterministic) + cardinal_graph = cardinal.fst + logging.debug( + f"cardinal: {time.time() - start_time: .2f}s -- {cardinal_graph.num_states()} nodes" + ) + + start_time = time.time() + ordinal = OrdinalFst(cardinal=cardinal, deterministic=deterministic) + ordinal_graph = ordinal.fst + logging.debug( + f"ordinal: {time.time() - start_time: .2f}s -- {ordinal_graph.num_states()} nodes" + ) + + start_time = time.time() + decimal = DecimalFst(cardinal=cardinal, deterministic=deterministic) + decimal_graph = decimal.fst + logging.debug( + f"decimal: {time.time() - start_time: .2f}s -- {decimal_graph.num_states()} nodes" + ) + + start_time = time.time() + fraction = FractionFst(deterministic=deterministic, cardinal=cardinal) + fraction_graph = fraction.fst + logging.debug( + f"fraction: {time.time() - start_time: .2f}s -- {fraction_graph.num_states()} nodes" + ) + + start_time = time.time() + measure = MeasureFst( + cardinal=cardinal, decimal=decimal, fraction=fraction, deterministic=deterministic + ) + measure_graph = measure.fst + logging.debug( + f"measure: {time.time() - start_time: .2f}s -- {measure_graph.num_states()} nodes" + ) + + start_time = time.time() + date_graph = DateFst(cardinal=cardinal, deterministic=deterministic).fst + logging.debug( + f"date: {time.time() - start_time: .2f}s -- {date_graph.num_states()} nodes" + ) + + start_time = time.time() + time_graph = TimeFst(cardinal=cardinal, deterministic=deterministic).fst + logging.debug( + f"time: {time.time() - start_time: .2f}s -- {time_graph.num_states()} nodes" + ) + + start_time = time.time() + telephone_graph = TelephoneFst(deterministic=deterministic).fst + logging.debug( + f"telephone: {time.time() - start_time: .2f}s -- {telephone_graph.num_states()} nodes" + ) + + start_time = time.time() + electonic_graph = ElectronicFst(deterministic=deterministic).fst + logging.debug( + f"electronic: {time.time() - start_time: .2f}s -- {electonic_graph.num_states()} nodes" + ) + + start_time = time.time() + money_graph = MoneyFst( + cardinal=cardinal, decimal=decimal, deterministic=deterministic + ).fst + logging.debug( + f"money: {time.time() - start_time: .2f}s -- {money_graph.num_states()} nodes" + ) + + start_time = time.time() + whitelist_graph = WhiteListFst( + input_case=input_case, deterministic=deterministic, input_file=whitelist + ).fst + logging.debug( + f"whitelist: {time.time() - start_time: .2f}s -- {whitelist_graph.num_states()} nodes" + ) + + start_time = time.time() + punctuation = PunctuationFst(deterministic=deterministic) + punct_graph = punctuation.fst + logging.debug( + f"punct: {time.time() - start_time: .2f}s -- {punct_graph.num_states()} nodes" + ) + + start_time = time.time() + word_graph = WordFst(punctuation=punctuation, deterministic=deterministic).fst + logging.debug( + f"word: {time.time() - start_time: .2f}s -- {word_graph.num_states()} nodes" + ) + + start_time = time.time() + serial_graph = SerialFst( + cardinal=cardinal, ordinal=ordinal, deterministic=deterministic + ).fst + logging.debug( + f"serial: {time.time() - start_time: .2f}s -- {serial_graph.num_states()} nodes" + ) + + start_time = time.time() + v_time_graph = vTimeFst(deterministic=deterministic).fst + v_ordinal_graph = vOrdinalFst(deterministic=deterministic) + v_date_graph = vDateFst(ordinal=v_ordinal_graph, deterministic=deterministic).fst + time_final = pynini.compose(time_graph, v_time_graph) + date_final = pynini.compose(date_graph, v_date_graph) + range_graph = RangeFst( + time=time_final, date=date_final, cardinal=cardinal, deterministic=deterministic + ).fst + logging.debug( + f"range: {time.time() - start_time: .2f}s -- {range_graph.num_states()} nodes" + ) + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 1.1) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electonic_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.1) + | pynutil.add_weight(range_graph, 1.1) + | pynutil.add_weight( + serial_graph, 1.1001 + ) # should be higher than the rest of the classes + ) + + roman_graph = RomanFst(deterministic=deterministic).fst + classify |= pynutil.add_weight(roman_graph, 1.1) + + if not deterministic: + abbreviation_graph = AbbreviationFst(deterministic=deterministic).fst + classify |= pynutil.add_weight(abbreviation_graph, 100) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=2.1) + + pynutil.insert(" }") + ) + punct = pynini.closure( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct), + 1, + ) + + classify |= pynutil.add_weight(word_graph, 100) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure( + ( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct + pynutil.insert(" ")) + ) + + token_plus_punct + ) + + graph = delete_space + graph + delete_space + graph |= punct + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify_lm.py b/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify_lm.py new file mode 100644 index 0000000..497fa6b --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify_lm.py @@ -0,0 +1,238 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + DAMO_WHITE_SPACE, + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.taggers.cardinal import CardinalFst +from fun_text_processing.text_normalization.en.taggers.date import DateFst +from fun_text_processing.text_normalization.en.taggers.decimal import DecimalFst +from fun_text_processing.text_normalization.en.taggers.electronic import ElectronicFst +from fun_text_processing.text_normalization.en.taggers.fraction import FractionFst +from fun_text_processing.text_normalization.en.taggers.measure import MeasureFst +from fun_text_processing.text_normalization.en.taggers.money import MoneyFst +from fun_text_processing.text_normalization.en.taggers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.text_normalization.en.taggers.range import RangeFst as RangeFst +from fun_text_processing.text_normalization.en.taggers.roman import RomanFst +from fun_text_processing.text_normalization.en.taggers.serial import SerialFst +from fun_text_processing.text_normalization.en.taggers.telephone import TelephoneFst +from fun_text_processing.text_normalization.en.taggers.time import TimeFst +from fun_text_processing.text_normalization.en.taggers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.en.taggers.word import WordFst +from fun_text_processing.text_normalization.en.verbalizers.cardinal import CardinalFst as vCardinal +from fun_text_processing.text_normalization.en.verbalizers.date import DateFst as vDate +from fun_text_processing.text_normalization.en.verbalizers.decimal import DecimalFst as vDecimal +from fun_text_processing.text_normalization.en.verbalizers.electronic import ( + ElectronicFst as vElectronic, +) +from fun_text_processing.text_normalization.en.verbalizers.fraction import FractionFst as vFraction +from fun_text_processing.text_normalization.en.verbalizers.measure import MeasureFst as vMeasure +from fun_text_processing.text_normalization.en.verbalizers.money import MoneyFst as vMoney +from fun_text_processing.text_normalization.en.verbalizers.ordinal import OrdinalFst as vOrdinal +from fun_text_processing.text_normalization.en.verbalizers.roman import RomanFst as vRoman +from fun_text_processing.text_normalization.en.verbalizers.telephone import ( + TelephoneFst as vTelephone, +) +from fun_text_processing.text_normalization.en.verbalizers.time import TimeFst as vTime +from fun_text_processing.text_normalization.en.verbalizers.word import WordFst as vWord +from pynini.examples import plurals +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence including punctuation. + For deployment, this grammar will be compiled and exported to OpenFst Finite State Archive (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + """ + + def __init__( + self, + input_case: str, + deterministic: bool = True, + cache_dir: str = None, + overwrite_cache: bool = True, + whitelist: str = None, + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + whitelist_file = os.path.basename(whitelist) if whitelist else "" + far_file = os.path.join( + cache_dir, + f"_{input_case}_en_tn_{deterministic}_deterministic{whitelist_file}_lm.far", + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + no_digits = pynini.closure(pynini.difference(DAMO_CHAR, DAMO_DIGIT)) + self.fst_no_digits = pynini.compose(self.fst, no_digits).optimize() + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars. This might take some time...") + # TAGGERS + cardinal = CardinalFst(deterministic=True, lm=True) + cardinal_tagger = cardinal + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst(cardinal=cardinal, deterministic=True) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal=cardinal, deterministic=True) + decimal_graph = decimal.fst + fraction = FractionFst(deterministic=True, cardinal=cardinal) + fraction_graph = fraction.fst + + measure = MeasureFst( + cardinal=cardinal, decimal=decimal, fraction=fraction, deterministic=True + ) + measure_graph = measure.fst + date = DateFst(cardinal=cardinal, deterministic=True, lm=True) + date_graph = date.fst + punctuation = PunctuationFst(deterministic=True) + punct_graph = punctuation.graph + word_graph = WordFst(punctuation=punctuation, deterministic=deterministic).graph + time_graph = TimeFst(cardinal=cardinal, deterministic=True).fst + telephone_graph = TelephoneFst(deterministic=True).fst + electronic_graph = ElectronicFst(deterministic=True).fst + money_graph = MoneyFst(cardinal=cardinal, decimal=decimal, deterministic=False).fst + whitelist = WhiteListFst( + input_case=input_case, deterministic=False, input_file=whitelist + ) + whitelist_graph = whitelist.graph + serial_graph = SerialFst( + cardinal=cardinal, ordinal=ordinal, deterministic=deterministic, lm=True + ).fst + + # VERBALIZERS + cardinal = vCardinal(deterministic=True) + v_cardinal_graph = cardinal.fst + decimal = vDecimal(cardinal=cardinal, deterministic=True) + v_decimal_graph = decimal.fst + ordinal = vOrdinal(deterministic=True) + v_ordinal_graph = ordinal.fst + fraction = vFraction(deterministic=True, lm=True) + v_fraction_graph = fraction.fst + v_telephone_graph = vTelephone(deterministic=True).fst + v_electronic_graph = vElectronic(deterministic=True).fst + measure = vMeasure( + decimal=decimal, cardinal=cardinal, fraction=fraction, deterministic=False + ) + v_measure_graph = measure.fst + v_time_graph = vTime(deterministic=True).fst + v_date_graph = vDate(ordinal=ordinal, deterministic=deterministic, lm=True).fst + v_money_graph = vMoney(decimal=decimal, deterministic=deterministic).fst + v_roman_graph = vRoman(deterministic=deterministic).fst + v_word_graph = vWord(deterministic=deterministic).fst + + cardinal_or_date_final = plurals._priority_union(date_graph, cardinal_graph, DAMO_SIGMA) + cardinal_or_date_final = pynini.compose( + cardinal_or_date_final, (v_cardinal_graph | v_date_graph) + ) + + time_final = pynini.compose(time_graph, v_time_graph) + ordinal_final = pynini.compose(ordinal_graph, v_ordinal_graph) + sem_w = 1 + word_w = 100 + punct_w = 2 + classify_and_verbalize = ( + pynutil.add_weight(time_final, sem_w) + | pynutil.add_weight(pynini.compose(decimal_graph, v_decimal_graph), sem_w) + | pynutil.add_weight(pynini.compose(measure_graph, v_measure_graph), sem_w) + | pynutil.add_weight(ordinal_final, sem_w) + | pynutil.add_weight(pynini.compose(telephone_graph, v_telephone_graph), sem_w) + | pynutil.add_weight(pynini.compose(electronic_graph, v_electronic_graph), sem_w) + | pynutil.add_weight(pynini.compose(fraction_graph, v_fraction_graph), sem_w) + | pynutil.add_weight(pynini.compose(money_graph, v_money_graph), sem_w) + | pynutil.add_weight(cardinal_or_date_final, sem_w) + | pynutil.add_weight(whitelist_graph, sem_w) + | pynutil.add_weight( + pynini.compose(serial_graph, v_word_graph), 1.1001 + ) # should be higher than the rest of the classes + ).optimize() + + roman_graph = RomanFst(deterministic=deterministic, lm=True).fst + # the weight matches the word_graph weight for "I" cases in long sentences with multiple semiotic tokens + classify_and_verbalize |= pynutil.add_weight( + pynini.compose(roman_graph, v_roman_graph), sem_w + ) + + date_final = pynini.compose(date_graph, v_date_graph) + range_graph = RangeFst( + time=time_final, + cardinal=cardinal_tagger, + date=date_final, + deterministic=deterministic, + ).fst + classify_and_verbalize |= pynutil.add_weight( + pynini.compose(range_graph, v_word_graph), sem_w + ) + classify_and_verbalize = ( + pynutil.insert("< ") + classify_and_verbalize + pynutil.insert(" >") + ) + classify_and_verbalize |= pynutil.add_weight(word_graph, word_w) + + punct_only = pynutil.add_weight(punct_graph, weight=punct_w) + punct = pynini.closure( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct_only), + 1, + ) + + def get_token_sem_graph(classify_and_verbalize): + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + classify_and_verbalize + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure( + ( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct + pynutil.insert(" ")) + ) + + token_plus_punct + ) + + graph |= punct_only + pynini.closure(punct) + graph = delete_space + graph + delete_space + + remove_extra_spaces = pynini.closure(DAMO_NOT_SPACE, 1) + pynini.closure( + delete_extra_space + pynini.closure(DAMO_NOT_SPACE, 1) + ) + remove_extra_spaces |= ( + pynini.closure(pynutil.delete(" "), 1) + + pynini.closure(DAMO_NOT_SPACE, 1) + + pynini.closure(delete_extra_space + pynini.closure(DAMO_NOT_SPACE, 1)) + ) + + graph = pynini.compose(graph.optimize(), remove_extra_spaces).optimize() + return graph + + self.fst = get_token_sem_graph(classify_and_verbalize) + no_digits = pynini.closure(pynini.difference(DAMO_CHAR, DAMO_DIGIT)) + self.fst_no_digits = pynini.compose(self.fst, no_digits).optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify_with_audio.py b/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify_with_audio.py new file mode 100644 index 0000000..244adbb --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/tokenize_and_classify_with_audio.py @@ -0,0 +1,238 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_WHITE_SPACE, + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.taggers.abbreviation import AbbreviationFst +from fun_text_processing.text_normalization.en.taggers.cardinal import CardinalFst +from fun_text_processing.text_normalization.en.taggers.date import DateFst +from fun_text_processing.text_normalization.en.taggers.decimal import DecimalFst +from fun_text_processing.text_normalization.en.taggers.electronic import ElectronicFst +from fun_text_processing.text_normalization.en.taggers.fraction import FractionFst +from fun_text_processing.text_normalization.en.taggers.measure import MeasureFst +from fun_text_processing.text_normalization.en.taggers.money import MoneyFst +from fun_text_processing.text_normalization.en.taggers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.text_normalization.en.taggers.range import RangeFst as RangeFst +from fun_text_processing.text_normalization.en.taggers.roman import RomanFst +from fun_text_processing.text_normalization.en.taggers.serial import SerialFst +from fun_text_processing.text_normalization.en.taggers.telephone import TelephoneFst +from fun_text_processing.text_normalization.en.taggers.time import TimeFst +from fun_text_processing.text_normalization.en.taggers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.en.taggers.word import WordFst +from fun_text_processing.text_normalization.en.verbalizers.abbreviation import ( + AbbreviationFst as vAbbreviation, +) +from fun_text_processing.text_normalization.en.verbalizers.cardinal import CardinalFst as vCardinal +from fun_text_processing.text_normalization.en.verbalizers.date import DateFst as vDate +from fun_text_processing.text_normalization.en.verbalizers.decimal import DecimalFst as vDecimal +from fun_text_processing.text_normalization.en.verbalizers.electronic import ( + ElectronicFst as vElectronic, +) +from fun_text_processing.text_normalization.en.verbalizers.fraction import FractionFst as vFraction +from fun_text_processing.text_normalization.en.verbalizers.measure import MeasureFst as vMeasure +from fun_text_processing.text_normalization.en.verbalizers.money import MoneyFst as vMoney +from fun_text_processing.text_normalization.en.verbalizers.ordinal import OrdinalFst as vOrdinal +from fun_text_processing.text_normalization.en.verbalizers.roman import RomanFst as vRoman +from fun_text_processing.text_normalization.en.verbalizers.telephone import ( + TelephoneFst as vTelephone, +) +from fun_text_processing.text_normalization.en.verbalizers.time import TimeFst as vTime +from fun_text_processing.text_normalization.en.verbalizers.word import WordFst as vWord +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence including punctuation. + For deployment, this grammar will be compiled and exported to OpenFst Finite State Archive (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + """ + + def __init__( + self, + input_case: str, + deterministic: bool = True, + cache_dir: str = None, + overwrite_cache: bool = True, + whitelist: str = None, + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + whitelist_file = os.path.basename(whitelist) if whitelist else "" + far_file = os.path.join( + cache_dir, f"_{input_case}_en_tn_{deterministic}_deterministic{whitelist_file}.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + no_digits = pynini.closure(pynini.difference(DAMO_CHAR, DAMO_DIGIT)) + self.fst_no_digits = pynini.compose(self.fst, no_digits).optimize() + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars. This might take some time...") + # TAGGERS + cardinal = CardinalFst(deterministic=deterministic) + cardinal_graph = cardinal.fst + + ordinal = OrdinalFst(cardinal=cardinal, deterministic=deterministic) + deterministic_ordinal = OrdinalFst(cardinal=cardinal, deterministic=True) + ordinal_graph = ordinal.fst + + decimal = DecimalFst(cardinal=cardinal, deterministic=deterministic) + decimal_graph = decimal.fst + fraction = FractionFst(deterministic=deterministic, cardinal=cardinal) + fraction_graph = fraction.fst + + measure = MeasureFst( + cardinal=cardinal, decimal=decimal, fraction=fraction, deterministic=deterministic + ) + measure_graph = measure.fst + date_graph = DateFst(cardinal=cardinal, deterministic=deterministic).fst + punctuation = PunctuationFst(deterministic=True) + punct_graph = punctuation.graph + word_graph = WordFst(punctuation=punctuation, deterministic=deterministic).graph + time_graph = TimeFst(cardinal=cardinal, deterministic=deterministic).fst + telephone_graph = TelephoneFst(deterministic=deterministic).fst + electronic_graph = ElectronicFst(deterministic=deterministic).fst + money_graph = MoneyFst( + cardinal=cardinal, decimal=decimal, deterministic=deterministic + ).fst + whitelist = WhiteListFst( + input_case=input_case, deterministic=deterministic, input_file=whitelist + ) + whitelist_graph = whitelist.graph + serial_graph = SerialFst( + cardinal=cardinal, ordinal=deterministic_ordinal, deterministic=deterministic + ).fst + + # VERBALIZERS + cardinal = vCardinal(deterministic=deterministic) + v_cardinal_graph = cardinal.fst + decimal = vDecimal(cardinal=cardinal, deterministic=deterministic) + v_decimal_graph = decimal.fst + ordinal = vOrdinal(deterministic=deterministic) + v_ordinal_graph = ordinal.fst + fraction = vFraction(deterministic=deterministic) + v_fraction_graph = fraction.fst + v_telephone_graph = vTelephone(deterministic=deterministic).fst + v_electronic_graph = vElectronic(deterministic=deterministic).fst + measure = vMeasure( + decimal=decimal, cardinal=cardinal, fraction=fraction, deterministic=deterministic + ) + v_measure_graph = measure.fst + v_time_graph = vTime(deterministic=deterministic).fst + v_date_graph = vDate(ordinal=ordinal, deterministic=deterministic).fst + v_money_graph = vMoney(decimal=decimal, deterministic=deterministic).fst + v_roman_graph = vRoman(deterministic=deterministic).fst + v_abbreviation = vAbbreviation(deterministic=deterministic).fst + + det_v_time_graph = vTime(deterministic=True).fst + det_v_date_graph = vDate(ordinal=vOrdinal(deterministic=True), deterministic=True).fst + time_final = pynini.compose(time_graph, det_v_time_graph) + date_final = pynini.compose(date_graph, det_v_date_graph) + range_graph = RangeFst( + time=time_final, + date=date_final, + cardinal=CardinalFst(deterministic=True), + deterministic=deterministic, + ).fst + v_word_graph = vWord(deterministic=deterministic).fst + + sem_w = 1 + word_w = 100 + punct_w = 2 + classify_and_verbalize = ( + pynutil.add_weight(whitelist_graph, sem_w) + | pynutil.add_weight(pynini.compose(time_graph, v_time_graph), sem_w) + | pynutil.add_weight(pynini.compose(decimal_graph, v_decimal_graph), sem_w) + | pynutil.add_weight(pynini.compose(measure_graph, v_measure_graph), sem_w) + | pynutil.add_weight(pynini.compose(cardinal_graph, v_cardinal_graph), sem_w) + | pynutil.add_weight(pynini.compose(ordinal_graph, v_ordinal_graph), sem_w) + | pynutil.add_weight(pynini.compose(telephone_graph, v_telephone_graph), sem_w) + | pynutil.add_weight(pynini.compose(electronic_graph, v_electronic_graph), sem_w) + | pynutil.add_weight(pynini.compose(fraction_graph, v_fraction_graph), sem_w) + | pynutil.add_weight(pynini.compose(money_graph, v_money_graph), sem_w) + | pynutil.add_weight(word_graph, word_w) + | pynutil.add_weight(pynini.compose(date_graph, v_date_graph), sem_w - 0.01) + | pynutil.add_weight(pynini.compose(range_graph, v_word_graph), sem_w) + | pynutil.add_weight( + pynini.compose(serial_graph, v_word_graph), 1.1001 + ) # should be higher than the rest of the classes + ).optimize() + + if not deterministic: + roman_graph = RomanFst(deterministic=deterministic).fst + # the weight matches the word_graph weight for "I" cases in long sentences with multiple semiotic tokens + classify_and_verbalize |= pynutil.add_weight( + pynini.compose(roman_graph, v_roman_graph), word_w + ) + + abbreviation_graph = AbbreviationFst( + whitelist=whitelist, deterministic=deterministic + ).fst + classify_and_verbalize |= pynutil.add_weight( + pynini.compose(abbreviation_graph, v_abbreviation), word_w + ) + + punct_only = pynutil.add_weight(punct_graph, weight=punct_w) + punct = pynini.closure( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct_only), + 1, + ) + + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + classify_and_verbalize + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure( + ( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct + pynutil.insert(" ")) + ) + + token_plus_punct + ) + + graph |= punct_only + pynini.closure(punct) + graph = delete_space + graph + delete_space + + remove_extra_spaces = pynini.closure(DAMO_NOT_SPACE, 1) + pynini.closure( + delete_extra_space + pynini.closure(DAMO_NOT_SPACE, 1) + ) + remove_extra_spaces |= ( + pynini.closure(pynutil.delete(" "), 1) + + pynini.closure(DAMO_NOT_SPACE, 1) + + pynini.closure(delete_extra_space + pynini.closure(DAMO_NOT_SPACE, 1)) + ) + + graph = pynini.compose(graph.optimize(), remove_extra_spaces).optimize() + self.fst = graph + no_digits = pynini.closure(pynini.difference(DAMO_CHAR, DAMO_DIGIT)) + self.fst_no_digits = pynini.compose(graph, no_digits).optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/en/taggers/whitelist.py b/fun_text_processing/text_normalization/en/taggers/whitelist.py new file mode 100644 index 0000000..d5a8f79 --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/whitelist.py @@ -0,0 +1,152 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_NOT_SPACE, + DAMO_SIGMA, + DAMO_UPPER, + SINGULAR_TO_PLURAL, + GraphFst, + convert_space, +) +from fun_text_processing.text_normalization.en.taggers.roman import get_names +from fun_text_processing.text_normalization.en.utils import ( + augment_labels_with_punct_at_end, + get_abs_path, + load_labels, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelist, e.g. + misses -> tokens { name: "mrs" } + for non-deterministic case: "Dr. Abc" -> + tokens { name: "drive" } tokens { name: "Abc" } + tokens { name: "doctor" } tokens { name: "Abc" } + tokens { name: "Dr." } tokens { name: "Abc" } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + input_file: path to a file with whitelist replacements + """ + + def __init__(self, input_case: str, deterministic: bool = True, input_file: str = None): + super().__init__(name="whitelist", kind="classify", deterministic=deterministic) + + def _get_whitelist_graph(input_case, file, keep_punct_add_end: bool = False): + whitelist = load_labels(file) + if input_case == "lower_cased": + whitelist = [[x.lower(), y] for x, y in whitelist] + else: + whitelist = [[x, y] for x, y in whitelist] + + if keep_punct_add_end: + whitelist.extend(augment_labels_with_punct_at_end(whitelist)) + + graph = pynini.string_map(whitelist) + return graph + + graph = _get_whitelist_graph(input_case, get_abs_path("data/whitelist/tts.tsv")) + graph |= pynini.compose( + pynini.difference(DAMO_SIGMA, pynini.accep("/")).optimize(), + _get_whitelist_graph(input_case, get_abs_path("data/whitelist/symbol.tsv")), + ).optimize() + + if deterministic: + names = get_names() + graph |= ( + pynini.cross(pynini.union("st", "St", "ST"), "Saint") + + pynini.closure(pynutil.delete(".")) + + pynini.accep(" ") + + names + ) + else: + graph |= _get_whitelist_graph( + input_case, get_abs_path("data/whitelist/alternatives.tsv"), keep_punct_add_end=True + ) + + for x in [".", ". "]: + graph |= ( + DAMO_UPPER + + pynini.closure(pynutil.delete(x) + DAMO_UPPER, 2) + + pynini.closure(pynutil.delete("."), 0, 1) + ) + + if not deterministic: + multiple_forms_whitelist_graph = get_formats( + get_abs_path("data/whitelist/alternatives_all_format.tsv") + ) + graph |= multiple_forms_whitelist_graph + + graph_unit = pynini.string_file( + get_abs_path("data/measure/unit.tsv") + ) | pynini.string_file(get_abs_path("data/measure/unit_alternatives.tsv")) + graph_unit_plural = graph_unit @ SINGULAR_TO_PLURAL + units_graph = pynini.compose( + DAMO_CHAR ** (3, ...), convert_space(graph_unit | graph_unit_plural) + ) + graph |= units_graph + + # convert to states only if comma is present before the abbreviation to avoid converting all caps words, + # e.g. "IN", "OH", "OK" + # TODO or only exclude above? + states = load_labels(get_abs_path("data/address/state.tsv")) + additional_options = [] + for x, y in states: + if input_case == "lower_cased": + x = x.lower() + additional_options.append((x, f"{y[0]}.{y[1:]}")) + if not deterministic: + additional_options.append((x, f"{y[0]}.{y[1:]}.")) + + states.extend(additional_options) + state_graph = pynini.string_map(states) + graph |= ( + pynini.closure(DAMO_NOT_SPACE, 1) + + pynini.union(", ", ",") + + pynini.invert(state_graph).optimize() + ) + + if input_file: + whitelist_provided = _get_whitelist_graph(input_case, input_file) + if not deterministic: + graph |= whitelist_provided + else: + graph = whitelist_provided + + self.graph = (convert_space(graph)).optimize() + + self.fst = (pynutil.insert('name: "') + self.graph + pynutil.insert('"')).optimize() + + +def get_formats(input_f, input_case="cased", is_default=True): + """ + Adds various abbreviation format options to the list of acceptable input forms + """ + multiple_formats = load_labels(input_f) + additional_options = [] + for x, y in multiple_formats: + if input_case == "lower_cased": + x = x.lower() + additional_options.append( + (f"{x}.", y) + ) # default "dr" -> doctor, this includes period "dr." -> doctor + additional_options.append( + (f"{x[0].upper() + x[1:]}", f"{y[0].upper() + y[1:]}") + ) # "Dr" -> Doctor + additional_options.append( + (f"{x[0].upper() + x[1:]}.", f"{y[0].upper() + y[1:]}") + ) # "Dr." -> Doctor + multiple_formats.extend(additional_options) + + if not is_default: + multiple_formats = [ + (x, f"|raw_start|{x}|raw_end||norm_start|{y}|norm_end|") for (x, y) in multiple_formats + ] + + multiple_formats = pynini.string_map(multiple_formats) + return multiple_formats diff --git a/fun_text_processing/text_normalization/en/taggers/word.py b/fun_text_processing/text_normalization/en/taggers/word.py new file mode 100644 index 0000000..6468f1e --- /dev/null +++ b/fun_text_processing/text_normalization/en/taggers/word.py @@ -0,0 +1,82 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + MIN_NEG_WEIGHT, + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_NOT_SPACE, + DAMO_SIGMA, + GraphFst, + convert_space, + get_abs_path, +) +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from pynini.examples import plurals +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying word. Considers sentence boundary exceptions. + e.g. sleep -> tokens { name: "sleep" } + + Args: + punctuation: PunctuationFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, punctuation: GraphFst, deterministic: bool = True): + super().__init__(name="word", kind="classify", deterministic=deterministic) + + punct = PunctuationFst().graph + default_graph = pynini.closure(pynini.difference(DAMO_NOT_SPACE, punct.project("input")), 1) + symbols_to_exclude = ( + pynini.union("$", "€", "₩", "£", "¥", "#", "%") | DAMO_DIGIT + ).optimize() + graph = pynini.closure(pynini.difference(DAMO_NOT_SPACE, symbols_to_exclude), 1) + graph = pynutil.add_weight(graph, MIN_NEG_WEIGHT) | default_graph + + # leave phones of format [HH AH0 L OW1] untouched + phoneme_unit = pynini.closure(DAMO_ALPHA, 1) + pynini.closure(DAMO_DIGIT) + phoneme = ( + pynini.accep(pynini.escape("[")) + + pynini.closure(phoneme_unit + pynini.accep(" ")) + + phoneme_unit + + pynini.accep(pynini.escape("]")) + ) + + # leave IPA phones of format [ˈdoʊv] untouched, single words and sentences with punctuation marks allowed + punct_marks = pynini.union(*punctuation.punct_marks).optimize() + stress = pynini.union("ˈ", "'", "ˌ") + ipa_phoneme_unit = pynini.string_file(get_abs_path("data/whitelist/ipa_symbols.tsv")) + # word in ipa form + ipa_phonemes = ( + pynini.closure(stress, 0, 1) + + pynini.closure(ipa_phoneme_unit, 1) + + pynini.closure(stress | ipa_phoneme_unit) + ) + # allow sentences of words in IPA format separated with spaces or punct marks + delim = (punct_marks | pynini.accep(" ")) ** (1, ...) + ipa_phonemes = ( + ipa_phonemes + pynini.closure(delim + ipa_phonemes) + pynini.closure(delim, 0, 1) + ) + ipa_phonemes = ( + pynini.accep(pynini.escape("[")) + ipa_phonemes + pynini.accep(pynini.escape("]")) + ).optimize() + + if not deterministic: + phoneme = ( + pynini.accep(pynini.escape("[")) + + pynini.closure(pynini.accep(" "), 0, 1) + + pynini.closure(phoneme_unit + pynini.accep(" ")) + + phoneme_unit + + pynini.closure(pynini.accep(" "), 0, 1) + + pynini.accep(pynini.escape("]")) + ).optimize() + ipa_phonemes = ( + pynini.accep(pynini.escape("[")) + ipa_phonemes + pynini.accep(pynini.escape("]")) + ).optimize() + + phoneme |= ipa_phonemes + self.graph = plurals._priority_union(convert_space(phoneme.optimize()), graph, DAMO_SIGMA) + self.fst = (pynutil.insert('name: "') + self.graph + pynutil.insert('"')).optimize() diff --git a/fun_text_processing/text_normalization/en/utils.py b/fun_text_processing/text_normalization/en/utils.py new file mode 100644 index 0000000..aa3cbdc --- /dev/null +++ b/fun_text_processing/text_normalization/en/utils.py @@ -0,0 +1,46 @@ +import csv +import os + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path + + +def load_labels(abs_path): + """ + loads relative path file as dictionary + + Args: + abs_path: absolute path + + Returns dictionary of mappings + """ + label_tsv = open(abs_path, encoding="utf-8") + labels = list(csv.reader(label_tsv, delimiter="\t")) + return labels + + +def augment_labels_with_punct_at_end(labels): + """ + augments labels: if key ends on a punctuation that value does not have, add a new label + where the value maintains the punctuation + + Args: + labels : input labels + Returns: + additional labels + """ + res = [] + for label in labels: + if len(label) > 1: + if label[0][-1] == "." and label[1][-1] != ".": + res.append([label[0], label[1] + "."] + label[2:]) + return res diff --git a/fun_text_processing/text_normalization/en/verbalizers/__init__.py b/fun_text_processing/text_normalization/en/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/en/verbalizers/abbreviation.py b/fun_text_processing/text_normalization/en/verbalizers/abbreviation.py new file mode 100644 index 0000000..c3812aa --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/abbreviation.py @@ -0,0 +1,21 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class AbbreviationFst(GraphFst): + """ + Finite state transducer for verbalizing abbreviations + e.g. tokens { abbreviation { value: "A B C" } } -> "ABC" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="abbreviation", kind="verbalize", deterministic=deterministic) + + graph = pynutil.delete('value: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/cardinal.py b/fun_text_processing/text_normalization/en/verbalizers/cardinal.py new file mode 100644 index 0000000..0f0c08e --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/cardinal.py @@ -0,0 +1,35 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinal, e.g. + cardinal { negative: "true" integer: "23" } -> minus twenty three + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) + + self.optional_sign = pynini.cross('negative: "true"', "minus ") + if not deterministic: + self.optional_sign |= pynini.cross('negative: "true"', "negative ") + self.optional_sign = pynini.closure(self.optional_sign + delete_space, 0, 1) + + integer = pynini.closure(DAMO_NOT_QUOTE) + + self.integer = delete_space + pynutil.delete('"') + integer + pynutil.delete('"') + integer = pynutil.delete("integer:") + self.integer + + self.numbers = self.optional_sign + integer + delete_tokens = self.delete_tokens(self.numbers) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/date.py b/fun_text_processing/text_normalization/en/verbalizers/date.py new file mode 100644 index 0000000..9be8f9a --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/date.py @@ -0,0 +1,100 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_extra_space, + delete_space, +) +from pynini.examples import plurals +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { month: "february" day: "five" year: "twenty twelve" preserve_order: true } -> february fifth twenty twelve + date { day: "five" month: "february" year: "twenty twelve" preserve_order: true } -> the fifth of february twenty twelve + + Args: + ordinal: OrdinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, ordinal: GraphFst, deterministic: bool = True, lm: bool = False): + super().__init__(name="date", kind="verbalize", deterministic=deterministic) + + month = pynini.closure(DAMO_NOT_QUOTE, 1) + day_cardinal = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + day = day_cardinal @ ordinal.suffix + + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + month + + pynutil.delete('"') + ) + + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + + # month (day) year + graph_mdy = ( + month + + pynini.closure(delete_extra_space + day, 0, 1) + + pynini.closure(delete_extra_space + year, 0, 1) + ) + # may 5 -> may five + if not deterministic and not lm: + graph_mdy |= ( + month + + pynini.closure(delete_extra_space + day_cardinal, 0, 1) + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + # day month year + graph_dmy = ( + pynutil.insert("the ") + + day + + delete_extra_space + + pynutil.insert("of ") + + month + + pynini.closure(delete_extra_space + year, 0, 1) + ) + + optional_preserve_order = pynini.closure( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + | pynutil.delete("field_order:") + + delete_space + + pynutil.delete('"') + + DAMO_NOT_QUOTE + + pynutil.delete('"') + + delete_space + ) + + final_graph = ( + ( + plurals._priority_union( + graph_mdy, pynutil.add_weight(graph_dmy, 0.0001), DAMO_SIGMA + ) + | year + ) + + delete_space + + optional_preserve_order + ) + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/decimal.py b/fun_text_processing/text_normalization/en/verbalizers/decimal.py new file mode 100644 index 0000000..766424f --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/decimal.py @@ -0,0 +1,58 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + decimal { negative: "true" integer_part: "twelve" fractional_part: "five o o six" quantity: "billion" } -> minus twelve point five o o six billion + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal, deterministic: bool = True): + super().__init__(name="decimal", kind="verbalize", deterministic=deterministic) + self.optional_sign = pynini.cross('negative: "true"', "minus ") + if not deterministic: + self.optional_sign |= pynini.cross('negative: "true"', "negative ") + self.optional_sign = pynini.closure(self.optional_sign + delete_space, 0, 1) + self.integer = pynutil.delete("integer_part:") + cardinal.integer + self.optional_integer = pynini.closure(self.integer + delete_space + insert_space, 0, 1) + self.fractional_default = ( + pynutil.delete("fractional_part:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + self.fractional = pynutil.insert("point ") + self.fractional_default + + self.quantity = ( + delete_space + + insert_space + + pynutil.delete("quantity:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + self.optional_quantity = pynini.closure(self.quantity, 0, 1) + + graph = self.optional_sign + ( + self.integer + | (self.integer + self.quantity) + | (self.optional_integer + self.fractional + self.optional_quantity) + ) + + self.numbers = graph + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/electronic.py b/fun_text_processing/text_normalization/en/verbalizers/electronic.py new file mode 100644 index 0000000..142a9dd --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/electronic.py @@ -0,0 +1,95 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_NOT_SPACE, + DAMO_SIGMA, + TO_UPPER, + GraphFst, + delete_extra_space, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.en.utils import get_abs_path +from pynini.examples import plurals +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. tokens { electronic { username: "cdf1" domain: "abc.edu" } } -> c d f one at a b c dot e d u + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="verbalize", deterministic=deterministic) + graph_digit_no_zero = pynini.invert( + pynini.string_file(get_abs_path("data/number/digit.tsv")) + ).optimize() + graph_zero = pynini.cross("0", "zero") + + if not deterministic: + graph_zero |= pynini.cross("0", "o") | pynini.cross("0", "oh") + + graph_digit = graph_digit_no_zero | graph_zero + graph_symbols = pynini.string_file(get_abs_path("data/electronic/symbol.tsv")).optimize() + + default_chars_symbols = pynini.cdrewrite( + pynutil.insert(" ") + (graph_symbols | graph_digit) + pynutil.insert(" "), + "", + "", + DAMO_SIGMA, + ) + default_chars_symbols = pynini.compose( + pynini.closure(DAMO_NOT_SPACE), default_chars_symbols.optimize() + ).optimize() + + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + default_chars_symbols + + pynutil.delete('"') + ) + + domain_common = pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + + domain = ( + default_chars_symbols + + insert_space + + plurals._priority_union( + domain_common, + pynutil.add_weight(pynini.cross(".", "dot"), weight=0.0001), + DAMO_SIGMA, + ) + + pynini.closure( + insert_space + + (pynini.cdrewrite(TO_UPPER, "", "", DAMO_SIGMA) @ default_chars_symbols), + 0, + 1, + ) + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + domain + + delete_space + + pynutil.delete('"') + ).optimize() + + protocol = ( + pynutil.delete('protocol: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + graph = ( + pynini.closure(protocol + delete_space, 0, 1) + + pynini.closure(user_name + delete_space + pynutil.insert(" at ") + delete_space, 0, 1) + + domain + + delete_space + ).optimize() @ pynini.cdrewrite(delete_extra_space, "", "", DAMO_SIGMA) + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/fraction.py b/fun_text_processing/text_normalization/en/verbalizers/fraction.py new file mode 100644 index 0000000..03c4683 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/fraction.py @@ -0,0 +1,94 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + insert_space, +) +from fun_text_processing.text_normalization.en.verbalizers.ordinal import OrdinalFst +from pynini.examples import plurals +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction + e.g. tokens { fraction { integer: "twenty three" numerator: "four" denominator: "five" } } -> + twenty three and four fifth + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="fraction", kind="verbalize", deterministic=deterministic) + suffix = OrdinalFst().suffix + + integer = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE) + + pynutil.delete('" ') + ) + denominator_one = pynini.cross('denominator: "one"', "over one") + denominator_half = pynini.cross('denominator: "two"', "half") + denominator_quarter = pynini.cross('denominator: "four"', "quarter") + + denominator_rest = ( + pynutil.delete('denominator: "') + + pynini.closure(DAMO_NOT_QUOTE) @ suffix + + pynutil.delete('"') + ) + + denominators = plurals._priority_union( + denominator_one, + plurals._priority_union( + denominator_half, + plurals._priority_union(denominator_quarter, denominator_rest, DAMO_SIGMA), + DAMO_SIGMA, + ), + DAMO_SIGMA, + ).optimize() + if not deterministic: + denominators |= ( + pynutil.delete('denominator: "') + + (pynini.accep("four") @ suffix) + + pynutil.delete('"') + ) + + numerator_one = pynutil.delete('numerator: "') + pynini.accep("one") + pynutil.delete('" ') + numerator_one = numerator_one + insert_space + denominators + numerator_rest = ( + pynutil.delete('numerator: "') + + (pynini.closure(DAMO_NOT_QUOTE) - pynini.accep("one")) + + pynutil.delete('" ') + ) + numerator_rest = numerator_rest + insert_space + denominators + numerator_rest @= pynini.cdrewrite( + plurals._priority_union( + pynini.cross("half", "halves"), pynutil.insert("s"), DAMO_SIGMA + ), + "", + "[EOS]", + DAMO_SIGMA, + ) + + graph = numerator_one | numerator_rest + + conjunction = pynutil.insert("and ") + if not deterministic and not lm: + conjunction = pynini.closure(conjunction, 0, 1) + + integer = pynini.closure(integer + insert_space + conjunction, 0, 1) + + graph = integer + graph + graph @= pynini.cdrewrite( + pynini.cross("and one half", "and a half") | pynini.cross("over ones", "over one"), + "", + "[EOS]", + DAMO_SIGMA, + ) + + self.graph = graph + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/measure.py b/fun_text_processing/text_normalization/en/verbalizers/measure.py new file mode 100644 index 0000000..a4308b6 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/measure.py @@ -0,0 +1,109 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { negative: "true" cardinal { integer: "twelve" } units: "kilograms" } -> minus twelve kilograms + measure { decimal { integer_part: "twelve" fractional_part: "five" } units: "kilograms" } -> twelve point five kilograms + tokens { measure { units: "covid" decimal { integer_part: "nineteen" fractional_part: "five" } } } -> covid nineteen point five + + Args: + decimal: DecimalFst + cardinal: CardinalFst + fraction: FractionFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__( + self, decimal: GraphFst, cardinal: GraphFst, fraction: GraphFst, deterministic: bool = True + ): + super().__init__(name="measure", kind="verbalize", deterministic=deterministic) + optional_sign = cardinal.optional_sign + unit = ( + pynutil.delete('units: "') + + pynini.difference(pynini.closure(DAMO_NOT_QUOTE, 1), pynini.union("address", "math")) + + pynutil.delete('"') + + delete_space + ) + + if not deterministic: + unit |= pynini.compose(unit, pynini.cross(pynini.union("inch", "inches"), '"')) + + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + optional_sign + + delete_space + + decimal.numbers + + delete_space + + pynutil.delete("}") + ) + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + delete_space + + cardinal.numbers + + delete_space + + pynutil.delete("}") + ) + + graph_fraction = ( + pynutil.delete("fraction {") + + delete_space + + fraction.graph + + delete_space + + pynutil.delete("}") + ) + + graph = ( + (graph_cardinal | graph_decimal | graph_fraction) + delete_space + insert_space + unit + ) + + # SH adds "preserve_order: true" by default + preserve_order = ( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + ) + graph |= ( + unit + + insert_space + + (graph_cardinal | graph_decimal) + + delete_space + + pynini.closure(preserve_order) + ) + # for only unit + graph |= ( + pynutil.delete('cardinal { integer: "-"') + + delete_space + + pynutil.delete("}") + + delete_space + + unit + + pynini.closure(preserve_order) + ) + address = ( + pynutil.delete('units: "address" ') + + delete_space + + graph_cardinal + + delete_space + + pynini.closure(preserve_order) + ) + math = ( + pynutil.delete('units: "math" ') + + delete_space + + graph_cardinal + + delete_space + + pynini.closure(preserve_order) + ) + graph |= address | math + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/money.py b/fun_text_processing/text_normalization/en/verbalizers/money.py new file mode 100644 index 0000000..241fbb7 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/money.py @@ -0,0 +1,69 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_extra_space, + delete_preserve_order, +) +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { integer_part: "twelve" fractional_part: "o five" currency: "dollars" } -> twelve o five dollars + + Args: + decimal: DecimalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="verbalize", deterministic=deterministic) + keep_space = pynini.accep(" ") + maj = ( + pynutil.delete('currency_maj: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + min = ( + pynutil.delete('currency_min: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + fractional_part = ( + pynutil.delete('fractional_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + integer_part = decimal.integer + + # *** currency_maj + graph_integer = integer_part + keep_space + maj + + # *** currency_maj + (***) | ((and) *** current_min) + fractional = fractional_part + delete_extra_space + min + + if not deterministic: + fractional |= pynutil.insert("and ") + fractional + + graph_integer_with_minor = ( + integer_part + keep_space + maj + keep_space + fractional + delete_preserve_order + ) + + # *** point *** currency_maj + graph_decimal = decimal.numbers + keep_space + maj + + # *** current_min + graph_minor = fractional_part + delete_extra_space + min + delete_preserve_order + + graph = graph_integer | graph_integer_with_minor | graph_decimal | graph_minor + + if not deterministic: + graph |= graph_integer + delete_preserve_order + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/ordinal.py b/fun_text_processing/text_normalization/en/verbalizers/ordinal.py new file mode 100644 index 0000000..e8e6c4a --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/ordinal.py @@ -0,0 +1,46 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from fun_text_processing.text_normalization.en.utils import get_abs_path +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinal, e.g. + ordinal { integer: "thirteen" } } -> thirteenth + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="ordinal", kind="verbalize", deterministic=deterministic) + + graph_digit = pynini.string_file(get_abs_path("data/ordinal/digit.tsv")).invert() + graph_teens = pynini.string_file(get_abs_path("data/ordinal/teen.tsv")).invert() + + graph = ( + pynutil.delete("integer:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + convert_rest = pynutil.insert("th") + + suffix = pynini.cdrewrite( + graph_digit | graph_teens | pynini.cross("ty", "tieth") | convert_rest, + "", + "[EOS]", + DAMO_SIGMA, + ).optimize() + self.graph = pynini.compose(graph, suffix) + self.suffix = suffix + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/post_processing.py b/fun_text_processing/text_normalization/en/verbalizers/post_processing.py new file mode 100644 index 0000000..5d604f0 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/post_processing.py @@ -0,0 +1,178 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + MIN_NEG_WEIGHT, + DAMO_ALPHA, + DAMO_CHAR, + DAMO_SIGMA, + DAMO_SPACE, + generator_main, +) +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from pynini.lib import pynutil + +import logging + + +class PostProcessingFst: + """ + Finite state transducer that post-processing an entire sentence after verbalization is complete, e.g. + removes extra spaces around punctuation marks " ( one hundred and twenty three ) " -> "(one hundred and twenty three)" + + Args: + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__(self, cache_dir: str = None, overwrite_cache: bool = False): + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join(cache_dir, "en_tn_post_processing.far") + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["post_process_graph"] + logging.info(f"Post processing graph was restored from {far_file}.") + else: + self.set_punct_dict() + self.fst = self.get_punct_postprocess_graph() + + if far_file: + generator_main(far_file, {"post_process_graph": self.fst}) + + def set_punct_dict(self): + self.punct_marks = { + "'": [ + "'", + "´", + "ʹ", + "ʻ", + "ʼ", + "ʽ", + "ʾ", + "ˈ", + "ˊ", + "ˋ", + "˴", + "ʹ", + "΄", + "՚", + "՝", + "י", + "׳", + "ߴ", + "ߵ", + "ᑊ", + "ᛌ", + "᾽", + "᾿", + "`", + "´", + "῾", + "‘", + "’", + "‛", + "′", + "‵", + "ꞌ", + "'", + "`", + "𖽑", + "𖽒", + ], + } + + def get_punct_postprocess_graph(self): + """ + Returns graph to post process punctuation marks. + + {``} quotes are converted to {"}. Note, if there are spaces around single quote {'}, they will be kept. + By default, a space is added after a punctuation mark, and spaces are removed before punctuation marks. + """ + punct_marks_all = PunctuationFst().punct_marks + + # no_space_before_punct assume no space before them + quotes = ["'", '"', "``", "«"] + dashes = ["-", "—"] + brackets = ["<", "{", "("] + open_close_single_quotes = [ + ("`", "`"), + ] + + open_close_double_quotes = [('"', '"'), ("``", "``"), ("“", "”")] + open_close_symbols = open_close_single_quotes + open_close_double_quotes + allow_space_before_punct = ( + ["&"] + quotes + dashes + brackets + [k[0] for k in open_close_symbols] + ) + + no_space_before_punct = [m for m in punct_marks_all if m not in allow_space_before_punct] + no_space_before_punct = pynini.union(*no_space_before_punct) + no_space_after_punct = pynini.union(*brackets) + delete_space = pynutil.delete(" ") + delete_space_optional = pynini.closure(delete_space, 0, 1) + + # non_punct allows space + # delete space before no_space_before_punct marks, if present + non_punct = pynini.difference(DAMO_CHAR, no_space_before_punct).optimize() + graph = ( + pynini.closure(non_punct) + + pynini.closure( + no_space_before_punct + | pynutil.add_weight(delete_space + no_space_before_punct, MIN_NEG_WEIGHT) + ) + + pynini.closure(non_punct) + ) + graph = pynini.closure(graph).optimize() + graph = pynini.compose( + graph, pynini.cdrewrite(pynini.cross("``", '"'), "", "", DAMO_SIGMA).optimize() + ).optimize() + + # remove space after no_space_after_punct (even if there are no matching closing brackets) + no_space_after_punct = pynini.cdrewrite( + delete_space, no_space_after_punct, DAMO_SIGMA, DAMO_SIGMA + ).optimize() + graph = pynini.compose(graph, no_space_after_punct).optimize() + + # remove space around text in quotes + single_quote = pynutil.add_weight(pynini.accep("`"), MIN_NEG_WEIGHT) + double_quotes = pynutil.add_weight(pynini.accep('"'), MIN_NEG_WEIGHT) + quotes_graph = ( + single_quote + + delete_space_optional + + DAMO_ALPHA + + DAMO_SIGMA + + delete_space_optional + + single_quote + ).optimize() + + # this is to make sure multiple quotes are tagged from right to left without skipping any quotes in the left + not_alpha = pynini.difference(DAMO_CHAR, DAMO_ALPHA).optimize() | pynutil.add_weight( + DAMO_SPACE, MIN_NEG_WEIGHT + ) + end = pynini.closure(pynutil.add_weight(not_alpha, MIN_NEG_WEIGHT)) + quotes_graph |= ( + double_quotes + + delete_space_optional + + DAMO_ALPHA + + DAMO_SIGMA + + delete_space_optional + + double_quotes + + end + ) + + quotes_graph = pynutil.add_weight(quotes_graph, MIN_NEG_WEIGHT) + quotes_graph = DAMO_SIGMA + pynini.closure(DAMO_SIGMA + quotes_graph + DAMO_SIGMA) + + graph = pynini.compose(graph, quotes_graph).optimize() + + # remove space between a word and a single quote followed by s + remove_space_around_single_quote = pynini.cdrewrite( + delete_space_optional + pynini.union(*self.punct_marks["'"]) + delete_space, + DAMO_ALPHA, + pynini.union("s ", "s[EOS]"), + DAMO_SIGMA, + ) + + graph = pynini.compose(graph, remove_space_around_single_quote).optimize() + return graph diff --git a/fun_text_processing/text_normalization/en/verbalizers/roman.py b/fun_text_processing/text_normalization/en/verbalizers/roman.py new file mode 100644 index 0000000..18fec22 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/roman.py @@ -0,0 +1,56 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from fun_text_processing.text_normalization.en.verbalizers.ordinal import OrdinalFst +from pynini.lib import pynutil + + +class RomanFst(GraphFst): + """ + Finite state transducer for verbalizing roman numerals + e.g. tokens { roman { integer: "one" } } -> one + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="roman", kind="verbalize", deterministic=deterministic) + suffix = OrdinalFst().suffix + + cardinal = pynini.closure(DAMO_NOT_QUOTE) + ordinal = pynini.compose(cardinal, suffix) + + graph = ( + pynutil.delete('key_cardinal: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" ") + + pynutil.delete('integer: "') + + cardinal + + pynutil.delete('"') + ).optimize() + + graph |= ( + pynutil.delete('default_cardinal: "default" integer: "') + + cardinal + + pynutil.delete('"') + ).optimize() + + graph |= ( + pynutil.delete('default_ordinal: "default" integer: "') + ordinal + pynutil.delete('"') + ).optimize() + + graph |= ( + pynutil.delete('key_the_ordinal: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + pynini.accep(" ") + + pynutil.delete('integer: "') + + pynini.closure(pynutil.insert("the "), 0, 1) + + ordinal + + pynutil.delete('"') + ).optimize() + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/telephone.py b/fun_text_processing/text_normalization/en/verbalizers/telephone.py new file mode 100644 index 0000000..5c4d0ef --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/telephone.py @@ -0,0 +1,54 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone numbers, e.g. + telephone { country_code: "one" number_part: "one two three, one two three, five six seven eight" extension: "one" } + -> one, one two three, one two three, five six seven eight, one + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="telephone", kind="verbalize", deterministic=deterministic) + + optional_country_code = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + delete_space + + insert_space, + 0, + 1, + ) + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynini.closure(pynutil.add_weight(pynutil.delete(" "), -0.0001), 0, 1) + + pynutil.delete('"') + ) + + optional_extension = pynini.closure( + delete_space + + insert_space + + pynutil.delete('extension: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"'), + 0, + 1, + ) + + graph = optional_country_code + number_part + optional_extension + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/time.py b/fun_text_processing/text_normalization/en/verbalizers/time.py new file mode 100644 index 0000000..715435e --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/time.py @@ -0,0 +1,88 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "twelve" minutes: "thirty" suffix: "a m" zone: "e s t" } -> twelve thirty a m e s t + time { hours: "twelve" } -> twelve o'clock + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="time", kind="verbalize", deterministic=deterministic) + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + suffix = ( + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_suffix = pynini.closure(delete_space + insert_space + suffix, 0, 1) + zone = ( + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(delete_space + insert_space + zone, 0, 1) + second = ( + pynutil.delete("seconds:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + graph_hms = ( + hour + + pynutil.insert(" hours ") + + delete_space + + minute + + pynutil.insert(" minutes and ") + + delete_space + + second + + pynutil.insert(" seconds") + + optional_suffix + + optional_zone + ) + graph_hms @= pynini.cdrewrite( + pynutil.delete("o ") + | pynini.cross("one minutes", "one minute") + | pynini.cross("one seconds", "one second") + | pynini.cross("one hours", "one hour"), + pynini.union(" ", "[BOS]"), + "", + DAMO_SIGMA, + ) + graph = hour + delete_space + insert_space + minute + optional_suffix + optional_zone + graph |= hour + insert_space + pynutil.insert("o'clock") + optional_zone + graph |= hour + delete_space + insert_space + suffix + optional_zone + graph |= graph_hms + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/verbalize.py b/fun_text_processing/text_normalization/en/verbalizers/verbalize.py new file mode 100644 index 0000000..0d0fddc --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/verbalize.py @@ -0,0 +1,70 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.en.verbalizers.abbreviation import AbbreviationFst +from fun_text_processing.text_normalization.en.verbalizers.cardinal import CardinalFst +from fun_text_processing.text_normalization.en.verbalizers.date import DateFst +from fun_text_processing.text_normalization.en.verbalizers.decimal import DecimalFst +from fun_text_processing.text_normalization.en.verbalizers.electronic import ElectronicFst +from fun_text_processing.text_normalization.en.verbalizers.fraction import FractionFst +from fun_text_processing.text_normalization.en.verbalizers.measure import MeasureFst +from fun_text_processing.text_normalization.en.verbalizers.money import MoneyFst +from fun_text_processing.text_normalization.en.verbalizers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.en.verbalizers.roman import RomanFst +from fun_text_processing.text_normalization.en.verbalizers.telephone import TelephoneFst +from fun_text_processing.text_normalization.en.verbalizers.time import TimeFst +from fun_text_processing.text_normalization.en.verbalizers.whitelist import WhiteListFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="verbalize", kind="verbalize", deterministic=deterministic) + cardinal = CardinalFst(deterministic=deterministic) + cardinal_graph = cardinal.fst + decimal = DecimalFst(cardinal=cardinal, deterministic=deterministic) + decimal_graph = decimal.fst + ordinal = OrdinalFst(deterministic=deterministic) + ordinal_graph = ordinal.fst + fraction = FractionFst(deterministic=deterministic) + fraction_graph = fraction.fst + telephone_graph = TelephoneFst(deterministic=deterministic).fst + electronic_graph = ElectronicFst(deterministic=deterministic).fst + measure = MeasureFst( + decimal=decimal, cardinal=cardinal, fraction=fraction, deterministic=deterministic + ) + measure_graph = measure.fst + time_graph = TimeFst(deterministic=deterministic).fst + date_graph = DateFst(ordinal=ordinal, deterministic=deterministic).fst + money_graph = MoneyFst(decimal=decimal, deterministic=deterministic).fst + whitelist_graph = WhiteListFst(deterministic=deterministic).fst + + graph = ( + time_graph + | date_graph + | money_graph + | measure_graph + | ordinal_graph + | decimal_graph + | cardinal_graph + | telephone_graph + | electronic_graph + | fraction_graph + | whitelist_graph + ) + + roman_graph = RomanFst(deterministic=deterministic).fst + graph |= roman_graph + + if not deterministic: + abbreviation_graph = AbbreviationFst(deterministic=deterministic).fst + graph |= abbreviation_graph + + self.fst = graph diff --git a/fun_text_processing/text_normalization/en/verbalizers/verbalize_final.py b/fun_text_processing/text_normalization/en/verbalizers/verbalize_final.py new file mode 100644 index 0000000..14a0722 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/verbalize_final.py @@ -0,0 +1,66 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.verbalizers.verbalize import VerbalizeFst +from fun_text_processing.text_normalization.en.verbalizers.word import WordFst +from pynini.lib import pynutil + +import logging + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "twelve" minutes: "thirty" } } tokens { name: "now" } tokens { name: "." } -> its twelve thirty now . + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__( + self, deterministic: bool = True, cache_dir: str = None, overwrite_cache: bool = False + ): + super().__init__(name="verbalize_final", kind="verbalize", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join( + cache_dir, f"en_tn_{deterministic}_deterministic_verbalizer.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["verbalize"] + logging.info(f"VerbalizeFinalFst graph was restored from {far_file}.") + else: + verbalize = VerbalizeFst(deterministic=deterministic).fst + word = WordFst(deterministic=deterministic).fst + types = verbalize | word + + if deterministic: + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + else: + graph = delete_space + types + delete_space + + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + + self.fst = graph.optimize() + if far_file: + generator_main(far_file, {"verbalize": self.fst}) + logging.info(f"VerbalizeFinalFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/en/verbalizers/whitelist.py b/fun_text_processing/text_normalization/en/verbalizers/whitelist.py new file mode 100644 index 0000000..396e86c --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/whitelist.py @@ -0,0 +1,31 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for verbalizing whitelist + e.g. tokens { name: "misses" } } -> misses + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="whitelist", kind="verbalize", deterministic=deterministic) + graph = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_CHAR - " ", 1) + + pynutil.delete('"') + ) + graph = graph @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/en/verbalizers/word.py b/fun_text_processing/text_normalization/en/verbalizers/word.py new file mode 100644 index 0000000..c0744a9 --- /dev/null +++ b/fun_text_processing/text_normalization/en/verbalizers/word.py @@ -0,0 +1,33 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for verbalizing word + e.g. tokens { name: "sleep" } -> sleep + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="word", kind="verbalize", deterministic=deterministic) + chars = pynini.closure(DAMO_CHAR - " ", 1) + char = ( + pynutil.delete("name:") + + delete_space + + pynutil.delete('"') + + chars + + pynutil.delete('"') + ) + graph = char @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", DAMO_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/es/README.md b/fun_text_processing/text_normalization/es/README.md new file mode 100644 index 0000000..895380e --- /dev/null +++ b/fun_text_processing/text_normalization/es/README.md @@ -0,0 +1,22 @@ +# Localization Note + +Depending on locale, Spanish number strings will vary in formatting. In the EU and South American countries, it is common to use a period (".") or space to delineate groupings of three +digits. e.g. + `1.000.000` -> "un millón" + `1 000 000` -> "un millón" + +and commas (",") to seperate cardinal and decimal strings. e.g. + + `1,00` -> "uno coma cero cero" + +While Central and Northern America will use commas (",") to delineate groupings of three digits, e.g. + `1,000,000` -> "un millón" + +and periods (".") to seperate cardinal and decimal strings. e.g. + + `1.00` -> "uno coma cero cero" + +As inclusion of both forms will create inherrent ambiguity for verbalization, this module defaults to the former formatting (periods for cardinal delineation and commas for decimals). + +To toggle the alternate formatting, you may edit the `LOCALIZATION` variable in `fun_text_processing.text_normalization.es.__init__` with the value of `'am'`. This will perform necessary +adjustments to all affected classes. \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/__init__.py b/fun_text_processing/text_normalization/es/__init__.py new file mode 100644 index 0000000..749ab53 --- /dev/null +++ b/fun_text_processing/text_normalization/es/__init__.py @@ -0,0 +1 @@ +LOCALIZATION = "eu" # Set to am for alternate formatting diff --git a/fun_text_processing/text_normalization/es/data/__init__.py b/fun_text_processing/text_normalization/es/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/dates/__init__.py b/fun_text_processing/text_normalization/es/data/dates/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/dates/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/dates/months.tsv b/fun_text_processing/text_normalization/es/data/dates/months.tsv new file mode 100644 index 0000000..7cfdf32 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/dates/months.tsv @@ -0,0 +1,12 @@ +1 enero +2 febrero +3 marzo +4 abril +5 mayo +6 junio +7 julio +8 agosto +9 septiembre +10 octubre +11 noviembre +12 diciembre \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/electronic/__init__.py b/fun_text_processing/text_normalization/es/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/electronic/domain.tsv b/fun_text_processing/text_normalization/es/data/electronic/domain.tsv new file mode 100644 index 0000000..9d71632 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/electronic/domain.tsv @@ -0,0 +1,14 @@ +.com punto com +.org punto org +.gov punto gov +.uk punto uk +.fr punto fr +.net punto net +.br punto br +.in punto in +.ru punto ru +.de punto de +.it punto it +.es punto es +.mx punto mx +.us punto us \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/electronic/server_name.tsv b/fun_text_processing/text_normalization/es/data/electronic/server_name.tsv new file mode 100644 index 0000000..9a0c756 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/electronic/server_name.tsv @@ -0,0 +1,11 @@ +gmail +nvidia +outlook +hotmail +yahoo +live +yandex +orange +wanadoo +web +comcast \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/electronic/symbols.tsv b/fun_text_processing/text_normalization/es/data/electronic/symbols.tsv new file mode 100644 index 0000000..c7790c3 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/electronic/symbols.tsv @@ -0,0 +1,22 @@ +. punto +- guión +_ barra baja +! signo de exclamación +# almohadilla +$ signo de dólar +% signo de porcentaje +& et +' comilla +* asterisco ++ signo más +/ barra += signo igual +? signo de interrogación +^ acento circunflej +` acento grave +{ llave izquierda +| pleca +} llave derecha +~ tilde +, coma +: dos puntos \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/fractions/__init__.py b/fun_text_processing/text_normalization/es/data/fractions/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/fractions/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/fractions/ordinal_exceptions.tsv b/fun_text_processing/text_normalization/es/data/fractions/ordinal_exceptions.tsv new file mode 100644 index 0000000..32cc393 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/fractions/ordinal_exceptions.tsv @@ -0,0 +1,2 @@ +segundo medio +tercero tercio \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/fractions/powers_of_ten.tsv b/fun_text_processing/text_normalization/es/data/fractions/powers_of_ten.tsv new file mode 100644 index 0000000..021dc0a --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/fractions/powers_of_ten.tsv @@ -0,0 +1,9 @@ +millón millonésimo +millones millonésimo +billón billonésimo +billones billonésimo +trillón trillonésimo +trillones trillonésimo +mil millones mil millonésimo +mil billones mil billonésimo +mil trillones mil trillonésimo \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/fractions/powers_of_ten_fem.tsv b/fun_text_processing/text_normalization/es/data/fractions/powers_of_ten_fem.tsv new file mode 100644 index 0000000..9e1a4ca --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/fractions/powers_of_ten_fem.tsv @@ -0,0 +1,6 @@ +décimo décima +centésimo centésima +milésimo milésima +millonésimo millonésima +billonésimo billonésima +trillonésimo trillonésima \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/measures/__init__.py b/fun_text_processing/text_normalization/es/data/measures/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/measures/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/measures/measurements.tsv b/fun_text_processing/text_normalization/es/data/measures/measurements.tsv new file mode 100644 index 0000000..13b00f4 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/measures/measurements.tsv @@ -0,0 +1,17 @@ +cm centímetro +g gramo +h hora +kg kilogramo +km kilómetro +km² kilómetro cuadrado +l litro +m metro +m² metro cuadrado +m³ metro cubico +mph milla por hora +ml mililitro +mm milímetro +ms milisegundo +min minuto +% por ciento +s segundo \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/measures/measurements_plural_fem.tsv b/fun_text_processing/text_normalization/es/data/measures/measurements_plural_fem.tsv new file mode 100644 index 0000000..e8158d7 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/measures/measurements_plural_fem.tsv @@ -0,0 +1,3 @@ +hora horas +milla por hora millas por hora +milla millas \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/measures/measurements_plural_masc.tsv b/fun_text_processing/text_normalization/es/data/measures/measurements_plural_masc.tsv new file mode 100644 index 0000000..8376ad2 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/measures/measurements_plural_masc.tsv @@ -0,0 +1,15 @@ +centímetro centímetros +gramo gramos +kilogramo kilogramos +kilómetro kilómetros +kilómetro cuadrado kilómetros cuadrados +litro litros +metro metros +metro cuadrado metros cuadrados +metro cubico metros cubicos +mililitro mililitros +milímetro milímetros +milisegundo milisegundos +minuto minutos +segundo segundos +por ciento por ciento \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/money/__init__.py b/fun_text_processing/text_normalization/es/data/money/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/money/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/money/currency_major.tsv b/fun_text_processing/text_normalization/es/data/money/currency_major.tsv new file mode 100644 index 0000000..5950aab --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/money/currency_major.tsv @@ -0,0 +1,29 @@ +€ euro +$ dólar +£ libra +₩ won +nzd dólar de Nueva Zelanda +rs rupia +chf franco suizo +fr franco +dkk corona danesa +kr corona +fim marco finlandes +mk marco +aed dírham +dh dírham +dhs dírham +¥ yen +czk corona checa +kč corona checa +crc colón costarricense +₡ colón +hkd dólar de Hong Kong +awg florín +nok corona noruega +sek corona sueca +R$ real +BRL real +ESP peseta +₧ peseta +Ptas peseta \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/money/currency_minor.tsv b/fun_text_processing/text_normalization/es/data/money/currency_minor.tsv new file mode 100644 index 0000000..2d559e1 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/money/currency_minor.tsv @@ -0,0 +1,4 @@ +$ centavo +€ céntimo +£ penique +¥ centavo \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/money/currency_plural_fem.tsv b/fun_text_processing/text_normalization/es/data/money/currency_plural_fem.tsv new file mode 100644 index 0000000..c412456 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/money/currency_plural_fem.tsv @@ -0,0 +1,8 @@ +rupia rupias +libra libras +corona danesa coronas danesas +corona coronas +corona checa coronas checas +corona noruega coronas noruegas +corona sueca coronas suecas +peseta pesetas \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/money/currency_plural_masc.tsv b/fun_text_processing/text_normalization/es/data/money/currency_plural_masc.tsv new file mode 100644 index 0000000..08c25ee --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/money/currency_plural_masc.tsv @@ -0,0 +1,19 @@ +euro euros +dólar dólares +dólar estadounidense dólares estadounidenses +won wones +dólar de Nueva Zelanda dólares de Nueva Zelanda +franco suizo francos suizos +franco francos +marco finlandes marcos finlandeses +marco marcos +dírham dírhams +dírham dírhams +dírham dírhams +yen yenes +colón costarricense colónes costarricenses +colón colónes +dólar de Hong Kong dólares de Hong Kong +centavo centavos +céntimo céntimos +penique peniques \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/numbers/__init__.py b/fun_text_processing/text_normalization/es/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/numbers/digit.tsv b/fun_text_processing/text_normalization/es/data/numbers/digit.tsv new file mode 100644 index 0000000..4628036 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/digit.tsv @@ -0,0 +1,9 @@ +un 1 +dos 2 +tres 3 +cuatro 4 +cinco 5 +seis 6 +siete 7 +ocho 8 +nueve 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/numbers/hundreds.tsv b/fun_text_processing/text_normalization/es/data/numbers/hundreds.tsv new file mode 100644 index 0000000..bf651cd --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/hundreds.tsv @@ -0,0 +1,8 @@ +doscientos 2 +trescientos 3 +cuatrocientos 4 +quinientos 5 +seiscientos 6 +setecientos 7 +ochocientos 8 +novecientos 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/numbers/quantities.tsv b/fun_text_processing/text_normalization/es/data/numbers/quantities.tsv new file mode 100644 index 0000000..58bce3e --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/quantities.tsv @@ -0,0 +1,6 @@ +millón +millones +billón +billones +trillón +trillones \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/numbers/teen.tsv b/fun_text_processing/text_normalization/es/data/numbers/teen.tsv new file mode 100644 index 0000000..370526e --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/teen.tsv @@ -0,0 +1,10 @@ +diez 10 +once 11 +doce 12 +trece 13 +catorce 14 +quince 15 +dieciséis 16 +diecisiete 17 +dieciocho 18 +diecinueve 19 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/numbers/ties.tsv b/fun_text_processing/text_normalization/es/data/numbers/ties.tsv new file mode 100644 index 0000000..51b2108 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/ties.tsv @@ -0,0 +1,7 @@ +treinta 3 +cuarenta 4 +cincuenta 5 +sesenta 6 +setenta 7 +ochenta 8 +noventa 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/numbers/twenties.tsv b/fun_text_processing/text_normalization/es/data/numbers/twenties.tsv new file mode 100644 index 0000000..c378a3a --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/twenties.tsv @@ -0,0 +1,10 @@ +veinte 20 +veintiún 21 +veintidós 22 +veintitrés 23 +veinticuatro 24 +veinticinco 25 +veintiséis 26 +veintisiete 27 +veintiocho 28 +veintinueve 29 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/numbers/zero.tsv b/fun_text_processing/text_normalization/es/data/numbers/zero.tsv new file mode 100644 index 0000000..9457852 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/numbers/zero.tsv @@ -0,0 +1 @@ +cero 0 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/ordinals/__init__.py b/fun_text_processing/text_normalization/es/data/ordinals/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/ordinals/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/ordinals/digit.tsv b/fun_text_processing/text_normalization/es/data/ordinals/digit.tsv new file mode 100644 index 0000000..08d86ac --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/ordinals/digit.tsv @@ -0,0 +1,11 @@ +primero uno +primera una +primero un +segundo dos +tercero tres +cuarto cuatro +quinto cinco +sexto seis +séptimo siete +octavo ocho +noveno nueve \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/ordinals/hundreds.tsv b/fun_text_processing/text_normalization/es/data/ordinals/hundreds.tsv new file mode 100644 index 0000000..65867fd --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/ordinals/hundreds.tsv @@ -0,0 +1,18 @@ +centésimo ciento +centésimo cien +ducentésimo doscientos +ducentésima doscientas +tricentésimo trescientos +tricentésima trescientas +cuadringentésimo cuatrocientos +cuadringentésima cuatrocientas +quingentésimo quinientos +quingentésima quinientas +sexcentésimo seiscientos +sexcentésima seiscientas +septingentésimo setecientos +septingentésima setecientas +octingentésimo ochocientos +octingentésima ochocientas +noningentésimo novecientos +noningentésima novecientas \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/ordinals/teen.tsv b/fun_text_processing/text_normalization/es/data/ordinals/teen.tsv new file mode 100644 index 0000000..1ffcfb2 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/ordinals/teen.tsv @@ -0,0 +1,10 @@ +décimo diez +undécimo once +duodécimo doce +decimotercero trece +decimocuarto catorce +decimoquinto quince +decimosexto dieciséis +decimoséptimo diecisiete +decimooctavo dieciocho +decimonoveno diecinueve \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/ordinals/ties.tsv b/fun_text_processing/text_normalization/es/data/ordinals/ties.tsv new file mode 100644 index 0000000..21c488e --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/ordinals/ties.tsv @@ -0,0 +1,8 @@ +vigésimo veinte +trigésimo treinta +cuadragésimo cuarenta +quincuagésimo cincuenta +sexagésimo sesenta +septuagésimo setenta +octogésimo ochenta +nonagésimo noventa \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/ordinals/twenties.tsv b/fun_text_processing/text_normalization/es/data/ordinals/twenties.tsv new file mode 100644 index 0000000..e63a3e5 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/ordinals/twenties.tsv @@ -0,0 +1,11 @@ +vigesimoprimero veintiuno +vigesimoprimera veintiuna +vigesimoprimero veintiún +vigesimosegundo veintidós +vigesimotercero veintitrés +vigesimocuarto veinticuatro +vigesimoquinto veinticinco +vigesimosexto veintiséis +vigesimoséptimo veintisiete +vigesimooctavo veintiocho +vigesimonoveno veintinueve \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/roman/__init__.py b/fun_text_processing/text_normalization/es/data/roman/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/roman/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/roman/digit.tsv b/fun_text_processing/text_normalization/es/data/roman/digit.tsv new file mode 100644 index 0000000..0610b4a --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/roman/digit.tsv @@ -0,0 +1,9 @@ +i 1 +ii 2 +iii 3 +iv 4 +v 5 +vi 6 +vii 7 +viii 8 +ix 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/roman/hundreds.tsv b/fun_text_processing/text_normalization/es/data/roman/hundreds.tsv new file mode 100644 index 0000000..cdbdb68 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/roman/hundreds.tsv @@ -0,0 +1,9 @@ +c 1 +cc 2 +ccc 3 +cd 4 +d 5 +dc 6 +dcc 7 +dccc 8 +cm 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/roman/ties.tsv b/fun_text_processing/text_normalization/es/data/roman/ties.tsv new file mode 100644 index 0000000..ac043aa --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/roman/ties.tsv @@ -0,0 +1,9 @@ +x 1 +xx 2 +xxx 3 +xl 4 +l 5 +lx 6 +lxx 7 +lxxx 8 +xc 9 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/__init__.py b/fun_text_processing/text_normalization/es/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/data/time/afternoon_times.tsv b/fun_text_processing/text_normalization/es/data/time/afternoon_times.tsv new file mode 100644 index 0000000..25e75c8 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/afternoon_times.tsv @@ -0,0 +1,4 @@ +una +dos +tres +cuatro \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/alt_minutes.tsv b/fun_text_processing/text_normalization/es/data/time/alt_minutes.tsv new file mode 100644 index 0000000..6bdff30 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/alt_minutes.tsv @@ -0,0 +1,2 @@ +quince cuarto +treinta media \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/evening_times.tsv b/fun_text_processing/text_normalization/es/data/time/evening_times.tsv new file mode 100644 index 0000000..c77d4c7 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/evening_times.tsv @@ -0,0 +1,7 @@ +cinco +seis +siete +ocho +nueve +diez +once \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/hour_to_12.tsv b/fun_text_processing/text_normalization/es/data/time/hour_to_12.tsv new file mode 100644 index 0000000..e681afc --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/hour_to_12.tsv @@ -0,0 +1,12 @@ +1 12 +2 1 +3 2 +4 3 +5 4 +6 5 +7 6 +8 7 +9 8 +10 9 +11 10 +12 11 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/hour_to_24.tsv b/fun_text_processing/text_normalization/es/data/time/hour_to_24.tsv new file mode 100644 index 0000000..13f43dc --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/hour_to_24.tsv @@ -0,0 +1,25 @@ +1 0 +2 1 +3 2 +4 3 +5 4 +6 5 +7 6 +8 7 +9 8 +10 9 +11 10 +12 11 +13 12 +14 13 +15 14 +16 15 +17 16 +18 17 +19 18 +20 19 +21 20 +22 21 +23 22 +0 23 +1 24 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/hour_to_night.tsv b/fun_text_processing/text_normalization/es/data/time/hour_to_night.tsv new file mode 100644 index 0000000..b7765ac --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/hour_to_night.tsv @@ -0,0 +1,13 @@ +12 0 +1 13 +2 14 +3 15 +4 16 +5 17 +6 18 +7 19 +8 20 +9 21 +10 22 +11 23 +12 24 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/minute_to.tsv b/fun_text_processing/text_normalization/es/data/time/minute_to.tsv new file mode 100644 index 0000000..edab4d5 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/minute_to.tsv @@ -0,0 +1,59 @@ +1 59 +2 58 +3 57 +4 56 +5 55 +6 54 +7 53 +8 52 +9 51 +10 50 +11 49 +12 48 +13 47 +14 46 +15 45 +16 44 +17 43 +18 42 +19 41 +20 40 +21 39 +22 38 +23 37 +24 36 +25 35 +26 34 +27 33 +28 32 +29 31 +30 30 +31 29 +32 28 +33 27 +34 26 +35 25 +36 24 +37 23 +38 22 +39 21 +40 20 +41 19 +42 18 +43 17 +44 16 +45 15 +46 14 +47 13 +48 12 +49 11 +50 10 +51 9 +52 8 +53 7 +54 6 +55 5 +56 4 +57 3 +58 2 +59 1 diff --git a/fun_text_processing/text_normalization/es/data/time/morning_times.tsv b/fun_text_processing/text_normalization/es/data/time/morning_times.tsv new file mode 100644 index 0000000..e329184 --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/morning_times.tsv @@ -0,0 +1,12 @@ +un +una +dos +tres +cuatro +cinco +seis +siete +ocho +nueve +diez +once \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/time_suffix.tsv b/fun_text_processing/text_normalization/es/data/time/time_suffix.tsv new file mode 100644 index 0000000..9ba6b1c --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/time_suffix.tsv @@ -0,0 +1,20 @@ +p.m. pm +p. m. pm +p.m pm +p m. pm +pm pm +P.M. pm +P.M pm +P M. pm +P. M. pm +PM pm +a.m. am +a.m. am +a.m am +a m. am +am am +A.M. am +A.M am +A M. am +A. M. am +AM am \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/time/time_zone.tsv b/fun_text_processing/text_normalization/es/data/time/time_zone.tsv new file mode 100644 index 0000000..e310d8f --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/time/time_zone.tsv @@ -0,0 +1,7 @@ +cst c s t +cet c e t +pst p s t +est e s t +pt p t +et e t +gmt g m t \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/data/whitelist.tsv b/fun_text_processing/text_normalization/es/data/whitelist.tsv new file mode 100644 index 0000000..ecf6dcf --- /dev/null +++ b/fun_text_processing/text_normalization/es/data/whitelist.tsv @@ -0,0 +1,42 @@ +ud. usted +Ud. usted +uds. ustedes +Uds. ustedes +Vd. vosotros +Vds. vosotros +vd. vosotros +vds. vosotros +D. Don +Da. Donna +Dr. Doctor +Dra. Doctora +dr. doctor +dra. doctora +d. don +da. donna +E este +EE. Estados Unidos +ee. estados unidos +Gob. gobierno +gob. gobierno +esq. esquina +Av. avenida +Avda. avenida +av. avenida +avda. avenida +O oeste +pág. página +p.ej. por ejemplo +Prof. profesor +Profa. profesora +prof. profesor +profa. profesora +S sur +N norte +Sr. señor +sr. señor +Sra. señora +sra. señora +Srta. señorita +srta. señorita +tel. teléfono \ No newline at end of file diff --git a/fun_text_processing/text_normalization/es/graph_utils.py b/fun_text_processing/text_normalization/es/graph_utils.py new file mode 100644 index 0000000..2fc5f8f --- /dev/null +++ b/fun_text_processing/text_normalization/es/graph_utils.py @@ -0,0 +1,169 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, DAMO_SPACE +from fun_text_processing.text_normalization.es import LOCALIZATION +from fun_text_processing.text_normalization.es.utils import get_abs_path, load_labels +from pynini.lib import pynutil + +digits = pynini.project(pynini.string_file(get_abs_path("data/numbers/digit.tsv")), "input") +tens = pynini.project(pynini.string_file(get_abs_path("data/numbers/ties.tsv")), "input") +teens = pynini.project(pynini.string_file(get_abs_path("data/numbers/teen.tsv")), "input") +twenties = pynini.project(pynini.string_file(get_abs_path("data/numbers/twenties.tsv")), "input") +hundreds = pynini.project(pynini.string_file(get_abs_path("data/numbers/hundreds.tsv")), "input") + +accents = pynini.string_map([("á", "a"), ("é", "e"), ("í", "i"), ("ó", "o"), ("ú", "u")]) + +if LOCALIZATION == "am": # Setting localization for central and northern america formatting + cardinal_separator = pynini.string_map([",", DAMO_SPACE]) + decimal_separator = pynini.accep(".") +else: + cardinal_separator = pynini.string_map([".", DAMO_SPACE]) + decimal_separator = pynini.accep(",") + +ones = pynini.union("un", "ún") +fem_ones = pynini.union( + pynini.cross("un", "una"), pynini.cross("ún", "una"), pynini.cross("uno", "una") +) +one_to_one_hundred = pynini.union( + digits, "uno", tens, teens, twenties, tens + pynini.accep(" y ") + digits +) +fem_hundreds = hundreds @ pynini.cdrewrite(pynini.cross("ientos", "ientas"), "", "", DAMO_SIGMA) + + +def strip_accent(fst: "pynini.FstLike") -> "pynini.FstLike": + """ + Converts all accented vowels to non-accented equivalents + + Args: + fst: Any fst. Composes vowel conversion onto fst's output strings + """ + return fst @ pynini.cdrewrite(accents, "", "", DAMO_SIGMA) + + +def shift_cardinal_gender(fst: "pynini.FstLike") -> "pynini.FstLike": + """ + Applies gender conversion rules to a cardinal string. These include: rendering all masculine forms of "uno" (including apocopated forms) as "una" and + Converting all gendered numbers in the hundreds series (200,300,400...) to feminine equivalent (e.g. "doscientos" -> "doscientas"). Conversion only applies + to value place for <1000 and multiple of 1000. (e.g. "doscientos mil doscientos" -> "doscientas mil doscientas".) For place values greater than the thousands, there + is no gender shift as the higher powers of ten ("millones", "billones") are masculine nouns and any conversion would be formally + ungrammatical. + e.g. + "doscientos" -> "doscientas" + "doscientos mil" -> "doscientas mil" + "doscientos millones" -> "doscientos millones" + "doscientos mil millones" -> "doscientos mil millones" + "doscientos millones doscientos mil doscientos" -> "doscientos millones doscientas mil doscientas" + + Args: + fst: Any fst. Composes conversion onto fst's output strings + """ + before_mil = ( + DAMO_SPACE + + (pynini.accep("mil") | pynini.accep("milésimo")) + + pynini.closure(DAMO_SPACE + hundreds, 0, 1) + + pynini.closure(DAMO_SPACE + one_to_one_hundred, 0, 1) + + pynini.union(pynini.accep("[EOS]"), pynini.accep('"'), decimal_separator) + ) + before_double_digits = pynini.closure(DAMO_SPACE + one_to_one_hundred, 0, 1) + pynini.union( + pynini.accep("[EOS]"), pynini.accep('"') + ) + + fem_allign = pynini.cdrewrite( + fem_hundreds, "", before_mil, DAMO_SIGMA + ) # doscientas mil dosciento + fem_allign @= pynini.cdrewrite( + fem_hundreds, "", before_double_digits, DAMO_SIGMA + ) # doscientas mil doscienta + + fem_allign @= pynini.cdrewrite( + fem_ones, "", pynini.union("[EOS]", '"', decimal_separator), DAMO_SIGMA + ) # If before a quote or EOS, we know it's the end of a string + + return fst @ fem_allign + + +def shift_number_gender(fst: "pynini.FstLike") -> "pynini.FstLike": + """ + Performs gender conversion on all verbalized numbers in output. All values in the hundreds series (200,300,400) are changed to + feminine gender (e.g. "doscientos" -> "doscientas") and all forms of "uno" (including apocopated forms) are converted to "una". + This has no boundary restriction and will perform shift across all values in output string. + e.g. + "doscientos" -> "doscientas" + "doscientos millones" -> "doscientas millones" + "doscientos millones doscientos" -> "doscientas millones doscientas" + + Args: + fst: Any fst. Composes conversion onto fst's output strings + """ + fem_allign = pynini.cdrewrite(fem_hundreds, "", "", DAMO_SIGMA) + fem_allign @= pynini.cdrewrite( + fem_ones, "", pynini.union(DAMO_SPACE, pynini.accep("[EOS]"), pynini.accep('"')), DAMO_SIGMA + ) # If before a quote or EOS, we know it's the end of a string + + return fst @ fem_allign + + +def strip_cardinal_apocope(fst: "pynini.FstLike") -> "pynini.FstLike": + """ + Reverts apocope on cardinal strings in line with formation rules. e.g. "un" -> "uno". Due to cardinal formation rules, this in effect only + affects strings where the final value is a variation of "un". + e.g. + "un" -> "uno" + "veintiún" -> "veintiuno" + + Args: + fst: Any fst. Composes conversion onto fst's output strings + """ + # Since cardinals use apocope by default for large values (e.g. "millón"), this only needs to act on the last instance of one + strip = pynini.cross("un", "uno") | pynini.cross("ún", "uno") + strip = pynini.cdrewrite(strip, "", pynini.union("[EOS]", '"'), DAMO_SIGMA) + return fst @ strip + + +def add_cardinal_apocope_fem(fst: "pynini.FstLike") -> "pynini.FstLike": + """ + Adds apocope on cardinal strings in line with stressing rules. e.g. "una" -> "un". This only occurs when "una" precedes a stressed "a" sound in formal speech. This is not predictable + with text string, so is included for non-deterministic cases. + e.g. + "una" -> "un" + "veintiuna" -> "veintiun" + + Args: + fst: Any fst. Composes conversion onto fst's output strings + """ + # Since the stress trigger follows the cardinal string and only affects the preceding sound, this only needs to act on the last instance of one + strip = pynini.cross("una", "un") | pynini.cross("veintiuna", "veintiún") + strip = pynini.cdrewrite(strip, "", pynini.union("[EOS]", '"'), DAMO_SIGMA) + return fst @ strip + + +def roman_to_int(fst: "pynini.FstLike") -> "pynini.FstLike": + """ + Alters given fst to convert Roman integers (lower and upper cased) into Arabic numerals. Valid for values up to 1000. + e.g. + "V" -> "5" + "i" -> "1" + + Args: + fst: Any fst. Composes fst onto Roman conversion outputs. + """ + + def _load_roman(file: str): + roman = load_labels(get_abs_path(file)) + roman_numerals = [(x, y) for x, y in roman] + [(x.upper(), y) for x, y in roman] + return pynini.string_map(roman_numerals) + + digit = _load_roman("data/roman/digit.tsv") + ties = _load_roman("data/roman/ties.tsv") + hundreds = _load_roman("data/roman/hundreds.tsv") + + graph = ( + digit + | ties + (digit | pynutil.add_weight(pynutil.insert("0"), 0.01)) + | ( + hundreds + + (ties | pynutil.add_weight(pynutil.insert("0"), 0.01)) + + (digit | pynutil.add_weight(pynutil.insert("0"), 0.01)) + ) + ).optimize() + + return graph @ fst diff --git a/fun_text_processing/text_normalization/es/taggers/__init__.py b/fun_text_processing/text_normalization/es/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/taggers/cardinal.py b/fun_text_processing/text_normalization/es/taggers/cardinal.py new file mode 100644 index 0000000..a5b79be --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/cardinal.py @@ -0,0 +1,195 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + DAMO_WHITE_SPACE, + GraphFst, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es.graph_utils import cardinal_separator +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +zero = pynini.invert(pynini.string_file(get_abs_path("data/numbers/zero.tsv"))) +digit = pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv"))) +teen = pynini.invert(pynini.string_file(get_abs_path("data/numbers/teen.tsv"))) +ties = pynini.invert(pynini.string_file(get_abs_path("data/numbers/ties.tsv"))) +twenties = pynini.invert(pynini.string_file(get_abs_path("data/numbers/twenties.tsv"))) +hundreds = pynini.invert(pynini.string_file(get_abs_path("data/numbers/hundreds.tsv"))) + + +def filter_punctuation(fst: "pynini.FstLike") -> "pynini.FstLike": + """ + Helper function for parsing number strings. Converts common cardinal strings (groups of three digits delineated by 'cardinal_separator' - see graph_utils) + and converts to a string of digits: + "1 000" -> "1000" + "1.000.000" -> "1000000" + Args: + fst: Any pynini.FstLike object. Function composes fst onto string parser fst + + Returns: + fst: A pynini.FstLike object + """ + exactly_three_digits = DAMO_DIGIT**3 # for blocks of three + up_to_three_digits = pynini.closure(DAMO_DIGIT, 1, 3) # for start of string + + cardinal_string = pynini.closure( + DAMO_DIGIT, 1 + ) # For string w/o punctuation (used for page numbers, thousand series) + + cardinal_string |= ( + up_to_three_digits + + pynutil.delete(cardinal_separator) + + pynini.closure(exactly_three_digits + pynutil.delete(cardinal_separator)) + + exactly_three_digits + ) + + return cardinal_string @ fst + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals, e.g. + "1000" -> cardinal { integer: "mil" } + "2.000.000" -> cardinal { integer: "dos millones" } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + + # Any single digit + graph_digit = digit + digits_no_one = (DAMO_DIGIT - "1") @ graph_digit + + # Any double digit + graph_tens = teen + graph_tens |= ties + (pynutil.delete("0") | (pynutil.insert(" y ") + graph_digit)) + graph_tens |= twenties + + self.tens = graph_tens.optimize() + + self.two_digit_non_zero = pynini.union( + graph_digit, graph_tens, (pynini.cross("0", DAMO_SPACE) + graph_digit) + ).optimize() + + # Three digit strings + graph_hundreds = hundreds + pynini.union( + pynutil.delete("00"), + (insert_space + graph_tens), + (pynini.cross("0", DAMO_SPACE) + graph_digit), + ) + graph_hundreds |= pynini.cross("100", "cien") + graph_hundreds |= ( + pynini.cross("1", "ciento") + + insert_space + + pynini.union(graph_tens, pynutil.delete("0") + graph_digit) + ) + + self.hundreds = graph_hundreds.optimize() + + # For all three digit strings with leading zeroes (graph appends '0's to manage place in string) + graph_hundreds_component = pynini.union(graph_hundreds, pynutil.delete("0") + graph_tens) + + graph_hundreds_component_at_least_one_none_zero_digit = graph_hundreds_component | ( + pynutil.delete("00") + graph_digit + ) + graph_hundreds_component_at_least_one_none_zero_digit_no_one = graph_hundreds_component | ( + pynutil.delete("00") + digits_no_one + ) + + graph_thousands_component_at_least_one_none_zero_digit = pynini.union( + pynutil.delete("000") + graph_hundreds_component_at_least_one_none_zero_digit, + graph_hundreds_component_at_least_one_none_zero_digit_no_one + + pynutil.insert(" mil") + + ( + (insert_space + graph_hundreds_component_at_least_one_none_zero_digit) + | pynutil.delete("000") + ), + pynini.cross("001", "mil") + + ( + (insert_space + graph_hundreds_component_at_least_one_none_zero_digit) + | pynutil.delete("000") + ), + ) + + graph_thousands_component_at_least_one_none_zero_digit_no_one = pynini.union( + pynutil.delete("000") + graph_hundreds_component_at_least_one_none_zero_digit_no_one, + graph_hundreds_component_at_least_one_none_zero_digit_no_one + + pynutil.insert(" mil") + + ( + (insert_space + graph_hundreds_component_at_least_one_none_zero_digit) + | pynutil.delete("000") + ), + pynini.cross("001", "mil") + + ( + (insert_space + graph_hundreds_component_at_least_one_none_zero_digit) + | pynutil.delete("000") + ), + ) + + graph_million = pynutil.add_weight(pynini.cross("000001", "un millón"), -0.001) + graph_million |= ( + graph_thousands_component_at_least_one_none_zero_digit_no_one + + pynutil.insert(" millones") + ) + graph_million |= pynutil.delete("000000") + graph_million += insert_space + + graph_billion = pynutil.add_weight(pynini.cross("000001", "un billón"), -0.001) + graph_billion |= ( + graph_thousands_component_at_least_one_none_zero_digit_no_one + + pynutil.insert(" billones") + ) + graph_billion |= pynutil.delete("000000") + graph_billion += insert_space + + graph_trillion = pynutil.add_weight(pynini.cross("000001", "un trillón"), -0.001) + graph_trillion |= ( + graph_thousands_component_at_least_one_none_zero_digit_no_one + + pynutil.insert(" trillones") + ) + graph_trillion |= pynutil.delete("000000") + graph_trillion += insert_space + + graph = ( + graph_trillion + + graph_billion + + graph_million + + (graph_thousands_component_at_least_one_none_zero_digit | pynutil.delete("000000")) + ) + + self.graph = ( + ((DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT, 0)) + @ pynini.cdrewrite(pynini.closure(pynutil.insert("0")), "[BOS]", "", DAMO_SIGMA) + @ DAMO_DIGIT**24 + @ graph + @ pynini.cdrewrite(delete_space, "[BOS]", "", DAMO_SIGMA) + @ pynini.cdrewrite(delete_space, "", "[EOS]", DAMO_SIGMA) + @ pynini.cdrewrite( + pynini.cross(pynini.closure(DAMO_WHITE_SPACE, 2), DAMO_SPACE), + DAMO_ALPHA, + DAMO_ALPHA, + DAMO_SIGMA, + ) + ) + self.graph |= zero + + self.graph = filter_punctuation(self.graph).optimize() + + optional_minus_graph = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + + final_graph = ( + optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"') + ) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/date.py b/fun_text_processing/text_normalization/es/taggers/date.py new file mode 100644 index 0000000..0b82d4a --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/date.py @@ -0,0 +1,98 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SPACE, + GraphFst, + delete_extra_space, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +articles = pynini.union("de", "del", "el", "del año") +delete_leading_zero = (pynutil.delete("0") | (DAMO_DIGIT - "0")) + DAMO_DIGIT +month_numbers = pynini.string_file(get_abs_path("data/dates/months.tsv")) + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, e.g. + "01.04.2010" -> date { day: "un" month: "enero" year: "dos mil diez" preserve_order: true } + "marzo 4 2000" -> date { month: "marzo" day: "cuatro" year: "dos mil" } + "1990-20-01" -> date { year: "mil novecientos noventa" day: "veinte" month: "enero" } + + Args: + cardinal: cardinal GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool): + super().__init__(name="date", kind="classify", deterministic=deterministic) + + number_to_month = month_numbers.optimize() + month_graph = pynini.project(number_to_month, "output") + + numbers = cardinal.graph + optional_leading_zero = delete_leading_zero | DAMO_DIGIT + + # 01, 31, 1 + digit_day = optional_leading_zero @ pynini.union(*[str(x) for x in range(1, 32)]) @ numbers + day = (pynutil.insert('day: "') + digit_day + pynutil.insert('"')).optimize() + + digit_month = optional_leading_zero @ pynini.union(*[str(x) for x in range(1, 13)]) + number_to_month = digit_month @ number_to_month + + month_name = (pynutil.insert('month: "') + month_graph + pynutil.insert('"')).optimize() + month_number = ( + pynutil.insert('month: "') + number_to_month + pynutil.insert('"') + ).optimize() + + # prefer cardinal over year + year = (DAMO_DIGIT - "0") + pynini.closure(DAMO_DIGIT, 1, 3) # 90, 990, 1990 + year @= numbers + self.year = year + + year_only = pynutil.insert('year: "') + year + pynutil.insert('"') + year_with_articles = ( + pynutil.insert('year: "') + + pynini.closure(articles + DAMO_SPACE, 0, 1) + + year + + pynutil.insert('"') + ) + + graph_dmy = ( + day + + pynini.closure(pynutil.delete(" de")) + + DAMO_SPACE + + month_name + + pynini.closure(DAMO_SPACE + year_with_articles, 0, 1) + ) + + graph_mdy = ( # English influences on language + month_name + + delete_extra_space + + day + + pynini.closure(DAMO_SPACE + year_with_articles, 0, 1) + ) + + separators = [".", "-", "/"] + for sep in separators: + year_optional = pynini.closure(pynini.cross(sep, DAMO_SPACE) + year_only, 0, 1) + new_graph = day + pynini.cross(sep, DAMO_SPACE) + month_number + year_optional + graph_dmy |= new_graph + if not deterministic: + new_graph = month_number + pynini.cross(sep, DAMO_SPACE) + day + year_optional + graph_mdy |= new_graph + + dash = "-" + day_optional = pynini.closure(pynini.cross(dash, DAMO_SPACE) + day, 0, 1) + graph_ymd = ( + DAMO_DIGIT**4 @ year_only + pynini.cross(dash, DAMO_SPACE) + month_number + day_optional + ) + + final_graph = graph_dmy + pynutil.insert(" preserve_order: true") + final_graph |= graph_ymd + final_graph |= graph_mdy + + self.final_graph = final_graph.optimize() + self.fst = self.add_tokens(self.final_graph).optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/decimals.py b/fun_text_processing/text_normalization/es/taggers/decimals.py new file mode 100644 index 0000000..a68e0cc --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/decimals.py @@ -0,0 +1,128 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es.graph_utils import ( + cardinal_separator, + decimal_separator, + strip_cardinal_apocope, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +quantities = pynini.string_file(get_abs_path("data/numbers/quantities.tsv")) +digit = pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv"))) +zero = pynini.invert(pynini.string_file(get_abs_path("data/numbers/zero.tsv"))) + + +def get_quantity( + decimal_graph: "pynini.FstLike", cardinal_graph: "pynini.FstLike" +) -> "pynini.FstLike": + """ + Returns FST that transforms either a cardinal or decimal followed by a quantity into a numeral, + e.g. 2 millones -> integer_part: "dos" quantity: "millones" + e.g. 2,4 millones -> integer_part: "dos" fractional_part: "quatro" quantity: "millones" + e.g. 2,400 millones -> integer_part: "dos mil cuatrocientos" fractional_part: "quatro" quantity: "millones" + + Args: + decimal_graph: DecimalFST + cardinal_graph: CardinalFST + """ + numbers = pynini.closure(DAMO_DIGIT, 1, 6) @ cardinal_graph + numbers = pynini.cdrewrite(pynutil.delete(cardinal_separator), "", "", DAMO_SIGMA) @ numbers + + res = ( + pynutil.insert('integer_part: "') + + numbers # The cardinal we're passing only produces 'un' for one, so gender agreement is safe (all quantities are masculine). Limit to 10^6 power. + + pynutil.insert('"') + + DAMO_SPACE + + pynutil.insert('quantity: "') + + quantities + + pynutil.insert('"') + ) + res |= ( + decimal_graph + + DAMO_SPACE + + pynutil.insert('quantity: "') + + quantities + + pynutil.insert('"') + ) + return res + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal, e.g. + -11,4006 billones -> decimal { negative: "true" integer_part: "once" fractional_part: "cuatro cero cero seis" quantity: "billones" preserve_order: true } + 1 billón -> decimal { integer_part: "un" quantity: "billón" preserve_order: true } + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + graph_digit = digit | zero + + if not deterministic: + graph = pynini.union(graph_digit, cardinal.hundreds, cardinal.tens) + graph += pynini.closure(insert_space + graph) + + else: + # General pattern seems to be 1-3 digits: map as cardinal, default to digits otherwise \ + graph = pynini.union( + graph_digit, + cardinal.tens, + cardinal.hundreds, + graph_digit + pynini.closure(insert_space + graph_digit, 3), + zero + + pynini.closure(insert_space + zero) + + pynini.closure(insert_space + graph_digit), # For cases such as "1,010" + ) + + # Need to strip apocope everywhere BUT end of string + reverse_apocope = pynini.string_map([("un", "uno"), ("ún", "uno")]) + apply_reverse_apocope = pynini.cdrewrite(reverse_apocope, "", DAMO_SPACE, DAMO_SIGMA) + graph @= apply_reverse_apocope + + # Technically decimals should be space delineated groups of three, e.g. (1,333 333). This removes any possible spaces + strip_formatting = pynini.cdrewrite(delete_space, "", "", DAMO_SIGMA) + graph = strip_formatting @ graph + + self.graph = graph.optimize() + + graph_separator = pynutil.delete(decimal_separator) + optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true" '), 0, 1 + ) + + self.graph_fractional = ( + pynutil.insert('fractional_part: "') + self.graph + pynutil.insert('"') + ) + + # Integer graph maintains apocope except for ones place + graph_integer = ( + strip_cardinal_apocope(cardinal.graph) + if deterministic + else pynini.union(cardinal.graph, strip_cardinal_apocope(cardinal.graph)) + ) # Gives us forms w/ and w/o apocope + self.graph_integer = pynutil.insert('integer_part: "') + graph_integer + pynutil.insert('"') + final_graph_wo_sign = ( + self.graph_integer + graph_separator + insert_space + self.graph_fractional + ) + + self.final_graph_wo_negative = ( + final_graph_wo_sign | get_quantity(final_graph_wo_sign, cardinal.graph).optimize() + ) + final_graph = optional_graph_negative + self.final_graph_wo_negative + + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/electronic.py b/fun_text_processing/text_normalization/es/taggers/electronic.py new file mode 100644 index 0000000..37c8983 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/electronic.py @@ -0,0 +1,70 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + GraphFst, + insert_space, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path, load_labels +from pynini.lib import pynutil + +common_domains = [x[0] for x in load_labels(get_abs_path("data/electronic/domain.tsv"))] +symbols = [x[0] for x in load_labels(get_abs_path("data/electronic/symbols.tsv"))] + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: email addresses + e.g. "abc@hotmail.com" -> electronic { username: "abc" domain: "hotmail.com" preserve_order: true } + e.g. "www.abc.com/123" -> electronic { protocol: "www." domain: "abc.com/123" preserve_order: true } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="classify", deterministic=deterministic) + + dot = pynini.accep(".") + accepted_common_domains = pynini.union(*common_domains) + accepted_symbols = pynini.union(*symbols) - dot + accepted_characters = pynini.closure(DAMO_ALPHA | DAMO_DIGIT | accepted_symbols) + acceepted_characters_with_dot = pynini.closure( + DAMO_ALPHA | DAMO_DIGIT | accepted_symbols | dot + ) + + # email + username = ( + pynutil.insert('username: "') + + acceepted_characters_with_dot + + pynutil.insert('"') + + pynini.cross("@", " ") + ) + domain_graph = accepted_characters + dot + accepted_characters + domain_graph = pynutil.insert('domain: "') + domain_graph + pynutil.insert('"') + domain_common_graph = ( + pynutil.insert('domain: "') + + accepted_characters + + accepted_common_domains + + pynini.closure( + (accepted_symbols | dot) + pynini.closure(accepted_characters, 1), 0, 1 + ) + + pynutil.insert('"') + ) + graph = (username + domain_graph) | domain_common_graph + + # url + protocol_start = pynini.accep("https://") | pynini.accep("http://") + protocol_end = ( + pynini.accep("www.") + if deterministic + else pynini.accep("www.") | pynini.cross("www.", "doble ve doble ve doble ve.") + ) + protocol = protocol_start | protocol_end | (protocol_start + protocol_end) + protocol = pynutil.insert('protocol: "') + protocol + pynutil.insert('"') + graph |= protocol + insert_space + (domain_graph | domain_common_graph) + self.graph = graph + + final_graph = self.add_tokens(self.graph + pynutil.insert(" preserve_order: true")) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/fraction.py b/fun_text_processing/text_normalization/es/taggers/fraction.py new file mode 100644 index 0000000..125a79c --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/fraction.py @@ -0,0 +1,148 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +ordinal_exceptions = pynini.string_file(get_abs_path("data/fractions/ordinal_exceptions.tsv")) +higher_powers_of_ten = pynini.string_file(get_abs_path("data/fractions/powers_of_ten.tsv")) + + +class FractionFst(GraphFst): + """ + Finite state transducer for classifying fraction + "23 4/5" -> + tokens { fraction { integer: "veintitrés" numerator: "cuatro" denominator: "quinto" mophosyntactic_features: "ordinal" } } + + Args: + cardinal: CardinalFst + ordinal: OrdinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, ordinal: GraphFst, deterministic: bool = True): + super().__init__(name="fraction", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph + ordinal_graph = ordinal.graph + + # 2-10 are all ordinals + three_to_ten = pynini.string_map( + [ + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + ] + ) + block_three_to_ten = pynutil.delete(three_to_ten) # To block cardinal productions + if not deterministic: # Multiples of tens are sometimes rendered as ordinals + three_to_ten |= pynini.string_map( + [ + "20", + "30", + "40", + "50", + "60", + "70", + "80", + "90", + ] + ) + graph_three_to_ten = three_to_ten @ ordinal_graph + graph_three_to_ten @= pynini.cdrewrite(ordinal_exceptions, "", "", DAMO_SIGMA) + + # Higher powers of tens (and multiples) are converted to ordinals. + hundreds = pynini.string_map( + [ + "100", + "200", + "300", + "400", + "500", + "600", + "700", + "800", + "900", + ] + ) + graph_hundreds = hundreds @ ordinal_graph + + multiples_of_thousand = ordinal.multiples_of_thousand # So we can have X milésimos + + graph_higher_powers_of_ten = ( + pynini.closure(ordinal.one_to_one_thousand + DAMO_SPACE, 0, 1) + + pynini.closure("mil ", 0, 1) + + pynini.closure(ordinal.one_to_one_thousand + DAMO_SPACE, 0, 1) + ) # x millones / x mil millones / x mil z millones + graph_higher_powers_of_ten += higher_powers_of_ten + graph_higher_powers_of_ten = cardinal_graph @ graph_higher_powers_of_ten + graph_higher_powers_of_ten @= pynini.cdrewrite( + pynutil.delete("un "), + pynini.accep("[BOS]"), + pynini.project(higher_powers_of_ten, "output"), + DAMO_SIGMA, + ) # we drop 'un' from these ordinals (millionths, not one-millionths) + + graph_higher_powers_of_ten = ( + multiples_of_thousand | graph_hundreds | graph_higher_powers_of_ten + ) + block_higher_powers_of_ten = pynutil.delete( + pynini.project(graph_higher_powers_of_ten, "input") + ) # For cardinal graph + + graph_fractions_ordinals = graph_higher_powers_of_ten | graph_three_to_ten + graph_fractions_ordinals += pynutil.insert( + '" morphosyntactic_features: "ordinal"' + ) # We note the root for processing later + + # Blocking the digits and hundreds from Cardinal graph + graph_fractions_cardinals = pynini.cdrewrite( + block_three_to_ten | block_higher_powers_of_ten, + pynini.accep("[BOS]"), + pynini.accep("[EOS]"), + DAMO_SIGMA, + ) + graph_fractions_cardinals @= DAMO_CHAR.plus @ pynini.cdrewrite( + pynutil.delete("0"), pynini.accep("[BOS]"), pynini.accep("[EOS]"), DAMO_SIGMA + ) # Empty characters become '0' for DAMO_CHAR fst, so need to block + graph_fractions_cardinals @= cardinal_graph + graph_fractions_cardinals += pynutil.insert( + '" morphosyntactic_features: "add_root"' + ) # blocking these entries to reduce erroneous possibilities in debugging + + if deterministic: + graph_fractions_cardinals = ( + pynini.closure(DAMO_DIGIT, 1, 2) @ graph_fractions_cardinals + ) # Past hundreds the conventional scheme can be hard to read. For determinism we stop here + + graph_denominator = pynini.union( + graph_fractions_ordinals, + graph_fractions_cardinals, + pynutil.add_weight(cardinal_graph + pynutil.insert('"'), 0.001), + ) # Last form is simply recording the cardinal. Weighting so last resort + + integer = ( + pynutil.insert('integer_part: "') + cardinal_graph + pynutil.insert('"') + DAMO_SPACE + ) + numerator = ( + pynutil.insert('numerator: "') + + cardinal_graph + + (pynini.cross("/", '" ') | pynini.cross(" / ", '" ')) + ) + denominator = pynutil.insert('denominator: "') + graph_denominator + + self.graph = pynini.closure(integer, 0, 1) + numerator + denominator + + final_graph = self.add_tokens(self.graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/measure.py b/fun_text_processing/text_normalization/es/taggers/measure.py new file mode 100644 index 0000000..d1a3003 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/measure.py @@ -0,0 +1,168 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_NON_BREAKING_SPACE, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + convert_space, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es.graph_utils import strip_cardinal_apocope +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +unit = pynini.string_file(get_abs_path("data/measures/measurements.tsv")) +unit_plural_fem = pynini.string_file(get_abs_path("data/measures/measurements_plural_fem.tsv")) +unit_plural_masc = pynini.string_file(get_abs_path("data/measures/measurements_plural_masc.tsv")) + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure, e.g. + "2,4 g" -> measure { cardinal { integer_part: "dos" fractional_part: "cuatro" units: "gramos" preserve_order: true } } + "1 g" -> measure { cardinal { integer: "un" units: "gramo" preserve_order: true } } + "1 millón g" -> measure { cardinal { integer: "un quantity: "millón" units: "gramos" preserve_order: true } } + e.g. "a-8" —> "a ocho" + e.g. "1,2-a" —> "uno coma dos a" + This class also converts words containing numbers and letters + e.g. "a-8" —> "a ocho" + e.g. "1,2-a" —> "uno coma dos a" + + + Args: + cardinal: CardinalFst + decimal: DecimalFst + fraction: FractionFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__( + self, cardinal: GraphFst, decimal: GraphFst, fraction: GraphFst, deterministic: bool = True + ): + super().__init__(name="measure", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph + + unit_singular = unit + unit_plural = unit_singular @ (unit_plural_fem | unit_plural_masc) + + graph_unit_singular = convert_space(unit_singular) + graph_unit_plural = convert_space(unit_plural) + + optional_graph_negative = pynini.closure("-", 0, 1) + + graph_unit_denominator = ( + pynini.cross("/", "por") + pynutil.insert(DAMO_NON_BREAKING_SPACE) + graph_unit_singular + ) + + optional_unit_denominator = pynini.closure( + pynutil.insert(DAMO_NON_BREAKING_SPACE) + graph_unit_denominator, + 0, + 1, + ) + + unit_plural = ( + pynutil.insert('units: "') + + ((graph_unit_plural + optional_unit_denominator) | graph_unit_denominator) + + pynutil.insert('"') + ) + + unit_singular_graph = ( + pynutil.insert('units: "') + + ((graph_unit_singular + optional_unit_denominator) | graph_unit_denominator) + + pynutil.insert('"') + ) + + subgraph_decimal = ( + decimal.fst + insert_space + pynini.closure(DAMO_SPACE, 0, 1) + unit_plural + ) + + subgraph_cardinal = ( + (optional_graph_negative + (DAMO_SIGMA - "1")) @ cardinal.fst + + insert_space + + pynini.closure(delete_space, 0, 1) + + unit_plural + ) + + subgraph_cardinal |= ( + (optional_graph_negative + pynini.accep("1")) @ cardinal.fst + + insert_space + + pynini.closure(delete_space, 0, 1) + + unit_singular_graph + ) + + subgraph_fraction = ( + fraction.fst + insert_space + pynini.closure(delete_space, 0, 1) + unit_singular_graph + ) + + decimal_times = ( + pynutil.insert("decimal { ") + + decimal.final_graph_wo_negative + + pynutil.insert(' } units: "') + + pynini.union("x", "X") + + pynutil.insert('"') + ) + + cardinal_times = ( + pynutil.insert('cardinal { integer: "') + + strip_cardinal_apocope(cardinal_graph) + + pynutil.insert('" } units: "') + + pynini.union("x", "X") + + pynutil.insert('"') + ) + + cardinal_dash_alpha = ( + pynutil.insert('cardinal { integer: "') + + strip_cardinal_apocope(cardinal_graph) + + pynutil.delete("-") + + pynutil.insert('" } units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.insert('"') + ) + + decimal_dash_alpha = ( + pynutil.insert("decimal { ") + + decimal.final_graph_wo_negative + + pynutil.delete("-") + + pynutil.insert(' } units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.insert('"') + ) + + alpha_dash_cardinal = ( + pynutil.insert('units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.delete("-") + + pynutil.insert('"') + + pynutil.insert(' cardinal { integer: "') + + cardinal_graph + + pynutil.insert('" } preserve_order: true') + ) + + alpha_dash_decimal = ( + pynutil.insert('units: "') + + pynini.closure(DAMO_ALPHA, 1) + + pynutil.delete("-") + + pynutil.insert('"') + + pynutil.insert(" decimal { ") + + decimal.final_graph_wo_negative + + pynutil.insert(" } preserve_order: true") + ) + + final_graph = ( + subgraph_decimal + | subgraph_cardinal + | cardinal_dash_alpha + | alpha_dash_cardinal + | decimal_dash_alpha + | subgraph_fraction + | decimal_times + | cardinal_times + | alpha_dash_decimal + ) + final_graph += pynutil.insert(" preserve_order: true") + final_graph = self.add_tokens(final_graph) + + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/money.py b/fun_text_processing/text_normalization/es/taggers/money.py new file mode 100644 index 0000000..9d78d86 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/money.py @@ -0,0 +1,209 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es.graph_utils import decimal_separator +from fun_text_processing.text_normalization.es.utils import get_abs_path, load_labels +from pynini.lib import pynutil + +maj_singular_labels = load_labels(get_abs_path("data/money/currency_major.tsv")) +maj_singular = pynini.string_file((get_abs_path("data/money/currency_major.tsv"))) +min_singular = pynini.string_file(get_abs_path("data/money/currency_minor.tsv")) +fem_plural = pynini.string_file((get_abs_path("data/money/currency_plural_fem.tsv"))) +masc_plural = pynini.string_file((get_abs_path("data/money/currency_plural_masc.tsv"))) + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money, e.g. + "€1" -> money { currency_maj: "euro" integer_part: "un"} + "€1,000" -> money { currency_maj: "euro" integer_part: "un" } + "€1,001" -> money { currency_maj: "euro" integer_part: "un" fractional_part: "cero cero un" } + "£1,4" -> money { integer_part: "una" currency_maj: "libra" fractional_part: "cuarenta" preserve_order: true } + -> money { integer_part: "una" currency_maj: "libra" fractional_part: "cuarenta" currency_min: "penique" preserve_order: true } + "0,01 £" -> money { fractional_part: "un" currency_min: "penique" preserve_order: true } + "0,02 £" -> money { fractional_part: "dos" currency_min: "peniques" preserve_order: true } + "£0,01 million" -> money { currency_maj: "libra" integer_part: "cero" fractional_part: "cero un" quantity: "million" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.graph + graph_decimal_final = decimal.final_graph_wo_negative + + maj_singular_graph = maj_singular + min_singular_graph = min_singular + maj_plural_graph = maj_singular @ (fem_plural | masc_plural) + min_plural_graph = min_singular @ (fem_plural | masc_plural) + + graph_maj_singular = ( + pynutil.insert('currency_maj: "') + maj_singular_graph + pynutil.insert('"') + ) + graph_maj_plural = ( + pynutil.insert('currency_maj: "') + maj_plural_graph + pynutil.insert('"') + ) + + graph_integer_one = ( + pynutil.insert('integer_part: "') + pynini.cross("1", "un") + pynutil.insert('"') + ) + + decimal_with_quantity = (DAMO_SIGMA + DAMO_ALPHA) @ graph_decimal_final + + graph_decimal_plural = pynini.union( + graph_maj_plural + + pynini.closure(delete_space, 0, 1) + + insert_space + + graph_decimal_final, # $1,05 + graph_decimal_final + + pynini.closure(delete_space, 0, 1) + + insert_space + + graph_maj_plural, # 1,05 $ + ) + graph_decimal_plural = ( + (DAMO_SIGMA - "1") + decimal_separator + DAMO_SIGMA + ) @ graph_decimal_plural # Can't have "un euros" + + graph_decimal_singular = pynini.union( + graph_maj_singular + + pynini.closure(delete_space, 0, 1) + + insert_space + + graph_decimal_final, # $1,05 + graph_decimal_final + + pynini.closure(delete_space, 0, 1) + + insert_space + + graph_maj_singular, # 1,05 $ + ) + graph_decimal_singular = ( + pynini.accep("1") + decimal_separator + DAMO_SIGMA + ) @ graph_decimal_singular + + graph_decimal = pynini.union( + graph_decimal_singular, + graph_decimal_plural, + graph_maj_plural + + pynini.closure(delete_space, 0, 1) + + insert_space + + decimal_with_quantity, + ) + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "1") @ cardinal_graph) + + pynutil.insert('"') + ) + + graph_integer_only = pynini.union( + graph_maj_singular + + pynini.closure(delete_space, 0, 1) + + insert_space + + graph_integer_one, + graph_integer_one + + pynini.closure(delete_space, 0, 1) + + insert_space + + graph_maj_singular, + ) + graph_integer_only |= pynini.union( + graph_maj_plural + pynini.closure(delete_space, 0, 1) + insert_space + graph_integer, + graph_integer + pynini.closure(delete_space, 0, 1) + insert_space + graph_maj_plural, + ) + + graph = graph_integer_only | graph_decimal + + # remove trailing zeros of non zero number in the first 2 digits and fill up to 2 digits + # e.g. 2000 -> 20, 0200->02, 01 -> 01, 10 -> 10 + # not accepted: 002, 00, 0, + two_digits_fractional_part = ( + pynini.closure(DAMO_DIGIT) + (DAMO_DIGIT - "0") + pynini.closure(pynutil.delete("0")) + ) @ ( + (pynutil.delete("0") + (DAMO_DIGIT - "0")) + | ((DAMO_DIGIT - "0") + pynutil.insert("0")) + | ((DAMO_DIGIT - "0") + DAMO_DIGIT) + ) + + graph_min_singular = ( + pynutil.insert('currency_min: "') + min_singular_graph + pynutil.insert('"') + ) + graph_min_plural = ( + pynutil.insert('currency_min: "') + min_plural_graph + pynutil.insert('"') + ) + + # format ** euro ** cent + decimal_graph_with_minor = None + for curr_symbol, _ in maj_singular_labels: + preserve_order = pynutil.insert(" preserve_order: true") + + integer_plus_maj = pynini.union( + graph_integer + insert_space + pynutil.insert(curr_symbol) @ graph_maj_plural, + graph_integer_one + insert_space + pynutil.insert(curr_symbol) @ graph_maj_singular, + ) + # non zero integer part + integer_plus_maj = (pynini.closure(DAMO_DIGIT) - "0") @ integer_plus_maj + + graph_fractional_one = ( + pynutil.insert('fractional_part: "') + + two_digits_fractional_part @ pynini.cross("1", "un") + + pynutil.insert('"') + ) + + graph_fractional = ( + two_digits_fractional_part + @ (pynini.closure(DAMO_DIGIT, 1, 2) - "1") + @ cardinal.two_digit_non_zero + ) + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_fractional + pynutil.insert('"') + ) + + fractional_plus_min = pynini.union( + graph_fractional + insert_space + pynutil.insert(curr_symbol) @ graph_min_plural, + graph_fractional_one + + insert_space + + pynutil.insert(curr_symbol) @ graph_min_singular, + ) + + decimal_graph_with_minor_curr = ( + integer_plus_maj + pynini.cross(decimal_separator, DAMO_SPACE) + fractional_plus_min + ) + decimal_graph_with_minor_curr |= pynutil.add_weight( + integer_plus_maj + + pynini.cross(decimal_separator, DAMO_SPACE) + + pynutil.insert('fractional_part: "') + + two_digits_fractional_part @ cardinal.two_digit_non_zero + + pynutil.insert('"'), + weight=0.0001, + ) + + decimal_graph_with_minor_curr |= pynutil.delete("0,") + fractional_plus_min + decimal_graph_with_minor_curr = pynini.union( + pynutil.delete(curr_symbol) + + pynini.closure(delete_space, 0, 1) + + decimal_graph_with_minor_curr + + preserve_order, + decimal_graph_with_minor_curr + + preserve_order + + pynini.closure(delete_space, 0, 1) + + pynutil.delete(curr_symbol), + ) + + decimal_graph_with_minor = ( + decimal_graph_with_minor_curr + if decimal_graph_with_minor is None + else pynini.union(decimal_graph_with_minor, decimal_graph_with_minor_curr) + ) + + final_graph = graph | pynutil.add_weight(decimal_graph_with_minor, -0.001) + + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/ordinal.py b/fun_text_processing/text_normalization/es/taggers/ordinal.py new file mode 100644 index 0000000..a4e0920 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/ordinal.py @@ -0,0 +1,173 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, +) +from fun_text_processing.text_normalization.es.graph_utils import roman_to_int, strip_accent +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +digit = pynini.invert(pynini.string_file(get_abs_path("data/ordinals/digit.tsv"))) +teens = pynini.invert(pynini.string_file(get_abs_path("data/ordinals/teen.tsv"))) +twenties = pynini.invert(pynini.string_file(get_abs_path("data/ordinals/twenties.tsv"))) +ties = pynini.invert(pynini.string_file(get_abs_path("data/ordinals/ties.tsv"))) +hundreds = pynini.invert(pynini.string_file(get_abs_path("data/ordinals/hundreds.tsv"))) + + +def get_one_to_one_thousand(cardinal: "pynini.FstLike") -> "pynini.FstLike": + """ + Produces an acceptor for verbalizations of all numbers from 1 to 1000. Needed for ordinals and fractions. + + Args: + cardinal: CardinalFst + + Returns: + fst: A pynini.FstLike object + """ + numbers = pynini.string_map([str(_) for _ in range(1, 1000)]) @ cardinal + return pynini.project(numbers, "output").optimize() + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying ordinal + "21.º" -> ordinal { integer: "vigésimo primero" morphosyntactic_features: "gender_masc" } + This class converts ordinal up to the millionth (millonésimo) order (exclusive). + + This FST also records the ending of the ordinal (called "morphosyntactic_features"): + either as gender_masc, gender_fem, or apocope. Also introduces plural feature for non-deterministic graphs. + + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="ordinal", kind="classify") + cardinal_graph = cardinal.graph + + graph_digit = digit.optimize() + graph_teens = teens.optimize() + graph_ties = ties.optimize() + graph_twenties = twenties.optimize() + graph_hundreds = hundreds.optimize() + + if not deterministic: + # Some alternative derivations + graph_ties = graph_ties | pynini.cross("sesenta", "setuagésimo") + + graph_teens = graph_teens | pynini.cross("once", "decimoprimero") + graph_teens |= pynini.cross("doce", "decimosegundo") + + graph_digit = graph_digit | pynini.cross("nueve", "nono") + graph_digit |= pynini.cross("siete", "sétimo") + + graph_tens_component = ( + graph_teens + | (graph_ties + pynini.closure(pynini.cross(" y ", DAMO_SPACE) + graph_digit, 0, 1)) + | graph_twenties + ) + + graph_hundred_component = pynini.union( + graph_hundreds + + pynini.closure(DAMO_SPACE + pynini.union(graph_tens_component, graph_digit), 0, 1), + graph_tens_component, + graph_digit, + ) + + # Need to go up to thousands for fractions + self.one_to_one_thousand = get_one_to_one_thousand(cardinal_graph) + + thousands = pynini.cross("mil", "milésimo") + + graph_thousands = ( + strip_accent(self.one_to_one_thousand) + DAMO_SPACE + thousands + ) # Cardinals become prefix for thousands series. Snce accent on the powers of ten we strip accent from leading words + graph_thousands @= pynini.cdrewrite( + delete_space, "", "milésimo", DAMO_SIGMA + ) # merge as a prefix + graph_thousands |= thousands + + self.multiples_of_thousand = (cardinal_graph @ graph_thousands).optimize() + + if ( + not deterministic + ): # Formally the words preceding the power of ten should be a prefix, but some maintain word boundaries. + graph_thousands |= ( + (self.one_to_one_thousand @ graph_hundred_component) + DAMO_SPACE + thousands + ) + + graph_thousands += pynini.closure(DAMO_SPACE + graph_hundred_component, 0, 1) + + ordinal_graph = graph_thousands | graph_hundred_component + ordinal_graph = cardinal_graph @ ordinal_graph + + if not deterministic: + # The 10's and 20's series can also be two words + split_words = pynini.cross("decimo", "décimo ") | pynini.cross("vigesimo", "vigésimo ") + split_words = pynini.cdrewrite(split_words, "", DAMO_CHAR, DAMO_SIGMA) + ordinal_graph |= ordinal_graph @ split_words + + # If "octavo" is preceeded by the "o" within string, it needs deletion + ordinal_graph @= pynini.cdrewrite(pynutil.delete("o"), "", "octavo", DAMO_SIGMA) + + self.graph = ordinal_graph.optimize() + + masc = pynini.accep("gender_masc") + fem = pynini.accep("gender_fem") + apocope = pynini.accep("apocope") + + delete_period = pynini.closure( + pynutil.delete("."), 0, 1 + ) # Sometimes the period is omitted f + + accept_masc = delete_period + pynini.cross("º", masc) + accep_fem = delete_period + pynini.cross("ª", fem) + accep_apocope = delete_period + pynini.cross("ᵉʳ", apocope) + + # Managing Romanization + graph_roman = ( + pynutil.insert('integer: "') + roman_to_int(ordinal_graph) + pynutil.insert('"') + ) + if not deterministic: + # Introduce plural + plural = pynini.closure(pynutil.insert("/plural"), 0, 1) + accept_masc += plural + accep_fem += plural + + # Romanizations have no morphology marker, so in non-deterministic case we provide option for all + insert_morphology = pynutil.insert(pynini.union(masc, fem)) + plural + insert_morphology |= pynutil.insert(apocope) + insert_morphology = ( + pynutil.insert(' morphosyntactic_features: "') + + insert_morphology + + pynutil.insert('"') + ) + + graph_roman += insert_morphology + + else: + # We insert both genders as default + graph_roman += pynutil.insert( + ' morphosyntactic_features: "gender_masc"' + ) | pynutil.insert(' morphosyntactic_features: "gender_fem"') + + # Rest of graph + convert_abbreviation = accept_masc | accep_fem | accep_apocope + + graph = ( + pynutil.insert('integer: "') + + ordinal_graph + + pynutil.insert('"') + + pynutil.insert(' morphosyntactic_features: "') + + convert_abbreviation + + pynutil.insert('"') + ) + graph = pynini.union(graph, graph_roman) + + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/telephone.py b/fun_text_processing/text_normalization/es/taggers/telephone.py new file mode 100644 index 0000000..9c4ca5b --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/telephone.py @@ -0,0 +1,131 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, GraphFst, insert_space +from fun_text_processing.text_normalization.es.graph_utils import ones +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +graph_digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv")) +graph_ties = pynini.string_file(get_abs_path("data/numbers/ties.tsv")) +graph_teen = pynini.string_file(get_abs_path("data/numbers/teen.tsv")) +graph_twenties = pynini.string_file(get_abs_path("data/numbers/twenties.tsv")) + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone numbers, e.g. + 123-123-5678 -> { number_part: "uno dos tres uno dos tres cinco seis siete ocho" }. + In Spanish, digits are generally read individually, or as 2-digit numbers, + eg. "123" = "uno dos tres", + "1234" = "doce treinta y cuatro". + This will verbalize sequences of 10 (3+3+4 e.g. 123-456-7890). + 9 (3+3+3 e.g. 123-456-789) and 8 (4+4 e.g. 1234-5678) digits. + + (we ignore more complicated cases such as "doscientos y dos" or "tres nueves"). + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="telephone", kind="classify") + + # create `single_digits` and `double_digits` graphs as these will be + # the building blocks of possible telephone numbers + single_digits = pynini.invert(graph_digit).optimize() | pynini.cross("0", "cero") + + double_digits = pynini.union( + graph_twenties, + graph_teen, + (graph_ties + pynutil.delete("0")), + (graph_ties + insert_space + pynutil.insert("y") + insert_space + graph_digit), + ) + double_digits = pynini.invert(double_digits) + + # define `ten_digit_graph`, `nine_digit_graph`, `eight_digit_graph` + # which produces telephone numbers spoken (1) only with single digits, + # or (2) spoken with double digits (and sometimes single digits) + + # 10-digit option (1): all single digits + ten_digit_graph = ( + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + single_digits + ) + + # 9-digit option (1): all single digits + nine_digit_graph = ( + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 2, 2) + + single_digits + ) + + # 8-digit option (1): all single digits + eight_digit_graph = ( + pynini.closure(single_digits + insert_space, 4, 4) + + pynutil.delete("-") + + pynini.closure(single_digits + insert_space, 3, 3) + + single_digits + ) + + if not deterministic: + # 10-digit option (2): (1+2) + (1+2) + (2+2) digits + ten_digit_graph |= ( + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + # 9-digit option (2): (1+2) + (1+2) + (1+2) digits + nine_digit_graph |= ( + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + single_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + single_digits + + insert_space + + double_digits + ) + + # 8-digit option (2): (2+2) + (2+2) digits + eight_digit_graph |= ( + double_digits + + insert_space + + double_digits + + insert_space + + pynutil.delete("-") + + double_digits + + insert_space + + double_digits + ) + + number_part = pynini.union(ten_digit_graph, nine_digit_graph, eight_digit_graph) + number_part @= pynini.cdrewrite(pynini.cross(ones, "uno"), "", "", DAMO_SIGMA) + + number_part = pynutil.insert('number_part: "') + number_part + pynutil.insert('"') + + graph = number_part + final_graph = self.add_tokens(graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/time.py b/fun_text_processing/text_normalization/es/taggers/time.py new file mode 100644 index 0000000..f8f77e9 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/time.py @@ -0,0 +1,226 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + GraphFst, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +time_zone_graph = pynini.string_file(get_abs_path("data/time/time_zone.tsv")) +suffix = pynini.string_file(get_abs_path("data/time/time_suffix.tsv")) + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time, e.g. + "02:15 est" -> time { hours: "dos" minutes: "quince" zone: "e s t"} + "2 h" -> time { hours: "dos" } + "9 h" -> time { hours: "nueve" } + "02:15:10 h" -> time { hours: "dos" minutes: "quince" seconds: "diez"} + + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = True): + super().__init__(name="time", kind="classify", deterministic=deterministic) + + delete_time_delimiter = pynutil.delete(pynini.union(".", ":")) + + one = pynini.string_map([("un", "una"), ("ún", "una")]) + change_one = pynini.cdrewrite(one, "", "", DAMO_SIGMA) + cardinal_graph = cardinal.graph @ change_one + + day_suffix = pynutil.insert('suffix: "') + suffix + pynutil.insert('"') + day_suffix = delete_space + insert_space + day_suffix + + delete_hora_suffix = delete_space + insert_space + pynutil.delete("h") + delete_minute_suffix = delete_space + insert_space + pynutil.delete("min") + delete_second_suffix = delete_space + insert_space + pynutil.delete("s") + + labels_hour_24 = [ + str(x) for x in range(0, 25) + ] # Can see both systems. Twelve hour requires am/pm for ambiguity resolution + labels_hour_12 = [str(x) for x in range(1, 13)] + labels_minute_single = [str(x) for x in range(1, 10)] + labels_minute_double = [str(x) for x in range(10, 60)] + + delete_leading_zero_to_double_digit = ( + pynini.closure(pynutil.delete("0") | (DAMO_DIGIT - "0"), 0, 1) + DAMO_DIGIT + ) + + graph_24 = ( + pynini.closure(DAMO_DIGIT, 1, 2) + @ delete_leading_zero_to_double_digit + @ pynini.union(*labels_hour_24) + ) + graph_12 = ( + pynini.closure(DAMO_DIGIT, 1, 2) + @ delete_leading_zero_to_double_digit + @ pynini.union(*labels_hour_12) + ) + + graph_hour_24 = graph_24 @ cardinal_graph + graph_hour_12 = graph_12 @ cardinal_graph + + graph_minute_single = delete_leading_zero_to_double_digit @ pynini.union( + *labels_minute_single + ) + graph_minute_double = pynini.union(*labels_minute_double) + + graph_minute = pynini.union(graph_minute_single, graph_minute_double) @ cardinal_graph + + final_graph_hour_only_24 = ( + pynutil.insert('hours: "') + graph_hour_24 + pynutil.insert('"') + delete_hora_suffix + ) + final_graph_hour_only_12 = ( + pynutil.insert('hours: "') + graph_hour_12 + pynutil.insert('"') + day_suffix + ) + + final_graph_hour_24 = pynutil.insert('hours: "') + graph_hour_24 + pynutil.insert('"') + final_graph_hour_12 = pynutil.insert('hours: "') + graph_hour_12 + pynutil.insert('"') + + final_graph_minute = pynutil.insert('minutes: "') + graph_minute + pynutil.insert('"') + final_graph_second = pynutil.insert('seconds: "') + graph_minute + pynutil.insert('"') + final_time_zone_optional = pynini.closure( + delete_space + + insert_space + + pynutil.insert('zone: "') + + time_zone_graph + + pynutil.insert('"'), + 0, + 1, + ) + + # 02.30 h + graph_hm = ( + final_graph_hour_24 + + delete_time_delimiter + + (pynutil.delete("00") | (insert_space + final_graph_minute)) + + pynini.closure( + delete_time_delimiter + + (pynini.cross("00", ' seconds: "0"') | (insert_space + final_graph_second)), + 0, + 1, + ) # For seconds 2.30.35 h + + pynini.closure(delete_hora_suffix, 0, 1) # 2.30 is valid if unambiguous + + final_time_zone_optional + ) + + # 2 h 30 min + graph_hm |= ( + final_graph_hour_24 + + delete_hora_suffix + + delete_space + + (pynutil.delete("00") | (insert_space + final_graph_minute)) + + delete_minute_suffix + + pynini.closure( + delete_space + + (pynini.cross("00", ' seconds: "0"') | (insert_space + final_graph_second)) + + delete_second_suffix, + 0, + 1, + ) # For seconds + + final_time_zone_optional + ) + + # 2.30 a. m. (Only for 12 hour clock) + graph_hm |= ( + final_graph_hour_12 + + delete_time_delimiter + + (pynutil.delete("00") | (insert_space + final_graph_minute)) + + pynini.closure( + delete_time_delimiter + + (pynini.cross("00", ' seconds: "0"') | (insert_space + final_graph_second)), + 0, + 1, + ) # For seconds 2.30.35 a. m. + + day_suffix + + final_time_zone_optional + ) + + graph_h = ( + pynini.union(final_graph_hour_only_24, final_graph_hour_only_12) + + final_time_zone_optional + ) # Should always have a time indicator, else we'll pass to cardinals + + if not deterministic: + # This includes alternate vocalization (hour menos min, min para hour), here we shift the times and indicate a `style` tag + hour_shift_24 = pynini.invert( + pynini.string_file(get_abs_path("data/time/hour_to_24.tsv")) + ) + hour_shift_12 = pynini.invert( + pynini.string_file(get_abs_path("data/time/hour_to_12.tsv")) + ) + minute_shift = pynini.string_file(get_abs_path("data/time/minute_to.tsv")) + + graph_hour_to_24 = graph_24 @ hour_shift_24 @ cardinal_graph + graph_hour_to_12 = graph_12 @ hour_shift_12 @ cardinal_graph + + graph_minute_to = ( + pynini.union(graph_minute_single, graph_minute_double) + @ minute_shift + @ cardinal_graph + ) + + final_graph_hour_to_24 = ( + pynutil.insert('hours: "') + graph_hour_to_24 + pynutil.insert('"') + ) + final_graph_hour_to_12 = ( + pynutil.insert('hours: "') + graph_hour_to_12 + pynutil.insert('"') + ) + + final_graph_minute_to = ( + pynutil.insert('minutes: "') + graph_minute_to + pynutil.insert('"') + ) + + graph_menos = pynutil.insert(' style: "1"') + graph_para = pynutil.insert(' style: "2"') + + final_graph_style = graph_menos | graph_para + + # 02.30 h (omitting seconds since a bit awkward) + graph_hm |= ( + final_graph_hour_to_24 + + delete_time_delimiter + + insert_space + + final_graph_minute_to + + pynini.closure(delete_hora_suffix, 0, 1) # 2.30 is valid if unambiguous + + final_time_zone_optional + + final_graph_style + ) + + # 2 h 30 min + graph_hm |= ( + final_graph_hour_to_24 + + delete_hora_suffix + + delete_space + + insert_space + + final_graph_minute_to + + delete_minute_suffix + + final_time_zone_optional + + final_graph_style + ) + + # 2.30 a. m. (Only for 12 hour clock) + graph_hm |= ( + final_graph_hour_to_12 + + delete_time_delimiter + + insert_space + + final_graph_minute_to + + day_suffix + + final_time_zone_optional + + final_graph_style + ) + + final_graph = graph_hm | graph_h + if deterministic: + final_graph = final_graph + pynutil.insert(" preserve_order: true") + final_graph = final_graph.optimize() + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/tokenize_and_classify.py b/fun_text_processing/text_normalization/es/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..fae83e9 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/tokenize_and_classify.py @@ -0,0 +1,151 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_WHITE_SPACE, + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.text_normalization.es.taggers.cardinal import CardinalFst +from fun_text_processing.text_normalization.es.taggers.date import DateFst +from fun_text_processing.text_normalization.es.taggers.decimals import DecimalFst +from fun_text_processing.text_normalization.es.taggers.electronic import ElectronicFst +from fun_text_processing.text_normalization.es.taggers.fraction import FractionFst +from fun_text_processing.text_normalization.es.taggers.measure import MeasureFst +from fun_text_processing.text_normalization.es.taggers.money import MoneyFst +from fun_text_processing.text_normalization.es.taggers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.es.taggers.telephone import TelephoneFst +from fun_text_processing.text_normalization.es.taggers.time import TimeFst +from fun_text_processing.text_normalization.es.taggers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.es.taggers.word import WordFst +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finate State aRchive (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + """ + + def __init__( + self, + input_case: str, + deterministic: bool = False, + cache_dir: str = None, + overwrite_cache: bool = False, + whitelist: str = None, + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + whitelist_file = os.path.basename(whitelist) if whitelist else "" + far_file = os.path.join( + cache_dir, f"_{input_case}_es_tn_{deterministic}_deterministic{whitelist_file}.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars. This might take some time...") + + self.cardinal = CardinalFst(deterministic=deterministic) + cardinal_graph = self.cardinal.fst + + self.ordinal = OrdinalFst(cardinal=self.cardinal, deterministic=deterministic) + ordinal_graph = self.ordinal.fst + + self.decimal = DecimalFst(cardinal=self.cardinal, deterministic=deterministic) + decimal_graph = self.decimal.fst + + self.fraction = FractionFst( + cardinal=self.cardinal, ordinal=self.ordinal, deterministic=deterministic + ) + fraction_graph = self.fraction.fst + self.measure = MeasureFst( + cardinal=self.cardinal, + decimal=self.decimal, + fraction=self.fraction, + deterministic=deterministic, + ) + measure_graph = self.measure.fst + self.date = DateFst(cardinal=self.cardinal, deterministic=deterministic) + date_graph = self.date.fst + word_graph = WordFst(deterministic=deterministic).fst + self.time = TimeFst(self.cardinal, deterministic=deterministic) + time_graph = self.time.fst + self.telephone = TelephoneFst(deterministic=deterministic) + telephone_graph = self.telephone.fst + self.electronic = ElectronicFst(deterministic=deterministic) + electronic_graph = self.electronic.fst + self.money = MoneyFst( + cardinal=self.cardinal, decimal=self.decimal, deterministic=deterministic + ) + money_graph = self.money.fst + self.whitelist = WhiteListFst( + input_case=input_case, deterministic=deterministic, input_file=whitelist + ) + whitelist_graph = self.whitelist.fst + punct_graph = PunctuationFst(deterministic=deterministic).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.09) + | pynutil.add_weight(measure_graph, 1.08) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(fraction_graph, 1.09) + | pynutil.add_weight(date_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 200) + ) + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=2.1) + + pynutil.insert(" }") + ) + punct = pynini.closure( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct), + 1, + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure( + ( + pynini.compose(pynini.closure(DAMO_WHITE_SPACE, 1), delete_extra_space) + | (pynutil.insert(" ") + punct + pynutil.insert(" ")) + ) + + token_plus_punct + ) + + graph = delete_space + graph + delete_space + graph |= punct + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/es/taggers/whitelist.py b/fun_text_processing/text_normalization/es/taggers/whitelist.py new file mode 100644 index 0000000..66638f1 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/whitelist.py @@ -0,0 +1,52 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst, convert_space +from fun_text_processing.text_normalization.es.utils import get_abs_path, load_labels +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelist, e.g. + "sr." -> tokens { name: "señor" } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + input_file: path to a file with whitelist replacements + """ + + def __init__(self, input_case: str, deterministic: bool = True, input_file: str = None): + super().__init__(name="whitelist", kind="classify", deterministic=deterministic) + + def _get_whitelist_graph(input_case, file): + whitelist = load_labels(file) + if input_case == "lower_cased": + whitelist = [[x[0].lower()] + x[1:] for x in whitelist] + graph = pynini.string_map(whitelist) + return graph + + graph = _get_whitelist_graph(input_case, get_abs_path("data/whitelist.tsv")) + if not deterministic and input_case != "lower_cased": + graph |= pynutil.add_weight( + _get_whitelist_graph("lower_cased", get_abs_path("data/whitelist.tsv")), + weight=0.0001, + ) + + if input_file: + whitelist_provided = _get_whitelist_graph(input_case, input_file) + if not deterministic: + graph |= whitelist_provided + else: + graph = whitelist_provided + + if not deterministic: + units_graph = _get_whitelist_graph( + input_case, file=get_abs_path("data/measures/measurements.tsv") + ) + graph |= units_graph + + self.graph = graph + self.final_graph = convert_space(self.graph).optimize() + self.fst = (pynutil.insert('name: "') + self.final_graph + pynutil.insert('"')).optimize() diff --git a/fun_text_processing/text_normalization/es/taggers/word.py b/fun_text_processing/text_normalization/es/taggers/word.py new file mode 100644 index 0000000..0b0a047 --- /dev/null +++ b/fun_text_processing/text_normalization/es/taggers/word.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying word. + e.g. dormir -> tokens { name: "dormir" } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/text_normalization/es/utils.py b/fun_text_processing/text_normalization/es/utils.py new file mode 100644 index 0000000..10af0c6 --- /dev/null +++ b/fun_text_processing/text_normalization/es/utils.py @@ -0,0 +1,28 @@ +import csv +import os + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path + + +def load_labels(abs_path): + """ + loads relative path file as dictionary + + Args: + abs_path: absolute path + + Returns dictionary of mappings + """ + label_tsv = open(abs_path) + labels = list(csv.reader(label_tsv, delimiter="\t")) + return labels diff --git a/fun_text_processing/text_normalization/es/verbalizers/__init__.py b/fun_text_processing/text_normalization/es/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/es/verbalizers/cardinal.py b/fun_text_processing/text_normalization/es/verbalizers/cardinal.py new file mode 100644 index 0000000..4a12d5e --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/cardinal.py @@ -0,0 +1,47 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from fun_text_processing.text_normalization.es.graph_utils import ( + add_cardinal_apocope_fem, + shift_cardinal_gender, + strip_cardinal_apocope, +) +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinals + e.g. cardinal { integer: "dos" } -> "dos" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) + optional_sign = pynini.closure(pynini.cross('negative: "true" ', "menos "), 0, 1) + self.optional_sign = optional_sign + + integer = pynini.closure(DAMO_NOT_QUOTE, 1) + self.integer = pynutil.delete(' "') + integer + pynutil.delete('"') + + integer = pynutil.delete("integer:") + self.integer + + graph_masc = optional_sign + integer + graph_fem = shift_cardinal_gender(graph_masc) + + self.graph_masc = pynini.optimize(graph_masc) + self.graph_fem = pynini.optimize(graph_fem) + + # Adding adjustment for fem gender (choice of gender will be random) + graph = graph_masc | graph_fem + + if not deterministic: + # For alternate renderings when apocope is omitted (i.e. cardinal stands alone) + graph |= strip_cardinal_apocope(graph_masc) + # "una" will drop to "un" in unique contexts + graph |= add_cardinal_apocope_fem(graph_fem) + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/date.py b/fun_text_processing/text_normalization/es/verbalizers/date.py new file mode 100644 index 0000000..b4750dd --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/date.py @@ -0,0 +1,75 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_preserve_order, +) +from fun_text_processing.text_normalization.es.graph_utils import strip_cardinal_apocope +from fun_text_processing.text_normalization.es.taggers.date import articles +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + date { day: "treinta y uno" month: "marzo" year: "dos mil" } -> "treinta y uno de marzo de dos mil" + date { day: "uno" month: "mayo" year: "del mil novecientos noventa" } -> "primero de mayo del mil novecientos noventa" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="date", kind="verbalize", deterministic=deterministic) + + day_cardinal = ( + pynutil.delete('day: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + day = strip_cardinal_apocope(day_cardinal) + + primero = pynini.cdrewrite(pynini.cross("uno", "primero"), "[BOS]", "[EOS]", DAMO_SIGMA) + day = ( + (day @ primero) if deterministic else pynini.union(day, day @ primero) + ) # Primero for first day is traditional, but will vary depending on region + + month = pynutil.delete('month: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + + year = ( + pynutil.delete('year: "') + + articles + + DAMO_SPACE + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + # Insert preposition if wasn't originally with the year. This would mean a space was present + year = pynutil.add_weight(year, -0.001) + year |= ( + pynutil.delete('year: "') + + pynutil.insert("de ") + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + # day month year + graph_dmy = ( + day + + pynini.cross(DAMO_SPACE, " de ") + + month + + pynini.closure(pynini.accep(" ") + year, 0, 1) + ) + + graph_mdy = month + DAMO_SPACE + day + pynini.closure(DAMO_SPACE + year, 0, 1) + if deterministic: + graph_mdy += pynutil.delete( + " preserve_order: true" + ) # Only accepts this if was explicitly passed + + self.graph = graph_dmy | graph_mdy + final_graph = self.graph + delete_preserve_order + + delete_tokens = self.delete_tokens(final_graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/decimals.py b/fun_text_processing/text_normalization/es/verbalizers/decimals.py new file mode 100644 index 0000000..ccc6246 --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/decimals.py @@ -0,0 +1,89 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_preserve_order, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es import LOCALIZATION +from fun_text_processing.text_normalization.es.graph_utils import ( + add_cardinal_apocope_fem, + shift_cardinal_gender, + shift_number_gender, + strip_cardinal_apocope, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal, e.g. + decimal { negative: "true" integer_part: "dos" fractional_part: "cuatro cero" quantity: "billones" } -> menos dos coma quatro cero billones + decimal { integer_part: "un" quantity: "billón" } -> un billón + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + + optional_sign = pynini.closure( + pynini.cross('negative: "true"', "menos ") + delete_space, 0, 1 + ) + integer = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + fractional_default = ( + pynutil.delete('fractional_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + conjunction = ( + pynutil.insert(" punto ") if LOCALIZATION == "am" else pynutil.insert(" coma ") + ) + if not deterministic: + conjunction |= pynutil.insert(pynini.union(" con ", " y ")) + fractional_default |= strip_cardinal_apocope(fractional_default) + fractional = conjunction + fractional_default + + quantity = ( + delete_space + + insert_space + + pynutil.delete('quantity: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_quantity = pynini.closure(quantity, 0, 1) + + graph_masc = optional_sign + pynini.union( + (integer + quantity), (integer + delete_space + fractional + optional_quantity) + ) + + # Allowing permutation for fem gender, don't include quantity since "million","billion", etc.. are masculine + graph_fem = optional_sign + ( + shift_cardinal_gender(integer) + delete_space + shift_number_gender(fractional) + ) + if not deterministic: # "una" will drop to "un" in certain cases + graph_fem |= add_cardinal_apocope_fem(graph_fem) + + self.numbers_only_quantity = ( + optional_sign + + pynini.union( + (integer + quantity), (integer + delete_space + fractional + quantity) + ).optimize() + ) + + self.graph_masc = (graph_masc + delete_preserve_order).optimize() + self.graph_fem = (graph_fem + delete_preserve_order).optimize() + + graph = graph_masc | graph_fem + + graph += delete_preserve_order + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/electronic.py b/fun_text_processing/text_normalization/es/verbalizers/electronic.py new file mode 100644 index 0000000..1b4d51d --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/electronic.py @@ -0,0 +1,67 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_preserve_order, + insert_space, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +digit_no_zero = pynini.invert(pynini.string_file(get_abs_path("data/numbers/digit.tsv"))) +zero = pynini.invert(pynini.string_file(get_abs_path("data/numbers/zero.tsv"))) + +graph_symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")) +server_common = pynini.string_file(get_abs_path("data/electronic/server_name.tsv")) +domain_common = pynini.string_file(get_abs_path("data/electronic/domain.tsv")) + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. electronic { username: "abc" domain: "hotmail.com" } -> "a b c arroba hotmail punto com" + -> "a b c arroba h o t m a i l punto c o m" + -> "a b c arroba hotmail punto c o m" + -> "a b c at h o t m a i l punto com" + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="verbalize", deterministic=deterministic) + + graph_digit_no_zero = ( + digit_no_zero + @ pynini.cdrewrite(pynini.cross("un", "uno"), "", "", DAMO_SIGMA).optimize() + ) + graph_digit = graph_digit_no_zero | zero + + def add_space_after_char(): + return pynini.closure(DAMO_NOT_QUOTE - pynini.accep(" ") + insert_space) + ( + DAMO_NOT_QUOTE - pynini.accep(" ") + ) + + verbalize_characters = pynini.cdrewrite(graph_symbols | graph_digit, "", "", DAMO_SIGMA) + + user_name = pynutil.delete('username: "') + add_space_after_char() + pynutil.delete('"') + user_name @= verbalize_characters + + convert_defaults = ( + pynutil.add_weight(DAMO_NOT_QUOTE, weight=0.0001) | domain_common | server_common + ) + domain = convert_defaults + pynini.closure(insert_space + convert_defaults) + domain @= verbalize_characters + + domain = pynutil.delete('domain: "') + domain + pynutil.delete('"') + protocol = ( + pynutil.delete('protocol: "') + + add_space_after_char() @ pynini.cdrewrite(graph_symbols, "", "", DAMO_SIGMA) + + pynutil.delete('"') + ) + self.graph = (pynini.closure(protocol + pynini.accep(" "), 0, 1) + domain) | ( + user_name + pynini.accep(" ") + pynutil.insert("arroba ") + domain + ) + delete_tokens = self.delete_tokens(self.graph + delete_preserve_order) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/fraction.py b/fun_text_processing/text_normalization/es/verbalizers/fraction.py new file mode 100644 index 0000000..7e157af --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/fraction.py @@ -0,0 +1,195 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_CHAR, + DAMO_NOT_QUOTE, + DAMO_NOT_SPACE, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es.graph_utils import ( + accents, + shift_cardinal_gender, + strip_cardinal_apocope, +) +from pynini.lib import pynutil + + +class FractionFst(GraphFst): + """ + Finite state transducer for verbalizing fraction + e.g. tokens { fraction { integer: "treinta y tres" numerator: "cuatro" denominator: "quinto" } } -> + treinta y tres y cuatro quintos + + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="fraction", kind="verbalize", deterministic=deterministic) + + # Derivational strings append 'avo' as a suffix. Adding space for processing aid + fraction_stem = pynutil.insert(" avo") + plural = pynutil.insert("s") + conjunction = pynutil.insert(" y ") + + integer = ( + pynutil.delete('integer_part: "') + + strip_cardinal_apocope(pynini.closure(DAMO_NOT_QUOTE)) + + pynutil.delete('"') + ) + + numerator_one = pynutil.delete('numerator: "') + pynini.accep("un") + pynutil.delete('" ') + numerator = ( + pynutil.delete('numerator: "') + + pynini.difference(pynini.closure(DAMO_NOT_QUOTE), "un") + + pynutil.delete('" ') + ) + + denominator_add_stem = pynutil.delete('denominator: "') + ( + pynini.closure(DAMO_NOT_QUOTE) + + fraction_stem + + pynutil.delete('" morphosyntactic_features: "add_root"') + ) + denominator_ordinal = pynutil.delete('denominator: "') + ( + pynini.closure(DAMO_NOT_QUOTE) + pynutil.delete('" morphosyntactic_features: "ordinal"') + ) + denominator_cardinal = pynutil.delete('denominator: "') + ( + pynini.closure(DAMO_NOT_QUOTE) + pynutil.delete('"') + ) + + denominator_singular = pynini.union(denominator_add_stem, denominator_ordinal) + if not deterministic: + # Occasional exceptions + denominator_singular |= denominator_add_stem @ pynini.string_map( + [("once avo", "undécimo"), ("doce avo", "duodécimo")] + ) + denominator_plural = denominator_singular + plural + + # Merging operations + merge = pynini.cdrewrite( + pynini.cross(" y ", "i"), "", "", DAMO_SIGMA + ) # The denominator must be a single word, with the conjunction "y" replaced by i + merge @= pynini.cdrewrite( + delete_space, "", pynini.difference(DAMO_CHAR, "parte"), DAMO_SIGMA + ) + + # The merger can produce duplicate vowels. This is not allowed in orthography + delete_duplicates = pynini.string_map([("aa", "a"), ("oo", "o")]) # Removes vowels + delete_duplicates = pynini.cdrewrite(delete_duplicates, "", "", DAMO_SIGMA) + + remove_accents = pynini.cdrewrite( + accents, + pynini.union(DAMO_SPACE, pynini.accep("[BOS]")) + pynini.closure(DAMO_NOT_SPACE), + pynini.closure(DAMO_NOT_SPACE) + pynini.union("avo", "ava", "ésimo", "ésima"), + DAMO_SIGMA, + ) + merge_into_single_word = merge @ remove_accents @ delete_duplicates + + fraction_default = ( + numerator + delete_space + insert_space + (denominator_plural @ merge_into_single_word) + ) + + fraction_with_one = ( + numerator_one + + delete_space + + insert_space + + (denominator_singular @ merge_into_single_word) + ) + + fraction_with_cardinal = strip_cardinal_apocope(numerator | numerator_one) + fraction_with_cardinal += ( + delete_space + pynutil.insert(" sobre ") + strip_cardinal_apocope(denominator_cardinal) + ) + + if not deterministic: + # There is an alternative rendering where ordinals act as adjectives for 'parte'. This requires use of the feminine + # Other rules will manage use of "un" at end, so just worry about endings + exceptions = pynini.string_map([("tercia", "tercera")]) + apply_exceptions = pynini.cdrewrite(exceptions, "", "", DAMO_SIGMA) + vowel_change = pynini.cdrewrite( + pynini.cross("o", "a"), "", pynini.accep("[EOS]"), DAMO_SIGMA + ) + + denominator_singular_fem = ( + shift_cardinal_gender(denominator_singular) @ vowel_change @ apply_exceptions + ) + denominator_plural_fem = denominator_singular_fem + plural + + numerator_one_fem = shift_cardinal_gender(numerator_one) + numerator_fem = shift_cardinal_gender(numerator) + + fraction_with_cardinal |= ( + (numerator_one_fem | numerator_fem) + + delete_space + + pynutil.insert(" sobre ") + + shift_cardinal_gender(denominator_cardinal) + ) + + # Still need to manage stems + merge_stem = pynini.cdrewrite( + delete_space, "", pynini.union("avo", "ava", "avos", "avas"), DAMO_SIGMA + ) # For managing alternative spacing + merge_stem @= remove_accents @ delete_duplicates + + fraction_with_one_fem = numerator_one_fem + delete_space + insert_space + fraction_with_one_fem += pynini.union( + denominator_singular_fem @ merge_stem, + denominator_singular_fem @ merge_into_single_word, + ) # Both forms exists + fraction_with_one_fem += pynutil.insert(" parte") + fraction_with_one_fem @= pynini.cdrewrite( + pynini.cross("una media", "media"), "", "", DAMO_SIGMA + ) # "media" not "una media" + + fraction_default_fem = numerator_fem + delete_space + insert_space + fraction_default_fem += pynini.union( + denominator_plural_fem @ merge_stem, denominator_plural_fem @ merge_into_single_word + ) + fraction_default_fem += pynutil.insert(" partes") + + fraction_default |= ( + numerator + delete_space + insert_space + denominator_plural @ merge_stem + ) # Case of no merger + fraction_default |= fraction_default_fem + + fraction_with_one |= ( + numerator_one + delete_space + insert_space + denominator_singular @ merge_stem + ) + fraction_with_one |= fraction_with_one_fem + + fraction_with_one @= pynini.cdrewrite( + pynini.cross("un medio", "medio"), "", "", DAMO_SIGMA + ) # "medio" not "un medio" + + fraction = fraction_with_one | fraction_default | fraction_with_cardinal + graph_masc = pynini.closure(integer + delete_space + conjunction, 0, 1) + fraction + + # Manage cases of fem gender (only shows on integer except for "medio") + integer_fem = shift_cardinal_gender(integer) + fraction_default |= ( + shift_cardinal_gender(numerator) + + delete_space + + insert_space + + (denominator_plural @ pynini.cross("medios", "medias")) + ) + fraction_with_one |= ( + pynutil.delete(numerator_one) + + delete_space + + (denominator_singular @ pynini.cross("medio", "media")) + ) + + fraction_fem = fraction_with_one | fraction_default | fraction_with_cardinal + graph_fem = pynini.closure(integer_fem + delete_space + conjunction, 0, 1) + fraction_fem + + self.graph_masc = pynini.optimize(graph_masc) + self.graph_fem = pynini.optimize(graph_fem) + + self.graph = graph_masc | graph_fem + + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/measure.py b/fun_text_processing/text_normalization/es/verbalizers/measure.py new file mode 100644 index 0000000..09f9c88 --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/measure.py @@ -0,0 +1,118 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + DAMO_SPACE, + DAMO_WHITE_SPACE, + GraphFst, + delete_extra_space, + delete_preserve_order, +) +from fun_text_processing.text_normalization.es.graph_utils import ones +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +unit_plural_fem = pynini.string_file(get_abs_path("data/measures/measurements_plural_fem.tsv")) +unit_plural_masc = pynini.string_file(get_abs_path("data/measures/measurements_plural_masc.tsv")) + +unit_singular_fem = pynini.project(unit_plural_fem, "input") +unit_singular_masc = pynini.project(unit_plural_masc, "input") + +unit_plural_fem = pynini.project(unit_plural_fem, "output") +unit_plural_masc = pynini.project(unit_plural_masc, "output") + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { cardinal { integer: "dos" units: "gramos" } } -> "dos gramos" + measure { decimal { integer_part: "dos" quantity: "millones" units: "gramos" } } -> "dos millones de gramos" + + Args: + decimal: DecimalFst + cardinal: CardinalFst + fraction: FractionFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__( + self, decimal: GraphFst, cardinal: GraphFst, fraction: GraphFst, deterministic: bool + ): + super().__init__(name="measure", kind="verbalize", deterministic=deterministic) + + graph_decimal_masc = decimal.delete_tokens(decimal.graph_masc) + graph_decimal_fem = decimal.delete_tokens(decimal.graph_fem) + graph_cardinal_masc = cardinal.delete_tokens(cardinal.graph_masc) + graph_cardinal_fem = cardinal.delete_tokens(cardinal.graph_fem) + graph_fraction_fem = fraction.delete_tokens(fraction.graph_fem) + graph_fraction_masc = fraction.delete_tokens(fraction.graph_masc) + + unit_masc = (unit_plural_masc | unit_singular_masc) + pynini.closure( + DAMO_WHITE_SPACE + "por" + pynini.closure(DAMO_NOT_QUOTE, 1), 0, 1 + ) + unit_masc |= "por" + pynini.closure(DAMO_NOT_QUOTE, 1) + unit_masc = ( + pynutil.delete('units: "') + + (pynini.closure(DAMO_NOT_QUOTE) @ unit_masc) + + pynutil.delete('"') + ) + + unit_fem = (unit_plural_fem | unit_singular_fem) + pynini.closure( + DAMO_WHITE_SPACE + "por" + pynini.closure(DAMO_NOT_QUOTE, 1), 0, 1 + ) + unit_fem = ( + pynutil.delete('units: "') + + (pynini.closure(DAMO_NOT_QUOTE) @ unit_fem) + + pynutil.delete('"') + ) + + graph_masc = (graph_cardinal_masc | graph_decimal_masc) + DAMO_WHITE_SPACE + unit_masc + graph_masc |= graph_fraction_masc + DAMO_WHITE_SPACE + pynutil.insert("de ") + unit_masc + graph_masc |= pynutil.add_weight( + graph_fraction_masc @ (DAMO_SIGMA + pynini.union("medio", "medios")) + + DAMO_WHITE_SPACE + + unit_masc, + -0.001, + ) # "medio litro" not "medio de litro" + + graph_fem = (graph_cardinal_fem | graph_decimal_fem) + DAMO_WHITE_SPACE + unit_fem + graph_fem |= graph_fraction_fem + DAMO_WHITE_SPACE + pynutil.insert("de ") + unit_fem + graph_fem |= pynutil.add_weight( + graph_fraction_fem @ (DAMO_SIGMA + pynini.union("media", "medias")) + + DAMO_WHITE_SPACE + + unit_fem, + -0.001, + ) + + graph = graph_masc | graph_fem + + graph = ( + pynini.cdrewrite( + pynutil.insert(" de"), + 'quantity: "' + pynini.closure(DAMO_NOT_QUOTE, 1), + '"', + DAMO_SIGMA, + ) + @ graph + ) # billones de xyz + + graph @= pynini.cdrewrite( + pynini.cross(ones, "uno"), "", DAMO_WHITE_SPACE + "por", DAMO_SIGMA + ) + + # To manage alphanumeric combonations ("a-8, 5x"), we let them use a weighted default path. + alpha_num_unit = ( + pynutil.delete('units: "') + pynini.closure(DAMO_NOT_QUOTE) + pynutil.delete('"') + ) + graph_alpha_num = pynini.union( + (graph_cardinal_masc | graph_decimal_masc) + DAMO_SPACE + alpha_num_unit, + alpha_num_unit + delete_extra_space + (graph_cardinal_masc | graph_decimal_masc), + ) + + graph |= pynutil.add_weight(graph_alpha_num, 0.01) + + graph += delete_preserve_order + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/money.py b/fun_text_processing/text_normalization/es/verbalizers/money.py new file mode 100644 index 0000000..96800c6 --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/money.py @@ -0,0 +1,169 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + delete_preserve_order, +) +from fun_text_processing.text_normalization.es.graph_utils import ( + shift_cardinal_gender, + strip_cardinal_apocope, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +fem = pynini.string_file((get_abs_path("data/money/currency_plural_fem.tsv"))) +masc = pynini.string_file((get_abs_path("data/money/currency_plural_masc.tsv"))) + +fem_singular = pynini.project(fem, "input") +masc_singular = pynini.project(masc, "input") + +fem_plural = pynini.project(fem, "output") +masc_plural = pynini.project(masc, "output") + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { currency_maj: "euro" integer_part: "un"} -> "un euro" + money { currency_maj: "euro" integer_part: "un" fractional_part: "cero cero un"} -> "uno coma cero cero uno euros" + money { integer_part: "un" currency_maj: "libra" fractional_part: "cuarenta" preserve_order: true} -> "una libra cuarenta" + money { integer_part: "un" currency_maj: "libra" fractional_part: "cuarenta" currency_min: "peniques" preserve_order: true} -> "una libra con cuarenta peniques" + money { fractional_part: "un" currency_min: "penique" preserve_order: true} -> "un penique" + + Args: + decimal: GraphFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="verbalize", deterministic=deterministic) + + maj_singular_masc = ( + pynutil.delete('currency_maj: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ masc_singular) + + pynutil.delete('"') + ) + maj_singular_fem = ( + pynutil.delete('currency_maj: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ fem_singular) + + pynutil.delete('"') + ) + + maj_plural_masc = ( + pynutil.delete('currency_maj: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ masc_plural) + + pynutil.delete('"') + ) + maj_plural_fem = ( + pynutil.delete('currency_maj: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ fem_plural) + + pynutil.delete('"') + ) + + maj_masc = maj_plural_masc | maj_singular_masc # Tagger kept quantity resolution stable + maj_fem = maj_plural_fem | maj_singular_fem + + min_singular_masc = ( + pynutil.delete('currency_min: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ masc_singular) + + pynutil.delete('"') + ) + min_singular_fem = ( + pynutil.delete('currency_min: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ fem_singular) + + pynutil.delete('"') + ) + + min_plural_masc = ( + pynutil.delete('currency_min: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ masc_plural) + + pynutil.delete('"') + ) + min_plural_fem = ( + pynutil.delete('currency_min: "') + + (pynini.closure(DAMO_NOT_QUOTE, 1) @ fem_plural) + + pynutil.delete('"') + ) + + min_masc = min_plural_masc | min_singular_masc + min_fem = min_plural_fem | min_singular_fem + + fractional_part = ( + pynutil.delete('fractional_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + integer_part = ( + pynutil.delete('integer_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_add_and = pynini.closure(pynutil.insert(pynini.union("con ", "y ")), 0, 1) + + # *** currency_maj + graph_integer_masc = integer_part + DAMO_SPACE + maj_masc + graph_integer_fem = shift_cardinal_gender(integer_part) + DAMO_SPACE + maj_fem + + graph_integer = graph_integer_fem | graph_integer_masc + + # *** currency_maj + (***) | ((con) *** current_min) + graph_integer_with_minor_masc = ( + graph_integer_masc + + DAMO_SPACE + + pynini.union( + optional_add_and + strip_cardinal_apocope(fractional_part), + (optional_add_and + fractional_part + DAMO_SPACE + min_masc), + (optional_add_and + shift_cardinal_gender(fractional_part) + DAMO_SPACE + min_fem), + ) # Could be minor currency that is different gender + + delete_preserve_order + ) + + graph_integer_with_minor_fem = ( + graph_integer_fem + + DAMO_SPACE + + pynini.union( + optional_add_and + shift_cardinal_gender(fractional_part), + (optional_add_and + fractional_part + DAMO_SPACE + min_masc), + (optional_add_and + shift_cardinal_gender(fractional_part) + DAMO_SPACE + min_fem), + ) # Could be minor currency that is different gender + + delete_preserve_order + ) + + graph_integer_with_minor = graph_integer_with_minor_fem | graph_integer_with_minor_masc + + ## *** coma *** currency_maj + graph_decimal_masc = decimal.graph_masc + DAMO_SPACE + maj_masc + + graph_decimal_fem = decimal.graph_fem + graph_decimal_fem |= ( + decimal.numbers_only_quantity + ) # can still have "x billions" with fem currency + graph_decimal_fem += DAMO_SPACE + maj_fem + + graph_decimal = graph_decimal_fem | graph_decimal_masc + graph_decimal = ( + pynini.cdrewrite( + pynutil.insert(" de"), + 'quantity: "' + pynini.closure(DAMO_NOT_QUOTE, 1), + '"', + DAMO_SIGMA, + ) + @ graph_decimal + ) # formally it's millones/billones de *** + + # *** current_min + graph_minor_masc = fractional_part + DAMO_SPACE + min_masc + delete_preserve_order + graph_minor_fem = ( + shift_cardinal_gender(fractional_part) + DAMO_SPACE + min_fem + delete_preserve_order + ) + + graph_minor = graph_minor_fem | graph_minor_masc + + graph = graph_integer | graph_integer_with_minor | graph_decimal | graph_minor + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/ordinal.py b/fun_text_processing/text_normalization/es/verbalizers/ordinal.py new file mode 100644 index 0000000..1c97473 --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/ordinal.py @@ -0,0 +1,68 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, +) +from fun_text_processing.text_normalization.es.graph_utils import shift_number_gender +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing ordinals + e.g. ordinal { integer: "tercer" } } -> "tercero" + -> "tercera" + -> "tercer" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="ordinal", kind="verbalize", deterministic=deterministic) + + graph = ( + pynutil.delete('integer: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + + # masculne gender we leave as is + graph_masc = graph + pynutil.delete(' morphosyntactic_features: "gender_masc') + + # shift gender + graph_fem_ending = graph @ pynini.cdrewrite( + pynini.cross("o", "a"), "", DAMO_SPACE | pynini.accep("[EOS]"), DAMO_SIGMA + ) + graph_fem = shift_number_gender(graph_fem_ending) + pynutil.delete( + ' morphosyntactic_features: "gender_fem' + ) + + # Apocope just changes tercero and primero. May occur if someone wrote 11.er (uncommon) + graph_apocope = ( + pynini.cross("tercero", "tercer") + | pynini.cross("primero", "primer") + | pynini.cross("undécimo", "decimoprimer") + ) # In case someone wrote 11.er with deterministic + graph_apocope = ( + graph @ pynini.cdrewrite(graph_apocope, "", "", DAMO_SIGMA) + ) + pynutil.delete(' morphosyntactic_features: "apocope') + + graph = graph_apocope | graph_masc | graph_fem + + if not deterministic: + # Plural graph + graph_plural = pynini.cdrewrite( + pynutil.insert("s"), + pynini.union("o", "a"), + DAMO_SPACE | pynini.accep("[EOS]"), + DAMO_SIGMA, + ) + + graph |= (graph @ graph_plural) + pynutil.delete("/plural") + + self.graph = graph + pynutil.delete('"') + + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/telephone.py b/fun_text_processing/text_normalization/es/verbalizers/telephone.py new file mode 100644 index 0000000..e347be6 --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/telephone.py @@ -0,0 +1,26 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "uno dos tres uno dos tres cinco seis siete ocho" } + -> uno dos tres uno dos tres cinco seis siete ocho + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="telephone", kind="verbalize") + + number_part = ( + pynutil.delete('number_part: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(number_part) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/time.py b/fun_text_processing/text_normalization/es/verbalizers/time.py new file mode 100644 index 0000000..448b9cb --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/time.py @@ -0,0 +1,249 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_preserve_order, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.es.utils import get_abs_path +from pynini.lib import pynutil + +alt_minutes = pynini.string_file(get_abs_path("data/time/alt_minutes.tsv")) + +morning_times = pynini.string_file(get_abs_path("data/time/morning_times.tsv")) +afternoon_times = pynini.string_file(get_abs_path("data/time/afternoon_times.tsv")) +evening_times = pynini.string_file(get_abs_path("data/time/evening_times.tsv")) + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing time, e.g. + time { hours: "doce" minutes: "media" suffix: "a m" } -> doce y media de la noche + time { hours: "doce" } -> twelve o'clock + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="time", kind="verbalize", deterministic=deterministic) + + change_minutes = pynini.cdrewrite( + alt_minutes, pynini.accep("[BOS]"), pynini.accep("[EOS]"), DAMO_SIGMA + ) + + morning_phrases = pynini.cross("am", "de la mañana") + afternoon_phrases = pynini.cross("pm", "de la tarde") + evening_phrases = pynini.cross("pm", "de la noche") + + # For the 12's + mid_times = pynini.accep("doce") + mid_phrases = ( + pynini.string_map([("pm", "del mediodía"), ("am", "de la noche")]) + if deterministic + else pynini.string_map( + [ + ("pm", "de la mañana"), + ("pm", "del día"), + ("pm", "del mediodía"), + ("am", "de la noche"), + ("am", "de la medianoche"), + ] + ) + ) + + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + minute = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + minute = ( + (minute @ change_minutes) + if deterministic + else pynini.union(minute, minute @ change_minutes) + ) + + suffix = ( + pynutil.delete("suffix:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + zone = ( + pynutil.delete("zone:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + optional_zone = pynini.closure(delete_space + insert_space + zone, 0, 1) + second = ( + pynutil.delete("seconds:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + graph_hms = ( + hour + + pynutil.insert(" horas ") + + delete_space + + minute + + pynutil.insert(" minutos y ") + + delete_space + + second + + pynutil.insert(" segundos") + ) + + graph_hm = hour + delete_space + pynutil.insert(" y ") + minute + graph_hm |= pynini.union( + (hour @ morning_times) + + delete_space + + pynutil.insert(" y ") + + minute + + delete_space + + insert_space + + (suffix @ morning_phrases), + (hour @ afternoon_times) + + delete_space + + pynutil.insert(" y ") + + minute + + delete_space + + insert_space + + (suffix @ afternoon_phrases), + (hour @ evening_times) + + delete_space + + pynutil.insert(" y ") + + minute + + delete_space + + insert_space + + (suffix @ evening_phrases), + (hour @ mid_times) + + delete_space + + pynutil.insert(" y ") + + minute + + delete_space + + insert_space + + (suffix @ mid_phrases), + ) + + graph_h = pynini.union( + hour, + (hour @ morning_times) + delete_space + insert_space + (suffix @ morning_phrases), + (hour @ afternoon_times) + delete_space + insert_space + (suffix @ afternoon_phrases), + (hour @ evening_times) + delete_space + insert_space + (suffix @ evening_phrases), + (hour @ mid_times) + delete_space + insert_space + (suffix @ mid_phrases), + ) + + graph = (graph_hms | graph_hm | graph_h) + optional_zone + + if not deterministic: + graph_style_1 = pynutil.delete(' style: "1"') + graph_style_2 = pynutil.delete(' style: "2"') + + graph_menos = hour + delete_space + pynutil.insert(" menos ") + minute + graph_style_1 + graph_menos |= ( + (hour @ morning_times) + + delete_space + + pynutil.insert(" menos ") + + minute + + delete_space + + insert_space + + (suffix @ morning_phrases) + + graph_style_1 + ) + graph_menos |= ( + (hour @ afternoon_times) + + delete_space + + pynutil.insert(" menos ") + + minute + + delete_space + + insert_space + + (suffix @ afternoon_phrases) + + graph_style_1 + ) + graph_menos |= ( + (hour @ evening_times) + + delete_space + + pynutil.insert(" menos ") + + minute + + delete_space + + insert_space + + (suffix @ evening_phrases) + + graph_style_1 + ) + graph_menos |= ( + (hour @ mid_times) + + delete_space + + pynutil.insert(" menos ") + + minute + + delete_space + + insert_space + + (suffix @ mid_phrases) + + graph_style_1 + ) + graph_menos += optional_zone + + graph_para = minute + pynutil.insert(" para las ") + delete_space + hour + graph_style_2 + graph_para |= ( + minute + + pynutil.insert(" para las ") + + delete_space + + (hour @ morning_times) + + delete_space + + insert_space + + (suffix @ morning_phrases) + + graph_style_2 + ) + graph_para |= ( + minute + + pynutil.insert(" para las ") + + delete_space + + (hour @ afternoon_times) + + delete_space + + insert_space + + (suffix @ afternoon_phrases) + + graph_style_2 + ) + graph_para |= ( + minute + + pynutil.insert(" para las ") + + delete_space + + (hour @ evening_times) + + delete_space + + insert_space + + (suffix @ evening_phrases) + + graph_style_2 + ) + graph_para |= ( + minute + + pynutil.insert(" para las ") + + delete_space + + (hour @ mid_times) + + delete_space + + insert_space + + (suffix @ mid_phrases) + + graph_style_2 + ) + graph_para += optional_zone + graph_para @= pynini.cdrewrite( + pynini.cross(" las ", " la "), "para", "una", DAMO_SIGMA + ) # Need agreement with one + + graph |= graph_menos | graph_para + delete_tokens = self.delete_tokens(graph + delete_preserve_order) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/es/verbalizers/verbalize.py b/fun_text_processing/text_normalization/es/verbalizers/verbalize.py new file mode 100644 index 0000000..075f889 --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/verbalize.py @@ -0,0 +1,62 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.en.verbalizers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.es.verbalizers.cardinal import CardinalFst +from fun_text_processing.text_normalization.es.verbalizers.date import DateFst +from fun_text_processing.text_normalization.es.verbalizers.decimals import DecimalFst +from fun_text_processing.text_normalization.es.verbalizers.electronic import ElectronicFst +from fun_text_processing.text_normalization.es.verbalizers.fraction import FractionFst +from fun_text_processing.text_normalization.es.verbalizers.measure import MeasureFst +from fun_text_processing.text_normalization.es.verbalizers.money import MoneyFst +from fun_text_processing.text_normalization.es.verbalizers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.es.verbalizers.telephone import TelephoneFst +from fun_text_processing.text_normalization.es.verbalizers.time import TimeFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="verbalize", kind="verbalize", deterministic=deterministic) + cardinal = CardinalFst(deterministic=deterministic) + cardinal_graph = cardinal.fst + ordinal = OrdinalFst(deterministic=deterministic) + ordinal_graph = ordinal.fst + decimal = DecimalFst(deterministic=deterministic) + decimal_graph = decimal.fst + fraction = FractionFst(deterministic=deterministic) + fraction_graph = fraction.fst + date = DateFst(deterministic=deterministic) + date_graph = date.fst + measure = MeasureFst( + cardinal=cardinal, decimal=decimal, fraction=fraction, deterministic=deterministic + ) + measure_graph = measure.fst + electronic = ElectronicFst(deterministic=deterministic) + electronic_graph = electronic.fst + whitelist_graph = WhiteListFst(deterministic=deterministic).fst + money_graph = MoneyFst(decimal=decimal, deterministic=deterministic).fst + telephone_graph = TelephoneFst(deterministic=deterministic).fst + time_graph = TimeFst(deterministic=deterministic).fst + + graph = ( + cardinal_graph + | measure_graph + | decimal_graph + | ordinal_graph + | date_graph + | electronic_graph + | money_graph + | fraction_graph + | whitelist_graph + | telephone_graph + | time_graph + ) + self.fst = graph diff --git a/fun_text_processing/text_normalization/es/verbalizers/verbalize_final.py b/fun_text_processing/text_normalization/es/verbalizers/verbalize_final.py new file mode 100644 index 0000000..93c671e --- /dev/null +++ b/fun_text_processing/text_normalization/es/verbalizers/verbalize_final.py @@ -0,0 +1,61 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.verbalizers.word import WordFst +from fun_text_processing.text_normalization.es.verbalizers.verbalize import VerbalizeFst +from pynini.lib import pynutil + +import logging + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__( + self, deterministic: bool = True, cache_dir: str = None, overwrite_cache: bool = False + ): + super().__init__(name="verbalize_final", kind="verbalize", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join( + cache_dir, f"es_tn_{deterministic}_deterministic_verbalizer.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["verbalize"] + logging.info(f"VerbalizeFinalFst graph was restored from {far_file}.") + else: + + verbalize = VerbalizeFst(deterministic=deterministic).fst + word = WordFst(deterministic=deterministic).fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + + self.fst = graph.optimize() + if far_file: + generator_main(far_file, {"verbalize": self.fst}) + logging.info(f"VerbalizeFinalFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/export_models.py b/fun_text_processing/text_normalization/export_models.py new file mode 100644 index 0000000..09fab45 --- /dev/null +++ b/fun_text_processing/text_normalization/export_models.py @@ -0,0 +1,92 @@ +import os +from time import perf_counter +from argparse import ArgumentParser +from fun_text_processing.text_normalization.en.graph_utils import generator_main + + +def parse_args(): + parser = ArgumentParser() + + parser.add_argument( + "--language", + help="language", + choices=["de", "en", "es", "ru", "zh"], + default="en", + type=str, + ) + parser.add_argument( + "--input_case", + help="input capitalization", + choices=["lower_cased", "cased"], + default="cased", + type=str, + ) + parser.add_argument( + "--export_dir", + help="path to export directory. Default to current directory.", + default="./", + type=str, + ) + return parser.parse_args() + + +def get_grammars(lang: str = "en", input_case: str = "cased"): + if lang == "de": + from fun_text_processing.text_normalization.de.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.de.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "en": + from fun_text_processing.text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "es": + from fun_text_processing.text_normalization.es.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.es.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "ru": + from fun_text_processing.text_normalization.ru.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.ru.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "zh": + from fun_text_processing.text_normalization.zh.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.zh.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + else: + from fun_text_processing.text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + + return ClassifyFst(input_case=input_case).fst, VerbalizeFinalFst().fst + + +if __name__ == "__main__": + args = parse_args() + + export_dir = args.export_dir + os.makedirs(export_dir, exist_ok=True) + tagger_far_file = os.path.join(export_dir, args.language + "_tn_tagger.far") + verbalizer_far_file = os.path.join(export_dir, args.language + "_tn_verbalizer.far") + + start_time = perf_counter() + tagger_fst, verbalizer_fst = get_grammars(args.language, args.input_case) + generator_main(tagger_far_file, {"tokenize_and_classify": tagger_fst}) + generator_main(verbalizer_far_file, {"verbalize": verbalizer_fst}) + print(f"Time to generate graph: {round(perf_counter() - start_time, 2)} sec") diff --git a/fun_text_processing/text_normalization/normalize.py b/fun_text_processing/text_normalization/normalize.py new file mode 100644 index 0000000..c1cebdd --- /dev/null +++ b/fun_text_processing/text_normalization/normalize.py @@ -0,0 +1,574 @@ +import itertools +import os +import re +from argparse import ArgumentParser +from collections import OrderedDict +from math import factorial +from time import perf_counter +from typing import Dict, List, Union + +import pynini +import regex +from joblib import Parallel, delayed +from fun_text_processing.text_normalization.data_loader_utils import ( + load_file, + post_process_punct, + pre_process, + write_file, +) +from fun_text_processing.text_normalization.token_parser import PRESERVE_ORDER_KEY, TokenParser +from pynini.lib.rewrite import top_rewrite +from tqdm import tqdm + +try: + from nemo.collections.common.tokenizers.moses_tokenizers import MosesProcessor + + NLP_AVAILABLE = True +except (ModuleNotFoundError, ImportError) as e: + NLP_AVAILABLE = False + +SPACE_DUP = re.compile(" {2,}") + + +class Normalizer: + """ + Normalizer class that converts text from written to spoken form. + Useful for TTS preprocessing. + + Args: + input_case: expected input capitalization + lang: language specifying the TN rules, by default: English + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + post_process: WFST-based post processing, e.g. to remove extra spaces added during TN. + Note: punct_post_process flag in normalize() supports all languages. + """ + + def __init__( + self, + input_case: str, + lang: str = "en", + deterministic: bool = True, + cache_dir: str = None, + overwrite_cache: bool = False, + whitelist: str = None, + lm: bool = False, + post_process: bool = True, + ): + assert input_case in ["lower_cased", "cased"] + + self.post_processor = None + + if lang == "en": + from fun_text_processing.text_normalization.en.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + from fun_text_processing.text_normalization.en.verbalizers.post_processing import ( + PostProcessingFst, + ) + + if post_process: + self.post_processor = PostProcessingFst( + cache_dir=cache_dir, overwrite_cache=overwrite_cache + ) + + if deterministic: + from fun_text_processing.text_normalization.en.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + else: + if lm: + from fun_text_processing.text_normalization.en.taggers.tokenize_and_classify_lm import ( + ClassifyFst, + ) + else: + from fun_text_processing.text_normalization.en.taggers.tokenize_and_classify_with_audio import ( + ClassifyFst, + ) + + elif lang == "ru": + # Ru TN only support non-deterministic cases and produces multiple normalization options + # use normalize_with_audio.py + from fun_text_processing.text_normalization.ru.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.ru.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "de": + from fun_text_processing.text_normalization.de.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.de.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "es": + from fun_text_processing.text_normalization.es.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.es.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + elif lang == "zh": + from fun_text_processing.text_normalization.zh.taggers.tokenize_and_classify import ( + ClassifyFst, + ) + from fun_text_processing.text_normalization.zh.verbalizers.verbalize_final import ( + VerbalizeFinalFst, + ) + self.tagger = ClassifyFst( + input_case=input_case, + deterministic=deterministic, + cache_dir=cache_dir, + overwrite_cache=overwrite_cache, + whitelist=whitelist, + ) + + self.verbalizer = VerbalizeFinalFst( + deterministic=deterministic, cache_dir=cache_dir, overwrite_cache=overwrite_cache + ) + + self.parser = TokenParser() + self.lang = lang + + if NLP_AVAILABLE: + self.processor = MosesProcessor(lang_id=lang) + else: + self.processor = None + print("NeMo NLP is not available. Moses de-tokenization will be skipped.") + + def normalize_list( + self, + texts: List[str], + verbose: bool = False, + punct_pre_process: bool = False, + punct_post_process: bool = False, + batch_size: int = 1, + n_jobs: int = 1, + ): + """ + NeMo text normalizer + + Args: + texts: list of input strings + verbose: whether to print intermediate meta information + punct_pre_process: whether to do punctuation pre processing + punct_post_process: whether to do punctuation post processing + n_jobs: the maximum number of concurrently running jobs. If -1 all CPUs are used. If 1 is given, + no parallel computing code is used at all, which is useful for debugging. For n_jobs below -1, + (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. + batch_size: Number of examples for each process + + Returns converted list input strings + """ + + # to save intermediate results to a file + batch = min(len(texts), batch_size) + + try: + normalized_texts = Parallel(n_jobs=n_jobs)( + delayed(self.process_batch)( + texts[i : i + batch], verbose, punct_pre_process, punct_post_process + ) + for i in range(0, len(texts), batch) + ) + except BaseException as e: + raise e + + normalized_texts = list(itertools.chain(*normalized_texts)) + return normalized_texts + + def process_batch(self, batch, verbose, punct_pre_process, punct_post_process): + """ + Normalizes batch of text sequences + Args: + batch: list of texts + verbose: whether to print intermediate meta information + punct_pre_process: whether to do punctuation pre processing + punct_post_process: whether to do punctuation post processing + """ + normalized_lines = [ + self.normalize( + text, + verbose=verbose, + punct_pre_process=punct_pre_process, + punct_post_process=punct_post_process, + ) + for text in tqdm(batch) + ] + return normalized_lines + + def _estimate_number_of_permutations_in_nested_dict( + self, token_group: Dict[str, Union[OrderedDict, str, bool]] + ) -> int: + num_perms = 1 + for k, inner in token_group.items(): + if isinstance(inner, dict): + num_perms *= self._estimate_number_of_permutations_in_nested_dict(inner) + num_perms *= factorial(len(token_group)) + return num_perms + + def _split_tokens_to_reduce_number_of_permutations( + self, tokens: List[dict], max_number_of_permutations_per_split: int = 729 + ) -> List[List[dict]]: + """ + Splits a sequence of tokens in a smaller sequences of tokens in a way that maximum number of composite + tokens permutations does not exceed ``max_number_of_permutations_per_split``. + + For example, + + .. code-block:: python + tokens = [ + {"tokens": {"date": {"year": "twenty eighteen", "month": "december", "day": "thirty one"}}}, + {"tokens": {"date": {"year": "twenty eighteen", "month": "january", "day": "eight"}}}, + ] + split = normalizer._split_tokens_to_reduce_number_of_permutations( + tokens, max_number_of_permutations_per_split=6 + ) + assert split == [ + [{"tokens": {"date": {"year": "twenty eighteen", "month": "december", "day": "thirty one"}}}], + [{"tokens": {"date": {"year": "twenty eighteen", "month": "january", "day": "eight"}}}], + ] + + Date tokens contain 3 items each which gives 6 permutations for every date. Since there are 2 dates, total + number of permutations would be ``6 * 6 == 36``. Parameter ``max_number_of_permutations_per_split`` equals 6, + so input sequence of tokens is split into 2 smaller sequences. + + Args: + tokens (:obj:`List[dict]`): a list of dictionaries, possibly nested. + max_number_of_permutations_per_split (:obj:`int`, `optional`, defaults to :obj:`243`): a maximum number + of permutations which can be generated from input sequence of tokens. + + Returns: + :obj:`List[List[dict]]`: a list of smaller sequences of tokens resulting from ``tokens`` split. + """ + splits = [] + prev_end_of_split = 0 + current_number_of_permutations = 1 + for i, token_group in enumerate(tokens): + n = self._estimate_number_of_permutations_in_nested_dict(token_group) + if n * current_number_of_permutations > max_number_of_permutations_per_split: + splits.append(tokens[prev_end_of_split:i]) + prev_end_of_split = i + current_number_of_permutations = 1 + if n > max_number_of_permutations_per_split: + raise ValueError( + f"Could not split token list with respect to condition that every split can generate number of " + f"permutations less or equal to " + f"`max_number_of_permutations_per_split={max_number_of_permutations_per_split}`. " + f"There is an unsplittable token group that generates more than " + f"{max_number_of_permutations_per_split} permutations. Try to increase " + f"`max_number_of_permutations_per_split` parameter." + ) + current_number_of_permutations *= n + splits.append(tokens[prev_end_of_split:]) + assert sum([len(s) for s in splits]) == len(tokens) + return splits + + def normalize( + self, + text: str, + verbose: bool = False, + punct_pre_process: bool = False, + punct_post_process: bool = False, + ) -> str: + """ + Main function. Normalizes tokens from written to spoken form + e.g. 12 kg -> twelve kilograms + + Args: + text: string that may include semiotic classes + verbose: whether to print intermediate meta information + punct_pre_process: whether to perform punctuation pre-processing, for example, [25] -> [ 25 ] + punct_post_process: whether to normalize punctuation + + Returns: spoken form + """ + if len(text.split()) > 500: + print( + "WARNING! Your input is too long and could take a long time to normalize." + "Use split_text_into_sentences() to make the input shorter and then call normalize_list()." + ) + + original_text = text + if punct_pre_process: + text = pre_process(text) + text = text.strip() + if not text: + if verbose: + print(text) + return text + text = pynini.escape(text) + tagged_lattice = self.find_tags(text) + tagged_text = self.select_tag(tagged_lattice) + if verbose: + print(tagged_text) + self.parser(tagged_text) + tokens = self.parser.parse() + split_tokens = self._split_tokens_to_reduce_number_of_permutations(tokens) + output = "" + for s in split_tokens: + tags_reordered = self.generate_permutations(s) + verbalizer_lattice = None + for tagged_text in tags_reordered: + tagged_text = pynini.escape(tagged_text) + + verbalizer_lattice = self.find_verbalizer(tagged_text) + if verbalizer_lattice.num_states() != 0: + break + if verbalizer_lattice is None: + raise ValueError(f"No permutations were generated from tokens {s}") + output += " " + self.select_verbalizer(verbalizer_lattice) + output = SPACE_DUP.sub(" ", output[1:]) + + if self.lang == "en" and hasattr(self, "post_processor"): + output = self.post_process(output) + + if punct_post_process: + # do post-processing based on Moses detokenizer + if self.processor: + output = self.processor.moses_detokenizer.detokenize([output], unescape=False) + output = post_process_punct(input=original_text, normalized_text=output) + else: + print("DAMO_NLP collection is not available: skipping punctuation post_processing") + + return output + + def split_text_into_sentences(self, text: str) -> List[str]: + """ + Split text into sentences. + + Args: + text: text + + Returns list of sentences + """ + lower_case_unicode = "" + upper_case_unicode = "" + if self.lang == "ru": + lower_case_unicode = "\u0430-\u04FF" + upper_case_unicode = "\u0410-\u042F" + + # Read and split transcript by utterance (roughly, sentences) + split_pattern = f"(? List[str]: + """ + Creates reorderings of dictionary elements and serializes as strings + + Args: + d: (nested) dictionary of key value pairs + + Return permutations of different string serializations of key value pairs + """ + l = [] + if PRESERVE_ORDER_KEY in d.keys(): + d_permutations = [d.items()] + else: + d_permutations = itertools.permutations(d.items()) + for perm in d_permutations: + subl = [""] + for k, v in perm: + if isinstance(v, str): + subl = ["".join(x) for x in itertools.product(subl, [f'{k}: "{v}" '])] + elif isinstance(v, OrderedDict): + rec = self._permute(v) + subl = [ + "".join(x) for x in itertools.product(subl, [f" {k} {{ "], rec, [f" }} "]) + ] + elif isinstance(v, bool): + subl = ["".join(x) for x in itertools.product(subl, [f"{k}: true "])] + else: + raise ValueError() + l.extend(subl) + return l + + def generate_permutations(self, tokens: List[dict]): + """ + Generates permutations of string serializations of list of dictionaries + + Args: + tokens: list of dictionaries + + Returns string serialization of list of dictionaries + """ + + def _helper(prefix: str, tokens: List[dict], idx: int): + """ + Generates permutations of string serializations of given dictionary + + Args: + tokens: list of dictionaries + prefix: prefix string + idx: index of next dictionary + + Returns string serialization of dictionary + """ + if idx == len(tokens): + yield prefix + return + token_options = self._permute(tokens[idx]) + for token_option in token_options: + yield from _helper(prefix + token_option, tokens, idx + 1) + + return _helper("", tokens, 0) + + def find_tags(self, text: str) -> "pynini.FstLike": + """ + Given text use tagger Fst to tag text + + Args: + text: sentence + + Returns: tagged lattice + """ + lattice = text @ self.tagger.fst + return lattice + + def select_tag(self, lattice: "pynini.FstLike") -> str: + """ + Given tagged lattice return shortest path + + Args: + tagged_text: tagged text + + Returns: shortest path + """ + tagged_text = pynini.shortestpath(lattice, nshortest=1, unique=True).string() + return tagged_text + + def find_verbalizer(self, tagged_text: str) -> "pynini.FstLike": + """ + Given tagged text creates verbalization lattice + This is context-independent. + + Args: + tagged_text: input text + + Returns: verbalized lattice + """ + lattice = tagged_text @ self.verbalizer.fst + return lattice + + def select_verbalizer(self, lattice: "pynini.FstLike") -> str: + """ + Given verbalized lattice return shortest path + + Args: + lattice: verbalization lattice + + Returns: shortest path + """ + output = pynini.shortestpath(lattice, nshortest=1, unique=True).string() + # lattice = output @ self.verbalizer.punct_graph + # output = pynini.shortestpath(lattice, nshortest=1, unique=True).string() + return output + + def post_process(self, normalized_text: "pynini.FstLike") -> str: + """ + Runs post processing graph on normalized text + + Args: + normalized_text: normalized text + + Returns: shortest path + """ + normalized_text = normalized_text.strip() + if not normalized_text: + return normalized_text + normalized_text = pynini.escape(normalized_text) + + if self.post_processor is not None: + normalized_text = top_rewrite(normalized_text, self.post_processor.fst) + return normalized_text + + +def parse_args(): + parser = ArgumentParser() + input = parser.add_mutually_exclusive_group() + input.add_argument("--text", dest="input_string", help="input string", type=str) + input.add_argument("--input_file", dest="input_file", help="input file path", type=str) + parser.add_argument("--output_file", dest="output_file", help="output file path", type=str) + parser.add_argument( + "--language", help="language", choices=["en", "de", "es", "zh"], default="en", type=str + ) + parser.add_argument( + "--input_case", + help="input capitalization", + choices=["lower_cased", "cased"], + default="cased", + type=str, + ) + parser.add_argument("--verbose", help="print info for debugging", action="store_true") + parser.add_argument( + "--punct_post_process", + help="set to True to enable punctuation post processing to match input.", + action="store_true", + ) + parser.add_argument( + "--punct_pre_process", + help="set to True to enable punctuation pre processing", + action="store_true", + ) + parser.add_argument( + "--overwrite_cache", help="set to True to re-create .far grammar files", action="store_true" + ) + parser.add_argument( + "--whitelist", help="path to a file with with whitelist", default=None, type=str + ) + parser.add_argument( + "--cache_dir", + help="path to a dir with .far grammar file. Set to None to avoid using cache", + default=None, + type=str, + ) + return parser.parse_args() + + +if __name__ == "__main__": + start_time = perf_counter() + + args = parse_args() + whitelist = os.path.abspath(args.whitelist) if args.whitelist else None + + if not args.input_string and not args.input_file: + raise ValueError("Either `--text` or `--input_file` required") + + normalizer = Normalizer( + input_case=args.input_case, + cache_dir=args.cache_dir, + overwrite_cache=args.overwrite_cache, + whitelist=whitelist, + lang=args.language, + ) + if args.input_string: + print( + normalizer.normalize( + args.input_string, + verbose=args.verbose, + punct_pre_process=args.punct_pre_process, + punct_post_process=args.punct_post_process, + ) + ) + elif args.input_file: + print("Loading data: " + args.input_file) + data = load_file(args.input_file) + + print("- Data: " + str(len(data)) + " sentences") + normalizer_prediction = normalizer.normalize_list( + data, + verbose=args.verbose, + punct_pre_process=args.punct_pre_process, + punct_post_process=args.punct_post_process, + ) + if args.output_file: + write_file(args.output_file, normalizer_prediction) + print(f"- Normalized. Writing out to {args.output_file}") + else: + print(normalizer_prediction) + + print(f"Execution time: {perf_counter() - start_time:.02f} sec") diff --git a/fun_text_processing/text_normalization/normalize_with_audio.py b/fun_text_processing/text_normalization/normalize_with_audio.py new file mode 100644 index 0000000..973a1d2 --- /dev/null +++ b/fun_text_processing/text_normalization/normalize_with_audio.py @@ -0,0 +1,578 @@ +import json +import os +import time +from argparse import ArgumentParser +from glob import glob +from typing import List, Tuple + +import pynini +from joblib import Parallel, delayed +from fun_text_processing.text_normalization.data_loader_utils import post_process_punct, pre_process +from fun_text_processing.text_normalization.normalize import Normalizer +from pynini.lib import rewrite +from tqdm import tqdm + +try: + from nemo.collections.asr.metrics.wer import word_error_rate + from nemo.collections.asr.models import ASRModel + + ASR_AVAILABLE = True +except (ModuleNotFoundError, ImportError): + ASR_AVAILABLE = False + + +""" +The script provides multiple normalization options and chooses the best one that minimizes CER of the ASR output +(most of the semiotic classes use deterministic=False flag). + +To run this script with a .json manifest file, the manifest file should contain the following fields: + "audio_data" - path to the audio file + "text" - raw text + "pred_text" - ASR model prediction + + See https://github.com/NVIDIA/NeMo/blob/main/examples/asr/transcribe_speech.py on how to add ASR predictions + + When the manifest is ready, run: + python normalize_with_audio.py \ + --audio_data PATH/TO/MANIFEST.JSON \ + --language en + + +To run with a single audio file, specify path to audio and text with: + python normalize_with_audio.py \ + --audio_data PATH/TO/AUDIO.WAV \ + --language en \ + --text raw text OR PATH/TO/.TXT/FILE + --model QuartzNet15x5Base-En \ + --verbose + +To see possible normalization options for a text input without an audio file (could be used for debugging), run: + python python normalize_with_audio.py --text "RAW TEXT" + +Specify `--cache_dir` to generate .far grammars once and re-used them for faster inference +""" + + +class NormalizerWithAudio(Normalizer): + """ + Normalizer class that converts text from written to spoken form. + Useful for TTS preprocessing. + + Args: + input_case: expected input capitalization + lang: language + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + post_process: WFST-based post processing, e.g. to remove extra spaces added during TN. + Note: punct_post_process flag in normalize() supports all languages. + """ + + def __init__( + self, + input_case: str, + lang: str = "en", + cache_dir: str = None, + overwrite_cache: bool = False, + whitelist: str = None, + lm: bool = False, + post_process: bool = True, + ): + + super().__init__( + input_case=input_case, + lang=lang, + deterministic=False, + cache_dir=cache_dir, + overwrite_cache=overwrite_cache, + whitelist=whitelist, + lm=lm, + post_process=post_process, + ) + self.lm = lm + + def normalize( + self, + text: str, + n_tagged: int, + punct_post_process: bool = True, + verbose: bool = False, + ) -> str: + """ + Main function. Normalizes tokens from written to spoken form + e.g. 12 kg -> twelve kilograms + + Args: + text: string that may include semiotic classes + n_tagged: number of tagged options to consider, -1 - to get all possible tagged options + punct_post_process: whether to normalize punctuation + verbose: whether to print intermediate meta information + + Returns: + normalized text options (usually there are multiple ways of normalizing a given semiotic class) + """ + + if len(text.split()) > 500: + raise ValueError( + "Your input is too long. Please split up the input into sentences, " + "or strings with fewer than 500 words" + ) + + original_text = text + text = pre_process(text) # to handle [] + + text = text.strip() + if not text: + if verbose: + print(text) + return text + text = pynini.escape(text) + print(text) + + if self.lm: + if self.lang not in ["en"]: + raise ValueError(f"{self.lang} is not supported in LM mode") + + if self.lang == "en": + # this to keep arpabet phonemes in the list of options + if "[" in text and "]" in text: + + lattice = rewrite.rewrite_lattice(text, self.tagger.fst) + else: + try: + lattice = rewrite.rewrite_lattice(text, self.tagger.fst_no_digits) + except pynini.lib.rewrite.Error: + lattice = rewrite.rewrite_lattice(text, self.tagger.fst) + lattice = rewrite.lattice_to_nshortest(lattice, n_tagged) + tagged_texts = [(x[1], float(x[2])) for x in lattice.paths().items()] + tagged_texts.sort(key=lambda x: x[1]) + tagged_texts, weights = list(zip(*tagged_texts)) + else: + tagged_texts = self._get_tagged_text(text, n_tagged) + # non-deterministic Eng normalization uses tagger composed with verbalizer, no permutation in between + if self.lang == "en": + normalized_texts = tagged_texts + normalized_texts = [self.post_process(text) for text in normalized_texts] + else: + normalized_texts = [] + for tagged_text in tagged_texts: + self._verbalize(tagged_text, normalized_texts, verbose=verbose) + + if len(normalized_texts) == 0: + raise ValueError() + + if punct_post_process: + # do post-processing based on Moses detokenizer + if self.processor: + normalized_texts = [self.processor.detokenize([t]) for t in normalized_texts] + normalized_texts = [ + post_process_punct(input=original_text, normalized_text=t) + for t in normalized_texts + ] + + if self.lm: + remove_dup = sorted(list(set(zip(normalized_texts, weights))), key=lambda x: x[1]) + normalized_texts, weights = zip(*remove_dup) + return list(normalized_texts), weights + + normalized_texts = set(normalized_texts) + return normalized_texts + + def _get_tagged_text(self, text, n_tagged): + """ + Returns text after tokenize and classify + Args; + text: input text + n_tagged: number of tagged options to consider, -1 - return all possible tagged options + """ + if n_tagged == -1: + if self.lang == "en": + # this to keep arpabet phonemes in the list of options + if "[" in text and "]" in text: + tagged_texts = rewrite.rewrites(text, self.tagger.fst) + else: + try: + tagged_texts = rewrite.rewrites(text, self.tagger.fst_no_digits) + except pynini.lib.rewrite.Error: + tagged_texts = rewrite.rewrites(text, self.tagger.fst) + else: + tagged_texts = rewrite.rewrites(text, self.tagger.fst) + else: + if self.lang == "en": + # this to keep arpabet phonemes in the list of options + if "[" in text and "]" in text: + tagged_texts = rewrite.top_rewrites(text, self.tagger.fst, nshortest=n_tagged) + else: + try: + # try self.tagger graph that produces output without digits + tagged_texts = rewrite.top_rewrites( + text, self.tagger.fst_no_digits, nshortest=n_tagged + ) + except pynini.lib.rewrite.Error: + tagged_texts = rewrite.top_rewrites( + text, self.tagger.fst, nshortest=n_tagged + ) + else: + tagged_texts = rewrite.top_rewrites(text, self.tagger.fst, nshortest=n_tagged) + return tagged_texts + + def _verbalize(self, tagged_text: str, normalized_texts: List[str], verbose: bool = False): + """ + Verbalizes tagged text + + Args: + tagged_text: text with tags + normalized_texts: list of possible normalization options + verbose: if true prints intermediate classification results + """ + + def get_verbalized_text(tagged_text): + return rewrite.rewrites(tagged_text, self.verbalizer.fst) + + self.parser(tagged_text) + tokens = self.parser.parse() + tags_reordered = self.generate_permutations(tokens) + for tagged_text_reordered in tags_reordered: + try: + tagged_text_reordered = pynini.escape(tagged_text_reordered) + normalized_texts.extend(get_verbalized_text(tagged_text_reordered)) + if verbose: + print(tagged_text_reordered) + + except pynini.lib.rewrite.Error: + continue + + def select_best_match( + self, + normalized_texts: List[str], + input_text: str, + pred_text: str, + verbose: bool = False, + remove_punct: bool = False, + cer_threshold: int = 100, + ): + """ + Selects the best normalization option based on the lowest CER + + Args: + normalized_texts: normalized text options + input_text: input text + pred_text: ASR model transcript of the audio file corresponding to the normalized text + verbose: whether to print intermediate meta information + remove_punct: whether to remove punctuation before calculating CER + cer_threshold: if CER for pred_text is above the cer_threshold, no normalization will be performed + + Returns: + normalized text with the lowest CER and CER value + """ + if pred_text == "": + return input_text, cer_threshold + + normalized_texts_cer = calculate_cer(normalized_texts, pred_text, remove_punct) + normalized_texts_cer = sorted(normalized_texts_cer, key=lambda x: x[1]) + normalized_text, cer = normalized_texts_cer[0] + + if cer > cer_threshold: + return input_text, cer + + if verbose: + print("-" * 30) + for option in normalized_texts: + print(option) + print("-" * 30) + return normalized_text, cer + + +def calculate_cer( + normalized_texts: List[str], pred_text: str, remove_punct=False +) -> List[Tuple[str, float]]: + """ + Calculates character error rate (CER) + + Args: + normalized_texts: normalized text options + pred_text: ASR model output + + Returns: normalized options with corresponding CER + """ + normalized_options = [] + for text in normalized_texts: + text_clean = text.replace("-", " ").lower() + if remove_punct: + for punct in "!?:;,.-()*+-/<=>@^_": + text_clean = text_clean.replace(punct, "") + cer = round(word_error_rate([pred_text], [text_clean], use_cer=True) * 100, 2) + normalized_options.append((text, cer)) + return normalized_options + + +def get_asr_model(asr_model): + """ + Returns ASR Model + + Args: + asr_model: NeMo ASR model + """ + if os.path.exists(args.model): + asr_model = ASRModel.restore_from(asr_model) + elif args.model in ASRModel.get_available_model_names(): + asr_model = ASRModel.from_pretrained(asr_model) + else: + raise ValueError( + f"Provide path to the pretrained checkpoint or choose from {ASRModel.get_available_model_names()}" + ) + return asr_model + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument( + "--text", help="input string or path to a .txt file", default=None, type=str + ) + parser.add_argument( + "--input_case", + help="input capitalization", + choices=["lower_cased", "cased"], + default="cased", + type=str, + ) + parser.add_argument( + "--language", + help="Select target language", + choices=["en", "ru", "de", "es"], + default="en", + type=str, + ) + parser.add_argument( + "--audio_data", default=None, help="path to an audio file or .json manifest" + ) + parser.add_argument( + "--model", + type=str, + default="QuartzNet15x5Base-En", + help="Pre-trained model name or path to model checkpoint", + ) + parser.add_argument( + "--n_tagged", + type=int, + default=30, + help="number of tagged options to consider, -1 - return all possible tagged options", + ) + parser.add_argument("--verbose", help="print info for debugging", action="store_true") + parser.add_argument( + "--no_remove_punct_for_cer", + help="Set to True to NOT remove punctuation before calculating CER", + action="store_true", + ) + parser.add_argument( + "--no_punct_post_process", + help="set to True to disable punctuation post processing", + action="store_true", + ) + parser.add_argument( + "--overwrite_cache", help="set to True to re-create .far grammar files", action="store_true" + ) + parser.add_argument( + "--whitelist", help="path to a file with with whitelist", default=None, type=str + ) + parser.add_argument( + "--cache_dir", + help="path to a dir with .far grammar file. Set to None to avoid using cache", + default=None, + type=str, + ) + parser.add_argument( + "--n_jobs", default=-2, type=int, help="The maximum number of concurrently running jobs" + ) + parser.add_argument( + "--lm", + action="store_true", + help="Set to True for WFST+LM. Only available for English right now.", + ) + parser.add_argument( + "--cer_threshold", + default=100, + type=int, + help="if CER for pred_text is above the cer_threshold, no normalization will be performed", + ) + parser.add_argument( + "--batch_size", default=200, type=int, help="Number of examples for each process" + ) + return parser.parse_args() + + +def _normalize_line( + normalizer: NormalizerWithAudio, + n_tagged, + verbose, + line: str, + remove_punct, + punct_post_process, + cer_threshold, +): + line = json.loads(line) + pred_text = line["pred_text"] + + normalized_texts = normalizer.normalize( + text=line["text"], + verbose=verbose, + n_tagged=n_tagged, + punct_post_process=punct_post_process, + ) + + normalized_texts = set(normalized_texts) + normalized_text, cer = normalizer.select_best_match( + normalized_texts=normalized_texts, + input_text=line["text"], + pred_text=pred_text, + verbose=verbose, + remove_punct=remove_punct, + cer_threshold=cer_threshold, + ) + line["nemo_normalized"] = normalized_text + line["CER_nemo_normalized"] = cer + return line + + +def normalize_manifest( + normalizer, + audio_data: str, + n_jobs: int, + n_tagged: int, + remove_punct: bool, + punct_post_process: bool, + batch_size: int, + cer_threshold: int, +): + """ + Args: + args.audio_data: path to .json manifest file. + """ + + def __process_batch(batch_idx: int, batch: List[str], dir_name: str): + """ + Normalizes batch of text sequences + Args: + batch: list of texts + batch_idx: batch index + dir_name: path to output directory to save results + """ + normalized_lines = [ + _normalize_line( + normalizer, + n_tagged, + verbose=False, + line=line, + remove_punct=remove_punct, + punct_post_process=punct_post_process, + cer_threshold=cer_threshold, + ) + for line in tqdm(batch) + ] + + with open(f"{dir_name}/{batch_idx:05}.json", "w") as f_out: + for line in normalized_lines: + f_out.write(json.dumps(line, ensure_ascii=False) + "\n") + + print(f"Batch -- {batch_idx} -- is complete") + + manifest_out = audio_data.replace(".json", "_normalized.json") + with open(audio_data, "r") as f: + lines = f.readlines() + + print(f"Normalizing {len(lines)} lines of {audio_data}...") + + # to save intermediate results to a file + batch = min(len(lines), batch_size) + + tmp_dir = manifest_out.replace(".json", "_parts") + os.makedirs(tmp_dir, exist_ok=True) + + Parallel(n_jobs=n_jobs)( + delayed(__process_batch)(idx, lines[i : i + batch], tmp_dir) + for idx, i in enumerate(range(0, len(lines), batch)) + ) + + # aggregate all intermediate files + with open(manifest_out, "w") as f_out: + for batch_f in sorted(glob(f"{tmp_dir}/*.json")): + with open(batch_f, "r") as f_in: + lines = f_in.read() + f_out.write(lines) + + print(f"Normalized version saved at {manifest_out}") + + +if __name__ == "__main__": + args = parse_args() + + if not ASR_AVAILABLE and args.audio_data: + raise ValueError("NeMo ASR collection is not installed.") + start = time.time() + args.whitelist = os.path.abspath(args.whitelist) if args.whitelist else None + if args.text is not None: + normalizer = NormalizerWithAudio( + input_case=args.input_case, + lang=args.language, + cache_dir=args.cache_dir, + overwrite_cache=args.overwrite_cache, + whitelist=args.whitelist, + lm=args.lm, + ) + + if os.path.exists(args.text): + with open(args.text, "r") as f: + args.text = f.read().strip() + normalized_texts = normalizer.normalize( + text=args.text, + verbose=args.verbose, + n_tagged=args.n_tagged, + punct_post_process=not args.no_punct_post_process, + ) + + if not normalizer.lm: + normalized_texts = set(normalized_texts) + if args.audio_data: + asr_model = get_asr_model(args.model) + pred_text = asr_model.transcribe([args.audio_data])[0] + normalized_text, cer = normalizer.select_best_match( + normalized_texts=normalized_texts, + pred_text=pred_text, + input_text=args.text, + verbose=args.verbose, + remove_punct=not args.no_remove_punct_for_cer, + cer_threshold=args.cer_threshold, + ) + print(f"Transcript: {pred_text}") + print(f"Normalized: {normalized_text}") + else: + print("Normalization options:") + for norm_text in normalized_texts: + print(norm_text) + elif not os.path.exists(args.audio_data): + raise ValueError(f"{args.audio_data} not found.") + elif args.audio_data.endswith(".json"): + normalizer = NormalizerWithAudio( + input_case=args.input_case, + lang=args.language, + cache_dir=args.cache_dir, + overwrite_cache=args.overwrite_cache, + whitelist=args.whitelist, + ) + normalize_manifest( + normalizer=normalizer, + audio_data=args.audio_data, + n_jobs=args.n_jobs, + n_tagged=args.n_tagged, + remove_punct=not args.no_remove_punct_for_cer, + punct_post_process=not args.no_punct_post_process, + batch_size=args.batch_size, + cer_threshold=args.cer_threshold, + ) + else: + raise ValueError( + "Provide either path to .json manifest in '--audio_data' OR " + + "'--audio_data' path to audio file and '--text' path to a text file OR" + "'--text' string text (for debugging without audio)" + ) + print(f"Execution time: {round((time.time() - start)/60, 2)} min.") diff --git a/fun_text_processing/text_normalization/ru/__init__.py b/fun_text_processing/text_normalization/ru/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/alphabet.py b/fun_text_processing/text_normalization/ru/alphabet.py new file mode 100644 index 0000000..d63f67b --- /dev/null +++ b/fun_text_processing/text_normalization/ru/alphabet.py @@ -0,0 +1,50 @@ +# Copyright 2017 Google Inc. + + +# Adapted from https://github.com/google/TextNormalizationCoveringGrammars +# Russian minimally supervised number grammar. + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NON_BREAKING_SPACE, + DAMO_SPACE, +) +from fun_text_processing.text_normalization.ru.utils import get_abs_path + +RU_LOWER_ALPHA = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя" +RU_UPPER_ALPHA = RU_LOWER_ALPHA.upper() +RU_LOWER_ALPHA = pynini.union(*RU_LOWER_ALPHA).optimize() +RU_UPPER_ALPHA = pynini.union(*RU_UPPER_ALPHA).optimize() +RU_ALPHA = (RU_LOWER_ALPHA | RU_UPPER_ALPHA).optimize() + +RU_STRESSED_MAP = [ + ("А́", "А'"), + ("Е́", "Е'"), + ("Ё́", "Е'"), + ("И́", "И'"), + ("О́", "О'"), + ("У́", "У'"), + ("Ы́", "Ы'"), + ("Э́", "Э'"), + ("Ю́", "Ю'"), + ("Я́", "Я'"), + ("а́", "а'"), + ("е́", "е'"), + ("ё́", "е'"), + ("и́", "и'"), + ("о́", "о'"), + ("у́", "у'"), + ("ы́", "ы'"), + ("э́", "э'"), + ("ю́", "ю'"), + ("я́", "я'"), + ("ё", "е"), + ("Ё", "Е"), +] + +REWRITE_STRESSED = pynini.closure( + pynini.string_map(RU_STRESSED_MAP).optimize() | RU_ALPHA +).optimize() +TO_CYRILLIC = pynini.string_file(get_abs_path("data/latin_to_cyrillic.tsv")).optimize() +TO_LATIN = pynini.invert(TO_CYRILLIC).optimize() +RU_ALPHA_OR_SPACE = pynini.union(RU_ALPHA, DAMO_SPACE, DAMO_NON_BREAKING_SPACE).optimize() diff --git a/fun_text_processing/text_normalization/ru/data/__init__.py b/fun_text_processing/text_normalization/ru/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/data/currency/__init__.py b/fun_text_processing/text_normalization/ru/data/currency/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/currency/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/data/currency/currency_plural.tsv b/fun_text_processing/text_normalization/ru/data/currency/currency_plural.tsv new file mode 100644 index 0000000..c1d2815 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/currency/currency_plural.tsv @@ -0,0 +1,53 @@ +р. рубли 0.1 +р. рубля 0.1 +р. рублей 0.1 +р. рублям 0.1 +р. рублями 0.1 +р. рублях 0.1 +руб. рубли -0.1 +руб. рубля -0.1 +руб. рублей -0.1 +руб. рублям -0.1 +руб. рублями -0.1 +руб. рублях -0.1 +₽ рубли 0.1 +₽ рубля 0.1 +₽ рублей 0.1 +₽ рублям 0.1 +₽ рублями 0.1 +₽ рублях 0.1 +RUB рубли 0.1 +RUB рублей 0.1 +RUB рубля 0.1 +RUB рублям 0.1 +RUB рублями 0.1 +RUB рублях 0.1 +$ доллары 0.1 +$ долларов 0.1 +$ доллара 0.1 +$ долларам 0.1 +$ доллары 0.1 +$ долларами 0.1 +USD доллары -0.1 +USD долларов -0.1 +USD долларам -0.1 +USD долларах -0.1 +USD долларами -0.1 +USD американские доллары 0.1 +USD американских долларов 0.1 +USD американским долларам 0.1 +USD американскими долларами 0.1 +USD американских долларах 0.1 +долл. США долларов сэ ш а 0.1 +долл. США долларов с ш а 0.1 +долл. США долларов сша -0.1 +долл. США доллара сша -0.1 +£ фунта 0.1 +£ фунтов 0.1 +€ евро 0.1 +€ евро 0.1 +коп. копейки +коп. копеек +коп. копейкам +коп. копейками +коп. копейках \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/currency/currency_singular.tsv b/fun_text_processing/text_normalization/ru/data/currency/currency_singular.tsv new file mode 100644 index 0000000..de7d1c7 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/currency/currency_singular.tsv @@ -0,0 +1,48 @@ +р. рубль 1 +р. рубля 1 +р. рублю 1 +р. рублем 1 +р. рубле 1 +руб. рубль -1 +руб. рубля -1 +руб. рублю -1 +руб. рублем -1 +руб. рубле -1 +₽ рубль 1 +₽ рубля 1 +₽ рублю 1 +₽ рублем 1 +₽ рубле 1 +RUB рубль 1 +RUB рубль 1 +RUB рубля 1 +RUB рублю 1 +RUB рублем 1 +RUB рубле 1 +USD доллар -1 +USD доллара -1 +USD доллару -1 +USD долларом -1 +USD долларе -1 +USD американский доллар 1 +USD американского доллара 1 +USD американскому доллару 1 +USD американским долларом 1 +USD американском долларе 1 +$ доллар 1 +$ доллар сэ ш а +$ доллар с ш а +$ доллар 1 +$ доллара 1 +$ доллару 1 +$ долларом 1 +$ долларе 1 +£ фунт +€ евро +коп. копейка +коп. копейки +коп. копейке +коп. копейку +коп. копейкой +коп. копейкою +коп. копейке \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/electronic/__init__.py b/fun_text_processing/text_normalization/ru/data/electronic/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/electronic/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/data/electronic/domain.tsv b/fun_text_processing/text_normalization/ru/data/electronic/domain.tsv new file mode 100644 index 0000000..c208e05 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/electronic/domain.tsv @@ -0,0 +1,9 @@ +com ком +uk +fr +net нет +br +in +ru ру +de +it \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/electronic/server_name.tsv b/fun_text_processing/text_normalization/ru/data/electronic/server_name.tsv new file mode 100644 index 0000000..5d885db --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/electronic/server_name.tsv @@ -0,0 +1,17 @@ +gmail джи мейл +n vidia н видия +n vidia эн видия +n vidia энвидия +n vidia нвидия +outlook аутлук +hotmail хот мейл +yahoo яху +aol +gmx +msn +live лайв +yandex яндекс +orange орандж +wanadoo ванаду +web веб +comcast комкаст \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/electronic/symbols.tsv b/fun_text_processing/text_normalization/ru/data/electronic/symbols.tsv new file mode 100644 index 0000000..e772ad9 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/electronic/symbols.tsv @@ -0,0 +1,28 @@ +. точка +- тире +- дефис +- минус +_ нижнее подчеркивание +_ знак подчеркивания +! восклицательный знак +# решетка +$ доллар +% процент +& энд +& амперсанд +' кавычка +* звездочка +* знак умножения ++ плюс +/ слэш +/ косая черта +\ бэк слэш +\ обратная косая черта += равно +? вопросительный знак +^ знак вставки +` кавычка +{ открытая фигурная скобка +| вертикальный слэш +} закрытая фигурная скобка +~ тильда \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/latin_to_cyrillic.tsv b/fun_text_processing/text_normalization/ru/data/latin_to_cyrillic.tsv new file mode 100644 index 0000000..8e0c8f5 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/latin_to_cyrillic.tsv @@ -0,0 +1,38 @@ +a эй +b би +b бэ +c си +d ди +e и +f эф +f ф +h эйч +h х +i ай +g джи +j джей +k кей +k к +l л +l эл +m эм +n н +n эн +o оу +o о +p пи +q кью +r а +r ар +r р +s эс +t ти +u ю +v ви +w дабл ю +w дабл в +x экс +y уай +z з +z зед +z зи \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/measurements.tsv b/fun_text_processing/text_normalization/ru/data/measurements.tsv new file mode 100644 index 0000000..a48079d --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/measurements.tsv @@ -0,0 +1,321 @@ +°F Фаренгейт +°F градусов Фаренгейта +°F градусов по Фаренгейту +°F фаренгейт +°F градусов фаренгейта +°F градусов по фаренгейту +°C цельсия +°C градусов цельсия +°C градусов по цельсию +°C Цельсия +°C градусов цельсия +°C градусов по цельсию +° градус +° градуса +° градусу +° градусом +° градусе +° градусы +° градусов +° градусам +° градусы +° градусами +° градусах +рад радиан +рад радиана +рад радиану +рад радианом +рад радиане +рад радианы +рад радианов +рад радианам +рад радианами +рад радианах +км километр +км километры +км километра +км километров +км километру +км километрам +км километром +км километрами +км километре +км километрах +м метр +м метра +м метру +м метра +м метром +м метре +м метры +м метров +м метрам +м метров +м метрами +м метрах +см сантиметр +см сантиметры +см сантиметра +см сантиметров +см сантиметру +см сантиметрам +см сантиметром +см сантиметрами +см сантиметре +см сантиметрах +мм миллиметр +мм миллиметры +мм миллиметра +мм миллиметров +мм миллиметру +мм миллиметрам +мм миллиметр +мм миллиметром +мм миллиметрами +мм миллиметре +мм миллиметрах +га гектар +га гектары +га гектара +га гектаров +га гектару +га гектарам +га гектаром +га гектарами +га гектаре +га гектарах +м² квадратный метр -0.11 +м² квадратные метры -0.11 +м² квадратного метра -0.11 +м² квадратных метров -0.11 +м² квадратному метру -0.11 +м² квадратным метрам -0.11 +м² квадратные метры -0.11 +м² квадратным метром -0.11 +м² квадратными метрами -0.11 +м² квадратном метре -0.11 +м² квадратных метрах -0.11 +кв. м. квадратный метр -0.1 +кв. м. квадратные метры -0.1 +кв. м. квадратного метра -0.1 +кв. м. квадратных метров -0.1 +кв. м. квадратному метру -0.1 +кв. м. квадратным метрам -0.1 +кв. м. квадратные метры -0.1 +кв. м. квадратным метром -0.1 +кв. м. квадратными метрами -0.1 +кв. м. квадратном метре -0.1 +кв.м. квадратных метрах -0.1 +кв.м. квадратный метр -0.1 +кв.м. квадратные метры -0.1 +кв.м. квадратного метра -0.1 +кв.м. квадратных метров -0.1 +кв.м. квадратному метру -0.1 +кв.м. квадратным метрам -0.1 +кв.м. квадратные метры -0.1 +кв.м. квадратным метром -0.1 +кв.м. квадратными метрами -0.1 +кв.м. квадратном метре -0.1 +кв.м. квадратных метрах -0.1 +м2 квадратный метр 0.1 +м2 квадратные метры 0.1 +м2 квадратного метра 0.1 +м2 квадратных метров 0.1 +м2 квадратному метру 0.1 +м2 квадратным метрам 0.1 +м2 квадратные метры 0.1 +м2 квадратным метром 0.1 +м2 квадратными метрами 0.1 +м2 квадратном метре 0.1 +м2 квадратных метрах 0.1 +₽ рублей 0.1 +₽ рубля 0.1 +₽ рубль 0.1 +RUB рублей 0.1 +RUB рубля 0.1 +RUB рубль 0.1 +pуб. рублей -0.1 +pуб. рубля -0.1 +pуб. рубль -0.1 +pуб рублей 0.1 +pуб рубля 0.1 +pуб рубль 0.1 +км² квадратный километр -0.1 +км2 квадратный километр 0.1 +% процент +% проценты +% процента +% процентов +% проценту +% процентам +% процентом +% процентами +% проценте +% процентах +кВт киловатт +л. с. лошадиная сила +л. с. лошадиные силы +л. с. лошадиной силы +л. с. лошадиных сил +л. с. лошадиной силе +л. с. лошадиным силам +л. с. лошадиную силу +л. с. лошадиные силы +л. с. лошадиной силой +л. с. лошадиной силою +л. с. лошадиными силами +л. с. лошадиных силах +мг миллиграм +кг килограм +кг килограма +кг килограму +кг килограм +кг килограмом +кг килограме +кг килограмы +кг килограмов +кг килограмам +кг килограмы +кг килограмами +кг килограмах +л литр +л литры +л литра +л литров +л литру +л литрам +л литры +л литром +л литрами +л литре +л литрах +л литре +кл килолитр +гл гектолитр +Мл мегалитр +Гл гигалитр +мл миллиитр +ч час +сек. секунд -0.1 +сек. секунда -0.1 +сек. секунды -0.1 +сек. секунды -0.1 +сек. секунд -0.1 +сек. секунде -0.1 +сек. секундам -0.1 +сек. секунду -0.1 +сек. секунды -0.1 +сек. секундой -0.1 +сек. секундами -0.1 +сек. секунде -0.1 +сек. секундах -0.1 +сек секунд 0.1 +сек секунда 0.1 +сек секунды 0.1 +сек секунды 0.1 +сек секунд 0.1 +сек секунде 0.1 +сек секундам 0.1 +сек секунду 0.1 +сек секунды 0.1 +сек секундой 0.1 +сек секундами 0.1 +сек секунде 0.1 +сек секундах 0.1 +с секунд 0.1 +с секунда 0.1 +с секунды 0.1 +с секунды 0.1 +с секунд 0.1 +с секунде 0.1 +с секундам 0.1 +с секунду 0.1 +с секунды 0.1 +с секундой 0.1 +с секундами 0.1 +с секунде 0.1 +с секундах 0.1 +дас декасекунда +кс килосекунда +Мс мегасекунда +мс миллисекунда +нм нанометр +нм нанометра +нм нанометров +нм нанометры +А ампер +К кельвин +кд кандела +мА миллиампер +кВт⋅ч киловатт час +м³ кубический метр -0.1 +м³ кубический метров -0.1 +м3 кубический метр 0.1 +м3 кубический метров 0.1 +м³ кубометр -0.1 +м³ кубометров -0.1 +км/ч километров в час +км/ч километра в час +В вольт +гВ гектовольт +кВ киловольт +МВ мегавольт +мВ милливольт +мВт мегаватт +ТВт тераватт +мкм микрометр +г грамм +г граммов +дБ децибел +Б байт +Кбайт килобайт +Мбайт мегабайт +Пбайт петабайт +Тбайт терабайт 0.1 +ТБ терабайт -0.1 +Гбайт гигабайт 0.1 +Гб гигабайт -0.1 +Гц герц +даГц декагерц +дГц децигерц +гГц гектогерц +сГц сантигерц +кГц килогерц +мГц миллигерц +МГц мегагерц +мкГц микрогерц +ГГц гигагерц +нГц наногерц +ТГц терагерц +пГц пикогерц +ПГц петагерц +фГц фемтогерц +ЭГц эксагерц +аГц аттогерц +ЗГц зеттагерц +зГц зептогерц +ИГц иоттагерц +иГц иоктогерц +кбит килобит +Мбит мегабит +Гбит гигабит +Тбит терабит +бит/с бит в секунду +кбит/с килобит в секунду +Мбит/с мегабит в секунду +Гбит/с гигабит в секунду +нс наносекунда +нс наносекунды +нс наносекунд +мм² квадратный миллиметр -0.1 +мм² квадратных миллиметров -0.1 +мм² квадратных миллиметра -0.1 +мм2 квадратный миллиметр 0.1 +мм2 квадратных миллимета 0.1 +мм2 квадратных миллиметров 0.1 +см² квадратный сантиметр -0.1 +см² квадратных сантимета -0.1 +см² квадратных сантиметров -0.1 +см2 квадратный сантиметр 0.1 +см2 квадратных сантиметра 0.1 +см2 квадратных сантиметров 0.1 diff --git a/fun_text_processing/text_normalization/ru/data/months/__init__.py b/fun_text_processing/text_normalization/ru/data/months/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/months/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/data/months/abbr.tsv b/fun_text_processing/text_normalization/ru/data/months/abbr.tsv new file mode 100644 index 0000000..cd51fe3 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/months/abbr.tsv @@ -0,0 +1,12 @@ +янв январь +фев февраль +мар март +апр апрель +май май +июнь июнь +июль июль +авг август +сент сентябрь +окт октябрь +нояб ноябрь +дек декабрь \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/months/abbr_to_name.tsv b/fun_text_processing/text_normalization/ru/data/months/abbr_to_name.tsv new file mode 100644 index 0000000..7a4c61b --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/months/abbr_to_name.tsv @@ -0,0 +1,62 @@ +янв январь 0.1 +янв января -0.1 +янв январю 0.1 +янв январем 0.1 +янв январе 0.1 +фев февраль 0.1 +фев февраль 0.1 +фев февраля -0.1 +фев февралю 0.1 +фев февралем 0.1 +фев феврале 0.1 +мар март 0.1 +мар марта -0.1 +мар марту 0.1 +мар мартом 0.1 +мар марте 0.1 +апр апрель 0.1 +апр апреля -0.1 +апр апрелю 0.1 +апр апрелем 0.1 +апр апреле 0.1 +май май 0.1 +май мая -0.1 +май маю 0.1 +май маем 0.1 +май мае 0.1 +июнь июнь 0.1 +июнь июня -0.1 +июнь июню 0.1 +июнь июнем 0.1 +июнь июне 0.1 +июль июль 0.1 +июль июля -0.1 +июль июлю 0.1 +июль июлем 0.1 +июль июле 0.1 +авг август 0.1 +авг августа -0.1 +авг августу 0.1 +авг август 0.1 +авг августом 0.1 +авг августе 0.1 +сент сентябрь 0.1 +сент сентября -0.1 +сент сентябрю 0.1 +сент сентябрем 0.1 +сент сентябре 0.1 +окт октябрь 0.1 +окт октября -0.1 +окт октябрю 0.1 +окт октябрем 0.1 +окт октябре 0.1 +нояб ноябрь 0.1 +нояб ноября -0.1 +нояб ноябрю 0.1 +нояб ноябрем 0.1 +нояб ноябре 0.1 +дек декабрь 0.1 +дек декабря -0.1 +дек декабрю 0.1 +дек декабрем 0.1 +дек декабре 0.1 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/months/numbers.tsv b/fun_text_processing/text_normalization/ru/data/months/numbers.tsv new file mode 100644 index 0000000..16256a5 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/months/numbers.tsv @@ -0,0 +1,21 @@ +1 янв +2 фев +3 мар +4 апр +5 май +6 июнь +7 июль +8 авг +9 сент +10 окт +11 нояб +12 дек +01 янв +02 фев +03 мар +04 апр +05 май +06 июнь +07 июль +08 авг +09 сент \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/1_cardinals_nominative.tsv b/fun_text_processing/text_normalization/ru/data/numbers/1_cardinals_nominative.tsv new file mode 100644 index 0000000..58c543a --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/1_cardinals_nominative.tsv @@ -0,0 +1,50 @@ +0 ноль +1 один +1 одна +1 одно +1 одни +2 два +2 две +3 три +4 четыре +5 пять +6 шесть +7 семь +8 восемь +9 девять +10 десять +11 одиннадцать +12 двенадцать +13 тринадцать +14 четырнадцать +15 пятнадцать +16 шестнадцать +17 семнадцать +18 восемнадцать +19 девятнадцать +20 двадцать +30 тридцать +40 сорок +50 пятьдесят +60 шестьдесят +70 семьдесят +80 восемьдесят +90 девяносто +100 сто +200 двести +300 триста +400 четыреста +500 пятьсот +600 шестьсот +700 семьсот +800 восемьсот +900 девятьсот +1000 тысяч +1000 тысяча +1000 тысячи +1000000 миллион +1000000 миллиона +1000000 миллионов +1000000000 миллиард +1000000000 миллиарда +1000000000 миллиардов \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/2_cardinals_genitive.tsv b/fun_text_processing/text_normalization/ru/data/numbers/2_cardinals_genitive.tsv new file mode 100644 index 0000000..d46d6a1 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/2_cardinals_genitive.tsv @@ -0,0 +1,45 @@ +0 ноля +1 одного +1 одной +1 одних +2 двух +3 трех +4 четырех +5 пяти +6 шести +7 семи +8 восьми +9 девяти +10 десяти +11 одиннадцати +12 двенадцати +13 тринадцати +14 четырнадцати +15 пятнадцати +16 шестнадцати +17 семнадцати +18 восемнадцати +19 девятнадцати +20 двадцати +30 тридцати +40 сорока +50 пятидесяти +60 шестидесяти +70 семидесяти +80 восьмидесяти +90 девяноста +100 ста +200 двухсот +300 трехсот +400 четырехсот +500 пятисот +600 шестисот +700 семисот +800 восьмисот +900 девятисот +1000 тысячи +1000 тысяч +1000000 миллиона +1000000 миллионов +1000000000 миллиарда +1000000000 миллиардов diff --git a/fun_text_processing/text_normalization/ru/data/numbers/3_cardinals_dative.tsv b/fun_text_processing/text_normalization/ru/data/numbers/3_cardinals_dative.tsv new file mode 100644 index 0000000..85d335f --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/3_cardinals_dative.tsv @@ -0,0 +1,45 @@ +0 нолем +1 одним +1 одному +1 одной +2 двум +3 трем +4 четырем +5 пяти +6 шести +7 семи +8 восьми +9 девяти +10 десяти +11 одиннадцати +12 двенадцати +13 тринадцати +14 четырнадцати +15 пятнадцати +16 шестнадцати +17 семнадцати +18 восемнадцати +19 девятнадцати +20 двадцати +30 тридцати +40 сорока +50 пятидесяти +60 шестидесяти +70 семидесяти +80 восьмидесяти +90 девяноста +100 ста +200 двумстам +300 тремстам +400 четыремстам +500 пятистам +600 шестистам +700 семистам +800 восьмистам +900 девятистам +1000 тысяче +1000 тысячам +1000000 миллиону +1000000 миллионам +1000000000 миллиарду +1000000000 миллиардам diff --git a/fun_text_processing/text_normalization/ru/data/numbers/4_cardinals_accusative.tsv b/fun_text_processing/text_normalization/ru/data/numbers/4_cardinals_accusative.tsv new file mode 100644 index 0000000..51617a4 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/4_cardinals_accusative.tsv @@ -0,0 +1,48 @@ +0 ноль +1 один +1 одного +1 одни +1 одно +1 одну +2 два +2 две +3 трех +4 четырех +5 пять +6 шесть +7 семь +8 восемь +9 девять +10 десять +11 одиннадцать +12 двенадцать +13 тринадцать +14 четырнадцать +15 пятнадцать +16 шестнадцать +17 семнадцать +18 восемнадцать +19 девятнадцать +20 двадцать +30 тридцать +40 сорок +50 пятьдесят +60 шестьдесят +70 семьдесят +80 восемьдесят +90 девяносто +100 сто +200 двести +300 триста +400 четыреста +500 пятьсот +600 шестьсот +700 семьсот +800 восемьсот +900 девятьсот +1000 тысячи +1000 тысячу +1000000 миллион +1000000 миллионы +1000000000 миллиард +1000000000 миллиарды \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/5_cardinals_instrumental.tsv b/fun_text_processing/text_normalization/ru/data/numbers/5_cardinals_instrumental.tsv new file mode 100644 index 0000000..a86f304 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/5_cardinals_instrumental.tsv @@ -0,0 +1,47 @@ +0 нолем +1 одним +1 одними +1 одной +1 одною +1 одну +2 двумя +3 тремя +4 четырьмя +5 пятью +6 шестью +7 семью +8 восемью +8 восьмью +9 девятью +10 десятью +11 одиннадцатью +12 двенадцатью +13 тринадцатью +14 четырнадцатью +15 пятнадцатью +16 шестнадцатью +17 семнадцатью +18 восемнадцатью +19 девятнадцатью +20 двадцатью +30 тридцатью +40 сорока +50 пятьюдесятью +60 шестьюдесятью +70 семьюдесятью +80 восьмьюдесятью +90 девяноста +100 ста +200 двумястами +300 тремястами +400 четырьмястами +500 пятьюстами +600 шестьюстами +700 семьюстами +800 восемьюстами +900 девятьюстами +1000000 миллионами +1000000 миллионом +1000000 миллиону +1000000 миллионы +1000000000 миллиардом diff --git a/fun_text_processing/text_normalization/ru/data/numbers/6_cardinals_prepositional.tsv b/fun_text_processing/text_normalization/ru/data/numbers/6_cardinals_prepositional.tsv new file mode 100644 index 0000000..6a10bc1 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/6_cardinals_prepositional.tsv @@ -0,0 +1,46 @@ +0 ноле +0 нуле +1 одной +1 одном +2 двух +3 трех +4 четырех +5 пяти +6 шести +7 семи +8 восьми +9 девяти +10 десяти +11 одиннадцати +12 двенадцати +13 тринадцати +14 четырнадцати +15 пятнадцати +16 шестнадцати +17 семнадцати +18 восемнадцати +19 девятнадцати +20 двадцати +30 тридцати +40 сорока +50 пятидесяти +60 шестидесяти +70 семидесяти +90 девяноста +100 ста +200 двухстах +300 трехстах +400 четырехстах +500 пятистах +600 шестистах +700 семистах +800 восьмистах +900 девятистах +900 девятьсот +900 девятьюстами +1000 тысячах +1000 тысяче +1000000 миллионах +1000000 миллионе +1000000000 миллиардах +1000000000 миллиарде diff --git a/fun_text_processing/text_normalization/ru/data/numbers/__init__.py b/fun_text_processing/text_normalization/ru/data/numbers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/data/numbers/cardinals_alternatives.tsv b/fun_text_processing/text_normalization/ru/data/numbers/cardinals_alternatives.tsv new file mode 100644 index 0000000..5afd1d6 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/cardinals_alternatives.tsv @@ -0,0 +1,16 @@ +1т одна тысяча +1т одной тысячи +1т одной тысяче +1т одну тысячу +1т одной тысячей +1т одной тысяче +1млн один миллион +1млн одного миллиона +1млн одному миллиону +1млн одним миллионом +1млн одном миллионе +1млрд один миллиард +1млрд одного миллиарда +1млрд одному миллиарду +1млрд одним миллиардом +1млрд одном миллиарде \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/cardinals_nominative_case.tsv b/fun_text_processing/text_normalization/ru/data/numbers/cardinals_nominative_case.tsv new file mode 100644 index 0000000..83cfb22 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/cardinals_nominative_case.tsv @@ -0,0 +1,37 @@ +0 ноль +1 один +2 два +3 три +4 четыре +5 пять +6 шесть +7 семь +8 восемь +9 девять +10 десять +11 одиннадцать +12 двенадцать +13 тринадцать +14 четырнадцать +15 пятнадцать +16 шестнадцать +17 семнадцать +18 восемнадцать +19 девятнадцать +20 двадцать +30 тридцать +40 сорок +50 пятьдесят +60 шестьдесят +70 семьдесят +80 восемьдесят +90 девяносто +100 сто +200 двести +300 триста +400 четыреста +500 пятьсот +600 шестьсот +700 семьсот +800 восемьсот +900 девятьсот \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/decimal_delimiter.tsv b/fun_text_processing/text_normalization/ru/data/numbers/decimal_delimiter.tsv new file mode 100644 index 0000000..fb796cf --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/decimal_delimiter.tsv @@ -0,0 +1,15 @@ +@@decimal_delimiter@@ целого 0.1 +@@decimal_delimiter@@ целому 0.1 +@@decimal_delimiter@@ целый 0.1 +@@decimal_delimiter@@ целого 0.1 +@@decimal_delimiter@@ целым 0.1 +@@decimal_delimiter@@ целом 0.1 +@@decimal_delimiter@@ целая -0.1 +@@decimal_delimiter@@ целой 0.1 +@@decimal_delimiter@@ целую 0.1 +@@decimal_delimiter@@ целою 0.1 +@@decimal_delimiter@@ целые -0.1 +@@decimal_delimiter@@ целых -0.1 +@@decimal_delimiter@@ целым 0.1 +@@decimal_delimiter@@ целые 0.1 +@@decimal_delimiter@@ целыми 0.1 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/decimal_endings.tsv b/fun_text_processing/text_normalization/ru/data/numbers/decimal_endings.tsv new file mode 100644 index 0000000..d2c30e1 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/decimal_endings.tsv @@ -0,0 +1,37 @@ +10 десятая -0.1 +10 десятой 0.1 +10 десятой 0.1 +10 десятую 0.1 +10 десятою 0.1 +10 десятой 0.1 +10 десятые 0.1 +10 десятых -0.1 +10 десятым 0.1 +10 десятыми 0.1 +100 сотые -0.1 +100 сотых -0.1 +100 сотым 0.1 +100 сотыми 0.1 +100 сотая -0.1 +100 сотой 0.1 +100 сотую 0.1 +100 сотою 0.1 +1000 тысячные -0.1 +1000 тысячных -0.1 +1000 тысячным 0.1 +1000 тысячными 0.1 +1000 тысячная -0.1 +1000 тысячной 0.1 +1000 тысячную 0.1 +1000 тысячною 0.1 +10000 десятитысячная -0.1 +10000 десятитысячной 0.1 +10000 десятитысячной 0.1 +10000 десятитысячную 0.1 +10000 десятитысячною 0.1 +10000 десятитысячной 0.1 +10000 десятитысячные 0.1 +10000 десятитысячных -0.1 +10000 десятитысячным 0.1 +10000 десятитысячные 0.1 +10000 десятитысячными 0.1 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/digits_nominative_case.tsv b/fun_text_processing/text_normalization/ru/data/numbers/digits_nominative_case.tsv new file mode 100644 index 0000000..c6663fb --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/digits_nominative_case.tsv @@ -0,0 +1,10 @@ +0 ноль +1 один +2 два +3 три +4 четыре +5 пять +6 шесть +7 семь +8 восемь +9 девять \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/numbers/ordinal_endings.tsv b/fun_text_processing/text_normalization/ru/data/numbers/ordinal_endings.tsv new file mode 100644 index 0000000..7f37fdc --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/ordinal_endings.tsv @@ -0,0 +1,40 @@ +ая-ая +ого-го +ьего-го +ьего-его +ьей-ей +ьему-ему +ьем-ем +ое-е +ые-е +ье-е +ий-ий +ьими-ими +ьим-им +ьих-их +ьи-и +ий-й +ой-й +ый-й +ыми-ми +ьими-ми +ому-му +ьему-му +ого-ого +ое-ое +ой-ой +ом-ом +ому-ому +ую-ую +ых-х +ьих-х +ые-ые +ый-ый +ыми-ыми +ым-ым +ых-ых +ую-ю +ью-ю +ая-я +ья-я +ом-м diff --git a/fun_text_processing/text_normalization/ru/data/numbers/ordinals.tsv b/fun_text_processing/text_normalization/ru/data/numbers/ordinals.tsv new file mode 100644 index 0000000..32b418b --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/ordinals.tsv @@ -0,0 +1,752 @@ +0 нулевая 0.1 +0 нулевого 0.1 +0 нулевое 0.1 +0 нулевой 0.1 +0 нулевом 0.1 +0 нулевому 0.1 +0 нулевую 0.1 +0 нулевые -0.01 +0 нулевым 0.1 +0 нулевыми 0.1 +0 нулевых 0.1 +1 первая -0.01 +1 первого -0.01 +1 первое -0.01 +1 первой 0.1 +1 первом 0.1 +1 первому 0.1 +1 первую 0.1 +1 первые 0.1 +1 первый -0.01 +1 первым 0.1 +1 первыми 0.1 +1 первых 0.1 +2 вторая -0.01 +2 второго 0.1 +2 второе -0.01 +2 второй -0.01 +2 втором 0.1 +2 второму 0.1 +2 вторую 0.1 +2 вторые 0.1 +2 вторым 0.1 +2 вторыми 0.1 +2 вторых 0.1 +3 третий +3 третье +3 третьего +3 третьей +3 третьем +3 третьему +3 третьи +3 третьим +3 третьим +3 третьими +3 третьих +3 третью +3 третья +4 четвертая +4 четвертого +4 четвертое +4 четвертой +4 четвертом +4 четвертому +4 четвертую +4 четвертые +4 четвертый +4 четвертым +4 четвертым +4 четвертыми +4 четвертых +4 четвертая +4 четвертого +4 четвертое +4 четвертой +4 четвертом +4 четвертому +4 четвертую +4 четвертые +4 четвертый +4 четвертым +4 четвертым +4 четвертыми +4 четвертых +5 пятая +5 пятого +5 пятое +5 пятой +5 пятом +5 пятому +5 пятую +5 пятые +5 пятый +5 пятым +5 пятым +5 пятыми +5 пятых +6 шестая +6 шестого +6 шестое +6 шестой +6 шестом +6 шестому +6 шестую +6 шестые +6 шестым +6 шестым +6 шестыми +6 шестых +7 седьмая +7 седьмого +7 седьмое +7 седьмой +7 седьмом +7 седьмому +7 седьмую +7 седьмые +7 седьмым +7 седьмым +7 седьмыми +7 седьмых +8 восьмая +8 восьмого +8 восьмое +8 восьмой +8 восьмом +8 восьмому +8 восьмую +8 восьмые +8 восьмым +8 восьмым +8 восьмыми +8 восьмых +9 девятая +9 девятого +9 девятое +9 девятой +9 девятом +9 девятому +9 девятую +9 девятые +9 девятый +9 девятым +9 девятым +9 девятыми +9 девятых +10 десятая +10 десятого +10 десятое +10 десятой +10 десятом +10 десятому +10 десятую +10 десятые +10 десятый +10 десятым +10 десятым +10 десятыми +10 десятых +11 одиннадцатая +11 одиннадцатого +11 одиннадцатое +11 одиннадцатой +11 одиннадцатом +11 одиннадцатому +11 одиннадцатую +11 одиннадцатые +11 одиннадцатый +11 одиннадцатым +11 одиннадцатым +11 одиннадцатыми +11 одиннадцатых +12 двенадцатая +12 двенадцатого +12 двенадцатое +12 двенадцатой +12 двенадцатом +12 двенадцатому +12 двенадцатую +12 двенадцатые +12 двенадцатый +12 двенадцатым +12 двенадцатым +12 двенадцатыми +12 двенадцатых +13 тринадцатая +13 тринадцатого +13 тринадцатое +13 тринадцатой +13 тринадцатом +13 тринадцатому +13 тринадцатую +13 тринадцатые +13 тринадцатый +13 тринадцатым +13 тринадцатым +13 тринадцатыми +13 тринадцатых +14 четырнадцатая +14 четырнадцатого +14 четырнадцатое +14 четырнадцатой +14 четырнадцатом +14 четырнадцатому +14 четырнадцатую +14 четырнадцатые +14 четырнадцатый +14 четырнадцатым +14 четырнадцатым +14 четырнадцатыми +14 четырнадцатых +15 пятнадцатая +15 пятнадцатого +15 пятнадцатое +15 пятнадцатой +15 пятнадцатом +15 пятнадцатому +15 пятнадцатую +15 пятнадцатые +15 пятнадцатый +15 пятнадцатым +15 пятнадцатым +15 пятнадцатыми +15 пятнадцатых +16 шестнадцатая +16 шестнадцатого +16 шестнадцатое +16 шестнадцатой +16 шестнадцатом +16 шестнадцатому +16 шестнадцатую +16 шестнадцатые +16 шестнадцатый +16 шестнадцатым +16 шестнадцатым +16 шестнадцатыми +16 шестнадцатых +17 семнадцатая +17 семнадцатого +17 семнадцатое +17 семнадцатой +17 семнадцатом +17 семнадцатому +17 семнадцатую +17 семнадцатые +17 семнадцатый +17 семнадцатым +17 семнадцатым +17 семнадцатыми +17 семнадцатых +18 восемнадцатая +18 восемнадцатого +18 восемнадцатое +18 восемнадцатой +18 восемнадцатом +18 восемнадцатому +18 восемнадцатую +18 восемнадцатые +18 восемнадцатый +18 восемнадцатым +18 восемнадцатым +18 восемнадцатыми +18 восемнадцатых +19 девятнадцатая +19 девятнадцатого +19 девятнадцатое +19 девятнадцатой +19 девятнадцатом +19 девятнадцатому +19 девятнадцатую +19 девятнадцатые +19 девятнадцатый +19 девятнадцатым +19 девятнадцатым +19 девятнадцатыми +19 девятнадцатых +20 двадцатая +20 двадцатого +20 двадцатое +20 двадцатой +20 двадцатом +20 двадцатому +20 двадцатую +20 двадцатые +20 двадцатый +20 двадцатым +20 двадцатым +20 двадцатыми +20 двадцатых +30 тридцатая +30 тридцатого +30 тридцатое +30 тридцатой +30 тридцатом +30 тридцатому +30 тридцатую +30 тридцатые +30 тридцатый +30 тридцатым +30 тридцатым +30 тридцатыми +30 тридцатых +40 сороковая +40 сорокового +40 сороковое +40 сороковой +40 сороковом +40 сороковому +40 сороковую +40 сороковые +40 сороковым +40 сороковым +40 сороковыми +40 сороковых +50 пятидесятая +50 пятидесятого +50 пятидесятое +50 пятидесятой +50 пятидесятом +50 пятидесятому +50 пятидесятую +50 пятидесятые +50 пятидесятый +50 пятидесятым +50 пятидесятым +50 пятидесятыми +50 пятидесятых +60 шестидесятая +60 шестидесятого +60 шестидесятое +60 шестидесятой +60 шестидесятом +60 шестидесятому +60 шестидесятую +60 шестидесятые +60 шестидесятый +60 шестидесятым +60 шестидесятым +60 шестидесятыми +60 шестидесятых +70 семидесятая +70 семидесятого +70 семидесятое +70 семидесятой +70 семидесятом +70 семидесятому +70 семидесятую +70 семидесятые +70 семидесятый +70 семидесятым +70 семидесятым +70 семидесятыми +70 семидесятых +80 восьмидесятая +80 восьмидесятого +80 восьмидесятое +80 восьмидесятой +80 восьмидесятом +80 восьмидесятому +80 восьмидесятую +80 восьмидесятые +80 восьмидесятый +80 восьмидесятым +80 восьмидесятым +80 восьмидесятыми +80 восьмидесятых +90 девяностая +90 девяностого +90 девяностое +90 девяностой +90 девяностом +90 девяностому +90 девяностую +90 девяностые +90 девяностый +90 девяностым +90 девяностым +90 девяностыми +90 девяностых +100 сотая +100 сотого +100 сотое +100 сотой +100 сотом +100 сотому +100 сотую +100 сотые +100 сотый +100 сотым +100 сотым +100 сотыми +100 сотых +200 двухсотая +200 двухсотого +200 двухсотое +200 двухсотой +200 двухсотом +200 двухсотому +200 двухсотую +200 двухсотые +200 двухсотый +200 двухсотым +200 двухсотым +200 двухсотыми +200 двухсотых +300 трехсотая +300 трехсотого +300 трехсотое +300 трехсотой +300 трехсотом +300 трехсотому +300 трехсотую +300 трехсотые +300 трехсотый +300 трехсотым +300 трехсотым +300 трехсотыми +300 трехсотых +400 четырехсотая +400 четырехсотого +400 четырехсотое +400 четырехсотой +400 четырехсотом +400 четырехсотому +400 четырехсотую +400 четырехсотые +400 четырехсотый +400 четырехсотым +400 четырехсотым +400 четырехсотыми +400 четырехсотых +500 пятисотая +500 пятисотого +500 пятисотое +500 пятисотой +500 пятисотом +500 пятисотому +500 пятисотую +500 пятисотые +500 пятисотый +500 пятисотым +500 пятисотым +500 пятисотыми +500 пятисотых +600 шестисотая +600 шестисотого +600 шестисотое +600 шестисотой +600 шестисотом +600 шестисотому +600 шестисотую +600 шестисотые +600 шестисотый +600 шестисотым +600 шестисотым +600 шестисотыми +600 шестисотых +700 семисотая +700 семисотого +700 семисотое +700 семисотой +700 семисотом +700 семисотому +700 семисотую +700 семисотые +700 семисотый +700 семисотым +700 семисотым +700 семисотыми +700 семисотых +800 восьмисотая +800 восьмисотого +800 восьмисотое +800 восьмисотой +800 восьмисотом +800 восьмисотому +800 восьмисотую +800 восьмисотые +800 восьмисотый +800 восьмисотым +800 восьмисотым +800 восьмисотыми +800 восьмисотых +900 девятисотая +900 девятисотого +900 девятисотое +900 девятисотой +900 девятисотом +900 девятисотому +900 девятисотую +900 девятисотые +900 девятисотый +900 девятисотым +900 девятисотым +900 девятисотыми +900 девятисотых +1000 тысячная +1000 тысячного +1000 тысячное +1000 тысячной +1000 тысячном +1000 тысячному +1000 тысячную +1000 тысячные +1000 тысячный +1000 тысячным +1000 тысячным +1000 тысячными +1000 тысячных +1000000 миллионная +1000000 миллионного +1000000 миллионное +1000000 миллионной +1000000 миллионном +1000000 миллионному +1000000 миллионную +1000000 миллионные +1000000 миллионный +1000000 миллионным +1000000 миллионным +1000000 миллионными +1000000 миллионных +1000000000 миллиардная +1000000000 миллиардного +1000000000 миллиардное +1000000000 миллиардной +1000000000 миллиардном +1000000000 миллиардному +1000000000 миллиардную +1000000000 миллиардные +1000000000 миллиардный +1000000000 миллиардным +1000000000 миллиардным +1000000000 миллиардными +1000000000 миллиардных +2000 двухтысячная +2000 двухтысячных +2000 двухтысячные +2000 двухтысячный +2000 двухтысячными +2000 двухтысячному +2000 двухтысячным +2000 двухтысячном +2000 двухтысячной +2000 двухтысячного +2000 двухтысячную +2000 двухтысячное +3000 трехтысячное +3000 трехтысячных +3000 трехтысячного +3000 трехтысячные +3000 трехтысячную +3000 трехтысячная +3000 трехтысячному +3000 трехтысячной +3000 трехтысячном +3000 трехтысячный +3000 трехтысячным +3000 трехтысячными +4000 четырехтысячных +4000 четырехтысячный +4000 четырехтысячное +4000 четырехтысячным +4000 четырехтысячными +4000 четырехтысячные +4000 четырехтысячному +4000 четырехтысячного +4000 четырехтысячной +4000 четырехтысячная +4000 четырехтысячную +4000 четырехтысячном +5000 пятитысячными +5000 пятитысячные +5000 пятитысячному +5000 пятитысячную +5000 пятитысячного +5000 пятитысячной +5000 пятитысячным +5000 пятитысячная +5000 пятитысячное +5000 пятитысячных +5000 пятитысячном +5000 пятитысячный +6000 шеститысячных +6000 шеститысячным +6000 шеститысячная +6000 шеститысячной +6000 шеститысячными +6000 шеститысячные +6000 шеститысячное +6000 шеститысячную +6000 шеститысячный +6000 шеститысячному +6000 шеститысячного +6000 шеститысячном +7000 семитысячную +7000 семитысячная +7000 семитысячном +7000 семитысячным +7000 семитысячного +7000 семитысячной +7000 семитысячный +7000 семитысячное +7000 семитысячных +7000 семитысячными +7000 семитысячные +7000 семитысячному +8000 восьмитысячному +8000 восьмитысячном +8000 восьмитысячную +8000 восьмитысячная +8000 восьмитысячными +8000 восьмитысячный +8000 восьмитысячной +8000 восьмитысячного +8000 восьмитысячное +8000 восьмитысячных +8000 восьмитысячным +8000 восьмитысячные +9000 девятитысячных +9000 девятитысячная +9000 девятитысячное +9000 девятитысячному +9000 девятитысячными +9000 девятитысячного +9000 девятитысячной +9000 девятитысячном +9000 девятитысячный +9000 девятитысячные +9000 девятитысячную +9000 девятитысячным +10000 десятитысячным +10000 десятитысячное +10000 десятитысячных +10000 десятитысячными +10000 десятитысячный +10000 десятитысячная +10000 десятитысячные +10000 десятитысячном +10000 десятитысячного +10000 десятитысячному +10000 десятитысячной +10000 десятитысячную +11000 одиннадцатитысячном +11000 одиннадцатитысячное +11000 одиннадцатитысячными +11000 одиннадцатитысячная +11000 одиннадцатитысячных +11000 одиннадцатитысячной +11000 одиннадцатитысячного +11000 одиннадцатитысячную +11000 одиннадцатитысячные +11000 одиннадцатитысячный +11000 одиннадцатитысячным +11000 одиннадцатитысячному +12000 двенадцатитысячного +12000 двенадцатитысячным +12000 двенадцатитысячной +12000 двенадцатитысячную +12000 двенадцатитысячный +12000 двенадцатитысячном +12000 двенадцатитысячными +12000 двенадцатитысячная +12000 двенадцатитысячному +12000 двенадцатитысячные +12000 двенадцатитысячное +12000 двенадцатитысячных +13000 тринадцатитысячных +13000 тринадцатитысячные +13000 тринадцатитысячной +13000 тринадцатитысячным +13000 тринадцатитысячное +13000 тринадцатитысячного +13000 тринадцатитысячная +13000 тринадцатитысячном +13000 тринадцатитысячными +13000 тринадцатитысячный +13000 тринадцатитысячную +13000 тринадцатитысячному +14000 четырнадцатитысячных +14000 четырнадцатитысячном +14000 четырнадцатитысячным +14000 четырнадцатитысячной +14000 четырнадцатитысячному +14000 четырнадцатитысячная +14000 четырнадцатитысячными +14000 четырнадцатитысячный +14000 четырнадцатитысячные +14000 четырнадцатитысячную +14000 четырнадцатитысячного +14000 четырнадцатитысячное +15000 пятнадцатитысячное +15000 пятнадцатитысячных +15000 пятнадцатитысячный +15000 пятнадцатитысячной +15000 пятнадцатитысячную +15000 пятнадцатитысячном +15000 пятнадцатитысячным +15000 пятнадцатитысячными +15000 пятнадцатитысячные +15000 пятнадцатитысячному +15000 пятнадцатитысячная +15000 пятнадцатитысячного +16000 шестнадцатитысячному +16000 шестнадцатитысячным +16000 шестнадцатитысячные +16000 шестнадцатитысячное +16000 шестнадцатитысячный +16000 шестнадцатитысячными +16000 шестнадцатитысячном +16000 шестнадцатитысячного +16000 шестнадцатитысячной +16000 шестнадцатитысячных +16000 шестнадцатитысячная +16000 шестнадцатитысячную +17000 семнадцатитысячного +17000 семнадцатитысячный +17000 семнадцатитысячное +17000 семнадцатитысячному +17000 семнадцатитысячную +17000 семнадцатитысячная +17000 семнадцатитысячной +17000 семнадцатитысячными +17000 семнадцатитысячным +17000 семнадцатитысячном +17000 семнадцатитысячные +17000 семнадцатитысячных +18000 восемнадцатитысячные +18000 восемнадцатитысячным +18000 восемнадцатитысячный +18000 восемнадцатитысячного +18000 восемнадцатитысячному +18000 восемнадцатитысячными +18000 восемнадцатитысячное +18000 восемнадцатитысячном +18000 восемнадцатитысячных +18000 восемнадцатитысячной +18000 восемнадцатитысячную +18000 восемнадцатитысячная +19000 девятнадцатитысячных +19000 девятнадцатитысячного +19000 девятнадцатитысячному +19000 девятнадцатитысячный +19000 девятнадцатитысячным +19000 девятнадцатитысячные +19000 девятнадцатитысячной +19000 девятнадцатитысячными +19000 девятнадцатитысячном +19000 девятнадцатитысячную +19000 девятнадцатитысячная +19000 девятнадцатитысячное +20000 двадцатитысячном +20000 двадцатитысячной +20000 двадцатитысячная +20000 двадцатитысячным +20000 двадцатитысячными +20000 двадцатитысячный +20000 двадцатитысячного +20000 двадцатитысячному +20000 двадцатитысячное +20000 двадцатитысячные +20000 двадцатитысячных +20000 двадцатитысячную diff --git a/fun_text_processing/text_normalization/ru/data/numbers/quantity.tsv b/fun_text_processing/text_normalization/ru/data/numbers/quantity.tsv new file mode 100644 index 0000000..3dca772 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/numbers/quantity.tsv @@ -0,0 +1,16 @@ +тысяч тысяч 0.1 +тысяча тысяча 0.1 +тысячи тысячи 0.1 +тыс. тысячи 0.1 +тыс тысячи -0.1 +миллион миллион 0.1 +миллионов миллионов 0.1 +миллиона миллиона 0.1 +миллиона миллиона 0.1 +млн. миллиона 0.1 +млн миллиона -0.1 +миллиарда миллиарда 0.1 +миллиард миллиард 0.1 +миллиардов миллиардов 0.1 +млрд. миллиарда 0.1 +млрд миллиарда -0.1 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/time/__init__.py b/fun_text_processing/text_normalization/ru/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/data/time/increment_hour_cardinal.tsv b/fun_text_processing/text_normalization/ru/data/time/increment_hour_cardinal.tsv new file mode 100644 index 0000000..96fd677 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/time/increment_hour_cardinal.tsv @@ -0,0 +1,24 @@ +00 час -0.1 +01 два -0.1 +02 три -0.1 +03 четыре -0.1 +04 пять -0.1 +05 шесть -0.1 +06 семь -0.1 +07 восемь -0.1 +08 девять -0.1 +09 десять -0.1 +10 одиннадцать 0.1 +11 двенадцать 0.1 +12 час 0.1 +13 два 0.1 +14 три 0.1 +15 четыре 0.1 +16 пять 0.1 +17 шесть 0.1 +18 семь 0.1 +19 восемь 0.1 +20 девять 0.1 +21 десять 0.1 +22 одиннадцать 0.1 +23 двенадцать 0.1 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/time/increment_hour_ordinal.tsv b/fun_text_processing/text_normalization/ru/data/time/increment_hour_ordinal.tsv new file mode 100644 index 0000000..83583e1 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/time/increment_hour_ordinal.tsv @@ -0,0 +1,24 @@ +00 первого 0.1 +01 второго -0.1 +02 третьего -0.1 +03 четвертого -0.1 +04 пятого -0.1 +05 шестого -0.1 +06 седьмого -0.1 +07 восьмого -0.1 +08 девятого -0.1 +09 десятого -0.1 +10 одиннадцатого -0.1 +11 двенадцатого -0.1 +12 первого -0.1 +13 второго 0.1 +14 третьего 0.1 +15 четвертого 0.1 +16 пятого 0.1 +17 шестого 0.1 +18 седьмого 0.1 +19 восьмого 0.1 +20 девятого 0.1 +21 десятого 0.1 +22 одиннадцатого 0.1 +23 двенадцатого 0.1 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/time/minutes_to_hour.tsv b/fun_text_processing/text_normalization/ru/data/time/minutes_to_hour.tsv new file mode 100644 index 0000000..50ab971 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/time/minutes_to_hour.tsv @@ -0,0 +1,25 @@ +59 одной минуты +58 двух минут +57 трех минут +56 четырех минут +55 пяти минут +54 шести минут +53 семи минут +52 восеми минут +51 девяти минут +50 десяти минут +49 одиннадцати минут +48 двенадцати минут +47 тринадцати минут +46 четырнадцати минут +45 пятнадцати минут +44 шестнадцати минут +43 семнадцати минут +42 восемьнадцати минут +41 девятнадцати минут +40 двадцати минут +39 двадцати одной минуты +38 двадцати двух минут +37 двадцати трех минут +36 двадцати четырех минут +35 двадцать пяти минут diff --git a/fun_text_processing/text_normalization/ru/data/time/time_convert.tsv b/fun_text_processing/text_normalization/ru/data/time/time_convert.tsv new file mode 100644 index 0000000..b10345c --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/time/time_convert.tsv @@ -0,0 +1,12 @@ +13 1 +14 2 +15 3 +16 4 +17 5 +18 6 +19 7 +20 8 +21 9 +22 10 +23 11 +24 12 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/data/utils/__init__.py b/fun_text_processing/text_normalization/ru/data/utils/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/utils/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/data/utils/g.fst b/fun_text_processing/text_normalization/ru/data/utils/g.fst new file mode 100644 index 0000000..66665f3 Binary files /dev/null and b/fun_text_processing/text_normalization/ru/data/utils/g.fst differ diff --git a/fun_text_processing/text_normalization/ru/data/utils/universal_thousands_punct.far b/fun_text_processing/text_normalization/ru/data/utils/universal_thousands_punct.far new file mode 100644 index 0000000..4c24b65 Binary files /dev/null and b/fun_text_processing/text_normalization/ru/data/utils/universal_thousands_punct.far differ diff --git a/fun_text_processing/text_normalization/ru/data/utils/util_arithmetic.far b/fun_text_processing/text_normalization/ru/data/utils/util_arithmetic.far new file mode 100644 index 0000000..584f04d Binary files /dev/null and b/fun_text_processing/text_normalization/ru/data/utils/util_arithmetic.far differ diff --git a/fun_text_processing/text_normalization/ru/data/utils/util_byte.far b/fun_text_processing/text_normalization/ru/data/utils/util_byte.far new file mode 100644 index 0000000..eabf8f1 Binary files /dev/null and b/fun_text_processing/text_normalization/ru/data/utils/util_byte.far differ diff --git a/fun_text_processing/text_normalization/ru/data/whitelist.tsv b/fun_text_processing/text_normalization/ru/data/whitelist.tsv new file mode 100644 index 0000000..7bc8e79 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/data/whitelist.tsv @@ -0,0 +1,37 @@ +гг. годы +г. год +г. году +г. год +г. года +г. годом +г. годе +§ параграф +комн. комнатная +эт. этажный +кв. квартира +кв. квартал +кв. квартала +кв. кварталу +кв. кварталом +кв. квартале +ЖК женская консультация +ЖК жидкие кристаллы +ЖК жилой комплекс +ЖК жилищный кооператив +ЖК жилищный кодекс +р-н район +до н. э. до нашей эры +н. э. нашей эры +см. также смотри также +с.ш. северной широты +ю.ш. южной широты +в.д. восточной долготы +з.д. западной долготы +и т. д. и так далее +и т. п. и тому подобное +б/у бывший в употреблении +экз. экземпляр +экз. экземпляры +и др. и другие +и пр. и прочие +т.е. то есть \ No newline at end of file diff --git a/fun_text_processing/text_normalization/ru/taggers/__init__.py b/fun_text_processing/text_normalization/ru/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/taggers/cardinal.py b/fun_text_processing/text_normalization/ru/taggers/cardinal.py new file mode 100644 index 0000000..9264146 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/cardinal.py @@ -0,0 +1,165 @@ +# Copyright 2017 Google Inc. + + +# Adapted from https://github.com/google/TextNormalizationCoveringGrammars +# Russian minimally supervised number grammar. + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, + insert_space, +) +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA, TO_CYRILLIC +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals, e.g. + "1 001" -> cardinal { integer: "тысяча один" } + + Args: + number_names: number_names for cardinal and ordinal numbers + alternative_formats: alternative number formats + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, number_names: dict, alternative_formats: dict, deterministic: bool = False): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + + self.cardinal_numbers_default = self.get_cardinal_numbers( + number_names, alternative_formats, mode="all" + ) + self.cardinal_numbers_nominative = self.get_cardinal_numbers( + number_names, alternative_formats, mode="nominative" + ) + self.optional_graph_negative = pynini.closure( + pynutil.insert("negative: ") + pynini.cross("-", '"true"') + insert_space, 0, 1 + ) + + self.cardinal_numbers_with_optional_negative = ( + self.optional_graph_negative + + pynutil.insert('integer: "') + + self.cardinal_numbers_default + + pynutil.insert('"') + ) + + # "03" -> remove leading zeros and verbalize + leading_zeros = pynini.closure(pynini.cross("0", "")) + self.cardinal_numbers_with_leading_zeros = ( + leading_zeros + self.cardinal_numbers_default + ).optimize() + + # "123" -> "один два три" + single_digits_graph = pynini.string_file( + get_abs_path("data/numbers/cardinals_nominative_case.tsv") + ).optimize() + single_digits_graph = pynini.compose(DAMO_DIGIT, single_digits_graph) + self.single_digits_graph = single_digits_graph + pynini.closure( + insert_space + single_digits_graph + ) + + optional_quantity = pynini.string_file(get_abs_path("data/numbers/quantity.tsv")).optimize() + optional_quantity = pynutil.insert('quantity: "') + optional_quantity + pynutil.insert('"') + optional_quantity = pynini.closure( + (pynutil.add_weight(pynini.accep(DAMO_SPACE), -0.1) | insert_space) + optional_quantity, + 0, + 1, + ) + + serial_graph = self.get_serial_graph() + + final_graph = ( + self.optional_graph_negative + + pynutil.insert('integer: "') + + self.cardinal_numbers_with_leading_zeros + + pynutil.insert('"') + + optional_quantity + ).optimize() + + final_graph = pynutil.add_weight(final_graph, -0.1) + final_graph |= ( + pynutil.insert('integer: "') + + pynutil.add_weight(serial_graph, 10) + + pynutil.insert('"') + ) + self.final_graph = final_graph + + # to cover cases "2-х" -> "двух" (this is not covered by ordinal endings) + final_graph |= pynini.compose( + pynini.compose(DAMO_DIGIT ** (1, ...) + pynini.cross("-х", ""), final_graph), + DAMO_SIGMA + pynini.accep('х"') + DAMO_SIGMA, + ) + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() + + def get_cardinal_numbers( + self, number_names: dict, alternative_formats: dict, mode: str = "all" + ): + """Returns cardinal numbers names graph. + + Args: + number_names: number_names for cardinal and ordinal numbers + alternative_formats: alternative number formats + mode: "all" - to return graph that includes all Ru cases, "nominative" to return only the nominative form + """ + if mode == "all": + cardinal_names = number_names["cardinal_number_names"] + elif mode == "nominative": + cardinal_names = number_names["cardinal_names_nominative"] + else: + raise ValueError(f"{mode} is not supported.") + one_thousand_alternative = alternative_formats["one_thousand_alternative"] + separators = alternative_formats["separators"] + + cardinal_numbers = cardinal_names | pynini.compose(cardinal_names, one_thousand_alternative) + cardinal_numbers = pynini.compose(separators, cardinal_numbers) + return cardinal_numbers + + def get_serial_graph(self): + """ + Finite state transducer for classifying serial. + The serial is a combination of digits, letters and dashes, e.g.: + c325-b -> tokens { cardinal { integer: "си три два пять би" } } + """ + num_graph = self.single_digits_graph + + alpha = TO_CYRILLIC | RU_ALPHA + + delimiter = insert_space | pynini.cross("-", " ") | pynini.cross("/", " ") + letter_num = pynini.closure(alpha + delimiter, 1) + num_graph + num_letter = pynini.closure(num_graph + delimiter, 1) + alpha + num_delimiter_num = pynini.closure(num_graph + delimiter, 1) + num_graph + next_alpha_or_num = pynini.closure(delimiter + (alpha | num_graph)) + serial_graph = (letter_num | num_letter | num_delimiter_num) + next_alpha_or_num + + # at least 1 alpha and 1 digit is present + at_least_one_alpha_num = ( + DAMO_SIGMA + + (RU_ALPHA | pynini.project(TO_CYRILLIC, "input")) + + DAMO_SIGMA + + DAMO_DIGIT + + DAMO_SIGMA + ) | ( + DAMO_SIGMA + + DAMO_DIGIT + + DAMO_SIGMA + + (RU_ALPHA | pynini.project(TO_CYRILLIC, "input")) + + DAMO_SIGMA + ) + serial_graph = pynini.compose(at_least_one_alpha_num, serial_graph.optimize()).optimize() + # numbers only with 2+ delimiters + serial_graph |= ( + num_graph + + delimiter + + num_graph + + delimiter + + num_graph + + pynini.closure(delimiter + num_graph) + ).optimize() + return serial_graph.optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/date.py b/fun_text_processing/text_normalization/ru/taggers/date.py new file mode 100644 index 0000000..904308e --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/date.py @@ -0,0 +1,139 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_NOT_QUOTE, + DAMO_SIGMA, + GraphFst, + delete_extra_space, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for classifying date, e.g. + "01.05" -> tokens { date { day: "первое мая" } } + + Args: + number_names: number_names for cardinal and ordinal numbers + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, number_names: dict, deterministic: bool): + super().__init__(name="date", kind="classify", deterministic=deterministic) + + # Ru format: DD-MM-YYYY or DD-MM-YY + month_abbr_to_names = pynini.string_file( + get_abs_path("data/months/abbr_to_name.tsv") + ).optimize() + + delete_sep = pynutil.add_weight(pynini.cross(".", " "), 1.09) | pynutil.add_weight( + pynini.cross(pynini.union("/", "-"), " "), 1.1 + ) + + numbers = number_names["ordinal_number_names"] + + zero = (pynutil.add_weight(pynini.cross("0", ""), -0.1)) | ( + pynutil.add_weight(pynini.cross("0", "ноль "), 0.1) + ) + zero_digit = zero + pynini.compose(DAMO_DIGIT, numbers) + digit_day = (pynini.union("1", "2", "3") + DAMO_DIGIT) | DAMO_DIGIT + digit_day = pynini.compose(digit_day, numbers) + + day = zero_digit | digit_day + day = pynini.compose( + day, + pynini.difference(DAMO_SIGMA, DAMO_SIGMA + pynini.union("ой", "ая", "ых", "ые", "ыми")), + ) + day = (pynutil.insert('day: "') + day + pynutil.insert('"')).optimize() + + digit_month = zero_digit | pynini.compose(pynini.accep("1") + DAMO_DIGIT, numbers) + month_number_to_abbr = pynini.string_file( + get_abs_path("data/months/numbers.tsv") + ).optimize() + month_number_to_abbr = ( + ( + ((pynutil.add_weight(pynini.cross("0", ""), -0.1) | pynini.accep("1")) + DAMO_DIGIT) + | DAMO_DIGIT + ).optimize() + @ month_number_to_abbr + ).optimize() + + month_name = ( + (month_number_to_abbr @ month_abbr_to_names) + | pynutil.add_weight(month_abbr_to_names, 0.1) + ).optimize() + month = ( + pynutil.insert('month: "') + + (month_name | pynutil.add_weight(digit_month, 0.1)) + + pynutil.insert('"') + ).optimize() + year = pynini.compose(((DAMO_DIGIT**4) | (DAMO_DIGIT**2)), numbers).optimize() + year |= zero_digit + + # reduce year options + year_wrong_endings = ["ую", "ая"] + year_wrong_beginning = ["две тысяча", "два тысяч", "два тысячи", "две тысяч "] + year = pynini.compose( + year, pynini.difference(DAMO_SIGMA, DAMO_SIGMA + pynini.union("ой", "ого")) + ) | pynutil.add_weight(pynini.compose(year, DAMO_SIGMA + pynini.union("ой", "ого")), -0.1) + + year_restrict1 = pynini.difference( + DAMO_SIGMA, pynini.union(*year_wrong_beginning) + DAMO_SIGMA + ) + year_restrict2 = pynini.difference( + DAMO_SIGMA, DAMO_SIGMA + pynini.union(*year_wrong_endings) + ) + year = pynini.compose(pynini.compose(year, year_restrict1), year_restrict2) + + year_word_singular = ["год", "года", "году", "годом", "годе"] + year_word_plural = ["годы", "годов", "годам", "годами", "годам", "годах"] + + year_word = pynini.cross("г.", pynini.union(*year_word_singular)) + year_word |= pynini.cross("гг.", pynini.union(*year_word_plural)) + year_word = ( + pynutil.add_weight(insert_space, -0.1) | pynutil.add_weight(pynini.accep(" "), 0.1) + ) + year_word + + year_optional = ( + pynutil.insert('year: "') + year + pynini.closure(year_word, 0, 1) + pynutil.insert('"') + ) + year_optional = pynini.closure(delete_sep + year_optional, 0, 1).optimize() + year_only = pynutil.insert('year: "') + year + year_word + pynutil.insert('"') + + tagger_graph = (day + delete_sep + month + year_optional) | year_only + + # Verbalizer + day = ( + pynutil.delete("day:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + month = ( + pynutil.delete("month:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + year = ( + pynutil.delete("year:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + delete_space + + pynutil.delete('"') + ) + year_optional = pynini.closure(delete_extra_space + year, 0, 1) + graph_dmy = day + delete_extra_space + month + year_optional + verbalizer_graph = (graph_dmy | year) + delete_space + + self.final_graph = pynini.compose(tagger_graph, verbalizer_graph).optimize() + self.fst = pynutil.insert('day: "') + self.final_graph + pynutil.insert('"') + self.fst = self.add_tokens(self.fst).optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/decimals.py b/fun_text_processing/text_normalization/ru/taggers/decimals.py new file mode 100644 index 0000000..7d7d73f --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/decimals.py @@ -0,0 +1,114 @@ +from collections import defaultdict + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + DAMO_SPACE, + GraphFst, + insert_space, +) +from fun_text_processing.text_normalization.en.utils import load_labels +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + +delete_space = pynutil.delete(" ") + + +def prepare_labels_for_insertion(file_path: str): + """ + Read the file and creates a union insertion graph + + Args: + file_path: path to a file (3 columns: a label type e.g. + "@@decimal_delimiter@@", a label e.g. "целого", and a weight e.g. "0.1"). + + Returns dictionary mapping from label type to an fst that inserts the labels with the specified weights. + + """ + labels = load_labels(file_path) + mapping = defaultdict(list) + for k, v, w in labels: + mapping[k].append((v, w)) + + for k in mapping: + mapping[k] = ( + insert_space + + pynini.union( + *[pynutil.add_weight(pynutil.insert(end), weight) for end, weight in mapping[k]] + ) + ).optimize() + return mapping + + +class DecimalFst(GraphFst): + """ + Finite state transducer for classifying decimal, e.g. + "1,08" -> tokens { decimal { integer_part: "одно целая" fractional_part: "восемь сотых} } + + Args: + cardinal: CardinalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, deterministic: bool = False): + super().__init__(name="decimal", kind="classify", deterministic=deterministic) + + integer_part = cardinal.cardinal_numbers_default + cardinal_numbers_with_leading_zeros = cardinal.cardinal_numbers_with_leading_zeros + + delimiter_map = prepare_labels_for_insertion( + get_abs_path("data/numbers/decimal_delimiter.tsv") + ) + delimiter = ( + pynini.cross(",", "") + + delimiter_map["@@decimal_delimiter@@"] + + pynini.closure(pynutil.add_weight(pynutil.insert(" и"), 0.5), 0, 1) + ).optimize() + + decimal_endings_map = prepare_labels_for_insertion( + get_abs_path("data/numbers/decimal_endings.tsv") + ) + + self.integer_part = integer_part + delimiter + graph_integer = pynutil.insert('integer_part: "') + self.integer_part + pynutil.insert('"') + + graph_fractional = ( + DAMO_DIGIT @ cardinal_numbers_with_leading_zeros + decimal_endings_map["10"] + ) + graph_fractional |= ( + DAMO_DIGIT + DAMO_DIGIT + ) @ cardinal_numbers_with_leading_zeros + decimal_endings_map["100"] + graph_fractional |= ( + DAMO_DIGIT + DAMO_DIGIT + DAMO_DIGIT + ) @ cardinal_numbers_with_leading_zeros + decimal_endings_map["1000"] + graph_fractional |= ( + DAMO_DIGIT + DAMO_DIGIT + DAMO_DIGIT + DAMO_DIGIT + ) @ cardinal_numbers_with_leading_zeros + decimal_endings_map["10000"] + + self.optional_quantity = pynini.string_file( + get_abs_path("data/numbers/quantity.tsv") + ).optimize() + + self.graph_fractional = graph_fractional + graph_fractional = ( + pynutil.insert('fractional_part: "') + graph_fractional + pynutil.insert('"') + ) + optional_quantity = pynini.closure( + (pynutil.add_weight(pynini.accep(DAMO_SPACE), -0.1) | insert_space) + + pynutil.insert('quantity: "') + + self.optional_quantity + + pynutil.insert('"'), + 0, + 1, + ) + self.final_graph = ( + cardinal.optional_graph_negative + + graph_integer + + insert_space + + graph_fractional + + optional_quantity + ) + + self.final_graph = self.add_tokens(self.final_graph) + self.fst = self.final_graph.optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/electronic.py b/fun_text_processing/text_normalization/ru/taggers/electronic.py new file mode 100644 index 0000000..f1d0eeb --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/electronic.py @@ -0,0 +1,113 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_ALPHA, + DAMO_DIGIT, + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA, TO_CYRILLIC +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for classifying electronic: email addresses + e.g. "ab@nd.ru" -> electronic { username: "эй би собака эн ди точка ру" } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="classify", deterministic=deterministic) + + # tagger + accepted_symbols = [] + with open(get_abs_path("data/electronic/symbols.tsv"), "r", encoding="utf-8") as f: + for line in f: + symbol, _ = line.split("\t") + accepted_symbols.append(pynini.accep(symbol)) + username = ( + pynutil.insert('username: "') + + DAMO_ALPHA + + pynini.closure(DAMO_ALPHA | DAMO_DIGIT | pynini.union(*accepted_symbols)) + + pynutil.insert('"') + + pynini.cross("@", " ") + ) + domain_graph = ( + DAMO_ALPHA + + (pynini.closure(DAMO_ALPHA | DAMO_DIGIT | pynini.accep("-") | pynini.accep("."))) + + (DAMO_ALPHA | DAMO_DIGIT) + ) + domain_graph = pynutil.insert('domain: "') + domain_graph + pynutil.insert('"') + tagger_graph = (username + domain_graph).optimize() + + # verbalizer + graph_digit = pynini.string_file( + get_abs_path("data/numbers/digits_nominative_case.tsv") + ).optimize() + graph_symbols = pynini.string_file(get_abs_path("data/electronic/symbols.tsv")).optimize() + user_name = ( + pynutil.delete("username:") + + delete_space + + pynutil.delete('"') + + ( + pynini.closure( + pynutil.add_weight(graph_digit + insert_space, 1.09) + | pynutil.add_weight(pynini.closure(graph_symbols + pynutil.insert(" ")), 1.09) + | pynutil.add_weight(DAMO_NOT_QUOTE + insert_space, 1.1) + ) + ) + + pynutil.delete('"') + ) + + domain_default = ( + pynini.closure(DAMO_NOT_QUOTE + insert_space) + + pynini.cross(".", "точка ") + + DAMO_NOT_QUOTE + + pynini.closure(insert_space + DAMO_NOT_QUOTE) + ) + + server_default = ( + pynini.closure((graph_digit | DAMO_ALPHA) + insert_space, 1) + + pynini.closure(graph_symbols + insert_space) + + pynini.closure((graph_digit | DAMO_ALPHA) + insert_space, 1) + ) + server_common = ( + pynini.string_file(get_abs_path("data/electronic/server_name.tsv")) + insert_space + ) + domain_common = pynini.cross(".", "точка ") + pynini.string_file( + get_abs_path("data/electronic/domain.tsv") + ) + domain = ( + pynutil.delete("domain:") + + delete_space + + pynutil.delete('"') + + (pynutil.add_weight(server_common, 1.09) | pynutil.add_weight(server_default, 1.1)) + + (pynutil.add_weight(domain_common, 1.09) | pynutil.add_weight(domain_default, 1.1)) + + delete_space + + pynutil.delete('"') + ) + + graph = ( + user_name + + delete_space + + pynutil.insert("собака ") + + delete_space + + domain + + delete_space + ) + # replace all latin letters with their Ru verbalization + verbalizer_graph = ( + graph.optimize() @ (pynini.closure(TO_CYRILLIC | RU_ALPHA | pynini.accep(" "))) + ).optimize() + verbalizer_graph = verbalizer_graph.optimize() + + self.final_graph = (tagger_graph @ verbalizer_graph).optimize() + self.fst = self.add_tokens( + pynutil.insert('username: "') + self.final_graph + pynutil.insert('"') + ).optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/measure.py b/fun_text_processing/text_normalization/ru/taggers/measure.py new file mode 100644 index 0000000..b1ff90d --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/measure.py @@ -0,0 +1,183 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NON_BREAKING_SPACE, + DAMO_NOT_QUOTE, + DAMO_SPACE, + GraphFst, + insert_space, +) +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for classifying measure, e.g. + "2 кг" -> measure { cardinal { integer: "два килограма" } } + This class also converts words containing numbers and letters + e.g. "тест-8" —> "тест восемь" + e.g. "тест-1,02" —> "тест одна целая две сотых" + + Args: + cardinal: CardinalFst + decimal: DecimalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="measure", kind="classify", deterministic=deterministic) + + # adding weight to make sure the space is preserved for ITN + delete_space = pynini.closure( + pynutil.add_weight( + pynutil.delete(pynini.union(DAMO_SPACE, DAMO_NON_BREAKING_SPACE)), -1 + ), + 0, + 1, + ) + + cardinal_graph = cardinal.cardinal_numbers_default + cardinal_graph_nominative = cardinal.cardinal_numbers_nominative + graph_unit = pynini.string_file(get_abs_path("data/measurements.tsv")) + optional_graph_negative = cardinal.optional_graph_negative + + space_for_units = ( + pynutil.add_weight(pynutil.insert(DAMO_NON_BREAKING_SPACE), -0.1) + | pynutil.add_weight(pynutil.insert(DAMO_SPACE), 0.1) + ).optimize() + slash_unit = ( + (pynini.cross("/", "в") | pynini.cross("/", "за")) + space_for_units + graph_unit + ) + + unit_slash_unit = pynutil.add_weight(graph_unit + space_for_units + slash_unit, -0.1) + default_units = ( + pynutil.insert('units: "') + (graph_unit | unit_slash_unit) + pynutil.insert('"') + ) + slash_units = pynutil.insert('units: "') + slash_unit + pynutil.insert('"') + subgraph_decimal = decimal.final_graph + ((delete_space + default_units) | slash_units) + + cardinal_space = ( + pynutil.insert("cardinal { ") + + optional_graph_negative + + pynutil.insert('integer: "') + + cardinal_graph + + ( + (delete_space + pynutil.insert('"') + pynutil.insert(" } ") + default_units) + | (pynutil.insert('"') + pynutil.insert(" } ") + slash_units) + ) + ) + + cardinal_optional_dash_alpha = ( + pynutil.insert('cardinal { integer: "') + + cardinal_graph + + pynini.closure(pynini.cross("-", ""), 0, 1) + + pynutil.insert('" } units: "') + + pynini.closure(RU_ALPHA, 1) + + pynutil.insert('"') + ) + + alpha_optional_dash_cardinal = ( + pynutil.insert('units: "') + + pynini.closure(RU_ALPHA, 1) + + pynini.closure(pynini.cross("-", ""), 0, 1) + + pynutil.insert('"') + + pynutil.insert(' cardinal { integer: "') + + cardinal_graph_nominative + + pynutil.insert('" } preserve_order: true') + ) + + decimal_dash_alpha = ( + decimal.final_graph + + pynini.cross("-", "") + + pynutil.insert(' units: "') + + pynini.closure(RU_ALPHA, 1) + + pynutil.insert('"') + ) + + alpha_dash_decimal = ( + pynutil.insert('units: "') + + pynini.closure(RU_ALPHA, 1) + + pynini.cross("-", "") + + pynutil.insert('" ') + + decimal.final_graph + + pynutil.insert(" preserve_order: true") + ) + + self.tagger_graph_default = (subgraph_decimal | cardinal_space).optimize() + + tagger_graph = ( + self.tagger_graph_default + | cardinal_optional_dash_alpha + | alpha_optional_dash_cardinal + | decimal_dash_alpha + | alpha_dash_decimal + ).optimize() + + # verbalizer + unit = ( + pynutil.delete('units: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + delete_space + ) + + optional_sign = pynini.closure(pynini.cross('negative: "true" ', "минус "), 0, 1) + integer = pynutil.delete(' "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + integer_part = pynutil.delete("integer_part:") + integer + fractional_part = pynutil.delete("fractional_part:") + integer + optional_quantity_part = pynini.closure( + pynini.accep(" ") + + pynutil.delete('quantity: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"'), + 0, + 1, + ) + graph_decimal = ( + optional_sign + + integer_part + + pynini.accep(" ") + + fractional_part + + optional_quantity_part + ) + + graph_decimal = ( + pynutil.delete("decimal {") + + delete_space + + graph_decimal + + delete_space + + pynutil.delete("}") + ) + + graph_cardinal = ( + pynutil.delete("cardinal {") + + delete_space + + optional_sign + + pynutil.delete('integer: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + + delete_space + + pynutil.delete("}") + ) + + verbalizer_graph = (graph_cardinal | graph_decimal) + delete_space + insert_space + unit + + # SH adds "preserve_order: true" by default + preserve_order = ( + pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space + ) + verbalizer_graph |= ( + unit + + insert_space + + (graph_cardinal | graph_decimal) + + delete_space + + pynini.closure(preserve_order, 0, 1) + ) + self.verbalizer_graph = verbalizer_graph.optimize() + + final_graph = (tagger_graph @ verbalizer_graph).optimize() + self.fst = self.add_tokens( + pynutil.insert('cardinal { integer: "') + final_graph + pynutil.insert('" }') + ).optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/money.py b/fun_text_processing/text_normalization/ru/taggers/money.py new file mode 100644 index 0000000..2003d45 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/money.py @@ -0,0 +1,97 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + DAMO_SIGMA, + DAMO_SPACE, + GraphFst, +) +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for classifying money, e.g. + "5руб." -> money { "пять рублей" } + + Args: + cardinal: CardinalFst + decimal: DecimalFst + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, cardinal: GraphFst, decimal: GraphFst, deterministic: bool = True): + super().__init__(name="money", kind="classify", deterministic=deterministic) + cardinal_graph = cardinal.cardinal_numbers_default + decimal_graph = decimal.final_graph + + unit_singular = pynini.string_file(get_abs_path("data/currency/currency_singular.tsv")) + unit_plural = pynini.string_file(get_abs_path("data/currency/currency_plural.tsv")) + + # adding weight to make sure the space is preserved for ITN + optional_delimiter = pynini.closure( + pynutil.add_weight(pynini.cross(DAMO_SPACE, ""), -100), 0, 1 + ) + graph_unit_singular = ( + optional_delimiter + + pynutil.insert(' currency: "') + + unit_singular + + pynutil.insert('"') + ) + graph_unit_plural = ( + optional_delimiter + pynutil.insert(' currency: "') + unit_plural + pynutil.insert('"') + ) + + one = pynini.compose(pynini.accep("1"), cardinal_graph).optimize() + singular_graph = ( + pynutil.insert('integer_part: "') + one + pynutil.insert('"') + graph_unit_singular + ) + + graph_decimal = decimal_graph + graph_unit_plural + + graph_integer = ( + pynutil.insert('integer_part: "') + + ((DAMO_SIGMA - "1") @ cardinal_graph) + + pynutil.insert('"') + + (graph_unit_plural) + ) + + graph_integer |= singular_graph + tagger_graph = (graph_integer.optimize() | graph_decimal.optimize()).optimize() + + # verbalizer + integer = pynutil.delete('"') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + integer_part = pynutil.delete("integer_part: ") + integer + + unit = ( + pynutil.delete("currency: ") + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + unit = pynini.accep(DAMO_SPACE) + unit + + verbalizer_graph_cardinal = (integer_part + unit).optimize() + + fractional_part = pynutil.delete("fractional_part: ") + integer + optional_quantity = pynini.closure( + pynini.accep(DAMO_SPACE) + pynutil.delete("quantity: ") + integer, 0, 1 + ) + + verbalizer_graph_decimal = ( + pynutil.delete("decimal { ") + + integer_part + + pynini.accep(" ") + + fractional_part + + optional_quantity + + pynutil.delete(" }") + + unit + ) + + verbalizer_graph = (verbalizer_graph_cardinal | verbalizer_graph_decimal).optimize() + + self.final_graph = (tagger_graph @ verbalizer_graph).optimize() + self.fst = self.add_tokens( + pynutil.insert('integer_part: "') + self.final_graph + pynutil.insert('"') + ).optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/number_names.py b/fun_text_processing/text_normalization/ru/taggers/number_names.py new file mode 100644 index 0000000..f033e89 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/number_names.py @@ -0,0 +1,138 @@ +# Copyright 2017 Google Inc. + + +# Adapted from https://github.com/google/TextNormalizationCoveringGrammars +# Russian minimally supervised number grammar. +# +# Supports cardinals and ordinals in all inflected forms. +# +# The language-specific acceptor G was compiled with digit, teen, decade, +# century, and big power-of-ten preterminals. The lexicon transducer is +# highly ambiguous, but no LM is used. + +# Intersects the universal factorization transducer (F) with language-specific +# acceptor (G). + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA +from fun_text_processing.text_normalization.ru.utils import get_abs_path, load_labels +from pynini.lib import pynutil, rewrite + + +def get_number_names(): + """ + Creates numbers names. + + Based on: 1) Gorman, K., and Sproat, R. 2016. Minimally supervised number normalization. + Transactions of the Association for Computational Linguistics 4: 507-519. + and 2) Ng, A. H., Gorman, K., and Sproat, R. 2017. + Minimally supervised written-to-spoken text normalization. In ASRU, pages 665-670. + """ + a = pynini.Far(get_abs_path("data/utils/util_arithmetic.far"), mode="r") + d = a["DELTA_STAR"] + f = a["IARITHMETIC_RESTRICTED"] + g = pynini.Fst.read(get_abs_path("data/utils/g.fst")) + fg = (d @ (f @ (f @ (f @ g).optimize()).optimize()).optimize()).optimize() + assert rewrite.top_rewrite("230", fg) == "(+ 200 30 +)" + + # Compiles lexicon transducers (L). + cardinal_name_nominative = pynini.string_file( + get_abs_path("data/numbers/1_cardinals_nominative.tsv") + ).optimize() + cardinal_name_genitive = pynini.string_file( + get_abs_path("data/numbers/2_cardinals_genitive.tsv") + ).optimize() + cardinal_name_dative = pynini.string_file( + get_abs_path("data/numbers/3_cardinals_dative.tsv") + ).optimize() + cardinal_name_accusative = pynini.string_file( + get_abs_path("data/numbers/4_cardinals_accusative.tsv") + ).optimize() + cardinal_name_instrumental = pynini.string_file( + get_abs_path("data/numbers/5_cardinals_instrumental.tsv") + ).optimize() + cardinal_name_prepositional = pynini.string_file( + get_abs_path("data/numbers/6_cardinals_prepositional.tsv") + ).optimize() + + cardinal_name_nominative = ( + pynini.closure(cardinal_name_nominative + pynini.accep(" ")) + cardinal_name_nominative + ).optimize() + cardinal_l = pynutil.add_weight(cardinal_name_nominative, -0.1) + for case in [ + pynutil.add_weight(cardinal_name_genitive, 0.1).optimize(), + pynutil.add_weight(cardinal_name_dative, 0.1).optimize(), + pynutil.add_weight(cardinal_name_accusative, 0.1).optimize(), + pynutil.add_weight(cardinal_name_instrumental, 0.1).optimize(), + pynutil.add_weight(cardinal_name_prepositional, 0.1).optimize(), + ]: + cardinal_l |= (pynini.closure(case + pynini.accep(" ")) + case).optimize() + + # Numbers in nominative case (to use, for example, with telephone or serial_graph (in cardinals)) + cardinal_names_nominative_l = ( + pynini.closure(cardinal_name_nominative + pynini.accep(" ")) + cardinal_name_nominative + ).optimize() + + # Convert e.g. "(* 5 1000 *)" back to "5000" so complex ordinals will be formed correctly, + # e.g. "пятитысячный" will eventually be formed. (If we didn't do this, the incorrect phrase + # "пять тысячный" would be formed). + # We do this for all thousands from "(*2 1000 *)" —> "2000" to "(*20 1000 *)" —> "20000". + # We do not go higher, in order to prevent the WFST graph becoming even larger. + complex_numbers = pynini.cross("(* 2 1000 *)", "2000") + for number in range(3, 21): + complex_numbers |= pynini.cross(f"(* {number} 1000 *)", f"{number}000") + + complex_numbers = ( + DAMO_SIGMA + + pynutil.add_weight(complex_numbers, -1) + + pynini.closure(pynini.union(" ", ")", "(", "+", "*")) + ).optimize() + fg_ordinal = pynutil.add_weight(pynini.compose(fg, complex_numbers), -1) | fg + ordinal_name = pynini.string_file(get_abs_path("data/numbers/ordinals.tsv")) + ordinal_l = ( + pynini.closure(cardinal_name_nominative + pynini.accep(" ")) + ordinal_name + ).optimize() + + # Composes L with the leaf transducer (P), then composes that with FG. + p = a["LEAVES"] + number_names = {} + number_names["ordinal_number_names"] = (fg_ordinal @ (p @ ordinal_l)).optimize() + number_names["cardinal_number_names"] = (fg @ (p @ cardinal_l)).optimize() + number_names["cardinal_names_nominative"] = (fg @ (p @ cardinal_names_nominative_l)).optimize() + return number_names + + +def get_alternative_formats(): + """ + Utils to get alternative formats for numbers. + """ + one_alternatives = load_labels(get_abs_path("data/numbers/cardinals_alternatives.tsv")) + one_thousand_map = [] + for k in one_alternatives: + default, alternative = k + one_thousand_map.append((alternative.split()[1], alternative)) + one_thousand_map = pynini.string_map(one_thousand_map) + + one_thousand_alternative = pynini.cdrewrite(one_thousand_map, "[BOS]", "", DAMO_SIGMA) + + # Adapted from + # https://github.com/google/TextNormalizationCoveringGrammars/blob/master/src/universal/thousands_punct.grm + # Specifies common ways of delimiting thousands in digit strings. + t = pynini.Far(get_abs_path("data/utils/universal_thousands_punct.far")) + separators = ( + pynutil.add_weight(t["dot_thousands"], 0.1) + | pynutil.add_weight(t["no_delimiter"], -0.1) + | pynutil.add_weight(t["space_thousands"], 0.1) + ) + alternative_formats = {} + alternative_formats["one_thousand_alternative"] = one_thousand_alternative.optimize() + alternative_formats["separators"] = separators.optimize() + return alternative_formats + + +if __name__ == "__main__": + from fun_text_processing.text_normalization.en.graph_utils import generator_main + + numbers = get_number_names() + for k, v in numbers.items(): + generator_main(f"{k}.far", {k: v}) diff --git a/fun_text_processing/text_normalization/ru/taggers/ordinal.py b/fun_text_processing/text_normalization/ru/taggers/ordinal.py new file mode 100644 index 0000000..2e0b393 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/ordinal.py @@ -0,0 +1,52 @@ +# Adapted from https://github.com/google/TextNormalizationCoveringGrammars +# Russian minimally supervised number grammar. + + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_SIGMA, GraphFst +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for classifying cardinals, e.g. + "2" -> ordinal { integer: "второе" } } + + Args: + number_names: number_names for cardinal and ordinal numbers + alternative_formats: alternative format for cardinal and ordinal numbers + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, number_names: dict, alternative_formats: dict, deterministic=False): + super().__init__(name="ordinal", kind="classify", deterministic=deterministic) + + one_thousand_alternative = alternative_formats["one_thousand_alternative"] + separators = alternative_formats["separators"] + + ordinal = number_names["ordinal_number_names"] + + ordinal |= ordinal @ one_thousand_alternative + ordinal_numbers = separators @ ordinal + + # to handle cases like 2-ая + endings = pynini.string_file(get_abs_path("data/numbers/ordinal_endings.tsv")) + not_dash = pynini.closure(pynini.difference(DAMO_SIGMA, "-")) + del_ending = pynini.cdrewrite(pynini.cross("-" + not_dash, ""), "", "[EOS]", DAMO_SIGMA) + ordinal_numbers_marked = ( + ((separators @ ordinal).optimize() + pynini.accep("-") + not_dash).optimize() + @ (DAMO_SIGMA + endings).optimize() + @ del_ending + ).optimize() + + self.ordinal_numbers = ordinal_numbers + # "03" -> remove leading zeros and verbalize + leading_zeros = pynini.closure(pynini.cross("0", "")) + self.ordinal_numbers_with_leading_zeros = (leading_zeros + ordinal_numbers).optimize() + + final_graph = (ordinal_numbers | ordinal_numbers_marked).optimize() + final_graph = pynutil.insert('integer: "') + final_graph + pynutil.insert('"') + final_graph = self.add_tokens(final_graph) + self.fst = final_graph.optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/telephone.py b/fun_text_processing/text_normalization/ru/taggers/telephone.py new file mode 100644 index 0000000..6a1563e --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/telephone.py @@ -0,0 +1,71 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_DIGIT, + GraphFst, + delete_space, + insert_space, +) +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA_OR_SPACE +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for classifying telephone, which includes country code, number part and extension + + E.g + "8-913-983-56-01" -> telephone { number_part: "восемь девятьсот тринадцать девятьсот восемьдесят три пятьдесят шесть ноль один" } + + Args: + number_names: number_names for cardinal and ordinal numbers + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, number_names: dict, deterministic: bool = True): + super().__init__(name="telephone", kind="classify", deterministic=deterministic) + + separator = pynini.cross("-", " ") # between components + number = number_names["cardinal_names_nominative"] + + country_code = ( + pynutil.insert('country_code: "') + + pynini.closure(pynutil.add_weight(pynutil.delete("+"), 0.1), 0, 1) + + number + + separator + + pynutil.insert('"') + ) + optional_country_code = pynini.closure(country_code + insert_space, 0, 1) + + number_part = ( + DAMO_DIGIT**3 @ number + + separator + + DAMO_DIGIT**3 @ number + + separator + + DAMO_DIGIT**2 @ number + + separator + + DAMO_DIGIT**2 @ (pynini.closure(pynini.cross("0", "ноль ")) + number) + ) + number_part = pynutil.insert('number_part: "') + number_part + pynutil.insert('"') + tagger_graph = (optional_country_code + number_part).optimize() + + # verbalizer + verbalizer_graph = pynini.closure( + pynutil.delete('country_code: "') + + pynini.closure(RU_ALPHA_OR_SPACE, 1) + + pynutil.delete('"') + + delete_space, + 0, + 1, + ) + verbalizer_graph += ( + pynutil.delete('number_part: "') + + pynini.closure(RU_ALPHA_OR_SPACE, 1) + + pynutil.delete('"') + ) + verbalizer_graph = verbalizer_graph.optimize() + + self.final_graph = (tagger_graph @ verbalizer_graph).optimize() + self.fst = self.add_tokens( + pynutil.insert('number_part: "') + self.final_graph + pynutil.insert('"') + ).optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/time.py b/fun_text_processing/text_normalization/ru/taggers/time.py new file mode 100644 index 0000000..2d5de5a --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/time.py @@ -0,0 +1,115 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.ru.utils import get_abs_path +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for classifying time, e.g. + "02:15" -> time { hours: "два часа пятнадцать минут" } + + Args: + number_names: number_names for cardinal and ordinal numbers + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, number_names: dict, deterministic: bool = True): + super().__init__(name="time", kind="classify", deterministic=deterministic) + + increment_hour_ordinal = pynini.string_file( + get_abs_path("data/time/increment_hour_ordinal.tsv") + ) + increment_hour_cardinal = pynini.string_file( + get_abs_path("data/time/increment_hour_cardinal.tsv") + ) + convert_hour = pynini.string_file(get_abs_path("data/time/time_convert.tsv")) + + number = ( + pynini.closure(pynini.cross("0", ""), 0, 1) + number_names["cardinal_names_nominative"] + ) + hour_options = pynini.project(increment_hour_ordinal, "input") + hour_options = hour_options | pynini.project(convert_hour, "output") + + hour_exeption_ends_with_one = pynini.union(*["01", "21"]) + hour_exeption_ends_rest = pynini.union(*["02", "03", "04", "22", "23"]) + hour_other = ( + pynini.difference( + hour_options, pynini.union(hour_exeption_ends_with_one, hour_exeption_ends_rest) + ) + ).optimize() + + hour = hour_exeption_ends_with_one @ number + pynutil.insert(" час") + hour |= hour_exeption_ends_rest @ number + pynutil.insert(" часа") + hour |= hour_other @ number + pynutil.insert(" часов") + + optional_and = pynini.closure(pynutil.insert("и "), 0, 1) + digits = pynini.union(*[str(x) for x in range(10)]) + mins_start = pynini.union(*"012345") + mins_options = mins_start + digits + mins_exception_ends_with_one = mins_start + pynini.accep("1") + mins_exception_ends_rest = pynini.difference( + mins_start + pynini.union(*"234"), pynini.union(*["12", "13", "14"]) + ) + mins_other = pynini.difference( + mins_options, pynini.union(mins_exception_ends_with_one, mins_exception_ends_rest) + ) + + minutes = mins_exception_ends_with_one @ number + pynutil.insert(" минута") + minutes |= mins_exception_ends_rest @ number + pynutil.insert(" минуты") + minutes |= mins_other @ number + pynutil.insert(" минут") + self.minutes = minutes.optimize() + # 17:15 -> "семнадцать часов и пятнадцать минут" + hm = ( + pynutil.insert('hours: "') + + hour.optimize() + + pynutil.insert('"') + + ( + pynini.cross(":", " ") + + pynutil.insert('minutes: "') + + optional_and + + minutes.optimize() + ) + + pynutil.insert('"') + + pynutil.insert(" preserve_order: true") + ) + h = pynutil.insert('hours: "') + hour + pynutil.insert('"') + pynutil.delete(":00") + self.graph_preserve_order = (hm | h).optimize() + + # 17:15 -> "пятнадцать минут шестого" + # Requires permutations for the correct verbalization + self.increment_hour_ordinal = pynini.compose( + hour_options, increment_hour_ordinal + ).optimize() + m_next_h = ( + pynutil.insert('hours: "') + + self.increment_hour_ordinal + + pynutil.insert('"') + + pynini.cross(":", " ") + + pynutil.insert('minutes: "') + + minutes + + pynutil.insert('"') + ) + + # 17:45 -> "без пятнадцати минут шесть" + # Requires permutations for the correct verbalization + self.mins_to_h = pynini.string_file( + get_abs_path("data/time/minutes_to_hour.tsv") + ).optimize() + self.increment_hour_cardinal = pynini.compose( + hour_options, increment_hour_cardinal + ).optimize() + m_to_h = ( + pynutil.insert('hours: "') + + self.increment_hour_cardinal + + pynutil.insert('"') + + pynini.cross(":", " ") + + pynutil.insert('minutes: "без ') + + self.mins_to_h + + pynutil.insert('"') + ) + + self.final_graph = m_next_h | self.graph_preserve_order | m_to_h + self.fst = self.add_tokens(self.final_graph) + self.fst = self.fst.optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/tokenize_and_classify.py b/fun_text_processing/text_normalization/ru/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..43d7e66 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/tokenize_and_classify.py @@ -0,0 +1,149 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst +from fun_text_processing.text_normalization.ru.taggers.cardinal import CardinalFst +from fun_text_processing.text_normalization.ru.taggers.date import DateFst +from fun_text_processing.text_normalization.ru.taggers.decimals import DecimalFst +from fun_text_processing.text_normalization.ru.taggers.electronic import ElectronicFst +from fun_text_processing.text_normalization.ru.taggers.measure import MeasureFst +from fun_text_processing.text_normalization.ru.taggers.money import MoneyFst +from fun_text_processing.text_normalization.ru.taggers.number_names import ( + get_alternative_formats, + get_number_names, +) +from fun_text_processing.text_normalization.ru.taggers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.ru.taggers.telephone import TelephoneFst +from fun_text_processing.text_normalization.ru.taggers.time import TimeFst +from fun_text_processing.text_normalization.ru.taggers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.ru.taggers.word import WordFst +from pynini.lib import pynutil + +import logging + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence, that is lower cased. + For deployment, this grammar will be compiled and exported to OpenFst Finite State Archive (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + """ + + def __init__( + self, + input_case: str, + deterministic: bool = False, + cache_dir: str = None, + overwrite_cache: bool = False, + whitelist: str = None, + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + if deterministic: + raise ValueError( + "Ru TN only supports non-deterministic cases and produces multiple normalization options." + ) + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + whitelist_file = os.path.basename(whitelist) if whitelist else "" + far_file = os.path.join( + cache_dir, f"_{input_case}_ru_tn_{deterministic}_deterministic{whitelist_file}.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + logging.info(f"ClassifyFst.fst was restored from {far_file}.") + else: + logging.info(f"Creating ClassifyFst grammars. This might take some time...") + number_names = get_number_names() + alternative_formats = get_alternative_formats() + + self.cardinal = CardinalFst( + number_names=number_names, + alternative_formats=alternative_formats, + deterministic=deterministic, + ) + cardinal_graph = self.cardinal.fst + + self.ordinal = OrdinalFst( + number_names=number_names, + alternative_formats=alternative_formats, + deterministic=deterministic, + ) + ordinal_graph = self.ordinal.fst + + self.decimal = DecimalFst(cardinal=self.cardinal, deterministic=deterministic) + decimal_graph = self.decimal.fst + + self.measure = MeasureFst( + cardinal=self.cardinal, decimal=self.decimal, deterministic=deterministic + ) + measure_graph = self.measure.fst + self.date = DateFst(number_names=number_names, deterministic=deterministic) + date_graph = self.date.fst + word_graph = WordFst(deterministic=deterministic).fst + self.time = TimeFst(number_names=number_names, deterministic=deterministic) + time_graph = self.time.fst + self.telephone = TelephoneFst(number_names=number_names, deterministic=deterministic) + telephone_graph = self.telephone.fst + self.electronic = ElectronicFst(deterministic=deterministic) + electronic_graph = self.electronic.fst + self.money = MoneyFst( + cardinal=self.cardinal, decimal=self.decimal, deterministic=deterministic + ) + money_graph = self.money.fst + self.whitelist = WhiteListFst( + input_case=input_case, deterministic=deterministic, input_file=whitelist + ) + whitelist_graph = self.whitelist.fst + punct_graph = PunctuationFst(deterministic=deterministic).fst + + classify = ( + pynutil.add_weight(whitelist_graph, 1.01) + | pynutil.add_weight(time_graph, 1.1) + | pynutil.add_weight(date_graph, 1.09) + | pynutil.add_weight(decimal_graph, 1.1) + | pynutil.add_weight(measure_graph, 0.9) + | pynutil.add_weight(cardinal_graph, 1.1) + | pynutil.add_weight(ordinal_graph, 1.1) + | pynutil.add_weight(money_graph, 1.1) + | pynutil.add_weight(telephone_graph, 1.1) + | pynutil.add_weight(electronic_graph, 1.1) + | pynutil.add_weight(word_graph, 100) + ) + + punct = ( + pynutil.insert("tokens { ") + + pynutil.add_weight(punct_graph, weight=1.1) + + pynutil.insert(" }") + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" }") + token_plus_punct = ( + pynini.closure(punct + pynutil.insert(" ")) + + token + + pynini.closure(pynutil.insert(" ") + punct) + ) + + graph = token_plus_punct + pynini.closure( + pynutil.add_weight(delete_extra_space, 1.1) + token_plus_punct + ) + graph = delete_space + graph + delete_space + + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"tokenize_and_classify": self.fst}) + logging.info(f"ClassifyFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/ru/taggers/whitelist.py b/fun_text_processing/text_normalization/ru/taggers/whitelist.py new file mode 100644 index 0000000..287fff1 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/whitelist.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_CHAR, GraphFst, convert_space +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA, TO_CYRILLIC +from fun_text_processing.text_normalization.ru.utils import get_abs_path, load_labels +from pynini.lib import pynutil + + +class WhiteListFst(GraphFst): + """ + Finite state transducer for classifying whitelist, e.g. + misses -> tokens { name: "mrs" } + for non-deterministic case: "Dr. Abc" -> + tokens { name: "drive" } tokens { name: "Abc" } + tokens { name: "doctor" } tokens { name: "Abc" } + tokens { name: "Dr." } tokens { name: "Abc" } + This class has highest priority among all classifier grammars. Whitelisted tokens are defined and loaded from "data/whitelist.tsv". + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + input_file: path to a file with whitelist replacements + """ + + def __init__(self, input_case: str, deterministic: bool = True, input_file: str = None): + super().__init__(name="whitelist", kind="classify", deterministic=deterministic) + + def _get_whitelist_graph(input_case, file): + whitelist = load_labels(file) + if input_case == "lower_cased": + whitelist = [[x[0].lower()] + x[1:] for x in whitelist] + else: + whitelist = [[x[0].lower()] + x[1:] for x in whitelist] + graph = pynini.string_map(whitelist) + return graph + + graph = _get_whitelist_graph(input_case, get_abs_path("data/whitelist.tsv")) + + if input_file: + graph = _get_whitelist_graph(input_case, input_file) + + units_graph = _get_whitelist_graph(input_case, file=get_abs_path("data/measurements.tsv")) + # do not replace single letter units, like `м`, `°` and `%` will be replaced + units_graph = pynini.compose( + (DAMO_CHAR ** (2, ...) | pynini.difference(DAMO_CHAR, RU_ALPHA)), units_graph + ) + graph |= units_graph.optimize() + graph |= TO_CYRILLIC + pynini.closure(pynutil.insert(" ") + TO_CYRILLIC) + + self.final_graph = convert_space(graph) + self.fst = (pynutil.insert('name: "') + self.final_graph + pynutil.insert('"')).optimize() diff --git a/fun_text_processing/text_normalization/ru/taggers/word.py b/fun_text_processing/text_normalization/ru/taggers/word.py new file mode 100644 index 0000000..318ba5d --- /dev/null +++ b/fun_text_processing/text_normalization/ru/taggers/word.py @@ -0,0 +1,19 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_SPACE, GraphFst +from pynini.lib import pynutil + + +class WordFst(GraphFst): + """ + Finite state transducer for classifying word. + e.g. sleep -> tokens { name: "sleep" } + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="word", kind="classify") + word = pynutil.insert('name: "') + pynini.closure(DAMO_NOT_SPACE, 1) + pynutil.insert('"') + self.fst = word.optimize() diff --git a/fun_text_processing/text_normalization/ru/utils.py b/fun_text_processing/text_normalization/ru/utils.py new file mode 100644 index 0000000..1a1f30f --- /dev/null +++ b/fun_text_processing/text_normalization/ru/utils.py @@ -0,0 +1,34 @@ +import csv +import os + +import logging + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + abs_path = os.path.dirname(os.path.abspath(__file__)) + os.sep + rel_path + + if not os.path.exists(abs_path): + logging.warning(f"{abs_path} does not exist") + return abs_path + + +def load_labels(abs_path): + """ + loads relative path file as dictionary + + Args: + abs_path: absolute path + + Returns dictionary of mappings + """ + label_tsv = open(abs_path, encoding="utf-8") + labels = list(csv.reader(label_tsv, delimiter="\t")) + return labels diff --git a/fun_text_processing/text_normalization/ru/verbalizers/__init__.py b/fun_text_processing/text_normalization/ru/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/ru/verbalizers/cardinal.py b/fun_text_processing/text_normalization/ru/verbalizers/cardinal.py new file mode 100644 index 0000000..2693477 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/cardinal.py @@ -0,0 +1,32 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class CardinalFst(GraphFst): + """ + Finite state transducer for verbalizing cardinals + e.g. cardinal { integer: "тысяча один" } -> "тысяча один" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) + optional_sign = pynini.closure(pynini.cross('negative: "true" ', "минус "), 0, 1) + optional_quantity_part = pynini.closure( + pynini.accep(" ") + + pynutil.delete('quantity: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"'), + 0, + 1, + ) + integer = ( + pynutil.delete('integer: "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + ) + self.graph = optional_sign + integer + optional_quantity_part + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/date.py b/fun_text_processing/text_normalization/ru/verbalizers/date.py new file mode 100644 index 0000000..b03eca4 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/date.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA +from pynini.lib import pynutil + + +class DateFst(GraphFst): + """ + Finite state transducer for verbalizing date, e.g. + tokens { date { day: "первое мая" } } -> "первое мая" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="date", kind="verbalize", deterministic=deterministic) + + graph = pynutil.delete('day: "') + pynini.closure(RU_ALPHA | " ", 1) + pynutil.delete('"') + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/decimal.py b/fun_text_processing/text_normalization/ru/verbalizers/decimal.py new file mode 100644 index 0000000..ee1f2b4 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/decimal.py @@ -0,0 +1,46 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class DecimalFst(GraphFst): + """ + Finite state transducer for verbalizing decimal, e.g. + tokens { decimal { integer_part: "одно целая" fractional_part: "восемь сотых} } -> + "одно целая восемь сотых" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="decimal", kind="verbalize", deterministic=deterministic) + + optional_sign = pynini.closure(pynini.cross('negative: "true" ', "минус "), 0, 1) + integer = pynutil.delete(' "') + pynini.closure(DAMO_NOT_QUOTE, 1) + pynutil.delete('"') + integer_part = pynutil.delete("integer_part:") + integer + fractional_part = pynutil.delete("fractional_part:") + integer + optional_quantity_part = pynini.closure( + pynini.accep(" ") + + pynutil.delete('quantity: "') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"'), + 0, + 1, + ) + + self.graph = ( + optional_sign + + integer_part + + pynini.accep(" ") + + fractional_part + + optional_quantity_part + + delete_space + ) + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/electronic.py b/fun_text_processing/text_normalization/ru/verbalizers/electronic.py new file mode 100644 index 0000000..5d42648 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/electronic.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA +from pynini.lib import pynutil + + +class ElectronicFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. electronic { username: "эй би собака эн ди точка ру" } -> "эй би собака эн ди точка ру" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="electronic", kind="verbalize", deterministic=deterministic) + + graph = pynutil.delete('username: "') + pynini.closure(RU_ALPHA | " ") + pynutil.delete('"') + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/measure.py b/fun_text_processing/text_normalization/ru/verbalizers/measure.py new file mode 100644 index 0000000..d3eb1ce --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/measure.py @@ -0,0 +1,34 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NON_BREAKING_SPACE, + DAMO_SPACE, + GraphFst, + delete_space, +) +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA +from pynini.lib import pynutil + + +class MeasureFst(GraphFst): + """ + Finite state transducer for verbalizing measure, e.g. + measure { cardinal { integer: "два килограма" } } -> "два килограма" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="measure", kind="verbalize", deterministic=deterministic) + + graph = ( + pynutil.delete(' cardinal { integer: "') + + pynini.closure(RU_ALPHA | DAMO_SPACE | DAMO_NON_BREAKING_SPACE) + + pynutil.delete('"') + + delete_space + + pynutil.delete("}") + ) + + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/money.py b/fun_text_processing/text_normalization/ru/verbalizers/money.py new file mode 100644 index 0000000..a6c2574 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/money.py @@ -0,0 +1,24 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA +from pynini.lib import pynutil + + +class MoneyFst(GraphFst): + """ + Finite state transducer for verbalizing money, e.g. + money { "пять рублей" } -> пять рублей + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="money", kind="verbalize", deterministic=deterministic) + + graph = pynini.closure(RU_ALPHA | " ") + delete_tokens = self.delete_tokens( + pynutil.delete('integer_part: "') + graph + pynutil.delete('"') + ) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/ordinal.py b/fun_text_processing/text_normalization/ru/verbalizers/ordinal.py new file mode 100644 index 0000000..564d361 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/ordinal.py @@ -0,0 +1,22 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class OrdinalFst(GraphFst): + """ + Finite state transducer for verbalizing roman numerals + e.g. ordinal { integer: "второе" } } -> "второе" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="ordinal", kind="verbalize", deterministic=deterministic) + + value = pynini.closure(DAMO_NOT_QUOTE) + graph = pynutil.delete('integer: "') + value + pynutil.delete('"') + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/telephone.py b/fun_text_processing/text_normalization/ru/verbalizers/telephone.py new file mode 100644 index 0000000..044e3e9 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/telephone.py @@ -0,0 +1,26 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.ru.alphabet import RU_ALPHA +from pynini.lib import pynutil + + +class TelephoneFst(GraphFst): + """ + Finite state transducer for verbalizing telephone, e.g. + telephone { number_part: "восемь девятьсот тринадцать девятьсот восемьдесят три пятьдесят шесть ноль один" } -> "восемь девятьсот тринадцать девятьсот восемьдесят три пятьдесят шесть ноль один" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="telephone", kind="verbalize", deterministic=deterministic) + + graph = ( + pynutil.delete('number_part: "') + + pynini.closure(RU_ALPHA | " ", 1) + + pynutil.delete('"') + ) + delete_tokens = self.delete_tokens(graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/time.py b/fun_text_processing/text_normalization/ru/verbalizers/time.py new file mode 100644 index 0000000..cdabfac --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/time.py @@ -0,0 +1,51 @@ +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + DAMO_NOT_QUOTE, + GraphFst, + delete_space, + insert_space, +) +from pynini.lib import pynutil + + +class TimeFst(GraphFst): + """ + Finite state transducer for verbalizing electronic + e.g. time { hours: "два часа пятнадцать минут" } -> "два часа пятнадцать минут" + + Args: + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="time", kind="verbalize", deterministic=deterministic) + + hour = ( + pynutil.delete("hours:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + minutes = ( + pynutil.delete("minutes:") + + delete_space + + pynutil.delete('"') + + pynini.closure(DAMO_NOT_QUOTE, 1) + + pynutil.delete('"') + ) + + self.graph = ( + hour + + delete_space + + insert_space + + minutes + + delete_space + + pynutil.delete("preserve_order: true") + ) + self.graph |= hour + delete_space + self.graph |= minutes + delete_space + insert_space + hour + delete_space + + delete_tokens = self.delete_tokens(self.graph) + self.fst = delete_tokens.optimize() diff --git a/fun_text_processing/text_normalization/ru/verbalizers/verbalize.py b/fun_text_processing/text_normalization/ru/verbalizers/verbalize.py new file mode 100644 index 0000000..465ff0a --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/verbalize.py @@ -0,0 +1,55 @@ +from fun_text_processing.text_normalization.en.graph_utils import GraphFst +from fun_text_processing.text_normalization.en.verbalizers.whitelist import WhiteListFst +from fun_text_processing.text_normalization.ru.verbalizers.cardinal import CardinalFst +from fun_text_processing.text_normalization.ru.verbalizers.date import DateFst +from fun_text_processing.text_normalization.ru.verbalizers.decimal import DecimalFst +from fun_text_processing.text_normalization.ru.verbalizers.electronic import ElectronicFst +from fun_text_processing.text_normalization.ru.verbalizers.measure import MeasureFst +from fun_text_processing.text_normalization.ru.verbalizers.money import MoneyFst +from fun_text_processing.text_normalization.ru.verbalizers.ordinal import OrdinalFst +from fun_text_processing.text_normalization.ru.verbalizers.telephone import TelephoneFst +from fun_text_processing.text_normalization.ru.verbalizers.time import TimeFst + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="verbalize", kind="verbalize", deterministic=deterministic) + cardinal = CardinalFst() + cardinal_graph = cardinal.fst + ordinal_graph = OrdinalFst().fst + decimal = DecimalFst() + decimal_graph = decimal.fst + date = DateFst() + date_graph = date.fst + measure = MeasureFst() + measure_graph = measure.fst + electronic = ElectronicFst() + electronic_graph = electronic.fst + whitelist_graph = WhiteListFst().fst + money_graph = MoneyFst().fst + telephone_graph = TelephoneFst().fst + time_graph = TimeFst().fst + + graph = ( + measure_graph + | cardinal_graph + | decimal_graph + | ordinal_graph + | date_graph + | electronic_graph + | money_graph + | whitelist_graph + | telephone_graph + | time_graph + ) + self.fst = graph diff --git a/fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py b/fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py new file mode 100644 index 0000000..1e95e86 --- /dev/null +++ b/fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py @@ -0,0 +1,62 @@ +import os + +import pynini +from fun_text_processing.text_normalization.en.graph_utils import ( + GraphFst, + delete_extra_space, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.en.verbalizers.word import WordFst +from fun_text_processing.text_normalization.ru.verbalizers.verbalize import VerbalizeFst +from pynini.lib import pynutil + +import logging + + +class VerbalizeFinalFst(GraphFst): + """ + Finite state transducer that verbalizes an entire sentence, e.g. + tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now + + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + """ + + def __init__( + self, deterministic: bool = True, cache_dir: str = None, overwrite_cache: bool = False + ): + super().__init__(name="verbalize_final", kind="verbalize", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join( + cache_dir, f"ru_tn_{deterministic}_deterministic_verbalizer.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["verbalize"] + logging.info(f"VerbalizeFinalFst graph was restored from {far_file}.") + else: + + verbalize = VerbalizeFst().fst + word = WordFst().fst + types = verbalize | word + graph = ( + pynutil.delete("tokens") + + delete_space + + pynutil.delete("{") + + delete_space + + types + + delete_space + + pynutil.delete("}") + ) + graph = delete_space + pynini.closure(graph + delete_extra_space) + graph + delete_space + self.fst = graph.optimize() + + if far_file: + generator_main(far_file, {"verbalize": self.fst}) + logging.info(f"VerbalizeFinalFst grammars are saved to {far_file}.") diff --git a/fun_text_processing/text_normalization/run_evaluate.py b/fun_text_processing/text_normalization/run_evaluate.py new file mode 100644 index 0000000..470a961 --- /dev/null +++ b/fun_text_processing/text_normalization/run_evaluate.py @@ -0,0 +1,114 @@ +from argparse import ArgumentParser + +from fun_text_processing.text_normalization.data_loader_utils import ( + evaluate, + known_types, + load_files, + training_data_to_sentences, + training_data_to_tokens, +) +from fun_text_processing.text_normalization.normalize import Normalizer + + +""" +Runs Evaluation on data in the format of : \t\t<`self` if trivial class or normalized text> +like the Google text normalization data https://www.kaggle.com/richardwilliamsproat/text-normalization-for-english-russian-and-polish +""" + + +def parse_args(): + parser = ArgumentParser() + parser.add_argument("--input", help="input file path", type=str) + parser.add_argument("--lang", help="language", choices=["en"], default="en", type=str) + parser.add_argument( + "--input_case", + help="input capitalization", + choices=["lower_cased", "cased"], + default="cased", + type=str, + ) + parser.add_argument( + "--cat", + dest="category", + help="focus on class only (" + ", ".join(known_types) + ")", + type=str, + default=None, + choices=known_types, + ) + parser.add_argument( + "--filter", action="store_true", help="clean data for normalization purposes" + ) + return parser.parse_args() + + +if __name__ == "__main__": + # Example usage: + # python run_evaluate.py --input= --cat= --filter + args = parse_args() + if args.lang == "en": + from fun_text_processing.text_normalization.en.clean_eval_data import filter_loaded_data + file_path = args.input + normalizer = Normalizer(input_case=args.input_case, lang=args.lang) + + print("Loading training data: " + file_path) + training_data = load_files([file_path]) + + if args.filter: + training_data = filter_loaded_data(training_data) + + if args.category is None: + print("Sentence level evaluation...") + sentences_un_normalized, sentences_normalized, _ = training_data_to_sentences(training_data) + print("- Data: " + str(len(sentences_normalized)) + " sentences") + sentences_prediction = normalizer.normalize_list(sentences_un_normalized) + print("- Normalized. Evaluating...") + sentences_accuracy = evaluate( + preds=sentences_prediction, labels=sentences_normalized, input=sentences_un_normalized + ) + print("- Accuracy: " + str(sentences_accuracy)) + + print("Token level evaluation...") + tokens_per_type = training_data_to_tokens(training_data, category=args.category) + token_accuracy = {} + for token_type in tokens_per_type: + print("- Token type: " + token_type) + tokens_un_normalized, tokens_normalized = tokens_per_type[token_type] + print(" - Data: " + str(len(tokens_normalized)) + " tokens") + tokens_prediction = normalizer.normalize_list(tokens_un_normalized) + print(" - Denormalized. Evaluating...") + token_accuracy[token_type] = evaluate( + preds=tokens_prediction, labels=tokens_normalized, input=tokens_un_normalized + ) + print(" - Accuracy: " + str(token_accuracy[token_type])) + token_count_per_type = { + token_type: len(tokens_per_type[token_type][0]) for token_type in tokens_per_type + } + token_weighted_accuracy = [ + token_count_per_type[token_type] * accuracy + for token_type, accuracy in token_accuracy.items() + ] + print("- Accuracy: " + str(sum(token_weighted_accuracy) / sum(token_count_per_type.values()))) + print(" - Total: " + str(sum(token_count_per_type.values())), "\n") + + print(" - Total: " + str(sum(token_count_per_type.values())), "\n") + + for token_type in token_accuracy: + if token_type not in known_types: + raise ValueError("Unexpected token type: " + token_type) + + if args.category is None: + c1 = ["Class", "sent level"] + known_types + c2 = ["Num Tokens", len(sentences_normalized)] + [ + token_count_per_type[known_type] if known_type in tokens_per_type else "0" + for known_type in known_types + ] + c3 = ["Normalization", sentences_accuracy] + [ + token_accuracy[known_type] if known_type in token_accuracy else "0" + for known_type in known_types + ] + + for i in range(len(c1)): + print(f"{str(c1[i]):10s} | {str(c2[i]):10s} | {str(c3[i]):5s}") + else: + print(f"numbers\t{token_count_per_type[args.category]}") + print(f"Normalization\t{token_accuracy[args.category]}") diff --git a/fun_text_processing/text_normalization/token_parser.py b/fun_text_processing/text_normalization/token_parser.py new file mode 100644 index 0000000..cb5dfe1 --- /dev/null +++ b/fun_text_processing/text_normalization/token_parser.py @@ -0,0 +1,179 @@ +import string +from collections import OrderedDict +from typing import Dict, List, Union + +PRESERVE_ORDER_KEY = "preserve_order" +EOS = "" + + +class TokenParser: + """ + Parses tokenized/classified text, e.g. 'tokens { money { integer: "20" currency: "$" } } tokens { name: "left"}' + + Args + text: tokenized text + """ + + def __call__(self, text): + """ + Setup function + + Args: + text: text to be parsed + + """ + self.text = text + self.len_text = len(text) + self.char = text[0] # cannot handle empty string + self.index = 0 + + def parse(self) -> List[dict]: + """ + Main function. Implements grammar: + A -> space F space F space F ... space + + Returns list of dictionaries + """ + l = list() + while self.parse_ws(): + token = self.parse_token() + if not token: + break + l.append(token) + return l + + def parse_token(self) -> Dict[str, Union[str, dict]]: + """ + Implements grammar: + F-> no_space KG no_space + + Returns: K, G as dictionary values + """ + d = OrderedDict() + key = self.parse_string_key() + if key is None: + return None + self.parse_ws() + if key == PRESERVE_ORDER_KEY: + self.parse_char(":") + self.parse_ws() + value = self.parse_chars("true") + else: + value = self.parse_token_value() + + d[key] = value + return d + + def parse_token_value(self) -> Union[str, dict]: + """ + Implements grammar: + G-> no_space :"VALUE" no_space | no_space {A} no_space + + Returns: string or dictionary + """ + if self.char == ":": + self.parse_char(":") + self.parse_ws() + self.parse_char('"') + value_string = self.parse_string_value() + self.parse_char('"') + return value_string + elif self.char == "{": + d = OrderedDict() + self.parse_char("{") + list_token_dicts = self.parse() + # flatten tokens + for tok_dict in list_token_dicts: + for k, v in tok_dict.items(): + d[k] = v + self.parse_char("}") + return d + else: + raise ValueError() + + def parse_char(self, exp) -> bool: + """ + Parses character + + Args: + exp: character to read in + + Returns true if successful + """ + assert self.char == exp + self.read() + return True + + def parse_chars(self, exp) -> bool: + """ + Parses characters + + Args: + exp: characters to read in + + Returns true if successful + """ + ok = False + for x in exp: + ok |= self.parse_char(x) + return ok + + def parse_string_key(self) -> str: + """ + Parses string key, can only contain ascii and '_' characters + + Returns parsed string key + """ + assert self.char not in string.whitespace and self.char != EOS + incl_criterium = string.ascii_letters + "_" + l = [] + while self.char in incl_criterium: + l.append(self.char) + if not self.read(): + raise ValueError() + + if not l: + return None + return "".join(l) + + def parse_string_value(self) -> str: + """ + Parses string value, ends with quote followed by space + + Returns parsed string value + """ + # assert self.char not in string.whitespace and self.char != EOS + assert self.char != EOS + l = [] + while self.char != '"' or self.text[self.index + 1] != " ": + l.append(self.char) + if not self.read(): + raise ValueError() + + if not l: + return None + return "".join(l) + + def parse_ws(self): + """ + Deletes whitespaces. + + Returns true if not EOS after parsing + """ + not_eos = self.char != EOS + while not_eos and self.char == " ": + not_eos = self.read() + return not_eos + + def read(self): + """ + Reads in next char. + + Returns true if not EOS + """ + if self.index < self.len_text - 1: # should be unique + self.index += 1 + self.char = self.text[self.index] + return True + self.char = EOS + return False diff --git a/fun_text_processing/text_normalization/zh/README.md b/fun_text_processing/text_normalization/zh/README.md new file mode 100644 index 0000000..0eedd57 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/README.md @@ -0,0 +1,138 @@ +# Chinese Text Normalization + +## 1. How To Use +``` +python normalize.py --language "zh" --text "text to be normalized" +``` + +## 2. TN Pipeline +There are 3 components in TN pipeline: +* pre-processing (before tagger) +* non-standard word normalization +* post-processing (after verbalizer) + +### 2.1 Pre-Processing +#### Char Width Conversion (全角 -> 半角) +``` +苹果CEO宣布发布新IPHONE -> 苹果CEO宣布发布新IPHONE +他说:“我们已经吃过了!”。 -> 他说:"我们已经吃过了!". +``` +* covers English letters, digits, punctuations and some symbols +* the complete mapping table `data/char/fullwidth_to_halfwidth.tsv` + +#### Denylist (Removal) +Sometime you may want to remove certain things like interjections/fillers "啊", "呃" etc +``` +呃这个呃啊我不知道 -> 这个我不知道 +``` +* customizable via `data/denylist/denylist.tsv` + + +### 2.2 Non-Standard-Words(NSW) normalization +#### Numbers +``` +共465篇,约315万字 -> 共四百六十五篇,约三百一十五万字 +共计6.42万人 -> 共计六点四二万人 +同比升高0.6个百分点 -> 同比升高零点六个百分点 +``` + +#### Fraction +``` +总量的1/5以上 -> 总量的五分之一以上 +相当于头发丝的1/16 -> 相当于头发丝的十六分之一 +3/2是一个假分数 -> 二分之三是一个假分数 +``` + +#### Percentage +``` +同比增长6.3% -> 同比增长百分之六点三 +增幅0.4% -> 增幅百分之零点四 +``` + +#### Date +``` +2002/01/28 -> 二零零二年一月二十八日 +2002-01-28 -> 二零零二年一月二十八日 +2002.01.28 -> 二零零二年一月二十八日 +2002/01 -> 二零零二年一月 +``` + +#### Time +``` +8月16号12:00之前 -> 八月十六号十二点之前 +我是5:02开始的 -> 我是五点零二分开始的 +于5:35:36发射 -> 于五点三十五分三十六秒发射 +8:00am准时开会 -> 上午八点准时开会 +``` + +#### Math +``` +比分定格在78:96 -> 比分定格在七十八比九十六 +计算-2的绝对值是2 -> 计算负二的绝对值是二 +±2的平方都是4 -> 正负二的平方都是四 +``` + +#### Money +``` +价格是¥13.5 -> 价格是十三点五元 +价格是$13.5 -> 价格是十三点五美元 +价格是A$13.5 -> 价格是十三点五澳元 +价格是HKD13.5 -> 价格是十三点五港元 +``` + +#### Measure +``` +重达25kg -> 二十五千克 +最高气温38°C -> 最高气温三十八摄氏度 +实际面积120m² -> 实际面积一百二十平方米 +渲染速度10ms一帧 -> 渲染速度十毫秒一帧 +``` + +#### Number series (phone, mobile numbers) +``` +可以打我手机13501234567 -> 可以打我手机一三五零一二三四五六七 +可以拨打12306来咨询 -> 可以拨打一二三零六来咨询 +``` + +#### Erhua(儿化音) Removal +``` +这儿有只鸟儿 -> 这有只鸟 +这事儿好办 -> 这事好办 +我儿子喜欢这地儿 -> 我儿子喜欢这地 +``` +* erhua whitelist is customizable via `data/erhua/whitelist.tsv` + +#### Whitelist(Replacement) +a set of user-defined hard mapping, i.e. exact-string matching & replacement +``` +C E O -> CEO +G P U -> GPU +O2O -> O to O +B2B -> B to B +``` +* customizable via `data/whitelist/default.tsv` + +### 2.3 Post-Processing +#### Punctuation Removal +If enabled, punctuations are removed. + +#### Uppercase or Lowercase Conversion +If enabled, English letters are converted to uppercases / lowercases + +#### Out-Of-Vocabulary(OOV) Tagger +If enabled, OOV chars are tagged with `` and ``, e.g.: +``` +我们안녕 -> 我们안녕 +雪の花 -> 雪の花 +``` +* default charset (national standard) [通用规范汉字表](https://zh.wikipedia.org/wiki/通用规范汉字表) +* you can extend charset via `data/char/charset_extension.tsv` + +## 3. Credits +Author: Zhenxiang MA @ Tsinghua University + +Advisors: [SpeechColab](https://github.com/SpeechColab) organization + +The authors of this work would like to thank: +* The authors of foundational libraries like OpenFst & Pynini +* NeMo team and NeMo open-source community diff --git a/fun_text_processing/text_normalization/zh/__init__.py b/fun_text_processing/text_normalization/zh/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/__init__.py b/fun_text_processing/text_normalization/zh/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/char/__init__.py b/fun_text_processing/text_normalization/zh/data/char/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/char/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/char/charset_extension.tsv b/fun_text_processing/text_normalization/zh/data/char/charset_extension.tsv new file mode 100644 index 0000000..de3ac0a --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/char/charset_extension.tsv @@ -0,0 +1,6 @@ +吶 +诶 +屌 +囧 +飚 +屄 diff --git a/fun_text_processing/text_normalization/zh/data/char/charset_national_standard_2013_8105.tsv b/fun_text_processing/text_normalization/zh/data/char/charset_national_standard_2013_8105.tsv new file mode 100644 index 0000000..06b46c6 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/char/charset_national_standard_2013_8105.tsv @@ -0,0 +1,8105 @@ +一 +丁 +七 +万 +丈 +三 +上 +下 +不 +与 +丏 +丐 +丑 +专 +且 +丕 +世 +丘 +丙 +业 +丛 +东 +丝 +丞 +丢 +两 +严 +丧 +个 +丫 +中 +丰 +串 +临 +丸 +丹 +为 +主 +丽 +举 +乂 +乃 +久 +么 +义 +之 +乌 +乍 +乎 +乏 +乐 +乒 +乓 +乔 +乖 +乘 +乙 +乜 +九 +乞 +也 +习 +乡 +书 +乩 +买 +乱 +乳 +乸 +乾 +了 +予 +争 +事 +二 +亍 +于 +亏 +云 +互 +亓 +五 +井 +亘 +亚 +些 +亟 +亡 +亢 +交 +亥 +亦 +产 +亨 +亩 +享 +京 +亭 +亮 +亲 +亳 +亵 +亶 +亸 +亹 +人 +亿 +什 +仁 +仂 +仃 +仄 +仅 +仆 +仇 +仉 +今 +介 +仍 +从 +仑 +仓 +仔 +仕 +他 +仗 +付 +仙 +仝 +仞 +仟 +仡 +代 +令 +以 +仨 +仪 +仫 +们 +仰 +仲 +仳 +仵 +件 +价 +任 +份 +仿 +企 +伈 +伉 +伊 +伋 +伍 +伎 +伏 +伐 +休 +众 +优 +伙 +会 +伛 +伞 +伟 +传 +伢 +伣 +伤 +伥 +伦 +伧 +伪 +伫 +伭 +伯 +估 +伲 +伴 +伶 +伸 +伺 +似 +伽 +伾 +佁 +佃 +但 +位 +低 +住 +佐 +佑 +体 +何 +佖 +佗 +佘 +余 +佚 +佛 +作 +佝 +佞 +佟 +你 +佣 +佤 +佥 +佩 +佬 +佯 +佰 +佳 +佴 +佶 +佸 +佺 +佻 +佼 +佽 +佾 +使 +侁 +侂 +侃 +侄 +侈 +侉 +例 +侍 +侏 +侑 +侔 +侗 +侘 +供 +依 +侠 +侣 +侥 +侦 +侧 +侨 +侩 +侪 +侬 +侮 +侯 +侴 +侵 +侹 +便 +促 +俄 +俅 +俊 +俍 +俎 +俏 +俐 +俑 +俗 +俘 +俙 +俚 +俜 +保 +俞 +俟 +信 +俣 +俦 +俨 +俩 +俪 +俫 +俭 +修 +俯 +俱 +俳 +俵 +俶 +俸 +俺 +俾 +倌 +倍 +倏 +倒 +倓 +倔 +倕 +倘 +候 +倚 +倜 +倞 +借 +倡 +倥 +倦 +倧 +倨 +倩 +倪 +倬 +倭 +倮 +倴 +债 +倻 +值 +倾 +偁 +偃 +假 +偈 +偌 +偎 +偏 +偓 +偕 +做 +停 +偡 +健 +偬 +偭 +偰 +偲 +偶 +偷 +偻 +偾 +偿 +傀 +傃 +傅 +傈 +傉 +傍 +傒 +傕 +傣 +傥 +傧 +储 +傩 +催 +傲 +傺 +傻 +僇 +僎 +像 +僔 +僖 +僚 +僦 +僧 +僬 +僭 +僮 +僰 +僳 +僵 +僻 +儆 +儇 +儋 +儒 +儡 +儦 +儳 +儴 +儿 +兀 +允 +元 +兄 +充 +兆 +先 +光 +克 +免 +兑 +兔 +兕 +兖 +党 +兜 +兢 +入 +全 +八 +公 +六 +兮 +兰 +共 +关 +兴 +兵 +其 +具 +典 +兹 +养 +兼 +兽 +冀 +冁 +内 +冈 +冉 +册 +再 +冏 +冒 +冔 +冕 +冗 +写 +军 +农 +冠 +冢 +冤 +冥 +冬 +冮 +冯 +冰 +冱 +冲 +决 +况 +冶 +冷 +冻 +冼 +冽 +净 +凄 +准 +凇 +凉 +凋 +凌 +减 +凑 +凓 +凘 +凛 +凝 +几 +凡 +凤 +凫 +凭 +凯 +凰 +凳 +凶 +凸 +凹 +出 +击 +凼 +函 +凿 +刀 +刁 +刃 +分 +切 +刈 +刊 +刍 +刎 +刑 +划 +刖 +列 +刘 +则 +刚 +创 +初 +删 +判 +刨 +利 +别 +刬 +刭 +刮 +到 +刳 +制 +刷 +券 +刹 +刺 +刻 +刽 +刿 +剀 +剁 +剂 +剃 +剅 +削 +剋 +剌 +前 +剐 +剑 +剔 +剕 +剖 +剜 +剞 +剟 +剡 +剥 +剧 +剩 +剪 +副 +割 +剽 +剿 +劁 +劂 +劄 +劈 +劐 +劓 +力 +劝 +办 +功 +加 +务 +劢 +劣 +动 +助 +努 +劫 +劬 +劭 +励 +劲 +劳 +劼 +劾 +势 +勃 +勇 +勉 +勋 +勍 +勐 +勒 +勔 +勖 +勘 +勚 +募 +勠 +勤 +勰 +勺 +勾 +勿 +匀 +包 +匆 +匈 +匍 +匏 +匐 +匕 +化 +北 +匙 +匜 +匝 +匠 +匡 +匣 +匦 +匪 +匮 +匹 +区 +医 +匼 +匾 +匿 +十 +千 +卅 +升 +午 +卉 +半 +华 +协 +卑 +卒 +卓 +单 +卖 +南 +博 +卜 +卞 +卟 +占 +卡 +卢 +卣 +卤 +卦 +卧 +卫 +卬 +卮 +卯 +印 +危 +即 +却 +卵 +卷 +卸 +卺 +卿 +厂 +厄 +厅 +历 +厉 +压 +厌 +厍 +厕 +厖 +厘 +厚 +厝 +原 +厢 +厣 +厥 +厦 +厨 +厩 +厮 +去 +厾 +县 +叁 +参 +叆 +叇 +又 +叉 +及 +友 +双 +反 +发 +叔 +叕 +取 +受 +变 +叙 +叚 +叛 +叟 +叠 +口 +古 +句 +另 +叨 +叩 +只 +叫 +召 +叭 +叮 +可 +台 +叱 +史 +右 +叵 +叶 +号 +司 +叹 +叻 +叼 +叽 +吁 +吃 +各 +吆 +合 +吉 +吊 +同 +名 +后 +吏 +吐 +向 +吒 +吓 +吕 +吖 +吗 +君 +吝 +吞 +吟 +吠 +吡 +吣 +否 +吧 +吨 +吩 +含 +听 +吭 +吮 +启 +吱 +吲 +吴 +吵 +吸 +吹 +吻 +吼 +吽 +吾 +呀 +呃 +呆 +呇 +呈 +告 +呋 +呐 +呒 +呓 +呔 +呕 +呖 +呗 +员 +呙 +呛 +呜 +呢 +呣 +呤 +呦 +周 +呱 +呲 +味 +呵 +呶 +呷 +呸 +呻 +呼 +命 +咀 +咂 +咄 +咆 +咇 +咉 +咋 +和 +咍 +咎 +咏 +咐 +咒 +咔 +咕 +咖 +咙 +咚 +咛 +咝 +咡 +咣 +咤 +咥 +咦 +咧 +咨 +咩 +咪 +咫 +咬 +咯 +咱 +咳 +咴 +咸 +咺 +咻 +咽 +咿 +哀 +品 +哂 +哃 +哄 +哆 +哇 +哈 +哉 +哌 +响 +哎 +哏 +哐 +哑 +哒 +哓 +哔 +哕 +哗 +哙 +哚 +哝 +哞 +哟 +哢 +哥 +哦 +哧 +哨 +哩 +哪 +哭 +哮 +哱 +哲 +哳 +哺 +哼 +哽 +哿 +唁 +唆 +唇 +唉 +唏 +唐 +唑 +唔 +唛 +唝 +唠 +唢 +唣 +唤 +唧 +唪 +唬 +售 +唯 +唰 +唱 +唳 +唵 +唷 +唼 +唾 +唿 +啁 +啃 +啄 +商 +啉 +啊 +啐 +啕 +啖 +啜 +啡 +啤 +啥 +啦 +啧 +啪 +啫 +啬 +啭 +啮 +啰 +啴 +啵 +啶 +啷 +啸 +啻 +啼 +啾 +喀 +喁 +喂 +喃 +善 +喆 +喇 +喈 +喉 +喊 +喋 +喏 +喑 +喔 +喘 +喙 +喜 +喝 +喟 +喤 +喧 +喱 +喳 +喵 +喷 +喹 +喻 +喽 +喾 +嗄 +嗅 +嗉 +嗌 +嗍 +嗐 +嗑 +嗒 +嗓 +嗔 +嗖 +嗜 +嗝 +嗞 +嗟 +嗡 +嗣 +嗤 +嗥 +嗦 +嗨 +嗪 +嗫 +嗬 +嗯 +嗲 +嗳 +嗵 +嗷 +嗽 +嗾 +嘀 +嘁 +嘈 +嘉 +嘌 +嘎 +嘏 +嘘 +嘚 +嘛 +嘞 +嘟 +嘡 +嘣 +嘤 +嘧 +嘬 +嘭 +嘱 +嘲 +嘴 +嘶 +嘹 +嘻 +嘿 +噀 +噂 +噇 +噌 +噍 +噎 +噔 +噗 +噘 +噙 +噜 +噢 +噤 +器 +噩 +噪 +噫 +噬 +噱 +噶 +噻 +噼 +嚄 +嚅 +嚆 +嚎 +嚏 +嚓 +嚚 +嚣 +嚭 +嚯 +嚷 +嚼 +囊 +囔 +囚 +四 +回 +囟 +因 +囡 +团 +囤 +囫 +园 +困 +囱 +围 +囵 +囷 +囹 +固 +国 +图 +囿 +圃 +圄 +圆 +圈 +圉 +圊 +圌 +圐 +圙 +圜 +土 +圢 +圣 +在 +圩 +圪 +圫 +圬 +圭 +圮 +圯 +地 +圲 +圳 +圹 +场 +圻 +圾 +址 +坂 +均 +坉 +坊 +坋 +坌 +坍 +坎 +坏 +坐 +坑 +坒 +块 +坚 +坛 +坜 +坝 +坞 +坟 +坠 +坡 +坤 +坥 +坦 +坨 +坩 +坪 +坫 +坬 +坭 +坯 +坰 +坳 +坷 +坻 +坼 +坽 +垂 +垃 +垄 +垆 +垈 +型 +垌 +垍 +垎 +垏 +垒 +垓 +垕 +垙 +垚 +垛 +垞 +垟 +垠 +垡 +垢 +垣 +垤 +垦 +垧 +垩 +垫 +垭 +垮 +垯 +垱 +垲 +垴 +垵 +垸 +垺 +垾 +垿 +埂 +埃 +埆 +埇 +埋 +埌 +城 +埏 +埒 +埔 +埕 +埗 +埘 +埙 +埚 +埝 +域 +埠 +埤 +埪 +埫 +埭 +埯 +埴 +埵 +埸 +培 +基 +埼 +埽 +堂 +堃 +堆 +堇 +堉 +堋 +堌 +堍 +堎 +堐 +堑 +堕 +堙 +堞 +堠 +堡 +堤 +堧 +堨 +堪 +堰 +堲 +堵 +堼 +堽 +堾 +塄 +塅 +塆 +塌 +塍 +塑 +塔 +塘 +塝 +塞 +塥 +填 +塬 +塱 +塾 +墀 +墁 +境 +墅 +墈 +墉 +墐 +墒 +墓 +墕 +墘 +墙 +墚 +增 +墟 +墡 +墣 +墦 +墨 +墩 +墼 +壁 +壅 +壑 +壕 +壤 +士 +壬 +壮 +声 +壳 +壶 +壸 +壹 +处 +备 +复 +夏 +夐 +夔 +夕 +外 +夙 +多 +夜 +够 +夤 +夥 +大 +天 +太 +夫 +夬 +夭 +央 +夯 +失 +头 +夷 +夸 +夹 +夺 +夼 +奁 +奂 +奄 +奇 +奈 +奉 +奋 +奎 +奏 +契 +奓 +奔 +奕 +奖 +套 +奘 +奚 +奠 +奡 +奢 +奥 +奭 +女 +奴 +奶 +奸 +她 +好 +妁 +如 +妃 +妄 +妆 +妇 +妈 +妊 +妍 +妒 +妓 +妖 +妗 +妘 +妙 +妞 +妣 +妤 +妥 +妧 +妨 +妩 +妪 +妫 +妭 +妮 +妯 +妲 +妹 +妻 +妾 +姆 +姈 +姊 +始 +姐 +姑 +姒 +姓 +委 +姗 +姘 +姚 +姜 +姝 +姞 +姣 +姤 +姥 +姨 +姬 +姮 +姱 +姶 +姹 +姻 +姽 +姿 +娀 +威 +娃 +娄 +娅 +娆 +娇 +娈 +娉 +娌 +娑 +娓 +娘 +娜 +娟 +娠 +娣 +娥 +娩 +娱 +娲 +娴 +娵 +娶 +娼 +婀 +婆 +婉 +婊 +婌 +婍 +婕 +婘 +婚 +婞 +婠 +婢 +婤 +婧 +婪 +婫 +婳 +婴 +婵 +婶 +婷 +婺 +婻 +婼 +婿 +媂 +媄 +媆 +媒 +媓 +媖 +媚 +媛 +媞 +媪 +媭 +媱 +媲 +媳 +媵 +媸 +媾 +嫁 +嫂 +嫄 +嫉 +嫌 +嫒 +嫔 +嫕 +嫖 +嫘 +嫚 +嫜 +嫠 +嫡 +嫣 +嫦 +嫩 +嫪 +嫫 +嫭 +嫱 +嫽 +嬉 +嬖 +嬗 +嬛 +嬥 +嬬 +嬴 +嬷 +嬿 +孀 +孅 +子 +孑 +孓 +孔 +孕 +孖 +字 +存 +孙 +孚 +孛 +孜 +孝 +孟 +孢 +季 +孤 +孥 +学 +孩 +孪 +孬 +孰 +孱 +孳 +孵 +孺 +孽 +宁 +它 +宄 +宅 +宇 +守 +安 +宋 +完 +宏 +宓 +宕 +宗 +官 +宙 +定 +宛 +宜 +宝 +实 +宠 +审 +客 +宣 +室 +宥 +宦 +宧 +宪 +宫 +宬 +宰 +害 +宴 +宵 +家 +宸 +容 +宽 +宾 +宿 +寁 +寂 +寄 +寅 +密 +寇 +富 +寐 +寒 +寓 +寝 +寞 +察 +寡 +寤 +寥 +寨 +寮 +寰 +寸 +对 +寺 +寻 +导 +寿 +封 +射 +将 +尉 +尊 +小 +少 +尔 +尕 +尖 +尘 +尚 +尜 +尝 +尢 +尤 +尥 +尧 +尨 +尪 +尬 +就 +尴 +尸 +尹 +尺 +尻 +尼 +尽 +尾 +尿 +局 +屁 +层 +屃 +居 +屈 +屉 +届 +屋 +屎 +屏 +屐 +屑 +展 +屙 +属 +屠 +屡 +屣 +履 +屦 +屯 +山 +屹 +屺 +屼 +屾 +屿 +岁 +岂 +岈 +岊 +岌 +岍 +岐 +岑 +岔 +岖 +岗 +岘 +岙 +岚 +岛 +岜 +岞 +岠 +岢 +岣 +岨 +岩 +岫 +岬 +岭 +岱 +岳 +岵 +岷 +岸 +岽 +岿 +峁 +峂 +峃 +峄 +峋 +峒 +峗 +峘 +峙 +峛 +峡 +峣 +峤 +峥 +峦 +峧 +峨 +峪 +峭 +峰 +峱 +峻 +峿 +崀 +崁 +崂 +崃 +崄 +崆 +崇 +崌 +崎 +崒 +崔 +崖 +崚 +崛 +崞 +崟 +崡 +崤 +崦 +崧 +崩 +崭 +崮 +崴 +崶 +崽 +崾 +崿 +嵁 +嵅 +嵇 +嵊 +嵋 +嵌 +嵎 +嵖 +嵘 +嵚 +嵛 +嵝 +嵩 +嵫 +嵬 +嵯 +嵲 +嵴 +嶂 +嶅 +嶍 +嶒 +嶓 +嶙 +嶝 +嶟 +嶦 +嶲 +嶷 +巅 +巇 +巉 +巍 +川 +州 +巡 +巢 +工 +左 +巧 +巨 +巩 +巫 +差 +巯 +己 +已 +巳 +巴 +巷 +巽 +巾 +币 +市 +布 +帅 +帆 +师 +希 +帏 +帐 +帑 +帔 +帕 +帖 +帘 +帙 +帚 +帛 +帜 +帝 +帡 +带 +帧 +帨 +席 +帮 +帱 +帷 +常 +帻 +帼 +帽 +幂 +幄 +幅 +幌 +幔 +幕 +幖 +幛 +幞 +幡 +幢 +幪 +干 +平 +年 +并 +幸 +幺 +幻 +幼 +幽 +广 +庄 +庆 +庇 +床 +庋 +序 +庐 +庑 +库 +应 +底 +庖 +店 +庙 +庚 +府 +庞 +废 +庠 +庤 +庥 +度 +座 +庭 +庱 +庳 +庵 +庶 +康 +庸 +庹 +庼 +庾 +廆 +廉 +廊 +廋 +廑 +廒 +廓 +廖 +廙 +廛 +廨 +廪 +延 +廷 +建 +廿 +开 +弁 +异 +弃 +弄 +弆 +弇 +弈 +弊 +弋 +式 +弑 +弓 +引 +弗 +弘 +弛 +弟 +张 +弢 +弥 +弦 +弧 +弨 +弩 +弭 +弯 +弱 +弶 +弸 +弹 +强 +弼 +彀 +归 +当 +录 +彖 +彗 +彘 +彝 +彟 +形 +彤 +彦 +彧 +彩 +彪 +彬 +彭 +彰 +影 +彳 +彷 +役 +彻 +彼 +往 +征 +徂 +径 +待 +徇 +很 +徉 +徊 +律 +徐 +徒 +徕 +得 +徘 +徙 +徛 +徜 +御 +徨 +循 +徭 +微 +徵 +德 +徼 +徽 +心 +必 +忆 +忉 +忌 +忍 +忏 +忐 +忑 +忒 +忖 +志 +忘 +忙 +忝 +忞 +忠 +忡 +忤 +忧 +忪 +快 +忭 +忮 +忱 +忳 +念 +忸 +忺 +忻 +忽 +忾 +忿 +怀 +态 +怂 +怃 +怄 +怅 +怆 +怊 +怍 +怎 +怏 +怒 +怔 +怕 +怖 +怙 +怛 +怜 +思 +怠 +怡 +急 +怦 +性 +怨 +怩 +怪 +怫 +怯 +怵 +总 +怼 +怿 +恁 +恂 +恃 +恋 +恍 +恐 +恒 +恓 +恔 +恕 +恙 +恚 +恝 +恢 +恣 +恤 +恧 +恨 +恩 +恪 +恫 +恬 +恭 +息 +恰 +恳 +恶 +恸 +恹 +恺 +恻 +恼 +恽 +恿 +悃 +悄 +悆 +悈 +悉 +悌 +悍 +悒 +悔 +悖 +悚 +悛 +悝 +悟 +悠 +悢 +患 +悦 +您 +悫 +悬 +悭 +悯 +悰 +悱 +悲 +悴 +悸 +悻 +悼 +情 +惆 +惇 +惊 +惋 +惎 +惑 +惔 +惕 +惘 +惙 +惚 +惛 +惜 +惝 +惟 +惠 +惦 +惧 +惨 +惩 +惫 +惬 +惭 +惮 +惯 +惰 +想 +惴 +惶 +惹 +惺 +愀 +愁 +愃 +愆 +愈 +愉 +愍 +愎 +意 +愐 +愔 +愕 +愚 +感 +愠 +愣 +愤 +愦 +愧 +愫 +愭 +愿 +慆 +慈 +慊 +慌 +慎 +慑 +慕 +慝 +慢 +慥 +慧 +慨 +慬 +慭 +慰 +慵 +慷 +憋 +憎 +憔 +憕 +憙 +憧 +憨 +憩 +憬 +憭 +憷 +憺 +憾 +懂 +懈 +懊 +懋 +懑 +懒 +懔 +懦 +懵 +懿 +戆 +戈 +戊 +戋 +戌 +戍 +戎 +戏 +成 +我 +戒 +戕 +或 +戗 +战 +戚 +戛 +戟 +戡 +戢 +戣 +戤 +戥 +截 +戬 +戭 +戮 +戳 +戴 +户 +戽 +戾 +房 +所 +扁 +扂 +扃 +扅 +扆 +扇 +扈 +扉 +扊 +手 +才 +扎 +扑 +扒 +打 +扔 +托 +扛 +扞 +扣 +扦 +执 +扩 +扪 +扫 +扬 +扭 +扮 +扯 +扰 +扳 +扶 +批 +扺 +扼 +扽 +找 +承 +技 +抃 +抄 +抉 +把 +抑 +抒 +抓 +抔 +投 +抖 +抗 +折 +抚 +抛 +抟 +抠 +抡 +抢 +护 +报 +抨 +披 +抬 +抱 +抵 +抹 +抻 +押 +抽 +抿 +拂 +拃 +拄 +担 +拆 +拇 +拈 +拉 +拊 +拌 +拍 +拎 +拐 +拒 +拓 +拔 +拖 +拗 +拘 +拙 +招 +拜 +拟 +拢 +拣 +拤 +拥 +拦 +拧 +拨 +择 +括 +拭 +拮 +拯 +拱 +拳 +拴 +拶 +拷 +拼 +拽 +拾 +拿 +持 +挂 +指 +挈 +按 +挎 +挑 +挓 +挖 +挚 +挛 +挝 +挞 +挟 +挠 +挡 +挣 +挤 +挥 +挦 +挨 +挪 +挫 +振 +挲 +挹 +挺 +挽 +捂 +捃 +捅 +捆 +捉 +捋 +捌 +捍 +捎 +捏 +捐 +捕 +捞 +损 +捡 +换 +捣 +捧 +捩 +捭 +据 +捯 +捶 +捷 +捺 +捻 +捽 +掀 +掂 +掇 +授 +掉 +掊 +掌 +掎 +掏 +掐 +排 +掖 +掘 +掞 +掠 +探 +掣 +接 +控 +推 +掩 +措 +掬 +掭 +掮 +掰 +掳 +掴 +掷 +掸 +掺 +掼 +掾 +揄 +揆 +揉 +揍 +描 +提 +插 +揕 +揖 +揠 +握 +揣 +揩 +揪 +揭 +揳 +援 +揶 +揸 +揽 +揿 +搀 +搁 +搂 +搅 +搋 +搌 +搏 +搐 +搒 +搓 +搔 +搛 +搜 +搞 +搠 +搡 +搦 +搪 +搬 +搭 +搴 +携 +搽 +摁 +摄 +摅 +摆 +摇 +摈 +摊 +摏 +摒 +摔 +摘 +摛 +摞 +摧 +摩 +摭 +摴 +摸 +摹 +摽 +撂 +撄 +撅 +撇 +撑 +撒 +撕 +撖 +撙 +撞 +撤 +撩 +撬 +播 +撮 +撰 +撵 +撷 +撸 +撺 +撼 +擀 +擂 +擅 +操 +擎 +擐 +擒 +擘 +擞 +擢 +擤 +擦 +擿 +攀 +攉 +攒 +攘 +攥 +攫 +攮 +支 +收 +攸 +改 +攻 +攽 +放 +政 +故 +效 +敉 +敌 +敏 +救 +敔 +敕 +敖 +教 +敛 +敝 +敞 +敢 +散 +敦 +敩 +敫 +敬 +数 +敲 +整 +敷 +文 +斋 +斌 +斐 +斑 +斓 +斗 +料 +斛 +斜 +斝 +斟 +斠 +斡 +斤 +斥 +斧 +斩 +斫 +断 +斯 +新 +斶 +方 +於 +施 +旁 +旃 +旄 +旅 +旆 +旋 +旌 +旎 +族 +旐 +旒 +旖 +旗 +旞 +无 +既 +日 +旦 +旧 +旨 +早 +旬 +旭 +旮 +旯 +旰 +旱 +旴 +旵 +时 +旷 +旸 +旺 +旻 +旿 +昀 +昂 +昃 +昄 +昆 +昇 +昈 +昉 +昊 +昌 +明 +昏 +昒 +易 +昔 +昕 +昙 +昝 +星 +映 +昡 +昣 +昤 +春 +昧 +昨 +昪 +昫 +昭 +是 +昱 +昳 +昴 +昵 +昶 +昺 +昼 +昽 +显 +晁 +晃 +晅 +晊 +晋 +晌 +晏 +晐 +晒 +晓 +晔 +晕 +晖 +晗 +晙 +晚 +晞 +晟 +晡 +晢 +晤 +晦 +晨 +晪 +晫 +普 +景 +晰 +晱 +晴 +晶 +晷 +智 +晾 +暂 +暄 +暅 +暇 +暌 +暑 +暕 +暖 +暗 +暝 +暧 +暨 +暮 +暲 +暴 +暵 +暶 +暹 +暾 +暿 +曈 +曌 +曙 +曛 +曜 +曝 +曦 +曩 +曰 +曲 +曳 +更 +曷 +曹 +曼 +曾 +替 +最 +月 +有 +朋 +服 +朏 +朐 +朓 +朔 +朕 +朗 +望 +朝 +期 +朦 +木 +未 +末 +本 +札 +术 +朱 +朳 +朴 +朵 +朸 +机 +朽 +杀 +杂 +权 +杄 +杆 +杈 +杉 +杌 +李 +杏 +材 +村 +杓 +杕 +杖 +杙 +杜 +杞 +束 +杠 +条 +来 +杧 +杨 +杩 +杪 +杭 +杯 +杰 +杲 +杳 +杵 +杷 +杻 +杼 +松 +板 +极 +构 +枅 +枇 +枉 +枋 +枍 +析 +枕 +林 +枘 +枚 +果 +枝 +枞 +枢 +枣 +枥 +枧 +枨 +枪 +枫 +枭 +枯 +枰 +枲 +枳 +枵 +架 +枷 +枸 +枹 +柁 +柃 +柄 +柈 +柊 +柏 +某 +柑 +柒 +染 +柔 +柖 +柘 +柙 +柚 +柜 +柝 +柞 +柠 +柢 +查 +柩 +柬 +柯 +柰 +柱 +柳 +柴 +柷 +柽 +柿 +栀 +栅 +标 +栈 +栉 +栊 +栋 +栌 +栎 +栏 +栐 +树 +栒 +栓 +栖 +栗 +栝 +栟 +校 +栩 +株 +栲 +栳 +栴 +样 +核 +根 +栻 +格 +栽 +栾 +桀 +桁 +桂 +桃 +桄 +桅 +框 +案 +桉 +桊 +桌 +桎 +桐 +桑 +桓 +桔 +桕 +桠 +桡 +桢 +档 +桤 +桥 +桦 +桧 +桨 +桩 +桫 +桯 +桲 +桴 +桶 +桷 +桹 +梁 +梃 +梅 +梆 +梌 +梏 +梓 +梗 +梠 +梢 +梣 +梦 +梧 +梨 +梭 +梯 +械 +梳 +梴 +梵 +梼 +梽 +梾 +梿 +检 +棁 +棂 +棉 +棋 +棍 +棐 +棒 +棓 +棕 +棘 +棚 +棠 +棣 +棤 +棨 +棪 +棫 +棬 +森 +棰 +棱 +棵 +棹 +棺 +棻 +棼 +棽 +椀 +椁 +椅 +椆 +椋 +植 +椎 +椐 +椑 +椒 +椓 +椟 +椠 +椤 +椪 +椭 +椰 +椴 +椸 +椹 +椽 +椿 +楂 +楒 +楔 +楗 +楙 +楚 +楝 +楞 +楠 +楣 +楦 +楩 +楪 +楫 +楮 +楯 +楷 +楸 +楹 +楼 +概 +榃 +榄 +榅 +榆 +榇 +榈 +榉 +榍 +榑 +榔 +榕 +榖 +榛 +榜 +榧 +榨 +榫 +榭 +榰 +榱 +榴 +榷 +榻 +槁 +槃 +槊 +槌 +槎 +槐 +槔 +槚 +槛 +槜 +槟 +槠 +槭 +槱 +槲 +槽 +槿 +樊 +樗 +樘 +樟 +模 +樨 +横 +樯 +樱 +樵 +樽 +樾 +橄 +橇 +橐 +橑 +橘 +橙 +橛 +橞 +橡 +橥 +橦 +橱 +橹 +橼 +檀 +檄 +檎 +檐 +檑 +檗 +檞 +檠 +檩 +檫 +檬 +櫆 +欂 +欠 +次 +欢 +欣 +欤 +欧 +欲 +欸 +欹 +欺 +欻 +款 +歃 +歅 +歆 +歇 +歉 +歌 +歙 +止 +正 +此 +步 +武 +歧 +歪 +歹 +死 +歼 +殁 +殂 +殃 +殄 +殆 +殇 +殉 +殊 +残 +殍 +殒 +殓 +殖 +殚 +殛 +殡 +殣 +殪 +殳 +殴 +段 +殷 +殿 +毁 +毂 +毅 +毋 +毌 +母 +每 +毐 +毒 +毓 +比 +毕 +毖 +毗 +毙 +毛 +毡 +毪 +毫 +毯 +毳 +毵 +毹 +毽 +氅 +氆 +氇 +氍 +氏 +氐 +民 +氓 +气 +氕 +氖 +氘 +氙 +氚 +氛 +氟 +氡 +氢 +氤 +氦 +氧 +氨 +氩 +氪 +氮 +氯 +氰 +氲 +水 +永 +氾 +氿 +汀 +汁 +求 +汆 +汇 +汈 +汉 +汊 +汋 +汐 +汔 +汕 +汗 +汛 +汜 +汝 +汞 +江 +池 +污 +汤 +汧 +汨 +汩 +汪 +汫 +汭 +汰 +汲 +汴 +汶 +汹 +汽 +汾 +沁 +沂 +沃 +沄 +沅 +沆 +沇 +沈 +沉 +沌 +沏 +沐 +沓 +沔 +沘 +沙 +沚 +沛 +沟 +没 +沣 +沤 +沥 +沦 +沧 +沨 +沩 +沪 +沫 +沭 +沮 +沱 +河 +沸 +油 +沺 +治 +沼 +沽 +沾 +沿 +泂 +泃 +泄 +泅 +泇 +泉 +泊 +泌 +泐 +泓 +泔 +法 +泖 +泗 +泙 +泚 +泛 +泜 +泞 +泠 +泡 +波 +泣 +泥 +注 +泪 +泫 +泮 +泯 +泰 +泱 +泳 +泵 +泷 +泸 +泺 +泻 +泼 +泽 +泾 +洁 +洄 +洇 +洈 +洋 +洌 +洎 +洑 +洒 +洓 +洗 +洘 +洙 +洚 +洛 +洞 +洢 +洣 +津 +洧 +洨 +洪 +洫 +洭 +洮 +洱 +洲 +洳 +洴 +洵 +洸 +洹 +洺 +活 +洼 +洽 +派 +洿 +流 +浃 +浅 +浆 +浇 +浈 +浉 +浊 +测 +浍 +济 +浏 +浐 +浑 +浒 +浓 +浔 +浕 +浙 +浚 +浛 +浜 +浞 +浟 +浠 +浡 +浣 +浥 +浦 +浩 +浪 +浬 +浭 +浮 +浯 +浰 +浲 +浴 +海 +浸 +浼 +涂 +涄 +涅 +消 +涉 +涌 +涍 +涎 +涐 +涑 +涓 +涔 +涕 +涘 +涛 +涝 +涞 +涟 +涠 +涡 +涢 +涣 +涤 +润 +涧 +涨 +涩 +涪 +涫 +涮 +涯 +液 +涴 +涵 +涸 +涿 +淀 +淄 +淅 +淆 +淇 +淋 +淌 +淏 +淑 +淖 +淘 +淙 +淜 +淝 +淞 +淟 +淠 +淡 +淤 +淦 +淫 +淬 +淮 +淯 +深 +淳 +淴 +混 +淹 +添 +淼 +清 +渊 +渌 +渍 +渎 +渐 +渑 +渔 +渗 +渚 +渝 +渟 +渠 +渡 +渣 +渤 +渥 +温 +渫 +渭 +港 +渰 +渲 +渴 +游 +渺 +渼 +湃 +湄 +湉 +湍 +湎 +湑 +湓 +湔 +湖 +湘 +湛 +湜 +湝 +湟 +湣 +湫 +湮 +湲 +湴 +湾 +湿 +溁 +溃 +溅 +溆 +溇 +溉 +溍 +溏 +源 +溘 +溚 +溜 +溞 +溟 +溠 +溢 +溥 +溦 +溧 +溪 +溯 +溱 +溲 +溴 +溵 +溶 +溷 +溹 +溺 +溻 +溽 +滁 +滂 +滃 +滆 +滇 +滉 +滋 +滍 +滏 +滑 +滓 +滔 +滕 +滗 +滘 +滚 +滞 +滟 +滠 +满 +滢 +滤 +滥 +滦 +滧 +滨 +滩 +滪 +滫 +滴 +滹 +漂 +漆 +漈 +漉 +漋 +漏 +漓 +演 +漕 +漖 +漠 +漤 +漦 +漩 +漪 +漫 +漭 +漯 +漱 +漳 +漴 +漶 +漷 +漹 +漻 +漼 +漾 +潆 +潇 +潋 +潍 +潏 +潖 +潘 +潜 +潞 +潟 +潢 +潦 +潩 +潭 +潮 +潲 +潴 +潵 +潸 +潺 +潼 +潽 +潾 +澂 +澄 +澈 +澉 +澌 +澍 +澎 +澛 +澜 +澡 +澥 +澧 +澪 +澭 +澳 +澴 +澶 +澹 +澼 +澽 +激 +濂 +濉 +濋 +濑 +濒 +濞 +濠 +濡 +濩 +濮 +濯 +瀌 +瀍 +瀑 +瀔 +瀚 +瀛 +瀣 +瀱 +瀵 +瀹 +瀼 +灈 +灌 +灏 +灞 +火 +灭 +灯 +灰 +灵 +灶 +灸 +灼 +灾 +灿 +炀 +炅 +炆 +炉 +炊 +炌 +炎 +炒 +炔 +炕 +炖 +炘 +炙 +炜 +炝 +炟 +炣 +炫 +炬 +炭 +炮 +炯 +炱 +炳 +炷 +炸 +点 +炻 +炼 +炽 +烀 +烁 +烂 +烃 +烈 +烊 +烔 +烘 +烙 +烛 +烜 +烝 +烟 +烠 +烤 +烦 +烧 +烨 +烩 +烫 +烬 +热 +烯 +烶 +烷 +烹 +烺 +烻 +烽 +焆 +焉 +焊 +焌 +焐 +焓 +焕 +焖 +焗 +焘 +焙 +焚 +焜 +焞 +焦 +焯 +焰 +焱 +然 +煁 +煃 +煅 +煊 +煋 +煌 +煎 +煓 +煜 +煞 +煟 +煤 +煦 +照 +煨 +煮 +煲 +煳 +煴 +煸 +煺 +煽 +熄 +熇 +熊 +熏 +熔 +熘 +熙 +熛 +熜 +熟 +熠 +熥 +熨 +熬 +熵 +熹 +熻 +燃 +燊 +燋 +燎 +燏 +燔 +燕 +燚 +燠 +燥 +燧 +燮 +燹 +爆 +爇 +爔 +爚 +爝 +爟 +爨 +爪 +爬 +爰 +爱 +爵 +父 +爷 +爸 +爹 +爻 +爽 +爿 +牁 +牂 +片 +版 +牌 +牍 +牒 +牖 +牙 +牚 +牛 +牝 +牟 +牡 +牢 +牤 +牥 +牦 +牧 +物 +牮 +牯 +牲 +牵 +特 +牺 +牻 +牾 +牿 +犀 +犁 +犄 +犇 +犊 +犋 +犍 +犏 +犒 +犟 +犨 +犬 +犯 +犰 +犴 +状 +犷 +犸 +犹 +狁 +狂 +狃 +狄 +狈 +狉 +狍 +狎 +狐 +狒 +狗 +狙 +狝 +狞 +狠 +狡 +狨 +狩 +独 +狭 +狮 +狯 +狰 +狱 +狲 +狳 +狴 +狷 +狸 +狺 +狻 +狼 +猁 +猃 +猄 +猇 +猊 +猎 +猕 +猖 +猗 +猛 +猜 +猝 +猞 +猡 +猢 +猥 +猩 +猪 +猫 +猬 +献 +猯 +猰 +猱 +猴 +猷 +猹 +猺 +猾 +猿 +獍 +獐 +獒 +獗 +獠 +獬 +獭 +獯 +獴 +獾 +玃 +玄 +率 +玉 +王 +玎 +玑 +玒 +玓 +玕 +玖 +玘 +玙 +玚 +玛 +玞 +玟 +玠 +玡 +玢 +玤 +玥 +玦 +玩 +玫 +玭 +玮 +环 +现 +玱 +玲 +玳 +玶 +玷 +玹 +玺 +玻 +玼 +玿 +珀 +珂 +珅 +珇 +珈 +珉 +珊 +珋 +珌 +珍 +珏 +珐 +珑 +珒 +珕 +珖 +珙 +珛 +珝 +珞 +珠 +珢 +珣 +珥 +珦 +珧 +珩 +珪 +珫 +班 +珰 +珲 +珵 +珷 +珸 +珹 +珺 +珽 +琀 +球 +琄 +琅 +理 +琇 +琈 +琉 +琊 +琎 +琏 +琐 +琔 +琚 +琛 +琟 +琡 +琢 +琤 +琥 +琦 +琨 +琪 +琫 +琬 +琭 +琮 +琯 +琰 +琲 +琳 +琴 +琵 +琶 +琼 +瑀 +瑁 +瑂 +瑃 +瑄 +瑅 +瑆 +瑑 +瑓 +瑔 +瑕 +瑖 +瑗 +瑙 +瑚 +瑛 +瑜 +瑝 +瑞 +瑟 +瑢 +瑧 +瑨 +瑬 +瑭 +瑰 +瑱 +瑳 +瑶 +瑷 +瑾 +璀 +璁 +璃 +璆 +璇 +璈 +璋 +璎 +璐 +璒 +璘 +璜 +璞 +璟 +璠 +璥 +璧 +璨 +璩 +璪 +璬 +璮 +璱 +璲 +璺 +瓀 +瓒 +瓖 +瓘 +瓜 +瓞 +瓠 +瓢 +瓣 +瓤 +瓦 +瓮 +瓯 +瓴 +瓶 +瓷 +瓻 +瓿 +甄 +甍 +甏 +甑 +甓 +甗 +甘 +甚 +甜 +生 +甡 +甥 +甦 +用 +甩 +甪 +甫 +甬 +甭 +甯 +田 +由 +甲 +申 +电 +男 +甸 +町 +画 +甾 +畀 +畅 +畈 +畋 +界 +畎 +畏 +畔 +畖 +留 +畚 +畛 +畜 +畤 +略 +畦 +番 +畬 +畯 +畲 +畴 +畸 +畹 +畿 +疁 +疃 +疆 +疍 +疏 +疐 +疑 +疔 +疖 +疗 +疙 +疚 +疝 +疟 +疠 +疡 +疢 +疣 +疤 +疥 +疫 +疬 +疭 +疮 +疯 +疰 +疱 +疲 +疳 +疴 +疵 +疸 +疹 +疼 +疽 +疾 +痂 +痃 +痄 +病 +症 +痈 +痉 +痊 +痍 +痒 +痓 +痔 +痕 +痘 +痛 +痞 +痢 +痣 +痤 +痦 +痧 +痨 +痪 +痫 +痰 +痱 +痴 +痹 +痼 +痿 +瘀 +瘁 +瘃 +瘅 +瘆 +瘊 +瘌 +瘐 +瘕 +瘗 +瘘 +瘙 +瘛 +瘟 +瘠 +瘢 +瘤 +瘥 +瘦 +瘩 +瘪 +瘫 +瘭 +瘰 +瘳 +瘴 +瘵 +瘸 +瘼 +瘾 +瘿 +癀 +癃 +癌 +癍 +癔 +癖 +癗 +癜 +癞 +癣 +癫 +癯 +癸 +登 +白 +百 +癿 +皂 +的 +皆 +皇 +皈 +皋 +皎 +皑 +皓 +皕 +皖 +皙 +皛 +皞 +皤 +皦 +皭 +皮 +皱 +皲 +皴 +皿 +盂 +盅 +盆 +盈 +盉 +益 +盍 +盎 +盏 +盐 +监 +盒 +盔 +盖 +盗 +盘 +盛 +盟 +盥 +盦 +目 +盯 +盱 +盲 +直 +盷 +相 +盹 +盼 +盾 +省 +眄 +眇 +眈 +眉 +眊 +看 +眍 +眙 +眚 +真 +眠 +眢 +眦 +眨 +眩 +眬 +眭 +眯 +眵 +眶 +眷 +眸 +眺 +眼 +着 +睁 +睃 +睄 +睇 +睎 +睐 +睑 +睚 +睛 +睡 +睢 +督 +睥 +睦 +睨 +睫 +睬 +睹 +睽 +睾 +睿 +瞀 +瞄 +瞅 +瞋 +瞌 +瞍 +瞎 +瞑 +瞒 +瞟 +瞠 +瞢 +瞥 +瞧 +瞩 +瞪 +瞫 +瞬 +瞭 +瞰 +瞳 +瞵 +瞻 +瞽 +瞿 +矍 +矗 +矛 +矜 +矞 +矢 +矣 +知 +矧 +矩 +矫 +矬 +短 +矮 +矰 +石 +矶 +矸 +矻 +矼 +矾 +矿 +砀 +码 +砂 +砄 +砆 +砉 +砌 +砍 +砑 +砒 +研 +砖 +砗 +砘 +砚 +砜 +砝 +砟 +砠 +砣 +砥 +砧 +砫 +砬 +砭 +砮 +砰 +破 +砵 +砷 +砸 +砹 +砺 +砻 +砼 +砾 +础 +硁 +硅 +硇 +硊 +硌 +硍 +硎 +硐 +硒 +硔 +硕 +硖 +硗 +硙 +硚 +硝 +硪 +硫 +硬 +硭 +确 +硼 +硿 +碃 +碇 +碈 +碉 +碌 +碍 +碎 +碏 +碑 +碓 +碗 +碘 +碚 +碛 +碜 +碟 +碡 +碣 +碥 +碧 +碨 +碰 +碱 +碲 +碳 +碴 +碶 +碹 +碾 +磁 +磅 +磉 +磊 +磋 +磏 +磐 +磔 +磕 +磙 +磜 +磡 +磨 +磬 +磲 +磴 +磷 +磹 +磻 +礁 +礅 +礌 +礓 +礞 +礴 +礵 +示 +礼 +社 +祀 +祁 +祃 +祆 +祇 +祈 +祉 +祊 +祋 +祎 +祏 +祐 +祓 +祕 +祖 +祗 +祚 +祛 +祜 +祝 +神 +祟 +祠 +祢 +祥 +祧 +票 +祭 +祯 +祲 +祷 +祸 +祺 +祼 +祾 +禀 +禁 +禄 +禅 +禊 +禋 +福 +禒 +禔 +禘 +禚 +禛 +禤 +禧 +禳 +禹 +禺 +离 +禽 +禾 +秀 +私 +秃 +秆 +秉 +秋 +种 +科 +秒 +秕 +秘 +租 +秣 +秤 +秦 +秧 +秩 +秫 +秬 +秭 +积 +称 +秸 +移 +秽 +秾 +稀 +稂 +稃 +稆 +程 +稌 +稍 +税 +稑 +稔 +稗 +稙 +稚 +稞 +稠 +稣 +稳 +稷 +稹 +稻 +稼 +稽 +稿 +穄 +穆 +穑 +穗 +穙 +穜 +穟 +穰 +穴 +究 +穷 +穸 +穹 +空 +穿 +窀 +突 +窃 +窄 +窅 +窈 +窊 +窍 +窎 +窑 +窒 +窕 +窖 +窗 +窘 +窜 +窝 +窟 +窠 +窣 +窥 +窦 +窨 +窬 +窭 +窳 +窸 +窿 +立 +竑 +竖 +竘 +站 +竞 +竟 +章 +竣 +童 +竦 +竫 +竭 +端 +竹 +竺 +竽 +竿 +笃 +笄 +笆 +笈 +笊 +笋 +笏 +笑 +笔 +笕 +笙 +笛 +笞 +笠 +笤 +笥 +符 +笨 +笪 +笫 +第 +笮 +笯 +笱 +笳 +笸 +笺 +笼 +笾 +筀 +筅 +筇 +等 +筋 +筌 +筏 +筐 +筑 +筒 +答 +策 +筘 +筚 +筛 +筜 +筝 +筠 +筢 +筤 +筥 +筦 +筮 +筱 +筲 +筵 +筶 +筷 +筹 +筻 +筼 +签 +简 +箅 +箍 +箐 +箓 +箔 +箕 +箖 +算 +箜 +管 +箢 +箦 +箧 +箨 +箩 +箪 +箫 +箬 +箭 +箱 +箴 +箸 +篁 +篆 +篇 +篌 +篑 +篓 +篙 +篚 +篝 +篡 +篥 +篦 +篪 +篮 +篯 +篱 +篷 +篼 +篾 +簃 +簇 +簉 +簋 +簌 +簏 +簕 +簖 +簝 +簟 +簠 +簧 +簪 +簰 +簸 +簿 +籀 +籁 +籍 +籥 +米 +籴 +类 +籼 +籽 +粉 +粑 +粒 +粕 +粗 +粘 +粜 +粝 +粞 +粟 +粢 +粤 +粥 +粪 +粮 +粱 +粲 +粳 +粹 +粼 +粽 +精 +粿 +糁 +糅 +糇 +糈 +糊 +糌 +糍 +糒 +糕 +糖 +糗 +糙 +糜 +糟 +糠 +糨 +糯 +糵 +系 +紊 +素 +索 +紧 +紫 +累 +絜 +絮 +絷 +綦 +綮 +縠 +縢 +縻 +繁 +繄 +繇 +纂 +纛 +纠 +纡 +红 +纣 +纤 +纥 +约 +级 +纨 +纩 +纪 +纫 +纬 +纭 +纮 +纯 +纰 +纱 +纲 +纳 +纴 +纵 +纶 +纷 +纸 +纹 +纺 +纻 +纼 +纽 +纾 +线 +绀 +绁 +绂 +练 +组 +绅 +细 +织 +终 +绉 +绊 +绋 +绌 +绍 +绎 +经 +绐 +绑 +绒 +结 +绔 +绕 +绖 +绗 +绘 +给 +绚 +绛 +络 +绝 +绞 +统 +绠 +绡 +绢 +绣 +绤 +绥 +绦 +继 +绨 +绩 +绪 +绫 +续 +绮 +绯 +绰 +绱 +绲 +绳 +维 +绵 +绶 +绷 +绸 +绹 +绺 +绻 +综 +绽 +绾 +绿 +缀 +缁 +缂 +缃 +缄 +缅 +缆 +缇 +缈 +缉 +缊 +缌 +缎 +缐 +缑 +缒 +缓 +缔 +缕 +编 +缗 +缘 +缙 +缚 +缛 +缜 +缝 +缞 +缟 +缠 +缡 +缢 +缣 +缤 +缥 +缦 +缧 +缨 +缩 +缪 +缫 +缬 +缭 +缮 +缯 +缰 +缱 +缲 +缳 +缴 +缵 +缶 +缸 +缺 +罂 +罄 +罅 +罍 +罐 +网 +罔 +罕 +罗 +罘 +罚 +罟 +罡 +罢 +罨 +罩 +罪 +置 +罱 +署 +罴 +罶 +罹 +罽 +罾 +羁 +羊 +羌 +美 +羑 +羓 +羔 +羕 +羖 +羚 +羝 +羞 +羟 +羡 +群 +羧 +羯 +羰 +羱 +羲 +羸 +羹 +羼 +羽 +羿 +翀 +翁 +翂 +翃 +翅 +翈 +翊 +翌 +翎 +翔 +翕 +翘 +翙 +翚 +翛 +翟 +翠 +翡 +翥 +翦 +翩 +翮 +翯 +翰 +翱 +翳 +翷 +翻 +翼 +翾 +耀 +老 +考 +耄 +者 +耆 +耇 +耋 +而 +耍 +耏 +耐 +耑 +耒 +耔 +耕 +耖 +耗 +耘 +耙 +耜 +耠 +耢 +耤 +耥 +耦 +耧 +耨 +耩 +耪 +耰 +耱 +耳 +耵 +耶 +耷 +耸 +耻 +耽 +耿 +聂 +聃 +聆 +聊 +聋 +职 +聍 +聒 +联 +聘 +聚 +聩 +聪 +聱 +聿 +肃 +肄 +肆 +肇 +肉 +肋 +肌 +肓 +肖 +肘 +肚 +肛 +肝 +肟 +肠 +股 +肢 +肤 +肥 +肩 +肪 +肫 +肭 +肮 +肯 +肱 +育 +肴 +肷 +肸 +肺 +肼 +肽 +肾 +肿 +胀 +胁 +胂 +胃 +胄 +胆 +胈 +背 +胍 +胎 +胖 +胗 +胙 +胚 +胛 +胜 +胝 +胞 +胠 +胡 +胣 +胤 +胥 +胧 +胨 +胩 +胪 +胫 +胬 +胭 +胯 +胰 +胱 +胲 +胳 +胴 +胶 +胸 +胺 +胼 +能 +脂 +脆 +脉 +脊 +脍 +脎 +脏 +脐 +脑 +脒 +脓 +脔 +脖 +脘 +脚 +脞 +脟 +脩 +脬 +脯 +脱 +脲 +脶 +脸 +脾 +脿 +腆 +腈 +腊 +腋 +腌 +腐 +腑 +腒 +腓 +腔 +腕 +腘 +腙 +腚 +腠 +腥 +腧 +腨 +腩 +腭 +腮 +腯 +腰 +腱 +腴 +腹 +腺 +腻 +腼 +腽 +腾 +腿 +膀 +膂 +膈 +膊 +膏 +膑 +膘 +膙 +膛 +膜 +膝 +膦 +膨 +膳 +膺 +膻 +臀 +臂 +臃 +臆 +臊 +臌 +臑 +臜 +臣 +臧 +自 +臬 +臭 +至 +致 +臻 +臼 +臾 +舀 +舁 +舂 +舄 +舅 +舆 +舌 +舍 +舐 +舒 +舔 +舛 +舜 +舞 +舟 +舠 +舢 +舣 +舥 +航 +舫 +般 +舭 +舯 +舰 +舱 +舲 +舳 +舴 +舵 +舶 +舷 +舸 +船 +舻 +舾 +艄 +艅 +艇 +艉 +艋 +艎 +艏 +艘 +艚 +艟 +艨 +艮 +良 +艰 +色 +艳 +艴 +艺 +艽 +艾 +艿 +节 +芃 +芄 +芈 +芊 +芋 +芍 +芎 +芏 +芑 +芒 +芗 +芘 +芙 +芜 +芝 +芟 +芠 +芡 +芣 +芤 +芥 +芦 +芨 +芩 +芪 +芫 +芬 +芭 +芮 +芯 +芰 +花 +芳 +芴 +芷 +芸 +芹 +芼 +芽 +芾 +苁 +苄 +苇 +苈 +苉 +苊 +苋 +苌 +苍 +苎 +苏 +苑 +苒 +苓 +苔 +苕 +苗 +苘 +苛 +苜 +苞 +苟 +苠 +苡 +苣 +苤 +若 +苦 +苧 +苫 +苯 +英 +苴 +苷 +苹 +苻 +苾 +茀 +茁 +茂 +范 +茄 +茅 +茆 +茈 +茉 +茋 +茌 +茎 +茏 +茑 +茓 +茔 +茕 +茗 +茚 +茛 +茜 +茝 +茧 +茨 +茫 +茬 +茭 +茯 +茱 +茳 +茴 +茵 +茶 +茸 +茹 +茺 +茼 +茽 +荀 +荁 +荃 +荄 +荆 +荇 +草 +荏 +荐 +荑 +荒 +荓 +荔 +荖 +荙 +荚 +荛 +荜 +荞 +荟 +荠 +荡 +荣 +荤 +荥 +荦 +荧 +荨 +荩 +荪 +荫 +荬 +荭 +荮 +药 +荷 +荸 +荻 +荼 +荽 +莅 +莆 +莉 +莎 +莒 +莓 +莘 +莙 +莛 +莜 +莝 +莞 +莠 +莨 +莩 +莪 +莫 +莰 +莱 +莲 +莳 +莴 +莶 +获 +莸 +莹 +莺 +莼 +莽 +莿 +菀 +菁 +菂 +菅 +菇 +菉 +菊 +菌 +菍 +菏 +菔 +菖 +菘 +菜 +菝 +菟 +菠 +菡 +菥 +菩 +菪 +菰 +菱 +菲 +菹 +菼 +菽 +萁 +萃 +萄 +萆 +萋 +萌 +萍 +萎 +萏 +萑 +萘 +萚 +萜 +萝 +萣 +萤 +营 +萦 +萧 +萨 +萩 +萱 +萳 +萸 +萹 +萼 +落 +葆 +葎 +葑 +葖 +著 +葙 +葚 +葛 +葜 +葡 +董 +葩 +葫 +葬 +葭 +葰 +葱 +葳 +葴 +葵 +葶 +葸 +葺 +蒂 +蒄 +蒇 +蒈 +蒉 +蒋 +蒌 +蒎 +蒐 +蒗 +蒙 +蒜 +蒟 +蒡 +蒨 +蒯 +蒱 +蒲 +蒴 +蒸 +蒹 +蒺 +蒻 +蒽 +蒿 +蓁 +蓂 +蓄 +蓇 +蓉 +蓊 +蓍 +蓏 +蓐 +蓑 +蓓 +蓖 +蓝 +蓟 +蓠 +蓢 +蓣 +蓥 +蓦 +蓬 +蓰 +蓼 +蓿 +蔀 +蔃 +蔈 +蔊 +蔌 +蔑 +蔓 +蔗 +蔚 +蔟 +蔡 +蔫 +蔬 +蔷 +蔸 +蔹 +蔺 +蔻 +蔼 +蔽 +蕃 +蕈 +蕉 +蕊 +蕖 +蕗 +蕙 +蕞 +蕤 +蕨 +蕰 +蕲 +蕴 +蕹 +蕺 +蕻 +蕾 +薁 +薄 +薅 +薇 +薏 +薛 +薜 +薢 +薤 +薨 +薪 +薮 +薯 +薰 +薳 +薷 +薸 +薹 +薿 +藁 +藉 +藏 +藐 +藓 +藕 +藜 +藟 +藠 +藤 +藦 +藨 +藩 +藻 +藿 +蘅 +蘑 +蘖 +蘘 +蘧 +蘩 +蘸 +蘼 +虎 +虏 +虐 +虑 +虒 +虓 +虔 +虚 +虞 +虢 +虤 +虫 +虬 +虮 +虱 +虷 +虸 +虹 +虺 +虻 +虼 +虽 +虾 +虿 +蚀 +蚁 +蚂 +蚄 +蚆 +蚊 +蚋 +蚌 +蚍 +蚓 +蚕 +蚜 +蚝 +蚣 +蚤 +蚧 +蚨 +蚩 +蚪 +蚬 +蚯 +蚰 +蚱 +蚲 +蚴 +蚶 +蚺 +蛀 +蛃 +蛄 +蛆 +蛇 +蛉 +蛊 +蛋 +蛎 +蛏 +蛐 +蛑 +蛔 +蛘 +蛙 +蛛 +蛞 +蛟 +蛤 +蛩 +蛭 +蛮 +蛰 +蛱 +蛲 +蛳 +蛴 +蛸 +蛹 +蛾 +蜀 +蜂 +蜃 +蜇 +蜈 +蜉 +蜊 +蜍 +蜎 +蜐 +蜒 +蜓 +蜕 +蜗 +蜘 +蜚 +蜜 +蜞 +蜡 +蜢 +蜣 +蜥 +蜩 +蜮 +蜱 +蜴 +蜷 +蜻 +蜾 +蜿 +蝇 +蝈 +蝉 +蝌 +蝎 +蝓 +蝗 +蝘 +蝙 +蝠 +蝣 +蝤 +蝥 +蝮 +蝰 +蝲 +蝴 +蝶 +蝻 +蝼 +蝽 +蝾 +螂 +螃 +螅 +螈 +螋 +融 +螗 +螟 +螠 +螣 +螨 +螫 +螬 +螭 +螯 +螱 +螳 +螵 +螺 +螽 +蟀 +蟆 +蟊 +蟋 +蟏 +蟑 +蟒 +蟛 +蟠 +蟥 +蟪 +蟫 +蟮 +蟹 +蟾 +蠃 +蠊 +蠋 +蠓 +蠕 +蠖 +蠡 +蠢 +蠲 +蠹 +蠼 +血 +衃 +衄 +衅 +行 +衍 +衎 +衒 +衔 +街 +衙 +衠 +衡 +衢 +衣 +补 +表 +衩 +衫 +衬 +衮 +衰 +衲 +衷 +衽 +衾 +衿 +袁 +袂 +袄 +袅 +袆 +袈 +袋 +袍 +袒 +袖 +袗 +袜 +袢 +袤 +袪 +被 +袭 +袯 +袱 +袷 +袼 +裁 +裂 +装 +裆 +裈 +裉 +裎 +裒 +裔 +裕 +裘 +裙 +裛 +裟 +裢 +裣 +裤 +裥 +裨 +裰 +裱 +裳 +裴 +裸 +裹 +裼 +裾 +褂 +褊 +褐 +褒 +褓 +褕 +褙 +褚 +褛 +褟 +褡 +褥 +褪 +褫 +褯 +褰 +褴 +褶 +襁 +襄 +襕 +襚 +襜 +襞 +襟 +襦 +襫 +襻 +西 +要 +覃 +覆 +见 +观 +觃 +规 +觅 +视 +觇 +览 +觉 +觊 +觋 +觌 +觎 +觏 +觐 +觑 +角 +觖 +觚 +觜 +觞 +觟 +解 +觥 +触 +觫 +觭 +觯 +觱 +觳 +觿 +言 +訄 +訇 +訚 +訾 +詈 +詟 +詹 +誉 +誊 +誓 +謇 +警 +譬 +计 +订 +讣 +认 +讥 +讦 +讧 +讨 +让 +讪 +讫 +训 +议 +讯 +记 +讱 +讲 +讳 +讴 +讵 +讶 +讷 +许 +讹 +论 +讻 +讼 +讽 +设 +访 +诀 +证 +诂 +诃 +评 +诅 +识 +诇 +诈 +诉 +诊 +诋 +诌 +词 +诎 +诏 +诐 +译 +诒 +诓 +诔 +试 +诖 +诗 +诘 +诙 +诚 +诛 +诜 +话 +诞 +诟 +诠 +诡 +询 +诣 +诤 +该 +详 +诧 +诨 +诩 +诫 +诬 +语 +诮 +误 +诰 +诱 +诲 +诳 +说 +诵 +请 +诸 +诹 +诺 +读 +诼 +诽 +课 +诿 +谀 +谁 +谂 +调 +谄 +谅 +谆 +谇 +谈 +谊 +谋 +谌 +谍 +谎 +谏 +谐 +谑 +谒 +谓 +谔 +谕 +谖 +谗 +谙 +谚 +谛 +谜 +谝 +谞 +谟 +谠 +谡 +谢 +谣 +谤 +谥 +谦 +谧 +谨 +谩 +谪 +谫 +谬 +谭 +谮 +谯 +谰 +谱 +谲 +谳 +谴 +谵 +谶 +谷 +谼 +谿 +豁 +豆 +豇 +豉 +豌 +豕 +豚 +象 +豢 +豨 +豪 +豫 +豮 +豳 +豸 +豹 +豺 +貂 +貅 +貆 +貉 +貊 +貌 +貔 +貘 +贝 +贞 +负 +贡 +财 +责 +贤 +败 +账 +货 +质 +贩 +贪 +贫 +贬 +购 +贮 +贯 +贰 +贱 +贲 +贳 +贴 +贵 +贶 +贷 +贸 +费 +贺 +贻 +贼 +贽 +贾 +贿 +赀 +赁 +赂 +赃 +资 +赅 +赆 +赇 +赈 +赉 +赊 +赋 +赌 +赍 +赎 +赏 +赐 +赑 +赒 +赓 +赔 +赕 +赖 +赗 +赘 +赙 +赚 +赛 +赜 +赝 +赞 +赟 +赠 +赡 +赢 +赣 +赤 +赦 +赧 +赪 +赫 +赭 +走 +赳 +赴 +赵 +赶 +起 +趁 +趄 +超 +越 +趋 +趑 +趔 +趟 +趣 +趯 +趱 +足 +趴 +趵 +趸 +趺 +趼 +趾 +趿 +跂 +跃 +跄 +跆 +跋 +跌 +跎 +跏 +跐 +跑 +跖 +跗 +跚 +跛 +距 +跞 +跟 +跣 +跤 +跨 +跪 +跬 +路 +跱 +跳 +践 +跶 +跷 +跸 +跹 +跺 +跻 +跽 +踅 +踉 +踊 +踌 +踏 +踒 +踔 +踝 +踞 +踟 +踢 +踣 +踦 +踩 +踪 +踬 +踮 +踯 +踱 +踵 +踶 +踹 +踺 +踽 +蹀 +蹁 +蹂 +蹄 +蹅 +蹇 +蹈 +蹉 +蹊 +蹋 +蹐 +蹑 +蹒 +蹙 +蹚 +蹜 +蹢 +蹦 +蹩 +蹬 +蹭 +蹯 +蹰 +蹲 +蹴 +蹶 +蹼 +蹽 +蹾 +蹿 +躁 +躅 +躇 +躏 +躐 +躔 +躜 +躞 +身 +躬 +躯 +躲 +躺 +车 +轧 +轨 +轩 +轪 +轫 +转 +轭 +轮 +软 +轰 +轱 +轲 +轳 +轴 +轵 +轶 +轷 +轸 +轹 +轺 +轻 +轼 +载 +轾 +轿 +辀 +辁 +辂 +较 +辄 +辅 +辆 +辇 +辈 +辉 +辊 +辋 +辌 +辍 +辎 +辏 +辐 +辑 +辒 +输 +辔 +辕 +辖 +辗 +辘 +辙 +辚 +辛 +辜 +辞 +辟 +辣 +辨 +辩 +辫 +辰 +辱 +边 +辽 +达 +辿 +迁 +迂 +迄 +迅 +过 +迈 +迎 +运 +近 +迓 +返 +迕 +还 +这 +进 +远 +违 +连 +迟 +迢 +迤 +迥 +迦 +迨 +迩 +迪 +迫 +迭 +迮 +述 +迳 +迷 +迸 +迹 +迺 +追 +退 +送 +适 +逃 +逄 +逅 +逆 +选 +逊 +逋 +逍 +透 +逐 +逑 +递 +途 +逖 +逗 +通 +逛 +逝 +逞 +速 +造 +逡 +逢 +逦 +逭 +逮 +逯 +逴 +逵 +逶 +逸 +逻 +逼 +逾 +遁 +遂 +遄 +遆 +遇 +遍 +遏 +遐 +遑 +遒 +道 +遗 +遘 +遛 +遢 +遣 +遥 +遨 +遭 +遮 +遴 +遵 +遹 +遽 +避 +邀 +邂 +邃 +邈 +邋 +邑 +邓 +邕 +邗 +邘 +邙 +邛 +邝 +邠 +邡 +邢 +那 +邦 +邨 +邪 +邬 +邮 +邯 +邰 +邱 +邲 +邳 +邴 +邵 +邶 +邸 +邹 +邺 +邻 +邽 +邾 +邿 +郁 +郃 +郄 +郅 +郇 +郈 +郊 +郎 +郏 +郐 +郑 +郓 +郗 +郚 +郛 +郜 +郝 +郡 +郢 +郤 +郦 +郧 +部 +郪 +郫 +郭 +郯 +郴 +郸 +都 +郾 +郿 +鄀 +鄂 +鄃 +鄄 +鄅 +鄌 +鄑 +鄗 +鄘 +鄙 +鄚 +鄜 +鄞 +鄠 +鄢 +鄣 +鄫 +鄯 +鄱 +鄹 +酂 +酃 +酅 +酆 +酉 +酊 +酋 +酌 +配 +酎 +酏 +酐 +酒 +酗 +酚 +酝 +酞 +酡 +酢 +酣 +酤 +酥 +酦 +酩 +酪 +酬 +酮 +酯 +酰 +酱 +酲 +酴 +酵 +酶 +酷 +酸 +酹 +酺 +酽 +酾 +酿 +醅 +醇 +醉 +醋 +醌 +醍 +醐 +醑 +醒 +醚 +醛 +醢 +醨 +醪 +醭 +醮 +醯 +醴 +醵 +醺 +醾 +采 +釉 +释 +里 +重 +野 +量 +釐 +金 +釜 +鉴 +銎 +銮 +鋆 +鋈 +錾 +鍪 +鎏 +鏊 +鏖 +鐾 +鑫 +钆 +钇 +针 +钉 +钊 +钋 +钌 +钍 +钎 +钏 +钐 +钒 +钓 +钔 +钕 +钖 +钗 +钘 +钙 +钚 +钛 +钜 +钝 +钞 +钟 +钠 +钡 +钢 +钣 +钤 +钥 +钦 +钧 +钨 +钩 +钪 +钫 +钬 +钭 +钮 +钯 +钰 +钱 +钲 +钳 +钴 +钵 +钷 +钹 +钺 +钻 +钼 +钽 +钾 +钿 +铀 +铁 +铂 +铃 +铄 +铅 +铆 +铈 +铉 +铊 +铋 +铌 +铍 +铎 +铏 +铐 +铑 +铒 +铕 +铖 +铗 +铘 +铙 +铚 +铛 +铜 +铝 +铞 +铟 +铠 +铡 +铢 +铣 +铤 +铥 +铧 +铨 +铩 +铪 +铫 +铬 +铭 +铮 +铯 +铰 +铱 +铲 +铳 +铴 +铵 +银 +铷 +铸 +铹 +铺 +铻 +铼 +铽 +链 +铿 +销 +锁 +锂 +锃 +锄 +锅 +锆 +锇 +锈 +锉 +锊 +锋 +锌 +锍 +锎 +锏 +锐 +锑 +锒 +锓 +锔 +锕 +锖 +锗 +锘 +错 +锚 +锛 +锜 +锝 +锞 +锟 +锡 +锢 +锣 +锤 +锥 +锦 +锧 +锨 +锩 +锪 +锫 +锬 +锭 +键 +锯 +锰 +锱 +锲 +锳 +锴 +锵 +锶 +锷 +锸 +锹 +锺 +锻 +锼 +锽 +锾 +锿 +镀 +镁 +镂 +镃 +镄 +镅 +镆 +镇 +镈 +镉 +镊 +镋 +镌 +镍 +镎 +镏 +镐 +镑 +镒 +镓 +镔 +镕 +镖 +镗 +镘 +镚 +镛 +镜 +镝 +镞 +镠 +镡 +镢 +镣 +镤 +镥 +镦 +镧 +镨 +镩 +镪 +镫 +镬 +镭 +镮 +镯 +镰 +镱 +镲 +镳 +镴 +镵 +镶 +长 +门 +闩 +闪 +闫 +闭 +问 +闯 +闰 +闱 +闲 +闳 +间 +闵 +闶 +闷 +闸 +闹 +闺 +闻 +闼 +闽 +闾 +闿 +阀 +阁 +阂 +阃 +阄 +阅 +阆 +阇 +阈 +阉 +阊 +阋 +阌 +阍 +阎 +阏 +阐 +阑 +阒 +阔 +阕 +阖 +阗 +阘 +阙 +阚 +阜 +队 +阡 +阪 +阮 +阱 +防 +阳 +阴 +阵 +阶 +阻 +阼 +阽 +阿 +陀 +陂 +附 +际 +陆 +陇 +陈 +陉 +陋 +陌 +降 +陎 +限 +陑 +陔 +陕 +陛 +陞 +陟 +陡 +院 +除 +陧 +陨 +险 +陪 +陬 +陲 +陴 +陵 +陶 +陷 +隃 +隅 +隆 +隈 +隋 +隍 +随 +隐 +隔 +隗 +隘 +隙 +障 +隧 +隩 +隰 +隳 +隶 +隹 +隺 +隼 +隽 +难 +雀 +雁 +雄 +雅 +集 +雇 +雉 +雊 +雌 +雍 +雎 +雏 +雒 +雕 +雠 +雨 +雩 +雪 +雯 +雱 +雳 +零 +雷 +雹 +雾 +需 +霁 +霄 +霅 +霆 +震 +霈 +霉 +霍 +霎 +霏 +霓 +霖 +霜 +霞 +霨 +霪 +霭 +霰 +露 +霸 +霹 +霾 +青 +靓 +靖 +静 +靛 +非 +靠 +靡 +面 +靥 +革 +靬 +靰 +靳 +靴 +靶 +靸 +靺 +靼 +靽 +靿 +鞁 +鞅 +鞋 +鞍 +鞑 +鞒 +鞔 +鞘 +鞠 +鞡 +鞣 +鞧 +鞨 +鞫 +鞬 +鞭 +鞮 +鞯 +鞲 +鞳 +鞴 +韂 +韦 +韧 +韨 +韩 +韪 +韫 +韬 +韭 +音 +韵 +韶 +页 +顶 +顷 +顸 +项 +顺 +须 +顼 +顽 +顾 +顿 +颀 +颁 +颂 +颃 +预 +颅 +领 +颇 +颈 +颉 +颊 +颋 +颌 +颍 +颎 +颏 +颐 +频 +颓 +颔 +颖 +颗 +题 +颙 +颚 +颛 +颜 +额 +颞 +颟 +颠 +颡 +颢 +颤 +颥 +颦 +颧 +风 +飏 +飐 +飑 +飒 +飓 +飔 +飕 +飗 +飘 +飙 +飞 +食 +飧 +飨 +餍 +餐 +餮 +饔 +饕 +饥 +饧 +饨 +饩 +饪 +饫 +饬 +饭 +饮 +饯 +饰 +饱 +饲 +饳 +饴 +饵 +饶 +饷 +饸 +饹 +饺 +饻 +饼 +饽 +饿 +馁 +馃 +馄 +馅 +馆 +馇 +馈 +馉 +馊 +馋 +馌 +馍 +馏 +馐 +馑 +馒 +馓 +馔 +馕 +首 +馗 +馘 +香 +馝 +馞 +馥 +馧 +馨 +马 +驭 +驮 +驯 +驰 +驱 +驲 +驳 +驴 +驵 +驶 +驷 +驸 +驹 +驺 +驻 +驼 +驽 +驾 +驿 +骀 +骁 +骂 +骃 +骄 +骅 +骆 +骇 +骈 +骉 +骊 +骋 +验 +骍 +骎 +骏 +骐 +骑 +骒 +骓 +骕 +骖 +骗 +骘 +骙 +骚 +骛 +骜 +骝 +骞 +骟 +骠 +骡 +骢 +骣 +骤 +骥 +骦 +骧 +骨 +骰 +骱 +骶 +骷 +骸 +骺 +骼 +髀 +髁 +髂 +髃 +髅 +髋 +髌 +髎 +髑 +髓 +高 +髡 +髢 +髦 +髫 +髭 +髯 +髹 +髻 +髽 +鬃 +鬈 +鬏 +鬒 +鬓 +鬘 +鬟 +鬣 +鬯 +鬲 +鬶 +鬷 +鬻 +鬼 +魁 +魂 +魃 +魄 +魅 +魆 +魇 +魈 +魉 +魋 +魍 +魏 +魑 +魔 +鱼 +鱽 +鱾 +鱿 +鲀 +鲁 +鲂 +鲃 +鲅 +鲆 +鲇 +鲈 +鲉 +鲊 +鲋 +鲌 +鲍 +鲎 +鲏 +鲐 +鲑 +鲒 +鲔 +鲕 +鲖 +鲗 +鲘 +鲙 +鲚 +鲛 +鲜 +鲝 +鲞 +鲟 +鲠 +鲡 +鲢 +鲣 +鲤 +鲥 +鲦 +鲧 +鲨 +鲩 +鲪 +鲫 +鲬 +鲭 +鲮 +鲯 +鲰 +鲱 +鲲 +鲳 +鲴 +鲵 +鲷 +鲸 +鲹 +鲺 +鲻 +鲼 +鲽 +鲾 +鲿 +鳀 +鳁 +鳂 +鳃 +鳄 +鳅 +鳇 +鳈 +鳉 +鳊 +鳌 +鳍 +鳎 +鳏 +鳐 +鳑 +鳒 +鳓 +鳔 +鳕 +鳖 +鳗 +鳘 +鳙 +鳚 +鳛 +鳜 +鳝 +鳞 +鳟 +鳠 +鳡 +鳢 +鳣 +鳤 +鸟 +鸠 +鸡 +鸢 +鸣 +鸤 +鸥 +鸦 +鸧 +鸨 +鸩 +鸪 +鸫 +鸬 +鸭 +鸮 +鸯 +鸰 +鸱 +鸲 +鸳 +鸵 +鸶 +鸷 +鸸 +鸹 +鸺 +鸻 +鸼 +鸽 +鸾 +鸿 +鹀 +鹁 +鹂 +鹃 +鹄 +鹅 +鹆 +鹇 +鹈 +鹉 +鹊 +鹋 +鹌 +鹍 +鹎 +鹏 +鹐 +鹑 +鹒 +鹔 +鹕 +鹖 +鹗 +鹘 +鹙 +鹚 +鹛 +鹜 +鹝 +鹞 +鹟 +鹠 +鹡 +鹢 +鹣 +鹤 +鹦 +鹧 +鹨 +鹩 +鹪 +鹫 +鹬 +鹭 +鹮 +鹯 +鹰 +鹱 +鹲 +鹳 +鹴 +鹾 +鹿 +麀 +麂 +麇 +麈 +麋 +麑 +麒 +麓 +麖 +麝 +麟 +麦 +麸 +麹 +麻 +麽 +麾 +黄 +黇 +黉 +黍 +黎 +黏 +黑 +黔 +默 +黛 +黜 +黝 +黟 +黠 +黡 +黢 +黥 +黧 +黩 +黪 +黯 +黹 +黻 +黼 +黾 +鼋 +鼍 +鼎 +鼐 +鼒 +鼓 +鼗 +鼙 +鼠 +鼢 +鼩 +鼫 +鼬 +鼯 +鼱 +鼷 +鼹 +鼻 +鼽 +鼾 +齁 +齇 +齉 +齐 +齑 +齿 +龀 +龁 +龂 +龃 +龄 +龅 +龆 +龇 +龈 +龉 +龊 +龋 +龌 +龙 +龚 +龛 +龟 +龠 +龢 +鿍 +鿎 +鿏 +㑇 +㑊 +㕮 +㘎 +㙍 +㙘 +㙦 +㛃 +㛚 +㛹 +㟃 +㠇 +㠓 +㤘 +㥄 +㧐 +㧑 +㧟 +㫰 +㬊 +㬎 +㬚 +㭎 +㭕 +㮾 +㰀 +㳇 +㳘 +㳚 +㴔 +㵐 +㶲 +㸆 +㸌 +㺄 +㻬 +㽏 +㿠 +䁖 +䂮 +䃅 +䃎 +䅟 +䌹 +䎃 +䎖 +䏝 +䏡 +䏲 +䐃 +䓖 +䓛 +䓨 +䓫 +䓬 +䗖 +䗛 +䗪 +䗴 +䜣 +䝙 +䢺 +䢼 +䣘 +䥽 +䦃 +䲟 +䲠 +䲢 +䴓 +䴔 +䴕 +䴖 +䴗 +䴘 +䴙 +䶮 +𠅤 +𠙶 +𠳐 +𡎚 +𡐓 +𣗋 +𣲗 +𣲘 +𣸣 +𤧛 +𤩽 +𤫉 +𥔲 +𥕢 +𥖨 +𥻗 +𦈡 +𦒍 +𦙶 +𦝼 +𦭜 +𦰡 +𧿹 +𨐈 +𨙸 +𨚕 +𨟠 +𨭉 +𨱇 +𨱏 +𨱑 +𨱔 +𨺙 +𩽾 +𩾃 +𩾌 +𪟝 +𪣻 +𪤗 +𪨰 +𪨶 +𪩘 +𪾢 +𫄧 +𫄨 +𫄷 +𫄸 +𫇭 +𫌀 +𫍣 +𫍯 +𫍲 +𫍽 +𫐄 +𫐐 +𫐓 +𫑡 +𫓧 +𫓯 +𫓶 +𫓹 +𫔍 +𫔎 +𫔶 +𫖮 +𫖯 +𫖳 +𫗧 +𫗴 +𫘜 +𫘝 +𫘦 +𫘧 +𫘨 +𫘪 +𫘬 +𫚕 +𫚖 +𫚭 +𫛭 +𫞩 +𫟅 +𫟦 +𫟹 +𫟼 +𫠆 +𫠊 +𫠜 +𫢸 +𫫇 +𫭟 +𫭢 +𫭼 +𫮃 +𫰛 +𫵷 +𫶇 +𫷷 +𫸩 +𬀩 +𬀪 +𬂩 +𬃊 +𬇕 +𬇙 +𬇹 +𬉼 +𬊈 +𬊤 +𬌗 +𬍛 +𬍡 +𬍤 +𬒈 +𬒔 +𬒗 +𬕂 +𬘓 +𬘘 +𬘡 +𬘩 +𬘫 +𬘬 +𬘭 +𬘯 +𬙂 +𬙊 +𬙋 +𬜬 +𬜯 +𬞟 +𬟁 +𬟽 +𬣙 +𬣞 +𬣡 +𬣳 +𬤇 +𬤊 +𬤝 +𬨂 +𬨎 +𬩽 +𬪩 +𬬩 +𬬭 +𬬮 +𬬱 +𬬸 +𬬹 +𬬻 +𬬿 +𬭁 +𬭊 +𬭎 +𬭚 +𬭛 +𬭤 +𬭩 +𬭬 +𬭯 +𬭳 +𬭶 +𬭸 +𬭼 +𬮱 +𬮿 +𬯀 +𬯎 +𬱖 +𬱟 +𬳵 +𬳶 +𬳽 +𬳿 +𬴂 +𬴃 +𬴊 +𬶋 +𬶍 +𬶏 +𬶐 +𬶟 +𬶠 +𬶨 +𬶭 +𬶮 +𬷕 +𬸘 +𬸚 +𬸣 +𬸦 +𬸪 +𬹼 +𬺈 +𬺓 diff --git a/fun_text_processing/text_normalization/zh/data/char/fullwidth_to_halfwidth.tsv b/fun_text_processing/text_normalization/zh/data/char/fullwidth_to_halfwidth.tsv new file mode 100644 index 0000000..7b3fd04 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/char/fullwidth_to_halfwidth.tsv @@ -0,0 +1,92 @@ +! ! +" " +# # +$ $ +% % +& & +' ' +( ( +) ) +* * ++ + +, , +- - +. . +/ / +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +; ; +< < += = +> > +? ? +@ @ +A A +B B +C C +D D +E E +F F +G G +H H +I I +J J +K K +L L +M M +N N +O O +P P +Q Q +R R +S S +T T +U U +V V +W W +X X +Y Y +Z Z +\ \ +^ ^ +_ _ +` ` +a a +b b +c c +d d +e e +f f +g g +h h +i i +j j +k k +l l +m m +n n +o o +p p +q q +r r +s s +t t +u u +v v +w w +x x +y y +z z +{ { +| | +: : +} } +~ ~ diff --git a/fun_text_processing/text_normalization/zh/data/char/oov_tags.tsv b/fun_text_processing/text_normalization/zh/data/char/oov_tags.tsv new file mode 100644 index 0000000..cd6c56f --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/char/oov_tags.tsv @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/char/punctuations_zh.tsv b/fun_text_processing/text_normalization/zh/data/char/punctuations_zh.tsv new file mode 100644 index 0000000..963b07d --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/char/punctuations_zh.tsv @@ -0,0 +1,72 @@ +! +? +。 +。 +" +# +$ +% +& +' +( +) +* ++ +, +- +/ +: +; +< += +> +@ +[ +\ +] +^ +_ +` +{ +| +} +~ +⦅ +⦆ +「 +」 +、 +、 +〃 +》 +「 +」 +『 +』 +【 +】 +〔 +〕 +〖 +〗 +〘 +〙 +〚 +〛 +〜 +〝 +〞 +〟 +〰 +– +— +‘ +’ +‛ +“ +” +„ +‟ +… +‧ +﹏ diff --git a/fun_text_processing/text_normalization/zh/data/char/upper_to_lower.tsv b/fun_text_processing/text_normalization/zh/data/char/upper_to_lower.tsv new file mode 100644 index 0000000..1b603c5 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/char/upper_to_lower.tsv @@ -0,0 +1,9 @@ +壹 一 +贰 二 +叁 三 +肆 四 +伍 五 +陆 六 +柒 七 +捌 八 +玖 九 diff --git a/fun_text_processing/text_normalization/zh/data/date/__init__.py b/fun_text_processing/text_normalization/zh/data/date/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/date/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/date/year_suffix.tsv b/fun_text_processing/text_normalization/zh/data/date/year_suffix.tsv new file mode 100644 index 0000000..2ae02dd --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/date/year_suffix.tsv @@ -0,0 +1,6 @@ +来 +前 +后 +内 +之后 + diff --git a/fun_text_processing/text_normalization/zh/data/denylist/__init__.py b/fun_text_processing/text_normalization/zh/data/denylist/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/denylist/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/denylist/denylist.tsv b/fun_text_processing/text_normalization/zh/data/denylist/denylist.tsv new file mode 100644 index 0000000..b419181 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/denylist/denylist.tsv @@ -0,0 +1,2 @@ +啊 +呃 \ No newline at end of file diff --git a/fun_text_processing/text_normalization/zh/data/erhua/__init__.py b/fun_text_processing/text_normalization/zh/data/erhua/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/erhua/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/erhua/whitelist.tsv b/fun_text_processing/text_normalization/zh/data/erhua/whitelist.tsv new file mode 100644 index 0000000..f00ae31 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/erhua/whitelist.tsv @@ -0,0 +1,35 @@ +儿女 +儿子 +儿孙 +女儿 +儿媳 +妻儿 +胎儿 +婴儿 +新生儿 +婴幼儿 +幼儿 +少儿 +小儿 +儿歌 +儿童 +儿科 +托儿所 +孤儿 +儿戏 +儿化 +台儿庄 +鹿儿岛 +正儿八经 +吊儿郎当 +生儿育女 +托儿带女 +养儿防老 +痴儿呆女 +佳儿佳妇 +儿怜兽扰 +儿无常父 +儿不嫌母丑 +儿行千里母担忧 +儿大不由爷 +苏乞儿 diff --git a/fun_text_processing/text_normalization/zh/data/math/__init__.py b/fun_text_processing/text_normalization/zh/data/math/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/math/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/math/score.tsv b/fun_text_processing/text_normalization/zh/data/math/score.tsv new file mode 100644 index 0000000..0647248 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/math/score.tsv @@ -0,0 +1,2 @@ +: 比 +: 比 diff --git a/fun_text_processing/text_normalization/zh/data/math/symbol.tsv b/fun_text_processing/text_normalization/zh/data/math/symbol.tsv new file mode 100644 index 0000000..7f16f52 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/math/symbol.tsv @@ -0,0 +1,7 @@ ++ 加 +~ 到 +± 正负 += 等于 +× 乘 +÷ 除 +° 度 diff --git a/fun_text_processing/text_normalization/zh/data/measure/__init__.py b/fun_text_processing/text_normalization/zh/data/measure/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/measure/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/measure/units_en.tsv b/fun_text_processing/text_normalization/zh/data/measure/units_en.tsv new file mode 100644 index 0000000..09c62fb --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/measure/units_en.tsv @@ -0,0 +1,90 @@ +amu 原子质量 +bar 巴 +° 度 +º 度 +°c 摄氏度 +°C 摄氏度 +ºc 摄氏度 +ºC 摄氏度 +℃ 摄氏度 +cm2 平方厘米 +cm² 平方厘米 +cm3 立方厘米 +cm³ 立方厘米 +cm 厘米 +cwt 美担 +db 分贝 +dm3 立方分米 +dm³ 立方分米 +dm 分米 +ds 毫秒 +°f 华氏度 +°F 华氏度 +℉ 华氏度 +ft 英尺 +ghz 吉赫兹 +gw 吉瓦 +gwh 吉瓦时 +hz 赫兹 +kbps 千比特每秒 +kcal 千卡 +kgf 千克力 +kg 千克 +khz 千赫兹 +km2 平方千米 +km² 平方千米 +km 千米 +kpa 千帕 +kwh 千瓦时 +kw 千瓦 +kW 千瓦 +lb 磅 +lbs 磅 +m2 平方米 +m² 平方米 +m3 立方米 +m³ 立方米 +mbps 兆比特每秒 +mg 毫克 +mhz 兆赫兹 +mi2 平方英里 +mi² 平方英里 +mi 英里 +min 分钟哦 +ml 毫升 +mm2 平方毫米 +mm² 平方毫米 +mol 摩尔 +mpa 兆帕 +mph 英里每小时 +ng 纳克 +nm 纳米 +ns 纳秒 +oz 盎司 +pa 帕斯卡 +rad 弧度 +rpm 转每分 +sq ft 平方英尺 +sq mi 平方英里 +sv 系沃特 +tb 太字节 +tj 万亿焦耳 +tl 台两 +v 伏特 +yd 码 +μg 微克 +μm 微米 +μs 微秒 +ω 欧米茄 +gb 吉字节 +gpa 吉帕斯卡 +gy 戈瑞 +ha 公顷 +m 米 +mm 毫米 +ms 毫秒 +mv 毫伏 +mw 毫瓦 +pg 皮克 +ps 皮秒 +s 秒 diff --git a/fun_text_processing/text_normalization/zh/data/measure/units_zh.tsv b/fun_text_processing/text_normalization/zh/data/measure/units_zh.tsv new file mode 100644 index 0000000..5ca1dd9 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/measure/units_zh.tsv @@ -0,0 +1,211 @@ +匹 +张 +座 +回 +场 +尾 +条 +个 +首 +阙 +阵 +网 +炮 +顶 +丘 +棵 +只 +支 +袭 +辆 +挑 +担 +颗 +壳 +窠 +曲 +墙 +群 +腔 +砣 +座 +客 +贯 +扎 +捆 +刀 +令 +打 +手 +罗 +坡 +山 +岭 +江 +溪 +钟 +队 +单 +双 +对 +口 +头 +脚 +板 +跳 +枝 +件 +贴 +针 +线 +管 +名 +位 +身 +堂 +课 +本 +页 +家 +户 +层 +丝 +毫 +厘 +分 +钱 +两 +斤 +担 +铢 +石 +钧 +锱 +忽 +克 +毫 +厘 +分 +寸 +尺 +丈 +里 +寻 +常 +铺 +程 +米 +撮 +勺 +合 +升 +斗 +石 +盘 +碗 +碟 +叠 +桶 +笼 +盆 +盒 +杯 +钟 +斛 +锅 +簋 +篮 +盘 +桶 +罐 +瓶 +壶 +卮 +盏 +箩 +箱 +煲 +啖 +袋 +钵 +年 +月 +日 +季 +刻 +时 +周 +天 +秒 +分 +旬 +纪 +岁 +世 +更 +夜 +春 +夏 +秋 +冬 +代 +伏 +辈 +丸 +泡 +粒 +颗 +幢 +堆 +条 +根 +支 +道 +面 +片 +张 +颗 +块 +架 +千米 +分米 +厘米 +毫米 +微米 +纳米 +亿 +千万 +百万 +万 +千 +百 +亿块 +千万块 +百万块 +万块 +千块 +百块 +亿角 +千万角 +百万角 +万角 +千角 +百角 +亿毛 +千万毛 +百万毛 +万毛 +千毛 +百毛 +亿分 +千万分 +百万分 +万分 +千分 +百分 +亿元 +千万元 +百万元 +万元 +千元 +百元 diff --git a/fun_text_processing/text_normalization/zh/data/money/__init__.py b/fun_text_processing/text_normalization/zh/data/money/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/money/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/money/currency_code.tsv b/fun_text_processing/text_normalization/zh/data/money/currency_code.tsv new file mode 100644 index 0000000..238c01b --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/money/currency_code.tsv @@ -0,0 +1,117 @@ +ALL 阿尔巴尼亚列克 +AFN 阿富汗 阿富汗尼 +ARS 阿根廷比索 +AWG 阿鲁巴盾 +AUD 澳元 +AZN 阿塞拜疆马纳特 +BSD 巴哈马元 +BBD 巴巴多斯元 +BYN 白俄罗斯卢布 +BZD 伯利兹元 +BMD 百慕大元 +BOB 玻利维亚玻利维亚诺 +BAM 波斯尼亚和黑塞哥维那可兑换马克 +BWP 博茨瓦纳普拉 +BGN 保加利亚列弗 +BRL 巴西雷亚尔 +BND 文莱达鲁萨兰国元 +KHR 柬埔寨瑞尔 +CAD 加元 +KYD 开曼群岛元 +CLP 智利比索 +CNY 人民币 +COP 哥伦比亚比索 +CRC 哥斯达黎加科隆 +HRK 克罗地亚库纳 +CUP 古巴比索 +CZK 捷克克朗 +DKK 丹麦克朗 +DOP 多米尼加共和国比索 +XCD 东加勒比元 +EGP 埃及镑 +SVC 萨尔瓦多科隆 +EUR 欧元成员国 +FKP 福克兰群岛(马尔维纳斯)镑 +FJD 斐济元 +GHS 加纳塞地 +GIP 直布罗陀镑 +GTQ 危地马拉格查尔 +GGP 根西岛镑 +GYD 圭亚那元 +HNL 洪都拉斯伦皮拉 +HKD 港元 +HUF 匈牙利福林 +ISK 冰岛克朗 +INR 印度卢比 +IDR 印尼盾 +IRR 伊朗里亚尔 +IMP 马恩岛英镑 +ILS 以色列谢克尔 +JMD 牙买加元 +JPY 日元 +JEP 泽西镑 +KZT 哈萨克斯坦腾格 +KPW 朝鲜园 +KRW 韩元 +KGS 吉尔吉斯斯坦索姆 +LAK 老挝基普 +LBP 黎巴嫩镑 +LRD 利比里亚元 +MKD 马其顿代纳尔 +MYR 马来西亚令吉 +MUR 毛里求斯卢比 +MXN 墨西哥比索 +MNT 蒙古图格里克 +MNT 摩洛哥迪拉姆 +MZN 莫桑比克梅蒂卡尔 +NAD 纳米比亚元 +NPR 尼泊尔卢比 +ANG 荷属安的列斯盾 +NZD 新西兰元 +NIO 尼加拉瓜科尔多瓦 +NGN 尼日利亚奈拉 +NOK 挪威克朗 +OMR 阿曼里亚尔 +PKR 巴基斯坦卢比 +PAB 巴拿马巴尔博亚 +PYG 巴拉圭瓜拉尼 +PEN 秘鲁索尔 +PHP 菲律宾比索 +PLN 波兰兹罗提 +QAR 卡塔尔里亚尔 +RON 罗马尼亚列伊 +RUB 俄罗斯卢布 +SHP 圣赫勒拿镑 +SAR 沙特阿拉伯里亚尔 +RSD 塞尔维亚第纳尔 +SCR 塞舌尔卢比 +SGD 新加坡元 +SBD 所罗门群岛元 +SOS 索马里先令 +KRW 韩元 +ZAR 南非兰特 +LKR 斯里兰卡卢比 +SEK 瑞典克朗 +CHF 瑞士法郎 +SRD 苏里南元 +SYP 叙利亚镑 +TWD 新台币 +THB 泰铢 +TTD 特立尼达和多巴哥元 +TRY 土耳其里拉 +TVD 图瓦卢元 +UAH 乌克兰格里夫纳 +AED 阿联酋迪拉姆 +GBP 英镑 +USD 美元 +UYU 乌拉圭比索 +UZS 乌兹别克斯坦索姆 +VEF 委内瑞拉玻利瓦尔 +VND 越南东 +YER 也门里亚尔 +ZWD 津巴布韦元 +J¥ 日元 +JPY¥ 日元 +HK$ 港元 +A$ 澳元 +CAD$ 加元 diff --git a/fun_text_processing/text_normalization/zh/data/money/currency_symbol.tsv b/fun_text_processing/text_normalization/zh/data/money/currency_symbol.tsv new file mode 100644 index 0000000..18e2af4 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/money/currency_symbol.tsv @@ -0,0 +1,63 @@ +Lek 阿尔巴尼亚列克 +ƒ 阿鲁巴盾 +Br 白俄罗斯卢布 +BZ$ 伯利兹元 +$b 玻利维亚玻利维亚诺 +KM 波斯尼亚和黑塞哥维那可兑换马克 +P 博茨瓦纳普拉 +лв 保加利亚列弗 +R$ 巴西雷亚尔 +៛ 柬埔寨瑞尔 +¥ 人民币 +₡ 哥斯达黎加科隆 +kn 克罗地亚库纳 +₱ 古巴比索 +Kč 捷克克朗 +kr 丹麦克朗 +RD$ 多米尼加共和国比索 +€ 欧元 +¢ 加纳塞地 +Q 危地马拉格查尔 +L 洪都拉斯伦皮拉 +Ft 匈牙利福林 +₹ 印度卢比 +Rp 印尼盾 +£ 英镑 +£ 英镑 +₪ 以色列谢克尔 +J$ 牙买加元 +лв 哈萨克斯坦腾格 +₩ 朝鲜园 +лв 吉尔吉斯斯坦索姆 +₭ 老挝基普 +ден 马其顿代纳尔 +RM 马来西亚令吉 +₨ 毛里求斯卢比 +₮ 蒙古图格里克 +MT 莫桑比克梅蒂卡尔 +C$ 尼加拉瓜科尔多瓦 +₦ 尼日利亚奈拉 +₨ 巴基斯坦卢比 +B/. 巴拿马巴尔博亚 +Gs 巴拉圭瓜拉尼 +S/. 秘鲁索尔 +₱ 菲律宾比索 +zł 波兰兹罗提 +lei 罗马尼亚列伊 +₽ 卢布 +Дин. 塞尔维亚第纳尔 +S 索马里先令 +R 南非兰特 +CHF 瑞士法郎 +NT$ 新台币 +฿ 泰铢 +TT$ 特立尼达和多巴哥元 +₺ 土耳其里拉 +₴ 乌克兰格里夫纳 +$ 美元 +$U 乌拉圭比索 +лв 乌兹别克斯坦索姆 +Bs 委内瑞拉玻利瓦尔 +₫ 越南东 +Z$ 津巴布韦元 +¥ 人民币 diff --git a/fun_text_processing/text_normalization/zh/data/number/__init__.py b/fun_text_processing/text_normalization/zh/data/number/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/number/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/number/digit.tsv b/fun_text_processing/text_normalization/zh/data/number/digit.tsv new file mode 100644 index 0000000..3a578d3 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/number/digit.tsv @@ -0,0 +1,9 @@ +1 一 +2 二 +3 三 +4 四 +5 五 +6 六 +7 七 +8 八 +9 九 diff --git a/fun_text_processing/text_normalization/zh/data/number/digit_teen.tsv b/fun_text_processing/text_normalization/zh/data/number/digit_teen.tsv new file mode 100644 index 0000000..04c85dd --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/number/digit_teen.tsv @@ -0,0 +1,9 @@ +1 +2 二 +3 三 +4 四 +5 五 +6 六 +7 七 +8 八 +9 九 diff --git a/fun_text_processing/text_normalization/zh/data/number/sign.tsv b/fun_text_processing/text_normalization/zh/data/number/sign.tsv new file mode 100644 index 0000000..645adbd --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/number/sign.tsv @@ -0,0 +1,2 @@ +- 负 ++ 正 diff --git a/fun_text_processing/text_normalization/zh/data/number/zero.tsv b/fun_text_processing/text_normalization/zh/data/number/zero.tsv new file mode 100644 index 0000000..d6b9cec --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/number/zero.tsv @@ -0,0 +1 @@ +0 零 diff --git a/fun_text_processing/text_normalization/zh/data/time/__init__.py b/fun_text_processing/text_normalization/zh/data/time/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/time/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/time/digit.tsv b/fun_text_processing/text_normalization/zh/data/time/digit.tsv new file mode 100644 index 0000000..c0ce4d7 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/time/digit.tsv @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 + diff --git a/fun_text_processing/text_normalization/zh/data/time/hour.tsv b/fun_text_processing/text_normalization/zh/data/time/hour.tsv new file mode 100644 index 0000000..7ed2844 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/time/hour.tsv @@ -0,0 +1,24 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 diff --git a/fun_text_processing/text_normalization/zh/data/time/suffix.tsv b/fun_text_processing/text_normalization/zh/data/time/suffix.tsv new file mode 100644 index 0000000..68ced35 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/time/suffix.tsv @@ -0,0 +1,10 @@ +am 上午 +a.m. 上午 +a m 上午 +AM 上午 +A M 上午 +pm 下午 +p.m. 下午 +p m 下午 +P M 下午 +PM 下午 diff --git a/fun_text_processing/text_normalization/zh/data/time/tens.tsv b/fun_text_processing/text_normalization/zh/data/time/tens.tsv new file mode 100644 index 0000000..09c277a --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/time/tens.tsv @@ -0,0 +1,7 @@ +0 +1 +2 +3 +4 +5 +6 diff --git a/fun_text_processing/text_normalization/zh/data/time/zero.tsv b/fun_text_processing/text_normalization/zh/data/time/zero.tsv new file mode 100644 index 0000000..573541a --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/time/zero.tsv @@ -0,0 +1 @@ +0 diff --git a/fun_text_processing/text_normalization/zh/data/whitelist/__init__.py b/fun_text_processing/text_normalization/zh/data/whitelist/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/whitelist/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/data/whitelist/default.tsv b/fun_text_processing/text_normalization/zh/data/whitelist/default.tsv new file mode 100644 index 0000000..fd7b54d --- /dev/null +++ b/fun_text_processing/text_normalization/zh/data/whitelist/default.tsv @@ -0,0 +1,79 @@ +O 2 O O to O +O2O O to O +P 2 P P to P +P2P P to P +CD C D +a.m. AM +am. AM +A M AM +Am AM + am AM +p.m. PM +pm. PM +Pm PM + pm PM +atm ATM +A T M ATM +Atm ATM +ufo UFO +Ufo UFO +U F O UFO +u f o UFO +m v MV +mv MV +MV MV +F I F A fifa +f i f a fifa +FIFA fifa +nba NBA +Nba NBA +NBA NBA +n b a NBA +x L XL +X L XL +x x L XXL +X X L XXL +x x x L XXXL +X X X L XXXL +Q Q QQ +qq QQ +Qq QQ +gpu GPU +GPU GPU +cpu CPU +C P U CPU +WIFI wifi +ms MS +ceo CEO +c e o CEO +C E O CEO +dv DV +d v DV +D V DV +wto WTO +w t o WTO +W T O WTO +pc PC +p c PC +P C PC +gps GPS +G P S GPS +M.V.P MVP +mvp MVP +M V P MVP +vip VIP +V I P VIP +cba CBA +c b a CBA +CBA CBA +mba MBA +m b a MBA +M B A MBA +iq IQ +IQ IQ +EQ EQ +cctv CCTV +C C t v CCTV +kfc KFC +K F C KFC +Steam steam diff --git a/fun_text_processing/text_normalization/zh/graph_utils.py b/fun_text_processing/text_normalization/zh/graph_utils.py new file mode 100644 index 0000000..6664de5 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/graph_utils.py @@ -0,0 +1,117 @@ +import os +import string +from pathlib import Path +from typing import Dict + +import pynini +from pynini import Far +from pynini.export import export +from pynini.lib import byte, pynutil, utf8 + +FUN_CHAR = utf8.VALID_UTF8_CHAR + +FUN_DIGIT = byte.DIGIT +FUN_LOWER = pynini.union(*string.ascii_lowercase).optimize() +FUN_UPPER = pynini.union(*string.ascii_uppercase).optimize() +FUN_ALPHA = pynini.union(FUN_LOWER, FUN_UPPER).optimize() + +FUN_SPACE = " " +FUN_WHITE_SPACE = pynini.union(" ", "\t", "\n", "\r", "\u00A0").optimize() +FUN_NOT_SPACE = pynini.difference(FUN_CHAR, FUN_WHITE_SPACE).optimize() +FUN_NOT_QUOTE = pynini.difference(FUN_CHAR, r'"').optimize() + +FUN_PUNCT = pynini.union(*map(pynini.escape, string.punctuation)).optimize() + + +FUN_SIGMA = pynini.closure(FUN_CHAR) + +delete_space = pynutil.delete(pynini.closure(FUN_WHITE_SPACE)) +delete_zero_or_one_space = pynutil.delete(pynini.closure(FUN_WHITE_SPACE, 0, 1)) +insert_space = pynutil.insert(" ") +delete_extra_space = pynini.cross(pynini.closure(FUN_WHITE_SPACE, 1), " ") + + +def generator_main(file_name: str, graphs: Dict[str, "pynini.FstLike"]): + """ + Exports graph as OpenFst finite state archive (FAR) file with given file name and rule name. + + Args: + file_name: exported file name + graphs: Mapping of a rule name and Pynini WFST graph to be exported + """ + exporter = export.Exporter(file_name) + for rule, graph in graphs.items(): + exporter[rule] = graph.optimize() + exporter.close() + print(f"Created {file_name}") + + +class GraphFst: + """ + Base class for all grammar fsts. + + Args: + name: name of grammar class + kind: either 'classify' or 'verbalize' + deterministic: if True will provide a single transduction option, + for False multiple transduction are generated (used for audio-based normalization) + """ + + def __init__(self, name: str, kind: str, deterministic: bool = True): + self.name = name + self.kind = kind + self._fst = None + self.deterministic = deterministic + + self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far") + if self.far_exist(): + self._fst = Far( + self.far_path, mode="r", arc_type="standard", far_type="default" + ).get_fst() + + def far_exist(self) -> bool: + """ + Returns true if FAR can be loaded + """ + return self.far_path.exists() + + @property + def fst(self) -> "pynini.FstLike": + return self._fst + + @fst.setter + def fst(self, fst): + self._fst = fst + + def add_tokens(self, fst) -> "pynini.FstLike": + """ + Wraps class name around to given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + return pynutil.insert(f"{self.name} {{ ") + fst + pynutil.insert(" }") + + def delete_tokens(self, fst) -> "pynini.FstLike": + """ + Deletes class name wrap around output of given fst + + Args: + fst: input fst + + Returns: + Fst: fst + """ + res = ( + pynutil.delete(f"{self.name}") + + delete_space + + pynutil.delete("{") + + delete_space + + fst + + delete_space + + pynutil.delete("}") + ) + return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", FUN_SIGMA) diff --git a/fun_text_processing/text_normalization/zh/taggers/__init__.py b/fun_text_processing/text_normalization/zh/taggers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/taggers/cardinal.py b/fun_text_processing/text_normalization/zh/taggers/cardinal.py new file mode 100644 index 0000000..d30bf10 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/cardinal.py @@ -0,0 +1,119 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst +from fun_text_processing.text_normalization.zh.utils import ( + UNIT_1e01, + UNIT_1e02, + UNIT_1e03, + UNIT_1e04, + get_abs_path, +) +from pynini.lib import pynutil + + +class Cardinal(GraphFst): + """ + self.graph_cardinal: + 5 -> 五 + 12 -> 十二 + 213 -> 二百一十三 + 3123 -> 三千一百二十三 + 51234 -> 五万一千二百三十四 + 51,234 -> 五万一千二百三十四 + 0.125 -> 零点一二五 + self.fst: + 123 -> cardinal{ integer: "一二三" } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="cardinal", kind="classify", deterministic=deterministic) + # base cardinal from digit to chinese + graph_digit = pynini.string_file(get_abs_path("data/number/digit.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/number/zero.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/number/digit_teen.tsv")) + graph_sign = pynini.string_file(get_abs_path("data/number/sign.tsv")) + + graph_digit_with_zero = graph_digit | graph_zero # from 0(read out) to 9 + graph_no_zero = pynini.cross("0", "") # cardinalzero,in some case we don't read it out + graph_digit_no_zero = graph_digit | graph_no_zero # from 0(not read out) to 9 + insert_zero = pynutil.insert("零") + delete_punct = pynutil.delete(",") # to deal with 5,000,cardinalin english form + + # 15 in 215 + graph_ten_u = (graph_digit + pynutil.insert(UNIT_1e01) + graph_digit_no_zero) | ( + graph_zero + graph_digit + ) + # 15 only + graph_ten = (graph_teen + pynutil.insert(UNIT_1e01) + graph_digit_no_zero) | ( + graph_zero + graph_digit + ) + # 215 or 200 + graph_hundred = (graph_digit + pynutil.insert(UNIT_1e02) + graph_ten_u) | ( + graph_digit + pynutil.insert(UNIT_1e02) + graph_no_zero**2 + ) + # 3000 or 3002 or 3012 or 3123 + # both with 3,000 or 3,002 or 3,012 or 3,123 + graph_thousand_sign = ( + (graph_digit + pynutil.insert(UNIT_1e03) + delete_punct + graph_hundred) + | ( + graph_digit + + pynutil.insert(UNIT_1e03) + + delete_punct.ques + + graph_zero + + graph_digit + + pynutil.insert(UNIT_1e01) + + graph_digit_no_zero + ) + | ( + graph_digit + + pynutil.insert(UNIT_1e03) + + delete_punct.ques + + graph_zero + + graph_no_zero + + graph_digit + ) + | (graph_digit + pynutil.insert(UNIT_1e03) + delete_punct.ques + graph_no_zero**3) + ) + # 20001234 or 2001234 or 201234 or 21234 or 20234 or 20023 or 20002 or 20000 + # 8 digits max supported,for 9 digits cardinal,often write with unit instead of read it in only cardinalform + graph_ten_thousand_sign = ( + (graph_thousand_sign | graph_hundred | graph_ten | graph_digit_no_zero) + + pynutil.insert(UNIT_1e04) + + ( + graph_thousand_sign + | (graph_no_zero + delete_punct.ques + insert_zero + graph_hundred) + | ( + graph_no_zero + + delete_punct.ques + + graph_no_zero + + insert_zero + + (graph_digit + pynutil.insert(UNIT_1e01) + graph_digit_no_zero) + ) + | (graph_no_zero + delete_punct.ques + graph_no_zero**2 + insert_zero + graph_digit) + | (graph_no_zero**4) + ) + ) + + # cardinalstring like 123 or 123.456,used in phone cardinal,ID cardinal,etc. + graph_numstring = pynini.closure(graph_digit_with_zero, 1) | ( + pynini.closure(graph_digit_with_zero, 1) + + pynini.cross(".", "点") + + pynini.closure(graph_digit_with_zero, 1) + ) + + graph = ( + graph_hundred + | graph_ten + | graph_digit_with_zero + | graph_thousand_sign + | graph_ten_thousand_sign + ) + # 456.123 + graph_decimal = graph + pynini.cross(".", "点") + pynini.closure(graph_digit_with_zero, 1) + graph_cardinal = graph | graph_decimal + signed_cardinal = graph_sign + graph_cardinal + self.graph_cardinal = (graph_cardinal | signed_cardinal).optimize() + + graph_numstring = self.add_tokens( + pynutil.insert('integer: "') + graph_numstring + pynutil.insert('"') + ) + self.fst = graph_numstring.optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/char.py b/fun_text_processing/text_normalization/zh/taggers/char.py new file mode 100644 index 0000000..20bd2e2 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/char.py @@ -0,0 +1,14 @@ +from fun_text_processing.text_normalization.zh.graph_utils import FUN_CHAR, GraphFst +from pynini.lib import pynutil + + +class Char(GraphFst): + """ + 你 -> char { name: "你" } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="char", kind="classify", deterministic=deterministic) + + graph = pynutil.insert('name: "') + FUN_CHAR + pynutil.insert('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/date.py b/fun_text_processing/text_normalization/zh/taggers/date.py new file mode 100644 index 0000000..56f5672 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/date.py @@ -0,0 +1,97 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import ( + FUN_CHAR, + FUN_DIGIT, + GraphFst, + insert_space, +) +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil + + +class Date(GraphFst): + """ + 2002年 -> tokens { date { year: "2002" } } + 2002-01-28 -> tokens { date { year: "2002" month: "01" day: "28"} } + 2002/01/28 -> tokens { date { year: "2002" month: "01" day: "28"} } + 2002.01.28 -> tokens { date { year: "2002" month: "01" day: "28"} } + 2002/02 -> tokens { date { year: "2002" month "02"} } + 02/11 -> tokens { date { year: "02" month "11"} } different with case "fraction 2/11" + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="date", kind="classify", deterministic=deterministic) + graph_digit = pynini.string_file(get_abs_path("data/number/digit.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/number/zero.tsv")) + year_whitelist = pynini.string_file(get_abs_path("data/date/year_suffix.tsv")) + + delete_date_sign = pynutil.delete("/") | pynutil.delete("-") | pynutil.delete(".") + + # 2012年 + date_type0 = ( + pynutil.insert('year: "') + + pynini.closure(graph_digit | graph_zero, 2, 4) + + "年" + + pynini.difference(FUN_CHAR, year_whitelist) + + pynutil.insert('"') + ) + + year_2_4_digit = pynini.closure(FUN_DIGIT, 2, 4) + delete_date_sign + year_4_digit = pynini.closure(FUN_DIGIT, 4, 4) + delete_date_sign + year_2_digit_with_zero = "0" + FUN_DIGIT + delete_date_sign + month_no_day_with_zero = "0" + FUN_DIGIT + month_no_day = pynini.closure(FUN_DIGIT, 2, 2) + month = pynini.closure(FUN_DIGIT, 1, 2) + delete_date_sign + day = pynini.closure(FUN_DIGIT, 1, 2) + + # 2012/01/28 + date_type1 = ( + pynutil.insert('year: "') + + year_2_4_digit + + pynutil.insert('"') + + insert_space + + pynutil.insert('month: "') + + month + + pynutil.insert('"') + + insert_space + + pynutil.insert('day: "') + + day + + pynutil.insert('"') + ) + + # 12/01 + date_type2 = ( + pynutil.insert('year: "') + + year_2_4_digit + + pynutil.insert('"') + + insert_space + + pynutil.insert('month: "') + + month_no_day_with_zero + + pynutil.insert('"') + ) + + # 2012/11 + date_type3 = ( + pynutil.insert('year: "') + + year_4_digit + + pynutil.insert('"') + + insert_space + + pynutil.insert('month: "') + + month_no_day + + pynutil.insert('"') + ) + + # 02/05 + date_type4 = ( + pynutil.insert('year: "') + + year_2_digit_with_zero + + pynutil.insert('"') + + insert_space + + pynutil.insert('month: "') + + month_no_day + + pynutil.insert('"') + ) + # add your date type as date_typex here. + graph = date_type0 | date_type1 | date_type2 | date_type3 | date_type4 + + self.fst = self.add_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/fraction.py b/fun_text_processing/text_normalization/zh/taggers/fraction.py new file mode 100644 index 0000000..2eb6998 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/fraction.py @@ -0,0 +1,26 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import FUN_DIGIT, GraphFst, insert_space +from pynini.lib import pynutil + + +class Fraction(GraphFst): + """ + 1/5 -> tokens { fraction { numerator: "1" denominator: "5" } } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="fraction", kind="classify", deterministic=deterministic) + + numerator = pynini.closure(FUN_DIGIT, 1) + pynutil.delete("/") + denominator = pynini.closure(FUN_DIGIT, 1) + graph = ( + pynutil.insert('numerator: "') + + numerator + + pynutil.insert('"') + + insert_space + + pynutil.insert('denominator: "') + + denominator + + pynutil.insert('"') + ) + + self.fst = self.add_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/math_symbol.py b/fun_text_processing/text_normalization/zh/taggers/math_symbol.py new file mode 100644 index 0000000..7ca7d52 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/math_symbol.py @@ -0,0 +1,28 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst +from fun_text_processing.text_normalization.zh.taggers.cardinal import Cardinal +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil + + +class MathSymbol(GraphFst): + """ + + -> tokens { sign: "加" } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="sign", kind="classify", deterministic=deterministic) + """ + add your sign in data/math/symbol.tsv,this graph just convert sigh to character,you can add more + cases with detailed cases + """ + score_sign = pynini.string_file(get_abs_path("data/math/score.tsv")) + score = ( + pynutil.insert('score: "') + + Cardinal().graph_cardinal + + score_sign + + Cardinal().graph_cardinal + + pynutil.insert('"') + ) + graph = score + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/measure.py b/fun_text_processing/text_normalization/zh/taggers/measure.py new file mode 100644 index 0000000..eb1de50 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/measure.py @@ -0,0 +1,39 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst, insert_space +from fun_text_processing.text_normalization.zh.taggers.cardinal import Cardinal +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil + + +class Measure(GraphFst): + """ + 1kg -> tokens { measure { cardinal { integer: "一" } units: "千克" } } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="measure", kind="classify", deterministic=deterministic) + + units_en = pynini.string_file(get_abs_path("data/measure/units_en.tsv")) + units_zh = pynini.string_file(get_abs_path("data/measure/units_zh.tsv")) + graph = ( + pynutil.insert("cardinal { ") + + pynutil.insert('integer: "') + + Cardinal().graph_cardinal + + pynutil.insert('"') + + pynutil.insert(" }") + + insert_space + + pynutil.insert('units: "') + + (units_en | units_zh) + + pynutil.insert('"') + ) + percent_graph = ( + pynutil.insert("decimal { ") + + pynutil.insert('integer_part: "') + + Cardinal().graph_cardinal + + pynutil.delete("%") + + pynutil.insert('"') + + pynutil.insert(" }") + ) + graph |= percent_graph + + self.fst = self.add_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/money.py b/fun_text_processing/text_normalization/zh/taggers/money.py new file mode 100644 index 0000000..beaf132 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/money.py @@ -0,0 +1,28 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst, insert_space +from fun_text_processing.text_normalization.zh.taggers.cardinal import Cardinal +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil + + +class Money(GraphFst): + """ + ¥1.25 -> tokens { money { fractional_part: "元" integer_part: "一点五" } } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="money", kind="classify", deterministic=deterministic) + + currency_code = pynini.string_file(get_abs_path("data/money/currency_code.tsv")) + currency_symbol = pynini.string_file(get_abs_path("data/money/currency_symbol.tsv")) + graph = ( + pynutil.insert('fractional_part: "') + + (currency_code | currency_symbol) + + pynutil.insert('"') + + insert_space + + pynutil.insert('integer_part: "') + + Cardinal().graph_cardinal + + pynutil.insert('"') + ) + + self.fst = self.add_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/preprocessor.py b/fun_text_processing/text_normalization/zh/taggers/preprocessor.py new file mode 100644 index 0000000..2e00745 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/preprocessor.py @@ -0,0 +1,39 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import FUN_SIGMA, GraphFst +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil + + +class PreProcessor(GraphFst): + """ + Preprocessing of TN: + 1. interjections removal such as '啊, 呃' + 2. fullwidth -> halfwidth char conversion + 好啊 -> 好 + 呃对 -> 对 + : -> : + ; -> ; + """ + + def __init__( + self, + remove_interjections: bool = True, + fullwidth_to_halfwidth: bool = True, + ): + super().__init__(name="PreProcessor", kind="processor") + + graph = pynini.cdrewrite("", "", "", FUN_SIGMA) + + if remove_interjections: + remove_interjections_graph = pynutil.delete( + pynini.string_file(get_abs_path("data/denylist/denylist.tsv")) + ) + graph @= pynini.cdrewrite(remove_interjections_graph, "", "", FUN_SIGMA) + + if fullwidth_to_halfwidth: + fullwidth_to_halfwidth_graph = pynini.string_file( + get_abs_path("data/char/fullwidth_to_halfwidth.tsv") + ) + graph @= pynini.cdrewrite(fullwidth_to_halfwidth_graph, "", "", FUN_SIGMA) + + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/time.py b/fun_text_processing/text_normalization/zh/taggers/time.py new file mode 100644 index 0000000..d5ee7ef --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/time.py @@ -0,0 +1,60 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst, insert_space +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil + + +class Time(GraphFst): + """ + 1:02 -> tokens { time { hours: "1" minitus: "02" } } + 1:02:36 -> tokens { time { hours: "1" minutes: "02" seconds: "36" } } + 1:02 am -> tokens { time { hours: "1" minutes: "02" seconds: "36" suffix "am" } } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="time", kind="classify", deterministic=deterministic) + + h = pynini.string_file(get_abs_path("data/time/hour.tsv")) + time_tens = pynini.string_file(get_abs_path("data/time/tens.tsv")) + time_digit = pynini.string_file(get_abs_path("data/time/digit.tsv")) + time_zero = pynini.string_file(get_abs_path("data/time/zero.tsv")) + time_digit = time_digit | time_zero + time_suffix = pynini.string_file(get_abs_path("data/time/suffix.tsv")) + + m = time_tens + time_digit + s = (time_tens + time_digit) | time_digit + + delete_colon = pynini.cross(":", " ") + + # 5:05, 14:30 + h_m = ( + pynutil.insert('hours: "') + + h + + pynutil.insert('"') + + delete_colon + + pynutil.insert('minutes: "') + + m + + pynutil.insert('"') + ) + + # 1:30:15 + h_m_s = ( + pynutil.insert('hours: "') + + h + + pynutil.insert('"') + + delete_colon + + pynutil.insert('minutes: "') + + m + + pynutil.insert('"') + + delete_colon + + pynutil.insert('seconds: "') + + s + + pynutil.insert('"') + ) + + graph = h_m | h_m_s + graph_suffix = ( + graph + insert_space + pynutil.insert('suffix: "') + time_suffix + pynutil.insert('"') + ) + graph |= graph_suffix + self.fst = self.add_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/taggers/tokenize_and_classify.py b/fun_text_processing/text_normalization/zh/taggers/tokenize_and_classify.py new file mode 100644 index 0000000..1cba12f --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/tokenize_and_classify.py @@ -0,0 +1,83 @@ +import os + +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import FUN_SIGMA, GraphFst +from fun_text_processing.text_normalization.zh.taggers.cardinal import Cardinal +from fun_text_processing.text_normalization.zh.taggers.char import Char +from fun_text_processing.text_normalization.zh.taggers.date import Date +from fun_text_processing.text_normalization.zh.taggers.fraction import Fraction +from fun_text_processing.text_normalization.zh.taggers.math_symbol import MathSymbol +from fun_text_processing.text_normalization.zh.taggers.measure import Measure +from fun_text_processing.text_normalization.zh.taggers.money import Money +from fun_text_processing.text_normalization.zh.taggers.preprocessor import PreProcessor +from fun_text_processing.text_normalization.zh.taggers.time import Time +from fun_text_processing.text_normalization.zh.taggers.whitelist import Whitelist +from pynini.lib import pynutil + + +class ClassifyFst(GraphFst): + """ + Final class that composes all other classification grammars. This class can process an entire sentence including punctuation. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + + Args: + input_case: accepting either "lower_cased" or "cased" input. + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + cache_dir: path to a dir with .far grammar file. Set to None to avoid using cache. + overwrite_cache: set to True to overwrite .far files + whitelist: path to a file with whitelist replacements + """ + + def __init__( + self, + input_case: str, + deterministic: bool = True, + cache_dir: str = None, + overwrite_cache: bool = False, + whitelist: str = None, + ): + super().__init__(name="tokenize_and_classify", kind="classify", deterministic=deterministic) + + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + whitelist_file = os.path.basename(whitelist) if whitelist else "" + far_file = os.path.join( + cache_dir, + f"zh_tn_{deterministic}_deterministic_{input_case}_{whitelist_file}_tokenize.far", + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["tokenize_and_classify"] + else: + date = Date(deterministic=deterministic) + cardinal = Cardinal(deterministic=deterministic) + char = Char(deterministic=deterministic) + fraction = Fraction(deterministic=deterministic) + math_symbol = MathSymbol(deterministic=deterministic) + money = Money(deterministic=deterministic) + measure = Measure(deterministic=deterministic) + time = Time(deterministic=deterministic) + whitelist = Whitelist(deterministic=deterministic) + + classify = pynini.union( + pynutil.add_weight(date.fst, 1.02), + pynutil.add_weight(fraction.fst, 1.05), + pynutil.add_weight(money.fst, 1.05), + pynutil.add_weight(measure.fst, 1.05), + pynutil.add_weight(time.fst, 1.05), + pynutil.add_weight(whitelist.fst, 1.03), + pynutil.add_weight(cardinal.fst, 1.06), + pynutil.add_weight(math_symbol.fst, 1.08), + pynutil.add_weight(char.fst, 100), + ) + token = pynutil.insert("tokens { ") + classify + pynutil.insert(" } ") + + tagger = pynini.cdrewrite(token.optimize(), "", "", FUN_SIGMA).optimize() + + preprocessor = PreProcessor( + remove_interjections=True, + fullwidth_to_halfwidth=True, + ) + self.fst = preprocessor.fst @ tagger diff --git a/fun_text_processing/text_normalization/zh/taggers/whitelist.py b/fun_text_processing/text_normalization/zh/taggers/whitelist.py new file mode 100644 index 0000000..616c55b --- /dev/null +++ b/fun_text_processing/text_normalization/zh/taggers/whitelist.py @@ -0,0 +1,25 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil + + +class Whitelist(GraphFst): + """ + ATM -> tokens { whitelist: "ATM" } + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="whitelist", kind="classify", deterministic=deterministic) + + whitelist = pynini.string_file(get_abs_path("data/whitelist/default.tsv")) + erhua = pynutil.insert('erhua: "') + pynini.accep("儿") + pynutil.insert('"') + sign = pynini.string_file(get_abs_path("data/math/symbol.tsv")) + whitelist = ( + pynutil.insert('name: "') + + (pynini.string_file(get_abs_path("data/erhua/whitelist.tsv")) | whitelist | sign) + + pynutil.insert('"') + ) + graph = pynutil.add_weight(erhua, 0.1) | whitelist + + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/utils.py b/fun_text_processing/text_normalization/zh/utils.py new file mode 100644 index 0000000..237a437 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/utils.py @@ -0,0 +1,51 @@ +import csv +import os + +UNIT_1e01 = "十" +UNIT_1e02 = "百" +UNIT_1e03 = "千" +UNIT_1e04 = "万" + + +def get_abs_path(rel_path): + """ + Get absolute path + + Args: + rel_path: relative path to this file + + Returns absolute path + """ + return os.path.dirname(os.path.abspath(__file__)) + "/" + rel_path + + +def load_labels(abs_path): + """ + loads relative path file as dictionary + + Args: + abs_path: absolute path + + Returns dictionary of mappings + """ + label_tsv = open(abs_path, encoding="utf-8") + labels = list(csv.reader(label_tsv, delimiter="\t")) + return labels + + +def augment_labels_with_punct_at_end(labels): + """ + augments labels: if key ends on a punctuation that value does not have, add a new label + where the value maintains the punctuation + + Args: + labels : input labels + Returns: + additional labels + """ + res = [] + for label in labels: + if len(label) > 1: + if label[0][-1] == "." and label[1][-1] != ".": + res.append([label[0], label[1] + "."] + label[2:]) + return res diff --git a/fun_text_processing/text_normalization/zh/verbalizers/__init__.py b/fun_text_processing/text_normalization/zh/verbalizers/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/__init__.py @@ -0,0 +1 @@ + diff --git a/fun_text_processing/text_normalization/zh/verbalizers/cardinal.py b/fun_text_processing/text_normalization/zh/verbalizers/cardinal.py new file mode 100644 index 0000000..6b4bcc7 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/cardinal.py @@ -0,0 +1,16 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import FUN_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class Cardinal(GraphFst): + """ + tokens { cardinal { integer: "一二三" } } -> 一二三 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) + + graph = pynutil.delete('integer: "') + pynini.closure(FUN_NOT_QUOTE) + pynutil.delete('"') + + self.fst = self.delete_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/char.py b/fun_text_processing/text_normalization/zh/verbalizers/char.py new file mode 100644 index 0000000..b04e441 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/char.py @@ -0,0 +1,14 @@ +from fun_text_processing.text_normalization.zh.graph_utils import FUN_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class Char(GraphFst): + """ + tokens { char: "你" } -> 你 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="char", kind="verbalize", deterministic=deterministic) + + graph = pynutil.delete('name: "') + FUN_NOT_QUOTE + pynutil.delete('"') + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/date.py b/fun_text_processing/text_normalization/zh/verbalizers/date.py new file mode 100644 index 0000000..cf0e604 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/date.py @@ -0,0 +1,61 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import ( + FUN_NOT_QUOTE, + GraphFst, + delete_space, +) +from fun_text_processing.text_normalization.zh.utils import UNIT_1e01, get_abs_path +from pynini.lib import pynutil + + +class Date(GraphFst): + """ + tokens { date { year: "2002" month: "01" day: "28"} } -> 二零零二年一月二十八日 + tokens { date { year: "2002" } } -> 二零零八年 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="date", kind="verbalize", deterministic=deterministic) + date_type0 = pynutil.delete('year: "') + pynini.closure(FUN_NOT_QUOTE) + pynutil.delete('"') + graph_digit = pynini.string_file(get_abs_path("data/number/digit.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/number/digit_teen.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/number/zero.tsv")) + graph_no_zero = pynini.cross("0", "") + graph_year = pynini.closure(graph_digit | graph_zero, 2, 4) + graph_digit_no_zero = graph_digit | graph_no_zero + graph_2_digit_date = (graph_teen + pynutil.insert(UNIT_1e01) + graph_digit_no_zero) | ( + graph_no_zero + graph_digit + ) + + date_type1 = ( + pynutil.delete('year: "') + + graph_year + + pynutil.insert("年") + + pynutil.delete('"') + + delete_space + + pynutil.delete('month: "') + + graph_2_digit_date + + pynutil.insert("月") + + pynutil.delete('"') + + delete_space + + pynutil.delete('day: "') + + graph_2_digit_date + + pynutil.insert("日") + + pynutil.delete('"') + ) + + date_type2 = ( + pynutil.delete('year: "') + + graph_year + + pynutil.insert("年") + + pynutil.delete('"') + + delete_space + + pynutil.delete('month: "') + + graph_2_digit_date + + pynutil.insert("月") + + pynutil.delete('"') + ) + + graph = date_type0 | date_type1 | date_type2 + + self.fst = self.delete_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/fraction.py b/fun_text_processing/text_normalization/zh/verbalizers/fraction.py new file mode 100644 index 0000000..414c470 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/fraction.py @@ -0,0 +1,20 @@ +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst +from fun_text_processing.text_normalization.zh.taggers.cardinal import Cardinal +from pynini.lib import pynutil + + +class Fraction(GraphFst): + """ + tokens { fraction { denominator: "5" numerator: "1" } } -> 五分之一 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="fraction", kind="verbalize", deterministic=deterministic) + + denominator = ( + pynutil.delete('denominator: "') + Cardinal().graph_cardinal + pynutil.delete('"') + ) + numerator = pynutil.delete('numerator: "') + Cardinal().graph_cardinal + pynutil.delete('"') + graph = denominator + pynutil.delete(" ") + pynutil.insert("分之") + numerator + + self.fst = self.delete_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/math_symbol.py b/fun_text_processing/text_normalization/zh/verbalizers/math_symbol.py new file mode 100644 index 0000000..4a70fda --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/math_symbol.py @@ -0,0 +1,16 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import FUN_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class MathSymbol(GraphFst): + """ + tokens { sign: "加" } -> 加 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="sign", kind="verbalize", deterministic=deterministic) + + graph = pynutil.delete('score: "') + pynini.closure(FUN_NOT_QUOTE) + pynutil.delete('"') + + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/measure.py b/fun_text_processing/text_normalization/zh/verbalizers/measure.py new file mode 100644 index 0000000..2119044 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/measure.py @@ -0,0 +1,41 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import ( + FUN_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class Measure(GraphFst): + """ + tokens { measure { cardinal: "一" } units: "千克" } } -> 一千克 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="measure", kind="verbalize", deterministic=deterministic) + + graph = ( + pynutil.delete("cardinal {") + + delete_space + + pynutil.delete('integer: "') + + pynini.closure(FUN_NOT_QUOTE) + + pynutil.delete('"') + + delete_space + + pynutil.delete("}") + + delete_space + + pynutil.delete('units: "') + + pynini.closure(FUN_NOT_QUOTE) + + pynutil.delete('"') + ) + percent_graph = ( + pynutil.delete("decimal { ") + + pynutil.delete('integer_part: "') + + pynutil.insert("百分之") + + pynini.closure(FUN_NOT_QUOTE, 1) + + pynutil.delete('"') + + delete_space + + pynutil.delete("}") + ) + graph |= percent_graph + self.fst = self.delete_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/money.py b/fun_text_processing/text_normalization/zh/verbalizers/money.py new file mode 100644 index 0000000..7f1aa9e --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/money.py @@ -0,0 +1,31 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import ( + FUN_NOT_QUOTE, + GraphFst, + delete_space, +) +from pynini.lib import pynutil + + +class Money(GraphFst): + """ + tokens { money { integer_part: "一点五" fractional_part: "元" } } -> 一点五元 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="money", kind="verbalize", deterministic=deterministic) + + cur = ( + pynutil.delete('fractional_part: "') + + pynini.closure(FUN_NOT_QUOTE) + + pynutil.delete('"') + ) + num = ( + pynutil.delete('integer_part: "') + + pynini.closure(FUN_NOT_QUOTE) + + pynutil.delete('"') + + delete_space + ) + graph = num + cur + + self.fst = self.delete_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/postprocessor.py b/fun_text_processing/text_normalization/zh/verbalizers/postprocessor.py new file mode 100644 index 0000000..e87f289 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/postprocessor.py @@ -0,0 +1,73 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import ( + FUN_ALPHA, + FUN_DIGIT, + FUN_PUNCT, + FUN_SIGMA, + FUN_WHITE_SPACE, + GraphFst, +) +from fun_text_processing.text_normalization.zh.utils import get_abs_path +from pynini.lib import pynutil, utf8 + + +class PostProcessor(GraphFst): + """ + Postprocessing of TN, now contains: + 1. punctuation removal + 2. letter case conversion + 3. oov tagger + """ + + def __init__( + self, + remove_puncts: bool = False, + to_upper: bool = False, + to_lower: bool = False, + tag_oov: bool = False, + ): + super().__init__(name="PostProcessor", kind="processor") + + graph = pynini.cdrewrite("", "", "", FUN_SIGMA) + if remove_puncts: + remove_puncts_graph = pynutil.delete( + pynini.union( + FUN_PUNCT, pynini.string_file(get_abs_path("data/char/punctuations_zh.tsv")) + ) + ) + graph @= pynini.cdrewrite(remove_puncts_graph, "", "", FUN_SIGMA).optimize() + + if to_upper or to_lower: + if to_upper: + conv_cases_graph = pynini.inverse( + pynini.string_file(get_abs_path("data/char/upper_to_lower.tsv")) + ) + else: + conv_cases_graph = pynini.string_file(get_abs_path("data/char/upper_to_lower.tsv")) + + graph @= pynini.cdrewrite(conv_cases_graph, "", "", FUN_SIGMA).optimize() + + if tag_oov: + zh_charset_std = pynini.string_file( + get_abs_path("data/char/charset_national_standard_2013_8105.tsv") + ) + zh_charset_ext = pynini.string_file(get_abs_path("data/char/charset_extension.tsv")) + + zh_charset = ( + zh_charset_std + | zh_charset_ext + | pynini.string_file(get_abs_path("data/char/punctuations_zh.tsv")) + ) + en_charset = FUN_DIGIT | FUN_ALPHA | FUN_PUNCT | FUN_WHITE_SPACE + charset = zh_charset | en_charset + + with open(get_abs_path("data/char/oov_tags.tsv"), "r") as f: + tags = f.readline().strip().split("\t") + assert len(tags) == 2 + ltag, rtag = tags + + oov_charset = pynini.difference(utf8.VALID_UTF8_CHAR, charset) + tag_oov_graph = pynutil.insert(ltag) + oov_charset + pynutil.insert(rtag) + graph @= pynini.cdrewrite(tag_oov_graph, "", "", FUN_SIGMA).optimize() + + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/time.py b/fun_text_processing/text_normalization/zh/verbalizers/time.py new file mode 100644 index 0000000..0c88ed8 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/time.py @@ -0,0 +1,88 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import ( + FUN_NOT_QUOTE, + GraphFst, + delete_space, +) +from fun_text_processing.text_normalization.zh.utils import UNIT_1e01, get_abs_path +from pynini.lib import pynutil + + +class Time(GraphFst): + """ + tokens { time { h: "1" m: "02" s: "36" } } -> 一点零二分三十六秒 + tokens { time { suffix "am" hours: "1" minutes: "02" seconds: "36" } } -> 上午一点零二分三十六秒 + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="time", kind="verbalize", deterministic=deterministic) + graph_digit = pynini.string_file(get_abs_path("data/number/digit.tsv")) + graph_teen = pynini.string_file(get_abs_path("data/number/digit_teen.tsv")) + graph_zero = pynini.string_file(get_abs_path("data/number/zero.tsv")) + graph_no_zero = pynini.cross("0", "") + + graph_digit_no_zero = graph_digit | graph_no_zero + + graph_2_digit_zero_none = pynini.cross("0", "") + pynini.cross("0", "") + graph_2_digit_zero = pynini.cross("00", "零") + + graph_2_digit_time = (graph_teen + pynutil.insert(UNIT_1e01) + graph_digit_no_zero) | ( + graph_zero + graph_digit + ) + h = graph_2_digit_time | graph_2_digit_zero | graph_digit + m = graph_2_digit_time | graph_2_digit_zero + s = graph_2_digit_time | graph_2_digit_zero + + # 6:25 + h_m = ( + pynutil.delete('hours: "') + + h + + pynutil.insert("点") + + pynutil.delete('"') + + delete_space + + pynutil.delete('minutes: "') + + (graph_2_digit_time) + + pynutil.insert("分") + + pynutil.delete('"') + ) + + # 23:00 + h_00 = ( + pynutil.delete('hours: "') + + h + + pynutil.insert("点") + + pynutil.delete('"') + + delete_space + + pynutil.delete('minutes: "') + + (graph_2_digit_zero_none) + + pynutil.delete('"') + ) + + # 9:12:52 + h_m_s = ( + pynutil.delete('hours: "') + + h + + pynutil.insert("点") + + pynutil.delete('"') + + delete_space + + pynutil.delete('minutes: "') + + m + + pynutil.insert("分") + + pynutil.delete('"') + + delete_space + + pynutil.delete('seconds: "') + + s + + pynutil.insert("秒") + + pynutil.delete('"') + ) + + graph = h_m | h_m_s | h_00 + graph_suffix = ( + pynutil.delete('suffix: "') + + pynini.closure(FUN_NOT_QUOTE) + + pynutil.delete('"') + + delete_space + + graph + ) + graph |= graph_suffix + self.fst = self.delete_tokens(graph).optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/verbalize.py b/fun_text_processing/text_normalization/zh/verbalizers/verbalize.py new file mode 100644 index 0000000..b582137 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/verbalize.py @@ -0,0 +1,49 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import GraphFst +from fun_text_processing.text_normalization.zh.verbalizers.cardinal import Cardinal +from fun_text_processing.text_normalization.zh.verbalizers.char import Char +from fun_text_processing.text_normalization.zh.verbalizers.date import Date +from fun_text_processing.text_normalization.zh.verbalizers.fraction import Fraction +from fun_text_processing.text_normalization.zh.verbalizers.math_symbol import MathSymbol +from fun_text_processing.text_normalization.zh.verbalizers.measure import Measure +from fun_text_processing.text_normalization.zh.verbalizers.money import Money +from fun_text_processing.text_normalization.zh.verbalizers.time import Time +from fun_text_processing.text_normalization.zh.verbalizers.whitelist import Whitelist + + +class VerbalizeFst(GraphFst): + """ + Composes other verbalizer grammars. + For deployment, this grammar will be compiled and exported to OpenFst Finate State Archiv (FAR) File. + More details to deployment at NeMo/tools/text_processing_deployment. + Args: + deterministic: if True will provide a single transduction option, + for False multiple options (used for audio-based normalization) + """ + + def __init__(self, deterministic: bool = True): + super().__init__(name="verbalize", kind="verbalize", deterministic=deterministic) + + date = Date(deterministic=deterministic) + cardinal = Cardinal(deterministic=deterministic) + char = Char(deterministic=deterministic) + fraction = Fraction(deterministic=deterministic) + math_symbol = MathSymbol(deterministic=deterministic) + money = Money(deterministic=deterministic) + measure = Measure(deterministic=deterministic) + time = Time(deterministic=deterministic) + whitelist = Whitelist(deterministic=deterministic) + + graph = pynini.union( + date.fst, + cardinal.fst, + fraction.fst, + char.fst, + math_symbol.fst, + money.fst, + measure.fst, + time.fst, + whitelist.fst, + ) + + self.fst = graph.optimize() diff --git a/fun_text_processing/text_normalization/zh/verbalizers/verbalize_final.py b/fun_text_processing/text_normalization/zh/verbalizers/verbalize_final.py new file mode 100644 index 0000000..1c7f77b --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/verbalize_final.py @@ -0,0 +1,51 @@ +import os + +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import ( + GraphFst, + delete_space, + generator_main, +) +from fun_text_processing.text_normalization.zh.verbalizers.postprocessor import PostProcessor +from fun_text_processing.text_normalization.zh.verbalizers.verbalize import VerbalizeFst +from pynini.lib import pynutil + +# import logging + + +class VerbalizeFinalFst(GraphFst): + """ """ + + def __init__( + self, deterministic: bool = True, cache_dir: str = None, overwrite_cache: bool = False + ): + super().__init__(name="verbalize_final", kind="verbalize", deterministic=deterministic) + far_file = None + if cache_dir is not None and cache_dir != "None": + os.makedirs(cache_dir, exist_ok=True) + far_file = os.path.join( + cache_dir, f"zh_tn_{deterministic}_deterministic_verbalizer.far" + ) + if not overwrite_cache and far_file and os.path.exists(far_file): + self.fst = pynini.Far(far_file, mode="r")["verbalize"] + else: + token_graph = VerbalizeFst(deterministic=deterministic) + token_verbalizer = ( + pynutil.delete("tokens {") + + delete_space + + token_graph.fst + + delete_space + + pynutil.delete(" }") + ) + verbalizer = pynini.closure(delete_space + token_verbalizer + delete_space) + + postprocessor = PostProcessor( + remove_puncts=False, + to_upper=False, + to_lower=False, + tag_oov=False, + ) + + self.fst = (verbalizer @ postprocessor.fst).optimize() + if far_file: + generator_main(far_file, {"verbalize": self.fst}) diff --git a/fun_text_processing/text_normalization/zh/verbalizers/whitelist.py b/fun_text_processing/text_normalization/zh/verbalizers/whitelist.py new file mode 100644 index 0000000..4d04066 --- /dev/null +++ b/fun_text_processing/text_normalization/zh/verbalizers/whitelist.py @@ -0,0 +1,16 @@ +import pynini +from fun_text_processing.text_normalization.zh.graph_utils import FUN_NOT_QUOTE, GraphFst +from pynini.lib import pynutil + + +class Whitelist(GraphFst): + """ + tokens { whitelist: "ATM" } -> A T M + """ + + def __init__(self, deterministic: bool = True, lm: bool = False): + super().__init__(name="whitelist", kind="verbalize", deterministic=deterministic) + remove_erhua = pynutil.delete('erhua: "') + pynutil.delete("儿") + pynutil.delete('"') + whitelist = pynutil.delete('name: "') + pynini.closure(FUN_NOT_QUOTE) + pynutil.delete('"') + graph = remove_erhua | whitelist + self.fst = graph.optimize() diff --git a/funasr/__init__.py b/funasr/__init__.py new file mode 100644 index 0000000..c7f7c21 --- /dev/null +++ b/funasr/__init__.py @@ -0,0 +1,44 @@ +"""Initialize funasr package.""" + +import os +import pkgutil +import importlib + +dirname = os.path.dirname(__file__) +version_file = os.path.join(dirname, "version.txt") +with open(version_file, "r") as f: + __version__ = f.read().strip() + + +import importlib +import pkgutil + + +def import_submodules(package, recursive=True): + if isinstance(package, str): + try: + package = importlib.import_module(package) + except Exception as e: + # 如果想要看到导入错误的具体信息,可以取消注释下面的行 + # print(f"Failed to import {package}: {e}") + pass + results = {} + if not isinstance(package, str): + for loader, name, is_pkg in pkgutil.walk_packages(package.__path__, package.__name__ + "."): + try: + results[name] = importlib.import_module(name) + except Exception as e: + # 如果想要看到导入错误的具体信息,可以取消注释下面的行 + # print(f"Failed to import {name}: {e}") + pass + if recursive and is_pkg: + results.update(import_submodules(name)) + return results + + +import_submodules(__name__) + +from funasr.auto.auto_model import AutoModel +from funasr.auto.auto_frontend import AutoFrontend + +os.environ["HYDRA_FULL_ERROR"] = "1" diff --git a/funasr/auto/__init__.py b/funasr/auto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/auto/auto_frontend.py b/funasr/auto/auto_frontend.py new file mode 100644 index 0000000..b8fa7e0 --- /dev/null +++ b/funasr/auto/auto_frontend.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import json +import time +import torch +import hydra +import random +import string +import logging +import os.path +from tqdm import tqdm +from omegaconf import DictConfig, OmegaConf, ListConfig + +from funasr.register import tables +from funasr.utils.load_utils import load_bytes +from funasr.download.file import download_from_url +from funasr.auto.auto_model import prepare_data_iterator +from funasr.utils.timestamp_tools import timestamp_sentence +from funasr.download.download_from_hub import download_model +from funasr.utils.vad_utils import slice_padding_audio_samples +from funasr.train_utils.set_all_random_seed import set_all_random_seed +from funasr.train_utils.load_pretrained_model import load_pretrained_model +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.models.campplus.utils import sv_chunk, postprocess, distribute_spk + + +class AutoFrontend: + def __init__(self, **kwargs): + assert "model" in kwargs + if "model_conf" not in kwargs: + logging.info("download models from model hub: {}".format(kwargs.get("hub", "ms"))) + kwargs = download_model(**kwargs) + + # build frontend + frontend = kwargs.get("frontend", None) + if frontend is not None: + frontend_class = tables.frontend_classes.get(frontend) + frontend = frontend_class(**kwargs["frontend_conf"]) + + self.frontend = frontend + if "frontend" in kwargs: + del kwargs["frontend"] + self.kwargs = kwargs + + def __call__(self, input, input_len=None, kwargs=None, **cfg): + + kwargs = self.kwargs if kwargs is None else kwargs + kwargs.update(cfg) + + key_list, data_list = prepare_data_iterator(input, input_len=input_len) + batch_size = kwargs.get("batch_size", 1) + device = kwargs.get("device", "cpu") + if device == "cpu": + batch_size = 1 + + meta_data = {} + + result_list = [] + num_samples = len(data_list) + pbar = tqdm(colour="blue", total=num_samples + 1, dynamic_ncols=True) + + time0 = time.perf_counter() + for beg_idx in range(0, num_samples, batch_size): + end_idx = min(num_samples, beg_idx + batch_size) + data_batch = data_list[beg_idx:end_idx] + key_batch = key_list[beg_idx:end_idx] + + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_batch, fs=self.frontend.fs, audio_fs=kwargs.get("fs", 16000) + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, + data_type=kwargs.get("data_type", "sound"), + frontend=self.frontend, + **kwargs, + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * self.frontend.frame_shift * self.frontend.lfr_n / 1000 + ) + + speech.to(device=device), speech_lengths.to(device=device) + batch = {"input": speech, "input_len": speech_lengths, "key": key_batch} + result_list.append(batch) + + pbar.update(1) + description = f"{meta_data}, " + pbar.set_description(description) + + time_end = time.perf_counter() + pbar.set_description(f"time escaped total: {time_end - time0:0.3f}") + + return result_list diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py new file mode 100644 index 0000000..97eb325 --- /dev/null +++ b/funasr/auto/auto_model.py @@ -0,0 +1,591 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import json +import time +import copy +import torch +import random +import string +import logging +import os.path +import numpy as np +from tqdm import tqdm + +from funasr.utils.misc import deep_update +from funasr.register import tables +from funasr.utils.load_utils import load_bytes +from funasr.download.file import download_from_url +from funasr.utils.timestamp_tools import timestamp_sentence +from funasr.download.download_from_hub import download_model +from funasr.utils.vad_utils import slice_padding_audio_samples +from funasr.utils.vad_utils import merge_vad +from funasr.utils.load_utils import load_audio_text_image_video +from funasr.train_utils.set_all_random_seed import set_all_random_seed +from funasr.train_utils.load_pretrained_model import load_pretrained_model +from funasr.utils import export_utils +from funasr.utils import misc + +try: + from funasr.models.campplus.utils import sv_chunk, postprocess, distribute_spk + from funasr.models.campplus.cluster_backend import ClusterBackend +except: + pass + + +def prepare_data_iterator(data_in, input_len=None, data_type=None, key=None): + """ """ + data_list = [] + key_list = [] + filelist = [".scp", ".txt", ".json", ".jsonl", ".text"] + + chars = string.ascii_letters + string.digits + if isinstance(data_in, str) and data_in.startswith("http"): # url + data_in = download_from_url(data_in) + + if isinstance(data_in, str) and os.path.exists( + data_in + ): # wav_path; filelist: wav.scp, file.jsonl;text.txt; + _, file_extension = os.path.splitext(data_in) + file_extension = file_extension.lower() + if file_extension in filelist: # filelist: wav.scp, file.jsonl;text.txt; + with open(data_in, encoding="utf-8") as fin: + for line in fin: + key = "rand_key_" + "".join(random.choice(chars) for _ in range(13)) + if data_in.endswith(".jsonl"): # file.jsonl: json.dumps({"source": data}) + lines = json.loads(line.strip()) + data = lines["source"] + key = data["key"] if "key" in data else key + else: # filelist, wav.scp, text.txt: id \t data or data + lines = line.strip().split(maxsplit=1) + data = lines[1] if len(lines) > 1 else lines[0] + key = lines[0] if len(lines) > 1 else key + + data_list.append(data) + key_list.append(key) + else: + if key is None: + # key = "rand_key_" + "".join(random.choice(chars) for _ in range(13)) + key = misc.extract_filename_without_extension(data_in) + data_list = [data_in] + key_list = [key] + elif isinstance(data_in, (list, tuple)): + if data_type is not None and isinstance(data_type, (list, tuple)): # mutiple inputs + data_list_tmp = [] + for data_in_i, data_type_i in zip(data_in, data_type): + key_list, data_list_i = prepare_data_iterator( + data_in=data_in_i, data_type=data_type_i + ) + data_list_tmp.append(data_list_i) + data_list = [] + for item in zip(*data_list_tmp): + data_list.append(item) + else: + # [audio sample point, fbank, text] + data_list = data_in + key_list = [] + for data_i in data_in: + if isinstance(data_i, str) and os.path.exists(data_i): + key = misc.extract_filename_without_extension(data_i) + else: + key = "rand_key_" + "".join(random.choice(chars) for _ in range(13)) + key_list.append(key) + + else: # raw text; audio sample point, fbank; bytes + if isinstance(data_in, bytes): # audio bytes + data_in = load_bytes(data_in) + if key is None: + key = "rand_key_" + "".join(random.choice(chars) for _ in range(13)) + data_list = [data_in] + key_list = [key] + + return key_list, data_list + + +class AutoModel: + + def __init__(self, **kwargs): + + log_level = getattr(logging, kwargs.get("log_level", "INFO").upper()) + logging.basicConfig(level=log_level) + + if not kwargs.get("disable_log", True): + tables.print() + + model, kwargs = self.build_model(**kwargs) + + # if vad_model is not None, build vad model else None + vad_model = kwargs.get("vad_model", None) + vad_kwargs = {} if kwargs.get("vad_kwargs", {}) is None else kwargs.get("vad_kwargs", {}) + if vad_model is not None: + logging.info("Building VAD model.") + vad_kwargs["model"] = vad_model + vad_kwargs["model_revision"] = kwargs.get("vad_model_revision", "master") + vad_kwargs["device"] = kwargs["device"] + vad_model, vad_kwargs = self.build_model(**vad_kwargs) + + # if punc_model is not None, build punc model else None + punc_model = kwargs.get("punc_model", None) + punc_kwargs = {} if kwargs.get("punc_kwargs", {}) is None else kwargs.get("punc_kwargs", {}) + if punc_model is not None: + logging.info("Building punc model.") + punc_kwargs["model"] = punc_model + punc_kwargs["model_revision"] = kwargs.get("punc_model_revision", "master") + punc_kwargs["device"] = kwargs["device"] + punc_model, punc_kwargs = self.build_model(**punc_kwargs) + + # if spk_model is not None, build spk model else None + spk_model = kwargs.get("spk_model", None) + spk_kwargs = {} if kwargs.get("spk_kwargs", {}) is None else kwargs.get("spk_kwargs", {}) + if spk_model is not None: + logging.info("Building SPK model.") + spk_kwargs["model"] = spk_model + spk_kwargs["model_revision"] = kwargs.get("spk_model_revision", "master") + spk_kwargs["device"] = kwargs["device"] + spk_model, spk_kwargs = self.build_model(**spk_kwargs) + self.cb_model = ClusterBackend().to(kwargs["device"]) + spk_mode = kwargs.get("spk_mode", "punc_segment") + if spk_mode not in ["default", "vad_segment", "punc_segment"]: + logging.error("spk_mode should be one of default, vad_segment and punc_segment.") + self.spk_mode = spk_mode + + self.kwargs = kwargs + self.model = model + self.vad_model = vad_model + self.vad_kwargs = vad_kwargs + self.punc_model = punc_model + self.punc_kwargs = punc_kwargs + self.spk_model = spk_model + self.spk_kwargs = spk_kwargs + self.model_path = kwargs.get("model_path") + + def build_model(self, **kwargs): + assert "model" in kwargs + if "model_conf" not in kwargs: + logging.info("download models from model hub: {}".format(kwargs.get("hub", "ms"))) + kwargs = download_model(**kwargs) + + set_all_random_seed(kwargs.get("seed", 0)) + + device = kwargs.get("device", "cuda") + if not torch.cuda.is_available() or kwargs.get("ngpu", 1) == 0: + device = "cpu" + kwargs["batch_size"] = 1 + kwargs["device"] = device + + torch.set_num_threads(kwargs.get("ncpu", 4)) + + # build tokenizer + tokenizer = kwargs.get("tokenizer", None) + if tokenizer is not None: + tokenizer_class = tables.tokenizer_classes.get(tokenizer) + tokenizer = tokenizer_class(**kwargs.get("tokenizer_conf", {})) + kwargs["token_list"] = ( + tokenizer.token_list if hasattr(tokenizer, "token_list") else None + ) + kwargs["token_list"] = ( + tokenizer.get_vocab() if hasattr(tokenizer, "get_vocab") else kwargs["token_list"] + ) + vocab_size = len(kwargs["token_list"]) if kwargs["token_list"] is not None else -1 + if vocab_size == -1 and hasattr(tokenizer, "get_vocab_size"): + vocab_size = tokenizer.get_vocab_size() + else: + vocab_size = -1 + kwargs["tokenizer"] = tokenizer + + # build frontend + frontend = kwargs.get("frontend", None) + kwargs["input_size"] = None + if frontend is not None: + frontend_class = tables.frontend_classes.get(frontend) + frontend = frontend_class(**kwargs.get("frontend_conf", {})) + kwargs["input_size"] = ( + frontend.output_size() if hasattr(frontend, "output_size") else None + ) + kwargs["frontend"] = frontend + # build model + model_class = tables.model_classes.get(kwargs["model"]) + model_conf = {} + deep_update(model_conf, kwargs.get("model_conf", {})) + deep_update(model_conf, kwargs) + model = model_class(**model_conf, vocab_size=vocab_size) + model.to(device) + + # init_param + init_param = kwargs.get("init_param", None) + if init_param is not None: + if os.path.exists(init_param): + logging.info(f"Loading pretrained params from {init_param}") + load_pretrained_model( + model=model, + path=init_param, + ignore_init_mismatch=kwargs.get("ignore_init_mismatch", True), + oss_bucket=kwargs.get("oss_bucket", None), + scope_map=kwargs.get("scope_map", []), + excludes=kwargs.get("excludes", None), + ) + else: + print(f"error, init_param does not exist!: {init_param}") + + # fp16 + if kwargs.get("fp16", False): + model.to(torch.float16) + return model, kwargs + + def __call__(self, *args, **cfg): + kwargs = self.kwargs + deep_update(kwargs, cfg) + res = self.model(*args, kwargs) + return res + + def generate(self, input, input_len=None, **cfg): + if self.vad_model is None: + return self.inference(input, input_len=input_len, **cfg) + + else: + return self.inference_with_vad(input, input_len=input_len, **cfg) + + def inference(self, input, input_len=None, model=None, kwargs=None, key=None, **cfg): + kwargs = self.kwargs if kwargs is None else kwargs + deep_update(kwargs, cfg) + model = self.model if model is None else model + model.eval() + + batch_size = kwargs.get("batch_size", 1) + # if kwargs.get("device", "cpu") == "cpu": + # batch_size = 1 + + key_list, data_list = prepare_data_iterator( + input, input_len=input_len, data_type=kwargs.get("data_type", None), key=key + ) + + speed_stats = {} + asr_result_list = [] + num_samples = len(data_list) + disable_pbar = self.kwargs.get("disable_pbar", False) + pbar = ( + tqdm(colour="blue", total=num_samples, dynamic_ncols=True) if not disable_pbar else None + ) + time_speech_total = 0.0 + time_escape_total = 0.0 + for beg_idx in range(0, num_samples, batch_size): + end_idx = min(num_samples, beg_idx + batch_size) + data_batch = data_list[beg_idx:end_idx] + key_batch = key_list[beg_idx:end_idx] + batch = {"data_in": data_batch, "key": key_batch} + + if (end_idx - beg_idx) == 1 and kwargs.get("data_type", None) == "fbank": # fbank + batch["data_in"] = data_batch[0] + batch["data_lengths"] = input_len + + time1 = time.perf_counter() + with torch.no_grad(): + res = model.inference(**batch, **kwargs) + if isinstance(res, (list, tuple)): + results = res[0] + meta_data = res[1] if len(res) > 1 else {} + time2 = time.perf_counter() + + asr_result_list.extend(results) + + # batch_data_time = time_per_frame_s * data_batch_i["speech_lengths"].sum().item() + batch_data_time = meta_data.get("batch_data_time", -1) + time_escape = time2 - time1 + speed_stats["load_data"] = meta_data.get("load_data", 0.0) + speed_stats["extract_feat"] = meta_data.get("extract_feat", 0.0) + speed_stats["forward"] = f"{time_escape:0.3f}" + speed_stats["batch_size"] = f"{len(results)}" + speed_stats["rtf"] = f"{(time_escape) / batch_data_time:0.3f}" + description = f"{speed_stats}, " + if pbar: + pbar.update(1) + pbar.set_description(description) + time_speech_total += batch_data_time + time_escape_total += time_escape + + if pbar: + # pbar.update(1) + pbar.set_description(f"rtf_avg: {time_escape_total/time_speech_total:0.3f}") + torch.cuda.empty_cache() + return asr_result_list + + def inference_with_vad(self, input, input_len=None, **cfg): + kwargs = self.kwargs + # step.1: compute the vad model + deep_update(self.vad_kwargs, cfg) + beg_vad = time.time() + res = self.inference( + input, input_len=input_len, model=self.vad_model, kwargs=self.vad_kwargs, **cfg + ) + end_vad = time.time() + + # FIX(gcf): concat the vad clips for sense vocie model for better aed + if kwargs.get("merge_vad", False): + for i in range(len(res)): + res[i]["value"] = merge_vad(res[i]["value"], kwargs.get("merge_length", 15000)) + + # step.2 compute asr model + model = self.model + deep_update(kwargs, cfg) + batch_size = max(int(kwargs.get("batch_size_s", 300)) * 1000, 1) + batch_size_threshold_ms = int(kwargs.get("batch_size_threshold_s", 60)) * 1000 + kwargs["batch_size"] = batch_size + + key_list, data_list = prepare_data_iterator( + input, input_len=input_len, data_type=kwargs.get("data_type", None) + ) + results_ret_list = [] + time_speech_total_all_samples = 1e-6 + + beg_total = time.time() + pbar_total = ( + tqdm(colour="red", total=len(res), dynamic_ncols=True) + if not kwargs.get("disable_pbar", False) + else None + ) + for i in range(len(res)): + key = res[i]["key"] + vadsegments = res[i]["value"] + input_i = data_list[i] + fs = kwargs["frontend"].fs if hasattr(kwargs["frontend"], "fs") else 16000 + speech = load_audio_text_image_video(input_i, fs=fs, audio_fs=kwargs.get("fs", 16000)) + speech_lengths = len(speech) + n = len(vadsegments) + data_with_index = [(vadsegments[i], i) for i in range(n)] + sorted_data = sorted(data_with_index, key=lambda x: x[0][1] - x[0][0]) + results_sorted = [] + + if not len(sorted_data): + logging.info("decoding, utt: {}, empty speech".format(key)) + continue + + if len(sorted_data) > 0 and len(sorted_data[0]) > 0: + batch_size = max(batch_size, sorted_data[0][0][1] - sorted_data[0][0][0]) + + beg_idx = 0 + beg_asr_total = time.time() + time_speech_total_per_sample = speech_lengths / 16000 + time_speech_total_all_samples += time_speech_total_per_sample + + # pbar_sample = tqdm(colour="blue", total=n, dynamic_ncols=True) + + all_segments = [] + max_len_in_batch = 0 + end_idx = 1 + for j, _ in enumerate(range(0, n)): + # pbar_sample.update(1) + sample_length = sorted_data[j][0][1] - sorted_data[j][0][0] + potential_batch_length = max(max_len_in_batch, sample_length) * (j + 1 - beg_idx) + # batch_size_ms_cum += sorted_data[j][0][1] - sorted_data[j][0][0] + if ( + j < n - 1 + and sample_length < batch_size_threshold_ms + and potential_batch_length < batch_size + ): + max_len_in_batch = max(max_len_in_batch, sample_length) + end_idx += 1 + continue + + speech_j, speech_lengths_j = slice_padding_audio_samples( + speech, speech_lengths, sorted_data[beg_idx:end_idx] + ) + results = self.inference( + speech_j, input_len=None, model=model, kwargs=kwargs, **cfg + ) + if self.spk_model is not None: + # compose vad segments: [[start_time_sec, end_time_sec, speech], [...]] + for _b in range(len(speech_j)): + vad_segments = [ + [ + sorted_data[beg_idx:end_idx][_b][0][0] / 1000.0, + sorted_data[beg_idx:end_idx][_b][0][1] / 1000.0, + np.array(speech_j[_b]), + ] + ] + segments = sv_chunk(vad_segments) + all_segments.extend(segments) + speech_b = [i[2] for i in segments] + spk_res = self.inference( + speech_b, input_len=None, model=self.spk_model, kwargs=kwargs, **cfg + ) + results[_b]["spk_embedding"] = spk_res[0]["spk_embedding"] + beg_idx = end_idx + end_idx += 1 + max_len_in_batch = sample_length + if len(results) < 1: + continue + results_sorted.extend(results) + + # end_asr_total = time.time() + # time_escape_total_per_sample = end_asr_total - beg_asr_total + # pbar_sample.update(1) + # pbar_sample.set_description(f"rtf_avg_per_sample: {time_escape_total_per_sample / time_speech_total_per_sample:0.3f}, " + # f"time_speech_total_per_sample: {time_speech_total_per_sample: 0.3f}, " + # f"time_escape_total_per_sample: {time_escape_total_per_sample:0.3f}") + + restored_data = [0] * n + for j in range(n): + index = sorted_data[j][1] + restored_data[index] = results_sorted[j] + result = {} + + # results combine for texts, timestamps, speaker embeddings and others + # TODO: rewrite for clean code + for j in range(n): + for k, v in restored_data[j].items(): + if k.startswith("timestamp"): + if k not in result: + result[k] = [] + for t in restored_data[j][k]: + t[0] += vadsegments[j][0] + t[1] += vadsegments[j][0] + result[k].extend(restored_data[j][k]) + elif k == "spk_embedding": + if k not in result: + result[k] = restored_data[j][k] + else: + result[k] = torch.cat([result[k], restored_data[j][k]], dim=0) + elif "text" in k: + if k not in result: + result[k] = restored_data[j][k] + else: + result[k] += " " + restored_data[j][k] + else: + if k not in result: + result[k] = restored_data[j][k] + else: + result[k] += restored_data[j][k] + + return_raw_text = kwargs.get("return_raw_text", False) + # step.3 compute punc model + if self.punc_model is not None: + if not len(result["text"].strip()): + if return_raw_text: + result["raw_text"] = "" + else: + deep_update(self.punc_kwargs, cfg) + punc_res = self.inference( + result["text"], model=self.punc_model, kwargs=self.punc_kwargs, **cfg + ) + raw_text = copy.copy(result["text"]) + if return_raw_text: + result["raw_text"] = raw_text + result["text"] = punc_res[0]["text"] + else: + raw_text = None + + # speaker embedding cluster after resorted + if self.spk_model is not None and kwargs.get("return_spk_res", True): + if raw_text is None: + logging.error("Missing punc_model, which is required by spk_model.") + all_segments = sorted(all_segments, key=lambda x: x[0]) + spk_embedding = result["spk_embedding"] + labels = self.cb_model( + spk_embedding.cpu(), oracle_num=kwargs.get("preset_spk_num", None) + ) + # del result['spk_embedding'] + sv_output = postprocess(all_segments, None, labels, spk_embedding.cpu()) + if self.spk_mode == "vad_segment": # recover sentence_list + sentence_list = [] + for res, vadsegment in zip(restored_data, vadsegments): + if "timestamp" not in res: + logging.error( + "Only 'iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch' \ + and 'iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch'\ + can predict timestamp, and speaker diarization relies on timestamps." + ) + sentence_list.append( + { + "start": vadsegment[0], + "end": vadsegment[1], + "sentence": res["text"], + "timestamp": res["timestamp"], + } + ) + elif self.spk_mode == "punc_segment": + if "timestamp" not in result: + logging.error( + "Only 'iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch' \ + and 'iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch'\ + can predict timestamp, and speaker diarization relies on timestamps." + ) + sentence_list = timestamp_sentence( + punc_res[0]["punc_array"], + result["timestamp"], + raw_text, + return_raw_text=return_raw_text, + ) + distribute_spk(sentence_list, sv_output) + result["sentence_info"] = sentence_list + elif kwargs.get("sentence_timestamp", False): + if not len(result["text"].strip()): + sentence_list = [] + else: + sentence_list = timestamp_sentence( + punc_res[0]["punc_array"], + result["timestamp"], + raw_text, + return_raw_text=return_raw_text, + ) + result["sentence_info"] = sentence_list + if "spk_embedding" in result: + del result["spk_embedding"] + + result["key"] = key + results_ret_list.append(result) + end_asr_total = time.time() + time_escape_total_per_sample = end_asr_total - beg_asr_total + if pbar_total: + pbar_total.update(1) + pbar_total.set_description( + f"rtf_avg: {time_escape_total_per_sample / time_speech_total_per_sample:0.3f}, " + f"time_speech: {time_speech_total_per_sample: 0.3f}, " + f"time_escape: {time_escape_total_per_sample:0.3f}" + ) + + # end_total = time.time() + # time_escape_total_all_samples = end_total - beg_total + # print(f"rtf_avg_all: {time_escape_total_all_samples / time_speech_total_all_samples:0.3f}, " + # f"time_speech_all: {time_speech_total_all_samples: 0.3f}, " + # f"time_escape_all: {time_escape_total_all_samples:0.3f}") + return results_ret_list + + def export(self, input=None, **cfg): + """ + + :param input: + :param type: + :param quantize: + :param fallback_num: + :param calib_num: + :param opset_version: + :param cfg: + :return: + """ + + device = cfg.get("device", "cpu") + model = self.model.to(device=device) + kwargs = self.kwargs + deep_update(kwargs, cfg) + kwargs["device"] = device + del kwargs["model"] + model.eval() + + type = kwargs.get("type", "onnx") + + key_list, data_list = prepare_data_iterator( + input, input_len=None, data_type=kwargs.get("data_type", None), key=None + ) + + with torch.no_grad(): + + if type == "onnx": + export_dir = export_utils.export_onnx(model=model, data_in=data_list, **kwargs) + else: + export_dir = export_utils.export_torchscripts( + model=model, data_in=data_list, **kwargs + ) + + return export_dir diff --git a/funasr/auto/auto_tokenizer.py b/funasr/auto/auto_tokenizer.py new file mode 100644 index 0000000..59ff889 --- /dev/null +++ b/funasr/auto/auto_tokenizer.py @@ -0,0 +1,7 @@ +class AutoTokenizer: + """ + Undo + """ + + def __init__(self): + pass diff --git a/funasr/bin/__init__.py b/funasr/bin/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/bin/compute_audio_cmvn.py b/funasr/bin/compute_audio_cmvn.py new file mode 100644 index 0000000..91bb2ac --- /dev/null +++ b/funasr/bin/compute_audio_cmvn.py @@ -0,0 +1,135 @@ +import os +import json +import numpy as np +import torch +import hydra +import logging +from omegaconf import DictConfig, OmegaConf + +from funasr.register import tables +from funasr.download.download_from_hub import download_model +from funasr.train_utils.set_all_random_seed import set_all_random_seed + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(kwargs: DictConfig): + if kwargs.get("debug", False): + import pdb + + pdb.set_trace() + + assert "model" in kwargs + if "model_conf" not in kwargs: + logging.info("download models from model hub: {}".format(kwargs.get("hub", "ms"))) + kwargs = download_model(is_training=kwargs.get("is_training", True), **kwargs) + + main(**kwargs) + + +def main(**kwargs): + print(kwargs) + # set random seed + # tables.print() + set_all_random_seed(kwargs.get("seed", 0)) + torch.backends.cudnn.enabled = kwargs.get("cudnn_enabled", torch.backends.cudnn.enabled) + torch.backends.cudnn.benchmark = kwargs.get("cudnn_benchmark", torch.backends.cudnn.benchmark) + torch.backends.cudnn.deterministic = kwargs.get("cudnn_deterministic", True) + + tokenizer = kwargs.get("tokenizer", None) + + # build frontend if frontend is none None + frontend = kwargs.get("frontend", None) + if frontend is not None: + frontend_class = tables.frontend_classes.get(frontend) + frontend = frontend_class(**kwargs["frontend_conf"]) + kwargs["frontend"] = frontend + kwargs["input_size"] = frontend.output_size() + + # dataset + dataset_class = tables.dataset_classes.get(kwargs.get("dataset", "AudioDataset")) + dataset_train = dataset_class( + kwargs.get("train_data_set_list"), + frontend=frontend, + tokenizer=None, + is_training=False, + **kwargs.get("dataset_conf") + ) + + # dataloader + batch_sampler = kwargs["dataset_conf"].get("batch_sampler", "BatchSampler") + batch_sampler_class = tables.batch_sampler_classes.get(batch_sampler) + dataset_conf = kwargs.get("dataset_conf") + dataset_conf["batch_type"] = "example" + dataset_conf["batch_size"] = 1 + dataset_conf["num_workers"] = os.cpu_count() or 32 + batch_sampler_train = batch_sampler_class(dataset_train, is_training=False, **dataset_conf) + + dataloader_train = torch.utils.data.DataLoader( + dataset_train, collate_fn=dataset_train.collator, **batch_sampler_train + ) + + iter_stop = int(kwargs.get("scale", 1.0) * len(dataloader_train)) + + total_frames = 0 + for batch_idx, batch in enumerate(dataloader_train): + if batch_idx >= iter_stop: + break + + fbank = batch["speech"].numpy()[0, :, :] + if total_frames == 0: + mean_stats = np.sum(fbank, axis=0) + var_stats = np.sum(np.square(fbank), axis=0) + else: + mean_stats += np.sum(fbank, axis=0) + var_stats += np.sum(np.square(fbank), axis=0) + total_frames += fbank.shape[0] + + cmvn_info = { + "mean_stats": list(mean_stats.tolist()), + "var_stats": list(var_stats.tolist()), + "total_frames": total_frames, + } + cmvn_file = kwargs.get("cmvn_file", "cmvn.json") + # import pdb;pdb.set_trace() + with open(cmvn_file, "w") as fout: + fout.write(json.dumps(cmvn_info)) + + mean = -1.0 * mean_stats / total_frames + var = 1.0 / np.sqrt(var_stats / total_frames - mean * mean) + dims = mean.shape[0] + am_mvn = os.path.dirname(cmvn_file) + "/am.mvn" + with open(am_mvn, "w") as fout: + fout.write( + "" + + "\n" + + " " + + str(dims) + + " " + + str(dims) + + "\n" + + "[ 0 ]" + + "\n" + + " " + + str(dims) + + " " + + str(dims) + + "\n" + ) + mean_str = str(list(mean)).replace(",", "").replace("[", "[ ").replace("]", " ]") + fout.write(" 0 " + mean_str + "\n") + fout.write(" " + str(dims) + " " + str(dims) + "\n") + var_str = str(list(var)).replace(",", "").replace("[", "[ ").replace("]", " ]") + fout.write(" 0 " + var_str + "\n") + fout.write("" + "\n") + + +""" +python funasr/bin/compute_audio_cmvn.py \ +--config-path "/Users/zhifu/funasr1.0/examples/aishell/paraformer/conf" \ +--config-name "train_asr_paraformer_conformer_12e_6d_2048_256.yaml" \ +++train_data_set_list="/Users/zhifu/funasr1.0/data/list/audio_datasets.jsonl" \ +++cmvn_file="/Users/zhifu/funasr1.0/data/list/cmvn.json" \ +++dataset_conf.num_workers=0 +""" +if __name__ == "__main__": + main_hydra() diff --git a/funasr/bin/export.py b/funasr/bin/export.py new file mode 100644 index 0000000..9d01401 --- /dev/null +++ b/funasr/bin/export.py @@ -0,0 +1,42 @@ +import os +import hydra +import logging +from omegaconf import DictConfig, OmegaConf, ListConfig + +from funasr.auto.auto_model import AutoModel + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(cfg: DictConfig): + def to_plain_list(cfg_item): + if isinstance(cfg_item, ListConfig): + return OmegaConf.to_container(cfg_item, resolve=True) + elif isinstance(cfg_item, DictConfig): + return {k: to_plain_list(v) for k, v in cfg_item.items()} + else: + return cfg_item + + kwargs = to_plain_list(cfg) + + if kwargs.get("debug", False): + import pdb + + pdb.set_trace() + + if "device" not in kwargs: + kwargs["device"] = "cpu" + model = AutoModel(**kwargs) + + res = model.export( + input=kwargs.get("input", None), + type=kwargs.get("type", "onnx"), + quantize=kwargs.get("quantize", False), + fallback_num=kwargs.get("fallback-num", 5), + calib_num=kwargs.get("calib_num", 100), + opset_version=kwargs.get("opset_version", 14), + ) + print(res) + + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/bin/inference.py b/funasr/bin/inference.py new file mode 100644 index 0000000..39ee5c0 --- /dev/null +++ b/funasr/bin/inference.py @@ -0,0 +1,30 @@ +import hydra +import logging +from omegaconf import DictConfig, OmegaConf, ListConfig + +from funasr.auto.auto_model import AutoModel + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(cfg: DictConfig): + def to_plain_list(cfg_item): + if isinstance(cfg_item, ListConfig): + return OmegaConf.to_container(cfg_item, resolve=True) + elif isinstance(cfg_item, DictConfig): + return {k: to_plain_list(v) for k, v in cfg_item.items()} + else: + return cfg_item + + kwargs = to_plain_list(cfg) + + if kwargs.get("debug", False): + import pdb + + pdb.set_trace() + model = AutoModel(**kwargs) + res = model.generate(input=kwargs["input"]) + print(res) + + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/bin/tokenize_text.py b/funasr/bin/tokenize_text.py new file mode 100644 index 0000000..8c2aae0 --- /dev/null +++ b/funasr/bin/tokenize_text.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python3 +import argparse +from collections import Counter +import logging +from pathlib import Path +import sys +from typing import List +from typing import Optional + + +from funasr.utils.cli_utils import get_commandline_args +from funasr.tokenizer.build_tokenizer import build_tokenizer +from funasr.tokenizer.cleaner import TextCleaner +from funasr.tokenizer.phoneme_tokenizer import g2p_classes +from funasr.utils.types import str2bool +from funasr.utils.types import str_or_none + + +def field2slice(field: Optional[str]) -> slice: + """Convert field string to slice + + Note that field string accepts 1-based integer. + + Examples: + >>> field2slice("1-") + slice(0, None, None) + >>> field2slice("1-3") + slice(0, 3, None) + >>> field2slice("-3") + slice(None, 3, None) + """ + field = field.strip() + try: + if "-" in field: + # e.g. "2-" or "2-5" or "-7" + s1, s2 = field.split("-", maxsplit=1) + if s1.strip() == "": + s1 = None + else: + s1 = int(s1) + if s1 == 0: + raise ValueError("1-based string") + if s2.strip() == "": + s2 = None + else: + s2 = int(s2) + else: + # e.g. "2" + s1 = int(field) + s2 = s1 + 1 + if s1 == 0: + raise ValueError("must be 1 or more value") + except ValueError: + raise RuntimeError(f"Format error: e.g. '2-', '2-5', or '-5': {field}") + + if s1 is None: + slic = slice(None, s2) + else: + # -1 because of 1-based integer following "cut" command + # e.g "1-3" -> slice(0, 3) + slic = slice(s1 - 1, s2) + return slic + + +def tokenize( + input: str, + output: str, + field: Optional[str], + delimiter: Optional[str], + token_type: str, + space_symbol: str, + non_linguistic_symbols: Optional[str], + bpemodel: Optional[str], + log_level: str, + write_vocabulary: bool, + vocabulary_size: int, + remove_non_linguistic_symbols: bool, + cutoff: int, + add_symbol: List[str], + cleaner: Optional[str], + g2p: Optional[str], +): + + logging.basicConfig( + level=log_level, + format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s", + ) + if input == "-": + fin = sys.stdin + else: + fin = Path(input).open("r", encoding="utf-8") + if output == "-": + fout = sys.stdout + else: + p = Path(output) + p.parent.mkdir(parents=True, exist_ok=True) + fout = p.open("w", encoding="utf-8") + + cleaner = TextCleaner(cleaner) + tokenizer = build_tokenizer( + token_type=token_type, + bpemodel=bpemodel, + delimiter=delimiter, + space_symbol=space_symbol, + non_linguistic_symbols=non_linguistic_symbols, + remove_non_linguistic_symbols=remove_non_linguistic_symbols, + g2p_type=g2p, + ) + + counter = Counter() + if field is not None: + field = field2slice(field) + + for line in fin: + line = line.rstrip() + if field is not None: + # e.g. field="2-" + # uttidA hello world!! -> hello world!! + tokens = line.split(delimiter) + tokens = tokens[field] + if delimiter is None: + line = " ".join(tokens) + else: + line = delimiter.join(tokens) + + line = cleaner(line) + tokens = tokenizer.text2tokens(line) + if not write_vocabulary: + fout.write(" ".join(tokens) + "\n") + else: + for t in tokens: + counter[t] += 1 + + if not write_vocabulary: + return + + ## FIXME + ## del duplicate add_symbols in counter + for symbol_and_id in add_symbol: + # e.g symbol=":0" + try: + symbol, idx = symbol_and_id.split(":") + except ValueError: + raise RuntimeError(f"Format error: e.g. ':0': {symbol_and_id}") + symbol = symbol.strip() + if symbol in counter: + del counter[symbol] + + # ======= write_vocabulary mode from here ======= + # Sort by the number of occurrences in descending order + # and filter lower frequency words than cutoff value + words_and_counts = list( + filter(lambda x: x[1] > cutoff, sorted(counter.items(), key=lambda x: -x[1])) + ) + # Restrict the vocabulary size + if vocabulary_size > 0: + if vocabulary_size < len(add_symbol): + raise RuntimeError(f"vocabulary_size is too small: {vocabulary_size}") + words_and_counts = words_and_counts[: vocabulary_size - len(add_symbol)] + + # Parse the values of --add_symbol + for symbol_and_id in add_symbol: + # e.g symbol=":0" + try: + symbol, idx = symbol_and_id.split(":") + idx = int(idx) + except ValueError: + raise RuntimeError(f"Format error: e.g. ':0': {symbol_and_id}") + symbol = symbol.strip() + + # e.g. idx=0 -> append as the first symbol + # e.g. idx=-1 -> append as the last symbol + if idx < 0: + idx = len(words_and_counts) + 1 + idx + words_and_counts.insert(idx, (symbol, None)) + + # Write words + for w, c in words_and_counts: + fout.write(w + "\n") + + # Logging + total_count = sum(counter.values()) + invocab_count = sum(c for w, c in words_and_counts if c is not None) + logging.info(f"OOV rate = {(total_count - invocab_count) / total_count * 100} %") + + +def get_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + description="Tokenize texts", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.add_argument( + "--log_level", + type=lambda x: x.upper(), + default="INFO", + choices=("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "NOTSET"), + help="The verbose level of logging", + ) + + parser.add_argument("--input", "-i", required=True, help="Input text. - indicates sys.stdin") + parser.add_argument("--output", "-o", required=True, help="Output text. - indicates sys.stdout") + parser.add_argument( + "--field", + "-f", + help="The target columns of the input text as 1-based integer. e.g 2-", + ) + parser.add_argument( + "--token_type", + "-t", + default="char", + choices=["char", "bpe", "word", "phn"], + help="Token type", + ) + parser.add_argument("--delimiter", "-d", default=None, help="The delimiter") + parser.add_argument("--space_symbol", default="", help="The space symbol") + parser.add_argument("--bpemodel", default=None, help="The bpemodel file path") + parser.add_argument( + "--non_linguistic_symbols", + type=str_or_none, + help="non_linguistic_symbols file path", + ) + parser.add_argument( + "--remove_non_linguistic_symbols", + type=str2bool, + default=False, + help="Remove non-language-symbols from tokens", + ) + parser.add_argument( + "--cleaner", + type=str_or_none, + choices=[None, "tacotron", "jaconv", "vietnamese", "korean_cleaner"], + default=None, + help="Apply text cleaning", + ) + parser.add_argument( + "--g2p", + type=str_or_none, + choices=g2p_classes, + default=None, + help="Specify g2p method if --token_type=phn", + ) + + group = parser.add_argument_group("write_vocabulary mode related") + group.add_argument( + "--write_vocabulary", + type=str2bool, + default=False, + help="Write tokens list instead of tokenized text per line", + ) + group.add_argument("--vocabulary_size", type=int, default=0, help="Vocabulary size") + group.add_argument( + "--cutoff", + default=0, + type=int, + help="cut-off frequency used for write-vocabulary mode", + ) + group.add_argument( + "--add_symbol", + type=str, + default=[], + action="append", + help="Append symbol e.g. --add_symbol ':0' --add_symbol ':1'", + ) + + return parser + + +def main(cmd=None): + print(get_commandline_args(), file=sys.stderr) + parser = get_parser() + args = parser.parse_args(cmd) + kwargs = vars(args) + tokenize(**kwargs) + + +if __name__ == "__main__": + main() diff --git a/funasr/bin/train.py b/funasr/bin/train.py new file mode 100644 index 0000000..c3556d1 --- /dev/null +++ b/funasr/bin/train.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- + +import os +import sys +import torch +import torch.nn as nn +import hydra +import logging +import time +import argparse +from io import BytesIO + +from contextlib import nullcontext +import torch.distributed as dist + +from omegaconf import DictConfig, OmegaConf +from torch.cuda.amp import autocast, GradScaler +from torch.nn.parallel import DistributedDataParallel as DDP +from torch.distributed.fsdp import FullyShardedDataParallel as FSDP +from torch.distributed.algorithms.join import Join +from torch.distributed.fsdp.sharded_grad_scaler import ShardedGradScaler +from funasr.train_utils.average_nbest_models import average_checkpoints + +from funasr.register import tables +from funasr.optimizers import optim_classes +from funasr.train_utils.trainer import Trainer +from funasr.schedulers import scheduler_classes +from funasr.train_utils.initialize import initialize +from funasr.download.download_from_hub import download_model +from funasr.models.lora.utils import mark_only_lora_as_trainable +from funasr.train_utils.set_all_random_seed import set_all_random_seed +from funasr.train_utils.load_pretrained_model import load_pretrained_model +from funasr.utils.misc import prepare_model_dir +from funasr.train_utils.model_summary import model_summary +from funasr import AutoModel + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(kwargs: DictConfig): + if kwargs.get("debug", False): + import pdb + + pdb.set_trace() + + assert "model" in kwargs + if "model_conf" not in kwargs: + logging.info("download models from model hub: {}".format(kwargs.get("hub", "ms"))) + kwargs = download_model(is_training=kwargs.get("is_training", True), **kwargs) + + main(**kwargs) + + +def main(**kwargs): + + # set random seed + set_all_random_seed(kwargs.get("seed", 0)) + torch.backends.cudnn.enabled = kwargs.get("cudnn_enabled", torch.backends.cudnn.enabled) + torch.backends.cudnn.benchmark = kwargs.get("cudnn_benchmark", torch.backends.cudnn.benchmark) + torch.backends.cudnn.deterministic = kwargs.get("cudnn_deterministic", True) + # open tf32 + torch.backends.cuda.matmul.allow_tf32 = kwargs.get("enable_tf32", True) + + local_rank = int(os.environ.get("LOCAL_RANK", 0)) + if local_rank == 0: + tables.print() + # Check if we are using DDP or FSDP + use_ddp = "WORLD_SIZE" in os.environ and int(os.environ["WORLD_SIZE"]) > 1 + use_fsdp = kwargs.get("use_fsdp", False) + # use_ddp = False if use_fsdp else use_fsdp + if use_ddp or use_fsdp: + dist.init_process_group(backend=kwargs.get("backend", "nccl"), init_method="env://") + torch.cuda.set_device(local_rank) + + logging.info("Build model, frontend, tokenizer") + device = kwargs.get("device", "cuda") + kwargs["device"] = "cpu" + model = AutoModel(**kwargs) + + # save config.yaml + if ( + (use_ddp or use_fsdp) + and dist.get_rank() == 0 + or not (use_ddp or use_fsdp) + and local_rank == 0 + ): + prepare_model_dir(**kwargs) + + # parse kwargs + kwargs = model.kwargs + kwargs["device"] = device + tokenizer = kwargs["tokenizer"] + frontend = kwargs["frontend"] + model = model.model + del kwargs["model"] + + # freeze_param + freeze_param = kwargs.get("freeze_param", None) + if freeze_param is not None: + if "," in freeze_param: + freeze_param = eval(freeze_param) + if not isinstance(freeze_param, (list, tuple)): + freeze_param = (freeze_param,) + logging.info("freeze_param is not None: %s", freeze_param) + for t in freeze_param: + for k, p in model.named_parameters(): + if k.startswith(t + ".") or k == t: + logging.info(f"Setting {k}.requires_grad = False") + p.requires_grad = False + if local_rank == 0: + logging.info(f"{model_summary(model)}") + + if use_ddp: + model = model.cuda(local_rank) + model = DDP( + model, + device_ids=[local_rank], + find_unused_parameters=kwargs.get("train_conf", {}).get( + "find_unused_parameters", False + ), + ) + elif use_fsdp: + # model = FSDP(model).cuda(local_rank) + + def custom_auto_wrap_policy( + module: nn.Module, + recurse: bool, + nonwrapped_numel: int, + # Additional custom arguments + min_num_params: int = int(1e8), + ) -> bool: + # 根据自定义逻辑决定是否包装模块 + is_large = unwrapped_params >= min_num_params + requires_grad_uniform = len({p.requires_grad for p in module.parameters()}) == 1 + return is_large and requires_grad_uniform + + # Configure a custom `min_num_params` + my_auto_wrap_policy = functools.partial(custom_auto_wrap_policy, min_num_params=int(1e5)) + torch.cuda.set_device(local_rank) + model = FSDP( + model, + auto_wrap_policy=custom_auto_wrap_policy, + mixed_precision=None, + device_id=torch.cuda.current_device(), + ) + else: + model = model.to(device=kwargs.get("device", "cuda")) + + kwargs["device"] = next(model.parameters()).device + + # optim + logging.info("Build optim") + optim = kwargs.get("optim", "adam") + assert optim in optim_classes + optim_class = optim_classes.get(optim) + optim = optim_class(model.parameters(), **kwargs.get("optim_conf")) + + # scheduler + logging.info("Build scheduler") + scheduler = kwargs.get("scheduler", "warmuplr") + assert scheduler in scheduler_classes + scheduler_class = scheduler_classes.get(scheduler) + scheduler = scheduler_class(optim, **kwargs.get("scheduler_conf")) + + # dataset + logging.info("Build dataloader") + dataloader_class = tables.dataloader_classes.get( + kwargs["dataset_conf"].get("dataloader", "DataloaderMapStyle") + ) + dataloader = dataloader_class(**kwargs) + # dataloader_tr, dataloader_val = dataloader_class(**kwargs) + trainer = Trainer( + local_rank=local_rank, + use_ddp=use_ddp, + use_fsdp=use_fsdp, + device=kwargs["device"], + output_dir=kwargs.get("output_dir", "./exp"), + **kwargs.get("train_conf"), + ) + + scaler = GradScaler(enabled=trainer.use_fp16) if trainer.use_fp16 else None + scaler = ShardedGradScaler(enabled=trainer.use_fp16) if trainer.use_fsdp else scaler + + trainer.resume_checkpoint( + model=model, + optim=optim, + scheduler=scheduler, + scaler=scaler, + ) + + tensorboard_dir = os.path.join(kwargs.get("output_dir"), "tensorboard") + os.makedirs(tensorboard_dir, exist_ok=True) + try: + from tensorboardX import SummaryWriter + + writer = SummaryWriter(tensorboard_dir) # if trainer.rank == 0 else None + except: + writer = None + + dataloader_tr, dataloader_val = None, None + for epoch in range(trainer.start_epoch, trainer.max_epoch): + time1 = time.perf_counter() + + for data_split_i in range(trainer.start_data_split_i, dataloader.data_split_num): + dataloader_tr, dataloader_val = dataloader.build_iter( + epoch, data_split_i=data_split_i, start_step=trainer.start_step + ) + + trainer.train_epoch( + model=model, + optim=optim, + scheduler=scheduler, + scaler=scaler, + dataloader_train=dataloader_tr, + dataloader_val=dataloader_val, + epoch=epoch, + writer=writer, + data_split_i=data_split_i, + data_split_num=dataloader.data_split_num, + start_step=trainer.start_step, + ) + trainer.start_step = 0 + + torch.cuda.empty_cache() + + trainer.start_data_split_i = 0 + trainer.validate_epoch( + model=model, dataloader_val=dataloader_val, epoch=epoch + 1, writer=writer + ) + scheduler.step() + trainer.step_in_epoch = 0 + trainer.save_checkpoint( + epoch + 1, model=model, optim=optim, scheduler=scheduler, scaler=scaler + ) + + time2 = time.perf_counter() + time_escaped = (time2 - time1) / 3600.0 + logging.info( + f"rank: {local_rank}, " + f"time_escaped_epoch: {time_escaped:.3f} hours, " + f"estimated to finish {trainer.max_epoch} " + f"epoch: {(trainer.max_epoch - epoch) * time_escaped:.3f} hours\n" + ) + trainer.train_acc_avg = 0.0 + trainer.train_loss_avg = 0.0 + + if trainer.rank == 0: + average_checkpoints(trainer.output_dir, trainer.avg_nbest_model) + + trainer.close() + + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/bin/train_ds.py b/funasr/bin/train_ds.py new file mode 100644 index 0000000..e4db533 --- /dev/null +++ b/funasr/bin/train_ds.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- + +import os +import sys +import torch +import torch.nn as nn +import hydra +import logging +import time +import argparse +from io import BytesIO + +from contextlib import nullcontext +import torch.distributed as dist + +from omegaconf import DictConfig, OmegaConf +from torch.cuda.amp import autocast, GradScaler +from torch.nn.parallel import DistributedDataParallel as DDP +from torch.distributed.fsdp import FullyShardedDataParallel as FSDP +from torch.distributed.algorithms.join import Join +from torch.distributed.fsdp.sharded_grad_scaler import ShardedGradScaler +from funasr.train_utils.average_nbest_models import average_checkpoints + +from funasr.register import tables +from funasr.optimizers import optim_classes +from funasr.train_utils.trainer_ds import Trainer +from funasr.schedulers import scheduler_classes +from funasr.train_utils.initialize import initialize +from funasr.download.download_from_hub import download_model +from funasr.models.lora.utils import mark_only_lora_as_trainable +from funasr.train_utils.set_all_random_seed import set_all_random_seed +from funasr.train_utils.load_pretrained_model import load_pretrained_model +from funasr.utils.misc import prepare_model_dir +from funasr.train_utils.model_summary import model_summary +from funasr import AutoModel + +try: + import deepspeed +except: + deepspeed = None + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(kwargs: DictConfig): + if kwargs.get("debug", False): + import pdb + + pdb.set_trace() + + assert "model" in kwargs + if "model_conf" not in kwargs: + logging.info("download models from model hub: {}".format(kwargs.get("hub", "ms"))) + kwargs = download_model(is_training=kwargs.get("is_training", True), **kwargs) + + main(**kwargs) + + +def main(**kwargs): + + # set random seed + set_all_random_seed(kwargs.get("seed", 0)) + torch.backends.cudnn.enabled = kwargs.get("cudnn_enabled", torch.backends.cudnn.enabled) + torch.backends.cudnn.benchmark = kwargs.get("cudnn_benchmark", torch.backends.cudnn.benchmark) + torch.backends.cudnn.deterministic = kwargs.get("cudnn_deterministic", True) + # open tf32 + torch.backends.cuda.matmul.allow_tf32 = kwargs.get("enable_tf32", True) + + rank = int(os.environ.get("RANK", 0)) + local_rank = int(os.environ.get("LOCAL_RANK", 0)) + world_size = int(os.environ.get("WORLD_SIZE", 1)) + + if local_rank == 0: + tables.print() + + use_ddp = world_size > 1 + use_fsdp = kwargs.get("use_fsdp", False) + use_deepspeed = kwargs.get("use_deepspeed", False) + if use_deepspeed: + logging.info(f"use_deepspeed: {use_deepspeed}") + deepspeed.init_distributed(dist_backend=kwargs.get("backend", "nccl")) + elif use_ddp or use_fsdp: + logging.info(f"use_ddp: {use_ddp}, use_fsdp: {use_fsdp}") + dist.init_process_group(backend=kwargs.get("backend", "nccl"), init_method="env://") + torch.cuda.set_device(local_rank) + + logging.info("Build model, frontend, tokenizer") + device = kwargs.get("device", "cuda") + kwargs["device"] = "cpu" + model = AutoModel(**kwargs) + + # save config.yaml + if rank == 0: + prepare_model_dir(**kwargs) + + # parse kwargs + kwargs = model.kwargs + kwargs["device"] = device + tokenizer = kwargs["tokenizer"] + frontend = kwargs["frontend"] + model = model.model + del kwargs["model"] + + # freeze_param + freeze_param = kwargs.get("freeze_param", None) + if freeze_param is not None: + if "," in freeze_param: + freeze_param = eval(freeze_param) + if not isinstance(freeze_param, (list, tuple)): + freeze_param = (freeze_param,) + logging.info("freeze_param is not None: %s", freeze_param) + for t in freeze_param: + for k, p in model.named_parameters(): + if k.startswith(t + ".") or k == t: + logging.info(f"Setting {k}.requires_grad = False") + p.requires_grad = False + if local_rank == 0: + logging.info(f"{model_summary(model)}") + + trainer = Trainer( + rank=rank, + local_rank=local_rank, + world_size=world_size, + use_ddp=use_ddp, + use_fsdp=use_fsdp, + device=kwargs["device"], + output_dir=kwargs.get("output_dir", "./exp"), + **kwargs.get("train_conf"), + ) + + model = trainer.warp_model(model) + + kwargs["device"] = next(model.parameters()).device + trainer.device = kwargs["device"] + + # optim + logging.info("Build optim") + optim = kwargs.get("optim", "adam") + assert optim in optim_classes + optim_class = optim_classes.get(optim) + optim = optim_class(model.parameters(), **kwargs.get("optim_conf")) + + # scheduler + logging.info("Build scheduler") + scheduler = kwargs.get("scheduler", "warmuplr") + assert scheduler in scheduler_classes + scheduler_class = scheduler_classes.get(scheduler) + scheduler = scheduler_class(optim, **kwargs.get("scheduler_conf")) + + if use_deepspeed: + args = OmegaConf.create({"deepspeed_config": kwargs.get("deepspeed_config", "")}) + model, optimizer, _, scheduler = deepspeed.initialize( + args=args, + model=model, + optimizer=optim, + lr_scheduler=scheduler, + model_parameters=model.parameters(), + ) + + # dataset + logging.info("Build dataloader") + dataloader_class = tables.dataloader_classes.get( + kwargs["dataset_conf"].get("dataloader", "DataloaderMapStyle") + ) + dataloader = dataloader_class(**kwargs) + # dataloader_tr, dataloader_val = dataloader_class(**kwargs) + + scaler = GradScaler(enabled=trainer.use_fp16) if trainer.use_fp16 else None + scaler = ShardedGradScaler(enabled=trainer.use_fp16) if trainer.use_fsdp else scaler + + trainer.resume_checkpoint( + model=model, + optim=optim, + scheduler=scheduler, + scaler=scaler, + ) + + tensorboard_dir = os.path.join(kwargs.get("output_dir"), "tensorboard") + os.makedirs(tensorboard_dir, exist_ok=True) + try: + from tensorboardX import SummaryWriter + + writer = SummaryWriter(tensorboard_dir) # if trainer.rank == 0 else None + except: + writer = None + + dataloader_tr, dataloader_val = None, None + for epoch in range(trainer.start_epoch, trainer.max_epoch): + time1 = time.perf_counter() + + for data_split_i in range(trainer.start_data_split_i, dataloader.data_split_num): + dataloader_tr, dataloader_val = dataloader.build_iter( + epoch, data_split_i=data_split_i, start_step=trainer.start_step + ) + + trainer.train_epoch( + model=model, + optim=optim, + scheduler=scheduler, + scaler=scaler, + dataloader_train=dataloader_tr, + dataloader_val=dataloader_val, + epoch=epoch, + writer=writer, + data_split_i=data_split_i, + data_split_num=dataloader.data_split_num, + start_step=trainer.start_step, + ) + trainer.start_step = 0 + + torch.cuda.empty_cache() + + trainer.start_data_split_i = 0 + trainer.validate_epoch( + model=model, dataloader_val=dataloader_val, epoch=epoch + 1, writer=writer + ) + scheduler.step() + trainer.step_in_epoch = 0 + trainer.save_checkpoint( + epoch + 1, model=model, optim=optim, scheduler=scheduler, scaler=scaler + ) + + time2 = time.perf_counter() + time_escaped = (time2 - time1) / 3600.0 + logging.info( + f"rank: {local_rank}, " + f"time_escaped_epoch: {time_escaped:.3f} hours, " + f"estimated to finish {trainer.max_epoch} " + f"epoch: {(trainer.max_epoch - epoch) * time_escaped:.3f} hours\n" + ) + trainer.train_acc_avg = 0.0 + trainer.train_loss_avg = 0.0 + + if trainer.rank == 0: + average_checkpoints(trainer.output_dir, trainer.avg_nbest_model) + + trainer.close() + + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/datasets/__init__.py b/funasr/datasets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/audio_datasets/__init__.py b/funasr/datasets/audio_datasets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/audio_datasets/datasets.py b/funasr/datasets/audio_datasets/datasets.py new file mode 100644 index 0000000..2aafde3 --- /dev/null +++ b/funasr/datasets/audio_datasets/datasets.py @@ -0,0 +1,260 @@ +import torch +import random + +from funasr.register import tables +from funasr.utils.load_utils import extract_fbank, load_audio_text_image_video + + +@tables.register("dataset_classes", "AudioDataset") +class AudioDataset(torch.utils.data.Dataset): + """ + AudioDataset + """ + + def __init__( + self, + path, + index_ds: str = None, + frontend=None, + tokenizer=None, + int_pad_value: int = -1, + float_pad_value: float = 0.0, + **kwargs, + ): + super().__init__() + index_ds_class = tables.index_ds_classes.get(index_ds) + self.index_ds = index_ds_class(path, **kwargs) + preprocessor_speech = kwargs.get("preprocessor_speech", None) + if preprocessor_speech: + preprocessor_speech_class = tables.preprocessor_classes.get(preprocessor_speech) + preprocessor_speech = preprocessor_speech_class( + **kwargs.get("preprocessor_speech_conf") + ) + self.preprocessor_speech = preprocessor_speech + preprocessor_text = kwargs.get("preprocessor_text", None) + if preprocessor_text: + preprocessor_text_class = tables.preprocessor_classes.get(preprocessor_text) + preprocessor_text = preprocessor_text_class(**kwargs.get("preprocessor_text_conf")) + self.preprocessor_text = preprocessor_text + + self.frontend = frontend + self.fs = 16000 if frontend is None else frontend.fs + self.data_type = "sound" + self.tokenizer = tokenizer + + self.int_pad_value = int_pad_value + self.float_pad_value = float_pad_value + + def get_source_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_source_len(item) + + def get_target_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_target_len(item) + + def __len__(self): + return len(self.index_ds) + + def __getitem__(self, index): + item = self.index_ds[index] + # import pdb; + # pdb.set_trace() + source = item["source"] + data_src = load_audio_text_image_video(source, fs=self.fs) + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + if self.tokenizer: + ids = self.tokenizer.encode(target) + text = torch.tensor(ids, dtype=torch.int64) + else: + ids = target + text = ids + ids_lengths = len(ids) + text_lengths = torch.tensor([ids_lengths], dtype=torch.int32) + + return { + "speech": speech[0, :, :], + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + } + + def collator(self, samples: list = None): + outputs = {} + for sample in samples: + for key in sample.keys(): + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + return outputs + + +@tables.register("dataset_classes", "AudioDatasetHotword") +class AudioDatasetHotword(AudioDataset): + # for finetuning contextual_paraformer and seaco_paraformer + def __init__( + self, + *args, + seaco_id: bool = 0, + **kwargs, + ): + super().__init__(*args, **kwargs) + self.seaco_id = seaco_id + + def __getitem__(self, index): + item = self.index_ds[index] + # import pdb; + # pdb.set_trace() + source = item["source"] + data_src = load_audio_text_image_video(source, fs=self.fs) + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + if self.tokenizer: + ids = self.tokenizer.encode(target) + text = torch.tensor(ids, dtype=torch.int64) + else: + ids = target + text = ids + ids_lengths = len(ids) + text_lengths = torch.tensor([ids_lengths], dtype=torch.int32) + + def generate_index( + length, + hotword_min_length=2, + hotword_max_length=8, + sample_rate=0.75, + double_rate=0.1, + pre_prob=0.0, + pre_index=None, + pre_hwlist=None, + ): + if length < hotword_min_length: + return [-1] + if random.random() < sample_rate: + if pre_prob > 0 and random.random() < pre_prob and pre_index is not None: + return pre_index + if length == hotword_min_length: + return [0, length - 1] + elif ( + random.random() < double_rate + and length > hotword_max_length + hotword_min_length + 2 + ): + # sample two hotwords in a sentence + _max_hw_length = min(hotword_max_length, length // 2) + # first hotword + start1 = random.randint(0, length // 3) + end1 = random.randint( + start1 + hotword_min_length - 1, start1 + _max_hw_length - 1 + ) + # second hotword + start2 = random.randint(end1 + 1, length - hotword_min_length) + end2 = random.randint( + min(length - 1, start2 + hotword_min_length - 1), + min(length - 1, start2 + hotword_max_length - 1), + ) + return [start1, end1, start2, end2] + else: # single hotword + start = random.randint(0, length - hotword_min_length) + end = random.randint( + min(length - 1, start + hotword_min_length - 1), + min(length - 1, start + hotword_max_length - 1), + ) + return [start, end] + else: + return [-1] + + hotword_indx = generate_index(text_lengths[0]) + return { + "speech": speech[0, :, :], + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + "hotword_indx": hotword_indx, + "seaco_id": self.seaco_id, + } + + def collator(self, samples: list = None): + outputs = {} + hotword_indxs = [] + seaco_id = samples[0]["seaco_id"] + for sample in samples: + for key in sample.keys(): + if key == "seaco_id": + continue + elif key == "hotword_indx": + hotword_indxs.append(sample[key]) + else: + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + + hotword_list, hotword_lengths = [], [] + text = outputs["text"] + seaco_label_pad = torch.ones_like(text) * -1 if seaco_id else None + for b, (hotword_indx, one_text, length) in enumerate( + zip(hotword_indxs, text, outputs["text_lengths"]) + ): + length = length[0] + if seaco_label_pad is not None: + seaco_label_pad[b][:length] = seaco_id + if hotword_indx[0] != -1: + start, end = int(hotword_indx[0]), int(hotword_indx[1]) + hotword = one_text[start : end + 1] + hotword_list.append(hotword) + hotword_lengths.append(end - start + 1) + if seaco_label_pad is not None: + seaco_label_pad[b][start : end + 1] = one_text[start : end + 1] + if len(hotword_indx) == 4 and hotword_indx[2] != -1: + # the second hotword if exist + start, end = int(hotword_indx[2]), int(hotword_indx[3]) + hotword_list.append(one_text[start : end + 1]) + hotword_lengths.append(end - start + 1) + if seaco_label_pad is not None: + seaco_label_pad[b][start : end + 1] = one_text[start : end + 1] + hotword_list.append(torch.tensor([1])) + hotword_lengths.append(1) + hotword_pad = torch.nn.utils.rnn.pad_sequence( + hotword_list, batch_first=True, padding_value=0 + ) + outputs["hotword_pad"] = hotword_pad + outputs["hotword_lengths"] = torch.tensor(hotword_lengths, dtype=torch.int32) + if seaco_label_pad is not None: + outputs["seaco_label_pad"] = seaco_label_pad + return outputs diff --git a/funasr/datasets/audio_datasets/espnet_samplers.py b/funasr/datasets/audio_datasets/espnet_samplers.py new file mode 100644 index 0000000..528f593 --- /dev/null +++ b/funasr/datasets/audio_datasets/espnet_samplers.py @@ -0,0 +1,161 @@ +import torch +import numpy as np +import logging +import math +import torch.distributed as dist +from torch.utils.data import DistributedSampler +from torch.utils.data import BatchSampler, Sampler +import torch.distributed as dist +import random +from funasr.register import tables + + +@tables.register("batch_sampler_classes", "EspnetStyleBatchSampler") +def EspnetStyleBatchSampler_fn(dataset, **kwargs): + dataloader_args = {} + + batch_sampler = EspnetStyleBatchSampler(dataset, **kwargs) + dataloader_args["batch_sampler"] = batch_sampler + dataloader_args["num_workers"] = kwargs.get("num_workers", 4) + dataloader_args["pin_memory"] = kwargs.get("pin_memory", True) + + return dataloader_args + + +import torch +from torch.utils.data import Dataset, DistributedSampler +import math +import random + + +class EspnetStyleBatchSampler(DistributedSampler): + def __init__( + self, + dataset, + batch_size, + batch_type="token", + rank=None, + num_replicas=None, + rank_split=False, + shuffle=True, + drop_last=False, + is_training: bool = True, + sort_size: int = 1024, + start_step: int = 0, + **kwargs, + ): + + try: + rank = dist.get_rank() + num_replicas = dist.get_world_size() + except: + rank = 0 + num_replicas = 1 + # if rank_split: + # logging.info(f"Warning, rank_split: {rank_split}, batch and shuffle data in local rank") + # rank = 0 + # num_replicas = 1 + self.rank = rank + self.num_replicas = num_replicas + self.dataset = dataset + self.batch_size = batch_size + self.batch_type = batch_type + self.is_training = is_training + self.shuffle = shuffle and is_training + self.drop_last = drop_last + + self.total_size = len(self.dataset) + self.num_samples = int(math.ceil(self.total_size / self.num_replicas)) + self.epoch = 0 + self.sort_size = sort_size * num_replicas + self.max_token_length = kwargs.get("max_token_length", 2048) + self.min_token_length = kwargs.get("min_token_length", 0) + self.length_scale_source = kwargs.get("length_scale_source", 1.0) + self.start_step = start_step + if self.start_step > 0: + logging.info(f"Warning, start_step > 0, dataloader start from step: {self.start_step}") + # super().__init__(dataset, num_replicas=num_replicas, rank=rank, + # shuffle=shuffle, drop_last=drop_last) + + def __iter__(self): + if self.shuffle: + g = torch.Generator() + g.manual_seed(self.epoch) + random.seed(self.epoch) + indices = torch.randperm(len(self.dataset), generator=g).tolist() + else: + indices = list(range(len(self.dataset))) + + # Sort indices by sample length + sorted_indices = sorted(indices, key=lambda idx: self.dataset.get_source_len(idx)) + + # Organize batches based on 'length' or 'example' + buffer_batches = [] + batch = [] + max_len_in_batch = 0 # Tracks the max sample length within the current batch + + for idx in sorted_indices: + + # original_sample_length = self.dataset.get_source_len(idx) + # if ( + # original_sample_length < self.min_token_length + # or original_sample_length > self.max_token_length + # ): # Skip samples that exceed the max length + # continue + + # sample_length = 1 if self.batch_type == "example" else original_sample_length + + # Set sample_length based on the batch type + if self.batch_type == "example": + sample_length = 1 + elif self.batch_type == "token": + sample_length = self.dataset.get_source_len(idx) + int( + self.dataset.get_target_len(idx) * 1.2 + ) + else: + sample_length = self.dataset.get_source_len(idx) + # Calculate potential batch size with the new sample + potential_batch_length = max(max_len_in_batch, sample_length) * (len(batch) + 1) + # Add index to batch if it doesn't exceed batch size limit + if potential_batch_length <= self.batch_size: + batch.append(idx) + max_len_in_batch = max(max_len_in_batch, sample_length) + else: + # Save the current batch and start a new one + buffer_batches.append(batch) + batch = [idx] + max_len_in_batch = sample_length + + # Add the last batch if it shouldn't be dropped + if batch and (not self.drop_last or len(batch) * max_len_in_batch == self.batch_size): + buffer_batches.append(batch) + + # Shuffle the list of batches + if self.shuffle: + random.seed(self.epoch) + random.shuffle(buffer_batches) + + # Ensure each rank gets the same number of batches + batches_per_rank = int(math.ceil(len(buffer_batches) / self.num_replicas)) + total_batches_needed = batches_per_rank * self.num_replicas + extra_batches = total_batches_needed - len(buffer_batches) + # Add extra batches by random selection, if needed + buffer_batches += random.choices(buffer_batches, k=extra_batches) + + # Allocate the batches to the current rank + start_idx = self.rank * batches_per_rank + end_idx = start_idx + batches_per_rank + rank_batches = buffer_batches[start_idx + self.start_step : end_idx] + logging.info( + f"rank: {self.rank}, dataloader start from step: {self.start_step}, batch_num: {end_idx-start_idx}, batch_num_after_step: {len(rank_batches)}" + ) + # Return an iterator over the batches for the current rank + return iter(rank_batches) + + def __len__(self): + # Calculate the number of batches per epoch for the current rank + return 1 + + def set_epoch(self, epoch): + # Set the epoch for shuffling + self.epoch = epoch diff --git a/funasr/datasets/audio_datasets/index_ds.py b/funasr/datasets/audio_datasets/index_ds.py new file mode 100644 index 0000000..385218a --- /dev/null +++ b/funasr/datasets/audio_datasets/index_ds.py @@ -0,0 +1,144 @@ +import os +import json +import torch +import logging + +import librosa +import random +import torch.distributed as dist + +from funasr.register import tables + + +@tables.register("index_ds_classes", "IndexDSJsonl") +@tables.register("index_ds_classes", "IndexDSJsonlRankFull") +@tables.register("index_ds_classes", "IndexDSJsonlRankSplit") +class IndexDSJsonlRankFull(torch.utils.data.Dataset): + + def __init__(self, path: str, **kwargs): + super().__init__() + self.max_source_length = kwargs.get("max_source_length", 2048) + self.min_source_length = kwargs.get("min_source_length", 0) + self.max_target_length = kwargs.get("max_target_length", 2048) + self.min_target_length = kwargs.get("min_target_length", 0) + self.max_token_length = kwargs.get("max_token_length", 2200) + + is_training = kwargs.get("is_training", True) + if not (path.endswith(".jsonl") or path.endswith(".json")): + # jsonl list file + data_split_num = kwargs.get("data_split_num", 1) + data_split_i = kwargs.get("data_split_i", 0) + + if not is_training: + data_split_num = 1 + data_split_i = 0 + with open(path, encoding="utf-8") as fin: + file_list_all = fin.readlines() + + num_per_slice = (len(file_list_all) - 1) // data_split_num + 1 # 16 + file_list = file_list_all[ + data_split_i * num_per_slice : (data_split_i + 1) * num_per_slice + ] + logging.info( + f"is_training: {is_training}, data_split_num: {data_split_num}, data_split_i: {data_split_i}, \nfile_list: {file_list}, \nfile_list_all: {file_list_all}" + ) + + else: + file_list = [path] + + # total_num = len(file_list) + # try: + # rank = dist.get_rank() + # world_size = dist.get_world_size() + # except: + # rank = 0 + # world_size = 1 + # logging.info("distributed is not initialized, only single shard") + # + # if not kwargs.get("rank_split", False): + # logging.info(f"Warning, rank_split disenabled, batch and shuffle data in global") + # rank = 0 + # world_size = 1 + # + # num_per_rank = total_num // world_size + # if num_per_rank * world_size < total_num: + # logging.info(f"Warning, jsonl file:{total_num} could not be divided by world_size: {world_size}, {path}") + # total_num_needed = num_per_rank * world_size + # + # extra_num = total_num_needed - total_num + # file_list_tmp = random.choices(file_list, k=extra_num) + # file_list += file_list_tmp + # logging.info(f"Warning, after random choices: {file_list}") + # + # file_list_rank = file_list[rank * num_per_rank:(rank + 1) * num_per_rank] + # + # logging.info( + # f"is_training: {is_training}, file_list_rank: {file_list_rank}") + + # contents = [] + # for file_json in file_list_rank: + contents = [] + for file_json in file_list: + with open(file_json.strip(), encoding="utf-8") as fin: + for line in fin: + data = json.loads(line.strip()) + if "text" in data: # for sft + contents.append(data["text"]) + if "source" in data: # for speech lab pretrain + prompt = data.get("prompt", "") + source = data["source"].replace( + "/cpfs01", "/cpfs_speech/data" + ) # only use in alibaba gpu group: .replace("/cpfs01", "/cpfs_speech/data") + target = data["target"] + source_len = data.get("source_len", 1) + target_len = data.get("target_len", 0) + if "aishell" in source: + target = target.replace(" ", "") + if ( + source_len < self.min_source_length + or source_len > self.max_source_length + ): + continue + if ( + target_len < self.min_target_length + or target_len > self.max_target_length + ): + continue + + if (source_len + target_len) > self.max_token_length: + continue + + contents_i = { + "source": source, + "prompt": prompt, + "target": target, + "source_len": source_len, + "target_len": target_len, + } + text_language = data.get("text_language", None) + if text_language is not None: + contents_i["text_language"] = text_language + # audio_language = data.get("audio_language", None) + # if audio_language is not None: + # contents_i["audio_language"] = audio_language + contents.append(contents_i) + + self.contents = contents + + logging.info("total_num of samplers: {}, {}".format(len(self.contents), path)) + + def __len__(self): + return len(self.contents) + + def __getitem__(self, index): + + data = self.contents[index] + + return data + + def get_source_len(self, data_dict): + return data_dict.get("source_len", 1) + + def get_target_len(self, data_dict): + + return data_dict.get("target_len", 0) diff --git a/funasr/datasets/audio_datasets/jsonl2scp.py b/funasr/datasets/audio_datasets/jsonl2scp.py new file mode 100644 index 0000000..3ce96ca --- /dev/null +++ b/funasr/datasets/audio_datasets/jsonl2scp.py @@ -0,0 +1,64 @@ +import os +import json +import torch +import logging +import hydra +from omegaconf import DictConfig, OmegaConf +import concurrent.futures +import librosa +import torch.distributed as dist + + +def gen_scp_from_jsonl(jsonl_file, data_type_list, wav_scp_file, text_file): + + wav_f = open(wav_scp_file, "w") + text_f = open(text_file, "w") + with open(jsonl_file, encoding="utf-8") as fin: + for line in fin: + data = json.loads(line.strip()) + + prompt = data.get("prompt", "") + source = data[data_type_list[0]] + target = data[data_type_list[1]] + source_len = data.get("source_len", 1) + target_len = data.get("target_len", 0) + if "aishell" in source: + target = target.replace(" ", "") + key = data["key"] + wav_f.write(f"{key}\t{source}\n") + wav_f.flush() + text_f.write(f"{key}\t{target}\n") + text_f.flush() + + wav_f.close() + text_f.close() + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(cfg: DictConfig): + + kwargs = OmegaConf.to_container(cfg, resolve=True) + print(kwargs) + + scp_file_list = kwargs.get( + "scp_file_list", + ("/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"), + ) + if isinstance(scp_file_list, str): + scp_file_list = eval(scp_file_list) + data_type_list = kwargs.get("data_type_list", ("source", "target")) + jsonl_file = kwargs.get( + "jsonl_file_in", "/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl" + ) + gen_scp_from_jsonl(jsonl_file, data_type_list, *scp_file_list) + + +""" +python -m funasr.datasets.audio_datasets.json2scp \ +++scp_file_list='["/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in=/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl +""" + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/datasets/audio_datasets/preprocessor.py b/funasr/datasets/audio_datasets/preprocessor.py new file mode 100644 index 0000000..b3f9421 --- /dev/null +++ b/funasr/datasets/audio_datasets/preprocessor.py @@ -0,0 +1,55 @@ +import os +import json +import torch +import logging +import concurrent.futures +import librosa +import torch.distributed as dist +from typing import Collection +import torch +import torchaudio +from torch import nn +import random +import re +from funasr.tokenizer.cleaner import TextCleaner +from funasr.register import tables + + +@tables.register("preprocessor_classes", "SpeechPreprocessSpeedPerturb") +class SpeechPreprocessSpeedPerturb(nn.Module): + def __init__(self, speed_perturb: list = None, **kwargs): + super().__init__() + self.speed_perturb = speed_perturb + + def forward(self, waveform, fs, **kwargs): + if self.speed_perturb is None: + return waveform + speed = random.choice(self.speed_perturb) + if speed != 1.0: + if not isinstance(waveform, torch.Tensor): + waveform = torch.tensor(waveform) + waveform, _ = torchaudio.sox_effects.apply_effects_tensor( + waveform.view(1, -1), fs, [["speed", str(speed)], ["rate", str(fs)]] + ) + waveform = waveform.view(-1) + + return waveform + + +@tables.register("preprocessor_classes", "TextPreprocessSegDict") +class TextPreprocessSegDict(nn.Module): + def __init__( + self, + seg_dict: str = None, + text_cleaner: Collection[str] = None, + split_with_space: bool = False, + **kwargs + ): + super().__init__() + + self.text_cleaner = TextCleaner(text_cleaner) + + def forward(self, text, **kwargs): + text = self.text_cleaner(text) + + return text diff --git a/funasr/datasets/audio_datasets/samplers.py b/funasr/datasets/audio_datasets/samplers.py new file mode 100644 index 0000000..18f8f91 --- /dev/null +++ b/funasr/datasets/audio_datasets/samplers.py @@ -0,0 +1,467 @@ +import torch +import numpy as np +import logging +import math +import random +import torch.distributed as dist +from torch.utils.data import DistributedSampler +from torch.utils.data import BatchSampler, Sampler +import torch.distributed as dist + +from funasr.register import tables + + +@tables.register("batch_sampler_classes", "BatchSampler") +@tables.register("batch_sampler_classes", "CustomDistributedBatchSampler") +@tables.register("batch_sampler_classes", "CustomDistributedDynamicBatchSampler") +@tables.register("batch_sampler_classes", "DynamicBatchLocalShuffleSampler") +@tables.register("batch_sampler_classes", "RankFullLocalShuffleBatchSampler") +@tables.register("batch_sampler_classes", "RankFullLocalShuffleDynamicBatchSampler") +def CustomDistributedBatchSampler_fn(dataset, **kwargs): + dataloader_args = {} + batch_type = kwargs.get("batch_type", "example") + if batch_type == "example": + batch_sampler = CustomDistributedBatchSampler(dataset, **kwargs) + + else: + if kwargs.get("sort_size", -1) > 0: + batch_sampler = CustomDistributedBufferDynamicBatchSampler(dataset, **kwargs) + else: + batch_sampler = CustomDistributedDynamicBatchSampler(dataset, **kwargs) + # batch_sampler = CustomDistributedDynamicBatchSampler(dataset, **kwargs) + + dataloader_args["batch_sampler"] = batch_sampler + dataloader_args["num_workers"] = kwargs.get("num_workers", 4) + dataloader_args["pin_memory"] = kwargs.get("pin_memory", True) + + return dataloader_args + + +class CustomDistributedBatchSampler(Sampler): + def __init__( + self, + dataset, + batch_size, + num_replicas=None, + rank=None, + shuffle=True, + drop_last=False, + is_training: bool = True, + **kwargs, + ): + + try: + rank = dist.get_rank() + num_replicas = dist.get_world_size() + except: + rank = 0 + num_replicas = 1 + self.rank = rank + self.num_replicas = num_replicas + self.dataset = dataset + self.batch_size = batch_size + self.is_training = is_training + self.shuffle = shuffle and is_training + self.drop_last = drop_last + # self.total_size = len(dataset) + if self.drop_last: + self.total_size = (len(self.dataset) // (batch_size * num_replicas)) * ( + batch_size * num_replicas + ) + else: + self.total_size = math.ceil(len(self.dataset) / (batch_size * num_replicas)) * ( + batch_size * num_replicas + ) + self.num_samples = int(self.total_size // self.num_replicas) + self.epoch = 0 + self.max_token_length = kwargs.get("max_token_length", None) + self.length_scale_source = kwargs.get("length_scale_source", 1.0) + + def __iter__(self): + # Generate a list of indices + if self.shuffle: + g = torch.Generator() + g.manual_seed(self.epoch) + indices = torch.randperm(len(self.dataset), generator=g).tolist() + else: + indices = list(range(len(self.dataset))) + + # Add extra samples to make it evenly divisible + padding_size = self.total_size - len(indices) + if padding_size <= len(indices): + indices += indices[:padding_size] + else: + indices += ( + indices * (padding_size // len(indices)) + indices[: padding_size % len(indices)] + ) + + assert len(indices) == self.total_size + + # Subsample + indices = indices[self.rank : self.total_size : self.num_replicas] + assert len(indices) == self.num_samples + + # Filter out indices with length greater than the max length, if provided + if self.max_token_length is not None: + filtered_indices = [] + for idx in indices: + source_len = self.dataset.get_source_len(idx) / self.length_scale_source + if source_len <= self.max_token_length: + filtered_indices.append(idx) + indices = filtered_indices + + # Now that we have only the indices for this replica, chunk them into batches + batches = [ + indices[i : i + self.batch_size] for i in range(0, len(indices), self.batch_size) + ] + + # Drop the last batch if it's not full and drop_last is True + if self.drop_last and len(batches[-1]) != self.batch_size: + batches = batches[:-1] + + return iter(batches) + + def __len__(self): + + return self.num_samples // self.batch_size + + def set_epoch(self, epoch): + self.epoch = epoch + + +class CustomDistributedBufferBatchSampler(Sampler): + def __init__( + self, + dataset, + batch_size, + num_replicas=None, + rank=None, + shuffle=True, + drop_last=False, + is_training: bool = True, + sort_size: int = 1024, + **kwargs, + ): + + try: + rank = dist.get_rank() + num_replicas = dist.get_world_size() + except: + rank = 0 + num_replicas = 1 + self.rank = rank + self.num_replicas = num_replicas + self.dataset = dataset + self.batch_size = batch_size + self.is_training = is_training + self.shuffle = shuffle and is_training + self.drop_last = drop_last + # self.total_size = len(dataset) + if self.drop_last: + self.total_size = (len(self.dataset) // (batch_size * num_replicas)) * ( + batch_size * num_replicas + ) + else: + self.total_size = math.ceil(len(self.dataset) / (batch_size * num_replicas)) * ( + batch_size * num_replicas + ) + self.num_samples = int(self.total_size // self.num_replicas) + self.epoch = 0 + self.max_token_length = kwargs.get("max_token_length", None) + self.length_scale_source = kwargs.get("length_scale_source", 1.0) + self.sort_size = sort_size + + def __iter__(self): + # Generate a list of indices + if self.shuffle: + g = torch.Generator() + g.manual_seed(self.epoch) + indices = torch.randperm(len(self.dataset), generator=g).tolist() + else: + indices = list(range(len(self.dataset))) + + # Add extra samples to make it evenly divisible + padding_size = self.total_size - len(indices) + if padding_size <= len(indices): + indices += indices[:padding_size] + else: + indices += ( + indices * (padding_size // len(indices)) + indices[: padding_size % len(indices)] + ) + + assert len(indices) == self.total_size + + # Subsample + indices = indices[self.rank : self.total_size : self.num_replicas] + assert len(indices) == self.num_samples + + # Filter out indices with length greater than the max length, if provided + if self.max_token_length is not None: + filtered_indices = [] + for idx in indices: + source_len = self.dataset.get_source_len(idx) / self.length_scale_source + if source_len <= self.max_token_length: + filtered_indices.append(idx) + indices = filtered_indices + + # Buffer sorting logic + sorted_batches = [] + buffer = [] + + for idx in indices: + buffer.append(idx) + if len(buffer) >= self.sort_size: + # Sort the buffer based on some criteria, e.g., dataset sample length + buffer.sort(key=lambda x: self.dataset.get_source_len(x)) + sorted_batches.extend(self._create_batches_from_buffer(buffer)) + buffer = [] + + # Handle the remaining items in the buffer + if buffer: + buffer.sort(key=lambda x: self.dataset.get_source_len(x)) + sorted_batches.extend(self._create_batches_from_buffer(buffer)) + + return iter(sorted_batches) + + def _create_batches_from_buffer(self, buffer): + # Function to convert the sorted buffer into batches + batched_buffer = [ + buffer[i : i + self.batch_size] for i in range(0, len(buffer), self.batch_size) + ] + if self.drop_last and len(batched_buffer[-1]) != self.batch_size: + batched_buffer = batched_buffer[:-1] + return batched_buffer + + def __len__(self): + + return self.num_samples // self.batch_size + + def set_epoch(self, epoch): + self.epoch = epoch + + +class CustomDistributedDynamicBatchSampler(DistributedSampler): + def __init__( + self, + dataset, + batch_size, + num_replicas=None, + rank=None, + shuffle=True, + drop_last=False, + is_training: bool = True, + **kwargs, + ): + + try: + rank = dist.get_rank() + num_replicas = dist.get_world_size() + except: + rank = 0 + num_replicas = 1 + self.rank = rank + self.num_replicas = num_replicas + self.dataset = dataset + self.batch_size = batch_size + self.is_training = is_training + self.shuffle = shuffle and is_training + self.drop_last = drop_last + + self.total_size = len(self.dataset) + # self.num_samples = int(math.ceil(self.total_size / self.num_replicas)) + self.epoch = 0 + self.max_token_length = kwargs.get("max_token_length", 2048) + self.length_scale_source = kwargs.get("length_scale_source", 1.0) + + def __iter__(self): + if self.shuffle: + g = torch.Generator() + g.manual_seed(self.epoch) + indices = torch.randperm(len(self.dataset), generator=g).tolist() + else: + indices = list(range(len(self.dataset))) + + indices = indices[self.rank : self.total_size : self.num_replicas] + + batches = [] + batch = [] + max_len_in_batch = 0 + current_batch_length = 0 + + for idx in indices: + sample_length = self.dataset.get_source_len(idx) + if sample_length > self.max_token_length: + continue + potential_batch_length = ( + max_len_in_batch if sample_length < max_len_in_batch else sample_length + ) * (len(batch) + 1) + + if potential_batch_length <= self.batch_size: + batch.append(idx) + if sample_length > max_len_in_batch: + max_len_in_batch = sample_length + # current_batch_length = max_len_in_batch * len(batch) + else: + batches.append(batch) + batch = [idx] + max_len_in_batch = sample_length + # current_batch_length = max_len_in_batch + + # Add the last batch if it's not empty and we're not dropping it + if batch and (not self.drop_last or len(batch) * max_len_in_batch == self.batch_size): + batches.append(batch) + + return iter(batches) + + def __len__(self): + + return 1 + + def set_epoch(self, epoch): + self.epoch = epoch + + +class CustomDistributedBufferDynamicBatchSampler(DistributedSampler): + def __init__( + self, + dataset, + batch_size, + batch_type="token", + num_replicas=None, + rank=None, + rank_split=False, + shuffle=True, + drop_last=False, + is_training: bool = True, + sort_size: int = 1024, + **kwargs, + ): + + try: + rank = dist.get_rank() + num_replicas = dist.get_world_size() + except: + rank = 0 + num_replicas = 1 + + # if rank_split: + # logging.info(f"Warning, rank_split: {rank_split}, batch and shuffle data in local rank") + # rank = 0 + # num_replicas = 1 + + self.rank = rank + self.num_replicas = num_replicas + self.dataset = dataset + self.batch_size = batch_size + self.batch_type = batch_type + self.is_training = is_training + self.shuffle = shuffle and is_training + self.drop_last = drop_last + + self.total_size = len(self.dataset) + self.num_samples = int(math.ceil(self.total_size / self.num_replicas)) + self.epoch = 0 + self.sort_size = sort_size * num_replicas + self.max_token_length = kwargs.get("max_token_length", 2048) + self.length_scale_source = kwargs.get("length_scale_source", 1.0) + super().__init__( + dataset, num_replicas=num_replicas, rank=rank, shuffle=shuffle, drop_last=drop_last + ) + + def __iter__(self): + if self.shuffle: + g = torch.Generator() + g.manual_seed(self.epoch) + random.seed(self.epoch) + + indices = torch.randperm(len(self.dataset), generator=g).tolist() + else: + indices = list(range(len(self.dataset))) + + # Create sorted buffers and form batches + buffer_batches = [] + for i in range(0, len(indices), self.sort_size): + buffer = sorted( + indices[i : i + self.sort_size], key=lambda idx: self.dataset.get_source_len(idx) + ) + batch = [] + max_len_in_batch = 0 + for idx in buffer: + original_sample_length = self.dataset.get_source_len(idx) + if original_sample_length > self.max_token_length: + continue + sample_length = 1 if self.batch_type == "example" else original_sample_length + potential_batch_length = max(max_len_in_batch, sample_length) * (len(batch) + 1) + if potential_batch_length <= self.batch_size: + batch.append(idx) + max_len_in_batch = max(max_len_in_batch, sample_length) + else: + buffer_batches.append(batch) + batch = [idx] + max_len_in_batch = sample_length + if batch: + buffer_batches.append(batch) + + # Ensure each rank gets the same number of batches, duplicate data if needed + batches_per_rank = math.ceil(len(buffer_batches) / self.num_replicas) + total_batches_needed = batches_per_rank * self.num_replicas + + extra_batches = total_batches_needed - len(buffer_batches) + buffer_batches += random.choices(buffer_batches, k=extra_batches) + + # Evenly distribute batches from buffer_batches to each rank + rank_batches = [[] for _ in range(self.num_replicas)] + for i, batch in enumerate(buffer_batches): + rank_batches[i % self.num_replicas].append(batch) + + # Assign all batches for the current rank directly + final_batches = rank_batches[self.rank] + + return iter(final_batches) + + def __len__(self): + + return 1 + + def set_epoch(self, epoch): + self.epoch = epoch + + +class DistributedSamplerWarp(BatchSampler): + def __init__( + self, dataset, batch_size, num_replicas=None, rank=None, shuffle=True, drop_last=False + ): + if num_replicas is None: + if not torch.distributed.is_available(): + raise RuntimeError("Requires distributed package to be available") + num_replicas = torch.distributed.get_world_size() + if rank is None: + if not torch.distributed.is_available(): + raise RuntimeError("Requires distributed package to be available") + rank = torch.distributed.get_rank() + + self.dataset = dataset + self.batch_size = batch_size + self.num_replicas = num_replicas + self.rank = rank + self.shuffle = shuffle + self.drop_last = drop_last + + # Create an instance of the DistributedSampler + self.sampler = DistributedSampler( + self.dataset, num_replicas=self.num_replicas, rank=self.rank, shuffle=self.shuffle + ) + + # Call BatchSampler's constructor + super().__init__(self.sampler, batch_size, drop_last) + + def __iter__(self): + # If we shuffle, we need to call the set_epoch method + if self.shuffle: + self.sampler.set_epoch(self.epoch) + + # Generate batch indices using the parent class + return super().__iter__() + + def set_epoch(self, epoch): + self.epoch = epoch diff --git a/funasr/datasets/audio_datasets/scp2jsonl.py b/funasr/datasets/audio_datasets/scp2jsonl.py new file mode 100644 index 0000000..f4c9d74 --- /dev/null +++ b/funasr/datasets/audio_datasets/scp2jsonl.py @@ -0,0 +1,123 @@ +import os +import json +import torch +import logging +import hydra +from omegaconf import DictConfig, OmegaConf +import concurrent.futures +import librosa +import torch.distributed as dist +from tqdm import tqdm + + +def gen_jsonl_from_wav_text_list( + path, data_type_list=("source", "target"), jsonl_file_out: str = None, **kwargs +): + try: + rank = dist.get_rank() + world_size = dist.get_world_size() + except: + rank = 0 + world_size = 1 + + cpu_cores = os.cpu_count() or 1 + print(f"convert wav.scp text to jsonl, ncpu: {cpu_cores}") + if rank == 0: + json_dict = {} + for data_type, data_file in zip(data_type_list, path): + json_dict[data_type] = {} + with open(data_file, "r") as f: + + data_file_lists = f.readlines() + lines_for_each_th = (len(data_file_lists) - 1) // cpu_cores + 1 + task_num = cpu_cores if len(data_file_lists) > cpu_cores else 1 + # import pdb;pdb.set_trace() + if task_num > 1: + with concurrent.futures.ThreadPoolExecutor(max_workers=cpu_cores) as executor: + + futures = [ + executor.submit( + parse_context_length, + data_file_lists[ + i * lines_for_each_th : (i + 1) * lines_for_each_th + ], + data_type, + i, + ) + for i in range(task_num) + ] + + for future in concurrent.futures.as_completed(futures): + + json_dict[data_type].update(future.result()) + else: + res = parse_context_length(data_file_lists, data_type) + json_dict[data_type].update(res) + + with open(jsonl_file_out, "w") as f: + for key in json_dict[data_type_list[0]].keys(): + jsonl_line = {"key": key} + for data_file in data_type_list: + jsonl_line.update(json_dict[data_file][key]) + jsonl_line = json.dumps(jsonl_line, ensure_ascii=False) + f.write(jsonl_line + "\n") + f.flush() + print(f"processed {len(json_dict[data_type_list[0]])} samples") + + else: + pass + + if world_size > 1: + dist.barrier() + + +def parse_context_length(data_list: list, data_type: str, id=0): + pbar = tqdm(total=len(data_list), dynamic_ncols=True) + res = {} + for i, line in enumerate(data_list): + pbar.update(1) + pbar.set_description(f"cpu: {id}") + lines = line.strip().split(maxsplit=1) + key = lines[0] + line = lines[1] if len(lines) > 1 else "" + line = line.strip() + if os.path.exists(line): + waveform, _ = librosa.load(line, sr=16000) + sample_num = len(waveform) + context_len = int(sample_num / 16000 * 1000 / 10) + else: + context_len = len(line.split()) if " " in line else len(line) + res[key] = {data_type: line, f"{data_type}_len": context_len} + return res + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(cfg: DictConfig): + + kwargs = OmegaConf.to_container(cfg, resolve=True) + print(kwargs) + + scp_file_list = kwargs.get( + "scp_file_list", + ("/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"), + ) + if isinstance(scp_file_list, str): + scp_file_list = eval(scp_file_list) + data_type_list = kwargs.get("data_type_list", ("source", "target")) + jsonl_file_out = kwargs.get( + "jsonl_file_out", "/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl" + ) + gen_jsonl_from_wav_text_list( + scp_file_list, data_type_list=data_type_list, jsonl_file_out=jsonl_file_out + ) + + +""" +python -m funasr.datasets.audio_datasets.scp2jsonl \ +++scp_file_list='["/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out=/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl +""" + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/datasets/audio_datasets/scp2len.py b/funasr/datasets/audio_datasets/scp2len.py new file mode 100644 index 0000000..5d742b1 --- /dev/null +++ b/funasr/datasets/audio_datasets/scp2len.py @@ -0,0 +1,121 @@ +import os +import json +import torch +import logging +import hydra +from omegaconf import DictConfig, OmegaConf +import concurrent.futures +import librosa +import torch.distributed as dist +from tqdm import tqdm + + +def gen_jsonl_from_wav_text_list( + path, data_type_list=("source",), jsonl_file_out: str = None, **kwargs +): + try: + rank = dist.get_rank() + world_size = dist.get_world_size() + except: + rank = 0 + world_size = 1 + + cpu_cores = os.cpu_count() or 1 + print(f"convert wav.scp text to jsonl, ncpu: {cpu_cores}") + if rank == 0: + json_dict = {} + # for data_type, data_file in zip(data_type_list, path): + data_type = data_type_list[0] + data_file = path + json_dict[data_type] = {} + with open(data_file, "r") as f: + + data_file_lists = f.readlines() + print("") + lines_for_each_th = (len(data_file_lists) - 1) // cpu_cores + 1 + task_num = cpu_cores if len(data_file_lists) > cpu_cores else 1 + # import pdb;pdb.set_trace() + if task_num > 1: + with concurrent.futures.ThreadPoolExecutor(max_workers=cpu_cores) as executor: + + futures = [ + executor.submit( + parse_context_length, + data_file_lists[i * lines_for_each_th : (i + 1) * lines_for_each_th], + data_type, + i, + ) + for i in range(task_num) + ] + + for future in concurrent.futures.as_completed(futures): + + json_dict[data_type].update(future.result()) + else: + res = parse_context_length(data_file_lists, data_type) + json_dict[data_type].update(res) + + with open(jsonl_file_out, "w") as f: + for key in json_dict[data_type_list[0]].keys(): + jsonl_line = {"key": key} + for data_file in data_type_list: + jsonl_line.update(json_dict[data_file][key]) + # jsonl_line = json.dumps(jsonl_line, ensure_ascii=False) + source_len = jsonl_line["source_len"] + jsonl_line = f"{key} {source_len}" + f.write(jsonl_line + "\n") + f.flush() + print(f"processed {len(json_dict[data_type_list[0]])} samples") + + else: + pass + + if world_size > 1: + dist.barrier() + + +def parse_context_length(data_list: list, data_type: str, id=0): + pbar = tqdm(total=len(data_list), dynamic_ncols=True) + res = {} + for i, line in enumerate(data_list): + pbar.update(1) + pbar.set_description(f"cpu: {id}") + lines = line.strip().split(maxsplit=1) + key = lines[0] + line = lines[1] if len(lines) > 1 else "" + line = line.strip() + if os.path.exists(line): + waveform, _ = librosa.load(line, sr=16000) + sample_num = len(waveform) + context_len = int(sample_num / 16000 * 1000 / 10) + else: + context_len = len(line.split()) if " " in line else len(line) + res[key] = {data_type: line, f"{data_type}_len": context_len} + return res + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(cfg: DictConfig): + + kwargs = OmegaConf.to_container(cfg, resolve=True) + print(kwargs) + + scp_file_list = kwargs.get("scp_file_list", "/Users/zhifu/funasr1.0/data/list/train_wav.scp") + # if isinstance(scp_file_list, str): + # scp_file_list = eval(scp_file_list) + data_type_list = kwargs.get("data_type_list", ("source",)) + jsonl_file_out = kwargs.get("jsonl_file_out", "/Users/zhifu/funasr1.0/data/list/wav_len.txt") + gen_jsonl_from_wav_text_list( + scp_file_list, data_type_list=data_type_list, jsonl_file_out=jsonl_file_out + ) + + +""" +python -m funasr.datasets.audio_datasets.scp2jsonl \ +++scp_file_list='["/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_out=/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl +""" + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/datasets/audio_datasets/update_jsonl.py b/funasr/datasets/audio_datasets/update_jsonl.py new file mode 100644 index 0000000..bc84708 --- /dev/null +++ b/funasr/datasets/audio_datasets/update_jsonl.py @@ -0,0 +1,99 @@ +import os +import json +import torch +import logging +import hydra +from omegaconf import DictConfig, OmegaConf +import concurrent.futures +import librosa +import torch.distributed as dist +import threading +from tqdm import tqdm +from concurrent.futures import ThreadPoolExecutor + + +def gen_scp_from_jsonl(jsonl_file, jsonl_file_out, ncpu): + jsonl_file_out_f = open(jsonl_file_out, "w") + with open(jsonl_file, encoding="utf-8") as fin: + lines = fin.readlines() + + num_total = len(lines) + if ncpu > 1: + # 使用ThreadPoolExecutor限制并发线程数 + with ThreadPoolExecutor(max_workers=ncpu) as executor: + # 提交任务到线程池 + futures = {executor.submit(update_data, lines, i) for i in tqdm(range(num_total))} + + # 等待所有任务完成,这会阻塞直到所有提交的任务完成 + for future in concurrent.futures.as_completed(futures): + # 这里可以添加额外的逻辑来处理完成的任务,但在这个例子中我们只是等待 + pass + else: + for i in range(num_total): + update_data(lines, i) + logging.info("All audio durations have been processed.") + + for line in lines: + + jsonl_file_out_f.write(line + "\n") + jsonl_file_out_f.flush() + + jsonl_file_out_f.close() + + +def update_data(lines, i): + line = lines[i] + data = json.loads(line.strip()) + + wav_path = data["source"].replace("/cpfs01", "/cpfs_speech/data") + if os.path.exists(wav_path): + waveform, _ = librosa.load(wav_path, sr=16000) + sample_num = len(waveform) + source_len = int(sample_num / 16000 * 1000 / 10) + source_len_old = data["source_len"] + # if (source_len_old - source_len) > 100 or (source_len - source_len_old) > 100: + # logging.info(f"old: {source_len_old}, new: {source_len}, wav: {wav_path}") + data["source_len"] = source_len + data["source"] = wav_path + jsonl_line = json.dumps(data, ensure_ascii=False) + lines[i] = jsonl_line + + +def update_wav_len(jsonl_file_list_in, jsonl_file_out_dir, ncpu=1): + + os.makedirs(jsonl_file_out_dir, exist_ok=True) + with open(jsonl_file_list_in, "r") as f: + data_file_lists = f.readlines() + + for i, jsonl in enumerate(data_file_lists): + filename_with_extension = os.path.basename(jsonl.strip()) + jsonl_file_out = os.path.join(jsonl_file_out_dir, filename_with_extension) + logging.info(f"{i}/{len(data_file_lists)}, jsonl: {jsonl}, {jsonl_file_out}") + + gen_scp_from_jsonl(jsonl.strip(), jsonl_file_out, ncpu) + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(cfg: DictConfig): + + kwargs = OmegaConf.to_container(cfg, resolve=True) + logging.info(kwargs) + + jsonl_file_list_in = kwargs.get( + "jsonl_file_list_in", "/Users/zhifu/funasr1.0/data/list/data_jsonl.list" + ) + jsonl_file_out_dir = kwargs.get("jsonl_file_out_dir", "/Users/zhifu/funasr1.0/data_tmp") + ncpu = kwargs.get("ncpu", 1) + update_wav_len(jsonl_file_list_in, jsonl_file_out_dir, ncpu) + # gen_scp_from_jsonl(jsonl_file_list_in, jsonl_file_out_dir) + + +""" +python -m funasr.datasets.audio_datasets.json2scp \ +++scp_file_list='["/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt"]' \ +++data_type_list='["source", "target"]' \ +++jsonl_file_in=/Users/zhifu/funasr1.0/test_local/audio_datasets.jsonl +""" + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/datasets/dataloader_entry.py b/funasr/datasets/dataloader_entry.py new file mode 100644 index 0000000..925b1d3 --- /dev/null +++ b/funasr/datasets/dataloader_entry.py @@ -0,0 +1,136 @@ +import logging +import torch + +from funasr.register import tables + + +# @tables.register("dataloader_classes", "DataloaderMapStyle") +def DataloaderMapStyle(frontend=None, tokenizer=None, **kwargs): + # dataset + logging.info("Build dataloader") + dataset_class = tables.dataset_classes.get(kwargs.get("dataset", "AudioDataset")) + dataset_tr = dataset_class( + kwargs.get("train_data_set_list"), + frontend=frontend, + tokenizer=tokenizer, + is_training=True, + **kwargs.get("dataset_conf"), + ) + dataset_val = dataset_class( + kwargs.get("valid_data_set_list"), + frontend=frontend, + tokenizer=tokenizer, + is_training=False, + **kwargs.get("dataset_conf"), + ) + + # dataloader + batch_sampler = kwargs["dataset_conf"].get("batch_sampler", "BatchSampler") + batch_sampler_val = None + if batch_sampler is not None: + batch_sampler_class = tables.batch_sampler_classes.get(batch_sampler) + batch_sampler = batch_sampler_class(dataset_tr, **kwargs.get("dataset_conf")) + batch_sampler_val = batch_sampler_class( + dataset_val, is_training=False, **kwargs.get("dataset_conf") + ) + + dataloader_tr = torch.utils.data.DataLoader( + dataset_tr, collate_fn=dataset_tr.collator, **batch_sampler + ) + dataloader_val = torch.utils.data.DataLoader( + dataset_val, collate_fn=dataset_val.collator, **batch_sampler_val + ) + + return dataloader_tr, dataloader_val + + +@tables.register("dataloader_classes", "DataloaderMapStyle") +class DataloaderMapStyle: + def __init__(self, frontend=None, tokenizer=None, **kwargs): + # dataset + logging.info("Build dataloader") + dataset_class = tables.dataset_classes.get(kwargs.get("dataset", "AudioDataset")) + dataset_tr = dataset_class( + kwargs.get("train_data_set_list"), + frontend=frontend, + tokenizer=tokenizer, + is_training=True, + **kwargs.get("dataset_conf"), + ) + dataset_val = dataset_class( + kwargs.get("valid_data_set_list"), + frontend=frontend, + tokenizer=tokenizer, + is_training=False, + **kwargs.get("dataset_conf"), + ) + + self.dataset_tr = dataset_tr + self.dataset_val = dataset_val + self.kwargs = kwargs + + # split dataset + self.data_split_num = kwargs["dataset_conf"].get("data_split_num", 1) + self.dataset_class = dataset_class + self.frontend = frontend + self.tokenizer = tokenizer + self.kwargs = kwargs + + def build_iter(self, epoch=0, data_split_i=0, start_step=0, **kwargs): + + # reload dataset slice + if self.data_split_num > 1: + del self.dataset_tr + self.dataset_tr = self.dataset_class( + self.kwargs.get("train_data_set_list"), + frontend=self.frontend, + tokenizer=self.tokenizer, + is_training=True, + **self.kwargs.get("dataset_conf"), + data_split_i=data_split_i, + ) + + # dataloader + batch_sampler = self.kwargs["dataset_conf"].get("batch_sampler", "BatchSampler") + batch_sampler_val = None + if batch_sampler is not None: + batch_sampler_class = tables.batch_sampler_classes.get(batch_sampler) + batch_sampler = batch_sampler_class( + self.dataset_tr, start_step=start_step, **self.kwargs.get("dataset_conf") + ) + batch_sampler_val = batch_sampler_class( + self.dataset_val, is_training=False, **self.kwargs.get("dataset_conf") + ) + + batch_sampler["batch_sampler"].set_epoch(epoch) + batch_sampler_val["batch_sampler"].set_epoch(epoch) + dataloader_tr = torch.utils.data.DataLoader( + self.dataset_tr, collate_fn=self.dataset_tr.collator, **batch_sampler + ) + dataloader_val = torch.utils.data.DataLoader( + self.dataset_val, collate_fn=self.dataset_val.collator, **batch_sampler_val + ) + + return dataloader_tr, dataloader_val + + +@tables.register("dataloader_classes", "DataloaderIterable") +def DataloaderIterable(frontend=None, tokenizer=None, **kwargs): + logging.info("Build dataloader") + dataset_class = tables.dataset_classes.get(kwargs.get("dataset", "LargeDataset")) + dataset_tr = dataset_class( + kwargs.get("train_data_set_list"), + frontend=frontend, + tokenizer=tokenizer, + is_training=True, + **kwargs.get("dataset_conf"), + ) + dataset_val = dataset_class( + kwargs.get("valid_data_set_list"), + frontend=frontend, + tokenizer=tokenizer, + is_training=False, + **kwargs.get("dataset_conf"), + ) + + return dataset_tr, dataset_val diff --git a/funasr/datasets/large_datasets/__init__.py b/funasr/datasets/large_datasets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/large_datasets/abs_iter_factory.py b/funasr/datasets/large_datasets/abs_iter_factory.py new file mode 100644 index 0000000..36e4dd2 --- /dev/null +++ b/funasr/datasets/large_datasets/abs_iter_factory.py @@ -0,0 +1,9 @@ +from abc import ABC +from abc import abstractmethod +from typing import Iterator + + +class AbsIterFactory(ABC): + @abstractmethod + def build_iter(self, epoch: int, shuffle: bool = None) -> Iterator: + raise NotImplementedError diff --git a/funasr/datasets/large_datasets/build_dataloader.py b/funasr/datasets/large_datasets/build_dataloader.py new file mode 100644 index 0000000..da04717 --- /dev/null +++ b/funasr/datasets/large_datasets/build_dataloader.py @@ -0,0 +1,109 @@ +import logging +from pathlib import Path +from typing import Iterable +from typing import List +from typing import Union + +import sentencepiece as spm +from torch.utils.data import DataLoader + +from funasr.datasets.large_datasets.dataset import Dataset +from funasr.datasets.large_datasets.abs_iter_factory import AbsIterFactory +from funasr.tokenizer.abs_tokenizer import AbsTokenizer + +from funasr.register import tables + + +def read_symbol_table(symbol_table_file): + if isinstance(symbol_table_file, str): + symbol_table = {} + with open(symbol_table_file, "r", encoding="utf8") as fin: + for i, line in enumerate(fin): + char = line.strip() + symbol_table[char] = i + else: + assert isinstance(symbol_table_file, list) + symbol_table = {} + for i, char in enumerate(symbol_table_file): + symbol_table[char] = i + return symbol_table + + +def load_seg_dict(seg_dict_file): + seg_dict = {} + assert isinstance(seg_dict_file, str) + with open(seg_dict_file, "r", encoding="utf8") as f: + lines = f.readlines() + for line in lines: + s = line.strip().split() + key = s[0] + value = s[1:] + seg_dict[key] = " ".join(value) + return seg_dict + + +class SentencepiecesTokenizer(AbsTokenizer): + def __init__(self, model: Union[Path, str]): + self.model = str(model) + self.sp = None + + def __repr__(self): + return f'{self.__class__.__name__}(model="{self.model}")' + + def _build_sentence_piece_processor(self): + if self.sp is None: + self.sp = spm.SentencePieceProcessor() + self.sp.load(self.model) + + def text2tokens(self, line: str) -> List[str]: + self._build_sentence_piece_processor() + return self.sp.EncodeAsPieces(line) + + def tokens2text(self, tokens: Iterable[str]) -> str: + self._build_sentence_piece_processor() + return self.sp.DecodePieces(list(tokens)) + + +@tables.register("dataset_classes", "LargeDataset") +class LargeDataLoader(AbsIterFactory): + def __init__(self, args, mode="train"): + symbol_table, seg_dict, punc_dict, bpe_tokenizer = None, None, None, None + if hasattr(args, "token_list") and args.token_list is not None: + symbol_table = read_symbol_table(args.token_list) + if hasattr(args, "seg_dict_file") and args.seg_dict_file is not None: + seg_dict = load_seg_dict(args.seg_dict_file) + if hasattr(args, "punc_list") and args.punc_list is not None: + punc_dict = read_symbol_table(args.punc_list) + if hasattr(args, "bpemodel") and args.bpemodel is not None: + bpe_tokenizer = SentencepiecesTokenizer(args.bpemodel) + self.dataset_conf = args.dataset_conf + if "frontend_conf" not in args: + self.frontend_conf = None + else: + self.frontend_conf = args.frontend_conf + self.speed_perturb = args.speed_perturb if hasattr(args, "speed_perturb") else None + logging.info("dataloader config: {}".format(self.dataset_conf)) + batch_mode = self.dataset_conf.get("batch_mode", "padding") + data_list = args.train_data_file if mode == "train" else args.valid_data_file + self.dataset = Dataset( + data_list, + symbol_table, + seg_dict, + punc_dict, + bpe_tokenizer, + self.dataset_conf, + self.frontend_conf, + speed_perturb=self.speed_perturb if mode == "train" else None, + mode=mode, + batch_mode=batch_mode, + ) + + def build_iter(self, epoch, shuffle=True): + self.dataset.set_epoch(epoch) + data_loader = DataLoader( + self.dataset, + batch_size=None, + pin_memory=True, + num_workers=self.dataset_conf.get("num_workers", 8), + ) + return data_loader diff --git a/funasr/datasets/large_datasets/collate_fn.py b/funasr/datasets/large_datasets/collate_fn.py new file mode 100644 index 0000000..4648d87 --- /dev/null +++ b/funasr/datasets/large_datasets/collate_fn.py @@ -0,0 +1,194 @@ +from typing import Collection +from typing import Dict +from typing import List +from typing import Tuple +from typing import Union + +import numpy as np +import torch +from funasr.models.transformer.utils.nets_utils import pad_list, pad_list_all_dim + + +class CommonCollateFn: + """Functor class of common_collate_fn()""" + + def __init__( + self, + float_pad_value: Union[float, int] = 0.0, + int_pad_value: int = -32768, + not_sequence: Collection[str] = (), + max_sample_size=None, + ): + self.float_pad_value = float_pad_value + self.int_pad_value = int_pad_value + self.not_sequence = set(not_sequence) + self.max_sample_size = max_sample_size + + def __repr__(self): + return ( + f"{self.__class__}(float_pad_value={self.float_pad_value}, " + f"int_pad_value={self.float_pad_value})" + ) + + def __call__( + self, data: Collection[Tuple[str, Dict[str, np.ndarray]]] + ) -> Tuple[List[str], Dict[str, torch.Tensor]]: + return common_collate_fn( + data, + float_pad_value=self.float_pad_value, + int_pad_value=self.int_pad_value, + not_sequence=self.not_sequence, + ) + + +def common_collate_fn( + data: Collection[Tuple[str, Dict[str, np.ndarray]]], + float_pad_value: Union[float, int] = 0.0, + int_pad_value: int = -32768, + not_sequence: Collection[str] = (), +) -> Tuple[List[str], Dict[str, torch.Tensor]]: + """Concatenate ndarray-list to an array and convert to torch.Tensor.""" + uttids = [u for u, _ in data] + data = [d for _, d in data] + + assert all(set(data[0]) == set(d) for d in data), "dict-keys mismatching" + assert all( + not k.endswith("_lengths") for k in data[0] + ), f"*_lengths is reserved: {list(data[0])}" + + output = {} + for key in data[0]: + if data[0][key].dtype.kind == "i": + pad_value = int_pad_value + else: + pad_value = float_pad_value + + array_list = [d[key] for d in data] + tensor_list = [torch.from_numpy(a) for a in array_list] + tensor = pad_list(tensor_list, pad_value) + output[key] = tensor + + if key not in not_sequence: + lens = torch.tensor([d[key].shape[0] for d in data], dtype=torch.long) + output[key + "_lengths"] = lens + + output = (uttids, output) + return output + + +class DiarCollateFn: + """Functor class of common_collate_fn()""" + + def __init__( + self, + float_pad_value: Union[float, int] = 0.0, + int_pad_value: int = -32768, + not_sequence: Collection[str] = (), + max_sample_size=None, + ): + self.float_pad_value = float_pad_value + self.int_pad_value = int_pad_value + self.not_sequence = set(not_sequence) + self.max_sample_size = max_sample_size + + def __repr__(self): + return ( + f"{self.__class__}(float_pad_value={self.float_pad_value}, " + f"int_pad_value={self.float_pad_value})" + ) + + def __call__( + self, data: Collection[Tuple[str, Dict[str, np.ndarray]]] + ) -> Tuple[List[str], Dict[str, torch.Tensor]]: + return diar_collate_fn( + data, + float_pad_value=self.float_pad_value, + int_pad_value=self.int_pad_value, + not_sequence=self.not_sequence, + ) + + +def diar_collate_fn( + data: Collection[Tuple[str, Dict[str, np.ndarray]]], + float_pad_value: Union[float, int] = 0.0, + int_pad_value: int = -32768, + not_sequence: Collection[str] = (), +) -> Tuple[List[str], Dict[str, torch.Tensor]]: + """Concatenate ndarray-list to an array and convert to torch.Tensor.""" + uttids = [u for u, _ in data] + data = [d for _, d in data] + + assert all(set(data[0]) == set(d) for d in data), "dict-keys mismatching" + assert all( + not k.endswith("_lengths") for k in data[0] + ), f"*_lengths is reserved: {list(data[0])}" + + output = {} + for key in data[0]: + if data[0][key].dtype.kind == "i": + pad_value = int_pad_value + else: + pad_value = float_pad_value + + array_list = [d[key] for d in data] + tensor_list = [torch.from_numpy(a) for a in array_list] + tensor = pad_list_all_dim(tensor_list, pad_value) + output[key] = tensor + + if key not in not_sequence: + lens = torch.tensor([d[key].shape[0] for d in data], dtype=torch.long) + output[key + "_lengths"] = lens + + output = (uttids, output) + return output + + +def crop_to_max_size(feature, target_size): + size = len(feature) + diff = size - target_size + if diff <= 0: + return feature + + start = np.random.randint(0, diff + 1) + end = size - diff + start + return feature[start:end] + + +def clipping_collate_fn( + data: Collection[Tuple[str, Dict[str, np.ndarray]]], + max_sample_size=None, + not_sequence: Collection[str] = (), +) -> Tuple[List[str], Dict[str, torch.Tensor]]: + # mainly for pre-training + uttids = [u for u, _ in data] + data = [d for _, d in data] + + assert all(set(data[0]) == set(d) for d in data), "dict-keys mismatching" + assert all( + not k.endswith("_lengths") for k in data[0] + ), f"*_lengths is reserved: {list(data[0])}" + + output = {} + for key in data[0]: + array_list = [d[key] for d in data] + tensor_list = [torch.from_numpy(a) for a in array_list] + sizes = [len(s) for s in tensor_list] + if max_sample_size is None: + target_size = min(sizes) + else: + target_size = min(min(sizes), max_sample_size) + tensor = tensor_list[0].new_zeros(len(tensor_list), target_size, tensor_list[0].shape[1]) + for i, (source, size) in enumerate(zip(tensor_list, sizes)): + diff = size - target_size + if diff == 0: + tensor[i] = source + else: + tensor[i] = crop_to_max_size(source, target_size) + output[key] = tensor + + if key not in not_sequence: + lens = torch.tensor([source.shape[0] for source in tensor], dtype=torch.long) + output[key + "_lengths"] = lens + + output = (uttids, output) + return output diff --git a/funasr/datasets/large_datasets/datapipes/__init__.py b/funasr/datasets/large_datasets/datapipes/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/large_datasets/datapipes/batch.py b/funasr/datasets/large_datasets/datapipes/batch.py new file mode 100644 index 0000000..aeeb451 --- /dev/null +++ b/funasr/datasets/large_datasets/datapipes/batch.py @@ -0,0 +1,213 @@ +import random + +from itertools import count +from functools import partial +from torch.utils.data import IterableDataset +from funasr.datasets.large_datasets.datapipes.map import MapperIterDataPipe + +tiebreaker = count() + + +def _default_len_fn(token): + return len(token), next(tiebreaker) + + +def _token_len_fn(token, len_fn): + return len_fn(token), next(tiebreaker), token + + +class MaxTokenBucketizerIterDataPipe(IterableDataset): + + def __init__( + self, + datapipe, + batch_size=8000, + len_fn=_default_len_fn, + buffer_size=10240, + sort_size=500, + batch_mode="padding", + ): + assert batch_size > 0, "Batch size is required to be larger than 0!" + assert buffer_size >= -1, "Buffer size is required to be larger than -1!" + assert sort_size > 0, "Sort size is required to be larger than 0!" + + datapipe = MapperIterDataPipe(datapipe, fn=partial(_token_len_fn, len_fn=len_fn)) + self.datapipe = datapipe + self.batch_size = batch_size + self.buffer_size = buffer_size + self.sort_size = sort_size + self.batch_mode = batch_mode + + def set_epoch(self, epoch): + self.datapipe.set_epoch(epoch) + + def __iter__(self): + buffer = [] + batch = [] + bucket = [] + max_lengths = 0 + min_lengths = 999999 + batch_lengths = 0 + + if self.batch_mode == "clipping": + assert self.buffer_size > 0, "for clipping batch_mode, buffer_size must be > 1" + for d in self.datapipe: + if d[0] > self.batch_size: + continue + buffer.append(d) + if len(buffer) == self.buffer_size: + random.shuffle(buffer) + for sample in buffer: + bucket.append(sample) + if len(bucket) == self.sort_size: + bucket.sort() + for x in bucket: + length, _, token = x + if length < min_lengths: + min_lengths = length + batch_lengths = min_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + yield batch + batch = [] + min_lengths = length + batch.append(token) + bucket = [] + buffer = [] + + if buffer: + random.shuffle(buffer) + for sample in buffer: + bucket.append(sample) + if len(bucket) == self.sort_size: + bucket.sort() + for x in bucket: + length, _, token = x + if length < min_lengths: + min_lengths = length + batch_lengths = min_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + yield batch + batch = [] + min_lengths = length + batch.append(token) + bucket = [] + buffer = [] + + if bucket: + bucket.sort() + for x in bucket: + length, _, token = x + if length < min_lengths: + min_lengths = length + batch_lengths = min_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + yield batch + batch = [] + min_lengths = length + batch.append(token) + bucket = [] + + if batch: + yield batch + + else: + if self.buffer_size == -1: + for d in self.datapipe: + if d[0] > self.batch_size: + continue + buffer.append(d) + buffer.sort() + for sample in buffer: + length, _, token = sample + if length > max_lengths: + max_lengths = length + batch_lengths = max_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + bucket.append(batch) + batch = [] + max_lengths = length + batch.append(token) + random.shuffle(bucket) + if bucket: + for batch_sample in bucket: + yield batch_sample + if batch: + yield batch + + elif self.buffer_size == 0: + for d in self.datapipe: + if d[0] > self.batch_size: + continue + length, _, token = d + if length > self.batch_size: + continue + if length > max_lengths: + max_lengths = length + batch_lengths = max_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + yield batch + batch = [] + max_lengths = length + batch.append(token) + if batch: + yield batch + + else: + for d in self.datapipe: + if d[0] > self.batch_size: + continue + buffer.append(d) + if len(buffer) == self.buffer_size: + random.shuffle(buffer) + for sample in buffer: + bucket.append(sample) + if len(bucket) == self.sort_size: + bucket.sort() + for x in bucket: + length, _, token = x + if length > max_lengths: + max_lengths = length + batch_lengths = max_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + yield batch + batch = [] + max_lengths = length + batch.append(token) + bucket = [] + buffer = [] + + if buffer: + random.shuffle(buffer) + for sample in buffer: + bucket.append(sample) + if len(bucket) == self.sort_size: + bucket.sort() + for x in bucket: + length, _, token = x + if length > max_lengths: + max_lengths = length + batch_lengths = max_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + yield batch + batch = [] + max_lengths = length + batch.append(token) + bucket = [] + buffer = [] + + if bucket: + bucket.sort() + for x in bucket: + length, _, token = x + if length > max_lengths: + max_lengths = length + batch_lengths = max_lengths * (len(batch) + 1) + if batch_lengths > self.batch_size: + yield batch + batch = [] + max_lengths = length + batch.append(token) + bucket = [] + + if batch: + yield batch diff --git a/funasr/datasets/large_datasets/datapipes/filter.py b/funasr/datasets/large_datasets/datapipes/filter.py new file mode 100644 index 0000000..c4f045d --- /dev/null +++ b/funasr/datasets/large_datasets/datapipes/filter.py @@ -0,0 +1,23 @@ +from torch.utils.data import IterableDataset + + +def default_fn(data): + return data + + +class FilterIterDataPipe(IterableDataset): + + def __init__(self, datapipe, fn=default_fn): + self.datapipe = datapipe + self.fn = fn + + def set_epoch(self, epoch): + self.datapipe.set_epoch(epoch) + + def __iter__(self): + assert callable(self.fn) + for data in self.datapipe: + if self.fn(data): + yield data + else: + continue diff --git a/funasr/datasets/large_datasets/datapipes/map.py b/funasr/datasets/large_datasets/datapipes/map.py new file mode 100644 index 0000000..f7211f9 --- /dev/null +++ b/funasr/datasets/large_datasets/datapipes/map.py @@ -0,0 +1,20 @@ +from torch.utils.data import IterableDataset + + +def default_fn(data): + return data + + +class MapperIterDataPipe(IterableDataset): + + def __init__(self, datapipe, fn=default_fn): + self.datapipe = datapipe + self.fn = fn + + def set_epoch(self, epoch): + self.datapipe.set_epoch(epoch) + + def __iter__(self): + assert callable(self.fn) + for data in self.datapipe: + yield self.fn(data) diff --git a/funasr/datasets/large_datasets/dataset.py b/funasr/datasets/large_datasets/dataset.py new file mode 100644 index 0000000..1e5b6c1 --- /dev/null +++ b/funasr/datasets/large_datasets/dataset.py @@ -0,0 +1,299 @@ +import logging +import os +import random +from functools import partial + +import torch +import torch.distributed as dist +import torchaudio +import numpy as np + +# import librosa +import librosa +from kaldiio import ReadHelper +from torch.utils.data import IterableDataset + +from funasr.datasets.large_datasets.datapipes.batch import MaxTokenBucketizerIterDataPipe +from funasr.datasets.large_datasets.datapipes.filter import FilterIterDataPipe +from funasr.datasets.large_datasets.datapipes.map import MapperIterDataPipe +from funasr.datasets.large_datasets.utils.clipping import clipping +from funasr.datasets.large_datasets.utils.filter import filter +from funasr.datasets.large_datasets.utils.padding import padding +from funasr.datasets.large_datasets.utils.tokenize import tokenize + + +def read_lists(list_file): + lists = [] + with open(list_file, "r", encoding="utf8") as fin: + for line in fin: + parts = line.strip() + lists.append(parts) + return lists + + +class AudioDataset(IterableDataset): + def __init__( + self, + scp_lists, + data_names, + data_types, + frontend_conf=None, + shuffle=True, + speed_perturb=None, + mode="train", + ): + self.scp_lists = scp_lists + self.data_names = data_names + self.data_types = data_types + self.frontend_conf = frontend_conf + self.shuffle = shuffle + self.mode = mode + self.epoch = -1 + self.rank = 0 + self.world_size = 1 + self.worker_id = 0 + self.num_workers = 1 + self.speed_perturb = speed_perturb + if self.speed_perturb is not None: + logging.info("Using speed_perturb: {}".format(speed_perturb)) + + def set_epoch(self, epoch): + self.epoch = epoch + + def get_rank_data_list(self, data_index): + assert dist.is_available() + if dist.is_initialized(): + self.rank = dist.get_rank() + self.world_size = dist.get_world_size() + else: + self.rank = 0 + self.world_size = 1 + + if self.mode == "train": + if self.shuffle: + random.seed(self.epoch) + random.shuffle(data_index) + return data_index[self.rank :: self.world_size] + + return data_index + + def get_worker_data_list(self, rank_data_index): + worker_info = torch.utils.data.get_worker_info() + if worker_info is None: + self.worker_id = 0 + self.num_workers = 1 + else: + self.worker_id = worker_info.id + self.num_workers = worker_info.num_workers + + return rank_data_index[self.worker_id :: self.num_workers] + + def close_reader(self, reader_list): + for reader in reader_list: + reader.close() + + def __iter__(self): + data_index = list(range(len(self.scp_lists))) + rank_data_index = self.get_rank_data_list(data_index) + worker_data_index = self.get_worker_data_list(rank_data_index) + + for index in worker_data_index: + data = dict(scp=self.scp_lists[index]) + + assert "scp" in data + scp = data["scp"] + data_file_list = scp.strip().split() + data_name_list = self.data_names.split(",") + data_type_list = self.data_types.split(",") + + for file in data_file_list: + assert os.path.exists(file), "{} not exists".format(file) + + assert ( + len(data_file_list) == len(data_name_list) == len(data_type_list) + ), "The item number of data, data_names, data_types must be the same " + + reader_list = [] + for data_file, data_type in zip(data_file_list, data_type_list): + if data_type == "kaldi_ark": + ark_reader = ReadHelper("ark:{}".format(data_file)) + reader_list.append(ark_reader) + elif data_type == "text" or data_type == "sound" or data_type == "text_hotword": + text_reader = open(data_file, "r", encoding="utf-8") + reader_list.append(text_reader) + elif data_type == "none": + continue + else: + raise TypeError("Data type {} is not supported".format(data_type)) + + for items in zip(*reader_list): + sample_dict = {} + for item, (data_name, data_type) in zip(items, zip(data_name_list, data_type_list)): + if data_type == "kaldi_ark": + key, mat = item + sample_dict[data_name] = mat + if data_name == "speech": + sample_dict["key"] = key + elif data_type == "sound": + key, path = item.strip().split() + try: + waveform, sampling_rate = torchaudio.load(path) + except: + # waveform, sampling_rate = librosa.load(path, dtype='float32') + waveform, sampling_rate = librosa.load(path, dtype="float32") + if waveform.ndim == 2: + waveform = waveform[:, 0] + waveform = np.expand_dims(waveform, axis=0) + waveform = torch.tensor(waveform) + if self.frontend_conf is not None: + if sampling_rate != self.frontend_conf["fs"]: + waveform = torchaudio.transforms.Resample( + orig_freq=sampling_rate, new_freq=self.frontend_conf["fs"] + )(waveform) + sampling_rate = self.frontend_conf["fs"] + waveform = waveform.numpy() + mat = waveform[0] + if self.speed_perturb is not None: + speed = random.choice(self.speed_perturb) + if speed != 1.0: + mat, _ = torchaudio.sox_effects.apply_effects_tensor( + torch.tensor(mat).view(1, -1), + sampling_rate, + [["speed", str(speed)], ["rate", str(sampling_rate)]], + ) + mat = mat.view(-1).numpy() + sample_dict[data_name] = mat + sample_dict["sampling_rate"] = sampling_rate + if data_name == "speech": + sample_dict["key"] = key + elif data_type == "text_hotword": + text = item + segs = text.strip().split() + sample_dict[data_name] = segs[1:] + if "key" not in sample_dict: + sample_dict["key"] = segs[0] + sample_dict["hw_tag"] = 1 + elif data_type == "text_nospace": + text = item + segs = text.strip().split(maxsplit=1) + sample_dict[data_name] = [x for x in segs[1]] + if "key" not in sample_dict: + sample_dict["key"] = segs[0] + else: + text = item + segs = text.strip().split() + sample_dict[data_name] = segs[1:] + if "key" not in sample_dict: + sample_dict["key"] = segs[0] + yield sample_dict + + self.close_reader(reader_list) + + +def len_fn_example(data): + return 1 + + +def len_fn_token(data): + assert "speech" in data + if "sampling_rate" in data: + return (data["speech"].shape[0] / data["sampling_rate"]) * 1000.0 + else: + return data["speech"].shape[0] + + +def Dataset( + data_list_file, + dict, + seg_dict, + punc_dict, + bpe_tokenizer, + conf, + frontend_conf, + speed_perturb=None, + mode="train", + batch_mode="padding", +): + scp_lists = read_lists(data_list_file) + shuffle = conf.get("shuffle", True) + data_names = conf.get("data_names", "speech,text") + data_types = conf.get("data_types", "kaldi_ark,text") + + pre_hwfile = conf.get("pre_hwlist", None) + # pre_prob = conf.get("pre_prob", 0) # unused yet + if pre_hwfile is not None: + pre_hwlist = [] + with open(pre_hwfile, "r", encoding="utf-8") as fin: + for line in fin.readlines(): + pre_hwlist.append(line.strip()) + else: + pre_hwlist = None + + hw_config = { + "sample_rate": conf.get("sample_rate", 0.6), + "double_rate": conf.get("double_rate", 0.1), + "hotword_min_length": conf.get("hotword_min_length", 2), + "hotword_max_length": conf.get("hotword_max_length", 8), + "pre_prob": conf.get("pre_prob", 0.0), + "pre_hwlist": pre_hwlist, + } + + dataset = AudioDataset( + scp_lists, + data_names, + data_types, + frontend_conf=frontend_conf, + shuffle=shuffle, + speed_perturb=speed_perturb, + mode=mode, + ) + + if "text" in data_names: + vocab = { + "vocab": dict, + "seg_dict": seg_dict, + "punc_dict": punc_dict, + "bpe_tokenizer": bpe_tokenizer, + "hw_config": hw_config, + } + tokenize_fn = partial(tokenize, **vocab) + dataset = MapperIterDataPipe(dataset, fn=tokenize_fn) + + filter_conf = conf.get("filter_conf", {}) + filter_fn = partial(filter, **filter_conf) + dataset = FilterIterDataPipe(dataset, fn=filter_fn) + + if shuffle: + buffer_conf = conf.get("shuffle_conf", {}) + buffer_size = buffer_conf["shuffle_size"] + sort_size = buffer_conf["sort_size"] + else: + buffer_size = 0 + sort_size = 1 + + batch_conf = conf.get("batch_conf", {}) + batch_size = batch_conf["batch_size"] + batch_type = batch_conf["batch_type"] + + assert batch_type in ["example", "token"] + if batch_type == "example": + len_fn = len_fn_example + else: + len_fn = len_fn_token + + dataset = MaxTokenBucketizerIterDataPipe( + dataset, + batch_size=batch_size, + len_fn=len_fn, + buffer_size=buffer_size, + sort_size=sort_size, + batch_mode=batch_mode, + ) + + int_pad_value = conf.get("int_pad_value", -1) + float_pad_value = conf.get("float_pad_value", 0.0) + padding_conf = {"int_pad_value": int_pad_value, "float_pad_value": float_pad_value} + padding_fn = partial(padding, **padding_conf) + dataset = MapperIterDataPipe(dataset, fn=padding_fn if batch_mode == "padding" else clipping) + + return dataset diff --git a/funasr/datasets/large_datasets/utils/__init__.py b/funasr/datasets/large_datasets/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/large_datasets/utils/clipping.py b/funasr/datasets/large_datasets/utils/clipping.py new file mode 100644 index 0000000..92f7d70 --- /dev/null +++ b/funasr/datasets/large_datasets/utils/clipping.py @@ -0,0 +1,44 @@ +import numpy as np +import torch + +from funasr.datasets.large_datasets.collate_fn import crop_to_max_size + + +def clipping(data): + assert isinstance(data, list) + assert "key" in data[0] + + keys = [x["key"] for x in data] + + batch = {} + data_names = data[0].keys() + for data_name in data_names: + if data_name == "key": + continue + else: + if data[0][data_name].dtype.kind == "i": + tensor_type = torch.int64 + else: + tensor_type = torch.float32 + + tensor_list = [torch.tensor(np.copy(d[data_name]), dtype=tensor_type) for d in data] + tensor_lengths = torch.tensor([len(d[data_name]) for d in data], dtype=torch.int32) + + length_clip = min(tensor_lengths) + tensor_clip = tensor_list[0].new_zeros( + len(tensor_list), length_clip, tensor_list[0].shape[1] + ) + for i, (tensor, length) in enumerate(zip(tensor_list, tensor_lengths)): + diff = length - length_clip + assert diff >= 0 + if diff == 0: + tensor_clip[i] = tensor + else: + tensor_clip[i] = crop_to_max_size(tensor, length_clip) + + batch[data_name] = tensor_clip + batch[data_name + "_lengths"] = torch.tensor( + [tensor.shape[0] for tensor in tensor_clip], dtype=torch.long + ) + + return keys, batch diff --git a/funasr/datasets/large_datasets/utils/filter.py b/funasr/datasets/large_datasets/utils/filter.py new file mode 100644 index 0000000..adc8fa0 --- /dev/null +++ b/funasr/datasets/large_datasets/utils/filter.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + + +def filter( + data, speech_length_min=100, speech_length_max=15000, token_length_min=0, token_length_max=200 +): + assert "speech" in data or "text" in data + + if "speech" in data and "text" in data: + if "sampling_rate" in data: + speech_length = (data["speech"].shape[0] / data["sampling_rate"]) * 1000.0 + else: + speech_length = data["speech"].shape[0] + num_tokens = len(data["text"]) + return ( + speech_length_min < speech_length < speech_length_max + and token_length_min < num_tokens < token_length_max + ) + elif "speech" in data: + if "sampling_rate" in data: + speech_length = (data["speech"].shape[0] / data["sampling_rate"]) * 1000.0 + else: + speech_length = data["speech"].shape[0] + return speech_length_min < speech_length < speech_length_max + else: + num_tokens = len(data["text"]) + return token_length_min < num_tokens < token_length_max diff --git a/funasr/datasets/large_datasets/utils/hotword_utils.py b/funasr/datasets/large_datasets/utils/hotword_utils.py new file mode 100644 index 0000000..66c131e --- /dev/null +++ b/funasr/datasets/large_datasets/utils/hotword_utils.py @@ -0,0 +1,42 @@ +import random + + +def sample_hotword( + length, + hotword_min_length, + hotword_max_length, + sample_rate, + double_rate, + pre_prob, + pre_index=None, + pre_hwlist=None, +): + if length < hotword_min_length: + return [-1] + if random.random() < sample_rate: + if pre_prob > 0 and random.random() < pre_prob and pre_index is not None: + return pre_index + if length == hotword_min_length: + return [0, length - 1] + elif random.random() < double_rate and length > hotword_max_length + hotword_min_length + 2: + # sample two hotwords in a sentence + _max_hw_length = min(hotword_max_length, length // 2) + # first hotword + start1 = random.randint(0, length // 3) + end1 = random.randint(start1 + hotword_min_length - 1, start1 + _max_hw_length - 1) + # second hotword + start2 = random.randint(end1 + 1, length - hotword_min_length) + end2 = random.randint( + min(length - 1, start2 + hotword_min_length - 1), + min(length - 1, start2 + hotword_max_length - 1), + ) + return [start1, end1, start2, end2] + else: # single hotword + start = random.randint(0, length - hotword_min_length) + end = random.randint( + min(length - 1, start + hotword_min_length - 1), + min(length - 1, start + hotword_max_length - 1), + ) + return [start, end] + else: + return [-1] diff --git a/funasr/datasets/large_datasets/utils/low_frame_rate.py b/funasr/datasets/large_datasets/utils/low_frame_rate.py new file mode 100644 index 0000000..87718e9 --- /dev/null +++ b/funasr/datasets/large_datasets/utils/low_frame_rate.py @@ -0,0 +1,30 @@ +import numpy as np + + +def build_LFR_features(data, m, n): + """ + Actually, this implements stacking frames and skipping frames. + if m = 1 and n = 1, just return the origin features. + if m = 1 and n > 1, it works like skipping. + if m > 1 and n = 1, it works like stacking but only support right frames. + if m > 1 and n > 1, it works like LFR. + + Args: + inputs_batch: inputs is T x D np.ndarray + m: number of frames to stack + n: number of frames to skip + """ + + LFR_inputs = [] + T = data.shape[0] + T_lfr = int(np.ceil(T / n)) + for i in range(T_lfr): + if m <= T - i * n: + LFR_inputs.append(np.hstack(data[i * n : i * n + m])) + else: + num_padding = m - (T - i * n) + frame = np.hstack(data[i * n :]) + for _ in range(num_padding): + frame = np.hstack((frame, data[-1])) + LFR_inputs.append(frame) + return np.vstack(LFR_inputs) diff --git a/funasr/datasets/large_datasets/utils/padding.py b/funasr/datasets/large_datasets/utils/padding.py new file mode 100644 index 0000000..cb43a27 --- /dev/null +++ b/funasr/datasets/large_datasets/utils/padding.py @@ -0,0 +1,72 @@ +import numpy as np +import torch +from torch.nn.utils.rnn import pad_sequence + + +def padding(data, float_pad_value=0.0, int_pad_value=-1): + assert isinstance(data, list) + assert "key" in data[0] + assert "speech" in data[0] or "text" in data[0] + + keys = [x["key"] for x in data] + + batch = {} + data_names = data[0].keys() + for data_name in data_names: + if data_name == "key" or data_name == "sampling_rate": + continue + else: + if data_name != "hotword_indxs": + if data[0][data_name].dtype.kind == "i": + pad_value = int_pad_value + tensor_type = torch.int64 + else: + pad_value = float_pad_value + tensor_type = torch.float32 + + tensor_list = [torch.tensor(np.copy(d[data_name]), dtype=tensor_type) for d in data] + tensor_lengths = torch.tensor([len(d[data_name]) for d in data], dtype=torch.int32) + tensor_pad = pad_sequence(tensor_list, batch_first=True, padding_value=pad_value) + batch[data_name] = tensor_pad + batch[data_name + "_lengths"] = tensor_lengths + + # SAC LABEL INCLUDE + if "hotword_indxs" in batch: + # if hotword indxs in batch + # use it to slice hotwords out + hotword_list = [] + hotword_lengths = [] + text = batch["text"] + text_lengths = batch["text_lengths"] + hotword_indxs = batch["hotword_indxs"] + dha_pad = torch.ones_like(text) * -1 + _, t1 = text.shape + t1 += 1 # TODO: as parameter which is same as predictor_bias + nth_hw = 0 + for b, (hotword_indx, one_text, length) in enumerate( + zip(hotword_indxs, text, text_lengths) + ): + dha_pad[b][:length] = 8405 + if hotword_indx[0] != -1: + start, end = int(hotword_indx[0]), int(hotword_indx[1]) + hotword = one_text[start : end + 1] + hotword_list.append(hotword) + hotword_lengths.append(end - start + 1) + dha_pad[b][start : end + 1] = one_text[start : end + 1] + nth_hw += 1 + if len(hotword_indx) == 4 and hotword_indx[2] != -1: + # the second hotword if exist + start, end = int(hotword_indx[2]), int(hotword_indx[3]) + hotword_list.append(one_text[start : end + 1]) + hotword_lengths.append(end - start + 1) + dha_pad[b][start : end + 1] = one_text[start : end + 1] + nth_hw += 1 + hotword_list.append(torch.tensor([1])) + hotword_lengths.append(1) + hotword_pad = pad_sequence(hotword_list, batch_first=True, padding_value=0) + batch["hotword_pad"] = hotword_pad + batch["hotword_lengths"] = torch.tensor(hotword_lengths, dtype=torch.int32) + batch["dha_pad"] = dha_pad + del batch["hotword_indxs"] + del batch["hotword_indxs_lengths"] + return keys, batch diff --git a/funasr/datasets/large_datasets/utils/tokenize.py b/funasr/datasets/large_datasets/utils/tokenize.py new file mode 100644 index 0000000..5a1ddd2 --- /dev/null +++ b/funasr/datasets/large_datasets/utils/tokenize.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +import re +import numpy as np +from funasr.datasets.large_datasets.utils.hotword_utils import sample_hotword + + +def forward_segment(text, seg_dict): + word_list = [] + i = 0 + while i < len(text): + longest_word = text[i] + for j in range(i + 1, len(text) + 1): + word = text[i:j] + if word in seg_dict: + if len(word) > len(longest_word): + longest_word = word + word_list.append(longest_word) + i += len(longest_word) + return word_list + + +def seg_tokenize(txt, seg_dict): + pattern = re.compile(r"^[\u4E00-\u9FA50-9]+$") + out_txt = "" + for word in txt: + word = word.lower() + if word in seg_dict: + out_txt += seg_dict[word] + " " + else: + if pattern.match(word): + for char in word: + if char in seg_dict: + out_txt += seg_dict[char] + " " + else: + out_txt += "" + " " + else: + out_txt += "" + " " + return out_txt.strip().split() + + +def tokenize(data, vocab=None, seg_dict=None, punc_dict=None, bpe_tokenizer=None, hw_config=None): + assert "text" in data + assert isinstance(vocab, dict) + text = data["text"] + token = [] + vad = -2 + if bpe_tokenizer is not None: + text = bpe_tokenizer.text2tokens(" ".join(text)) + if seg_dict is not None: + assert isinstance(seg_dict, dict) + text = seg_tokenize(text, seg_dict) + + length = len(text) + if "hw_tag" in data: + pre_index = None + if hw_config["pre_hwlist"] is not None and hw_config["pre_prob"] > 0: + # enable preset hotword detect in sampling + for hw in hw_config["pre_hwlist"]: + hw = " ".join(seg_tokenize(hw, seg_dict)) + _find = " ".join(text).find(hw) + if _find != -1: + # _find = text[:_find].count(" ") # bpe sometimes + pre_index = [_find, _find + max(hw.count(" "), 1)] + break + hotword_indxs = sample_hotword(length, **hw_config, pre_index=pre_index) + data["hotword_indxs"] = hotword_indxs + del data["hw_tag"] + for i in range(length): + x = text[i] + if i == length - 1 and "punc" in data and x.startswith("vad:"): + vad = x[4:] + if len(vad) == 0: + vad = -1 + else: + vad = int(vad) + elif x in vocab: + token.append(vocab[x]) + else: + token.append(vocab[""]) + + if "punc" in data and punc_dict is not None: + punc_token = [] + for punc in data["punc"]: + if punc in punc_dict: + punc_token.append(punc_dict[punc]) + else: + punc_token.append(punc_dict["_"]) + data["punc"] = np.array(punc_token) + + data["text"] = np.array(token) + if vad is not -2: + data["vad_indexes"] = np.array([vad], dtype=np.int64) + return data diff --git a/funasr/datasets/llm_datasets/__init__.py b/funasr/datasets/llm_datasets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/llm_datasets/datasets.py b/funasr/datasets/llm_datasets/datasets.py new file mode 100644 index 0000000..b660554 --- /dev/null +++ b/funasr/datasets/llm_datasets/datasets.py @@ -0,0 +1,436 @@ +import torch +import copy + +from funasr.register import tables +from funasr.utils.load_utils import extract_fbank, load_audio_text_image_video + + +@tables.register("dataset_classes", "AudioLLMNARDataset") +class AudioLLMNARDataset(torch.utils.data.Dataset): + """ + AudioLLMDataset + """ + + def __init__( + self, + path, + index_ds: str = None, + frontend=None, + tokenizer=None, + int_pad_value: int = -1, + float_pad_value: float = 0.0, + **kwargs + ): + super().__init__() + index_ds_class = tables.index_ds_classes.get(index_ds) + self.index_ds = index_ds_class(path, **kwargs) + preprocessor_speech = kwargs.get("preprocessor_speech", None) + if preprocessor_speech: + preprocessor_speech_class = tables.preprocessor_classes.get(preprocessor_speech) + preprocessor_speech = preprocessor_speech_class( + **kwargs.get("preprocessor_speech_conf", {}) + ) + self.preprocessor_speech = preprocessor_speech + preprocessor_text = kwargs.get("preprocessor_text", None) + if preprocessor_text: + preprocessor_text_class = tables.preprocessor_classes.get(preprocessor_text) + preprocessor_text = preprocessor_text_class(**kwargs.get("preprocessor_text_conf", {})) + self.preprocessor_text = preprocessor_text + + self.frontend = frontend + self.fs = 16000 if frontend is None else frontend.fs + self.data_type = "sound" + self.tokenizer = tokenizer + + self.float_pad_value = float_pad_value + self.prompt = kwargs.get("prompt", "Please copy the following text.") + self.prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format( + self.prompt + ) # "USER: \nINSTRUCTION: {}\nINPUT: {}\nASSISTANT: " + self.prompt_af = "" + self.IGNORE_INDEX = kwargs.get("IGNORE_INDEX", -100) + self.int_pad_value = self.IGNORE_INDEX + + def get_source_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_source_len(item) + + def get_target_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_target_len(item) + + def __len__(self): + return len(self.index_ds) + + def __getitem__(self, index): + item = self.index_ds[index] + # import pdb; + # pdb.set_trace() + source = item["source"] + data_src = load_audio_text_image_video(source, fs=self.fs) + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + speech = speech.squeeze(0) + + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + + prompt_ids_pre = self.tokenizer.encode(self.prompt_pre) # [bos,prompt] + prompt_ids_length = len(prompt_ids_pre) + + # bos prompt audio bos target + # prompt_input = "{}{}".format(self.prompt_pre, target) + # prompt_input_ids = self.tokenizer.encode(prompt_input) #[bos, prompt, input] + # audio_length = len(prompt_input_ids) - prompt_ids_length + target_ids = self.tokenizer.encode(target) + if target_ids[0] == self.tokenizer.bos_token_id: + target_ids = target_ids[1:] + target_ids_length = len(target_ids) + audio_length = target_ids_length + input_ids = ( + prompt_ids_pre + target_ids + [self.tokenizer.pad_token_id] + target_ids + ) # [bos, prompt, input, pad, target] + input_ids = torch.tensor( + copy.deepcopy(input_ids), dtype=torch.int64 + ) # [bos, prompt, input, pad, target] + input_ids[prompt_ids_length : prompt_ids_length + audio_length] = ( + -1 + ) # [bos, prompt,-1, pad, target] # it is no need, only for check + attention_mask = input_ids.ge(-1) # [true, true, true, true, true], length mask + + # bos prompt audio target eos + # prompt_answer = "{}{}".format(self.prompt_pre, target) + # prompt_answer_ids = self.tokenizer.encode(prompt_answer) #[bos, prompt, input] + # answer_length = len(prompt_answer_ids) - prompt_ids_length + target_ids = self.tokenizer.encode(target) + if target_ids[0] == self.tokenizer.bos_token_id: + target_ids = target_ids[1:] + # target_ids_length = len(target_ids) + labels_ids = ( + prompt_ids_pre + target_ids + target_ids + [self.tokenizer.eos_token_id] + ) # [bos, prompt, input, target, eos] + labels_ids = torch.tensor( + copy.deepcopy(labels_ids), dtype=torch.int64 + ) # [bos, prompt, input, target, eos] + labels_ids[:prompt_ids_length] = -1 # [-1, -1, input, target, eos] + label_mask = labels_ids.ge(0) # [false, false, true, true, true], length mask + labels_ids[~label_mask] = self.IGNORE_INDEX # [-1, -1, input, target, eos] + + audio_mask = ( + [0] * prompt_ids_length + [1] * audio_length + [0] * target_ids_length + [0] + ) # [0, 0, 1, 0, 0] + audio_mask = torch.tensor(audio_mask, dtype=torch.float32) + + ids = target_ids # self.tokenizer.encode(target) # token ids is different from labels_ids + text = torch.tensor(ids, dtype=torch.int64) + text_lengths = torch.tensor([len(ids)], dtype=torch.int32) + + prompt_bos_length = torch.tensor([len(prompt_ids_pre)], dtype=torch.int32) + + return { + "speech": speech, + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + "input_ids": input_ids, + "attention_mask": attention_mask, + "labels_ids": labels_ids, + "label_mask": label_mask, + "audio_mask": audio_mask, + "prompt_bos_length": prompt_bos_length, + } + + def collator(self, samples: list = None): + outputs = {} + for sample in samples: + for key in sample.keys(): + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + return outputs + + +@tables.register("dataset_classes", "AudioLLMDataset") +class AudioLLMDataset(torch.utils.data.Dataset): + """ + AudioLLMDataset + """ + + def __init__( + self, + path, + index_ds: str = None, + frontend=None, + tokenizer=None, + int_pad_value: int = -1, + float_pad_value: float = 0.0, + **kwargs + ): + super().__init__() + index_ds_class = tables.index_ds_classes.get(index_ds) + self.index_ds = index_ds_class(path, **kwargs) + preprocessor_speech = kwargs.get("preprocessor_speech", None) + if preprocessor_speech: + preprocessor_speech_class = tables.preprocessor_classes.get(preprocessor_speech) + preprocessor_speech = preprocessor_speech_class( + **kwargs.get("preprocessor_speech_conf", {}) + ) + self.preprocessor_speech = preprocessor_speech + preprocessor_text = kwargs.get("preprocessor_text", None) + if preprocessor_text: + preprocessor_text_class = tables.preprocessor_classes.get(preprocessor_text) + preprocessor_text = preprocessor_text_class(**kwargs.get("preprocessor_text_conf", {})) + self.preprocessor_text = preprocessor_text + + self.frontend = frontend + self.fs = 16000 if frontend is None else frontend.fs + self.data_type = "sound" + self.tokenizer = tokenizer + + self.float_pad_value = float_pad_value + self.prompt = kwargs.get("prompt", "Transcribe speech to text.") + self.prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format( + self.prompt + ) # "USER: \nINSTRUCTION: {}\nnINPUT: {}\nASSISTANT: " + self.prompt_af = "" + self.IGNORE_INDEX = kwargs.get("IGNORE_INDEX", -100) + self.int_pad_value = self.IGNORE_INDEX + + def get_source_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_source_len(item) + + def get_target_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_target_len(item) + + def __len__(self): + return len(self.index_ds) + + def __getitem__(self, index): + item = self.index_ds[index] + # import pdb; + # pdb.set_trace() + source = item["source"] + data_src = load_audio_text_image_video(source, fs=self.fs) + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + speech = speech.squeeze(0) + + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + + prompt_ids_pre = self.tokenizer.encode(self.prompt_pre) # [bos,prompt] + prompt_ids_length = len(prompt_ids_pre) + + prompt_input = "{}{}".format(self.prompt_pre, target) + prompt_input_ids = self.tokenizer.encode(prompt_input) + audio_length = len(prompt_input_ids) - prompt_ids_length + input_ids = prompt_input_ids + [self.tokenizer.pad_token_id] + input_ids = torch.tensor(input_ids, dtype=torch.int64) # [bos, prompt, input, pad] + input_ids[prompt_ids_length:] = -1 # [bos, prompt,-1,-1] + attention_mask = input_ids.ge(-1) # [true, true, true, true], length mask + + prompt_answer = "{}{}".format(self.prompt_pre, target) + prompt_answer_ids = self.tokenizer.encode(prompt_answer) + answer_length = len(prompt_answer_ids) - prompt_ids_length + labels_ids = copy.deepcopy(prompt_input_ids) + [self.tokenizer.eos_token_id] + labels_ids = torch.tensor(labels_ids, dtype=torch.int64) # [bos, prompt, input, eos] + labels_ids[:prompt_ids_length] = -1 # [-1, -1, input, eos] + label_mask = labels_ids.ge(0) # [False,False,True,True] + labels_ids[~label_mask] = self.IGNORE_INDEX # [-100,-100,input,eos] + + audio_mask = [0] * prompt_ids_length + [1] * audio_length + [0] + audio_mask = torch.tensor(audio_mask, dtype=torch.float32) + + ids = self.tokenizer.encode(target) # token ids is different from labels_ids + text = torch.tensor(ids, dtype=torch.int64) + text_lengths = torch.tensor([len(ids)], dtype=torch.int32) + + return { + "speech": speech, + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + "input_ids": input_ids, + "attention_mask": attention_mask, + "labels_ids": labels_ids, + "label_mask": label_mask, + "audio_mask": audio_mask, + } + + def collator(self, samples: list = None): + outputs = {} + for sample in samples: + for key in sample.keys(): + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + return outputs + + +@tables.register("dataset_classes", "AudioLLMARDataset") +class AudioLLMARDataset(torch.utils.data.Dataset): + """ + AudioLLMDataset + """ + + def __init__( + self, + path, + index_ds: str = None, + frontend=None, + tokenizer=None, + int_pad_value: int = -1, + float_pad_value: float = 0.0, + **kwargs + ): + super().__init__() + index_ds_class = tables.index_ds_classes.get(index_ds) + self.index_ds = index_ds_class(path, **kwargs) + preprocessor_speech = kwargs.get("preprocessor_speech", None) + if preprocessor_speech: + preprocessor_speech_class = tables.preprocessor_classes.get(preprocessor_speech) + preprocessor_speech = preprocessor_speech_class( + **kwargs.get("preprocessor_speech_conf", {}) + ) + self.preprocessor_speech = preprocessor_speech + preprocessor_text = kwargs.get("preprocessor_text", None) + if preprocessor_text: + preprocessor_text_class = tables.preprocessor_classes.get(preprocessor_text) + preprocessor_text = preprocessor_text_class(**kwargs.get("preprocessor_text_conf", {})) + self.preprocessor_text = preprocessor_text + + self.frontend = frontend + self.fs = 16000 if frontend is None else frontend.fs + self.data_type = "sound" + self.tokenizer = tokenizer + + self.float_pad_value = float_pad_value + self.prompt = kwargs.get("prompt", "Transcribe speech to text.") + self.prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format( + self.prompt + ) # "USER: \nINSTRUCTION: {}\nnINPUT: {}\nASSISTANT: " + self.prompt_af = "" + self.IGNORE_INDEX = kwargs.get("IGNORE_INDEX", -100) + self.int_pad_value = self.IGNORE_INDEX + + def get_source_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_source_len(item) + + def get_target_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_target_len(item) + + def __len__(self): + return len(self.index_ds) + + def __getitem__(self, index): + item = self.index_ds[index] + # import pdb; + # pdb.set_trace() + source = item["source"] + data_src = load_audio_text_image_video(source, fs=self.fs) + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + speech = speech.squeeze(0) + + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + + prompt_ids_pre = self.tokenizer.encode(self.prompt_pre) # [bos,prompt] + prompt_ids_length = len(prompt_ids_pre) + + prompt_input = "{}{}".format(self.prompt_pre, target) + prompt_input_ids = self.tokenizer.encode(prompt_input) + audio_length = len(prompt_input_ids) - prompt_ids_length + input_ids = prompt_input_ids + [self.tokenizer.pad_token_id] + input_ids = torch.tensor(input_ids, dtype=torch.int64) # [bos, prompt, input, pad] + input_ids[prompt_ids_length:] = -1 # [bos, prompt,-1,-1] + attention_mask = input_ids.ge(-1) # [true, true, true, true], length mask + + prompt_answer = "{}{}".format(self.prompt_pre, target) + prompt_answer_ids = self.tokenizer.encode(prompt_answer) + answer_length = len(prompt_answer_ids) - prompt_ids_length + labels_ids = copy.deepcopy(prompt_input_ids) + [self.tokenizer.eos_token_id] + labels_ids = torch.tensor(labels_ids, dtype=torch.int64) # [bos, prompt, input, eos] + labels_ids[:prompt_ids_length] = -1 # [-1, -1, input, eos] + label_mask = labels_ids.ge(0) # [False,False,True,True] + labels_ids[~label_mask] = self.IGNORE_INDEX # [-100,-100,input,eos] + + audio_mask = [0] * prompt_ids_length + [1] * audio_length + [0] + audio_mask = torch.tensor(audio_mask, dtype=torch.float32) + + ids = self.tokenizer.encode(target) # token ids is different from labels_ids + text = torch.tensor(ids, dtype=torch.int64) + text_lengths = torch.tensor([len(ids)], dtype=torch.int32) + + return { + "speech": speech, + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + "input_ids": input_ids, + "attention_mask": attention_mask, + "labels_ids": labels_ids, + "label_mask": label_mask, + "audio_mask": audio_mask, + } + + def collator(self, samples: list = None): + outputs = {} + for sample in samples: + for key in sample.keys(): + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + return outputs diff --git a/funasr/datasets/llm_datasets/preprocessor.py b/funasr/datasets/llm_datasets/preprocessor.py new file mode 100644 index 0000000..b99255e --- /dev/null +++ b/funasr/datasets/llm_datasets/preprocessor.py @@ -0,0 +1,34 @@ +import os +import json +import torch +import logging +import concurrent.futures +import librosa +import torch.distributed as dist +from typing import Collection +import torch +import torchaudio +from torch import nn +import random +import re +import string +from funasr.tokenizer.cleaner import TextCleaner +from funasr.register import tables + + +@tables.register("preprocessor_classes", "TextPreprocessRemovePunctuation") +class TextPreprocessRemovePunctuation(nn.Module): + def __init__(self, **kwargs): + super().__init__() + + def forward(self, text, **kwargs): + # 定义英文标点符号 + en_punct = string.punctuation + # 定义中文标点符号(部分常用的) + cn_punct = "。?!,、;:“”‘’()《》【】…—~·" + # 合并英文和中文标点符号 + all_punct = en_punct + cn_punct + # 创建正则表达式模式,匹配任何在all_punct中的字符 + punct_pattern = re.compile("[{}]".format(re.escape(all_punct))) + # 使用正则表达式的sub方法替换掉这些字符 + return punct_pattern.sub("", text) diff --git a/funasr/datasets/llm_datasets_qwenaudio/__init__.py b/funasr/datasets/llm_datasets_qwenaudio/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/llm_datasets_qwenaudio/datasets.py b/funasr/datasets/llm_datasets_qwenaudio/datasets.py new file mode 100644 index 0000000..b56e624 --- /dev/null +++ b/funasr/datasets/llm_datasets_qwenaudio/datasets.py @@ -0,0 +1,161 @@ +import torch +import copy + +from funasr.register import tables +from funasr.utils.load_utils import extract_fbank, load_audio_text_image_video + + +@tables.register("dataset_classes", "AudioLLMQwenAudioDataset") +class AudioLLMQwenAudioDataset(torch.utils.data.Dataset): + """ + AudioLLMDataset + """ + + def __init__( + self, + path, + index_ds: str = None, + frontend=None, + tokenizer=None, + int_pad_value: int = -1, + float_pad_value: float = 0.0, + **kwargs + ): + super().__init__() + index_ds_class = tables.index_ds_classes.get(index_ds) + self.index_ds = index_ds_class(path, **kwargs) + preprocessor_speech = kwargs.get("preprocessor_speech", None) + if preprocessor_speech: + preprocessor_speech_class = tables.preprocessor_classes.get(preprocessor_speech) + preprocessor_speech = preprocessor_speech_class( + **kwargs.get("preprocessor_speech_conf", {}) + ) + self.preprocessor_speech = preprocessor_speech + preprocessor_text = kwargs.get("preprocessor_text", None) + if preprocessor_text: + preprocessor_text_class = tables.preprocessor_classes.get(preprocessor_text) + preprocessor_text = preprocessor_text_class(**kwargs.get("preprocessor_text_conf", {})) + self.preprocessor_text = preprocessor_text + + self.frontend = frontend + self.fs = 16000 if frontend is None else frontend.fs + self.data_type = "sound" + self.tokenizer = tokenizer + + self.float_pad_value = float_pad_value + self.prompt = kwargs.get("prompt", "Transcribe speech to text.") + # self.prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format(self.prompt) # "USER: \nINSTRUCTION: {}\nnINPUT: {}\nASSISTANT: " + self.prompt_af = "" + self.IGNORE_INDEX = kwargs.get("IGNORE_INDEX", -100) + self.int_pad_value = self.IGNORE_INDEX + self.audio_adaptor_downsample_rate = kwargs.get("audio_adaptor_downsample_rate", 5) + self.audio_encoder_downsample_rate = kwargs.get("audio_encoder_downsample_rate", 2) + self.prompt_template = "{}" + self.answer_template = "{}" + + def get_source_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_source_len(item) + + def get_target_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_target_len(item) + + def __len__(self): + return len(self.index_ds) + + def __getitem__(self, index): + item = self.index_ds[index] + # import pdb; + # pdb.set_trace() + source = item["source"] + data_src = load_audio_text_image_video(source, fs=self.fs) + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + speech = speech.squeeze(0) + + audio_pseudo_length = ( + (speech.shape[0] + 1) + // self.audio_adaptor_downsample_rate + // self.audio_encoder_downsample_rate + ) + audio_pseudo = torch.full((audio_pseudo_length,), -1) # placeholder + + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + + self.prompt_pre = self.prompt_template.format(self.prompt) + prompt_ids_pre = self.tokenizer.encode(self.prompt_pre) # [bos,prompt] + prompt_pre_length = len(prompt_ids_pre) + + # input + input = self.answer_template.format(target.lower()) + prompt_input = "{}{}".format(self.prompt_pre, input) + prompt_input_ids = self.tokenizer.encode(prompt_input) # [bos, prompt, input] + # audio_length = len(prompt_input_ids) - prompt_pre_length + input_ids = prompt_input_ids + [self.tokenizer.pad_token_id] # [bos, prompt, input, pad] + input_ids_length = len(input_ids) + input_ids = torch.tensor(input_ids, dtype=torch.int64) # [bos, prompt, input, pad] + input_ids = torch.cat((audio_pseudo, input_ids)) # [audio, bos, prompt, input, pad] + # input_ids[:audio_pseudo_length] = -1 # [-1, bos, prompt, input, pad] + attention_mask = input_ids.ge(-1) # [true, true, true, true, true], length mask + # input_ids[prompt_pre_length:] = -1 # [bos, prompt,-1,-1] + # attention_mask = input_ids.ge(-1) # [true, true, true, true], length mask + + # label + answer = self.answer_template.format(target.lower()) + prompt_answer = "{}{}".format(self.prompt_pre, answer) + prompt_answer_ids = self.tokenizer.encode(prompt_answer) + # answer_length = len(prompt_answer_ids) - prompt_pre_length + labels_ids = copy.deepcopy(prompt_answer_ids) + [self.tokenizer.eos_token_id] + labels_ids = torch.tensor(labels_ids, dtype=torch.int64) # [bos, prompt, answer, eos] + labels_ids = torch.cat((audio_pseudo, labels_ids)) # [audio, bos, prompt, answer, eos] + labels_ids[: audio_pseudo_length + prompt_pre_length] = -1 # [-1, -1, -1, answer, eos] + # labels_ids[:prompt_pre_length] = -1 # [-1, -1, input, eos] + label_mask = labels_ids.ge(0) # [false, false, false, true, true] + labels_ids[~label_mask] = self.IGNORE_INDEX # [-100, -100, -100, answer, eos] + + # audio_mask for input_ids + audio_mask = [1] * audio_pseudo_length + [0] * input_ids_length + audio_mask = torch.tensor(audio_mask, dtype=torch.float32) + + ids = self.tokenizer.encode(target) # token ids is different from labels_ids + text = torch.tensor(ids, dtype=torch.int64) + text_lengths = torch.tensor([len(ids)], dtype=torch.int32) + + return { + "speech": speech, + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + "input_ids": input_ids, + "attention_mask": attention_mask, + "labels_ids": labels_ids, + "label_mask": label_mask, + "audio_mask": audio_mask, + } + + def collator(self, samples: list = None): + outputs = {} + for sample in samples: + for key in sample.keys(): + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + return outputs diff --git a/funasr/datasets/llm_datasets_vicuna/__init__.py b/funasr/datasets/llm_datasets_vicuna/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/llm_datasets_vicuna/datasets.py b/funasr/datasets/llm_datasets_vicuna/datasets.py new file mode 100644 index 0000000..04fa514 --- /dev/null +++ b/funasr/datasets/llm_datasets_vicuna/datasets.py @@ -0,0 +1,161 @@ +import torch +import copy + +from funasr.register import tables +from funasr.utils.load_utils import extract_fbank, load_audio_text_image_video + + +@tables.register("dataset_classes", "AudioLLMVicunaDataset") +class AudioLLMVicunaDataset(torch.utils.data.Dataset): + """ + AudioLLMDataset + """ + + def __init__( + self, + path, + index_ds: str = None, + frontend=None, + tokenizer=None, + int_pad_value: int = -1, + float_pad_value: float = 0.0, + **kwargs + ): + super().__init__() + index_ds_class = tables.index_ds_classes.get(index_ds) + self.index_ds = index_ds_class(path, **kwargs) + preprocessor_speech = kwargs.get("preprocessor_speech", None) + if preprocessor_speech: + preprocessor_speech_class = tables.preprocessor_classes.get(preprocessor_speech) + preprocessor_speech = preprocessor_speech_class( + **kwargs.get("preprocessor_speech_conf", {}) + ) + self.preprocessor_speech = preprocessor_speech + preprocessor_text = kwargs.get("preprocessor_text", None) + if preprocessor_text: + preprocessor_text_class = tables.preprocessor_classes.get(preprocessor_text) + preprocessor_text = preprocessor_text_class(**kwargs.get("preprocessor_text_conf", {})) + self.preprocessor_text = preprocessor_text + + self.frontend = frontend + self.fs = 16000 if frontend is None else frontend.fs + self.data_type = "sound" + self.tokenizer = tokenizer + + self.float_pad_value = float_pad_value + self.prompt = kwargs.get("prompt", "Transcribe speech to text.") + # self.prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format(self.prompt) # "USER: \nINSTRUCTION: {}\nnINPUT: {}\nASSISTANT: " + self.prompt_af = "" + self.IGNORE_INDEX = kwargs.get("IGNORE_INDEX", -100) + self.int_pad_value = self.IGNORE_INDEX + self.audio_adaptor_downsample_rate = kwargs.get("audio_adaptor_downsample_rate", 5) + self.audio_encoder_downsample_rate = kwargs.get("audio_encoder_downsample_rate", 2) + self.prompt_template = "USER: {}\n ASSISTANT:" + self.answer_template = "{}" + + def get_source_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_source_len(item) + + def get_target_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_target_len(item) + + def __len__(self): + return len(self.index_ds) + + def __getitem__(self, index): + item = self.index_ds[index] + # import pdb; + # pdb.set_trace() + source = item["source"] + data_src = load_audio_text_image_video(source, fs=self.fs) + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + speech = speech.squeeze(0) + + audio_pseudo_length = ( + (speech.shape[0] + 1) + // self.audio_adaptor_downsample_rate + // self.audio_encoder_downsample_rate + ) + audio_pseudo = torch.full((audio_pseudo_length,), -1) # placeholder + + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + + self.prompt_pre = self.prompt_template.format(self.prompt) + prompt_ids_pre = self.tokenizer.encode(self.prompt_pre) # [bos,prompt] + prompt_pre_length = len(prompt_ids_pre) + + # input + input = self.answer_template.format(target.lower()) + prompt_input = "{}{}".format(self.prompt_pre, input) + prompt_input_ids = self.tokenizer.encode(prompt_input) # [bos, prompt, input] + # audio_length = len(prompt_input_ids) - prompt_pre_length + input_ids = prompt_input_ids + [self.tokenizer.pad_token_id] # [bos, prompt, input, pad] + input_ids_length = len(input_ids) + input_ids = torch.tensor(input_ids, dtype=torch.int64) # [bos, prompt, input, pad] + input_ids = torch.cat((audio_pseudo, input_ids)) # [audio, bos, prompt, input, pad] + # input_ids[:audio_pseudo_length] = -1 # [-1, bos, prompt, input, pad] + attention_mask = input_ids.ge(-1) # [true, true, true, true, true], length mask + # input_ids[prompt_pre_length:] = -1 # [bos, prompt,-1,-1] + # attention_mask = input_ids.ge(-1) # [true, true, true, true], length mask + + # label + answer = self.answer_template.format(target.lower()) + prompt_answer = "{}{}".format(self.prompt_pre, answer) + prompt_answer_ids = self.tokenizer.encode(prompt_answer) + # answer_length = len(prompt_answer_ids) - prompt_pre_length + labels_ids = copy.deepcopy(prompt_answer_ids) + [self.tokenizer.eos_token_id] + labels_ids = torch.tensor(labels_ids, dtype=torch.int64) # [bos, prompt, answer, eos] + labels_ids = torch.cat((audio_pseudo, labels_ids)) # [audio, bos, prompt, answer, eos] + labels_ids[: audio_pseudo_length + prompt_pre_length] = -1 # [-1, -1, -1, answer, eos] + # labels_ids[:prompt_pre_length] = -1 # [-1, -1, input, eos] + label_mask = labels_ids.ge(0) # [false, false, false, true, true] + labels_ids[~label_mask] = self.IGNORE_INDEX # [-100, -100, -100, answer, eos] + + # audio_mask for input_ids + audio_mask = [1] * audio_pseudo_length + [0] * input_ids_length + audio_mask = torch.tensor(audio_mask, dtype=torch.float32) + + ids = self.tokenizer.encode(target) # token ids is different from labels_ids + text = torch.tensor(ids, dtype=torch.int64) + text_lengths = torch.tensor([len(ids)], dtype=torch.int32) + + return { + "speech": speech, + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + "input_ids": input_ids, + "attention_mask": attention_mask, + "labels_ids": labels_ids, + "label_mask": label_mask, + "audio_mask": audio_mask, + } + + def collator(self, samples: list = None): + outputs = {} + for sample in samples: + for key in sample.keys(): + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + return outputs diff --git a/funasr/datasets/sense_voice_datasets/__init__.py b/funasr/datasets/sense_voice_datasets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/datasets/sense_voice_datasets/datasets.py b/funasr/datasets/sense_voice_datasets/datasets.py new file mode 100644 index 0000000..690a1c5 --- /dev/null +++ b/funasr/datasets/sense_voice_datasets/datasets.py @@ -0,0 +1,232 @@ +import logging + +import torch +import random +import traceback +from funasr.register import tables +from funasr.utils.load_utils import extract_fbank, load_audio_text_image_video + + +@tables.register("dataset_classes", "SenseVoiceDataset") +class SenseVoiceDataset(torch.utils.data.Dataset): + """ + SenseVoiceDataset + """ + + def __init__( + self, + path, + index_ds: str = None, + frontend=None, + tokenizer=None, + int_pad_value: int = -1, + float_pad_value: float = 0.0, + **kwargs, + ): + super().__init__() + index_ds_class = tables.index_ds_classes.get(index_ds) + self.index_ds = index_ds_class(path, **kwargs) + preprocessor_speech = kwargs.get("preprocessor_speech", None) + if preprocessor_speech: + preprocessor_speech_class = tables.preprocessor_classes.get(preprocessor_speech) + preprocessor_speech = preprocessor_speech_class( + **kwargs.get("preprocessor_speech_conf") + ) + self.preprocessor_speech = preprocessor_speech + preprocessor_text = kwargs.get("preprocessor_text", None) + if preprocessor_text: + preprocessor_text_class = tables.preprocessor_classes.get(preprocessor_text) + preprocessor_text = preprocessor_text_class(**kwargs.get("preprocessor_text_conf")) + self.preprocessor_text = preprocessor_text + + self.frontend = frontend + self.fs = 16000 if frontend is None else frontend.fs + self.data_type = "sound" + self.tokenizer = tokenizer + + self.int_pad_value = int_pad_value + self.float_pad_value = float_pad_value + self.sos = kwargs.get("sos", "<|startoftranscript|>") + self.eos = kwargs.get("eos", "<|endoftext|>") + self.batch_size = kwargs.get("batch_size") + self.batch_type = kwargs.get("batch_type") + self.prompt_ids_len = 0 + self.retry = kwargs.get("retry", 5) + + self.permute = False + from funasr.frontends.whisper_frontend import WhisperFrontend + + if isinstance(self.frontend, WhisperFrontend): + self.permute = True + + def get_source_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_source_len(item) + + def get_target_len(self, index): + item = self.index_ds[index] + return self.index_ds.get_target_len(item) + + def __len__(self): + return len(self.index_ds) + + def __getitem__(self, index): + # import pdb; + # pdb.set_trace() + + output = None + for idx in range(self.retry): + if idx == 0: + index_cur = index + else: + index_cur = torch.randint(0, len(self.index_ds), ()).item() + + item = self.index_ds[index_cur] + + source = item["source"] + try: + data_src = load_audio_text_image_video(source, fs=self.fs) + except Exception as e: + logging.error(f"Loading wav failed! {str(e)}, {traceback.format_exc()}") + continue + + if self.preprocessor_speech: + data_src = self.preprocessor_speech(data_src, fs=self.fs) + speech, speech_lengths = extract_fbank( + data_src, data_type=self.data_type, frontend=self.frontend, is_final=True + ) # speech: [b, T, d] + + if speech_lengths > self.batch_size: + continue + if self.permute: + speech = speech.permute(0, 2, 1) + target = item["target"] + if self.preprocessor_text: + target = self.preprocessor_text(target) + + task = item.get("prompt", "<|ASR|>") + text_language = item.get("text_language", "<|zh|>") + + if isinstance(self.sos, str): + prompt = f"{self.sos}{task}{text_language}" + prompt_ids = self.tokenizer.encode(prompt, allowed_special="all") + else: + prompt = f"{task}{text_language}" + prompt_ids = self.tokenizer.encode(prompt, allowed_special="all") + prompt_ids = [self.sos] + prompt_ids + + prompt_ids_len = len(prompt_ids) - 1 # [sos, task] + self.prompt_ids_len = prompt_ids_len + + target_ids = self.tokenizer.encode(target, allowed_special="all") + target_ids_len = len(target_ids) + 1 # [lid, text] + if target_ids_len > 200: + continue + + if isinstance(self.eos, str): + eos = self.tokenizer.encode(self.eos, allowed_special="all") # [eos] + else: + eos = [self.eos] + + ids = prompt_ids + target_ids + eos # [sos, task, lid, text, eos] + ids_lengths = len(ids) + + text = torch.tensor(ids, dtype=torch.int64) + text_lengths = torch.tensor([ids_lengths], dtype=torch.int32) + + target_mask = ( + [0] * (prompt_ids_len) + [1] * (target_ids_len) + [1] + ) # [sos, task, lid, text, eos]: [0, 0, 1, 1, 1] + target_mask_lengths = len(target_mask) + target_mask = torch.tensor(target_mask, dtype=torch.float32) + target_mask_lengths = torch.tensor([target_mask_lengths], dtype=torch.int32) + + output = { + "speech": speech[0, :, :], + "speech_lengths": speech_lengths, + "text": text, + "text_lengths": text_lengths, + "target_mask": target_mask, + "target_mask_lengths": target_mask_lengths, + } + break + + return output + + def collator(self, samples: list = None): + outputs = {} + for sample in samples: + if sample is None: + continue + for key in sample.keys(): + if key not in outputs: + outputs[key] = [] + outputs[key].append(sample[key]) + + if len(outputs) < 1: + logging.error(f"ERROR: data is empty!") + outputs = { + "speech": torch.rand((10, 128), dtype=torch.float32)[None, :, :], + "speech_lengths": torch.tensor( + [ + 10, + ], + dtype=torch.int32, + )[:, None], + "text": torch.tensor( + [ + 58836, + ], + dtype=torch.int32, + )[None, :], + "text_lengths": torch.tensor( + [ + 1, + ], + dtype=torch.int32, + )[:, None], + "target_mask": torch.tensor([[0] * (self.prompt_ids_len) + [1] * (1) + [1]])[ + None, : + ], + } + return outputs + + for key, data_list in outputs.items(): + if isinstance(data_list[0], torch.Tensor): + if data_list[0].dtype == torch.int64 or data_list[0].dtype == torch.int32: + + pad_value = self.int_pad_value + else: + pad_value = self.float_pad_value + + outputs[key] = torch.nn.utils.rnn.pad_sequence( + data_list, batch_first=True, padding_value=pad_value + ) + + if self.batch_type != "example": + for i in range(10): + outputs = self._filter_badcase(outputs, i=i) + + return outputs + + def _filter_badcase(self, outputs, i=0): + b, t, _ = outputs["speech"].shape + + if b * t > self.batch_size * 1.25: + beg = torch.randint(0, 2, ()).item() + if b < 2: + beg = 0 + logging.info( + f"Warning, b * t: {b * t} > {self.batch_size}, drop half data {i}th, beg:{beg}" + ) + for key, data_list in outputs.items(): + outputs[key] = outputs[key][beg : beg + b : 2] + + speech_lengths_max = outputs["speech_lengths"].max().item() + outputs["speech"] = outputs["speech"][:, :speech_lengths_max, :] + text_lengths_max = outputs["text_lengths"].max().item() + outputs["text"] = outputs["text"][:, :text_lengths_max] + target_mask_lengths_max = outputs["target_mask_lengths"].max().item() + outputs["target_mask"] = outputs["target_mask"][:, :target_mask_lengths_max] + + return outputs diff --git a/funasr/download/__init__.py b/funasr/download/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/download/download_dataset_from_hub.py b/funasr/download/download_dataset_from_hub.py new file mode 100644 index 0000000..2419ce8 --- /dev/null +++ b/funasr/download/download_dataset_from_hub.py @@ -0,0 +1,14 @@ +def download_dataset(): + pass + + +def download_dataset_from_ms(**kwargs): + from modelscope.msdatasets import MsDataset + + dataset_name = kwargs.get("dataset_name", "speech_asr/speech_asr_aishell1_trainsets") + subset_name = kwargs.get("subset_name", "default") + split = kwargs.get("split", "train") + data_dump_dir = kwargs.get("data_dump_dir", None) + ds = MsDataset.load( + dataset_name=dataset_name, subset_name=subset_name, split=split, cache_dir=data_dump_dir + ) diff --git a/funasr/download/download_from_hub.py b/funasr/download/download_from_hub.py new file mode 100644 index 0000000..075b131 --- /dev/null +++ b/funasr/download/download_from_hub.py @@ -0,0 +1,218 @@ +import os +import json +from omegaconf import OmegaConf, DictConfig + +from funasr.download.name_maps_from_hub import name_maps_ms, name_maps_hf, name_maps_openai + + +def download_model(**kwargs): + hub = kwargs.get("hub", "ms") + if hub == "ms": + kwargs = download_from_ms(**kwargs) + elif hub == "hf": + kwargs = download_from_hf(**kwargs) + elif hub == "openai": + model_or_path = kwargs.get("model") + if os.path.exists(model_or_path): + # local path + kwargs["model_path"] = model_or_path + kwargs["model"] = "WhisperWarp" + else: + # model name + if model_or_path in name_maps_openai: + model_or_path = name_maps_openai[model_or_path] + kwargs["model_path"] = model_or_path + + return kwargs + + +def download_from_ms(**kwargs): + model_or_path = kwargs.get("model") + if model_or_path in name_maps_ms: + model_or_path = name_maps_ms[model_or_path] + model_revision = kwargs.get("model_revision", "master") + if not os.path.exists(model_or_path) and "model_path" not in kwargs: + try: + model_or_path = get_or_download_model_dir( + model_or_path, + model_revision, + is_training=kwargs.get("is_training"), + check_latest=kwargs.get("check_latest", True), + ) + except Exception as e: + print(f"Download: {model_or_path} failed!: {e}") + + kwargs["model_path"] = model_or_path if "model_path" not in kwargs else kwargs["model_path"] + + if os.path.exists(os.path.join(model_or_path, "configuration.json")): + with open(os.path.join(model_or_path, "configuration.json"), "r", encoding="utf-8") as f: + conf_json = json.load(f) + + cfg = {} + if "file_path_metas" in conf_json: + add_file_root_path(model_or_path, conf_json["file_path_metas"], cfg) + cfg.update(kwargs) + if "config" in cfg: + config = OmegaConf.load(cfg["config"]) + kwargs = OmegaConf.merge(config, cfg) + kwargs["model"] = config["model"] + elif os.path.exists(os.path.join(model_or_path, "config.yaml")) and os.path.exists( + os.path.join(model_or_path, "model.pt") + ): + config = OmegaConf.load(os.path.join(model_or_path, "config.yaml")) + kwargs = OmegaConf.merge(config, kwargs) + init_param = os.path.join(model_or_path, "model.pb") + kwargs["init_param"] = init_param + if os.path.exists(os.path.join(model_or_path, "tokens.txt")): + kwargs["tokenizer_conf"]["token_list"] = os.path.join(model_or_path, "tokens.txt") + if os.path.exists(os.path.join(model_or_path, "tokens.json")): + kwargs["tokenizer_conf"]["token_list"] = os.path.join(model_or_path, "tokens.json") + if os.path.exists(os.path.join(model_or_path, "seg_dict")): + kwargs["tokenizer_conf"]["seg_dict"] = os.path.join(model_or_path, "seg_dict") + if os.path.exists(os.path.join(model_or_path, "bpe.model")): + kwargs["tokenizer_conf"]["bpemodel"] = os.path.join(model_or_path, "bpe.model") + kwargs["model"] = config["model"] + if os.path.exists(os.path.join(model_or_path, "am.mvn")): + kwargs["frontend_conf"]["cmvn_file"] = os.path.join(model_or_path, "am.mvn") + if os.path.exists(os.path.join(model_or_path, "jieba_usr_dict")): + kwargs["jieba_usr_dict"] = os.path.join(model_or_path, "jieba_usr_dict") + if isinstance(kwargs, DictConfig): + kwargs = OmegaConf.to_container(kwargs, resolve=True) + if os.path.exists(os.path.join(model_or_path, "requirements.txt")): + requirements = os.path.join(model_or_path, "requirements.txt") + print(f"Detect model requirements, begin to install it: {requirements}") + from funasr.utils.install_model_requirements import install_requirements + + install_requirements(requirements) + return kwargs + + +def download_from_hf(**kwargs): + model_or_path = kwargs.get("model") + if model_or_path in name_maps_hf: + model_or_path = name_maps_hf[model_or_path] + model_revision = kwargs.get("model_revision", "master") + if not os.path.exists(model_or_path) and "model_path" not in kwargs: + try: + model_or_path = get_or_download_model_dir_hf( + model_or_path, + model_revision, + is_training=kwargs.get("is_training"), + check_latest=kwargs.get("check_latest", True), + ) + except Exception as e: + print(f"Download: {model_or_path} failed!: {e}") + + kwargs["model_path"] = model_or_path if "model_path" not in kwargs else kwargs["model_path"] + + if os.path.exists(os.path.join(model_or_path, "configuration.json")): + with open(os.path.join(model_or_path, "configuration.json"), "r", encoding="utf-8") as f: + conf_json = json.load(f) + + cfg = {} + if "file_path_metas" in conf_json: + add_file_root_path(model_or_path, conf_json["file_path_metas"], cfg) + cfg.update(kwargs) + if "config" in cfg: + config = OmegaConf.load(cfg["config"]) + kwargs = OmegaConf.merge(config, cfg) + kwargs["model"] = config["model"] + elif os.path.exists(os.path.join(model_or_path, "config.yaml")) and os.path.exists( + os.path.join(model_or_path, "model.pt") + ): + config = OmegaConf.load(os.path.join(model_or_path, "config.yaml")) + kwargs = OmegaConf.merge(config, kwargs) + init_param = os.path.join(model_or_path, "model.pb") + kwargs["init_param"] = init_param + if os.path.exists(os.path.join(model_or_path, "tokens.txt")): + kwargs["tokenizer_conf"]["token_list"] = os.path.join(model_or_path, "tokens.txt") + if os.path.exists(os.path.join(model_or_path, "tokens.json")): + kwargs["tokenizer_conf"]["token_list"] = os.path.join(model_or_path, "tokens.json") + if os.path.exists(os.path.join(model_or_path, "seg_dict")): + kwargs["tokenizer_conf"]["seg_dict"] = os.path.join(model_or_path, "seg_dict") + if os.path.exists(os.path.join(model_or_path, "bpe.model")): + kwargs["tokenizer_conf"]["bpemodel"] = os.path.join(model_or_path, "bpe.model") + kwargs["model"] = config["model"] + if os.path.exists(os.path.join(model_or_path, "am.mvn")): + kwargs["frontend_conf"]["cmvn_file"] = os.path.join(model_or_path, "am.mvn") + if os.path.exists(os.path.join(model_or_path, "jieba_usr_dict")): + kwargs["jieba_usr_dict"] = os.path.join(model_or_path, "jieba_usr_dict") + if isinstance(kwargs, DictConfig): + kwargs = OmegaConf.to_container(kwargs, resolve=True) + if os.path.exists(os.path.join(model_or_path, "requirements.txt")): + requirements = os.path.join(model_or_path, "requirements.txt") + print(f"Detect model requirements, begin to install it: {requirements}") + from funasr.utils.install_model_requirements import install_requirements + + install_requirements(requirements) + return kwargs + + +def add_file_root_path(model_or_path: str, file_path_metas: dict, cfg={}): + + if isinstance(file_path_metas, dict): + for k, v in file_path_metas.items(): + if isinstance(v, str): + p = os.path.join(model_or_path, v) + if os.path.exists(p): + cfg[k] = p + elif isinstance(v, dict): + if k not in cfg: + cfg[k] = {} + add_file_root_path(model_or_path, v, cfg[k]) + + return cfg + + +def get_or_download_model_dir( + model, + model_revision=None, + is_training=False, + check_latest=True, +): + """Get local model directory or download model if necessary. + + Args: + model (str): model id or path to local model directory. + model_revision (str, optional): model version number. + :param is_training: + """ + from modelscope.hub.check_model import check_local_model_is_latest + from modelscope.hub.snapshot_download import snapshot_download + + from modelscope.utils.constant import Invoke, ThirdParty + + key = Invoke.LOCAL_TRAINER if is_training else Invoke.PIPELINE + + if os.path.exists(model) and check_latest: + model_cache_dir = model if os.path.isdir(model) else os.path.dirname(model) + try: + check_local_model_is_latest( + model_cache_dir, user_agent={Invoke.KEY: key, ThirdParty.KEY: "funasr"} + ) + except: + print("could not check the latest version") + else: + model_cache_dir = snapshot_download( + model, revision=model_revision, user_agent={Invoke.KEY: key, ThirdParty.KEY: "funasr"} + ) + return model_cache_dir + + +def get_or_download_model_dir_hf( + model, + model_revision=None, + is_training=False, + check_latest=True, +): + """Get local model directory or download model if necessary. + + Args: + model (str): model id or path to local model directory. + model_revision (str, optional): model version number. + :param is_training: + """ + from huggingface_hub import snapshot_download + + model_cache_dir = snapshot_download(model) + return model_cache_dir diff --git a/funasr/download/file.py b/funasr/download/file.py new file mode 100644 index 0000000..a8a13f8 --- /dev/null +++ b/funasr/download/file.py @@ -0,0 +1,320 @@ +# Copyright (c) Alibaba, Inc. and its affiliates. + +import contextlib +import os +import tempfile +from abc import ABCMeta, abstractmethod +from pathlib import Path +from typing import Generator, Union + +import requests +from urllib.parse import urlparse + + +def download_from_url(url): + result = urlparse(url) + file_path = None + if result.scheme is not None and len(result.scheme) > 0: + storage = HTTPStorage() + # bytes + data = storage.read(url) + work_dir = tempfile.TemporaryDirectory().name + if not os.path.exists(work_dir): + os.makedirs(work_dir) + file_path = os.path.join(work_dir, os.path.basename(url)) + with open(file_path, "wb") as fb: + fb.write(data) + assert file_path is not None, f"failed to download: {url}" + return file_path + + +class Storage(metaclass=ABCMeta): + """Abstract class of storage. + + All backends need to implement two apis: ``read()`` and ``read_text()``. + ``read()`` reads the file as a byte stream and ``read_text()`` reads + the file as texts. + """ + + @abstractmethod + def read(self, filepath: str): + pass + + @abstractmethod + def read_text(self, filepath: str): + pass + + @abstractmethod + def write(self, obj: bytes, filepath: Union[str, Path]) -> None: + pass + + @abstractmethod + def write_text(self, obj: str, filepath: Union[str, Path], encoding: str = "utf-8") -> None: + pass + + +class LocalStorage(Storage): + """Local hard disk storage""" + + def read(self, filepath: Union[str, Path]) -> bytes: + """Read data from a given ``filepath`` with 'rb' mode. + + Args: + filepath (str or Path): Path to read data. + + Returns: + bytes: Expected bytes object. + """ + with open(filepath, "rb") as f: + content = f.read() + return content + + def read_text(self, filepath: Union[str, Path], encoding: str = "utf-8") -> str: + """Read data from a given ``filepath`` with 'r' mode. + + Args: + filepath (str or Path): Path to read data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + + Returns: + str: Expected text reading from ``filepath``. + """ + with open(filepath, "r", encoding=encoding) as f: + value_buf = f.read() + return value_buf + + def write(self, obj: bytes, filepath: Union[str, Path]) -> None: + """Write data to a given ``filepath`` with 'wb' mode. + + Note: + ``write`` will create a directory if the directory of ``filepath`` + does not exist. + + Args: + obj (bytes): Data to be written. + filepath (str or Path): Path to write data. + """ + dirname = os.path.dirname(filepath) + if dirname and not os.path.exists(dirname): + os.makedirs(dirname, exist_ok=True) + + with open(filepath, "wb") as f: + f.write(obj) + + def write_text(self, obj: str, filepath: Union[str, Path], encoding: str = "utf-8") -> None: + """Write data to a given ``filepath`` with 'w' mode. + + Note: + ``write_text`` will create a directory if the directory of + ``filepath`` does not exist. + + Args: + obj (str): Data to be written. + filepath (str or Path): Path to write data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + """ + dirname = os.path.dirname(filepath) + if dirname and not os.path.exists(dirname): + os.makedirs(dirname, exist_ok=True) + + with open(filepath, "w", encoding=encoding) as f: + f.write(obj) + + @contextlib.contextmanager + def as_local_path(self, filepath: Union[str, Path]) -> Generator[Union[str, Path], None, None]: + """Only for unified API and do nothing.""" + yield filepath + + +class HTTPStorage(Storage): + """HTTP and HTTPS storage.""" + + def read(self, url): + # TODO @wenmeng.zwm add progress bar if file is too large + r = requests.get(url) + r.raise_for_status() + return r.content + + def read_text(self, url): + r = requests.get(url) + r.raise_for_status() + return r.text + + @contextlib.contextmanager + def as_local_path(self, filepath: str) -> Generator[Union[str, Path], None, None]: + """Download a file from ``filepath``. + + ``as_local_path`` is decorated by :meth:`contextlib.contextmanager`. It + can be called with ``with`` statement, and when exists from the + ``with`` statement, the temporary path will be released. + + Args: + filepath (str): Download a file from ``filepath``. + + Examples: + >>> storage = HTTPStorage() + >>> # After existing from the ``with`` clause, + >>> # the path will be removed + >>> with storage.get_local_path('http://path/to/file') as path: + ... # do something here + """ + try: + f = tempfile.NamedTemporaryFile(delete=False) + f.write(self.read(filepath)) + f.close() + yield f.name + finally: + os.remove(f.name) + + def write(self, obj: bytes, url: Union[str, Path]) -> None: + raise NotImplementedError("write is not supported by HTTP Storage") + + def write_text(self, obj: str, url: Union[str, Path], encoding: str = "utf-8") -> None: + raise NotImplementedError("write_text is not supported by HTTP Storage") + + +class OSSStorage(Storage): + """OSS storage.""" + + def __init__(self, oss_config_file=None): + # read from config file or env var + raise NotImplementedError("OSSStorage.__init__ to be implemented in the future") + + def read(self, filepath): + raise NotImplementedError("OSSStorage.read to be implemented in the future") + + def read_text(self, filepath, encoding="utf-8"): + raise NotImplementedError("OSSStorage.read_text to be implemented in the future") + + @contextlib.contextmanager + def as_local_path(self, filepath: str) -> Generator[Union[str, Path], None, None]: + """Download a file from ``filepath``. + + ``as_local_path`` is decorated by :meth:`contextlib.contextmanager`. It + can be called with ``with`` statement, and when exists from the + ``with`` statement, the temporary path will be released. + + Args: + filepath (str): Download a file from ``filepath``. + + Examples: + >>> storage = OSSStorage() + >>> # After existing from the ``with`` clause, + >>> # the path will be removed + >>> with storage.get_local_path('http://path/to/file') as path: + ... # do something here + """ + try: + f = tempfile.NamedTemporaryFile(delete=False) + f.write(self.read(filepath)) + f.close() + yield f.name + finally: + os.remove(f.name) + + def write(self, obj: bytes, filepath: Union[str, Path]) -> None: + raise NotImplementedError("OSSStorage.write to be implemented in the future") + + def write_text(self, obj: str, filepath: Union[str, Path], encoding: str = "utf-8") -> None: + raise NotImplementedError("OSSStorage.write_text to be implemented in the future") + + +G_STORAGES = {} + + +class File(object): + _prefix_to_storage: dict = { + "oss": OSSStorage, + "http": HTTPStorage, + "https": HTTPStorage, + "local": LocalStorage, + } + + @staticmethod + def _get_storage(uri): + assert isinstance(uri, str), f"uri should be str type, but got {type(uri)}" + + if "://" not in uri: + # local path + storage_type = "local" + else: + prefix, _ = uri.split("://") + storage_type = prefix + + assert storage_type in File._prefix_to_storage, ( + f"Unsupported uri {uri}, valid prefixs: " f"{list(File._prefix_to_storage.keys())}" + ) + + if storage_type not in G_STORAGES: + G_STORAGES[storage_type] = File._prefix_to_storage[storage_type]() + + return G_STORAGES[storage_type] + + @staticmethod + def read(uri: str) -> bytes: + """Read data from a given ``filepath`` with 'rb' mode. + + Args: + filepath (str or Path): Path to read data. + + Returns: + bytes: Expected bytes object. + """ + storage = File._get_storage(uri) + return storage.read(uri) + + @staticmethod + def read_text(uri: Union[str, Path], encoding: str = "utf-8") -> str: + """Read data from a given ``filepath`` with 'r' mode. + + Args: + filepath (str or Path): Path to read data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + + Returns: + str: Expected text reading from ``filepath``. + """ + storage = File._get_storage(uri) + return storage.read_text(uri) + + @staticmethod + def write(obj: bytes, uri: Union[str, Path]) -> None: + """Write data to a given ``filepath`` with 'wb' mode. + + Note: + ``write`` will create a directory if the directory of ``filepath`` + does not exist. + + Args: + obj (bytes): Data to be written. + filepath (str or Path): Path to write data. + """ + storage = File._get_storage(uri) + return storage.write(obj, uri) + + @staticmethod + def write_text(obj: str, uri: str, encoding: str = "utf-8") -> None: + """Write data to a given ``filepath`` with 'w' mode. + + Note: + ``write_text`` will create a directory if the directory of + ``filepath`` does not exist. + + Args: + obj (str): Data to be written. + filepath (str or Path): Path to write data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + """ + storage = File._get_storage(uri) + return storage.write_text(obj, uri) + + @contextlib.contextmanager + def as_local_path(uri: str) -> Generator[Union[str, Path], None, None]: + """Only for unified API and do nothing.""" + storage = File._get_storage(uri) + with storage.as_local_path(uri) as local_path: + yield local_path diff --git a/funasr/download/name_maps_from_hub.py b/funasr/download/name_maps_from_hub.py new file mode 100644 index 0000000..3bb25a7 --- /dev/null +++ b/funasr/download/name_maps_from_hub.py @@ -0,0 +1,34 @@ +name_maps_ms = { + "paraformer": "iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + "paraformer-zh": "iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + "paraformer-en": "iic/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020", + "paraformer-en-spk": "iic/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020", + "paraformer-zh-streaming": "iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online", + "fsmn-vad": "iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + "ct-punc": "iic/punc_ct-transformer_cn-en-common-vocab471067-large", + "ct-punc-c": "iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", + "fa-zh": "iic/speech_timestamp_prediction-v1-16k-offline", + "cam++": "iic/speech_campplus_sv_zh-cn_16k-common", + "Whisper-large-v2": "iic/speech_whisper-large_asr_multilingual", + "Whisper-large-v3": "iic/Whisper-large-v3", + "Qwen-Audio": "Qwen/Qwen-Audio", +} + +name_maps_hf = { + "": "", +} + +name_maps_openai = { + "Whisper-tiny.en": "tiny.en", + "Whisper-tiny": "tiny", + "Whisper-base.en": "base.en", + "Whisper-base": "base", + "Whisper-small.en": "small.en", + "Whisper-small": "small", + "Whisper-medium.en": "medium.en", + "Whisper-medium": "medium", + "Whisper-large-v1": "large-v1", + "Whisper-large-v2": "large-v2", + "Whisper-large-v3": "large-v3", + "Whisper-large": "large", +} diff --git a/funasr/download/runtime_sdk_download_tool.py b/funasr/download/runtime_sdk_download_tool.py new file mode 100644 index 0000000..96c6735 --- /dev/null +++ b/funasr/download/runtime_sdk_download_tool.py @@ -0,0 +1,52 @@ +import os +import argparse +from pathlib import Path + +from funasr.utils.types import str2bool + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--model-name", type=str, required=True) + parser.add_argument("--export-dir", type=str, required=True) + parser.add_argument("--export", type=str2bool, default=True, help="whether to export model") + parser.add_argument("--type", type=str, default="onnx", help='["onnx", "torch"]') + parser.add_argument("--device", type=str, default="cpu", help='["cpu", "cuda"]') + parser.add_argument("--quantize", type=str2bool, default=False, help="export quantized model") + parser.add_argument("--fallback-num", type=int, default=0, help="amp fallback number") + parser.add_argument("--audio_in", type=str, default=None, help='["wav", "wav.scp"]') + parser.add_argument("--model_revision", type=str, default=None, help="model_revision") + parser.add_argument("--calib_num", type=int, default=200, help="calib max num") + args = parser.parse_args() + + model_dir = args.model_name + output_dir = args.model_name + if not Path(args.model_name).exists(): + from modelscope.hub.snapshot_download import snapshot_download + + try: + model_dir = snapshot_download( + args.model_name, cache_dir=args.export_dir, revision=args.model_revision + ) + output_dir = os.path.join(args.export_dir, args.model_name) + except: + raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format( + model_dir + ) + if args.export: + model_file = os.path.join(model_dir, "model.onnx") + if args.quantize: + model_file = os.path.join(model_dir, "model_quant.onnx") + if not os.path.exists(model_file): + print(".onnx is not exist, begin to export onnx") + from funasr import AutoModel + + export_model = AutoModel(model=args.model_name, output_dir=output_dir) + export_model.export( + quantize=args.quantize, + type=args.type, + ) + + +if __name__ == "__main__": + main() diff --git a/funasr/frontends/__init__.py b/funasr/frontends/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/frontends/default.py b/funasr/frontends/default.py new file mode 100644 index 0000000..462da86 --- /dev/null +++ b/funasr/frontends/default.py @@ -0,0 +1,340 @@ +import copy +from typing import Optional +from typing import Tuple +from typing import Union +import logging +import numpy as np +import torch +import torch.nn as nn + +try: + from torch_complex.tensor import ComplexTensor +except: + print("Please install torch_complex firstly") + +from funasr.frontends.utils.log_mel import LogMel +from funasr.frontends.utils.stft import Stft +from funasr.frontends.utils.frontend import Frontend +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.register import tables + + +@tables.register("frontend_classes", "DefaultFrontend") +class DefaultFrontend(nn.Module): + """Conventional frontend structure for ASR. + Stft -> WPE -> MVDR-Beamformer -> Power-spec -> Mel-Fbank -> CMVN + """ + + def __init__( + self, + fs: int = 16000, + n_fft: int = 512, + win_length: int = None, + hop_length: int = 128, + window: Optional[str] = "hann", + center: bool = True, + normalized: bool = False, + onesided: bool = True, + n_mels: int = 80, + fmin: int = None, + fmax: int = None, + htk: bool = False, + frontend_conf: Optional[dict] = None, + apply_stft: bool = True, + use_channel: int = None, + **kwargs, + ): + super().__init__() + + # Deepcopy (In general, dict shouldn't be used as default arg) + frontend_conf = copy.deepcopy(frontend_conf) + self.hop_length = hop_length + self.fs = fs + + if apply_stft: + self.stft = Stft( + n_fft=n_fft, + win_length=win_length, + hop_length=hop_length, + center=center, + window=window, + normalized=normalized, + onesided=onesided, + ) + else: + self.stft = None + self.apply_stft = apply_stft + + if frontend_conf is not None: + self.frontend = Frontend(idim=n_fft // 2 + 1, **frontend_conf) + else: + self.frontend = None + + self.logmel = LogMel( + fs=fs, + n_fft=n_fft, + n_mels=n_mels, + fmin=fmin, + fmax=fmax, + htk=htk, + ) + self.n_mels = n_mels + self.use_channel = use_channel + self.frontend_type = "default" + + def output_size(self) -> int: + return self.n_mels + + def forward( + self, input: torch.Tensor, input_lengths: Union[torch.Tensor, list] + ) -> Tuple[torch.Tensor, torch.Tensor]: + if isinstance(input_lengths, list): + input_lengths = torch.tensor(input_lengths) + if input.dtype == torch.float64: + input = input.float() + # 1. Domain-conversion: e.g. Stft: time -> time-freq + if self.stft is not None: + input_stft, feats_lens = self._compute_stft(input, input_lengths) + else: + input_stft = ComplexTensor(input[..., 0], input[..., 1]) + feats_lens = input_lengths + # 2. [Option] Speech enhancement + if self.frontend is not None: + assert isinstance(input_stft, ComplexTensor), type(input_stft) + # input_stft: (Batch, Length, [Channel], Freq) + input_stft, _, mask = self.frontend(input_stft, feats_lens) + + # 3. [Multi channel case]: Select a channel + if input_stft.dim() == 4: + # h: (B, T, C, F) -> h: (B, T, F) + if self.training: + if self.use_channel is not None: + input_stft = input_stft[:, :, self.use_channel, :] + else: + # Select 1ch randomly + ch = np.random.randint(input_stft.size(2)) + input_stft = input_stft[:, :, ch, :] + else: + # Use the first channel + input_stft = input_stft[:, :, 0, :] + + # 4. STFT -> Power spectrum + # h: ComplexTensor(B, T, F) -> torch.Tensor(B, T, F) + input_power = input_stft.real**2 + input_stft.imag**2 + + # 5. Feature transform e.g. Stft -> Log-Mel-Fbank + # input_power: (Batch, [Channel,] Length, Freq) + # -> input_feats: (Batch, Length, Dim) + input_feats, _ = self.logmel(input_power, feats_lens) + + return input_feats, feats_lens + + def _compute_stft(self, input: torch.Tensor, input_lengths: torch.Tensor) -> torch.Tensor: + input_stft, feats_lens = self.stft(input, input_lengths) + + assert input_stft.dim() >= 4, input_stft.shape + # "2" refers to the real/imag parts of Complex + assert input_stft.shape[-1] == 2, input_stft.shape + + # Change torch.Tensor to ComplexTensor + # input_stft: (..., F, 2) -> (..., F) + input_stft = ComplexTensor(input_stft[..., 0], input_stft[..., 1]) + return input_stft, feats_lens + + +class MultiChannelFrontend(nn.Module): + """Conventional frontend structure for ASR. + Stft -> WPE -> MVDR-Beamformer -> Power-spec -> Mel-Fbank -> CMVN + """ + + def __init__( + self, + fs: int = 16000, + n_fft: int = 512, + win_length: int = None, + hop_length: int = None, + frame_length: int = None, + frame_shift: int = None, + window: Optional[str] = "hann", + center: bool = True, + normalized: bool = False, + onesided: bool = True, + n_mels: int = 80, + fmin: int = None, + fmax: int = None, + htk: bool = False, + frontend_conf: Optional[dict] = None, + apply_stft: bool = True, + use_channel: int = None, + lfr_m: int = 1, + lfr_n: int = 1, + cmvn_file: str = None, + mc: bool = True, + ): + super().__init__() + # Deepcopy (In general, dict shouldn't be used as default arg) + frontend_conf = copy.deepcopy(frontend_conf) + if win_length is None and hop_length is None: + self.win_length = frame_length * 16 + self.hop_length = frame_shift * 16 + elif frame_length is None and frame_shift is None: + self.win_length = self.win_length + self.hop_length = self.hop_length + else: + logging.error( + "Only one of (win_length, hop_length) and (frame_length, frame_shift)" "can be set." + ) + exit(1) + + if apply_stft: + self.stft = Stft( + n_fft=n_fft, + win_length=self.win_length, + hop_length=self.hop_length, + center=center, + window=window, + normalized=normalized, + onesided=onesided, + ) + else: + self.stft = None + self.apply_stft = apply_stft + + if frontend_conf is not None: + self.frontend = Frontend(idim=n_fft // 2 + 1, **frontend_conf) + else: + self.frontend = None + + self.logmel = LogMel( + fs=fs, + n_fft=n_fft, + n_mels=n_mels, + fmin=fmin, + fmax=fmax, + htk=htk, + ) + self.n_mels = n_mels + self.use_channel = use_channel + self.mc = mc + if not self.mc: + if self.use_channel is not None: + logging.info("use the channel %d" % (self.use_channel)) + else: + logging.info("random select channel") + self.cmvn_file = cmvn_file + if self.cmvn_file is not None: + mean, std = self._load_cmvn(self.cmvn_file) + self.register_buffer("mean", torch.from_numpy(mean)) + self.register_buffer("std", torch.from_numpy(std)) + self.frontend_type = "multichannelfrontend" + + def output_size(self) -> int: + return self.n_mels + + def forward( + self, input: torch.Tensor, input_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + # 1. Domain-conversion: e.g. Stft: time -> time-freq + # import pdb;pdb.set_trace() + if self.stft is not None: + input_stft, feats_lens = self._compute_stft(input, input_lengths) + else: + input_stft = ComplexTensor(input[..., 0], input[..., 1]) + feats_lens = input_lengths + # 2. [Option] Speech enhancement + if self.frontend is not None: + assert isinstance(input_stft, ComplexTensor), type(input_stft) + # input_stft: (Batch, Length, [Channel], Freq) + input_stft, _, mask = self.frontend(input_stft, feats_lens) + + # 3. [Multi channel case]: Select a channel(sa_asr) + if input_stft.dim() == 4 and not self.mc: + # h: (B, T, C, F) -> h: (B, T, F) + if self.training: + if self.use_channel is not None: + input_stft = input_stft[:, :, self.use_channel, :] + + else: + # Select 1ch randomly + ch = np.random.randint(input_stft.size(2)) + input_stft = input_stft[:, :, ch, :] + else: + # Use the first channel + input_stft = input_stft[:, :, 0, :] + + # 4. STFT -> Power spectrum + # h: ComplexTensor(B, T, F) -> torch.Tensor(B, T, F) + input_power = input_stft.real**2 + input_stft.imag**2 + + # 5. Feature transform e.g. Stft -> Log-Mel-Fbank + # input_power: (Batch, [Channel,] Length, Freq) + # -> input_feats: (Batch, Length, Dim) + input_feats, _ = self.logmel(input_power, feats_lens) + if self.mc: + # MFCCA + if input_feats.dim() == 4: + bt = input_feats.size(0) + channel_size = input_feats.size(2) + input_feats = ( + input_feats.transpose(1, 2).reshape(bt * channel_size, -1, 80).contiguous() + ) + feats_lens = feats_lens.repeat(1, channel_size).squeeze() + else: + channel_size = 1 + return input_feats, feats_lens, channel_size + else: + # 6. Apply CMVN + if self.cmvn_file is not None: + if feats_lens is None: + feats_lens = input_feats.new_full([input_feats.size(0)], input_feats.size(1)) + self.mean = self.mean.to(input_feats.device, input_feats.dtype) + self.std = self.std.to(input_feats.device, input_feats.dtype) + mask = make_pad_mask(feats_lens, input_feats, 1) + + if input_feats.requires_grad: + input_feats = input_feats + self.mean + else: + input_feats += self.mean + if input_feats.requires_grad: + input_feats = input_feats.masked_fill(mask, 0.0) + else: + input_feats.masked_fill_(mask, 0.0) + + input_feats *= self.std + + return input_feats, feats_lens + + def _compute_stft(self, input: torch.Tensor, input_lengths: torch.Tensor) -> torch.Tensor: + input_stft, feats_lens = self.stft(input, input_lengths) + + assert input_stft.dim() >= 4, input_stft.shape + # "2" refers to the real/imag parts of Complex + assert input_stft.shape[-1] == 2, input_stft.shape + + # Change torch.Tensor to ComplexTensor + # input_stft: (..., F, 2) -> (..., F) + input_stft = ComplexTensor(input_stft[..., 0], input_stft[..., 1]) + return input_stft, feats_lens + + def _load_cmvn(self, cmvn_file): + with open(cmvn_file, "r", encoding="utf-8") as f: + lines = f.readlines() + means_list = [] + vars_list = [] + for i in range(len(lines)): + line_item = lines[i].split() + if line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + add_shift_line = line_item[3 : (len(line_item) - 1)] + means_list = list(add_shift_line) + continue + elif line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + rescale_line = line_item[3 : (len(line_item) - 1)] + vars_list = list(rescale_line) + continue + means = np.array(means_list).astype(np.float) + vars = np.array(vars_list).astype(np.float) + return means, vars diff --git a/funasr/frontends/eend_ola_feature.py b/funasr/frontends/eend_ola_feature.py new file mode 100644 index 0000000..0c79a3b --- /dev/null +++ b/funasr/frontends/eend_ola_feature.py @@ -0,0 +1,47 @@ +# Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) +# Licensed under the MIT license. +# +# This module is for computing audio features + +import librosa +import numpy as np + + +def transform(Y, dtype=np.float32): + Y = np.abs(Y) + n_fft = 2 * (Y.shape[1] - 1) + sr = 8000 + n_mels = 23 + mel_basis = librosa.filters.mel(sr, n_fft, n_mels) + Y = np.dot(Y**2, mel_basis.T) + Y = np.log10(np.maximum(Y, 1e-10)) + mean = np.mean(Y, axis=0) + Y = Y - mean + return Y.astype(dtype) + + +def subsample(Y, T, subsampling=1): + Y_ss = Y[::subsampling] + T_ss = T[::subsampling] + return Y_ss, T_ss + + +def splice(Y, context_size=0): + Y_pad = np.pad(Y, [(context_size, context_size), (0, 0)], "constant") + Y_spliced = np.lib.stride_tricks.as_strided( + np.ascontiguousarray(Y_pad), + (Y.shape[0], Y.shape[1] * (2 * context_size + 1)), + (Y.itemsize * Y.shape[1], Y.itemsize), + writeable=False, + ) + return Y_spliced + + +def stft(data, frame_size=1024, frame_shift=256): + fft_size = 1 << (frame_size - 1).bit_length() + if len(data) % frame_shift == 0: + return librosa.stft(data, n_fft=fft_size, win_length=frame_size, hop_length=frame_shift).T[ + :-1 + ] + else: + return librosa.stft(data, n_fft=fft_size, win_length=frame_size, hop_length=frame_shift).T diff --git a/funasr/frontends/fused.py b/funasr/frontends/fused.py new file mode 100644 index 0000000..0fa7639 --- /dev/null +++ b/funasr/frontends/fused.py @@ -0,0 +1,138 @@ +from funasr.frontends.default import DefaultFrontend +from funasr.frontends.s3prl import S3prlFrontend +import numpy as np +import torch +import torch.nn as nn +from typing import Tuple + + +class FusedFrontends(nn.Module): + def __init__(self, frontends=None, align_method="linear_projection", proj_dim=100, fs=16000): + + super().__init__() + self.align_method = align_method # fusing method : linear_projection only for now + self.proj_dim = proj_dim # dim of the projection done on each frontend + self.frontends = [] # list of the frontends to combine + + for i, frontend in enumerate(frontends): + frontend_type = frontend["frontend_type"] + if frontend_type == "default": + n_mels, fs, n_fft, win_length, hop_length = ( + frontend.get("n_mels", 80), + fs, + frontend.get("n_fft", 512), + frontend.get("win_length"), + frontend.get("hop_length", 128), + ) + window, center, normalized, onesided = ( + frontend.get("window", "hann"), + frontend.get("center", True), + frontend.get("normalized", False), + frontend.get("onesided", True), + ) + fmin, fmax, htk, apply_stft = ( + frontend.get("fmin", None), + frontend.get("fmax", None), + frontend.get("htk", False), + frontend.get("apply_stft", True), + ) + + self.frontends.append( + DefaultFrontend( + n_mels=n_mels, + n_fft=n_fft, + fs=fs, + win_length=win_length, + hop_length=hop_length, + window=window, + center=center, + normalized=normalized, + onesided=onesided, + fmin=fmin, + fmax=fmax, + htk=htk, + apply_stft=apply_stft, + ) + ) + elif frontend_type == "s3prl": + frontend_conf, download_dir, multilayer_feature = ( + frontend.get("frontend_conf"), + frontend.get("download_dir"), + frontend.get("multilayer_feature"), + ) + self.frontends.append( + S3prlFrontend( + fs=fs, + frontend_conf=frontend_conf, + download_dir=download_dir, + multilayer_feature=multilayer_feature, + ) + ) + + else: + raise NotImplementedError # frontends are only default or s3prl + + self.frontends = torch.nn.ModuleList(self.frontends) + + self.gcd = np.gcd.reduce([frontend.hop_length for frontend in self.frontends]) + self.factors = [frontend.hop_length // self.gcd for frontend in self.frontends] + if torch.cuda.is_available(): + dev = "cuda" + else: + dev = "cpu" + if self.align_method == "linear_projection": + self.projection_layers = [ + torch.nn.Linear( + in_features=frontend.output_size(), + out_features=self.factors[i] * self.proj_dim, + ) + for i, frontend in enumerate(self.frontends) + ] + self.projection_layers = torch.nn.ModuleList(self.projection_layers) + self.projection_layers = self.projection_layers.to(torch.device(dev)) + + def output_size(self) -> int: + return len(self.frontends) * self.proj_dim + + def forward( + self, input: torch.Tensor, input_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + + # step 0 : get all frontends features + self.feats = [] + for frontend in self.frontends: + with torch.no_grad(): + input_feats, feats_lens = frontend.forward(input, input_lengths) + self.feats.append([input_feats, feats_lens]) + + if self.align_method == "linear_projection": # TODO(Dan): to add other align methods + + # first step : projections + self.feats_proj = [] + for i, frontend in enumerate(self.frontends): + input_feats = self.feats[i][0] + self.feats_proj.append(self.projection_layers[i](input_feats)) + + # 2nd step : reshape + self.feats_reshaped = [] + for i, frontend in enumerate(self.frontends): + input_feats_proj = self.feats_proj[i] + bs, nf, dim = input_feats_proj.shape + input_feats_reshaped = torch.reshape( + input_feats_proj, (bs, nf * self.factors[i], dim // self.factors[i]) + ) + self.feats_reshaped.append(input_feats_reshaped) + + # 3rd step : drop the few last frames + m = min([x.shape[1] for x in self.feats_reshaped]) + self.feats_final = [x[:, :m, :] for x in self.feats_reshaped] + + input_feats = torch.cat( + self.feats_final, dim=-1 + ) # change the input size of the preencoder : proj_dim * n_frontends + feats_lens = torch.ones_like(self.feats[0][1]) * (m) + + else: + raise NotImplementedError + + return input_feats, feats_lens diff --git a/funasr/frontends/s3prl.py b/funasr/frontends/s3prl.py new file mode 100644 index 0000000..5c358cc --- /dev/null +++ b/funasr/frontends/s3prl.py @@ -0,0 +1,139 @@ +import copy +import logging +import os +from argparse import Namespace +from typing import Optional +from typing import Tuple +from typing import Union + +import humanfriendly +import torch +import torch.nn as nn + +from funasr.frontends.utils.frontend import Frontend +from funasr.models.transformer.utils.nets_utils import pad_list + + +def base_s3prl_setup(args): + args.upstream_feature_selection = getattr(args, "upstream_feature_selection", None) + args.upstream_model_config = getattr(args, "upstream_model_config", None) + args.upstream_refresh = getattr(args, "upstream_refresh", False) + args.upstream_ckpt = getattr(args, "upstream_ckpt", None) + args.init_ckpt = getattr(args, "init_ckpt", None) + args.verbose = getattr(args, "verbose", False) + args.tile_factor = getattr(args, "tile_factor", 1) + return args + + +class S3prlFrontend(nn.Module): + """Speech Pretrained Representation frontend structure for ASR.""" + + def __init__( + self, + fs: Union[int, str] = 16000, + frontend_conf: Optional[dict] = None, + download_dir: str = None, + multilayer_feature: bool = False, + ): + super().__init__() + if isinstance(fs, str): + fs = humanfriendly.parse_size(fs) + + if download_dir is not None: + torch.hub.set_dir(download_dir) + + self.multilayer_feature = multilayer_feature + self.upstream, self.featurizer = self._get_upstream(frontend_conf) + self.pretrained_params = copy.deepcopy(self.upstream.state_dict()) + self.output_dim = self.featurizer.output_dim + self.frontend_type = "s3prl" + self.hop_length = self.upstream.get_downsample_rates("key") + + def _get_upstream(self, frontend_conf): + """Get S3PRL upstream model.""" + s3prl_args = base_s3prl_setup( + Namespace(**frontend_conf, device="cpu"), + ) + self.args = s3prl_args + + s3prl_path = None + python_path_list = os.environ.get("PYTHONPATH", "(None)").split(":") + for p in python_path_list: + if p.endswith("s3prl"): + s3prl_path = p + break + assert s3prl_path is not None + + s3prl_upstream = torch.hub.load( + s3prl_path, + s3prl_args.upstream, + ckpt=s3prl_args.upstream_ckpt, + model_config=s3prl_args.upstream_model_config, + refresh=s3prl_args.upstream_refresh, + source="local", + ).to("cpu") + + if getattr( + s3prl_upstream, "model", None + ) is not None and s3prl_upstream.model.__class__.__name__ in [ + "Wav2Vec2Model", + "HubertModel", + ]: + s3prl_upstream.model.encoder.layerdrop = 0.0 + + from s3prl.upstream.interfaces import Featurizer + + if self.multilayer_feature is None: + feature_selection = "last_hidden_state" + else: + feature_selection = "hidden_states" + s3prl_featurizer = Featurizer( + upstream=s3prl_upstream, + feature_selection=feature_selection, + upstream_device="cpu", + ) + + return s3prl_upstream, s3prl_featurizer + + def _tile_representations(self, feature): + """Tile up the representations by `tile_factor`. + Input - sequence of representations + shape: (batch_size, seq_len, feature_dim) + Output - sequence of tiled representations + shape: (batch_size, seq_len * factor, feature_dim) + """ + assert len(feature.shape) == 3, "Input argument `feature` has invalid shape: {}".format( + feature.shape + ) + tiled_feature = feature.repeat(1, 1, self.args.tile_factor) + tiled_feature = tiled_feature.reshape( + feature.size(0), feature.size(1) * self.args.tile_factor, feature.size(2) + ) + return tiled_feature + + def output_size(self) -> int: + return self.output_dim + + def forward( + self, input: torch.Tensor, input_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + wavs = [wav[: input_lengths[i]] for i, wav in enumerate(input)] + self.upstream.eval() + with torch.no_grad(): + feats = self.upstream(wavs) + feats = self.featurizer(wavs, feats) + + if self.args.tile_factor != 1: + feats = self._tile_representations(feats) + + input_feats = pad_list(feats, 0.0) + feats_lens = torch.tensor([f.shape[0] for f in feats], dtype=torch.long) + + # Saving CUDA Memory + del feats + + return input_feats, feats_lens + + def reload_pretrained_parameters(self): + self.upstream.load_state_dict(self.pretrained_params) + logging.info("Pretrained S3PRL frontend model parameters reloaded!") diff --git a/funasr/frontends/utils/__init__.py b/funasr/frontends/utils/__init__.py new file mode 100644 index 0000000..b7f1773 --- /dev/null +++ b/funasr/frontends/utils/__init__.py @@ -0,0 +1 @@ +"""Initialize sub package.""" diff --git a/funasr/frontends/utils/beamformer.py b/funasr/frontends/utils/beamformer.py new file mode 100644 index 0000000..d19abe0 --- /dev/null +++ b/funasr/frontends/utils/beamformer.py @@ -0,0 +1,82 @@ +import torch +from torch_complex import functional as FC +from torch_complex.tensor import ComplexTensor + + +def get_power_spectral_density_matrix( + xs: ComplexTensor, mask: torch.Tensor, normalization=True, eps: float = 1e-15 +) -> ComplexTensor: + """Return cross-channel power spectral density (PSD) matrix + + Args: + xs (ComplexTensor): (..., F, C, T) + mask (torch.Tensor): (..., F, C, T) + normalization (bool): + eps (float): + Returns + psd (ComplexTensor): (..., F, C, C) + + """ + # outer product: (..., C_1, T) x (..., C_2, T) -> (..., T, C, C_2) + psd_Y = FC.einsum("...ct,...et->...tce", [xs, xs.conj()]) + + # Averaging mask along C: (..., C, T) -> (..., T) + mask = mask.mean(dim=-2) + + # Normalized mask along T: (..., T) + if normalization: + # If assuming the tensor is padded with zero, the summation along + # the time axis is same regardless of the padding length. + mask = mask / (mask.sum(dim=-1, keepdim=True) + eps) + + # psd: (..., T, C, C) + psd = psd_Y * mask[..., None, None] + # (..., T, C, C) -> (..., C, C) + psd = psd.sum(dim=-3) + + return psd + + +def get_mvdr_vector( + psd_s: ComplexTensor, + psd_n: ComplexTensor, + reference_vector: torch.Tensor, + eps: float = 1e-15, +) -> ComplexTensor: + """Return the MVDR(Minimum Variance Distortionless Response) vector: + + h = (Npsd^-1 @ Spsd) / (Tr(Npsd^-1 @ Spsd)) @ u + + Reference: + On optimal frequency-domain multichannel linear filtering + for noise reduction; M. Souden et al., 2010; + https://ieeexplore.ieee.org/document/5089420 + + Args: + psd_s (ComplexTensor): (..., F, C, C) + psd_n (ComplexTensor): (..., F, C, C) + reference_vector (torch.Tensor): (..., C) + eps (float): + Returns: + beamform_vector (ComplexTensor)r: (..., F, C) + """ + # Add eps + C = psd_n.size(-1) + eye = torch.eye(C, dtype=psd_n.dtype, device=psd_n.device) + shape = [1 for _ in range(psd_n.dim() - 2)] + [C, C] + eye = eye.view(*shape) + psd_n += eps * eye + + # numerator: (..., C_1, C_2) x (..., C_2, C_3) -> (..., C_1, C_3) + numerator = FC.einsum("...ec,...cd->...ed", [psd_n.inverse(), psd_s]) + # ws: (..., C, C) / (...,) -> (..., C, C) + ws = numerator / (FC.trace(numerator)[..., None, None] + eps) + # h: (..., F, C_1, C_2) x (..., C_2) -> (..., F, C_1) + beamform_vector = FC.einsum("...fec,...c->...fe", [ws, reference_vector]) + return beamform_vector + + +def apply_beamforming_vector(beamform_vector: ComplexTensor, mix: ComplexTensor) -> ComplexTensor: + # (..., C) x (..., C, T) -> (..., T) + es = FC.einsum("...c,...ct->...t", [beamform_vector.conj(), mix]) + return es diff --git a/funasr/frontends/utils/complex_utils.py b/funasr/frontends/utils/complex_utils.py new file mode 100644 index 0000000..06c6936 --- /dev/null +++ b/funasr/frontends/utils/complex_utils.py @@ -0,0 +1,184 @@ +"""Beamformer module.""" + +from distutils.version import LooseVersion +from typing import Sequence +from typing import Tuple +from typing import Union + +import torch + +try: + from torch_complex import functional as FC + from torch_complex.tensor import ComplexTensor +except: + print("Please install torch_complex firstly") + + +EPS = torch.finfo(torch.double).eps +is_torch_1_8_plus = LooseVersion(torch.__version__) >= LooseVersion("1.8.0") +is_torch_1_9_plus = LooseVersion(torch.__version__) >= LooseVersion("1.9.0") + + +def new_complex_like( + ref: Union[torch.Tensor, ComplexTensor], + real_imag: Tuple[torch.Tensor, torch.Tensor], +): + if isinstance(ref, ComplexTensor): + return ComplexTensor(*real_imag) + elif is_torch_complex_tensor(ref): + return torch.complex(*real_imag) + else: + raise ValueError("Please update your PyTorch version to 1.9+ for complex support.") + + +def is_torch_complex_tensor(c): + return not isinstance(c, ComplexTensor) and is_torch_1_9_plus and torch.is_complex(c) + + +def is_complex(c): + return isinstance(c, ComplexTensor) or is_torch_complex_tensor(c) + + +def to_double(c): + if not isinstance(c, ComplexTensor) and is_torch_1_9_plus and torch.is_complex(c): + return c.to(dtype=torch.complex128) + else: + return c.double() + + +def to_float(c): + if not isinstance(c, ComplexTensor) and is_torch_1_9_plus and torch.is_complex(c): + return c.to(dtype=torch.complex64) + else: + return c.float() + + +def cat(seq: Sequence[Union[ComplexTensor, torch.Tensor]], *args, **kwargs): + if not isinstance(seq, (list, tuple)): + raise TypeError( + "cat(): argument 'tensors' (position 1) must be tuple of Tensors, " "not Tensor" + ) + if isinstance(seq[0], ComplexTensor): + return FC.cat(seq, *args, **kwargs) + else: + return torch.cat(seq, *args, **kwargs) + + +def complex_norm(c: Union[torch.Tensor, ComplexTensor], dim=-1, keepdim=False) -> torch.Tensor: + if not is_complex(c): + raise TypeError("Input is not a complex tensor.") + if is_torch_complex_tensor(c): + return torch.norm(c, dim=dim, keepdim=keepdim) + else: + return torch.sqrt((c.real**2 + c.imag**2).sum(dim=dim, keepdim=keepdim) + EPS) + + +def einsum(equation, *operands): + # NOTE: Do not mix ComplexTensor and torch.complex in the input! + # NOTE (wangyou): Until PyTorch 1.9.0, torch.einsum does not support + # mixed input with complex and real tensors. + if len(operands) == 1: + if isinstance(operands[0], (tuple, list)): + operands = operands[0] + complex_module = FC if isinstance(operands[0], ComplexTensor) else torch + return complex_module.einsum(equation, *operands) + elif len(operands) != 2: + op0 = operands[0] + same_type = all(op.dtype == op0.dtype for op in operands[1:]) + if same_type: + _einsum = FC.einsum if isinstance(op0, ComplexTensor) else torch.einsum + return _einsum(equation, *operands) + else: + raise ValueError("0 or More than 2 operands are not supported.") + a, b = operands + if isinstance(a, ComplexTensor) or isinstance(b, ComplexTensor): + return FC.einsum(equation, a, b) + elif is_torch_1_9_plus and (torch.is_complex(a) or torch.is_complex(b)): + if not torch.is_complex(a): + o_real = torch.einsum(equation, a, b.real) + o_imag = torch.einsum(equation, a, b.imag) + return torch.complex(o_real, o_imag) + elif not torch.is_complex(b): + o_real = torch.einsum(equation, a.real, b) + o_imag = torch.einsum(equation, a.imag, b) + return torch.complex(o_real, o_imag) + else: + return torch.einsum(equation, a, b) + else: + return torch.einsum(equation, a, b) + + +def inverse(c: Union[torch.Tensor, ComplexTensor]) -> Union[torch.Tensor, ComplexTensor]: + if isinstance(c, ComplexTensor): + return c.inverse2() + else: + return c.inverse() + + +def matmul( + a: Union[torch.Tensor, ComplexTensor], b: Union[torch.Tensor, ComplexTensor] +) -> Union[torch.Tensor, ComplexTensor]: + # NOTE: Do not mix ComplexTensor and torch.complex in the input! + # NOTE (wangyou): Until PyTorch 1.9.0, torch.matmul does not support + # multiplication between complex and real tensors. + if isinstance(a, ComplexTensor) or isinstance(b, ComplexTensor): + return FC.matmul(a, b) + elif is_torch_1_9_plus and (torch.is_complex(a) or torch.is_complex(b)): + if not torch.is_complex(a): + o_real = torch.matmul(a, b.real) + o_imag = torch.matmul(a, b.imag) + return torch.complex(o_real, o_imag) + elif not torch.is_complex(b): + o_real = torch.matmul(a.real, b) + o_imag = torch.matmul(a.imag, b) + return torch.complex(o_real, o_imag) + else: + return torch.matmul(a, b) + else: + return torch.matmul(a, b) + + +def trace(a: Union[torch.Tensor, ComplexTensor]): + # NOTE (wangyou): until PyTorch 1.9.0, torch.trace does not + # support bacth processing. Use FC.trace() as fallback. + return FC.trace(a) + + +def reverse(a: Union[torch.Tensor, ComplexTensor], dim=0): + if isinstance(a, ComplexTensor): + return FC.reverse(a, dim=dim) + else: + return torch.flip(a, dims=(dim,)) + + +def solve(b: Union[torch.Tensor, ComplexTensor], a: Union[torch.Tensor, ComplexTensor]): + """Solve the linear equation ax = b.""" + # NOTE: Do not mix ComplexTensor and torch.complex in the input! + # NOTE (wangyou): Until PyTorch 1.9.0, torch.solve does not support + # mixed input with complex and real tensors. + if isinstance(a, ComplexTensor) or isinstance(b, ComplexTensor): + if isinstance(a, ComplexTensor) and isinstance(b, ComplexTensor): + return FC.solve(b, a, return_LU=False) + else: + return matmul(inverse(a), b) + elif is_torch_1_9_plus and (torch.is_complex(a) or torch.is_complex(b)): + if torch.is_complex(a) and torch.is_complex(b): + return torch.linalg.solve(a, b) + else: + return matmul(inverse(a), b) + else: + if is_torch_1_8_plus: + return torch.linalg.solve(a, b) + else: + return torch.solve(b, a)[0] + + +def stack(seq: Sequence[Union[ComplexTensor, torch.Tensor]], *args, **kwargs): + if not isinstance(seq, (list, tuple)): + raise TypeError( + "stack(): argument 'tensors' (position 1) must be tuple of Tensors, " "not Tensor" + ) + if isinstance(seq[0], ComplexTensor): + return FC.stack(seq, *args, **kwargs) + else: + return torch.stack(seq, *args, **kwargs) diff --git a/funasr/frontends/utils/dnn_beamformer.py b/funasr/frontends/utils/dnn_beamformer.py new file mode 100644 index 0000000..73b6bea --- /dev/null +++ b/funasr/frontends/utils/dnn_beamformer.py @@ -0,0 +1,161 @@ +"""DNN beamformer module.""" + +from typing import Tuple + +import torch +from torch.nn import functional as F + +from funasr.frontends.utils.beamformer import apply_beamforming_vector +from funasr.frontends.utils.beamformer import get_mvdr_vector +from funasr.frontends.utils.beamformer import ( + get_power_spectral_density_matrix, # noqa: H301 +) +from funasr.frontends.utils.mask_estimator import MaskEstimator +from torch_complex.tensor import ComplexTensor + + +class DNN_Beamformer(torch.nn.Module): + """DNN mask based Beamformer + + Citation: + Multichannel End-to-end Speech Recognition; T. Ochiai et al., 2017; + https://arxiv.org/abs/1703.04783 + + """ + + def __init__( + self, + bidim, + btype="blstmp", + blayers=3, + bunits=300, + bprojs=320, + bnmask=2, + dropout_rate=0.0, + badim=320, + ref_channel: int = -1, + beamformer_type="mvdr", + ): + super().__init__() + self.mask = MaskEstimator(btype, bidim, blayers, bunits, bprojs, dropout_rate, nmask=bnmask) + self.ref = AttentionReference(bidim, badim) + self.ref_channel = ref_channel + + self.nmask = bnmask + + if beamformer_type != "mvdr": + raise ValueError("Not supporting beamformer_type={}".format(beamformer_type)) + self.beamformer_type = beamformer_type + + def forward( + self, data: ComplexTensor, ilens: torch.LongTensor + ) -> Tuple[ComplexTensor, torch.LongTensor, ComplexTensor]: + """The forward function + + Notation: + B: Batch + C: Channel + T: Time or Sequence length + F: Freq + + Args: + data (ComplexTensor): (B, T, C, F) + ilens (torch.Tensor): (B,) + Returns: + enhanced (ComplexTensor): (B, T, F) + ilens (torch.Tensor): (B,) + + """ + + def apply_beamforming(data, ilens, psd_speech, psd_noise): + # u: (B, C) + if self.ref_channel < 0: + u, _ = self.ref(psd_speech, ilens) + else: + # (optional) Create onehot vector for fixed reference microphone + u = torch.zeros(*(data.size()[:-3] + (data.size(-2),)), device=data.device) + u[..., self.ref_channel].fill_(1) + + ws = get_mvdr_vector(psd_speech, psd_noise, u) + enhanced = apply_beamforming_vector(ws, data) + + return enhanced, ws + + # data (B, T, C, F) -> (B, F, C, T) + data = data.permute(0, 3, 2, 1) + + # mask: (B, F, C, T) + masks, _ = self.mask(data, ilens) + assert self.nmask == len(masks) + + if self.nmask == 2: # (mask_speech, mask_noise) + mask_speech, mask_noise = masks + + psd_speech = get_power_spectral_density_matrix(data, mask_speech) + psd_noise = get_power_spectral_density_matrix(data, mask_noise) + + enhanced, ws = apply_beamforming(data, ilens, psd_speech, psd_noise) + + # (..., F, T) -> (..., T, F) + enhanced = enhanced.transpose(-1, -2) + mask_speech = mask_speech.transpose(-1, -3) + else: # multi-speaker case: (mask_speech1, ..., mask_noise) + mask_speech = list(masks[:-1]) + mask_noise = masks[-1] + + psd_speeches = [get_power_spectral_density_matrix(data, mask) for mask in mask_speech] + psd_noise = get_power_spectral_density_matrix(data, mask_noise) + + enhanced = [] + ws = [] + for i in range(self.nmask - 1): + psd_speech = psd_speeches.pop(i) + # treat all other speakers' psd_speech as noises + enh, w = apply_beamforming(data, ilens, psd_speech, sum(psd_speeches) + psd_noise) + psd_speeches.insert(i, psd_speech) + + # (..., F, T) -> (..., T, F) + enh = enh.transpose(-1, -2) + mask_speech[i] = mask_speech[i].transpose(-1, -3) + + enhanced.append(enh) + ws.append(w) + + return enhanced, ilens, mask_speech + + +class AttentionReference(torch.nn.Module): + def __init__(self, bidim, att_dim): + super().__init__() + self.mlp_psd = torch.nn.Linear(bidim, att_dim) + self.gvec = torch.nn.Linear(att_dim, 1) + + def forward( + self, psd_in: ComplexTensor, ilens: torch.LongTensor, scaling: float = 2.0 + ) -> Tuple[torch.Tensor, torch.LongTensor]: + """The forward function + + Args: + psd_in (ComplexTensor): (B, F, C, C) + ilens (torch.Tensor): (B,) + scaling (float): + Returns: + u (torch.Tensor): (B, C) + ilens (torch.Tensor): (B,) + """ + B, _, C = psd_in.size()[:3] + assert psd_in.size(2) == psd_in.size(3), psd_in.size() + # psd_in: (B, F, C, C) + psd = psd_in.masked_fill(torch.eye(C, dtype=torch.bool, device=psd_in.device), 0) + # psd: (B, F, C, C) -> (B, C, F) + psd = (psd.sum(dim=-1) / (C - 1)).transpose(-1, -2) + + # Calculate amplitude + psd_feat = (psd.real**2 + psd.imag**2) ** 0.5 + + # (B, C, F) -> (B, C, F2) + mlp_psd = self.mlp_psd(psd_feat) + # (B, C, F2) -> (B, C, 1) -> (B, C) + e = self.gvec(torch.tanh(mlp_psd)).squeeze(-1) + u = F.softmax(scaling * e, dim=-1) + return u, ilens diff --git a/funasr/frontends/utils/dnn_wpe.py b/funasr/frontends/utils/dnn_wpe.py new file mode 100644 index 0000000..9171339 --- /dev/null +++ b/funasr/frontends/utils/dnn_wpe.py @@ -0,0 +1,93 @@ +from typing import Tuple + +from pytorch_wpe import wpe_one_iteration +import torch +from torch_complex.tensor import ComplexTensor + +from funasr.frontends.utils.mask_estimator import MaskEstimator +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class DNN_WPE(torch.nn.Module): + def __init__( + self, + wtype: str = "blstmp", + widim: int = 257, + wlayers: int = 3, + wunits: int = 300, + wprojs: int = 320, + dropout_rate: float = 0.0, + taps: int = 5, + delay: int = 3, + use_dnn_mask: bool = True, + iterations: int = 1, + normalization: bool = False, + ): + super().__init__() + self.iterations = iterations + self.taps = taps + self.delay = delay + + self.normalization = normalization + self.use_dnn_mask = use_dnn_mask + + self.inverse_power = True + + if self.use_dnn_mask: + self.mask_est = MaskEstimator( + wtype, widim, wlayers, wunits, wprojs, dropout_rate, nmask=1 + ) + + def forward( + self, data: ComplexTensor, ilens: torch.LongTensor + ) -> Tuple[ComplexTensor, torch.LongTensor, ComplexTensor]: + """The forward function + + Notation: + B: Batch + C: Channel + T: Time or Sequence length + F: Freq or Some dimension of the feature vector + + Args: + data: (B, C, T, F) + ilens: (B,) + Returns: + data: (B, C, T, F) + ilens: (B,) + """ + # (B, T, C, F) -> (B, F, C, T) + enhanced = data = data.permute(0, 3, 2, 1) + mask = None + + for i in range(self.iterations): + # Calculate power: (..., C, T) + power = enhanced.real**2 + enhanced.imag**2 + if i == 0 and self.use_dnn_mask: + # mask: (B, F, C, T) + (mask,), _ = self.mask_est(enhanced, ilens) + if self.normalization: + # Normalize along T + mask = mask / mask.sum(dim=-1)[..., None] + # (..., C, T) * (..., C, T) -> (..., C, T) + power = power * mask + + # Averaging along the channel axis: (..., C, T) -> (..., T) + power = power.mean(dim=-2) + + # enhanced: (..., C, T) -> (..., C, T) + enhanced = wpe_one_iteration( + data.contiguous(), + power, + taps=self.taps, + delay=self.delay, + inverse_power=self.inverse_power, + ) + + enhanced.masked_fill_(make_pad_mask(ilens, enhanced.real), 0) + + # (B, F, C, T) -> (B, T, C, F) + enhanced = enhanced.permute(0, 3, 2, 1) + if mask is not None: + mask = mask.transpose(-1, -3) + return enhanced, ilens, mask diff --git a/funasr/frontends/utils/feature_transform.py b/funasr/frontends/utils/feature_transform.py new file mode 100644 index 0000000..ab1486b --- /dev/null +++ b/funasr/frontends/utils/feature_transform.py @@ -0,0 +1,259 @@ +from typing import List +from typing import Tuple +from typing import Union + +import librosa +import numpy as np +import torch +from torch_complex.tensor import ComplexTensor + +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class FeatureTransform(torch.nn.Module): + def __init__( + self, + # Mel options, + fs: int = 16000, + n_fft: int = 512, + n_mels: int = 80, + fmin: float = 0.0, + fmax: float = None, + # Normalization + stats_file: str = None, + apply_uttmvn: bool = True, + uttmvn_norm_means: bool = True, + uttmvn_norm_vars: bool = False, + ): + super().__init__() + self.apply_uttmvn = apply_uttmvn + + self.logmel = LogMel(fs=fs, n_fft=n_fft, n_mels=n_mels, fmin=fmin, fmax=fmax) + self.stats_file = stats_file + if stats_file is not None: + self.global_mvn = GlobalMVN(stats_file) + else: + self.global_mvn = None + + if self.apply_uttmvn is not None: + self.uttmvn = UtteranceMVN(norm_means=uttmvn_norm_means, norm_vars=uttmvn_norm_vars) + else: + self.uttmvn = None + + def forward( + self, x: ComplexTensor, ilens: Union[torch.LongTensor, np.ndarray, List[int]] + ) -> Tuple[torch.Tensor, torch.LongTensor]: + # (B, T, F) or (B, T, C, F) + if x.dim() not in (3, 4): + raise ValueError(f"Input dim must be 3 or 4: {x.dim()}") + if not torch.is_tensor(ilens): + ilens = torch.from_numpy(np.asarray(ilens)).to(x.device) + + if x.dim() == 4: + # h: (B, T, C, F) -> h: (B, T, F) + if self.training: + # Select 1ch randomly + ch = np.random.randint(x.size(2)) + h = x[:, :, ch, :] + else: + # Use the first channel + h = x[:, :, 0, :] + else: + h = x + + # h: ComplexTensor(B, T, F) -> torch.Tensor(B, T, F) + h = h.real**2 + h.imag**2 + + h, _ = self.logmel(h, ilens) + if self.stats_file is not None: + h, _ = self.global_mvn(h, ilens) + if self.apply_uttmvn: + h, _ = self.uttmvn(h, ilens) + + return h, ilens + + +class LogMel(torch.nn.Module): + """Convert STFT to fbank feats + + The arguments is same as librosa.filters.mel + + Args: + fs: number > 0 [scalar] sampling rate of the incoming signal + n_fft: int > 0 [scalar] number of FFT components + n_mels: int > 0 [scalar] number of Mel bands to generate + fmin: float >= 0 [scalar] lowest frequency (in Hz) + fmax: float >= 0 [scalar] highest frequency (in Hz). + If `None`, use `fmax = fs / 2.0` + htk: use HTK formula instead of Slaney + norm: {None, 1, np.inf} [scalar] + if 1, divide the triangular mel weights by the width of the mel band + (area normalization). Otherwise, leave all the triangles aiming for + a peak value of 1.0 + + """ + + def __init__( + self, + fs: int = 16000, + n_fft: int = 512, + n_mels: int = 80, + fmin: float = 0.0, + fmax: float = None, + htk: bool = False, + norm=1, + ): + super().__init__() + + _mel_options = dict( + sr=fs, n_fft=n_fft, n_mels=n_mels, fmin=fmin, fmax=fmax, htk=htk, norm=norm + ) + self.mel_options = _mel_options + + # Note(kamo): The mel matrix of librosa is different from kaldi. + melmat = librosa.filters.mel(**_mel_options) + # melmat: (D2, D1) -> (D1, D2) + self.register_buffer("melmat", torch.from_numpy(melmat.T).float()) + + def extra_repr(self): + return ", ".join(f"{k}={v}" for k, v in self.mel_options.items()) + + def forward( + self, feat: torch.Tensor, ilens: torch.LongTensor + ) -> Tuple[torch.Tensor, torch.LongTensor]: + # feat: (B, T, D1) x melmat: (D1, D2) -> mel_feat: (B, T, D2) + mel_feat = torch.matmul(feat, self.melmat) + + logmel_feat = (mel_feat + 1e-20).log() + # Zero padding + logmel_feat = logmel_feat.masked_fill(make_pad_mask(ilens, logmel_feat, 1), 0.0) + return logmel_feat, ilens + + +class GlobalMVN(torch.nn.Module): + """Apply global mean and variance normalization + + Args: + stats_file(str): npy file of 1-dim array or text file. + From the _first element to + the {(len(array) - 1) / 2}th element are treated as + the sum of features, + and the rest excluding the last elements are + treated as the sum of the square value of features, + and the last elements eqauls to the number of samples. + std_floor(float): + """ + + def __init__( + self, + stats_file: str, + norm_means: bool = True, + norm_vars: bool = True, + eps: float = 1.0e-20, + ): + super().__init__() + self.norm_means = norm_means + self.norm_vars = norm_vars + + self.stats_file = stats_file + stats = np.load(stats_file) + + stats = stats.astype(float) + assert (len(stats) - 1) % 2 == 0, stats.shape + + count = stats.flatten()[-1] + mean = stats[: (len(stats) - 1) // 2] / count + var = stats[(len(stats) - 1) // 2 : -1] / count - mean * mean + std = np.maximum(np.sqrt(var), eps) + + self.register_buffer("bias", torch.from_numpy(-mean.astype(np.float32))) + self.register_buffer("scale", torch.from_numpy(1 / std.astype(np.float32))) + + def extra_repr(self): + return ( + f"stats_file={self.stats_file}, " + f"norm_means={self.norm_means}, norm_vars={self.norm_vars}" + ) + + def forward( + self, x: torch.Tensor, ilens: torch.LongTensor + ) -> Tuple[torch.Tensor, torch.LongTensor]: + # feat: (B, T, D) + if self.norm_means: + x += self.bias.type_as(x) + x.masked_fill(make_pad_mask(ilens, x, 1), 0.0) + + if self.norm_vars: + x *= self.scale.type_as(x) + return x, ilens + + +class UtteranceMVN(torch.nn.Module): + def __init__(self, norm_means: bool = True, norm_vars: bool = False, eps: float = 1.0e-20): + super().__init__() + self.norm_means = norm_means + self.norm_vars = norm_vars + self.eps = eps + + def extra_repr(self): + return f"norm_means={self.norm_means}, norm_vars={self.norm_vars}" + + def forward( + self, x: torch.Tensor, ilens: torch.LongTensor + ) -> Tuple[torch.Tensor, torch.LongTensor]: + return utterance_mvn( + x, ilens, norm_means=self.norm_means, norm_vars=self.norm_vars, eps=self.eps + ) + + +def utterance_mvn( + x: torch.Tensor, + ilens: torch.LongTensor, + norm_means: bool = True, + norm_vars: bool = False, + eps: float = 1.0e-20, +) -> Tuple[torch.Tensor, torch.LongTensor]: + """Apply utterance mean and variance normalization + + Args: + x: (B, T, D), assumed zero padded + ilens: (B, T, D) + norm_means: + norm_vars: + eps: + + """ + ilens_ = ilens.type_as(x) + # mean: (B, D) + mean = x.sum(dim=1) / ilens_[:, None] + + if norm_means: + x -= mean[:, None, :] + x_ = x + else: + x_ = x - mean[:, None, :] + + # Zero padding + x_.masked_fill(make_pad_mask(ilens, x_, 1), 0.0) + if norm_vars: + var = x_.pow(2).sum(dim=1) / ilens_[:, None] + var = torch.clamp(var, min=eps) + x /= var.sqrt()[:, None, :] + x_ = x + return x_, ilens + + +def feature_transform_for(args, n_fft): + return FeatureTransform( + # Mel options, + fs=args.fbank_fs, + n_fft=n_fft, + n_mels=args.n_mels, + fmin=args.fbank_fmin, + fmax=args.fbank_fmax, + # Normalization + stats_file=args.stats_file, + apply_uttmvn=args.apply_uttmvn, + uttmvn_norm_means=args.uttmvn_norm_means, + uttmvn_norm_vars=args.uttmvn_norm_vars, + ) diff --git a/funasr/frontends/utils/frontend.py b/funasr/frontends/utils/frontend.py new file mode 100644 index 0000000..a2a6cc1 --- /dev/null +++ b/funasr/frontends/utils/frontend.py @@ -0,0 +1,151 @@ +from typing import List +from typing import Optional +from typing import Tuple +from typing import Union + +import numpy +import torch +import torch.nn as nn +from torch_complex.tensor import ComplexTensor + +from funasr.frontends.utils.dnn_beamformer import DNN_Beamformer +from funasr.frontends.utils.dnn_wpe import DNN_WPE + + +class Frontend(nn.Module): + def __init__( + self, + idim: int, + # WPE options + use_wpe: bool = False, + wtype: str = "blstmp", + wlayers: int = 3, + wunits: int = 300, + wprojs: int = 320, + wdropout_rate: float = 0.0, + taps: int = 5, + delay: int = 3, + use_dnn_mask_for_wpe: bool = True, + # Beamformer options + use_beamformer: bool = False, + btype: str = "blstmp", + blayers: int = 3, + bunits: int = 300, + bprojs: int = 320, + bnmask: int = 2, + badim: int = 320, + ref_channel: int = -1, + bdropout_rate=0.0, + ): + super().__init__() + + self.use_beamformer = use_beamformer + self.use_wpe = use_wpe + self.use_dnn_mask_for_wpe = use_dnn_mask_for_wpe + # use frontend for all the data, + # e.g. in the case of multi-speaker speech separation + self.use_frontend_for_all = bnmask > 2 + + if self.use_wpe: + if self.use_dnn_mask_for_wpe: + # Use DNN for power estimation + # (Not observed significant gains) + iterations = 1 + else: + # Performing as conventional WPE, without DNN Estimator + iterations = 2 + + self.wpe = DNN_WPE( + wtype=wtype, + widim=idim, + wunits=wunits, + wprojs=wprojs, + wlayers=wlayers, + taps=taps, + delay=delay, + dropout_rate=wdropout_rate, + iterations=iterations, + use_dnn_mask=use_dnn_mask_for_wpe, + ) + else: + self.wpe = None + + if self.use_beamformer: + self.beamformer = DNN_Beamformer( + btype=btype, + bidim=idim, + bunits=bunits, + bprojs=bprojs, + blayers=blayers, + bnmask=bnmask, + dropout_rate=bdropout_rate, + badim=badim, + ref_channel=ref_channel, + ) + else: + self.beamformer = None + + def forward( + self, x: ComplexTensor, ilens: Union[torch.LongTensor, numpy.ndarray, List[int]] + ) -> Tuple[ComplexTensor, torch.LongTensor, Optional[ComplexTensor]]: + assert len(x) == len(ilens), (len(x), len(ilens)) + # (B, T, F) or (B, T, C, F) + if x.dim() not in (3, 4): + raise ValueError(f"Input dim must be 3 or 4: {x.dim()}") + if not torch.is_tensor(ilens): + ilens = torch.from_numpy(numpy.asarray(ilens)).to(x.device) + + mask = None + h = x + if h.dim() == 4: + if self.training: + choices = [(False, False)] if not self.use_frontend_for_all else [] + if self.use_wpe: + choices.append((True, False)) + + if self.use_beamformer: + choices.append((False, True)) + + use_wpe, use_beamformer = choices[numpy.random.randint(len(choices))] + + else: + use_wpe = self.use_wpe + use_beamformer = self.use_beamformer + + # 1. WPE + if use_wpe: + # h: (B, T, C, F) -> h: (B, T, C, F) + h, ilens, mask = self.wpe(h, ilens) + + # 2. Beamformer + if use_beamformer: + # h: (B, T, C, F) -> h: (B, T, F) + h, ilens, mask = self.beamformer(h, ilens) + + return h, ilens, mask + + +def frontend_for(args, idim): + return Frontend( + idim=idim, + # WPE options + use_wpe=args.use_wpe, + wtype=args.wtype, + wlayers=args.wlayers, + wunits=args.wunits, + wprojs=args.wprojs, + wdropout_rate=args.wdropout_rate, + taps=args.wpe_taps, + delay=args.wpe_delay, + use_dnn_mask_for_wpe=args.use_dnn_mask_for_wpe, + # Beamformer options + use_beamformer=args.use_beamformer, + btype=args.btype, + blayers=args.blayers, + bunits=args.bunits, + bprojs=args.bprojs, + bnmask=args.bnmask, + badim=args.badim, + ref_channel=args.ref_channel, + bdropout_rate=args.bdropout_rate, + ) diff --git a/funasr/frontends/utils/log_mel.py b/funasr/frontends/utils/log_mel.py new file mode 100644 index 0000000..611cf1e --- /dev/null +++ b/funasr/frontends/utils/log_mel.py @@ -0,0 +1,79 @@ +import librosa +import torch +from typing import Tuple + +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class LogMel(torch.nn.Module): + """Convert STFT to fbank feats + + The arguments is same as librosa.filters.mel + + Args: + fs: number > 0 [scalar] sampling rate of the incoming signal + n_fft: int > 0 [scalar] number of FFT components + n_mels: int > 0 [scalar] number of Mel bands to generate + fmin: float >= 0 [scalar] lowest frequency (in Hz) + fmax: float >= 0 [scalar] highest frequency (in Hz). + If `None`, use `fmax = fs / 2.0` + htk: use HTK formula instead of Slaney + """ + + def __init__( + self, + fs: int = 16000, + n_fft: int = 512, + n_mels: int = 80, + fmin: float = None, + fmax: float = None, + htk: bool = False, + log_base: float = None, + ): + super().__init__() + + fmin = 0 if fmin is None else fmin + fmax = fs / 2 if fmax is None else fmax + _mel_options = dict( + sr=fs, + n_fft=n_fft, + n_mels=n_mels, + fmin=fmin, + fmax=fmax, + htk=htk, + ) + self.mel_options = _mel_options + self.log_base = log_base + + # Note(kamo): The mel matrix of librosa is different from kaldi. + melmat = librosa.filters.mel(**_mel_options) + # melmat: (D2, D1) -> (D1, D2) + self.register_buffer("melmat", torch.from_numpy(melmat.T).float()) + + def extra_repr(self): + return ", ".join(f"{k}={v}" for k, v in self.mel_options.items()) + + def forward( + self, + feat: torch.Tensor, + ilens: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor]: + # feat: (B, T, D1) x melmat: (D1, D2) -> mel_feat: (B, T, D2) + mel_feat = torch.matmul(feat, self.melmat) + mel_feat = torch.clamp(mel_feat, min=1e-10) + + if self.log_base is None: + logmel_feat = mel_feat.log() + elif self.log_base == 2.0: + logmel_feat = mel_feat.log2() + elif self.log_base == 10.0: + logmel_feat = mel_feat.log10() + else: + logmel_feat = mel_feat.log() / torch.log(self.log_base) + + # Zero padding + if ilens is not None: + logmel_feat = logmel_feat.masked_fill(make_pad_mask(ilens, logmel_feat, 1), 0.0) + else: + ilens = feat.new_full([feat.size(0)], fill_value=feat.size(1), dtype=torch.long) + return logmel_feat, ilens diff --git a/funasr/frontends/utils/mask_estimator.py b/funasr/frontends/utils/mask_estimator.py new file mode 100644 index 0000000..29a21d9 --- /dev/null +++ b/funasr/frontends/utils/mask_estimator.py @@ -0,0 +1,75 @@ +from typing import Tuple + +import numpy as np +import torch +from torch.nn import functional as F +from torch_complex.tensor import ComplexTensor + +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.language_model.rnn.encoders import RNN +from funasr.models.language_model.rnn.encoders import RNNP + + +class MaskEstimator(torch.nn.Module): + def __init__(self, type, idim, layers, units, projs, dropout, nmask=1): + super().__init__() + subsample = np.ones(layers + 1, dtype=np.int32) + + typ = type.lstrip("vgg").rstrip("p") + if type[-1] == "p": + self.brnn = RNNP(idim, layers, units, projs, subsample, dropout, typ=typ) + else: + self.brnn = RNN(idim, layers, units, projs, dropout, typ=typ) + + self.type = type + self.nmask = nmask + self.linears = torch.nn.ModuleList([torch.nn.Linear(projs, idim) for _ in range(nmask)]) + + def forward( + self, xs: ComplexTensor, ilens: torch.LongTensor + ) -> Tuple[Tuple[torch.Tensor, ...], torch.LongTensor]: + """The forward function + + Args: + xs: (B, F, C, T) + ilens: (B,) + Returns: + hs (torch.Tensor): The hidden vector (B, F, C, T) + masks: A tuple of the masks. (B, F, C, T) + ilens: (B,) + """ + assert xs.size(0) == ilens.size(0), (xs.size(0), ilens.size(0)) + _, _, C, input_length = xs.size() + # (B, F, C, T) -> (B, C, T, F) + xs = xs.permute(0, 2, 3, 1) + + # Calculate amplitude: (B, C, T, F) -> (B, C, T, F) + xs = (xs.real**2 + xs.imag**2) ** 0.5 + # xs: (B, C, T, F) -> xs: (B * C, T, F) + xs = xs.contiguous().view(-1, xs.size(-2), xs.size(-1)) + # ilens: (B,) -> ilens_: (B * C) + ilens_ = ilens[:, None].expand(-1, C).contiguous().view(-1) + + # xs: (B * C, T, F) -> xs: (B * C, T, D) + xs, _, _ = self.brnn(xs, ilens_) + # xs: (B * C, T, D) -> xs: (B, C, T, D) + xs = xs.view(-1, C, xs.size(-2), xs.size(-1)) + + masks = [] + for linear in self.linears: + # xs: (B, C, T, D) -> mask:(B, C, T, F) + mask = linear(xs) + + mask = torch.sigmoid(mask) + # Zero padding + mask.masked_fill(make_pad_mask(ilens, mask, length_dim=2), 0) + + # (B, C, T, F) -> (B, F, C, T) + mask = mask.permute(0, 3, 1, 2) + + # Take cares of multi gpu cases: If input_length > max(ilens) + if mask.size(-1) < input_length: + mask = F.pad(mask, [0, input_length - mask.size(-1)], value=0) + masks.append(mask) + + return tuple(masks), ilens diff --git a/funasr/frontends/utils/stft.py b/funasr/frontends/utils/stft.py new file mode 100644 index 0000000..381f1e9 --- /dev/null +++ b/funasr/frontends/utils/stft.py @@ -0,0 +1,226 @@ +from distutils.version import LooseVersion +from typing import Optional +from typing import Tuple +from typing import Union + +import torch + +try: + from torch_complex.tensor import ComplexTensor +except: + print("Please install torch_complex firstly") +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.frontends.utils.complex_utils import is_complex + +import librosa +import numpy as np + +is_torch_1_9_plus = LooseVersion(torch.__version__) >= LooseVersion("1.9.0") + + +is_torch_1_7_plus = LooseVersion(torch.__version__) >= LooseVersion("1.7") + + +class Stft(torch.nn.Module): + def __init__( + self, + n_fft: int = 512, + win_length: int = None, + hop_length: int = 128, + window: Optional[str] = "hann", + center: bool = True, + normalized: bool = False, + onesided: bool = True, + ): + super().__init__() + self.n_fft = n_fft + if win_length is None: + self.win_length = n_fft + else: + self.win_length = win_length + self.hop_length = hop_length + self.center = center + self.normalized = normalized + self.onesided = onesided + if window is not None and not hasattr(torch, f"{window}_window"): + if window.lower() != "povey": + raise ValueError(f"{window} window is not implemented") + self.window = window + + def extra_repr(self): + return ( + f"n_fft={self.n_fft}, " + f"win_length={self.win_length}, " + f"hop_length={self.hop_length}, " + f"center={self.center}, " + f"normalized={self.normalized}, " + f"onesided={self.onesided}" + ) + + def forward( + self, input: torch.Tensor, ilens: torch.Tensor = None + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """STFT forward function. + + Args: + input: (Batch, Nsamples) or (Batch, Nsample, Channels) + ilens: (Batch) + Returns: + output: (Batch, Frames, Freq, 2) or (Batch, Frames, Channels, Freq, 2) + + """ + bs = input.size(0) + if input.dim() == 3: + multi_channel = True + # input: (Batch, Nsample, Channels) -> (Batch * Channels, Nsample) + input = input.transpose(1, 2).reshape(-1, input.size(1)) + else: + multi_channel = False + + # NOTE(kamo): + # The default behaviour of torch.stft is compatible with librosa.stft + # about padding and scaling. + # Note that it's different from scipy.signal.stft + + # output: (Batch, Freq, Frames, 2=real_imag) + # or (Batch, Channel, Freq, Frames, 2=real_imag) + if self.window is not None: + if self.window.lower() == "povey": + window = torch.hann_window( + self.win_length, periodic=False, device=input.device, dtype=input.dtype + ).pow(0.85) + else: + window_func = getattr(torch, f"{self.window}_window") + window = window_func(self.win_length, dtype=input.dtype, device=input.device) + else: + window = None + + # For the compatibility of ARM devices, which do not support + # torch.stft() due to the lake of MKL. + if input.is_cuda or torch.backends.mkl.is_available(): + stft_kwargs = dict( + n_fft=self.n_fft, + win_length=self.win_length, + hop_length=self.hop_length, + center=self.center, + window=window, + normalized=self.normalized, + onesided=self.onesided, + ) + if is_torch_1_7_plus: + stft_kwargs["return_complex"] = False + output = torch.stft(input, **stft_kwargs) + else: + if self.training: + raise NotImplementedError( + "stft is implemented with librosa on this device, which does not " + "support the training mode." + ) + + # use stft_kwargs to flexibly control different PyTorch versions' kwargs + stft_kwargs = dict( + n_fft=self.n_fft, + win_length=self.win_length, + hop_length=self.hop_length, + center=self.center, + window=window, + ) + + if window is not None: + # pad the given window to n_fft + n_pad_left = (self.n_fft - window.shape[0]) // 2 + n_pad_right = self.n_fft - window.shape[0] - n_pad_left + stft_kwargs["window"] = torch.cat( + [torch.zeros(n_pad_left), window, torch.zeros(n_pad_right)], 0 + ).numpy() + else: + win_length = self.win_length if self.win_length is not None else self.n_fft + stft_kwargs["window"] = torch.ones(win_length) + + output = [] + # iterate over istances in a batch + for i, instance in enumerate(input): + stft = librosa.stft(input[i].numpy(), **stft_kwargs) + output.append(torch.tensor(np.stack([stft.real, stft.imag], -1))) + output = torch.stack(output, 0) + if not self.onesided: + len_conj = self.n_fft - output.shape[1] + conj = output[:, 1 : 1 + len_conj].flip(1) + conj[:, :, :, -1].data *= -1 + output = torch.cat([output, conj], 1) + if self.normalized: + output = output * (stft_kwargs["window"].shape[0] ** (-0.5)) + + # output: (Batch, Freq, Frames, 2=real_imag) + # -> (Batch, Frames, Freq, 2=real_imag) + output = output.transpose(1, 2) + if multi_channel: + # output: (Batch * Channel, Frames, Freq, 2=real_imag) + # -> (Batch, Frame, Channel, Freq, 2=real_imag) + output = output.view(bs, -1, output.size(1), output.size(2), 2).transpose(1, 2) + + if ilens is not None: + if self.center: + pad = self.n_fft // 2 + ilens = ilens + 2 * pad + + olens = (ilens - self.n_fft) // self.hop_length + 1 + output.masked_fill_(make_pad_mask(olens, output, 1), 0.0) + else: + olens = None + + return output, olens + + def inverse( + self, input: Union[torch.Tensor, ComplexTensor], ilens: torch.Tensor = None + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """Inverse STFT. + + Args: + input: Tensor(batch, T, F, 2) or ComplexTensor(batch, T, F) + ilens: (batch,) + Returns: + wavs: (batch, samples) + ilens: (batch,) + """ + if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + istft = torch.functional.istft + else: + try: + import torchaudio + except ImportError: + raise ImportError("Please install torchaudio>=0.3.0 or use torch>=1.6.0") + + if not hasattr(torchaudio.functional, "istft"): + raise ImportError("Please install torchaudio>=0.3.0 or use torch>=1.6.0") + istft = torchaudio.functional.istft + + if self.window is not None: + window_func = getattr(torch, f"{self.window}_window") + if is_complex(input): + datatype = input.real.dtype + else: + datatype = input.dtype + window = window_func(self.win_length, dtype=datatype, device=input.device) + else: + window = None + + if is_complex(input): + input = torch.stack([input.real, input.imag], dim=-1) + elif input.shape[-1] != 2: + raise TypeError("Invalid input type") + input = input.transpose(1, 2) + + wavs = istft( + input, + n_fft=self.n_fft, + hop_length=self.hop_length, + win_length=self.win_length, + window=window, + center=self.center, + normalized=self.normalized, + onesided=self.onesided, + length=ilens.max() if ilens is not None else ilens, + ) + + return wavs, ilens diff --git a/funasr/frontends/wav_frontend.py b/funasr/frontends/wav_frontend.py new file mode 100644 index 0000000..a4002df --- /dev/null +++ b/funasr/frontends/wav_frontend.py @@ -0,0 +1,545 @@ +# Copyright (c) Alibaba, Inc. and its affiliates. +# Part of the implementation is borrowed from espnet/espnet. +from typing import Tuple +import copy +import numpy as np +import torch +import torch.nn as nn +import torchaudio.compliance.kaldi as kaldi +from torch.nn.utils.rnn import pad_sequence + +import funasr.frontends.eend_ola_feature as eend_ola_feature +from funasr.register import tables + + +def load_cmvn(cmvn_file): + with open(cmvn_file, "r", encoding="utf-8") as f: + lines = f.readlines() + means_list = [] + vars_list = [] + for i in range(len(lines)): + line_item = lines[i].split() + if line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + add_shift_line = line_item[3 : (len(line_item) - 1)] + means_list = list(add_shift_line) + continue + elif line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + rescale_line = line_item[3 : (len(line_item) - 1)] + vars_list = list(rescale_line) + continue + means = np.array(means_list).astype(np.float32) + vars = np.array(vars_list).astype(np.float32) + cmvn = np.array([means, vars]) + cmvn = torch.as_tensor(cmvn, dtype=torch.float32) + return cmvn + + +def apply_cmvn(inputs, cmvn): # noqa + """ + Apply CMVN with mvn data + """ + + device = inputs.device + dtype = inputs.dtype + frame, dim = inputs.shape + + means = cmvn[0:1, :dim] + vars = cmvn[1:2, :dim] + inputs += means.to(device) + inputs *= vars.to(device) + + return inputs.type(torch.float32) + + +def apply_lfr(inputs, lfr_m, lfr_n): + LFR_inputs = [] + T = inputs.shape[0] + T_lfr = int(np.ceil(T / lfr_n)) + left_padding = inputs[0].repeat((lfr_m - 1) // 2, 1) + inputs = torch.vstack((left_padding, inputs)) + T = T + (lfr_m - 1) // 2 + for i in range(T_lfr): + if lfr_m <= T - i * lfr_n: + LFR_inputs.append((inputs[i * lfr_n : i * lfr_n + lfr_m]).view(1, -1)) + else: # process last LFR frame + num_padding = lfr_m - (T - i * lfr_n) + frame = (inputs[i * lfr_n :]).view(-1) + for _ in range(num_padding): + frame = torch.hstack((frame, inputs[-1])) + LFR_inputs.append(frame) + LFR_outputs = torch.vstack(LFR_inputs) + return LFR_outputs.type(torch.float32) + + +@tables.register("frontend_classes", "wav_frontend") +@tables.register("frontend_classes", "WavFrontend") +class WavFrontend(nn.Module): + """Conventional frontend structure for ASR.""" + + def __init__( + self, + cmvn_file: str = None, + fs: int = 16000, + window: str = "hamming", + n_mels: int = 80, + frame_length: int = 25, + frame_shift: int = 10, + filter_length_min: int = -1, + filter_length_max: int = -1, + lfr_m: int = 1, + lfr_n: int = 1, + dither: float = 1.0, + snip_edges: bool = True, + upsacle_samples: bool = True, + **kwargs, + ): + super().__init__() + self.fs = fs + self.window = window + self.n_mels = n_mels + self.frame_length = frame_length + self.frame_shift = frame_shift + self.filter_length_min = filter_length_min + self.filter_length_max = filter_length_max + self.lfr_m = lfr_m + self.lfr_n = lfr_n + self.cmvn_file = cmvn_file + self.dither = dither + self.snip_edges = snip_edges + self.upsacle_samples = upsacle_samples + self.cmvn = None if self.cmvn_file is None else load_cmvn(self.cmvn_file) + + def output_size(self) -> int: + return self.n_mels * self.lfr_m + + def forward( + self, + input: torch.Tensor, + input_lengths, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + batch_size = input.size(0) + feats = [] + feats_lens = [] + for i in range(batch_size): + waveform_length = input_lengths[i] + waveform = input[i][:waveform_length] + if self.upsacle_samples: + waveform = waveform * (1 << 15) + waveform = waveform.unsqueeze(0) + mat = kaldi.fbank( + waveform, + num_mel_bins=self.n_mels, + frame_length=self.frame_length, + frame_shift=self.frame_shift, + dither=self.dither, + energy_floor=0.0, + window_type=self.window, + sample_frequency=self.fs, + snip_edges=self.snip_edges, + ) + + if self.lfr_m != 1 or self.lfr_n != 1: + mat = apply_lfr(mat, self.lfr_m, self.lfr_n) + if self.cmvn is not None: + mat = apply_cmvn(mat, self.cmvn) + feat_length = mat.size(0) + feats.append(mat) + feats_lens.append(feat_length) + + feats_lens = torch.as_tensor(feats_lens) + if batch_size == 1: + feats_pad = feats[0][None, :, :] + else: + feats_pad = pad_sequence(feats, batch_first=True, padding_value=0.0) + return feats_pad, feats_lens + + def forward_fbank( + self, input: torch.Tensor, input_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + batch_size = input.size(0) + feats = [] + feats_lens = [] + for i in range(batch_size): + waveform_length = input_lengths[i] + waveform = input[i][:waveform_length] + waveform = waveform * (1 << 15) + waveform = waveform.unsqueeze(0) + mat = kaldi.fbank( + waveform, + num_mel_bins=self.n_mels, + frame_length=self.frame_length, + frame_shift=self.frame_shift, + dither=self.dither, + energy_floor=0.0, + window_type=self.window, + sample_frequency=self.fs, + ) + + feat_length = mat.size(0) + feats.append(mat) + feats_lens.append(feat_length) + + feats_lens = torch.as_tensor(feats_lens) + feats_pad = pad_sequence(feats, batch_first=True, padding_value=0.0) + return feats_pad, feats_lens + + def forward_lfr_cmvn( + self, input: torch.Tensor, input_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + batch_size = input.size(0) + feats = [] + feats_lens = [] + for i in range(batch_size): + mat = input[i, : input_lengths[i], :] + if self.lfr_m != 1 or self.lfr_n != 1: + mat = apply_lfr(mat, self.lfr_m, self.lfr_n) + if self.cmvn is not None: + mat = apply_cmvn(mat, self.cmvn) + feat_length = mat.size(0) + feats.append(mat) + feats_lens.append(feat_length) + + feats_lens = torch.as_tensor(feats_lens) + feats_pad = pad_sequence(feats, batch_first=True, padding_value=0.0) + return feats_pad, feats_lens + + +@tables.register("frontend_classes", "WavFrontendOnline") +class WavFrontendOnline(nn.Module): + """Conventional frontend structure for streaming ASR/VAD.""" + + def __init__( + self, + cmvn_file: str = None, + fs: int = 16000, + window: str = "hamming", + n_mels: int = 80, + frame_length: int = 25, + frame_shift: int = 10, + filter_length_min: int = -1, + filter_length_max: int = -1, + lfr_m: int = 1, + lfr_n: int = 1, + dither: float = 1.0, + snip_edges: bool = True, + upsacle_samples: bool = True, + **kwargs, + ): + super().__init__() + self.fs = fs + self.window = window + self.n_mels = n_mels + self.frame_length = frame_length + self.frame_shift = frame_shift + self.frame_sample_length = int(self.frame_length * self.fs / 1000) + self.frame_shift_sample_length = int(self.frame_shift * self.fs / 1000) + self.filter_length_min = filter_length_min + self.filter_length_max = filter_length_max + self.lfr_m = lfr_m + self.lfr_n = lfr_n + self.cmvn_file = cmvn_file + self.dither = dither + self.snip_edges = snip_edges + self.upsacle_samples = upsacle_samples + # self.waveforms = None + # self.reserve_waveforms = None + # self.fbanks = None + # self.fbanks_lens = None + self.cmvn = None if self.cmvn_file is None else load_cmvn(self.cmvn_file) + # self.input_cache = None + # self.lfr_splice_cache = [] + + def output_size(self) -> int: + return self.n_mels * self.lfr_m + + @staticmethod + def apply_cmvn(inputs: torch.Tensor, cmvn: torch.Tensor) -> torch.Tensor: + """ + Apply CMVN with mvn data + """ + + device = inputs.device + dtype = inputs.dtype + frame, dim = inputs.shape + + means = np.tile(cmvn[0:1, :dim], (frame, 1)) + vars = np.tile(cmvn[1:2, :dim], (frame, 1)) + inputs += torch.from_numpy(means).type(dtype).to(device) + inputs *= torch.from_numpy(vars).type(dtype).to(device) + + return inputs.type(torch.float32) + + @staticmethod + def apply_lfr( + inputs: torch.Tensor, lfr_m: int, lfr_n: int, is_final: bool = False + ) -> Tuple[torch.Tensor, torch.Tensor, int]: + """ + Apply lfr with data + """ + + LFR_inputs = [] + # inputs = torch.vstack((inputs_lfr_cache, inputs)) + T = inputs.shape[0] # include the right context + T_lfr = int( + np.ceil((T - (lfr_m - 1) // 2) / lfr_n) + ) # minus the right context: (lfr_m - 1) // 2 + splice_idx = T_lfr + for i in range(T_lfr): + if lfr_m <= T - i * lfr_n: + LFR_inputs.append((inputs[i * lfr_n : i * lfr_n + lfr_m]).view(1, -1)) + else: # process last LFR frame + if is_final: + num_padding = lfr_m - (T - i * lfr_n) + frame = (inputs[i * lfr_n :]).view(-1) + for _ in range(num_padding): + frame = torch.hstack((frame, inputs[-1])) + LFR_inputs.append(frame) + else: + # update splice_idx and break the circle + splice_idx = i + break + splice_idx = min(T - 1, splice_idx * lfr_n) + lfr_splice_cache = inputs[splice_idx:, :] + LFR_outputs = torch.vstack(LFR_inputs) + return LFR_outputs.type(torch.float32), lfr_splice_cache, splice_idx + + @staticmethod + def compute_frame_num( + sample_length: int, frame_sample_length: int, frame_shift_sample_length: int + ) -> int: + frame_num = int((sample_length - frame_sample_length) / frame_shift_sample_length + 1) + return frame_num if frame_num >= 1 and sample_length >= frame_sample_length else 0 + + def forward_fbank( + self, + input: torch.Tensor, + input_lengths: torch.Tensor, + cache: dict = {}, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + batch_size = input.size(0) + + input = torch.cat((cache["input_cache"], input), dim=1) + frame_num = self.compute_frame_num( + input.shape[-1], self.frame_sample_length, self.frame_shift_sample_length + ) + # update self.in_cache + cache["input_cache"] = input[ + :, -(input.shape[-1] - frame_num * self.frame_shift_sample_length) : + ] + waveforms = torch.empty(0) + feats_pad = torch.empty(0) + feats_lens = torch.empty(0) + if frame_num: + waveforms = [] + feats = [] + feats_lens = [] + for i in range(batch_size): + waveform = input[i] + # we need accurate wave samples that used for fbank extracting + waveforms.append( + waveform[ + : ( + (frame_num - 1) * self.frame_shift_sample_length + + self.frame_sample_length + ) + ] + ) + waveform = waveform * (1 << 15) + waveform = waveform.unsqueeze(0) + mat = kaldi.fbank( + waveform, + num_mel_bins=self.n_mels, + frame_length=self.frame_length, + frame_shift=self.frame_shift, + dither=self.dither, + energy_floor=0.0, + window_type=self.window, + sample_frequency=self.fs, + ) + + feat_length = mat.size(0) + feats.append(mat) + feats_lens.append(feat_length) + + waveforms = torch.stack(waveforms) + feats_lens = torch.as_tensor(feats_lens) + feats_pad = pad_sequence(feats, batch_first=True, padding_value=0.0) + cache["fbanks"] = feats_pad + cache["fbanks_lens"] = copy.deepcopy(feats_lens) + return waveforms, feats_pad, feats_lens + + def forward_lfr_cmvn( + self, + input: torch.Tensor, + input_lengths: torch.Tensor, + is_final: bool = False, + cache: dict = {}, + **kwargs, + ): + batch_size = input.size(0) + feats = [] + feats_lens = [] + lfr_splice_frame_idxs = [] + for i in range(batch_size): + mat = input[i, : input_lengths[i], :] + if self.lfr_m != 1 or self.lfr_n != 1: + # update self.lfr_splice_cache in self.apply_lfr + # mat, self.lfr_splice_cache[i], lfr_splice_frame_idx = self.apply_lfr(mat, self.lfr_m, self.lfr_n, self.lfr_splice_cache[i], + mat, cache["lfr_splice_cache"][i], lfr_splice_frame_idx = self.apply_lfr( + mat, self.lfr_m, self.lfr_n, is_final + ) + if self.cmvn_file is not None: + mat = self.apply_cmvn(mat, self.cmvn) + feat_length = mat.size(0) + feats.append(mat) + feats_lens.append(feat_length) + lfr_splice_frame_idxs.append(lfr_splice_frame_idx) + + feats_lens = torch.as_tensor(feats_lens) + feats_pad = pad_sequence(feats, batch_first=True, padding_value=0.0) + lfr_splice_frame_idxs = torch.as_tensor(lfr_splice_frame_idxs) + return feats_pad, feats_lens, lfr_splice_frame_idxs + + def forward(self, input: torch.Tensor, input_lengths: torch.Tensor, **kwargs): + is_final = kwargs.get("is_final", False) + cache = kwargs.get("cache", {}) + if len(cache) == 0: + self.init_cache(cache) + + batch_size = input.shape[0] + assert ( + batch_size == 1 + ), "we support to extract feature online only when the batch size is equal to 1 now" + + waveforms, feats, feats_lengths = self.forward_fbank( + input, input_lengths, cache=cache + ) # input shape: B T D + + if feats.shape[0]: + + cache["waveforms"] = torch.cat((cache["reserve_waveforms"], waveforms), dim=1) + + if not cache["lfr_splice_cache"]: # 初始化splice_cache + for i in range(batch_size): + cache["lfr_splice_cache"].append( + feats[i][0, :].unsqueeze(dim=0).repeat((self.lfr_m - 1) // 2, 1) + ) + # need the number of the input frames + self.lfr_splice_cache[0].shape[0] is greater than self.lfr_m + if feats_lengths[0] + cache["lfr_splice_cache"][0].shape[0] >= self.lfr_m: + lfr_splice_cache_tensor = torch.stack(cache["lfr_splice_cache"]) # B T D + feats = torch.cat((lfr_splice_cache_tensor, feats), dim=1) + feats_lengths += lfr_splice_cache_tensor[0].shape[0] + frame_from_waveforms = int( + (cache["waveforms"].shape[1] - self.frame_sample_length) + / self.frame_shift_sample_length + + 1 + ) + minus_frame = ( + (self.lfr_m - 1) // 2 if cache["reserve_waveforms"].numel() == 0 else 0 + ) + feats, feats_lengths, lfr_splice_frame_idxs = self.forward_lfr_cmvn( + feats, feats_lengths, is_final, cache=cache + ) + if self.lfr_m == 1: + cache["reserve_waveforms"] = torch.empty(0) + else: + reserve_frame_idx = lfr_splice_frame_idxs[0] - minus_frame + # print('reserve_frame_idx: ' + str(reserve_frame_idx)) + # print('frame_frame: ' + str(frame_from_waveforms)) + cache["reserve_waveforms"] = cache["waveforms"][ + :, + reserve_frame_idx + * self.frame_shift_sample_length : frame_from_waveforms + * self.frame_shift_sample_length, + ] + sample_length = ( + frame_from_waveforms - 1 + ) * self.frame_shift_sample_length + self.frame_sample_length + cache["waveforms"] = cache["waveforms"][:, :sample_length] + else: + # update self.reserve_waveforms and self.lfr_splice_cache + cache["reserve_waveforms"] = cache["waveforms"][ + :, : -(self.frame_sample_length - self.frame_shift_sample_length) + ] + for i in range(batch_size): + cache["lfr_splice_cache"][i] = torch.cat( + (cache["lfr_splice_cache"][i], feats[i]), dim=0 + ) + return torch.empty(0), feats_lengths + else: + if is_final: + cache["waveforms"] = ( + waveforms + if cache["reserve_waveforms"].numel() == 0 + else cache["reserve_waveforms"] + ) + feats = torch.stack(cache["lfr_splice_cache"]) + feats_lengths = torch.zeros(batch_size, dtype=torch.int) + feats.shape[1] + feats, feats_lengths, _ = self.forward_lfr_cmvn( + feats, feats_lengths, is_final, cache=cache + ) + # if is_final: + # self.init_cache(cache) + return feats, feats_lengths + + def init_cache(self, cache: dict = {}): + cache["reserve_waveforms"] = torch.empty(0) + cache["input_cache"] = torch.empty(0) + cache["lfr_splice_cache"] = [] + cache["waveforms"] = None + cache["fbanks"] = None + cache["fbanks_lens"] = None + return cache + + +class WavFrontendMel23(nn.Module): + """Conventional frontend structure for ASR.""" + + def __init__( + self, + fs: int = 16000, + frame_length: int = 25, + frame_shift: int = 10, + lfr_m: int = 1, + lfr_n: int = 1, + **kwargs, + ): + super().__init__() + self.fs = fs + self.frame_length = frame_length + self.frame_shift = frame_shift + self.lfr_m = lfr_m + self.lfr_n = lfr_n + self.n_mels = 23 + + def output_size(self) -> int: + return self.n_mels * (2 * self.lfr_m + 1) + + def forward( + self, input: torch.Tensor, input_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + batch_size = input.size(0) + feats = [] + feats_lens = [] + for i in range(batch_size): + waveform_length = input_lengths[i] + waveform = input[i][:waveform_length] + waveform = waveform.numpy() + mat = eend_ola_feature.stft(waveform, self.frame_length, self.frame_shift) + mat = eend_ola_feature.transform(mat) + mat = eend_ola_feature.splice(mat, context_size=self.lfr_m) + mat = mat[:: self.lfr_n] + mat = torch.from_numpy(mat) + feat_length = mat.size(0) + feats.append(mat) + feats_lens.append(feat_length) + + feats_lens = torch.as_tensor(feats_lens) + feats_pad = pad_sequence(feats, batch_first=True, padding_value=0.0) + return feats_pad, feats_lens diff --git a/funasr/frontends/whisper_frontend.py b/funasr/frontends/whisper_frontend.py new file mode 100644 index 0000000..1bd8aec --- /dev/null +++ b/funasr/frontends/whisper_frontend.py @@ -0,0 +1,117 @@ +from typing import Tuple +import torch +import torch.nn as nn + + +from funasr.register import tables +from torch.nn.utils.rnn import pad_sequence + + +@tables.register("frontend_classes", "WhisperFrontend") +class WhisperFrontend(nn.Module): + """Speech Representation Using Encoder Outputs from OpenAI's Whisper Model: + + URL: https://github.com/openai/whisper + """ + + def __init__( + self, + fs: int = 16000, + whisper_model: str = None, + do_pad_trim: bool = True, + n_mels: int = 80, + permute: bool = False, + **kwargs, + ): + super().__init__() + assert fs == 16000 + self.fs = fs + import whisper + from whisper.audio import HOP_LENGTH, N_FFT, N_SAMPLES + + self.n_fft = N_FFT + self.win_length = N_FFT + self.hop_length = HOP_LENGTH + self.pad_samples = N_SAMPLES + self.frame_shift = int(self.hop_length / self.fs * 1000) + self.lfr_n = 1 + self.n_mels = n_mels + if whisper_model == "large-v3" or whisper_model == "large": + self.n_mels = 128 + + filters_path = kwargs.get("filters_path", None) + self.filters_path = filters_path + if filters_path is not None: + from funasr.models.sense_voice.whisper_lib.audio import mel_filters + + self.mel_filters = mel_filters + else: + self.mel_filters = whisper.audio.mel_filters + self.do_pad_trim = do_pad_trim + if do_pad_trim: + self.pad_or_trim = whisper.pad_or_trim + self.permute = permute + + # assert whisper_model in whisper.available_models() + + def output_size(self) -> int: + return self.n_mels + + def log_mel_spectrogram( + self, + audio: torch.Tensor, + ilens: torch.Tensor = None, + ) -> torch.Tensor: + window = torch.hann_window(self.win_length).to(audio.device) + stft = torch.stft(audio, self.n_fft, self.hop_length, window=window, return_complex=True) + + # whisper deletes the last frame by default (Shih-Lun) + magnitudes = stft[..., :-1].abs() ** 2 + if self.filters_path is not None: + filters = self.mel_filters(audio.device, self.n_mels, self.filters_path) + else: + filters = self.mel_filters(audio.device, self.n_mels) + mel_spec = filters @ magnitudes + + log_spec = torch.clamp(mel_spec, min=1e-10).log10() + + if ilens is not None: + olens = ilens // self.hop_length + else: + olens = None + + log_spec = torch.maximum( + log_spec, + log_spec.view(audio.size(0), -1).max(dim=-1)[0][:, None, None] - 8.0, + ) + log_spec = (log_spec + 4.0) / 4.0 + + return log_spec, olens + + def forward( + self, + input: torch.Tensor, + input_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + batch_size = input.size(0) + feats = [] + feats_lens = [] + input = input.to(torch.float32) + for i in range(batch_size): + if self.do_pad_trim: + feat = self.pad_or_trim(input[i], self.pad_samples) + else: + feat = input[i] + feat, feat_len = self.log_mel_spectrogram(feat[None, :], input_lengths[0]) + feats.append(feat[0]) + feats_lens.append(feat_len) + feats_lens = torch.as_tensor(feats_lens) + + if batch_size == 1: + feats_pad = feats[0][None, :, :] + else: + feats_pad = pad_sequence(feats, batch_first=True, padding_value=0.0) + if self.permute: + feats_pad = feats_pad.permute(0, 2, 1) + return feats_pad, feats_lens diff --git a/funasr/frontends/windowing.py b/funasr/frontends/windowing.py new file mode 100644 index 0000000..84ec8e2 --- /dev/null +++ b/funasr/frontends/windowing.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# 2020, Technische Universität München; Ludwig Kürzinger +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Sliding Window for raw audio input data.""" + +import torch +import torch.nn as nn +from typing import Tuple + + +class SlidingWindow(nn.Module): + """Sliding Window. + Provides a sliding window over a batched continuous raw audio tensor. + Optionally, provides padding (Currently not implemented). + Combine this module with a pre-encoder compatible with raw audio data, + for example Sinc convolutions. + Known issues: + Output length is calculated incorrectly if audio shorter than win_length. + WARNING: trailing values are discarded - padding not implemented yet. + There is currently no additional window function applied to input values. + """ + + def __init__( + self, + win_length: int = 400, + hop_length: int = 160, + channels: int = 1, + padding: int = None, + fs=None, + ): + """Initialize. + Args: + win_length: Length of frame. + hop_length: Relative starting point of next frame. + channels: Number of input channels. + padding: Padding (placeholder, currently not implemented). + fs: Sampling rate (placeholder for compatibility, not used). + """ + super().__init__() + self.fs = fs + self.win_length = win_length + self.hop_length = hop_length + self.channels = channels + self.padding = padding + + def forward( + self, input: torch.Tensor, input_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Apply a sliding window on the input. + Args: + input: Input (B, T, C*D) or (B, T*C*D), with D=C=1. + input_lengths: Input lengths within batch. + Returns: + Tensor: Output with dimensions (B, T, C, D), with D=win_length. + Tensor: Output lengths within batch. + """ + input_size = input.size() + B = input_size[0] + T = input_size[1] + C = self.channels + D = self.win_length + # (B, T, C) --> (T, B, C) + continuous = input.view(B, T, C).permute(1, 0, 2) + windowed = continuous.unfold(0, D, self.hop_length) + # (T, B, C, D) --> (B, T, C, D) + output = windowed.permute(1, 0, 2, 3).contiguous() + # After unfold(), windowed lengths change: + output_lengths = (input_lengths - self.win_length) // self.hop_length + 1 + return output, output_lengths + + def output_size(self) -> int: + """Return output length of feature dimension D, i.e. the window length.""" + return self.win_length diff --git a/funasr/losses/__init__.py b/funasr/losses/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/losses/label_smoothing_loss.py b/funasr/losses/label_smoothing_loss.py new file mode 100644 index 0000000..ffc38da --- /dev/null +++ b/funasr/losses/label_smoothing_loss.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Label smoothing module.""" + +import torch +from torch import nn +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class LabelSmoothingLoss(nn.Module): + """Label-smoothing loss. + + :param int size: the number of class + :param int padding_idx: ignored class id + :param float smoothing: smoothing rate (0.0 means the conventional CE) + :param bool normalize_length: normalize loss by sequence length if True + :param torch.nn.Module criterion: loss function to be smoothed + """ + + def __init__( + self, + size, + padding_idx, + smoothing, + normalize_length=False, + criterion=nn.KLDivLoss(reduction="none"), + ): + """Construct an LabelSmoothingLoss object.""" + super(LabelSmoothingLoss, self).__init__() + self.criterion = criterion + self.padding_idx = padding_idx + self.confidence = 1.0 - smoothing + self.smoothing = smoothing + self.size = size + self.true_dist = None + self.normalize_length = normalize_length + + def forward(self, x, target): + """Compute loss between x and target. + + :param torch.Tensor x: prediction (batch, seqlen, class) + :param torch.Tensor target: + target signal masked with self.padding_id (batch, seqlen) + :return: scalar float value + :rtype torch.Tensor + """ + assert x.size(2) == self.size + batch_size = x.size(0) + x = x.contiguous().view(-1, self.size) + target = target.contiguous().view(-1) + with torch.no_grad(): + true_dist = x.clone() + true_dist.fill_(self.smoothing / (self.size - 1)) + ignore = target == self.padding_idx # (B,) + total = len(target) - ignore.sum().item() + target = target.masked_fill(ignore, 0) # avoid -1 index + true_dist.scatter_(1, target.unsqueeze(1), self.confidence) + kl = self.criterion(torch.log_softmax(x, dim=1), true_dist) + denom = total if self.normalize_length else batch_size + return kl.masked_fill(ignore.unsqueeze(1), 0).sum() / denom + + +class SequenceBinaryCrossEntropy(nn.Module): + def __init__(self, normalize_length=False, criterion=nn.BCEWithLogitsLoss(reduction="none")): + super().__init__() + self.normalize_length = normalize_length + self.criterion = criterion + + def forward(self, pred, label, lengths): + pad_mask = make_pad_mask(lengths, maxlen=pred.shape[1]).to(pred.device) + loss = self.criterion(pred, label) + denom = (~pad_mask).sum() if self.normalize_length else pred.shape[0] + return loss.masked_fill(pad_mask.unsqueeze(-1), 0).sum() / denom + + +class NllLoss(nn.Module): + """Nll loss. + + :param int size: the number of class + :param int padding_idx: ignored class id + :param bool normalize_length: normalize loss by sequence length if True + :param torch.nn.Module criterion: loss function + """ + + def __init__( + self, + size, + padding_idx, + normalize_length=False, + criterion=nn.NLLLoss(reduction="none"), + ): + """Construct an NllLoss object.""" + super(NllLoss, self).__init__() + self.criterion = criterion + self.padding_idx = padding_idx + self.size = size + self.true_dist = None + self.normalize_length = normalize_length + + def forward(self, x, target): + """Compute loss between x and target. + + :param torch.Tensor x: prediction (batch, seqlen, class) + :param torch.Tensor target: + target signal masked with self.padding_id (batch, seqlen) + :return: scalar float value + :rtype torch.Tensor + """ + assert x.size(2) == self.size + batch_size = x.size(0) + x = x.view(-1, self.size) + target = target.view(-1) + with torch.no_grad(): + ignore = target == self.padding_idx # (B,) + total = len(target) - ignore.sum().item() + target = target.masked_fill(ignore, 0) # avoid -1 index + kl = self.criterion(x, target) + denom = total if self.normalize_length else batch_size + return kl.masked_fill(ignore, 0).sum() / denom diff --git a/funasr/metrics/__init__.py b/funasr/metrics/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/metrics/common.py b/funasr/metrics/common.py new file mode 100644 index 0000000..2443e0d --- /dev/null +++ b/funasr/metrics/common.py @@ -0,0 +1,245 @@ +#!/usr/bin/env python3 +# encoding: utf-8 + +# Copyright 2017 Johns Hopkins University (Shinji Watanabe) +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Common functions for ASR.""" + +import json +import logging +import sys + +from itertools import groupby +import numpy as np +import six + + +def end_detect(ended_hyps, i, M=3, D_end=np.log(1 * np.exp(-10))): + """End detection. + + described in Eq. (50) of S. Watanabe et al + "Hybrid CTC/Attention Architecture for End-to-End Speech Recognition" + + :param ended_hyps: + :param i: + :param M: + :param D_end: + :return: + """ + if len(ended_hyps) == 0: + return False + count = 0 + best_hyp = sorted(ended_hyps, key=lambda x: x["score"], reverse=True)[0] + for m in six.moves.range(M): + # get ended_hyps with their length is i - m + hyp_length = i - m + hyps_same_length = [x for x in ended_hyps if len(x["yseq"]) == hyp_length] + if len(hyps_same_length) > 0: + best_hyp_same_length = sorted(hyps_same_length, key=lambda x: x["score"], reverse=True)[ + 0 + ] + if best_hyp_same_length["score"] - best_hyp["score"] < D_end: + count += 1 + + if count == M: + return True + else: + return False + + +# TODO(takaaki-hori): add different smoothing methods +def label_smoothing_dist(odim, lsm_type, transcript=None, blank=0): + """Obtain label distribution for loss smoothing. + + :param odim: + :param lsm_type: + :param blank: + :param transcript: + :return: + """ + if transcript is not None: + with open(transcript, "rb") as f: + trans_json = json.load(f)["utts"] + + if lsm_type == "unigram": + assert transcript is not None, "transcript is required for %s label smoothing" % lsm_type + labelcount = np.zeros(odim) + for k, v in trans_json.items(): + ids = np.array([int(n) for n in v["output"][0]["tokenid"].split()]) + # to avoid an error when there is no text in an uttrance + if len(ids) > 0: + labelcount[ids] += 1 + labelcount[odim - 1] = len(transcript) # count + labelcount[labelcount == 0] = 1 # flooring + labelcount[blank] = 0 # remove counts for blank + labeldist = labelcount.astype(np.float32) / np.sum(labelcount) + else: + logging.error("Error: unexpected label smoothing type: %s" % lsm_type) + sys.exit() + + return labeldist + + +def get_vgg2l_odim(idim, in_channel=3, out_channel=128): + """Return the output size of the VGG frontend. + + :param in_channel: input channel size + :param out_channel: output channel size + :return: output size + :rtype int + """ + idim = idim / in_channel + idim = np.ceil(np.array(idim, dtype=np.float32) / 2) # 1st max pooling + idim = np.ceil(np.array(idim, dtype=np.float32) / 2) # 2nd max pooling + return int(idim) * out_channel # numer of channels + + +class ErrorCalculator(object): + """Calculate CER and WER for E2E_ASR and CTC models during training. + + :param y_hats: numpy array with predicted text + :param y_pads: numpy array with true (target) text + :param char_list: + :param sym_space: + :param sym_blank: + :return: + """ + + def __init__(self, char_list, sym_space, sym_blank, report_cer=False, report_wer=False): + """Construct an ErrorCalculator object.""" + super(ErrorCalculator, self).__init__() + + self.report_cer = report_cer + self.report_wer = report_wer + + self.char_list = char_list + self.space = sym_space + self.blank = sym_blank + self.idx_blank = self.char_list.index(self.blank) + if self.space in self.char_list: + self.idx_space = self.char_list.index(self.space) + else: + self.idx_space = None + + def __call__(self, ys_hat, ys_pad, is_ctc=False): + """Calculate sentence-level WER/CER score. + + :param torch.Tensor ys_hat: prediction (batch, seqlen) + :param torch.Tensor ys_pad: reference (batch, seqlen) + :param bool is_ctc: calculate CER score for CTC + :return: sentence-level WER score + :rtype float + :return: sentence-level CER score + :rtype float + """ + cer, wer = None, None + if is_ctc: + return self.calculate_cer_ctc(ys_hat, ys_pad) + elif not self.report_cer and not self.report_wer: + return cer, wer + + seqs_hat, seqs_true = self.convert_to_char(ys_hat, ys_pad) + if self.report_cer: + cer = self.calculate_cer(seqs_hat, seqs_true) + + if self.report_wer: + wer = self.calculate_wer(seqs_hat, seqs_true) + return cer, wer + + def calculate_cer_ctc(self, ys_hat, ys_pad): + """Calculate sentence-level CER score for CTC. + + :param torch.Tensor ys_hat: prediction (batch, seqlen) + :param torch.Tensor ys_pad: reference (batch, seqlen) + :return: average sentence-level CER score + :rtype float + """ + import editdistance + + cers, char_ref_lens = [], [] + for i, y in enumerate(ys_hat): + y_hat = [x[0] for x in groupby(y)] + y_true = ys_pad[i] + seq_hat, seq_true = [], [] + for idx in y_hat: + idx = int(idx) + if idx != -1 and idx != self.idx_blank and idx != self.idx_space: + seq_hat.append(self.char_list[int(idx)]) + + for idx in y_true: + idx = int(idx) + if idx != -1 and idx != self.idx_blank and idx != self.idx_space: + seq_true.append(self.char_list[int(idx)]) + + hyp_chars = "".join(seq_hat) + ref_chars = "".join(seq_true) + if len(ref_chars) > 0: + cers.append(editdistance.eval(hyp_chars, ref_chars)) + char_ref_lens.append(len(ref_chars)) + + cer_ctc = float(sum(cers)) / sum(char_ref_lens) if cers else None + return cer_ctc + + def convert_to_char(self, ys_hat, ys_pad): + """Convert index to character. + + :param torch.Tensor seqs_hat: prediction (batch, seqlen) + :param torch.Tensor seqs_true: reference (batch, seqlen) + :return: token list of prediction + :rtype list + :return: token list of reference + :rtype list + """ + seqs_hat, seqs_true = [], [] + for i, y_hat in enumerate(ys_hat): + y_true = ys_pad[i] + eos_true = np.where(y_true == -1)[0] + ymax = eos_true[0] if len(eos_true) > 0 else len(y_true) + # NOTE: padding index (-1) in y_true is used to pad y_hat + seq_hat = [self.char_list[int(idx)] for idx in y_hat[:ymax]] + seq_true = [self.char_list[int(idx)] for idx in y_true if int(idx) != -1] + seq_hat_text = "".join(seq_hat).replace(self.space, " ") + seq_hat_text = seq_hat_text.replace(self.blank, "") + seq_true_text = "".join(seq_true).replace(self.space, " ") + seqs_hat.append(seq_hat_text) + seqs_true.append(seq_true_text) + return seqs_hat, seqs_true + + def calculate_cer(self, seqs_hat, seqs_true): + """Calculate sentence-level CER score. + + :param list seqs_hat: prediction + :param list seqs_true: reference + :return: average sentence-level CER score + :rtype float + """ + import editdistance + + char_eds, char_ref_lens = [], [] + for i, seq_hat_text in enumerate(seqs_hat): + seq_true_text = seqs_true[i] + hyp_chars = seq_hat_text.replace(" ", "") + ref_chars = seq_true_text.replace(" ", "") + char_eds.append(editdistance.eval(hyp_chars, ref_chars)) + char_ref_lens.append(len(ref_chars)) + return float(sum(char_eds)) / sum(char_ref_lens) + + def calculate_wer(self, seqs_hat, seqs_true): + """Calculate sentence-level WER score. + + :param list seqs_hat: prediction + :param list seqs_true: reference + :return: average sentence-level WER score + :rtype float + """ + import editdistance + + word_eds, word_ref_lens = [], [] + for i, seq_hat_text in enumerate(seqs_hat): + seq_true_text = seqs_true[i] + hyp_words = seq_hat_text.split() + ref_words = seq_true_text.split() + word_eds.append(editdistance.eval(hyp_words, ref_words)) + word_ref_lens.append(len(ref_words)) + return float(sum(word_eds)) / sum(word_ref_lens) diff --git a/funasr/metrics/compute_acc.py b/funasr/metrics/compute_acc.py new file mode 100644 index 0000000..8345866 --- /dev/null +++ b/funasr/metrics/compute_acc.py @@ -0,0 +1,40 @@ +import torch + + +def th_accuracy(pad_outputs, pad_targets, ignore_label): + """Calculate accuracy. + + Args: + pad_outputs (Tensor): Prediction tensors (B * Lmax, D). + pad_targets (LongTensor): Target label tensors (B, Lmax, D). + ignore_label (int): Ignore label id. + + Returns: + float: Accuracy value (0.0 - 1.0). + + """ + pad_pred = pad_outputs.view( + pad_targets.size(0), pad_targets.size(1), pad_outputs.size(1) + ).argmax(2) + mask = pad_targets != ignore_label + numerator = torch.sum(pad_pred.masked_select(mask) == pad_targets.masked_select(mask)) + denominator = torch.sum(mask) + return float(numerator) / float(denominator) + + +def compute_accuracy(pad_outputs, pad_targets, ignore_label): + """Calculate accuracy. + + Args: + pad_outputs (LongTensor): Prediction tensors (B, Lmax). + pad_targets (LongTensor): Target label tensors (B, Lmax). + ignore_label (int): Ignore label id. + + Returns: + float: Accuracy value (0.0 - 1.0). + + """ + mask = pad_targets != ignore_label + numerator = torch.sum(pad_outputs.masked_select(mask) == pad_targets.masked_select(mask)) + denominator = torch.sum(mask) + return numerator.float() / denominator.float() # (FIX:MZY):return torch.Tensor type diff --git a/funasr/metrics/compute_eer.py b/funasr/metrics/compute_eer.py new file mode 100644 index 0000000..5180b16 --- /dev/null +++ b/funasr/metrics/compute_eer.py @@ -0,0 +1,59 @@ +import numpy as np +from sklearn.metrics import roc_curve +import argparse + + +def _compute_eer(label, pred, positive_label=1): + """ + Python compute equal error rate (eer) + ONLY tested on binary classification + + :param label: ground-truth label, should be a 1-d list or np.array, each element represents the ground-truth label of one sample + :param pred: model prediction, should be a 1-d list or np.array, each element represents the model prediction of one sample + :param positive_label: the class that is viewed as positive class when computing EER + :return: equal error rate (EER) + """ + + # all fpr, tpr, fnr, fnr, threshold are lists (in the format of np.array) + fpr, tpr, threshold = roc_curve(label, pred, pos_label=positive_label) + fnr = 1 - tpr + + # the threshold of fnr == fpr + eer_threshold = threshold[np.nanargmin(np.absolute((fnr - fpr)))] + + # theoretically eer from fpr and eer from fnr should be identical but they can be slightly differ in reality + eer_1 = fpr[np.nanargmin(np.absolute((fnr - fpr)))] + eer_2 = fnr[np.nanargmin(np.absolute((fnr - fpr)))] + + # return the mean of eer from fpr and from fnr + eer = (eer_1 + eer_2) / 2 + return eer, eer_threshold + + +def compute_eer(trials_path, scores_path): + labels = [] + for one_line in open(trials_path, "r"): + labels.append(one_line.strip().rsplit(" ", 1)[-1] == "target") + labels = np.array(labels, dtype=int) + + scores = [] + for one_line in open(scores_path, "r"): + scores.append(float(one_line.strip().rsplit(" ", 1)[-1])) + scores = np.array(scores, dtype=float) + + eer, threshold = _compute_eer(labels, scores) + return eer, threshold + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("trials", help="trial list") + parser.add_argument("scores", help="score file, normalized to [0, 1]") + args = parser.parse_args() + + eer, threshold = compute_eer(args.trials, args.scores) + print("EER is {:.4f} at threshold {:.4f}".format(eer * 100.0, threshold)) + + +if __name__ == "__main__": + main() diff --git a/funasr/metrics/compute_min_dcf.py b/funasr/metrics/compute_min_dcf.py new file mode 100644 index 0000000..472f7b3 --- /dev/null +++ b/funasr/metrics/compute_min_dcf.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python3 +# Copyright 2018 David Snyder +# Apache 2.0 + +# This script computes the minimum detection cost function, which is a common +# error metric used in speaker recognition. Compared to equal error-rate, +# which assigns equal weight to false negatives and false positives, this +# error-rate is usually used to assess performance in settings where achieving +# a low false positive rate is more important than achieving a low false +# negative rate. See the NIST 2016 Speaker Recognition Evaluation Plan at +# https://www.nist.gov/sites/default/files/documents/2016/10/07/sre16_eval_plan_v1.3.pdf +# for more details about the metric. +from __future__ import print_function +from operator import itemgetter +import sys, argparse, os + + +def GetArgs(): + parser = argparse.ArgumentParser( + description="Compute the minimum " + "detection cost function along with the threshold at which it occurs. " + "Usage: sid/compute_min_dcf.py [options...] " + " " + "E.g., sid/compute_min_dcf.py --p-target 0.01 --c-miss 1 --c-fa 1 " + "exp/scores/trials data/test/trials", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.add_argument( + "--p-target", + type=float, + dest="p_target", + default=0.01, + help="The prior probability of the target speaker in a trial.", + ) + parser.add_argument( + "--c-miss", + type=float, + dest="c_miss", + default=1, + help="Cost of a missed detection. This is usually not changed.", + ) + parser.add_argument( + "--c-fa", + type=float, + dest="c_fa", + default=1, + help="Cost of a spurious detection. This is usually not changed.", + ) + parser.add_argument( + "scores_filename", + help="Input scores file, with columns of the form " " ", + ) + parser.add_argument( + "trials_filename", + help="Input trials file, with columns of the form " " ", + ) + sys.stderr.write(" ".join(sys.argv) + "\n") + args = parser.parse_args() + args = CheckArgs(args) + return args + + +def CheckArgs(args): + if args.c_fa <= 0: + raise Exception("--c-fa must be greater than 0") + if args.c_miss <= 0: + raise Exception("--c-miss must be greater than 0") + if args.p_target <= 0 or args.p_target >= 1: + raise Exception("--p-target must be greater than 0 and less than 1") + return args + + +# Creates a list of false-negative rates, a list of false-positive rates +# and a list of decision thresholds that give those error-rates. +def ComputeErrorRates(scores, labels): + + # Sort the scores from smallest to largest, and also get the corresponding + # indexes of the sorted scores. We will treat the sorted scores as the + # thresholds at which the the error-rates are evaluated. + sorted_indexes, thresholds = zip( + *sorted([(index, threshold) for index, threshold in enumerate(scores)], key=itemgetter(1)) + ) + labels = [labels[i] for i in sorted_indexes] + fns = [] + tns = [] + + # At the end of this loop, fns[i] is the number of errors made by + # incorrectly rejecting scores less than thresholds[i]. And, tns[i] + # is the total number of times that we have correctly rejected scores + # less than thresholds[i]. + for i in range(0, len(labels)): + if i == 0: + fns.append(labels[i]) + tns.append(1 - labels[i]) + else: + fns.append(fns[i - 1] + labels[i]) + tns.append(tns[i - 1] + 1 - labels[i]) + positives = sum(labels) + negatives = len(labels) - positives + + # Now divide the false negatives by the total number of + # positives to obtain the false negative rates across + # all thresholds + fnrs = [fn / float(positives) for fn in fns] + + # Divide the true negatives by the total number of + # negatives to get the true negative rate. Subtract these + # quantities from 1 to get the false positive rates. + fprs = [1 - tn / float(negatives) for tn in tns] + return fnrs, fprs, thresholds + + +# Computes the minimum of the detection cost function. The comments refer to +# equations in Section 3 of the NIST 2016 Speaker Recognition Evaluation Plan. +def ComputeMinDcf(fnrs, fprs, thresholds, p_target, c_miss, c_fa): + min_c_det = float("inf") + min_c_det_threshold = thresholds[0] + for i in range(0, len(fnrs)): + # See Equation (2). it is a weighted sum of false negative + # and false positive errors. + c_det = c_miss * fnrs[i] * p_target + c_fa * fprs[i] * (1 - p_target) + if c_det < min_c_det: + min_c_det = c_det + min_c_det_threshold = thresholds[i] + # See Equations (3) and (4). Now we normalize the cost. + c_def = min(c_miss * p_target, c_fa * (1 - p_target)) + min_dcf = min_c_det / c_def + return min_dcf, min_c_det_threshold + + +def compute_min_dcf(scores_filename, trials_filename, c_miss=1, c_fa=1, p_target=0.01): + scores_file = open(scores_filename, "r").readlines() + trials_file = open(trials_filename, "r").readlines() + c_miss = c_miss + c_fa = c_fa + p_target = p_target + + scores = [] + labels = [] + + trials = {} + for line in trials_file: + utt1, utt2, target = line.rstrip().split() + trial = utt1 + " " + utt2 + trials[trial] = target + + for line in scores_file: + utt1, utt2, score = line.rstrip().split() + trial = utt1 + " " + utt2 + if trial in trials: + scores.append(float(score)) + if trials[trial] == "target": + labels.append(1) + else: + labels.append(0) + else: + raise Exception("Missing entry for " + utt1 + " and " + utt2 + " " + scores_filename) + + fnrs, fprs, thresholds = ComputeErrorRates(scores, labels) + mindcf, threshold = ComputeMinDcf(fnrs, fprs, thresholds, p_target, c_miss, c_fa) + return mindcf, threshold + + +def main(): + args = GetArgs() + mindcf, threshold = compute_min_dcf( + args.scores_filename, args.trials_filename, args.c_miss, args.c_fa, args.p_target + ) + sys.stdout.write( + "minDCF is {0:.4f} at threshold {1:.4f} (p-target={2}, c-miss={3}, " + "c-fa={4})\n".format(mindcf, threshold, args.p_target, args.c_miss, args.c_fa) + ) + + +if __name__ == "__main__": + main() diff --git a/funasr/metrics/wer.py b/funasr/metrics/wer.py new file mode 100644 index 0000000..ab07bc2 --- /dev/null +++ b/funasr/metrics/wer.py @@ -0,0 +1,225 @@ +import os +import numpy as np +import sys +import hydra +from omegaconf import DictConfig, OmegaConf, ListConfig + + +def compute_wer( + ref_file, + hyp_file, + cer_file, + cn_postprocess=False, +): + rst = { + "Wrd": 0, + "Corr": 0, + "Ins": 0, + "Del": 0, + "Sub": 0, + "Snt": 0, + "Err": 0.0, + "S.Err": 0.0, + "wrong_words": 0, + "wrong_sentences": 0, + } + + hyp_dict = {} + ref_dict = {} + with open(hyp_file, "r") as hyp_reader: + for line in hyp_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + if cn_postprocess: + value = " ".join(value) + value = value.replace(" ", "") + if value[0] == "请": + value = value[1:] + value = [x for x in value] + hyp_dict[key] = value + with open(ref_file, "r") as ref_reader: + for line in ref_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + if cn_postprocess: + value = " ".join(value) + value = value.replace(" ", "") + value = [x for x in value] + ref_dict[key] = value + + cer_detail_writer = open(cer_file, "w") + for hyp_key in hyp_dict: + if hyp_key in ref_dict: + out_item = compute_wer_by_line(hyp_dict[hyp_key], ref_dict[hyp_key]) + rst["Wrd"] += out_item["nwords"] + rst["Corr"] += out_item["cor"] + rst["wrong_words"] += out_item["wrong"] + rst["Ins"] += out_item["ins"] + rst["Del"] += out_item["del"] + rst["Sub"] += out_item["sub"] + rst["Snt"] += 1 + if out_item["wrong"] > 0: + rst["wrong_sentences"] += 1 + cer_detail_writer.write(hyp_key + print_cer_detail(out_item) + "\n") + cer_detail_writer.write( + "ref:" + "\t" + " ".join(list(map(lambda x: x.lower(), ref_dict[hyp_key]))) + "\n" + ) + cer_detail_writer.write( + "hyp:" + "\t" + " ".join(list(map(lambda x: x.lower(), hyp_dict[hyp_key]))) + "\n" + ) + cer_detail_writer.flush() + + if rst["Wrd"] > 0: + rst["Err"] = round(rst["wrong_words"] * 100 / rst["Wrd"], 2) + if rst["Snt"] > 0: + rst["S.Err"] = round(rst["wrong_sentences"] * 100 / rst["Snt"], 2) + + cer_detail_writer.write("\n") + cer_detail_writer.write( + "%WER " + + str(rst["Err"]) + + " [ " + + str(rst["wrong_words"]) + + " / " + + str(rst["Wrd"]) + + ", " + + str(rst["Ins"]) + + " ins, " + + str(rst["Del"]) + + " del, " + + str(rst["Sub"]) + + " sub ]" + + "\n" + ) + cer_detail_writer.write( + "%SER " + + str(rst["S.Err"]) + + " [ " + + str(rst["wrong_sentences"]) + + " / " + + str(rst["Snt"]) + + " ]" + + "\n" + ) + cer_detail_writer.write( + "Scored " + + str(len(hyp_dict)) + + " sentences, " + + str(len(hyp_dict) - rst["Snt"]) + + " not present in hyp." + + "\n" + ) + + cer_detail_writer.close() + + +def compute_wer_by_line(hyp, ref): + hyp = list(map(lambda x: x.lower(), hyp)) + ref = list(map(lambda x: x.lower(), ref)) + + len_hyp = len(hyp) + len_ref = len(ref) + + cost_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int16) + + ops_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int8) + + for i in range(len_hyp + 1): + cost_matrix[i][0] = i + for j in range(len_ref + 1): + cost_matrix[0][j] = j + + for i in range(1, len_hyp + 1): + for j in range(1, len_ref + 1): + if hyp[i - 1] == ref[j - 1]: + cost_matrix[i][j] = cost_matrix[i - 1][j - 1] + else: + substitution = cost_matrix[i - 1][j - 1] + 1 + insertion = cost_matrix[i - 1][j] + 1 + deletion = cost_matrix[i][j - 1] + 1 + + compare_val = [substitution, insertion, deletion] + + min_val = min(compare_val) + operation_idx = compare_val.index(min_val) + 1 + cost_matrix[i][j] = min_val + ops_matrix[i][j] = operation_idx + + match_idx = [] + i = len_hyp + j = len_ref + rst = {"nwords": len_ref, "cor": 0, "wrong": 0, "ins": 0, "del": 0, "sub": 0} + while i >= 0 or j >= 0: + i_idx = max(0, i) + j_idx = max(0, j) + + if ops_matrix[i_idx][j_idx] == 0: # correct + if i - 1 >= 0 and j - 1 >= 0: + match_idx.append((j - 1, i - 1)) + rst["cor"] += 1 + + i -= 1 + j -= 1 + + elif ops_matrix[i_idx][j_idx] == 2: # insert + i -= 1 + rst["ins"] += 1 + + elif ops_matrix[i_idx][j_idx] == 3: # delete + j -= 1 + rst["del"] += 1 + + elif ops_matrix[i_idx][j_idx] == 1: # substitute + i -= 1 + j -= 1 + rst["sub"] += 1 + + if i < 0 and j >= 0: + rst["del"] += 1 + elif j < 0 and i >= 0: + rst["ins"] += 1 + + match_idx.reverse() + wrong_cnt = cost_matrix[len_hyp][len_ref] + rst["wrong"] = wrong_cnt + + return rst + + +def print_cer_detail(rst): + return ( + "(" + + "nwords=" + + str(rst["nwords"]) + + ",cor=" + + str(rst["cor"]) + + ",ins=" + + str(rst["ins"]) + + ",del=" + + str(rst["del"]) + + ",sub=" + + str(rst["sub"]) + + ") corr:" + + "{:.2%}".format(rst["cor"] / rst["nwords"]) + + ",cer:" + + "{:.2%}".format(rst["wrong"] / rst["nwords"]) + ) + + +@hydra.main(config_name=None, version_base=None) +def main_hydra(cfg: DictConfig): + ref_file = cfg.get("ref_file", None) + hyp_file = cfg.get("hyp_file", None) + cer_file = cfg.get("cer_file", None) + cn_postprocess = cfg.get("cn_postprocess", False) + if ref_file is None or hyp_file is None or cer_file is None: + print( + "usage : python -m funasr.metrics.wer ++ref_file=test.ref ++hyp_file=test.hyp ++cer_file=test.wer ++cn_postprocess=false" + ) + sys.exit(0) + + compute_wer(ref_file, hyp_file, cer_file, cn_postprocess) + + +if __name__ == "__main__": + main_hydra() diff --git a/funasr/models/__init__.py b/funasr/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/bat/__init__.py b/funasr/models/bat/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/bat/model.py b/funasr/models/bat/model.py new file mode 100644 index 0000000..ec22443 --- /dev/null +++ b/funasr/models/bat/model.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import time +import torch +import logging +from contextlib import contextmanager +from typing import Dict, Optional, Tuple +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.utils import postprocess_utils +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.transducer.model import Transducer +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.transformer.scorers.ctc import CTCPrefixScorer +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.transformer.scorers.length_bonus import LengthBonus +from funasr.models.transformer.utils.nets_utils import get_transducer_task_io +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.models.transducer.beam_search_transducer import BeamSearchTransducer + + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "BAT") # TODO: BAT training +class BAT(Transducer): + pass diff --git a/funasr/models/bicif_paraformer/__init__.py b/funasr/models/bicif_paraformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/bicif_paraformer/cif_predictor.py b/funasr/models/bicif_paraformer/cif_predictor.py new file mode 100644 index 0000000..88366e1 --- /dev/null +++ b/funasr/models/bicif_paraformer/cif_predictor.py @@ -0,0 +1,543 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch + +from funasr.register import tables +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class mae_loss(torch.nn.Module): + + def __init__(self, normalize_length=False): + super(mae_loss, self).__init__() + self.normalize_length = normalize_length + self.criterion = torch.nn.L1Loss(reduction="sum") + + def forward(self, token_length, pre_token_length): + loss_token_normalizer = token_length.size(0) + if self.normalize_length: + loss_token_normalizer = token_length.sum().type(torch.float32) + loss = self.criterion(token_length, pre_token_length) + loss = loss / loss_token_normalizer + return loss + + +def cif(hidden, alphas, threshold): + batch_size, len_time, hidden_size = hidden.size() + + # loop varss + integrate = torch.zeros([batch_size], device=hidden.device) + frame = torch.zeros([batch_size, hidden_size], device=hidden.device) + # intermediate vars along time + list_fires = [] + list_frames = [] + + for t in range(len_time): + alpha = alphas[:, t] + distribution_completion = torch.ones([batch_size], device=hidden.device) - integrate + + integrate += alpha + list_fires.append(integrate) + + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, integrate - torch.ones([batch_size], device=hidden.device), integrate + ) + cur = torch.where(fire_place, distribution_completion, alpha) + remainds = alpha - cur + + frame += cur[:, None] * hidden[:, t, :] + list_frames.append(frame) + frame = torch.where( + fire_place[:, None].repeat(1, hidden_size), remainds[:, None] * hidden[:, t, :], frame + ) + + fires = torch.stack(list_fires, 1) + frames = torch.stack(list_frames, 1) + list_ls = [] + len_labels = torch.round(alphas.sum(-1)).int() + max_label_len = len_labels.max() + for b in range(batch_size): + fire = fires[b, :] + l = torch.index_select(frames[b, :, :], 0, torch.nonzero(fire >= threshold).squeeze()) + pad_l = torch.zeros([max_label_len - l.size(0), hidden_size], device=hidden.device) + list_ls.append(torch.cat([l, pad_l], 0)) + return torch.stack(list_ls, 0), fires + + +def cif_wo_hidden(alphas, threshold): + batch_size, len_time = alphas.size() + + # loop varss + integrate = torch.zeros([batch_size], device=alphas.device) + # intermediate vars along time + list_fires = [] + + for t in range(len_time): + alpha = alphas[:, t] + + integrate += alpha + list_fires.append(integrate) + + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, + integrate - torch.ones([batch_size], device=alphas.device) * threshold, + integrate, + ) + + fires = torch.stack(list_fires, 1) + return fires + + +@tables.register("predictor_classes", "CifPredictorV3") +class CifPredictorV3(torch.nn.Module): + def __init__( + self, + idim, + l_order, + r_order, + threshold=1.0, + dropout=0.1, + smooth_factor=1.0, + noise_threshold=0, + tail_threshold=0.0, + tf2torch_tensor_name_prefix_torch="predictor", + tf2torch_tensor_name_prefix_tf="seq2seq/cif", + smooth_factor2=1.0, + noise_threshold2=0, + upsample_times=5, + upsample_type="cnn", + use_cif1_cnn=True, + tail_mask=True, + ): + super(CifPredictorV3, self).__init__() + + self.pad = torch.nn.ConstantPad1d((l_order, r_order), 0) + self.cif_conv1d = torch.nn.Conv1d(idim, idim, l_order + r_order + 1) + self.cif_output = torch.nn.Linear(idim, 1) + self.dropout = torch.nn.Dropout(p=dropout) + self.threshold = threshold + self.smooth_factor = smooth_factor + self.noise_threshold = noise_threshold + self.tail_threshold = tail_threshold + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + + self.upsample_times = upsample_times + self.upsample_type = upsample_type + self.use_cif1_cnn = use_cif1_cnn + if self.upsample_type == "cnn": + self.upsample_cnn = torch.nn.ConvTranspose1d( + idim, idim, self.upsample_times, self.upsample_times + ) + self.cif_output2 = torch.nn.Linear(idim, 1) + elif self.upsample_type == "cnn_blstm": + self.upsample_cnn = torch.nn.ConvTranspose1d( + idim, idim, self.upsample_times, self.upsample_times + ) + self.blstm = torch.nn.LSTM( + idim, idim, 1, bias=True, batch_first=True, dropout=0.0, bidirectional=True + ) + self.cif_output2 = torch.nn.Linear(idim * 2, 1) + elif self.upsample_type == "cnn_attn": + self.upsample_cnn = torch.nn.ConvTranspose1d( + idim, idim, self.upsample_times, self.upsample_times + ) + from funasr.models.transformer.encoder import EncoderLayer as TransformerEncoderLayer + from funasr.models.transformer.attention import MultiHeadedAttention + from funasr.models.transformer.positionwise_feed_forward import PositionwiseFeedForward + + positionwise_layer_args = ( + idim, + idim * 2, + 0.1, + ) + self.self_attn = TransformerEncoderLayer( + idim, + MultiHeadedAttention(4, idim, 0.1), + PositionwiseFeedForward(*positionwise_layer_args), + 0.1, + True, # normalize_before, + False, # concat_after, + ) + self.cif_output2 = torch.nn.Linear(idim, 1) + self.smooth_factor2 = smooth_factor2 + self.noise_threshold2 = noise_threshold2 + + def forward( + self, + hidden, + target_label=None, + mask=None, + ignore_id=-1, + mask_chunk_predictor=None, + target_label_length=None, + ): + h = hidden + context = h.transpose(1, 2) + queries = self.pad(context) + output = torch.relu(self.cif_conv1d(queries)) + + # alphas2 is an extra head for timestamp prediction + if not self.use_cif1_cnn: + _output = context + else: + _output = output + if self.upsample_type == "cnn": + output2 = self.upsample_cnn(_output) + output2 = output2.transpose(1, 2) + elif self.upsample_type == "cnn_blstm": + output2 = self.upsample_cnn(_output) + output2 = output2.transpose(1, 2) + output2, (_, _) = self.blstm(output2) + elif self.upsample_type == "cnn_attn": + output2 = self.upsample_cnn(_output) + output2 = output2.transpose(1, 2) + output2, _ = self.self_attn(output2, mask) + # import pdb; pdb.set_trace() + alphas2 = torch.sigmoid(self.cif_output2(output2)) + alphas2 = torch.nn.functional.relu(alphas2 * self.smooth_factor2 - self.noise_threshold2) + # repeat the mask in T demension to match the upsampled length + if mask is not None: + mask2 = ( + mask.repeat(1, self.upsample_times, 1) + .transpose(-1, -2) + .reshape(alphas2.shape[0], -1) + ) + mask2 = mask2.unsqueeze(-1) + alphas2 = alphas2 * mask2 + alphas2 = alphas2.squeeze(-1) + token_num2 = alphas2.sum(-1) + + output = output.transpose(1, 2) + + output = self.cif_output(output) + alphas = torch.sigmoid(output) + alphas = torch.nn.functional.relu(alphas * self.smooth_factor - self.noise_threshold) + if mask is not None: + mask = mask.transpose(-1, -2).float() + alphas = alphas * mask + if mask_chunk_predictor is not None: + alphas = alphas * mask_chunk_predictor + alphas = alphas.squeeze(-1) + mask = mask.squeeze(-1) + if target_label_length is not None: + target_length = target_label_length + elif target_label is not None: + target_length = (target_label != ignore_id).float().sum(-1) + else: + target_length = None + token_num = alphas.sum(-1) + + if target_length is not None: + alphas *= (target_length / token_num)[:, None].repeat(1, alphas.size(1)) + elif self.tail_threshold > 0.0: + hidden, alphas, token_num = self.tail_process_fn(hidden, alphas, token_num, mask=mask) + + acoustic_embeds, cif_peak = cif(hidden, alphas, self.threshold) + if target_length is None and self.tail_threshold > 0.0: + token_num_int = torch.max(token_num).type(torch.int32).item() + acoustic_embeds = acoustic_embeds[:, :token_num_int, :] + return acoustic_embeds, token_num, alphas, cif_peak, token_num2 + + def get_upsample_timestamp(self, hidden, mask=None, token_num=None): + h = hidden + b = hidden.shape[0] + context = h.transpose(1, 2) + queries = self.pad(context) + output = torch.relu(self.cif_conv1d(queries)) + + # alphas2 is an extra head for timestamp prediction + if not self.use_cif1_cnn: + _output = context + else: + _output = output + if self.upsample_type == "cnn": + output2 = self.upsample_cnn(_output) + output2 = output2.transpose(1, 2) + elif self.upsample_type == "cnn_blstm": + output2 = self.upsample_cnn(_output) + output2 = output2.transpose(1, 2) + output2, (_, _) = self.blstm(output2) + elif self.upsample_type == "cnn_attn": + output2 = self.upsample_cnn(_output) + output2 = output2.transpose(1, 2) + output2, _ = self.self_attn(output2, mask) + alphas2 = torch.sigmoid(self.cif_output2(output2)) + alphas2 = torch.nn.functional.relu(alphas2 * self.smooth_factor2 - self.noise_threshold2) + # repeat the mask in T demension to match the upsampled length + if mask is not None: + mask2 = ( + mask.repeat(1, self.upsample_times, 1) + .transpose(-1, -2) + .reshape(alphas2.shape[0], -1) + ) + mask2 = mask2.unsqueeze(-1) + alphas2 = alphas2 * mask2 + alphas2 = alphas2.squeeze(-1) + _token_num = alphas2.sum(-1) + if token_num is not None: + alphas2 *= (token_num / _token_num)[:, None].repeat(1, alphas2.size(1)) + # re-downsample + ds_alphas = alphas2.reshape(b, -1, self.upsample_times).sum(-1) + ds_cif_peak = cif_wo_hidden(ds_alphas, self.threshold - 1e-4) + # upsampled alphas and cif_peak + us_alphas = alphas2 + us_cif_peak = cif_wo_hidden(us_alphas, self.threshold - 1e-4) + return ds_alphas, ds_cif_peak, us_alphas, us_cif_peak + + def tail_process_fn(self, hidden, alphas, token_num=None, mask=None): + b, t, d = hidden.size() + tail_threshold = self.tail_threshold + if mask is not None: + zeros_t = torch.zeros((b, 1), dtype=torch.float32, device=alphas.device) + ones_t = torch.ones_like(zeros_t) + mask_1 = torch.cat([mask, zeros_t], dim=1) + mask_2 = torch.cat([ones_t, mask], dim=1) + mask = mask_2 - mask_1 + tail_threshold = mask * tail_threshold + alphas = torch.cat([alphas, zeros_t], dim=1) + alphas = torch.add(alphas, tail_threshold) + else: + tail_threshold = torch.tensor([tail_threshold], dtype=alphas.dtype).to(alphas.device) + tail_threshold = torch.reshape(tail_threshold, (1, 1)) + alphas = torch.cat([alphas, tail_threshold], dim=1) + zeros = torch.zeros((b, 1, d), dtype=hidden.dtype).to(hidden.device) + hidden = torch.cat([hidden, zeros], dim=1) + token_num = alphas.sum(dim=-1) + token_num_floor = torch.floor(token_num) + + return hidden, alphas, token_num_floor + + def gen_frame_alignments( + self, alphas: torch.Tensor = None, encoder_sequence_length: torch.Tensor = None + ): + batch_size, maximum_length = alphas.size() + int_type = torch.int32 + + is_training = self.training + if is_training: + token_num = torch.round(torch.sum(alphas, dim=1)).type(int_type) + else: + token_num = torch.floor(torch.sum(alphas, dim=1)).type(int_type) + + max_token_num = torch.max(token_num).item() + + alphas_cumsum = torch.cumsum(alphas, dim=1) + alphas_cumsum = torch.floor(alphas_cumsum).type(int_type) + alphas_cumsum = alphas_cumsum[:, None, :].repeat(1, max_token_num, 1) + + index = torch.ones([batch_size, max_token_num], dtype=int_type) + index = torch.cumsum(index, dim=1) + index = index[:, :, None].repeat(1, 1, maximum_length).to(alphas_cumsum.device) + + index_div = torch.floor(torch.true_divide(alphas_cumsum, index)).type(int_type) + index_div_bool_zeros = index_div.eq(0) + index_div_bool_zeros_count = torch.sum(index_div_bool_zeros, dim=-1) + 1 + index_div_bool_zeros_count = torch.clamp( + index_div_bool_zeros_count, 0, encoder_sequence_length.max() + ) + token_num_mask = (~make_pad_mask(token_num, maxlen=max_token_num)).to(token_num.device) + index_div_bool_zeros_count *= token_num_mask + + index_div_bool_zeros_count_tile = index_div_bool_zeros_count[:, :, None].repeat( + 1, 1, maximum_length + ) + ones = torch.ones_like(index_div_bool_zeros_count_tile) + zeros = torch.zeros_like(index_div_bool_zeros_count_tile) + ones = torch.cumsum(ones, dim=2) + cond = index_div_bool_zeros_count_tile == ones + index_div_bool_zeros_count_tile = torch.where(cond, zeros, ones) + + index_div_bool_zeros_count_tile_bool = index_div_bool_zeros_count_tile.type(torch.bool) + index_div_bool_zeros_count_tile = 1 - index_div_bool_zeros_count_tile_bool.type(int_type) + index_div_bool_zeros_count_tile_out = torch.sum(index_div_bool_zeros_count_tile, dim=1) + index_div_bool_zeros_count_tile_out = index_div_bool_zeros_count_tile_out.type(int_type) + predictor_mask = ( + (~make_pad_mask(encoder_sequence_length, maxlen=encoder_sequence_length.max())) + .type(int_type) + .to(encoder_sequence_length.device) + ) + index_div_bool_zeros_count_tile_out = index_div_bool_zeros_count_tile_out * predictor_mask + + predictor_alignments = index_div_bool_zeros_count_tile_out + predictor_alignments_length = predictor_alignments.sum(-1).type( + encoder_sequence_length.dtype + ) + return predictor_alignments.detach(), predictor_alignments_length.detach() + + +@tables.register("predictor_classes", "CifPredictorV3Export") +class CifPredictorV3Export(torch.nn.Module): + def __init__(self, model, **kwargs): + super().__init__() + + self.pad = model.pad + self.cif_conv1d = model.cif_conv1d + self.cif_output = model.cif_output + self.threshold = model.threshold + self.smooth_factor = model.smooth_factor + self.noise_threshold = model.noise_threshold + self.tail_threshold = model.tail_threshold + + self.upsample_times = model.upsample_times + self.upsample_cnn = model.upsample_cnn + self.blstm = model.blstm + self.cif_output2 = model.cif_output2 + self.smooth_factor2 = model.smooth_factor2 + self.noise_threshold2 = model.noise_threshold2 + + def forward( + self, + hidden: torch.Tensor, + mask: torch.Tensor, + ): + h = hidden + context = h.transpose(1, 2) + queries = self.pad(context) + output = torch.relu(self.cif_conv1d(queries)) + output = output.transpose(1, 2) + + output = self.cif_output(output) + alphas = torch.sigmoid(output) + alphas = torch.nn.functional.relu(alphas * self.smooth_factor - self.noise_threshold) + mask = mask.transpose(-1, -2).float() + alphas = alphas * mask + alphas = alphas.squeeze(-1) + token_num = alphas.sum(-1) + + mask = mask.squeeze(-1) + hidden, alphas, token_num = self.tail_process_fn(hidden, alphas, mask=mask) + acoustic_embeds, cif_peak = cif_export(hidden, alphas, self.threshold) + + return acoustic_embeds, token_num, alphas, cif_peak + + def get_upsample_timestmap(self, hidden, mask=None, token_num=None): + h = hidden + b = hidden.shape[0] + context = h.transpose(1, 2) + + # generate alphas2 + _output = context + output2 = self.upsample_cnn(_output) + output2 = output2.transpose(1, 2) + output2, (_, _) = self.blstm(output2) + alphas2 = torch.sigmoid(self.cif_output2(output2)) + alphas2 = torch.nn.functional.relu(alphas2 * self.smooth_factor2 - self.noise_threshold2) + + mask = ( + mask.repeat(1, self.upsample_times, 1).transpose(-1, -2).reshape(alphas2.shape[0], -1) + ) + mask = mask.unsqueeze(-1) + alphas2 = alphas2 * mask + alphas2 = alphas2.squeeze(-1) + _token_num = alphas2.sum(-1) + alphas2 *= (token_num / _token_num)[:, None].repeat(1, alphas2.size(1)) + # upsampled alphas and cif_peak + us_alphas = alphas2 + us_cif_peak = cif_wo_hidden_export(us_alphas, self.threshold - 1e-4) + return us_alphas, us_cif_peak + + def tail_process_fn(self, hidden, alphas, token_num=None, mask=None): + b, t, d = hidden.size() + tail_threshold = self.tail_threshold + + zeros_t = torch.zeros((b, 1), dtype=torch.float32, device=alphas.device) + ones_t = torch.ones_like(zeros_t) + + mask_1 = torch.cat([mask, zeros_t], dim=1) + mask_2 = torch.cat([ones_t, mask], dim=1) + mask = mask_2 - mask_1 + tail_threshold = mask * tail_threshold + alphas = torch.cat([alphas, zeros_t], dim=1) + alphas = torch.add(alphas, tail_threshold) + + zeros = torch.zeros((b, 1, d), dtype=hidden.dtype).to(hidden.device) + hidden = torch.cat([hidden, zeros], dim=1) + token_num = alphas.sum(dim=-1) + token_num_floor = torch.floor(token_num) + + return hidden, alphas, token_num_floor + + +@torch.jit.script +def cif_export(hidden, alphas, threshold: float): + batch_size, len_time, hidden_size = hidden.size() + threshold = torch.tensor([threshold], dtype=alphas.dtype).to(alphas.device) + + # loop varss + integrate = torch.zeros([batch_size], dtype=alphas.dtype, device=hidden.device) + frame = torch.zeros([batch_size, hidden_size], dtype=hidden.dtype, device=hidden.device) + # intermediate vars along time + list_fires = [] + list_frames = [] + + for t in range(len_time): + alpha = alphas[:, t] + distribution_completion = ( + torch.ones([batch_size], dtype=alphas.dtype, device=hidden.device) - integrate + ) + + integrate += alpha + list_fires.append(integrate) + + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, + integrate - torch.ones([batch_size], dtype=alphas.dtype, device=hidden.device), + integrate, + ) + cur = torch.where(fire_place, distribution_completion, alpha) + remainds = alpha - cur + + frame += cur[:, None] * hidden[:, t, :] + list_frames.append(frame) + frame = torch.where( + fire_place[:, None].repeat(1, hidden_size), remainds[:, None] * hidden[:, t, :], frame + ) + + fires = torch.stack(list_fires, 1) + frames = torch.stack(list_frames, 1) + + fire_idxs = fires >= threshold + frame_fires = torch.zeros_like(hidden) + max_label_len = frames[0, fire_idxs[0]].size(0) + for b in range(batch_size): + frame_fire = frames[b, fire_idxs[b]] + frame_len = frame_fire.size(0) + frame_fires[b, :frame_len, :] = frame_fire + + if frame_len >= max_label_len: + max_label_len = frame_len + frame_fires = frame_fires[:, :max_label_len, :] + return frame_fires, fires + + +@torch.jit.script +def cif_wo_hidden_export(alphas, threshold: float): + batch_size, len_time = alphas.size() + + # loop varss + integrate = torch.zeros([batch_size], dtype=alphas.dtype, device=alphas.device) + # intermediate vars along time + list_fires = [] + + for t in range(len_time): + alpha = alphas[:, t] + + integrate += alpha + list_fires.append(integrate) + + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, + integrate - torch.ones([batch_size], device=alphas.device) * threshold, + integrate, + ) + + fires = torch.stack(list_fires, 1) + return fires diff --git a/funasr/models/bicif_paraformer/export_meta.py b/funasr/models/bicif_paraformer/export_meta.py new file mode 100644 index 0000000..e9d0a25 --- /dev/null +++ b/funasr/models/bicif_paraformer/export_meta.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import types + +from funasr.register import tables + + +def export_rebuild_model(model, **kwargs): + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + predictor_class = tables.predictor_classes.get(kwargs["predictor"] + "Export") + model.predictor = predictor_class(model.predictor, onnx=is_onnx) + + decoder_class = tables.decoder_classes.get(kwargs["decoder"] + "Export") + model.decoder = decoder_class(model.decoder, onnx=is_onnx) + + from funasr.utils.torch_function import sequence_mask + + model.make_pad_mask = sequence_mask(kwargs["max_seq_len"], flip=False) + + model.forward = types.MethodType(export_forward, model) + model.export_dummy_inputs = types.MethodType(export_dummy_inputs, model) + model.export_input_names = types.MethodType(export_input_names, model) + model.export_output_names = types.MethodType(export_output_names, model) + model.export_dynamic_axes = types.MethodType(export_dynamic_axes, model) + model.export_name = types.MethodType(export_name, model) + + return model + + +def export_forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, +): + # a. To device + batch = {"speech": speech, "speech_lengths": speech_lengths} + + enc, enc_len = self.encoder(**batch) + mask = self.make_pad_mask(enc_len)[:, None, :] + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = self.predictor(enc, mask) + pre_token_length = pre_token_length.round().type(torch.int32) + + decoder_out, _ = self.decoder(enc, enc_len, pre_acoustic_embeds, pre_token_length) + decoder_out = torch.log_softmax(decoder_out, dim=-1) + + # get predicted timestamps + us_alphas, us_cif_peak = self.predictor.get_upsample_timestmap(enc, mask, pre_token_length) + + return decoder_out, pre_token_length, us_alphas, us_cif_peak + + +def export_dummy_inputs(self): + speech = torch.randn(2, 30, 560) + speech_lengths = torch.tensor([6, 30], dtype=torch.int32) + return (speech, speech_lengths) + + +def export_input_names(self): + return ["speech", "speech_lengths"] + + +def export_output_names(self): + return ["logits", "token_num", "us_alphas", "us_cif_peak"] + + +def export_dynamic_axes(self): + return { + "speech": {0: "batch_size", 1: "feats_length"}, + "speech_lengths": { + 0: "batch_size", + }, + "logits": {0: "batch_size", 1: "logits_length"}, + "us_alphas": {0: "batch_size", 1: "alphas_length"}, + "us_cif_peak": {0: "batch_size", 1: "alphas_length"}, + } + + +def export_name(self): + return "model.onnx" diff --git a/funasr/models/bicif_paraformer/model.py b/funasr/models/bicif_paraformer/model.py new file mode 100644 index 0000000..4db9c76 --- /dev/null +++ b/funasr/models/bicif_paraformer/model.py @@ -0,0 +1,377 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import copy +import time +import torch +import logging +from contextlib import contextmanager +from distutils.version import LooseVersion +from typing import Dict, List, Optional, Tuple + +from funasr.register import tables +from funasr.models.ctc.ctc import CTC +from funasr.utils import postprocess_utils +from funasr.metrics.compute_acc import th_accuracy +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.model import Paraformer +from funasr.models.paraformer.search import Hypothesis +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.utils.timestamp_tools import ts_prediction_lfr6_standard +from funasr.models.transformer.utils.nets_utils import make_pad_mask, pad_list +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.train_utils.device_funcs import to_device + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "BiCifParaformer") +class BiCifParaformer(Paraformer): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paper1: FunASR: A Fundamental End-to-End Speech Recognition Toolkit + https://arxiv.org/abs/2305.11013 + Paper2: Achieving timestamp prediction while recognizing with non-autoregressive end-to-end ASR model + https://arxiv.org/abs/2301.12343 + """ + + def __init__( + self, + *args, + **kwargs, + ): + super().__init__(*args, **kwargs) + + def _calc_pre2_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + if self.predictor_bias == 1: + _, ys_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_pad_lens = ys_pad_lens + self.predictor_bias + _, _, _, _, pre_token_length2 = self.predictor( + encoder_out, ys_pad, encoder_out_mask, ignore_id=self.ignore_id + ) + + # loss_pre = self.criterion_pre(ys_pad_lens.type_as(pre_token_length), pre_token_length) + loss_pre2 = self.criterion_pre(ys_pad_lens.type_as(pre_token_length2), pre_token_length2) + + return loss_pre2 + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + if self.predictor_bias == 1: + _, ys_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_pad_lens = ys_pad_lens + self.predictor_bias + pre_acoustic_embeds, pre_token_length, _, pre_peak_index, _ = self.predictor( + encoder_out, ys_pad, encoder_out_mask, ignore_id=self.ignore_id + ) + + # 0. sampler + decoder_out_1st = None + if self.sampling_ratio > 0.0: + sematic_embeds, decoder_out_1st = self.sampler( + encoder_out, encoder_out_lens, ys_pad, ys_pad_lens, pre_acoustic_embeds + ) + else: + sematic_embeds = pre_acoustic_embeds + + # 1. Forward decoder + decoder_outs = self.decoder(encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens) + decoder_out, _ = decoder_outs[0], decoder_outs[1] + + if decoder_out_1st is None: + decoder_out_1st = decoder_out + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_pad) + acc_att = th_accuracy( + decoder_out_1st.view(-1, self.vocab_size), + ys_pad, + ignore_label=self.ignore_id, + ) + loss_pre = self.criterion_pre(ys_pad_lens.type_as(pre_token_length), pre_token_length) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out_1st.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att, loss_pre + + def calc_predictor(self, encoder_out, encoder_out_lens): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index, pre_token_length2 = ( + self.predictor(encoder_out, None, encoder_out_mask, ignore_id=self.ignore_id) + ) + return pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index + + def calc_predictor_timestamp(self, encoder_out, encoder_out_lens, token_num): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + ds_alphas, ds_cif_peak, us_alphas, us_peaks = self.predictor.get_upsample_timestamp( + encoder_out, encoder_out_mask, token_num + ) + return ds_alphas, ds_cif_peak, us_alphas, us_peaks + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_ctc, cer_ctc = None, None + loss_pre = None + stats = dict() + + # decoder: CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # decoder: Attention decoder branch + loss_att, acc_att, cer_att, wer_att, loss_pre = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + loss_pre2 = self._calc_pre2_loss(encoder_out, encoder_out_lens, text, text_lengths) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = ( + loss_att + + loss_pre * self.predictor_weight + + loss_pre2 * self.predictor_weight * 0.5 + ) + else: + loss = ( + self.ctc_weight * loss_ctc + + (1 - self.ctc_weight) * loss_att + + loss_pre * self.predictor_weight + + loss_pre2 * self.predictor_weight * 0.5 + ) + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + stats["loss_pre2"] = loss_pre2.detach().cpu() + + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + self.predictor_bias).sum()) + + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + # init beamsearch + is_use_ctc = kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None + is_use_lm = ( + kwargs.get("lm_weight", 0.0) > 0.00001 and kwargs.get("lm_file", None) is not None + ) + if self.beam_search is None and (is_use_lm or is_use_ctc): + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + # if isinstance(data_in, torch.Tensor): # fbank + # speech, speech_lengths = data_in, data_lengths + # if len(speech.shape) < 3: + # speech = speech[None, :, :] + # if speech_lengths is None: + # speech_lengths = speech.shape[1] + # else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, fs=frontend.fs, audio_fs=kwargs.get("fs", 16000) + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # predictor + predictor_outs = self.calc_predictor(encoder_out, encoder_out_lens) + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = ( + predictor_outs[0], + predictor_outs[1], + predictor_outs[2], + predictor_outs[3], + ) + pre_token_length = pre_token_length.round().long() + if torch.max(pre_token_length) < 1: + return [] + decoder_outs = self.cal_decoder_with_predictor( + encoder_out, encoder_out_lens, pre_acoustic_embeds, pre_token_length + ) + decoder_out, ys_pad_lens = decoder_outs[0], decoder_outs[1] + + # BiCifParaformer, test no bias cif2 + _, _, us_alphas, us_peaks = self.calc_predictor_timestamp( + encoder_out, encoder_out_lens, pre_token_length + ) + + results = [] + b, n, d = decoder_out.size() + for i in range(b): + x = encoder_out[i, : encoder_out_lens[i], :] + am_scores = decoder_out[i, : pre_token_length[i], :] + if self.beam_search is not None: + nbest_hyps = self.beam_search( + x=x, + am_scores=am_scores, + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + else: + + yseq = am_scores.argmax(dim=-1) + score = am_scores.max(dim=-1)[0] + score = torch.sum(score, dim=-1) + # pad with mask tokens to ensure compatibility with sos/eos tokens + yseq = torch.tensor([self.sos] + yseq.tolist() + [self.eos], device=yseq.device) + nbest_hyps = [Hypothesis(yseq=yseq, score=score)] + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx+1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + if tokenizer is not None: + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text = tokenizer.tokens2text(token) + + _, timestamp = ts_prediction_lfr6_standard( + us_alphas[i][: encoder_out_lens[i] * 3], + us_peaks[i][: encoder_out_lens[i] * 3], + copy.copy(token), + vad_offset=kwargs.get("begin_time", 0), + ) + + text_postprocessed, time_stamp_postprocessed, word_lists = ( + postprocess_utils.sentence_postprocess(token, timestamp) + ) + + result_i = { + "key": key[i], + "text": text_postprocessed, + "timestamp": time_stamp_postprocessed, + } + + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + # ibest_writer["text"][key[i]] = text + ibest_writer["timestamp"][key[i]] = time_stamp_postprocessed + ibest_writer["text"][key[i]] = text_postprocessed + else: + result_i = {"key": key[i], "token_int": token_int} + results.append(result_i) + + return results, meta_data + + def export(self, **kwargs): + from .export_meta import export_rebuild_model + + if "max_seq_len" not in kwargs: + kwargs["max_seq_len"] = 512 + models = export_rebuild_model(model=self, **kwargs) + return models diff --git a/funasr/models/bicif_paraformer/template.yaml b/funasr/models/bicif_paraformer/template.yaml new file mode 100644 index 0000000..db7ce55 --- /dev/null +++ b/funasr/models/bicif_paraformer/template.yaml @@ -0,0 +1,134 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +#model: funasr.models.paraformer.model:Paraformer +model: BiCifParaformer +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + predictor_weight: 1.0 + predictor_bias: 1 + sampling_ratio: 0.75 + +# encoder +encoder: SANMEncoder +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + +# decoder +decoder: ParaformerSANMDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 0 + +predictor: CifPredictorV3 +predictor_conf: + idim: 512 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + smooth_factor2: 0.25 + noise_threshold2: 0.01 + upsample_times: 3 + use_cif1_cnn: false + upsample_type: cnn_blstm + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/branchformer/__init__.py b/funasr/models/branchformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/branchformer/cgmlp.py b/funasr/models/branchformer/cgmlp.py new file mode 100644 index 0000000..17a1016 --- /dev/null +++ b/funasr/models/branchformer/cgmlp.py @@ -0,0 +1,124 @@ +"""MLP with convolutional gating (cgMLP) definition. + +References: + https://openreview.net/forum?id=RA-zVvZLYIy + https://arxiv.org/abs/2105.08050 + +""" + +import torch + +from funasr.models.transformer.utils.nets_utils import get_activation +from funasr.models.transformer.layer_norm import LayerNorm + + +class ConvolutionalSpatialGatingUnit(torch.nn.Module): + """Convolutional Spatial Gating Unit (CSGU).""" + + def __init__( + self, + size: int, + kernel_size: int, + dropout_rate: float, + use_linear_after_conv: bool, + gate_activation: str, + ): + super().__init__() + + n_channels = size // 2 # split input channels + self.norm = LayerNorm(n_channels) + self.conv = torch.nn.Conv1d( + n_channels, + n_channels, + kernel_size, + 1, + (kernel_size - 1) // 2, + groups=n_channels, + ) + if use_linear_after_conv: + self.linear = torch.nn.Linear(n_channels, n_channels) + else: + self.linear = None + + if gate_activation == "identity": + self.act = torch.nn.Identity() + else: + self.act = get_activation(gate_activation) + + self.dropout = torch.nn.Dropout(dropout_rate) + + def espnet_initialization_fn(self): + torch.nn.init.normal_(self.conv.weight, std=1e-6) + torch.nn.init.ones_(self.conv.bias) + if self.linear is not None: + torch.nn.init.normal_(self.linear.weight, std=1e-6) + torch.nn.init.ones_(self.linear.bias) + + def forward(self, x, gate_add=None): + """Forward method + + Args: + x (torch.Tensor): (N, T, D) + gate_add (torch.Tensor): (N, T, D/2) + + Returns: + out (torch.Tensor): (N, T, D/2) + """ + + x_r, x_g = x.chunk(2, dim=-1) + + x_g = self.norm(x_g) # (N, T, D/2) + x_g = self.conv(x_g.transpose(1, 2)).transpose(1, 2) # (N, T, D/2) + if self.linear is not None: + x_g = self.linear(x_g) + + if gate_add is not None: + x_g = x_g + gate_add + + x_g = self.act(x_g) + out = x_r * x_g # (N, T, D/2) + out = self.dropout(out) + return out + + +class ConvolutionalGatingMLP(torch.nn.Module): + """Convolutional Gating MLP (cgMLP).""" + + def __init__( + self, + size: int, + linear_units: int, + kernel_size: int, + dropout_rate: float, + use_linear_after_conv: bool, + gate_activation: str, + ): + super().__init__() + + self.channel_proj1 = torch.nn.Sequential( + torch.nn.Linear(size, linear_units), torch.nn.GELU() + ) + self.csgu = ConvolutionalSpatialGatingUnit( + size=linear_units, + kernel_size=kernel_size, + dropout_rate=dropout_rate, + use_linear_after_conv=use_linear_after_conv, + gate_activation=gate_activation, + ) + self.channel_proj2 = torch.nn.Linear(linear_units // 2, size) + + def forward(self, x, mask): + if isinstance(x, tuple): + xs_pad, pos_emb = x + else: + xs_pad, pos_emb = x, None + + xs_pad = self.channel_proj1(xs_pad) # size -> linear_units + xs_pad = self.csgu(xs_pad) # linear_units -> linear_units/2 + xs_pad = self.channel_proj2(xs_pad) # linear_units/2 -> size + + if pos_emb is not None: + out = (xs_pad, pos_emb) + else: + out = xs_pad + return out diff --git a/funasr/models/branchformer/encoder.py b/funasr/models/branchformer/encoder.py new file mode 100644 index 0000000..a15a3f2 --- /dev/null +++ b/funasr/models/branchformer/encoder.py @@ -0,0 +1,524 @@ +# Copyright 2022 Yifan Peng (Carnegie Mellon University) +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Branchformer encoder definition. + +Reference: + Yifan Peng, Siddharth Dalmia, Ian Lane, and Shinji Watanabe, + “Branchformer: Parallel MLP-Attention Architectures to Capture + Local and Global Context for Speech Recognition and Understanding,” + in Proceedings of ICML, 2022. + +""" + +import logging +from typing import List, Optional, Tuple, Union + +import numpy +import torch +import torch.nn as nn + +from funasr.models.branchformer.cgmlp import ConvolutionalGatingMLP +from funasr.models.branchformer.fastformer import FastSelfAttention +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.attention import ( # noqa: H301 + LegacyRelPositionMultiHeadedAttention, + MultiHeadedAttention, + RelPositionMultiHeadedAttention, +) +from funasr.models.transformer.embedding import ( # noqa: H301 + LegacyRelPositionalEncoding, + PositionalEncoding, + RelPositionalEncoding, + ScaledPositionalEncoding, +) +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.subsampling import ( + Conv2dSubsampling, + Conv2dSubsampling2, + Conv2dSubsampling6, + Conv2dSubsampling8, + TooShortUttError, + check_short_utt, +) + +from funasr.register import tables + + +class BranchformerEncoderLayer(torch.nn.Module): + """Branchformer encoder layer module. + + Args: + size (int): model dimension + attn: standard self-attention or efficient attention, optional + cgmlp: ConvolutionalGatingMLP, optional + dropout_rate (float): dropout probability + merge_method (str): concat, learned_ave, fixed_ave + cgmlp_weight (float): weight of the cgmlp branch, between 0 and 1, + used if merge_method is fixed_ave + attn_branch_drop_rate (float): probability of dropping the attn branch, + used if merge_method is learned_ave + stochastic_depth_rate (float): stochastic depth probability + """ + + def __init__( + self, + size: int, + attn: Optional[torch.nn.Module], + cgmlp: Optional[torch.nn.Module], + dropout_rate: float, + merge_method: str, + cgmlp_weight: float = 0.5, + attn_branch_drop_rate: float = 0.0, + stochastic_depth_rate: float = 0.0, + ): + super().__init__() + assert (attn is not None) or (cgmlp is not None), "At least one branch should be valid" + + self.size = size + self.attn = attn + self.cgmlp = cgmlp + self.merge_method = merge_method + self.cgmlp_weight = cgmlp_weight + self.attn_branch_drop_rate = attn_branch_drop_rate + self.stochastic_depth_rate = stochastic_depth_rate + self.use_two_branches = (attn is not None) and (cgmlp is not None) + + if attn is not None: + self.norm_mha = LayerNorm(size) # for the MHA module + if cgmlp is not None: + self.norm_mlp = LayerNorm(size) # for the MLP module + self.norm_final = LayerNorm(size) # for the final output of the block + + self.dropout = torch.nn.Dropout(dropout_rate) + + if self.use_two_branches: + if merge_method == "concat": + self.merge_proj = torch.nn.Linear(size + size, size) + + elif merge_method == "learned_ave": + # attention-based pooling for two branches + self.pooling_proj1 = torch.nn.Linear(size, 1) + self.pooling_proj2 = torch.nn.Linear(size, 1) + + # linear projections for calculating merging weights + self.weight_proj1 = torch.nn.Linear(size, 1) + self.weight_proj2 = torch.nn.Linear(size, 1) + + # linear projection after weighted average + self.merge_proj = torch.nn.Linear(size, size) + + elif merge_method == "fixed_ave": + assert 0.0 <= cgmlp_weight <= 1.0, "cgmlp weight should be between 0.0 and 1.0" + + # remove the other branch if only one branch is used + if cgmlp_weight == 0.0: + self.use_two_branches = False + self.cgmlp = None + self.norm_mlp = None + elif cgmlp_weight == 1.0: + self.use_two_branches = False + self.attn = None + self.norm_mha = None + + # linear projection after weighted average + self.merge_proj = torch.nn.Linear(size, size) + + else: + raise ValueError(f"unknown merge method: {merge_method}") + + else: + self.merge_proj = torch.nn.Identity() + + def forward(self, x_input, mask, cache=None): + """Compute encoded features. + + Args: + x_input (Union[Tuple, torch.Tensor]): Input tensor w/ or w/o pos emb. + - w/ pos emb: Tuple of tensors [(#batch, time, size), (1, time, size)]. + - w/o pos emb: Tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, 1, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + """ + + if cache is not None: + raise NotImplementedError("cache is not None, which is not tested") + + if isinstance(x_input, tuple): + x, pos_emb = x_input[0], x_input[1] + else: + x, pos_emb = x_input, None + + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + if pos_emb is not None: + return (x, pos_emb), mask + return x, mask + + # Two branches + x1 = x + x2 = x + + # Branch 1: multi-headed attention module + if self.attn is not None: + x1 = self.norm_mha(x1) + + if isinstance(self.attn, FastSelfAttention): + x_att = self.attn(x1, mask) + else: + if pos_emb is not None: + x_att = self.attn(x1, x1, x1, pos_emb, mask) + else: + x_att = self.attn(x1, x1, x1, mask) + + x1 = self.dropout(x_att) + + # Branch 2: convolutional gating mlp + if self.cgmlp is not None: + x2 = self.norm_mlp(x2) + + if pos_emb is not None: + x2 = (x2, pos_emb) + x2 = self.cgmlp(x2, mask) + if isinstance(x2, tuple): + x2 = x2[0] + + x2 = self.dropout(x2) + + # Merge two branches + if self.use_two_branches: + if self.merge_method == "concat": + x = x + stoch_layer_coeff * self.dropout( + self.merge_proj(torch.cat([x1, x2], dim=-1)) + ) + elif self.merge_method == "learned_ave": + if ( + self.training + and self.attn_branch_drop_rate > 0 + and torch.rand(1).item() < self.attn_branch_drop_rate + ): + # Drop the attn branch + w1, w2 = 0.0, 1.0 + else: + # branch1 + score1 = ( + self.pooling_proj1(x1).transpose(1, 2) / self.size**0.5 + ) # (batch, 1, time) + if mask is not None: + min_value = float( + numpy.finfo(torch.tensor(0, dtype=score1.dtype).numpy().dtype).min + ) + score1 = score1.masked_fill(mask.eq(0), min_value) + score1 = torch.softmax(score1, dim=-1).masked_fill(mask.eq(0), 0.0) + else: + score1 = torch.softmax(score1, dim=-1) + pooled1 = torch.matmul(score1, x1).squeeze(1) # (batch, size) + weight1 = self.weight_proj1(pooled1) # (batch, 1) + + # branch2 + score2 = ( + self.pooling_proj2(x2).transpose(1, 2) / self.size**0.5 + ) # (batch, 1, time) + if mask is not None: + min_value = float( + numpy.finfo(torch.tensor(0, dtype=score2.dtype).numpy().dtype).min + ) + score2 = score2.masked_fill(mask.eq(0), min_value) + score2 = torch.softmax(score2, dim=-1).masked_fill(mask.eq(0), 0.0) + else: + score2 = torch.softmax(score2, dim=-1) + pooled2 = torch.matmul(score2, x2).squeeze(1) # (batch, size) + weight2 = self.weight_proj2(pooled2) # (batch, 1) + + # normalize weights of two branches + merge_weights = torch.softmax( + torch.cat([weight1, weight2], dim=-1), dim=-1 + ) # (batch, 2) + merge_weights = merge_weights.unsqueeze(-1).unsqueeze(-1) # (batch, 2, 1, 1) + w1, w2 = merge_weights[:, 0], merge_weights[:, 1] # (batch, 1, 1) + + x = x + stoch_layer_coeff * self.dropout(self.merge_proj(w1 * x1 + w2 * x2)) + elif self.merge_method == "fixed_ave": + x = x + stoch_layer_coeff * self.dropout( + self.merge_proj((1.0 - self.cgmlp_weight) * x1 + self.cgmlp_weight * x2) + ) + else: + raise RuntimeError(f"unknown merge method: {self.merge_method}") + else: + if self.attn is None: + x = x + stoch_layer_coeff * self.dropout(self.merge_proj(x2)) + elif self.cgmlp is None: + x = x + stoch_layer_coeff * self.dropout(self.merge_proj(x1)) + else: + # This should not happen + raise RuntimeError("Both branches are not None, which is unexpected.") + + x = self.norm_final(x) + + if pos_emb is not None: + return (x, pos_emb), mask + + return x, mask + + +@tables.register("encoder_classes", "BranchformerEncoder") +class BranchformerEncoder(nn.Module): + """Branchformer encoder module.""" + + def __init__( + self, + input_size: int, + output_size: int = 256, + use_attn: bool = True, + attention_heads: int = 4, + attention_layer_type: str = "rel_selfattn", + pos_enc_layer_type: str = "rel_pos", + rel_pos_type: str = "latest", + use_cgmlp: bool = True, + cgmlp_linear_units: int = 2048, + cgmlp_conv_kernel: int = 31, + use_linear_after_conv: bool = False, + gate_activation: str = "identity", + merge_method: str = "concat", + cgmlp_weight: Union[float, List[float]] = 0.5, + attn_branch_drop_rate: Union[float, List[float]] = 0.0, + num_blocks: int = 12, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: Optional[str] = "conv2d", + zero_triu: bool = False, + padding_idx: int = -1, + stochastic_depth_rate: Union[float, List[float]] = 0.0, + ): + super().__init__() + self._output_size = output_size + + if rel_pos_type == "legacy": + if pos_enc_layer_type == "rel_pos": + pos_enc_layer_type = "legacy_rel_pos" + if attention_layer_type == "rel_selfattn": + attention_layer_type = "legacy_rel_selfattn" + elif rel_pos_type == "latest": + assert attention_layer_type != "legacy_rel_selfattn" + assert pos_enc_layer_type != "legacy_rel_pos" + else: + raise ValueError("unknown rel_pos_type: " + rel_pos_type) + + if pos_enc_layer_type == "abs_pos": + pos_enc_class = PositionalEncoding + elif pos_enc_layer_type == "scaled_abs_pos": + pos_enc_class = ScaledPositionalEncoding + elif pos_enc_layer_type == "rel_pos": + assert attention_layer_type == "rel_selfattn" + pos_enc_class = RelPositionalEncoding + elif pos_enc_layer_type == "legacy_rel_pos": + assert attention_layer_type == "legacy_rel_selfattn" + pos_enc_class = LegacyRelPositionalEncoding + logging.warning("Using legacy_rel_pos and it will be deprecated in the future.") + else: + raise ValueError("unknown pos_enc_layer: " + pos_enc_layer_type) + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif isinstance(input_layer, torch.nn.Module): + self.embed = torch.nn.Sequential( + input_layer, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer is None: + if input_size == output_size: + self.embed = None + else: + self.embed = torch.nn.Linear(input_size, output_size) + else: + raise ValueError("unknown input_layer: " + input_layer) + + if attention_layer_type == "selfattn": + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + elif attention_layer_type == "legacy_rel_selfattn": + assert pos_enc_layer_type == "legacy_rel_pos" + encoder_selfattn_layer = LegacyRelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + logging.warning("Using legacy_rel_selfattn and it will be deprecated in the future.") + elif attention_layer_type == "rel_selfattn": + assert pos_enc_layer_type == "rel_pos" + encoder_selfattn_layer = RelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + zero_triu, + ) + elif attention_layer_type == "fast_selfattn": + assert pos_enc_layer_type in ["abs_pos", "scaled_abs_pos"] + encoder_selfattn_layer = FastSelfAttention + encoder_selfattn_layer_args = ( + output_size, + attention_heads, + attention_dropout_rate, + ) + else: + raise ValueError("unknown encoder_attn_layer: " + attention_layer_type) + + cgmlp_layer = ConvolutionalGatingMLP + cgmlp_layer_args = ( + output_size, + cgmlp_linear_units, + cgmlp_conv_kernel, + dropout_rate, + use_linear_after_conv, + gate_activation, + ) + + if isinstance(stochastic_depth_rate, float): + stochastic_depth_rate = [stochastic_depth_rate] * num_blocks + if len(stochastic_depth_rate) != num_blocks: + raise ValueError( + f"Length of stochastic_depth_rate ({len(stochastic_depth_rate)}) " + f"should be equal to num_blocks ({num_blocks})" + ) + + if isinstance(cgmlp_weight, float): + cgmlp_weight = [cgmlp_weight] * num_blocks + if len(cgmlp_weight) != num_blocks: + raise ValueError( + f"Length of cgmlp_weight ({len(cgmlp_weight)}) should be equal to " + f"num_blocks ({num_blocks})" + ) + + if isinstance(attn_branch_drop_rate, float): + attn_branch_drop_rate = [attn_branch_drop_rate] * num_blocks + if len(attn_branch_drop_rate) != num_blocks: + raise ValueError( + f"Length of attn_branch_drop_rate ({len(attn_branch_drop_rate)}) " + f"should be equal to num_blocks ({num_blocks})" + ) + + self.encoders = repeat( + num_blocks, + lambda lnum: BranchformerEncoderLayer( + output_size, + encoder_selfattn_layer(*encoder_selfattn_layer_args) if use_attn else None, + cgmlp_layer(*cgmlp_layer_args) if use_cgmlp else None, + dropout_rate, + merge_method, + cgmlp_weight[lnum], + attn_branch_drop_rate[lnum], + stochastic_depth_rate[lnum], + ), + ) + self.after_norm = LayerNorm(output_size) + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Calculate forward propagation. + + Args: + xs_pad (torch.Tensor): Input tensor (#batch, L, input_size). + ilens (torch.Tensor): Input length (#batch). + prev_states (torch.Tensor): Not to be used now. + + Returns: + torch.Tensor: Output tensor (#batch, L, output_size). + torch.Tensor: Output length (#batch). + torch.Tensor: Not to be used now. + + """ + + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + + if ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + elif self.embed is not None: + xs_pad = self.embed(xs_pad) + + xs_pad, masks = self.encoders(xs_pad, masks) + + if isinstance(xs_pad, tuple): + xs_pad = xs_pad[0] + + xs_pad = self.after_norm(xs_pad) + olens = masks.squeeze(1).sum(1) + return xs_pad, olens, None diff --git a/funasr/models/branchformer/fastformer.py b/funasr/models/branchformer/fastformer.py new file mode 100644 index 0000000..ede94dc --- /dev/null +++ b/funasr/models/branchformer/fastformer.py @@ -0,0 +1,139 @@ +"""Fastformer attention definition. + +Reference: + Wu et al., "Fastformer: Additive Attention Can Be All You Need" + https://arxiv.org/abs/2108.09084 + https://github.com/wuch15/Fastformer + +""" + +import numpy +import torch + + +class FastSelfAttention(torch.nn.Module): + """Fast self-attention used in Fastformer.""" + + def __init__( + self, + size, + attention_heads, + dropout_rate, + ): + super().__init__() + if size % attention_heads != 0: + raise ValueError( + f"Hidden size ({size}) is not an integer multiple " + f"of attention heads ({attention_heads})" + ) + self.attention_head_size = size // attention_heads + self.num_attention_heads = attention_heads + + self.query = torch.nn.Linear(size, size) + self.query_att = torch.nn.Linear(size, attention_heads) + self.key = torch.nn.Linear(size, size) + self.key_att = torch.nn.Linear(size, attention_heads) + self.transform = torch.nn.Linear(size, size) + self.dropout = torch.nn.Dropout(dropout_rate) + + def espnet_initialization_fn(self): + self.apply(self.init_weights) + + def init_weights(self, module): + if isinstance(module, torch.nn.Linear): + module.weight.data.normal_(mean=0.0, std=0.02) + if isinstance(module, torch.nn.Linear) and module.bias is not None: + module.bias.data.zero_() + + def transpose_for_scores(self, x): + """Reshape and transpose to compute scores. + + Args: + x: (batch, time, size = n_heads * attn_dim) + + Returns: + (batch, n_heads, time, attn_dim) + """ + + new_x_shape = x.shape[:-1] + ( + self.num_attention_heads, + self.attention_head_size, + ) + return x.reshape(*new_x_shape).transpose(1, 2) + + def forward(self, xs_pad, mask): + """Forward method. + + Args: + xs_pad: (batch, time, size = n_heads * attn_dim) + mask: (batch, 1, time), nonpadding is 1, padding is 0 + + Returns: + torch.Tensor: (batch, time, size) + """ + + batch_size, seq_len, _ = xs_pad.shape + mixed_query_layer = self.query(xs_pad) # (batch, time, size) + mixed_key_layer = self.key(xs_pad) # (batch, time, size) + + if mask is not None: + mask = mask.eq(0) # padding is 1, nonpadding is 0 + + # (batch, n_heads, time) + query_for_score = ( + self.query_att(mixed_query_layer).transpose(1, 2) / self.attention_head_size**0.5 + ) + if mask is not None: + min_value = float( + numpy.finfo(torch.tensor(0, dtype=query_for_score.dtype).numpy().dtype).min + ) + query_for_score = query_for_score.masked_fill(mask, min_value) + query_weight = torch.softmax(query_for_score, dim=-1).masked_fill(mask, 0.0) + else: + query_weight = torch.softmax(query_for_score, dim=-1) + + query_weight = query_weight.unsqueeze(2) # (batch, n_heads, 1, time) + query_layer = self.transpose_for_scores( + mixed_query_layer + ) # (batch, n_heads, time, attn_dim) + + pooled_query = ( + torch.matmul(query_weight, query_layer) + .transpose(1, 2) + .reshape(-1, 1, self.num_attention_heads * self.attention_head_size) + ) # (batch, 1, size = n_heads * attn_dim) + pooled_query = self.dropout(pooled_query) + pooled_query_repeat = pooled_query.repeat(1, seq_len, 1) # (batch, time, size) + + mixed_query_key_layer = mixed_key_layer * pooled_query_repeat # (batch, time, size) + + # (batch, n_heads, time) + query_key_score = ( + self.key_att(mixed_query_key_layer) / self.attention_head_size**0.5 + ).transpose(1, 2) + if mask is not None: + min_value = float( + numpy.finfo(torch.tensor(0, dtype=query_key_score.dtype).numpy().dtype).min + ) + query_key_score = query_key_score.masked_fill(mask, min_value) + query_key_weight = torch.softmax(query_key_score, dim=-1).masked_fill(mask, 0.0) + else: + query_key_weight = torch.softmax(query_key_score, dim=-1) + + query_key_weight = query_key_weight.unsqueeze(2) # (batch, n_heads, 1, time) + key_layer = self.transpose_for_scores( + mixed_query_key_layer + ) # (batch, n_heads, time, attn_dim) + pooled_key = torch.matmul(query_key_weight, key_layer) # (batch, n_heads, 1, attn_dim) + pooled_key = self.dropout(pooled_key) + + # NOTE: value = query, due to param sharing + weighted_value = (pooled_key * query_layer).transpose( + 1, 2 + ) # (batch, time, n_heads, attn_dim) + weighted_value = weighted_value.reshape( + weighted_value.shape[:-2] + (self.num_attention_heads * self.attention_head_size,) + ) # (batch, time, size) + weighted_value = self.dropout(self.transform(weighted_value)) + mixed_query_layer + + return weighted_value diff --git a/funasr/models/branchformer/model.py b/funasr/models/branchformer/model.py new file mode 100644 index 0000000..f7e4b36 --- /dev/null +++ b/funasr/models/branchformer/model.py @@ -0,0 +1,17 @@ +import logging + +from funasr.models.transformer.model import Transformer +from funasr.register import tables + + +@tables.register("model_classes", "Branchformer") +class Branchformer(Transformer): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + *args, + **kwargs, + ): + + super().__init__(*args, **kwargs) diff --git a/funasr/models/branchformer/template.yaml b/funasr/models/branchformer/template.yaml new file mode 100644 index 0000000..0fec497 --- /dev/null +++ b/funasr/models/branchformer/template.yaml @@ -0,0 +1,116 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Branchformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: BranchformerEncoder +encoder_conf: + output_size: 256 + use_attn: true + attention_heads: 4 + attention_layer_type: rel_selfattn + pos_enc_layer_type: rel_pos + rel_pos_type: latest + use_cgmlp: true + cgmlp_linear_units: 2048 + cgmlp_conv_kernel: 31 + use_linear_after_conv: false + gate_activation: identity + merge_method: concat + cgmlp_weight: 0.5 # used only if merge_method is "fixed_ave" + attn_branch_drop_rate: 0.0 # used only if merge_method is "learned_ave" + num_blocks: 24 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: conv2d + stochastic_depth_rate: 0.0 + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0. + src_attention_dropout_rate: 0. + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + dither: 0.0 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.001 + weight_decay: 0.000001 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 35000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 4 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/campplus/__init__.py b/funasr/models/campplus/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/campplus/cluster_backend.py b/funasr/models/campplus/cluster_backend.py new file mode 100644 index 0000000..b98721e --- /dev/null +++ b/funasr/models/campplus/cluster_backend.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) +# Modified from 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker) + +import scipy +import torch +import sklearn +import numpy as np + +from sklearn.cluster._kmeans import k_means +from sklearn.cluster import HDBSCAN + + +class SpectralCluster: + r"""A spectral clustering mehtod using unnormalized Laplacian of affinity matrix. + This implementation is adapted from https://github.com/speechbrain/speechbrain. + """ + + def __init__(self, min_num_spks=1, max_num_spks=15, pval=0.022): + self.min_num_spks = min_num_spks + self.max_num_spks = max_num_spks + self.pval = pval + + def __call__(self, X, oracle_num=None): + # Similarity matrix computation + sim_mat = self.get_sim_mat(X) + + # Refining similarity matrix with pval + prunned_sim_mat = self.p_pruning(sim_mat) + + # Symmetrization + sym_prund_sim_mat = 0.5 * (prunned_sim_mat + prunned_sim_mat.T) + + # Laplacian calculation + laplacian = self.get_laplacian(sym_prund_sim_mat) + + # Get Spectral Embeddings + emb, num_of_spk = self.get_spec_embs(laplacian, oracle_num) + + # Perform clustering + labels = self.cluster_embs(emb, num_of_spk) + + return labels + + def get_sim_mat(self, X): + # Cosine similarities + M = sklearn.metrics.pairwise.cosine_similarity(X, X) + return M + + def p_pruning(self, A): + if A.shape[0] * self.pval < 6: + pval = 6.0 / A.shape[0] + else: + pval = self.pval + + n_elems = int((1 - pval) * A.shape[0]) + + # For each row in a affinity matrix + for i in range(A.shape[0]): + low_indexes = np.argsort(A[i, :]) + low_indexes = low_indexes[0:n_elems] + + # Replace smaller similarity values by 0s + A[i, low_indexes] = 0 + return A + + def get_laplacian(self, M): + M[np.diag_indices(M.shape[0])] = 0 + D = np.sum(np.abs(M), axis=1) + D = np.diag(D) + L = D - M + return L + + def get_spec_embs(self, L, k_oracle=None): + lambdas, eig_vecs = scipy.linalg.eigh(L) + + if k_oracle is not None: + num_of_spk = k_oracle + else: + lambda_gap_list = self.getEigenGaps( + lambdas[self.min_num_spks - 1 : self.max_num_spks + 1] + ) + num_of_spk = np.argmax(lambda_gap_list) + self.min_num_spks + + emb = eig_vecs[:, :num_of_spk] + return emb, num_of_spk + + def cluster_embs(self, emb, k): + _, labels, _ = k_means(emb, k) + return labels + + def getEigenGaps(self, eig_vals): + eig_vals_gap_list = [] + for i in range(len(eig_vals) - 1): + gap = float(eig_vals[i + 1]) - float(eig_vals[i]) + eig_vals_gap_list.append(gap) + return eig_vals_gap_list + + +class UmapHdbscan: + r""" + Reference: + - Siqi Zheng, Hongbin Suo. Reformulating Speaker Diarization as Community Detection With + Emphasis On Topological Structure. ICASSP2022 + """ + + def __init__( + self, n_neighbors=20, n_components=60, min_samples=10, min_cluster_size=10, metric="cosine" + ): + self.n_neighbors = n_neighbors + self.n_components = n_components + self.min_samples = min_samples + self.min_cluster_size = min_cluster_size + self.metric = metric + + def __call__(self, X): + import umap.umap_ as umap + + umap_X = umap.UMAP( + n_neighbors=self.n_neighbors, + min_dist=0.0, + n_components=min(self.n_components, X.shape[0] - 2), + metric=self.metric, + ).fit_transform(X) + labels = HDBSCAN( + min_samples=self.min_samples, + min_cluster_size=self.min_cluster_size, + allow_single_cluster=True, + ).fit_predict(umap_X) + return labels + + +class ClusterBackend(torch.nn.Module): + r"""Perfom clustering for input embeddings and output the labels. + Args: + model_dir: A model dir. + model_config: The model config. + """ + + def __init__(self): + super().__init__() + self.model_config = {"merge_thr": 0.78} + # self.other_config = kwargs + + self.spectral_cluster = SpectralCluster() + self.umap_hdbscan_cluster = UmapHdbscan() + + def forward(self, X, **params): + # clustering and return the labels + k = params["oracle_num"] if "oracle_num" in params else None + assert len(X.shape) == 2, "modelscope error: the shape of input should be [N, C]" + if X.shape[0] < 20: + return np.zeros(X.shape[0], dtype="int") + if X.shape[0] < 2048 or k is not None: + # unexpected corner case + labels = self.spectral_cluster(X, k) + else: + labels = self.umap_hdbscan_cluster(X) + + if k is None and "merge_thr" in self.model_config: + labels = self.merge_by_cos(labels, X, self.model_config["merge_thr"]) + + return labels + + def merge_by_cos(self, labels, embs, cos_thr): + # merge the similar speakers by cosine similarity + assert cos_thr > 0 and cos_thr <= 1 + while True: + spk_num = labels.max() + 1 + if spk_num == 1: + break + spk_center = [] + for i in range(spk_num): + spk_emb = embs[labels == i].mean(0) + spk_center.append(spk_emb) + assert len(spk_center) > 0 + spk_center = np.stack(spk_center, axis=0) + norm_spk_center = spk_center / np.linalg.norm(spk_center, axis=1, keepdims=True) + affinity = np.matmul(norm_spk_center, norm_spk_center.T) + affinity = np.triu(affinity, 1) + spks = np.unravel_index(np.argmax(affinity), affinity.shape) + if affinity[spks] < cos_thr: + break + for i in range(len(labels)): + if labels[i] == spks[1]: + labels[i] = spks[0] + elif labels[i] > spks[1]: + labels[i] -= 1 + return labels diff --git a/funasr/models/campplus/components.py b/funasr/models/campplus/components.py new file mode 100644 index 0000000..263b943 --- /dev/null +++ b/funasr/models/campplus/components.py @@ -0,0 +1,288 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) +# Modified from 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker) + +import torch +import torch.nn.functional as F +import torch.utils.checkpoint as cp + + +class BasicResBlock(torch.nn.Module): + expansion = 1 + + def __init__(self, in_planes, planes, stride=1): + super(BasicResBlock, self).__init__() + self.conv1 = torch.nn.Conv2d( + in_planes, planes, kernel_size=3, stride=(stride, 1), padding=1, bias=False + ) + self.bn1 = torch.nn.BatchNorm2d(planes) + self.conv2 = torch.nn.Conv2d(planes, planes, kernel_size=3, stride=1, padding=1, bias=False) + self.bn2 = torch.nn.BatchNorm2d(planes) + + self.shortcut = torch.nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = torch.nn.Sequential( + torch.nn.Conv2d( + in_planes, + self.expansion * planes, + kernel_size=1, + stride=(stride, 1), + bias=False, + ), + torch.nn.BatchNorm2d(self.expansion * planes), + ) + + def forward(self, x): + out = F.relu(self.bn1(self.conv1(x))) + out = self.bn2(self.conv2(out)) + out += self.shortcut(x) + out = F.relu(out) + return out + + +class FCM(torch.nn.Module): + def __init__(self, block=BasicResBlock, num_blocks=[2, 2], m_channels=32, feat_dim=80): + super(FCM, self).__init__() + self.in_planes = m_channels + self.conv1 = torch.nn.Conv2d(1, m_channels, kernel_size=3, stride=1, padding=1, bias=False) + self.bn1 = torch.nn.BatchNorm2d(m_channels) + + self.layer1 = self._make_layer(block, m_channels, num_blocks[0], stride=2) + self.layer2 = self._make_layer(block, m_channels, num_blocks[0], stride=2) + + self.conv2 = torch.nn.Conv2d( + m_channels, m_channels, kernel_size=3, stride=(2, 1), padding=1, bias=False + ) + self.bn2 = torch.nn.BatchNorm2d(m_channels) + self.out_channels = m_channels * (feat_dim // 8) + + def _make_layer(self, block, planes, num_blocks, stride): + strides = [stride] + [1] * (num_blocks - 1) + layers = [] + for stride in strides: + layers.append(block(self.in_planes, planes, stride)) + self.in_planes = planes * block.expansion + return torch.nn.Sequential(*layers) + + def forward(self, x): + x = x.unsqueeze(1) + out = F.relu(self.bn1(self.conv1(x))) + out = self.layer1(out) + out = self.layer2(out) + out = F.relu(self.bn2(self.conv2(out))) + + shape = out.shape + out = out.reshape(shape[0], shape[1] * shape[2], shape[3]) + return out + + +def get_nonlinear(config_str, channels): + nonlinear = torch.nn.Sequential() + for name in config_str.split("-"): + if name == "relu": + nonlinear.add_module("relu", torch.nn.ReLU(inplace=True)) + elif name == "prelu": + nonlinear.add_module("prelu", torch.nn.PReLU(channels)) + elif name == "batchnorm": + nonlinear.add_module("batchnorm", torch.nn.BatchNorm1d(channels)) + elif name == "batchnorm_": + nonlinear.add_module("batchnorm", torch.nn.BatchNorm1d(channels, affine=False)) + else: + raise ValueError("Unexpected module ({}).".format(name)) + return nonlinear + + +def statistics_pooling(x, dim=-1, keepdim=False, unbiased=True, eps=1e-2): + mean = x.mean(dim=dim) + std = x.std(dim=dim, unbiased=unbiased) + stats = torch.cat([mean, std], dim=-1) + if keepdim: + stats = stats.unsqueeze(dim=dim) + return stats + + +class StatsPool(torch.nn.Module): + def forward(self, x): + return statistics_pooling(x) + + +class TDNNLayer(torch.nn.Module): + def __init__( + self, + in_channels, + out_channels, + kernel_size, + stride=1, + padding=0, + dilation=1, + bias=False, + config_str="batchnorm-relu", + ): + super(TDNNLayer, self).__init__() + if padding < 0: + assert ( + kernel_size % 2 == 1 + ), "Expect equal paddings, but got even kernel size ({})".format(kernel_size) + padding = (kernel_size - 1) // 2 * dilation + self.linear = torch.nn.Conv1d( + in_channels, + out_channels, + kernel_size, + stride=stride, + padding=padding, + dilation=dilation, + bias=bias, + ) + self.nonlinear = get_nonlinear(config_str, out_channels) + + def forward(self, x): + x = self.linear(x) + x = self.nonlinear(x) + return x + + +class CAMLayer(torch.nn.Module): + def __init__( + self, bn_channels, out_channels, kernel_size, stride, padding, dilation, bias, reduction=2 + ): + super(CAMLayer, self).__init__() + self.linear_local = torch.nn.Conv1d( + bn_channels, + out_channels, + kernel_size, + stride=stride, + padding=padding, + dilation=dilation, + bias=bias, + ) + self.linear1 = torch.nn.Conv1d(bn_channels, bn_channels // reduction, 1) + self.relu = torch.nn.ReLU(inplace=True) + self.linear2 = torch.nn.Conv1d(bn_channels // reduction, out_channels, 1) + self.sigmoid = torch.nn.Sigmoid() + + def forward(self, x): + y = self.linear_local(x) + context = x.mean(-1, keepdim=True) + self.seg_pooling(x) + context = self.relu(self.linear1(context)) + m = self.sigmoid(self.linear2(context)) + return y * m + + def seg_pooling(self, x, seg_len=100, stype="avg"): + if stype == "avg": + seg = F.avg_pool1d(x, kernel_size=seg_len, stride=seg_len, ceil_mode=True) + elif stype == "max": + seg = F.max_pool1d(x, kernel_size=seg_len, stride=seg_len, ceil_mode=True) + else: + raise ValueError("Wrong segment pooling type.") + shape = seg.shape + seg = seg.unsqueeze(-1).expand(*shape, seg_len).reshape(*shape[:-1], -1) + seg = seg[..., : x.shape[-1]] + return seg + + +class CAMDenseTDNNLayer(torch.nn.Module): + def __init__( + self, + in_channels, + out_channels, + bn_channels, + kernel_size, + stride=1, + dilation=1, + bias=False, + config_str="batchnorm-relu", + memory_efficient=False, + ): + super(CAMDenseTDNNLayer, self).__init__() + assert kernel_size % 2 == 1, "Expect equal paddings, but got even kernel size ({})".format( + kernel_size + ) + padding = (kernel_size - 1) // 2 * dilation + self.memory_efficient = memory_efficient + self.nonlinear1 = get_nonlinear(config_str, in_channels) + self.linear1 = torch.nn.Conv1d(in_channels, bn_channels, 1, bias=False) + self.nonlinear2 = get_nonlinear(config_str, bn_channels) + self.cam_layer = CAMLayer( + bn_channels, + out_channels, + kernel_size, + stride=stride, + padding=padding, + dilation=dilation, + bias=bias, + ) + + def bn_function(self, x): + return self.linear1(self.nonlinear1(x)) + + def forward(self, x): + if self.training and self.memory_efficient: + x = cp.checkpoint(self.bn_function, x) + else: + x = self.bn_function(x) + x = self.cam_layer(self.nonlinear2(x)) + return x + + +class CAMDenseTDNNBlock(torch.nn.ModuleList): + def __init__( + self, + num_layers, + in_channels, + out_channels, + bn_channels, + kernel_size, + stride=1, + dilation=1, + bias=False, + config_str="batchnorm-relu", + memory_efficient=False, + ): + super(CAMDenseTDNNBlock, self).__init__() + for i in range(num_layers): + layer = CAMDenseTDNNLayer( + in_channels=in_channels + i * out_channels, + out_channels=out_channels, + bn_channels=bn_channels, + kernel_size=kernel_size, + stride=stride, + dilation=dilation, + bias=bias, + config_str=config_str, + memory_efficient=memory_efficient, + ) + self.add_module("tdnnd%d" % (i + 1), layer) + + def forward(self, x): + for layer in self: + x = torch.cat([x, layer(x)], dim=1) + return x + + +class TransitLayer(torch.nn.Module): + def __init__(self, in_channels, out_channels, bias=True, config_str="batchnorm-relu"): + super(TransitLayer, self).__init__() + self.nonlinear = get_nonlinear(config_str, in_channels) + self.linear = torch.nn.Conv1d(in_channels, out_channels, 1, bias=bias) + + def forward(self, x): + x = self.nonlinear(x) + x = self.linear(x) + return x + + +class DenseLayer(torch.nn.Module): + def __init__(self, in_channels, out_channels, bias=False, config_str="batchnorm-relu"): + super(DenseLayer, self).__init__() + self.linear = torch.nn.Conv1d(in_channels, out_channels, 1, bias=bias) + self.nonlinear = get_nonlinear(config_str, out_channels) + + def forward(self, x): + if len(x.shape) == 2: + x = self.linear(x.unsqueeze(dim=-1)).squeeze(dim=-1) + else: + x = self.linear(x) + x = self.nonlinear(x) + return x diff --git a/funasr/models/campplus/model.py b/funasr/models/campplus/model.py new file mode 100644 index 0000000..e3a829b --- /dev/null +++ b/funasr/models/campplus/model.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) +# Modified from 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker) + +import time +import torch +import numpy as np +from collections import OrderedDict +from contextlib import contextmanager +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.models.campplus.utils import extract_feature +from funasr.utils.load_utils import load_audio_text_image_video +from funasr.models.campplus.components import ( + DenseLayer, + StatsPool, + TDNNLayer, + CAMDenseTDNNBlock, + TransitLayer, + get_nonlinear, + FCM, +) + + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "CAMPPlus") +class CAMPPlus(torch.nn.Module): + def __init__( + self, + feat_dim=80, + embedding_size=192, + growth_rate=32, + bn_size=4, + init_channels=128, + config_str="batchnorm-relu", + memory_efficient=True, + output_level="segment", + **kwargs, + ): + super().__init__() + + self.head = FCM(feat_dim=feat_dim) + channels = self.head.out_channels + self.output_level = output_level + + self.xvector = torch.nn.Sequential( + OrderedDict( + [ + ( + "tdnn", + TDNNLayer( + channels, + init_channels, + 5, + stride=2, + dilation=1, + padding=-1, + config_str=config_str, + ), + ), + ] + ) + ) + channels = init_channels + for i, (num_layers, kernel_size, dilation) in enumerate( + zip((12, 24, 16), (3, 3, 3), (1, 2, 2)) + ): + block = CAMDenseTDNNBlock( + num_layers=num_layers, + in_channels=channels, + out_channels=growth_rate, + bn_channels=bn_size * growth_rate, + kernel_size=kernel_size, + dilation=dilation, + config_str=config_str, + memory_efficient=memory_efficient, + ) + self.xvector.add_module("block%d" % (i + 1), block) + channels = channels + num_layers * growth_rate + self.xvector.add_module( + "transit%d" % (i + 1), + TransitLayer(channels, channels // 2, bias=False, config_str=config_str), + ) + channels //= 2 + + self.xvector.add_module("out_nonlinear", get_nonlinear(config_str, channels)) + + if self.output_level == "segment": + self.xvector.add_module("stats", StatsPool()) + self.xvector.add_module( + "dense", DenseLayer(channels * 2, embedding_size, config_str="batchnorm_") + ) + else: + assert ( + self.output_level == "frame" + ), "`output_level` should be set to 'segment' or 'frame'. " + + for m in self.modules(): + if isinstance(m, (torch.nn.Conv1d, torch.nn.Linear)): + torch.nn.init.kaiming_normal_(m.weight.data) + if m.bias is not None: + torch.nn.init.zeros_(m.bias) + + def forward(self, x): + x = x.permute(0, 2, 1) # (B,T,F) => (B,F,T) + x = self.head(x) + x = self.xvector(x) + if self.output_level == "frame": + x = x.transpose(1, 2) + return x + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + # extract fbank feats + meta_data = {} + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, fs=16000, audio_fs=kwargs.get("fs", 16000), data_type="sound" + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths, speech_times = extract_feature(audio_sample_list) + speech = speech.to(device=kwargs["device"]) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = np.array(speech_times).sum().item() / 16000.0 + results = [{"spk_embedding": self.forward(speech.to(torch.float32))}] + return results, meta_data diff --git a/funasr/models/campplus/template.yaml b/funasr/models/campplus/template.yaml new file mode 100644 index 0000000..38dcfde --- /dev/null +++ b/funasr/models/campplus/template.yaml @@ -0,0 +1,23 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: CAMPPlus +model_conf: + feat_dim: 80 + embedding_size: 192 + growth_rate: 32 + bn_size: 4 + init_channels: 128 + config_str: 'batchnorm-relu' + memory_efficient: True + output_level: 'segment' + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 diff --git a/funasr/models/campplus/utils.py b/funasr/models/campplus/utils.py new file mode 100644 index 0000000..cb8d4b3 --- /dev/null +++ b/funasr/models/campplus/utils.py @@ -0,0 +1,504 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) +# Modified from 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker) + +import io +import os +import torch +import requests +import tempfile +import contextlib +import numpy as np +import librosa as sf +from typing import Union +from pathlib import Path +from typing import Generator, Union +from abc import ABCMeta, abstractmethod +import torchaudio.compliance.kaldi as Kaldi + +from funasr.models.transformer.utils.nets_utils import pad_list + + +def check_audio_list(audio: list): + audio_dur = 0 + for i in range(len(audio)): + seg = audio[i] + assert seg[1] >= seg[0], "modelscope error: Wrong time stamps." + assert isinstance(seg[2], np.ndarray), "modelscope error: Wrong data type." + assert ( + int(seg[1] * 16000) - int(seg[0] * 16000) == seg[2].shape[0] + ), "modelscope error: audio data in list is inconsistent with time length." + if i > 0: + assert seg[0] >= audio[i - 1][1], "modelscope error: Wrong time stamps." + audio_dur += seg[1] - seg[0] + return audio_dur + # assert audio_dur > 5, 'modelscope error: The effective audio duration is too short.' + + +def sv_preprocess(inputs: Union[np.ndarray, list]): + output = [] + for i in range(len(inputs)): + if isinstance(inputs[i], str): + file_bytes = File.read(inputs[i]) + data, fs = sf.load(io.BytesIO(file_bytes), dtype="float32") + if len(data.shape) == 2: + data = data[:, 0] + data = torch.from_numpy(data).unsqueeze(0) + data = data.squeeze(0) + elif isinstance(inputs[i], np.ndarray): + assert len(inputs[i].shape) == 1, "modelscope error: Input array should be [N, T]" + data = inputs[i] + if data.dtype in ["int16", "int32", "int64"]: + data = (data / (1 << 15)).astype("float32") + else: + data = data.astype("float32") + data = torch.from_numpy(data) + else: + raise ValueError( + "modelscope error: The input type is restricted to audio address and nump array." + ) + output.append(data) + return output + + +def sv_chunk(vad_segments: list, fs=16000) -> list: + config = { + "seg_dur": 1.5, + "seg_shift": 0.75, + } + + def seg_chunk(seg_data): + seg_st = seg_data[0] + data = seg_data[2] + chunk_len = int(config["seg_dur"] * fs) + chunk_shift = int(config["seg_shift"] * fs) + last_chunk_ed = 0 + seg_res = [] + for chunk_st in range(0, data.shape[0], chunk_shift): + chunk_ed = min(chunk_st + chunk_len, data.shape[0]) + if chunk_ed <= last_chunk_ed: + break + last_chunk_ed = chunk_ed + chunk_st = max(0, chunk_ed - chunk_len) + chunk_data = data[chunk_st:chunk_ed] + if chunk_data.shape[0] < chunk_len: + chunk_data = np.pad(chunk_data, (0, chunk_len - chunk_data.shape[0]), "constant") + seg_res.append([chunk_st / fs + seg_st, chunk_ed / fs + seg_st, chunk_data]) + return seg_res + + segs = [] + for i, s in enumerate(vad_segments): + segs.extend(seg_chunk(s)) + + return segs + + +def extract_feature(audio): + features = [] + feature_times = [] + feature_lengths = [] + for au in audio: + feature = Kaldi.fbank(au.unsqueeze(0), num_mel_bins=80) + feature = feature - feature.mean(dim=0, keepdim=True) + features.append(feature) + feature_times.append(au.shape[0]) + feature_lengths.append(feature.shape[0]) + # padding for batch inference + features_padded = pad_list(features, pad_value=0) + # features = torch.cat(features) + return features_padded, feature_lengths, feature_times + + +def postprocess( + segments: list, vad_segments: list, labels: np.ndarray, embeddings: np.ndarray +) -> list: + assert len(segments) == len(labels) + labels = correct_labels(labels) + distribute_res = [] + for i in range(len(segments)): + distribute_res.append([segments[i][0], segments[i][1], labels[i]]) + # merge the same speakers chronologically + distribute_res = merge_seque(distribute_res) + + # accquire speaker center + spk_embs = [] + for i in range(labels.max() + 1): + spk_emb = embeddings[labels == i].mean(0) + spk_embs.append(spk_emb) + spk_embs = np.stack(spk_embs) + + def is_overlapped(t1, t2): + if t1 > t2 + 1e-4: + return True + return False + + # distribute the overlap region + for i in range(1, len(distribute_res)): + if is_overlapped(distribute_res[i - 1][1], distribute_res[i][0]): + p = (distribute_res[i][0] + distribute_res[i - 1][1]) / 2 + distribute_res[i][0] = p + distribute_res[i - 1][1] = p + + # smooth the result + distribute_res = smooth(distribute_res) + + return distribute_res + + +def correct_labels(labels): + labels_id = 0 + id2id = {} + new_labels = [] + for i in labels: + if i not in id2id: + id2id[i] = labels_id + labels_id += 1 + new_labels.append(id2id[i]) + return np.array(new_labels) + + +def merge_seque(distribute_res): + res = [distribute_res[0]] + for i in range(1, len(distribute_res)): + if distribute_res[i][2] != res[-1][2] or distribute_res[i][0] > res[-1][1]: + res.append(distribute_res[i]) + else: + res[-1][1] = distribute_res[i][1] + return res + + +def smooth(res, mindur=1): + # if only one segment, return directly + if len(res) < 2: + return res + # short segments are assigned to nearest speakers. + for i in range(len(res)): + res[i][0] = round(res[i][0], 2) + res[i][1] = round(res[i][1], 2) + if res[i][1] - res[i][0] < mindur: + if i == 0: + res[i][2] = res[i + 1][2] + elif i == len(res) - 1: + res[i][2] = res[i - 1][2] + elif res[i][0] - res[i - 1][1] <= res[i + 1][0] - res[i][1]: + res[i][2] = res[i - 1][2] + else: + res[i][2] = res[i + 1][2] + # merge the speakers + res = merge_seque(res) + + return res + + +def distribute_spk(sentence_list, sd_time_list): + sd_sentence_list = [] + for d in sentence_list: + sentence_start = d["start"] + sentence_end = d["end"] + sentence_spk = 0 + max_overlap = 0 + for sd_time in sd_time_list: + spk_st, spk_ed, spk = sd_time + spk_st = spk_st * 1000 + spk_ed = spk_ed * 1000 + overlap = max(min(sentence_end, spk_ed) - max(sentence_start, spk_st), 0) + if overlap > max_overlap: + max_overlap = overlap + sentence_spk = spk + d["spk"] = int(sentence_spk) + sd_sentence_list.append(d) + return sd_sentence_list + + +class Storage(metaclass=ABCMeta): + """Abstract class of storage. + + All backends need to implement two apis: ``read()`` and ``read_text()``. + ``read()`` reads the file as a byte stream and ``read_text()`` reads + the file as texts. + """ + + @abstractmethod + def read(self, filepath: str): + pass + + @abstractmethod + def read_text(self, filepath: str): + pass + + @abstractmethod + def write(self, obj: bytes, filepath: Union[str, Path]) -> None: + pass + + @abstractmethod + def write_text(self, obj: str, filepath: Union[str, Path], encoding: str = "utf-8") -> None: + pass + + +class LocalStorage(Storage): + """Local hard disk storage""" + + def read(self, filepath: Union[str, Path]) -> bytes: + """Read data from a given ``filepath`` with 'rb' mode. + + Args: + filepath (str or Path): Path to read data. + + Returns: + bytes: Expected bytes object. + """ + with open(filepath, "rb") as f: + content = f.read() + return content + + def read_text(self, filepath: Union[str, Path], encoding: str = "utf-8") -> str: + """Read data from a given ``filepath`` with 'r' mode. + + Args: + filepath (str or Path): Path to read data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + + Returns: + str: Expected text reading from ``filepath``. + """ + with open(filepath, "r", encoding=encoding) as f: + value_buf = f.read() + return value_buf + + def write(self, obj: bytes, filepath: Union[str, Path]) -> None: + """Write data to a given ``filepath`` with 'wb' mode. + + Note: + ``write`` will create a directory if the directory of ``filepath`` + does not exist. + + Args: + obj (bytes): Data to be written. + filepath (str or Path): Path to write data. + """ + dirname = os.path.dirname(filepath) + if dirname and not os.path.exists(dirname): + os.makedirs(dirname, exist_ok=True) + + with open(filepath, "wb") as f: + f.write(obj) + + def write_text(self, obj: str, filepath: Union[str, Path], encoding: str = "utf-8") -> None: + """Write data to a given ``filepath`` with 'w' mode. + + Note: + ``write_text`` will create a directory if the directory of + ``filepath`` does not exist. + + Args: + obj (str): Data to be written. + filepath (str or Path): Path to write data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + """ + dirname = os.path.dirname(filepath) + if dirname and not os.path.exists(dirname): + os.makedirs(dirname, exist_ok=True) + + with open(filepath, "w", encoding=encoding) as f: + f.write(obj) + + @contextlib.contextmanager + def as_local_path(self, filepath: Union[str, Path]) -> Generator[Union[str, Path], None, None]: + """Only for unified API and do nothing.""" + yield filepath + + +class HTTPStorage(Storage): + """HTTP and HTTPS storage.""" + + def read(self, url): + # TODO @wenmeng.zwm add progress bar if file is too large + r = requests.get(url) + r.raise_for_status() + return r.content + + def read_text(self, url): + r = requests.get(url) + r.raise_for_status() + return r.text + + @contextlib.contextmanager + def as_local_path(self, filepath: str) -> Generator[Union[str, Path], None, None]: + """Download a file from ``filepath``. + + ``as_local_path`` is decorated by :meth:`contextlib.contextmanager`. It + can be called with ``with`` statement, and when exists from the + ``with`` statement, the temporary path will be released. + + Args: + filepath (str): Download a file from ``filepath``. + + Examples: + >>> storage = HTTPStorage() + >>> # After existing from the ``with`` clause, + >>> # the path will be removed + >>> with storage.get_local_path('http://path/to/file') as path: + ... # do something here + """ + try: + f = tempfile.NamedTemporaryFile(delete=False) + f.write(self.read(filepath)) + f.close() + yield f.name + finally: + os.remove(f.name) + + def write(self, obj: bytes, url: Union[str, Path]) -> None: + raise NotImplementedError("write is not supported by HTTP Storage") + + def write_text(self, obj: str, url: Union[str, Path], encoding: str = "utf-8") -> None: + raise NotImplementedError("write_text is not supported by HTTP Storage") + + +class OSSStorage(Storage): + """OSS storage.""" + + def __init__(self, oss_config_file=None): + # read from config file or env var + raise NotImplementedError("OSSStorage.__init__ to be implemented in the future") + + def read(self, filepath): + raise NotImplementedError("OSSStorage.read to be implemented in the future") + + def read_text(self, filepath, encoding="utf-8"): + raise NotImplementedError("OSSStorage.read_text to be implemented in the future") + + @contextlib.contextmanager + def as_local_path(self, filepath: str) -> Generator[Union[str, Path], None, None]: + """Download a file from ``filepath``. + + ``as_local_path`` is decorated by :meth:`contextlib.contextmanager`. It + can be called with ``with`` statement, and when exists from the + ``with`` statement, the temporary path will be released. + + Args: + filepath (str): Download a file from ``filepath``. + + Examples: + >>> storage = OSSStorage() + >>> # After existing from the ``with`` clause, + >>> # the path will be removed + >>> with storage.get_local_path('http://path/to/file') as path: + ... # do something here + """ + try: + f = tempfile.NamedTemporaryFile(delete=False) + f.write(self.read(filepath)) + f.close() + yield f.name + finally: + os.remove(f.name) + + def write(self, obj: bytes, filepath: Union[str, Path]) -> None: + raise NotImplementedError("OSSStorage.write to be implemented in the future") + + def write_text(self, obj: str, filepath: Union[str, Path], encoding: str = "utf-8") -> None: + raise NotImplementedError("OSSStorage.write_text to be implemented in the future") + + +G_STORAGES = {} + + +class File(object): + _prefix_to_storage: dict = { + "oss": OSSStorage, + "http": HTTPStorage, + "https": HTTPStorage, + "local": LocalStorage, + } + + @staticmethod + def _get_storage(uri): + assert isinstance(uri, str), f"uri should be str type, but got {type(uri)}" + + if "://" not in uri: + # local path + storage_type = "local" + else: + prefix, _ = uri.split("://") + storage_type = prefix + + assert storage_type in File._prefix_to_storage, ( + f"Unsupported uri {uri}, valid prefixs: " f"{list(File._prefix_to_storage.keys())}" + ) + + if storage_type not in G_STORAGES: + G_STORAGES[storage_type] = File._prefix_to_storage[storage_type]() + + return G_STORAGES[storage_type] + + @staticmethod + def read(uri: str) -> bytes: + """Read data from a given ``filepath`` with 'rb' mode. + + Args: + filepath (str or Path): Path to read data. + + Returns: + bytes: Expected bytes object. + """ + storage = File._get_storage(uri) + return storage.read(uri) + + @staticmethod + def read_text(uri: Union[str, Path], encoding: str = "utf-8") -> str: + """Read data from a given ``filepath`` with 'r' mode. + + Args: + filepath (str or Path): Path to read data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + + Returns: + str: Expected text reading from ``filepath``. + """ + storage = File._get_storage(uri) + return storage.read_text(uri) + + @staticmethod + def write(obj: bytes, uri: Union[str, Path]) -> None: + """Write data to a given ``filepath`` with 'wb' mode. + + Note: + ``write`` will create a directory if the directory of ``filepath`` + does not exist. + + Args: + obj (bytes): Data to be written. + filepath (str or Path): Path to write data. + """ + storage = File._get_storage(uri) + return storage.write(obj, uri) + + @staticmethod + def write_text(obj: str, uri: str, encoding: str = "utf-8") -> None: + """Write data to a given ``filepath`` with 'w' mode. + + Note: + ``write_text`` will create a directory if the directory of + ``filepath`` does not exist. + + Args: + obj (str): Data to be written. + filepath (str or Path): Path to write data. + encoding (str): The encoding format used to open the ``filepath``. + Default: 'utf-8'. + """ + storage = File._get_storage(uri) + return storage.write_text(obj, uri) + + @contextlib.contextmanager + def as_local_path(uri: str) -> Generator[Union[str, Path], None, None]: + """Only for unified API and do nothing.""" + storage = File._get_storage(uri) + with storage.as_local_path(uri) as local_path: + yield local_path diff --git a/funasr/models/conformer/__init__.py b/funasr/models/conformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/conformer/encoder.py b/funasr/models/conformer/encoder.py new file mode 100644 index 0000000..7c939b4 --- /dev/null +++ b/funasr/models/conformer/encoder.py @@ -0,0 +1,1260 @@ +# Copyright 2020 Tomoki Hayashi +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Conformer encoder definition.""" + +import logging +from typing import Union, Dict, List, Tuple, Optional + +import torch +from torch import nn + +from funasr.models.ctc.ctc import CTC +from funasr.models.transformer.attention import ( + MultiHeadedAttention, # noqa: H301 + RelPositionMultiHeadedAttention, # noqa: H301 + LegacyRelPositionMultiHeadedAttention, # noqa: H301 + RelPositionMultiHeadedAttentionChunk, +) +from funasr.models.transformer.embedding import ( + PositionalEncoding, # noqa: H301 + ScaledPositionalEncoding, # noqa: H301 + RelPositionalEncoding, # noqa: H301 + LegacyRelPositionalEncoding, # noqa: H301 + StreamingRelPositionalEncoding, +) +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.utils.nets_utils import get_activation +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.utils.nets_utils import ( + TooShortUttError, + check_short_utt, + make_chunk_mask, + make_source_mask, +) +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat, MultiBlocks +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling2 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling6 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling8 +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.utils.subsampling import check_short_utt +from funasr.models.transformer.utils.subsampling import Conv2dSubsamplingPad +from funasr.models.transformer.utils.subsampling import StreamingConvInput +from funasr.register import tables +import pdb + + +class ConvolutionModule(nn.Module): + """ConvolutionModule in Conformer model. + + Args: + channels (int): The number of channels of conv layers. + kernel_size (int): Kernerl size of conv layers. + + """ + + def __init__(self, channels, kernel_size, activation=nn.ReLU(), bias=True): + """Construct an ConvolutionModule object.""" + super(ConvolutionModule, self).__init__() + # kernerl_size should be a odd number for 'SAME' padding + assert (kernel_size - 1) % 2 == 0 + + self.pointwise_conv1 = nn.Conv1d( + channels, + 2 * channels, + kernel_size=1, + stride=1, + padding=0, + bias=bias, + ) + self.depthwise_conv = nn.Conv1d( + channels, + channels, + kernel_size, + stride=1, + padding=(kernel_size - 1) // 2, + groups=channels, + bias=bias, + ) + self.norm = nn.BatchNorm1d(channels) + self.pointwise_conv2 = nn.Conv1d( + channels, + channels, + kernel_size=1, + stride=1, + padding=0, + bias=bias, + ) + self.activation = activation + + def forward(self, x): + """Compute convolution module. + + Args: + x (torch.Tensor): Input tensor (#batch, time, channels). + + Returns: + torch.Tensor: Output tensor (#batch, time, channels). + + """ + # exchange the temporal dimension and the feature dimension + x = x.transpose(1, 2) + + # GLU mechanism + x = self.pointwise_conv1(x) # (batch, 2*channel, dim) + x = nn.functional.glu(x, dim=1) # (batch, channel, dim) + + # 1D Depthwise Conv + x = self.depthwise_conv(x) + x = self.activation(self.norm(x)) + + x = self.pointwise_conv2(x) + + return x.transpose(1, 2) + + +class EncoderLayer(nn.Module): + """Encoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` instance + can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + feed_forward_macaron (torch.nn.Module): Additional feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + conv_module (torch.nn.Module): Convolution module instance. + `ConvlutionModule` instance can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + stochastic_depth_rate (float): Proability to skip this layer. + During training, the layer may skip residual computation and return input + as-is with given probability. + """ + + def __init__( + self, + size, + self_attn, + feed_forward, + feed_forward_macaron, + conv_module, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayer, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.feed_forward_macaron = feed_forward_macaron + self.conv_module = conv_module + self.norm_ff = LayerNorm(size) # for the FNN module + self.norm_mha = LayerNorm(size) # for the MHA module + if feed_forward_macaron is not None: + self.norm_ff_macaron = LayerNorm(size) + self.ff_scale = 0.5 + else: + self.ff_scale = 1.0 + if self.conv_module is not None: + self.norm_conv = LayerNorm(size) # for the CNN module + self.norm_final = LayerNorm(size) # for the final output of the block + self.dropout = nn.Dropout(dropout_rate) + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + + def forward(self, x_input, mask, cache=None): + """Compute encoded features. + + Args: + x_input (Union[Tuple, torch.Tensor]): Input tensor w/ or w/o pos emb. + - w/ pos emb: Tuple of tensors [(#batch, time, size), (1, time, size)]. + - w/o pos emb: Tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + if isinstance(x_input, tuple): + x, pos_emb = x_input[0], x_input[1] + else: + x, pos_emb = x_input, None + + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + if pos_emb is not None: + return (x, pos_emb), mask + return x, mask + + # whether to use macaron style + if self.feed_forward_macaron is not None: + residual = x + if self.normalize_before: + x = self.norm_ff_macaron(x) + x = residual + stoch_layer_coeff * self.ff_scale * self.dropout( + self.feed_forward_macaron(x) + ) + if not self.normalize_before: + x = self.norm_ff_macaron(x) + + # multi-headed self-attention module + residual = x + if self.normalize_before: + x = self.norm_mha(x) + + if cache is None: + x_q = x + else: + assert cache.shape == (x.shape[0], x.shape[1] - 1, self.size) + x_q = x[:, -1:, :] + residual = residual[:, -1:, :] + mask = None if mask is None else mask[:, -1:, :] + + if pos_emb is not None: + x_att = self.self_attn(x_q, x, x, pos_emb, mask) + else: + x_att = self.self_attn(x_q, x, x, mask) + + if self.concat_after: + x_concat = torch.cat((x, x_att), dim=-1) + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = residual + stoch_layer_coeff * self.dropout(x_att) + if not self.normalize_before: + x = self.norm_mha(x) + + # convolution module + if self.conv_module is not None: + residual = x + if self.normalize_before: + x = self.norm_conv(x) + x = residual + stoch_layer_coeff * self.dropout(self.conv_module(x)) + if not self.normalize_before: + x = self.norm_conv(x) + + # feed forward module + residual = x + if self.normalize_before: + x = self.norm_ff(x) + x = residual + stoch_layer_coeff * self.ff_scale * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm_ff(x) + + if self.conv_module is not None: + x = self.norm_final(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + if pos_emb is not None: + return (x, pos_emb), mask + + return x, mask + + +@tables.register("encoder_classes", "ConformerEncoder") +class ConformerEncoder(nn.Module): + """Conformer encoder module. + + Args: + input_size (int): Input dimension. + output_size (int): Dimension of attention. + attention_heads (int): The number of heads of multi head attention. + linear_units (int): The number of units of position-wise feed forward. + num_blocks (int): The number of decoder blocks. + dropout_rate (float): Dropout rate. + attention_dropout_rate (float): Dropout rate in attention. + positional_dropout_rate (float): Dropout rate after adding positional encoding. + input_layer (Union[str, torch.nn.Module]): Input layer type. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + If True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + If False, no additional linear will be applied. i.e. x -> x + att(x) + positionwise_layer_type (str): "linear", "conv1d", or "conv1d-linear". + positionwise_conv_kernel_size (int): Kernel size of positionwise conv1d layer. + rel_pos_type (str): Whether to use the latest relative positional encoding or + the legacy one. The legacy relative positional encoding will be deprecated + in the future. More Details can be found in + https://github.com/espnet/espnet/pull/2816. + encoder_pos_enc_layer_type (str): Encoder positional encoding layer type. + encoder_attn_layer_type (str): Encoder attention layer type. + activation_type (str): Encoder activation function type. + macaron_style (bool): Whether to use macaron style for positionwise layer. + use_cnn_module (bool): Whether to use convolution module. + zero_triu (bool): Whether to zero the upper triangular part of attention matrix. + cnn_module_kernel (int): Kernerl size of convolution module. + padding_idx (int): Padding idx for input_layer=embed. + + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: str = "conv2d", + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 3, + macaron_style: bool = False, + rel_pos_type: str = "legacy", + pos_enc_layer_type: str = "rel_pos", + selfattention_layer_type: str = "rel_selfattn", + activation_type: str = "swish", + use_cnn_module: bool = True, + zero_triu: bool = False, + cnn_module_kernel: int = 31, + padding_idx: int = -1, + interctc_layer_idx: List[int] = [], + interctc_use_conditioning: bool = False, + stochastic_depth_rate: Union[float, List[float]] = 0.0, + ): + super().__init__() + self._output_size = output_size + + if rel_pos_type == "legacy": + if pos_enc_layer_type == "rel_pos": + pos_enc_layer_type = "legacy_rel_pos" + if selfattention_layer_type == "rel_selfattn": + selfattention_layer_type = "legacy_rel_selfattn" + elif rel_pos_type == "latest": + assert selfattention_layer_type != "legacy_rel_selfattn" + assert pos_enc_layer_type != "legacy_rel_pos" + else: + raise ValueError("unknown rel_pos_type: " + rel_pos_type) + + activation = get_activation(activation_type) + if pos_enc_layer_type == "abs_pos": + pos_enc_class = PositionalEncoding + elif pos_enc_layer_type == "scaled_abs_pos": + pos_enc_class = ScaledPositionalEncoding + elif pos_enc_layer_type == "rel_pos": + assert selfattention_layer_type == "rel_selfattn" + pos_enc_class = RelPositionalEncoding + elif pos_enc_layer_type == "legacy_rel_pos": + assert selfattention_layer_type == "legacy_rel_selfattn" + pos_enc_class = LegacyRelPositionalEncoding + logging.warning("Using legacy_rel_pos and it will be deprecated in the future.") + else: + raise ValueError("unknown pos_enc_layer: " + pos_enc_layer_type) + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2dpad": + self.embed = Conv2dSubsamplingPad( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif isinstance(input_layer, torch.nn.Module): + self.embed = torch.nn.Sequential( + input_layer, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer is None: + self.embed = torch.nn.Sequential(pos_enc_class(output_size, positional_dropout_rate)) + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + activation, + ) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + + if selfattention_layer_type == "selfattn": + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + elif selfattention_layer_type == "legacy_rel_selfattn": + assert pos_enc_layer_type == "legacy_rel_pos" + encoder_selfattn_layer = LegacyRelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + logging.warning("Using legacy_rel_selfattn and it will be deprecated in the future.") + elif selfattention_layer_type == "rel_selfattn": + assert pos_enc_layer_type == "rel_pos" + encoder_selfattn_layer = RelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + zero_triu, + ) + else: + raise ValueError("unknown encoder_attn_layer: " + selfattention_layer_type) + + convolution_layer = ConvolutionModule + convolution_layer_args = (output_size, cnn_module_kernel, activation) + + if isinstance(stochastic_depth_rate, float): + stochastic_depth_rate = [stochastic_depth_rate] * num_blocks + + if len(stochastic_depth_rate) != num_blocks: + raise ValueError( + f"Length of stochastic_depth_rate ({len(stochastic_depth_rate)}) " + f"should be equal to num_blocks ({num_blocks})" + ) + + self.encoders = repeat( + num_blocks, + lambda lnum: EncoderLayer( + output_size, + encoder_selfattn_layer(*encoder_selfattn_layer_args), + positionwise_layer(*positionwise_layer_args), + positionwise_layer(*positionwise_layer_args) if macaron_style else None, + convolution_layer(*convolution_layer_args) if use_cnn_module else None, + dropout_rate, + normalize_before, + concat_after, + stochastic_depth_rate[lnum], + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + + self.interctc_layer_idx = interctc_layer_idx + if len(interctc_layer_idx) > 0: + assert 0 < min(interctc_layer_idx) and max(interctc_layer_idx) < num_blocks + self.interctc_use_conditioning = interctc_use_conditioning + self.conditioning_layer = None + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ctc: CTC = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Calculate forward propagation. + + Args: + xs_pad (torch.Tensor): Input tensor (#batch, L, input_size). + ilens (torch.Tensor): Input length (#batch). + prev_states (torch.Tensor): Not to be used now. + + Returns: + torch.Tensor: Output tensor (#batch, L, output_size). + torch.Tensor: Output length (#batch). + torch.Tensor: Not to be used now. + + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + + if ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + or isinstance(self.embed, Conv2dSubsamplingPad) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + + intermediate_outs = [] + if len(self.interctc_layer_idx) == 0: + xs_pad, masks = self.encoders(xs_pad, masks) + else: + for layer_idx, encoder_layer in enumerate(self.encoders): + xs_pad, masks = encoder_layer(xs_pad, masks) + + if layer_idx + 1 in self.interctc_layer_idx: + encoder_out = xs_pad + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # intermediate outputs are also normalized + if self.normalize_before: + encoder_out = self.after_norm(encoder_out) + + intermediate_outs.append((layer_idx + 1, encoder_out)) + + if self.interctc_use_conditioning: + ctc_out = ctc.softmax(encoder_out) + + if isinstance(xs_pad, tuple): + x, pos_emb = xs_pad + x = x + self.conditioning_layer(ctc_out) + xs_pad = (x, pos_emb) + else: + xs_pad = xs_pad + self.conditioning_layer(ctc_out) + + if isinstance(xs_pad, tuple): + xs_pad = xs_pad[0] + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + olens = masks.squeeze(1).sum(1) + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), olens, None + return xs_pad, olens, None + + +class CausalConvolution(torch.nn.Module): + """ConformerConvolution module definition. + Args: + channels: The number of channels. + kernel_size: Size of the convolving kernel. + activation: Type of activation function. + norm_args: Normalization module arguments. + causal: Whether to use causal convolution (set to True if streaming). + """ + + def __init__( + self, + channels: int, + kernel_size: int, + activation: torch.nn.Module = torch.nn.ReLU(), + norm_args: Dict = {}, + causal: bool = False, + ) -> None: + """Construct an ConformerConvolution object.""" + super().__init__() + + assert (kernel_size - 1) % 2 == 0 + + self.kernel_size = kernel_size + + self.pointwise_conv1 = torch.nn.Conv1d( + channels, + 2 * channels, + kernel_size=1, + stride=1, + padding=0, + ) + + if causal: + self.lorder = kernel_size - 1 + padding = 0 + else: + self.lorder = 0 + padding = (kernel_size - 1) // 2 + + self.depthwise_conv = torch.nn.Conv1d( + channels, + channels, + kernel_size, + stride=1, + padding=padding, + groups=channels, + ) + self.norm = torch.nn.BatchNorm1d(channels, **norm_args) + self.pointwise_conv2 = torch.nn.Conv1d( + channels, + channels, + kernel_size=1, + stride=1, + padding=0, + ) + + self.activation = activation + + def forward( + self, + x: torch.Tensor, + cache: Optional[torch.Tensor] = None, + right_context: int = 0, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute convolution module. + Args: + x: ConformerConvolution input sequences. (B, T, D_hidden) + cache: ConformerConvolution input cache. (1, conv_kernel, D_hidden) + right_context: Number of frames in right context. + Returns: + x: ConformerConvolution output sequences. (B, T, D_hidden) + cache: ConformerConvolution output cache. (1, conv_kernel, D_hidden) + """ + x = self.pointwise_conv1(x.transpose(1, 2)) + x = torch.nn.functional.glu(x, dim=1) + + if self.lorder > 0: + if cache is None: + x = torch.nn.functional.pad(x, (self.lorder, 0), "constant", 0.0) + else: + x = torch.cat([cache, x], dim=2) + + if right_context > 0: + cache = x[:, :, -(self.lorder + right_context) : -right_context] + else: + cache = x[:, :, -self.lorder :] + + x = self.depthwise_conv(x) + x = self.activation(self.norm(x)) + + x = self.pointwise_conv2(x).transpose(1, 2) + + return x, cache + + +class ChunkEncoderLayer(torch.nn.Module): + """Chunk Conformer module definition. + Args: + block_size: Input/output size. + self_att: Self-attention module instance. + feed_forward: Feed-forward module instance. + feed_forward_macaron: Feed-forward module instance for macaron network. + conv_mod: Convolution module instance. + norm_class: Normalization module class. + norm_args: Normalization module arguments. + dropout_rate: Dropout rate. + """ + + def __init__( + self, + block_size: int, + self_att: torch.nn.Module, + feed_forward: torch.nn.Module, + feed_forward_macaron: torch.nn.Module, + conv_mod: torch.nn.Module, + norm_class: torch.nn.Module = LayerNorm, + norm_args: Dict = {}, + dropout_rate: float = 0.0, + ) -> None: + """Construct a Conformer object.""" + super().__init__() + + self.self_att = self_att + + self.feed_forward = feed_forward + self.feed_forward_macaron = feed_forward_macaron + self.feed_forward_scale = 0.5 + + self.conv_mod = conv_mod + + self.norm_feed_forward = norm_class(block_size, **norm_args) + self.norm_self_att = norm_class(block_size, **norm_args) + + self.norm_macaron = norm_class(block_size, **norm_args) + self.norm_conv = norm_class(block_size, **norm_args) + self.norm_final = norm_class(block_size, **norm_args) + + self.dropout = torch.nn.Dropout(dropout_rate) + + self.block_size = block_size + self.cache = None + + def reset_streaming_cache(self, left_context: int, device: torch.device) -> None: + """Initialize/Reset self-attention and convolution modules cache for streaming. + Args: + left_context: Number of left frames during chunk-by-chunk inference. + device: Device to use for cache tensor. + """ + self.cache = [ + torch.zeros( + (1, left_context, self.block_size), + device=device, + ), + torch.zeros( + ( + 1, + self.block_size, + self.conv_mod.kernel_size - 1, + ), + device=device, + ), + ] + + def forward( + self, + x: torch.Tensor, + pos_enc: torch.Tensor, + mask: torch.Tensor, + chunk_mask: Optional[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + """Encode input sequences. + Args: + x: Conformer input sequences. (B, T, D_block) + pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block) + mask: Source mask. (B, T) + chunk_mask: Chunk mask. (T_2, T_2) + Returns: + x: Conformer output sequences. (B, T, D_block) + mask: Source mask. (B, T) + pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block) + """ + residual = x + + x = self.norm_macaron(x) + x = residual + self.feed_forward_scale * self.dropout(self.feed_forward_macaron(x)) + + residual = x + x = self.norm_self_att(x) + x_q = x + x = residual + self.dropout( + self.self_att( + x_q, + x, + x, + pos_enc, + mask, + chunk_mask=chunk_mask, + ) + ) + + residual = x + + x = self.norm_conv(x) + x, _ = self.conv_mod(x) + x = residual + self.dropout(x) + residual = x + + x = self.norm_feed_forward(x) + x = residual + self.feed_forward_scale * self.dropout(self.feed_forward(x)) + + x = self.norm_final(x) + return x, mask, pos_enc + + def chunk_forward( + self, + x: torch.Tensor, + pos_enc: torch.Tensor, + mask: torch.Tensor, + chunk_size: int = 16, + left_context: int = 0, + right_context: int = 0, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encode chunk of input sequence. + Args: + x: Conformer input sequences. (B, T, D_block) + pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block) + mask: Source mask. (B, T_2) + left_context: Number of frames in left context. + right_context: Number of frames in right context. + Returns: + x: Conformer output sequences. (B, T, D_block) + pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block) + """ + residual = x + + x = self.norm_macaron(x) + x = residual + self.feed_forward_scale * self.feed_forward_macaron(x) + + residual = x + x = self.norm_self_att(x) + if left_context > 0: + key = torch.cat([self.cache[0], x], dim=1) + else: + key = x + val = key + + if right_context > 0: + att_cache = key[:, -(left_context + right_context) : -right_context, :] + else: + att_cache = key[:, -left_context:, :] + x = residual + self.self_att( + x, + key, + val, + pos_enc, + mask, + left_context=left_context, + ) + + residual = x + x = self.norm_conv(x) + x, conv_cache = self.conv_mod(x, cache=self.cache[1], right_context=right_context) + x = residual + x + residual = x + + x = self.norm_feed_forward(x) + x = residual + self.feed_forward_scale * self.feed_forward(x) + + x = self.norm_final(x) + self.cache = [att_cache, conv_cache] + + return x, pos_enc + + +@tables.register("encoder_classes", "ChunkConformerEncoder") +class ConformerChunkEncoder(torch.nn.Module): + """Encoder module definition. + Args: + input_size: Input size. + body_conf: Encoder body configuration. + input_conf: Encoder input configuration. + main_conf: Encoder main configuration. + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + embed_vgg_like: bool = False, + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 3, + macaron_style: bool = False, + rel_pos_type: str = "legacy", + pos_enc_layer_type: str = "rel_pos", + selfattention_layer_type: str = "rel_selfattn", + activation_type: str = "swish", + use_cnn_module: bool = True, + zero_triu: bool = False, + norm_type: str = "layer_norm", + cnn_module_kernel: int = 31, + conv_mod_norm_eps: float = 0.00001, + conv_mod_norm_momentum: float = 0.1, + simplified_att_score: bool = False, + dynamic_chunk_training: bool = False, + short_chunk_threshold: float = 0.75, + short_chunk_size: int = 25, + left_chunk_size: int = 0, + time_reduction_factor: int = 1, + unified_model_training: bool = False, + default_chunk_size: int = 16, + jitter_range: int = 4, + subsampling_factor: int = 1, + ) -> None: + """Construct an Encoder object.""" + super().__init__() + + self.embed = StreamingConvInput( + input_size=input_size, + conv_size=output_size, + subsampling_factor=subsampling_factor, + vgg_like=embed_vgg_like, + output_size=output_size, + ) + + self.pos_enc = StreamingRelPositionalEncoding( + output_size, + positional_dropout_rate, + ) + + activation = get_activation(activation_type) + + pos_wise_args = ( + output_size, + linear_units, + positional_dropout_rate, + activation, + ) + + conv_mod_norm_args = { + "eps": conv_mod_norm_eps, + "momentum": conv_mod_norm_momentum, + } + + conv_mod_args = ( + output_size, + cnn_module_kernel, + activation, + conv_mod_norm_args, + dynamic_chunk_training or unified_model_training, + ) + + mult_att_args = ( + attention_heads, + output_size, + attention_dropout_rate, + simplified_att_score, + ) + + fn_modules = [] + for _ in range(num_blocks): + module = lambda: ChunkEncoderLayer( + output_size, + RelPositionMultiHeadedAttentionChunk(*mult_att_args), + PositionwiseFeedForward(*pos_wise_args), + PositionwiseFeedForward(*pos_wise_args), + CausalConvolution(*conv_mod_args), + dropout_rate=dropout_rate, + ) + fn_modules.append(module) + + self.encoders = MultiBlocks( + [fn() for fn in fn_modules], + output_size, + ) + + self._output_size = output_size + + self.dynamic_chunk_training = dynamic_chunk_training + self.short_chunk_threshold = short_chunk_threshold + self.short_chunk_size = short_chunk_size + self.left_chunk_size = left_chunk_size + + self.unified_model_training = unified_model_training + self.default_chunk_size = default_chunk_size + self.jitter_range = jitter_range + + self.time_reduction_factor = time_reduction_factor + + def output_size(self) -> int: + return self._output_size + + def get_encoder_input_raw_size(self, size: int, hop_length: int) -> int: + """Return the corresponding number of sample for a given chunk size, in frames. + Where size is the number of features frames after applying subsampling. + Args: + size: Number of frames after subsampling. + hop_length: Frontend's hop length + Returns: + : Number of raw samples + """ + return self.embed.get_size_before_subsampling(size) * hop_length + + def get_encoder_input_size(self, size: int) -> int: + """Return the corresponding number of sample for a given chunk size, in frames. + Where size is the number of features frames after applying subsampling. + Args: + size: Number of frames after subsampling. + Returns: + : Number of raw samples + """ + return self.embed.get_size_before_subsampling(size) + + def reset_streaming_cache(self, left_context: int, device: torch.device) -> None: + """Initialize/Reset encoder streaming cache. + Args: + left_context: Number of frames in left context. + device: Device ID. + """ + return self.encoders.reset_streaming_cache(left_context, device) + + def forward( + self, + x: torch.Tensor, + x_len: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encode input sequences. + Args: + x: Encoder input features. (B, T_in, F) + x_len: Encoder input features lengths. (B,) + Returns: + x: Encoder outputs. (B, T_out, D_enc) + x_len: Encoder outputs lenghts. (B,) + """ + short_status, limit_size = check_short_utt(self.embed.subsampling_factor, x.size(1)) + + if short_status: + raise TooShortUttError( + f"has {x.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + x.size(1), + limit_size, + ) + + mask = make_source_mask(x_len).to(x.device) + + if self.unified_model_training: + if self.training: + chunk_size = ( + self.default_chunk_size + + torch.randint(-self.jitter_range, self.jitter_range + 1, (1,)).item() + ) + else: + chunk_size = self.default_chunk_size + x, mask = self.embed(x, mask, chunk_size) + pos_enc = self.pos_enc(x) + chunk_mask = make_chunk_mask( + x.size(1), + chunk_size, + left_chunk_size=self.left_chunk_size, + device=x.device, + ) + x_utt = self.encoders( + x, + pos_enc, + mask, + chunk_mask=None, + ) + x_chunk = self.encoders( + x, + pos_enc, + mask, + chunk_mask=chunk_mask, + ) + + olens = mask.eq(0).sum(1) + if self.time_reduction_factor > 1: + x_utt = x_utt[:, :: self.time_reduction_factor, :] + x_chunk = x_chunk[:, :: self.time_reduction_factor, :] + olens = torch.floor_divide(olens - 1, self.time_reduction_factor) + 1 + + return x_utt, x_chunk, olens + + elif self.dynamic_chunk_training: + max_len = x.size(1) + if self.training: + chunk_size = torch.randint(1, max_len, (1,)).item() + + if chunk_size > (max_len * self.short_chunk_threshold): + chunk_size = max_len + else: + chunk_size = (chunk_size % self.short_chunk_size) + 1 + else: + chunk_size = self.default_chunk_size + + x, mask = self.embed(x, mask, chunk_size) + pos_enc = self.pos_enc(x) + + chunk_mask = make_chunk_mask( + x.size(1), + chunk_size, + left_chunk_size=self.left_chunk_size, + device=x.device, + ) + else: + x, mask = self.embed(x, mask, None) + pos_enc = self.pos_enc(x) + chunk_mask = None + x = self.encoders( + x, + pos_enc, + mask, + chunk_mask=chunk_mask, + ) + + olens = mask.eq(0).sum(1) + if self.time_reduction_factor > 1: + x = x[:, :: self.time_reduction_factor, :] + olens = torch.floor_divide(olens - 1, self.time_reduction_factor) + 1 + + return x, olens, None + + def full_utt_forward( + self, + x: torch.Tensor, + x_len: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encode input sequences. + Args: + x: Encoder input features. (B, T_in, F) + x_len: Encoder input features lengths. (B,) + Returns: + x: Encoder outputs. (B, T_out, D_enc) + x_len: Encoder outputs lenghts. (B,) + """ + short_status, limit_size = check_short_utt(self.embed.subsampling_factor, x.size(1)) + + if short_status: + raise TooShortUttError( + f"has {x.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + x.size(1), + limit_size, + ) + + mask = make_source_mask(x_len).to(x.device) + x, mask = self.embed(x, mask, None) + pos_enc = self.pos_enc(x) + x_utt = self.encoders( + x, + pos_enc, + mask, + chunk_mask=None, + ) + + if self.time_reduction_factor > 1: + x_utt = x_utt[:, :: self.time_reduction_factor, :] + return x_utt + + def simu_chunk_forward( + self, + x: torch.Tensor, + x_len: torch.Tensor, + chunk_size: int = 16, + left_context: int = 32, + right_context: int = 0, + ) -> torch.Tensor: + short_status, limit_size = check_short_utt(self.embed.subsampling_factor, x.size(1)) + + if short_status: + raise TooShortUttError( + f"has {x.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + x.size(1), + limit_size, + ) + + mask = make_source_mask(x_len) + + x, mask = self.embed(x, mask, chunk_size) + pos_enc = self.pos_enc(x) + chunk_mask = make_chunk_mask( + x.size(1), + chunk_size, + left_chunk_size=self.left_chunk_size, + device=x.device, + ) + + x = self.encoders( + x, + pos_enc, + mask, + chunk_mask=chunk_mask, + ) + olens = mask.eq(0).sum(1) + if self.time_reduction_factor > 1: + x = x[:, :: self.time_reduction_factor, :] + + return x + + def chunk_forward( + self, + x: torch.Tensor, + x_len: torch.Tensor, + processed_frames: torch.tensor, + chunk_size: int = 16, + left_context: int = 32, + right_context: int = 0, + ) -> torch.Tensor: + """Encode input sequences as chunks. + Args: + x: Encoder input features. (1, T_in, F) + x_len: Encoder input features lengths. (1,) + processed_frames: Number of frames already seen. + left_context: Number of frames in left context. + right_context: Number of frames in right context. + Returns: + x: Encoder outputs. (B, T_out, D_enc) + """ + mask = make_source_mask(x_len) + x, mask = self.embed(x, mask, None) + + if left_context > 0: + processed_mask = ( + torch.arange(left_context, device=x.device).view(1, left_context).flip(1) + ) + processed_mask = processed_mask >= processed_frames + mask = torch.cat([processed_mask, mask], dim=1) + pos_enc = self.pos_enc(x, left_context=left_context) + x = self.encoders.chunk_forward( + x, + pos_enc, + mask, + chunk_size=chunk_size, + left_context=left_context, + right_context=right_context, + ) + + if right_context > 0: + x = x[:, 0:-right_context, :] + + if self.time_reduction_factor > 1: + x = x[:, :: self.time_reduction_factor, :] + return x diff --git a/funasr/models/conformer/model.py b/funasr/models/conformer/model.py new file mode 100644 index 0000000..d7e77b1 --- /dev/null +++ b/funasr/models/conformer/model.py @@ -0,0 +1,19 @@ +import logging + +import torch + +from funasr.models.transformer.model import Transformer +from funasr.register import tables + + +@tables.register("model_classes", "Conformer") +class Conformer(Transformer): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + *args, + **kwargs, + ): + + super().__init__(*args, **kwargs) diff --git a/funasr/models/conformer/template.yaml b/funasr/models/conformer/template.yaml new file mode 100644 index 0000000..5a8687e --- /dev/null +++ b/funasr/models/conformer/template.yaml @@ -0,0 +1,117 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Conformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: ConformerEncoder +encoder_conf: + output_size: 256 + attention_heads: 4 + linear_units: 2048 + num_blocks: 12 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: conv2d + normalize_before: true + pos_enc_layer_type: rel_pos + selfattention_layer_type: rel_selfattn + activation_type: swish + macaron_style: true + use_cnn_module: true + cnn_module_kernel: 15 + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.0 + src_attention_dropout_rate: 0.0 + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + dither: 0.0 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/conformer_rwkv/__init__.py b/funasr/models/conformer_rwkv/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/conformer_rwkv/decoder.py b/funasr/models/conformer_rwkv/decoder.py new file mode 100644 index 0000000..4c41049 --- /dev/null +++ b/funasr/models/conformer_rwkv/decoder.py @@ -0,0 +1,517 @@ +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Decoder definition.""" +from typing import Any +from typing import List +from typing import Sequence +from typing import Tuple + +import torch +from torch import nn + + +from funasr.models.transformer.attention import MultiHeadedAttention +from funasr.models.transformer.utils.dynamic_conv import DynamicConvolution +from funasr.models.transformer.utils.dynamic_conv2d import DynamicConvolution2D +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.lightconv import LightweightConvolution +from funasr.models.transformer.utils.lightconv2d import LightweightConvolution2D +from funasr.models.transformer.utils.mask import subsequent_mask +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.scorers.scorer_interface import BatchScorerInterface +from omegaconf import OmegaConf +from funasr.register import tables + + +class LayerNorm(nn.LayerNorm): + def forward(self, x): + return super().forward(x.float()).type(x.dtype) + + +class DecoderLayer(nn.Module): + """Single decoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + src_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + + """ + + def __init__( + self, + size, + # self_attn, + src_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + layer_id=None, + args={}, + **kwargs, + ): + """Construct an DecoderLayer object.""" + super(DecoderLayer, self).__init__() + self.size = size + # self.self_attn = self_attn.to(torch.bfloat16) + self.src_attn = src_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + self.norm2 = LayerNorm(size) + self.norm3 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = nn.Linear(size + size, size) + self.concat_linear2 = nn.Linear(size + size, size) + self.layer_id = layer_id + + if args.get("version", "v4") == "v4": + from funasr.models.sense_voice.rwkv_v4 import RWKVLayer + from funasr.models.sense_voice.rwkv_v4 import RWKV_TimeMix as RWKV_Tmix + elif args.get("version", "v5") == "v5": + from funasr.models.sense_voice.rwkv_v5 import RWKVLayer + from funasr.models.sense_voice.rwkv_v5 import RWKV_Tmix_x052 as RWKV_Tmix + else: + from funasr.models.sense_voice.rwkv_v6 import RWKVLayer + from funasr.models.sense_voice.rwkv_v6 import RWKV_Tmix_x060 as RWKV_Tmix + # self.attn = RWKVLayer(args=args, layer_id=layer_id) + self.self_attn = RWKV_Tmix(args, layer_id=layer_id) + + self.args = args + self.ln0 = None + if self.layer_id == 0 and not args.get("ln0", True): + self.ln0 = LayerNorm(args.n_embd) + if args.get("init_rwkv", True): + print("init_rwkv") + layer_id = 0 + scale = ((1 + layer_id) / args.get("n_layer")) ** 0.7 + nn.init.constant_(self.ln0.weight, scale) + + # init + if args.get("init_rwkv", True): + print("init_rwkv") + scale = ((1 + layer_id) / args.get("n_layer")) ** 0.7 + nn.init.constant_(self.norm1.weight, scale) + # nn.init.constant_(self.self_attn.ln2.weight, scale) + + if args.get("init_rwkv", True): + print("init_rwkv") + nn.init.orthogonal_(self.self_attn.receptance.weight, gain=1) + nn.init.orthogonal_(self.self_attn.key.weight, gain=0.1) + nn.init.orthogonal_(self.self_attn.value.weight, gain=1) + nn.init.orthogonal_(self.self_attn.gate.weight, gain=0.1) + nn.init.zeros_(self.self_attn.output.weight) + + if args.get("datatype", "bf16") == "bf16": + self.self_attn.to(torch.bfloat16) + # self.norm1.to(torch.bfloat16) + + def forward(self, tgt, tgt_mask, memory, memory_mask, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + + if self.layer_id == 0 and self.ln0 is not None: + tgt = self.ln0(tgt) + + if self.args.get("datatype", "bf16") == "bf16": + tgt = tgt.bfloat16() + residual = tgt + + tgt = self.norm1(tgt) + + if cache is None: + + x = residual + self.dropout(self.self_attn(tgt, mask=tgt_mask)) + else: + + # tgt_q = tgt[:, -1:, :] + # residual_q = residual[:, -1:, :] + tgt_q_mask = None + + x = residual + self.dropout(self.self_attn(tgt, mask=tgt_q_mask)) + x = x[:, -1, :] + if self.args.get("datatype", "bf16") == "bf16": + x = x.to(torch.float32) + # x = residual + self.dropout(self.self_attn(tgt_q, tgt, tgt, tgt_q_mask)) + + residual = x + x = self.norm2(x) + x = residual + self.dropout(self.src_attn(x, memory, memory, memory_mask)) + residual = x + x = self.norm3(x) + x = residual + self.dropout(self.feed_forward(x)) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + return x, tgt_mask, memory, memory_mask + + +class BaseTransformerDecoder(nn.Module, BatchScorerInterface): + """Base class of Transfomer decoder module. + + Args: + vocab_size: output dim + encoder_output_size: dimension of attention + attention_heads: the number of heads of multi head attention + linear_units: the number of units of position-wise feed forward + num_blocks: the number of decoder blocks + dropout_rate: dropout rate + self_attention_dropout_rate: dropout rate for attention + input_layer: input layer type + use_output_layer: whether to use output layer + pos_enc_class: PositionalEncoding or ScaledPositionalEncoding + normalize_before: whether to use layer_norm before the first block + concat_after: whether to concat attention layer's input and output + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. + i.e. x -> x + att(x) + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + ): + super().__init__() + attention_dim = encoder_output_size + + if input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(vocab_size, attention_dim), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(vocab_size, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + else: + raise ValueError(f"only 'embed' or 'linear' is supported: {input_layer}") + + self.normalize_before = normalize_before + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + if use_output_layer: + self.output_layer = torch.nn.Linear(attention_dim, vocab_size) + else: + self.output_layer = None + + # Must set by the inheritance + self.decoders = None + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + # tgt_mask: (B, 1, L) + tgt_mask = (~make_pad_mask(ys_in_lens)[:, None, :]).to(tgt.device) + # m: (1, L, L) + m = subsequent_mask(tgt_mask.size(-1), device=tgt_mask.device).unsqueeze(0) + # tgt_mask: (B, L, L) + tgt_mask = tgt_mask & m + + memory = hs_pad + memory_mask = (~make_pad_mask(hlens, maxlen=memory.size(1)))[:, None, :].to(memory.device) + # Padding for Longformer + if memory_mask.shape[-1] != memory.shape[1]: + padlen = memory.shape[1] - memory_mask.shape[-1] + memory_mask = torch.nn.functional.pad(memory_mask, (0, padlen), "constant", False) + + x = self.embed(tgt) + x, tgt_mask, memory, memory_mask = self.decoders(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + return x, olens + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + """ + x = self.embed(tgt) + if cache is None: + cache = [None] * len(self.decoders) + new_cache = [] + for c, decoder in zip(cache, self.decoders): + x, tgt_mask, memory, memory_mask = decoder(x, tgt_mask, memory, None, cache=c) + new_cache.append(x) + + if self.normalize_before: + y = self.after_norm(x[:, -1]) + else: + y = x[:, -1] + if self.output_layer is not None: + y = torch.log_softmax(self.output_layer(y), dim=-1) + + return y, new_cache + + def score(self, ys, state, x): + """Score.""" + ys_mask = subsequent_mask(len(ys), device=x.device).unsqueeze(0) + logp, state = self.forward_one_step(ys.unsqueeze(0), ys_mask, x.unsqueeze(0), cache=state) + return logp.squeeze(0), state + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, n_vocab)` + and next state list for ys. + + """ + # merge states + n_batch = len(ys) + n_layers = len(self.decoders) + if states[0] is None: + batch_state = None + else: + # transpose state of [batch, layer] into [layer, batch] + batch_state = [ + torch.stack([states[b][i] for b in range(n_batch)]) for i in range(n_layers) + ] + + # batch decoding + ys_mask = subsequent_mask(ys.size(-1), device=xs.device).unsqueeze(0) + logp, states = self.forward_one_step(ys, ys_mask, xs, cache=batch_state) + + # transpose state of [layer, batch] into [batch, layer] + state_list = [[states[i][b] for i in range(n_layers)] for b in range(n_batch)] + return logp, state_list + + +@tables.register("decoder_classes", "TransformerRWKVDecoder") +class TransformerRWKVDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + **kwargs, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + # from funasr.models.sense_voice.rwkv_v6 import RWKVLayer + + rwkv_cfg = kwargs.get("rwkv_cfg", {}) + args = OmegaConf.create(rwkv_cfg) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + lnum, + args=args, + ), + ) + + # init + if args.get("init_rwkv", True): + print("init_rwkv") + nn.init.uniform_(self.embed[0].weight, a=-1e-4, b=1e-4) + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + # tgt_mask: (B, 1, L) + tgt_mask = (~make_pad_mask(ys_in_lens)[:, None, :]).to(tgt.device) + # m: (1, L, L) + m = subsequent_mask(tgt_mask.size(-1), device=tgt_mask.device).unsqueeze(0) + # tgt_mask: (B, L, L) + tgt_mask = tgt_mask & m + + memory = hs_pad + memory_mask = (~make_pad_mask(hlens, maxlen=memory.size(1)))[:, None, :].to(memory.device) + # Padding for Longformer + if memory_mask.shape[-1] != memory.shape[1]: + padlen = memory.shape[1] - memory_mask.shape[-1] + memory_mask = torch.nn.functional.pad(memory_mask, (0, padlen), "constant", False) + + x = self.embed(tgt) + x, tgt_mask, memory, memory_mask = self.decoders(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + return x, olens + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + """ + x = self.embed(tgt) + if cache is None: + cache = [None] * len(self.decoders) + new_cache = [] + for c, decoder in zip(cache, self.decoders): + x, tgt_mask, memory, memory_mask = decoder(x, tgt_mask, memory, None, cache=c) + new_cache.append(x) + + if self.normalize_before: + y = self.after_norm(x[:, -1]) + else: + y = x[:, -1] + if self.output_layer is not None: + y = torch.log_softmax(self.output_layer(y), dim=-1) + + return y, new_cache diff --git a/funasr/models/conformer_rwkv/model.py b/funasr/models/conformer_rwkv/model.py new file mode 100644 index 0000000..d7e77b1 --- /dev/null +++ b/funasr/models/conformer_rwkv/model.py @@ -0,0 +1,19 @@ +import logging + +import torch + +from funasr.models.transformer.model import Transformer +from funasr.register import tables + + +@tables.register("model_classes", "Conformer") +class Conformer(Transformer): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + *args, + **kwargs, + ): + + super().__init__(*args, **kwargs) diff --git a/funasr/models/conformer_rwkv/template.yaml b/funasr/models/conformer_rwkv/template.yaml new file mode 100644 index 0000000..cd71105 --- /dev/null +++ b/funasr/models/conformer_rwkv/template.yaml @@ -0,0 +1,123 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Conformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: ConformerEncoder +encoder_conf: + output_size: 256 # dimension of attention + attention_heads: 4 + linear_units: 2048 # the number of units of position-wise feed forward + num_blocks: 12 # the number of encoder blocks + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: conv2d # encoder architecture type + normalize_before: true + pos_enc_layer_type: rel_pos + selfattention_layer_type: rel_selfattn + activation_type: swish + macaron_style: true + use_cnn_module: true + cnn_module_kernel: 15 + +# decoder +decoder: TransformerRWKVDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.0 + src_attention_dropout_rate: 0.0 + input_layer: embed + rwkv_cfg: + n_embd: 256 + dropout: 0 + head_size_a: 64 + ctx_len: 512 + dim_att: 256 #${model_conf.rwkv_cfg.n_embd} + dim_ffn: null + head_size_divisor: 4 + n_layer: 6 + pre_ffn: 0 + ln0: false + ln1: false + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: EspnetStyleBatchSampler + batch_type: length # example or length + batch_size: 25000 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 1024 + shuffle: True + num_workers: 4 + preprocessor_speech: SpeechPreprocessSpeedPerturb + preprocessor_speech_conf: + speed_perturb: [0.9, 1.0, 1.1] + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/contextual_paraformer/__init__.py b/funasr/models/contextual_paraformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/contextual_paraformer/decoder.py b/funasr/models/contextual_paraformer/decoder.py new file mode 100644 index 0000000..0b30c99 --- /dev/null +++ b/funasr/models/contextual_paraformer/decoder.py @@ -0,0 +1,446 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import logging +import numpy as np +from typing import Tuple + +from funasr.register import tables +from funasr.models.scama import utils as myutils +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.paraformer.decoder import DecoderLayerSANM, ParaformerSANMDecoder +from funasr.models.sanm.positionwise_feed_forward import PositionwiseFeedForwardDecoderSANM +from funasr.models.sanm.attention import ( + MultiHeadedAttentionSANMDecoder, + MultiHeadedAttentionCrossAtt, +) + + +class ContextualDecoderLayer(torch.nn.Module): + def __init__( + self, + size, + self_attn, + src_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an DecoderLayer object.""" + super(ContextualDecoderLayer, self).__init__() + self.size = size + self.self_attn = self_attn + self.src_attn = src_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + if self_attn is not None: + self.norm2 = LayerNorm(size) + if src_attn is not None: + self.norm3 = LayerNorm(size) + self.dropout = torch.nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = torch.nn.Linear(size + size, size) + self.concat_linear2 = torch.nn.Linear(size + size, size) + + def forward( + self, + tgt, + tgt_mask, + memory, + memory_mask, + cache=None, + ): + # tgt = self.dropout(tgt) + if isinstance(tgt, Tuple): + tgt, _ = tgt + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.normalize_before: + tgt = self.norm2(tgt) + if self.training: + cache = None + x, cache = self.self_attn(tgt, tgt_mask, cache=cache) + x = residual + self.dropout(x) + x_self_attn = x + + residual = x + if self.normalize_before: + x = self.norm3(x) + x = self.src_attn(x, memory, memory_mask) + x_src_attn = x + + x = residual + self.dropout(x) + return x, tgt_mask, x_self_attn, x_src_attn + + +class ContextualBiasDecoder(torch.nn.Module): + def __init__( + self, + size, + src_attn, + dropout_rate, + normalize_before=True, + ): + """Construct an DecoderLayer object.""" + super(ContextualBiasDecoder, self).__init__() + self.size = size + self.src_attn = src_attn + if src_attn is not None: + self.norm3 = LayerNorm(size) + self.dropout = torch.nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + + def forward(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + x = tgt + if self.src_attn is not None: + if self.normalize_before: + x = self.norm3(x) + x = self.dropout(self.src_attn(x, memory, memory_mask)) + return x, tgt_mask, memory, memory_mask, cache + + +@tables.register("decoder_classes", "ContextualParaformerDecoder") +class ContextualParaformerDecoder(ParaformerSANMDecoder): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2006.01713 + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + att_layer_num: int = 6, + kernel_size: int = 21, + sanm_shfit: int = 0, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + if input_layer == "none": + self.embed = None + if input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(vocab_size, attention_dim), + # pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(vocab_size, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + else: + raise ValueError(f"only 'embed' or 'linear' is supported: {input_layer}") + + self.normalize_before = normalize_before + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + if use_output_layer: + self.output_layer = torch.nn.Linear(attention_dim, vocab_size) + else: + self.output_layer = None + + self.att_layer_num = att_layer_num + self.num_blocks = num_blocks + if sanm_shfit is None: + sanm_shfit = (kernel_size - 1) // 2 + self.decoders = repeat( + att_layer_num - 1, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, self_attention_dropout_rate, kernel_size, sanm_shfit=sanm_shfit + ), + MultiHeadedAttentionCrossAtt( + attention_heads, attention_dim, src_attention_dropout_rate + ), + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + self.dropout = torch.nn.Dropout(dropout_rate) + self.bias_decoder = ContextualBiasDecoder( + size=attention_dim, + src_attn=MultiHeadedAttentionCrossAtt( + attention_heads, attention_dim, src_attention_dropout_rate + ), + dropout_rate=dropout_rate, + normalize_before=True, + ) + self.bias_output = torch.nn.Conv1d(attention_dim * 2, attention_dim, 1, bias=False) + self.last_decoder = ContextualDecoderLayer( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, self_attention_dropout_rate, kernel_size, sanm_shfit=sanm_shfit + ), + MultiHeadedAttentionCrossAtt( + attention_heads, attention_dim, src_attention_dropout_rate + ), + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ) + if num_blocks - att_layer_num <= 0: + self.decoders2 = None + else: + self.decoders2 = repeat( + num_blocks - att_layer_num, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, self_attention_dropout_rate, kernel_size, sanm_shfit=0 + ), + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + self.decoders3 = repeat( + 1, + lambda lnum: DecoderLayerSANM( + attention_dim, + None, + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + contextual_info: torch.Tensor, + clas_scale: float = 1.0, + return_hidden: bool = False, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + + x = tgt + x, tgt_mask, memory, memory_mask, _ = self.decoders(x, tgt_mask, memory, memory_mask) + _, _, x_self_attn, x_src_attn = self.last_decoder(x, tgt_mask, memory, memory_mask) + + # contextual paraformer related + contextual_length = torch.Tensor([contextual_info.shape[1]]).int().repeat(hs_pad.shape[0]) + contextual_mask = myutils.sequence_mask(contextual_length, device=memory.device)[:, None, :] + cx, tgt_mask, _, _, _ = self.bias_decoder( + x_self_attn, tgt_mask, contextual_info, memory_mask=contextual_mask + ) + + if self.bias_output is not None: + x = torch.cat([x_src_attn, cx * clas_scale], dim=2) + x = self.bias_output(x.transpose(1, 2)).transpose(1, 2) # 2D -> D + x = x_self_attn + self.dropout(x) + + if self.decoders2 is not None: + x, tgt_mask, memory, memory_mask, _ = self.decoders2(x, tgt_mask, memory, memory_mask) + + x, tgt_mask, memory, memory_mask, _ = self.decoders3(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + x = self.after_norm(x) + olens = tgt_mask.sum(1) + if self.output_layer is not None and return_hidden is False: + x = self.output_layer(x) + return x, olens + + +@tables.register("decoder_classes", "ContextualParaformerDecoderExport") +class ContextualParaformerDecoderExport(torch.nn.Module): + def __init__( + self, + model, + max_seq_len=512, + model_name="decoder", + onnx: bool = True, + **kwargs, + ): + super().__init__() + from funasr.utils.torch_function import sequence_mask + + self.model = model + self.make_pad_mask = sequence_mask(max_seq_len, flip=False) + + from funasr.models.sanm.attention import MultiHeadedAttentionSANMDecoderExport + from funasr.models.sanm.attention import MultiHeadedAttentionCrossAttExport + from funasr.models.paraformer.decoder import DecoderLayerSANMExport + from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForwardDecoderSANMExport, + ) + + for i, d in enumerate(self.model.decoders): + if isinstance(d.feed_forward, PositionwiseFeedForwardDecoderSANM): + d.feed_forward = PositionwiseFeedForwardDecoderSANMExport(d.feed_forward) + if isinstance(d.self_attn, MultiHeadedAttentionSANMDecoder): + d.self_attn = MultiHeadedAttentionSANMDecoderExport(d.self_attn) + if isinstance(d.src_attn, MultiHeadedAttentionCrossAtt): + d.src_attn = MultiHeadedAttentionCrossAttExport(d.src_attn) + self.model.decoders[i] = DecoderLayerSANMExport(d) + + if self.model.decoders2 is not None: + for i, d in enumerate(self.model.decoders2): + if isinstance(d.feed_forward, PositionwiseFeedForwardDecoderSANM): + d.feed_forward = PositionwiseFeedForwardDecoderSANMExport(d.feed_forward) + if isinstance(d.self_attn, MultiHeadedAttentionSANMDecoder): + d.self_attn = MultiHeadedAttentionSANMDecoderExport(d.self_attn) + self.model.decoders2[i] = DecoderLayerSANMExport(d) + + for i, d in enumerate(self.model.decoders3): + if isinstance(d.feed_forward, PositionwiseFeedForwardDecoderSANM): + d.feed_forward = PositionwiseFeedForwardDecoderSANMExport(d.feed_forward) + self.model.decoders3[i] = DecoderLayerSANMExport(d) + + self.output_layer = model.output_layer + self.after_norm = model.after_norm + self.model_name = model_name + + # bias decoder + if isinstance(self.model.bias_decoder.src_attn, MultiHeadedAttentionCrossAtt): + self.model.bias_decoder.src_attn = MultiHeadedAttentionCrossAttExport( + self.model.bias_decoder.src_attn + ) + self.bias_decoder = self.model.bias_decoder + + # last decoder + if isinstance(self.model.last_decoder.src_attn, MultiHeadedAttentionCrossAtt): + self.model.last_decoder.src_attn = MultiHeadedAttentionCrossAttExport( + self.model.last_decoder.src_attn + ) + if isinstance(self.model.last_decoder.self_attn, MultiHeadedAttentionSANMDecoder): + self.model.last_decoder.self_attn = MultiHeadedAttentionSANMDecoderExport( + self.model.last_decoder.self_attn + ) + if isinstance(self.model.last_decoder.feed_forward, PositionwiseFeedForwardDecoderSANM): + self.model.last_decoder.feed_forward = PositionwiseFeedForwardDecoderSANMExport( + self.model.last_decoder.feed_forward + ) + self.last_decoder = self.model.last_decoder + self.bias_output = self.model.bias_output + self.dropout = self.model.dropout + + def prepare_mask(self, mask): + mask_3d_btd = mask[:, :, None] + if len(mask.shape) == 2: + mask_4d_bhlt = 1 - mask[:, None, None, :] + elif len(mask.shape) == 3: + mask_4d_bhlt = 1 - mask[:, None, :] + mask_4d_bhlt = mask_4d_bhlt * -10000.0 + + return mask_3d_btd, mask_4d_bhlt + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + bias_embed: torch.Tensor, + ): + + tgt = ys_in_pad + tgt_mask = self.make_pad_mask(ys_in_lens) + tgt_mask, _ = self.prepare_mask(tgt_mask) + # tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = self.make_pad_mask(hlens) + _, memory_mask = self.prepare_mask(memory_mask) + # memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + + x = tgt + x, tgt_mask, memory, memory_mask, _ = self.model.decoders(x, tgt_mask, memory, memory_mask) + + _, _, x_self_attn, x_src_attn = self.last_decoder(x, tgt_mask, memory, memory_mask) + + # contextual paraformer related + contextual_length = torch.Tensor([bias_embed.shape[1]]).int().repeat(hs_pad.shape[0]) + # contextual_mask = myutils.sequence_mask(contextual_length, device=memory.device)[:, None, :] + contextual_mask = self.make_pad_mask(contextual_length) + contextual_mask, _ = self.prepare_mask(contextual_mask) + # import pdb; pdb.set_trace() + contextual_mask = contextual_mask.transpose(2, 1).unsqueeze(1) + cx, tgt_mask, _, _, _ = self.bias_decoder( + x_self_attn, tgt_mask, bias_embed, memory_mask=contextual_mask + ) + + if self.bias_output is not None: + x = torch.cat([x_src_attn, cx], dim=2) + x = self.bias_output(x.transpose(1, 2)).transpose(1, 2) # 2D -> D + x = x_self_attn + self.dropout(x) + + if self.model.decoders2 is not None: + x, tgt_mask, memory, memory_mask, _ = self.model.decoders2( + x, tgt_mask, memory, memory_mask + ) + x, tgt_mask, memory, memory_mask, _ = self.model.decoders3(x, tgt_mask, memory, memory_mask) + x = self.after_norm(x) + x = self.output_layer(x) + + return x, ys_in_lens diff --git a/funasr/models/contextual_paraformer/export_meta.py b/funasr/models/contextual_paraformer/export_meta.py new file mode 100644 index 0000000..602057f --- /dev/null +++ b/funasr/models/contextual_paraformer/export_meta.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import types + +from funasr.register import tables +from funasr.models.seaco_paraformer.export_meta import ContextualEmbedderExport + + +class ContextualEmbedderExport2(ContextualEmbedderExport): + def __init__(self, model, **kwargs): + super().__init__(model) + self.embedding = model.bias_embed + model.bias_encoder.batch_first = False + self.bias_encoder = model.bias_encoder + + +def export_rebuild_model(model, **kwargs): + is_onnx = kwargs.get("type", "onnx") == "onnx" + + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + predictor_class = tables.predictor_classes.get(kwargs["predictor"] + "Export") + model.predictor = predictor_class(model.predictor, onnx=is_onnx) + + # little difference with bias encoder with seaco paraformer + embedder_class = ContextualEmbedderExport2 + embedder_model = embedder_class(model, onnx=is_onnx) + + if kwargs["decoder"] == "ParaformerSANMDecoder": + kwargs["decoder"] = "ParaformerSANMDecoderOnline" + decoder_class = tables.decoder_classes.get(kwargs["decoder"] + "Export") + model.decoder = decoder_class(model.decoder, onnx=is_onnx) + + from funasr.utils.torch_function import sequence_mask + + model.make_pad_mask = sequence_mask(kwargs["max_seq_len"], flip=False) + model.feats_dim = 560 + + import copy + + backbone_model = copy.copy(model) + + # backbone + backbone_model.forward = types.MethodType(export_backbone_forward, backbone_model) + backbone_model.export_dummy_inputs = types.MethodType( + export_backbone_dummy_inputs, backbone_model + ) + backbone_model.export_input_names = types.MethodType( + export_backbone_input_names, backbone_model + ) + backbone_model.export_output_names = types.MethodType( + export_backbone_output_names, backbone_model + ) + backbone_model.export_dynamic_axes = types.MethodType( + export_backbone_dynamic_axes, backbone_model + ) + backbone_model.export_name = types.MethodType(export_backbone_name, backbone_model) + + return backbone_model, embedder_model + + +def export_backbone_forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + bias_embed: torch.Tensor, +): + batch = {"speech": speech, "speech_lengths": speech_lengths} + + enc, enc_len = self.encoder(**batch) + mask = self.make_pad_mask(enc_len)[:, None, :] + pre_acoustic_embeds, pre_token_length, _, _ = self.predictor(enc, mask) + pre_token_length = pre_token_length.floor().type(torch.int32) + + decoder_out, _ = self.decoder(enc, enc_len, pre_acoustic_embeds, pre_token_length, bias_embed) + decoder_out = torch.log_softmax(decoder_out, dim=-1) + + return decoder_out, pre_token_length + + +def export_backbone_dummy_inputs(self): + speech = torch.randn(2, 30, self.feats_dim) + speech_lengths = torch.tensor([6, 30], dtype=torch.int32) + bias_embed = torch.randn(2, 1, 512) + return (speech, speech_lengths, bias_embed) + + +def export_backbone_input_names(self): + return ["speech", "speech_lengths", "bias_embed"] + + +def export_backbone_output_names(self): + return ["logits", "token_num"] + + +def export_backbone_dynamic_axes(self): + return { + "speech": {0: "batch_size", 1: "feats_length"}, + "speech_lengths": { + 0: "batch_size", + }, + "bias_embed": {0: "batch_size", 1: "num_hotwords"}, + "logits": {0: "batch_size", 1: "logits_length"}, + } + + +def export_backbone_name(self): + return "model.onnx" diff --git a/funasr/models/contextual_paraformer/model.py b/funasr/models/contextual_paraformer/model.py new file mode 100644 index 0000000..fd88220 --- /dev/null +++ b/funasr/models/contextual_paraformer/model.py @@ -0,0 +1,597 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import os +import re +import time +import torch +import codecs +import logging +import tempfile +import requests +import numpy as np +from typing import Dict, Tuple +from contextlib import contextmanager +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.utils import postprocess_utils +from funasr.metrics.compute_acc import th_accuracy +from funasr.models.paraformer.model import Paraformer +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.search import Hypothesis +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.models.transformer.utils.nets_utils import make_pad_mask, pad_list +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "ContextualParaformer") +class ContextualParaformer(Paraformer): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + FunASR: A Fundamental End-to-End Speech Recognition Toolkit + https://arxiv.org/abs/2305.11013 + """ + + def __init__( + self, + *args, + **kwargs, + ): + super().__init__(*args, **kwargs) + + self.target_buffer_length = kwargs.get("target_buffer_length", -1) + inner_dim = kwargs.get("inner_dim", 256) + bias_encoder_type = kwargs.get("bias_encoder_type", "lstm") + use_decoder_embedding = kwargs.get("use_decoder_embedding", False) + crit_attn_weight = kwargs.get("crit_attn_weight", 0.0) + crit_attn_smooth = kwargs.get("crit_attn_smooth", 0.0) + bias_encoder_dropout_rate = kwargs.get("bias_encoder_dropout_rate", 0.0) + + if bias_encoder_type == "lstm": + self.bias_encoder = torch.nn.LSTM( + inner_dim, inner_dim, 1, batch_first=True, dropout=bias_encoder_dropout_rate + ) + self.bias_embed = torch.nn.Embedding(self.vocab_size, inner_dim) + elif bias_encoder_type == "mean": + self.bias_embed = torch.nn.Embedding(self.vocab_size, inner_dim) + else: + logging.error("Unsupport bias encoder type: {}".format(bias_encoder_type)) + + if self.target_buffer_length > 0: + self.hotword_buffer = None + self.length_record = [] + self.current_buffer_length = 0 + self.use_decoder_embedding = use_decoder_embedding + self.crit_attn_weight = crit_attn_weight + if self.crit_attn_weight > 0: + self.attn_loss = torch.nn.L1Loss() + self.crit_attn_smooth = crit_attn_smooth + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + text_lengths = text_lengths.squeeze() + speech_lengths = speech_lengths.squeeze() + + batch_size = speech.shape[0] + + hotword_pad = kwargs.get("hotword_pad") + hotword_lengths = kwargs.get("hotword_lengths") + # dha_pad = kwargs.get("dha_pad") + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_ctc, cer_ctc = None, None + + stats = dict() + + # 1. CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # 2b. Attention decoder branch + loss_att, acc_att, cer_att, wer_att, loss_pre, loss_ideal = self._calc_att_clas_loss( + encoder_out, encoder_out_lens, text, text_lengths, hotword_pad, hotword_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + loss_pre * self.predictor_weight + else: + loss = ( + self.ctc_weight * loss_ctc + + (1 - self.ctc_weight) * loss_att + + loss_pre * self.predictor_weight + ) + + if loss_ideal is not None: + loss = loss + loss_ideal * self.crit_attn_weight + stats["loss_ideal"] = loss_ideal.detach().cpu() + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + + stats["loss"] = torch.clone(loss.detach()) + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + self.predictor_bias).sum()) + + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def _calc_att_clas_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + hotword_pad: torch.Tensor, + hotword_lengths: torch.Tensor, + ): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + + if self.predictor_bias == 1: + _, ys_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_pad_lens = ys_pad_lens + self.predictor_bias + + pre_acoustic_embeds, pre_token_length, _, _ = self.predictor( + encoder_out, ys_pad, encoder_out_mask, ignore_id=self.ignore_id + ) + # -1. bias encoder + if self.use_decoder_embedding: + hw_embed = self.decoder.embed(hotword_pad) + else: + hw_embed = self.bias_embed(hotword_pad) + + hw_embed, (_, _) = self.bias_encoder(hw_embed) + _ind = np.arange(0, hotword_pad.shape[0]).tolist() + selected = hw_embed[_ind, [i - 1 for i in hotword_lengths.detach().cpu().tolist()]] + contextual_info = selected.squeeze(0).repeat(ys_pad.shape[0], 1, 1).to(ys_pad.device) + + # 0. sampler + decoder_out_1st = None + if self.sampling_ratio > 0.0: + + sematic_embeds, decoder_out_1st = self.sampler( + encoder_out, + encoder_out_lens, + ys_pad, + ys_pad_lens, + pre_acoustic_embeds, + contextual_info, + ) + else: + sematic_embeds = pre_acoustic_embeds + + # 1. Forward decoder + decoder_outs = self.decoder( + encoder_out, + encoder_out_lens, + sematic_embeds, + ys_pad_lens, + contextual_info=contextual_info, + ) + decoder_out, _ = decoder_outs[0], decoder_outs[1] + """ + if self.crit_attn_weight > 0 and attn.shape[-1] > 1: + ideal_attn = ideal_attn + self.crit_attn_smooth / (self.crit_attn_smooth + 1.0) + attn_non_blank = attn[:,:,:,:-1] + ideal_attn_non_blank = ideal_attn[:,:,:-1] + loss_ideal = self.attn_loss(attn_non_blank.max(1)[0], ideal_attn_non_blank.to(attn.device)) + else: + loss_ideal = None + """ + loss_ideal = None + + if decoder_out_1st is None: + decoder_out_1st = decoder_out + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_pad) + acc_att = th_accuracy( + decoder_out_1st.view(-1, self.vocab_size), + ys_pad, + ignore_label=self.ignore_id, + ) + loss_pre = self.criterion_pre(ys_pad_lens.type_as(pre_token_length), pre_token_length) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out_1st.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att, loss_pre, loss_ideal + + def sampler( + self, + encoder_out, + encoder_out_lens, + ys_pad, + ys_pad_lens, + pre_acoustic_embeds, + contextual_info, + ): + tgt_mask = (~make_pad_mask(ys_pad_lens, maxlen=ys_pad_lens.max())[:, :, None]).to( + ys_pad.device + ) + ys_pad = ys_pad * tgt_mask[:, :, 0] + if self.share_embedding: + ys_pad_embed = self.decoder.output_layer.weight[ys_pad] + else: + ys_pad_embed = self.decoder.embed(ys_pad) + with torch.no_grad(): + decoder_outs = self.decoder( + encoder_out, + encoder_out_lens, + pre_acoustic_embeds, + ys_pad_lens, + contextual_info=contextual_info, + ) + decoder_out, _ = decoder_outs[0], decoder_outs[1] + pred_tokens = decoder_out.argmax(-1) + nonpad_positions = ys_pad.ne(self.ignore_id) + seq_lens = (nonpad_positions).sum(1) + same_num = ((pred_tokens == ys_pad) & nonpad_positions).sum(1) + input_mask = torch.ones_like(nonpad_positions) + bsz, seq_len = ys_pad.size() + for li in range(bsz): + target_num = ( + ((seq_lens[li] - same_num[li].sum()).float()) * self.sampling_ratio + ).long() + if target_num > 0: + input_mask[li].scatter_( + dim=0, + index=torch.randperm(seq_lens[li])[:target_num].to( + pre_acoustic_embeds.device + ), + value=0, + ) + input_mask = input_mask.eq(1) + input_mask = input_mask.masked_fill(~nonpad_positions, False) + input_mask_expand_dim = input_mask.unsqueeze(2).to(pre_acoustic_embeds.device) + + sematic_embeds = pre_acoustic_embeds.masked_fill( + ~input_mask_expand_dim, 0 + ) + ys_pad_embed.masked_fill(input_mask_expand_dim, 0) + return sematic_embeds * tgt_mask, decoder_out * tgt_mask + + def cal_decoder_with_predictor( + self, + encoder_out, + encoder_out_lens, + sematic_embeds, + ys_pad_lens, + hw_list=None, + clas_scale=1.0, + ): + if hw_list is None: + hw_list = [torch.Tensor([1]).long().to(encoder_out.device)] # empty hotword list + hw_list_pad = pad_list(hw_list, 0) + if self.use_decoder_embedding: + hw_embed = self.decoder.embed(hw_list_pad) + else: + hw_embed = self.bias_embed(hw_list_pad) + hw_embed, (h_n, _) = self.bias_encoder(hw_embed) + hw_embed = h_n.repeat(encoder_out.shape[0], 1, 1) + else: + hw_lengths = [len(i) for i in hw_list] + hw_list_pad = pad_list([torch.Tensor(i).long() for i in hw_list], 0).to( + encoder_out.device + ) + if self.use_decoder_embedding: + hw_embed = self.decoder.embed(hw_list_pad) + else: + hw_embed = self.bias_embed(hw_list_pad) + hw_embed = torch.nn.utils.rnn.pack_padded_sequence( + hw_embed, hw_lengths, batch_first=True, enforce_sorted=False + ) + _, (h_n, _) = self.bias_encoder(hw_embed) + hw_embed = h_n.repeat(encoder_out.shape[0], 1, 1) + + decoder_outs = self.decoder( + encoder_out, + encoder_out_lens, + sematic_embeds, + ys_pad_lens, + contextual_info=hw_embed, + clas_scale=clas_scale, + ) + + decoder_out = decoder_outs[0] + decoder_out = torch.log_softmax(decoder_out, dim=-1) + return decoder_out, ys_pad_lens + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + # init beamsearch + + is_use_ctc = kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None + is_use_lm = ( + kwargs.get("lm_weight", 0.0) > 0.00001 and kwargs.get("lm_file", None) is not None + ) + if self.beam_search is None and (is_use_lm or is_use_ctc): + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + + # extract fbank feats + time1 = time.perf_counter() + + audio_sample_list = load_audio_text_image_video( + data_in, fs=frontend.fs, audio_fs=kwargs.get("fs", 16000) + ) + + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # hotword + self.hotword_list = self.generate_hotwords_list( + kwargs.get("hotword", None), tokenizer=tokenizer, frontend=frontend + ) + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # predictor + predictor_outs = self.calc_predictor(encoder_out, encoder_out_lens) + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = ( + predictor_outs[0], + predictor_outs[1], + predictor_outs[2], + predictor_outs[3], + ) + pre_token_length = pre_token_length.round().long() + if torch.max(pre_token_length) < 1: + return [] + + decoder_outs = self.cal_decoder_with_predictor( + encoder_out, + encoder_out_lens, + pre_acoustic_embeds, + pre_token_length, + hw_list=self.hotword_list, + clas_scale=kwargs.get("clas_scale", 1.0), + ) + decoder_out, ys_pad_lens = decoder_outs[0], decoder_outs[1] + + results = [] + b, n, d = decoder_out.size() + for i in range(b): + x = encoder_out[i, : encoder_out_lens[i], :] + am_scores = decoder_out[i, : pre_token_length[i], :] + if self.beam_search is not None: + nbest_hyps = self.beam_search( + x=x, + am_scores=am_scores, + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + else: + + yseq = am_scores.argmax(dim=-1) + score = am_scores.max(dim=-1)[0] + score = torch.sum(score, dim=-1) + # pad with mask tokens to ensure compatibility with sos/eos tokens + yseq = torch.tensor([self.sos] + yseq.tolist() + [self.eos], device=yseq.device) + nbest_hyps = [Hypothesis(yseq=yseq, score=score)] + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + if tokenizer is not None: + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text = tokenizer.tokens2text(token) + + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + result_i = {"key": key[i], "text": text_postprocessed} + + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text + ibest_writer["text_postprocessed"][key[i]] = text_postprocessed + else: + result_i = {"key": key[i], "token_int": token_int} + results.append(result_i) + + return results, meta_data + + def generate_hotwords_list(self, hotword_list_or_file, tokenizer=None, frontend=None): + def load_seg_dict(seg_dict_file): + seg_dict = {} + assert isinstance(seg_dict_file, str) + with open(seg_dict_file, "r", encoding="utf8") as f: + lines = f.readlines() + for line in lines: + s = line.strip().split() + key = s[0] + value = s[1:] + seg_dict[key] = " ".join(value) + return seg_dict + + def seg_tokenize(txt, seg_dict): + pattern = re.compile(r"^[\u4E00-\u9FA50-9]+$") + out_txt = "" + for word in txt: + word = word.lower() + if word in seg_dict: + out_txt += seg_dict[word] + " " + else: + if pattern.match(word): + for char in word: + if char in seg_dict: + out_txt += seg_dict[char] + " " + else: + out_txt += "" + " " + else: + out_txt += "" + " " + return out_txt.strip().split() + + seg_dict = None + if frontend.cmvn_file is not None: + model_dir = os.path.dirname(frontend.cmvn_file) + seg_dict_file = os.path.join(model_dir, "seg_dict") + if os.path.exists(seg_dict_file): + seg_dict = load_seg_dict(seg_dict_file) + else: + seg_dict = None + # for None + if hotword_list_or_file is None: + hotword_list = None + # for local txt inputs + elif os.path.exists(hotword_list_or_file) and hotword_list_or_file.endswith(".txt"): + logging.info("Attempting to parse hotwords from local txt...") + hotword_list = [] + hotword_str_list = [] + with codecs.open(hotword_list_or_file, "r") as fin: + for line in fin.readlines(): + hw = line.strip() + hw_list = hw.split() + if seg_dict is not None: + hw_list = seg_tokenize(hw_list, seg_dict) + hotword_str_list.append(hw) + hotword_list.append(tokenizer.tokens2ids(hw_list)) + hotword_list.append([self.sos]) + hotword_str_list.append("") + logging.info( + "Initialized hotword list from file: {}, hotword list: {}.".format( + hotword_list_or_file, hotword_str_list + ) + ) + # for url, download and generate txt + elif hotword_list_or_file.startswith("http"): + logging.info("Attempting to parse hotwords from url...") + work_dir = tempfile.TemporaryDirectory().name + if not os.path.exists(work_dir): + os.makedirs(work_dir) + text_file_path = os.path.join(work_dir, os.path.basename(hotword_list_or_file)) + local_file = requests.get(hotword_list_or_file) + open(text_file_path, "wb").write(local_file.content) + hotword_list_or_file = text_file_path + hotword_list = [] + hotword_str_list = [] + with codecs.open(hotword_list_or_file, "r") as fin: + for line in fin.readlines(): + hw = line.strip() + hw_list = hw.split() + if seg_dict is not None: + hw_list = seg_tokenize(hw_list, seg_dict) + hotword_str_list.append(hw) + hotword_list.append(tokenizer.tokens2ids(hw_list)) + hotword_list.append([self.sos]) + hotword_str_list.append("") + logging.info( + "Initialized hotword list from file: {}, hotword list: {}.".format( + hotword_list_or_file, hotword_str_list + ) + ) + # for text str input + elif not hotword_list_or_file.endswith(".txt"): + logging.info("Attempting to parse hotwords as str...") + hotword_list = [] + hotword_str_list = [] + for hw in hotword_list_or_file.strip().split(): + hotword_str_list.append(hw) + hw_list = hw.strip().split() + if seg_dict is not None: + hw_list = seg_tokenize(hw_list, seg_dict) + hotword_list.append(tokenizer.tokens2ids(hw_list)) + hotword_list.append([self.sos]) + hotword_str_list.append("") + logging.info("Hotword list: {}.".format(hotword_str_list)) + else: + hotword_list = None + return hotword_list + + def export( + self, + **kwargs, + ): + if "max_seq_len" not in kwargs: + kwargs["max_seq_len"] = 512 + from .export_meta import export_rebuild_model + + models = export_rebuild_model(model=self, **kwargs) + return models diff --git a/funasr/models/contextual_paraformer/template.yaml b/funasr/models/contextual_paraformer/template.yaml new file mode 100644 index 0000000..2205250 --- /dev/null +++ b/funasr/models/contextual_paraformer/template.yaml @@ -0,0 +1,129 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: ContextualParaformer +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + predictor_weight: 1.0 + predictor_bias: 1 + sampling_ratio: 0.75 + inner_dim: 512 + +# encoder +encoder: SANMEncoder +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + + +# decoder +decoder: ContextualParaformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 0 + +predictor: CifPredictorV2 +predictor_conf: + idim: 512 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null \ No newline at end of file diff --git a/funasr/models/ct_transformer/__init__.py b/funasr/models/ct_transformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/ct_transformer/export_meta.py b/funasr/models/ct_transformer/export_meta.py new file mode 100644 index 0000000..c222008 --- /dev/null +++ b/funasr/models/ct_transformer/export_meta.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import types +import torch +from funasr.register import tables + + +def export_rebuild_model(model, **kwargs): + + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + model.forward = types.MethodType(export_forward, model) + model.export_dummy_inputs = types.MethodType(export_dummy_inputs, model) + model.export_input_names = types.MethodType(export_input_names, model) + model.export_output_names = types.MethodType(export_output_names, model) + model.export_dynamic_axes = types.MethodType(export_dynamic_axes, model) + model.export_name = types.MethodType(export_name, model) + + return model + + +def export_forward(self, inputs: torch.Tensor, text_lengths: torch.Tensor): + """Compute loss value from buffer sequences. + + Args: + input (torch.Tensor): Input ids. (batch, len) + hidden (torch.Tensor): Target ids. (batch, len) + + """ + x = self.embed(inputs) + h, _ = self.encoder(x, text_lengths) + y = self.decoder(h) + return y + + +def export_dummy_inputs(self): + length = 120 + text_indexes = torch.randint(0, self.embed.num_embeddings, (2, length)).type(torch.int32) + text_lengths = torch.tensor([length - 20, length], dtype=torch.int32) + return (text_indexes, text_lengths) + + +def export_input_names(self): + return ["inputs", "text_lengths"] + + +def export_output_names(self): + return ["logits"] + + +def export_dynamic_axes(self): + return { + "inputs": {0: "batch_size", 1: "feats_length"}, + "text_lengths": { + 0: "batch_size", + }, + "logits": {0: "batch_size", 1: "logits_length"}, + } + + +def export_name(self): + return "model.onnx" diff --git a/funasr/models/ct_transformer/model.py b/funasr/models/ct_transformer/model.py new file mode 100644 index 0000000..abc5dfd --- /dev/null +++ b/funasr/models/ct_transformer/model.py @@ -0,0 +1,420 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import copy +import torch +import numpy as np +import torch.nn.functional as F +from contextlib import contextmanager +from distutils.version import LooseVersion +from typing import Any, List, Tuple, Optional + +from funasr.register import tables +from funasr.train_utils.device_funcs import to_device +from funasr.train_utils.device_funcs import force_gatherable +from funasr.utils.load_utils import load_audio_text_image_video +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.ct_transformer.utils import split_to_mini_sentence, split_words + +try: + import jieba +except: + pass +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "CTTransformer") +class CTTransformer(torch.nn.Module): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + CT-Transformer: Controllable time-delay transformer for real-time punctuation prediction and disfluency detection + https://arxiv.org/pdf/2003.01309.pdf + """ + + def __init__( + self, + encoder: str = None, + encoder_conf: dict = None, + vocab_size: int = -1, + punc_list: list = None, + punc_weight: list = None, + embed_unit: int = 128, + att_unit: int = 256, + dropout_rate: float = 0.5, + ignore_id: int = -1, + sos: int = 1, + eos: int = 2, + sentence_end_id: int = 3, + **kwargs, + ): + super().__init__() + + punc_size = len(punc_list) + if punc_weight is None: + punc_weight = [1] * punc_size + + self.embed = torch.nn.Embedding(vocab_size, embed_unit) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(**encoder_conf) + + self.decoder = torch.nn.Linear(att_unit, punc_size) + self.encoder = encoder + self.punc_list = punc_list + self.punc_weight = punc_weight + self.ignore_id = ignore_id + self.sos = sos + self.eos = eos + self.sentence_end_id = sentence_end_id + self.jieba_usr_dict = None + if kwargs.get("jieba_usr_dict", None) is not None: + jieba.load_userdict(kwargs["jieba_usr_dict"]) + self.jieba_usr_dict = jieba + + def punc_forward(self, text: torch.Tensor, text_lengths: torch.Tensor, **kwargs): + """Compute loss value from buffer sequences. + + Args: + input (torch.Tensor): Input ids. (batch, len) + hidden (torch.Tensor): Target ids. (batch, len) + + """ + x = self.embed(text) + # mask = self._target_mask(input) + h, _, _ = self.encoder(x, text_lengths) + y = self.decoder(h) + return y, None + + def with_vad(self): + return False + + def score(self, y: torch.Tensor, state: Any, x: torch.Tensor) -> Tuple[torch.Tensor, Any]: + """Score new token. + + Args: + y (torch.Tensor): 1D torch.int64 prefix tokens. + state: Scorer state for prefix tokens + x (torch.Tensor): encoder feature that generates ys. + + Returns: + tuple[torch.Tensor, Any]: Tuple of + torch.float32 scores for next token (vocab_size) + and next state for ys + + """ + y = y.unsqueeze(0) + h, _, cache = self.encoder.forward_one_step( + self.embed(y), self._target_mask(y), cache=state + ) + h = self.decoder(h[:, -1]) + logp = h.log_softmax(dim=-1).squeeze(0) + return logp, cache + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, vocab_size)` + and next state list for ys. + + """ + # merge states + n_batch = len(ys) + n_layers = len(self.encoder.encoders) + if states[0] is None: + batch_state = None + else: + # transpose state of [batch, layer] into [layer, batch] + batch_state = [ + torch.stack([states[b][i] for b in range(n_batch)]) for i in range(n_layers) + ] + + # batch decoding + h, _, states = self.encoder.forward_one_step( + self.embed(ys), self._target_mask(ys), cache=batch_state + ) + h = self.decoder(h[:, -1]) + logp = h.log_softmax(dim=-1) + + # transpose state of [layer, batch] into [batch, layer] + state_list = [[states[i][b] for i in range(n_layers)] for b in range(n_batch)] + return logp, state_list + + def nll( + self, + text: torch.Tensor, + punc: torch.Tensor, + text_lengths: torch.Tensor, + punc_lengths: torch.Tensor, + max_length: Optional[int] = None, + vad_indexes: Optional[torch.Tensor] = None, + vad_indexes_lengths: Optional[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute negative log likelihood(nll) + + Normally, this function is called in batchify_nll. + Args: + text: (Batch, Length) + punc: (Batch, Length) + text_lengths: (Batch,) + max_lengths: int + """ + batch_size = text.size(0) + # For data parallel + if max_length is None: + text = text[:, : text_lengths.max()] + punc = punc[:, : text_lengths.max()] + else: + text = text[:, :max_length] + punc = punc[:, :max_length] + + if self.with_vad(): + # Should be VadRealtimeTransformer + assert vad_indexes is not None + y, _ = self.punc_forward(text, text_lengths, vad_indexes) + else: + # Should be TargetDelayTransformer, + y, _ = self.punc_forward(text, text_lengths) + + # Calc negative log likelihood + # nll: (BxL,) + if self.training == False: + _, indices = y.view(-1, y.shape[-1]).topk(1, dim=1) + from sklearn.metrics import f1_score + + f1_score = f1_score( + punc.view(-1).detach().cpu().numpy(), + indices.squeeze(-1).detach().cpu().numpy(), + average="micro", + ) + nll = torch.Tensor([f1_score]).repeat(text_lengths.sum()) + return nll, text_lengths + else: + self.punc_weight = self.punc_weight.to(punc.device) + nll = F.cross_entropy( + y.view(-1, y.shape[-1]), + punc.view(-1), + self.punc_weight, + reduction="none", + ignore_index=self.ignore_id, + ) + # nll: (BxL,) -> (BxL,) + if max_length is None: + nll.masked_fill_(make_pad_mask(text_lengths).to(nll.device).view(-1), 0.0) + else: + nll.masked_fill_( + make_pad_mask(text_lengths, maxlen=max_length + 1).to(nll.device).view(-1), + 0.0, + ) + # nll: (BxL,) -> (B, L) + nll = nll.view(batch_size, -1) + return nll, text_lengths + + def forward( + self, + text: torch.Tensor, + punc: torch.Tensor, + text_lengths: torch.Tensor, + punc_lengths: torch.Tensor, + vad_indexes: Optional[torch.Tensor] = None, + vad_indexes_lengths: Optional[torch.Tensor] = None, + ): + nll, y_lengths = self.nll(text, punc, text_lengths, punc_lengths, vad_indexes=vad_indexes) + ntokens = y_lengths.sum() + loss = nll.sum() / ntokens + stats = dict(loss=loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + loss, stats, weight = force_gatherable((loss, stats, ntokens), loss.device) + return loss, stats, weight + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + assert len(data_in) == 1 + text = load_audio_text_image_video(data_in, data_type=kwargs.get("kwargs", "text"))[0] + vad_indexes = kwargs.get("vad_indexes", None) + # text = data_in[0] + # text_lengths = data_lengths[0] if data_lengths is not None else None + split_size = kwargs.get("split_size", 20) + + tokens = split_words(text, jieba_usr_dict=self.jieba_usr_dict) + tokens_int = tokenizer.encode(tokens) + + mini_sentences = split_to_mini_sentence(tokens, split_size) + mini_sentences_id = split_to_mini_sentence(tokens_int, split_size) + assert len(mini_sentences) == len(mini_sentences_id) + cache_sent = [] + cache_sent_id = torch.from_numpy(np.array([], dtype="int32")) + new_mini_sentence = "" + new_mini_sentence_punc = [] + cache_pop_trigger_limit = 200 + results = [] + meta_data = {} + punc_array = None + for mini_sentence_i in range(len(mini_sentences)): + mini_sentence = mini_sentences[mini_sentence_i] + mini_sentence_id = mini_sentences_id[mini_sentence_i] + mini_sentence = cache_sent + mini_sentence + mini_sentence_id = np.concatenate((cache_sent_id, mini_sentence_id), axis=0) + data = { + "text": torch.unsqueeze(torch.from_numpy(mini_sentence_id), 0), + "text_lengths": torch.from_numpy(np.array([len(mini_sentence_id)], dtype="int32")), + } + data = to_device(data, kwargs["device"]) + # y, _ = self.wrapped_model(**data) + y, _ = self.punc_forward(**data) + _, indices = y.view(-1, y.shape[-1]).topk(1, dim=1) + punctuations = torch.squeeze(indices, dim=1) + assert punctuations.size()[0] == len(mini_sentence) + + # Search for the last Period/QuestionMark as cache + if mini_sentence_i < len(mini_sentences) - 1: + sentenceEnd = -1 + last_comma_index = -1 + for i in range(len(punctuations) - 2, 1, -1): + if ( + self.punc_list[punctuations[i]] == "。" + or self.punc_list[punctuations[i]] == "?" + ): + sentenceEnd = i + break + if last_comma_index < 0 and self.punc_list[punctuations[i]] == ",": + last_comma_index = i + + if ( + sentenceEnd < 0 + and len(mini_sentence) > cache_pop_trigger_limit + and last_comma_index >= 0 + ): + # The sentence it too long, cut off at a comma. + sentenceEnd = last_comma_index + punctuations[sentenceEnd] = self.sentence_end_id + cache_sent = mini_sentence[sentenceEnd + 1 :] + cache_sent_id = mini_sentence_id[sentenceEnd + 1 :] + mini_sentence = mini_sentence[0 : sentenceEnd + 1] + punctuations = punctuations[0 : sentenceEnd + 1] + + # if len(punctuations) == 0: + # continue + + punctuations_np = punctuations.cpu().numpy() + new_mini_sentence_punc += [int(x) for x in punctuations_np] + words_with_punc = [] + for i in range(len(mini_sentence)): + if ( + i == 0 + or self.punc_list[punctuations[i - 1]] == "。" + or self.punc_list[punctuations[i - 1]] == "?" + ) and len(mini_sentence[i][0].encode()) == 1: + mini_sentence[i] = mini_sentence[i].capitalize() + if i == 0: + if len(mini_sentence[i][0].encode()) == 1: + mini_sentence[i] = " " + mini_sentence[i] + if i > 0: + if ( + len(mini_sentence[i][0].encode()) == 1 + and len(mini_sentence[i - 1][0].encode()) == 1 + ): + mini_sentence[i] = " " + mini_sentence[i] + words_with_punc.append(mini_sentence[i]) + if self.punc_list[punctuations[i]] != "_": + punc_res = self.punc_list[punctuations[i]] + if len(mini_sentence[i][0].encode()) == 1: + if punc_res == ",": + punc_res = "," + elif punc_res == "。": + punc_res = "." + elif punc_res == "?": + punc_res = "?" + words_with_punc.append(punc_res) + new_mini_sentence += "".join(words_with_punc) + # Add Period for the end of the sentence + new_mini_sentence_out = new_mini_sentence + new_mini_sentence_punc_out = new_mini_sentence_punc + if mini_sentence_i == len(mini_sentences) - 1: + if new_mini_sentence[-1] == "," or new_mini_sentence[-1] == "、": + new_mini_sentence_out = new_mini_sentence[:-1] + "。" + new_mini_sentence_punc_out = new_mini_sentence_punc[:-1] + [ + self.sentence_end_id + ] + elif new_mini_sentence[-1] == ",": + new_mini_sentence_out = new_mini_sentence[:-1] + "." + new_mini_sentence_punc_out = new_mini_sentence_punc[:-1] + [ + self.sentence_end_id + ] + elif ( + new_mini_sentence[-1] != "。" + and new_mini_sentence[-1] != "?" + and len(new_mini_sentence[-1].encode()) != 1 + ): + new_mini_sentence_out = new_mini_sentence + "。" + new_mini_sentence_punc_out = new_mini_sentence_punc[:-1] + [ + self.sentence_end_id + ] + if len(punctuations): + punctuations[-1] = 2 + elif ( + new_mini_sentence[-1] != "." + and new_mini_sentence[-1] != "?" + and len(new_mini_sentence[-1].encode()) == 1 + ): + new_mini_sentence_out = new_mini_sentence + "." + new_mini_sentence_punc_out = new_mini_sentence_punc[:-1] + [ + self.sentence_end_id + ] + if len(punctuations): + punctuations[-1] = 2 + # keep a punctuations array for punc segment + if punc_array is None: + punc_array = punctuations + else: + punc_array = torch.cat([punc_array, punctuations], dim=0) + + # post processing when using word level punc model + if self.jieba_usr_dict is not None: + punc_array = punc_array.reshape(-1) + len_tokens = len(tokens) + new_punc_array = copy.copy(punc_array).tolist() + # for i, (token, punc_id) in enumerate(zip(tokens[::-1], punc_array.tolist()[::-1])): + for i, token in enumerate(tokens[::-1]): + if "\u0e00" <= token[0] <= "\u9fa5": # ignore en words + if len(token) > 1: + num_append = len(token) - 1 + ind_append = len_tokens - i - 1 + for _ in range(num_append): + new_punc_array.insert(ind_append, 1) + punc_array = torch.tensor(new_punc_array) + + result_i = {"key": key[0], "text": new_mini_sentence_out, "punc_array": punc_array} + results.append(result_i) + return results, meta_data + + def export(self, **kwargs): + + from .export_meta import export_rebuild_model + + models = export_rebuild_model(model=self, **kwargs) + return models diff --git a/funasr/models/ct_transformer/template.yaml b/funasr/models/ct_transformer/template.yaml new file mode 100644 index 0000000..2538e6b --- /dev/null +++ b/funasr/models/ct_transformer/template.yaml @@ -0,0 +1,53 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +model: CTTransformer +model_conf: + ignore_id: 0 + embed_unit: 256 + att_unit: 256 + dropout_rate: 0.1 + punc_list: + - + - _ + - ',' + - 。 + - '?' + - 、 + punc_weight: + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + sentence_end_id: 3 + +encoder: SANMEncoder +encoder_conf: + input_size: 256 + output_size: 256 + attention_heads: 8 + linear_units: 1024 + num_blocks: 4 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + padding_idx: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + + + diff --git a/funasr/models/ct_transformer/utils.py b/funasr/models/ct_transformer/utils.py new file mode 100644 index 0000000..b6e11e7 --- /dev/null +++ b/funasr/models/ct_transformer/utils.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import re + + +def split_to_mini_sentence(words: list, word_limit: int = 20): + assert word_limit > 1 + if len(words) <= word_limit: + return [words] + sentences = [] + length = len(words) + sentence_len = length // word_limit + for i in range(sentence_len): + sentences.append(words[i * word_limit : (i + 1) * word_limit]) + if length % word_limit > 0: + sentences.append(words[sentence_len * word_limit :]) + return sentences + + +def split_words(text: str, jieba_usr_dict=None, **kwargs): + if jieba_usr_dict: + input_list = text.split() + token_list_all = [] + langauge_list = [] + token_list_tmp = [] + language_flag = None + for token in input_list: + if isEnglish(token) and language_flag == "Chinese": + token_list_all.append(token_list_tmp) + langauge_list.append("Chinese") + token_list_tmp = [] + elif not isEnglish(token) and language_flag == "English": + token_list_all.append(token_list_tmp) + langauge_list.append("English") + token_list_tmp = [] + + token_list_tmp.append(token) + + if isEnglish(token): + language_flag = "English" + else: + language_flag = "Chinese" + + if token_list_tmp: + token_list_all.append(token_list_tmp) + langauge_list.append(language_flag) + + result_list = [] + for token_list_tmp, language_flag in zip(token_list_all, langauge_list): + if language_flag == "English": + result_list.extend(token_list_tmp) + else: + seg_list = jieba_usr_dict.cut(join_chinese_and_english(token_list_tmp), HMM=False) + result_list.extend(seg_list) + + return result_list + + else: + words = [] + segs = text.split() + for seg in segs: + # There is no space in seg. + current_word = "" + for c in seg: + if len(c.encode()) == 1: + # This is an ASCII char. + current_word += c + else: + # This is a Chinese char. + if len(current_word) > 0: + words.append(current_word) + current_word = "" + words.append(c) + if len(current_word) > 0: + words.append(current_word) + return words + + +def isEnglish(text: str): + if re.search("^[a-zA-Z']+$", text): + return True + else: + return False + + +def join_chinese_and_english(input_list): + line = "" + for token in input_list: + if isEnglish(token): + line = line + " " + token + else: + line = line + token + + line = line.strip() + return line diff --git a/funasr/models/ct_transformer_streaming/__init__.py b/funasr/models/ct_transformer_streaming/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/ct_transformer_streaming/attention.py b/funasr/models/ct_transformer_streaming/attention.py new file mode 100644 index 0000000..97e770b --- /dev/null +++ b/funasr/models/ct_transformer_streaming/attention.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +from funasr.models.sanm.attention import MultiHeadedAttentionSANM + + +class MultiHeadedAttentionSANMwithMask(MultiHeadedAttentionSANM): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def forward(self, x, mask, mask_shfit_chunk=None, mask_att_chunk_encoder=None): + q_h, k_h, v_h, v = self.forward_qkv(x) + fsmn_memory = self.forward_fsmn(v, mask[0], mask_shfit_chunk) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, mask[1], mask_att_chunk_encoder) + return att_outs + fsmn_memory diff --git a/funasr/models/ct_transformer_streaming/encoder.py b/funasr/models/ct_transformer_streaming/encoder.py new file mode 100644 index 0000000..a61319a --- /dev/null +++ b/funasr/models/ct_transformer_streaming/encoder.py @@ -0,0 +1,506 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +from typing import List, Optional, Tuple + +from funasr.register import tables +from funasr.models.ctc.ctc import CTC +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.sanm.attention import MultiHeadedAttention +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.utils.subsampling import check_short_utt +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.embedding import SinusoidalPositionEncoder +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.mask import subsequent_mask, vad_mask +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.positionwise_feed_forward import PositionwiseFeedForward +from funasr.models.ct_transformer_streaming.attention import MultiHeadedAttentionSANMwithMask +from funasr.models.transformer.utils.subsampling import ( + Conv2dSubsampling, + Conv2dSubsampling2, + Conv2dSubsampling6, + Conv2dSubsampling8, +) + + +class EncoderLayerSANM(torch.nn.Module): + def __init__( + self, + in_size, + size, + self_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayerSANM, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(in_size) + self.norm2 = LayerNorm(size) + self.dropout = torch.nn.Dropout(dropout_rate) + self.in_size = in_size + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = torch.nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + self.dropout_rate = dropout_rate + + def forward(self, x, mask, cache=None, mask_shfit_chunk=None, mask_att_chunk_encoder=None): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + return x, mask + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if self.concat_after: + x_concat = torch.cat( + ( + x, + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ), + ), + dim=-1, + ) + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = stoch_layer_coeff * self.concat_linear(x_concat) + else: + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.dropout( + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ) + ) + else: + x = stoch_layer_coeff * self.dropout( + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ) + ) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + stoch_layer_coeff * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm2(x) + + return x, mask, cache, mask_shfit_chunk, mask_att_chunk_encoder + + def forward_chunk(self, x, cache=None, chunk_size=None, look_back=0): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if self.in_size == self.size: + attn, cache = self.self_attn.forward_chunk(x, cache, chunk_size, look_back) + x = residual + attn + else: + x, cache = self.self_attn.forward_chunk(x, cache, chunk_size, look_back) + + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + self.feed_forward(x) + if not self.normalize_before: + x = self.norm2(x) + + return x, cache + + +@tables.register("encoder_classes", "SANMVadEncoder") +class SANMVadEncoder(torch.nn.Module): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: Optional[str] = "conv2d", + pos_enc_class=SinusoidalPositionEncoder, + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 1, + padding_idx: int = -1, + interctc_layer_idx: List[int] = [], + interctc_use_conditioning: bool = False, + kernel_size: int = 11, + sanm_shfit: int = 0, + selfattention_layer_type: str = "sanm", + ): + super().__init__() + self._output_size = output_size + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling(input_size, output_size, dropout_rate) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2(input_size, output_size, dropout_rate) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6(input_size, output_size, dropout_rate) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8(input_size, output_size, dropout_rate) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + SinusoidalPositionEncoder(), + ) + elif input_layer is None: + if input_size == output_size: + self.embed = None + else: + self.embed = torch.nn.Linear(input_size, output_size) + elif input_layer == "pe": + self.embed = SinusoidalPositionEncoder() + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + + if selfattention_layer_type == "selfattn": + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + + elif selfattention_layer_type == "sanm": + self.encoder_selfattn_layer = MultiHeadedAttentionSANMwithMask + encoder_selfattn_layer_args0 = ( + attention_heads, + input_size, + output_size, + attention_dropout_rate, + kernel_size, + sanm_shfit, + ) + + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + output_size, + attention_dropout_rate, + kernel_size, + sanm_shfit, + ) + + self.encoders0 = repeat( + 1, + lambda lnum: EncoderLayerSANM( + input_size, + output_size, + self.encoder_selfattn_layer(*encoder_selfattn_layer_args0), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + self.encoders = repeat( + num_blocks - 1, + lambda lnum: EncoderLayerSANM( + output_size, + output_size, + self.encoder_selfattn_layer(*encoder_selfattn_layer_args), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + + self.interctc_layer_idx = interctc_layer_idx + if len(interctc_layer_idx) > 0: + assert 0 < min(interctc_layer_idx) and max(interctc_layer_idx) < num_blocks + self.interctc_use_conditioning = interctc_use_conditioning + self.conditioning_layer = None + self.dropout = torch.nn.Dropout(dropout_rate) + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + vad_indexes: torch.Tensor, + prev_states: torch.Tensor = None, + ctc: CTC = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Embed positions in tensor. + + Args: + xs_pad: input tensor (B, L, D) + ilens: input length (B) + prev_states: Not to be used now. + Returns: + position embedded tensor and mask + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + sub_masks = subsequent_mask(masks.size(-1), device=xs_pad.device).unsqueeze(0) + no_future_masks = masks & sub_masks + xs_pad *= self.output_size() ** 0.5 + if self.embed is None: + xs_pad = xs_pad + elif ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + + # xs_pad = self.dropout(xs_pad) + mask_tup0 = [masks, no_future_masks] + encoder_outs = self.encoders0(xs_pad, mask_tup0) + xs_pad, _ = encoder_outs[0], encoder_outs[1] + intermediate_outs = [] + + for layer_idx, encoder_layer in enumerate(self.encoders): + if layer_idx + 1 == len(self.encoders): + # This is last layer. + coner_mask = torch.ones( + masks.size(0), + masks.size(-1), + masks.size(-1), + device=xs_pad.device, + dtype=torch.bool, + ) + for word_index, length in enumerate(ilens): + coner_mask[word_index, :, :] = vad_mask( + masks.size(-1), vad_indexes[word_index], device=xs_pad.device + ) + layer_mask = masks & coner_mask + else: + layer_mask = no_future_masks + mask_tup1 = [masks, layer_mask] + encoder_outs = encoder_layer(xs_pad, mask_tup1) + xs_pad, layer_mask = encoder_outs[0], encoder_outs[1] + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + olens = masks.squeeze(1).sum(1) + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), olens, None + return xs_pad, olens, None + + +class EncoderLayerSANMExport(torch.nn.Module): + def __init__( + self, + model, + ): + """Construct an EncoderLayer object.""" + super().__init__() + self.self_attn = model.self_attn + self.feed_forward = model.feed_forward + self.norm1 = model.norm1 + self.norm2 = model.norm2 + self.in_size = model.in_size + self.size = model.size + + def forward(self, x, mask): + + residual = x + x = self.norm1(x) + x = self.self_attn(x, mask) + if self.in_size == self.size: + x = x + residual + residual = x + x = self.norm2(x) + x = self.feed_forward(x) + x = x + residual + + return x, mask + + +@tables.register("encoder_classes", "SANMVadEncoderExport") +class SANMVadEncoderExport(torch.nn.Module): + def __init__( + self, + model, + max_seq_len=512, + feats_dim=560, + model_name="encoder", + onnx: bool = True, + ): + super().__init__() + self.embed = model.embed + self.model = model + self._output_size = model._output_size + + from funasr.utils.torch_function import sequence_mask + + self.make_pad_mask = sequence_mask(max_seq_len, flip=False) + + from funasr.models.sanm.attention import MultiHeadedAttentionSANMExport + + if hasattr(model, "encoders0"): + for i, d in enumerate(self.model.encoders0): + if isinstance(d.self_attn, MultiHeadedAttentionSANMwithMask): + d.self_attn = MultiHeadedAttentionSANMExport(d.self_attn) + self.model.encoders0[i] = EncoderLayerSANMExport(d) + + for i, d in enumerate(self.model.encoders): + if isinstance(d.self_attn, MultiHeadedAttentionSANMwithMask): + d.self_attn = MultiHeadedAttentionSANMExport(d.self_attn) + self.model.encoders[i] = EncoderLayerSANMExport(d) + + def prepare_mask(self, mask, sub_masks): + mask_3d_btd = mask[:, :, None] + mask_4d_bhlt = (1 - sub_masks) * -10000.0 + + return mask_3d_btd, mask_4d_bhlt + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + vad_masks: torch.Tensor, + sub_masks: torch.Tensor, + ): + speech = speech * self._output_size**0.5 + mask = self.make_pad_mask(speech_lengths) + vad_masks = self.prepare_mask(mask, vad_masks) + mask = self.prepare_mask(mask, sub_masks) + + if self.embed is None: + xs_pad = speech + else: + xs_pad = self.embed(speech) + + encoder_outs = self.model.encoders0(xs_pad, mask) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + + # encoder_outs = self.model.encoders(xs_pad, mask) + for layer_idx, encoder_layer in enumerate(self.model.encoders): + if layer_idx == len(self.model.encoders) - 1: + mask = vad_masks + encoder_outs = encoder_layer(xs_pad, mask) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + + xs_pad = self.model.after_norm(xs_pad) + + return xs_pad, speech_lengths + + def get_output_size(self): + return self.model.encoders[0].size diff --git a/funasr/models/ct_transformer_streaming/export_meta.py b/funasr/models/ct_transformer_streaming/export_meta.py new file mode 100644 index 0000000..ba0283e --- /dev/null +++ b/funasr/models/ct_transformer_streaming/export_meta.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import types +import torch +from funasr.register import tables + + +def export_rebuild_model(model, **kwargs): + + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + model.forward = types.MethodType(export_forward, model) + model.export_dummy_inputs = types.MethodType(export_dummy_inputs, model) + model.export_input_names = types.MethodType(export_input_names, model) + model.export_output_names = types.MethodType(export_output_names, model) + model.export_dynamic_axes = types.MethodType(export_dynamic_axes, model) + model.export_name = types.MethodType(export_name, model) + + return model + + +def export_forward( + self, + inputs: torch.Tensor, + text_lengths: torch.Tensor, + vad_indexes: torch.Tensor, + sub_masks: torch.Tensor, +): + """Compute loss value from buffer sequences. + + Args: + input (torch.Tensor): Input ids. (batch, len) + hidden (torch.Tensor): Target ids. (batch, len) + + """ + x = self.embed(inputs) + # mask = self._target_mask(input) + h, _ = self.encoder(x, text_lengths, vad_indexes, sub_masks) + y = self.decoder(h) + return y + + +def export_dummy_inputs(self): + length = 120 + text_indexes = torch.randint(0, self.embed.num_embeddings, (1, length)).type(torch.int32) + text_lengths = torch.tensor([length], dtype=torch.int32) + vad_mask = torch.ones(length, length, dtype=torch.float32)[None, None, :, :] + sub_masks = torch.ones(length, length, dtype=torch.float32) + sub_masks = torch.tril(sub_masks).type(torch.float32) + return (text_indexes, text_lengths, vad_mask, sub_masks[None, None, :, :]) + + +def export_input_names(self): + return ["inputs", "text_lengths", "vad_masks", "sub_masks"] + + +def export_output_names(self): + return ["logits"] + + +def export_dynamic_axes(self): + return { + "inputs": {1: "feats_length"}, + "vad_masks": {2: "feats_length1", 3: "feats_length2"}, + "sub_masks": {2: "feats_length1", 3: "feats_length2"}, + "logits": {1: "logits_length"}, + } + + +def export_name(self): + return "model.onnx" diff --git a/funasr/models/ct_transformer_streaming/model.py b/funasr/models/ct_transformer_streaming/model.py new file mode 100644 index 0000000..a1afc7a --- /dev/null +++ b/funasr/models/ct_transformer_streaming/model.py @@ -0,0 +1,193 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import numpy as np +from contextlib import contextmanager +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.train_utils.device_funcs import to_device +from funasr.models.ct_transformer.model import CTTransformer +from funasr.utils.load_utils import load_audio_text_image_video +from funasr.models.ct_transformer.utils import split_to_mini_sentence, split_words + + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "CTTransformerStreaming") +class CTTransformerStreaming(CTTransformer): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + CT-Transformer: Controllable time-delay transformer for real-time punctuation prediction and disfluency detection + https://arxiv.org/pdf/2003.01309.pdf + """ + + def __init__( + self, + *args, + **kwargs, + ): + super().__init__(*args, **kwargs) + + def punc_forward( + self, text: torch.Tensor, text_lengths: torch.Tensor, vad_indexes: torch.Tensor, **kwargs + ): + """Compute loss value from buffer sequences. + + Args: + input (torch.Tensor): Input ids. (batch, len) + hidden (torch.Tensor): Target ids. (batch, len) + + """ + x = self.embed(text) + # mask = self._target_mask(input) + h, _, _ = self.encoder(x, text_lengths, vad_indexes=vad_indexes) + y = self.decoder(h) + return y, None + + def with_vad(self): + return True + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + cache: dict = {}, + **kwargs, + ): + assert len(data_in) == 1 + + if len(cache) == 0: + cache["pre_text"] = [] + text = load_audio_text_image_video(data_in, data_type=kwargs.get("kwargs", "text"))[0] + text = "".join(cache["pre_text"]) + " " + text + + split_size = kwargs.get("split_size", 20) + + tokens = split_words(text) + tokens_int = tokenizer.encode(tokens) + + mini_sentences = split_to_mini_sentence(tokens, split_size) + mini_sentences_id = split_to_mini_sentence(tokens_int, split_size) + assert len(mini_sentences) == len(mini_sentences_id) + cache_sent = [] + cache_sent_id = torch.from_numpy(np.array([], dtype="int32")) + skip_num = 0 + sentence_punc_list = [] + sentence_words_list = [] + cache_pop_trigger_limit = 200 + results = [] + meta_data = {} + punc_array = None + for mini_sentence_i in range(len(mini_sentences)): + mini_sentence = mini_sentences[mini_sentence_i] + mini_sentence_id = mini_sentences_id[mini_sentence_i] + mini_sentence = cache_sent + mini_sentence + mini_sentence_id = np.concatenate((cache_sent_id, mini_sentence_id), axis=0) + data = { + "text": torch.unsqueeze(torch.from_numpy(mini_sentence_id), 0), + "text_lengths": torch.from_numpy(np.array([len(mini_sentence_id)], dtype="int32")), + "vad_indexes": torch.from_numpy(np.array([len(cache["pre_text"])], dtype="int32")), + } + data = to_device(data, kwargs["device"]) + # y, _ = self.wrapped_model(**data) + y, _ = self.punc_forward(**data) + _, indices = y.view(-1, y.shape[-1]).topk(1, dim=1) + punctuations = indices + if indices.size()[0] != 1: + punctuations = torch.squeeze(indices) + assert punctuations.size()[0] == len(mini_sentence) + + # Search for the last Period/QuestionMark as cache + if mini_sentence_i < len(mini_sentences) - 1: + sentenceEnd = -1 + last_comma_index = -1 + for i in range(len(punctuations) - 2, 1, -1): + if ( + self.punc_list[punctuations[i]] == "。" + or self.punc_list[punctuations[i]] == "?" + ): + sentenceEnd = i + break + if last_comma_index < 0 and self.punc_list[punctuations[i]] == ",": + last_comma_index = i + + if ( + sentenceEnd < 0 + and len(mini_sentence) > cache_pop_trigger_limit + and last_comma_index >= 0 + ): + # The sentence it too long, cut off at a comma. + sentenceEnd = last_comma_index + punctuations[sentenceEnd] = self.sentence_end_id + cache_sent = mini_sentence[sentenceEnd + 1 :] + cache_sent_id = mini_sentence_id[sentenceEnd + 1 :] + mini_sentence = mini_sentence[0 : sentenceEnd + 1] + punctuations = punctuations[0 : sentenceEnd + 1] + + # if len(punctuations) == 0: + # continue + + punctuations_np = punctuations.cpu().numpy() + sentence_punc_list += [self.punc_list[int(x)] for x in punctuations_np] + sentence_words_list += mini_sentence + + assert len(sentence_punc_list) == len(sentence_words_list) + words_with_punc = [] + sentence_punc_list_out = [] + for i in range(0, len(sentence_words_list)): + if i > 0: + if ( + len(sentence_words_list[i][0].encode()) == 1 + and len(sentence_words_list[i - 1][-1].encode()) == 1 + ): + sentence_words_list[i] = " " + sentence_words_list[i] + if skip_num < len(cache["pre_text"]): + skip_num += 1 + else: + words_with_punc.append(sentence_words_list[i]) + if skip_num >= len(cache["pre_text"]): + sentence_punc_list_out.append(sentence_punc_list[i]) + if sentence_punc_list[i] != "_": + words_with_punc.append(sentence_punc_list[i]) + sentence_out = "".join(words_with_punc) + + sentenceEnd = -1 + for i in range(len(sentence_punc_list) - 2, 1, -1): + if sentence_punc_list[i] == "。" or sentence_punc_list[i] == "?": + sentenceEnd = i + break + cache["pre_text"] = sentence_words_list[sentenceEnd + 1 :] + if sentence_out[-1] in self.punc_list: + sentence_out = sentence_out[:-1] + sentence_punc_list_out[-1] = "_" + # keep a punctuations array for punc segment + if punc_array is None: + punc_array = punctuations + else: + punc_array = torch.cat([punc_array, punctuations], dim=0) + + result_i = {"key": key[0], "text": sentence_out, "punc_array": punc_array} + results.append(result_i) + + return results, meta_data + + def export(self, **kwargs): + + from .export_meta import export_rebuild_model + + models = export_rebuild_model(model=self, **kwargs) + return models diff --git a/funasr/models/ct_transformer_streaming/template.yaml b/funasr/models/ct_transformer_streaming/template.yaml new file mode 100644 index 0000000..2477ac2 --- /dev/null +++ b/funasr/models/ct_transformer_streaming/template.yaml @@ -0,0 +1,50 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +model: CTTransformerStreaming +model_conf: + ignore_id: 0 + embed_unit: 256 + att_unit: 256 + dropout_rate: 0.1 + punc_list: + - + - _ + - , + - 。 + - ? + - 、 + punc_weight: + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + sentence_end_id: 3 + +encoder: SANMVadEncoder +encoder_conf: + input_size: 256 + output_size: 256 + attention_heads: 8 + linear_units: 1024 + num_blocks: 3 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 5 + selfattention_layer_type: sanm + padding_idx: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: \ No newline at end of file diff --git a/funasr/models/ctc/__init__.py b/funasr/models/ctc/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/ctc/ctc.py b/funasr/models/ctc/ctc.py new file mode 100644 index 0000000..bdfb3a6 --- /dev/null +++ b/funasr/models/ctc/ctc.py @@ -0,0 +1,178 @@ +import logging + +import torch +import torch.nn.functional as F + + +class CTC(torch.nn.Module): + """CTC module. + + Args: + odim: dimension of outputs + encoder_output_size: number of encoder projection units + dropout_rate: dropout rate (0.0 ~ 1.0) + ctc_type: builtin or warpctc + reduce: reduce the CTC loss into a scalar + """ + + def __init__( + self, + odim: int, + encoder_output_size: int, + dropout_rate: float = 0.0, + ctc_type: str = "builtin", + reduce: bool = True, + ignore_nan_grad: bool = True, + ): + super().__init__() + eprojs = encoder_output_size + self.dropout_rate = dropout_rate + self.ctc_lo = torch.nn.Linear(eprojs, odim) + self.ctc_type = ctc_type + self.ignore_nan_grad = ignore_nan_grad + + if self.ctc_type == "builtin": + self.ctc_loss = torch.nn.CTCLoss(reduction="none") + elif self.ctc_type == "warpctc": + import warpctc_pytorch as warp_ctc + + if ignore_nan_grad: + logging.warning("ignore_nan_grad option is not supported for warp_ctc") + self.ctc_loss = warp_ctc.CTCLoss(size_average=True, reduce=reduce) + else: + raise ValueError(f'ctc_type must be "builtin" or "warpctc": {self.ctc_type}') + + self.reduce = reduce + + def loss_fn(self, th_pred, th_target, th_ilen, th_olen) -> torch.Tensor: + if self.ctc_type == "builtin": + th_pred = th_pred.log_softmax(2) + loss = self.ctc_loss(th_pred, th_target, th_ilen, th_olen) + + if loss.requires_grad and self.ignore_nan_grad: + # ctc_grad: (L, B, O) + ctc_grad = loss.grad_fn(torch.ones_like(loss)) + ctc_grad = ctc_grad.sum([0, 2]) + indices = torch.isfinite(ctc_grad) + size = indices.long().sum() + if size == 0: + # Return as is + logging.warning( + "All samples in this mini-batch got nan grad." + " Returning nan value instead of CTC loss" + ) + elif size != th_pred.size(1): + logging.warning( + f"{th_pred.size(1) - size}/{th_pred.size(1)}" + " samples got nan grad." + " These were ignored for CTC loss." + ) + + # Create mask for target + target_mask = torch.full( + [th_target.size(0)], + 1, + dtype=torch.bool, + device=th_target.device, + ) + s = 0 + for ind, le in enumerate(th_olen): + if not indices[ind]: + target_mask[s : s + le] = 0 + s += le + + # Calc loss again using maksed data + loss = self.ctc_loss( + th_pred[:, indices, :], + th_target[target_mask], + th_ilen[indices], + th_olen[indices], + ) + else: + size = th_pred.size(1) + + if self.reduce: + # Batch-size average + loss = loss.sum() / size + else: + loss = loss / size + return loss + + elif self.ctc_type == "warpctc": + # warpctc only supports float32 + th_pred = th_pred.to(dtype=torch.float32) + + th_target = th_target.cpu().int() + th_ilen = th_ilen.cpu().int() + th_olen = th_olen.cpu().int() + loss = self.ctc_loss(th_pred, th_target, th_ilen, th_olen) + if self.reduce: + # NOTE: sum() is needed to keep consistency since warpctc + # return as tensor w/ shape (1,) + # but builtin return as tensor w/o shape (scalar). + loss = loss.sum() + return loss + + elif self.ctc_type == "gtnctc": + log_probs = torch.nn.functional.log_softmax(th_pred, dim=2) + return self.ctc_loss(log_probs, th_target, th_ilen, 0, "none") + + else: + raise NotImplementedError + + def forward(self, hs_pad, hlens, ys_pad, ys_lens): + """Calculate CTC loss. + + Args: + hs_pad: batch of padded hidden state sequences (B, Tmax, D) + hlens: batch of lengths of hidden state sequences (B) + ys_pad: batch of padded character id sequence tensor (B, Lmax) + ys_lens: batch of lengths of character sequence (B) + """ + # hs_pad: (B, L, NProj) -> ys_hat: (B, L, Nvocab) + ys_hat = self.ctc_lo(F.dropout(hs_pad, p=self.dropout_rate)) + + if self.ctc_type == "gtnctc": + # gtn expects list form for ys + ys_true = [y[y != -1] for y in ys_pad] # parse padded ys + else: + # ys_hat: (B, L, D) -> (L, B, D) + ys_hat = ys_hat.transpose(0, 1) + # (B, L) -> (BxL,) + ys_true = torch.cat([ys_pad[i, :l] for i, l in enumerate(ys_lens)]) + + loss = self.loss_fn(ys_hat, ys_true, hlens, ys_lens).to( + device=hs_pad.device, dtype=hs_pad.dtype + ) + + return loss + + def softmax(self, hs_pad): + """softmax of frame activations + + Args: + Tensor hs_pad: 3d tensor (B, Tmax, eprojs) + Returns: + torch.Tensor: softmax applied 3d tensor (B, Tmax, odim) + """ + return F.softmax(self.ctc_lo(hs_pad), dim=2) + + def log_softmax(self, hs_pad): + """log_softmax of frame activations + + Args: + Tensor hs_pad: 3d tensor (B, Tmax, eprojs) + Returns: + torch.Tensor: log softmax applied 3d tensor (B, Tmax, odim) + """ + return F.log_softmax(self.ctc_lo(hs_pad), dim=2) + + def argmax(self, hs_pad): + """argmax of frame activations + + Args: + torch.Tensor hs_pad: 3d tensor (B, Tmax, eprojs) + Returns: + torch.Tensor: argmax applied 2d tensor (B, Tmax) + """ + return torch.argmax(self.ctc_lo(hs_pad), dim=2) diff --git a/funasr/models/data2vec/__init__.py b/funasr/models/data2vec/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/data2vec/data2vec.py b/funasr/models/data2vec/data2vec.py new file mode 100644 index 0000000..ed58d1c --- /dev/null +++ b/funasr/models/data2vec/data2vec.py @@ -0,0 +1,153 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +from contextlib import contextmanager +from distutils.version import LooseVersion +from typing import Dict +from typing import Optional +from typing import Tuple + +import torch +import torch.nn as nn + +# from funasr.layers.abs_normalize import AbsNormalize +# from funasr.models.base_model import FunASRModel +# from funasr.models.encoder.abs_encoder import AbsEncoder +from funasr.frontends.abs_frontend import AbsFrontend + +# from funasr.models.preencoder.abs_preencoder import AbsPreEncoder +# from funasr.models.specaug.abs_specaug import AbsSpecAug +from funasr.train_utils.device_funcs import force_gatherable + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +class Data2VecPretrainModel(nn.Module): + """Data2Vec Pretrain model""" + + def __init__( + self, + frontend=None, + specaug=None, + normalize=None, + encoder=None, + preencoder=None, + ): + + super().__init__() + + self.frontend = frontend + self.specaug = specaug + self.normalize = normalize + self.preencoder = preencoder + self.encoder = encoder + self.num_updates = 0 + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + # Check that batch_size is unified + assert speech.shape[0] == speech_lengths.shape[0], (speech.shape, speech_lengths.shape) + + self.encoder.set_num_updates(self.num_updates) + + # 1. Encoder + encoder_out = self.encode(speech, speech_lengths) + + losses = encoder_out["losses"] + loss = sum(losses.values()) + sample_size = encoder_out["sample_size"] + loss = loss.sum() / sample_size + + target_var = float(encoder_out["target_var"]) + pred_var = float(encoder_out["pred_var"]) + ema_decay = float(encoder_out["ema_decay"]) + + stats = dict( + loss=torch.clone(loss.detach()), + target_var=target_var, + pred_var=pred_var, + ema_decay=ema_decay, + ) + + loss, stats, weight = force_gatherable((loss, stats, sample_size), loss.device) + return loss, stats, weight + + def collect_feats( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Dict[str, torch.Tensor]: + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + return {"feats": feats, "feats_lengths": feats_lengths} + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + ): + """Frontend + Encoder. + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + with autocast(False): + # 1. Extract feats + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + + # 2. Data augmentation + if self.specaug is not None and self.training: + feats, feats_lengths = self.specaug(feats, feats_lengths) + + # 3. Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + feats, feats_lengths = self.normalize(feats, feats_lengths) + + # Pre-encoder, e.g. used for raw input data + if self.preencoder is not None: + feats, feats_lengths = self.preencoder(feats, feats_lengths) + + # 4. Forward encoder + if min(speech_lengths) == max(speech_lengths): # for clipping, set speech_lengths as None + speech_lengths = None + encoder_out = self.encoder(feats, speech_lengths, mask=True, features_only=False) + + return encoder_out + + def _extract_feats( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + assert speech_lengths.dim() == 1, speech_lengths.shape + + # for data-parallel + speech = speech[:, : speech_lengths.max()] + + if self.frontend is not None: + # Frontend + # e.g. STFT and Feature extract + # data_loader may send time-domain signal in this case + # speech (Batch, NSamples) -> feats: (Batch, NFrames, Dim) + feats, feats_lengths = self.frontend(speech, speech_lengths) + else: + # No frontend and no feature extract + feats, feats_lengths = speech, speech_lengths + return feats, feats_lengths + + def set_num_updates(self, num_updates): + self.num_updates = num_updates + + def get_num_updates(self): + return self.num_updates diff --git a/funasr/models/data2vec/data2vec_encoder.py b/funasr/models/data2vec/data2vec_encoder.py new file mode 100644 index 0000000..f591dd6 --- /dev/null +++ b/funasr/models/data2vec/data2vec_encoder.py @@ -0,0 +1,563 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import logging +import math + +import torch +import torch.distributed as dist +import torch.nn as nn +import torch.nn.functional as F + +from funasr.models.data2vec.data_utils import compute_mask_indices +from funasr.models.data2vec.ema_module import EMAModule +from funasr.models.data2vec.grad_multiply import GradMultiply +from funasr.models.data2vec.wav2vec2 import ( + ConvFeatureExtractionModel, + TransformerEncoder, +) +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +def get_annealed_rate(start, end, curr_step, total_steps): + r = end - start + pct_remaining = 1 - curr_step / total_steps + return end - r * pct_remaining + + +class Data2VecEncoder(nn.Module): + def __init__( + self, + # for ConvFeatureExtractionModel + input_size: int = None, + extractor_mode: str = None, + conv_feature_layers: str = "[(512,2,2)] + [(512,2,2)]", + # for Transformer Encoder + ## model architecture + layer_type: str = "transformer", + layer_norm_first: bool = False, + encoder_layers: int = 12, + encoder_embed_dim: int = 768, + encoder_ffn_embed_dim: int = 3072, + encoder_attention_heads: int = 12, + activation_fn: str = "gelu", + ## dropouts + dropout: float = 0.1, + attention_dropout: float = 0.1, + activation_dropout: float = 0.0, + encoder_layerdrop: float = 0.0, + dropout_input: float = 0.0, + dropout_features: float = 0.0, + ## grad settings + feature_grad_mult: float = 1.0, + ## masking + mask_prob: float = 0.65, + mask_length: int = 10, + mask_selection: str = "static", + mask_other: int = 0, + no_mask_overlap: bool = False, + mask_min_space: int = 1, + require_same_masks: bool = True, # if set as True, collate_fn should be clipping + mask_dropout: float = 0.0, + ## channel masking + mask_channel_length: int = 10, + mask_channel_prob: float = 0.0, + mask_channel_before: bool = False, + mask_channel_selection: str = "static", + mask_channel_other: int = 0, + no_mask_channel_overlap: bool = False, + mask_channel_min_space: int = 1, + ## positional embeddings + conv_pos: int = 128, + conv_pos_groups: int = 16, + pos_conv_depth: int = 1, + max_positions: int = 100000, + # EMA module + average_top_k_layers: int = 8, + layer_norm_target_layer: bool = False, + instance_norm_target_layer: bool = False, + instance_norm_targets: bool = False, + layer_norm_targets: bool = False, + batch_norm_target_layer: bool = False, + group_norm_target_layer: bool = False, + ema_decay: float = 0.999, + ema_end_decay: float = 0.9999, + ema_anneal_end_step: int = 100000, + ema_transformer_only: bool = True, + ema_layers_only: bool = True, + min_target_var: float = 0.1, + min_pred_var: float = 0.01, + # Loss + loss_beta: float = 0.0, + loss_scale: float = None, + # FP16 optimization + required_seq_len_multiple: int = 2, + ): + super().__init__() + + # ConvFeatureExtractionModel + self.conv_feature_layers = conv_feature_layers + feature_enc_layers = eval(conv_feature_layers) + self.extractor_embed = feature_enc_layers[-1][0] + self.feature_extractor = ConvFeatureExtractionModel( + conv_layers=feature_enc_layers, + dropout=0.0, + mode=extractor_mode, + in_d=input_size, + ) + + # Transformer Encoder + ## model architecture + self.layer_type = layer_type + self.layer_norm_first = layer_norm_first + self.encoder_layers = encoder_layers + self.encoder_embed_dim = encoder_embed_dim + self.encoder_ffn_embed_dim = encoder_ffn_embed_dim + self.encoder_attention_heads = encoder_attention_heads + self.activation_fn = activation_fn + ## dropout + self.dropout = dropout + self.attention_dropout = attention_dropout + self.activation_dropout = activation_dropout + self.encoder_layerdrop = encoder_layerdrop + self.dropout_input = dropout_input + self.dropout_features = dropout_features + ## grad settings + self.feature_grad_mult = feature_grad_mult + ## masking + self.mask_prob = mask_prob + self.mask_length = mask_length + self.mask_selection = mask_selection + self.mask_other = mask_other + self.no_mask_overlap = no_mask_overlap + self.mask_min_space = mask_min_space + self.require_same_masks = ( + require_same_masks # if set as True, collate_fn should be clipping + ) + self.mask_dropout = mask_dropout + ## channel masking + self.mask_channel_length = mask_channel_length + self.mask_channel_prob = mask_channel_prob + self.mask_channel_before = mask_channel_before + self.mask_channel_selection = mask_channel_selection + self.mask_channel_other = mask_channel_other + self.no_mask_channel_overlap = no_mask_channel_overlap + self.mask_channel_min_space = mask_channel_min_space + ## positional embeddings + self.conv_pos = conv_pos + self.conv_pos_groups = conv_pos_groups + self.pos_conv_depth = pos_conv_depth + self.max_positions = max_positions + self.mask_emb = nn.Parameter(torch.FloatTensor(self.encoder_embed_dim).uniform_()) + self.encoder = TransformerEncoder( + dropout=self.dropout, + encoder_embed_dim=self.encoder_embed_dim, + required_seq_len_multiple=required_seq_len_multiple, + pos_conv_depth=self.pos_conv_depth, + conv_pos=self.conv_pos, + conv_pos_groups=self.conv_pos_groups, + # transformer layers + layer_type=self.layer_type, + encoder_layers=self.encoder_layers, + encoder_ffn_embed_dim=self.encoder_ffn_embed_dim, + encoder_attention_heads=self.encoder_attention_heads, + attention_dropout=self.attention_dropout, + activation_dropout=self.activation_dropout, + activation_fn=self.activation_fn, + layer_norm_first=self.layer_norm_first, + encoder_layerdrop=self.encoder_layerdrop, + max_positions=self.max_positions, + ) + ## projections and dropouts + self.post_extract_proj = nn.Linear(self.extractor_embed, self.encoder_embed_dim) + self.dropout_input = nn.Dropout(self.dropout_input) + self.dropout_features = nn.Dropout(self.dropout_features) + self.layer_norm = torch.nn.LayerNorm(self.extractor_embed) + self.final_proj = nn.Linear(self.encoder_embed_dim, self.encoder_embed_dim) + + # EMA module + self.average_top_k_layers = average_top_k_layers + self.layer_norm_target_layer = layer_norm_target_layer + self.instance_norm_target_layer = instance_norm_target_layer + self.instance_norm_targets = instance_norm_targets + self.layer_norm_targets = layer_norm_targets + self.batch_norm_target_layer = batch_norm_target_layer + self.group_norm_target_layer = group_norm_target_layer + self.ema_decay = ema_decay + self.ema_end_decay = ema_end_decay + self.ema_anneal_end_step = ema_anneal_end_step + self.ema_transformer_only = ema_transformer_only + self.ema_layers_only = ema_layers_only + self.min_target_var = min_target_var + self.min_pred_var = min_pred_var + self.ema = None + + # Loss + self.loss_beta = loss_beta + self.loss_scale = loss_scale + + # FP16 optimization + self.required_seq_len_multiple = required_seq_len_multiple + + self.num_updates = 0 + + logging.info("Data2VecEncoder settings: {}".format(self.__dict__)) + + def make_ema_teacher(self): + skip_keys = set() + if self.ema_layers_only: + self.ema_transformer_only = True + for k, _ in self.encoder.pos_conv.named_parameters(): + skip_keys.add(f"pos_conv.{k}") + + self.ema = EMAModule( + self.encoder if self.ema_transformer_only else self, + ema_decay=self.ema_decay, + ema_fp32=True, + skip_keys=skip_keys, + ) + + def set_num_updates(self, num_updates): + if self.ema is None and self.final_proj is not None: + logging.info("Making EMA Teacher") + self.make_ema_teacher() + elif self.training and self.ema is not None: + if self.ema_decay != self.ema_end_decay: + if num_updates >= self.ema_anneal_end_step: + decay = self.ema_end_decay + else: + decay = get_annealed_rate( + self.ema_decay, + self.ema_end_decay, + num_updates, + self.ema_anneal_end_step, + ) + self.ema.set_decay(decay) + if self.ema.get_decay() < 1: + self.ema.step(self.encoder if self.ema_transformer_only else self) + + self.num_updates = num_updates + + def apply_mask( + self, + x, + padding_mask, + mask_indices=None, + mask_channel_indices=None, + ): + B, T, C = x.shape + + if self.mask_channel_prob > 0 and self.mask_channel_before: + mask_channel_indices = compute_mask_indices( + (B, C), + None, + self.mask_channel_prob, + self.mask_channel_length, + self.mask_channel_selection, + self.mask_channel_other, + no_overlap=self.no_mask_channel_overlap, + min_space=self.mask_channel_min_space, + ) + mask_channel_indices = ( + torch.from_numpy(mask_channel_indices).to(x.device).unsqueeze(1).expand(-1, T, -1) + ) + x[mask_channel_indices] = 0 + + if self.mask_prob > 0: + if mask_indices is None: + mask_indices = compute_mask_indices( + (B, T), + padding_mask, + self.mask_prob, + self.mask_length, + self.mask_selection, + self.mask_other, + min_masks=1, + no_overlap=self.no_mask_overlap, + min_space=self.mask_min_space, + require_same_masks=self.require_same_masks, + mask_dropout=self.mask_dropout, + ) + mask_indices = torch.from_numpy(mask_indices).to(x.device) + x[mask_indices] = self.mask_emb + else: + mask_indices = None + + if self.mask_channel_prob > 0 and not self.mask_channel_before: + if mask_channel_indices is None: + mask_channel_indices = compute_mask_indices( + (B, C), + None, + self.mask_channel_prob, + self.mask_channel_length, + self.mask_channel_selection, + self.mask_channel_other, + no_overlap=self.no_mask_channel_overlap, + min_space=self.mask_channel_min_space, + ) + mask_channel_indices = ( + torch.from_numpy(mask_channel_indices) + .to(x.device) + .unsqueeze(1) + .expand(-1, T, -1) + ) + x[mask_channel_indices] = 0 + + return x, mask_indices + + def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTensor): + """ + Computes the output length of the convolutional layers + """ + + def _conv_out_length(input_length, kernel_size, stride): + return torch.floor((input_length - kernel_size).to(torch.float32) / stride + 1) + + conv_cfg_list = eval(self.conv_feature_layers) + + for i in range(len(conv_cfg_list)): + input_lengths = _conv_out_length( + input_lengths, conv_cfg_list[i][1], conv_cfg_list[i][2] + ) + + return input_lengths.to(torch.long) + + def forward( + self, + xs_pad, + ilens=None, + mask=False, + features_only=True, + layer=None, + mask_indices=None, + mask_channel_indices=None, + padding_count=None, + ): + # create padding_mask by ilens + if ilens is not None: + padding_mask = make_pad_mask(lengths=ilens).to(xs_pad.device) + else: + padding_mask = None + + features = xs_pad + + if self.feature_grad_mult > 0: + features = self.feature_extractor(features) + if self.feature_grad_mult != 1.0: + features = GradMultiply.apply(features, self.feature_grad_mult) + else: + with torch.no_grad(): + features = self.feature_extractor(features) + + features = features.transpose(1, 2) + + features = self.layer_norm(features) + + orig_padding_mask = padding_mask + + if padding_mask is not None: + input_lengths = (1 - padding_mask.long()).sum(-1) + # apply conv formula to get real output_lengths + output_lengths = self._get_feat_extract_output_lengths(input_lengths) + + padding_mask = torch.zeros( + features.shape[:2], dtype=features.dtype, device=features.device + ) + # these two operations makes sure that all values + # before the output lengths indices are attended to + padding_mask[ + ( + torch.arange(padding_mask.shape[0], device=padding_mask.device), + output_lengths - 1, + ) + ] = 1 + padding_mask = (1 - padding_mask.flip([-1]).cumsum(-1).flip([-1])).bool() + else: + padding_mask = None + + if self.post_extract_proj is not None: + features = self.post_extract_proj(features) + + pre_encoder_features = None + if self.ema_transformer_only: + pre_encoder_features = features.clone() + + features = self.dropout_input(features) + + if mask: + x, mask_indices = self.apply_mask( + features, + padding_mask, + mask_indices=mask_indices, + mask_channel_indices=mask_channel_indices, + ) + else: + x = features + mask_indices = None + + x, layer_results = self.encoder( + x, + padding_mask=padding_mask, + layer=layer, + ) + + if features_only: + encoder_out_lens = (1 - padding_mask.long()).sum(1) + return x, encoder_out_lens, None + + result = { + "losses": {}, + "padding_mask": padding_mask, + "x": x, + } + + with torch.no_grad(): + self.ema.model.eval() + + if self.ema_transformer_only: + y, layer_results = self.ema.model.extract_features( + pre_encoder_features, + padding_mask=padding_mask, + min_layer=self.encoder_layers - self.average_top_k_layers, + ) + y = { + "x": y, + "padding_mask": padding_mask, + "layer_results": layer_results, + } + else: + y = self.ema.model.extract_features( + source=xs_pad, + padding_mask=orig_padding_mask, + mask=False, + ) + + target_layer_results = [l[2] for l in y["layer_results"]] + + permuted = False + if self.instance_norm_target_layer or self.batch_norm_target_layer: + target_layer_results = [ + tl.permute(1, 2, 0) for tl in target_layer_results # TBC -> BCT + ] + permuted = True + + if self.batch_norm_target_layer: + target_layer_results = [ + F.batch_norm(tl.float(), running_mean=None, running_var=None, training=True) + for tl in target_layer_results + ] + + if self.instance_norm_target_layer: + target_layer_results = [F.instance_norm(tl.float()) for tl in target_layer_results] + + if permuted: + target_layer_results = [ + tl.transpose(1, 2) for tl in target_layer_results # BCT -> BTC + ] + + if self.group_norm_target_layer: + target_layer_results = [ + F.layer_norm(tl.float(), tl.shape[-2:]) for tl in target_layer_results + ] + + if self.layer_norm_target_layer: + target_layer_results = [ + F.layer_norm(tl.float(), tl.shape[-1:]) for tl in target_layer_results + ] + + y = sum(target_layer_results) / len(target_layer_results) + + if self.layer_norm_targets: + y = F.layer_norm(y.float(), y.shape[-1:]) + + if self.instance_norm_targets: + y = F.instance_norm(y.float().transpose(1, 2)).transpose(1, 2) + + if not permuted: + y = y.transpose(0, 1) + + y = y[mask_indices] + + x = x[mask_indices] + x = self.final_proj(x) + + sz = x.size(-1) + + if self.loss_beta == 0: + loss = F.mse_loss(x.float(), y.float(), reduction="none").sum(dim=-1) + else: + loss = F.smooth_l1_loss( + x.float(), y.float(), reduction="none", beta=self.loss_beta + ).sum(dim=-1) + + if self.loss_scale is not None: + scale = self.loss_scale + else: + scale = 1 / math.sqrt(sz) + + result["losses"]["regression"] = loss.sum() * scale + + if "sample_size" not in result: + result["sample_size"] = loss.numel() + + with torch.no_grad(): + result["target_var"] = self.compute_var(y) + result["pred_var"] = self.compute_var(x.float()) + + if self.num_updates > 5000 and result["target_var"] < self.min_target_var: + logging.error( + f"target var is {result['target_var'].item()} < {self.min_target_var}, exiting" + ) + raise Exception( + f"target var is {result['target_var'].item()} < {self.min_target_var}, exiting" + ) + if self.num_updates > 5000 and result["pred_var"] < self.min_pred_var: + logging.error(f"pred var is {result['pred_var'].item()} < {self.min_pred_var}, exiting") + raise Exception( + f"pred var is {result['pred_var'].item()} < {self.min_pred_var}, exiting" + ) + + if self.ema is not None: + result["ema_decay"] = self.ema.get_decay() * 1000 + + return result + + @staticmethod + def compute_var(y): + y = y.view(-1, y.size(-1)) + if dist.is_initialized(): + zc = torch.tensor(y.size(0)).cuda() + zs = y.sum(dim=0) + zss = (y**2).sum(dim=0) + + dist.all_reduce(zc) + dist.all_reduce(zs) + dist.all_reduce(zss) + + var = zss / (zc - 1) - (zs**2) / (zc * (zc - 1)) + return torch.sqrt(var + 1e-6).mean() + else: + return torch.sqrt(y.var(dim=0) + 1e-6).mean() + + def extract_features(self, xs_pad, ilens, mask=False, layer=None): + res = self.forward( + xs_pad, + ilens, + mask=mask, + features_only=True, + layer=layer, + ) + return res + + def remove_pretraining_modules(self, last_layer=None): + self.final_proj = None + self.ema = None + if last_layer is not None: + self.encoder.layers = nn.ModuleList( + l for i, l in enumerate(self.encoder.layers) if i <= last_layer + ) + + def output_size(self) -> int: + return self.encoder_embed_dim diff --git a/funasr/models/data2vec/data_utils.py b/funasr/models/data2vec/data_utils.py new file mode 100644 index 0000000..f486edf --- /dev/null +++ b/funasr/models/data2vec/data_utils.py @@ -0,0 +1,141 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + + +from typing import Optional, Tuple + +import numpy as np +import torch + + +def compute_mask_indices( + shape: Tuple[int, int], + padding_mask: Optional[torch.Tensor], + mask_prob: float, + mask_length: int, + mask_type: str = "static", + mask_other: float = 0.0, + min_masks: int = 0, + no_overlap: bool = False, + min_space: int = 0, + require_same_masks: bool = True, + mask_dropout: float = 0.0, +) -> np.ndarray: + """ + Computes random mask spans for a given shape + + Args: + shape: the the shape for which to compute masks. + should be of size 2 where first element is batch size and 2nd is timesteps + padding_mask: optional padding mask of the same size as shape, which will prevent masking padded elements + mask_prob: probability for each token to be chosen as start of the span to be masked. this will be multiplied by + number of timesteps divided by length of mask span to mask approximately this percentage of all elements. + however due to overlaps, the actual number will be smaller (unless no_overlap is True) + mask_type: how to compute mask lengths + static = fixed size + uniform = sample from uniform distribution [mask_other, mask_length*2] + normal = sample from normal distribution with mean mask_length and stdev mask_other. mask is min 1 element + poisson = sample from possion distribution with lambda = mask length + min_masks: minimum number of masked spans + no_overlap: if false, will switch to an alternative recursive algorithm that prevents spans from overlapping + min_space: only used if no_overlap is True, this is how many elements to keep unmasked between spans + require_same_masks: if true, will randomly drop out masks until same amount of masks remains in each sample + mask_dropout: randomly dropout this percentage of masks in each example + """ + + bsz, all_sz = shape + mask = np.full((bsz, all_sz), False) + + all_num_mask = int( + # add a random number for probabilistic rounding + mask_prob * all_sz / float(mask_length) + + np.random.rand() + ) + + all_num_mask = max(min_masks, all_num_mask) + + mask_idcs = [] + for i in range(bsz): + if padding_mask is not None: + sz = all_sz - padding_mask[i].long().sum().item() + num_mask = int( + # add a random number for probabilistic rounding + mask_prob * sz / float(mask_length) + + np.random.rand() + ) + num_mask = max(min_masks, num_mask) + else: + sz = all_sz + num_mask = all_num_mask + + if mask_type == "static": + lengths = np.full(num_mask, mask_length) + elif mask_type == "uniform": + lengths = np.random.randint(mask_other, mask_length * 2 + 1, size=num_mask) + elif mask_type == "normal": + lengths = np.random.normal(mask_length, mask_other, size=num_mask) + lengths = [max(1, int(round(x))) for x in lengths] + elif mask_type == "poisson": + lengths = np.random.poisson(mask_length, size=num_mask) + lengths = [int(round(x)) for x in lengths] + else: + raise Exception("unknown mask selection " + mask_type) + + if sum(lengths) == 0: + lengths[0] = min(mask_length, sz - 1) + + if no_overlap: + mask_idc = [] + + def arrange(s, e, length, keep_length): + span_start = np.random.randint(s, e - length) + mask_idc.extend(span_start + i for i in range(length)) + + new_parts = [] + if span_start - s - min_space >= keep_length: + new_parts.append((s, span_start - min_space + 1)) + if e - span_start - length - min_space > keep_length: + new_parts.append((span_start + length + min_space, e)) + return new_parts + + parts = [(0, sz)] + min_length = min(lengths) + for length in sorted(lengths, reverse=True): + lens = np.fromiter( + (e - s if e - s >= length + min_space else 0 for s, e in parts), + np.int32, + ) + l_sum = np.sum(lens) + if l_sum == 0: + break + probs = lens / np.sum(lens) + c = np.random.choice(len(parts), p=probs) + s, e = parts.pop(c) + parts.extend(arrange(s, e, length, min_length)) + mask_idc = np.asarray(mask_idc) + else: + min_len = min(lengths) + if sz - min_len <= num_mask: + min_len = sz - num_mask - 1 + + mask_idc = np.random.choice(sz - min_len, num_mask, replace=False) + + mask_idc = np.asarray( + [mask_idc[j] + offset for j in range(len(mask_idc)) for offset in range(lengths[j])] + ) + + mask_idcs.append(np.unique(mask_idc[mask_idc < sz])) + + min_len = min([len(m) for m in mask_idcs]) + for i, mask_idc in enumerate(mask_idcs): + if len(mask_idc) > min_len and require_same_masks: + mask_idc = np.random.choice(mask_idc, min_len, replace=False) + if mask_dropout > 0: + num_holes = np.rint(len(mask_idc) * mask_dropout).astype(int) + mask_idc = np.random.choice(mask_idc, len(mask_idc) - num_holes, replace=False) + + mask[i, mask_idc] = True + + return mask diff --git a/funasr/models/data2vec/ema_module.py b/funasr/models/data2vec/ema_module.py new file mode 100644 index 0000000..3d7c21e --- /dev/null +++ b/funasr/models/data2vec/ema_module.py @@ -0,0 +1,130 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +""" +Used for EMA tracking a given pytorch module. The user is responsible for calling step() +and setting the appropriate decay +""" + +import copy +import logging + +import torch + + +class EMAModule: + """Exponential Moving Average of Fairseq Models""" + + def __init__(self, model, ema_decay=0.9999, ema_fp32=False, device=None, skip_keys=None): + """ + @param model model to initialize the EMA with + @param config EMAConfig object with configuration like + ema_decay, ema_update_freq, ema_fp32 + @param device If provided, copy EMA to this device (e.g. gpu). + Otherwise EMA is in the same device as the model. + """ + + self.decay = ema_decay + self.ema_fp32 = ema_fp32 + self.model = copy.deepcopy(model) + self.model.requires_grad_(False) + self.skip_keys = skip_keys or set() + self.fp32_params = {} + + if device is not None: + logging.info(f"Copying EMA model to device {device}") + self.model = self.model.to(device=device) + + if self.ema_fp32: + self.build_fp32_params() + + self.update_freq_counter = 0 + + def build_fp32_params(self, state_dict=None): + """ + Store a copy of the EMA params in fp32. + If state dict is passed, the EMA params is copied from + the provided state dict. Otherwise, it is copied from the + current EMA model parameters. + """ + if not self.ema_fp32: + raise RuntimeError( + "build_fp32_params should not be called if ema_fp32=False. " + "Use ema_fp32=True if this is really intended." + ) + + if state_dict is None: + state_dict = self.model.state_dict() + + def _to_float(t): + return t.float() if torch.is_floating_point(t) else t + + for param_key in state_dict: + if param_key in self.fp32_params: + self.fp32_params[param_key].copy_(state_dict[param_key]) + else: + self.fp32_params[param_key] = _to_float(state_dict[param_key]) + + def restore(self, state_dict, build_fp32_params=False): + """Load data from a model spec into EMA model""" + self.model.load_state_dict(state_dict, strict=False) + if build_fp32_params: + self.build_fp32_params(state_dict) + + def set_decay(self, decay): + self.decay = decay + + def get_decay(self): + return self.decay + + def _step_internal(self, new_model): + """One update of the EMA model based on new model weights""" + decay = self.decay + + ema_state_dict = {} + ema_params = self.fp32_params if self.ema_fp32 else self.model.state_dict() + for key, param in new_model.state_dict().items(): + if isinstance(param, dict): + continue + try: + ema_param = ema_params[key] + except KeyError: + ema_param = param.float().clone() if param.ndim == 1 else copy.deepcopy(param) + + if param.shape != ema_param.shape: + raise ValueError( + "incompatible tensor shapes between model param and ema param" + + "{} vs. {}".format(param.shape, ema_param.shape) + ) + + if "version" in key: + # Do not decay a model.version pytorch param + continue + + if key in self.skip_keys or ( + "num_batches_tracked" in key and ema_param.dtype == torch.int64 + ): + ema_param = param.to(dtype=ema_param.dtype).clone() + ema_params[key].copy_(ema_param) + else: + ema_param.mul_(decay) + ema_param.add_(param.to(dtype=ema_param.dtype), alpha=1 - decay) + ema_state_dict[key] = ema_param + self.restore(ema_state_dict, build_fp32_params=False) + + def step(self, new_model): + self._step_internal(new_model) + + def reverse(self, model): + """ + Load the model parameters from EMA model. + Useful for inference or fine-tuning from the EMA model. + """ + d = self.model.state_dict() + if "_ema" in d: + del d["_ema"] + + model.load_state_dict(d, strict=False) + return model diff --git a/funasr/models/data2vec/grad_multiply.py b/funasr/models/data2vec/grad_multiply.py new file mode 100644 index 0000000..08d15f5 --- /dev/null +++ b/funasr/models/data2vec/grad_multiply.py @@ -0,0 +1,18 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import torch + + +class GradMultiply(torch.autograd.Function): + @staticmethod + def forward(ctx, x, scale): + ctx.scale = scale + res = x.new(x) + return res + + @staticmethod + def backward(ctx, grad): + return grad * ctx.scale, None diff --git a/funasr/models/data2vec/multihead_attention.py b/funasr/models/data2vec/multihead_attention.py new file mode 100644 index 0000000..85bd038 --- /dev/null +++ b/funasr/models/data2vec/multihead_attention.py @@ -0,0 +1,609 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import logging +import math +from typing import Dict, List, Optional, Tuple + +import torch +import torch.nn.functional as F +from torch import Tensor, nn +from torch.nn import Parameter + +from funasr.models.data2vec.quant_noise import quant_noise + + +class FairseqDropout(nn.Module): + def __init__(self, p, module_name=None): + super().__init__() + self.p = p + self.module_name = module_name + self.apply_during_inference = False + + def forward(self, x, inplace: bool = False): + if self.p > 0 and (self.training or self.apply_during_inference): + return F.dropout(x, p=self.p, training=True, inplace=inplace) + else: + return x + + def make_generation_fast_( + self, + name: str, + retain_dropout: bool = False, + retain_dropout_modules: Optional[List[str]] = None, + **kwargs, + ): + if retain_dropout: + if retain_dropout_modules is not None and self.module_name is None: + logging.warning( + "Cannot enable dropout during inference for module {} " + "because module_name was not set".format(name) + ) + elif ( + retain_dropout_modules is None # if None, apply to all modules + or self.module_name in retain_dropout_modules + ): + logging.info("Enabling dropout during inference for module: {}".format(name)) + self.apply_during_inference = True + else: + logging.info("Disabling dropout for module: {}".format(name)) + + +class MultiheadAttention(nn.Module): + """Multi-headed attention. + + See "Attention Is All You Need" for more details. + """ + + def __init__( + self, + embed_dim, + num_heads, + kdim=None, + vdim=None, + dropout=0.0, + bias=True, + add_bias_kv=False, + add_zero_attn=False, + self_attention=False, + encoder_decoder_attention=False, + q_noise=0.0, + qn_block_size=8, + ): + super().__init__() + self.embed_dim = embed_dim + self.kdim = kdim if kdim is not None else embed_dim + self.vdim = vdim if vdim is not None else embed_dim + self.qkv_same_dim = self.kdim == embed_dim and self.vdim == embed_dim + + self.num_heads = num_heads + self.dropout_module = FairseqDropout(dropout, module_name=self.__class__.__name__) + + self.head_dim = embed_dim // num_heads + assert ( + self.head_dim * num_heads == self.embed_dim + ), "embed_dim must be divisible by num_heads" + self.scaling = self.head_dim**-0.5 + + self.self_attention = self_attention + self.encoder_decoder_attention = encoder_decoder_attention + + assert not self.self_attention or self.qkv_same_dim, ( + "Self-attention requires query, key and " "value to be of the same size" + ) + + self.k_proj = quant_noise( + nn.Linear(self.kdim, embed_dim, bias=bias), q_noise, qn_block_size + ) + self.v_proj = quant_noise( + nn.Linear(self.vdim, embed_dim, bias=bias), q_noise, qn_block_size + ) + self.q_proj = quant_noise( + nn.Linear(embed_dim, embed_dim, bias=bias), q_noise, qn_block_size + ) + + self.out_proj = quant_noise( + nn.Linear(embed_dim, embed_dim, bias=bias), q_noise, qn_block_size + ) + + if add_bias_kv: + self.bias_k = Parameter(torch.Tensor(1, 1, embed_dim)) + self.bias_v = Parameter(torch.Tensor(1, 1, embed_dim)) + else: + self.bias_k = self.bias_v = None + + self.add_zero_attn = add_zero_attn + + self.reset_parameters() + + self.onnx_trace = False + self.skip_embed_dim_check = False + + def prepare_for_onnx_export_(self): + self.onnx_trace = True + + def reset_parameters(self): + if self.qkv_same_dim: + # Empirically observed the convergence to be much better with + # the scaled initialization + nn.init.xavier_uniform_(self.k_proj.weight, gain=1 / math.sqrt(2)) + nn.init.xavier_uniform_(self.v_proj.weight, gain=1 / math.sqrt(2)) + nn.init.xavier_uniform_(self.q_proj.weight, gain=1 / math.sqrt(2)) + else: + nn.init.xavier_uniform_(self.k_proj.weight) + nn.init.xavier_uniform_(self.v_proj.weight) + nn.init.xavier_uniform_(self.q_proj.weight) + + nn.init.xavier_uniform_(self.out_proj.weight) + if self.out_proj.bias is not None: + nn.init.constant_(self.out_proj.bias, 0.0) + if self.bias_k is not None: + nn.init.xavier_normal_(self.bias_k) + if self.bias_v is not None: + nn.init.xavier_normal_(self.bias_v) + + def _get_reserve_head_index(self, num_heads_to_keep: int): + k_proj_heads_norm = [] + q_proj_heads_norm = [] + v_proj_heads_norm = [] + + for i in range(self.num_heads): + start_idx = i * self.head_dim + end_idx = (i + 1) * self.head_dim + k_proj_heads_norm.append( + torch.sum(torch.abs(self.k_proj.weight[start_idx:end_idx,])).tolist() + + torch.sum(torch.abs(self.k_proj.bias[start_idx:end_idx])).tolist() + ) + q_proj_heads_norm.append( + torch.sum(torch.abs(self.q_proj.weight[start_idx:end_idx,])).tolist() + + torch.sum(torch.abs(self.q_proj.bias[start_idx:end_idx])).tolist() + ) + v_proj_heads_norm.append( + torch.sum(torch.abs(self.v_proj.weight[start_idx:end_idx,])).tolist() + + torch.sum(torch.abs(self.v_proj.bias[start_idx:end_idx])).tolist() + ) + + heads_norm = [] + for i in range(self.num_heads): + heads_norm.append(k_proj_heads_norm[i] + q_proj_heads_norm[i] + v_proj_heads_norm[i]) + + sorted_head_index = sorted(range(self.num_heads), key=lambda k: heads_norm[k], reverse=True) + reserve_head_index = [] + for i in range(num_heads_to_keep): + start = sorted_head_index[i] * self.head_dim + end = (sorted_head_index[i] + 1) * self.head_dim + reserve_head_index.append((start, end)) + return reserve_head_index + + def _adaptive_prune_heads(self, reserve_head_index: List[Tuple[int, int]]): + new_q_weight = [] + new_q_bias = [] + new_k_weight = [] + new_k_bias = [] + new_v_weight = [] + new_v_bias = [] + new_out_proj_weight = [] + + for ele in reserve_head_index: + start_idx, end_idx = ele + new_q_weight.append(self.q_proj.weight[start_idx:end_idx,]) + new_q_bias.append(self.q_proj.bias[start_idx:end_idx]) + + new_k_weight.append(self.k_proj.weight[start_idx:end_idx,]) + + new_k_bias.append(self.k_proj.bias[start_idx:end_idx]) + + new_v_weight.append(self.v_proj.weight[start_idx:end_idx,]) + new_v_bias.append(self.v_proj.bias[start_idx:end_idx]) + + new_out_proj_weight.append(self.out_proj.weight[:, start_idx:end_idx]) + + new_q_weight = torch.cat(new_q_weight).detach() + new_k_weight = torch.cat(new_k_weight).detach() + new_v_weight = torch.cat(new_v_weight).detach() + new_out_proj_weight = torch.cat(new_out_proj_weight, dim=-1).detach() + new_q_weight.requires_grad = True + new_k_weight.requires_grad = True + new_v_weight.requires_grad = True + new_out_proj_weight.requires_grad = True + + new_q_bias = torch.cat(new_q_bias).detach() + new_q_bias.requires_grad = True + + new_k_bias = torch.cat(new_k_bias).detach() + new_k_bias.requires_grad = True + + new_v_bias = torch.cat(new_v_bias).detach() + new_v_bias.requires_grad = True + + self.q_proj.weight = torch.nn.Parameter(new_q_weight) + self.q_proj.bias = torch.nn.Parameter(new_q_bias) + + self.k_proj.weight = torch.nn.Parameter(new_k_weight) + self.k_proj.bias = torch.nn.Parameter(new_k_bias) + + self.v_proj.weight = torch.nn.Parameter(new_v_weight) + self.v_proj.bias = torch.nn.Parameter(new_v_bias) + + self.out_proj.weight = torch.nn.Parameter(new_out_proj_weight) + + self.num_heads = len(reserve_head_index) + self.embed_dim = self.head_dim * self.num_heads + self.q_proj.out_features = self.embed_dim + self.k_proj.out_features = self.embed_dim + self.v_proj.out_features = self.embed_dim + + def _set_skip_embed_dim_check(self): + self.skip_embed_dim_check = True + + def forward( + self, + query, + key: Optional[Tensor], + value: Optional[Tensor], + key_padding_mask: Optional[Tensor] = None, + incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None, + need_weights: bool = True, + static_kv: bool = False, + attn_mask: Optional[Tensor] = None, + before_softmax: bool = False, + need_head_weights: bool = False, + ) -> Tuple[Tensor, Optional[Tensor]]: + """Input shape: Time x Batch x Channel + + Args: + key_padding_mask (ByteTensor, optional): mask to exclude + keys that are pads, of shape `(batch, src_len)`, where + padding elements are indicated by 1s. + need_weights (bool, optional): return the attention weights, + averaged over heads (default: False). + attn_mask (ByteTensor, optional): typically used to + implement causal attention, where the mask prevents the + attention from looking forward in time (default: None). + before_softmax (bool, optional): return the raw attention + weights and values before the attention softmax. + need_head_weights (bool, optional): return the attention + weights for each head. Implies *need_weights*. Default: + return the average attention weights over all heads. + """ + if need_head_weights: + need_weights = True + + is_tpu = query.device.type == "xla" + + tgt_len, bsz, embed_dim = query.size() + src_len = tgt_len + if not self.skip_embed_dim_check: + assert embed_dim == self.embed_dim, f"query dim {embed_dim} != {self.embed_dim}" + assert list(query.size()) == [tgt_len, bsz, embed_dim] + if key is not None: + src_len, key_bsz, _ = key.size() + if not torch.jit.is_scripting(): + assert key_bsz == bsz + assert value is not None + assert src_len, bsz == value.shape[:2] + + if ( + not self.onnx_trace + and not is_tpu # don't use PyTorch version on TPUs + and incremental_state is None + and not static_kv + # A workaround for quantization to work. Otherwise JIT compilation + # treats bias in linear module as method. + and not torch.jit.is_scripting() + # The Multihead attention implemented in pytorch forces strong dimension check + # for input embedding dimention and K,Q,V projection dimension. + # Since pruning will break the dimension check and it is not easy to modify the pytorch API, + # it is preferred to bypass the pytorch MHA when we need to skip embed_dim_check + and not self.skip_embed_dim_check + ): + assert key is not None and value is not None + return F.multi_head_attention_forward( + query, + key, + value, + self.embed_dim, + self.num_heads, + torch.empty([0]), + torch.cat((self.q_proj.bias, self.k_proj.bias, self.v_proj.bias)), + self.bias_k, + self.bias_v, + self.add_zero_attn, + self.dropout_module.p, + self.out_proj.weight, + self.out_proj.bias, + self.training or self.dropout_module.apply_during_inference, + key_padding_mask, + need_weights, + attn_mask, + use_separate_proj_weight=True, + q_proj_weight=self.q_proj.weight, + k_proj_weight=self.k_proj.weight, + v_proj_weight=self.v_proj.weight, + ) + + if incremental_state is not None: + saved_state = self._get_input_buffer(incremental_state) + if saved_state is not None and "prev_key" in saved_state: + # previous time steps are cached - no need to recompute + # key and value if they are static + if static_kv: + assert self.encoder_decoder_attention and not self.self_attention + key = value = None + else: + saved_state = None + + if self.self_attention: + q = self.q_proj(query) + k = self.k_proj(query) + v = self.v_proj(query) + elif self.encoder_decoder_attention: + # encoder-decoder attention + q = self.q_proj(query) + if key is None: + assert value is None + k = v = None + else: + k = self.k_proj(key) + v = self.v_proj(key) + + else: + assert key is not None and value is not None + q = self.q_proj(query) + k = self.k_proj(key) + v = self.v_proj(value) + q *= self.scaling + + if self.bias_k is not None: + assert self.bias_v is not None + k = torch.cat([k, self.bias_k.repeat(1, bsz, 1)]) + v = torch.cat([v, self.bias_v.repeat(1, bsz, 1)]) + if attn_mask is not None: + attn_mask = torch.cat([attn_mask, attn_mask.new_zeros(attn_mask.size(0), 1)], dim=1) + if key_padding_mask is not None: + key_padding_mask = torch.cat( + [ + key_padding_mask, + key_padding_mask.new_zeros(key_padding_mask.size(0), 1), + ], + dim=1, + ) + + q = q.contiguous().view(tgt_len, bsz * self.num_heads, self.head_dim).transpose(0, 1) + if k is not None: + k = k.contiguous().view(-1, bsz * self.num_heads, self.head_dim).transpose(0, 1) + if v is not None: + v = v.contiguous().view(-1, bsz * self.num_heads, self.head_dim).transpose(0, 1) + + if saved_state is not None: + # saved states are stored with shape (bsz, num_heads, seq_len, head_dim) + if "prev_key" in saved_state: + _prev_key = saved_state["prev_key"] + assert _prev_key is not None + prev_key = _prev_key.view(bsz * self.num_heads, -1, self.head_dim) + if static_kv: + k = prev_key + else: + assert k is not None + k = torch.cat([prev_key, k], dim=1) + src_len = k.size(1) + if "prev_value" in saved_state: + _prev_value = saved_state["prev_value"] + assert _prev_value is not None + prev_value = _prev_value.view(bsz * self.num_heads, -1, self.head_dim) + if static_kv: + v = prev_value + else: + assert v is not None + v = torch.cat([prev_value, v], dim=1) + prev_key_padding_mask: Optional[Tensor] = None + if "prev_key_padding_mask" in saved_state: + prev_key_padding_mask = saved_state["prev_key_padding_mask"] + assert k is not None and v is not None + key_padding_mask = MultiheadAttention._append_prev_key_padding_mask( + key_padding_mask=key_padding_mask, + prev_key_padding_mask=prev_key_padding_mask, + batch_size=bsz, + src_len=k.size(1), + static_kv=static_kv, + ) + + saved_state["prev_key"] = k.view(bsz, self.num_heads, -1, self.head_dim) + saved_state["prev_value"] = v.view(bsz, self.num_heads, -1, self.head_dim) + saved_state["prev_key_padding_mask"] = key_padding_mask + # In this branch incremental_state is never None + assert incremental_state is not None + incremental_state = self._set_input_buffer(incremental_state, saved_state) + assert k is not None + assert k.size(1) == src_len + + # This is part of a workaround to get around fork/join parallelism + # not supporting Optional types. + if key_padding_mask is not None and key_padding_mask.dim() == 0: + key_padding_mask = None + + if key_padding_mask is not None: + assert key_padding_mask.size(0) == bsz + assert key_padding_mask.size(1) == src_len + + if self.add_zero_attn: + assert v is not None + src_len += 1 + k = torch.cat([k, k.new_zeros((k.size(0), 1) + k.size()[2:])], dim=1) + v = torch.cat([v, v.new_zeros((v.size(0), 1) + v.size()[2:])], dim=1) + if attn_mask is not None: + attn_mask = torch.cat([attn_mask, attn_mask.new_zeros(attn_mask.size(0), 1)], dim=1) + if key_padding_mask is not None: + key_padding_mask = torch.cat( + [ + key_padding_mask, + torch.zeros(key_padding_mask.size(0), 1).type_as(key_padding_mask), + ], + dim=1, + ) + + attn_weights = torch.bmm(q, k.transpose(1, 2)) + attn_weights = self.apply_sparse_mask(attn_weights, tgt_len, src_len, bsz) + + assert list(attn_weights.size()) == [bsz * self.num_heads, tgt_len, src_len] + + if attn_mask is not None: + attn_mask = attn_mask.unsqueeze(0) + if self.onnx_trace: + attn_mask = attn_mask.repeat(attn_weights.size(0), 1, 1) + attn_weights += attn_mask + + if key_padding_mask is not None: + # don't attend to padding symbols + attn_weights = attn_weights.view(bsz, self.num_heads, tgt_len, src_len) + if not is_tpu: + attn_weights = attn_weights.masked_fill( + key_padding_mask.unsqueeze(1).unsqueeze(2).to(torch.bool), + float("-inf"), + ) + else: + attn_weights = attn_weights.transpose(0, 2) + attn_weights = attn_weights.masked_fill(key_padding_mask, float("-inf")) + attn_weights = attn_weights.transpose(0, 2) + attn_weights = attn_weights.view(bsz * self.num_heads, tgt_len, src_len) + + if before_softmax: + return attn_weights, v + + attn_weights_float = F.softmax(attn_weights, dim=-1, dtype=torch.float32) + attn_weights = attn_weights_float.type_as(attn_weights) + attn_probs = self.dropout_module(attn_weights) + + assert v is not None + attn = torch.bmm(attn_probs, v) + assert list(attn.size()) == [bsz * self.num_heads, tgt_len, self.head_dim] + if self.onnx_trace and attn.size(1) == 1: + # when ONNX tracing a single decoder step (sequence length == 1) + # the transpose is a no-op copy before view, thus unnecessary + attn = attn.contiguous().view(tgt_len, bsz, self.embed_dim) + else: + attn = attn.transpose(0, 1).contiguous().view(tgt_len, bsz, self.embed_dim) + attn = self.out_proj(attn) + attn_weights: Optional[Tensor] = None + if need_weights: + attn_weights = attn_weights_float.view(bsz, self.num_heads, tgt_len, src_len).transpose( + 1, 0 + ) + if not need_head_weights: + # average attention weights over heads + attn_weights = attn_weights.mean(dim=0) + + return attn, attn_weights + + @staticmethod + def _append_prev_key_padding_mask( + key_padding_mask: Optional[Tensor], + prev_key_padding_mask: Optional[Tensor], + batch_size: int, + src_len: int, + static_kv: bool, + ) -> Optional[Tensor]: + # saved key padding masks have shape (bsz, seq_len) + if prev_key_padding_mask is not None and static_kv: + new_key_padding_mask = prev_key_padding_mask + elif prev_key_padding_mask is not None and key_padding_mask is not None: + new_key_padding_mask = torch.cat( + [prev_key_padding_mask.float(), key_padding_mask.float()], dim=1 + ) + # During incremental decoding, as the padding token enters and + # leaves the frame, there will be a time when prev or current + # is None + elif prev_key_padding_mask is not None: + if src_len > prev_key_padding_mask.size(1): + filler = torch.zeros( + (batch_size, src_len - prev_key_padding_mask.size(1)), + device=prev_key_padding_mask.device, + ) + new_key_padding_mask = torch.cat( + [prev_key_padding_mask.float(), filler.float()], dim=1 + ) + else: + new_key_padding_mask = prev_key_padding_mask.float() + elif key_padding_mask is not None: + if src_len > key_padding_mask.size(1): + filler = torch.zeros( + (batch_size, src_len - key_padding_mask.size(1)), + device=key_padding_mask.device, + ) + new_key_padding_mask = torch.cat([filler.float(), key_padding_mask.float()], dim=1) + else: + new_key_padding_mask = key_padding_mask.float() + else: + new_key_padding_mask = prev_key_padding_mask + return new_key_padding_mask + + @torch.jit.export + def reorder_incremental_state( + self, + incremental_state: Dict[str, Dict[str, Optional[Tensor]]], + new_order: Tensor, + ): + """Reorder buffered internal state (for incremental generation).""" + input_buffer = self._get_input_buffer(incremental_state) + if input_buffer is not None: + for k in input_buffer.keys(): + input_buffer_k = input_buffer[k] + if input_buffer_k is not None: + if self.encoder_decoder_attention and input_buffer_k.size(0) == new_order.size( + 0 + ): + break + input_buffer[k] = input_buffer_k.index_select(0, new_order) + incremental_state = self._set_input_buffer(incremental_state, input_buffer) + return incremental_state + + def _get_input_buffer( + self, incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] + ) -> Dict[str, Optional[Tensor]]: + result = self.get_incremental_state(incremental_state, "attn_state") + if result is not None: + return result + else: + empty_result: Dict[str, Optional[Tensor]] = {} + return empty_result + + def _set_input_buffer( + self, + incremental_state: Dict[str, Dict[str, Optional[Tensor]]], + buffer: Dict[str, Optional[Tensor]], + ): + return self.set_incremental_state(incremental_state, "attn_state", buffer) + + def apply_sparse_mask(self, attn_weights, tgt_len: int, src_len: int, bsz: int): + return attn_weights + + def upgrade_state_dict_named(self, state_dict, name): + prefix = name + "." if name != "" else "" + items_to_add = {} + keys_to_remove = [] + for k in state_dict.keys(): + if k.endswith(prefix + "in_proj_weight"): + # in_proj_weight used to be q + k + v with same dimensions + dim = int(state_dict[k].shape[0] / 3) + items_to_add[prefix + "q_proj.weight"] = state_dict[k][:dim] + items_to_add[prefix + "k_proj.weight"] = state_dict[k][dim : 2 * dim] + items_to_add[prefix + "v_proj.weight"] = state_dict[k][2 * dim :] + + keys_to_remove.append(k) + + k_bias = prefix + "in_proj_bias" + if k_bias in state_dict.keys(): + dim = int(state_dict[k].shape[0] / 3) + items_to_add[prefix + "q_proj.bias"] = state_dict[k_bias][:dim] + items_to_add[prefix + "k_proj.bias"] = state_dict[k_bias][dim : 2 * dim] + items_to_add[prefix + "v_proj.bias"] = state_dict[k_bias][2 * dim :] + + keys_to_remove.append(prefix + "in_proj_bias") + + for k in keys_to_remove: + del state_dict[k] + + for key, value in items_to_add.items(): + state_dict[key] = value diff --git a/funasr/models/data2vec/quant_noise.py b/funasr/models/data2vec/quant_noise.py new file mode 100644 index 0000000..50b2c15 --- /dev/null +++ b/funasr/models/data2vec/quant_noise.py @@ -0,0 +1,101 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import torch +import torch.nn as nn + + +def quant_noise(module, p, block_size): + """ + Wraps modules and applies quantization noise to the weights for + subsequent quantization with Iterative Product Quantization as + described in "Training with Quantization Noise for Extreme Model Compression" + + Args: + - module: nn.Module + - p: amount of Quantization Noise + - block_size: size of the blocks for subsequent quantization with iPQ + + Remarks: + - Module weights must have the right sizes wrt the block size + - Only Linear, Embedding and Conv2d modules are supported for the moment + - For more detail on how to quantize by blocks with convolutional weights, + see "And the Bit Goes Down: Revisiting the Quantization of Neural Networks" + - We implement the simplest form of noise here as stated in the paper + which consists in randomly dropping blocks + """ + + # if no quantization noise, don't register hook + if p <= 0: + return module + + # supported modules + assert isinstance(module, (nn.Linear, nn.Embedding, nn.Conv2d)) + + # test whether module.weight has the right sizes wrt block_size + is_conv = module.weight.ndim == 4 + + # 2D matrix + if not is_conv: + assert ( + module.weight.size(1) % block_size == 0 + ), "Input features must be a multiple of block sizes" + + # 4D matrix + else: + # 1x1 convolutions + if module.kernel_size == (1, 1): + assert ( + module.in_channels % block_size == 0 + ), "Input channels must be a multiple of block sizes" + # regular convolutions + else: + k = module.kernel_size[0] * module.kernel_size[1] + assert k % block_size == 0, "Kernel size must be a multiple of block size" + + def _forward_pre_hook(mod, input): + # no noise for evaluation + if mod.training: + if not is_conv: + # gather weight and sizes + weight = mod.weight + in_features = weight.size(1) + out_features = weight.size(0) + + # split weight matrix into blocks and randomly drop selected blocks + mask = torch.zeros(in_features // block_size * out_features, device=weight.device) + mask.bernoulli_(p) + mask = mask.repeat_interleave(block_size, -1).view(-1, in_features) + + else: + # gather weight and sizes + weight = mod.weight + in_channels = mod.in_channels + out_channels = mod.out_channels + + # split weight matrix into blocks and randomly drop selected blocks + if mod.kernel_size == (1, 1): + mask = torch.zeros( + int(in_channels // block_size * out_channels), + device=weight.device, + ) + mask.bernoulli_(p) + mask = mask.repeat_interleave(block_size, -1).view(-1, in_channels) + else: + mask = torch.zeros(weight.size(0), weight.size(1), device=weight.device) + mask.bernoulli_(p) + mask = ( + mask.unsqueeze(2) + .unsqueeze(3) + .repeat(1, 1, mod.kernel_size[0], mod.kernel_size[1]) + ) + + # scale weights and apply mask + mask = mask.to(torch.bool) # x.bool() is not currently supported in TorchScript + s = 1 / (1 - p) + mod.weight.data = s * weight.masked_fill(mask, 0) + + module.register_forward_pre_hook(_forward_pre_hook) + return module diff --git a/funasr/models/data2vec/utils.py b/funasr/models/data2vec/utils.py new file mode 100644 index 0000000..b4c1603 --- /dev/null +++ b/funasr/models/data2vec/utils.py @@ -0,0 +1,154 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import math + +import torch +import torch.nn as nn +import torch.nn.functional as F + +from funasr.models.data2vec.multihead_attention import MultiheadAttention + + +class Fp32LayerNorm(nn.LayerNorm): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def forward(self, input): + output = F.layer_norm( + input.float(), + self.normalized_shape, + self.weight.float() if self.weight is not None else None, + self.bias.float() if self.bias is not None else None, + self.eps, + ) + return output.type_as(input) + + +class Fp32GroupNorm(nn.GroupNorm): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def forward(self, input): + output = F.group_norm( + input.float(), + self.num_groups, + self.weight.float() if self.weight is not None else None, + self.bias.float() if self.bias is not None else None, + self.eps, + ) + return output.type_as(input) + + +class TransposeLast(nn.Module): + def __init__(self, deconstruct_idx=None): + super().__init__() + self.deconstruct_idx = deconstruct_idx + + def forward(self, x): + if self.deconstruct_idx is not None: + x = x[self.deconstruct_idx] + return x.transpose(-2, -1) + + +class SamePad(nn.Module): + def __init__(self, kernel_size, causal=False): + super().__init__() + if causal: + self.remove = kernel_size - 1 + else: + self.remove = 1 if kernel_size % 2 == 0 else 0 + + def forward(self, x): + if self.remove > 0: + x = x[:, :, : -self.remove] + return x + + +def pad_to_multiple(x, multiple, dim=-1, value=0): + # Inspired from https://github.com/lucidrains/local-attention/blob/master/local_attention/local_attention.py#L41 + if x is None: + return None, 0 + tsz = x.size(dim) + m = tsz / multiple + remainder = math.ceil(m) * multiple - tsz + if m.is_integer(): + return x, 0 + pad_offset = (0,) * (-1 - dim) * 2 + + return F.pad(x, (*pad_offset, 0, remainder), value=value), remainder + + +def gelu_accurate(x): + if not hasattr(gelu_accurate, "_a"): + gelu_accurate._a = math.sqrt(2 / math.pi) + return 0.5 * x * (1 + torch.tanh(gelu_accurate._a * (x + 0.044715 * torch.pow(x, 3)))) + + +def gelu(x: torch.Tensor) -> torch.Tensor: + return torch.nn.functional.gelu(x.float()).type_as(x) + + +def get_available_activation_fns(): + return [ + "relu", + "gelu", + "gelu_fast", # deprecated + "gelu_accurate", + "tanh", + "linear", + ] + + +def get_activation_fn(activation: str): + """Returns the activation function corresponding to `activation`""" + + if activation == "relu": + return F.relu + elif activation == "gelu": + return gelu + elif activation == "gelu_accurate": + return gelu_accurate + elif activation == "tanh": + return torch.tanh + elif activation == "linear": + return lambda x: x + elif activation == "swish": + return torch.nn.SiLU + else: + raise RuntimeError("--activation-fn {} not supported".format(activation)) + + +def init_bert_params(module): + """ + Initialize the weights specific to the BERT Model. + This overrides the default initializations depending on the specified arguments. + 1. If normal_init_linear_weights is set then weights of linear + layer will be initialized using the normal distribution and + bais will be set to the specified value. + 2. If normal_init_embed_weights is set then weights of embedding + layer will be initialized using the normal distribution. + 3. If normal_init_proj_weights is set then weights of + in_project_weight for MultiHeadAttention initialized using + the normal distribution (to be validated). + """ + + def normal_(data): + # with FSDP, module params will be on CUDA, so we cast them back to CPU + # so that the RNG is consistent with and without FSDP + data.copy_(data.cpu().normal_(mean=0.0, std=0.02).to(data.device)) + + if isinstance(module, nn.Linear): + normal_(module.weight.data) + if module.bias is not None: + module.bias.data.zero_() + if isinstance(module, nn.Embedding): + normal_(module.weight.data) + if module.padding_idx is not None: + module.weight.data[module.padding_idx].zero_() + if isinstance(module, MultiheadAttention): + normal_(module.q_proj.weight.data) + normal_(module.k_proj.weight.data) + normal_(module.v_proj.weight.data) diff --git a/funasr/models/data2vec/wav2vec2.py b/funasr/models/data2vec/wav2vec2.py new file mode 100644 index 0000000..a3e837a --- /dev/null +++ b/funasr/models/data2vec/wav2vec2.py @@ -0,0 +1,401 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import logging +import math +from typing import List, Tuple + +import numpy as np +import torch +import torch.nn as nn +import torch.nn.functional as F + +from funasr.models.data2vec import utils +from funasr.models.data2vec.multihead_attention import MultiheadAttention + + +class ConvFeatureExtractionModel(nn.Module): + def __init__( + self, + conv_layers: List[Tuple[int, int, int]], + dropout: float = 0.0, + mode: str = "default", + conv_bias: bool = False, + in_d: int = 1, + ): + super().__init__() + + assert mode in {"default", "layer_norm"} + + def block( + n_in, + n_out, + k, + stride, + is_layer_norm=False, + is_group_norm=False, + conv_bias=False, + ): + def make_conv(): + conv = nn.Conv1d(n_in, n_out, k, stride=stride, bias=conv_bias) + nn.init.kaiming_normal_(conv.weight) + return conv + + assert ( + is_layer_norm and is_group_norm + ) == False, "layer norm and group norm are exclusive" + + if is_layer_norm: + return nn.Sequential( + make_conv(), + nn.Dropout(p=dropout), + nn.Sequential( + utils.TransposeLast(), + utils.Fp32LayerNorm(dim, elementwise_affine=True), + utils.TransposeLast(), + ), + nn.GELU(), + ) + elif is_group_norm: + return nn.Sequential( + make_conv(), + nn.Dropout(p=dropout), + utils.Fp32GroupNorm(dim, dim, affine=True), + nn.GELU(), + ) + else: + return nn.Sequential(make_conv(), nn.Dropout(p=dropout), nn.GELU()) + + self.conv_layers = nn.ModuleList() + for i, cl in enumerate(conv_layers): + assert len(cl) == 3, "invalid conv definition: " + str(cl) + (dim, k, stride) = cl + + self.conv_layers.append( + block( + in_d, + dim, + k, + stride, + is_layer_norm=mode == "layer_norm", + is_group_norm=mode == "default" and i == 0, + conv_bias=conv_bias, + ) + ) + in_d = dim + + def forward(self, x): + if len(x.shape) == 2: + x = x.unsqueeze(1) + else: + x = x.transpose(1, 2) + + for conv in self.conv_layers: + x = conv(x) + return x + + +def make_conv_pos(e, k, g): + pos_conv = nn.Conv1d( + e, + e, + kernel_size=k, + padding=k // 2, + groups=g, + ) + dropout = 0 + std = math.sqrt((4 * (1.0 - dropout)) / (k * e)) + nn.init.normal_(pos_conv.weight, mean=0, std=std) + nn.init.constant_(pos_conv.bias, 0) + + pos_conv = nn.utils.weight_norm(pos_conv, name="weight", dim=2) + pos_conv = nn.Sequential(pos_conv, utils.SamePad(k), nn.GELU()) + + return pos_conv + + +class TransformerEncoder(nn.Module): + def build_encoder_layer(self): + if self.layer_type == "transformer": + layer = TransformerSentenceEncoderLayer( + embedding_dim=self.embedding_dim, + ffn_embedding_dim=self.encoder_ffn_embed_dim, + num_attention_heads=self.encoder_attention_heads, + dropout=self.dropout, + attention_dropout=self.attention_dropout, + activation_dropout=self.activation_dropout, + activation_fn=self.activation_fn, + layer_norm_first=self.layer_norm_first, + ) + else: + logging.error("Only transformer is supported for data2vec now") + return layer + + def __init__( + self, + # position + dropout, + encoder_embed_dim, + required_seq_len_multiple, + pos_conv_depth, + conv_pos, + conv_pos_groups, + # transformer layers + layer_type, + encoder_layers, + encoder_ffn_embed_dim, + encoder_attention_heads, + attention_dropout, + activation_dropout, + activation_fn, + layer_norm_first, + encoder_layerdrop, + max_positions, + ): + super().__init__() + + # position + self.dropout = dropout + self.embedding_dim = encoder_embed_dim + self.required_seq_len_multiple = required_seq_len_multiple + if pos_conv_depth > 1: + num_layers = pos_conv_depth + k = max(3, conv_pos // num_layers) + + def make_conv_block(e, k, g, l): + return nn.Sequential( + *[ + nn.Sequential( + nn.Conv1d( + e, + e, + kernel_size=k, + padding=k // 2, + groups=g, + ), + utils.SamePad(k), + utils.TransposeLast(), + torch.nn.LayerNorm(e, elementwise_affine=False), + utils.TransposeLast(), + nn.GELU(), + ) + for _ in range(l) + ] + ) + + self.pos_conv = make_conv_block(self.embedding_dim, k, conv_pos_groups, num_layers) + + else: + self.pos_conv = make_conv_pos( + self.embedding_dim, + conv_pos, + conv_pos_groups, + ) + + # transformer layers + self.layer_type = layer_type + self.encoder_ffn_embed_dim = encoder_ffn_embed_dim + self.encoder_attention_heads = encoder_attention_heads + self.attention_dropout = attention_dropout + self.activation_dropout = activation_dropout + self.activation_fn = activation_fn + self.layer_norm_first = layer_norm_first + self.layerdrop = encoder_layerdrop + self.max_positions = max_positions + self.layers = nn.ModuleList([self.build_encoder_layer() for _ in range(encoder_layers)]) + self.layer_norm = torch.nn.LayerNorm(self.embedding_dim) + + self.apply(utils.init_bert_params) + + def forward(self, x, padding_mask=None, layer=None): + x, layer_results = self.extract_features(x, padding_mask, layer) + + if self.layer_norm_first and layer is None: + x = self.layer_norm(x) + + return x, layer_results + + def extract_features( + self, + x, + padding_mask=None, + tgt_layer=None, + min_layer=0, + ): + + if padding_mask is not None: + x[padding_mask] = 0 + + x_conv = self.pos_conv(x.transpose(1, 2)) + x_conv = x_conv.transpose(1, 2) + x = x + x_conv + + if not self.layer_norm_first: + x = self.layer_norm(x) + + # pad to the sequence length dimension + x, pad_length = utils.pad_to_multiple(x, self.required_seq_len_multiple, dim=-2, value=0) + if pad_length > 0 and padding_mask is None: + padding_mask = x.new_zeros((x.size(0), x.size(1)), dtype=torch.bool) + padding_mask[:, -pad_length:] = True + else: + padding_mask, _ = utils.pad_to_multiple( + padding_mask, self.required_seq_len_multiple, dim=-1, value=True + ) + x = F.dropout(x, p=self.dropout, training=self.training) + + # B x T x C -> T x B x C + x = x.transpose(0, 1) + + layer_results = [] + r = None + for i, layer in enumerate(self.layers): + dropout_probability = np.random.random() if self.layerdrop > 0 else 1 + if not self.training or (dropout_probability > self.layerdrop): + x, (z, lr) = layer(x, self_attn_padding_mask=padding_mask) + if i >= min_layer: + layer_results.append((x, z, lr)) + if i == tgt_layer: + r = x + break + + if r is not None: + x = r + + # T x B x C -> B x T x C + x = x.transpose(0, 1) + + # undo paddding + if pad_length > 0: + x = x[:, :-pad_length] + + def undo_pad(a, b, c): + return ( + a[:-pad_length], + b[:-pad_length] if b is not None else b, + c[:-pad_length], + ) + + layer_results = [undo_pad(*u) for u in layer_results] + + return x, layer_results + + def max_positions(self): + """Maximum output length supported by the encoder.""" + return self.max_positions + + def upgrade_state_dict_named(self, state_dict, name): + """Upgrade a (possibly old) state dict for new versions of fairseq.""" + return state_dict + + +class TransformerSentenceEncoderLayer(nn.Module): + """ + Implements a Transformer Encoder Layer used in BERT/XLM style pre-trained + models. + """ + + def __init__( + self, + embedding_dim: int = 768, + ffn_embedding_dim: int = 3072, + num_attention_heads: int = 8, + dropout: float = 0.1, + attention_dropout: float = 0.1, + activation_dropout: float = 0.1, + activation_fn: str = "relu", + layer_norm_first: bool = False, + ) -> None: + + super().__init__() + # Initialize parameters + self.embedding_dim = embedding_dim + self.dropout = dropout + self.activation_dropout = activation_dropout + + # Initialize blocks + self.activation_fn = utils.get_activation_fn(activation_fn) + self.self_attn = MultiheadAttention( + self.embedding_dim, + num_attention_heads, + dropout=attention_dropout, + self_attention=True, + ) + + self.dropout1 = nn.Dropout(dropout) + self.dropout2 = nn.Dropout(self.activation_dropout) + self.dropout3 = nn.Dropout(dropout) + + self.layer_norm_first = layer_norm_first + + # layer norm associated with the self attention layer + self.self_attn_layer_norm = torch.nn.LayerNorm(self.embedding_dim) + self.fc1 = nn.Linear(self.embedding_dim, ffn_embedding_dim) + self.fc2 = nn.Linear(ffn_embedding_dim, self.embedding_dim) + + # layer norm associated with the position wise feed-forward NN + self.final_layer_norm = torch.nn.LayerNorm(self.embedding_dim) + + def forward( + self, + x: torch.Tensor, # (T, B, C) + self_attn_mask: torch.Tensor = None, + self_attn_padding_mask: torch.Tensor = None, + ): + """ + LayerNorm is applied either before or after the self-attention/ffn + modules similar to the original Transformer imlementation. + """ + residual = x + + if self.layer_norm_first: + x = self.self_attn_layer_norm(x) + x, attn = self.self_attn( + query=x, + key=x, + value=x, + key_padding_mask=self_attn_padding_mask, + attn_mask=self_attn_mask, + need_weights=False, + ) + x = self.dropout1(x) + x = residual + x + + residual = x + x = self.final_layer_norm(x) + x = self.activation_fn(self.fc1(x)) + x = self.dropout2(x) + x = self.fc2(x) + + layer_result = x + + x = self.dropout3(x) + x = residual + x + else: + x, attn = self.self_attn( + query=x, + key=x, + value=x, + key_padding_mask=self_attn_padding_mask, + need_weights=False, + ) + + x = self.dropout1(x) + x = residual + x + + x = self.self_attn_layer_norm(x) + + residual = x + x = self.activation_fn(self.fc1(x)) + x = self.dropout2(x) + x = self.fc2(x) + + layer_result = x + + x = self.dropout3(x) + x = residual + x + x = self.final_layer_norm(x) + + return x, (attn, layer_result) diff --git a/funasr/models/e_branchformer/__init__.py b/funasr/models/e_branchformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/e_branchformer/encoder.py b/funasr/models/e_branchformer/encoder.py new file mode 100644 index 0000000..adc6642 --- /dev/null +++ b/funasr/models/e_branchformer/encoder.py @@ -0,0 +1,460 @@ +# Copyright 2022 Kwangyoun Kim (ASAPP inc.) +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""E-Branchformer encoder definition. +Reference: + Kwangyoun Kim, Felix Wu, Yifan Peng, Jing Pan, + Prashant Sridhar, Kyu J. Han, Shinji Watanabe, + "E-Branchformer: Branchformer with Enhanced merging + for speech recognition," in SLT 2022. +""" + +import logging +from typing import List, Optional, Tuple + +import torch +import torch.nn as nn +from funasr.models.ctc.ctc import CTC +from funasr.models.branchformer.cgmlp import ConvolutionalGatingMLP +from funasr.models.branchformer.fastformer import FastSelfAttention +from funasr.models.transformer.utils.nets_utils import get_activation, make_pad_mask +from funasr.models.transformer.attention import ( # noqa: H301 + LegacyRelPositionMultiHeadedAttention, + MultiHeadedAttention, + RelPositionMultiHeadedAttention, +) +from funasr.models.transformer.embedding import ( # noqa: H301 + LegacyRelPositionalEncoding, + PositionalEncoding, + RelPositionalEncoding, + ScaledPositionalEncoding, +) +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.subsampling import ( + Conv2dSubsampling, + Conv2dSubsampling2, + Conv2dSubsampling6, + Conv2dSubsampling8, + TooShortUttError, + check_short_utt, +) +from funasr.register import tables + + +class EBranchformerEncoderLayer(torch.nn.Module): + """E-Branchformer encoder layer module. + + Args: + size (int): model dimension + attn: standard self-attention or efficient attention + cgmlp: ConvolutionalGatingMLP + feed_forward: feed-forward module, optional + feed_forward: macaron-style feed-forward module, optional + dropout_rate (float): dropout probability + merge_conv_kernel (int): kernel size of the depth-wise conv in merge module + """ + + def __init__( + self, + size: int, + attn: torch.nn.Module, + cgmlp: torch.nn.Module, + feed_forward: Optional[torch.nn.Module], + feed_forward_macaron: Optional[torch.nn.Module], + dropout_rate: float, + merge_conv_kernel: int = 3, + ): + super().__init__() + + self.size = size + self.attn = attn + self.cgmlp = cgmlp + + self.feed_forward = feed_forward + self.feed_forward_macaron = feed_forward_macaron + self.ff_scale = 1.0 + if self.feed_forward is not None: + self.norm_ff = LayerNorm(size) + if self.feed_forward_macaron is not None: + self.ff_scale = 0.5 + self.norm_ff_macaron = LayerNorm(size) + + self.norm_mha = LayerNorm(size) # for the MHA module + self.norm_mlp = LayerNorm(size) # for the MLP module + self.norm_final = LayerNorm(size) # for the final output of the block + + self.dropout = torch.nn.Dropout(dropout_rate) + + self.depthwise_conv_fusion = torch.nn.Conv1d( + size + size, + size + size, + kernel_size=merge_conv_kernel, + stride=1, + padding=(merge_conv_kernel - 1) // 2, + groups=size + size, + bias=True, + ) + self.merge_proj = torch.nn.Linear(size + size, size) + + def forward(self, x_input, mask, cache=None): + """Compute encoded features. + + Args: + x_input (Union[Tuple, torch.Tensor]): Input tensor w/ or w/o pos emb. + - w/ pos emb: Tuple of tensors [(#batch, time, size), (1, time, size)]. + - w/o pos emb: Tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, 1, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + """ + + if cache is not None: + raise NotImplementedError("cache is not None, which is not tested") + + if isinstance(x_input, tuple): + x, pos_emb = x_input[0], x_input[1] + else: + x, pos_emb = x_input, None + + if self.feed_forward_macaron is not None: + residual = x + x = self.norm_ff_macaron(x) + x = residual + self.ff_scale * self.dropout(self.feed_forward_macaron(x)) + + # Two branches + x1 = x + x2 = x + + # Branch 1: multi-headed attention module + x1 = self.norm_mha(x1) + + if isinstance(self.attn, FastSelfAttention): + x_att = self.attn(x1, mask) + else: + if pos_emb is not None: + x_att = self.attn(x1, x1, x1, pos_emb, mask) + else: + x_att = self.attn(x1, x1, x1, mask) + + x1 = self.dropout(x_att) + + # Branch 2: convolutional gating mlp + x2 = self.norm_mlp(x2) + + if pos_emb is not None: + x2 = (x2, pos_emb) + x2 = self.cgmlp(x2, mask) + if isinstance(x2, tuple): + x2 = x2[0] + + x2 = self.dropout(x2) + + # Merge two branches + x_concat = torch.cat([x1, x2], dim=-1) + x_tmp = x_concat.transpose(1, 2) + x_tmp = self.depthwise_conv_fusion(x_tmp) + x_tmp = x_tmp.transpose(1, 2) + x = x + self.dropout(self.merge_proj(x_concat + x_tmp)) + + if self.feed_forward is not None: + # feed forward module + residual = x + x = self.norm_ff(x) + x = residual + self.ff_scale * self.dropout(self.feed_forward(x)) + + x = self.norm_final(x) + + if pos_emb is not None: + return (x, pos_emb), mask + + return x, mask + + +@tables.register("encoder_classes", "EBranchformerEncoder") +class EBranchformerEncoder(nn.Module): + """E-Branchformer encoder module.""" + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + attention_layer_type: str = "rel_selfattn", + pos_enc_layer_type: str = "rel_pos", + rel_pos_type: str = "latest", + cgmlp_linear_units: int = 2048, + cgmlp_conv_kernel: int = 31, + use_linear_after_conv: bool = False, + gate_activation: str = "identity", + num_blocks: int = 12, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: Optional[str] = "conv2d", + zero_triu: bool = False, + padding_idx: int = -1, + layer_drop_rate: float = 0.0, + max_pos_emb_len: int = 5000, + use_ffn: bool = False, + macaron_ffn: bool = False, + ffn_activation_type: str = "swish", + linear_units: int = 2048, + positionwise_layer_type: str = "linear", + merge_conv_kernel: int = 3, + interctc_layer_idx=None, + interctc_use_conditioning: bool = False, + ): + super().__init__() + self._output_size = output_size + + if rel_pos_type == "legacy": + if pos_enc_layer_type == "rel_pos": + pos_enc_layer_type = "legacy_rel_pos" + if attention_layer_type == "rel_selfattn": + attention_layer_type = "legacy_rel_selfattn" + elif rel_pos_type == "latest": + assert attention_layer_type != "legacy_rel_selfattn" + assert pos_enc_layer_type != "legacy_rel_pos" + else: + raise ValueError("unknown rel_pos_type: " + rel_pos_type) + + if pos_enc_layer_type == "abs_pos": + pos_enc_class = PositionalEncoding + elif pos_enc_layer_type == "scaled_abs_pos": + pos_enc_class = ScaledPositionalEncoding + elif pos_enc_layer_type == "rel_pos": + assert attention_layer_type == "rel_selfattn" + pos_enc_class = RelPositionalEncoding + elif pos_enc_layer_type == "legacy_rel_pos": + assert attention_layer_type == "legacy_rel_selfattn" + pos_enc_class = LegacyRelPositionalEncoding + logging.warning("Using legacy_rel_pos and it will be deprecated in the future.") + else: + raise ValueError("unknown pos_enc_layer: " + pos_enc_layer_type) + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + pos_enc_class(output_size, positional_dropout_rate, max_pos_emb_len), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate, max_pos_emb_len), + ) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate, max_pos_emb_len), + ) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate, max_pos_emb_len), + ) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate, max_pos_emb_len), + ) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + pos_enc_class(output_size, positional_dropout_rate, max_pos_emb_len), + ) + elif isinstance(input_layer, torch.nn.Module): + self.embed = torch.nn.Sequential( + input_layer, + pos_enc_class(output_size, positional_dropout_rate, max_pos_emb_len), + ) + elif input_layer is None: + if input_size == output_size: + self.embed = None + else: + self.embed = torch.nn.Linear(input_size, output_size) + else: + raise ValueError("unknown input_layer: " + input_layer) + + activation = get_activation(ffn_activation_type) + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + activation, + ) + elif positionwise_layer_type is None: + logging.warning("no macaron ffn") + else: + raise ValueError("Support only linear.") + + if attention_layer_type == "selfattn": + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + elif attention_layer_type == "legacy_rel_selfattn": + assert pos_enc_layer_type == "legacy_rel_pos" + encoder_selfattn_layer = LegacyRelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + logging.warning("Using legacy_rel_selfattn and it will be deprecated in the future.") + elif attention_layer_type == "rel_selfattn": + assert pos_enc_layer_type == "rel_pos" + encoder_selfattn_layer = RelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + zero_triu, + ) + elif attention_layer_type == "fast_selfattn": + assert pos_enc_layer_type in ["abs_pos", "scaled_abs_pos"] + encoder_selfattn_layer = FastSelfAttention + encoder_selfattn_layer_args = ( + output_size, + attention_heads, + attention_dropout_rate, + ) + else: + raise ValueError("unknown encoder_attn_layer: " + attention_layer_type) + + cgmlp_layer = ConvolutionalGatingMLP + cgmlp_layer_args = ( + output_size, + cgmlp_linear_units, + cgmlp_conv_kernel, + dropout_rate, + use_linear_after_conv, + gate_activation, + ) + + self.encoders = repeat( + num_blocks, + lambda lnum: EBranchformerEncoderLayer( + output_size, + encoder_selfattn_layer(*encoder_selfattn_layer_args), + cgmlp_layer(*cgmlp_layer_args), + positionwise_layer(*positionwise_layer_args) if use_ffn else None, + positionwise_layer(*positionwise_layer_args) if use_ffn and macaron_ffn else None, + dropout_rate, + merge_conv_kernel, + ), + layer_drop_rate, + ) + self.after_norm = LayerNorm(output_size) + + if interctc_layer_idx is None: + interctc_layer_idx = [] + self.interctc_layer_idx = interctc_layer_idx + if len(interctc_layer_idx) > 0: + assert 0 < min(interctc_layer_idx) and max(interctc_layer_idx) < num_blocks + self.interctc_use_conditioning = interctc_use_conditioning + self.conditioning_layer = None + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ctc: CTC = None, + max_layer: int = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Calculate forward propagation. + + Args: + xs_pad (torch.Tensor): Input tensor (#batch, L, input_size). + ilens (torch.Tensor): Input length (#batch). + prev_states (torch.Tensor): Not to be used now. + ctc (CTC): Intermediate CTC module. + max_layer (int): Layer depth below which InterCTC is applied. + Returns: + torch.Tensor: Output tensor (#batch, L, output_size). + torch.Tensor: Output length (#batch). + torch.Tensor: Not to be used now. + """ + + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + + if ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + elif self.embed is not None: + xs_pad = self.embed(xs_pad) + + intermediate_outs = [] + if len(self.interctc_layer_idx) == 0: + if max_layer is not None and 0 <= max_layer < len(self.encoders): + for layer_idx, encoder_layer in enumerate(self.encoders): + xs_pad, masks = encoder_layer(xs_pad, masks) + if layer_idx >= max_layer: + break + else: + xs_pad, masks = self.encoders(xs_pad, masks) + else: + for layer_idx, encoder_layer in enumerate(self.encoders): + xs_pad, masks = encoder_layer(xs_pad, masks) + + if layer_idx + 1 in self.interctc_layer_idx: + encoder_out = xs_pad + + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + intermediate_outs.append((layer_idx + 1, encoder_out)) + + if self.interctc_use_conditioning: + ctc_out = ctc.softmax(encoder_out) + + if isinstance(xs_pad, tuple): + xs_pad = list(xs_pad) + xs_pad[0] = xs_pad[0] + self.conditioning_layer(ctc_out) + xs_pad = tuple(xs_pad) + else: + xs_pad = xs_pad + self.conditioning_layer(ctc_out) + + if isinstance(xs_pad, tuple): + xs_pad = xs_pad[0] + + xs_pad = self.after_norm(xs_pad) + olens = masks.squeeze(1).sum(1) + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), olens, None + return xs_pad, olens, None diff --git a/funasr/models/e_branchformer/model.py b/funasr/models/e_branchformer/model.py new file mode 100644 index 0000000..9853f73 --- /dev/null +++ b/funasr/models/e_branchformer/model.py @@ -0,0 +1,17 @@ +import logging + +from funasr.models.transformer.model import Transformer +from funasr.register import tables + + +@tables.register("model_classes", "EBranchformer") +class EBranchformer(Transformer): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + *args, + **kwargs, + ): + + super().__init__(*args, **kwargs) diff --git a/funasr/models/e_branchformer/template.yaml b/funasr/models/e_branchformer/template.yaml new file mode 100644 index 0000000..7b0b27c --- /dev/null +++ b/funasr/models/e_branchformer/template.yaml @@ -0,0 +1,116 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Branchformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: EBranchformerEncoder +encoder_conf: + output_size: 256 + attention_heads: 4 + attention_layer_type: rel_selfattn + pos_enc_layer_type: rel_pos + rel_pos_type: latest + cgmlp_linear_units: 1024 + cgmlp_conv_kernel: 31 + use_linear_after_conv: false + gate_activation: identity + num_blocks: 12 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: conv2d + layer_drop_rate: 0.0 + linear_units: 1024 + positionwise_layer_type: linear + use_ffn: true + macaron_ffn: true + merge_conv_kernel: 31 + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0. + src_attention_dropout_rate: 0. + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + dither: 0.0 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 180 + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.001 + weight_decay: 0.000001 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 35000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 4 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/eend/__init__.py b/funasr/models/eend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/eend/e2e_diar_eend_ola.py b/funasr/models/eend/e2e_diar_eend_ola.py new file mode 100644 index 0000000..cae5d1f --- /dev/null +++ b/funasr/models/eend/e2e_diar_eend_ola.py @@ -0,0 +1,264 @@ +from contextlib import contextmanager +from distutils.version import LooseVersion +from typing import Dict, List, Tuple, Optional + +import numpy as np +import torch +import torch.nn as nn +import torch.nn.functional as F + +from funasr.frontends.wav_frontend import WavFrontendMel23 +from funasr.models.eend.encoder import EENDOLATransformerEncoder +from funasr.models.eend.encoder_decoder_attractor import EncoderDecoderAttractor +from funasr.models.eend.utils.losses import ( + standard_loss, + cal_power_loss, + fast_batch_pit_n_speaker_loss, +) +from funasr.models.eend.utils.power import create_powerlabel +from funasr.models.eend.utils.power import generate_mapping_dict +from funasr.train_utils.device_funcs import force_gatherable + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + pass +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +def pad_attractor(att, max_n_speakers): + C, D = att.shape + if C < max_n_speakers: + att = torch.cat( + [att, torch.zeros(max_n_speakers - C, D).to(torch.float32).to(att.device)], dim=0 + ) + return att + + +def pad_labels(ts, out_size): + for i, t in enumerate(ts): + if t.shape[1] < out_size: + ts[i] = F.pad(t, (0, out_size - t.shape[1], 0, 0), mode="constant", value=0.0) + return ts + + +def pad_results(ys, out_size): + ys_padded = [] + for i, y in enumerate(ys): + if y.shape[1] < out_size: + ys_padded.append( + torch.cat( + [ + y, + torch.zeros(y.shape[0], out_size - y.shape[1]) + .to(torch.float32) + .to(y.device), + ], + dim=1, + ) + ) + else: + ys_padded.append(y) + return ys_padded + + +class DiarEENDOLAModel(nn.Module): + """EEND-OLA diarization model""" + + def __init__( + self, + frontend: Optional[WavFrontendMel23], + encoder: EENDOLATransformerEncoder, + encoder_decoder_attractor: EncoderDecoderAttractor, + n_units: int = 256, + max_n_speaker: int = 8, + attractor_loss_weight: float = 1.0, + mapping_dict=None, + **kwargs, + ): + super().__init__() + self.frontend = frontend + self.enc = encoder + self.encoder_decoder_attractor = encoder_decoder_attractor + self.attractor_loss_weight = attractor_loss_weight + self.max_n_speaker = max_n_speaker + if mapping_dict is None: + mapping_dict = generate_mapping_dict(max_speaker_num=self.max_n_speaker) + self.mapping_dict = mapping_dict + # PostNet + self.postnet = nn.LSTM(self.max_n_speaker, n_units, 1, batch_first=True) + self.output_layer = nn.Linear(n_units, mapping_dict["oov"] + 1) + + def forward_encoder(self, xs, ilens): + xs = nn.utils.rnn.pad_sequence(xs, batch_first=True, padding_value=-1) + pad_shape = xs.shape + xs_mask = [torch.ones(ilen).to(xs.device) for ilen in ilens] + xs_mask = torch.nn.utils.rnn.pad_sequence( + xs_mask, batch_first=True, padding_value=0 + ).unsqueeze(-2) + emb = self.enc(xs, xs_mask) + emb = torch.split(emb.view(pad_shape[0], pad_shape[1], -1), 1, dim=0) + emb = [e[0][:ilen] for e, ilen in zip(emb, ilens)] + return emb + + def forward_post_net(self, logits, ilens): + maxlen = torch.max(ilens).to(torch.int).item() + logits = nn.utils.rnn.pad_sequence(logits, batch_first=True, padding_value=-1) + logits = nn.utils.rnn.pack_padded_sequence( + logits, ilens.cpu().to(torch.int64), batch_first=True, enforce_sorted=False + ) + outputs, (_, _) = self.postnet(logits) + outputs = nn.utils.rnn.pad_packed_sequence( + outputs, batch_first=True, padding_value=-1, total_length=maxlen + )[0] + outputs = [output[: ilens[i].to(torch.int).item()] for i, output in enumerate(outputs)] + outputs = [self.output_layer(output) for output in outputs] + return outputs + + def forward( + self, + speech: List[torch.Tensor], + speaker_labels: List[torch.Tensor], + orders: torch.Tensor, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + + # Check that batch_size is unified + assert len(speech) == len(speaker_labels), (len(speech), len(speaker_labels)) + speech_lengths = torch.tensor([len(sph) for sph in speech]).to(torch.int64) + speaker_labels_lengths = torch.tensor([spk.shape[-1] for spk in speaker_labels]).to( + torch.int64 + ) + batch_size = len(speech) + + # Encoder + encoder_out = self.forward_encoder(speech, speech_lengths) + + # Encoder-decoder attractor + attractor_loss, attractors = self.encoder_decoder_attractor( + [e[order] for e, order in zip(encoder_out, orders)], speaker_labels_lengths + ) + speaker_logits = [ + torch.matmul(e, att.permute(1, 0)) for e, att in zip(encoder_out, attractors) + ] + + # pit loss + pit_speaker_labels = fast_batch_pit_n_speaker_loss(speaker_logits, speaker_labels) + pit_loss = standard_loss(speaker_logits, pit_speaker_labels) + + # pse loss + with torch.no_grad(): + power_ts = [ + create_powerlabel(label.cpu().numpy(), self.mapping_dict, self.max_n_speaker).to( + encoder_out[0].device, non_blocking=True + ) + for label in pit_speaker_labels + ] + pad_attractors = [pad_attractor(att, self.max_n_speaker) for att in attractors] + pse_speaker_logits = [ + torch.matmul(e, pad_att.permute(1, 0)) + for e, pad_att in zip(encoder_out, pad_attractors) + ] + pse_speaker_logits = self.forward_post_net(pse_speaker_logits, speech_lengths) + pse_loss = cal_power_loss(pse_speaker_logits, power_ts) + + loss = pse_loss + pit_loss + self.attractor_loss_weight * attractor_loss + + stats = dict() + stats["pse_loss"] = pse_loss.detach() + stats["pit_loss"] = pit_loss.detach() + stats["attractor_loss"] = attractor_loss.detach() + stats["batch_size"] = batch_size + + # Collect total loss stats + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def estimate_sequential( + self, + speech: torch.Tensor, + n_speakers: int = None, + shuffle: bool = True, + threshold: float = 0.5, + **kwargs, + ): + speech_lengths = torch.tensor([len(sph) for sph in speech]).to(torch.int64) + emb = self.forward_encoder(speech, speech_lengths) + if shuffle: + orders = [np.arange(e.shape[0]) for e in emb] + for order in orders: + np.random.shuffle(order) + attractors, probs = self.encoder_decoder_attractor.estimate( + [ + e[torch.from_numpy(order).to(torch.long).to(speech[0].device)] + for e, order in zip(emb, orders) + ] + ) + else: + attractors, probs = self.encoder_decoder_attractor.estimate(emb) + attractors_active = [] + for p, att, e in zip(probs, attractors, emb): + if n_speakers and n_speakers >= 0: + att = att[:n_speakers,] + attractors_active.append(att) + elif threshold is not None: + silence = torch.nonzero(p < threshold)[0] + n_spk = silence[0] if silence.size else None + att = att[:n_spk,] + attractors_active.append(att) + else: + NotImplementedError("n_speakers or threshold has to be given.") + raw_n_speakers = [att.shape[0] for att in attractors_active] + attractors = [ + ( + pad_attractor(att, self.max_n_speaker) + if att.shape[0] <= self.max_n_speaker + else att[: self.max_n_speaker] + ) + for att in attractors_active + ] + ys = [torch.matmul(e, att.permute(1, 0)) for e, att in zip(emb, attractors)] + logits = self.forward_post_net(ys, speech_lengths) + ys = [ + self.recover_y_from_powerlabel(logit, raw_n_speaker) + for logit, raw_n_speaker in zip(logits, raw_n_speakers) + ] + + return ys, emb, attractors, raw_n_speakers + + def recover_y_from_powerlabel(self, logit, n_speaker): + pred = torch.argmax(torch.softmax(logit, dim=-1), dim=-1) + oov_index = torch.where(pred == self.mapping_dict["oov"])[0] + for i in oov_index: + if i > 0: + pred[i] = pred[i - 1] + else: + pred[i] = 0 + pred = [self.inv_mapping_func(i) for i in pred] + decisions = [bin(num)[2:].zfill(self.max_n_speaker)[::-1] for num in pred] + decisions = ( + torch.from_numpy( + np.stack([np.array([int(i) for i in dec]) for dec in decisions], axis=0) + ) + .to(logit.device) + .to(torch.float32) + ) + decisions = decisions[:, :n_speaker] + return decisions + + def inv_mapping_func(self, label): + + if not isinstance(label, int): + label = int(label) + if label in self.mapping_dict["label2dec"].keys(): + num = self.mapping_dict["label2dec"][label] + else: + num = -1 + return num + + def collect_feats(self, **batch: torch.Tensor) -> Dict[str, torch.Tensor]: + pass diff --git a/funasr/models/eend/eend_ola_dataloader.py b/funasr/models/eend/eend_ola_dataloader.py new file mode 100644 index 0000000..43f00fb --- /dev/null +++ b/funasr/models/eend/eend_ola_dataloader.py @@ -0,0 +1,57 @@ +import logging + +import kaldiio +import numpy as np +import torch +from torch.utils.data import DataLoader +from torch.utils.data import Dataset + + +def custom_collate(batch): + keys, speech, speaker_labels, orders = zip(*batch) + speech = [torch.from_numpy(np.copy(sph)).to(torch.float32) for sph in speech] + speaker_labels = [torch.from_numpy(np.copy(spk)).to(torch.float32) for spk in speaker_labels] + orders = [torch.from_numpy(np.copy(o)).to(torch.int64) for o in orders] + batch = dict(speech=speech, speaker_labels=speaker_labels, orders=orders) + + return keys, batch + + +class EENDOLADataset(Dataset): + def __init__( + self, + data_file, + ): + self.data_file = data_file + with open(data_file) as f: + lines = f.readlines() + self.samples = [line.strip().split() for line in lines] + logging.info("total samples: {}".format(len(self.samples))) + + def __len__(self): + return len(self.samples) + + def __getitem__(self, idx): + key, speech_path, speaker_label_path = self.samples[idx] + speech = kaldiio.load_mat(speech_path) + speaker_label = kaldiio.load_mat(speaker_label_path).reshape(speech.shape[0], -1) + + order = np.arange(speech.shape[0]) + np.random.shuffle(order) + + return key, speech, speaker_label, order + + +class EENDOLADataLoader: + def __init__(self, data_file, batch_size, shuffle=True, num_workers=8): + dataset = EENDOLADataset(data_file) + self.data_loader = DataLoader( + dataset, + batch_size=batch_size, + collate_fn=custom_collate, + shuffle=shuffle, + num_workers=num_workers, + ) + + def build_iter(self, epoch): + return self.data_loader diff --git a/funasr/models/eend/encoder.py b/funasr/models/eend/encoder.py new file mode 100644 index 0000000..0dbd98f --- /dev/null +++ b/funasr/models/eend/encoder.py @@ -0,0 +1,118 @@ +import math + +import torch +import torch.nn.functional as F +from torch import nn + + +class MultiHeadSelfAttention(nn.Module): + def __init__(self, n_units, h=8, dropout_rate=0.1): + super().__init__() + self.linearQ = nn.Linear(n_units, n_units) + self.linearK = nn.Linear(n_units, n_units) + self.linearV = nn.Linear(n_units, n_units) + self.linearO = nn.Linear(n_units, n_units) + self.d_k = n_units // h + self.h = h + self.dropout = nn.Dropout(dropout_rate) + + def __call__(self, x, batch_size, x_mask): + q = self.linearQ(x).view(batch_size, -1, self.h, self.d_k) + k = self.linearK(x).view(batch_size, -1, self.h, self.d_k) + v = self.linearV(x).view(batch_size, -1, self.h, self.d_k) + scores = torch.matmul(q.permute(0, 2, 1, 3), k.permute(0, 2, 3, 1)) / math.sqrt(self.d_k) + if x_mask is not None: + x_mask = x_mask.unsqueeze(1) + scores = scores.masked_fill(x_mask == 0, -1e9) + self.att = F.softmax(scores, dim=3) + p_att = self.dropout(self.att) + x = torch.matmul(p_att, v.permute(0, 2, 1, 3)) + x = x.permute(0, 2, 1, 3).contiguous().view(-1, self.h * self.d_k) + return self.linearO(x) + + +class PositionwiseFeedForward(nn.Module): + def __init__(self, n_units, d_units, dropout_rate): + super(PositionwiseFeedForward, self).__init__() + self.linear1 = nn.Linear(n_units, d_units) + self.linear2 = nn.Linear(d_units, n_units) + self.dropout = nn.Dropout(dropout_rate) + + def __call__(self, x): + return self.linear2(self.dropout(F.relu(self.linear1(x)))) + + +class PositionalEncoding(torch.nn.Module): + def __init__(self, d_model, dropout_rate, max_len=5000, reverse=False): + super(PositionalEncoding, self).__init__() + self.d_model = d_model + self.reverse = reverse + self.xscale = math.sqrt(self.d_model) + self.dropout = torch.nn.Dropout(p=dropout_rate) + self.pe = None + self.extend_pe(torch.tensor(0.0).expand(1, max_len)) + + def extend_pe(self, x): + if self.pe is not None: + if self.pe.size(1) >= x.size(1): + if self.pe.dtype != x.dtype or self.pe.device != x.device: + self.pe = self.pe.to(dtype=x.dtype, device=x.device) + return + pe = torch.zeros(x.size(1), self.d_model) + if self.reverse: + position = torch.arange(x.size(1) - 1, -1, -1.0, dtype=torch.float32).unsqueeze(1) + else: + position = torch.arange(0, x.size(1), dtype=torch.float32).unsqueeze(1) + div_term = torch.exp( + torch.arange(0, self.d_model, 2, dtype=torch.float32) + * -(math.log(10000.0) / self.d_model) + ) + pe[:, 0::2] = torch.sin(position * div_term) + pe[:, 1::2] = torch.cos(position * div_term) + pe = pe.unsqueeze(0) + self.pe = pe.to(device=x.device, dtype=x.dtype) + + def forward(self, x: torch.Tensor): + self.extend_pe(x) + x = x * self.xscale + self.pe[:, : x.size(1)] + return self.dropout(x) + + +class EENDOLATransformerEncoder(nn.Module): + def __init__( + self, + idim: int, + n_layers: int, + n_units: int, + e_units: int = 2048, + h: int = 4, + dropout_rate: float = 0.1, + use_pos_emb: bool = False, + ): + super(EENDOLATransformerEncoder, self).__init__() + self.linear_in = nn.Linear(idim, n_units) + self.lnorm_in = nn.LayerNorm(n_units) + self.n_layers = n_layers + self.dropout = nn.Dropout(dropout_rate) + for i in range(n_layers): + setattr(self, "{}{:d}".format("lnorm1_", i), nn.LayerNorm(n_units)) + setattr(self, "{}{:d}".format("self_att_", i), MultiHeadSelfAttention(n_units, h)) + setattr(self, "{}{:d}".format("lnorm2_", i), nn.LayerNorm(n_units)) + setattr( + self, + "{}{:d}".format("ff_", i), + PositionwiseFeedForward(n_units, e_units, dropout_rate), + ) + self.lnorm_out = nn.LayerNorm(n_units) + + def __call__(self, x, x_mask=None): + BT_size = x.shape[0] * x.shape[1] + e = self.linear_in(x.reshape(BT_size, -1)) + for i in range(self.n_layers): + e = getattr(self, "{}{:d}".format("lnorm1_", i))(e) + s = getattr(self, "{}{:d}".format("self_att_", i))(e, x.shape[0], x_mask) + e = e + self.dropout(s) + e = getattr(self, "{}{:d}".format("lnorm2_", i))(e) + s = getattr(self, "{}{:d}".format("ff_", i))(e) + e = e + self.dropout(s) + return self.lnorm_out(e) diff --git a/funasr/models/eend/encoder_decoder_attractor.py b/funasr/models/eend/encoder_decoder_attractor.py new file mode 100644 index 0000000..6500791 --- /dev/null +++ b/funasr/models/eend/encoder_decoder_attractor.py @@ -0,0 +1,64 @@ +import numpy as np +import torch +import torch.nn.functional as F +from torch import nn + + +class EncoderDecoderAttractor(nn.Module): + + def __init__(self, n_units, encoder_dropout=0.1, decoder_dropout=0.1): + super(EncoderDecoderAttractor, self).__init__() + self.enc0_dropout = nn.Dropout(encoder_dropout) + self.encoder = nn.LSTM(n_units, n_units, 1, batch_first=True, dropout=encoder_dropout) + self.dec0_dropout = nn.Dropout(decoder_dropout) + self.decoder = nn.LSTM(n_units, n_units, 1, batch_first=True, dropout=decoder_dropout) + self.counter = nn.Linear(n_units, 1) + self.n_units = n_units + + def forward_core(self, xs, zeros): + ilens = torch.from_numpy(np.array([x.shape[0] for x in xs])).to(torch.int64) + xs = [self.enc0_dropout(x) for x in xs] + xs = nn.utils.rnn.pad_sequence(xs, batch_first=True, padding_value=-1) + xs = nn.utils.rnn.pack_padded_sequence(xs, ilens, batch_first=True, enforce_sorted=False) + _, (hx, cx) = self.encoder(xs) + zlens = torch.from_numpy(np.array([z.shape[0] for z in zeros])).to(torch.int64) + max_zlen = torch.max(zlens).to(torch.int).item() + zeros = [self.enc0_dropout(z) for z in zeros] + zeros = nn.utils.rnn.pad_sequence(zeros, batch_first=True, padding_value=-1) + zeros = nn.utils.rnn.pack_padded_sequence( + zeros, zlens, batch_first=True, enforce_sorted=False + ) + attractors, (_, _) = self.decoder(zeros, (hx, cx)) + attractors = nn.utils.rnn.pad_packed_sequence( + attractors, batch_first=True, padding_value=-1, total_length=max_zlen + )[0] + attractors = [att[: zlens[i].to(torch.int).item()] for i, att in enumerate(attractors)] + return attractors + + def forward(self, xs, n_speakers): + zeros = [ + torch.zeros(n_spk + 1, self.n_units).to(torch.float32).to(xs[0].device) + for n_spk in n_speakers + ] + attractors = self.forward_core(xs, zeros) + labels = torch.cat( + [torch.from_numpy(np.array([[1] * n_spk + [0]], np.float32)) for n_spk in n_speakers], + dim=1, + ) + labels = labels.to(xs[0].device) + logit = torch.cat( + [self.counter(att).view(-1, n_spk + 1) for att, n_spk in zip(attractors, n_speakers)], + dim=1, + ) + loss = F.binary_cross_entropy(torch.sigmoid(logit), labels) + + attractors = [att[slice(0, att.shape[0] - 1)] for att in attractors] + return loss, attractors + + def estimate(self, xs, max_n_speakers=15): + zeros = [ + torch.zeros(max_n_speakers, self.n_units).to(torch.float32).to(xs[0].device) for _ in xs + ] + attractors = self.forward_core(xs, zeros) + probs = [torch.sigmoid(torch.flatten(self.counter(att))) for att in attractors] + return attractors, probs diff --git a/funasr/models/eend/utils/__init__.py b/funasr/models/eend/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/eend/utils/feature.py b/funasr/models/eend/utils/feature.py new file mode 100644 index 0000000..1dd55dc --- /dev/null +++ b/funasr/models/eend/utils/feature.py @@ -0,0 +1,262 @@ +# Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) +# Licensed under the MIT license. +# +# This module is for computing audio features + +import numpy as np +import librosa + + +def get_input_dim( + frame_size, + context_size, + transform_type, +): + if transform_type.startswith("logmel23"): + frame_size = 23 + elif transform_type.startswith("logmel"): + frame_size = 40 + else: + fft_size = 1 << (frame_size - 1).bit_length() + frame_size = int(fft_size / 2) + 1 + input_dim = (2 * context_size + 1) * frame_size + return input_dim + + +def transform(Y, transform_type=None, dtype=np.float32): + """Transform STFT feature + + Args: + Y: STFT + (n_frames, n_bins)-shaped np.complex array + transform_type: + None, "log" + dtype: output data type + np.float32 is expected + Returns: + Y (numpy.array): transformed feature + """ + Y = np.abs(Y) + if not transform_type: + pass + elif transform_type == "log": + Y = np.log(np.maximum(Y, 1e-10)) + elif transform_type == "logmel": + n_fft = 2 * (Y.shape[1] - 1) + sr = 16000 + n_mels = 40 + mel_basis = librosa.filters.mel(sr, n_fft, n_mels) + Y = np.dot(Y**2, mel_basis.T) + Y = np.log10(np.maximum(Y, 1e-10)) + elif transform_type == "logmel23": + n_fft = 2 * (Y.shape[1] - 1) + sr = 8000 + n_mels = 23 + mel_basis = librosa.filters.mel(sr, n_fft, n_mels) + Y = np.dot(Y**2, mel_basis.T) + Y = np.log10(np.maximum(Y, 1e-10)) + elif transform_type == "logmel23_mn": + n_fft = 2 * (Y.shape[1] - 1) + sr = 8000 + n_mels = 23 + mel_basis = librosa.filters.mel(sr, n_fft, n_mels) + Y = np.dot(Y**2, mel_basis.T) + Y = np.log10(np.maximum(Y, 1e-10)) + mean = np.mean(Y, axis=0) + Y = Y - mean + elif transform_type == "logmel23_swn": + n_fft = 2 * (Y.shape[1] - 1) + sr = 8000 + n_mels = 23 + mel_basis = librosa.filters.mel(sr, n_fft, n_mels) + Y = np.dot(Y**2, mel_basis.T) + Y = np.log10(np.maximum(Y, 1e-10)) + # b = np.ones(300)/300 + # mean = scipy.signal.convolve2d(Y, b[:, None], mode='same') + + # simple 2-means based threshoding for mean calculation + powers = np.sum(Y, axis=1) + th = (np.max(powers) + np.min(powers)) / 2.0 + for i in range(10): + th = (np.mean(powers[powers >= th]) + np.mean(powers[powers < th])) / 2 + mean = np.mean(Y[powers > th, :], axis=0) + Y = Y - mean + elif transform_type == "logmel23_mvn": + n_fft = 2 * (Y.shape[1] - 1) + sr = 8000 + n_mels = 23 + mel_basis = librosa.filters.mel(sr, n_fft, n_mels) + Y = np.dot(Y**2, mel_basis.T) + Y = np.log10(np.maximum(Y, 1e-10)) + mean = np.mean(Y, axis=0) + Y = Y - mean + std = np.maximum(np.std(Y, axis=0), 1e-10) + Y = Y / std + else: + raise ValueError("Unknown transform_type: %s" % transform_type) + return Y.astype(dtype) + + +def subsample(Y, T, subsampling=1): + """Frame subsampling""" + Y_ss = Y[::subsampling] + T_ss = T[::subsampling] + return Y_ss, T_ss + + +def splice(Y, context_size=0): + """Frame splicing + + Args: + Y: feature + (n_frames, n_featdim)-shaped numpy array + context_size: + number of frames concatenated on left-side + if context_size = 5, 11 frames are concatenated. + + Returns: + Y_spliced: spliced feature + (n_frames, n_featdim * (2 * context_size + 1))-shaped + """ + Y_pad = np.pad(Y, [(context_size, context_size), (0, 0)], "constant") + Y_spliced = np.lib.stride_tricks.as_strided( + np.ascontiguousarray(Y_pad), + (Y.shape[0], Y.shape[1] * (2 * context_size + 1)), + (Y.itemsize * Y.shape[1], Y.itemsize), + writeable=False, + ) + return Y_spliced + + +def stft(data, frame_size=1024, frame_shift=256): + """Compute STFT features + + Args: + data: audio signal + (n_samples,)-shaped np.float32 array + frame_size: number of samples in a frame (must be a power of two) + frame_shift: number of samples between frames + + Returns: + stft: STFT frames + (n_frames, n_bins)-shaped np.complex64 array + """ + # round up to nearest power of 2 + fft_size = 1 << (frame_size - 1).bit_length() + # HACK: The last frame is ommited + # as librosa.stft produces such an excessive frame + if len(data) % frame_shift == 0: + return librosa.stft(data, n_fft=fft_size, win_length=frame_size, hop_length=frame_shift).T[ + :-1 + ] + else: + return librosa.stft(data, n_fft=fft_size, win_length=frame_size, hop_length=frame_shift).T + + +def _count_frames(data_len, size, shift): + # HACK: Assuming librosa.stft(..., center=True) + n_frames = 1 + int(data_len / shift) + if data_len % shift == 0: + n_frames = n_frames - 1 + return n_frames + + +def get_frame_labels( + kaldi_obj, rec, start=0, end=None, frame_size=1024, frame_shift=256, n_speakers=None +): + """Get frame-aligned labels of given recording + Args: + kaldi_obj (KaldiData) + rec (str): recording id + start (int): start frame index + end (int): end frame index + None means the last frame of recording + frame_size (int): number of frames in a frame + frame_shift (int): number of shift samples + n_speakers (int): number of speakers + if None, the value is given from data + Returns: + T: label + (n_frames, n_speakers)-shaped np.int32 array + """ + filtered_segments = kaldi_obj.segments[kaldi_obj.segments["rec"] == rec] + speakers = np.unique([kaldi_obj.utt2spk[seg["utt"]] for seg in filtered_segments]).tolist() + if n_speakers is None: + n_speakers = len(speakers) + es = end * frame_shift if end is not None else None + data, rate = kaldi_obj.load_wav(rec, start * frame_shift, es) + n_frames = _count_frames(len(data), frame_size, frame_shift) + T = np.zeros((n_frames, n_speakers), dtype=np.int32) + if end is None: + end = n_frames + + for seg in filtered_segments: + speaker_index = speakers.index(kaldi_obj.utt2spk[seg["utt"]]) + start_frame = np.rint(seg["st"] * rate / frame_shift).astype(int) + end_frame = np.rint(seg["et"] * rate / frame_shift).astype(int) + rel_start = rel_end = None + if start <= start_frame and start_frame < end: + rel_start = start_frame - start + if start < end_frame and end_frame <= end: + rel_end = end_frame - start + if rel_start is not None or rel_end is not None: + T[rel_start:rel_end, speaker_index] = 1 + return T + + +def get_labeledSTFT( + kaldi_obj, rec, start, end, frame_size, frame_shift, n_speakers=None, use_speaker_id=False +): + """Extracts STFT and corresponding labels + + Extracts STFT and corresponding diarization labels for + given recording id and start/end times + + Args: + kaldi_obj (KaldiData) + rec (str): recording id + start (int): start frame index + end (int): end frame index + frame_size (int): number of samples in a frame + frame_shift (int): number of shift samples + n_speakers (int): number of speakers + if None, the value is given from data + Returns: + Y: STFT + (n_frames, n_bins)-shaped np.complex64 array, + T: label + (n_frmaes, n_speakers)-shaped np.int32 array. + """ + data, rate = kaldi_obj.load_wav(rec, start * frame_shift, end * frame_shift) + Y = stft(data, frame_size, frame_shift) + filtered_segments = kaldi_obj.segments[rec] + # filtered_segments = kaldi_obj.segments[kaldi_obj.segments['rec'] == rec] + speakers = np.unique([kaldi_obj.utt2spk[seg["utt"]] for seg in filtered_segments]).tolist() + if n_speakers is None: + n_speakers = len(speakers) + T = np.zeros((Y.shape[0], n_speakers), dtype=np.int32) + + if use_speaker_id: + all_speakers = sorted(kaldi_obj.spk2utt.keys()) + S = np.zeros((Y.shape[0], len(all_speakers)), dtype=np.int32) + + for seg in filtered_segments: + speaker_index = speakers.index(kaldi_obj.utt2spk[seg["utt"]]) + if use_speaker_id: + all_speaker_index = all_speakers.index(kaldi_obj.utt2spk[seg["utt"]]) + start_frame = np.rint(seg["st"] * rate / frame_shift).astype(int) + end_frame = np.rint(seg["et"] * rate / frame_shift).astype(int) + rel_start = rel_end = None + if start <= start_frame and start_frame < end: + rel_start = start_frame - start + if start < end_frame and end_frame <= end: + rel_end = end_frame - start + if rel_start is not None or rel_end is not None: + T[rel_start:rel_end, speaker_index] = 1 + if use_speaker_id: + S[rel_start:rel_end, all_speaker_index] = 1 + + if use_speaker_id: + return Y, T, S + else: + return Y, T diff --git a/funasr/models/eend/utils/kaldi_data.py b/funasr/models/eend/utils/kaldi_data.py new file mode 100644 index 0000000..59e7a16 --- /dev/null +++ b/funasr/models/eend/utils/kaldi_data.py @@ -0,0 +1,152 @@ +# Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) +# Licensed under the MIT license. +# +# This library provides utilities for kaldi-style data directory. + + +from __future__ import print_function +import os +import sys +import numpy as np +import subprocess +import librosa as sf +import io +from functools import lru_cache + + +def load_segments(segments_file): + """load segments file as array""" + if not os.path.exists(segments_file): + return None + return np.loadtxt( + segments_file, + dtype=[("utt", "object"), ("rec", "object"), ("st", "f"), ("et", "f")], + ndmin=1, + ) + + +def load_segments_hash(segments_file): + ret = {} + if not os.path.exists(segments_file): + return None + for line in open(segments_file): + utt, rec, st, et = line.strip().split() + ret[utt] = (rec, float(st), float(et)) + return ret + + +def load_segments_rechash(segments_file): + ret = {} + if not os.path.exists(segments_file): + return None + for line in open(segments_file): + utt, rec, st, et = line.strip().split() + if rec not in ret: + ret[rec] = [] + ret[rec].append({"utt": utt, "st": float(st), "et": float(et)}) + return ret + + +def load_wav_scp(wav_scp_file): + """return dictionary { rec: wav_rxfilename }""" + lines = [line.strip().split(None, 1) for line in open(wav_scp_file)] + return {x[0]: x[1] for x in lines} + + +@lru_cache(maxsize=1) +def load_wav(wav_rxfilename, start=0, end=None): + """This function reads audio file and return data in numpy.float32 array. + "lru_cache" holds recently loaded audio so that can be called + many times on the same audio file. + OPTIMIZE: controls lru_cache size for random access, + considering memory size + """ + if wav_rxfilename.endswith("|"): + # input piped command + p = subprocess.Popen(wav_rxfilename[:-1], shell=True, stdout=subprocess.PIPE) + data, samplerate = sf.load(io.BytesIO(p.stdout.read()), dtype="float32") + # cannot seek + data = data[start:end] + elif wav_rxfilename == "-": + # stdin + data, samplerate = sf.load(sys.stdin, dtype="float32") + # cannot seek + data = data[start:end] + else: + # normal wav file + data, samplerate = sf.load(wav_rxfilename, start=start, stop=end) + return data, samplerate + + +def load_utt2spk(utt2spk_file): + """returns dictionary { uttid: spkid }""" + lines = [line.strip().split(None, 1) for line in open(utt2spk_file)] + return {x[0]: x[1] for x in lines} + + +def load_spk2utt(spk2utt_file): + """returns dictionary { spkid: list of uttids }""" + if not os.path.exists(spk2utt_file): + return None + lines = [line.strip().split() for line in open(spk2utt_file)] + return {x[0]: x[1:] for x in lines} + + +def load_reco2dur(reco2dur_file): + """returns dictionary { recid: duration }""" + if not os.path.exists(reco2dur_file): + return None + lines = [line.strip().split(None, 1) for line in open(reco2dur_file)] + return {x[0]: float(x[1]) for x in lines} + + +def process_wav(wav_rxfilename, process): + """This function returns preprocessed wav_rxfilename + Args: + wav_rxfilename: input + process: command which can be connected via pipe, + use stdin and stdout + Returns: + wav_rxfilename: output piped command + """ + if wav_rxfilename.endswith("|"): + # input piped command + return wav_rxfilename + process + "|" + else: + # stdin "-" or normal file + return "cat {} | {} |".format(wav_rxfilename, process) + + +def extract_segments(wavs, segments=None): + """This function returns generator of segmented audio as + (utterance id, numpy.float32 array) + TODO?: sampling rate is not converted. + """ + if segments is not None: + # segments should be sorted by rec-id + for seg in segments: + wav = wavs[seg["rec"]] + data, samplerate = load_wav(wav) + st_sample = np.rint(seg["st"] * samplerate).astype(int) + et_sample = np.rint(seg["et"] * samplerate).astype(int) + yield seg["utt"], data[st_sample:et_sample] + else: + # segments file not found, + # wav.scp is used as segmented audio list + for rec in wavs: + data, samplerate = load_wav(wavs[rec]) + yield rec, data + + +class KaldiData: + def __init__(self, data_dir): + self.data_dir = data_dir + self.segments = load_segments_rechash(os.path.join(self.data_dir, "segments")) + self.utt2spk = load_utt2spk(os.path.join(self.data_dir, "utt2spk")) + self.wavs = load_wav_scp(os.path.join(self.data_dir, "wav.scp")) + self.reco2dur = load_reco2dur(os.path.join(self.data_dir, "reco2dur")) + self.spk2utt = load_spk2utt(os.path.join(self.data_dir, "spk2utt")) + + def load_wav(self, recid, start=0, end=None): + data, rate = load_wav(self.wavs[recid], start, end) + return data, rate diff --git a/funasr/models/eend/utils/losses.py b/funasr/models/eend/utils/losses.py new file mode 100644 index 0000000..82fb573 --- /dev/null +++ b/funasr/models/eend/utils/losses.py @@ -0,0 +1,49 @@ +import numpy as np +import torch +import torch.nn.functional as F +from scipy.optimize import linear_sum_assignment + + +def standard_loss(ys, ts): + losses = [F.binary_cross_entropy(torch.sigmoid(y), t) * len(y) for y, t in zip(ys, ts)] + loss = torch.sum(torch.stack(losses)) + n_frames = ( + torch.from_numpy(np.array(np.sum([t.shape[0] for t in ts]))) + .to(torch.float32) + .to(ys[0].device) + ) + loss = loss / n_frames + return loss + + +def fast_batch_pit_n_speaker_loss(ys, ts): + with torch.no_grad(): + bs = len(ys) + indices = [] + for b in range(bs): + y = ys[b].transpose(0, 1) + t = ts[b].transpose(0, 1) + C, _ = t.shape + y = y[:, None, :].repeat(1, C, 1) + t = t[None, :, :].repeat(C, 1, 1) + bce_loss = F.binary_cross_entropy(torch.sigmoid(y), t, reduction="none").mean(-1) + C = bce_loss.cpu() + indices.append(linear_sum_assignment(C)) + labels_perm = [t[:, idx[1]] for t, idx in zip(ts, indices)] + + return labels_perm + + +def cal_power_loss(logits, power_ts): + losses = [ + F.cross_entropy(input=logit, target=power_t.to(torch.long)) * len(logit) + for logit, power_t in zip(logits, power_ts) + ] + loss = torch.sum(torch.stack(losses)) + n_frames = ( + torch.from_numpy(np.array(np.sum([power_t.shape[0] for power_t in power_ts]))) + .to(torch.float32) + .to(power_ts[0].device) + ) + loss = loss / n_frames + return loss diff --git a/funasr/models/eend/utils/power.py b/funasr/models/eend/utils/power.py new file mode 100644 index 0000000..b6b32c5 --- /dev/null +++ b/funasr/models/eend/utils/power.py @@ -0,0 +1,104 @@ +import numpy as np +import torch +import torch.multiprocessing +import torch.nn.functional as F +from itertools import combinations +from itertools import permutations + + +def generate_mapping_dict(max_speaker_num=6, max_olp_speaker_num=3): + all_kinds = [] + all_kinds.append(0) + for i in range(max_olp_speaker_num): + selected_num = i + 1 + coms = np.array(list(combinations(np.arange(max_speaker_num), selected_num))) + for com in coms: + tmp = np.zeros(max_speaker_num) + tmp[com] = 1 + item = int(raw_dec_trans(tmp.reshape(1, -1), max_speaker_num)[0]) + all_kinds.append(item) + all_kinds_order = sorted(all_kinds) + + mapping_dict = {} + mapping_dict["dec2label"] = {} + mapping_dict["label2dec"] = {} + for i in range(len(all_kinds_order)): + dec = all_kinds_order[i] + mapping_dict["dec2label"][dec] = i + mapping_dict["label2dec"][i] = dec + oov_id = len(all_kinds_order) + mapping_dict["oov"] = oov_id + return mapping_dict + + +def raw_dec_trans(x, max_speaker_num): + num_list = [] + for i in range(max_speaker_num): + num_list.append(x[:, i]) + base = 1 + T = x.shape[0] + res = np.zeros((T)) + for num in num_list: + res += num * base + base = base * 2 + return res + + +def mapping_func(num, mapping_dict): + if num in mapping_dict["dec2label"].keys(): + label = mapping_dict["dec2label"][num] + else: + label = mapping_dict["oov"] + return label + + +def dec_trans(x, max_speaker_num, mapping_dict): + num_list = [] + for i in range(max_speaker_num): + num_list.append(x[:, i]) + base = 1 + T = x.shape[0] + res = np.zeros((T)) + for num in num_list: + res += num * base + base = base * 2 + res = np.array([mapping_func(i, mapping_dict) for i in res]) + return res + + +def create_powerlabel(label, mapping_dict, max_speaker_num=6, max_olp_speaker_num=3): + T, C = label.shape + padding_label = np.zeros((T, max_speaker_num)) + padding_label[:, :C] = label + out_label = dec_trans(padding_label, max_speaker_num, mapping_dict) + out_label = torch.from_numpy(out_label) + return out_label + + +def generate_perm_pse(label, n_speaker, mapping_dict, max_speaker_num, max_olp_speaker_num=3): + perms = np.array(list(permutations(range(n_speaker)))).astype(np.float32) + perms = torch.from_numpy(perms).to(label.device).to(torch.int64) + perm_labels = [label[:, perm] for perm in perms] + perm_pse_labels = [ + create_powerlabel(perm_label.cpu().numpy(), mapping_dict, max_speaker_num).to( + perm_label.device, non_blocking=True + ) + for perm_label in perm_labels + ] + return perm_labels, perm_pse_labels + + +def generate_min_pse( + label, n_speaker, mapping_dict, max_speaker_num, pse_logit, max_olp_speaker_num=3 +): + perm_labels, perm_pse_labels = generate_perm_pse( + label, n_speaker, mapping_dict, max_speaker_num, max_olp_speaker_num=max_olp_speaker_num + ) + losses = [ + F.cross_entropy(input=pse_logit, target=perm_pse_label.to(torch.long)) * len(pse_logit) + for perm_pse_label in perm_pse_labels + ] + loss = torch.stack(losses) + min_index = torch.argmin(loss) + selected_perm_label, selected_pse_label = perm_labels[min_index], perm_pse_labels[min_index] + return selected_perm_label, selected_pse_label diff --git a/funasr/models/eend/utils/report.py b/funasr/models/eend/utils/report.py new file mode 100644 index 0000000..eb1bdac --- /dev/null +++ b/funasr/models/eend/utils/report.py @@ -0,0 +1,182 @@ +import copy +import numpy as np +import time +import torch +from funasr.models.eend.utils.power import create_powerlabel +from itertools import combinations + +metrics = [ + ("diarization_error", "speaker_scored", "DER"), + ("speech_miss", "speech_scored", "SAD_MR"), + ("speech_falarm", "speech_scored", "SAD_FR"), + ("speaker_miss", "speaker_scored", "MI"), + ("speaker_falarm", "speaker_scored", "FA"), + ("speaker_error", "speaker_scored", "CF"), + ("correct", "frames", "accuracy"), +] + + +def recover_prediction(y, n_speaker): + if n_speaker <= 1: + return y + elif n_speaker == 2: + com_index = torch.from_numpy(np.array(list(combinations(np.arange(n_speaker), 2)))).to( + y.dtype + ) + num_coms = com_index.shape[0] + y_single = y[:, :-num_coms] + y_olp = y[:, -num_coms:] + olp_map_index = torch.where(y_olp > 0.5) + olp_map_index = torch.stack(olp_map_index, dim=1) + com_map_index = com_index[olp_map_index[:, -1]] + speaker_map_index = torch.from_numpy(np.array(com_map_index)).view(-1).to(torch.int64) + frame_map_index = olp_map_index[:, 0][:, None].repeat([1, 2]).view(-1).to(torch.int64) + y_single[frame_map_index] = 0 + y_single[frame_map_index, speaker_map_index] = 1 + return y_single + else: + olp2_com_index = torch.from_numpy(np.array(list(combinations(np.arange(n_speaker), 2)))).to( + y.dtype + ) + olp2_num_coms = olp2_com_index.shape[0] + olp3_com_index = torch.from_numpy(np.array(list(combinations(np.arange(n_speaker), 3)))).to( + y.dtype + ) + olp3_num_coms = olp3_com_index.shape[0] + y_single = y[:, :n_speaker] + y_olp2 = y[:, n_speaker : n_speaker + olp2_num_coms] + y_olp3 = y[:, -olp3_num_coms:] + + olp3_map_index = torch.where(y_olp3 > 0.5) + olp3_map_index = torch.stack(olp3_map_index, dim=1) + olp3_com_map_index = olp3_com_index[olp3_map_index[:, -1]] + olp3_speaker_map_index = ( + torch.from_numpy(np.array(olp3_com_map_index)).view(-1).to(torch.int64) + ) + olp3_frame_map_index = olp3_map_index[:, 0][:, None].repeat([1, 3]).view(-1).to(torch.int64) + y_single[olp3_frame_map_index] = 0 + y_single[olp3_frame_map_index, olp3_speaker_map_index] = 1 + y_olp2[olp3_frame_map_index] = 0 + + olp2_map_index = torch.where(y_olp2 > 0.5) + olp2_map_index = torch.stack(olp2_map_index, dim=1) + olp2_com_map_index = olp2_com_index[olp2_map_index[:, -1]] + olp2_speaker_map_index = ( + torch.from_numpy(np.array(olp2_com_map_index)).view(-1).to(torch.int64) + ) + olp2_frame_map_index = olp2_map_index[:, 0][:, None].repeat([1, 2]).view(-1).to(torch.int64) + y_single[olp2_frame_map_index] = 0 + y_single[olp2_frame_map_index, olp2_speaker_map_index] = 1 + return y_single + + +class PowerReporter: + def __init__(self, valid_data_loader, mapping_dict, max_n_speaker): + valid_data_loader_cp = copy.deepcopy(valid_data_loader) + self.valid_data_loader = valid_data_loader_cp + del valid_data_loader + self.mapping_dict = mapping_dict + self.max_n_speaker = max_n_speaker + + def report(self, model, eidx, device): + self.report_val(model, eidx, device) + + def report_val(self, model, eidx, device): + model.eval() + ud_valid_start = time.time() + valid_res, valid_loss, stats_keys, vad_valid_accuracy = self.report_core( + model, self.valid_data_loader, device + ) + + # Epoch Display + valid_der = valid_res["diarization_error"] / valid_res["speaker_scored"] + valid_accuracy = valid_res["correct"].to(torch.float32) / valid_res["frames"] * 100 + vad_valid_accuracy = vad_valid_accuracy * 100 + print( + "Epoch ", + eidx + 1, + "Valid Loss ", + valid_loss, + "Valid_DER %.5f" % valid_der, + "Valid_Accuracy %.5f%% " % valid_accuracy, + "VAD_Valid_Accuracy %.5f%% " % vad_valid_accuracy, + ) + ud_valid = (time.time() - ud_valid_start) / 60.0 + print("Valid cost time ... ", ud_valid) + + def inv_mapping_func(self, label, mapping_dict): + if not isinstance(label, int): + label = int(label) + if label in mapping_dict["label2dec"].keys(): + num = mapping_dict["label2dec"][label] + else: + num = -1 + return num + + def report_core(self, model, data_loader, device): + res = {} + for item in metrics: + res[item[0]] = 0.0 + res[item[1]] = 0.0 + with torch.no_grad(): + loss_s = 0.0 + uidx = 0 + for xs, ts, orders in data_loader: + xs = [x.to(device) for x in xs] + ts = [t.to(device) for t in ts] + orders = [o.to(device) for o in orders] + loss, pit_loss, mpit_loss, att_loss, ys, logits, labels, attractors = model( + xs, ts, orders + ) + loss_s += loss.item() + uidx += 1 + + for logit, t, att in zip(logits, labels, attractors): + pred = torch.argmax(torch.softmax(logit, dim=-1), dim=-1) # (T, ) + oov_index = torch.where(pred == self.mapping_dict["oov"])[0] + for i in oov_index: + if i > 0: + pred[i] = pred[i - 1] + else: + pred[i] = 0 + pred = [self.inv_mapping_func(i, self.mapping_dict) for i in pred] + decisions = [bin(num)[2:].zfill(self.max_n_speaker)[::-1] for num in pred] + decisions = ( + torch.from_numpy( + np.stack([np.array([int(i) for i in dec]) for dec in decisions], axis=0) + ) + .to(att.device) + .to(torch.float32) + ) + decisions = decisions[:, : att.shape[0]] + + stats = self.calc_diarization_error(decisions, t) + res["speaker_scored"] += stats["speaker_scored"] + res["speech_scored"] += stats["speech_scored"] + res["frames"] += stats["frames"] + for item in metrics: + res[item[0]] += stats[item[0]] + loss_s /= uidx + vad_acc = 0 + + return res, loss_s, stats.keys(), vad_acc + + def calc_diarization_error(self, decisions, label, label_delay=0): + label = label[: len(label) - label_delay, ...] + n_ref = torch.sum(label, dim=-1) + n_sys = torch.sum(decisions, dim=-1) + res = {} + res["speech_scored"] = torch.sum(n_ref > 0) + res["speech_miss"] = torch.sum((n_ref > 0) & (n_sys == 0)) + res["speech_falarm"] = torch.sum((n_ref == 0) & (n_sys > 0)) + res["speaker_scored"] = torch.sum(n_ref) + res["speaker_miss"] = torch.sum(torch.max(n_ref - n_sys, torch.zeros_like(n_ref))) + res["speaker_falarm"] = torch.sum(torch.max(n_sys - n_ref, torch.zeros_like(n_ref))) + n_map = torch.sum(((label == 1) & (decisions == 1)), dim=-1).to(torch.float32) + res["speaker_error"] = torch.sum(torch.min(n_ref, n_sys) - n_map) + res["correct"] = torch.sum(label == decisions) / label.shape[1] + res["diarization_error"] = ( + res["speaker_miss"] + res["speaker_falarm"] + res["speaker_error"] + ) + res["frames"] = len(label) + return res diff --git a/funasr/models/eres2net/__init__.py b/funasr/models/eres2net/__init__.py new file mode 100644 index 0000000..570bbb1 --- /dev/null +++ b/funasr/models/eres2net/__init__.py @@ -0,0 +1,2 @@ +from .eres2net import ERes2Net +from .eres2net_aug import ERes2NetAug diff --git a/funasr/models/eres2net/eres2net.py b/funasr/models/eres2net/eres2net.py new file mode 100644 index 0000000..de6c2bb --- /dev/null +++ b/funasr/models/eres2net/eres2net.py @@ -0,0 +1,384 @@ +# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +""" Res2Net implementation is adapted from https://github.com/wenet-e2e/wespeaker. + ERes2Net incorporates both local and global feature fusion techniques to improve the performance. + The local feature fusion (LFF) fuses the features within one single residual block to extract the local signal. + The global feature fusion (GFF) takes acoustic features of different scales as input to aggregate global signal. + ERes2Net-Large is an upgraded version of ERes2Net that uses a larger number of parameters to achieve better + recognition performance. Parameters expansion, baseWidth, and scale can be modified to obtain optimal performance. +""" + +import math + +import torch +import torch.nn as nn +import torch.nn.functional as F + +import funasr.models.sond.pooling.pooling_layers as pooling_layers + +from funasr.models.eres2net.fusion import AFF + + +class ReLU(nn.Hardtanh): + + def __init__(self, inplace=False): + super(ReLU, self).__init__(0, 20, inplace) + + def __repr__(self): + inplace_str = "inplace" if self.inplace else "" + return self.__class__.__name__ + " (" + inplace_str + ")" + + +def conv1x1(in_planes, out_planes, stride=1): + "1x1 convolution without padding" + return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, padding=0, bias=False) + + +def conv3x3(in_planes, out_planes, stride=1): + "3x3 convolution with padding" + return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) + + +class BasicBlockERes2Net(nn.Module): + expansion = 2 + + def __init__(self, in_planes, planes, stride=1, baseWidth=32, scale=2): + super(BasicBlockERes2Net, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + self.nums = scale + + convs = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = sp + spx[i] + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class BasicBlockERes2Net_diff_AFF(nn.Module): + expansion = 2 + + def __init__(self, in_planes, planes, stride=1, baseWidth=32, scale=2): + super(BasicBlockERes2Net_diff_AFF, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + self.nums = scale + + convs = [] + fuse_models = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + for j in range(self.nums - 1): + fuse_models.append(AFF(channels=width)) + + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.fuse_models = nn.ModuleList(fuse_models) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = self.fuse_models[i - 1](sp, spx[i]) + + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class ERes2Net(nn.Module): + def __init__( + self, + block=BasicBlockERes2Net, + block_fuse=BasicBlockERes2Net_diff_AFF, + num_blocks=[3, 4, 6, 3], + m_channels=32, + feat_dim=80, + embedding_size=192, + pooling_func="TSTP", + two_emb_layer=False, + ): + super(ERes2Net, self).__init__() + self.in_planes = m_channels + self.feat_dim = feat_dim + self.embedding_size = embedding_size + self.stats_dim = int(feat_dim / 8) * m_channels * 8 + self.two_emb_layer = two_emb_layer + + self.conv1 = nn.Conv2d(1, m_channels, kernel_size=3, stride=1, padding=1, bias=False) + self.bn1 = nn.BatchNorm2d(m_channels) + self.layer1 = self._make_layer(block, m_channels, num_blocks[0], stride=1) + self.layer2 = self._make_layer(block, m_channels * 2, num_blocks[1], stride=2) + self.layer3 = self._make_layer(block_fuse, m_channels * 4, num_blocks[2], stride=2) + self.layer4 = self._make_layer(block_fuse, m_channels * 8, num_blocks[3], stride=2) + + # Downsampling module for each layer + self.layer1_downsample = nn.Conv2d( + m_channels * 2, m_channels * 4, kernel_size=3, stride=2, padding=1, bias=False + ) + self.layer2_downsample = nn.Conv2d( + m_channels * 4, m_channels * 8, kernel_size=3, padding=1, stride=2, bias=False + ) + self.layer3_downsample = nn.Conv2d( + m_channels * 8, m_channels * 16, kernel_size=3, padding=1, stride=2, bias=False + ) + + # Bottom-up fusion module + self.fuse_mode12 = AFF(channels=m_channels * 4) + self.fuse_mode123 = AFF(channels=m_channels * 8) + self.fuse_mode1234 = AFF(channels=m_channels * 16) + + self.n_stats = 1 if pooling_func == "TAP" or pooling_func == "TSDP" else 2 + self.pool = getattr(pooling_layers, pooling_func)(in_dim=self.stats_dim * block.expansion) + self.seg_1 = nn.Linear(self.stats_dim * block.expansion * self.n_stats, embedding_size) + if self.two_emb_layer: + self.seg_bn_1 = nn.BatchNorm1d(embedding_size, affine=False) + self.seg_2 = nn.Linear(embedding_size, embedding_size) + else: + self.seg_bn_1 = nn.Identity() + self.seg_2 = nn.Identity() + + def _make_layer(self, block, planes, num_blocks, stride): + strides = [stride] + [1] * (num_blocks - 1) + layers = [] + for stride in strides: + layers.append(block(self.in_planes, planes, stride)) + self.in_planes = planes * block.expansion + return nn.Sequential(*layers) + + def forward(self, x): + x = x.permute(0, 2, 1) # (B,T,F) => (B,F,T) + x = x.unsqueeze_(1) + out = F.relu(self.bn1(self.conv1(x))) + out1 = self.layer1(out) + out2 = self.layer2(out1) + out1_downsample = self.layer1_downsample(out1) + fuse_out12 = self.fuse_mode12(out2, out1_downsample) + out3 = self.layer3(out2) + fuse_out12_downsample = self.layer2_downsample(fuse_out12) + fuse_out123 = self.fuse_mode123(out3, fuse_out12_downsample) + out4 = self.layer4(out3) + fuse_out123_downsample = self.layer3_downsample(fuse_out123) + fuse_out1234 = self.fuse_mode1234(out4, fuse_out123_downsample) + stats = self.pool(fuse_out1234) + + embed_a = self.seg_1(stats) + if self.two_emb_layer: + out = F.relu(embed_a) + out = self.seg_bn_1(out) + embed_b = self.seg_2(out) + return embed_b + else: + return embed_a + + +class BasicBlockRes2Net(nn.Module): + expansion = 2 + + def __init__(self, in_planes, planes, stride=1, baseWidth=32, scale=2): + super(BasicBlockRes2Net, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + self.nums = scale - 1 + convs = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = sp + spx[i] + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = torch.cat((out, spx[self.nums]), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class Res2Net(nn.Module): + def __init__( + self, + block=BasicBlockRes2Net, + num_blocks=[3, 4, 6, 3], + m_channels=32, + feat_dim=80, + embedding_size=192, + pooling_func="TSTP", + two_emb_layer=False, + ): + super(Res2Net, self).__init__() + self.in_planes = m_channels + self.feat_dim = feat_dim + self.embedding_size = embedding_size + self.stats_dim = int(feat_dim / 8) * m_channels * 8 + self.two_emb_layer = two_emb_layer + + self.conv1 = nn.Conv2d(1, m_channels, kernel_size=3, stride=1, padding=1, bias=False) + self.bn1 = nn.BatchNorm2d(m_channels) + self.layer1 = self._make_layer(block, m_channels, num_blocks[0], stride=1) + self.layer2 = self._make_layer(block, m_channels * 2, num_blocks[1], stride=2) + self.layer3 = self._make_layer(block, m_channels * 4, num_blocks[2], stride=2) + self.layer4 = self._make_layer(block, m_channels * 8, num_blocks[3], stride=2) + + self.n_stats = 1 if pooling_func == "TAP" or pooling_func == "TSDP" else 2 + self.pool = getattr(pooling_layers, pooling_func)(in_dim=self.stats_dim * block.expansion) + self.seg_1 = nn.Linear(self.stats_dim * block.expansion * self.n_stats, embedding_size) + if self.two_emb_layer: + self.seg_bn_1 = nn.BatchNorm1d(embedding_size, affine=False) + self.seg_2 = nn.Linear(embedding_size, embedding_size) + else: + self.seg_bn_1 = nn.Identity() + self.seg_2 = nn.Identity() + + def _make_layer(self, block, planes, num_blocks, stride): + strides = [stride] + [1] * (num_blocks - 1) + layers = [] + for stride in strides: + layers.append(block(self.in_planes, planes, stride)) + self.in_planes = planes * block.expansion + return nn.Sequential(*layers) + + def forward(self, x): + x = x.permute(0, 2, 1) # (B,T,F) => (B,F,T) + + x = x.unsqueeze_(1) + out = F.relu(self.bn1(self.conv1(x))) + out = self.layer1(out) + out = self.layer2(out) + out = self.layer3(out) + out = self.layer4(out) + + stats = self.pool(out) + + embed_a = self.seg_1(stats) + if self.two_emb_layer: + out = F.relu(embed_a) + out = self.seg_bn_1(out) + embed_b = self.seg_2(out) + return embed_b + else: + return embed_a diff --git a/funasr/models/eres2net/eres2net_aug.py b/funasr/models/eres2net/eres2net_aug.py new file mode 100644 index 0000000..f700b9c --- /dev/null +++ b/funasr/models/eres2net/eres2net_aug.py @@ -0,0 +1,255 @@ +# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +""" Res2Net implementation is adapted from https://github.com/wenet-e2e/wespeaker. + ERes2Net incorporates both local and global feature fusion techniques to improve the performance. + The local feature fusion (LFF) fuses the features within one single residual block to extract the local signal. + The global feature fusion (GFF) takes acoustic features of different scales as input to aggregate global signal. + ERes2Net-Large is an upgraded version of ERes2Net that uses a larger number of parameters to achieve better + recognition performance. Parameters expansion, baseWidth, and scale can be modified to obtain optimal performance. +""" + +import math + +import torch +import torch.nn as nn +import torch.nn.functional as F + +import funasr.models.sond.pooling.pooling_layers as pooling_layers + +from funasr.models.eres2net.fusion import AFF + + +class ReLU(nn.Hardtanh): + + def __init__(self, inplace=False): + super(ReLU, self).__init__(0, 20, inplace) + + def __repr__(self): + inplace_str = "inplace" if self.inplace else "" + return self.__class__.__name__ + " (" + inplace_str + ")" + + +def conv1x1(in_planes, out_planes, stride=1): + "1x1 convolution without padding" + return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, padding=0, bias=False) + + +def conv3x3(in_planes, out_planes, stride=1): + "3x3 convolution with padding" + return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) + + +class BasicBlockERes2Net(nn.Module): + expansion = 4 + + def __init__(self, in_planes, planes, stride=1, baseWidth=24, scale=3): + super(BasicBlockERes2Net, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + self.nums = scale + + convs = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = sp + spx[i] + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class BasicBlockERes2Net_diff_AFF(nn.Module): + expansion = 4 + + def __init__(self, in_planes, planes, stride=1, baseWidth=24, scale=3): + super(BasicBlockERes2Net_diff_AFF, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + + self.nums = scale + + convs = [] + fuse_models = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + for j in range(self.nums - 1): + fuse_models.append(AFF(channels=width)) + + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.fuse_models = nn.ModuleList(fuse_models) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = self.fuse_models[i - 1](sp, spx[i]) + + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class ERes2NetAug(nn.Module): + def __init__( + self, + block=BasicBlockERes2Net, + block_fuse=BasicBlockERes2Net_diff_AFF, + num_blocks=[3, 4, 6, 3], + m_channels=64, + feat_dim=80, + embedding_size=192, + pooling_func="TSTP", + two_emb_layer=False, + ): + super(ERes2NetAug, self).__init__() + self.in_planes = m_channels + self.feat_dim = feat_dim + self.embedding_size = embedding_size + self.stats_dim = int(feat_dim / 8) * m_channels * 8 + self.two_emb_layer = two_emb_layer + + self.conv1 = nn.Conv2d(1, m_channels, kernel_size=3, stride=1, padding=1, bias=False) + self.bn1 = nn.BatchNorm2d(m_channels) + self.layer1 = self._make_layer(block, m_channels, num_blocks[0], stride=1) + self.layer2 = self._make_layer(block, m_channels * 2, num_blocks[1], stride=2) + self.layer3 = self._make_layer(block_fuse, m_channels * 4, num_blocks[2], stride=2) + self.layer4 = self._make_layer(block_fuse, m_channels * 8, num_blocks[3], stride=2) + + self.layer1_downsample = nn.Conv2d( + m_channels * 4, m_channels * 8, kernel_size=3, padding=1, stride=2, bias=False + ) + self.layer2_downsample = nn.Conv2d( + m_channels * 8, m_channels * 16, kernel_size=3, padding=1, stride=2, bias=False + ) + self.layer3_downsample = nn.Conv2d( + m_channels * 16, m_channels * 32, kernel_size=3, padding=1, stride=2, bias=False + ) + self.fuse_mode12 = AFF(channels=m_channels * 8) + self.fuse_mode123 = AFF(channels=m_channels * 16) + self.fuse_mode1234 = AFF(channels=m_channels * 32) + + self.n_stats = 1 if pooling_func == "TAP" or pooling_func == "TSDP" else 2 + self.pool = getattr(pooling_layers, pooling_func)(in_dim=self.stats_dim * block.expansion) + self.seg_1 = nn.Linear(self.stats_dim * block.expansion * self.n_stats, embedding_size) + if self.two_emb_layer: + self.seg_bn_1 = nn.BatchNorm1d(embedding_size, affine=False) + self.seg_2 = nn.Linear(embedding_size, embedding_size) + else: + self.seg_bn_1 = nn.Identity() + self.seg_2 = nn.Identity() + + def _make_layer(self, block, planes, num_blocks, stride): + strides = [stride] + [1] * (num_blocks - 1) + layers = [] + for stride in strides: + layers.append(block(self.in_planes, planes, stride)) + self.in_planes = planes * block.expansion + return nn.Sequential(*layers) + + def forward(self, x): + x = x.permute(0, 2, 1) # (B,T,F) => (B,F,T) + + x = x.unsqueeze_(1) + out = F.relu(self.bn1(self.conv1(x))) + out1 = self.layer1(out) + out2 = self.layer2(out1) + out1_downsample = self.layer1_downsample(out1) + fuse_out12 = self.fuse_mode12(out2, out1_downsample) + out3 = self.layer3(out2) + fuse_out12_downsample = self.layer2_downsample(fuse_out12) + fuse_out123 = self.fuse_mode123(out3, fuse_out12_downsample) + out4 = self.layer4(out3) + fuse_out123_downsample = self.layer3_downsample(fuse_out123) + fuse_out1234 = self.fuse_mode1234(out4, fuse_out123_downsample) + stats = self.pool(fuse_out1234) + + embed_a = self.seg_1(stats) + if self.two_emb_layer: + out = F.relu(embed_a) + out = self.seg_bn_1(out) + embed_b = self.seg_2(out) + return embed_b + else: + return embed_a diff --git a/funasr/models/eres2net/fusion.py b/funasr/models/eres2net/fusion.py new file mode 100644 index 0000000..fbe699e --- /dev/null +++ b/funasr/models/eres2net/fusion.py @@ -0,0 +1,28 @@ +# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +import torch +import torch.nn as nn + + +class AFF(nn.Module): + + def __init__(self, channels=64, r=4): + super(AFF, self).__init__() + inter_channels = int(channels // r) + + self.local_att = nn.Sequential( + nn.Conv2d(channels * 2, inter_channels, kernel_size=1, stride=1, padding=0), + nn.BatchNorm2d(inter_channels), + nn.SiLU(inplace=True), + nn.Conv2d(inter_channels, channels, kernel_size=1, stride=1, padding=0), + nn.BatchNorm2d(channels), + ) + + def forward(self, x, ds_y): + xa = torch.cat((x, ds_y), dim=1) + x_att = self.local_att(xa) + x_att = 1.0 + torch.tanh(x_att) + xo = torch.mul(x, x_att) + torch.mul(ds_y, 2.0 - x_att) + + return xo diff --git a/funasr/models/fsmn_vad_streaming/__init__.py b/funasr/models/fsmn_vad_streaming/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/fsmn_vad_streaming/encoder.py b/funasr/models/fsmn_vad_streaming/encoder.py new file mode 100644 index 0000000..6668c5d --- /dev/null +++ b/funasr/models/fsmn_vad_streaming/encoder.py @@ -0,0 +1,404 @@ +from typing import Tuple, Dict +import copy +import os + +import numpy as np +import torch +import torch.nn as nn +import torch.nn.functional as F + +from funasr.register import tables + + +class LinearTransform(nn.Module): + + def __init__(self, input_dim, output_dim): + super(LinearTransform, self).__init__() + self.input_dim = input_dim + self.output_dim = output_dim + self.linear = nn.Linear(input_dim, output_dim, bias=False) + + def forward(self, input): + output = self.linear(input) + + return output + + +class AffineTransform(nn.Module): + + def __init__(self, input_dim, output_dim): + super(AffineTransform, self).__init__() + self.input_dim = input_dim + self.output_dim = output_dim + self.linear = nn.Linear(input_dim, output_dim) + + def forward(self, input): + output = self.linear(input) + + return output + + +class RectifiedLinear(nn.Module): + + def __init__(self, input_dim, output_dim): + super(RectifiedLinear, self).__init__() + self.dim = input_dim + self.relu = nn.ReLU() + self.dropout = nn.Dropout(0.1) + + def forward(self, input): + out = self.relu(input) + return out + + +class FSMNBlock(nn.Module): + + def __init__( + self, + input_dim: int, + output_dim: int, + lorder=None, + rorder=None, + lstride=1, + rstride=1, + ): + super(FSMNBlock, self).__init__() + + self.dim = input_dim + + if lorder is None: + return + + self.lorder = lorder + self.rorder = rorder + self.lstride = lstride + self.rstride = rstride + + self.conv_left = nn.Conv2d( + self.dim, self.dim, [lorder, 1], dilation=[lstride, 1], groups=self.dim, bias=False + ) + + if self.rorder > 0: + self.conv_right = nn.Conv2d( + self.dim, self.dim, [rorder, 1], dilation=[rstride, 1], groups=self.dim, bias=False + ) + else: + self.conv_right = None + + def forward(self, input: torch.Tensor, cache: torch.Tensor): + x = torch.unsqueeze(input, 1) + x_per = x.permute(0, 3, 2, 1) # B D T C + + cache = cache.to(x_per.device) + y_left = torch.cat((cache, x_per), dim=2) + cache = y_left[:, :, -(self.lorder - 1) * self.lstride :, :] + y_left = self.conv_left(y_left) + out = x_per + y_left + + if self.conv_right is not None: + # maybe need to check + y_right = F.pad(x_per, [0, 0, 0, self.rorder * self.rstride]) + y_right = y_right[:, :, self.rstride :, :] + y_right = self.conv_right(y_right) + out += y_right + + out_per = out.permute(0, 3, 2, 1) + output = out_per.squeeze(1) + + return output, cache + + +class BasicBlock(nn.Module): + def __init__( + self, + linear_dim: int, + proj_dim: int, + lorder: int, + rorder: int, + lstride: int, + rstride: int, + stack_layer: int, + ): + super(BasicBlock, self).__init__() + self.lorder = lorder + self.rorder = rorder + self.lstride = lstride + self.rstride = rstride + self.stack_layer = stack_layer + self.linear = LinearTransform(linear_dim, proj_dim) + self.fsmn_block = FSMNBlock(proj_dim, proj_dim, lorder, rorder, lstride, rstride) + self.affine = AffineTransform(proj_dim, linear_dim) + self.relu = RectifiedLinear(linear_dim, linear_dim) + + def forward(self, input: torch.Tensor, cache: Dict[str, torch.Tensor]): + x1 = self.linear(input) # B T D + cache_layer_name = "cache_layer_{}".format(self.stack_layer) + if cache_layer_name not in cache: + cache[cache_layer_name] = torch.zeros( + x1.shape[0], x1.shape[-1], (self.lorder - 1) * self.lstride, 1 + ) + x2, cache[cache_layer_name] = self.fsmn_block(x1, cache[cache_layer_name]) + x3 = self.affine(x2) + x4 = self.relu(x3) + return x4 + + +class BasicBlock_export(nn.Module): + def __init__( + self, + model, + ): + super(BasicBlock_export, self).__init__() + self.linear = model.linear + self.fsmn_block = model.fsmn_block + self.affine = model.affine + self.relu = model.relu + + def forward(self, input: torch.Tensor, in_cache: torch.Tensor): + x = self.linear(input) # B T D + # cache_layer_name = 'cache_layer_{}'.format(self.stack_layer) + # if cache_layer_name not in in_cache: + # in_cache[cache_layer_name] = torch.zeros(x1.shape[0], x1.shape[-1], (self.lorder - 1) * self.lstride, 1) + x, out_cache = self.fsmn_block(x, in_cache) + x = self.affine(x) + x = self.relu(x) + return x, out_cache + + +class FsmnStack(nn.Sequential): + def __init__(self, *args): + super(FsmnStack, self).__init__(*args) + + def forward(self, input: torch.Tensor, cache: Dict[str, torch.Tensor]): + x = input + for module in self._modules.values(): + x = module(x, cache) + return x + + +""" +FSMN net for keyword spotting +input_dim: input dimension +linear_dim: fsmn input dimensionll +proj_dim: fsmn projection dimension +lorder: fsmn left order +rorder: fsmn right order +num_syn: output dimension +fsmn_layers: no. of sequential fsmn layers +""" + + +@tables.register("encoder_classes", "FSMN") +class FSMN(nn.Module): + def __init__( + self, + input_dim: int, + input_affine_dim: int, + fsmn_layers: int, + linear_dim: int, + proj_dim: int, + lorder: int, + rorder: int, + lstride: int, + rstride: int, + output_affine_dim: int, + output_dim: int, + ): + super().__init__() + + self.input_dim = input_dim + self.input_affine_dim = input_affine_dim + self.fsmn_layers = fsmn_layers + self.linear_dim = linear_dim + self.proj_dim = proj_dim + self.output_affine_dim = output_affine_dim + self.output_dim = output_dim + + self.in_linear1 = AffineTransform(input_dim, input_affine_dim) + self.in_linear2 = AffineTransform(input_affine_dim, linear_dim) + self.relu = RectifiedLinear(linear_dim, linear_dim) + self.fsmn = FsmnStack( + *[ + BasicBlock(linear_dim, proj_dim, lorder, rorder, lstride, rstride, i) + for i in range(fsmn_layers) + ] + ) + self.out_linear1 = AffineTransform(linear_dim, output_affine_dim) + self.out_linear2 = AffineTransform(output_affine_dim, output_dim) + self.softmax = nn.Softmax(dim=-1) + + def fuse_modules(self): + pass + + def forward( + self, input: torch.Tensor, cache: Dict[str, torch.Tensor] + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor]]: + """ + Args: + input (torch.Tensor): Input tensor (B, T, D) + cache: when cache is not None, the forward is in streaming. The type of cache is a dict, egs, + {'cache_layer_1': torch.Tensor(B, T1, D)}, T1 is equal to self.lorder. It is {} for the 1st frame + """ + + x1 = self.in_linear1(input) + x2 = self.in_linear2(x1) + x3 = self.relu(x2) + x4 = self.fsmn(x3, cache) # self.cache will update automatically in self.fsmn + x5 = self.out_linear1(x4) + x6 = self.out_linear2(x5) + x7 = self.softmax(x6) + + return x7 + + +@tables.register("encoder_classes", "FSMNExport") +class FSMNExport(nn.Module): + def __init__( + self, + model, + **kwargs, + ): + super().__init__() + + # self.input_dim = input_dim + # self.input_affine_dim = input_affine_dim + # self.fsmn_layers = fsmn_layers + # self.linear_dim = linear_dim + # self.proj_dim = proj_dim + # self.output_affine_dim = output_affine_dim + # self.output_dim = output_dim + # + # self.in_linear1 = AffineTransform(input_dim, input_affine_dim) + # self.in_linear2 = AffineTransform(input_affine_dim, linear_dim) + # self.relu = RectifiedLinear(linear_dim, linear_dim) + # self.fsmn = FsmnStack(*[BasicBlock(linear_dim, proj_dim, lorder, rorder, lstride, rstride, i) for i in + # range(fsmn_layers)]) + # self.out_linear1 = AffineTransform(linear_dim, output_affine_dim) + # self.out_linear2 = AffineTransform(output_affine_dim, output_dim) + # self.softmax = nn.Softmax(dim=-1) + self.in_linear1 = model.in_linear1 + self.in_linear2 = model.in_linear2 + self.relu = model.relu + # self.fsmn = model.fsmn + self.out_linear1 = model.out_linear1 + self.out_linear2 = model.out_linear2 + self.softmax = model.softmax + self.fsmn = model.fsmn + for i, d in enumerate(model.fsmn): + if isinstance(d, BasicBlock): + self.fsmn[i] = BasicBlock_export(d) + + def fuse_modules(self): + pass + + def forward( + self, + input: torch.Tensor, + *args, + ): + """ + Args: + input (torch.Tensor): Input tensor (B, T, D) + in_cache: when in_cache is not None, the forward is in streaming. The type of in_cache is a dict, egs, + {'cache_layer_1': torch.Tensor(B, T1, D)}, T1 is equal to self.lorder. It is {} for the 1st frame + """ + + x = self.in_linear1(input) + x = self.in_linear2(x) + x = self.relu(x) + # x4 = self.fsmn(x3, in_cache) # self.in_cache will update automatically in self.fsmn + out_caches = list() + for i, d in enumerate(self.fsmn): + in_cache = args[i] + x, out_cache = d(x, in_cache) + out_caches.append(out_cache) + x = self.out_linear1(x) + x = self.out_linear2(x) + x = self.softmax(x) + + return x, out_caches + + +""" +one deep fsmn layer +dimproj: projection dimension, input and output dimension of memory blocks +dimlinear: dimension of mapping layer +lorder: left order +rorder: right order +lstride: left stride +rstride: right stride +""" + + +@tables.register("encoder_classes", "DFSMN") +class DFSMN(nn.Module): + + def __init__(self, dimproj=64, dimlinear=128, lorder=20, rorder=1, lstride=1, rstride=1): + super(DFSMN, self).__init__() + + self.lorder = lorder + self.rorder = rorder + self.lstride = lstride + self.rstride = rstride + + self.expand = AffineTransform(dimproj, dimlinear) + self.shrink = LinearTransform(dimlinear, dimproj) + + self.conv_left = nn.Conv2d( + dimproj, dimproj, [lorder, 1], dilation=[lstride, 1], groups=dimproj, bias=False + ) + + if rorder > 0: + self.conv_right = nn.Conv2d( + dimproj, dimproj, [rorder, 1], dilation=[rstride, 1], groups=dimproj, bias=False + ) + else: + self.conv_right = None + + def forward(self, input): + f1 = F.relu(self.expand(input)) + p1 = self.shrink(f1) + + x = torch.unsqueeze(p1, 1) + x_per = x.permute(0, 3, 2, 1) + + y_left = F.pad(x_per, [0, 0, (self.lorder - 1) * self.lstride, 0]) + + if self.conv_right is not None: + y_right = F.pad(x_per, [0, 0, 0, (self.rorder) * self.rstride]) + y_right = y_right[:, :, self.rstride :, :] + out = x_per + self.conv_left(y_left) + self.conv_right(y_right) + else: + out = x_per + self.conv_left(y_left) + + out1 = out.permute(0, 3, 2, 1) + output = input + out1.squeeze(1) + + return output + + +""" +build stacked dfsmn layers +""" + + +def buildDFSMNRepeats(linear_dim=128, proj_dim=64, lorder=20, rorder=1, fsmn_layers=6): + repeats = [ + nn.Sequential(DFSMN(proj_dim, linear_dim, lorder, rorder, 1, 1)) for i in range(fsmn_layers) + ] + + return nn.Sequential(*repeats) + + +if __name__ == "__main__": + fsmn = FSMN(400, 140, 4, 250, 128, 10, 2, 1, 1, 140, 2599) + print(fsmn) + + num_params = sum(p.numel() for p in fsmn.parameters()) + print("the number of model params: {}".format(num_params)) + x = torch.zeros(128, 200, 400) # batch-size * time * dim + y, _ = fsmn(x) # batch-size * time * dim + print("input shape: {}".format(x.shape)) + print("output shape: {}".format(y.shape)) + + print(fsmn.to_kaldi_net()) diff --git a/funasr/models/fsmn_vad_streaming/export_meta.py b/funasr/models/fsmn_vad_streaming/export_meta.py new file mode 100644 index 0000000..f760169 --- /dev/null +++ b/funasr/models/fsmn_vad_streaming/export_meta.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import types +import torch +from funasr.register import tables + + +def export_rebuild_model(model, **kwargs): + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + model.forward = types.MethodType(export_forward, model) + model.export_dummy_inputs = types.MethodType(export_dummy_inputs, model) + model.export_input_names = types.MethodType(export_input_names, model) + model.export_output_names = types.MethodType(export_output_names, model) + model.export_dynamic_axes = types.MethodType(export_dynamic_axes, model) + model.export_name = types.MethodType(export_name, model) + + return model + + +def export_forward(self, feats: torch.Tensor, *args, **kwargs): + + scores, out_caches = self.encoder(feats, *args) + + return scores, out_caches + + +def export_dummy_inputs(self, data_in=None, frame=30): + if data_in is None: + speech = torch.randn(1, frame, self.encoder_conf.get("input_dim")) + else: + speech = None # Undo + + cache_frames = self.encoder_conf.get("lorder") + self.encoder_conf.get("rorder") - 1 + in_cache0 = torch.randn(1, self.encoder_conf.get("proj_dim"), cache_frames, 1) + in_cache1 = torch.randn(1, self.encoder_conf.get("proj_dim"), cache_frames, 1) + in_cache2 = torch.randn(1, self.encoder_conf.get("proj_dim"), cache_frames, 1) + in_cache3 = torch.randn(1, self.encoder_conf.get("proj_dim"), cache_frames, 1) + + return (speech, in_cache0, in_cache1, in_cache2, in_cache3) + + +def export_input_names(self): + return ["speech", "in_cache0", "in_cache1", "in_cache2", "in_cache3"] + + +def export_output_names(self): + return ["logits", "out_cache0", "out_cache1", "out_cache2", "out_cache3"] + + +def export_dynamic_axes(self): + return { + "speech": {1: "feats_length"}, + } + + +def export_name( + self, +): + return "model.onnx" diff --git a/funasr/models/fsmn_vad_streaming/model.py b/funasr/models/fsmn_vad_streaming/model.py new file mode 100644 index 0000000..04689be --- /dev/null +++ b/funasr/models/fsmn_vad_streaming/model.py @@ -0,0 +1,916 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import os +import json +import time +import math +import torch +from torch import nn +from enum import Enum +from dataclasses import dataclass +from funasr.register import tables +from typing import List, Tuple, Dict, Any, Optional + +from funasr.utils.datadir_writer import DatadirWriter +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + + +class VadStateMachine(Enum): + kVadInStateStartPointNotDetected = 1 + kVadInStateInSpeechSegment = 2 + kVadInStateEndPointDetected = 3 + + +class FrameState(Enum): + kFrameStateInvalid = -1 + kFrameStateSpeech = 1 + kFrameStateSil = 0 + + +# final voice/unvoice state per frame +class AudioChangeState(Enum): + kChangeStateSpeech2Speech = 0 + kChangeStateSpeech2Sil = 1 + kChangeStateSil2Sil = 2 + kChangeStateSil2Speech = 3 + kChangeStateNoBegin = 4 + kChangeStateInvalid = 5 + + +class VadDetectMode(Enum): + kVadSingleUtteranceDetectMode = 0 + kVadMutipleUtteranceDetectMode = 1 + + +class VADXOptions: + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__( + self, + sample_rate: int = 16000, + detect_mode: int = VadDetectMode.kVadMutipleUtteranceDetectMode.value, + snr_mode: int = 0, + max_end_silence_time: int = 800, + max_start_silence_time: int = 3000, + do_start_point_detection: bool = True, + do_end_point_detection: bool = True, + window_size_ms: int = 200, + sil_to_speech_time_thres: int = 150, + speech_to_sil_time_thres: int = 150, + speech_2_noise_ratio: float = 1.0, + do_extend: int = 1, + lookback_time_start_point: int = 200, + lookahead_time_end_point: int = 100, + max_single_segment_time: int = 60000, + nn_eval_block_size: int = 8, + dcd_block_size: int = 4, + snr_thres: int = -100.0, + noise_frame_num_used_for_snr: int = 100, + decibel_thres: int = -100.0, + speech_noise_thres: float = 0.6, + fe_prior_thres: float = 1e-4, + silence_pdf_num: int = 1, + sil_pdf_ids: List[int] = [0], + speech_noise_thresh_low: float = -0.1, + speech_noise_thresh_high: float = 0.3, + output_frame_probs: bool = False, + frame_in_ms: int = 10, + frame_length_ms: int = 25, + **kwargs, + ): + self.sample_rate = sample_rate + self.detect_mode = detect_mode + self.snr_mode = snr_mode + self.max_end_silence_time = max_end_silence_time + self.max_start_silence_time = max_start_silence_time + self.do_start_point_detection = do_start_point_detection + self.do_end_point_detection = do_end_point_detection + self.window_size_ms = window_size_ms + self.sil_to_speech_time_thres = sil_to_speech_time_thres + self.speech_to_sil_time_thres = speech_to_sil_time_thres + self.speech_2_noise_ratio = speech_2_noise_ratio + self.do_extend = do_extend + self.lookback_time_start_point = lookback_time_start_point + self.lookahead_time_end_point = lookahead_time_end_point + self.max_single_segment_time = max_single_segment_time + self.nn_eval_block_size = nn_eval_block_size + self.dcd_block_size = dcd_block_size + self.snr_thres = snr_thres + self.noise_frame_num_used_for_snr = noise_frame_num_used_for_snr + self.decibel_thres = decibel_thres + self.speech_noise_thres = speech_noise_thres + self.fe_prior_thres = fe_prior_thres + self.silence_pdf_num = silence_pdf_num + self.sil_pdf_ids = sil_pdf_ids + self.speech_noise_thresh_low = speech_noise_thresh_low + self.speech_noise_thresh_high = speech_noise_thresh_high + self.output_frame_probs = output_frame_probs + self.frame_in_ms = frame_in_ms + self.frame_length_ms = frame_length_ms + + +class E2EVadSpeechBufWithDoa(object): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__(self): + self.start_ms = 0 + self.end_ms = 0 + self.buffer = [] + self.contain_seg_start_point = False + self.contain_seg_end_point = False + self.doa = 0 + + def Reset(self): + self.start_ms = 0 + self.end_ms = 0 + self.buffer = [] + self.contain_seg_start_point = False + self.contain_seg_end_point = False + self.doa = 0 + + +class E2EVadFrameProb(object): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__(self): + self.noise_prob = 0.0 + self.speech_prob = 0.0 + self.score = 0.0 + self.frame_id = 0 + self.frm_state = 0 + + +class WindowDetector(object): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__( + self, + window_size_ms: int, + sil_to_speech_time: int, + speech_to_sil_time: int, + frame_size_ms: int, + ): + self.window_size_ms = window_size_ms + self.sil_to_speech_time = sil_to_speech_time + self.speech_to_sil_time = speech_to_sil_time + self.frame_size_ms = frame_size_ms + + self.win_size_frame = int(window_size_ms / frame_size_ms) + self.win_sum = 0 + self.win_state = [0] * self.win_size_frame # 初始化窗 + + self.cur_win_pos = 0 + self.pre_frame_state = FrameState.kFrameStateSil + self.cur_frame_state = FrameState.kFrameStateSil + self.sil_to_speech_frmcnt_thres = int(sil_to_speech_time / frame_size_ms) + self.speech_to_sil_frmcnt_thres = int(speech_to_sil_time / frame_size_ms) + + self.voice_last_frame_count = 0 + self.noise_last_frame_count = 0 + self.hydre_frame_count = 0 + + def Reset(self) -> None: + self.cur_win_pos = 0 + self.win_sum = 0 + self.win_state = [0] * self.win_size_frame + self.pre_frame_state = FrameState.kFrameStateSil + self.cur_frame_state = FrameState.kFrameStateSil + self.voice_last_frame_count = 0 + self.noise_last_frame_count = 0 + self.hydre_frame_count = 0 + + def GetWinSize(self) -> int: + return int(self.win_size_frame) + + def DetectOneFrame( + self, frameState: FrameState, frame_count: int, cache: dict = {} + ) -> AudioChangeState: + cur_frame_state = FrameState.kFrameStateSil + if frameState == FrameState.kFrameStateSpeech: + cur_frame_state = 1 + elif frameState == FrameState.kFrameStateSil: + cur_frame_state = 0 + else: + return AudioChangeState.kChangeStateInvalid + self.win_sum -= self.win_state[self.cur_win_pos] + self.win_sum += cur_frame_state + self.win_state[self.cur_win_pos] = cur_frame_state + self.cur_win_pos = (self.cur_win_pos + 1) % self.win_size_frame + + if ( + self.pre_frame_state == FrameState.kFrameStateSil + and self.win_sum >= self.sil_to_speech_frmcnt_thres + ): + self.pre_frame_state = FrameState.kFrameStateSpeech + return AudioChangeState.kChangeStateSil2Speech + + if ( + self.pre_frame_state == FrameState.kFrameStateSpeech + and self.win_sum <= self.speech_to_sil_frmcnt_thres + ): + self.pre_frame_state = FrameState.kFrameStateSil + return AudioChangeState.kChangeStateSpeech2Sil + + if self.pre_frame_state == FrameState.kFrameStateSil: + return AudioChangeState.kChangeStateSil2Sil + if self.pre_frame_state == FrameState.kFrameStateSpeech: + return AudioChangeState.kChangeStateSpeech2Speech + return AudioChangeState.kChangeStateInvalid + + def FrameSizeMs(self) -> int: + return int(self.frame_size_ms) + + +class Stats(object): + def __init__( + self, + sil_pdf_ids, + max_end_sil_frame_cnt_thresh, + speech_noise_thres, + ): + self.data_buf_start_frame = 0 + self.frm_cnt = 0 + self.latest_confirmed_speech_frame = 0 + self.lastest_confirmed_silence_frame = -1 + self.continous_silence_frame_count = 0 + self.vad_state_machine = VadStateMachine.kVadInStateStartPointNotDetected + self.confirmed_start_frame = -1 + self.confirmed_end_frame = -1 + self.number_end_time_detected = 0 + self.sil_frame = 0 + self.sil_pdf_ids = sil_pdf_ids + self.noise_average_decibel = -100.0 + self.pre_end_silence_detected = False + self.next_seg = True + + self.output_data_buf = [] + self.output_data_buf_offset = 0 + self.frame_probs = [] + self.max_end_sil_frame_cnt_thresh = max_end_sil_frame_cnt_thresh + self.speech_noise_thres = speech_noise_thres + self.scores = None + self.max_time_out = False + self.decibel = [] + self.data_buf = None + self.data_buf_all = None + self.waveform = None + self.last_drop_frames = 0 + + +@tables.register("model_classes", "FsmnVADStreaming") +class FsmnVADStreaming(nn.Module): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__( + self, + encoder: str = None, + encoder_conf: Optional[Dict] = None, + vad_post_args: Dict[str, Any] = None, + **kwargs, + ): + super().__init__() + self.vad_opts = VADXOptions(**kwargs) + + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(**encoder_conf) + self.encoder = encoder + self.encoder_conf = encoder_conf + + def ResetDetection(self, cache: dict = {}): + cache["stats"].continous_silence_frame_count = 0 + cache["stats"].latest_confirmed_speech_frame = 0 + cache["stats"].lastest_confirmed_silence_frame = -1 + cache["stats"].confirmed_start_frame = -1 + cache["stats"].confirmed_end_frame = -1 + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateStartPointNotDetected + cache["windows_detector"].Reset() + cache["stats"].sil_frame = 0 + cache["stats"].frame_probs = [] + + if cache["stats"].output_data_buf: + assert cache["stats"].output_data_buf[-1].contain_seg_end_point == True + drop_frames = int(cache["stats"].output_data_buf[-1].end_ms / self.vad_opts.frame_in_ms) + real_drop_frames = drop_frames - cache["stats"].last_drop_frames + cache["stats"].last_drop_frames = drop_frames + cache["stats"].data_buf_all = cache["stats"].data_buf_all[ + real_drop_frames + * int(self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000) : + ] + cache["stats"].decibel = cache["stats"].decibel[real_drop_frames:] + cache["stats"].scores = cache["stats"].scores[:, real_drop_frames:, :] + + def ComputeDecibel(self, cache: dict = {}) -> None: + frame_sample_length = int(self.vad_opts.frame_length_ms * self.vad_opts.sample_rate / 1000) + frame_shift_length = int(self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000) + if cache["stats"].data_buf_all is None: + cache["stats"].data_buf_all = cache["stats"].waveform[ + 0 + ] # cache["stats"].data_buf is pointed to cache["stats"].waveform[0] + cache["stats"].data_buf = cache["stats"].data_buf_all + else: + cache["stats"].data_buf_all = torch.cat( + (cache["stats"].data_buf_all, cache["stats"].waveform[0]) + ) + for offset in range( + 0, cache["stats"].waveform.shape[1] - frame_sample_length + 1, frame_shift_length + ): + cache["stats"].decibel.append( + 10 + * math.log10( + (cache["stats"].waveform[0][offset : offset + frame_sample_length]) + .square() + .sum() + + 0.000001 + ) + ) + + def ComputeScores(self, feats: torch.Tensor, cache: dict = {}) -> None: + scores = self.encoder(feats, cache=cache["encoder"]).to("cpu") # return B * T * D + assert ( + scores.shape[1] == feats.shape[1] + ), "The shape between feats and scores does not match" + self.vad_opts.nn_eval_block_size = scores.shape[1] + cache["stats"].frm_cnt += scores.shape[1] # count total frames + if cache["stats"].scores is None: + cache["stats"].scores = scores # the first calculation + else: + cache["stats"].scores = torch.cat((cache["stats"].scores, scores), dim=1) + + def PopDataBufTillFrame(self, frame_idx: int, cache: dict = {}) -> None: # need check again + while cache["stats"].data_buf_start_frame < frame_idx: + if len(cache["stats"].data_buf) >= int( + self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000 + ): + cache["stats"].data_buf_start_frame += 1 + cache["stats"].data_buf = cache["stats"].data_buf_all[ + (cache["stats"].data_buf_start_frame - cache["stats"].last_drop_frames) + * int(self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000) : + ] + + def PopDataToOutputBuf( + self, + start_frm: int, + frm_cnt: int, + first_frm_is_start_point: bool, + last_frm_is_end_point: bool, + end_point_is_sent_end: bool, + cache: dict = {}, + ) -> None: + self.PopDataBufTillFrame(start_frm, cache=cache) + expected_sample_number = int( + frm_cnt * self.vad_opts.sample_rate * self.vad_opts.frame_in_ms / 1000 + ) + if last_frm_is_end_point: + extra_sample = max( + 0, + int( + self.vad_opts.frame_length_ms * self.vad_opts.sample_rate / 1000 + - self.vad_opts.sample_rate * self.vad_opts.frame_in_ms / 1000 + ), + ) + expected_sample_number += int(extra_sample) + if end_point_is_sent_end: + expected_sample_number = max(expected_sample_number, len(cache["stats"].data_buf)) + if len(cache["stats"].data_buf) < expected_sample_number: + print("error in calling pop data_buf\n") + + if len(cache["stats"].output_data_buf) == 0 or first_frm_is_start_point: + cache["stats"].output_data_buf.append(E2EVadSpeechBufWithDoa()) + cache["stats"].output_data_buf[-1].Reset() + cache["stats"].output_data_buf[-1].start_ms = start_frm * self.vad_opts.frame_in_ms + cache["stats"].output_data_buf[-1].end_ms = cache["stats"].output_data_buf[-1].start_ms + cache["stats"].output_data_buf[-1].doa = 0 + cur_seg = cache["stats"].output_data_buf[-1] + if cur_seg.end_ms != start_frm * self.vad_opts.frame_in_ms: + print("warning\n") + out_pos = len(cur_seg.buffer) # cur_seg.buff现在没做任何操作 + data_to_pop = 0 + if end_point_is_sent_end: + data_to_pop = expected_sample_number + else: + data_to_pop = int( + frm_cnt * self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000 + ) + if data_to_pop > len(cache["stats"].data_buf): + print('VAD data_to_pop is bigger than cache["stats"].data_buf.size()!!!\n') + data_to_pop = len(cache["stats"].data_buf) + expected_sample_number = len(cache["stats"].data_buf) + + cur_seg.doa = 0 + for sample_cpy_out in range(0, data_to_pop): + # cur_seg.buffer[out_pos ++] = data_buf_.back(); + out_pos += 1 + for sample_cpy_out in range(data_to_pop, expected_sample_number): + # cur_seg.buffer[out_pos++] = data_buf_.back() + out_pos += 1 + if cur_seg.end_ms != start_frm * self.vad_opts.frame_in_ms: + print("Something wrong with the VAD algorithm\n") + cache["stats"].data_buf_start_frame += frm_cnt + cur_seg.end_ms = (start_frm + frm_cnt) * self.vad_opts.frame_in_ms + if first_frm_is_start_point: + cur_seg.contain_seg_start_point = True + if last_frm_is_end_point: + cur_seg.contain_seg_end_point = True + + def OnSilenceDetected(self, valid_frame: int, cache: dict = {}): + cache["stats"].lastest_confirmed_silence_frame = valid_frame + if cache["stats"].vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + self.PopDataBufTillFrame(valid_frame, cache=cache) + + # silence_detected_callback_ + # pass + + def OnVoiceDetected(self, valid_frame: int, cache: dict = {}) -> None: + cache["stats"].latest_confirmed_speech_frame = valid_frame + self.PopDataToOutputBuf(valid_frame, 1, False, False, False, cache=cache) + + def OnVoiceStart(self, start_frame: int, fake_result: bool = False, cache: dict = {}) -> None: + if self.vad_opts.do_start_point_detection: + pass + if cache["stats"].confirmed_start_frame != -1: + print("not reset vad properly\n") + else: + cache["stats"].confirmed_start_frame = start_frame + + if ( + not fake_result + and cache["stats"].vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected + ): + self.PopDataToOutputBuf( + cache["stats"].confirmed_start_frame, 1, True, False, False, cache=cache + ) + + def OnVoiceEnd( + self, end_frame: int, fake_result: bool, is_last_frame: bool, cache: dict = {} + ) -> None: + for t in range(cache["stats"].latest_confirmed_speech_frame + 1, end_frame): + self.OnVoiceDetected(t, cache=cache) + if self.vad_opts.do_end_point_detection: + pass + if cache["stats"].confirmed_end_frame != -1: + print("not reset vad properly\n") + else: + cache["stats"].confirmed_end_frame = end_frame + if not fake_result: + cache["stats"].sil_frame = 0 + self.PopDataToOutputBuf( + cache["stats"].confirmed_end_frame, 1, False, True, is_last_frame, cache=cache + ) + cache["stats"].number_end_time_detected += 1 + + def MaybeOnVoiceEndIfLastFrame( + self, is_final_frame: bool, cur_frm_idx: int, cache: dict = {} + ) -> None: + if is_final_frame: + self.OnVoiceEnd(cur_frm_idx, False, True, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + + def GetLatency(self, cache: dict = {}) -> int: + return int(self.LatencyFrmNumAtStartPoint(cache=cache) * self.vad_opts.frame_in_ms) + + def LatencyFrmNumAtStartPoint(self, cache: dict = {}) -> int: + vad_latency = cache["windows_detector"].GetWinSize() + if self.vad_opts.do_extend: + vad_latency += int(self.vad_opts.lookback_time_start_point / self.vad_opts.frame_in_ms) + return vad_latency + + def GetFrameState(self, t: int, cache: dict = {}): + frame_state = FrameState.kFrameStateInvalid + cur_decibel = cache["stats"].decibel[t] + cur_snr = cur_decibel - cache["stats"].noise_average_decibel + # for each frame, calc log posterior probability of each state + if cur_decibel < self.vad_opts.decibel_thres: + frame_state = FrameState.kFrameStateSil + self.DetectOneFrame(frame_state, t, False, cache=cache) + return frame_state + + sum_score = 0.0 + noise_prob = 0.0 + assert len(cache["stats"].sil_pdf_ids) == self.vad_opts.silence_pdf_num + if len(cache["stats"].sil_pdf_ids) > 0: + assert len(cache["stats"].scores) == 1 # 只支持batch_size = 1的测试 + sil_pdf_scores = [ + cache["stats"].scores[0][t][sil_pdf_id] for sil_pdf_id in cache["stats"].sil_pdf_ids + ] + sum_score = sum(sil_pdf_scores) + noise_prob = math.log(sum_score) * self.vad_opts.speech_2_noise_ratio + total_score = 1.0 + sum_score = total_score - sum_score + speech_prob = math.log(sum_score) + if self.vad_opts.output_frame_probs: + frame_prob = E2EVadFrameProb() + frame_prob.noise_prob = noise_prob + frame_prob.speech_prob = speech_prob + frame_prob.score = sum_score + frame_prob.frame_id = t + cache["stats"].frame_probs.append(frame_prob) + if math.exp(speech_prob) >= math.exp(noise_prob) + cache["stats"].speech_noise_thres: + if cur_snr >= self.vad_opts.snr_thres and cur_decibel >= self.vad_opts.decibel_thres: + frame_state = FrameState.kFrameStateSpeech + else: + frame_state = FrameState.kFrameStateSil + else: + frame_state = FrameState.kFrameStateSil + if cache["stats"].noise_average_decibel < -99.9: + cache["stats"].noise_average_decibel = cur_decibel + else: + cache["stats"].noise_average_decibel = ( + cur_decibel + + cache["stats"].noise_average_decibel + * (self.vad_opts.noise_frame_num_used_for_snr - 1) + ) / self.vad_opts.noise_frame_num_used_for_snr + + return frame_state + + def forward( + self, + feats: torch.Tensor, + waveform: torch.tensor, + cache: dict = {}, + is_final: bool = False, + **kwargs, + ): + # if len(cache) == 0: + # self.AllResetDetection() + # self.waveform = waveform # compute decibel for each frame + cache["stats"].waveform = waveform + is_streaming_input = kwargs.get("is_streaming_input", True) + self.ComputeDecibel(cache=cache) + self.ComputeScores(feats, cache=cache) + if not is_final: + self.DetectCommonFrames(cache=cache) + else: + self.DetectLastFrames(cache=cache) + segments = [] + for batch_num in range(0, feats.shape[0]): # only support batch_size = 1 now + segment_batch = [] + if len(cache["stats"].output_data_buf) > 0: + for i in range( + cache["stats"].output_data_buf_offset, len(cache["stats"].output_data_buf) + ): + if ( + is_streaming_input + ): # in this case, return [beg, -1], [], [-1, end], [beg, end] + if not cache["stats"].output_data_buf[i].contain_seg_start_point: + continue + if ( + not cache["stats"].next_seg + and not cache["stats"].output_data_buf[i].contain_seg_end_point + ): + continue + start_ms = ( + cache["stats"].output_data_buf[i].start_ms + if cache["stats"].next_seg + else -1 + ) + if cache["stats"].output_data_buf[i].contain_seg_end_point: + end_ms = cache["stats"].output_data_buf[i].end_ms + cache["stats"].next_seg = True + cache["stats"].output_data_buf_offset += 1 + else: + end_ms = -1 + cache["stats"].next_seg = False + segment = [start_ms, end_ms] + + else: # in this case, return [beg, end] + + if not is_final and ( + not cache["stats"].output_data_buf[i].contain_seg_start_point + or not cache["stats"].output_data_buf[i].contain_seg_end_point + ): + continue + segment = [ + cache["stats"].output_data_buf[i].start_ms, + cache["stats"].output_data_buf[i].end_ms, + ] + cache["stats"].output_data_buf_offset += 1 # need update this parameter + + segment_batch.append(segment) + + if segment_batch: + segments.append(segment_batch) + # if is_final: + # # reset class variables and clear the dict for the next query + # self.AllResetDetection() + return segments + + def init_cache(self, cache: dict = {}, **kwargs): + + cache["frontend"] = {} + cache["prev_samples"] = torch.empty(0) + cache["encoder"] = {} + + if kwargs.get("max_end_silence_time") is not None: + # update the max_end_silence_time + self.vad_opts.max_end_silence_time = kwargs.get("max_end_silence_time") + + windows_detector = WindowDetector( + self.vad_opts.window_size_ms, + self.vad_opts.sil_to_speech_time_thres, + self.vad_opts.speech_to_sil_time_thres, + self.vad_opts.frame_in_ms, + ) + windows_detector.Reset() + + stats = Stats( + sil_pdf_ids=self.vad_opts.sil_pdf_ids, + max_end_sil_frame_cnt_thresh=self.vad_opts.max_end_silence_time + - self.vad_opts.speech_to_sil_time_thres, + speech_noise_thres=self.vad_opts.speech_noise_thres, + ) + cache["windows_detector"] = windows_detector + cache["stats"] = stats + return cache + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + cache: dict = {}, + **kwargs, + ): + + if len(cache) == 0: + self.init_cache(cache, **kwargs) + + meta_data = {} + chunk_size = kwargs.get("chunk_size", 60000) # 50ms + chunk_stride_samples = int(chunk_size * frontend.fs / 1000) + + time1 = time.perf_counter() + is_streaming_input = ( + kwargs.get("is_streaming_input", False) + if chunk_size >= 15000 + else kwargs.get("is_streaming_input", True) + ) + is_final = ( + kwargs.get("is_final", False) if is_streaming_input else kwargs.get("is_final", True) + ) + cfg = {"is_final": is_final, "is_streaming_input": is_streaming_input} + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + cache=cfg, + ) + _is_final = cfg["is_final"] # if data_in is a file or url, set is_final=True + is_streaming_input = cfg["is_streaming_input"] + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + assert len(audio_sample_list) == 1, "batch_size must be set 1" + + audio_sample = torch.cat((cache["prev_samples"], audio_sample_list[0])) + + n = int(len(audio_sample) // chunk_stride_samples + int(_is_final)) + m = int(len(audio_sample) % chunk_stride_samples * (1 - int(_is_final))) + segments = [] + for i in range(n): + kwargs["is_final"] = _is_final and i == n - 1 + audio_sample_i = audio_sample[i * chunk_stride_samples : (i + 1) * chunk_stride_samples] + + # extract fbank feats + speech, speech_lengths = extract_fbank( + [audio_sample_i], + data_type=kwargs.get("data_type", "sound"), + frontend=frontend, + cache=cache["frontend"], + is_final=kwargs["is_final"], + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + batch = { + "feats": speech, + "waveform": cache["frontend"]["waveforms"], + "is_final": kwargs["is_final"], + "cache": cache, + "is_streaming_input": is_streaming_input, + } + segments_i = self.forward(**batch) + if len(segments_i) > 0: + segments.extend(*segments_i) + + cache["prev_samples"] = audio_sample[:-m] + if _is_final: + self.init_cache(cache) + + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{1}best_recog"] + + results = [] + result_i = {"key": key[0], "value": segments} + # if "MODELSCOPE_ENVIRONMENT" in os.environ and os.environ["MODELSCOPE_ENVIRONMENT"] == "eas": + # result_i = json.dumps(result_i) + + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["text"][key[0]] = segments + + return results, meta_data + + def export(self, **kwargs): + + from .export_meta import export_rebuild_model + + models = export_rebuild_model(model=self, **kwargs) + return models + + def DetectCommonFrames(self, cache: dict = {}) -> int: + if cache["stats"].vad_state_machine == VadStateMachine.kVadInStateEndPointDetected: + return 0 + for i in range(self.vad_opts.nn_eval_block_size - 1, -1, -1): + frame_state = FrameState.kFrameStateInvalid + frame_state = self.GetFrameState( + cache["stats"].frm_cnt - 1 - i - cache["stats"].last_drop_frames, cache=cache + ) + self.DetectOneFrame(frame_state, cache["stats"].frm_cnt - 1 - i, False, cache=cache) + + return 0 + + def DetectLastFrames(self, cache: dict = {}) -> int: + if cache["stats"].vad_state_machine == VadStateMachine.kVadInStateEndPointDetected: + return 0 + for i in range(self.vad_opts.nn_eval_block_size - 1, -1, -1): + frame_state = FrameState.kFrameStateInvalid + frame_state = self.GetFrameState( + cache["stats"].frm_cnt - 1 - i - cache["stats"].last_drop_frames, cache=cache + ) + if i != 0: + self.DetectOneFrame(frame_state, cache["stats"].frm_cnt - 1 - i, False, cache=cache) + else: + self.DetectOneFrame(frame_state, cache["stats"].frm_cnt - 1, True, cache=cache) + + return 0 + + def DetectOneFrame( + self, cur_frm_state: FrameState, cur_frm_idx: int, is_final_frame: bool, cache: dict = {} + ) -> None: + tmp_cur_frm_state = FrameState.kFrameStateInvalid + if cur_frm_state == FrameState.kFrameStateSpeech: + if math.fabs(1.0) > self.vad_opts.fe_prior_thres: + tmp_cur_frm_state = FrameState.kFrameStateSpeech + else: + tmp_cur_frm_state = FrameState.kFrameStateSil + elif cur_frm_state == FrameState.kFrameStateSil: + tmp_cur_frm_state = FrameState.kFrameStateSil + state_change = cache["windows_detector"].DetectOneFrame( + tmp_cur_frm_state, cur_frm_idx, cache=cache + ) + frm_shift_in_ms = self.vad_opts.frame_in_ms + if AudioChangeState.kChangeStateSil2Speech == state_change: + silence_frame_count = cache["stats"].continous_silence_frame_count + cache["stats"].continous_silence_frame_count = 0 + cache["stats"].pre_end_silence_detected = False + start_frame = 0 + if cache["stats"].vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + start_frame = max( + cache["stats"].data_buf_start_frame, + cur_frm_idx - self.LatencyFrmNumAtStartPoint(cache=cache), + ) + self.OnVoiceStart(start_frame, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateInSpeechSegment + for t in range(start_frame + 1, cur_frm_idx + 1): + self.OnVoiceDetected(t, cache=cache) + elif cache["stats"].vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + for t in range(cache["stats"].latest_confirmed_speech_frame + 1, cur_frm_idx): + self.OnVoiceDetected(t, cache=cache) + if ( + cur_frm_idx - cache["stats"].confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + self.OnVoiceEnd(cur_frm_idx, False, False, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif not is_final_frame: + self.OnVoiceDetected(cur_frm_idx, cache=cache) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx, cache=cache) + else: + pass + elif AudioChangeState.kChangeStateSpeech2Sil == state_change: + cache["stats"].continous_silence_frame_count = 0 + if cache["stats"].vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + pass + elif cache["stats"].vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + if ( + cur_frm_idx - cache["stats"].confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + self.OnVoiceEnd(cur_frm_idx, False, False, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif not is_final_frame: + self.OnVoiceDetected(cur_frm_idx, cache=cache) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx, cache=cache) + else: + pass + elif AudioChangeState.kChangeStateSpeech2Speech == state_change: + cache["stats"].continous_silence_frame_count = 0 + if cache["stats"].vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + if ( + cur_frm_idx - cache["stats"].confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + cache["stats"].max_time_out = True + self.OnVoiceEnd(cur_frm_idx, False, False, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif not is_final_frame: + self.OnVoiceDetected(cur_frm_idx, cache=cache) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx, cache=cache) + else: + pass + elif AudioChangeState.kChangeStateSil2Sil == state_change: + cache["stats"].continous_silence_frame_count += 1 + if cache["stats"].vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + # silence timeout, return zero length decision + if ( + (self.vad_opts.detect_mode == VadDetectMode.kVadSingleUtteranceDetectMode.value) + and ( + cache["stats"].continous_silence_frame_count * frm_shift_in_ms + > self.vad_opts.max_start_silence_time + ) + ) or (is_final_frame and cache["stats"].number_end_time_detected == 0): + for t in range(cache["stats"].lastest_confirmed_silence_frame + 1, cur_frm_idx): + self.OnSilenceDetected(t, cache=cache) + self.OnVoiceStart(0, True, cache=cache) + self.OnVoiceEnd(0, True, False, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + else: + if cur_frm_idx >= self.LatencyFrmNumAtStartPoint(cache=cache): + self.OnSilenceDetected( + cur_frm_idx - self.LatencyFrmNumAtStartPoint(cache=cache), cache=cache + ) + elif cache["stats"].vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + if ( + cache["stats"].continous_silence_frame_count * frm_shift_in_ms + >= cache["stats"].max_end_sil_frame_cnt_thresh + ): + lookback_frame = int( + cache["stats"].max_end_sil_frame_cnt_thresh / frm_shift_in_ms + ) + if self.vad_opts.do_extend: + lookback_frame -= int( + self.vad_opts.lookahead_time_end_point / frm_shift_in_ms + ) + lookback_frame -= 1 + lookback_frame = max(0, lookback_frame) + self.OnVoiceEnd(cur_frm_idx - lookback_frame, False, False, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif ( + cur_frm_idx - cache["stats"].confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + self.OnVoiceEnd(cur_frm_idx, False, False, cache=cache) + cache["stats"].vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif self.vad_opts.do_extend and not is_final_frame: + if cache["stats"].continous_silence_frame_count <= int( + self.vad_opts.lookahead_time_end_point / frm_shift_in_ms + ): + self.OnVoiceDetected(cur_frm_idx, cache=cache) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx, cache=cache) + else: + pass + + if ( + cache["stats"].vad_state_machine == VadStateMachine.kVadInStateEndPointDetected + and self.vad_opts.detect_mode == VadDetectMode.kVadMutipleUtteranceDetectMode.value + ): + self.ResetDetection(cache=cache) diff --git a/funasr/models/fsmn_vad_streaming/template.yaml b/funasr/models/fsmn_vad_streaming/template.yaml new file mode 100644 index 0000000..e8a3a4f --- /dev/null +++ b/funasr/models/fsmn_vad_streaming/template.yaml @@ -0,0 +1,62 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: FsmnVADStreaming +model_conf: + sample_rate: 16000 + detect_mode: 1 + snr_mode: 0 + max_end_silence_time: 800 + max_start_silence_time: 3000 + do_start_point_detection: True + do_end_point_detection: True + window_size_ms: 200 + sil_to_speech_time_thres: 150 + speech_to_sil_time_thres: 150 + speech_2_noise_ratio: 1.0 + do_extend: 1 + lookback_time_start_point: 200 + lookahead_time_end_point: 100 + max_single_segment_time: 60000 + snr_thres: -100.0 + noise_frame_num_used_for_snr: 100 + decibel_thres: -100.0 + speech_noise_thres: 0.6 + fe_prior_thres: 0.0001 + silence_pdf_num: 1 + sil_pdf_ids: [0] + speech_noise_thresh_low: -0.1 + speech_noise_thresh_high: 0.3 + output_frame_probs: False + frame_in_ms: 10 + frame_length_ms: 25 + +encoder: FSMN +encoder_conf: + input_dim: 400 + input_affine_dim: 140 + fsmn_layers: 4 + linear_dim: 250 + proj_dim: 128 + lorder: 20 + rorder: 0 + lstride: 1 + rstride: 0 + output_affine_dim: 140 + output_dim: 248 + +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + dither: 0.0 + lfr_m: 5 + lfr_n: 1 diff --git a/funasr/models/language_model/__init__.py b/funasr/models/language_model/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/language_model/rnn/__init__.py b/funasr/models/language_model/rnn/__init__.py new file mode 100644 index 0000000..b7f1773 --- /dev/null +++ b/funasr/models/language_model/rnn/__init__.py @@ -0,0 +1 @@ +"""Initialize sub package.""" diff --git a/funasr/models/language_model/rnn/argument.py b/funasr/models/language_model/rnn/argument.py new file mode 100644 index 0000000..8935262 --- /dev/null +++ b/funasr/models/language_model/rnn/argument.py @@ -0,0 +1,148 @@ +# Copyright 2020 Hirofumi Inaguma +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Conformer common arguments.""" + + +def add_arguments_rnn_encoder_common(group): + """Define common arguments for RNN encoder.""" + group.add_argument( + "--etype", + default="blstmp", + type=str, + choices=[ + "lstm", + "blstm", + "lstmp", + "blstmp", + "vgglstmp", + "vggblstmp", + "vgglstm", + "vggblstm", + "gru", + "bgru", + "grup", + "bgrup", + "vgggrup", + "vggbgrup", + "vgggru", + "vggbgru", + ], + help="Type of encoder network architecture", + ) + group.add_argument( + "--elayers", + default=4, + type=int, + help="Number of encoder layers", + ) + group.add_argument( + "--eunits", + "-u", + default=300, + type=int, + help="Number of encoder hidden units", + ) + group.add_argument("--eprojs", default=320, type=int, help="Number of encoder projection units") + group.add_argument( + "--subsample", + default="1", + type=str, + help="Subsample input frames x_y_z means " + "subsample every x frame at 1st layer, " + "every y frame at 2nd layer etc.", + ) + return group + + +def add_arguments_rnn_decoder_common(group): + """Define common arguments for RNN decoder.""" + group.add_argument( + "--dtype", + default="lstm", + type=str, + choices=["lstm", "gru"], + help="Type of decoder network architecture", + ) + group.add_argument("--dlayers", default=1, type=int, help="Number of decoder layers") + group.add_argument("--dunits", default=320, type=int, help="Number of decoder hidden units") + group.add_argument( + "--dropout-rate-decoder", + default=0.0, + type=float, + help="Dropout rate for the decoder", + ) + group.add_argument( + "--sampling-probability", + default=0.0, + type=float, + help="Ratio of predicted labels fed back to decoder", + ) + group.add_argument( + "--lsm-type", + const="", + default="", + type=str, + nargs="?", + choices=["", "unigram"], + help="Apply label smoothing with a specified distribution type", + ) + return group + + +def add_arguments_rnn_attention_common(group): + """Define common arguments for RNN attention.""" + group.add_argument( + "--atype", + default="dot", + type=str, + choices=[ + "noatt", + "dot", + "add", + "location", + "coverage", + "coverage_location", + "location2d", + "location_recurrent", + "multi_head_dot", + "multi_head_add", + "multi_head_loc", + "multi_head_multi_res_loc", + ], + help="Type of attention architecture", + ) + group.add_argument( + "--adim", + default=320, + type=int, + help="Number of attention transformation dimensions", + ) + group.add_argument("--awin", default=5, type=int, help="Window size for location2d attention") + group.add_argument( + "--aheads", + default=4, + type=int, + help="Number of heads for multi head attention", + ) + group.add_argument( + "--aconv-chans", + default=-1, + type=int, + help="Number of attention convolution channels \ + (negative value indicates no location-aware attention)", + ) + group.add_argument( + "--aconv-filts", + default=100, + type=int, + help="Number of attention convolution filters \ + (negative value indicates no location-aware attention)", + ) + group.add_argument( + "--dropout-rate", + default=0.0, + type=float, + help="Dropout rate for the encoder", + ) + return group diff --git a/funasr/models/language_model/rnn/attentions.py b/funasr/models/language_model/rnn/attentions.py new file mode 100644 index 0000000..f5c450c --- /dev/null +++ b/funasr/models/language_model/rnn/attentions.py @@ -0,0 +1,1724 @@ +"""Attention modules for RNN.""" + +import math +import six + +import torch +import torch.nn.functional as F + +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.utils.nets_utils import to_device + + +def _apply_attention_constraint(e, last_attended_idx, backward_window=1, forward_window=3): + """Apply monotonic attention constraint. + + This function apply the monotonic attention constraint + introduced in `Deep Voice 3: Scaling + Text-to-Speech with Convolutional Sequence Learning`_. + + Args: + e (Tensor): Attention energy before applying softmax (1, T). + last_attended_idx (int): The index of the inputs of the last attended [0, T]. + backward_window (int, optional): Backward window size in attention constraint. + forward_window (int, optional): Forward window size in attetion constraint. + + Returns: + Tensor: Monotonic constrained attention energy (1, T). + + .. _`Deep Voice 3: Scaling Text-to-Speech with Convolutional Sequence Learning`: + https://arxiv.org/abs/1710.07654 + + """ + if e.size(0) != 1: + raise NotImplementedError("Batch attention constraining is not yet supported.") + backward_idx = last_attended_idx - backward_window + forward_idx = last_attended_idx + forward_window + if backward_idx > 0: + e[:, :backward_idx] = -float("inf") + if forward_idx < e.size(1): + e[:, forward_idx:] = -float("inf") + return e + + +class NoAtt(torch.nn.Module): + """No attention""" + + def __init__(self): + super(NoAtt, self).__init__() + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.c = None + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.c = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev): + """NoAtt forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B, T_max, D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: dummy (does not use) + :param torch.Tensor att_prev: dummy (does not use) + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: previous attention weights + :rtype: torch.Tensor + """ + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + + # initialize attention weight with uniform dist. + if att_prev is None: + # if no bias, 0 0-pad goes 0 + mask = 1.0 - make_pad_mask(enc_hs_len).float() + att_prev = mask / mask.new(enc_hs_len).unsqueeze(-1) + att_prev = att_prev.to(self.enc_h) + self.c = torch.sum(self.enc_h * att_prev.view(batch, self.h_length, 1), dim=1) + + return self.c, att_prev + + +class AttDot(torch.nn.Module): + """Dot product attention + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_enc_h + """ + + def __init__(self, eprojs, dunits, att_dim, han_mode=False): + super(AttDot, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim) + + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev, scaling=2.0): + """AttDot forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: dummy (does not use) + :param torch.Tensor att_prev: dummy (does not use) + :param float scaling: scaling parameter before applying softmax + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: previous attention weight (B x T_max) + :rtype: torch.Tensor + """ + + batch = enc_hs_pad.size(0) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = torch.tanh(self.mlp_enc(self.enc_h)) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + e = torch.sum( + self.pre_compute_enc_h * torch.tanh(self.mlp_dec(dec_z)).view(batch, 1, self.att_dim), + dim=2, + ) # utt x frame + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w = F.softmax(scaling * e, dim=1) + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + return c, w + + +class AttAdd(torch.nn.Module): + """Additive attention + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_enc_h + """ + + def __init__(self, eprojs, dunits, att_dim, han_mode=False): + super(AttAdd, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.gvec = torch.nn.Linear(att_dim, 1) + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev, scaling=2.0): + """AttAdd forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: dummy (does not use) + :param float scaling: scaling parameter before applying softmax + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: previous attention weights (B x T_max) + :rtype: torch.Tensor + """ + + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).view(batch, 1, self.att_dim) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec(torch.tanh(self.pre_compute_enc_h + dec_z_tiled)).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w = F.softmax(scaling * e, dim=1) + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + + return c, w + + +class AttLoc(torch.nn.Module): + """location-aware attention module. + + Reference: Attention-Based Models for Speech Recognition + (https://arxiv.org/pdf/1506.07503.pdf) + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_enc_h + """ + + def __init__(self, eprojs, dunits, att_dim, aconv_chans, aconv_filts, han_mode=False): + super(AttLoc, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.mlp_att = torch.nn.Linear(aconv_chans, att_dim, bias=False) + self.loc_conv = torch.nn.Conv2d( + 1, + aconv_chans, + (1, 2 * aconv_filts + 1), + padding=(0, aconv_filts), + bias=False, + ) + self.gvec = torch.nn.Linear(att_dim, 1) + + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward( + self, + enc_hs_pad, + enc_hs_len, + dec_z, + att_prev, + scaling=2.0, + last_attended_idx=None, + backward_window=1, + forward_window=3, + ): + """Calculate AttLoc forward propagation. + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: previous attention weight (B x T_max) + :param float scaling: scaling parameter before applying softmax + :param torch.Tensor forward_window: + forward window size when constraining attention + :param int last_attended_idx: index of the inputs of the last attended + :param int backward_window: backward window size in attention constraint + :param int forward_window: forward window size in attetion constraint + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: previous attention weights (B x T_max) + :rtype: torch.Tensor + """ + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + # initialize attention weight with uniform dist. + if att_prev is None: + # if no bias, 0 0-pad goes 0 + att_prev = 1.0 - make_pad_mask(enc_hs_len).to(device=dec_z.device, dtype=dec_z.dtype) + att_prev = att_prev / att_prev.new(enc_hs_len).unsqueeze(-1) + + # att_prev: utt x frame -> utt x 1 x 1 x frame + # -> utt x att_conv_chans x 1 x frame + att_conv = self.loc_conv(att_prev.view(batch, 1, 1, self.h_length)) + # att_conv: utt x att_conv_chans x 1 x frame -> utt x frame x att_conv_chans + att_conv = att_conv.squeeze(2).transpose(1, 2) + # att_conv: utt x frame x att_conv_chans -> utt x frame x att_dim + att_conv = self.mlp_att(att_conv) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).view(batch, 1, self.att_dim) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec(torch.tanh(att_conv + self.pre_compute_enc_h + dec_z_tiled)).squeeze(2) + + # NOTE: consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + + # apply monotonic attention constraint (mainly for TTS) + if last_attended_idx is not None: + e = _apply_attention_constraint(e, last_attended_idx, backward_window, forward_window) + + w = F.softmax(scaling * e, dim=1) + + # weighted sum over flames + # utt x hdim + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + + return c, w + + +class AttCov(torch.nn.Module): + """Coverage mechanism attention + + Reference: Get To The Point: Summarization with Pointer-Generator Network + (https://arxiv.org/abs/1704.04368) + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_enc_h + """ + + def __init__(self, eprojs, dunits, att_dim, han_mode=False): + super(AttCov, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.wvec = torch.nn.Linear(1, att_dim) + self.gvec = torch.nn.Linear(att_dim, 1) + + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev_list, scaling=2.0): + """AttCov forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param list att_prev_list: list of previous attention weight + :param float scaling: scaling parameter before applying softmax + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: list of previous attention weights + :rtype: list + """ + + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + # initialize attention weight with uniform dist. + if att_prev_list is None: + # if no bias, 0 0-pad goes 0 + att_prev_list = to_device(enc_hs_pad, (1.0 - make_pad_mask(enc_hs_len).float())) + att_prev_list = [att_prev_list / att_prev_list.new(enc_hs_len).unsqueeze(-1)] + + # att_prev_list: L' * [B x T] => cov_vec B x T + cov_vec = sum(att_prev_list) + # cov_vec: B x T => B x T x 1 => B x T x att_dim + cov_vec = self.wvec(cov_vec.unsqueeze(-1)) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).view(batch, 1, self.att_dim) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec(torch.tanh(cov_vec + self.pre_compute_enc_h + dec_z_tiled)).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w = F.softmax(scaling * e, dim=1) + att_prev_list += [w] + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + + return c, att_prev_list + + +class AttLoc2D(torch.nn.Module): + """2D location-aware attention + + This attention is an extended version of location aware attention. + It take not only one frame before attention weights, + but also earlier frames into account. + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + :param int att_win: attention window size (default=5) + :param bool han_mode: + flag to swith on mode of hierarchical attention and not store pre_compute_enc_h + """ + + def __init__(self, eprojs, dunits, att_dim, att_win, aconv_chans, aconv_filts, han_mode=False): + super(AttLoc2D, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.mlp_att = torch.nn.Linear(aconv_chans, att_dim, bias=False) + self.loc_conv = torch.nn.Conv2d( + 1, + aconv_chans, + (att_win, 2 * aconv_filts + 1), + padding=(0, aconv_filts), + bias=False, + ) + self.gvec = torch.nn.Linear(att_dim, 1) + + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.aconv_chans = aconv_chans + self.att_win = att_win + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev, scaling=2.0): + """AttLoc2D forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: previous attention weight (B x att_win x T_max) + :param float scaling: scaling parameter before applying softmax + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: previous attention weights (B x att_win x T_max) + :rtype: torch.Tensor + """ + + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + # initialize attention weight with uniform dist. + if att_prev is None: + # B * [Li x att_win] + # if no bias, 0 0-pad goes 0 + att_prev = to_device(enc_hs_pad, (1.0 - make_pad_mask(enc_hs_len).float())) + att_prev = att_prev / att_prev.new(enc_hs_len).unsqueeze(-1) + att_prev = att_prev.unsqueeze(1).expand(-1, self.att_win, -1) + + # att_prev: B x att_win x Tmax -> B x 1 x att_win x Tmax -> B x C x 1 x Tmax + att_conv = self.loc_conv(att_prev.unsqueeze(1)) + # att_conv: B x C x 1 x Tmax -> B x Tmax x C + att_conv = att_conv.squeeze(2).transpose(1, 2) + # att_conv: utt x frame x att_conv_chans -> utt x frame x att_dim + att_conv = self.mlp_att(att_conv) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).view(batch, 1, self.att_dim) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec(torch.tanh(att_conv + self.pre_compute_enc_h + dec_z_tiled)).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w = F.softmax(scaling * e, dim=1) + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + + # update att_prev: B x att_win x Tmax -> B x att_win+1 x Tmax + # -> B x att_win x Tmax + att_prev = torch.cat([att_prev, w.unsqueeze(1)], dim=1) + att_prev = att_prev[:, 1:] + + return c, att_prev + + +class AttLocRec(torch.nn.Module): + """location-aware recurrent attention + + This attention is an extended version of location aware attention. + With the use of RNN, + it take the effect of the history of attention weights into account. + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + :param bool han_mode: + flag to swith on mode of hierarchical attention and not store pre_compute_enc_h + """ + + def __init__(self, eprojs, dunits, att_dim, aconv_chans, aconv_filts, han_mode=False): + super(AttLocRec, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.loc_conv = torch.nn.Conv2d( + 1, + aconv_chans, + (1, 2 * aconv_filts + 1), + padding=(0, aconv_filts), + bias=False, + ) + self.att_lstm = torch.nn.LSTMCell(aconv_chans, att_dim, bias=False) + self.gvec = torch.nn.Linear(att_dim, 1) + + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev_states, scaling=2.0): + """AttLocRec forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param tuple att_prev_states: previous attention weight and lstm states + ((B, T_max), ((B, att_dim), (B, att_dim))) + :param float scaling: scaling parameter before applying softmax + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: previous attention weights and lstm states (w, (hx, cx)) + ((B, T_max), ((B, att_dim), (B, att_dim))) + :rtype: tuple + """ + + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + if att_prev_states is None: + # initialize attention weight with uniform dist. + # if no bias, 0 0-pad goes 0 + att_prev = to_device(enc_hs_pad, (1.0 - make_pad_mask(enc_hs_len).float())) + att_prev = att_prev / att_prev.new(enc_hs_len).unsqueeze(-1) + + # initialize lstm states + att_h = enc_hs_pad.new_zeros(batch, self.att_dim) + att_c = enc_hs_pad.new_zeros(batch, self.att_dim) + att_states = (att_h, att_c) + else: + att_prev = att_prev_states[0] + att_states = att_prev_states[1] + + # B x 1 x 1 x T -> B x C x 1 x T + att_conv = self.loc_conv(att_prev.view(batch, 1, 1, self.h_length)) + # apply non-linear + att_conv = F.relu(att_conv) + # B x C x 1 x T -> B x C x 1 x 1 -> B x C + att_conv = F.max_pool2d(att_conv, (1, att_conv.size(3))).view(batch, -1) + + att_h, att_c = self.att_lstm(att_conv, att_states) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).view(batch, 1, self.att_dim) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec( + torch.tanh(att_h.unsqueeze(1) + self.pre_compute_enc_h + dec_z_tiled) + ).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w = F.softmax(scaling * e, dim=1) + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + + return c, (w, (att_h, att_c)) + + +class AttCovLoc(torch.nn.Module): + """Coverage mechanism location aware attention + + This attention is a combination of coverage and location-aware attentions. + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + :param bool han_mode: + flag to swith on mode of hierarchical attention and not store pre_compute_enc_h + """ + + def __init__(self, eprojs, dunits, att_dim, aconv_chans, aconv_filts, han_mode=False): + super(AttCovLoc, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.mlp_att = torch.nn.Linear(aconv_chans, att_dim, bias=False) + self.loc_conv = torch.nn.Conv2d( + 1, + aconv_chans, + (1, 2 * aconv_filts + 1), + padding=(0, aconv_filts), + bias=False, + ) + self.gvec = torch.nn.Linear(att_dim, 1) + + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.aconv_chans = aconv_chans + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev_list, scaling=2.0): + """AttCovLoc forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param list att_prev_list: list of previous attention weight + :param float scaling: scaling parameter before applying softmax + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: list of previous attention weights + :rtype: list + """ + + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + # initialize attention weight with uniform dist. + if att_prev_list is None: + # if no bias, 0 0-pad goes 0 + mask = 1.0 - make_pad_mask(enc_hs_len).float() + att_prev_list = [to_device(enc_hs_pad, mask / mask.new(enc_hs_len).unsqueeze(-1))] + + # att_prev_list: L' * [B x T] => cov_vec B x T + cov_vec = sum(att_prev_list) + + # cov_vec: B x T -> B x 1 x 1 x T -> B x C x 1 x T + att_conv = self.loc_conv(cov_vec.view(batch, 1, 1, self.h_length)) + # att_conv: utt x att_conv_chans x 1 x frame -> utt x frame x att_conv_chans + att_conv = att_conv.squeeze(2).transpose(1, 2) + # att_conv: utt x frame x att_conv_chans -> utt x frame x att_dim + att_conv = self.mlp_att(att_conv) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).view(batch, 1, self.att_dim) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec(torch.tanh(att_conv + self.pre_compute_enc_h + dec_z_tiled)).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w = F.softmax(scaling * e, dim=1) + att_prev_list += [w] + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + + return c, att_prev_list + + +class AttMultiHeadDot(torch.nn.Module): + """Multi head dot product attention + + Reference: Attention is all you need + (https://arxiv.org/abs/1706.03762) + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int aheads: # heads of multi head attention + :param int att_dim_k: dimension k in multi head attention + :param int att_dim_v: dimension v in multi head attention + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_k and pre_compute_v + """ + + def __init__(self, eprojs, dunits, aheads, att_dim_k, att_dim_v, han_mode=False): + super(AttMultiHeadDot, self).__init__() + self.mlp_q = torch.nn.ModuleList() + self.mlp_k = torch.nn.ModuleList() + self.mlp_v = torch.nn.ModuleList() + for _ in six.moves.range(aheads): + self.mlp_q += [torch.nn.Linear(dunits, att_dim_k)] + self.mlp_k += [torch.nn.Linear(eprojs, att_dim_k, bias=False)] + self.mlp_v += [torch.nn.Linear(eprojs, att_dim_v, bias=False)] + self.mlp_o = torch.nn.Linear(aheads * att_dim_v, eprojs, bias=False) + self.dunits = dunits + self.eprojs = eprojs + self.aheads = aheads + self.att_dim_k = att_dim_k + self.att_dim_v = att_dim_v + self.scaling = 1.0 / math.sqrt(att_dim_k) + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev): + """AttMultiHeadDot forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: dummy (does not use) + :return: attention weighted encoder state (B x D_enc) + :rtype: torch.Tensor + :return: list of previous attention weight (B x T_max) * aheads + :rtype: list + """ + + batch = enc_hs_pad.size(0) + # pre-compute all k and v outside the decoder loop + if self.pre_compute_k is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_k = [ + torch.tanh(self.mlp_k[h](self.enc_h)) for h in six.moves.range(self.aheads) + ] + + if self.pre_compute_v is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_v = [self.mlp_v[h](self.enc_h) for h in six.moves.range(self.aheads)] + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + c = [] + w = [] + for h in six.moves.range(self.aheads): + e = torch.sum( + self.pre_compute_k[h] + * torch.tanh(self.mlp_q[h](dec_z)).view(batch, 1, self.att_dim_k), + dim=2, + ) # utt x frame + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w += [F.softmax(self.scaling * e, dim=1)] + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c += [torch.sum(self.pre_compute_v[h] * w[h].view(batch, self.h_length, 1), dim=1)] + + # concat all of c + c = self.mlp_o(torch.cat(c, dim=1)) + + return c, w + + +class AttMultiHeadAdd(torch.nn.Module): + """Multi head additive attention + + Reference: Attention is all you need + (https://arxiv.org/abs/1706.03762) + + This attention is multi head attention using additive attention for each head. + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int aheads: # heads of multi head attention + :param int att_dim_k: dimension k in multi head attention + :param int att_dim_v: dimension v in multi head attention + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_k and pre_compute_v + """ + + def __init__(self, eprojs, dunits, aheads, att_dim_k, att_dim_v, han_mode=False): + super(AttMultiHeadAdd, self).__init__() + self.mlp_q = torch.nn.ModuleList() + self.mlp_k = torch.nn.ModuleList() + self.mlp_v = torch.nn.ModuleList() + self.gvec = torch.nn.ModuleList() + for _ in six.moves.range(aheads): + self.mlp_q += [torch.nn.Linear(dunits, att_dim_k)] + self.mlp_k += [torch.nn.Linear(eprojs, att_dim_k, bias=False)] + self.mlp_v += [torch.nn.Linear(eprojs, att_dim_v, bias=False)] + self.gvec += [torch.nn.Linear(att_dim_k, 1)] + self.mlp_o = torch.nn.Linear(aheads * att_dim_v, eprojs, bias=False) + self.dunits = dunits + self.eprojs = eprojs + self.aheads = aheads + self.att_dim_k = att_dim_k + self.att_dim_v = att_dim_v + self.scaling = 1.0 / math.sqrt(att_dim_k) + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev): + """AttMultiHeadAdd forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: dummy (does not use) + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: list of previous attention weight (B x T_max) * aheads + :rtype: list + """ + + batch = enc_hs_pad.size(0) + # pre-compute all k and v outside the decoder loop + if self.pre_compute_k is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_k = [self.mlp_k[h](self.enc_h) for h in six.moves.range(self.aheads)] + + if self.pre_compute_v is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_v = [self.mlp_v[h](self.enc_h) for h in six.moves.range(self.aheads)] + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + c = [] + w = [] + for h in six.moves.range(self.aheads): + e = self.gvec[h]( + torch.tanh( + self.pre_compute_k[h] + self.mlp_q[h](dec_z).view(batch, 1, self.att_dim_k) + ) + ).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w += [F.softmax(self.scaling * e, dim=1)] + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c += [torch.sum(self.pre_compute_v[h] * w[h].view(batch, self.h_length, 1), dim=1)] + + # concat all of c + c = self.mlp_o(torch.cat(c, dim=1)) + + return c, w + + +class AttMultiHeadLoc(torch.nn.Module): + """Multi head location based attention + + Reference: Attention is all you need + (https://arxiv.org/abs/1706.03762) + + This attention is multi head attention using location-aware attention for each head. + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int aheads: # heads of multi head attention + :param int att_dim_k: dimension k in multi head attention + :param int att_dim_v: dimension v in multi head attention + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_k and pre_compute_v + """ + + def __init__( + self, + eprojs, + dunits, + aheads, + att_dim_k, + att_dim_v, + aconv_chans, + aconv_filts, + han_mode=False, + ): + super(AttMultiHeadLoc, self).__init__() + self.mlp_q = torch.nn.ModuleList() + self.mlp_k = torch.nn.ModuleList() + self.mlp_v = torch.nn.ModuleList() + self.gvec = torch.nn.ModuleList() + self.loc_conv = torch.nn.ModuleList() + self.mlp_att = torch.nn.ModuleList() + for _ in six.moves.range(aheads): + self.mlp_q += [torch.nn.Linear(dunits, att_dim_k)] + self.mlp_k += [torch.nn.Linear(eprojs, att_dim_k, bias=False)] + self.mlp_v += [torch.nn.Linear(eprojs, att_dim_v, bias=False)] + self.gvec += [torch.nn.Linear(att_dim_k, 1)] + self.loc_conv += [ + torch.nn.Conv2d( + 1, + aconv_chans, + (1, 2 * aconv_filts + 1), + padding=(0, aconv_filts), + bias=False, + ) + ] + self.mlp_att += [torch.nn.Linear(aconv_chans, att_dim_k, bias=False)] + self.mlp_o = torch.nn.Linear(aheads * att_dim_v, eprojs, bias=False) + self.dunits = dunits + self.eprojs = eprojs + self.aheads = aheads + self.att_dim_k = att_dim_k + self.att_dim_v = att_dim_v + self.scaling = 1.0 / math.sqrt(att_dim_k) + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev, scaling=2.0): + """AttMultiHeadLoc forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: + list of previous attention weight (B x T_max) * aheads + :param float scaling: scaling parameter before applying softmax + :return: attention weighted encoder state (B x D_enc) + :rtype: torch.Tensor + :return: list of previous attention weight (B x T_max) * aheads + :rtype: list + """ + + batch = enc_hs_pad.size(0) + # pre-compute all k and v outside the decoder loop + if self.pre_compute_k is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_k = [self.mlp_k[h](self.enc_h) for h in six.moves.range(self.aheads)] + + if self.pre_compute_v is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_v = [self.mlp_v[h](self.enc_h) for h in six.moves.range(self.aheads)] + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + if att_prev is None: + att_prev = [] + for _ in six.moves.range(self.aheads): + # if no bias, 0 0-pad goes 0 + mask = 1.0 - make_pad_mask(enc_hs_len).float() + att_prev += [to_device(enc_hs_pad, mask / mask.new(enc_hs_len).unsqueeze(-1))] + + c = [] + w = [] + for h in six.moves.range(self.aheads): + att_conv = self.loc_conv[h](att_prev[h].view(batch, 1, 1, self.h_length)) + att_conv = att_conv.squeeze(2).transpose(1, 2) + att_conv = self.mlp_att[h](att_conv) + + e = self.gvec[h]( + torch.tanh( + self.pre_compute_k[h] + + att_conv + + self.mlp_q[h](dec_z).view(batch, 1, self.att_dim_k) + ) + ).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w += [F.softmax(scaling * e, dim=1)] + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c += [torch.sum(self.pre_compute_v[h] * w[h].view(batch, self.h_length, 1), dim=1)] + + # concat all of c + c = self.mlp_o(torch.cat(c, dim=1)) + + return c, w + + +class AttMultiHeadMultiResLoc(torch.nn.Module): + """Multi head multi resolution location based attention + + Reference: Attention is all you need + (https://arxiv.org/abs/1706.03762) + + This attention is multi head attention using location-aware attention for each head. + Furthermore, it uses different filter size for each head. + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int aheads: # heads of multi head attention + :param int att_dim_k: dimension k in multi head attention + :param int att_dim_v: dimension v in multi head attention + :param int aconv_chans: maximum # channels of attention convolution + each head use #ch = aconv_chans * (head + 1) / aheads + e.g. aheads=4, aconv_chans=100 => filter size = 25, 50, 75, 100 + :param int aconv_filts: filter size of attention convolution + :param bool han_mode: flag to swith on mode of hierarchical attention + and not store pre_compute_k and pre_compute_v + """ + + def __init__( + self, + eprojs, + dunits, + aheads, + att_dim_k, + att_dim_v, + aconv_chans, + aconv_filts, + han_mode=False, + ): + super(AttMultiHeadMultiResLoc, self).__init__() + self.mlp_q = torch.nn.ModuleList() + self.mlp_k = torch.nn.ModuleList() + self.mlp_v = torch.nn.ModuleList() + self.gvec = torch.nn.ModuleList() + self.loc_conv = torch.nn.ModuleList() + self.mlp_att = torch.nn.ModuleList() + for h in six.moves.range(aheads): + self.mlp_q += [torch.nn.Linear(dunits, att_dim_k)] + self.mlp_k += [torch.nn.Linear(eprojs, att_dim_k, bias=False)] + self.mlp_v += [torch.nn.Linear(eprojs, att_dim_v, bias=False)] + self.gvec += [torch.nn.Linear(att_dim_k, 1)] + afilts = aconv_filts * (h + 1) // aheads + self.loc_conv += [ + torch.nn.Conv2d( + 1, aconv_chans, (1, 2 * afilts + 1), padding=(0, afilts), bias=False + ) + ] + self.mlp_att += [torch.nn.Linear(aconv_chans, att_dim_k, bias=False)] + self.mlp_o = torch.nn.Linear(aheads * att_dim_v, eprojs, bias=False) + self.dunits = dunits + self.eprojs = eprojs + self.aheads = aheads + self.att_dim_k = att_dim_k + self.att_dim_v = att_dim_v + self.scaling = 1.0 / math.sqrt(att_dim_k) + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + self.han_mode = han_mode + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_k = None + self.pre_compute_v = None + self.mask = None + + def forward(self, enc_hs_pad, enc_hs_len, dec_z, att_prev): + """AttMultiHeadMultiResLoc forward + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: list of previous attention weight + (B x T_max) * aheads + :return: attention weighted encoder state (B x D_enc) + :rtype: torch.Tensor + :return: list of previous attention weight (B x T_max) * aheads + :rtype: list + """ + + batch = enc_hs_pad.size(0) + # pre-compute all k and v outside the decoder loop + if self.pre_compute_k is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_k = [self.mlp_k[h](self.enc_h) for h in six.moves.range(self.aheads)] + + if self.pre_compute_v is None or self.han_mode: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_v = [self.mlp_v[h](self.enc_h) for h in six.moves.range(self.aheads)] + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + if att_prev is None: + att_prev = [] + for _ in six.moves.range(self.aheads): + # if no bias, 0 0-pad goes 0 + mask = 1.0 - make_pad_mask(enc_hs_len).float() + att_prev += [to_device(enc_hs_pad, mask / mask.new(enc_hs_len).unsqueeze(-1))] + + c = [] + w = [] + for h in six.moves.range(self.aheads): + att_conv = self.loc_conv[h](att_prev[h].view(batch, 1, 1, self.h_length)) + att_conv = att_conv.squeeze(2).transpose(1, 2) + att_conv = self.mlp_att[h](att_conv) + + e = self.gvec[h]( + torch.tanh( + self.pre_compute_k[h] + + att_conv + + self.mlp_q[h](dec_z).view(batch, 1, self.att_dim_k) + ) + ).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + w += [F.softmax(self.scaling * e, dim=1)] + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c += [torch.sum(self.pre_compute_v[h] * w[h].view(batch, self.h_length, 1), dim=1)] + + # concat all of c + c = self.mlp_o(torch.cat(c, dim=1)) + + return c, w + + +class AttForward(torch.nn.Module): + """Forward attention module. + + Reference: + Forward attention in sequence-to-sequence acoustic modeling for speech synthesis + (https://arxiv.org/pdf/1807.06736.pdf) + + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + """ + + def __init__(self, eprojs, dunits, att_dim, aconv_chans, aconv_filts): + super(AttForward, self).__init__() + self.mlp_enc = torch.nn.Linear(eprojs, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.mlp_att = torch.nn.Linear(aconv_chans, att_dim, bias=False) + self.loc_conv = torch.nn.Conv2d( + 1, + aconv_chans, + (1, 2 * aconv_filts + 1), + padding=(0, aconv_filts), + bias=False, + ) + self.gvec = torch.nn.Linear(att_dim, 1) + self.dunits = dunits + self.eprojs = eprojs + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def reset(self): + """reset states""" + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + + def forward( + self, + enc_hs_pad, + enc_hs_len, + dec_z, + att_prev, + scaling=1.0, + last_attended_idx=None, + backward_window=1, + forward_window=3, + ): + """Calculate AttForward forward propagation. + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B x T_max x D_enc) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B x D_dec) + :param torch.Tensor att_prev: attention weights of previous step + :param float scaling: scaling parameter before applying softmax + :param int last_attended_idx: index of the inputs of the last attended + :param int backward_window: backward window size in attention constraint + :param int forward_window: forward window size in attetion constraint + :return: attention weighted encoder state (B, D_enc) + :rtype: torch.Tensor + :return: previous attention weights (B x T_max) + :rtype: torch.Tensor + """ + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + if att_prev is None: + # initial attention will be [1, 0, 0, ...] + att_prev = enc_hs_pad.new_zeros(*enc_hs_pad.size()[:2]) + att_prev[:, 0] = 1.0 + + # att_prev: utt x frame -> utt x 1 x 1 x frame + # -> utt x att_conv_chans x 1 x frame + att_conv = self.loc_conv(att_prev.view(batch, 1, 1, self.h_length)) + # att_conv: utt x att_conv_chans x 1 x frame -> utt x frame x att_conv_chans + att_conv = att_conv.squeeze(2).transpose(1, 2) + # att_conv: utt x frame x att_conv_chans -> utt x frame x att_dim + att_conv = self.mlp_att(att_conv) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).unsqueeze(1) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec(torch.tanh(self.pre_compute_enc_h + dec_z_tiled + att_conv)).squeeze(2) + + # NOTE: consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + + # apply monotonic attention constraint (mainly for TTS) + if last_attended_idx is not None: + e = _apply_attention_constraint(e, last_attended_idx, backward_window, forward_window) + + w = F.softmax(scaling * e, dim=1) + + # forward attention + att_prev_shift = F.pad(att_prev, (1, 0))[:, :-1] + w = (att_prev + att_prev_shift) * w + # NOTE: clamp is needed to avoid nan gradient + w = F.normalize(torch.clamp(w, 1e-6), p=1, dim=1) + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.unsqueeze(-1), dim=1) + + return c, w + + +class AttForwardTA(torch.nn.Module): + """Forward attention with transition agent module. + + Reference: + Forward attention in sequence-to-sequence acoustic modeling for speech synthesis + (https://arxiv.org/pdf/1807.06736.pdf) + + :param int eunits: # units of encoder + :param int dunits: # units of decoder + :param int att_dim: attention dimension + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + :param int odim: output dimension + """ + + def __init__(self, eunits, dunits, att_dim, aconv_chans, aconv_filts, odim): + super(AttForwardTA, self).__init__() + self.mlp_enc = torch.nn.Linear(eunits, att_dim) + self.mlp_dec = torch.nn.Linear(dunits, att_dim, bias=False) + self.mlp_ta = torch.nn.Linear(eunits + dunits + odim, 1) + self.mlp_att = torch.nn.Linear(aconv_chans, att_dim, bias=False) + self.loc_conv = torch.nn.Conv2d( + 1, + aconv_chans, + (1, 2 * aconv_filts + 1), + padding=(0, aconv_filts), + bias=False, + ) + self.gvec = torch.nn.Linear(att_dim, 1) + self.dunits = dunits + self.eunits = eunits + self.att_dim = att_dim + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + self.trans_agent_prob = 0.5 + + def reset(self): + self.h_length = None + self.enc_h = None + self.pre_compute_enc_h = None + self.mask = None + self.trans_agent_prob = 0.5 + + def forward( + self, + enc_hs_pad, + enc_hs_len, + dec_z, + att_prev, + out_prev, + scaling=1.0, + last_attended_idx=None, + backward_window=1, + forward_window=3, + ): + """Calculate AttForwardTA forward propagation. + + :param torch.Tensor enc_hs_pad: padded encoder hidden state (B, Tmax, eunits) + :param list enc_hs_len: padded encoder hidden state length (B) + :param torch.Tensor dec_z: decoder hidden state (B, dunits) + :param torch.Tensor att_prev: attention weights of previous step + :param torch.Tensor out_prev: decoder outputs of previous step (B, odim) + :param float scaling: scaling parameter before applying softmax + :param int last_attended_idx: index of the inputs of the last attended + :param int backward_window: backward window size in attention constraint + :param int forward_window: forward window size in attetion constraint + :return: attention weighted encoder state (B, dunits) + :rtype: torch.Tensor + :return: previous attention weights (B, Tmax) + :rtype: torch.Tensor + """ + batch = len(enc_hs_pad) + # pre-compute all h outside the decoder loop + if self.pre_compute_enc_h is None: + self.enc_h = enc_hs_pad # utt x frame x hdim + self.h_length = self.enc_h.size(1) + # utt x frame x att_dim + self.pre_compute_enc_h = self.mlp_enc(self.enc_h) + + if dec_z is None: + dec_z = enc_hs_pad.new_zeros(batch, self.dunits) + else: + dec_z = dec_z.view(batch, self.dunits) + + if att_prev is None: + # initial attention will be [1, 0, 0, ...] + att_prev = enc_hs_pad.new_zeros(*enc_hs_pad.size()[:2]) + att_prev[:, 0] = 1.0 + + # att_prev: utt x frame -> utt x 1 x 1 x frame + # -> utt x att_conv_chans x 1 x frame + att_conv = self.loc_conv(att_prev.view(batch, 1, 1, self.h_length)) + # att_conv: utt x att_conv_chans x 1 x frame -> utt x frame x att_conv_chans + att_conv = att_conv.squeeze(2).transpose(1, 2) + # att_conv: utt x frame x att_conv_chans -> utt x frame x att_dim + att_conv = self.mlp_att(att_conv) + + # dec_z_tiled: utt x frame x att_dim + dec_z_tiled = self.mlp_dec(dec_z).view(batch, 1, self.att_dim) + + # dot with gvec + # utt x frame x att_dim -> utt x frame + e = self.gvec(torch.tanh(att_conv + self.pre_compute_enc_h + dec_z_tiled)).squeeze(2) + + # NOTE consider zero padding when compute w. + if self.mask is None: + self.mask = to_device(enc_hs_pad, make_pad_mask(enc_hs_len)) + e.masked_fill_(self.mask, -float("inf")) + + # apply monotonic attention constraint (mainly for TTS) + if last_attended_idx is not None: + e = _apply_attention_constraint(e, last_attended_idx, backward_window, forward_window) + + w = F.softmax(scaling * e, dim=1) + + # forward attention + att_prev_shift = F.pad(att_prev, (1, 0))[:, :-1] + w = (self.trans_agent_prob * att_prev + (1 - self.trans_agent_prob) * att_prev_shift) * w + # NOTE: clamp is needed to avoid nan gradient + w = F.normalize(torch.clamp(w, 1e-6), p=1, dim=1) + + # weighted sum over flames + # utt x hdim + # NOTE use bmm instead of sum(*) + c = torch.sum(self.enc_h * w.view(batch, self.h_length, 1), dim=1) + + # update transition agent prob + self.trans_agent_prob = torch.sigmoid(self.mlp_ta(torch.cat([c, out_prev, dec_z], dim=1))) + + return c, w + + +def att_for(args, num_att=1, han_mode=False): + """Instantiates an attention module given the program arguments + + :param Namespace args: The arguments + :param int num_att: number of attention modules + (in multi-speaker case, it can be 2 or more) + :param bool han_mode: switch on/off mode of hierarchical attention network (HAN) + :rtype torch.nn.Module + :return: The attention module + """ + att_list = torch.nn.ModuleList() + num_encs = getattr(args, "num_encs", 1) # use getattr to keep compatibility + aheads = getattr(args, "aheads", None) + awin = getattr(args, "awin", None) + aconv_chans = getattr(args, "aconv_chans", None) + aconv_filts = getattr(args, "aconv_filts", None) + + if num_encs == 1: + for i in range(num_att): + att = initial_att( + args.atype, + args.eprojs, + args.dunits, + aheads, + args.adim, + awin, + aconv_chans, + aconv_filts, + ) + att_list.append(att) + elif num_encs > 1: # no multi-speaker mode + if han_mode: + att = initial_att( + args.han_type, + args.eprojs, + args.dunits, + args.han_heads, + args.han_dim, + args.han_win, + args.han_conv_chans, + args.han_conv_filts, + han_mode=True, + ) + return att + else: + att_list = torch.nn.ModuleList() + for idx in range(num_encs): + att = initial_att( + args.atype[idx], + args.eprojs, + args.dunits, + aheads[idx], + args.adim[idx], + awin[idx], + aconv_chans[idx], + aconv_filts[idx], + ) + att_list.append(att) + else: + raise ValueError("Number of encoders needs to be more than one. {}".format(num_encs)) + return att_list + + +def initial_att( + atype, eprojs, dunits, aheads, adim, awin, aconv_chans, aconv_filts, han_mode=False +): + """Instantiates a single attention module + + :param str atype: attention type + :param int eprojs: # projection-units of encoder + :param int dunits: # units of decoder + :param int aheads: # heads of multi head attention + :param int adim: attention dimension + :param int awin: attention window size + :param int aconv_chans: # channels of attention convolution + :param int aconv_filts: filter size of attention convolution + :param bool han_mode: flag to swith on mode of hierarchical attention + :return: The attention module + """ + + if atype == "noatt": + att = NoAtt() + elif atype == "dot": + att = AttDot(eprojs, dunits, adim, han_mode) + elif atype == "add": + att = AttAdd(eprojs, dunits, adim, han_mode) + elif atype == "location": + att = AttLoc(eprojs, dunits, adim, aconv_chans, aconv_filts, han_mode) + elif atype == "location2d": + att = AttLoc2D(eprojs, dunits, adim, awin, aconv_chans, aconv_filts, han_mode) + elif atype == "location_recurrent": + att = AttLocRec(eprojs, dunits, adim, aconv_chans, aconv_filts, han_mode) + elif atype == "coverage": + att = AttCov(eprojs, dunits, adim, han_mode) + elif atype == "coverage_location": + att = AttCovLoc(eprojs, dunits, adim, aconv_chans, aconv_filts, han_mode) + elif atype == "multi_head_dot": + att = AttMultiHeadDot(eprojs, dunits, aheads, adim, adim, han_mode) + elif atype == "multi_head_add": + att = AttMultiHeadAdd(eprojs, dunits, aheads, adim, adim, han_mode) + elif atype == "multi_head_loc": + att = AttMultiHeadLoc( + eprojs, dunits, aheads, adim, adim, aconv_chans, aconv_filts, han_mode + ) + elif atype == "multi_head_multi_res_loc": + att = AttMultiHeadMultiResLoc( + eprojs, dunits, aheads, adim, adim, aconv_chans, aconv_filts, han_mode + ) + return att + + +def att_to_numpy(att_ws, att): + """Converts attention weights to a numpy array given the attention + + :param list att_ws: The attention weights + :param torch.nn.Module att: The attention + :rtype: np.ndarray + :return: The numpy array of the attention weights + """ + # convert to numpy array with the shape (B, Lmax, Tmax) + if isinstance(att, AttLoc2D): + # att_ws => list of previous concate attentions + att_ws = torch.stack([aw[:, -1] for aw in att_ws], dim=1).cpu().numpy() + elif isinstance(att, (AttCov, AttCovLoc)): + # att_ws => list of list of previous attentions + att_ws = torch.stack([aw[idx] for idx, aw in enumerate(att_ws)], dim=1).cpu().numpy() + elif isinstance(att, AttLocRec): + # att_ws => list of tuple of attention and hidden states + att_ws = torch.stack([aw[0] for aw in att_ws], dim=1).cpu().numpy() + elif isinstance( + att, + (AttMultiHeadDot, AttMultiHeadAdd, AttMultiHeadLoc, AttMultiHeadMultiResLoc), + ): + # att_ws => list of list of each head attention + n_heads = len(att_ws[0]) + att_ws_sorted_by_head = [] + for h in six.moves.range(n_heads): + att_ws_head = torch.stack([aw[h] for aw in att_ws], dim=1) + att_ws_sorted_by_head += [att_ws_head] + att_ws = torch.stack(att_ws_sorted_by_head, dim=1).cpu().numpy() + else: + # att_ws => list of attentions + att_ws = torch.stack(att_ws, dim=1).cpu().numpy() + return att_ws diff --git a/funasr/models/language_model/rnn/decoders.py b/funasr/models/language_model/rnn/decoders.py new file mode 100644 index 0000000..e7d35e9 --- /dev/null +++ b/funasr/models/language_model/rnn/decoders.py @@ -0,0 +1,1142 @@ +"""RNN decoder module.""" + +import logging +import math +import random +from argparse import Namespace + +import numpy as np +import six +import torch +import torch.nn.functional as F + +from funasr.models.transformer.utils.scorers.ctc_prefix_score import CTCPrefixScore +from funasr.models.transformer.utils.scorers.ctc_prefix_score import CTCPrefixScoreTH +from funasr.models.transformer.utils.scorers.scorer_interface import ScorerInterface +from funasr.metrics import end_detect +from funasr.models.transformer.utils.nets_utils import mask_by_length +from funasr.models.transformer.utils.nets_utils import pad_list +from funasr.metrics.compute_acc import th_accuracy +from funasr.models.transformer.utils.nets_utils import to_device +from funasr.models.language_model.rnn.attentions import att_to_numpy + +MAX_DECODER_OUTPUT = 5 +CTC_SCORING_RATIO = 1.5 + + +class Decoder(torch.nn.Module, ScorerInterface): + """Decoder module + + :param int eprojs: encoder projection units + :param int odim: dimension of outputs + :param str dtype: gru or lstm + :param int dlayers: decoder layers + :param int dunits: decoder units + :param int sos: start of sequence symbol id + :param int eos: end of sequence symbol id + :param torch.nn.Module att: attention module + :param int verbose: verbose level + :param list char_list: list of character strings + :param ndarray labeldist: distribution of label smoothing + :param float lsm_weight: label smoothing weight + :param float sampling_probability: scheduled sampling probability + :param float dropout: dropout rate + :param float context_residual: if True, use context vector for token generation + :param float replace_sos: use for multilingual (speech/text) translation + """ + + def __init__( + self, + eprojs, + odim, + dtype, + dlayers, + dunits, + sos, + eos, + att, + verbose=0, + char_list=None, + labeldist=None, + lsm_weight=0.0, + sampling_probability=0.0, + dropout=0.0, + context_residual=False, + replace_sos=False, + num_encs=1, + ): + + torch.nn.Module.__init__(self) + self.dtype = dtype + self.dunits = dunits + self.dlayers = dlayers + self.context_residual = context_residual + self.embed = torch.nn.Embedding(odim, dunits) + self.dropout_emb = torch.nn.Dropout(p=dropout) + + self.decoder = torch.nn.ModuleList() + self.dropout_dec = torch.nn.ModuleList() + self.decoder += [ + ( + torch.nn.LSTMCell(dunits + eprojs, dunits) + if self.dtype == "lstm" + else torch.nn.GRUCell(dunits + eprojs, dunits) + ) + ] + self.dropout_dec += [torch.nn.Dropout(p=dropout)] + for _ in six.moves.range(1, self.dlayers): + self.decoder += [ + ( + torch.nn.LSTMCell(dunits, dunits) + if self.dtype == "lstm" + else torch.nn.GRUCell(dunits, dunits) + ) + ] + self.dropout_dec += [torch.nn.Dropout(p=dropout)] + # NOTE: dropout is applied only for the vertical connections + # see https://arxiv.org/pdf/1409.2329.pdf + self.ignore_id = -1 + + if context_residual: + self.output = torch.nn.Linear(dunits + eprojs, odim) + else: + self.output = torch.nn.Linear(dunits, odim) + + self.loss = None + self.att = att + self.dunits = dunits + self.sos = sos + self.eos = eos + self.odim = odim + self.verbose = verbose + self.char_list = char_list + # for label smoothing + self.labeldist = labeldist + self.vlabeldist = None + self.lsm_weight = lsm_weight + self.sampling_probability = sampling_probability + self.dropout = dropout + self.num_encs = num_encs + + # for multilingual E2E-ST + self.replace_sos = replace_sos + + self.logzero = -10000000000.0 + + def zero_state(self, hs_pad): + return hs_pad.new_zeros(hs_pad.size(0), self.dunits) + + def rnn_forward(self, ey, z_list, c_list, z_prev, c_prev): + if self.dtype == "lstm": + z_list[0], c_list[0] = self.decoder[0](ey, (z_prev[0], c_prev[0])) + for i in six.moves.range(1, self.dlayers): + z_list[i], c_list[i] = self.decoder[i]( + self.dropout_dec[i - 1](z_list[i - 1]), (z_prev[i], c_prev[i]) + ) + else: + z_list[0] = self.decoder[0](ey, z_prev[0]) + for i in six.moves.range(1, self.dlayers): + z_list[i] = self.decoder[i](self.dropout_dec[i - 1](z_list[i - 1]), z_prev[i]) + return z_list, c_list + + def forward(self, hs_pad, hlens, ys_pad, strm_idx=0, lang_ids=None): + """Decoder forward + + :param torch.Tensor hs_pad: batch of padded hidden state sequences (B, Tmax, D) + [in multi-encoder case, + list of torch.Tensor, + [(B, Tmax_1, D), (B, Tmax_2, D), ..., ] ] + :param torch.Tensor hlens: batch of lengths of hidden state sequences (B) + [in multi-encoder case, list of torch.Tensor, + [(B), (B), ..., ] + :param torch.Tensor ys_pad: batch of padded character id sequence tensor + (B, Lmax) + :param int strm_idx: stream index indicates the index of decoding stream. + :param torch.Tensor lang_ids: batch of target language id tensor (B, 1) + :return: attention loss value + :rtype: torch.Tensor + :return: accuracy + :rtype: float + """ + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + hs_pad = [hs_pad] + hlens = [hlens] + + # TODO(kan-bayashi): need to make more smart way + ys = [y[y != self.ignore_id] for y in ys_pad] # parse padded ys + # attention index for the attention module + # in SPA (speaker parallel attention), + # att_idx is used to select attention module. In other cases, it is 0. + att_idx = min(strm_idx, len(self.att) - 1) + + # hlens should be list of list of integer + hlens = [list(map(int, hlens[idx])) for idx in range(self.num_encs)] + + self.loss = None + # prepare input and output word sequences with sos/eos IDs + eos = ys[0].new([self.eos]) + sos = ys[0].new([self.sos]) + if self.replace_sos: + ys_in = [torch.cat([idx, y], dim=0) for idx, y in zip(lang_ids, ys)] + else: + ys_in = [torch.cat([sos, y], dim=0) for y in ys] + ys_out = [torch.cat([y, eos], dim=0) for y in ys] + + # padding for ys with -1 + # pys: utt x olen + ys_in_pad = pad_list(ys_in, self.eos) + ys_out_pad = pad_list(ys_out, self.ignore_id) + + # get dim, length info + batch = ys_out_pad.size(0) + olength = ys_out_pad.size(1) + for idx in range(self.num_encs): + logging.info( + self.__class__.__name__ + + "Number of Encoder:{}; enc{}: input lengths: {}.".format( + self.num_encs, idx + 1, hlens[idx] + ) + ) + logging.info( + self.__class__.__name__ + " output lengths: " + str([y.size(0) for y in ys_out]) + ) + + # initialization + c_list = [self.zero_state(hs_pad[0])] + z_list = [self.zero_state(hs_pad[0])] + for _ in six.moves.range(1, self.dlayers): + c_list.append(self.zero_state(hs_pad[0])) + z_list.append(self.zero_state(hs_pad[0])) + z_all = [] + if self.num_encs == 1: + att_w = None + self.att[att_idx].reset() # reset pre-computation of h + else: + att_w_list = [None] * (self.num_encs + 1) # atts + han + att_c_list = [None] * (self.num_encs) # atts + for idx in range(self.num_encs + 1): + self.att[idx].reset() # reset pre-computation of h in atts and han + + # pre-computation of embedding + eys = self.dropout_emb(self.embed(ys_in_pad)) # utt x olen x zdim + + # loop for an output sequence + for i in six.moves.range(olength): + if self.num_encs == 1: + att_c, att_w = self.att[att_idx]( + hs_pad[0], hlens[0], self.dropout_dec[0](z_list[0]), att_w + ) + else: + for idx in range(self.num_encs): + att_c_list[idx], att_w_list[idx] = self.att[idx]( + hs_pad[idx], + hlens[idx], + self.dropout_dec[0](z_list[0]), + att_w_list[idx], + ) + hs_pad_han = torch.stack(att_c_list, dim=1) + hlens_han = [self.num_encs] * len(ys_in) + att_c, att_w_list[self.num_encs] = self.att[self.num_encs]( + hs_pad_han, + hlens_han, + self.dropout_dec[0](z_list[0]), + att_w_list[self.num_encs], + ) + if i > 0 and random.random() < self.sampling_probability: + logging.info(" scheduled sampling ") + z_out = self.output(z_all[-1]) + z_out = np.argmax(z_out.detach().cpu(), axis=1) + z_out = self.dropout_emb(self.embed(to_device(hs_pad[0], z_out))) + ey = torch.cat((z_out, att_c), dim=1) # utt x (zdim + hdim) + else: + ey = torch.cat((eys[:, i, :], att_c), dim=1) # utt x (zdim + hdim) + z_list, c_list = self.rnn_forward(ey, z_list, c_list, z_list, c_list) + if self.context_residual: + z_all.append( + torch.cat((self.dropout_dec[-1](z_list[-1]), att_c), dim=-1) + ) # utt x (zdim + hdim) + else: + z_all.append(self.dropout_dec[-1](z_list[-1])) # utt x (zdim) + + z_all = torch.stack(z_all, dim=1).view(batch * olength, -1) + # compute loss + y_all = self.output(z_all) + self.loss = F.cross_entropy( + y_all, + ys_out_pad.view(-1), + ignore_index=self.ignore_id, + reduction="mean", + ) + # compute perplexity + ppl = math.exp(self.loss.item()) + # -1: eos, which is removed in the loss computation + self.loss *= np.mean([len(x) for x in ys_in]) - 1 + acc = th_accuracy(y_all, ys_out_pad, ignore_label=self.ignore_id) + logging.info("att loss:" + "".join(str(self.loss.item()).split("\n"))) + + # show predicted character sequence for debug + if self.verbose > 0 and self.char_list is not None: + ys_hat = y_all.view(batch, olength, -1) + ys_true = ys_out_pad + for (i, y_hat), y_true in zip( + enumerate(ys_hat.detach().cpu().numpy()), ys_true.detach().cpu().numpy() + ): + if i == MAX_DECODER_OUTPUT: + break + idx_hat = np.argmax(y_hat[y_true != self.ignore_id], axis=1) + idx_true = y_true[y_true != self.ignore_id] + seq_hat = [self.char_list[int(idx)] for idx in idx_hat] + seq_true = [self.char_list[int(idx)] for idx in idx_true] + seq_hat = "".join(seq_hat) + seq_true = "".join(seq_true) + logging.info("groundtruth[%d]: " % i + seq_true) + logging.info("prediction [%d]: " % i + seq_hat) + + if self.labeldist is not None: + if self.vlabeldist is None: + self.vlabeldist = to_device(hs_pad[0], torch.from_numpy(self.labeldist)) + loss_reg = -torch.sum( + (F.log_softmax(y_all, dim=1) * self.vlabeldist).view(-1), dim=0 + ) / len(ys_in) + self.loss = (1.0 - self.lsm_weight) * self.loss + self.lsm_weight * loss_reg + + return self.loss, acc, ppl + + def recognize_beam(self, h, lpz, recog_args, char_list, rnnlm=None, strm_idx=0): + """beam search implementation + + :param torch.Tensor h: encoder hidden state (T, eprojs) + [in multi-encoder case, list of torch.Tensor, + [(T1, eprojs), (T2, eprojs), ...] ] + :param torch.Tensor lpz: ctc log softmax output (T, odim) + [in multi-encoder case, list of torch.Tensor, + [(T1, odim), (T2, odim), ...] ] + :param Namespace recog_args: argument Namespace containing options + :param char_list: list of character strings + :param torch.nn.Module rnnlm: language module + :param int strm_idx: + stream index for speaker parallel attention in multi-speaker case + :return: N-best decoding results + :rtype: list of dicts + """ + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + h = [h] + lpz = [lpz] + if self.num_encs > 1 and lpz is None: + lpz = [lpz] * self.num_encs + + for idx in range(self.num_encs): + logging.info( + "Number of Encoder:{}; enc{}: input lengths: {}.".format( + self.num_encs, idx + 1, h[0].size(0) + ) + ) + att_idx = min(strm_idx, len(self.att) - 1) + # initialization + c_list = [self.zero_state(h[0].unsqueeze(0))] + z_list = [self.zero_state(h[0].unsqueeze(0))] + for _ in six.moves.range(1, self.dlayers): + c_list.append(self.zero_state(h[0].unsqueeze(0))) + z_list.append(self.zero_state(h[0].unsqueeze(0))) + if self.num_encs == 1: + a = None + self.att[att_idx].reset() # reset pre-computation of h + else: + a = [None] * (self.num_encs + 1) # atts + han + att_w_list = [None] * (self.num_encs + 1) # atts + han + att_c_list = [None] * (self.num_encs) # atts + for idx in range(self.num_encs + 1): + self.att[idx].reset() # reset pre-computation of h in atts and han + + # search parms + beam = recog_args.beam_size + penalty = recog_args.penalty + ctc_weight = getattr(recog_args, "ctc_weight", False) # for NMT + + if lpz[0] is not None and self.num_encs > 1: + # weights-ctc, + # e.g. ctc_loss = w_1*ctc_1_loss + w_2 * ctc_2_loss + w_N * ctc_N_loss + weights_ctc_dec = recog_args.weights_ctc_dec / np.sum( + recog_args.weights_ctc_dec + ) # normalize + logging.info("ctc weights (decoding): " + " ".join([str(x) for x in weights_ctc_dec])) + else: + weights_ctc_dec = [1.0] + + # preprate sos + if self.replace_sos and recog_args.tgt_lang: + y = char_list.index(recog_args.tgt_lang) + else: + y = self.sos + logging.info(" index: " + str(y)) + logging.info(" mark: " + char_list[y]) + vy = h[0].new_zeros(1).long() + + maxlen = np.amin([h[idx].size(0) for idx in range(self.num_encs)]) + if recog_args.maxlenratio != 0: + # maxlen >= 1 + maxlen = max(1, int(recog_args.maxlenratio * maxlen)) + minlen = int(recog_args.minlenratio * maxlen) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # initialize hypothesis + if rnnlm: + hyp = { + "score": 0.0, + "yseq": [y], + "c_prev": c_list, + "z_prev": z_list, + "a_prev": a, + "rnnlm_prev": None, + } + else: + hyp = { + "score": 0.0, + "yseq": [y], + "c_prev": c_list, + "z_prev": z_list, + "a_prev": a, + } + if lpz[0] is not None: + ctc_prefix_score = [ + CTCPrefixScore(lpz[idx].detach().numpy(), 0, self.eos, np) + for idx in range(self.num_encs) + ] + hyp["ctc_state_prev"] = [ + ctc_prefix_score[idx].initial_state() for idx in range(self.num_encs) + ] + hyp["ctc_score_prev"] = [0.0] * self.num_encs + if ctc_weight != 1.0: + # pre-pruning based on attention scores + ctc_beam = min(lpz[0].shape[-1], int(beam * CTC_SCORING_RATIO)) + else: + ctc_beam = lpz[0].shape[-1] + hyps = [hyp] + ended_hyps = [] + + for i in six.moves.range(maxlen): + logging.debug("position " + str(i)) + + hyps_best_kept = [] + for hyp in hyps: + vy[0] = hyp["yseq"][i] + ey = self.dropout_emb(self.embed(vy)) # utt list (1) x zdim + if self.num_encs == 1: + att_c, att_w = self.att[att_idx]( + h[0].unsqueeze(0), + [h[0].size(0)], + self.dropout_dec[0](hyp["z_prev"][0]), + hyp["a_prev"], + ) + else: + for idx in range(self.num_encs): + att_c_list[idx], att_w_list[idx] = self.att[idx]( + h[idx].unsqueeze(0), + [h[idx].size(0)], + self.dropout_dec[0](hyp["z_prev"][0]), + hyp["a_prev"][idx], + ) + h_han = torch.stack(att_c_list, dim=1) + att_c, att_w_list[self.num_encs] = self.att[self.num_encs]( + h_han, + [self.num_encs], + self.dropout_dec[0](hyp["z_prev"][0]), + hyp["a_prev"][self.num_encs], + ) + ey = torch.cat((ey, att_c), dim=1) # utt(1) x (zdim + hdim) + z_list, c_list = self.rnn_forward(ey, z_list, c_list, hyp["z_prev"], hyp["c_prev"]) + + # get nbest local scores and their ids + if self.context_residual: + logits = self.output( + torch.cat((self.dropout_dec[-1](z_list[-1]), att_c), dim=-1) + ) + else: + logits = self.output(self.dropout_dec[-1](z_list[-1])) + local_att_scores = F.log_softmax(logits, dim=1) + if rnnlm: + rnnlm_state, local_lm_scores = rnnlm.predict(hyp["rnnlm_prev"], vy) + local_scores = local_att_scores + recog_args.lm_weight * local_lm_scores + else: + local_scores = local_att_scores + + if lpz[0] is not None: + local_best_scores, local_best_ids = torch.topk( + local_att_scores, ctc_beam, dim=1 + ) + ctc_scores, ctc_states = ( + [None] * self.num_encs, + [None] * self.num_encs, + ) + for idx in range(self.num_encs): + ctc_scores[idx], ctc_states[idx] = ctc_prefix_score[idx]( + hyp["yseq"], local_best_ids[0], hyp["ctc_state_prev"][idx] + ) + local_scores = (1.0 - ctc_weight) * local_att_scores[:, local_best_ids[0]] + if self.num_encs == 1: + local_scores += ctc_weight * torch.from_numpy( + ctc_scores[0] - hyp["ctc_score_prev"][0] + ) + else: + for idx in range(self.num_encs): + local_scores += ( + ctc_weight + * weights_ctc_dec[idx] + * torch.from_numpy(ctc_scores[idx] - hyp["ctc_score_prev"][idx]) + ) + if rnnlm: + local_scores += recog_args.lm_weight * local_lm_scores[:, local_best_ids[0]] + local_best_scores, joint_best_ids = torch.topk(local_scores, beam, dim=1) + local_best_ids = local_best_ids[:, joint_best_ids[0]] + else: + local_best_scores, local_best_ids = torch.topk(local_scores, beam, dim=1) + + for j in six.moves.range(beam): + new_hyp = {} + # [:] is needed! + new_hyp["z_prev"] = z_list[:] + new_hyp["c_prev"] = c_list[:] + if self.num_encs == 1: + new_hyp["a_prev"] = att_w[:] + else: + new_hyp["a_prev"] = [att_w_list[idx][:] for idx in range(self.num_encs + 1)] + new_hyp["score"] = hyp["score"] + local_best_scores[0, j] + new_hyp["yseq"] = [0] * (1 + len(hyp["yseq"])) + new_hyp["yseq"][: len(hyp["yseq"])] = hyp["yseq"] + new_hyp["yseq"][len(hyp["yseq"])] = int(local_best_ids[0, j]) + if rnnlm: + new_hyp["rnnlm_prev"] = rnnlm_state + if lpz[0] is not None: + new_hyp["ctc_state_prev"] = [ + ctc_states[idx][joint_best_ids[0, j]] for idx in range(self.num_encs) + ] + new_hyp["ctc_score_prev"] = [ + ctc_scores[idx][joint_best_ids[0, j]] for idx in range(self.num_encs) + ] + # will be (2 x beam) hyps at most + hyps_best_kept.append(new_hyp) + + hyps_best_kept = sorted(hyps_best_kept, key=lambda x: x["score"], reverse=True)[ + :beam + ] + + # sort and get nbest + hyps = hyps_best_kept + logging.debug("number of pruned hypotheses: " + str(len(hyps))) + logging.debug("best hypo: " + "".join([char_list[int(x)] for x in hyps[0]["yseq"][1:]])) + + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + for hyp in hyps: + hyp["yseq"].append(self.eos) + + # add ended hypotheses to a final list, + # and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in hyps: + if hyp["yseq"][-1] == self.eos: + # only store the sequence that has more than minlen outputs + # also add penalty + if len(hyp["yseq"]) > minlen: + hyp["score"] += (i + 1) * penalty + if rnnlm: # Word LM needs to add final score + hyp["score"] += recog_args.lm_weight * rnnlm.final(hyp["rnnlm_prev"]) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + + # end detection + if end_detect(ended_hyps, i) and recog_args.maxlenratio == 0.0: + logging.info("end detected at %d", i) + break + + hyps = remained_hyps + if len(hyps) > 0: + logging.debug("remaining hypotheses: " + str(len(hyps))) + else: + logging.info("no hypothesis. Finish decoding.") + break + + for hyp in hyps: + logging.debug("hypo: " + "".join([char_list[int(x)] for x in hyp["yseq"][1:]])) + + logging.debug("number of ended hypotheses: " + str(len(ended_hyps))) + + nbest_hyps = sorted(ended_hyps, key=lambda x: x["score"], reverse=True)[ + : min(len(ended_hyps), recog_args.nbest) + ] + + # check number of hypotheses + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, " "perform recognition again with smaller minlenratio." + ) + # should copy because Namespace will be overwritten globally + recog_args = Namespace(**vars(recog_args)) + recog_args.minlenratio = max(0.0, recog_args.minlenratio - 0.1) + if self.num_encs == 1: + return self.recognize_beam(h[0], lpz[0], recog_args, char_list, rnnlm) + else: + return self.recognize_beam(h, lpz, recog_args, char_list, rnnlm) + + logging.info("total log probability: " + str(nbest_hyps[0]["score"])) + logging.info( + "normalized log probability: " + + str(nbest_hyps[0]["score"] / len(nbest_hyps[0]["yseq"])) + ) + + # remove sos + return nbest_hyps + + def recognize_beam_batch( + self, + h, + hlens, + lpz, + recog_args, + char_list, + rnnlm=None, + normalize_score=True, + strm_idx=0, + lang_ids=None, + ): + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + h = [h] + hlens = [hlens] + lpz = [lpz] + if self.num_encs > 1 and lpz is None: + lpz = [lpz] * self.num_encs + + att_idx = min(strm_idx, len(self.att) - 1) + for idx in range(self.num_encs): + logging.info( + "Number of Encoder:{}; enc{}: input lengths: {}.".format( + self.num_encs, idx + 1, h[idx].size(1) + ) + ) + h[idx] = mask_by_length(h[idx], hlens[idx], 0.0) + + # search params + batch = len(hlens[0]) + beam = recog_args.beam_size + penalty = recog_args.penalty + ctc_weight = getattr(recog_args, "ctc_weight", 0) # for NMT + att_weight = 1.0 - ctc_weight + ctc_margin = getattr( + recog_args, "ctc_window_margin", 0 + ) # use getattr to keep compatibility + # weights-ctc, + # e.g. ctc_loss = w_1*ctc_1_loss + w_2 * ctc_2_loss + w_N * ctc_N_loss + if lpz[0] is not None and self.num_encs > 1: + weights_ctc_dec = recog_args.weights_ctc_dec / np.sum( + recog_args.weights_ctc_dec + ) # normalize + logging.info("ctc weights (decoding): " + " ".join([str(x) for x in weights_ctc_dec])) + else: + weights_ctc_dec = [1.0] + + n_bb = batch * beam + pad_b = to_device(h[0], torch.arange(batch) * beam).view(-1, 1) + + max_hlen = np.amin([max(hlens[idx]) for idx in range(self.num_encs)]) + if recog_args.maxlenratio == 0: + maxlen = max_hlen + else: + maxlen = max(1, int(recog_args.maxlenratio * max_hlen)) + minlen = int(recog_args.minlenratio * max_hlen) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # initialization + c_prev = [to_device(h[0], torch.zeros(n_bb, self.dunits)) for _ in range(self.dlayers)] + z_prev = [to_device(h[0], torch.zeros(n_bb, self.dunits)) for _ in range(self.dlayers)] + c_list = [to_device(h[0], torch.zeros(n_bb, self.dunits)) for _ in range(self.dlayers)] + z_list = [to_device(h[0], torch.zeros(n_bb, self.dunits)) for _ in range(self.dlayers)] + vscores = to_device(h[0], torch.zeros(batch, beam)) + + rnnlm_state = None + if self.num_encs == 1: + a_prev = [None] + att_w_list, ctc_scorer, ctc_state = [None], [None], [None] + self.att[att_idx].reset() # reset pre-computation of h + else: + a_prev = [None] * (self.num_encs + 1) # atts + han + att_w_list = [None] * (self.num_encs + 1) # atts + han + att_c_list = [None] * (self.num_encs) # atts + ctc_scorer, ctc_state = [None] * (self.num_encs), [None] * (self.num_encs) + for idx in range(self.num_encs + 1): + self.att[idx].reset() # reset pre-computation of h in atts and han + + if self.replace_sos and recog_args.tgt_lang: + logging.info(" index: " + str(char_list.index(recog_args.tgt_lang))) + logging.info(" mark: " + recog_args.tgt_lang) + yseq = [[char_list.index(recog_args.tgt_lang)] for _ in six.moves.range(n_bb)] + elif lang_ids is not None: + # NOTE: used for evaluation during training + yseq = [[lang_ids[b // recog_args.beam_size]] for b in six.moves.range(n_bb)] + else: + logging.info(" index: " + str(self.sos)) + logging.info(" mark: " + char_list[self.sos]) + yseq = [[self.sos] for _ in six.moves.range(n_bb)] + + accum_odim_ids = [self.sos for _ in six.moves.range(n_bb)] + stop_search = [False for _ in six.moves.range(batch)] + nbest_hyps = [[] for _ in six.moves.range(batch)] + ended_hyps = [[] for _ in range(batch)] + + exp_hlens = [ + hlens[idx].repeat(beam).view(beam, batch).transpose(0, 1).contiguous() + for idx in range(self.num_encs) + ] + exp_hlens = [exp_hlens[idx].view(-1).tolist() for idx in range(self.num_encs)] + exp_h = [ + h[idx].unsqueeze(1).repeat(1, beam, 1, 1).contiguous() for idx in range(self.num_encs) + ] + exp_h = [ + exp_h[idx].view(n_bb, h[idx].size()[1], h[idx].size()[2]) + for idx in range(self.num_encs) + ] + + if lpz[0] is not None: + scoring_num = min( + int(beam * CTC_SCORING_RATIO) if att_weight > 0.0 and not lpz[0].is_cuda else 0, + lpz[0].size(-1), + ) + ctc_scorer = [ + CTCPrefixScoreTH( + lpz[idx], + hlens[idx], + 0, + self.eos, + margin=ctc_margin, + ) + for idx in range(self.num_encs) + ] + + for i in six.moves.range(maxlen): + logging.debug("position " + str(i)) + + vy = to_device(h[0], torch.LongTensor(self._get_last_yseq(yseq))) + ey = self.dropout_emb(self.embed(vy)) + if self.num_encs == 1: + att_c, att_w = self.att[att_idx]( + exp_h[0], exp_hlens[0], self.dropout_dec[0](z_prev[0]), a_prev[0] + ) + att_w_list = [att_w] + else: + for idx in range(self.num_encs): + att_c_list[idx], att_w_list[idx] = self.att[idx]( + exp_h[idx], + exp_hlens[idx], + self.dropout_dec[0](z_prev[0]), + a_prev[idx], + ) + exp_h_han = torch.stack(att_c_list, dim=1) + att_c, att_w_list[self.num_encs] = self.att[self.num_encs]( + exp_h_han, + [self.num_encs] * n_bb, + self.dropout_dec[0](z_prev[0]), + a_prev[self.num_encs], + ) + ey = torch.cat((ey, att_c), dim=1) + + # attention decoder + z_list, c_list = self.rnn_forward(ey, z_list, c_list, z_prev, c_prev) + if self.context_residual: + logits = self.output(torch.cat((self.dropout_dec[-1](z_list[-1]), att_c), dim=-1)) + else: + logits = self.output(self.dropout_dec[-1](z_list[-1])) + local_scores = att_weight * F.log_softmax(logits, dim=1) + + # rnnlm + if rnnlm: + rnnlm_state, local_lm_scores = rnnlm.buff_predict(rnnlm_state, vy, n_bb) + local_scores = local_scores + recog_args.lm_weight * local_lm_scores + + # ctc + if ctc_scorer[0]: + local_scores[:, 0] = self.logzero # avoid choosing blank + part_ids = ( + torch.topk(local_scores, scoring_num, dim=-1)[1] if scoring_num > 0 else None + ) + for idx in range(self.num_encs): + att_w = att_w_list[idx] + att_w_ = att_w if isinstance(att_w, torch.Tensor) else att_w[0] + local_ctc_scores, ctc_state[idx] = ctc_scorer[idx]( + yseq, ctc_state[idx], part_ids, att_w_ + ) + local_scores = ( + local_scores + ctc_weight * weights_ctc_dec[idx] * local_ctc_scores + ) + + local_scores = local_scores.view(batch, beam, self.odim) + if i == 0: + local_scores[:, 1:, :] = self.logzero + + # accumulate scores + eos_vscores = local_scores[:, :, self.eos] + vscores + vscores = vscores.view(batch, beam, 1).repeat(1, 1, self.odim) + vscores[:, :, self.eos] = self.logzero + vscores = (vscores + local_scores).view(batch, -1) + + # global pruning + accum_best_scores, accum_best_ids = torch.topk(vscores, beam, 1) + accum_odim_ids = torch.fmod(accum_best_ids, self.odim).view(-1).data.cpu().tolist() + accum_padded_beam_ids = ( + (accum_best_ids // self.odim + pad_b).view(-1).data.cpu().tolist() + ) + + y_prev = yseq[:][:] + yseq = self._index_select_list(yseq, accum_padded_beam_ids) + yseq = self._append_ids(yseq, accum_odim_ids) + vscores = accum_best_scores + vidx = to_device(h[0], torch.LongTensor(accum_padded_beam_ids)) + + a_prev = [] + num_atts = self.num_encs if self.num_encs == 1 else self.num_encs + 1 + for idx in range(num_atts): + if isinstance(att_w_list[idx], torch.Tensor): + _a_prev = torch.index_select( + att_w_list[idx].view(n_bb, *att_w_list[idx].shape[1:]), 0, vidx + ) + elif isinstance(att_w_list[idx], list): + # handle the case of multi-head attention + _a_prev = [ + torch.index_select(att_w_one.view(n_bb, -1), 0, vidx) + for att_w_one in att_w_list[idx] + ] + else: + # handle the case of location_recurrent when return is a tuple + _a_prev_ = torch.index_select(att_w_list[idx][0].view(n_bb, -1), 0, vidx) + _h_prev_ = torch.index_select(att_w_list[idx][1][0].view(n_bb, -1), 0, vidx) + _c_prev_ = torch.index_select(att_w_list[idx][1][1].view(n_bb, -1), 0, vidx) + _a_prev = (_a_prev_, (_h_prev_, _c_prev_)) + a_prev.append(_a_prev) + z_prev = [ + torch.index_select(z_list[li].view(n_bb, -1), 0, vidx) for li in range(self.dlayers) + ] + c_prev = [ + torch.index_select(c_list[li].view(n_bb, -1), 0, vidx) for li in range(self.dlayers) + ] + + # pick ended hyps + if i >= minlen: + k = 0 + penalty_i = (i + 1) * penalty + thr = accum_best_scores[:, -1] + for samp_i in six.moves.range(batch): + if stop_search[samp_i]: + k = k + beam + continue + for beam_j in six.moves.range(beam): + _vscore = None + if eos_vscores[samp_i, beam_j] > thr[samp_i]: + yk = y_prev[k][:] + if len(yk) <= min(hlens[idx][samp_i] for idx in range(self.num_encs)): + _vscore = eos_vscores[samp_i][beam_j] + penalty_i + elif i == maxlen - 1: + yk = yseq[k][:] + _vscore = vscores[samp_i][beam_j] + penalty_i + if _vscore: + yk.append(self.eos) + if rnnlm: + _vscore += recog_args.lm_weight * rnnlm.final(rnnlm_state, index=k) + _score = _vscore.data.cpu().numpy() + ended_hyps[samp_i].append( + {"yseq": yk, "vscore": _vscore, "score": _score} + ) + k = k + 1 + + # end detection + stop_search = [ + stop_search[samp_i] or end_detect(ended_hyps[samp_i], i) + for samp_i in six.moves.range(batch) + ] + stop_search_summary = list(set(stop_search)) + if len(stop_search_summary) == 1 and stop_search_summary[0]: + break + + if rnnlm: + rnnlm_state = self._index_select_lm_state(rnnlm_state, 0, vidx) + if ctc_scorer[0]: + for idx in range(self.num_encs): + ctc_state[idx] = ctc_scorer[idx].index_select_state( + ctc_state[idx], accum_best_ids + ) + + torch.cuda.empty_cache() + + dummy_hyps = [{"yseq": [self.sos, self.eos], "score": np.array([-float("inf")])}] + ended_hyps = [ + ended_hyps[samp_i] if len(ended_hyps[samp_i]) != 0 else dummy_hyps + for samp_i in six.moves.range(batch) + ] + if normalize_score: + for samp_i in six.moves.range(batch): + for x in ended_hyps[samp_i]: + x["score"] /= len(x["yseq"]) + + nbest_hyps = [ + sorted(ended_hyps[samp_i], key=lambda x: x["score"], reverse=True)[ + : min(len(ended_hyps[samp_i]), recog_args.nbest) + ] + for samp_i in six.moves.range(batch) + ] + + return nbest_hyps + + def calculate_all_attentions(self, hs_pad, hlen, ys_pad, strm_idx=0, lang_ids=None): + """Calculate all of attentions + + :param torch.Tensor hs_pad: batch of padded hidden state sequences + (B, Tmax, D) + in multi-encoder case, list of torch.Tensor, + [(B, Tmax_1, D), (B, Tmax_2, D), ..., ] ] + :param torch.Tensor hlen: batch of lengths of hidden state sequences (B) + [in multi-encoder case, list of torch.Tensor, + [(B), (B), ..., ] + :param torch.Tensor ys_pad: + batch of padded character id sequence tensor (B, Lmax) + :param int strm_idx: + stream index for parallel speaker attention in multi-speaker case + :param torch.Tensor lang_ids: batch of target language id tensor (B, 1) + :return: attention weights with the following shape, + 1) multi-head case => attention weights (B, H, Lmax, Tmax), + 2) multi-encoder case => + [(B, Lmax, Tmax1), (B, Lmax, Tmax2), ..., (B, Lmax, NumEncs)] + 3) other case => attention weights (B, Lmax, Tmax). + :rtype: float ndarray + """ + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + hs_pad = [hs_pad] + hlen = [hlen] + + # TODO(kan-bayashi): need to make more smart way + ys = [y[y != self.ignore_id] for y in ys_pad] # parse padded ys + att_idx = min(strm_idx, len(self.att) - 1) + + # hlen should be list of list of integer + hlen = [list(map(int, hlen[idx])) for idx in range(self.num_encs)] + + self.loss = None + # prepare input and output word sequences with sos/eos IDs + eos = ys[0].new([self.eos]) + sos = ys[0].new([self.sos]) + if self.replace_sos: + ys_in = [torch.cat([idx, y], dim=0) for idx, y in zip(lang_ids, ys)] + else: + ys_in = [torch.cat([sos, y], dim=0) for y in ys] + ys_out = [torch.cat([y, eos], dim=0) for y in ys] + + # padding for ys with -1 + # pys: utt x olen + ys_in_pad = pad_list(ys_in, self.eos) + ys_out_pad = pad_list(ys_out, self.ignore_id) + + # get length info + olength = ys_out_pad.size(1) + + # initialization + c_list = [self.zero_state(hs_pad[0])] + z_list = [self.zero_state(hs_pad[0])] + for _ in six.moves.range(1, self.dlayers): + c_list.append(self.zero_state(hs_pad[0])) + z_list.append(self.zero_state(hs_pad[0])) + att_ws = [] + if self.num_encs == 1: + att_w = None + self.att[att_idx].reset() # reset pre-computation of h + else: + att_w_list = [None] * (self.num_encs + 1) # atts + han + att_c_list = [None] * (self.num_encs) # atts + for idx in range(self.num_encs + 1): + self.att[idx].reset() # reset pre-computation of h in atts and han + + # pre-computation of embedding + eys = self.dropout_emb(self.embed(ys_in_pad)) # utt x olen x zdim + + # loop for an output sequence + for i in six.moves.range(olength): + if self.num_encs == 1: + att_c, att_w = self.att[att_idx]( + hs_pad[0], hlen[0], self.dropout_dec[0](z_list[0]), att_w + ) + att_ws.append(att_w) + else: + for idx in range(self.num_encs): + att_c_list[idx], att_w_list[idx] = self.att[idx]( + hs_pad[idx], + hlen[idx], + self.dropout_dec[0](z_list[0]), + att_w_list[idx], + ) + hs_pad_han = torch.stack(att_c_list, dim=1) + hlen_han = [self.num_encs] * len(ys_in) + att_c, att_w_list[self.num_encs] = self.att[self.num_encs]( + hs_pad_han, + hlen_han, + self.dropout_dec[0](z_list[0]), + att_w_list[self.num_encs], + ) + att_ws.append(att_w_list.copy()) + ey = torch.cat((eys[:, i, :], att_c), dim=1) # utt x (zdim + hdim) + z_list, c_list = self.rnn_forward(ey, z_list, c_list, z_list, c_list) + + if self.num_encs == 1: + # convert to numpy array with the shape (B, Lmax, Tmax) + att_ws = att_to_numpy(att_ws, self.att[att_idx]) + else: + _att_ws = [] + for idx, ws in enumerate(zip(*att_ws)): + ws = att_to_numpy(ws, self.att[idx]) + _att_ws.append(ws) + att_ws = _att_ws + return att_ws + + @staticmethod + def _get_last_yseq(exp_yseq): + last = [] + for y_seq in exp_yseq: + last.append(y_seq[-1]) + return last + + @staticmethod + def _append_ids(yseq, ids): + if isinstance(ids, list): + for i, j in enumerate(ids): + yseq[i].append(j) + else: + for i in range(len(yseq)): + yseq[i].append(ids) + return yseq + + @staticmethod + def _index_select_list(yseq, lst): + new_yseq = [] + for i in lst: + new_yseq.append(yseq[i][:]) + return new_yseq + + @staticmethod + def _index_select_lm_state(rnnlm_state, dim, vidx): + if isinstance(rnnlm_state, dict): + new_state = {} + for k, v in rnnlm_state.items(): + new_state[k] = [torch.index_select(vi, dim, vidx) for vi in v] + elif isinstance(rnnlm_state, list): + new_state = [] + for i in vidx: + new_state.append(rnnlm_state[int(i)][:]) + return new_state + + # scorer interface methods + def init_state(self, x): + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + x = [x] + + c_list = [self.zero_state(x[0].unsqueeze(0))] + z_list = [self.zero_state(x[0].unsqueeze(0))] + for _ in six.moves.range(1, self.dlayers): + c_list.append(self.zero_state(x[0].unsqueeze(0))) + z_list.append(self.zero_state(x[0].unsqueeze(0))) + # TODO(karita): support strm_index for `asr_mix` + strm_index = 0 + att_idx = min(strm_index, len(self.att) - 1) + if self.num_encs == 1: + a = None + self.att[att_idx].reset() # reset pre-computation of h + else: + a = [None] * (self.num_encs + 1) # atts + han + for idx in range(self.num_encs + 1): + self.att[idx].reset() # reset pre-computation of h in atts and han + return dict( + c_prev=c_list[:], + z_prev=z_list[:], + a_prev=a, + workspace=(att_idx, z_list, c_list), + ) + + def score(self, yseq, state, x): + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + x = [x] + + att_idx, z_list, c_list = state["workspace"] + vy = yseq[-1].unsqueeze(0) + ey = self.dropout_emb(self.embed(vy)) # utt list (1) x zdim + if self.num_encs == 1: + att_c, att_w = self.att[att_idx]( + x[0].unsqueeze(0), + [x[0].size(0)], + self.dropout_dec[0](state["z_prev"][0]), + state["a_prev"], + ) + else: + att_w = [None] * (self.num_encs + 1) # atts + han + att_c_list = [None] * (self.num_encs) # atts + for idx in range(self.num_encs): + att_c_list[idx], att_w[idx] = self.att[idx]( + x[idx].unsqueeze(0), + [x[idx].size(0)], + self.dropout_dec[0](state["z_prev"][0]), + state["a_prev"][idx], + ) + h_han = torch.stack(att_c_list, dim=1) + att_c, att_w[self.num_encs] = self.att[self.num_encs]( + h_han, + [self.num_encs], + self.dropout_dec[0](state["z_prev"][0]), + state["a_prev"][self.num_encs], + ) + ey = torch.cat((ey, att_c), dim=1) # utt(1) x (zdim + hdim) + z_list, c_list = self.rnn_forward(ey, z_list, c_list, state["z_prev"], state["c_prev"]) + if self.context_residual: + logits = self.output(torch.cat((self.dropout_dec[-1](z_list[-1]), att_c), dim=-1)) + else: + logits = self.output(self.dropout_dec[-1](z_list[-1])) + logp = F.log_softmax(logits, dim=1).squeeze(0) + return ( + logp, + dict( + c_prev=c_list[:], + z_prev=z_list[:], + a_prev=att_w, + workspace=(att_idx, z_list, c_list), + ), + ) + + +def decoder_for(args, odim, sos, eos, att, labeldist): + return Decoder( + args.eprojs, + odim, + args.dtype, + args.dlayers, + args.dunits, + sos, + eos, + att, + args.verbose, + args.char_list, + labeldist, + args.lsm_weight, + args.sampling_probability, + args.dropout_rate_decoder, + getattr(args, "context_residual", False), # use getattr to keep compatibility + getattr(args, "replace_sos", False), # use getattr to keep compatibility + getattr(args, "num_encs", 1), + ) # use getattr to keep compatibility diff --git a/funasr/models/language_model/rnn/encoders.py b/funasr/models/language_model/rnn/encoders.py new file mode 100644 index 0000000..fff3766 --- /dev/null +++ b/funasr/models/language_model/rnn/encoders.py @@ -0,0 +1,360 @@ +import logging + +import numpy as np +import six +import torch +import torch.nn.functional as F +from torch.nn.utils.rnn import pack_padded_sequence +from torch.nn.utils.rnn import pad_packed_sequence + +from funasr.metrics.common import get_vgg2l_odim +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.utils.nets_utils import to_device + + +class RNNP(torch.nn.Module): + """RNN with projection layer module + + :param int idim: dimension of inputs + :param int elayers: number of encoder layers + :param int cdim: number of rnn units (resulted in cdim * 2 if bidirectional) + :param int hdim: number of projection units + :param np.ndarray subsample: list of subsampling numbers + :param float dropout: dropout rate + :param str typ: The RNN type + """ + + def __init__(self, idim, elayers, cdim, hdim, subsample, dropout, typ="blstm"): + super(RNNP, self).__init__() + bidir = typ[0] == "b" + for i in six.moves.range(elayers): + if i == 0: + inputdim = idim + else: + inputdim = hdim + + RNN = torch.nn.LSTM if "lstm" in typ else torch.nn.GRU + rnn = RNN(inputdim, cdim, num_layers=1, bidirectional=bidir, batch_first=True) + + setattr(self, "%s%d" % ("birnn" if bidir else "rnn", i), rnn) + + # bottleneck layer to merge + if bidir: + setattr(self, "bt%d" % i, torch.nn.Linear(2 * cdim, hdim)) + else: + setattr(self, "bt%d" % i, torch.nn.Linear(cdim, hdim)) + + self.elayers = elayers + self.cdim = cdim + self.subsample = subsample + self.typ = typ + self.bidir = bidir + self.dropout = dropout + + def forward(self, xs_pad, ilens, prev_state=None): + """RNNP forward + + :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim) + :param torch.Tensor ilens: batch of lengths of input sequences (B) + :param torch.Tensor prev_state: batch of previous RNN states + :return: batch of hidden state sequences (B, Tmax, hdim) + :rtype: torch.Tensor + """ + logging.debug(self.__class__.__name__ + " input lengths: " + str(ilens)) + elayer_states = [] + for layer in six.moves.range(self.elayers): + if not isinstance(ilens, torch.Tensor): + ilens = torch.tensor(ilens) + xs_pack = pack_padded_sequence(xs_pad, ilens.cpu(), batch_first=True) + rnn = getattr(self, ("birnn" if self.bidir else "rnn") + str(layer)) + rnn.flatten_parameters() + if prev_state is not None and rnn.bidirectional: + prev_state = reset_backward_rnn_state(prev_state) + ys, states = rnn(xs_pack, hx=None if prev_state is None else prev_state[layer]) + elayer_states.append(states) + # ys: utt list of frame x cdim x 2 (2: means bidirectional) + ys_pad, ilens = pad_packed_sequence(ys, batch_first=True) + sub = self.subsample[layer + 1] + if sub > 1: + ys_pad = ys_pad[:, ::sub] + ilens = torch.tensor([int(i + 1) // sub for i in ilens]) + # (sum _utt frame_utt) x dim + projection_layer = getattr(self, "bt%d" % layer) + projected = projection_layer(ys_pad.contiguous().view(-1, ys_pad.size(2))) + xs_pad = projected.view(ys_pad.size(0), ys_pad.size(1), -1) + if layer < self.elayers - 1: + xs_pad = torch.tanh(F.dropout(xs_pad, p=self.dropout)) + + return xs_pad, ilens, elayer_states # x: utt list of frame x dim + + +class RNN(torch.nn.Module): + """RNN module + + :param int idim: dimension of inputs + :param int elayers: number of encoder layers + :param int cdim: number of rnn units (resulted in cdim * 2 if bidirectional) + :param int hdim: number of final projection units + :param float dropout: dropout rate + :param str typ: The RNN type + """ + + def __init__(self, idim, elayers, cdim, hdim, dropout, typ="blstm"): + super(RNN, self).__init__() + bidir = typ[0] == "b" + self.nbrnn = ( + torch.nn.LSTM( + idim, + cdim, + elayers, + batch_first=True, + dropout=dropout, + bidirectional=bidir, + ) + if "lstm" in typ + else torch.nn.GRU( + idim, + cdim, + elayers, + batch_first=True, + dropout=dropout, + bidirectional=bidir, + ) + ) + if bidir: + self.l_last = torch.nn.Linear(cdim * 2, hdim) + else: + self.l_last = torch.nn.Linear(cdim, hdim) + self.typ = typ + + def forward(self, xs_pad, ilens, prev_state=None): + """RNN forward + + :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, D) + :param torch.Tensor ilens: batch of lengths of input sequences (B) + :param torch.Tensor prev_state: batch of previous RNN states + :return: batch of hidden state sequences (B, Tmax, eprojs) + :rtype: torch.Tensor + """ + logging.debug(self.__class__.__name__ + " input lengths: " + str(ilens)) + if not isinstance(ilens, torch.Tensor): + ilens = torch.tensor(ilens) + xs_pack = pack_padded_sequence(xs_pad, ilens.cpu(), batch_first=True) + self.nbrnn.flatten_parameters() + if prev_state is not None and self.nbrnn.bidirectional: + # We assume that when previous state is passed, + # it means that we're streaming the input + # and therefore cannot propagate backward BRNN state + # (otherwise it goes in the wrong direction) + prev_state = reset_backward_rnn_state(prev_state) + ys, states = self.nbrnn(xs_pack, hx=prev_state) + # ys: utt list of frame x cdim x 2 (2: means bidirectional) + ys_pad, ilens = pad_packed_sequence(ys, batch_first=True) + # (sum _utt frame_utt) x dim + projected = torch.tanh(self.l_last(ys_pad.contiguous().view(-1, ys_pad.size(2)))) + xs_pad = projected.view(ys_pad.size(0), ys_pad.size(1), -1) + return xs_pad, ilens, states # x: utt list of frame x dim + + +def reset_backward_rnn_state(states): + """Sets backward BRNN states to zeroes + + Useful in processing of sliding windows over the inputs + """ + if isinstance(states, (list, tuple)): + for state in states: + state[1::2] = 0.0 + else: + states[1::2] = 0.0 + return states + + +class VGG2L(torch.nn.Module): + """VGG-like module + + :param int in_channel: number of input channels + """ + + def __init__(self, in_channel=1): + super(VGG2L, self).__init__() + # CNN layer (VGG motivated) + self.conv1_1 = torch.nn.Conv2d(in_channel, 64, 3, stride=1, padding=1) + self.conv1_2 = torch.nn.Conv2d(64, 64, 3, stride=1, padding=1) + self.conv2_1 = torch.nn.Conv2d(64, 128, 3, stride=1, padding=1) + self.conv2_2 = torch.nn.Conv2d(128, 128, 3, stride=1, padding=1) + + self.in_channel = in_channel + + def forward(self, xs_pad, ilens, **kwargs): + """VGG2L forward + + :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, D) + :param torch.Tensor ilens: batch of lengths of input sequences (B) + :return: batch of padded hidden state sequences (B, Tmax // 4, 128 * D // 4) + :rtype: torch.Tensor + """ + logging.debug(self.__class__.__name__ + " input lengths: " + str(ilens)) + + # x: utt x frame x dim + # xs_pad = F.pad_sequence(xs_pad) + + # x: utt x 1 (input channel num) x frame x dim + xs_pad = xs_pad.view( + xs_pad.size(0), + xs_pad.size(1), + self.in_channel, + xs_pad.size(2) // self.in_channel, + ).transpose(1, 2) + + # NOTE: max_pool1d ? + xs_pad = F.relu(self.conv1_1(xs_pad)) + xs_pad = F.relu(self.conv1_2(xs_pad)) + xs_pad = F.max_pool2d(xs_pad, 2, stride=2, ceil_mode=True) + + xs_pad = F.relu(self.conv2_1(xs_pad)) + xs_pad = F.relu(self.conv2_2(xs_pad)) + xs_pad = F.max_pool2d(xs_pad, 2, stride=2, ceil_mode=True) + if torch.is_tensor(ilens): + ilens = ilens.cpu().numpy() + else: + ilens = np.array(ilens, dtype=np.float32) + ilens = np.array(np.ceil(ilens / 2), dtype=np.int64) + ilens = np.array(np.ceil(np.array(ilens, dtype=np.float32) / 2), dtype=np.int64).tolist() + + # x: utt_list of frame (remove zeropaded frames) x (input channel num x dim) + xs_pad = xs_pad.transpose(1, 2) + xs_pad = xs_pad.contiguous().view( + xs_pad.size(0), xs_pad.size(1), xs_pad.size(2) * xs_pad.size(3) + ) + return xs_pad, ilens, None # no state in this layer + + +class Encoder(torch.nn.Module): + """Encoder module + + :param str etype: type of encoder network + :param int idim: number of dimensions of encoder network + :param int elayers: number of layers of encoder network + :param int eunits: number of lstm units of encoder network + :param int eprojs: number of projection units of encoder network + :param np.ndarray subsample: list of subsampling numbers + :param float dropout: dropout rate + :param int in_channel: number of input channels + """ + + def __init__(self, etype, idim, elayers, eunits, eprojs, subsample, dropout, in_channel=1): + super(Encoder, self).__init__() + typ = etype.lstrip("vgg").rstrip("p") + if typ not in ["lstm", "gru", "blstm", "bgru"]: + logging.error("Error: need to specify an appropriate encoder architecture") + + if etype.startswith("vgg"): + if etype[-1] == "p": + self.enc = torch.nn.ModuleList( + [ + VGG2L(in_channel), + RNNP( + get_vgg2l_odim(idim, in_channel=in_channel), + elayers, + eunits, + eprojs, + subsample, + dropout, + typ=typ, + ), + ] + ) + logging.info("Use CNN-VGG + " + typ.upper() + "P for encoder") + else: + self.enc = torch.nn.ModuleList( + [ + VGG2L(in_channel), + RNN( + get_vgg2l_odim(idim, in_channel=in_channel), + elayers, + eunits, + eprojs, + dropout, + typ=typ, + ), + ] + ) + logging.info("Use CNN-VGG + " + typ.upper() + " for encoder") + self.conv_subsampling_factor = 4 + else: + if etype[-1] == "p": + self.enc = torch.nn.ModuleList( + [RNNP(idim, elayers, eunits, eprojs, subsample, dropout, typ=typ)] + ) + logging.info(typ.upper() + " with every-layer projection for encoder") + else: + self.enc = torch.nn.ModuleList( + [RNN(idim, elayers, eunits, eprojs, dropout, typ=typ)] + ) + logging.info(typ.upper() + " without projection for encoder") + self.conv_subsampling_factor = 1 + + def forward(self, xs_pad, ilens, prev_states=None): + """Encoder forward + + :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, D) + :param torch.Tensor ilens: batch of lengths of input sequences (B) + :param torch.Tensor prev_state: batch of previous encoder hidden states (?, ...) + :return: batch of hidden state sequences (B, Tmax, eprojs) + :rtype: torch.Tensor + """ + if prev_states is None: + prev_states = [None] * len(self.enc) + assert len(prev_states) == len(self.enc) + + current_states = [] + for module, prev_state in zip(self.enc, prev_states): + xs_pad, ilens, states = module(xs_pad, ilens, prev_state=prev_state) + current_states.append(states) + + # make mask to remove bias value in padded part + mask = to_device(xs_pad, make_pad_mask(ilens).unsqueeze(-1)) + + return xs_pad.masked_fill(mask, 0.0), ilens, current_states + + +def encoder_for(args, idim, subsample): + """Instantiates an encoder module given the program arguments + + :param Namespace args: The arguments + :param int or List of integer idim: dimension of input, e.g. 83, or + List of dimensions of inputs, e.g. [83,83] + :param List or List of List subsample: subsample factors, e.g. [1,2,2,1,1], or + List of subsample factors of each encoder. + e.g. [[1,2,2,1,1], [1,2,2,1,1]] + :rtype torch.nn.Module + :return: The encoder module + """ + num_encs = getattr(args, "num_encs", 1) # use getattr to keep compatibility + if num_encs == 1: + # compatible with single encoder asr mode + return Encoder( + args.etype, + idim, + args.elayers, + args.eunits, + args.eprojs, + subsample, + args.dropout_rate, + ) + elif num_encs >= 1: + enc_list = torch.nn.ModuleList() + for idx in range(num_encs): + enc = Encoder( + args.etype[idx], + idim[idx], + args.elayers[idx], + args.eunits[idx], + args.eprojs, + subsample[idx], + args.dropout_rate[idx], + ) + enc_list.append(enc) + return enc_list + else: + raise ValueError("Number of encoders needs to be more than one. {}".format(num_encs)) diff --git a/funasr/models/language_model/seq_rnn_lm.py b/funasr/models/language_model/seq_rnn_lm.py new file mode 100644 index 0000000..baf63bc --- /dev/null +++ b/funasr/models/language_model/seq_rnn_lm.py @@ -0,0 +1,168 @@ +"""Sequential implementation of Recurrent Neural Network Language Model.""" + +from typing import Tuple +from typing import Union + +import torch +import torch.nn as nn +from funasr.train.abs_model import AbsLM + + +class SequentialRNNLM(AbsLM): + """Sequential RNNLM. + + See also: + https://github.com/pytorch/examples/blob/4581968193699de14b56527296262dd76ab43557/word_language_model/model.py + + """ + + def __init__( + self, + vocab_size: int, + unit: int = 650, + nhid: int = None, + nlayers: int = 2, + dropout_rate: float = 0.0, + tie_weights: bool = False, + rnn_type: str = "lstm", + ignore_id: int = 0, + ): + super().__init__() + + ninp = unit + if nhid is None: + nhid = unit + rnn_type = rnn_type.upper() + + self.drop = nn.Dropout(dropout_rate) + self.encoder = nn.Embedding(vocab_size, ninp, padding_idx=ignore_id) + if rnn_type in ["LSTM", "GRU"]: + rnn_class = getattr(nn, rnn_type) + self.rnn = rnn_class(ninp, nhid, nlayers, dropout=dropout_rate, batch_first=True) + else: + try: + nonlinearity = {"RNN_TANH": "tanh", "RNN_RELU": "relu"}[rnn_type] + except KeyError: + raise ValueError( + """An invalid option for `--model` was supplied, + options are ['LSTM', 'GRU', 'RNN_TANH' or 'RNN_RELU']""" + ) + self.rnn = nn.RNN( + ninp, + nhid, + nlayers, + nonlinearity=nonlinearity, + dropout=dropout_rate, + batch_first=True, + ) + self.decoder = nn.Linear(nhid, vocab_size) + + # Optionally tie weights as in: + # "Using the Output Embedding to Improve Language Models" + # (Press & Wolf 2016) https://arxiv.org/abs/1608.05859 + # and + # "Tying Word Vectors and Word Classifiers: + # A Loss Framework for Language Modeling" (Inan et al. 2016) + # https://arxiv.org/abs/1611.01462 + if tie_weights: + if nhid != ninp: + raise ValueError("When using the tied flag, nhid must be equal to emsize") + self.decoder.weight = self.encoder.weight + + self.rnn_type = rnn_type + self.nhid = nhid + self.nlayers = nlayers + + def zero_state(self): + """Initialize LM state filled with zero values.""" + if isinstance(self.rnn, torch.nn.LSTM): + h = torch.zeros((self.nlayers, self.nhid), dtype=torch.float) + c = torch.zeros((self.nlayers, self.nhid), dtype=torch.float) + state = h, c + else: + state = torch.zeros((self.nlayers, self.nhid), dtype=torch.float) + + return state + + def forward( + self, input: torch.Tensor, hidden: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + emb = self.drop(self.encoder(input)) + output, hidden = self.rnn(emb, hidden) + output = self.drop(output) + decoded = self.decoder( + output.contiguous().view(output.size(0) * output.size(1), output.size(2)) + ) + return ( + decoded.view(output.size(0), output.size(1), decoded.size(1)), + hidden, + ) + + def score( + self, + y: torch.Tensor, + state: Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]], + x: torch.Tensor, + ) -> Tuple[torch.Tensor, Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]]: + """Score new token. + + Args: + y: 1D torch.int64 prefix tokens. + state: Scorer state for prefix tokens + x: 2D encoder feature that generates ys. + + Returns: + Tuple of + torch.float32 scores for next token (n_vocab) + and next state for ys + + """ + y, new_state = self(y[-1].view(1, 1), state) + logp = y.log_softmax(dim=-1).view(-1) + return logp, new_state + + def batch_score( + self, ys: torch.Tensor, states: torch.Tensor, xs: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, n_vocab)` + and next state list for ys. + + """ + if states[0] is None: + states = None + elif isinstance(self.rnn, torch.nn.LSTM): + # states: Batch x 2 x (Nlayers, Dim) -> 2 x (Nlayers, Batch, Dim) + h = torch.stack([h for h, c in states], dim=1) + c = torch.stack([c for h, c in states], dim=1) + states = h, c + else: + # states: Batch x (Nlayers, Dim) -> (Nlayers, Batch, Dim) + states = torch.stack(states, dim=1) + + ys, states = self(ys[:, -1:], states) + # ys: (Batch, 1, Nvocab) -> (Batch, NVocab) + assert ys.size(1) == 1, ys.shape + ys = ys.squeeze(1) + logp = ys.log_softmax(dim=-1) + + # state: Change to batch first + if isinstance(self.rnn, torch.nn.LSTM): + # h, c: (Nlayers, Batch, Dim) + h, c = states + # states: Batch x 2 x (Nlayers, Dim) + states = [(h[:, i], c[:, i]) for i in range(h.size(1))] + else: + # states: (Nlayers, Batch, Dim) -> Batch x (Nlayers, Dim) + states = [states[:, i] for i in range(states.size(1))] + + return logp, states diff --git a/funasr/models/language_model/transformer_encoder.py b/funasr/models/language_model/transformer_encoder.py new file mode 100644 index 0000000..7c22550 --- /dev/null +++ b/funasr/models/language_model/transformer_encoder.py @@ -0,0 +1,459 @@ +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Transformer encoder definition.""" + +from typing import List +from typing import Optional +from typing import Tuple + +import torch +from torch import nn +import logging + +from funasr.models.transformer.attention import MultiHeadedAttention +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.dynamic_conv import DynamicConvolution +from funasr.models.transformer.utils.dynamic_conv2d import DynamicConvolution2D +from funasr.models.transformer.utils.lightconv import LightweightConvolution +from funasr.models.transformer.utils.lightconv2d import LightweightConvolution2D +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling2 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling6 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling8 +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.utils.subsampling import check_short_utt + + +class EncoderLayer(nn.Module): + """Encoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` instance + can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + stochastic_depth_rate (float): Proability to skip this layer. + During training, the layer may skip residual computation and return input + as-is with given probability. + """ + + def __init__( + self, + size, + self_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayer, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + self.norm2 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + + def forward(self, x, mask, cache=None): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + return x, mask + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if cache is None: + x_q = x + else: + assert cache.shape == (x.shape[0], x.shape[1] - 1, self.size) + x_q = x[:, -1:, :] + residual = residual[:, -1:, :] + mask = None if mask is None else mask[:, -1:, :] + + if self.concat_after: + x_concat = torch.cat((x, self.self_attn(x_q, x, x, mask)), dim=-1) + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = residual + stoch_layer_coeff * self.dropout(self.self_attn(x_q, x, x, mask)) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + stoch_layer_coeff * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm2(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + return x, mask + + +class TransformerEncoder_lm(nn.Module): + """Transformer encoder module. + + Args: + idim (int): Input dimension. + attention_dim (int): Dimension of attention. + attention_heads (int): The number of heads of multi head attention. + conv_wshare (int): The number of kernel of convolution. Only used in + selfattention_layer_type == "lightconv*" or "dynamiconv*". + conv_kernel_length (Union[int, str]): Kernel size str of convolution + (e.g. 71_71_71_71_71_71). Only used in selfattention_layer_type + == "lightconv*" or "dynamiconv*". + conv_usebias (bool): Whether to use bias in convolution. Only used in + selfattention_layer_type == "lightconv*" or "dynamiconv*". + linear_units (int): The number of units of position-wise feed forward. + num_blocks (int): The number of decoder blocks. + dropout_rate (float): Dropout rate. + positional_dropout_rate (float): Dropout rate after adding positional encoding. + attention_dropout_rate (float): Dropout rate in attention. + input_layer (Union[str, torch.nn.Module]): Input layer type. + pos_enc_class (torch.nn.Module): Positional encoding module class. + `PositionalEncoding `or `ScaledPositionalEncoding` + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + positionwise_layer_type (str): "linear", "conv1d", or "conv1d-linear". + positionwise_conv_kernel_size (int): Kernel size of positionwise conv1d layer. + selfattention_layer_type (str): Encoder attention layer type. + padding_idx (int): Padding idx for input_layer=embed. + stochastic_depth_rate (float): Maximum probability to skip the encoder layer. + intermediate_layers (Union[List[int], None]): indices of intermediate CTC layer. + indices start from 1. + if not None, intermediate outputs are returned (which changes return type + signature.) + + """ + + def __init__( + self, + idim, + attention_dim=256, + attention_heads=4, + conv_wshare=4, + conv_kernel_length="11", + conv_usebias=False, + linear_units=2048, + num_blocks=6, + dropout_rate=0.1, + positional_dropout_rate=0.1, + attention_dropout_rate=0.0, + input_layer="conv2d", + pos_enc_class=PositionalEncoding, + normalize_before=True, + concat_after=False, + positionwise_layer_type="linear", + positionwise_conv_kernel_size=1, + selfattention_layer_type="selfattn", + padding_idx=-1, + stochastic_depth_rate=0.0, + intermediate_layers=None, + ctc_softmax=None, + conditioning_layer_dim=None, + ): + """Construct an Encoder object.""" + super().__init__() + + self.conv_subsampling_factor = 1 + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(idim, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling(idim, attention_dim, dropout_rate) + self.conv_subsampling_factor = 4 + elif input_layer == "conv2d-scaled-pos-enc": + self.embed = Conv2dSubsampling( + idim, + attention_dim, + dropout_rate, + pos_enc_class(attention_dim, positional_dropout_rate), + ) + self.conv_subsampling_factor = 4 + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6(idim, attention_dim, dropout_rate) + self.conv_subsampling_factor = 6 + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8(idim, attention_dim, dropout_rate) + self.conv_subsampling_factor = 8 + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(idim, attention_dim, padding_idx=padding_idx), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif isinstance(input_layer, torch.nn.Module): + self.embed = torch.nn.Sequential( + input_layer, + pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif input_layer is None: + self.embed = torch.nn.Sequential(pos_enc_class(attention_dim, positional_dropout_rate)) + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + positionwise_layer, positionwise_layer_args = self.get_positionwise_layer( + positionwise_layer_type, + attention_dim, + linear_units, + dropout_rate, + positionwise_conv_kernel_size, + ) + if selfattention_layer_type in [ + "selfattn", + "rel_selfattn", + "legacy_rel_selfattn", + ]: + logging.info("encoder self-attention layer type = self-attention") + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = [ + ( + attention_heads, + attention_dim, + attention_dropout_rate, + ) + ] * num_blocks + elif selfattention_layer_type == "lightconv": + logging.info("encoder self-attention layer type = lightweight convolution") + encoder_selfattn_layer = LightweightConvolution + encoder_selfattn_layer_args = [ + ( + conv_wshare, + attention_dim, + attention_dropout_rate, + int(conv_kernel_length.split("_")[lnum]), + False, + conv_usebias, + ) + for lnum in range(num_blocks) + ] + elif selfattention_layer_type == "lightconv2d": + logging.info( + "encoder self-attention layer " "type = lightweight convolution 2-dimensional" + ) + encoder_selfattn_layer = LightweightConvolution2D + encoder_selfattn_layer_args = [ + ( + conv_wshare, + attention_dim, + attention_dropout_rate, + int(conv_kernel_length.split("_")[lnum]), + False, + conv_usebias, + ) + for lnum in range(num_blocks) + ] + elif selfattention_layer_type == "dynamicconv": + logging.info("encoder self-attention layer type = dynamic convolution") + encoder_selfattn_layer = DynamicConvolution + encoder_selfattn_layer_args = [ + ( + conv_wshare, + attention_dim, + attention_dropout_rate, + int(conv_kernel_length.split("_")[lnum]), + False, + conv_usebias, + ) + for lnum in range(num_blocks) + ] + elif selfattention_layer_type == "dynamicconv2d": + logging.info("encoder self-attention layer type = dynamic convolution 2-dimensional") + encoder_selfattn_layer = DynamicConvolution2D + encoder_selfattn_layer_args = [ + ( + conv_wshare, + attention_dim, + attention_dropout_rate, + int(conv_kernel_length.split("_")[lnum]), + False, + conv_usebias, + ) + for lnum in range(num_blocks) + ] + else: + raise NotImplementedError(selfattention_layer_type) + + self.encoders = repeat( + num_blocks, + lambda lnum: EncoderLayer( + attention_dim, + encoder_selfattn_layer(*encoder_selfattn_layer_args[lnum]), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + stochastic_depth_rate * float(1 + lnum) / num_blocks, + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + + self.intermediate_layers = intermediate_layers + self.use_conditioning = True if ctc_softmax is not None else False + if self.use_conditioning: + self.ctc_softmax = ctc_softmax + self.conditioning_layer = torch.nn.Linear(conditioning_layer_dim, attention_dim) + + def get_positionwise_layer( + self, + positionwise_layer_type="linear", + attention_dim=256, + linear_units=2048, + dropout_rate=0.1, + positionwise_conv_kernel_size=1, + ): + """Define positionwise layer.""" + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = (attention_dim, linear_units, dropout_rate) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + attention_dim, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + attention_dim, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + return positionwise_layer, positionwise_layer_args + + def forward(self, xs, masks): + """Encode input sequence. + + Args: + xs (torch.Tensor): Input tensor (#batch, time, idim). + masks (torch.Tensor): Mask tensor (#batch, time). + + Returns: + torch.Tensor: Output tensor (#batch, time, attention_dim). + torch.Tensor: Mask tensor (#batch, time). + + """ + if isinstance( + self.embed, + (Conv2dSubsampling, Conv2dSubsampling6, Conv2dSubsampling8), + ): + xs, masks = self.embed(xs, masks) + else: + xs = self.embed(xs) + + if self.intermediate_layers is None: + xs, masks = self.encoders(xs, masks) + else: + intermediate_outputs = [] + for layer_idx, encoder_layer in enumerate(self.encoders): + xs, masks = encoder_layer(xs, masks) + + if ( + self.intermediate_layers is not None + and layer_idx + 1 in self.intermediate_layers + ): + encoder_output = xs + # intermediate branches also require normalization. + if self.normalize_before: + encoder_output = self.after_norm(encoder_output) + intermediate_outputs.append(encoder_output) + + if self.use_conditioning: + intermediate_result = self.ctc_softmax(encoder_output) + xs = xs + self.conditioning_layer(intermediate_result) + + if self.normalize_before: + xs = self.after_norm(xs) + + if self.intermediate_layers is not None: + return xs, masks, intermediate_outputs + return xs, masks + + def forward_one_step(self, xs, masks, cache=None): + """Encode input frame. + + Args: + xs (torch.Tensor): Input tensor. + masks (torch.Tensor): Mask tensor. + cache (List[torch.Tensor]): List of cache tensors. + + Returns: + torch.Tensor: Output tensor. + torch.Tensor: Mask tensor. + List[torch.Tensor]: List of new cache tensors. + + """ + if isinstance(self.embed, Conv2dSubsampling): + xs, masks = self.embed(xs, masks) + else: + xs = self.embed(xs) + if cache is None: + cache = [None for _ in range(len(self.encoders))] + new_cache = [] + for c, e in zip(cache, self.encoders): + xs, masks = e(xs, masks, cache=c) + new_cache.append(xs) + if self.normalize_before: + xs = self.after_norm(xs) + return xs, masks, new_cache diff --git a/funasr/models/language_model/transformer_lm.py b/funasr/models/language_model/transformer_lm.py new file mode 100644 index 0000000..3b90e3d --- /dev/null +++ b/funasr/models/language_model/transformer_lm.py @@ -0,0 +1,128 @@ +from typing import Any +from typing import List +from typing import Tuple + +import torch +import torch.nn as nn + +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.encoder.transformer_encoder import TransformerEncoder_s0 as Encoder +from funasr.models.transformer.utils.mask import subsequent_mask +from funasr.train.abs_model import AbsLM + + +class TransformerLM(AbsLM): + def __init__( + self, + vocab_size: int, + pos_enc: str = None, + embed_unit: int = 128, + att_unit: int = 256, + head: int = 2, + unit: int = 1024, + layer: int = 4, + dropout_rate: float = 0.5, + ): + super().__init__() + if pos_enc == "sinusoidal": + pos_enc_class = PositionalEncoding + elif pos_enc is None: + + def pos_enc_class(*args, **kwargs): + return nn.Sequential() # indentity + + else: + raise ValueError(f"unknown pos-enc option: {pos_enc}") + + self.embed = nn.Embedding(vocab_size, embed_unit) + self.encoder = Encoder( + idim=embed_unit, + attention_dim=att_unit, + attention_heads=head, + linear_units=unit, + num_blocks=layer, + dropout_rate=dropout_rate, + input_layer="linear", + pos_enc_class=pos_enc_class, + ) + self.decoder = nn.Linear(att_unit, vocab_size) + + def _target_mask(self, ys_in_pad): + ys_mask = ys_in_pad != 0 + m = subsequent_mask(ys_mask.size(-1), device=ys_mask.device).unsqueeze(0) + return ys_mask.unsqueeze(-2) & m + + def forward(self, input: torch.Tensor, hidden: None) -> Tuple[torch.Tensor, None]: + """Compute LM loss value from buffer sequences. + + Args: + input (torch.Tensor): Input ids. (batch, len) + hidden (torch.Tensor): Target ids. (batch, len) + + """ + x = self.embed(input) + mask = self._target_mask(input) + h, _ = self.encoder(x, mask) + y = self.decoder(h) + return y, None + + def score(self, y: torch.Tensor, state: Any, x: torch.Tensor) -> Tuple[torch.Tensor, Any]: + """Score new token. + + Args: + y (torch.Tensor): 1D torch.int64 prefix tokens. + state: Scorer state for prefix tokens + x (torch.Tensor): encoder feature that generates ys. + + Returns: + tuple[torch.Tensor, Any]: Tuple of + torch.float32 scores for next token (vocab_size) + and next state for ys + + """ + y = y.unsqueeze(0) + h, _, cache = self.encoder.forward_one_step( + self.embed(y), self._target_mask(y), cache=state + ) + h = self.decoder(h[:, -1]) + logp = h.log_softmax(dim=-1).squeeze(0) + return logp, cache + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, vocab_size)` + and next state list for ys. + + """ + # merge states + n_batch = len(ys) + n_layers = len(self.encoder.encoders) + if states[0] is None: + batch_state = None + else: + # transpose state of [batch, layer] into [layer, batch] + batch_state = [ + torch.stack([states[b][i] for b in range(n_batch)]) for i in range(n_layers) + ] + + # batch decoding + h, _, states = self.encoder.forward_one_step( + self.embed(ys), self._target_mask(ys), cache=batch_state + ) + h = self.decoder(h[:, -1]) + logp = h.log_softmax(dim=-1) + + # transpose state of [layer, batch] into [batch, layer] + state_list = [[states[i][b] for i in range(n_layers)] for b in range(n_batch)] + return logp, state_list diff --git a/funasr/models/lcbnet/__init__.py b/funasr/models/lcbnet/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/lcbnet/attention.py b/funasr/models/lcbnet/attention.py new file mode 100644 index 0000000..05a5041 --- /dev/null +++ b/funasr/models/lcbnet/attention.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2024 yufan +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Multi-Head Attention Return Weight layer definition.""" + +import math + +import torch +from torch import nn + + +class MultiHeadedAttentionReturnWeight(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_head, n_feat, dropout_rate): + """Construct an MultiHeadedAttentionReturnWeight object.""" + super(MultiHeadedAttentionReturnWeight, self).__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + self.linear_q = nn.Linear(n_feat, n_feat) + self.linear_k = nn.Linear(n_feat, n_feat) + self.linear_v = nn.Linear(n_feat, n_feat) + self.linear_out = nn.Linear(n_feat, n_feat) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv(self, query, key, value): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + n_batch = query.size(0) + q = self.linear_q(query).view(n_batch, -1, self.h, self.d_k) + k = self.linear_k(key).view(n_batch, -1, self.h, self.d_k) + v = self.linear_v(value).view(n_batch, -1, self.h, self.d_k) + q = q.transpose(1, 2) # (batch, head, time1, d_k) + k = k.transpose(1, 2) # (batch, head, time2, d_k) + v = v.transpose(1, 2) # (batch, head, time2, d_k) + + return q, k, v + + def forward_attention(self, value, scores, mask): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + min_value = torch.finfo(scores.dtype).min + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x), self.attn # (batch, time1, d_model) + + def forward(self, query, key, value, mask): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q, k, v = self.forward_qkv(query, key, value) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, mask) diff --git a/funasr/models/lcbnet/encoder.py b/funasr/models/lcbnet/encoder.py new file mode 100644 index 0000000..f5f2497 --- /dev/null +++ b/funasr/models/lcbnet/encoder.py @@ -0,0 +1,398 @@ +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Transformer encoder definition.""" + +from typing import List +from typing import Optional +from typing import Tuple + +import torch +from torch import nn +import logging + +from funasr.models.transformer.attention import MultiHeadedAttention +from funasr.models.lcbnet.attention import MultiHeadedAttentionReturnWeight +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm + +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.positionwise_feed_forward import PositionwiseFeedForward +from funasr.models.transformer.utils.repeat import repeat +from funasr.register import tables + + +class EncoderLayer(nn.Module): + """Encoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` instance + can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + stochastic_depth_rate (float): Proability to skip this layer. + During training, the layer may skip residual computation and return input + as-is with given probability. + """ + + def __init__( + self, + size, + self_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayer, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + self.norm2 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + + def forward(self, x, mask, cache=None): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + return x, mask + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if cache is None: + x_q = x + else: + assert cache.shape == (x.shape[0], x.shape[1] - 1, self.size) + x_q = x[:, -1:, :] + residual = residual[:, -1:, :] + mask = None if mask is None else mask[:, -1:, :] + + if self.concat_after: + x_concat = torch.cat((x, self.self_attn(x_q, x, x, mask)), dim=-1) + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = residual + stoch_layer_coeff * self.dropout(self.self_attn(x_q, x, x, mask)) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + stoch_layer_coeff * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm2(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + return x, mask + + +@tables.register("encoder_classes", "TransformerTextEncoder") +class TransformerTextEncoder(nn.Module): + """Transformer text encoder module. + + Args: + input_size: input dim + output_size: dimension of attention + attention_heads: the number of heads of multi head attention + linear_units: the number of units of position-wise feed forward + num_blocks: the number of decoder blocks + dropout_rate: dropout rate + attention_dropout_rate: dropout rate in attention + positional_dropout_rate: dropout rate after adding positional encoding + input_layer: input layer type + pos_enc_class: PositionalEncoding or ScaledPositionalEncoding + normalize_before: whether to use layer_norm before the first block + concat_after: whether to concat attention layer's input and output + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. + i.e. x -> x + att(x) + positionwise_layer_type: linear of conv1d + positionwise_conv_kernel_size: kernel size of positionwise conv1d layer + padding_idx: padding_idx for input_layer=embed + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + ): + super().__init__() + self._output_size = output_size + + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size), + pos_enc_class(output_size, positional_dropout_rate), + ) + + self.normalize_before = normalize_before + + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + ) + self.encoders = repeat( + num_blocks, + lambda lnum: EncoderLayer( + output_size, + MultiHeadedAttention(attention_heads, output_size, attention_dropout_rate), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Embed positions in tensor. + + Args: + xs_pad: input tensor (B, L, D) + ilens: input length (B) + Returns: + position embedded tensor and mask + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + xs_pad = self.embed(xs_pad) + + xs_pad, masks = self.encoders(xs_pad, masks) + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + olens = masks.squeeze(1).sum(1) + return xs_pad, olens, None + + +@tables.register("encoder_classes", "FusionSANEncoder") +class SelfSrcAttention(nn.Module): + """Single decoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + src_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + + """ + + def __init__( + self, + size, + attention_heads, + attention_dim, + linear_units, + self_attention_dropout_rate, + src_attention_dropout_rate, + positional_dropout_rate, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an SelfSrcAttention object.""" + super(SelfSrcAttention, self).__init__() + self.size = size + self.self_attn = MultiHeadedAttention( + attention_heads, attention_dim, self_attention_dropout_rate + ) + self.src_attn = MultiHeadedAttentionReturnWeight( + attention_heads, attention_dim, src_attention_dropout_rate + ) + self.feed_forward = PositionwiseFeedForward( + attention_dim, linear_units, positional_dropout_rate + ) + self.norm1 = LayerNorm(size) + self.norm2 = LayerNorm(size) + self.norm3 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = nn.Linear(size + size, size) + self.concat_linear2 = nn.Linear(size + size, size) + + def forward(self, tgt, tgt_mask, memory, memory_mask, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + + if cache is None: + tgt_q = tgt + tgt_q_mask = tgt_mask + else: + # compute only the last frame query keeping dim: max_time_out -> 1 + assert cache.shape == ( + tgt.shape[0], + tgt.shape[1] - 1, + self.size, + ), f"{cache.shape} == {(tgt.shape[0], tgt.shape[1] - 1, self.size)}" + tgt_q = tgt[:, -1:, :] + residual = residual[:, -1:, :] + tgt_q_mask = None + if tgt_mask is not None: + tgt_q_mask = tgt_mask[:, -1:, :] + + if self.concat_after: + tgt_concat = torch.cat((tgt_q, self.self_attn(tgt_q, tgt, tgt, tgt_q_mask)), dim=-1) + x = residual + self.concat_linear1(tgt_concat) + else: + x = residual + self.dropout(self.self_attn(tgt_q, tgt, tgt, tgt_q_mask)) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + if self.concat_after: + x_concat = torch.cat((x, self.src_attn(x, memory, memory, memory_mask)), dim=-1) + x = residual + self.concat_linear2(x_concat) + else: + x, score = self.src_attn(x, memory, memory, memory_mask) + x = residual + self.dropout(x) + if not self.normalize_before: + x = self.norm2(x) + + residual = x + if self.normalize_before: + x = self.norm3(x) + x = residual + self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm3(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + return x, tgt_mask, memory, memory_mask + + +@tables.register("encoder_classes", "ConvBiasPredictor") +class ConvPredictor(nn.Module): + def __init__( + self, + size=256, + l_order=3, + r_order=3, + attention_heads=4, + attention_dropout_rate=0.1, + linear_units=2048, + ): + super().__init__() + self.atten = MultiHeadedAttention(attention_heads, size, attention_dropout_rate) + self.norm1 = LayerNorm(size) + self.feed_forward = PositionwiseFeedForward(size, linear_units, attention_dropout_rate) + self.norm2 = LayerNorm(size) + self.pad = nn.ConstantPad1d((l_order, r_order), 0) + self.conv1d = nn.Conv1d(size, size, l_order + r_order + 1, groups=size) + self.output_linear = nn.Linear(size, 1) + + def forward(self, text_enc, asr_enc): + # stage1 cross-attention + residual = text_enc + text_enc = residual + self.atten(text_enc, asr_enc, asr_enc, None) + + # stage2 FFN + residual = text_enc + text_enc = self.norm1(text_enc) + text_enc = residual + self.feed_forward(text_enc) + + # stage Conv predictor + text_enc = self.norm2(text_enc) + context = text_enc.transpose(1, 2) + queries = self.pad(context) + memory = self.conv1d(queries) + output = memory + context + output = output.transpose(1, 2) + output = torch.relu(output) + output = self.output_linear(output) + if output.dim() == 3: + output = output.squeeze(2) + return output diff --git a/funasr/models/lcbnet/model.py b/funasr/models/lcbnet/model.py new file mode 100644 index 0000000..d3df25a --- /dev/null +++ b/funasr/models/lcbnet/model.py @@ -0,0 +1,504 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import logging +from typing import Union, Dict, List, Tuple, Optional + +import time +import torch +import torch.nn as nn +from torch.cuda.amp import autocast + +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.ctc.ctc import CTC +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.metrics.compute_acc import th_accuracy + +# from funasr.models.e2e_asr_common import ErrorCalculator +from funasr.train_utils.device_funcs import force_gatherable +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.utils import postprocess_utils +from funasr.utils.datadir_writer import DatadirWriter +from funasr.register import tables + +import pdb + + +@tables.register("model_classes", "LCBNet") +class LCBNet(nn.Module): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + LCB-NET: LONG-CONTEXT BIASING FOR AUDIO-VISUAL SPEECH RECOGNITION + https://arxiv.org/abs/2401.06390 + """ + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + text_encoder: str = None, + text_encoder_conf: dict = None, + bias_predictor: str = None, + bias_predictor_conf: dict = None, + fusion_encoder: str = None, + fusion_encoder_conf: dict = None, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.5, + interctc_weight: float = 0.0, + select_num: int = 2, + select_length: int = 3, + insert_blank: bool = True, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + # lcbnet modules: text encoder, fusion encoder and bias predictor + text_encoder_class = tables.encoder_classes.get(text_encoder) + text_encoder = text_encoder_class(input_size=vocab_size, **text_encoder_conf) + fusion_encoder_class = tables.encoder_classes.get(fusion_encoder) + fusion_encoder = fusion_encoder_class(**fusion_encoder_conf) + bias_predictor_class = tables.encoder_classes.get(bias_predictor) + bias_predictor = bias_predictor_class(**bias_predictor_conf) + + if decoder is not None: + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + **decoder_conf, + ) + if ctc_weight > 0.0: + + if ctc_conf is None: + ctc_conf = {} + + ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **ctc_conf) + + self.blank_id = blank_id + self.sos = vocab_size - 1 + self.eos = vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.ctc_weight = ctc_weight + self.specaug = specaug + self.normalize = normalize + self.encoder = encoder + # lcbnet + self.text_encoder = text_encoder + self.fusion_encoder = fusion_encoder + self.bias_predictor = bias_predictor + self.select_num = select_num + self.select_length = select_length + self.insert_blank = insert_blank + + if not hasattr(self.encoder, "interctc_use_conditioning"): + self.encoder.interctc_use_conditioning = False + if self.encoder.interctc_use_conditioning: + self.encoder.conditioning_layer = torch.nn.Linear( + vocab_size, self.encoder.output_size() + ) + self.interctc_weight = interctc_weight + + # self.error_calculator = None + if ctc_weight == 1.0: + self.decoder = None + else: + self.decoder = decoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + # + # if report_cer or report_wer: + # self.error_calculator = ErrorCalculator( + # token_list, sym_space, sym_blank, report_cer, report_wer + # ) + # + self.error_calculator = None + if ctc_weight == 0.0: + self.ctc = None + else: + self.ctc = ctc + + self.share_embedding = share_embedding + if self.share_embedding: + self.decoder.embed = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + loss_att, acc_att, cer_att, wer_att = None, None, None, None + loss_ctc, cer_ctc = None, None + stats = dict() + + # decoder: CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # Intermediate CTC (optional) + loss_interctc = 0.0 + if self.interctc_weight != 0.0 and intermediate_outs is not None: + for layer_idx, intermediate_out in intermediate_outs: + # we assume intermediate_out has the same length & padding + # as those of encoder_out + loss_ic, cer_ic = self._calc_ctc_loss( + intermediate_out, encoder_out_lens, text, text_lengths + ) + loss_interctc = loss_interctc + loss_ic + + # Collect Intermedaite CTC stats + stats["loss_interctc_layer{}".format(layer_idx)] = ( + loss_ic.detach() if loss_ic is not None else None + ) + stats["cer_interctc_layer{}".format(layer_idx)] = cer_ic + + loss_interctc = loss_interctc / len(intermediate_outs) + + # calculate whole encoder loss + loss_ctc = (1 - self.interctc_weight) * loss_ctc + self.interctc_weight * loss_interctc + + # decoder: Attention decoder branch + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + elif self.ctc_weight == 1.0: + loss = loss_ctc + else: + loss = self.ctc_weight * loss_ctc + (1 - self.ctc_weight) * loss_att + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + + # Collect total loss stats + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + # Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + if self.encoder.interctc_use_conditioning: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths, ctc=self.ctc) + else: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + if intermediate_outs is not None: + return (encoder_out, intermediate_outs), encoder_out_lens + return encoder_out, encoder_out_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, _ = self.decoder(encoder_out, encoder_out_lens, ys_in_pad, ys_in_lens) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + # Calc CTC loss + loss_ctc = self.ctc(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + + # Calc CER using CTC + cer_ctc = None + if not self.training and self.error_calculator is not None: + ys_hat = self.ctc.argmax(encoder_out).data + cer_ctc = self.error_calculator(ys_hat.cpu(), ys_pad.cpu(), is_ctc=True) + return loss_ctc, cer_ctc + + def init_beam_search( + self, + **kwargs, + ): + from funasr.models.transformer.search import BeamSearch + from funasr.models.transformer.scorers.ctc import CTCPrefixScorer + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + if self.ctc != None: + ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos) + scorers.update(ctc=ctc) + token_list = kwargs.get("token_list") + scorers.update( + decoder=self.decoder, + length_bonus=LengthBonus(len(token_list)), + ) + + # 3. Build ngram model + # ngram is not supported now + ngram = None + scorers["ngram"] = ngram + + weights = dict( + decoder=1.0 - kwargs.get("decoding_ctc_weight", 0.3), + ctc=kwargs.get("decoding_ctc_weight", 0.3), + lm=kwargs.get("lm_weight", 0.0), + ngram=kwargs.get("ngram_weight", 0.0), + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearch( + beam_size=kwargs.get("beam_size", 20), + weights=weights, + scorers=scorers, + sos=self.sos, + eos=self.eos, + vocab_size=len(token_list), + token_list=token_list, + pre_beam_score_key=None if self.ctc_weight == 1.0 else "full", + ) + + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + # init beamsearch + if self.beam_search is None: + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + audio_sample_list = sample_list[0] + if len(sample_list) > 1: + ocr_sample_list = sample_list[1] + else: + ocr_sample_list = [[294, 0]] + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + frame_shift = 10 + meta_data["batch_data_time"] = speech_lengths.sum().item() * frame_shift / 1000 + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + ocr_list_new = [[x + 1 if x != 0 else x for x in sublist] for sublist in ocr_sample_list] + ocr = torch.tensor(ocr_list_new).to(device=kwargs["device"]) + ocr_lengths = ocr.new_full([1], dtype=torch.long, fill_value=ocr.size(1)).to( + device=kwargs["device"] + ) + ocr, ocr_lens, _ = self.text_encoder(ocr, ocr_lengths) + fusion_out, _, _, _ = self.fusion_encoder(encoder_out, None, ocr, None) + encoder_out = encoder_out + fusion_out + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + b, n, d = encoder_out.size() + for i in range(b): + + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text = tokenizer.tokens2text(token) + + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + result_i = {"key": key[i], "token": token, "text": text_postprocessed} + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text_postprocessed + + return results, meta_data diff --git a/funasr/models/llm_asr/__init__.py b/funasr/models/llm_asr/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/llm_asr/adaptor.py b/funasr/models/llm_asr/adaptor.py new file mode 100644 index 0000000..8c2a804 --- /dev/null +++ b/funasr/models/llm_asr/adaptor.py @@ -0,0 +1,65 @@ +import torch +import torch.nn as nn + +from funasr.register import tables + + +@tables.register("adaptor_classes", "Linear") +class Linear(nn.Module): + def __init__(self, downsample_rate, encoder_dim, llm_dim, ffn_dim: int = 2048, **kwargs): + super().__init__() + self.k = downsample_rate + self.encoder_dim = encoder_dim + self.llm_dim = llm_dim + self.linear1 = nn.Linear(self.encoder_dim * self.k, ffn_dim) + self.relu = nn.ReLU() + self.linear2 = nn.Linear(ffn_dim, self.llm_dim) + + def forward(self, x): + batch_size, seq_len, dim = x.size() + num_frames_to_discard = seq_len % self.k + if num_frames_to_discard > 0: + x = x[:, :-num_frames_to_discard, :] + seq_len = x.size(1) + + x = x.contiguous() + x = x.view(batch_size, seq_len // self.k, dim * self.k) + x = self.linear1(x) + x = self.relu(x) + x = self.linear2(x) + return x + + +@tables.register("adaptor_classes", "QFormer") +class EncoderProjectorQFormer(nn.Module): + def __init__(self, downsample_rate, encoder_dim, llm_dim, ffn_dim: int = 2048, **kwargs): + super().__init__() + self.encoder_dim = encoder_dim + self.llm_dim = llm_dim + from transformers import Blip2QFormerConfig, Blip2QFormerModel + + configuration = Blip2QFormerConfig() + configuration.encoder_hidden_size = self.encoder_dim + configuration.num_hidden_layers = 2 + + self.query_len = 64 + self.query = nn.Parameter(torch.zeros(1, self.query_len, configuration.hidden_size)) + self.query.data.normal_(mean=0.0, std=1.0) + self.qformer = Blip2QFormerModel(configuration) + + self.linear = nn.Linear(configuration.hidden_size, self.llm_dim) + self.norm = nn.LayerNorm(self.llm_dim, eps=1e-5) + + def forward(self, x, atts): + query = self.query.expand(x.shape[0], -1, -1) + + query_output = self.qformer( + query_embeds=query, + encoder_hidden_states=x, + encoder_attention_mask=atts, + return_dict=True, + ) + + query_proj = self.norm(self.linear(query_output.last_hidden_state)) + + return query_proj diff --git a/funasr/models/llm_asr/model.py b/funasr/models/llm_asr/model.py new file mode 100644 index 0000000..4345f69 --- /dev/null +++ b/funasr/models/llm_asr/model.py @@ -0,0 +1,343 @@ +import logging +from typing import Union, Dict, List, Tuple, Optional + +import time +import torch +import torch.nn as nn +import torch.nn.functional as F +from torch.cuda.amp import autocast + +from funasr.models.scama.utils import sequence_mask +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.ctc.ctc import CTC +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.metrics.compute_acc import th_accuracy, compute_accuracy +from funasr.metrics.common import ErrorCalculator +from funasr.train_utils.device_funcs import force_gatherable +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.utils import postprocess_utils +from funasr.utils.datadir_writer import DatadirWriter +from funasr.register import tables + + +@tables.register("model_classes", "LLMASR") +class LLMASR(nn.Module): + """ """ + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + audio_encoder: str = None, + audio_encoder_conf: dict = None, + audio_adaptor: str = None, + audio_adaptor_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.5, + llm: str = None, + llm_conf: dict = None, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + + # audio encoder + hub = audio_encoder_conf.get("hub", None) + if hub == "ms": + from funasr import AutoModel + + model = AutoModel(model=audio_encoder, model_revision="master") + # frontend = model.kwargs.get("frontend") + audio_encoder_output_size = model.model.encoder_output_size + + audio_encoder = model.model.model.encoder + + # self.frontend = frontend + + elif hub == "hf": + pass + else: + encoder_class = tables.encoder_classes.get(audio_encoder) + audio_encoder = encoder_class(input_size=input_size, **audio_encoder_conf) + audio_encoder_output_size = audio_encoder.output_size() + freeze = audio_encoder_conf.get("freeze", True) + if freeze: + for name, param in audio_encoder.named_parameters(): + param.requires_grad = False + audio_encoder.eval() + + self.audio_encoder = audio_encoder + + # llm + hub = llm_conf.get("hub", "hf") + self.llm = None + if hub == "hf": + from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig + + init_param_path = llm_conf.get("init_param_path", "vicuna-7b-v1.5") + + model = AutoModelForCausalLM.from_pretrained( + init_param_path, + load_in_8bit=None, + device_map=None, + use_cache=None, + ) + freeze = llm_conf.get("freeze", True) + if freeze: + for name, param in model.named_parameters(): + param.requires_grad = False + model.eval() + self.llm = model + + # adaptor + adaptor_class = tables.adaptor_classes.get(audio_adaptor) + audio_adaptor_conf["encoder_dim"] = audio_encoder_output_size + audio_adaptor = adaptor_class(**audio_adaptor_conf) + + self.audio_adaptor = audio_adaptor + + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.specaug = specaug + self.normalize = normalize + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + + self.error_calculator = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + input_ids: torch.Tensor, + attention_mask: torch.Tensor, + labels_ids: torch.Tensor, + label_mask: torch.Tensor, + audio_mask: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # audio encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + # audio_adaptor + encoder_out = self.audio_adaptor(encoder_out) + + input_ids[input_ids == -1] = 0 + input_ids[input_ids == -100] = 0 + if hasattr(self.llm.model, "embed_tokens"): + inputs_embeds = self.llm.model.embed_tokens(input_ids) + elif hasattr(self.llm.model.model, "embed_tokens"): + inputs_embeds = self.llm.model.model.embed_tokens(input_ids) + else: + inputs_embeds = self.llm.model.model.model.embed_tokens(input_ids) + + if audio_mask is not None: + batch_size, token_num, dims = inputs_embeds.shape + _, l, _ = encoder_out.shape + # [audio, bos, prompt, input, pad] + encoder_outs_pad = F.pad(encoder_out, (0, 0, 0, token_num - l, 0, 0), value=0.0) + inputs_embeds = encoder_outs_pad * audio_mask[:, :, None] + inputs_embeds * ( + 1.0 - audio_mask[:, :, None] + ) + + model_outputs = self.llm( + inputs_embeds=inputs_embeds, attention_mask=attention_mask, labels=labels_ids + ) + loss = model_outputs.loss + + stats = {} + with torch.no_grad(): + preds = torch.argmax(model_outputs.logits, -1) + acc_att = compute_accuracy(preds[:, :-1], labels_ids[:, 1:], ignore_label=-100) + stats["acc"] = acc_att + + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + speech = speech.permute(0, 2, 1) + res = self.audio_encoder(speech) + if isinstance(res, (list, tuple)): + encoder_out, encoder_out_lens = res[0], res[1] + else: + encoder_out, encoder_out_lens = res, speech_lengths + return encoder_out, encoder_out_lens + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + prompt = kwargs.get("prompt", "Transcribe speech to text.") + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + # adaptor + encoder_out = self.audio_adaptor(encoder_out) + + prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format(prompt) + prompt_ids = tokenizer.encode(prompt_pre) + prompt_length = len(prompt_ids) + prompt_ids = torch.tensor(prompt_ids, dtype=torch.int64).to(kwargs["device"]) + + if hasattr(self.llm.model, "embed_tokens"): + inputs_embeds = self.llm.model.embed_tokens(prompt_ids) + elif hasattr(self.llm.model.model, "embed_tokens"): + inputs_embeds = self.llm.model.model.embed_tokens(prompt_ids) + else: + inputs_embeds = self.llm.model.model.model.embed_tokens(prompt_ids) + + inputs_embeds = torch.cat( + (inputs_embeds[None, :, :], encoder_out), dim=1 + ) # [prompt, audio] + attention_mask = torch.ones(inputs_embeds.size()[:-1], dtype=torch.long).to( + kwargs["device"] + ) + + preds = self.llm.generate( + inputs_embeds=inputs_embeds, + max_length=kwargs.get("max_length", 200), + max_new_tokens=kwargs.get("max_new_tokens", 200), + num_beams=kwargs.get("num_beams", 4), + do_sample=kwargs.get("do_sample", False), + min_length=kwargs.get("min_length", 1), + top_p=kwargs.get("top_p", 1.0), + repetition_penalty=kwargs.get("repetition_penalty", 1.0), + length_penalty=kwargs.get("length_penalty", 1.0), + temperature=kwargs.get("temperature", 1.0), + attention_mask=attention_mask, + bos_token_id=tokenizer.bos_token_id, + eos_token_id=tokenizer.eos_token_id, + pad_token_id=tokenizer.pad_token_id, + ) + + text = tokenizer.batch_decode(preds, add_special_tokens=False, skip_special_tokens=True) + + text = text[0].split(": ")[-1] + text = text.strip() + + # preds = torch.argmax(model_outputs.logits, -1) + + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{0 + 1}best_recog"] + + results = [] + result_i = {"key": key[0], "text": text} + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["text"][key[0]] = text + + return results, meta_data diff --git a/funasr/models/llm_asr_nar/__init__.py b/funasr/models/llm_asr_nar/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/llm_asr_nar/adaptor.py b/funasr/models/llm_asr_nar/adaptor.py new file mode 100644 index 0000000..0d73a1a --- /dev/null +++ b/funasr/models/llm_asr_nar/adaptor.py @@ -0,0 +1,30 @@ +import torch +import torch.nn as nn + +from funasr.register import tables + + +@tables.register("adaptor_classes", "Linear") +class Linear(nn.Module): + def __init__(self, downsample_rate, encoder_dim, llm_dim, ffn_dim: int = 2048, **kwargs): + super().__init__() + self.k = downsample_rate + self.encoder_dim = encoder_dim + self.llm_dim = llm_dim + self.linear1 = nn.Linear(self.encoder_dim * self.k, ffn_dim) + self.relu = nn.ReLU() + self.linear2 = nn.Linear(ffn_dim, self.llm_dim) + + def forward(self, x): + batch_size, seq_len, dim = x.size() + num_frames_to_discard = seq_len % self.k + if num_frames_to_discard > 0: + x = x[:, :-num_frames_to_discard, :] + seq_len = x.size(1) + + x = x.contiguous() + x = x.view(batch_size, seq_len // self.k, dim * self.k) + x = self.linear1(x) + x = self.relu(x) + x = self.linear2(x) + return x diff --git a/funasr/models/llm_asr_nar/model.py b/funasr/models/llm_asr_nar/model.py new file mode 100644 index 0000000..8c0c3ff --- /dev/null +++ b/funasr/models/llm_asr_nar/model.py @@ -0,0 +1,788 @@ +import logging +from typing import Union, Dict, List, Tuple, Optional + +import time +import torch +import torch.nn as nn +import torch.nn.functional as F +from torch.cuda.amp import autocast + +from funasr.models.scama.utils import sequence_mask +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.ctc.ctc import CTC +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.metrics.compute_acc import th_accuracy, compute_accuracy + +# from funasr.models.e2e_asr_common import ErrorCalculator +from funasr.train_utils.device_funcs import force_gatherable +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.utils import postprocess_utils +from funasr.models.paraformer.cif_predictor import mae_loss +from funasr.utils.datadir_writer import DatadirWriter +from funasr.register import tables + + +@tables.register("model_classes", "LLMASRNAR") +class LLMASRNAR(nn.Module): + """ """ + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.5, + llm: str = None, + llm_conf: dict = None, + adaptor: str = None, + adaptor_conf: dict = None, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + + # audio encoder + hub = encoder_conf.get("hub", None) + if hub == "funasr": + from funasr import AutoModel + + init_param_path = encoder_conf.get( + "init_param_path", + "iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + ) + model = AutoModel(model=init_param_path, model_revision="master") + # frontend = model.kwargs.get("frontend") + model.model.decoder = None + + self.audio_encoder = model.model + # self.frontend = frontend + + elif hub == "hf": + pass + else: + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + # llm + hub = llm_conf.get("hub", "hf") + self.llm = None + if hub == "hf": + from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig + + init_param_path = llm_conf.get("init_param_path", "vicuna-7b-v1.5") + model = AutoModelForCausalLM.from_pretrained( + init_param_path, + load_in_8bit=None, + device_map=None, + use_cache=None, + ) + freeze = llm_conf.get("freeze", True) + if freeze: + for name, param in model.named_parameters(): + param.requires_grad = False + model.eval() + self.llm = model + + # adaptor + adaptor_class = tables.adaptor_classes.get(adaptor) + adaptor = adaptor_class(**adaptor_conf) + + self.adaptor = adaptor + + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.specaug = specaug + self.normalize = normalize + self.encoder = encoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + # + # if report_cer or report_wer: + # self.error_calculator = ErrorCalculator( + # token_list, sym_space, sym_blank, report_cer, report_wer + # ) + # + self.error_calculator = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + input_ids: torch.Tensor, + attention_mask: torch.Tensor, + labels_ids: torch.Tensor, + label_mask: torch.Tensor, + audio_mask: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # audio encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths, audio_mask=audio_mask) + + # adaptor + encoder_out = self.adaptor(encoder_out) + + if input_ids is not None: + input_ids[input_ids == -1] = 0 + input_ids[input_ids == -100] = 0 + if hasattr(self.llm.model, "embed_tokens"): + inputs_embeds = self.llm.model.embed_tokens(input_ids) + elif hasattr(self.llm.model.model, "embed_tokens"): + inputs_embeds = self.llm.model.model.embed_tokens(input_ids) + else: + inputs_embeds = self.llm.model.model.model.embed_tokens(input_ids) + + if audio_mask is not None: + batch_size, token_num, dims = inputs_embeds.shape + _, l, _ = encoder_out.shape + encoder_outs_pad = F.pad(encoder_out, (0, 0, token_num - l - 1, 1, 0, 0), value=0.0) + inputs_embeds = encoder_outs_pad * audio_mask[:, :, None] + inputs_embeds * ( + 1.0 - audio_mask[:, :, None] + ) + inputs_embeds = F.pad(inputs_embeds[:, 1:, :], (0, 0, 0, 1, 0, 0), value=0.0) + + model_outputs = self.llm( + inputs_embeds=inputs_embeds, attention_mask=attention_mask, labels=labels_ids + ) + loss = model_outputs.loss + + stats = {} + with torch.no_grad(): + preds = torch.argmax(model_outputs.logits, -1) + acc_att = compute_accuracy(preds[:, :-1], labels_ids[:, 1:], ignore_label=-100) + stats["acc"] = acc_att + + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + + audio_mask = kwargs.get("audio_mask", None) + audio_token_lengths = audio_mask.sum(-1) if audio_mask is not None else None + text_token_int = kwargs.get("text_token_int", None) + if audio_token_lengths is None: + audio_token_lengths = torch.tensor([len(text_token_int)], dtype=torch.int64) + + batch = {"speech": speech, "speech_lengths": speech_lengths} + enc, enc_lens = self.audio_encoder.encode(**batch) + with autocast(False): + enc_mask = sequence_mask(enc_lens, enc.size(1), device=enc.device)[:, None, :] + pre_acoustic_embeds, pre_token_length, _, _ = self.audio_encoder.predictor( + enc, + mask=enc_mask, + target_label_length=audio_token_lengths, + ) + + return pre_acoustic_embeds, pre_token_length + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + prompt = kwargs.get("prompt", "Transcribe speech to text.") + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=None, + ) + if len(kwargs.get("data_type", [])) > 1: + audio_sample_list, text_token_int_list = audio_sample_list + text_token_int = text_token_int_list[0].replace(" ", "") + text_token_int = tokenizer.encode(text_token_int) + else: + text_token_int = None + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + encoder_out, encoder_out_lens = self.encode( + speech, speech_lengths, text_token_int=text_token_int + ) + + # adaptor + encoder_out = self.adaptor(encoder_out) + + prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format(prompt) + prompt_ids = tokenizer.encode(prompt_pre) + prompt_length = len(prompt_ids) + prompt_ids = torch.tensor(prompt_ids, dtype=torch.int64).to(kwargs["device"]) + + if hasattr(self.llm.model, "embed_tokens"): + inputs_embeds = self.llm.model.embed_tokens(prompt_ids) + elif hasattr(self.llm.model.model, "embed_tokens"): + inputs_embeds = self.llm.model.model.embed_tokens(prompt_ids) + else: + inputs_embeds = self.llm.model.model.model.embed_tokens(prompt_ids) + + inputs_embeds = torch.cat( + (inputs_embeds[None, :, :], encoder_out), dim=1 + ) # [prompt, audio] + attention_mask = torch.ones(inputs_embeds.size()[:-1], dtype=torch.long).to( + kwargs["device"] + ) + + # model_outputs = self.llm.generate( + # inputs_embeds=inputs_embeds, + # max_length=kwargs.get("max_length", 200), + # max_new_tokens=kwargs.get("max_new_tokens", 200), + # num_beams=kwargs.get("num_beams", 4), + # do_sample=kwargs.get("do_sample", False), + # min_length=kwargs.get("min_length", 1), + # top_p=kwargs.get("top_p", 1.0), + # repetition_penalty=kwargs.get("repetition_penalty", 1.0), + # length_penalty=kwargs.get("length_penalty", 1.0), + # temperature=kwargs.get("temperature", 1.0), + # attention_mask=attention_mask, + # bos_token_id=tokenizer.bos_token_id, + # eos_token_id=tokenizer.eos_token_id, + # pad_token_id=tokenizer.pad_token_id + # ) + + model_outputs = self.llm( + inputs_embeds=inputs_embeds, attention_mask=attention_mask, labels=None + ) + preds = torch.argmax(model_outputs.logits, -1) + text = tokenizer.batch_decode(preds, add_special_tokens=False, skip_special_tokens=True) + + text = text[0].split(": ")[-1] + text = text.strip() + + # preds = torch.argmax(model_outputs.logits, -1) + + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{0 + 1}best_recog"] + + results = [] + result_i = {"key": key[0], "text": text} + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["text"][key[0]] = text + + return results, meta_data + + +@tables.register("model_classes", "LLMASRNARPrompt") +class LLMASRNARPrompt(nn.Module): + """ """ + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.0, + llm: str = None, + llm_conf: dict = None, + adaptor: str = None, + adaptor_conf: dict = None, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + predictor_weight: int = 1.0, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + + # audio encoder + hub = encoder_conf.get("hub", None) + if hub == "funasr": + from funasr import AutoModel + + init_param_path = encoder_conf.get( + "init_param_path", + "iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + ) + model = AutoModel(model=init_param_path, model_revision="master") + # frontend = model.kwargs.get("frontend") + model.model.decoder = None + + self.audio_encoder = model.model + # self.frontend = frontend + self.predictor_weight = predictor_weight + + elif hub == "hf": + pass + else: + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + # llm + hub = llm_conf.get("hub", "hf") + self.llm = None + if hub == "hf": + from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig + + init_param_path = llm_conf.get("init_param_path", "vicuna-7b-v1.5") + model = AutoModelForCausalLM.from_pretrained( + init_param_path, + load_in_8bit=None, + device_map=None, + use_cache=None, + ) + freeze = llm_conf.get("freeze", True) + if freeze: + for name, param in model.named_parameters(): + param.requires_grad = False + model.eval() + self.llm = model + + # adaptor + adaptor_class = tables.adaptor_classes.get(adaptor) + adaptor = adaptor_class(**adaptor_conf) + + self.adaptor = adaptor + + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.specaug = specaug + self.normalize = normalize + self.encoder = encoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + self.criterion_pre = mae_loss(normalize_length=length_normalized_loss) + # + # if report_cer or report_wer: + # self.error_calculator = ErrorCalculator( + # token_list, sym_space, sym_blank, report_cer, report_wer + # ) + # + self.error_calculator = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + if ctc_weight > 0.0: + if ctc_conf is None: + ctc_conf = {} + + ctc = CTC(odim=vocab_size, encoder_output_size=adaptor_conf["encoder_dim"], **ctc_conf) + self.ctc_weight = ctc_weight + self.ctc = ctc + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + input_ids: torch.Tensor, + attention_mask: torch.Tensor, + labels_ids: torch.Tensor, + label_mask: torch.Tensor, + audio_mask: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + stats = {} + # audio encoder + outs = self.encode(speech, speech_lengths, audio_mask=audio_mask) + enc, enc_lens = outs[0], outs[1] + encoder_out, encoder_out_lens, loss_pre = outs[2], outs[3], outs[4] + + # decoder: CTC branch + + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss(enc, enc_lens, text, text_lengths) + + # Collect CTC branch stats + stats["loss_ctc"] = torch.clone(loss_ctc.detach()) if loss_ctc is not None else None + + # adaptor + encoder_out = self.adaptor(encoder_out) + + if input_ids is not None: + input_ids[input_ids == -1] = 0 + input_ids[input_ids == -100] = 0 + if hasattr(self.llm.model, "embed_tokens"): + inputs_embeds = self.llm.model.embed_tokens(input_ids) + elif hasattr(self.llm.model.model, "embed_tokens"): + inputs_embeds = self.llm.model.model.embed_tokens(input_ids) + else: + inputs_embeds = self.llm.model.model.model.embed_tokens(input_ids) + + if audio_mask is not None: + # inputs_embeds: [bos, prompt, input, pad, target] + prompt_bos_length = kwargs.get("prompt_bos_length", None) + assert prompt_bos_length is not None + prompt_bos_length = prompt_bos_length[0].item() + batch_size, token_num, dims = inputs_embeds.shape + _, l, _ = encoder_out.shape + encoder_outs_pad = F.pad( + encoder_out, + (0, 0, prompt_bos_length, token_num - prompt_bos_length - l, 0, 0), + value=0.0, + ) + inputs_embeds = encoder_outs_pad * audio_mask[:, :, None] + inputs_embeds * ( + 1.0 - audio_mask[:, :, None] + ) + inputs_embeds = F.pad( + inputs_embeds[:, 1:, :], (0, 0, 0, 1, 0, 0), value=0.0 + ) # [prompt, input, pad, target, 0.0] + + # labels_ids: [bos, prompt, input, target, eos] -> [-1, -1, input, target, eos] + # loss: + # inputs_embeds[:-1] -> [prompt, input, pad, target] + # labels_ids[1:] -> [prompt, input, target, eos] -> [-1, input, target, eos]; + model_outputs = self.llm( + inputs_embeds=inputs_embeds, attention_mask=attention_mask, labels=labels_ids + ) + loss_llm = model_outputs.loss + stats["loss_llm"] = torch.clone(loss_llm.detach()) + if self.ctc_weight > 0.0: + loss_llm = self.ctc_weight * loss_ctc + loss_llm + loss = loss_llm + loss_pre * self.predictor_weight + + with torch.no_grad(): + preds = torch.argmax(model_outputs.logits, -1) + acc_att = compute_accuracy(preds[:, :-1], labels_ids[:, 1:], ignore_label=-100) + stats["acc"] = acc_att + + stats["loss_pre"] = torch.clone(loss_pre.detach()) + stats["loss"] = torch.clone(loss.detach()) + stats["batch_size"] = batch_size + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + + audio_mask = kwargs.get("audio_mask", None) + audio_token_lengths = audio_mask.sum(-1) if audio_mask is not None else None + text_token_int = kwargs.get("text_token_int", None) + if audio_token_lengths is None and text_token_int is not None: + audio_token_lengths = torch.tensor([len(text_token_int)], dtype=torch.int64) + + batch = {"speech": speech, "speech_lengths": speech_lengths} + enc, enc_lens = self.audio_encoder.encode(**batch) + with autocast(False): + enc_mask = sequence_mask(enc_lens, enc.size(1), device=enc.device)[:, None, :] + pre_acoustic_embeds, pre_token_length, _, _ = self.audio_encoder.predictor( + enc, + mask=enc_mask, + target_label_length=audio_token_lengths, + ) + loss_pre = 0.0 + if audio_token_lengths is not None: + loss_pre = self.criterion_pre( + audio_token_lengths.type_as(pre_token_length), pre_token_length + ) + + return enc, enc_lens, pre_acoustic_embeds, pre_token_length, loss_pre + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + # Calc CTC loss + loss_ctc = self.ctc(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + + # Calc CER using CTC + cer_ctc = None + if not self.training and self.error_calculator is not None: + ys_hat = self.ctc.argmax(encoder_out).data + cer_ctc = self.error_calculator(ys_hat.cpu(), ys_pad.cpu(), is_ctc=True) + return loss_ctc, cer_ctc + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + prompt = kwargs.get("prompt", "Transcribe speech to text.") + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=None, + ) + if len(kwargs.get("data_type", [])) > 1: + audio_sample_list, text_token_int_list = audio_sample_list + text_token_int = text_token_int_list[0] + text_token_int = tokenizer.encode(text_token_int) + if text_token_int[0] == tokenizer.bos_token_id: + text_token_int = text_token_int[1:] + else: + text_token_int = None + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + res = self.encode(speech, speech_lengths, text_token_int=text_token_int) + encoder_out = res[0] + + # adaptor + encoder_out = self.adaptor(encoder_out) + + prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format(prompt) + prompt_ids = tokenizer.encode(prompt_pre) + if prompt_ids[0] == tokenizer.bos_token_id: + prompt_ids = prompt_ids[1:] + # prompt_ids = prompt_ids + [tokenizer.pad_token_id] + prompt_length = len(prompt_ids) + prompt_ids = torch.tensor(prompt_ids, dtype=torch.int64).to(kwargs["device"]) + pad = torch.tensor([tokenizer.pad_token_id], dtype=torch.int64).to(kwargs["device"]) + + if hasattr(self.llm.model, "embed_tokens"): + inputs_embeds = self.llm.model.embed_tokens(prompt_ids) + pad = self.llm.model.embed_tokens(pad) + elif hasattr(self.llm.model.model, "embed_tokens"): + inputs_embeds = self.llm.model.model.embed_tokens(prompt_ids) + else: + inputs_embeds = self.llm.model.model.model.embed_tokens(prompt_ids) + + # inputs_embeds = torch.cat((inputs_embeds[None, :, :], encoder_out, pad[None, :, :]), dim=1) # [prompt, audio, pad] + inputs_embeds = torch.cat( + (inputs_embeds[None, :, :], encoder_out), dim=1 + ) # [prompt, audio] + attention_mask = torch.ones(inputs_embeds.size()[:-1], dtype=torch.long).to( + kwargs["device"] + ) + + # model_outputs = self.llm.generate( + # inputs_embeds=inputs_embeds, + # max_length=kwargs.get("max_length", 200), + # max_new_tokens=kwargs.get("max_new_tokens", 200), + # num_beams=kwargs.get("num_beams", 4), + # do_sample=kwargs.get("do_sample", False), + # min_length=kwargs.get("min_length", 1), + # top_p=kwargs.get("top_p", 1.0), + # repetition_penalty=kwargs.get("repetition_penalty", 1.0), + # length_penalty=kwargs.get("length_penalty", 1.0), + # temperature=kwargs.get("temperature", 1.0), + # attention_mask=attention_mask, + # bos_token_id=tokenizer.bos_token_id, + # eos_token_id=tokenizer.eos_token_id, + # pad_token_id=tokenizer.pad_token_id + # ) + + model_outputs = self.llm( + inputs_embeds=inputs_embeds, attention_mask=attention_mask, labels=None + ) + preds = torch.argmax(model_outputs.logits, -1) + text = tokenizer.batch_decode(preds, add_special_tokens=False, skip_special_tokens=True) + + text = text[0].split(":")[-1] + text = text.strip() + if text.startswith("Please\n "): + text = text.replace("Please\n ", "") + text = text.strip() + + # preds = torch.argmax(model_outputs.logits, -1) + + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{0 + 1}best_recog"] + + results = [] + result_i = {"key": key[0], "text": text} + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["text"][key[0]] = text + + return results, meta_data diff --git a/funasr/models/lora/__init__.py b/funasr/models/lora/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/lora/layers.py b/funasr/models/lora/layers.py new file mode 100644 index 0000000..b91253d --- /dev/null +++ b/funasr/models/lora/layers.py @@ -0,0 +1,342 @@ +# ------------------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. +# ------------------------------------------------------------------------------------------ +import torch +import torch.nn as nn +import torch.nn.functional as F + +import math +from typing import Optional, List + + +class LoRALayer: + def __init__( + self, + r: int, + lora_alpha: int, + lora_dropout: float, + merge_weights: bool, + ): + self.r = r + self.lora_alpha = lora_alpha + # Optional dropout + if lora_dropout > 0.0: + self.lora_dropout = nn.Dropout(p=lora_dropout) + else: + self.lora_dropout = lambda x: x + # Mark the weight as unmerged + self.merged = False + self.merge_weights = merge_weights + + +class Embedding(nn.Embedding, LoRALayer): + # LoRA implemented in a dense layer + def __init__( + self, + num_embeddings: int, + embedding_dim: int, + r: int = 0, + lora_alpha: int = 1, + merge_weights: bool = True, + **kwargs + ): + nn.Embedding.__init__(self, num_embeddings, embedding_dim, **kwargs) + LoRALayer.__init__( + self, r=r, lora_alpha=lora_alpha, lora_dropout=0, merge_weights=merge_weights + ) + # Actual trainable parameters + if r > 0: + self.lora_A = nn.Parameter(self.weight.new_zeros((r, num_embeddings))) + self.lora_B = nn.Parameter(self.weight.new_zeros((embedding_dim, r))) + self.scaling = self.lora_alpha / self.r + # Freezing the pre-trained weight matrix + self.weight.requires_grad = False + self.reset_parameters() + + def reset_parameters(self): + nn.Embedding.reset_parameters(self) + if hasattr(self, "lora_A"): + # initialize A the same way as the default for nn.Linear and B to zero + nn.init.zeros_(self.lora_A) + nn.init.normal_(self.lora_B) + + def train(self, mode: bool = True): + nn.Embedding.train(self, mode) + if self.merge_weights and self.merged: + # Make sure that the weights are not merged + if self.r > 0: + self.weight.data -= (self.lora_B @ self.lora_A).T * self.scaling + self.merged = False + + def eval(self): + nn.Linear.eval(self) + if self.merge_weights and not self.merged: + # Merge the weights and mark it + if self.r > 0: + self.weight.data += (self.lora_B @ self.lora_A) * self.scaling + self.merged = True + + def forward(self, x: torch.Tensor): + if self.r > 0 and not self.merged: + result = nn.Embedding.forward(self, x) + if self.r > 0: + after_A = F.embedding( + x, + self.lora_A.T, + self.padding_idx, + self.max_norm, + self.norm_type, + self.scale_grad_by_freq, + self.sparse, + ) + result += (after_A @ self.lora_B.T) * self.scaling + return result + else: + return nn.Embedding.forward(self, x) + + +class Linear(nn.Linear, LoRALayer): + # LoRA implemented in a dense layer + def __init__( + self, + in_features: int, + out_features: int, + r: int = 0, + lora_alpha: int = 1, + lora_dropout: float = 0.0, + fan_in_fan_out: bool = False, # Set this to True if the layer to replace stores weight like (fan_in, fan_out) + merge_weights: bool = True, + **kwargs + ): + nn.Linear.__init__(self, in_features, out_features, **kwargs) + LoRALayer.__init__( + self, r=r, lora_alpha=lora_alpha, lora_dropout=lora_dropout, merge_weights=merge_weights + ) + + self.fan_in_fan_out = fan_in_fan_out + # Actual trainable parameters + if r > 0: + self.lora_A = nn.Parameter(self.weight.new_zeros((r, in_features))) + self.lora_B = nn.Parameter(self.weight.new_zeros((out_features, r))) + self.scaling = self.lora_alpha / self.r + # Freezing the pre-trained weight matrix + self.weight.requires_grad = False + self.reset_parameters() + if fan_in_fan_out: + self.weight.data = self.weight.data.T + + def reset_parameters(self): + nn.Linear.reset_parameters(self) + if hasattr(self, "lora_A"): + # initialize A the same way as the default for nn.Linear and B to zero + nn.init.kaiming_uniform_(self.lora_A, a=math.sqrt(5)) + nn.init.zeros_(self.lora_B) + + def train(self, mode: bool = True): + def T(w): + return w.T if self.fan_in_fan_out else w + + nn.Linear.train(self, mode) + if self.merge_weights and self.merged: + # Make sure that the weights are not merged + if self.r > 0: + self.weight.data -= T(self.lora_B @ self.lora_A) * self.scaling + self.merged = False + + def eval(self): + def T(w): + return w.T if self.fan_in_fan_out else w + + nn.Linear.eval(self) + if self.merge_weights and not self.merged: + # Merge the weights and mark it + if self.r > 0: + self.weight.data += T(self.lora_B @ self.lora_A) * self.scaling + self.merged = True + + def forward(self, x: torch.Tensor): + def T(w): + return w.T if self.fan_in_fan_out else w + + if self.r > 0 and not self.merged: + result = F.linear(x, T(self.weight), bias=self.bias) + if self.r > 0: + result += (self.lora_dropout(x) @ self.lora_A.T @ self.lora_B.T) * self.scaling + return result + else: + return F.linear(x, T(self.weight), bias=self.bias) + + +class MergedLinear(nn.Linear, LoRALayer): + # LoRA implemented in a dense layer + def __init__( + self, + in_features: int, + out_features: int, + r: int = 0, + lora_alpha: int = 1, + lora_dropout: float = 0.0, + enable_lora: List[bool] = [False], + fan_in_fan_out: bool = False, + merge_weights: bool = True, + **kwargs + ): + nn.Linear.__init__(self, in_features, out_features, **kwargs) + LoRALayer.__init__( + self, r=r, lora_alpha=lora_alpha, lora_dropout=lora_dropout, merge_weights=merge_weights + ) + assert ( + out_features % len(enable_lora) == 0 + ), "The length of enable_lora must divide out_features" + self.enable_lora = enable_lora + self.fan_in_fan_out = fan_in_fan_out + # Actual trainable parameters + if r > 0 and any(enable_lora): + self.lora_A = nn.Parameter(self.weight.new_zeros((r * sum(enable_lora), in_features))) + self.lora_B = nn.Parameter( + self.weight.new_zeros((out_features // len(enable_lora) * sum(enable_lora), r)) + ) # weights for Conv1D with groups=sum(enable_lora) + self.scaling = self.lora_alpha / self.r + # Freezing the pre-trained weight matrix + self.weight.requires_grad = False + # Compute the indices + self.lora_ind = self.weight.new_zeros((out_features,), dtype=torch.bool).view( + len(enable_lora), -1 + ) + self.lora_ind[enable_lora, :] = True + self.lora_ind = self.lora_ind.view(-1) + self.reset_parameters() + if fan_in_fan_out: + self.weight.data = self.weight.data.T + + def reset_parameters(self): + nn.Linear.reset_parameters(self) + if hasattr(self, "lora_A"): + # initialize A the same way as the default for nn.Linear and B to zero + nn.init.kaiming_uniform_(self.lora_A, a=math.sqrt(5)) + nn.init.zeros_(self.lora_B) + + def zero_pad(self, x): + result = x.new_zeros((*x.shape[:-1], self.out_features)) + result = result.view(-1, self.out_features) + result[:, self.lora_ind] = x.reshape( + -1, self.out_features // len(self.enable_lora) * sum(self.enable_lora) + ) + return result.view((*x.shape[:-1], self.out_features)) + + def train(self, mode: bool = True): + def T(w): + return w.T if self.fan_in_fan_out else w + + nn.Linear.train(self, mode) + if self.merge_weights and self.merged: + # Make sure that the weights are not merged + if self.r > 0 and any(self.enable_lora): + delta_w = F.conv1d( + self.lora_A.data.unsqueeze(0), + self.lora_B.data.unsqueeze(-1), + groups=sum(self.enable_lora), + ).squeeze(0) + self.weight.data -= self.zero_pad(T(delta_w * self.scaling)) + self.merged = False + + def eval(self): + def T(w): + return w.T if self.fan_in_fan_out else w + + nn.Linear.eval(self) + if self.merge_weights and not self.merged: + # Merge the weights and mark it + if self.r > 0 and any(self.enable_lora): + delta_w = F.conv1d( + self.lora_A.data.unsqueeze(0), + self.lora_B.data.unsqueeze(-1), + groups=sum(self.enable_lora), + ).squeeze(0) + self.weight.data += self.zero_pad(T(delta_w * self.scaling)) + self.merged = True + + def forward(self, x: torch.Tensor): + def T(w): + return w.T if self.fan_in_fan_out else w + + if self.merged: + return F.linear(x, T(self.weight), bias=self.bias) + else: + result = F.linear(x, T(self.weight), bias=self.bias) + if self.r > 0: + after_A = F.linear(self.lora_dropout(x), self.lora_A) + after_B = F.conv1d( + after_A.transpose(-2, -1), + self.lora_B.unsqueeze(-1), + groups=sum(self.enable_lora), + ).transpose(-2, -1) + result += self.zero_pad(after_B) * self.scaling + return result + + +class Conv2d(nn.Conv2d, LoRALayer): + # LoRA implemented in a dense layer + def __init__( + self, + in_channels: int, + out_channels: int, + kernel_size: int, + r: int = 0, + lora_alpha: int = 1, + lora_dropout: float = 0.0, + merge_weights: bool = True, + **kwargs + ): + nn.Conv2d.__init__(self, in_channels, out_channels, kernel_size, **kwargs) + LoRALayer.__init__( + self, r=r, lora_alpha=lora_alpha, lora_dropout=lora_dropout, merge_weights=merge_weights + ) + assert type(kernel_size) is int + # Actual trainable parameters + if r > 0: + self.lora_A = nn.Parameter( + self.weight.new_zeros((r * kernel_size, in_channels * kernel_size)) + ) + self.lora_B = nn.Parameter( + self.weight.new_zeros((out_channels * kernel_size, r * kernel_size)) + ) + self.scaling = self.lora_alpha / self.r + # Freezing the pre-trained weight matrix + self.weight.requires_grad = False + self.reset_parameters() + + def reset_parameters(self): + nn.Conv2d.reset_parameters(self) + if hasattr(self, "lora_A"): + # initialize A the same way as the default for nn.Linear and B to zero + nn.init.kaiming_uniform_(self.lora_A, a=math.sqrt(5)) + nn.init.zeros_(self.lora_B) + + def train(self, mode: bool = True): + nn.Conv2d.train(self, mode) + if self.merge_weights and self.merged: + # Make sure that the weights are not merged + self.weight.data -= (self.lora_B @ self.lora_A).view(self.weight.shape) * self.scaling + self.merged = False + + def eval(self): + nn.Conv2d.eval(self) + if self.merge_weights and not self.merged: + # Merge the weights and mark it + self.weight.data += (self.lora_B @ self.lora_A).view(self.weight.shape) * self.scaling + self.merged = True + + def forward(self, x: torch.Tensor): + if self.r > 0 and not self.merged: + return F.conv2d( + x, + self.weight + (self.lora_B @ self.lora_A).view(self.weight.shape) * self.scaling, + self.bias, + self.stride, + self.padding, + self.dilation, + self.groups, + ) + return nn.Conv2d.forward(self, x) diff --git a/funasr/models/lora/utils.py b/funasr/models/lora/utils.py new file mode 100644 index 0000000..670c1dc --- /dev/null +++ b/funasr/models/lora/utils.py @@ -0,0 +1,47 @@ +# ------------------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. +# ------------------------------------------------------------------------------------------ +import torch +import torch.nn as nn + +from typing import Dict + +from .layers import LoRALayer + + +def mark_only_lora_as_trainable(model: nn.Module, bias: str = "none") -> None: + for n, p in model.named_parameters(): + if "lora_" not in n and "cif" not in n: + p.requires_grad = False + if bias == "none": + return + elif bias == "all": + for n, p in model.named_parameters(): + if "bias" in n: + p.requires_grad = True + elif bias == "lora_only": + for m in model.modules(): + if isinstance(m, LoRALayer) and hasattr(m, "bias") and m.bias is not None: + m.bias.requires_grad = True + else: + raise NotImplementedError + + +def lora_state_dict(model: nn.Module, bias: str = "none") -> Dict[str, torch.Tensor]: + my_state_dict = model.state_dict() + if bias == "none": + return {k: my_state_dict[k] for k in my_state_dict if "lora_" in k} + elif bias == "all": + return {k: my_state_dict[k] for k in my_state_dict if "lora_" in k or "bias" in k} + elif bias == "lora_only": + to_return = {} + for k in my_state_dict: + if "lora_" in k: + to_return[k] = my_state_dict[k] + bias_name = k.split("lora_")[0] + "bias" + if bias_name in my_state_dict: + to_return[bias_name] = my_state_dict[bias_name] + return to_return + else: + raise NotImplementedError diff --git a/funasr/models/mfcca/__init__.py b/funasr/models/mfcca/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/mfcca/e2e_asr_mfcca.py b/funasr/models/mfcca/e2e_asr_mfcca.py new file mode 100644 index 0000000..681d1f6 --- /dev/null +++ b/funasr/models/mfcca/e2e_asr_mfcca.py @@ -0,0 +1,320 @@ +from contextlib import contextmanager +from distutils.version import LooseVersion +from typing import Dict +from typing import List +from typing import Optional +from typing import Tuple +from typing import Union +import logging +import torch + +from funasr.metrics import ErrorCalculator +from funasr.metrics.compute_acc import th_accuracy +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.losses.label_smoothing_loss import ( + LabelSmoothingLoss, # noqa: H301 +) +from funasr.models.ctc import CTC +from funasr.models.decoder.abs_decoder import AbsDecoder +from funasr.models.encoder.abs_encoder import AbsEncoder +from funasr.frontends.abs_frontend import AbsFrontend +from funasr.models.preencoder.abs_preencoder import AbsPreEncoder +from funasr.models.specaug.abs_specaug import AbsSpecAug +from funasr.layers.abs_normalize import AbsNormalize +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.base_model import FunASRModel + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +import pdb +import random +import math + + +class MFCCA(FunASRModel): + """ + Author: Audio, Speech and Language Processing Group (ASLP@NPU), Northwestern Polytechnical University + MFCCA:Multi-Frame Cross-Channel attention for multi-speaker ASR in Multi-party meeting scenario + https://arxiv.org/abs/2210.05265 + """ + + def __init__( + self, + vocab_size: int, + token_list: Union[Tuple[str, ...], List[str]], + frontend: Optional[AbsFrontend], + specaug: Optional[AbsSpecAug], + normalize: Optional[AbsNormalize], + encoder: AbsEncoder, + decoder: AbsDecoder, + ctc: CTC, + rnnt_decoder: None = None, + ctc_weight: float = 0.5, + ignore_id: int = -1, + lsm_weight: float = 0.0, + mask_ratio: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + preencoder: Optional[AbsPreEncoder] = None, + ): + assert 0.0 <= ctc_weight <= 1.0, ctc_weight + assert rnnt_decoder is None, "Not implemented" + + super().__init__() + # note that eos is the same as sos (equivalent ID) + self.sos = vocab_size - 1 + self.eos = vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.ctc_weight = ctc_weight + self.token_list = token_list.copy() + + self.mask_ratio = mask_ratio + + self.frontend = frontend + self.specaug = specaug + self.normalize = normalize + self.preencoder = preencoder + self.encoder = encoder + # we set self.decoder = None in the CTC mode since + # self.decoder parameters were never used and PyTorch complained + # and threw an Exception in the multi-GPU experiment. + # thanks Jeff Farris for pointing out the issue. + if ctc_weight == 1.0: + self.decoder = None + else: + self.decoder = decoder + if ctc_weight == 0.0: + self.ctc = None + else: + self.ctc = ctc + self.rnnt_decoder = rnnt_decoder + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + + if report_cer or report_wer: + self.error_calculator = ErrorCalculator( + token_list, sym_space, sym_blank, report_cer, report_wer + ) + else: + self.error_calculator = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + assert text_lengths.dim() == 1, text_lengths.shape + # Check that batch_size is unified + assert ( + speech.shape[0] == speech_lengths.shape[0] == text.shape[0] == text_lengths.shape[0] + ), (speech.shape, speech_lengths.shape, text.shape, text_lengths.shape) + # pdb.set_trace() + if speech.dim() == 3 and speech.size(2) == 8 and self.mask_ratio != 0: + rate_num = random.random() + # rate_num = 0.1 + if rate_num <= self.mask_ratio: + retain_channel = math.ceil(random.random() * 8) + if retain_channel > 1: + speech = speech[:, :, torch.randperm(8)[0:retain_channel].sort().values] + else: + speech = speech[:, :, torch.randperm(8)[0]] + # pdb.set_trace() + batch_size = speech.shape[0] + # for data-parallel + text = text[:, : text_lengths.max()] + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + # 2a. Attention-decoder branch + if self.ctc_weight == 1.0: + loss_att, acc_att, cer_att, wer_att = None, None, None, None + else: + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 2b. CTC branch + if self.ctc_weight == 0.0: + loss_ctc, cer_ctc = None, None + else: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 2c. RNN-T branch + if self.rnnt_decoder is not None: + _ = self._calc_rnnt_loss(encoder_out, encoder_out_lens, text, text_lengths) + + if self.ctc_weight == 0.0: + loss = loss_att + elif self.ctc_weight == 1.0: + loss = loss_ctc + else: + loss = self.ctc_weight * loss_ctc + (1 - self.ctc_weight) * loss_att + + stats = dict( + loss=loss.detach(), + loss_att=loss_att.detach() if loss_att is not None else None, + loss_ctc=loss_ctc.detach() if loss_ctc is not None else None, + acc=acc_att, + cer=cer_att, + wer=wer_att, + cer_ctc=cer_ctc, + ) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def collect_feats( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + ) -> Dict[str, torch.Tensor]: + feats, feats_lengths, channel_size = self._extract_feats(speech, speech_lengths) + return {"feats": feats, "feats_lengths": feats_lengths} + + def encode( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + with autocast(False): + # 1. Extract feats + feats, feats_lengths, channel_size = self._extract_feats(speech, speech_lengths) + # 2. Data augmentation + if self.specaug is not None and self.training: + feats, feats_lengths = self.specaug(feats, feats_lengths) + + # 3. Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + feats, feats_lengths = self.normalize(feats, feats_lengths) + + # Pre-encoder, e.g. used for raw input data + if self.preencoder is not None: + feats, feats_lengths = self.preencoder(feats, feats_lengths) + # pdb.set_trace() + encoder_out, encoder_out_lens, _ = self.encoder(feats, feats_lengths, channel_size) + + assert encoder_out.size(0) == speech.size(0), ( + encoder_out.size(), + speech.size(0), + ) + if encoder_out.dim() == 4: + assert encoder_out.size(2) <= encoder_out_lens.max(), ( + encoder_out.size(), + encoder_out_lens.max(), + ) + else: + assert encoder_out.size(1) <= encoder_out_lens.max(), ( + encoder_out.size(), + encoder_out_lens.max(), + ) + + return encoder_out, encoder_out_lens + + def _extract_feats( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + assert speech_lengths.dim() == 1, speech_lengths.shape + # for data-parallel + speech = speech[:, : speech_lengths.max()] + if self.frontend is not None: + # Frontend + # e.g. STFT and Feature extract + # data_loader may send time-domain signal in this case + # speech (Batch, NSamples) -> feats: (Batch, NFrames, Dim) + feats, feats_lengths, channel_size = self.frontend(speech, speech_lengths) + else: + # No frontend and no feature extract + feats, feats_lengths = speech, speech_lengths + channel_size = 1 + return feats, feats_lengths, channel_size + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, _ = self.decoder(encoder_out, encoder_out_lens, ys_in_pad, ys_in_lens) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + # Calc CTC loss + if encoder_out.dim() == 4: + encoder_out = encoder_out.mean(1) + loss_ctc = self.ctc(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + + # Calc CER using CTC + cer_ctc = None + if not self.training and self.error_calculator is not None: + ys_hat = self.ctc.argmax(encoder_out).data + cer_ctc = self.error_calculator(ys_hat.cpu(), ys_pad.cpu(), is_ctc=True) + return loss_ctc, cer_ctc + + def _calc_rnnt_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + raise NotImplementedError diff --git a/funasr/models/mfcca/encoder_layer_mfcca.py b/funasr/models/mfcca/encoder_layer_mfcca.py new file mode 100644 index 0000000..f16a4e6 --- /dev/null +++ b/funasr/models/mfcca/encoder_layer_mfcca.py @@ -0,0 +1,273 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2020 Johns Hopkins University (Shinji Watanabe) +# Northwestern Polytechnical University (Pengcheng Guo) +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Encoder self-attention layer definition.""" + +import torch + +from torch import nn + +from funasr.models.transformer.layer_norm import LayerNorm +from torch.autograd import Variable + + +class Encoder_Conformer_Layer(nn.Module): + """Encoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` instance + can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + feed_forward_macaron (torch.nn.Module): Additional feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + conv_module (torch.nn.Module): Convolution module instance. + `ConvlutionModule` instance can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + """ + + def __init__( + self, + size, + self_attn, + feed_forward, + feed_forward_macaron, + conv_module, + dropout_rate, + normalize_before=True, + concat_after=False, + cca_pos=0, + ): + """Construct an Encoder_Conformer_Layer object.""" + super(Encoder_Conformer_Layer, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.feed_forward_macaron = feed_forward_macaron + self.conv_module = conv_module + self.norm_ff = LayerNorm(size) # for the FNN module + self.norm_mha = LayerNorm(size) # for the MHA module + if feed_forward_macaron is not None: + self.norm_ff_macaron = LayerNorm(size) + self.ff_scale = 0.5 + else: + self.ff_scale = 1.0 + if self.conv_module is not None: + self.norm_conv = LayerNorm(size) # for the CNN module + self.norm_final = LayerNorm(size) # for the final output of the block + self.dropout = nn.Dropout(dropout_rate) + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + self.cca_pos = cca_pos + + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + + def forward(self, x_input, mask, cache=None): + """Compute encoded features. + + Args: + x_input (Union[Tuple, torch.Tensor]): Input tensor w/ or w/o pos emb. + - w/ pos emb: Tuple of tensors [(#batch, time, size), (1, time, size)]. + - w/o pos emb: Tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + if isinstance(x_input, tuple): + x, pos_emb = x_input[0], x_input[1] + else: + x, pos_emb = x_input, None + # whether to use macaron style + if self.feed_forward_macaron is not None: + residual = x + if self.normalize_before: + x = self.norm_ff_macaron(x) + x = residual + self.ff_scale * self.dropout(self.feed_forward_macaron(x)) + if not self.normalize_before: + x = self.norm_ff_macaron(x) + + # multi-headed self-attention module + residual = x + if self.normalize_before: + x = self.norm_mha(x) + + if cache is None: + x_q = x + else: + assert cache.shape == (x.shape[0], x.shape[1] - 1, self.size) + x_q = x[:, -1:, :] + residual = residual[:, -1:, :] + mask = None if mask is None else mask[:, -1:, :] + + if self.cca_pos < 2: + if pos_emb is not None: + x_att = self.self_attn(x_q, x, x, pos_emb, mask) + else: + x_att = self.self_attn(x_q, x, x, mask) + else: + x_att = self.self_attn(x_q, x, x, mask) + + if self.concat_after: + x_concat = torch.cat((x, x_att), dim=-1) + x = residual + self.concat_linear(x_concat) + else: + x = residual + self.dropout(x_att) + if not self.normalize_before: + x = self.norm_mha(x) + + # convolution module + if self.conv_module is not None: + residual = x + if self.normalize_before: + x = self.norm_conv(x) + x = residual + self.dropout(self.conv_module(x)) + if not self.normalize_before: + x = self.norm_conv(x) + + # feed forward module + residual = x + if self.normalize_before: + x = self.norm_ff(x) + x = residual + self.ff_scale * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm_ff(x) + + if self.conv_module is not None: + x = self.norm_final(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + if pos_emb is not None: + return (x, pos_emb), mask + + return x, mask + + +class EncoderLayer(nn.Module): + """Encoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` instance + can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + feed_forward_macaron (torch.nn.Module): Additional feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + conv_module (torch.nn.Module): Convolution module instance. + `ConvlutionModule` instance can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + """ + + def __init__( + self, + size, + self_attn_cros_channel, + self_attn_conformer, + feed_forward_csa, + feed_forward_macaron_csa, + conv_module_csa, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayer, self).__init__() + + self.encoder_cros_channel_atten = self_attn_cros_channel + self.encoder_csa = Encoder_Conformer_Layer( + size, + self_attn_conformer, + feed_forward_csa, + feed_forward_macaron_csa, + conv_module_csa, + dropout_rate, + normalize_before, + concat_after, + cca_pos=0, + ) + self.norm_mha = LayerNorm(size) # for the MHA module + self.dropout = nn.Dropout(dropout_rate) + + def forward(self, x_input, mask, channel_size, cache=None): + """Compute encoded features. + + Args: + x_input (Union[Tuple, torch.Tensor]): Input tensor w/ or w/o pos emb. + - w/ pos emb: Tuple of tensors [(#batch, time, size), (1, time, size)]. + - w/o pos emb: Tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + if isinstance(x_input, tuple): + x, pos_emb = x_input[0], x_input[1] + else: + x, pos_emb = x_input, None + residual = x + x = self.norm_mha(x) + t_leng = x.size(1) + d_dim = x.size(2) + x_new = x.reshape(-1, channel_size, t_leng, d_dim).transpose(1, 2) # x_new B*T * C * D + x_k_v = x_new.new(x_new.size(0), x_new.size(1), 5, x_new.size(2), x_new.size(3)) + pad_before = Variable(torch.zeros(x_new.size(0), 2, x_new.size(2), x_new.size(3))).type( + x_new.type() + ) + pad_after = Variable(torch.zeros(x_new.size(0), 2, x_new.size(2), x_new.size(3))).type( + x_new.type() + ) + x_pad = torch.cat([pad_before, x_new, pad_after], 1) + x_k_v[:, :, 0, :, :] = x_pad[:, 0:-4, :, :] + x_k_v[:, :, 1, :, :] = x_pad[:, 1:-3, :, :] + x_k_v[:, :, 2, :, :] = x_pad[:, 2:-2, :, :] + x_k_v[:, :, 3, :, :] = x_pad[:, 3:-1, :, :] + x_k_v[:, :, 4, :, :] = x_pad[:, 4:, :, :] + x_new = x_new.reshape(-1, channel_size, d_dim) + x_k_v = x_k_v.reshape(-1, 5 * channel_size, d_dim) + x_att = self.encoder_cros_channel_atten(x_new, x_k_v, x_k_v, None) + x_att = ( + x_att.reshape(-1, t_leng, channel_size, d_dim) + .transpose(1, 2) + .reshape(-1, t_leng, d_dim) + ) + x = residual + self.dropout(x_att) + if pos_emb is not None: + x_input = (x, pos_emb) + else: + x_input = x + x_input, mask = self.encoder_csa(x_input, mask) + + return x_input, mask, channel_size diff --git a/funasr/models/mfcca/mfcca_encoder.py b/funasr/models/mfcca/mfcca_encoder.py new file mode 100644 index 0000000..19a6df9 --- /dev/null +++ b/funasr/models/mfcca/mfcca_encoder.py @@ -0,0 +1,430 @@ +from typing import Optional +from typing import Tuple + +import logging +import torch +from torch import nn + + +from funasr.models.encoder.encoder_layer_mfcca import EncoderLayer +from funasr.models.transformer.utils.nets_utils import get_activation +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.attention import ( + MultiHeadedAttention, # noqa: H301 + RelPositionMultiHeadedAttention, # noqa: H301 + LegacyRelPositionMultiHeadedAttention, # noqa: H301 +) +from funasr.models.transformer.embedding import ( + PositionalEncoding, # noqa: H301 + ScaledPositionalEncoding, # noqa: H301 + RelPositionalEncoding, # noqa: H301 + LegacyRelPositionalEncoding, # noqa: H301 +) +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling2 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling6 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling8 +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.utils.subsampling import check_short_utt +from funasr.models.encoder.abs_encoder import AbsEncoder +import pdb +import math + + +class ConvolutionModule(nn.Module): + """ConvolutionModule in Conformer model. + Args: + channels (int): The number of channels of conv layers. + kernel_size (int): Kernerl size of conv layers. + """ + + def __init__(self, channels, kernel_size, activation=nn.ReLU(), bias=True): + """Construct an ConvolutionModule object.""" + super(ConvolutionModule, self).__init__() + # kernerl_size should be a odd number for 'SAME' padding + assert (kernel_size - 1) % 2 == 0 + + self.pointwise_conv1 = nn.Conv1d( + channels, + 2 * channels, + kernel_size=1, + stride=1, + padding=0, + bias=bias, + ) + self.depthwise_conv = nn.Conv1d( + channels, + channels, + kernel_size, + stride=1, + padding=(kernel_size - 1) // 2, + groups=channels, + bias=bias, + ) + self.norm = nn.BatchNorm1d(channels) + self.pointwise_conv2 = nn.Conv1d( + channels, + channels, + kernel_size=1, + stride=1, + padding=0, + bias=bias, + ) + self.activation = activation + + def forward(self, x): + """Compute convolution module. + Args: + x (torch.Tensor): Input tensor (#batch, time, channels). + Returns: + torch.Tensor: Output tensor (#batch, time, channels). + """ + # exchange the temporal dimension and the feature dimension + x = x.transpose(1, 2) + + # GLU mechanism + x = self.pointwise_conv1(x) # (batch, 2*channel, dim) + x = nn.functional.glu(x, dim=1) # (batch, channel, dim) + + # 1D Depthwise Conv + x = self.depthwise_conv(x) + x = self.activation(self.norm(x)) + + x = self.pointwise_conv2(x) + + return x.transpose(1, 2) + + +class MFCCAEncoder(AbsEncoder): + """Conformer encoder module. + Args: + input_size (int): Input dimension. + output_size (int): Dimention of attention. + attention_heads (int): The number of heads of multi head attention. + linear_units (int): The number of units of position-wise feed forward. + num_blocks (int): The number of decoder blocks. + dropout_rate (float): Dropout rate. + attention_dropout_rate (float): Dropout rate in attention. + positional_dropout_rate (float): Dropout rate after adding positional encoding. + input_layer (Union[str, torch.nn.Module]): Input layer type. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + If True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + If False, no additional linear will be applied. i.e. x -> x + att(x) + positionwise_layer_type (str): "linear", "conv1d", or "conv1d-linear". + positionwise_conv_kernel_size (int): Kernel size of positionwise conv1d layer. + rel_pos_type (str): Whether to use the latest relative positional encoding or + the legacy one. The legacy relative positional encoding will be deprecated + in the future. More Details can be found in + https://github.com/espnet/espnet/pull/2816. + encoder_pos_enc_layer_type (str): Encoder positional encoding layer type. + encoder_attn_layer_type (str): Encoder attention layer type. + activation_type (str): Encoder activation function type. + macaron_style (bool): Whether to use macaron style for positionwise layer. + use_cnn_module (bool): Whether to use convolution module. + zero_triu (bool): Whether to zero the upper triangular part of attention matrix. + cnn_module_kernel (int): Kernerl size of convolution module. + padding_idx (int): Padding idx for input_layer=embed. + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: str = "conv2d", + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 3, + macaron_style: bool = False, + rel_pos_type: str = "legacy", + pos_enc_layer_type: str = "rel_pos", + selfattention_layer_type: str = "rel_selfattn", + activation_type: str = "swish", + use_cnn_module: bool = True, + zero_triu: bool = False, + cnn_module_kernel: int = 31, + padding_idx: int = -1, + ): + super().__init__() + self._output_size = output_size + + if rel_pos_type == "legacy": + if pos_enc_layer_type == "rel_pos": + pos_enc_layer_type = "legacy_rel_pos" + if selfattention_layer_type == "rel_selfattn": + selfattention_layer_type = "legacy_rel_selfattn" + elif rel_pos_type == "latest": + assert selfattention_layer_type != "legacy_rel_selfattn" + assert pos_enc_layer_type != "legacy_rel_pos" + else: + raise ValueError("unknown rel_pos_type: " + rel_pos_type) + + activation = get_activation(activation_type) + if pos_enc_layer_type == "abs_pos": + pos_enc_class = PositionalEncoding + elif pos_enc_layer_type == "scaled_abs_pos": + pos_enc_class = ScaledPositionalEncoding + elif pos_enc_layer_type == "rel_pos": + assert selfattention_layer_type == "rel_selfattn" + pos_enc_class = RelPositionalEncoding + elif pos_enc_layer_type == "legacy_rel_pos": + assert selfattention_layer_type == "legacy_rel_selfattn" + pos_enc_class = LegacyRelPositionalEncoding + logging.warning("Using legacy_rel_pos and it will be deprecated in the future.") + else: + raise ValueError("unknown pos_enc_layer: " + pos_enc_layer_type) + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8( + input_size, + output_size, + dropout_rate, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif isinstance(input_layer, torch.nn.Module): + self.embed = torch.nn.Sequential( + input_layer, + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer is None: + self.embed = torch.nn.Sequential(pos_enc_class(output_size, positional_dropout_rate)) + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + activation, + ) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + + if selfattention_layer_type == "selfattn": + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + elif selfattention_layer_type == "legacy_rel_selfattn": + assert pos_enc_layer_type == "legacy_rel_pos" + encoder_selfattn_layer = LegacyRelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + logging.warning("Using legacy_rel_selfattn and it will be deprecated in the future.") + elif selfattention_layer_type == "rel_selfattn": + assert pos_enc_layer_type == "rel_pos" + encoder_selfattn_layer = RelPositionMultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + zero_triu, + ) + else: + raise ValueError("unknown encoder_attn_layer: " + selfattention_layer_type) + + convolution_layer = ConvolutionModule + convolution_layer_args = (output_size, cnn_module_kernel, activation) + encoder_selfattn_layer_raw = MultiHeadedAttention + encoder_selfattn_layer_args_raw = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + self.encoders = repeat( + num_blocks, + lambda lnum: EncoderLayer( + output_size, + encoder_selfattn_layer_raw(*encoder_selfattn_layer_args_raw), + encoder_selfattn_layer(*encoder_selfattn_layer_args), + positionwise_layer(*positionwise_layer_args), + positionwise_layer(*positionwise_layer_args) if macaron_style else None, + convolution_layer(*convolution_layer_args) if use_cnn_module else None, + dropout_rate, + normalize_before, + concat_after, + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + self.conv1 = torch.nn.Conv2d(8, 16, [5, 7], stride=[1, 1], padding=(2, 3)) + + self.conv2 = torch.nn.Conv2d(16, 32, [5, 7], stride=[1, 1], padding=(2, 3)) + + self.conv3 = torch.nn.Conv2d(32, 16, [5, 7], stride=[1, 1], padding=(2, 3)) + + self.conv4 = torch.nn.Conv2d(16, 1, [5, 7], stride=[1, 1], padding=(2, 3)) + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + channel_size: torch.Tensor, + prev_states: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Calculate forward propagation. + Args: + xs_pad (torch.Tensor): Input tensor (#batch, L, input_size). + ilens (torch.Tensor): Input length (#batch). + prev_states (torch.Tensor): Not to be used now. + Returns: + torch.Tensor: Output tensor (#batch, L, output_size). + torch.Tensor: Output length (#batch). + torch.Tensor: Not to be used now. + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + if ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + xs_pad, masks, channel_size = self.encoders(xs_pad, masks, channel_size) + if isinstance(xs_pad, tuple): + xs_pad = xs_pad[0] + + t_leng = xs_pad.size(1) + d_dim = xs_pad.size(2) + xs_pad = xs_pad.reshape(-1, channel_size, t_leng, d_dim) + # pdb.set_trace() + if channel_size < 8: + repeat_num = math.ceil(8 / channel_size) + xs_pad = xs_pad.repeat(1, repeat_num, 1, 1)[:, 0:8, :, :] + xs_pad = self.conv1(xs_pad) + xs_pad = self.conv2(xs_pad) + xs_pad = self.conv3(xs_pad) + xs_pad = self.conv4(xs_pad) + xs_pad = xs_pad.squeeze().reshape(-1, t_leng, d_dim) + mask_tmp = masks.size(1) + masks = masks.reshape(-1, channel_size, mask_tmp, t_leng)[:, 0, :, :] + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + olens = masks.squeeze(1).sum(1) + return xs_pad, olens, None + + def forward_hidden( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Calculate forward propagation. + Args: + xs_pad (torch.Tensor): Input tensor (#batch, L, input_size). + ilens (torch.Tensor): Input length (#batch). + prev_states (torch.Tensor): Not to be used now. + Returns: + torch.Tensor: Output tensor (#batch, L, output_size). + torch.Tensor: Output length (#batch). + torch.Tensor: Not to be used now. + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + if ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + num_layer = len(self.encoders) + for idx, encoder in enumerate(self.encoders): + xs_pad, masks = encoder(xs_pad, masks) + if idx == num_layer // 2 - 1: + hidden_feature = xs_pad + if isinstance(xs_pad, tuple): + xs_pad = xs_pad[0] + hidden_feature = hidden_feature[0] + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + self.hidden_feature = self.after_norm(hidden_feature) + + olens = masks.squeeze(1).sum(1) + return xs_pad, olens, None diff --git a/funasr/models/model_hf/__init__.py b/funasr/models/model_hf/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/monotonic_aligner/__init__.py b/funasr/models/monotonic_aligner/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/monotonic_aligner/model.py b/funasr/models/monotonic_aligner/model.py new file mode 100644 index 0000000..4754d1f --- /dev/null +++ b/funasr/models/monotonic_aligner/model.py @@ -0,0 +1,231 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import time +import copy +import torch +from torch.cuda.amp import autocast +from typing import Union, Dict, List, Tuple, Optional + +from funasr.register import tables +from funasr.models.ctc.ctc import CTC +from funasr.utils import postprocess_utils +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.cif_predictor import mae_loss +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.utils.timestamp_tools import ts_prediction_lfr6_standard +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + + +@tables.register("model_classes", "MonotonicAligner") +class MonotonicAligner(torch.nn.Module): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Achieving timestamp prediction while recognizing with non-autoregressive end-to-end ASR model + https://arxiv.org/abs/2301.12343 + """ + + def __init__( + self, + input_size: int = 80, + specaug: Optional[str] = None, + specaug_conf: Optional[Dict] = None, + normalize: str = None, + normalize_conf: Optional[Dict] = None, + encoder: str = None, + encoder_conf: Optional[Dict] = None, + predictor: str = None, + predictor_conf: Optional[Dict] = None, + predictor_bias: int = 0, + length_normalized_loss: bool = False, + **kwargs, + ): + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + predictor_class = tables.predictor_classes.get(predictor) + predictor = predictor_class(**predictor_conf) + self.specaug = specaug + self.normalize = normalize + self.encoder = encoder + self.predictor = predictor + self.criterion_pre = mae_loss(normalize_length=length_normalized_loss) + self.predictor_bias = predictor_bias + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + assert text_lengths.dim() == 1, text_lengths.shape + # Check that batch_size is unified + assert ( + speech.shape[0] == speech_lengths.shape[0] == text.shape[0] == text_lengths.shape[0] + ), (speech.shape, speech_lengths.shape, text.shape, text_lengths.shape) + batch_size = speech.shape[0] + # for data-parallel + text = text[:, : text_lengths.max()] + speech = speech[:, : speech_lengths.max()] + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + if self.predictor_bias == 1: + _, text = add_sos_eos(text, 1, 2, -1) + text_lengths = text_lengths + self.predictor_bias + _, _, _, _, pre_token_length2 = self.predictor( + encoder_out, text, encoder_out_mask, ignore_id=-1 + ) + + # loss_pre = self.criterion_pre(ys_pad_lens.type_as(pre_token_length), pre_token_length) + loss_pre = self.criterion_pre(text_lengths.type_as(pre_token_length2), pre_token_length2) + + loss = loss_pre + stats = dict() + + # Collect Attn branch stats + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def calc_predictor_timestamp(self, encoder_out, encoder_out_lens, token_num): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + ds_alphas, ds_cif_peak, us_alphas, us_peaks = self.predictor.get_upsample_timestamp( + encoder_out, encoder_out_mask, token_num + ) + return ds_alphas, ds_cif_peak, us_alphas, us_peaks + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + return encoder_out, encoder_out_lens + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + meta_data = {} + # extract fbank feats + time1 = time.perf_counter() + audio_list, text_token_int_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + # predictor + text_lengths = torch.tensor([len(i) + 1 for i in text_token_int_list]).to( + encoder_out.device + ) + _, _, us_alphas, us_peaks = self.calc_predictor_timestamp( + encoder_out, encoder_out_lens, token_num=text_lengths + ) + + results = [] + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer["tp_res"] + + for i, (us_alpha, us_peak, token_int) in enumerate( + zip(us_alphas, us_peaks, text_token_int_list) + ): + token = tokenizer.ids2tokens(token_int) + timestamp_str, timestamp = ts_prediction_lfr6_standard( + us_alpha[: encoder_out_lens[i] * 3], + us_peak[: encoder_out_lens[i] * 3], + copy.copy(token), + ) + text_postprocessed, time_stamp_postprocessed, _ = ( + postprocess_utils.sentence_postprocess(token, timestamp) + ) + result_i = { + "key": key[i], + "text": text_postprocessed, + "timestamp": time_stamp_postprocessed, + } + results.append(result_i) + + if ibest_writer: + # ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["timestamp_list"][key[i]] = time_stamp_postprocessed + ibest_writer["timestamp_str"][key[i]] = timestamp_str + + return results, meta_data diff --git a/funasr/models/monotonic_aligner/template.yaml b/funasr/models/monotonic_aligner/template.yaml new file mode 100644 index 0000000..f8d5ded --- /dev/null +++ b/funasr/models/monotonic_aligner/template.yaml @@ -0,0 +1,115 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: MonotonicAligner +model_conf: + length_normalized_loss: False + predictor_bias: 1 + +# encoder +encoder: SANMEncoder +encoder_conf: + output_size: 320 + attention_heads: 4 + linear_units: 1280 + num_blocks: 30 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + +predictor: CifPredictorV3 +predictor_conf: + idim: 320 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + smooth_factor2: 0.25 + noise_threshold2: 0.01 + upsample_times: 3 + use_cif1_cnn: false + upsample_type: cnn_blstm + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true + +normalize: null diff --git a/funasr/models/mossformer/__init__.py b/funasr/models/mossformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/mossformer/e2e_ss.py b/funasr/models/mossformer/e2e_ss.py new file mode 100644 index 0000000..40d30ca --- /dev/null +++ b/funasr/models/mossformer/e2e_ss.py @@ -0,0 +1,95 @@ +import math +import torch +import torch.nn as nn +import torch.nn.functional as F +import copy +from funasr.models.base_model import FunASRModel +from funasr.models.encoder.mossformer_encoder import MossFormerEncoder, MossFormer_MaskNet +from funasr.models.decoder.mossformer_decoder import MossFormerDecoder + + +class MossFormer(FunASRModel): + """The MossFormer model for separating input mixed speech into different speaker's speech. + + Arguments + --------- + in_channels : int + Number of channels at the output of the encoder. + out_channels : int + Number of channels that would be inputted to the intra and inter blocks. + num_blocks : int + Number of layers of Dual Computation Block. + norm : str + Normalization type. + num_spks : int + Number of sources (speakers). + skip_around_intra : bool + Skip connection around intra. + use_global_pos_enc : bool + Global positional encodings. + max_length : int + Maximum sequence length. + kernel_size: int + Encoder and decoder kernel size + """ + + def __init__( + self, + in_channels=512, + out_channels=512, + num_blocks=24, + kernel_size=16, + norm="ln", + num_spks=2, + skip_around_intra=True, + use_global_pos_enc=True, + max_length=20000, + ): + super(MossFormer, self).__init__() + self.num_spks = num_spks + # Encoding + self.enc = MossFormerEncoder( + kernel_size=kernel_size, out_channels=in_channels, in_channels=1 + ) + + ##Compute Mask + self.mask_net = MossFormer_MaskNet( + in_channels=in_channels, + out_channels=out_channels, + num_blocks=num_blocks, + norm=norm, + num_spks=num_spks, + skip_around_intra=skip_around_intra, + use_global_pos_enc=use_global_pos_enc, + max_length=max_length, + ) + self.dec = MossFormerDecoder( + in_channels=out_channels, + out_channels=1, + kernel_size=kernel_size, + stride=kernel_size // 2, + bias=False, + ) + + def forward(self, input): + x = self.enc(input) + mask = self.mask_net(x) + x = torch.stack([x] * self.num_spks) + sep_x = x * mask + + # Decoding + est_source = torch.cat( + [self.dec(sep_x[i]).unsqueeze(-1) for i in range(self.num_spks)], + dim=-1, + ) + T_origin = input.size(1) + T_est = est_source.size(1) + if T_origin > T_est: + est_source = F.pad(est_source, (0, 0, 0, T_origin - T_est)) + else: + est_source = est_source[:, :T_origin, :] + + out = [] + for spk in range(self.num_spks): + out.append(est_source[:, :, spk]) + return out diff --git a/funasr/models/mossformer/mossformer.py b/funasr/models/mossformer/mossformer.py new file mode 100644 index 0000000..30aab48 --- /dev/null +++ b/funasr/models/mossformer/mossformer.py @@ -0,0 +1,317 @@ +import torch +import torch.nn.functional as F +from torch import nn, einsum +from einops import rearrange + + +def identity(t, *args, **kwargs): + return t + + +def append_dims(x, num_dims): + if num_dims <= 0: + return x + return x.view(*x.shape, *((1,) * num_dims)) + + +def exists(val): + return val is not None + + +def default(val, d): + return val if exists(val) else d + + +def padding_to_multiple_of(n, mult): + remainder = n % mult + if remainder == 0: + return 0 + return mult - remainder + + +class Transpose(nn.Module): + """Wrapper class of torch.transpose() for Sequential module.""" + + def __init__(self, shape: tuple): + super(Transpose, self).__init__() + self.shape = shape + + def forward(self, x): + return x.transpose(*self.shape) + + +class DepthwiseConv1d(nn.Module): + """ + When groups == in_channels and out_channels == K * in_channels, where K is a positive integer, + this operation is termed in literature as depthwise convolution. + Args: + in_channels (int): Number of channels in the input + out_channels (int): Number of channels produced by the convolution + kernel_size (int or tuple): Size of the convolving kernel + stride (int, optional): Stride of the convolution. Default: 1 + padding (int or tuple, optional): Zero-padding added to both sides of the input. Default: 0 + bias (bool, optional): If True, adds a learnable bias to the output. Default: True + Inputs: inputs + - **inputs** (batch, in_channels, time): Tensor containing input vector + Returns: outputs + - **outputs** (batch, out_channels, time): Tensor produces by depthwise 1-D convolution. + """ + + def __init__( + self, + in_channels: int, + out_channels: int, + kernel_size: int, + stride: int = 1, + padding: int = 0, + bias: bool = False, + ) -> None: + super(DepthwiseConv1d, self).__init__() + assert ( + out_channels % in_channels == 0 + ), "out_channels should be constant multiple of in_channels" + self.conv = nn.Conv1d( + in_channels=in_channels, + out_channels=out_channels, + kernel_size=kernel_size, + groups=in_channels, + stride=stride, + padding=padding, + bias=bias, + ) + + def forward(self, inputs): + return self.conv(inputs) + + +class ConvModule(nn.Module): + """ + Conformer convolution module starts with a pointwise convolution and a gated linear unit (GLU). + This is followed by a single 1-D depthwise convolution layer. Batchnorm is deployed just after the convolution + to aid training deep models. + Args: + in_channels (int): Number of channels in the input + kernel_size (int or tuple, optional): Size of the convolving kernel Default: 31 + dropout_p (float, optional): probability of dropout + Inputs: inputs + inputs (batch, time, dim): Tensor contains input sequences + Outputs: outputs + outputs (batch, time, dim): Tensor produces by conformer convolution module. + """ + + def __init__( + self, + in_channels: int, + kernel_size: int = 17, + expansion_factor: int = 2, + dropout_p: float = 0.1, + ) -> None: + super(ConvModule, self).__init__() + assert (kernel_size - 1) % 2 == 0, "kernel_size should be a odd number for 'SAME' padding" + assert expansion_factor == 2, "Currently, Only Supports expansion_factor 2" + + self.sequential = nn.Sequential( + Transpose(shape=(1, 2)), + DepthwiseConv1d( + in_channels, in_channels, kernel_size, stride=1, padding=(kernel_size - 1) // 2 + ), + ) + + def forward(self, inputs): + return inputs + self.sequential(inputs).transpose(1, 2) + + +class OffsetScale(nn.Module): + def __init__(self, dim, heads=1): + super().__init__() + self.gamma = nn.Parameter(torch.ones(heads, dim)) + self.beta = nn.Parameter(torch.zeros(heads, dim)) + nn.init.normal_(self.gamma, std=0.02) + + def forward(self, x): + out = einsum("... d, h d -> ... h d", x, self.gamma) + self.beta + return out.unbind(dim=-2) + + +class FFConvM(nn.Module): + def __init__(self, dim_in, dim_out, norm_klass=nn.LayerNorm, dropout=0.1): + super().__init__() + self.mdl = nn.Sequential( + norm_klass(dim_in), + nn.Linear(dim_in, dim_out), + nn.SiLU(), + ConvModule(dim_out), + nn.Dropout(dropout), + ) + + def forward( + self, + x, + ): + output = self.mdl(x) + return output + + +class FLASH_ShareA_FFConvM(nn.Module): + def __init__( + self, + *, + dim, + group_size=256, + query_key_dim=128, + expansion_factor=1.0, + causal=False, + dropout=0.1, + rotary_pos_emb=None, + norm_klass=nn.LayerNorm, + shift_tokens=True + ): + super().__init__() + hidden_dim = int(dim * expansion_factor) + self.group_size = group_size + self.causal = causal + self.shift_tokens = shift_tokens + + # positional embeddings + self.rotary_pos_emb = rotary_pos_emb + # norm + self.dropout = nn.Dropout(dropout) + # projections + + self.to_hidden = FFConvM( + dim_in=dim, + dim_out=hidden_dim, + norm_klass=norm_klass, + dropout=dropout, + ) + self.to_qk = FFConvM( + dim_in=dim, + dim_out=query_key_dim, + norm_klass=norm_klass, + dropout=dropout, + ) + + self.qk_offset_scale = OffsetScale(query_key_dim, heads=4) + + self.to_out = FFConvM( + dim_in=dim * 2, + dim_out=dim, + norm_klass=norm_klass, + dropout=dropout, + ) + + self.gateActivate = nn.Sigmoid() + + def forward(self, x, *, mask=None): + """ + b - batch + n - sequence length (within groups) + g - group dimension + d - feature dimension (keys) + e - feature dimension (values) + i - sequence dimension (source) + j - sequence dimension (target) + """ + + normed_x = x + + # do token shift - a great, costless trick from an independent AI researcher in Shenzhen + residual = x + + if self.shift_tokens: + x_shift, x_pass = normed_x.chunk(2, dim=-1) + x_shift = F.pad(x_shift, (0, 0, 1, -1), value=0.0) + normed_x = torch.cat((x_shift, x_pass), dim=-1) + + # initial projections + + v, u = self.to_hidden(normed_x).chunk(2, dim=-1) + qk = self.to_qk(normed_x) + + # offset and scale + quad_q, lin_q, quad_k, lin_k = self.qk_offset_scale(qk) + att_v, att_u = self.cal_attention(x, quad_q, lin_q, quad_k, lin_k, v, u) + out = (att_u * v) * self.gateActivate(att_v * u) + x = x + self.to_out(out) + return x + + def cal_attention(self, x, quad_q, lin_q, quad_k, lin_k, v, u, mask=None): + b, n, device, g = x.shape[0], x.shape[-2], x.device, self.group_size + + if exists(mask): + lin_mask = rearrange(mask, "... -> ... 1") + lin_k = lin_k.masked_fill(~lin_mask, 0.0) + + # rotate queries and keys + + if exists(self.rotary_pos_emb): + quad_q, lin_q, quad_k, lin_k = map( + self.rotary_pos_emb.rotate_queries_or_keys, (quad_q, lin_q, quad_k, lin_k) + ) + + # padding for groups + + padding = padding_to_multiple_of(n, g) + + if padding > 0: + quad_q, quad_k, lin_q, lin_k, v, u = map( + lambda t: F.pad(t, (0, 0, 0, padding), value=0.0), + (quad_q, quad_k, lin_q, lin_k, v, u), + ) + + mask = default(mask, torch.ones((b, n), device=device, dtype=torch.bool)) + mask = F.pad(mask, (0, padding), value=False) + + # group along sequence + + quad_q, quad_k, lin_q, lin_k, v, u = map( + lambda t: rearrange(t, "b (g n) d -> b g n d", n=self.group_size), + (quad_q, quad_k, lin_q, lin_k, v, u), + ) + + if exists(mask): + mask = rearrange(mask, "b (g j) -> b g 1 j", j=g) + + # calculate quadratic attention output + + sim = einsum("... i d, ... j d -> ... i j", quad_q, quad_k) / g + + attn = F.relu(sim) ** 2 + attn = self.dropout(attn) + + if exists(mask): + attn = attn.masked_fill(~mask, 0.0) + + if self.causal: + causal_mask = torch.ones((g, g), dtype=torch.bool, device=device).triu(1) + attn = attn.masked_fill(causal_mask, 0.0) + + quad_out_v = einsum("... i j, ... j d -> ... i d", attn, v) + quad_out_u = einsum("... i j, ... j d -> ... i d", attn, u) + + # calculate linear attention output + + if self.causal: + lin_kv = einsum("b g n d, b g n e -> b g d e", lin_k, v) / g + # exclusive cumulative sum along group dimension + lin_kv = lin_kv.cumsum(dim=1) + lin_kv = F.pad(lin_kv, (0, 0, 0, 0, 1, -1), value=0.0) + lin_out_v = einsum("b g d e, b g n d -> b g n e", lin_kv, lin_q) + + lin_ku = einsum("b g n d, b g n e -> b g d e", lin_k, u) / g + # exclusive cumulative sum along group dimension + lin_ku = lin_ku.cumsum(dim=1) + lin_ku = F.pad(lin_ku, (0, 0, 0, 0, 1, -1), value=0.0) + lin_out_u = einsum("b g d e, b g n d -> b g n e", lin_ku, lin_q) + else: + lin_kv = einsum("b g n d, b g n e -> b d e", lin_k, v) / n + lin_out_v = einsum("b g n d, b d e -> b g n e", lin_q, lin_kv) + + lin_ku = einsum("b g n d, b g n e -> b d e", lin_k, u) / n + lin_out_u = einsum("b g n d, b d e -> b g n e", lin_q, lin_ku) + + # fold back groups into full sequence, and excise out padding + return map( + lambda t: rearrange(t, "b g n d -> b (g n) d")[:, :n], + (quad_out_v + lin_out_v, quad_out_u + lin_out_u), + ) diff --git a/funasr/models/mossformer/mossformer_decoder.py b/funasr/models/mossformer/mossformer_decoder.py new file mode 100644 index 0000000..56ad2ec --- /dev/null +++ b/funasr/models/mossformer/mossformer_decoder.py @@ -0,0 +1,50 @@ +import torch +import torch.nn as nn + + +class MossFormerDecoder(nn.ConvTranspose1d): + """A decoder layer that consists of ConvTranspose1d. + + Arguments + --------- + kernel_size : int + Length of filters. + in_channels : int + Number of input channels. + out_channels : int + Number of output channels. + + + Example + --------- + >>> x = torch.randn(2, 100, 1000) + >>> decoder = Decoder(kernel_size=4, in_channels=100, out_channels=1) + >>> h = decoder(x) + >>> h.shape + torch.Size([2, 1003]) + """ + + def __init__(self, *args, **kwargs): + super(MossFormerDecoder, self).__init__(*args, **kwargs) + + def forward(self, x): + """Return the decoded output. + + Arguments + --------- + x : torch.Tensor + Input tensor with dimensionality [B, N, L]. + where, B = Batchsize, + N = number of filters + L = time points + """ + + if x.dim() not in [2, 3]: + raise RuntimeError("{} accept 3/4D tensor as input".format(self.__name__)) + x = super().forward(x if x.dim() == 3 else torch.unsqueeze(x, 1)) + + if torch.squeeze(x).dim() == 1: + x = torch.squeeze(x, dim=1) + else: + x = torch.squeeze(x) + return x diff --git a/funasr/models/mossformer/mossformer_encoder.py b/funasr/models/mossformer/mossformer_encoder.py new file mode 100644 index 0000000..888aef8 --- /dev/null +++ b/funasr/models/mossformer/mossformer_encoder.py @@ -0,0 +1,428 @@ +import torch +import torch.nn as nn +import torch.nn.functional as F + +try: + from rotary_embedding_torch import RotaryEmbedding +except: + print( + "If you want use mossformer, lease install rotary_embedding_torch by: \n pip install -U rotary_embedding_torch" + ) +from funasr.models.transformer.layer_norm import GlobalLayerNorm, CumulativeLayerNorm, ScaleNorm +from funasr.models.transformer.embedding import ScaledSinuEmbedding +from funasr.models.transformer.mossformer import FLASH_ShareA_FFConvM + + +def select_norm(norm, dim, shape): + """Just a wrapper to select the normalization type.""" + + if norm == "gln": + return GlobalLayerNorm(dim, shape, elementwise_affine=True) + if norm == "cln": + return CumulativeLayerNorm(dim, elementwise_affine=True) + if norm == "ln": + return nn.GroupNorm(1, dim, eps=1e-8) + else: + return nn.BatchNorm1d(dim) + + +class MossformerBlock(nn.Module): + def __init__( + self, + *, + dim, + depth, + group_size=256, + query_key_dim=128, + expansion_factor=4.0, + causal=False, + attn_dropout=0.1, + norm_type="scalenorm", + shift_tokens=True + ): + super().__init__() + assert norm_type in ( + "scalenorm", + "layernorm", + ), "norm_type must be one of scalenorm or layernorm" + + if norm_type == "scalenorm": + norm_klass = ScaleNorm + elif norm_type == "layernorm": + norm_klass = nn.LayerNorm + + self.group_size = group_size + + rotary_pos_emb = RotaryEmbedding(dim=min(32, query_key_dim)) + # max rotary embedding dimensions of 32, partial Rotary embeddings, from Wang et al - GPT-J + self.layers = nn.ModuleList( + [ + FLASH_ShareA_FFConvM( + dim=dim, + group_size=group_size, + query_key_dim=query_key_dim, + expansion_factor=expansion_factor, + causal=causal, + dropout=attn_dropout, + rotary_pos_emb=rotary_pos_emb, + norm_klass=norm_klass, + shift_tokens=shift_tokens, + ) + for _ in range(depth) + ] + ) + + def forward(self, x, *, mask=None): + ii = 0 + for flash in self.layers: + x = flash(x, mask=mask) + ii = ii + 1 + return x + + +class MossFormer_MaskNet(nn.Module): + """The MossFormer module for computing output masks. + + Arguments + --------- + in_channels : int + Number of channels at the output of the encoder. + out_channels : int + Number of channels that would be inputted to the intra and inter blocks. + num_blocks : int + Number of layers of Dual Computation Block. + norm : str + Normalization type. + num_spks : int + Number of sources (speakers). + skip_around_intra : bool + Skip connection around intra. + use_global_pos_enc : bool + Global positional encodings. + max_length : int + Maximum sequence length. + + Example + --------- + >>> mossformer_block = MossFormerM(1, 64, 8) + >>> mossformer_masknet = MossFormer_MaskNet(64, 64, intra_block, num_spks=2) + >>> x = torch.randn(10, 64, 2000) + >>> x = mossformer_masknet(x) + >>> x.shape + torch.Size([2, 10, 64, 2000]) + """ + + def __init__( + self, + in_channels, + out_channels, + num_blocks=24, + norm="ln", + num_spks=2, + skip_around_intra=True, + use_global_pos_enc=True, + max_length=20000, + ): + super(MossFormer_MaskNet, self).__init__() + self.num_spks = num_spks + self.num_blocks = num_blocks + self.norm = select_norm(norm, in_channels, 3) + self.conv1d_encoder = nn.Conv1d(in_channels, out_channels, 1, bias=False) + self.use_global_pos_enc = use_global_pos_enc + + if self.use_global_pos_enc: + self.pos_enc = ScaledSinuEmbedding(out_channels) + + self.mdl = Computation_Block( + num_blocks, + out_channels, + norm, + skip_around_intra=skip_around_intra, + ) + + self.conv1d_out = nn.Conv1d(out_channels, out_channels * num_spks, kernel_size=1) + self.conv1_decoder = nn.Conv1d(out_channels, in_channels, 1, bias=False) + self.prelu = nn.PReLU() + self.activation = nn.ReLU() + # gated output layer + self.output = nn.Sequential(nn.Conv1d(out_channels, out_channels, 1), nn.Tanh()) + self.output_gate = nn.Sequential(nn.Conv1d(out_channels, out_channels, 1), nn.Sigmoid()) + + def forward(self, x): + """Returns the output tensor. + + Arguments + --------- + x : torch.Tensor + Input tensor of dimension [B, N, S]. + + Returns + ------- + out : torch.Tensor + Output tensor of dimension [spks, B, N, S] + where, spks = Number of speakers + B = Batchsize, + N = number of filters + S = the number of time frames + """ + + # before each line we indicate the shape after executing the line + + # [B, N, L] + x = self.norm(x) + + # [B, N, L] + x = self.conv1d_encoder(x) + if self.use_global_pos_enc: + # x = self.pos_enc(x.transpose(1, -1)).transpose(1, -1) + x * ( + # x.size(1) ** 0.5) + base = x + x = x.transpose(1, -1) + emb = self.pos_enc(x) + emb = emb.transpose(0, -1) + # print('base: {}, emb: {}'.format(base.shape, emb.shape)) + x = base + emb + + # [B, N, S] + # for i in range(self.num_modules): + # x = self.dual_mdl[i](x) + x = self.mdl(x) + x = self.prelu(x) + + # [B, N*spks, S] + x = self.conv1d_out(x) + B, _, S = x.shape + + # [B*spks, N, S] + x = x.view(B * self.num_spks, -1, S) + + # [B*spks, N, S] + x = self.output(x) * self.output_gate(x) + + # [B*spks, N, S] + x = self.conv1_decoder(x) + + # [B, spks, N, S] + _, N, L = x.shape + x = x.view(B, self.num_spks, N, L) + x = self.activation(x) + + # [spks, B, N, S] + x = x.transpose(0, 1) + + return x + + +class MossFormerEncoder(nn.Module): + """Convolutional Encoder Layer. + + Arguments + --------- + kernel_size : int + Length of filters. + in_channels : int + Number of input channels. + out_channels : int + Number of output channels. + + Example + ------- + >>> x = torch.randn(2, 1000) + >>> encoder = Encoder(kernel_size=4, out_channels=64) + >>> h = encoder(x) + >>> h.shape + torch.Size([2, 64, 499]) + """ + + def __init__(self, kernel_size=2, out_channels=64, in_channels=1): + super(MossFormerEncoder, self).__init__() + self.conv1d = nn.Conv1d( + in_channels=in_channels, + out_channels=out_channels, + kernel_size=kernel_size, + stride=kernel_size // 2, + groups=1, + bias=False, + ) + self.in_channels = in_channels + + def forward(self, x): + """Return the encoded output. + + Arguments + --------- + x : torch.Tensor + Input tensor with dimensionality [B, L]. + Return + ------ + x : torch.Tensor + Encoded tensor with dimensionality [B, N, T_out]. + + where B = Batchsize + L = Number of timepoints + N = Number of filters + T_out = Number of timepoints at the output of the encoder + """ + # B x L -> B x 1 x L + if self.in_channels == 1: + x = torch.unsqueeze(x, dim=1) + # B x 1 x L -> B x N x T_out + x = self.conv1d(x) + x = F.relu(x) + + return x + + +class MossFormerM(nn.Module): + """This class implements the transformer encoder. + + Arguments + --------- + num_blocks : int + Number of mossformer blocks to include. + d_model : int + The dimension of the input embedding. + attn_dropout : float + Dropout for the self-attention (Optional). + group_size: int + the chunk size + query_key_dim: int + the attention vector dimension + expansion_factor: int + the expansion factor for the linear projection in conv module + causal: bool + true for causal / false for non causal + + Example + ------- + >>> import torch + >>> x = torch.rand((8, 60, 512)) + >>> net = TransformerEncoder_MossFormerM(num_blocks=8, d_model=512) + >>> output, _ = net(x) + >>> output.shape + torch.Size([8, 60, 512]) + """ + + def __init__( + self, + num_blocks, + d_model=None, + causal=False, + group_size=256, + query_key_dim=128, + expansion_factor=4.0, + attn_dropout=0.1, + ): + super().__init__() + + self.mossformerM = MossformerBlock( + dim=d_model, + depth=num_blocks, + group_size=group_size, + query_key_dim=query_key_dim, + expansion_factor=expansion_factor, + causal=causal, + attn_dropout=attn_dropout, + ) + self.norm = nn.LayerNorm(d_model, eps=1e-6) + + def forward( + self, + src, + ): + """ + Arguments + ---------- + src : torch.Tensor + Tensor shape [B, L, N], + where, B = Batchsize, + L = time points + N = number of filters + The sequence to the encoder layer (required). + src_mask : tensor + The mask for the src sequence (optional). + src_key_padding_mask : tensor + The mask for the src keys per batch (optional). + """ + output = self.mossformerM(src) + output = self.norm(output) + + return output + + +class Computation_Block(nn.Module): + """Computation block for dual-path processing. + + Arguments + --------- + out_channels : int + Dimensionality of inter/intra model. + norm : str + Normalization type. + skip_around_intra : bool + Skip connection around the intra layer. + + Example + --------- + >>> comp_block = Computation_Block(64) + >>> x = torch.randn(10, 64, 100) + >>> x = comp_block(x) + >>> x.shape + torch.Size([10, 64, 100]) + """ + + def __init__( + self, + num_blocks, + out_channels, + norm="ln", + skip_around_intra=True, + ): + super(Computation_Block, self).__init__() + + ##MossFormer2M: MossFormer with recurrence + # self.intra_mdl = MossFormer2M(num_blocks=num_blocks, d_model=out_channels) + ##MossFormerM: the orignal MossFormer + self.intra_mdl = MossFormerM(num_blocks=num_blocks, d_model=out_channels) + self.skip_around_intra = skip_around_intra + + # Norm + self.norm = norm + if norm is not None: + self.intra_norm = select_norm(norm, out_channels, 3) + + def forward(self, x): + """Returns the output tensor. + + Arguments + --------- + x : torch.Tensor + Input tensor of dimension [B, N, S]. + + + Return + --------- + out: torch.Tensor + Output tensor of dimension [B, N, S]. + where, B = Batchsize, + N = number of filters + S = sequence time index + """ + B, N, S = x.shape + # intra RNN + # [B, S, N] + intra = x.permute(0, 2, 1).contiguous() # .view(B, S, N) + + intra = self.intra_mdl(intra) + + # [B, N, S] + intra = intra.permute(0, 2, 1).contiguous() + if self.norm is not None: + intra = self.intra_norm(intra) + + # [B, N, S] + if self.skip_around_intra: + intra = intra + x + + out = intra + return out diff --git a/funasr/models/normalize/__init__.py b/funasr/models/normalize/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/normalize/global_mvn.py b/funasr/models/normalize/global_mvn.py new file mode 100644 index 0000000..55a7287 --- /dev/null +++ b/funasr/models/normalize/global_mvn.py @@ -0,0 +1,116 @@ +from pathlib import Path +from typing import Tuple +from typing import Union + +import numpy as np +import torch + +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.register import tables + + +@tables.register("normalize_classes", "GlobalMVN") +class GlobalMVN(torch.nn.Module): + """Apply global mean and variance normalization + TODO(kamo): Make this class portable somehow + Args: + stats_file: npy file + norm_means: Apply mean normalization + norm_vars: Apply var normalization + eps: + """ + + def __init__( + self, + stats_file: Union[Path, str], + norm_means: bool = True, + norm_vars: bool = True, + eps: float = 1.0e-20, + ): + super().__init__() + self.norm_means = norm_means + self.norm_vars = norm_vars + self.eps = eps + stats_file = Path(stats_file) + + self.stats_file = stats_file + stats = np.load(stats_file) + if isinstance(stats, np.ndarray): + # Kaldi like stats + count = stats[0].flatten()[-1] + mean = stats[0, :-1] / count + var = stats[1, :-1] / count - mean * mean + else: + # New style: Npz file + count = stats["count"] + sum_v = stats["sum"] + sum_square_v = stats["sum_square"] + mean = sum_v / count + var = sum_square_v / count - mean * mean + std = np.sqrt(np.maximum(var, eps)) + + self.register_buffer("mean", torch.from_numpy(mean)) + self.register_buffer("std", torch.from_numpy(std)) + + def extra_repr(self): + return ( + f"stats_file={self.stats_file}, " + f"norm_means={self.norm_means}, norm_vars={self.norm_vars}" + ) + + def forward( + self, x: torch.Tensor, ilens: torch.Tensor = None + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward function + Args: + x: (B, L, ...) + ilens: (B,) + """ + if ilens is None: + ilens = x.new_full([x.size(0)], x.size(1)) + norm_means = self.norm_means + norm_vars = self.norm_vars + self.mean = self.mean.to(x.device, x.dtype) + self.std = self.std.to(x.device, x.dtype) + mask = make_pad_mask(ilens, x, 1) + + # feat: (B, T, D) + if norm_means: + if x.requires_grad: + x = x - self.mean + else: + x -= self.mean + if x.requires_grad: + x = x.masked_fill(mask, 0.0) + else: + x.masked_fill_(mask, 0.0) + + if norm_vars: + x /= self.std + + return x, ilens + + def inverse( + self, x: torch.Tensor, ilens: torch.Tensor = None + ) -> Tuple[torch.Tensor, torch.Tensor]: + if ilens is None: + ilens = x.new_full([x.size(0)], x.size(1)) + norm_means = self.norm_means + norm_vars = self.norm_vars + self.mean = self.mean.to(x.device, x.dtype) + self.std = self.std.to(x.device, x.dtype) + mask = make_pad_mask(ilens, x, 1) + + if x.requires_grad: + x = x.masked_fill(mask, 0.0) + else: + x.masked_fill_(mask, 0.0) + + if norm_vars: + x *= self.std + + # feat: (B, T, D) + if norm_means: + x += self.mean + x.masked_fill_(make_pad_mask(ilens, x, 1), 0.0) + return x, ilens diff --git a/funasr/models/normalize/utterance_mvn.py b/funasr/models/normalize/utterance_mvn.py new file mode 100644 index 0000000..8216328 --- /dev/null +++ b/funasr/models/normalize/utterance_mvn.py @@ -0,0 +1,87 @@ +from typing import Tuple + +import torch + +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.register import tables + + +@tables.register("normalize_classes", "UtteranceMVN") +class UtteranceMVN(torch.nn.Module): + def __init__( + self, + norm_means: bool = True, + norm_vars: bool = False, + eps: float = 1.0e-20, + ): + super().__init__() + self.norm_means = norm_means + self.norm_vars = norm_vars + self.eps = eps + + def extra_repr(self): + return f"norm_means={self.norm_means}, norm_vars={self.norm_vars}" + + def forward( + self, x: torch.Tensor, ilens: torch.Tensor = None + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward function + + Args: + x: (B, L, ...) + ilens: (B,) + + """ + return utterance_mvn( + x, + ilens, + norm_means=self.norm_means, + norm_vars=self.norm_vars, + eps=self.eps, + ) + + +def utterance_mvn( + x: torch.Tensor, + ilens: torch.Tensor = None, + norm_means: bool = True, + norm_vars: bool = False, + eps: float = 1.0e-20, +) -> Tuple[torch.Tensor, torch.Tensor]: + """Apply utterance mean and variance normalization + + Args: + x: (B, T, D), assumed zero padded + ilens: (B,) + norm_means: + norm_vars: + eps: + + """ + if ilens is None: + ilens = x.new_full([x.size(0)], x.size(1)) + ilens_ = ilens.to(x.device, x.dtype).view(-1, *[1 for _ in range(x.dim() - 1)]) + # Zero padding + if x.requires_grad: + x = x.masked_fill(make_pad_mask(ilens, x, 1), 0.0) + else: + x.masked_fill_(make_pad_mask(ilens, x, 1), 0.0) + # mean: (B, 1, D) + mean = x.sum(dim=1, keepdim=True) / ilens_ + + if norm_means: + x -= mean + + if norm_vars: + var = x.pow(2).sum(dim=1, keepdim=True) / ilens_ + std = torch.clamp(var.sqrt(), min=eps) + x = x / std.sqrt() + return x, ilens + else: + if norm_vars: + y = x - mean + y.masked_fill_(make_pad_mask(ilens, y, 1), 0.0) + var = y.pow(2).sum(dim=1, keepdim=True) / ilens_ + std = torch.clamp(var.sqrt(), min=eps) + x /= std + return x, ilens diff --git a/funasr/models/paraformer/__init__.py b/funasr/models/paraformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/paraformer/cif_predictor.py b/funasr/models/paraformer/cif_predictor.py new file mode 100644 index 0000000..d707448 --- /dev/null +++ b/funasr/models/paraformer/cif_predictor.py @@ -0,0 +1,633 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import logging +import numpy as np + +from funasr.register import tables +from funasr.train_utils.device_funcs import to_device +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from torch.cuda.amp import autocast + + +@tables.register("predictor_classes", "CifPredictor") +class CifPredictor(torch.nn.Module): + def __init__( + self, + idim, + l_order, + r_order, + threshold=1.0, + dropout=0.1, + smooth_factor=1.0, + noise_threshold=0, + tail_threshold=0.45, + ): + super().__init__() + + self.pad = torch.nn.ConstantPad1d((l_order, r_order), 0) + self.cif_conv1d = torch.nn.Conv1d(idim, idim, l_order + r_order + 1, groups=idim) + self.cif_output = torch.nn.Linear(idim, 1) + self.dropout = torch.nn.Dropout(p=dropout) + self.threshold = threshold + self.smooth_factor = smooth_factor + self.noise_threshold = noise_threshold + self.tail_threshold = tail_threshold + + def forward( + self, + hidden, + target_label=None, + mask=None, + ignore_id=-1, + mask_chunk_predictor=None, + target_label_length=None, + ): + + with autocast(False): + h = hidden + context = h.transpose(1, 2) + queries = self.pad(context) + memory = self.cif_conv1d(queries) + output = memory + context + output = self.dropout(output) + output = output.transpose(1, 2) + output = torch.relu(output) + output = self.cif_output(output) + alphas = torch.sigmoid(output) + alphas = torch.nn.functional.relu(alphas * self.smooth_factor - self.noise_threshold) + if mask is not None: + mask = mask.transpose(-1, -2).float() + alphas = alphas * mask + if mask_chunk_predictor is not None: + alphas = alphas * mask_chunk_predictor + alphas = alphas.squeeze(-1) + mask = mask.squeeze(-1) + if target_label_length is not None: + target_length = target_label_length + elif target_label is not None: + target_length = (target_label != ignore_id).float().sum(-1) + else: + target_length = None + token_num = alphas.sum(-1) + if target_length is not None: + alphas *= (target_length / token_num)[:, None].repeat(1, alphas.size(1)) + elif self.tail_threshold > 0.0: + hidden, alphas, token_num = self.tail_process_fn( + hidden, alphas, token_num, mask=mask + ) + + acoustic_embeds, cif_peak = cif(hidden, alphas, self.threshold) + + if target_length is None and self.tail_threshold > 0.0: + token_num_int = torch.max(token_num).type(torch.int32).item() + acoustic_embeds = acoustic_embeds[:, :token_num_int, :] + + return acoustic_embeds, token_num, alphas, cif_peak + + def tail_process_fn(self, hidden, alphas, token_num=None, mask=None): + b, t, d = hidden.size() + tail_threshold = self.tail_threshold + if mask is not None: + zeros_t = torch.zeros((b, 1), dtype=torch.float32, device=alphas.device) + ones_t = torch.ones_like(zeros_t) + mask_1 = torch.cat([mask, zeros_t], dim=1) + mask_2 = torch.cat([ones_t, mask], dim=1) + mask = mask_2 - mask_1 + tail_threshold = mask * tail_threshold + alphas = torch.cat([alphas, zeros_t], dim=1) + alphas = torch.add(alphas, tail_threshold) + else: + tail_threshold = torch.tensor([tail_threshold], dtype=alphas.dtype).to(alphas.device) + tail_threshold = torch.reshape(tail_threshold, (1, 1)) + alphas = torch.cat([alphas, tail_threshold], dim=1) + zeros = torch.zeros((b, 1, d), dtype=hidden.dtype).to(hidden.device) + hidden = torch.cat([hidden, zeros], dim=1) + token_num = alphas.sum(dim=-1) + token_num_floor = torch.floor(token_num) + + return hidden, alphas, token_num_floor + + def gen_frame_alignments( + self, alphas: torch.Tensor = None, encoder_sequence_length: torch.Tensor = None + ): + batch_size, maximum_length = alphas.size() + int_type = torch.int32 + + is_training = self.training + if is_training: + token_num = torch.round(torch.sum(alphas, dim=1)).type(int_type) + else: + token_num = torch.floor(torch.sum(alphas, dim=1)).type(int_type) + + max_token_num = torch.max(token_num).item() + + alphas_cumsum = torch.cumsum(alphas, dim=1) + alphas_cumsum = torch.floor(alphas_cumsum).type(int_type) + alphas_cumsum = alphas_cumsum[:, None, :].repeat(1, max_token_num, 1) + + index = torch.ones([batch_size, max_token_num], dtype=int_type) + index = torch.cumsum(index, dim=1) + index = index[:, :, None].repeat(1, 1, maximum_length).to(alphas_cumsum.device) + + index_div = torch.floor(torch.true_divide(alphas_cumsum, index)).type(int_type) + index_div_bool_zeros = index_div.eq(0) + index_div_bool_zeros_count = torch.sum(index_div_bool_zeros, dim=-1) + 1 + index_div_bool_zeros_count = torch.clamp( + index_div_bool_zeros_count, 0, encoder_sequence_length.max() + ) + token_num_mask = (~make_pad_mask(token_num, maxlen=max_token_num)).to(token_num.device) + index_div_bool_zeros_count *= token_num_mask + + index_div_bool_zeros_count_tile = index_div_bool_zeros_count[:, :, None].repeat( + 1, 1, maximum_length + ) + ones = torch.ones_like(index_div_bool_zeros_count_tile) + zeros = torch.zeros_like(index_div_bool_zeros_count_tile) + ones = torch.cumsum(ones, dim=2) + cond = index_div_bool_zeros_count_tile == ones + index_div_bool_zeros_count_tile = torch.where(cond, zeros, ones) + + index_div_bool_zeros_count_tile_bool = index_div_bool_zeros_count_tile.type(torch.bool) + index_div_bool_zeros_count_tile = 1 - index_div_bool_zeros_count_tile_bool.type(int_type) + index_div_bool_zeros_count_tile_out = torch.sum(index_div_bool_zeros_count_tile, dim=1) + index_div_bool_zeros_count_tile_out = index_div_bool_zeros_count_tile_out.type(int_type) + predictor_mask = ( + (~make_pad_mask(encoder_sequence_length, maxlen=encoder_sequence_length.max())) + .type(int_type) + .to(encoder_sequence_length.device) + ) + index_div_bool_zeros_count_tile_out = index_div_bool_zeros_count_tile_out * predictor_mask + + predictor_alignments = index_div_bool_zeros_count_tile_out + predictor_alignments_length = predictor_alignments.sum(-1).type( + encoder_sequence_length.dtype + ) + return predictor_alignments.detach(), predictor_alignments_length.detach() + + +@tables.register("predictor_classes", "CifPredictorV2") +class CifPredictorV2(torch.nn.Module): + def __init__( + self, + idim, + l_order, + r_order, + threshold=1.0, + dropout=0.1, + smooth_factor=1.0, + noise_threshold=0, + tail_threshold=0.0, + tf2torch_tensor_name_prefix_torch="predictor", + tf2torch_tensor_name_prefix_tf="seq2seq/cif", + tail_mask=True, + ): + super().__init__() + + self.pad = torch.nn.ConstantPad1d((l_order, r_order), 0) + self.cif_conv1d = torch.nn.Conv1d(idim, idim, l_order + r_order + 1) + self.cif_output = torch.nn.Linear(idim, 1) + self.dropout = torch.nn.Dropout(p=dropout) + self.threshold = threshold + self.smooth_factor = smooth_factor + self.noise_threshold = noise_threshold + self.tail_threshold = tail_threshold + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + self.tail_mask = tail_mask + + def forward( + self, + hidden, + target_label=None, + mask=None, + ignore_id=-1, + mask_chunk_predictor=None, + target_label_length=None, + ): + + with autocast(False): + h = hidden + context = h.transpose(1, 2) + queries = self.pad(context) + output = torch.relu(self.cif_conv1d(queries)) + output = output.transpose(1, 2) + + output = self.cif_output(output) + alphas = torch.sigmoid(output) + alphas = torch.nn.functional.relu(alphas * self.smooth_factor - self.noise_threshold) + if mask is not None: + mask = mask.transpose(-1, -2).float() + alphas = alphas * mask + if mask_chunk_predictor is not None: + alphas = alphas * mask_chunk_predictor + alphas = alphas.squeeze(-1) + mask = mask.squeeze(-1) + if target_label_length is not None: + target_length = target_label_length.squeeze(-1) + elif target_label is not None: + target_length = (target_label != ignore_id).float().sum(-1) + else: + target_length = None + token_num = alphas.sum(-1) + if target_length is not None: + alphas *= (target_length / token_num)[:, None].repeat(1, alphas.size(1)) + elif self.tail_threshold > 0.0: + if self.tail_mask: + hidden, alphas, token_num = self.tail_process_fn( + hidden, alphas, token_num, mask=mask + ) + else: + hidden, alphas, token_num = self.tail_process_fn( + hidden, alphas, token_num, mask=None + ) + + acoustic_embeds, cif_peak = cif(hidden, alphas, self.threshold) + if target_length is None and self.tail_threshold > 0.0: + token_num_int = torch.max(token_num).type(torch.int32).item() + acoustic_embeds = acoustic_embeds[:, :token_num_int, :] + + return acoustic_embeds, token_num, alphas, cif_peak + + def forward_chunk(self, hidden, cache=None, **kwargs): + is_final = kwargs.get("is_final", False) + batch_size, len_time, hidden_size = hidden.shape + h = hidden + context = h.transpose(1, 2) + queries = self.pad(context) + output = torch.relu(self.cif_conv1d(queries)) + output = output.transpose(1, 2) + output = self.cif_output(output) + alphas = torch.sigmoid(output) + alphas = torch.nn.functional.relu(alphas * self.smooth_factor - self.noise_threshold) + + alphas = alphas.squeeze(-1) + + token_length = [] + list_fires = [] + list_frames = [] + cache_alphas = [] + cache_hiddens = [] + + if cache is not None and "chunk_size" in cache: + alphas[:, : cache["chunk_size"][0]] = 0.0 + if not is_final: + alphas[:, sum(cache["chunk_size"][:2]) :] = 0.0 + if cache is not None and "cif_alphas" in cache and "cif_hidden" in cache: + cache["cif_hidden"] = to_device(cache["cif_hidden"], device=hidden.device) + cache["cif_alphas"] = to_device(cache["cif_alphas"], device=alphas.device) + hidden = torch.cat((cache["cif_hidden"], hidden), dim=1) + alphas = torch.cat((cache["cif_alphas"], alphas), dim=1) + if cache is not None and is_final: + tail_hidden = torch.zeros((batch_size, 1, hidden_size), device=hidden.device) + tail_alphas = torch.tensor([[self.tail_threshold]], device=alphas.device) + tail_alphas = torch.tile(tail_alphas, (batch_size, 1)) + hidden = torch.cat((hidden, tail_hidden), dim=1) + alphas = torch.cat((alphas, tail_alphas), dim=1) + + len_time = alphas.shape[1] + for b in range(batch_size): + integrate = 0.0 + frames = torch.zeros((hidden_size), device=hidden.device) + list_frame = [] + list_fire = [] + for t in range(len_time): + alpha = alphas[b][t] + if alpha + integrate < self.threshold: + integrate += alpha + list_fire.append(integrate) + frames += alpha * hidden[b][t] + else: + frames += (self.threshold - integrate) * hidden[b][t] + list_frame.append(frames) + integrate += alpha + list_fire.append(integrate) + integrate -= self.threshold + frames = integrate * hidden[b][t] + + cache_alphas.append(integrate) + if integrate > 0.0: + cache_hiddens.append(frames / integrate) + else: + cache_hiddens.append(frames) + + token_length.append(torch.tensor(len(list_frame), device=alphas.device)) + list_fires.append(list_fire) + list_frames.append(list_frame) + + cache["cif_alphas"] = torch.stack(cache_alphas, axis=0) + cache["cif_alphas"] = torch.unsqueeze(cache["cif_alphas"], axis=0) + cache["cif_hidden"] = torch.stack(cache_hiddens, axis=0) + cache["cif_hidden"] = torch.unsqueeze(cache["cif_hidden"], axis=0) + + max_token_len = max(token_length) + if max_token_len == 0: + return hidden, torch.stack(token_length, 0), None, None + list_ls = [] + for b in range(batch_size): + pad_frames = torch.zeros( + (max_token_len - token_length[b], hidden_size), device=alphas.device + ) + if token_length[b] == 0: + list_ls.append(pad_frames) + else: + list_frames[b] = torch.stack(list_frames[b]) + list_ls.append(torch.cat((list_frames[b], pad_frames), dim=0)) + + cache["cif_alphas"] = torch.stack(cache_alphas, axis=0) + cache["cif_alphas"] = torch.unsqueeze(cache["cif_alphas"], axis=0) + cache["cif_hidden"] = torch.stack(cache_hiddens, axis=0) + cache["cif_hidden"] = torch.unsqueeze(cache["cif_hidden"], axis=0) + return torch.stack(list_ls, 0), torch.stack(token_length, 0), None, None + + def tail_process_fn(self, hidden, alphas, token_num=None, mask=None): + b, t, d = hidden.size() + tail_threshold = self.tail_threshold + if mask is not None: + zeros_t = torch.zeros((b, 1), dtype=torch.float32, device=alphas.device) + ones_t = torch.ones_like(zeros_t) + mask_1 = torch.cat([mask, zeros_t], dim=1) + mask_2 = torch.cat([ones_t, mask], dim=1) + mask = mask_2 - mask_1 + tail_threshold = mask * tail_threshold + alphas = torch.cat([alphas, zeros_t], dim=1) + alphas = torch.add(alphas, tail_threshold) + else: + tail_threshold = torch.tensor([tail_threshold], dtype=alphas.dtype).to(alphas.device) + tail_threshold = torch.reshape(tail_threshold, (1, 1)) + if b > 1: + alphas = torch.cat([alphas, tail_threshold.repeat(b, 1)], dim=1) + else: + alphas = torch.cat([alphas, tail_threshold], dim=1) + zeros = torch.zeros((b, 1, d), dtype=hidden.dtype).to(hidden.device) + hidden = torch.cat([hidden, zeros], dim=1) + token_num = alphas.sum(dim=-1) + token_num_floor = torch.floor(token_num) + + return hidden, alphas, token_num_floor + + def gen_frame_alignments( + self, alphas: torch.Tensor = None, encoder_sequence_length: torch.Tensor = None + ): + batch_size, maximum_length = alphas.size() + int_type = torch.int32 + + is_training = self.training + if is_training: + token_num = torch.round(torch.sum(alphas, dim=1)).type(int_type) + else: + token_num = torch.floor(torch.sum(alphas, dim=1)).type(int_type) + + max_token_num = torch.max(token_num).item() + + alphas_cumsum = torch.cumsum(alphas, dim=1) + alphas_cumsum = torch.floor(alphas_cumsum).type(int_type) + alphas_cumsum = alphas_cumsum[:, None, :].repeat(1, max_token_num, 1) + + index = torch.ones([batch_size, max_token_num], dtype=int_type) + index = torch.cumsum(index, dim=1) + index = index[:, :, None].repeat(1, 1, maximum_length).to(alphas_cumsum.device) + + index_div = torch.floor(torch.true_divide(alphas_cumsum, index)).type(int_type) + index_div_bool_zeros = index_div.eq(0) + index_div_bool_zeros_count = torch.sum(index_div_bool_zeros, dim=-1) + 1 + index_div_bool_zeros_count = torch.clamp( + index_div_bool_zeros_count, 0, encoder_sequence_length.max() + ) + token_num_mask = (~make_pad_mask(token_num, maxlen=max_token_num)).to(token_num.device) + index_div_bool_zeros_count *= token_num_mask + + index_div_bool_zeros_count_tile = index_div_bool_zeros_count[:, :, None].repeat( + 1, 1, maximum_length + ) + ones = torch.ones_like(index_div_bool_zeros_count_tile) + zeros = torch.zeros_like(index_div_bool_zeros_count_tile) + ones = torch.cumsum(ones, dim=2) + cond = index_div_bool_zeros_count_tile == ones + index_div_bool_zeros_count_tile = torch.where(cond, zeros, ones) + + index_div_bool_zeros_count_tile_bool = index_div_bool_zeros_count_tile.type(torch.bool) + index_div_bool_zeros_count_tile = 1 - index_div_bool_zeros_count_tile_bool.type(int_type) + index_div_bool_zeros_count_tile_out = torch.sum(index_div_bool_zeros_count_tile, dim=1) + index_div_bool_zeros_count_tile_out = index_div_bool_zeros_count_tile_out.type(int_type) + predictor_mask = ( + (~make_pad_mask(encoder_sequence_length, maxlen=encoder_sequence_length.max())) + .type(int_type) + .to(encoder_sequence_length.device) + ) + index_div_bool_zeros_count_tile_out = index_div_bool_zeros_count_tile_out * predictor_mask + + predictor_alignments = index_div_bool_zeros_count_tile_out + predictor_alignments_length = predictor_alignments.sum(-1).type( + encoder_sequence_length.dtype + ) + return predictor_alignments.detach(), predictor_alignments_length.detach() + + +@tables.register("predictor_classes", "CifPredictorV2Export") +class CifPredictorV2Export(torch.nn.Module): + def __init__(self, model, **kwargs): + super().__init__() + + self.pad = model.pad + self.cif_conv1d = model.cif_conv1d + self.cif_output = model.cif_output + self.threshold = model.threshold + self.smooth_factor = model.smooth_factor + self.noise_threshold = model.noise_threshold + self.tail_threshold = model.tail_threshold + + def forward( + self, + hidden: torch.Tensor, + mask: torch.Tensor, + ): + alphas, token_num = self.forward_cnn(hidden, mask) + mask = mask.transpose(-1, -2).float() + mask = mask.squeeze(-1) + hidden, alphas, token_num = self.tail_process_fn(hidden, alphas, mask=mask) + acoustic_embeds, cif_peak = cif_export(hidden, alphas, self.threshold) + + return acoustic_embeds, token_num, alphas, cif_peak + + def forward_cnn( + self, + hidden: torch.Tensor, + mask: torch.Tensor, + ): + h = hidden + context = h.transpose(1, 2) + queries = self.pad(context) + output = torch.relu(self.cif_conv1d(queries)) + output = output.transpose(1, 2) + + output = self.cif_output(output) + alphas = torch.sigmoid(output) + alphas = torch.nn.functional.relu(alphas * self.smooth_factor - self.noise_threshold) + mask = mask.transpose(-1, -2).float() + alphas = alphas * mask + alphas = alphas.squeeze(-1) + token_num = alphas.sum(-1) + + return alphas, token_num + + def tail_process_fn(self, hidden, alphas, token_num=None, mask=None): + b, t, d = hidden.size() + tail_threshold = self.tail_threshold + + zeros_t = torch.zeros((b, 1), dtype=torch.float32, device=alphas.device) + ones_t = torch.ones_like(zeros_t) + + mask_1 = torch.cat([mask, zeros_t], dim=1) + mask_2 = torch.cat([ones_t, mask], dim=1) + mask = mask_2 - mask_1 + tail_threshold = mask * tail_threshold + alphas = torch.cat([alphas, zeros_t], dim=1) + alphas = torch.add(alphas, tail_threshold) + + zeros = torch.zeros((b, 1, d), dtype=hidden.dtype).to(hidden.device) + hidden = torch.cat([hidden, zeros], dim=1) + token_num = alphas.sum(dim=-1) + token_num_floor = torch.floor(token_num) + + return hidden, alphas, token_num_floor + + +@torch.jit.script +def cif_export(hidden, alphas, threshold: float): + batch_size, len_time, hidden_size = hidden.size() + threshold = torch.tensor([threshold], dtype=alphas.dtype).to(alphas.device) + + # loop varss + integrate = torch.zeros([batch_size], dtype=alphas.dtype, device=hidden.device) + frame = torch.zeros([batch_size, hidden_size], dtype=hidden.dtype, device=hidden.device) + # intermediate vars along time + list_fires = [] + list_frames = [] + + for t in range(len_time): + alpha = alphas[:, t] + distribution_completion = ( + torch.ones([batch_size], dtype=alphas.dtype, device=hidden.device) - integrate + ) + + integrate += alpha + list_fires.append(integrate) + + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, + integrate - torch.ones([batch_size], dtype=alphas.dtype, device=hidden.device), + integrate, + ) + cur = torch.where(fire_place, distribution_completion, alpha) + remainds = alpha - cur + + frame += cur[:, None] * hidden[:, t, :] + list_frames.append(frame) + frame = torch.where( + fire_place[:, None].repeat(1, hidden_size), remainds[:, None] * hidden[:, t, :], frame + ) + + fires = torch.stack(list_fires, 1) + frames = torch.stack(list_frames, 1) + + fire_idxs = fires >= threshold + frame_fires = torch.zeros_like(hidden) + max_label_len = frames[0, fire_idxs[0]].size(0) + for b in range(batch_size): + frame_fire = frames[b, fire_idxs[b]] + frame_len = frame_fire.size(0) + frame_fires[b, :frame_len, :] = frame_fire + + if frame_len >= max_label_len: + max_label_len = frame_len + frame_fires = frame_fires[:, :max_label_len, :] + return frame_fires, fires + + +class mae_loss(torch.nn.Module): + + def __init__(self, normalize_length=False): + super(mae_loss, self).__init__() + self.normalize_length = normalize_length + self.criterion = torch.nn.L1Loss(reduction="sum") + + def forward(self, token_length, pre_token_length): + loss_token_normalizer = token_length.size(0) + if self.normalize_length: + loss_token_normalizer = token_length.sum().type(torch.float32) + loss = self.criterion(token_length, pre_token_length) + loss = loss / loss_token_normalizer + return loss + + +def cif(hidden, alphas, threshold): + batch_size, len_time, hidden_size = hidden.size() + + # loop varss + integrate = torch.zeros([batch_size], device=hidden.device) + frame = torch.zeros([batch_size, hidden_size], device=hidden.device) + # intermediate vars along time + list_fires = [] + list_frames = [] + + for t in range(len_time): + alpha = alphas[:, t] + distribution_completion = torch.ones([batch_size], device=hidden.device) - integrate + + integrate += alpha + list_fires.append(integrate) + + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, integrate - torch.ones([batch_size], device=hidden.device), integrate + ) + cur = torch.where(fire_place, distribution_completion, alpha) + remainds = alpha - cur + + frame += cur[:, None] * hidden[:, t, :] + list_frames.append(frame) + frame = torch.where( + fire_place[:, None].repeat(1, hidden_size), remainds[:, None] * hidden[:, t, :], frame + ) + + fires = torch.stack(list_fires, 1) + frames = torch.stack(list_frames, 1) + list_ls = [] + len_labels = torch.round(alphas.sum(-1)).int() + max_label_len = len_labels.max() + for b in range(batch_size): + fire = fires[b, :] + l = torch.index_select(frames[b, :, :], 0, torch.nonzero(fire >= threshold).squeeze()) + pad_l = torch.zeros([max_label_len - l.size(0), hidden_size], device=hidden.device) + list_ls.append(torch.cat([l, pad_l], 0)) + return torch.stack(list_ls, 0), fires + + +def cif_wo_hidden(alphas, threshold): + batch_size, len_time = alphas.size() + + # loop varss + integrate = torch.zeros([batch_size], device=alphas.device) + # intermediate vars along time + list_fires = [] + + for t in range(len_time): + alpha = alphas[:, t] + + integrate += alpha + list_fires.append(integrate) + + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, + integrate - torch.ones([batch_size], device=alphas.device) * threshold, + integrate, + ) + + fires = torch.stack(list_fires, 1) + return fires diff --git a/funasr/models/paraformer/decoder.py b/funasr/models/paraformer/decoder.py new file mode 100644 index 0000000..7edd91a --- /dev/null +++ b/funasr/models/paraformer/decoder.py @@ -0,0 +1,1193 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +from typing import List, Tuple + +from funasr.register import tables +from funasr.models.scama import utils as myutils +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.decoder import DecoderLayer +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.attention import MultiHeadedAttention +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.decoder import BaseTransformerDecoder +from funasr.models.transformer.positionwise_feed_forward import PositionwiseFeedForward +from funasr.models.sanm.positionwise_feed_forward import PositionwiseFeedForwardDecoderSANM +from funasr.models.sanm.attention import ( + MultiHeadedAttentionSANMDecoder, + MultiHeadedAttentionCrossAtt, +) + + +class DecoderLayerSANM(torch.nn.Module): + """Single decoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + src_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + + """ + + def __init__( + self, + size, + self_attn, + src_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an DecoderLayer object.""" + super(DecoderLayerSANM, self).__init__() + self.size = size + self.self_attn = self_attn + self.src_attn = src_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + if self_attn is not None: + self.norm2 = LayerNorm(size) + if src_attn is not None: + self.norm3 = LayerNorm(size) + self.dropout = torch.nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = torch.nn.Linear(size + size, size) + self.concat_linear2 = torch.nn.Linear(size + size, size) + self.reserve_attn = False + self.attn_mat = [] + + def forward(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + # tgt = self.dropout(tgt) + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + x, _ = self.self_attn(tgt, tgt_mask) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + if self.reserve_attn: + x_src_attn, attn_mat = self.src_attn(x, memory, memory_mask, ret_attn=True) + self.attn_mat.append(attn_mat) + else: + x_src_attn = self.src_attn(x, memory, memory_mask, ret_attn=False) + x = residual + self.dropout(x_src_attn) + # x = residual + self.dropout(self.src_attn(x, memory, memory_mask)) + + return x, tgt_mask, memory, memory_mask, cache + + def get_attn_mat(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + residual = tgt + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn is not None: + tgt = self.norm2(tgt) + x, cache = self.self_attn(tgt, tgt_mask, cache=cache) + x = residual + x + + residual = x + x = self.norm3(x) + x_src_attn, attn_mat = self.src_attn(x, memory, memory_mask, ret_attn=True) + return attn_mat + + def forward_one_step(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + # tgt = self.dropout(tgt) + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + if self.training: + cache = None + x, cache = self.self_attn(tgt, tgt_mask, cache=cache) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x = residual + self.dropout(self.src_attn(x, memory, memory_mask)) + + return x, tgt_mask, memory, memory_mask, cache + + def forward_chunk( + self, tgt, memory, fsmn_cache=None, opt_cache=None, chunk_size=None, look_back=0 + ): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + x, fsmn_cache = self.self_attn(tgt, None, fsmn_cache) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x, opt_cache = self.src_attn.forward_chunk(x, memory, opt_cache, chunk_size, look_back) + x = residual + x + + return x, memory, fsmn_cache, opt_cache + + +@tables.register("decoder_classes", "ParaformerSANMDecoder") +class ParaformerSANMDecoder(BaseTransformerDecoder): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2006.01713 + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + wo_input_layer: bool = False, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + att_layer_num: int = 6, + kernel_size: int = 21, + sanm_shfit: int = 0, + lora_list: List[str] = None, + lora_rank: int = 8, + lora_alpha: int = 16, + lora_dropout: float = 0.1, + chunk_multiply_factor: tuple = (1,), + tf2torch_tensor_name_prefix_torch: str = "decoder", + tf2torch_tensor_name_prefix_tf: str = "seq2seq/decoder", + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + if wo_input_layer: + self.embed = None + else: + if input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(vocab_size, attention_dim), + # pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(vocab_size, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + else: + raise ValueError(f"only 'embed' or 'linear' is supported: {input_layer}") + + self.normalize_before = normalize_before + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + if use_output_layer: + self.output_layer = torch.nn.Linear(attention_dim, vocab_size) + else: + self.output_layer = None + + self.att_layer_num = att_layer_num + self.num_blocks = num_blocks + if sanm_shfit is None: + sanm_shfit = (kernel_size - 1) // 2 + self.decoders = repeat( + att_layer_num, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, self_attention_dropout_rate, kernel_size, sanm_shfit=sanm_shfit + ), + MultiHeadedAttentionCrossAtt( + attention_heads, + attention_dim, + src_attention_dropout_rate, + lora_list, + lora_rank, + lora_alpha, + lora_dropout, + ), + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if num_blocks - att_layer_num <= 0: + self.decoders2 = None + else: + self.decoders2 = repeat( + num_blocks - att_layer_num, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, self_attention_dropout_rate, kernel_size, sanm_shfit=0 + ), + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + self.decoders3 = repeat( + 1, + lambda lnum: DecoderLayerSANM( + attention_dim, + None, + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + self.chunk_multiply_factor = chunk_multiply_factor + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + chunk_mask: torch.Tensor = None, + return_hidden: bool = False, + return_both: bool = False, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + if chunk_mask is not None: + memory_mask = memory_mask * chunk_mask + if tgt_mask.size(1) != memory_mask.size(1): + memory_mask = torch.cat((memory_mask, memory_mask[:, -2:-1, :]), dim=1) + + x = tgt + x, tgt_mask, memory, memory_mask, _ = self.decoders(x, tgt_mask, memory, memory_mask) + if self.decoders2 is not None: + x, tgt_mask, memory, memory_mask, _ = self.decoders2(x, tgt_mask, memory, memory_mask) + x, tgt_mask, memory, memory_mask, _ = self.decoders3(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + hidden = self.after_norm(x) + + olens = tgt_mask.sum(1) + if self.output_layer is not None and return_hidden is False: + x = self.output_layer(hidden) + return x, olens + if return_both: + x = self.output_layer(hidden) + return x, hidden, olens + return hidden, olens + + def score(self, ys, state, x): + """Score.""" + ys_mask = myutils.sequence_mask( + torch.tensor([len(ys)], dtype=torch.int32), device=x.device + )[:, :, None] + logp, state = self.forward_one_step(ys.unsqueeze(0), ys_mask, x.unsqueeze(0), cache=state) + return logp.squeeze(0), state + + def forward_asf2( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ): + + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + + tgt, tgt_mask, memory, memory_mask, _ = self.decoders[0](tgt, tgt_mask, memory, memory_mask) + attn_mat = self.model.decoders[1].get_attn_mat(tgt, tgt_mask, memory, memory_mask) + return attn_mat + + def forward_asf6( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ): + + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + + tgt, tgt_mask, memory, memory_mask, _ = self.decoders[0](tgt, tgt_mask, memory, memory_mask) + tgt, tgt_mask, memory, memory_mask, _ = self.decoders[1](tgt, tgt_mask, memory, memory_mask) + tgt, tgt_mask, memory, memory_mask, _ = self.decoders[2](tgt, tgt_mask, memory, memory_mask) + tgt, tgt_mask, memory, memory_mask, _ = self.decoders[3](tgt, tgt_mask, memory, memory_mask) + tgt, tgt_mask, memory, memory_mask, _ = self.decoders[4](tgt, tgt_mask, memory, memory_mask) + attn_mat = self.decoders[5].get_attn_mat(tgt, tgt_mask, memory, memory_mask) + return attn_mat + + def forward_chunk( + self, + memory: torch.Tensor, + tgt: torch.Tensor, + cache: dict = None, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + x = tgt + if cache["decode_fsmn"] is None: + cache_layer_num = len(self.decoders) + if self.decoders2 is not None: + cache_layer_num += len(self.decoders2) + fsmn_cache = [None] * cache_layer_num + else: + fsmn_cache = cache["decode_fsmn"] + + if cache["opt"] is None: + cache_layer_num = len(self.decoders) + opt_cache = [None] * cache_layer_num + else: + opt_cache = cache["opt"] + + for i in range(self.att_layer_num): + decoder = self.decoders[i] + x, memory, fsmn_cache[i], opt_cache[i] = decoder.forward_chunk( + x, + memory, + fsmn_cache=fsmn_cache[i], + opt_cache=opt_cache[i], + chunk_size=cache["chunk_size"], + look_back=cache["decoder_chunk_look_back"], + ) + + if self.num_blocks - self.att_layer_num > 1: + for i in range(self.num_blocks - self.att_layer_num): + j = i + self.att_layer_num + decoder = self.decoders2[i] + x, memory, fsmn_cache[j], _ = decoder.forward_chunk( + x, memory, fsmn_cache=fsmn_cache[j] + ) + + for decoder in self.decoders3: + x, memory, _, _ = decoder.forward_chunk(x, memory) + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + cache["decode_fsmn"] = fsmn_cache + if cache["decoder_chunk_look_back"] > 0 or cache["decoder_chunk_look_back"] == -1: + cache["opt"] = opt_cache + return x + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + """ + x = self.embed(tgt) + if cache is None: + cache_layer_num = len(self.decoders) + if self.decoders2 is not None: + cache_layer_num += len(self.decoders2) + cache = [None] * cache_layer_num + new_cache = [] + # for c, decoder in zip(cache, self.decoders): + for i in range(self.att_layer_num): + decoder = self.decoders[i] + c = cache[i] + x, tgt_mask, memory, memory_mask, c_ret = decoder.forward_one_step( + x, tgt_mask, memory, None, cache=c + ) + new_cache.append(c_ret) + + if self.num_blocks - self.att_layer_num > 1: + for i in range(self.num_blocks - self.att_layer_num): + j = i + self.att_layer_num + decoder = self.decoders2[i] + c = cache[j] + x, tgt_mask, memory, memory_mask, c_ret = decoder.forward_one_step( + x, tgt_mask, memory, None, cache=c + ) + new_cache.append(c_ret) + + for decoder in self.decoders3: + + x, tgt_mask, memory, memory_mask, _ = decoder.forward_one_step( + x, tgt_mask, memory, None, cache=None + ) + + if self.normalize_before: + y = self.after_norm(x[:, -1]) + else: + y = x[:, -1] + if self.output_layer is not None: + y = torch.log_softmax(self.output_layer(y), dim=-1) + + return y, new_cache + + +class DecoderLayerSANMExport(torch.nn.Module): + + def __init__(self, model): + super().__init__() + self.self_attn = model.self_attn + self.src_attn = model.src_attn + self.feed_forward = model.feed_forward + self.norm1 = model.norm1 + self.norm2 = model.norm2 if hasattr(model, "norm2") else None + self.norm3 = model.norm3 if hasattr(model, "norm3") else None + self.size = model.size + + def forward(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + + residual = tgt + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn is not None: + tgt = self.norm2(tgt) + x, cache = self.self_attn(tgt, tgt_mask, cache=cache) + x = residual + x + + if self.src_attn is not None: + residual = x + x = self.norm3(x) + x = residual + self.src_attn(x, memory, memory_mask) + + return x, tgt_mask, memory, memory_mask, cache + + def get_attn_mat(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + residual = tgt + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn is not None: + tgt = self.norm2(tgt) + x, cache = self.self_attn(tgt, tgt_mask, cache=cache) + x = residual + x + + residual = x + x = self.norm3(x) + x_src_attn, attn_mat = self.src_attn(x, memory, memory_mask, ret_attn=True) + return attn_mat + + +@tables.register("decoder_classes", "ParaformerSANMDecoderExport") +class ParaformerSANMDecoderExport(torch.nn.Module): + def __init__(self, model, max_seq_len=512, model_name="decoder", onnx: bool = True, **kwargs): + super().__init__() + # self.embed = model.embed #Embedding(model.embed, max_seq_len) + + from funasr.utils.torch_function import sequence_mask + + self.model = model + + self.make_pad_mask = sequence_mask(max_seq_len, flip=False) + + from funasr.models.sanm.attention import MultiHeadedAttentionSANMDecoderExport + from funasr.models.sanm.attention import MultiHeadedAttentionCrossAttExport + + for i, d in enumerate(self.model.decoders): + if isinstance(d.self_attn, MultiHeadedAttentionSANMDecoder): + d.self_attn = MultiHeadedAttentionSANMDecoderExport(d.self_attn) + if isinstance(d.src_attn, MultiHeadedAttentionCrossAtt): + d.src_attn = MultiHeadedAttentionCrossAttExport(d.src_attn) + self.model.decoders[i] = DecoderLayerSANMExport(d) + + if self.model.decoders2 is not None: + for i, d in enumerate(self.model.decoders2): + if isinstance(d.self_attn, MultiHeadedAttentionSANMDecoder): + d.self_attn = MultiHeadedAttentionSANMDecoderExport(d.self_attn) + self.model.decoders2[i] = DecoderLayerSANMExport(d) + + for i, d in enumerate(self.model.decoders3): + self.model.decoders3[i] = DecoderLayerSANMExport(d) + + self.output_layer = model.output_layer + self.after_norm = model.after_norm + self.model_name = model_name + + def prepare_mask(self, mask): + mask_3d_btd = mask[:, :, None] + if len(mask.shape) == 2: + mask_4d_bhlt = 1 - mask[:, None, None, :] + elif len(mask.shape) == 3: + mask_4d_bhlt = 1 - mask[:, None, :] + mask_4d_bhlt = mask_4d_bhlt * -10000.0 + + return mask_3d_btd, mask_4d_bhlt + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + return_hidden: bool = False, + return_both: bool = False, + ): + + tgt = ys_in_pad + tgt_mask = self.make_pad_mask(ys_in_lens) + tgt_mask, _ = self.prepare_mask(tgt_mask) + # tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = self.make_pad_mask(hlens) + _, memory_mask = self.prepare_mask(memory_mask) + # memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + + x = tgt + x, tgt_mask, memory, memory_mask, _ = self.model.decoders(x, tgt_mask, memory, memory_mask) + if self.model.decoders2 is not None: + x, tgt_mask, memory, memory_mask, _ = self.model.decoders2( + x, tgt_mask, memory, memory_mask + ) + x, tgt_mask, memory, memory_mask, _ = self.model.decoders3(x, tgt_mask, memory, memory_mask) + hidden = self.after_norm(x) + # x = self.output_layer(x) + + if self.output_layer is not None and return_hidden is False: + x = self.output_layer(hidden) + return x, ys_in_lens + if return_both: + x = self.output_layer(hidden) + return x, hidden, ys_in_lens + return hidden, ys_in_lens + + def forward_asf2( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ): + + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + _, memory_mask = self.prepare_mask(memory_mask) + + tgt, tgt_mask, memory, memory_mask, _ = self.model.decoders[0]( + tgt, tgt_mask, memory, memory_mask + ) + attn_mat = self.model.decoders[1].get_attn_mat(tgt, tgt_mask, memory, memory_mask) + return attn_mat + + def forward_asf6( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ): + + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + _, memory_mask = self.prepare_mask(memory_mask) + + tgt, tgt_mask, memory, memory_mask, _ = self.model.decoders[0]( + tgt, tgt_mask, memory, memory_mask + ) + tgt, tgt_mask, memory, memory_mask, _ = self.model.decoders[1]( + tgt, tgt_mask, memory, memory_mask + ) + tgt, tgt_mask, memory, memory_mask, _ = self.model.decoders[2]( + tgt, tgt_mask, memory, memory_mask + ) + tgt, tgt_mask, memory, memory_mask, _ = self.model.decoders[3]( + tgt, tgt_mask, memory, memory_mask + ) + tgt, tgt_mask, memory, memory_mask, _ = self.model.decoders[4]( + tgt, tgt_mask, memory, memory_mask + ) + attn_mat = self.model.decoders[5].get_attn_mat(tgt, tgt_mask, memory, memory_mask) + return attn_mat + + """ + def get_dummy_inputs(self, enc_size): + tgt = torch.LongTensor([0]).unsqueeze(0) + memory = torch.randn(1, 100, enc_size) + pre_acoustic_embeds = torch.randn(1, 1, enc_size) + cache_num = len(self.model.decoders) + len(self.model.decoders2) + cache = [ + torch.zeros((1, self.model.decoders[0].size, self.model.decoders[0].self_attn.kernel_size)) + for _ in range(cache_num) + ] + return (tgt, memory, pre_acoustic_embeds, cache) + + def is_optimizable(self): + return True + + def get_input_names(self): + cache_num = len(self.model.decoders) + len(self.model.decoders2) + return ['tgt', 'memory', 'pre_acoustic_embeds'] \ + + ['cache_%d' % i for i in range(cache_num)] + + def get_output_names(self): + cache_num = len(self.model.decoders) + len(self.model.decoders2) + return ['y'] \ + + ['out_cache_%d' % i for i in range(cache_num)] + + def get_dynamic_axes(self): + ret = { + 'tgt': { + 0: 'tgt_batch', + 1: 'tgt_length' + }, + 'memory': { + 0: 'memory_batch', + 1: 'memory_length' + }, + 'pre_acoustic_embeds': { + 0: 'acoustic_embeds_batch', + 1: 'acoustic_embeds_length', + } + } + cache_num = len(self.model.decoders) + len(self.model.decoders2) + ret.update({ + 'cache_%d' % d: { + 0: 'cache_%d_batch' % d, + 2: 'cache_%d_length' % d + } + for d in range(cache_num) + }) + return ret + """ + + +@tables.register("decoder_classes", "ParaformerSANMDecoderOnlineExport") +class ParaformerSANMDecoderOnlineExport(torch.nn.Module): + def __init__(self, model, max_seq_len=512, model_name="decoder", onnx: bool = True, **kwargs): + super().__init__() + # self.embed = model.embed #Embedding(model.embed, max_seq_len) + self.model = model + + from funasr.utils.torch_function import sequence_mask + + self.model = model + + self.make_pad_mask = sequence_mask(max_seq_len, flip=False) + + from funasr.models.sanm.attention import MultiHeadedAttentionSANMDecoderExport + from funasr.models.sanm.attention import MultiHeadedAttentionCrossAttExport + + for i, d in enumerate(self.model.decoders): + if isinstance(d.self_attn, MultiHeadedAttentionSANMDecoder): + d.self_attn = MultiHeadedAttentionSANMDecoderExport(d.self_attn) + if isinstance(d.src_attn, MultiHeadedAttentionCrossAtt): + d.src_attn = MultiHeadedAttentionCrossAttExport(d.src_attn) + self.model.decoders[i] = DecoderLayerSANMExport(d) + + if self.model.decoders2 is not None: + for i, d in enumerate(self.model.decoders2): + if isinstance(d.self_attn, MultiHeadedAttentionSANMDecoder): + d.self_attn = MultiHeadedAttentionSANMDecoderExport(d.self_attn) + self.model.decoders2[i] = DecoderLayerSANMExport(d) + + for i, d in enumerate(self.model.decoders3): + self.model.decoders3[i] = DecoderLayerSANMExport(d) + + self.output_layer = model.output_layer + self.after_norm = model.after_norm + self.model_name = model_name + + def prepare_mask(self, mask): + mask_3d_btd = mask[:, :, None] + if len(mask.shape) == 2: + mask_4d_bhlt = 1 - mask[:, None, None, :] + elif len(mask.shape) == 3: + mask_4d_bhlt = 1 - mask[:, None, :] + mask_4d_bhlt = mask_4d_bhlt * -10000.0 + + return mask_3d_btd, mask_4d_bhlt + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + *args, + ): + + tgt = ys_in_pad + tgt_mask = self.make_pad_mask(ys_in_lens) + tgt_mask, _ = self.prepare_mask(tgt_mask) + # tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = self.make_pad_mask(hlens) + _, memory_mask = self.prepare_mask(memory_mask) + # memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + + x = tgt + out_caches = list() + for i, decoder in enumerate(self.model.decoders): + in_cache = args[i] + x, tgt_mask, memory, memory_mask, out_cache = decoder( + x, tgt_mask, memory, memory_mask, cache=in_cache + ) + out_caches.append(out_cache) + if self.model.decoders2 is not None: + for i, decoder in enumerate(self.model.decoders2): + in_cache = args[i + len(self.model.decoders)] + x, tgt_mask, memory, memory_mask, out_cache = decoder( + x, tgt_mask, memory, memory_mask, cache=in_cache + ) + out_caches.append(out_cache) + x, tgt_mask, memory, memory_mask, _ = self.model.decoders3(x, tgt_mask, memory, memory_mask) + x = self.after_norm(x) + x = self.output_layer(x) + + return x, out_caches + + def get_dummy_inputs(self, enc_size): + enc = torch.randn(2, 100, enc_size).type(torch.float32) + enc_len = torch.tensor([30, 100], dtype=torch.int32) + acoustic_embeds = torch.randn(2, 10, enc_size).type(torch.float32) + acoustic_embeds_len = torch.tensor([5, 10], dtype=torch.int32) + cache_num = len(self.model.decoders) + if hasattr(self.model, "decoders2") and self.model.decoders2 is not None: + cache_num += len(self.model.decoders2) + cache = [ + torch.zeros( + (2, self.model.decoders[0].size, self.model.decoders[0].self_attn.kernel_size - 1), + dtype=torch.float32, + ) + for _ in range(cache_num) + ] + return (enc, enc_len, acoustic_embeds, acoustic_embeds_len, *cache) + + def get_input_names(self): + cache_num = len(self.model.decoders) + if hasattr(self.model, "decoders2") and self.model.decoders2 is not None: + cache_num += len(self.model.decoders2) + return ["enc", "enc_len", "acoustic_embeds", "acoustic_embeds_len"] + [ + "in_cache_%d" % i for i in range(cache_num) + ] + + def get_output_names(self): + cache_num = len(self.model.decoders) + if hasattr(self.model, "decoders2") and self.model.decoders2 is not None: + cache_num += len(self.model.decoders2) + return ["logits", "sample_ids"] + ["out_cache_%d" % i for i in range(cache_num)] + + def get_dynamic_axes(self): + ret = { + "enc": {0: "batch_size", 1: "enc_length"}, + "acoustic_embeds": {0: "batch_size", 1: "token_length"}, + "enc_len": { + 0: "batch_size", + }, + "acoustic_embeds_len": { + 0: "batch_size", + }, + } + cache_num = len(self.model.decoders) + if hasattr(self.model, "decoders2") and self.model.decoders2 is not None: + cache_num += len(self.model.decoders2) + ret.update( + { + "in_cache_%d" + % d: { + 0: "batch_size", + } + for d in range(cache_num) + } + ) + ret.update( + { + "out_cache_%d" + % d: { + 0: "batch_size", + } + for d in range(cache_num) + } + ) + return ret + + +@tables.register("decoder_classes", "ParaformerSANDecoder") +class ParaformerSANDecoder(BaseTransformerDecoder): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2006.01713 + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + embeds_id: int = -1, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + MultiHeadedAttention(attention_heads, attention_dim, self_attention_dropout_rate), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + self.embeds_id = embeds_id + self.attention_dim = attention_dim + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + tgt_mask = (~make_pad_mask(ys_in_lens)[:, None, :]).to(tgt.device) + + memory = hs_pad + memory_mask = (~make_pad_mask(hlens, maxlen=memory.size(1)))[:, None, :].to(memory.device) + # Padding for Longformer + if memory_mask.shape[-1] != memory.shape[1]: + padlen = memory.shape[1] - memory_mask.shape[-1] + memory_mask = torch.nn.functional.pad(memory_mask, (0, padlen), "constant", False) + + # x = self.embed(tgt) + x = tgt + embeds_outputs = None + for layer_id, decoder in enumerate(self.decoders): + x, tgt_mask, memory, memory_mask = decoder(x, tgt_mask, memory, memory_mask) + if layer_id == self.embeds_id: + embeds_outputs = x + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + if embeds_outputs is not None: + return x, olens, embeds_outputs + else: + return x, olens + + +@tables.register("decoder_classes", "ParaformerDecoderSANExport") +class ParaformerDecoderSANExport(torch.nn.Module): + def __init__( + self, + model, + max_seq_len=512, + model_name="decoder", + onnx: bool = True, + ): + super().__init__() + # self.embed = model.embed #Embedding(model.embed, max_seq_len) + self.model = model + + from funasr.utils.torch_function import sequence_mask + + self.model = model + + self.make_pad_mask = sequence_mask(max_seq_len, flip=False) + + from funasr.models.transformer.decoder import DecoderLayerExport + from funasr.models.transformer.attention import MultiHeadedAttentionExport + + for i, d in enumerate(self.model.decoders): + if isinstance(d.src_attn, MultiHeadedAttention): + d.src_attn = MultiHeadedAttentionExport(d.src_attn) + self.model.decoders[i] = DecoderLayerExport(d) + + self.output_layer = model.output_layer + self.after_norm = model.after_norm + self.model_name = model_name + + def prepare_mask(self, mask): + mask_3d_btd = mask[:, :, None] + if len(mask.shape) == 2: + mask_4d_bhlt = 1 - mask[:, None, None, :] + elif len(mask.shape) == 3: + mask_4d_bhlt = 1 - mask[:, None, :] + mask_4d_bhlt = mask_4d_bhlt * -10000.0 + + return mask_3d_btd, mask_4d_bhlt + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ): + + tgt = ys_in_pad + tgt_mask = self.make_pad_mask(ys_in_lens) + tgt_mask, _ = self.prepare_mask(tgt_mask) + # tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = self.make_pad_mask(hlens) + _, memory_mask = self.prepare_mask(memory_mask) + # memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + + x = tgt + x, tgt_mask, memory, memory_mask = self.model.decoders(x, tgt_mask, memory, memory_mask) + x = self.after_norm(x) + x = self.output_layer(x) + + return x, ys_in_lens + + def get_dummy_inputs(self, enc_size): + tgt = torch.LongTensor([0]).unsqueeze(0) + memory = torch.randn(1, 100, enc_size) + pre_acoustic_embeds = torch.randn(1, 1, enc_size) + cache_num = len(self.model.decoders) + len(self.model.decoders2) + cache = [ + torch.zeros( + (1, self.model.decoders[0].size, self.model.decoders[0].self_attn.kernel_size) + ) + for _ in range(cache_num) + ] + return (tgt, memory, pre_acoustic_embeds, cache) + + def is_optimizable(self): + return True + + def get_input_names(self): + cache_num = len(self.model.decoders) + len(self.model.decoders2) + return ["tgt", "memory", "pre_acoustic_embeds"] + ["cache_%d" % i for i in range(cache_num)] + + def get_output_names(self): + cache_num = len(self.model.decoders) + len(self.model.decoders2) + return ["y"] + ["out_cache_%d" % i for i in range(cache_num)] + + def get_dynamic_axes(self): + ret = { + "tgt": {0: "tgt_batch", 1: "tgt_length"}, + "memory": {0: "memory_batch", 1: "memory_length"}, + "pre_acoustic_embeds": { + 0: "acoustic_embeds_batch", + 1: "acoustic_embeds_length", + }, + } + cache_num = len(self.model.decoders) + len(self.model.decoders2) + ret.update( + { + "cache_%d" % d: {0: "cache_%d_batch" % d, 2: "cache_%d_length" % d} + for d in range(cache_num) + } + ) + return ret diff --git a/funasr/models/paraformer/export_meta.py b/funasr/models/paraformer/export_meta.py new file mode 100644 index 0000000..5c1b6c0 --- /dev/null +++ b/funasr/models/paraformer/export_meta.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import types +import torch +from funasr.register import tables + + +def export_rebuild_model(model, **kwargs): + model.device = kwargs.get("device") + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + predictor_class = tables.predictor_classes.get(kwargs["predictor"] + "Export") + model.predictor = predictor_class(model.predictor, onnx=is_onnx) + + decoder_class = tables.decoder_classes.get(kwargs["decoder"] + "Export") + model.decoder = decoder_class(model.decoder, onnx=is_onnx) + + from funasr.utils.torch_function import sequence_mask + + model.make_pad_mask = sequence_mask(kwargs["max_seq_len"], flip=False) + + model.forward = types.MethodType(export_forward, model) + model.export_dummy_inputs = types.MethodType(export_dummy_inputs, model) + model.export_input_names = types.MethodType(export_input_names, model) + model.export_output_names = types.MethodType(export_output_names, model) + model.export_dynamic_axes = types.MethodType(export_dynamic_axes, model) + model.export_name = types.MethodType(export_name, model) + + return model + + +def export_forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, +): + # a. To device + batch = {"speech": speech, "speech_lengths": speech_lengths} + # batch = to_device(batch, device=self.device) + + enc, enc_len = self.encoder(**batch) + mask = self.make_pad_mask(enc_len)[:, None, :] + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = self.predictor(enc, mask) + pre_token_length = pre_token_length.floor().type(torch.int32) + + decoder_out, _ = self.decoder(enc, enc_len, pre_acoustic_embeds, pre_token_length) + decoder_out = torch.log_softmax(decoder_out, dim=-1) + # sample_ids = decoder_out.argmax(dim=-1) + + return decoder_out, pre_token_length + + +def export_dummy_inputs(self): + speech = torch.randn(2, 30, 560) + speech_lengths = torch.tensor([6, 30], dtype=torch.int32) + return (speech, speech_lengths) + + +def export_input_names(self): + return ["speech", "speech_lengths"] + + +def export_output_names(self): + return ["logits", "token_num"] + + +def export_dynamic_axes(self): + return { + "speech": {0: "batch_size", 1: "feats_length"}, + "speech_lengths": { + 0: "batch_size", + }, + "logits": {0: "batch_size", 1: "logits_length"}, + } + + +def export_name( + self, +): + return "model.onnx" diff --git a/funasr/models/paraformer/model.py b/funasr/models/paraformer/model.py new file mode 100644 index 0000000..0d9bb2b --- /dev/null +++ b/funasr/models/paraformer/model.py @@ -0,0 +1,588 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import time +import torch +import logging +from torch.cuda.amp import autocast +from typing import Union, Dict, List, Tuple, Optional + +from funasr.register import tables +from funasr.models.ctc.ctc import CTC +from funasr.utils import postprocess_utils +from funasr.metrics.compute_acc import th_accuracy +from funasr.train_utils.device_funcs import to_device +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.search import Hypothesis +from funasr.models.paraformer.cif_predictor import mae_loss +from funasr.train_utils.device_funcs import force_gatherable +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + + +@tables.register("model_classes", "Paraformer") +class Paraformer(torch.nn.Module): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2206.08317 + """ + + def __init__( + self, + specaug: Optional[str] = None, + specaug_conf: Optional[Dict] = None, + normalize: str = None, + normalize_conf: Optional[Dict] = None, + encoder: str = None, + encoder_conf: Optional[Dict] = None, + decoder: str = None, + decoder_conf: Optional[Dict] = None, + ctc: str = None, + ctc_conf: Optional[Dict] = None, + predictor: str = None, + predictor_conf: Optional[Dict] = None, + ctc_weight: float = 0.5, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + # report_cer: bool = True, + # report_wer: bool = True, + # sym_space: str = "", + # sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + # predictor=None, + predictor_weight: float = 0.0, + predictor_bias: int = 0, + sampling_ratio: float = 0.2, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + use_1st_decoder_loss: bool = False, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + if decoder is not None: + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + **decoder_conf, + ) + if ctc_weight > 0.0: + + if ctc_conf is None: + ctc_conf = {} + + ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **ctc_conf) + if predictor is not None: + predictor_class = tables.predictor_classes.get(predictor) + predictor = predictor_class(**predictor_conf) + + # note that eos is the same as sos (equivalent ID) + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.ctc_weight = ctc_weight + # self.token_list = token_list.copy() + # + # self.frontend = frontend + self.specaug = specaug + self.normalize = normalize + # self.preencoder = preencoder + # self.postencoder = postencoder + self.encoder = encoder + # + # if not hasattr(self.encoder, "interctc_use_conditioning"): + # self.encoder.interctc_use_conditioning = False + # if self.encoder.interctc_use_conditioning: + # self.encoder.conditioning_layer = torch.nn.Linear( + # vocab_size, self.encoder.output_size() + # ) + # + # self.error_calculator = None + # + if ctc_weight == 1.0: + self.decoder = None + else: + self.decoder = decoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + # + # if report_cer or report_wer: + # self.error_calculator = ErrorCalculator( + # token_list, sym_space, sym_blank, report_cer, report_wer + # ) + # + if ctc_weight == 0.0: + self.ctc = None + else: + self.ctc = ctc + # + # self.extract_feats_in_collect_stats = extract_feats_in_collect_stats + self.predictor = predictor + self.predictor_weight = predictor_weight + self.predictor_bias = predictor_bias + self.sampling_ratio = sampling_ratio + self.criterion_pre = mae_loss(normalize_length=length_normalized_loss) + + self.share_embedding = share_embedding + if self.share_embedding: + self.decoder.embed = None + + self.use_1st_decoder_loss = use_1st_decoder_loss + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + self.error_calculator = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_ctc, cer_ctc = None, None + loss_pre = None + stats = dict() + + # decoder: CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # decoder: Attention decoder branch + loss_att, acc_att, cer_att, wer_att, loss_pre, pre_loss_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + loss_pre * self.predictor_weight + else: + loss = ( + self.ctc_weight * loss_ctc + + (1 - self.ctc_weight) * loss_att + + loss_pre * self.predictor_weight + ) + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["pre_loss_att"] = pre_loss_att.detach() if pre_loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + + stats["loss"] = torch.clone(loss.detach()) + stats["batch_size"] = batch_size + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = (text_lengths + self.predictor_bias).sum() + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + return encoder_out, encoder_out_lens + + def calc_predictor(self, encoder_out, encoder_out_lens): + + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = self.predictor( + encoder_out, None, encoder_out_mask, ignore_id=self.ignore_id + ) + return pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index + + def cal_decoder_with_predictor( + self, encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens + ): + + decoder_outs = self.decoder(encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens) + decoder_out = decoder_outs[0] + decoder_out = torch.log_softmax(decoder_out, dim=-1) + return decoder_out, ys_pad_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + if self.predictor_bias == 1: + _, ys_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_pad_lens = ys_pad_lens + self.predictor_bias + pre_acoustic_embeds, pre_token_length, _, pre_peak_index = self.predictor( + encoder_out, ys_pad, encoder_out_mask, ignore_id=self.ignore_id + ) + + # 0. sampler + decoder_out_1st = None + pre_loss_att = None + if self.sampling_ratio > 0.0: + + sematic_embeds, decoder_out_1st = self.sampler( + encoder_out, encoder_out_lens, ys_pad, ys_pad_lens, pre_acoustic_embeds + ) + else: + sematic_embeds = pre_acoustic_embeds + + # 1. Forward decoder + decoder_outs = self.decoder(encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens) + decoder_out, _ = decoder_outs[0], decoder_outs[1] + + if decoder_out_1st is None: + decoder_out_1st = decoder_out + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_pad) + acc_att = th_accuracy( + decoder_out_1st.view(-1, self.vocab_size), + ys_pad, + ignore_label=self.ignore_id, + ) + loss_pre = self.criterion_pre(ys_pad_lens.type_as(pre_token_length), pre_token_length) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out_1st.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att, loss_pre, pre_loss_att + + def sampler(self, encoder_out, encoder_out_lens, ys_pad, ys_pad_lens, pre_acoustic_embeds): + + tgt_mask = (~make_pad_mask(ys_pad_lens, maxlen=ys_pad_lens.max())[:, :, None]).to( + ys_pad.device + ) + ys_pad_masked = ys_pad * tgt_mask[:, :, 0] + if self.share_embedding: + ys_pad_embed = self.decoder.output_layer.weight[ys_pad_masked] + else: + ys_pad_embed = self.decoder.embed(ys_pad_masked) + with torch.no_grad(): + decoder_outs = self.decoder( + encoder_out, encoder_out_lens, pre_acoustic_embeds, ys_pad_lens + ) + decoder_out, _ = decoder_outs[0], decoder_outs[1] + pred_tokens = decoder_out.argmax(-1) + nonpad_positions = ys_pad.ne(self.ignore_id) + seq_lens = (nonpad_positions).sum(1) + same_num = ((pred_tokens == ys_pad) & nonpad_positions).sum(1) + input_mask = torch.ones_like(nonpad_positions) + bsz, seq_len = ys_pad.size() + for li in range(bsz): + target_num = ( + ((seq_lens[li] - same_num[li].sum()).float()) * self.sampling_ratio + ).long() + if target_num > 0: + input_mask[li].scatter_( + dim=0, + index=torch.randperm(seq_lens[li])[:target_num].to(input_mask.device), + value=0, + ) + input_mask = input_mask.eq(1) + input_mask = input_mask.masked_fill(~nonpad_positions, False) + input_mask_expand_dim = input_mask.unsqueeze(2).to(pre_acoustic_embeds.device) + + sematic_embeds = pre_acoustic_embeds.masked_fill( + ~input_mask_expand_dim, 0 + ) + ys_pad_embed.masked_fill(input_mask_expand_dim, 0) + return sematic_embeds * tgt_mask, decoder_out * tgt_mask + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + # Calc CTC loss + loss_ctc = self.ctc(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + + # Calc CER using CTC + cer_ctc = None + if not self.training and self.error_calculator is not None: + ys_hat = self.ctc.argmax(encoder_out).data + cer_ctc = self.error_calculator(ys_hat.cpu(), ys_pad.cpu(), is_ctc=True) + return loss_ctc, cer_ctc + + def init_beam_search( + self, + **kwargs, + ): + from funasr.models.paraformer.search import BeamSearchPara + from funasr.models.transformer.scorers.ctc import CTCPrefixScorer + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + if self.ctc != None: + ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos) + scorers.update(ctc=ctc) + token_list = kwargs.get("token_list") + scorers.update( + length_bonus=LengthBonus(len(token_list)), + ) + + # 3. Build ngram model + # ngram is not supported now + ngram = None + scorers["ngram"] = ngram + + weights = dict( + decoder=1.0 - kwargs.get("decoding_ctc_weight"), + ctc=kwargs.get("decoding_ctc_weight", 0.0), + lm=kwargs.get("lm_weight", 0.0), + ngram=kwargs.get("ngram_weight", 0.0), + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearchPara( + beam_size=kwargs.get("beam_size", 2), + weights=weights, + scorers=scorers, + sos=self.sos, + eos=self.eos, + vocab_size=len(token_list), + token_list=token_list, + pre_beam_score_key=None if self.ctc_weight == 1.0 else "full", + ) + # beam_search.to(device=kwargs.get("device", "cpu"), dtype=getattr(torch, kwargs.get("dtype", "float32"))).eval() + # for scorer in scorers.values(): + # if isinstance(scorer, torch.nn.Module): + # scorer.to(device=kwargs.get("device", "cpu"), dtype=getattr(torch, kwargs.get("dtype", "float32"))).eval() + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + # init beamsearch + is_use_ctc = kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None + is_use_lm = ( + kwargs.get("lm_weight", 0.0) > 0.00001 and kwargs.get("lm_file", None) is not None + ) + if self.beam_search is None and (is_use_lm or is_use_ctc): + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is not None: + speech_lengths = speech_lengths.squeeze(-1) + else: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + # Encoder + if kwargs.get("fp16", False): + speech = speech.half() + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # predictor + predictor_outs = self.calc_predictor(encoder_out, encoder_out_lens) + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = ( + predictor_outs[0], + predictor_outs[1], + predictor_outs[2], + predictor_outs[3], + ) + pre_token_length = pre_token_length.round().long() + if torch.max(pre_token_length) < 1: + return [] + decoder_outs = self.cal_decoder_with_predictor( + encoder_out, encoder_out_lens, pre_acoustic_embeds, pre_token_length + ) + decoder_out, ys_pad_lens = decoder_outs[0], decoder_outs[1] + + results = [] + b, n, d = decoder_out.size() + if isinstance(key[0], (list, tuple)): + key = key[0] + if len(key) < b: + key = key * b + for i in range(b): + x = encoder_out[i, : encoder_out_lens[i], :] + am_scores = decoder_out[i, : pre_token_length[i], :] + if self.beam_search is not None: + nbest_hyps = self.beam_search( + x=x, + am_scores=am_scores, + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + else: + + yseq = am_scores.argmax(dim=-1) + score = am_scores.max(dim=-1)[0] + score = torch.sum(score, dim=-1) + # pad with mask tokens to ensure compatibility with sos/eos tokens + yseq = torch.tensor([self.sos] + yseq.tolist() + [self.eos], device=yseq.device) + nbest_hyps = [Hypothesis(yseq=yseq, score=score)] + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx+1}best_recog"] + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + if tokenizer is not None: + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text_postprocessed = tokenizer.tokens2text(token) + if not hasattr(tokenizer, "bpemodel"): + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + + result_i = {"key": key[i], "text": text_postprocessed} + + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + # ibest_writer["text"][key[i]] = text + ibest_writer["text"][key[i]] = text_postprocessed + else: + result_i = {"key": key[i], "token_int": token_int} + results.append(result_i) + + return results, meta_data + + def export(self, **kwargs): + from .export_meta import export_rebuild_model + + if "max_seq_len" not in kwargs: + kwargs["max_seq_len"] = 512 + models = export_rebuild_model(model=self, **kwargs) + return models diff --git a/funasr/models/paraformer/search.py b/funasr/models/paraformer/search.py new file mode 100644 index 0000000..16e13dd --- /dev/null +++ b/funasr/models/paraformer/search.py @@ -0,0 +1,451 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import logging +from itertools import chain +from typing import Any, Dict, List, NamedTuple, Tuple, Union + +from funasr.metrics.common import end_detect +from funasr.models.transformer.scorers.scorer_interface import ( + PartialScorerInterface, + ScorerInterface, +) + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: torch.Tensor + score: Union[float, torch.Tensor] = 0 + scores: Dict[str, Union[float, torch.Tensor]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +class BeamSearchPara(torch.nn.Module): + """Beam search implementation.""" + + def __init__( + self, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + beam_size: int, + vocab_size: int, + sos: int, + eos: int, + token_list: List[str] = None, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = None, + ): + """Initialize beam search. + + Args: + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + sos (int): Start of sequence id + eos (int): End of sequence id + token_list (list[str]): List of tokens for debug log + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + """ + super().__init__() + # set scorers + self.weights = weights + self.scorers = dict() + self.full_scorers = dict() + self.part_scorers = dict() + # this module dict is required for recursive cast + # `self.to(device, dtype)` in `recog.py` + self.nn_dict = torch.nn.ModuleDict() + for k, v in scorers.items(): + w = weights.get(k, 0) + if w == 0 or v is None: + continue + assert isinstance( + v, ScorerInterface + ), f"{k} ({type(v)}) does not implement ScorerInterface" + self.scorers[k] = v + if isinstance(v, PartialScorerInterface): + self.part_scorers[k] = v + else: + self.full_scorers[k] = v + if isinstance(v, torch.nn.Module): + self.nn_dict[k] = v + + # set configurations + self.sos = sos + self.eos = eos + self.token_list = token_list + self.pre_beam_size = int(pre_beam_ratio * beam_size) + self.beam_size = beam_size + self.n_vocab = vocab_size + if ( + pre_beam_score_key is not None + and pre_beam_score_key != "full" + and pre_beam_score_key not in self.full_scorers + ): + raise KeyError(f"{pre_beam_score_key} is not found in {self.full_scorers}") + self.pre_beam_score_key = pre_beam_score_key + self.do_pre_beam = ( + self.pre_beam_score_key is not None + and self.pre_beam_size < self.n_vocab + and len(self.part_scorers) > 0 + ) + + def init_hyp(self, x: torch.Tensor) -> List[Hypothesis]: + """Get an initial hypothesis data. + + Args: + x (torch.Tensor): The encoder output feature + + Returns: + Hypothesis: The initial hypothesis. + + """ + init_states = dict() + init_scores = dict() + for k, d in self.scorers.items(): + init_states[k] = d.init_state(x) + init_scores[k] = 0.0 + return [ + Hypothesis( + score=0.0, + scores=init_scores, + states=init_states, + yseq=torch.tensor([self.sos], device=x.device), + ) + ] + + @staticmethod + def append_token(xs: torch.Tensor, x: int) -> torch.Tensor: + """Append new token to prefix tokens. + + Args: + xs (torch.Tensor): The prefix token + x (int): The new token to append + + Returns: + torch.Tensor: New tensor contains: xs + [x] with xs.dtype and xs.device + + """ + x = torch.tensor([x], dtype=xs.dtype, device=xs.device) + return torch.cat((xs, x)) + + def score_full( + self, hyp: Hypothesis, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.full_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.full_scorers` + and tensor score values of shape: `(self.n_vocab,)`, + and state dict that has string keys + and state values of `self.full_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.full_scorers.items(): + scores[k], states[k] = d.score(hyp.yseq, hyp.states[k], x) + return scores, states + + def score_partial( + self, hyp: Hypothesis, ids: torch.Tensor, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.part_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + ids (torch.Tensor): 1D tensor of new partial tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.part_scorers` + and tensor score values of shape: `(len(ids),)`, + and state dict that has string keys + and state values of `self.part_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.part_scorers.items(): + scores[k], states[k] = d.score_partial(hyp.yseq, ids, hyp.states[k], x) + return scores, states + + def beam( + self, weighted_scores: torch.Tensor, ids: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute topk full token ids and partial token ids. + + Args: + weighted_scores (torch.Tensor): The weighted sum scores for each tokens. + Its shape is `(self.n_vocab,)`. + ids (torch.Tensor): The partial token ids to compute topk + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + The topk full token ids and partial token ids. + Their shapes are `(self.beam_size,)` + + """ + # no pre beam performed + if weighted_scores.size(0) == ids.size(0): + top_ids = weighted_scores.topk(self.beam_size)[1] + return top_ids, top_ids + + # mask pruned in pre-beam not to select in topk + tmp = weighted_scores[ids] + weighted_scores[:] = -float("inf") + weighted_scores[ids] = tmp + top_ids = weighted_scores.topk(self.beam_size)[1] + local_ids = weighted_scores[ids].topk(self.beam_size)[1] + return top_ids, local_ids + + @staticmethod + def merge_scores( + prev_scores: Dict[str, float], + next_full_scores: Dict[str, torch.Tensor], + full_idx: int, + next_part_scores: Dict[str, torch.Tensor], + part_idx: int, + ) -> Dict[str, torch.Tensor]: + """Merge scores for new hypothesis. + + Args: + prev_scores (Dict[str, float]): + The previous hypothesis scores by `self.scorers` + next_full_scores (Dict[str, torch.Tensor]): scores by `self.full_scorers` + full_idx (int): The next token id for `next_full_scores` + next_part_scores (Dict[str, torch.Tensor]): + scores of partial tokens by `self.part_scorers` + part_idx (int): The new token id for `next_part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are scalar tensors by the scorers. + + """ + new_scores = dict() + for k, v in next_full_scores.items(): + new_scores[k] = prev_scores[k] + v[full_idx] + for k, v in next_part_scores.items(): + new_scores[k] = prev_scores[k] + v[part_idx] + return new_scores + + def merge_states(self, states: Any, part_states: Any, part_idx: int) -> Any: + """Merge states for new hypothesis. + + Args: + states: states of `self.full_scorers` + part_states: states of `self.part_scorers` + part_idx (int): The new token id for `part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are states of the scorers. + + """ + new_states = dict() + for k, v in states.items(): + new_states[k] = v + for k, d in self.part_scorers.items(): + new_states[k] = d.select_state(part_states[k], part_idx) + return new_states + + def search( + self, running_hyps: List[Hypothesis], x: torch.Tensor, am_score: torch.Tensor + ) -> List[Hypothesis]: + """Search new tokens for running hypotheses and encoded speech x. + + Args: + running_hyps (List[Hypothesis]): Running hypotheses on beam + x (torch.Tensor): Encoded speech feature (T, D) + + Returns: + List[Hypotheses]: Best sorted hypotheses + + """ + best_hyps = [] + part_ids = torch.arange(self.n_vocab, device=x.device) # no pre-beam + for hyp in running_hyps: + # scoring + weighted_scores = torch.zeros(self.n_vocab, dtype=x.dtype, device=x.device) + weighted_scores += am_score + scores, states = self.score_full(hyp, x) + for k in self.full_scorers: + weighted_scores += self.weights[k] * scores[k] + # partial scoring + if self.do_pre_beam: + pre_beam_scores = ( + weighted_scores + if self.pre_beam_score_key == "full" + else scores[self.pre_beam_score_key] + ) + part_ids = torch.topk(pre_beam_scores, self.pre_beam_size)[1] + part_scores, part_states = self.score_partial(hyp, part_ids, x) + for k in self.part_scorers: + weighted_scores[part_ids] += self.weights[k] * part_scores[k] + # add previous hyp score + weighted_scores += hyp.score + + # update hyps + for j, part_j in zip(*self.beam(weighted_scores, part_ids)): + # will be (2 x beam at most) + best_hyps.append( + Hypothesis( + score=weighted_scores[j], + yseq=self.append_token(hyp.yseq, j), + scores=self.merge_scores(hyp.scores, scores, j, part_scores, part_j), + states=self.merge_states(states, part_states, part_j), + ) + ) + + # sort and prune 2 x beam -> beam + best_hyps = sorted(best_hyps, key=lambda x: x.score, reverse=True)[ + : min(len(best_hyps), self.beam_size) + ] + return best_hyps + + def forward( + self, + x: torch.Tensor, + am_scores: torch.Tensor, + maxlenratio: float = 0.0, + minlenratio: float = 0.0, + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + If maxlenratio<0.0, its absolute value is interpreted + as a constant max output length. + minlenratio (float): Input length ratio to obtain min output length. + + Returns: + list[Hypothesis]: N-best decoding results + + """ + # set length bounds + maxlen = am_scores.shape[0] + logging.info("decoder input length: " + str(x.shape[0])) + logging.info("max output length: " + str(maxlen)) + + # main loop of prefix search + running_hyps = self.init_hyp(x) + ended_hyps = [] + for i in range(maxlen): + logging.debug("position " + str(i)) + best = self.search(running_hyps, x, am_scores[i]) + # post process of one iteration + running_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps) + # end detection + if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i): + logging.info(f"end detected at {i}") + break + if len(running_hyps) == 0: + logging.info("no hypothesis. Finish decoding.") + break + else: + logging.debug(f"remained hypotheses: {len(running_hyps)}") + + nbest_hyps = sorted(ended_hyps, key=lambda x: x.score, reverse=True) + # check the number of hypotheses reaching to eos + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, perform recognition " "again with smaller minlenratio." + ) + return ( + [] + if minlenratio < 0.1 + else self.forward(x, maxlenratio, max(0.0, minlenratio - 0.1)) + ) + + # report the best result + best = nbest_hyps[0] + for k, v in best.scores.items(): + logging.info(f"{v:6.2f} * {self.weights[k]:3} = {v * self.weights[k]:6.2f} for {k}") + logging.info(f"total log probability: {best.score:.2f}") + logging.info(f"normalized log probability: {best.score / len(best.yseq):.2f}") + logging.info(f"total number of ended hypotheses: {len(nbest_hyps)}") + if self.token_list is not None: + logging.info( + "best hypo: " + "".join([self.token_list[x.item()] for x in best.yseq[1:-1]]) + "\n" + ) + return nbest_hyps + + def post_process( + self, + i: int, + maxlen: int, + maxlenratio: float, + running_hyps: List[Hypothesis], + ended_hyps: List[Hypothesis], + ) -> List[Hypothesis]: + """Perform post-processing of beam search iterations. + + Args: + i (int): The length of hypothesis tokens. + maxlen (int): The maximum length of tokens in beam search. + maxlenratio (int): The maximum length ratio in beam search. + running_hyps (List[Hypothesis]): The running hypotheses in beam search. + ended_hyps (List[Hypothesis]): The ended hypotheses in beam search. + + Returns: + List[Hypothesis]: The new running hypotheses. + + """ + logging.debug(f"the number of running hypotheses: {len(running_hyps)}") + if self.token_list is not None: + logging.debug( + "best hypo: " + + "".join([self.token_list[x.item()] for x in running_hyps[0].yseq[1:]]) + ) + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + running_hyps = [ + h._replace(yseq=self.append_token(h.yseq, self.eos)) for h in running_hyps + ] + + # add ended hypotheses to a final list, and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in running_hyps: + if hyp.yseq[-1] == self.eos: + # e.g., Word LM needs to add final score + for k, d in chain(self.full_scorers.items(), self.part_scorers.items()): + s = d.final_score(hyp.states[k]) + hyp.scores[k] += s + hyp = hyp._replace(score=hyp.score + self.weights[k] * s) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + return remained_hyps diff --git a/funasr/models/paraformer/template.yaml b/funasr/models/paraformer/template.yaml new file mode 100644 index 0000000..249e88c --- /dev/null +++ b/funasr/models/paraformer/template.yaml @@ -0,0 +1,122 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Paraformer +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + predictor_weight: 1.0 + predictor_bias: 1 + sampling_ratio: 0.75 + +# encoder +encoder: SANMEncoder +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + +# decoder +decoder: ParaformerSANMDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 0 + +predictor: CifPredictorV2 +predictor_conf: + idim: 512 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + avg_nbest_model: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/paraformer_streaming/__init__.py b/funasr/models/paraformer_streaming/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/paraformer_streaming/export_meta.py b/funasr/models/paraformer_streaming/export_meta.py new file mode 100644 index 0000000..9740ecc --- /dev/null +++ b/funasr/models/paraformer_streaming/export_meta.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import types +import torch +from funasr.register import tables + + +def export_rebuild_model(model, **kwargs): + model.device = kwargs.get("device") + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + predictor_class = tables.predictor_classes.get(kwargs["predictor"] + "Export") + model.predictor = predictor_class(model.predictor, onnx=is_onnx) + + decoder_class = tables.decoder_classes.get(kwargs["decoder"] + "Export") + model.decoder = decoder_class(model.decoder, onnx=is_onnx) + + from funasr.utils.torch_function import sequence_mask + + model.make_pad_mask = sequence_mask(kwargs["max_seq_len"], flip=False) + + model.forward = types.MethodType(export_forward, model) + model.export_dummy_inputs = types.MethodType(export_dummy_inputs, model) + model.export_input_names = types.MethodType(export_input_names, model) + model.export_output_names = types.MethodType(export_output_names, model) + model.export_dynamic_axes = types.MethodType(export_dynamic_axes, model) + model.export_name = types.MethodType(export_name, model) + + return model + + +def export_rebuild_model(model, **kwargs): + # self.device = kwargs.get("device") + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + predictor_class = tables.predictor_classes.get(kwargs["predictor"] + "Export") + model.predictor = predictor_class(model.predictor, onnx=is_onnx) + + if kwargs["decoder"] == "ParaformerSANMDecoder": + kwargs["decoder"] = "ParaformerSANMDecoderOnline" + decoder_class = tables.decoder_classes.get(kwargs["decoder"] + "Export") + model.decoder = decoder_class(model.decoder, onnx=is_onnx) + + from funasr.utils.torch_function import sequence_mask + + model.make_pad_mask = sequence_mask(max_seq_len=None, flip=False) + + import copy + import types + + encoder_model = copy.copy(model) + decoder_model = copy.copy(model) + + # encoder + encoder_model.forward = types.MethodType(export_encoder_forward, encoder_model) + encoder_model.export_dummy_inputs = types.MethodType(export_encoder_dummy_inputs, encoder_model) + encoder_model.export_input_names = types.MethodType(export_encoder_input_names, encoder_model) + encoder_model.export_output_names = types.MethodType(export_encoder_output_names, encoder_model) + encoder_model.export_dynamic_axes = types.MethodType(export_encoder_dynamic_axes, encoder_model) + encoder_model.export_name = types.MethodType(export_encoder_name, encoder_model) + + # decoder + decoder_model.forward = types.MethodType(export_decoder_forward, decoder_model) + decoder_model.export_dummy_inputs = types.MethodType(export_decoder_dummy_inputs, decoder_model) + decoder_model.export_input_names = types.MethodType(export_decoder_input_names, decoder_model) + decoder_model.export_output_names = types.MethodType(export_decoder_output_names, decoder_model) + decoder_model.export_dynamic_axes = types.MethodType(export_decoder_dynamic_axes, decoder_model) + decoder_model.export_name = types.MethodType(export_decoder_name, decoder_model) + + return encoder_model, decoder_model + + +def export_encoder_forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, +): + # a. To device + batch = {"speech": speech, "speech_lengths": speech_lengths, "online": True} + # batch = to_device(batch, device=self.device) + + enc, enc_len = self.encoder(**batch) + mask = self.make_pad_mask(enc_len)[:, None, :] + alphas, _ = self.predictor.forward_cnn(enc, mask) + + return enc, enc_len, alphas + + +def export_encoder_dummy_inputs(self): + speech = torch.randn(2, 30, 560) + speech_lengths = torch.tensor([6, 30], dtype=torch.int32) + return (speech, speech_lengths) + + +def export_encoder_input_names(self): + return ["speech", "speech_lengths"] + + +def export_encoder_output_names(self): + return ["enc", "enc_len", "alphas"] + + +def export_encoder_dynamic_axes(self): + return { + "speech": {0: "batch_size", 1: "feats_length"}, + "speech_lengths": { + 0: "batch_size", + }, + "enc": {0: "batch_size", 1: "feats_length"}, + "enc_len": { + 0: "batch_size", + }, + "alphas": {0: "batch_size", 1: "feats_length"}, + } + + +def export_encoder_name(self): + return "model.onnx" + + +def export_decoder_forward( + self, + enc: torch.Tensor, + enc_len: torch.Tensor, + acoustic_embeds: torch.Tensor, + acoustic_embeds_len: torch.Tensor, + *args, +): + decoder_out, out_caches = self.decoder( + enc, enc_len, acoustic_embeds, acoustic_embeds_len, *args + ) + sample_ids = decoder_out.argmax(dim=-1) + + return decoder_out, sample_ids, out_caches + + +def export_decoder_dummy_inputs(self): + dummy_inputs = self.decoder.get_dummy_inputs(enc_size=self.encoder._output_size) + return dummy_inputs + + +def export_decoder_input_names(self): + return self.decoder.get_input_names() + + +def export_decoder_output_names(self): + return self.decoder.get_output_names() + + +def export_decoder_dynamic_axes(self): + return self.decoder.get_dynamic_axes() + + +def export_decoder_name(self): + return "decoder.onnx" diff --git a/funasr/models/paraformer_streaming/model.py b/funasr/models/paraformer_streaming/model.py new file mode 100644 index 0000000..13e76c7 --- /dev/null +++ b/funasr/models/paraformer_streaming/model.py @@ -0,0 +1,724 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import time +import torch +import logging +from typing import Dict, Tuple +from contextlib import contextmanager +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.models.ctc.ctc import CTC +from funasr.utils import postprocess_utils +from funasr.metrics.compute_acc import th_accuracy +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.model import Paraformer +from funasr.models.paraformer.search import Hypothesis +from funasr.models.paraformer.cif_predictor import mae_loss +from funasr.train_utils.device_funcs import force_gatherable +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.models.transformer.utils.nets_utils import make_pad_mask, pad_list +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "ParaformerStreaming") +class ParaformerStreaming(Paraformer): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2206.08317 + """ + + def __init__( + self, + *args, + **kwargs, + ): + + super().__init__(*args, **kwargs) + + # import pdb; + # pdb.set_trace() + self.sampling_ratio = kwargs.get("sampling_ratio", 0.2) + + self.scama_mask = None + if ( + hasattr(self.encoder, "overlap_chunk_cls") + and self.encoder.overlap_chunk_cls is not None + ): + from funasr.models.scama.chunk_utilis import ( + build_scama_mask_for_cross_attention_decoder, + ) + + self.build_scama_mask_for_cross_attention_decoder_fn = ( + build_scama_mask_for_cross_attention_decoder + ) + self.decoder_attention_chunk_type = kwargs.get("decoder_attention_chunk_type", "chunk") + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + # import pdb; + # pdb.set_trace() + decoding_ind = kwargs.get("decoding_ind") + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # Encoder + if hasattr(self.encoder, "overlap_chunk_cls"): + ind = self.encoder.overlap_chunk_cls.random_choice(self.training, decoding_ind) + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths, ind=ind) + else: + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_ctc, cer_ctc = None, None + loss_pre = None + stats = dict() + + # decoder: CTC branch + + if self.ctc_weight > 0.0: + if hasattr(self.encoder, "overlap_chunk_cls"): + encoder_out_ctc, encoder_out_lens_ctc = self.encoder.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + else: + encoder_out_ctc, encoder_out_lens_ctc = encoder_out, encoder_out_lens + + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out_ctc, encoder_out_lens_ctc, text, text_lengths + ) + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # decoder: Attention decoder branch + loss_att, acc_att, cer_att, wer_att, loss_pre, pre_loss_att = self._calc_att_predictor_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + loss_pre * self.predictor_weight + else: + loss = ( + self.ctc_weight * loss_ctc + + (1 - self.ctc_weight) * loss_att + + loss_pre * self.predictor_weight + ) + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["pre_loss_att"] = pre_loss_att.detach() if pre_loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = (text_lengths + self.predictor_bias).sum() + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode_chunk( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + cache: dict = None, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens, _ = self.encoder.forward_chunk( + speech, speech_lengths, cache=cache["encoder"] + ) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + return encoder_out, torch.tensor([encoder_out.size(1)]) + + def _calc_att_predictor_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + if self.predictor_bias == 1: + _, ys_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_pad_lens = ys_pad_lens + self.predictor_bias + mask_chunk_predictor = None + if self.encoder.overlap_chunk_cls is not None: + mask_chunk_predictor = self.encoder.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, _ = self.predictor( + encoder_out, + ys_pad, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=ys_pad_lens, + ) + predictor_alignments, predictor_alignments_len = self.predictor.gen_frame_alignments( + pre_alphas, encoder_out_lens + ) + + scama_mask = None + if ( + self.encoder.overlap_chunk_cls is not None + and self.decoder_attention_chunk_type == "chunk" + ): + encoder_chunk_size = self.encoder.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=ys_pad_lens, + is_training=self.training, + ) + elif self.encoder.overlap_chunk_cls is not None: + encoder_out, encoder_out_lens = self.encoder.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + # 0. sampler + decoder_out_1st = None + pre_loss_att = None + if self.sampling_ratio > 0.0: + + if self.use_1st_decoder_loss: + sematic_embeds, decoder_out_1st, pre_loss_att = self.sampler_with_grad( + encoder_out, + encoder_out_lens, + ys_pad, + ys_pad_lens, + pre_acoustic_embeds, + scama_mask, + ) + else: + sematic_embeds, decoder_out_1st = self.sampler( + encoder_out, + encoder_out_lens, + ys_pad, + ys_pad_lens, + pre_acoustic_embeds, + scama_mask, + ) + else: + sematic_embeds = pre_acoustic_embeds + + # 1. Forward decoder + decoder_outs = self.decoder( + encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens, scama_mask + ) + decoder_out, _ = decoder_outs[0], decoder_outs[1] + + if decoder_out_1st is None: + decoder_out_1st = decoder_out + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_pad) + acc_att = th_accuracy( + decoder_out_1st.view(-1, self.vocab_size), + ys_pad, + ignore_label=self.ignore_id, + ) + loss_pre = self.criterion_pre(ys_pad_lens.type_as(pre_token_length), pre_token_length) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out_1st.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att, loss_pre, pre_loss_att + + def sampler( + self, + encoder_out, + encoder_out_lens, + ys_pad, + ys_pad_lens, + pre_acoustic_embeds, + chunk_mask=None, + ): + + tgt_mask = (~make_pad_mask(ys_pad_lens, maxlen=ys_pad_lens.max())[:, :, None]).to( + ys_pad.device + ) + ys_pad_masked = ys_pad * tgt_mask[:, :, 0] + if self.share_embedding: + ys_pad_embed = self.decoder.output_layer.weight[ys_pad_masked] + else: + ys_pad_embed = self.decoder.embed(ys_pad_masked) + with torch.no_grad(): + decoder_outs = self.decoder( + encoder_out, encoder_out_lens, pre_acoustic_embeds, ys_pad_lens, chunk_mask + ) + decoder_out, _ = decoder_outs[0], decoder_outs[1] + pred_tokens = decoder_out.argmax(-1) + nonpad_positions = ys_pad.ne(self.ignore_id) + seq_lens = (nonpad_positions).sum(1) + same_num = ((pred_tokens == ys_pad) & nonpad_positions).sum(1) + input_mask = torch.ones_like(nonpad_positions) + bsz, seq_len = ys_pad.size() + for li in range(bsz): + target_num = ( + ((seq_lens[li] - same_num[li].sum()).float()) * self.sampling_ratio + ).long() + if target_num > 0: + input_mask[li].scatter_( + dim=0, index=torch.randperm(seq_lens[li])[:target_num].cuda(), value=0 + ) + input_mask = input_mask.eq(1) + input_mask = input_mask.masked_fill(~nonpad_positions, False) + input_mask_expand_dim = input_mask.unsqueeze(2).to(pre_acoustic_embeds.device) + + sematic_embeds = pre_acoustic_embeds.masked_fill( + ~input_mask_expand_dim, 0 + ) + ys_pad_embed.masked_fill(input_mask_expand_dim, 0) + return sematic_embeds * tgt_mask, decoder_out * tgt_mask + + def calc_predictor(self, encoder_out, encoder_out_lens): + + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + mask_chunk_predictor = None + if self.encoder.overlap_chunk_cls is not None: + mask_chunk_predictor = self.encoder.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, pre_peak_index = self.predictor( + encoder_out, + None, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=None, + ) + predictor_alignments, predictor_alignments_len = self.predictor.gen_frame_alignments( + pre_alphas, + encoder_out_lens + 1 if self.predictor.tail_threshold > 0.0 else encoder_out_lens, + ) + + scama_mask = None + if ( + self.encoder.overlap_chunk_cls is not None + and self.decoder_attention_chunk_type == "chunk" + ): + encoder_chunk_size = self.encoder.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=None, + is_training=self.training, + ) + self.scama_mask = scama_mask + + return pre_acoustic_embeds, pre_token_length, pre_alphas, pre_peak_index + + def calc_predictor_chunk(self, encoder_out, encoder_out_lens, cache=None, **kwargs): + is_final = kwargs.get("is_final", False) + + return self.predictor.forward_chunk(encoder_out, cache["encoder"], is_final=is_final) + + def cal_decoder_with_predictor( + self, encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens + ): + decoder_outs = self.decoder( + encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens, self.scama_mask + ) + decoder_out = decoder_outs[0] + decoder_out = torch.log_softmax(decoder_out, dim=-1) + return decoder_out, ys_pad_lens + + def cal_decoder_with_predictor_chunk( + self, encoder_out, encoder_out_lens, sematic_embeds, ys_pad_lens, cache=None + ): + decoder_outs = self.decoder.forward_chunk(encoder_out, sematic_embeds, cache["decoder"]) + decoder_out = decoder_outs + decoder_out = torch.log_softmax(decoder_out, dim=-1) + return decoder_out, ys_pad_lens + + def init_cache_seesion(self, session_id: str, cache: dict = {}, **kwargs): + chunk_size = kwargs.get("chunk_size", [0, 10, 5]) + encoder_chunk_look_back = kwargs.get("encoder_chunk_look_back", 0) + decoder_chunk_look_back = kwargs.get("decoder_chunk_look_back", 0) + batch_size = 1 + + enc_output_size = kwargs["encoder_conf"]["output_size"] + feats_dims = kwargs["frontend_conf"]["n_mels"] * kwargs["frontend_conf"]["lfr_m"] + cache_encoder = { + "start_idx": 0, + "cif_hidden": torch.zeros((batch_size, 1, enc_output_size)), + "cif_alphas": torch.zeros((batch_size, 1)), + "chunk_size": chunk_size, + "encoder_chunk_look_back": encoder_chunk_look_back, + "last_chunk": False, + "opt": None, + "feats": torch.zeros((batch_size, chunk_size[0] + chunk_size[2], feats_dims)), + "tail_chunk": False, + } + cache[session_id]["encoder"] = cache_encoder + + cache_decoder = { + "decode_fsmn": None, + "decoder_chunk_look_back": decoder_chunk_look_back, + "opt": None, + "chunk_size": chunk_size, + } + cache[session_id]["decoder"] = cache_decoder + cache[session_id]["frontend"] = {} + cache[session_id]["prev_samples"] = torch.empty(0) + + return cache + + def init_cache(self, cache: dict = {}, **kwargs): + chunk_size = kwargs.get("chunk_size", [0, 10, 5]) + encoder_chunk_look_back = kwargs.get("encoder_chunk_look_back", 0) + decoder_chunk_look_back = kwargs.get("decoder_chunk_look_back", 0) + batch_size = 1 + + enc_output_size = kwargs["encoder_conf"]["output_size"] + feats_dims = kwargs["frontend_conf"]["n_mels"] * kwargs["frontend_conf"]["lfr_m"] + cache_encoder = { + "start_idx": 0, + "cif_hidden": torch.zeros((batch_size, 1, enc_output_size)), + "cif_alphas": torch.zeros((batch_size, 1)), + "chunk_size": chunk_size, + "encoder_chunk_look_back": encoder_chunk_look_back, + "last_chunk": False, + "opt": None, + "feats": torch.zeros((batch_size, chunk_size[0] + chunk_size[2], feats_dims)), + "tail_chunk": False, + } + cache["encoder"] = cache_encoder + + cache_decoder = { + "decode_fsmn": None, + "decoder_chunk_look_back": decoder_chunk_look_back, + "opt": None, + "chunk_size": chunk_size, + } + cache["decoder"] = cache_decoder + cache["frontend"] = {} + cache["prev_samples"] = torch.empty(0) + + return cache + + def generate_chunk( + self, + speech, + speech_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + cache = kwargs.get("cache", {}) + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + encoder_out, encoder_out_lens = self.encode_chunk( + speech, speech_lengths, cache=cache, is_final=kwargs.get("is_final", False) + ) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # predictor + predictor_outs = self.calc_predictor_chunk( + encoder_out, encoder_out_lens, cache=cache, is_final=kwargs.get("is_final", False) + ) + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = ( + predictor_outs[0], + predictor_outs[1], + predictor_outs[2], + predictor_outs[3], + ) + pre_token_length = pre_token_length.round().long() + if torch.max(pre_token_length) < 1: + return [] + decoder_outs = self.cal_decoder_with_predictor_chunk( + encoder_out, encoder_out_lens, pre_acoustic_embeds, pre_token_length, cache=cache + ) + decoder_out, ys_pad_lens = decoder_outs[0], decoder_outs[1] + + results = [] + b, n, d = decoder_out.size() + if isinstance(key[0], (list, tuple)): + key = key[0] + for i in range(b): + x = encoder_out[i, : encoder_out_lens[i], :] + am_scores = decoder_out[i, : pre_token_length[i], :] + if self.beam_search is not None: + nbest_hyps = self.beam_search( + x=x, + am_scores=am_scores, + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + else: + + yseq = am_scores.argmax(dim=-1) + score = am_scores.max(dim=-1)[0] + score = torch.sum(score, dim=-1) + # pad with mask tokens to ensure compatibility with sos/eos tokens + yseq = torch.tensor([self.sos] + yseq.tolist() + [self.eos], device=yseq.device) + nbest_hyps = [Hypothesis(yseq=yseq, score=score)] + for nbest_idx, hyp in enumerate(nbest_hyps): + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + # text = tokenizer.tokens2text(token) + + result_i = token + + results.extend(result_i) + + return results + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + cache: dict = {}, + **kwargs, + ): + + # init beamsearch + is_use_ctc = kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None + is_use_lm = ( + kwargs.get("lm_weight", 0.0) > 0.00001 and kwargs.get("lm_file", None) is not None + ) + if self.beam_search is None and (is_use_lm or is_use_ctc): + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + session_id = kwargs.pop("session_id", None) + if session_id: + if len(cache[session_id]) == 0: + self.init_cache_seesion(session_id, cache, **kwargs) + else: + cache = {} + if len(cache) == 0: + self.init_cache(cache, **kwargs) + + meta_data = {} + chunk_size = kwargs.get("chunk_size", [0, 10, 5]) + chunk_stride_samples = int(chunk_size[1] * 960) # 600ms + + time1 = time.perf_counter() + cfg = {"is_final": kwargs.get("is_final", False)} + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + cache=cfg, + ) + _is_final = cfg["is_final"] # if data_in is a file or url, set is_final=True + + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + assert len(audio_sample_list) == 1, "batch_size must be set 1" + + if session_id: + audio_sample = torch.cat((cache[session_id]["prev_samples"], audio_sample_list[0])) + else: + audio_sample = torch.cat((cache["prev_samples"], audio_sample_list[0])) + + n = int(len(audio_sample) // chunk_stride_samples + int(_is_final)) + m = int(len(audio_sample) % chunk_stride_samples * (1 - int(_is_final))) + tokens = [] + for i in range(n): + kwargs["is_final"] = _is_final and i == n - 1 + audio_sample_i = audio_sample[i * chunk_stride_samples : (i + 1) * chunk_stride_samples] + if kwargs["is_final"] and len(audio_sample_i) < 960: + if session_id: + cache[session_id]["encoder"]["tail_chunk"] = True + speech = cache[session_id]["encoder"]["feats"] + else: + cache["encoder"]["tail_chunk"] = True + speech = cache["encoder"]["feats"] + speech_lengths = torch.tensor([speech.shape[1]], dtype=torch.int64).to( + speech.device + ) + else: + # extract fbank feats + if session_id: + frontend_cache = cache[session_id]["frontend"] + else: + frontend_cache = cache["frontend"] + speech, speech_lengths = extract_fbank( + [audio_sample_i], + data_type=kwargs.get("data_type", "sound"), + frontend=frontend, + cache=frontend_cache, + is_final=kwargs["is_final"], + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + if session_id: + chunck_cache = cache[session_id] + else: + chunck_cache = cache + tokens_i = self.generate_chunk( + speech, + speech_lengths, + key=key, + tokenizer=tokenizer, + cache=chunck_cache, + frontend=frontend, + **kwargs, + ) + tokens.extend(tokens_i) + + text_postprocessed, _ = postprocess_utils.sentence_postprocess(tokens) + + result_i = {"key": key[0], "text": text_postprocessed} + result = [result_i] + + if session_id: + cache[session_id]["prev_samples"] = audio_sample[:-m] + if _is_final: + self.init_cache_seesion(session_id, cache, **kwargs) + else: + cache["prev_samples"] = audio_sample[:-m] + if _is_final: + self.init_cache(cache, **kwargs) + if kwargs.get("output_dir"): + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{1}best_recog"] + ibest_writer["token"][key[0]] = " ".join(tokens) + ibest_writer["text"][key[0]] = text_postprocessed + + return result, meta_data + + def export(self, **kwargs): + from .export_meta import export_rebuild_model + + models = export_rebuild_model(model=self, **kwargs) + return models diff --git a/funasr/models/paraformer_streaming/template.yaml b/funasr/models/paraformer_streaming/template.yaml new file mode 100644 index 0000000..889971a --- /dev/null +++ b/funasr/models/paraformer_streaming/template.yaml @@ -0,0 +1,143 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: ParaformerStreaming +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + predictor_weight: 1.0 + predictor_bias: 1 + sampling_ratio: 0.75 + +# encoder +encoder: SANMEncoderChunkOpt +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe_online + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + chunk_size: + - 12 + - 15 + stride: + - 8 + - 10 + pad_left: + - 0 + - 0 + encoder_att_look_back_factor: + - 4 + - 4 + decoder_att_look_back_factor: + - 1 + - 1 + +# decoder +decoder: ParaformerSANMDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 5 + +predictor: CifPredictorV2 +predictor_conf: + idim: 512 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + +# frontend related +frontend: WavFrontendOnline +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/qwen_audio/__init__.py b/funasr/models/qwen_audio/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/qwen_audio/audio.py b/funasr/models/qwen_audio/audio.py new file mode 100644 index 0000000..a1aad79 --- /dev/null +++ b/funasr/models/qwen_audio/audio.py @@ -0,0 +1,442 @@ +import base64 +import gzip +from dataclasses import dataclass +from typing import Dict, Iterable, Optional, List + +import numpy as np +import torch +import torch.nn.functional as F +from torch import Tensor, nn +from subprocess import CalledProcessError, run, Popen, PIPE + +import os +from functools import lru_cache +from typing import Optional, Union +from funasr.register import tables + + +def exact_div(x, y): + assert x % y == 0 + return x // y + + +# hard-coded audio hyperparameters +SAMPLE_RATE = 16000 +N_FFT = 400 +N_MELS = 80 +HOP_LENGTH = 160 +CHUNK_LENGTH = 30 +N_SAMPLES = CHUNK_LENGTH * SAMPLE_RATE # 480000 samples in a 30-second chunk +N_FRAMES = exact_div(N_SAMPLES, HOP_LENGTH) # 3000 frames in a mel spectrogram input + +N_SAMPLES_PER_TOKEN = HOP_LENGTH * 2 # the initial convolutions has stride 2 +FRAMES_PER_SECOND = exact_div(SAMPLE_RATE, HOP_LENGTH) # 10ms per audio frame +TOKENS_PER_SECOND = exact_div(SAMPLE_RATE, N_SAMPLES_PER_TOKEN) # 20ms per audio token + + +def get_T_after_cnn(L_in, dilation=1): + for padding, kernel_size, stride in eval("[(1,3,1)] + [(1,3,2)] "): + L_out = L_in + 2 * padding - dilation * (kernel_size - 1) - 1 + L_out = 1 + L_out // stride + L_in = L_out + return L_out + + +def load_bytesio_audio(content, sr: int = SAMPLE_RATE): + cmd = [ + "ffmpeg", + "-nostdin", + "-threads", + "0", + "-i", + "pipe:", + "-f", + "s16le", + "-ac", + "1", + "-acodec", + "pcm_s16le", + "-ar", + str(sr), + "pipe:", + ] + p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=-1) + out, _ = p.communicate(input=content) + return np.frombuffer(out, np.int16).flatten().astype(np.float32) / 32768.0 + + +def load_audio(file: str, sr: int = SAMPLE_RATE): + """ + Open an audio file and read as mono waveform, resampling as necessary + + Parameters + ---------- + file: str + The audio file to open + + sr: int + The sample rate to resample the audio if necessary + + Returns + ------- + A NumPy array containing the audio waveform, in float32 dtype. + """ + + # This launches a subprocess to decode audio while down-mixing + # and resampling as necessary. Requires the ffmpeg CLI in PATH. + # fmt: off + cmd = [ + "ffmpeg", + "-nostdin", + "-threads", "0", + "-i", file, + "-f", "s16le", + "-ac", "1", + "-acodec", "pcm_s16le", + "-ar", str(sr), + "-" + ] + # fmt: on + try: + out = run(cmd, capture_output=True, check=True).stdout + except CalledProcessError as e: + raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e + + return np.frombuffer(out, np.int16).flatten().astype(np.float32) / 32768.0 + + +def pad_or_trim(array, length: int = N_SAMPLES, *, axis: int = -1): + """ + Pad or trim the audio array to N_SAMPLES, as expected by the encoder. + """ + if torch.is_tensor(array): + if array.shape[axis] > length: + array = array.index_select(dim=axis, index=torch.arange(length, device=array.device)) + + if array.shape[axis] < length: + pad_widths = [(0, 0)] * array.ndim + pad_widths[axis] = (0, length - array.shape[axis]) + array = F.pad(array, [pad for sizes in pad_widths[::-1] for pad in sizes]) + else: + if array.shape[axis] > length: + array = array.take(indices=range(length), axis=axis) + + if array.shape[axis] < length: + pad_widths = [(0, 0)] * array.ndim + pad_widths[axis] = (0, length - array.shape[axis]) + array = np.pad(array, pad_widths) + + return array + + +def trim(array, length: int = N_SAMPLES, *, axis: int = -1): + """ + Pad or trim the audio array to N_SAMPLES, as expected by the encoder. + """ + if torch.is_tensor(array): + if array.shape[axis] > length: + array = array.index_select(dim=axis, index=torch.arange(length, device=array.device)) + else: + if array.shape[axis] > length: + array = array.take(indices=range(length), axis=axis) + return array + + +@lru_cache(maxsize=None) +def mel_filters(device, n_mels: int = N_MELS) -> torch.Tensor: + """ + load the mel filterbank matrix for projecting STFT into a Mel spectrogram. + Allows decoupling librosa dependency; saved using: + + np.savez_compressed( + "mel_filters.npz", + mel_80=librosa.filters.mel(sr=16000, n_fft=400, n_mels=80), + ) + """ + assert n_mels == 80, f"Unsupported n_mels: {n_mels}" + with np.load( + os.path.join(os.path.dirname(__file__), "mel_filters.npz") # todo + # os.path.join("assets", "mel_filters.npz") + ) as f: + return torch.from_numpy(f[f"mel_{n_mels}"]).to(device) + + +def log_mel_spectrogram( + audio: Union[str, np.ndarray, torch.Tensor], + n_mels: int = N_MELS, + padding: int = 0, + device: Optional[Union[str, torch.device]] = None, +): + """ + Compute the log-Mel spectrogram of + + Parameters + ---------- + audio: Union[str, np.ndarray, torch.Tensor], shape = (*) + The path to audio or either a NumPy array or Tensor containing the audio waveform in 16 kHz + + n_mels: int + The number of Mel-frequency filters, only 80 is supported + + padding: int + Number of zero samples to pad to the right + + device: Optional[Union[str, torch.device]] + If given, the audio tensor is moved to this device before STFT + + Returns + ------- + torch.Tensor, shape = (80, n_frames) + A Tensor that contains the Mel spectrogram + """ + if not torch.is_tensor(audio): + if isinstance(audio, str): + audio = load_audio(audio) + audio = torch.from_numpy(audio) + + if device is not None: + audio = audio.to(device) + if padding > 0: + audio = F.pad(audio, (0, padding)) + window = torch.hann_window(N_FFT).to(audio.device) + stft = torch.stft(audio, N_FFT, HOP_LENGTH, window=window, return_complex=True) + magnitudes = stft[..., :-1].abs() ** 2 + + filters = mel_filters(audio.device, n_mels) + mel_spec = filters @ magnitudes + + log_spec = torch.clamp(mel_spec, min=1e-10).log10() + log_spec = torch.maximum(log_spec, log_spec.max() - 8.0) + log_spec = (log_spec + 4.0) / 4.0 + return log_spec + + +@dataclass +class ModelDimensions: + n_mels: int + n_audio_ctx: int + n_audio_state: int + n_audio_head: int + n_audio_layer: int + n_vocab: int + n_text_ctx: int + n_text_state: int + n_text_head: int + n_text_layer: int + + +class LayerNorm(nn.LayerNorm): + def forward(self, x: Tensor) -> Tensor: + # return super().forward(x.float()).type(x.dtype) + return super().forward(x).type(x.dtype) + + +class Linear(nn.Linear): + def forward(self, x: Tensor) -> Tensor: + return F.linear( + x, + self.weight.to(x.dtype), + None if self.bias is None else self.bias.to(x.dtype), + ) + + +class Conv1d(nn.Conv1d): + def _conv_forward(self, x: Tensor, weight: Tensor, bias: Optional[Tensor]) -> Tensor: + return super()._conv_forward( + x, weight.to(x.dtype), None if bias is None else bias.to(x.dtype) + ) + + +def sinusoids(length, channels, max_timescale=10000): + """Returns sinusoids for positional embedding""" + assert channels % 2 == 0 + log_timescale_increment = np.log(max_timescale) / (channels // 2 - 1) + inv_timescales = torch.exp(-log_timescale_increment * torch.arange(channels // 2)) + scaled_time = torch.arange(length)[:, np.newaxis] * inv_timescales[np.newaxis, :] + return torch.cat([torch.sin(scaled_time), torch.cos(scaled_time)], dim=1) + + +class MultiHeadAttention(nn.Module): + def __init__(self, n_state: int, n_head: int): + super().__init__() + self.n_head = n_head + self.query = Linear(n_state, n_state) + self.key = Linear(n_state, n_state, bias=False) + self.value = Linear(n_state, n_state) + self.out = Linear(n_state, n_state) + + def forward( + self, + x: Tensor, + xa: Optional[Tensor] = None, + mask: Optional[Tensor] = None, + kv_cache: Optional[dict] = None, + ): + q = self.query(x) + + if kv_cache is None or xa is None or self.key not in kv_cache: + # hooks, if installed (i.e. kv_cache is not None), will prepend the cached kv tensors; + # otherwise, perform key/value projections for self- or cross-attention as usual. + k = self.key(x if xa is None else xa) + v = self.value(x if xa is None else xa) + else: + # for cross-attention, calculate keys and values once and reuse in subsequent calls. + k = kv_cache[self.key] + v = kv_cache[self.value] + + wv, qk = self.qkv_attention(q, k, v, mask) + return self.out(wv), qk + + def qkv_attention(self, q: Tensor, k: Tensor, v: Tensor, mask: Optional[Tensor] = None): + n_batch, n_ctx, n_state = q.shape + scale = (n_state // self.n_head) ** -0.25 + q = q.view(*q.shape[:2], self.n_head, -1).permute(0, 2, 1, 3) * scale + k = k.view(*k.shape[:2], self.n_head, -1).permute(0, 2, 3, 1) * scale + v = v.view(*v.shape[:2], self.n_head, -1).permute(0, 2, 1, 3) + + qk = q @ k + if mask is not None: + qk += mask + + w = F.softmax(qk, dim=-1).to(q.dtype) + return (w @ v).permute(0, 2, 1, 3).flatten(start_dim=2), qk.detach() + + +class ResidualAttentionBlock(nn.Module): + def __init__(self, n_state: int, n_head: int, cross_attention: bool = False): + super().__init__() + + self.attn = MultiHeadAttention(n_state, n_head) + self.attn_ln = LayerNorm(n_state) + + self.cross_attn = MultiHeadAttention(n_state, n_head) if cross_attention else None + self.cross_attn_ln = LayerNorm(n_state) if cross_attention else None + + n_mlp = n_state * 4 + self.mlp = nn.Sequential(Linear(n_state, n_mlp), nn.GELU(), Linear(n_mlp, n_state)) + self.mlp_ln = LayerNorm(n_state) + + def forward( + self, + x: Tensor, + xa: Optional[Tensor] = None, + mask: Optional[Tensor] = None, + kv_cache: Optional[dict] = None, + ): + x = x + self.attn(self.attn_ln(x), mask=mask, kv_cache=kv_cache)[0] + if self.cross_attn: + x = x + self.cross_attn(self.cross_attn_ln(x), xa, kv_cache=kv_cache)[0] + x = x + self.mlp(self.mlp_ln(x)) + return x + + +@tables.register("encoder_classes", "QwenAudioEncoder") +class QwenAudioEncoder(nn.Module): + def __init__( + self, + n_mels: int, + n_ctx: int, + n_state: int, + n_head: int, + n_layer: int, + output_dim: int = 512, + avg_pool: bool = True, + add_audio_bos_eos_token: bool = True, + **kwargs, + ): + super().__init__() + self.conv1 = Conv1d(n_mels, n_state, kernel_size=3, padding=1) + self.conv2 = Conv1d(n_state, n_state, kernel_size=3, stride=2, padding=1) + self.register_buffer("positional_embedding", sinusoids(n_ctx, n_state)) + + self.blocks: Iterable[ResidualAttentionBlock] = nn.ModuleList( + [ResidualAttentionBlock(n_state, n_head) for _ in range(n_layer)] + ) + self.ln_post = LayerNorm(n_state) + + if avg_pool: + self.avg_pooler = nn.AvgPool1d(2, stride=2) + else: + self.avg_pooler = None + self.proj = nn.Linear(n_state, output_dim) + if add_audio_bos_eos_token: + self.audio_bos_eos_token = nn.Embedding(2, output_dim) + else: + self.audio_bos_eos_token = None + self.output_dim = output_dim + self.n_head = n_head + + def forward(self, x: Tensor, padding_mask: Tensor = None, audio_lengths: Tensor = None): + """ + x : torch.Tensor, shape = (batch_size, n_mels, n_ctx) + the mel spectrogram of the audio + """ + x = x.to(dtype=self.conv1.weight.dtype, device=self.conv1.weight.device) + if audio_lengths is not None: + input_mel_len = audio_lengths[:, 0] * 2 + max_mel_len_in_batch = input_mel_len.max() + x = x[:, :, :max_mel_len_in_batch] + x = F.gelu(self.conv1(x)) + x = F.gelu(self.conv2(x)) + x = x.permute(0, 2, 1) # B, L, D + bsz = x.size(0) + src_len = x.size(1) + + self.input_positional_embedding = self.positional_embedding[:src_len] + assert ( + x.shape[1:] == self.input_positional_embedding.shape + ), f"incorrect audio shape: {x.shape[1:], self.input_positional_embedding.shape}" + x = (x + self.input_positional_embedding).to(x.dtype) + if padding_mask is not None: + padding_mask = padding_mask.to( + dtype=self.conv1.weight.dtype, device=self.conv1.weight.device + ) + batch_src_len = padding_mask.size(1) + x = x[:, :batch_src_len, :] + padding_mask = padding_mask.view(bsz, -1, batch_src_len) + padding_mask_ = padding_mask.all(1) + x[padding_mask_] = 0 + key_padding_mask = ( + padding_mask_.view(bsz, 1, 1, batch_src_len) + .expand(-1, self.n_head, -1, -1) + .reshape(bsz, self.n_head, 1, batch_src_len) + ) + new_padding_mask = torch.zeros_like(key_padding_mask, dtype=x.dtype) + padding_mask = new_padding_mask.masked_fill(key_padding_mask, float("-inf")) + + for block in self.blocks: + x = block(x, mask=padding_mask) + + if self.avg_pooler: + x = x.permute(0, 2, 1) + x = self.avg_pooler(x) + x = x.permute(0, 2, 1) + + x = self.ln_post(x) + x = self.proj(x) + + if self.audio_bos_eos_token is not None: + bos = self.audio_bos_eos_token.weight[0][None, :] + eos = self.audio_bos_eos_token.weight[1][None, :] + else: + bos, eos = None, None + return x, bos, eos + + def encode(self, input_audios: Tensor, input_audio_lengths: Tensor, audio_span_tokens: List): + real_input_audio_lens = input_audio_lengths[:, 0].tolist() + max_len_in_batch = max(real_input_audio_lens) + padding_mask = torch.ones([input_audios.size(0), max_len_in_batch]).to( + dtype=self.conv1.weight.dtype, device=self.conv1.weight.device + ) + for index in range(len(input_audios)): + padding_mask[index, : input_audio_lengths[index][0].item()] = 0 + x, bos, eos = self(input_audios, padding_mask, input_audio_lengths) + output_audios = [] + for i in range(len(audio_span_tokens)): + audio_span = audio_span_tokens[i] + audio = x[i][: audio_span - 2] + if bos is not None: + audio = torch.concat([bos, audio, eos]) + assert len(audio) == audio_span + output_audios.append(audio) + return output_audios diff --git a/funasr/models/qwen_audio/model.py b/funasr/models/qwen_audio/model.py new file mode 100644 index 0000000..b0af456 --- /dev/null +++ b/funasr/models/qwen_audio/model.py @@ -0,0 +1,151 @@ +from dataclasses import dataclass +from typing import Dict +from typing import Iterable, Optional +import time +import numpy as np +import torch +import torch.nn.functional as F +from torch import Tensor +from torch import nn +import whisper +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + + +from funasr.register import tables + + +@tables.register("model_classes", "Qwen/Qwen-Audio") +@tables.register("model_classes", "Qwen-Audio") +@tables.register("model_classes", "Qwen/QwenAudio") +@tables.register("model_classes", "QwenAudio") +@tables.register("model_classes", "QwenAudioWarp") +class QwenAudioWarp(nn.Module): + """ + Qwen-Audio: Advancing Universal Audio Understanding via Unified Large-Scale Audio-Language Models + https://arxiv.org/abs/2311.07919 + Modified from https://github.com/QwenLM/Qwen-Audio + """ + + def __init__(self, *args, **kwargs): + super().__init__() + from transformers import AutoModelForCausalLM, AutoTokenizer + from transformers.generation import GenerationConfig + + model_or_path = kwargs.get("model_path", "QwenAudio") + model = AutoModelForCausalLM.from_pretrained( + model_or_path, device_map="cpu", trust_remote_code=True + ) + tokenizer = AutoTokenizer.from_pretrained(model_or_path, trust_remote_code=True) + + self.model = model + self.tokenizer = tokenizer + + def forward( + self, + ): + pass + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + meta_data = {} + # meta_data["batch_data_time"] = -1 + prompt = kwargs.get( + "prompt", "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>" + ) + query = f"{prompt}" + audio_info = self.tokenizer.process_audio(query) + inputs = self.tokenizer(query, return_tensors="pt", audio_info=audio_info) + inputs = inputs.to(self.model.device) + pred = self.model.generate(**inputs, audio_info=audio_info) + response = self.tokenizer.decode( + pred.cpu()[0], skip_special_tokens=False, audio_info=audio_info + ) + + results = [] + result_i = {"key": key[0], "text": response} + + results.append(result_i) + + return results, meta_data + + +@tables.register("model_classes", "Qwen/Qwen-Audio-Chat") +@tables.register("model_classes", "Qwen/QwenAudioChat") +@tables.register("model_classes", "Qwen-Audio-Chat") +@tables.register("model_classes", "QwenAudioChat") +@tables.register("model_classes", "QwenAudioChatWarp") +class QwenAudioChatWarp(nn.Module): + def __init__(self, *args, **kwargs): + """ + Qwen-Audio: Advancing Universal Audio Understanding via Unified Large-Scale Audio-Language Models + https://arxiv.org/abs/2311.07919 + Modified from https://github.com/QwenLM/Qwen-Audio + """ + super().__init__() + from transformers import AutoModelForCausalLM, AutoTokenizer + from transformers.generation import GenerationConfig + + model_or_path = kwargs.get("model_path", "QwenAudio") + bf16 = kwargs.get("bf16", False) + fp16 = kwargs.get("fp16", False) + model = AutoModelForCausalLM.from_pretrained( + model_or_path, device_map="cpu", bf16=bf16, fp16=fp16, trust_remote_code=True + ) + tokenizer = AutoTokenizer.from_pretrained(model_or_path, trust_remote_code=True) + + self.model = model + self.tokenizer = tokenizer + + def forward( + self, + ): + pass + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + meta_data = {} + + prompt = kwargs.get("prompt", "what does the person say?") + cache = kwargs.get("cache", {}) + history = cache.get("history", None) + if data_in[0] is not None: + # 1st dialogue turn + query = self.tokenizer.from_list_format( + [ + {"audio": data_in[0]}, # Either a local path or an url + {"text": prompt}, + ] + ) + else: + query = prompt + response, history = self.model.chat(self.tokenizer, query=query, history=history) + cache["history"] = history + # print(response) + # The person says: "mister quilter is the apostle of the middle classes and we are glad to welcome his gospel". + + results = [] + result_i = {"key": key[0], "text": response} + + results.append(result_i) + + return results, meta_data diff --git a/funasr/models/qwen_audio/template.yaml b/funasr/models/qwen_audio/template.yaml new file mode 100644 index 0000000..40b902c --- /dev/null +++ b/funasr/models/qwen_audio/template.yaml @@ -0,0 +1,46 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: WhisperWarp +model_conf: + lsm_weight: 0.1 + length_normalized_loss: true + hub: funasr # openai + init_param_path: null # large-v2 or large-v3 if hub == "openai" + + + +# only use for hub == funasr, +# if hub == openai, whisper_dims is automaticall download +whisper_dims: + 'n_mels': 80 + 'n_vocab': 51865 + 'n_audio_ctx': 1500 + 'n_audio_state': 1280 + 'n_audio_head': 20 + 'n_audio_layer': 32 + 'n_text_ctx': 448 + 'n_text_state': 1280 + 'n_text_head': 20 + 'n_text_layer': 32 + +# frontend related +frontend: WhisperFrontend +frontend_conf: + fs: 16000 + n_mels: 80 + do_pad_trim: true + +tokenizer: WhisperTokenizer +tokenizer_conf: + language: null + task: transcribe + is_multilingual: true + num_languages: 99 + +scope_map: ['none', "model."] diff --git a/funasr/models/rwkv_bat/__init__.py b/funasr/models/rwkv_bat/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/rwkv_bat/cuda_decoder/wkv_cuda.cu b/funasr/models/rwkv_bat/cuda_decoder/wkv_cuda.cu new file mode 100644 index 0000000..1dcbc71 --- /dev/null +++ b/funasr/models/rwkv_bat/cuda_decoder/wkv_cuda.cu @@ -0,0 +1,135 @@ +// Copied from https://github.com/BlinkDL/RWKV-LM/blob/main/RWKV-v4/cuda/wkv_cuda.cu + +#include +#include + +#define MIN_VALUE (-1e38) + +template +__global__ void kernel_forward(const int B, const int T, const int C, + const F *__restrict__ const _w, const F *__restrict__ const _u, const F *__restrict__ const _k, const F *__restrict__ const _v, + F *__restrict__ const _y) { + const int idx = blockIdx.x * blockDim.x + threadIdx.x; + const int _b = idx / C; + const int _c = idx % C; + const int _offset = _b * T * C + _c; + + F u = _u[_c]; + F w = _w[_c]; + const F *__restrict__ const k = _k + _offset; + const F *__restrict__ const v = _v + _offset; + F *__restrict__ const y = _y + _offset; + + // aa and bb are running sums divided by exp(pp) (to avoid overflow) + F aa = 0, bb = 0, pp = MIN_VALUE; + for (int i = 0; i < T; i++) { + const int ii = i * C; + const F kk = k[ii]; + const F vv = v[ii]; + + F ww = u + kk; + F p = max(pp, ww); + F e1 = exp(pp - p); + F e2 = exp(ww - p); + y[ii] = (e1 * aa + e2 * vv) / (e1 * bb + e2); + + ww = w + pp; + p = max(ww, kk); + e1 = exp(ww - p); + e2 = exp(kk - p); + aa = e1 * aa + e2 * vv; + bb = e1 * bb + e2; + pp = p; + } +} + +template +__global__ void kernel_backward(const int B, const int T, const int C, + const F *__restrict__ const _w, const F *__restrict__ const _u, const F *__restrict__ const _k, const F *__restrict__ const _v, + const F *__restrict__ const _y, const F *__restrict__ const _gy, + F *__restrict__ const _gw, F *__restrict__ const _gu, F *__restrict__ const _gk, F *__restrict__ const _gv) { + const int idx = blockIdx.x * blockDim.x + threadIdx.x; + const int _b = idx / C; + const int _c = idx % C; + const int _offset = _b * T * C + _c; + + F u = _u[_c]; + F w = _w[_c]; + const F *__restrict__ const k = _k + _offset; + const F *__restrict__ const v = _v + _offset; + const F *__restrict__ const y = _y + _offset; + const F *__restrict__ const gy = _gy + _offset; + F *__restrict__ const gk = _gk + _offset; + F *__restrict__ const gv = _gv + _offset; + + F q[Tmax], r[Tmax]; + + F gw = 0, gu = 0, aa = 0, bb = 0, ga = 0, gb = 0, pp = MIN_VALUE; + for (int i = 0; i < T; i++) { + const int ii = i * C; + const F kk = k[ii]; + const F vv = v[ii]; + const F yy = y[ii]; + + F ww = u + kk; + F p = max(pp, ww); + F e1 = exp(pp - p); + F e2 = exp(ww - p); + const F qq = gy[ii] / (e1 * bb + e2); + gw += (ga - gb * yy) * e1 * qq; + gu += (vv - yy) * e2 * qq; + q[i] = qq; + r[i] = ww - p; + + ww = w + pp; + p = max(ww, kk); + e1 = exp(ww - p); + e2 = exp(kk - p); + ga = e1 * (aa + ga); + gb = e1 * (bb + gb); + aa = e1 * aa + e2 * vv; + bb = e1 * bb + e2; + pp = p; + } + const int _offsetBC = _b * C + _c; + _gw[_offsetBC] = gw * _w[_c]; // multiply by w because of w -> -exp(w) in python forward() + _gu[_offsetBC] = gu; + + aa = 0, bb = 0, pp = MIN_VALUE; + for (int i = T - 1; i >= 0; i--) { + const int ii = i * C; + const F kk = k[ii]; + const F vv = v[ii]; + const F yy = y[ii]; + const F qq = q[i]; + const F rr = r[i]; + + F e1 = qq * exp(rr); + F e2 = exp(kk + pp); + gk[ii] = e1 * (vv - yy) + e2 * (aa * vv + bb); + gv[ii] = e1 + e2 * aa; + + const F ww = w + pp; + const F www = rr - u - kk; + const F p = max(ww, www); + e1 = exp(ww - p); + e2 = qq * exp(www - p); + aa = e1 * aa + e2; + bb = e1 * bb - e2 * yy; + pp = p; + } +} + +void cuda_forward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y) { + dim3 threadsPerBlock( min(C, 32) ); // requires --maxrregcount 60 for optimal performance + assert(B * C % threadsPerBlock.x == 0); + dim3 numBlocks(B * C / threadsPerBlock.x); + kernel_forward<<>>(B, T, C, w, u, k, v, y); +} + +void cuda_backward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y, float *gy, float *gw, float *gu, float *gk, float *gv) { + dim3 threadsPerBlock( min(C, 32) ); // requires --maxrregcount 60 for optimal performance + assert(B * C % threadsPerBlock.x == 0); + dim3 numBlocks(B * C / threadsPerBlock.x); + kernel_backward<<>>(B, T, C, w, u, k, v, y, gy, gw, gu, gk, gv); +} diff --git a/funasr/models/rwkv_bat/cuda_decoder/wkv_op.cpp b/funasr/models/rwkv_bat/cuda_decoder/wkv_op.cpp new file mode 100644 index 0000000..1024219 --- /dev/null +++ b/funasr/models/rwkv_bat/cuda_decoder/wkv_op.cpp @@ -0,0 +1,37 @@ +/* + * Bsed on https://github.com/BlinkDL/RWKV-LM/blob/main/RWKV-v4/cuda/wkv_op.cpp + Function signatures were modified based on https://github.com/huggingface/transformers/blob/main/src/transformers/kernels/rwkv/wkv_op.cpp + + */ + +#include + +void cuda_forward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y); + +void cuda_backward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y, float *gy, float *gw, float *gu, float *gk, float *gv); + +void forward(torch::Tensor &w, torch::Tensor &u, torch::Tensor &k, torch::Tensor &v, torch::Tensor &y) { + const int B = k.size(0); + const int T = k.size(1); + const int C = k.size(2); + + cuda_forward(B, T, C, w.data_ptr(), u.data_ptr(), k.data_ptr(), v.data_ptr(), y.data_ptr()); +} + +void backward(torch::Tensor &w, torch::Tensor &u, torch::Tensor &k, torch::Tensor &v, torch::Tensor &y, torch::Tensor &gy, torch::Tensor &gw, torch::Tensor &gu, torch::Tensor &gk, torch::Tensor &gv) { + const int B = k.size(0); + const int T = k.size(1); + const int C = k.size(2); + + cuda_backward(B, T, C, w.data_ptr(), u.data_ptr(), k.data_ptr(), v.data_ptr(), y.data_ptr(), gy.data_ptr(), gw.data_ptr(), gu.data_ptr(), gk.data_ptr(), gv.data_ptr()); +} + +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.def("forward", &forward, "wkv forward"); + m.def("backward", &backward, "wkv backward"); +} + +TORCH_LIBRARY(wkv_decoder, m) { + m.def("forward", forward); + m.def("backward", backward); +} diff --git a/funasr/models/rwkv_bat/cuda_encoder/wkv_cuda.cu b/funasr/models/rwkv_bat/cuda_encoder/wkv_cuda.cu new file mode 100644 index 0000000..1dcbc71 --- /dev/null +++ b/funasr/models/rwkv_bat/cuda_encoder/wkv_cuda.cu @@ -0,0 +1,135 @@ +// Copied from https://github.com/BlinkDL/RWKV-LM/blob/main/RWKV-v4/cuda/wkv_cuda.cu + +#include +#include + +#define MIN_VALUE (-1e38) + +template +__global__ void kernel_forward(const int B, const int T, const int C, + const F *__restrict__ const _w, const F *__restrict__ const _u, const F *__restrict__ const _k, const F *__restrict__ const _v, + F *__restrict__ const _y) { + const int idx = blockIdx.x * blockDim.x + threadIdx.x; + const int _b = idx / C; + const int _c = idx % C; + const int _offset = _b * T * C + _c; + + F u = _u[_c]; + F w = _w[_c]; + const F *__restrict__ const k = _k + _offset; + const F *__restrict__ const v = _v + _offset; + F *__restrict__ const y = _y + _offset; + + // aa and bb are running sums divided by exp(pp) (to avoid overflow) + F aa = 0, bb = 0, pp = MIN_VALUE; + for (int i = 0; i < T; i++) { + const int ii = i * C; + const F kk = k[ii]; + const F vv = v[ii]; + + F ww = u + kk; + F p = max(pp, ww); + F e1 = exp(pp - p); + F e2 = exp(ww - p); + y[ii] = (e1 * aa + e2 * vv) / (e1 * bb + e2); + + ww = w + pp; + p = max(ww, kk); + e1 = exp(ww - p); + e2 = exp(kk - p); + aa = e1 * aa + e2 * vv; + bb = e1 * bb + e2; + pp = p; + } +} + +template +__global__ void kernel_backward(const int B, const int T, const int C, + const F *__restrict__ const _w, const F *__restrict__ const _u, const F *__restrict__ const _k, const F *__restrict__ const _v, + const F *__restrict__ const _y, const F *__restrict__ const _gy, + F *__restrict__ const _gw, F *__restrict__ const _gu, F *__restrict__ const _gk, F *__restrict__ const _gv) { + const int idx = blockIdx.x * blockDim.x + threadIdx.x; + const int _b = idx / C; + const int _c = idx % C; + const int _offset = _b * T * C + _c; + + F u = _u[_c]; + F w = _w[_c]; + const F *__restrict__ const k = _k + _offset; + const F *__restrict__ const v = _v + _offset; + const F *__restrict__ const y = _y + _offset; + const F *__restrict__ const gy = _gy + _offset; + F *__restrict__ const gk = _gk + _offset; + F *__restrict__ const gv = _gv + _offset; + + F q[Tmax], r[Tmax]; + + F gw = 0, gu = 0, aa = 0, bb = 0, ga = 0, gb = 0, pp = MIN_VALUE; + for (int i = 0; i < T; i++) { + const int ii = i * C; + const F kk = k[ii]; + const F vv = v[ii]; + const F yy = y[ii]; + + F ww = u + kk; + F p = max(pp, ww); + F e1 = exp(pp - p); + F e2 = exp(ww - p); + const F qq = gy[ii] / (e1 * bb + e2); + gw += (ga - gb * yy) * e1 * qq; + gu += (vv - yy) * e2 * qq; + q[i] = qq; + r[i] = ww - p; + + ww = w + pp; + p = max(ww, kk); + e1 = exp(ww - p); + e2 = exp(kk - p); + ga = e1 * (aa + ga); + gb = e1 * (bb + gb); + aa = e1 * aa + e2 * vv; + bb = e1 * bb + e2; + pp = p; + } + const int _offsetBC = _b * C + _c; + _gw[_offsetBC] = gw * _w[_c]; // multiply by w because of w -> -exp(w) in python forward() + _gu[_offsetBC] = gu; + + aa = 0, bb = 0, pp = MIN_VALUE; + for (int i = T - 1; i >= 0; i--) { + const int ii = i * C; + const F kk = k[ii]; + const F vv = v[ii]; + const F yy = y[ii]; + const F qq = q[i]; + const F rr = r[i]; + + F e1 = qq * exp(rr); + F e2 = exp(kk + pp); + gk[ii] = e1 * (vv - yy) + e2 * (aa * vv + bb); + gv[ii] = e1 + e2 * aa; + + const F ww = w + pp; + const F www = rr - u - kk; + const F p = max(ww, www); + e1 = exp(ww - p); + e2 = qq * exp(www - p); + aa = e1 * aa + e2; + bb = e1 * bb - e2 * yy; + pp = p; + } +} + +void cuda_forward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y) { + dim3 threadsPerBlock( min(C, 32) ); // requires --maxrregcount 60 for optimal performance + assert(B * C % threadsPerBlock.x == 0); + dim3 numBlocks(B * C / threadsPerBlock.x); + kernel_forward<<>>(B, T, C, w, u, k, v, y); +} + +void cuda_backward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y, float *gy, float *gw, float *gu, float *gk, float *gv) { + dim3 threadsPerBlock( min(C, 32) ); // requires --maxrregcount 60 for optimal performance + assert(B * C % threadsPerBlock.x == 0); + dim3 numBlocks(B * C / threadsPerBlock.x); + kernel_backward<<>>(B, T, C, w, u, k, v, y, gy, gw, gu, gk, gv); +} diff --git a/funasr/models/rwkv_bat/cuda_encoder/wkv_op.cpp b/funasr/models/rwkv_bat/cuda_encoder/wkv_op.cpp new file mode 100644 index 0000000..16f3646 --- /dev/null +++ b/funasr/models/rwkv_bat/cuda_encoder/wkv_op.cpp @@ -0,0 +1,37 @@ +/* + * Bsed on https://github.com/BlinkDL/RWKV-LM/blob/main/RWKV-v4/cuda/wkv_op.cpp + Function signatures were modified based on https://github.com/huggingface/transformers/blob/main/src/transformers/kernels/rwkv/wkv_op.cpp + + */ + +#include + +void cuda_forward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y); + +void cuda_backward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y, float *gy, float *gw, float *gu, float *gk, float *gv); + +void forward(torch::Tensor &w, torch::Tensor &u, torch::Tensor &k, torch::Tensor &v, torch::Tensor &y) { + const int B = k.size(0); + const int T = k.size(1); + const int C = k.size(2); + + cuda_forward(B, T, C, w.data_ptr(), u.data_ptr(), k.data_ptr(), v.data_ptr(), y.data_ptr()); +} + +void backward(torch::Tensor &w, torch::Tensor &u, torch::Tensor &k, torch::Tensor &v, torch::Tensor &y, torch::Tensor &gy, torch::Tensor &gw, torch::Tensor &gu, torch::Tensor &gk, torch::Tensor &gv) { + const int B = k.size(0); + const int T = k.size(1); + const int C = k.size(2); + + cuda_backward(B, T, C, w.data_ptr(), u.data_ptr(), k.data_ptr(), v.data_ptr(), y.data_ptr(), gy.data_ptr(), gw.data_ptr(), gu.data_ptr(), gk.data_ptr(), gv.data_ptr()); +} + +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.def("forward", &forward, "wkv forward"); + m.def("backward", &backward, "wkv backward"); +} + +TORCH_LIBRARY(wkv_encoder, m) { + m.def("forward", forward); + m.def("backward", backward); +} diff --git a/funasr/models/rwkv_bat/rwkv.py b/funasr/models/rwkv_bat/rwkv.py new file mode 100644 index 0000000..c777cf2 --- /dev/null +++ b/funasr/models/rwkv_bat/rwkv.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +from typing import Dict, Optional, Tuple + +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.rwkv_bat.rwkv_feed_forward import FeedForward +from funasr.models.rwkv_bat.rwkv_attention import EncoderSelfAttention, DecoderSelfAttention + + +class RWKV(torch.nn.Module): + """RWKV module. + + Args: + size: Input/Output size. + linear_size: Feed-forward hidden size. + attention_size: SelfAttention hidden size. + context_size: Context size for WKV computation. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + normalization_class: Normalization layer class. + normalization_args: Normalization layer arguments. + att_dropout_rate: Dropout rate for the attention module. + ffn_dropout_rate: Dropout rate for the feed-forward module. + + """ + + def __init__( + self, + size: int, + linear_size: int, + attention_size: int, + context_size: int, + block_id: int, + num_blocks: int, + att_dropout_rate: float = 0.0, + ffn_dropout_rate: float = 0.0, + dropout_rate: float = 0.0, + ) -> None: + """Construct a RWKV object.""" + super().__init__() + + self.layer_norm_att = LayerNorm(size) + self.layer_norm_ffn = LayerNorm(size) + + self.att = EncoderSelfAttention( + size, attention_size, context_size, block_id, att_dropout_rate, num_blocks + ) + self.dropout_att = torch.nn.Dropout(p=dropout_rate) + + self.ffn = FeedForward(size, linear_size, block_id, ffn_dropout_rate, num_blocks) + self.dropout_ffn = torch.nn.Dropout(p=dropout_rate) + + def forward( + self, + x: torch.Tensor, + state: Optional[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """Compute receptance weighted key value. + + Args: + x: RWKV input sequences. (B, L, size) + state: Decoder hidden states. [5 x (B, D_att/size, N)] + + Returns: + x: RWKV output sequences. (B, L, size) + x: Decoder hidden states. [5 x (B, D_att/size, N)] + + """ + att, state = self.att(self.layer_norm_att(x), state=state) + x = x + self.dropout_att(att) + ffn, state = self.ffn(self.layer_norm_ffn(x), state=state) + x = x + self.dropout_ffn(ffn) + return x, state + + +class RWKVDecoderLayer(torch.nn.Module): + """RWKV module. + + Args: + size: Input/Output size. + linear_size: Feed-forward hidden size. + attention_size: SelfAttention hidden size. + context_size: Context size for WKV computation. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + normalization_class: Normalization layer class. + normalization_args: Normalization layer arguments. + att_dropout_rate: Dropout rate for the attention module. + ffn_dropout_rate: Dropout rate for the feed-forward module. + + """ + + def __init__( + self, + size: int, + linear_size: int, + attention_size: int, + context_size: int, + block_id: int, + num_blocks: int, + att_dropout_rate: float = 0.0, + ffn_dropout_rate: float = 0.0, + dropout_rate: float = 0.0, + ) -> None: + """Construct a RWKV object.""" + super().__init__() + + self.layer_norm_att = LayerNorm(size) + self.layer_norm_ffn = LayerNorm(size) + + self.att = DecoderSelfAttention( + size, attention_size, context_size, block_id, att_dropout_rate, num_blocks + ) + self.dropout_att = torch.nn.Dropout(p=dropout_rate) + + self.ffn = FeedForward(size, linear_size, block_id, ffn_dropout_rate, num_blocks) + self.dropout_ffn = torch.nn.Dropout(p=dropout_rate) + + def forward( + self, + x: torch.Tensor, + state: Optional[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """Compute receptance weighted key value. + + Args: + x: RWKV input sequences. (B, L, size) + state: Decoder hidden states. [5 x (B, D_att/size, N)] + + Returns: + x: RWKV output sequences. (B, L, size) + x: Decoder hidden states. [5 x (B, D_att/size, N)] + + """ + att, state = self.att(self.layer_norm_att(x), state=state) + x = x + self.dropout_att(att) + + ffn, state = self.ffn(self.layer_norm_ffn(x), state=state) + x = x + self.dropout_ffn(ffn) + + return x, state diff --git a/funasr/models/rwkv_bat/rwkv_attention.py b/funasr/models/rwkv_bat/rwkv_attention.py new file mode 100644 index 0000000..59bf0ff --- /dev/null +++ b/funasr/models/rwkv_bat/rwkv_attention.py @@ -0,0 +1,608 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import math +import torch +from pathlib import Path +from importlib.util import find_spec +from typing import List, Optional, Tuple, Union + + +wkv_kernel_encoder = None +wkv_kernel_decoder = None + + +class WKVLinearAttentionEncoder(torch.autograd.Function): + """WKVLinearAttention function definition.""" + + @staticmethod + def forward( + ctx, + time_decay: torch.Tensor, + time_first: torch.Tensor, + key: torch.Tensor, + value: torch.tensor, + ) -> torch.Tensor: + """WKVLinearAttention function forward pass. + + Args: + time_decay: Channel-wise time decay vector. (D_att) + time_first: Channel-wise time first vector. (D_att) + key: Key tensor. (B, U, D_att) + value: Value tensor. (B, U, D_att) + + Returns: + out: Weighted Key-Value tensor. (B, U, D_att) + + """ + batch, length, dim = key.size() + + assert length <= wkv_kernel_encoder.context_size, ( + f"Cannot process key of length {length} while context_size " + f"is ({wkv_kernel_encoder.context_size}). Limit should be increased." + ) + + assert batch * dim % min(dim, 32) == 0, ( + f"batch size ({batch}) by dimension ({dim}) should be a multiple of " f"{min(dim, 32)}" + ) + + ctx.input_dtype = key.dtype + + time_decay = -torch.exp(time_decay.float().contiguous()) + time_first = time_first.float().contiguous() + + key = key.float().contiguous() + value = value.float().contiguous() + + out = torch.empty_like(key, memory_format=torch.contiguous_format) + + wkv_kernel_encoder.forward(time_decay, time_first, key, value, out) + ctx.save_for_backward(time_decay, time_first, key, value, out) + + return out + + @staticmethod + def backward( + ctx, grad_output: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]: + """WKVLinearAttention function backward pass. + + Args: + grad_output: Output gradient. (B, U, D_att) + + Returns: + grad_time_decay: Gradient for channel-wise time decay vector. (D_att) + grad_time_first: Gradient for channel-wise time first vector. (D_att) + grad_key: Gradient for key tensor. (B, U, D_att) + grad_value: Gradient for value tensor. (B, U, D_att) + + """ + time_decay, time_first, key, value, output = ctx.saved_tensors + grad_dtype = ctx.input_dtype + + batch, _, dim = key.size() + + grad_time_decay = torch.empty( + (batch, dim), + memory_format=torch.contiguous_format, + dtype=time_decay.dtype, + device=time_decay.device, + ) + + grad_time_first = torch.empty( + (batch, dim), + memory_format=torch.contiguous_format, + dtype=time_decay.dtype, + device=time_decay.device, + ) + + grad_key = torch.empty_like(key, memory_format=torch.contiguous_format) + grad_value = torch.empty_like(value, memory_format=torch.contiguous_format) + + wkv_kernel_encoder.backward( + time_decay, + time_first, + key, + value, + output, + grad_output.contiguous(), + grad_time_decay, + grad_time_first, + grad_key, + grad_value, + ) + + grad_time_decay = torch.sum(grad_time_decay, dim=0) + grad_time_first = torch.sum(grad_time_first, dim=0) + + return ( + grad_time_decay, + grad_time_first, + grad_key, + grad_value, + ) + + +class WKVLinearAttentionDecoder(torch.autograd.Function): + """WKVLinearAttention function definition.""" + + @staticmethod + def forward( + ctx, + time_decay: torch.Tensor, + time_first: torch.Tensor, + key: torch.Tensor, + value: torch.tensor, + ) -> torch.Tensor: + """WKVLinearAttention function forward pass. + + Args: + time_decay: Channel-wise time decay vector. (D_att) + time_first: Channel-wise time first vector. (D_att) + key: Key tensor. (B, U, D_att) + value: Value tensor. (B, U, D_att) + + Returns: + out: Weighted Key-Value tensor. (B, U, D_att) + + """ + batch, length, dim = key.size() + + assert length <= wkv_kernel_decoder.context_size, ( + f"Cannot process key of length {length} while context_size " + f"is ({wkv_kernel.context_size}). Limit should be increased." + ) + + assert batch * dim % min(dim, 32) == 0, ( + f"batch size ({batch}) by dimension ({dim}) should be a multiple of " f"{min(dim, 32)}" + ) + + ctx.input_dtype = key.dtype + + time_decay = -torch.exp(time_decay.float().contiguous()) + time_first = time_first.float().contiguous() + + key = key.float().contiguous() + value = value.float().contiguous() + + out = torch.empty_like(key, memory_format=torch.contiguous_format) + + wkv_kernel_decoder.forward(time_decay, time_first, key, value, out) + ctx.save_for_backward(time_decay, time_first, key, value, out) + + return out + + @staticmethod + def backward( + ctx, grad_output: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]: + """WKVLinearAttention function backward pass. + + Args: + grad_output: Output gradient. (B, U, D_att) + + Returns: + grad_time_decay: Gradient for channel-wise time decay vector. (D_att) + grad_time_first: Gradient for channel-wise time first vector. (D_att) + grad_key: Gradient for key tensor. (B, U, D_att) + grad_value: Gradient for value tensor. (B, U, D_att) + + """ + time_decay, time_first, key, value, output = ctx.saved_tensors + grad_dtype = ctx.input_dtype + + batch, _, dim = key.size() + + grad_time_decay = torch.empty( + (batch, dim), + memory_format=torch.contiguous_format, + dtype=time_decay.dtype, + device=time_decay.device, + ) + + grad_time_first = torch.empty( + (batch, dim), + memory_format=torch.contiguous_format, + dtype=time_decay.dtype, + device=time_decay.device, + ) + + grad_key = torch.empty_like(key, memory_format=torch.contiguous_format) + grad_value = torch.empty_like(value, memory_format=torch.contiguous_format) + + wkv_kernel_decoder.backward( + time_decay, + time_first, + key, + value, + output, + grad_output.contiguous(), + grad_time_decay, + grad_time_first, + grad_key, + grad_value, + ) + + grad_time_decay = torch.sum(grad_time_decay, dim=0) + grad_time_first = torch.sum(grad_time_first, dim=0) + + return ( + grad_time_decay, + grad_time_first, + grad_key, + grad_value, + ) + + +def load_encoder_wkv_kernel(context_size: int) -> None: + """Load WKV CUDA kernel. + + Args: + context_size: Context size. + + """ + from torch.utils.cpp_extension import load + + global wkv_kernel_encoder + + if wkv_kernel_encoder is not None and wkv_kernel_encoder.context_size == context_size: + return + + if find_spec("ninja") is None: + raise ImportError( + "Ninja package was not found. WKV kernel module can't be loaded " + "for training. Please, 'pip install ninja' in your environment." + ) + + if not torch.cuda.is_available(): + raise ImportError( + "CUDA is currently a requirement for WKV kernel loading. " + "Please set your devices properly and launch again." + ) + + kernel_folder = Path(__file__).resolve().parent / "cuda_encoder" + kernel_files = [kernel_folder / f for f in ["wkv_op.cpp", "wkv_cuda.cu"]] + + kernel_cflags = [ + "-res-usage", + "--maxrregcount 60", + "--use_fast_math", + "-O3", + "-Xptxas -O3", + f"-DTmax={context_size}", + ] + wkv_kernel_encoder = load( + name=f"encoder_wkv_{context_size}", + sources=kernel_files, + verbose=True, + extra_cuda_cflags=kernel_cflags, + ) + wkv_kernel_encoder.context_size = context_size + + +def load_decoder_wkv_kernel(context_size: int) -> None: + """Load WKV CUDA kernel. + + Args: + context_size: Context size. + + """ + from torch.utils.cpp_extension import load + + global wkv_kernel_decoder + + if wkv_kernel_decoder is not None and wkv_kernel_decoder.context_size == context_size: + return + + if find_spec("ninja") is None: + raise ImportError( + "Ninja package was not found. WKV kernel module can't be loaded " + "for training. Please, 'pip install ninja' in your environment." + ) + + if not torch.cuda.is_available(): + raise ImportError( + "CUDA is currently a requirement for WKV kernel loading. " + "Please set your devices properly and launch again." + ) + + kernel_folder = Path(__file__).resolve().parent / "cuda_decoder" + kernel_files = [kernel_folder / f for f in ["wkv_op.cpp", "wkv_cuda.cu"]] + + kernel_cflags = [ + "-res-usage", + "--maxrregcount 60", + "--use_fast_math", + "-O3", + "-Xptxas -O3", + f"-DTmax={context_size}", + ] + wkv_kernel_decoder = load( + name=f"decoder_wkv_{context_size}", + sources=kernel_files, + verbose=True, + extra_cuda_cflags=kernel_cflags, + ) + wkv_kernel_decoder.context_size = context_size + + +class SelfAttention(torch.nn.Module): + """SelfAttention module definition. + + Args: + size: Input/Output size. + attention_size: Attention hidden size. + context_size: Context size for WKV kernel. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + + """ + + def __init__( + self, + size: int, + attention_size: int, + block_id: int, + dropout_rate: float, + num_blocks: int, + ) -> None: + """Construct a SelfAttention object.""" + super().__init__() + self.time_shift = torch.nn.ZeroPad2d((0, 0, 1, -1)) + + self.time_decay = torch.nn.Parameter(torch.empty(attention_size)) + self.time_first = torch.nn.Parameter(torch.empty(attention_size)) + + self.time_mix_key = torch.nn.Parameter(torch.empty(1, 1, size)) + self.time_mix_value = torch.nn.Parameter(torch.empty(1, 1, size)) + self.time_mix_receptance = torch.nn.Parameter(torch.empty(1, 1, size)) + + self.proj_key = torch.nn.Linear(size, attention_size, bias=True) + self.proj_value = torch.nn.Linear(size, attention_size, bias=True) + self.proj_receptance = torch.nn.Linear(size, attention_size, bias=True) + + self.proj_output = torch.nn.Linear(attention_size, size, bias=True) + + self.block_id = block_id + + self.reset_parameters(size, attention_size, block_id, num_blocks) + self.dropout = torch.nn.Dropout(p=dropout_rate) + + def reset_parameters( + self, size: int, attention_size: int, block_id: int, num_blocks: int + ) -> None: + """Reset module parameters. + + Args: + size: Block size. + attention_size: Attention hidden size. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + + """ + ratio_0_to_1 = block_id / (num_blocks - 1) + ratio_1_to_almost0 = 1.0 - (block_id / num_blocks) + + time_weight = torch.ones(1, 1, size) + + for i in range(size): + time_weight[0, 0, i] = i / size + + decay_speed = [ + -5 + 8 * (h / (attention_size - 1)) ** (0.7 + 1.3 * ratio_0_to_1) + for h in range(attention_size) + ] + decay_speed = torch.tensor( + decay_speed, dtype=self.time_decay.dtype, device=self.time_decay.device + ) + + zigzag = ( + torch.tensor( + [(i + 1) % 3 - 1 for i in range(attention_size)], + dtype=self.time_first.dtype, + device=self.time_first.device, + ) + * 0.5 + ) + + with torch.no_grad(): + self.time_decay.data = decay_speed + self.time_first.data = torch.ones_like(self.time_first * math.log(0.3) + zigzag) + + self.time_mix_key.data = torch.pow(time_weight, ratio_1_to_almost0) + self.time_mix_value.data = ( + torch.pow(time_weight, ratio_1_to_almost0) + 0.3 * ratio_0_to_1 + ) + self.time_mix_receptance.data = torch.pow(time_weight, 0.5 * ratio_1_to_almost0) + + @torch.no_grad() + def wkv_linear_attention( + self, + time_decay: torch.Tensor, + time_first: torch.Tensor, + key: torch.Tensor, + value: torch.Tensor, + state: Tuple[torch.Tensor, torch.Tensor, torch.Tensor], + ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]: + """Compute WKV with state (i.e.: for inference). + + Args: + time_decay: Channel-wise time decay vector. (D_att) + time_first: Channel-wise time first vector. (D_att) + key: Key tensor. (B, 1, D_att) + value: Value tensor. (B, 1, D_att) + state: Decoder hidden states. [3 x (B, D_att)] + + Returns: + output: Weighted Key-Value. (B, 1, D_att) + state: Decoder hidden states. [3 x (B, 1, D_att)] + + """ + num_state, den_state, max_state = state + time_decay = -torch.exp(time_decay) + max_for_output = torch.maximum(max_state, (time_first + key)) + + e1 = torch.exp(max_state - max_for_output) + e2 = torch.exp((time_first + key) - max_for_output) + + numerator = e1 * num_state + e2 * value + denominator = e1 * den_state + e2 + + max_for_state = torch.maximum(key, (max_state + time_decay)) + + e1 = torch.exp((max_state + time_decay) - max_for_state) + e2 = torch.exp(key - max_for_state) + + wkv = numerator / denominator + + state = [e1 * num_state + e2 * value, e1 * den_state + e2, max_for_state] + + return wkv, state + + +class DecoderSelfAttention(SelfAttention): + """SelfAttention module definition. + + Args: + size: Input/Output size. + attention_size: Attention hidden size. + context_size: Context size for WKV kernel. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + + """ + + def __init__( + self, + size: int, + attention_size: int, + context_size: int, + block_id: int, + dropout_rate: float, + num_blocks: int, + ) -> None: + """Construct a SelfAttention object.""" + super().__init__(size, attention_size, block_id, dropout_rate, num_blocks) + # load_decoder_wkv_kernel(context_size) + + def forward( + self, + x: torch.Tensor, + state: Optional[List[torch.Tensor]] = None, + ) -> Tuple[torch.Tensor, Optional[List[torch.Tensor]]]: + """Compute time mixing. + + Args: + x: SelfAttention input sequences. (B, U, size) + state: Decoder hidden states. [5 x (B, 1, D_att, N)] + + Returns: + x: SelfAttention output sequences. (B, U, size) + + """ + shifted_x = self.time_shift(x) if state is None else state[1][..., self.block_id] + + key = x * self.time_mix_key + shifted_x * (1 - self.time_mix_key) + value = x * self.time_mix_value + shifted_x * (1 - self.time_mix_value) + receptance = x * self.time_mix_receptance + shifted_x * (1 - self.time_mix_receptance) + + key = self.proj_key(key) + value = self.proj_value(value) + receptance = torch.sigmoid(self.proj_receptance(receptance)) + + if state is not None: + state[1][..., self.block_id] = x + + wkv, att_state = self.wkv_linear_attention( + self.time_decay, + self.time_first, + key, + value, + tuple(s[..., self.block_id] for s in state[2:]), + ) + + state[2][..., self.block_id] = att_state[0] + state[3][..., self.block_id] = att_state[1] + state[4][..., self.block_id] = att_state[2] + else: + wkv = WKVLinearAttentionDecoder.apply(self.time_decay, self.time_first, key, value) + + wkv = self.dropout(wkv) + x = self.proj_output(receptance * wkv) + + return x, state + + +class EncoderSelfAttention(SelfAttention): + """SelfAttention module definition. + + Args: + size: Input/Output size. + attention_size: Attention hidden size. + context_size: Context size for WKV kernel. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + + """ + + def __init__( + self, + size: int, + attention_size: int, + context_size: int, + block_id: int, + dropout_rate: float, + num_blocks: int, + ) -> None: + """Construct a SelfAttention object.""" + super().__init__(size, attention_size, block_id, dropout_rate, num_blocks) + # load_encoder_wkv_kernel(context_size) + + def forward( + self, + x: torch.Tensor, + state: Optional[List[torch.Tensor]] = None, + ) -> Tuple[torch.Tensor, Optional[List[torch.Tensor]]]: + """Compute time mixing. + + Args: + x: SelfAttention input sequences. (B, U, size) + state: Decoder hidden states. [5 x (B, 1, D_att, N)] + + Returns: + x: SelfAttention output sequences. (B, U, size) + + """ + shifted_x = self.time_shift(x) if state is None else state[1][..., self.block_id] + + key = x * self.time_mix_key + shifted_x * (1 - self.time_mix_key) + value = x * self.time_mix_value + shifted_x * (1 - self.time_mix_value) + receptance = x * self.time_mix_receptance + shifted_x * (1 - self.time_mix_receptance) + + key = self.proj_key(key) + value = self.proj_value(value) + receptance = torch.sigmoid(self.proj_receptance(receptance)) + + if state is not None: + state[1][..., self.block_id] = x + + wkv, att_state = self.wkv_linear_attention( + self.time_decay, + self.time_first, + key, + value, + tuple(s[..., self.block_id] for s in state[2:]), + ) + + state[2][..., self.block_id] = att_state[0] + state[3][..., self.block_id] = att_state[1] + state[4][..., self.block_id] = att_state[2] + else: + wkv = WKVLinearAttentionEncoder.apply(self.time_decay, self.time_first, key, value) + + wkv = self.dropout(wkv) + x = self.proj_output(receptance * wkv) + + return x, state diff --git a/funasr/models/rwkv_bat/rwkv_encoder.py b/funasr/models/rwkv_bat/rwkv_encoder.py new file mode 100644 index 0000000..a27088d --- /dev/null +++ b/funasr/models/rwkv_bat/rwkv_encoder.py @@ -0,0 +1,158 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +from typing import Dict, List, Optional, Tuple + +from funasr.register import tables +from funasr.models.rwkv_bat.rwkv import RWKV +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.nets_utils import make_source_mask +from funasr.models.rwkv_bat.rwkv_subsampling import RWKVConvInput + + +@tables.register("encoder_classes", "RWKVEncoder") +class RWKVEncoder(torch.nn.Module): + """RWKV encoder module. + + Based on https://arxiv.org/pdf/2305.13048.pdf. + + Args: + vocab_size: Vocabulary size. + output_size: Input/Output size. + context_size: Context size for WKV computation. + linear_size: FeedForward hidden size. + attention_size: SelfAttention hidden size. + normalization_type: Normalization layer type. + normalization_args: Normalization layer arguments. + num_blocks: Number of RWKV blocks. + embed_dropout_rate: Dropout rate for embedding layer. + att_dropout_rate: Dropout rate for the attention module. + ffn_dropout_rate: Dropout rate for the feed-forward module. + """ + + def __init__( + self, + input_size: int, + output_size: int = 512, + context_size: int = 1024, + linear_size: Optional[int] = None, + attention_size: Optional[int] = None, + num_blocks: int = 4, + att_dropout_rate: float = 0.0, + ffn_dropout_rate: float = 0.0, + dropout_rate: float = 0.0, + subsampling_factor: int = 4, + time_reduction_factor: int = 1, + kernel: int = 3, + **kwargs, + ) -> None: + """Construct a RWKVEncoder object.""" + super().__init__() + + self.embed = RWKVConvInput( + input_size, + [output_size // 4, output_size // 2, output_size], + subsampling_factor, + conv_kernel_size=kernel, + output_size=output_size, + ) + + self.subsampling_factor = subsampling_factor + + linear_size = output_size * 4 if linear_size is None else linear_size + attention_size = output_size if attention_size is None else attention_size + + self.rwkv_blocks = torch.nn.ModuleList( + [ + RWKV( + output_size, + linear_size, + attention_size, + context_size, + block_id, + num_blocks, + att_dropout_rate=att_dropout_rate, + ffn_dropout_rate=ffn_dropout_rate, + dropout_rate=dropout_rate, + ) + for block_id in range(num_blocks) + ] + ) + + self.embed_norm = LayerNorm(output_size) + self.final_norm = LayerNorm(output_size) + + self._output_size = output_size + self.context_size = context_size + + self.num_blocks = num_blocks + self.time_reduction_factor = time_reduction_factor + + def output_size(self) -> int: + return self._output_size + + def forward(self, x: torch.Tensor, x_len) -> torch.Tensor: + """Encode source label sequences. + + Args: + x: Encoder input sequences. (B, L) + + Returns: + out: Encoder output sequences. (B, U, D) + + """ + _, length, _ = x.size() + + assert ( + length <= self.context_size * self.subsampling_factor + ), "Context size is too short for current length: %d versus %d" % ( + length, + self.context_size * self.subsampling_factor, + ) + mask = make_source_mask(x_len).to(x.device) + x, mask = self.embed(x, mask, None) + x = self.embed_norm(x) + olens = mask.eq(0).sum(1) + + if self.training: + for block in self.rwkv_blocks: + x, _ = block(x) + else: + x = self.rwkv_infer(x) + + x = self.final_norm(x) + + if self.time_reduction_factor > 1: + x = x[:, :: self.time_reduction_factor, :] + olens = torch.floor_divide(olens - 1, self.time_reduction_factor) + 1 + + return x, olens, None + + def rwkv_infer(self, xs_pad): + + batch_size = xs_pad.shape[0] + + hidden_sizes = [self._output_size for i in range(5)] + + state = [ + torch.zeros( + (batch_size, 1, hidden_sizes[i], self.num_blocks), + dtype=torch.float32, + device=xs_pad.device, + ) + for i in range(5) + ] + + state[4] -= 1e-30 + + xs_out = [] + for t in range(xs_pad.shape[1]): + x_t = xs_pad[:, t, :] + for idx, block in enumerate(self.rwkv_blocks): + x_t, state = block(x_t, state=state) + xs_out.append(x_t) + xs_out = torch.cat(xs_out, dim=1) + return xs_out diff --git a/funasr/models/rwkv_bat/rwkv_feed_forward.py b/funasr/models/rwkv_bat/rwkv_feed_forward.py new file mode 100644 index 0000000..a8056bf --- /dev/null +++ b/funasr/models/rwkv_bat/rwkv_feed_forward.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +from typing import List, Optional, Tuple + + +class FeedForward(torch.nn.Module): + """FeedForward module definition. + + Args: + size: Input/Output size. + hidden_size: Hidden size. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + + """ + + def __init__( + self, size: int, hidden_size: int, block_id: int, dropout_rate: float, num_blocks: int + ) -> None: + """Construct a FeedForward object.""" + super().__init__() + + self.time_shift = torch.nn.ZeroPad2d((0, 0, 1, -1)) + + self.time_mix_key = torch.nn.Parameter(torch.empty(1, 1, size)) + self.time_mix_receptance = torch.nn.Parameter(torch.empty(1, 1, size)) + + self.proj_key = torch.nn.Linear(size, hidden_size, bias=True) + self.proj_value = torch.nn.Linear(hidden_size, size, bias=True) + self.proj_receptance = torch.nn.Linear(size, size, bias=True) + + self.block_id = block_id + + self.reset_parameters(size, block_id, num_blocks) + self.dropout = torch.nn.Dropout(p=dropout_rate) + + def reset_parameters(self, size: int, block_id: int, num_blocks: int) -> None: + """Reset module parameters. + + Args: + size: Block size. + block_id: Block index. + num_blocks: Number of blocks in the architecture. + + """ + ratio_1_to_almost0 = 1.0 - (block_id / num_blocks) + + time_weight = torch.ones(1, 1, size) + + for i in range(size): + time_weight[0, 0, i] = i / size + + with torch.no_grad(): + self.time_mix_key.data = torch.pow(time_weight, ratio_1_to_almost0) + self.time_mix_receptance.data = torch.pow(time_weight, ratio_1_to_almost0) + + def forward( + self, x: torch.Tensor, state: Optional[List[torch.Tensor]] = None + ) -> Tuple[torch.Tensor, Optional[List[torch.Tensor]]]: + """Compute channel mixing. + + Args: + x: FeedForward input sequences. (B, U, size) + state: Decoder hidden state. [5 x (B, 1, size, N)] + + Returns: + x: FeedForward output sequences. (B, U, size) + state: Decoder hidden state. [5 x (B, 1, size, N)] + + """ + shifted_x = self.time_shift(x) if state is None else state[0][..., self.block_id] + + key = x * self.time_mix_key + shifted_x * (1 - self.time_mix_key) + receptance = x * self.time_mix_receptance + shifted_x * (1 - self.time_mix_receptance) + + key = torch.square(torch.relu(self.proj_key(key))) + value = self.proj_value(self.dropout(key)) + receptance = torch.sigmoid(self.proj_receptance(receptance)) + + if state is not None: + state[0][..., self.block_id] = x + + x = receptance * value + + return x, state diff --git a/funasr/models/rwkv_bat/rwkv_subsampling.py b/funasr/models/rwkv_bat/rwkv_subsampling.py new file mode 100644 index 0000000..5108ae6 --- /dev/null +++ b/funasr/models/rwkv_bat/rwkv_subsampling.py @@ -0,0 +1,250 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import math +import torch +from typing import Optional, Tuple, Union +from funasr.models.transformer.utils.nets_utils import pad_to_len + + +class TooShortUttError(Exception): + """Raised when the utt is too short for subsampling. + + Args: + message (str): Message for error catch + actual_size (int): the short size that cannot pass the subsampling + limit (int): the limit size for subsampling + + """ + + def __init__(self, message, actual_size, limit): + """Construct a TooShortUttError for error handler.""" + super().__init__(message) + self.actual_size = actual_size + self.limit = limit + + +def check_short_utt(ins, size): + """Check if the utterance is too short for subsampling.""" + if isinstance(ins, Conv2dSubsampling2) and size < 3: + return True, 3 + if isinstance(ins, Conv2dSubsampling) and size < 7: + return True, 7 + if isinstance(ins, Conv2dSubsampling6) and size < 11: + return True, 11 + if isinstance(ins, Conv2dSubsampling8) and size < 15: + return True, 15 + return False, -1 + + +class RWKVConvInput(torch.nn.Module): + """Streaming ConvInput module definition. + Args: + input_size: Input size. + conv_size: Convolution size. + subsampling_factor: Subsampling factor. + output_size: Block output dimension. + """ + + def __init__( + self, + input_size: int, + conv_size: Union[int, Tuple], + subsampling_factor: int = 4, + conv_kernel_size: int = 3, + output_size: Optional[int] = None, + ) -> None: + """Construct a ConvInput object.""" + super().__init__() + if subsampling_factor == 1: + conv_size1, conv_size2, conv_size3 = conv_size + + self.conv = torch.nn.Sequential( + torch.nn.Conv2d( + 1, conv_size1, conv_kernel_size, stride=1, padding=(conv_kernel_size - 1) // 2 + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size1, + conv_size1, + conv_kernel_size, + stride=[1, 2], + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size1, + conv_size2, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size2, + conv_size2, + conv_kernel_size, + stride=[1, 2], + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size2, + conv_size3, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size3, + conv_size3, + conv_kernel_size, + stride=[1, 2], + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + ) + + output_proj = conv_size3 * ((input_size // 2) // 2) + + self.subsampling_factor = 1 + + self.stride_1 = 1 + + self.create_new_mask = self.create_new_vgg_mask + + else: + conv_size1, conv_size2, conv_size3 = conv_size + + kernel_1 = int(subsampling_factor / 2) + + self.conv = torch.nn.Sequential( + torch.nn.Conv2d( + 1, conv_size1, conv_kernel_size, stride=1, padding=(conv_kernel_size - 1) // 2 + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size1, + conv_size1, + conv_kernel_size, + stride=[kernel_1, 2], + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size1, + conv_size2, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size2, + conv_size2, + conv_kernel_size, + stride=[2, 2], + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size2, + conv_size3, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size3, + conv_size3, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + ) + + output_proj = conv_size3 * ((input_size // 2) // 2) + + self.subsampling_factor = subsampling_factor + + self.create_new_mask = self.create_new_vgg_mask + + self.stride_1 = kernel_1 + + self.min_frame_length = 7 + + if output_size is not None: + self.output = torch.nn.Linear(output_proj, output_size) + self.output_size = output_size + else: + self.output = None + self.output_size = output_proj + + def forward( + self, x: torch.Tensor, mask: Optional[torch.Tensor], chunk_size: Optional[torch.Tensor] + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encode input sequences. + Args: + x: ConvInput input sequences. (B, T, D_feats) + mask: Mask of input sequences. (B, 1, T) + Returns: + x: ConvInput output sequences. (B, sub(T), D_out) + mask: Mask of output sequences. (B, 1, sub(T)) + """ + if mask is not None: + mask = self.create_new_mask(mask) + olens = max(mask.eq(0).sum(1)) + + b, t, f = x.size() + x = x.unsqueeze(1) # (b. 1. t. f) + + if chunk_size is not None: + max_input_length = int( + chunk_size + * self.subsampling_factor + * (math.ceil(float(t) / (chunk_size * self.subsampling_factor))) + ) + x = map(lambda inputs: pad_to_len(inputs, max_input_length, 1), x) + x = list(x) + x = torch.stack(x, dim=0) + N_chunks = max_input_length // (chunk_size * self.subsampling_factor) + x = x.view(b * N_chunks, 1, chunk_size * self.subsampling_factor, f) + + x = self.conv(x) + + _, c, _, f = x.size() + if chunk_size is not None: + x = x.transpose(1, 2).contiguous().view(b, -1, c * f)[:, :olens, :] + else: + x = x.transpose(1, 2).contiguous().view(b, -1, c * f) + + if self.output is not None: + x = self.output(x) + + return x, mask[:, :olens][:, : x.size(1)] + + def create_new_vgg_mask(self, mask: torch.Tensor) -> torch.Tensor: + """Create a new mask for VGG output sequences. + Args: + mask: Mask of input sequences. (B, T) + Returns: + mask: Mask of output sequences. (B, sub(T)) + """ + if self.subsampling_factor > 1: + return mask[:, ::2][:, :: self.stride_1] + else: + return mask + + def get_size_before_subsampling(self, size: int) -> int: + """Return the original size before subsampling for a given size. + Args: + size: Number of frames after subsampling. + Returns: + : Number of frames before subsampling. + """ + return size * self.subsampling_factor diff --git a/funasr/models/rwkv_bat/template.yaml b/funasr/models/rwkv_bat/template.yaml new file mode 100644 index 0000000..dad84bf --- /dev/null +++ b/funasr/models/rwkv_bat/template.yaml @@ -0,0 +1,64 @@ +# network architecture +model: Transducer +model_conf: + auxiliary_ctc_weight: 0.0 + +# encoder +encoder: RWKVEncoder +encoder_conf: + kernel: 3 + subsampling_factor: 4 + output_size: 512 + num_blocks: 18 + time_reduction_factor: 2 + att_dropout_rate: 0.1 + ffn_dropout_rate: 0.1 + dropout_rate: 0.1 + +# decoder (prediction network) +decoder: rnnt_decoder +decoder_conf: + embed_size: 512 + hidden_size: 512 + embed_dropout_rate: 0.1 + dropout_rate: 0.1 + use_embed_mask: false + +# joint network +joint_network: joint_network +joint_network_conf: + joint_space_size: 512 + +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 1 + lfr_n: 1 + upsacle_samples: true + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + \ No newline at end of file diff --git a/funasr/models/sa_asr/__init__.py b/funasr/models/sa_asr/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/sa_asr/attention.py b/funasr/models/sa_asr/attention.py new file mode 100644 index 0000000..74e687a --- /dev/null +++ b/funasr/models/sa_asr/attention.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + + +"""Multi-Head Attention layer definition.""" + +import math + +import numpy +import torch +from torch import nn +from typing import Optional, Tuple + +import torch.nn.functional as F +from funasr.models.transformer.utils.nets_utils import make_pad_mask +import funasr.models.lora.layers as lora + + +class CosineDistanceAttention(nn.Module): + """Compute Cosine Distance between spk decoder output and speaker profile + Args: + profile_path: speaker profile file path (.npy file) + """ + + def __init__(self): + super().__init__() + self.softmax = nn.Softmax(dim=-1) + + def forward(self, spk_decoder_out, profile, profile_lens=None): + """ + Args: + spk_decoder_out(torch.Tensor):(B, L, D) + spk_profiles(torch.Tensor):(B, N, D) + """ + x = spk_decoder_out.unsqueeze(2) # (B, L, 1, D) + if profile_lens is not None: + + mask = (make_pad_mask(profile_lens)[:, None, :]).to(profile.device) + min_value = float(numpy.finfo(torch.tensor(0, dtype=x.dtype).numpy().dtype).min) + weights_not_softmax = F.cosine_similarity(x, profile.unsqueeze(1), dim=-1).masked_fill( + mask, min_value + ) + weights = self.softmax(weights_not_softmax).masked_fill(mask, 0.0) # (B, L, N) + else: + x = x[:, -1:, :, :] + weights_not_softmax = F.cosine_similarity(x, profile.unsqueeze(1).to(x.device), dim=-1) + weights = self.softmax(weights_not_softmax) # (B, 1, N) + spk_embedding = torch.matmul(weights, profile.to(weights.device)) # (B, L, D) + + return spk_embedding, weights diff --git a/funasr/models/sa_asr/beam_search_sa_asr.py b/funasr/models/sa_asr/beam_search_sa_asr.py new file mode 100644 index 0000000..d953b4c --- /dev/null +++ b/funasr/models/sa_asr/beam_search_sa_asr.py @@ -0,0 +1,540 @@ +"""Beam search module.""" + +from itertools import chain +import logging +from typing import Any +from typing import Dict +from typing import List +from typing import NamedTuple +from typing import Tuple +from typing import Union + +import torch + +from funasr.metrics import end_detect +from funasr.models.transformer.scorers.scorer_interface import PartialScorerInterface +from funasr.models.transformer.scorers.scorer_interface import ScorerInterface +from funasr.models.decoder.abs_decoder import AbsDecoder + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: torch.Tensor + spk_weigths: List + score: Union[float, torch.Tensor] = 0 + scores: Dict[str, Union[float, torch.Tensor]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +class BeamSearch(torch.nn.Module): + """Beam search implementation.""" + + def __init__( + self, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + beam_size: int, + vocab_size: int, + sos: int, + eos: int, + token_list: List[str] = None, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = None, + ): + """Initialize beam search. + + Args: + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + sos (int): Start of sequence id + eos (int): End of sequence id + token_list (list[str]): List of tokens for debug log + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + """ + super().__init__() + # set scorers + self.weights = weights + self.scorers = dict() + self.full_scorers = dict() + self.part_scorers = dict() + # this module dict is required for recursive cast + # `self.to(device, dtype)` in `recog.py` + self.nn_dict = torch.nn.ModuleDict() + for k, v in scorers.items(): + w = weights.get(k, 0) + if w == 0 or v is None: + continue + assert isinstance( + v, ScorerInterface + ), f"{k} ({type(v)}) does not implement ScorerInterface" + self.scorers[k] = v + if isinstance(v, PartialScorerInterface): + self.part_scorers[k] = v + else: + self.full_scorers[k] = v + if isinstance(v, torch.nn.Module): + self.nn_dict[k] = v + + # set configurations + self.sos = sos + self.eos = eos + self.token_list = token_list + self.pre_beam_size = int(pre_beam_ratio * beam_size) + self.beam_size = beam_size + self.n_vocab = vocab_size + if ( + pre_beam_score_key is not None + and pre_beam_score_key != "full" + and pre_beam_score_key not in self.full_scorers + ): + raise KeyError(f"{pre_beam_score_key} is not found in {self.full_scorers}") + self.pre_beam_score_key = pre_beam_score_key + self.do_pre_beam = ( + self.pre_beam_score_key is not None + and self.pre_beam_size < self.n_vocab + and len(self.part_scorers) > 0 + ) + + def init_hyp(self, x: torch.Tensor) -> List[Hypothesis]: + """Get an initial hypothesis data. + + Args: + x (torch.Tensor): The encoder output feature + + Returns: + Hypothesis: The initial hypothesis. + + """ + init_states = dict() + init_scores = dict() + for k, d in self.scorers.items(): + init_states[k] = d.init_state(x) + init_scores[k] = 0.0 + return [ + Hypothesis( + score=0.0, + scores=init_scores, + states=init_states, + yseq=torch.tensor([self.sos], device=x.device), + spk_weigths=[], + ) + ] + + @staticmethod + def append_token(xs: torch.Tensor, x: int) -> torch.Tensor: + """Append new token to prefix tokens. + + Args: + xs (torch.Tensor): The prefix token + x (int): The new token to append + + Returns: + torch.Tensor: New tensor contains: xs + [x] with xs.dtype and xs.device + + """ + x = torch.tensor([x], dtype=xs.dtype, device=xs.device) + return torch.cat((xs, x)) + + def score_full( + self, + hyp: Hypothesis, + asr_enc: torch.Tensor, + spk_enc: torch.Tensor, + profile: torch.Tensor, + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.full_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.full_scorers` + and tensor score values of shape: `(self.n_vocab,)`, + and state dict that has string keys + and state values of `self.full_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.full_scorers.items(): + if isinstance(d, AbsDecoder): + scores[k], spk_weigths, states[k] = d.score( + hyp.yseq, hyp.states[k], asr_enc, spk_enc, profile + ) + else: + scores[k], states[k] = d.score(hyp.yseq, hyp.states[k], asr_enc) + return scores, spk_weigths, states + + def score_partial( + self, + hyp: Hypothesis, + ids: torch.Tensor, + asr_enc: torch.Tensor, + spk_enc: torch.Tensor, + profile: torch.Tensor, + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.part_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + ids (torch.Tensor): 1D tensor of new partial tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.part_scorers` + and tensor score values of shape: `(len(ids),)`, + and state dict that has string keys + and state values of `self.part_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.part_scorers.items(): + if isinstance(d, AbsDecoder): + scores[k], states[k] = d.score_partial( + hyp.yseq, ids, hyp.states[k], asr_enc, spk_enc, profile + ) + else: + scores[k], states[k] = d.score_partial(hyp.yseq, ids, hyp.states[k], asr_enc) + return scores, states + + def beam( + self, weighted_scores: torch.Tensor, ids: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute topk full token ids and partial token ids. + + Args: + weighted_scores (torch.Tensor): The weighted sum scores for each tokens. + Its shape is `(self.n_vocab,)`. + ids (torch.Tensor): The partial token ids to compute topk + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + The topk full token ids and partial token ids. + Their shapes are `(self.beam_size,)` + + """ + # no pre beam performed + if weighted_scores.size(0) == ids.size(0): + top_ids = weighted_scores.topk(self.beam_size)[1] + return top_ids, top_ids + + # mask pruned in pre-beam not to select in topk + tmp = weighted_scores[ids] + weighted_scores[:] = -float("inf") + weighted_scores[ids] = tmp + top_ids = weighted_scores.topk(self.beam_size)[1] + local_ids = weighted_scores[ids].topk(self.beam_size)[1] + return top_ids, local_ids + + @staticmethod + def merge_scores( + prev_scores: Dict[str, float], + next_full_scores: Dict[str, torch.Tensor], + full_idx: int, + next_part_scores: Dict[str, torch.Tensor], + part_idx: int, + ) -> Dict[str, torch.Tensor]: + """Merge scores for new hypothesis. + + Args: + prev_scores (Dict[str, float]): + The previous hypothesis scores by `self.scorers` + next_full_scores (Dict[str, torch.Tensor]): scores by `self.full_scorers` + full_idx (int): The next token id for `next_full_scores` + next_part_scores (Dict[str, torch.Tensor]): + scores of partial tokens by `self.part_scorers` + part_idx (int): The new token id for `next_part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are scalar tensors by the scorers. + + """ + new_scores = dict() + for k, v in next_full_scores.items(): + new_scores[k] = prev_scores[k] + v[full_idx] + for k, v in next_part_scores.items(): + new_scores[k] = prev_scores[k] + v[part_idx] + return new_scores + + def merge_states(self, states: Any, part_states: Any, part_idx: int) -> Any: + """Merge states for new hypothesis. + + Args: + states: states of `self.full_scorers` + part_states: states of `self.part_scorers` + part_idx (int): The new token id for `part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are states of the scorers. + + """ + new_states = dict() + for k, v in states.items(): + new_states[k] = v + for k, d in self.part_scorers.items(): + new_states[k] = d.select_state(part_states[k], part_idx) + return new_states + + def search( + self, + running_hyps: List[Hypothesis], + asr_enc: torch.Tensor, + spk_enc: torch.Tensor, + profile: torch.Tensor, + ) -> List[Hypothesis]: + """Search new tokens for running hypotheses and encoded speech x. + + Args: + running_hyps (List[Hypothesis]): Running hypotheses on beam + x (torch.Tensor): Encoded speech feature (T, D) + + Returns: + List[Hypotheses]: Best sorted hypotheses + + """ + # import ipdb;ipdb.set_trace() + best_hyps = [] + part_ids = torch.arange(self.n_vocab, device=asr_enc.device) # no pre-beam + for hyp in running_hyps: + # scoring + weighted_scores = torch.zeros(self.n_vocab, dtype=asr_enc.dtype, device=asr_enc.device) + scores, spk_weigths, states = self.score_full(hyp, asr_enc, spk_enc, profile) + for k in self.full_scorers: + weighted_scores += self.weights[k] * scores[k] + # partial scoring + if self.do_pre_beam: + pre_beam_scores = ( + weighted_scores + if self.pre_beam_score_key == "full" + else scores[self.pre_beam_score_key] + ) + part_ids = torch.topk(pre_beam_scores, self.pre_beam_size)[1] + part_scores, part_states = self.score_partial(hyp, part_ids, asr_enc, spk_enc, profile) + for k in self.part_scorers: + weighted_scores[part_ids] += self.weights[k] * part_scores[k] + # add previous hyp score + weighted_scores += hyp.score + + # update hyps + for j, part_j in zip(*self.beam(weighted_scores, part_ids)): + # will be (2 x beam at most) + best_hyps.append( + Hypothesis( + score=weighted_scores[j], + yseq=self.append_token(hyp.yseq, j), + scores=self.merge_scores(hyp.scores, scores, j, part_scores, part_j), + states=self.merge_states(states, part_states, part_j), + spk_weigths=hyp.spk_weigths + [spk_weigths], + ) + ) + + # sort and prune 2 x beam -> beam + best_hyps = sorted(best_hyps, key=lambda x: x.score, reverse=True)[ + : min(len(best_hyps), self.beam_size) + ] + return best_hyps + + def forward( + self, + asr_enc: torch.Tensor, + spk_enc: torch.Tensor, + profile: torch.Tensor, + maxlenratio: float = 0.0, + minlenratio: float = 0.0, + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + minlenratio (float): Input length ratio to obtain min output length. + + Returns: + list[Hypothesis]: N-best decoding results + + """ + # import ipdb;ipdb.set_trace() + # set length bounds + if maxlenratio == 0: + maxlen = asr_enc.shape[0] + else: + maxlen = max(1, int(maxlenratio * asr_enc.size(0))) + minlen = int(minlenratio * asr_enc.size(0)) + logging.info("decoder input length: " + str(asr_enc.shape[0])) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # main loop of prefix search + running_hyps = self.init_hyp(asr_enc) + ended_hyps = [] + for i in range(maxlen): + logging.debug("position " + str(i)) + best = self.search(running_hyps, asr_enc, spk_enc, profile) + # import pdb;pdb.set_trace() + # post process of one iteration + running_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps) + # end detection + if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i): + logging.info(f"end detected at {i}") + break + if len(running_hyps) == 0: + logging.info("no hypothesis. Finish decoding.") + break + else: + logging.debug(f"remained hypotheses: {len(running_hyps)}") + + nbest_hyps = sorted(ended_hyps, key=lambda x: x.score, reverse=True) + # check the number of hypotheses reaching to eos + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, perform recognition " "again with smaller minlenratio." + ) + return ( + [] + if minlenratio < 0.1 + else self.forward( + asr_enc, spk_enc, profile, maxlenratio, max(0.0, minlenratio - 0.1) + ) + ) + + # report the best result + best = nbest_hyps[0] + for k, v in best.scores.items(): + logging.info(f"{v:6.2f} * {self.weights[k]:3} = {v * self.weights[k]:6.2f} for {k}") + logging.info(f"total log probability: {best.score:.2f}") + logging.info(f"normalized log probability: {best.score / len(best.yseq):.2f}") + logging.info(f"total number of ended hypotheses: {len(nbest_hyps)}") + if self.token_list is not None: + logging.info( + "best hypo: " + "".join([self.token_list[x] for x in best.yseq[1:-1]]) + "\n" + ) + return nbest_hyps + + def post_process( + self, + i: int, + maxlen: int, + maxlenratio: float, + running_hyps: List[Hypothesis], + ended_hyps: List[Hypothesis], + ) -> List[Hypothesis]: + """Perform post-processing of beam search iterations. + + Args: + i (int): The length of hypothesis tokens. + maxlen (int): The maximum length of tokens in beam search. + maxlenratio (int): The maximum length ratio in beam search. + running_hyps (List[Hypothesis]): The running hypotheses in beam search. + ended_hyps (List[Hypothesis]): The ended hypotheses in beam search. + + Returns: + List[Hypothesis]: The new running hypotheses. + + """ + logging.debug(f"the number of running hypotheses: {len(running_hyps)}") + if self.token_list is not None: + logging.debug( + "best hypo: " + "".join([self.token_list[x] for x in running_hyps[0].yseq[1:]]) + ) + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + running_hyps = [ + h._replace(yseq=self.append_token(h.yseq, self.eos)) for h in running_hyps + ] + + # add ended hypotheses to a final list, and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in running_hyps: + if hyp.yseq[-1] == self.eos: + # e.g., Word LM needs to add final score + for k, d in chain(self.full_scorers.items(), self.part_scorers.items()): + s = d.final_score(hyp.states[k]) + hyp.scores[k] += s + hyp = hyp._replace(score=hyp.score + self.weights[k] * s) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + return remained_hyps + + +def beam_search( + x: torch.Tensor, + sos: int, + eos: int, + beam_size: int, + vocab_size: int, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + token_list: List[str] = None, + maxlenratio: float = 0.0, + minlenratio: float = 0.0, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = "full", +) -> list: + """Perform beam search with scorers. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + sos (int): Start of sequence id + eos (int): End of sequence id + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + token_list (list[str]): List of tokens for debug log + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + minlenratio (float): Input length ratio to obtain min output length. + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + Returns: + list: N-best decoding results + + """ + ret = BeamSearch( + scorers, + weights, + beam_size=beam_size, + vocab_size=vocab_size, + pre_beam_ratio=pre_beam_ratio, + pre_beam_score_key=pre_beam_score_key, + sos=sos, + eos=eos, + token_list=token_list, + ).forward(x=x, maxlenratio=maxlenratio, minlenratio=minlenratio) + return [h.asdict() for h in ret] diff --git a/funasr/models/sa_asr/e2e_sa_asr.py b/funasr/models/sa_asr/e2e_sa_asr.py new file mode 100644 index 0000000..f4827b2 --- /dev/null +++ b/funasr/models/sa_asr/e2e_sa_asr.py @@ -0,0 +1,508 @@ +# Copyright ESPnet (https://github.com/espnet/espnet). All Rights Reserved. +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +import logging +from contextlib import contextmanager +from distutils.version import LooseVersion +from typing import Dict +from typing import List +from typing import Optional +from typing import Tuple +from typing import Union + +import torch +import torch.nn.functional as F + +from funasr.layers.abs_normalize import AbsNormalize +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss, NllLoss # noqa: H301 +from funasr.models.ctc import CTC +from funasr.models.decoder.abs_decoder import AbsDecoder +from funasr.models.encoder.abs_encoder import AbsEncoder +from funasr.frontends.abs_frontend import AbsFrontend +from funasr.models.postencoder.abs_postencoder import AbsPostEncoder +from funasr.models.preencoder.abs_preencoder import AbsPreEncoder +from funasr.models.specaug.abs_specaug import AbsSpecAug +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.metrics import ErrorCalculator +from funasr.metrics.compute_acc import th_accuracy +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.base_model import FunASRModel + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +class SAASRModel(FunASRModel): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + vocab_size: int, + max_spk_num: int, + token_list: Union[Tuple[str, ...], List[str]], + frontend: Optional[AbsFrontend], + specaug: Optional[AbsSpecAug], + normalize: Optional[AbsNormalize], + asr_encoder: AbsEncoder, + spk_encoder: torch.nn.Module, + decoder: AbsDecoder, + ctc: CTC, + spk_weight: float = 0.5, + ctc_weight: float = 0.5, + interctc_weight: float = 0.0, + ignore_id: int = -1, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + extract_feats_in_collect_stats: bool = True, + ): + assert 0.0 <= ctc_weight <= 1.0, ctc_weight + assert 0.0 <= interctc_weight < 1.0, interctc_weight + + super().__init__() + # note that eos is the same as sos (equivalent ID) + self.blank_id = 0 + self.sos = 1 + self.eos = 2 + self.vocab_size = vocab_size + self.max_spk_num = max_spk_num + self.ignore_id = ignore_id + self.spk_weight = spk_weight + self.ctc_weight = ctc_weight + self.interctc_weight = interctc_weight + self.token_list = token_list.copy() + + self.frontend = frontend + self.specaug = specaug + self.normalize = normalize + self.asr_encoder = asr_encoder + self.spk_encoder = spk_encoder + + if not hasattr(self.asr_encoder, "interctc_use_conditioning"): + self.asr_encoder.interctc_use_conditioning = False + if self.asr_encoder.interctc_use_conditioning: + self.asr_encoder.conditioning_layer = torch.nn.Linear( + vocab_size, self.asr_encoder.output_size() + ) + + self.error_calculator = None + + # we set self.decoder = None in the CTC mode since + # self.decoder parameters were never used and PyTorch complained + # and threw an Exception in the multi-GPU experiment. + # thanks Jeff Farris for pointing out the issue. + if ctc_weight == 1.0: + self.decoder = None + else: + self.decoder = decoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + + self.criterion_spk = NllLoss( + size=max_spk_num, + padding_idx=ignore_id, + normalize_length=length_normalized_loss, + ) + + if report_cer or report_wer: + self.error_calculator = ErrorCalculator( + token_list, sym_space, sym_blank, report_cer, report_wer + ) + + if ctc_weight == 0.0: + self.ctc = None + else: + self.ctc = ctc + + self.extract_feats_in_collect_stats = extract_feats_in_collect_stats + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + profile: torch.Tensor, + profile_lengths: torch.Tensor, + text_id: torch.Tensor, + text_id_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + profile: (Batch, Length, Dim) + profile_lengths: (Batch,) + """ + assert text_lengths.dim() == 1, text_lengths.shape + # Check that batch_size is unified + assert ( + speech.shape[0] == speech_lengths.shape[0] == text.shape[0] == text_lengths.shape[0] + ), (speech.shape, speech_lengths.shape, text.shape, text_lengths.shape) + batch_size = speech.shape[0] + + # for data-parallel + text = text[:, : text_lengths.max()] + + # 1. Encoder + asr_encoder_out, encoder_out_lens, spk_encoder_out = self.encode(speech, speech_lengths) + intermediate_outs = None + if isinstance(asr_encoder_out, tuple): + intermediate_outs = asr_encoder_out[1] + asr_encoder_out = asr_encoder_out[0] + + loss_att, loss_spk, acc_att, acc_spk, cer_att, wer_att = None, None, None, None, None, None + loss_ctc, cer_ctc = None, None + stats = dict() + + # 1. CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + asr_encoder_out, encoder_out_lens, text, text_lengths + ) + + # Intermediate CTC (optional) + loss_interctc = 0.0 + if self.interctc_weight != 0.0 and intermediate_outs is not None: + for layer_idx, intermediate_out in intermediate_outs: + # we assume intermediate_out has the same length & padding + # as those of encoder_out + loss_ic, cer_ic = self._calc_ctc_loss( + intermediate_out, encoder_out_lens, text, text_lengths + ) + loss_interctc = loss_interctc + loss_ic + + # Collect Intermedaite CTC stats + stats["loss_interctc_layer{}".format(layer_idx)] = ( + loss_ic.detach() if loss_ic is not None else None + ) + stats["cer_interctc_layer{}".format(layer_idx)] = cer_ic + + loss_interctc = loss_interctc / len(intermediate_outs) + + # calculate whole encoder loss + loss_ctc = (1 - self.interctc_weight) * loss_ctc + self.interctc_weight * loss_interctc + + # 2b. Attention decoder branch + if self.ctc_weight != 1.0: + loss_att, loss_spk, acc_att, acc_spk, cer_att, wer_att = self._calc_att_loss( + asr_encoder_out, + spk_encoder_out, + encoder_out_lens, + text, + text_lengths, + profile, + profile_lengths, + text_id, + text_id_lengths, + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss_asr = loss_att + elif self.ctc_weight == 1.0: + loss_asr = loss_ctc + else: + loss_asr = self.ctc_weight * loss_ctc + (1 - self.ctc_weight) * loss_att + + if self.spk_weight == 0.0: + loss = loss_asr + else: + loss = self.spk_weight * loss_spk + (1 - self.spk_weight) * loss_asr + + stats = dict( + loss=loss.detach(), + loss_asr=loss_asr.detach(), + loss_att=loss_att.detach() if loss_att is not None else None, + loss_ctc=loss_ctc.detach() if loss_ctc is not None else None, + loss_spk=loss_spk.detach() if loss_spk is not None else None, + acc=acc_att, + acc_spk=acc_spk, + cer=cer_att, + wer=wer_att, + cer_ctc=cer_ctc, + ) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def collect_feats( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + ) -> Dict[str, torch.Tensor]: + if self.extract_feats_in_collect_stats: + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + else: + # Generate dummy stats if extract_feats_in_collect_stats is False + logging.warning( + "Generating dummy stats for feats and feats_lengths, " + "because encoder_conf.extract_feats_in_collect_stats is " + f"{self.extract_feats_in_collect_stats}" + ) + feats, feats_lengths = speech, speech_lengths + return {"feats": feats, "feats_lengths": feats_lengths} + + def encode( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + with autocast(False): + # 1. Extract feats + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + + # 2. Data augmentation + feats_raw = feats.clone() + if self.specaug is not None and self.training: + feats, feats_lengths = self.specaug(feats, feats_lengths) + + # 3. Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + feats, feats_lengths = self.normalize(feats, feats_lengths) + + # 4. Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + if self.asr_encoder.interctc_use_conditioning: + encoder_out, encoder_out_lens, _ = self.asr_encoder(feats, feats_lengths, ctc=self.ctc) + else: + encoder_out, encoder_out_lens, _ = self.asr_encoder(feats, feats_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + encoder_out_spk_ori = self.spk_encoder(feats_raw, feats_lengths)[0] + # import ipdb;ipdb.set_trace() + if encoder_out_spk_ori.size(1) != encoder_out.size(1): + encoder_out_spk = F.interpolate( + encoder_out_spk_ori.transpose(-2, -1), size=(encoder_out.size(1)), mode="nearest" + ).transpose(-2, -1) + else: + encoder_out_spk = encoder_out_spk_ori + + assert encoder_out.size(0) == speech.size(0), ( + encoder_out.size(), + speech.size(0), + ) + assert encoder_out.size(1) <= encoder_out_lens.max(), ( + encoder_out.size(), + encoder_out_lens.max(), + ) + assert encoder_out_spk.size(0) == speech.size(0), ( + encoder_out_spk.size(), + speech.size(0), + ) + + if intermediate_outs is not None: + return (encoder_out, intermediate_outs), encoder_out_lens, encoder_out_spk + + return encoder_out, encoder_out_lens, encoder_out_spk + + def _extract_feats( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + assert speech_lengths.dim() == 1, speech_lengths.shape + + # for data-parallel + speech = speech[:, : speech_lengths.max()] + + if self.frontend is not None: + # Frontend + # e.g. STFT and Feature extract + # data_loader may send time-domain signal in this case + # speech (Batch, NSamples) -> feats: (Batch, NFrames, Dim) + feats, feats_lengths = self.frontend(speech, speech_lengths) + else: + # No frontend and no feature extract + feats, feats_lengths = speech, speech_lengths + return feats, feats_lengths + + def nll( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ) -> torch.Tensor: + """Compute negative log likelihood(nll) from transformer-decoder + + Normally, this function is called in batchify_nll. + + Args: + encoder_out: (Batch, Length, Dim) + encoder_out_lens: (Batch,) + ys_pad: (Batch, Length) + ys_pad_lens: (Batch,) + """ + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, _ = self.decoder( + encoder_out, encoder_out_lens, ys_in_pad, ys_in_lens + ) # [batch, seqlen, dim] + batch_size = decoder_out.size(0) + decoder_num_class = decoder_out.size(2) + # nll: negative log-likelihood + nll = torch.nn.functional.cross_entropy( + decoder_out.view(-1, decoder_num_class), + ys_out_pad.view(-1), + ignore_index=self.ignore_id, + reduction="none", + ) + nll = nll.view(batch_size, -1) + nll = nll.sum(dim=1) + assert nll.size(0) == batch_size + return nll + + def batchify_nll( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + batch_size: int = 100, + ): + """Compute negative log likelihood(nll) from transformer-decoder + + To avoid OOM, this fuction seperate the input into batches. + Then call nll for each batch and combine and return results. + Args: + encoder_out: (Batch, Length, Dim) + encoder_out_lens: (Batch,) + ys_pad: (Batch, Length) + ys_pad_lens: (Batch,) + batch_size: int, samples each batch contain when computing nll, + you may change this to avoid OOM or increase + GPU memory usage + """ + total_num = encoder_out.size(0) + if total_num <= batch_size: + nll = self.nll(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + else: + nll = [] + start_idx = 0 + while True: + end_idx = min(start_idx + batch_size, total_num) + batch_encoder_out = encoder_out[start_idx:end_idx, :, :] + batch_encoder_out_lens = encoder_out_lens[start_idx:end_idx] + batch_ys_pad = ys_pad[start_idx:end_idx, :] + batch_ys_pad_lens = ys_pad_lens[start_idx:end_idx] + batch_nll = self.nll( + batch_encoder_out, + batch_encoder_out_lens, + batch_ys_pad, + batch_ys_pad_lens, + ) + nll.append(batch_nll) + start_idx = end_idx + if start_idx == total_num: + break + nll = torch.cat(nll) + assert nll.size(0) == total_num + return nll + + def _calc_att_loss( + self, + asr_encoder_out: torch.Tensor, + spk_encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + profile: torch.Tensor, + profile_lens: torch.Tensor, + text_id: torch.Tensor, + text_id_lengths: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, weights_no_pad, _ = self.decoder( + asr_encoder_out, + spk_encoder_out, + encoder_out_lens, + ys_in_pad, + ys_in_lens, + profile, + profile_lens, + ) + + spk_num_no_pad = weights_no_pad.size(-1) + pad = (0, self.max_spk_num - spk_num_no_pad) + weights = F.pad(weights_no_pad, pad, mode="constant", value=0) + + # pre_id=weights.argmax(-1) + # pre_text=decoder_out.argmax(-1) + # id_mask=(pre_id==text_id).to(dtype=text_id.dtype) + # pre_text_mask=pre_text*id_mask+1-id_mask #相同的地方不变,不同的地方设为1() + # padding_mask= ys_out_pad != self.ignore_id + # numerator = torch.sum(pre_text_mask.masked_select(padding_mask) == ys_out_pad.masked_select(padding_mask)) + # denominator = torch.sum(padding_mask) + # sd_acc = float(numerator) / float(denominator) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + loss_spk = self.criterion_spk(torch.log(weights), text_id) + + acc_spk = th_accuracy( + weights.view(-1, self.max_spk_num), + text_id, + ignore_label=self.ignore_id, + ) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, loss_spk, acc_att, acc_spk, cer_att, wer_att + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + # Calc CTC loss + loss_ctc = self.ctc(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + + # Calc CER using CTC + cer_ctc = None + if not self.training and self.error_calculator is not None: + ys_hat = self.ctc.argmax(encoder_out).data + cer_ctc = self.error_calculator(ys_hat.cpu(), ys_pad.cpu(), is_ctc=True) + return loss_ctc, cer_ctc diff --git a/funasr/models/sa_asr/transformer_decoder.py b/funasr/models/sa_asr/transformer_decoder.py new file mode 100644 index 0000000..be33fa5 --- /dev/null +++ b/funasr/models/sa_asr/transformer_decoder.py @@ -0,0 +1,731 @@ +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Decoder definition.""" +from typing import Any +from typing import List +from typing import Sequence +from typing import Tuple + +import torch +from torch import nn + + +from funasr.models.transformer.attention import MultiHeadedAttention +from funasr.models.sa_asr.attention import CosineDistanceAttention +from funasr.models.transformer.utils.dynamic_conv import DynamicConvolution +from funasr.models.transformer.utils.dynamic_conv2d import DynamicConvolution2D +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.lightconv import LightweightConvolution +from funasr.models.transformer.utils.lightconv2d import LightweightConvolution2D +from funasr.models.transformer.utils.mask import subsequent_mask +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.scorers.scorer_interface import BatchScorerInterface + +from funasr.register import tables + + +class DecoderLayer(nn.Module): + """Single decoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + src_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + + """ + + def __init__( + self, + size, + self_attn, + src_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an DecoderLayer object.""" + super(DecoderLayer, self).__init__() + self.size = size + self.self_attn = self_attn + self.src_attn = src_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + self.norm2 = LayerNorm(size) + self.norm3 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = nn.Linear(size + size, size) + self.concat_linear2 = nn.Linear(size + size, size) + + def forward(self, tgt, tgt_mask, memory, memory_mask, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + + if cache is None: + tgt_q = tgt + tgt_q_mask = tgt_mask + else: + # compute only the last frame query keeping dim: max_time_out -> 1 + assert cache.shape == ( + tgt.shape[0], + tgt.shape[1] - 1, + self.size, + ), f"{cache.shape} == {(tgt.shape[0], tgt.shape[1] - 1, self.size)}" + tgt_q = tgt[:, -1:, :] + residual = residual[:, -1:, :] + tgt_q_mask = None + if tgt_mask is not None: + tgt_q_mask = tgt_mask[:, -1:, :] + + if self.concat_after: + tgt_concat = torch.cat((tgt_q, self.self_attn(tgt_q, tgt, tgt, tgt_q_mask)), dim=-1) + x = residual + self.concat_linear1(tgt_concat) + else: + x = residual + self.dropout(self.self_attn(tgt_q, tgt, tgt, tgt_q_mask)) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + if self.concat_after: + x_concat = torch.cat((x, self.src_attn(x, memory, memory, memory_mask)), dim=-1) + x = residual + self.concat_linear2(x_concat) + else: + x = residual + self.dropout(self.src_attn(x, memory, memory, memory_mask)) + if not self.normalize_before: + x = self.norm2(x) + + residual = x + if self.normalize_before: + x = self.norm3(x) + x = residual + self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm3(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + return x, tgt_mask, memory, memory_mask + + +class BaseTransformerDecoder(nn.Module, BatchScorerInterface): + """Base class of Transfomer decoder module. + + Args: + vocab_size: output dim + encoder_output_size: dimension of attention + attention_heads: the number of heads of multi head attention + linear_units: the number of units of position-wise feed forward + num_blocks: the number of decoder blocks + dropout_rate: dropout rate + self_attention_dropout_rate: dropout rate for attention + input_layer: input layer type + use_output_layer: whether to use output layer + pos_enc_class: PositionalEncoding or ScaledPositionalEncoding + normalize_before: whether to use layer_norm before the first block + concat_after: whether to concat attention layer's input and output + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. + i.e. x -> x + att(x) + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + ): + super().__init__() + attention_dim = encoder_output_size + + if input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(vocab_size, attention_dim), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(vocab_size, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + else: + raise ValueError(f"only 'embed' or 'linear' is supported: {input_layer}") + + self.normalize_before = normalize_before + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + if use_output_layer: + self.output_layer = torch.nn.Linear(attention_dim, vocab_size) + else: + self.output_layer = None + + # Must set by the inheritance + self.decoders = None + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + # tgt_mask: (B, 1, L) + tgt_mask = (~make_pad_mask(ys_in_lens)[:, None, :]).to(tgt.device) + # m: (1, L, L) + m = subsequent_mask(tgt_mask.size(-1), device=tgt_mask.device).unsqueeze(0) + # tgt_mask: (B, L, L) + tgt_mask = tgt_mask & m + + memory = hs_pad + memory_mask = (~make_pad_mask(hlens, maxlen=memory.size(1)))[:, None, :].to(memory.device) + # Padding for Longformer + if memory_mask.shape[-1] != memory.shape[1]: + padlen = memory.shape[1] - memory_mask.shape[-1] + memory_mask = torch.nn.functional.pad(memory_mask, (0, padlen), "constant", False) + + x = self.embed(tgt) + x, tgt_mask, memory, memory_mask = self.decoders(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + return x, olens + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + """ + x = self.embed(tgt) + if cache is None: + cache = [None] * len(self.decoders) + new_cache = [] + for c, decoder in zip(cache, self.decoders): + x, tgt_mask, memory, memory_mask = decoder(x, tgt_mask, memory, None, cache=c) + new_cache.append(x) + + if self.normalize_before: + y = self.after_norm(x[:, -1]) + else: + y = x[:, -1] + if self.output_layer is not None: + y = torch.log_softmax(self.output_layer(y), dim=-1) + + return y, new_cache + + def score(self, ys, state, x): + """Score.""" + ys_mask = subsequent_mask(len(ys), device=x.device).unsqueeze(0) + logp, state = self.forward_one_step(ys.unsqueeze(0), ys_mask, x.unsqueeze(0), cache=state) + return logp.squeeze(0), state + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, n_vocab)` + and next state list for ys. + + """ + # merge states + n_batch = len(ys) + n_layers = len(self.decoders) + if states[0] is None: + batch_state = None + else: + # transpose state of [batch, layer] into [layer, batch] + batch_state = [ + torch.stack([states[b][i] for b in range(n_batch)]) for i in range(n_layers) + ] + + # batch decoding + ys_mask = subsequent_mask(ys.size(-1), device=xs.device).unsqueeze(0) + logp, states = self.forward_one_step(ys, ys_mask, xs, cache=batch_state) + + # transpose state of [layer, batch] into [batch, layer] + state_list = [[states[i][b] for i in range(n_layers)] for b in range(n_batch)] + return logp, state_list + + +@tables.register("decoder_classes", "TransformerDecoder") +class TransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + MultiHeadedAttention(attention_heads, attention_dim, self_attention_dropout_rate), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "ParaformerDecoderSAN") +class ParaformerDecoderSAN(BaseTransformerDecoder): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2006.01713 + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + embeds_id: int = -1, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + MultiHeadedAttention(attention_heads, attention_dim, self_attention_dropout_rate), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + self.embeds_id = embeds_id + self.attention_dim = attention_dim + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + tgt_mask = (~make_pad_mask(ys_in_lens)[:, None, :]).to(tgt.device) + + memory = hs_pad + memory_mask = (~make_pad_mask(hlens, maxlen=memory.size(1)))[:, None, :].to(memory.device) + # Padding for Longformer + if memory_mask.shape[-1] != memory.shape[1]: + padlen = memory.shape[1] - memory_mask.shape[-1] + memory_mask = torch.nn.functional.pad(memory_mask, (0, padlen), "constant", False) + + # x = self.embed(tgt) + x = tgt + embeds_outputs = None + for layer_id, decoder in enumerate(self.decoders): + x, tgt_mask, memory, memory_mask = decoder(x, tgt_mask, memory, memory_mask) + if layer_id == self.embeds_id: + embeds_outputs = x + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + if embeds_outputs is not None: + return x, olens, embeds_outputs + else: + return x, olens + + +@tables.register("decoder_classes", "LightweightConvolutionTransformerDecoder") +class LightweightConvolutionTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + LightweightConvolution( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "LightweightConvolution2DTransformerDecoder") +class LightweightConvolution2DTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + LightweightConvolution2D( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "DynamicConvolutionTransformerDecoder") +class DynamicConvolutionTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + attention_dim = encoder_output_size + + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + DynamicConvolution( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "DynamicConvolution2DTransformerDecoder") +class DynamicConvolution2DTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + attention_dim = encoder_output_size + + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + DynamicConvolution2D( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) diff --git a/funasr/models/sanm/__init__.py b/funasr/models/sanm/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/sanm/attention.py b/funasr/models/sanm/attention.py new file mode 100644 index 0000000..da8850f --- /dev/null +++ b/funasr/models/sanm/attention.py @@ -0,0 +1,895 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Multi-Head Attention layer definition.""" + +import math + +import numpy +import torch +from torch import nn +from typing import Optional, Tuple + +import torch.nn.functional as F +from funasr.models.transformer.utils.nets_utils import make_pad_mask +import funasr.models.lora.layers as lora + + +def preprocess_for_attn(x, mask, cache, pad_fn, kernel_size): + x = x * mask + x = x.transpose(1, 2) + if cache is None: + x = pad_fn(x) + else: + x = torch.cat((cache, x), dim=2) + cache = x[:, :, -(kernel_size - 1) :] + return x, cache + + +torch_version = tuple([int(i) for i in torch.__version__.split(".")[:2]]) +if torch_version >= (1, 8): + import torch.fx + + torch.fx.wrap("preprocess_for_attn") + + +class MultiHeadedAttention(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_head, n_feat, dropout_rate): + """Construct an MultiHeadedAttention object.""" + super(MultiHeadedAttention, self).__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + self.linear_q = nn.Linear(n_feat, n_feat) + self.linear_k = nn.Linear(n_feat, n_feat) + self.linear_v = nn.Linear(n_feat, n_feat) + self.linear_out = nn.Linear(n_feat, n_feat) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv(self, query, key, value): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + n_batch = query.size(0) + q = self.linear_q(query).view(n_batch, -1, self.h, self.d_k) + k = self.linear_k(key).view(n_batch, -1, self.h, self.d_k) + v = self.linear_v(value).view(n_batch, -1, self.h, self.d_k) + q = q.transpose(1, 2) # (batch, head, time1, d_k) + k = k.transpose(1, 2) # (batch, head, time2, d_k) + v = v.transpose(1, 2) # (batch, head, time2, d_k) + + return q, k, v + + def forward_attention(self, value, scores, mask): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + min_value = float(numpy.finfo(torch.tensor(0, dtype=scores.dtype).numpy().dtype).min) + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x) # (batch, time1, d_model) + + def forward(self, query, key, value, mask): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q, k, v = self.forward_qkv(query, key, value) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, mask) + + +class MultiHeadedAttentionSANM(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__( + self, + n_head, + in_feat, + n_feat, + dropout_rate, + kernel_size, + sanm_shfit=0, + lora_list=None, + lora_rank=8, + lora_alpha=16, + lora_dropout=0.1, + ): + """Construct an MultiHeadedAttention object.""" + super().__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + # self.linear_q = nn.Linear(n_feat, n_feat) + # self.linear_k = nn.Linear(n_feat, n_feat) + # self.linear_v = nn.Linear(n_feat, n_feat) + if lora_list is not None: + if "o" in lora_list: + self.linear_out = lora.Linear( + n_feat, n_feat, r=lora_rank, lora_alpha=lora_alpha, lora_dropout=lora_dropout + ) + else: + self.linear_out = nn.Linear(n_feat, n_feat) + lora_qkv_list = ["q" in lora_list, "k" in lora_list, "v" in lora_list] + if lora_qkv_list == [False, False, False]: + self.linear_q_k_v = nn.Linear(in_feat, n_feat * 3) + else: + self.linear_q_k_v = lora.MergedLinear( + in_feat, + n_feat * 3, + r=lora_rank, + lora_alpha=lora_alpha, + lora_dropout=lora_dropout, + enable_lora=lora_qkv_list, + ) + else: + self.linear_out = nn.Linear(n_feat, n_feat) + self.linear_q_k_v = nn.Linear(in_feat, n_feat * 3) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + self.fsmn_block = nn.Conv1d( + n_feat, n_feat, kernel_size, stride=1, padding=0, groups=n_feat, bias=False + ) + # padding + left_padding = (kernel_size - 1) // 2 + if sanm_shfit > 0: + left_padding = left_padding + sanm_shfit + right_padding = kernel_size - 1 - left_padding + self.pad_fn = nn.ConstantPad1d((left_padding, right_padding), 0.0) + + def forward_fsmn(self, inputs, mask, mask_shfit_chunk=None): + b, t, d = inputs.size() + if mask is not None: + mask = torch.reshape(mask, (b, -1, 1)) + if mask_shfit_chunk is not None: + mask = mask * mask_shfit_chunk + inputs = inputs * mask + + x = inputs.transpose(1, 2) + x = self.pad_fn(x) + x = self.fsmn_block(x) + x = x.transpose(1, 2) + x += inputs + x = self.dropout(x) + if mask is not None: + x = x * mask + return x + + def forward_qkv(self, x): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + b, t, d = x.size() + q_k_v = self.linear_q_k_v(x) + q, k, v = torch.split(q_k_v, int(self.h * self.d_k), dim=-1) + q_h = torch.reshape(q, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time1, d_k) + k_h = torch.reshape(k, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + v_h = torch.reshape(v, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + + return q_h, k_h, v_h, v + + def forward_attention(self, value, scores, mask, mask_att_chunk_encoder=None): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + if mask_att_chunk_encoder is not None: + mask = mask * mask_att_chunk_encoder + + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + + min_value = float(numpy.finfo(torch.tensor(0, dtype=scores.dtype).numpy().dtype).min) + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x) # (batch, time1, d_model) + + def forward(self, x, mask, mask_shfit_chunk=None, mask_att_chunk_encoder=None): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q_h, k_h, v_h, v = self.forward_qkv(x) + fsmn_memory = self.forward_fsmn(v, mask, mask_shfit_chunk) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, mask, mask_att_chunk_encoder) + return att_outs + fsmn_memory + + def forward_chunk(self, x, cache=None, chunk_size=None, look_back=0): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q_h, k_h, v_h, v = self.forward_qkv(x) + if chunk_size is not None and look_back > 0 or look_back == -1: + if cache is not None: + k_h_stride = k_h[:, :, : -(chunk_size[2]), :] + v_h_stride = v_h[:, :, : -(chunk_size[2]), :] + k_h = torch.cat((cache["k"], k_h), dim=2) + v_h = torch.cat((cache["v"], v_h), dim=2) + + cache["k"] = torch.cat((cache["k"], k_h_stride), dim=2) + cache["v"] = torch.cat((cache["v"], v_h_stride), dim=2) + if look_back != -1: + cache["k"] = cache["k"][:, :, -(look_back * chunk_size[1]) :, :] + cache["v"] = cache["v"][:, :, -(look_back * chunk_size[1]) :, :] + else: + cache_tmp = { + "k": k_h[:, :, : -(chunk_size[2]), :], + "v": v_h[:, :, : -(chunk_size[2]), :], + } + cache = cache_tmp + fsmn_memory = self.forward_fsmn(v, None) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, None) + return att_outs + fsmn_memory, cache + + +class MultiHeadedAttentionSANMExport(nn.Module): + def __init__(self, model): + super().__init__() + self.d_k = model.d_k + self.h = model.h + self.linear_out = model.linear_out + self.linear_q_k_v = model.linear_q_k_v + self.fsmn_block = model.fsmn_block + self.pad_fn = model.pad_fn + + self.attn = None + self.all_head_size = self.h * self.d_k + + def forward(self, x, mask): + mask_3d_btd, mask_4d_bhlt = mask + q_h, k_h, v_h, v = self.forward_qkv(x) + fsmn_memory = self.forward_fsmn(v, mask_3d_btd) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, mask_4d_bhlt) + return att_outs + fsmn_memory + + def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: + new_x_shape = x.size()[:-1] + (self.h, self.d_k) + x = x.view(new_x_shape) + return x.permute(0, 2, 1, 3) + + def forward_qkv(self, x): + q_k_v = self.linear_q_k_v(x) + q, k, v = torch.split(q_k_v, int(self.h * self.d_k), dim=-1) + q_h = self.transpose_for_scores(q) + k_h = self.transpose_for_scores(k) + v_h = self.transpose_for_scores(v) + return q_h, k_h, v_h, v + + def forward_fsmn(self, inputs, mask): + # b, t, d = inputs.size() + # mask = torch.reshape(mask, (b, -1, 1)) + inputs = inputs * mask + x = inputs.transpose(1, 2) + x = self.pad_fn(x) + x = self.fsmn_block(x) + x = x.transpose(1, 2) + x = x + inputs + x = x * mask + return x + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) + + +class MultiHeadedAttentionSANMExport(nn.Module): + def __init__(self, model): + super().__init__() + self.d_k = model.d_k + self.h = model.h + self.linear_out = model.linear_out + self.linear_q_k_v = model.linear_q_k_v + self.fsmn_block = model.fsmn_block + self.pad_fn = model.pad_fn + + self.attn = None + self.all_head_size = self.h * self.d_k + + def forward(self, x, mask): + mask_3d_btd, mask_4d_bhlt = mask + q_h, k_h, v_h, v = self.forward_qkv(x) + fsmn_memory = self.forward_fsmn(v, mask_3d_btd) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, mask_4d_bhlt) + return att_outs + fsmn_memory + + def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: + new_x_shape = x.size()[:-1] + (self.h, self.d_k) + x = x.view(new_x_shape) + return x.permute(0, 2, 1, 3) + + def forward_qkv(self, x): + q_k_v = self.linear_q_k_v(x) + q, k, v = torch.split(q_k_v, int(self.h * self.d_k), dim=-1) + q_h = self.transpose_for_scores(q) + k_h = self.transpose_for_scores(k) + v_h = self.transpose_for_scores(v) + return q_h, k_h, v_h, v + + def forward_fsmn(self, inputs, mask): + # b, t, d = inputs.size() + # mask = torch.reshape(mask, (b, -1, 1)) + inputs = inputs * mask + x = inputs.transpose(1, 2) + x = self.pad_fn(x) + x = self.fsmn_block(x) + x = x.transpose(1, 2) + x = x + inputs + x = x * mask + return x + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) + + +class MultiHeadedAttentionSANMDecoder(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_feat, dropout_rate, kernel_size, sanm_shfit=0): + """Construct an MultiHeadedAttention object.""" + super().__init__() + + self.dropout = nn.Dropout(p=dropout_rate) + + self.fsmn_block = nn.Conv1d( + n_feat, n_feat, kernel_size, stride=1, padding=0, groups=n_feat, bias=False + ) + # padding + # padding + left_padding = (kernel_size - 1) // 2 + if sanm_shfit > 0: + left_padding = left_padding + sanm_shfit + right_padding = kernel_size - 1 - left_padding + self.pad_fn = nn.ConstantPad1d((left_padding, right_padding), 0.0) + self.kernel_size = kernel_size + + def forward(self, inputs, mask, cache=None, mask_shfit_chunk=None): + """ + :param x: (#batch, time1, size). + :param mask: Mask tensor (#batch, 1, time) + :return: + """ + # print("in fsmn, inputs", inputs.size()) + b, t, d = inputs.size() + # logging.info( + # "mask: {}".format(mask.size())) + if mask is not None: + mask = torch.reshape(mask, (b, -1, 1)) + # logging.info("in fsmn, mask: {}, {}".format(mask.size(), mask[0:100:50, :, :])) + if mask_shfit_chunk is not None: + # logging.info("in fsmn, mask_fsmn: {}, {}".format(mask_shfit_chunk.size(), mask_shfit_chunk[0:100:50, :, :])) + mask = mask * mask_shfit_chunk + # logging.info("in fsmn, mask_after_fsmn: {}, {}".format(mask.size(), mask[0:100:50, :, :])) + # print("in fsmn, mask", mask.size()) + # print("in fsmn, inputs", inputs.size()) + inputs = inputs * mask + + x = inputs.transpose(1, 2) + b, d, t = x.size() + if cache is None: + # print("in fsmn, cache is None, x", x.size()) + + x = self.pad_fn(x) + if not self.training: + cache = x + else: + # print("in fsmn, cache is not None, x", x.size()) + # x = torch.cat((x, cache), dim=2)[:, :, :-1] + # if t < self.kernel_size: + # x = self.pad_fn(x) + x = torch.cat((cache[:, :, 1:], x), dim=2) + x = x[:, :, -(self.kernel_size + t - 1) :] + # print("in fsmn, cache is not None, x_cat", x.size()) + cache = x + x = self.fsmn_block(x) + x = x.transpose(1, 2) + # print("in fsmn, fsmn_out", x.size()) + if x.size(1) != inputs.size(1): + inputs = inputs[:, -1, :] + + x = x + inputs + x = self.dropout(x) + if mask is not None: + x = x * mask + return x, cache + + +class MultiHeadedAttentionSANMDecoderExport(nn.Module): + def __init__(self, model): + super().__init__() + self.fsmn_block = model.fsmn_block + self.pad_fn = model.pad_fn + self.kernel_size = model.kernel_size + self.attn = None + + def forward(self, inputs, mask, cache=None): + x, cache = preprocess_for_attn(inputs, mask, cache, self.pad_fn, self.kernel_size) + x = self.fsmn_block(x) + x = x.transpose(1, 2) + + x = x + inputs + x = x * mask + return x, cache + + +class MultiHeadedAttentionCrossAtt(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__( + self, + n_head, + n_feat, + dropout_rate, + lora_list=None, + lora_rank=8, + lora_alpha=16, + lora_dropout=0.1, + encoder_output_size=None, + ): + """Construct an MultiHeadedAttention object.""" + super().__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + if lora_list is not None: + if "q" in lora_list: + self.linear_q = lora.Linear( + n_feat, n_feat, r=lora_rank, lora_alpha=lora_alpha, lora_dropout=lora_dropout + ) + else: + self.linear_q = nn.Linear(n_feat, n_feat) + lora_kv_list = ["k" in lora_list, "v" in lora_list] + if lora_kv_list == [False, False]: + self.linear_k_v = nn.Linear( + n_feat if encoder_output_size is None else encoder_output_size, n_feat * 2 + ) + else: + self.linear_k_v = lora.MergedLinear( + n_feat if encoder_output_size is None else encoder_output_size, + n_feat * 2, + r=lora_rank, + lora_alpha=lora_alpha, + lora_dropout=lora_dropout, + enable_lora=lora_kv_list, + ) + if "o" in lora_list: + self.linear_out = lora.Linear( + n_feat, n_feat, r=lora_rank, lora_alpha=lora_alpha, lora_dropout=lora_dropout + ) + else: + self.linear_out = nn.Linear(n_feat, n_feat) + else: + self.linear_q = nn.Linear(n_feat, n_feat) + self.linear_k_v = nn.Linear( + n_feat if encoder_output_size is None else encoder_output_size, n_feat * 2 + ) + self.linear_out = nn.Linear(n_feat, n_feat) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv(self, x, memory): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + + # print("in forward_qkv, x", x.size()) + b = x.size(0) + q = self.linear_q(x) + q_h = torch.reshape(q, (b, -1, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time1, d_k) + + k_v = self.linear_k_v(memory) + k, v = torch.split(k_v, int(self.h * self.d_k), dim=-1) + k_h = torch.reshape(k, (b, -1, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + v_h = torch.reshape(v, (b, -1, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + + return q_h, k_h, v_h + + def forward_attention(self, value, scores, mask, ret_attn=False): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + min_value = float(numpy.finfo(torch.tensor(0, dtype=scores.dtype).numpy().dtype).min) + # logging.info( + # "scores: {}, mask_size: {}".format(scores.size(), mask.size())) + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + if ret_attn: + return self.linear_out(x), self.attn # (batch, time1, d_model) + return self.linear_out(x) # (batch, time1, d_model) + + def forward(self, x, memory, memory_mask, ret_attn=False): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q_h, k_h, v_h = self.forward_qkv(x, memory) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + return self.forward_attention(v_h, scores, memory_mask, ret_attn=ret_attn) + + def forward_chunk(self, x, memory, cache=None, chunk_size=None, look_back=0): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q_h, k_h, v_h = self.forward_qkv(x, memory) + if chunk_size is not None and look_back > 0: + if cache is not None: + k_h = torch.cat((cache["k"], k_h), dim=2) + v_h = torch.cat((cache["v"], v_h), dim=2) + cache["k"] = k_h[:, :, -(look_back * chunk_size[1]) :, :] + cache["v"] = v_h[:, :, -(look_back * chunk_size[1]) :, :] + else: + cache_tmp = { + "k": k_h[:, :, -(look_back * chunk_size[1]) :, :], + "v": v_h[:, :, -(look_back * chunk_size[1]) :, :], + } + cache = cache_tmp + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + return self.forward_attention(v_h, scores, None), cache + + +class MultiHeadedAttentionCrossAttExport(nn.Module): + def __init__(self, model): + super().__init__() + self.d_k = model.d_k + self.h = model.h + self.linear_q = model.linear_q + self.linear_k_v = model.linear_k_v + self.linear_out = model.linear_out + self.attn = None + self.all_head_size = self.h * self.d_k + + def forward(self, x, memory, memory_mask, ret_attn=False): + q, k, v = self.forward_qkv(x, memory) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, memory_mask, ret_attn) + + def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: + new_x_shape = x.size()[:-1] + (self.h, self.d_k) + x = x.view(new_x_shape) + return x.permute(0, 2, 1, 3) + + def forward_qkv(self, x, memory): + q = self.linear_q(x) + + k_v = self.linear_k_v(memory) + k, v = torch.split(k_v, int(self.h * self.d_k), dim=-1) + q = self.transpose_for_scores(q) + k = self.transpose_for_scores(k) + v = self.transpose_for_scores(v) + return q, k, v + + def forward_attention(self, value, scores, mask, ret_attn): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + if ret_attn: + return self.linear_out(context_layer), self.attn + return self.linear_out(context_layer) # (batch, time1, d_model) + + +class MultiHeadSelfAttention(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_head, in_feat, n_feat, dropout_rate): + """Construct an MultiHeadedAttention object.""" + super(MultiHeadSelfAttention, self).__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + self.linear_out = nn.Linear(n_feat, n_feat) + self.linear_q_k_v = nn.Linear(in_feat, n_feat * 3) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv(self, x): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + b, t, d = x.size() + q_k_v = self.linear_q_k_v(x) + q, k, v = torch.split(q_k_v, int(self.h * self.d_k), dim=-1) + q_h = torch.reshape(q, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time1, d_k) + k_h = torch.reshape(k, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + v_h = torch.reshape(v, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + + return q_h, k_h, v_h, v + + def forward_attention(self, value, scores, mask, mask_att_chunk_encoder=None): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + if mask_att_chunk_encoder is not None: + mask = mask * mask_att_chunk_encoder + + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + + min_value = float(numpy.finfo(torch.tensor(0, dtype=scores.dtype).numpy().dtype).min) + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x) # (batch, time1, d_model) + + def forward(self, x, mask, mask_att_chunk_encoder=None): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q_h, k_h, v_h, v = self.forward_qkv(x) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, mask, mask_att_chunk_encoder) + return att_outs diff --git a/funasr/models/sanm/decoder.py b/funasr/models/sanm/decoder.py new file mode 100644 index 0000000..1a4fb26 --- /dev/null +++ b/funasr/models/sanm/decoder.py @@ -0,0 +1,498 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from typing import List +from typing import Tuple +import logging +import torch +import torch.nn as nn +import numpy as np + +from funasr.models.scama import utils as myutils +from funasr.models.transformer.decoder import BaseTransformerDecoder + +from funasr.models.sanm.attention import ( + MultiHeadedAttentionSANMDecoder, + MultiHeadedAttentionCrossAtt, +) +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.sanm.positionwise_feed_forward import PositionwiseFeedForwardDecoderSANM +from funasr.models.transformer.utils.repeat import repeat + +from funasr.register import tables + + +class DecoderLayerSANM(nn.Module): + """Single decoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + src_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + + """ + + def __init__( + self, + size, + self_attn, + src_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an DecoderLayer object.""" + super(DecoderLayerSANM, self).__init__() + self.size = size + self.self_attn = self_attn + self.src_attn = src_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + if self_attn is not None: + self.norm2 = LayerNorm(size) + if src_attn is not None: + self.norm3 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = nn.Linear(size + size, size) + self.concat_linear2 = nn.Linear(size + size, size) + + def forward(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + # tgt = self.dropout(tgt) + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + x, _ = self.self_attn(tgt, tgt_mask) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x = residual + self.dropout(self.src_attn(x, memory, memory_mask)) + + return x, tgt_mask, memory, memory_mask, cache + + def forward_one_step(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + # tgt = self.dropout(tgt) + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + if self.training: + cache = None + x, cache = self.self_attn(tgt, tgt_mask, cache=cache) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x = residual + self.dropout(self.src_attn(x, memory, memory_mask)) + + return x, tgt_mask, memory, memory_mask, cache + + def forward_chunk( + self, tgt, memory, fsmn_cache=None, opt_cache=None, chunk_size=None, look_back=0 + ): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + x, fsmn_cache = self.self_attn(tgt, None, fsmn_cache) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x, opt_cache = self.src_attn.forward_chunk(x, memory, opt_cache, chunk_size, look_back) + x = residual + x + + return x, memory, fsmn_cache, opt_cache + + +@tables.register("decoder_classes", "FsmnDecoder") +class FsmnDecoder(BaseTransformerDecoder): + """ + Author: Zhifu Gao, Shiliang Zhang, Ming Lei, Ian McLoughlin + San-m: Memory equipped self-attention for end-to-end speech recognition + https://arxiv.org/abs/2006.01713 + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + att_layer_num: int = 6, + kernel_size: int = 21, + sanm_shfit: int = None, + concat_embeds: bool = False, + attention_dim: int = None, + tf2torch_tensor_name_prefix_torch: str = "decoder", + tf2torch_tensor_name_prefix_tf: str = "seq2seq/decoder", + embed_tensor_name_prefix_tf: str = None, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + if attention_dim is None: + attention_dim = encoder_output_size + + if input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(vocab_size, attention_dim), + ) + elif input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(vocab_size, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + else: + raise ValueError(f"only 'embed' or 'linear' is supported: {input_layer}") + + self.normalize_before = normalize_before + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + if use_output_layer: + self.output_layer = torch.nn.Linear(attention_dim, vocab_size) + else: + self.output_layer = None + + self.att_layer_num = att_layer_num + self.num_blocks = num_blocks + if sanm_shfit is None: + sanm_shfit = (kernel_size - 1) // 2 + self.decoders = repeat( + att_layer_num, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, self_attention_dropout_rate, kernel_size, sanm_shfit=sanm_shfit + ), + MultiHeadedAttentionCrossAtt( + attention_heads, + attention_dim, + src_attention_dropout_rate, + encoder_output_size=encoder_output_size, + ), + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if num_blocks - att_layer_num <= 0: + self.decoders2 = None + else: + self.decoders2 = repeat( + num_blocks - att_layer_num, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, + self_attention_dropout_rate, + kernel_size, + sanm_shfit=sanm_shfit, + ), + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + self.decoders3 = repeat( + 1, + lambda lnum: DecoderLayerSANM( + attention_dim, + None, + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if concat_embeds: + self.embed_concat_ffn = repeat( + 1, + lambda lnum: DecoderLayerSANM( + attention_dim + encoder_output_size, + None, + None, + PositionwiseFeedForwardDecoderSANM( + attention_dim + encoder_output_size, + linear_units, + dropout_rate, + adim=attention_dim, + ), + dropout_rate, + normalize_before, + concat_after, + ), + ) + else: + self.embed_concat_ffn = None + self.concat_embeds = concat_embeds + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + self.embed_tensor_name_prefix_tf = embed_tensor_name_prefix_tf + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + chunk_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + if chunk_mask is not None: + memory_mask = memory_mask * chunk_mask + if tgt_mask.size(1) != memory_mask.size(1): + memory_mask = torch.cat((memory_mask, memory_mask[:, -2:-1, :]), dim=1) + + x = self.embed(tgt) + + if pre_acoustic_embeds is not None and self.concat_embeds: + x = torch.cat((x, pre_acoustic_embeds), dim=-1) + x, _, _, _, _ = self.embed_concat_ffn(x, None, None, None, None) + + x, tgt_mask, memory, memory_mask, _ = self.decoders(x, tgt_mask, memory, memory_mask) + if self.decoders2 is not None: + x, tgt_mask, memory, memory_mask, _ = self.decoders2(x, tgt_mask, memory, memory_mask) + x, tgt_mask, memory, memory_mask, _ = self.decoders3(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + return x, olens + + def score( + self, + ys, + state, + x, + x_mask=None, + pre_acoustic_embeds: torch.Tensor = None, + ): + """Score.""" + ys_mask = myutils.sequence_mask( + torch.tensor([len(ys)], dtype=torch.int32), device=x.device + )[:, :, None] + logp, state = self.forward_one_step( + ys.unsqueeze(0), + ys_mask, + x.unsqueeze(0), + memory_mask=x_mask, + pre_acoustic_embeds=pre_acoustic_embeds, + cache=state, + ) + return logp.squeeze(0), state + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + memory_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + """ + + x = tgt[:, -1:] + tgt_mask = None + x = self.embed(x) + + if pre_acoustic_embeds is not None and self.concat_embeds: + x = torch.cat((x, pre_acoustic_embeds), dim=-1) + x, _, _, _, _ = self.embed_concat_ffn(x, None, None, None, None) + + if cache is None: + cache_layer_num = len(self.decoders) + if self.decoders2 is not None: + cache_layer_num += len(self.decoders2) + cache = [None] * cache_layer_num + new_cache = [] + # for c, decoder in zip(cache, self.decoders): + for i in range(self.att_layer_num): + decoder = self.decoders[i] + c = cache[i] + x, tgt_mask, memory, memory_mask, c_ret = decoder.forward_one_step( + x, tgt_mask, memory, memory_mask, cache=c + ) + new_cache.append(c_ret) + + if self.num_blocks - self.att_layer_num >= 1: + for i in range(self.num_blocks - self.att_layer_num): + j = i + self.att_layer_num + decoder = self.decoders2[i] + c = cache[j] + x, tgt_mask, memory, memory_mask, c_ret = decoder.forward_one_step( + x, tgt_mask, memory, memory_mask, cache=c + ) + new_cache.append(c_ret) + + for decoder in self.decoders3: + x, tgt_mask, memory, memory_mask, _ = decoder.forward_one_step( + x, tgt_mask, memory, None, cache=None + ) + + if self.normalize_before: + y = self.after_norm(x[:, -1]) + else: + y = x[:, -1] + if self.output_layer is not None: + y = self.output_layer(y) + y = torch.log_softmax(y, dim=-1) + + return y, new_cache diff --git a/funasr/models/sanm/encoder.py b/funasr/models/sanm/encoder.py new file mode 100644 index 0000000..dc30a94 --- /dev/null +++ b/funasr/models/sanm/encoder.py @@ -0,0 +1,604 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from typing import List +from typing import Optional +from typing import Sequence +from typing import Tuple +from typing import Union +import logging +import torch +import torch.nn as nn +import torch.nn.functional as F + +import numpy as np +from funasr.train_utils.device_funcs import to_device +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.sanm.attention import MultiHeadedAttention, MultiHeadedAttentionSANM +from funasr.models.transformer.embedding import ( + SinusoidalPositionEncoder, + StreamSinusoidalPositionEncoder, +) +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling2 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling6 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling8 +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.utils.subsampling import check_short_utt + + +from funasr.models.ctc.ctc import CTC + +from funasr.register import tables + + +class EncoderLayerSANM(nn.Module): + def __init__( + self, + in_size, + size, + self_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayerSANM, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(in_size) + self.norm2 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.in_size = in_size + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + self.dropout_rate = dropout_rate + + def forward(self, x, mask, cache=None, mask_shfit_chunk=None, mask_att_chunk_encoder=None): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + return x, mask + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if self.concat_after: + x_concat = torch.cat( + ( + x, + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ), + ), + dim=-1, + ) + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = stoch_layer_coeff * self.concat_linear(x_concat) + else: + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.dropout( + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ) + ) + else: + x = stoch_layer_coeff * self.dropout( + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ) + ) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + stoch_layer_coeff * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm2(x) + + return x, mask, cache, mask_shfit_chunk, mask_att_chunk_encoder + + def forward_chunk(self, x, cache=None, chunk_size=None, look_back=0): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if self.in_size == self.size: + attn, cache = self.self_attn.forward_chunk(x, cache, chunk_size, look_back) + x = residual + attn + else: + x, cache = self.self_attn.forward_chunk(x, cache, chunk_size, look_back) + + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + self.feed_forward(x) + if not self.normalize_before: + x = self.norm2(x) + + return x, cache + + +@tables.register("encoder_classes", "SANMEncoder") +class SANMEncoder(nn.Module): + """ + Author: Zhifu Gao, Shiliang Zhang, Ming Lei, Ian McLoughlin + San-m: Memory equipped self-attention for end-to-end speech recognition + https://arxiv.org/abs/2006.01713 + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: Optional[str] = "conv2d", + pos_enc_class=SinusoidalPositionEncoder, + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 1, + padding_idx: int = -1, + interctc_layer_idx: List[int] = [], + interctc_use_conditioning: bool = False, + kernel_size: int = 11, + sanm_shfit: int = 0, + lora_list: List[str] = None, + lora_rank: int = 8, + lora_alpha: int = 16, + lora_dropout: float = 0.1, + selfattention_layer_type: str = "sanm", + tf2torch_tensor_name_prefix_torch: str = "encoder", + tf2torch_tensor_name_prefix_tf: str = "seq2seq/encoder", + ): + super().__init__() + self._output_size = output_size + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling(input_size, output_size, dropout_rate) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2(input_size, output_size, dropout_rate) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6(input_size, output_size, dropout_rate) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8(input_size, output_size, dropout_rate) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + SinusoidalPositionEncoder(), + ) + elif input_layer is None: + if input_size == output_size: + self.embed = None + else: + self.embed = torch.nn.Linear(input_size, output_size) + elif input_layer == "pe": + self.embed = SinusoidalPositionEncoder() + elif input_layer == "pe_online": + self.embed = StreamSinusoidalPositionEncoder() + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + + if selfattention_layer_type == "selfattn": + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + + elif selfattention_layer_type == "sanm": + encoder_selfattn_layer = MultiHeadedAttentionSANM + encoder_selfattn_layer_args0 = ( + attention_heads, + input_size, + output_size, + attention_dropout_rate, + kernel_size, + sanm_shfit, + lora_list, + lora_rank, + lora_alpha, + lora_dropout, + ) + + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + output_size, + attention_dropout_rate, + kernel_size, + sanm_shfit, + lora_list, + lora_rank, + lora_alpha, + lora_dropout, + ) + self.encoders0 = repeat( + 1, + lambda lnum: EncoderLayerSANM( + input_size, + output_size, + encoder_selfattn_layer(*encoder_selfattn_layer_args0), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + self.encoders = repeat( + num_blocks - 1, + lambda lnum: EncoderLayerSANM( + output_size, + output_size, + encoder_selfattn_layer(*encoder_selfattn_layer_args), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + + self.interctc_layer_idx = interctc_layer_idx + if len(interctc_layer_idx) > 0: + assert 0 < min(interctc_layer_idx) and max(interctc_layer_idx) < num_blocks + self.interctc_use_conditioning = interctc_use_conditioning + self.conditioning_layer = None + self.dropout = nn.Dropout(dropout_rate) + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ctc: CTC = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Embed positions in tensor. + + Args: + xs_pad: input tensor (B, L, D) + ilens: input length (B) + prev_states: Not to be used now. + Returns: + position embedded tensor and mask + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + xs_pad = xs_pad * self.output_size() ** 0.5 + if self.embed is None: + xs_pad = xs_pad + elif ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + + # xs_pad = self.dropout(xs_pad) + encoder_outs = self.encoders0(xs_pad, masks) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + intermediate_outs = [] + if len(self.interctc_layer_idx) == 0: + encoder_outs = self.encoders(xs_pad, masks) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + else: + for layer_idx, encoder_layer in enumerate(self.encoders): + encoder_outs = encoder_layer(xs_pad, masks) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + + if layer_idx + 1 in self.interctc_layer_idx: + encoder_out = xs_pad + + # intermediate outputs are also normalized + if self.normalize_before: + encoder_out = self.after_norm(encoder_out) + + intermediate_outs.append((layer_idx + 1, encoder_out)) + + if self.interctc_use_conditioning: + ctc_out = ctc.softmax(encoder_out) + xs_pad = xs_pad + self.conditioning_layer(ctc_out) + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + olens = masks.squeeze(1).sum(1) + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), olens, None + return xs_pad, olens, None + + def _add_overlap_chunk(self, feats: np.ndarray, cache: dict = {}): + if len(cache) == 0: + return feats + cache["feats"] = to_device(cache["feats"], device=feats.device) + overlap_feats = torch.cat((cache["feats"], feats), dim=1) + cache["feats"] = overlap_feats[:, -(cache["chunk_size"][0] + cache["chunk_size"][2]) :, :] + return overlap_feats + + def forward_chunk( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + cache: dict = None, + ctc: CTC = None, + ): + xs_pad *= self.output_size() ** 0.5 + if self.embed is None: + xs_pad = xs_pad + else: + xs_pad = self.embed(xs_pad, cache) + if cache["tail_chunk"]: + xs_pad = to_device(cache["feats"], device=xs_pad.device) + else: + xs_pad = self._add_overlap_chunk(xs_pad, cache) + encoder_outs = self.encoders0(xs_pad, None, None, None, None) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + intermediate_outs = [] + if len(self.interctc_layer_idx) == 0: + encoder_outs = self.encoders(xs_pad, None, None, None, None) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + else: + for layer_idx, encoder_layer in enumerate(self.encoders): + encoder_outs = encoder_layer(xs_pad, None, None, None, None) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + if layer_idx + 1 in self.interctc_layer_idx: + encoder_out = xs_pad + + # intermediate outputs are also normalized + if self.normalize_before: + encoder_out = self.after_norm(encoder_out) + + intermediate_outs.append((layer_idx + 1, encoder_out)) + + if self.interctc_use_conditioning: + ctc_out = ctc.softmax(encoder_out) + xs_pad = xs_pad + self.conditioning_layer(ctc_out) + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), None, None + return xs_pad, ilens, None + + +class EncoderLayerSANMExport(nn.Module): + def __init__( + self, + model, + ): + """Construct an EncoderLayer object.""" + super().__init__() + self.self_attn = model.self_attn + self.feed_forward = model.feed_forward + self.norm1 = model.norm1 + self.norm2 = model.norm2 + self.in_size = model.in_size + self.size = model.size + + def forward(self, x, mask): + + residual = x + x = self.norm1(x) + x = self.self_attn(x, mask) + if self.in_size == self.size: + x = x + residual + residual = x + x = self.norm2(x) + x = self.feed_forward(x) + x = x + residual + + return x, mask + + +@tables.register("encoder_classes", "SANMEncoderChunkOptExport") +@tables.register("encoder_classes", "SANMEncoderExport") +class SANMEncoderExport(nn.Module): + def __init__( + self, + model, + max_seq_len=512, + feats_dim=560, + model_name="encoder", + onnx: bool = True, + ): + super().__init__() + self.embed = model.embed + if isinstance(self.embed, StreamSinusoidalPositionEncoder): + self.embed = None + self.model = model + self.feats_dim = feats_dim + self._output_size = model._output_size + + from funasr.utils.torch_function import sequence_mask + + self.make_pad_mask = sequence_mask(max_seq_len, flip=False) + + from funasr.models.sanm.attention import MultiHeadedAttentionSANMExport + + if hasattr(model, "encoders0"): + for i, d in enumerate(self.model.encoders0): + if isinstance(d.self_attn, MultiHeadedAttentionSANM): + d.self_attn = MultiHeadedAttentionSANMExport(d.self_attn) + self.model.encoders0[i] = EncoderLayerSANMExport(d) + + for i, d in enumerate(self.model.encoders): + if isinstance(d.self_attn, MultiHeadedAttentionSANM): + d.self_attn = MultiHeadedAttentionSANMExport(d.self_attn) + self.model.encoders[i] = EncoderLayerSANMExport(d) + + self.model_name = model_name + self.num_heads = model.encoders[0].self_attn.h + self.hidden_size = model.encoders[0].self_attn.linear_out.out_features + + def prepare_mask(self, mask): + mask_3d_btd = mask[:, :, None] + if len(mask.shape) == 2: + mask_4d_bhlt = 1 - mask[:, None, None, :] + elif len(mask.shape) == 3: + mask_4d_bhlt = 1 - mask[:, None, :] + mask_4d_bhlt = mask_4d_bhlt * -10000.0 + + return mask_3d_btd, mask_4d_bhlt + + def forward(self, speech: torch.Tensor, speech_lengths: torch.Tensor, online: bool = False): + if not online: + speech = speech * self._output_size**0.5 + mask = self.make_pad_mask(speech_lengths) + mask = self.prepare_mask(mask) + if self.embed is None: + xs_pad = speech + else: + xs_pad = self.embed(speech) + + encoder_outs = self.model.encoders0(xs_pad, mask) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + + encoder_outs = self.model.encoders(xs_pad, mask) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + + xs_pad = self.model.after_norm(xs_pad) + + return xs_pad, speech_lengths + + def get_output_size(self): + return self.model.encoders[0].size + + def get_dummy_inputs(self): + feats = torch.randn(1, 100, self.feats_dim) + return feats + + def get_input_names(self): + return ["feats"] + + def get_output_names(self): + return ["encoder_out", "encoder_out_lens", "predictor_weight"] + + def get_dynamic_axes(self): + return { + "feats": {1: "feats_length"}, + "encoder_out": {1: "enc_out_length"}, + "predictor_weight": {1: "pre_out_length"}, + } diff --git a/funasr/models/sanm/model.py b/funasr/models/sanm/model.py new file mode 100644 index 0000000..b3f84b2 --- /dev/null +++ b/funasr/models/sanm/model.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import logging + +import torch + +from funasr.models.transformer.model import Transformer +from funasr.register import tables + + +@tables.register("model_classes", "SANM") +class SANM(Transformer): + """ + Author: Zhifu Gao, Shiliang Zhang, Ming Lei, Ian McLoughlin + San-m: Memory equipped self-attention for end-to-end speech recognition + https://arxiv.org/abs/2006.01713 + """ + + def __init__( + self, + *args, + **kwargs, + ): + + super().__init__(*args, **kwargs) diff --git a/funasr/models/sanm/multihead_att.py b/funasr/models/sanm/multihead_att.py new file mode 100644 index 0000000..c7d9796 --- /dev/null +++ b/funasr/models/sanm/multihead_att.py @@ -0,0 +1,241 @@ +import os +import math + +import torch +import torch.nn as nn + + +class MultiHeadedAttentionSANMExport(nn.Module): + def __init__(self, model): + super().__init__() + self.d_k = model.d_k + self.h = model.h + self.linear_out = model.linear_out + self.linear_q_k_v = model.linear_q_k_v + self.fsmn_block = model.fsmn_block + self.pad_fn = model.pad_fn + + self.attn = None + self.all_head_size = self.h * self.d_k + + def forward(self, x, mask): + mask_3d_btd, mask_4d_bhlt = mask + q_h, k_h, v_h, v = self.forward_qkv(x) + fsmn_memory = self.forward_fsmn(v, mask_3d_btd) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, mask_4d_bhlt) + return att_outs + fsmn_memory + + def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: + new_x_shape = x.size()[:-1] + (self.h, self.d_k) + x = x.view(new_x_shape) + return x.permute(0, 2, 1, 3) + + def forward_qkv(self, x): + q_k_v = self.linear_q_k_v(x) + q, k, v = torch.split(q_k_v, int(self.h * self.d_k), dim=-1) + q_h = self.transpose_for_scores(q) + k_h = self.transpose_for_scores(k) + v_h = self.transpose_for_scores(v) + return q_h, k_h, v_h, v + + def forward_fsmn(self, inputs, mask): + # b, t, d = inputs.size() + # mask = torch.reshape(mask, (b, -1, 1)) + inputs = inputs * mask + x = inputs.transpose(1, 2) + x = self.pad_fn(x) + x = self.fsmn_block(x) + x = x.transpose(1, 2) + x = x + inputs + x = x * mask + return x + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) + + +def preprocess_for_attn(x, mask, cache, pad_fn, kernel_size): + x = x * mask + x = x.transpose(1, 2) + if cache is None: + x = pad_fn(x) + else: + x = torch.cat((cache, x), dim=2) + cache = x[:, :, -(kernel_size - 1) :] + return x, cache + + +torch_version = tuple([int(i) for i in torch.__version__.split(".")[:2]]) +if torch_version >= (1, 8): + import torch.fx + + torch.fx.wrap("preprocess_for_attn") + + +class MultiHeadedAttentionSANMDecoderExport(nn.Module): + def __init__(self, model): + super().__init__() + self.fsmn_block = model.fsmn_block + self.pad_fn = model.pad_fn + self.kernel_size = model.kernel_size + self.attn = None + + def forward(self, inputs, mask, cache=None): + x, cache = preprocess_for_attn(inputs, mask, cache, self.pad_fn, self.kernel_size) + x = self.fsmn_block(x) + x = x.transpose(1, 2) + + x = x + inputs + x = x * mask + return x, cache + + +class MultiHeadedAttentionCrossAttExport(nn.Module): + def __init__(self, model): + super().__init__() + self.d_k = model.d_k + self.h = model.h + self.linear_q = model.linear_q + self.linear_k_v = model.linear_k_v + self.linear_out = model.linear_out + self.attn = None + self.all_head_size = self.h * self.d_k + + def forward(self, x, memory, memory_mask): + q, k, v = self.forward_qkv(x, memory) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, memory_mask) + + def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: + new_x_shape = x.size()[:-1] + (self.h, self.d_k) + x = x.view(new_x_shape) + return x.permute(0, 2, 1, 3) + + def forward_qkv(self, x, memory): + q = self.linear_q(x) + + k_v = self.linear_k_v(memory) + k, v = torch.split(k_v, int(self.h * self.d_k), dim=-1) + q = self.transpose_for_scores(q) + k = self.transpose_for_scores(k) + v = self.transpose_for_scores(v) + return q, k, v + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) + + +class OnnxMultiHeadedAttention(nn.Module): + def __init__(self, model): + super().__init__() + self.d_k = model.d_k + self.h = model.h + self.linear_q = model.linear_q + self.linear_k = model.linear_k + self.linear_v = model.linear_v + self.linear_out = model.linear_out + self.attn = None + self.all_head_size = self.h * self.d_k + + def forward(self, query, key, value, mask): + q, k, v = self.forward_qkv(query, key, value) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, mask) + + def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: + new_x_shape = x.size()[:-1] + (self.h, self.d_k) + x = x.view(new_x_shape) + return x.permute(0, 2, 1, 3) + + def forward_qkv(self, query, key, value): + q = self.linear_q(query) + k = self.linear_k(key) + v = self.linear_v(value) + q = self.transpose_for_scores(q) + k = self.transpose_for_scores(k) + v = self.transpose_for_scores(v) + return q, k, v + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) + + +class OnnxRelPosMultiHeadedAttention(OnnxMultiHeadedAttention): + def __init__(self, model): + super().__init__(model) + self.linear_pos = model.linear_pos + self.pos_bias_u = model.pos_bias_u + self.pos_bias_v = model.pos_bias_v + + def forward(self, query, key, value, pos_emb, mask): + q, k, v = self.forward_qkv(query, key, value) + q = q.transpose(1, 2) # (batch, time1, head, d_k) + + p = self.transpose_for_scores(self.linear_pos(pos_emb)) # (batch, head, time1, d_k) + + # (batch, head, time1, d_k) + q_with_bias_u = (q + self.pos_bias_u).transpose(1, 2) + # (batch, head, time1, d_k) + q_with_bias_v = (q + self.pos_bias_v).transpose(1, 2) + + # compute attention score + # first compute matrix a and matrix c + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + # (batch, head, time1, time2) + matrix_ac = torch.matmul(q_with_bias_u, k.transpose(-2, -1)) + + # compute matrix b and matrix d + # (batch, head, time1, time1) + matrix_bd = torch.matmul(q_with_bias_v, p.transpose(-2, -1)) + matrix_bd = self.rel_shift(matrix_bd) + + scores = (matrix_ac + matrix_bd) / math.sqrt(self.d_k) # (batch, head, time1, time2) + + return self.forward_attention(v, scores, mask) + + def rel_shift(self, x): + zero_pad = torch.zeros((*x.size()[:3], 1), device=x.device, dtype=x.dtype) + x_padded = torch.cat([zero_pad, x], dim=-1) + + x_padded = x_padded.view(*x.size()[:2], x.size(3) + 1, x.size(2)) + x = x_padded[:, :, 1:].view_as(x)[ + :, :, :, : x.size(-1) // 2 + 1 + ] # only keep the positions from 0 to time2 + return x + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) diff --git a/funasr/models/sanm/positionwise_feed_forward.py b/funasr/models/sanm/positionwise_feed_forward.py new file mode 100644 index 0000000..e28ba88 --- /dev/null +++ b/funasr/models/sanm/positionwise_feed_forward.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + + +"""Positionwise feed forward layer definition.""" + +import torch + +from funasr.models.transformer.layer_norm import LayerNorm + + +class PositionwiseFeedForwardDecoderSANM(torch.nn.Module): + """Positionwise feed forward layer. + + Args: + idim (int): Input dimenstion. + hidden_units (int): The number of hidden units. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, idim, hidden_units, dropout_rate, adim=None, activation=torch.nn.ReLU()): + """Construct an PositionwiseFeedForward object.""" + super(PositionwiseFeedForwardDecoderSANM, self).__init__() + self.w_1 = torch.nn.Linear(idim, hidden_units) + self.w_2 = torch.nn.Linear(hidden_units, idim if adim is None else adim, bias=False) + self.dropout = torch.nn.Dropout(dropout_rate) + self.activation = activation + self.norm = LayerNorm(hidden_units) + + def forward(self, x): + """Forward function.""" + return self.w_2(self.norm(self.dropout(self.activation(self.w_1(x))))) diff --git a/funasr/models/sanm/template.yaml b/funasr/models/sanm/template.yaml new file mode 100644 index 0000000..316fe75 --- /dev/null +++ b/funasr/models/sanm/template.yaml @@ -0,0 +1,121 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: SANM +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + +# encoder +encoder: SANMEncoder +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + +# decoder +decoder: FsmnDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 0 + + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + avg_nbest_model: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true + +normalize: null diff --git a/funasr/models/scama/__init__.py b/funasr/models/scama/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/scama/beam_search.py b/funasr/models/scama/beam_search.py new file mode 100644 index 0000000..259f483 --- /dev/null +++ b/funasr/models/scama/beam_search.py @@ -0,0 +1,978 @@ +"""Beam search module.""" + +from itertools import chain +import logging +from typing import Any +from typing import Dict +from typing import List +from typing import NamedTuple +from typing import Tuple +from typing import Union + +import torch + +from funasr.metrics.common import end_detect +from funasr.models.transformer.scorers.scorer_interface import PartialScorerInterface +from funasr.models.transformer.scorers.scorer_interface import ScorerInterface + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: torch.Tensor + score: Union[float, torch.Tensor] = 0 + scores: Dict[str, Union[float, torch.Tensor]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +class BeamSearchScama(torch.nn.Module): + """Beam search implementation.""" + + def __init__( + self, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + beam_size: int, + vocab_size: int, + sos: int, + eos: int, + token_list: List[str] = None, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = None, + ): + """Initialize beam search. + + Args: + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + sos (int): Start of sequence id + eos (int): End of sequence id + token_list (list[str]): List of tokens for debug log + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + """ + super().__init__() + # set scorers + self.weights = weights + self.scorers = dict() + self.full_scorers = dict() + self.part_scorers = dict() + # this module dict is required for recursive cast + # `self.to(device, dtype)` in `recog.py` + self.nn_dict = torch.nn.ModuleDict() + for k, v in scorers.items(): + w = weights.get(k, 0) + if w == 0 or v is None: + continue + assert isinstance( + v, ScorerInterface + ), f"{k} ({type(v)}) does not implement ScorerInterface" + self.scorers[k] = v + if isinstance(v, PartialScorerInterface): + self.part_scorers[k] = v + else: + self.full_scorers[k] = v + if isinstance(v, torch.nn.Module): + self.nn_dict[k] = v + + # set configurations + self.sos = sos + self.eos = eos + self.token_list = token_list + self.pre_beam_size = int(pre_beam_ratio * beam_size) + self.beam_size = beam_size + self.n_vocab = vocab_size + if ( + pre_beam_score_key is not None + and pre_beam_score_key != "full" + and pre_beam_score_key not in self.full_scorers + ): + raise KeyError(f"{pre_beam_score_key} is not found in {self.full_scorers}") + self.pre_beam_score_key = pre_beam_score_key + self.do_pre_beam = ( + self.pre_beam_score_key is not None + and self.pre_beam_size < self.n_vocab + and len(self.part_scorers) > 0 + ) + + def init_hyp(self, x: torch.Tensor) -> List[Hypothesis]: + """Get an initial hypothesis data. + + Args: + x (torch.Tensor): The encoder output feature + + Returns: + Hypothesis: The initial hypothesis. + + """ + init_states = dict() + init_scores = dict() + for k, d in self.scorers.items(): + init_states[k] = d.init_state(x) + init_scores[k] = 0.0 + return [ + Hypothesis( + score=0.0, + scores=init_scores, + states=init_states, + yseq=torch.tensor([self.sos], device=x.device), + ) + ] + + @staticmethod + def append_token(xs: torch.Tensor, x: int) -> torch.Tensor: + """Append new token to prefix tokens. + + Args: + xs (torch.Tensor): The prefix token + x (int): The new token to append + + Returns: + torch.Tensor: New tensor contains: xs + [x] with xs.dtype and xs.device + + """ + x = torch.tensor([x], dtype=xs.dtype, device=xs.device) + return torch.cat((xs, x)) + + def score_full( + self, + hyp: Hypothesis, + x: torch.Tensor, + x_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.full_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.full_scorers` + and tensor score values of shape: `(self.n_vocab,)`, + and state dict that has string keys + and state values of `self.full_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.full_scorers.items(): + scores[k], states[k] = d.score( + hyp.yseq, hyp.states[k], x, x_mask=x_mask, pre_acoustic_embeds=pre_acoustic_embeds + ) + return scores, states + + def score_partial( + self, hyp: Hypothesis, ids: torch.Tensor, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.part_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + ids (torch.Tensor): 1D tensor of new partial tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.part_scorers` + and tensor score values of shape: `(len(ids),)`, + and state dict that has string keys + and state values of `self.part_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.part_scorers.items(): + scores[k], states[k] = d.score_partial(hyp.yseq, ids, hyp.states[k], x) + return scores, states + + def beam( + self, weighted_scores: torch.Tensor, ids: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute topk full token ids and partial token ids. + + Args: + weighted_scores (torch.Tensor): The weighted sum scores for each tokens. + Its shape is `(self.n_vocab,)`. + ids (torch.Tensor): The partial token ids to compute topk + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + The topk full token ids and partial token ids. + Their shapes are `(self.beam_size,)` + + """ + # no pre beam performed + if weighted_scores.size(0) == ids.size(0): + top_ids = weighted_scores.topk(self.beam_size)[1] + return top_ids, top_ids + + # mask pruned in pre-beam not to select in topk + tmp = weighted_scores[ids] + weighted_scores[:] = -float("inf") + weighted_scores[ids] = tmp + top_ids = weighted_scores.topk(self.beam_size)[1] + local_ids = weighted_scores[ids].topk(self.beam_size)[1] + return top_ids, local_ids + + @staticmethod + def merge_scores( + prev_scores: Dict[str, float], + next_full_scores: Dict[str, torch.Tensor], + full_idx: int, + next_part_scores: Dict[str, torch.Tensor], + part_idx: int, + ) -> Dict[str, torch.Tensor]: + """Merge scores for new hypothesis. + + Args: + prev_scores (Dict[str, float]): + The previous hypothesis scores by `self.scorers` + next_full_scores (Dict[str, torch.Tensor]): scores by `self.full_scorers` + full_idx (int): The next token id for `next_full_scores` + next_part_scores (Dict[str, torch.Tensor]): + scores of partial tokens by `self.part_scorers` + part_idx (int): The new token id for `next_part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are scalar tensors by the scorers. + + """ + new_scores = dict() + for k, v in next_full_scores.items(): + new_scores[k] = prev_scores[k] + v[full_idx] + for k, v in next_part_scores.items(): + new_scores[k] = prev_scores[k] + v[part_idx] + return new_scores + + def merge_states(self, states: Any, part_states: Any, part_idx: int) -> Any: + """Merge states for new hypothesis. + + Args: + states: states of `self.full_scorers` + part_states: states of `self.part_scorers` + part_idx (int): The new token id for `part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are states of the scorers. + + """ + new_states = dict() + for k, v in states.items(): + new_states[k] = v + for k, d in self.part_scorers.items(): + new_states[k] = d.select_state(part_states[k], part_idx) + return new_states + + def search( + self, + running_hyps: List[Hypothesis], + x: torch.Tensor, + x_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + ) -> List[Hypothesis]: + """Search new tokens for running hypotheses and encoded speech x. + + Args: + running_hyps (List[Hypothesis]): Running hypotheses on beam + x (torch.Tensor): Encoded speech feature (T, D) + + Returns: + List[Hypotheses]: Best sorted hypotheses + + """ + best_hyps = [] + part_ids = torch.arange(self.n_vocab, device=x.device) # no pre-beam + for hyp in running_hyps: + # scoring + weighted_scores = torch.zeros(self.n_vocab, dtype=x.dtype, device=x.device) + scores, states = self.score_full( + hyp, x, x_mask=x_mask, pre_acoustic_embeds=pre_acoustic_embeds + ) + for k in self.full_scorers: + weighted_scores += self.weights[k] * scores[k] + # partial scoring + if self.do_pre_beam: + pre_beam_scores = ( + weighted_scores + if self.pre_beam_score_key == "full" + else scores[self.pre_beam_score_key] + ) + part_ids = torch.topk(pre_beam_scores, self.pre_beam_size)[1] + part_scores, part_states = self.score_partial(hyp, part_ids, x) + for k in self.part_scorers: + weighted_scores[part_ids] += self.weights[k] * part_scores[k] + # add previous hyp score + weighted_scores += hyp.score + + # update hyps + for j, part_j in zip(*self.beam(weighted_scores, part_ids)): + # will be (2 x beam at most) + best_hyps.append( + Hypothesis( + score=weighted_scores[j], + yseq=self.append_token(hyp.yseq, j), + scores=self.merge_scores(hyp.scores, scores, j, part_scores, part_j), + states=self.merge_states(states, part_states, part_j), + ) + ) + + # sort and prune 2 x beam -> beam + best_hyps = sorted(best_hyps, key=lambda x: x.score, reverse=True)[ + : min(len(best_hyps), self.beam_size) + ] + return best_hyps + + def forward( + self, + x: torch.Tensor, + scama_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + maxlenratio: float = 0.0, + minlenratio: float = 0.0, + maxlen: int = None, + minlen: int = 0, + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + If maxlenratio<0.0, its absolute value is interpreted + as a constant max output length. + minlenratio (float): Input length ratio to obtain min output length. + + Returns: + list[Hypothesis]: N-best decoding results + + """ + if maxlen is None: + # set length bounds + if maxlenratio == 0: + maxlen = x.shape[0] + elif maxlenratio < 0: + maxlen = -1 * int(maxlenratio) + else: + maxlen = max(1, int(maxlenratio * x.size(0))) + minlen = int(minlenratio * x.size(0)) + + logging.info("decoder input length: " + str(x.shape[0])) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # main loop of prefix search + running_hyps = self.init_hyp(x) + ended_hyps = [] + for i in range(maxlen): + logging.debug("position " + str(i)) + mask_enc = None + if scama_mask is not None: + token_num_predictor = scama_mask.size(1) + token_id_slice = min(i, token_num_predictor - 1) + mask_enc = scama_mask[:, token_id_slice : token_id_slice + 1, :] + # if mask_enc.size(1) == 0: + # mask_enc = scama_mask[:, -2:-1, :] + # # mask_enc = torch.zeros_like(mask_enc) + pre_acoustic_embeds_cur = None + if pre_acoustic_embeds is not None: + b, t, d = pre_acoustic_embeds.size() + pad = torch.zeros((b, 1, d), dtype=pre_acoustic_embeds.dtype).to( + device=pre_acoustic_embeds.device + ) + pre_acoustic_embeds = torch.cat((pre_acoustic_embeds, pad), dim=1) + token_id_slice = min(i, t) + pre_acoustic_embeds_cur = pre_acoustic_embeds[ + :, token_id_slice : token_id_slice + 1, : + ] + + best = self.search( + running_hyps, x, x_mask=mask_enc, pre_acoustic_embeds=pre_acoustic_embeds_cur + ) + # post process of one iteration + running_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps) + # end detection + if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i): + logging.info(f"end detected at {i}") + break + if len(running_hyps) == 0: + logging.info("no hypothesis. Finish decoding.") + break + else: + logging.debug(f"remained hypotheses: {len(running_hyps)}") + + nbest_hyps = sorted(ended_hyps, key=lambda x: x.score, reverse=True) + # check the number of hypotheses reaching to eos + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, perform recognition " "again with smaller minlenratio." + ) + return ( + [] + if minlenratio < 0.1 + else self.forward(x, maxlenratio, max(0.0, minlenratio - 0.1)) + ) + + # report the best result + for x in nbest_hyps: + yseq = "".join([self.token_list[x] for x in x.yseq]) + logging.debug("nbest: y: {}, yseq: {}, score: {}".format(x.yseq, yseq, x.score)) + best = nbest_hyps[0] + for k, v in best.scores.items(): + logging.info(f"{v:6.2f} * {self.weights[k]:3} = {v * self.weights[k]:6.2f} for {k}") + logging.info(f"total log probability: {best.score:.2f}") + logging.info(f"normalized log probability: {best.score / len(best.yseq):.2f}") + logging.info(f"total number of ended hypotheses: {len(nbest_hyps)}") + if self.token_list is not None: + logging.info( + "best hypo: " + "".join([self.token_list[x] for x in best.yseq[1:-1]]) + "\n" + ) + return nbest_hyps + + def post_process( + self, + i: int, + maxlen: int, + maxlenratio: float, + running_hyps: List[Hypothesis], + ended_hyps: List[Hypothesis], + ) -> List[Hypothesis]: + """Perform post-processing of beam search iterations. + + Args: + i (int): The length of hypothesis tokens. + maxlen (int): The maximum length of tokens in beam search. + maxlenratio (int): The maximum length ratio in beam search. + running_hyps (List[Hypothesis]): The running hypotheses in beam search. + ended_hyps (List[Hypothesis]): The ended hypotheses in beam search. + + Returns: + List[Hypothesis]: The new running hypotheses. + + """ + logging.debug(f"the number of running hypotheses: {len(running_hyps)}") + if self.token_list is not None: + logging.debug( + "best hypo: " + "".join([self.token_list[x] for x in running_hyps[0].yseq[1:]]) + ) + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + running_hyps = [ + h._replace(yseq=self.append_token(h.yseq, self.eos)) for h in running_hyps + ] + + # add ended hypotheses to a final list, and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in running_hyps: + if hyp.yseq[-1] == self.eos: + # e.g., Word LM needs to add final score + for k, d in chain(self.full_scorers.items(), self.part_scorers.items()): + s = d.final_score(hyp.states[k]) + hyp.scores[k] += s + hyp = hyp._replace(score=hyp.score + self.weights[k] * s) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + return remained_hyps + + +class BeamSearchScamaStreaming(torch.nn.Module): + """Beam search implementation.""" + + def __init__( + self, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + beam_size: int, + vocab_size: int, + sos: int, + eos: int, + token_list: List[str] = None, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = None, + ): + """Initialize beam search. + + Args: + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + sos (int): Start of sequence id + eos (int): End of sequence id + token_list (list[str]): List of tokens for debug log + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + """ + super().__init__() + # set scorers + self.weights = weights + self.scorers = dict() + self.full_scorers = dict() + self.part_scorers = dict() + # this module dict is required for recursive cast + # `self.to(device, dtype)` in `recog.py` + self.nn_dict = torch.nn.ModuleDict() + for k, v in scorers.items(): + w = weights.get(k, 0) + if w == 0 or v is None: + continue + assert isinstance( + v, ScorerInterface + ), f"{k} ({type(v)}) does not implement ScorerInterface" + self.scorers[k] = v + if isinstance(v, PartialScorerInterface): + self.part_scorers[k] = v + else: + self.full_scorers[k] = v + if isinstance(v, torch.nn.Module): + self.nn_dict[k] = v + + # set configurations + self.sos = sos + self.eos = eos + self.token_list = token_list + self.pre_beam_size = int(pre_beam_ratio * beam_size) + self.beam_size = beam_size + self.n_vocab = vocab_size + if ( + pre_beam_score_key is not None + and pre_beam_score_key != "full" + and pre_beam_score_key not in self.full_scorers + ): + raise KeyError(f"{pre_beam_score_key} is not found in {self.full_scorers}") + self.pre_beam_score_key = pre_beam_score_key + self.do_pre_beam = ( + self.pre_beam_score_key is not None + and self.pre_beam_size < self.n_vocab + and len(self.part_scorers) > 0 + ) + + def init_hyp(self, x) -> List[Hypothesis]: + """Get an initial hypothesis data. + + Args: + x (torch.Tensor): The encoder output feature + + Returns: + Hypothesis: The initial hypothesis. + + """ + init_states = dict() + init_scores = dict() + for k, d in self.scorers.items(): + init_states[k] = d.init_state(x) + init_scores[k] = 0.0 + return [ + Hypothesis( + score=0.0, + scores=init_scores, + states=init_states, + yseq=torch.tensor([self.sos], device=x.device), + ) + ] + + @staticmethod + def append_token(xs: torch.Tensor, x: int) -> torch.Tensor: + """Append new token to prefix tokens. + + Args: + xs (torch.Tensor): The prefix token + x (int): The new token to append + + Returns: + torch.Tensor: New tensor contains: xs + [x] with xs.dtype and xs.device + + """ + x = torch.tensor([x], dtype=xs.dtype, device=xs.device) + return torch.cat((xs, x)) + + def score_full( + self, + hyp: Hypothesis, + x: torch.Tensor, + x_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + cache: dict = {}, + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.full_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.full_scorers` + and tensor score values of shape: `(self.n_vocab,)`, + and state dict that has string keys + and state values of `self.full_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.full_scorers.items(): + scores[k], states[k] = d.score( + hyp.yseq, + hyp.states[k], + x, + x_mask=x_mask, + pre_acoustic_embeds=pre_acoustic_embeds, + cache=cache, + ) + return scores, states + + def score_partial( + self, hyp: Hypothesis, ids: torch.Tensor, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.part_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + ids (torch.Tensor): 1D tensor of new partial tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.part_scorers` + and tensor score values of shape: `(len(ids),)`, + and state dict that has string keys + and state values of `self.part_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.part_scorers.items(): + scores[k], states[k] = d.score_partial(hyp.yseq, ids, hyp.states[k], x) + return scores, states + + def beam( + self, weighted_scores: torch.Tensor, ids: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute topk full token ids and partial token ids. + + Args: + weighted_scores (torch.Tensor): The weighted sum scores for each tokens. + Its shape is `(self.n_vocab,)`. + ids (torch.Tensor): The partial token ids to compute topk + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + The topk full token ids and partial token ids. + Their shapes are `(self.beam_size,)` + + """ + # no pre beam performed + if weighted_scores.size(0) == ids.size(0): + top_ids = weighted_scores.topk(self.beam_size)[1] + return top_ids, top_ids + + # mask pruned in pre-beam not to select in topk + tmp = weighted_scores[ids] + weighted_scores[:] = -float("inf") + weighted_scores[ids] = tmp + top_ids = weighted_scores.topk(self.beam_size)[1] + local_ids = weighted_scores[ids].topk(self.beam_size)[1] + return top_ids, local_ids + + @staticmethod + def merge_scores( + prev_scores: Dict[str, float], + next_full_scores: Dict[str, torch.Tensor], + full_idx: int, + next_part_scores: Dict[str, torch.Tensor], + part_idx: int, + ) -> Dict[str, torch.Tensor]: + """Merge scores for new hypothesis. + + Args: + prev_scores (Dict[str, float]): + The previous hypothesis scores by `self.scorers` + next_full_scores (Dict[str, torch.Tensor]): scores by `self.full_scorers` + full_idx (int): The next token id for `next_full_scores` + next_part_scores (Dict[str, torch.Tensor]): + scores of partial tokens by `self.part_scorers` + part_idx (int): The new token id for `next_part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are scalar tensors by the scorers. + + """ + new_scores = dict() + for k, v in next_full_scores.items(): + new_scores[k] = prev_scores[k] + v[full_idx] + for k, v in next_part_scores.items(): + new_scores[k] = prev_scores[k] + v[part_idx] + return new_scores + + def merge_states(self, states: Any, part_states: Any, part_idx: int) -> Any: + """Merge states for new hypothesis. + + Args: + states: states of `self.full_scorers` + part_states: states of `self.part_scorers` + part_idx (int): The new token id for `part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are states of the scorers. + + """ + new_states = dict() + for k, v in states.items(): + new_states[k] = v + for k, d in self.part_scorers.items(): + new_states[k] = d.select_state(part_states[k], part_idx) + return new_states + + def search( + self, + running_hyps: List[Hypothesis], + x: torch.Tensor, + x_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + cache: dict = {}, + ) -> List[Hypothesis]: + """Search new tokens for running hypotheses and encoded speech x. + + Args: + running_hyps (List[Hypothesis]): Running hypotheses on beam + x (torch.Tensor): Encoded speech feature (T, D) + + Returns: + List[Hypotheses]: Best sorted hypotheses + + """ + best_hyps = [] + part_ids = torch.arange(self.n_vocab, device=x.device) # no pre-beam + for hyp in running_hyps: + # scoring + weighted_scores = torch.zeros(self.n_vocab, dtype=x.dtype, device=x.device) + scores, states = self.score_full( + hyp, x, x_mask=x_mask, pre_acoustic_embeds=pre_acoustic_embeds, cache=cache + ) + for k in self.full_scorers: + weighted_scores += self.weights[k] * scores[k] + # partial scoring + if self.do_pre_beam: + pre_beam_scores = ( + weighted_scores + if self.pre_beam_score_key == "full" + else scores[self.pre_beam_score_key] + ) + part_ids = torch.topk(pre_beam_scores, self.pre_beam_size)[1] + part_scores, part_states = self.score_partial(hyp, part_ids, x) + for k in self.part_scorers: + weighted_scores[part_ids] += self.weights[k] * part_scores[k] + # add previous hyp score + weighted_scores += hyp.score + + # update hyps + for j, part_j in zip(*self.beam(weighted_scores, part_ids)): + # will be (2 x beam at most) + best_hyps.append( + Hypothesis( + score=weighted_scores[j], + yseq=self.append_token(hyp.yseq, j), + scores=self.merge_scores(hyp.scores, scores, j, part_scores, part_j), + states=self.merge_states(states, part_states, part_j), + ) + ) + + # sort and prune 2 x beam -> beam + best_hyps = sorted(best_hyps, key=lambda x: x.score, reverse=True)[ + : min(len(best_hyps), self.beam_size) + ] + return best_hyps + + def forward( + self, + x: torch.Tensor, + scama_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + maxlenratio: float = 0.0, + minlenratio: float = 0.0, + maxlen: int = None, + minlen: int = 0, + cache: dict = {}, + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + If maxlenratio<0.0, its absolute value is interpreted + as a constant max output length. + minlenratio (float): Input length ratio to obtain min output length. + + Returns: + list[Hypothesis]: N-best decoding results + + """ + if maxlen is None: + # set length bounds + if maxlenratio == 0: + maxlen = x.shape[0] + elif maxlenratio < 0: + maxlen = -1 * int(maxlenratio) + else: + maxlen = max(1, int(maxlenratio * x.size(0))) + minlen = int(minlenratio * x.size(0)) + + logging.info("decoder input length: " + str(x.shape[0])) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # main loop of prefix search + # running_hyps = self.init_hyp(x) + running_hyps = cache["running_hyps"] + ended_hyps = [] + for i in range(maxlen): + logging.debug("position " + str(i)) + mask_enc = None + # if scama_mask is not None: + # token_num_predictor = scama_mask.size(1) + # token_id_slice = min(i, token_num_predictor-1) + # mask_enc = scama_mask[:, token_id_slice:token_id_slice+1, :] + # # if mask_enc.size(1) == 0: + # # mask_enc = scama_mask[:, -2:-1, :] + # # # mask_enc = torch.zeros_like(mask_enc) + pre_acoustic_embeds_cur = None + if pre_acoustic_embeds is not None: + b, t, d = pre_acoustic_embeds.size() + pad = torch.zeros((b, 1, d), dtype=pre_acoustic_embeds.dtype).to( + device=pre_acoustic_embeds.device + ) + pre_acoustic_embeds = torch.cat((pre_acoustic_embeds, pad), dim=1) + token_id_slice = min(i, t) + pre_acoustic_embeds_cur = pre_acoustic_embeds[ + :, token_id_slice : token_id_slice + 1, : + ] + + best = self.search( + running_hyps, + x, + x_mask=mask_enc, + pre_acoustic_embeds=pre_acoustic_embeds_cur, + cache=cache["decoder"], + ) + # post process of one iteration + running_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps) + # end detection + if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i): + logging.info(f"end detected at {i}") + break + if len(running_hyps) == 0: + logging.info("no hypothesis. Finish decoding.") + break + else: + logging.debug(f"remained hypotheses: {len(running_hyps)}") + + nbest_hyps = sorted(ended_hyps, key=lambda x: x.score, reverse=True) + # check the number of hypotheses reaching to eos + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, perform recognition " "again with smaller minlenratio." + ) + return ( + [] + if minlenratio < 0.1 + else self.forward(x, maxlenratio, max(0.0, minlenratio - 0.1)) + ) + + # report the best result + for x in nbest_hyps: + yseq = "".join([self.token_list[x] for x in x.yseq]) + logging.debug("nbest: y: {}, yseq: {}, score: {}".format(x.yseq, yseq, x.score)) + best = nbest_hyps[0] + for k, v in best.scores.items(): + logging.info(f"{v:6.2f} * {self.weights[k]:3} = {v * self.weights[k]:6.2f} for {k}") + logging.info(f"total log probability: {best.score:.2f}") + logging.info(f"normalized log probability: {best.score / len(best.yseq):.2f}") + logging.info(f"total number of ended hypotheses: {len(nbest_hyps)}") + if self.token_list is not None: + logging.info( + "best hypo: " + "".join([self.token_list[x] for x in best.yseq[1:-1]]) + "\n" + ) + return nbest_hyps + + def post_process( + self, + i: int, + maxlen: int, + maxlenratio: float, + running_hyps: List[Hypothesis], + ended_hyps: List[Hypothesis], + ) -> List[Hypothesis]: + """Perform post-processing of beam search iterations. + + Args: + i (int): The length of hypothesis tokens. + maxlen (int): The maximum length of tokens in beam search. + maxlenratio (int): The maximum length ratio in beam search. + running_hyps (List[Hypothesis]): The running hypotheses in beam search. + ended_hyps (List[Hypothesis]): The ended hypotheses in beam search. + + Returns: + List[Hypothesis]: The new running hypotheses. + + """ + logging.debug(f"the number of running hypotheses: {len(running_hyps)}") + if self.token_list is not None: + logging.debug( + "best hypo: " + "".join([self.token_list[x] for x in running_hyps[0].yseq[1:]]) + ) + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + running_hyps = [ + h._replace(yseq=self.append_token(h.yseq, self.eos)) for h in running_hyps + ] + + # add ended hypotheses to a final list, and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in running_hyps: + if hyp.yseq[-1] == self.eos: + # e.g., Word LM needs to add final score + for k, d in chain(self.full_scorers.items(), self.part_scorers.items()): + s = d.final_score(hyp.states[k]) + hyp.scores[k] += s + hyp = hyp._replace(score=hyp.score + self.weights[k] * s) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + return remained_hyps diff --git a/funasr/models/scama/chunk_utilis.py b/funasr/models/scama/chunk_utilis.py new file mode 100644 index 0000000..2fe3fa4 --- /dev/null +++ b/funasr/models/scama/chunk_utilis.py @@ -0,0 +1,493 @@ +import math +import torch +import numpy as np +import torch.nn.functional as F + +from funasr.models.scama.utils import sequence_mask +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class overlap_chunk: + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + San-m: Memory equipped self-attention for end-to-end speech recognition + https://arxiv.org/abs/2006.01713 + + """ + + def __init__( + self, + chunk_size: tuple = (16,), + stride: tuple = (10,), + pad_left: tuple = (0,), + encoder_att_look_back_factor: tuple = (1,), + shfit_fsmn: int = 0, + decoder_att_look_back_factor: tuple = (1,), + ): + + pad_left = self.check_chunk_size_args(chunk_size, pad_left) + encoder_att_look_back_factor = self.check_chunk_size_args( + chunk_size, encoder_att_look_back_factor + ) + decoder_att_look_back_factor = self.check_chunk_size_args( + chunk_size, decoder_att_look_back_factor + ) + ( + self.chunk_size, + self.stride, + self.pad_left, + self.encoder_att_look_back_factor, + self.decoder_att_look_back_factor, + ) = ( + chunk_size, + stride, + pad_left, + encoder_att_look_back_factor, + decoder_att_look_back_factor, + ) + self.shfit_fsmn = shfit_fsmn + self.x_add_mask = None + self.x_rm_mask = None + self.x_len = None + self.mask_shfit_chunk = None + self.mask_chunk_predictor = None + self.mask_att_chunk_encoder = None + self.mask_shift_att_chunk_decoder = None + self.chunk_outs = None + ( + self.chunk_size_cur, + self.stride_cur, + self.pad_left_cur, + self.encoder_att_look_back_factor_cur, + self.chunk_size_pad_shift_cur, + ) = (None, None, None, None, None) + + def check_chunk_size_args(self, chunk_size, x): + if len(x) < len(chunk_size): + x = [x[0] for i in chunk_size] + return x + + def get_chunk_size(self, ind: int = 0): + # with torch.no_grad: + chunk_size, stride, pad_left, encoder_att_look_back_factor, decoder_att_look_back_factor = ( + self.chunk_size[ind], + self.stride[ind], + self.pad_left[ind], + self.encoder_att_look_back_factor[ind], + self.decoder_att_look_back_factor[ind], + ) + ( + self.chunk_size_cur, + self.stride_cur, + self.pad_left_cur, + self.encoder_att_look_back_factor_cur, + self.chunk_size_pad_shift_cur, + self.decoder_att_look_back_factor_cur, + ) = ( + chunk_size, + stride, + pad_left, + encoder_att_look_back_factor, + chunk_size + self.shfit_fsmn, + decoder_att_look_back_factor, + ) + return ( + self.chunk_size_cur, + self.stride_cur, + self.pad_left_cur, + self.encoder_att_look_back_factor_cur, + self.chunk_size_pad_shift_cur, + ) + + def random_choice(self, training=True, decoding_ind=None): + chunk_num = len(self.chunk_size) + ind = 0 + if training and chunk_num > 1: + ind = torch.randint(0, chunk_num, ()).cpu().item() + if not training and decoding_ind is not None: + ind = int(decoding_ind) + + return ind + + def gen_chunk_mask(self, x_len, ind=0, num_units=1, num_units_predictor=1): + + with torch.no_grad(): + x_len = x_len.cpu().numpy() + x_len_max = x_len.max() + + chunk_size, stride, pad_left, encoder_att_look_back_factor, chunk_size_pad_shift = ( + self.get_chunk_size(ind) + ) + shfit_fsmn = self.shfit_fsmn + pad_right = chunk_size - stride - pad_left + + chunk_num_batch = np.ceil(x_len / stride).astype(np.int32) + x_len_chunk = ( + (chunk_num_batch - 1) * chunk_size_pad_shift + + shfit_fsmn + + pad_left + + 0 + + x_len + - (chunk_num_batch - 1) * stride + ) + x_len_chunk = x_len_chunk.astype(x_len.dtype) + x_len_chunk_max = x_len_chunk.max() + + chunk_num = int(math.ceil(x_len_max / stride)) + dtype = np.int32 + max_len_for_x_mask_tmp = max(chunk_size, x_len_max + pad_left) + x_add_mask = np.zeros([0, max_len_for_x_mask_tmp], dtype=dtype) + x_rm_mask = np.zeros([max_len_for_x_mask_tmp, 0], dtype=dtype) + mask_shfit_chunk = np.zeros([0, num_units], dtype=dtype) + mask_chunk_predictor = np.zeros([0, num_units_predictor], dtype=dtype) + mask_shift_att_chunk_decoder = np.zeros([0, 1], dtype=dtype) + mask_att_chunk_encoder = np.zeros([0, chunk_num * chunk_size_pad_shift], dtype=dtype) + for chunk_ids in range(chunk_num): + # x_mask add + fsmn_padding = np.zeros((shfit_fsmn, max_len_for_x_mask_tmp), dtype=dtype) + x_mask_cur = np.diag(np.ones(chunk_size, dtype=np.float32)) + x_mask_pad_left = np.zeros((chunk_size, chunk_ids * stride), dtype=dtype) + x_mask_pad_right = np.zeros((chunk_size, max_len_for_x_mask_tmp), dtype=dtype) + x_cur_pad = np.concatenate([x_mask_pad_left, x_mask_cur, x_mask_pad_right], axis=1) + x_cur_pad = x_cur_pad[:chunk_size, :max_len_for_x_mask_tmp] + x_add_mask_fsmn = np.concatenate([fsmn_padding, x_cur_pad], axis=0) + x_add_mask = np.concatenate([x_add_mask, x_add_mask_fsmn], axis=0) + + # x_mask rm + fsmn_padding = np.zeros((max_len_for_x_mask_tmp, shfit_fsmn), dtype=dtype) + padding_mask_left = np.zeros((max_len_for_x_mask_tmp, pad_left), dtype=dtype) + padding_mask_right = np.zeros((max_len_for_x_mask_tmp, pad_right), dtype=dtype) + x_mask_cur = np.diag(np.ones(stride, dtype=dtype)) + x_mask_cur_pad_top = np.zeros((chunk_ids * stride, stride), dtype=dtype) + x_mask_cur_pad_bottom = np.zeros((max_len_for_x_mask_tmp, stride), dtype=dtype) + x_rm_mask_cur = np.concatenate( + [x_mask_cur_pad_top, x_mask_cur, x_mask_cur_pad_bottom], axis=0 + ) + x_rm_mask_cur = x_rm_mask_cur[:max_len_for_x_mask_tmp, :stride] + x_rm_mask_cur_fsmn = np.concatenate( + [fsmn_padding, padding_mask_left, x_rm_mask_cur, padding_mask_right], axis=1 + ) + x_rm_mask = np.concatenate([x_rm_mask, x_rm_mask_cur_fsmn], axis=1) + + # fsmn_padding_mask + pad_shfit_mask = np.zeros([shfit_fsmn, num_units], dtype=dtype) + ones_1 = np.ones([chunk_size, num_units], dtype=dtype) + mask_shfit_chunk_cur = np.concatenate([pad_shfit_mask, ones_1], axis=0) + mask_shfit_chunk = np.concatenate([mask_shfit_chunk, mask_shfit_chunk_cur], axis=0) + + # predictor mask + zeros_1 = np.zeros([shfit_fsmn + pad_left, num_units_predictor], dtype=dtype) + ones_2 = np.ones([stride, num_units_predictor], dtype=dtype) + zeros_3 = np.zeros( + [chunk_size - stride - pad_left, num_units_predictor], dtype=dtype + ) + ones_zeros = np.concatenate([ones_2, zeros_3], axis=0) + mask_chunk_predictor_cur = np.concatenate([zeros_1, ones_zeros], axis=0) + mask_chunk_predictor = np.concatenate( + [mask_chunk_predictor, mask_chunk_predictor_cur], axis=0 + ) + + # encoder att mask + zeros_1_top = np.zeros([shfit_fsmn, chunk_num * chunk_size_pad_shift], dtype=dtype) + + zeros_2_num = max(chunk_ids - encoder_att_look_back_factor, 0) + zeros_2 = np.zeros([chunk_size, zeros_2_num * chunk_size_pad_shift], dtype=dtype) + + encoder_att_look_back_num = max(chunk_ids - zeros_2_num, 0) + zeros_2_left = np.zeros([chunk_size, shfit_fsmn], dtype=dtype) + ones_2_mid = np.ones([stride, stride], dtype=dtype) + zeros_2_bottom = np.zeros([chunk_size - stride, stride], dtype=dtype) + zeros_2_right = np.zeros([chunk_size, chunk_size - stride], dtype=dtype) + ones_2 = np.concatenate([ones_2_mid, zeros_2_bottom], axis=0) + ones_2 = np.concatenate([zeros_2_left, ones_2, zeros_2_right], axis=1) + ones_2 = np.tile(ones_2, [1, encoder_att_look_back_num]) + + zeros_3_left = np.zeros([chunk_size, shfit_fsmn], dtype=dtype) + ones_3_right = np.ones([chunk_size, chunk_size], dtype=dtype) + ones_3 = np.concatenate([zeros_3_left, ones_3_right], axis=1) + + zeros_remain_num = max(chunk_num - 1 - chunk_ids, 0) + zeros_remain = np.zeros( + [chunk_size, zeros_remain_num * chunk_size_pad_shift], dtype=dtype + ) + + ones2_bottom = np.concatenate([zeros_2, ones_2, ones_3, zeros_remain], axis=1) + mask_att_chunk_encoder_cur = np.concatenate([zeros_1_top, ones2_bottom], axis=0) + mask_att_chunk_encoder = np.concatenate( + [mask_att_chunk_encoder, mask_att_chunk_encoder_cur], axis=0 + ) + + # decoder fsmn_shift_att_mask + zeros_1 = np.zeros([shfit_fsmn, 1]) + ones_1 = np.ones([chunk_size, 1]) + mask_shift_att_chunk_decoder_cur = np.concatenate([zeros_1, ones_1], axis=0) + mask_shift_att_chunk_decoder = np.concatenate( + [mask_shift_att_chunk_decoder, mask_shift_att_chunk_decoder_cur], axis=0 + ) + + self.x_add_mask = x_add_mask[:x_len_chunk_max, : x_len_max + pad_left] + self.x_len_chunk = x_len_chunk + self.x_rm_mask = x_rm_mask[:x_len_max, :x_len_chunk_max] + self.x_len = x_len + self.mask_shfit_chunk = mask_shfit_chunk[:x_len_chunk_max, :] + self.mask_chunk_predictor = mask_chunk_predictor[:x_len_chunk_max, :] + self.mask_att_chunk_encoder = mask_att_chunk_encoder[:x_len_chunk_max, :x_len_chunk_max] + self.mask_shift_att_chunk_decoder = mask_shift_att_chunk_decoder[:x_len_chunk_max, :] + self.chunk_outs = ( + self.x_add_mask, + self.x_len_chunk, + self.x_rm_mask, + self.x_len, + self.mask_shfit_chunk, + self.mask_chunk_predictor, + self.mask_att_chunk_encoder, + self.mask_shift_att_chunk_decoder, + ) + + return self.chunk_outs + + def split_chunk(self, x, x_len, chunk_outs): + """ + :param x: (b, t, d) + :param x_length: (b) + :param ind: int + :return: + """ + x = x[:, : x_len.max(), :] + b, t, d = x.size() + x_len_mask = (~make_pad_mask(x_len, maxlen=t)).to(x.device) + x *= x_len_mask[:, :, None] + + x_add_mask = self.get_x_add_mask(chunk_outs, x.device, dtype=x.dtype) + x_len_chunk = self.get_x_len_chunk(chunk_outs, x_len.device, dtype=x_len.dtype) + pad = (0, 0, self.pad_left_cur, 0) + x = F.pad(x, pad, "constant", 0.0) + b, t, d = x.size() + x = torch.transpose(x, 1, 0) + x = torch.reshape(x, [t, -1]) + x_chunk = torch.mm(x_add_mask, x) + x_chunk = torch.reshape(x_chunk, [-1, b, d]).transpose(1, 0) + + return x_chunk, x_len_chunk + + def remove_chunk(self, x_chunk, x_len_chunk, chunk_outs): + x_chunk = x_chunk[:, : x_len_chunk.max(), :] + b, t, d = x_chunk.size() + x_len_chunk_mask = (~make_pad_mask(x_len_chunk, maxlen=t)).to(x_chunk.device) + x_chunk *= x_len_chunk_mask[:, :, None] + + x_rm_mask = self.get_x_rm_mask(chunk_outs, x_chunk.device, dtype=x_chunk.dtype) + x_len = self.get_x_len(chunk_outs, x_len_chunk.device, dtype=x_len_chunk.dtype) + x_chunk = torch.transpose(x_chunk, 1, 0) + x_chunk = torch.reshape(x_chunk, [t, -1]) + x = torch.mm(x_rm_mask, x_chunk) + x = torch.reshape(x, [-1, b, d]).transpose(1, 0) + + return x, x_len + + def get_x_add_mask(self, chunk_outs=None, device="cpu", idx=0, dtype=torch.float32): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = torch.from_numpy(x).type(dtype).to(device) + return x + + def get_x_len_chunk(self, chunk_outs=None, device="cpu", idx=1, dtype=torch.float32): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = torch.from_numpy(x).type(dtype).to(device) + return x + + def get_x_rm_mask(self, chunk_outs=None, device="cpu", idx=2, dtype=torch.float32): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = torch.from_numpy(x).type(dtype).to(device) + return x + + def get_x_len(self, chunk_outs=None, device="cpu", idx=3, dtype=torch.float32): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = torch.from_numpy(x).type(dtype).to(device) + return x + + def get_mask_shfit_chunk( + self, chunk_outs=None, device="cpu", batch_size=1, num_units=1, idx=4, dtype=torch.float32 + ): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = np.tile( + x[ + None, + :, + :, + ], + [batch_size, 1, num_units], + ) + x = torch.from_numpy(x).type(dtype).to(device) + return x + + def get_mask_chunk_predictor( + self, chunk_outs=None, device="cpu", batch_size=1, num_units=1, idx=5, dtype=torch.float32 + ): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = np.tile( + x[ + None, + :, + :, + ], + [batch_size, 1, num_units], + ) + x = torch.from_numpy(x).type(dtype).to(device) + return x + + def get_mask_att_chunk_encoder( + self, chunk_outs=None, device="cpu", batch_size=1, idx=6, dtype=torch.float32 + ): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = np.tile( + x[ + None, + :, + :, + ], + [batch_size, 1, 1], + ) + x = torch.from_numpy(x).type(dtype).to(device) + return x + + def get_mask_shift_att_chunk_decoder( + self, chunk_outs=None, device="cpu", batch_size=1, idx=7, dtype=torch.float32 + ): + with torch.no_grad(): + x = chunk_outs[idx] if chunk_outs is not None else self.chunk_outs[idx] + x = np.tile(x[None, None, :, 0], [batch_size, 1, 1]) + x = torch.from_numpy(x).type(dtype).to(device) + return x + + +def build_scama_mask_for_cross_attention_decoder( + predictor_alignments: torch.Tensor, + encoder_sequence_length: torch.Tensor, + chunk_size: int = 5, + encoder_chunk_size: int = 5, + attention_chunk_center_bias: int = 0, + attention_chunk_size: int = 1, + attention_chunk_type: str = "chunk", + step=None, + predictor_mask_chunk_hopping: torch.Tensor = None, + decoder_att_look_back_factor: int = 1, + mask_shift_att_chunk_decoder: torch.Tensor = None, + target_length: torch.Tensor = None, + is_training=True, + dtype: torch.dtype = torch.float32, +): + with torch.no_grad(): + device = predictor_alignments.device + batch_size, chunk_num = predictor_alignments.size() + maximum_encoder_length = encoder_sequence_length.max().item() + int_type = predictor_alignments.dtype + if not is_training: + target_length = predictor_alignments.sum(dim=-1).type(encoder_sequence_length.dtype) + maximum_target_length = target_length.max() + predictor_alignments_cumsum = torch.cumsum(predictor_alignments, dim=1) + predictor_alignments_cumsum = predictor_alignments_cumsum[:, None, :].repeat( + 1, maximum_target_length, 1 + ) + + index = torch.ones([batch_size, maximum_target_length], dtype=int_type).to(device) + index = torch.cumsum(index, dim=1) + index = index[:, :, None].repeat(1, 1, chunk_num) + + index_div = torch.floor(torch.divide(predictor_alignments_cumsum, index)).type(int_type) + index_div_bool_zeros = index_div == 0 + index_div_bool_zeros_count = torch.sum(index_div_bool_zeros.type(int_type), dim=-1) + 1 + + index_div_bool_zeros_count = torch.clip(index_div_bool_zeros_count, min=1, max=chunk_num) + + index_div_bool_zeros_count *= chunk_size + index_div_bool_zeros_count += attention_chunk_center_bias + index_div_bool_zeros_count = torch.clip( + index_div_bool_zeros_count - 1, min=0, max=maximum_encoder_length + ) + index_div_bool_zeros_count_ori = index_div_bool_zeros_count + + index_div_bool_zeros_count = ( + torch.floor(index_div_bool_zeros_count / encoder_chunk_size) + 1 + ) * encoder_chunk_size + max_len_chunk = math.ceil(maximum_encoder_length / encoder_chunk_size) * encoder_chunk_size + + mask_flip, mask_flip2 = None, None + if attention_chunk_size is not None: + index_div_bool_zeros_count_beg = index_div_bool_zeros_count - attention_chunk_size + index_div_bool_zeros_count_beg = torch.clip( + index_div_bool_zeros_count_beg, 0, max_len_chunk + ) + index_div_bool_zeros_count_beg_mask = sequence_mask( + index_div_bool_zeros_count_beg, maxlen=max_len_chunk, dtype=int_type, device=device + ) + mask_flip = 1 - index_div_bool_zeros_count_beg_mask + attention_chunk_size2 = attention_chunk_size * (decoder_att_look_back_factor + 1) + index_div_bool_zeros_count_beg = index_div_bool_zeros_count - attention_chunk_size2 + + index_div_bool_zeros_count_beg = torch.clip( + index_div_bool_zeros_count_beg, 0, max_len_chunk + ) + index_div_bool_zeros_count_beg_mask = sequence_mask( + index_div_bool_zeros_count_beg, maxlen=max_len_chunk, dtype=int_type, device=device + ) + mask_flip2 = 1 - index_div_bool_zeros_count_beg_mask + + mask = sequence_mask( + index_div_bool_zeros_count, maxlen=max_len_chunk, dtype=dtype, device=device + ) + + if predictor_mask_chunk_hopping is not None: + b, k, t = mask.size() + predictor_mask_chunk_hopping = predictor_mask_chunk_hopping[:, None, :, 0].repeat( + 1, k, 1 + ) + + mask_mask_flip = mask + if mask_flip is not None: + mask_mask_flip = mask_flip * mask + + def _fn(): + mask_sliced = mask[:b, :k, encoder_chunk_size:t] + zero_pad_right = torch.zeros( + [b, k, encoder_chunk_size], dtype=mask_sliced.dtype + ).to(device) + mask_sliced = torch.cat([mask_sliced, zero_pad_right], dim=2) + _, _, tt = predictor_mask_chunk_hopping.size() + pad_right_p = max_len_chunk - tt + predictor_mask_chunk_hopping_pad = torch.nn.functional.pad( + predictor_mask_chunk_hopping, [0, pad_right_p], "constant", 0 + ) + masked = mask_sliced * predictor_mask_chunk_hopping_pad + + mask_true = mask_mask_flip + masked + return mask_true + + mask = _fn() if t > chunk_size else mask_mask_flip + + if mask_flip2 is not None: + mask *= mask_flip2 + + mask_target = sequence_mask( + target_length, maxlen=maximum_target_length, dtype=mask.dtype, device=device + ) + mask = mask[:, :maximum_target_length, :] * mask_target[:, :, None] + + mask_len = sequence_mask( + encoder_sequence_length, maxlen=maximum_encoder_length, dtype=mask.dtype, device=device + ) + mask = mask[:, :, :maximum_encoder_length] * mask_len[:, None, :] + + if attention_chunk_type == "full": + mask = torch.ones_like(mask).to(device) + if mask_shift_att_chunk_decoder is not None: + mask = mask * mask_shift_att_chunk_decoder + mask = mask[:, :maximum_target_length, :maximum_encoder_length].type(dtype).to(device) + + return mask diff --git a/funasr/models/scama/decoder.py b/funasr/models/scama/decoder.py new file mode 100644 index 0000000..31b2357 --- /dev/null +++ b/funasr/models/scama/decoder.py @@ -0,0 +1,498 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from typing import List +from typing import Tuple +import logging +import torch +import torch.nn as nn +import numpy as np + +from funasr.models.scama import utils as myutils +from funasr.models.transformer.decoder import BaseTransformerDecoder + +from funasr.models.sanm.attention import ( + MultiHeadedAttentionSANMDecoder, + MultiHeadedAttentionCrossAtt, +) +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.sanm.positionwise_feed_forward import PositionwiseFeedForwardDecoderSANM +from funasr.models.transformer.utils.repeat import repeat + +from funasr.register import tables + + +class DecoderLayerSANM(nn.Module): + """Single decoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + src_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + + """ + + def __init__( + self, + size, + self_attn, + src_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an DecoderLayer object.""" + super(DecoderLayerSANM, self).__init__() + self.size = size + self.self_attn = self_attn + self.src_attn = src_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + if self_attn is not None: + self.norm2 = LayerNorm(size) + if src_attn is not None: + self.norm3 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = nn.Linear(size + size, size) + self.concat_linear2 = nn.Linear(size + size, size) + + def forward(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + # tgt = self.dropout(tgt) + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + x, _ = self.self_attn(tgt, tgt_mask) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x = residual + self.dropout(self.src_attn(x, memory, memory_mask)) + + return x, tgt_mask, memory, memory_mask, cache + + def forward_one_step(self, tgt, tgt_mask, memory, memory_mask=None, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + # tgt = self.dropout(tgt) + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + if self.training: + cache = None + x, cache = self.self_attn(tgt, tgt_mask, cache=cache) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x = residual + self.dropout(self.src_attn(x, memory, memory_mask)) + + return x, tgt_mask, memory, memory_mask, cache + + def forward_chunk( + self, tgt, memory, fsmn_cache=None, opt_cache=None, chunk_size=None, look_back=0 + ): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + tgt = self.feed_forward(tgt) + + x = tgt + if self.self_attn: + if self.normalize_before: + tgt = self.norm2(tgt) + x, fsmn_cache = self.self_attn(tgt, None, fsmn_cache) + x = residual + self.dropout(x) + + if self.src_attn is not None: + residual = x + if self.normalize_before: + x = self.norm3(x) + + x, opt_cache = self.src_attn.forward_chunk(x, memory, opt_cache, chunk_size, look_back) + x = residual + x + + return x, memory, fsmn_cache, opt_cache + + +@tables.register("decoder_classes", "FsmnDecoderSCAMAOpt") +class FsmnDecoderSCAMAOpt(BaseTransformerDecoder): + """ + Author: Shiliang Zhang, Zhifu Gao, Haoneng Luo, Ming Lei, Jie Gao, Zhijie Yan, Lei Xie + SCAMA: Streaming chunk-aware multihead attention for online end-to-end speech recognition + https://arxiv.org/abs/2006.01712 + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + att_layer_num: int = 6, + kernel_size: int = 21, + sanm_shfit: int = None, + concat_embeds: bool = False, + attention_dim: int = None, + tf2torch_tensor_name_prefix_torch: str = "decoder", + tf2torch_tensor_name_prefix_tf: str = "seq2seq/decoder", + embed_tensor_name_prefix_tf: str = None, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + if attention_dim is None: + attention_dim = encoder_output_size + + if input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(vocab_size, attention_dim), + ) + elif input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(vocab_size, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + else: + raise ValueError(f"only 'embed' or 'linear' is supported: {input_layer}") + + self.normalize_before = normalize_before + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + if use_output_layer: + self.output_layer = torch.nn.Linear(attention_dim, vocab_size) + else: + self.output_layer = None + + self.att_layer_num = att_layer_num + self.num_blocks = num_blocks + if sanm_shfit is None: + sanm_shfit = (kernel_size - 1) // 2 + self.decoders = repeat( + att_layer_num, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, self_attention_dropout_rate, kernel_size, sanm_shfit=sanm_shfit + ), + MultiHeadedAttentionCrossAtt( + attention_heads, + attention_dim, + src_attention_dropout_rate, + encoder_output_size=encoder_output_size, + ), + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if num_blocks - att_layer_num <= 0: + self.decoders2 = None + else: + self.decoders2 = repeat( + num_blocks - att_layer_num, + lambda lnum: DecoderLayerSANM( + attention_dim, + MultiHeadedAttentionSANMDecoder( + attention_dim, + self_attention_dropout_rate, + kernel_size, + sanm_shfit=sanm_shfit, + ), + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + self.decoders3 = repeat( + 1, + lambda lnum: DecoderLayerSANM( + attention_dim, + None, + None, + PositionwiseFeedForwardDecoderSANM(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if concat_embeds: + self.embed_concat_ffn = repeat( + 1, + lambda lnum: DecoderLayerSANM( + attention_dim + encoder_output_size, + None, + None, + PositionwiseFeedForwardDecoderSANM( + attention_dim + encoder_output_size, + linear_units, + dropout_rate, + adim=attention_dim, + ), + dropout_rate, + normalize_before, + concat_after, + ), + ) + else: + self.embed_concat_ffn = None + self.concat_embeds = concat_embeds + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + self.embed_tensor_name_prefix_tf = embed_tensor_name_prefix_tf + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + chunk_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + tgt_mask = myutils.sequence_mask(ys_in_lens, device=tgt.device)[:, :, None] + + memory = hs_pad + memory_mask = myutils.sequence_mask(hlens, device=memory.device)[:, None, :] + if chunk_mask is not None: + memory_mask = memory_mask * chunk_mask + if tgt_mask.size(1) != memory_mask.size(1): + memory_mask = torch.cat((memory_mask, memory_mask[:, -2:-1, :]), dim=1) + + x = self.embed(tgt) + + if pre_acoustic_embeds is not None and self.concat_embeds: + x = torch.cat((x, pre_acoustic_embeds), dim=-1) + x, _, _, _, _ = self.embed_concat_ffn(x, None, None, None, None) + + x, tgt_mask, memory, memory_mask, _ = self.decoders(x, tgt_mask, memory, memory_mask) + if self.decoders2 is not None: + x, tgt_mask, memory, memory_mask, _ = self.decoders2(x, tgt_mask, memory, memory_mask) + x, tgt_mask, memory, memory_mask, _ = self.decoders3(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + return x, olens + + def score( + self, + ys, + state, + x, + x_mask=None, + pre_acoustic_embeds: torch.Tensor = None, + ): + """Score.""" + ys_mask = myutils.sequence_mask( + torch.tensor([len(ys)], dtype=torch.int32), device=x.device + )[:, :, None] + logp, state = self.forward_one_step( + ys.unsqueeze(0), + ys_mask, + x.unsqueeze(0), + memory_mask=x_mask, + pre_acoustic_embeds=pre_acoustic_embeds, + cache=state, + ) + return logp.squeeze(0), state + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + memory_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + """ + + x = tgt[:, -1:] + tgt_mask = None + x = self.embed(x) + + if pre_acoustic_embeds is not None and self.concat_embeds: + x = torch.cat((x, pre_acoustic_embeds), dim=-1) + x, _, _, _, _ = self.embed_concat_ffn(x, None, None, None, None) + + if cache is None: + cache_layer_num = len(self.decoders) + if self.decoders2 is not None: + cache_layer_num += len(self.decoders2) + cache = [None] * cache_layer_num + new_cache = [] + # for c, decoder in zip(cache, self.decoders): + for i in range(self.att_layer_num): + decoder = self.decoders[i] + c = cache[i] + x, tgt_mask, memory, memory_mask, c_ret = decoder.forward_one_step( + x, tgt_mask, memory, memory_mask, cache=c + ) + new_cache.append(c_ret) + + if self.num_blocks - self.att_layer_num >= 1: + for i in range(self.num_blocks - self.att_layer_num): + j = i + self.att_layer_num + decoder = self.decoders2[i] + c = cache[j] + x, tgt_mask, memory, memory_mask, c_ret = decoder.forward_one_step( + x, tgt_mask, memory, memory_mask, cache=c + ) + new_cache.append(c_ret) + + for decoder in self.decoders3: + x, tgt_mask, memory, memory_mask, _ = decoder.forward_one_step( + x, tgt_mask, memory, None, cache=None + ) + + if self.normalize_before: + y = self.after_norm(x[:, -1]) + else: + y = x[:, -1] + if self.output_layer is not None: + y = self.output_layer(y) + y = torch.log_softmax(y, dim=-1) + + return y, new_cache diff --git a/funasr/models/scama/encoder.py b/funasr/models/scama/encoder.py new file mode 100644 index 0000000..e1fe924 --- /dev/null +++ b/funasr/models/scama/encoder.py @@ -0,0 +1,499 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from typing import List +from typing import Optional +from typing import Sequence +from typing import Tuple +from typing import Union +import logging +import torch +import torch.nn as nn +import torch.nn.functional as F +from funasr.models.scama.chunk_utilis import overlap_chunk +import numpy as np +from funasr.train_utils.device_funcs import to_device +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.sanm.attention import MultiHeadedAttention, MultiHeadedAttentionSANM +from funasr.models.transformer.embedding import ( + SinusoidalPositionEncoder, + StreamSinusoidalPositionEncoder, +) +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling2 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling6 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling8 +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.utils.subsampling import check_short_utt +from funasr.models.transformer.utils.mask import subsequent_mask, vad_mask + +from funasr.models.ctc.ctc import CTC + +from funasr.register import tables + + +class EncoderLayerSANM(nn.Module): + def __init__( + self, + in_size, + size, + self_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayerSANM, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(in_size) + self.norm2 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.in_size = in_size + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + self.dropout_rate = dropout_rate + + def forward(self, x, mask, cache=None, mask_shfit_chunk=None, mask_att_chunk_encoder=None): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + return x, mask + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if self.concat_after: + x_concat = torch.cat( + ( + x, + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ), + ), + dim=-1, + ) + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = stoch_layer_coeff * self.concat_linear(x_concat) + else: + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.dropout( + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ) + ) + else: + x = stoch_layer_coeff * self.dropout( + self.self_attn( + x, + mask, + mask_shfit_chunk=mask_shfit_chunk, + mask_att_chunk_encoder=mask_att_chunk_encoder, + ) + ) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + stoch_layer_coeff * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm2(x) + + return x, mask, cache, mask_shfit_chunk, mask_att_chunk_encoder + + def forward_chunk(self, x, cache=None, chunk_size=None, look_back=0): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if self.in_size == self.size: + attn, cache = self.self_attn.forward_chunk(x, cache, chunk_size, look_back) + x = residual + attn + else: + x, cache = self.self_attn.forward_chunk(x, cache, chunk_size, look_back) + + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + self.feed_forward(x) + if not self.normalize_before: + x = self.norm2(x) + + return x, cache + + +@tables.register("encoder_classes", "SANMEncoderChunkOpt") +class SANMEncoderChunkOpt(nn.Module): + """ + Author: Shiliang Zhang, Zhifu Gao, Haoneng Luo, Ming Lei, Jie Gao, Zhijie Yan, Lei Xie + SCAMA: Streaming chunk-aware multihead attention for online end-to-end speech recognition + https://arxiv.org/abs/2006.01712 + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: Optional[str] = "conv2d", + pos_enc_class=SinusoidalPositionEncoder, + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 1, + padding_idx: int = -1, + interctc_layer_idx: List[int] = [], + interctc_use_conditioning: bool = False, + kernel_size: int = 11, + sanm_shfit: int = 0, + selfattention_layer_type: str = "sanm", + chunk_size: Union[int, Sequence[int]] = (16,), + stride: Union[int, Sequence[int]] = (10,), + pad_left: Union[int, Sequence[int]] = (0,), + encoder_att_look_back_factor: Union[int, Sequence[int]] = (1,), + decoder_att_look_back_factor: Union[int, Sequence[int]] = (1,), + tf2torch_tensor_name_prefix_torch: str = "encoder", + tf2torch_tensor_name_prefix_tf: str = "seq2seq/encoder", + ): + super().__init__() + self._output_size = output_size + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling(input_size, output_size, dropout_rate) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2(input_size, output_size, dropout_rate) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6(input_size, output_size, dropout_rate) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8(input_size, output_size, dropout_rate) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer is None: + if input_size == output_size: + self.embed = None + else: + self.embed = torch.nn.Linear(input_size, output_size) + elif input_layer == "pe": + self.embed = SinusoidalPositionEncoder() + elif input_layer == "pe_online": + self.embed = StreamSinusoidalPositionEncoder() + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + + if selfattention_layer_type == "selfattn": + encoder_selfattn_layer = MultiHeadedAttention + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + ) + elif selfattention_layer_type == "sanm": + encoder_selfattn_layer = MultiHeadedAttentionSANM + encoder_selfattn_layer_args0 = ( + attention_heads, + input_size, + output_size, + attention_dropout_rate, + kernel_size, + sanm_shfit, + ) + + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + output_size, + attention_dropout_rate, + kernel_size, + sanm_shfit, + ) + self.encoders0 = repeat( + 1, + lambda lnum: EncoderLayerSANM( + input_size, + output_size, + encoder_selfattn_layer(*encoder_selfattn_layer_args0), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + self.encoders = repeat( + num_blocks - 1, + lambda lnum: EncoderLayerSANM( + output_size, + output_size, + encoder_selfattn_layer(*encoder_selfattn_layer_args), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + + self.interctc_layer_idx = interctc_layer_idx + if len(interctc_layer_idx) > 0: + assert 0 < min(interctc_layer_idx) and max(interctc_layer_idx) < num_blocks + self.interctc_use_conditioning = interctc_use_conditioning + self.conditioning_layer = None + shfit_fsmn = (kernel_size - 1) // 2 + self.overlap_chunk_cls = overlap_chunk( + chunk_size=chunk_size, + stride=stride, + pad_left=pad_left, + shfit_fsmn=shfit_fsmn, + encoder_att_look_back_factor=encoder_att_look_back_factor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + ) + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ctc: CTC = None, + ind: int = 0, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Embed positions in tensor. + + Args: + xs_pad: input tensor (B, L, D) + ilens: input length (B) + prev_states: Not to be used now. + Returns: + position embedded tensor and mask + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + xs_pad *= self.output_size() ** 0.5 + if self.embed is None: + xs_pad = xs_pad + elif ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + + mask_shfit_chunk, mask_att_chunk_encoder = None, None + if self.overlap_chunk_cls is not None: + ilens = masks.squeeze(1).sum(1) + chunk_outs = self.overlap_chunk_cls.gen_chunk_mask(ilens, ind) + xs_pad, ilens = self.overlap_chunk_cls.split_chunk(xs_pad, ilens, chunk_outs=chunk_outs) + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + mask_shfit_chunk = self.overlap_chunk_cls.get_mask_shfit_chunk( + chunk_outs, xs_pad.device, xs_pad.size(0), dtype=xs_pad.dtype + ) + mask_att_chunk_encoder = self.overlap_chunk_cls.get_mask_att_chunk_encoder( + chunk_outs, xs_pad.device, xs_pad.size(0), dtype=xs_pad.dtype + ) + + encoder_outs = self.encoders0(xs_pad, masks, None, mask_shfit_chunk, mask_att_chunk_encoder) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + intermediate_outs = [] + if len(self.interctc_layer_idx) == 0: + encoder_outs = self.encoders( + xs_pad, masks, None, mask_shfit_chunk, mask_att_chunk_encoder + ) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + else: + for layer_idx, encoder_layer in enumerate(self.encoders): + encoder_outs = encoder_layer( + xs_pad, masks, None, mask_shfit_chunk, mask_att_chunk_encoder + ) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + if layer_idx + 1 in self.interctc_layer_idx: + encoder_out = xs_pad + + # intermediate outputs are also normalized + if self.normalize_before: + encoder_out = self.after_norm(encoder_out) + + intermediate_outs.append((layer_idx + 1, encoder_out)) + + if self.interctc_use_conditioning: + ctc_out = ctc.softmax(encoder_out) + xs_pad = xs_pad + self.conditioning_layer(ctc_out) + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + olens = masks.squeeze(1).sum(1) + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), olens, None + return xs_pad, olens, None + + def _add_overlap_chunk(self, feats: np.ndarray, cache: dict = {}): + if len(cache) == 0: + return feats + cache["feats"] = to_device(cache["feats"], device=feats.device) + overlap_feats = torch.cat((cache["feats"], feats), dim=1) + cache["feats"] = overlap_feats[:, -(cache["chunk_size"][0] + cache["chunk_size"][2]) :, :] + return overlap_feats + + def forward_chunk( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + cache: dict = None, + **kwargs, + ): + is_final = kwargs.get("is_final", False) + xs_pad *= self.output_size() ** 0.5 + if self.embed is None: + xs_pad = xs_pad + else: + xs_pad = self.embed(xs_pad, cache) + if cache["tail_chunk"]: + xs_pad = to_device(cache["feats"], device=xs_pad.device) + else: + xs_pad = self._add_overlap_chunk(xs_pad, cache) + if cache["opt"] is None: + cache_layer_num = len(self.encoders0) + len(self.encoders) + new_cache = [None] * cache_layer_num + else: + new_cache = cache["opt"] + + for layer_idx, encoder_layer in enumerate(self.encoders0): + encoder_outs = encoder_layer.forward_chunk( + xs_pad, new_cache[layer_idx], cache["chunk_size"], cache["encoder_chunk_look_back"] + ) + xs_pad, new_cache[0] = encoder_outs[0], encoder_outs[1] + + for layer_idx, encoder_layer in enumerate(self.encoders): + encoder_outs = encoder_layer.forward_chunk( + xs_pad, + new_cache[layer_idx + len(self.encoders0)], + cache["chunk_size"], + cache["encoder_chunk_look_back"], + ) + xs_pad, new_cache[layer_idx + len(self.encoders0)] = encoder_outs[0], encoder_outs[1] + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + if cache["encoder_chunk_look_back"] > 0 or cache["encoder_chunk_look_back"] == -1: + cache["opt"] = new_cache + + return xs_pad, ilens, None diff --git a/funasr/models/scama/model.py b/funasr/models/scama/model.py new file mode 100644 index 0000000..c15f435 --- /dev/null +++ b/funasr/models/scama/model.py @@ -0,0 +1,739 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import time +import torch +import torch.nn as nn +import torch.functional as F +import logging +from typing import Dict, Tuple +from contextlib import contextmanager +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.models.ctc.ctc import CTC +from funasr.utils import postprocess_utils +from funasr.metrics.compute_acc import th_accuracy +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.model import Paraformer +from funasr.models.paraformer.search import Hypothesis +from funasr.models.paraformer.cif_predictor import mae_loss +from funasr.train_utils.device_funcs import force_gatherable +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.models.transformer.utils.nets_utils import make_pad_mask, pad_list +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.models.scama.utils import sequence_mask + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "SCAMA") +class SCAMA(nn.Module): + """ + Author: Shiliang Zhang, Zhifu Gao, Haoneng Luo, Ming Lei, Jie Gao, Zhijie Yan, Lei Xie + SCAMA: Streaming chunk-aware multihead attention for online end-to-end speech recognition + https://arxiv.org/abs/2006.01712 + """ + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.5, + predictor: str = None, + predictor_conf: dict = None, + predictor_bias: int = 0, + predictor_weight: float = 0.0, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + share_embedding: bool = False, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + **decoder_conf, + ) + if ctc_weight > 0.0: + + if ctc_conf is None: + ctc_conf = {} + + ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **ctc_conf) + + predictor_class = tables.predictor_classes.get(predictor) + predictor = predictor_class(**predictor_conf) + + # note that eos is the same as sos (equivalent ID) + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.ctc_weight = ctc_weight + + self.specaug = specaug + self.normalize = normalize + + self.encoder = encoder + + if ctc_weight == 1.0: + self.decoder = None + else: + self.decoder = decoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + + if ctc_weight == 0.0: + self.ctc = None + else: + self.ctc = ctc + + self.predictor = predictor + self.predictor_weight = predictor_weight + self.predictor_bias = predictor_bias + + self.criterion_pre = mae_loss(normalize_length=length_normalized_loss) + + self.share_embedding = share_embedding + if self.share_embedding: + self.decoder.embed = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + self.error_calculator = None + + if self.encoder.overlap_chunk_cls is not None: + from funasr.models.scama.chunk_utilis import ( + build_scama_mask_for_cross_attention_decoder, + ) + + self.build_scama_mask_for_cross_attention_decoder_fn = ( + build_scama_mask_for_cross_attention_decoder + ) + self.decoder_attention_chunk_type = kwargs.get("decoder_attention_chunk_type", "chunk") + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + + decoding_ind = kwargs.get("decoding_ind") + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # Encoder + ind = self.encoder.overlap_chunk_cls.random_choice(self.training, decoding_ind) + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths, ind=ind) + + loss_ctc, cer_ctc = None, None + loss_pre = None + stats = dict() + + # decoder: CTC branch + + if self.ctc_weight > 0.0: + + encoder_out_ctc, encoder_out_lens_ctc = self.encoder.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out_ctc, encoder_out_lens_ctc, text, text_lengths + ) + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # decoder: Attention decoder branch + loss_att, acc_att, cer_att, wer_att, loss_pre = self._calc_att_predictor_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + loss_pre * self.predictor_weight + else: + loss = ( + self.ctc_weight * loss_ctc + + (1 - self.ctc_weight) * loss_att + + loss_pre * self.predictor_weight + ) + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = (text_lengths + self.predictor_bias).sum() + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + return encoder_out, encoder_out_lens + + def encode_chunk( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + cache: dict = None, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens, _ = self.encoder.forward_chunk( + speech, speech_lengths, cache=cache["encoder"] + ) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + return encoder_out, torch.tensor([encoder_out.size(1)]) + + def calc_predictor_chunk(self, encoder_out, encoder_out_lens, cache=None, **kwargs): + is_final = kwargs.get("is_final", False) + + return self.predictor.forward_chunk(encoder_out, cache["encoder"], is_final=is_final) + + def _calc_att_predictor_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + encoder_out_mask = sequence_mask( + encoder_out_lens, + maxlen=encoder_out.size(1), + dtype=encoder_out.dtype, + device=encoder_out.device, + )[:, None, :] + mask_chunk_predictor = None + if self.encoder.overlap_chunk_cls is not None: + mask_chunk_predictor = self.encoder.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, _ = self.predictor( + encoder_out, + ys_out_pad, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=ys_in_lens, + ) + predictor_alignments, predictor_alignments_len = self.predictor.gen_frame_alignments( + pre_alphas, encoder_out_lens + ) + + encoder_chunk_size = self.encoder.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=ys_in_lens, + is_training=self.training, + ) + + # try: + # 1. Forward decoder + decoder_out, _ = self.decoder( + encoder_out, + encoder_out_lens, + ys_in_pad, + ys_in_lens, + chunk_mask=scama_mask, + pre_acoustic_embeds=pre_acoustic_embeds, + ) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + # predictor loss + loss_pre = self.criterion_pre(ys_in_lens.type_as(pre_token_length), pre_token_length) + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att, loss_pre + + def calc_predictor_mask( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor = None, + ys_pad_lens: torch.Tensor = None, + ): + # ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + # ys_in_lens = ys_pad_lens + 1 + ys_out_pad, ys_in_lens = None, None + + encoder_out_mask = sequence_mask( + encoder_out_lens, + maxlen=encoder_out.size(1), + dtype=encoder_out.dtype, + device=encoder_out.device, + )[:, None, :] + mask_chunk_predictor = None + + mask_chunk_predictor = self.encoder.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, _ = self.predictor( + encoder_out, + ys_out_pad, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=ys_in_lens, + ) + predictor_alignments, predictor_alignments_len = self.predictor.gen_frame_alignments( + pre_alphas, encoder_out_lens + ) + + encoder_chunk_size = self.encoder.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=ys_in_lens, + is_training=self.training, + ) + + return ( + pre_acoustic_embeds, + pre_token_length, + predictor_alignments, + predictor_alignments_len, + scama_mask, + ) + + def init_beam_search( + self, + **kwargs, + ): + + from funasr.models.scama.beam_search import BeamSearchScamaStreaming + + from funasr.models.transformer.scorers.ctc import CTCPrefixScorer + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + if self.ctc != None: + ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos) + scorers.update(ctc=ctc) + token_list = kwargs.get("token_list") + scorers.update( + decoder=self.decoder, + length_bonus=LengthBonus(len(token_list)), + ) + + # 3. Build ngram model + # ngram is not supported now + ngram = None + scorers["ngram"] = ngram + + weights = dict( + decoder=1.0 - kwargs.get("decoding_ctc_weight", 0.0), + ctc=kwargs.get("decoding_ctc_weight", 0.0), + lm=kwargs.get("lm_weight", 0.0), + ngram=kwargs.get("ngram_weight", 0.0), + length_bonus=kwargs.get("penalty", 0.0), + ) + + beam_search = BeamSearchScamaStreaming( + beam_size=kwargs.get("beam_size", 2), + weights=weights, + scorers=scorers, + sos=self.sos, + eos=self.eos, + vocab_size=len(token_list), + token_list=token_list, + pre_beam_score_key=None if self.ctc_weight == 1.0 else "full", + ) + # beam_search.to(device=kwargs.get("device", "cpu"), dtype=getattr(torch, kwargs.get("dtype", "float32"))).eval() + # for scorer in scorers.values(): + # if isinstance(scorer, torch.nn.Module): + # scorer.to(device=kwargs.get("device", "cpu"), dtype=getattr(torch, kwargs.get("dtype", "float32"))).eval() + self.beam_search = beam_search + + def generate_chunk( + self, + speech, + speech_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + cache = kwargs.get("cache", {}) + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + encoder_out, encoder_out_lens = self.encode_chunk( + speech, speech_lengths, cache=cache, is_final=kwargs.get("is_final", False) + ) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + if "running_hyps" not in cache: + running_hyps = self.beam_search.init_hyp(encoder_out) + cache["running_hyps"] = running_hyps + + # predictor + predictor_outs = self.calc_predictor_chunk( + encoder_out, + encoder_out_lens, + cache=cache, + is_final=kwargs.get("is_final", False), + ) + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = ( + predictor_outs[0], + predictor_outs[1], + predictor_outs[2], + predictor_outs[3], + ) + pre_token_length = pre_token_length.round().long() + + if torch.max(pre_token_length) < 1: + return [] + maxlen = minlen = pre_token_length + if kwargs.get("is_final", False): + maxlen += kwargs.get("token_num_relax", 5) + minlen = max(0, minlen - kwargs.get("token_num_relax", 5)) + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + scama_mask=None, + pre_acoustic_embeds=pre_acoustic_embeds, + maxlen=int(maxlen), + minlen=int(minlen), + cache=cache, + ) + + cache["running_hyps"] = nbest_hyps + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + for hyp in nbest_hyps: + # assert isinstance(hyp, (Hypothesis)), type(hyp) + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + # text = tokenizer.tokens2text(token) + + result_i = token + + results.extend(result_i) + + return results + + def init_cache(self, cache: dict = {}, **kwargs): + device = kwargs.get("device", "cuda") + + chunk_size = kwargs.get("chunk_size", [0, 10, 5]) + encoder_chunk_look_back = kwargs.get("encoder_chunk_look_back", 0) + decoder_chunk_look_back = kwargs.get("decoder_chunk_look_back", 0) + batch_size = 1 + + enc_output_size = kwargs["encoder_conf"]["output_size"] + feats_dims = kwargs["frontend_conf"]["n_mels"] * kwargs["frontend_conf"]["lfr_m"] + + cache_encoder = { + "start_idx": 0, + "cif_hidden": torch.zeros((batch_size, 1, enc_output_size)).to(device=device), + "cif_alphas": torch.zeros((batch_size, 1)).to(device=device), + "chunk_size": chunk_size, + "encoder_chunk_look_back": encoder_chunk_look_back, + "last_chunk": False, + "opt": None, + "feats": torch.zeros((batch_size, chunk_size[0] + chunk_size[2], feats_dims)).to( + device=device + ), + "tail_chunk": False, + } + cache["encoder"] = cache_encoder + + cache_decoder = { + "decode_fsmn": None, + "decoder_chunk_look_back": decoder_chunk_look_back, + "opt": None, + "chunk_size": chunk_size, + } + cache["decoder"] = cache_decoder + cache["frontend"] = {} + + cache["prev_samples"] = torch.empty(0).to(device=device) + + return cache + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + cache: dict = {}, + **kwargs, + ): + + # init beamsearch + is_use_ctc = kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None + is_use_lm = ( + kwargs.get("lm_weight", 0.0) > 0.00001 and kwargs.get("lm_file", None) is not None + ) + + if self.beam_search is None: + + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + if len(cache) == 0: + self.init_cache(cache, **kwargs) + + meta_data = {} + chunk_size = kwargs.get("chunk_size", [0, 10, 5]) + chunk_stride_samples = int(chunk_size[1] * 960) # 600ms + + time1 = time.perf_counter() + cfg = {"is_final": kwargs.get("is_final", False)} + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + cache=cfg, + ) + _is_final = cfg["is_final"] # if data_in is a file or url, set is_final=True + + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + assert len(audio_sample_list) == 1, "batch_size must be set 1" + + audio_sample = torch.cat((cache["prev_samples"], audio_sample_list[0])) + + n = int(len(audio_sample) // chunk_stride_samples + int(_is_final)) + m = int(len(audio_sample) % chunk_stride_samples * (1 - int(_is_final))) + tokens = [] + for i in range(n): + kwargs["is_final"] = _is_final and i == n - 1 + audio_sample_i = audio_sample[i * chunk_stride_samples : (i + 1) * chunk_stride_samples] + + # extract fbank feats + speech, speech_lengths = extract_fbank( + [audio_sample_i], + data_type=kwargs.get("data_type", "sound"), + frontend=frontend, + cache=cache["frontend"], + is_final=kwargs["is_final"], + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + tokens_i = self.generate_chunk( + speech, + speech_lengths, + key=key, + tokenizer=tokenizer, + cache=cache, + frontend=frontend, + **kwargs, + ) + tokens.extend(tokens_i) + + text_postprocessed, _ = postprocess_utils.sentence_postprocess(tokens) + + result_i = {"key": key[0], "text": text_postprocessed} + result = [result_i] + + cache["prev_samples"] = audio_sample[:-m] + if _is_final: + self.init_cache(cache, **kwargs) + + if kwargs.get("output_dir"): + writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = writer[f"{1}best_recog"] + ibest_writer["token"][key[0]] = " ".join(tokens) + ibest_writer["text"][key[0]] = text_postprocessed + + return result, meta_data diff --git a/funasr/models/scama/template.yaml b/funasr/models/scama/template.yaml new file mode 100644 index 0000000..bc2e210 --- /dev/null +++ b/funasr/models/scama/template.yaml @@ -0,0 +1,127 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: SCAMA +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + +# encoder +encoder: SANMEncoderChunkOpt +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + +# decoder +decoder: FsmnDecoderSCAMAOpt +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 0 + +predictor: CifPredictorV2 +predictor_conf: + idim: 512 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + avg_nbest_model: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true + +normalize: null diff --git a/funasr/models/scama/utils.py b/funasr/models/scama/utils.py new file mode 100644 index 0000000..c3f7bc3 --- /dev/null +++ b/funasr/models/scama/utils.py @@ -0,0 +1,89 @@ +import os +import yaml +import torch +import numpy as np +from torch.nn import functional as F + + +def sequence_mask(lengths, maxlen=None, dtype=torch.float32, device=None): + if maxlen is None: + maxlen = lengths.max() + row_vector = torch.arange(0, maxlen, 1).to(lengths.device) + matrix = torch.unsqueeze(lengths, dim=-1) + mask = row_vector < matrix + mask = mask.detach() + + return mask.type(dtype).to(device) if device is not None else mask.type(dtype) + + +def apply_cmvn(inputs, mvn): + device = inputs.device + dtype = inputs.dtype + frame, dim = inputs.shape + meams = np.tile(mvn[0:1, :dim], (frame, 1)) + vars = np.tile(mvn[1:2, :dim], (frame, 1)) + inputs -= torch.from_numpy(meams).type(dtype).to(device) + inputs *= torch.from_numpy(vars).type(dtype).to(device) + + return inputs.type(torch.float32) + + +def drop_and_add( + inputs: torch.Tensor, + outputs: torch.Tensor, + training: bool, + dropout_rate: float = 0.1, + stoch_layer_coeff: float = 1.0, +): + + outputs = F.dropout(outputs, p=dropout_rate, training=training, inplace=True) + outputs *= stoch_layer_coeff + + input_dim = inputs.size(-1) + output_dim = outputs.size(-1) + + if input_dim == output_dim: + outputs += inputs + return outputs + + +def proc_tf_vocab(vocab_path): + with open(vocab_path, encoding="utf-8") as f: + token_list = [line.rstrip() for line in f] + if "" not in token_list: + token_list.append("") + return token_list + + +def gen_config_for_tfmodel(config_path, vocab_path, output_dir): + token_list = proc_tf_vocab(vocab_path) + with open(config_path, encoding="utf-8") as f: + config = yaml.safe_load(f) + + config["token_list"] = token_list + + if not os.path.exists(output_dir): + os.makedirs(output_dir) + + with open(os.path.join(output_dir, "config.yaml"), "w", encoding="utf-8") as f: + yaml_no_alias_safe_dump(config, f, indent=4, sort_keys=False) + + +class NoAliasSafeDumper(yaml.SafeDumper): + # Disable anchor/alias in yaml because looks ugly + def ignore_aliases(self, data): + return True + + +def yaml_no_alias_safe_dump(data, stream=None, **kwargs): + """Safe-dump in yaml with no anchor/alias""" + return yaml.dump(data, stream, allow_unicode=True, Dumper=NoAliasSafeDumper, **kwargs) + + +if __name__ == "__main__": + import sys + + config_path = sys.argv[1] + vocab_path = sys.argv[2] + output_dir = sys.argv[3] + gen_config_for_tfmodel(config_path, vocab_path, output_dir) diff --git a/funasr/models/seaco_paraformer/__init__.py b/funasr/models/seaco_paraformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/seaco_paraformer/export_meta.py b/funasr/models/seaco_paraformer/export_meta.py new file mode 100644 index 0000000..6d8096f --- /dev/null +++ b/funasr/models/seaco_paraformer/export_meta.py @@ -0,0 +1,197 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch + +from funasr.register import tables + + +class ContextualEmbedderExport(torch.nn.Module): + def __init__( + self, + model, + max_seq_len=512, + feats_dim=560, + **kwargs, + ): + super().__init__() + self.embedding = model.decoder.embed # model.bias_embed + model.bias_encoder.batch_first = False + self.bias_encoder = model.bias_encoder + + def forward(self, hotword): + hotword = self.embedding(hotword).transpose(0, 1) # batch second + hw_embed, (_, _) = self.bias_encoder(hotword) + return hw_embed + + def export_dummy_inputs(self): + hotword = torch.tensor( + [ + [10, 11, 12, 13, 14, 10, 11, 12, 13, 14], + [100, 101, 0, 0, 0, 0, 0, 0, 0, 0], + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [10, 11, 12, 13, 14, 10, 11, 12, 13, 14], + [100, 101, 0, 0, 0, 0, 0, 0, 0, 0], + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ], + dtype=torch.int32, + ) + # hotword_length = torch.tensor([10, 2, 1], dtype=torch.int32) + return hotword + + def export_input_names(self): + return ["hotword"] + + def export_output_names(self): + return ["hw_embed"] + + def export_dynamic_axes(self): + return { + "hotword": { + 0: "num_hotwords", + }, + "hw_embed": { + 0: "num_hotwords", + }, + } + + def export_name(self): + return "model_eb.onnx" + + +def export_rebuild_model(model, **kwargs): + model.device = kwargs.get("device") + is_onnx = kwargs.get("type", "onnx") == "onnx" + encoder_class = tables.encoder_classes.get(kwargs["encoder"] + "Export") + model.encoder = encoder_class(model.encoder, onnx=is_onnx) + + predictor_class = tables.predictor_classes.get(kwargs["predictor"] + "Export") + model.predictor = predictor_class(model.predictor, onnx=is_onnx) + + # before decoder convert into export class + embedder_class = ContextualEmbedderExport + embedder_model = embedder_class(model, onnx=is_onnx) + + decoder_class = tables.decoder_classes.get(kwargs["decoder"] + "Export") + model.decoder = decoder_class(model.decoder, onnx=is_onnx) + + seaco_decoder_class = tables.decoder_classes.get(kwargs["seaco_decoder"] + "Export") + model.seaco_decoder = seaco_decoder_class(model.seaco_decoder, onnx=is_onnx) + + from funasr.utils.torch_function import sequence_mask + + model.make_pad_mask = sequence_mask(kwargs["max_seq_len"], flip=False) + + from funasr.utils.torch_function import sequence_mask + + model.make_pad_mask = sequence_mask(kwargs["max_seq_len"], flip=False) + model.feats_dim = 560 + model.NOBIAS = 8377 + + import copy + import types + + backbone_model = copy.copy(model) + + # backbone + backbone_model.forward = types.MethodType(export_backbone_forward, backbone_model) + backbone_model.export_dummy_inputs = types.MethodType( + export_backbone_dummy_inputs, backbone_model + ) + backbone_model.export_input_names = types.MethodType( + export_backbone_input_names, backbone_model + ) + backbone_model.export_output_names = types.MethodType( + export_backbone_output_names, backbone_model + ) + backbone_model.export_dynamic_axes = types.MethodType( + export_backbone_dynamic_axes, backbone_model + ) + backbone_model.export_name = types.MethodType(export_backbone_name, backbone_model) + + return backbone_model, embedder_model + + +def export_backbone_forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + bias_embed: torch.Tensor, + # lmbd: float, +): + # a. To device + batch = {"speech": speech, "speech_lengths": speech_lengths} + + enc, enc_len = self.encoder(**batch) + mask = self.make_pad_mask(enc_len)[:, None, :] + pre_acoustic_embeds, pre_token_length, alphas, pre_peak_index = self.predictor(enc, mask) + pre_token_length = pre_token_length.floor().type(torch.int32) + + decoder_out, decoder_hidden, _ = self.decoder( + enc, enc_len, pre_acoustic_embeds, pre_token_length, return_hidden=True, return_both=True + ) + decoder_out = torch.log_softmax(decoder_out, dim=-1) + # seaco forward + B, N, D = bias_embed.shape + _contextual_length = torch.ones(B) * N + + # ASF + hotword_scores = self.seaco_decoder.forward_asf6( + bias_embed, _contextual_length, decoder_hidden, pre_token_length + ) + hotword_scores = hotword_scores[0].sum(0).sum(0) + # _ = self.decoder2(bias_embed, _contextual_length, decoder_hidden, pre_token_length) + # hotword_scores = self.decoder2.model.decoders[-1].attn_mat[0][0].sum(0).sum(0) + dec_filter = torch.sort(hotword_scores, descending=True)[1][:51] + contextual_info = bias_embed[:, dec_filter] + num_hot_word = contextual_info.shape[1] + _contextual_length = torch.Tensor([num_hot_word]).int().repeat(B).to(enc.device) + + # again + cif_attended, _ = self.seaco_decoder( + contextual_info, _contextual_length, pre_acoustic_embeds, pre_token_length + ) + dec_attended, _ = self.seaco_decoder( + contextual_info, _contextual_length, decoder_hidden, pre_token_length + ) + merged = cif_attended + dec_attended + dha_output = self.hotword_output_layer(merged) + dha_pred = torch.log_softmax(dha_output, dim=-1) + # merging logits + dha_ids = dha_pred.max(-1)[-1] + dha_mask = (dha_ids == self.NOBIAS).int().unsqueeze(-1) + decoder_out = decoder_out * dha_mask + dha_pred * (1 - dha_mask) + return decoder_out, pre_token_length, alphas + + +def export_backbone_dummy_inputs(self): + speech = torch.randn(2, 30, self.feats_dim) + speech_lengths = torch.tensor([15, 30], dtype=torch.int32) + bias_embed = torch.randn(2, 1, 512) + return (speech, speech_lengths, bias_embed) + + +def export_backbone_input_names(self): + return ["speech", "speech_lengths", "bias_embed"] + + +def export_backbone_output_names(self): + return ["logits", "token_num", "alphas"] + + +def export_backbone_dynamic_axes(self): + return { + "speech": {0: "batch_size", 1: "feats_length"}, + "speech_lengths": { + 0: "batch_size", + }, + "bias_embed": {0: "batch_size", 1: "num_hotwords"}, + "logits": {0: "batch_size", 1: "logits_length"}, + "pre_acoustic_embeds": {1: "feats_length1"}, + } + + +def export_backbone_name(self): + return "model.onnx" diff --git a/funasr/models/seaco_paraformer/model.py b/funasr/models/seaco_paraformer/model.py new file mode 100644 index 0000000..3b6595c --- /dev/null +++ b/funasr/models/seaco_paraformer/model.py @@ -0,0 +1,628 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import os +import re +import time +import copy +import torch +import codecs +import logging +import tempfile +import requests +import numpy as np +from typing import Dict, Tuple +from contextlib import contextmanager +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.utils import postprocess_utils +from funasr.models.paraformer.model import Paraformer +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.search import Hypothesis +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.bicif_paraformer.model import BiCifParaformer +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.utils.timestamp_tools import ts_prediction_lfr6_standard +from funasr.models.transformer.utils.nets_utils import make_pad_mask, pad_list +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "SeacoParaformer") +class SeacoParaformer(BiCifParaformer, Paraformer): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + SeACo-Paraformer: A Non-Autoregressive ASR System with Flexible and Effective Hotword Customization Ability + https://arxiv.org/abs/2308.03266 + """ + + def __init__( + self, + *args, + **kwargs, + ): + super().__init__(*args, **kwargs) + + self.inner_dim = kwargs.get("inner_dim", 256) + self.bias_encoder_type = kwargs.get("bias_encoder_type", "lstm") + bias_encoder_dropout_rate = kwargs.get("bias_encoder_dropout_rate", 0.0) + bias_encoder_bid = kwargs.get("bias_encoder_bid", False) + seaco_lsm_weight = kwargs.get("seaco_lsm_weight", 0.0) + seaco_length_normalized_loss = kwargs.get("seaco_length_normalized_loss", True) + + # bias encoder + if self.bias_encoder_type == "lstm": + self.bias_encoder = torch.nn.LSTM( + self.inner_dim, + self.inner_dim, + 2, + batch_first=True, + dropout=bias_encoder_dropout_rate, + bidirectional=bias_encoder_bid, + ) + if bias_encoder_bid: + self.lstm_proj = torch.nn.Linear(self.inner_dim * 2, self.inner_dim) + else: + self.lstm_proj = None + # self.bias_embed = torch.nn.Embedding(self.vocab_size, self.inner_dim) + elif self.bias_encoder_type == "mean": + self.bias_embed = torch.nn.Embedding(self.vocab_size, self.inner_dim) + else: + logging.error("Unsupport bias encoder type: {}".format(self.bias_encoder_type)) + + # seaco decoder + seaco_decoder = kwargs.get("seaco_decoder", None) + if seaco_decoder is not None: + seaco_decoder_conf = kwargs.get("seaco_decoder_conf") + seaco_decoder_class = tables.decoder_classes.get(seaco_decoder) + self.seaco_decoder = seaco_decoder_class( + vocab_size=self.vocab_size, + encoder_output_size=self.inner_dim, + **seaco_decoder_conf, + ) + self.hotword_output_layer = torch.nn.Linear(self.inner_dim, self.vocab_size) + self.criterion_seaco = LabelSmoothingLoss( + size=self.vocab_size, + padding_idx=self.ignore_id, + smoothing=seaco_lsm_weight, + normalize_length=seaco_length_normalized_loss, + ) + self.train_decoder = kwargs.get("train_decoder", True) + self.seaco_weight = kwargs.get("seaco_weight", 0.01) + self.NO_BIAS = kwargs.get("NO_BIAS", 8377) + self.predictor_name = kwargs.get("predictor") + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + # Check that batch_size is unified + assert ( + speech.shape[0] == speech_lengths.shape[0] == text.shape[0] == text_lengths.shape[0] + ), (speech.shape, speech_lengths.shape, text.shape, text_lengths.shape) + + hotword_pad = kwargs.get("hotword_pad") + hotword_lengths = kwargs.get("hotword_lengths") + seaco_label_pad = kwargs.get("seaco_label_pad") + if len(hotword_lengths.size()) > 1: + hotword_lengths = hotword_lengths[:, 0] + + batch_size = speech.shape[0] + # for data-parallel + text = text[:, : text_lengths.max()] + speech = speech[:, : speech_lengths.max()] + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if self.predictor_bias == 1: + _, ys_pad = add_sos_eos(text, self.sos, self.eos, self.ignore_id) + ys_lengths = text_lengths + self.predictor_bias + + stats = dict() + loss_seaco = self._calc_seaco_loss( + encoder_out, + encoder_out_lens, + ys_pad, + ys_lengths, + hotword_pad, + hotword_lengths, + seaco_label_pad, + ) + if self.train_decoder: + loss_att, acc_att, _, _, _ = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + loss = loss_seaco + loss_att * self.seaco_weight + stats["loss_att"] = torch.clone(loss_att.detach()) + stats["acc_att"] = acc_att + else: + loss = loss_seaco + + stats["loss_seaco"] = torch.clone(loss_seaco.detach()) + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = (text_lengths + self.predictor_bias).sum() + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def _merge(self, cif_attended, dec_attended): + return cif_attended + dec_attended + + def calc_predictor(self, encoder_out, encoder_out_lens): + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + predictor_outs = self.predictor( + encoder_out, None, encoder_out_mask, ignore_id=self.ignore_id + ) + return predictor_outs[:4] + + def _calc_seaco_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_lengths: torch.Tensor, + hotword_pad: torch.Tensor, + hotword_lengths: torch.Tensor, + seaco_label_pad: torch.Tensor, + ): + # predictor forward + encoder_out_mask = ( + ~make_pad_mask(encoder_out_lens, maxlen=encoder_out.size(1))[:, None, :] + ).to(encoder_out.device) + pre_acoustic_embeds = self.predictor( + encoder_out, ys_pad, encoder_out_mask, ignore_id=self.ignore_id + )[0] + # decoder forward + decoder_out, _ = self.decoder( + encoder_out, encoder_out_lens, pre_acoustic_embeds, ys_lengths, return_hidden=True + ) + selected = self._hotword_representation(hotword_pad, hotword_lengths) + contextual_info = ( + selected.squeeze(0).repeat(encoder_out.shape[0], 1, 1).to(encoder_out.device) + ) + num_hot_word = contextual_info.shape[1] + _contextual_length = ( + torch.Tensor([num_hot_word]).int().repeat(encoder_out.shape[0]).to(encoder_out.device) + ) + # dha core + cif_attended, _ = self.seaco_decoder( + contextual_info, _contextual_length, pre_acoustic_embeds, ys_lengths + ) + dec_attended, _ = self.seaco_decoder( + contextual_info, _contextual_length, decoder_out, ys_lengths + ) + merged = self._merge(cif_attended, dec_attended) + dha_output = self.hotword_output_layer( + merged[:, :-1] + ) # remove the last token in loss calculation + loss_att = self.criterion_seaco(dha_output, seaco_label_pad) + return loss_att + + def _seaco_decode_with_ASF( + self, + encoder_out, + encoder_out_lens, + sematic_embeds, + ys_pad_lens, + hw_list, + nfilter=50, + seaco_weight=1.0, + ): + # decoder forward + + decoder_out, decoder_hidden, _ = self.decoder( + encoder_out, + encoder_out_lens, + sematic_embeds, + ys_pad_lens, + return_hidden=True, + return_both=True, + ) + + decoder_pred = torch.log_softmax(decoder_out, dim=-1) + if hw_list is not None: + hw_lengths = [len(i) for i in hw_list] + hw_list_ = [torch.Tensor(i).long() for i in hw_list] + hw_list_pad = pad_list(hw_list_, 0).to(encoder_out.device) + selected = self._hotword_representation( + hw_list_pad, torch.Tensor(hw_lengths).int().to(encoder_out.device) + ) + + contextual_info = ( + selected.squeeze(0).repeat(encoder_out.shape[0], 1, 1).to(encoder_out.device) + ) + num_hot_word = contextual_info.shape[1] + _contextual_length = ( + torch.Tensor([num_hot_word]) + .int() + .repeat(encoder_out.shape[0]) + .to(encoder_out.device) + ) + + # ASF Core + if nfilter > 0 and nfilter < num_hot_word: + hotword_scores = self.seaco_decoder.forward_asf6( + contextual_info, _contextual_length, decoder_hidden, ys_pad_lens + ) + hotword_scores = hotword_scores[0].sum(0).sum(0) + # hotword_scores /= torch.sqrt(torch.tensor(hw_lengths)[:-1].float()).to(hotword_scores.device) + dec_filter = torch.topk(hotword_scores, min(nfilter, num_hot_word - 1))[1].tolist() + add_filter = dec_filter + add_filter.append(len(hw_list_pad) - 1) + # filter hotword embedding + selected = selected[add_filter] + # again + contextual_info = ( + selected.squeeze(0).repeat(encoder_out.shape[0], 1, 1).to(encoder_out.device) + ) + num_hot_word = contextual_info.shape[1] + _contextual_length = ( + torch.Tensor([num_hot_word]) + .int() + .repeat(encoder_out.shape[0]) + .to(encoder_out.device) + ) + + # SeACo Core + cif_attended, _ = self.seaco_decoder( + contextual_info, _contextual_length, sematic_embeds, ys_pad_lens + ) + dec_attended, _ = self.seaco_decoder( + contextual_info, _contextual_length, decoder_hidden, ys_pad_lens + ) + merged = self._merge(cif_attended, dec_attended) + + dha_output = self.hotword_output_layer( + merged + ) # remove the last token in loss calculation + dha_pred = torch.log_softmax(dha_output, dim=-1) + + def _merge_res(dec_output, dha_output): + lmbd = torch.Tensor([seaco_weight] * dha_output.shape[0]) + dha_ids = dha_output.max(-1)[-1] # [0] + dha_mask = (dha_ids == self.NO_BIAS).int().unsqueeze(-1) + a = (1 - lmbd) / lmbd + b = 1 / lmbd + a, b = a.to(dec_output.device), b.to(dec_output.device) + dha_mask = (dha_mask + a.reshape(-1, 1, 1)) / b.reshape(-1, 1, 1) + # logits = dec_output * dha_mask + dha_output[:,:,:-1] * (1-dha_mask) + logits = dec_output * dha_mask + dha_output[:, :, :] * (1 - dha_mask) + return logits + + merged_pred = _merge_res(decoder_pred, dha_pred) + return merged_pred + else: + return decoder_pred + + def _hotword_representation(self, hotword_pad, hotword_lengths): + if self.bias_encoder_type != "lstm": + logging.error("Unsupported bias encoder type") + + """ + hw_embed = self.decoder.embed(hotword_pad) + hw_embed, (_, _) = self.bias_encoder(hw_embed) + if self.lstm_proj is not None: + hw_embed = self.lstm_proj(hw_embed) + _ind = np.arange(0, hw_embed.shape[0]).tolist() + selected = hw_embed[_ind, [i-1 for i in hotword_lengths.detach().cpu().tolist()]] + return selected + """ + + # hw_embed = self.sac_embedding(hotword_pad) + hw_embed = self.decoder.embed(hotword_pad) + hw_embed = torch.nn.utils.rnn.pack_padded_sequence( + hw_embed, + hotword_lengths.cpu().type(torch.int64), + batch_first=True, + enforce_sorted=False, + ) + packed_rnn_output, _ = self.bias_encoder(hw_embed) + rnn_output = torch.nn.utils.rnn.pad_packed_sequence(packed_rnn_output, batch_first=True)[0] + if self.lstm_proj is not None: + hw_hidden = self.lstm_proj(rnn_output) + else: + hw_hidden = rnn_output + _ind = np.arange(0, hw_hidden.shape[0]).tolist() + selected = hw_hidden[_ind, [i - 1 for i in hotword_lengths.detach().cpu().tolist()]] + return selected + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + # init beamsearch + is_use_ctc = kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None + is_use_lm = ( + kwargs.get("lm_weight", 0.0) > 0.00001 and kwargs.get("lm_file", None) is not None + ) + if self.beam_search is None and (is_use_lm or is_use_ctc): + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + meta_data = {} + + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, fs=frontend.fs, audio_fs=kwargs.get("fs", 16000) + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # hotword + self.hotword_list = self.generate_hotwords_list( + kwargs.get("hotword", None), tokenizer=tokenizer, frontend=frontend + ) + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # predictor + predictor_outs = self.calc_predictor(encoder_out, encoder_out_lens) + pre_acoustic_embeds, pre_token_length = predictor_outs[0], predictor_outs[1] + pre_token_length = pre_token_length.round().long() + if torch.max(pre_token_length) < 1: + return ([],) + + decoder_out = self._seaco_decode_with_ASF( + encoder_out, + encoder_out_lens, + pre_acoustic_embeds, + pre_token_length, + hw_list=self.hotword_list, + ) + + # decoder_out, _ = decoder_outs[0], decoder_outs[1] + if self.predictor_name == "CifPredictorV3": + _, _, us_alphas, us_peaks = self.calc_predictor_timestamp( + encoder_out, encoder_out_lens, pre_token_length + ) + else: + us_alphas = None + + results = [] + b, n, d = decoder_out.size() + for i in range(b): + x = encoder_out[i, : encoder_out_lens[i], :] + am_scores = decoder_out[i, : pre_token_length[i], :] + if self.beam_search is not None: + nbest_hyps = self.beam_search( + x=x, + am_scores=am_scores, + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + else: + + yseq = am_scores.argmax(dim=-1) + score = am_scores.max(dim=-1)[0] + score = torch.sum(score, dim=-1) + # pad with mask tokens to ensure compatibility with sos/eos tokens + yseq = torch.tensor([self.sos] + yseq.tolist() + [self.eos], device=yseq.device) + nbest_hyps = [Hypothesis(yseq=yseq, score=score)] + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + if tokenizer is not None: + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text = tokenizer.tokens2text(token) + if us_alphas is not None: + _, timestamp = ts_prediction_lfr6_standard( + us_alphas[i][: encoder_out_lens[i] * 3], + us_peaks[i][: encoder_out_lens[i] * 3], + copy.copy(token), + vad_offset=kwargs.get("begin_time", 0), + ) + text_postprocessed, time_stamp_postprocessed, _ = ( + postprocess_utils.sentence_postprocess(token, timestamp) + ) + result_i = { + "key": key[i], + "text": text_postprocessed, + "timestamp": time_stamp_postprocessed, + } + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["timestamp"][key[i]] = time_stamp_postprocessed + ibest_writer["text"][key[i]] = text_postprocessed + else: + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + result_i = {"key": key[i], "text": text_postprocessed} + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text_postprocessed + else: + result_i = {"key": key[i], "token_int": token_int} + results.append(result_i) + + return results, meta_data + + def generate_hotwords_list(self, hotword_list_or_file, tokenizer=None, frontend=None): + def load_seg_dict(seg_dict_file): + seg_dict = {} + assert isinstance(seg_dict_file, str) + with open(seg_dict_file, "r", encoding="utf8") as f: + lines = f.readlines() + for line in lines: + s = line.strip().split() + key = s[0] + value = s[1:] + seg_dict[key] = " ".join(value) + return seg_dict + + def seg_tokenize(txt, seg_dict): + pattern = re.compile(r"^[\u4E00-\u9FA50-9]+$") + out_txt = "" + for word in txt: + word = word.lower() + if word in seg_dict: + out_txt += seg_dict[word] + " " + else: + if pattern.match(word): + for char in word: + if char in seg_dict: + out_txt += seg_dict[char] + " " + else: + out_txt += "" + " " + else: + out_txt += "" + " " + return out_txt.strip().split() + + seg_dict = None + if frontend.cmvn_file is not None: + model_dir = os.path.dirname(frontend.cmvn_file) + seg_dict_file = os.path.join(model_dir, "seg_dict") + if os.path.exists(seg_dict_file): + seg_dict = load_seg_dict(seg_dict_file) + else: + seg_dict = None + # for None + if hotword_list_or_file is None: + hotword_list = None + # for local txt inputs + elif os.path.exists(hotword_list_or_file) and hotword_list_or_file.endswith(".txt"): + logging.info("Attempting to parse hotwords from local txt...") + hotword_list = [] + hotword_str_list = [] + with codecs.open(hotword_list_or_file, "r") as fin: + for line in fin.readlines(): + hw = line.strip() + hw_list = hw.split() + if seg_dict is not None: + hw_list = seg_tokenize(hw_list, seg_dict) + hotword_str_list.append(hw) + hotword_list.append(tokenizer.tokens2ids(hw_list)) + hotword_list.append([self.sos]) + hotword_str_list.append("") + logging.info( + "Initialized hotword list from file: {}, hotword list: {}.".format( + hotword_list_or_file, hotword_str_list + ) + ) + # for url, download and generate txt + elif hotword_list_or_file.startswith("http"): + logging.info("Attempting to parse hotwords from url...") + work_dir = tempfile.TemporaryDirectory().name + if not os.path.exists(work_dir): + os.makedirs(work_dir) + text_file_path = os.path.join(work_dir, os.path.basename(hotword_list_or_file)) + local_file = requests.get(hotword_list_or_file) + open(text_file_path, "wb").write(local_file.content) + hotword_list_or_file = text_file_path + hotword_list = [] + hotword_str_list = [] + with codecs.open(hotword_list_or_file, "r") as fin: + for line in fin.readlines(): + hw = line.strip() + hw_list = hw.split() + if seg_dict is not None: + hw_list = seg_tokenize(hw_list, seg_dict) + hotword_str_list.append(hw) + hotword_list.append(tokenizer.tokens2ids(hw_list)) + hotword_list.append([self.sos]) + hotword_str_list.append("") + logging.info( + "Initialized hotword list from file: {}, hotword list: {}.".format( + hotword_list_or_file, hotword_str_list + ) + ) + # for text str input + elif not hotword_list_or_file.endswith(".txt"): + logging.info("Attempting to parse hotwords as str...") + hotword_list = [] + hotword_str_list = [] + for hw in hotword_list_or_file.strip().split(): + hotword_str_list.append(hw) + hw_list = hw.strip().split() + if seg_dict is not None: + hw_list = seg_tokenize(hw_list, seg_dict) + hotword_list.append(tokenizer.tokens2ids(hw_list)) + hotword_list.append([self.sos]) + hotword_str_list.append("") + logging.info("Hotword list: {}.".format(hotword_str_list)) + else: + hotword_list = None + return hotword_list + + def export( + self, + **kwargs, + ): + if "max_seq_len" not in kwargs: + kwargs["max_seq_len"] = 512 + from .export_meta import export_rebuild_model + + models = export_rebuild_model(model=self, **kwargs) + return models diff --git a/funasr/models/seaco_paraformer/template.yaml b/funasr/models/seaco_paraformer/template.yaml new file mode 100644 index 0000000..fcaf524 --- /dev/null +++ b/funasr/models/seaco_paraformer/template.yaml @@ -0,0 +1,156 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: SeacoParaformer +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + predictor_weight: 1.0 + predictor_bias: 1 + sampling_ratio: 0.75 + inner_dim: 512 + bias_encoder_type: lstm + bias_encoder_bid: false + seaco_lsm_weight: 0.1 + seaco_length_normal: true + train_decoder: false + NO_BIAS: 8377 + +# encoder +encoder: SANMEncoder +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + +# decoder +decoder: ParaformerSANMDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 0 + +# seaco decoder +seaco_decoder: ParaformerSANMDecoder +seaco_decoder_conf: + attention_heads: 4 + linear_units: 1024 + num_blocks: 4 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + kernel_size: 21 + sanm_shfit: 0 + use_output_layer: false + wo_input_layer: true + +predictor: CifPredictorV3 +predictor_conf: + idim: 512 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 + smooth_factor2: 0.25 + noise_threshold2: 0.01 + upsample_times: 3 + use_cif1_cnn: false + upsample_type: cnn_blstm + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + dither: 0.0 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/sense_voice/__init__.py b/funasr/models/sense_voice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/sense_voice/cuda/wkv5_cuda.cu b/funasr/models/sense_voice/cuda/wkv5_cuda.cu new file mode 100644 index 0000000..3e6b859 --- /dev/null +++ b/funasr/models/sense_voice/cuda/wkv5_cuda.cu @@ -0,0 +1,202 @@ +#include +#include +#include "ATen/ATen.h" +typedef at::BFloat16 bf16; + +template +__global__ void kernel_forward(const int B, const int T, const int C, const int H, + const F *__restrict__ const _r, const F *__restrict__ const _k, const F *__restrict__ const _v, const float *__restrict__ _w, const F *__restrict__ _u, + F *__restrict__ const _y) +{ + const int b = blockIdx.x / H; + const int h = blockIdx.x % H; + const int i = threadIdx.x; + _w += h*_N_; + _u += h*_N_; + + __shared__ float r[_N_], k[_N_], u[_N_], w[_N_]; + float state[_N_] = {0}; + + __syncthreads(); + w[i] = _w[i]; + u[i] = float(_u[i]); + __syncthreads(); + + for (int t = b*T*C + h*_N_ + i; t < (b+1)*T*C + h*_N_ + i; t += C) + { + __syncthreads(); + r[i] = float(_r[t]); + k[i] = float(_k[t]); + __syncthreads(); + + const float v = float(_v[t]); + float y = 0; + + #pragma unroll + for (int j = 0; j < _N_; j+=4) + { + const float4& r_ = (float4&)(r[j]); + const float4& k_ = (float4&)(k[j]); + const float4& w_ = (float4&)(w[j]); + const float4& u_ = (float4&)(u[j]); + float4& s = (float4&)(state[j]); + float4 x; + + x.x = k_.x * v; + x.y = k_.y * v; + x.z = k_.z * v; + x.w = k_.w * v; + + y += r_.x * (u_.x * x.x + s.x); + y += r_.y * (u_.y * x.y + s.y); + y += r_.z * (u_.z * x.z + s.z); + y += r_.w * (u_.w * x.w + s.w); + + s.x = s.x * w_.x + x.x; + s.y = s.y * w_.y + x.y; + s.z = s.z * w_.z + x.z; + s.w = s.w * w_.w + x.w; + } + _y[t] = F(y); + } +} + +template +__global__ void kernel_backward(const int B, const int T, const int C, const int H, + const F *__restrict__ const _r, const F *__restrict__ const _k, const F *__restrict__ const _v, const float *__restrict__ _w, const float *__restrict__ __w, const F *__restrict__ _u, const F *__restrict__ const _gy, + F *__restrict__ const _gr, F *__restrict__ const _gk, F *__restrict__ const _gv, F *__restrict__ const _gw, F *__restrict__ const _gu) +{ + const int b = blockIdx.x / H; + const int h = blockIdx.x % H; + const int i = threadIdx.x; + _w += h*_N_; + _u += h*_N_; + __w += h*_N_; + + __shared__ float w_[_N_], u_[_N_]; + __shared__ float r[_N_], k[_N_], v[_N_], gy[_N_]; + __syncthreads(); + w_[i] = _w[i]; + u_[i] = float(_u[i]); + __syncthreads(); + + const float w = w_[i]; + const float ww = __w[i]; + const float u = u_[i]; + + float state[_N_] = {0}, saaaa[_N_] = {0}, sbbbb[_N_] = {0}, scccc[_N_] = {0}, sdddd[_N_] = {0}; + + float gw = 0, gu = 0; + const int t000 = b*T*C + h*_N_ + i; + const int t111 = (b+1)*T*C + h*_N_ + i; + const int t222 = t111 - 2*C; + + for (int t = t000; t < t111; t += C) + { + __syncthreads(); + v[i] = float(_v[t]); + gy[i] = float(_gy[t]); + __syncthreads(); + + const float k = float(_k[t]); + float gr = 0, gu_ = 0; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = state[j]; + float x = k * v[j]; + + gr += (u * x + s) * gy[j]; + gu_ += x * gy[j]; + s = s * w + x; + } + _gr[t] = F(gr); + gu += float(_r[t]) * gu_; + } + _gu[b*C + h*_N_ + i] = F(gu); + + for (int t = t000; t < t222; t += C) + { + __syncthreads(); + v[i] = float(_v[t]); + gy[i] = float(_gy[t + 2*C]); + __syncthreads(); + + const float k = float(_k[t]); + float gw_ = 0; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = saaaa[j]; + float& s2 = sbbbb[j]; + float x = k * v[j]; + + float tmp = w * (x + s); + s = tmp; + s2 = tmp + w * s2; + gw_ += s2 * gy[j]; + } + gw += float(_r[t + 2*C]) * gw_; + } + _gw[b*C + h*_N_ + i] = F(ww * gw); + + for (int t = t111 - C; t >= t000; t -= C) + { + __syncthreads(); + v[i] = float(_v[t]); + gy[i] = float(_gy[t]); + __syncthreads(); + + const float rr = float(_r[t]); + float gk = 0; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = scccc[j]; + float x = rr * gy[j]; + + gk += (u * x + s) * v[j]; + s = x + s * w; + } + _gk[t] = F(gk); + } + + for (int t = t111 - C; t >= t000; t -= C) + { + __syncthreads(); + r[i] = float(_r[t]); + k[i] = float(_k[t]); + __syncthreads(); + + const float gyy = float(_gy[t]); + float gv = 0; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = sdddd[j]; + float x = gyy * r[j]; + + gv += (u_[j] * x + s) * k[j]; + s = x + s * w_[j]; + } + _gv[t] = F(gv); + } +} + +void cuda_forward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, bf16 *u, bf16 *y) +{ + assert(H*_N_ == C); + assert(_N_%4 == 0); + kernel_forward<<>>(B, T, C, H, r, k, v, w, u, y); +} + +void cuda_backward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, float *ww, bf16 *u, bf16 *gy, bf16 *gr, bf16 *gk, bf16 *gv, bf16 *gw, bf16 *gu) +{ + assert(H*_N_ == C); + assert(_N_%4 == 0); + kernel_backward<<>>(B, T, C, H, r, k, v, w, ww, u, gy, gr, gk, gv, gw, gu); +} diff --git a/funasr/models/sense_voice/cuda/wkv5_op.cpp b/funasr/models/sense_voice/cuda/wkv5_op.cpp new file mode 100644 index 0000000..4c9ece1 --- /dev/null +++ b/funasr/models/sense_voice/cuda/wkv5_op.cpp @@ -0,0 +1,22 @@ +#include +#include "ATen/ATen.h" +typedef at::BFloat16 bf16; + +void cuda_forward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, bf16 *u, bf16 *y); +void cuda_backward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, float *ww, bf16 *u, bf16 *gy, bf16 *gr, bf16 *gk, bf16 *gv, bf16 *gw, bf16 *gu); + +void forward(int64_t B, int64_t T, int64_t C, int64_t H, torch::Tensor &r, torch::Tensor &k, torch::Tensor &v, torch::Tensor &w, torch::Tensor &u, torch::Tensor &y) { + cuda_forward(B, T, C, H, r.data_ptr(), k.data_ptr(), v.data_ptr(), w.data_ptr(), u.data_ptr(), y.data_ptr()); +} +void backward(int64_t B, int64_t T, int64_t C, int64_t H, torch::Tensor &r, torch::Tensor &k, torch::Tensor &v, torch::Tensor &w, torch::Tensor &ww, torch::Tensor &u, torch::Tensor &gy, torch::Tensor &gr, torch::Tensor &gk, torch::Tensor &gv, torch::Tensor &gw, torch::Tensor &gu) { + cuda_backward(B, T, C, H, r.data_ptr(), k.data_ptr(), v.data_ptr(), w.data_ptr(), ww.data_ptr(), u.data_ptr(), gy.data_ptr(), gr.data_ptr(), gk.data_ptr(), gv.data_ptr(), gw.data_ptr(), gu.data_ptr()); +} +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.def("forward", &forward, "wkv5 forward"); + m.def("backward", &backward, "wkv5 backward"); +} + +TORCH_LIBRARY(wkv5, m) { + m.def("forward", forward); + m.def("backward", backward); +} diff --git a/funasr/models/sense_voice/cuda/wkv6_cuda.cu b/funasr/models/sense_voice/cuda/wkv6_cuda.cu new file mode 100644 index 0000000..d98f57f --- /dev/null +++ b/funasr/models/sense_voice/cuda/wkv6_cuda.cu @@ -0,0 +1,243 @@ +#include +#include +#include "ATen/ATen.h" +typedef at::BFloat16 bf16; +// typedef float bf16; + +template +__global__ void kernel_forward(const int B, const int T, const int C, const int H, + const F *__restrict__ const _r, const F *__restrict__ const _k, const F *__restrict__ const _v, const float *__restrict__ _w, const F *__restrict__ _u, + F *__restrict__ const _y) +{ + const int b = blockIdx.x / H; + const int h = blockIdx.x % H; + const int i = threadIdx.x; + _u += h*_N_; + + __shared__ float r[_N_], k[_N_], u[_N_], w[_N_]; + float state[_N_] = {0}; + + __syncthreads(); + u[i] = float(_u[i]); + __syncthreads(); + + for (int t = b*T*C + h*_N_ + i; t < (b+1)*T*C + h*_N_ + i; t += C) + { + __syncthreads(); + w[i] = exp(_w[t]); + r[i] = float(_r[t]); + k[i] = float(_k[t]); + __syncthreads(); + + const float v = float(_v[t]); + float y = 0; + + #pragma unroll + for (int j = 0; j < _N_; j+=4) + { + const float4& r_ = (float4&)(r[j]); + const float4& k_ = (float4&)(k[j]); + const float4& w_ = (float4&)(w[j]); + const float4& u_ = (float4&)(u[j]); + float4& s = (float4&)(state[j]); + float4 x; + + x.x = k_.x * v; + x.y = k_.y * v; + x.z = k_.z * v; + x.w = k_.w * v; + + y += r_.x * (u_.x * x.x + s.x); + y += r_.y * (u_.y * x.y + s.y); + y += r_.z * (u_.z * x.z + s.z); + y += r_.w * (u_.w * x.w + s.w); + + s.x = s.x * w_.x + x.x; + s.y = s.y * w_.y + x.y; + s.z = s.z * w_.z + x.z; + s.w = s.w * w_.w + x.w; + } + _y[t] = F(y); + } +} + +template +__global__ void kernel_backward_111(const int B, const int T, const int C, const int H, + const F *__restrict__ const _r, const F *__restrict__ const _k, const F *__restrict__ const _v, const float *__restrict__ _w, const F *__restrict__ _u, const F *__restrict__ const _gy, + F *__restrict__ const _gr, F *__restrict__ const _gk, F *__restrict__ const _gv, F *__restrict__ const _gu) +{ + const int b = blockIdx.x / H; + const int h = blockIdx.x % H; + const int i = threadIdx.x; + _u += h*_N_; + + __shared__ float u_[_N_]; + __shared__ float r[_N_], k[_N_], v[_N_], w_[_N_], gy[_N_]; + __syncthreads(); + u_[i] = float(_u[i]); + __syncthreads(); + + const float u = u_[i]; + + float state[_N_] = {0}, scccc[_N_] = {0}, sdddd[_N_] = {0}; + + const int t_0 = b*T*C + h*_N_ + i; + const int t_T_1 = t_0 + (T-1)*C; + const int t_T = t_0 + T*C; + + float gu = 0; + for (int t = t_0; t < t_T; t += C) + { + __syncthreads(); + v[i] = float(_v[t]); + gy[i] = float(_gy[t]); + __syncthreads(); + + const float k = float(_k[t]); + const float w = exp(_w[t]); + float gr = 0, gu_ = 0; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = state[j]; + float x = k * v[j]; + + gr += (u * x + s) * gy[j]; + gu_ += x * gy[j]; + s = s * w + x; + } + _gr[t] = F(gr); + gu += float(_r[t]) * gu_; + } + _gu[b*C + h*_N_ + i] = F(gu); + + for (int t = t_T_1; t >= t_0; t -= C) + { + __syncthreads(); + v[i] = float(_v[t]); + gy[i] = float(_gy[t]); + __syncthreads(); + + const float rr = float(_r[t]); + const float w = exp(_w[t]); + float gk = 0; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = scccc[j]; + float x = rr * gy[j]; + + gk += (u * x + s) * v[j]; + s = x + s * w; + } + _gk[t] = F(gk); + } + + for (int t = t_T_1; t >= t_0; t -= C) + { + __syncthreads(); + r[i] = float(_r[t]); + k[i] = float(_k[t]); + w_[i] = exp(_w[t]); + __syncthreads(); + + const float gyy = float(_gy[t]); + float gv = 0; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = sdddd[j]; + float x = gyy * r[j]; + + gv += (u_[j] * x + s) * k[j]; + s = x + s * w_[j]; + } + _gv[t] = F(gv); + } +} + +template +__global__ void kernel_backward_222(const int B, const int T, const int C, const int H, + const F *__restrict__ const _r, const F *__restrict__ const _k, const F *__restrict__ const _v, const float *__restrict__ _w, const F *__restrict__ _u, const F *__restrict__ const _gy, + F *__restrict__ const _gw) +{ + const int b = blockIdx.x / H; + const int h = blockIdx.x % H; + const int i = threadIdx.x; + + __shared__ float v[_N_], gy[_N_]; + float saaaa[_N_] = {0}, sbbbb[_T_-2] = {0}, scccc[_N_] = {0}; + + const int t_0 = b*T*C + h*_N_ + i; + const int t_1 = t_0 + C; + const int t_2 = t_0 + 2*C; + const int t_T_1 = t_0 + (T-1)*C; + + for (int t = t_T_1; t > t_1; t -= C) + { + __syncthreads(); + gy[i] = float(_gy[t]); + v[i] = float(_v[t-2*C]); + __syncthreads(); + + const float r = float(_r[t]); + const float w = exp(_w[t-C]); + float sum = 0.0f; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = saaaa[j]; + float x = r * gy[j]; + s = (s + x) * w; + sum += s * v[j]; + } + sbbbb[(t-t_2)/C] = sum * float(_k[t-2*C]); + } + + float sss = sbbbb[0]; + _gw[t_0] = 0; + _gw[t_1] = F(sss * _w[t_1]); + + for (int t = t_2; t < t_T_1; t += C) + { + __syncthreads(); + gy[i] = float(_gy[t]); + v[i] = float(_v[t-2*C]); + __syncthreads(); + + const float w = exp(_w[t-C]); + const float k = float(_k[t-2*C]); + float sum = 0.0f; + + #pragma unroll + for (int j = 0; j < _N_; j++) + { + float& s = scccc[j]; + float x = k * v[j]; + s = (s + x) * w; + sum += s * gy[j]; + } + sss += sbbbb[(t-t_1)/C] - (sum * float(_r[t])); + _gw[t] = F(sss * _w[t]); + } + _gw[t_T_1] = 0; +} + +void cuda_forward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, bf16 *u, bf16 *y) +{ + assert(H*_N_ == C); + assert(_N_%4 == 0); + kernel_forward<<>>(B, T, C, H, r, k, v, w, u, y); +} + +void cuda_backward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, bf16 *u, bf16 *gy, bf16 *gr, bf16 *gk, bf16 *gv, bf16 *gw, bf16 *gu) +{ + assert(H*_N_ == C); + assert(_N_%4 == 0); + kernel_backward_111<<>>(B, T, C, H, r, k, v, w, u, gy, gr, gk, gv, gu); + kernel_backward_222<<>>(B, T, C, H, r, k, v, w, u, gy, gw); +} diff --git a/funasr/models/sense_voice/cuda/wkv6_op.cpp b/funasr/models/sense_voice/cuda/wkv6_op.cpp new file mode 100644 index 0000000..22da520 --- /dev/null +++ b/funasr/models/sense_voice/cuda/wkv6_op.cpp @@ -0,0 +1,23 @@ +#include +#include "ATen/ATen.h" + typedef at::BFloat16 bf16; +//typedef float bf16; + +void cuda_forward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, bf16 *u, bf16 *y); +void cuda_backward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, bf16 *u, bf16 *gy, bf16 *gr, bf16 *gk, bf16 *gv, bf16 *gw, bf16 *gu); + +void forward(int64_t B, int64_t T, int64_t C, int64_t H, torch::Tensor &r, torch::Tensor &k, torch::Tensor &v, torch::Tensor &w, torch::Tensor &u, torch::Tensor &y) { + cuda_forward(B, T, C, H, r.data_ptr(), k.data_ptr(), v.data_ptr(), w.data_ptr(), u.data_ptr(), y.data_ptr()); +} +void backward(int64_t B, int64_t T, int64_t C, int64_t H, torch::Tensor &r, torch::Tensor &k, torch::Tensor &v, torch::Tensor &w, torch::Tensor &u, torch::Tensor &gy, torch::Tensor &gr, torch::Tensor &gk, torch::Tensor &gv, torch::Tensor &gw, torch::Tensor &gu) { + cuda_backward(B, T, C, H, r.data_ptr(), k.data_ptr(), v.data_ptr(), w.data_ptr(), u.data_ptr(), gy.data_ptr(), gr.data_ptr(), gk.data_ptr(), gv.data_ptr(), gw.data_ptr(), gu.data_ptr()); +} +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.def("forward", &forward, "wkv6 forward"); + m.def("backward", &backward, "wkv6 backward"); +} + +TORCH_LIBRARY(wkv6, m) { + m.def("forward", forward); + m.def("backward", backward); +} diff --git a/funasr/models/sense_voice/cuda/wkv_cuda.cu b/funasr/models/sense_voice/cuda/wkv_cuda.cu new file mode 100644 index 0000000..6acd0f3 --- /dev/null +++ b/funasr/models/sense_voice/cuda/wkv_cuda.cu @@ -0,0 +1,125 @@ +#include +#include + +#define MIN_VALUE (-1e38) + +template +__global__ void kernel_forward(const int B, const int T, const int C, + const F *__restrict__ const _w, const F *__restrict__ const _u, const F *__restrict__ const _k, const F *__restrict__ const _v, + F *__restrict__ const _y) { + const int idx = blockIdx.x * blockDim.x + threadIdx.x; + const int _b = idx / C; + const int _c = idx % C; + const int _offset = _b * T * C + _c; + + F u = _u[_c]; + F w = _w[_c]; + const F *__restrict__ const k = _k + _offset; + const F *__restrict__ const v = _v + _offset; + F *__restrict__ const y = _y + _offset; + + F p = 0, q = 0, o = MIN_VALUE; + // p and q are running sums divided by exp(o) (to avoid overflows) + for (int i = 0; i < T; i++) { + const int ii = i * C; + + F no = max(o, u + k[ii]); + F A = exp(o - no); + F B = exp(u + k[ii] - no); + y[ii] = (A * p + B * v[ii]) / (A * q + B); + + no = max(w + o, k[ii]); + A = exp(w + o - no); + B = exp(k[ii] - no); + p = A * p + B * v[ii]; + q = A * q + B; + o = no; + } +} + +template +__global__ void kernel_backward(const int B, const int T, const int C, + const F *__restrict__ const _w, const F *__restrict__ const _u, const F *__restrict__ const _k, const F *__restrict__ const _v, const F *__restrict__ const _gy, + F *__restrict__ const _gw, F *__restrict__ const _gu, F *__restrict__ const _gk, F *__restrict__ const _gv) { + const int idx = blockIdx.x * blockDim.x + threadIdx.x; + const int _b = idx / C; + const int _c = idx % C; + const int _offset = _b * T * C + _c; + + F u = _u[_c]; + F w = _w[_c]; + const F *__restrict__ const k = _k + _offset; + const F *__restrict__ const v = _v + _offset; + const F *__restrict__ const gy = _gy + _offset; + + F *__restrict__ const gk = _gk + _offset; + F *__restrict__ const gv = _gv + _offset; + + F y[Tmax], z[Tmax], zexp[Tmax]; + + F gw = 0, gu = 0; + F p = 0, q = 0; + F dpdw = 0, dqdw = 0; + F o = MIN_VALUE; + for (int i = 0; i < T; i++) { + const int ii = i * C; + F no = max(o, k[ii] + u); + F A = exp(o - no); + F B = exp(k[ii] + u - no); + + F num = A * p + B * v[ii]; + F iden = 1 / (A * q + B); + + y[i] = num * iden; + z[i] = iden; + zexp[i] = k[ii] + u - no; + + gw += gy[ii] * (dpdw - dqdw * y[i]) * iden * A; + gu += gy[ii] * (v[ii] - y[i]) * B * iden; + + no = max(w + o, k[ii]); + A = exp(w + o - no); + B = exp(k[ii] - no); + dpdw = A * (p + dpdw); + dqdw = A * (q + dqdw); + p = A * p + B * v[ii]; + q = A * q + B; + o = no; + } + + F gp = 0, gq = 0; + o = MIN_VALUE; + for (int i = T - 1; i >= 0; i--) { + const int ii = i * C; + F A = gy[ii] * z[i] * exp(zexp[i]); + F B = exp(k[ii] + o); + gk[ii] = A * (v[ii] - y[i]) + B * (gp * v[ii] + gq); + gv[ii] = A + B * gp; + + F no = max(w + o, zexp[i] - k[ii] - u); + A = exp(w + o - no); + B = gy[ii] * z[i] * exp(zexp[i] - k[ii] - u - no); + gp = A * gp + B; + gq = A * gq - B * y[i]; + o = no; + } + + // Multiply by w because the w -> -exp(w) preprocessing is halfway in the backwards pass, even though it's not in the forward pass + const int _offsetBC = _b * C + _c; + _gw[_offsetBC] += gw * _w[_c]; + _gu[_offsetBC] += gu; +} + +void cuda_forward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y) { + dim3 threadsPerBlock( min(C, 32) ); // requires --maxrregcount 60 for optimal performance + assert(B * C % threadsPerBlock.x == 0); + dim3 numBlocks(B * C / threadsPerBlock.x); + kernel_forward<<>>(B, T, C, w, u, k, v, y); +} + +void cuda_backward(int B, int T, int C, float *w, float *u, float *k, float *v, float *gy, float *gw, float *gu, float *gk, float *gv) { + dim3 threadsPerBlock( min(C, 32) ); // requires --maxrregcount 60 for optimal performance + assert(B * C % threadsPerBlock.x == 0); + dim3 numBlocks(B * C / threadsPerBlock.x); + kernel_backward<<>>(B, T, C, w, u, k, v, gy, gw, gu, gk, gv); +} diff --git a/funasr/models/sense_voice/cuda/wkv_op.cpp b/funasr/models/sense_voice/cuda/wkv_op.cpp new file mode 100644 index 0000000..efe56d8 --- /dev/null +++ b/funasr/models/sense_voice/cuda/wkv_op.cpp @@ -0,0 +1,21 @@ +#include + +void cuda_forward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y); +void cuda_backward(int B, int T, int C, float *w, float *u, float *k, float *v, float *gy, float *gw, float *gu, float *gk, float *gv); + +void forward(int64_t B, int64_t T, int64_t C, torch::Tensor &w, torch::Tensor &u, torch::Tensor &k, torch::Tensor &v, torch::Tensor &y) { + cuda_forward(B, T, C, w.data_ptr(), u.data_ptr(), k.data_ptr(), v.data_ptr(), y.data_ptr()); +} +void backward(int64_t B, int64_t T, int64_t C, torch::Tensor &w, torch::Tensor &u, torch::Tensor &k, torch::Tensor &v, torch::Tensor &gy, torch::Tensor &gw, torch::Tensor &gu, torch::Tensor &gk, torch::Tensor &gv) { + cuda_backward(B, T, C, w.data_ptr(), u.data_ptr(), k.data_ptr(), v.data_ptr(), gy.data_ptr(), gw.data_ptr(), gu.data_ptr(), gk.data_ptr(), gv.data_ptr()); +} + +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.def("forward", &forward, "wkv forward"); + m.def("backward", &backward, "wkv backward"); +} + +TORCH_LIBRARY(wkv, m) { + m.def("forward", forward); + m.def("backward", backward); +} diff --git a/funasr/models/sense_voice/decoder.py b/funasr/models/sense_voice/decoder.py new file mode 100644 index 0000000..03b7532 --- /dev/null +++ b/funasr/models/sense_voice/decoder.py @@ -0,0 +1,604 @@ +import copy +from typing import Optional, Tuple, Union + +import torch +import torch.nn as nn +import torch.nn.functional as F +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.register import tables +import base64 +import gzip +from dataclasses import dataclass +from typing import Dict, Iterable, Optional + +import numpy as np +import torch +import torch.nn.functional as F +from torch import Tensor, nn +from funasr.models.transformer.utils.mask import subsequent_mask + + +class LayerNorm(nn.LayerNorm): + def forward(self, x: Tensor) -> Tensor: + return super().forward(x.float()).type(x.dtype) + + +class Linear(nn.Linear): + def forward(self, x: Tensor) -> Tensor: + return F.linear( + x, + self.weight.to(x.dtype), + None if self.bias is None else self.bias.to(x.dtype), + ) + + +def sense_voice_decode_forward( + self, + x: torch.Tensor, + xa: torch.Tensor, + kv_cache: Optional[dict] = None, + **kwargs, +): + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + # import pdb;pdb.set_trace() + use_padmask = self.use_padmask + hlens = kwargs.get("hlens", None) + + ys_in_lens = kwargs.get("ys_in_lens", None) + + offset = next(iter(kv_cache.values())).shape[1] if kv_cache else 0 + tgt, memory = x, xa + tgt[tgt == -1] = 0 + tgt = self.token_embedding(tgt) + self.positional_embedding[offset : offset + tgt.size(1)] + # tgt = self.dropout(tgt) + + x = tgt.to(memory.dtype) + + if use_padmask and hlens is not None: + memory_mask = (~make_pad_mask(hlens)[:, None, :]).to(memory.device) + else: + memory_mask = None + + for layer, block in enumerate(self.blocks): + x = block( + x, + memory, + mask=self.mask, + memory_mask=memory_mask, + is_pad_mask=False, + is_pad_memory_mask=True, + ) + + x = self.ln(x) + x = (x @ torch.transpose(self.token_embedding.weight.to(x.dtype), 0, 1)).float() + + return x + + +class MultiHeadAttention(nn.Module): + def __init__(self, n_state: int, n_head: int): + super().__init__() + self.n_head = n_head + self.query = Linear(n_state, n_state) + self.key = Linear(n_state, n_state, bias=False) + self.value = Linear(n_state, n_state) + self.out = Linear(n_state, n_state) + + def forward( + self, + x: Tensor, + xa: Optional[Tensor] = None, + mask: Optional[Tensor] = None, + kv_cache: Optional[dict] = None, + **kwargs, + ): + is_pad_mask = kwargs.get("is_pad_mask", False) + + q = self.query(x) + + if kv_cache is None or xa is None or self.key not in kv_cache: + # hooks, if installed (i.e. kv_cache is not None), will prepend the cached kv tensors; + # otherwise, perform key/value projections for self- or cross-attention as usual. + k = self.key(x if xa is None else xa) + v = self.value(x if xa is None else xa) + else: + # for cross-attention, calculate keys and values once and reuse in subsequent calls. + k = kv_cache[self.key] + v = kv_cache[self.value] + + wv, qk = self.qkv_attention(q, k, v, mask, is_pad_mask=is_pad_mask) + return self.out(wv), qk + + def qkv_attention( + self, + q: Tensor, + k: Tensor, + v: Tensor, + mask: Optional[Tensor] = None, + **kwargs, + ): + is_pad_mask = kwargs.get("is_pad_mask", False) + n_batch, n_ctx, n_state = q.shape + scale = (n_state // self.n_head) ** -0.25 + q = q.view(*q.shape[:2], self.n_head, -1).permute(0, 2, 1, 3) * scale + k = k.view(*k.shape[:2], self.n_head, -1).permute(0, 2, 3, 1) * scale + v = v.view(*v.shape[:2], self.n_head, -1).permute(0, 2, 1, 3) + + qk = q @ k + if mask is not None: + if not is_pad_mask: + qk = qk + mask[:n_ctx, :n_ctx] + else: + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + min_value = float(np.finfo(torch.tensor(0, dtype=qk.dtype).numpy().dtype).min) + qk = qk.masked_fill(mask, min_value) + + qk = qk.float() + + w = F.softmax(qk, dim=-1).to(q.dtype) + if mask is not None and is_pad_mask: + w = w.masked_fill(mask, 0.0) + return (w @ v).permute(0, 2, 1, 3).flatten(start_dim=2), qk.detach() + + +from omegaconf import OmegaConf + + +class ResidualAttentionBlockRWKV(nn.Module): + def __init__( + self, n_state: int, n_head: int, cross_attention: bool = False, layer_id=0, **kwargs + ): + super().__init__() + + rwkv_cfg = kwargs.get("rwkv_cfg", {}) + args = OmegaConf.create(rwkv_cfg) + if args.get("version", "v4") == "v4": + from funasr.models.sense_voice.rwkv_v4 import RWKVLayer + from funasr.models.sense_voice.rwkv_v4 import RWKV_TimeMix as RWKV_Tmix + elif args.get("version", "v5") == "v5": + from funasr.models.sense_voice.rwkv_v5 import RWKVLayer + from funasr.models.sense_voice.rwkv_v5 import RWKV_Tmix_x052 as RWKV_Tmix + else: + from funasr.models.sense_voice.rwkv_v6 import RWKVLayer + from funasr.models.sense_voice.rwkv_v6 import RWKV_Tmix_x060 as RWKV_Tmix + # self.att = RWKVLayer(args=args, layer_id=layer_id) + self.att = RWKV_Tmix(args, layer_id=layer_id) + + if args.get("init_rwkv", True): + print("init_rwkv") + nn.init.orthogonal_(self.att.receptance.weight, gain=1) + nn.init.orthogonal_(self.att.key.weight, gain=0.1) + nn.init.orthogonal_(self.att.value.weight, gain=1) + nn.init.orthogonal_(self.att.gate.weight, gain=0.1) + nn.init.zeros_(self.att.output.weight) + + self.ln0 = None + if layer_id == 0 and not args.get("ln0", True): + self.ln0 = LayerNorm(args.n_embd) + if args.get("init_rwkv", True): + print("init_rwkv") + layer_id = 0 + scale = ((1 + layer_id) / args.get("n_layer")) ** 0.7 + nn.init.constant_(self.ln0.weight, scale) + + self.layer_id = layer_id + self.args = args + + self.ln1 = None + if not args.get("ln1", True): + self.ln1 = LayerNorm(args.n_embd) + # init + if args.get("init_rwkv", True): + print("init_rwkv") + scale = ((1 + layer_id) / args.get("n_layer")) ** 0.7 + nn.init.constant_(self.ln1.weight, scale) + + if args.get("datatype", "bf16") == "bf16": + self.att.to(torch.bfloat16) + # if self.ln1 is not None: + # self.ln1.to(torch.bfloat16) + + self.cross_attn = MultiHeadAttention(n_state, n_head) if cross_attention else None + self.cross_attn_ln = LayerNorm(n_state) if cross_attention else None + + n_mlp = n_state * 4 + self.mlp = nn.Sequential(Linear(n_state, n_mlp), nn.GELU(), Linear(n_mlp, n_state)) + self.mlp_ln = LayerNorm(n_state) + + def forward( + self, + x: Tensor, + xa: Optional[Tensor] = None, + mask: Optional[Tensor] = None, + kv_cache: Optional[dict] = None, + **kwargs, + ): + is_pad_mask = kwargs.get("is_pad_mask", False) + is_pad_memory_mask = kwargs.get("is_pad_memory_mask", False) + + if self.layer_id == 0 and self.ln0 is not None: + x = self.ln0(x) + + if self.args.get("datatype", "bf16") == "bf16": + x = x.bfloat16() + if self.ln1 is None: + x = x + self.att(x, mask=mask, kv_cache=kv_cache, is_pad_mask=is_pad_mask)[0] + else: + x = x + self.att(self.ln1(x), mask=mask, kv_cache=kv_cache, is_pad_mask=is_pad_mask)[0] + if self.args.get("datatype", "bf16") == "bf16": + x = x.to(torch.float32) + + if self.cross_attn: + x = ( + x + + self.cross_attn( + self.cross_attn_ln(x), xa, kv_cache=kv_cache, is_pad_mask=is_pad_memory_mask + )[0] + ) + x = x + self.mlp(self.mlp_ln(x)) + + return x + + +@tables.register("decoder_classes", "SenseVoiceDecoder") +class SenseVoiceDecoder(nn.Module): + def __init__(self, n_vocab: int, n_ctx: int, n_state: int, n_head: int, n_layer: int, **kwargs): + super().__init__() + + self.token_embedding = nn.Embedding(n_vocab, n_state) + self.positional_embedding = nn.Parameter(torch.empty(n_ctx, n_state)) + + self.blocks = nn.ModuleList( + [ + ResidualAttentionBlockRWKV( + n_state, n_head, cross_attention=True, layer_id=i, **kwargs + ) + for i in range(n_layer) + ] + ) + self.ln = LayerNorm(n_state) + + mask = torch.empty(n_ctx, n_ctx).fill_(-np.inf).triu_(1) + self.register_buffer("mask", mask, persistent=False) + + self.use_padmask = kwargs.get("use_padmask", True) + + def forward( + self, + x: torch.Tensor, + xa: torch.Tensor, + kv_cache: Optional[dict] = None, + **kwargs, + ): + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + # import pdb;pdb.set_trace() + use_padmask = self.use_padmask + hlens = kwargs.get("hlens", None) + + ys_in_lens = kwargs.get("ys_in_lens", None) + + offset = next(iter(kv_cache.values())).shape[1] if kv_cache else 0 + tgt, memory = x, xa + tgt[tgt == -1] = 0 + tgt = self.token_embedding(tgt) + self.positional_embedding[offset : offset + tgt.size(1)] + # tgt = self.dropout(tgt) + + x = tgt.to(memory.dtype) + + if use_padmask and hlens is not None: + memory_mask = (~make_pad_mask(hlens)[:, None, :]).to(memory.device) + else: + memory_mask = None + + for layer, block in enumerate(self.blocks): + x = block( + x, + memory, + mask=self.mask, + memory_mask=memory_mask, + is_pad_mask=False, + is_pad_memory_mask=True, + ) + + x = self.ln(x) + x = (x @ torch.transpose(self.token_embedding.weight.to(x.dtype), 0, 1)).float() + + return x + + def init_state(self, x): + state = {} + + return state + + def final_score(self, state) -> float: + """Score eos (optional). + + Args: + state: Scorer state for prefix tokens + + Returns: + float: final score + + """ + return 0.0 + + def score(self, ys, state, x): + """Score.""" + ys_mask = subsequent_mask(len(ys), device=x.device).unsqueeze(0) + logp = self.forward(ys.unsqueeze(0), x.unsqueeze(0), cache=state) + return logp.squeeze(0)[-1, :], state + + +class MultiHeadedAttentionSANMDecoder(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_feat, dropout_rate, kernel_size, sanm_shfit=0): + """Construct an MultiHeadedAttention object.""" + super().__init__() + + self.dropout = nn.Dropout(p=dropout_rate) + + self.fsmn_block = nn.Conv1d( + n_feat, n_feat, kernel_size, stride=1, padding=0, groups=n_feat, bias=False + ) + # padding + # padding + left_padding = (kernel_size - 1) // 2 + if sanm_shfit > 0: + left_padding = left_padding + sanm_shfit + right_padding = kernel_size - 1 - left_padding + self.pad_fn = nn.ConstantPad1d((left_padding, right_padding), 0.0) + self.kernel_size = kernel_size + + def forward(self, inputs, mask, cache=None, mask_shfit_chunk=None, **kwargs): + """ + :param x: (#batch, time1, size). + :param mask: Mask tensor (#batch, 1, time) + :return: + """ + # print("in fsmn, inputs", inputs.size()) + b, t, d = inputs.size() + # logging.info( + # "mask: {}".format(mask.size())) + if mask is not None: + mask = torch.reshape(mask, (b, -1, 1)) + # logging.info("in fsmn, mask: {}, {}".format(mask.size(), mask[0:100:50, :, :])) + if mask_shfit_chunk is not None: + # logging.info("in fsmn, mask_fsmn: {}, {}".format(mask_shfit_chunk.size(), mask_shfit_chunk[0:100:50, :, :])) + mask = mask * mask_shfit_chunk + # logging.info("in fsmn, mask_after_fsmn: {}, {}".format(mask.size(), mask[0:100:50, :, :])) + # print("in fsmn, mask", mask.size()) + # print("in fsmn, inputs", inputs.size()) + inputs = inputs * mask + + x = inputs.transpose(1, 2) + b, d, t = x.size() + if cache is None: + # print("in fsmn, cache is None, x", x.size()) + + x = self.pad_fn(x) + if not self.training: + cache = x + else: + # print("in fsmn, cache is not None, x", x.size()) + # x = torch.cat((x, cache), dim=2)[:, :, :-1] + # if t < self.kernel_size: + # x = self.pad_fn(x) + x = torch.cat((cache[:, :, 1:], x), dim=2) + x = x[:, :, -(self.kernel_size + t - 1) :] + # print("in fsmn, cache is not None, x_cat", x.size()) + cache = x + x = self.fsmn_block(x) + x = x.transpose(1, 2) + # print("in fsmn, fsmn_out", x.size()) + if x.size(1) != inputs.size(1): + inputs = inputs[:, -1, :] + + x = x + inputs + x = self.dropout(x) + if mask is not None: + x = x * mask + return x, cache + + +class ResidualAttentionBlockFSMN(nn.Module): + def __init__(self, n_state: int, n_head: int, cross_attention: bool = False, **kwargs): + super().__init__() + + self.attn = MultiHeadedAttentionSANMDecoder( + n_state, + kwargs.get("self_attention_dropout_rate"), + kwargs.get("kernel_size", 20), + kwargs.get("sanm_shfit", 10), + ) + self.attn_ln = LayerNorm(n_state) + + self.cross_attn = MultiHeadAttention(n_state, n_head) if cross_attention else None + self.cross_attn_ln = LayerNorm(n_state) if cross_attention else None + + n_mlp = n_state * 4 + self.mlp = nn.Sequential(Linear(n_state, n_mlp), nn.GELU(), Linear(n_mlp, n_state)) + self.mlp_ln = LayerNorm(n_state) + + def forward( + self, + x: Tensor, + xa: Optional[Tensor] = None, + mask: Optional[Tensor] = None, + kv_cache: Optional[dict] = None, + **kwargs, + ): + cache = kwargs.get("cache", {}) + layer = kwargs.get("layer", 0) + is_pad_mask = kwargs.get("is_pad_mask", False) + is_pad_memory_mask = kwargs.get("is_pad_memory_mask", False) + + fsmn_cache = cache[layer]["fsmn_cache"] if cache is not None and len(cache) > 0 else None + # if fsmn_cache is not None: + # x = x[:, -1:] + att_res, fsmn_cache = self.attn(self.attn_ln(x), mask=None, cache=fsmn_cache) + # if len(cache)>1: + # cache[layer]["fsmn_cache"] = fsmn_cache + # x = x[:, -1:] + x = x + att_res + if self.cross_attn: + x = ( + x + + self.cross_attn( + self.cross_attn_ln(x), xa, kv_cache=kv_cache, is_pad_mask=is_pad_memory_mask + )[0] + ) + x = x + self.mlp(self.mlp_ln(x)) + return x + + +@tables.register("decoder_classes", "SenseVoiceDecoderFSMN") +class SenseVoiceDecoderFSMN(nn.Module): + def __init__(self, n_vocab: int, n_ctx: int, n_state: int, n_head: int, n_layer: int, **kwargs): + super().__init__() + + self.token_embedding = nn.Embedding(n_vocab, n_state) + self.positional_embedding = nn.Parameter(torch.empty(n_ctx, n_state)) + + self.blocks = nn.ModuleList( + [ + ResidualAttentionBlockFSMN( + n_state, n_head, cross_attention=True, layer_id=i, **kwargs + ) + for i in range(n_layer) + ] + ) + self.ln = LayerNorm(n_state) + + mask = torch.empty(n_ctx, n_ctx).fill_(-np.inf).triu_(1) + self.register_buffer("mask", mask, persistent=False) + + self.use_padmask = kwargs.get("use_padmask", True) + + def forward( + self, + x: torch.Tensor, + xa: torch.Tensor, + kv_cache: Optional[dict] = None, + **kwargs, + ): + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + # import pdb;pdb.set_trace() + use_padmask = self.use_padmask + hlens = kwargs.get("hlens", None) + + ys_in_lens = kwargs.get("ys_in_lens", None) + + tgt, memory = x, xa + tgt[tgt == -1] = 0 + tgt = self.token_embedding(tgt) + self.positional_embedding[: tgt.size(1)] + # tgt = self.dropout(tgt) + + x = tgt.to(memory.dtype) + + if use_padmask and hlens is not None: + memory_mask = (~make_pad_mask(hlens)[:, None, :]).to(memory.device) + else: + memory_mask = None + + for layer, block in enumerate(self.blocks): + x = block( + x, + memory, + mask=self.mask, + memory_mask=memory_mask, + is_pad_mask=False, + is_pad_memory_mask=True, + cache=kwargs.get("cache", None), + layer=layer, + ) + + x = self.ln(x) + x = (x @ torch.transpose(self.token_embedding.weight.to(x.dtype), 0, 1)).float() + + return x + + def init_state(self, x): + state = {} + for layer, block in enumerate(self.blocks): + state[layer] = { + "fsmn_cache": None, + "memory_key": None, + "memory_value": None, + } + + return state + + def final_score(self, state) -> float: + """Score eos (optional). + + Args: + state: Scorer state for prefix tokens + + Returns: + float: final score + + """ + return 0.0 + + def score(self, ys, state, x): + """Score.""" + ys_mask = subsequent_mask(len(ys), device=x.device).unsqueeze(0) + logp = self.forward(ys.unsqueeze(0), x.unsqueeze(0), cache=None) + logp = torch.log_softmax(logp, dim=-1) + return logp.squeeze(0)[-1, :], state diff --git a/funasr/models/sense_voice/encoder.py b/funasr/models/sense_voice/encoder.py new file mode 100644 index 0000000..d464f1c --- /dev/null +++ b/funasr/models/sense_voice/encoder.py @@ -0,0 +1,57 @@ +import copy +from typing import Optional, Tuple, Union + +import torch +import torch.nn as nn +import torch.nn.functional as F +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +def sense_voice_encode_forward( + self, + x: torch.Tensor, + ilens: torch.Tensor = None, + **kwargs, +): + use_padmask = self.use_padmask + x = F.gelu(self.conv1(x)) + x = F.gelu(self.conv2(x)) + x = x.permute(0, 2, 1) + + n_frames = x.size(1) + max_pos = self.positional_embedding.size(0) + max_pos = n_frames if n_frames < max_pos else max_pos + x = (x[:, :max_pos, :] + self.positional_embedding[None, :max_pos, :]).to(x.dtype) + + if ilens is not None: + if self.downsample_rate == 4: + olens = ( + 1 + + (ilens - self.conv1.kernel_size[0] + 2 * self.conv1.padding[0]) + // self.conv1.stride[0] + ) + else: + olens = ilens + olens = ( + 1 + + (olens - self.conv2.kernel_size[0] + 2 * self.conv2.padding[0]) + // self.conv2.stride[0] + ) + olens = torch.clamp(olens, max=max_pos) + else: + olens = None + + if use_padmask and olens is not None: + padding_mask = (~make_pad_mask(olens)[:, None, :]).to(x.device) + else: + padding_mask = None + + for layer, block in enumerate(self.blocks): + x = block(x, mask=padding_mask, is_pad_mask=True) + + x = self.ln_post(x) + + if ilens is None: + return x + else: + return x, olens diff --git a/funasr/models/sense_voice/model.py b/funasr/models/sense_voice/model.py new file mode 100644 index 0000000..127d5a0 --- /dev/null +++ b/funasr/models/sense_voice/model.py @@ -0,0 +1,1380 @@ +import logging +from dataclasses import dataclass +from typing import Dict +from typing import Iterable, Optional +import types +import time +import numpy as np +import torch +import torch.nn.functional as F +from torch import Tensor +from torch import nn +from torch.cuda.amp import autocast +from funasr.metrics.compute_acc import compute_accuracy +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.train_utils.device_funcs import force_gatherable +from . import whisper_lib as whisper +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.utils.datadir_writer import DatadirWriter + +from funasr.register import tables + + +@tables.register("model_classes", "SenseVoice") +class SenseVoice(nn.Module): + def __init__(self, *args, **kwargs): + super().__init__() + + dims = kwargs.get("dims", {}) + dims = whisper.model.ModelDimensions(**dims) + model = whisper.model.Whisper(dims=dims) + + # encoder + model.encoder.downsample_rate = kwargs.get("downsample_rate", 4) + model.encoder.use_padmask = kwargs.get("use_padmask", True) + from .encoder import sense_voice_encode_forward + + model.encoder.forward = types.MethodType(sense_voice_encode_forward, model.encoder) + + # decoder + model.decoder.use_padmask = kwargs.get("use_padmask", True) + from .decoder import sense_voice_decode_forward + + model.decoder.forward = types.MethodType(sense_voice_decode_forward, model.decoder) + + self.model = model + + self.encoder_output_size = self.model.dims.n_audio_state + + self.activation_checkpoint = kwargs.get("activation_checkpoint", False) + self.ignore_id = kwargs.get("ignore_id", -1) + self.vocab_size = kwargs.get("vocab_size", -1) + self.length_normalized_loss = kwargs.get("length_normalized_loss", True) + self.criterion_att = LabelSmoothingLoss( + size=self.vocab_size, + padding_idx=self.ignore_id, + smoothing=kwargs.get("lsm_weight", 0.0), + normalize_length=self.length_normalized_loss, + ) + + specaug = kwargs.get("specaug", None) + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**kwargs.get("specaug_conf", {})) + self.specaug = specaug + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + if self.activation_checkpoint: + from torch.utils.checkpoint import checkpoint + + encoder_out, encoder_out_lens = checkpoint( + self.encode, speech, speech_lengths, use_reentrant=False + ) + else: + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths, target_mask=target_mask + ) + loss = loss_att + stats = {} + stats["acc"] = acc_att + stats["loss"] = torch.clone(loss.detach()) + stats["batch_size"] = batch_size + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + """Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens = self.model.encoder(speech.permute(0, 2, 1), speech_lengths) + + return encoder_out, encoder_out_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + stats = {} + + # 1. Forward decoder + decoder_out = self.model.decoder( + x=ys_pad, xa=encoder_out, hlens=encoder_out_lens, ys_in_lens=ys_pad_lens + ) + + # 2. Compute attention loss + mask = torch.ones_like(ys_pad) * (-1) + ys_pad_mask = (ys_pad * target_mask + mask * (1 - target_mask)).to(torch.int64) + ys_pad_mask[ys_pad_mask == 0] = -1 + loss_att = self.criterion_att(decoder_out[:, :-1, :], ys_pad_mask[:, 1:]) + + with torch.no_grad(): + preds = torch.argmax(decoder_out, -1) + acc_att = compute_accuracy( + preds[:, :-1], ys_pad_mask[:, 1:], ignore_label=self.ignore_id + ) + + return loss_att, acc_att, None, None + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + if frontend is None and not hasattr(self, "frontend"): + frontend_class = tables.frontend_classes.get("WhisperFrontend") + frontend = frontend_class( + n_mels=self.model.dims.n_mels, do_pad_trim=kwargs.get("do_pad_trim", True) + ) + self.frontend = frontend + else: + frontend = frontend if frontend is not None else self.frontend + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs if hasattr(frontend, "fs") else 16000, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + frame_shift = frontend.frame_shift if hasattr(frontend, "frame_shift") else 10 + lfr_n = frontend.lfr_n if hasattr(frontend, "lfr_n") else 1 + meta_data["batch_data_time"] = speech_lengths.sum().item() * frame_shift * lfr_n / 1000 + + speech = speech.to(device=kwargs["device"])[0, :, :] + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + DecodingOptions = kwargs.get("DecodingOptions", {}) + task = DecodingOptions.get("task", "ASR") + if isinstance(task, str): + task = [task] + task = "".join([f"<|{x}|>" for x in task]) + initial_prompt = kwargs.get("initial_prompt", f"<|startoftranscript|>{task}") + DecodingOptions["initial_prompt"] = initial_prompt + + language = DecodingOptions.get("language", None) + language = None if language == "auto" else language + DecodingOptions["language"] = language + + DecodingOptions["vocab_path"] = kwargs["tokenizer_conf"].get("vocab_path", None) + + if "without_timestamps" not in DecodingOptions: + DecodingOptions["without_timestamps"] = True + + options = whisper.DecodingOptions(**DecodingOptions) + + result = whisper.decode(self.model, speech, options) + text = f"{result.text}" + results = [] + result_i = {"key": key[0], "text": text} + + results.append(result_i) + + return results, meta_data + + +@tables.register("model_classes", "SenseVoiceRWKV") +class SenseVoiceRWKV(nn.Module): + def __init__(self, *args, **kwargs): + super().__init__() + + dims = kwargs.get("dims", {}) + dims = whisper.model.ModelDimensions(**dims) + model = whisper.model.Whisper(dims=dims) + + # encoder + model.encoder.downsample_rate = kwargs.get("downsample_rate", 4) + model.encoder.use_padmask = kwargs.get("use_padmask", True) + from .encoder import sense_voice_encode_forward + + model.encoder.forward = types.MethodType(sense_voice_encode_forward, model.encoder) + + # decoder + del model.decoder + decoder = kwargs.get("decoder", "SenseVoiceDecoder") + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + n_vocab=dims.n_vocab, + n_ctx=dims.n_text_ctx, + n_state=dims.n_text_state, + n_head=dims.n_text_head, + n_layer=dims.n_text_layer, + **kwargs.get("decoder_conf"), + ) + model.decoder = decoder + + self.model = model + + self.encoder_output_size = self.model.dims.n_audio_state + + self.activation_checkpoint = kwargs.get("activation_checkpoint", False) + self.ignore_id = kwargs.get("ignore_id", -1) + self.vocab_size = kwargs.get("vocab_size", -1) + self.length_normalized_loss = kwargs.get("length_normalized_loss", True) + self.criterion_att = LabelSmoothingLoss( + size=self.vocab_size, + padding_idx=self.ignore_id, + smoothing=kwargs.get("lsm_weight", 0.0), + normalize_length=self.length_normalized_loss, + ) + + specaug = kwargs.get("specaug", None) + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**kwargs.get("specaug_conf", {})) + self.specaug = specaug + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size, frames, _ = speech.shape + _, text_tokens = text.shape + + if self.activation_checkpoint: + from torch.utils.checkpoint import checkpoint + + encoder_out, encoder_out_lens = checkpoint( + self.encode, speech, speech_lengths, use_reentrant=False + ) + else: + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths, target_mask=target_mask + ) + loss = loss_att + stats = {} + stats["acc"] = acc_att + stats["loss"] = torch.clone(loss.detach()) + stats["batch_size"] = batch_size + stats["batch_size_x_frames"] = frames * batch_size + stats["batch_size_real_frames"] = speech_lengths.sum().item() + stats["padding_frames"] = stats["batch_size_x_frames"] - stats["batch_size_real_frames"] + stats["batch_size_x_tokens"] = text_tokens * batch_size + stats["batch_size_real_tokens"] = text_lengths.sum().item() + stats["padding_tokens"] = stats["batch_size_x_tokens"] - stats["batch_size_real_tokens"] + stats["batch_size_x_frames_plus_tokens"] = (text_tokens + frames) * batch_size + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + """Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens = self.model.encoder(speech.permute(0, 2, 1), speech_lengths) + + return encoder_out, encoder_out_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + stats = {} + + # 1. Forward decoder + # ys_pad: [sos, task, lid, text, eos] + decoder_out = self.model.decoder( + x=ys_pad, xa=encoder_out, hlens=encoder_out_lens, ys_in_lens=ys_pad_lens + ) + + # 2. Compute attention loss + mask = torch.ones_like(ys_pad) * (-1) # [sos, task, lid, text, eos]: [-1, -1, -1, -1] + ys_pad_mask = (ys_pad * target_mask + mask * (1 - target_mask)).to( + torch.int64 + ) # [sos, task, lid, text, eos]: [0, 0, 1, 1, 1] + [-1, -1, 0, 0, 0] + ys_pad_mask[ys_pad_mask == 0] = -1 # [-1, -1, lid, text, eos] + # decoder_out: [sos, task, lid, text] + # ys_pad_mask: [-1, lid, text, eos] + loss_att = self.criterion_att(decoder_out[:, :-1, :], ys_pad_mask[:, 1:]) + + with torch.no_grad(): + preds = torch.argmax(decoder_out, -1) + acc_att = compute_accuracy( + preds[:, :-1], ys_pad_mask[:, 1:], ignore_label=self.ignore_id + ) + + return loss_att, acc_att, None, None + + def init_beam_search( + self, + **kwargs, + ): + from .search import BeamSearch + + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + scorers.update( + decoder=self.model.decoder, + length_bonus=LengthBonus(self.vocab_size), + ) + + weights = dict( + decoder=1.0, + ctc=0.0, + lm=0.0, + ngram=0.0, + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearch( + beam_size=kwargs.get("beam_size", 5), + weights=weights, + scorers=scorers, + sos=None, + eos=None, + vocab_size=self.vocab_size, + token_list=None, + pre_beam_score_key="full", + ) + + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + # init beamsearch + if not hasattr(self, "beam_search") or self.beam_search is None: + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + if frontend is None and not hasattr(self, "frontend"): + frontend_class = tables.frontend_classes.get("WhisperFrontend") + frontend = frontend_class( + n_mels=self.model.dims.n_mels, do_pad_trim=kwargs.get("do_pad_trim", True) + ) + self.frontend = frontend + else: + frontend = frontend if frontend is not None else self.frontend + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs if hasattr(frontend, "fs") else 16000, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + frame_shift = frontend.frame_shift if hasattr(frontend, "frame_shift") else 10 + lfr_n = frontend.lfr_n if hasattr(frontend, "lfr_n") else 1 + meta_data["batch_data_time"] = speech_lengths.sum().item() * frame_shift * lfr_n / 1000 + + speech = speech.to(device=kwargs["device"])[0, :, :] + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + DecodingOptions = kwargs.get("DecodingOptions", {}) + task = DecodingOptions.get("task", "ASR") + if isinstance(task, str): + task = [task] + task = "".join([f"<|{x}|>" for x in task]) + initial_prompt = kwargs.get("initial_prompt", f"<|startoftranscript|>{task}") + + language = DecodingOptions.get("language", None) + language = None if language == "auto" else language + + sos = f"{initial_prompt}<|{language}|>" if language is not None else initial_prompt + sos_int = tokenizer.encode(sos, allowed_special="all") + eos = kwargs.get("model_conf").get("eos") + eos_int = tokenizer.encode(eos, allowed_special="all") + self.beam_search.sos = sos_int + self.beam_search.eos = eos_int[0] + + # Paramterts for rich decoding + self.beam_search.emo_unk = tokenizer.encode( + DecodingOptions.get("emo_unk_token", "<|SPECIAL_TOKEN_1|>"), allowed_special="all" + )[0] + self.beam_search.emo_unk_score = 1 + self.beam_search.emo_tokens = tokenizer.encode( + DecodingOptions.get("emo_target_tokens", "<|HAPPY|><|SAD|><|ANGRY|>"), + allowed_special="all", + ) + self.beam_search.emo_scores = DecodingOptions.get("emo_target_threshold", [0.1, 0.1, 0.1]) + + self.beam_search.event_bg_token = tokenizer.encode( + DecodingOptions.get("gain_tokens_bg", "<|Speech|><|BGM|><|Applause|><|Laughter|>"), + allowed_special="all", + ) + self.beam_search.event_ed_token = tokenizer.encode( + DecodingOptions.get("gain_tokens_ed", "<|/Speech|><|/BGM|><|/Applause|><|/Laughter|>"), + allowed_special="all", + ) + self.beam_search.event_score_ga = DecodingOptions.get("gain_tokens_score", [1, 1, 1, 1]) + + encoder_out, encoder_out_lens = self.encode( + speech[None, :, :].permute(0, 2, 1), speech_lengths + ) + + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + b, n, d = encoder_out.size() + for i in range(b): + + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # # remove blank symbol id, which is assumed to be 0 + # token_int = list( + # filter( + # lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + # ) + # ) + + # Change integer-ids to tokens + # token = tokenizer.ids2tokens(token_int) + text = tokenizer.decode(token_int) + + result_i = {"key": key[i], "text": text} + results.append(result_i) + + if ibest_writer is not None: + # ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text + + return results, meta_data + + +@tables.register("model_classes", "SenseVoiceFSMN") +class SenseVoiceFSMN(nn.Module): + def __init__(self, *args, **kwargs): + super().__init__() + + dims = kwargs.get("dims", {}) + dims = whisper.model.ModelDimensions(**dims) + model = whisper.model.Whisper(dims=dims) + + # encoder + model.encoder.downsample_rate = kwargs.get("downsample_rate", 4) + model.encoder.use_padmask = kwargs.get("use_padmask", True) + from .encoder import sense_voice_encode_forward + + model.encoder.forward = types.MethodType(sense_voice_encode_forward, model.encoder) + + # decoder + del model.decoder + decoder = kwargs.get("decoder", "SenseVoiceDecoder") + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + n_vocab=dims.n_vocab, + n_ctx=dims.n_text_ctx, + n_state=dims.n_text_state, + n_head=dims.n_text_head, + n_layer=dims.n_text_layer, + **kwargs.get("decoder_conf"), + ) + model.decoder = decoder + + self.model = model + + self.encoder_output_size = self.model.dims.n_audio_state + + self.activation_checkpoint = kwargs.get("activation_checkpoint", False) + self.ignore_id = kwargs.get("ignore_id", -1) + self.vocab_size = dims.n_vocab + self.length_normalized_loss = kwargs.get("length_normalized_loss", True) + self.criterion_att = LabelSmoothingLoss( + size=self.vocab_size, + padding_idx=self.ignore_id, + smoothing=kwargs.get("lsm_weight", 0.0), + normalize_length=self.length_normalized_loss, + ) + + specaug = kwargs.get("specaug", None) + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**kwargs.get("specaug_conf", {})) + self.specaug = specaug + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size, frames, _ = speech.shape + _, text_tokens = text.shape + + if self.activation_checkpoint: + from torch.utils.checkpoint import checkpoint + + encoder_out, encoder_out_lens = checkpoint( + self.encode, speech, speech_lengths, use_reentrant=False + ) + else: + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths, target_mask=target_mask + ) + loss = loss_att + stats = {} + stats["acc"] = acc_att + stats["loss"] = torch.clone(loss.detach()) + stats["batch_size"] = batch_size + stats["batch_size_x_frames"] = frames * batch_size + stats["batch_size_real_frames"] = speech_lengths.sum().item() + stats["padding_frames"] = stats["batch_size_x_frames"] - stats["batch_size_real_frames"] + stats["batch_size_x_tokens"] = text_tokens * batch_size + stats["batch_size_real_tokens"] = text_lengths.sum().item() + stats["padding_tokens"] = stats["batch_size_x_tokens"] - stats["batch_size_real_tokens"] + stats["batch_size_x_frames_plus_tokens"] = (text_tokens + frames) * batch_size + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + """Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Forward encoder + encoder_out, encoder_out_lens = self.model.encoder(speech.permute(0, 2, 1), speech_lengths) + + return encoder_out, encoder_out_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + stats = {} + + # 1. Forward decoder + decoder_out = self.model.decoder( + x=ys_pad, xa=encoder_out, hlens=encoder_out_lens, ys_in_lens=ys_pad_lens + ) + # decoder_out, _ = self.model.decoder(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + # 2. Compute attention loss + mask = torch.ones_like(ys_pad) * (-1) + ys_pad_mask = (ys_pad * target_mask + mask * (1 - target_mask)).to(torch.int64) + ys_pad_mask[ys_pad_mask == 0] = -1 + loss_att = self.criterion_att(decoder_out[:, :-1, :], ys_pad_mask[:, 1:]) + + with torch.no_grad(): + preds = torch.argmax(decoder_out, -1) + acc_att = compute_accuracy( + preds[:, :-1], ys_pad_mask[:, 1:], ignore_label=self.ignore_id + ) + + return loss_att, acc_att, None, None + + def init_beam_search( + self, + **kwargs, + ): + from .search import BeamSearch + + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + scorers.update( + decoder=self.model.decoder, + length_bonus=LengthBonus(self.vocab_size), + ) + + weights = dict( + decoder=1.0, + ctc=0.0, + lm=0.0, + ngram=0.0, + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearch( + beam_size=kwargs.get("beam_size", 5), + weights=weights, + scorers=scorers, + sos=None, + eos=None, + vocab_size=self.vocab_size, + token_list=None, + pre_beam_score_key="full", + ) + + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + # init beamsearch + if not hasattr(self, "beam_search") or self.beam_search is None: + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + if frontend is None and not hasattr(self, "frontend"): + frontend_class = tables.frontend_classes.get("WhisperFrontend") + frontend = frontend_class( + n_mels=self.model.dims.n_mels, do_pad_trim=kwargs.get("do_pad_trim", True) + ) + self.frontend = frontend + else: + frontend = frontend if frontend is not None else self.frontend + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs if hasattr(frontend, "fs") else 16000, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + + if ( + isinstance(kwargs.get("data_type", None), (list, tuple)) + and len(kwargs.get("data_type", [])) > 1 + ): + audio_sample_list, text_token_int_list = audio_sample_list + text_token_int = text_token_int_list[0] + else: + text_token_int = None + + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + frame_shift = frontend.frame_shift if hasattr(frontend, "frame_shift") else 10 + lfr_n = frontend.lfr_n if hasattr(frontend, "lfr_n") else 1 + meta_data["batch_data_time"] = speech_lengths.sum().item() * frame_shift * lfr_n / 1000 + + speech = speech.to(device=kwargs["device"])[0, :, :] + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + DecodingOptions = kwargs.get("DecodingOptions", {}) + task = DecodingOptions.get("task", "ASR") + if isinstance(task, str): + task = [task] + task = "".join([f"<|{x}|>" for x in task]) + initial_prompt = kwargs.get("initial_prompt", f"<|startoftranscript|>{task}") + + language = DecodingOptions.get("language", None) + language = None if language == "auto" else language + + sos = f"{initial_prompt}<|{language}|>" if language is not None else initial_prompt + sos_int = tokenizer.encode(sos, allowed_special="all") + eos = kwargs.get("model_conf").get("eos") + eos_int = tokenizer.encode(eos, allowed_special="all") + self.beam_search.sos = sos_int + self.beam_search.eos = eos_int[0] + + # Paramterts for rich decoding + self.beam_search.emo_unk = tokenizer.encode( + DecodingOptions.get("emo_unk_token", "<|SPECIAL_TOKEN_1|>"), allowed_special="all" + )[0] + self.beam_search.emo_unk_score = 1 + self.beam_search.emo_tokens = tokenizer.encode( + DecodingOptions.get("emo_target_tokens", "<|HAPPY|><|SAD|><|ANGRY|>"), + allowed_special="all", + ) + self.beam_search.emo_scores = DecodingOptions.get("emo_target_threshold", [0.1, 0.1, 0.1]) + + self.beam_search.event_bg_token = tokenizer.encode( + DecodingOptions.get("gain_tokens_bg", "<|Speech|><|BGM|><|Applause|><|Laughter|>"), + allowed_special="all", + ) + self.beam_search.event_ed_token = tokenizer.encode( + DecodingOptions.get("gain_tokens_ed", "<|/Speech|><|/BGM|><|/Applause|><|/Laughter|>"), + allowed_special="all", + ) + self.beam_search.event_score_ga = DecodingOptions.get("gain_tokens_score", [1, 1, 1, 1]) + + encoder_out, encoder_out_lens = self.encode( + speech[None, :, :].permute(0, 2, 1), speech_lengths + ) + + if text_token_int is not None: + i = 0 + results = [] + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"1best_recog"] + + # 1. Forward decoder + ys_pad = torch.tensor(sos_int + text_token_int, dtype=torch.int64).to(kwargs["device"])[ + None, : + ] + ys_pad_lens = torch.tensor([len(sos_int + text_token_int)], dtype=torch.int64).to( + kwargs["device"] + )[None, :] + decoder_out = self.model.decoder( + x=ys_pad, xa=encoder_out, hlens=encoder_out_lens, ys_in_lens=ys_pad_lens + ) + + token_int = decoder_out.argmax(-1)[0, :].tolist() + text = tokenizer.decode(token_int) + + result_i = {"key": key[i], "text": text} + results.append(result_i) + + if ibest_writer is not None: + # ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text + return results, meta_data + + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + b, n, d = encoder_out.size() + for i in range(b): + + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # # remove blank symbol id, which is assumed to be 0 + # token_int = list( + # filter( + # lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + # ) + # ) + + # Change integer-ids to tokens + # token = tokenizer.ids2tokens(token_int) + text = tokenizer.decode(token_int) + + result_i = {"key": key[i], "text": text} + results.append(result_i) + + if ibest_writer is not None: + # ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text + + return results, meta_data + + +@tables.register("model_classes", "SenseVoiceSANM") +class SenseVoiceSANM(nn.Module): + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + **decoder_conf, + ) + + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + + self.specaug = specaug + + self.encoder = encoder + + self.decoder = decoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + + self.error_calculator = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + self.activation_checkpoint = kwargs.get("activation_checkpoint", False) + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size, frames, _ = speech.shape + _, text_tokens = text.shape + + if self.activation_checkpoint: + from torch.utils.checkpoint import checkpoint + + encoder_out, encoder_out_lens = checkpoint( + self.encode, speech, speech_lengths, use_reentrant=False + ) + else: + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths, target_mask=target_mask + ) + + loss = loss_att + stats = {} + stats["acc"] = acc_att + stats["loss"] = torch.clone(loss.detach()) + stats["batch_size"] = batch_size + stats["batch_size_x_frames"] = frames * batch_size + stats["batch_size_real_frames"] = speech_lengths.sum().item() + stats["padding_frames"] = stats["batch_size_x_frames"] - stats["batch_size_real_frames"] + stats["batch_size_x_tokens"] = text_tokens * batch_size + stats["batch_size_real_tokens"] = text_lengths.sum().item() + stats["padding_tokens"] = stats["batch_size_x_tokens"] - stats["batch_size_real_tokens"] + stats["batch_size_x_frames_plus_tokens"] = (text_tokens + frames) * batch_size + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + if isinstance(encoder_out, (tuple, list)): + encoder_out = encoder_out[0] + + return encoder_out, encoder_out_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + **kwargs, + ): + target_mask = kwargs.get("target_mask", None) + stats = {} + + # 1. Forward decoder + ys_pad[ys_pad == -1] = 0 + decoder_out = self.decoder(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + if isinstance(decoder_out, (list, tuple)): + decoder_out = decoder_out[0] + + # 2. Compute attention loss + mask = torch.ones_like(ys_pad) * (-1) + ys_pad_mask = (ys_pad * target_mask + mask * (1 - target_mask)).to(torch.int64) + ys_pad_mask[ys_pad_mask == 0] = -1 + loss_att = self.criterion_att(decoder_out[:, :-1, :], ys_pad_mask[:, 1:]) + + with torch.no_grad(): + preds = torch.argmax(decoder_out, -1) + acc_att = compute_accuracy( + preds[:, :-1], ys_pad_mask[:, 1:], ignore_label=self.ignore_id + ) + + return loss_att, acc_att, None, None + + def init_beam_search( + self, + **kwargs, + ): + from .search import BeamSearch + + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + scorers.update( + decoder=self.decoder, + length_bonus=LengthBonus(self.vocab_size), + ) + + weights = dict( + decoder=1.0, + ctc=0.0, + lm=0.0, + ngram=0.0, + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearch( + beam_size=kwargs.get("beam_size", 5), + weights=weights, + scorers=scorers, + sos=None, + eos=None, + vocab_size=self.vocab_size, + token_list=None, + pre_beam_score_key="full", + ) + + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + # init beamsearch + if not hasattr(self, "beam_search") or self.beam_search is None: + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + if frontend is None and not hasattr(self, "frontend"): + frontend_class = tables.frontend_classes.get("WhisperFrontend") + frontend = frontend_class( + n_mels=self.model.dims.n_mels, do_pad_trim=kwargs.get("do_pad_trim", True) + ) + self.frontend = frontend + else: + frontend = frontend if frontend is not None else self.frontend + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs if hasattr(frontend, "fs") else 16000, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + + if ( + isinstance(kwargs.get("data_type", None), (list, tuple)) + and len(kwargs.get("data_type", [])) > 1 + ): + audio_sample_list, text_token_int_list = audio_sample_list + text_token_int = text_token_int_list[0] + else: + text_token_int = None + + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + frame_shift = frontend.frame_shift if hasattr(frontend, "frame_shift") else 10 + lfr_n = frontend.lfr_n if hasattr(frontend, "lfr_n") else 1 + meta_data["batch_data_time"] = speech_lengths.sum().item() * frame_shift * lfr_n / 1000 + + speech = speech.to(device=kwargs["device"])[0, :, :] + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + DecodingOptions = kwargs.get("DecodingOptions", {}) + task = DecodingOptions.get("task", "ASR") + if isinstance(task, str): + task = [task] + task = "".join([f"<|{x}|>" for x in task]) + initial_prompt = kwargs.get("initial_prompt", f"<|startoftranscript|>{task}") + + language = DecodingOptions.get("language", None) + language = None if language == "auto" else language + + sos = f"{initial_prompt}<|{language}|>" if language is not None else initial_prompt + sos_int = tokenizer.encode(sos, allowed_special="all") + eos = kwargs.get("model_conf").get("eos") + eos_int = tokenizer.encode(eos, allowed_special="all") + self.beam_search.sos = sos_int + self.beam_search.eos = eos_int[0] + + # Paramterts for rich decoding + self.beam_search.emo_unk = tokenizer.encode( + DecodingOptions.get("emo_unk_token", "<|SPECIAL_TOKEN_1|>"), allowed_special="all" + )[0] + self.beam_search.emo_unk_score = 1 + self.beam_search.emo_tokens = tokenizer.encode( + DecodingOptions.get("emo_target_tokens", "<|HAPPY|><|SAD|><|ANGRY|>"), + allowed_special="all", + ) + self.beam_search.emo_scores = DecodingOptions.get("emo_target_threshold", [0.1, 0.1, 0.1]) + + self.beam_search.event_bg_token = tokenizer.encode( + DecodingOptions.get("gain_tokens_bg", "<|Speech|><|BGM|><|Applause|><|Laughter|>"), + allowed_special="all", + ) + self.beam_search.event_ed_token = tokenizer.encode( + DecodingOptions.get("gain_tokens_ed", "<|/Speech|><|/BGM|><|/Applause|><|/Laughter|>"), + allowed_special="all", + ) + self.beam_search.event_score_ga = DecodingOptions.get("gain_tokens_score", [1, 1, 1, 1]) + + encoder_out, encoder_out_lens = self.encode( + speech[None, :, :].permute(0, 2, 1), speech_lengths + ) + + if text_token_int is not None: + i = 0 + results = [] + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"1best_recog"] + + # 1. Forward decoder + ys_pad = torch.tensor(sos_int + text_token_int, dtype=torch.int64).to(kwargs["device"])[ + None, : + ] + ys_pad_lens = torch.tensor([len(sos_int + text_token_int)], dtype=torch.int64).to( + kwargs["device"] + )[None, :] + decoder_out = self.model.decoder( + x=ys_pad, xa=encoder_out, hlens=encoder_out_lens, ys_in_lens=ys_pad_lens + ) + + token_int = decoder_out.argmax(-1)[0, :].tolist() + text = tokenizer.decode(token_int) + + result_i = {"key": key[i], "text": text} + results.append(result_i) + + if ibest_writer is not None: + # ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text + return results, meta_data + + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + b, n, d = encoder_out.size() + for i in range(b): + + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # # remove blank symbol id, which is assumed to be 0 + # token_int = list( + # filter( + # lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + # ) + # ) + + # Change integer-ids to tokens + # token = tokenizer.ids2tokens(token_int) + text = tokenizer.decode(token_int) + + result_i = {"key": key[i], "text": text} + results.append(result_i) + + if ibest_writer is not None: + # ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text + + return results, meta_data diff --git a/funasr/models/sense_voice/rwkv_v4.py b/funasr/models/sense_voice/rwkv_v4.py new file mode 100644 index 0000000..c154ac0 --- /dev/null +++ b/funasr/models/sense_voice/rwkv_v4.py @@ -0,0 +1,412 @@ +######################################################################################################## +# The RWKV Language Model - https://github.com/BlinkDL/RWKV-LM +######################################################################################################## + +import os, math, gc, importlib +import torch + +# torch._C._jit_set_profiling_executor(True) +# torch._C._jit_set_profiling_mode(True) +import torch.nn as nn +from torch.nn import functional as F + + +def __nop(ob): + return ob + + +MyModule = nn.Module +MyFunction = __nop +if "RWKV_JIT_ON" in os.environ and os.environ["RWKV_JIT_ON"] == "1": + MyModule = torch.jit.ScriptModule + MyFunction = torch.jit.script_method + +######################################################################################################## +# CUDA Kernel +######################################################################################################## + +wkv_cuda = None + + +def load_rwkv_kernel( + HEAD_SIZE: int = 64, + RWKV_CTXLEN: int = 512, + T_MAX: int = 512, +): + from torch.utils.cpp_extension import load + + global wkv_cuda + + if wkv_cuda is not None: + return + + absolute_file_path = os.path.abspath(__file__) + cur_dir = os.path.dirname(absolute_file_path) + wkv_cuda = load( + name="wkv", + sources=[f"{cur_dir}/cuda/wkv_op.cpp", f"{cur_dir}/cuda/wkv_cuda.cu"], + verbose=True, + extra_cuda_cflags=[ + "-res-usage", + "--maxrregcount 60", + "--use_fast_math", + "-O3", + "-Xptxas -O3", + f"-DTmax={T_MAX}", + ], + ) + + +class WKV(torch.autograd.Function): + @staticmethod + def forward(ctx, B, T, C, w, u, k, v): + ctx.B = B + ctx.T = T + ctx.C = C + # assert T <= T_MAX + assert B * C % min(C, 1024) == 0 + if "32" in os.environ["RWKV_FLOAT_MODE"]: + w = -torch.exp(w.contiguous()) + u = u.contiguous() + k = k.contiguous() + v = v.contiguous() + else: + w = -torch.exp(w.float().contiguous()) + u = u.float().contiguous() + k = k.float().contiguous() + v = v.float().contiguous() + ctx.save_for_backward(w, u, k, v) + y = torch.empty((B, T, C), device="cuda", memory_format=torch.contiguous_format) + wkv_cuda.forward(B, T, C, w, u, k, v, y) + if "32" in os.environ["RWKV_FLOAT_MODE"]: + return y + elif os.environ["RWKV_FLOAT_MODE"] == "fp16": + return y.half() + elif os.environ["RWKV_FLOAT_MODE"] == "bf16": + return y.bfloat16() + + @staticmethod + def backward(ctx, gy): + B = ctx.B + T = ctx.T + C = ctx.C + assert T <= T_MAX + assert B * C % min(C, 1024) == 0 + w, u, k, v = ctx.saved_tensors + gw = torch.zeros((B, C), device="cuda").contiguous() + gu = torch.zeros((B, C), device="cuda").contiguous() + gk = torch.zeros((B, T, C), device="cuda").contiguous() + gv = torch.zeros((B, T, C), device="cuda").contiguous() + if "32" in os.environ["RWKV_FLOAT_MODE"]: + wkv_cuda.backward(B, T, C, w, u, k, v, gy.contiguous(), gw, gu, gk, gv) + else: + wkv_cuda.backward(B, T, C, w, u, k, v, gy.float().contiguous(), gw, gu, gk, gv) + gw = torch.sum(gw, dim=0) + gu = torch.sum(gu, dim=0) + if "32" in os.environ["RWKV_FLOAT_MODE"]: + return (None, None, None, gw, gu, gk, gv) + elif os.environ["RWKV_FLOAT_MODE"] == "fp16": + return (None, None, None, gw.half(), gu.half(), gk.half(), gv.half()) + elif os.environ["RWKV_FLOAT_MODE"] == "bf16": + return (None, None, None, gw.bfloat16(), gu.bfloat16(), gk.bfloat16(), gv.bfloat16()) + + +def RUN_CUDA(B, T, C, w, u, k, v): + return WKV.apply(B, T, C, w.cuda(), u.cuda(), k.cuda(), v.cuda()) + + +class RWKV_TimeMix(torch.jit.ScriptModule): + def __init__(self, config, layer_id): + super().__init__() + load_rwkv_kernel() + self.layer_id = layer_id + self.ctx_len = config.ctx_len + self.n_embd = config.n_embd + + attn_sz = config.n_embd + + with torch.no_grad(): # fancy init + ratio_0_to_1 = layer_id / (config.n_layer - 1) # 0 to 1 + ratio_1_to_almost0 = 1.0 - (layer_id / config.n_layer) # 1 to ~0 + + # fancy time_decay + decay_speed = torch.ones(attn_sz) + for h in range(attn_sz): + decay_speed[h] = -5 + 8 * (h / (attn_sz - 1)) ** (0.7 + 1.3 * ratio_0_to_1) + self.time_decay = nn.Parameter(decay_speed) + # print(layer_id, self.time_decay.flatten()[:3].cpu().numpy(), '...', self.time_decay.flatten()[-3:].cpu().numpy()) + + # fancy time_first + zigzag = torch.tensor([(i + 1) % 3 - 1 for i in range(attn_sz)]) * 0.5 + self.time_first = nn.Parameter(torch.ones(attn_sz) * math.log(0.3) + zigzag) + + # fancy time_mix + x = torch.ones(1, 1, config.n_embd) + for i in range(config.n_embd): + x[0, 0, i] = i / config.n_embd + self.time_mix_k = nn.Parameter(torch.pow(x, ratio_1_to_almost0)) + self.time_mix_v = nn.Parameter(torch.pow(x, ratio_1_to_almost0) + 0.3 * ratio_0_to_1) + self.time_mix_r = nn.Parameter(torch.pow(x, 0.5 * ratio_1_to_almost0)) + + self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) + + self.key = nn.Linear(config.n_embd, attn_sz, bias=False) + self.value = nn.Linear(config.n_embd, attn_sz, bias=False) + self.receptance = nn.Linear(config.n_embd, attn_sz, bias=False) + + self.output = nn.Linear(attn_sz, config.n_embd, bias=False) + + self.key.scale_init = 0 + self.receptance.scale_init = 0 + self.output.scale_init = 0 + + @torch.jit.script_method + def jit_func(self, x): + + # Mix x with the previous timestep to produce xk, xv, xr + xx = self.time_shift(x) + xk = x * self.time_mix_k + xx * (1 - self.time_mix_k) + xv = x * self.time_mix_v + xx * (1 - self.time_mix_v) + xr = x * self.time_mix_r + xx * (1 - self.time_mix_r) + + # Use xk, xv, xr to produce k, v, r + k = self.key(xk) + v = self.value(xv) + r = self.receptance(xr) + sr = torch.sigmoid(r) + + return sr, k, v + + def forward(self, x): + B, T, C = x.size() # x = (Batch,Time,Channel) + + sr, k, v = self.jit_func(x) + + rwkv = sr * RUN_CUDA(B, T, C, self.time_decay, self.time_first, k, v) + rwkv = self.output(rwkv) + return rwkv + + +class RWKV_ChannelMix(torch.jit.ScriptModule): + def __init__(self, config, layer_id): + super().__init__() + self.layer_id = layer_id + + self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) + + with torch.no_grad(): # fancy init of time_mix + ratio_1_to_almost0 = 1.0 - (layer_id / config.n_layer) # 1 to ~0 + + x = torch.ones(1, 1, config.n_embd) + for i in range(config.n_embd): + x[0, 0, i] = i / config.n_embd + + self.time_mix_k = nn.Parameter(torch.pow(x, ratio_1_to_almost0)) + self.time_mix_r = nn.Parameter(torch.pow(x, ratio_1_to_almost0)) + + hidden_sz = 4 * config.n_embd + self.key = nn.Linear(config.n_embd, hidden_sz, bias=False) + self.receptance = nn.Linear(config.n_embd, config.n_embd, bias=False) + self.value = nn.Linear(hidden_sz, config.n_embd, bias=False) + + self.value.scale_init = 0 + self.receptance.scale_init = 0 + + @torch.jit.script_method + def forward(self, x): + xx = self.time_shift(x) + xk = x * self.time_mix_k + xx * (1 - self.time_mix_k) + xr = x * self.time_mix_r + xx * (1 - self.time_mix_r) + + k = self.key(xk) + k = torch.square(torch.relu(k)) + kv = self.value(k) + + rkv = torch.sigmoid(self.receptance(xr)) * kv + return rkv + + +# class Block(nn.Module): +# def __init__(self, args, layer_id): +# super().__init__() +# self.args = args +# self.layer_id = layer_id +# +# self.ln1 = nn.LayerNorm(args.n_embd) +# self.ln2 = nn.LayerNorm(args.n_embd) +# +# if self.layer_id == 0: +# self.ln0 = nn.LayerNorm(args.n_embd) +# +# self.att = RWKV_Tmix_x060(args, layer_id) +# +# self.ffn = RWKV_CMix_x060(args, layer_id) +# +# if args.dropout > 0: +# self.drop0 = nn.Dropout(p=args.dropout) +# self.drop1 = nn.Dropout(p=args.dropout) +# +# def forward(self, x, x_emb=None): +# args = self.args +# B, T, C = x.size() +# if self.layer_id == 0: +# x = self.ln0(x) +# +# if self.args.dropout == 0: +# if self.layer_id == 0 and args.pre_ffn > 0: +# x = x + self.ffnPre(self.ln1(x)) +# else: +# x = x + self.att(self.ln1(x)) +# x = x + self.ffn(self.ln2(x)) +# else: +# if self.layer_id == 0 and args.pre_ffn > 0: +# x = self.drop0(x + self.ffnPre(self.ln1(x))) +# else: +# x = self.drop0(x + self.att(self.ln1(x))) +# x = self.drop1(x + self.ffn(self.ln2(x))) +# +# return x + + +class RWKVLayer(nn.Module): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + self.layer_id = layer_id + if args.dim_ffn is None: + args.dim_ffn = int((args.n_embd * 3.5) // 32 * 32) + self.ln0 = None + if self.layer_id == 0 and args.get("ln0", True): + self.ln0 = nn.LayerNorm(args.n_embd) + + self.ln1 = None + if args.get("ln1", True): + self.ln1 = nn.LayerNorm(args.n_embd) + self.ln2 = nn.LayerNorm(args.n_embd) + + self.att = RWKV_TimeMix(args, layer_id) + + self.ffn = RWKV_ChannelMix(args, layer_id) + + if args.dropout > 0: + self.drop0 = nn.Dropout(p=args.dropout) + self.drop1 = nn.Dropout(p=args.dropout) + + # init + if args.get("init_rwkv", True): + print("init_rwkv") + nn.init.orthogonal_(self.att.receptance.weight, gain=1) + nn.init.orthogonal_(self.att.key.weight, gain=0.1) + nn.init.orthogonal_(self.att.value.weight, gain=1) + nn.init.orthogonal_(self.att.gate.weight, gain=0.1) + nn.init.zeros_(self.att.output.weight) + + nn.init.orthogonal_(self.ffn.key.weight, gain=1) + nn.init.zeros_(self.ffn.value.weight) + nn.init.zeros_(self.ffn.receptance.weight) + scale = ((1 + layer_id) / args.get("n_layer")) ** 0.7 + nn.init.constant_(self.ln2.weight, scale) + if self.ln0 is not None: + nn.init.constant_(self.ln0.weight, scale) + if self.ln1 is not None: + nn.init.constant_(self.ln1.weight, scale) + + def forward(self, x, x_emb=None, mask=None, **kwargs): + + args = self.args + if args.get("datatype", "bf16") == "bf16": + x = x.bfloat16() + B, T, C = x.size() + if self.layer_id == 0 and self.ln0 is not None: + x = self.ln0(x) + + if self.args.dropout == 0: + if self.ln1 is None: + x = x + self.att(x) + else: + x = x + self.att(self.ln1(x)) + x = x + self.ffn(self.ln2(x)) + else: + if self.ln1 is None: + x = self.drop0(x + self.att(x)) + else: + x = self.drop0(x + self.att(self.ln1(x))) + x = self.drop1(x + self.ffn(self.ln2(x))) + + if args.get("datatype", "bf16") == "bf16": + x = x.to(torch.float32) + return x + + +class RWKV(nn.Module): + def __init__(self, args): + super().__init__() + self.args = args + if not hasattr(args, "dim_att"): + args.dim_att = args.n_embd + if not hasattr(args, "dim_ffn"): + if "-f4" in os.environ["RWKV_MY_TESTING"]: + args.dim_ffn = int((args.n_embd * 4) // 32 * 32) + else: + args.dim_ffn = int((args.n_embd * 3.5) // 32 * 32) # default = 3.5x emb size + if not hasattr(args, "tiny_att_layer"): + args.tiny_att_layer = -1 + if not hasattr(args, "tiny_att_dim"): + args.tiny_att_dim = -1 + assert args.n_embd % 32 == 0 + assert args.dim_att % 32 == 0 + assert args.dim_ffn % 32 == 0 + + self.emb = nn.Embedding(args.vocab_size, args.n_embd) + + self.blocks = nn.ModuleList([Block(args, i) for i in range(args.n_layer)]) + + self.ln_out = nn.LayerNorm(args.n_embd) + self.head = nn.Linear(args.n_embd, args.vocab_size, bias=False) + + if args.dropout > 0: + self.drop0 = nn.Dropout(p=args.dropout) + + def forward(self, idx): + args = self.args + B, T = idx.size() + assert T <= args.ctx_len, "Cannot forward, model ctx_len is exhausted." + + x = self.emb(idx) + x_emb = x + + if args.dropout > 0: + x = self.drop0(x) + if args.tiny_att_dim > 0: + for block in self.blocks: + if args.grad_cp == 1: + x = deepspeed.checkpointing.checkpoint(block, x, x_emb) + else: + x = block(x, x_emb) + else: + for block in self.blocks: + if args.grad_cp == 1: + x = deepspeed.checkpointing.checkpoint(block, x) + else: + x = block(x) + + x = self.ln_out(x) + + if args.head_qk > 0: + q = self.head_q(x)[:, :T, :] + k = self.head_k(x)[:, :T, :] + c = (q @ k.transpose(-2, -1)) * (1.0 / args.head_qk) + c = c.masked_fill(self.copy_mask[:T, :T] == 0, 0) + + if "32" in os.environ["RWKV_FLOAT_MODE"]: + c = c @ F.one_hot(idx, num_classes=args.vocab_size) + elif os.environ["RWKV_FLOAT_MODE"] == "fp16": + c = c @ F.one_hot(idx, num_classes=args.vocab_size).half() + elif os.environ["RWKV_FLOAT_MODE"] == "bf16": + c = c @ F.one_hot(idx, num_classes=args.vocab_size).bfloat16() + + x = self.head(x) + c + else: + x = self.head(x) + + return x diff --git a/funasr/models/sense_voice/rwkv_v5.py b/funasr/models/sense_voice/rwkv_v5.py new file mode 100644 index 0000000..f19ca79 --- /dev/null +++ b/funasr/models/sense_voice/rwkv_v5.py @@ -0,0 +1,597 @@ +######################################################################################################## +# The RWKV Language Model - https://github.com/BlinkDL/RWKV-LM +######################################################################################################## + +import os, math, gc, importlib +import torch + +# torch._C._jit_set_profiling_executor(True) +# torch._C._jit_set_profiling_mode(True) +import torch.nn as nn +from torch.nn import functional as F + + +def __nop(ob): + return ob + + +MyModule = nn.Module +MyFunction = __nop +if "RWKV_JIT_ON" in os.environ and os.environ["RWKV_JIT_ON"] == "1": + MyModule = torch.jit.ScriptModule + MyFunction = torch.jit.script_method + +######################################################################################################## +# CUDA Kernel +######################################################################################################## + +wkv5_cuda = None + + +def load_rwkv_kernel( + HEAD_SIZE: int = 64, + RWKV_CTXLEN: int = 512, +): + from torch.utils.cpp_extension import load + + global wkv5_cuda + + if wkv5_cuda is not None: + return + + absolute_file_path = os.path.abspath(__file__) + cur_dir = os.path.dirname(absolute_file_path) + + wkv5_cuda = load( + name="wkv5", + sources=[f"{cur_dir}/cuda/wkv5_op.cpp", f"{cur_dir}/cuda/wkv5_cuda.cu"], + verbose=True, + extra_cuda_cflags=[ + "-res-usage", + "--use_fast_math", + "-O3", + "-Xptxas -O3", + "--extra-device-vectorization", + f"-D_N_={HEAD_SIZE}", + ], + ) + + +# dtype = torch.float +dtype = torch.bfloat16 + + +class WKV_5(torch.autograd.Function): + @staticmethod + def forward(ctx, B, T, C, H, r, k, v, w, u): + with torch.no_grad(): + # assert r.dtype == torch.bfloat16 + # assert k.dtype == torch.bfloat16 + # assert v.dtype == torch.bfloat16 + # assert w.dtype == torch.bfloat16 + # assert u.dtype == torch.bfloat16 + # assert HEAD_SIZE == C // H + ctx.B = B + ctx.T = T + ctx.C = C + ctx.H = H + assert r.is_contiguous() + assert k.is_contiguous() + assert v.is_contiguous() + assert w.is_contiguous() + assert u.is_contiguous() + ew = (-torch.exp(w.float())).contiguous() + eew = (torch.exp(ew)).contiguous() + ctx.save_for_backward(r, k, v, eew, ew, u) + y = torch.empty( + (B, T, C), + device=r.device, + dtype=torch.bfloat16, + memory_format=torch.contiguous_format, + ) # .uniform_(-1, 1) + wkv5_cuda.forward(B, T, C, H, r, k, v, eew, u, y) + return y + + @staticmethod + def backward(ctx, gy): + with torch.no_grad(): + assert gy.dtype == torch.bfloat16 + B = ctx.B + T = ctx.T + C = ctx.C + H = ctx.H + assert gy.is_contiguous() + r, k, v, eew, ew, u = ctx.saved_tensors + gr = torch.empty( + (B, T, C), + device=gy.device, + requires_grad=False, + dtype=torch.bfloat16, + memory_format=torch.contiguous_format, + ) # .uniform_(-1, 1) + gk = torch.empty( + (B, T, C), + device=gy.device, + requires_grad=False, + dtype=torch.bfloat16, + memory_format=torch.contiguous_format, + ) # .uniform_(-1, 1) + gv = torch.empty( + (B, T, C), + device=gy.device, + requires_grad=False, + dtype=torch.bfloat16, + memory_format=torch.contiguous_format, + ) # .uniform_(-1, 1) + gw = torch.empty( + (B, C), + device=gy.device, + requires_grad=False, + dtype=torch.bfloat16, + memory_format=torch.contiguous_format, + ) # .uniform_(-1, 1) + gu = torch.empty( + (B, C), + device=gy.device, + requires_grad=False, + dtype=torch.bfloat16, + memory_format=torch.contiguous_format, + ) # .uniform_(-1, 1) + wkv5_cuda.backward(B, T, C, H, r, k, v, eew, ew, u, gy, gr, gk, gv, gw, gu) + gw = torch.sum(gw, 0).view(H, C // H) + gu = torch.sum(gu, 0).view(H, C // H) + return (None, None, None, None, gr, gk, gv, gw, gu) + + +def RUN_CUDA_RWKV5(B, T, C, H, r, k, v, w, u): + return WKV_5.apply(B, T, C, H, r, k, v, w, u) + + +class RWKV_Tmix_x052(MyModule): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + load_rwkv_kernel(args.head_size_a, args.ctx_len) + self.layer_id = layer_id + + self.head_size = args.head_size_a + # assert HEAD_SIZE == self.head_size # change HEAD_SIZE to match args.head_size_a + self.n_head = args.dim_att // self.head_size + assert args.dim_att % self.n_head == 0 + self.head_size_divisor = args.head_size_divisor + + with torch.no_grad(): + ratio_0_to_1 = layer_id / (args.n_layer - 1) # 0 to 1 + ratio_1_to_almost0 = 1.0 - (layer_id / args.n_layer) # 1 to ~0 + ddd = torch.ones(1, 1, args.n_embd) + for i in range(args.n_embd): + ddd[0, 0, i] = i / args.n_embd + + # fancy time_mix + self.time_mix_k = nn.Parameter(torch.pow(ddd, ratio_1_to_almost0)) + self.time_mix_v = nn.Parameter(torch.pow(ddd, ratio_1_to_almost0) + 0.3 * ratio_0_to_1) + self.time_mix_r = nn.Parameter(torch.pow(ddd, 0.5 * ratio_1_to_almost0)) + self.time_mix_g = nn.Parameter(torch.pow(ddd, 0.5 * ratio_1_to_almost0)) + + # fancy time_decay + decay_speed = torch.ones(args.dim_att) + for n in range(args.dim_att): + decay_speed[n] = -6 + 5 * (n / (args.dim_att - 1)) ** (0.7 + 1.3 * ratio_0_to_1) + self.time_decay = nn.Parameter(decay_speed.reshape(self.n_head, self.head_size)) + # print(layer_id, self.time_decay.flatten()[:3].cpu().numpy(), '...', self.time_decay.flatten()[-3:].cpu().numpy()) + + tmp = torch.zeros(args.dim_att) + for n in range(args.dim_att): + zigzag = ((n + 1) % 3 - 1) * 0.1 + tmp[n] = ratio_0_to_1 * (1 - (n / (args.dim_att - 1))) + zigzag + + self.time_faaaa = nn.Parameter(tmp.reshape(self.n_head, self.head_size)) + + self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) + self.receptance = nn.Linear(args.n_embd, args.dim_att, bias=False) + self.key = nn.Linear(args.n_embd, args.dim_att, bias=False) + + self.value = nn.Linear(args.n_embd, args.dim_att, bias=False) + self.output = nn.Linear(args.dim_att, args.n_embd, bias=False) + self.gate = nn.Linear(args.n_embd, args.dim_att, bias=False) + self.ln_x = nn.GroupNorm(self.n_head, args.dim_att) + + @MyFunction + def jit_func(self, x): + B, T, C = x.size() + + xx = self.time_shift(x) # Mix x with the previous timestep to produce xk, xv, xr + xk = x * self.time_mix_k + xx * (1 - self.time_mix_k) + xv = x * self.time_mix_v + xx * (1 - self.time_mix_v) + xr = x * self.time_mix_r + xx * (1 - self.time_mix_r) + xg = x * self.time_mix_g + xx * (1 - self.time_mix_g) + + r = self.receptance(xr) + k = self.key(xk) + v = self.value(xv) + g = F.silu(self.gate(xg)) + + return r, k, v, g + + @MyFunction + def jit_func_2(self, x, g): + B, T, C = x.size() + x = x.view(B * T, C) + + x = self.ln_x(x / self.head_size_divisor).view(B, T, C) + x = self.output(x * g) + return x + + def forward(self, x, **kwargs): + B, T, C = x.size() + H = self.n_head + + r, k, v, g = self.jit_func(x) + + x = RUN_CUDA_RWKV5(B, T, C, H, r, k, v, w=self.time_decay, u=self.time_faaaa) + + return self.jit_func_2(x, g) + + +# +# class RWKV_Tmix_x060(MyModule): +# def __init__(self, args, layer_id): +# super().__init__() +# self.args = args +# +# load_rwkv_kernel(args.head_size_a, args.ctx_len) +# +# self.layer_id = layer_id +# +# self.head_size = args.head_size_a +# self.n_head = args.dim_att // self.head_size +# assert args.dim_att % self.n_head == 0 +# +# with torch.no_grad(): +# ratio_0_to_1 = layer_id / (args.n_layer - 1) # 0 to 1 +# ratio_1_to_almost0 = 1.0 - (layer_id / args.n_layer) # 1 to ~0 +# ddd = torch.ones(1, 1, args.n_embd) +# for i in range(args.n_embd): +# ddd[0, 0, i] = i / args.n_embd +# +# # fancy time_mix +# self.time_maa_x = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) +# self.time_maa_w = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) +# self.time_maa_k = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) +# self.time_maa_v = nn.Parameter( +# 1.0 - (torch.pow(ddd, ratio_1_to_almost0) + 0.3 * ratio_0_to_1) +# ) +# self.time_maa_r = nn.Parameter(1.0 - torch.pow(ddd, 0.5 * ratio_1_to_almost0)) +# self.time_maa_g = nn.Parameter(1.0 - torch.pow(ddd, 0.5 * ratio_1_to_almost0)) +# +# D_MIX_LORA = 32 # generate TIME_MIX for w,k,v,r,g +# self.time_maa_w1 = nn.Parameter(torch.zeros(args.n_embd, D_MIX_LORA * 5)) +# self.time_maa_w2 = nn.Parameter( +# torch.zeros(5, D_MIX_LORA, args.n_embd).uniform_(-0.01, 0.01) +# ) +# +# # fancy time_decay +# decay_speed = torch.ones(args.dim_att) +# for n in range(args.dim_att): +# decay_speed[n] = -6 + 5 * (n / (args.dim_att - 1)) ** (0.7 + 1.3 * ratio_0_to_1) +# self.time_decay = nn.Parameter(decay_speed.reshape(1, 1, args.dim_att)) +# +# D_DECAY_LORA = 64 +# self.time_decay_w1 = nn.Parameter(torch.zeros(args.n_embd, D_DECAY_LORA)) +# self.time_decay_w2 = nn.Parameter( +# torch.zeros(D_DECAY_LORA, args.dim_att).uniform_(-0.01, 0.01) +# ) +# +# tmp = torch.zeros(args.dim_att) +# for n in range(args.dim_att): +# zigzag = ((n + 1) % 3 - 1) * 0.1 +# tmp[n] = ratio_0_to_1 * (1 - (n / (args.dim_att - 1))) + zigzag +# +# self.time_faaaa = nn.Parameter(tmp.reshape(self.n_head, self.head_size)) +# +# self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) +# self.receptance = nn.Linear(args.n_embd, args.dim_att, bias=False) +# self.key = nn.Linear(args.n_embd, args.dim_att, bias=False) +# +# self.value = nn.Linear(args.n_embd, args.dim_att, bias=False) +# self.output = nn.Linear(args.dim_att, args.n_embd, bias=False) +# self.gate = nn.Linear(args.n_embd, args.dim_att, bias=False) +# self.ln_x = nn.GroupNorm( +# self.n_head, args.dim_att, eps=(1e-5) * (args.head_size_divisor**2) +# ) +# +# @MyFunction +# def jit_func(self, x): +# B, T, C = x.size() +# +# xx = self.time_shift(x) - x +# +# xxx = x + xx * self.time_maa_x +# xxx = torch.tanh(xxx @ self.time_maa_w1).view(B * T, 5, -1).transpose(0, 1) +# xxx = torch.bmm(xxx, self.time_maa_w2).view(5, B, T, -1) +# mw, mk, mv, mr, mg = xxx.unbind(dim=0) +# +# xw = x + xx * (self.time_maa_w + mw) +# xk = x + xx * (self.time_maa_k + mk) +# xv = x + xx * (self.time_maa_v + mv) +# xr = x + xx * (self.time_maa_r + mr) +# xg = x + xx * (self.time_maa_g + mg) +# +# r = self.receptance(xr) +# k = self.key(xk) +# v = self.value(xv) +# g = F.silu(self.gate(xg)) +# +# ww = torch.tanh(xw @ self.time_decay_w1) @ self.time_decay_w2 +# w = self.time_decay + ww +# +# return r, k, v, g, w +# +# @MyFunction +# def jit_func_2(self, x, g): +# B, T, C = x.size() +# x = x.view(B * T, C) +# +# x = self.ln_x(x).view(B, T, C) +# x = self.output(x * g) +# return x +# +# def forward(self, x): +# B, T, C = x.size() +# H = self.n_head +# +# r, k, v, g, w = self.jit_func(x) +# x = RUN_CUDA_RWKV6(B, T, C, H, r, k, v, w, u=self.time_faaaa) +# +# return self.jit_func_2(x, g) + + +class RWKV_CMix_x052(MyModule): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + self.layer_id = layer_id + self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) + + with torch.no_grad(): # fancy init of time_mix + ratio_1_to_almost0 = 1.0 - (layer_id / args.n_layer) # 1 to ~0 + ddd = torch.ones(1, 1, args.n_embd) + for i in range(args.n_embd): + ddd[0, 0, i] = i / args.n_embd + self.time_mix_k = nn.Parameter(torch.pow(ddd, ratio_1_to_almost0)) + self.time_mix_r = nn.Parameter(torch.pow(ddd, ratio_1_to_almost0)) + + self.key = nn.Linear(args.n_embd, args.dim_ffn, bias=False) + self.receptance = nn.Linear(args.n_embd, args.n_embd, bias=False) + self.value = nn.Linear(args.dim_ffn, args.n_embd, bias=False) + + @MyFunction + def forward(self, x): + xx = self.time_shift(x) + xk = x * self.time_mix_k + xx * (1 - self.time_mix_k) + xr = x * self.time_mix_r + xx * (1 - self.time_mix_r) + k = self.key(xk) + k = torch.relu(k) ** 2 + kv = self.value(k) + return torch.sigmoid(self.receptance(xr)) * kv + + +# class RWKV_CMix_x060(MyModule): +# def __init__(self, args, layer_id): +# super().__init__() +# self.args = args +# self.layer_id = layer_id +# self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) +# +# with torch.no_grad(): # fancy init of time_mix +# ratio_1_to_almost0 = 1.0 - (layer_id / args.n_layer) # 1 to ~0 +# ddd = torch.ones(1, 1, args.n_embd) +# for i in range(args.n_embd): +# ddd[0, 0, i] = i / args.n_embd +# self.time_maa_k = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) +# self.time_maa_r = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) +# +# self.key = nn.Linear(args.n_embd, args.dim_ffn, bias=False) +# self.receptance = nn.Linear(args.n_embd, args.n_embd, bias=False) +# self.value = nn.Linear(args.dim_ffn, args.n_embd, bias=False) +# +# @MyFunction +# def forward(self, x): +# xx = self.time_shift(x) - x +# xk = x + xx * self.time_maa_k +# xr = x + xx * self.time_maa_r +# +# k = self.key(xk) +# k = torch.relu(k) ** 2 +# kv = self.value(k) +# return torch.sigmoid(self.receptance(xr)) * kv + + +# class Block(nn.Module): +# def __init__(self, args, layer_id): +# super().__init__() +# self.args = args +# self.layer_id = layer_id +# +# self.ln1 = nn.LayerNorm(args.n_embd) +# self.ln2 = nn.LayerNorm(args.n_embd) +# +# if self.layer_id == 0: +# self.ln0 = nn.LayerNorm(args.n_embd) +# +# self.att = RWKV_Tmix_x060(args, layer_id) +# +# self.ffn = RWKV_CMix_x060(args, layer_id) +# +# if args.dropout > 0: +# self.drop0 = nn.Dropout(p=args.dropout) +# self.drop1 = nn.Dropout(p=args.dropout) +# +# def forward(self, x, x_emb=None): +# args = self.args +# B, T, C = x.size() +# if self.layer_id == 0: +# x = self.ln0(x) +# +# if self.args.dropout == 0: +# if self.layer_id == 0 and args.pre_ffn > 0: +# x = x + self.ffnPre(self.ln1(x)) +# else: +# x = x + self.att(self.ln1(x)) +# x = x + self.ffn(self.ln2(x)) +# else: +# if self.layer_id == 0 and args.pre_ffn > 0: +# x = self.drop0(x + self.ffnPre(self.ln1(x))) +# else: +# x = self.drop0(x + self.att(self.ln1(x))) +# x = self.drop1(x + self.ffn(self.ln2(x))) +# +# return x + + +class RWKVLayer(nn.Module): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + self.layer_id = layer_id + if args.dim_ffn is None: + args.dim_ffn = int((args.n_embd * 3.5) // 32 * 32) + self.ln0 = None + if self.layer_id == 0 and args.get("ln0", True): + self.ln0 = nn.LayerNorm(args.n_embd) + + self.ln1 = None + if args.get("ln1", True): + self.ln1 = nn.LayerNorm(args.n_embd) + + self.att = RWKV_Tmix_x052(args, layer_id) + self.ln2 = None + self.ffn = None + if args.get("use_rwkv_ffn", True): + self.ln2 = nn.LayerNorm(args.n_embd) + self.ffn = RWKV_CMix_x052(args, layer_id) + + if args.dropout > 0: + self.drop0 = nn.Dropout(p=args.dropout) + self.drop1 = nn.Dropout(p=args.dropout) + + # init + if args.get("init_rwkv", True): + print("init_rwkv") + nn.init.orthogonal_(self.att.receptance.weight, gain=1) + nn.init.orthogonal_(self.att.key.weight, gain=0.1) + nn.init.orthogonal_(self.att.value.weight, gain=1) + nn.init.orthogonal_(self.att.gate.weight, gain=0.1) + nn.init.zeros_(self.att.output.weight) + + nn.init.orthogonal_(self.ffn.key.weight, gain=1) + nn.init.zeros_(self.ffn.value.weight) + nn.init.zeros_(self.ffn.receptance.weight) + scale = ((1 + layer_id) / args.get("n_layer")) ** 0.7 + nn.init.constant_(self.ln2.weight, scale) + if self.ln0 is not None: + nn.init.constant_(self.ln0.weight, scale) + if self.ln1 is not None: + nn.init.constant_(self.ln1.weight, scale) + + def forward(self, x, x_emb=None, mask=None, **kwargs): + + args = self.args + if args.get("datatype", "bf16") == "bf16": + x = x.bfloat16() + B, T, C = x.size() + if self.layer_id == 0 and self.ln0 is not None: + x = self.ln0(x) + + if self.args.dropout == 0: + if self.ln1 is None: + x = x + self.att(x) + else: + x = x + self.att(self.ln1(x)) + if self.ffn is not None: + x = x + self.ffn(self.ln2(x)) + else: + if self.ln1 is None: + x = self.drop0(x + self.att(x)) + else: + x = self.drop0(x + self.att(self.ln1(x))) + if self.ffn is not None: + x = self.drop1(x + self.ffn(self.ln2(x))) + + if args.get("datatype", "bf16") == "bf16": + x = x.to(torch.float32) + return x + + +# class RWKV(nn.Module): +# def __init__(self, args): +# super().__init__() +# self.args = args +# if not hasattr(args, "dim_att"): +# args.dim_att = args.n_embd +# if not hasattr(args, "dim_ffn"): +# if "-f4" in os.environ["RWKV_MY_TESTING"]: +# args.dim_ffn = int((args.n_embd * 4) // 32 * 32) +# else: +# args.dim_ffn = int((args.n_embd * 3.5) // 32 * 32) # default = 3.5x emb size +# if not hasattr(args, "tiny_att_layer"): +# args.tiny_att_layer = -1 +# if not hasattr(args, "tiny_att_dim"): +# args.tiny_att_dim = -1 +# assert args.n_embd % 32 == 0 +# assert args.dim_att % 32 == 0 +# assert args.dim_ffn % 32 == 0 +# +# self.emb = nn.Embedding(args.vocab_size, args.n_embd) +# +# self.blocks = nn.ModuleList([Block(args, i) for i in range(args.n_layer)]) +# +# self.ln_out = nn.LayerNorm(args.n_embd) +# self.head = nn.Linear(args.n_embd, args.vocab_size, bias=False) +# +# if args.dropout > 0: +# self.drop0 = nn.Dropout(p=args.dropout) +# +# def forward(self, idx): +# args = self.args +# B, T = idx.size() +# assert T <= args.ctx_len, "Cannot forward, model ctx_len is exhausted." +# +# x = self.emb(idx) +# x_emb = x +# +# if args.dropout > 0: +# x = self.drop0(x) +# if args.tiny_att_dim > 0: +# for block in self.blocks: +# if args.grad_cp == 1: +# x = deepspeed.checkpointing.checkpoint(block, x, x_emb) +# else: +# x = block(x, x_emb) +# else: +# for block in self.blocks: +# if args.grad_cp == 1: +# x = deepspeed.checkpointing.checkpoint(block, x) +# else: +# x = block(x) +# +# x = self.ln_out(x) +# +# if args.head_qk > 0: +# q = self.head_q(x)[:, :T, :] +# k = self.head_k(x)[:, :T, :] +# c = (q @ k.transpose(-2, -1)) * (1.0 / args.head_qk) +# c = c.masked_fill(self.copy_mask[:T, :T] == 0, 0) +# +# if "32" in os.environ["RWKV_FLOAT_MODE"]: +# c = c @ F.one_hot(idx, num_classes=args.vocab_size) +# elif os.environ["RWKV_FLOAT_MODE"] == "fp16": +# c = c @ F.one_hot(idx, num_classes=args.vocab_size).half() +# elif os.environ["RWKV_FLOAT_MODE"] == "bf16": +# c = c @ F.one_hot(idx, num_classes=args.vocab_size).bfloat16() +# +# x = self.head(x) + c +# else: +# x = self.head(x) +# +# return x diff --git a/funasr/models/sense_voice/rwkv_v6.py b/funasr/models/sense_voice/rwkv_v6.py new file mode 100644 index 0000000..b91d47a --- /dev/null +++ b/funasr/models/sense_voice/rwkv_v6.py @@ -0,0 +1,478 @@ +######################################################################################################## +# The RWKV Language Model - https://github.com/BlinkDL/RWKV-LM +######################################################################################################## + +import os, math, gc, importlib +import torch + +# torch._C._jit_set_profiling_executor(True) +# torch._C._jit_set_profiling_mode(True) +import torch.nn as nn +from torch.nn import functional as F + + +def __nop(ob): + return ob + + +MyModule = nn.Module +MyFunction = __nop +if "RWKV_JIT_ON" in os.environ and os.environ["RWKV_JIT_ON"] == "1": + MyModule = torch.jit.ScriptModule + MyFunction = torch.jit.script_method + +######################################################################################################## +# CUDA Kernel +######################################################################################################## + +wkv6_cuda = None + + +def load_rwkv_kernel( + HEAD_SIZE: int = 64, + RWKV_CTXLEN: int = 512, +): + from torch.utils.cpp_extension import load + + global wkv6_cuda + + if wkv6_cuda is not None: + return + + absolute_file_path = os.path.abspath(__file__) + cur_dir = os.path.dirname(absolute_file_path) + wkv6_cuda = load( + name="wkv6", + sources=[f"{cur_dir}/cuda/wkv6_op.cpp", f"{cur_dir}/cuda/wkv6_cuda.cu"], + verbose=True, + extra_cuda_cflags=[ + "-res-usage", + "--use_fast_math", + "-O3", + "-Xptxas -O3", + "--extra-device-vectorization", + f"-D_N_={HEAD_SIZE}", + f"-D_T_={RWKV_CTXLEN}", + ], + ) + + +# dtype = torch.float +dtype = torch.bfloat16 + + +class WKV_6(torch.autograd.Function): + @staticmethod + def forward(ctx, B, T, C, H, r, k, v, w, u): + with torch.no_grad(): + # assert r.dtype == torch.bfloat16 + # assert k.dtype == torch.bfloat16 + # assert v.dtype == torch.bfloat16 + # assert w.dtype == torch.bfloat16 + # assert u.dtype == torch.bfloat16 + # assert HEAD_SIZE == C // H + ctx.B = B + ctx.T = T + ctx.C = C + ctx.H = H + assert r.is_contiguous() + assert k.is_contiguous() + assert v.is_contiguous() + assert w.is_contiguous() + assert u.is_contiguous() + ew = (-torch.exp(w.float())).contiguous() + ctx.save_for_backward(r, k, v, ew, u) + y = torch.empty( + (B, T, C), device=r.device, dtype=dtype, memory_format=torch.contiguous_format + ) # .uniform_(-100, 100) + wkv6_cuda.forward(B, T, C, H, r, k, v, ew, u, y) + return y + + @staticmethod + def backward(ctx, gy): + with torch.no_grad(): + # assert gy.dtype == torch.bfloat16 + B = ctx.B + T = ctx.T + C = ctx.C + H = ctx.H + assert gy.is_contiguous() + r, k, v, ew, u = ctx.saved_tensors + gr = torch.empty( + (B, T, C), + device=gy.device, + requires_grad=False, + dtype=dtype, + memory_format=torch.contiguous_format, + ) # .uniform_(-100, 100) + gk = torch.empty( + (B, T, C), + device=gy.device, + requires_grad=False, + dtype=dtype, + memory_format=torch.contiguous_format, + ) # .uniform_(-100, 100) + gv = torch.empty( + (B, T, C), + device=gy.device, + requires_grad=False, + dtype=dtype, + memory_format=torch.contiguous_format, + ) # .uniform_(-100, 100) + gw = torch.empty( + (B, T, C), + device=gy.device, + requires_grad=False, + dtype=dtype, + memory_format=torch.contiguous_format, + ) # .uniform_(-100, 100) + gu = torch.empty( + (B, C), + device=gy.device, + requires_grad=False, + dtype=dtype, + memory_format=torch.contiguous_format, + ) # .uniform_(-100, 100) + wkv6_cuda.backward(B, T, C, H, r, k, v, ew, u, gy, gr, gk, gv, gw, gu) + gu = torch.sum(gu, 0).view(H, C // H) + return (None, None, None, None, gr, gk, gv, gw, gu) + + +def RUN_CUDA_RWKV6(B, T, C, H, r, k, v, w, u): + return WKV_6.apply(B, T, C, H, r, k, v, w, u) + + +class RWKV_Tmix_x060(MyModule): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + + load_rwkv_kernel(args.head_size_a, args.ctx_len) + + self.layer_id = layer_id + + self.head_size = args.head_size_a + self.n_head = args.dim_att // self.head_size + assert args.dim_att % self.n_head == 0 + + with torch.no_grad(): + ratio_0_to_1 = layer_id / (args.n_layer - 1) # 0 to 1 + ratio_1_to_almost0 = 1.0 - (layer_id / args.n_layer) # 1 to ~0 + ddd = torch.ones(1, 1, args.n_embd) + for i in range(args.n_embd): + ddd[0, 0, i] = i / args.n_embd + + # fancy time_mix + self.time_maa_x = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) + self.time_maa_w = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) + self.time_maa_k = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) + self.time_maa_v = nn.Parameter( + 1.0 - (torch.pow(ddd, ratio_1_to_almost0) + 0.3 * ratio_0_to_1) + ) + self.time_maa_r = nn.Parameter(1.0 - torch.pow(ddd, 0.5 * ratio_1_to_almost0)) + self.time_maa_g = nn.Parameter(1.0 - torch.pow(ddd, 0.5 * ratio_1_to_almost0)) + + D_MIX_LORA = 32 # generate TIME_MIX for w,k,v,r,g + self.time_maa_w1 = nn.Parameter(torch.zeros(args.n_embd, D_MIX_LORA * 5)) + self.time_maa_w2 = nn.Parameter( + torch.zeros(5, D_MIX_LORA, args.n_embd).uniform_(-0.01, 0.01) + ) + + # fancy time_decay + decay_speed = torch.ones(args.dim_att) + for n in range(args.dim_att): + decay_speed[n] = -6 + 5 * (n / (args.dim_att - 1)) ** (0.7 + 1.3 * ratio_0_to_1) + self.time_decay = nn.Parameter(decay_speed.reshape(1, 1, args.dim_att)) + + D_DECAY_LORA = 64 + self.time_decay_w1 = nn.Parameter(torch.zeros(args.n_embd, D_DECAY_LORA)) + self.time_decay_w2 = nn.Parameter( + torch.zeros(D_DECAY_LORA, args.dim_att).uniform_(-0.01, 0.01) + ) + + tmp = torch.zeros(args.dim_att) + for n in range(args.dim_att): + zigzag = ((n + 1) % 3 - 1) * 0.1 + tmp[n] = ratio_0_to_1 * (1 - (n / (args.dim_att - 1))) + zigzag + + self.time_faaaa = nn.Parameter(tmp.reshape(self.n_head, self.head_size)) + + self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) + self.receptance = nn.Linear(args.n_embd, args.dim_att, bias=False) + self.key = nn.Linear(args.n_embd, args.dim_att, bias=False) + + self.value = nn.Linear(args.n_embd, args.dim_att, bias=False) + self.output = nn.Linear(args.dim_att, args.n_embd, bias=False) + self.gate = nn.Linear(args.n_embd, args.dim_att, bias=False) + self.ln_x = nn.GroupNorm( + self.n_head, args.dim_att, eps=(1e-5) * (args.head_size_divisor**2) + ) + + @MyFunction + def jit_func(self, x): + B, T, C = x.size() + + xx = self.time_shift(x) - x + + xxx = x + xx * self.time_maa_x + xxx = torch.tanh(xxx @ self.time_maa_w1).view(B * T, 5, -1).transpose(0, 1) + xxx = torch.bmm(xxx, self.time_maa_w2).view(5, B, T, -1) + mw, mk, mv, mr, mg = xxx.unbind(dim=0) + + xw = x + xx * (self.time_maa_w + mw) + xk = x + xx * (self.time_maa_k + mk) + xv = x + xx * (self.time_maa_v + mv) + xr = x + xx * (self.time_maa_r + mr) + xg = x + xx * (self.time_maa_g + mg) + + r = self.receptance(xr) + k = self.key(xk) + v = self.value(xv) + g = F.silu(self.gate(xg)) + + ww = torch.tanh(xw @ self.time_decay_w1) @ self.time_decay_w2 + w = self.time_decay + ww + + return r, k, v, g, w + + @MyFunction + def jit_func_2(self, x, g): + B, T, C = x.size() + x = x.view(B * T, C) + + x = self.ln_x(x).view(B, T, C) + x = self.output(x * g) + return x + + def forward(self, x, **kwargs): + B, T, C = x.size() + H = self.n_head + + r, k, v, g, w = self.jit_func(x) + x = RUN_CUDA_RWKV6(B, T, C, H, r, k, v, w, u=self.time_faaaa) + + return self.jit_func_2(x, g) + + +class RWKV_CMix_x060(MyModule): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + self.layer_id = layer_id + self.time_shift = nn.ZeroPad2d((0, 0, 1, -1)) + + with torch.no_grad(): # fancy init of time_mix + ratio_1_to_almost0 = 1.0 - (layer_id / args.n_layer) # 1 to ~0 + ddd = torch.ones(1, 1, args.n_embd) + for i in range(args.n_embd): + ddd[0, 0, i] = i / args.n_embd + self.time_maa_k = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) + self.time_maa_r = nn.Parameter(1.0 - torch.pow(ddd, ratio_1_to_almost0)) + + self.key = nn.Linear(args.n_embd, args.dim_ffn, bias=False) + self.receptance = nn.Linear(args.n_embd, args.n_embd, bias=False) + self.value = nn.Linear(args.dim_ffn, args.n_embd, bias=False) + + @MyFunction + def forward(self, x): + xx = self.time_shift(x) - x + xk = x + xx * self.time_maa_k + xr = x + xx * self.time_maa_r + + k = self.key(xk) + k = torch.relu(k) ** 2 + kv = self.value(k) + return torch.sigmoid(self.receptance(xr)) * kv + + +class Block(nn.Module): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + self.layer_id = layer_id + + self.ln1 = nn.LayerNorm(args.n_embd) + self.ln2 = nn.LayerNorm(args.n_embd) + + if self.layer_id == 0: + self.ln0 = nn.LayerNorm(args.n_embd) + + self.att = RWKV_Tmix_x060(args, layer_id) + + self.ffn = RWKV_CMix_x060(args, layer_id) + + if args.dropout > 0: + self.drop0 = nn.Dropout(p=args.dropout) + self.drop1 = nn.Dropout(p=args.dropout) + + def forward(self, x, x_emb=None): + args = self.args + B, T, C = x.size() + if self.layer_id == 0: + x = self.ln0(x) + + if self.args.dropout == 0: + if self.layer_id == 0 and args.pre_ffn > 0: + x = x + self.ffnPre(self.ln1(x)) + else: + x = x + self.att(self.ln1(x)) + x = x + self.ffn(self.ln2(x)) + else: + if self.layer_id == 0 and args.pre_ffn > 0: + x = self.drop0(x + self.ffnPre(self.ln1(x))) + else: + x = self.drop0(x + self.att(self.ln1(x))) + x = self.drop1(x + self.ffn(self.ln2(x))) + + return x + + +class RWKVLayer(nn.Module): + def __init__(self, args, layer_id): + super().__init__() + self.args = args + self.layer_id = layer_id + if args.dim_ffn is None: + args.dim_ffn = int((args.n_embd * 3.5) // 32 * 32) + self.ln0 = None + if self.layer_id == 0 and args.get("ln0", True): + self.ln0 = nn.LayerNorm(args.n_embd) + + self.ln1 = None + if args.get("ln1", True): + self.ln1 = nn.LayerNorm(args.n_embd) + + self.att = RWKV_Tmix_x060(args, layer_id) + + self.ln2 = None + self.ffn = None + if args.get("use_rwkv_ffn", True): + self.ln2 = nn.LayerNorm(args.n_embd) + self.ffn = RWKV_CMix_x060(args, layer_id) + + if args.dropout > 0: + self.drop0 = nn.Dropout(p=args.dropout) + self.drop1 = nn.Dropout(p=args.dropout) + + # init + if args.get("init_rwkv", True): + print("init_rwkv") + nn.init.orthogonal_(self.att.receptance.weight, gain=1) + nn.init.orthogonal_(self.att.key.weight, gain=0.1) + nn.init.orthogonal_(self.att.value.weight, gain=1) + nn.init.orthogonal_(self.att.gate.weight, gain=0.1) + nn.init.zeros_(self.att.output.weight) + + nn.init.orthogonal_(self.ffn.key.weight, gain=1) + nn.init.zeros_(self.ffn.value.weight) + nn.init.zeros_(self.ffn.receptance.weight) + scale = ((1 + layer_id) / args.get("n_layer")) ** 0.7 + + if self.ln0 is not None: + nn.init.constant_(self.ln0.weight, scale) + if self.ln1 is not None: + nn.init.constant_(self.ln1.weight, scale) + if self.ln2 is not None: + nn.init.constant_(self.ln2.weight, scale) + + def forward(self, x, x_emb=None, mask=None, **kwargs): + + args = self.args + if args.get("datatype", "bf16") == "bf16": + x = x.bfloat16() + B, T, C = x.size() + if self.layer_id == 0 and self.ln0 is not None: + x = self.ln0(x) + + if self.args.dropout == 0: + if self.ln1 is None: + x = x + self.att(x) + else: + x = x + self.att(self.ln1(x)) + if self.ffn is not None: + x = x + self.ffn(self.ln2(x)) + else: + if self.ln1 is None: + x = self.drop0(x + self.att(x)) + else: + x = self.drop0(x + self.att(self.ln1(x))) + if self.ffn is not None: + x = self.drop1(x + self.ffn(self.ln2(x))) + + if args.get("datatype", "bf16") == "bf16": + x = x.to(torch.float32) + return x + + +class RWKV(nn.Module): + def __init__(self, args): + super().__init__() + self.args = args + if not hasattr(args, "dim_att"): + args.dim_att = args.n_embd + if not hasattr(args, "dim_ffn"): + if "-f4" in os.environ["RWKV_MY_TESTING"]: + args.dim_ffn = int((args.n_embd * 4) // 32 * 32) + else: + args.dim_ffn = int((args.n_embd * 3.5) // 32 * 32) # default = 3.5x emb size + if not hasattr(args, "tiny_att_layer"): + args.tiny_att_layer = -1 + if not hasattr(args, "tiny_att_dim"): + args.tiny_att_dim = -1 + assert args.n_embd % 32 == 0 + assert args.dim_att % 32 == 0 + assert args.dim_ffn % 32 == 0 + + self.emb = nn.Embedding(args.vocab_size, args.n_embd) + + self.blocks = nn.ModuleList([Block(args, i) for i in range(args.n_layer)]) + + self.ln_out = nn.LayerNorm(args.n_embd) + self.head = nn.Linear(args.n_embd, args.vocab_size, bias=False) + + if args.dropout > 0: + self.drop0 = nn.Dropout(p=args.dropout) + + def forward(self, idx): + args = self.args + B, T = idx.size() + assert T <= args.ctx_len, "Cannot forward, model ctx_len is exhausted." + + x = self.emb(idx) + x_emb = x + + if args.dropout > 0: + x = self.drop0(x) + if args.tiny_att_dim > 0: + for block in self.blocks: + if args.grad_cp == 1: + x = deepspeed.checkpointing.checkpoint(block, x, x_emb) + else: + x = block(x, x_emb) + else: + for block in self.blocks: + if args.grad_cp == 1: + x = deepspeed.checkpointing.checkpoint(block, x) + else: + x = block(x) + + x = self.ln_out(x) + + if args.head_qk > 0: + q = self.head_q(x)[:, :T, :] + k = self.head_k(x)[:, :T, :] + c = (q @ k.transpose(-2, -1)) * (1.0 / args.head_qk) + c = c.masked_fill(self.copy_mask[:T, :T] == 0, 0) + + if "32" in os.environ["RWKV_FLOAT_MODE"]: + c = c @ F.one_hot(idx, num_classes=args.vocab_size) + elif os.environ["RWKV_FLOAT_MODE"] == "fp16": + c = c @ F.one_hot(idx, num_classes=args.vocab_size).half() + elif os.environ["RWKV_FLOAT_MODE"] == "bf16": + c = c @ F.one_hot(idx, num_classes=args.vocab_size).bfloat16() + + x = self.head(x) + c + else: + x = self.head(x) + + return x diff --git a/funasr/models/sense_voice/search.py b/funasr/models/sense_voice/search.py new file mode 100644 index 0000000..3a1a049 --- /dev/null +++ b/funasr/models/sense_voice/search.py @@ -0,0 +1,513 @@ +from itertools import chain +from dataclasses import field +import logging +from typing import Any +from typing import Dict +from typing import List +from typing import NamedTuple +from typing import Tuple +from typing import Union + +import torch +import numpy as np + +from funasr.metrics.common import end_detect +from funasr.models.transformer.scorers.scorer_interface import PartialScorerInterface +from funasr.models.transformer.scorers.scorer_interface import ScorerInterface + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: torch.Tensor + score: Union[float, torch.Tensor] = 0 + scores: Dict[str, Union[float, torch.Tensor]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +class BeamSearch(torch.nn.Module): + """Beam search implementation.""" + + def __init__( + self, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + beam_size: int, + vocab_size: int, + sos=None, + eos=None, + # NOTE add rich decoding parameters + # [SPECIAL_TOKEN_1, HAPPY, SAD, ANGRY, NEUTRAL] + emo_unk: int = 58964, + emo_unk_score: float = 1.0, + emo_tokens: List[int] = field(default_factory=lambda: [58954, 58955, 58956, 58957]), + emo_scores: List[float] = field(default_factory=lambda: [0.1, 0.1, 0.1, 0.1]), + # [Speech, BGM, Laughter, Applause] + event_bg_token: List[int] = field(default_factory=lambda: [58946, 58948, 58950, 58952]), + event_ed_token: List[int] = field(default_factory=lambda: [58947, 58949, 58951, 58953]), + event_score_ga: List[float] = field(default_factory=lambda: [1, 1, 5, 25]), + token_list: List[str] = None, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = None, + ): + """Initialize beam search. + + Args: + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + sos (int): Start of sequence id + eos (int): End of sequence id + token_list (list[str]): List of tokens for debug log + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + """ + super().__init__() + # set scorers + self.weights = weights + self.scorers = dict() + self.full_scorers = dict() + self.part_scorers = dict() + # this module dict is required for recursive cast + # `self.to(device, dtype)` in `recog.py` + self.nn_dict = torch.nn.ModuleDict() + for k, v in scorers.items(): + w = weights.get(k, 0) + if w == 0 or v is None: + continue + # assert isinstance( + # v, ScorerInterface + # ), f"{k} ({type(v)}) does not implement ScorerInterface" + self.scorers[k] = v + if isinstance(v, PartialScorerInterface): + self.part_scorers[k] = v + else: + self.full_scorers[k] = v + if isinstance(v, torch.nn.Module): + self.nn_dict[k] = v + + # set configurations + self.sos = sos + self.eos = eos + if isinstance(self.eos, (list, tuple)): + self.eos = eos[0] + self.token_list = token_list + self.pre_beam_size = int(pre_beam_ratio * beam_size) + self.beam_size = beam_size + self.n_vocab = vocab_size + if ( + pre_beam_score_key is not None + and pre_beam_score_key != "full" + and pre_beam_score_key not in self.full_scorers + ): + raise KeyError(f"{pre_beam_score_key} is not found in {self.full_scorers}") + self.pre_beam_score_key = pre_beam_score_key + self.do_pre_beam = ( + self.pre_beam_score_key is not None + and self.pre_beam_size < self.n_vocab + and len(self.part_scorers) > 0 + ) + + self.emo_unk = emo_unk + self.emo_unk_score = emo_unk_score + self.emo_tokens = emo_tokens + self.emo_scores = emo_scores + self.event_bg_token = event_bg_token + self.event_ed_token = event_ed_token + self.event_score_ga = event_score_ga + + def init_hyp(self, x: torch.Tensor) -> List[Hypothesis]: + """Get an initial hypothesis data. + + Args: + x (torch.Tensor): The encoder output feature + + Returns: + Hypothesis: The initial hypothesis. + + """ + init_states = dict() + init_scores = dict() + for k, d in self.scorers.items(): + init_states[k] = d.init_state(x) + init_scores[k] = 0.0 + if not isinstance(self.sos, (list, tuple)): + self.sos = [self.sos] + return [ + Hypothesis( + score=0.0, + scores=init_scores, + states=init_states, + yseq=torch.tensor(self.sos, device=x.device), + ) + ] + + @staticmethod + def append_token(xs: torch.Tensor, x: int) -> torch.Tensor: + """Append new token to prefix tokens. + + Args: + xs (torch.Tensor): The prefix token + x (int): The new token to append + + Returns: + torch.Tensor: New tensor contains: xs + [x] with xs.dtype and xs.device + + """ + x = torch.tensor([x], dtype=xs.dtype, device=xs.device) + return torch.cat((xs, x)) + + def score_full( + self, hyp: Hypothesis, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.full_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.full_scorers` + and tensor score values of shape: `(self.n_vocab,)`, + and state dict that has string keys + and state values of `self.full_scorers` + + """ + scores = dict() + states = dict() + + def get_score(yseq, sp1, sp2): + score = [0, 0] + last_token = yseq[-1] + last_token2 = yseq[-2] if len(yseq) > 1 else yseq[-1] + sum_sp1 = sum([1 if x == sp1 else 0 for x in yseq]) + sum_sp2 = sum([1 if x == sp2 else 0 for x in yseq]) + if sum_sp1 > sum_sp2 or last_token in [sp1, sp2]: + score[0] = -np.inf + if sum_sp2 >= sum_sp1: + score[1] = -np.inf + return score + + def struct_score(yseq, score): + import math + + last_token = yseq[-1] + if last_token in self.emo_tokens + [self.emo_unk]: + # prevent output event after emotation token + score[self.event_bg_token] = -np.inf + + for eve_bg, eve_ed, eve_ga in zip( + self.event_bg_token, self.event_ed_token, self.event_score_ga + ): + score_offset = get_score(yseq, eve_bg, eve_ed) + score[eve_bg] += score_offset[0] + score[eve_ed] += score_offset[1] + score[eve_bg] += math.log(eve_ga) + + score[self.emo_unk] += math.log(self.emo_unk_score) + for emo, emo_th in zip(self.emo_tokens, self.emo_scores): + if score.argmax() == emo and score[emo] < math.log(emo_th): + score[self.emo_unk] = max(score[emo], score[self.emo_unk]) + score[emo] = -np.inf + return score + + for k, d in self.full_scorers.items(): + scores[k], states[k] = d.score(hyp.yseq, hyp.states[k], x) + scores[k] = struct_score(hyp.yseq, scores[k]) + + return scores, states + + def score_partial( + self, hyp: Hypothesis, ids: torch.Tensor, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.part_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + ids (torch.Tensor): 1D tensor of new partial tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.part_scorers` + and tensor score values of shape: `(len(ids),)`, + and state dict that has string keys + and state values of `self.part_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.part_scorers.items(): + scores[k], states[k] = d.score_partial(hyp.yseq, ids, hyp.states[k], x) + return scores, states + + def beam( + self, weighted_scores: torch.Tensor, ids: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute topk full token ids and partial token ids. + + Args: + weighted_scores (torch.Tensor): The weighted sum scores for each tokens. + Its shape is `(self.n_vocab,)`. + ids (torch.Tensor): The partial token ids to compute topk + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + The topk full token ids and partial token ids. + Their shapes are `(self.beam_size,)` + + """ + # no pre beam performed + if weighted_scores.size(0) == ids.size(0): + top_ids = weighted_scores.topk(self.beam_size)[1] + return top_ids, top_ids + + # mask pruned in pre-beam not to select in topk + tmp = weighted_scores[ids] + weighted_scores[:] = -float("inf") + weighted_scores[ids] = tmp + top_ids = weighted_scores.topk(self.beam_size)[1] + local_ids = weighted_scores[ids].topk(self.beam_size)[1] + return top_ids, local_ids + + @staticmethod + def merge_scores( + prev_scores: Dict[str, float], + next_full_scores: Dict[str, torch.Tensor], + full_idx: int, + next_part_scores: Dict[str, torch.Tensor], + part_idx: int, + ) -> Dict[str, torch.Tensor]: + """Merge scores for new hypothesis. + + Args: + prev_scores (Dict[str, float]): + The previous hypothesis scores by `self.scorers` + next_full_scores (Dict[str, torch.Tensor]): scores by `self.full_scorers` + full_idx (int): The next token id for `next_full_scores` + next_part_scores (Dict[str, torch.Tensor]): + scores of partial tokens by `self.part_scorers` + part_idx (int): The new token id for `next_part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are scalar tensors by the scorers. + + """ + new_scores = dict() + for k, v in next_full_scores.items(): + new_scores[k] = prev_scores[k] + v[full_idx] + for k, v in next_part_scores.items(): + new_scores[k] = prev_scores[k] + v[part_idx] + return new_scores + + def merge_states(self, states: Any, part_states: Any, part_idx: int) -> Any: + """Merge states for new hypothesis. + + Args: + states: states of `self.full_scorers` + part_states: states of `self.part_scorers` + part_idx (int): The new token id for `part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are states of the scorers. + + """ + new_states = dict() + for k, v in states.items(): + new_states[k] = v + for k, d in self.part_scorers.items(): + new_states[k] = d.select_state(part_states[k], part_idx) + return new_states + + def search(self, running_hyps: List[Hypothesis], x: torch.Tensor) -> List[Hypothesis]: + """Search new tokens for running hypotheses and encoded speech x. + + Args: + running_hyps (List[Hypothesis]): Running hypotheses on beam + x (torch.Tensor): Encoded speech feature (T, D) + + Returns: + List[Hypotheses]: Best sorted hypotheses + + """ + best_hyps = [] + part_ids = torch.arange(self.n_vocab, device=x.device) # no pre-beam + for hyp in running_hyps: + # scoring + weighted_scores = torch.zeros(self.n_vocab, dtype=x.dtype, device=x.device) + scores, states = self.score_full(hyp, x) + for k in self.full_scorers: + weighted_scores += self.weights[k] * scores[k] + # partial scoring + if self.do_pre_beam: + pre_beam_scores = ( + weighted_scores + if self.pre_beam_score_key == "full" + else scores[self.pre_beam_score_key] + ) + part_ids = torch.topk(pre_beam_scores, self.pre_beam_size)[1] + part_scores, part_states = self.score_partial(hyp, part_ids, x) + for k in self.part_scorers: + weighted_scores[part_ids] += self.weights[k] * part_scores[k] + # add previous hyp score + weighted_scores += hyp.score + + # update hyps + for j, part_j in zip(*self.beam(weighted_scores, part_ids)): + # will be (2 x beam at most) + best_hyps.append( + Hypothesis( + score=weighted_scores[j], + yseq=self.append_token(hyp.yseq, j), + scores=self.merge_scores(hyp.scores, scores, j, part_scores, part_j), + states=self.merge_states(states, part_states, part_j), + ) + ) + + # sort and prune 2 x beam -> beam + best_hyps = sorted(best_hyps, key=lambda x: x.score, reverse=True)[ + : min(len(best_hyps), self.beam_size) + ] + return best_hyps + + def forward( + self, x: torch.Tensor, maxlenratio: float = 0.0, minlenratio: float = 0.0 + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + If maxlenratio<0.0, its absolute value is interpreted + as a constant max output length. + minlenratio (float): Input length ratio to obtain min output length. + + Returns: + list[Hypothesis]: N-best decoding results + + """ + # set length bounds + if maxlenratio == 0: + maxlen = x.shape[0] + elif maxlenratio < 0: + maxlen = -1 * int(maxlenratio) + else: + maxlen = max(1, int(maxlenratio * x.size(0))) + minlen = int(minlenratio * x.size(0)) + logging.info("decoder input length: " + str(x.shape[0])) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # main loop of prefix search + running_hyps = self.init_hyp(x) + ended_hyps = [] + for i in range(maxlen): + logging.debug("position " + str(i)) + best = self.search(running_hyps, x) + # post process of one iteration + running_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps) + # end detection + # if len(ended_hyps) > 0: + # print(f"ended_hyps: {ended_hyps}") + if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i): + logging.info(f"end detected at {i}") + break + if len(running_hyps) == 0: + logging.info("no hypothesis. Finish decoding.") + break + else: + logging.debug(f"remained hypotheses: {len(running_hyps)}") + + nbest_hyps = sorted(ended_hyps, key=lambda x: x.score, reverse=True) + # check the number of hypotheses reaching to eos + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, perform recognition " "again with smaller minlenratio." + ) + return ( + [] + if minlenratio < 0.1 + else self.forward(x, maxlenratio, max(0.0, minlenratio - 0.1)) + ) + + # report the best result + best = nbest_hyps[0] + for k, v in best.scores.items(): + logging.info(f"{v:6.2f} * {self.weights[k]:3} = {v * self.weights[k]:6.2f} for {k}") + logging.info(f"total log probability: {best.score:.2f}") + logging.info(f"normalized log probability: {best.score / len(best.yseq):.2f}") + logging.info(f"total number of ended hypotheses: {len(nbest_hyps)}") + if self.token_list is not None: + logging.info( + "best hypo: " + "".join([self.token_list[x] for x in best.yseq[1:-1]]) + "\n" + ) + return nbest_hyps + + def post_process( + self, + i: int, + maxlen: int, + maxlenratio: float, + running_hyps: List[Hypothesis], + ended_hyps: List[Hypothesis], + ) -> List[Hypothesis]: + """Perform post-processing of beam search iterations. + + Args: + i (int): The length of hypothesis tokens. + maxlen (int): The maximum length of tokens in beam search. + maxlenratio (int): The maximum length ratio in beam search. + running_hyps (List[Hypothesis]): The running hypotheses in beam search. + ended_hyps (List[Hypothesis]): The ended hypotheses in beam search. + + Returns: + List[Hypothesis]: The new running hypotheses. + + """ + logging.debug(f"the number of running hypotheses: {len(running_hyps)}") + if self.token_list is not None: + logging.debug( + "best hypo: " + "".join([self.token_list[x] for x in running_hyps[0].yseq[1:]]) + ) + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + running_hyps = [ + h._replace(yseq=self.append_token(h.yseq, self.eos)) for h in running_hyps + ] + + # add ended hypotheses to a final list, and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in running_hyps: + if hyp.yseq[-1] == self.eos: + # e.g., Word LM needs to add final score + for k, d in chain(self.full_scorers.items(), self.part_scorers.items()): + s = d.final_score(hyp.states[k]) + hyp.scores[k] += s + hyp = hyp._replace(score=hyp.score + self.weights[k] * s) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + return remained_hyps diff --git a/funasr/models/sense_voice/template.yaml b/funasr/models/sense_voice/template.yaml new file mode 100644 index 0000000..1a25ea4 --- /dev/null +++ b/funasr/models/sense_voice/template.yaml @@ -0,0 +1,108 @@ +# network architecture +model: SenseVoiceRWKV +model_conf: + lsm_weight: 0.1 + length_normalized_loss: true + activation_checkpoint: true + sos: "<|startoftranscript|>" + eos: "<|endoftext|>" + downsample_rate: 4 + use_padmask: true + + dims: + n_mels: 128 + n_vocab: 60515 + n_audio_ctx: 1500 + n_audio_state: 1280 + n_audio_head: 20 + n_audio_layer: 32 + n_text_ctx: 448 + n_text_state: 1280 + n_text_head: 20 + n_text_layer: 32 + + +# decoder +decoder: SenseVoiceDecoder +decoder_conf: + rwkv_cfg: + n_embd: 1280 + dropout: 0 + head_size_a: 64 + ctx_len: 1280 + dim_att: 1280 #${model_conf.rwkv_cfg.n_embd} + dim_ffn: null + head_size_divisor: 8 + n_layer: 32 + pre_ffn: 0 + ln0: false + ln1: false + init_rwkv: false + datatype: bf16 + + +# frontend related +frontend: WhisperFrontend +frontend_conf: + fs: 16000 + n_mels: ${model_conf.dims.n_mels} + do_pad_trim: false + +tokenizer: SenseVoiceTokenizer +tokenizer_conf: + vocab_path: null + is_multilingual: true + num_languages: 8749 + +dataset: SenseVoiceDataset +dataset_conf: + index_ds: IndexDSJsonlRankSplit + batch_sampler: EspnetStyleBatchSampler + rank_split: true + batch_type: token # example or length + batch_size: 3500 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2200 + min_token_length: 60 + max_source_length: 2000 + min_source_length: 60 + max_target_length: 150 + min_target_length: 0 + shuffle: True + num_workers: 4 + sos: ${model_conf.sos} + eos: ${model_conf.eos} + +train_conf: + accum_grad: 2 + grad_clip: 5 + max_epoch: 20 + keep_nbest_models: 20 + avg_nbest_model: ${train_conf.keep_nbest_models} + log_interval: 50 + reset_gpu_cache: true + +optim: adamw +optim_conf: + lr: 0.00002 + +scheduler: warmuplr +scheduler_conf: + warmup_steps: 10000 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 40 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_ratio_range: + - 0.0 + - 0.12 + num_time_mask: 2 + +scope_map: ['encoder.encoders', 'model.encoder', 'decoder.decoders', 'model.decoder'] \ No newline at end of file diff --git a/funasr/models/sense_voice/whisper_lib/__init__.py b/funasr/models/sense_voice/whisper_lib/__init__.py new file mode 100644 index 0000000..855b8cf --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/__init__.py @@ -0,0 +1,152 @@ +import hashlib +import io +import os +import urllib +import warnings +from typing import List, Optional, Union + +import torch +from tqdm import tqdm + +from .audio import load_audio, log_mel_spectrogram, pad_or_trim +from .decoding import DecodingOptions, DecodingResult, decode, detect_language +from .model import ModelDimensions, Whisper +from .transcribe import transcribe +from .version import __version__ + +_MODELS = { + "tiny.en": "https://openaipublic.azureedge.net/main/whisper/models/d3dd57d32accea0b295c96e26691aa14d8822fac7d9d27d5dc00b4ca2826dd03/tiny.en.pt", + "tiny": "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt", + "base.en": "https://openaipublic.azureedge.net/main/whisper/models/25a8566e1d0c1e2231d1c762132cd20e0f96a85d16145c3a00adf5d1ac670ead/base.en.pt", + "base": "https://openaipublic.azureedge.net/main/whisper/models/ed3a0b6b1c0edf879ad9b11b1af5a0e6ab5db9205f891f668f8b0e6c6326e34e/base.pt", + "small.en": "https://openaipublic.azureedge.net/main/whisper/models/f953ad0fd29cacd07d5a9eda5624af0f6bcf2258be67c92b79389873d91e0872/small.en.pt", + "small": "https://openaipublic.azureedge.net/main/whisper/models/9ecf779972d90ba49c06d968637d720dd632c55bbf19d441fb42bf17a411e794/small.pt", + "medium.en": "https://openaipublic.azureedge.net/main/whisper/models/d7440d1dc186f76616474e0ff0b3b6b879abc9d1a4926b7adfa41db2d497ab4f/medium.en.pt", + "medium": "https://openaipublic.azureedge.net/main/whisper/models/345ae4da62f9b3d59415adc60127b97c714f32e89e936602e85993674d08dcb1/medium.pt", + "large-v1": "https://openaipublic.azureedge.net/main/whisper/models/e4b87e7e0bf463eb8e6956e646f1e277e901512310def2c24bf0e11bd3c28e9a/large-v1.pt", + "large-v2": "https://openaipublic.azureedge.net/main/whisper/models/81f7c96c852ee8fc832187b0132e569d6c3065a3252ed18e56effd0b6a73e524/large-v2.pt", + "large-v3": "https://openaipublic.azureedge.net/main/whisper/models/e5b1a55b89c1367dacf97e3e19bfd829a01529dbfdeefa8caeb59b3f1b81dadb/large-v3.pt", + "large": "https://openaipublic.azureedge.net/main/whisper/models/e5b1a55b89c1367dacf97e3e19bfd829a01529dbfdeefa8caeb59b3f1b81dadb/large-v3.pt", +} + +# base85-encoded (n_layers, n_heads) boolean arrays indicating the cross-attention heads that are +# highly correlated to the word-level timing, i.e. the alignment between audio and text tokens. +_ALIGNMENT_HEADS = { + "tiny.en": b"ABzY8J1N>@0{>%R00Bk>$p{7v037`oCl~+#00", + "tiny": b"ABzY8bu8Lr0{>%RKn9Fp%m@SkK7Kt=7ytkO", + "base.en": b"ABzY8;40c<0{>%RzzG;p*o+Vo09|#PsxSZm00", + "base": b"ABzY8KQ!870{>%RzyTQH3`Q^yNP!>##QT-?_)10{>%RpeA61k&I|OI3I$65C{;;pbCHh0B{qLQ;+}v00", + "small": b"ABzY8DmU6=0{>%Rpa?J`kvJ6qF(V^F86#Xh7JUGMK}P%R7%R7}kK1fFL7w6%<-Pf*t^=N)Qr&0RR9", + "large-v1": b"ABzY8r9j$a0{>%R7#4sLmoOs{s)o3~84-RPdcFk!JR%R7=D0pU<_bnWW*tkYAhobTNnu$jnkEkXqp)j;w1Tzk)UH3X%SZd&fFZ2fC2yj", + "large-v3": b"ABzY8gWO1E0{>%R7(9S+Kn!D~%ngiGaR?*L!iJG9p-nab0JQ=-{D1-g00", + "large": b"ABzY8gWO1E0{>%R7(9S+Kn!D~%ngiGaR?*L!iJG9p-nab0JQ=-{D1-g00", +} + + +def _download(url: str, root: str, in_memory: bool) -> Union[bytes, str]: + os.makedirs(root, exist_ok=True) + + expected_sha256 = url.split("/")[-2] + download_target = os.path.join(root, os.path.basename(url)) + + if os.path.exists(download_target) and not os.path.isfile(download_target): + raise RuntimeError(f"{download_target} exists and is not a regular file") + + if os.path.isfile(download_target): + with open(download_target, "rb") as f: + model_bytes = f.read() + if hashlib.sha256(model_bytes).hexdigest() == expected_sha256: + return model_bytes if in_memory else download_target + else: + warnings.warn( + f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file" + ) + + with urllib.request.urlopen(url) as source, open(download_target, "wb") as output: + with tqdm( + total=int(source.info().get("Content-Length")), + ncols=80, + unit="iB", + unit_scale=True, + unit_divisor=1024, + ) as loop: + while True: + buffer = source.read(8192) + if not buffer: + break + + output.write(buffer) + loop.update(len(buffer)) + + model_bytes = open(download_target, "rb").read() + if hashlib.sha256(model_bytes).hexdigest() != expected_sha256: + raise RuntimeError( + "Model has been downloaded but the SHA256 checksum does not not match. Please retry loading the model." + ) + + return model_bytes if in_memory else download_target + + +def available_models() -> List[str]: + """Returns the names of available models""" + return list(_MODELS.keys()) + + +def load_model( + name: str, + device: Optional[Union[str, torch.device]] = None, + download_root: str = None, + in_memory: bool = False, +) -> Whisper: + """ + Load a Whisper ASR model + + Parameters + ---------- + name : str + one of the official model names listed by `whisper.available_models()`, or + path to a model checkpoint containing the model dimensions and the model state_dict. + device : Union[str, torch.device] + the PyTorch device to put the model into + download_root: str + path to download the model files; by default, it uses "~/.cache/whisper" + in_memory: bool + whether to preload the model weights into host memory + + Returns + ------- + model : Whisper + The Whisper ASR model instance + """ + + if device is None: + device = "cuda" if torch.cuda.is_available() else "cpu" + if download_root is None: + default = os.path.join(os.path.expanduser("~"), ".cache") + download_root = os.path.join(os.getenv("XDG_CACHE_HOME", default), "whisper") + + if name in _MODELS: + checkpoint_file = _download(_MODELS[name], download_root, in_memory) + alignment_heads = _ALIGNMENT_HEADS[name] + elif os.path.isfile(name): + checkpoint_file = open(name, "rb").read() if in_memory else name + alignment_heads = None + else: + raise RuntimeError(f"Model {name} not found; available models = {available_models()}") + + with io.BytesIO(checkpoint_file) if in_memory else open(checkpoint_file, "rb") as fp: + checkpoint = torch.load(fp, map_location=device) + del checkpoint_file + + dims = ModelDimensions(**checkpoint["dims"]) + model = Whisper(dims) + model.load_state_dict(checkpoint["model_state_dict"]) + + if alignment_heads is not None: + model.set_alignment_heads(alignment_heads) + + return model.to(device) diff --git a/funasr/models/sense_voice/whisper_lib/__main__.py b/funasr/models/sense_voice/whisper_lib/__main__.py new file mode 100644 index 0000000..8874c7a --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/__main__.py @@ -0,0 +1,3 @@ +# from .transcribe import cli +# +# cli() diff --git a/funasr/models/sense_voice/whisper_lib/audio.py b/funasr/models/sense_voice/whisper_lib/audio.py new file mode 100644 index 0000000..2f688e9 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/audio.py @@ -0,0 +1,155 @@ +import os +from functools import lru_cache +from subprocess import CalledProcessError, run +from typing import Optional, Union + +import numpy as np +import torch +import torch.nn.functional as F + +from .utils import exact_div + +# hard-coded audio hyperparameters +SAMPLE_RATE = 16000 +N_FFT = 400 +HOP_LENGTH = 160 +CHUNK_LENGTH = 30 +N_SAMPLES = CHUNK_LENGTH * SAMPLE_RATE # 480000 samples in a 30-second chunk +N_FRAMES = exact_div(N_SAMPLES, HOP_LENGTH) # 3000 frames in a mel spectrogram input + +N_SAMPLES_PER_TOKEN = HOP_LENGTH * 2 # the initial convolutions has stride 2 +FRAMES_PER_SECOND = exact_div(SAMPLE_RATE, HOP_LENGTH) # 10ms per audio frame +TOKENS_PER_SECOND = exact_div(SAMPLE_RATE, N_SAMPLES_PER_TOKEN) # 20ms per audio token + + +def load_audio(file: str, sr: int = SAMPLE_RATE): + """ + Open an audio file and read as mono waveform, resampling as necessary + + Parameters + ---------- + file: str + The audio file to open + + sr: int + The sample rate to resample the audio if necessary + + Returns + ------- + A NumPy array containing the audio waveform, in float32 dtype. + """ + + # This launches a subprocess to decode audio while down-mixing + # and resampling as necessary. Requires the ffmpeg CLI in PATH. + # fmt: off + cmd = [ + "ffmpeg", + "-nostdin", + "-threads", "0", + "-i", file, + "-f", "s16le", + "-ac", "1", + "-acodec", "pcm_s16le", + "-ar", str(sr), + "-" + ] + # fmt: on + try: + out = run(cmd, capture_output=True, check=True).stdout + except CalledProcessError as e: + raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e + + return np.frombuffer(out, np.int16).flatten().astype(np.float32) / 32768.0 + + +def pad_or_trim(array, length: int = N_SAMPLES, *, axis: int = -1): + """ + Pad or trim the audio array to N_SAMPLES, as expected by the encoder. + """ + if torch.is_tensor(array): + if array.shape[axis] > length: + array = array.index_select(dim=axis, index=torch.arange(length, device=array.device)) + + if array.shape[axis] < length: + pad_widths = [(0, 0)] * array.ndim + pad_widths[axis] = (0, length - array.shape[axis]) + array = F.pad(array, [pad for sizes in pad_widths[::-1] for pad in sizes]) + else: + if array.shape[axis] > length: + array = array.take(indices=range(length), axis=axis) + + if array.shape[axis] < length: + pad_widths = [(0, 0)] * array.ndim + pad_widths[axis] = (0, length - array.shape[axis]) + array = np.pad(array, pad_widths) + + return array + + +@lru_cache(maxsize=None) +def mel_filters(device, n_mels: int, filters_path: str = None) -> torch.Tensor: + """ + load the mel filterbank matrix for projecting STFT into a Mel spectrogram. + Allows decoupling librosa dependency; saved using: + + np.savez_compressed( + "mel_filters.npz", + mel_80=librosa.filters.mel(sr=16000, n_fft=400, n_mels=80), + mel_128=librosa.filters.mel(sr=16000, n_fft=400, n_mels=128), + ) + """ + assert n_mels in {80, 128}, f"Unsupported n_mels: {n_mels}" + if filters_path is None: + filters_path = os.path.join(os.path.dirname(__file__), "assets", "mel_filters.npz") + with np.load(filters_path, allow_pickle=False) as f: + return torch.from_numpy(f[f"mel_{n_mels}"]).to(device) + + +def log_mel_spectrogram( + audio: Union[str, np.ndarray, torch.Tensor], + n_mels: int = 80, + padding: int = 0, + device: Optional[Union[str, torch.device]] = None, +): + """ + Compute the log-Mel spectrogram of + + Parameters + ---------- + audio: Union[str, np.ndarray, torch.Tensor], shape = (*) + The path to audio or either a NumPy array or Tensor containing the audio waveform in 16 kHz + + n_mels: int + The number of Mel-frequency filters, only 80 is supported + + padding: int + Number of zero samples to pad to the right + + device: Optional[Union[str, torch.device]] + If given, the audio tensor is moved to this device before STFT + + Returns + ------- + torch.Tensor, shape = (80, n_frames) + A Tensor that contains the Mel spectrogram + """ + if not torch.is_tensor(audio): + if isinstance(audio, str): + audio = load_audio(audio) + audio = torch.from_numpy(audio) + + if device is not None: + audio = audio.to(device) + if padding > 0: + audio = F.pad(audio, (0, padding)) + window = torch.hann_window(N_FFT).to(audio.device) + stft = torch.stft(audio, N_FFT, HOP_LENGTH, window=window, return_complex=True) + magnitudes = stft[..., :-1].abs() ** 2 + + filters = mel_filters(audio.device, n_mels) + mel_spec = filters @ magnitudes + + log_spec = torch.clamp(mel_spec, min=1e-10).log10() + log_spec = torch.maximum(log_spec, log_spec.max() - 8.0) + log_spec = (log_spec + 4.0) / 4.0 + return log_spec diff --git a/funasr/models/sense_voice/whisper_lib/decoding.py b/funasr/models/sense_voice/whisper_lib/decoding.py new file mode 100644 index 0000000..a468efa --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/decoding.py @@ -0,0 +1,890 @@ +from dataclasses import dataclass, field, replace +from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple, Union + +import numpy as np +import torch +import torch.nn.functional as F +from torch import Tensor +from torch.distributions import Categorical + +from .audio import CHUNK_LENGTH +from .tokenizer import Tokenizer, get_tokenizer +from .utils import compression_ratio +from funasr.models.transformer.utils.nets_utils import to_device + + +if TYPE_CHECKING: + from .model import Whisper + + +@torch.no_grad() +def detect_language( + model: "Whisper", + mel: Tensor, + tokenizer: Tokenizer = None, + initial_prompt=None, + x=None, +) -> Tuple[Tensor, List[dict]]: + """ + Detect the spoken language in the audio, and return them as list of strings, along with the ids + of the most probable language tokens and the probability distribution over all language tokens. + This is performed outside the main decode loop in order to not interfere with kv-caching. + + Returns + ------- + language_tokens : Tensor, shape = (n_audio,) + ids of the most probable language tokens, which appears after the startoftranscript token. + language_probs : List[Dict[str, float]], length = n_audio + list of dictionaries containing the probability distribution over all languages. + """ + if tokenizer is None: + tokenizer = get_tokenizer(model.is_multilingual, num_languages=model.num_languages) + if tokenizer.language is None or tokenizer.language_token not in tokenizer.sot_sequence: + raise ValueError("This model doesn't have language tokens so it can't perform lang id") + + single = mel.ndim == 2 + if single: + mel = mel.unsqueeze(0) + + # skip encoder forward pass if already-encoded audio features were given + # FIX(funasr): sense vocie + if mel.shape[-1] != model.dims.n_audio_state: + mel = model.encoder(mel) + + # forward pass using a single token, startoftranscript + n_audio = mel.shape[0] + # FIX(funasr): sense vocie + # x = torch.tensor([[tokenizer.sot]] * n_audio).to(mel.device) # [n_audio, 1] + if x is None: + x = torch.tensor([tokenizer.encode(initial_prompt, allowed_special="all")] * n_audio).to( + mel.device + ) # [n_audio, 1] + + else: + x = x.to(mel.device) + # FIX(funasr): sense vocie + logits = model.logits(x[:, :-1], mel)[:, -1] + # logits = model.logits(x[:, :], mel)[:, -1] + + # collect detected languages; suppress all non-language tokens + mask = torch.ones(logits.shape[-1], dtype=torch.bool) + mask[list(tokenizer.all_language_tokens)] = False + mask[tokenizer.no_speech] = False + + logits[:, mask] = -np.inf + language_tokens = logits.argmax(dim=-1) + language_token_probs = logits.softmax(dim=-1).cpu() + + language_probs = [ + { + c: language_token_probs[i, j].item() + for j, c in zip( + list(tokenizer.all_language_tokens) + [tokenizer.no_speech], + list(tokenizer.all_language_codes) + ["nospeech"], + ) + } + for i in range(n_audio) + ] + + if single: + language_tokens = language_tokens[0] + language_probs = language_probs[0] + + return language_tokens, language_probs + + +@dataclass(frozen=True) +class DecodingOptions: + # whether to perform X->X "transcribe" or X->English "translate" + task: str = "transcribe" + + # language that the audio is in; uses detected language if None + language: Optional[str] = None + + # sampling-related options + temperature: float = 0.0 + sample_len: Optional[int] = None # maximum number of tokens to sample + best_of: Optional[int] = None # number of independent sample trajectories, if t > 0 + beam_size: Optional[int] = None # number of beams in beam search, if t == 0 + patience: Optional[float] = None # patience in beam search (arxiv:2204.05424) + + # "alpha" in Google NMT, or None for length norm, when ranking generations + # to select which to return among the beams or best-of-N samples + length_penalty: Optional[float] = None + + # text or tokens to feed as the prompt or the prefix; for more info: + # https://github.com/openai/whisper/discussions/117#discussioncomment-3727051 + prompt: Optional[Union[str, List[int]]] = None # for the previous context + prefix: Optional[Union[str, List[int]]] = None # to prefix the current context + + # list of tokens ids (or comma-separated token ids) to suppress + # "-1" will suppress a set of symbols as defined in `tokenizer.non_speech_tokens()` + suppress_tokens: Optional[Union[str, Iterable[int]]] = "-1" + suppress_blank: bool = True # this will suppress blank outputs + + gain_event: bool = False # this will suppress blank outputs + gain_tokens_bg: Optional[Union[str, List[int]]] = "<|Speech|><|BGM|><|Applause|><|Laughter|>" + gain_tokens_ed: Optional[Union[str, List[int]]] = ( + "<|/Speech|><|/BGM|><|/Applause|><|/Laughter|>" + ) + gain_tokens_score: List[float] = field(default_factory=lambda: [1, 1, 25.0, 5.0]) # [25, 5] + + use_emo_threshold: bool = False # this will suppress blank outputs + emo_unk_token: Optional[Union[str, List[int]]] = "<|SPECIAL_TOKEN_1|>" + emo_target_tokens: Optional[Union[str, List[int]]] = "<|HAPPY|><|SAD|><|ANGRY|>" + emo_target_threshold: List[float] = field(default_factory=lambda: [0.1, 0.1, 0.1]) # [25, 5] + + # timestamp sampling options + without_timestamps: bool = False # use <|notimestamps|> to sample text tokens only + max_initial_timestamp: Optional[float] = 1.0 + + # implementation details + fp16: bool = True # use fp16 for most of the calculation + + # FIX(funasr): sense vocie + initial_prompt: str = None + vocab_path: str = None + + +@dataclass(frozen=True) +class DecodingResult: + audio_features: Tensor + language: str + language_probs: Optional[Dict[str, float]] = None + tokens: List[int] = field(default_factory=list) + text: str = "" + avg_logprob: float = np.nan + no_speech_prob: float = np.nan + temperature: float = np.nan + compression_ratio: float = np.nan + + +class Inference: + def logits(self, tokens: Tensor, audio_features: Tensor) -> Tensor: + """Perform a forward pass on the decoder and return per-token logits""" + raise NotImplementedError + + def rearrange_kv_cache(self, source_indices) -> None: + """Update the key-value cache according to the updated beams""" + raise NotImplementedError + + def cleanup_caching(self) -> None: + """Clean up any resources or hooks after decoding is finished""" + pass + + +class PyTorchInference(Inference): + def __init__(self, model: "Whisper", initial_token_length: int): + self.model: "Whisper" = model + self.initial_token_length = initial_token_length + self.kv_cache = {} + self.hooks = [] + + key_modules = [block.attn.key for block in self.model.decoder.blocks] + value_modules = [block.attn.value for block in self.model.decoder.blocks] + self.kv_modules = key_modules + value_modules + + def logits(self, tokens: Tensor, audio_features: Tensor) -> Tensor: + if not self.kv_cache: + self.kv_cache, self.hooks = self.model.install_kv_cache_hooks() + + if tokens.shape[-1] > self.initial_token_length: + # only need to use the last token except in the first forward pass + tokens = tokens[:, -1:] + + return self.model.decoder(tokens, audio_features, kv_cache=self.kv_cache) + + def cleanup_caching(self): + for hook in self.hooks: + hook.remove() + + self.kv_cache = {} + self.hooks = [] + + def rearrange_kv_cache(self, source_indices): + if source_indices != list(range(len(source_indices))): + for module in self.kv_modules: + # update the key/value cache to contain the selected sequences + self.kv_cache[module] = self.kv_cache[module][source_indices].detach() + + +class SequenceRanker: + def rank(self, tokens: List[List[Tensor]], sum_logprobs: List[List[float]]) -> List[int]: + """ + Given a list of groups of samples and their cumulative log probabilities, + return the indices of the samples in each group to select as the final result + """ + raise NotImplementedError + + +class MaximumLikelihoodRanker(SequenceRanker): + """ + Select the sample with the highest log probabilities, penalized using either + a simple length normalization or Google NMT paper's length penalty + """ + + def __init__(self, length_penalty: Optional[float]): + self.length_penalty = length_penalty + + def rank(self, tokens: List[List[Tensor]], sum_logprobs: List[List[float]]): + def scores(logprobs, lengths): + result = [] + for logprob, length in zip(logprobs, lengths): + if self.length_penalty is None: + penalty = length + else: + # from the Google NMT paper + penalty = ((5 + length) / 6) ** self.length_penalty + result.append(logprob / penalty) + return result + + # get the sequence with the highest score + lengths = [[len(t) for t in s] for s in tokens] + return [np.argmax(scores(p, l)) for p, l in zip(sum_logprobs, lengths)] + + +class TokenDecoder: + def reset(self): + """Initialize any stateful variables for decoding a new sequence""" + + def update(self, tokens: Tensor, logits: Tensor, sum_logprobs: Tensor) -> Tuple[Tensor, bool]: + """Specify how to select the next token, based on the current trace and logits + + Parameters + ---------- + tokens : Tensor, shape = (n_batch, current_sequence_length) + all tokens in the context so far, including the prefix and sot_sequence tokens + + logits : Tensor, shape = (n_batch, vocab_size) + per-token logits of the probability distribution at the current step + + sum_logprobs : Tensor, shape = (n_batch) + cumulative log probabilities for each sequence + + Returns + ------- + tokens : Tensor, shape = (n_batch, current_sequence_length + 1) + the tokens, appended with the selected next token + + completed : bool + True if all sequences has reached the end of text + + """ + raise NotImplementedError + + def finalize( + self, tokens: Tensor, sum_logprobs: Tensor + ) -> Tuple[Sequence[Sequence[Tensor]], List[List[float]]]: + """Finalize search and return the final candidate sequences + + Parameters + ---------- + tokens : Tensor, shape = (n_audio, n_group, current_sequence_length) + all tokens in the context so far, including the prefix and sot_sequence + + sum_logprobs : Tensor, shape = (n_audio, n_group) + cumulative log probabilities for each sequence + + Returns + ------- + tokens : Sequence[Sequence[Tensor]], length = n_audio + sequence of Tensors containing candidate token sequences, for each audio input + + sum_logprobs : List[List[float]], length = n_audio + sequence of cumulative log probabilities corresponding to the above + + """ + raise NotImplementedError + + +class GreedyDecoder(TokenDecoder): + def __init__(self, temperature: float, eot: int): + self.temperature = temperature + self.eot = eot + + def update(self, tokens: Tensor, logits: Tensor, sum_logprobs: Tensor) -> Tuple[Tensor, bool]: + if self.temperature == 0: + next_tokens = logits.argmax(dim=-1) + else: + next_tokens = Categorical(logits=logits / self.temperature).sample() + + logprobs = F.log_softmax(logits.float(), dim=-1) + current_logprobs = logprobs[torch.arange(logprobs.shape[0]), next_tokens] + sum_logprobs += current_logprobs * (tokens[:, -1] != self.eot) + + next_tokens[tokens[:, -1] == self.eot] = self.eot + tokens = torch.cat([tokens, next_tokens[:, None]], dim=-1) + + completed = (tokens[:, -1] == self.eot).all() + return tokens, completed + + def finalize(self, tokens: Tensor, sum_logprobs: Tensor): + # make sure each sequence has at least one EOT token at the end + tokens = F.pad(tokens, (0, 1), value=self.eot) + return tokens, sum_logprobs.tolist() + + +class BeamSearchDecoder(TokenDecoder): + def __init__( + self, + beam_size: int, + eot: int, + inference: Inference, + patience: Optional[float] = None, + ): + self.beam_size = beam_size + self.eot = eot + self.inference = inference + self.patience = patience or 1.0 + self.max_candidates: int = round(beam_size * self.patience) + self.finished_sequences = None + + assert self.max_candidates > 0, f"Invalid beam size ({beam_size}) or patience ({patience})" + + def reset(self): + self.finished_sequences = None + + def update(self, tokens: Tensor, logits: Tensor, sum_logprobs: Tensor) -> Tuple[Tensor, bool]: + if tokens.shape[0] % self.beam_size != 0: + raise ValueError(f"{tokens.shape}[0] % {self.beam_size} != 0") + + n_audio = tokens.shape[0] // self.beam_size + if self.finished_sequences is None: # for the first update + self.finished_sequences = [{} for _ in range(n_audio)] + + logprobs = F.log_softmax(logits.float(), dim=-1) + next_tokens, source_indices, finished_sequences = [], [], [] + for i in range(n_audio): + scores, sources, finished = {}, {}, {} + + # STEP 1: calculate the cumulative log probabilities for possible candidates + for j in range(self.beam_size): + idx = i * self.beam_size + j + prefix = tokens[idx].tolist() + for logprob, token in zip(*logprobs[idx].topk(self.beam_size + 1)): + new_logprob = (sum_logprobs[idx] + logprob).item() + sequence = tuple(prefix + [token.item()]) + scores[sequence] = new_logprob + sources[sequence] = idx + + # STEP 2: rank the candidates and keep the top beam_size sequences for each audio + saved = 0 + for sequence in sorted(scores, key=scores.get, reverse=True): + if sequence[-1] == self.eot: + finished[sequence] = scores[sequence] + else: + sum_logprobs[len(next_tokens)] = scores[sequence] + next_tokens.append(sequence) + source_indices.append(sources[sequence]) + + saved += 1 + if saved == self.beam_size: + break + + finished_sequences.append(finished) + + tokens = torch.tensor(next_tokens, device=tokens.device) + self.inference.rearrange_kv_cache(source_indices) + + # add newly finished sequences to self.finished_sequences + assert len(self.finished_sequences) == len(finished_sequences) + for previously_finished, newly_finished in zip(self.finished_sequences, finished_sequences): + for seq in sorted(newly_finished, key=newly_finished.get, reverse=True): + if len(previously_finished) >= self.max_candidates: + break # the candidate list is full + previously_finished[seq] = newly_finished[seq] + + # mark as completed if all audio has enough number of samples + completed = all( + len(sequences) >= self.max_candidates for sequences in self.finished_sequences + ) + return tokens, completed + + def finalize(self, preceding_tokens: Tensor, sum_logprobs: Tensor): + # collect all finished sequences, including patience, and add unfinished ones if not enough + sum_logprobs = sum_logprobs.cpu() + for i, sequences in enumerate(self.finished_sequences): + if len(sequences) < self.beam_size: # when not enough sequences are finished + for j in list(np.argsort(sum_logprobs[i]))[::-1]: + sequence = preceding_tokens[i, j].tolist() + [self.eot] + sequences[tuple(sequence)] = sum_logprobs[i][j].item() + if len(sequences) >= self.beam_size: + break + + tokens: List[List[Tensor]] = [ + [torch.tensor(seq) for seq in sequences.keys()] for sequences in self.finished_sequences + ] + sum_logprobs: List[List[float]] = [ + list(sequences.values()) for sequences in self.finished_sequences + ] + return tokens, sum_logprobs + + +class LogitFilter: + def apply(self, logits: Tensor, tokens: Tensor) -> None: + """Apply any filtering or masking to logits in-place + + Parameters + ---------- + logits : Tensor, shape = (n_batch, vocab_size) + per-token logits of the probability distribution at the current step + + tokens : Tensor, shape = (n_batch, current_sequence_length) + all tokens in the context so far, including the prefix and sot_sequence tokens + + """ + raise NotImplementedError + + +class SuppressBlank(LogitFilter): + def __init__(self, tokenizer: Tokenizer, sample_begin: int): + self.tokenizer = tokenizer + self.sample_begin = sample_begin + + def apply(self, logits: Tensor, tokens: Tensor): + if tokens.shape[1] == self.sample_begin: + logits[:, self.tokenizer.encode(" ") + [self.tokenizer.eot]] = -np.inf + + +class SuppressTokens(LogitFilter): + def __init__(self, suppress_tokens: Sequence[int]): + self.suppress_tokens = list(suppress_tokens) + + def apply(self, logits: Tensor, tokens: Tensor): + logits[:, self.suppress_tokens] = -np.inf + + +class GainEventToken(LogitFilter): + def __init__( + self, bg_tokens: Sequence[int], ed_tokens: Sequence[int], gain_values: Sequence[float] + ): + self.bg_tokens = list(bg_tokens) + self.ed_tokens = list(ed_tokens) + self.gain_value = [np.log(max(ga, 1e-9)) for ga in gain_values] + assert len(self.ed_tokens) == len(self.gain_value) + assert len(self.bg_tokens) == len(self.gain_value) + + def apply(self, logits: Tensor, tokens: Tensor): + for i in range(len(tokens)): + for bg, ed, ga in zip(self.bg_tokens, self.ed_tokens, self.gain_value): + sum_bg = sum([1 if x == bg else 0 for x in tokens[i]]) + sum_ed = sum([1 if x == ed else 0 for x in tokens[i]]) + logits[i, bg] += ga + if sum_bg > sum_ed or tokens[i, -1] in [bg, ed]: + logits[i, bg] = -np.inf + if sum_bg <= sum_ed: + logits[i, ed] = -np.inf + + +class ThresholdEmoToken(LogitFilter): + def __init__( + self, unk_tokens: Sequence[int], emo_tokens: Sequence[int], th_values: Sequence[float] + ): + self.unk_token = list(unk_tokens)[0] + self.emo_tokens = list(emo_tokens) + self.th_values = list(th_values) + assert len(self.emo_tokens) == len(self.th_values) + + def apply(self, logits: Tensor, tokens: Tensor): + for i in range(len(tokens)): + for emo, th in zip(self.emo_tokens, self.th_values): + if logits[i].argmax() == emo and logits[i].softmax(dim=-1)[emo] < th: + logits[i, self.unk_token] = max(logits[i, emo], logits[i, self.unk_token]) + logits[i, emo] = -np.inf + + # for bg, ed, ga in zip(self.bg_tokens, self.ed_tokens, self.gain_value): + # sum_bg = sum([1 if x == bg else 0 for x in tokens[i]]) + # sum_ed = sum([1 if x == ed else 0 for x in tokens[i]]) + # logits[i, bg] += ga + # if sum_bg > sum_ed or tokens[i,-1] in [bg, ed]: + # logits[i, bg] = -np.inf + # if sum_bg <= sum_ed: + # logits[i, ed] = -np.inf + + +class ApplyTimestampRules(LogitFilter): + def __init__( + self, + tokenizer: Tokenizer, + sample_begin: int, + max_initial_timestamp_index: Optional[int], + ): + self.tokenizer = tokenizer + self.sample_begin = sample_begin + self.max_initial_timestamp_index = max_initial_timestamp_index + + def apply(self, logits: Tensor, tokens: Tensor): + # suppress <|notimestamps|> which is handled by without_timestamps + if self.tokenizer.no_timestamps is not None: + logits[:, self.tokenizer.no_timestamps] = -np.inf + + # timestamps have to appear in pairs, except directly before EOT; mask logits accordingly + for k in range(tokens.shape[0]): + sampled_tokens = tokens[k, self.sample_begin :] + seq = [t for t in sampled_tokens.tolist()] + last_was_timestamp = len(seq) >= 1 and seq[-1] >= self.tokenizer.timestamp_begin + penultimate_was_timestamp = len(seq) < 2 or seq[-2] >= self.tokenizer.timestamp_begin + + if last_was_timestamp: + if penultimate_was_timestamp: # has to be non-timestamp + logits[k, self.tokenizer.timestamp_begin :] = -np.inf + else: # cannot be normal text tokens + logits[k, : self.tokenizer.eot] = -np.inf + + timestamps = sampled_tokens[sampled_tokens.ge(self.tokenizer.timestamp_begin)] + if timestamps.numel() > 0: + # timestamps shouldn't decrease; forbid timestamp tokens smaller than the last + # also force each segment to have a nonzero length, to prevent infinite looping + if last_was_timestamp and not penultimate_was_timestamp: + timestamp_last = timestamps[-1] + else: + timestamp_last = timestamps[-1] + 1 + logits[k, self.tokenizer.timestamp_begin : timestamp_last] = -np.inf + + if tokens.shape[1] == self.sample_begin: + # suppress generating non-timestamp tokens at the beginning + logits[:, : self.tokenizer.timestamp_begin] = -np.inf + + # apply the `max_initial_timestamp` option + if self.max_initial_timestamp_index is not None: + last_allowed = self.tokenizer.timestamp_begin + self.max_initial_timestamp_index + logits[:, last_allowed + 1 :] = -np.inf + + # if sum of probability over timestamps is above any other token, sample timestamp + logprobs = F.log_softmax(logits.float(), dim=-1) + for k in range(tokens.shape[0]): + timestamp_logprob = logprobs[k, self.tokenizer.timestamp_begin :].logsumexp(dim=-1) + max_text_token_logprob = logprobs[k, : self.tokenizer.timestamp_begin].max() + if timestamp_logprob > max_text_token_logprob: + logits[k, : self.tokenizer.timestamp_begin] = -np.inf + + +class DecodingTask: + inference: Inference + sequence_ranker: SequenceRanker + decoder: TokenDecoder + logit_filters: List[LogitFilter] + + def __init__(self, model: "Whisper", options: DecodingOptions): + self.model = model + + language = options.language or "en" + tokenizer = get_tokenizer( + model.is_multilingual, + num_languages=model.num_languages, + language=language, + task=options.task, + vocab_path=options.vocab_path, + ) + self.tokenizer: Tokenizer = tokenizer + self.options: DecodingOptions = self._verify_options(options) + + self.n_group: int = options.beam_size or options.best_of or 1 + self.n_ctx: int = model.dims.n_text_ctx + self.sample_len: int = options.sample_len or model.dims.n_text_ctx // 2 + + self.sot_sequence: Tuple[int] = tokenizer.sot_sequence + if self.options.without_timestamps: + self.sot_sequence = tokenizer.sot_sequence_including_notimestamps + + self.initial_tokens: Tuple[int] = self._get_initial_tokens() + self.sample_begin: int = len(self.initial_tokens) + self.sot_index: int = self.initial_tokens.index(tokenizer.sot) + + # inference: implements the forward pass through the decoder, including kv caching + self.inference = PyTorchInference(model, len(self.initial_tokens)) + + # sequence ranker: implements how to rank a group of sampled sequences + self.sequence_ranker = MaximumLikelihoodRanker(options.length_penalty) + + # decoder: implements how to select the next tokens, given the autoregressive distribution + if options.beam_size is not None: + self.decoder = BeamSearchDecoder( + options.beam_size, tokenizer.eot, self.inference, options.patience + ) + else: + self.decoder = GreedyDecoder(options.temperature, tokenizer.eot) + + # logit filters: applies various rules to suppress or penalize certain tokens + self.logit_filters = [] + if self.options.suppress_blank: + self.logit_filters.append(SuppressBlank(self.tokenizer, self.sample_begin)) + if self.options.suppress_tokens: + self.logit_filters.append(SuppressTokens(self._get_suppress_tokens())) + if self.options.gain_event: + self.logit_filters.append( + GainEventToken( + self.tokenizer.encode(self.options.gain_tokens_bg, allowed_special="all"), + self.tokenizer.encode(self.options.gain_tokens_ed, allowed_special="all"), + self.options.gain_tokens_score, + ) + ) + if self.options.use_emo_threshold: + self.logit_filters.append( + ThresholdEmoToken( + self.tokenizer.encode(self.options.emo_unk_token, allowed_special="all"), + self.tokenizer.encode(self.options.emo_target_tokens, allowed_special="all"), + self.options.emo_target_threshold, + ) + ) + if not options.without_timestamps: + precision = CHUNK_LENGTH / model.dims.n_audio_ctx # usually 0.02 seconds + max_initial_timestamp_index = None + if options.max_initial_timestamp: + max_initial_timestamp_index = round(self.options.max_initial_timestamp / precision) + self.logit_filters.append( + ApplyTimestampRules(tokenizer, self.sample_begin, max_initial_timestamp_index) + ) + + def _verify_options(self, options: DecodingOptions) -> DecodingOptions: + if options.beam_size is not None and options.best_of is not None: + raise ValueError("beam_size and best_of can't be given together") + if options.temperature == 0: + if options.best_of is not None: + raise ValueError("best_of with greedy sampling (T=0) is not compatible") + if options.patience is not None and options.beam_size is None: + raise ValueError("patience requires beam_size to be given") + if options.length_penalty is not None and not (0 <= options.length_penalty <= 1): + raise ValueError("length_penalty (alpha) should be a value between 0 and 1") + + return options + + def _get_initial_tokens(self) -> Tuple[int]: + tokens = list(self.sot_sequence) + + if prefix := self.options.prefix: + prefix_tokens = ( + self.tokenizer.encode(" " + prefix.strip()) if isinstance(prefix, str) else prefix + ) + if self.sample_len is not None: + max_prefix_len = self.n_ctx // 2 - self.sample_len + prefix_tokens = prefix_tokens[-max_prefix_len:] + tokens = tokens + prefix_tokens + + if prompt := self.options.prompt: + prompt_tokens = ( + self.tokenizer.encode(" " + prompt.strip()) if isinstance(prompt, str) else prompt + ) + tokens = [self.tokenizer.sot_prev] + prompt_tokens[-(self.n_ctx // 2 - 1) :] + tokens + # FIX(funasr): sense vocie + if initial_prompt := self.options.initial_prompt: + if self.options.language is not None: + initial_prompt = f"{initial_prompt}<|{self.options.language}|>" + tokens = self.tokenizer.encode(initial_prompt, allowed_special="all") + else: + tokens = self.tokenizer.encode(initial_prompt, allowed_special="all") + tokens += [0] + + return tuple(tokens) + + def _get_suppress_tokens(self) -> Tuple[int]: + suppress_tokens = self.options.suppress_tokens + + if isinstance(suppress_tokens, str): + suppress_tokens = [int(t) for t in suppress_tokens.split(",")] + + if -1 in suppress_tokens: + suppress_tokens = [t for t in suppress_tokens if t >= 0] + suppress_tokens.extend(self.tokenizer.non_speech_tokens) + elif suppress_tokens is None or len(suppress_tokens) == 0: + suppress_tokens = [] # interpret empty string as an empty list + else: + assert isinstance(suppress_tokens, list), "suppress_tokens must be a list" + + suppress_tokens.extend( + [ + self.tokenizer.transcribe, + self.tokenizer.translate, + self.tokenizer.sot, + self.tokenizer.sot_prev, + self.tokenizer.sot_lm, + ] + ) + if self.tokenizer.no_speech is not None: + # no-speech probability is collected separately + suppress_tokens.append(self.tokenizer.no_speech) + + return tuple(sorted(set(suppress_tokens))) + + def _get_audio_features(self, mel: Tensor): + if self.options.fp16: + mel = mel.half() + + if mel.shape[-2:] == ( + self.model.dims.n_audio_ctx, + self.model.dims.n_audio_state, + ): + # encoded audio features are given; skip audio encoding + audio_features = mel + else: + audio_features = self.model.encoder(mel) + + if audio_features.dtype != (torch.float16 if self.options.fp16 else torch.float32): + return TypeError(f"audio_features has an incorrect dtype: {audio_features.dtype}") + + return audio_features + + def _detect_language(self, audio_features: Tensor, tokens: Tensor): + languages = [self.options.language] * audio_features.shape[0] + lang_probs = None + + if self.options.language is None or self.options.task == "lang_id": + lang_tokens, lang_probs = self.model.detect_language( + audio_features, self.tokenizer, x=tokens + ) + languages = [max(probs, key=probs.get) for probs in lang_probs] + # FIX(funasr): sense vocie + # if self.options.language is None: + # tokens[:, self.sot_index + 1] = lang_tokens # write language tokens + if self.options.language is None: + # tokens[:, self.sot_index + 1] = lang_tokens # write language tokens + languages = "".join([f"<|{language}|>" for language in languages]) + + n_audio = audio_features.shape[0] + lang_tokens = torch.tensor( + [self.tokenizer.encode(languages, allowed_special="all")] * n_audio + ).to( + audio_features.device + ) # [n_audio, 1] + + tokens[:, -1:] = lang_tokens[:, :] + languages = [languages] + + return languages, lang_probs + + def _main_loop(self, audio_features: Tensor, tokens: Tensor): + n_batch = tokens.shape[0] + sum_logprobs: Tensor = torch.zeros(n_batch, device=audio_features.device) + no_speech_probs = [np.nan] * n_batch + + try: + for i in range(self.sample_len): + logits = self.inference.logits(tokens, audio_features) + + if i == 0 and self.tokenizer.no_speech is not None: # save no_speech_probs + probs_at_sot = logits[:, self.sot_index].float().softmax(dim=-1) + no_speech_probs = probs_at_sot[:, self.tokenizer.no_speech].tolist() + + # now we need to consider the logits at the last token only + logits = logits[:, -1] + + # apply the logit filters, e.g. for suppressing or applying penalty to + for logit_filter in self.logit_filters: + logit_filter.apply(logits, tokens) + + # expand the tokens tensor with the selected next tokens + tokens, completed = self.decoder.update(tokens, logits, sum_logprobs) + + if completed or tokens.shape[-1] > self.n_ctx: + break + finally: + self.inference.cleanup_caching() + + return tokens, sum_logprobs, no_speech_probs + + @torch.no_grad() + def run(self, mel: Tensor) -> List[DecodingResult]: + self.decoder.reset() + tokenizer: Tokenizer = self.tokenizer + n_audio: int = mel.shape[0] + + audio_features: Tensor = self._get_audio_features(mel) # encoder forward pass + tokens: Tensor = torch.tensor([self.initial_tokens]).repeat(n_audio, 1) + + # detect language if requested, overwriting the language token + languages, language_probs = self._detect_language(audio_features, tokens) + if self.options.task == "lang_id": + return [ + DecodingResult(audio_features=features, language=language, language_probs=probs) + for features, language, probs in zip(audio_features, languages, language_probs) + ] + + # repeat text tensors by the group size, for beam search or best-of-n sampling + tokens = tokens.repeat_interleave(self.n_group, dim=0).to(audio_features.device) + + # call the main sampling loop + tokens, sum_logprobs, no_speech_probs = self._main_loop(audio_features, tokens) + + # reshape the tensors to have (n_audio, n_group) as the first two dimensions + audio_features = audio_features[:: self.n_group] + no_speech_probs = no_speech_probs[:: self.n_group] + assert audio_features.shape[0] == len(no_speech_probs) == n_audio + + tokens = tokens.reshape(n_audio, self.n_group, -1) + sum_logprobs = sum_logprobs.reshape(n_audio, self.n_group) + + # get the final candidates for each group, and slice between the first sampled token and EOT + tokens, sum_logprobs = self.decoder.finalize(tokens, sum_logprobs) + tokens: List[List[Tensor]] = [ + [t[self.sample_begin : (t == tokenizer.eot).nonzero()[0, 0]] for t in s] for s in tokens + ] + + # select the top-ranked sample in each group + selected = self.sequence_ranker.rank(tokens, sum_logprobs) + tokens: List[List[int]] = [t[i].tolist() for i, t in zip(selected, tokens)] + texts: List[str] = [tokenizer.decode(t).strip() for t in tokens] + + sum_logprobs: List[float] = [lp[i] for i, lp in zip(selected, sum_logprobs)] + avg_logprobs: List[float] = [lp / (len(t) + 1) for t, lp in zip(tokens, sum_logprobs)] + + fields = ( + texts, + languages, + tokens, + audio_features, + avg_logprobs, + no_speech_probs, + ) + if len(set(map(len, fields))) != 1: + raise RuntimeError(f"inconsistent result lengths: {list(map(len, fields))}") + + return [ + DecodingResult( + audio_features=features, + language=language, + tokens=tokens, + text=text, + avg_logprob=avg_logprob, + no_speech_prob=no_speech_prob, + temperature=self.options.temperature, + compression_ratio=compression_ratio(text), + ) + for text, language, tokens, features, avg_logprob, no_speech_prob in zip(*fields) + ] + + +@torch.no_grad() +def decode( + model: "Whisper", + mel: Tensor, + options: DecodingOptions = DecodingOptions(), + **kwargs, +) -> Union[DecodingResult, List[DecodingResult]]: + """ + Performs decoding of 30-second audio segment(s), provided as Mel spectrogram(s). + + Parameters + ---------- + model: Whisper + the Whisper model instance + + mel: torch.Tensor, shape = (80, 3000) or (*, 80, 3000) + A tensor containing the Mel spectrogram(s) + + options: DecodingOptions + A dataclass that contains all necessary options for decoding 30-second segments + + Returns + ------- + result: Union[DecodingResult, List[DecodingResult]] + The result(s) of decoding contained in `DecodingResult` dataclass instance(s) + """ + if single := mel.ndim == 2: + mel = mel.unsqueeze(0) + + if kwargs: + options = replace(options, **kwargs) + + result = DecodingTask(model, options).run(mel) + + return result[0] if single else result diff --git a/funasr/models/sense_voice/whisper_lib/model.py b/funasr/models/sense_voice/whisper_lib/model.py new file mode 100644 index 0000000..40939df --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/model.py @@ -0,0 +1,316 @@ +import base64 +import gzip +from dataclasses import dataclass +from typing import Dict, Iterable, Optional + +import numpy as np +import torch +import torch.nn.functional as F +from torch import Tensor, nn + +from .decoding import decode as decode_function +from .decoding import detect_language as detect_language_function +from .transcribe import transcribe as transcribe_function + + +@dataclass +class ModelDimensions: + n_mels: int + n_audio_ctx: int + n_audio_state: int + n_audio_head: int + n_audio_layer: int + n_vocab: int + n_text_ctx: int + n_text_state: int + n_text_head: int + n_text_layer: int + + +class LayerNorm(nn.LayerNorm): + def forward(self, x: Tensor) -> Tensor: + return super().forward(x.float()).type(x.dtype) + + +class Linear(nn.Linear): + def forward(self, x: Tensor) -> Tensor: + return F.linear( + x, + self.weight.to(x.dtype), + None if self.bias is None else self.bias.to(x.dtype), + ) + + +class Conv1d(nn.Conv1d): + def _conv_forward(self, x: Tensor, weight: Tensor, bias: Optional[Tensor]) -> Tensor: + return super()._conv_forward( + x, weight.to(x.dtype), None if bias is None else bias.to(x.dtype) + ) + + +def sinusoids(length, channels, max_timescale=10000): + """Returns sinusoids for positional embedding""" + assert channels % 2 == 0 + log_timescale_increment = np.log(max_timescale) / (channels // 2 - 1) + inv_timescales = torch.exp(-log_timescale_increment * torch.arange(channels // 2)) + scaled_time = torch.arange(length)[:, np.newaxis] * inv_timescales[np.newaxis, :] + return torch.cat([torch.sin(scaled_time), torch.cos(scaled_time)], dim=1) + + +class MultiHeadAttention(nn.Module): + def __init__(self, n_state: int, n_head: int): + super().__init__() + self.n_head = n_head + self.query = Linear(n_state, n_state) + self.key = Linear(n_state, n_state, bias=False) + self.value = Linear(n_state, n_state) + self.out = Linear(n_state, n_state) + + def forward( + self, + x: Tensor, + xa: Optional[Tensor] = None, + mask: Optional[Tensor] = None, + kv_cache: Optional[dict] = None, + **kwargs, + ): + is_pad_mask = kwargs.get("is_pad_mask", False) + + q = self.query(x) + + if kv_cache is None or xa is None or self.key not in kv_cache: + # hooks, if installed (i.e. kv_cache is not None), will prepend the cached kv tensors; + # otherwise, perform key/value projections for self- or cross-attention as usual. + k = self.key(x if xa is None else xa) + v = self.value(x if xa is None else xa) + else: + # for cross-attention, calculate keys and values once and reuse in subsequent calls. + k = kv_cache[self.key] + v = kv_cache[self.value] + + wv, qk = self.qkv_attention(q, k, v, mask, is_pad_mask=is_pad_mask) + return self.out(wv), qk + + def qkv_attention( + self, + q: Tensor, + k: Tensor, + v: Tensor, + mask: Optional[Tensor] = None, + **kwargs, + ): + is_pad_mask = kwargs.get("is_pad_mask", False) + n_batch, n_ctx, n_state = q.shape + scale = (n_state // self.n_head) ** -0.25 + q = q.view(*q.shape[:2], self.n_head, -1).permute(0, 2, 1, 3) * scale + k = k.view(*k.shape[:2], self.n_head, -1).permute(0, 2, 3, 1) * scale + v = v.view(*v.shape[:2], self.n_head, -1).permute(0, 2, 1, 3) + + qk = q @ k + if mask is not None: + if not is_pad_mask: + qk = qk + mask[:n_ctx, :n_ctx] + else: + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + min_value = float(np.finfo(torch.tensor(0, dtype=qk.dtype).numpy().dtype).min) + qk = qk.masked_fill(mask, min_value) + + qk = qk.float() + + w = F.softmax(qk, dim=-1).to(q.dtype) + if mask is not None and is_pad_mask: + w = w.masked_fill(mask, 0.0) + return (w @ v).permute(0, 2, 1, 3).flatten(start_dim=2), qk.detach() + + +class ResidualAttentionBlock(nn.Module): + def __init__(self, n_state: int, n_head: int, cross_attention: bool = False): + super().__init__() + + self.attn = MultiHeadAttention(n_state, n_head) + self.attn_ln = LayerNorm(n_state) + + self.cross_attn = MultiHeadAttention(n_state, n_head) if cross_attention else None + self.cross_attn_ln = LayerNorm(n_state) if cross_attention else None + + n_mlp = n_state * 4 + self.mlp = nn.Sequential(Linear(n_state, n_mlp), nn.GELU(), Linear(n_mlp, n_state)) + self.mlp_ln = LayerNorm(n_state) + + def forward( + self, + x: Tensor, + xa: Optional[Tensor] = None, + mask: Optional[Tensor] = None, + kv_cache: Optional[dict] = None, + **kwargs, + ): + is_pad_mask = kwargs.get("is_pad_mask", False) + is_pad_memory_mask = kwargs.get("is_pad_memory_mask", False) + x = x + self.attn(self.attn_ln(x), mask=mask, kv_cache=kv_cache, is_pad_mask=is_pad_mask)[0] + if self.cross_attn: + x = ( + x + + self.cross_attn( + self.cross_attn_ln(x), xa, kv_cache=kv_cache, is_pad_mask=is_pad_memory_mask + )[0] + ) + x = x + self.mlp(self.mlp_ln(x)) + return x + + +class AudioEncoder(nn.Module): + def __init__(self, n_mels: int, n_ctx: int, n_state: int, n_head: int, n_layer: int): + super().__init__() + self.conv1 = Conv1d(n_mels, n_state, kernel_size=3, stride=2, padding=1) + self.conv2 = Conv1d(n_state, n_state, kernel_size=3, stride=2, padding=1) + self.register_buffer("positional_embedding", sinusoids(n_ctx, n_state)) + + self.blocks: Iterable[ResidualAttentionBlock] = nn.ModuleList( + [ResidualAttentionBlock(n_state, n_head) for _ in range(n_layer)] + ) + self.ln_post = LayerNorm(n_state) + + def forward(self, x: Tensor): + """ + x : torch.Tensor, shape = (batch_size, n_mels, n_ctx) + the mel spectrogram of the audio + """ + x = F.gelu(self.conv1(x)) + x = F.gelu(self.conv2(x)) + x = x.permute(0, 2, 1) + + # assert x.shape[1:] == self.positional_embedding.shape, "incorrect audio shape" + # x = (x + self.positional_embedding).to(x.dtype) + x = (x + self.positional_embedding[: x.size(1), :]).to(x.dtype) + + for block in self.blocks: + x = block(x) + + x = self.ln_post(x) + return x + + +class TextDecoder(nn.Module): + def __init__(self, n_vocab: int, n_ctx: int, n_state: int, n_head: int, n_layer: int): + super().__init__() + + self.token_embedding = nn.Embedding(n_vocab, n_state) + self.positional_embedding = nn.Parameter(torch.empty(n_ctx, n_state)) + + self.blocks: Iterable[ResidualAttentionBlock] = nn.ModuleList( + [ResidualAttentionBlock(n_state, n_head, cross_attention=True) for _ in range(n_layer)] + ) + self.ln = LayerNorm(n_state) + + mask = torch.empty(n_ctx, n_ctx).fill_(-np.inf).triu_(1) + self.register_buffer("mask", mask, persistent=False) + + def forward(self, x: Tensor, xa: Tensor, kv_cache: Optional[dict] = None): + """ + x : torch.LongTensor, shape = (batch_size, <= n_ctx) + the text tokens + xa : torch.Tensor, shape = (batch_size, n_audio_ctx, n_audio_state) + the encoded audio features to be attended on + """ + offset = next(iter(kv_cache.values())).shape[1] if kv_cache else 0 + x = self.token_embedding(x) + self.positional_embedding[offset : offset + x.shape[-1]] + x = x.to(xa.dtype) + + for block in self.blocks: + x = block(x, xa, mask=self.mask, kv_cache=kv_cache) + + x = self.ln(x) + logits = (x @ torch.transpose(self.token_embedding.weight.to(x.dtype), 0, 1)).float() + + return logits + + +class Whisper(nn.Module): + def __init__(self, dims: ModelDimensions): + super().__init__() + self.dims = dims + self.encoder = AudioEncoder( + self.dims.n_mels, + self.dims.n_audio_ctx, + self.dims.n_audio_state, + self.dims.n_audio_head, + self.dims.n_audio_layer, + ) + self.decoder = TextDecoder( + self.dims.n_vocab, + self.dims.n_text_ctx, + self.dims.n_text_state, + self.dims.n_text_head, + self.dims.n_text_layer, + ) + # use the last half among the decoder layers for time alignment by default; + # to use a specific set of heads, see `set_alignment_heads()` below. + all_heads = torch.zeros(self.dims.n_text_layer, self.dims.n_text_head, dtype=torch.bool) + all_heads[self.dims.n_text_layer // 2 :] = True + # self.register_buffer("alignment_heads", all_heads.to_sparse(), persistent=False) + # alignment_heads_dense = model.get_buffer("alignment_heads").to_dense() + # model.register_buffer("alignment_heads", alignment_heads_dense, persistent=False) + + def set_alignment_heads(self, dump: bytes): + array = np.frombuffer(gzip.decompress(base64.b85decode(dump)), dtype=bool).copy() + mask = torch.from_numpy(array).reshape(self.dims.n_text_layer, self.dims.n_text_head) + self.register_buffer("alignment_heads", mask.to_sparse(), persistent=False) + + def embed_audio(self, mel: torch.Tensor): + return self.encoder(mel) + + def logits(self, tokens: torch.Tensor, audio_features: torch.Tensor): + return self.decoder(tokens, audio_features) + + def forward(self, mel: torch.Tensor, tokens: torch.Tensor) -> Dict[str, torch.Tensor]: + return self.decoder(tokens, self.encoder(mel)) + + @property + def device(self): + return next(self.parameters()).device + + @property + def is_multilingual(self): + return self.dims.n_vocab >= 51865 + + @property + def num_languages(self): + return self.dims.n_vocab - 51765 - int(self.is_multilingual) + + def install_kv_cache_hooks(self, cache: Optional[dict] = None): + """ + The `MultiHeadAttention` module optionally accepts `kv_cache` which stores the key and value + tensors calculated for the previous positions. This method returns a dictionary that stores + all caches, and the necessary hooks for the key and value projection modules that save the + intermediate tensors to be reused during later calculations. + + Returns + ------- + cache : Dict[nn.Module, torch.Tensor] + A dictionary object mapping the key/value projection modules to its cache + hooks : List[RemovableHandle] + List of PyTorch RemovableHandle objects to stop the hooks to be called + """ + cache = {**cache} if cache is not None else {} + hooks = [] + + def save_to_cache(module, _, output): + if module not in cache or output.shape[1] > self.dims.n_text_ctx: + # save as-is, for the first token or cross attention + cache[module] = output + else: + cache[module] = torch.cat([cache[module], output], dim=1).detach() + return cache[module] + + def install_hooks(layer: nn.Module): + if isinstance(layer, MultiHeadAttention): + hooks.append(layer.key.register_forward_hook(save_to_cache)) + hooks.append(layer.value.register_forward_hook(save_to_cache)) + + self.decoder.apply(install_hooks) + return cache, hooks + + detect_language = detect_language_function + transcribe = transcribe_function + decode = decode_function diff --git a/funasr/models/sense_voice/whisper_lib/normalizers/__init__.py b/funasr/models/sense_voice/whisper_lib/normalizers/__init__.py new file mode 100644 index 0000000..896d5e3 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/normalizers/__init__.py @@ -0,0 +1,2 @@ +from .basic import BasicTextNormalizer as BasicTextNormalizer +from .english import EnglishTextNormalizer as EnglishTextNormalizer diff --git a/funasr/models/sense_voice/whisper_lib/normalizers/basic.py b/funasr/models/sense_voice/whisper_lib/normalizers/basic.py new file mode 100644 index 0000000..76addc5 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/normalizers/basic.py @@ -0,0 +1,75 @@ +import re +import unicodedata + +import regex + +# non-ASCII letters that are not separated by "NFKD" normalization +ADDITIONAL_DIACRITICS = { + "œ": "oe", + "Œ": "OE", + "ø": "o", + "Ø": "O", + "æ": "ae", + "Æ": "AE", + "ß": "ss", + "ẞ": "SS", + "đ": "d", + "Đ": "D", + "ð": "d", + "Ð": "D", + "þ": "th", + "Þ": "th", + "ł": "l", + "Ł": "L", +} + + +def remove_symbols_and_diacritics(s: str, keep=""): + """ + Replace any other markers, symbols, and punctuations with a space, + and drop any diacritics (category 'Mn' and some manual mappings) + """ + return "".join( + ( + c + if c in keep + else ( + ADDITIONAL_DIACRITICS[c] + if c in ADDITIONAL_DIACRITICS + else ( + "" + if unicodedata.category(c) == "Mn" + else " " if unicodedata.category(c)[0] in "MSP" else c + ) + ) + ) + for c in unicodedata.normalize("NFKD", s) + ) + + +def remove_symbols(s: str): + """ + Replace any other markers, symbols, punctuations with a space, keeping diacritics + """ + return "".join( + " " if unicodedata.category(c)[0] in "MSP" else c for c in unicodedata.normalize("NFKC", s) + ) + + +class BasicTextNormalizer: + def __init__(self, remove_diacritics: bool = False, split_letters: bool = False): + self.clean = remove_symbols_and_diacritics if remove_diacritics else remove_symbols + self.split_letters = split_letters + + def __call__(self, s: str): + s = s.lower() + s = re.sub(r"[<\[][^>\]]*[>\]]", "", s) # remove words between brackets + s = re.sub(r"\(([^)]+?)\)", "", s) # remove words between parenthesis + s = self.clean(s).lower() + + if self.split_letters: + s = " ".join(regex.findall(r"\X", s, regex.U)) + + s = re.sub(r"\s+", " ", s) # replace any successive whitespace characters with a space + + return s diff --git a/funasr/models/sense_voice/whisper_lib/normalizers/english.json b/funasr/models/sense_voice/whisper_lib/normalizers/english.json new file mode 100644 index 0000000..74a1c35 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/normalizers/english.json @@ -0,0 +1,1741 @@ +{ + "accessorise": "accessorize", + "accessorised": "accessorized", + "accessorises": "accessorizes", + "accessorising": "accessorizing", + "acclimatisation": "acclimatization", + "acclimatise": "acclimatize", + "acclimatised": "acclimatized", + "acclimatises": "acclimatizes", + "acclimatising": "acclimatizing", + "accoutrements": "accouterments", + "aeon": "eon", + "aeons": "eons", + "aerogramme": "aerogram", + "aerogrammes": "aerograms", + "aeroplane": "airplane", + "aeroplanes": "airplanes", + "aesthete": "esthete", + "aesthetes": "esthetes", + "aesthetic": "esthetic", + "aesthetically": "esthetically", + "aesthetics": "esthetics", + "aetiology": "etiology", + "ageing": "aging", + "aggrandisement": "aggrandizement", + "agonise": "agonize", + "agonised": "agonized", + "agonises": "agonizes", + "agonising": "agonizing", + "agonisingly": "agonizingly", + "almanack": "almanac", + "almanacks": "almanacs", + "aluminium": "aluminum", + "amortisable": "amortizable", + "amortisation": "amortization", + "amortisations": "amortizations", + "amortise": "amortize", + "amortised": "amortized", + "amortises": "amortizes", + "amortising": "amortizing", + "amphitheatre": "amphitheater", + "amphitheatres": "amphitheaters", + "anaemia": "anemia", + "anaemic": "anemic", + "anaesthesia": "anesthesia", + "anaesthetic": "anesthetic", + "anaesthetics": "anesthetics", + "anaesthetise": "anesthetize", + "anaesthetised": "anesthetized", + "anaesthetises": "anesthetizes", + "anaesthetising": "anesthetizing", + "anaesthetist": "anesthetist", + "anaesthetists": "anesthetists", + "anaesthetize": "anesthetize", + "anaesthetized": "anesthetized", + "anaesthetizes": "anesthetizes", + "anaesthetizing": "anesthetizing", + "analogue": "analog", + "analogues": "analogs", + "analyse": "analyze", + "analysed": "analyzed", + "analyses": "analyzes", + "analysing": "analyzing", + "anglicise": "anglicize", + "anglicised": "anglicized", + "anglicises": "anglicizes", + "anglicising": "anglicizing", + "annualised": "annualized", + "antagonise": "antagonize", + "antagonised": "antagonized", + "antagonises": "antagonizes", + "antagonising": "antagonizing", + "apologise": "apologize", + "apologised": "apologized", + "apologises": "apologizes", + "apologising": "apologizing", + "appal": "appall", + "appals": "appalls", + "appetiser": "appetizer", + "appetisers": "appetizers", + "appetising": "appetizing", + "appetisingly": "appetizingly", + "arbour": "arbor", + "arbours": "arbors", + "archeological": "archaeological", + "archaeologically": "archeologically", + "archaeologist": "archeologist", + "archaeologists": "archeologists", + "archaeology": "archeology", + "ardour": "ardor", + "armour": "armor", + "armoured": "armored", + "armourer": "armorer", + "armourers": "armorers", + "armouries": "armories", + "armoury": "armory", + "artefact": "artifact", + "artefacts": "artifacts", + "authorise": "authorize", + "authorised": "authorized", + "authorises": "authorizes", + "authorising": "authorizing", + "axe": "ax", + "backpedalled": "backpedaled", + "backpedalling": "backpedaling", + "bannister": "banister", + "bannisters": "banisters", + "baptise": "baptize", + "baptised": "baptized", + "baptises": "baptizes", + "baptising": "baptizing", + "bastardise": "bastardize", + "bastardised": "bastardized", + "bastardises": "bastardizes", + "bastardising": "bastardizing", + "battleax": "battleaxe", + "baulk": "balk", + "baulked": "balked", + "baulking": "balking", + "baulks": "balks", + "bedevilled": "bedeviled", + "bedevilling": "bedeviling", + "behaviour": "behavior", + "behavioural": "behavioral", + "behaviourism": "behaviorism", + "behaviourist": "behaviorist", + "behaviourists": "behaviorists", + "behaviours": "behaviors", + "behove": "behoove", + "behoved": "behooved", + "behoves": "behooves", + "bejewelled": "bejeweled", + "belabour": "belabor", + "belaboured": "belabored", + "belabouring": "belaboring", + "belabours": "belabors", + "bevelled": "beveled", + "bevvies": "bevies", + "bevvy": "bevy", + "biassed": "biased", + "biassing": "biasing", + "bingeing": "binging", + "bougainvillaea": "bougainvillea", + "bougainvillaeas": "bougainvilleas", + "bowdlerise": "bowdlerize", + "bowdlerised": "bowdlerized", + "bowdlerises": "bowdlerizes", + "bowdlerising": "bowdlerizing", + "breathalyse": "breathalyze", + "breathalysed": "breathalyzed", + "breathalyser": "breathalyzer", + "breathalysers": "breathalyzers", + "breathalyses": "breathalyzes", + "breathalysing": "breathalyzing", + "brutalise": "brutalize", + "brutalised": "brutalized", + "brutalises": "brutalizes", + "brutalising": "brutalizing", + "busses": "buses", + "bussing": "busing", + "caesarean": "cesarean", + "caesareans": "cesareans", + "calibre": "caliber", + "calibres": "calibers", + "calliper": "caliper", + "callipers": "calipers", + "callisthenics": "calisthenics", + "canalise": "canalize", + "canalised": "canalized", + "canalises": "canalizes", + "canalising": "canalizing", + "cancelation": "cancellation", + "cancelations": "cancellations", + "cancelled": "canceled", + "cancelling": "canceling", + "candour": "candor", + "cannibalise": "cannibalize", + "cannibalised": "cannibalized", + "cannibalises": "cannibalizes", + "cannibalising": "cannibalizing", + "canonise": "canonize", + "canonised": "canonized", + "canonises": "canonizes", + "canonising": "canonizing", + "capitalise": "capitalize", + "capitalised": "capitalized", + "capitalises": "capitalizes", + "capitalising": "capitalizing", + "caramelise": "caramelize", + "caramelised": "caramelized", + "caramelises": "caramelizes", + "caramelising": "caramelizing", + "carbonise": "carbonize", + "carbonised": "carbonized", + "carbonises": "carbonizes", + "carbonising": "carbonizing", + "carolled": "caroled", + "carolling": "caroling", + "catalogue": "catalog", + "catalogued": "cataloged", + "catalogues": "catalogs", + "cataloguing": "cataloging", + "catalyse": "catalyze", + "catalysed": "catalyzed", + "catalyses": "catalyzes", + "catalysing": "catalyzing", + "categorise": "categorize", + "categorised": "categorized", + "categorises": "categorizes", + "categorising": "categorizing", + "cauterise": "cauterize", + "cauterised": "cauterized", + "cauterises": "cauterizes", + "cauterising": "cauterizing", + "cavilled": "caviled", + "cavilling": "caviling", + "centigramme": "centigram", + "centigrammes": "centigrams", + "centilitre": "centiliter", + "centilitres": "centiliters", + "centimetre": "centimeter", + "centimetres": "centimeters", + "centralise": "centralize", + "centralised": "centralized", + "centralises": "centralizes", + "centralising": "centralizing", + "centre": "center", + "centred": "centered", + "centrefold": "centerfold", + "centrefolds": "centerfolds", + "centrepiece": "centerpiece", + "centrepieces": "centerpieces", + "centres": "centers", + "channelled": "channeled", + "channelling": "channeling", + "characterise": "characterize", + "characterised": "characterized", + "characterises": "characterizes", + "characterising": "characterizing", + "cheque": "check", + "chequebook": "checkbook", + "chequebooks": "checkbooks", + "chequered": "checkered", + "cheques": "checks", + "chilli": "chili", + "chimaera": "chimera", + "chimaeras": "chimeras", + "chiselled": "chiseled", + "chiselling": "chiseling", + "circularise": "circularize", + "circularised": "circularized", + "circularises": "circularizes", + "circularising": "circularizing", + "civilise": "civilize", + "civilised": "civilized", + "civilises": "civilizes", + "civilising": "civilizing", + "clamour": "clamor", + "clamoured": "clamored", + "clamouring": "clamoring", + "clamours": "clamors", + "clangour": "clangor", + "clarinettist": "clarinetist", + "clarinettists": "clarinetists", + "collectivise": "collectivize", + "collectivised": "collectivized", + "collectivises": "collectivizes", + "collectivising": "collectivizing", + "colonisation": "colonization", + "colonise": "colonize", + "colonised": "colonized", + "coloniser": "colonizer", + "colonisers": "colonizers", + "colonises": "colonizes", + "colonising": "colonizing", + "colour": "color", + "colourant": "colorant", + "colourants": "colorants", + "coloured": "colored", + "coloureds": "coloreds", + "colourful": "colorful", + "colourfully": "colorfully", + "colouring": "coloring", + "colourize": "colorize", + "colourized": "colorized", + "colourizes": "colorizes", + "colourizing": "colorizing", + "colourless": "colorless", + "colours": "colors", + "commercialise": "commercialize", + "commercialised": "commercialized", + "commercialises": "commercializes", + "commercialising": "commercializing", + "compartmentalise": "compartmentalize", + "compartmentalised": "compartmentalized", + "compartmentalises": "compartmentalizes", + "compartmentalising": "compartmentalizing", + "computerise": "computerize", + "computerised": "computerized", + "computerises": "computerizes", + "computerising": "computerizing", + "conceptualise": "conceptualize", + "conceptualised": "conceptualized", + "conceptualises": "conceptualizes", + "conceptualising": "conceptualizing", + "connexion": "connection", + "connexions": "connections", + "contextualise": "contextualize", + "contextualised": "contextualized", + "contextualises": "contextualizes", + "contextualising": "contextualizing", + "cosier": "cozier", + "cosies": "cozies", + "cosiest": "coziest", + "cosily": "cozily", + "cosiness": "coziness", + "cosy": "cozy", + "councillor": "councilor", + "councillors": "councilors", + "counselled": "counseled", + "counselling": "counseling", + "counsellor": "counselor", + "counsellors": "counselors", + "crenelated": "crenellated", + "criminalise": "criminalize", + "criminalised": "criminalized", + "criminalises": "criminalizes", + "criminalising": "criminalizing", + "criticise": "criticize", + "criticised": "criticized", + "criticises": "criticizes", + "criticising": "criticizing", + "crueller": "crueler", + "cruellest": "cruelest", + "crystallisation": "crystallization", + "crystallise": "crystallize", + "crystallised": "crystallized", + "crystallises": "crystallizes", + "crystallising": "crystallizing", + "cudgelled": "cudgeled", + "cudgelling": "cudgeling", + "customise": "customize", + "customised": "customized", + "customises": "customizes", + "customising": "customizing", + "cypher": "cipher", + "cyphers": "ciphers", + "decentralisation": "decentralization", + "decentralise": "decentralize", + "decentralised": "decentralized", + "decentralises": "decentralizes", + "decentralising": "decentralizing", + "decriminalisation": "decriminalization", + "decriminalise": "decriminalize", + "decriminalised": "decriminalized", + "decriminalises": "decriminalizes", + "decriminalising": "decriminalizing", + "defence": "defense", + "defenceless": "defenseless", + "defences": "defenses", + "dehumanisation": "dehumanization", + "dehumanise": "dehumanize", + "dehumanised": "dehumanized", + "dehumanises": "dehumanizes", + "dehumanising": "dehumanizing", + "demeanour": "demeanor", + "demilitarisation": "demilitarization", + "demilitarise": "demilitarize", + "demilitarised": "demilitarized", + "demilitarises": "demilitarizes", + "demilitarising": "demilitarizing", + "demobilisation": "demobilization", + "demobilise": "demobilize", + "demobilised": "demobilized", + "demobilises": "demobilizes", + "demobilising": "demobilizing", + "democratisation": "democratization", + "democratise": "democratize", + "democratised": "democratized", + "democratises": "democratizes", + "democratising": "democratizing", + "demonise": "demonize", + "demonised": "demonized", + "demonises": "demonizes", + "demonising": "demonizing", + "demoralisation": "demoralization", + "demoralise": "demoralize", + "demoralised": "demoralized", + "demoralises": "demoralizes", + "demoralising": "demoralizing", + "denationalisation": "denationalization", + "denationalise": "denationalize", + "denationalised": "denationalized", + "denationalises": "denationalizes", + "denationalising": "denationalizing", + "deodorise": "deodorize", + "deodorised": "deodorized", + "deodorises": "deodorizes", + "deodorising": "deodorizing", + "depersonalise": "depersonalize", + "depersonalised": "depersonalized", + "depersonalises": "depersonalizes", + "depersonalising": "depersonalizing", + "deputise": "deputize", + "deputised": "deputized", + "deputises": "deputizes", + "deputising": "deputizing", + "desensitisation": "desensitization", + "desensitise": "desensitize", + "desensitised": "desensitized", + "desensitises": "desensitizes", + "desensitising": "desensitizing", + "destabilisation": "destabilization", + "destabilise": "destabilize", + "destabilised": "destabilized", + "destabilises": "destabilizes", + "destabilising": "destabilizing", + "dialled": "dialed", + "dialling": "dialing", + "dialogue": "dialog", + "dialogues": "dialogs", + "diarrhoea": "diarrhea", + "digitise": "digitize", + "digitised": "digitized", + "digitises": "digitizes", + "digitising": "digitizing", + "disc": "disk", + "discolour": "discolor", + "discoloured": "discolored", + "discolouring": "discoloring", + "discolours": "discolors", + "discs": "disks", + "disembowelled": "disemboweled", + "disembowelling": "disemboweling", + "disfavour": "disfavor", + "dishevelled": "disheveled", + "dishonour": "dishonor", + "dishonourable": "dishonorable", + "dishonourably": "dishonorably", + "dishonoured": "dishonored", + "dishonouring": "dishonoring", + "dishonours": "dishonors", + "disorganisation": "disorganization", + "disorganised": "disorganized", + "distil": "distill", + "distils": "distills", + "dramatisation": "dramatization", + "dramatisations": "dramatizations", + "dramatise": "dramatize", + "dramatised": "dramatized", + "dramatises": "dramatizes", + "dramatising": "dramatizing", + "draught": "draft", + "draughtboard": "draftboard", + "draughtboards": "draftboards", + "draughtier": "draftier", + "draughtiest": "draftiest", + "draughts": "drafts", + "draughtsman": "draftsman", + "draughtsmanship": "draftsmanship", + "draughtsmen": "draftsmen", + "draughtswoman": "draftswoman", + "draughtswomen": "draftswomen", + "draughty": "drafty", + "drivelled": "driveled", + "drivelling": "driveling", + "duelled": "dueled", + "duelling": "dueling", + "economise": "economize", + "economised": "economized", + "economises": "economizes", + "economising": "economizing", + "edoema": "edema", + "editorialise": "editorialize", + "editorialised": "editorialized", + "editorialises": "editorializes", + "editorialising": "editorializing", + "empathise": "empathize", + "empathised": "empathized", + "empathises": "empathizes", + "empathising": "empathizing", + "emphasise": "emphasize", + "emphasised": "emphasized", + "emphasises": "emphasizes", + "emphasising": "emphasizing", + "enamelled": "enameled", + "enamelling": "enameling", + "enamoured": "enamored", + "encyclopaedia": "encyclopedia", + "encyclopaedias": "encyclopedias", + "encyclopaedic": "encyclopedic", + "endeavour": "endeavor", + "endeavoured": "endeavored", + "endeavouring": "endeavoring", + "endeavours": "endeavors", + "energise": "energize", + "energised": "energized", + "energises": "energizes", + "energising": "energizing", + "enrol": "enroll", + "enrols": "enrolls", + "enthral": "enthrall", + "enthrals": "enthralls", + "epaulette": "epaulet", + "epaulettes": "epaulets", + "epicentre": "epicenter", + "epicentres": "epicenters", + "epilogue": "epilog", + "epilogues": "epilogs", + "epitomise": "epitomize", + "epitomised": "epitomized", + "epitomises": "epitomizes", + "epitomising": "epitomizing", + "equalisation": "equalization", + "equalise": "equalize", + "equalised": "equalized", + "equaliser": "equalizer", + "equalisers": "equalizers", + "equalises": "equalizes", + "equalising": "equalizing", + "eulogise": "eulogize", + "eulogised": "eulogized", + "eulogises": "eulogizes", + "eulogising": "eulogizing", + "evangelise": "evangelize", + "evangelised": "evangelized", + "evangelises": "evangelizes", + "evangelising": "evangelizing", + "exorcise": "exorcize", + "exorcised": "exorcized", + "exorcises": "exorcizes", + "exorcising": "exorcizing", + "extemporisation": "extemporization", + "extemporise": "extemporize", + "extemporised": "extemporized", + "extemporises": "extemporizes", + "extemporising": "extemporizing", + "externalisation": "externalization", + "externalisations": "externalizations", + "externalise": "externalize", + "externalised": "externalized", + "externalises": "externalizes", + "externalising": "externalizing", + "factorise": "factorize", + "factorised": "factorized", + "factorises": "factorizes", + "factorising": "factorizing", + "faecal": "fecal", + "faeces": "feces", + "familiarisation": "familiarization", + "familiarise": "familiarize", + "familiarised": "familiarized", + "familiarises": "familiarizes", + "familiarising": "familiarizing", + "fantasise": "fantasize", + "fantasised": "fantasized", + "fantasises": "fantasizes", + "fantasising": "fantasizing", + "favour": "favor", + "favourable": "favorable", + "favourably": "favorably", + "favoured": "favored", + "favouring": "favoring", + "favourite": "favorite", + "favourites": "favorites", + "favouritism": "favoritism", + "favours": "favors", + "feminise": "feminize", + "feminised": "feminized", + "feminises": "feminizes", + "feminising": "feminizing", + "fertilisation": "fertilization", + "fertilise": "fertilize", + "fertilised": "fertilized", + "fertiliser": "fertilizer", + "fertilisers": "fertilizers", + "fertilises": "fertilizes", + "fertilising": "fertilizing", + "fervour": "fervor", + "fibre": "fiber", + "fibreglass": "fiberglass", + "fibres": "fibers", + "fictionalisation": "fictionalization", + "fictionalisations": "fictionalizations", + "fictionalise": "fictionalize", + "fictionalised": "fictionalized", + "fictionalises": "fictionalizes", + "fictionalising": "fictionalizing", + "fillet": "filet", + "filleted": "fileted", + "filleting": "fileting", + "fillets": "filets", + "finalisation": "finalization", + "finalise": "finalize", + "finalised": "finalized", + "finalises": "finalizes", + "finalising": "finalizing", + "flautist": "flutist", + "flautists": "flutists", + "flavour": "flavor", + "flavoured": "flavored", + "flavouring": "flavoring", + "flavourings": "flavorings", + "flavourless": "flavorless", + "flavours": "flavors", + "flavoursome": "flavorsome", + "flyer / flier": "flier / flyer", + "foetal": "fetal", + "foetid": "fetid", + "foetus": "fetus", + "foetuses": "fetuses", + "formalisation": "formalization", + "formalise": "formalize", + "formalised": "formalized", + "formalises": "formalizes", + "formalising": "formalizing", + "fossilisation": "fossilization", + "fossilise": "fossilize", + "fossilised": "fossilized", + "fossilises": "fossilizes", + "fossilising": "fossilizing", + "fraternisation": "fraternization", + "fraternise": "fraternize", + "fraternised": "fraternized", + "fraternises": "fraternizes", + "fraternising": "fraternizing", + "fulfil": "fulfill", + "fulfilment": "fulfillment", + "fulfils": "fulfills", + "funnelled": "funneled", + "funnelling": "funneling", + "galvanise": "galvanize", + "galvanised": "galvanized", + "galvanises": "galvanizes", + "galvanising": "galvanizing", + "gambolled": "gamboled", + "gambolling": "gamboling", + "gaol": "jail", + "gaolbird": "jailbird", + "gaolbirds": "jailbirds", + "gaolbreak": "jailbreak", + "gaolbreaks": "jailbreaks", + "gaoled": "jailed", + "gaoler": "jailer", + "gaolers": "jailers", + "gaoling": "jailing", + "gaols": "jails", + "gasses": "gases", + "gage": "gauge", + "gaged": "gauged", + "gages": "gauges", + "gaging": "gauging", + "generalisation": "generalization", + "generalisations": "generalizations", + "generalise": "generalize", + "generalised": "generalized", + "generalises": "generalizes", + "generalising": "generalizing", + "ghettoise": "ghettoize", + "ghettoised": "ghettoized", + "ghettoises": "ghettoizes", + "ghettoising": "ghettoizing", + "gipsies": "gypsies", + "glamorise": "glamorize", + "glamorised": "glamorized", + "glamorises": "glamorizes", + "glamorising": "glamorizing", + "glamor": "glamour", + "globalisation": "globalization", + "globalise": "globalize", + "globalised": "globalized", + "globalises": "globalizes", + "globalising": "globalizing", + "glueing": "gluing", + "goitre": "goiter", + "goitres": "goiters", + "gonorrhoea": "gonorrhea", + "gramme": "gram", + "grammes": "grams", + "gravelled": "graveled", + "grey": "gray", + "greyed": "grayed", + "greying": "graying", + "greyish": "grayish", + "greyness": "grayness", + "greys": "grays", + "grovelled": "groveled", + "grovelling": "groveling", + "groyne": "groin", + "groynes": "groins", + "gruelling": "grueling", + "gruellingly": "gruelingly", + "gryphon": "griffin", + "gryphons": "griffins", + "gynaecological": "gynecological", + "gynaecologist": "gynecologist", + "gynaecologists": "gynecologists", + "gynaecology": "gynecology", + "haematological": "hematological", + "haematologist": "hematologist", + "haematologists": "hematologists", + "haematology": "hematology", + "haemoglobin": "hemoglobin", + "haemophilia": "hemophilia", + "haemophiliac": "hemophiliac", + "haemophiliacs": "hemophiliacs", + "haemorrhage": "hemorrhage", + "haemorrhaged": "hemorrhaged", + "haemorrhages": "hemorrhages", + "haemorrhaging": "hemorrhaging", + "haemorrhoids": "hemorrhoids", + "harbour": "harbor", + "harboured": "harbored", + "harbouring": "harboring", + "harbours": "harbors", + "harmonisation": "harmonization", + "harmonise": "harmonize", + "harmonised": "harmonized", + "harmonises": "harmonizes", + "harmonising": "harmonizing", + "homoeopath": "homeopath", + "homoeopathic": "homeopathic", + "homoeopaths": "homeopaths", + "homoeopathy": "homeopathy", + "homogenise": "homogenize", + "homogenised": "homogenized", + "homogenises": "homogenizes", + "homogenising": "homogenizing", + "honour": "honor", + "honourable": "honorable", + "honourably": "honorably", + "honoured": "honored", + "honouring": "honoring", + "honours": "honors", + "hospitalisation": "hospitalization", + "hospitalise": "hospitalize", + "hospitalised": "hospitalized", + "hospitalises": "hospitalizes", + "hospitalising": "hospitalizing", + "humanise": "humanize", + "humanised": "humanized", + "humanises": "humanizes", + "humanising": "humanizing", + "humour": "humor", + "humoured": "humored", + "humouring": "humoring", + "humourless": "humorless", + "humours": "humors", + "hybridise": "hybridize", + "hybridised": "hybridized", + "hybridises": "hybridizes", + "hybridising": "hybridizing", + "hypnotise": "hypnotize", + "hypnotised": "hypnotized", + "hypnotises": "hypnotizes", + "hypnotising": "hypnotizing", + "hypothesise": "hypothesize", + "hypothesised": "hypothesized", + "hypothesises": "hypothesizes", + "hypothesising": "hypothesizing", + "idealisation": "idealization", + "idealise": "idealize", + "idealised": "idealized", + "idealises": "idealizes", + "idealising": "idealizing", + "idolise": "idolize", + "idolised": "idolized", + "idolises": "idolizes", + "idolising": "idolizing", + "immobilisation": "immobilization", + "immobilise": "immobilize", + "immobilised": "immobilized", + "immobiliser": "immobilizer", + "immobilisers": "immobilizers", + "immobilises": "immobilizes", + "immobilising": "immobilizing", + "immortalise": "immortalize", + "immortalised": "immortalized", + "immortalises": "immortalizes", + "immortalising": "immortalizing", + "immunisation": "immunization", + "immunise": "immunize", + "immunised": "immunized", + "immunises": "immunizes", + "immunising": "immunizing", + "impanelled": "impaneled", + "impanelling": "impaneling", + "imperilled": "imperiled", + "imperilling": "imperiling", + "individualise": "individualize", + "individualised": "individualized", + "individualises": "individualizes", + "individualising": "individualizing", + "industrialise": "industrialize", + "industrialised": "industrialized", + "industrialises": "industrializes", + "industrialising": "industrializing", + "inflexion": "inflection", + "inflexions": "inflections", + "initialise": "initialize", + "initialised": "initialized", + "initialises": "initializes", + "initialising": "initializing", + "initialled": "initialed", + "initialling": "initialing", + "instal": "install", + "instalment": "installment", + "instalments": "installments", + "instals": "installs", + "instil": "instill", + "instils": "instills", + "institutionalisation": "institutionalization", + "institutionalise": "institutionalize", + "institutionalised": "institutionalized", + "institutionalises": "institutionalizes", + "institutionalising": "institutionalizing", + "intellectualise": "intellectualize", + "intellectualised": "intellectualized", + "intellectualises": "intellectualizes", + "intellectualising": "intellectualizing", + "internalisation": "internalization", + "internalise": "internalize", + "internalised": "internalized", + "internalises": "internalizes", + "internalising": "internalizing", + "internationalisation": "internationalization", + "internationalise": "internationalize", + "internationalised": "internationalized", + "internationalises": "internationalizes", + "internationalising": "internationalizing", + "ionisation": "ionization", + "ionise": "ionize", + "ionised": "ionized", + "ioniser": "ionizer", + "ionisers": "ionizers", + "ionises": "ionizes", + "ionising": "ionizing", + "italicise": "italicize", + "italicised": "italicized", + "italicises": "italicizes", + "italicising": "italicizing", + "itemise": "itemize", + "itemised": "itemized", + "itemises": "itemizes", + "itemising": "itemizing", + "jeopardise": "jeopardize", + "jeopardised": "jeopardized", + "jeopardises": "jeopardizes", + "jeopardising": "jeopardizing", + "jewelled": "jeweled", + "jeweller": "jeweler", + "jewellers": "jewelers", + "jewellery": "jewelry", + "judgement": "judgment", + "kilogramme": "kilogram", + "kilogrammes": "kilograms", + "kilometre": "kilometer", + "kilometres": "kilometers", + "labelled": "labeled", + "labelling": "labeling", + "labour": "labor", + "laboured": "labored", + "labourer": "laborer", + "labourers": "laborers", + "labouring": "laboring", + "labours": "labors", + "lacklustre": "lackluster", + "legalisation": "legalization", + "legalise": "legalize", + "legalised": "legalized", + "legalises": "legalizes", + "legalising": "legalizing", + "legitimise": "legitimize", + "legitimised": "legitimized", + "legitimises": "legitimizes", + "legitimising": "legitimizing", + "leukaemia": "leukemia", + "levelled": "leveled", + "leveller": "leveler", + "levellers": "levelers", + "levelling": "leveling", + "libelled": "libeled", + "libelling": "libeling", + "libellous": "libelous", + "liberalisation": "liberalization", + "liberalise": "liberalize", + "liberalised": "liberalized", + "liberalises": "liberalizes", + "liberalising": "liberalizing", + "licence": "license", + "licenced": "licensed", + "licences": "licenses", + "licencing": "licensing", + "likeable": "likable", + "lionisation": "lionization", + "lionise": "lionize", + "lionised": "lionized", + "lionises": "lionizes", + "lionising": "lionizing", + "liquidise": "liquidize", + "liquidised": "liquidized", + "liquidiser": "liquidizer", + "liquidisers": "liquidizers", + "liquidises": "liquidizes", + "liquidising": "liquidizing", + "litre": "liter", + "litres": "liters", + "localise": "localize", + "localised": "localized", + "localises": "localizes", + "localising": "localizing", + "louvre": "louver", + "louvred": "louvered", + "louvres": "louvers", + "lustre": "luster", + "magnetise": "magnetize", + "magnetised": "magnetized", + "magnetises": "magnetizes", + "magnetising": "magnetizing", + "manoeuvrability": "maneuverability", + "manoeuvrable": "maneuverable", + "manoeuvre": "maneuver", + "manoeuvred": "maneuvered", + "manoeuvres": "maneuvers", + "manoeuvring": "maneuvering", + "manoeuvrings": "maneuverings", + "marginalisation": "marginalization", + "marginalise": "marginalize", + "marginalised": "marginalized", + "marginalises": "marginalizes", + "marginalising": "marginalizing", + "marshalled": "marshaled", + "marshalling": "marshaling", + "marvelled": "marveled", + "marvelling": "marveling", + "marvellous": "marvelous", + "marvellously": "marvelously", + "materialisation": "materialization", + "materialise": "materialize", + "materialised": "materialized", + "materialises": "materializes", + "materialising": "materializing", + "maximisation": "maximization", + "maximise": "maximize", + "maximised": "maximized", + "maximises": "maximizes", + "maximising": "maximizing", + "meagre": "meager", + "mechanisation": "mechanization", + "mechanise": "mechanize", + "mechanised": "mechanized", + "mechanises": "mechanizes", + "mechanising": "mechanizing", + "mediaeval": "medieval", + "memorialise": "memorialize", + "memorialised": "memorialized", + "memorialises": "memorializes", + "memorialising": "memorializing", + "memorise": "memorize", + "memorised": "memorized", + "memorises": "memorizes", + "memorising": "memorizing", + "mesmerise": "mesmerize", + "mesmerised": "mesmerized", + "mesmerises": "mesmerizes", + "mesmerising": "mesmerizing", + "metabolise": "metabolize", + "metabolised": "metabolized", + "metabolises": "metabolizes", + "metabolising": "metabolizing", + "metre": "meter", + "metres": "meters", + "micrometre": "micrometer", + "micrometres": "micrometers", + "militarise": "militarize", + "militarised": "militarized", + "militarises": "militarizes", + "militarising": "militarizing", + "milligramme": "milligram", + "milligrammes": "milligrams", + "millilitre": "milliliter", + "millilitres": "milliliters", + "millimetre": "millimeter", + "millimetres": "millimeters", + "miniaturisation": "miniaturization", + "miniaturise": "miniaturize", + "miniaturised": "miniaturized", + "miniaturises": "miniaturizes", + "miniaturising": "miniaturizing", + "minibusses": "minibuses", + "minimise": "minimize", + "minimised": "minimized", + "minimises": "minimizes", + "minimising": "minimizing", + "misbehaviour": "misbehavior", + "misdemeanour": "misdemeanor", + "misdemeanours": "misdemeanors", + "misspelt": "misspelled", + "mitre": "miter", + "mitres": "miters", + "mobilisation": "mobilization", + "mobilise": "mobilize", + "mobilised": "mobilized", + "mobilises": "mobilizes", + "mobilising": "mobilizing", + "modelled": "modeled", + "modeller": "modeler", + "modellers": "modelers", + "modelling": "modeling", + "modernise": "modernize", + "modernised": "modernized", + "modernises": "modernizes", + "modernising": "modernizing", + "moisturise": "moisturize", + "moisturised": "moisturized", + "moisturiser": "moisturizer", + "moisturisers": "moisturizers", + "moisturises": "moisturizes", + "moisturising": "moisturizing", + "monologue": "monolog", + "monologues": "monologs", + "monopolisation": "monopolization", + "monopolise": "monopolize", + "monopolised": "monopolized", + "monopolises": "monopolizes", + "monopolising": "monopolizing", + "moralise": "moralize", + "moralised": "moralized", + "moralises": "moralizes", + "moralising": "moralizing", + "motorised": "motorized", + "mould": "mold", + "moulded": "molded", + "moulder": "molder", + "mouldered": "moldered", + "mouldering": "moldering", + "moulders": "molders", + "mouldier": "moldier", + "mouldiest": "moldiest", + "moulding": "molding", + "mouldings": "moldings", + "moulds": "molds", + "mouldy": "moldy", + "moult": "molt", + "moulted": "molted", + "moulting": "molting", + "moults": "molts", + "moustache": "mustache", + "moustached": "mustached", + "moustaches": "mustaches", + "moustachioed": "mustachioed", + "multicoloured": "multicolored", + "nationalisation": "nationalization", + "nationalisations": "nationalizations", + "nationalise": "nationalize", + "nationalised": "nationalized", + "nationalises": "nationalizes", + "nationalising": "nationalizing", + "naturalisation": "naturalization", + "naturalise": "naturalize", + "naturalised": "naturalized", + "naturalises": "naturalizes", + "naturalising": "naturalizing", + "neighbour": "neighbor", + "neighbourhood": "neighborhood", + "neighbourhoods": "neighborhoods", + "neighbouring": "neighboring", + "neighbourliness": "neighborliness", + "neighbourly": "neighborly", + "neighbours": "neighbors", + "neutralisation": "neutralization", + "neutralise": "neutralize", + "neutralised": "neutralized", + "neutralises": "neutralizes", + "neutralising": "neutralizing", + "normalisation": "normalization", + "normalise": "normalize", + "normalised": "normalized", + "normalises": "normalizes", + "normalising": "normalizing", + "odour": "odor", + "odourless": "odorless", + "odours": "odors", + "oesophagus": "esophagus", + "oesophaguses": "esophaguses", + "oestrogen": "estrogen", + "offence": "offense", + "offences": "offenses", + "omelette": "omelet", + "omelettes": "omelets", + "optimise": "optimize", + "optimised": "optimized", + "optimises": "optimizes", + "optimising": "optimizing", + "organisation": "organization", + "organisational": "organizational", + "organisations": "organizations", + "organise": "organize", + "organised": "organized", + "organiser": "organizer", + "organisers": "organizers", + "organises": "organizes", + "organising": "organizing", + "orthopaedic": "orthopedic", + "orthopaedics": "orthopedics", + "ostracise": "ostracize", + "ostracised": "ostracized", + "ostracises": "ostracizes", + "ostracising": "ostracizing", + "outmanoeuvre": "outmaneuver", + "outmanoeuvred": "outmaneuvered", + "outmanoeuvres": "outmaneuvers", + "outmanoeuvring": "outmaneuvering", + "overemphasise": "overemphasize", + "overemphasised": "overemphasized", + "overemphasises": "overemphasizes", + "overemphasising": "overemphasizing", + "oxidisation": "oxidization", + "oxidise": "oxidize", + "oxidised": "oxidized", + "oxidises": "oxidizes", + "oxidising": "oxidizing", + "paederast": "pederast", + "paederasts": "pederasts", + "paediatric": "pediatric", + "paediatrician": "pediatrician", + "paediatricians": "pediatricians", + "paediatrics": "pediatrics", + "paedophile": "pedophile", + "paedophiles": "pedophiles", + "paedophilia": "pedophilia", + "palaeolithic": "paleolithic", + "palaeontologist": "paleontologist", + "palaeontologists": "paleontologists", + "palaeontology": "paleontology", + "panelled": "paneled", + "panelling": "paneling", + "panellist": "panelist", + "panellists": "panelists", + "paralyse": "paralyze", + "paralysed": "paralyzed", + "paralyses": "paralyzes", + "paralysing": "paralyzing", + "parcelled": "parceled", + "parcelling": "parceling", + "parlour": "parlor", + "parlours": "parlors", + "particularise": "particularize", + "particularised": "particularized", + "particularises": "particularizes", + "particularising": "particularizing", + "passivisation": "passivization", + "passivise": "passivize", + "passivised": "passivized", + "passivises": "passivizes", + "passivising": "passivizing", + "pasteurisation": "pasteurization", + "pasteurise": "pasteurize", + "pasteurised": "pasteurized", + "pasteurises": "pasteurizes", + "pasteurising": "pasteurizing", + "patronise": "patronize", + "patronised": "patronized", + "patronises": "patronizes", + "patronising": "patronizing", + "patronisingly": "patronizingly", + "pedalled": "pedaled", + "pedalling": "pedaling", + "pedestrianisation": "pedestrianization", + "pedestrianise": "pedestrianize", + "pedestrianised": "pedestrianized", + "pedestrianises": "pedestrianizes", + "pedestrianising": "pedestrianizing", + "penalise": "penalize", + "penalised": "penalized", + "penalises": "penalizes", + "penalising": "penalizing", + "pencilled": "penciled", + "pencilling": "penciling", + "personalise": "personalize", + "personalised": "personalized", + "personalises": "personalizes", + "personalising": "personalizing", + "pharmacopoeia": "pharmacopeia", + "pharmacopoeias": "pharmacopeias", + "philosophise": "philosophize", + "philosophised": "philosophized", + "philosophises": "philosophizes", + "philosophising": "philosophizing", + "philtre": "filter", + "philtres": "filters", + "phoney": "phony", + "plagiarise": "plagiarize", + "plagiarised": "plagiarized", + "plagiarises": "plagiarizes", + "plagiarising": "plagiarizing", + "plough": "plow", + "ploughed": "plowed", + "ploughing": "plowing", + "ploughman": "plowman", + "ploughmen": "plowmen", + "ploughs": "plows", + "ploughshare": "plowshare", + "ploughshares": "plowshares", + "polarisation": "polarization", + "polarise": "polarize", + "polarised": "polarized", + "polarises": "polarizes", + "polarising": "polarizing", + "politicisation": "politicization", + "politicise": "politicize", + "politicised": "politicized", + "politicises": "politicizes", + "politicising": "politicizing", + "popularisation": "popularization", + "popularise": "popularize", + "popularised": "popularized", + "popularises": "popularizes", + "popularising": "popularizing", + "pouffe": "pouf", + "pouffes": "poufs", + "practise": "practice", + "practised": "practiced", + "practises": "practices", + "practising": "practicing", + "praesidium": "presidium", + "praesidiums": "presidiums", + "pressurisation": "pressurization", + "pressurise": "pressurize", + "pressurised": "pressurized", + "pressurises": "pressurizes", + "pressurising": "pressurizing", + "pretence": "pretense", + "pretences": "pretenses", + "primaeval": "primeval", + "prioritisation": "prioritization", + "prioritise": "prioritize", + "prioritised": "prioritized", + "prioritises": "prioritizes", + "prioritising": "prioritizing", + "privatisation": "privatization", + "privatisations": "privatizations", + "privatise": "privatize", + "privatised": "privatized", + "privatises": "privatizes", + "privatising": "privatizing", + "professionalisation": "professionalization", + "professionalise": "professionalize", + "professionalised": "professionalized", + "professionalises": "professionalizes", + "professionalising": "professionalizing", + "programme": "program", + "programmes": "programs", + "prologue": "prolog", + "prologues": "prologs", + "propagandise": "propagandize", + "propagandised": "propagandized", + "propagandises": "propagandizes", + "propagandising": "propagandizing", + "proselytise": "proselytize", + "proselytised": "proselytized", + "proselytiser": "proselytizer", + "proselytisers": "proselytizers", + "proselytises": "proselytizes", + "proselytising": "proselytizing", + "psychoanalyse": "psychoanalyze", + "psychoanalysed": "psychoanalyzed", + "psychoanalyses": "psychoanalyzes", + "psychoanalysing": "psychoanalyzing", + "publicise": "publicize", + "publicised": "publicized", + "publicises": "publicizes", + "publicising": "publicizing", + "pulverisation": "pulverization", + "pulverise": "pulverize", + "pulverised": "pulverized", + "pulverises": "pulverizes", + "pulverising": "pulverizing", + "pummelled": "pummel", + "pummelling": "pummeled", + "pyjama": "pajama", + "pyjamas": "pajamas", + "pzazz": "pizzazz", + "quarrelled": "quarreled", + "quarrelling": "quarreling", + "radicalise": "radicalize", + "radicalised": "radicalized", + "radicalises": "radicalizes", + "radicalising": "radicalizing", + "rancour": "rancor", + "randomise": "randomize", + "randomised": "randomized", + "randomises": "randomizes", + "randomising": "randomizing", + "rationalisation": "rationalization", + "rationalisations": "rationalizations", + "rationalise": "rationalize", + "rationalised": "rationalized", + "rationalises": "rationalizes", + "rationalising": "rationalizing", + "ravelled": "raveled", + "ravelling": "raveling", + "realisable": "realizable", + "realisation": "realization", + "realisations": "realizations", + "realise": "realize", + "realised": "realized", + "realises": "realizes", + "realising": "realizing", + "recognisable": "recognizable", + "recognisably": "recognizably", + "recognisance": "recognizance", + "recognise": "recognize", + "recognised": "recognized", + "recognises": "recognizes", + "recognising": "recognizing", + "reconnoitre": "reconnoiter", + "reconnoitred": "reconnoitered", + "reconnoitres": "reconnoiters", + "reconnoitring": "reconnoitering", + "refuelled": "refueled", + "refuelling": "refueling", + "regularisation": "regularization", + "regularise": "regularize", + "regularised": "regularized", + "regularises": "regularizes", + "regularising": "regularizing", + "remodelled": "remodeled", + "remodelling": "remodeling", + "remould": "remold", + "remoulded": "remolded", + "remoulding": "remolding", + "remoulds": "remolds", + "reorganisation": "reorganization", + "reorganisations": "reorganizations", + "reorganise": "reorganize", + "reorganised": "reorganized", + "reorganises": "reorganizes", + "reorganising": "reorganizing", + "revelled": "reveled", + "reveller": "reveler", + "revellers": "revelers", + "revelling": "reveling", + "revitalise": "revitalize", + "revitalised": "revitalized", + "revitalises": "revitalizes", + "revitalising": "revitalizing", + "revolutionise": "revolutionize", + "revolutionised": "revolutionized", + "revolutionises": "revolutionizes", + "revolutionising": "revolutionizing", + "rhapsodise": "rhapsodize", + "rhapsodised": "rhapsodized", + "rhapsodises": "rhapsodizes", + "rhapsodising": "rhapsodizing", + "rigour": "rigor", + "rigours": "rigors", + "ritualised": "ritualized", + "rivalled": "rivaled", + "rivalling": "rivaling", + "romanticise": "romanticize", + "romanticised": "romanticized", + "romanticises": "romanticizes", + "romanticising": "romanticizing", + "rumour": "rumor", + "rumoured": "rumored", + "rumours": "rumors", + "sabre": "saber", + "sabres": "sabers", + "saltpetre": "saltpeter", + "sanitise": "sanitize", + "sanitised": "sanitized", + "sanitises": "sanitizes", + "sanitising": "sanitizing", + "satirise": "satirize", + "satirised": "satirized", + "satirises": "satirizes", + "satirising": "satirizing", + "saviour": "savior", + "saviours": "saviors", + "savour": "savor", + "savoured": "savored", + "savouries": "savories", + "savouring": "savoring", + "savours": "savors", + "savoury": "savory", + "scandalise": "scandalize", + "scandalised": "scandalized", + "scandalises": "scandalizes", + "scandalising": "scandalizing", + "sceptic": "skeptic", + "sceptical": "skeptical", + "sceptically": "skeptically", + "scepticism": "skepticism", + "sceptics": "skeptics", + "sceptre": "scepter", + "sceptres": "scepters", + "scrutinise": "scrutinize", + "scrutinised": "scrutinized", + "scrutinises": "scrutinizes", + "scrutinising": "scrutinizing", + "secularisation": "secularization", + "secularise": "secularize", + "secularised": "secularized", + "secularises": "secularizes", + "secularising": "secularizing", + "sensationalise": "sensationalize", + "sensationalised": "sensationalized", + "sensationalises": "sensationalizes", + "sensationalising": "sensationalizing", + "sensitise": "sensitize", + "sensitised": "sensitized", + "sensitises": "sensitizes", + "sensitising": "sensitizing", + "sentimentalise": "sentimentalize", + "sentimentalised": "sentimentalized", + "sentimentalises": "sentimentalizes", + "sentimentalising": "sentimentalizing", + "sepulchre": "sepulcher", + "sepulchres": "sepulchers", + "serialisation": "serialization", + "serialisations": "serializations", + "serialise": "serialize", + "serialised": "serialized", + "serialises": "serializes", + "serialising": "serializing", + "sermonise": "sermonize", + "sermonised": "sermonized", + "sermonises": "sermonizes", + "sermonising": "sermonizing", + "sheikh": "sheik", + "shovelled": "shoveled", + "shovelling": "shoveling", + "shrivelled": "shriveled", + "shrivelling": "shriveling", + "signalise": "signalize", + "signalised": "signalized", + "signalises": "signalizes", + "signalising": "signalizing", + "signalled": "signaled", + "signalling": "signaling", + "smoulder": "smolder", + "smouldered": "smoldered", + "smouldering": "smoldering", + "smoulders": "smolders", + "snivelled": "sniveled", + "snivelling": "sniveling", + "snorkelled": "snorkeled", + "snorkelling": "snorkeling", + "snowplough": "snowplow", + "snowploughs": "snowplow", + "socialisation": "socialization", + "socialise": "socialize", + "socialised": "socialized", + "socialises": "socializes", + "socialising": "socializing", + "sodomise": "sodomize", + "sodomised": "sodomized", + "sodomises": "sodomizes", + "sodomising": "sodomizing", + "solemnise": "solemnize", + "solemnised": "solemnized", + "solemnises": "solemnizes", + "solemnising": "solemnizing", + "sombre": "somber", + "specialisation": "specialization", + "specialisations": "specializations", + "specialise": "specialize", + "specialised": "specialized", + "specialises": "specializes", + "specialising": "specializing", + "spectre": "specter", + "spectres": "specters", + "spiralled": "spiraled", + "spiralling": "spiraling", + "splendour": "splendor", + "splendours": "splendors", + "squirrelled": "squirreled", + "squirrelling": "squirreling", + "stabilisation": "stabilization", + "stabilise": "stabilize", + "stabilised": "stabilized", + "stabiliser": "stabilizer", + "stabilisers": "stabilizers", + "stabilises": "stabilizes", + "stabilising": "stabilizing", + "standardisation": "standardization", + "standardise": "standardize", + "standardised": "standardized", + "standardises": "standardizes", + "standardising": "standardizing", + "stencilled": "stenciled", + "stencilling": "stenciling", + "sterilisation": "sterilization", + "sterilisations": "sterilizations", + "sterilise": "sterilize", + "sterilised": "sterilized", + "steriliser": "sterilizer", + "sterilisers": "sterilizers", + "sterilises": "sterilizes", + "sterilising": "sterilizing", + "stigmatisation": "stigmatization", + "stigmatise": "stigmatize", + "stigmatised": "stigmatized", + "stigmatises": "stigmatizes", + "stigmatising": "stigmatizing", + "storey": "story", + "storeys": "stories", + "subsidisation": "subsidization", + "subsidise": "subsidize", + "subsidised": "subsidized", + "subsidiser": "subsidizer", + "subsidisers": "subsidizers", + "subsidises": "subsidizes", + "subsidising": "subsidizing", + "succour": "succor", + "succoured": "succored", + "succouring": "succoring", + "succours": "succors", + "sulphate": "sulfate", + "sulphates": "sulfates", + "sulphide": "sulfide", + "sulphides": "sulfides", + "sulphur": "sulfur", + "sulphurous": "sulfurous", + "summarise": "summarize", + "summarised": "summarized", + "summarises": "summarizes", + "summarising": "summarizing", + "swivelled": "swiveled", + "swivelling": "swiveling", + "symbolise": "symbolize", + "symbolised": "symbolized", + "symbolises": "symbolizes", + "symbolising": "symbolizing", + "sympathise": "sympathize", + "sympathised": "sympathized", + "sympathiser": "sympathizer", + "sympathisers": "sympathizers", + "sympathises": "sympathizes", + "sympathising": "sympathizing", + "synchronisation": "synchronization", + "synchronise": "synchronize", + "synchronised": "synchronized", + "synchronises": "synchronizes", + "synchronising": "synchronizing", + "synthesise": "synthesize", + "synthesised": "synthesized", + "synthesiser": "synthesizer", + "synthesisers": "synthesizers", + "synthesises": "synthesizes", + "synthesising": "synthesizing", + "syphon": "siphon", + "syphoned": "siphoned", + "syphoning": "siphoning", + "syphons": "siphons", + "systematisation": "systematization", + "systematise": "systematize", + "systematised": "systematized", + "systematises": "systematizes", + "systematising": "systematizing", + "tantalise": "tantalize", + "tantalised": "tantalized", + "tantalises": "tantalizes", + "tantalising": "tantalizing", + "tantalisingly": "tantalizingly", + "tasselled": "tasseled", + "technicolour": "technicolor", + "temporise": "temporize", + "temporised": "temporized", + "temporises": "temporizes", + "temporising": "temporizing", + "tenderise": "tenderize", + "tenderised": "tenderized", + "tenderises": "tenderizes", + "tenderising": "tenderizing", + "terrorise": "terrorize", + "terrorised": "terrorized", + "terrorises": "terrorizes", + "terrorising": "terrorizing", + "theatre": "theater", + "theatregoer": "theatergoer", + "theatregoers": "theatergoers", + "theatres": "theaters", + "theorise": "theorize", + "theorised": "theorized", + "theorises": "theorizes", + "theorising": "theorizing", + "tonne": "ton", + "tonnes": "tons", + "towelled": "toweled", + "towelling": "toweling", + "toxaemia": "toxemia", + "tranquillise": "tranquilize", + "tranquillised": "tranquilized", + "tranquilliser": "tranquilizer", + "tranquillisers": "tranquilizers", + "tranquillises": "tranquilizes", + "tranquillising": "tranquilizing", + "tranquillity": "tranquility", + "tranquillize": "tranquilize", + "tranquillized": "tranquilized", + "tranquillizer": "tranquilizer", + "tranquillizers": "tranquilizers", + "tranquillizes": "tranquilizes", + "tranquillizing": "tranquilizing", + "tranquilly": "tranquility", + "transistorised": "transistorized", + "traumatise": "traumatize", + "traumatised": "traumatized", + "traumatises": "traumatizes", + "traumatising": "traumatizing", + "travelled": "traveled", + "traveller": "traveler", + "travellers": "travelers", + "travelling": "traveling", + "travelog": "travelogue", + "travelogs": "travelogues", + "trialled": "trialed", + "trialling": "trialing", + "tricolour": "tricolor", + "tricolours": "tricolors", + "trivialise": "trivialize", + "trivialised": "trivialized", + "trivialises": "trivializes", + "trivialising": "trivializing", + "tumour": "tumor", + "tumours": "tumors", + "tunnelled": "tunneled", + "tunnelling": "tunneling", + "tyrannise": "tyrannize", + "tyrannised": "tyrannized", + "tyrannises": "tyrannizes", + "tyrannising": "tyrannizing", + "tyre": "tire", + "tyres": "tires", + "unauthorised": "unauthorized", + "uncivilised": "uncivilized", + "underutilised": "underutilized", + "unequalled": "unequaled", + "unfavourable": "unfavorable", + "unfavourably": "unfavorably", + "unionisation": "unionization", + "unionise": "unionize", + "unionised": "unionized", + "unionises": "unionizes", + "unionising": "unionizing", + "unorganised": "unorganized", + "unravelled": "unraveled", + "unravelling": "unraveling", + "unrecognisable": "unrecognizable", + "unrecognised": "unrecognized", + "unrivalled": "unrivaled", + "unsavoury": "unsavory", + "untrammelled": "untrammeled", + "urbanisation": "urbanization", + "urbanise": "urbanize", + "urbanised": "urbanized", + "urbanises": "urbanizes", + "urbanising": "urbanizing", + "utilisable": "utilizable", + "utilisation": "utilization", + "utilise": "utilize", + "utilised": "utilized", + "utilises": "utilizes", + "utilising": "utilizing", + "valour": "valor", + "vandalise": "vandalize", + "vandalised": "vandalized", + "vandalises": "vandalizes", + "vandalising": "vandalizing", + "vaporisation": "vaporization", + "vaporise": "vaporize", + "vaporised": "vaporized", + "vaporises": "vaporizes", + "vaporising": "vaporizing", + "vapour": "vapor", + "vapours": "vapors", + "verbalise": "verbalize", + "verbalised": "verbalized", + "verbalises": "verbalizes", + "verbalising": "verbalizing", + "victimisation": "victimization", + "victimise": "victimize", + "victimised": "victimized", + "victimises": "victimizes", + "victimising": "victimizing", + "videodisc": "videodisk", + "videodiscs": "videodisks", + "vigour": "vigor", + "visualisation": "visualization", + "visualisations": "visualizations", + "visualise": "visualize", + "visualised": "visualized", + "visualises": "visualizes", + "visualising": "visualizing", + "vocalisation": "vocalization", + "vocalisations": "vocalizations", + "vocalise": "vocalize", + "vocalised": "vocalized", + "vocalises": "vocalizes", + "vocalising": "vocalizing", + "vulcanised": "vulcanized", + "vulgarisation": "vulgarization", + "vulgarise": "vulgarize", + "vulgarised": "vulgarized", + "vulgarises": "vulgarizes", + "vulgarising": "vulgarizing", + "waggon": "wagon", + "waggons": "wagons", + "watercolour": "watercolor", + "watercolours": "watercolors", + "weaselled": "weaseled", + "weaselling": "weaseling", + "westernisation": "westernization", + "westernise": "westernize", + "westernised": "westernized", + "westernises": "westernizes", + "westernising": "westernizing", + "womanise": "womanize", + "womanised": "womanized", + "womaniser": "womanizer", + "womanisers": "womanizers", + "womanises": "womanizes", + "womanising": "womanizing", + "woollen": "woolen", + "woollens": "woolens", + "woollies": "woolies", + "woolly": "wooly", + "worshipped": "worshiped", + "worshipping": "worshiping", + "worshipper": "worshiper", + "yodelled": "yodeled", + "yodelling": "yodeling", + "yoghourt": "yogurt", + "yoghourts": "yogurts", + "yoghurt": "yogurt", + "yoghurts": "yogurts", + "mhm": "hmm", + "mmm": "hmm" +} \ No newline at end of file diff --git a/funasr/models/sense_voice/whisper_lib/normalizers/english.py b/funasr/models/sense_voice/whisper_lib/normalizers/english.py new file mode 100644 index 0000000..cb46530 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/normalizers/english.py @@ -0,0 +1,546 @@ +import json +import os +import re +from fractions import Fraction +from typing import Iterator, List, Match, Optional, Union + +from more_itertools import windowed + +from .basic import remove_symbols_and_diacritics + + +class EnglishNumberNormalizer: + """ + Convert any spelled-out numbers into arabic numbers, while handling: + + - remove any commas + - keep the suffixes such as: `1960s`, `274th`, `32nd`, etc. + - spell out currency symbols after the number. e.g. `$20 million` -> `20000000 dollars` + - spell out `one` and `ones` + - interpret successive single-digit numbers as nominal: `one oh one` -> `101` + """ + + def __init__(self): + super().__init__() + + self.zeros = {"o", "oh", "zero"} + self.ones = { + name: i + for i, name in enumerate( + [ + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "ten", + "eleven", + "twelve", + "thirteen", + "fourteen", + "fifteen", + "sixteen", + "seventeen", + "eighteen", + "nineteen", + ], + start=1, + ) + } + self.ones_plural = { + "sixes" if name == "six" else name + "s": (value, "s") + for name, value in self.ones.items() + } + self.ones_ordinal = { + "zeroth": (0, "th"), + "first": (1, "st"), + "second": (2, "nd"), + "third": (3, "rd"), + "fifth": (5, "th"), + "twelfth": (12, "th"), + **{ + name + ("h" if name.endswith("t") else "th"): (value, "th") + for name, value in self.ones.items() + if value > 3 and value != 5 and value != 12 + }, + } + self.ones_suffixed = {**self.ones_plural, **self.ones_ordinal} + + self.tens = { + "twenty": 20, + "thirty": 30, + "forty": 40, + "fifty": 50, + "sixty": 60, + "seventy": 70, + "eighty": 80, + "ninety": 90, + } + self.tens_plural = { + name.replace("y", "ies"): (value, "s") for name, value in self.tens.items() + } + self.tens_ordinal = { + name.replace("y", "ieth"): (value, "th") for name, value in self.tens.items() + } + self.tens_suffixed = {**self.tens_plural, **self.tens_ordinal} + + self.multipliers = { + "hundred": 100, + "thousand": 1_000, + "million": 1_000_000, + "billion": 1_000_000_000, + "trillion": 1_000_000_000_000, + "quadrillion": 1_000_000_000_000_000, + "quintillion": 1_000_000_000_000_000_000, + "sextillion": 1_000_000_000_000_000_000_000, + "septillion": 1_000_000_000_000_000_000_000_000, + "octillion": 1_000_000_000_000_000_000_000_000_000, + "nonillion": 1_000_000_000_000_000_000_000_000_000_000, + "decillion": 1_000_000_000_000_000_000_000_000_000_000_000, + } + self.multipliers_plural = { + name + "s": (value, "s") for name, value in self.multipliers.items() + } + self.multipliers_ordinal = { + name + "th": (value, "th") for name, value in self.multipliers.items() + } + self.multipliers_suffixed = { + **self.multipliers_plural, + **self.multipliers_ordinal, + } + self.decimals = {*self.ones, *self.tens, *self.zeros} + + self.preceding_prefixers = { + "minus": "-", + "negative": "-", + "plus": "+", + "positive": "+", + } + self.following_prefixers = { + "pound": "£", + "pounds": "£", + "euro": "€", + "euros": "€", + "dollar": "$", + "dollars": "$", + "cent": "¢", + "cents": "¢", + } + self.prefixes = set( + list(self.preceding_prefixers.values()) + list(self.following_prefixers.values()) + ) + self.suffixers = { + "per": {"cent": "%"}, + "percent": "%", + } + self.specials = {"and", "double", "triple", "point"} + + self.words = set( + [ + key + for mapping in [ + self.zeros, + self.ones, + self.ones_suffixed, + self.tens, + self.tens_suffixed, + self.multipliers, + self.multipliers_suffixed, + self.preceding_prefixers, + self.following_prefixers, + self.suffixers, + self.specials, + ] + for key in mapping + ] + ) + self.literal_words = {"one", "ones"} + + def process_words(self, words: List[str]) -> Iterator[str]: + prefix: Optional[str] = None + value: Optional[Union[str, int]] = None + skip = False + + def to_fraction(s: str): + try: + return Fraction(s) + except ValueError: + return None + + def output(result: Union[str, int]): + nonlocal prefix, value + result = str(result) + if prefix is not None: + result = prefix + result + value = None + prefix = None + return result + + if len(words) == 0: + return + + for prev, current, next in windowed([None] + words + [None], 3): + if skip: + skip = False + continue + + next_is_numeric = next is not None and re.match(r"^\d+(\.\d+)?$", next) + has_prefix = current[0] in self.prefixes + current_without_prefix = current[1:] if has_prefix else current + if re.match(r"^\d+(\.\d+)?$", current_without_prefix): + # arabic numbers (potentially with signs and fractions) + f = to_fraction(current_without_prefix) + assert f is not None + if value is not None: + if isinstance(value, str) and value.endswith("."): + # concatenate decimals / ip address components + value = str(value) + str(current) + continue + else: + yield output(value) + + prefix = current[0] if has_prefix else prefix + if f.denominator == 1: + value = f.numerator # store integers as int + else: + value = current_without_prefix + elif current not in self.words: + # non-numeric words + if value is not None: + yield output(value) + yield output(current) + elif current in self.zeros: + value = str(value or "") + "0" + elif current in self.ones: + ones = self.ones[current] + + if value is None: + value = ones + elif isinstance(value, str) or prev in self.ones: + if prev in self.tens and ones < 10: # replace the last zero with the digit + assert value[-1] == "0" + value = value[:-1] + str(ones) + else: + value = str(value) + str(ones) + elif ones < 10: + if value % 10 == 0: + value += ones + else: + value = str(value) + str(ones) + else: # eleven to nineteen + if value % 100 == 0: + value += ones + else: + value = str(value) + str(ones) + elif current in self.ones_suffixed: + # ordinal or cardinal; yield the number right away + ones, suffix = self.ones_suffixed[current] + if value is None: + yield output(str(ones) + suffix) + elif isinstance(value, str) or prev in self.ones: + if prev in self.tens and ones < 10: + assert value[-1] == "0" + yield output(value[:-1] + str(ones) + suffix) + else: + yield output(str(value) + str(ones) + suffix) + elif ones < 10: + if value % 10 == 0: + yield output(str(value + ones) + suffix) + else: + yield output(str(value) + str(ones) + suffix) + else: # eleven to nineteen + if value % 100 == 0: + yield output(str(value + ones) + suffix) + else: + yield output(str(value) + str(ones) + suffix) + value = None + elif current in self.tens: + tens = self.tens[current] + if value is None: + value = tens + elif isinstance(value, str): + value = str(value) + str(tens) + else: + if value % 100 == 0: + value += tens + else: + value = str(value) + str(tens) + elif current in self.tens_suffixed: + # ordinal or cardinal; yield the number right away + tens, suffix = self.tens_suffixed[current] + if value is None: + yield output(str(tens) + suffix) + elif isinstance(value, str): + yield output(str(value) + str(tens) + suffix) + else: + if value % 100 == 0: + yield output(str(value + tens) + suffix) + else: + yield output(str(value) + str(tens) + suffix) + elif current in self.multipliers: + multiplier = self.multipliers[current] + if value is None: + value = multiplier + elif isinstance(value, str) or value == 0: + f = to_fraction(value) + p = f * multiplier if f is not None else None + if f is not None and p.denominator == 1: + value = p.numerator + else: + yield output(value) + value = multiplier + else: + before = value // 1000 * 1000 + residual = value % 1000 + value = before + residual * multiplier + elif current in self.multipliers_suffixed: + multiplier, suffix = self.multipliers_suffixed[current] + if value is None: + yield output(str(multiplier) + suffix) + elif isinstance(value, str): + f = to_fraction(value) + p = f * multiplier if f is not None else None + if f is not None and p.denominator == 1: + yield output(str(p.numerator) + suffix) + else: + yield output(value) + yield output(str(multiplier) + suffix) + else: # int + before = value // 1000 * 1000 + residual = value % 1000 + value = before + residual * multiplier + yield output(str(value) + suffix) + value = None + elif current in self.preceding_prefixers: + # apply prefix (positive, minus, etc.) if it precedes a number + if value is not None: + yield output(value) + + if next in self.words or next_is_numeric: + prefix = self.preceding_prefixers[current] + else: + yield output(current) + elif current in self.following_prefixers: + # apply prefix (dollars, cents, etc.) only after a number + if value is not None: + prefix = self.following_prefixers[current] + yield output(value) + else: + yield output(current) + elif current in self.suffixers: + # apply suffix symbols (percent -> '%') + if value is not None: + suffix = self.suffixers[current] + if isinstance(suffix, dict): + if next in suffix: + yield output(str(value) + suffix[next]) + skip = True + else: + yield output(value) + yield output(current) + else: + yield output(str(value) + suffix) + else: + yield output(current) + elif current in self.specials: + if next not in self.words and not next_is_numeric: + # apply special handling only if the next word can be numeric + if value is not None: + yield output(value) + yield output(current) + elif current == "and": + # ignore "and" after hundreds, thousands, etc. + if prev not in self.multipliers: + if value is not None: + yield output(value) + yield output(current) + elif current == "double" or current == "triple": + if next in self.ones or next in self.zeros: + repeats = 2 if current == "double" else 3 + ones = self.ones.get(next, 0) + value = str(value or "") + str(ones) * repeats + skip = True + else: + if value is not None: + yield output(value) + yield output(current) + elif current == "point": + if next in self.decimals or next_is_numeric: + value = str(value or "") + "." + else: + # should all have been covered at this point + raise ValueError(f"Unexpected token: {current}") + else: + # all should have been covered at this point + raise ValueError(f"Unexpected token: {current}") + + if value is not None: + yield output(value) + + def preprocess(self, s: str): + # replace " and a half" with " point five" + results = [] + + segments = re.split(r"\band\s+a\s+half\b", s) + for i, segment in enumerate(segments): + if len(segment.strip()) == 0: + continue + if i == len(segments) - 1: + results.append(segment) + else: + results.append(segment) + last_word = segment.rsplit(maxsplit=2)[-1] + if last_word in self.decimals or last_word in self.multipliers: + results.append("point five") + else: + results.append("and a half") + + s = " ".join(results) + + # put a space at number/letter boundary + s = re.sub(r"([a-z])([0-9])", r"\1 \2", s) + s = re.sub(r"([0-9])([a-z])", r"\1 \2", s) + + # but remove spaces which could be a suffix + s = re.sub(r"([0-9])\s+(st|nd|rd|th|s)\b", r"\1\2", s) + + return s + + def postprocess(self, s: str): + def combine_cents(m: Match): + try: + currency = m.group(1) + integer = m.group(2) + cents = int(m.group(3)) + return f"{currency}{integer}.{cents:02d}" + except ValueError: + return m.string + + def extract_cents(m: Match): + try: + return f"¢{int(m.group(1))}" + except ValueError: + return m.string + + # apply currency postprocessing; "$2 and ¢7" -> "$2.07" + s = re.sub(r"([€£$])([0-9]+) (?:and )?¢([0-9]{1,2})\b", combine_cents, s) + s = re.sub(r"[€£$]0.([0-9]{1,2})\b", extract_cents, s) + + # write "one(s)" instead of "1(s)", just for the readability + s = re.sub(r"\b1(s?)\b", r"one\1", s) + + return s + + def __call__(self, s: str): + s = self.preprocess(s) + s = " ".join(word for word in self.process_words(s.split()) if word is not None) + s = self.postprocess(s) + + return s + + +class EnglishSpellingNormalizer: + """ + Applies British-American spelling mappings as listed in [1]. + + [1] https://www.tysto.com/uk-us-spelling-list.html + """ + + def __init__(self): + mapping_path = os.path.join(os.path.dirname(__file__), "english.json") + self.mapping = json.load(open(mapping_path)) + + def __call__(self, s: str): + return " ".join(self.mapping.get(word, word) for word in s.split()) + + +class EnglishTextNormalizer: + def __init__(self): + self.ignore_patterns = r"\b(hmm|mm|mhm|mmm|uh|um)\b" + self.replacers = { + # common contractions + r"\bwon't\b": "will not", + r"\bcan't\b": "can not", + r"\blet's\b": "let us", + r"\bain't\b": "aint", + r"\by'all\b": "you all", + r"\bwanna\b": "want to", + r"\bgotta\b": "got to", + r"\bgonna\b": "going to", + r"\bi'ma\b": "i am going to", + r"\bimma\b": "i am going to", + r"\bwoulda\b": "would have", + r"\bcoulda\b": "could have", + r"\bshoulda\b": "should have", + r"\bma'am\b": "madam", + # contractions in titles/prefixes + r"\bmr\b": "mister ", + r"\bmrs\b": "missus ", + r"\bst\b": "saint ", + r"\bdr\b": "doctor ", + r"\bprof\b": "professor ", + r"\bcapt\b": "captain ", + r"\bgov\b": "governor ", + r"\bald\b": "alderman ", + r"\bgen\b": "general ", + r"\bsen\b": "senator ", + r"\brep\b": "representative ", + r"\bpres\b": "president ", + r"\brev\b": "reverend ", + r"\bhon\b": "honorable ", + r"\basst\b": "assistant ", + r"\bassoc\b": "associate ", + r"\blt\b": "lieutenant ", + r"\bcol\b": "colonel ", + r"\bjr\b": "junior ", + r"\bsr\b": "senior ", + r"\besq\b": "esquire ", + # prefect tenses, ideally it should be any past participles, but it's harder.. + r"'d been\b": " had been", + r"'s been\b": " has been", + r"'d gone\b": " had gone", + r"'s gone\b": " has gone", + r"'d done\b": " had done", # "'s done" is ambiguous + r"'s got\b": " has got", + # general contractions + r"n't\b": " not", + r"'re\b": " are", + r"'s\b": " is", + r"'d\b": " would", + r"'ll\b": " will", + r"'t\b": " not", + r"'ve\b": " have", + r"'m\b": " am", + } + self.standardize_numbers = EnglishNumberNormalizer() + self.standardize_spellings = EnglishSpellingNormalizer() + + def __call__(self, s: str): + s = s.lower() + + s = re.sub(r"[<\[][^>\]]*[>\]]", "", s) # remove words between brackets + s = re.sub(r"\(([^)]+?)\)", "", s) # remove words between parenthesis + s = re.sub(self.ignore_patterns, "", s) + s = re.sub(r"\s+'", "'", s) # when there's a space before an apostrophe + + for pattern, replacement in self.replacers.items(): + s = re.sub(pattern, replacement, s) + + s = re.sub(r"(\d),(\d)", r"\1\2", s) # remove commas between digits + s = re.sub(r"\.([^0-9]|$)", r" \1", s) # remove periods not followed by numbers + s = remove_symbols_and_diacritics(s, keep=".%$¢€£") # keep numeric symbols + + s = self.standardize_numbers(s) + s = self.standardize_spellings(s) + + # now remove prefix/suffix symbols that are not preceded/followed by numbers + s = re.sub(r"[.$¢€£]([^0-9])", r" \1", s) + s = re.sub(r"([^0-9])%", r"\1 ", s) + + s = re.sub(r"\s+", " ", s) # replace any successive whitespaces with a space + + return s diff --git a/funasr/models/sense_voice/whisper_lib/timing.py b/funasr/models/sense_voice/whisper_lib/timing.py new file mode 100644 index 0000000..ba9cb13 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/timing.py @@ -0,0 +1,362 @@ +import itertools +import subprocess +import warnings +from dataclasses import dataclass +from typing import TYPE_CHECKING, List + +import numba +import numpy as np +import torch +import torch.nn.functional as F + +from .audio import HOP_LENGTH, SAMPLE_RATE, TOKENS_PER_SECOND +from .tokenizer import Tokenizer + +if TYPE_CHECKING: + from .model import Whisper + + +def median_filter(x: torch.Tensor, filter_width: int): + """Apply a median filter of width `filter_width` along the last dimension of `x`""" + pad_width = filter_width // 2 + if x.shape[-1] <= pad_width: + # F.pad requires the padding width to be smaller than the input dimension + return x + + if (ndim := x.ndim) <= 2: + # `F.pad` does not support 1D or 2D inputs for reflect padding but supports 3D and 4D + x = x[None, None, :] + + assert filter_width > 0 and filter_width % 2 == 1, "`filter_width` should be an odd number" + + result = None + x = F.pad(x, (filter_width // 2, filter_width // 2, 0, 0), mode="reflect") + if x.is_cuda: + try: + from .triton_ops import median_filter_cuda + + result = median_filter_cuda(x, filter_width) + except (RuntimeError, subprocess.CalledProcessError): + warnings.warn( + "Failed to launch Triton kernels, likely due to missing CUDA toolkit; " + "falling back to a slower median kernel implementation..." + ) + + if result is None: + # sort() is faster than torch.median (https://github.com/pytorch/pytorch/issues/51450) + result = x.unfold(-1, filter_width, 1).sort()[0][..., filter_width // 2] + + if ndim <= 2: + result = result[0, 0] + + return result + + +@numba.jit(nopython=True) +def backtrace(trace: np.ndarray): + i = trace.shape[0] - 1 + j = trace.shape[1] - 1 + trace[0, :] = 2 + trace[:, 0] = 1 + + result = [] + while i > 0 or j > 0: + result.append((i - 1, j - 1)) + + if trace[i, j] == 0: + i -= 1 + j -= 1 + elif trace[i, j] == 1: + i -= 1 + elif trace[i, j] == 2: + j -= 1 + else: + raise ValueError("Unexpected trace[i, j]") + + result = np.array(result) + return result[::-1, :].T + + +@numba.jit(nopython=True, parallel=True) +def dtw_cpu(x: np.ndarray): + N, M = x.shape + cost = np.ones((N + 1, M + 1), dtype=np.float32) * np.inf + trace = -np.ones((N + 1, M + 1), dtype=np.float32) + + cost[0, 0] = 0 + for j in range(1, M + 1): + for i in range(1, N + 1): + c0 = cost[i - 1, j - 1] + c1 = cost[i - 1, j] + c2 = cost[i, j - 1] + + if c0 < c1 and c0 < c2: + c, t = c0, 0 + elif c1 < c0 and c1 < c2: + c, t = c1, 1 + else: + c, t = c2, 2 + + cost[i, j] = x[i - 1, j - 1] + c + trace[i, j] = t + + return backtrace(trace) + + +def dtw_cuda(x, BLOCK_SIZE=1024): + from .triton_ops import dtw_kernel + + M, N = x.shape + assert M < BLOCK_SIZE, f"M should be smaller than {BLOCK_SIZE=}" + + x_skew = F.pad(x, (0, M + 1), value=np.inf).flatten()[: M * (N + M)].reshape(M, N + M) + x_skew = x_skew.T.contiguous() + cost = torch.ones(N + M + 2, M + 2) * np.inf + cost[0, 0] = 0 + cost = cost.cuda() + trace = torch.zeros_like(cost, dtype=torch.int32) + + dtw_kernel[(1,)]( + cost, + trace, + x_skew, + x_skew.stride(0), + cost.stride(0), + trace.stride(0), + N, + M, + BLOCK_SIZE=BLOCK_SIZE, + ) + + trace = trace.T.flatten()[: (M + 1) * (M + N + 3)].reshape(M + 1, M + N + 3)[:, : N + 1] + return backtrace(trace.cpu().numpy()) + + +def dtw(x: torch.Tensor) -> np.ndarray: + if x.is_cuda: + try: + return dtw_cuda(x) + except (RuntimeError, subprocess.CalledProcessError): + warnings.warn( + "Failed to launch Triton kernels, likely due to missing CUDA toolkit; " + "falling back to a slower DTW implementation..." + ) + + return dtw_cpu(x.double().cpu().numpy()) + + +@dataclass +class WordTiming: + word: str + tokens: List[int] + start: float + end: float + probability: float + + +def find_alignment( + model: "Whisper", + tokenizer: Tokenizer, + text_tokens: List[int], + mel: torch.Tensor, + num_frames: int, + *, + medfilt_width: int = 7, + qk_scale: float = 1.0, +) -> List[WordTiming]: + if len(text_tokens) == 0: + return [] + + tokens = torch.tensor( + [ + *tokenizer.sot_sequence, + tokenizer.no_timestamps, + *text_tokens, + tokenizer.eot, + ] + ).to(model.device) + + # install hooks on the cross attention layers to retrieve the attention weights + QKs = [None] * model.dims.n_text_layer + hooks = [ + block.cross_attn.register_forward_hook( + lambda _, ins, outs, index=i: QKs.__setitem__(index, outs[-1][0]) + ) + for i, block in enumerate(model.decoder.blocks) + ] + + with torch.no_grad(): + logits = model(mel.unsqueeze(0), tokens.unsqueeze(0))[0] + sampled_logits = logits[len(tokenizer.sot_sequence) :, : tokenizer.eot] + token_probs = sampled_logits.softmax(dim=-1) + text_token_probs = token_probs[np.arange(len(text_tokens)), text_tokens] + text_token_probs = text_token_probs.tolist() + + for hook in hooks: + hook.remove() + + # heads * tokens * frames + weights = torch.stack([QKs[_l][_h] for _l, _h in model.alignment_heads.indices().T]) + weights = weights[:, :, : num_frames // 2] + weights = (weights * qk_scale).softmax(dim=-1) + std, mean = torch.std_mean(weights, dim=-2, keepdim=True, unbiased=False) + weights = (weights - mean) / std + weights = median_filter(weights, medfilt_width) + + matrix = weights.mean(axis=0) + matrix = matrix[len(tokenizer.sot_sequence) : -1] + text_indices, time_indices = dtw(-matrix) + + words, word_tokens = tokenizer.split_to_word_tokens(text_tokens + [tokenizer.eot]) + if len(word_tokens) <= 1: + # return on eot only + # >>> np.pad([], (1, 0)) + # array([0.]) + # This results in crashes when we lookup jump_times with float, like + # IndexError: arrays used as indices must be of integer (or boolean) type + return [] + word_boundaries = np.pad(np.cumsum([len(t) for t in word_tokens[:-1]]), (1, 0)) + + jumps = np.pad(np.diff(text_indices), (1, 0), constant_values=1).astype(bool) + jump_times = time_indices[jumps] / TOKENS_PER_SECOND + start_times = jump_times[word_boundaries[:-1]] + end_times = jump_times[word_boundaries[1:]] + word_probabilities = [ + np.mean(text_token_probs[i:j]) for i, j in zip(word_boundaries[:-1], word_boundaries[1:]) + ] + + return [ + WordTiming(word, tokens, start, end, probability) + for word, tokens, start, end, probability in zip( + words, word_tokens, start_times, end_times, word_probabilities + ) + ] + + +def merge_punctuations(alignment: List[WordTiming], prepended: str, appended: str): + # merge prepended punctuations + i = len(alignment) - 2 + j = len(alignment) - 1 + while i >= 0: + previous = alignment[i] + following = alignment[j] + if previous.word.startswith(" ") and previous.word.strip() in prepended: + # prepend it to the following word + following.word = previous.word + following.word + following.tokens = previous.tokens + following.tokens + previous.word = "" + previous.tokens = [] + else: + j = i + i -= 1 + + # merge appended punctuations + i = 0 + j = 1 + while j < len(alignment): + previous = alignment[i] + following = alignment[j] + if not previous.word.endswith(" ") and following.word in appended: + # append it to the previous word + previous.word = previous.word + following.word + previous.tokens = previous.tokens + following.tokens + following.word = "" + following.tokens = [] + else: + i = j + j += 1 + + +def add_word_timestamps( + *, + segments: List[dict], + model: "Whisper", + tokenizer: Tokenizer, + mel: torch.Tensor, + num_frames: int, + prepend_punctuations: str = "\"'“¿([{-", + append_punctuations: str = "\"'.。,,!!??::”)]}、", + last_speech_timestamp: float, + **kwargs, +): + if len(segments) == 0: + return + + text_tokens_per_segment = [ + [token for token in segment["tokens"] if token < tokenizer.eot] for segment in segments + ] + + text_tokens = list(itertools.chain.from_iterable(text_tokens_per_segment)) + alignment = find_alignment(model, tokenizer, text_tokens, mel, num_frames, **kwargs) + word_durations = np.array([t.end - t.start for t in alignment]) + word_durations = word_durations[word_durations.nonzero()] + median_duration = np.median(word_durations) if len(word_durations) > 0 else 0.0 + median_duration = min(0.7, float(median_duration)) + max_duration = median_duration * 2 + + # hack: truncate long words at sentence boundaries. + # a better segmentation algorithm based on VAD should be able to replace this. + if len(word_durations) > 0: + sentence_end_marks = ".。!!??" + # ensure words at sentence boundaries are not longer than twice the median word duration. + for i in range(1, len(alignment)): + if alignment[i].end - alignment[i].start > max_duration: + if alignment[i].word in sentence_end_marks: + alignment[i].end = alignment[i].start + max_duration + elif alignment[i - 1].word in sentence_end_marks: + alignment[i].start = alignment[i].end - max_duration + + merge_punctuations(alignment, prepend_punctuations, append_punctuations) + + time_offset = segments[0]["seek"] * HOP_LENGTH / SAMPLE_RATE + word_index = 0 + + for segment, text_tokens in zip(segments, text_tokens_per_segment): + saved_tokens = 0 + words = [] + + while word_index < len(alignment) and saved_tokens < len(text_tokens): + timing = alignment[word_index] + + if timing.word: + words.append( + dict( + word=timing.word, + start=round(time_offset + timing.start, 2), + end=round(time_offset + timing.end, 2), + probability=timing.probability, + ) + ) + + saved_tokens += len(timing.tokens) + word_index += 1 + + # hack: truncate long words at segment boundaries. + # a better segmentation algorithm based on VAD should be able to replace this. + if len(words) > 0: + # ensure the first and second word after a pause is not longer than + # twice the median word duration. + if words[0]["end"] - last_speech_timestamp > median_duration * 4 and ( + words[0]["end"] - words[0]["start"] > max_duration + or (len(words) > 1 and words[1]["end"] - words[0]["start"] > max_duration * 2) + ): + if len(words) > 1 and words[1]["end"] - words[1]["start"] > max_duration: + boundary = max(words[1]["end"] / 2, words[1]["end"] - max_duration) + words[0]["end"] = words[1]["start"] = boundary + words[0]["start"] = max(0, words[0]["end"] - max_duration) + + # prefer the segment-level start timestamp if the first word is too long. + if segment["start"] < words[0]["end"] and segment["start"] - 0.5 > words[0]["start"]: + words[0]["start"] = max(0, min(words[0]["end"] - median_duration, segment["start"])) + else: + segment["start"] = words[0]["start"] + + # prefer the segment-level end timestamp if the last word is too long. + if segment["end"] > words[-1]["start"] and segment["end"] + 0.5 < words[-1]["end"]: + words[-1]["end"] = max(words[-1]["start"] + median_duration, segment["end"]) + else: + segment["end"] = words[-1]["end"] + + last_speech_timestamp = segment["end"] + + segment["words"] = words diff --git a/funasr/models/sense_voice/whisper_lib/tokenizer.py b/funasr/models/sense_voice/whisper_lib/tokenizer.py new file mode 100644 index 0000000..5b276c2 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/tokenizer.py @@ -0,0 +1,456 @@ +import base64 +import os +import string +from dataclasses import dataclass, field +from functools import cached_property, lru_cache +from typing import Dict, List, Optional, Tuple + +import tiktoken + +# FIX(funasr): sense vocie +LANGUAGES = { + "en": "english", + "zh": "chinese", + "de": "german", + "es": "spanish", + "ru": "russian", + "ko": "korean", + "fr": "french", + "ja": "japanese", + "pt": "portuguese", + "tr": "turkish", + "pl": "polish", + "ca": "catalan", + "nl": "dutch", + "ar": "arabic", + "sv": "swedish", + "it": "italian", + "id": "indonesian", + "hi": "hindi", + "fi": "finnish", + "vi": "vietnamese", + "he": "hebrew", + "uk": "ukrainian", + "el": "greek", + "ms": "malay", + "cs": "czech", + "ro": "romanian", + "da": "danish", + "hu": "hungarian", + "ta": "tamil", + "no": "norwegian", + "th": "thai", + "ur": "urdu", + "hr": "croatian", + "bg": "bulgarian", + "lt": "lithuanian", + "la": "latin", + "mi": "maori", + "ml": "malayalam", + "cy": "welsh", + "sk": "slovak", + "te": "telugu", + "fa": "persian", + "lv": "latvian", + "bn": "bengali", + "sr": "serbian", + "az": "azerbaijani", + "sl": "slovenian", + "kn": "kannada", + "et": "estonian", + "mk": "macedonian", + "br": "breton", + "eu": "basque", + "is": "icelandic", + "hy": "armenian", + "ne": "nepali", + "mn": "mongolian", + "bs": "bosnian", + "kk": "kazakh", + "sq": "albanian", + "sw": "swahili", + "gl": "galician", + "mr": "marathi", + "pa": "punjabi", + "si": "sinhala", + "km": "khmer", + "sn": "shona", + "yo": "yoruba", + "so": "somali", + "af": "afrikaans", + "oc": "occitan", + "ka": "georgian", + "be": "belarusian", + "tg": "tajik", + "sd": "sindhi", + "gu": "gujarati", + "am": "amharic", + "yi": "yiddish", + "lo": "lao", + "uz": "uzbek", + "fo": "faroese", + "ht": "haitian creole", + "ps": "pashto", + "tk": "turkmen", + "nn": "nynorsk", + "mt": "maltese", + "sa": "sanskrit", + "lb": "luxembourgish", + "my": "myanmar", + "bo": "tibetan", + "tl": "tagalog", + "mg": "malagasy", + "as": "assamese", + "tt": "tatar", + "haw": "hawaiian", + "ln": "lingala", + "ha": "hausa", + "ba": "bashkir", + "jw": "javanese", + "su": "sundanese", + "yue": "cantonese", + "minnan": "minnan", + "wuyu": "wuyu", + "dialect": "dialect", + "zh/en": "zh/en", + "en/zh": "en/zh", +} + +# language code lookup by name, with a few language aliases +TO_LANGUAGE_CODE = { + **{language: code for code, language in LANGUAGES.items()}, + "burmese": "my", + "valencian": "ca", + "flemish": "nl", + "haitian": "ht", + "letzeburgesch": "lb", + "pushto": "ps", + "panjabi": "pa", + "moldavian": "ro", + "moldovan": "ro", + "sinhalese": "si", + "castilian": "es", + "mandarin": "zh", +} + +# FIX(funasr): sense vocie +AUDIO_EVENT = { + "ASR": "ASR", + "AED": "AED", + "SER": "SER", + "Speech": "Speech", + "/Speech": "/Speech", + "BGM": "BGM", + "/BGM": "/BGM", + "Laughter": "Laughter", + "/Laughter": "/Laughter", + "Applause": "Applause", + "/Applause": "/Applause", +} + +EMOTION = { + "HAPPY": "HAPPY", + "SAD": "SAD", + "ANGRY": "ANGRY", + "NEUTRAL": "NEUTRAL", +} + + +@dataclass +class Tokenizer: + """A thin wrapper around `tiktoken` providing quick access to special tokens""" + + encoding: tiktoken.Encoding + num_languages: int + language: Optional[str] = None + task: Optional[str] = None + sot_sequence: Tuple[int] = () + special_tokens: Dict[str, int] = field(default_factory=dict) + + def __post_init__(self): + for special in self.encoding.special_tokens_set: + special_token = self.encoding.encode_single_token(special) + self.special_tokens[special] = special_token + + sot: int = self.special_tokens["<|startoftranscript|>"] + translate: int = self.special_tokens["<|translate|>"] + transcribe: int = self.special_tokens["<|transcribe|>"] + + langs = tuple(LANGUAGES.keys())[: self.num_languages] + sot_sequence = [sot] + if self.language is not None: + if self.language == "nospeech": + sot_sequence.append(self.no_speech) + else: + sot_sequence.append(sot + 1 + langs.index(self.language)) + # if self.language is not None: + # sot_sequence.append(sot + 1 + langs.index(self.language)) + if self.task is not None: + task_token: int = transcribe if self.task == "transcribe" else translate + sot_sequence.append(task_token) + + self.sot_sequence = tuple(sot_sequence) + + def encode(self, text, **kwargs): + return self.encoding.encode(text, **kwargs) + + def decode(self, token_ids: List[int], **kwargs) -> str: + token_ids = [t for t in token_ids if t < self.timestamp_begin] + return self.encoding.decode(token_ids, **kwargs) + + def decode_with_timestamps(self, token_ids: List[int], **kwargs) -> str: + """ + Timestamp tokens are above other special tokens' id range and are ignored by `decode()`. + This method decodes given tokens with timestamps tokens annotated, e.g. "<|1.08|>". + """ + return self.encoding.decode(token_ids, **kwargs) + + def get_vocab_size(self) -> int: + return self.encoding.n_vocab + + @cached_property + def eot(self) -> int: + return self.encoding.eot_token + + @cached_property + def transcribe(self) -> int: + return self.special_tokens["<|transcribe|>"] + + @cached_property + def translate(self) -> int: + return self.special_tokens["<|translate|>"] + + @cached_property + def sot(self) -> int: + return self.special_tokens["<|startoftranscript|>"] + + @cached_property + def sot_sense(self) -> int: + return self.special_tokens["<|startoftranscript|>"] + + @cached_property + def sot_lm(self) -> int: + return self.special_tokens["<|startoflm|>"] + + @cached_property + def sot_prev(self) -> int: + return self.special_tokens["<|startofprev|>"] + + @cached_property + def no_speech(self) -> int: + return self.special_tokens["<|nospeech|>"] + + @cached_property + def no_timestamps(self) -> int: + return self.special_tokens["<|notimestamps|>"] + + @cached_property + def timestamp_begin(self) -> int: + return self.special_tokens["<|0.00|>"] + + @cached_property + def language_token(self) -> int: + """Returns the token id corresponding to the value of the `language` field""" + if self.language is None: + raise ValueError("This tokenizer does not have language token configured") + + return self.to_language_token(self.language) + + def to_language_token(self, language): + if token := self.special_tokens.get(f"<|{language}|>", None): + return token + + raise KeyError(f"Language {language} not found in tokenizer.") + + @cached_property + def all_language_tokens(self) -> Tuple[int]: + result = [] + for token, token_id in self.special_tokens.items(): + if token.strip("<|>") in LANGUAGES: + result.append(token_id) + return tuple(result)[: self.num_languages] + + @cached_property + def all_language_codes(self) -> Tuple[str]: + return tuple(self.decode([_l]).strip("<|>") for _l in self.all_language_tokens) + + @cached_property + def sot_sequence_including_notimestamps(self) -> Tuple[int]: + return tuple(list(self.sot_sequence) + [self.no_timestamps]) + + @cached_property + def non_speech_tokens(self) -> Tuple[int]: + """ + Returns the list of tokens to suppress in order to avoid any speaker tags or non-speech + annotations, to prevent sampling texts that are not actually spoken in the audio, e.g. + + - ♪♪♪ + - ( SPEAKING FOREIGN LANGUAGE ) + - [DAVID] Hey there, + + keeping basic punctuations like commas, periods, question marks, exclamation points, etc. + """ + symbols = list('"#()*+/:;<=>@[\\]^_`{|}~「」『』') + symbols += "<< >> <<< >>> -- --- -( -[ (' (\" (( )) ((( ))) [[ ]] {{ }} ♪♪ ♪♪♪".split() + + # symbols that may be a single token or multiple tokens depending on the tokenizer. + # In case they're multiple tokens, suppress the first token, which is safe because: + # These are between U+2640 and U+267F miscellaneous symbols that are okay to suppress + # in generations, and in the 3-byte UTF-8 representation they share the first two bytes. + miscellaneous = set("♩♪♫♬♭♮♯") + assert all(0x2640 <= ord(c) <= 0x267F for c in miscellaneous) + + # allow hyphens "-" and single quotes "'" between words, but not at the beginning of a word + result = {self.encoding.encode(" -")[0], self.encoding.encode(" '")[0]} + for symbol in symbols + list(miscellaneous): + for tokens in [ + self.encoding.encode(symbol), + self.encoding.encode(" " + symbol), + ]: + if len(tokens) == 1 or symbol in miscellaneous: + result.add(tokens[0]) + + return tuple(sorted(result)) + + def split_to_word_tokens(self, tokens: List[int]): + if self.language in {"zh", "ja", "th", "lo", "my", "yue"}: + # These languages don't typically use spaces, so it is difficult to split words + # without morpheme analysis. Here, we instead split words at any + # position where the tokens are decoded as valid unicode points + return self.split_tokens_on_unicode(tokens) + + return self.split_tokens_on_spaces(tokens) + + def split_tokens_on_unicode(self, tokens: List[int]): + decoded_full = self.decode_with_timestamps(tokens) + replacement_char = "\ufffd" + + words = [] + word_tokens = [] + current_tokens = [] + unicode_offset = 0 + + for token in tokens: + current_tokens.append(token) + decoded = self.decode_with_timestamps(current_tokens) + + if ( + replacement_char not in decoded + or decoded_full[unicode_offset + decoded.index(replacement_char)] + == replacement_char + ): + words.append(decoded) + word_tokens.append(current_tokens) + current_tokens = [] + unicode_offset += len(decoded) + + return words, word_tokens + + def split_tokens_on_spaces(self, tokens: List[int]): + subwords, subword_tokens_list = self.split_tokens_on_unicode(tokens) + words = [] + word_tokens = [] + + for subword, subword_tokens in zip(subwords, subword_tokens_list): + special = subword_tokens[0] >= self.eot + with_space = subword.startswith(" ") + punctuation = subword.strip() in string.punctuation + if special or with_space or punctuation or len(words) == 0: + words.append(subword) + word_tokens.append(subword_tokens) + else: + words[-1] = words[-1] + subword + word_tokens[-1].extend(subword_tokens) + + return words, word_tokens + + +@lru_cache(maxsize=None) +def get_encoding(name: str = "gpt2", num_languages: int = 99, vocab_path: str = None): + if vocab_path is None: + vocab_path = os.path.join(os.path.dirname(__file__), "assets", f"{name}.tiktoken") + + ranks = { + base64.b64decode(token): int(rank) + for token, rank in (line.split() for line in open(vocab_path) if line) + } + n_vocab = len(ranks) + special_tokens = {} + + if False: # name == "gpt2" or name == "multilingual": + specials = [ + "<|endoftext|>", + "<|startoftranscript|>", + *[f"<|{lang}|>" for lang in list(LANGUAGES.keys())[:num_languages]], + "<|translate|>", + "<|transcribe|>", + "<|startoflm|>", + "<|startofprev|>", + "<|nospeech|>", + "<|notimestamps|>", + *[f"<|{i * 0.02:.2f}|>" for i in range(1501)], + ] + else: + specials = [ + "<|endoftext|>", + "<|startoftranscript|>", + *[f"<|{lang}|>" for lang in list(LANGUAGES.keys())[:num_languages]], + *[f"<|{audio_event}|>" for audio_event in list(AUDIO_EVENT.keys())], + *[f"<|{emotion}|>" for emotion in list(EMOTION.keys())], + "<|translate|>", + "<|transcribe|>", + "<|startoflm|>", + "<|startofprev|>", + "<|nospeech|>", + "<|notimestamps|>", + *[f"<|SPECIAL_TOKEN_{i}|>" for i in range(1, 51)], + *[f"<|{i * 0.02:.2f}|>" for i in range(1501)], + ] + + for token in specials: + special_tokens[token] = n_vocab + n_vocab += 1 + + return tiktoken.Encoding( + name=os.path.basename(vocab_path), + explicit_n_vocab=n_vocab, + pat_str=r"""'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+""", + mergeable_ranks=ranks, + special_tokens=special_tokens, + ) + + +@lru_cache(maxsize=None) +def get_tokenizer( + multilingual: bool, + *, + num_languages: int = 99, + language: Optional[str] = None, + task: Optional[str] = None, # Literal["transcribe", "translate", None] + encoding_path: Optional[str] = None, + vocab_path: Optional[str] = None, +) -> Tokenizer: + if language is not None: + language = language.lower() + if language not in LANGUAGES: + if language in TO_LANGUAGE_CODE: + language = TO_LANGUAGE_CODE[language] + elif language == "nospeech": + pass + else: + raise ValueError(f"Unsupported language: {language}") + + if multilingual: + encoding_name = "multilingual" + language = language or "en" + task = task or "transcribe" + else: + encoding_name = "gpt2" + language = None + task = None + if encoding_path is not None: + encoding_name = encoding_path + + encoding = get_encoding(name=encoding_name, num_languages=num_languages, vocab_path=vocab_path) + + return Tokenizer(encoding=encoding, num_languages=num_languages, language=language, task=task) diff --git a/funasr/models/sense_voice/whisper_lib/transcribe.py b/funasr/models/sense_voice/whisper_lib/transcribe.py new file mode 100644 index 0000000..5c5f49d --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/transcribe.py @@ -0,0 +1,573 @@ +import argparse +import os +import traceback +import warnings +from typing import TYPE_CHECKING, List, Optional, Tuple, Union + +import numpy as np +import torch +import tqdm + +from .audio import ( + FRAMES_PER_SECOND, + HOP_LENGTH, + N_FRAMES, + N_SAMPLES, + SAMPLE_RATE, + log_mel_spectrogram, + pad_or_trim, +) +from .decoding import DecodingOptions, DecodingResult +from .timing import add_word_timestamps +from .tokenizer import LANGUAGES, TO_LANGUAGE_CODE, get_tokenizer +from .utils import ( + exact_div, + format_timestamp, + get_end, + get_writer, + make_safe, + optional_float, + optional_int, + str2bool, +) + +if TYPE_CHECKING: + from .model import Whisper + + +def transcribe( + model: "Whisper", + audio: Union[str, np.ndarray, torch.Tensor], + *, + verbose: Optional[bool] = None, + temperature: Union[float, Tuple[float, ...]] = (0.0, 0.2, 0.4, 0.6, 0.8, 1.0), + compression_ratio_threshold: Optional[float] = 2.4, + logprob_threshold: Optional[float] = -1.0, + no_speech_threshold: Optional[float] = 0.6, + condition_on_previous_text: bool = True, + initial_prompt: Optional[str] = None, + word_timestamps: bool = False, + prepend_punctuations: str = "\"'“¿([{-", + append_punctuations: str = "\"'.。,,!!??::”)]}、", + clip_timestamps: Union[str, List[float]] = "0", + hallucination_silence_threshold: Optional[float] = None, + **decode_options, +): + """ + Transcribe an audio file using Whisper + + Parameters + ---------- + model: Whisper + The Whisper model instance + + audio: Union[str, np.ndarray, torch.Tensor] + The path to the audio file to open, or the audio waveform + + verbose: bool + Whether to display the text being decoded to the console. If True, displays all the details, + If False, displays minimal details. If None, does not display anything + + temperature: Union[float, Tuple[float, ...]] + Temperature for sampling. It can be a tuple of temperatures, which will be successively used + upon failures according to either `compression_ratio_threshold` or `logprob_threshold`. + + compression_ratio_threshold: float + If the gzip compression ratio is above this value, treat as failed + + logprob_threshold: float + If the average log probability over sampled tokens is below this value, treat as failed + + no_speech_threshold: float + If the no_speech probability is higher than this value AND the average log probability + over sampled tokens is below `logprob_threshold`, consider the segment as silent + + condition_on_previous_text: bool + if True, the previous output of the model is provided as a prompt for the next window; + disabling may make the text inconsistent across windows, but the model becomes less prone to + getting stuck in a failure loop, such as repetition looping or timestamps going out of sync. + + word_timestamps: bool + Extract word-level timestamps using the cross-attention pattern and dynamic time warping, + and include the timestamps for each word in each segment. + + prepend_punctuations: str + If word_timestamps is True, merge these punctuation symbols with the next word + + append_punctuations: str + If word_timestamps is True, merge these punctuation symbols with the previous word + + initial_prompt: Optional[str] + Optional text to provide as a prompt for the first window. This can be used to provide, or + "prompt-engineer" a context for transcription, e.g. custom vocabularies or proper nouns + to make it more likely to predict those word correctly. + + decode_options: dict + Keyword arguments to construct `DecodingOptions` instances + + clip_timestamps: Union[str, List[float]] + Comma-separated list start,end,start,end,... timestamps (in seconds) of clips to process. + The last end timestamp defaults to the end of the file. + + hallucination_silence_threshold: Optional[float] + When word_timestamps is True, skip silent periods longer than this threshold (in seconds) + when a possible hallucination is detected + + Returns + ------- + A dictionary containing the resulting text ("text") and segment-level details ("segments"), and + the spoken language ("language"), which is detected when `decode_options["language"]` is None. + """ + dtype = torch.float16 if decode_options.get("fp16", True) else torch.float32 + if model.device == torch.device("cpu"): + if torch.cuda.is_available(): + warnings.warn("Performing inference on CPU when CUDA is available") + if dtype == torch.float16: + warnings.warn("FP16 is not supported on CPU; using FP32 instead") + dtype = torch.float32 + + if dtype == torch.float32: + decode_options["fp16"] = False + + # Pad 30-seconds of silence to the input audio, for slicing + mel = log_mel_spectrogram(audio, model.dims.n_mels, padding=N_SAMPLES) + content_frames = mel.shape[-1] - N_FRAMES + content_duration = float(content_frames * HOP_LENGTH / SAMPLE_RATE) + + if decode_options.get("language", None) is None: + if not model.is_multilingual: + decode_options["language"] = "en" + else: + if verbose: + print( + "Detecting language using up to the first 30 seconds. Use `--language` to specify the language" + ) + mel_segment = pad_or_trim(mel, N_FRAMES).to(model.device).to(dtype) + _, probs = model.detect_language(mel_segment) + decode_options["language"] = max(probs, key=probs.get) + if verbose is not None: + print(f"Detected language: {LANGUAGES[decode_options['language']].title()}") + + language: str = decode_options["language"] + task: str = decode_options.get("task", "transcribe") + tokenizer = get_tokenizer( + model.is_multilingual, + num_languages=model.num_languages, + language=language, + task=task, + ) + + if isinstance(clip_timestamps, str): + clip_timestamps = [ + float(ts) for ts in (clip_timestamps.split(",") if clip_timestamps else []) + ] + seek_points: List[int] = [round(ts * FRAMES_PER_SECOND) for ts in clip_timestamps] + if len(seek_points) == 0: + seek_points.append(0) + if len(seek_points) % 2 == 1: + seek_points.append(content_frames) + seek_clips: List[Tuple[int, int]] = list(zip(seek_points[::2], seek_points[1::2])) + + punctuation = "\"'“¿([{-\"'.。,,!!??::”)]}、" + + if word_timestamps and task == "translate": + warnings.warn("Word-level timestamps on translations may not be reliable.") + + def decode_with_fallback(segment: torch.Tensor) -> DecodingResult: + temperatures = [temperature] if isinstance(temperature, (int, float)) else temperature + decode_result = None + + for t in temperatures: + kwargs = {**decode_options} + if t > 0: + # disable beam_size and patience when t > 0 + kwargs.pop("beam_size", None) + kwargs.pop("patience", None) + else: + # disable best_of when t == 0 + kwargs.pop("best_of", None) + + options = DecodingOptions(**kwargs, temperature=t) + decode_result = model.decode(segment, options) + + needs_fallback = False + if ( + compression_ratio_threshold is not None + and decode_result.compression_ratio > compression_ratio_threshold + ): + needs_fallback = True # too repetitive + if logprob_threshold is not None and decode_result.avg_logprob < logprob_threshold: + needs_fallback = True # average log probability is too low + if ( + no_speech_threshold is not None + and decode_result.no_speech_prob > no_speech_threshold + ): + needs_fallback = False # silence + if not needs_fallback: + break + + return decode_result + + clip_idx = 0 + seek = seek_clips[clip_idx][0] + input_stride = exact_div(N_FRAMES, model.dims.n_audio_ctx) # mel frames per output token: 2 + time_precision = ( + input_stride * HOP_LENGTH / SAMPLE_RATE + ) # time per output token: 0.02 (seconds) + all_tokens = [] + all_segments = [] + prompt_reset_since = 0 + + if initial_prompt is not None: + initial_prompt_tokens = tokenizer.encode(" " + initial_prompt.strip()) + all_tokens.extend(initial_prompt_tokens) + else: + initial_prompt_tokens = [] + + def new_segment(*, start: float, end: float, tokens: torch.Tensor, result: DecodingResult): + tokens = tokens.tolist() + text_tokens = [token for token in tokens if token < tokenizer.eot] + return { + "seek": seek, + "start": start, + "end": end, + "text": tokenizer.decode(text_tokens), + "tokens": tokens, + "temperature": result.temperature, + "avg_logprob": result.avg_logprob, + "compression_ratio": result.compression_ratio, + "no_speech_prob": result.no_speech_prob, + } + + # show the progress bar when verbose is False (if True, transcribed text will be printed) + with tqdm.tqdm(total=content_frames, unit="frames", disable=verbose is not False) as pbar: + last_speech_timestamp = 0.0 + # NOTE: This loop is obscurely flattened to make the diff readable. + # A later commit should turn this into a simpler nested loop. + # for seek_clip_start, seek_clip_end in seek_clips: + # while seek < seek_clip_end + while clip_idx < len(seek_clips): + seek_clip_start, seek_clip_end = seek_clips[clip_idx] + if seek < seek_clip_start: + seek = seek_clip_start + if seek >= seek_clip_end: + clip_idx += 1 + if clip_idx < len(seek_clips): + seek = seek_clips[clip_idx][0] + continue + time_offset = float(seek * HOP_LENGTH / SAMPLE_RATE) + window_end_time = float((seek + N_FRAMES) * HOP_LENGTH / SAMPLE_RATE) + segment_size = min(N_FRAMES, content_frames - seek, seek_clip_end - seek) + mel_segment = mel[:, seek : seek + segment_size] + segment_duration = segment_size * HOP_LENGTH / SAMPLE_RATE + mel_segment = pad_or_trim(mel_segment, N_FRAMES).to(model.device).to(dtype) + + decode_options["prompt"] = all_tokens[prompt_reset_since:] + result: DecodingResult = decode_with_fallback(mel_segment) + tokens = torch.tensor(result.tokens) + + if no_speech_threshold is not None: + # no voice activity check + should_skip = result.no_speech_prob > no_speech_threshold + if logprob_threshold is not None and result.avg_logprob > logprob_threshold: + # don't skip if the logprob is high enough, despite the no_speech_prob + should_skip = False + + if should_skip: + seek += segment_size # fast-forward to the next segment boundary + continue + + previous_seek = seek + current_segments = [] + + # anomalous words are very long/short/improbable + def word_anomaly_score(word: dict) -> float: + probability = word.get("probability", 0.0) + duration = word["end"] - word["start"] + score = 0.0 + if probability < 0.15: + score += 1.0 + if duration < 0.133: + score += (0.133 - duration) * 15 + if duration > 2.0: + score += duration - 2.0 + return score + + def is_segment_anomaly(segment: Optional[dict]) -> bool: + if segment is None or not segment["words"]: + return False + words = [w for w in segment["words"] if w["word"] not in punctuation] + words = words[:8] + score = sum(word_anomaly_score(w) for w in words) + return score >= 3 or score + 0.01 >= len(words) + + def next_words_segment(segments: List[dict]) -> Optional[dict]: + return next((s for s in segments if s["words"]), None) + + timestamp_tokens: torch.Tensor = tokens.ge(tokenizer.timestamp_begin) + single_timestamp_ending = timestamp_tokens[-2:].tolist() == [False, True] + + consecutive = torch.where(timestamp_tokens[:-1] & timestamp_tokens[1:])[0] + consecutive.add_(1) + if len(consecutive) > 0: + # if the output contains two consecutive timestamp tokens + slices = consecutive.tolist() + if single_timestamp_ending: + slices.append(len(tokens)) + + last_slice = 0 + for current_slice in slices: + sliced_tokens = tokens[last_slice:current_slice] + start_timestamp_pos = sliced_tokens[0].item() - tokenizer.timestamp_begin + end_timestamp_pos = sliced_tokens[-1].item() - tokenizer.timestamp_begin + current_segments.append( + new_segment( + start=time_offset + start_timestamp_pos * time_precision, + end=time_offset + end_timestamp_pos * time_precision, + tokens=sliced_tokens, + result=result, + ) + ) + last_slice = current_slice + + if single_timestamp_ending: + # single timestamp at the end means no speech after the last timestamp. + seek += segment_size + else: + # otherwise, ignore the unfinished segment and seek to the last timestamp + last_timestamp_pos = tokens[last_slice - 1].item() - tokenizer.timestamp_begin + seek += last_timestamp_pos * input_stride + else: + duration = segment_duration + timestamps = tokens[timestamp_tokens.nonzero().flatten()] + if len(timestamps) > 0 and timestamps[-1].item() != tokenizer.timestamp_begin: + # no consecutive timestamps but it has a timestamp; use the last one. + last_timestamp_pos = timestamps[-1].item() - tokenizer.timestamp_begin + duration = last_timestamp_pos * time_precision + + current_segments.append( + new_segment( + start=time_offset, + end=time_offset + duration, + tokens=tokens, + result=result, + ) + ) + seek += segment_size + + if word_timestamps: + add_word_timestamps( + segments=current_segments, + model=model, + tokenizer=tokenizer, + mel=mel_segment, + num_frames=segment_size, + prepend_punctuations=prepend_punctuations, + append_punctuations=append_punctuations, + last_speech_timestamp=last_speech_timestamp, + ) + + if not single_timestamp_ending: + last_word_end = get_end(current_segments) + if last_word_end is not None and last_word_end > time_offset: + seek = round(last_word_end * FRAMES_PER_SECOND) + + # skip silence before possible hallucinations + if hallucination_silence_threshold is not None: + threshold = hallucination_silence_threshold + if not single_timestamp_ending: + last_word_end = get_end(current_segments) + if last_word_end is not None and last_word_end > time_offset: + remaining_duration = window_end_time - last_word_end + if remaining_duration > threshold: + seek = round(last_word_end * FRAMES_PER_SECOND) + else: + seek = previous_seek + segment_size + + # if first segment might be a hallucination, skip leading silence + first_segment = next_words_segment(current_segments) + if first_segment is not None and is_segment_anomaly(first_segment): + gap = first_segment["start"] - time_offset + if gap > threshold: + seek = previous_seek + round(gap * FRAMES_PER_SECOND) + continue + + # skip silence before any possible hallucination that is surrounded + # by silence or more hallucinations + hal_last_end = last_speech_timestamp + for si in range(len(current_segments)): + segment = current_segments[si] + if not segment["words"]: + continue + if is_segment_anomaly(segment): + next_segment = next_words_segment(current_segments[si + 1 :]) + if next_segment is not None: + hal_next_start = next_segment["words"][0]["start"] + else: + hal_next_start = time_offset + segment_duration + silence_before = ( + segment["start"] - hal_last_end > threshold + or segment["start"] < threshold + or segment["start"] - time_offset < 2.0 + ) + silence_after = ( + hal_next_start - segment["end"] > threshold + or is_segment_anomaly(next_segment) + or window_end_time - segment["end"] < 2.0 + ) + if silence_before and silence_after: + seek = round( + max(time_offset + 1, segment["start"]) * FRAMES_PER_SECOND + ) + if content_duration - segment["end"] < threshold: + seek = content_frames + current_segments[si:] = [] + break + hal_last_end = segment["end"] + + last_word_end = get_end(current_segments) + if last_word_end is not None: + last_speech_timestamp = last_word_end + + if verbose: + for segment in current_segments: + start, end, text = segment["start"], segment["end"], segment["text"] + line = f"[{format_timestamp(start)} --> {format_timestamp(end)}] {text}" + print(make_safe(line)) + + # if a segment is instantaneous or does not contain text, clear it + for i, segment in enumerate(current_segments): + if segment["start"] == segment["end"] or segment["text"].strip() == "": + segment["text"] = "" + segment["tokens"] = [] + segment["words"] = [] + + all_segments.extend( + [ + {"id": i, **segment} + for i, segment in enumerate(current_segments, start=len(all_segments)) + ] + ) + all_tokens.extend( + [token for segment in current_segments for token in segment["tokens"]] + ) + + if not condition_on_previous_text or result.temperature > 0.5: + # do not feed the prompt tokens if a high temperature was used + prompt_reset_since = len(all_tokens) + + # update progress bar + pbar.update(min(content_frames, seek) - previous_seek) + + return dict( + text=tokenizer.decode(all_tokens[len(initial_prompt_tokens) :]), + segments=all_segments, + language=language, + ) + + +def cli(): + from . import available_models + + def valid_model_name(name): + if name in available_models() or os.path.exists(name): + return name + raise ValueError( + f"model should be one of {available_models()} or path to a model checkpoint" + ) + + # fmt: off + parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument("audio", nargs="+", type=str, help="audio file(s) to transcribe") + parser.add_argument("--model", default="small", type=valid_model_name, help="name of the Whisper model to use") + parser.add_argument("--model_dir", type=str, default=None, help="the path to save model files; uses ~/.cache/whisper by default") + parser.add_argument("--device", default="cuda" if torch.cuda.is_available() else "cpu", help="device to use for PyTorch inference") + parser.add_argument("--output_dir", "-o", type=str, default=".", help="directory to save the outputs") + parser.add_argument("--output_format", "-f", type=str, default="all", choices=["txt", "vtt", "srt", "tsv", "json", "all"], help="format of the output file; if not specified, all available formats will be produced") + parser.add_argument("--verbose", type=str2bool, default=True, help="whether to print out the progress and debug messages") + + parser.add_argument("--task", type=str, default="transcribe", choices=["transcribe", "translate"], help="whether to perform X->X speech recognition ('transcribe') or X->English translation ('translate')") + parser.add_argument("--language", type=str, default=None, choices=sorted(LANGUAGES.keys()) + sorted([k.title() for k in TO_LANGUAGE_CODE.keys()]), help="language spoken in the audio, specify None to perform language detection") + + parser.add_argument("--temperature", type=float, default=0, help="temperature to use for sampling") + parser.add_argument("--best_of", type=optional_int, default=5, help="number of candidates when sampling with non-zero temperature") + parser.add_argument("--beam_size", type=optional_int, default=5, help="number of beams in beam search, only applicable when temperature is zero") + parser.add_argument("--patience", type=float, default=None, help="optional patience value to use in beam decoding, as in https://arxiv.org/abs/2204.05424, the default (1.0) is equivalent to conventional beam search") + parser.add_argument("--length_penalty", type=float, default=None, help="optional token length penalty coefficient (alpha) as in https://arxiv.org/abs/1609.08144, uses simple length normalization by default") + + parser.add_argument("--suppress_tokens", type=str, default="-1", help="comma-separated list of token ids to suppress during sampling; '-1' will suppress most special characters except common punctuations") + parser.add_argument("--initial_prompt", type=str, default=None, help="optional text to provide as a prompt for the first window.") + parser.add_argument("--condition_on_previous_text", type=str2bool, default=True, help="if True, provide the previous output of the model as a prompt for the next window; disabling may make the text inconsistent across windows, but the model becomes less prone to getting stuck in a failure loop") + parser.add_argument("--fp16", type=str2bool, default=True, help="whether to perform inference in fp16; True by default") + + parser.add_argument("--temperature_increment_on_fallback", type=optional_float, default=0.2, help="temperature to increase when falling back when the decoding fails to meet either of the thresholds below") + parser.add_argument("--compression_ratio_threshold", type=optional_float, default=2.4, help="if the gzip compression ratio is higher than this value, treat the decoding as failed") + parser.add_argument("--logprob_threshold", type=optional_float, default=-1.0, help="if the average log probability is lower than this value, treat the decoding as failed") + parser.add_argument("--no_speech_threshold", type=optional_float, default=0.6, help="if the probability of the <|nospeech|> token is higher than this value AND the decoding has failed due to `logprob_threshold`, consider the segment as silence") + parser.add_argument("--word_timestamps", type=str2bool, default=False, help="(experimental) extract word-level timestamps and refine the results based on them") + parser.add_argument("--prepend_punctuations", type=str, default="\"\'“¿([{-", help="if word_timestamps is True, merge these punctuation symbols with the next word") + parser.add_argument("--append_punctuations", type=str, default="\"\'.。,,!!??::”)]}、", help="if word_timestamps is True, merge these punctuation symbols with the previous word") + parser.add_argument("--highlight_words", type=str2bool, default=False, help="(requires --word_timestamps True) underline each word as it is spoken in srt and vtt") + parser.add_argument("--max_line_width", type=optional_int, default=None, help="(requires --word_timestamps True) the maximum number of characters in a line before breaking the line") + parser.add_argument("--max_line_count", type=optional_int, default=None, help="(requires --word_timestamps True) the maximum number of lines in a segment") + parser.add_argument("--max_words_per_line", type=optional_int, default=None, help="(requires --word_timestamps True, no effect with --max_line_width) the maximum number of words in a segment") + parser.add_argument("--threads", type=optional_int, default=0, help="number of threads used by torch for CPU inference; supercedes MKL_NUM_THREADS/OMP_NUM_THREADS") + parser.add_argument("--clip_timestamps", type=str, default="0", help="comma-separated list start,end,start,end,... timestamps (in seconds) of clips to process, where the last end timestamp defaults to the end of the file") + parser.add_argument("--hallucination_silence_threshold", type=optional_float, help="(requires --word_timestamps True) skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected") + # fmt: on + + args = parser.parse_args().__dict__ + model_name: str = args.pop("model") + model_dir: str = args.pop("model_dir") + output_dir: str = args.pop("output_dir") + output_format: str = args.pop("output_format") + device: str = args.pop("device") + os.makedirs(output_dir, exist_ok=True) + + if model_name.endswith(".en") and args["language"] not in {"en", "English"}: + if args["language"] is not None: + warnings.warn( + f"{model_name} is an English-only model but receipted '{args['language']}'; using English instead." + ) + args["language"] = "en" + + temperature = args.pop("temperature") + if (increment := args.pop("temperature_increment_on_fallback")) is not None: + temperature = tuple(np.arange(temperature, 1.0 + 1e-6, increment)) + else: + temperature = [temperature] + + if (threads := args.pop("threads")) > 0: + torch.set_num_threads(threads) + + from . import load_model + + model = load_model(model_name, device=device, download_root=model_dir) + + writer = get_writer(output_format, output_dir) + word_options = [ + "highlight_words", + "max_line_count", + "max_line_width", + "max_words_per_line", + ] + if not args["word_timestamps"]: + for option in word_options: + if args[option]: + parser.error(f"--{option} requires --word_timestamps True") + if args["max_line_count"] and not args["max_line_width"]: + warnings.warn("--max_line_count has no effect without --max_line_width") + if args["max_words_per_line"] and args["max_line_width"]: + warnings.warn("--max_words_per_line has no effect with --max_line_width") + writer_args = {arg: args.pop(arg) for arg in word_options} + for audio_path in args.pop("audio"): + try: + result = transcribe(model, audio_path, temperature=temperature, **args) + writer(result, audio_path, **writer_args) + except Exception as e: + traceback.print_exc() + print(f"Skipping {audio_path} due to {type(e).__name__}: {str(e)}") + + +if __name__ == "__main__": + cli() diff --git a/funasr/models/sense_voice/whisper_lib/triton_ops.py b/funasr/models/sense_voice/whisper_lib/triton_ops.py new file mode 100644 index 0000000..9919595 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/triton_ops.py @@ -0,0 +1,102 @@ +from functools import lru_cache + +import numpy as np +import torch + +try: + import triton + import triton.language as tl +except ImportError: + raise RuntimeError("triton import failed; try `pip install --pre triton`") + + +@triton.jit +def dtw_kernel(cost, trace, x, x_stride, cost_stride, trace_stride, N, M, BLOCK_SIZE: tl.constexpr): + offsets = tl.arange(0, BLOCK_SIZE) + mask = offsets < M + + for k in range(1, N + M + 1): # k = i + j + tl.debug_barrier() + + p0 = cost + (k - 1) * cost_stride + p1 = cost + k * cost_stride + p2 = cost + k * cost_stride + 1 + + c0 = tl.load(p0 + offsets, mask=mask) + c1 = tl.load(p1 + offsets, mask=mask) + c2 = tl.load(p2 + offsets, mask=mask) + + x_row = tl.load(x + (k - 1) * x_stride + offsets, mask=mask, other=0) + cost_row = x_row + tl.minimum(tl.minimum(c0, c1), c2) + + cost_ptr = cost + (k + 1) * cost_stride + 1 + tl.store(cost_ptr + offsets, cost_row, mask=mask) + + trace_ptr = trace + (k + 1) * trace_stride + 1 + tl.store(trace_ptr + offsets, 2, mask=mask & (c2 <= c0) & (c2 <= c1)) + tl.store(trace_ptr + offsets, 1, mask=mask & (c1 <= c0) & (c1 <= c2)) + tl.store(trace_ptr + offsets, 0, mask=mask & (c0 <= c1) & (c0 <= c2)) + + +@lru_cache(maxsize=None) +def median_kernel(filter_width: int): + @triton.jit + def kernel(y, x, x_stride, y_stride, BLOCK_SIZE: tl.constexpr): # x.shape[-1] == filter_width + row_idx = tl.program_id(0) + offsets = tl.arange(0, BLOCK_SIZE) + mask = offsets < y_stride + + x_ptr = x + row_idx * x_stride # noqa: F841 + y_ptr = y + row_idx * y_stride + + LOAD_ALL_ROWS_HERE # noqa: F821 + + BUBBLESORT_HERE # noqa: F821 + + tl.store(y_ptr + offsets, MIDDLE_ROW_HERE, mask=mask) # noqa: F821 + + kernel = triton.JITFunction(kernel.fn) + kernel.src = kernel.src.replace( + " LOAD_ALL_ROWS_HERE", + "\n".join( + [f" row{i} = tl.load(x_ptr + offsets + {i}, mask=mask)" for i in range(filter_width)] + ), + ) + kernel.src = kernel.src.replace( + " BUBBLESORT_HERE", + "\n\n".join( + [ + "\n\n".join( + [ + "\n".join( + [ + f" smaller = tl.where(row{j} < row{j + 1}, row{j}, row{j + 1})", + f" larger = tl.where(row{j} > row{j + 1}, row{j}, row{j + 1})", + f" row{j} = smaller", + f" row{j + 1} = larger", + ] + ) + for j in range(filter_width - i - 1) + ] + ) + for i in range(filter_width // 2 + 1) + ] + ), + ) + kernel.src = kernel.src.replace("MIDDLE_ROW_HERE", f"row{filter_width // 2}") + + return kernel + + +def median_filter_cuda(x: torch.Tensor, filter_width: int): + """Apply a median filter of given width along the last dimension of x""" + slices = x.contiguous().unfold(-1, filter_width, 1) + grid = np.prod(slices.shape[:-2]) + + kernel = median_kernel(filter_width) + y = torch.empty_like(slices[..., 0]) + + BLOCK_SIZE = 1 << (y.stride(-2) - 1).bit_length() + kernel[(grid,)](y, x, x.stride(-2), y.stride(-2), BLOCK_SIZE=BLOCK_SIZE) + + return y diff --git a/funasr/models/sense_voice/whisper_lib/utils.py b/funasr/models/sense_voice/whisper_lib/utils.py new file mode 100644 index 0000000..5fc6125 --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/utils.py @@ -0,0 +1,283 @@ +import json +import os +import re +import sys +import zlib +from typing import Callable, List, Optional, TextIO + +system_encoding = sys.getdefaultencoding() + +if system_encoding != "utf-8": + + def make_safe(string): + # replaces any character not representable using the system default encoding with an '?', + # avoiding UnicodeEncodeError (https://github.com/openai/whisper/discussions/729). + return string.encode(system_encoding, errors="replace").decode(system_encoding) + +else: + + def make_safe(string): + # utf-8 can encode any Unicode code point, so no need to do the round-trip encoding + return string + + +def exact_div(x, y): + assert x % y == 0 + return x // y + + +def str2bool(string): + str2val = {"True": True, "False": False} + if string in str2val: + return str2val[string] + else: + raise ValueError(f"Expected one of {set(str2val.keys())}, got {string}") + + +def optional_int(string): + return None if string == "None" else int(string) + + +def optional_float(string): + return None if string == "None" else float(string) + + +def compression_ratio(text) -> float: + text_bytes = text.encode("utf-8") + return len(text_bytes) / len(zlib.compress(text_bytes)) + + +def format_timestamp(seconds: float, always_include_hours: bool = False, decimal_marker: str = "."): + assert seconds >= 0, "non-negative timestamp expected" + milliseconds = round(seconds * 1000.0) + + hours = milliseconds // 3_600_000 + milliseconds -= hours * 3_600_000 + + minutes = milliseconds // 60_000 + milliseconds -= minutes * 60_000 + + seconds = milliseconds // 1_000 + milliseconds -= seconds * 1_000 + + hours_marker = f"{hours:02d}:" if always_include_hours or hours > 0 else "" + return f"{hours_marker}{minutes:02d}:{seconds:02d}{decimal_marker}{milliseconds:03d}" + + +def get_start(segments: List[dict]) -> Optional[float]: + return next( + (w["start"] for s in segments for w in s["words"]), + segments[0]["start"] if segments else None, + ) + + +def get_end(segments: List[dict]) -> Optional[float]: + return next( + (w["end"] for s in reversed(segments) for w in reversed(s["words"])), + segments[-1]["end"] if segments else None, + ) + + +class ResultWriter: + extension: str + + def __init__(self, output_dir: str): + self.output_dir = output_dir + + def __call__(self, result: dict, audio_path: str, options: Optional[dict] = None, **kwargs): + audio_basename = os.path.basename(audio_path) + audio_basename = os.path.splitext(audio_basename)[0] + output_path = os.path.join(self.output_dir, audio_basename + "." + self.extension) + + with open(output_path, "w", encoding="utf-8") as f: + self.write_result(result, file=f, options=options, **kwargs) + + def write_result(self, result: dict, file: TextIO, options: Optional[dict] = None, **kwargs): + raise NotImplementedError + + +class WriteTXT(ResultWriter): + extension: str = "txt" + + def write_result(self, result: dict, file: TextIO, options: Optional[dict] = None, **kwargs): + for segment in result["segments"]: + print(segment["text"].strip(), file=file, flush=True) + + +class SubtitlesWriter(ResultWriter): + always_include_hours: bool + decimal_marker: str + + def iterate_result( + self, + result: dict, + options: Optional[dict] = None, + *, + max_line_width: Optional[int] = None, + max_line_count: Optional[int] = None, + highlight_words: bool = False, + max_words_per_line: Optional[int] = None, + ): + options = options or {} + max_line_width = max_line_width or options.get("max_line_width") + max_line_count = max_line_count or options.get("max_line_count") + highlight_words = highlight_words or options.get("highlight_words", False) + max_words_per_line = max_words_per_line or options.get("max_words_per_line") + preserve_segments = max_line_count is None or max_line_width is None + max_line_width = max_line_width or 1000 + max_words_per_line = max_words_per_line or 1000 + + def iterate_subtitles(): + line_len = 0 + line_count = 1 + # the next subtitle to yield (a list of word timings with whitespace) + subtitle: List[dict] = [] + last: float = get_start(result["segments"]) or 0.0 + for segment in result["segments"]: + chunk_index = 0 + words_count = max_words_per_line + while chunk_index < len(segment["words"]): + remaining_words = len(segment["words"]) - chunk_index + if max_words_per_line > len(segment["words"]) - chunk_index: + words_count = remaining_words + for i, original_timing in enumerate( + segment["words"][chunk_index : chunk_index + words_count] + ): + timing = original_timing.copy() + long_pause = not preserve_segments and timing["start"] - last > 3.0 + has_room = line_len + len(timing["word"]) <= max_line_width + seg_break = i == 0 and len(subtitle) > 0 and preserve_segments + if line_len > 0 and has_room and not long_pause and not seg_break: + # line continuation + line_len += len(timing["word"]) + else: + # new line + timing["word"] = timing["word"].strip() + if ( + len(subtitle) > 0 + and max_line_count is not None + and (long_pause or line_count >= max_line_count) + or seg_break + ): + # subtitle break + yield subtitle + subtitle = [] + line_count = 1 + elif line_len > 0: + # line break + line_count += 1 + timing["word"] = "\n" + timing["word"] + line_len = len(timing["word"].strip()) + subtitle.append(timing) + last = timing["start"] + chunk_index += max_words_per_line + if len(subtitle) > 0: + yield subtitle + + if len(result["segments"]) > 0 and "words" in result["segments"][0]: + for subtitle in iterate_subtitles(): + subtitle_start = self.format_timestamp(subtitle[0]["start"]) + subtitle_end = self.format_timestamp(subtitle[-1]["end"]) + subtitle_text = "".join([word["word"] for word in subtitle]) + if highlight_words: + last = subtitle_start + all_words = [timing["word"] for timing in subtitle] + for i, this_word in enumerate(subtitle): + start = self.format_timestamp(this_word["start"]) + end = self.format_timestamp(this_word["end"]) + if last != start: + yield last, start, subtitle_text + + yield start, end, "".join( + [ + re.sub(r"^(\s*)(.*)$", r"\1\2", word) if j == i else word + for j, word in enumerate(all_words) + ] + ) + last = end + else: + yield subtitle_start, subtitle_end, subtitle_text + else: + for segment in result["segments"]: + segment_start = self.format_timestamp(segment["start"]) + segment_end = self.format_timestamp(segment["end"]) + segment_text = segment["text"].strip().replace("-->", "->") + yield segment_start, segment_end, segment_text + + def format_timestamp(self, seconds: float): + return format_timestamp( + seconds=seconds, + always_include_hours=self.always_include_hours, + decimal_marker=self.decimal_marker, + ) + + +class WriteVTT(SubtitlesWriter): + extension: str = "vtt" + always_include_hours: bool = False + decimal_marker: str = "." + + def write_result(self, result: dict, file: TextIO, options: Optional[dict] = None, **kwargs): + print("WEBVTT\n", file=file) + for start, end, text in self.iterate_result(result, options, **kwargs): + print(f"{start} --> {end}\n{text}\n", file=file, flush=True) + + +class WriteSRT(SubtitlesWriter): + extension: str = "srt" + always_include_hours: bool = True + decimal_marker: str = "," + + def write_result(self, result: dict, file: TextIO, options: Optional[dict] = None, **kwargs): + for i, (start, end, text) in enumerate( + self.iterate_result(result, options, **kwargs), start=1 + ): + print(f"{i}\n{start} --> {end}\n{text}\n", file=file, flush=True) + + +class WriteTSV(ResultWriter): + """ + Write a transcript to a file in TSV (tab-separated values) format containing lines like: + \t\t + + Using integer milliseconds as start and end times means there's no chance of interference from + an environment setting a language encoding that causes the decimal in a floating point number + to appear as a comma; also is faster and more efficient to parse & store, e.g., in C++. + """ + + extension: str = "tsv" + + def write_result(self, result: dict, file: TextIO, options: Optional[dict] = None, **kwargs): + print("start", "end", "text", sep="\t", file=file) + for segment in result["segments"]: + print(round(1000 * segment["start"]), file=file, end="\t") + print(round(1000 * segment["end"]), file=file, end="\t") + print(segment["text"].strip().replace("\t", " "), file=file, flush=True) + + +class WriteJSON(ResultWriter): + extension: str = "json" + + def write_result(self, result: dict, file: TextIO, options: Optional[dict] = None, **kwargs): + json.dump(result, file) + + +def get_writer(output_format: str, output_dir: str) -> Callable[[dict, TextIO, dict], None]: + writers = { + "txt": WriteTXT, + "vtt": WriteVTT, + "srt": WriteSRT, + "tsv": WriteTSV, + "json": WriteJSON, + } + + if output_format == "all": + all_writers = [writer(output_dir) for writer in writers.values()] + + def write_all(result: dict, file: TextIO, options: Optional[dict] = None, **kwargs): + for writer in all_writers: + writer(result, file, options, **kwargs) + + return write_all + + return writers[output_format](output_dir) diff --git a/funasr/models/sense_voice/whisper_lib/version.py b/funasr/models/sense_voice/whisper_lib/version.py new file mode 100644 index 0000000..c96dd9c --- /dev/null +++ b/funasr/models/sense_voice/whisper_lib/version.py @@ -0,0 +1 @@ +__version__ = "20231117" diff --git a/funasr/models/sond/__init__.py b/funasr/models/sond/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/sond/attention.py b/funasr/models/sond/attention.py new file mode 100644 index 0000000..1af5534 --- /dev/null +++ b/funasr/models/sond/attention.py @@ -0,0 +1,322 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Multi-Head Attention layer definition.""" + +import math + +import numpy +import torch +from torch import nn +from typing import Optional, Tuple + +import torch.nn.functional as F +from funasr.models.transformer.utils.nets_utils import make_pad_mask +import funasr.models.lora.layers as lora + + +class MultiHeadedAttention(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_head, n_feat, dropout_rate): + """Construct an MultiHeadedAttention object.""" + super(MultiHeadedAttention, self).__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + self.linear_q = nn.Linear(n_feat, n_feat) + self.linear_k = nn.Linear(n_feat, n_feat) + self.linear_v = nn.Linear(n_feat, n_feat) + self.linear_out = nn.Linear(n_feat, n_feat) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv(self, query, key, value): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + n_batch = query.size(0) + q = self.linear_q(query).view(n_batch, -1, self.h, self.d_k) + k = self.linear_k(key).view(n_batch, -1, self.h, self.d_k) + v = self.linear_v(value).view(n_batch, -1, self.h, self.d_k) + q = q.transpose(1, 2) # (batch, head, time1, d_k) + k = k.transpose(1, 2) # (batch, head, time2, d_k) + v = v.transpose(1, 2) # (batch, head, time2, d_k) + + return q, k, v + + def forward_attention(self, value, scores, mask): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + min_value = float(numpy.finfo(torch.tensor(0, dtype=scores.dtype).numpy().dtype).min) + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x) # (batch, time1, d_model) + + def forward(self, query, key, value, mask): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q, k, v = self.forward_qkv(query, key, value) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, mask) + + +class RelPositionMultiHeadedAttention(MultiHeadedAttention): + """Multi-Head Attention layer with relative position encoding (new implementation). + + Details can be found in https://github.com/espnet/espnet/pull/2816. + + Paper: https://arxiv.org/abs/1901.02860 + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + zero_triu (bool): Whether to zero the upper triangular part of attention matrix. + + """ + + def __init__(self, n_head, n_feat, dropout_rate, zero_triu=False): + """Construct an RelPositionMultiHeadedAttention object.""" + super().__init__(n_head, n_feat, dropout_rate) + self.zero_triu = zero_triu + # linear transformation for positional encoding + self.linear_pos = nn.Linear(n_feat, n_feat, bias=False) + # these two learnable bias are used in matrix c and matrix d + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + self.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k)) + self.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k)) + torch.nn.init.xavier_uniform_(self.pos_bias_u) + torch.nn.init.xavier_uniform_(self.pos_bias_v) + + def rel_shift(self, x): + """Compute relative positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, head, time1, 2*time1-1). + time1 means the length of query vector. + + Returns: + torch.Tensor: Output tensor. + + """ + zero_pad = torch.zeros((*x.size()[:3], 1), device=x.device, dtype=x.dtype) + x_padded = torch.cat([zero_pad, x], dim=-1) + + x_padded = x_padded.view(*x.size()[:2], x.size(3) + 1, x.size(2)) + x = x_padded[:, :, 1:].view_as(x)[ + :, :, :, : x.size(-1) // 2 + 1 + ] # only keep the positions from 0 to time2 + + if self.zero_triu: + ones = torch.ones((x.size(2), x.size(3)), device=x.device) + x = x * torch.tril(ones, x.size(3) - x.size(2))[None, None, :, :] + + return x + + def forward(self, query, key, value, pos_emb, mask): + """Compute 'Scaled Dot Product Attention' with rel. positional encoding. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + pos_emb (torch.Tensor): Positional embedding tensor + (#batch, 2*time1-1, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q, k, v = self.forward_qkv(query, key, value) + q = q.transpose(1, 2) # (batch, time1, head, d_k) + + n_batch_pos = pos_emb.size(0) + p = self.linear_pos(pos_emb).view(n_batch_pos, -1, self.h, self.d_k) + p = p.transpose(1, 2) # (batch, head, 2*time1-1, d_k) + + # (batch, head, time1, d_k) + q_with_bias_u = (q + self.pos_bias_u).transpose(1, 2) + # (batch, head, time1, d_k) + q_with_bias_v = (q + self.pos_bias_v).transpose(1, 2) + + # compute attention score + # first compute matrix a and matrix c + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + # (batch, head, time1, time2) + matrix_ac = torch.matmul(q_with_bias_u, k.transpose(-2, -1)) + + # compute matrix b and matrix d + # (batch, head, time1, 2*time1-1) + matrix_bd = torch.matmul(q_with_bias_v, p.transpose(-2, -1)) + matrix_bd = self.rel_shift(matrix_bd) + + scores = (matrix_ac + matrix_bd) / math.sqrt(self.d_k) # (batch, head, time1, time2) + + return self.forward_attention(v, scores, mask) + + +class MultiHeadSelfAttention(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_head, in_feat, n_feat, dropout_rate): + """Construct an MultiHeadedAttention object.""" + super(MultiHeadSelfAttention, self).__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + self.linear_out = nn.Linear(n_feat, n_feat) + self.linear_q_k_v = nn.Linear(in_feat, n_feat * 3) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv(self, x): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + b, t, d = x.size() + q_k_v = self.linear_q_k_v(x) + q, k, v = torch.split(q_k_v, int(self.h * self.d_k), dim=-1) + q_h = torch.reshape(q, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time1, d_k) + k_h = torch.reshape(k, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + v_h = torch.reshape(v, (b, t, self.h, self.d_k)).transpose( + 1, 2 + ) # (batch, head, time2, d_k) + + return q_h, k_h, v_h, v + + def forward_attention(self, value, scores, mask, mask_att_chunk_encoder=None): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + if mask_att_chunk_encoder is not None: + mask = mask * mask_att_chunk_encoder + + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + + min_value = float(numpy.finfo(torch.tensor(0, dtype=scores.dtype).numpy().dtype).min) + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x) # (batch, time1, d_model) + + def forward(self, x, mask, mask_att_chunk_encoder=None): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q_h, k_h, v_h, v = self.forward_qkv(x) + q_h = q_h * self.d_k ** (-0.5) + scores = torch.matmul(q_h, k_h.transpose(-2, -1)) + att_outs = self.forward_attention(v_h, scores, mask, mask_att_chunk_encoder) + return att_outs diff --git a/funasr/models/sond/e2e_diar_sond.py b/funasr/models/sond/e2e_diar_sond.py new file mode 100644 index 0000000..0f5a7c2 --- /dev/null +++ b/funasr/models/sond/e2e_diar_sond.py @@ -0,0 +1,576 @@ +#!/usr/bin/env python3 +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) +import logging +import random +from contextlib import contextmanager +from distutils.version import LooseVersion +from itertools import permutations +from typing import Dict +from typing import Optional +from typing import Tuple, List + +import numpy as np +import torch +from torch.nn import functional as F + +from funasr.models.transformer.utils.nets_utils import to_device +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.decoder.abs_decoder import AbsDecoder +from funasr.models.encoder.abs_encoder import AbsEncoder +from funasr.frontends.abs_frontend import AbsFrontend +from funasr.models.specaug.abs_specaug import AbsSpecAug +from funasr.models.specaug.abs_profileaug import AbsProfileAug +from funasr.layers.abs_normalize import AbsNormalize +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.base_model import FunASRModel +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss, SequenceBinaryCrossEntropy +from funasr.utils.misc import int2vec +from funasr.utils.hinter import hint_once + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +class DiarSondModel(FunASRModel): + """Speaker overlap-aware neural diarization model + reference: https://arxiv.org/abs/2211.10243 + """ + + def __init__( + self, + vocab_size: int, + frontend: Optional[AbsFrontend], + specaug: Optional[AbsSpecAug], + profileaug: Optional[AbsProfileAug], + normalize: Optional[AbsNormalize], + encoder: torch.nn.Module, + speaker_encoder: Optional[torch.nn.Module], + ci_scorer: torch.nn.Module, + cd_scorer: Optional[torch.nn.Module], + decoder: torch.nn.Module, + token_list: list, + lsm_weight: float = 0.1, + length_normalized_loss: bool = False, + max_spk_num: int = 16, + label_aggregator: Optional[torch.nn.Module] = None, + normalize_speech_speaker: bool = False, + ignore_id: int = -1, + speaker_discrimination_loss_weight: float = 1.0, + inter_score_loss_weight: float = 0.0, + inputs_type: str = "raw", + model_regularizer_weight: float = 0.0, + freeze_encoder: bool = False, + onfly_shuffle_speaker: bool = True, + ): + + super().__init__() + + self.encoder = encoder + self.speaker_encoder = speaker_encoder + self.ci_scorer = ci_scorer + self.cd_scorer = cd_scorer + self.normalize = normalize + self.frontend = frontend + self.specaug = specaug + self.profileaug = profileaug + self.label_aggregator = label_aggregator + self.decoder = decoder + self.token_list = token_list + self.max_spk_num = max_spk_num + self.normalize_speech_speaker = normalize_speech_speaker + self.ignore_id = ignore_id + self.model_regularizer_weight = model_regularizer_weight + self.freeze_encoder = freeze_encoder + self.onfly_shuffle_speaker = onfly_shuffle_speaker + self.criterion_diar = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + self.criterion_bce = SequenceBinaryCrossEntropy(normalize_length=length_normalized_loss) + self.pse_embedding = self.generate_pse_embedding() + self.power_weight = torch.from_numpy( + 2 ** np.arange(max_spk_num)[np.newaxis, np.newaxis, :] + ).float() + self.int_token_arr = torch.from_numpy( + np.array(self.token_list).astype(int)[np.newaxis, np.newaxis, :] + ).int() + self.speaker_discrimination_loss_weight = speaker_discrimination_loss_weight + self.inter_score_loss_weight = inter_score_loss_weight + self.forward_steps = 0 + self.inputs_type = inputs_type + self.to_regularize_parameters = None + + def get_regularize_parameters(self): + to_regularize_parameters, normal_parameters = [], [] + for name, param in self.named_parameters(): + if ( + "encoder" in name + and "weight" in name + and "bn" not in name + and ("conv2" in name or "conv1" in name or "conv_sc" in name or "dense" in name) + ): + to_regularize_parameters.append((name, param)) + else: + normal_parameters.append((name, param)) + self.to_regularize_parameters = to_regularize_parameters + return to_regularize_parameters, normal_parameters + + def generate_pse_embedding(self): + embedding = np.zeros((len(self.token_list), self.max_spk_num), dtype=np.float32) + for idx, pse_label in enumerate(self.token_list): + emb = int2vec(int(pse_label), vec_dim=self.max_spk_num, dtype=np.float32) + embedding[idx] = emb + return torch.from_numpy(embedding) + + def rand_permute_speaker(self, raw_profile, raw_binary_labels): + """ + raw_profile: B, N, D + raw_binary_labels: B, T, N + """ + assert ( + raw_profile.shape[1] == raw_binary_labels.shape[2] + ), "Num profile: {}, Num label: {}".format( + raw_profile.shape[1], raw_binary_labels.shape[-1] + ) + profile = torch.clone(raw_profile) + binary_labels = torch.clone(raw_binary_labels) + bsz, num_spk = profile.shape[0], profile.shape[1] + for i in range(bsz): + idx = list(range(num_spk)) + random.shuffle(idx) + profile[i] = profile[i][idx, :] + binary_labels[i] = binary_labels[i][:, idx] + + return profile, binary_labels + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor = None, + profile: torch.Tensor = None, + profile_lengths: torch.Tensor = None, + binary_labels: torch.Tensor = None, + binary_labels_lengths: torch.Tensor = None, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Speaker Encoder + CI Scorer + CD Scorer + Decoder + Calc loss + + Args: + speech: (Batch, samples) or (Batch, frames, input_size) + speech_lengths: (Batch,) default None for chunk interator, + because the chunk-iterator does not + have the speech_lengths returned. + see in + espnet2/iterators/chunk_iter_factory.py + profile: (Batch, N_spk, dim) + profile_lengths: (Batch,) + binary_labels: (Batch, frames, max_spk_num) + binary_labels_lengths: (Batch,) + """ + assert speech.shape[0] <= binary_labels.shape[0], (speech.shape, binary_labels.shape) + batch_size = speech.shape[0] + if self.freeze_encoder: + hint_once("Freeze encoder", "freeze_encoder", rank=0) + self.encoder.eval() + self.forward_steps = self.forward_steps + 1 + if self.pse_embedding.device != speech.device: + self.pse_embedding = self.pse_embedding.to(speech.device) + self.power_weight = self.power_weight.to(speech.device) + self.int_token_arr = self.int_token_arr.to(speech.device) + + if self.onfly_shuffle_speaker: + hint_once("On-the-fly shuffle speaker permutation.", "onfly_shuffle_speaker", rank=0) + profile, binary_labels = self.rand_permute_speaker(profile, binary_labels) + + # 0a. Aggregate time-domain labels to match forward outputs + if self.label_aggregator is not None: + binary_labels, binary_labels_lengths = self.label_aggregator( + binary_labels, binary_labels_lengths + ) + # 0b. augment profiles + if self.profileaug is not None and self.training: + speech, profile, binary_labels = self.profileaug( + speech, + speech_lengths, + profile, + profile_lengths, + binary_labels, + binary_labels_lengths, + ) + + # 1. Calculate power-set encoding (PSE) labels + pad_bin_labels = F.pad( + binary_labels, (0, self.max_spk_num - binary_labels.shape[2]), "constant", 0.0 + ) + raw_pse_labels = torch.sum(pad_bin_labels * self.power_weight, dim=2, keepdim=True) + pse_labels = torch.argmax((raw_pse_labels.int() == self.int_token_arr).float(), dim=2) + + # 2. Network forward + pred, inter_outputs = self.prediction_forward( + speech, speech_lengths, profile, profile_lengths, return_inter_outputs=True + ) + (speech, speech_lengths), (profile, profile_lengths), (ci_score, cd_score) = inter_outputs + + # If encoder uses conv* as input_layer (i.e., subsampling), + # the sequence length of 'pred' might be slightly less than the + # length of 'spk_labels'. Here we force them to be equal. + length_diff_tolerance = 2 + length_diff = abs(pse_labels.shape[1] - pred.shape[1]) + if length_diff <= length_diff_tolerance: + min_len = min(pred.shape[1], pse_labels.shape[1]) + pse_labels = pse_labels[:, :min_len] + pred = pred[:, :min_len] + cd_score = cd_score[:, :min_len] + ci_score = ci_score[:, :min_len] + + loss_diar = self.classification_loss(pred, pse_labels, binary_labels_lengths) + loss_spk_dis = self.speaker_discrimination_loss(profile, profile_lengths) + loss_inter_ci, loss_inter_cd = self.internal_score_loss( + cd_score, ci_score, pse_labels, binary_labels_lengths + ) + regularizer_loss = None + if self.model_regularizer_weight > 0 and self.to_regularize_parameters is not None: + regularizer_loss = self.calculate_regularizer_loss() + label_mask = make_pad_mask(binary_labels_lengths, maxlen=pse_labels.shape[1]).to( + pse_labels.device + ) + loss = ( + loss_diar + + self.speaker_discrimination_loss_weight * loss_spk_dis + + self.inter_score_loss_weight * (loss_inter_ci + loss_inter_cd) + ) + # if regularizer_loss is not None: + # loss = loss + regularizer_loss * self.model_regularizer_weight + + ( + correct, + num_frames, + speech_scored, + speech_miss, + speech_falarm, + speaker_scored, + speaker_miss, + speaker_falarm, + speaker_error, + ) = self.calc_diarization_error( + pred=F.embedding(pred.argmax(dim=2) * (~label_mask), self.pse_embedding), + label=F.embedding(pse_labels * (~label_mask), self.pse_embedding), + length=binary_labels_lengths, + ) + + if speech_scored > 0 and num_frames > 0: + sad_mr, sad_fr, mi, fa, cf, acc, der = ( + speech_miss / speech_scored, + speech_falarm / speech_scored, + speaker_miss / speaker_scored, + speaker_falarm / speaker_scored, + speaker_error / speaker_scored, + correct / num_frames, + (speaker_miss + speaker_falarm + speaker_error) / speaker_scored, + ) + else: + sad_mr, sad_fr, mi, fa, cf, acc, der = 0, 0, 0, 0, 0, 0, 0 + + stats = dict( + loss=loss.detach(), + loss_diar=loss_diar.detach() if loss_diar is not None else None, + loss_spk_dis=loss_spk_dis.detach() if loss_spk_dis is not None else None, + loss_inter_ci=loss_inter_ci.detach() if loss_inter_ci is not None else None, + loss_inter_cd=loss_inter_cd.detach() if loss_inter_cd is not None else None, + regularizer_loss=regularizer_loss.detach() if regularizer_loss is not None else None, + sad_mr=sad_mr, + sad_fr=sad_fr, + mi=mi, + fa=fa, + cf=cf, + acc=acc, + der=der, + forward_steps=self.forward_steps, + ) + + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def calculate_regularizer_loss(self): + regularizer_loss = 0.0 + for name, param in self.to_regularize_parameters: + regularizer_loss = regularizer_loss + torch.norm(param, p=2) + return regularizer_loss + + def classification_loss( + self, predictions: torch.Tensor, labels: torch.Tensor, prediction_lengths: torch.Tensor + ) -> torch.Tensor: + mask = make_pad_mask(prediction_lengths, maxlen=labels.shape[1]) + pad_labels = labels.masked_fill(mask.to(predictions.device), value=self.ignore_id) + loss = self.criterion_diar(predictions.contiguous(), pad_labels) + + return loss + + def speaker_discrimination_loss( + self, profile: torch.Tensor, profile_lengths: torch.Tensor + ) -> torch.Tensor: + profile_mask = ( + torch.linalg.norm(profile, ord=2, dim=2, keepdim=True) > 0 + ).float() # (B, N, 1) + mask = torch.matmul(profile_mask, profile_mask.transpose(1, 2)) # (B, N, N) + mask = mask * (1.0 - torch.eye(self.max_spk_num).unsqueeze(0).to(mask)) + + eps = 1e-12 + coding_norm = ( + torch.linalg.norm( + profile * profile_mask + (1 - profile_mask) * eps, dim=2, keepdim=True + ) + * profile_mask + ) + # profile: Batch, N, dim + cos_theta = ( + F.cosine_similarity(profile.unsqueeze(2), profile.unsqueeze(1), dim=-1, eps=eps) * mask + ) + cos_theta = torch.clip(cos_theta, -1 + eps, 1 - eps) + loss = (F.relu(mask * coding_norm * (cos_theta - 0.0))).sum() / mask.sum() + + return loss + + def calculate_multi_labels(self, pse_labels, pse_labels_lengths): + mask = make_pad_mask(pse_labels_lengths, maxlen=pse_labels.shape[1]) + padding_labels = pse_labels.masked_fill(mask.to(pse_labels.device), value=0).to(pse_labels) + multi_labels = F.embedding(padding_labels, self.pse_embedding) + + return multi_labels + + def internal_score_loss( + self, + cd_score: torch.Tensor, + ci_score: torch.Tensor, + pse_labels: torch.Tensor, + pse_labels_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + multi_labels = self.calculate_multi_labels(pse_labels, pse_labels_lengths) + ci_loss = self.criterion_bce(ci_score, multi_labels, pse_labels_lengths) + cd_loss = self.criterion_bce(cd_score, multi_labels, pse_labels_lengths) + return ci_loss, cd_loss + + def collect_feats( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + profile: torch.Tensor = None, + profile_lengths: torch.Tensor = None, + binary_labels: torch.Tensor = None, + binary_labels_lengths: torch.Tensor = None, + ) -> Dict[str, torch.Tensor]: + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + return {"feats": feats, "feats_lengths": feats_lengths} + + def encode_speaker( + self, + profile: torch.Tensor, + profile_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + with autocast(False): + if profile.shape[1] < self.max_spk_num: + profile = F.pad( + profile, [0, 0, 0, self.max_spk_num - profile.shape[1], 0, 0], "constant", 0.0 + ) + profile_mask = (torch.linalg.norm(profile, ord=2, dim=2, keepdim=True) > 0).float() + profile = F.normalize(profile, dim=2) + if self.speaker_encoder is not None: + profile = self.speaker_encoder(profile, profile_lengths)[0] + return profile * profile_mask, profile_lengths + else: + return profile, profile_lengths + + def encode_speech( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + if self.encoder is not None and self.inputs_type == "raw": + speech, speech_lengths = self.encode(speech, speech_lengths) + speech_mask = ~make_pad_mask(speech_lengths, maxlen=speech.shape[1]) + speech_mask = speech_mask.to(speech.device).unsqueeze(-1).float() + return speech * speech_mask, speech_lengths + else: + return speech, speech_lengths + + @staticmethod + def concate_speech_ivc(speech: torch.Tensor, ivc: torch.Tensor) -> torch.Tensor: + nn, tt = ivc.shape[1], speech.shape[1] + speech = speech.unsqueeze(dim=1) # B x 1 x T x D + speech = speech.expand(-1, nn, -1, -1) # B x N x T x D + ivc = ivc.unsqueeze(dim=2) # B x N x 1 x D + ivc = ivc.expand(-1, -1, tt, -1) # B x N x T x D + sd_in = torch.cat([speech, ivc], dim=3) # B x N x T x 2D + return sd_in + + def calc_similarity( + self, + speech_encoder_outputs: torch.Tensor, + speaker_encoder_outputs: torch.Tensor, + seq_len: torch.Tensor = None, + spk_len: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor]: + bb, tt = speech_encoder_outputs.shape[0], speech_encoder_outputs.shape[1] + d_sph, d_spk = speech_encoder_outputs.shape[2], speaker_encoder_outputs.shape[2] + if self.normalize_speech_speaker: + speech_encoder_outputs = F.normalize(speech_encoder_outputs, dim=2) + speaker_encoder_outputs = F.normalize(speaker_encoder_outputs, dim=2) + ge_in = self.concate_speech_ivc(speech_encoder_outputs, speaker_encoder_outputs) + ge_in = torch.reshape(ge_in, [bb * self.max_spk_num, tt, d_sph + d_spk]) + ge_len = seq_len.unsqueeze(1).expand(-1, self.max_spk_num) + ge_len = torch.reshape(ge_len, [bb * self.max_spk_num]) + cd_simi = self.cd_scorer(ge_in, ge_len)[0] + cd_simi = torch.reshape(cd_simi, [bb, self.max_spk_num, tt, 1]) + cd_simi = cd_simi.squeeze(dim=3).permute([0, 2, 1]) + + if isinstance(self.ci_scorer, AbsEncoder): + ci_simi = self.ci_scorer(ge_in, ge_len)[0] + ci_simi = torch.reshape(ci_simi, [bb, self.max_spk_num, tt]).permute([0, 2, 1]) + else: + ci_simi = self.ci_scorer(speech_encoder_outputs, speaker_encoder_outputs) + + return ci_simi, cd_simi + + def post_net_forward(self, simi, seq_len): + logits = self.decoder(simi, seq_len)[0] + + return logits + + def prediction_forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + profile: torch.Tensor, + profile_lengths: torch.Tensor, + return_inter_outputs: bool = False, + ) -> [torch.Tensor, Optional[list]]: + # speech encoding + speech, speech_lengths = self.encode_speech(speech, speech_lengths) + # speaker encoding + profile, profile_lengths = self.encode_speaker(profile, profile_lengths) + # calculating similarity + ci_simi, cd_simi = self.calc_similarity(speech, profile, speech_lengths, profile_lengths) + similarity = torch.cat([cd_simi, ci_simi], dim=2) + # post net forward + logits = self.post_net_forward(similarity, speech_lengths) + + if return_inter_outputs: + return logits, [ + (speech, speech_lengths), + (profile, profile_lengths), + (ci_simi, cd_simi), + ] + return logits + + def encode( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder + + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch,) + """ + with autocast(False): + # 1. Extract feats + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + + # 2. Data augmentation + if self.specaug is not None and self.training: + feats, feats_lengths = self.specaug(feats, feats_lengths) + + # 3. Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + feats, feats_lengths = self.normalize(feats, feats_lengths) + + # 4. Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim) + encoder_outputs = self.encoder(feats, feats_lengths) + encoder_out, encoder_out_lens = encoder_outputs[:2] + + assert encoder_out.size(0) == speech.size(0), ( + encoder_out.size(), + speech.size(0), + ) + assert encoder_out.size(1) <= encoder_out_lens.max(), ( + encoder_out.size(), + encoder_out_lens.max(), + ) + + return encoder_out, encoder_out_lens + + def _extract_feats( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + batch_size = speech.shape[0] + speech_lengths = ( + speech_lengths + if speech_lengths is not None + else torch.ones(batch_size).int() * speech.shape[1] + ) + + assert speech_lengths.dim() == 1, speech_lengths.shape + + # for data-parallel + speech = speech[:, : speech_lengths.max()] + + if self.frontend is not None: + # Frontend + # e.g. STFT and Feature extract + # data_loader may send time-domain signal in this case + # speech (Batch, NSamples) -> feats: (Batch, NFrames, Dim) + feats, feats_lengths = self.frontend(speech, speech_lengths) + else: + # No frontend and no feature extract + feats, feats_lengths = speech, speech_lengths + return feats, feats_lengths + + @staticmethod + def calc_diarization_error(pred, label, length): + # Note (jiatong): Credit to https://github.com/hitachi-speech/EEND + + (batch_size, max_len, num_output) = label.size() + # mask the padding part + mask = ~make_pad_mask(length, maxlen=label.shape[1]).unsqueeze(-1).numpy() + + # pred and label have the shape (batch_size, max_len, num_output) + label_np = label.data.cpu().numpy().astype(int) + pred_np = (pred.data.cpu().numpy() > 0).astype(int) + label_np = label_np * mask + pred_np = pred_np * mask + length = length.data.cpu().numpy() + + # compute speech activity detection error + n_ref = np.sum(label_np, axis=2) + n_sys = np.sum(pred_np, axis=2) + speech_scored = float(np.sum(n_ref > 0)) + speech_miss = float(np.sum(np.logical_and(n_ref > 0, n_sys == 0))) + speech_falarm = float(np.sum(np.logical_and(n_ref == 0, n_sys > 0))) + + # compute speaker diarization error + speaker_scored = float(np.sum(n_ref)) + speaker_miss = float(np.sum(np.maximum(n_ref - n_sys, 0))) + speaker_falarm = float(np.sum(np.maximum(n_sys - n_ref, 0))) + n_map = np.sum(np.logical_and(label_np == 1, pred_np == 1), axis=2) + speaker_error = float(np.sum(np.minimum(n_ref, n_sys) - n_map)) + correct = float(1.0 * np.sum((label_np == pred_np) * mask) / num_output) + num_frames = np.sum(length) + return ( + correct, + num_frames, + speech_scored, + speech_miss, + speech_falarm, + speaker_scored, + speaker_miss, + speaker_falarm, + speaker_error, + ) diff --git a/funasr/models/sond/encoder/__init__.py b/funasr/models/sond/encoder/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/sond/encoder/ci_scorers.py b/funasr/models/sond/encoder/ci_scorers.py new file mode 100644 index 0000000..a60560b --- /dev/null +++ b/funasr/models/sond/encoder/ci_scorers.py @@ -0,0 +1,32 @@ +import torch +from torch.nn import functional as F + + +class DotScorer(torch.nn.Module): + def __init__(self): + super().__init__() + + def forward( + self, + xs_pad: torch.Tensor, + spk_emb: torch.Tensor, + ): + # xs_pad: B, T, D + # spk_emb: B, N, D + scores = torch.matmul(xs_pad, spk_emb.transpose(1, 2)) + return scores + + +class CosScorer(torch.nn.Module): + def __init__(self): + super().__init__() + + def forward( + self, + xs_pad: torch.Tensor, + spk_emb: torch.Tensor, + ): + # xs_pad: B, T, D + # spk_emb: B, N, D + scores = F.cosine_similarity(xs_pad.unsqueeze(2), spk_emb.unsqueeze(1), dim=-1) + return scores diff --git a/funasr/models/sond/encoder/conv_encoder.py b/funasr/models/sond/encoder/conv_encoder.py new file mode 100644 index 0000000..c4f7098 --- /dev/null +++ b/funasr/models/sond/encoder/conv_encoder.py @@ -0,0 +1,174 @@ +from typing import List +from typing import Optional +from typing import Sequence +from typing import Tuple +from typing import Union +import logging +import torch +import torch.nn as nn +from torch.nn import functional as F +import numpy as np +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.encoder.abs_encoder import AbsEncoder +import math +from funasr.models.transformer.utils.repeat import repeat + + +class EncoderLayer(nn.Module): + def __init__( + self, + input_units, + num_units, + kernel_size=3, + activation="tanh", + stride=1, + include_batch_norm=False, + residual=False, + ): + super().__init__() + left_padding = math.ceil((kernel_size - stride) / 2) + right_padding = kernel_size - stride - left_padding + self.conv_padding = nn.ConstantPad1d((left_padding, right_padding), 0.0) + self.conv1d = nn.Conv1d( + input_units, + num_units, + kernel_size, + stride, + ) + self.activation = self.get_activation(activation) + if include_batch_norm: + self.bn = nn.BatchNorm1d(num_units, momentum=0.99, eps=1e-3) + self.residual = residual + self.include_batch_norm = include_batch_norm + self.input_units = input_units + self.num_units = num_units + self.stride = stride + + @staticmethod + def get_activation(activation): + if activation == "tanh": + return nn.Tanh() + else: + return nn.ReLU() + + def forward(self, xs_pad, ilens=None): + outputs = self.conv1d(self.conv_padding(xs_pad)) + if self.residual and self.stride == 1 and self.input_units == self.num_units: + outputs = outputs + xs_pad + + if self.include_batch_norm: + outputs = self.bn(outputs) + + # add parenthesis for repeat module + return self.activation(outputs), ilens + + +class ConvEncoder(AbsEncoder): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Convolution encoder in OpenNMT framework + """ + + def __init__( + self, + num_layers, + input_units, + num_units, + kernel_size=3, + dropout_rate=0.3, + position_encoder=None, + activation="tanh", + auxiliary_states=True, + out_units=None, + out_norm=False, + out_residual=False, + include_batchnorm=False, + regularization_weight=0.0, + stride=1, + tf2torch_tensor_name_prefix_torch: str = "speaker_encoder", + tf2torch_tensor_name_prefix_tf: str = "EAND/speaker_encoder", + ): + super().__init__() + self._output_size = num_units + + self.num_layers = num_layers + self.input_units = input_units + self.num_units = num_units + self.kernel_size = kernel_size + self.dropout_rate = dropout_rate + self.position_encoder = position_encoder + self.out_units = out_units + self.auxiliary_states = auxiliary_states + self.out_norm = out_norm + self.activation = activation + self.out_residual = out_residual + self.include_batch_norm = include_batchnorm + self.regularization_weight = regularization_weight + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + if isinstance(stride, int): + self.stride = [stride] * self.num_layers + else: + self.stride = stride + self.downsample_rate = 1 + for s in self.stride: + self.downsample_rate *= s + + self.dropout = nn.Dropout(dropout_rate) + self.cnn_a = repeat( + self.num_layers, + lambda lnum: EncoderLayer( + input_units if lnum == 0 else num_units, + num_units, + kernel_size, + activation, + self.stride[lnum], + include_batchnorm, + residual=True if lnum > 0 else False, + ), + ) + + if self.out_units is not None: + left_padding = math.ceil((kernel_size - stride) / 2) + right_padding = kernel_size - stride - left_padding + self.out_padding = nn.ConstantPad1d((left_padding, right_padding), 0.0) + self.conv_out = nn.Conv1d( + num_units, + out_units, + kernel_size, + ) + + if self.out_norm: + self.after_norm = LayerNorm(out_units) + + def output_size(self) -> int: + return self.num_units + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + + inputs = xs_pad + if self.position_encoder is not None: + inputs = self.position_encoder(inputs) + + if self.dropout_rate > 0: + inputs = self.dropout(inputs) + + outputs, _ = self.cnn_a(inputs.transpose(1, 2), ilens) + + if self.out_units is not None: + outputs = self.conv_out(self.out_padding(outputs)) + + outputs = outputs.transpose(1, 2) + if self.out_norm: + outputs = self.after_norm(outputs) + + if self.out_residual: + outputs = outputs + inputs + + return outputs, ilens, None diff --git a/funasr/models/sond/encoder/ecapa_tdnn_encoder.py b/funasr/models/sond/encoder/ecapa_tdnn_encoder.py new file mode 100644 index 0000000..1af8b70 --- /dev/null +++ b/funasr/models/sond/encoder/ecapa_tdnn_encoder.py @@ -0,0 +1,672 @@ +import math +import torch +import torch.nn as nn +import torch.nn.functional as F + + +class _BatchNorm1d(nn.Module): + def __init__( + self, + input_shape=None, + input_size=None, + eps=1e-05, + momentum=0.1, + affine=True, + track_running_stats=True, + combine_batch_time=False, + skip_transpose=False, + ): + super().__init__() + self.combine_batch_time = combine_batch_time + self.skip_transpose = skip_transpose + + if input_size is None and skip_transpose: + input_size = input_shape[1] + elif input_size is None: + input_size = input_shape[-1] + + self.norm = nn.BatchNorm1d( + input_size, + eps=eps, + momentum=momentum, + affine=affine, + track_running_stats=track_running_stats, + ) + + def forward(self, x): + shape_or = x.shape + if self.combine_batch_time: + if x.ndim == 3: + x = x.reshape(shape_or[0] * shape_or[1], shape_or[2]) + else: + x = x.reshape(shape_or[0] * shape_or[1], shape_or[3], shape_or[2]) + + elif not self.skip_transpose: + x = x.transpose(-1, 1) + + x_n = self.norm(x) + + if self.combine_batch_time: + x_n = x_n.reshape(shape_or) + elif not self.skip_transpose: + x_n = x_n.transpose(1, -1) + + return x_n + + +class _Conv1d(nn.Module): + def __init__( + self, + out_channels, + kernel_size, + input_shape=None, + in_channels=None, + stride=1, + dilation=1, + padding="same", + groups=1, + bias=True, + padding_mode="reflect", + skip_transpose=False, + ): + super().__init__() + self.kernel_size = kernel_size + self.stride = stride + self.dilation = dilation + self.padding = padding + self.padding_mode = padding_mode + self.unsqueeze = False + self.skip_transpose = skip_transpose + + if input_shape is None and in_channels is None: + raise ValueError("Must provide one of input_shape or in_channels") + + if in_channels is None: + in_channels = self._check_input_shape(input_shape) + + self.conv = nn.Conv1d( + in_channels, + out_channels, + self.kernel_size, + stride=self.stride, + dilation=self.dilation, + padding=0, + groups=groups, + bias=bias, + ) + + def forward(self, x): + if not self.skip_transpose: + x = x.transpose(1, -1) + + if self.unsqueeze: + x = x.unsqueeze(1) + + if self.padding == "same": + x = self._manage_padding(x, self.kernel_size, self.dilation, self.stride) + + elif self.padding == "causal": + num_pad = (self.kernel_size - 1) * self.dilation + x = F.pad(x, (num_pad, 0)) + + elif self.padding == "valid": + pass + + else: + raise ValueError("Padding must be 'same', 'valid' or 'causal'. Got " + self.padding) + + wx = self.conv(x) + + if self.unsqueeze: + wx = wx.squeeze(1) + + if not self.skip_transpose: + wx = wx.transpose(1, -1) + + return wx + + def _manage_padding( + self, + x, + kernel_size: int, + dilation: int, + stride: int, + ): + # Detecting input shape + L_in = x.shape[-1] + + # Time padding + padding = get_padding_elem(L_in, stride, kernel_size, dilation) + + # Applying padding + x = F.pad(x, padding, mode=self.padding_mode) + + return x + + def _check_input_shape(self, shape): + """Checks the input shape and returns the number of input channels.""" + + if len(shape) == 2: + self.unsqueeze = True + in_channels = 1 + elif self.skip_transpose: + in_channels = shape[1] + elif len(shape) == 3: + in_channels = shape[2] + else: + raise ValueError("conv1d expects 2d, 3d inputs. Got " + str(len(shape))) + + # Kernel size must be odd + if self.kernel_size % 2 == 0: + raise ValueError( + "The field kernel size must be an odd number. Got %s." % (self.kernel_size) + ) + return in_channels + + +def get_padding_elem(L_in: int, stride: int, kernel_size: int, dilation: int): + if stride > 1: + n_steps = math.ceil(((L_in - kernel_size * dilation) / stride) + 1) + L_out = stride * (n_steps - 1) + kernel_size * dilation + padding = [kernel_size // 2, kernel_size // 2] + + else: + L_out = (L_in - dilation * (kernel_size - 1) - 1) // stride + 1 + + padding = [(L_in - L_out) // 2, (L_in - L_out) // 2] + return padding + + +# Skip transpose as much as possible for efficiency +class Conv1d(_Conv1d): + def __init__(self, *args, **kwargs): + super().__init__(skip_transpose=True, *args, **kwargs) + + +class BatchNorm1d(_BatchNorm1d): + def __init__(self, *args, **kwargs): + super().__init__(skip_transpose=True, *args, **kwargs) + + +def length_to_mask(length, max_len=None, dtype=None, device=None): + assert len(length.shape) == 1 + + if max_len is None: + max_len = length.max().long().item() # using arange to generate mask + mask = torch.arange(max_len, device=length.device, dtype=length.dtype).expand( + len(length), max_len + ) < length.unsqueeze(1) + + if dtype is None: + dtype = length.dtype + + if device is None: + device = length.device + + mask = torch.as_tensor(mask, dtype=dtype, device=device) + return mask + + +class TDNNBlock(nn.Module): + def __init__( + self, + in_channels, + out_channels, + kernel_size, + dilation, + activation=nn.ReLU, + groups=1, + ): + super(TDNNBlock, self).__init__() + self.conv = Conv1d( + in_channels=in_channels, + out_channels=out_channels, + kernel_size=kernel_size, + dilation=dilation, + groups=groups, + ) + self.activation = activation() + self.norm = BatchNorm1d(input_size=out_channels) + + def forward(self, x): + return self.norm(self.activation(self.conv(x))) + + +class Res2NetBlock(torch.nn.Module): + """An implementation of Res2NetBlock w/ dilation. + + Arguments + --------- + in_channels : int + The number of channels expected in the input. + out_channels : int + The number of output channels. + scale : int + The scale of the Res2Net block. + kernel_size: int + The kernel size of the Res2Net block. + dilation : int + The dilation of the Res2Net block. + + Example + ------- + >>> inp_tensor = torch.rand([8, 120, 64]).transpose(1, 2) + >>> layer = Res2NetBlock(64, 64, scale=4, dilation=3) + >>> out_tensor = layer(inp_tensor).transpose(1, 2) + >>> out_tensor.shape + torch.Size([8, 120, 64]) + """ + + def __init__(self, in_channels, out_channels, scale=8, kernel_size=3, dilation=1): + super(Res2NetBlock, self).__init__() + assert in_channels % scale == 0 + assert out_channels % scale == 0 + + in_channel = in_channels // scale + hidden_channel = out_channels // scale + + self.blocks = nn.ModuleList( + [ + TDNNBlock( + in_channel, + hidden_channel, + kernel_size=kernel_size, + dilation=dilation, + ) + for i in range(scale - 1) + ] + ) + self.scale = scale + + def forward(self, x): + y = [] + for i, x_i in enumerate(torch.chunk(x, self.scale, dim=1)): + if i == 0: + y_i = x_i + elif i == 1: + y_i = self.blocks[i - 1](x_i) + else: + y_i = self.blocks[i - 1](x_i + y_i) + y.append(y_i) + y = torch.cat(y, dim=1) + return y + + +class SEBlock(nn.Module): + """An implementation of squeeze-and-excitation block. + + Arguments + --------- + in_channels : int + The number of input channels. + se_channels : int + The number of output channels after squeeze. + out_channels : int + The number of output channels. + + Example + ------- + >>> inp_tensor = torch.rand([8, 120, 64]).transpose(1, 2) + >>> se_layer = SEBlock(64, 16, 64) + >>> lengths = torch.rand((8,)) + >>> out_tensor = se_layer(inp_tensor, lengths).transpose(1, 2) + >>> out_tensor.shape + torch.Size([8, 120, 64]) + """ + + def __init__(self, in_channels, se_channels, out_channels): + super(SEBlock, self).__init__() + + self.conv1 = Conv1d(in_channels=in_channels, out_channels=se_channels, kernel_size=1) + self.relu = torch.nn.ReLU(inplace=True) + self.conv2 = Conv1d(in_channels=se_channels, out_channels=out_channels, kernel_size=1) + self.sigmoid = torch.nn.Sigmoid() + + def forward(self, x, lengths=None): + L = x.shape[-1] + if lengths is not None: + mask = length_to_mask(lengths * L, max_len=L, device=x.device) + mask = mask.unsqueeze(1) + total = mask.sum(dim=2, keepdim=True) + s = (x * mask).sum(dim=2, keepdim=True) / total + else: + s = x.mean(dim=2, keepdim=True) + + s = self.relu(self.conv1(s)) + s = self.sigmoid(self.conv2(s)) + + return s * x + + +class AttentiveStatisticsPooling(nn.Module): + """This class implements an attentive statistic pooling layer for each channel. + It returns the concatenated mean and std of the input tensor. + + Arguments + --------- + channels: int + The number of input channels. + attention_channels: int + The number of attention channels. + + Example + ------- + >>> inp_tensor = torch.rand([8, 120, 64]).transpose(1, 2) + >>> asp_layer = AttentiveStatisticsPooling(64) + >>> lengths = torch.rand((8,)) + >>> out_tensor = asp_layer(inp_tensor, lengths).transpose(1, 2) + >>> out_tensor.shape + torch.Size([8, 1, 128]) + """ + + def __init__(self, channels, attention_channels=128, global_context=True): + super().__init__() + + self.eps = 1e-12 + self.global_context = global_context + if global_context: + self.tdnn = TDNNBlock(channels * 3, attention_channels, 1, 1) + else: + self.tdnn = TDNNBlock(channels, attention_channels, 1, 1) + self.tanh = nn.Tanh() + self.conv = Conv1d(in_channels=attention_channels, out_channels=channels, kernel_size=1) + + def forward(self, x, lengths=None): + """Calculates mean and std for a batch (input tensor). + + Arguments + --------- + x : torch.Tensor + Tensor of shape [N, C, L]. + """ + L = x.shape[-1] + + def _compute_statistics(x, m, dim=2, eps=self.eps): + mean = (m * x).sum(dim) + std = torch.sqrt((m * (x - mean.unsqueeze(dim)).pow(2)).sum(dim).clamp(eps)) + return mean, std + + if lengths is None: + lengths = torch.ones(x.shape[0], device=x.device) + + # Make binary mask of shape [N, 1, L] + mask = length_to_mask(lengths * L, max_len=L, device=x.device) + mask = mask.unsqueeze(1) + + # Expand the temporal context of the pooling layer by allowing the + # self-attention to look at global properties of the utterance. + if self.global_context: + # torch.std is unstable for backward computation + # https://github.com/pytorch/pytorch/issues/4320 + total = mask.sum(dim=2, keepdim=True).float() + mean, std = _compute_statistics(x, mask / total) + mean = mean.unsqueeze(2).repeat(1, 1, L) + std = std.unsqueeze(2).repeat(1, 1, L) + attn = torch.cat([x, mean, std], dim=1) + else: + attn = x + + # Apply layers + attn = self.conv(self.tanh(self.tdnn(attn))) + + # Filter out zero-paddings + attn = attn.masked_fill(mask == 0, float("-inf")) + + attn = F.softmax(attn, dim=2) + mean, std = _compute_statistics(x, attn) + # Append mean and std of the batch + pooled_stats = torch.cat((mean, std), dim=1) + pooled_stats = pooled_stats.unsqueeze(2) + + return pooled_stats + + +class SERes2NetBlock(nn.Module): + """An implementation of building block in ECAPA-TDNN, i.e., + TDNN-Res2Net-TDNN-SEBlock. + + Arguments + ---------- + out_channels: int + The number of output channels. + res2net_scale: int + The scale of the Res2Net block. + kernel_size: int + The kernel size of the TDNN blocks. + dilation: int + The dilation of the Res2Net block. + activation : torch class + A class for constructing the activation layers. + groups: int + Number of blocked connections from input channels to output channels. + + Example + ------- + >>> x = torch.rand(8, 120, 64).transpose(1, 2) + >>> conv = SERes2NetBlock(64, 64, res2net_scale=4) + >>> out = conv(x).transpose(1, 2) + >>> out.shape + torch.Size([8, 120, 64]) + """ + + def __init__( + self, + in_channels, + out_channels, + res2net_scale=8, + se_channels=128, + kernel_size=1, + dilation=1, + activation=torch.nn.ReLU, + groups=1, + ): + super().__init__() + self.out_channels = out_channels + self.tdnn1 = TDNNBlock( + in_channels, + out_channels, + kernel_size=1, + dilation=1, + activation=activation, + groups=groups, + ) + self.res2net_block = Res2NetBlock( + out_channels, out_channels, res2net_scale, kernel_size, dilation + ) + self.tdnn2 = TDNNBlock( + out_channels, + out_channels, + kernel_size=1, + dilation=1, + activation=activation, + groups=groups, + ) + self.se_block = SEBlock(out_channels, se_channels, out_channels) + + self.shortcut = None + if in_channels != out_channels: + self.shortcut = Conv1d( + in_channels=in_channels, + out_channels=out_channels, + kernel_size=1, + ) + + def forward(self, x, lengths=None): + residual = x + if self.shortcut: + residual = self.shortcut(x) + + x = self.tdnn1(x) + x = self.res2net_block(x) + x = self.tdnn2(x) + x = self.se_block(x, lengths) + + return x + residual + + +class ECAPA_TDNN(torch.nn.Module): + """An implementation of the speaker embedding model in a paper. + "ECAPA-TDNN: Emphasized Channel Attention, Propagation and Aggregation in + TDNN Based Speaker Verification" (https://arxiv.org/abs/2005.07143). + + Arguments + --------- + activation : torch class + A class for constructing the activation layers. + channels : list of ints + Output channels for TDNN/SERes2Net layer. + kernel_sizes : list of ints + List of kernel sizes for each layer. + dilations : list of ints + List of dilations for kernels in each layer. + lin_neurons : int + Number of neurons in linear layers. + groups : list of ints + List of groups for kernels in each layer. + + Example + ------- + >>> input_feats = torch.rand([5, 120, 80]) + >>> compute_embedding = ECAPA_TDNN(80, lin_neurons=192) + >>> outputs = compute_embedding(input_feats) + >>> outputs.shape + torch.Size([5, 1, 192]) + """ + + def __init__( + self, + input_size, + lin_neurons=192, + activation=torch.nn.ReLU, + channels=[512, 512, 512, 512, 1536], + kernel_sizes=[5, 3, 3, 3, 1], + dilations=[1, 2, 3, 4, 1], + attention_channels=128, + res2net_scale=8, + se_channels=128, + global_context=True, + groups=[1, 1, 1, 1, 1], + window_size=20, + window_shift=1, + ): + + super().__init__() + assert len(channels) == len(kernel_sizes) + assert len(channels) == len(dilations) + self.channels = channels + self.blocks = nn.ModuleList() + self.window_size = window_size + self.window_shift = window_shift + + # The initial TDNN layer + self.blocks.append( + TDNNBlock( + input_size, + channels[0], + kernel_sizes[0], + dilations[0], + activation, + groups[0], + ) + ) + + # SE-Res2Net layers + for i in range(1, len(channels) - 1): + self.blocks.append( + SERes2NetBlock( + channels[i - 1], + channels[i], + res2net_scale=res2net_scale, + se_channels=se_channels, + kernel_size=kernel_sizes[i], + dilation=dilations[i], + activation=activation, + groups=groups[i], + ) + ) + + # Multi-layer feature aggregation + self.mfa = TDNNBlock( + channels[-1], + channels[-1], + kernel_sizes[-1], + dilations[-1], + activation, + groups=groups[-1], + ) + + # Attentive Statistical Pooling + self.asp = AttentiveStatisticsPooling( + channels[-1], + attention_channels=attention_channels, + global_context=global_context, + ) + self.asp_bn = BatchNorm1d(input_size=channels[-1] * 2) + + # Final linear transformation + self.fc = Conv1d( + in_channels=channels[-1] * 2, + out_channels=lin_neurons, + kernel_size=1, + ) + + def windowed_pooling(self, x, lengths=None): + # x: Batch, Channel, Time + tt = x.shape[2] + num_chunk = int(math.ceil(tt / self.window_shift)) + pad = self.window_size // 2 + x = F.pad(x, (pad, pad, 0, 0), "reflect") + stat_list = [] + + for i in range(num_chunk): + # B x C + st, ed = i * self.window_shift, i * self.window_shift + self.window_size + x = self.asp( + x[:, :, st:ed], + lengths=( + torch.clamp(lengths - i, 0, self.window_size) if lengths is not None else None + ), + ) + x = self.asp_bn(x) + x = self.fc(x) + stat_list.append(x) + + return torch.cat(stat_list, dim=2) + + def forward(self, x, lengths=None): + """Returns the embedding vector. + + Arguments + --------- + x : torch.Tensor + Tensor of shape (batch, time, channel). + lengths: torch.Tensor + Tensor of shape (batch, ) + """ + # Minimize transpose for efficiency + x = x.transpose(1, 2) + + xl = [] + for layer in self.blocks: + try: + x = layer(x, lengths=lengths) + except TypeError: + x = layer(x) + xl.append(x) + + # Multi-layer feature aggregation + x = torch.cat(xl[1:], dim=1) + x = self.mfa(x) + + if self.window_size is None: + # Attentive Statistical Pooling + x = self.asp(x, lengths=lengths) + x = self.asp_bn(x) + # Final linear transformation + x = self.fc(x) + # x = x.transpose(1, 2) + x = x.squeeze(2) # -> B, C + else: + x = self.windowed_pooling(x, lengths) + x = x.transpose(1, 2) # -> B, T, C + return x diff --git a/funasr/models/sond/encoder/fsmn_encoder.py b/funasr/models/sond/encoder/fsmn_encoder.py new file mode 100644 index 0000000..9ec9912 --- /dev/null +++ b/funasr/models/sond/encoder/fsmn_encoder.py @@ -0,0 +1,180 @@ +from typing import List +from typing import Optional +from typing import Sequence +from typing import Tuple +from typing import Union +import logging +import torch +import torch.nn as nn +from torch.nn import functional as F +import numpy as np +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.encoder.abs_encoder import AbsEncoder +import math +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.multi_layer_conv import FsmnFeedForward + + +class FsmnBlock(torch.nn.Module): + def __init__( + self, + n_feat, + dropout_rate, + kernel_size, + fsmn_shift=0, + ): + super().__init__() + self.dropout = nn.Dropout(p=dropout_rate) + self.fsmn_block = nn.Conv1d( + n_feat, n_feat, kernel_size, stride=1, padding=0, groups=n_feat, bias=False + ) + # padding + left_padding = (kernel_size - 1) // 2 + if fsmn_shift > 0: + left_padding = left_padding + fsmn_shift + right_padding = kernel_size - 1 - left_padding + self.pad_fn = nn.ConstantPad1d((left_padding, right_padding), 0.0) + + def forward(self, inputs, mask, mask_shfit_chunk=None): + b, t, d = inputs.size() + if mask is not None: + mask = torch.reshape(mask, (b, -1, 1)) + if mask_shfit_chunk is not None: + mask = mask * mask_shfit_chunk + + inputs = inputs * mask + x = inputs.transpose(1, 2) + x = self.pad_fn(x) + x = self.fsmn_block(x) + x = x.transpose(1, 2) + x = x + inputs + x = self.dropout(x) + return x * mask + + +class EncoderLayer(torch.nn.Module): + def __init__(self, in_size, size, feed_forward, fsmn_block, dropout_rate=0.0): + super().__init__() + self.in_size = in_size + self.size = size + self.ffn = feed_forward + self.memory = fsmn_block + self.dropout = nn.Dropout(dropout_rate) + + def forward( + self, xs_pad: torch.Tensor, mask: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + # xs_pad in Batch, Time, Dim + + context = self.ffn(xs_pad)[0] + memory = self.memory(context, mask) + + memory = self.dropout(memory) + if self.in_size == self.size: + return memory + xs_pad, mask + + return memory, mask + + +class FsmnEncoder(AbsEncoder): + """Encoder using Fsmn""" + + def __init__( + self, + in_units, + filter_size, + fsmn_num_layers, + dnn_num_layers, + num_memory_units=512, + ffn_inner_dim=2048, + dropout_rate=0.0, + shift=0, + position_encoder=None, + sample_rate=1, + out_units=None, + tf2torch_tensor_name_prefix_torch="post_net", + tf2torch_tensor_name_prefix_tf="EAND/post_net", + ): + """Initializes the parameters of the encoder. + + Args: + filter_size: the total order of memory block + fsmn_num_layers: The number of fsmn layers. + dnn_num_layers: The number of dnn layers + num_units: The number of memory units. + ffn_inner_dim: The number of units of the inner linear transformation + in the feed forward layer. + dropout_rate: The probability to drop units from the outputs. + shift: left padding, to control delay + position_encoder: The :class:`opennmt.layers.position.PositionEncoder` to + apply on inputs or ``None``. + """ + super(FsmnEncoder, self).__init__() + self.in_units = in_units + self.filter_size = filter_size + self.fsmn_num_layers = fsmn_num_layers + self.dnn_num_layers = dnn_num_layers + self.num_memory_units = num_memory_units + self.ffn_inner_dim = ffn_inner_dim + self.dropout_rate = dropout_rate + self.shift = shift + if not isinstance(shift, list): + self.shift = [shift for _ in range(self.fsmn_num_layers)] + self.sample_rate = sample_rate + if not isinstance(sample_rate, list): + self.sample_rate = [sample_rate for _ in range(self.fsmn_num_layers)] + self.position_encoder = position_encoder + self.dropout = nn.Dropout(dropout_rate) + self.out_units = out_units + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + + self.fsmn_layers = repeat( + self.fsmn_num_layers, + lambda lnum: EncoderLayer( + in_units if lnum == 0 else num_memory_units, + num_memory_units, + FsmnFeedForward( + in_units if lnum == 0 else num_memory_units, + ffn_inner_dim, + num_memory_units, + 1, + dropout_rate, + ), + FsmnBlock(num_memory_units, dropout_rate, filter_size, self.shift[lnum]), + ), + ) + + self.dnn_layers = repeat( + dnn_num_layers, + lambda lnum: FsmnFeedForward( + num_memory_units, + ffn_inner_dim, + num_memory_units, + 1, + dropout_rate, + ), + ) + if out_units is not None: + self.conv1d = nn.Conv1d(num_memory_units, out_units, 1, 1) + + def output_size(self) -> int: + return self.num_memory_units + + def forward( + self, xs_pad: torch.Tensor, ilens: torch.Tensor, prev_states: torch.Tensor = None + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + inputs = xs_pad + if self.position_encoder is not None: + inputs = self.position_encoder(inputs) + + inputs = self.dropout(inputs) + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + inputs = self.fsmn_layers(inputs, masks)[0] + inputs = self.dnn_layers(inputs)[0] + + if self.out_units is not None: + inputs = self.conv1d(inputs.transpose(1, 2)).transpose(1, 2) + + return inputs, ilens, None diff --git a/funasr/models/sond/encoder/resnet34_encoder.py b/funasr/models/sond/encoder/resnet34_encoder.py new file mode 100644 index 0000000..ba577a3 --- /dev/null +++ b/funasr/models/sond/encoder/resnet34_encoder.py @@ -0,0 +1,462 @@ +import torch +from torch.nn import functional as F +from funasr.models.encoder.abs_encoder import AbsEncoder +from typing import Tuple, Optional +from funasr.models.pooling.statistic_pooling import statistic_pooling, windowed_statistic_pooling +from collections import OrderedDict +import logging +import numpy as np + + +class BasicLayer(torch.nn.Module): + + def __init__(self, in_filters: int, filters: int, stride: int, bn_momentum: float = 0.5): + + super().__init__() + self.stride = stride + self.in_filters = in_filters + self.filters = filters + + self.bn1 = torch.nn.BatchNorm2d(in_filters, eps=1e-3, momentum=bn_momentum, affine=True) + self.relu1 = torch.nn.ReLU() + self.conv1 = torch.nn.Conv2d(in_filters, filters, 3, stride, bias=False) + + self.bn2 = torch.nn.BatchNorm2d(filters, eps=1e-3, momentum=bn_momentum, affine=True) + self.relu2 = torch.nn.ReLU() + self.conv2 = torch.nn.Conv2d(filters, filters, 3, 1, bias=False) + + if in_filters != filters or stride > 1: + self.conv_sc = torch.nn.Conv2d(in_filters, filters, 1, stride, bias=False) + self.bn_sc = torch.nn.BatchNorm2d(filters, eps=1e-3, momentum=bn_momentum, affine=True) + + def proper_padding(self, x, stride): + # align padding mode to tf.layers.conv2d with padding_mod="same" + if stride == 1: + return F.pad(x, (1, 1, 1, 1), "constant", 0) + elif stride == 2: + h, w = x.size(2), x.size(3) + # (left, right, top, bottom) + return F.pad(x, (w % 2, 1, h % 2, 1), "constant", 0) + + def forward(self, xs_pad, ilens): + identity = xs_pad + if self.in_filters != self.filters or self.stride > 1: + identity = self.conv_sc(identity) + identity = self.bn_sc(identity) + + xs_pad = self.relu1(self.bn1(xs_pad)) + xs_pad = self.proper_padding(xs_pad, self.stride) + xs_pad = self.conv1(xs_pad) + + xs_pad = self.relu2(self.bn2(xs_pad)) + xs_pad = self.proper_padding(xs_pad, 1) + xs_pad = self.conv2(xs_pad) + + if self.stride == 2: + ilens = (ilens + 1) // self.stride + + return xs_pad + identity, ilens + + +class BasicBlock(torch.nn.Module): + def __init__(self, in_filters, filters, num_layer, stride, bn_momentum=0.5): + super().__init__() + self.num_layer = num_layer + + for i in range(num_layer): + layer = BasicLayer( + in_filters if i == 0 else filters, filters, stride if i == 0 else 1, bn_momentum + ) + self.add_module("layer_{}".format(i), layer) + + def forward(self, xs_pad, ilens): + + for i in range(self.num_layer): + xs_pad, ilens = self._modules["layer_{}".format(i)](xs_pad, ilens) + + return xs_pad, ilens + + +class ResNet34(AbsEncoder): + def __init__( + self, + input_size, + use_head_conv=True, + batchnorm_momentum=0.5, + use_head_maxpool=False, + num_nodes_pooling_layer=256, + layers_in_block=(3, 4, 6, 3), + filters_in_block=(32, 64, 128, 256), + ): + super(ResNet34, self).__init__() + + self.use_head_conv = use_head_conv + self.use_head_maxpool = use_head_maxpool + self.num_nodes_pooling_layer = num_nodes_pooling_layer + self.layers_in_block = layers_in_block + self.filters_in_block = filters_in_block + self.input_size = input_size + + pre_filters = filters_in_block[0] + if use_head_conv: + self.pre_conv = torch.nn.Conv2d( + 1, pre_filters, 3, 1, 1, bias=False, padding_mode="zeros" + ) + self.pre_conv_bn = torch.nn.BatchNorm2d( + pre_filters, eps=1e-3, momentum=batchnorm_momentum + ) + + if use_head_maxpool: + self.head_maxpool = torch.nn.MaxPool2d(3, 1, padding=1) + + for i in range(len(layers_in_block)): + if i == 0: + in_filters = pre_filters if self.use_head_conv else 1 + else: + in_filters = filters_in_block[i - 1] + + block = BasicBlock( + in_filters, + filters=filters_in_block[i], + num_layer=layers_in_block[i], + stride=1 if i == 0 else 2, + bn_momentum=batchnorm_momentum, + ) + self.add_module("block_{}".format(i), block) + + self.resnet0_dense = torch.nn.Conv2d(filters_in_block[-1], num_nodes_pooling_layer, 1) + self.resnet0_bn = torch.nn.BatchNorm2d( + num_nodes_pooling_layer, eps=1e-3, momentum=batchnorm_momentum + ) + + self.time_ds_ratio = 8 + + def output_size(self) -> int: + return self.num_nodes_pooling_layer + + def forward( + self, xs_pad: torch.Tensor, ilens: torch.Tensor, prev_states: torch.Tensor = None + ) -> Tuple[torch.Tensor, torch.Tensor]: + + features = xs_pad + assert ( + features.size(-1) == self.input_size + ), "Dimension of features {} doesn't match the input_size {}.".format( + features.size(-1), self.input_size + ) + features = torch.unsqueeze(features, dim=1) + if self.use_head_conv: + features = self.pre_conv(features) + features = self.pre_conv_bn(features) + features = F.relu(features) + + if self.use_head_maxpool: + features = self.head_maxpool(features) + + resnet_outs, resnet_out_lens = features, ilens + for i in range(len(self.layers_in_block)): + block = self._modules["block_{}".format(i)] + resnet_outs, resnet_out_lens = block(resnet_outs, resnet_out_lens) + + features = self.resnet0_dense(resnet_outs) + features = F.relu(features) + features = self.resnet0_bn(features) + + return features, resnet_out_lens + + +# Note: For training, this implement is not equivalent to tf because of the kernel_regularizer in tf.layers. +# TODO: implement kernel_regularizer in torch with munal loss addition or weigth_decay in the optimizer +class ResNet34_SP_L2Reg(AbsEncoder): + def __init__( + self, + input_size, + use_head_conv=True, + batchnorm_momentum=0.5, + use_head_maxpool=False, + num_nodes_pooling_layer=256, + layers_in_block=(3, 4, 6, 3), + filters_in_block=(32, 64, 128, 256), + tf2torch_tensor_name_prefix_torch="encoder", + tf2torch_tensor_name_prefix_tf="EAND/speech_encoder", + tf_train_steps=720000, + ): + super(ResNet34_SP_L2Reg, self).__init__() + + self.use_head_conv = use_head_conv + self.use_head_maxpool = use_head_maxpool + self.num_nodes_pooling_layer = num_nodes_pooling_layer + self.layers_in_block = layers_in_block + self.filters_in_block = filters_in_block + self.input_size = input_size + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + self.tf_train_steps = tf_train_steps + + pre_filters = filters_in_block[0] + if use_head_conv: + self.pre_conv = torch.nn.Conv2d( + 1, pre_filters, 3, 1, 1, bias=False, padding_mode="zeros" + ) + self.pre_conv_bn = torch.nn.BatchNorm2d( + pre_filters, eps=1e-3, momentum=batchnorm_momentum + ) + + if use_head_maxpool: + self.head_maxpool = torch.nn.MaxPool2d(3, 1, padding=1) + + for i in range(len(layers_in_block)): + if i == 0: + in_filters = pre_filters if self.use_head_conv else 1 + else: + in_filters = filters_in_block[i - 1] + + block = BasicBlock( + in_filters, + filters=filters_in_block[i], + num_layer=layers_in_block[i], + stride=1 if i == 0 else 2, + bn_momentum=batchnorm_momentum, + ) + self.add_module("block_{}".format(i), block) + + self.resnet0_dense = torch.nn.Conv1d( + filters_in_block[-1] * input_size // 8, num_nodes_pooling_layer, 1 + ) + self.resnet0_bn = torch.nn.BatchNorm1d( + num_nodes_pooling_layer, eps=1e-3, momentum=batchnorm_momentum + ) + + self.time_ds_ratio = 8 + + def output_size(self) -> int: + return self.num_nodes_pooling_layer + + def forward( + self, xs_pad: torch.Tensor, ilens: torch.Tensor, prev_states: torch.Tensor = None + ) -> Tuple[torch.Tensor, torch.Tensor]: + + features = xs_pad + assert ( + features.size(-1) == self.input_size + ), "Dimension of features {} doesn't match the input_size {}.".format( + features.size(-1), self.input_size + ) + features = torch.unsqueeze(features, dim=1) + if self.use_head_conv: + features = self.pre_conv(features) + features = self.pre_conv_bn(features) + features = F.relu(features) + + if self.use_head_maxpool: + features = self.head_maxpool(features) + + resnet_outs, resnet_out_lens = features, ilens + for i in range(len(self.layers_in_block)): + block = self._modules["block_{}".format(i)] + resnet_outs, resnet_out_lens = block(resnet_outs, resnet_out_lens) + + # B, C, T, F + bb, cc, tt, ff = resnet_outs.shape + resnet_outs = torch.reshape(resnet_outs.permute(0, 3, 1, 2), [bb, ff * cc, tt]) + features = self.resnet0_dense(resnet_outs) + features = F.relu(features) + features = self.resnet0_bn(features) + + return features, resnet_out_lens + + +class ResNet34Diar(ResNet34): + def __init__( + self, + input_size, + embedding_node="resnet1_dense", + use_head_conv=True, + batchnorm_momentum=0.5, + use_head_maxpool=False, + num_nodes_pooling_layer=256, + layers_in_block=(3, 4, 6, 3), + filters_in_block=(32, 64, 128, 256), + num_nodes_resnet1=256, + num_nodes_last_layer=256, + pooling_type="window_shift", + pool_size=20, + stride=1, + tf2torch_tensor_name_prefix_torch="encoder", + tf2torch_tensor_name_prefix_tf="seq2seq/speech_encoder", + ): + """ + Author: Speech Lab, Alibaba Group, China + SOND: Speaker Overlap-aware Neural Diarization for Multi-party Meeting Analysis + https://arxiv.org/abs/2211.10243 + """ + + super(ResNet34Diar, self).__init__( + input_size, + use_head_conv=use_head_conv, + batchnorm_momentum=batchnorm_momentum, + use_head_maxpool=use_head_maxpool, + num_nodes_pooling_layer=num_nodes_pooling_layer, + layers_in_block=layers_in_block, + filters_in_block=filters_in_block, + ) + + self.embedding_node = embedding_node + self.num_nodes_resnet1 = num_nodes_resnet1 + self.num_nodes_last_layer = num_nodes_last_layer + self.pooling_type = pooling_type + self.pool_size = pool_size + self.stride = stride + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + + self.resnet1_dense = torch.nn.Linear(num_nodes_pooling_layer * 2, num_nodes_resnet1) + self.resnet1_bn = torch.nn.BatchNorm1d( + num_nodes_resnet1, eps=1e-3, momentum=batchnorm_momentum + ) + + self.resnet2_dense = torch.nn.Linear(num_nodes_resnet1, num_nodes_last_layer) + self.resnet2_bn = torch.nn.BatchNorm1d( + num_nodes_last_layer, eps=1e-3, momentum=batchnorm_momentum + ) + + def output_size(self) -> int: + if self.embedding_node.startswith("resnet1"): + return self.num_nodes_resnet1 + elif self.embedding_node.startswith("resnet2"): + return self.num_nodes_last_layer + + return self.num_nodes_pooling_layer + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + + endpoints = OrderedDict() + res_out, ilens = super().forward(xs_pad, ilens) + endpoints["resnet0_bn"] = res_out + if self.pooling_type == "frame_gsp": + features = statistic_pooling(res_out, ilens, (3,)) + else: + features, ilens = windowed_statistic_pooling( + res_out, ilens, (2, 3), self.pool_size, self.stride + ) + features = features.transpose(1, 2) + endpoints["pooling"] = features + + features = self.resnet1_dense(features) + endpoints["resnet1_dense"] = features + features = F.relu(features) + endpoints["resnet1_relu"] = features + features = self.resnet1_bn(features.transpose(1, 2)).transpose(1, 2) + endpoints["resnet1_bn"] = features + + features = self.resnet2_dense(features) + endpoints["resnet2_dense"] = features + features = F.relu(features) + endpoints["resnet2_relu"] = features + features = self.resnet2_bn(features.transpose(1, 2)).transpose(1, 2) + endpoints["resnet2_bn"] = features + + return endpoints[self.embedding_node], ilens, None + + +class ResNet34SpL2RegDiar(ResNet34_SP_L2Reg): + def __init__( + self, + input_size, + embedding_node="resnet1_dense", + use_head_conv=True, + batchnorm_momentum=0.5, + use_head_maxpool=False, + num_nodes_pooling_layer=256, + layers_in_block=(3, 4, 6, 3), + filters_in_block=(32, 64, 128, 256), + num_nodes_resnet1=256, + num_nodes_last_layer=256, + pooling_type="window_shift", + pool_size=20, + stride=1, + tf2torch_tensor_name_prefix_torch="encoder", + tf2torch_tensor_name_prefix_tf="seq2seq/speech_encoder", + ): + """ + Author: Speech Lab, Alibaba Group, China + TOLD: A Novel Two-Stage Overlap-Aware Framework for Speaker Diarization + https://arxiv.org/abs/2303.05397 + """ + + super(ResNet34SpL2RegDiar, self).__init__( + input_size, + use_head_conv=use_head_conv, + batchnorm_momentum=batchnorm_momentum, + use_head_maxpool=use_head_maxpool, + num_nodes_pooling_layer=num_nodes_pooling_layer, + layers_in_block=layers_in_block, + filters_in_block=filters_in_block, + ) + + self.embedding_node = embedding_node + self.num_nodes_resnet1 = num_nodes_resnet1 + self.num_nodes_last_layer = num_nodes_last_layer + self.pooling_type = pooling_type + self.pool_size = pool_size + self.stride = stride + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + + self.resnet1_dense = torch.nn.Linear(num_nodes_pooling_layer * 2, num_nodes_resnet1) + self.resnet1_bn = torch.nn.BatchNorm1d( + num_nodes_resnet1, eps=1e-3, momentum=batchnorm_momentum + ) + + self.resnet2_dense = torch.nn.Linear(num_nodes_resnet1, num_nodes_last_layer) + self.resnet2_bn = torch.nn.BatchNorm1d( + num_nodes_last_layer, eps=1e-3, momentum=batchnorm_momentum + ) + + def output_size(self) -> int: + if self.embedding_node.startswith("resnet1"): + return self.num_nodes_resnet1 + elif self.embedding_node.startswith("resnet2"): + return self.num_nodes_last_layer + + return self.num_nodes_pooling_layer + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + + endpoints = OrderedDict() + res_out, ilens = super().forward(xs_pad, ilens) + endpoints["resnet0_bn"] = res_out + if self.pooling_type == "frame_gsp": + features = statistic_pooling(res_out, ilens, (2,)) + else: + features, ilens = windowed_statistic_pooling( + res_out, ilens, (2,), self.pool_size, self.stride + ) + features = features.transpose(1, 2) + endpoints["pooling"] = features + + features = self.resnet1_dense(features) + endpoints["resnet1_dense"] = features + features = F.relu(features) + endpoints["resnet1_relu"] = features + features = self.resnet1_bn(features.transpose(1, 2)).transpose(1, 2) + endpoints["resnet1_bn"] = features + + features = self.resnet2_dense(features) + endpoints["resnet2_dense"] = features + features = F.relu(features) + endpoints["resnet2_relu"] = features + features = self.resnet2_bn(features.transpose(1, 2)).transpose(1, 2) + endpoints["resnet2_bn"] = features + + return endpoints[self.embedding_node], ilens, None diff --git a/funasr/models/sond/encoder/self_attention_encoder.py b/funasr/models/sond/encoder/self_attention_encoder.py new file mode 100644 index 0000000..2e979b1 --- /dev/null +++ b/funasr/models/sond/encoder/self_attention_encoder.py @@ -0,0 +1,333 @@ +from typing import List +from typing import Optional +from typing import Sequence +from typing import Tuple +from typing import Union +import logging +import torch +import torch.nn as nn +from funasr.models.scama.chunk_utilis import overlap_chunk +import numpy as np +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.sond.attention import MultiHeadSelfAttention +from funasr.models.transformer.embedding import SinusoidalPositionEncoder +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling2 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling6 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling8 +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.utils.subsampling import check_short_utt +from funasr.models.ctc import CTC +from funasr.models.encoder.abs_encoder import AbsEncoder + + +class EncoderLayer(nn.Module): + def __init__( + self, + in_size, + size, + self_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayer, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(in_size) + self.norm2 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.in_size = in_size + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + self.dropout_rate = dropout_rate + + def forward(self, x, mask, cache=None, mask_att_chunk_encoder=None): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + return x, mask + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if self.concat_after: + x_concat = torch.cat( + (x, self.self_attn(x, mask, mask_att_chunk_encoder=mask_att_chunk_encoder)), dim=-1 + ) + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = stoch_layer_coeff * self.concat_linear(x_concat) + else: + if self.in_size == self.size: + x = residual + stoch_layer_coeff * self.dropout( + self.self_attn(x, mask, mask_att_chunk_encoder=mask_att_chunk_encoder) + ) + else: + x = stoch_layer_coeff * self.dropout( + self.self_attn(x, mask, mask_att_chunk_encoder=mask_att_chunk_encoder) + ) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + stoch_layer_coeff * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm2(x) + + return x, mask, cache, mask_att_chunk_encoder + + +class SelfAttentionEncoder(AbsEncoder): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Self attention encoder in OpenNMT framework + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: Optional[str] = "conv2d", + pos_enc_class=SinusoidalPositionEncoder, + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 1, + padding_idx: int = -1, + interctc_layer_idx: List[int] = [], + interctc_use_conditioning: bool = False, + tf2torch_tensor_name_prefix_torch: str = "encoder", + tf2torch_tensor_name_prefix_tf: str = "seq2seq/encoder", + out_units=None, + ): + super().__init__() + self._output_size = output_size + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling(input_size, output_size, dropout_rate) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2(input_size, output_size, dropout_rate) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6(input_size, output_size, dropout_rate) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8(input_size, output_size, dropout_rate) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + SinusoidalPositionEncoder(), + ) + elif input_layer is None: + if input_size == output_size: + self.embed = None + else: + self.embed = torch.nn.Linear(input_size, output_size) + elif input_layer == "pe": + self.embed = SinusoidalPositionEncoder() + elif input_layer == "null": + self.embed = None + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + + self.encoders = repeat( + num_blocks, + lambda lnum: ( + EncoderLayer( + output_size, + output_size, + MultiHeadSelfAttention( + attention_heads, + output_size, + output_size, + attention_dropout_rate, + ), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ) + if lnum > 0 + else EncoderLayer( + input_size, + output_size, + MultiHeadSelfAttention( + attention_heads, + input_size if input_layer == "pe" or input_layer == "null" else output_size, + output_size, + attention_dropout_rate, + ), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ) + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + + self.interctc_layer_idx = interctc_layer_idx + if len(interctc_layer_idx) > 0: + assert 0 < min(interctc_layer_idx) and max(interctc_layer_idx) < num_blocks + self.interctc_use_conditioning = interctc_use_conditioning + self.conditioning_layer = None + self.dropout = nn.Dropout(dropout_rate) + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + self.out_units = out_units + if out_units is not None: + self.output_linear = nn.Linear(output_size, out_units) + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ctc: CTC = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Embed positions in tensor. + + Args: + xs_pad: input tensor (B, L, D) + ilens: input length (B) + prev_states: Not to be used now. + Returns: + position embedded tensor and mask + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + xs_pad = xs_pad * self.output_size() ** 0.5 + if self.embed is None: + xs_pad = xs_pad + elif ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + + xs_pad = self.dropout(xs_pad) + # encoder_outs = self.encoders0(xs_pad, masks) + # xs_pad, masks = encoder_outs[0], encoder_outs[1] + intermediate_outs = [] + if len(self.interctc_layer_idx) == 0: + encoder_outs = self.encoders(xs_pad, masks) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + else: + for layer_idx, encoder_layer in enumerate(self.encoders): + encoder_outs = encoder_layer(xs_pad, masks) + xs_pad, masks = encoder_outs[0], encoder_outs[1] + + if layer_idx + 1 in self.interctc_layer_idx: + encoder_out = xs_pad + + # intermediate outputs are also normalized + if self.normalize_before: + encoder_out = self.after_norm(encoder_out) + + intermediate_outs.append((layer_idx + 1, encoder_out)) + + if self.interctc_use_conditioning: + ctc_out = ctc.softmax(encoder_out) + xs_pad = xs_pad + self.conditioning_layer(ctc_out) + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + if self.out_units is not None: + xs_pad = self.output_linear(xs_pad) + olens = masks.squeeze(1).sum(1) + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), olens, None + return xs_pad, olens, None diff --git a/funasr/models/sond/label_aggregation.py b/funasr/models/sond/label_aggregation.py new file mode 100644 index 0000000..dddc4c4 --- /dev/null +++ b/funasr/models/sond/label_aggregation.py @@ -0,0 +1,113 @@ +import torch +from typing import Optional +from typing import Tuple +from torch.nn import functional as F +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class LabelAggregate(torch.nn.Module): + def __init__( + self, + win_length: int = 512, + hop_length: int = 128, + center: bool = True, + ): + super().__init__() + + self.win_length = win_length + self.hop_length = hop_length + self.center = center + + def extra_repr(self): + return ( + f"win_length={self.win_length}, " + f"hop_length={self.hop_length}, " + f"center={self.center}, " + ) + + def forward( + self, input: torch.Tensor, ilens: torch.Tensor = None + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """LabelAggregate forward function. + + Args: + input: (Batch, Nsamples, Label_dim) + ilens: (Batch) + Returns: + output: (Batch, Frames, Label_dim) + + """ + bs = input.size(0) + max_length = input.size(1) + label_dim = input.size(2) + + # NOTE(jiatong): + # The default behaviour of label aggregation is compatible with + # torch.stft about framing and padding. + + # Step1: center padding + if self.center: + pad = self.win_length // 2 + max_length = max_length + 2 * pad + input = torch.nn.functional.pad(input, (0, 0, pad, pad), "constant", 0) + input[:, :pad, :] = input[:, pad : (2 * pad), :] + input[:, (max_length - pad) : max_length, :] = input[ + :, (max_length - 2 * pad) : (max_length - pad), : + ] + nframe = (max_length - self.win_length) // self.hop_length + 1 + + # Step2: framing + output = input.as_strided( + (bs, nframe, self.win_length, label_dim), + (max_length * label_dim, self.hop_length * label_dim, label_dim, 1), + ) + + # Step3: aggregate label + output = torch.gt(output.sum(dim=2, keepdim=False), self.win_length // 2) + output = output.float() + + # Step4: process lengths + if ilens is not None: + if self.center: + pad = self.win_length // 2 + ilens = ilens + 2 * pad + + olens = (ilens - self.win_length) // self.hop_length + 1 + output.masked_fill_(make_pad_mask(olens, output, 1), 0.0) + else: + olens = None + + return output.to(input.dtype), olens + + +class LabelAggregateMaxPooling(torch.nn.Module): + def __init__( + self, + hop_length: int = 8, + ): + super().__init__() + + self.hop_length = hop_length + + def extra_repr(self): + return f"hop_length={self.hop_length}, " + + def forward( + self, input: torch.Tensor, ilens: torch.Tensor = None + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """LabelAggregate forward function. + + Args: + input: (Batch, Nsamples, Label_dim) + ilens: (Batch) + Returns: + output: (Batch, Frames, Label_dim) + + """ + + output = F.max_pool1d(input.transpose(1, 2), self.hop_length, self.hop_length).transpose( + 1, 2 + ) + olens = ilens // self.hop_length + + return output.to(input.dtype), olens diff --git a/funasr/models/sond/pooling/__init__.py b/funasr/models/sond/pooling/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/sond/pooling/pooling_layers.py b/funasr/models/sond/pooling/pooling_layers.py new file mode 100644 index 0000000..0a426a9 --- /dev/null +++ b/funasr/models/sond/pooling/pooling_layers.py @@ -0,0 +1,107 @@ +# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +""" This implementation is adapted from https://github.com/wenet-e2e/wespeaker.""" + +import torch +import torch.nn as nn + + +class TAP(nn.Module): + """ + Temporal average pooling, only first-order mean is considered + """ + + def __init__(self, **kwargs): + super(TAP, self).__init__() + + def forward(self, x): + pooling_mean = x.mean(dim=-1) + # To be compatable with 2D input + pooling_mean = pooling_mean.flatten(start_dim=1) + return pooling_mean + + +class TSDP(nn.Module): + """ + Temporal standard deviation pooling, only second-order std is considered + """ + + def __init__(self, **kwargs): + super(TSDP, self).__init__() + + def forward(self, x): + # The last dimension is the temporal axis + pooling_std = torch.sqrt(torch.var(x, dim=-1) + 1e-8) + pooling_std = pooling_std.flatten(start_dim=1) + return pooling_std + + +class TSTP(nn.Module): + """ + Temporal statistics pooling, concatenate mean and std, which is used in + x-vector + Comment: simple concatenation can not make full use of both statistics + """ + + def __init__(self, **kwargs): + super(TSTP, self).__init__() + + def forward(self, x): + # The last dimension is the temporal axis + pooling_mean = x.mean(dim=-1) + pooling_std = torch.sqrt(torch.var(x, dim=-1) + 1e-8) + pooling_mean = pooling_mean.flatten(start_dim=1) + pooling_std = pooling_std.flatten(start_dim=1) + + stats = torch.cat((pooling_mean, pooling_std), 1) + return stats + + +class ASTP(nn.Module): + """Attentive statistics pooling: Channel- and context-dependent + statistics pooling, first used in ECAPA_TDNN. + """ + + def __init__(self, in_dim, bottleneck_dim=128, global_context_att=False): + super(ASTP, self).__init__() + self.global_context_att = global_context_att + + # Use Conv1d with stride == 1 rather than Linear, then we don't + # need to transpose inputs. + if global_context_att: + self.linear1 = nn.Conv1d( + in_dim * 3, bottleneck_dim, kernel_size=1 + ) # equals W and b in the paper + else: + self.linear1 = nn.Conv1d( + in_dim, bottleneck_dim, kernel_size=1 + ) # equals W and b in the paper + self.linear2 = nn.Conv1d( + bottleneck_dim, in_dim, kernel_size=1 + ) # equals V and k in the paper + + def forward(self, x): + """ + x: a 3-dimensional tensor in tdnn-based architecture (B,F,T) + or a 4-dimensional tensor in resnet architecture (B,C,F,T) + 0-dim: batch-dimension, last-dim: time-dimension (frame-dimension) + """ + if len(x.shape) == 4: + x = x.reshape(x.shape[0], x.shape[1] * x.shape[2], x.shape[3]) + assert len(x.shape) == 3 + + if self.global_context_att: + context_mean = torch.mean(x, dim=-1, keepdim=True).expand_as(x) + context_std = torch.sqrt(torch.var(x, dim=-1, keepdim=True) + 1e-10).expand_as(x) + x_in = torch.cat((x, context_mean, context_std), dim=1) + else: + x_in = x + + # DON'T use ReLU here! ReLU may be hard to converge. + alpha = torch.tanh(self.linear1(x_in)) # alpha = F.relu(self.linear1(x_in)) + alpha = torch.softmax(self.linear2(alpha), dim=2) + mean = torch.sum(alpha * x, dim=2) + var = torch.sum(alpha * (x**2), dim=2) - mean**2 + std = torch.sqrt(var.clamp(min=1e-10)) + return torch.cat([mean, std], dim=1) diff --git a/funasr/models/sond/pooling/statistic_pooling.py b/funasr/models/sond/pooling/statistic_pooling.py new file mode 100644 index 0000000..91db239 --- /dev/null +++ b/funasr/models/sond/pooling/statistic_pooling.py @@ -0,0 +1,98 @@ +import torch +from typing import Tuple +from typing import Union +from funasr.models.transformer.utils.nets_utils import make_non_pad_mask +from torch.nn import functional as F +import math + +VAR2STD_EPSILON = 1e-12 + + +class StatisticPooling(torch.nn.Module): + def __init__(self, pooling_dim: Union[int, Tuple] = 2, eps=1e-12): + super(StatisticPooling, self).__init__() + if isinstance(pooling_dim, int): + pooling_dim = (pooling_dim,) + self.pooling_dim = pooling_dim + self.eps = eps + + def forward(self, xs_pad, ilens=None): + # xs_pad in (Batch, Channel, Time, Frequency) + + if ilens is None: + masks = torch.ones_like(xs_pad).to(xs_pad) + else: + masks = make_non_pad_mask(ilens, xs_pad, length_dim=2).to(xs_pad) + mean = torch.sum(xs_pad, dim=self.pooling_dim, keepdim=True) / torch.sum( + masks, dim=self.pooling_dim, keepdim=True + ) + squared_difference = torch.pow(xs_pad - mean, 2.0) + variance = torch.sum(squared_difference, dim=self.pooling_dim, keepdim=True) / torch.sum( + masks, dim=self.pooling_dim, keepdim=True + ) + for i in reversed(self.pooling_dim): + mean, variance = torch.squeeze(mean, dim=i), torch.squeeze(variance, dim=i) + + mask = torch.less_equal(variance, self.eps).float() + variance = (1.0 - mask) * variance + mask * self.eps + stddev = torch.sqrt(variance) + + stat_pooling = torch.cat([mean, stddev], dim=1) + + return stat_pooling + + +def statistic_pooling( + xs_pad: torch.Tensor, ilens: torch.Tensor = None, pooling_dim: Tuple = (2, 3) +) -> torch.Tensor: + # xs_pad in (Batch, Channel, Time, Frequency) + + if ilens is None: + seq_mask = torch.ones_like(xs_pad).to(xs_pad) + else: + seq_mask = make_non_pad_mask(ilens, xs_pad, length_dim=2).to(xs_pad) + mean = torch.sum(xs_pad, dim=pooling_dim, keepdim=True) / torch.sum( + seq_mask, dim=pooling_dim, keepdim=True + ) + squared_difference = torch.pow(xs_pad - mean, 2.0) + variance = torch.sum(squared_difference, dim=pooling_dim, keepdim=True) / torch.sum( + seq_mask, dim=pooling_dim, keepdim=True + ) + for i in reversed(pooling_dim): + mean, variance = torch.squeeze(mean, dim=i), torch.squeeze(variance, dim=i) + + value_mask = torch.less_equal(variance, VAR2STD_EPSILON).float() + variance = (1.0 - value_mask) * variance + value_mask * VAR2STD_EPSILON + stddev = torch.sqrt(variance) + + stat_pooling = torch.cat([mean, stddev], dim=1) + + return stat_pooling + + +def windowed_statistic_pooling( + xs_pad: torch.Tensor, + ilens: torch.Tensor = None, + pooling_dim: Tuple = (2, 3), + pooling_size: int = 20, + pooling_stride: int = 1, +) -> Tuple[torch.Tensor, int]: + # xs_pad in (Batch, Channel, Time, Frequency) + + tt = xs_pad.shape[2] + num_chunk = int(math.ceil(tt / pooling_stride)) + pad = pooling_size // 2 + if len(xs_pad.shape) == 4: + features = F.pad(xs_pad, (0, 0, pad, pad), "replicate") + else: + features = F.pad(xs_pad, (pad, pad), "replicate") + stat_list = [] + + for i in range(num_chunk): + # B x C + st, ed = i * pooling_stride, i * pooling_stride + pooling_size + stat = statistic_pooling(features[:, :, st:ed], pooling_dim=pooling_dim) + stat_list.append(stat.unsqueeze(2)) + + # B x C x T + return torch.cat(stat_list, dim=2), ilens / pooling_stride diff --git a/funasr/models/sond/sv_decoder.py b/funasr/models/sond/sv_decoder.py new file mode 100644 index 0000000..7d8484d --- /dev/null +++ b/funasr/models/sond/sv_decoder.py @@ -0,0 +1,41 @@ +import torch +from torch.nn import functional as F +from funasr.models.decoder.abs_decoder import AbsDecoder + + +class DenseDecoder(AbsDecoder): + def __init__( + self, + vocab_size, + encoder_output_size, + num_nodes_resnet1: int = 256, + num_nodes_last_layer: int = 256, + batchnorm_momentum: float = 0.5, + ): + super(DenseDecoder, self).__init__() + self.resnet1_dense = torch.nn.Linear(encoder_output_size, num_nodes_resnet1) + self.resnet1_bn = torch.nn.BatchNorm1d( + num_nodes_resnet1, eps=1e-3, momentum=batchnorm_momentum + ) + + self.resnet2_dense = torch.nn.Linear(num_nodes_resnet1, num_nodes_last_layer) + self.resnet2_bn = torch.nn.BatchNorm1d( + num_nodes_last_layer, eps=1e-3, momentum=batchnorm_momentum + ) + + self.output_dense = torch.nn.Linear(num_nodes_last_layer, vocab_size, bias=False) + + def forward(self, features): + embeddings = {} + features = self.resnet1_dense(features) + embeddings["resnet1_dense"] = features + features = F.relu(features) + features = self.resnet1_bn(features) + + features = self.resnet2_dense(features) + embeddings["resnet2_dense"] = features + features = F.relu(features) + features = self.resnet2_bn(features) + + features = self.output_dense(features) + return features, embeddings diff --git a/funasr/models/specaug/__init__.py b/funasr/models/specaug/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/specaug/mask_along_axis.py b/funasr/models/specaug/mask_along_axis.py new file mode 100644 index 0000000..d4f237b --- /dev/null +++ b/funasr/models/specaug/mask_along_axis.py @@ -0,0 +1,336 @@ +import math +import torch +from typing import Sequence +from typing import Union + + +def mask_along_axis( + spec: torch.Tensor, + spec_lengths: torch.Tensor, + mask_width_range: Sequence[int] = (0, 30), + dim: int = 1, + num_mask: int = 2, + replace_with_zero: bool = True, +): + """Apply mask along the specified direction. + + Args: + spec: (Batch, Length, Freq) + spec_lengths: (Length): Not using lengths in this implementation + mask_width_range: Select the width randomly between this range + """ + + org_size = spec.size() + if spec.dim() == 4: + # spec: (Batch, Channel, Length, Freq) -> (Batch * Channel, Length, Freq) + spec = spec.view(-1, spec.size(2), spec.size(3)) + + B = spec.shape[0] + # D = Length or Freq + D = spec.shape[dim] + # mask_length: (B, num_mask, 1) + mask_length = torch.randint( + mask_width_range[0], + mask_width_range[1], + (B, num_mask), + device=spec.device, + ).unsqueeze(2) + + # mask_pos: (B, num_mask, 1) + mask_pos = torch.randint( + 0, max(1, D - mask_length.max()), (B, num_mask), device=spec.device + ).unsqueeze(2) + + # aran: (1, 1, D) + aran = torch.arange(D, device=spec.device)[None, None, :] + # mask: (Batch, num_mask, D) + mask = (mask_pos <= aran) * (aran < (mask_pos + mask_length)) + # Multiply masks: (Batch, num_mask, D) -> (Batch, D) + mask = mask.any(dim=1) + if dim == 1: + # mask: (Batch, Length, 1) + mask = mask.unsqueeze(2) + elif dim == 2: + # mask: (Batch, 1, Freq) + mask = mask.unsqueeze(1) + + if replace_with_zero: + value = 0.0 + else: + value = spec.mean() + + if spec.requires_grad: + spec = spec.masked_fill(mask, value) + else: + spec = spec.masked_fill_(mask, value) + spec = spec.view(*org_size) + return spec, spec_lengths + + +def mask_along_axis_lfr( + spec: torch.Tensor, + spec_lengths: torch.Tensor, + mask_width_range: Sequence[int] = (0, 30), + dim: int = 1, + num_mask: int = 2, + replace_with_zero: bool = True, + lfr_rate: int = 1, +): + """Apply mask along the specified direction. + + Args: + spec: (Batch, Length, Freq) + spec_lengths: (Length): Not using lengths in this implementation + mask_width_range: Select the width randomly between this range + lfr_rate:low frame rate + """ + + org_size = spec.size() + if spec.dim() == 4: + # spec: (Batch, Channel, Length, Freq) -> (Batch * Channel, Length, Freq) + spec = spec.view(-1, spec.size(2), spec.size(3)) + + B = spec.shape[0] + # D = Length or Freq + D = spec.shape[dim] // lfr_rate + # mask_length: (B, num_mask, 1) + mask_length = torch.randint( + mask_width_range[0], + mask_width_range[1], + (B, num_mask), + device=spec.device, + ).unsqueeze(2) + if lfr_rate > 1: + mask_length = mask_length.repeat(1, lfr_rate, 1) + # mask_pos: (B, num_mask, 1) + mask_pos = torch.randint( + 0, max(1, D - mask_length.max()), (B, num_mask), device=spec.device + ).unsqueeze(2) + if lfr_rate > 1: + mask_pos_raw = mask_pos.clone() + mask_pos = torch.zeros((B, 0, 1), device=spec.device, dtype=torch.int32) + for i in range(lfr_rate): + mask_pos_i = mask_pos_raw + D * i + mask_pos = torch.cat((mask_pos, mask_pos_i), dim=1) + # aran: (1, 1, D) + D = spec.shape[dim] + aran = torch.arange(D, device=spec.device)[None, None, :] + # mask: (Batch, num_mask, D) + mask = (mask_pos <= aran) * (aran < (mask_pos + mask_length)) + # Multiply masks: (Batch, num_mask, D) -> (Batch, D) + mask = mask.any(dim=1) + if dim == 1: + # mask: (Batch, Length, 1) + mask = mask.unsqueeze(2) + elif dim == 2: + # mask: (Batch, 1, Freq) + mask = mask.unsqueeze(1) + + if replace_with_zero: + value = 0.0 + else: + value = spec.mean() + + if spec.requires_grad: + spec = spec.masked_fill(mask, value) + else: + spec = spec.masked_fill_(mask, value) + spec = spec.view(*org_size) + return spec, spec_lengths + + +class MaskAlongAxis(torch.nn.Module): + def __init__( + self, + mask_width_range: Union[int, Sequence[int]] = (0, 30), + num_mask: int = 2, + dim: Union[int, str] = "time", + replace_with_zero: bool = True, + ): + if isinstance(mask_width_range, int): + mask_width_range = (0, mask_width_range) + if len(mask_width_range) != 2: + raise TypeError( + f"mask_width_range must be a tuple of int and int values: " f"{mask_width_range}", + ) + + assert mask_width_range[1] > mask_width_range[0] + if isinstance(dim, str): + if dim == "time": + dim = 1 + elif dim == "freq": + dim = 2 + else: + raise ValueError("dim must be int, 'time' or 'freq'") + if dim == 1: + self.mask_axis = "time" + elif dim == 2: + self.mask_axis = "freq" + else: + self.mask_axis = "unknown" + + super().__init__() + self.mask_width_range = mask_width_range + self.num_mask = num_mask + self.dim = dim + self.replace_with_zero = replace_with_zero + + def extra_repr(self): + return ( + f"mask_width_range={self.mask_width_range}, " + f"num_mask={self.num_mask}, axis={self.mask_axis}" + ) + + def forward(self, spec: torch.Tensor, spec_lengths: torch.Tensor = None): + """Forward function. + + Args: + spec: (Batch, Length, Freq) + """ + + return mask_along_axis( + spec, + spec_lengths, + mask_width_range=self.mask_width_range, + dim=self.dim, + num_mask=self.num_mask, + replace_with_zero=self.replace_with_zero, + ) + + +class MaskAlongAxisVariableMaxWidth(torch.nn.Module): + """Mask input spec along a specified axis with variable maximum width. + + Formula: + max_width = max_width_ratio * seq_len + """ + + def __init__( + self, + mask_width_ratio_range: Union[float, Sequence[float]] = (0.0, 0.05), + num_mask: int = 2, + dim: Union[int, str] = "time", + replace_with_zero: bool = True, + ): + if isinstance(mask_width_ratio_range, float): + mask_width_ratio_range = (0.0, mask_width_ratio_range) + if len(mask_width_ratio_range) != 2: + raise TypeError( + f"mask_width_ratio_range must be a tuple of float and float values: " + f"{mask_width_ratio_range}", + ) + + assert mask_width_ratio_range[1] > mask_width_ratio_range[0] + if isinstance(dim, str): + if dim == "time": + dim = 1 + elif dim == "freq": + dim = 2 + else: + raise ValueError("dim must be int, 'time' or 'freq'") + if dim == 1: + self.mask_axis = "time" + elif dim == 2: + self.mask_axis = "freq" + else: + self.mask_axis = "unknown" + + super().__init__() + self.mask_width_ratio_range = mask_width_ratio_range + self.num_mask = num_mask + self.dim = dim + self.replace_with_zero = replace_with_zero + + def extra_repr(self): + return ( + f"mask_width_ratio_range={self.mask_width_ratio_range}, " + f"num_mask={self.num_mask}, axis={self.mask_axis}" + ) + + def forward(self, spec: torch.Tensor, spec_lengths: torch.Tensor = None): + """Forward function. + + Args: + spec: (Batch, Length, Freq) + """ + + max_seq_len = spec.shape[self.dim] + min_mask_width = math.floor(max_seq_len * self.mask_width_ratio_range[0]) + min_mask_width = max([0, min_mask_width]) + max_mask_width = math.floor(max_seq_len * self.mask_width_ratio_range[1]) + max_mask_width = min([max_seq_len, max_mask_width]) + + if max_mask_width > min_mask_width: + return mask_along_axis( + spec, + spec_lengths, + mask_width_range=(min_mask_width, max_mask_width), + dim=self.dim, + num_mask=self.num_mask, + replace_with_zero=self.replace_with_zero, + ) + return spec, spec_lengths + + +class MaskAlongAxisLFR(torch.nn.Module): + def __init__( + self, + mask_width_range: Union[int, Sequence[int]] = (0, 30), + num_mask: int = 2, + dim: Union[int, str] = "time", + replace_with_zero: bool = True, + lfr_rate: int = 1, + ): + if isinstance(mask_width_range, int): + mask_width_range = (0, mask_width_range) + if len(mask_width_range) != 2: + raise TypeError( + f"mask_width_range must be a tuple of int and int values: " f"{mask_width_range}", + ) + + assert mask_width_range[1] > mask_width_range[0] + if isinstance(dim, str): + if dim == "time": + dim = 1 + lfr_rate = 1 + elif dim == "freq": + dim = 2 + else: + raise ValueError("dim must be int, 'time' or 'freq'") + if dim == 1: + self.mask_axis = "time" + lfr_rate = 1 + elif dim == 2: + self.mask_axis = "freq" + else: + self.mask_axis = "unknown" + + super().__init__() + self.mask_width_range = mask_width_range + self.num_mask = num_mask + self.dim = dim + self.replace_with_zero = replace_with_zero + self.lfr_rate = lfr_rate + + def extra_repr(self): + return ( + f"mask_width_range={self.mask_width_range}, " + f"num_mask={self.num_mask}, axis={self.mask_axis}" + ) + + def forward(self, spec: torch.Tensor, spec_lengths: torch.Tensor = None): + """Forward function. + + Args: + spec: (Batch, Length, Freq) + """ + + return mask_along_axis_lfr( + spec, + spec_lengths, + mask_width_range=self.mask_width_range, + dim=self.dim, + num_mask=self.num_mask, + replace_with_zero=self.replace_with_zero, + lfr_rate=self.lfr_rate, + ) diff --git a/funasr/models/specaug/profileaug.py b/funasr/models/specaug/profileaug.py new file mode 100644 index 0000000..669d323 --- /dev/null +++ b/funasr/models/specaug/profileaug.py @@ -0,0 +1,142 @@ +from typing import Tuple, Optional +import numpy as np +import torch +from torch.nn import functional as F +import torch.nn as nn + + +class ProfileAug(nn.Module): + """ + Implement the augmentation for profiles including: + - Split aug: split one profile into two profiles, i.e., main and inaccurate, labels assigned to main + - Merge aug: merge two profiles into one, labels are also merged into one, the other set to zero + - Disturb aug: disturb some profile with others to simulate the inaccurate clustering centroids. + """ + + def __init__( + self, + apply_split_aug: bool = True, + split_aug_prob: float = 0.05, + apply_merge_aug: bool = True, + merge_aug_prob: float = 0.2, + apply_disturb_aug: bool = True, + disturb_aug_prob: float = 0.4, + disturb_alpha: float = 0.2, + ) -> None: + super().__init__() + self.apply_split_aug = apply_split_aug + self.split_aug_prob = split_aug_prob + self.apply_merge_aug = apply_merge_aug + self.merge_aug_prob = merge_aug_prob + self.apply_disturb_aug = apply_disturb_aug + self.disturb_aug_prob = disturb_aug_prob + self.disturb_alpha = disturb_alpha + + def split_aug(self, profile: torch.Tensor, binary_labels: torch.Tensor, mask: torch.Tensor): + # B, N + bsz, dim = profile.shape[0], profile.shape[-1] + profile_norm = torch.linalg.norm(profile, dim=-1, keepdim=False) + spk_count = binary_labels.sum(dim=1) + prob = np.random.rand(bsz) + batch_indices = np.nonzero(prob < self.split_aug_prob)[0] + for idx in batch_indices: + valid_spk_idx = torch.nonzero(spk_count[idx] * mask[idx]) + pad_spk_idx = torch.nonzero((spk_count[idx] == 0) * mask[idx]) + if len(valid_spk_idx) == 0 or len(pad_spk_idx) == 0: + continue + split_spk_idx = valid_spk_idx[torch.randint(len(valid_spk_idx), ())] + to_cover_idx = pad_spk_idx[torch.randint(len(pad_spk_idx), ())] + disturb_vec = torch.randn((dim,)).to(profile) + disturb_vec = F.normalize(disturb_vec, dim=-1) + profile[idx, to_cover_idx] = F.normalize( + profile[idx, split_spk_idx] + self.disturb_alpha * disturb_vec + ) + mask[idx, split_spk_idx] = 0 + mask[idx, to_cover_idx] = 0 + return profile, binary_labels, mask + + def merge_aug(self, profile: torch.Tensor, binary_labels: torch.Tensor, mask: torch.Tensor): + bsz, dim = profile.shape[0], profile.shape[-1] + profile_norm = torch.linalg.norm(profile, dim=-1, keepdim=False) + spk_count = binary_labels.sum(dim=1) + prob = np.random.rand(bsz) + batch_indices = np.nonzero(prob < self.merge_aug_prob)[0] + for idx in batch_indices: + valid_spk_idx = torch.nonzero(profile_norm[idx] * mask[idx]) + if len(valid_spk_idx) == 0: + continue + to_merge = torch.randint(len(valid_spk_idx), (2,)) + spk_idx_1, spk_idx_2 = valid_spk_idx[to_merge[0]], valid_spk_idx[to_merge[1]] + # merge profile + profile[idx, spk_idx_1] = profile[idx, spk_idx_1] + profile[idx, spk_idx_2] + profile[idx, spk_idx_1] = F.normalize(profile[idx, spk_idx_1], dim=-1) + profile[idx, spk_idx_2] = 0 + # merge binary labels + binary_labels[idx, :, spk_idx_1] = ( + binary_labels[idx, :, spk_idx_1] + binary_labels[idx, :, spk_idx_2] + ) + binary_labels[idx, :, spk_idx_1] = (binary_labels[idx, :, spk_idx_1] > 0).to( + binary_labels + ) + binary_labels[idx, :, spk_idx_2] = 0 + + mask[idx, spk_idx_1] = 0 + mask[idx, spk_idx_2] = 0 + + return profile, binary_labels, mask + + def disturb_aug(self, profile: torch.Tensor, binary_labels: torch.Tensor, mask: torch.Tensor): + bsz, dim = profile.shape[0], profile.shape[-1] + profile_norm = torch.linalg.norm(profile, dim=-1, keepdim=False) + spk_count = binary_labels.sum(dim=1) + prob = np.random.rand(bsz) + batch_indices = np.nonzero(prob < self.disturb_aug_prob)[0] + for idx in batch_indices: + pos_spk_idx = torch.nonzero(spk_count[idx] * mask[idx]) + valid_spk_idx = torch.nonzero(profile_norm[idx] * mask[idx]) + if len(pos_spk_idx) == 0 or len(valid_spk_idx) == 0: + continue + to_disturb_idx = pos_spk_idx[torch.randint(len(pos_spk_idx), ())] + disturb_idx = valid_spk_idx[torch.randint(len(valid_spk_idx), ())] + alpha = self.disturb_alpha * torch.rand(()).item() + profile[idx, to_disturb_idx] = (1 - alpha) * profile[ + idx, to_disturb_idx + ] + alpha * profile[idx, disturb_idx] + profile[idx, to_disturb_idx] = F.normalize(profile[idx, to_disturb_idx], dim=-1) + mask[idx, to_disturb_idx] = 0 + + return profile, binary_labels, mask + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor = None, + profile: torch.Tensor = None, + profile_lengths: torch.Tensor = None, + binary_labels: torch.Tensor = None, + labels_length: torch.Tensor = None, + ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[torch.Tensor]]: + + # copy inputs to avoid inplace-operation + speech, profile, binary_labels = ( + torch.clone(speech), + torch.clone(profile), + torch.clone(binary_labels), + ) + profile = F.normalize(profile, dim=-1) + + profile_mask = torch.ones(profile.shape[:2]).to(profile) + if self.apply_disturb_aug: + profile, binary_labels, profile_mask = self.disturb_aug( + profile, binary_labels, profile_mask + ) + if self.apply_split_aug: + profile, binary_labels, profile_mask = self.split_aug( + profile, binary_labels, profile_mask + ) + if self.apply_merge_aug: + profile, binary_labels, profile_mask = self.merge_aug( + profile, binary_labels, profile_mask + ) + + return speech, profile, binary_labels diff --git a/funasr/models/specaug/specaug.py b/funasr/models/specaug/specaug.py new file mode 100644 index 0000000..75a4b0b --- /dev/null +++ b/funasr/models/specaug/specaug.py @@ -0,0 +1,186 @@ +"""SpecAugment module.""" + +from typing import Optional +from typing import Sequence +from typing import Union + +from funasr.models.specaug.mask_along_axis import MaskAlongAxis +from funasr.models.specaug.mask_along_axis import MaskAlongAxisVariableMaxWidth +from funasr.models.specaug.mask_along_axis import MaskAlongAxisLFR +from funasr.models.specaug.time_warp import TimeWarp +from funasr.register import tables + +import torch.nn as nn + + +@tables.register("specaug_classes", "SpecAug") +class SpecAug(nn.Module): + """Implementation of SpecAug. + + Reference: + Daniel S. Park et al. + "SpecAugment: A Simple Data + Augmentation Method for Automatic Speech Recognition" + + .. warning:: + When using cuda mode, time_warp doesn't have reproducibility + due to `torch.nn.functional.interpolate`. + + """ + + def __init__( + self, + apply_time_warp: bool = True, + time_warp_window: int = 5, + time_warp_mode: str = "bicubic", + apply_freq_mask: bool = True, + freq_mask_width_range: Union[int, Sequence[int]] = (0, 20), + num_freq_mask: int = 2, + apply_time_mask: bool = True, + time_mask_width_range: Optional[Union[int, Sequence[int]]] = None, + time_mask_width_ratio_range: Optional[Union[float, Sequence[float]]] = None, + num_time_mask: int = 2, + ): + if not apply_time_warp and not apply_time_mask and not apply_freq_mask: + raise ValueError("Either one of time_warp, time_mask, or freq_mask should be applied") + if ( + apply_time_mask + and (time_mask_width_range is not None) + and (time_mask_width_ratio_range is not None) + ): + raise ValueError( + 'Either one of "time_mask_width_range" or ' + '"time_mask_width_ratio_range" can be used' + ) + super().__init__() + self.apply_time_warp = apply_time_warp + self.apply_freq_mask = apply_freq_mask + self.apply_time_mask = apply_time_mask + + if apply_time_warp: + self.time_warp = TimeWarp(window=time_warp_window, mode=time_warp_mode) + else: + self.time_warp = None + + if apply_freq_mask: + self.freq_mask = MaskAlongAxis( + dim="freq", + mask_width_range=freq_mask_width_range, + num_mask=num_freq_mask, + ) + else: + self.freq_mask = None + + if apply_time_mask: + if time_mask_width_range is not None: + self.time_mask = MaskAlongAxis( + dim="time", + mask_width_range=time_mask_width_range, + num_mask=num_time_mask, + ) + elif time_mask_width_ratio_range is not None: + self.time_mask = MaskAlongAxisVariableMaxWidth( + dim="time", + mask_width_ratio_range=time_mask_width_ratio_range, + num_mask=num_time_mask, + ) + else: + raise ValueError( + 'Either one of "time_mask_width_range" or ' + '"time_mask_width_ratio_range" should be used.' + ) + else: + self.time_mask = None + + def forward(self, x, x_lengths=None): + if self.time_warp is not None: + x, x_lengths = self.time_warp(x, x_lengths) + if self.freq_mask is not None: + x, x_lengths = self.freq_mask(x, x_lengths) + if self.time_mask is not None: + x, x_lengths = self.time_mask(x, x_lengths) + return x, x_lengths + + +@tables.register("specaug_classes", "SpecAugLFR") +class SpecAugLFR(nn.Module): + """Implementation of SpecAug. + lfr_rate:low frame rate + """ + + def __init__( + self, + apply_time_warp: bool = True, + time_warp_window: int = 5, + time_warp_mode: str = "bicubic", + apply_freq_mask: bool = True, + freq_mask_width_range: Union[int, Sequence[int]] = (0, 20), + num_freq_mask: int = 2, + lfr_rate: int = 0, + apply_time_mask: bool = True, + time_mask_width_range: Optional[Union[int, Sequence[int]]] = None, + time_mask_width_ratio_range: Optional[Union[float, Sequence[float]]] = None, + num_time_mask: int = 2, + ): + if not apply_time_warp and not apply_time_mask and not apply_freq_mask: + raise ValueError("Either one of time_warp, time_mask, or freq_mask should be applied") + if ( + apply_time_mask + and (time_mask_width_range is not None) + and (time_mask_width_ratio_range is not None) + ): + raise ValueError( + 'Either one of "time_mask_width_range" or ' + '"time_mask_width_ratio_range" can be used' + ) + super().__init__() + self.apply_time_warp = apply_time_warp + self.apply_freq_mask = apply_freq_mask + self.apply_time_mask = apply_time_mask + + if apply_time_warp: + self.time_warp = TimeWarp(window=time_warp_window, mode=time_warp_mode) + else: + self.time_warp = None + + if apply_freq_mask: + self.freq_mask = MaskAlongAxisLFR( + dim="freq", + mask_width_range=freq_mask_width_range, + num_mask=num_freq_mask, + lfr_rate=lfr_rate + 1, + ) + + else: + self.freq_mask = None + + if apply_time_mask: + if time_mask_width_range is not None: + self.time_mask = MaskAlongAxisLFR( + dim="time", + mask_width_range=time_mask_width_range, + num_mask=num_time_mask, + lfr_rate=lfr_rate + 1, + ) + elif time_mask_width_ratio_range is not None: + self.time_mask = MaskAlongAxisVariableMaxWidth( + dim="time", + mask_width_ratio_range=time_mask_width_ratio_range, + num_mask=num_time_mask, + ) + else: + raise ValueError( + 'Either one of "time_mask_width_range" or ' + '"time_mask_width_ratio_range" should be used.' + ) + else: + self.time_mask = None + + def forward(self, x, x_lengths=None): + if self.time_warp is not None: + x, x_lengths = self.time_warp(x, x_lengths) + if self.freq_mask is not None: + x, x_lengths = self.freq_mask(x, x_lengths) + if self.time_mask is not None: + x, x_lengths = self.time_mask(x, x_lengths) + return x, x_lengths diff --git a/funasr/models/specaug/time_warp.py b/funasr/models/specaug/time_warp.py new file mode 100644 index 0000000..ef3532f --- /dev/null +++ b/funasr/models/specaug/time_warp.py @@ -0,0 +1,89 @@ +"""Time warp module.""" + +import torch + +from funasr.models.transformer.utils.nets_utils import pad_list + +DEFAULT_TIME_WARP_MODE = "bicubic" + + +def time_warp(x: torch.Tensor, window: int = 80, mode: str = DEFAULT_TIME_WARP_MODE): + """Time warping using torch.interpolate. + + Args: + x: (Batch, Time, Freq) + window: time warp parameter + mode: Interpolate mode + """ + + # bicubic supports 4D or more dimension tensor + org_size = x.size() + if x.dim() == 3: + # x: (Batch, Time, Freq) -> (Batch, 1, Time, Freq) + x = x[:, None] + + t = x.shape[2] + if t - window <= window: + return x.view(*org_size) + + center = torch.randint(window, t - window, (1,))[0] + warped = torch.randint(center - window, center + window, (1,))[0] + 1 + + # left: (Batch, Channel, warped, Freq) + # right: (Batch, Channel, time - warped, Freq) + left = torch.nn.functional.interpolate( + x[:, :, :center], (warped, x.shape[3]), mode=mode, align_corners=False + ) + right = torch.nn.functional.interpolate( + x[:, :, center:], (t - warped, x.shape[3]), mode=mode, align_corners=False + ) + + if x.requires_grad: + x = torch.cat([left, right], dim=-2) + else: + x[:, :, :warped] = left + x[:, :, warped:] = right + + return x.view(*org_size) + + +class TimeWarp(torch.nn.Module): + """Time warping using torch.interpolate. + + Args: + window: time warp parameter + mode: Interpolate mode + """ + + def __init__(self, window: int = 80, mode: str = DEFAULT_TIME_WARP_MODE): + super().__init__() + self.window = window + self.mode = mode + + def extra_repr(self): + return f"window={self.window}, mode={self.mode}" + + def forward(self, x: torch.Tensor, x_lengths: torch.Tensor = None): + """Forward function. + + Args: + x: (Batch, Time, Freq) + x_lengths: (Batch,) + """ + + if x_lengths is None or all(le == x_lengths[0] for le in x_lengths): + # Note that applying same warping for each sample + y = time_warp(x, window=self.window, mode=self.mode) + else: + # FIXME(kamo): I have no idea to batchify Timewarp + ys = [] + for i in range(x.size(0)): + _y = time_warp( + x[i][None, : x_lengths[i]], + window=self.window, + mode=self.mode, + )[0] + ys.append(_y) + y = pad_list(ys, 0.0) + + return y, x_lengths diff --git a/funasr/models/transducer/__init__.py b/funasr/models/transducer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/transducer/beam_search_transducer.py b/funasr/models/transducer/beam_search_transducer.py new file mode 100644 index 0000000..aa9e34e --- /dev/null +++ b/funasr/models/transducer/beam_search_transducer.py @@ -0,0 +1,694 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import numpy as np +from dataclasses import dataclass +from typing import Any, Dict, List, Optional, Tuple, Union + +from funasr.models.transducer.joint_network import JointNetwork + + +@dataclass +class Hypothesis: + """Default hypothesis definition for Transducer search algorithms. + + Args: + score: Total log-probability. + yseq: Label sequence as integer ID sequence. + dec_state: RNNDecoder or StatelessDecoder state. + ((N, 1, D_dec), (N, 1, D_dec) or None) or None + lm_state: RNNLM state. ((N, D_lm), (N, D_lm)) or None + + """ + + score: float + yseq: List[int] + dec_state: Optional[Tuple[torch.Tensor, Optional[torch.Tensor]]] = None + lm_state: Optional[Union[Dict[str, Any], List[Any]]] = None + + +@dataclass +class ExtendedHypothesis(Hypothesis): + """Extended hypothesis definition for NSC beam search and mAES. + + Args: + : Hypothesis dataclass arguments. + dec_out: Decoder output sequence. (B, D_dec) + lm_score: Log-probabilities of the LM for given label. (vocab_size) + + """ + + dec_out: torch.Tensor = None + lm_score: torch.Tensor = None + + +class BeamSearchTransducer: + """Beam search implementation for Transducer. + + Args: + decoder: Decoder module. + joint_network: Joint network module. + beam_size: Size of the beam. + lm: LM class. + lm_weight: LM weight for soft fusion. + search_type: Search algorithm to use during inference. + max_sym_exp: Number of maximum symbol expansions at each time step. (TSD) + u_max: Maximum expected target sequence length. (ALSD) + nstep: Number of maximum expansion steps at each time step. (mAES) + expansion_gamma: Allowed logp difference for prune-by-value method. (mAES) + expansion_beta: + Number of additional candidates for expanded hypotheses selection. (mAES) + score_norm: Normalize final scores by length. + nbest: Number of final hypothesis. + streaming: Whether to perform chunk-by-chunk beam search. + + """ + + def __init__( + self, + decoder, + joint_network: JointNetwork, + beam_size: int, + lm: Optional[torch.nn.Module] = None, + lm_weight: float = 0.1, + search_type: str = "default", + max_sym_exp: int = 3, + u_max: int = 50, + nstep: int = 2, + expansion_gamma: float = 2.3, + expansion_beta: int = 2, + score_norm: bool = False, + nbest: int = 1, + streaming: bool = False, + ) -> None: + """Construct a BeamSearchTransducer object.""" + super().__init__() + + self.decoder = decoder + self.joint_network = joint_network + + self.vocab_size = decoder.vocab_size + + assert ( + beam_size <= self.vocab_size + ), "beam_size (%d) should be smaller than or equal to vocabulary size (%d)." % ( + beam_size, + self.vocab_size, + ) + self.beam_size = beam_size + + if search_type == "default": + self.search_algorithm = self.default_beam_search + elif search_type == "tsd": + assert max_sym_exp > 1, "max_sym_exp (%d) should be greater than one." % (max_sym_exp) + self.max_sym_exp = max_sym_exp + + self.search_algorithm = self.time_sync_decoding + elif search_type == "alsd": + assert not streaming, "ALSD is not available in streaming mode." + + assert u_max >= 0, "u_max should be a positive integer, a portion of max_T." + self.u_max = u_max + + self.search_algorithm = self.align_length_sync_decoding + elif search_type == "maes": + assert self.vocab_size >= beam_size + expansion_beta, ( + "beam_size (%d) + expansion_beta (%d) " + " should be smaller than or equal to vocab size (%d)." + % (beam_size, expansion_beta, self.vocab_size) + ) + self.max_candidates = beam_size + expansion_beta + + self.nstep = nstep + self.expansion_gamma = expansion_gamma + + self.search_algorithm = self.modified_adaptive_expansion_search + else: + raise NotImplementedError("Specified search type (%s) is not supported." % search_type) + + self.use_lm = lm is not None + + if self.use_lm: + assert hasattr(lm, "rnn_type"), "Transformer LM is currently not supported." + + self.sos = self.vocab_size - 1 + + self.lm = lm + self.lm_weight = lm_weight + + self.score_norm = score_norm + self.nbest = nbest + + self.reset_inference_cache() + + def __call__( + self, + enc_out: torch.Tensor, + is_final: bool = True, + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + enc_out: Encoder output sequence. (T, D_enc) + is_final: Whether enc_out is the final chunk of data. + + Returns: + nbest_hyps: N-best decoding results + + """ + self.decoder.set_device(enc_out.device) + + hyps = self.search_algorithm(enc_out) + + if is_final: + self.reset_inference_cache() + + return self.sort_nbest(hyps) + + self.search_cache = hyps + + return hyps + + def reset_inference_cache(self) -> None: + """Reset cache for decoder scoring and streaming.""" + self.decoder.score_cache = {} + self.search_cache = None + + def sort_nbest(self, hyps: List[Hypothesis]) -> List[Hypothesis]: + """Sort in-place hypotheses by score or score given sequence length. + + Args: + hyps: Hypothesis. + + Return: + hyps: Sorted hypothesis. + + """ + if self.score_norm: + hyps.sort(key=lambda x: x.score / len(x.yseq), reverse=True) + else: + hyps.sort(key=lambda x: x.score, reverse=True) + + return hyps[: self.nbest] + + def recombine_hyps(self, hyps: List[Hypothesis]) -> List[Hypothesis]: + """Recombine hypotheses with same label ID sequence. + + Args: + hyps: Hypotheses. + + Returns: + final: Recombined hypotheses. + + """ + final = {} + + for hyp in hyps: + str_yseq = "_".join(map(str, hyp.yseq)) + + if str_yseq in final: + final[str_yseq].score = np.logaddexp(final[str_yseq].score, hyp.score) + else: + final[str_yseq] = hyp + + return [*final.values()] + + def select_k_expansions( + self, + hyps: List[ExtendedHypothesis], + topk_idx: torch.Tensor, + topk_logp: torch.Tensor, + ) -> List[ExtendedHypothesis]: + """Return K hypotheses candidates for expansion from a list of hypothesis. + + K candidates are selected according to the extended hypotheses probabilities + and a prune-by-value method. Where K is equal to beam_size + beta. + + Args: + hyps: Hypotheses. + topk_idx: Indices of candidates hypothesis. + topk_logp: Log-probabilities of candidates hypothesis. + + Returns: + k_expansions: Best K expansion hypotheses candidates. + + """ + k_expansions = [] + + for i, hyp in enumerate(hyps): + hyp_i = [(int(k), hyp.score + float(v)) for k, v in zip(topk_idx[i], topk_logp[i])] + k_best_exp = max(hyp_i, key=lambda x: x[1])[1] + + k_expansions.append( + sorted( + filter(lambda x: (k_best_exp - self.expansion_gamma) <= x[1], hyp_i), + key=lambda x: x[1], + reverse=True, + ) + ) + + return k_expansions + + def create_lm_batch_inputs(self, hyps_seq: List[List[int]]) -> torch.Tensor: + """Make batch of inputs with left padding for LM scoring. + + Args: + hyps_seq: Hypothesis sequences. + + Returns: + : Padded batch of sequences. + + """ + max_len = max([len(h) for h in hyps_seq]) + + return torch.LongTensor( + [[self.sos] + ([0] * (max_len - len(h))) + h[1:] for h in hyps_seq], + device=self.decoder.device, + ) + + def default_beam_search(self, enc_out: torch.Tensor) -> List[Hypothesis]: + """Beam search implementation without prefix search. + + Modified from https://arxiv.org/pdf/1211.3711.pdf + + Args: + enc_out: Encoder output sequence. (T, D) + + Returns: + nbest_hyps: N-best hypothesis. + + """ + beam_k = min(self.beam_size, (self.vocab_size - 1)) + max_t = len(enc_out) + + if self.search_cache is not None: + kept_hyps = self.search_cache + else: + kept_hyps = [ + Hypothesis( + score=0.0, + yseq=[0], + dec_state=self.decoder.init_state(1), + ) + ] + + for t in range(max_t): + hyps = kept_hyps + kept_hyps = [] + + while True: + max_hyp = max(hyps, key=lambda x: x.score) + hyps.remove(max_hyp) + + label = torch.full( + (1, 1), + max_hyp.yseq[-1], + dtype=torch.long, + device=self.decoder.device, + ) + dec_out, state = self.decoder.score( + label, + max_hyp.yseq, + max_hyp.dec_state, + ) + + logp = torch.log_softmax( + self.joint_network(enc_out[t : t + 1, :], dec_out), + dim=-1, + ).squeeze(0) + top_k = logp[1:].topk(beam_k, dim=-1) + + kept_hyps.append( + Hypothesis( + score=(max_hyp.score + float(logp[0:1])), + yseq=max_hyp.yseq, + dec_state=max_hyp.dec_state, + lm_state=max_hyp.lm_state, + ) + ) + + if self.use_lm: + lm_scores, lm_state = self.lm.score( + torch.LongTensor([self.sos] + max_hyp.yseq[1:], device=self.decoder.device), + max_hyp.lm_state, + None, + ) + else: + lm_state = max_hyp.lm_state + + for logp, k in zip(*top_k): + score = max_hyp.score + float(logp) + + if self.use_lm: + score += self.lm_weight * lm_scores[k + 1] + + hyps.append( + Hypothesis( + score=score, + yseq=max_hyp.yseq + [int(k + 1)], + dec_state=state, + lm_state=lm_state, + ) + ) + + hyps_max = float(max(hyps, key=lambda x: x.score).score) + kept_most_prob = sorted( + [hyp for hyp in kept_hyps if hyp.score > hyps_max], + key=lambda x: x.score, + ) + if len(kept_most_prob) >= self.beam_size: + kept_hyps = kept_most_prob + break + + return kept_hyps + + def align_length_sync_decoding( + self, + enc_out: torch.Tensor, + ) -> List[Hypothesis]: + """Alignment-length synchronous beam search implementation. + + Based on https://ieeexplore.ieee.org/document/9053040 + + Args: + h: Encoder output sequences. (T, D) + + Returns: + nbest_hyps: N-best hypothesis. + + """ + t_max = int(enc_out.size(0)) + u_max = min(self.u_max, (t_max - 1)) + + B = [Hypothesis(yseq=[0], score=0.0, dec_state=self.decoder.init_state(1))] + final = [] + + if self.use_lm: + B[0].lm_state = self.lm.zero_state() + + for i in range(t_max + u_max): + A = [] + + B_ = [] + B_enc_out = [] + for hyp in B: + u = len(hyp.yseq) - 1 + t = i - u + + if t > (t_max - 1): + continue + + B_.append(hyp) + B_enc_out.append((t, enc_out[t])) + + if B_: + beam_enc_out = torch.stack([b[1] for b in B_enc_out]) + beam_dec_out, beam_state = self.decoder.batch_score(B_) + + beam_logp = torch.log_softmax( + self.joint_network(beam_enc_out, beam_dec_out), + dim=-1, + ) + beam_topk = beam_logp[:, 1:].topk(self.beam_size, dim=-1) + + if self.use_lm: + beam_lm_scores, beam_lm_states = self.lm.batch_score( + self.create_lm_batch_inputs([b.yseq for b in B_]), + [b.lm_state for b in B_], + None, + ) + + for i, hyp in enumerate(B_): + new_hyp = Hypothesis( + score=(hyp.score + float(beam_logp[i, 0])), + yseq=hyp.yseq[:], + dec_state=hyp.dec_state, + lm_state=hyp.lm_state, + ) + + A.append(new_hyp) + + if B_enc_out[i][0] == (t_max - 1): + final.append(new_hyp) + + for logp, k in zip(beam_topk[0][i], beam_topk[1][i] + 1): + new_hyp = Hypothesis( + score=(hyp.score + float(logp)), + yseq=(hyp.yseq[:] + [int(k)]), + dec_state=self.decoder.select_state(beam_state, i), + lm_state=hyp.lm_state, + ) + + if self.use_lm: + new_hyp.score += self.lm_weight * beam_lm_scores[i, k] + new_hyp.lm_state = beam_lm_states[i] + + A.append(new_hyp) + + B = sorted(A, key=lambda x: x.score, reverse=True)[: self.beam_size] + B = self.recombine_hyps(B) + + if final: + return final + + return B + + def time_sync_decoding(self, enc_out: torch.Tensor) -> List[Hypothesis]: + """Time synchronous beam search implementation. + + Based on https://ieeexplore.ieee.org/document/9053040 + + Args: + enc_out: Encoder output sequence. (T, D) + + Returns: + nbest_hyps: N-best hypothesis. + + """ + if self.search_cache is not None: + B = self.search_cache + else: + B = [ + Hypothesis( + yseq=[0], + score=0.0, + dec_state=self.decoder.init_state(1), + ) + ] + + if self.use_lm: + B[0].lm_state = self.lm.zero_state() + + for enc_out_t in enc_out: + A = [] + C = B + + enc_out_t = enc_out_t.unsqueeze(0) + + for v in range(self.max_sym_exp): + D = [] + + beam_dec_out, beam_state = self.decoder.batch_score(C) + + beam_logp = torch.log_softmax( + self.joint_network(enc_out_t, beam_dec_out), + dim=-1, + ) + beam_topk = beam_logp[:, 1:].topk(self.beam_size, dim=-1) + + seq_A = [h.yseq for h in A] + + for i, hyp in enumerate(C): + if hyp.yseq not in seq_A: + A.append( + Hypothesis( + score=(hyp.score + float(beam_logp[i, 0])), + yseq=hyp.yseq[:], + dec_state=hyp.dec_state, + lm_state=hyp.lm_state, + ) + ) + else: + dict_pos = seq_A.index(hyp.yseq) + + A[dict_pos].score = np.logaddexp( + A[dict_pos].score, (hyp.score + float(beam_logp[i, 0])) + ) + + if v < (self.max_sym_exp - 1): + if self.use_lm: + beam_lm_scores, beam_lm_states = self.lm.batch_score( + self.create_lm_batch_inputs([c.yseq for c in C]), + [c.lm_state for c in C], + None, + ) + + for i, hyp in enumerate(C): + for logp, k in zip(beam_topk[0][i], beam_topk[1][i] + 1): + new_hyp = Hypothesis( + score=(hyp.score + float(logp)), + yseq=(hyp.yseq + [int(k)]), + dec_state=self.decoder.select_state(beam_state, i), + lm_state=hyp.lm_state, + ) + + if self.use_lm: + new_hyp.score += self.lm_weight * beam_lm_scores[i, k] + new_hyp.lm_state = beam_lm_states[i] + + D.append(new_hyp) + + C = sorted(D, key=lambda x: x.score, reverse=True)[: self.beam_size] + + B = sorted(A, key=lambda x: x.score, reverse=True)[: self.beam_size] + + return B + + def modified_adaptive_expansion_search( + self, + enc_out: torch.Tensor, + ) -> List[ExtendedHypothesis]: + """Modified version of Adaptive Expansion Search (mAES). + + Based on AES (https://ieeexplore.ieee.org/document/9250505) and + NSC (https://arxiv.org/abs/2201.05420). + + Args: + enc_out: Encoder output sequence. (T, D_enc) + + Returns: + nbest_hyps: N-best hypothesis. + + """ + if self.search_cache is not None: + kept_hyps = self.search_cache + else: + init_tokens = [ + ExtendedHypothesis( + yseq=[0], + score=0.0, + dec_state=self.decoder.init_state(1), + ) + ] + + beam_dec_out, beam_state = self.decoder.batch_score( + init_tokens, + ) + + if self.use_lm: + beam_lm_scores, beam_lm_states = self.lm.batch_score( + self.create_lm_batch_inputs([h.yseq for h in init_tokens]), + [h.lm_state for h in init_tokens], + None, + ) + + lm_state = beam_lm_states[0] + lm_score = beam_lm_scores[0] + else: + lm_state = None + lm_score = None + + kept_hyps = [ + ExtendedHypothesis( + yseq=[0], + score=0.0, + dec_state=self.decoder.select_state(beam_state, 0), + dec_out=beam_dec_out[0], + lm_state=lm_state, + lm_score=lm_score, + ) + ] + + for enc_out_t in enc_out: + hyps = kept_hyps + kept_hyps = [] + + beam_enc_out = enc_out_t.unsqueeze(0) + + list_b = [] + for n in range(self.nstep): + beam_dec_out = torch.stack([h.dec_out for h in hyps]) + + beam_logp, beam_idx = torch.log_softmax( + self.joint_network(beam_enc_out, beam_dec_out), + dim=-1, + ).topk(self.max_candidates, dim=-1) + + k_expansions = self.select_k_expansions(hyps, beam_idx, beam_logp) + + list_exp = [] + for i, hyp in enumerate(hyps): + for k, new_score in k_expansions[i]: + new_hyp = ExtendedHypothesis( + yseq=hyp.yseq[:], + score=new_score, + dec_out=hyp.dec_out, + dec_state=hyp.dec_state, + lm_state=hyp.lm_state, + lm_score=hyp.lm_score, + ) + + if k == 0: + list_b.append(new_hyp) + else: + new_hyp.yseq.append(int(k)) + + if self.use_lm: + new_hyp.score += self.lm_weight * float(hyp.lm_score[k]) + + list_exp.append(new_hyp) + + if not list_exp: + kept_hyps = sorted( + self.recombine_hyps(list_b), key=lambda x: x.score, reverse=True + )[: self.beam_size] + + break + else: + beam_dec_out, beam_state = self.decoder.batch_score( + list_exp, + ) + + if self.use_lm: + beam_lm_scores, beam_lm_states = self.lm.batch_score( + self.create_lm_batch_inputs([h.yseq for h in list_exp]), + [h.lm_state for h in list_exp], + None, + ) + + if n < (self.nstep - 1): + for i, hyp in enumerate(list_exp): + hyp.dec_out = beam_dec_out[i] + hyp.dec_state = self.decoder.select_state(beam_state, i) + + if self.use_lm: + hyp.lm_state = beam_lm_states[i] + hyp.lm_score = beam_lm_scores[i] + + hyps = list_exp[:] + else: + beam_logp = torch.log_softmax( + self.joint_network(beam_enc_out, beam_dec_out), + dim=-1, + ) + + for i, hyp in enumerate(list_exp): + hyp.score += float(beam_logp[i, 0]) + + hyp.dec_out = beam_dec_out[i] + hyp.dec_state = self.decoder.select_state(beam_state, i) + + if self.use_lm: + hyp.lm_state = beam_lm_states[i] + hyp.lm_score = beam_lm_scores[i] + + kept_hyps = sorted( + self.recombine_hyps(list_b + list_exp), + key=lambda x: x.score, + reverse=True, + )[: self.beam_size] + + return kept_hyps diff --git a/funasr/models/transducer/joint_network.py b/funasr/models/transducer/joint_network.py new file mode 100644 index 0000000..955d6a0 --- /dev/null +++ b/funasr/models/transducer/joint_network.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch + +from funasr.register import tables +from funasr.models.transformer.utils.nets_utils import get_activation + + +@tables.register("joint_network_classes", "joint_network") +class JointNetwork(torch.nn.Module): + """Transducer joint network module. + + Args: + output_size: Output size. + encoder_size: Encoder output size. + decoder_size: Decoder output size.. + joint_space_size: Joint space size. + joint_act_type: Type of activation for joint network. + **activation_parameters: Parameters for the activation function. + + """ + + def __init__( + self, + output_size: int, + encoder_size: int, + decoder_size: int, + joint_space_size: int = 256, + joint_activation_type: str = "tanh", + ) -> None: + """Construct a JointNetwork object.""" + super().__init__() + + self.lin_enc = torch.nn.Linear(encoder_size, joint_space_size) + self.lin_dec = torch.nn.Linear(decoder_size, joint_space_size, bias=False) + + self.lin_out = torch.nn.Linear(joint_space_size, output_size) + + self.joint_activation = get_activation(joint_activation_type) + + def forward( + self, + enc_out: torch.Tensor, + dec_out: torch.Tensor, + project_input: bool = True, + ) -> torch.Tensor: + """Joint computation of encoder and decoder hidden state sequences. + + Args: + enc_out: Expanded encoder output state sequences (B, T, 1, D_enc) + dec_out: Expanded decoder output state sequences (B, 1, U, D_dec) + + Returns: + joint_out: Joint output state sequences. (B, T, U, D_out) + + """ + if project_input: + joint_out = self.joint_activation(self.lin_enc(enc_out) + self.lin_dec(dec_out)) + else: + joint_out = self.joint_activation(enc_out + dec_out) + return self.lin_out(joint_out) diff --git a/funasr/models/transducer/model.py b/funasr/models/transducer/model.py new file mode 100644 index 0000000..37925fc --- /dev/null +++ b/funasr/models/transducer/model.py @@ -0,0 +1,536 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import time +import torch +import logging +from contextlib import contextmanager +from typing import Dict, Optional, Tuple +from distutils.version import LooseVersion + +from funasr.register import tables +from funasr.utils import postprocess_utils +from funasr.utils.datadir_writer import DatadirWriter +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.transformer.scorers.ctc import CTCPrefixScorer +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.transformer.scorers.length_bonus import LengthBonus +from funasr.models.transformer.utils.nets_utils import get_transducer_task_io +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.models.transducer.beam_search_transducer import BeamSearchTransducer + + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +@tables.register("model_classes", "Transducer") +class Transducer(torch.nn.Module): + def __init__( + self, + frontend: Optional[str] = None, + frontend_conf: Optional[Dict] = None, + specaug: Optional[str] = None, + specaug_conf: Optional[Dict] = None, + normalize: str = None, + normalize_conf: Optional[Dict] = None, + encoder: str = None, + encoder_conf: Optional[Dict] = None, + decoder: str = None, + decoder_conf: Optional[Dict] = None, + joint_network: str = None, + joint_network_conf: Optional[Dict] = None, + transducer_weight: float = 1.0, + fastemit_lambda: float = 0.0, + auxiliary_ctc_weight: float = 0.0, + auxiliary_ctc_dropout_rate: float = 0.0, + auxiliary_lm_loss_weight: float = 0.0, + auxiliary_lm_loss_smoothing: float = 0.0, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + # report_cer: bool = True, + # report_wer: bool = True, + # sym_space: str = "", + # sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + vocab_size=vocab_size, + **decoder_conf, + ) + decoder_output_size = decoder.output_size + + joint_network_class = tables.joint_network_classes.get(joint_network) + joint_network = joint_network_class( + vocab_size, + encoder_output_size, + decoder_output_size, + **joint_network_conf, + ) + + self.criterion_transducer = None + self.error_calculator = None + + self.use_auxiliary_ctc = auxiliary_ctc_weight > 0 + self.use_auxiliary_lm_loss = auxiliary_lm_loss_weight > 0 + + if self.use_auxiliary_ctc: + self.ctc_lin = torch.nn.Linear(encoder.output_size(), vocab_size) + self.ctc_dropout_rate = auxiliary_ctc_dropout_rate + + if self.use_auxiliary_lm_loss: + self.lm_lin = torch.nn.Linear(decoder.output_size, vocab_size) + self.lm_loss_smoothing = auxiliary_lm_loss_smoothing + + self.transducer_weight = transducer_weight + self.fastemit_lambda = fastemit_lambda + + self.auxiliary_ctc_weight = auxiliary_ctc_weight + self.auxiliary_lm_loss_weight = auxiliary_lm_loss_weight + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.frontend = frontend + self.specaug = specaug + self.normalize = normalize + self.encoder = encoder + self.decoder = decoder + self.joint_network = joint_network + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + self.ctc = None + self.ctc_weight = 0.0 + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if ( + hasattr(self.encoder, "overlap_chunk_cls") + and self.encoder.overlap_chunk_cls is not None + ): + encoder_out, encoder_out_lens = self.encoder.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + # 2. Transducer-related I/O preparation + decoder_in, target, t_len, u_len = get_transducer_task_io( + text, + encoder_out_lens, + ignore_id=self.ignore_id, + ) + + # 3. Decoder + self.decoder.set_device(encoder_out.device) + decoder_out = self.decoder(decoder_in, u_len) + + # 4. Joint Network + joint_out = self.joint_network(encoder_out.unsqueeze(2), decoder_out.unsqueeze(1)) + + # 5. Losses + loss_trans, cer_trans, wer_trans = self._calc_transducer_loss( + encoder_out, + joint_out, + target, + t_len, + u_len, + ) + + loss_ctc, loss_lm = 0.0, 0.0 + + if self.use_auxiliary_ctc: + loss_ctc = self._calc_ctc_loss( + encoder_out, + target, + t_len, + u_len, + ) + + if self.use_auxiliary_lm_loss: + loss_lm = self._calc_lm_loss(decoder_out, target) + + loss = ( + self.transducer_weight * loss_trans + + self.auxiliary_ctc_weight * loss_ctc + + self.auxiliary_lm_loss_weight * loss_lm + ) + + stats = dict( + loss=loss.detach(), + loss_transducer=loss_trans.detach(), + aux_ctc_loss=loss_ctc.detach() if loss_ctc > 0.0 else None, + aux_lm_loss=loss_lm.detach() if loss_lm > 0.0 else None, + cer_transducer=cer_trans, + wer_transducer=wer_trans, + ) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + if intermediate_outs is not None: + return (encoder_out, intermediate_outs), encoder_out_lens + + return encoder_out, encoder_out_lens + + def _calc_transducer_loss( + self, + encoder_out: torch.Tensor, + joint_out: torch.Tensor, + target: torch.Tensor, + t_len: torch.Tensor, + u_len: torch.Tensor, + ) -> Tuple[torch.Tensor, Optional[float], Optional[float]]: + """Compute Transducer loss. + + Args: + encoder_out: Encoder output sequences. (B, T, D_enc) + joint_out: Joint Network output sequences (B, T, U, D_joint) + target: Target label ID sequences. (B, L) + t_len: Encoder output sequences lengths. (B,) + u_len: Target label ID sequences lengths. (B,) + + Return: + loss_transducer: Transducer loss value. + cer_transducer: Character error rate for Transducer. + wer_transducer: Word Error Rate for Transducer. + + """ + if self.criterion_transducer is None: + try: + from warp_rnnt import rnnt_loss as RNNTLoss + + self.criterion_transducer = RNNTLoss + + except ImportError: + logging.error( + "warp-rnnt was not installed." "Please consult the installation documentation." + ) + exit(1) + + log_probs = torch.log_softmax(joint_out, dim=-1) + + loss_transducer = self.criterion_transducer( + log_probs, + target, + t_len, + u_len, + reduction="mean", + blank=self.blank_id, + fastemit_lambda=self.fastemit_lambda, + gather=True, + ) + + if not self.training and (self.report_cer or self.report_wer): + if self.error_calculator is None: + from funasr.metrics import ErrorCalculatorTransducer as ErrorCalculator + + self.error_calculator = ErrorCalculator( + self.decoder, + self.joint_network, + self.token_list, + self.sym_space, + self.sym_blank, + report_cer=self.report_cer, + report_wer=self.report_wer, + ) + + cer_transducer, wer_transducer = self.error_calculator(encoder_out, target, t_len) + + return loss_transducer, cer_transducer, wer_transducer + + return loss_transducer, None, None + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + target: torch.Tensor, + t_len: torch.Tensor, + u_len: torch.Tensor, + ) -> torch.Tensor: + """Compute CTC loss. + + Args: + encoder_out: Encoder output sequences. (B, T, D_enc) + target: Target label ID sequences. (B, L) + t_len: Encoder output sequences lengths. (B,) + u_len: Target label ID sequences lengths. (B,) + + Return: + loss_ctc: CTC loss value. + + """ + ctc_in = self.ctc_lin(torch.nn.functional.dropout(encoder_out, p=self.ctc_dropout_rate)) + ctc_in = torch.log_softmax(ctc_in.transpose(0, 1), dim=-1) + + target_mask = target != 0 + ctc_target = target[target_mask].cpu() + + with torch.backends.cudnn.flags(deterministic=True): + loss_ctc = torch.nn.functional.ctc_loss( + ctc_in, + ctc_target, + t_len, + u_len, + zero_infinity=True, + reduction="sum", + ) + loss_ctc /= target.size(0) + + return loss_ctc + + def _calc_lm_loss( + self, + decoder_out: torch.Tensor, + target: torch.Tensor, + ) -> torch.Tensor: + """Compute LM loss. + + Args: + decoder_out: Decoder output sequences. (B, U, D_dec) + target: Target label ID sequences. (B, L) + + Return: + loss_lm: LM loss value. + + """ + lm_loss_in = self.lm_lin(decoder_out[:, :-1, :]).view(-1, self.vocab_size) + lm_target = target.view(-1).type(torch.int64) + + with torch.no_grad(): + true_dist = lm_loss_in.clone() + true_dist.fill_(self.lm_loss_smoothing / (self.vocab_size - 1)) + + # Ignore blank ID (0) + ignore = lm_target == 0 + lm_target = lm_target.masked_fill(ignore, 0) + + true_dist.scatter_(1, lm_target.unsqueeze(1), (1 - self.lm_loss_smoothing)) + + loss_lm = torch.nn.functional.kl_div( + torch.log_softmax(lm_loss_in, dim=1), + true_dist, + reduction="none", + ) + loss_lm = loss_lm.masked_fill(ignore.unsqueeze(1), 0).sum() / decoder_out.size(0) + + return loss_lm + + def init_beam_search( + self, + **kwargs, + ): + + # 1. Build ASR model + scorers = {} + + if self.ctc != None: + ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos) + scorers.update(ctc=ctc) + token_list = kwargs.get("token_list") + scorers.update( + length_bonus=LengthBonus(len(token_list)), + ) + + # 3. Build ngram model + # ngram is not supported now + ngram = None + scorers["ngram"] = ngram + + beam_search = BeamSearchTransducer( + self.decoder, + self.joint_network, + kwargs.get("beam_size", 2), + nbest=1, + ) + # beam_search.to(device=kwargs.get("device", "cpu"), dtype=getattr(torch, kwargs.get("dtype", "float32"))).eval() + # for scorer in scorers.values(): + # if isinstance(scorer, torch.nn.Module): + # scorer.to(device=kwargs.get("device", "cpu"), dtype=getattr(torch, kwargs.get("dtype", "float32"))).eval() + self.beam_search = beam_search + + def inference( + self, + data_in: list, + data_lengths: list = None, + key: list = None, + tokenizer=None, + **kwargs, + ): + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + # init beamsearch + is_use_ctc = kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None + is_use_lm = ( + kwargs.get("lm_weight", 0.0) > 0.00001 and kwargs.get("lm_file", None) is not None + ) + # if self.beam_search is None and (is_use_lm or is_use_ctc): + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, fs=self.frontend.fs, audio_fs=kwargs.get("fs", 16000) + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=self.frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * self.frontend.frame_shift * self.frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search(encoder_out[0], is_final=True) + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + b, n, d = encoder_out.size() + for i in range(b): + + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq # [1:last_pos] + else: + token_int = hyp.yseq # [1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text = tokenizer.tokens2text(token) + + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + result_i = { + "key": key[i], + "token": token, + "text": text, + "text_postprocessed": text_postprocessed, + } + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text + ibest_writer["text_postprocessed"][key[i]] = text_postprocessed + + return results, meta_data diff --git a/funasr/models/transducer/rnn_decoder.py b/funasr/models/transducer/rnn_decoder.py new file mode 100644 index 0000000..4a0ffa3 --- /dev/null +++ b/funasr/models/transducer/rnn_decoder.py @@ -0,0 +1,331 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +import random +import numpy as np +import torch.nn as nn +import torch.nn.functional as F + +from funasr.register import tables +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.utils.nets_utils import to_device +from funasr.models.language_model.rnn.attentions import initial_att + + +def build_attention_list( + eprojs: int, + dunits: int, + atype: str = "location", + num_att: int = 1, + num_encs: int = 1, + aheads: int = 4, + adim: int = 320, + awin: int = 5, + aconv_chans: int = 10, + aconv_filts: int = 100, + han_mode: bool = False, + han_type=None, + han_heads: int = 4, + han_dim: int = 320, + han_conv_chans: int = -1, + han_conv_filts: int = 100, + han_win: int = 5, +): + + att_list = torch.nn.ModuleList() + if num_encs == 1: + for i in range(num_att): + att = initial_att( + atype, + eprojs, + dunits, + aheads, + adim, + awin, + aconv_chans, + aconv_filts, + ) + att_list.append(att) + elif num_encs > 1: # no multi-speaker mode + if han_mode: + att = initial_att( + han_type, + eprojs, + dunits, + han_heads, + han_dim, + han_win, + han_conv_chans, + han_conv_filts, + han_mode=True, + ) + return att + else: + att_list = torch.nn.ModuleList() + for idx in range(num_encs): + att = initial_att( + atype[idx], + eprojs, + dunits, + aheads[idx], + adim[idx], + awin[idx], + aconv_chans[idx], + aconv_filts[idx], + ) + att_list.append(att) + else: + raise ValueError("Number of encoders needs to be more than one. {}".format(num_encs)) + return att_list + + +@tables.register("decoder_classes", "rnn_decoder") +class RNNDecoder(nn.Module): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + rnn_type: str = "lstm", + num_layers: int = 1, + hidden_size: int = 320, + sampling_probability: float = 0.0, + dropout: float = 0.0, + context_residual: bool = False, + replace_sos: bool = False, + num_encs: int = 1, + att_conf: dict = None, + ): + # FIXME(kamo): The parts of num_spk should be refactored more more more + if rnn_type not in {"lstm", "gru"}: + raise ValueError(f"Not supported: rnn_type={rnn_type}") + + super().__init__() + eprojs = encoder_output_size + self.dtype = rnn_type + self.dunits = hidden_size + self.dlayers = num_layers + self.context_residual = context_residual + self.sos = vocab_size - 1 + self.eos = vocab_size - 1 + self.odim = vocab_size + self.sampling_probability = sampling_probability + self.dropout = dropout + self.num_encs = num_encs + + # for multilingual translation + self.replace_sos = replace_sos + + self.embed = torch.nn.Embedding(vocab_size, hidden_size) + self.dropout_emb = torch.nn.Dropout(p=dropout) + + self.decoder = torch.nn.ModuleList() + self.dropout_dec = torch.nn.ModuleList() + self.decoder += [ + ( + torch.nn.LSTMCell(hidden_size + eprojs, hidden_size) + if self.dtype == "lstm" + else torch.nn.GRUCell(hidden_size + eprojs, hidden_size) + ) + ] + self.dropout_dec += [torch.nn.Dropout(p=dropout)] + for _ in range(1, self.dlayers): + self.decoder += [ + ( + torch.nn.LSTMCell(hidden_size, hidden_size) + if self.dtype == "lstm" + else torch.nn.GRUCell(hidden_size, hidden_size) + ) + ] + self.dropout_dec += [torch.nn.Dropout(p=dropout)] + # NOTE: dropout is applied only for the vertical connections + # see https://arxiv.org/pdf/1409.2329.pdf + + if context_residual: + self.output = torch.nn.Linear(hidden_size + eprojs, vocab_size) + else: + self.output = torch.nn.Linear(hidden_size, vocab_size) + + self.att_list = build_attention_list(eprojs=eprojs, dunits=hidden_size, **att_conf) + + def zero_state(self, hs_pad): + return hs_pad.new_zeros(hs_pad.size(0), self.dunits) + + def rnn_forward(self, ey, z_list, c_list, z_prev, c_prev): + if self.dtype == "lstm": + z_list[0], c_list[0] = self.decoder[0](ey, (z_prev[0], c_prev[0])) + for i in range(1, self.dlayers): + z_list[i], c_list[i] = self.decoder[i]( + self.dropout_dec[i - 1](z_list[i - 1]), + (z_prev[i], c_prev[i]), + ) + else: + z_list[0] = self.decoder[0](ey, z_prev[0]) + for i in range(1, self.dlayers): + z_list[i] = self.decoder[i](self.dropout_dec[i - 1](z_list[i - 1]), z_prev[i]) + return z_list, c_list + + def forward(self, hs_pad, hlens, ys_in_pad, ys_in_lens, strm_idx=0): + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + hs_pad = [hs_pad] + hlens = [hlens] + + # attention index for the attention module + # in SPA (speaker parallel attention), + # att_idx is used to select attention module. In other cases, it is 0. + att_idx = min(strm_idx, len(self.att_list) - 1) + + # hlens should be list of list of integer + hlens = [list(map(int, hlens[idx])) for idx in range(self.num_encs)] + + # get dim, length info + olength = ys_in_pad.size(1) + + # initialization + c_list = [self.zero_state(hs_pad[0])] + z_list = [self.zero_state(hs_pad[0])] + for _ in range(1, self.dlayers): + c_list.append(self.zero_state(hs_pad[0])) + z_list.append(self.zero_state(hs_pad[0])) + z_all = [] + if self.num_encs == 1: + att_w = None + self.att_list[att_idx].reset() # reset pre-computation of h + else: + att_w_list = [None] * (self.num_encs + 1) # atts + han + att_c_list = [None] * self.num_encs # atts + for idx in range(self.num_encs + 1): + # reset pre-computation of h in atts and han + self.att_list[idx].reset() + + # pre-computation of embedding + eys = self.dropout_emb(self.embed(ys_in_pad)) # utt x olen x zdim + + # loop for an output sequence + for i in range(olength): + if self.num_encs == 1: + att_c, att_w = self.att_list[att_idx]( + hs_pad[0], hlens[0], self.dropout_dec[0](z_list[0]), att_w + ) + else: + for idx in range(self.num_encs): + att_c_list[idx], att_w_list[idx] = self.att_list[idx]( + hs_pad[idx], + hlens[idx], + self.dropout_dec[0](z_list[0]), + att_w_list[idx], + ) + hs_pad_han = torch.stack(att_c_list, dim=1) + hlens_han = [self.num_encs] * len(ys_in_pad) + att_c, att_w_list[self.num_encs] = self.att_list[self.num_encs]( + hs_pad_han, + hlens_han, + self.dropout_dec[0](z_list[0]), + att_w_list[self.num_encs], + ) + if i > 0 and random.random() < self.sampling_probability: + z_out = self.output(z_all[-1]) + z_out = np.argmax(z_out.detach().cpu(), axis=1) + z_out = self.dropout_emb(self.embed(to_device(self, z_out))) + ey = torch.cat((z_out, att_c), dim=1) # utt x (zdim + hdim) + else: + # utt x (zdim + hdim) + ey = torch.cat((eys[:, i, :], att_c), dim=1) + z_list, c_list = self.rnn_forward(ey, z_list, c_list, z_list, c_list) + if self.context_residual: + z_all.append( + torch.cat((self.dropout_dec[-1](z_list[-1]), att_c), dim=-1) + ) # utt x (zdim + hdim) + else: + z_all.append(self.dropout_dec[-1](z_list[-1])) # utt x (zdim) + + z_all = torch.stack(z_all, dim=1) + z_all = self.output(z_all) + z_all.masked_fill_( + make_pad_mask(ys_in_lens, z_all, 1), + 0, + ) + return z_all, ys_in_lens + + def init_state(self, x): + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + x = [x] + + c_list = [self.zero_state(x[0].unsqueeze(0))] + z_list = [self.zero_state(x[0].unsqueeze(0))] + for _ in range(1, self.dlayers): + c_list.append(self.zero_state(x[0].unsqueeze(0))) + z_list.append(self.zero_state(x[0].unsqueeze(0))) + # TODO(karita): support strm_index for `asr_mix` + strm_index = 0 + att_idx = min(strm_index, len(self.att_list) - 1) + if self.num_encs == 1: + a = None + self.att_list[att_idx].reset() # reset pre-computation of h + else: + a = [None] * (self.num_encs + 1) # atts + han + for idx in range(self.num_encs + 1): + # reset pre-computation of h in atts and han + self.att_list[idx].reset() + return dict( + c_prev=c_list[:], + z_prev=z_list[:], + a_prev=a, + workspace=(att_idx, z_list, c_list), + ) + + def score(self, yseq, state, x): + # to support mutiple encoder asr mode, in single encoder mode, + # convert torch.Tensor to List of torch.Tensor + if self.num_encs == 1: + x = [x] + + att_idx, z_list, c_list = state["workspace"] + vy = yseq[-1].unsqueeze(0) + ey = self.dropout_emb(self.embed(vy)) # utt list (1) x zdim + if self.num_encs == 1: + att_c, att_w = self.att_list[att_idx]( + x[0].unsqueeze(0), + [x[0].size(0)], + self.dropout_dec[0](state["z_prev"][0]), + state["a_prev"], + ) + else: + att_w = [None] * (self.num_encs + 1) # atts + han + att_c_list = [None] * self.num_encs # atts + for idx in range(self.num_encs): + att_c_list[idx], att_w[idx] = self.att_list[idx]( + x[idx].unsqueeze(0), + [x[idx].size(0)], + self.dropout_dec[0](state["z_prev"][0]), + state["a_prev"][idx], + ) + h_han = torch.stack(att_c_list, dim=1) + att_c, att_w[self.num_encs] = self.att_list[self.num_encs]( + h_han, + [self.num_encs], + self.dropout_dec[0](state["z_prev"][0]), + state["a_prev"][self.num_encs], + ) + ey = torch.cat((ey, att_c), dim=1) # utt(1) x (zdim + hdim) + z_list, c_list = self.rnn_forward(ey, z_list, c_list, state["z_prev"], state["c_prev"]) + if self.context_residual: + logits = self.output(torch.cat((self.dropout_dec[-1](z_list[-1]), att_c), dim=-1)) + else: + logits = self.output(self.dropout_dec[-1](z_list[-1])) + logp = F.log_softmax(logits, dim=1).squeeze(0) + return ( + logp, + dict( + c_prev=c_list[:], + z_prev=z_list[:], + a_prev=att_w, + workspace=(att_idx, z_list, c_list), + ), + ) diff --git a/funasr/models/transducer/rnnt_decoder.py b/funasr/models/transducer/rnnt_decoder.py new file mode 100644 index 0000000..bc1787a --- /dev/null +++ b/funasr/models/transducer/rnnt_decoder.py @@ -0,0 +1,264 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import torch +from typing import List, Optional, Tuple + +from funasr.register import tables +from funasr.models.specaug.specaug import SpecAug +from funasr.models.transducer.beam_search_transducer import Hypothesis + + +@tables.register("decoder_classes", "rnnt_decoder") +class RNNTDecoder(torch.nn.Module): + """RNN decoder module. + + Args: + vocab_size: Vocabulary size. + embed_size: Embedding size. + hidden_size: Hidden size.. + rnn_type: Decoder layers type. + num_layers: Number of decoder layers. + dropout_rate: Dropout rate for decoder layers. + embed_dropout_rate: Dropout rate for embedding layer. + embed_pad: Embedding padding symbol ID. + + """ + + def __init__( + self, + vocab_size: int, + embed_size: int = 256, + hidden_size: int = 256, + rnn_type: str = "lstm", + num_layers: int = 1, + dropout_rate: float = 0.0, + embed_dropout_rate: float = 0.0, + embed_pad: int = 0, + use_embed_mask: bool = False, + ) -> None: + """Construct a RNNDecoder object.""" + super().__init__() + + if rnn_type not in ("lstm", "gru"): + raise ValueError(f"Not supported: rnn_type={rnn_type}") + + self.embed = torch.nn.Embedding(vocab_size, embed_size, padding_idx=embed_pad) + self.dropout_embed = torch.nn.Dropout(p=embed_dropout_rate) + + rnn_class = torch.nn.LSTM if rnn_type == "lstm" else torch.nn.GRU + + self.rnn = torch.nn.ModuleList([rnn_class(embed_size, hidden_size, 1, batch_first=True)]) + + for _ in range(1, num_layers): + self.rnn += [rnn_class(hidden_size, hidden_size, 1, batch_first=True)] + + self.dropout_rnn = torch.nn.ModuleList( + [torch.nn.Dropout(p=dropout_rate) for _ in range(num_layers)] + ) + + self.dlayers = num_layers + self.dtype = rnn_type + + self.output_size = hidden_size + self.vocab_size = vocab_size + + self.device = next(self.parameters()).device + self.score_cache = {} + + self.use_embed_mask = use_embed_mask + if self.use_embed_mask: + self._embed_mask = SpecAug( + time_mask_width_range=3, + num_time_mask=4, + apply_freq_mask=False, + apply_time_warp=False, + ) + + def forward( + self, + labels: torch.Tensor, + label_lens: torch.Tensor, + states: Optional[Tuple[torch.Tensor, Optional[torch.Tensor]]] = None, + ) -> torch.Tensor: + """Encode source label sequences. + + Args: + labels: Label ID sequences. (B, L) + states: Decoder hidden states. + ((N, B, D_dec), (N, B, D_dec) or None) or None + + Returns: + dec_out: Decoder output sequences. (B, U, D_dec) + + """ + if states is None: + states = self.init_state(labels.size(0)) + + dec_embed = self.dropout_embed(self.embed(labels)) + if self.use_embed_mask and self.training: + dec_embed = self._embed_mask(dec_embed, label_lens)[0] + dec_out, states = self.rnn_forward(dec_embed, states) + return dec_out + + def rnn_forward( + self, + x: torch.Tensor, + state: Tuple[torch.Tensor, Optional[torch.Tensor]], + ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, Optional[torch.Tensor]]]: + """Encode source label sequences. + + Args: + x: RNN input sequences. (B, D_emb) + state: Decoder hidden states. ((N, B, D_dec), (N, B, D_dec) or None) + + Returns: + x: RNN output sequences. (B, D_dec) + (h_next, c_next): Decoder hidden states. + (N, B, D_dec), (N, B, D_dec) or None) + + """ + h_prev, c_prev = state + h_next, c_next = self.init_state(x.size(0)) + + for layer in range(self.dlayers): + if self.dtype == "lstm": + x, (h_next[layer : layer + 1], c_next[layer : layer + 1]) = self.rnn[layer]( + x, hx=(h_prev[layer : layer + 1], c_prev[layer : layer + 1]) + ) + else: + x, h_next[layer : layer + 1] = self.rnn[layer](x, hx=h_prev[layer : layer + 1]) + + x = self.dropout_rnn[layer](x) + + return x, (h_next, c_next) + + def score( + self, + label: torch.Tensor, + label_sequence: List[int], + dec_state: Tuple[torch.Tensor, Optional[torch.Tensor]], + ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, Optional[torch.Tensor]]]: + """One-step forward hypothesis. + + Args: + label: Previous label. (1, 1) + label_sequence: Current label sequence. + dec_state: Previous decoder hidden states. + ((N, 1, D_dec), (N, 1, D_dec) or None) + + Returns: + dec_out: Decoder output sequence. (1, D_dec) + dec_state: Decoder hidden states. + ((N, 1, D_dec), (N, 1, D_dec) or None) + + """ + str_labels = "_".join(map(str, label_sequence)) + + if str_labels in self.score_cache: + dec_out, dec_state = self.score_cache[str_labels] + else: + dec_embed = self.embed(label) + dec_out, dec_state = self.rnn_forward(dec_embed, dec_state) + + self.score_cache[str_labels] = (dec_out, dec_state) + + return dec_out[0], dec_state + + def batch_score( + self, + hyps: List[Hypothesis], + ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, Optional[torch.Tensor]]]: + """One-step forward hypotheses. + + Args: + hyps: Hypotheses. + + Returns: + dec_out: Decoder output sequences. (B, D_dec) + states: Decoder hidden states. ((N, B, D_dec), (N, B, D_dec) or None) + + """ + labels = torch.LongTensor([[h.yseq[-1]] for h in hyps], device=self.device) + dec_embed = self.embed(labels) + + states = self.create_batch_states([h.dec_state for h in hyps]) + dec_out, states = self.rnn_forward(dec_embed, states) + + return dec_out.squeeze(1), states + + def set_device(self, device: torch.device) -> None: + """Set GPU device to use. + + Args: + device: Device ID. + + """ + self.device = device + + def init_state(self, batch_size: int) -> Tuple[torch.Tensor, Optional[torch.tensor]]: + """Initialize decoder states. + + Args: + batch_size: Batch size. + + Returns: + : Initial decoder hidden states. ((N, B, D_dec), (N, B, D_dec) or None) + + """ + h_n = torch.zeros( + self.dlayers, + batch_size, + self.output_size, + device=self.device, + ) + + if self.dtype == "lstm": + c_n = torch.zeros( + self.dlayers, + batch_size, + self.output_size, + device=self.device, + ) + + return (h_n, c_n) + + return (h_n, None) + + def select_state( + self, states: Tuple[torch.Tensor, Optional[torch.Tensor]], idx: int + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """Get specified ID state from decoder hidden states. + + Args: + states: Decoder hidden states. ((N, B, D_dec), (N, B, D_dec) or None) + idx: State ID to extract. + + Returns: + : Decoder hidden state for given ID. ((N, 1, D_dec), (N, 1, D_dec) or None) + + """ + return ( + states[0][:, idx : idx + 1, :], + states[1][:, idx : idx + 1, :] if self.dtype == "lstm" else None, + ) + + def create_batch_states( + self, + new_states: List[Tuple[torch.Tensor, Optional[torch.Tensor]]], + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """Create decoder hidden states. + + Args: + new_states: Decoder hidden states. [N x ((1, D_dec), (1, D_dec) or None)] + + Returns: + states: Decoder hidden states. ((N, B, D_dec), (N, B, D_dec) or None) + + """ + return ( + torch.cat([s[0] for s in new_states], dim=1), + torch.cat([s[1] for s in new_states], dim=1) if self.dtype == "lstm" else None, + ) diff --git a/funasr/models/transformer/__init__.py b/funasr/models/transformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/transformer/attention.py b/funasr/models/transformer/attention.py new file mode 100644 index 0000000..e4add5c --- /dev/null +++ b/funasr/models/transformer/attention.py @@ -0,0 +1,610 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Multi-Head Attention layer definition.""" + +import math + +import numpy +import torch +from torch import nn +from typing import Optional, Tuple + +import torch.nn.functional as F +from funasr.models.transformer.utils.nets_utils import make_pad_mask +import funasr.models.lora.layers as lora + + +class MultiHeadedAttention(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, n_head, n_feat, dropout_rate): + """Construct an MultiHeadedAttention object.""" + super(MultiHeadedAttention, self).__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + self.linear_q = nn.Linear(n_feat, n_feat) + self.linear_k = nn.Linear(n_feat, n_feat) + self.linear_v = nn.Linear(n_feat, n_feat) + self.linear_out = nn.Linear(n_feat, n_feat) + self.attn = None + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv(self, query, key, value): + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor (#batch, n_head, time2, d_k). + + """ + n_batch = query.size(0) + q = self.linear_q(query).view(n_batch, -1, self.h, self.d_k) + k = self.linear_k(key).view(n_batch, -1, self.h, self.d_k) + v = self.linear_v(value).view(n_batch, -1, self.h, self.d_k) + q = q.transpose(1, 2) # (batch, head, time1, d_k) + k = k.transpose(1, 2) # (batch, head, time2, d_k) + v = v.transpose(1, 2) # (batch, head, time2, d_k) + + return q, k, v + + def forward_attention(self, value, scores, mask): + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask (#batch, 1, time2) or (#batch, time1, time2). + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + if mask is not None: + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + min_value = float(numpy.finfo(torch.tensor(0, dtype=scores.dtype).numpy().dtype).min) + scores = scores.masked_fill(mask, min_value) + self.attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0 + ) # (batch, head, time1, time2) + else: + self.attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(self.attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = ( + x.transpose(1, 2).contiguous().view(n_batch, -1, self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x) # (batch, time1, d_model) + + def forward(self, query, key, value, mask): + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q, k, v = self.forward_qkv(query, key, value) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, mask) + + +class MultiHeadedAttentionExport(nn.Module): + def __init__(self, model): + super().__init__() + self.d_k = model.d_k + self.h = model.h + self.linear_q = model.linear_q + self.linear_k = model.linear_k + self.linear_v = model.linear_v + self.linear_out = model.linear_out + self.attn = None + self.all_head_size = self.h * self.d_k + + def forward(self, query, key, value, mask): + q, k, v = self.forward_qkv(query, key, value) + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, mask) + + def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: + new_x_shape = x.size()[:-1] + (self.h, self.d_k) + x = x.view(new_x_shape) + return x.permute(0, 2, 1, 3) + + def forward_qkv(self, query, key, value): + q = self.linear_q(query) + k = self.linear_k(key) + v = self.linear_v(value) + q = self.transpose_for_scores(q) + k = self.transpose_for_scores(k) + v = self.transpose_for_scores(v) + return q, k, v + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) + + +class RelPosMultiHeadedAttentionExport(MultiHeadedAttentionExport): + def __init__(self, model): + super().__init__(model) + self.linear_pos = model.linear_pos + self.pos_bias_u = model.pos_bias_u + self.pos_bias_v = model.pos_bias_v + + def forward(self, query, key, value, pos_emb, mask): + q, k, v = self.forward_qkv(query, key, value) + q = q.transpose(1, 2) # (batch, time1, head, d_k) + + p = self.transpose_for_scores(self.linear_pos(pos_emb)) # (batch, head, time1, d_k) + + # (batch, head, time1, d_k) + q_with_bias_u = (q + self.pos_bias_u).transpose(1, 2) + # (batch, head, time1, d_k) + q_with_bias_v = (q + self.pos_bias_v).transpose(1, 2) + + # compute attention score + # first compute matrix a and matrix c + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + # (batch, head, time1, time2) + matrix_ac = torch.matmul(q_with_bias_u, k.transpose(-2, -1)) + + # compute matrix b and matrix d + # (batch, head, time1, time1) + matrix_bd = torch.matmul(q_with_bias_v, p.transpose(-2, -1)) + matrix_bd = self.rel_shift(matrix_bd) + + scores = (matrix_ac + matrix_bd) / math.sqrt(self.d_k) # (batch, head, time1, time2) + + return self.forward_attention(v, scores, mask) + + def rel_shift(self, x): + zero_pad = torch.zeros((*x.size()[:3], 1), device=x.device, dtype=x.dtype) + x_padded = torch.cat([zero_pad, x], dim=-1) + + x_padded = x_padded.view(*x.size()[:2], x.size(3) + 1, x.size(2)) + x = x_padded[:, :, 1:].view_as(x)[ + :, :, :, : x.size(-1) // 2 + 1 + ] # only keep the positions from 0 to time2 + return x + + def forward_attention(self, value, scores, mask): + scores = scores + mask + + self.attn = torch.softmax(scores, dim=-1) + context_layer = torch.matmul(self.attn, value) # (batch, head, time1, d_k) + + context_layer = context_layer.permute(0, 2, 1, 3).contiguous() + new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,) + context_layer = context_layer.view(new_context_layer_shape) + return self.linear_out(context_layer) # (batch, time1, d_model) + + +class LegacyRelPositionMultiHeadedAttention(MultiHeadedAttention): + """Multi-Head Attention layer with relative position encoding (old version). + + Details can be found in https://github.com/espnet/espnet/pull/2816. + + Paper: https://arxiv.org/abs/1901.02860 + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + zero_triu (bool): Whether to zero the upper triangular part of attention matrix. + + """ + + def __init__(self, n_head, n_feat, dropout_rate, zero_triu=False): + """Construct an RelPositionMultiHeadedAttention object.""" + super().__init__(n_head, n_feat, dropout_rate) + self.zero_triu = zero_triu + # linear transformation for positional encoding + self.linear_pos = nn.Linear(n_feat, n_feat, bias=False) + # these two learnable bias are used in matrix c and matrix d + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + self.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k)) + self.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k)) + torch.nn.init.xavier_uniform_(self.pos_bias_u) + torch.nn.init.xavier_uniform_(self.pos_bias_v) + + def rel_shift(self, x): + """Compute relative positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, head, time1, time2). + + Returns: + torch.Tensor: Output tensor. + + """ + zero_pad = torch.zeros((*x.size()[:3], 1), device=x.device, dtype=x.dtype) + x_padded = torch.cat([zero_pad, x], dim=-1) + + x_padded = x_padded.view(*x.size()[:2], x.size(3) + 1, x.size(2)) + x = x_padded[:, :, 1:].view_as(x) + + if self.zero_triu: + ones = torch.ones((x.size(2), x.size(3))) + x = x * torch.tril(ones, x.size(3) - x.size(2))[None, None, :, :] + + return x + + def forward(self, query, key, value, pos_emb, mask): + """Compute 'Scaled Dot Product Attention' with rel. positional encoding. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + pos_emb (torch.Tensor): Positional embedding tensor (#batch, time1, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q, k, v = self.forward_qkv(query, key, value) + q = q.transpose(1, 2) # (batch, time1, head, d_k) + + n_batch_pos = pos_emb.size(0) + p = self.linear_pos(pos_emb).view(n_batch_pos, -1, self.h, self.d_k) + p = p.transpose(1, 2) # (batch, head, time1, d_k) + + # (batch, head, time1, d_k) + q_with_bias_u = (q + self.pos_bias_u).transpose(1, 2) + # (batch, head, time1, d_k) + q_with_bias_v = (q + self.pos_bias_v).transpose(1, 2) + + # compute attention score + # first compute matrix a and matrix c + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + # (batch, head, time1, time2) + matrix_ac = torch.matmul(q_with_bias_u, k.transpose(-2, -1)) + + # compute matrix b and matrix d + # (batch, head, time1, time1) + matrix_bd = torch.matmul(q_with_bias_v, p.transpose(-2, -1)) + matrix_bd = self.rel_shift(matrix_bd) + + scores = (matrix_ac + matrix_bd) / math.sqrt(self.d_k) # (batch, head, time1, time2) + + return self.forward_attention(v, scores, mask) + + +class RelPositionMultiHeadedAttention(MultiHeadedAttention): + """Multi-Head Attention layer with relative position encoding (new implementation). + + Details can be found in https://github.com/espnet/espnet/pull/2816. + + Paper: https://arxiv.org/abs/1901.02860 + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + zero_triu (bool): Whether to zero the upper triangular part of attention matrix. + + """ + + def __init__(self, n_head, n_feat, dropout_rate, zero_triu=False): + """Construct an RelPositionMultiHeadedAttention object.""" + super().__init__(n_head, n_feat, dropout_rate) + self.zero_triu = zero_triu + # linear transformation for positional encoding + self.linear_pos = nn.Linear(n_feat, n_feat, bias=False) + # these two learnable bias are used in matrix c and matrix d + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + self.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k)) + self.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k)) + torch.nn.init.xavier_uniform_(self.pos_bias_u) + torch.nn.init.xavier_uniform_(self.pos_bias_v) + + def rel_shift(self, x): + """Compute relative positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, head, time1, 2*time1-1). + time1 means the length of query vector. + + Returns: + torch.Tensor: Output tensor. + + """ + zero_pad = torch.zeros((*x.size()[:3], 1), device=x.device, dtype=x.dtype) + x_padded = torch.cat([zero_pad, x], dim=-1) + + x_padded = x_padded.view(*x.size()[:2], x.size(3) + 1, x.size(2)) + x = x_padded[:, :, 1:].view_as(x)[ + :, :, :, : x.size(-1) // 2 + 1 + ] # only keep the positions from 0 to time2 + + if self.zero_triu: + ones = torch.ones((x.size(2), x.size(3)), device=x.device) + x = x * torch.tril(ones, x.size(3) - x.size(2))[None, None, :, :] + + return x + + def forward(self, query, key, value, pos_emb, mask): + """Compute 'Scaled Dot Product Attention' with rel. positional encoding. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + pos_emb (torch.Tensor): Positional embedding tensor + (#batch, 2*time1-1, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + + """ + q, k, v = self.forward_qkv(query, key, value) + q = q.transpose(1, 2) # (batch, time1, head, d_k) + + n_batch_pos = pos_emb.size(0) + p = self.linear_pos(pos_emb).view(n_batch_pos, -1, self.h, self.d_k) + p = p.transpose(1, 2) # (batch, head, 2*time1-1, d_k) + + # (batch, head, time1, d_k) + q_with_bias_u = (q + self.pos_bias_u).transpose(1, 2) + # (batch, head, time1, d_k) + q_with_bias_v = (q + self.pos_bias_v).transpose(1, 2) + + # compute attention score + # first compute matrix a and matrix c + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + # (batch, head, time1, time2) + matrix_ac = torch.matmul(q_with_bias_u, k.transpose(-2, -1)) + + # compute matrix b and matrix d + # (batch, head, time1, 2*time1-1) + matrix_bd = torch.matmul(q_with_bias_v, p.transpose(-2, -1)) + matrix_bd = self.rel_shift(matrix_bd) + + scores = (matrix_ac + matrix_bd) / math.sqrt(self.d_k) # (batch, head, time1, time2) + + return self.forward_attention(v, scores, mask) + + +class RelPositionMultiHeadedAttentionChunk(torch.nn.Module): + """RelPositionMultiHeadedAttention definition. + Args: + num_heads: Number of attention heads. + embed_size: Embedding size. + dropout_rate: Dropout rate. + """ + + def __init__( + self, + num_heads: int, + embed_size: int, + dropout_rate: float = 0.0, + simplified_attention_score: bool = False, + ) -> None: + """Construct an MultiHeadedAttention object.""" + super().__init__() + + self.d_k = embed_size // num_heads + self.num_heads = num_heads + + assert self.d_k * num_heads == embed_size, ( + "embed_size (%d) must be divisible by num_heads (%d)", + (embed_size, num_heads), + ) + + self.linear_q = torch.nn.Linear(embed_size, embed_size) + self.linear_k = torch.nn.Linear(embed_size, embed_size) + self.linear_v = torch.nn.Linear(embed_size, embed_size) + + self.linear_out = torch.nn.Linear(embed_size, embed_size) + + if simplified_attention_score: + self.linear_pos = torch.nn.Linear(embed_size, num_heads) + + self.compute_att_score = self.compute_simplified_attention_score + else: + self.linear_pos = torch.nn.Linear(embed_size, embed_size, bias=False) + + self.pos_bias_u = torch.nn.Parameter(torch.Tensor(num_heads, self.d_k)) + self.pos_bias_v = torch.nn.Parameter(torch.Tensor(num_heads, self.d_k)) + torch.nn.init.xavier_uniform_(self.pos_bias_u) + torch.nn.init.xavier_uniform_(self.pos_bias_v) + + self.compute_att_score = self.compute_attention_score + + self.dropout = torch.nn.Dropout(p=dropout_rate) + self.attn = None + + def rel_shift(self, x: torch.Tensor, left_context: int = 0) -> torch.Tensor: + """Compute relative positional encoding. + Args: + x: Input sequence. (B, H, T_1, 2 * T_1 - 1) + left_context: Number of frames in left context. + Returns: + x: Output sequence. (B, H, T_1, T_2) + """ + batch_size, n_heads, time1, n = x.shape + time2 = time1 + left_context + + batch_stride, n_heads_stride, time1_stride, n_stride = x.stride() + + return x.as_strided( + (batch_size, n_heads, time1, time2), + (batch_stride, n_heads_stride, time1_stride - n_stride, n_stride), + storage_offset=(n_stride * (time1 - 1)), + ) + + def compute_simplified_attention_score( + self, + query: torch.Tensor, + key: torch.Tensor, + pos_enc: torch.Tensor, + left_context: int = 0, + ) -> torch.Tensor: + """Simplified attention score computation. + Reference: https://github.com/k2-fsa/icefall/pull/458 + Args: + query: Transformed query tensor. (B, H, T_1, d_k) + key: Transformed key tensor. (B, H, T_2, d_k) + pos_enc: Positional embedding tensor. (B, 2 * T_1 - 1, size) + left_context: Number of frames in left context. + Returns: + : Attention score. (B, H, T_1, T_2) + """ + pos_enc = self.linear_pos(pos_enc) + + matrix_ac = torch.matmul(query, key.transpose(2, 3)) + + matrix_bd = self.rel_shift( + pos_enc.transpose(1, 2).unsqueeze(2).repeat(1, 1, query.size(2), 1), + left_context=left_context, + ) + + return (matrix_ac + matrix_bd) / math.sqrt(self.d_k) + + def compute_attention_score( + self, + query: torch.Tensor, + key: torch.Tensor, + pos_enc: torch.Tensor, + left_context: int = 0, + ) -> torch.Tensor: + """Attention score computation. + Args: + query: Transformed query tensor. (B, H, T_1, d_k) + key: Transformed key tensor. (B, H, T_2, d_k) + pos_enc: Positional embedding tensor. (B, 2 * T_1 - 1, size) + left_context: Number of frames in left context. + Returns: + : Attention score. (B, H, T_1, T_2) + """ + p = self.linear_pos(pos_enc).view(pos_enc.size(0), -1, self.num_heads, self.d_k) + + query = query.transpose(1, 2) + q_with_bias_u = (query + self.pos_bias_u).transpose(1, 2) + q_with_bias_v = (query + self.pos_bias_v).transpose(1, 2) + + matrix_ac = torch.matmul(q_with_bias_u, key.transpose(-2, -1)) + + matrix_bd = torch.matmul(q_with_bias_v, p.permute(0, 2, 3, 1)) + matrix_bd = self.rel_shift(matrix_bd, left_context=left_context) + + return (matrix_ac + matrix_bd) / math.sqrt(self.d_k) + + def forward_qkv( + self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + """Transform query, key and value. + Args: + query: Query tensor. (B, T_1, size) + key: Key tensor. (B, T_2, size) + v: Value tensor. (B, T_2, size) + Returns: + q: Transformed query tensor. (B, H, T_1, d_k) + k: Transformed key tensor. (B, H, T_2, d_k) + v: Transformed value tensor. (B, H, T_2, d_k) + """ + n_batch = query.size(0) + + q = self.linear_q(query).view(n_batch, -1, self.num_heads, self.d_k).transpose(1, 2) + k = self.linear_k(key).view(n_batch, -1, self.num_heads, self.d_k).transpose(1, 2) + v = self.linear_v(value).view(n_batch, -1, self.num_heads, self.d_k).transpose(1, 2) + + return q, k, v + + def forward_attention( + self, + value: torch.Tensor, + scores: torch.Tensor, + mask: torch.Tensor, + chunk_mask: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """Compute attention context vector. + Args: + value: Transformed value. (B, H, T_2, d_k) + scores: Attention score. (B, H, T_1, T_2) + mask: Source mask. (B, T_2) + chunk_mask: Chunk mask. (T_1, T_1) + Returns: + attn_output: Transformed value weighted by attention score. (B, T_1, H * d_k) + """ + batch_size = scores.size(0) + mask = mask.unsqueeze(1).unsqueeze(2) + if chunk_mask is not None: + mask = chunk_mask.unsqueeze(0).unsqueeze(1) | mask + scores = scores.masked_fill(mask, float("-inf")) + self.attn = torch.softmax(scores, dim=-1).masked_fill(mask, 0.0) + + attn_output = self.dropout(self.attn) + attn_output = torch.matmul(attn_output, value) + + attn_output = self.linear_out( + attn_output.transpose(1, 2).contiguous().view(batch_size, -1, self.num_heads * self.d_k) + ) + + return attn_output + + def forward( + self, + query: torch.Tensor, + key: torch.Tensor, + value: torch.Tensor, + pos_enc: torch.Tensor, + mask: torch.Tensor, + chunk_mask: Optional[torch.Tensor] = None, + left_context: int = 0, + ) -> torch.Tensor: + """Compute scaled dot product attention with rel. positional encoding. + Args: + query: Query tensor. (B, T_1, size) + key: Key tensor. (B, T_2, size) + value: Value tensor. (B, T_2, size) + pos_enc: Positional embedding tensor. (B, 2 * T_1 - 1, size) + mask: Source mask. (B, T_2) + chunk_mask: Chunk mask. (T_1, T_1) + left_context: Number of frames in left context. + Returns: + : Output tensor. (B, T_1, H * d_k) + """ + q, k, v = self.forward_qkv(query, key, value) + scores = self.compute_att_score(q, k, pos_enc, left_context=left_context) + return self.forward_attention(v, scores, mask, chunk_mask=chunk_mask) diff --git a/funasr/models/transformer/decoder.py b/funasr/models/transformer/decoder.py new file mode 100644 index 0000000..7d849f3 --- /dev/null +++ b/funasr/models/transformer/decoder.py @@ -0,0 +1,653 @@ +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Decoder definition.""" +from typing import Any +from typing import List +from typing import Sequence +from typing import Tuple + +import torch +from torch import nn + + +from funasr.models.transformer.attention import MultiHeadedAttention +from funasr.models.transformer.utils.dynamic_conv import DynamicConvolution +from funasr.models.transformer.utils.dynamic_conv2d import DynamicConvolution2D +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.lightconv import LightweightConvolution +from funasr.models.transformer.utils.lightconv2d import LightweightConvolution2D +from funasr.models.transformer.utils.mask import subsequent_mask +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.positionwise_feed_forward import ( + PositionwiseFeedForward, # noqa: H301 +) +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.transformer.scorers.scorer_interface import BatchScorerInterface + +from funasr.register import tables + + +class DecoderLayer(nn.Module): + """Single decoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + src_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + + + """ + + def __init__( + self, + size, + self_attn, + src_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + ): + """Construct an DecoderLayer object.""" + super(DecoderLayer, self).__init__() + self.size = size + self.self_attn = self_attn + self.src_attn = src_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + self.norm2 = LayerNorm(size) + self.norm3 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear1 = nn.Linear(size + size, size) + self.concat_linear2 = nn.Linear(size + size, size) + + def forward(self, tgt, tgt_mask, memory, memory_mask, cache=None): + """Compute decoded features. + + Args: + tgt (torch.Tensor): Input tensor (#batch, maxlen_out, size). + tgt_mask (torch.Tensor): Mask for input tensor (#batch, maxlen_out). + memory (torch.Tensor): Encoded memory, float32 (#batch, maxlen_in, size). + memory_mask (torch.Tensor): Encoded memory mask (#batch, maxlen_in). + cache (List[torch.Tensor]): List of cached tensors. + Each tensor shape should be (#batch, maxlen_out - 1, size). + + Returns: + torch.Tensor: Output tensor(#batch, maxlen_out, size). + torch.Tensor: Mask for output tensor (#batch, maxlen_out). + torch.Tensor: Encoded memory (#batch, maxlen_in, size). + torch.Tensor: Encoded memory mask (#batch, maxlen_in). + + """ + residual = tgt + if self.normalize_before: + tgt = self.norm1(tgt) + + if cache is None: + tgt_q = tgt + tgt_q_mask = tgt_mask + else: + # compute only the last frame query keeping dim: max_time_out -> 1 + assert cache.shape == ( + tgt.shape[0], + tgt.shape[1] - 1, + self.size, + ), f"{cache.shape} == {(tgt.shape[0], tgt.shape[1] - 1, self.size)}" + tgt_q = tgt[:, -1:, :] + residual = residual[:, -1:, :] + tgt_q_mask = None + if tgt_mask is not None: + tgt_q_mask = tgt_mask[:, -1:, :] + + if self.concat_after: + tgt_concat = torch.cat((tgt_q, self.self_attn(tgt_q, tgt, tgt, tgt_q_mask)), dim=-1) + x = residual + self.concat_linear1(tgt_concat) + else: + x = residual + self.dropout(self.self_attn(tgt_q, tgt, tgt, tgt_q_mask)) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + if self.concat_after: + x_concat = torch.cat((x, self.src_attn(x, memory, memory, memory_mask)), dim=-1) + x = residual + self.concat_linear2(x_concat) + else: + x = residual + self.dropout(self.src_attn(x, memory, memory, memory_mask)) + if not self.normalize_before: + x = self.norm2(x) + + residual = x + if self.normalize_before: + x = self.norm3(x) + x = residual + self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm3(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + return x, tgt_mask, memory, memory_mask + + +class DecoderLayerExport(nn.Module): + def __init__(self, model): + super().__init__() + self.self_attn = model.self_attn + self.src_attn = model.src_attn + self.feed_forward = model.feed_forward + self.norm1 = model.norm1 + self.norm2 = model.norm2 + self.norm3 = model.norm3 + + def forward(self, tgt, tgt_mask, memory, memory_mask, cache=None): + residual = tgt + tgt = self.norm1(tgt) + tgt_q = tgt + tgt_q_mask = tgt_mask + x = residual + self.self_attn(tgt_q, tgt, tgt, tgt_q_mask) + + residual = x + x = self.norm2(x) + + x = residual + self.src_attn(x, memory, memory, memory_mask) + + residual = x + x = self.norm3(x) + x = residual + self.feed_forward(x) + + return x, tgt_mask, memory, memory_mask + + +class BaseTransformerDecoder(nn.Module, BatchScorerInterface): + """Base class of Transfomer decoder module. + + Args: + vocab_size: output dim + encoder_output_size: dimension of attention + attention_heads: the number of heads of multi head attention + linear_units: the number of units of position-wise feed forward + num_blocks: the number of decoder blocks + dropout_rate: dropout rate + self_attention_dropout_rate: dropout rate for attention + input_layer: input layer type + use_output_layer: whether to use output layer + pos_enc_class: PositionalEncoding or ScaledPositionalEncoding + normalize_before: whether to use layer_norm before the first block + concat_after: whether to concat attention layer's input and output + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. + i.e. x -> x + att(x) + """ + + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + ): + super().__init__() + attention_dim = encoder_output_size + + if input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(vocab_size, attention_dim), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + elif input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(vocab_size, attention_dim), + torch.nn.LayerNorm(attention_dim), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(attention_dim, positional_dropout_rate), + ) + else: + raise ValueError(f"only 'embed' or 'linear' is supported: {input_layer}") + + self.normalize_before = normalize_before + if self.normalize_before: + self.after_norm = LayerNorm(attention_dim) + if use_output_layer: + self.output_layer = torch.nn.Linear(attention_dim, vocab_size) + else: + self.output_layer = None + + # Must set by the inheritance + self.decoders = None + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt = ys_in_pad + # tgt_mask: (B, 1, L) + tgt_mask = (~make_pad_mask(ys_in_lens)[:, None, :]).to(tgt.device) + # m: (1, L, L) + m = subsequent_mask(tgt_mask.size(-1), device=tgt_mask.device).unsqueeze(0) + # tgt_mask: (B, L, L) + tgt_mask = tgt_mask & m + + memory = hs_pad + memory_mask = (~make_pad_mask(hlens, maxlen=memory.size(1)))[:, None, :].to(memory.device) + # Padding for Longformer + if memory_mask.shape[-1] != memory.shape[1]: + padlen = memory.shape[1] - memory_mask.shape[-1] + memory_mask = torch.nn.functional.pad(memory_mask, (0, padlen), "constant", False) + + x = self.embed(tgt) + x, tgt_mask, memory, memory_mask = self.decoders(x, tgt_mask, memory, memory_mask) + if self.normalize_before: + x = self.after_norm(x) + if self.output_layer is not None: + x = self.output_layer(x) + + olens = tgt_mask.sum(1) + return x, olens + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + """ + x = self.embed(tgt) + if cache is None: + cache = [None] * len(self.decoders) + new_cache = [] + for c, decoder in zip(cache, self.decoders): + x, tgt_mask, memory, memory_mask = decoder(x, tgt_mask, memory, None, cache=c) + new_cache.append(x) + + if self.normalize_before: + y = self.after_norm(x[:, -1]) + else: + y = x[:, -1] + if self.output_layer is not None: + y = torch.log_softmax(self.output_layer(y), dim=-1) + + return y, new_cache + + def score(self, ys, state, x): + """Score.""" + ys_mask = subsequent_mask(len(ys), device=x.device).unsqueeze(0) + logp, state = self.forward_one_step(ys.unsqueeze(0), ys_mask, x.unsqueeze(0), cache=state) + return logp.squeeze(0), state + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, n_vocab)` + and next state list for ys. + + """ + # merge states + n_batch = len(ys) + n_layers = len(self.decoders) + if states[0] is None: + batch_state = None + else: + # transpose state of [batch, layer] into [layer, batch] + batch_state = [ + torch.stack([states[b][i] for b in range(n_batch)]) for i in range(n_layers) + ] + + # batch decoding + ys_mask = subsequent_mask(ys.size(-1), device=xs.device).unsqueeze(0) + logp, states = self.forward_one_step(ys, ys_mask, xs, cache=batch_state) + + # transpose state of [layer, batch] into [batch, layer] + state_list = [[states[i][b] for i in range(n_layers)] for b in range(n_batch)] + return logp, state_list + + +@tables.register("decoder_classes", "TransformerDecoder") +class TransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + ): + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + MultiHeadedAttention(attention_heads, attention_dim, self_attention_dropout_rate), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "LightweightConvolutionTransformerDecoder") +class LightweightConvolutionTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + LightweightConvolution( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "LightweightConvolution2DTransformerDecoder") +class LightweightConvolution2DTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + + attention_dim = encoder_output_size + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + LightweightConvolution2D( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "DynamicConvolutionTransformerDecoder") +class DynamicConvolutionTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + attention_dim = encoder_output_size + + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + DynamicConvolution( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) + + +@tables.register("decoder_classes", "DynamicConvolution2DTransformerDecoder") +class DynamicConvolution2DTransformerDecoder(BaseTransformerDecoder): + def __init__( + self, + vocab_size: int, + encoder_output_size: int, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + self_attention_dropout_rate: float = 0.0, + src_attention_dropout_rate: float = 0.0, + input_layer: str = "embed", + use_output_layer: bool = True, + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + conv_wshare: int = 4, + conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11), + conv_usebias: int = False, + ): + if len(conv_kernel_length) != num_blocks: + raise ValueError( + "conv_kernel_length must have equal number of values to num_blocks: " + f"{len(conv_kernel_length)} != {num_blocks}" + ) + super().__init__( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + dropout_rate=dropout_rate, + positional_dropout_rate=positional_dropout_rate, + input_layer=input_layer, + use_output_layer=use_output_layer, + pos_enc_class=pos_enc_class, + normalize_before=normalize_before, + ) + attention_dim = encoder_output_size + + self.decoders = repeat( + num_blocks, + lambda lnum: DecoderLayer( + attention_dim, + DynamicConvolution2D( + wshare=conv_wshare, + n_feat=attention_dim, + dropout_rate=self_attention_dropout_rate, + kernel_size=conv_kernel_length[lnum], + use_kernel_mask=True, + use_bias=conv_usebias, + ), + MultiHeadedAttention(attention_heads, attention_dim, src_attention_dropout_rate), + PositionwiseFeedForward(attention_dim, linear_units, dropout_rate), + dropout_rate, + normalize_before, + concat_after, + ), + ) diff --git a/funasr/models/transformer/embedding.py b/funasr/models/transformer/embedding.py new file mode 100644 index 0000000..7c86dab --- /dev/null +++ b/funasr/models/transformer/embedding.py @@ -0,0 +1,533 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Positional Encoding Module.""" + +import math +import torch +import torch.nn.functional as F +from torch import einsum + + +def _pre_hook( + state_dict, + prefix, + local_metadata, + strict, + missing_keys, + unexpected_keys, + error_msgs, +): + """Perform pre-hook in load_state_dict for backward compatibility. + + Note: + We saved self.pe until v.0.5.2 but we have omitted it later. + Therefore, we remove the item "pe" from `state_dict` for backward compatibility. + + """ + k = prefix + "pe" + if k in state_dict: + state_dict.pop(k) + + +class PositionalEncoding(torch.nn.Module): + """Positional encoding. + + Args: + d_model (int): Embedding dimension. + dropout_rate (float): Dropout rate. + max_len (int): Maximum input length. + reverse (bool): Whether to reverse the input position. Only for + the class LegacyRelPositionalEncoding. We remove it in the current + class RelPositionalEncoding. + """ + + def __init__(self, d_model, dropout_rate, max_len=5000, reverse=False): + """Construct an PositionalEncoding object.""" + super(PositionalEncoding, self).__init__() + self.d_model = d_model + self.reverse = reverse + self.xscale = math.sqrt(self.d_model) + self.dropout = torch.nn.Dropout(p=dropout_rate) + self.pe = None + self.extend_pe(torch.tensor(0.0).expand(1, max_len)) + self._register_load_state_dict_pre_hook(_pre_hook) + + def extend_pe(self, x): + """Reset the positional encodings.""" + if self.pe is not None: + if self.pe.size(1) >= x.size(1): + if self.pe.dtype != x.dtype or self.pe.device != x.device: + self.pe = self.pe.to(dtype=x.dtype, device=x.device) + return + pe = torch.zeros(x.size(1), self.d_model) + if self.reverse: + position = torch.arange(x.size(1) - 1, -1, -1.0, dtype=torch.float32).unsqueeze(1) + else: + position = torch.arange(0, x.size(1), dtype=torch.float32).unsqueeze(1) + div_term = torch.exp( + torch.arange(0, self.d_model, 2, dtype=torch.float32) + * -(math.log(10000.0) / self.d_model) + ) + pe[:, 0::2] = torch.sin(position * div_term) + pe[:, 1::2] = torch.cos(position * div_term) + pe = pe.unsqueeze(0) + self.pe = pe.to(device=x.device, dtype=x.dtype) + + def forward(self, x: torch.Tensor): + """Add positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, time, `*`). + + Returns: + torch.Tensor: Encoded tensor (batch, time, `*`). + """ + self.extend_pe(x) + x = x * self.xscale + self.pe[:, : x.size(1)] + return self.dropout(x) + + +class ScaledPositionalEncoding(PositionalEncoding): + """Scaled positional encoding module. + + See Sec. 3.2 https://arxiv.org/abs/1809.08895 + + Args: + d_model (int): Embedding dimension. + dropout_rate (float): Dropout rate. + max_len (int): Maximum input length. + + """ + + def __init__(self, d_model, dropout_rate, max_len=5000): + """Initialize class.""" + super().__init__(d_model=d_model, dropout_rate=dropout_rate, max_len=max_len) + self.alpha = torch.nn.Parameter(torch.tensor(1.0)) + + def reset_parameters(self): + """Reset parameters.""" + self.alpha.data = torch.tensor(1.0) + + def forward(self, x): + """Add positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, time, `*`). + + Returns: + torch.Tensor: Encoded tensor (batch, time, `*`). + + """ + self.extend_pe(x) + x = x + self.alpha * self.pe[:, : x.size(1)] + return self.dropout(x) + + +class LearnableFourierPosEnc(torch.nn.Module): + """Learnable Fourier Features for Positional Encoding. + + See https://arxiv.org/pdf/2106.02795.pdf + + Args: + d_model (int): Embedding dimension. + dropout_rate (float): Dropout rate. + max_len (int): Maximum input length. + gamma (float): init parameter for the positional kernel variance + see https://arxiv.org/pdf/2106.02795.pdf. + apply_scaling (bool): Whether to scale the input before adding the pos encoding. + hidden_dim (int): if not None, we modulate the pos encodings with + an MLP whose hidden layer has hidden_dim neurons. + """ + + def __init__( + self, + d_model, + dropout_rate=0.0, + max_len=5000, + gamma=1.0, + apply_scaling=False, + hidden_dim=None, + ): + """Initialize class.""" + super(LearnableFourierPosEnc, self).__init__() + + self.d_model = d_model + + if apply_scaling: + self.xscale = math.sqrt(self.d_model) + else: + self.xscale = 1.0 + + self.dropout = torch.nn.Dropout(dropout_rate) + self.max_len = max_len + + self.gamma = gamma + if self.gamma is None: + self.gamma = self.d_model // 2 + + assert d_model % 2 == 0, "d_model should be divisible by two in order to use this layer." + self.w_r = torch.nn.Parameter(torch.empty(1, d_model // 2)) + self._reset() # init the weights + + self.hidden_dim = hidden_dim + if self.hidden_dim is not None: + self.mlp = torch.nn.Sequential( + torch.nn.Linear(d_model, hidden_dim), + torch.nn.GELU(), + torch.nn.Linear(hidden_dim, d_model), + ) + + def _reset(self): + self.w_r.data = torch.normal(0, (1 / math.sqrt(self.gamma)), (1, self.d_model // 2)) + + def extend_pe(self, x): + """Reset the positional encodings.""" + position_v = torch.arange(0, x.size(1), dtype=torch.float32).unsqueeze(1).to(x) + + cosine = torch.cos(torch.matmul(position_v, self.w_r)) + sine = torch.sin(torch.matmul(position_v, self.w_r)) + pos_enc = torch.cat((cosine, sine), -1) + pos_enc /= math.sqrt(self.d_model) + + if self.hidden_dim is None: + return pos_enc.unsqueeze(0) + else: + return self.mlp(pos_enc.unsqueeze(0)) + + def forward(self, x: torch.Tensor): + """Add positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, time, `*`). + + Returns: + torch.Tensor: Encoded tensor (batch, time, `*`). + """ + pe = self.extend_pe(x) + x = x * self.xscale + pe + return self.dropout(x) + + +class LegacyRelPositionalEncoding(PositionalEncoding): + """Relative positional encoding module (old version). + + Details can be found in https://github.com/espnet/espnet/pull/2816. + + See : Appendix B in https://arxiv.org/abs/1901.02860 + + Args: + d_model (int): Embedding dimension. + dropout_rate (float): Dropout rate. + max_len (int): Maximum input length. + + """ + + def __init__(self, d_model, dropout_rate, max_len=5000): + """Initialize class.""" + super().__init__( + d_model=d_model, + dropout_rate=dropout_rate, + max_len=max_len, + reverse=True, + ) + + def forward(self, x): + """Compute positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, time, `*`). + + Returns: + torch.Tensor: Encoded tensor (batch, time, `*`). + torch.Tensor: Positional embedding tensor (1, time, `*`). + + """ + self.extend_pe(x) + x = x * self.xscale + pos_emb = self.pe[:, : x.size(1)] + return self.dropout(x), self.dropout(pos_emb) + + +class RelPositionalEncoding(torch.nn.Module): + """Relative positional encoding module (new implementation). + + Details can be found in https://github.com/espnet/espnet/pull/2816. + + See : Appendix B in https://arxiv.org/abs/1901.02860 + + Args: + d_model (int): Embedding dimension. + dropout_rate (float): Dropout rate. + max_len (int): Maximum input length. + + """ + + def __init__(self, d_model, dropout_rate, max_len=5000): + """Construct an PositionalEncoding object.""" + super(RelPositionalEncoding, self).__init__() + self.d_model = d_model + self.xscale = math.sqrt(self.d_model) + self.dropout = torch.nn.Dropout(p=dropout_rate) + self.pe = None + self.extend_pe(torch.tensor(0.0).expand(1, max_len)) + + def extend_pe(self, x): + """Reset the positional encodings.""" + if self.pe is not None: + # self.pe contains both positive and negative parts + # the length of self.pe is 2 * input_len - 1 + if self.pe.size(1) >= x.size(1) * 2 - 1: + if self.pe.dtype != x.dtype or self.pe.device != x.device: + self.pe = self.pe.to(dtype=x.dtype, device=x.device) + return + # Suppose `i` means to the position of query vecotr and `j` means the + # position of key vector. We use position relative positions when keys + # are to the left (i>j) and negative relative positions otherwise (i= length: + if self.pe.dtype != dtype or self.pe.device != device: + self.pe = self.pe.to(dtype=dtype, device=device) + return + pe = torch.zeros(length, self.d_model) + position = torch.arange(0, length, dtype=torch.float32).unsqueeze(1) + div_term = torch.exp( + torch.arange(0, self.d_model, 2, dtype=torch.float32) + * -(math.log(10000.0) / self.d_model) + ) + pe[:, 0::2] = torch.sin(position * div_term) + pe[:, 1::2] = torch.cos(position * div_term) + pe = pe.unsqueeze(0) + self.pe = pe.to(device=device, dtype=dtype) + + def forward(self, x: torch.Tensor, start_idx: int = 0): + """Add positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, time, `*`). + + Returns: + torch.Tensor: Encoded tensor (batch, time, `*`). + + """ + self.extend_pe(x.size(1) + start_idx, x.device, x.dtype) + x = x * self.xscale + self.pe[:, start_idx : start_idx + x.size(1)] + return self.dropout(x) + + +class SinusoidalPositionEncoder(torch.nn.Module): + """ """ + + def __int__(self, d_model=80, dropout_rate=0.1): + pass + + def encode( + self, positions: torch.Tensor = None, depth: int = None, dtype: torch.dtype = torch.float32 + ): + batch_size = positions.size(0) + positions = positions.type(dtype) + device = positions.device + log_timescale_increment = torch.log(torch.tensor([10000], dtype=dtype, device=device)) / ( + depth / 2 - 1 + ) + inv_timescales = torch.exp( + torch.arange(depth / 2, device=device).type(dtype) * (-log_timescale_increment) + ) + inv_timescales = torch.reshape(inv_timescales, [batch_size, -1]) + scaled_time = torch.reshape(positions, [1, -1, 1]) * torch.reshape( + inv_timescales, [1, 1, -1] + ) + encoding = torch.cat([torch.sin(scaled_time), torch.cos(scaled_time)], dim=2) + return encoding.type(dtype) + + def forward(self, x): + batch_size, timesteps, input_dim = x.size() + positions = torch.arange(1, timesteps + 1, device=x.device)[None, :] + position_encoding = self.encode(positions, input_dim, x.dtype).to(x.device) + + return x + position_encoding + + +class StreamSinusoidalPositionEncoder(torch.nn.Module): + """ """ + + def __int__(self, d_model=80, dropout_rate=0.1): + pass + + def encode( + self, positions: torch.Tensor = None, depth: int = None, dtype: torch.dtype = torch.float32 + ): + batch_size = positions.size(0) + positions = positions.type(dtype) + log_timescale_increment = torch.log(torch.tensor([10000], dtype=dtype)) / (depth / 2 - 1) + inv_timescales = torch.exp(torch.arange(depth / 2).type(dtype) * (-log_timescale_increment)) + inv_timescales = torch.reshape(inv_timescales, [batch_size, -1]) + scaled_time = torch.reshape(positions, [1, -1, 1]) * torch.reshape( + inv_timescales, [1, 1, -1] + ) + encoding = torch.cat([torch.sin(scaled_time), torch.cos(scaled_time)], dim=2) + return encoding.type(dtype) + + def forward(self, x, cache=None): + batch_size, timesteps, input_dim = x.size() + start_idx = 0 + if cache is not None: + start_idx = cache["start_idx"] + cache["start_idx"] += timesteps + positions = torch.arange(1, timesteps + start_idx + 1)[None, :] + position_encoding = self.encode(positions, input_dim, x.dtype).to(x.device) + return x + position_encoding[:, start_idx : start_idx + timesteps] + + +class StreamingRelPositionalEncoding(torch.nn.Module): + """Relative positional encoding. + Args: + size: Module size. + max_len: Maximum input length. + dropout_rate: Dropout rate. + """ + + def __init__(self, size: int, dropout_rate: float = 0.0, max_len: int = 5000) -> None: + """Construct a RelativePositionalEncoding object.""" + super().__init__() + + self.size = size + + self.pe = None + self.dropout = torch.nn.Dropout(p=dropout_rate) + + self.extend_pe(torch.tensor(0.0).expand(1, max_len)) + self._register_load_state_dict_pre_hook(_pre_hook) + + def extend_pe(self, x: torch.Tensor, left_context: int = 0) -> None: + """Reset positional encoding. + Args: + x: Input sequences. (B, T, ?) + left_context: Number of frames in left context. + """ + time1 = x.size(1) + left_context + + if self.pe is not None: + if self.pe.size(1) >= time1 * 2 - 1: + if self.pe.dtype != x.dtype or self.pe.device != x.device: + self.pe = self.pe.to(device=x.device, dtype=x.dtype) + return + + pe_positive = torch.zeros(time1, self.size) + pe_negative = torch.zeros(time1, self.size) + + position = torch.arange(0, time1, dtype=torch.float32).unsqueeze(1) + div_term = torch.exp( + torch.arange(0, self.size, 2, dtype=torch.float32) * -(math.log(10000.0) / self.size) + ) + + pe_positive[:, 0::2] = torch.sin(position * div_term) + pe_positive[:, 1::2] = torch.cos(position * div_term) + pe_positive = torch.flip(pe_positive, [0]).unsqueeze(0) + + pe_negative[:, 0::2] = torch.sin(-1 * position * div_term) + pe_negative[:, 1::2] = torch.cos(-1 * position * div_term) + pe_negative = pe_negative[1:].unsqueeze(0) + + self.pe = torch.cat([pe_positive, pe_negative], dim=1).to(dtype=x.dtype, device=x.device) + + def forward(self, x: torch.Tensor, left_context: int = 0) -> torch.Tensor: + """Compute positional encoding. + Args: + x: Input sequences. (B, T, ?) + left_context: Number of frames in left context. + Returns: + pos_enc: Positional embedding sequences. (B, 2 * (T - 1), ?) + """ + self.extend_pe(x, left_context=left_context) + + time1 = x.size(1) + left_context + + pos_enc = self.pe[:, self.pe.size(1) // 2 - time1 + 1 : self.pe.size(1) // 2 + x.size(1)] + pos_enc = self.dropout(pos_enc) + + return pos_enc + + +class ScaledSinuEmbedding(torch.nn.Module): + def __init__(self, dim): + super().__init__() + self.scale = torch.nn.Parameter( + torch.ones( + 1, + ) + ) + inv_freq = 1.0 / (10000 ** (torch.arange(0, dim, 2).float() / dim)) + self.register_buffer("inv_freq", inv_freq) + + def forward(self, x): + n, device = x.shape[1], x.device + t = torch.arange(n, device=device).type_as(self.inv_freq) + sinu = einsum("i , j -> i j", t, self.inv_freq) + emb = torch.cat((sinu.sin(), sinu.cos()), dim=-1) + return emb * self.scale diff --git a/funasr/models/transformer/encoder.py b/funasr/models/transformer/encoder.py new file mode 100644 index 0000000..a6a85ae --- /dev/null +++ b/funasr/models/transformer/encoder.py @@ -0,0 +1,329 @@ +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Transformer encoder definition.""" + +from typing import List +from typing import Optional +from typing import Tuple + +import torch +from torch import nn +import logging + +from funasr.models.transformer.attention import MultiHeadedAttention +from funasr.models.transformer.embedding import PositionalEncoding +from funasr.models.transformer.layer_norm import LayerNorm +from funasr.models.transformer.utils.multi_layer_conv import Conv1dLinear +from funasr.models.transformer.utils.multi_layer_conv import MultiLayeredConv1d +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.transformer.positionwise_feed_forward import PositionwiseFeedForward +from funasr.models.transformer.utils.repeat import repeat +from funasr.models.ctc.ctc import CTC + +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling2 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling6 +from funasr.models.transformer.utils.subsampling import Conv2dSubsampling8 +from funasr.models.transformer.utils.subsampling import TooShortUttError +from funasr.models.transformer.utils.subsampling import check_short_utt + +from funasr.register import tables + + +class EncoderLayer(nn.Module): + """Encoder layer module. + + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` instance + can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance + can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): Whether to use layer_norm before the first block. + concat_after (bool): Whether to concat attention layer's input and output. + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. i.e. x -> x + att(x) + stochastic_depth_rate (float): Proability to skip this layer. + During training, the layer may skip residual computation and return input + as-is with given probability. + """ + + def __init__( + self, + size, + self_attn, + feed_forward, + dropout_rate, + normalize_before=True, + concat_after=False, + stochastic_depth_rate=0.0, + ): + """Construct an EncoderLayer object.""" + super(EncoderLayer, self).__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.norm1 = LayerNorm(size) + self.norm2 = LayerNorm(size) + self.dropout = nn.Dropout(dropout_rate) + self.size = size + self.normalize_before = normalize_before + self.concat_after = concat_after + if self.concat_after: + self.concat_linear = nn.Linear(size + size, size) + self.stochastic_depth_rate = stochastic_depth_rate + + def forward(self, x, mask, cache=None): + """Compute encoded features. + + Args: + x_input (torch.Tensor): Input tensor (#batch, time, size). + mask (torch.Tensor): Mask tensor for the input (#batch, time). + cache (torch.Tensor): Cache tensor of the input (#batch, time - 1, size). + + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time). + + """ + skip_layer = False + # with stochastic depth, residual connection `x + f(x)` becomes + # `x <- x + 1 / (1 - p) * f(x)` at training time. + stoch_layer_coeff = 1.0 + if self.training and self.stochastic_depth_rate > 0: + skip_layer = torch.rand(1).item() < self.stochastic_depth_rate + stoch_layer_coeff = 1.0 / (1 - self.stochastic_depth_rate) + + if skip_layer: + if cache is not None: + x = torch.cat([cache, x], dim=1) + return x, mask + + residual = x + if self.normalize_before: + x = self.norm1(x) + + if cache is None: + x_q = x + else: + assert cache.shape == (x.shape[0], x.shape[1] - 1, self.size) + x_q = x[:, -1:, :] + residual = residual[:, -1:, :] + mask = None if mask is None else mask[:, -1:, :] + + if self.concat_after: + x_concat = torch.cat((x, self.self_attn(x_q, x, x, mask)), dim=-1) + x = residual + stoch_layer_coeff * self.concat_linear(x_concat) + else: + x = residual + stoch_layer_coeff * self.dropout(self.self_attn(x_q, x, x, mask)) + if not self.normalize_before: + x = self.norm1(x) + + residual = x + if self.normalize_before: + x = self.norm2(x) + x = residual + stoch_layer_coeff * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm2(x) + + if cache is not None: + x = torch.cat([cache, x], dim=1) + + return x, mask + + +@tables.register("encoder_classes", "TransformerEncoder") +class TransformerEncoder(nn.Module): + """Transformer encoder module. + + Args: + input_size: input dim + output_size: dimension of attention + attention_heads: the number of heads of multi head attention + linear_units: the number of units of position-wise feed forward + num_blocks: the number of decoder blocks + dropout_rate: dropout rate + attention_dropout_rate: dropout rate in attention + positional_dropout_rate: dropout rate after adding positional encoding + input_layer: input layer type + pos_enc_class: PositionalEncoding or ScaledPositionalEncoding + normalize_before: whether to use layer_norm before the first block + concat_after: whether to concat attention layer's input and output + if True, additional linear will be applied. + i.e. x -> x + linear(concat(x, att(x))) + if False, no additional linear will be applied. + i.e. x -> x + att(x) + positionwise_layer_type: linear of conv1d + positionwise_conv_kernel_size: kernel size of positionwise conv1d layer + padding_idx: padding_idx for input_layer=embed + """ + + def __init__( + self, + input_size: int, + output_size: int = 256, + attention_heads: int = 4, + linear_units: int = 2048, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: Optional[str] = "conv2d", + pos_enc_class=PositionalEncoding, + normalize_before: bool = True, + concat_after: bool = False, + positionwise_layer_type: str = "linear", + positionwise_conv_kernel_size: int = 1, + padding_idx: int = -1, + interctc_layer_idx: List[int] = [], + interctc_use_conditioning: bool = False, + ): + super().__init__() + self._output_size = output_size + + if input_layer == "linear": + self.embed = torch.nn.Sequential( + torch.nn.Linear(input_size, output_size), + torch.nn.LayerNorm(output_size), + torch.nn.Dropout(dropout_rate), + torch.nn.ReLU(), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer == "conv2d": + self.embed = Conv2dSubsampling(input_size, output_size, dropout_rate) + elif input_layer == "conv2d2": + self.embed = Conv2dSubsampling2(input_size, output_size, dropout_rate) + elif input_layer == "conv2d6": + self.embed = Conv2dSubsampling6(input_size, output_size, dropout_rate) + elif input_layer == "conv2d8": + self.embed = Conv2dSubsampling8(input_size, output_size, dropout_rate) + elif input_layer == "embed": + self.embed = torch.nn.Sequential( + torch.nn.Embedding(input_size, output_size, padding_idx=padding_idx), + pos_enc_class(output_size, positional_dropout_rate), + ) + elif input_layer is None: + if input_size == output_size: + self.embed = None + else: + self.embed = torch.nn.Linear(input_size, output_size) + else: + raise ValueError("unknown input_layer: " + input_layer) + self.normalize_before = normalize_before + if positionwise_layer_type == "linear": + positionwise_layer = PositionwiseFeedForward + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d": + positionwise_layer = MultiLayeredConv1d + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + elif positionwise_layer_type == "conv1d-linear": + positionwise_layer = Conv1dLinear + positionwise_layer_args = ( + output_size, + linear_units, + positionwise_conv_kernel_size, + dropout_rate, + ) + else: + raise NotImplementedError("Support only linear or conv1d.") + self.encoders = repeat( + num_blocks, + lambda lnum: EncoderLayer( + output_size, + MultiHeadedAttention(attention_heads, output_size, attention_dropout_rate), + positionwise_layer(*positionwise_layer_args), + dropout_rate, + normalize_before, + concat_after, + ), + ) + if self.normalize_before: + self.after_norm = LayerNorm(output_size) + + self.interctc_layer_idx = interctc_layer_idx + if len(interctc_layer_idx) > 0: + assert 0 < min(interctc_layer_idx) and max(interctc_layer_idx) < num_blocks + self.interctc_use_conditioning = interctc_use_conditioning + self.conditioning_layer = None + + def output_size(self) -> int: + return self._output_size + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ctc: CTC = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + """Embed positions in tensor. + + Args: + xs_pad: input tensor (B, L, D) + ilens: input length (B) + prev_states: Not to be used now. + Returns: + position embedded tensor and mask + """ + masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device) + + if self.embed is None: + xs_pad = xs_pad + elif ( + isinstance(self.embed, Conv2dSubsampling) + or isinstance(self.embed, Conv2dSubsampling2) + or isinstance(self.embed, Conv2dSubsampling6) + or isinstance(self.embed, Conv2dSubsampling8) + ): + short_status, limit_size = check_short_utt(self.embed, xs_pad.size(1)) + if short_status: + raise TooShortUttError( + f"has {xs_pad.size(1)} frames and is too short for subsampling " + + f"(it needs more than {limit_size} frames), return empty results", + xs_pad.size(1), + limit_size, + ) + xs_pad, masks = self.embed(xs_pad, masks) + else: + xs_pad = self.embed(xs_pad) + + intermediate_outs = [] + if len(self.interctc_layer_idx) == 0: + xs_pad, masks = self.encoders(xs_pad, masks) + else: + for layer_idx, encoder_layer in enumerate(self.encoders): + xs_pad, masks = encoder_layer(xs_pad, masks) + + if layer_idx + 1 in self.interctc_layer_idx: + encoder_out = xs_pad + + # intermediate outputs are also normalized + if self.normalize_before: + encoder_out = self.after_norm(encoder_out) + + intermediate_outs.append((layer_idx + 1, encoder_out)) + + if self.interctc_use_conditioning: + ctc_out = ctc.softmax(encoder_out) + xs_pad = xs_pad + self.conditioning_layer(ctc_out) + + if self.normalize_before: + xs_pad = self.after_norm(xs_pad) + + olens = masks.squeeze(1).sum(1) + if len(intermediate_outs) > 0: + return (xs_pad, intermediate_outs), olens, None + return xs_pad, olens, None diff --git a/funasr/models/transformer/layer_norm.py b/funasr/models/transformer/layer_norm.py new file mode 100644 index 0000000..ce4f887 --- /dev/null +++ b/funasr/models/transformer/layer_norm.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Layer normalization module.""" + +import torch +import torch.nn as nn + + +class LayerNorm(torch.nn.LayerNorm): + """Layer normalization module. + + Args: + nout (int): Output dim size. + dim (int): Dimension to be normalized. + + """ + + def __init__(self, nout, dim=-1): + """Construct an LayerNorm object.""" + super(LayerNorm, self).__init__(nout, eps=1e-12) + self.dim = dim + + def forward(self, x): + """Apply layer normalization. + + Args: + x (torch.Tensor): Input tensor. + + Returns: + torch.Tensor: Normalized tensor. + + """ + if self.dim == -1: + return super(LayerNorm, self).forward(x) + return super(LayerNorm, self).forward(x.transpose(self.dim, -1)).transpose(self.dim, -1) + + +class GlobalLayerNorm(nn.Module): + """Calculate Global Layer Normalization. + + Arguments + --------- + dim : (int or list or torch.Size) + Input shape from an expected input of size. + eps : float + A value added to the denominator for numerical stability. + elementwise_affine : bool + A boolean value that when set to True, + this module has learnable per-element affine parameters + initialized to ones (for weights) and zeros (for biases). + + Example + ------- + >>> x = torch.randn(5, 10, 20) + >>> GLN = GlobalLayerNorm(10, 3) + >>> x_norm = GLN(x) + """ + + def __init__(self, dim, shape, eps=1e-8, elementwise_affine=True): + super(GlobalLayerNorm, self).__init__() + self.dim = dim + self.eps = eps + self.elementwise_affine = elementwise_affine + + if self.elementwise_affine: + if shape == 3: + self.weight = nn.Parameter(torch.ones(self.dim, 1)) + self.bias = nn.Parameter(torch.zeros(self.dim, 1)) + if shape == 4: + self.weight = nn.Parameter(torch.ones(self.dim, 1, 1)) + self.bias = nn.Parameter(torch.zeros(self.dim, 1, 1)) + else: + self.register_parameter("weight", None) + self.register_parameter("bias", None) + + def forward(self, x): + """Returns the normalized tensor. + + Arguments + --------- + x : torch.Tensor + Tensor of size [N, C, K, S] or [N, C, L]. + """ + # x = N x C x K x S or N x C x L + # N x 1 x 1 + # cln: mean,var N x 1 x K x S + # gln: mean,var N x 1 x 1 + if x.dim() == 3: + mean = torch.mean(x, (1, 2), keepdim=True) + var = torch.mean((x - mean) ** 2, (1, 2), keepdim=True) + if self.elementwise_affine: + x = self.weight * (x - mean) / torch.sqrt(var + self.eps) + self.bias + else: + x = (x - mean) / torch.sqrt(var + self.eps) + + if x.dim() == 4: + mean = torch.mean(x, (1, 2, 3), keepdim=True) + var = torch.mean((x - mean) ** 2, (1, 2, 3), keepdim=True) + if self.elementwise_affine: + x = self.weight * (x - mean) / torch.sqrt(var + self.eps) + self.bias + else: + x = (x - mean) / torch.sqrt(var + self.eps) + return x + + +class CumulativeLayerNorm(nn.LayerNorm): + """Calculate Cumulative Layer Normalization. + + Arguments + --------- + dim : int + Dimension that you want to normalize. + elementwise_affine : True + Learnable per-element affine parameters. + + Example + ------- + >>> x = torch.randn(5, 10, 20) + >>> CLN = CumulativeLayerNorm(10) + >>> x_norm = CLN(x) + """ + + def __init__(self, dim, elementwise_affine=True): + super(CumulativeLayerNorm, self).__init__( + dim, elementwise_affine=elementwise_affine, eps=1e-8 + ) + + def forward(self, x): + """Returns the normalized tensor. + + Arguments + --------- + x : torch.Tensor + Tensor size [N, C, K, S] or [N, C, L] + """ + # x: N x C x K x S or N x C x L + # N x K x S x C + if x.dim() == 4: + x = x.permute(0, 2, 3, 1).contiguous() + # N x K x S x C == only channel norm + x = super().forward(x) + # N x C x K x S + x = x.permute(0, 3, 1, 2).contiguous() + if x.dim() == 3: + x = torch.transpose(x, 1, 2) + # N x L x C == only channel norm + x = super().forward(x) + # N x C x L + x = torch.transpose(x, 1, 2) + return x + + +class ScaleNorm(nn.Module): + def __init__(self, dim, eps=1e-5): + super().__init__() + self.scale = dim**-0.5 + self.eps = eps + self.g = nn.Parameter(torch.ones(1)) + + def forward(self, x): + norm = torch.norm(x, dim=-1, keepdim=True) * self.scale + return x / norm.clamp(min=self.eps) * self.g diff --git a/funasr/models/transformer/model.py b/funasr/models/transformer/model.py new file mode 100644 index 0000000..0d5ed23 --- /dev/null +++ b/funasr/models/transformer/model.py @@ -0,0 +1,461 @@ +import logging +from typing import Union, Dict, List, Tuple, Optional + +import time +import torch +import torch.nn as nn +from torch.cuda.amp import autocast + +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.ctc.ctc import CTC +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.metrics.compute_acc import th_accuracy + +# from funasr.models.e2e_asr_common import ErrorCalculator +from funasr.train_utils.device_funcs import force_gatherable +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.utils import postprocess_utils +from funasr.utils.datadir_writer import DatadirWriter +from funasr.register import tables + + +@tables.register("model_classes", "Transformer") +class Transformer(nn.Module): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.5, + interctc_weight: float = 0.0, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + if decoder is not None: + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + **decoder_conf, + ) + if ctc_weight > 0.0: + + if ctc_conf is None: + ctc_conf = {} + + ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **ctc_conf) + + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.ctc_weight = ctc_weight + self.specaug = specaug + self.normalize = normalize + self.encoder = encoder + + if not hasattr(self.encoder, "interctc_use_conditioning"): + self.encoder.interctc_use_conditioning = False + if self.encoder.interctc_use_conditioning: + self.encoder.conditioning_layer = torch.nn.Linear( + vocab_size, self.encoder.output_size() + ) + self.interctc_weight = interctc_weight + + # self.error_calculator = None + if ctc_weight == 1.0: + self.decoder = None + else: + self.decoder = decoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + # + # if report_cer or report_wer: + # self.error_calculator = ErrorCalculator( + # token_list, sym_space, sym_blank, report_cer, report_wer + # ) + # + self.error_calculator = None + if ctc_weight == 0.0: + self.ctc = None + else: + self.ctc = ctc + + self.share_embedding = share_embedding + if self.share_embedding: + self.decoder.embed = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + loss_att, acc_att, cer_att, wer_att = None, None, None, None + loss_ctc, cer_ctc = None, None + stats = dict() + + # decoder: CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # Intermediate CTC (optional) + loss_interctc = 0.0 + if self.interctc_weight != 0.0 and intermediate_outs is not None: + for layer_idx, intermediate_out in intermediate_outs: + # we assume intermediate_out has the same length & padding + # as those of encoder_out + loss_ic, cer_ic = self._calc_ctc_loss( + intermediate_out, encoder_out_lens, text, text_lengths + ) + loss_interctc = loss_interctc + loss_ic + + # Collect Intermedaite CTC stats + stats["loss_interctc_layer{}".format(layer_idx)] = ( + loss_ic.detach() if loss_ic is not None else None + ) + stats["cer_interctc_layer{}".format(layer_idx)] = cer_ic + + loss_interctc = loss_interctc / len(intermediate_outs) + + # calculate whole encoder loss + loss_ctc = (1 - self.interctc_weight) * loss_ctc + self.interctc_weight * loss_interctc + + # decoder: Attention decoder branch + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + elif self.ctc_weight == 1.0: + loss = loss_ctc + else: + loss = self.ctc_weight * loss_ctc + (1 - self.ctc_weight) * loss_att + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + + # Collect total loss stats + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + if self.encoder.interctc_use_conditioning: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths, ctc=self.ctc) + else: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + if intermediate_outs is not None: + return (encoder_out, intermediate_outs), encoder_out_lens + + return encoder_out, encoder_out_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, _ = self.decoder(encoder_out, encoder_out_lens, ys_in_pad, ys_in_lens) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + # Calc CTC loss + loss_ctc = self.ctc(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + + # Calc CER using CTC + cer_ctc = None + if not self.training and self.error_calculator is not None: + ys_hat = self.ctc.argmax(encoder_out).data + cer_ctc = self.error_calculator(ys_hat.cpu(), ys_pad.cpu(), is_ctc=True) + return loss_ctc, cer_ctc + + def init_beam_search( + self, + **kwargs, + ): + from funasr.models.transformer.search import BeamSearch + from funasr.models.transformer.scorers.ctc import CTCPrefixScorer + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + if self.ctc != None: + ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos) + scorers.update(ctc=ctc) + token_list = kwargs.get("token_list") + scorers.update( + decoder=self.decoder, + length_bonus=LengthBonus(len(token_list)), + ) + + # 3. Build ngram model + # ngram is not supported now + ngram = None + scorers["ngram"] = ngram + + weights = dict( + decoder=1.0 - kwargs.get("decoding_ctc_weight", 0.5), + ctc=kwargs.get("decoding_ctc_weight", 0.5), + lm=kwargs.get("lm_weight", 0.0), + ngram=kwargs.get("ngram_weight", 0.0), + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearch( + beam_size=kwargs.get("beam_size", 10), + weights=weights, + scorers=scorers, + sos=self.sos, + eos=self.eos, + vocab_size=len(token_list), + token_list=token_list, + pre_beam_score_key=None if self.ctc_weight == 1.0 else "full", + ) + + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + # init beamsearch + if self.beam_search is None: + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + b, n, d = encoder_out.size() + for i in range(b): + + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text = tokenizer.tokens2text(token) + + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + result_i = {"key": key[i], "token": token, "text": text_postprocessed} + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text_postprocessed + + return results, meta_data diff --git a/funasr/models/transformer/positionwise_feed_forward.py b/funasr/models/transformer/positionwise_feed_forward.py new file mode 100644 index 0000000..7cfa5f9 --- /dev/null +++ b/funasr/models/transformer/positionwise_feed_forward.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Positionwise feed forward layer definition.""" + +import torch + +from funasr.models.transformer.layer_norm import LayerNorm + + +class PositionwiseFeedForward(torch.nn.Module): + """Positionwise feed forward layer. + + Args: + idim (int): Input dimenstion. + hidden_units (int): The number of hidden units. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, idim, hidden_units, dropout_rate, activation=torch.nn.ReLU()): + """Construct an PositionwiseFeedForward object.""" + super(PositionwiseFeedForward, self).__init__() + self.w_1 = torch.nn.Linear(idim, hidden_units) + self.w_2 = torch.nn.Linear(hidden_units, idim) + self.dropout = torch.nn.Dropout(dropout_rate) + self.activation = activation + + def forward(self, x): + """Forward function.""" + return self.w_2(self.dropout(self.activation(self.w_1(x)))) + + +class PositionwiseFeedForwardDecoderSANMExport(torch.nn.Module): + def __init__(self, model): + super().__init__() + self.w_1 = model.w_1 + self.w_2 = model.w_2 + self.activation = model.activation + self.norm = model.norm + + def forward(self, x): + x = self.activation(self.w_1(x)) + x = self.w_2(self.norm(x)) + return x diff --git a/funasr/models/transformer/scorers/__init__.py b/funasr/models/transformer/scorers/__init__.py new file mode 100644 index 0000000..b7f1773 --- /dev/null +++ b/funasr/models/transformer/scorers/__init__.py @@ -0,0 +1 @@ +"""Initialize sub package.""" diff --git a/funasr/models/transformer/scorers/ctc.py b/funasr/models/transformer/scorers/ctc.py new file mode 100644 index 0000000..73a14bd --- /dev/null +++ b/funasr/models/transformer/scorers/ctc.py @@ -0,0 +1,156 @@ +"""ScorerInterface implementation for CTC.""" + +import numpy as np +import torch + +from funasr.models.transformer.scorers.ctc_prefix_score import CTCPrefixScore +from funasr.models.transformer.scorers.ctc_prefix_score import CTCPrefixScoreTH +from funasr.models.transformer.scorers.scorer_interface import BatchPartialScorerInterface + + +class CTCPrefixScorer(BatchPartialScorerInterface): + """Decoder interface wrapper for CTCPrefixScore.""" + + def __init__(self, ctc: torch.nn.Module, eos: int): + """Initialize class. + + Args: + ctc (torch.nn.Module): The CTC implementation. + For example, :class:`espnet.nets.pytorch_backend.ctc.CTC` + eos (int): The end-of-sequence id. + + """ + self.ctc = ctc + self.eos = eos + self.impl = None + + def init_state(self, x: torch.Tensor): + """Get an initial state for decoding. + + Args: + x (torch.Tensor): The encoded feature tensor + + Returns: initial state + + """ + logp = self.ctc.log_softmax(x.unsqueeze(0)).detach().squeeze(0).cpu().numpy() + # TODO(karita): use CTCPrefixScoreTH + self.impl = CTCPrefixScore(logp, 0, self.eos, np) + return 0, self.impl.initial_state() + + def select_state(self, state, i, new_id=None): + """Select state with relative ids in the main beam search. + + Args: + state: Decoder state for prefix tokens + i (int): Index to select a state in the main beam search + new_id (int): New label id to select a state if necessary + + Returns: + state: pruned state + + """ + if type(state) == tuple: + if len(state) == 2: # for CTCPrefixScore + sc, st = state + return sc[i], st[i] + else: # for CTCPrefixScoreTH (need new_id > 0) + r, log_psi, f_min, f_max, scoring_idmap = state + s = log_psi[i, new_id].expand(log_psi.size(1)) + if scoring_idmap is not None: + return r[:, :, i, scoring_idmap[i, new_id]], s, f_min, f_max + else: + return r[:, :, i, new_id], s, f_min, f_max + return None if state is None else state[i] + + def score_partial(self, y, ids, state, x): + """Score new token. + + Args: + y (torch.Tensor): 1D prefix token + next_tokens (torch.Tensor): torch.int64 next token to score + state: decoder state for prefix tokens + x (torch.Tensor): 2D encoder feature that generates ys + + Returns: + tuple[torch.Tensor, Any]: + Tuple of a score tensor for y that has a shape `(len(next_tokens),)` + and next state for ys + + """ + prev_score, state = state + presub_score, new_st = self.impl(y.cpu(), ids.cpu(), state) + tscore = torch.as_tensor(presub_score - prev_score, device=x.device, dtype=x.dtype) + return tscore, (presub_score, new_st) + + def batch_init_state(self, x: torch.Tensor): + """Get an initial state for decoding. + + Args: + x (torch.Tensor): The encoded feature tensor + + Returns: initial state + + """ + logp = self.ctc.log_softmax(x.unsqueeze(0)) # assuming batch_size = 1 + xlen = torch.tensor([logp.size(1)]) + self.impl = CTCPrefixScoreTH(logp, xlen, 0, self.eos) + return None + + def batch_score_partial(self, y, ids, state, x): + """Score new token. + + Args: + y (torch.Tensor): 1D prefix token + ids (torch.Tensor): torch.int64 next token to score + state: decoder state for prefix tokens + x (torch.Tensor): 2D encoder feature that generates ys + + Returns: + tuple[torch.Tensor, Any]: + Tuple of a score tensor for y that has a shape `(len(next_tokens),)` + and next state for ys + + """ + batch_state = ( + ( + torch.stack([s[0] for s in state], dim=2), + torch.stack([s[1] for s in state]), + state[0][2], + state[0][3], + ) + if state[0] is not None + else None + ) + return self.impl(y, batch_state, ids) + + def extend_prob(self, x: torch.Tensor): + """Extend probs for decoding. + + This extension is for streaming decoding + as in Eq (14) in https://arxiv.org/abs/2006.14941 + + Args: + x (torch.Tensor): The encoded feature tensor + + """ + logp = self.ctc.log_softmax(x.unsqueeze(0)) + self.impl.extend_prob(logp) + + def extend_state(self, state): + """Extend state for decoding. + + This extension is for streaming decoding + as in Eq (14) in https://arxiv.org/abs/2006.14941 + + Args: + state: The states of hyps + + Returns: exteded state + + """ + new_state = [] + for s in state: + new_state.append(self.impl.extend_state(s)) + + return new_state diff --git a/funasr/models/transformer/scorers/ctc_prefix_score.py b/funasr/models/transformer/scorers/ctc_prefix_score.py new file mode 100644 index 0000000..ce0703e --- /dev/null +++ b/funasr/models/transformer/scorers/ctc_prefix_score.py @@ -0,0 +1,337 @@ +#!/usr/bin/env python3 + +# Copyright 2018 Mitsubishi Electric Research Labs (Takaaki Hori) +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +import torch + +import numpy as np +import six + + +class CTCPrefixScoreTH(object): + """Batch processing of CTCPrefixScore + + which is based on Algorithm 2 in WATANABE et al. + "HYBRID CTC/ATTENTION ARCHITECTURE FOR END-TO-END SPEECH RECOGNITION," + but extended to efficiently compute the label probablities for multiple + hypotheses simultaneously + See also Seki et al. "Vectorized Beam Search for CTC-Attention-Based + Speech Recognition," In INTERSPEECH (pp. 3825-3829), 2019. + """ + + def __init__(self, x, xlens, blank, eos, margin=0): + """Construct CTC prefix scorer + + :param torch.Tensor x: input label posterior sequences (B, T, O) + :param torch.Tensor xlens: input lengths (B,) + :param int blank: blank label id + :param int eos: end-of-sequence id + :param int margin: margin parameter for windowing (0 means no windowing) + """ + # In the comment lines, + # we assume T: input_length, B: batch size, W: beam width, O: output dim. + self.logzero = -10000000000.0 + self.blank = blank + self.eos = eos + self.batch = x.size(0) + self.input_length = x.size(1) + self.odim = x.size(2) + self.dtype = x.dtype + self.device = torch.device("cuda:%d" % x.get_device()) if x.is_cuda else torch.device("cpu") + # Pad the rest of posteriors in the batch + # TODO(takaaki-hori): need a better way without for-loops + for i, l in enumerate(xlens): + if l < self.input_length: + x[i, l:, :] = self.logzero + x[i, l:, blank] = 0 + # Reshape input x + xn = x.transpose(0, 1) # (B, T, O) -> (T, B, O) + xb = xn[:, :, self.blank].unsqueeze(2).expand(-1, -1, self.odim) + self.x = torch.stack([xn, xb]) # (2, T, B, O) + self.end_frames = torch.as_tensor(xlens) - 1 + + # Setup CTC windowing + self.margin = margin + if margin > 0: + self.frame_ids = torch.arange(self.input_length, dtype=self.dtype, device=self.device) + # Base indices for index conversion + self.idx_bh = None + self.idx_b = torch.arange(self.batch, device=self.device) + self.idx_bo = (self.idx_b * self.odim).unsqueeze(1) + + def __call__(self, y, state, scoring_ids=None, att_w=None): + """Compute CTC prefix scores for next labels + + :param list y: prefix label sequences + :param tuple state: previous CTC state + :param torch.Tensor pre_scores: scores for pre-selection of hypotheses (BW, O) + :param torch.Tensor att_w: attention weights to decide CTC window + :return new_state, ctc_local_scores (BW, O) + """ + output_length = len(y[0]) - 1 # ignore sos + last_ids = [yi[-1] for yi in y] # last output label ids + n_bh = len(last_ids) # batch * hyps + n_hyps = n_bh // self.batch # assuming each utterance has the same # of hyps + self.scoring_num = scoring_ids.size(-1) if scoring_ids is not None else 0 + # prepare state info + if state is None: + r_prev = torch.full( + (self.input_length, 2, self.batch, n_hyps), + self.logzero, + dtype=self.dtype, + device=self.device, + ) + r_prev[:, 1] = torch.cumsum(self.x[0, :, :, self.blank], 0).unsqueeze(2) + r_prev = r_prev.view(-1, 2, n_bh) + s_prev = 0.0 + f_min_prev = 0 + f_max_prev = 1 + else: + r_prev, s_prev, f_min_prev, f_max_prev = state + + # select input dimensions for scoring + if self.scoring_num > 0: + scoring_idmap = torch.full((n_bh, self.odim), -1, dtype=torch.long, device=self.device) + snum = self.scoring_num + if self.idx_bh is None or n_bh > len(self.idx_bh): + self.idx_bh = torch.arange(n_bh, device=self.device).view(-1, 1) + scoring_idmap[self.idx_bh[:n_bh], scoring_ids] = torch.arange(snum, device=self.device) + scoring_idx = (scoring_ids + self.idx_bo.repeat(1, n_hyps).view(-1, 1)).view(-1) + x_ = torch.index_select( + self.x.view(2, -1, self.batch * self.odim), 2, scoring_idx + ).view(2, -1, n_bh, snum) + else: + scoring_ids = None + scoring_idmap = None + snum = self.odim + x_ = self.x.unsqueeze(3).repeat(1, 1, 1, n_hyps, 1).view(2, -1, n_bh, snum) + + # new CTC forward probs are prepared as a (T x 2 x BW x S) tensor + # that corresponds to r_t^n(h) and r_t^b(h) in a batch. + r = torch.full( + (self.input_length, 2, n_bh, snum), + self.logzero, + dtype=self.dtype, + device=self.device, + ) + if output_length == 0: + r[0, 0] = x_[0, 0] + + r_sum = torch.logsumexp(r_prev, 1) + log_phi = r_sum.unsqueeze(2).repeat(1, 1, snum) + if scoring_ids is not None: + for idx in range(n_bh): + pos = scoring_idmap[idx, last_ids[idx]] + if pos >= 0: + log_phi[:, idx, pos] = r_prev[:, 1, idx] + else: + for idx in range(n_bh): + log_phi[:, idx, last_ids[idx]] = r_prev[:, 1, idx] + + # decide start and end frames based on attention weights + if att_w is not None and self.margin > 0: + f_arg = torch.matmul(att_w, self.frame_ids) + f_min = max(int(f_arg.min().cpu()), f_min_prev) + f_max = max(int(f_arg.max().cpu()), f_max_prev) + start = min(f_max_prev, max(f_min - self.margin, output_length, 1)) + end = min(f_max + self.margin, self.input_length) + else: + f_min = f_max = 0 + start = max(output_length, 1) + end = self.input_length + + # compute forward probabilities log(r_t^n(h)) and log(r_t^b(h)) + for t in range(start, end): + rp = r[t - 1] + rr = torch.stack([rp[0], log_phi[t - 1], rp[0], rp[1]]).view(2, 2, n_bh, snum) + r[t] = torch.logsumexp(rr, 1) + x_[:, t] + + # compute log prefix probabilities log(psi) + log_phi_x = torch.cat((log_phi[0].unsqueeze(0), log_phi[:-1]), dim=0) + x_[0] + if scoring_ids is not None: + log_psi = torch.full( + (n_bh, self.odim), self.logzero, dtype=self.dtype, device=self.device + ) + log_psi_ = torch.logsumexp( + torch.cat((log_phi_x[start:end], r[start - 1, 0].unsqueeze(0)), dim=0), + dim=0, + ) + for si in range(n_bh): + log_psi[si, scoring_ids[si]] = log_psi_[si] + else: + log_psi = torch.logsumexp( + torch.cat((log_phi_x[start:end], r[start - 1, 0].unsqueeze(0)), dim=0), + dim=0, + ) + + for si in range(n_bh): + log_psi[si, self.eos] = r_sum[self.end_frames[si // n_hyps], si] + + # exclude blank probs + log_psi[:, self.blank] = self.logzero + + return (log_psi - s_prev), (r, log_psi, f_min, f_max, scoring_idmap) + + def index_select_state(self, state, best_ids): + """Select CTC states according to best ids + + :param state : CTC state + :param best_ids : index numbers selected by beam pruning (B, W) + :return selected_state + """ + r, s, f_min, f_max, scoring_idmap = state + # convert ids to BHO space + n_bh = len(s) + n_hyps = n_bh // self.batch + vidx = (best_ids + (self.idx_b * (n_hyps * self.odim)).view(-1, 1)).view(-1) + # select hypothesis scores + s_new = torch.index_select(s.view(-1), 0, vidx) + s_new = s_new.view(-1, 1).repeat(1, self.odim).view(n_bh, self.odim) + # convert ids to BHS space (S: scoring_num) + if scoring_idmap is not None: + snum = self.scoring_num + hyp_idx = (best_ids // self.odim + (self.idx_b * n_hyps).view(-1, 1)).view(-1) + label_ids = torch.fmod(best_ids, self.odim).view(-1) + score_idx = scoring_idmap[hyp_idx, label_ids] + score_idx[score_idx == -1] = 0 + vidx = score_idx + hyp_idx * snum + else: + snum = self.odim + # select forward probabilities + r_new = torch.index_select(r.view(-1, 2, n_bh * snum), 2, vidx).view(-1, 2, n_bh) + return r_new, s_new, f_min, f_max + + def extend_prob(self, x): + """Extend CTC prob. + + :param torch.Tensor x: input label posterior sequences (B, T, O) + """ + + if self.x.shape[1] < x.shape[1]: # self.x (2,T,B,O); x (B,T,O) + # Pad the rest of posteriors in the batch + # TODO(takaaki-hori): need a better way without for-loops + xlens = [x.size(1)] + for i, l in enumerate(xlens): + if l < self.input_length: + x[i, l:, :] = self.logzero + x[i, l:, self.blank] = 0 + tmp_x = self.x + xn = x.transpose(0, 1) # (B, T, O) -> (T, B, O) + xb = xn[:, :, self.blank].unsqueeze(2).expand(-1, -1, self.odim) + self.x = torch.stack([xn, xb]) # (2, T, B, O) + self.x[:, : tmp_x.shape[1], :, :] = tmp_x + self.input_length = x.size(1) + self.end_frames = torch.as_tensor(xlens) - 1 + + def extend_state(self, state): + """Compute CTC prefix state. + + + :param state : CTC state + :return ctc_state + """ + + if state is None: + # nothing to do + return state + else: + r_prev, s_prev, f_min_prev, f_max_prev = state + + r_prev_new = torch.full( + (self.input_length, 2), + self.logzero, + dtype=self.dtype, + device=self.device, + ) + start = max(r_prev.shape[0], 1) + r_prev_new[0:start] = r_prev + for t in six.moves.range(start, self.input_length): + r_prev_new[t, 1] = r_prev_new[t - 1, 1] + self.x[0, t, :, self.blank] + + return (r_prev_new, s_prev, f_min_prev, f_max_prev) + + +class CTCPrefixScore(object): + """Compute CTC label sequence scores + + which is based on Algorithm 2 in WATANABE et al. + "HYBRID CTC/ATTENTION ARCHITECTURE FOR END-TO-END SPEECH RECOGNITION," + but extended to efficiently compute the probablities of multiple labels + simultaneously + """ + + def __init__(self, x, blank, eos, xp): + self.xp = xp + self.logzero = -10000000000.0 + self.blank = blank + self.eos = eos + self.input_length = len(x) + self.x = x + + def initial_state(self): + """Obtain an initial CTC state + + :return: CTC state + """ + # initial CTC state is made of a frame x 2 tensor that corresponds to + # r_t^n() and r_t^b(), where 0 and 1 of axis=1 represent + # superscripts n and b (non-blank and blank), respectively. + r = self.xp.full((self.input_length, 2), self.logzero, dtype=np.float32) + r[0, 1] = self.x[0, self.blank] + for i in six.moves.range(1, self.input_length): + r[i, 1] = r[i - 1, 1] + self.x[i, self.blank] + return r + + def __call__(self, y, cs, r_prev): + """Compute CTC prefix scores for next labels + + :param y : prefix label sequence + :param cs : array of next labels + :param r_prev: previous CTC state + :return ctc_scores, ctc_states + """ + # initialize CTC states + output_length = len(y) - 1 # ignore sos + # new CTC states are prepared as a frame x (n or b) x n_labels tensor + # that corresponds to r_t^n(h) and r_t^b(h). + r = self.xp.ndarray((self.input_length, 2, len(cs)), dtype=np.float32) + xs = self.x[:, cs] + if output_length == 0: + r[0, 0] = xs[0] + r[0, 1] = self.logzero + else: + r[output_length - 1] = self.logzero + + # prepare forward probabilities for the last label + r_sum = self.xp.logaddexp(r_prev[:, 0], r_prev[:, 1]) # log(r_t^n(g) + r_t^b(g)) + last = y[-1] + if output_length > 0 and last in cs: + log_phi = self.xp.ndarray((self.input_length, len(cs)), dtype=np.float32) + for i in six.moves.range(len(cs)): + log_phi[:, i] = r_sum if cs[i] != last else r_prev[:, 1] + else: + log_phi = r_sum + + # compute forward probabilities log(r_t^n(h)), log(r_t^b(h)), + # and log prefix probabilities log(psi) + start = max(output_length, 1) + log_psi = r[start - 1, 0] + for t in six.moves.range(start, self.input_length): + r[t, 0] = self.xp.logaddexp(r[t - 1, 0], log_phi[t - 1]) + xs[t] + r[t, 1] = self.xp.logaddexp(r[t - 1, 0], r[t - 1, 1]) + self.x[t, self.blank] + log_psi = self.xp.logaddexp(log_psi, log_phi[t - 1] + xs[t]) + + # get P(...eos|X) that ends with the prefix itself + eos_pos = self.xp.where(cs == self.eos)[0] + if len(eos_pos) > 0: + log_psi[eos_pos] = r_sum[-1] # log(r_T^n(g) + r_T^b(g)) + + # exclude blank probs + blank_pos = self.xp.where(cs == self.blank)[0] + if len(blank_pos) > 0: + log_psi[blank_pos] = self.logzero + + # return the log prefix probability and CTC states, where the label axis + # of the CTC states is moved to the first axis to slice it easily + return log_psi, self.xp.rollaxis(r, 2) diff --git a/funasr/models/transformer/scorers/length_bonus.py b/funasr/models/transformer/scorers/length_bonus.py new file mode 100644 index 0000000..3a7e9e0 --- /dev/null +++ b/funasr/models/transformer/scorers/length_bonus.py @@ -0,0 +1,60 @@ +"""Length bonus module.""" + +from typing import Any +from typing import List +from typing import Tuple + +import torch + +from funasr.models.transformer.scorers.scorer_interface import BatchScorerInterface + + +class LengthBonus(BatchScorerInterface): + """Length bonus in beam search.""" + + def __init__(self, n_vocab: int): + """Initialize class. + + Args: + n_vocab (int): The number of tokens in vocabulary for beam search + + """ + self.n = n_vocab + + def score(self, y, state, x): + """Score new token. + + Args: + y (torch.Tensor): 1D torch.int64 prefix tokens. + state: Scorer state for prefix tokens + x (torch.Tensor): 2D encoder feature that generates ys. + + Returns: + tuple[torch.Tensor, Any]: Tuple of + torch.float32 scores for next token (n_vocab) + and None + + """ + return torch.tensor([1.0], device=x.device, dtype=x.dtype).expand(self.n), None + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, n_vocab)` + and next state list for ys. + + """ + return ( + torch.tensor([1.0], device=xs.device, dtype=xs.dtype).expand(ys.shape[0], self.n), + None, + ) diff --git a/funasr/models/transformer/scorers/scorer_interface.py b/funasr/models/transformer/scorers/scorer_interface.py new file mode 100644 index 0000000..3acdf2f --- /dev/null +++ b/funasr/models/transformer/scorers/scorer_interface.py @@ -0,0 +1,186 @@ +"""Scorer interface module.""" + +from typing import Any +from typing import List +from typing import Tuple + +import torch +import warnings + + +class ScorerInterface: + """Scorer interface for beam search. + + The scorer performs scoring of the all tokens in vocabulary. + + Examples: + * Search heuristics + * :class:`espnet.nets.scorers.length_bonus.LengthBonus` + * Decoder networks of the sequence-to-sequence models + * :class:`espnet.nets.pytorch_backend.nets.transformer.decoder.Decoder` + * :class:`espnet.nets.pytorch_backend.nets.rnn.decoders.Decoder` + * Neural language models + * :class:`espnet.nets.pytorch_backend.lm.transformer.TransformerLM` + * :class:`espnet.nets.pytorch_backend.lm.default.DefaultRNNLM` + * :class:`espnet.nets.pytorch_backend.lm.seq_rnn.SequentialRNNLM` + + """ + + def init_state(self, x: torch.Tensor) -> Any: + """Get an initial state for decoding (optional). + + Args: + x (torch.Tensor): The encoded feature tensor + + Returns: initial state + + """ + return None + + def select_state(self, state: Any, i: int, new_id: int = None) -> Any: + """Select state with relative ids in the main beam search. + + Args: + state: Decoder state for prefix tokens + i (int): Index to select a state in the main beam search + new_id (int): New label index to select a state if necessary + + Returns: + state: pruned state + + """ + return None if state is None else state[i] + + def score(self, y: torch.Tensor, state: Any, x: torch.Tensor) -> Tuple[torch.Tensor, Any]: + """Score new token (required). + + Args: + y (torch.Tensor): 1D torch.int64 prefix tokens. + state: Scorer state for prefix tokens + x (torch.Tensor): The encoder feature that generates ys. + + Returns: + tuple[torch.Tensor, Any]: Tuple of + scores for next token that has a shape of `(n_vocab)` + and next state for ys + + """ + raise NotImplementedError + + def final_score(self, state: Any) -> float: + """Score eos (optional). + + Args: + state: Scorer state for prefix tokens + + Returns: + float: final score + + """ + return 0.0 + + +class BatchScorerInterface(ScorerInterface): + """Batch scorer interface.""" + + def batch_init_state(self, x: torch.Tensor) -> Any: + """Get an initial state for decoding (optional). + + Args: + x (torch.Tensor): The encoded feature tensor + + Returns: initial state + + """ + return self.init_state(x) + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch (required). + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, n_vocab)` + and next state list for ys. + + """ + warnings.warn( + "{} batch score is implemented through for loop not parallelized".format( + self.__class__.__name__ + ) + ) + scores = list() + outstates = list() + for i, (y, state, x) in enumerate(zip(ys, states, xs)): + score, outstate = self.score(y, state, x) + outstates.append(outstate) + scores.append(score) + scores = torch.cat(scores, 0).view(ys.shape[0], -1) + return scores, outstates + + +class PartialScorerInterface(ScorerInterface): + """Partial scorer interface for beam search. + + The partial scorer performs scoring when non-partial scorer finished scoring, + and receives pre-pruned next tokens to score because it is too heavy to score + all the tokens. + + Examples: + * Prefix search for connectionist-temporal-classification models + * :class:`espnet.nets.scorers.ctc.CTCPrefixScorer` + + """ + + def score_partial( + self, y: torch.Tensor, next_tokens: torch.Tensor, state: Any, x: torch.Tensor + ) -> Tuple[torch.Tensor, Any]: + """Score new token (required). + + Args: + y (torch.Tensor): 1D prefix token + next_tokens (torch.Tensor): torch.int64 next token to score + state: decoder state for prefix tokens + x (torch.Tensor): The encoder feature that generates ys + + Returns: + tuple[torch.Tensor, Any]: + Tuple of a score tensor for y that has a shape `(len(next_tokens),)` + and next state for ys + + """ + raise NotImplementedError + + +class BatchPartialScorerInterface(BatchScorerInterface, PartialScorerInterface): + """Batch partial scorer interface for beam search.""" + + def batch_score_partial( + self, + ys: torch.Tensor, + next_tokens: torch.Tensor, + states: List[Any], + xs: torch.Tensor, + ) -> Tuple[torch.Tensor, Any]: + """Score new token (required). + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + next_tokens (torch.Tensor): torch.int64 tokens to score (n_batch, n_token). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, Any]: + Tuple of a score tensor for ys that has a shape `(n_batch, n_vocab)` + and next states for ys + """ + raise NotImplementedError diff --git a/funasr/models/transformer/search.py b/funasr/models/transformer/search.py new file mode 100644 index 0000000..c1d90b6 --- /dev/null +++ b/funasr/models/transformer/search.py @@ -0,0 +1,449 @@ +from itertools import chain +import logging +from typing import Any +from typing import Dict +from typing import List +from typing import NamedTuple +from typing import Tuple +from typing import Union + +import torch + +from funasr.metrics.common import end_detect +from funasr.models.transformer.scorers.scorer_interface import PartialScorerInterface +from funasr.models.transformer.scorers.scorer_interface import ScorerInterface + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: torch.Tensor + score: Union[float, torch.Tensor] = 0 + scores: Dict[str, Union[float, torch.Tensor]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +class BeamSearch(torch.nn.Module): + """Beam search implementation.""" + + def __init__( + self, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + beam_size: int, + vocab_size: int, + sos: int, + eos: int, + token_list: List[str] = None, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = None, + ): + """Initialize beam search. + + Args: + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + sos (int): Start of sequence id + eos (int): End of sequence id + token_list (list[str]): List of tokens for debug log + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + """ + super().__init__() + # set scorers + self.weights = weights + self.scorers = dict() + self.full_scorers = dict() + self.part_scorers = dict() + # this module dict is required for recursive cast + # `self.to(device, dtype)` in `recog.py` + self.nn_dict = torch.nn.ModuleDict() + for k, v in scorers.items(): + w = weights.get(k, 0) + if w == 0 or v is None: + continue + assert isinstance( + v, ScorerInterface + ), f"{k} ({type(v)}) does not implement ScorerInterface" + self.scorers[k] = v + if isinstance(v, PartialScorerInterface): + self.part_scorers[k] = v + else: + self.full_scorers[k] = v + if isinstance(v, torch.nn.Module): + self.nn_dict[k] = v + + # set configurations + self.sos = sos + self.eos = eos + self.token_list = token_list + self.pre_beam_size = int(pre_beam_ratio * beam_size) + self.beam_size = beam_size + self.n_vocab = vocab_size + if ( + pre_beam_score_key is not None + and pre_beam_score_key != "full" + and pre_beam_score_key not in self.full_scorers + ): + raise KeyError(f"{pre_beam_score_key} is not found in {self.full_scorers}") + self.pre_beam_score_key = pre_beam_score_key + self.do_pre_beam = ( + self.pre_beam_score_key is not None + and self.pre_beam_size < self.n_vocab + and len(self.part_scorers) > 0 + ) + + def init_hyp(self, x: torch.Tensor) -> List[Hypothesis]: + """Get an initial hypothesis data. + + Args: + x (torch.Tensor): The encoder output feature + + Returns: + Hypothesis: The initial hypothesis. + + """ + init_states = dict() + init_scores = dict() + for k, d in self.scorers.items(): + init_states[k] = d.init_state(x) + init_scores[k] = 0.0 + return [ + Hypothesis( + score=0.0, + scores=init_scores, + states=init_states, + yseq=torch.tensor([self.sos], device=x.device), + ) + ] + + @staticmethod + def append_token(xs: torch.Tensor, x: int) -> torch.Tensor: + """Append new token to prefix tokens. + + Args: + xs (torch.Tensor): The prefix token + x (int): The new token to append + + Returns: + torch.Tensor: New tensor contains: xs + [x] with xs.dtype and xs.device + + """ + x = torch.tensor([x], dtype=xs.dtype, device=xs.device) + return torch.cat((xs, x)) + + def score_full( + self, hyp: Hypothesis, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.full_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.full_scorers` + and tensor score values of shape: `(self.n_vocab,)`, + and state dict that has string keys + and state values of `self.full_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.full_scorers.items(): + scores[k], states[k] = d.score(hyp.yseq, hyp.states[k], x) + return scores, states + + def score_partial( + self, hyp: Hypothesis, ids: torch.Tensor, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.part_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + ids (torch.Tensor): 1D tensor of new partial tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.part_scorers` + and tensor score values of shape: `(len(ids),)`, + and state dict that has string keys + and state values of `self.part_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.part_scorers.items(): + scores[k], states[k] = d.score_partial(hyp.yseq, ids, hyp.states[k], x) + return scores, states + + def beam( + self, weighted_scores: torch.Tensor, ids: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute topk full token ids and partial token ids. + + Args: + weighted_scores (torch.Tensor): The weighted sum scores for each tokens. + Its shape is `(self.n_vocab,)`. + ids (torch.Tensor): The partial token ids to compute topk + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + The topk full token ids and partial token ids. + Their shapes are `(self.beam_size,)` + + """ + # no pre beam performed + if weighted_scores.size(0) == ids.size(0): + top_ids = weighted_scores.topk(self.beam_size)[1] + return top_ids, top_ids + + # mask pruned in pre-beam not to select in topk + tmp = weighted_scores[ids] + weighted_scores[:] = -float("inf") + weighted_scores[ids] = tmp + top_ids = weighted_scores.topk(self.beam_size)[1] + local_ids = weighted_scores[ids].topk(self.beam_size)[1] + return top_ids, local_ids + + @staticmethod + def merge_scores( + prev_scores: Dict[str, float], + next_full_scores: Dict[str, torch.Tensor], + full_idx: int, + next_part_scores: Dict[str, torch.Tensor], + part_idx: int, + ) -> Dict[str, torch.Tensor]: + """Merge scores for new hypothesis. + + Args: + prev_scores (Dict[str, float]): + The previous hypothesis scores by `self.scorers` + next_full_scores (Dict[str, torch.Tensor]): scores by `self.full_scorers` + full_idx (int): The next token id for `next_full_scores` + next_part_scores (Dict[str, torch.Tensor]): + scores of partial tokens by `self.part_scorers` + part_idx (int): The new token id for `next_part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are scalar tensors by the scorers. + + """ + new_scores = dict() + for k, v in next_full_scores.items(): + new_scores[k] = prev_scores[k] + v[full_idx] + for k, v in next_part_scores.items(): + new_scores[k] = prev_scores[k] + v[part_idx] + return new_scores + + def merge_states(self, states: Any, part_states: Any, part_idx: int) -> Any: + """Merge states for new hypothesis. + + Args: + states: states of `self.full_scorers` + part_states: states of `self.part_scorers` + part_idx (int): The new token id for `part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are states of the scorers. + + """ + new_states = dict() + for k, v in states.items(): + new_states[k] = v + for k, d in self.part_scorers.items(): + new_states[k] = d.select_state(part_states[k], part_idx) + return new_states + + def search(self, running_hyps: List[Hypothesis], x: torch.Tensor) -> List[Hypothesis]: + """Search new tokens for running hypotheses and encoded speech x. + + Args: + running_hyps (List[Hypothesis]): Running hypotheses on beam + x (torch.Tensor): Encoded speech feature (T, D) + + Returns: + List[Hypotheses]: Best sorted hypotheses + + """ + best_hyps = [] + part_ids = torch.arange(self.n_vocab, device=x.device) # no pre-beam + for hyp in running_hyps: + # scoring + weighted_scores = torch.zeros(self.n_vocab, dtype=x.dtype, device=x.device) + scores, states = self.score_full(hyp, x) + for k in self.full_scorers: + weighted_scores += self.weights[k] * scores[k] + # partial scoring + if self.do_pre_beam: + pre_beam_scores = ( + weighted_scores + if self.pre_beam_score_key == "full" + else scores[self.pre_beam_score_key] + ) + part_ids = torch.topk(pre_beam_scores, self.pre_beam_size)[1] + part_scores, part_states = self.score_partial(hyp, part_ids, x) + for k in self.part_scorers: + weighted_scores[part_ids] += self.weights[k] * part_scores[k] + # add previous hyp score + weighted_scores += hyp.score + + # update hyps + for j, part_j in zip(*self.beam(weighted_scores, part_ids)): + # will be (2 x beam at most) + best_hyps.append( + Hypothesis( + score=weighted_scores[j], + yseq=self.append_token(hyp.yseq, j), + scores=self.merge_scores(hyp.scores, scores, j, part_scores, part_j), + states=self.merge_states(states, part_states, part_j), + ) + ) + + # sort and prune 2 x beam -> beam + best_hyps = sorted(best_hyps, key=lambda x: x.score, reverse=True)[ + : min(len(best_hyps), self.beam_size) + ] + return best_hyps + + def forward( + self, x: torch.Tensor, maxlenratio: float = 0.0, minlenratio: float = 0.0 + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + If maxlenratio<0.0, its absolute value is interpreted + as a constant max output length. + minlenratio (float): Input length ratio to obtain min output length. + + Returns: + list[Hypothesis]: N-best decoding results + + """ + # set length bounds + if maxlenratio == 0: + maxlen = x.shape[0] + elif maxlenratio < 0: + maxlen = -1 * int(maxlenratio) + else: + maxlen = max(1, int(maxlenratio * x.size(0))) + minlen = int(minlenratio * x.size(0)) + logging.info("decoder input length: " + str(x.shape[0])) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # main loop of prefix search + running_hyps = self.init_hyp(x) + ended_hyps = [] + for i in range(maxlen): + logging.debug("position " + str(i)) + best = self.search(running_hyps, x) + # post process of one iteration + running_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps) + # end detection + if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i): + logging.info(f"end detected at {i}") + break + if len(running_hyps) == 0: + logging.info("no hypothesis. Finish decoding.") + break + else: + logging.debug(f"remained hypotheses: {len(running_hyps)}") + + nbest_hyps = sorted(ended_hyps, key=lambda x: x.score, reverse=True) + # check the number of hypotheses reaching to eos + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, perform recognition " "again with smaller minlenratio." + ) + return ( + [] + if minlenratio < 0.1 + else self.forward(x, maxlenratio, max(0.0, minlenratio - 0.1)) + ) + + # report the best result + best = nbest_hyps[0] + for k, v in best.scores.items(): + logging.info(f"{v:6.2f} * {self.weights[k]:3} = {v * self.weights[k]:6.2f} for {k}") + logging.info(f"total log probability: {best.score:.2f}") + logging.info(f"normalized log probability: {best.score / len(best.yseq):.2f}") + logging.info(f"total number of ended hypotheses: {len(nbest_hyps)}") + if self.token_list is not None: + logging.info( + "best hypo: " + "".join([self.token_list[x] for x in best.yseq[1:-1]]) + "\n" + ) + return nbest_hyps + + def post_process( + self, + i: int, + maxlen: int, + maxlenratio: float, + running_hyps: List[Hypothesis], + ended_hyps: List[Hypothesis], + ) -> List[Hypothesis]: + """Perform post-processing of beam search iterations. + + Args: + i (int): The length of hypothesis tokens. + maxlen (int): The maximum length of tokens in beam search. + maxlenratio (int): The maximum length ratio in beam search. + running_hyps (List[Hypothesis]): The running hypotheses in beam search. + ended_hyps (List[Hypothesis]): The ended hypotheses in beam search. + + Returns: + List[Hypothesis]: The new running hypotheses. + + """ + logging.debug(f"the number of running hypotheses: {len(running_hyps)}") + if self.token_list is not None: + logging.debug( + "best hypo: " + "".join([self.token_list[x] for x in running_hyps[0].yseq[1:]]) + ) + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + running_hyps = [ + h._replace(yseq=self.append_token(h.yseq, self.eos)) for h in running_hyps + ] + + # add ended hypotheses to a final list, and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in running_hyps: + if hyp.yseq[-1] == self.eos: + # e.g., Word LM needs to add final score + for k, d in chain(self.full_scorers.items(), self.part_scorers.items()): + s = d.final_score(hyp.states[k]) + hyp.scores[k] += s + hyp = hyp._replace(score=hyp.score + self.weights[k] * s) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + return remained_hyps diff --git a/funasr/models/transformer/template.yaml b/funasr/models/transformer/template.yaml new file mode 100644 index 0000000..eb597f9 --- /dev/null +++ b/funasr/models/transformer/template.yaml @@ -0,0 +1,110 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: Transformer +model_conf: + ctc_weight: 0.3 + lsm_weight: 0.1 # label smoothing option + length_normalized_loss: false + +# encoder +encoder: TransformerEncoder +encoder_conf: + output_size: 256 # dimension of attention + attention_heads: 4 + linear_units: 2048 # the number of units of position-wise feed forward + num_blocks: 12 # the number of encoder blocks + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.0 + input_layer: conv2d # encoder architecture type + normalize_before: true + +# decoder +decoder: TransformerDecoder +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 6 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.0 + src_attention_dropout_rate: 0.0 + + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 1 + lfr_n: 1 + +specaug: SpecAug +specaug_conf: + apply_time_warp: true + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + num_freq_mask: 2 + apply_time_mask: true + time_mask_width_range: + - 0 + - 40 + num_time_mask: 2 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + val_scheduler_criterion: + - valid + - acc + best_model_criterion: + - - valid + - acc + - max + keep_nbest_models: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.002 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/transformer/utils/__init__.py b/funasr/models/transformer/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/transformer/utils/add_sos_eos.py b/funasr/models/transformer/utils/add_sos_eos.py new file mode 100644 index 0000000..beead1b --- /dev/null +++ b/funasr/models/transformer/utils/add_sos_eos.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Unility functions for Transformer.""" + +import torch +from funasr.models.transformer.utils.nets_utils import pad_list + + +def add_sos_eos(ys_pad, sos, eos, ignore_id): + """Add and labels. + + :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax) + :param int sos: index of + :param int eos: index of + :param int ignore_id: index of padding + :return: padded tensor (B, Lmax) + :rtype: torch.Tensor + :return: padded tensor (B, Lmax) + :rtype: torch.Tensor + """ + + _sos = ys_pad.new([sos]) + _eos = ys_pad.new([eos]) + ys = [y[y != ignore_id] for y in ys_pad] # parse padded ys + ys_in = [torch.cat([_sos, y], dim=0) for y in ys] + ys_out = [torch.cat([y, _eos], dim=0) for y in ys] + return pad_list(ys_in, eos), pad_list(ys_out, ignore_id) diff --git a/funasr/models/transformer/utils/dynamic_conv.py b/funasr/models/transformer/utils/dynamic_conv.py new file mode 100644 index 0000000..f685038 --- /dev/null +++ b/funasr/models/transformer/utils/dynamic_conv.py @@ -0,0 +1,125 @@ +"""Dynamic Convolution module.""" + +import numpy +import torch +from torch import nn +import torch.nn.functional as F + + +MIN_VALUE = float(numpy.finfo(numpy.float32).min) + + +class DynamicConvolution(nn.Module): + """Dynamic Convolution layer. + + This implementation is based on + https://github.com/pytorch/fairseq/tree/master/fairseq + + Args: + wshare (int): the number of kernel of convolution + n_feat (int): the number of features + dropout_rate (float): dropout_rate + kernel_size (int): kernel size (length) + use_kernel_mask (bool): Use causal mask or not for convolution kernel + use_bias (bool): Use bias term or not. + + """ + + def __init__( + self, + wshare, + n_feat, + dropout_rate, + kernel_size, + use_kernel_mask=False, + use_bias=False, + ): + """Construct Dynamic Convolution layer.""" + super(DynamicConvolution, self).__init__() + + assert n_feat % wshare == 0 + self.wshare = wshare + self.use_kernel_mask = use_kernel_mask + self.dropout_rate = dropout_rate + self.kernel_size = kernel_size + self.attn = None + + # linear -> GLU -- -> lightconv -> linear + # \ / + # Linear + self.linear1 = nn.Linear(n_feat, n_feat * 2) + self.linear2 = nn.Linear(n_feat, n_feat) + self.linear_weight = nn.Linear(n_feat, self.wshare * 1 * kernel_size) + nn.init.xavier_uniform(self.linear_weight.weight) + self.act = nn.GLU() + + # dynamic conv related + self.use_bias = use_bias + if self.use_bias: + self.bias = nn.Parameter(torch.Tensor(n_feat)) + + def forward(self, query, key, value, mask): + """Forward of 'Dynamic Convolution'. + + This function takes query, key and value but uses only quert. + This is just for compatibility with self-attention layer (attention.py) + + Args: + query (torch.Tensor): (batch, time1, d_model) input tensor + key (torch.Tensor): (batch, time2, d_model) NOT USED + value (torch.Tensor): (batch, time2, d_model) NOT USED + mask (torch.Tensor): (batch, time1, time2) mask + + Return: + x (torch.Tensor): (batch, time1, d_model) output + + """ + # linear -> GLU -- -> lightconv -> linear + # \ / + # Linear + x = query + B, T, C = x.size() + H = self.wshare + k = self.kernel_size + + # first liner layer + x = self.linear1(x) + + # GLU activation + x = self.act(x) + + # get kernel of convolution + weight = self.linear_weight(x) # B x T x kH + weight = F.dropout(weight, self.dropout_rate, training=self.training) + weight = weight.view(B, T, H, k).transpose(1, 2).contiguous() # B x H x T x k + weight_new = torch.zeros(B * H * T * (T + k - 1), dtype=weight.dtype) + weight_new = weight_new.view(B, H, T, T + k - 1).fill_(float("-inf")) + weight_new = weight_new.to(x.device) # B x H x T x T+k-1 + weight_new.as_strided((B, H, T, k), ((T + k - 1) * T * H, (T + k - 1) * T, T + k, 1)).copy_( + weight + ) + weight_new = weight_new.narrow(-1, int((k - 1) / 2), T) # B x H x T x T(k) + if self.use_kernel_mask: + kernel_mask = torch.tril(torch.ones(T, T, device=x.device)).unsqueeze(0) + weight_new = weight_new.masked_fill(kernel_mask == 0.0, float("-inf")) + weight_new = F.softmax(weight_new, dim=-1) + self.attn = weight_new + weight_new = weight_new.view(B * H, T, T) + + # convolution + x = x.transpose(1, 2).contiguous() # B x C x T + x = x.view(B * H, int(C / H), T).transpose(1, 2) + x = torch.bmm(weight_new, x) # BH x T x C/H + x = x.transpose(1, 2).contiguous().view(B, C, T) + + if self.use_bias: + x = x + self.bias.view(1, -1, 1) + x = x.transpose(1, 2) # B x T x C + + if mask is not None and not self.use_kernel_mask: + mask = mask.transpose(-1, -2) + x = x.masked_fill(mask == 0, 0.0) + + # second linear layer + x = self.linear2(x) + return x diff --git a/funasr/models/transformer/utils/dynamic_conv2d.py b/funasr/models/transformer/utils/dynamic_conv2d.py new file mode 100644 index 0000000..29d4dd8 --- /dev/null +++ b/funasr/models/transformer/utils/dynamic_conv2d.py @@ -0,0 +1,136 @@ +"""Dynamic 2-Dimensional Convolution module.""" + +import numpy +import torch +from torch import nn +import torch.nn.functional as F + + +MIN_VALUE = float(numpy.finfo(numpy.float32).min) + + +class DynamicConvolution2D(nn.Module): + """Dynamic 2-Dimensional Convolution layer. + + This implementation is based on + https://github.com/pytorch/fairseq/tree/master/fairseq + + Args: + wshare (int): the number of kernel of convolution + n_feat (int): the number of features + dropout_rate (float): dropout_rate + kernel_size (int): kernel size (length) + use_kernel_mask (bool): Use causal mask or not for convolution kernel + use_bias (bool): Use bias term or not. + + """ + + def __init__( + self, + wshare, + n_feat, + dropout_rate, + kernel_size, + use_kernel_mask=False, + use_bias=False, + ): + """Construct Dynamic 2-Dimensional Convolution layer.""" + super(DynamicConvolution2D, self).__init__() + + assert n_feat % wshare == 0 + self.wshare = wshare + self.use_kernel_mask = use_kernel_mask + self.dropout_rate = dropout_rate + self.kernel_size = kernel_size + self.padding_size = int(kernel_size / 2) + self.attn_t = None + self.attn_f = None + + # linear -> GLU -- -> lightconv -> linear + # \ / + # Linear + self.linear1 = nn.Linear(n_feat, n_feat * 2) + self.linear2 = nn.Linear(n_feat * 2, n_feat) + self.linear_weight = nn.Linear(n_feat, self.wshare * 1 * kernel_size) + nn.init.xavier_uniform(self.linear_weight.weight) + self.linear_weight_f = nn.Linear(n_feat, kernel_size) + nn.init.xavier_uniform(self.linear_weight_f.weight) + self.act = nn.GLU() + + # dynamic conv related + self.use_bias = use_bias + if self.use_bias: + self.bias = nn.Parameter(torch.Tensor(n_feat)) + + def forward(self, query, key, value, mask): + """Forward of 'Dynamic 2-Dimensional Convolution'. + + This function takes query, key and value but uses only query. + This is just for compatibility with self-attention layer (attention.py) + + Args: + query (torch.Tensor): (batch, time1, d_model) input tensor + key (torch.Tensor): (batch, time2, d_model) NOT USED + value (torch.Tensor): (batch, time2, d_model) NOT USED + mask (torch.Tensor): (batch, time1, time2) mask + + Return: + x (torch.Tensor): (batch, time1, d_model) output + + """ + # linear -> GLU -- -> lightconv -> linear + # \ / + # Linear + x = query + B, T, C = x.size() + H = self.wshare + k = self.kernel_size + + # first liner layer + x = self.linear1(x) + + # GLU activation + x = self.act(x) + + # convolution of frequency axis + weight_f = self.linear_weight_f(x).view(B * T, 1, k) # B x T x k + self.attn_f = weight_f.view(B, T, k).unsqueeze(1) + xf = F.conv1d(x.view(1, B * T, C), weight_f, padding=self.padding_size, groups=B * T) + xf = xf.view(B, T, C) + + # get kernel of convolution + weight = self.linear_weight(x) # B x T x kH + weight = F.dropout(weight, self.dropout_rate, training=self.training) + weight = weight.view(B, T, H, k).transpose(1, 2).contiguous() # B x H x T x k + weight_new = torch.zeros(B * H * T * (T + k - 1), dtype=weight.dtype) + weight_new = weight_new.view(B, H, T, T + k - 1).fill_(float("-inf")) + weight_new = weight_new.to(x.device) # B x H x T x T+k-1 + weight_new.as_strided((B, H, T, k), ((T + k - 1) * T * H, (T + k - 1) * T, T + k, 1)).copy_( + weight + ) + weight_new = weight_new.narrow(-1, int((k - 1) / 2), T) # B x H x T x T(k) + if self.use_kernel_mask: + kernel_mask = torch.tril(torch.ones(T, T, device=x.device)).unsqueeze(0) + weight_new = weight_new.masked_fill(kernel_mask == 0.0, float("-inf")) + weight_new = F.softmax(weight_new, dim=-1) + self.attn_t = weight_new + weight_new = weight_new.view(B * H, T, T) + + # convolution + x = x.transpose(1, 2).contiguous() # B x C x T + x = x.view(B * H, int(C / H), T).transpose(1, 2) + x = torch.bmm(weight_new, x) + x = x.transpose(1, 2).contiguous().view(B, C, T) + + if self.use_bias: + x = x + self.bias.view(1, -1, 1) + x = x.transpose(1, 2) # B x T x C + x = torch.cat((x, xf), -1) # B x T x Cx2 + + if mask is not None and not self.use_kernel_mask: + mask = mask.transpose(-1, -2) + x = x.masked_fill(mask == 0, 0.0) + + # second linear layer + x = self.linear2(x) + return x diff --git a/funasr/models/transformer/utils/lightconv.py b/funasr/models/transformer/utils/lightconv.py new file mode 100644 index 0000000..b6d131b --- /dev/null +++ b/funasr/models/transformer/utils/lightconv.py @@ -0,0 +1,108 @@ +"""Lightweight Convolution Module.""" + +import numpy +import torch +from torch import nn +import torch.nn.functional as F + + +MIN_VALUE = float(numpy.finfo(numpy.float32).min) + + +class LightweightConvolution(nn.Module): + """Lightweight Convolution layer. + + This implementation is based on + https://github.com/pytorch/fairseq/tree/master/fairseq + + Args: + wshare (int): the number of kernel of convolution + n_feat (int): the number of features + dropout_rate (float): dropout_rate + kernel_size (int): kernel size (length) + use_kernel_mask (bool): Use causal mask or not for convolution kernel + use_bias (bool): Use bias term or not. + + """ + + def __init__( + self, + wshare, + n_feat, + dropout_rate, + kernel_size, + use_kernel_mask=False, + use_bias=False, + ): + """Construct Lightweight Convolution layer.""" + super(LightweightConvolution, self).__init__() + + assert n_feat % wshare == 0 + self.wshare = wshare + self.use_kernel_mask = use_kernel_mask + self.dropout_rate = dropout_rate + self.kernel_size = kernel_size + self.padding_size = int(kernel_size / 2) + + # linear -> GLU -> lightconv -> linear + self.linear1 = nn.Linear(n_feat, n_feat * 2) + self.linear2 = nn.Linear(n_feat, n_feat) + self.act = nn.GLU() + + # lightconv related + self.weight = nn.Parameter(torch.Tensor(self.wshare, 1, kernel_size).uniform_(0, 1)) + self.use_bias = use_bias + if self.use_bias: + self.bias = nn.Parameter(torch.Tensor(n_feat)) + + # mask of kernel + kernel_mask0 = torch.zeros(self.wshare, int(kernel_size / 2)) + kernel_mask1 = torch.ones(self.wshare, int(kernel_size / 2 + 1)) + self.kernel_mask = torch.cat((kernel_mask1, kernel_mask0), dim=-1).unsqueeze(1) + + def forward(self, query, key, value, mask): + """Forward of 'Lightweight Convolution'. + + This function takes query, key and value but uses only query. + This is just for compatibility with self-attention layer (attention.py) + + Args: + query (torch.Tensor): (batch, time1, d_model) input tensor + key (torch.Tensor): (batch, time2, d_model) NOT USED + value (torch.Tensor): (batch, time2, d_model) NOT USED + mask (torch.Tensor): (batch, time1, time2) mask + + Return: + x (torch.Tensor): (batch, time1, d_model) output + + """ + # linear -> GLU -> lightconv -> linear + x = query + B, T, C = x.size() + H = self.wshare + + # first liner layer + x = self.linear1(x) + + # GLU activation + x = self.act(x) + + # lightconv + x = x.transpose(1, 2).contiguous().view(-1, H, T) # B x C x T + weight = F.dropout(self.weight, self.dropout_rate, training=self.training) + if self.use_kernel_mask: + self.kernel_mask = self.kernel_mask.to(x.device) + weight = weight.masked_fill(self.kernel_mask == 0.0, float("-inf")) + weight = F.softmax(weight, dim=-1) + x = F.conv1d(x, weight, padding=self.padding_size, groups=self.wshare).view(B, C, T) + if self.use_bias: + x = x + self.bias.view(1, -1, 1) + x = x.transpose(1, 2) # B x T x C + + if mask is not None and not self.use_kernel_mask: + mask = mask.transpose(-1, -2) + x = x.masked_fill(mask == 0, 0.0) + + # second linear layer + x = self.linear2(x) + return x diff --git a/funasr/models/transformer/utils/lightconv2d.py b/funasr/models/transformer/utils/lightconv2d.py new file mode 100644 index 0000000..60e5af5 --- /dev/null +++ b/funasr/models/transformer/utils/lightconv2d.py @@ -0,0 +1,120 @@ +"""Lightweight 2-Dimensional Convolution module.""" + +import numpy +import torch +from torch import nn +import torch.nn.functional as F + + +MIN_VALUE = float(numpy.finfo(numpy.float32).min) + + +class LightweightConvolution2D(nn.Module): + """Lightweight 2-Dimensional Convolution layer. + + This implementation is based on + https://github.com/pytorch/fairseq/tree/master/fairseq + + Args: + wshare (int): the number of kernel of convolution + n_feat (int): the number of features + dropout_rate (float): dropout_rate + kernel_size (int): kernel size (length) + use_kernel_mask (bool): Use causal mask or not for convolution kernel + use_bias (bool): Use bias term or not. + + """ + + def __init__( + self, + wshare, + n_feat, + dropout_rate, + kernel_size, + use_kernel_mask=False, + use_bias=False, + ): + """Construct Lightweight 2-Dimensional Convolution layer.""" + super(LightweightConvolution2D, self).__init__() + + assert n_feat % wshare == 0 + self.wshare = wshare + self.use_kernel_mask = use_kernel_mask + self.dropout_rate = dropout_rate + self.kernel_size = kernel_size + self.padding_size = int(kernel_size / 2) + + # linear -> GLU -> lightconv -> linear + self.linear1 = nn.Linear(n_feat, n_feat * 2) + self.linear2 = nn.Linear(n_feat * 2, n_feat) + self.act = nn.GLU() + + # lightconv related + self.weight = nn.Parameter(torch.Tensor(self.wshare, 1, kernel_size).uniform_(0, 1)) + self.weight_f = nn.Parameter(torch.Tensor(1, 1, kernel_size).uniform_(0, 1)) + self.use_bias = use_bias + if self.use_bias: + self.bias = nn.Parameter(torch.Tensor(n_feat)) + + # mask of kernel + kernel_mask0 = torch.zeros(self.wshare, int(kernel_size / 2)) + kernel_mask1 = torch.ones(self.wshare, int(kernel_size / 2 + 1)) + self.kernel_mask = torch.cat((kernel_mask1, kernel_mask0), dim=-1).unsqueeze(1) + + def forward(self, query, key, value, mask): + """Forward of 'Lightweight 2-Dimensional Convolution'. + + This function takes query, key and value but uses only query. + This is just for compatibility with self-attention layer (attention.py) + + Args: + query (torch.Tensor): (batch, time1, d_model) input tensor + key (torch.Tensor): (batch, time2, d_model) NOT USED + value (torch.Tensor): (batch, time2, d_model) NOT USED + mask (torch.Tensor): (batch, time1, time2) mask + + Return: + x (torch.Tensor): (batch, time1, d_model) output + + """ + # linear -> GLU -> lightconv -> linear + x = query + B, T, C = x.size() + H = self.wshare + + # first liner layer + x = self.linear1(x) + + # GLU activation + x = self.act(x) + + # convolution along frequency axis + weight_f = F.softmax(self.weight_f, dim=-1) + weight_f = F.dropout(weight_f, self.dropout_rate, training=self.training) + weight_new = torch.zeros(B * T, 1, self.kernel_size, device=x.device, dtype=x.dtype).copy_( + weight_f + ) + xf = F.conv1d( + x.view(1, B * T, C), weight_new, padding=self.padding_size, groups=B * T + ).view(B, T, C) + + # lightconv + x = x.transpose(1, 2).contiguous().view(-1, H, T) # B x C x T + weight = F.dropout(self.weight, self.dropout_rate, training=self.training) + if self.use_kernel_mask: + self.kernel_mask = self.kernel_mask.to(x.device) + weight = weight.masked_fill(self.kernel_mask == 0.0, float("-inf")) + weight = F.softmax(weight, dim=-1) + x = F.conv1d(x, weight, padding=self.padding_size, groups=self.wshare).view(B, C, T) + if self.use_bias: + x = x + self.bias.view(1, -1, 1) + x = x.transpose(1, 2) # B x T x C + x = torch.cat((x, xf), -1) # B x T x Cx2 + + if mask is not None and not self.use_kernel_mask: + mask = mask.transpose(-1, -2) + x = x.masked_fill(mask == 0, 0.0) + + # second linear layer + x = self.linear2(x) + return x diff --git a/funasr/models/transformer/utils/mask.py b/funasr/models/transformer/utils/mask.py new file mode 100644 index 0000000..e859e0e --- /dev/null +++ b/funasr/models/transformer/utils/mask.py @@ -0,0 +1,52 @@ +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Mask module.""" + +import torch + + +def subsequent_mask(size, device="cpu", dtype=torch.bool): + """Create mask for subsequent steps (size, size). + + :param int size: size of mask + :param str device: "cpu" or "cuda" or torch.Tensor.device + :param torch.dtype dtype: result dtype + :rtype: torch.Tensor + >>> subsequent_mask(3) + [[1, 0, 0], + [1, 1, 0], + [1, 1, 1]] + """ + ret = torch.ones(size, size, device=device, dtype=dtype) + return torch.tril(ret, out=ret) + + +def target_mask(ys_in_pad, ignore_id): + """Create mask for decoder self-attention. + + :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax) + :param int ignore_id: index of padding + :param torch.dtype dtype: result dtype + :rtype: torch.Tensor (B, Lmax, Lmax) + """ + ys_mask = ys_in_pad != ignore_id + m = subsequent_mask(ys_mask.size(-1), device=ys_mask.device).unsqueeze(0) + return ys_mask.unsqueeze(-2) & m + + +def vad_mask(size, vad_pos, device="cpu", dtype=torch.bool): + """Create mask for decoder self-attention. + + :param int size: size of mask + :param int vad_pos: index of vad index + :param str device: "cpu" or "cuda" or torch.Tensor.device + :param torch.dtype dtype: result dtype + :rtype: torch.Tensor (B, Lmax, Lmax) + """ + ret = torch.ones(size, size, device=device, dtype=dtype) + if vad_pos <= 0 or vad_pos >= size: + return ret + sub_corner = torch.zeros(vad_pos - 1, size - vad_pos, device=device, dtype=dtype) + ret[0 : vad_pos - 1, vad_pos:] = sub_corner + return ret diff --git a/funasr/models/transformer/utils/multi_layer_conv.py b/funasr/models/transformer/utils/multi_layer_conv.py new file mode 100644 index 0000000..4893da1 --- /dev/null +++ b/funasr/models/transformer/utils/multi_layer_conv.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Tomoki Hayashi +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Layer modules for FFT block in FastSpeech (Feed-forward Transformer).""" + +import torch + + +class MultiLayeredConv1d(torch.nn.Module): + """Multi-layered conv1d for Transformer block. + + This is a module of multi-leyered conv1d designed + to replace positionwise feed-forward network + in Transforner block, which is introduced in + `FastSpeech: Fast, Robust and Controllable Text to Speech`_. + + .. _`FastSpeech: Fast, Robust and Controllable Text to Speech`: + https://arxiv.org/pdf/1905.09263.pdf + + """ + + def __init__(self, in_chans, hidden_chans, kernel_size, dropout_rate): + """Initialize MultiLayeredConv1d module. + + Args: + in_chans (int): Number of input channels. + hidden_chans (int): Number of hidden channels. + kernel_size (int): Kernel size of conv1d. + dropout_rate (float): Dropout rate. + + """ + super(MultiLayeredConv1d, self).__init__() + self.w_1 = torch.nn.Conv1d( + in_chans, + hidden_chans, + kernel_size, + stride=1, + padding=(kernel_size - 1) // 2, + ) + self.w_2 = torch.nn.Conv1d( + hidden_chans, + in_chans, + kernel_size, + stride=1, + padding=(kernel_size - 1) // 2, + ) + self.dropout = torch.nn.Dropout(dropout_rate) + + def forward(self, x): + """Calculate forward propagation. + + Args: + x (torch.Tensor): Batch of input tensors (B, T, in_chans). + + Returns: + torch.Tensor: Batch of output tensors (B, T, hidden_chans). + + """ + x = torch.relu(self.w_1(x.transpose(-1, 1))).transpose(-1, 1) + return self.w_2(self.dropout(x).transpose(-1, 1)).transpose(-1, 1) + + +class FsmnFeedForward(torch.nn.Module): + """Position-wise feed forward for FSMN blocks. + + This is a module of multi-leyered conv1d designed + to replace position-wise feed-forward network + in FSMN block. + """ + + def __init__(self, in_chans, hidden_chans, out_chans, kernel_size, dropout_rate): + """Initialize FsmnFeedForward module. + + Args: + in_chans (int): Number of input channels. + hidden_chans (int): Number of hidden channels. + out_chans (int): Number of output channels. + kernel_size (int): Kernel size of conv1d. + dropout_rate (float): Dropout rate. + + """ + super(FsmnFeedForward, self).__init__() + self.w_1 = torch.nn.Conv1d( + in_chans, + hidden_chans, + kernel_size, + stride=1, + padding=(kernel_size - 1) // 2, + ) + self.w_2 = torch.nn.Conv1d( + hidden_chans, + out_chans, + kernel_size, + stride=1, + padding=(kernel_size - 1) // 2, + bias=False, + ) + self.norm = torch.nn.LayerNorm(hidden_chans) + self.dropout = torch.nn.Dropout(dropout_rate) + + def forward(self, x, ilens=None): + """Calculate forward propagation. + + Args: + x (torch.Tensor): Batch of input tensors (B, T, in_chans). + + Returns: + torch.Tensor: Batch of output tensors (B, T, out_chans). + + """ + x = torch.relu(self.w_1(x.transpose(-1, 1))).transpose(-1, 1) + return self.w_2(self.norm(self.dropout(x)).transpose(-1, 1)).transpose(-1, 1), ilens + + +class Conv1dLinear(torch.nn.Module): + """Conv1D + Linear for Transformer block. + + A variant of MultiLayeredConv1d, which replaces second conv-layer to linear. + + """ + + def __init__(self, in_chans, hidden_chans, kernel_size, dropout_rate): + """Initialize Conv1dLinear module. + + Args: + in_chans (int): Number of input channels. + hidden_chans (int): Number of hidden channels. + kernel_size (int): Kernel size of conv1d. + dropout_rate (float): Dropout rate. + + """ + super(Conv1dLinear, self).__init__() + self.w_1 = torch.nn.Conv1d( + in_chans, + hidden_chans, + kernel_size, + stride=1, + padding=(kernel_size - 1) // 2, + ) + self.w_2 = torch.nn.Linear(hidden_chans, in_chans) + self.dropout = torch.nn.Dropout(dropout_rate) + + def forward(self, x): + """Calculate forward propagation. + + Args: + x (torch.Tensor): Batch of input tensors (B, T, in_chans). + + Returns: + torch.Tensor: Batch of output tensors (B, T, hidden_chans). + + """ + x = torch.relu(self.w_1(x.transpose(-1, 1))).transpose(-1, 1) + return self.w_2(self.dropout(x)) diff --git a/funasr/models/transformer/utils/nets_utils.py b/funasr/models/transformer/utils/nets_utils.py new file mode 100644 index 0000000..29d23ee --- /dev/null +++ b/funasr/models/transformer/utils/nets_utils.py @@ -0,0 +1,734 @@ +# -*- coding: utf-8 -*- + +"""Network related utility tools.""" + +import logging +from typing import Dict, List, Tuple + +import numpy as np +import torch + + +def to_device(m, x): + """Send tensor into the device of the module. + + Args: + m (torch.nn.Module): Torch module. + x (Tensor): Torch tensor. + + Returns: + Tensor: Torch tensor located in the same place as torch module. + + """ + if isinstance(m, torch.nn.Module): + device = next(m.parameters()).device + elif isinstance(m, torch.Tensor): + device = m.device + else: + raise TypeError("Expected torch.nn.Module or torch.tensor, " f"bot got: {type(m)}") + return x.to(device) + + +def pad_list(xs, pad_value): + """Perform padding for the list of tensors. + + Args: + xs (List): List of Tensors [(T_1, `*`), (T_2, `*`), ..., (T_B, `*`)]. + pad_value (float): Value for padding. + + Returns: + Tensor: Padded tensor (B, Tmax, `*`). + + Examples: + >>> x = [torch.ones(4), torch.ones(2), torch.ones(1)] + >>> x + [tensor([1., 1., 1., 1.]), tensor([1., 1.]), tensor([1.])] + >>> pad_list(x, 0) + tensor([[1., 1., 1., 1.], + [1., 1., 0., 0.], + [1., 0., 0., 0.]]) + + """ + n_batch = len(xs) + max_len = max(x.size(0) for x in xs) + pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value) + + for i in range(n_batch): + pad[i, : xs[i].size(0)] = xs[i] + + return pad + + +def pad_list_all_dim(xs, pad_value): + """Perform padding for the list of tensors. + + Args: + xs (List): List of Tensors [(T_1, `*`), (T_2, `*`), ..., (T_B, `*`)]. + pad_value (float): Value for padding. + + Returns: + Tensor: Padded tensor (B, Tmax, `*`). + + Examples: + >>> x = [torch.ones(4), torch.ones(2), torch.ones(1)] + >>> x + [tensor([1., 1., 1., 1.]), tensor([1., 1.]), tensor([1.])] + >>> pad_list(x, 0) + tensor([[1., 1., 1., 1.], + [1., 1., 0., 0.], + [1., 0., 0., 0.]]) + + """ + n_batch = len(xs) + num_dim = len(xs[0].shape) + max_len_all_dim = [] + for i in range(num_dim): + max_len_all_dim.append(max(x.size(i) for x in xs)) + pad = xs[0].new(n_batch, *max_len_all_dim).fill_(pad_value) + + for i in range(n_batch): + if num_dim == 1: + pad[i, : xs[i].size(0)] = xs[i] + elif num_dim == 2: + pad[i, : xs[i].size(0), : xs[i].size(1)] = xs[i] + elif num_dim == 3: + pad[i, : xs[i].size(0), : xs[i].size(1), : xs[i].size(2)] = xs[i] + else: + raise ValueError( + "pad_list_all_dim only support 1-D, 2-D and 3-D tensors, not {}-D.".format(num_dim) + ) + + return pad + + +def make_pad_mask(lengths, xs=None, length_dim=-1, maxlen=None): + """Make mask tensor containing indices of padded part. + + Args: + lengths (LongTensor or List): Batch of lengths (B,). + xs (Tensor, optional): The reference tensor. + If set, masks will be the same shape as this tensor. + length_dim (int, optional): Dimension indicator of the above tensor. + See the example. + + Returns: + Tensor: Mask tensor containing indices of padded part. + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (including 1.2) + + Examples: + With only lengths. + + >>> lengths = [5, 3, 2] + >>> make_pad_mask(lengths) + masks = [[0, 0, 0, 0 ,0], + [0, 0, 0, 1, 1], + [0, 0, 1, 1, 1]] + + With the reference tensor. + + >>> xs = torch.zeros((3, 2, 4)) + >>> make_pad_mask(lengths, xs) + tensor([[[0, 0, 0, 0], + [0, 0, 0, 0]], + [[0, 0, 0, 1], + [0, 0, 0, 1]], + [[0, 0, 1, 1], + [0, 0, 1, 1]]], dtype=torch.uint8) + >>> xs = torch.zeros((3, 2, 6)) + >>> make_pad_mask(lengths, xs) + tensor([[[0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, 1]], + [[0, 0, 0, 1, 1, 1], + [0, 0, 0, 1, 1, 1]], + [[0, 0, 1, 1, 1, 1], + [0, 0, 1, 1, 1, 1]]], dtype=torch.uint8) + + With the reference tensor and dimension indicator. + + >>> xs = torch.zeros((3, 6, 6)) + >>> make_pad_mask(lengths, xs, 1) + tensor([[[0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [1, 1, 1, 1, 1, 1]], + [[0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1]], + [[0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1]]], dtype=torch.uint8) + >>> make_pad_mask(lengths, xs, 2) + tensor([[[0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, 1]], + [[0, 0, 0, 1, 1, 1], + [0, 0, 0, 1, 1, 1], + [0, 0, 0, 1, 1, 1], + [0, 0, 0, 1, 1, 1], + [0, 0, 0, 1, 1, 1], + [0, 0, 0, 1, 1, 1]], + [[0, 0, 1, 1, 1, 1], + [0, 0, 1, 1, 1, 1], + [0, 0, 1, 1, 1, 1], + [0, 0, 1, 1, 1, 1], + [0, 0, 1, 1, 1, 1], + [0, 0, 1, 1, 1, 1]]], dtype=torch.uint8) + + """ + if length_dim == 0: + raise ValueError("length_dim cannot be 0: {}".format(length_dim)) + + if not isinstance(lengths, list): + lengths = lengths.tolist() + bs = int(len(lengths)) + if maxlen is None: + if xs is None: + maxlen = int(max(lengths)) + else: + maxlen = xs.size(length_dim) + else: + assert xs is None + assert maxlen >= int(max(lengths)) + + seq_range = torch.arange(0, maxlen, dtype=torch.int64) + seq_range_expand = seq_range.unsqueeze(0).expand(bs, maxlen) + seq_length_expand = seq_range_expand.new(lengths).unsqueeze(-1) + mask = seq_range_expand >= seq_length_expand + + if xs is not None: + assert xs.size(0) == bs, (xs.size(0), bs) + + if length_dim < 0: + length_dim = xs.dim() + length_dim + # ind = (:, None, ..., None, :, , None, ..., None) + ind = tuple(slice(None) if i in (0, length_dim) else None for i in range(xs.dim())) + mask = mask[ind].expand_as(xs).to(xs.device) + return mask + + +def make_non_pad_mask(lengths, xs=None, length_dim=-1): + """Make mask tensor containing indices of non-padded part. + + Args: + lengths (LongTensor or List): Batch of lengths (B,). + xs (Tensor, optional): The reference tensor. + If set, masks will be the same shape as this tensor. + length_dim (int, optional): Dimension indicator of the above tensor. + See the example. + + Returns: + ByteTensor: mask tensor containing indices of padded part. + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (including 1.2) + + Examples: + With only lengths. + + >>> lengths = [5, 3, 2] + >>> make_non_pad_mask(lengths) + masks = [[1, 1, 1, 1 ,1], + [1, 1, 1, 0, 0], + [1, 1, 0, 0, 0]] + + With the reference tensor. + + >>> xs = torch.zeros((3, 2, 4)) + >>> make_non_pad_mask(lengths, xs) + tensor([[[1, 1, 1, 1], + [1, 1, 1, 1]], + [[1, 1, 1, 0], + [1, 1, 1, 0]], + [[1, 1, 0, 0], + [1, 1, 0, 0]]], dtype=torch.uint8) + >>> xs = torch.zeros((3, 2, 6)) + >>> make_non_pad_mask(lengths, xs) + tensor([[[1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 0]], + [[1, 1, 1, 0, 0, 0], + [1, 1, 1, 0, 0, 0]], + [[1, 1, 0, 0, 0, 0], + [1, 1, 0, 0, 0, 0]]], dtype=torch.uint8) + + With the reference tensor and dimension indicator. + + >>> xs = torch.zeros((3, 6, 6)) + >>> make_non_pad_mask(lengths, xs, 1) + tensor([[[1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 0, 0]], + [[1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0]], + [[1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0]]], dtype=torch.uint8) + >>> make_non_pad_mask(lengths, xs, 2) + tensor([[[1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 0]], + [[1, 1, 1, 0, 0, 0], + [1, 1, 1, 0, 0, 0], + [1, 1, 1, 0, 0, 0], + [1, 1, 1, 0, 0, 0], + [1, 1, 1, 0, 0, 0], + [1, 1, 1, 0, 0, 0]], + [[1, 1, 0, 0, 0, 0], + [1, 1, 0, 0, 0, 0], + [1, 1, 0, 0, 0, 0], + [1, 1, 0, 0, 0, 0], + [1, 1, 0, 0, 0, 0], + [1, 1, 0, 0, 0, 0]]], dtype=torch.uint8) + + """ + return ~make_pad_mask(lengths, xs, length_dim) + + +def mask_by_length(xs, lengths, fill=0): + """Mask tensor according to length. + + Args: + xs (Tensor): Batch of input tensor (B, `*`). + lengths (LongTensor or List): Batch of lengths (B,). + fill (int or float): Value to fill masked part. + + Returns: + Tensor: Batch of masked input tensor (B, `*`). + + Examples: + >>> x = torch.arange(5).repeat(3, 1) + 1 + >>> x + tensor([[1, 2, 3, 4, 5], + [1, 2, 3, 4, 5], + [1, 2, 3, 4, 5]]) + >>> lengths = [5, 3, 2] + >>> mask_by_length(x, lengths) + tensor([[1, 2, 3, 4, 5], + [1, 2, 3, 0, 0], + [1, 2, 0, 0, 0]]) + + """ + assert xs.size(0) == len(lengths) + ret = xs.data.new(*xs.size()).fill_(fill) + for i, l in enumerate(lengths): + ret[i, :l] = xs[i, :l] + return ret + + +def to_torch_tensor(x): + """Change to torch.Tensor or ComplexTensor from numpy.ndarray. + + Args: + x: Inputs. It should be one of numpy.ndarray, Tensor, ComplexTensor, and dict. + + Returns: + Tensor or ComplexTensor: Type converted inputs. + + Examples: + >>> xs = np.ones(3, dtype=np.float32) + >>> xs = to_torch_tensor(xs) + tensor([1., 1., 1.]) + >>> xs = torch.ones(3, 4, 5) + >>> assert to_torch_tensor(xs) is xs + >>> xs = {'real': xs, 'imag': xs} + >>> to_torch_tensor(xs) + ComplexTensor( + Real: + tensor([1., 1., 1.]) + Imag; + tensor([1., 1., 1.]) + ) + + """ + # If numpy, change to torch tensor + if isinstance(x, np.ndarray): + if x.dtype.kind == "c": + # Dynamically importing because torch_complex requires python3 + from torch_complex.tensor import ComplexTensor + + return ComplexTensor(x) + else: + return torch.from_numpy(x) + + # If {'real': ..., 'imag': ...}, convert to ComplexTensor + elif isinstance(x, dict): + # Dynamically importing because torch_complex requires python3 + from torch_complex.tensor import ComplexTensor + + if "real" not in x or "imag" not in x: + raise ValueError("has 'real' and 'imag' keys: {}".format(list(x))) + # Relative importing because of using python3 syntax + return ComplexTensor(x["real"], x["imag"]) + + # If torch.Tensor, as it is + elif isinstance(x, torch.Tensor): + return x + + else: + error = ( + "x must be numpy.ndarray, torch.Tensor or a dict like " + "{{'real': torch.Tensor, 'imag': torch.Tensor}}, " + "but got {}".format(type(x)) + ) + try: + from torch_complex.tensor import ComplexTensor + except Exception: + # If PY2 + raise ValueError(error) + else: + # If PY3 + if isinstance(x, ComplexTensor): + return x + else: + raise ValueError(error) + + +def get_subsample(train_args, mode, arch): + """Parse the subsampling factors from the args for the specified `mode` and `arch`. + + Args: + train_args: argument Namespace containing options. + mode: one of ('asr', 'mt', 'st') + arch: one of ('rnn', 'rnn-t', 'rnn_mix', 'rnn_mulenc', 'transformer') + + Returns: + np.ndarray / List[np.ndarray]: subsampling factors. + """ + if arch == "transformer": + return np.array([1]) + + elif mode == "mt" and arch == "rnn": + # +1 means input (+1) and layers outputs (train_args.elayer) + subsample = np.ones(train_args.elayers + 1, dtype=np.int32) + logging.warning("Subsampling is not performed for machine translation.") + logging.info("subsample: " + " ".join([str(x) for x in subsample])) + return subsample + + elif ( + (mode == "asr" and arch in ("rnn", "rnn-t")) + or (mode == "mt" and arch == "rnn") + or (mode == "st" and arch == "rnn") + ): + subsample = np.ones(train_args.elayers + 1, dtype=np.int32) + if train_args.etype.endswith("p") and not train_args.etype.startswith("vgg"): + ss = train_args.subsample.split("_") + for j in range(min(train_args.elayers + 1, len(ss))): + subsample[j] = int(ss[j]) + else: + logging.warning( + "Subsampling is not performed for vgg*. " + "It is performed in max pooling layers at CNN." + ) + logging.info("subsample: " + " ".join([str(x) for x in subsample])) + return subsample + + elif mode == "asr" and arch == "rnn_mix": + subsample = np.ones(train_args.elayers_sd + train_args.elayers + 1, dtype=np.int32) + if train_args.etype.endswith("p") and not train_args.etype.startswith("vgg"): + ss = train_args.subsample.split("_") + for j in range(min(train_args.elayers_sd + train_args.elayers + 1, len(ss))): + subsample[j] = int(ss[j]) + else: + logging.warning( + "Subsampling is not performed for vgg*. " + "It is performed in max pooling layers at CNN." + ) + logging.info("subsample: " + " ".join([str(x) for x in subsample])) + return subsample + + elif mode == "asr" and arch == "rnn_mulenc": + subsample_list = [] + for idx in range(train_args.num_encs): + subsample = np.ones(train_args.elayers[idx] + 1, dtype=np.int32) + if train_args.etype[idx].endswith("p") and not train_args.etype[idx].startswith("vgg"): + ss = train_args.subsample[idx].split("_") + for j in range(min(train_args.elayers[idx] + 1, len(ss))): + subsample[j] = int(ss[j]) + else: + logging.warning( + "Encoder %d: Subsampling is not performed for vgg*. " + "It is performed in max pooling layers at CNN.", + idx + 1, + ) + logging.info("subsample: " + " ".join([str(x) for x in subsample])) + subsample_list.append(subsample) + return subsample_list + + else: + raise ValueError("Invalid options: mode={}, arch={}".format(mode, arch)) + + +def rename_state_dict(old_prefix: str, new_prefix: str, state_dict: Dict[str, torch.Tensor]): + """Replace keys of old prefix with new prefix in state dict.""" + # need this list not to break the dict iterator + old_keys = [k for k in state_dict if k.startswith(old_prefix)] + if len(old_keys) > 0: + logging.warning(f"Rename: {old_prefix} -> {new_prefix}") + for k in old_keys: + v = state_dict.pop(k) + new_k = k.replace(old_prefix, new_prefix) + state_dict[new_k] = v + + +class Swish(torch.nn.Module): + """Swish activation definition. + + Swish(x) = (beta * x) * sigmoid(x) + where beta = 1 defines standard Swish activation. + + References: + https://arxiv.org/abs/2108.12943 / https://arxiv.org/abs/1710.05941v1. + E-swish variant: https://arxiv.org/abs/1801.07145. + + Args: + beta: Beta parameter for E-Swish. + (beta >= 1. If beta < 1, use standard Swish). + use_builtin: Whether to use PyTorch function if available. + + """ + + def __init__(self, beta: float = 1.0, use_builtin: bool = False) -> None: + super().__init__() + + self.beta = beta + + if beta > 1: + self.swish = lambda x: (self.beta * x) * torch.sigmoid(x) + else: + if use_builtin: + self.swish = torch.nn.SiLU() + else: + self.swish = lambda x: x * torch.sigmoid(x) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + """Forward computation.""" + return self.swish(x) + + +def get_activation(act): + """Return activation function.""" + + activation_funcs = { + "hardtanh": torch.nn.Hardtanh, + "tanh": torch.nn.Tanh, + "relu": torch.nn.ReLU, + "selu": torch.nn.SELU, + "swish": Swish, + } + + return activation_funcs[act]() + + +class TooShortUttError(Exception): + """Raised when the utt is too short for subsampling. + + Args: + message: Error message to display. + actual_size: The size that cannot pass the subsampling. + limit: The size limit for subsampling. + + """ + + def __init__(self, message: str, actual_size: int, limit: int) -> None: + """Construct a TooShortUttError module.""" + super().__init__(message) + + self.actual_size = actual_size + self.limit = limit + + +def check_short_utt(sub_factor: int, size: int) -> Tuple[bool, int]: + """Check if the input is too short for subsampling. + + Args: + sub_factor: Subsampling factor for Conv2DSubsampling. + size: Input size. + + Returns: + : Whether an error should be sent. + : Size limit for specified subsampling factor. + + """ + if sub_factor == 2 and size < 3: + return True, 7 + elif sub_factor == 4 and size < 7: + return True, 7 + elif sub_factor == 6 and size < 11: + return True, 11 + + return False, -1 + + +def sub_factor_to_params(sub_factor: int, input_size: int) -> Tuple[int, int, int]: + """Get conv2D second layer parameters for given subsampling factor. + + Args: + sub_factor: Subsampling factor (1/X). + input_size: Input size. + + Returns: + : Kernel size for second convolution. + : Stride for second convolution. + : Conv2DSubsampling output size. + + """ + if sub_factor == 2: + return 3, 1, (((input_size - 1) // 2 - 2)) + elif sub_factor == 4: + return 3, 2, (((input_size - 1) // 2 - 1) // 2) + elif sub_factor == 6: + return 5, 3, (((input_size - 1) // 2 - 2) // 3) + else: + raise ValueError("subsampling_factor parameter should be set to either 2, 4 or 6.") + + +def make_chunk_mask( + size: int, + chunk_size: int, + left_chunk_size: int = 0, + device: torch.device = None, +) -> torch.Tensor: + """Create chunk mask for the subsequent steps (size, size). + + Reference: https://github.com/k2-fsa/icefall/blob/master/icefall/utils.py + + Args: + size: Size of the source mask. + chunk_size: Number of frames in chunk. + left_chunk_size: Size of the left context in chunks (0 means full context). + device: Device for the mask tensor. + + Returns: + mask: Chunk mask. (size, size) + + """ + mask = torch.zeros(size, size, device=device, dtype=torch.bool) + + for i in range(size): + if left_chunk_size < 0: + start = 0 + else: + start = max((i // chunk_size - left_chunk_size) * chunk_size, 0) + + end = min((i // chunk_size + 1) * chunk_size, size) + mask[i, start:end] = True + + return ~mask + + +def make_source_mask(lengths: torch.Tensor) -> torch.Tensor: + """Create source mask for given lengths. + + Reference: https://github.com/k2-fsa/icefall/blob/master/icefall/utils.py + + Args: + lengths: Sequence lengths. (B,) + + Returns: + : Mask for the sequence lengths. (B, max_len) + + """ + max_len = lengths.max() + batch_size = lengths.size(0) + + expanded_lengths = torch.arange(max_len).expand(batch_size, max_len).to(lengths) + + return expanded_lengths >= lengths.unsqueeze(1) + + +def get_transducer_task_io( + labels: torch.Tensor, + encoder_out_lens: torch.Tensor, + ignore_id: int = -1, + blank_id: int = 0, +) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]: + """Get Transducer loss I/O. + + Args: + labels: Label ID sequences. (B, L) + encoder_out_lens: Encoder output lengths. (B,) + ignore_id: Padding symbol ID. + blank_id: Blank symbol ID. + + Returns: + decoder_in: Decoder inputs. (B, U) + target: Target label ID sequences. (B, U) + t_len: Time lengths. (B,) + u_len: Label lengths. (B,) + + """ + + def pad_list(labels: List[torch.Tensor], padding_value: int = 0): + """Create padded batch of labels from a list of labels sequences. + + Args: + labels: Labels sequences. [B x (?)] + padding_value: Padding value. + + Returns: + labels: Batch of padded labels sequences. (B,) + + """ + batch_size = len(labels) + + padded = ( + labels[0] + .new(batch_size, max(x.size(0) for x in labels), *labels[0].size()[1:]) + .fill_(padding_value) + ) + + for i in range(batch_size): + padded[i, : labels[i].size(0)] = labels[i] + + return padded + + device = labels.device + + labels_unpad = [y[y != ignore_id] for y in labels] + blank = labels[0].new([blank_id]) + + decoder_in = pad_list( + [torch.cat([blank, label], dim=0) for label in labels_unpad], blank_id + ).to(device) + + target = pad_list(labels_unpad, blank_id).type(torch.int32).to(device) + + encoder_out_lens = list(map(int, encoder_out_lens)) + t_len = torch.IntTensor(encoder_out_lens).to(device) + + u_len = torch.IntTensor([y.size(0) for y in labels_unpad]).to(device) + + return decoder_in, target, t_len, u_len + + +def pad_to_len(t: torch.Tensor, pad_len: int, dim: int): + """Pad the tensor `t` at `dim` to the length `pad_len` with right padding zeros.""" + if t.size(dim) == pad_len: + return t + else: + pad_size = list(t.shape) + pad_size[dim] = pad_len - t.size(dim) + return torch.cat([t, torch.zeros(*pad_size, dtype=t.dtype, device=t.device)], dim=dim) diff --git a/funasr/models/transformer/utils/repeat.py b/funasr/models/transformer/utils/repeat.py new file mode 100644 index 0000000..a44c1a0 --- /dev/null +++ b/funasr/models/transformer/utils/repeat.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Repeat the same layer definition.""" + +from typing import Dict, List, Optional +from funasr.models.transformer.layer_norm import LayerNorm +import torch + + +class MultiSequential(torch.nn.Sequential): + """Multi-input multi-output torch.nn.Sequential.""" + + def __init__(self, *args, layer_drop_rate=0.0): + """Initialize MultiSequential with layer_drop. + + Args: + layer_drop_rate (float): Probability of dropping out each fn (layer). + + """ + super(MultiSequential, self).__init__(*args) + self.layer_drop_rate = layer_drop_rate + + def forward(self, *args): + """Repeat.""" + _probs = torch.empty(len(self)).uniform_() + for idx, m in enumerate(self): + if not self.training or (_probs[idx] >= self.layer_drop_rate): + args = m(*args) + return args + + +def repeat(N, fn, layer_drop_rate=0.0): + """Repeat module N times. + + Args: + N (int): Number of repeat time. + fn (Callable): Function to generate module. + layer_drop_rate (float): Probability of dropping out each fn (layer). + + Returns: + MultiSequential: Repeated model instance. + + """ + return MultiSequential(*[fn(n) for n in range(N)], layer_drop_rate=layer_drop_rate) + + +class MultiBlocks(torch.nn.Module): + """MultiBlocks definition. + Args: + block_list: Individual blocks of the encoder architecture. + output_size: Architecture output size. + norm_class: Normalization module class. + norm_args: Normalization module arguments. + """ + + def __init__( + self, + block_list: List[torch.nn.Module], + output_size: int, + norm_class: torch.nn.Module = LayerNorm, + ) -> None: + """Construct a MultiBlocks object.""" + super().__init__() + + self.blocks = torch.nn.ModuleList(block_list) + self.norm_blocks = norm_class(output_size) + + self.num_blocks = len(block_list) + + def reset_streaming_cache(self, left_context: int, device: torch.device) -> None: + """Initialize/Reset encoder streaming cache. + Args: + left_context: Number of left frames during chunk-by-chunk inference. + device: Device to use for cache tensor. + """ + for idx in range(self.num_blocks): + self.blocks[idx].reset_streaming_cache(left_context, device) + + def forward( + self, + x: torch.Tensor, + pos_enc: torch.Tensor, + mask: torch.Tensor, + chunk_mask: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """Forward each block of the encoder architecture. + Args: + x: MultiBlocks input sequences. (B, T, D_block_1) + pos_enc: Positional embedding sequences. + mask: Source mask. (B, T) + chunk_mask: Chunk mask. (T_2, T_2) + Returns: + x: Output sequences. (B, T, D_block_N) + """ + for block_index, block in enumerate(self.blocks): + x, mask, pos_enc = block(x, pos_enc, mask, chunk_mask=chunk_mask) + + x = self.norm_blocks(x) + + return x + + def chunk_forward( + self, + x: torch.Tensor, + pos_enc: torch.Tensor, + mask: torch.Tensor, + chunk_size: int = 0, + left_context: int = 0, + right_context: int = 0, + ) -> torch.Tensor: + """Forward each block of the encoder architecture. + Args: + x: MultiBlocks input sequences. (B, T, D_block_1) + pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_att) + mask: Source mask. (B, T_2) + left_context: Number of frames in left context. + right_context: Number of frames in right context. + Returns: + x: MultiBlocks output sequences. (B, T, D_block_N) + """ + for block_idx, block in enumerate(self.blocks): + x, pos_enc = block.chunk_forward( + x, + pos_enc, + mask, + chunk_size=chunk_size, + left_context=left_context, + right_context=right_context, + ) + + x = self.norm_blocks(x) + + return x diff --git a/funasr/models/transformer/utils/subsampling.py b/funasr/models/transformer/utils/subsampling.py new file mode 100644 index 0000000..b18bd31 --- /dev/null +++ b/funasr/models/transformer/utils/subsampling.py @@ -0,0 +1,629 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2019 Shigeki Karita +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Subsampling layer definition.""" +import numpy as np +import torch +import torch.nn.functional as F +from funasr.models.transformer.embedding import PositionalEncoding +import logging +from funasr.models.scama.utils import sequence_mask +from funasr.models.transformer.utils.nets_utils import sub_factor_to_params, pad_to_len +from typing import Optional, Tuple, Union +import math + + +class TooShortUttError(Exception): + """Raised when the utt is too short for subsampling. + + Args: + message (str): Message for error catch + actual_size (int): the short size that cannot pass the subsampling + limit (int): the limit size for subsampling + + """ + + def __init__(self, message, actual_size, limit): + """Construct a TooShortUttError for error handler.""" + super().__init__(message) + self.actual_size = actual_size + self.limit = limit + + +def check_short_utt(ins, size): + """Check if the utterance is too short for subsampling.""" + if isinstance(ins, Conv2dSubsampling2) and size < 3: + return True, 3 + if isinstance(ins, Conv2dSubsampling) and size < 7: + return True, 7 + if isinstance(ins, Conv2dSubsampling6) and size < 11: + return True, 11 + if isinstance(ins, Conv2dSubsampling8) and size < 15: + return True, 15 + return False, -1 + + +class Conv2dSubsampling(torch.nn.Module): + """Convolutional 2D subsampling (to 1/4 length). + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + pos_enc (torch.nn.Module): Custom position encoding layer. + + """ + + def __init__(self, idim, odim, dropout_rate, pos_enc=None): + """Construct an Conv2dSubsampling object.""" + super(Conv2dSubsampling, self).__init__() + self.conv = torch.nn.Sequential( + torch.nn.Conv2d(1, odim, 3, 2), + torch.nn.ReLU(), + torch.nn.Conv2d(odim, odim, 3, 2), + torch.nn.ReLU(), + ) + self.out = torch.nn.Sequential( + torch.nn.Linear(odim * (((idim - 1) // 2 - 1) // 2), odim), + pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate), + ) + + def forward(self, x, x_mask): + """Subsample x. + + Args: + x (torch.Tensor): Input tensor (#batch, time, idim). + x_mask (torch.Tensor): Input mask (#batch, 1, time). + + Returns: + torch.Tensor: Subsampled tensor (#batch, time', odim), + where time' = time // 4. + torch.Tensor: Subsampled mask (#batch, 1, time'), + where time' = time // 4. + + """ + x = x.unsqueeze(1) # (b, c, t, f) + x = self.conv(x) + b, c, t, f = x.size() + x = self.out(x.transpose(1, 2).contiguous().view(b, t, c * f)) + if x_mask is None: + return x, None + return x, x_mask[:, :, :-2:2][:, :, :-2:2] + + def __getitem__(self, key): + """Get item. + + When reset_parameters() is called, if use_scaled_pos_enc is used, + return the positioning encoding. + + """ + if key != -1: + raise NotImplementedError("Support only `-1` (for `reset_parameters`).") + return self.out[key] + + +class Conv2dSubsamplingPad(torch.nn.Module): + """Convolutional 2D subsampling (to 1/4 length). + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + pos_enc (torch.nn.Module): Custom position encoding layer. + + """ + + def __init__(self, idim, odim, dropout_rate, pos_enc=None): + """Construct an Conv2dSubsampling object.""" + super(Conv2dSubsamplingPad, self).__init__() + self.conv = torch.nn.Sequential( + torch.nn.Conv2d(1, odim, 3, 2, padding=(0, 0)), + torch.nn.ReLU(), + torch.nn.Conv2d(odim, odim, 3, 2, padding=(0, 0)), + torch.nn.ReLU(), + ) + self.out = torch.nn.Sequential( + torch.nn.Linear(odim * (((idim - 1) // 2 - 1) // 2), odim), + pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate), + ) + self.pad_fn = torch.nn.ConstantPad1d((0, 4), 0.0) + + def forward(self, x, x_mask): + """Subsample x. + + Args: + x (torch.Tensor): Input tensor (#batch, time, idim). + x_mask (torch.Tensor): Input mask (#batch, 1, time). + + Returns: + torch.Tensor: Subsampled tensor (#batch, time', odim), + where time' = time // 4. + torch.Tensor: Subsampled mask (#batch, 1, time'), + where time' = time // 4. + + """ + x = x.transpose(1, 2) + x = self.pad_fn(x) + x = x.transpose(1, 2) + x = x.unsqueeze(1) # (b, c, t, f) + x = self.conv(x) + b, c, t, f = x.size() + x = self.out(x.transpose(1, 2).contiguous().view(b, t, c * f)) + if x_mask is None: + return x, None + x_len = torch.sum(x_mask[:, 0, :], dim=-1) + x_len = (x_len - 1) // 2 + 1 + x_len = (x_len - 1) // 2 + 1 + mask = sequence_mask(x_len, None, x_len.dtype, x[0].device) + return x, mask[:, None, :] + + def __getitem__(self, key): + """Get item. + + When reset_parameters() is called, if use_scaled_pos_enc is used, + return the positioning encoding. + + """ + if key != -1: + raise NotImplementedError("Support only `-1` (for `reset_parameters`).") + return self.out[key] + + +class Conv2dSubsampling2(torch.nn.Module): + """Convolutional 2D subsampling (to 1/2 length). + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + pos_enc (torch.nn.Module): Custom position encoding layer. + + """ + + def __init__(self, idim, odim, dropout_rate, pos_enc=None): + """Construct an Conv2dSubsampling2 object.""" + super(Conv2dSubsampling2, self).__init__() + self.conv = torch.nn.Sequential( + torch.nn.Conv2d(1, odim, 3, 2), + torch.nn.ReLU(), + torch.nn.Conv2d(odim, odim, 3, 1), + torch.nn.ReLU(), + ) + self.out = torch.nn.Sequential( + torch.nn.Linear(odim * (((idim - 1) // 2 - 2)), odim), + pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate), + ) + + def forward(self, x, x_mask): + """Subsample x. + + Args: + x (torch.Tensor): Input tensor (#batch, time, idim). + x_mask (torch.Tensor): Input mask (#batch, 1, time). + + Returns: + torch.Tensor: Subsampled tensor (#batch, time', odim), + where time' = time // 2. + torch.Tensor: Subsampled mask (#batch, 1, time'), + where time' = time // 2. + + """ + x = x.unsqueeze(1) # (b, c, t, f) + x = self.conv(x) + b, c, t, f = x.size() + x = self.out(x.transpose(1, 2).contiguous().view(b, t, c * f)) + if x_mask is None: + return x, None + return x, x_mask[:, :, :-2:2][:, :, :-2:1] + + def __getitem__(self, key): + """Get item. + + When reset_parameters() is called, if use_scaled_pos_enc is used, + return the positioning encoding. + + """ + if key != -1: + raise NotImplementedError("Support only `-1` (for `reset_parameters`).") + return self.out[key] + + +class Conv2dSubsampling6(torch.nn.Module): + """Convolutional 2D subsampling (to 1/6 length). + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + pos_enc (torch.nn.Module): Custom position encoding layer. + + """ + + def __init__(self, idim, odim, dropout_rate, pos_enc=None): + """Construct an Conv2dSubsampling6 object.""" + super(Conv2dSubsampling6, self).__init__() + self.conv = torch.nn.Sequential( + torch.nn.Conv2d(1, odim, 3, 2), + torch.nn.ReLU(), + torch.nn.Conv2d(odim, odim, 5, 3), + torch.nn.ReLU(), + ) + self.out = torch.nn.Sequential( + torch.nn.Linear(odim * (((idim - 1) // 2 - 2) // 3), odim), + pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate), + ) + + def forward(self, x, x_mask): + """Subsample x. + + Args: + x (torch.Tensor): Input tensor (#batch, time, idim). + x_mask (torch.Tensor): Input mask (#batch, 1, time). + + Returns: + torch.Tensor: Subsampled tensor (#batch, time', odim), + where time' = time // 6. + torch.Tensor: Subsampled mask (#batch, 1, time'), + where time' = time // 6. + + """ + x = x.unsqueeze(1) # (b, c, t, f) + x = self.conv(x) + b, c, t, f = x.size() + x = self.out(x.transpose(1, 2).contiguous().view(b, t, c * f)) + if x_mask is None: + return x, None + return x, x_mask[:, :, :-2:2][:, :, :-4:3] + + +class Conv2dSubsampling8(torch.nn.Module): + """Convolutional 2D subsampling (to 1/8 length). + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + pos_enc (torch.nn.Module): Custom position encoding layer. + + """ + + def __init__(self, idim, odim, dropout_rate, pos_enc=None): + """Construct an Conv2dSubsampling8 object.""" + super(Conv2dSubsampling8, self).__init__() + self.conv = torch.nn.Sequential( + torch.nn.Conv2d(1, odim, 3, 2), + torch.nn.ReLU(), + torch.nn.Conv2d(odim, odim, 3, 2), + torch.nn.ReLU(), + torch.nn.Conv2d(odim, odim, 3, 2), + torch.nn.ReLU(), + ) + self.out = torch.nn.Sequential( + torch.nn.Linear(odim * ((((idim - 1) // 2 - 1) // 2 - 1) // 2), odim), + pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate), + ) + + def forward(self, x, x_mask): + """Subsample x. + + Args: + x (torch.Tensor): Input tensor (#batch, time, idim). + x_mask (torch.Tensor): Input mask (#batch, 1, time). + + Returns: + torch.Tensor: Subsampled tensor (#batch, time', odim), + where time' = time // 8. + torch.Tensor: Subsampled mask (#batch, 1, time'), + where time' = time // 8. + + """ + x = x.unsqueeze(1) # (b, c, t, f) + x = self.conv(x) + b, c, t, f = x.size() + x = self.out(x.transpose(1, 2).contiguous().view(b, t, c * f)) + if x_mask is None: + return x, None + return x, x_mask[:, :, :-2:2][:, :, :-2:2][:, :, :-2:2] + + +class Conv1dSubsampling(torch.nn.Module): + """Convolutional 1D subsampling (to 1/2 length). + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + pos_enc (torch.nn.Module): Custom position encoding layer. + + """ + + def __init__( + self, + idim, + odim, + kernel_size, + stride, + pad, + tf2torch_tensor_name_prefix_torch: str = "stride_conv", + tf2torch_tensor_name_prefix_tf: str = "seq2seq/proj_encoder/downsampling", + ): + super(Conv1dSubsampling, self).__init__() + self.conv = torch.nn.Conv1d(idim, odim, kernel_size, stride) + self.pad_fn = torch.nn.ConstantPad1d(pad, 0.0) + self.stride = stride + self.odim = odim + self.tf2torch_tensor_name_prefix_torch = tf2torch_tensor_name_prefix_torch + self.tf2torch_tensor_name_prefix_tf = tf2torch_tensor_name_prefix_tf + + def output_size(self) -> int: + return self.odim + + def forward(self, x, x_len): + """Subsample x.""" + x = x.transpose(1, 2) # (b, d ,t) + x = self.pad_fn(x) + # x = F.relu(self.conv(x)) + x = F.leaky_relu(self.conv(x), negative_slope=0.0) + x = x.transpose(1, 2) # (b, t ,d) + + if x_len is None: + + return x, None + x_len = (x_len - 1) // self.stride + 1 + return x, x_len + + +class StreamingConvInput(torch.nn.Module): + """Streaming ConvInput module definition. + Args: + input_size: Input size. + conv_size: Convolution size. + subsampling_factor: Subsampling factor. + vgg_like: Whether to use a VGG-like network. + output_size: Block output dimension. + """ + + def __init__( + self, + input_size: int, + conv_size: Union[int, Tuple], + subsampling_factor: int = 4, + vgg_like: bool = True, + conv_kernel_size: int = 3, + output_size: Optional[int] = None, + ) -> None: + """Construct a ConvInput object.""" + super().__init__() + if vgg_like: + if subsampling_factor == 1: + conv_size1, conv_size2 = conv_size + + self.conv = torch.nn.Sequential( + torch.nn.Conv2d( + 1, + conv_size1, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size1, + conv_size1, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.MaxPool2d((1, 2)), + torch.nn.Conv2d( + conv_size1, + conv_size2, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size2, + conv_size2, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.MaxPool2d((1, 2)), + ) + + output_proj = conv_size2 * ((input_size // 2) // 2) + + self.subsampling_factor = 1 + + self.stride_1 = 1 + + self.create_new_mask = self.create_new_vgg_mask + + else: + conv_size1, conv_size2 = conv_size + + kernel_1 = int(subsampling_factor / 2) + + self.conv = torch.nn.Sequential( + torch.nn.Conv2d( + 1, + conv_size1, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size1, + conv_size1, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.MaxPool2d((kernel_1, 2)), + torch.nn.Conv2d( + conv_size1, + conv_size2, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size2, + conv_size2, + conv_kernel_size, + stride=1, + padding=(conv_kernel_size - 1) // 2, + ), + torch.nn.ReLU(), + torch.nn.MaxPool2d((2, 2)), + ) + + output_proj = conv_size2 * ((input_size // 2) // 2) + + self.subsampling_factor = subsampling_factor + + self.create_new_mask = self.create_new_vgg_mask + + self.stride_1 = kernel_1 + + else: + if subsampling_factor == 1: + self.conv = torch.nn.Sequential( + torch.nn.Conv2d(1, conv_size, 3, [1, 2], [1, 0]), + torch.nn.ReLU(), + torch.nn.Conv2d(conv_size, conv_size, conv_kernel_size, [1, 2], [1, 0]), + torch.nn.ReLU(), + ) + + output_proj = conv_size * (((input_size - 1) // 2 - 1) // 2) + + self.subsampling_factor = subsampling_factor + self.kernel_2 = conv_kernel_size + self.stride_2 = 1 + + self.create_new_mask = self.create_new_conv2d_mask + + else: + kernel_2, stride_2, conv_2_output_size = sub_factor_to_params( + subsampling_factor, + input_size, + ) + + self.conv = torch.nn.Sequential( + torch.nn.Conv2d(1, conv_size, 3, 2, [1, 0]), + torch.nn.ReLU(), + torch.nn.Conv2d( + conv_size, conv_size, kernel_2, stride_2, [(kernel_2 - 1) // 2, 0] + ), + torch.nn.ReLU(), + ) + + output_proj = conv_size * conv_2_output_size + + self.subsampling_factor = subsampling_factor + self.kernel_2 = kernel_2 + self.stride_2 = stride_2 + + self.create_new_mask = self.create_new_conv2d_mask + + self.vgg_like = vgg_like + self.min_frame_length = 7 + + if output_size is not None: + self.output = torch.nn.Linear(output_proj, output_size) + self.output_size = output_size + else: + self.output = None + self.output_size = output_proj + + def forward( + self, x: torch.Tensor, mask: Optional[torch.Tensor], chunk_size: Optional[torch.Tensor] + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Encode input sequences. + Args: + x: ConvInput input sequences. (B, T, D_feats) + mask: Mask of input sequences. (B, 1, T) + Returns: + x: ConvInput output sequences. (B, sub(T), D_out) + mask: Mask of output sequences. (B, 1, sub(T)) + """ + if mask is not None: + mask = self.create_new_mask(mask) + olens = max(mask.eq(0).sum(1)) + + b, t, f = x.size() + x = x.unsqueeze(1) # (b. 1. t. f) + + if chunk_size is not None: + max_input_length = int( + chunk_size + * self.subsampling_factor + * (math.ceil(float(t) / (chunk_size * self.subsampling_factor))) + ) + x = map(lambda inputs: pad_to_len(inputs, max_input_length, 1), x) + x = list(x) + x = torch.stack(x, dim=0) + N_chunks = max_input_length // (chunk_size * self.subsampling_factor) + x = x.view(b * N_chunks, 1, chunk_size * self.subsampling_factor, f) + + x = self.conv(x) + + _, c, _, f = x.size() + if chunk_size is not None: + x = x.transpose(1, 2).contiguous().view(b, -1, c * f)[:, :olens, :] + else: + x = x.transpose(1, 2).contiguous().view(b, -1, c * f) + + if self.output is not None: + x = self.output(x) + + return x, mask[:, :olens][:, : x.size(1)] + + def create_new_vgg_mask(self, mask: torch.Tensor) -> torch.Tensor: + """Create a new mask for VGG output sequences. + Args: + mask: Mask of input sequences. (B, T) + Returns: + mask: Mask of output sequences. (B, sub(T)) + """ + if self.subsampling_factor > 1: + vgg1_t_len = mask.size(1) - (mask.size(1) % (self.subsampling_factor // 2)) + mask = mask[:, :vgg1_t_len][:, :: self.subsampling_factor // 2] + + vgg2_t_len = mask.size(1) - (mask.size(1) % 2) + mask = mask[:, :vgg2_t_len][:, ::2] + else: + mask = mask + + return mask + + def create_new_conv2d_mask(self, mask: torch.Tensor) -> torch.Tensor: + """Create new conformer mask for Conv2d output sequences. + Args: + mask: Mask of input sequences. (B, T) + Returns: + mask: Mask of output sequences. (B, sub(T)) + """ + if self.subsampling_factor > 1: + return mask[:, ::2][:, :: self.stride_2] + else: + return mask + + def get_size_before_subsampling(self, size: int) -> int: + """Return the original size before subsampling for a given size. + Args: + size: Number of frames after subsampling. + Returns: + : Number of frames before subsampling. + """ + return size * self.subsampling_factor diff --git a/funasr/models/transformer/utils/subsampling_without_posenc.py b/funasr/models/transformer/utils/subsampling_without_posenc.py new file mode 100644 index 0000000..239d3f1 --- /dev/null +++ b/funasr/models/transformer/utils/subsampling_without_posenc.py @@ -0,0 +1,61 @@ +# Copyright 2020 Emiru Tsunoo +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +"""Subsampling layer definition.""" + +import math +import torch + + +class Conv2dSubsamplingWOPosEnc(torch.nn.Module): + """Convolutional 2D subsampling. + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + kernels (list): kernel sizes + strides (list): stride sizes + + """ + + def __init__(self, idim, odim, dropout_rate, kernels, strides): + """Construct an Conv2dSubsamplingWOPosEnc object.""" + assert len(kernels) == len(strides) + super().__init__() + conv = [] + olen = idim + for i, (k, s) in enumerate(zip(kernels, strides)): + conv += [ + torch.nn.Conv2d(1 if i == 0 else odim, odim, k, s), + torch.nn.ReLU(), + ] + olen = math.floor((olen - k) / s + 1) + self.conv = torch.nn.Sequential(*conv) + self.out = torch.nn.Linear(odim * olen, odim) + self.strides = strides + self.kernels = kernels + + def forward(self, x, x_mask): + """Subsample x. + + Args: + x (torch.Tensor): Input tensor (#batch, time, idim). + x_mask (torch.Tensor): Input mask (#batch, 1, time). + + Returns: + torch.Tensor: Subsampled tensor (#batch, time', odim), + where time' = time // 4. + torch.Tensor: Subsampled mask (#batch, 1, time'), + where time' = time // 4. + + """ + x = x.unsqueeze(1) # (b, c, t, f) + x = self.conv(x) + b, c, t, f = x.size() + x = self.out(x.transpose(1, 2).contiguous().view(b, t, c * f)) + if x_mask is None: + return x, None + for k, s in zip(self.kernels, self.strides): + x_mask = x_mask[:, :, : -k + 1 : s] + return x, x_mask diff --git a/funasr/models/transformer/utils/vgg2l.py b/funasr/models/transformer/utils/vgg2l.py new file mode 100644 index 0000000..7466bac --- /dev/null +++ b/funasr/models/transformer/utils/vgg2l.py @@ -0,0 +1,88 @@ +"""VGG2L module definition for custom encoder.""" + +from typing import Tuple, Union + +import torch + + +class VGG2L(torch.nn.Module): + """VGG2L module for custom encoder. + + Args: + idim: Input dimension. + odim: Output dimension. + pos_enc: Positional encoding class. + + """ + + def __init__(self, idim: int, odim: int, pos_enc: torch.nn.Module = None): + """Construct a VGG2L object.""" + super().__init__() + + self.vgg2l = torch.nn.Sequential( + torch.nn.Conv2d(1, 64, 3, stride=1, padding=1), + torch.nn.ReLU(), + torch.nn.Conv2d(64, 64, 3, stride=1, padding=1), + torch.nn.ReLU(), + torch.nn.MaxPool2d((3, 2)), + torch.nn.Conv2d(64, 128, 3, stride=1, padding=1), + torch.nn.ReLU(), + torch.nn.Conv2d(128, 128, 3, stride=1, padding=1), + torch.nn.ReLU(), + torch.nn.MaxPool2d((2, 2)), + ) + + if pos_enc is not None: + self.output = torch.nn.Sequential( + torch.nn.Linear(128 * ((idim // 2) // 2), odim), pos_enc + ) + else: + self.output = torch.nn.Linear(128 * ((idim // 2) // 2), odim) + + def forward(self, feats: torch.Tensor, feats_mask: torch.Tensor) -> Union[ + Tuple[torch.Tensor, torch.Tensor], + Tuple[Tuple[torch.Tensor, torch.Tensor], torch.Tensor], + ]: + """Forward VGG2L bottleneck. + + Args: + feats: Feature sequences. (B, F, D_feats) + feats_mask: Mask of feature sequences. (B, 1, F) + + Returns: + vgg_output: VGG output sequences. + (B, sub(F), D_out) or ((B, sub(F), D_out), (B, sub(F), D_att)) + vgg_mask: Mask of VGG output sequences. (B, 1, sub(F)) + + """ + feats = feats.unsqueeze(1) + vgg_output = self.vgg2l(feats) + + b, c, t, f = vgg_output.size() + + vgg_output = self.output(vgg_output.transpose(1, 2).contiguous().view(b, t, c * f)) + + if feats_mask is not None: + vgg_mask = self.create_new_mask(feats_mask) + else: + vgg_mask = feats_mask + + return vgg_output, vgg_mask + + def create_new_mask(self, feats_mask: torch.Tensor) -> torch.Tensor: + """Create a subsampled mask of feature sequences. + + Args: + feats_mask: Mask of feature sequences. (B, 1, F) + + Returns: + vgg_mask: Mask of VGG2L output sequences. (B, 1, sub(F)) + + """ + vgg1_t_len = feats_mask.size(2) - (feats_mask.size(2) % 3) + vgg_mask = feats_mask[:, :, :vgg1_t_len][:, :, ::3] + + vgg2_t_len = vgg_mask.size(2) - (vgg_mask.size(2) % 2) + vgg_mask = vgg_mask[:, :, :vgg2_t_len][:, :, ::2] + + return vgg_mask diff --git a/funasr/models/uniasr/__init__.py b/funasr/models/uniasr/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/uniasr/beam_search.py b/funasr/models/uniasr/beam_search.py new file mode 100644 index 0000000..f422129 --- /dev/null +++ b/funasr/models/uniasr/beam_search.py @@ -0,0 +1,499 @@ +"""Beam search module.""" + +from itertools import chain +import logging +from typing import Any +from typing import Dict +from typing import List +from typing import NamedTuple +from typing import Tuple +from typing import Union + +import torch + +from funasr.metrics.common import end_detect +from funasr.models.transformer.scorers.scorer_interface import PartialScorerInterface +from funasr.models.transformer.scorers.scorer_interface import ScorerInterface + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: torch.Tensor + score: Union[float, torch.Tensor] = 0 + scores: Dict[str, Union[float, torch.Tensor]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +class BeamSearchScama(torch.nn.Module): + """Beam search implementation.""" + + def __init__( + self, + scorers: Dict[str, ScorerInterface], + weights: Dict[str, float], + beam_size: int, + vocab_size: int, + sos: int, + eos: int, + token_list: List[str] = None, + pre_beam_ratio: float = 1.5, + pre_beam_score_key: str = None, + ): + """Initialize beam search. + + Args: + scorers (dict[str, ScorerInterface]): Dict of decoder modules + e.g., Decoder, CTCPrefixScorer, LM + The scorer will be ignored if it is `None` + weights (dict[str, float]): Dict of weights for each scorers + The scorer will be ignored if its weight is 0 + beam_size (int): The number of hypotheses kept during search + vocab_size (int): The number of vocabulary + sos (int): Start of sequence id + eos (int): End of sequence id + token_list (list[str]): List of tokens for debug log + pre_beam_score_key (str): key of scores to perform pre-beam search + pre_beam_ratio (float): beam size in the pre-beam search + will be `int(pre_beam_ratio * beam_size)` + + """ + super().__init__() + # set scorers + self.weights = weights + self.scorers = dict() + self.full_scorers = dict() + self.part_scorers = dict() + # this module dict is required for recursive cast + # `self.to(device, dtype)` in `recog.py` + self.nn_dict = torch.nn.ModuleDict() + for k, v in scorers.items(): + w = weights.get(k, 0) + if w == 0 or v is None: + continue + assert isinstance( + v, ScorerInterface + ), f"{k} ({type(v)}) does not implement ScorerInterface" + self.scorers[k] = v + if isinstance(v, PartialScorerInterface): + self.part_scorers[k] = v + else: + self.full_scorers[k] = v + if isinstance(v, torch.nn.Module): + self.nn_dict[k] = v + + # set configurations + self.sos = sos + self.eos = eos + self.token_list = token_list + self.pre_beam_size = int(pre_beam_ratio * beam_size) + self.beam_size = beam_size + self.n_vocab = vocab_size + if ( + pre_beam_score_key is not None + and pre_beam_score_key != "full" + and pre_beam_score_key not in self.full_scorers + ): + raise KeyError(f"{pre_beam_score_key} is not found in {self.full_scorers}") + self.pre_beam_score_key = pre_beam_score_key + self.do_pre_beam = ( + self.pre_beam_score_key is not None + and self.pre_beam_size < self.n_vocab + and len(self.part_scorers) > 0 + ) + + def init_hyp(self, x: torch.Tensor) -> List[Hypothesis]: + """Get an initial hypothesis data. + + Args: + x (torch.Tensor): The encoder output feature + + Returns: + Hypothesis: The initial hypothesis. + + """ + init_states = dict() + init_scores = dict() + for k, d in self.scorers.items(): + init_states[k] = d.init_state(x) + init_scores[k] = 0.0 + return [ + Hypothesis( + score=0.0, + scores=init_scores, + states=init_states, + yseq=torch.tensor([self.sos], device=x.device), + ) + ] + + @staticmethod + def append_token(xs: torch.Tensor, x: int) -> torch.Tensor: + """Append new token to prefix tokens. + + Args: + xs (torch.Tensor): The prefix token + x (int): The new token to append + + Returns: + torch.Tensor: New tensor contains: xs + [x] with xs.dtype and xs.device + + """ + x = torch.tensor([x], dtype=xs.dtype, device=xs.device) + return torch.cat((xs, x)) + + def score_full( + self, + hyp: Hypothesis, + x: torch.Tensor, + x_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.full_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.full_scorers` + and tensor score values of shape: `(self.n_vocab,)`, + and state dict that has string keys + and state values of `self.full_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.full_scorers.items(): + scores[k], states[k] = d.score( + hyp.yseq, hyp.states[k], x, x_mask=x_mask, pre_acoustic_embeds=pre_acoustic_embeds + ) + return scores, states + + def score_partial( + self, hyp: Hypothesis, ids: torch.Tensor, x: torch.Tensor + ) -> Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: + """Score new hypothesis by `self.part_scorers`. + + Args: + hyp (Hypothesis): Hypothesis with prefix tokens to score + ids (torch.Tensor): 1D tensor of new partial tokens to score + x (torch.Tensor): Corresponding input feature + + Returns: + Tuple[Dict[str, torch.Tensor], Dict[str, Any]]: Tuple of + score dict of `hyp` that has string keys of `self.part_scorers` + and tensor score values of shape: `(len(ids),)`, + and state dict that has string keys + and state values of `self.part_scorers` + + """ + scores = dict() + states = dict() + for k, d in self.part_scorers.items(): + scores[k], states[k] = d.score_partial(hyp.yseq, ids, hyp.states[k], x) + return scores, states + + def beam( + self, weighted_scores: torch.Tensor, ids: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute topk full token ids and partial token ids. + + Args: + weighted_scores (torch.Tensor): The weighted sum scores for each tokens. + Its shape is `(self.n_vocab,)`. + ids (torch.Tensor): The partial token ids to compute topk + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + The topk full token ids and partial token ids. + Their shapes are `(self.beam_size,)` + + """ + # no pre beam performed + if weighted_scores.size(0) == ids.size(0): + top_ids = weighted_scores.topk(self.beam_size)[1] + return top_ids, top_ids + + # mask pruned in pre-beam not to select in topk + tmp = weighted_scores[ids] + weighted_scores[:] = -float("inf") + weighted_scores[ids] = tmp + top_ids = weighted_scores.topk(self.beam_size)[1] + local_ids = weighted_scores[ids].topk(self.beam_size)[1] + return top_ids, local_ids + + @staticmethod + def merge_scores( + prev_scores: Dict[str, float], + next_full_scores: Dict[str, torch.Tensor], + full_idx: int, + next_part_scores: Dict[str, torch.Tensor], + part_idx: int, + ) -> Dict[str, torch.Tensor]: + """Merge scores for new hypothesis. + + Args: + prev_scores (Dict[str, float]): + The previous hypothesis scores by `self.scorers` + next_full_scores (Dict[str, torch.Tensor]): scores by `self.full_scorers` + full_idx (int): The next token id for `next_full_scores` + next_part_scores (Dict[str, torch.Tensor]): + scores of partial tokens by `self.part_scorers` + part_idx (int): The new token id for `next_part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are scalar tensors by the scorers. + + """ + new_scores = dict() + for k, v in next_full_scores.items(): + new_scores[k] = prev_scores[k] + v[full_idx] + for k, v in next_part_scores.items(): + new_scores[k] = prev_scores[k] + v[part_idx] + return new_scores + + def merge_states(self, states: Any, part_states: Any, part_idx: int) -> Any: + """Merge states for new hypothesis. + + Args: + states: states of `self.full_scorers` + part_states: states of `self.part_scorers` + part_idx (int): The new token id for `part_scores` + + Returns: + Dict[str, torch.Tensor]: The new score dict. + Its keys are names of `self.full_scorers` and `self.part_scorers`. + Its values are states of the scorers. + + """ + new_states = dict() + for k, v in states.items(): + new_states[k] = v + for k, d in self.part_scorers.items(): + new_states[k] = d.select_state(part_states[k], part_idx) + return new_states + + def search( + self, + running_hyps: List[Hypothesis], + x: torch.Tensor, + x_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + ) -> List[Hypothesis]: + """Search new tokens for running hypotheses and encoded speech x. + + Args: + running_hyps (List[Hypothesis]): Running hypotheses on beam + x (torch.Tensor): Encoded speech feature (T, D) + + Returns: + List[Hypotheses]: Best sorted hypotheses + + """ + best_hyps = [] + part_ids = torch.arange(self.n_vocab, device=x.device) # no pre-beam + for hyp in running_hyps: + # scoring + weighted_scores = torch.zeros(self.n_vocab, dtype=x.dtype, device=x.device) + scores, states = self.score_full( + hyp, x, x_mask=x_mask, pre_acoustic_embeds=pre_acoustic_embeds + ) + for k in self.full_scorers: + weighted_scores += self.weights[k] * scores[k] + # partial scoring + if self.do_pre_beam: + pre_beam_scores = ( + weighted_scores + if self.pre_beam_score_key == "full" + else scores[self.pre_beam_score_key] + ) + part_ids = torch.topk(pre_beam_scores, self.pre_beam_size)[1] + part_scores, part_states = self.score_partial(hyp, part_ids, x) + for k in self.part_scorers: + weighted_scores[part_ids] += self.weights[k] * part_scores[k] + # add previous hyp score + weighted_scores += hyp.score + + # update hyps + for j, part_j in zip(*self.beam(weighted_scores, part_ids)): + # will be (2 x beam at most) + best_hyps.append( + Hypothesis( + score=weighted_scores[j], + yseq=self.append_token(hyp.yseq, j), + scores=self.merge_scores(hyp.scores, scores, j, part_scores, part_j), + states=self.merge_states(states, part_states, part_j), + ) + ) + + # sort and prune 2 x beam -> beam + best_hyps = sorted(best_hyps, key=lambda x: x.score, reverse=True)[ + : min(len(best_hyps), self.beam_size) + ] + return best_hyps + + def forward( + self, + x: torch.Tensor, + scama_mask: torch.Tensor = None, + pre_acoustic_embeds: torch.Tensor = None, + maxlenratio: float = 0.0, + minlenratio: float = 0.0, + maxlen: int = None, + minlen: int = 0, + ) -> List[Hypothesis]: + """Perform beam search. + + Args: + x (torch.Tensor): Encoded speech feature (T, D) + maxlenratio (float): Input length ratio to obtain max output length. + If maxlenratio=0.0 (default), it uses a end-detect function + to automatically find maximum hypothesis lengths + If maxlenratio<0.0, its absolute value is interpreted + as a constant max output length. + minlenratio (float): Input length ratio to obtain min output length. + + Returns: + list[Hypothesis]: N-best decoding results + + """ + if maxlen is None: + # set length bounds + if maxlenratio == 0: + maxlen = x.shape[0] + elif maxlenratio < 0: + maxlen = -1 * int(maxlenratio) + else: + maxlen = max(1, int(maxlenratio * x.size(0))) + minlen = int(minlenratio * x.size(0)) + + logging.info("decoder input length: " + str(x.shape[0])) + logging.info("max output length: " + str(maxlen)) + logging.info("min output length: " + str(minlen)) + + # main loop of prefix search + running_hyps = self.init_hyp(x) + ended_hyps = [] + for i in range(maxlen): + logging.debug("position " + str(i)) + mask_enc = None + if scama_mask is not None: + token_num_predictor = scama_mask.size(1) + token_id_slice = min(i, token_num_predictor - 1) + mask_enc = scama_mask[:, token_id_slice : token_id_slice + 1, :] + # if mask_enc.size(1) == 0: + # mask_enc = scama_mask[:, -2:-1, :] + # # mask_enc = torch.zeros_like(mask_enc) + pre_acoustic_embeds_cur = None + if pre_acoustic_embeds is not None: + b, t, d = pre_acoustic_embeds.size() + pad = torch.zeros((b, 1, d), dtype=pre_acoustic_embeds.dtype).to( + device=pre_acoustic_embeds.device + ) + pre_acoustic_embeds = torch.cat((pre_acoustic_embeds, pad), dim=1) + token_id_slice = min(i, t) + pre_acoustic_embeds_cur = pre_acoustic_embeds[ + :, token_id_slice : token_id_slice + 1, : + ] + + best = self.search( + running_hyps, x, x_mask=mask_enc, pre_acoustic_embeds=pre_acoustic_embeds_cur + ) + # post process of one iteration + running_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps) + # end detection + if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i): + logging.info(f"end detected at {i}") + break + if len(running_hyps) == 0: + logging.info("no hypothesis. Finish decoding.") + break + else: + logging.debug(f"remained hypotheses: {len(running_hyps)}") + + nbest_hyps = sorted(ended_hyps, key=lambda x: x.score, reverse=True) + # check the number of hypotheses reaching to eos + if len(nbest_hyps) == 0: + logging.warning( + "there is no N-best results, perform recognition " "again with smaller minlenratio." + ) + return ( + [] + if minlenratio < 0.1 + else self.forward(x, maxlenratio, max(0.0, minlenratio - 0.1)) + ) + + # report the best result + for x in nbest_hyps: + yseq = "".join([self.token_list[x] for x in x.yseq]) + logging.debug("nbest: y: {}, yseq: {}, score: {}".format(x.yseq, yseq, x.score)) + best = nbest_hyps[0] + for k, v in best.scores.items(): + logging.info(f"{v:6.2f} * {self.weights[k]:3} = {v * self.weights[k]:6.2f} for {k}") + logging.info(f"total log probability: {best.score:.2f}") + logging.info(f"normalized log probability: {best.score / len(best.yseq):.2f}") + logging.info(f"total number of ended hypotheses: {len(nbest_hyps)}") + if self.token_list is not None: + logging.info( + "best hypo: " + "".join([self.token_list[x] for x in best.yseq[1:-1]]) + "\n" + ) + return nbest_hyps + + def post_process( + self, + i: int, + maxlen: int, + maxlenratio: float, + running_hyps: List[Hypothesis], + ended_hyps: List[Hypothesis], + ) -> List[Hypothesis]: + """Perform post-processing of beam search iterations. + + Args: + i (int): The length of hypothesis tokens. + maxlen (int): The maximum length of tokens in beam search. + maxlenratio (int): The maximum length ratio in beam search. + running_hyps (List[Hypothesis]): The running hypotheses in beam search. + ended_hyps (List[Hypothesis]): The ended hypotheses in beam search. + + Returns: + List[Hypothesis]: The new running hypotheses. + + """ + logging.debug(f"the number of running hypotheses: {len(running_hyps)}") + if self.token_list is not None: + logging.debug( + "best hypo: " + "".join([self.token_list[x] for x in running_hyps[0].yseq[1:]]) + ) + # add eos in the final loop to avoid that there are no ended hyps + if i == maxlen - 1: + logging.info("adding in the last position in the loop") + running_hyps = [ + h._replace(yseq=self.append_token(h.yseq, self.eos)) for h in running_hyps + ] + + # add ended hypotheses to a final list, and removed them from current hypotheses + # (this will be a problem, number of hyps < beam) + remained_hyps = [] + for hyp in running_hyps: + if hyp.yseq[-1] == self.eos: + # e.g., Word LM needs to add final score + for k, d in chain(self.full_scorers.items(), self.part_scorers.items()): + s = d.final_score(hyp.states[k]) + hyp.scores[k] += s + hyp = hyp._replace(score=hyp.score + self.weights[k] * s) + ended_hyps.append(hyp) + else: + remained_hyps.append(hyp) + return remained_hyps diff --git a/funasr/models/uniasr/model.py b/funasr/models/uniasr/model.py new file mode 100644 index 0000000..bde6377 --- /dev/null +++ b/funasr/models/uniasr/model.py @@ -0,0 +1,1030 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import time +import torch +import logging +from torch.cuda.amp import autocast +from typing import Union, Dict, List, Tuple, Optional + +from funasr.register import tables +from funasr.models.ctc.ctc import CTC +from funasr.utils import postprocess_utils +from funasr.metrics.compute_acc import th_accuracy +from funasr.utils.datadir_writer import DatadirWriter +from funasr.models.paraformer.cif_predictor import mae_loss +from funasr.train_utils.device_funcs import force_gatherable +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.models.transformer.utils.nets_utils import make_pad_mask, pad_list +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.models.scama.utils import sequence_mask + + +@tables.register("model_classes", "UniASR") +class UniASR(torch.nn.Module): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + """ + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + encoder2: str = None, + encoder2_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + decoder2: str = None, + decoder2_conf: dict = None, + predictor: str = None, + predictor_conf: dict = None, + predictor_bias: int = 0, + predictor_weight: float = 0.0, + predictor2: str = None, + predictor2_conf: dict = None, + predictor2_bias: int = 0, + predictor2_weight: float = 0.0, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.5, + ctc2: str = None, + ctc2_conf: dict = None, + ctc2_weight: float = 0.5, + decoder_attention_chunk_type: str = "chunk", + decoder_attention_chunk_type2: str = "chunk", + stride_conv=None, + stride_conv_conf: dict = None, + loss_weight_model1: float = 0.5, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + share_embedding: bool = False, + **kwargs, + ): + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class( + vocab_size=vocab_size, + encoder_output_size=encoder_output_size, + **decoder_conf, + ) + predictor_class = tables.predictor_classes.get(predictor) + predictor = predictor_class(**predictor_conf) + + from funasr.models.transformer.utils.subsampling import Conv1dSubsampling + + stride_conv = Conv1dSubsampling( + **stride_conv_conf, + idim=input_size + encoder_output_size, + odim=input_size + encoder_output_size, + ) + stride_conv_output_size = stride_conv.output_size() + + encoder_class = tables.encoder_classes.get(encoder2) + encoder2 = encoder_class(input_size=stride_conv_output_size, **encoder2_conf) + encoder2_output_size = encoder2.output_size() + + decoder_class = tables.decoder_classes.get(decoder2) + decoder2 = decoder_class( + vocab_size=vocab_size, + encoder_output_size=encoder2_output_size, + **decoder2_conf, + ) + predictor_class = tables.predictor_classes.get(predictor2) + predictor2 = predictor_class(**predictor2_conf) + + self.blank_id = blank_id + self.sos = sos + self.eos = eos + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.ctc_weight = ctc_weight + self.ctc2_weight = ctc2_weight + + self.specaug = specaug + self.normalize = normalize + + self.encoder = encoder + + self.error_calculator = None + + self.decoder = decoder + self.ctc = None + self.ctc2 = None + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + + self.predictor = predictor + self.predictor_weight = predictor_weight + self.criterion_pre = mae_loss(normalize_length=length_normalized_loss) + self.encoder1_encoder2_joint_training = kwargs.get("encoder1_encoder2_joint_training", True) + + if self.encoder.overlap_chunk_cls is not None: + from funasr.models.scama.chunk_utilis import ( + build_scama_mask_for_cross_attention_decoder, + ) + + self.build_scama_mask_for_cross_attention_decoder_fn = ( + build_scama_mask_for_cross_attention_decoder + ) + self.decoder_attention_chunk_type = decoder_attention_chunk_type + + self.encoder2 = encoder2 + self.decoder2 = decoder2 + self.ctc2_weight = ctc2_weight + + self.predictor2 = predictor2 + self.predictor2_weight = predictor2_weight + self.decoder_attention_chunk_type2 = decoder_attention_chunk_type2 + self.stride_conv = stride_conv + self.loss_weight_model1 = loss_weight_model1 + if self.encoder2.overlap_chunk_cls is not None: + from funasr.models.scama.chunk_utilis import ( + build_scama_mask_for_cross_attention_decoder, + ) + + self.build_scama_mask_for_cross_attention_decoder_fn2 = ( + build_scama_mask_for_cross_attention_decoder + ) + self.decoder_attention_chunk_type2 = decoder_attention_chunk_type2 + + self.length_normalized_loss = length_normalized_loss + self.enable_maas_finetune = kwargs.get("enable_maas_finetune", False) + self.freeze_encoder2 = kwargs.get("freeze_encoder2", False) + self.beam_search = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + decoding_ind = kwargs.get("decoding_ind", None) + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + ind = self.encoder.overlap_chunk_cls.random_choice(self.training, decoding_ind) + # 1. Encoder + if self.enable_maas_finetune: + with torch.no_grad(): + speech_raw, encoder_out, encoder_out_lens = self.encode( + speech, speech_lengths, ind=ind + ) + else: + speech_raw, encoder_out, encoder_out_lens = self.encode(speech, speech_lengths, ind=ind) + + loss_att, acc_att, cer_att, wer_att = None, None, None, None + loss_ctc, cer_ctc = None, None + stats = dict() + loss_pre = None + loss, loss1, loss2 = 0.0, 0.0, 0.0 + + if self.loss_weight_model1 > 0.0: + ## model1 + # 1. CTC branch + if self.enable_maas_finetune: + with torch.no_grad(): + + loss_att, acc_att, cer_att, wer_att, loss_pre = self._calc_att_predictor_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + loss = loss_att + loss_pre * self.predictor_weight + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + else: + + loss_att, acc_att, cer_att, wer_att, loss_pre = self._calc_att_predictor_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + loss = loss_att + loss_pre * self.predictor_weight + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + stats["loss_pre"] = loss_pre.detach().cpu() if loss_pre is not None else None + + loss1 = loss + + if self.loss_weight_model1 < 1.0: + ## model2 + + # encoder2 + if self.freeze_encoder2: + with torch.no_grad(): + encoder_out, encoder_out_lens = self.encode2( + encoder_out, encoder_out_lens, speech_raw, speech_lengths, ind=ind + ) + else: + encoder_out, encoder_out_lens = self.encode2( + encoder_out, encoder_out_lens, speech_raw, speech_lengths, ind=ind + ) + + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + loss_att, acc_att, cer_att, wer_att, loss_pre = self._calc_att_predictor_loss2( + encoder_out, encoder_out_lens, text, text_lengths + ) + + loss = loss_att + loss_pre * self.predictor2_weight + + # Collect Attn branch stats + stats["loss_att2"] = loss_att.detach() if loss_att is not None else None + stats["acc2"] = acc_att + stats["cer2"] = cer_att + stats["wer2"] = wer_att + stats["loss_pre2"] = loss_pre.detach().cpu() if loss_pre is not None else None + + loss2 = loss + + loss = loss1 * self.loss_weight_model1 + loss2 * (1 - self.loss_weight_model1) + stats["loss1"] = torch.clone(loss1.detach()) + stats["loss2"] = torch.clone(loss2.detach()) + stats["loss"] = torch.clone(loss.detach()) + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def collect_feats( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + ) -> Dict[str, torch.Tensor]: + if self.extract_feats_in_collect_stats: + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + else: + # Generate dummy stats if extract_feats_in_collect_stats is False + logging.warning( + "Generating dummy stats for feats and feats_lengths, " + "because encoder_conf.extract_feats_in_collect_stats is " + f"{self.extract_feats_in_collect_stats}" + ) + feats, feats_lengths = speech, speech_lengths + return {"feats": feats, "feats_lengths": feats_lengths} + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + ind = kwargs.get("ind", 0) + with autocast(False): + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + speech_raw = speech.clone().to(speech.device) + + # 4. Forward encoder + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths, ind=ind) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + return speech_raw, encoder_out, encoder_out_lens + + def encode2( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ): + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + + ind = kwargs.get("ind", 0) + encoder_out_rm, encoder_out_lens_rm = self.encoder.overlap_chunk_cls.remove_chunk( + encoder_out, + encoder_out_lens, + chunk_outs=None, + ) + # residual_input + encoder_out = torch.cat((speech, encoder_out_rm), dim=-1) + encoder_out_lens = encoder_out_lens_rm + if self.stride_conv is not None: + speech, speech_lengths = self.stride_conv(encoder_out, encoder_out_lens) + if not self.encoder1_encoder2_joint_training: + speech = speech.detach() + speech_lengths = speech_lengths.detach() + # 4. Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + + encoder_out, encoder_out_lens, _ = self.encoder2(speech, speech_lengths, ind=ind) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + return encoder_out, encoder_out_lens + + def nll( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ) -> torch.Tensor: + """Compute negative log likelihood(nll) from transformer-decoder + Normally, this function is called in batchify_nll. + Args: + encoder_out: (Batch, Length, Dim) + encoder_out_lens: (Batch,) + ys_pad: (Batch, Length) + ys_pad_lens: (Batch,) + """ + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, _ = self.decoder( + encoder_out, encoder_out_lens, ys_in_pad, ys_in_lens + ) # [batch, seqlen, dim] + batch_size = decoder_out.size(0) + decoder_num_class = decoder_out.size(2) + # nll: negative log-likelihood + nll = torch.nn.functional.cross_entropy( + decoder_out.view(-1, decoder_num_class), + ys_out_pad.view(-1), + ignore_index=self.ignore_id, + reduction="none", + ) + nll = nll.view(batch_size, -1) + nll = nll.sum(dim=1) + assert nll.size(0) == batch_size + return nll + + def batchify_nll( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + batch_size: int = 100, + ): + """Compute negative log likelihood(nll) from transformer-decoder + To avoid OOM, this fuction seperate the input into batches. + Then call nll for each batch and combine and return results. + Args: + encoder_out: (Batch, Length, Dim) + encoder_out_lens: (Batch,) + ys_pad: (Batch, Length) + ys_pad_lens: (Batch,) + batch_size: int, samples each batch contain when computing nll, + you may change this to avoid OOM or increase + GPU memory usage + """ + total_num = encoder_out.size(0) + if total_num <= batch_size: + nll = self.nll(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + else: + nll = [] + start_idx = 0 + while True: + end_idx = min(start_idx + batch_size, total_num) + batch_encoder_out = encoder_out[start_idx:end_idx, :, :] + batch_encoder_out_lens = encoder_out_lens[start_idx:end_idx] + batch_ys_pad = ys_pad[start_idx:end_idx, :] + batch_ys_pad_lens = ys_pad_lens[start_idx:end_idx] + batch_nll = self.nll( + batch_encoder_out, + batch_encoder_out_lens, + batch_ys_pad, + batch_ys_pad_lens, + ) + nll.append(batch_nll) + start_idx = end_idx + if start_idx == total_num: + break + nll = torch.cat(nll) + assert nll.size(0) == total_num + return nll + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, _ = self.decoder(encoder_out, encoder_out_lens, ys_in_pad, ys_in_lens) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att + + def _calc_att_predictor_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + encoder_out_mask = sequence_mask( + encoder_out_lens, + maxlen=encoder_out.size(1), + dtype=encoder_out.dtype, + device=encoder_out.device, + )[:, None, :] + mask_chunk_predictor = None + if self.encoder.overlap_chunk_cls is not None: + mask_chunk_predictor = self.encoder.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, _ = self.predictor( + encoder_out, + ys_out_pad, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=ys_in_lens, + ) + predictor_alignments, predictor_alignments_len = self.predictor.gen_frame_alignments( + pre_alphas, encoder_out_lens + ) + + scama_mask = None + if ( + self.encoder.overlap_chunk_cls is not None + and self.decoder_attention_chunk_type == "chunk" + ): + encoder_chunk_size = self.encoder.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=ys_in_lens, + is_training=self.training, + ) + elif self.encoder.overlap_chunk_cls is not None: + encoder_out, encoder_out_lens = self.encoder.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + # try: + # 1. Forward decoder + decoder_out, _ = self.decoder( + encoder_out, + encoder_out_lens, + ys_in_pad, + ys_in_lens, + chunk_mask=scama_mask, + pre_acoustic_embeds=pre_acoustic_embeds, + ) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + # predictor loss + loss_pre = self.criterion_pre(ys_in_lens.type_as(pre_token_length), pre_token_length) + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att, loss_pre + + def _calc_att_predictor_loss2( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + encoder_out_mask = sequence_mask( + encoder_out_lens, + maxlen=encoder_out.size(1), + dtype=encoder_out.dtype, + device=encoder_out.device, + )[:, None, :] + mask_chunk_predictor = None + if self.encoder2.overlap_chunk_cls is not None: + mask_chunk_predictor = self.encoder2.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder2.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, _ = self.predictor2( + encoder_out, + ys_out_pad, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=ys_in_lens, + ) + predictor_alignments, predictor_alignments_len = self.predictor2.gen_frame_alignments( + pre_alphas, encoder_out_lens + ) + + scama_mask = None + if ( + self.encoder2.overlap_chunk_cls is not None + and self.decoder_attention_chunk_type2 == "chunk" + ): + encoder_chunk_size = self.encoder2.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder2.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder2.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn2( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type2, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=ys_in_lens, + is_training=self.training, + ) + elif self.encoder2.overlap_chunk_cls is not None: + encoder_out, encoder_out_lens = self.encoder2.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + # try: + # 1. Forward decoder + decoder_out, _ = self.decoder2( + encoder_out, + encoder_out_lens, + ys_in_pad, + ys_in_lens, + chunk_mask=scama_mask, + pre_acoustic_embeds=pre_acoustic_embeds, + ) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + # predictor loss + loss_pre = self.criterion_pre(ys_in_lens.type_as(pre_token_length), pre_token_length) + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att, loss_pre + + def calc_predictor_mask( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor = None, + ys_pad_lens: torch.Tensor = None, + ): + # ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + # ys_in_lens = ys_pad_lens + 1 + ys_out_pad, ys_in_lens = None, None + + encoder_out_mask = sequence_mask( + encoder_out_lens, + maxlen=encoder_out.size(1), + dtype=encoder_out.dtype, + device=encoder_out.device, + )[:, None, :] + mask_chunk_predictor = None + if self.encoder.overlap_chunk_cls is not None: + mask_chunk_predictor = self.encoder.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, _ = self.predictor( + encoder_out, + ys_out_pad, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=ys_in_lens, + ) + predictor_alignments, predictor_alignments_len = self.predictor.gen_frame_alignments( + pre_alphas, encoder_out_lens + ) + + scama_mask = None + if ( + self.encoder.overlap_chunk_cls is not None + and self.decoder_attention_chunk_type == "chunk" + ): + encoder_chunk_size = self.encoder.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=ys_in_lens, + is_training=self.training, + ) + elif self.encoder.overlap_chunk_cls is not None: + encoder_out, encoder_out_lens = self.encoder.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + + return ( + pre_acoustic_embeds, + pre_token_length, + predictor_alignments, + predictor_alignments_len, + scama_mask, + ) + + def calc_predictor_mask2( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor = None, + ys_pad_lens: torch.Tensor = None, + ): + # ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + # ys_in_lens = ys_pad_lens + 1 + ys_out_pad, ys_in_lens = None, None + + encoder_out_mask = sequence_mask( + encoder_out_lens, + maxlen=encoder_out.size(1), + dtype=encoder_out.dtype, + device=encoder_out.device, + )[:, None, :] + mask_chunk_predictor = None + if self.encoder2.overlap_chunk_cls is not None: + mask_chunk_predictor = self.encoder2.overlap_chunk_cls.get_mask_chunk_predictor( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + mask_shfit_chunk = self.encoder2.overlap_chunk_cls.get_mask_shfit_chunk( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + encoder_out = encoder_out * mask_shfit_chunk + pre_acoustic_embeds, pre_token_length, pre_alphas, _ = self.predictor2( + encoder_out, + ys_out_pad, + encoder_out_mask, + ignore_id=self.ignore_id, + mask_chunk_predictor=mask_chunk_predictor, + target_label_length=ys_in_lens, + ) + predictor_alignments, predictor_alignments_len = self.predictor2.gen_frame_alignments( + pre_alphas, encoder_out_lens + ) + + scama_mask = None + if ( + self.encoder2.overlap_chunk_cls is not None + and self.decoder_attention_chunk_type2 == "chunk" + ): + encoder_chunk_size = self.encoder2.overlap_chunk_cls.chunk_size_pad_shift_cur + attention_chunk_center_bias = 0 + attention_chunk_size = encoder_chunk_size + decoder_att_look_back_factor = ( + self.encoder2.overlap_chunk_cls.decoder_att_look_back_factor_cur + ) + mask_shift_att_chunk_decoder = ( + self.encoder2.overlap_chunk_cls.get_mask_shift_att_chunk_decoder( + None, device=encoder_out.device, batch_size=encoder_out.size(0) + ) + ) + scama_mask = self.build_scama_mask_for_cross_attention_decoder_fn2( + predictor_alignments=predictor_alignments, + encoder_sequence_length=encoder_out_lens, + chunk_size=1, + encoder_chunk_size=encoder_chunk_size, + attention_chunk_center_bias=attention_chunk_center_bias, + attention_chunk_size=attention_chunk_size, + attention_chunk_type=self.decoder_attention_chunk_type2, + step=None, + predictor_mask_chunk_hopping=mask_chunk_predictor, + decoder_att_look_back_factor=decoder_att_look_back_factor, + mask_shift_att_chunk_decoder=mask_shift_att_chunk_decoder, + target_length=ys_in_lens, + is_training=self.training, + ) + elif self.encoder2.overlap_chunk_cls is not None: + encoder_out, encoder_out_lens = self.encoder2.overlap_chunk_cls.remove_chunk( + encoder_out, encoder_out_lens, chunk_outs=None + ) + + return ( + pre_acoustic_embeds, + pre_token_length, + predictor_alignments, + predictor_alignments_len, + scama_mask, + ) + + def init_beam_search( + self, + **kwargs, + ): + from funasr.models.uniasr.beam_search import BeamSearchScama + from funasr.models.transformer.scorers.ctc import CTCPrefixScorer + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + decoding_mode = kwargs.get("decoding_mode", "model1") + if decoding_mode == "model1": + decoder = self.decoder + else: + decoder = self.decoder2 + # 1. Build ASR model + scorers = {} + + if self.ctc != None: + ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos) + scorers.update(ctc=ctc) + token_list = kwargs.get("token_list") + scorers.update( + decoder=decoder, + length_bonus=LengthBonus(len(token_list)), + ) + + # 3. Build ngram model + # ngram is not supported now + ngram = None + scorers["ngram"] = ngram + + weights = dict( + decoder=1.0 - kwargs.get("decoding_ctc_weight", 0.0), + ctc=kwargs.get("decoding_ctc_weight", 0.0), + lm=kwargs.get("lm_weight", 0.0), + ngram=kwargs.get("ngram_weight", 0.0), + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearchScama( + beam_size=kwargs.get("beam_size", 5), + weights=weights, + scorers=scorers, + sos=self.sos, + eos=self.eos, + vocab_size=len(token_list), + token_list=token_list, + pre_beam_score_key=None if self.ctc_weight == 1.0 else "full", + ) + + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + decoding_model = kwargs.get("decoding_model", "normal") + token_num_relax = kwargs.get("token_num_relax", 5) + if decoding_model == "fast": + decoding_ind = 0 + decoding_mode = "model1" + elif decoding_model == "offline": + decoding_ind = 1 + decoding_mode = "model2" + else: + decoding_ind = 0 + decoding_mode = "model2" + # init beamsearch + + if self.beam_search is None: + logging.info("enable beam_search") + self.init_beam_search(decoding_mode=decoding_mode, **kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + speech_raw = speech.clone().to(device=kwargs["device"]) + # Encoder + _, encoder_out, encoder_out_lens = self.encode(speech, speech_lengths, ind=decoding_ind) + if decoding_mode == "model1": + predictor_outs = self.calc_predictor_mask(encoder_out, encoder_out_lens) + else: + encoder_out, encoder_out_lens = self.encode2( + encoder_out, encoder_out_lens, speech_raw, speech_lengths, ind=decoding_ind + ) + predictor_outs = self.calc_predictor_mask2(encoder_out, encoder_out_lens) + + scama_mask = predictor_outs[4] + pre_token_length = predictor_outs[1] + pre_acoustic_embeds = predictor_outs[0] + maxlen = pre_token_length.sum().item() + token_num_relax + minlen = max(0, pre_token_length.sum().item() - token_num_relax) + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + scama_mask=scama_mask, + pre_acoustic_embeds=pre_acoustic_embeds, + maxlenratio=0.0, + minlenratio=0.0, + maxlen=int(maxlen), + minlen=int(minlen), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + for hyp in nbest_hyps: + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list(filter(lambda x: x != 0, token_int)) + + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text_postprocessed = tokenizer.tokens2text(token) + if not hasattr(tokenizer, "bpemodel"): + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + + result_i = {"key": key[0], "text": text_postprocessed} + results.append(result_i) + + return results, meta_data diff --git a/funasr/models/uniasr/template.yaml b/funasr/models/uniasr/template.yaml new file mode 100644 index 0000000..43d55fc --- /dev/null +++ b/funasr/models/uniasr/template.yaml @@ -0,0 +1,206 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: UniASR +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + predictor_weight: 1.0 + decoder_attention_chunk_type: chunk + ctc_weight2: 0.0 + predictor_weight2: 1.0 + decoder_attention_chunk_type2: chunk + loss_weight_model1: 0.5 + + +# encoder +encoder: SANMEncoderChunkOpt +encoder_conf: + output_size: 320 + attention_heads: 4 + linear_units: 1280 + num_blocks: 35 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + chunk_size: + - 20 + - 60 + stride: + - 10 + - 40 + pad_left: + - 5 + - 10 + encoder_att_look_back_factor: + - 0 + - 0 + decoder_att_look_back_factor: + - 0 + - 0 + +# decoder +decoder: FsmnDecoderSCAMAOpt +decoder_conf: + attention_dim: 256 + attention_heads: 4 + linear_units: 1024 + num_blocks: 12 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 6 + kernel_size: 11 + concat_embeds: true + +# predictor +predictor: CifPredictorV2 +predictor_conf: + idim: 320 + threshold: 1.0 + l_order: 1 + r_order: 1 + + +# encoder2 +encoder2: SANMEncoderChunkOpt +encoder2_conf: + output_size: 320 + attention_heads: 4 + linear_units: 1280 + num_blocks: 20 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 21 + sanm_shfit: 0 + selfattention_layer_type: sanm + chunk_size: + - 45 + - 70 + stride: + - 35 + - 50 + pad_left: + - 5 + - 10 + encoder_att_look_back_factor: + - 0 + - 0 + decoder_att_look_back_factor: + - 0 + - 0 + +# decoder +decoder2: FsmnDecoderSCAMAOpt +decoder2_conf: + attention_dim: 320 + attention_heads: 4 + linear_units: 1280 + num_blocks: 12 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 6 + kernel_size: 11 + concat_embeds: true + +predictor2: CifPredictorV2 +predictor2_conf: + idim: 320 + threshold: 1.0 + l_order: 1 + r_order: 1 + +stride_conv: stride_conv1d +stride_conv_conf: + kernel_size: 2 + stride: 2 + pad: + - 0 + - 1 + +# frontend related +frontend: WavFrontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 + dither: 0.0 + +specaug: SpecAugLFR +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 + +train_conf: + accum_grad: 1 + grad_clip: 5 + max_epoch: 150 + keep_nbest_models: 10 + avg_nbest_model: 10 + log_interval: 50 + +optim: adam +optim_conf: + lr: 0.0001 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 + +dataset: AudioDataset +dataset_conf: + index_ds: IndexDSJsonl + batch_sampler: BatchSampler + batch_type: example # example or length + batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; + max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, + buffer_size: 500 + shuffle: True + num_workers: 0 + +tokenizer: CharTokenizer +tokenizer_conf: + unk_symbol: + split_with_space: true + + +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +normalize: null diff --git a/funasr/models/whisper/__init__.py b/funasr/models/whisper/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/whisper/model.py b/funasr/models/whisper/model.py new file mode 100644 index 0000000..8e9245a --- /dev/null +++ b/funasr/models/whisper/model.py @@ -0,0 +1,118 @@ +from dataclasses import dataclass +from typing import Dict +from typing import Iterable, Optional +import time +import numpy as np +import torch +import torch.nn.functional as F +from torch import Tensor +from torch import nn +import whisper +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank + +from funasr.register import tables + + +@tables.register("model_classes", "Whisper-tiny.en") +@tables.register("model_classes", "Whisper-tiny") +@tables.register("model_classes", "Whisper-base.en") +@tables.register("model_classes", "Whisper-base") +@tables.register("model_classes", "Whisper-small.en") +@tables.register("model_classes", "Whisper-small") +@tables.register("model_classes", "Whisper-medium.en") +@tables.register("model_classes", "Whisper-medium") +@tables.register("model_classes", "Whisper-large-v1") +@tables.register("model_classes", "Whisper-large-v2") +@tables.register("model_classes", "Whisper-large-v3") +@tables.register("model_classes", "WhisperWarp") +class WhisperWarp(nn.Module): + def __init__(self, *args, **kwargs): + super().__init__() + hub = kwargs.get("hub", "funasr") + if hub == "openai": + model_or_path = kwargs.get("model_path", "Whisper-large-v3") + if model_or_path.startswith("Whisper-"): + model_or_path = model_or_path.replace("Whisper-", "") + model = whisper.load_model(model_or_path) + else: + dims = kwargs.get("dims", {}) + dims = whisper.model.ModelDimensions(**dims) + model = whisper.model.Whisper(dims=dims) + + self.model = model + + self.encoder_output_size = self.model.dims.n_audio_state + + def forward( + self, + ): + pass + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + if frontend is None and not hasattr(self, "frontend"): + frontend_class = tables.frontend_classes.get("WhisperFrontend") + frontend = frontend_class( + n_mels=self.model.dims.n_mels, do_pad_trim=kwargs.get("do_pad_trim", True) + ) + self.frontend = frontend + else: + frontend = frontend if frontend is not None else self.frontend + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs if hasattr(frontend, "fs") else 16000, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + frame_shift = frontend.frame_shift if hasattr(frontend, "frame_shift") else 10 + lfr_n = frontend.lfr_n if hasattr(frontend, "lfr_n") else 1 + meta_data["batch_data_time"] = speech_lengths.sum().item() * frame_shift * lfr_n / 1000 + + speech = speech.to(device=kwargs["device"])[0, :, :] + speech_lengths = speech_lengths.to(device=kwargs["device"]) + + # # detect the spoken language + # _, probs = self.model.detect_language(speech) + # print(f"Detected language: {max(probs, key=probs.get)}") + + # decode the audio + options = whisper.DecodingOptions(**kwargs.get("DecodingOptions", {})) + result = whisper.decode(self.model, speech, options) + + results = [] + result_i = {"key": key[0], "text": result.text} + + results.append(result_i) + + return results, meta_data diff --git a/funasr/models/whisper/template.yaml b/funasr/models/whisper/template.yaml new file mode 100644 index 0000000..568b948 --- /dev/null +++ b/funasr/models/whisper/template.yaml @@ -0,0 +1,45 @@ +# This is an example that demonstrates how to configure a model file. +# You can modify the configuration according to your own requirements. + +# to print the register_table: +# from funasr.register import tables +# tables.print() + +# network architecture +model: WhisperWarp +model_conf: + lsm_weight: 0.1 + length_normalized_loss: true + hub: funasr # openai + + + +# only use for hub == funasr, +# if hub == openai, dims is automaticall download +dims: + n_mels: 128 + n_vocab: 51866 + n_audio_ctx: 1500 + n_audio_state: 1280 + n_audio_head: 20 + n_audio_layer: 32 + n_text_ctx: 448 + n_text_state: 1280 + n_text_head: 20 + n_text_layer: 32 + +# frontend related +frontend: WhisperFrontend +frontend_conf: + fs: 16000 + n_mels: ${dims.n_mels} + do_pad_trim: true + +tokenizer: WhisperTokenizer +tokenizer_conf: + language: null + task: transcribe + is_multilingual: true + num_languages: 100 + +scope_map: [none, "model."] \ No newline at end of file diff --git a/funasr/models/whisper_lid/__init__.py b/funasr/models/whisper_lid/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/whisper_lid/decoder.py b/funasr/models/whisper_lid/decoder.py new file mode 100644 index 0000000..1c8ab47 --- /dev/null +++ b/funasr/models/whisper_lid/decoder.py @@ -0,0 +1,162 @@ +# Copyright ESPnet (https://github.com/espnet/espnet). All Rights Reserved. +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +import copy +from typing import Any, List, Tuple + +import torch +from torch import nn +import whisper + +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.register import tables + + +@tables.register("decoder_classes", "OpenAIWhisperDecoderWarp") +class OpenAIWhisperDecoderWarp(nn.Module): + """Transformer-based Speech-to-Text Decoder from OpenAI's Whisper Model: + + URL: https://github.com/openai/whisper + """ + + def __init__( + self, + dropout_rate: float = 0.0, + whisper_model: str = "small", + download_dir: str = None, + use_padmask: bool = False, + ): + super().__init__() + + assert whisper_model in whisper.available_models() + _model = whisper.load_model(whisper_model, download_root=download_dir, device="cpu") + self.decoders = copy.deepcopy(_model.decoder) + attention_dim = self.decoders.token_embedding.embedding_dim + + # note that originally Whisper doesn't use dropouts + self.dropout = torch.nn.Dropout(dropout_rate) + + self.decoders.train() + del _model + self.use_padmask = use_padmask + + def forward( + self, + hs_pad: torch.Tensor, + hlens: torch.Tensor, + ys_in_pad: torch.Tensor, + ys_in_lens: torch.Tensor, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Forward decoder. + + Args: + hs_pad: encoded memory, float32 (batch, maxlen_in, feat) + hlens: (batch) + ys_in_pad: + input token ids, int64 (batch, maxlen_out) + if input_layer == "embed" + input tensor (batch, maxlen_out, #mels) in the other cases + ys_in_lens: (batch) + Returns: + (tuple): tuple containing: + + x: decoded token score before softmax (batch, maxlen_out, token) + if use_output_layer is True, + olens: (batch, ) + """ + tgt, memory = ys_in_pad, hs_pad + tgt = self.decoders.token_embedding(tgt) + self.decoders.positional_embedding[: tgt.size(1)] + tgt = self.dropout(tgt) + + x = tgt.to(memory.dtype) + + if self.use_padmask: + memory_mask = (~make_pad_mask(hlens)[:, None, :]).to(memory.device) + else: + memory_mask = None + + for layer, block in enumerate(self.decoders.blocks): + x = block( + x, + memory, + mask=self.decoders.mask, + memory_mask=memory_mask, + is_pad_mask=False, + is_pad_memory_mask=True, + ) + + if layer < len(self.decoders.blocks) - 1: + x = self.dropout(x) + + x = self.decoders.ln(x) + x = (x @ torch.transpose(self.decoders.token_embedding.weight.to(x.dtype), 0, 1)).float() + + return x, ys_in_lens + + def forward_one_step( + self, + tgt: torch.Tensor, + tgt_mask: torch.Tensor, + memory: torch.Tensor, + cache: List[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """Forward one step. + + Args: + tgt: input token ids, int64 (batch, maxlen_out) + tgt_mask: input token mask, (batch, maxlen_out) + dtype=torch.uint8 in PyTorch 1.2- + dtype=torch.bool in PyTorch 1.2+ (include 1.2) + memory: encoded memory, float32 (batch, maxlen_in, feat) + cache: cached output list of (batch, max_time_out-1, size) + Returns: + y, cache: NN output value and cache per `self.decoders`. + y.shape` is (batch, maxlen_out, token) + NOTE (Shih-Lun): + cache implementation is ignored for now + for simplicity & correctness + """ + x = self.decoders.token_embedding(tgt) + self.decoders.positional_embedding[: tgt.size(1)] + x = self.dropout(x) + x = x.to(memory.dtype) + + for layer, block in enumerate(self.decoders.blocks): + x = block(x, memory, mask=self.decoders.mask) + if layer < len(self.decoders.blocks) - 1: + x = self.dropout(x) + + x = self.decoders.ln(x) + y = x[:, -1] + y = (y @ torch.transpose(self.decoders.token_embedding.weight.to(x.dtype), 0, 1)).float() + y = torch.log_softmax(y, dim=-1) + + return y, None + + def score(self, ys, state, x): + """Score.""" + logp, state = self.forward_one_step( + ys.unsqueeze(0), torch.empty(0), x.unsqueeze(0), cache=state # dummy mask + ) + return logp.squeeze(0), state + + def batch_score( + self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor + ) -> Tuple[torch.Tensor, List[Any]]: + """Score new token batch. + + Args: + ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen). + states (List[Any]): Scorer states for prefix tokens. + xs (torch.Tensor): + The encoder feature that generates ys (n_batch, xlen, n_feat). + + Returns: + tuple[torch.Tensor, List[Any]]: Tuple of + batchfied scores for next token with shape of `(n_batch, n_vocab)` + and next state list for ys. + + """ + # batch decoding, dummy mask is passed + logp, states = self.forward_one_step(ys, torch.empty(0), xs, cache=None) + + return logp, None diff --git a/funasr/models/whisper_lid/encoder.py b/funasr/models/whisper_lid/encoder.py new file mode 100644 index 0000000..b6fb28b --- /dev/null +++ b/funasr/models/whisper_lid/encoder.py @@ -0,0 +1,113 @@ +# Copyright ESPnet (https://github.com/espnet/espnet). All Rights Reserved. +# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +import copy +from typing import Optional, Tuple, Union + +import torch +from torch import nn +import torch.nn.functional as F +import whisper + +from funasr.models.transformer.utils.nets_utils import make_pad_mask +from funasr.models.specaug.specaug import SpecAug +from funasr.register import tables + + +@tables.register("encoder_classes", "OpenAIWhisperEncoderWarp") +class OpenAIWhisperEncoderWarp(nn.Module): + """Transformer-based Speech Encoder from OpenAI's Whisper Model: + + URL: https://github.com/openai/whisper + """ + + def __init__( + self, + dropout_rate: float = 0.0, + whisper_model: str = "small", + download_dir: str = None, + use_specaug: bool = False, + use_padmask: bool = False, + specaug_conf: Union[dict, None] = None, + ): + super().__init__() + + # note that originally Whisper doesn't use dropouts + self.dropout = torch.nn.Dropout(dropout_rate) + + assert whisper_model in whisper.available_models() + _model = whisper.load_model(whisper_model, download_root=download_dir, device="cpu") + self.encoders = copy.deepcopy(_model.encoder) + self.encoders.train() + + del _model + + if use_specaug: + self.specaug = SpecAug(**specaug_conf) + else: + self.specaug = None + self.use_padmask = use_padmask + + def whisper_encode( + self, + input: torch.Tensor, + ilens: torch.Tensor = None, + ) -> torch.Tensor: + x = F.gelu(self.encoders.conv1(input)) + x = F.gelu(self.encoders.conv2(x)) + x = x.permute(0, 2, 1) + + n_frames = x.size(1) + max_pos = self.encoders.positional_embedding.size(0) + if n_frames <= max_pos: + x = (x + self.encoders.positional_embedding[: x.size(1), :]).to(x.dtype) + else: + # due to positional encoding, audios >30 sec won't be accepted + x = x[:, :max_pos, :] + self.encoders.positional_embedding + + if ilens is not None: + olens = ( + 1 + + (ilens - self.encoders.conv2.kernel_size[0] + 2 * self.encoders.conv2.padding[0]) + // self.encoders.conv2.stride[0] + ) + olens = torch.clamp(olens, max=max_pos) + else: + olens = None + + if self.use_padmask: + padding_mask = (~make_pad_mask(olens)[:, None, :]).to(x.device) + else: + padding_mask = None + + x = self.dropout(x) + + for layer, block in enumerate(self.encoders.blocks): + x = block(x) + if layer < len(self.encoders.blocks) - 1: + x = self.dropout(x) + + x = self.encoders.ln_post(x) + + return x, olens + + def output_size(self) -> int: + # dummy output size + return self.encoders.conv2.weight.shape[0] + + def forward( + self, + xs_pad: torch.Tensor, + ilens: torch.Tensor, + prev_states: torch.Tensor = None, + ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: + feats, feats_lens = xs_pad, ilens + + if self.specaug is not None and self.encoders.training: + feats = torch.transpose(feats, 1, 2) + feats, feats_lens = self.specaug(feats, feats_lens) + feats = torch.transpose(feats, 1, 2) + + xs_pad, olens = self.whisper_encode(feats, feats_lens) + + return xs_pad, olens, None diff --git a/funasr/models/whisper_lid/eres2net/ResNet.py b/funasr/models/whisper_lid/eres2net/ResNet.py new file mode 100644 index 0000000..df3b96d --- /dev/null +++ b/funasr/models/whisper_lid/eres2net/ResNet.py @@ -0,0 +1,387 @@ +# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +""" Res2Net implementation is adapted from https://github.com/wenet-e2e/wespeaker. + ERes2Net incorporates both local and global feature fusion techniques to improve the performance. + The local feature fusion (LFF) fuses the features within one single residual block to extract the local signal. + The global feature fusion (GFF) takes acoustic features of different scales as input to aggregate global signal. + ERes2Net-Large is an upgraded version of ERes2Net that uses a larger number of parameters to achieve better + recognition performance. Parameters expansion, baseWidth, and scale can be modified to obtain optimal performance. +""" + +import torch +import math +import torch.nn as nn +import torch.nn.functional as F +import funasr.models.whisper_lid.eres2net.pooling_layers as pooling_layers +from funasr.models.whisper_lid.eres2net.fusion import AFF + + +class ReLU(nn.Hardtanh): + + def __init__(self, inplace=False): + super(ReLU, self).__init__(0, 20, inplace) + + def __repr__(self): + inplace_str = "inplace" if self.inplace else "" + return self.__class__.__name__ + " (" + inplace_str + ")" + + +def conv1x1(in_planes, out_planes, stride=1): + "1x1 convolution without padding" + return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, padding=0, bias=False) + + +def conv3x3(in_planes, out_planes, stride=1): + "3x3 convolution with padding" + return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) + + +class BasicBlockERes2Net(nn.Module): + expansion = 2 + + def __init__(self, in_planes, planes, stride=1, baseWidth=32, scale=2): + super(BasicBlockERes2Net, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + self.nums = scale + + convs = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = sp + spx[i] + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class BasicBlockERes2Net_diff_AFF(nn.Module): + expansion = 2 + + def __init__(self, in_planes, planes, stride=1, baseWidth=32, scale=2): + super(BasicBlockERes2Net_diff_AFF, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + self.nums = scale + + convs = [] + fuse_models = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + for j in range(self.nums - 1): + fuse_models.append(AFF(channels=width)) + + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.fuse_models = nn.ModuleList(fuse_models) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = self.fuse_models[i - 1](sp, spx[i]) + + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class ERes2Net(nn.Module): + def __init__( + self, + block=BasicBlockERes2Net, + block_fuse=BasicBlockERes2Net_diff_AFF, + num_blocks=[3, 4, 6, 3], + m_channels=32, + feat_dim=80, + embedding_size=192, + pooling_func="TSTP", + two_emb_layer=False, + ): + super(ERes2Net, self).__init__() + self.in_planes = m_channels + self.feat_dim = feat_dim + self.embedding_size = embedding_size + self.stats_dim = int(feat_dim / 8) * m_channels * 8 + self.two_emb_layer = two_emb_layer + self._output_size = embedding_size + + self.conv1 = nn.Conv2d(1, m_channels, kernel_size=3, stride=1, padding=1, bias=False) + self.bn1 = nn.BatchNorm2d(m_channels) + self.layer1 = self._make_layer(block, m_channels, num_blocks[0], stride=1) + self.layer2 = self._make_layer(block, m_channels * 2, num_blocks[1], stride=2) + self.layer3 = self._make_layer(block_fuse, m_channels * 4, num_blocks[2], stride=2) + self.layer4 = self._make_layer(block_fuse, m_channels * 8, num_blocks[3], stride=2) + + # Downsampling module for each layer + self.layer1_downsample = nn.Conv2d( + m_channels * 2, m_channels * 4, kernel_size=3, stride=2, padding=1, bias=False + ) + self.layer2_downsample = nn.Conv2d( + m_channels * 4, m_channels * 8, kernel_size=3, padding=1, stride=2, bias=False + ) + self.layer3_downsample = nn.Conv2d( + m_channels * 8, m_channels * 16, kernel_size=3, padding=1, stride=2, bias=False + ) + + # Bottom-up fusion module + self.fuse_mode12 = AFF(channels=m_channels * 4) + self.fuse_mode123 = AFF(channels=m_channels * 8) + self.fuse_mode1234 = AFF(channels=m_channels * 16) + + self.n_stats = 1 if pooling_func == "TAP" or pooling_func == "TSDP" else 2 + self.pool = getattr(pooling_layers, pooling_func)(in_dim=self.stats_dim * block.expansion) + self.seg_1 = nn.Linear(self.stats_dim * block.expansion * self.n_stats, embedding_size) + if self.two_emb_layer: + self.seg_bn_1 = nn.BatchNorm1d(embedding_size, affine=False) + self.seg_2 = nn.Linear(embedding_size, embedding_size) + else: + self.seg_bn_1 = nn.Identity() + self.seg_2 = nn.Identity() + + def _make_layer(self, block, planes, num_blocks, stride): + strides = [stride] + [1] * (num_blocks - 1) + layers = [] + for stride in strides: + layers.append(block(self.in_planes, planes, stride)) + self.in_planes = planes * block.expansion + return nn.Sequential(*layers) + + def output_size(self) -> int: + return self._output_size + + def forward(self, x, ilens): + # assert x.shape[1] == ilens.max() + x = x.permute(0, 2, 1) # (B,T,F) => (B,F,T) + x = x.unsqueeze_(1) + out = F.relu(self.bn1(self.conv1(x))) + out1 = self.layer1(out) + out2 = self.layer2(out1) + out1_downsample = self.layer1_downsample(out1) + fuse_out12 = self.fuse_mode12(out2, out1_downsample) + out3 = self.layer3(out2) + fuse_out12_downsample = self.layer2_downsample(fuse_out12) + fuse_out123 = self.fuse_mode123(out3, fuse_out12_downsample) + out4 = self.layer4(out3) + fuse_out123_downsample = self.layer3_downsample(fuse_out123) + fuse_out1234 = self.fuse_mode1234(out4, fuse_out123_downsample) + olens = (((((ilens - 1) // 2 + 1) - 1) // 2 + 1) - 1) // 2 + 1 + stats = self.pool(fuse_out1234, olens) + + embed_a = self.seg_1(stats) + if self.two_emb_layer: + out = F.relu(embed_a) + out = self.seg_bn_1(out) + embed_b = self.seg_2(out) + return embed_b + else: + return embed_a + + +class BasicBlockRes2Net(nn.Module): + expansion = 2 + + def __init__(self, in_planes, planes, stride=1, baseWidth=32, scale=2): + super(BasicBlockRes2Net, self).__init__() + width = int(math.floor(planes * (baseWidth / 64.0))) + self.conv1 = conv1x1(in_planes, width * scale, stride) + self.bn1 = nn.BatchNorm2d(width * scale) + self.nums = scale - 1 + convs = [] + bns = [] + for i in range(self.nums): + convs.append(conv3x3(width, width)) + bns.append(nn.BatchNorm2d(width)) + self.convs = nn.ModuleList(convs) + self.bns = nn.ModuleList(bns) + self.relu = ReLU(inplace=True) + + self.conv3 = conv1x1(width * scale, planes * self.expansion) + self.bn3 = nn.BatchNorm2d(planes * self.expansion) + self.shortcut = nn.Sequential() + if stride != 1 or in_planes != self.expansion * planes: + self.shortcut = nn.Sequential( + nn.Conv2d( + in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False + ), + nn.BatchNorm2d(self.expansion * planes), + ) + self.stride = stride + self.width = width + self.scale = scale + + def forward(self, x): + residual = x + + out = self.conv1(x) + out = self.bn1(out) + out = self.relu(out) + spx = torch.split(out, self.width, 1) + for i in range(self.nums): + if i == 0: + sp = spx[i] + else: + sp = sp + spx[i] + sp = self.convs[i](sp) + sp = self.relu(self.bns[i](sp)) + if i == 0: + out = sp + else: + out = torch.cat((out, sp), 1) + + out = torch.cat((out, spx[self.nums]), 1) + + out = self.conv3(out) + out = self.bn3(out) + + residual = self.shortcut(x) + out += residual + out = self.relu(out) + + return out + + +class Res2Net(nn.Module): + def __init__( + self, + block=BasicBlockRes2Net, + num_blocks=[3, 4, 6, 3], + m_channels=32, + feat_dim=80, + embedding_size=192, + pooling_func="TSTP", + two_emb_layer=False, + ): + super(Res2Net, self).__init__() + self.in_planes = m_channels + self.feat_dim = feat_dim + self.embedding_size = embedding_size + self.stats_dim = int(feat_dim / 8) * m_channels * 8 + self.two_emb_layer = two_emb_layer + + self.conv1 = nn.Conv2d(1, m_channels, kernel_size=3, stride=1, padding=1, bias=False) + self.bn1 = nn.BatchNorm2d(m_channels) + self.layer1 = self._make_layer(block, m_channels, num_blocks[0], stride=1) + self.layer2 = self._make_layer(block, m_channels * 2, num_blocks[1], stride=2) + self.layer3 = self._make_layer(block, m_channels * 4, num_blocks[2], stride=2) + self.layer4 = self._make_layer(block, m_channels * 8, num_blocks[3], stride=2) + + self.n_stats = 1 if pooling_func == "TAP" or pooling_func == "TSDP" else 2 + self.pool = getattr(pooling_layers, pooling_func)(in_dim=self.stats_dim * block.expansion) + self.seg_1 = nn.Linear(self.stats_dim * block.expansion * self.n_stats, embedding_size) + if self.two_emb_layer: + self.seg_bn_1 = nn.BatchNorm1d(embedding_size, affine=False) + self.seg_2 = nn.Linear(embedding_size, embedding_size) + else: + self.seg_bn_1 = nn.Identity() + self.seg_2 = nn.Identity() + + def _make_layer(self, block, planes, num_blocks, stride): + strides = [stride] + [1] * (num_blocks - 1) + layers = [] + for stride in strides: + layers.append(block(self.in_planes, planes, stride)) + self.in_planes = planes * block.expansion + return nn.Sequential(*layers) + + def forward(self, x): + x = x.permute(0, 2, 1) # (B,T,F) => (B,F,T) + + x = x.unsqueeze_(1) + out = F.relu(self.bn1(self.conv1(x))) + out = self.layer1(out) + out = self.layer2(out) + out = self.layer3(out) + out = self.layer4(out) + + stats = self.pool(out) + + embed_a = self.seg_1(stats) + if self.two_emb_layer: + out = F.relu(embed_a) + out = self.seg_bn_1(out) + embed_b = self.seg_2(out) + return embed_b + else: + return embed_a diff --git a/funasr/models/whisper_lid/eres2net/__init__.py b/funasr/models/whisper_lid/eres2net/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/whisper_lid/eres2net/fusion.py b/funasr/models/whisper_lid/eres2net/fusion.py new file mode 100644 index 0000000..fbe699e --- /dev/null +++ b/funasr/models/whisper_lid/eres2net/fusion.py @@ -0,0 +1,28 @@ +# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +import torch +import torch.nn as nn + + +class AFF(nn.Module): + + def __init__(self, channels=64, r=4): + super(AFF, self).__init__() + inter_channels = int(channels // r) + + self.local_att = nn.Sequential( + nn.Conv2d(channels * 2, inter_channels, kernel_size=1, stride=1, padding=0), + nn.BatchNorm2d(inter_channels), + nn.SiLU(inplace=True), + nn.Conv2d(inter_channels, channels, kernel_size=1, stride=1, padding=0), + nn.BatchNorm2d(channels), + ) + + def forward(self, x, ds_y): + xa = torch.cat((x, ds_y), dim=1) + x_att = self.local_att(xa) + x_att = 1.0 + torch.tanh(x_att) + xo = torch.mul(x, x_att) + torch.mul(ds_y, 2.0 - x_att) + + return xo diff --git a/funasr/models/whisper_lid/eres2net/pooling_layers.py b/funasr/models/whisper_lid/eres2net/pooling_layers.py new file mode 100644 index 0000000..da23d7b --- /dev/null +++ b/funasr/models/whisper_lid/eres2net/pooling_layers.py @@ -0,0 +1,119 @@ +# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +""" This implementation is adapted from https://github.com/wenet-e2e/wespeaker.""" + +import torch +import torch.nn as nn + +from funasr.models.transformer.utils.nets_utils import make_pad_mask + + +class TAP(nn.Module): + """ + Temporal average pooling, only first-order mean is considered + """ + + def __init__(self, **kwargs): + super(TAP, self).__init__() + + def forward(self, x): + pooling_mean = x.mean(dim=-1) + # To be compatable with 2D input + pooling_mean = pooling_mean.flatten(start_dim=1) + return pooling_mean + + +class TSDP(nn.Module): + """ + Temporal standard deviation pooling, only second-order std is considered + """ + + def __init__(self, **kwargs): + super(TSDP, self).__init__() + + def forward(self, x): + # The last dimension is the temporal axis + pooling_std = torch.sqrt(torch.var(x, dim=-1) + 1e-8) + pooling_std = pooling_std.flatten(start_dim=1) + return pooling_std + + +class TSTP(nn.Module): + """ + Temporal statistics pooling, concatenate mean and std, which is used in + x-vector + Comment: simple concatenation can not make full use of both statistics + """ + + def __init__(self, **kwargs): + super(TSTP, self).__init__() + + def forward(self, x, olens): + # The last dimension is the temporal axis + masks = (~make_pad_mask(olens, maxlen=x.shape[-1])[:, None, None, :]).to(x.device) + x_masked = x * masks + sum_without_padding = torch.sum(x_masked, axis=-1) + count_without_padding = torch.sum(masks, axis=-1) + mean_without_padding = sum_without_padding / count_without_padding + + var_without_padding = ((x_masked - mean_without_padding.unsqueeze(-1)) ** 2 * masks).sum( + -1 + ) / count_without_padding + + pooling_mean = mean_without_padding + pooling_std = torch.sqrt(var_without_padding + 1e-8) + pooling_mean = pooling_mean.flatten(start_dim=1) + pooling_std = pooling_std.flatten(start_dim=1) + + stats = torch.cat((pooling_mean, pooling_std), 1) + return stats + + +class ASTP(nn.Module): + """Attentive statistics pooling: Channel- and context-dependent + statistics pooling, first used in ECAPA_TDNN. + """ + + def __init__(self, in_dim, bottleneck_dim=128, global_context_att=False): + super(ASTP, self).__init__() + self.global_context_att = global_context_att + + # Use Conv1d with stride == 1 rather than Linear, then we don't + # need to transpose inputs. + if global_context_att: + self.linear1 = nn.Conv1d( + in_dim * 3, bottleneck_dim, kernel_size=1 + ) # equals W and b in the paper + else: + self.linear1 = nn.Conv1d( + in_dim, bottleneck_dim, kernel_size=1 + ) # equals W and b in the paper + self.linear2 = nn.Conv1d( + bottleneck_dim, in_dim, kernel_size=1 + ) # equals V and k in the paper + + def forward(self, x): + """ + x: a 3-dimensional tensor in tdnn-based architecture (B,F,T) + or a 4-dimensional tensor in resnet architecture (B,C,F,T) + 0-dim: batch-dimension, last-dim: time-dimension (frame-dimension) + """ + if len(x.shape) == 4: + x = x.reshape(x.shape[0], x.shape[1] * x.shape[2], x.shape[3]) + assert len(x.shape) == 3 + + if self.global_context_att: + context_mean = torch.mean(x, dim=-1, keepdim=True).expand_as(x) + context_std = torch.sqrt(torch.var(x, dim=-1, keepdim=True) + 1e-10).expand_as(x) + x_in = torch.cat((x, context_mean, context_std), dim=1) + else: + x_in = x + + # DON'T use ReLU here! ReLU may be hard to converge. + alpha = torch.tanh(self.linear1(x_in)) # alpha = F.relu(self.linear1(x_in)) + alpha = torch.softmax(self.linear2(alpha), dim=2) + mean = torch.sum(alpha * x, dim=2) + var = torch.sum(alpha * (x**2), dim=2) - mean**2 + std = torch.sqrt(var.clamp(min=1e-10)) + return torch.cat([mean, std], dim=1) diff --git a/funasr/models/whisper_lid/eres2net/simple_avg.py b/funasr/models/whisper_lid/eres2net/simple_avg.py new file mode 100644 index 0000000..9dbe7b3 --- /dev/null +++ b/funasr/models/whisper_lid/eres2net/simple_avg.py @@ -0,0 +1,18 @@ +import torch + +from funasr.models.encoder.abs_encoder import AbsEncoder +from funasr.modules.nets_utils import make_pad_mask + + +class SimpleAvg(AbsEncoder): + def __init__(self, feat_dim): + super(SimpleAvg, self).__init__() + self.feat_dim = feat_dim + + def forward(self, x, ilens): + mask = ~make_pad_mask(ilens, maxlen=x.shape[1]).to(x.device) + avg_x = (x * mask[:, :, None]).sum(1) / mask.sum(-1)[:, None] + return avg_x + + def output_size(self) -> int: + return self.feat_dim diff --git a/funasr/models/whisper_lid/lid_predictor.py b/funasr/models/whisper_lid/lid_predictor.py new file mode 100644 index 0000000..d5b0d37 --- /dev/null +++ b/funasr/models/whisper_lid/lid_predictor.py @@ -0,0 +1,31 @@ +from funasr.register import tables +from funasr.models.whisper_lid.eres2net.ResNet import ( + ERes2Net, + BasicBlockERes2Net, + BasicBlockERes2Net_diff_AFF, +) + + +@tables.register("lid_predictor_classes", "LidPredictor") +class LidPredictor(ERes2Net): + def __init__( + self, + block=BasicBlockERes2Net, + block_fuse=BasicBlockERes2Net_diff_AFF, + num_blocks=[3, 4, 6, 3], + m_channels=32, + feat_dim=80, + embedding_size=192, + pooling_func="TSTP", + two_emb_layer=False, + ): + super(LidPredictor, self).__init__( + block=block, + block_fuse=block_fuse, + num_blocks=num_blocks, + m_channels=m_channels, + feat_dim=feat_dim, + embedding_size=embedding_size, + pooling_func=pooling_func, + two_emb_layer=two_emb_layer, + ) diff --git a/funasr/models/whisper_lid/model.py b/funasr/models/whisper_lid/model.py new file mode 100644 index 0000000..0701f61 --- /dev/null +++ b/funasr/models/whisper_lid/model.py @@ -0,0 +1,704 @@ +import logging +from typing import Union, Dict, List, Tuple, Optional + +import time +import torch +import numpy as np +import torch.nn as nn +from torch.cuda.amp import autocast + +from funasr.losses.label_smoothing_loss import LabelSmoothingLoss +from funasr.models.ctc.ctc import CTC +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.metrics.compute_acc import th_accuracy +from funasr.train_utils.device_funcs import force_gatherable +from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank +from funasr.utils import postprocess_utils +from funasr.utils.datadir_writer import DatadirWriter +from funasr.register import tables + + +@tables.register("model_classes", "OpenAIWhisperModel") +class OpenAIWhisperModel(nn.Module): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + specaug: str = None, + specaug_conf: dict = None, + normalize: str = None, + normalize_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + decoder: str = None, + decoder_conf: dict = None, + ctc: str = None, + ctc_conf: dict = None, + ctc_weight: float = 0.5, + interctc_weight: float = 0.0, + input_size: int = 80, + vocab_size: int = -1, + ignore_id: int = -1, + blank_id: int = 0, + sos: int = 1, + eos: int = 2, + lsm_weight: float = 0.0, + length_normalized_loss: bool = False, + report_cer: bool = True, + report_wer: bool = True, + sym_space: str = "", + sym_blank: str = "", + # extract_feats_in_collect_stats: bool = True, + share_embedding: bool = False, + # preencoder: Optional[AbsPreEncoder] = None, + # postencoder: Optional[AbsPostEncoder] = None, + **kwargs, + ): + + super().__init__() + + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + if normalize is not None: + normalize_class = tables.normalize_classes.get(normalize) + normalize = normalize_class(**normalize_conf) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(input_size=input_size, **encoder_conf) + encoder_output_size = encoder.output_size() + if decoder is not None: + decoder_class = tables.decoder_classes.get(decoder) + decoder = decoder_class(decoder_conf) + if ctc_weight > 0.0: + + if ctc_conf is None: + ctc_conf = {} + + ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **ctc_conf) + + self.blank_id = blank_id + self.sos = sos if sos is not None else vocab_size - 1 + self.eos = eos if eos is not None else vocab_size - 1 + self.vocab_size = vocab_size + self.ignore_id = ignore_id + self.ctc_weight = ctc_weight + self.specaug = specaug + self.normalize = normalize + self.encoder = encoder + + if not hasattr(self.encoder, "interctc_use_conditioning"): + self.encoder.interctc_use_conditioning = False + if self.encoder.interctc_use_conditioning: + self.encoder.conditioning_layer = torch.nn.Linear( + vocab_size, self.encoder.output_size() + ) + self.interctc_weight = interctc_weight + + # self.error_calculator = None + if ctc_weight == 1.0: + self.decoder = None + else: + self.decoder = decoder + + self.criterion_att = LabelSmoothingLoss( + size=vocab_size, + padding_idx=ignore_id, + smoothing=lsm_weight, + normalize_length=length_normalized_loss, + ) + # + # if report_cer or report_wer: + # self.error_calculator = ErrorCalculator( + # token_list, sym_space, sym_blank, report_cer, report_wer + # ) + # + self.error_calculator = None + if ctc_weight == 0.0: + self.ctc = None + else: + self.ctc = ctc + + self.share_embedding = share_embedding + if self.share_embedding: + self.decoder.embed = None + + self.length_normalized_loss = length_normalized_loss + self.beam_search = None + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + # import pdb; + # pdb.set_trace() + if len(text_lengths.size()) > 1: + text_lengths = text_lengths[:, 0] + if len(speech_lengths.size()) > 1: + speech_lengths = speech_lengths[:, 0] + + batch_size = speech.shape[0] + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + loss_att, acc_att, cer_att, wer_att = None, None, None, None + loss_ctc, cer_ctc = None, None + stats = dict() + + # decoder: CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # Intermediate CTC (optional) + loss_interctc = 0.0 + if self.interctc_weight != 0.0 and intermediate_outs is not None: + for layer_idx, intermediate_out in intermediate_outs: + # we assume intermediate_out has the same length & padding + # as those of encoder_out + loss_ic, cer_ic = self._calc_ctc_loss( + intermediate_out, encoder_out_lens, text, text_lengths + ) + loss_interctc = loss_interctc + loss_ic + + # Collect Intermedaite CTC stats + stats["loss_interctc_layer{}".format(layer_idx)] = ( + loss_ic.detach() if loss_ic is not None else None + ) + stats["cer_interctc_layer{}".format(layer_idx)] = cer_ic + + loss_interctc = loss_interctc / len(intermediate_outs) + + # calculate whole encoder loss + loss_ctc = (1 - self.interctc_weight) * loss_ctc + self.interctc_weight * loss_interctc + + # decoder: Attention decoder branch + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + elif self.ctc_weight == 1.0: + loss = loss_ctc + else: + loss = self.ctc_weight * loss_ctc + (1 - self.ctc_weight) * loss_att + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + + # Collect total loss stats + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + if self.length_normalized_loss: + batch_size = int((text_lengths + 1).sum()) + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + **kwargs, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + ind: int + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech, speech_lengths = self.specaug(speech, speech_lengths) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + if self.encoder.interctc_use_conditioning: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths, ctc=self.ctc) + else: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + if intermediate_outs is not None: + return (encoder_out, intermediate_outs), encoder_out_lens + + return encoder_out, encoder_out_lens + + def _calc_att_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + ys_in_pad, ys_out_pad = add_sos_eos(ys_pad, self.sos, self.eos, self.ignore_id) + ys_in_lens = ys_pad_lens + 1 + + # 1. Forward decoder + decoder_out, _ = self.decoder(encoder_out, encoder_out_lens, ys_in_pad, ys_in_lens) + + # 2. Compute attention loss + loss_att = self.criterion_att(decoder_out, ys_out_pad) + acc_att = th_accuracy( + decoder_out.view(-1, self.vocab_size), + ys_out_pad, + ignore_label=self.ignore_id, + ) + + # Compute cer/wer using attention-decoder + if self.training or self.error_calculator is None: + cer_att, wer_att = None, None + else: + ys_hat = decoder_out.argmax(dim=-1) + cer_att, wer_att = self.error_calculator(ys_hat.cpu(), ys_pad.cpu()) + + return loss_att, acc_att, cer_att, wer_att + + def _calc_ctc_loss( + self, + encoder_out: torch.Tensor, + encoder_out_lens: torch.Tensor, + ys_pad: torch.Tensor, + ys_pad_lens: torch.Tensor, + ): + # Calc CTC loss + loss_ctc = self.ctc(encoder_out, encoder_out_lens, ys_pad, ys_pad_lens) + + # Calc CER using CTC + cer_ctc = None + if not self.training and self.error_calculator is not None: + ys_hat = self.ctc.argmax(encoder_out).data + cer_ctc = self.error_calculator(ys_hat.cpu(), ys_pad.cpu(), is_ctc=True) + return loss_ctc, cer_ctc + + def init_beam_search( + self, + **kwargs, + ): + from funasr.models.transformer.search import BeamSearch + from funasr.models.transformer.scorers.ctc import CTCPrefixScorer + from funasr.models.transformer.scorers.length_bonus import LengthBonus + + # 1. Build ASR model + scorers = {} + + if self.ctc != None: + ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos) + scorers.update(ctc=ctc) + token_list = kwargs.get("token_list") + scorers.update( + decoder=self.decoder, + length_bonus=LengthBonus(len(token_list)), + ) + + # 3. Build ngram model + # ngram is not supported now + ngram = None + scorers["ngram"] = ngram + + weights = dict( + decoder=1.0 - kwargs.get("decoding_ctc_weight", 0.5), + ctc=kwargs.get("decoding_ctc_weight", 0.5), + lm=kwargs.get("lm_weight", 0.0), + ngram=kwargs.get("ngram_weight", 0.0), + length_bonus=kwargs.get("penalty", 0.0), + ) + beam_search = BeamSearch( + beam_size=kwargs.get("beam_size", 10), + weights=weights, + scorers=scorers, + sos=self.sos, + eos=self.eos, + vocab_size=len(token_list), + token_list=token_list, + pre_beam_score_key=None if self.ctc_weight == 1.0 else "full", + ) + + self.beam_search = beam_search + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + # init beamsearch + if self.beam_search is None: + logging.info("enable beam_search") + self.init_beam_search(**kwargs) + self.nbest = kwargs.get("nbest", 1) + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + # Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + if isinstance(encoder_out, tuple): + encoder_out = encoder_out[0] + + # c. Passed the encoder result and the beam search + nbest_hyps = self.beam_search( + x=encoder_out[0], + maxlenratio=kwargs.get("maxlenratio", 0.0), + minlenratio=kwargs.get("minlenratio", 0.0), + ) + + nbest_hyps = nbest_hyps[: self.nbest] + + results = [] + b, n, d = encoder_out.size() + for i in range(b): + + for nbest_idx, hyp in enumerate(nbest_hyps): + ibest_writer = None + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + ibest_writer = self.writer[f"{nbest_idx + 1}best_recog"] + + # remove sos/eos and get results + last_pos = -1 + if isinstance(hyp.yseq, list): + token_int = hyp.yseq[1:last_pos] + else: + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list( + filter( + lambda x: x != self.eos and x != self.sos and x != self.blank_id, token_int + ) + ) + + # Change integer-ids to tokens + token = tokenizer.ids2tokens(token_int) + text = tokenizer.tokens2text(token) + + text_postprocessed, _ = postprocess_utils.sentence_postprocess(token) + result_i = {"key": key[i], "token": token, "text": text_postprocessed} + results.append(result_i) + + if ibest_writer is not None: + ibest_writer["token"][key[i]] = " ".join(token) + ibest_writer["text"][key[i]] = text_postprocessed + + return results, meta_data + + +@tables.register("model_classes", "OpenAIWhisperLIDModel") +class OpenAIWhisperLIDModel(nn.Module): + """WhisperEncoder and EResNet based LID Model""" + + def __init__( + self, + vocab_size: int, + specaug: str = None, + specaug_conf: dict = None, + encoder: str = None, + encoder_conf: dict = None, + lid_predictor: str = None, + lid_predictor_conf: dict = None, + proj_dim: int = None, + clip_frames: int = None, + random_clip: bool = False, + **kwargs, + ): + super().__init__() + if specaug is not None: + specaug_class = tables.specaug_classes.get(specaug) + specaug = specaug_class(**specaug_conf) + encoder_class = tables.encoder_classes.get(encoder) + encoder = encoder_class(**encoder_conf) + lid_predictor_class = tables.lid_predictor_classes.get(lid_predictor) + lid_predictor = lid_predictor_class(**lid_predictor_conf) + if encoder.output_size() != proj_dim: + self.proj_layer = torch.nn.Linear(encoder.output_size(), proj_dim) + else: + self.proj_layer = None + self.output_layer = torch.nn.Linear(lid_predictor.output_size(), vocab_size) + self.criterion_lid = LabelSmoothingLoss( + size=vocab_size, + padding_idx=-1, + smoothing=0.0, + normalize_length=False, + ) + + self.specaug = specaug + self.encoder = encoder + self.lid_predictor = lid_predictor + self.clip_frames = clip_frames + self.random_clip = random_clip + self.normalize = None + self.beam_search = None + if not hasattr(self.encoder, "interctc_use_conditioning"): + self.encoder.interctc_use_conditioning = False + + def forward( + self, + speech: torch.Tensor, # may be padding + speech_lengths: torch.Tensor, # actual length + lid: torch.Tensor, # lid label, (batch_size, 1) + lid_lengths: torch.Tensor, + ): + assert lid.shape[1] == 1 + batch_size = speech.shape[0] + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + + # re-generate encoder_out + if self.clip_frames is None: + reduced_encoder_out = ( + torch.zeros(batch_size, encoder_out_lens.max(), encoder_out.shape[-1]) + .to(encoder_out.dtype) + .to(encoder_out.device) + ) + for i, enc_length in enumerate(encoder_out_lens): + reduced_encoder_out[i, :enc_length] = encoder_out[i, :enc_length] + else: + reduced_encoder_out = ( + torch.zeros(batch_size, self.clip_frames, encoder_out.shape[-1]) + .to(encoder_out.dtype) + .to(encoder_out.device) + ) + if self.random_clip: + for i, enc_length in enumerate(encoder_out_lens): + if enc_length <= self.clip_frames: + reduced_encoder_out[i, :enc_length] = encoder_out[i, :enc_length] + encoder_out_lens[i] = enc_length + else: + max_start_index = enc_length.item() - self.clip_frames + start_index = np.random.randint(0, max_start_index + 1) + reduced_encoder_out[i, : self.clip_frames] = encoder_out[ + i, start_index : start_index + self.clip_frames + ] + encoder_out_lens[i] = self.clip_frames + else: + for i, enc_length in enumerate(encoder_out_lens): + enc_length = self.clip_frames if enc_length >= self.clip_frames else enc_length + reduced_encoder_out[i, :enc_length] = encoder_out[i, :enc_length] + encoder_out_lens[i] = enc_length + if self.proj_layer is not None: + reduced_encoder_out = self.proj_layer(reduced_encoder_out) + lid_output = self.lid_predictor(reduced_encoder_out, encoder_out_lens) # (B, D) + lid_logits = self.output_layer(lid_output) # (B, num_classes) + loss = self.criterion_lid(lid_logits[:, None, :], lid) + with torch.no_grad(): + _, predicted_lid = torch.max(lid_logits, 1) + correct = (predicted_lid == lid[:, 0]).sum().item() + lid_acc = correct * 1.0 / lid_logits.shape[0] + stats = dict() + stats["batch_size"] = batch_size + stats["loss"] = torch.clone(loss.detach()) + stats["acc"] = lid_acc + stats["token_length"] = speech_lengths.max() + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def encode( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + with autocast(False): + + # Data augmentation + if self.specaug is not None and self.training: + speech = speech.permute(0, 2, 1) + # suit for whisper padding + padded_speech_lengths = torch.ones_like(speech_lengths) * speech.shape[1] + speech, padded_speech_lengths = self.specaug(speech, padded_speech_lengths) + speech = speech.permute(0, 2, 1) + + # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + speech, speech_lengths = self.normalize(speech, speech_lengths) + + # Forward encoder + # feats: (Batch, Length, Dim) + # -> encoder_out: (Batch, Length2, Dim2) + if self.encoder.interctc_use_conditioning: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths, ctc=self.ctc) + else: + encoder_out, encoder_out_lens, _ = self.encoder(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + if intermediate_outs is not None: + return (encoder_out, intermediate_outs), encoder_out_lens + + return encoder_out, encoder_out_lens + + def inference( + self, + data_in, + data_lengths=None, + key: list = None, + tokenizer=None, + frontend=None, + **kwargs, + ): + + if kwargs.get("batch_size", 1) > 1: + raise NotImplementedError("batch decoding is not implemented") + + meta_data = {} + if ( + isinstance(data_in, torch.Tensor) and kwargs.get("data_type", "sound") == "fbank" + ): # fbank + speech, speech_lengths = data_in, data_lengths + if len(speech.shape) < 3: + speech = speech[None, :, :] + if speech_lengths is None: + speech_lengths = speech.shape[1] + else: + # extract fbank feats + time1 = time.perf_counter() + audio_sample_list = load_audio_text_image_video( + data_in, + fs=frontend.fs, + audio_fs=kwargs.get("fs", 16000), + data_type=kwargs.get("data_type", "sound"), + tokenizer=tokenizer, + ) + time2 = time.perf_counter() + meta_data["load_data"] = f"{time2 - time1:0.3f}" + speech, speech_lengths = extract_fbank( + audio_sample_list, data_type=kwargs.get("data_type", "sound"), frontend=frontend + ) + time3 = time.perf_counter() + meta_data["extract_feat"] = f"{time3 - time2:0.3f}" + meta_data["batch_data_time"] = ( + speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 + ) + + speech = speech.to(device=kwargs["device"]) + speech_lengths = speech_lengths.to(device=kwargs["device"]) + # Encoder + enc, enc_out_lens = self.encode(speech, speech_lengths) + + inference_clip_length = kwargs.get("inference_clip_length", None) + if self.clip_frames is not None: + if inference_clip_length is None: + reduced_enc = ( + torch.zeros(enc.shape[0], self.clip_frames, enc.shape[-1]) + .to(enc.dtype) + .to(enc.device) + ) + for i, enc_length in enumerate(enc_out_lens): + enc_length = self.clip_frames if enc_length >= self.clip_frames else enc_length + reduced_enc[i, :enc_length] = enc[i, :enc_length] + enc_out_lens[i] = enc_length + else: + assert inference_clip_length > 0, "inference_clip_length must be larger than 0" + reduced_enc = ( + torch.zeros(enc.shape[0], inference_clip_length, enc.shape[-1]) + .to(enc.dtype) + .to(enc.device) + ) + for i, enc_length in enumerate(enc_out_lens): + enc_length = ( + inference_clip_length if enc_length >= inference_clip_length else enc_length + ) + reduced_enc[i, :enc_length] = enc[i, :enc_length] + enc_out_lens[i] = enc_length + else: + reduced_enc = ( + torch.zeros(enc.shape[0], enc_out_lens.max(), enc.shape[-1]) + .to(enc.dtype) + .to(enc.device) + ) + for i, enc_length in enumerate(enc_out_lens): + reduced_enc[i, :enc_length] = enc[i, :enc_length] + + if self.proj_layer is not None: + reduced_enc = self.proj_layer(reduced_enc) + lid_output = self.lid_predictor(reduced_enc, enc_out_lens) # (B, D) + lid_logits = self.output_layer(lid_output) # (B, num_classes) + + _, predicted_lid_index = torch.max(lid_logits, 1) + predicted_lid = tokenizer.ids2tokens([predicted_lid_index[0].cpu()])[0] + + if kwargs.get("output_dir") is not None: + if not hasattr(self, "writer"): + self.writer = DatadirWriter(kwargs.get("output_dir")) + lid_writer = self.writer["lid"] + lid_writer[key[0]] = predicted_lid + + results = [{"key": key[0], "lid": predicted_lid}] + + return results, meta_data diff --git a/funasr/models/xvector/__init__.py b/funasr/models/xvector/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/models/xvector/e2e_sv.py b/funasr/models/xvector/e2e_sv.py new file mode 100644 index 0000000..56c9e3b --- /dev/null +++ b/funasr/models/xvector/e2e_sv.py @@ -0,0 +1,263 @@ +""" +Author: Speech Lab, Alibaba Group, China +""" + +import logging +from contextlib import contextmanager +from distutils.version import LooseVersion +from typing import Dict +from typing import List +from typing import Optional +from typing import Tuple +from typing import Union + +import torch + +from funasr.layers.abs_normalize import AbsNormalize +from funasr.losses.label_smoothing_loss import ( + LabelSmoothingLoss, # noqa: H301 +) +from funasr.models.ctc import CTC +from funasr.models.decoder.abs_decoder import AbsDecoder +from funasr.models.encoder.abs_encoder import AbsEncoder +from funasr.frontends.abs_frontend import AbsFrontend +from funasr.models.postencoder.abs_postencoder import AbsPostEncoder +from funasr.models.preencoder.abs_preencoder import AbsPreEncoder +from funasr.models.specaug.abs_specaug import AbsSpecAug +from funasr.models.transformer.utils.add_sos_eos import add_sos_eos +from funasr.metrics import ErrorCalculator +from funasr.metrics.compute_acc import th_accuracy +from funasr.train_utils.device_funcs import force_gatherable +from funasr.models.base_model import FunASRModel + +if LooseVersion(torch.__version__) >= LooseVersion("1.6.0"): + from torch.cuda.amp import autocast +else: + # Nothing to do if torch<1.6.0 + @contextmanager + def autocast(enabled=True): + yield + + +class ESPnetSVModel(FunASRModel): + """CTC-attention hybrid Encoder-Decoder model""" + + def __init__( + self, + vocab_size: int, + token_list: Union[Tuple[str, ...], List[str]], + frontend: Optional[AbsFrontend], + specaug: Optional[AbsSpecAug], + normalize: Optional[AbsNormalize], + preencoder: Optional[AbsPreEncoder], + encoder: AbsEncoder, + postencoder: Optional[AbsPostEncoder], + pooling_layer: torch.nn.Module, + decoder: AbsDecoder, + ): + + super().__init__() + # note that eos is the same as sos (equivalent ID) + self.vocab_size = vocab_size + self.token_list = token_list.copy() + + self.frontend = frontend + self.specaug = specaug + self.normalize = normalize + self.preencoder = preencoder + self.postencoder = postencoder + self.encoder = encoder + self.pooling_layer = pooling_layer + self.decoder = decoder + + def forward( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: + """Frontend + Encoder + Decoder + Calc loss + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + text: (Batch, Length) + text_lengths: (Batch,) + """ + assert text_lengths.dim() == 1, text_lengths.shape + # Check that batch_size is unified + assert ( + speech.shape[0] == speech_lengths.shape[0] == text.shape[0] == text_lengths.shape[0] + ), (speech.shape, speech_lengths.shape, text.shape, text_lengths.shape) + batch_size = speech.shape[0] + + # for data-parallel + text = text[:, : text_lengths.max()] + + # 1. Encoder + encoder_out, encoder_out_lens = self.encode(speech, speech_lengths) + intermediate_outs = None + if isinstance(encoder_out, tuple): + intermediate_outs = encoder_out[1] + encoder_out = encoder_out[0] + + loss_att, acc_att, cer_att, wer_att = None, None, None, None + loss_ctc, cer_ctc = None, None + loss_transducer, cer_transducer, wer_transducer = None, None, None + stats = dict() + + # 1. CTC branch + if self.ctc_weight != 0.0: + loss_ctc, cer_ctc = self._calc_ctc_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # Collect CTC branch stats + stats["loss_ctc"] = loss_ctc.detach() if loss_ctc is not None else None + stats["cer_ctc"] = cer_ctc + + # Intermediate CTC (optional) + loss_interctc = 0.0 + if self.interctc_weight != 0.0 and intermediate_outs is not None: + for layer_idx, intermediate_out in intermediate_outs: + # we assume intermediate_out has the same length & padding + # as those of encoder_out + loss_ic, cer_ic = self._calc_ctc_loss( + intermediate_out, encoder_out_lens, text, text_lengths + ) + loss_interctc = loss_interctc + loss_ic + + # Collect Intermedaite CTC stats + stats["loss_interctc_layer{}".format(layer_idx)] = ( + loss_ic.detach() if loss_ic is not None else None + ) + stats["cer_interctc_layer{}".format(layer_idx)] = cer_ic + + loss_interctc = loss_interctc / len(intermediate_outs) + + # calculate whole encoder loss + loss_ctc = (1 - self.interctc_weight) * loss_ctc + self.interctc_weight * loss_interctc + + if self.use_transducer_decoder: + # 2a. Transducer decoder branch + ( + loss_transducer, + cer_transducer, + wer_transducer, + ) = self._calc_transducer_loss( + encoder_out, + encoder_out_lens, + text, + ) + + if loss_ctc is not None: + loss = loss_transducer + (self.ctc_weight * loss_ctc) + else: + loss = loss_transducer + + # Collect Transducer branch stats + stats["loss_transducer"] = ( + loss_transducer.detach() if loss_transducer is not None else None + ) + stats["cer_transducer"] = cer_transducer + stats["wer_transducer"] = wer_transducer + + else: + # 2b. Attention decoder branch + if self.ctc_weight != 1.0: + loss_att, acc_att, cer_att, wer_att = self._calc_att_loss( + encoder_out, encoder_out_lens, text, text_lengths + ) + + # 3. CTC-Att loss definition + if self.ctc_weight == 0.0: + loss = loss_att + elif self.ctc_weight == 1.0: + loss = loss_ctc + else: + loss = self.ctc_weight * loss_ctc + (1 - self.ctc_weight) * loss_att + + # Collect Attn branch stats + stats["loss_att"] = loss_att.detach() if loss_att is not None else None + stats["acc"] = acc_att + stats["cer"] = cer_att + stats["wer"] = wer_att + + # Collect total loss stats + stats["loss"] = torch.clone(loss.detach()) + + # force_gatherable: to-device and to-tensor if scalar for DataParallel + loss, stats, weight = force_gatherable((loss, stats, batch_size), loss.device) + return loss, stats, weight + + def collect_feats( + self, + speech: torch.Tensor, + speech_lengths: torch.Tensor, + text: torch.Tensor, + text_lengths: torch.Tensor, + ) -> Dict[str, torch.Tensor]: + if self.extract_feats_in_collect_stats: + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + else: + # Generate dummy stats if extract_feats_in_collect_stats is False + logging.warning( + "Generating dummy stats for feats and feats_lengths, " + "because encoder_conf.extract_feats_in_collect_stats is " + f"{self.extract_feats_in_collect_stats}" + ) + feats, feats_lengths = speech, speech_lengths + return {"feats": feats, "feats_lengths": feats_lengths} + + def encode( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Frontend + Encoder. Note that this method is used by asr_inference.py + Args: + speech: (Batch, Length, ...) + speech_lengths: (Batch, ) + """ + with autocast(False): + # 1. Extract feats + feats, feats_lengths = self._extract_feats(speech, speech_lengths) + + # 2. Data augmentation + if self.specaug is not None and self.training: + feats, feats_lengths = self.specaug(feats, feats_lengths) + + # 3. Normalization for feature: e.g. Global-CMVN, Utterance-CMVN + if self.normalize is not None: + feats, feats_lengths = self.normalize(feats, feats_lengths) + + # Pre-encoder, e.g. used for raw input data + if self.preencoder is not None: + feats, feats_lengths = self.preencoder(feats, feats_lengths) + + # 4. Forward encoder + # feats: (Batch, Length, Dim) -> (Batch, Channel, Length2, Dim2) + encoder_out, encoder_out_lens = self.encoder(feats, feats_lengths) + + # Post-encoder, e.g. NLU + if self.postencoder is not None: + encoder_out, encoder_out_lens = self.postencoder(encoder_out, encoder_out_lens) + + return encoder_out, encoder_out_lens + + def _extract_feats( + self, speech: torch.Tensor, speech_lengths: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + assert speech_lengths.dim() == 1, speech_lengths.shape + + # for data-parallel + speech = speech[:, : speech_lengths.max()] + + if self.frontend is not None: + # Frontend + # e.g. STFT and Feature extract + # data_loader may send time-domain signal in this case + # speech (Batch, NSamples) -> feats: (Batch, NFrames, Dim) + feats, feats_lengths = self.frontend(speech, speech_lengths) + else: + # No frontend and no feature extract + feats, feats_lengths = speech, speech_lengths + return feats, feats_lengths diff --git a/funasr/optimizers/__init__.py b/funasr/optimizers/__init__.py new file mode 100644 index 0000000..66e2e9d --- /dev/null +++ b/funasr/optimizers/__init__.py @@ -0,0 +1,17 @@ +import torch +from funasr.optimizers.fairseq_adam import FairseqAdam +from funasr.optimizers.sgd import SGD + +optim_classes = dict( + adam=torch.optim.Adam, + fairseq_adam=FairseqAdam, + adamw=torch.optim.AdamW, + sgd=SGD, + adadelta=torch.optim.Adadelta, + adagrad=torch.optim.Adagrad, + adamax=torch.optim.Adamax, + asgd=torch.optim.ASGD, + lbfgs=torch.optim.LBFGS, + rmsprop=torch.optim.RMSprop, + rprop=torch.optim.Rprop, +) diff --git a/funasr/optimizers/fairseq_adam.py b/funasr/optimizers/fairseq_adam.py new file mode 100644 index 0000000..32fae6a --- /dev/null +++ b/funasr/optimizers/fairseq_adam.py @@ -0,0 +1,144 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + + +import math + +import torch +import torch.optim + + +class FairseqAdam(torch.optim.Optimizer): + r"""Implements Adam algorithm. + + This implementation is modified from torch.optim.Adam based on: + `Fixed Weight Decay Regularization in Adam` + (see https://arxiv.org/abs/1711.05101) + + It has been proposed in `Adam: A Method for Stochastic Optimization`_. + + Args: + params (iterable): iterable of parameters to optimize or dicts defining + parameter groups + lr (float, optional): learning rate (default: 1e-3) + betas (Tuple[float, float], optional): coefficients used for computing + running averages of gradient and its square (default: (0.9, 0.999)) + eps (float, optional): term added to the denominator to improve + numerical stability (default: 1e-8) + weight_decay (float, optional): weight decay (L2 penalty) (default: 0) + amsgrad (boolean, optional): whether to use the AMSGrad variant of this + algorithm from the paper `On the Convergence of Adam and Beyond`_ + + .. _Adam\: A Method for Stochastic Optimization: + https://arxiv.org/abs/1412.6980 + .. _On the Convergence of Adam and Beyond: + https://openreview.net/forum?id=ryQu7f-RZ + """ + + def __init__( + self, + params, + lr=1e-3, + adam_betas=(0.9, 0.999), + adam_eps=1e-8, + weight_decay=0, + amsgrad=False, + ): + defaults = dict( + lr=lr, betas=adam_betas, eps=adam_eps, weight_decay=weight_decay, amsgrad=amsgrad + ) + super(FairseqAdam, self).__init__(params, defaults) + self.optimizer_lr = lr + + @property + def supports_memory_efficient_fp16(self): + return True + + @property + def supports_flat_params(self): + return True + + def step(self, closure=None): + """Performs a single optimization step. + + Args: + closure (callable, optional): A closure that reevaluates the model + and returns the loss. + """ + loss = None + if closure is not None: + loss = closure() + + for group in self.param_groups: + for p in group["params"]: + if p.grad is None: + continue + grad = p.grad.data + if grad.dtype in {torch.float16, torch.bfloat16}: + grad = grad.float() + if grad.is_sparse: + raise RuntimeError( + "Adam does not support sparse gradients, please consider SparseAdam instead" + ) + amsgrad = group.get("amsgrad", False) + + p_data_fp32 = p.data + if p.data.dtype in {torch.float16, torch.bfloat16}: + p_data_fp32 = p_data_fp32.float() + + state = self.state[p] + + # State initialization + if len(state) == 0: + state["step"] = 0 + # Exponential moving average of gradient values + state["exp_avg"] = torch.zeros_like(p_data_fp32) + # Exponential moving average of squared gradient values + state["exp_avg_sq"] = torch.zeros_like(p_data_fp32) + if amsgrad: + # Maintains max of all exp. moving avg. of sq. grad. values + state["max_exp_avg_sq"] = torch.zeros_like(p_data_fp32) + else: + state["exp_avg"] = state["exp_avg"].to(p_data_fp32) + state["exp_avg_sq"] = state["exp_avg_sq"].to(p_data_fp32) + if amsgrad: + state["max_exp_avg_sq"] = state["max_exp_avg_sq"].to(p_data_fp32) + + exp_avg, exp_avg_sq = state["exp_avg"], state["exp_avg_sq"] + if amsgrad: + max_exp_avg_sq = state["max_exp_avg_sq"] + beta1, beta2 = group["betas"] + + state["step"] += 1 + + # Decay the first and second moment running average coefficient + exp_avg.mul_(beta1).add_(grad, alpha=1 - beta1) + exp_avg_sq.mul_(beta2).addcmul_(grad, grad, value=1 - beta2) + if amsgrad: + # Maintains the maximum of all 2nd moment running avg. till now + torch.max(max_exp_avg_sq, exp_avg_sq, out=max_exp_avg_sq) + # Use the max. for normalizing running avg. of gradient + denom = max_exp_avg_sq.sqrt().add_(group["eps"]) + else: + denom = exp_avg_sq.sqrt().add_(group["eps"]) + + bias_correction1 = 1 - beta1 ** state["step"] + bias_correction2 = 1 - beta2 ** state["step"] + step_size = group["lr"] * math.sqrt(bias_correction2) / bias_correction1 + + if group["weight_decay"] != 0: + p_data_fp32.add_(p_data_fp32, alpha=-group["weight_decay"] * group["lr"]) + + p_data_fp32.addcdiv_(exp_avg, denom, value=-step_size) + + if p.data.dtype in {torch.float16, torch.bfloat16}: + p.data.copy_(p_data_fp32) + + return loss + + def set_lr(self, lr): + """Set the learning rate.""" + for param_group in self.param_groups: + param_group["lr"] = lr diff --git a/funasr/optimizers/sgd.py b/funasr/optimizers/sgd.py new file mode 100644 index 0000000..fb7a3df --- /dev/null +++ b/funasr/optimizers/sgd.py @@ -0,0 +1,30 @@ +import torch + + +class SGD(torch.optim.SGD): + """Thin inheritance of torch.optim.SGD to bind the required arguments, 'lr' + + Note that + the arguments of the optimizer invoked by AbsTask.main() + must have default value except for 'param'. + + I can't understand why only SGD.lr doesn't have the default value. + """ + + def __init__( + self, + params, + lr: float = 0.1, + momentum: float = 0.0, + dampening: float = 0.0, + weight_decay: float = 0.0, + nesterov: bool = False, + ): + super().__init__( + params, + lr=lr, + momentum=momentum, + dampening=dampening, + weight_decay=weight_decay, + nesterov=nesterov, + ) diff --git a/funasr/register.py b/funasr/register.py new file mode 100644 index 0000000..384bc58 --- /dev/null +++ b/funasr/register.py @@ -0,0 +1,91 @@ +import logging +import inspect +from dataclasses import dataclass +import re + + +@dataclass +class RegisterTables: + model_classes = {} + frontend_classes = {} + specaug_classes = {} + normalize_classes = {} + encoder_classes = {} + decoder_classes = {} + joint_network_classes = {} + predictor_classes = {} + stride_conv_classes = {} + tokenizer_classes = {} + dataloader_classes = {} + batch_sampler_classes = {} + dataset_classes = {} + index_ds_classes = {} + + def print(self, key=None): + print("\ntables: \n") + fields = vars(self) + for classes_key, classes_dict in fields.items(): + + flag = True + if key is not None: + flag = key in classes_key + if classes_key.endswith("_meta") and flag: + print(f"----------- ** {classes_key.replace('_meta', '')} ** --------------") + headers = ["register name", "class name", "class location"] + metas = [] + for register_key, meta in classes_dict.items(): + metas.append(meta) + metas.sort(key=lambda x: x[0]) + data = [headers] + metas + col_widths = [max(len(str(item)) for item in col) for col in zip(*data)] + + for row in data: + print( + "| " + + " | ".join(str(item).ljust(width) for item, width in zip(row, col_widths)) + + " |" + ) + print("\n") + + def register(self, register_tables_key: str, key=None): + def decorator(target_class): + + if not hasattr(self, register_tables_key): + setattr(self, register_tables_key, {}) + logging.info("new registry table has been added: {}".format(register_tables_key)) + + registry = getattr(self, register_tables_key) + registry_key = key if key is not None else target_class.__name__ + + # assert not registry_key in registry, "(key: {} / class: {}) has been registered already,in {}".format( + # registry_key, target_class, register_tables_key) + + registry[registry_key] = target_class + + # meta, headers = ["class name", "register name", "class location"] + register_tables_key_meta = register_tables_key + "_meta" + if not hasattr(self, register_tables_key_meta): + setattr(self, register_tables_key_meta, {}) + registry_meta = getattr(self, register_tables_key_meta) + # doc = target_class.__doc__ + class_file = inspect.getfile(target_class) + class_line = inspect.getsourcelines(target_class)[1] + pattern = r"^.+/funasr/" + class_file = re.sub(pattern, "funasr/", class_file) + # meata_data = [f"{target_class.__name__}", f"{class_file}:{class_line}"] + meata_data = [ + f"{registry_key}", + f"{target_class.__name__}", + f"{class_file}:{class_line}", + ] + registry_meta[registry_key] = meata_data + # print(f"Registering class: {class_file}:{class_line} - {target_class.__name__} as {registry_key}") + return target_class + + return decorator + + +tables = RegisterTables() + + +import funasr diff --git a/funasr/schedulers/__init__.py b/funasr/schedulers/__init__.py new file mode 100644 index 0000000..39f8c0e --- /dev/null +++ b/funasr/schedulers/__init__.py @@ -0,0 +1,25 @@ +import torch +import torch.multiprocessing +import torch.nn +import torch.optim + +from funasr.schedulers.noam_lr import NoamLR +from funasr.schedulers.tri_stage_scheduler import TriStageLR +from funasr.schedulers.warmup_lr import WarmupLR +from funasr.schedulers.lambdalr_cus import CustomLambdaLR + +scheduler_classes = dict( + ReduceLROnPlateau=torch.optim.lr_scheduler.ReduceLROnPlateau, + lambdalr=torch.optim.lr_scheduler.LambdaLR, + steplr=torch.optim.lr_scheduler.StepLR, + multisteplr=torch.optim.lr_scheduler.MultiStepLR, + exponentiallr=torch.optim.lr_scheduler.ExponentialLR, + CosineAnnealingLR=torch.optim.lr_scheduler.CosineAnnealingLR, + noamlr=NoamLR, + warmuplr=WarmupLR, + tri_stage=TriStageLR, + cycliclr=torch.optim.lr_scheduler.CyclicLR, + onecyclelr=torch.optim.lr_scheduler.OneCycleLR, + CosineAnnealingWarmRestarts=torch.optim.lr_scheduler.CosineAnnealingWarmRestarts, + custom_lambdalr=CustomLambdaLR, +) diff --git a/funasr/schedulers/abs_scheduler.py b/funasr/schedulers/abs_scheduler.py new file mode 100644 index 0000000..7395f25 --- /dev/null +++ b/funasr/schedulers/abs_scheduler.py @@ -0,0 +1,84 @@ +from abc import ABC +from abc import abstractmethod + +import torch.optim.lr_scheduler as L + + +class AbsScheduler(ABC): + @abstractmethod + def step(self, epoch: int = None): + pass + + @abstractmethod + def state_dict(self): + pass + + @abstractmethod + def load_state_dict(self, state): + pass + + +# If you need to define custom scheduler, please inherit these classes +class AbsBatchStepScheduler(AbsScheduler): + @abstractmethod + def step(self, epoch: int = None): + pass + + @abstractmethod + def state_dict(self): + pass + + @abstractmethod + def load_state_dict(self, state): + pass + + +class AbsEpochStepScheduler(AbsScheduler): + @abstractmethod + def step(self, epoch: int = None): + pass + + @abstractmethod + def state_dict(self): + pass + + @abstractmethod + def load_state_dict(self, state): + pass + + +class AbsValEpochStepScheduler(AbsEpochStepScheduler): + @abstractmethod + def step(self, val, epoch: int = None): + pass + + @abstractmethod + def state_dict(self): + pass + + @abstractmethod + def load_state_dict(self, state): + pass + + +# Create alias type to check the type +# Note(kamo): Currently PyTorch doesn't provide the base class +# to judge these classes. +AbsValEpochStepScheduler.register(L.ReduceLROnPlateau) +for s in [ + L.ReduceLROnPlateau, + L.LambdaLR, + L.StepLR, + L.MultiStepLR, + L.MultiStepLR, + L.ExponentialLR, + L.CosineAnnealingLR, +]: + AbsEpochStepScheduler.register(s) + +AbsBatchStepScheduler.register(L.CyclicLR) +for s in [ + L.OneCycleLR, + L.CosineAnnealingWarmRestarts, +]: + AbsBatchStepScheduler.register(s) diff --git a/funasr/schedulers/lambdalr_cus.py b/funasr/schedulers/lambdalr_cus.py new file mode 100644 index 0000000..e3bb1fb --- /dev/null +++ b/funasr/schedulers/lambdalr_cus.py @@ -0,0 +1,41 @@ +import torch +from torch.optim.lr_scheduler import _LRScheduler + + +# class CustomLambdaLR(_LRScheduler): +# def __init__(self, optimizer, warmup_steps, last_epoch=-1): +# self.warmup_steps = warmup_steps +# super().__init__(optimizer, last_epoch) +# +# def get_lr(self): +# if self.last_epoch < self.warmup_steps: +# return [ +# base_lr * min(self.last_epoch / self.warmup_steps, 1) for base_lr in self.base_lrs +# ] +# else: +# return [base_lr for base_lr in self.base_lrs] + + +class CustomLambdaLR(_LRScheduler): + def __init__( + self, + optimizer, + warmup_steps: int = 25000, + total_steps: int = 500000, + last_epoch=-1, + verbose=False, + ): + self.warmup_steps = warmup_steps + self.total_steps = total_steps + super().__init__(optimizer, last_epoch, verbose) + + def get_lr(self): + + step = self.last_epoch + 1 + if step < self.warmup_steps: + lr_scale = step / self.warmup_steps + else: + lr_scale = max( + 0.0, 1 - (step - self.warmup_steps) / (self.total_steps - self.warmup_steps) + ) + return [base_lr * lr_scale for base_lr in self.base_lrs] diff --git a/funasr/schedulers/noam_lr.py b/funasr/schedulers/noam_lr.py new file mode 100644 index 0000000..b33b4bd --- /dev/null +++ b/funasr/schedulers/noam_lr.py @@ -0,0 +1,62 @@ +"""Noam learning rate scheduler module.""" + +from typing import Union +import warnings + +import torch +from torch.optim.lr_scheduler import _LRScheduler + +from funasr.schedulers.abs_scheduler import AbsBatchStepScheduler + + +class NoamLR(_LRScheduler, AbsBatchStepScheduler): + """The LR scheduler proposed by Noam + + Ref: + "Attention Is All You Need", https://arxiv.org/pdf/1706.03762.pdf + + FIXME(kamo): PyTorch doesn't provide _LRScheduler as public class, + thus the behaviour isn't guaranteed at forward PyTorch version. + + NOTE(kamo): The "model_size" in original implementation is derived from + the model, but in this implementation, this parameter is a constant value. + You need to change it if the model is changed. + + """ + + def __init__( + self, + optimizer: torch.optim.Optimizer, + model_size: Union[int, float] = 320, + warmup_steps: Union[int, float] = 25000, + last_epoch: int = -1, + ): + self.model_size = model_size + self.warmup_steps = warmup_steps + + lr = list(optimizer.param_groups)[0]["lr"] + new_lr = self.lr_for_WarmupLR(lr) + warnings.warn( + f"NoamLR is deprecated. " + f"Use WarmupLR(warmup_steps={warmup_steps}) with Optimizer(lr={new_lr})", + ) + + # __init__() must be invoked before setting field + # because step() is also invoked in __init__() + super().__init__(optimizer, last_epoch) + + def lr_for_WarmupLR(self, lr: float) -> float: + return lr / self.model_size**0.5 / self.warmup_steps**0.5 + + def __repr__(self): + return ( + f"{self.__class__.__name__}(model_size={self.model_size}, " + f"warmup_steps={self.warmup_steps})" + ) + + def get_lr(self): + step_num = self.last_epoch + 1 + return [ + lr * self.model_size**-0.5 * min(step_num**-0.5, step_num * self.warmup_steps**-1.5) + for lr in self.base_lrs + ] diff --git a/funasr/schedulers/tri_stage_scheduler.py b/funasr/schedulers/tri_stage_scheduler.py new file mode 100644 index 0000000..7fc13b2 --- /dev/null +++ b/funasr/schedulers/tri_stage_scheduler.py @@ -0,0 +1,104 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import math +from typing import Optional, List + +import torch +from torch.optim.lr_scheduler import _LRScheduler + +from funasr.schedulers.abs_scheduler import AbsBatchStepScheduler + + +class TriStageLR(_LRScheduler, AbsBatchStepScheduler): + def __init__( + self, + optimizer: torch.optim.Optimizer, + last_epoch: int = -1, + phase_ratio: Optional[List[float]] = None, + init_lr_scale: float = 0.01, + final_lr_scale: float = 0.01, + ): + self.optimizer = optimizer + self.last_epoch = last_epoch + self.phase_ratio = phase_ratio + self.init_lr_scale = init_lr_scale + self.final_lr_scale = final_lr_scale + self.optimizer_lr = self.optimizer.defaults["lr"] + + def init_tri_stage_scheudler(self, max_update): + self.max_update = max_update + self.peak_lr = self.optimizer_lr + self.init_lr = self.init_lr_scale * self.optimizer_lr + self.final_lr = self.final_lr_scale * self.optimizer_lr + + assert self.max_update > 0 + assert sum(self.phase_ratio) == 1, "phase ratios must add up to 1" + assert len(self.phase_ratio) == 3 + self.warmup_steps = int(self.max_update * self.phase_ratio[0]) + self.hold_steps = int(self.max_update * self.phase_ratio[1]) + self.decay_steps = int(self.max_update * self.phase_ratio[2]) + + self.warmup_rate = ( + (self.peak_lr - self.init_lr) / self.warmup_steps if self.warmup_steps != 0 else 0 + ) + self.decay_factor = -math.log(self.final_lr_scale) / self.decay_steps + + # initial learning rate + self.lr = self.init_lr + + # __init__() must be invoked before setting field + # because step() is also invoked in __init__() + self.set_optimizer_lr(self.lr) + super().__init__(self.optimizer, self.last_epoch) + + def _decide_stage(self, update_step): + """ + return stage, and the corresponding steps within the current stage + """ + if update_step < self.warmup_steps: + # warmup state + return 0, update_step + + offset = self.warmup_steps + + if update_step < offset + self.hold_steps: + # hold stage + return 1, update_step - offset + + offset += self.hold_steps + + if update_step <= offset + self.decay_steps: + # decay stage + return 2, update_step - offset + + offset += self.decay_steps + + # still here ? constant lr stage + return 3, update_step - offset + + def step_update(self, num_updates): + """Update the learning rate after each update.""" + stage, steps_in_stage = self._decide_stage(num_updates) + if stage == 0: + self.lr = self.init_lr + self.warmup_rate * steps_in_stage + elif stage == 1: + self.lr = self.peak_lr + elif stage == 2: + self.lr = self.peak_lr * math.exp(-self.decay_factor * steps_in_stage) + elif stage == 3: + self.lr = self.final_lr + else: + raise ValueError("Undefined stage") + self.set_optimizer_lr(self.lr) + + def set_optimizer_lr(self, lr): + for param_group in self.optimizer.param_groups: + param_group["lr"] = lr + + def get_lr(self): + step_num = self.last_epoch + 1 + self.step_update(step_num) + return [self.lr] diff --git a/funasr/schedulers/warmup_lr.py b/funasr/schedulers/warmup_lr.py new file mode 100644 index 0000000..847b53a --- /dev/null +++ b/funasr/schedulers/warmup_lr.py @@ -0,0 +1,47 @@ +"""Warm up learning rate scheduler module.""" + +from typing import Union + +import torch +from torch.optim.lr_scheduler import _LRScheduler + +from funasr.schedulers.abs_scheduler import AbsBatchStepScheduler + + +class WarmupLR(_LRScheduler, AbsBatchStepScheduler): + """The WarmupLR scheduler + + This scheduler is almost same as NoamLR Scheduler except for following difference: + + NoamLR: + lr = optimizer.lr * model_size ** -0.5 + * min(step ** -0.5, step * warmup_step ** -1.5) + WarmupLR: + lr = optimizer.lr * warmup_step ** 0.5 + * min(step ** -0.5, step * warmup_step ** -1.5) + + Note that the maximum lr equals to optimizer.lr in this scheduler. + + """ + + def __init__( + self, + optimizer: torch.optim.Optimizer, + warmup_steps: Union[int, float] = 25000, + last_epoch: int = -1, + ): + self.warmup_steps = warmup_steps + + # __init__() must be invoked before setting field + # because step() is also invoked in __init__() + super().__init__(optimizer, last_epoch) + + def __repr__(self): + return f"{self.__class__.__name__}(warmup_steps={self.warmup_steps})" + + def get_lr(self): + step_num = self.last_epoch + 1 + return [ + lr * self.warmup_steps**0.5 * min(step_num**-0.5, step_num * self.warmup_steps**-1.5) + for lr in self.base_lrs + ] diff --git a/funasr/tokenizer/__init__.py b/funasr/tokenizer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/tokenizer/abs_tokenizer.py b/funasr/tokenizer/abs_tokenizer.py new file mode 100644 index 0000000..e125d29 --- /dev/null +++ b/funasr/tokenizer/abs_tokenizer.py @@ -0,0 +1,93 @@ +import json +import numpy as np +from abc import ABC +from pathlib import Path +from abc import abstractmethod +from typing import Union, Iterable, List, Dict + + +class AbsTokenizer(ABC): + @abstractmethod + def text2tokens(self, line: str) -> List[str]: + raise NotImplementedError + + @abstractmethod + def tokens2text(self, tokens: Iterable[str]) -> str: + raise NotImplementedError + + +class BaseTokenizer(ABC): + def __init__( + self, + token_list: Union[Path, str, Iterable[str]] = None, + unk_symbol: str = "", + **kwargs, + ): + + if token_list is not None: + if isinstance(token_list, (Path, str)) and token_list.endswith(".txt"): + token_list = Path(token_list) + self.token_list_repr = str(token_list) + self.token_list: List[str] = [] + + with token_list.open("r", encoding="utf-8") as f: + for idx, line in enumerate(f): + line = line.rstrip() + self.token_list.append(line) + elif isinstance(token_list, (Path, str)) and token_list.endswith(".json"): + token_list = Path(token_list) + self.token_list_repr = str(token_list) + self.token_list: List[str] = [] + + with open(token_list, "r", encoding="utf-8") as f: + self.token_list = json.load(f) + + else: + self.token_list: List[str] = list(token_list) + self.token_list_repr = "" + for i, t in enumerate(self.token_list): + if i == 3: + break + self.token_list_repr += f"{t}, " + self.token_list_repr += f"... (NVocab={(len(self.token_list))})" + + self.token2id: Dict[str, int] = {} + for i, t in enumerate(self.token_list): + if t in self.token2id: + raise RuntimeError(f'Symbol "{t}" is duplicated') + self.token2id[t] = i + + self.unk_symbol = unk_symbol + if self.unk_symbol not in self.token2id: + raise RuntimeError(f"Unknown symbol '{unk_symbol}' doesn't exist in the token_list") + self.unk_id = self.token2id[self.unk_symbol] + + def encode(self, text, **kwargs): + tokens = self.text2tokens(text) + text_ints = self.tokens2ids(tokens) + + return text_ints + + def decode(self, text_ints): + token = self.ids2tokens(text_ints) + text = self.tokens2text(token) + return text + + def get_num_vocabulary_size(self) -> int: + return len(self.token_list) + + def ids2tokens(self, integers: Union[np.ndarray, Iterable[int]]) -> List[str]: + if isinstance(integers, np.ndarray) and integers.ndim != 1: + raise ValueError(f"Must be 1 dim ndarray, but got {integers.ndim}") + return [self.token_list[i] for i in integers] + + def tokens2ids(self, tokens: Iterable[str]) -> List[int]: + return [self.token2id.get(i, self.unk_id) for i in tokens] + + @abstractmethod + def text2tokens(self, line: str) -> List[str]: + raise NotImplementedError + + @abstractmethod + def tokens2text(self, tokens: Iterable[str]) -> str: + raise NotImplementedError diff --git a/funasr/tokenizer/build_tokenizer.py b/funasr/tokenizer/build_tokenizer.py new file mode 100644 index 0000000..d6080f7 --- /dev/null +++ b/funasr/tokenizer/build_tokenizer.py @@ -0,0 +1,59 @@ +from pathlib import Path +from typing import Iterable +from typing import Union + + +from funasr.tokenizer.abs_tokenizer import AbsTokenizer +from funasr.tokenizer.char_tokenizer import CharTokenizer +from funasr.tokenizer.phoneme_tokenizer import PhonemeTokenizer +from funasr.tokenizer.sentencepiece_tokenizer import SentencepiecesTokenizer +from funasr.tokenizer.word_tokenizer import WordTokenizer + + +def build_tokenizer( + token_type: str, + bpemodel: Union[Path, str, Iterable[str]] = None, + non_linguistic_symbols: Union[Path, str, Iterable[str]] = None, + remove_non_linguistic_symbols: bool = False, + space_symbol: str = "", + delimiter: str = None, + g2p_type: str = None, +) -> AbsTokenizer: + """A helper function to instantiate Tokenizer""" + if token_type == "bpe": + if bpemodel is None: + raise ValueError('bpemodel is required if token_type = "bpe"') + + if remove_non_linguistic_symbols: + raise RuntimeError( + "remove_non_linguistic_symbols is not implemented for token_type=bpe" + ) + return SentencepiecesTokenizer(bpemodel) + + elif token_type == "word": + if remove_non_linguistic_symbols and non_linguistic_symbols is not None: + return WordTokenizer( + delimiter=delimiter, + non_linguistic_symbols=non_linguistic_symbols, + remove_non_linguistic_symbols=True, + ) + else: + return WordTokenizer(delimiter=delimiter) + + elif token_type == "char": + return CharTokenizer( + non_linguistic_symbols=non_linguistic_symbols, + space_symbol=space_symbol, + remove_non_linguistic_symbols=remove_non_linguistic_symbols, + ) + + elif token_type == "phn": + return PhonemeTokenizer( + g2p_type=g2p_type, + non_linguistic_symbols=non_linguistic_symbols, + space_symbol=space_symbol, + remove_non_linguistic_symbols=remove_non_linguistic_symbols, + ) + + else: + raise ValueError(f"token_mode must be one of bpe, word, char or phn: " f"{token_type}") diff --git a/funasr/tokenizer/char_tokenizer.py b/funasr/tokenizer/char_tokenizer.py new file mode 100644 index 0000000..805ecd0 --- /dev/null +++ b/funasr/tokenizer/char_tokenizer.py @@ -0,0 +1,113 @@ +from pathlib import Path +from typing import Iterable +from typing import List +from typing import Union +import warnings +import re + +from funasr.tokenizer.abs_tokenizer import BaseTokenizer +from funasr.register import tables + + +@tables.register("tokenizer_classes", "CharTokenizer") +class CharTokenizer(BaseTokenizer): + def __init__( + self, + non_linguistic_symbols: Union[Path, str, Iterable[str]] = None, + space_symbol: str = "", + remove_non_linguistic_symbols: bool = False, + split_with_space: bool = False, + seg_dict: str = None, + **kwargs, + ): + super().__init__(**kwargs) + self.space_symbol = space_symbol + if non_linguistic_symbols is None: + self.non_linguistic_symbols = set() + elif isinstance(non_linguistic_symbols, (Path, str)): + non_linguistic_symbols = Path(non_linguistic_symbols) + try: + with non_linguistic_symbols.open("r", encoding="utf-8") as f: + self.non_linguistic_symbols = set(line.rstrip() for line in f) + except FileNotFoundError: + warnings.warn(f"{non_linguistic_symbols} doesn't exist.") + self.non_linguistic_symbols = set() + else: + self.non_linguistic_symbols = set(non_linguistic_symbols) + self.remove_non_linguistic_symbols = remove_non_linguistic_symbols + self.split_with_space = split_with_space + self.seg_dict = None + seg_dict = seg_dict if seg_dict is not None else kwargs.get("seg_dict_file", None) + if seg_dict is not None: + self.seg_dict = load_seg_dict(seg_dict) + + def __repr__(self): + return ( + f"{self.__class__.__name__}(" + f'space_symbol="{self.space_symbol}"' + f'non_linguistic_symbols="{self.non_linguistic_symbols}"' + f")" + ) + + def text2tokens(self, line: Union[str, list]) -> List[str]: + + # if self.split_with_space: + + if self.seg_dict is not None: + tokens = line.strip().split(" ") + tokens = seg_tokenize(tokens, self.seg_dict) + else: + tokens = [] + while len(line) != 0: + for w in self.non_linguistic_symbols: + if line.startswith(w): + if not self.remove_non_linguistic_symbols: + tokens.append(line[: len(w)]) + line = line[len(w) :] + break + else: + t = line[0] + if t == " ": + # t = "" + line = line[1:] + continue + tokens.append(t) + line = line[1:] + return tokens + + def tokens2text(self, tokens: Iterable[str]) -> str: + tokens = [t if t != self.space_symbol else " " for t in tokens] + return "".join(tokens) + + +def load_seg_dict(seg_dict_file): + seg_dict = {} + assert isinstance(seg_dict_file, str) + with open(seg_dict_file, "r", encoding="utf8") as f: + lines = f.readlines() + for line in lines: + s = line.strip().split() + key = s[0] + value = s[1:] + seg_dict[key] = " ".join(value) + return seg_dict + + +def seg_tokenize(txt, seg_dict): + # pattern = re.compile(r'^[\u4E00-\u9FA50-9]+$') + pattern = re.compile(r"([\u4E00-\u9FA5A-Za-z0-9])") + out_txt = "" + for word in txt: + word = word.lower() + if word in seg_dict: + out_txt += seg_dict[word] + " " + else: + if pattern.match(word): + for char in word: + if char in seg_dict: + out_txt += seg_dict[char] + " " + else: + out_txt += "" + " " + else: + out_txt += "" + " " + return out_txt.strip().split() diff --git a/funasr/tokenizer/cleaner.py b/funasr/tokenizer/cleaner.py new file mode 100644 index 0000000..882db5c --- /dev/null +++ b/funasr/tokenizer/cleaner.py @@ -0,0 +1,48 @@ +from typing import Collection + +from jaconv import jaconv + +# import tacotron_cleaner.cleaners + +try: + from vietnamese_cleaner import vietnamese_cleaners +except ImportError: + vietnamese_cleaners = None + + +class TextCleaner: + """Text cleaner. + + Examples: + >>> cleaner = TextCleaner("tacotron") + >>> cleaner("(Hello-World); & jr. & dr.") + 'HELLO WORLD, AND JUNIOR AND DOCTOR' + + """ + + def __init__(self, cleaner_types: Collection[str] = None): + + if cleaner_types is None: + self.cleaner_types = [] + elif isinstance(cleaner_types, str): + self.cleaner_types = [cleaner_types] + else: + self.cleaner_types = list(cleaner_types) + + def __call__(self, text: str) -> str: + for t in self.cleaner_types: + if t == "tacotron": + # text = tacotron_cleaner.cleaners.custom_english_cleaners(text) + pass + elif t == "jaconv": + text = jaconv.normalize(text) + elif t == "vietnamese": + if vietnamese_cleaners is None: + raise RuntimeError("Please install underthesea") + text = vietnamese_cleaners.vietnamese_cleaner(text) + elif t == "korean_cleaner": + text = KoreanCleaner.normalize_text(text) + else: + raise RuntimeError(f"Not supported: type={t}") + + return text diff --git a/funasr/tokenizer/hf_tokenizer.py b/funasr/tokenizer/hf_tokenizer.py new file mode 100644 index 0000000..1ac7ae2 --- /dev/null +++ b/funasr/tokenizer/hf_tokenizer.py @@ -0,0 +1,13 @@ +from funasr.register import tables + + +@tables.register("tokenizer_classes", "HuggingfaceTokenizer") +def HuggingfaceTokenizer(init_param_path, **kwargs): + try: + from transformers import AutoTokenizer + except: + # print("If you want to use hugging, please `pip install -U transformers`") + pass + tokenizer = AutoTokenizer.from_pretrained(init_param_path) + + return tokenizer diff --git a/funasr/tokenizer/korean_cleaner.py b/funasr/tokenizer/korean_cleaner.py new file mode 100644 index 0000000..eceebe2 --- /dev/null +++ b/funasr/tokenizer/korean_cleaner.py @@ -0,0 +1,74 @@ +# Referenced from https://github.com/hccho2/Tacotron-Wavenet-Vocoder-Korean + +import re + + +class KoreanCleaner: + @classmethod + def _normalize_numbers(cls, text): + number_to_kor = { + "0": "영", + "1": "일", + "2": "이", + "3": "삼", + "4": "사", + "5": "오", + "6": "육", + "7": "칠", + "8": "팔", + "9": "구", + } + new_text = "".join( + number_to_kor[char] if char in number_to_kor.keys() else char for char in text + ) + return new_text + + @classmethod + def _normalize_english_text(cls, text): + upper_alphabet_to_kor = { + "A": "에이", + "B": "비", + "C": "씨", + "D": "디", + "E": "이", + "F": "에프", + "G": "지", + "H": "에이치", + "I": "아이", + "J": "제이", + "K": "케이", + "L": "엘", + "M": "엠", + "N": "엔", + "O": "오", + "P": "피", + "Q": "큐", + "R": "알", + "S": "에스", + "T": "티", + "U": "유", + "V": "브이", + "W": "더블유", + "X": "엑스", + "Y": "와이", + "Z": "지", + } + new_text = re.sub("[a-z]+", lambda x: str.upper(x.group()), text) + new_text = "".join( + upper_alphabet_to_kor[char] if char in upper_alphabet_to_kor.keys() else char + for char in new_text + ) + + return new_text + + @classmethod + def normalize_text(cls, text): + # stage 0 : text strip + text = text.strip() + + # stage 1 : normalize numbers + text = cls._normalize_numbers(text) + + # stage 2 : normalize english text + text = cls._normalize_english_text(text) + return text diff --git a/funasr/tokenizer/phoneme_tokenizer.py b/funasr/tokenizer/phoneme_tokenizer.py new file mode 100644 index 0000000..12b29ec --- /dev/null +++ b/funasr/tokenizer/phoneme_tokenizer.py @@ -0,0 +1,524 @@ +import logging +from pathlib import Path +import re +from typing import Iterable +from typing import List +from typing import Optional +from typing import Union +import warnings + +# import g2p_en +import jamo + +from funasr.tokenizer.abs_tokenizer import AbsTokenizer + + +g2p_classes = [ + None, + "g2p_en", + "g2p_en_no_space", + "pyopenjtalk", + "pyopenjtalk_kana", + "pyopenjtalk_accent", + "pyopenjtalk_accent_with_pause", + "pyopenjtalk_prosody", + "pypinyin_g2p", + "pypinyin_g2p_phone", + "espeak_ng_arabic", + "espeak_ng_german", + "espeak_ng_french", + "espeak_ng_spanish", + "espeak_ng_russian", + "espeak_ng_greek", + "espeak_ng_finnish", + "espeak_ng_hungarian", + "espeak_ng_dutch", + "espeak_ng_english_us_vits", + "espeak_ng_hindi", + "g2pk", + "g2pk_no_space", + "korean_jaso", + "korean_jaso_no_space", +] + + +def split_by_space(text) -> List[str]: + if " " in text: + text = text.replace(" ", " ") + return [c.replace("", " ") for c in text.split(" ")] + else: + return text.split(" ") + + +def pyopenjtalk_g2p(text) -> List[str]: + import pyopenjtalk + + # phones is a str object separated by space + phones = pyopenjtalk.g2p(text, kana=False) + phones = phones.split(" ") + return phones + + +def pyopenjtalk_g2p_accent(text) -> List[str]: + import pyopenjtalk + import re + + phones = [] + for labels in pyopenjtalk.run_frontend(text)[1]: + p = re.findall(r"\-(.*?)\+.*?\/A:([0-9\-]+).*?\/F:.*?_([0-9]+)", labels) + if len(p) == 1: + phones += [p[0][0], p[0][2], p[0][1]] + return phones + + +def pyopenjtalk_g2p_accent_with_pause(text) -> List[str]: + import pyopenjtalk + import re + + phones = [] + for labels in pyopenjtalk.run_frontend(text)[1]: + if labels.split("-")[1].split("+")[0] == "pau": + phones += ["pau"] + continue + p = re.findall(r"\-(.*?)\+.*?\/A:([0-9\-]+).*?\/F:.*?_([0-9]+)", labels) + if len(p) == 1: + phones += [p[0][0], p[0][2], p[0][1]] + return phones + + +def pyopenjtalk_g2p_kana(text) -> List[str]: + import pyopenjtalk + + kanas = pyopenjtalk.g2p(text, kana=True) + return list(kanas) + + +def pyopenjtalk_g2p_prosody(text: str, drop_unvoiced_vowels: bool = True) -> List[str]: + """Extract phoneme + prosoody symbol sequence from input full-context labels. + + The algorithm is based on `Prosodic features control by symbols as input of + sequence-to-sequence acoustic modeling for neural TTS`_ with some r9y9's tweaks. + + Args: + text (str): Input text. + drop_unvoiced_vowels (bool): whether to drop unvoiced vowels. + + Returns: + List[str]: List of phoneme + prosody symbols. + + Examples: + >>> from funasr.tokenizer.phoneme_tokenizer import pyopenjtalk_g2p_prosody + >>> pyopenjtalk_g2p_prosody("こんにちは。") + ['^', 'k', 'o', '[', 'N', 'n', 'i', 'ch', 'i', 'w', 'a', '$'] + + .. _`Prosodic features control by symbols as input of sequence-to-sequence acoustic + modeling for neural TTS`: https://doi.org/10.1587/transinf.2020EDP7104 + + """ + import pyopenjtalk + + labels = pyopenjtalk.run_frontend(text)[1] + N = len(labels) + + phones = [] + for n in range(N): + lab_curr = labels[n] + + # current phoneme + p3 = re.search(r"\-(.*?)\+", lab_curr).group(1) + + # deal unvoiced vowels as normal vowels + if drop_unvoiced_vowels and p3 in "AEIOU": + p3 = p3.lower() + + # deal with sil at the beginning and the end of text + if p3 == "sil": + assert n == 0 or n == N - 1 + if n == 0: + phones.append("^") + elif n == N - 1: + # check question form or not + e3 = _numeric_feature_by_regex(r"!(\d+)_", lab_curr) + if e3 == 0: + phones.append("$") + elif e3 == 1: + phones.append("?") + continue + elif p3 == "pau": + phones.append("_") + continue + else: + phones.append(p3) + + # accent type and position info (forward or backward) + a1 = _numeric_feature_by_regex(r"/A:([0-9\-]+)\+", lab_curr) + a2 = _numeric_feature_by_regex(r"\+(\d+)\+", lab_curr) + a3 = _numeric_feature_by_regex(r"\+(\d+)/", lab_curr) + + # number of mora in accent phrase + f1 = _numeric_feature_by_regex(r"/F:(\d+)_", lab_curr) + + a2_next = _numeric_feature_by_regex(r"\+(\d+)\+", labels[n + 1]) + # accent phrase border + if a3 == 1 and a2_next == 1 and p3 in "aeiouAEIOUNcl": + phones.append("#") + # pitch falling + elif a1 == 0 and a2_next == a2 + 1 and a2 != f1: + phones.append("]") + # pitch rising + elif a2 == 1 and a2_next == 2: + phones.append("[") + + return phones + + +def _numeric_feature_by_regex(regex, s): + match = re.search(regex, s) + if match is None: + return -50 + return int(match.group(1)) + + +def pypinyin_g2p(text) -> List[str]: + from pypinyin import pinyin + from pypinyin import Style + + phones = [phone[0] for phone in pinyin(text, style=Style.TONE3)] + return phones + + +def pypinyin_g2p_phone(text) -> List[str]: + from pypinyin import pinyin + from pypinyin import Style + from pypinyin.style._utils import get_finals + from pypinyin.style._utils import get_initials + + phones = [ + p + for phone in pinyin(text, style=Style.TONE3) + for p in [ + get_initials(phone[0], strict=True), + get_finals(phone[0], strict=True), + ] + if len(p) != 0 + ] + return phones + + +class G2p_en: + """On behalf of g2p_en.G2p. + + g2p_en.G2p isn't pickalable and it can't be copied to the other processes + via multiprocessing module. + As a workaround, g2p_en.G2p is instantiated upon calling this class. + + """ + + def __init__(self, no_space: bool = False): + self.no_space = no_space + self.g2p = None + + def __call__(self, text) -> List[str]: + if self.g2p is None: + self.g2p = g2p_en.G2p() + + phones = self.g2p(text) + if self.no_space: + # remove space which represents word serapater + phones = list(filter(lambda s: s != " ", phones)) + return phones + + +class G2pk: + """On behalf of g2pk.G2p. + + g2pk.G2p isn't pickalable and it can't be copied to the other processes + via multiprocessing module. + As a workaround, g2pk.G2p is instantiated upon calling this class. + + """ + + def __init__(self, descritive=False, group_vowels=False, to_syl=False, no_space=False): + self.descritive = descritive + self.group_vowels = group_vowels + self.to_syl = to_syl + self.no_space = no_space + self.g2p = None + + def __call__(self, text) -> List[str]: + if self.g2p is None: + import g2pk + + self.g2p = g2pk.G2p() + + phones = list( + self.g2p( + text, + descriptive=self.descritive, + group_vowels=self.group_vowels, + to_syl=self.to_syl, + ) + ) + if self.no_space: + # remove space which represents word serapater + phones = list(filter(lambda s: s != " ", phones)) + return phones + + +class Jaso: + PUNC = "!'(),-.:;?" + SPACE = " " + + JAMO_LEADS = "".join([chr(_) for _ in range(0x1100, 0x1113)]) + JAMO_VOWELS = "".join([chr(_) for _ in range(0x1161, 0x1176)]) + JAMO_TAILS = "".join([chr(_) for _ in range(0x11A8, 0x11C3)]) + + VALID_CHARS = JAMO_LEADS + JAMO_VOWELS + JAMO_TAILS + PUNC + SPACE + + def __init__(self, space_symbol=" ", no_space=False): + self.space_symbol = space_symbol + self.no_space = no_space + + def _text_to_jaso(self, line: str) -> List[str]: + jasos = list(jamo.hangul_to_jamo(line)) + return jasos + + def _remove_non_korean_characters(self, tokens): + new_tokens = [token for token in tokens if token in self.VALID_CHARS] + return new_tokens + + def __call__(self, text) -> List[str]: + graphemes = [x for x in self._text_to_jaso(text)] + graphemes = self._remove_non_korean_characters(graphemes) + + if self.no_space: + graphemes = list(filter(lambda s: s != " ", graphemes)) + else: + graphemes = [x if x != " " else self.space_symbol for x in graphemes] + return graphemes + + +class Phonemizer: + """Phonemizer module for various languages. + + This is wrapper module of https://github.com/bootphon/phonemizer. + You can define various g2p modules by specifying options for phonemizer. + + See available options: + https://github.com/bootphon/phonemizer/blob/master/phonemizer/phonemize.py#L32 + + """ + + def __init__( + self, + backend, + word_separator: Optional[str] = None, + syllable_separator: Optional[str] = None, + phone_separator: Optional[str] = " ", + strip=False, + split_by_single_token: bool = False, + **phonemizer_kwargs, + ): + # delayed import + from phonemizer.backend import BACKENDS + from phonemizer.separator import Separator + + self.separator = Separator( + word=word_separator, + syllable=syllable_separator, + phone=phone_separator, + ) + + # define logger to suppress the warning in phonemizer + logger = logging.getLogger("phonemizer") + logger.setLevel(logging.ERROR) + self.phonemizer = BACKENDS[backend]( + **phonemizer_kwargs, + logger=logger, + ) + self.strip = strip + self.split_by_single_token = split_by_single_token + + def __call__(self, text) -> List[str]: + tokens = self.phonemizer.phonemize( + [text], + separator=self.separator, + strip=self.strip, + njobs=1, + )[0] + if not self.split_by_single_token: + return tokens.split() + else: + # "a: ab" -> ["a", ":", "", "a", "b"] + # TODO(kan-bayashi): space replacement should be dealt in PhonemeTokenizer + return [c.replace(" ", "") for c in tokens] + + +class PhonemeTokenizer(AbsTokenizer): + def __init__( + self, + g2p_type: Union[None, str], + non_linguistic_symbols: Union[Path, str, Iterable[str]] = None, + space_symbol: str = "", + remove_non_linguistic_symbols: bool = False, + ): + if g2p_type is None: + self.g2p = split_by_space + elif g2p_type == "g2p_en": + self.g2p = G2p_en(no_space=False) + elif g2p_type == "g2p_en_no_space": + self.g2p = G2p_en(no_space=True) + elif g2p_type == "pyopenjtalk": + self.g2p = pyopenjtalk_g2p + elif g2p_type == "pyopenjtalk_kana": + self.g2p = pyopenjtalk_g2p_kana + elif g2p_type == "pyopenjtalk_accent": + self.g2p = pyopenjtalk_g2p_accent + elif g2p_type == "pyopenjtalk_accent_with_pause": + self.g2p = pyopenjtalk_g2p_accent_with_pause + elif g2p_type == "pyopenjtalk_prosody": + self.g2p = pyopenjtalk_g2p_prosody + elif g2p_type == "pypinyin_g2p": + self.g2p = pypinyin_g2p + elif g2p_type == "pypinyin_g2p_phone": + self.g2p = pypinyin_g2p_phone + elif g2p_type == "espeak_ng_arabic": + self.g2p = Phonemizer( + language="ar", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_german": + self.g2p = Phonemizer( + language="de", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_french": + self.g2p = Phonemizer( + language="fr-fr", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_spanish": + self.g2p = Phonemizer( + language="es", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_russian": + self.g2p = Phonemizer( + language="ru", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_greek": + self.g2p = Phonemizer( + language="el", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_finnish": + self.g2p = Phonemizer( + language="fi", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_hungarian": + self.g2p = Phonemizer( + language="hu", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_dutch": + self.g2p = Phonemizer( + language="nl", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "espeak_ng_hindi": + self.g2p = Phonemizer( + language="hi", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + ) + elif g2p_type == "g2pk": + self.g2p = G2pk(no_space=False) + elif g2p_type == "g2pk_no_space": + self.g2p = G2pk(no_space=True) + elif g2p_type == "espeak_ng_english_us_vits": + # VITS official implementation-like processing + # Reference: https://github.com/jaywalnut310/vits + self.g2p = Phonemizer( + language="en-us", + backend="espeak", + with_stress=True, + preserve_punctuation=True, + strip=True, + word_separator=" ", + phone_separator="", + split_by_single_token=True, + ) + elif g2p_type == "korean_jaso": + self.g2p = Jaso(space_symbol=space_symbol, no_space=False) + elif g2p_type == "korean_jaso_no_space": + self.g2p = Jaso(no_space=True) + else: + raise NotImplementedError(f"Not supported: g2p_type={g2p_type}") + + self.g2p_type = g2p_type + self.space_symbol = space_symbol + if non_linguistic_symbols is None: + self.non_linguistic_symbols = set() + elif isinstance(non_linguistic_symbols, (Path, str)): + non_linguistic_symbols = Path(non_linguistic_symbols) + try: + with non_linguistic_symbols.open("r", encoding="utf-8") as f: + self.non_linguistic_symbols = set(line.rstrip() for line in f) + except FileNotFoundError: + warnings.warn(f"{non_linguistic_symbols} doesn't exist.") + self.non_linguistic_symbols = set() + else: + self.non_linguistic_symbols = set(non_linguistic_symbols) + self.remove_non_linguistic_symbols = remove_non_linguistic_symbols + + def __repr__(self): + return ( + f"{self.__class__.__name__}(" + f'g2p_type="{self.g2p_type}", ' + f'space_symbol="{self.space_symbol}", ' + f'non_linguistic_symbols="{self.non_linguistic_symbols}"' + ")" + ) + + def text2tokens(self, line: str) -> List[str]: + tokens = [] + while len(line) != 0: + for w in self.non_linguistic_symbols: + if line.startswith(w): + if not self.remove_non_linguistic_symbols: + tokens.append(line[: len(w)]) + line = line[len(w) :] + break + else: + t = line[0] + tokens.append(t) + line = line[1:] + + line = "".join(tokens) + tokens = self.g2p(line) + return tokens + + def tokens2text(self, tokens: Iterable[str]) -> str: + # phoneme type is not invertible + return "".join(tokens) diff --git a/funasr/tokenizer/sentencepiece_tokenizer.py b/funasr/tokenizer/sentencepiece_tokenizer.py new file mode 100644 index 0000000..1be1b81 --- /dev/null +++ b/funasr/tokenizer/sentencepiece_tokenizer.py @@ -0,0 +1,51 @@ +from pathlib import Path +from typing import Iterable +from typing import List +from typing import Union + +import sentencepiece as spm + +from funasr.tokenizer.abs_tokenizer import BaseTokenizer +from funasr.register import tables + + +@tables.register("tokenizer_classes", "SentencepiecesTokenizer") +class SentencepiecesTokenizer(BaseTokenizer): + def __init__(self, bpemodel: Union[Path, str], **kwargs): + super().__init__(**kwargs) + self.bpemodel = str(bpemodel) + # NOTE(kamo): + # Don't build SentencePieceProcessor in __init__() + # because it's not picklable and it may cause following error, + # "TypeError: can't pickle SwigPyObject objects", + # when giving it as argument of "multiprocessing.Process()". + self.sp = None + self._build_sentence_piece_processor() + + def __repr__(self): + return f'{self.__class__.__name__}(model="{self.bpemodel}")' + + def _build_sentence_piece_processor(self): + # Build SentencePieceProcessor lazily. + if self.sp is None: + self.sp = spm.SentencePieceProcessor() + self.sp.load(self.bpemodel) + + def text2tokens(self, line: str) -> List[str]: + self._build_sentence_piece_processor() + return self.sp.EncodeAsPieces(line) + + def tokens2text(self, tokens: Iterable[str]) -> str: + self._build_sentence_piece_processor() + return self.sp.DecodePieces(list(tokens)) + + def encode(self, line: str, **kwargs) -> List[int]: + self._build_sentence_piece_processor() + return self.sp.EncodeAsIds(line) + + def decode(self, line: List[int], **kwargs): + self._build_sentence_piece_processor() + return self.sp.DecodeIds(line) + + def get_vocab_size(self): + return self.sp.GetPieceSize() diff --git a/funasr/tokenizer/token_id_converter.py b/funasr/tokenizer/token_id_converter.py new file mode 100644 index 0000000..c3fc71d --- /dev/null +++ b/funasr/tokenizer/token_id_converter.py @@ -0,0 +1,56 @@ +from pathlib import Path +from typing import Dict +from typing import Iterable +from typing import List +from typing import Union + +import numpy as np + + +class TokenIDConverter: + def __init__( + self, + token_list: Union[Path, str, Iterable[str]], + unk_symbol: str = "", + ): + + if isinstance(token_list, (Path, str)): + token_list = Path(token_list) + self.token_list_repr = str(token_list) + self.token_list: List[str] = [] + + with token_list.open("r", encoding="utf-8") as f: + for idx, line in enumerate(f): + line = line.rstrip() + self.token_list.append(line) + + else: + self.token_list: List[str] = list(token_list) + self.token_list_repr = "" + for i, t in enumerate(self.token_list): + if i == 3: + break + self.token_list_repr += f"{t}, " + self.token_list_repr += f"... (NVocab={(len(self.token_list))})" + + self.token2id: Dict[str, int] = {} + for i, t in enumerate(self.token_list): + if t in self.token2id: + raise RuntimeError(f'Symbol "{t}" is duplicated') + self.token2id[t] = i + + self.unk_symbol = unk_symbol + if self.unk_symbol not in self.token2id: + raise RuntimeError(f"Unknown symbol '{unk_symbol}' doesn't exist in the token_list") + self.unk_id = self.token2id[self.unk_symbol] + + def get_num_vocabulary_size(self) -> int: + return len(self.token_list) + + def ids2tokens(self, integers: Union[np.ndarray, Iterable[int]]) -> List[str]: + if isinstance(integers, np.ndarray) and integers.ndim != 1: + raise ValueError(f"Must be 1 dim ndarray, but got {integers.ndim}") + return [self.token_list[i] for i in integers] + + def tokens2ids(self, tokens: Iterable[str]) -> List[int]: + return [self.token2id.get(i, self.unk_id) for i in tokens] diff --git a/funasr/tokenizer/whisper_tokenizer.py b/funasr/tokenizer/whisper_tokenizer.py new file mode 100644 index 0000000..bd96b83 --- /dev/null +++ b/funasr/tokenizer/whisper_tokenizer.py @@ -0,0 +1,45 @@ +from funasr.register import tables + + +@tables.register("tokenizer_classes", "WhisperTokenizer") +def WhisperTokenizer(**kwargs): + try: + from whisper.tokenizer import get_tokenizer + except: + print("Notice: If you want to use whisper, please `pip install -U openai-whisper`") + + language = kwargs.get("language", None) + task = kwargs.get("task", "transcribe") + is_multilingual = kwargs.get("is_multilingual", True) + num_languages = kwargs.get("num_languages", 99) + tokenizer = get_tokenizer( + multilingual=is_multilingual, + num_languages=num_languages, + language=language, + task=task, + ) + + return tokenizer + + +@tables.register("tokenizer_classes", "SenseVoiceTokenizer") +def SenseVoiceTokenizer(**kwargs): + try: + from funasr.models.sense_voice.whisper_lib.tokenizer import get_tokenizer + except: + print("Notice: If you want to use whisper, please `pip install -U openai-whisper`") + + language = kwargs.get("language", None) + task = kwargs.get("task", None) + is_multilingual = kwargs.get("is_multilingual", True) + num_languages = kwargs.get("num_languages", 8749) + vocab_path = kwargs.get("vocab_path", None) + tokenizer = get_tokenizer( + multilingual=is_multilingual, + num_languages=num_languages, + language=language, + task=task, + vocab_path=vocab_path, + ) + + return tokenizer diff --git a/funasr/tokenizer/word_tokenizer.py b/funasr/tokenizer/word_tokenizer.py new file mode 100644 index 0000000..c1fd6e0 --- /dev/null +++ b/funasr/tokenizer/word_tokenizer.py @@ -0,0 +1,55 @@ +from pathlib import Path +from typing import Iterable +from typing import List +from typing import Union +import warnings + + +from funasr.tokenizer.abs_tokenizer import AbsTokenizer + + +class WordTokenizer(AbsTokenizer): + def __init__( + self, + delimiter: str = None, + non_linguistic_symbols: Union[Path, str, Iterable[str]] = None, + remove_non_linguistic_symbols: bool = False, + ): + self.delimiter = delimiter + + if not remove_non_linguistic_symbols and non_linguistic_symbols is not None: + warnings.warn( + "non_linguistic_symbols is only used " "when remove_non_linguistic_symbols = True" + ) + + if non_linguistic_symbols is None: + self.non_linguistic_symbols = set() + elif isinstance(non_linguistic_symbols, (Path, str)): + non_linguistic_symbols = Path(non_linguistic_symbols) + try: + with non_linguistic_symbols.open("r", encoding="utf-8") as f: + self.non_linguistic_symbols = set(line.rstrip() for line in f) + except FileNotFoundError: + warnings.warn(f"{non_linguistic_symbols} doesn't exist.") + self.non_linguistic_symbols = set() + else: + self.non_linguistic_symbols = set(non_linguistic_symbols) + self.remove_non_linguistic_symbols = remove_non_linguistic_symbols + + def __repr__(self): + return f'{self.__class__.__name__}(delimiter="{self.delimiter}")' + + def text2tokens(self, line: str) -> List[str]: + tokens = [] + for t in line.split(self.delimiter): + if self.remove_non_linguistic_symbols and t in self.non_linguistic_symbols: + continue + tokens.append(t) + return tokens + + def tokens2text(self, tokens: Iterable[str]) -> str: + if self.delimiter is None: + delimiter = " " + else: + delimiter = self.delimiter + return delimiter.join(tokens) diff --git a/funasr/train_utils/__init__.py b/funasr/train_utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/train_utils/add_gradient_noise.py b/funasr/train_utils/add_gradient_noise.py new file mode 100644 index 0000000..654e928 --- /dev/null +++ b/funasr/train_utils/add_gradient_noise.py @@ -0,0 +1,31 @@ +import torch + + +def add_gradient_noise( + model: torch.nn.Module, + iteration: int, + duration: float = 100, + eta: float = 1.0, + scale_factor: float = 0.55, +): + """Adds noise from a standard normal distribution to the gradients. + + The standard deviation (`sigma`) is controlled + by the three hyper-parameters below. + `sigma` goes to zero (no noise) with more iterations. + + Args: + model: Model. + iteration: Number of iterations. + duration: {100, 1000}: Number of durations to control + the interval of the `sigma` change. + eta: {0.01, 0.3, 1.0}: The magnitude of `sigma`. + scale_factor: {0.55}: The scale of `sigma`. + """ + interval = (iteration // duration) + 1 + sigma = eta / interval**scale_factor + for param in model.parameters(): + if param.grad is not None: + _shape = param.grad.size() + noise = sigma * torch.randn(_shape).to(param.device) + param.grad += noise diff --git a/funasr/train_utils/average_nbest_models.py b/funasr/train_utils/average_nbest_models.py new file mode 100644 index 0000000..0f08804 --- /dev/null +++ b/funasr/train_utils/average_nbest_models.py @@ -0,0 +1,82 @@ +import logging +from pathlib import Path +from typing import Optional +from typing import Sequence +from typing import Union +import warnings +import os +from io import BytesIO + +import torch +from typing import Collection +import os +import torch +import re +from collections import OrderedDict +from functools import cmp_to_key + + +def _get_checkpoint_paths(output_dir: str, last_n: int = 5): + """ + Get the paths of the last 'last_n' checkpoints by parsing filenames + in the output directory. + """ + try: + checkpoint = torch.load(os.path.join(output_dir, "model.pt"), map_location="cpu") + avg_keep_nbest_models_type = checkpoint["avg_keep_nbest_models_type"] + val_step_or_eoch = checkpoint[f"val_{avg_keep_nbest_models_type}_step_or_eoch"] + sorted_items = sorted(val_step_or_eoch.items(), key=lambda x: x[1], reverse=True) + sorted_items = ( + sorted_items[:last_n] if avg_keep_nbest_models_type == "acc" else sorted_items[-last_n:] + ) + checkpoint_paths = [os.path.join(output_dir, key) for key, value in sorted_items[:last_n]] + except: + print(f"{checkpoint} does not exist, avg the lastet checkpoint.") + # List all files in the output directory + files = os.listdir(output_dir) + # Filter out checkpoint files and extract epoch numbers + checkpoint_files = [f for f in files if f.startswith("model.pt.e")] + # Sort files by epoch number in descending order + checkpoint_files.sort(key=lambda x: int(re.search(r"(\d+)", x).group()), reverse=True) + # Get the last 'last_n' checkpoint paths + checkpoint_paths = [os.path.join(output_dir, f) for f in checkpoint_files[:last_n]] + return checkpoint_paths + + +@torch.no_grad() +def average_checkpoints(output_dir: str, last_n: int = 5, **kwargs): + """ + Average the last 'last_n' checkpoints' model state_dicts. + If a tensor is of type torch.int, perform sum instead of average. + """ + checkpoint_paths = _get_checkpoint_paths(output_dir, last_n) + print(f"average_checkpoints: {checkpoint_paths}") + state_dicts = [] + + # Load state_dicts from checkpoints + for path in checkpoint_paths: + if os.path.isfile(path): + state_dicts.append(torch.load(path, map_location="cpu")["state_dict"]) + else: + print(f"Checkpoint file {path} not found.") + + # Check if we have any state_dicts to average + if len(state_dicts) < 1: + raise RuntimeError("No checkpoints found for averaging.") + + # Average or sum weights + avg_state_dict = OrderedDict() + for key in state_dicts[0].keys(): + tensors = [state_dict[key].cpu() for state_dict in state_dicts] + # Check the type of the tensor + if str(tensors[0].dtype).startswith("torch.int"): + # Perform sum for integer tensors + summed_tensor = sum(tensors) + avg_state_dict[key] = summed_tensor + else: + # Perform average for other types of tensors + stacked_tensors = torch.stack(tensors) + avg_state_dict[key] = torch.mean(stacked_tensors, dim=0) + checkpoint_outpath = os.path.join(output_dir, f"model.pt.avg{last_n}") + torch.save({"state_dict": avg_state_dict}, checkpoint_outpath) + return checkpoint_outpath diff --git a/funasr/train_utils/device_funcs.py b/funasr/train_utils/device_funcs.py new file mode 100644 index 0000000..dd7fc76 --- /dev/null +++ b/funasr/train_utils/device_funcs.py @@ -0,0 +1,64 @@ +import dataclasses +import warnings + +import numpy as np +import torch + + +def to_device(data, device=None, dtype=None, non_blocking=False, copy=False): + """Change the device of object recursively""" + if isinstance(data, dict): + return {k: to_device(v, device, dtype, non_blocking, copy) for k, v in data.items()} + elif dataclasses.is_dataclass(data) and not isinstance(data, type): + return type(data)( + *[to_device(v, device, dtype, non_blocking, copy) for v in dataclasses.astuple(data)] + ) + # maybe namedtuple. I don't know the correct way to judge namedtuple. + elif isinstance(data, tuple) and type(data) is not tuple: + return type(data)(*[to_device(o, device, dtype, non_blocking, copy) for o in data]) + elif isinstance(data, (list, tuple)): + return type(data)(to_device(v, device, dtype, non_blocking, copy) for v in data) + elif isinstance(data, np.ndarray): + return to_device(torch.from_numpy(data), device, dtype, non_blocking, copy) + elif isinstance(data, torch.Tensor): + return data.to(device, dtype, non_blocking, copy) + else: + return data + + +def force_gatherable(data, device): + """Change object to gatherable in torch.nn.DataParallel recursively + + The difference from to_device() is changing to torch.Tensor if float or int + value is found. + + The restriction to the returned value in DataParallel: + The object must be + - torch.cuda.Tensor + - 1 or more dimension. 0-dimension-tensor sends warning. + or a list, tuple, dict. + + """ + if isinstance(data, dict): + return {k: force_gatherable(v, device) for k, v in data.items()} + # DataParallel can't handle NamedTuple well + elif isinstance(data, tuple) and type(data) is not tuple: + return type(data)(*[force_gatherable(o, device) for o in data]) + elif isinstance(data, (list, tuple, set)): + return type(data)(force_gatherable(v, device) for v in data) + elif isinstance(data, np.ndarray): + return force_gatherable(torch.from_numpy(data), device) + elif isinstance(data, torch.Tensor): + if data.dim() == 0: + # To 1-dim array + data = data[None] + return data.to(device) + elif isinstance(data, float): + return torch.tensor([data], dtype=torch.float, device=device) + elif isinstance(data, int): + return torch.tensor([data], dtype=torch.long, device=device) + elif data is None: + return None + else: + warnings.warn(f"{type(data)} may not be gatherable by DataParallel") + return data diff --git a/funasr/train_utils/forward_adaptor.py b/funasr/train_utils/forward_adaptor.py new file mode 100644 index 0000000..eb6da2b --- /dev/null +++ b/funasr/train_utils/forward_adaptor.py @@ -0,0 +1,31 @@ +import torch + + +class ForwardAdaptor(torch.nn.Module): + """Wrapped module to parallelize specified method + + torch.nn.DataParallel parallelizes only "forward()" + and, maybe, the method having the other name can't be applied + except for wrapping the module just like this class. + + Examples: + >>> class A(torch.nn.Module): + ... def foo(self, x): + ... ... + >>> model = A() + >>> model = ForwardAdaptor(model, "foo") + >>> model = torch.nn.DataParallel(model, device_ids=[0, 1]) + >>> x = torch.randn(2, 10) + >>> model(x) + """ + + def __init__(self, module: torch.nn.Module, name: str): + super().__init__() + self.module = module + self.name = name + if not hasattr(module, name): + raise ValueError(f"{module} doesn't have {name}") + + def forward(self, *args, **kwargs): + func = getattr(self.module, self.name) + return func(*args, **kwargs) diff --git a/funasr/train_utils/initialize.py b/funasr/train_utils/initialize.py new file mode 100644 index 0000000..667585a --- /dev/null +++ b/funasr/train_utils/initialize.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +"""Initialize modules for espnet2 neural networks.""" + +import math +import torch + + +def initialize(model: torch.nn.Module, init: str): + """Initialize weights of a neural network module. + + Parameters are initialized using the given method or distribution. + + Custom initialization routines can be implemented into submodules + as function `espnet_initialization_fn` within the custom module. + + Args: + model: Target. + init: Method of initialization. + """ + + # weight init + for p in model.parameters(): + if p.dim() > 1: + if init == "xavier_uniform": + torch.nn.init.xavier_uniform_(p.data) + elif init == "xavier_normal": + torch.nn.init.xavier_normal_(p.data) + elif init == "kaiming_uniform": + torch.nn.init.kaiming_uniform_(p.data, nonlinearity="relu") + elif init == "kaiming_normal": + torch.nn.init.kaiming_normal_(p.data, nonlinearity="relu") + else: + raise ValueError("Unknown initialization: " + init) + # bias init + for p in model.parameters(): + if p.dim() == 1: + p.data.zero_() + + # reset some modules with default init + for m in model.modules(): + if isinstance(m, (torch.nn.Embedding, torch.nn.LayerNorm, torch.nn.GroupNorm)): + m.reset_parameters() + if hasattr(m, "espnet_initialization_fn"): + m.espnet_initialization_fn() + + # TODO(xkc): Hacking s3prl_frontend and wav2vec2encoder initialization + if getattr(model, "encoder", None) and getattr( + model.encoder, "reload_pretrained_parameters", None + ): + model.encoder.reload_pretrained_parameters() + if getattr(model, "frontend", None) and getattr( + model.frontend, "reload_pretrained_parameters", None + ): + model.frontend.reload_pretrained_parameters() diff --git a/funasr/train_utils/load_pretrained_model.py b/funasr/train_utils/load_pretrained_model.py new file mode 100644 index 0000000..02abfd5 --- /dev/null +++ b/funasr/train_utils/load_pretrained_model.py @@ -0,0 +1,116 @@ +from typing import Any +from typing import Dict +from typing import Union +from io import BytesIO + +import logging +import torch +import torch.nn +import torch.optim +import pdb + + +def filter_state_dict( + dst_state: Dict[str, Union[float, torch.Tensor]], + src_state: Dict[str, Union[float, torch.Tensor]], +): + """Filter name, size mismatch instances between dicts. + + Args: + dst_state: reference state dict for filtering + src_state: target state dict for filtering + + """ + match_state = {} + for key, value in src_state.items(): + if key in dst_state and (dst_state[key].size() == src_state[key].size()): + match_state[key] = value + else: + if key not in dst_state: + logging.warning( + f"Filter out {key} from pretrained dict" + + " because of name not found in target dict" + ) + else: + logging.warning( + f"Filter out {key} from pretrained dict" + + " because of size mismatch" + + f"({dst_state[key].size()}-{src_state[key].size()})" + ) + return match_state + + +def load_pretrained_model( + path: str, + model: torch.nn.Module, + ignore_init_mismatch: bool = True, + map_location: str = "cpu", + oss_bucket=None, + scope_map=[], + excludes=None, + **kwargs, +): + """Load a model state and set it to the model. + + Args: + init_param: ::: + + Examples: + + """ + + obj = model + dst_state = obj.state_dict() + + print(f"ckpt: {path}") + + if oss_bucket is None: + src_state = torch.load(path, map_location=map_location) + else: + buffer = BytesIO(oss_bucket.get_object(path).read()) + src_state = torch.load(buffer, map_location=map_location) + + src_state = src_state["state_dict"] if "state_dict" in src_state else src_state + src_state = src_state["model_state_dict"] if "model_state_dict" in src_state else src_state + src_state = src_state["model"] if "model" in src_state else src_state + + if isinstance(scope_map, str): + scope_map = scope_map.split(",") + scope_map += ["module.", "None"] + + for k in dst_state.keys(): + + k_src = k + + if scope_map is not None: + src_prefix = "" + dst_prefix = "" + for i in range(0, len(scope_map), 2): + src_prefix = scope_map[i] if scope_map[i].lower() != "none" else "" + dst_prefix = scope_map[i + 1] if scope_map[i + 1].lower() != "none" else "" + + if dst_prefix == "" and (src_prefix + k) in src_state.keys(): + k_src = src_prefix + k + if not k_src.startswith("module."): + print(f"init param, map: {k} from {k_src} in ckpt") + elif ( + k.startswith(dst_prefix) + and k.replace(dst_prefix, src_prefix, 1) in src_state.keys() + ): + k_src = k.replace(dst_prefix, src_prefix, 1) + if not k_src.startswith("module."): + print(f"init param, map: {k} from {k_src} in ckpt") + + if k_src in src_state.keys(): + if ignore_init_mismatch and dst_state[k].shape != src_state[k_src].shape: + print( + f"ignore_init_mismatch:{ignore_init_mismatch}, dst: {k, dst_state[k].shape}, src: {k_src, src_state[k_src].shape}" + ) + else: + dst_state[k] = src_state[k_src] + + else: + print(f"Warning, miss key in ckpt: {k}, mapped: {k_src}") + + flag = obj.load_state_dict(dst_state, strict=True) + # print(flag) diff --git a/funasr/train_utils/model_summary.py b/funasr/train_utils/model_summary.py new file mode 100644 index 0000000..4e92a33 --- /dev/null +++ b/funasr/train_utils/model_summary.py @@ -0,0 +1,64 @@ +import numpy as np +import torch + + +def get_human_readable_count(number: int) -> str: + """Return human_readable_count + + Originated from: + https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/core/memory.py + + Abbreviates an integer number with K, M, B, T for thousands, millions, + billions and trillions, respectively. + Examples: + >>> get_human_readable_count(123) + '123 ' + >>> get_human_readable_count(1234) # (one thousand) + '1 K' + >>> get_human_readable_count(2e6) # (two million) + '2 M' + >>> get_human_readable_count(3e9) # (three billion) + '3 B' + >>> get_human_readable_count(4e12) # (four trillion) + '4 T' + >>> get_human_readable_count(5e15) # (more than trillion) + '5,000 T' + Args: + number: a positive integer number + Return: + A string formatted according to the pattern described above. + """ + assert number >= 0 + labels = [" ", "K", "M", "B", "T"] + num_digits = int(np.floor(np.log10(number)) + 1 if number > 0 else 1) + num_groups = int(np.ceil(num_digits / 3)) + num_groups = min(num_groups, len(labels)) # don't abbreviate beyond trillions + shift = -3 * (num_groups - 1) + number = number * (10**shift) + index = num_groups - 1 + return f"{number:.2f} {labels[index]}" + + +def to_bytes(dtype) -> int: + # torch.float16 -> 16 + return int(str(dtype)[-2:]) // 8 + + +def model_summary(model: torch.nn.Module) -> str: + message = "Model structure:\n" + message += str(model) + # for p in model.parameters(): + # print(f"{p.numel()}") + tot_params = sum(p.numel() for p in model.parameters()) + num_params = sum(p.numel() for p in model.parameters() if p.requires_grad) + percent_trainable = "{:.1f}".format(num_params * 100.0 / tot_params) + tot_params = get_human_readable_count(tot_params) + num_params = get_human_readable_count(num_params) + message += "\n\nModel summary:\n" + message += f" Class Name: {model.__class__.__name__}\n" + message += f" Total Number of model parameters: {tot_params}\n" + message += f" Number of trainable parameters: {num_params} ({percent_trainable}%)\n" + + dtype = next(iter(model.parameters())).dtype + message += f" Type: {dtype}" + return message diff --git a/funasr/train_utils/recursive_op.py b/funasr/train_utils/recursive_op.py new file mode 100644 index 0000000..1c2a92f --- /dev/null +++ b/funasr/train_utils/recursive_op.py @@ -0,0 +1,48 @@ +"""Torch utility module.""" + +import torch + +if torch.distributed.is_available(): + from torch.distributed import ReduceOp + + +def recursive_sum(obj, weight: torch.Tensor, distributed: bool = False): + assert weight.dim() == 1, weight.size() + if isinstance(obj, (tuple, list)): + return type(obj)(recursive_sum(v, weight, distributed) for v in obj) + elif isinstance(obj, dict): + return {k: recursive_sum(v, weight, distributed) for k, v in obj.items()} + elif isinstance(obj, torch.Tensor): + assert obj.size() == weight.size(), (obj.size(), weight.size()) + obj = (obj * weight.type(obj.dtype)).sum() + if distributed: + torch.distributed.all_reduce(obj, op=ReduceOp.SUM) + return obj + elif obj is None: + return None + else: + raise ValueError(type(obj)) + + +def recursive_divide(a, b: torch.Tensor): + if isinstance(a, (tuple, list)): + return type(a)(recursive_divide(v, b) for v in a) + elif isinstance(a, dict): + return {k: recursive_divide(v, b) for k, v in a.items()} + elif isinstance(a, torch.Tensor): + assert a.size() == b.size(), (a.size(), b.size()) + return a / b.type(a.dtype) + elif a is None: + return None + else: + raise ValueError(type(a)) + + +def recursive_average(obj, weight: torch.Tensor, distributed: bool = False): + obj = recursive_sum(obj, weight, distributed) + weight = weight.sum() + if distributed: + torch.distributed.all_reduce(weight, op=ReduceOp.SUM) + # Normalize weight to be sum-to-1 + obj = recursive_divide(obj, weight) + return obj, weight diff --git a/funasr/train_utils/set_all_random_seed.py b/funasr/train_utils/set_all_random_seed.py new file mode 100644 index 0000000..ebdca3f --- /dev/null +++ b/funasr/train_utils/set_all_random_seed.py @@ -0,0 +1,10 @@ +import random + +import numpy as np +import torch + + +def set_all_random_seed(seed: int): + random.seed(seed) + np.random.seed(seed) + torch.random.manual_seed(seed) diff --git a/funasr/train_utils/trainer.py b/funasr/train_utils/trainer.py new file mode 100644 index 0000000..50f99f0 --- /dev/null +++ b/funasr/train_utils/trainer.py @@ -0,0 +1,714 @@ +import math +import os +import time +import torch +import logging +from tqdm import tqdm +from datetime import datetime +import torch.distributed as dist +from torch.cuda.amp import autocast, GradScaler +from contextlib import nullcontext, contextmanager +from pathlib import Path + +from funasr.train_utils.device_funcs import to_device +from funasr.train_utils.recursive_op import recursive_average +from funasr.train_utils.average_nbest_models import average_checkpoints +from torch.distributed.fsdp.sharded_grad_scaler import ShardedGradScaler + +try: + import wandb +except: + wandb = None + + +@contextmanager +def maybe_autocast(enabled): + if enabled: + with autocast(): + yield + else: + yield + + +class Trainer: + """ + A simple trainer class for training a PyTorch model, saving checkpoints at the end of each epoch, + and optionally resuming from a saved checkpoint. + + Attributes: + max_epoch (int): Maximum number of epochs for training. + model (torch.nn.Module): The model to be trained. + optim (torch.optim.Optimizer): The optimizer to use for training. + scheduler (torch.optim.lr_scheduler._LRScheduler): The learning rate scheduler. + dataloader_train (torch.utils.data.DataLoader): DataLoader for the training dataset. + dataloader_val (torch.utils.data.DataLoader): DataLoader for the validation dataset. + output_dir (str): Directory where model checkpoints will be saved. + resume (str, optional): Path to a checkpoint to resume training from. + """ + + def __init__( + self, + local_rank, + use_ddp: bool = False, + use_fsdp: bool = False, + use_fp16: bool = False, + output_dir: str = "./", + **kwargs, + ): + """ + Initializes the Trainer class with the model, optimizer, scheduler, dataloaders, and other settings. + + Args: + model (torch.nn.Module): The model to be trained. + optim (torch.optim.Optimizer): The optimizer to use for training. + scheduler (torch.optim.lr_scheduler._LRScheduler): The learning rate scheduler. + dataloader_train (torch.utils.data.DataLoader): The DataLoader for the training dataset. + dataloader_val (torch.utils.data.DataLoader): The DataLoader for the validation dataset. + **kwargs: Additional keyword arguments: + max_epoch (int): The maximum number of epochs for training. + output_dir (str): The directory where model checkpoints will be saved. Default is './'. + resume (str, optional): The file path to a checkpoint to resume training from. + """ + + self.output_dir = output_dir + if not os.path.exists(self.output_dir): + os.makedirs(self.output_dir, exist_ok=True) + self.resume = kwargs.get("resume", True) + self.start_epoch = 0 + self.max_epoch = kwargs.get("max_epoch", 100) + self.local_rank = local_rank + self.use_ddp = use_ddp + self.use_fsdp = use_fsdp + self.device = kwargs.get("device", "cuda") + # self.kwargs = kwargs + self.log_interval = kwargs.get("log_interval", 50) + self.batch_total = 0 + self.use_fp16 = use_fp16 + self.save_checkpoint_interval = kwargs.get("save_checkpoint_interval", 5000) + self.validate_interval = kwargs.get("validate_interval", 5000) + self.keep_nbest_models = kwargs.get("keep_nbest_models", 500) + self.avg_keep_nbest_models_type = kwargs.get("avg_keep_nbest_models_type", "acc") + self.avg_nbest_model = kwargs.get("avg_nbest_model", 10) + self.accum_grad = kwargs.get("accum_grad", 1) + self.grad_clip = kwargs.get("grad_clip", 10.0) + self.grad_clip_type = kwargs.get("grad_clip_type", 2.0) + + try: + rank = dist.get_rank() + world_size = dist.get_world_size() + except: + rank = 0 + world_size = 1 + logging.warning("distributed is not initialized, only single shard") + self.rank = rank + self.world_size = world_size + self.train_acc_avg = 0.0 + self.train_loss_avg = 0.0 + self.val_acc_avg = 0.0 + self.val_loss_avg = 0.0 + self.best_acc_idx = 0 + self.saved_ckpts = {} + self.step_or_epoch = -1 + self.best_step_or_epoch = "" + self.val_acc_step_or_eoch = {} + self.val_loss_step_or_eoch = {} + + self.reset_gpu_cache = kwargs.get("reset_gpu_cache", False) + self.start_data_split_i = 0 + self.start_step = 0 + self.step_in_epoch = 0 + self.use_wandb = kwargs.get("use_wandb", False) + if self.use_wandb: + wandb.login(key=kwargs.get("wandb_token")) + wandb.init( + config=kwargs, + project=kwargs.get("wandb_project", "my_project"), + entity=kwargs.get("wandb_team", "my_team"), + name=kwargs.get("wandb_exp_name", "my_exp"), + dir=output_dir, + job_type="training", + reinit=True, + ) + + def save_checkpoint( + self, + epoch, + step=None, + model=None, + optim=None, + scheduler=None, + scaler=None, + step_in_epoch=None, + **kwargs, + ): + """ + Saves a checkpoint containing the model's state, the optimizer's state, + and the scheduler's state at the end of the given epoch. This method is + intended to be called at the end of each epoch to save the training progress. + + Args: + epoch (int): The epoch number at which the checkpoint is being saved. + """ + + step_in_epoch = None if step is None else step_in_epoch + if self.rank == 0: + logging.info(f"Save checkpoint: {epoch}, rank: {self.local_rank}\n") + # self.step_or_epoch += 1 + state = { + "epoch": epoch, + "state_dict": model.state_dict(), + "optimizer": optim.state_dict(), + "scheduler": scheduler.state_dict(), + "saved_ckpts": self.saved_ckpts, + "val_acc_step_or_eoch": self.val_acc_step_or_eoch, + "val_loss_step_or_eoch": self.val_loss_step_or_eoch, + "best_step_or_epoch": self.best_step_or_epoch, + "avg_keep_nbest_models_type": self.avg_keep_nbest_models_type, + "step": step, + "step_in_epoch": step_in_epoch, + "data_split_i": kwargs.get("data_split_i", 0), + "data_split_num": kwargs.get("data_split_num", 1), + "batch_total": self.batch_total, + "train_loss_avg": kwargs.get("train_loss_avg", 0), + "train_acc_avg": kwargs.get("train_acc_avg", 0), + } + step = step_in_epoch + if hasattr(model, "module"): + state["state_dict"] = model.module.state_dict() + + if scaler: + state["scaler_state"] = scaler.state_dict() + # Create output directory if it does not exist + os.makedirs(self.output_dir, exist_ok=True) + if step is None: + ckpt_name = f"model.pt.ep{epoch}" + else: + ckpt_name = f"model.pt.ep{epoch}.{step}" + filename = os.path.join(self.output_dir, ckpt_name) + torch.save(state, filename) + + logging.info(f"\nCheckpoint saved to {filename}\n") + latest = Path(os.path.join(self.output_dir, f"model.pt")) + torch.save(state, latest) + if self.best_step_or_epoch == "": + self.best_step_or_epoch = ckpt_name + + if self.avg_keep_nbest_models_type == "acc": + if ( + self.val_acc_step_or_eoch[ckpt_name] + >= self.val_acc_step_or_eoch[self.best_step_or_epoch] + ): + self.best_step_or_epoch = ckpt_name + best_ckpt = Path(os.path.join(self.output_dir, f"model.pt.best")) + torch.save(state, best_ckpt) + logging.info( + f"Update best acc: {self.val_acc_step_or_eoch[self.best_step_or_epoch]:.4f}, {best_ckpt}" + ) + else: + logging.info( + f"No improvement in acc: {self.val_acc_step_or_eoch[ckpt_name]:.4f} < {self.val_acc_step_or_eoch[self.best_step_or_epoch]:.4f}, {os.path.join(self.output_dir, self.best_step_or_epoch)}" + ) + elif self.avg_keep_nbest_models_type == "loss": + if ( + self.val_loss_step_or_eoch[ckpt_name] + <= self.val_loss_step_or_eoch[self.best_step_or_epoch] + ): + self.best_step_or_epoch = ckpt_name + best_ckpt = Path(os.path.join(self.output_dir, f"model.pt.best")) + torch.save(state, best_ckpt) + logging.info( + f"Update best loss: {self.val_loss_step_or_eoch[self.best_step_or_epoch]:.4f}, {best_ckpt}" + ) + else: + logging.info( + f"No improvement in loss: {self.val_loss_step_or_eoch[ckpt_name]:.4f} > {self.val_loss_step_or_eoch[self.best_step_or_epoch]:.4f}, {os.path.join(self.output_dir, self.best_step_or_epoch)}" + ) + else: + print("Undo") + self.saved_ckpts[ckpt_name] = getattr( + self, f"val_{self.avg_keep_nbest_models_type}_step_or_eoch" + )[ckpt_name] + if self.keep_nbest_models > 0: + if len(self.saved_ckpts) > self.keep_nbest_models: + if self.avg_keep_nbest_models_type == "acc": + key = min(self.saved_ckpts, key=self.saved_ckpts.get) + else: + key = max(self.saved_ckpts, key=self.saved_ckpts.get) + if key in self.saved_ckpts: + del self.saved_ckpts[key] + filename = os.path.join(self.output_dir, key) + logging.info(f"Delete: {filename}") + if os.path.exists(filename): + os.remove(filename) + + if self.use_ddp or self.use_fsdp: + dist.barrier() + + def resume_checkpoint( + self, + model=None, + optim=None, + scheduler=None, + scaler=None, + ): + """ + Resumes training from a checkpoint at the given file path. + Loads the model's state, the optimizer's state, and the scheduler's state. + + Args: + resume_path (str): The file path to the checkpoint to resume from. + """ + if self.resume: + ckpt = os.path.join(self.output_dir, "model.pt") + if os.path.isfile(ckpt): + checkpoint = torch.load(ckpt, map_location="cpu") + self.start_epoch = checkpoint["epoch"] + # self.model.load_state_dict(checkpoint['state_dict']) + src_state = checkpoint["state_dict"] + dst_state = model.state_dict() + for k in dst_state.keys(): + if not k.startswith("module.") and "module." + k in src_state.keys(): + k_ddp = "module." + k + elif k.startswith("module.") and "module." + k not in src_state.keys(): + k_ddp = k.replace("module.", "", 1) + else: + k_ddp = k + if k_ddp in src_state.keys(): + dst_state[k] = src_state[k_ddp] + else: + print(f"Miss key in ckpt: model: {k}, ckpt: {k_ddp}") + + model.load_state_dict(dst_state) + optim.load_state_dict(checkpoint["optimizer"]) + scheduler.load_state_dict(checkpoint["scheduler"]) + if scaler is not None and "scaler_state" in checkpoint: + scaler.load_state_dict(checkpoint["scaler_state"]) + + self.saved_ckpts = checkpoint["saved_ckpts"] + self.val_acc_step_or_eoch = ( + checkpoint["val_acc_step_or_eoch"] + if "val_acc_step_or_eoch" in checkpoint + else {} + ) + self.val_loss_step_or_eoch = ( + checkpoint["val_loss_step_or_eoch"] + if "val_loss_step_or_eoch" in checkpoint + else {} + ) + self.best_step_or_epoch = ( + checkpoint["best_step_or_epoch"] if "best_step_or_epoch" in checkpoint else "" + ) + self.start_data_split_i = ( + checkpoint["data_split_i"] if "data_split_i" in checkpoint else 0 + ) + self.batch_total = checkpoint["batch_total"] if "batch_total" in checkpoint else 0 + self.start_step = checkpoint["step"] if "step" in checkpoint else 0 + self.start_step = 0 if self.start_step is None else self.start_step + self.step_in_epoch = ( + checkpoint["step_in_epoch"] if "step_in_epoch" in checkpoint else 0 + ) + self.step_in_epoch = 0 if self.step_in_epoch is None else self.step_in_epoch + print(checkpoint["train_acc_avg"]) + self.train_acc_avg = ( + checkpoint["train_acc_avg"] if "train_acc_avg" in checkpoint else 0 + ) + self.train_loss_avg = ( + checkpoint["train_loss_avg"] if "train_loss_avg" in checkpoint else 0 + ) + model.to(self.device) + print(f"Checkpoint loaded successfully from '{ckpt}'") + else: + print(f"No checkpoint found at '{ckpt}', does not resume status!") + + if self.use_ddp or self.use_fsdp: + dist.barrier() + + def train_epoch( + self, + model=None, + optim=None, + scheduler=None, + scaler=None, + dataloader_train=None, + dataloader_val=None, + epoch=None, + writer=None, + **kwargs, + ): + """ + Defines the training process for a single epoch with gradient accumulation. + Args: + epoch (int): The current epoch number. + """ + if self.use_ddp or self.use_fsdp: + dist.barrier() + logging.info(f"Train epoch: {epoch}, rank: {self.rank}\n") + model.train() + + # Set the number of steps for gradient accumulation + accum_grad = self.accum_grad + # Initialize the gradient accumulation + optim.zero_grad() + speed_stats = {} + + iterator_stop = torch.tensor(0).to(self.device) + + dataloader_train.batch_sampler.set_epoch(epoch) + time_beg = time.perf_counter() + time5 = time_beg + for batch_idx, batch in enumerate(dataloader_train): + if self.use_ddp or self.use_fsdp: + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + if iterator_stop > 0: + break + self.batch_total += 1 + self.step_in_epoch += 1 + time1 = time.perf_counter() + speed_stats["data_load"] = f"{time1-time_beg:0.3f}" + + batch = to_device(batch, self.device) + + my_context = nullcontext + if self.use_ddp or self.use_fsdp: + my_context = model.no_sync if batch_idx % accum_grad != 0 else my_context + with my_context(): + time2 = time.perf_counter() + with maybe_autocast(self.use_fp16): + retval = model(**batch) + + if ( + self.reset_gpu_cache + and (torch.cuda.max_memory_reserved() / 1024 / 1024 / 1024) > 70 + ): + torch.cuda.empty_cache() + + loss, stats, weight = retval + stats = {k: v for k, v in stats.items() if v is not None} + if self.use_ddp or self.use_fsdp: + # Apply weighted averaging for loss and stats + loss = (loss * weight.type(loss.dtype)).sum() + # if distributed, this method can also apply all_reduce() + # stats, weight = recursive_average(stats, weight, distributed=True) + if self.use_ddp or self.use_fsdp: + dist.all_reduce(weight, op=dist.ReduceOp.SUM) + # Now weight is summation over all workers + loss /= weight.sum() # shape:[1] -> shape:[] + # Multiply world_size because DistributedDataParallel + # automatically normalizes the gradient by world_size. + loss *= self.world_size + # loss *= self.world_size + # Scale the loss since we're not updating for every mini-batch + loss = loss / accum_grad + + time3 = time.perf_counter() + speed_stats["forward_time"] = f"{time3 - time2:0.3f}" + if self.use_fp16: + scaler.scale(loss).backward() + else: + loss.backward() + time4 = time.perf_counter() + speed_stats["backward_and_AllReaduce_time"] = f"{time4 - time3:0.3f}" + + self.train_loss_avg = ( + self.train_loss_avg * (batch_idx + kwargs.get("start_step", 0)) + + loss.detach().cpu().item() + ) / (batch_idx + kwargs.get("start_step", 0) + 1) + if "acc" in stats: + self.train_acc_avg = ( + self.train_acc_avg * (batch_idx + kwargs.get("start_step", 0)) + + stats["acc"].detach().cpu().item() + ) / (batch_idx + kwargs.get("start_step", 0) + 1) + + # Perform an optimizer step only after accumulating enough gradients + if (batch_idx + 1) % accum_grad == 0: + # Perform gradient clipping if it is set + if self.grad_clip > 0: + grad_norm = torch.nn.utils.clip_grad_norm_( + model.parameters(), + max_norm=self.grad_clip, + norm_type=self.grad_clip_type, + ) + if not torch.isfinite(grad_norm): + logging.warning( + f"The grad norm is {grad_norm}. Skipping updating the model." + ) + optim.zero_grad() # Reset gradients + continue + + # Execute an optimization step (update model parameters) + if self.use_ddp or self.use_fsdp: + dist.barrier() + if self.use_fp16: + scaler.step(optim) + scaler.update() + else: + optim.step() + scheduler.step() + # Clear gradients for the next accumulation stage + optim.zero_grad(set_to_none=True) + + if self.use_ddp or self.use_fsdp: + train_loss_avg = torch.tensor(self.train_loss_avg, dtype=torch.float32).to( + self.device + ) + train_acc_avg = torch.tensor(self.train_acc_avg, dtype=torch.float32).to( + self.device + ) + dist.all_reduce(train_loss_avg, op=dist.ReduceOp.SUM) + dist.all_reduce(train_acc_avg, op=dist.ReduceOp.SUM) + self.train_loss_avg = train_loss_avg.detach().cpu().item() / self.world_size + self.train_acc_avg = train_acc_avg.detach().cpu().item() / self.world_size + + total_time = f"{(time.perf_counter() - time5)/accum_grad:0.3f}" + time5 = time.perf_counter() + + speed_stats["optim_time"] = f"{time5 - time4:0.3f}" + + speed_stats["total_time"] = total_time + lr = scheduler.get_last_lr()[0] + batch_num_epoch = 1 + if hasattr(dataloader_train, "__len__"): + batch_num_epoch = len(dataloader_train) + self.log( + epoch, + batch_idx, + log_step=batch_idx + kwargs.get("start_step", 0), + step_in_epoch=self.step_in_epoch, + batch_num_epoch=batch_num_epoch, + lr=lr, + loss=loss.detach().cpu().item(), + speed_stats=speed_stats, + stats=stats, + writer=writer, + tag="train", + data_split_i=kwargs.get("data_split_i", 0), + data_split_num=kwargs.get("data_split_num", 1), + ) + + if self.step_in_epoch % self.validate_interval == 0: + self.validate_epoch( + model=model, + dataloader_val=dataloader_val, + epoch=epoch, + writer=writer, + step=batch_idx + 1, + step_in_epoch=self.step_in_epoch, + ) + + if self.step_in_epoch % self.save_checkpoint_interval == 0: + self.save_checkpoint( + epoch, + model=model, + optim=optim, + scheduler=scheduler, + scaler=scaler, + step=batch_idx + 1, + step_in_epoch=self.step_in_epoch, + data_split_i=kwargs.get("data_split_i", 0), + data_split_num=kwargs.get("data_split_num", 1), + train_loss_avg=self.train_loss_avg, + train_acc_avg=self.train_acc_avg, + ) + + time_beg = time.perf_counter() + else: + if self.use_ddp or self.use_fsdp: + iterator_stop.fill_(1) + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + + if self.use_ddp or self.use_fsdp: + dist.barrier() + iterator_stop = torch.tensor(0).to(self.device) + + def validate_epoch( + self, + model=None, + dataloader_val=None, + epoch=None, + writer=None, + **kwargs, + ): + """ + Defines the validation process for a single epoch. + Should be implemented with the actual model validation steps. + + Args: + epoch (int): The current epoch number. + """ + if self.use_ddp or self.use_fsdp: + dist.barrier() + logging.info(f"Validate epoch: {epoch}, rank: {self.rank}\n") + model.eval() + + with torch.no_grad(): + + speed_stats = {} + time5 = time.perf_counter() + iterator_stop = torch.tensor(0).to(self.device) + dataloader_val.batch_sampler.set_epoch(epoch) + for batch_idx, batch in enumerate(dataloader_val): + if self.use_ddp or self.use_fsdp: + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + if iterator_stop > 0: + break + time1 = time.perf_counter() + speed_stats["data_load"] = f"{time1 - time5:0.3f}" + batch = to_device(batch, self.device) + time2 = time.perf_counter() + retval = model(**batch) + time3 = time.perf_counter() + speed_stats["forward_time"] = f"{time3 - time2:0.3f}" + loss, stats, weight = retval + stats = {k: v for k, v in stats.items() if v is not None} + if self.use_ddp or self.use_fsdp: + # Apply weighted averaging for loss and stats + loss = (loss * weight.type(loss.dtype)).sum() + # if distributed, this method can also apply all_reduce() + # stats, weight = recursive_average(stats, weight, distributed=True) + if self.use_ddp or self.use_fsdp: + dist.all_reduce(weight, op=dist.ReduceOp.SUM) + # Now weight is summation over all workers + loss /= weight.sum() # shape:[1] -> shape:[] + # Multiply world_size because DistributedDataParallel + # automatically normalizes the gradient by world_size. + loss *= self.world_size + # Scale the loss since we're not updating for every mini-batch + loss = loss + time4 = time.perf_counter() + + self.val_loss_avg = (self.val_loss_avg * batch_idx + loss.detach().cpu().item()) / ( + batch_idx + 1 + ) + if "acc" in stats: + self.val_acc_avg = ( + self.val_acc_avg * batch_idx + stats["acc"].detach().cpu().item() + ) / (batch_idx + 1) + if self.use_ddp or self.use_fsdp: + val_loss_avg = torch.tensor(self.val_loss_avg, dtype=torch.float32).to( + self.device + ) + val_acc_avg = torch.tensor(self.val_acc_avg, dtype=torch.float32).to( + self.device + ) + dist.all_reduce(val_loss_avg, op=dist.ReduceOp.SUM) + dist.all_reduce(val_acc_avg, op=dist.ReduceOp.SUM) + self.val_loss_avg = val_loss_avg.detach().cpu().item() / self.world_size + self.val_acc_avg = val_acc_avg.detach().cpu().item() / self.world_size + time5 = time.perf_counter() + batch_num_epoch = 1 + if hasattr(dataloader_val, "__len__"): + batch_num_epoch = len(dataloader_val) + self.log( + epoch, + batch_idx, + batch_num_epoch=batch_num_epoch, + lr=0.0, + loss=loss.detach().cpu().item(), + speed_stats=speed_stats, + stats=stats, + writer=writer, + tag="val", + ) + + else: + if self.use_ddp or self.use_fsdp: + iterator_stop.fill_(1) + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + + if kwargs.get("step_in_epoch", None) is None: + ckpt_name = f"model.pt.ep{epoch}" + else: + ckpt_name = f'model.pt.ep{epoch}.{kwargs.get("step_in_epoch")}' + self.val_acc_step_or_eoch[ckpt_name] = self.val_acc_avg + self.val_loss_step_or_eoch[ckpt_name] = self.val_loss_avg + model.train() + + if self.use_ddp or self.use_fsdp: + dist.barrier() + iterator_stop = torch.tensor(0).to(self.device) + + def log( + self, + epoch=0, + batch_idx=0, + step_in_epoch=0, + batch_num_epoch=-1, + lr=0.0, + loss=0.0, + speed_stats=None, + stats=None, + writer=None, + tag="train", + data_split_i=0, + data_split_num=1, + log_step=None, + **kwargs, + ): + + if (batch_idx + 1) % self.log_interval == 0: + batch_idx = log_step if log_step is not None else batch_idx + gpu_info = ( + "GPU, memory: usage: {:.3f} GB, " + "peak: {:.3f} GB, " + "cache: {:.3f} GB, " + "cache_peak: {:.3f} GB".format( + torch.cuda.memory_allocated() / 1024 / 1024 / 1024, + torch.cuda.max_memory_allocated() / 1024 / 1024 / 1024, + torch.cuda.memory_reserved() / 1024 / 1024 / 1024, + torch.cuda.max_memory_reserved() / 1024 / 1024 / 1024, + ) + ) + + loss_avg_epoch = getattr(self, f"{tag}_loss_avg") + acc_avg_epoch = getattr(self, f"{tag}_acc_avg") + description = ( + f"{tag}, " + f"rank: {self.rank}, " + f"epoch: {epoch}/{self.max_epoch}, " + f"data_slice: {data_split_i}/{data_split_num}, " + f"step_in_slice: {batch_idx + 1}/{batch_num_epoch}, step_in_epoch: {step_in_epoch}, total step: {self.batch_total}, " + f"(loss_avg_rank: {loss:.3f}), " + f"(loss_avg_slice: {loss_avg_epoch:.3f}), " + f"(ppl_avg_slice: {math.exp(loss_avg_epoch):.3e}), " + f"(acc_avg_slice: {acc_avg_epoch:.3f}), " + f"(lr: {lr:.3e}), " + f"{[(k, round(v.detach().cpu().item(), 3)) for k, v in stats.items()]}, " + f"{speed_stats}, " + f"{gpu_info}" + ) + logging.info(description) + + description_dict = { + f"rank{self.rank}_loss/{tag}": loss, + f"rank{self.rank}_lr/{tag}": lr, + } + + if writer is not None: + writer.add_scalar(f"rank{self.rank}_loss/{tag}", loss, self.batch_total) + writer.add_scalar(f"rank{self.rank}_lr/{tag}", lr, self.batch_total) + for key, var in stats.items(): + writer.add_scalar( + f"stats_rank{self.rank}_{key}/{tag}", var.item(), self.batch_total + ) + description_dict[f"stats_rank{self.rank}_{key}/{tag}"] = var.item() + for key, var in speed_stats.items(): + writer.add_scalar( + f"stats_rank{self.rank}_{key}/{tag}", eval(var), self.batch_total + ) + description_dict[f"stats_rank{self.rank}_{key}/{tag}"] = eval(var) + if self.use_wandb and wandb is not None: + wandb.log( + description_dict, + setp=self.batch_total, + ) + + def close(self, writer=None): + + if self.use_ddp or self.use_fsdp: + dist.barrier() + + if writer is not None: + writer.close() + + if self.use_ddp or self.use_fsdp: + torch.distributed.destroy_process_group() diff --git a/funasr/train_utils/trainer_ds.py b/funasr/train_utils/trainer_ds.py new file mode 100644 index 0000000..7188921 --- /dev/null +++ b/funasr/train_utils/trainer_ds.py @@ -0,0 +1,800 @@ +import math +import os +import time +import torch +import logging +from tqdm import tqdm +from datetime import datetime +import torch.distributed as dist +from torch.cuda.amp import autocast, GradScaler +from contextlib import nullcontext, contextmanager +from pathlib import Path +from torch.nn.parallel import DistributedDataParallel as DDP +from torch.distributed.fsdp import FullyShardedDataParallel as FSDP +from funasr.train_utils.device_funcs import to_device +from funasr.train_utils.recursive_op import recursive_average +from funasr.train_utils.average_nbest_models import average_checkpoints +from torch.distributed.fsdp.sharded_grad_scaler import ShardedGradScaler + +try: + import wandb +except: + wandb = None + + +@contextmanager +def maybe_autocast(enabled): + if enabled: + with autocast(): + yield + else: + yield + + +class Trainer: + """ + A simple trainer class for training a PyTorch model, saving checkpoints at the end of each epoch, + and optionally resuming from a saved checkpoint. + + Attributes: + max_epoch (int): Maximum number of epochs for training. + model (torch.nn.Module): The model to be trained. + optim (torch.optim.Optimizer): The optimizer to use for training. + scheduler (torch.optim.lr_scheduler._LRScheduler): The learning rate scheduler. + dataloader_train (torch.utils.data.DataLoader): DataLoader for the training dataset. + dataloader_val (torch.utils.data.DataLoader): DataLoader for the validation dataset. + output_dir (str): Directory where model checkpoints will be saved. + resume (str, optional): Path to a checkpoint to resume training from. + """ + + def __init__( + self, + rank=0, + local_rank=0, + world_size=1, + use_ddp: bool = False, + use_fsdp: bool = False, + use_fp16: bool = False, + use_deepspeed: bool = False, + output_dir: str = "./", + **kwargs, + ): + """ + Initializes the Trainer class with the model, optimizer, scheduler, dataloaders, and other settings. + + Args: + model (torch.nn.Module): The model to be trained. + optim (torch.optim.Optimizer): The optimizer to use for training. + scheduler (torch.optim.lr_scheduler._LRScheduler): The learning rate scheduler. + dataloader_train (torch.utils.data.DataLoader): The DataLoader for the training dataset. + dataloader_val (torch.utils.data.DataLoader): The DataLoader for the validation dataset. + **kwargs: Additional keyword arguments: + max_epoch (int): The maximum number of epochs for training. + output_dir (str): The directory where model checkpoints will be saved. Default is './'. + resume (str, optional): The file path to a checkpoint to resume training from. + """ + self.rank = kwargs.get("rank", 0) + self.local_rank = local_rank + self.world_size = world_size + self.use_ddp = use_ddp + self.use_fsdp = use_fsdp + self.use_deepspeed = use_deepspeed + self.device = kwargs.get("device", "cuda") + + self.output_dir = output_dir + if not os.path.exists(self.output_dir): + os.makedirs(self.output_dir, exist_ok=True) + self.resume = kwargs.get("resume", True) + self.start_epoch = 0 + self.max_epoch = kwargs.get("max_epoch", 100) + + # self.kwargs = kwargs + self.log_interval = kwargs.get("log_interval", 50) + self.batch_total = 0 + self.use_fp16 = use_fp16 + self.save_checkpoint_interval = kwargs.get("save_checkpoint_interval", 5000) + self.validate_interval = kwargs.get("validate_interval", 5000) + self.keep_nbest_models = kwargs.get("keep_nbest_models", 500) + self.avg_keep_nbest_models_type = kwargs.get("avg_keep_nbest_models_type", "acc") + self.avg_nbest_model = kwargs.get("avg_nbest_model", 10) + self.accum_grad = kwargs.get("accum_grad", 1) + self.grad_clip = kwargs.get("grad_clip", 10.0) + self.grad_clip_type = kwargs.get("grad_clip_type", 2.0) + + self.train_acc_avg = 0.0 + self.train_loss_avg = 0.0 + self.val_acc_avg = 0.0 + self.val_loss_avg = 0.0 + self.best_acc_idx = 0 + self.saved_ckpts = {} + self.step_or_epoch = -1 + self.best_step_or_epoch = "" + self.val_acc_step_or_eoch = {} + self.val_loss_step_or_eoch = {} + + self.reset_gpu_cache = kwargs.get("reset_gpu_cache", False) + self.start_data_split_i = 0 + self.start_step = 0 + self.step_in_epoch = 0 + self.use_wandb = kwargs.get("use_wandb", False) + if self.use_wandb: + wandb.login(key=kwargs.get("wandb_token")) + wandb.init( + config=kwargs, + project=kwargs.get("wandb_project", "my_project"), + entity=kwargs.get("wandb_team", "my_team"), + name=kwargs.get("wandb_exp_name", "my_exp"), + dir=output_dir, + job_type="training", + reinit=True, + ) + + def save_checkpoint( + self, + epoch, + step=None, + model=None, + optim=None, + scheduler=None, + scaler=None, + step_in_epoch=None, + **kwargs, + ): + """ + Saves a checkpoint containing the model's state, the optimizer's state, + and the scheduler's state at the end of the given epoch. This method is + intended to be called at the end of each epoch to save the training progress. + + Args: + epoch (int): The epoch number at which the checkpoint is being saved. + """ + + step_in_epoch = None if step is None else step_in_epoch + if self.rank == 0: + logging.info(f"Save checkpoint: {epoch}, rank: {self.local_rank}\n") + # self.step_or_epoch += 1 + state = { + "epoch": epoch, + "state_dict": model.state_dict(), + "optimizer": optim.state_dict(), + "scheduler": scheduler.state_dict(), + "saved_ckpts": self.saved_ckpts, + "val_acc_step_or_eoch": self.val_acc_step_or_eoch, + "val_loss_step_or_eoch": self.val_loss_step_or_eoch, + "best_step_or_epoch": self.best_step_or_epoch, + "avg_keep_nbest_models_type": self.avg_keep_nbest_models_type, + "step": step, + "step_in_epoch": step_in_epoch, + "data_split_i": kwargs.get("data_split_i", 0), + "data_split_num": kwargs.get("data_split_num", 1), + "batch_total": self.batch_total, + "train_loss_avg": kwargs.get("train_loss_avg", 0), + "train_acc_avg": kwargs.get("train_acc_avg", 0), + } + step = step_in_epoch + if hasattr(model, "module"): + state["state_dict"] = model.module.state_dict() + + if scaler: + state["scaler_state"] = scaler.state_dict() + # Create output directory if it does not exist + os.makedirs(self.output_dir, exist_ok=True) + if step is None: + ckpt_name = f"model.pt.ep{epoch}" + else: + ckpt_name = f"model.pt.ep{epoch}.{step}" + filename = os.path.join(self.output_dir, ckpt_name) + torch.save(state, filename) + + logging.info(f"\nCheckpoint saved to {filename}\n") + latest = Path(os.path.join(self.output_dir, f"model.pt")) + torch.save(state, latest) + if self.best_step_or_epoch == "": + self.best_step_or_epoch = ckpt_name + + if self.avg_keep_nbest_models_type == "acc": + if ( + self.val_acc_step_or_eoch[ckpt_name] + >= self.val_acc_step_or_eoch[self.best_step_or_epoch] + ): + self.best_step_or_epoch = ckpt_name + best_ckpt = Path(os.path.join(self.output_dir, f"model.pt.best")) + torch.save(state, best_ckpt) + logging.info( + f"Update best acc: {self.val_acc_step_or_eoch[self.best_step_or_epoch]:.4f}, {best_ckpt}" + ) + else: + logging.info( + f"No improvement in acc: {self.val_acc_step_or_eoch[ckpt_name]:.4f} < {self.val_acc_step_or_eoch[self.best_step_or_epoch]:.4f}, {os.path.join(self.output_dir, self.best_step_or_epoch)}" + ) + elif self.avg_keep_nbest_models_type == "loss": + if ( + self.val_loss_step_or_eoch[ckpt_name] + <= self.val_loss_step_or_eoch[self.best_step_or_epoch] + ): + self.best_step_or_epoch = ckpt_name + best_ckpt = Path(os.path.join(self.output_dir, f"model.pt.best")) + torch.save(state, best_ckpt) + logging.info( + f"Update best loss: {self.val_loss_step_or_eoch[self.best_step_or_epoch]:.4f}, {best_ckpt}" + ) + else: + logging.info( + f"No improvement in loss: {self.val_loss_step_or_eoch[ckpt_name]:.4f} > {self.val_loss_step_or_eoch[self.best_step_or_epoch]:.4f}, {os.path.join(self.output_dir, self.best_step_or_epoch)}" + ) + else: + print("Undo") + self.saved_ckpts[ckpt_name] = getattr( + self, f"val_{self.avg_keep_nbest_models_type}_step_or_eoch" + )[ckpt_name] + if self.keep_nbest_models > 0: + if len(self.saved_ckpts) > self.keep_nbest_models: + if self.avg_keep_nbest_models_type == "acc": + key = min(self.saved_ckpts, key=self.saved_ckpts.get) + else: + key = max(self.saved_ckpts, key=self.saved_ckpts.get) + if key in self.saved_ckpts: + del self.saved_ckpts[key] + filename = os.path.join(self.output_dir, key) + logging.info(f"Delete: {filename}") + if os.path.exists(filename): + os.remove(filename) + + if self.use_ddp or self.use_fsdp: + dist.barrier() + + def resume_checkpoint( + self, + model=None, + optim=None, + scheduler=None, + scaler=None, + ): + """ + Resumes training from a checkpoint at the given file path. + Loads the model's state, the optimizer's state, and the scheduler's state. + + Args: + resume_path (str): The file path to the checkpoint to resume from. + """ + if self.resume: + ckpt = os.path.join(self.output_dir, "model.pt") + if os.path.isfile(ckpt): + checkpoint = torch.load(ckpt, map_location="cpu") + self.start_epoch = checkpoint["epoch"] + # self.model.load_state_dict(checkpoint['state_dict']) + src_state = checkpoint["state_dict"] + dst_state = model.state_dict() + for k in dst_state.keys(): + if not k.startswith("module.") and "module." + k in src_state.keys(): + k_ddp = "module." + k + elif k.startswith("module.") and "module." + k not in src_state.keys(): + k_ddp = k.replace("module.", "", 1) + else: + k_ddp = k + if k_ddp in src_state.keys(): + dst_state[k] = src_state[k_ddp] + else: + print(f"Miss key in ckpt: model: {k}, ckpt: {k_ddp}") + + model.load_state_dict(dst_state) + optim.load_state_dict(checkpoint["optimizer"]) + scheduler.load_state_dict(checkpoint["scheduler"]) + if scaler is not None and "scaler_state" in checkpoint: + scaler.load_state_dict(checkpoint["scaler_state"]) + + self.saved_ckpts = checkpoint["saved_ckpts"] + self.val_acc_step_or_eoch = ( + checkpoint["val_acc_step_or_eoch"] + if "val_acc_step_or_eoch" in checkpoint + else {} + ) + self.val_loss_step_or_eoch = ( + checkpoint["val_loss_step_or_eoch"] + if "val_loss_step_or_eoch" in checkpoint + else {} + ) + self.best_step_or_epoch = ( + checkpoint["best_step_or_epoch"] if "best_step_or_epoch" in checkpoint else "" + ) + self.start_data_split_i = ( + checkpoint["data_split_i"] if "data_split_i" in checkpoint else 0 + ) + self.batch_total = checkpoint["batch_total"] if "batch_total" in checkpoint else 0 + self.start_step = checkpoint["step"] if "step" in checkpoint else 0 + self.start_step = 0 if self.start_step is None else self.start_step + self.step_in_epoch = ( + checkpoint["step_in_epoch"] if "step_in_epoch" in checkpoint else 0 + ) + self.step_in_epoch = 0 if self.step_in_epoch is None else self.step_in_epoch + print(checkpoint["train_acc_avg"]) + self.train_acc_avg = ( + checkpoint["train_acc_avg"] if "train_acc_avg" in checkpoint else 0 + ) + self.train_loss_avg = ( + checkpoint["train_loss_avg"] if "train_loss_avg" in checkpoint else 0 + ) + model.to(self.device) + print(f"Checkpoint loaded successfully from '{ckpt}'") + else: + print(f"No checkpoint found at '{ckpt}', does not resume status!") + + if self.use_ddp or self.use_fsdp: + dist.barrier() + + def train_epoch( + self, + model=None, + optim=None, + scheduler=None, + scaler=None, + dataloader_train=None, + dataloader_val=None, + epoch=None, + writer=None, + **kwargs, + ): + """ + Defines the training process for a single epoch with gradient accumulation. + Args: + epoch (int): The current epoch number. + """ + if self.use_ddp or self.use_fsdp: + dist.barrier() + logging.info(f"Train epoch: {epoch}, rank: {self.rank}\n") + model.train() + + # Set the number of steps for gradient accumulation + accum_grad = self.accum_grad + # Initialize the gradient accumulation + optim.zero_grad() + speed_stats = {} + + iterator_stop = torch.tensor(0).to(self.device) + + dataloader_train.batch_sampler.set_epoch(epoch) + time_beg = time.perf_counter() + time5 = time_beg + for batch_idx, batch in enumerate(dataloader_train): + if self.use_ddp or self.use_fsdp: + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + if iterator_stop > 0: + break + self.batch_total += 1 + self.step_in_epoch += 1 + time1 = time.perf_counter() + speed_stats["data_load"] = f"{time1-time_beg:0.3f}" + + batch = to_device(batch, self.device) + + my_context = nullcontext + if self.use_ddp or self.use_fsdp: + my_context = model.no_sync if batch_idx % accum_grad != 0 else my_context + with my_context(): + time2 = time.perf_counter() + loss_dict = {} + self.forward_step(model, batch, loss_dict=loss_dict) + + time3 = time.perf_counter() + speed_stats["forward_time"] = f"{time3 - time2:0.3f}" + self.backward_step(model, scaler, loss_dict=loss_dict) + + time4 = time.perf_counter() + speed_stats["backward_and_AllReaduce_time"] = f"{time4 - time3:0.3f}" + + # self.train_loss_avg = ( + # self.train_loss_avg * (batch_idx + kwargs.get("start_step", 0)) + # + loss.detach().cpu().item() + # ) / (batch_idx + kwargs.get("start_step", 0) + 1) + # if "acc" in stats: + # self.train_acc_avg = ( + # self.train_acc_avg * (batch_idx + kwargs.get("start_step", 0)) + # + stats["acc"].detach().cpu().item() + # ) / (batch_idx + kwargs.get("start_step", 0) + 1) + + self.update_step(model, optim, scheduler, scaler, loss_dict) + # Perform an optimizer step only after accumulating enough gradients + + if self.step_in_epoch % self.validate_interval == 0: + self.validate_epoch( + model=model, + dataloader_val=dataloader_val, + epoch=epoch, + writer=writer, + step=batch_idx + 1, + step_in_epoch=self.step_in_epoch, + ) + + if self.step_in_epoch % self.save_checkpoint_interval == 0: + self.save_checkpoint( + epoch, + model=model, + optim=optim, + scheduler=scheduler, + scaler=scaler, + step=batch_idx + 1, + step_in_epoch=self.step_in_epoch, + data_split_i=kwargs.get("data_split_i", 0), + data_split_num=kwargs.get("data_split_num", 1), + train_loss_avg=self.train_loss_avg, + train_acc_avg=self.train_acc_avg, + ) + + time_beg = time.perf_counter() + else: + if self.use_ddp or self.use_fsdp: + iterator_stop.fill_(1) + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + + if self.use_ddp or self.use_fsdp: + dist.barrier() + iterator_stop = torch.tensor(0).to(self.device) + + def forward_step(self, model, batch, loss_dict={}): + with maybe_autocast(self.use_fp16): + retval = model(**batch) + + if ( + self.reset_gpu_cache + and (torch.cuda.max_memory_reserved() / 1024 / 1024 / 1024) > 70 + ): + torch.cuda.empty_cache() + + loss, stats, weight = retval + stats = {k: v for k, v in stats.items() if v is not None} + # if self.use_ddp or self.use_fsdp: + # # Apply weighted averaging for loss and stats + # loss = (loss * weight.type(loss.dtype)).sum() + # # if distributed, this method can also apply all_reduce() + # # stats, weight = recursive_average(stats, weight, distributed=True) + # if self.use_ddp or self.use_fsdp: + # dist.all_reduce(weight, op=dist.ReduceOp.SUM) + # # Now weight is summation over all workers + # loss /= weight.sum() # shape:[1] -> shape:[] + # # Multiply world_size because DistributedDataParallel + # # automatically normalizes the gradient by world_size. + # loss *= self.world_size + # loss *= self.world_size + # Scale the loss since we're not updating for every mini-batch + + loss_dict["loss"] = loss + loss_dict["stats"] = stats + loss_dict["weight"] = weight + + def backward_step(self, model, scaler, loss_dict={}): + loss = loss_dict["loss"] + + if self.use_deepspeed: + scaled_loss = model.backward(loss) + else: + loss = loss / self.accum_grad + if self.use_fp16: + scaler.scale(loss).backward() + else: + loss.backward() + + def update_step(self, model, optim, scheduler, scaler, batch_idx=0, loss_dict=loss_dict): + if (batch_idx + 1) % self.accum_grad == 0: + # Perform gradient clipping if it is set + if self.grad_clip > 0: + grad_norm = torch.nn.utils.clip_grad_norm_( + model.parameters(), + max_norm=self.grad_clip, + norm_type=self.grad_clip_type, + ) + if not torch.isfinite(grad_norm): + logging.warning(f"The grad norm is {grad_norm}. Skipping updating the model.") + optim.zero_grad() # Reset gradients + return + + # Execute an optimization step (update model parameters) + if self.use_ddp or self.use_fsdp: + dist.barrier() + if self.use_fp16: + scaler.step(optim) + scaler.update() + else: + optim.step() + scheduler.step() + # Clear gradients for the next accumulation stage + optim.zero_grad(set_to_none=True) + + if self.use_ddp or self.use_fsdp: + train_loss_avg = torch.tensor(self.train_loss_avg, dtype=torch.float32).to( + self.device + ) + train_acc_avg = torch.tensor(self.train_acc_avg, dtype=torch.float32).to( + self.device + ) + dist.all_reduce(train_loss_avg, op=dist.ReduceOp.SUM) + dist.all_reduce(train_acc_avg, op=dist.ReduceOp.SUM) + self.train_loss_avg = train_loss_avg.detach().cpu().item() / self.world_size + self.train_acc_avg = train_acc_avg.detach().cpu().item() / self.world_size + + total_time = f"{(time.perf_counter() - time5) / accum_grad:0.3f}" + time5 = time.perf_counter() + + speed_stats["optim_time"] = f"{time5 - time4:0.3f}" + + speed_stats["total_time"] = total_time + lr = scheduler.get_last_lr()[0] + batch_num_epoch = 1 + if hasattr(dataloader_train, "__len__"): + batch_num_epoch = len(dataloader_train) + self.log( + epoch, + batch_idx, + log_step=batch_idx + kwargs.get("start_step", 0), + step_in_epoch=self.step_in_epoch, + batch_num_epoch=batch_num_epoch, + lr=lr, + loss=loss.detach().cpu().item(), + speed_stats=speed_stats, + stats=stats, + writer=writer, + tag="train", + data_split_i=kwargs.get("data_split_i", 0), + data_split_num=kwargs.get("data_split_num", 1), + ) + + def validate_epoch( + self, + model=None, + dataloader_val=None, + epoch=None, + writer=None, + **kwargs, + ): + """ + Defines the validation process for a single epoch. + Should be implemented with the actual model validation steps. + + Args: + epoch (int): The current epoch number. + """ + if self.use_ddp or self.use_fsdp: + dist.barrier() + logging.info(f"Validate epoch: {epoch}, rank: {self.rank}\n") + model.eval() + + with torch.no_grad(): + + speed_stats = {} + time5 = time.perf_counter() + iterator_stop = torch.tensor(0).to(self.device) + dataloader_val.batch_sampler.set_epoch(epoch) + for batch_idx, batch in enumerate(dataloader_val): + if self.use_ddp or self.use_fsdp: + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + if iterator_stop > 0: + break + time1 = time.perf_counter() + speed_stats["data_load"] = f"{time1 - time5:0.3f}" + batch = to_device(batch, self.device) + time2 = time.perf_counter() + retval = model(**batch) + time3 = time.perf_counter() + speed_stats["forward_time"] = f"{time3 - time2:0.3f}" + loss, stats, weight = retval + stats = {k: v for k, v in stats.items() if v is not None} + if self.use_ddp or self.use_fsdp: + # Apply weighted averaging for loss and stats + loss = (loss * weight.type(loss.dtype)).sum() + # if distributed, this method can also apply all_reduce() + # stats, weight = recursive_average(stats, weight, distributed=True) + if self.use_ddp or self.use_fsdp: + dist.all_reduce(weight, op=dist.ReduceOp.SUM) + # Now weight is summation over all workers + loss /= weight.sum() # shape:[1] -> shape:[] + # Multiply world_size because DistributedDataParallel + # automatically normalizes the gradient by world_size. + loss *= self.world_size + # Scale the loss since we're not updating for every mini-batch + loss = loss + time4 = time.perf_counter() + + self.val_loss_avg = (self.val_loss_avg * batch_idx + loss.detach().cpu().item()) / ( + batch_idx + 1 + ) + if "acc" in stats: + self.val_acc_avg = ( + self.val_acc_avg * batch_idx + stats["acc"].detach().cpu().item() + ) / (batch_idx + 1) + if self.use_ddp or self.use_fsdp: + val_loss_avg = torch.tensor(self.val_loss_avg, dtype=torch.float32).to( + self.device + ) + val_acc_avg = torch.tensor(self.val_acc_avg, dtype=torch.float32).to( + self.device + ) + dist.all_reduce(val_loss_avg, op=dist.ReduceOp.SUM) + dist.all_reduce(val_acc_avg, op=dist.ReduceOp.SUM) + self.val_loss_avg = val_loss_avg.detach().cpu().item() / self.world_size + self.val_acc_avg = val_acc_avg.detach().cpu().item() / self.world_size + time5 = time.perf_counter() + batch_num_epoch = 1 + if hasattr(dataloader_val, "__len__"): + batch_num_epoch = len(dataloader_val) + self.log( + epoch, + batch_idx, + batch_num_epoch=batch_num_epoch, + lr=0.0, + loss=loss.detach().cpu().item(), + speed_stats=speed_stats, + stats=stats, + writer=writer, + tag="val", + ) + + else: + if self.use_ddp or self.use_fsdp: + iterator_stop.fill_(1) + dist.all_reduce(iterator_stop, dist.ReduceOp.SUM) + + if kwargs.get("step_in_epoch", None) is None: + ckpt_name = f"model.pt.ep{epoch}" + else: + ckpt_name = f'model.pt.ep{epoch}.{kwargs.get("step_in_epoch")}' + self.val_acc_step_or_eoch[ckpt_name] = self.val_acc_avg + self.val_loss_step_or_eoch[ckpt_name] = self.val_loss_avg + model.train() + + if self.use_ddp or self.use_fsdp: + dist.barrier() + iterator_stop = torch.tensor(0).to(self.device) + + def log( + self, + epoch=0, + batch_idx=0, + step_in_epoch=0, + batch_num_epoch=-1, + lr=0.0, + loss=0.0, + speed_stats=None, + stats=None, + writer=None, + tag="train", + data_split_i=0, + data_split_num=1, + log_step=None, + **kwargs, + ): + + if (batch_idx + 1) % self.log_interval == 0: + batch_idx = log_step if log_step is not None else batch_idx + gpu_info = ( + "GPU, memory: usage: {:.3f} GB, " + "peak: {:.3f} GB, " + "cache: {:.3f} GB, " + "cache_peak: {:.3f} GB".format( + torch.cuda.memory_allocated() / 1024 / 1024 / 1024, + torch.cuda.max_memory_allocated() / 1024 / 1024 / 1024, + torch.cuda.memory_reserved() / 1024 / 1024 / 1024, + torch.cuda.max_memory_reserved() / 1024 / 1024 / 1024, + ) + ) + + loss_avg_epoch = getattr(self, f"{tag}_loss_avg") + acc_avg_epoch = getattr(self, f"{tag}_acc_avg") + description = ( + f"{tag}, " + f"rank: {self.rank}, " + f"epoch: {epoch}/{self.max_epoch}, " + f"data_slice: {data_split_i}/{data_split_num}, " + f"step_in_slice: {batch_idx + 1}/{batch_num_epoch}, step_in_epoch: {step_in_epoch}, total step: {self.batch_total}, " + f"(loss_avg_rank: {loss:.3f}), " + f"(loss_avg_slice: {loss_avg_epoch:.3f}), " + f"(ppl_avg_slice: {math.exp(loss_avg_epoch):.3e}), " + f"(acc_avg_slice: {acc_avg_epoch:.3f}), " + f"(lr: {lr:.3e}), " + f"{[(k, round(v.detach().cpu().item(), 3)) for k, v in stats.items()]}, " + f"{speed_stats}, " + f"{gpu_info}" + ) + logging.info(description) + + description_dict = { + f"rank{self.rank}_loss/{tag}": loss, + f"rank{self.rank}_lr/{tag}": lr, + } + + if writer is not None: + writer.add_scalar(f"rank{self.rank}_loss/{tag}", loss, self.batch_total) + writer.add_scalar(f"rank{self.rank}_lr/{tag}", lr, self.batch_total) + for key, var in stats.items(): + writer.add_scalar( + f"stats_rank{self.rank}_{key}/{tag}", var.item(), self.batch_total + ) + description_dict[f"stats_rank{self.rank}_{key}/{tag}"] = var.item() + for key, var in speed_stats.items(): + writer.add_scalar( + f"stats_rank{self.rank}_{key}/{tag}", eval(var), self.batch_total + ) + description_dict[f"stats_rank{self.rank}_{key}/{tag}"] = eval(var) + if self.use_wandb and wandb is not None: + wandb.log( + description_dict, + setp=self.batch_total, + ) + + def close(self, writer=None): + + if self.use_ddp or self.use_fsdp: + dist.barrier() + + if writer is not None: + writer.close() + + if self.use_ddp or self.use_fsdp: + torch.distributed.destroy_process_group() + + def warp_model(self, model, **kwargs): + + if self.use_deepspeed: + from deepspeed.runtime.zero.stage_1_and_2 import ( + estimate_zero2_model_states_mem_needs_all_live, + ) + from deepspeed.runtime.zero.stage3 import estimate_zero3_model_states_mem_needs_all_live + from deepspeed.utils.zero_to_fp32 import convert_zero_checkpoint_to_fp32_state_dict + + local_world_size = int(os.environ.get("LOCAL_WORLD_SIZE", 1)) + world_size = int(os.environ.get("WORLD_SIZE", 1)) + + # NOTE(xcsong): look in detail how the memory estimator API works: + # https://deepspeed.readthedocs.io/en/latest/memory.html#discussion + if int(os.environ.get("RANK", 0)) == 0: + logging.info("Estimating model states memory needs (zero2)...") + estimate_zero2_model_states_mem_needs_all_live( + model, + num_gpus_per_node=local_world_size, + num_nodes=world_size // local_world_size, + ) + logging.info("Estimating model states memory needs (zero3)...") + estimate_zero3_model_states_mem_needs_all_live( + model, + num_gpus_per_node=local_world_size, + num_nodes=world_size // local_world_size, + ) + device = None # Init device later + pass # Init DeepSpeed later + + elif self.use_ddp: + local_rank = int(os.environ.get("LOCAL_RANK", 0)) + model = model.cuda(local_rank) + model = DDP( + model, + device_ids=[local_rank], + find_unused_parameters=kwargs.get("train_conf", {}).get( + "find_unused_parameters", False + ), + ) + # elif self.use_fsdp: + # # model = FSDP(model).cuda(local_rank) + # + # def custom_auto_wrap_policy( + # module: nn.Module, + # recurse: bool, + # nonwrapped_numel: int, + # # Additional custom arguments + # min_num_params: int = int(1e8), + # ) -> bool: + # # 根据自定义逻辑决定是否包装模块 + # is_large = unwrapped_params >= min_num_params + # requires_grad_uniform = len({p.requires_grad for p in module.parameters()}) == 1 + # return is_large and requires_grad_uniform + # + # # Configure a custom `min_num_params` + # my_auto_wrap_policy = functools.partial(custom_auto_wrap_policy, min_num_params=int(1e5)) + # torch.cuda.set_device(local_rank) + # model = FSDP( + # model, + # auto_wrap_policy=custom_auto_wrap_policy, + # mixed_precision=None, + # device_id=torch.cuda.current_device(), + # ) + else: + model = model.to(device=kwargs.get("device", "cuda")) + + return model diff --git a/funasr/utils/__init__.py b/funasr/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funasr/utils/datadir_writer.py b/funasr/utils/datadir_writer.py new file mode 100644 index 0000000..882db77 --- /dev/null +++ b/funasr/utils/datadir_writer.py @@ -0,0 +1,70 @@ +from pathlib import Path +from typing import Union +import warnings + + +class DatadirWriter: + """Writer class to create kaldi like data directory. + + Examples: + >>> with DatadirWriter("output") as writer: + ... # output/sub.txt is created here + ... subwriter = writer["sub.txt"] + ... # Write "uttidA some/where/a.wav" + ... subwriter["uttidA"] = "some/where/a.wav" + ... subwriter["uttidB"] = "some/where/b.wav" + + """ + + def __init__(self, p: Union[Path, str]): + self.path = Path(p) + self.chilidren = {} + self.fd = None + self.has_children = False + self.keys = set() + + def __enter__(self): + return self + + def __getitem__(self, key: str) -> "DatadirWriter": + if self.fd is not None: + raise RuntimeError("This writer points out a file") + + if key not in self.chilidren: + w = DatadirWriter((self.path / key)) + self.chilidren[key] = w + self.has_children = True + + retval = self.chilidren[key] + return retval + + def __setitem__(self, key: str, value: str): + if self.has_children: + raise RuntimeError("This writer points out a directory") + if key in self.keys: + warnings.warn(f"Duplicated: {key}") + + if self.fd is None: + self.path.parent.mkdir(parents=True, exist_ok=True) + self.fd = self.path.open("w", encoding="utf-8") + + self.keys.add(key) + self.fd.write(f"{key} {value}\n") + self.fd.flush() + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + def close(self): + if self.has_children: + prev_child = None + for child in self.chilidren.values(): + child.close() + if prev_child is not None and prev_child.keys != child.keys: + warnings.warn( + f"Ids are mismatching between " f"{prev_child.path} and {child.path}" + ) + prev_child = child + + elif self.fd is not None: + self.fd.close() diff --git a/funasr/utils/export_utils.py b/funasr/utils/export_utils.py new file mode 100644 index 0000000..bc79539 --- /dev/null +++ b/funasr/utils/export_utils.py @@ -0,0 +1,72 @@ +import os +import torch + + +def export_onnx(model, data_in=None, quantize: bool = False, opset_version: int = 14, **kwargs): + model_scripts = model.export(**kwargs) + export_dir = kwargs.get("output_dir", os.path.dirname(kwargs.get("init_param"))) + os.makedirs(export_dir, exist_ok=True) + + if not isinstance(model_scripts, (list, tuple)): + model_scripts = (model_scripts,) + for m in model_scripts: + m.eval() + _onnx( + m, + data_in=data_in, + quantize=quantize, + opset_version=opset_version, + export_dir=export_dir, + **kwargs + ) + print("output dir: {}".format(export_dir)) + + return export_dir + + +def _onnx( + model, + data_in=None, + quantize: bool = False, + opset_version: int = 14, + export_dir: str = None, + **kwargs +): + + dummy_input = model.export_dummy_inputs() + + verbose = kwargs.get("verbose", False) + + export_name = model.export_name() if hasattr(model, "export_name") else "model.onnx" + model_path = os.path.join(export_dir, export_name) + torch.onnx.export( + model, + dummy_input, + model_path, + verbose=verbose, + opset_version=opset_version, + input_names=model.export_input_names(), + output_names=model.export_output_names(), + dynamic_axes=model.export_dynamic_axes(), + ) + + if quantize: + from onnxruntime.quantization import QuantType, quantize_dynamic + import onnx + + quant_model_path = model_path.replace(".onnx", "_quant.onnx") + if not os.path.exists(quant_model_path): + onnx_model = onnx.load(model_path) + nodes = [n.name for n in onnx_model.graph.node] + nodes_to_exclude = [ + m for m in nodes if "output" in m or "bias_encoder" in m or "bias_decoder" in m + ] + quantize_dynamic( + model_input=model_path, + model_output=quant_model_path, + op_types_to_quantize=["MatMul"], + per_channel=True, + reduce_range=False, + weight_type=QuantType.QUInt8, + nodes_to_exclude=nodes_to_exclude, + ) diff --git a/funasr/utils/install_model_requirements.py b/funasr/utils/install_model_requirements.py new file mode 100644 index 0000000..d7295db --- /dev/null +++ b/funasr/utils/install_model_requirements.py @@ -0,0 +1,36 @@ +import subprocess + + +def install_requirements(requirements_path): + try: + result = subprocess.run( + ["pip", "install", "-r", requirements_path], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + ) + + # check status + if result.returncode == 0: + print("install model requirements successfully") + return True + else: + print("fail to install model requirements! ") + print("error", result.stderr) + return False + except Exception as e: + result = subprocess.run( + ["pip", "install", "-r", requirements_path], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + ) + + # check status + if result.returncode == 0: + print("install model requirements successfully") + return True + else: + print("fail to install model requirements! ") + print("error", result.stderr) + return False diff --git a/funasr/utils/load_utils.py b/funasr/utils/load_utils.py new file mode 100644 index 0000000..346a00b --- /dev/null +++ b/funasr/utils/load_utils.py @@ -0,0 +1,217 @@ +import os +import torch +import json +import torch.distributed as dist +import numpy as np +import kaldiio +import librosa +import torchaudio +import time +import logging +from torch.nn.utils.rnn import pad_sequence + +try: + from funasr.download.file import download_from_url +except: + print("urllib is not installed, if you infer from url, please install it first.") +import pdb +import subprocess +from subprocess import CalledProcessError, run + + +def is_ffmpeg_installed(): + try: + output = subprocess.check_output(["ffmpeg", "-version"], stderr=subprocess.STDOUT) + return "ffmpeg version" in output.decode("utf-8") + except (subprocess.CalledProcessError, FileNotFoundError): + return False + + +use_ffmpeg = False +if is_ffmpeg_installed(): + use_ffmpeg = True +else: + print( + "Notice: ffmpeg is not installed. torchaudio is used to load audio\n" + "If you want to use ffmpeg backend to load audio, please install it by:" + "\n\tsudo apt install ffmpeg # ubuntu" + "\n\t# brew install ffmpeg # mac" + ) + + +def load_audio_text_image_video( + data_or_path_or_list, + fs: int = 16000, + audio_fs: int = 16000, + data_type="sound", + tokenizer=None, + **kwargs, +): + if isinstance(data_or_path_or_list, (list, tuple)): + if data_type is not None and isinstance(data_type, (list, tuple)): + data_types = [data_type] * len(data_or_path_or_list) + data_or_path_or_list_ret = [[] for d in data_type] + for i, (data_type_i, data_or_path_or_list_i) in enumerate( + zip(data_types, data_or_path_or_list) + ): + for j, (data_type_j, data_or_path_or_list_j) in enumerate( + zip(data_type_i, data_or_path_or_list_i) + ): + data_or_path_or_list_j = load_audio_text_image_video( + data_or_path_or_list_j, + fs=fs, + audio_fs=audio_fs, + data_type=data_type_j, + tokenizer=tokenizer, + **kwargs, + ) + data_or_path_or_list_ret[j].append(data_or_path_or_list_j) + + return data_or_path_or_list_ret + else: + return [ + load_audio_text_image_video( + audio, fs=fs, audio_fs=audio_fs, data_type=data_type, **kwargs + ) + for audio in data_or_path_or_list + ] + if isinstance(data_or_path_or_list, str) and data_or_path_or_list.startswith( + "http" + ): # download url to local file + data_or_path_or_list = download_from_url(data_or_path_or_list) + + if isinstance(data_or_path_or_list, str) and os.path.exists(data_or_path_or_list): # local file + if data_type is None or data_type == "sound": + # if use_ffmpeg: + # data_or_path_or_list = _load_audio_ffmpeg(data_or_path_or_list, sr=fs) + # data_or_path_or_list = torch.from_numpy(data_or_path_or_list).squeeze() # [n_samples,] + # else: + # data_or_path_or_list, audio_fs = torchaudio.load(data_or_path_or_list) + # if kwargs.get("reduce_channels", True): + # data_or_path_or_list = data_or_path_or_list.mean(0) + try: + data_or_path_or_list, audio_fs = torchaudio.load(data_or_path_or_list) + if kwargs.get("reduce_channels", True): + data_or_path_or_list = data_or_path_or_list.mean(0) + except: + data_or_path_or_list = _load_audio_ffmpeg(data_or_path_or_list, sr=fs) + data_or_path_or_list = torch.from_numpy( + data_or_path_or_list + ).squeeze() # [n_samples,] + elif data_type == "text" and tokenizer is not None: + data_or_path_or_list = tokenizer.encode(data_or_path_or_list) + elif data_type == "image": # undo + pass + elif data_type == "video": # undo + pass + + # if data_in is a file or url, set is_final=True + if "cache" in kwargs: + kwargs["cache"]["is_final"] = True + kwargs["cache"]["is_streaming_input"] = False + elif isinstance(data_or_path_or_list, str) and data_type == "text" and tokenizer is not None: + data_or_path_or_list = tokenizer.encode(data_or_path_or_list) + elif isinstance(data_or_path_or_list, np.ndarray): # audio sample point + data_or_path_or_list = torch.from_numpy(data_or_path_or_list).squeeze() # [n_samples,] + elif isinstance(data_or_path_or_list, str) and data_type == "kaldi_ark": + data_mat = kaldiio.load_mat(data_or_path_or_list) + if isinstance(data_mat, tuple): + audio_fs, mat = data_mat + else: + mat = data_mat + if mat.dtype == "int16" or mat.dtype == "int32": + mat = mat.astype(np.float64) + mat = mat / 32768 + if mat.ndim == 2: + mat = mat[:, 0] + data_or_path_or_list = mat + else: + pass + # print(f"unsupport data type: {data_or_path_or_list}, return raw data") + + if audio_fs != fs and data_type != "text": + resampler = torchaudio.transforms.Resample(audio_fs, fs) + data_or_path_or_list = resampler(data_or_path_or_list[None, :])[0, :] + return data_or_path_or_list + + +def load_bytes(input): + middle_data = np.frombuffer(input, dtype=np.int16) + middle_data = np.asarray(middle_data) + if middle_data.dtype.kind not in "iu": + raise TypeError("'middle_data' must be an array of integers") + dtype = np.dtype("float32") + if dtype.kind != "f": + raise TypeError("'dtype' must be a floating point type") + + i = np.iinfo(middle_data.dtype) + abs_max = 2 ** (i.bits - 1) + offset = i.min + abs_max + array = np.frombuffer((middle_data.astype(dtype) - offset) / abs_max, dtype=np.float32) + return array + + +def extract_fbank(data, data_len=None, data_type: str = "sound", frontend=None, **kwargs): + if isinstance(data, np.ndarray): + data = torch.from_numpy(data) + if len(data.shape) < 2: + data = data[None, :] # data: [batch, N] + data_len = [data.shape[1]] if data_len is None else data_len + elif isinstance(data, torch.Tensor): + if len(data.shape) < 2: + data = data[None, :] # data: [batch, N] + data_len = [data.shape[1]] if data_len is None else data_len + elif isinstance(data, (list, tuple)): + data_list, data_len = [], [] + for data_i in data: + if isinstance(data_i, np.ndarray): + data_i = torch.from_numpy(data_i) + data_list.append(data_i) + data_len.append(data_i.shape[0]) + data = pad_sequence(data_list, batch_first=True) # data: [batch, N] + + data, data_len = frontend(data, data_len, **kwargs) + + if isinstance(data_len, (list, tuple)): + data_len = torch.tensor([data_len]) + return data.to(torch.float32), data_len.to(torch.int32) + + +def _load_audio_ffmpeg(file: str, sr: int = 16000): + """ + Open an audio file and read as mono waveform, resampling as necessary + + Parameters + ---------- + file: str + The audio file to open + + sr: int + The sample rate to resample the audio if necessary + + Returns + ------- + A NumPy array containing the audio waveform, in float32 dtype. + """ + + # This launches a subprocess to decode audio while down-mixing + # and resampling as necessary. Requires the ffmpeg CLI in PATH. + # fmt: off + cmd = [ + "ffmpeg", + "-nostdin", + "-threads", "0", + "-i", file, + "-f", "s16le", + "-ac", "1", + "-acodec", "pcm_s16le", + "-ar", str(sr), + "-" + ] + # fmt: on + try: + out = run(cmd, capture_output=True, check=True).stdout + except CalledProcessError as e: + raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e + + return np.frombuffer(out, np.int16).flatten().astype(np.float32) / 32768.0 diff --git a/funasr/utils/misc.py b/funasr/utils/misc.py new file mode 100644 index 0000000..4613cb3 --- /dev/null +++ b/funasr/utils/misc.py @@ -0,0 +1,96 @@ +import os +import io +import shutil +import logging +from collections import OrderedDict +import numpy as np +from omegaconf import DictConfig, OmegaConf + + +def statistic_model_parameters(model, prefix=None): + var_dict = model.state_dict() + numel = 0 + for i, key in enumerate( + sorted(list([x for x in var_dict.keys() if "num_batches_tracked" not in x])) + ): + if prefix is None or key.startswith(prefix): + numel += var_dict[key].numel() + return numel + + +def int2vec(x, vec_dim=8, dtype=np.int32): + b = ("{:0" + str(vec_dim) + "b}").format(x) + # little-endian order: lower bit first + return (np.array(list(b)[::-1]) == "1").astype(dtype) + + +def seq2arr(seq, vec_dim=8): + return np.row_stack([int2vec(int(x), vec_dim) for x in seq]) + + +def load_scp_as_dict(scp_path, value_type="str", kv_sep=" "): + with io.open(scp_path, "r", encoding="utf-8") as f: + ret_dict = OrderedDict() + for one_line in f.readlines(): + one_line = one_line.strip() + pos = one_line.find(kv_sep) + key, value = one_line[:pos], one_line[pos + 1 :] + if value_type == "list": + value = value.split(" ") + ret_dict[key] = value + return ret_dict + + +def load_scp_as_list(scp_path, value_type="str", kv_sep=" "): + with io.open(scp_path, "r", encoding="utf8") as f: + ret_dict = [] + for one_line in f.readlines(): + one_line = one_line.strip() + pos = one_line.find(kv_sep) + key, value = one_line[:pos], one_line[pos + 1 :] + if value_type == "list": + value = value.split(" ") + ret_dict.append((key, value)) + return ret_dict + + +def deep_update(original, update): + for key, value in update.items(): + if isinstance(value, dict) and key in original: + if len(value) == 0: + original[key] = value + deep_update(original[key], value) + else: + original[key] = value + + +def prepare_model_dir(**kwargs): + + os.makedirs(kwargs.get("output_dir", "./"), exist_ok=True) + + yaml_file = os.path.join(kwargs.get("output_dir", "./"), "config.yaml") + OmegaConf.save(config=kwargs, f=yaml_file) + logging.info(f"kwargs: {kwargs}") + logging.info("config.yaml is saved to: %s", yaml_file) + + model_path = kwargs.get("model_path", None) + if model_path is not None: + config_json = os.path.join(model_path, "configuration.json") + if os.path.exists(config_json): + shutil.copy( + config_json, os.path.join(kwargs.get("output_dir", "./"), "configuration.json") + ) + + +def extract_filename_without_extension(file_path): + """ + 从给定的文件路径中提取文件名(不包含路径和扩展名) + :param file_path: 完整的文件路径 + :return: 文件名(不含路径和扩展名) + """ + # 首先,使用os.path.basename获取路径中的文件名部分(含扩展名) + filename_with_extension = os.path.basename(file_path) + # 然后,使用os.path.splitext分离文件名和扩展名 + filename, extension = os.path.splitext(filename_with_extension) + # 返回不包含扩展名的文件名 + return filename diff --git a/funasr/utils/postprocess_utils.py b/funasr/utils/postprocess_utils.py new file mode 100644 index 0000000..34f933c --- /dev/null +++ b/funasr/utils/postprocess_utils.py @@ -0,0 +1,301 @@ +# Copyright (c) Alibaba, Inc. and its affiliates. + +import string +import logging +from typing import Any, List, Union + + +def isChinese(ch: str): + if "\u4e00" <= ch <= "\u9fff" or "\u0030" <= ch <= "\u0039" or ch == "@": + return True + return False + + +def isAllChinese(word: Union[List[Any], str]): + word_lists = [] + for i in word: + cur = i.replace(" ", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + word_lists.append(cur) + + if len(word_lists) == 0: + return False + + for ch in word_lists: + if isChinese(ch) is False: + return False + return True + + +def isAllAlpha(word: Union[List[Any], str]): + word_lists = [] + for i in word: + cur = i.replace(" ", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + word_lists.append(cur) + + if len(word_lists) == 0: + return False + + for ch in word_lists: + if ch.isalpha() is False and ch != "'": + return False + elif ch.isalpha() is True and isChinese(ch) is True: + return False + + return True + + +# def abbr_dispose(words: List[Any]) -> List[Any]: +def abbr_dispose(words: List[Any], time_stamp: List[List] = None) -> List[Any]: + words_size = len(words) + word_lists = [] + abbr_begin = [] + abbr_end = [] + last_num = -1 + ts_lists = [] + ts_nums = [] + ts_index = 0 + for num in range(words_size): + if num <= last_num: + continue + + if len(words[num]) == 1 and words[num].encode("utf-8").isalpha(): + if ( + num + 1 < words_size + and words[num + 1] == " " + and num + 2 < words_size + and len(words[num + 2]) == 1 + and words[num + 2].encode("utf-8").isalpha() + ): + # found the begin of abbr + abbr_begin.append(num) + num += 2 + abbr_end.append(num) + # to find the end of abbr + while True: + num += 1 + if num < words_size and words[num] == " ": + num += 1 + if ( + num < words_size + and len(words[num]) == 1 + and words[num].encode("utf-8").isalpha() + ): + abbr_end.pop() + abbr_end.append(num) + last_num = num + else: + break + else: + break + + for num in range(words_size): + if words[num] == " ": + ts_nums.append(ts_index) + else: + ts_nums.append(ts_index) + ts_index += 1 + last_num = -1 + for num in range(words_size): + if num <= last_num: + continue + + if num in abbr_begin: + if time_stamp is not None: + begin = time_stamp[ts_nums[num]][0] + abbr_word = words[num].upper() + num += 1 + while num < words_size: + if num in abbr_end: + abbr_word += words[num].upper() + last_num = num + break + else: + if words[num].encode("utf-8").isalpha(): + abbr_word += words[num].upper() + num += 1 + word_lists.append(abbr_word) + if time_stamp is not None: + end = time_stamp[ts_nums[num]][1] + ts_lists.append([begin, end]) + else: + word_lists.append(words[num]) + if time_stamp is not None and words[num] != " ": + begin = time_stamp[ts_nums[num]][0] + end = time_stamp[ts_nums[num]][1] + ts_lists.append([begin, end]) + begin = end + + if time_stamp is not None: + return word_lists, ts_lists + else: + return word_lists + + +def sentence_postprocess(words: List[Any], time_stamp: List[List] = None): + middle_lists = [] + word_lists = [] + word_item = "" + ts_lists = [] + + # wash words lists + for i in words: + word = "" + if isinstance(i, str): + word = i + else: + word = i.decode("utf-8") + + if word in ["", "", "", ""]: + continue + else: + middle_lists.append(word) + + # all chinese characters + if isAllChinese(middle_lists): + for i, ch in enumerate(middle_lists): + word_lists.append(ch.replace(" ", "")) + if time_stamp is not None: + ts_lists = time_stamp + + # all alpha characters + elif isAllAlpha(middle_lists): + ts_flag = True + for i, ch in enumerate(middle_lists): + if ts_flag and time_stamp is not None: + begin = time_stamp[i][0] + end = time_stamp[i][1] + word = "" + if "@@" in ch: + word = ch.replace("@@", "") + word_item += word + if time_stamp is not None: + ts_flag = False + end = time_stamp[i][1] + else: + word_item += ch + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + if time_stamp is not None: + ts_flag = True + end = time_stamp[i][1] + ts_lists.append([begin, end]) + begin = end + + # mix characters + else: + alpha_blank = False + ts_flag = True + begin = -1 + end = -1 + for i, ch in enumerate(middle_lists): + if ts_flag and time_stamp is not None: + begin = time_stamp[i][0] + end = time_stamp[i][1] + word = "" + if isAllChinese(ch): + if alpha_blank is True: + word_lists.pop() + word_lists.append(ch) + alpha_blank = False + if time_stamp is not None: + ts_flag = True + ts_lists.append([begin, end]) + begin = end + elif "@@" in ch: + word = ch.replace("@@", "") + word_item += word + alpha_blank = False + if time_stamp is not None: + ts_flag = False + end = time_stamp[i][1] + elif isAllAlpha(ch): + word_item += ch + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + alpha_blank = True + if time_stamp is not None: + ts_flag = True + end = time_stamp[i][1] + ts_lists.append([begin, end]) + begin = end + else: + word_lists.append(ch) + + if time_stamp is not None: + word_lists, ts_lists = abbr_dispose(word_lists, ts_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + real_word_lists.append(ch) + sentence = " ".join(real_word_lists).strip() + return sentence, ts_lists, real_word_lists + else: + word_lists = abbr_dispose(word_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + real_word_lists.append(ch) + sentence = "".join(word_lists).strip() + return sentence, real_word_lists + + +def sentence_postprocess_sentencepiece(words): + middle_lists = [] + word_lists = [] + word_item = "" + + # wash words lists + for i in words: + word = "" + if isinstance(i, str): + word = i + else: + word = i.decode("utf-8") + + if word in ["", "", "", ""]: + continue + else: + middle_lists.append(word) + + # all alpha characters + for i, ch in enumerate(middle_lists): + word = "" + if "\u2581" in ch and i == 0: + word_item = "" + word = ch.replace("\u2581", "") + word_item += word + elif "\u2581" in ch and i != 0: + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + word = ch.replace("\u2581", "") + word_item += word + else: + word_item += ch + if word_item is not None: + word_lists.append(word_item) + # word_lists = abbr_dispose(word_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + if ch == "i": + ch = ch.replace("i", "I") + elif ch == "i'm": + ch = ch.replace("i'm", "I'm") + elif ch == "i've": + ch = ch.replace("i've", "I've") + elif ch == "i'll": + ch = ch.replace("i'll", "I'll") + real_word_lists.append(ch) + sentence = "".join(word_lists) + return sentence, real_word_lists diff --git a/funasr/utils/speaker_utils.py b/funasr/utils/speaker_utils.py new file mode 100644 index 0000000..e470849 --- /dev/null +++ b/funasr/utils/speaker_utils.py @@ -0,0 +1,197 @@ +# Copyright (c) Alibaba, Inc. and its affiliates. +""" Some implementations are adapted from https://github.com/yuyq96/D-TDNN +""" + +import io +from typing import Union + +import librosa as sf +import numpy as np +import torch +import torch.nn.functional as F +import torchaudio.compliance.kaldi as Kaldi +from torch import nn + +from funasr.utils.modelscope_file import File + + +def check_audio_list(audio: list): + audio_dur = 0 + for i in range(len(audio)): + seg = audio[i] + assert seg[1] >= seg[0], "modelscope error: Wrong time stamps." + assert isinstance(seg[2], np.ndarray), "modelscope error: Wrong data type." + assert ( + int(seg[1] * 16000) - int(seg[0] * 16000) == seg[2].shape[0] + ), "modelscope error: audio data in list is inconsistent with time length." + if i > 0: + assert seg[0] >= audio[i - 1][1], "modelscope error: Wrong time stamps." + audio_dur += seg[1] - seg[0] + return audio_dur + # assert audio_dur > 5, 'modelscope error: The effective audio duration is too short.' + + +def sv_preprocess(inputs: Union[np.ndarray, list]): + output = [] + for i in range(len(inputs)): + if isinstance(inputs[i], str): + file_bytes = File.read(inputs[i]) + data, fs = sf.load(io.BytesIO(file_bytes), dtype="float32") + if len(data.shape) == 2: + data = data[:, 0] + data = torch.from_numpy(data).unsqueeze(0) + data = data.squeeze(0) + elif isinstance(inputs[i], np.ndarray): + assert len(inputs[i].shape) == 1, "modelscope error: Input array should be [N, T]" + data = inputs[i] + if data.dtype in ["int16", "int32", "int64"]: + data = (data / (1 << 15)).astype("float32") + else: + data = data.astype("float32") + data = torch.from_numpy(data) + else: + raise ValueError( + "modelscope error: The input type is restricted to audio address and nump array." + ) + output.append(data) + return output + + +def sv_chunk(vad_segments: list, fs=16000) -> list: + config = { + "seg_dur": 1.5, + "seg_shift": 0.75, + } + + def seg_chunk(seg_data): + seg_st = seg_data[0] + data = seg_data[2] + chunk_len = int(config["seg_dur"] * fs) + chunk_shift = int(config["seg_shift"] * fs) + last_chunk_ed = 0 + seg_res = [] + for chunk_st in range(0, data.shape[0], chunk_shift): + chunk_ed = min(chunk_st + chunk_len, data.shape[0]) + if chunk_ed <= last_chunk_ed: + break + last_chunk_ed = chunk_ed + chunk_st = max(0, chunk_ed - chunk_len) + chunk_data = data[chunk_st:chunk_ed] + if chunk_data.shape[0] < chunk_len: + chunk_data = np.pad(chunk_data, (0, chunk_len - chunk_data.shape[0]), "constant") + seg_res.append([chunk_st / fs + seg_st, chunk_ed / fs + seg_st, chunk_data]) + return seg_res + + segs = [] + for i, s in enumerate(vad_segments): + segs.extend(seg_chunk(s)) + + return segs + + +def extract_feature(audio): + features = [] + for au in audio: + feature = Kaldi.fbank(au.unsqueeze(0), num_mel_bins=80) + feature = feature - feature.mean(dim=0, keepdim=True) + features.append(feature.unsqueeze(0)) + features = torch.cat(features) + return features + + +def postprocess( + segments: list, vad_segments: list, labels: np.ndarray, embeddings: np.ndarray +) -> list: + assert len(segments) == len(labels) + labels = correct_labels(labels) + distribute_res = [] + for i in range(len(segments)): + distribute_res.append([segments[i][0], segments[i][1], labels[i]]) + # merge the same speakers chronologically + distribute_res = merge_seque(distribute_res) + + # accquire speaker center + spk_embs = [] + for i in range(labels.max() + 1): + spk_emb = embeddings[labels == i].mean(0) + spk_embs.append(spk_emb) + spk_embs = np.stack(spk_embs) + + def is_overlapped(t1, t2): + if t1 > t2 + 1e-4: + return True + return False + + # distribute the overlap region + for i in range(1, len(distribute_res)): + if is_overlapped(distribute_res[i - 1][1], distribute_res[i][0]): + p = (distribute_res[i][0] + distribute_res[i - 1][1]) / 2 + distribute_res[i][0] = p + distribute_res[i - 1][1] = p + + # smooth the result + distribute_res = smooth(distribute_res) + + return distribute_res + + +def correct_labels(labels): + labels_id = 0 + id2id = {} + new_labels = [] + for i in labels: + if i not in id2id: + id2id[i] = labels_id + labels_id += 1 + new_labels.append(id2id[i]) + return np.array(new_labels) + + +def merge_seque(distribute_res): + res = [distribute_res[0]] + for i in range(1, len(distribute_res)): + if distribute_res[i][2] != res[-1][2] or distribute_res[i][0] > res[-1][1]: + res.append(distribute_res[i]) + else: + res[-1][1] = distribute_res[i][1] + return res + + +def smooth(res, mindur=1): + # short segments are assigned to nearest speakers. + for i in range(len(res)): + res[i][0] = round(res[i][0], 2) + res[i][1] = round(res[i][1], 2) + if res[i][1] - res[i][0] < mindur: + if i == 0: + res[i][2] = res[i + 1][2] + elif i == len(res) - 1: + res[i][2] = res[i - 1][2] + elif res[i][0] - res[i - 1][1] <= res[i + 1][0] - res[i][1]: + res[i][2] = res[i - 1][2] + else: + res[i][2] = res[i + 1][2] + # merge the speakers + res = merge_seque(res) + + return res + + +def distribute_spk(sentence_list, sd_time_list): + sd_sentence_list = [] + for d in sentence_list: + sentence_start = d["ts_list"][0][0] + sentence_end = d["ts_list"][-1][1] + sentence_spk = 0 + max_overlap = 0 + for sd_time in sd_time_list: + spk_st, spk_ed, spk = sd_time + spk_st = spk_st * 1000 + spk_ed = spk_ed * 1000 + overlap = max(min(sentence_end, spk_ed) - max(sentence_start, spk_st), 0) + if overlap > max_overlap: + max_overlap = overlap + sentence_spk = spk + d["spk"] = sentence_spk + sd_sentence_list.append(d) + return sd_sentence_list diff --git a/funasr/utils/timestamp_tools.py b/funasr/utils/timestamp_tools.py new file mode 100644 index 0000000..831d773 --- /dev/null +++ b/funasr/utils/timestamp_tools.py @@ -0,0 +1,187 @@ +import torch +import codecs +import logging +import argparse +import numpy as np + +# import edit_distance +from itertools import zip_longest + + +def cif_wo_hidden(alphas, threshold): + batch_size, len_time = alphas.size() + # loop varss + integrate = torch.zeros([batch_size], device=alphas.device) + # intermediate vars along time + list_fires = [] + for t in range(len_time): + alpha = alphas[:, t] + integrate += alpha + list_fires.append(integrate) + fire_place = integrate >= threshold + integrate = torch.where( + fire_place, + integrate - torch.ones([batch_size], device=alphas.device) * threshold, + integrate, + ) + fires = torch.stack(list_fires, 1) + return fires + + +def ts_prediction_lfr6_standard( + us_alphas, us_peaks, char_list, vad_offset=0.0, force_time_shift=-1.5, sil_in_str=True +): + if not len(char_list): + return "", [] + START_END_THRESHOLD = 5 + MAX_TOKEN_DURATION = 12 + TIME_RATE = 10.0 * 6 / 1000 / 3 # 3 times upsampled + if len(us_alphas.shape) == 2: + alphas, peaks = us_alphas[0], us_peaks[0] # support inference batch_size=1 only + else: + alphas, peaks = us_alphas, us_peaks + if char_list[-1] == "": + char_list = char_list[:-1] + fire_place = ( + torch.where(peaks >= 1.0 - 1e-4)[0].cpu().numpy() + force_time_shift + ) # total offset + if len(fire_place) != len(char_list) + 1: + alphas /= alphas.sum() / (len(char_list) + 1) + alphas = alphas.unsqueeze(0) + peaks = cif_wo_hidden(alphas, threshold=1.0 - 1e-4)[0] + fire_place = ( + torch.where(peaks >= 1.0 - 1e-4)[0].cpu().numpy() + force_time_shift + ) # total offset + num_frames = peaks.shape[0] + timestamp_list = [] + new_char_list = [] + # for bicif model trained with large data, cif2 actually fires when a character starts + # so treat the frames between two peaks as the duration of the former token + # fire_place = torch.where(peaks>=1.0-1e-4)[0].cpu().numpy() + force_time_shift # total offset + # assert num_peak == len(char_list) + 1 # number of peaks is supposed to be number of tokens + 1 + # begin silence + if fire_place[0] > START_END_THRESHOLD: + # char_list.insert(0, '') + timestamp_list.append([0.0, fire_place[0] * TIME_RATE]) + new_char_list.append("") + # tokens timestamp + for i in range(len(fire_place) - 1): + new_char_list.append(char_list[i]) + if MAX_TOKEN_DURATION < 0 or fire_place[i + 1] - fire_place[i] <= MAX_TOKEN_DURATION: + timestamp_list.append([fire_place[i] * TIME_RATE, fire_place[i + 1] * TIME_RATE]) + else: + # cut the duration to token and sil of the 0-weight frames last long + _split = fire_place[i] + MAX_TOKEN_DURATION + timestamp_list.append([fire_place[i] * TIME_RATE, _split * TIME_RATE]) + timestamp_list.append([_split * TIME_RATE, fire_place[i + 1] * TIME_RATE]) + new_char_list.append("") + # tail token and end silence + # new_char_list.append(char_list[-1]) + if num_frames - fire_place[-1] > START_END_THRESHOLD: + _end = (num_frames + fire_place[-1]) * 0.5 + # _end = fire_place[-1] + timestamp_list[-1][1] = _end * TIME_RATE + timestamp_list.append([_end * TIME_RATE, num_frames * TIME_RATE]) + new_char_list.append("") + else: + timestamp_list[-1][1] = num_frames * TIME_RATE + if vad_offset: # add offset time in model with vad + for i in range(len(timestamp_list)): + timestamp_list[i][0] = timestamp_list[i][0] + vad_offset / 1000.0 + timestamp_list[i][1] = timestamp_list[i][1] + vad_offset / 1000.0 + res_txt = "" + for char, timestamp in zip(new_char_list, timestamp_list): + # if char != '': + if not sil_in_str and char == "": + continue + res_txt += "{} {} {};".format( + char, str(timestamp[0] + 0.0005)[:5], str(timestamp[1] + 0.0005)[:5] + ) + res = [] + for char, timestamp in zip(new_char_list, timestamp_list): + if char != "": + res.append([int(timestamp[0] * 1000), int(timestamp[1] * 1000)]) + return res_txt, res + + +def timestamp_sentence( + punc_id_list, timestamp_postprocessed, text_postprocessed, return_raw_text=False +): + punc_list = [",", "。", "?", "、"] + res = [] + if text_postprocessed is None: + return res + if timestamp_postprocessed is None: + return res + if len(timestamp_postprocessed) == 0: + return res + if len(text_postprocessed) == 0: + return res + + if punc_id_list is None or len(punc_id_list) == 0: + res.append( + { + "text": text_postprocessed.split(), + "start": timestamp_postprocessed[0][0], + "end": timestamp_postprocessed[-1][1], + "timestamp": timestamp_postprocessed, + } + ) + return res + if len(punc_id_list) != len(timestamp_postprocessed): + logging.warning("length mismatch between punc and timestamp") + sentence_text = "" + sentence_text_seg = "" + ts_list = [] + sentence_start = timestamp_postprocessed[0][0] + sentence_end = timestamp_postprocessed[0][1] + texts = text_postprocessed.split() + punc_stamp_text_list = list( + zip_longest(punc_id_list, timestamp_postprocessed, texts, fillvalue=None) + ) + for punc_stamp_text in punc_stamp_text_list: + punc_id, timestamp, text = punc_stamp_text + # sentence_text += text if text is not None else '' + if text is not None: + if "a" <= text[0] <= "z" or "A" <= text[0] <= "Z": + sentence_text += " " + text + elif len(sentence_text) and ( + "a" <= sentence_text[-1] <= "z" or "A" <= sentence_text[-1] <= "Z" + ): + sentence_text += " " + text + else: + sentence_text += text + sentence_text_seg += text + " " + ts_list.append(timestamp) + + punc_id = int(punc_id) if punc_id is not None else 1 + sentence_end = timestamp[1] if timestamp is not None else sentence_end + sentence_text_seg = ( + sentence_text_seg[:-1] if sentence_text_seg[-1] == " " else sentence_text_seg + ) + if punc_id > 1: + sentence_text += punc_list[punc_id - 2] + if return_raw_text: + res.append( + { + "text": sentence_text, + "start": sentence_start, + "end": sentence_end, + "timestamp": ts_list, + "raw_text": sentence_text_seg, + } + ) + else: + res.append( + { + "text": sentence_text, + "start": sentence_start, + "end": sentence_end, + "timestamp": ts_list, + } + ) + sentence_text = "" + sentence_text_seg = "" + ts_list = [] + sentence_start = sentence_end + return res diff --git a/funasr/utils/torch_function.py b/funasr/utils/torch_function.py new file mode 100644 index 0000000..f637bbf --- /dev/null +++ b/funasr/utils/torch_function.py @@ -0,0 +1,84 @@ +from typing import Optional + +import torch +import torch.nn as nn + +import numpy as np + + +class MakePadMask(nn.Module): + def __init__(self, max_seq_len=512, flip=True): + super().__init__() + if flip: + self.mask_pad = torch.Tensor(1 - np.tri(max_seq_len)).type(torch.bool) + else: + self.mask_pad = torch.Tensor(np.tri(max_seq_len)).type(torch.bool) + + def forward(self, lengths, xs=None, length_dim=-1, maxlen=None): + """Make mask tensor containing indices of padded part. + This implementation creates the same mask tensor with original make_pad_mask, + which can be converted into onnx format. + Dimension length of xs should be 2 or 3. + """ + if length_dim == 0: + raise ValueError("length_dim cannot be 0: {}".format(length_dim)) + + if xs is not None and len(xs.shape) == 3: + if length_dim == 1: + lengths = lengths.unsqueeze(1).expand(*xs.transpose(1, 2).shape[:2]) + else: + lengths = lengths.unsqueeze(1).expand(*xs.shape[:2]) + + if maxlen is not None: + m = maxlen + elif xs is not None: + m = xs.shape[-1] + else: + m = torch.max(lengths) + + mask = self.mask_pad[lengths - 1][..., :m].type(torch.float32) + + if length_dim == 1: + return mask.transpose(1, 2) + else: + return mask + + +class sequence_mask(nn.Module): + def __init__(self, max_seq_len=512, flip=True): + super().__init__() + + def forward(self, lengths, max_seq_len=None, dtype=torch.float32, device=None): + if max_seq_len is None: + max_seq_len = lengths.max() + row_vector = torch.arange(0, max_seq_len, 1).to(lengths.device) + matrix = torch.unsqueeze(lengths, dim=-1) + mask = row_vector < matrix + + return mask.type(dtype).to(device) if device is not None else mask.type(dtype) + + +def normalize( + input: torch.Tensor, p: float = 2.0, dim: int = 1, out: Optional[torch.Tensor] = None +) -> torch.Tensor: + if out is None: + denom = input.norm(p, dim, keepdim=True).expand_as(input) + return input / denom + else: + denom = input.norm(p, dim, keepdim=True).expand_as(input) + return torch.div(input, denom, out=out) + + +def subsequent_mask(size: torch.Tensor): + return torch.ones(size, size).tril() + + +def MakePadMask_test(): + feats_length = torch.tensor([10]).type(torch.long) + mask_fn = MakePadMask() + mask = mask_fn(feats_length) + print(mask) + + +if __name__ == "__main__": + MakePadMask_test() diff --git a/funasr/utils/types.py b/funasr/utils/types.py new file mode 100644 index 0000000..6b36f9c --- /dev/null +++ b/funasr/utils/types.py @@ -0,0 +1,149 @@ +from distutils.util import strtobool +from typing import Optional +from typing import Tuple +from typing import Union + +import humanfriendly + + +def str2bool(value: str) -> bool: + return bool(strtobool(value)) + + +def remove_parenthesis(value: str): + value = value.strip() + if value.startswith("(") and value.endswith(")"): + value = value[1:-1] + elif value.startswith("[") and value.endswith("]"): + value = value[1:-1] + return value + + +def remove_quotes(value: str): + value = value.strip() + if value.startswith('"') and value.endswith('"'): + value = value[1:-1] + elif value.startswith("'") and value.endswith("'"): + value = value[1:-1] + return value + + +def int_or_none(value: str) -> Optional[int]: + """int_or_none. + + Examples: + >>> import argparse + >>> parser = argparse.ArgumentParser() + >>> _ = parser.add_argument('--foo', type=int_or_none) + >>> parser.parse_args(['--foo', '456']) + Namespace(foo=456) + >>> parser.parse_args(['--foo', 'none']) + Namespace(foo=None) + >>> parser.parse_args(['--foo', 'null']) + Namespace(foo=None) + >>> parser.parse_args(['--foo', 'nil']) + Namespace(foo=None) + + """ + if value.strip().lower() in ("none", "null", "nil"): + return None + return int(value) + + +def float_or_none(value: str) -> Optional[float]: + """float_or_none. + + Examples: + >>> import argparse + >>> parser = argparse.ArgumentParser() + >>> _ = parser.add_argument('--foo', type=float_or_none) + >>> parser.parse_args(['--foo', '4.5']) + Namespace(foo=4.5) + >>> parser.parse_args(['--foo', 'none']) + Namespace(foo=None) + >>> parser.parse_args(['--foo', 'null']) + Namespace(foo=None) + >>> parser.parse_args(['--foo', 'nil']) + Namespace(foo=None) + + """ + if value.strip().lower() in ("none", "null", "nil"): + return None + return float(value) + + +def humanfriendly_parse_size_or_none(value) -> Optional[float]: + if value.strip().lower() in ("none", "null", "nil"): + return None + return humanfriendly.parse_size(value) + + +def str_or_int(value: str) -> Union[str, int]: + try: + return int(value) + except ValueError: + return value + + +def str_or_none(value: str) -> Optional[str]: + """str_or_none. + + Examples: + >>> import argparse + >>> parser = argparse.ArgumentParser() + >>> _ = parser.add_argument('--foo', type=str_or_none) + >>> parser.parse_args(['--foo', 'aaa']) + Namespace(foo='aaa') + >>> parser.parse_args(['--foo', 'none']) + Namespace(foo=None) + >>> parser.parse_args(['--foo', 'null']) + Namespace(foo=None) + >>> parser.parse_args(['--foo', 'nil']) + Namespace(foo=None) + + """ + if value.strip().lower() in ("none", "null", "nil"): + return None + return value + + +def str2pair_str(value: str) -> Tuple[str, str]: + """str2pair_str. + + Examples: + >>> import argparse + >>> str2pair_str('abc,def ') + ('abc', 'def') + >>> parser = argparse.ArgumentParser() + >>> _ = parser.add_argument('--foo', type=str2pair_str) + >>> parser.parse_args(['--foo', 'abc,def']) + Namespace(foo=('abc', 'def')) + + """ + value = remove_parenthesis(value) + a, b = value.split(",") + + # Workaround for configargparse issues: + # If the list values are given from yaml file, + # the value givent to type() is shaped as python-list, + # e.g. ['a', 'b', 'c'], + # so we need to remove double quotes from it. + return remove_quotes(a), remove_quotes(b) + + +def str2triple_str(value: str) -> Tuple[str, str, str]: + """str2triple_str. + + Examples: + >>> str2triple_str('abc,def ,ghi') + ('abc', 'def', 'ghi') + """ + value = remove_parenthesis(value) + a, b, c = value.split(",") + + # Workaround for configargparse issues: + # If the list values are given from yaml file, + # the value givent to type() is shaped as python-list, + # e.g. ['a', 'b', 'c'], + # so we need to remove quotes from it. + return remove_quotes(a), remove_quotes(b), remove_quotes(c) diff --git a/funasr/utils/vad_utils.py b/funasr/utils/vad_utils.py new file mode 100644 index 0000000..eba48a9 --- /dev/null +++ b/funasr/utils/vad_utils.py @@ -0,0 +1,55 @@ +import torch +from torch.nn.utils.rnn import pad_sequence + + +def slice_padding_fbank(speech, speech_lengths, vad_segments): + speech_list = [] + speech_lengths_list = [] + for i, segment in enumerate(vad_segments): + + bed_idx = int(segment[0][0] * 16) + end_idx = min(int(segment[0][1] * 16), speech_lengths[0]) + speech_i = speech[0, bed_idx:end_idx] + speech_lengths_i = end_idx - bed_idx + speech_list.append(speech_i) + speech_lengths_list.append(speech_lengths_i) + feats_pad = pad_sequence(speech_list, batch_first=True, padding_value=0.0) + speech_lengths_pad = torch.Tensor(speech_lengths_list).int() + return feats_pad, speech_lengths_pad + + +def slice_padding_audio_samples(speech, speech_lengths, vad_segments): + speech_list = [] + speech_lengths_list = [] + for i, segment in enumerate(vad_segments): + bed_idx = int(segment[0][0] * 16) + end_idx = min(int(segment[0][1] * 16), speech_lengths) + speech_i = speech[bed_idx:end_idx] + speech_lengths_i = end_idx - bed_idx + speech_list.append(speech_i) + speech_lengths_list.append(speech_lengths_i) + + return speech_list, speech_lengths_list + + +def merge_vad(vad_result, max_length=15000): + new_result = [] + time_step = [t[0] for t in vad_result] + [t[1] for t in vad_result] + time_step = sorted(list(set(time_step))) + if len(time_step) == 0: + return [] + bg = 0 + for i in range(len(time_step) - 1): + time = time_step[i] + if time_step[i + 1] - bg < max_length: + continue + if time - bg < max_length * 1.5: + new_result.append([bg, time]) + else: + split_num = int(time - bg) // max_length + 1 + spl_l = int(time - bg) // split_num + for j in range(split_num): + new_result.append([bg + j * spl_l, bg + (j + 1) * spl_l]) + bg = time + new_result.append([bg, time_step[-1]]) + return new_result diff --git a/funasr/version.txt b/funasr/version.txt new file mode 100644 index 0000000..3f11ef6 --- /dev/null +++ b/funasr/version.txt @@ -0,0 +1 @@ +1.0.27 \ No newline at end of file diff --git a/model_zoo/huggingface_models.md b/model_zoo/huggingface_models.md new file mode 100644 index 0000000..ad367de --- /dev/null +++ b/model_zoo/huggingface_models.md @@ -0,0 +1,126 @@ +# Pretrained Models on Huggingface + +## Model License +- Apache License 2.0 + +## Model Zoo +Here we provided several pretrained models on different datasets. The details of models and datasets can be found on [ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition). + +### Speech Recognition Models +#### Paraformer Models + +| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes | +|:-----------------------------------------------------------------------:|:--------:|:----------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [Paraformer-large](https://huggingface.co/funasr/paraformer-large) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Offline | Duration of input wav <= 20s | + +[//]: # (| [Paraformer-large-long](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Offline | Which ould deal with arbitrary length input wav |) + +[//]: # (| [paraformer-large-contextual](https://www.modelscope.cn/models/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Offline | Which supports the hotword customization based on the incentive enhancement, and improves the recall and precision of hotwords. |) + +[//]: # (| [Paraformer](https://modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8358-tensorflow1/summary) | CN & EN | Alibaba Speech Data (50000hours) | 8358 | 68M | Offline | Duration of input wav <= 20s |) + +[//]: # (| [Paraformer-online](https://modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8358-tensorflow1/summary) | CN & EN | Alibaba Speech Data (50000hours) | 8404 | 68M | Online | Which could deal with streaming input |) + +[//]: # (| [Paraformer-tiny](https://www.modelscope.cn/models/damo/speech_paraformer-tiny-commandword_asr_nat-zh-cn-16k-vocab544-pytorch/summary) | CN | Alibaba Speech Data (200hours) | 544 | 5.2M | Offline | Lightweight Paraformer model which supports Mandarin command words recognition |) + +[//]: # (| [Paraformer-aishell](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-aishell1-pytorch/summary) | CN | AISHELL (178hours) | 4234 | 43M | Offline | |) + +[//]: # (| [ParaformerBert-aishell](https://modelscope.cn/models/damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch/summary) | CN | AISHELL (178hours) | 4234 | 43M | Offline | |) + +[//]: # (| [Paraformer-aishell2](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | CN | AISHELL-2 (1000hours) | 5212 | 64M | Offline | |) + +[//]: # (| [ParaformerBert-aishell2](https://www.modelscope.cn/models/damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | CN | AISHELL-2 (1000hours) | 5212 | 64M | Offline | |) + + +#### UniASR Models + +[//]: # (| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes |) + +[//]: # (|:--------------------------------------------------------------------------------------------------------------------------------------:|:--------:|:--------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------|) + +[//]: # (| [UniASR](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-online/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8358 | 100M | Online | UniASR streaming offline unifying models |) + +[//]: # (| [UniASR-large](https://modelscope.cn/models/damo/speech_UniASR-large_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-offline/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8358 | 220M | Offline | UniASR streaming offline unifying models |) + +[//]: # (| [UniASR Burmese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-my-16k-common-vocab696-pytorch/summary) | Burmese | Alibaba Speech Data (? hours) | 696 | 95M | Online | UniASR streaming offline unifying models |) + +[//]: # (| [UniASR Hebrew](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-he-16k-common-vocab1085-pytorch/summary) | Hebrew | Alibaba Speech Data (? hours) | 1085 | 95M | Online | UniASR streaming offline unifying models |) + +[//]: # (| [UniASR Urdu](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ur-16k-common-vocab877-pytorch/summary) | Urdu | Alibaba Speech Data (? hours) | 877 | 95M | Online | UniASR streaming offline unifying models |) + +#### Conformer Models + +[//]: # (| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes |) + +[//]: # (|:----------------------------------------------------------------------------------------------------------------------:|:--------:|:---------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------|) + +[//]: # (| [Conformer](https://modelscope.cn/models/damo/speech_conformer_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch/summary) | CN | AISHELL (178hours) | 4234 | 44M | Offline | Duration of input wav <= 20s |) + +[//]: # (| [Conformer](https://www.modelscope.cn/models/damo/speech_conformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | CN | AISHELL-2 (1000hours) | 5212 | 44M | Offline | Duration of input wav <= 20s |) + + +#### RNN-T Models + +### Multi-talker Speech Recognition Models + +#### MFCCA Models + +[//]: # (| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes |) + +[//]: # (|:-------------------------------------------------------------------------------------------------------------:|:--------:|:------------------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------|) + +[//]: # (| [MFCCA](https://www.modelscope.cn/models/NPU-ASLP/speech_mfcca_asr-zh-cn-16k-alimeeting-vocab4950/summary) | CN | AliMeeting、AISHELL-4、Simudata (917hours) | 4950 | 45M | Offline | Duration of input wav <= 20s, channel of input wav <= 8 channel |) + + + +### Voice Activity Detection Models + +| Model Name | Training Data | Parameters | Sampling Rate | Notes | +|:----------------------------------------------------:|:----------------------------:|:----------:|:-------------:|:------| +| [FSMN-VAD](https://huggingface.co/funasr/FSMN-VAD) | Alibaba Speech Data (5000hours) | 0.4M | 16000 | | + +[//]: # (| [FSMN-VAD](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-8k-common/summary) | Alibaba Speech Data (5000hours) | 0.4M | 8000 | |) + +### Punctuation Restoration Models + +| Model Name | Training Data | Parameters | Vocab Size| Offline/Online | Notes | +|:--------------------------------------------------------------------:|:----------------------------:|:----------:|:----------:|:--------------:|:------| +| [CT-Transformer](https://huggingface.co/funasr/CT-Transformer-punc) | Alibaba Text Data | 70M | 272727 | Offline | offline punctuation model | + +[//]: # (| [CT-Transformer](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727/summary) | Alibaba Text Data | 70M | 272727 | Online | online punctuation model |) + +### Language Models + +[//]: # (| Model Name | Training Data | Parameters | Vocab Size | Notes |) + +[//]: # (|:----------------------------------------------------------------------------------------------------------------------:|:----------------------------:|:----------:|:----------:|:------|) + +[//]: # (| [Transformer](https://www.modelscope.cn/models/damo/speech_transformer_lm_zh-cn-common-vocab8404-pytorch/summary) | Alibaba Speech Data (?hours) | 57M | 8404 | |) + +### Speaker Verification Models + +[//]: # (| Model Name | Training Data | Parameters | Number Speaker | Notes |) + +[//]: # (|:-------------------------------------------------------------------------------------------------------------:|:-----------------:|:----------:|:----------:|:------|) + +[//]: # (| [Xvector](https://www.modelscope.cn/models/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/summary) | CNCeleb (1,200 hours) | 17.5M | 3465 | Xvector, speaker verification, Chinese |) + +[//]: # (| [Xvector](https://www.modelscope.cn/models/damo/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch/summary) | CallHome (60 hours) | 61M | 6135 | Xvector, speaker verification, English |) + +### Speaker diarization Models + +[//]: # (| Model Name | Training Data | Parameters | Notes |) + +[//]: # (|:----------------------------------------------------------------------------------------------------------------:|:-------------------:|:----------:|:------|) + +[//]: # (| [SOND](https://www.modelscope.cn/models/damo/speech_diarization_sond-zh-cn-alimeeting-16k-n16k4-pytorch/summary) | AliMeeting (120 hours) | 40.5M | Speaker diarization, profiles and records, Chinese |) + +[//]: # (| [SOND](https://www.modelscope.cn/models/damo/speech_diarization_sond-en-us-callhome-8k-n16k4-pytorch/summary) | CallHome (60 hours) | 12M | Speaker diarization, profiles and records, English |) + +### Timestamp Prediction Models + +[//]: # (| Model Name | Language | Training Data | Parameters | Notes |) + +[//]: # (|:--------------------------------------------------------------------------------------------------:|:--------------:|:-------------------:|:----------:|:------|) + +[//]: # (| [TP-Aligner](https://modelscope.cn/models/damo/speech_timestamp_prediction-v1-16k-offline/summary) | CN | Alibaba Speech Data (50000hours) | 37.8M | Timestamp prediction, Mandarin, middle size |) diff --git a/model_zoo/modelscope_models.md b/model_zoo/modelscope_models.md new file mode 100644 index 0000000..46b1313 --- /dev/null +++ b/model_zoo/modelscope_models.md @@ -0,0 +1,128 @@ +([简体中文](./modelscope_models_zh.md)|English) + +# Pretrained Models Released on ModelScope + +## Model License +You are free to use, copy, modify, and share FunASR models under the conditions of this agreement. You should indicate the model source and author information when using, copying, modifying and sharing FunASR models. You should keep the relevant names of models in [FunASR software].. Full model license could see [license](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE) + +## Model Usage +Ref to [docs](https://alibaba-damo-academy.github.io/FunASR/en/modelscope_pipeline/quick_start.html) + +## Model Zoo +Here we provided several pretrained models on different datasets. The details of models and datasets can be found on [ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition). + +### Speech Recognition +#### Paraformer + +| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes | +|:--------------------------------------------------------------------------------------------------------------------------------------------------:|:--------:|:--------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [Paraformer-large](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Offline | Duration of input wav <= 20s | +| [Paraformer-large-long](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Offline | Which would deal with arbitrary length input wav | +| [Paraformer-large-en-long](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) | EN | Alibaba Speech Data (50000hours) | 10020 | 220M | Offline | Which would deal with arbitrary length input wav | +| [Paraformer-large-Spk](https://modelscope.cn/models/damo/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Offline | Supporting speaker diarizatioin for ASR results based on paraformer-large-long | +| [Paraformer-large-contextual](https://www.modelscope.cn/models/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Offline | Which supports the hotword customization based on the incentive enhancement, and improves the recall and precision of hotwords. | +| [Paraformer](https://modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8358-tensorflow1/summary) | CN & EN | Alibaba Speech Data (50000hours) | 8358 | 68M | Offline | Duration of input wav <= 20s | +| [Paraformer-online](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online/summary) | CN & EN | Alibaba Speech Data (50000hours) | 8404 | 68M | Online | Which could deal with streaming input | +| [Paraformer-large-online](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) | CN & EN | Alibaba Speech Data (60000hours) | 8404 | 220M | Online | Which could deal with streaming input | +| [Paraformer-tiny](https://www.modelscope.cn/models/damo/speech_paraformer-tiny-commandword_asr_nat-zh-cn-16k-vocab544-pytorch/summary) | CN | Alibaba Speech Data (200hours) | 544 | 5.2M | Offline | Lightweight Paraformer model which supports Mandarin command words recognition | +| [Paraformer-aishell](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-aishell1-pytorch/summary) | CN | AISHELL (178hours) | 4234 | 43M | Offline | | +| [ParaformerBert-aishell](https://modelscope.cn/models/damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch/summary) | CN | AISHELL (178hours) | 4234 | 43M | Offline | | +| [Paraformer-aishell2](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | CN | AISHELL-2 (1000hours) | 5212 | 64M | Offline | | +| [ParaformerBert-aishell2](https://www.modelscope.cn/models/damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | CN | AISHELL-2 (1000hours) | 5212 | 64M | Offline | | + + +#### UniASR [Unify Streaming and Non-streaming] + +| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes | +|:-------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------:|:---------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [UniASR](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-online/summary) | CN & EN | Alibaba Speech Data (60000 hours) | 8358 | 100M | Online | UniASR streaming offline unifying models | +| [UniASR-large](https://modelscope.cn/models/damo/speech_UniASR-large_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-offline/summary) | CN & EN | Alibaba Speech Data (60000 hours) | 8358 | 220M | Offline | UniASR streaming offline unifying models | +| [UniASR English](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-en-16k-common-vocab1080-tensorflow1-online/summary) | EN | Alibaba Speech Data (10000 hours) | 1080 | 95M | Online | UniASR streaming online unifying models | +| [UniASR Russian](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ru-16k-common-vocab1664-tensorflow1-online/summary) | RU | Alibaba Speech Data (5000 hours) | 1664 | 95M | Online | UniASR streaming online unifying models | +| [UniASR Japanese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ja-16k-common-vocab93-tensorflow1-online/summary) | JA | Alibaba Speech Data (5000 hours) | 5977 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR Korean](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ko-16k-common-vocab6400-tensorflow1-online/summary) | KO | Alibaba Speech Data (2000 hours) | 6400 | 95M | Online | UniASR streaming online unifying models | +| [UniASR Cantonese (CHS)](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-cantonese-CHS-16k-common-vocab1468-tensorflow1-online/summary) | Cantonese (CHS) | Alibaba Speech Data (5000 hours) | 1468 | 95M | Online | UniASR streaming online unifying models | +| [UniASR Indonesian](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-id-16k-common-vocab1067-tensorflow1-online/summary) | ID | Alibaba Speech Data (1000 hours) | 1067 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR Vietnamese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-vi-16k-common-vocab1001-pytorch-online/summary) | VI | Alibaba Speech Data (1000 hours) | 1001 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR Spanish](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-es-16k-common-vocab3445-tensorflow1-online/summary) | ES | Alibaba Speech Data (1000 hours) | 3445 | 95M | Online | UniASR streaming online unifying models | +| [UniASR Portuguese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-pt-16k-common-vocab1617-tensorflow1-online/summary) | PT | Alibaba Speech Data (1000 hours) | 1617 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR French](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-fr-16k-common-vocab3472-tensorflow1-online/summary) | FR | Alibaba Speech Data (1000 hours) | 3472 | 95M | Online | UniASR streaming online unifying models | +| [UniASR German](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-de-16k-common-vocab3690-tensorflow1-online/summary) | GE | Alibaba Speech Data (1000 hours) | 3690 | 95M | Online | UniASR streaming online unifying models | +| [UniASR Persian](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-fa-16k-common-vocab1257-pytorch-online/summary) | FA | Alibaba Speech Data (1000 hours) | 1257 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR Burmese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-my-16k-common-vocab696-pytorch/summary) | MY | Alibaba Speech Data (1000 hours) | 696 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR Hebrew](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-he-16k-common-vocab1085-pytorch/summary) | HE | Alibaba Speech Data (1000 hours) | 1085 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR Urdu](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ur-16k-common-vocab877-pytorch/summary) | UR | Alibaba Speech Data (1000 hours) | 877 | 95M | Online | UniASR streaming offline unifying models | +| [UniASR Turkish](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/summary) | TR | Alibaba Speech Data (1000 hours) | 1582 | 95M | Online | UniASR streaming offline unifying models | + + +#### Conformer + +| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes | +|:----------------------------------------------------------------------------------------------------------------------:|:--------:|:---------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [Conformer](https://modelscope.cn/models/damo/speech_conformer_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch/summary) | CN | AISHELL (178hours) | 4234 | 44M | Offline | Duration of input wav <= 20s | +| [Conformer](https://www.modelscope.cn/models/damo/speech_conformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | CN | AISHELL-2 (1000hours) | 5212 | 44M | Offline | Duration of input wav <= 20s | +| [Conformer](https://modelscope.cn/models/damo/speech_conformer_asr-en-16k-vocab4199-pytorch/summary) | EN | Alibaba Speech Data (10000hours) | 4199 | 220M | Offline | Duration of input wav <= 20s | + +### Multi-talker Speech Recognition + +| Model Name | Language | Training Data | Vocab Size | Parameter | Offline/Online | Notes | +|:-------------------------------------------------------------------------------------------------------------:|:--------:|:------------------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [MFCCA](https://www.modelscope.cn/models/NPU-ASLP/speech_mfcca_asr-zh-cn-16k-alimeeting-vocab4950/summary) | CN | AliMeeting、AISHELL-4、Simudata (917hours) | 4950 | 45M | Offline | Duration of input wav <= 20s, channel of input wav <= 8 channel | + + + +### Voice Activity Detection + +| Model Name | Training Data | Parameters | Sampling Rate | Notes | +|:----------------------------------------------------------------------------------------------:|:----------------------------:|:----------:|:-------------:|:------| +| [FSMN-VAD](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary) | Alibaba Speech Data (5000hours) | 0.4M | 16000 | | +| [FSMN-VAD](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-8k-common/summary) | Alibaba Speech Data (5000hours) | 0.4M | 8000 | | + +### Punctuation Restoration + +| Model Name | Language | Training Data | Parameters | Vocab Size| Offline/Online | Notes | +|:--------------------------------------------------------------------------------------------------------------------------:|:---------|:----------------------------:|:----------:|:----------:|:--------------:|:------| +| [CT-Transformer-Large](https://modelscope.cn/models/damo/punc_ct-transformer_cn-en-common-vocab471067-large/summary) | CN & EN | Alibaba Text Data(100M) | 1.1G | 471067 | Offline | large offline punctuation model | +| [CT-Transformer](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/summary) | CN & EN | Alibaba Text Data(70M) | 291M | 272727 | Offline | offline punctuation model | +| [CT-Transformer-Realtime](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727/summary) | CN & EN | Alibaba Text Data(70M) | 288M | 272727 | Online | online punctuation model | + +### Language Models + +| Model Name | Training Data | Parameters | Vocab Size | Notes | +|:----------------------------------------------------------------------------------------------------------------------:|:----------------------------:|:----------:|:----------:|:------| +| [Transformer](https://www.modelscope.cn/models/damo/speech_transformer_lm_zh-cn-common-vocab8404-pytorch/summary) | Alibaba Speech Data (?hours) | 57M | 8404 | | + +### Speaker Verification + +| Model Name | Training Data | Parameters | Number Speaker | Notes | +|:-------------------------------------------------------------------------------------------------------------:|:-----------------:|:----------:|:----------:|:------| +| [Xvector](https://www.modelscope.cn/models/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/summary) | CNCeleb (1,200 hours) | 17.5M | 3465 | Xvector, speaker verification, Chinese | +| [Xvector](https://www.modelscope.cn/models/damo/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch/summary) | CallHome (60 hours) | 61M | 6135 | Xvector, speaker verification, English | + +### Speaker Diarization + +| Model Name | Training Data | Parameters | Notes | +|:----------------------------------------------------------------------------------------------------------------:|:-------------------:|:----------:|:------| +| [SOND](https://www.modelscope.cn/models/damo/speech_diarization_sond-zh-cn-alimeeting-16k-n16k4-pytorch/summary) | AliMeeting (120 hours) | 40.5M | Speaker diarization, profiles and records, Chinese | +| [SOND](https://www.modelscope.cn/models/damo/speech_diarization_sond-en-us-callhome-8k-n16k4-pytorch/summary) | CallHome (60 hours) | 12M | Speaker diarization, profiles and records, English | + +### Timestamp Prediction +| Model Name | Language | Training Data | Parameters | Notes | +|:--------------------------------------------------------------------------------------------------:|:--------------:|:-------------------:|:----------:|:------| +| [TP-Aligner](https://modelscope.cn/models/damo/speech_timestamp_prediction-v1-16k-offline/summary) | CN | Alibaba Speech Data (50000hours) | 37.8M | Timestamp prediction, Mandarin, middle size | + +### Inverse Text Normalization (ITN) + +| Model Name | Language | Parameters | Notes | +|:----------------------------------------------------------------------------------------------------------------:|:--------:|:----------:|:-------------------------| +| [English](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-en/summary) | EN | 1.54M | ITN, ASR post-processing | +| [Russian](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-ru/summary) | RU | 17.79M | ITN, ASR post-processing | +| [Japanese](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-ja/summary) | JA | 6.8M | ITN, ASR post-processing | +| [Korean](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-ko/summary) | KO | 1.28M | ITN, ASR post-processing | +| [Indonesian](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-id/summary) | ID | 2.06M | ITN, ASR post-processing | +| [Vietnamese](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-vi/summary) | VI | 0.92M | ITN, ASR post-processing | +| [Tagalog](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-tl/summary) | TL | 0.65M | ITN, ASR post-processing | +| [Spanish](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-es/summary) | ES | 1.32M | ITN, ASR post-processing | +| [Portuguese](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-pt/summary) | PT | 1.28M | ITN, ASR post-processing | +| [French](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-fr/summary) | FR | 4.39M | ITN, ASR post-processing | +| [German](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-de/summary)| GE | 3.95M | ITN, ASR post-processing | diff --git a/model_zoo/modelscope_models_zh.md b/model_zoo/modelscope_models_zh.md new file mode 100644 index 0000000..1f501a3 --- /dev/null +++ b/model_zoo/modelscope_models_zh.md @@ -0,0 +1,134 @@ +(简体中文|[English](./modelscope_models.md)) + +# ModelScope上的预训练模型 + +## 模型许可协议 +您可以在本协议的条件下自由使用、复制、修改和分享FunASR模型。在使用、复制、修改和分享FunASR模型时,您应当标明模型来源和作者信息。您应当在[FunASR软件]中保留相关模型的名称。完整的模型许可证请参见 [模型许可协议](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE) + +## 模型用法 +模型用法参考[文档](funasr/quick_start_zh.md) + +## 模型仓库 +这里我们提供了在不同数据集上预训练的模型。模型和数据集的详细信息可在 [ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition)中找到. + +### 语音识别模型 +#### Paraformer模型 + +| 模型名字 | 语言 | 训练数据 | 词典大小 | 参数量 | 非实时/实时 | 备注 | +|:--------------------------------------------------------------------------------------------------------------------------------------------------:|:--------:|:---------------------:|:-----------------:|:----:|:-------:|:---------------------------| +| [Paraformer-large](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | 中文和英文 | 阿里巴巴语音数据(60000小时) | 8404 | 220M | 非实时 | 输入wav文件持续时间不超过20秒 | +| [Paraformer-large长音频版本](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | 中文和英文 | 阿里巴巴语音数据(60000小时) | 8404 | 220M | 非实时 | 能够处理任意长度的输入wav文件 | +| [Paraformer-large-en长音频版本](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) | 英文 | 阿里巴巴语音数据(50000小时) | 10020 | 220M | 非实时 | 能够处理任意长度的输入wav文件 | +| [Paraformer-large-Spk](https://modelscope.cn/models/damo/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/summary) | 中文和英文 | 阿里巴巴语音数据(60000小时) | 8404 | 220M | 非实时 | 在长音频功能的基础上添加说话人识别功能 | +| [Paraformer-large热词](https://www.modelscope.cn/models/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/summary) | 中文和英文 | 阿里巴巴语音数据(60000小时) | 8404 | 220M | 非实时 | 基于激励增强的热词定制支持,可以提高热词的召回率和准确率,输入wav文件持续时间不超过20秒 | +| [Paraformer](https://modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8358-tensorflow1/summary) | 中文和英文 | 阿里巴巴语音数据(50000小时) | 8358 | 68M | 离线 | 输入wav文件持续时间不超过20秒 | +| [Paraformer实时](https://modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online/summary) | 中文和英文 | 阿里巴巴语音数据 (50000hours) | 8404 | 68M | 实时 | 能够处理流式输入 | +| [Paraformer-large实时](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) | 中文和英文 | 阿里巴巴语音数据 (60000hours) | 8404 | 220M | 实时 | 能够处理流式输入 | +| [Paraformer-tiny](https://www.modelscope.cn/models/damo/speech_paraformer-tiny-commandword_asr_nat-zh-cn-16k-vocab544-pytorch/summary) | 中文 | 阿里巴巴语音数据 (200hours) | 544 | 5.2M | 非实时 | 轻量级Paraformer模型,支持普通话命令词识别 | +| [Paraformer-aishell](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-aishell1-pytorch/summary) | 中文 | AISHELL (178hours) | 4234 | 43M | 非实时 | 学术模型 | +| [ParaformerBert-aishell](https://modelscope.cn/models/damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch/summary) | 中文 | AISHELL (178hours) | 4234 | 43M | 非实时 | 学术模型 | +| [Paraformer-aishell2](https://www.modelscope.cn/models/damo/speech_paraformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | 中文 | AISHELL-2 (1000hours) | 5212 | 64M | 非实时 | 学术模型 | +| [ParaformerBert-aishell2](https://www.modelscope.cn/models/damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | 中文 | AISHELL-2 (1000hours) | 5212 | 64M | 非实时 | 学术模型 | + + +#### UniASR模型 + +| 模型名字 | 语言 | 训练数据 | Vocab Size | Parameter | 非实时/实时 | 备注 | +|:---------------------------------------------------------------------------------------------------------------------------------------------:|:--------:|:---------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [UniASR](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-online/summary) | 中文和英文 | 阿里巴巴语音数据 (60000 小时) | 8358 | 100M | 实时 | 流式离线一体化模型 | +| [UniASR-large](https://modelscope.cn/models/damo/speech_UniASR-large_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-offline/summary) | 中文和英文 | 阿里巴巴语音数据 (60000 小时) | 8358 | 220M | 非实时 | 流式离线一体化模型 | +| [UniASR English](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-en-16k-common-vocab1080-tensorflow1-online/summary) | 英文 | 阿里巴巴语音数据 (10000 小时) | 1080 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Russian](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ru-16k-common-vocab1664-tensorflow1-online/summary) | 俄语 | 阿里巴巴语音数据 (5000 小时) | 1664 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Japanese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ja-16k-common-vocab93-tensorflow1-online/summary) | 日语 | 阿里巴巴语音数据 (5000 小时) | 5977 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Korean](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ko-16k-common-vocab6400-tensorflow1-online/summary) | 韩语 | 阿里巴巴语音数据 (2000 小时) | 6400 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Cantonese (CHS)](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-cantonese-CHS-16k-common-vocab1468-tensorflow1-online/summary) | 粤语(简体中文) | 阿里巴巴语音数据 (5000 小时) | 1468 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Indonesian](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-id-16k-common-vocab1067-tensorflow1-online/summary) | 印尼语 | 阿里巴巴语音数据 (1000 小时) | 1067 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Vietnamese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-vi-16k-common-vocab1001-pytorch-online/summary) | 越南语 | 阿里巴巴语音数据 (1000 小时) | 1001 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Spanish](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-es-16k-common-vocab3445-tensorflow1-online/summary) | 西班牙语 | 阿里巴巴语音数据 (1000 小时) | 3445 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Portuguese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-pt-16k-common-vocab1617-tensorflow1-online/summary) | 葡萄牙语 | 阿里巴巴语音数据 (1000 小时) | 1617 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR French](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-fr-16k-common-vocab3472-tensorflow1-online/summary) | 法语 | 阿里巴巴语音数据 (1000 小时) | 3472 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR German](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-de-16k-common-vocab3690-tensorflow1-online/summary) | 德语 | 阿里巴巴语音数据 (1000 小时) | 3690 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Persian](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-fa-16k-common-vocab1257-pytorch-online/summary) | 波斯语 | 阿里巴巴语音数据 (1000 小时) | 1257 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Burmese](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-my-16k-common-vocab696-pytorch/summary) | 缅甸语 | 阿里巴巴语音数据 (1000 小时) | 696 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Hebrew](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-he-16k-common-vocab1085-pytorch/summary) | 希伯来语 | 阿里巴巴语音数据 (1000 小时) | 1085 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Urdu](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ur-16k-common-vocab877-pytorch/summary) | 乌尔都语 | 阿里巴巴语音数据 (1000 小时) | 877 | 95M | 实时 | 流式离线一体化模型 | +| [UniASR Turkish](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/summary) | 土耳其语 | 阿里巴巴语音数据 (1000 小时) | 1582 | 95M | 实时 | 流式离线一体化模型 | + + +#### Conformer模型 + +| 模型名字 | 语言 | 训练数据 | Vocab Size | Parameter | 非实时/实时 | 备注 | +|:----------------------------------------------------------------------------------------------------------------------:|:--------:|:---------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [Conformer](https://modelscope.cn/models/damo/speech_conformer_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch/summary) | 中文 | AISHELL (178hours) | 4234 | 44M | 非实时 | 输入wav文件持续时间不超过20秒 | +| [Conformer](https://www.modelscope.cn/models/damo/speech_conformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch/summary) | 中文 | AISHELL-2 (1000hours) | 5212 | 44M | 非实时 | 输入wav文件持续时间不超过20秒 | +| [Conformer](https://modelscope.cn/models/damo/speech_conformer_asr-en-16k-vocab4199-pytorch/summary) | 英文 | 阿里巴巴语音数据 (10000hours) | 4199 | 220M | 非实时 | 输入wav文件持续时间不超过20秒 | + + +#### RNN-T 模型 + +### 多说话人语音识别模型 + +#### MFCCA模型 + +| 模型名字 | 语言 | 训练数据 | Vocab Size | Parameter | 非实时/实时 | 备注 | +|:-------------------------------------------------------------------------------------------------------------:|:--------:|:------------------------------------------:|:----------:|:---------:|:--------------:|:--------------------------------------------------------------------------------------------------------------------------------| +| [MFCCA](https://www.modelscope.cn/models/NPU-ASLP/speech_mfcca_asr-zh-cn-16k-alimeeting-vocab4950/summary) | 中文 | AliMeeting、AISHELL-4、Simudata (917hours) | 4950 | 45M | 非实时 | 输入音频的持续时间不超过20秒,输入音频的通道数不超过8通道。 | + + + +### 语音端点检测模型 + +| 模型名字 | 训练数据 | 模型参数 | Sampling Rate | 备注 | +|:----------------------------------------------------------------------------------------------:|:----------------------------:|:----------:|:-------------:|:------| +| [FSMN-VAD](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary) | 阿里巴巴语音数据 (5000hours) | 0.4M | 16000 | | +| [FSMN-VAD](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-8k-common/summary) | 阿里巴巴语音数据 (5000hours) | 0.4M | 8000 | | + +### 标点恢复模型 + +| 模型名字 | 语言 | 训练数据 | 模型参数 | Vocab Size| 非实时/实时 | 备注 | +|:--------------------------------------------------------------------------------------------------------------------------:|:----------:|:----------------------------:|:----------:|:----------:|:--------------:|:--------| +| [CT-Transformer-Large](https://modelscope.cn/models/damo/punc_ct-transformer_cn-en-common-vocab471067-large/summary) | 中文和英文 | Alibaba Text Data(100M) | 1.1G | 471067 | 非实时 | 支持中英文标点大模型 | +| [CT-Transformer](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/summary) | 中文和英文 | Alibaba Text Data(70M) | 291M | 272727 | 非实时 | 支持中英文标点 | +| [CT-Transformer-Realtime](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727/summary) | 中文和英文 | Alibaba Text Data(70M) | 288M | 272727 | 实时 | VAD点实时标点 | + +### 语音模型 + +| 模型名字 | 训练数据 | 模型参数 | 词典大小 | 备注 | +|:----------------------------------------------------------------------------------------------------------------------:|:---------:|:----------:|:----:|:------| +| [Transformer](https://www.modelscope.cn/models/damo/speech_transformer_lm_zh-cn-common-vocab8404-pytorch/summary) | 阿里巴巴语音数据 | 57M | 8404 | | + +### 说话人确认模型 + +| 模型名字 | 训练数据 | 模型参数 | Number Speaker | 备注 | +|:-------------------------------------------------------------------------------------------------------------:|:-----------------:|:----------:|:----------:|:------------| +| [Xvector](https://www.modelscope.cn/models/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/summary) | CNCeleb (1,200 小时) | 17.5M | 3465 | Xvector, 中文 | +| [Xvector](https://www.modelscope.cn/models/damo/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch/summary) | CallHome (60 小时) | 61M | 6135 | Xvector,英文 | + +### 说话人日志模型 + +| 模型名字 | 训练数据 | 模型参数 | 备注 | +|:----------------------------------------------------------------------------------------------------------------:|:-------------------:|:----------:|:----| +| [SOND](https://www.modelscope.cn/models/damo/speech_diarization_sond-zh-cn-alimeeting-16k-n16k4-pytorch/summary) | AliMeeting (120 小时) | 40.5M | 中文 | +| [SOND](https://www.modelscope.cn/models/damo/speech_diarization_sond-en-us-callhome-8k-n16k4-pytorch/summary) | CallHome (60 小时) | 12M | 英文 | + +### 时间戳预测模型 + +| 模型名字 | 语言 | 训练数据 | 模型参数 | 备注 | +|:--------------------------------------------------------------------------------------------------:|:--------------:|:-------------------:|:----------:|:---------| +| [TP-Aligner](https://modelscope.cn/models/damo/speech_timestamp_prediction-v1-16k-offline/summary) |中文| 阿里巴巴语音数据 (50000hours) | 37.8M | 时间戳模型,中文 | + +### 逆文本正则化 + +| 模型名字 | 语言 | 模型参数 | 备注 | +|:----------------------------------------------------------------------------------------------------------------:|:---:|:------:|:--------------| +| [English](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-en/summary) | EN | 1.54M | ITN,语音识别文本后处理 | +| [Russian](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-ru/summary) | RU | 17.79M | ITN,语音识别文本后处理 | +| [Japanese](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-ja/summary) | JA | 6.8M | ITN,语音识别文本后处理 | +| [Korean](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-ko/summary) | KO | 1.28M | ITN,语音识别文本后处理 | +| [Indonesian](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-id/summary) | ID | 2.06M | ITN,语音识别文本后处理 | +| [Vietnamese](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-vi/summary) | VI | 0.92M | ITN,语音识别文本后处理 | +| [Tagalog](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-tl/summary) | TL | 0.65M | ITN,语音识别文本后处理 | +| [Spanish](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-es/summary) | ES | 1.32M | ITN,语音识别文本后处理 | +| [Portuguese](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-pt/summary) | PT | 1.28M | ITN,语音识别文本后处理 | +| [French](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-fr/summary) | FR | 4.39M | ITN,语音识别文本后处理 | +| [German](https://modelscope.cn/models/damo/speech_inverse_text_processing_fun-text-processing-itn-de/summary)| GE | 3.95M | ITN,语音识别文本后处理 | diff --git a/model_zoo/readme.md b/model_zoo/readme.md new file mode 100644 index 0000000..133307b --- /dev/null +++ b/model_zoo/readme.md @@ -0,0 +1,32 @@ +([简体中文](./readme_zh.md)|English) + +# Model Zoo + +## Model License +You are free to use, copy, modify, and share FunASR models under the conditions of this agreement. You should indicate the model source and author information when using, copying, modifying and sharing FunASR models. You should keep the relevant names of models in [FunASR software]. Full model license could see [license](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE) + +## Model Usage +Ref to [docs](https://alibaba-damo-academy.github.io/FunASR/en/modelscope_pipeline/quick_start.html) + +## Model Zoo +Here we provided several pretrained models on different datasets. The details of models and datasets can be found on [ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition). + +### Speech Recognition +#### Paraformer + + +FunASR has open-sourced a large number of pre-trained models on industrial data. You are free to use, copy, modify, and share FunASR models under the [Model License Agreement](./MODEL_LICENSE). Below are some representative models, for more models please refer to the [Model Zoo](). + +(Note: 🤗 represents the Huggingface model zoo link, ⭐ represents the ModelScope model zoo link) + + +| Model Name | Task Details | Training Data | Parameters | +|:------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------:|:--------------------------------:|:----------:| +| paraformer-zh
([⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) [🤗]() ) | speech recognition, with timestamps, non-streaming | 60000 hours, Mandarin | 220M | +| paraformer-zh-spk
( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/summary) [🤗]() ) | speech recognition with speaker diarization, with timestamps, non-streaming | 60000 hours, Mandarin | 220M | +| paraformer-zh-online
( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗]() )
| speech recognition, streaming | 60000 hours, Mandarin | 220M | +| paraformer-en
( [⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) [🤗]() ) | speech recognition, with timestamps, non-streaming | 50000 hours, English | 220M | +| conformer-en
( [⭐](https://modelscope.cn/models/damo/speech_conformer_asr-en-16k-vocab4199-pytorch/summary) [🤗]() ) | speech recognition, non-streaming | 50000 hours, English | 220M | +| ct-punc
( [⭐](https://modelscope.cn/models/damo/punc_ct-transformer_cn-en-common-vocab471067-large/summary) [🤗]() ) | punctuation restoration | 100M, Mandarin and English | 1.1G | +| fsmn-vad
( [⭐](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary) [🤗]() ) | voice activity detection | 5000 hours, Mandarin and English | 0.4M | +| fa-zh
( [⭐](https://modelscope.cn/models/damo/speech_timestamp_prediction-v1-16k-offline/summary) [🤗]() ) | timestamp prediction | 5000 hours, Mandarin | 38M | diff --git a/model_zoo/readme_zh.md b/model_zoo/readme_zh.md new file mode 100644 index 0000000..657b4f1 --- /dev/null +++ b/model_zoo/readme_zh.md @@ -0,0 +1,28 @@ +(简体中文|[English](./readme.md)) + +# 模型仓库 + +## 模型许可协议 +您可以在本协议的条件下自由使用、复制、修改和分享FunASR模型。在使用、复制、修改和分享FunASR模型时,您应当标明模型来源和作者信息。您应当在[FunASR软件]中保留相关模型的名称。完整的模型许可证请参见 [模型许可协议](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE) + +## 模型用法 +模型用法参考[文档](funasr/quick_start_zh.md) + +## 模型仓库 +这里我们提供了在不同数据集上预训练的模型。模型和数据集的详细信息可在 [ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition)中找到. + +### 语音识别模型 +#### Paraformer模型 + +(注:[🤗]()表示Huggingface模型仓库链接,[⭐]()表示ModelScope模型仓库链接) + +| 模型名字 | 任务详情 | 训练数据 | 参数量 | +|:--------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------:|:------------:|:----:| +| paraformer-zh
([⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) [🤗]() ) | 语音识别,带时间戳输出,非实时 | 60000小时,中文 | 220M | +| SeACoParaformer-zh
( [⭐](https://www.modelscope.cn/models/iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) [🤗]() ) | 带热词功能的语音识别,带时间戳输出,非实时 | 60000小时,中文 | 220M | +| paraformer-zh-spk
( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/summary) [🤗]() ) | 分角色语音识别,带时间戳输出,非实时 | 60000小时,中文 | 220M | +| paraformer-zh-streaming
( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗]() ) | 语音识别,实时 | 60000小时,中文 | 220M | +| paraformer-zh-streaming-small
( [⭐](https://www.modelscope.cn/models/iic/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗]() ) | 语音识别,实时 | 60000小时,中文 | 220M | + +| paraformer-en
( [⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) [🤗]() ) | 语音识别,非实时 | 50000小时,英文 | 220M | + diff --git a/runtime/__init__.py b/runtime/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/runtime/android/AndroidClient/app/build.gradle b/runtime/android/AndroidClient/app/build.gradle new file mode 100644 index 0000000..f2499ad --- /dev/null +++ b/runtime/android/AndroidClient/app/build.gradle @@ -0,0 +1,71 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} + +android { + namespace 'com.yeyupiaoling.androidclient' + compileSdk 33 + + defaultConfig { + applicationId "com.yeyupiaoling.androidclient" + minSdk 24 + targetSdk 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary true + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + buildFeatures { + compose true + } + composeOptions { + kotlinCompilerExtensionVersion '1.4.3' + } + packaging { + resources { + excludes += '/META-INF/{AL2.0,LGPL2.1}' + } + } +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1' + implementation 'androidx.activity:activity-compose:1.7.0' + implementation platform('androidx.compose:compose-bom:2023.03.00') + implementation 'androidx.compose.ui:ui' + implementation 'androidx.compose.ui:ui-graphics' + implementation 'androidx.compose.ui:ui-tooling-preview' + implementation 'androidx.compose.material3:material3' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.8.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation platform('androidx.compose:compose-bom:2023.03.00') + androidTestImplementation 'androidx.compose.ui:ui-test-junit4' + debugImplementation 'androidx.compose.ui:ui-tooling' + debugImplementation 'androidx.compose.ui:ui-test-manifest' + + implementation 'com.squareup.okhttp3:okhttp:4.9.1' +} \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/proguard-rules.pro b/runtime/android/AndroidClient/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/runtime/android/AndroidClient/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/src/androidTest/java/com/yeyupiaoling/androidclient/ExampleInstrumentedTest.kt b/runtime/android/AndroidClient/app/src/androidTest/java/com/yeyupiaoling/androidclient/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..ac1b6d9 --- /dev/null +++ b/runtime/android/AndroidClient/app/src/androidTest/java/com/yeyupiaoling/androidclient/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.yeyupiaoling.androidclient + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.yeyupiaoling.androidclient", appContext.packageName) + } +} \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/src/main/AndroidManifest.xml b/runtime/android/AndroidClient/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..74c5d0c --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/AudioView.java b/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/AudioView.java new file mode 100644 index 0000000..0d7bd34 --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/AudioView.java @@ -0,0 +1,216 @@ +package com.yeyupiaoling.androidclient; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.Point; +import android.util.AttributeSet; +import android.view.View; + +import androidx.annotation.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class AudioView extends View { + + // 频谱数量 + private static final int LUMP_COUNT = 128; + private static final int LUMP_WIDTH = 6; + private static final int LUMP_SPACE = 2; + private static final int LUMP_MIN_HEIGHT = LUMP_WIDTH; + private static final int LUMP_MAX_HEIGHT = 200;//TODO: HEIGHT + private static final int LUMP_SIZE = LUMP_WIDTH + LUMP_SPACE; + private static final int LUMP_COLOR = Color.parseColor("#6de8fd"); + + private static final int WAVE_SAMPLING_INTERVAL = 3; + + private static final float SCALE = LUMP_MAX_HEIGHT / LUMP_COUNT; + + private ShowStyle upShowStyle = ShowStyle.STYLE_HOLLOW_LUMP; + private ShowStyle downShowStyle = ShowStyle.STYLE_WAVE; + + private byte[] waveData; + List pointList; + + private Paint lumpPaint; + Path wavePath = new Path(); + + + public AudioView(Context context) { + super(context); + init(); + } + + public AudioView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + init(); + } + + public AudioView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + private void init() { + lumpPaint = new Paint(); + lumpPaint.setAntiAlias(true); + lumpPaint.setColor(LUMP_COLOR); + + lumpPaint.setStrokeWidth(2); + lumpPaint.setStyle(Paint.Style.STROKE); + } + + public void setWaveData(byte[] data) { + this.waveData = readyData(data); + genSamplingPoint(data); + invalidate(); + } + + + public void setStyle(ShowStyle upShowStyle, ShowStyle downShowStyle) { + this.upShowStyle = upShowStyle; + this.downShowStyle = downShowStyle; + } + + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + wavePath.reset(); + + for (int i = 0; i < LUMP_COUNT; i++) { + if (waveData == null) { + canvas.drawRect((LUMP_WIDTH + LUMP_SPACE) * i, + LUMP_MAX_HEIGHT - LUMP_MIN_HEIGHT, + (LUMP_WIDTH + LUMP_SPACE) * i + LUMP_WIDTH, + LUMP_MAX_HEIGHT, + lumpPaint); + continue; + } + + switch (upShowStyle) { + case STYLE_HOLLOW_LUMP: + drawLump(canvas, i, false); + break; + case STYLE_WAVE: + drawWave(canvas, i, false); + break; + default: + break; + } + + switch (downShowStyle) { + case STYLE_HOLLOW_LUMP: + drawLump(canvas, i, true); + break; + case STYLE_WAVE: + drawWave(canvas, i, true); + break; + default: + break; + } + } + } + + /** + * 预处理数据 + * + * @return + */ + private static byte[] readyData(byte[] fft) { + byte[] newData = new byte[LUMP_COUNT]; + byte abs; + for (int i = 0; i < LUMP_COUNT; i++) { + abs = (byte) Math.abs(fft[i]); + //描述:Math.abs -128时越界 + newData[i] = abs < 0 ? 127 : abs; + } + return newData; + } + + /** + * 绘制曲线 + * + * @param canvas + * @param i + * @param reversal + */ + private void drawWave(Canvas canvas, int i, boolean reversal) { + if (pointList == null || pointList.size() < 2) { + return; + } + float ratio = SCALE * (reversal ? -1 : 1); + if (i < pointList.size() - 2) { + Point point = pointList.get(i); + Point nextPoint = pointList.get(i + 1); + int midX = (point.x + nextPoint.x) >> 1; + if (i == 0) { + wavePath.moveTo(point.x, LUMP_MAX_HEIGHT - point.y * ratio); + } + wavePath.cubicTo(midX, LUMP_MAX_HEIGHT - point.y * ratio, + midX, LUMP_MAX_HEIGHT - nextPoint.y * ratio, + nextPoint.x, LUMP_MAX_HEIGHT - nextPoint.y * ratio); + + canvas.drawPath(wavePath, lumpPaint); + } + } + + /** + * 绘制矩形条 + */ + private void drawLump(Canvas canvas, int i, boolean reversal) { + int minus = reversal ? -1 : 1; + float top = (LUMP_MAX_HEIGHT - (LUMP_MIN_HEIGHT + waveData[i] * SCALE) * minus); + + canvas.drawRect(LUMP_SIZE * i, + top, + LUMP_SIZE * i + LUMP_WIDTH, + LUMP_MAX_HEIGHT, + lumpPaint); + } + + /** + * 生成波形图的采样数据,减少计算量 + * + * @param data + */ + private void genSamplingPoint(byte[] data) { + if (upShowStyle != ShowStyle.STYLE_WAVE && downShowStyle != ShowStyle.STYLE_WAVE) { + return; + } + if (pointList == null) { + pointList = new ArrayList<>(); + } else { + pointList.clear(); + } + pointList.add(new Point(0, 0)); + for (int i = WAVE_SAMPLING_INTERVAL; i < LUMP_COUNT; i += WAVE_SAMPLING_INTERVAL) { + pointList.add(new Point(LUMP_SIZE * i, waveData[i])); + } + pointList.add(new Point(LUMP_SIZE * LUMP_COUNT, 0)); + } + + + /** + * 可视化样式 + */ + public enum ShowStyle { + /** + * 空心的矩形小块 + */ + STYLE_HOLLOW_LUMP, + + /** + * 曲线 + */ + STYLE_WAVE, + + /** + * 不显示 + */ + STYLE_NOTHING + } +} \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/MainActivity.java b/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/MainActivity.java new file mode 100644 index 0000000..e7925ab --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/MainActivity.java @@ -0,0 +1,361 @@ +package com.yeyupiaoling.androidclient; + +import android.Manifest; +import android.annotation.SuppressLint; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.media.AudioFormat; +import android.media.AudioRecord; +import android.media.MediaRecorder; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.MotionEvent; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.WebSocket; +import okhttp3.WebSocketListener; +import okio.ByteString; + +public class MainActivity extends AppCompatActivity { + public static final String TAG = MainActivity.class.getSimpleName(); + // WebSocket地址 + public String ASR_HOST = ""; + // 官方WebSocket地址 + public static final String DEFAULT_HOST = "wss://101.37.77.25:10088"; + // 发送的JSON数据 + public static final String MODE = "2pass"; + public static final String CHUNK_SIZE = "5, 10, 5"; + public static final int CHUNK_INTERVAL = 10; + public static final int SEND_SIZE = 1920; + // 热词 + private String hotWords = "阿里巴巴 20\n达摩院 20\n夜雨飘零 20\n"; + // 采样率 + public static final int SAMPLE_RATE = 16000; + // 声道数 + public static final int CHANNEL = AudioFormat.CHANNEL_IN_MONO; + // 返回的音频数据的格式 + public static final int AUDIO_FORMAT = AudioFormat.ENCODING_PCM_16BIT; + private AudioRecord audioRecord; + private boolean isRecording = false; + private AudioView audioView; + private String allAsrText = ""; + private String asrText = ""; + private SharedPreferences sharedPreferences; + // 控件 + private Button recordBtn; + private TextView resultText; + + @SuppressLint("ClickableViewAccessibility") + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + // 请求权限 + if (!hasPermission()) { + requestPermission(); + } + // 显示识别结果控件 + resultText = findViewById(R.id.result_text); + // 显示录音状态控件 + audioView = findViewById(R.id.audioView); + audioView.setStyle(AudioView.ShowStyle.STYLE_HOLLOW_LUMP, AudioView.ShowStyle.STYLE_NOTHING); + // 按下识别按钮 + recordBtn = findViewById(R.id.record_button); + recordBtn.setOnTouchListener((v, event) -> { + if (event.getAction() == MotionEvent.ACTION_UP) { + if (!ASR_HOST.equals("")) { + isRecording = false; + stopRecording(); + recordBtn.setText("按下录音"); + } + } else if (event.getAction() == MotionEvent.ACTION_DOWN) { + if (!ASR_HOST.equals("")) { + allAsrText = ""; + asrText = ""; + isRecording = true; + startRecording(); + recordBtn.setText("录音中..."); + } + } + return true; + }); + // 读取WebSocket地址 + sharedPreferences = getSharedPreferences("FunASR", MODE_PRIVATE); + String uri = sharedPreferences.getString("uri", ""); + if (uri.equals("")) { + showUriInput(); + } else { + ASR_HOST = uri; + } + // 读取热词 + String hotWords = sharedPreferences.getString("hotwords", null); + if (hotWords != null) { + this.hotWords = hotWords; + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + int id = item.getItemId(); + if (id == R.id.change_uri) { + showUriInput(); + return true; + } else if (id == R.id.change_hotwords) { + showHotWordsInput(); + return true; + } + return super.onOptionsItemSelected(item); + } + + // 显示WebSocket地址输入框 + private void showUriInput() { + AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); + builder.setTitle("请输入WebSocket地址:"); + View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.dialog_input_uri, null); + final EditText input = view.findViewById(R.id.uri_edit_text); + if (!ASR_HOST.equals("")) { + input.setText(ASR_HOST); + } + builder.setView(view); + builder.setPositiveButton("确定", (dialog, id) -> { + ASR_HOST = input.getText().toString(); + if (!ASR_HOST.equals("")) { + Toast.makeText(MainActivity.this, "WebSocket地址:" + ASR_HOST, Toast.LENGTH_SHORT).show(); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.putString("uri", ASR_HOST); + editor.apply(); + } + }); + builder.setNeutralButton("使用官方服务", (dialog, id) -> { + ASR_HOST = DEFAULT_HOST; + input.setText(DEFAULT_HOST); + Toast.makeText(MainActivity.this, "WebSocket地址:" + ASR_HOST, Toast.LENGTH_SHORT).show(); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.putString("uri", ASR_HOST); + editor.apply(); + }); + AlertDialog dialog = builder.create(); + dialog.show(); + } + + // 显示热词输入框 + private void showHotWordsInput() { + AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); + builder.setTitle("请输入热词:"); + View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.dialog_input_hotwords, null); + final EditText input = view.findViewById(R.id.hotwords_edit_text); + if (!this.hotWords.equals("")) { + input.setText(this.hotWords); + } + builder.setView(view); + builder.setPositiveButton("确定", (dialog, id) -> { + String hotwords = input.getText().toString(); + this.hotWords = hotwords; + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.putString("hotwords", hotwords); + editor.apply(); + }); + AlertDialog dialog = builder.create(); + dialog.show(); + } + + // 开始录音 + private void startRecording() { + // 准备录音器 + try { + // 确保有权限 + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { + requestPermission(); + return; + } + // 创建录音器 + audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, SAMPLE_RATE, CHANNEL, AUDIO_FORMAT, SEND_SIZE); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + // 开启一个线程将录音数据写入文件 + Thread recordingAudioThread = new Thread(() -> { + try { + setAudioData(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + recordingAudioThread.start(); + // 启动录音器 + audioRecord.startRecording(); + audioView.setVisibility(View.VISIBLE); + } + + // 停止录音器 + private void stopRecording() { + audioRecord.stop(); + audioRecord.release(); + audioRecord = null; + audioView.setVisibility(View.GONE); + } + + // 读取录音数据 + private void setAudioData() throws Exception { + // 建立WebSocket连接 + OkHttpClient client = new OkHttpClient.Builder() + // 忽略验证证书 + .sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.getX509TrustManager()) + // 不验证域名 + .hostnameVerifier(SSLSocketClient.getHostnameVerifier()) + .build(); + Request request = new Request.Builder() + .url(ASR_HOST) + .build(); + WebSocket webSocket = client.newWebSocket(request, new WebSocketListener() { + + @Override + public void onOpen(@NonNull WebSocket webSocket, @NonNull Response response) { + // 连接成功时的处理 + Log.d(TAG, "WebSocket连接成功"); + runOnUiThread(() -> Toast.makeText(MainActivity.this, "WebSocket连接成功", Toast.LENGTH_SHORT).show()); + } + + @Override + public void onMessage(@NonNull WebSocket webSocket, @NonNull String text) { + // 接收到消息时的处理 + Log.d(TAG, "WebSocket接收到消息: " + text); + try { + JSONObject jsonObject = new JSONObject(text); + String t = jsonObject.getString("text"); + boolean isFinal = jsonObject.getBoolean("is_final"); + if (!t.equals("")) { + // 拼接识别结果 + String mode = jsonObject.getString("mode"); + if (mode.equals("2pass-offline")) { + asrText = ""; + allAsrText = allAsrText + t; + // 这里可以做一些自动停止录音识别的程序 + } else { + asrText = asrText + t; + } + } + // 显示语音识别结果消息 + if (!(allAsrText + asrText).equals("")) { + runOnUiThread(() -> resultText.setText(allAsrText + asrText)); + } + // 如果检测的录音停止就关闭WebSocket连接 + if (isFinal) { + webSocket.close(1000, "关闭WebSocket连接"); + } + } catch (JSONException e) { + throw new RuntimeException(e); + } + } + + @Override + public void onClosing(@NonNull WebSocket webSocket, int code, @NonNull String reason) { + // 关闭连接时的处理 + Log.d(TAG, "WebSocket关闭连接: " + reason); + } + + @Override + public void onFailure(@NonNull WebSocket webSocket, @NonNull Throwable t, Response response) { + // 连接失败时的处理 + Log.d(TAG, "WebSocket连接失败: " + t + ": " + response); + runOnUiThread(() -> Toast.makeText(MainActivity.this, "WebSocket连接失败:" + t, Toast.LENGTH_SHORT).show()); + } + }); + String message = getMessage(true); + Log.d(TAG, "WebSocket发送消息: " + message); + webSocket.send(message); + + audioRecord.startRecording(); + byte[] bytes = new byte[SEND_SIZE]; + while (isRecording) { + int readSize = audioRecord.read(bytes, 0, SEND_SIZE); + if (readSize > 0) { + ByteString byteString = ByteString.of(bytes); + webSocket.send(byteString); + audioView.post(() -> audioView.setWaveData(bytes)); + } + } + JSONObject obj = new JSONObject(); + obj.put("is_speaking", false); + webSocket.send(obj.toString()); + // webSocket.close(1000, "关闭WebSocket连接"); + } + + // 发送第一步的JSON数据 + public String getMessage(boolean isSpeaking) { + try { + JSONObject obj = new JSONObject(); + obj.put("mode", MODE); + JSONArray array = new JSONArray(); + String[] chunkList = CHUNK_SIZE.split(","); + for (String s : chunkList) { + array.put(Integer.valueOf(s.trim())); + } + obj.put("chunk_size", array); + obj.put("chunk_interval", CHUNK_INTERVAL); + obj.put("wav_name", "default"); + if (!hotWords.equals("")) { + JSONObject hotwordsJSON = new JSONObject(); + // 分割每一行字符串 + String[] hotWordsList = hotWords.split("\n"); + for (String s : hotWordsList) { + if (s.equals("")) { + Log.w(TAG, "hotWords为空"); + continue; + } + // 按照空格分割字符串 + String[] hotWordsArray = s.split(" "); + if (hotWordsArray.length != 2) { + Log.w(TAG, "hotWords格式不正确"); + continue; + } + hotwordsJSON.put(hotWordsArray[0], Integer.valueOf(hotWordsArray[1])); + } + obj.put("hotwords", hotwordsJSON.toString()); + } + obj.put("wav_format", "pcm"); + obj.put("is_speaking", isSpeaking); + return obj.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + return ""; + } + + // 检查权限 + private boolean hasPermission() { + return checkSelfPermission(Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED && + checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; + } + + // 请求权限 + private void requestPermission() { + requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO, + Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); + } +} \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/SSLSocketClient.java b/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/SSLSocketClient.java new file mode 100644 index 0000000..0bc190a --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/java/com/yeyupiaoling/androidclient/SSLSocketClient.java @@ -0,0 +1,71 @@ +package com.yeyupiaoling.androidclient; + +import java.security.SecureRandom; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +public class SSLSocketClient { + //获取SSLSocketFactory + public static SSLSocketFactory getSSLSocketFactory() { + try { + SSLContext sslContext = SSLContext.getInstance("SSL"); + sslContext.init(null, getTrustManager(), new SecureRandom()); + return sslContext.getSocketFactory(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + //获取X509TrustManager + public static X509TrustManager getX509TrustManager() { + X509TrustManager x509TrustManager = new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[0]; + } + }; + return x509TrustManager; + } + + //获取TrustManager + private static TrustManager[] getTrustManager() { + TrustManager[] trustAllCerts = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[]{}; + } + } + }; + return trustAllCerts; + } + + //获取HostnameVerifier + public static HostnameVerifier getHostnameVerifier() { + HostnameVerifier hostnameVerifier = (s, sslSession) -> true; + return hostnameVerifier; + } +} + diff --git a/runtime/android/AndroidClient/app/src/main/res/drawable/edittext_border.xml b/runtime/android/AndroidClient/app/src/main/res/drawable/edittext_border.xml new file mode 100644 index 0000000..a278e3c --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/res/drawable/edittext_border.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/src/main/res/drawable/ic_launcher_background.xml b/runtime/android/AndroidClient/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/runtime/android/AndroidClient/app/src/main/res/drawable/ic_launcher_foreground.xml b/runtime/android/AndroidClient/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/android/AndroidClient/app/src/main/res/drawable/logo.png b/runtime/android/AndroidClient/app/src/main/res/drawable/logo.png new file mode 100644 index 0000000..96b2bab Binary files /dev/null and b/runtime/android/AndroidClient/app/src/main/res/drawable/logo.png differ diff --git a/runtime/android/AndroidClient/app/src/main/res/layout/activity_main.xml b/runtime/android/AndroidClient/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..e9f6569 --- /dev/null +++ b/runtime/android/AndroidClient/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,35 @@ + + + +
+ + + + + + + + + + + + + + + + + diff --git a/runtime/html5/static/main.js b/runtime/html5/static/main.js new file mode 100644 index 0000000..63967e1 --- /dev/null +++ b/runtime/html5/static/main.js @@ -0,0 +1,576 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaoming,mali aihealthx.com */ + + +// 连接; 定义socket连接类对象与语音对象 +var wsconnecter = new WebSocketConnectMethod({msgHandle:getJsonMessage,stateHandle:getConnState}); +var audioBlob; + +// 录音; 定义录音对象,wav格式 +var rec = Recorder({ + type:"pcm", + bitRate:16, + sampleRate:16000, + onProcess:recProcess +}); + + + + +var sampleBuf=new Int16Array(); +// 定义按钮响应事件 +var btnStart = document.getElementById('btnStart'); +btnStart.onclick = record; +var btnStop = document.getElementById('btnStop'); +btnStop.onclick = stop; +btnStop.disabled = true; +btnStart.disabled = true; + +btnConnect= document.getElementById('btnConnect'); +btnConnect.onclick = start; + +var awsslink= document.getElementById('wsslink'); + + +var rec_text=""; // for online rec asr result +var offline_text=""; // for offline rec asr result +var info_div = document.getElementById('info_div'); + +var upfile = document.getElementById('upfile'); + + + +var isfilemode=false; // if it is in file mode +var file_ext=""; +var file_sample_rate=16000; //for wav file sample rate +var file_data_array; // array to save file data + +var totalsend=0; + + +var now_ipaddress=window.location.href; +now_ipaddress=now_ipaddress.replace("https://","wss://"); +now_ipaddress=now_ipaddress.replace("static/index.html",""); +var localport=window.location.port; +now_ipaddress=now_ipaddress.replace(localport,"10095"); +document.getElementById('wssip').value=now_ipaddress; +addresschange(); +function addresschange() +{ + + var Uri = document.getElementById('wssip').value; + document.getElementById('info_wslink').innerHTML="点此处手工授权(IOS手机)"; + Uri=Uri.replace(/wss/g,"https"); + console.log("addresschange uri=",Uri); + + awsslink.onclick=function(){ + window.open(Uri, '_blank'); + } + +} + +upfile.onclick=function() +{ + btnStart.disabled = true; + btnStop.disabled = true; + btnConnect.disabled=false; + +} + +// from https://github.com/xiangyuecn/Recorder/tree/master +var readWavInfo=function(bytes){ + //读取wav文件头,统一成44字节的头 + if(bytes.byteLength<44){ + return null; + }; + var wavView=bytes; + var eq=function(p,s){ + for(var i=0;i=chunk_size){ + + sendBuf=sampleBuf.slice(0,chunk_size); + totalsend=totalsend+sampleBuf.length; + sampleBuf=sampleBuf.slice(chunk_size,sampleBuf.length); + wsconnecter.wsSend(sendBuf); + + + } + + stop(); + + + +} + + +function on_recoder_mode_change() +{ + var item = null; + var obj = document.getElementsByName("recoder_mode"); + for (var i = 0; i < obj.length; i++) { //遍历Radio + if (obj[i].checked) { + item = obj[i].value; + break; + } + + + } + if(item=="mic") + { + document.getElementById("mic_mode_div").style.display = 'block'; + document.getElementById("rec_mode_div").style.display = 'none'; + + + btnStart.disabled = true; + btnStop.disabled = true; + btnConnect.disabled=false; + isfilemode=false; + } + else + { + document.getElementById("mic_mode_div").style.display = 'none'; + document.getElementById("rec_mode_div").style.display = 'block'; + + btnStart.disabled = true; + btnStop.disabled = true; + btnConnect.disabled=true; + isfilemode=true; + info_div.innerHTML='请点击选择文件'; + + + } +} + + +function getHotwords(){ + + var obj = document.getElementById("varHot"); + + if(typeof(obj) == 'undefined' || obj==null || obj.value.length<=0){ + return null; + } + let val = obj.value.toString(); + + console.log("hotwords="+val); + let items = val.split(/[(\r\n)\r\n]+/); //split by \r\n + var jsonresult = {}; + const regexNum = /^[0-9]*$/; // test number + for (item of items) { + + let result = item.split(" "); + if(result.length>=2 && regexNum.test(result[result.length-1])) + { + var wordstr=""; + for(var i=0;i0){ + wsconnecter.wsSend(sampleBuf); + console.log("sampleBuf.length"+sampleBuf.length); + sampleBuf=new Int16Array(); + } + wsconnecter.wsSend( JSON.stringify(request) ); + + + + + + + // 控件状态更新 + + isRec = false; + info_div.innerHTML="发送完数据,请等候,正在识别..."; + + if(isfilemode==false){ + btnStop.disabled = true; + btnStart.disabled = true; + btnConnect.disabled=true; + //wait 3s for asr result + setTimeout(function(){ + console.log("call stop ws!"); + wsconnecter.wsStop(); + btnConnect.disabled=false; + info_div.innerHTML="请点击连接";}, 3000 ); + + + + rec.stop(function(blob,duration){ + + console.log(blob); + var audioBlob = Recorder.pcm2wav(data = {sampleRate:16000, bitRate:16, blob:blob}, + function(theblob,duration){ + console.log(theblob); + var audio_record = document.getElementById('audio_record'); + audio_record.src = (window.URL||webkitURL).createObjectURL(theblob); + audio_record.controls=true; + //audio_record.play(); + + + } ,function(msg){ + console.log(msg); + } + ); + + + + },function(errMsg){ + console.log("errMsg: " + errMsg); + }); + } + // 停止连接 + + + +} + +function clear() { + + var varArea=document.getElementById('varArea'); + + varArea.value=""; + rec_text=""; + offline_text=""; + +} + + +function recProcess( buffer, powerLevel, bufferDuration, bufferSampleRate,newBufferIdx,asyncEnd ) { + if ( isRec === true ) { + var data_48k = buffer[buffer.length-1]; + + var array_48k = new Array(data_48k); + var data_16k=Recorder.SampleData(array_48k,bufferSampleRate,16000).data; + + sampleBuf = Int16Array.from([...sampleBuf, ...data_16k]); + var chunk_size=960; // for asr chunk_size [5, 10, 5] + info_div.innerHTML=""+bufferDuration/1000+"s"; + while(sampleBuf.length>=chunk_size){ + sendBuf=sampleBuf.slice(0,chunk_size); + sampleBuf=sampleBuf.slice(chunk_size,sampleBuf.length); + wsconnecter.wsSend(sendBuf); + + + + } + + + + } +} + +function getUseITN() { + var obj = document.getElementsByName("use_itn"); + for (var i = 0; i < obj.length; i++) { + if (obj[i].checked) { + return obj[i].value === "true"; + } + } + return false; +} diff --git a/runtime/html5/static/pcm.js b/runtime/html5/static/pcm.js new file mode 100644 index 0000000..51c1efe --- /dev/null +++ b/runtime/html5/static/pcm.js @@ -0,0 +1,96 @@ +/* +pcm编码器+编码引擎 +https://github.com/xiangyuecn/Recorder + +编码原理:本编码器输出的pcm格式数据其实就是Recorder中的buffers原始数据(经过了重新采样),16位时为LE小端模式(Little Endian),并未经过任何编码处理 + +编码的代码和wav.js区别不大,pcm加上一个44字节wav头即成wav文件;所以要播放pcm就很简单了,直接转成wav文件来播放,已提供转换函数 Recorder.pcm2wav +*/ +(function(){ +"use strict"; + +Recorder.prototype.enc_pcm={ + stable:true + ,testmsg:"pcm为未封装的原始音频数据,pcm数据文件无法直接播放;支持位数8位、16位(填在比特率里面),采样率取值无限制" +}; +Recorder.prototype.pcm=function(res,True,False){ + var This=this,set=This.set + ,size=res.length + ,bitRate=set.bitRate==8?8:16; + + var buffer=new ArrayBuffer(size*(bitRate/8)); + var data=new DataView(buffer); + var offset=0; + + // 写入采样数据 + if(bitRate==8) { + for(var i=0;i>8)+128; + data.setInt8(offset,val,true); + }; + }else{ + for (var i=0;i=pcmSampleRate时不会进行任何处理,小于时会进行重新采样 +prevChunkInfo:{} 可选,上次调用时的返回值,用于连续转换,本次调用将从上次结束位置开始进行处理。或可自行定义一个ChunkInfo从pcmDatas指定的位置开始进行转换 +option:{ 可选,配置项 + frameSize:123456 帧大小,每帧的PCM Int16的数量,采样率转换后的pcm长度为frameSize的整数倍,用于连续转换。目前仅在mp3格式时才有用,frameSize取值为1152,这样编码出来的mp3时长和pcm的时长完全一致,否则会因为mp3最后一帧录音不够填满时添加填充数据导致mp3的时长变长。 + frameType:"" 帧类型,一般为rec.set.type,提供此参数时无需提供frameSize,会自动使用最佳的值给frameSize赋值,目前仅支持mp3=1152(MPEG1 Layer3的每帧采采样数),其他类型=1。 + 以上两个参数用于连续转换时使用,最多使用一个,不提供时不进行帧的特殊处理,提供时必须同时提供prevChunkInfo才有作用。最后一段数据处理时无需提供帧大小以便输出最后一丁点残留数据。 + } + +返回ChunkInfo:{ + //可定义,从指定位置开始转换到结尾 + index:0 pcmDatas已处理到的索引 + offset:0.0 已处理到的index对应的pcm中的偏移的下一个位置 + + //仅作为返回值 + frameNext:null||[Int16,...] 下一帧的部分数据,frameSize设置了的时候才可能会有 + sampleRate:16000 结果的采样率,<=newSampleRate + data:[Int16,...] 转换后的PCM结果;如果是连续转换,并且pcmDatas中并没有新数据时,data的长度可能为0 +} +*/ +Recorder.SampleData=function(pcmDatas,pcmSampleRate,newSampleRate,prevChunkInfo,option){ + prevChunkInfo||(prevChunkInfo={}); + var index=prevChunkInfo.index||0; + var offset=prevChunkInfo.offset||0; + + var frameNext=prevChunkInfo.frameNext||[]; + option||(option={}); + var frameSize=option.frameSize||1; + if(option.frameType){ + frameSize=option.frameType=="mp3"?1152:1; + }; + + var nLen=pcmDatas.length; + if(index>nLen+1){ + CLog("SampleData似乎传入了未重置chunk "+index+">"+nLen,3); + }; + var size=0; + for(var i=index;i1){//新采样低于录音采样,进行抽样 + size=Math.floor(size/step); + }else{//新采样高于录音采样不处理,省去了插值处理 + step=1; + newSampleRate=pcmSampleRate; + }; + + size+=frameNext.length; + var res=new Int16Array(size); + var idx=0; + //添加上一次不够一帧的剩余数据 + for(var i=0;i0){ + var u8Pos=(res.length-frameNextSize)*2; + frameNext=new Int16Array(res.buffer.slice(u8Pos)); + res=new Int16Array(res.buffer.slice(0,u8Pos)); + }; + + return { + index:index + ,offset:offset + + ,frameNext:frameNext + ,sampleRate:newSampleRate + ,data:res + }; +}; + + +/*计算音量百分比的一个方法 +pcmAbsSum: pcm Int16所有采样的绝对值的和 +pcmLength: pcm长度 +返回值:0-100,主要当做百分比用 +注意:这个不是分贝,因此没用volume当做名称*/ +Recorder.PowerLevel=function(pcmAbsSum,pcmLength){ + /*计算音量 https://blog.csdn.net/jody1989/article/details/73480259 + 更高灵敏度算法: + 限定最大感应值10000 + 线性曲线:低音量不友好 + power/10000*100 + 对数曲线:低音量友好,但需限定最低感应值 + (1+Math.log10(power/10000))*100 + */ + var power=(pcmAbsSum/pcmLength) || 0;//NaN + var level; + if(power<1251){//1250的结果10%,更小的音量采用线性取值 + level=Math.round(power/1250*10); + }else{ + level=Math.round(Math.min(100,Math.max(0,(1+Math.log(power/10000)/Math.log(10))*100))); + }; + return level; +}; + +/*计算音量,单位dBFS(满刻度相对电平) +maxSample: 为16位pcm采样的绝对值中最大的一个(计算峰值音量),或者为pcm中所有采样的绝对值的平局值 +返回值:-100~0 (最大值0dB,最小值-100代替-∞) +*/ +Recorder.PowerDBFS=function(maxSample){ + var val=Math.max(0.1, maxSample||0),Pref=0x7FFF; + val=Math.min(val,Pref); + //https://www.logiclocmusic.com/can-you-tell-the-decibel/ + //https://blog.csdn.net/qq_17256689/article/details/120442510 + val=20*Math.log(val/Pref)/Math.log(10); + return Math.max(-100,Math.round(val)); +}; + + + + +//带时间的日志输出,可设为一个空函数来屏蔽日志输出 +//CLog(msg,errOrLogMsg, logMsg...) err为数字时代表日志类型1:error 2:log默认 3:warn,否则当做内容输出,第一个参数不能是对象因为要拼接时间,后面可以接无数个输出参数 +Recorder.CLog=function(msg,err){ + var now=new Date(); + var t=("0"+now.getMinutes()).substr(-2) + +":"+("0"+now.getSeconds()).substr(-2) + +"."+("00"+now.getMilliseconds()).substr(-3); + var recID=this&&this.envIn&&this.envCheck&&this.id; + var arr=["["+t+" "+RecTxt+(recID?":"+recID:"")+"]"+msg]; + var a=arguments,console=window.console||{}; + var i=2,fn=console.log; + if(typeof(err)=="number"){ + fn=err==1?console.error:err==3?console.warn:fn; + }else{ + i=1; + }; + for(;i1?arr:""); + }else{ + fn.apply(console,arr); + }; +}; +var CLog=function(){ Recorder.CLog.apply(this,arguments); }; +var IsLoser=true;try{IsLoser=!console.log.apply;}catch(e){}; + + + + +var ID=0; +function initFn(set){ + this.id=++ID; + + //如果开启了流量统计,这里将发送一个图片请求 + Traffic(); + + + var o={ + type:"mp3" //输出类型:mp3,wav,wav输出文件尺寸超大不推荐使用,但mp3编码支持会导致js文件超大,如果不需支持mp3可以使js文件大幅减小 + ,bitRate:16 //比特率 wav:16或8位,MP3:8kbps 1k/s,8kbps 2k/s 录音文件很小 + + ,sampleRate:16000 //采样率,wav格式大小=sampleRate*时间;mp3此项对低比特率有影响,高比特率几乎无影响。 + //wav任意值,mp3取值范围:48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000 + //采样率参考https://www.cnblogs.com/devin87/p/mp3-recorder.html + + ,onProcess:NOOP //fn(buffers,powerLevel,bufferDuration,bufferSampleRate,newBufferIdx,asyncEnd) buffers=[[Int16,...],...]:缓冲的PCM数据,为从开始录音到现在的所有pcm片段;powerLevel:当前缓冲的音量级别0-100,bufferDuration:已缓冲时长,bufferSampleRate:缓冲使用的采样率(当type支持边录边转码(Worker)时,此采样率和设置的采样率相同,否则不一定相同);newBufferIdx:本次回调新增的buffer起始索引;asyncEnd:fn() 如果onProcess是异步的(返回值为true时),处理完成时需要调用此回调,如果不是异步的请忽略此参数,此方法回调时必须是真异步(不能真异步时需用setTimeout包裹)。onProcess返回值:如果返回true代表开启异步模式,在某些大量运算的场合异步是必须的,必须在异步处理完成时调用asyncEnd(不能真异步时需用setTimeout包裹),在onProcess执行后新增的buffer会全部替换成空数组,因此本回调开头应立即将newBufferIdx到本次回调结尾位置的buffer全部保存到另外一个数组内,处理完成后写回buffers中本次回调的结尾位置。 + + //*******高级设置****** + //,sourceStream:MediaStream Object + //可选直接提供一个媒体流,从这个流中录制、实时处理音频数据(当前Recorder实例独享此流);不提供时为普通的麦克风录音,由getUserMedia提供音频流(所有Recorder实例共享同一个流) + //比如:audio、video标签dom节点的captureStream方法(实验特性,不同浏览器支持程度不高)返回的流;WebRTC中的remote流;自己创建的流等 + //注意:流内必须至少存在一条音轨(Audio Track),比如audio标签必须等待到可以开始播放后才会有音轨,否则open会失败 + + //,audioTrackSet:{ deviceId:"",groupId:"", autoGainControl:true, echoCancellation:true, noiseSuppression:true } + //普通麦克风录音时getUserMedia方法的audio配置参数,比如指定设备id,回声消除、降噪开关;注意:提供的任何配置值都不一定会生效 + //由于麦克风是全局共享的,所以新配置后需要close掉以前的再重新open + //更多参考: https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints + + //,disableEnvInFix:false 内部参数,禁用设备卡顿时音频输入丢失补偿功能 + + //,takeoffEncodeChunk:NOOP //fn(chunkBytes) chunkBytes=[Uint8,...]:实时编码环境下接管编码器输出,当编码器实时编码出一块有效的二进制音频数据时实时回调此方法;参数为二进制的Uint8Array,就是编码出来的音频数据片段,所有的chunkBytes拼接在一起即为完整音频。本实现的想法最初由QQ2543775048提出 + //当提供此回调方法时,将接管编码器的数据输出,编码器内部将放弃存储生成的音频数据;环境要求比较苛刻:如果当前环境不支持实时编码处理,将在open时直接走fail逻辑 + //因此提供此回调后调用stop方法将无法获得有效的音频数据,因为编码器内没有音频数据,因此stop时返回的blob将是一个字节长度为0的blob + //目前只有mp3格式实现了实时编码,在支持实时处理的环境中将会实时的将编码出来的mp3片段通过此方法回调,所有的chunkBytes拼接到一起即为完整的mp3,此种拼接的结果比mock方法实时生成的音质更加,因为天然避免了首尾的静默 + //目前除mp3外其他格式不可以提供此回调,提供了将在open时直接走fail逻辑 + }; + + for(var k in set){ + o[k]=set[k]; + }; + this.set=o; + + this._S=9;//stop同步锁,stop可以阻止open过程中还未运行的start + this.Sync={O:9,C:9};//和Recorder.Sync一致,只不过这个是非全局的,仅用来简化代码逻辑,无实际作用 +}; +//同步锁,控制对Stream的竞争;用于close时中断异步的open;一个对象open如果变化了都要阻止close,Stream的控制权交个新的对象 +Recorder.Sync={/*open*/O:9,/*close*/C:9}; + +Recorder.prototype=initFn.prototype={ + CLog:CLog + + //流相关的数据存储在哪个对象里面;如果提供了sourceStream,数据直接存储在当前对象中,否则存储在全局 + ,_streamStore:function(){ + if(this.set.sourceStream){ + return this; + }else{ + return Recorder; + } + } + + //打开录音资源True(),False(msg,isUserNotAllow),需要调用close。注意:此方法是异步的;一般使用时打开,用完立即关闭;可重复调用,可用来测试是否能录音 + ,open:function(True,False){ + var This=this,streamStore=This._streamStore(); + True=True||NOOP; + var failCall=function(errMsg,isUserNotAllow){ + isUserNotAllow=!!isUserNotAllow; + This.CLog("录音open失败:"+errMsg+",isUserNotAllow:"+isUserNotAllow,1); + False&&False(errMsg,isUserNotAllow); + }; + + var ok=function(){ + This.CLog("open ok id:"+This.id); + True(); + + This._SO=0;//解除stop对open中的start调用的阻止 + }; + + + //同步锁 + var Lock=streamStore.Sync; + var lockOpen=++Lock.O,lockClose=Lock.C; + This._O=This._O_=lockOpen;//记住当前的open,如果变化了要阻止close,这里假定了新对象已取代当前对象并且不再使用 + This._SO=This._S;//记住open过程中的stop,中途任何stop调用后都不能继续open中的start + var lockFail=function(){ + //允许多次open,但不允许任何一次close,或者自身已经调用了关闭 + if(lockClose!=Lock.C || !This._O){ + var err="open被取消"; + if(lockOpen==Lock.O){ + //无新的open,已经调用了close进行取消,此处应让上次的close明确生效 + This.close(); + }else{ + err="open被中断"; + }; + failCall(err); + return true; + }; + }; + + //环境配置检查 + var checkMsg=This.envCheck({envName:"H5",canProcess:true}); + if(checkMsg){ + failCall("不能录音:"+checkMsg); + return; + }; + + + //***********已直接提供了音频流************ + if(This.set.sourceStream){ + if(!Recorder.GetContext()){ + failCall("不支持此浏览器从流中获取录音"); + return; + }; + + Disconnect(streamStore);//可能已open过,直接先尝试断开 + This.Stream=This.set.sourceStream; + This.Stream._call={}; + + try{ + Connect(streamStore); + }catch(e){ + failCall("从流中打开录音失败:"+e.message); + return; + } + ok(); + return; + }; + + + //***********打开麦克风得到全局的音频流************ + var codeFail=function(code,msg){ + try{//跨域的优先检测一下 + window.top.a; + }catch(e){ + failCall('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")'); + return; + }; + + if(/Permission|Allow/i.test(code)){ + failCall("用户拒绝了录音权限",true); + }else if(window.isSecureContext===false){ + failCall("浏览器禁止不安全页面录音,可开启https解决"); + }else if(/Found/i.test(code)){//可能是非安全环境导致的没有设备 + failCall(msg+",无可用麦克风"); + }else{ + failCall(msg); + }; + }; + + + //如果已打开并且有效就不要再打开了 + if(Recorder.IsOpen()){ + ok(); + return; + }; + if(!Recorder.Support()){ + codeFail("","此浏览器不支持录音"); + return; + }; + + //请求权限,如果从未授权,一般浏览器会弹出权限请求弹框 + var f1=function(stream){ + //https://github.com/xiangyuecn/Recorder/issues/14 获取到的track.readyState!="live",刚刚回调时可能是正常的,但过一下可能就被关掉了,原因不明。延迟一下保证真异步。对正常浏览器不影响 + setTimeout(function(){ + stream._call={}; + var oldStream=Recorder.Stream; + if(oldStream){ + Disconnect(); //直接断开已存在的,旧的Connect未完成会自动终止 + stream._call=oldStream._call; + }; + Recorder.Stream=stream; + if(lockFail())return; + + if(Recorder.IsOpen()){ + if(oldStream)This.CLog("发现同时多次调用open",1); + + Connect(streamStore,1); + ok(); + }else{ + failCall("录音功能无效:无音频流"); + }; + },100); + }; + var f2=function(e){ + var code=e.name||e.message||e.code+":"+e; + This.CLog("请求录音权限错误",1,e); + + codeFail(code,"无法录音:"+code); + }; + + var trackSet={ + noiseSuppression:false //默认禁用降噪,原声录制,免得移动端表现怪异(包括系统播放声音变小) + ,echoCancellation:false //回声消除 + }; + var trackSet2=This.set.audioTrackSet; + for(var k in trackSet2)trackSet[k]=trackSet2[k]; + trackSet.sampleRate=Recorder.Ctx.sampleRate;//必须指明采样率,不然手机上MediaRecorder采样率16k + + try{ + var pro=Recorder.Scope[getUserMediaTxt]({audio:trackSet},f1,f2); + }catch(e){//不能设置trackSet就算了 + This.CLog(getUserMediaTxt,3,e); + pro=Recorder.Scope[getUserMediaTxt]({audio:true},f1,f2); + }; + if(pro&&pro.then){ + pro.then(f1)[CatchTxt](f2); //fix 关键字,保证catch压缩时保持字符串形式 + }; + } + //关闭释放录音资源 + ,close:function(call){ + call=call||NOOP; + + var This=this,streamStore=This._streamStore(); + This._stop(); + + var Lock=streamStore.Sync; + This._O=0; + if(This._O_!=Lock.O){ + //唯一资源Stream的控制权已交给新对象,这里不能关闭。此处在每次都弹权限的浏览器内可能存在泄漏,新对象被拒绝权限可能不会调用close,忽略这种不处理 + This.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3); + call(); + return; + }; + Lock.C++;//获得控制权 + + Disconnect(streamStore); + + This.CLog("close"); + call(); + } + + + + + + /*模拟一段录音数据,后面可以调用stop进行编码,需提供pcm数据[1,2,3...],pcm的采样率*/ + ,mock:function(pcmData,pcmSampleRate){ + var This=this; + This._stop();//清理掉已有的资源 + + This.isMock=1; + This.mockEnvInfo=null; + This.buffers=[pcmData]; + This.recSize=pcmData.length; + This[srcSampleRateTxt]=pcmSampleRate; + return This; + } + ,envCheck:function(envInfo){//平台环境下的可用性检查,任何时候都可以调用检查,返回errMsg:""正常,"失败原因" + //envInfo={envName:"H5",canProcess:true} + var errMsg,This=this,set=This.set; + + //检测CPU的数字字节序,TypedArray字节序是个迷,直接拒绝罕见的大端模式,因为找不到这种CPU进行测试 + var tag="CPU_BE"; + if(!errMsg && !Recorder[tag] && window.Int8Array && !new Int8Array(new Int32Array([1]).buffer)[0]){ + Traffic(tag); //如果开启了流量统计,这里将发送一个图片请求 + errMsg="不支持"+tag+"架构"; + }; + + //编码器检查环境下配置是否可用 + if(!errMsg){ + var type=set.type; + if(This[type+"_envCheck"]){//编码器已实现环境检查 + errMsg=This[type+"_envCheck"](envInfo,set); + }else{//未实现检查的手动检查配置是否有效 + if(set.takeoffEncodeChunk){ + errMsg=type+"类型"+(This[type]?"":"(未加载编码器)")+"不支持设置takeoffEncodeChunk"; + }; + }; + }; + + return errMsg||""; + } + ,envStart:function(mockEnvInfo,sampleRate){//平台环境相关的start调用 + var This=this,set=This.set; + This.isMock=mockEnvInfo?1:0;//非H5环境需要启用mock,并提供envCheck需要的环境信息 + This.mockEnvInfo=mockEnvInfo; + This.buffers=[];//数据缓冲 + This.recSize=0;//数据大小 + + This.envInLast=0;//envIn接收到最后录音内容的时间 + This.envInFirst=0;//envIn接收到的首个录音内容的录制时间 + This.envInFix=0;//补偿的总时间 + This.envInFixTs=[];//补偿计数列表 + + //engineCtx需要提前确定最终的采样率 + var setSr=set[sampleRateTxt]; + if(setSr>sampleRate){ + set[sampleRateTxt]=sampleRate; + }else{ setSr=0 } + This[srcSampleRateTxt]=sampleRate; + This.CLog(srcSampleRateTxt+": "+sampleRate+" set."+sampleRateTxt+": "+set[sampleRateTxt]+(setSr?" 忽略"+setSr:""), setSr?3:0); + + This.engineCtx=0; + //此类型有边录边转码(Worker)支持 + if(This[set.type+"_start"]){ + var engineCtx=This.engineCtx=This[set.type+"_start"](set); + if(engineCtx){ + engineCtx.pcmDatas=[]; + engineCtx.pcmSize=0; + }; + }; + } + ,envResume:function(){//和平台环境无关的恢复录音 + //重新开始计数 + this.envInFixTs=[]; + } + ,envIn:function(pcm,sum){//和平台环境无关的pcm[Int16]输入 + var This=this,set=This.set,engineCtx=This.engineCtx; + var bufferSampleRate=This[srcSampleRateTxt]; + var size=pcm.length; + var powerLevel=Recorder.PowerLevel(sum,size); + + var buffers=This.buffers; + var bufferFirstIdx=buffers.length;//之前的buffer都是经过onProcess处理好的,不允许再修改 + buffers.push(pcm); + + //有engineCtx时会被覆盖,这里保存一份 + var buffersThis=buffers; + var bufferFirstIdxThis=bufferFirstIdx; + + //卡顿丢失补偿:因为设备很卡的时候导致H5接收到的数据量不够造成播放时候变速,结果比实际的时长要短,此处保证了不会变短,但不能修复丢失的音频数据造成音质变差。当前算法采用输入时间侦测下一帧是否需要添加补偿帧,需要(6次输入||超过1秒)以上才会开始侦测,如果滑动窗口内丢失超过1/3就会进行补偿 + var now=Date.now(); + var pcmTime=Math.round(size/bufferSampleRate*1000); + This.envInLast=now; + if(This.buffers.length==1){//记下首个录音数据的录制时间 + This.envInFirst=now-pcmTime; + }; + var envInFixTs=This.envInFixTs; + envInFixTs.splice(0,0,{t:now,d:pcmTime}); + //保留3秒的计数滑动窗口,另外超过3秒的停顿不补偿 + var tsInStart=now,tsPcm=0; + for(var i=0;i3000){ + envInFixTs.length=i; + break; + }; + tsInStart=o.t; + tsPcm+=o.d; + }; + //达到需要的数据量,开始侦测是否需要补偿 + var tsInPrev=envInFixTs[1]; + var tsIn=now-tsInStart; + var lost=tsIn-tsPcm; + if( lost>tsIn/3 && (tsInPrev&&tsIn>1000 || envInFixTs.length>=6) ){ + //丢失过多,开始执行补偿 + var addTime=now-tsInPrev.t-pcmTime;//距离上次输入丢失这么多ms + if(addTime>pcmTime/5){//丢失超过本帧的1/5 + var fixOpen=!set.disableEnvInFix; + This.CLog("["+now+"]"+(fixOpen?"":"未")+"补偿"+addTime+"ms",3); + This.envInFix+=addTime; + + //用静默进行补偿 + if(fixOpen){ + var addPcm=new Int16Array(addTime*bufferSampleRate/1000); + size+=addPcm.length; + buffers.push(addPcm); + }; + }; + }; + + + var sizeOld=This.recSize,addSize=size; + var bufferSize=sizeOld+addSize; + This.recSize=bufferSize;//此值在onProcess后需要修正,可能新数据被修改 + + + //此类型有边录边转码(Worker)支持,开启实时转码 + if(engineCtx){ + //转换成set的采样率 + var chunkInfo=Recorder.SampleData(buffers,bufferSampleRate,set[sampleRateTxt],engineCtx.chunkInfo); + engineCtx.chunkInfo=chunkInfo; + + sizeOld=engineCtx.pcmSize; + addSize=chunkInfo.data.length; + bufferSize=sizeOld+addSize; + engineCtx.pcmSize=bufferSize;//此值在onProcess后需要修正,可能新数据被修改 + + buffers=engineCtx.pcmDatas; + bufferFirstIdx=buffers.length; + buffers.push(chunkInfo.data); + bufferSampleRate=chunkInfo[sampleRateTxt]; + }; + + var duration=Math.round(bufferSize/bufferSampleRate*1000); + var bufferNextIdx=buffers.length; + var bufferNextIdxThis=buffersThis.length; + + //允许异步处理buffer数据 + var asyncEnd=function(){ + //重新计算size,异步的早已减去添加的,同步的需去掉本次添加的然后重新计算 + var num=asyncBegin?0:-addSize; + var hasClear=buffers[0]==null; + for(var i=bufferFirstIdx;i10 && This.envInFirst-now>1000){ //1秒后开始onProcess性能监测 + This.CLog(procTxt+"低性能,耗时"+slowT+"ms",3); + }; + + if(asyncBegin===true){ + //开启了异步模式,onProcess已接管buffers新数据,立即清空,避免出现未处理的数据 + var hasClear=0; + for(var i=bufferFirstIdx;i"+res.length+" 花:"+(Date.now()-t1)+"ms"); + + setTimeout(function(){ + t1=Date.now(); + This[set.type](res,function(blob){ + ok(blob,duration); + },function(msg){ + err(msg); + }); + }); + } + +}; + +if(window[RecTxt]){ + CLog("重复引入"+RecTxt,3); + window[RecTxt].Destroy(); +}; +window[RecTxt]=Recorder; + + + + +//=======从WebM字节流中提取pcm数据,提取成功返回Float32Array,失败返回null||-1===== +var WebM_Extract=function(inBytes, scope){ + if(!scope.pos){ + scope.pos=[0]; scope.tracks={}; scope.bytes=[]; + }; + var tracks=scope.tracks, position=[scope.pos[0]]; + var endPos=function(){ scope.pos[0]=position[0] }; + + var sBL=scope.bytes.length; + var bytes=new Uint8Array(sBL+inBytes.length); + bytes.set(scope.bytes); bytes.set(inBytes,sBL); + scope.bytes=bytes; + + //先读取文件头和Track信息 + if(!scope._ht){ + readMatroskaVInt(bytes, position);//EBML Header + readMatroskaBlock(bytes, position);//跳过EBML Header内容 + if(!BytesEq(readMatroskaVInt(bytes, position), [0x18,0x53,0x80,0x67])){ + return;//未识别到Segment + } + readMatroskaVInt(bytes, position);//跳过Segment长度值 + while(position[0]1){//多声道,提取一个声道 + var arr2=[]; + for(var i=0;i=arr.length)return; + var b0=arr[i],b2=("0000000"+b0.toString(2)).substr(-8); + var m=/^(0*1)(\d*)$/.exec(b2); + if(!m)return; + var len=m[1].length, val=[]; + if(i+len>arr.length)return; + for(var i2=0;i2arr.length)return; + for(var i2=0;i2>8)+128; + data.setInt8(offset,val,true); + }; + }else{ + for (var i=0;i /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1A7F0C8F2A2F1F0000A6EEB7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A6C93052A84D64E007E36DC /* paraformer.cpp in Sources */, + 1A6C94022A84D66E007E36DC /* demangle.cc in Sources */, + 1A6C94122A84D66E007E36DC /* scanscalar.cpp in Sources */, + 1A6C941D2A84D66E007E36DC /* tag.cpp in Sources */, + 1A6C94252A84D66E007E36DC /* emitterstate.cpp in Sources */, + 1A6C93152A84D64E007E36DC /* funasrruntime.cpp in Sources */, + 1A6C93122A84D64E007E36DC /* fsmn-vad-online.cpp in Sources */, + 1A6C940D2A84D66E007E36DC /* simplekey.cpp in Sources */, + 1A6C94182A84D66E007E36DC /* nodeevents.cpp in Sources */, + 1A7F0C9E2A2F1F0000A6EEB7 /* ViewController.mm in Sources */, + 1A7F0C982A2F1F0000A6EEB7 /* AppDelegate.m in Sources */, + 1A7F0DBE2A2F221C00A6EEB7 /* AudioCapture.mm in Sources */, + 1A6C94162A84D66E007E36DC /* singledocparser.cpp in Sources */, + 1A6C940C2A84D66E007E36DC /* emitfromevents.cpp in Sources */, + 1A6C930D2A84D64E007E36DC /* audio.cpp in Sources */, + 1A6C93DD2A84D66E007E36DC /* mel-computations.cc in Sources */, + 1A6C94242A84D66E007E36DC /* node_data.cpp in Sources */, + 1A7F0CA92A2F1F0200A6EEB7 /* main.m in Sources */, + 1A6C930C2A84D64E007E36DC /* resample.cpp in Sources */, + 1A6C94002A84D66E007E36DC /* signalhandler.cc in Sources */, + 1A6C94262A84D66E007E36DC /* parser.cpp in Sources */, + 1A6C93142A84D64E007E36DC /* model.cpp in Sources */, + 1A6C941E2A84D66E007E36DC /* emitterutils.cpp in Sources */, + 1A6C94112A84D66E007E36DC /* regex_yaml.cpp in Sources */, + 1A6C93112A84D64E007E36DC /* tpass-stream.cpp in Sources */, + 1A6C93172A84D64E007E36DC /* punc-model.cpp in Sources */, + 1A6C93DA2A84D66E007E36DC /* rfft.cc in Sources */, + 1A7F0C9B2A2F1F0000A6EEB7 /* SceneDelegate.m in Sources */, + 1A6C940A2A84D66E007E36DC /* memory.cpp in Sources */, + 1A6C93D52A84D66E007E36DC /* online-feature.cc in Sources */, + 1A6C93132A84D64E007E36DC /* ct-transformer.cpp in Sources */, + 1A6C930B2A84D64E007E36DC /* alignedmem.cpp in Sources */, + 1A7F0DBF2A2F221C00A6EEB7 /* AudioRecorder.m in Sources */, + 1A6C930E2A84D64E007E36DC /* tokenizer.cpp in Sources */, + 1A6C93DC2A84D66E007E36DC /* feature-window.cc in Sources */, + 1A6C940E2A84D66E007E36DC /* parse.cpp in Sources */, + 1A6C93F82A84D66E007E36DC /* vlog_is_on.cc in Sources */, + 1A6C93F62A84D66E007E36DC /* utilities.cc in Sources */, + 1A6C94192A84D66E007E36DC /* graphbuilderadapter.cpp in Sources */, + 1A6C94232A84D66E007E36DC /* directives.cpp in Sources */, + 1A6C94202A84D66E007E36DC /* scantag.cpp in Sources */, + 1A6C93182A84D64E007E36DC /* vad-model.cpp in Sources */, + 1A6C93092A84D64E007E36DC /* fsmn-vad.cpp in Sources */, + 1A6C93E02A84D66E007E36DC /* feature-functions.cc in Sources */, + 1A6C93F72A84D66E007E36DC /* symbolize.cc in Sources */, + 1A6C93062A84D64E007E36DC /* util.cpp in Sources */, + 1A6C94222A84D66E007E36DC /* nodebuilder.cpp in Sources */, + 1ACBFB692AB99D55002FC7C7 /* seg_dict.cpp in Sources */, + 1A6C94132A84D66E007E36DC /* exp.cpp in Sources */, + 1A6C930A2A84D64E007E36DC /* vocab.cpp in Sources */, + 1A6C94012A84D66E007E36DC /* logging.cc in Sources */, + 1A6C941F2A84D66E007E36DC /* stream.cpp in Sources */, + 1A6C94102A84D66E007E36DC /* convert.cpp in Sources */, + 1A6C94032A84D66E007E36DC /* fuzz_demangle.cc in Sources */, + 1A6C94172A84D66E007E36DC /* binary.cpp in Sources */, + 1A6C93102A84D64E007E36DC /* offline-stream.cpp in Sources */, + 1A6C94212A84D66E007E36DC /* scantoken.cpp in Sources */, + 1A6C930F2A84D64E007E36DC /* tpass-online-stream.cpp in Sources */, + 1A6C941C2A84D66E007E36DC /* emit.cpp in Sources */, + 1A6C940F2A84D66E007E36DC /* emitter.cpp in Sources */, + 1A6C93DE2A84D66E007E36DC /* fftsg.c in Sources */, + 1A6C940B2A84D66E007E36DC /* ostream_wrapper.cpp in Sources */, + 1ACBFB6C2AB9A086002FC7C7 /* encode_converter.cpp in Sources */, + 1A6C93E12A84D66E007E36DC /* log.cc in Sources */, + 1A6C94092A84D66E007E36DC /* exceptions.cpp in Sources */, + 1A6C94152A84D66E007E36DC /* node.cpp in Sources */, + 1A6C94142A84D66E007E36DC /* null.cpp in Sources */, + 1A6C941A2A84D66E007E36DC /* graphbuilder.cpp in Sources */, + 1A6C941B2A84D66E007E36DC /* scanner.cpp in Sources */, + 1A6C93162A84D64E007E36DC /* paraformer-online.cpp in Sources */, + 1A6C93072A84D64E007E36DC /* ct-transformer-online.cpp in Sources */, + 1A6C93D42A84D66E007E36DC /* feature-fbank.cc in Sources */, + 1A6C93FD2A84D66E007E36DC /* raw_logging.cc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 1A7F0C9F2A2F1F0000A6EEB7 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 1A7F0CA02A2F1F0000A6EEB7 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 1A7F0CA42A2F1F0200A6EEB7 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 1A7F0CA52A2F1F0200A6EEB7 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1A7F0CAA2A2F1F0200A6EEB7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 1A7F0CAB2A2F1F0200A6EEB7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 1A7F0CAD2A2F1F0200A6EEB7 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B9ED2A36675364C815C03C96 /* Pods-paraformer_online.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 834ZC97578; + GCC_PREPROCESSOR_DEFINITIONS = HAVE_CLAPACK; + GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + "$(PROJECT_DIR)/../../onnxruntime/third_party/yaml-cpp/include", + "$(PROJECT_DIR)/../../onnxruntime/third_party/kaldi-native-fbank", + "$(PROJECT_DIR)/../../onnxruntime/third_party/glog/src", + "$(PROJECT_DIR)/paraformer_online/include", + "$(PROJECT_DIR)/../../onnxruntime/third_party/", + "$(PROJECT_DIR)/paraformer_online/", + ); + INFOPLIST_FILE = paraformer_online/Info.plist; + INFOPLIST_KEY_NSMicrophoneUsageDescription = "我要使用麦克风"; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.qiuwei.paraformer-online1"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1A7F0CAE2A2F1F0200A6EEB7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 00FB7DEC958626AACE224936 /* Pods-paraformer_online.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 834ZC97578; + GCC_PREPROCESSOR_DEFINITIONS = HAVE_CLAPACK; + GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + "$(PROJECT_DIR)/../../onnxruntime/third_party/yaml-cpp/include", + "$(PROJECT_DIR)/../../onnxruntime/third_party/kaldi-native-fbank", + "$(PROJECT_DIR)/../../onnxruntime/third_party/glog/src", + "$(PROJECT_DIR)/paraformer_online/include", + "$(PROJECT_DIR)/../../onnxruntime/third_party/", + "$(PROJECT_DIR)/paraformer_online/", + ); + INFOPLIST_FILE = paraformer_online/Info.plist; + INFOPLIST_KEY_NSMicrophoneUsageDescription = "我要使用麦克风"; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.qiuwei.paraformer-online1"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1A7F0C8E2A2F1F0000A6EEB7 /* Build configuration list for PBXProject "paraformer_online" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A7F0CAA2A2F1F0200A6EEB7 /* Debug */, + 1A7F0CAB2A2F1F0200A6EEB7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1A7F0CAC2A2F1F0200A6EEB7 /* Build configuration list for PBXNativeTarget "paraformer_online" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A7F0CAD2A2F1F0200A6EEB7 /* Debug */, + 1A7F0CAE2A2F1F0200A6EEB7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1A7F0C8B2A2F1F0000A6EEB7 /* Project object */; +} diff --git a/runtime/ios/paraformer_online/paraformer_online.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/runtime/ios/paraformer_online/paraformer_online.xcodeproj/project.xcworkspace/xcuserdata/qiuwei.xcuserdatad/UserInterfaceState.xcuserstate b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/project.xcworkspace/xcuserdata/qiuwei.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..0eb7aef Binary files /dev/null and b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/project.xcworkspace/xcuserdata/qiuwei.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/runtime/ios/paraformer_online/paraformer_online.xcodeproj/xcuserdata/qiuwei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/xcuserdata/qiuwei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..f7c7588 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/xcuserdata/qiuwei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/runtime/ios/paraformer_online/paraformer_online.xcodeproj/xcuserdata/qiuwei.xcuserdatad/xcschemes/xcschememanagement.plist b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/xcuserdata/qiuwei.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..81a245a --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online.xcodeproj/xcuserdata/qiuwei.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + paraformer_online.xcscheme_^#shared#^_ + + orderHint + 2 + + + + diff --git a/runtime/ios/paraformer_online/paraformer_online/AppDelegate.h b/runtime/ios/paraformer_online/paraformer_online/AppDelegate.h new file mode 100644 index 0000000..0bba555 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/AppDelegate.h @@ -0,0 +1,19 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// AppDelegate.h +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import + +@interface AppDelegate : UIResponder + + +@end + diff --git a/runtime/ios/paraformer_online/paraformer_online/AppDelegate.m b/runtime/ios/paraformer_online/paraformer_online/AppDelegate.m new file mode 100644 index 0000000..de29bb1 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/AppDelegate.m @@ -0,0 +1,45 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// AppDelegate.m +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +#pragma mark - UISceneSession lifecycle + + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; +} + + +- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. +} + + +@end diff --git a/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/AccentColor.colorset/Contents.json b/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/AppIcon.appiconset/Contents.json b/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/Contents.json b/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/runtime/ios/paraformer_online/paraformer_online/AudioCapture.h b/runtime/ios/paraformer_online/paraformer_online/AudioCapture.h new file mode 100644 index 0000000..6c4d7c1 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/AudioCapture.h @@ -0,0 +1,30 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// AudioCapture.h +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^SpeechRecognitionBlock)(NSString *result); + +@interface AudioCapture : NSObject + +@property (nonatomic,copy) SpeechRecognitionBlock resultBlock; + +- (id)initWithOnnxModel:(BOOL)onnxModel; + +- (void)startRecorder; +- (void)stopRecorder; + +@end + +NS_ASSUME_NONNULL_END diff --git a/runtime/ios/paraformer_online/paraformer_online/AudioCapture.mm b/runtime/ios/paraformer_online/paraformer_online/AudioCapture.mm new file mode 100644 index 0000000..1917b6b --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/AudioCapture.mm @@ -0,0 +1,279 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// AudioCapture.m +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import "AudioCapture.h" +#import +#include + +#import "AudioRecorder.h" + +#include "precomp.h" + +#define Recorder_Sample_Rate 16000 +#define Samples_Per_Frame (Recorder_Sample_Rate/100) + +#define k_input_frames 10 +#define k_left_padding_frames 5 +#define k_right_padding_frames 5 +#define k_input_samples 960 // (60ms) + + +static AudioCapture *selfClass = nil; + +@interface AudioCapture () + +@property (nonatomic, strong) AVCaptureSession *capture; + +@property (nonatomic, copy) NSMutableData *sampleData; + +@property (nonatomic, strong) AudioRecorder *audioRecorder; + +@property (nonatomic, assign) BOOL isRecording; + +@property (nonatomic, strong) NSLock *lock; + +@end + +using namespace funasr; + +@implementation AudioCapture +{ + const char* output_path; + void* denoiser; + void* resampler; + +// Paraformer_stream *stream_; + + FUNASR_HANDLE asr_handle_; + FUNASR_HANDLE online_handle_; + + bool is_onnx; + + char *speech_buff; +} +int packetIndex = 0; + +- (id)initWithOnnxModel:(BOOL)onnxModel +{ + self = [super init]; + if (self) { + is_onnx = onnxModel ? true : false; + + if (is_onnx) { + [self initASROnnx]; + } else { +// [self initASR]; + } + self.isRecording = NO; + + NSLog(@"model init done!"); + } + return self; +} + +void S16ToFloatS16_1(const int16_t* src, size_t size, float* dest) { + for (size_t i = 0; i < size; ++i) + dest[i] = (float)src[i]; +} + +void CharToFloat(const char* src, size_t size, float* dst) { + const int16_t* sample_data = reinterpret_cast(src); + S16ToFloatS16_1(sample_data, size/2, dst); +} + +void CharToFloat_1(const char* src, size_t size, float* dst) { + const int16_t* sample_data = reinterpret_cast(src); +// length = length/2; + float data_f[Samples_Per_Frame] = {0.0}; + S16ToFloatS16_1(sample_data, size/2, data_f); + +// float data_f_norm[480]; + for (int i = 0; i < Samples_Per_Frame; i++) { + dst[i] = data_f[i] / 32767.0; + } +} + +void CharToS16(const char* src, size_t src_size, short* dst) { + const int16_t* sample_data = reinterpret_cast(src); + for (int i = 0; i < src_size/2; i++) { + dst[i] = sample_data[i]; + } +} + +- (void)initASROnnx { + NSString *model_file_path = [[NSBundle mainBundle] pathForResource:@"config" ofType:@".yaml" inDirectory:@"model"]; + model_file_path = [model_file_path stringByReplacingOccurrencesOfString:@"config.yaml" withString:@""]; + const char* model_dir= [model_file_path UTF8String]; + + std::map model_path; + model_path.insert({MODEL_DIR, model_dir}); + model_path.insert({QUANTIZE, "true"}); + + struct timeval start, end; +// gettimeofday(&start, NULL); + int thread_num = 1; + asr_handle_ = FunASRInit(model_path, thread_num, ASR_ONLINE); + + if (!asr_handle_) + { + std::cout << "FunVad init failed" << std::endl; + } + +// gettimeofday(&end, NULL); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + std::cout << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s" << std::endl; + + string default_id = "wav_default_id"; + + // init online features + online_handle_ = FunASROnlineInit(asr_handle_); + +} + +//static FILE *pf_file_out = NULL; +//int audio_index = 0; +- (void)startRecorder { + selfClass = self; + + __weak __typeof(self) weakSelf = self; + [self.sampleData setLength:0]; + // audio record call-back +// float speech[10 * 960]; + speech_buff = (char *)calloc(10*960*2, sizeof(char)); + __block int speech_idx = 0; + self.audioRecorder.inputBlock = ^(NSData *speechData) { + dispatch_async(dispatch_get_main_queue(), ^{ + __strong __typeof(weakSelf) strongSelf = weakSelf; + if (weakSelf.isRecording) { +// [weakSelf appendPCMData:speechData]; // DUBUG USE: append audio data, Memory increment + const char* buffer = (const char*)speechData.bytes; + int length = (int)speechData.length; + + if (strongSelf->is_onnx) { +// char speech_buff[9600*2]; + int step = 9600*2; + + memcpy(speech_buff+length*speech_idx, buffer, length*sizeof(char)); + + // FIX: You can change it to a ring buffer + if (speech_idx == k_input_frames*6-1) { + FUNASR_RESULT result = FunASRInferBuffer(strongSelf->online_handle_, speech_buff, step, RASR_NONE, NULL, false, 16000); + + memset(speech_buff, 0, step * sizeof(char)); + speech_idx = 0; + + if (result) + { + string msg = FunASRGetResult(result, 0); +// std::cout<Process(input_data, length/2); +// NSString *result = [NSString stringWithUTF8String:msg.c_str()]; +// +// if (self.resultBlock) { +// self.resultBlock(result); +// } +// +// free(input_data); + +} + +- (BOOL)writeData { + return [self.sampleData writeToFile:[self getPCMPath] atomically:NO]; +} + +- (void)appendPCMData:(NSData *)pcmData { + [self audioProcessing:pcmData]; +} + +- (void)audioProcessing:(NSData *)data { + [self.sampleData appendData:data]; +} + +- (NSMutableData *)sampleData { + if (!_sampleData) { + _sampleData = [NSMutableData data]; + } + + return _sampleData; +} + +- (AudioRecorder *)audioRecorder { + if (!_audioRecorder) { + _audioRecorder = [[AudioRecorder alloc] init]; + } + + return _audioRecorder; +} + +- (NSLock *)lock { + if (!_lock) { + _lock = [NSLock new]; + } + + return _lock; +} + +- (NSString *)getPCMPath { + NSString *directoryS = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]; + NSString *directory = [directoryS stringByAppendingPathComponent:@"mic_ori.pcm"]; + return directory; +} + + +@end diff --git a/runtime/ios/paraformer_online/paraformer_online/AudioRecorder.h b/runtime/ios/paraformer_online/paraformer_online/AudioRecorder.h new file mode 100644 index 0000000..8d580e0 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/AudioRecorder.h @@ -0,0 +1,49 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// AudioRecorder.h +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import +#import +#import + + +NS_ASSUME_NONNULL_BEGIN + +#define RECORDER_NOTIFICATION_CALLBACK_NAME @"recorderNotificationCallBackName" +#define kNumberAudioQueueBuffers 3 //缓冲区设定3个 +#define kDefaultSampleRate 16000 //采样率 +#define kBufferByteSize (kDefaultSampleRate/100*2)//960 +#define kDataSize 2048 + +typedef void (^AudioRecorder_inputBlock)(NSData *speechData); + +@interface AudioRecorder : NSObject +{ + AudioQueueRef _audioQueue; + AudioStreamBasicDescription audioFormat; + AudioQueueBufferRef _audioBuffers[kNumberAudioQueueBuffers]; + char data[kDataSize]; + int offset; + +} + +@property (nonatomic, assign) BOOL isRecording; +@property (atomic, assign) NSUInteger sampleRate; + +@property (nonatomic,copy) AudioRecorder_inputBlock inputBlock; + +-(void)start; + +-(void)stop; + +@end + +NS_ASSUME_NONNULL_END diff --git a/runtime/ios/paraformer_online/paraformer_online/AudioRecorder.m b/runtime/ios/paraformer_online/paraformer_online/AudioRecorder.m new file mode 100644 index 0000000..821b8e0 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/AudioRecorder.m @@ -0,0 +1,140 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// AudioRecorder.m +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import "AudioRecorder.h" + + + +@implementation AudioRecorder + +- (id)init +{ + self = [super init]; + if (self) { + + self.sampleRate = kDefaultSampleRate; + + //设置录音 初始化录音参数 + [self setupAudioFormat:kAudioFormatLinearPCM SampleRate:(int)self.sampleRate]; + + } + return self; +} +//设置录音 初始化录音参数 +- (void)setupAudioFormat:(UInt32)inFormatID SampleRate:(int)sampeleRate +{ + + memset(&audioFormat, 0, sizeof(audioFormat)); + + audioFormat.mSampleRate = sampeleRate;//采样率 + audioFormat.mChannelsPerFrame = 1;//单声道 + + audioFormat.mFormatID = inFormatID;//采集pcm 格式 + audioFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; + audioFormat.mBitsPerChannel = 16;//每个通道采集2个byte + audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame = (audioFormat.mBitsPerChannel / 8) * audioFormat.mChannelsPerFrame; + audioFormat.mFramesPerPacket = 1; + +} + +//回调函数 不断采集声音。 +void inputHandler(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, const AudioTimeStamp *inStartTime,UInt32 inNumPackets, const AudioStreamPacketDescription *inPacketDesc) +{ + + AudioRecorder *recorder = (__bridge AudioRecorder*)inUserData; + + int k = 0; + if (inBuffer->mAudioDataByteSize > 0) { +// NSLog(@"size: %d", inBuffer->mAudioDataByteSize); + memcpy(recorder->data+recorder->offset,inBuffer->mAudioData,inBuffer->mAudioDataByteSize);//通过recorder->offset 偏移把语音数据存入recorder->data + + recorder->offset+=inBuffer->mAudioDataByteSize;//记录语音数据的大小 + + k = recorder->offset/kBufferByteSize;//计算语音数据有多个960个字节语音 + + for(int i = 0; i data+i*kBufferByteSize length:kBufferByteSize];//把recorder->data 数据以960个字节分切放入 传出的数组中。 + [[NSNotificationCenter defaultCenter] postNotificationName:RECORDER_NOTIFICATION_CALLBACK_NAME object:SpeechData]; + if (recorder.inputBlock) { + recorder.inputBlock(SpeechData); + } + } + +// NSLog(@"sampleRate: %lu", (unsigned long)recorder->_sampleRate); + memcpy(recorder->data,recorder->data+k*kBufferByteSize,recorder->offset-(k*kBufferByteSize));//把剩下的语音数据放入原来的数组中 + + recorder->offset-=(k*kBufferByteSize);//计算剩下的语音数据大小 + + + } + + if (recorder.isRecording) { + + AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL); + + } + +} +//开始录音 +-(void)start +{ + NSError *error = nil; + + //录音的设置和初始化 + BOOL ret = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; + if (!ret) { + return; + } + + //启用audio session + ret = [[AVAudioSession sharedInstance] setActive:YES error:&error]; + if (!ret) + { + return; + } + + + //初始化缓冲语音数据数组 + memset(data,0,kDataSize); // 清空 + offset = 0; + audioFormat.mSampleRate = self.sampleRate; + //初始化音频输入队列 + AudioQueueNewInput(&audioFormat, inputHandler, (__bridge void *)(self), NULL, NULL, 0, &_audioQueue); + + int bufferByteSize = kBufferByteSize; //设定采集一帧960个字节 + + //创建缓冲器 + for (int i = 0; i < kNumberAudioQueueBuffers; ++i){ + AudioQueueAllocateBuffer(_audioQueue, bufferByteSize, &_audioBuffers[i]); + AudioQueueEnqueueBuffer(_audioQueue, _audioBuffers[i], 0, NULL); + } + + //开始录音 + AudioQueueStart(_audioQueue, NULL); + self.isRecording = YES; +} + +//结束录音 +-(void)stop +{ + if (self.isRecording) { + self.isRecording = NO; + AudioQueueStop(_audioQueue, true); + AudioQueueDispose(_audioQueue, true); + [[AVAudioSession sharedInstance] setActive:NO error:nil]; + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:nil]; + } +} + +@end diff --git a/runtime/ios/paraformer_online/paraformer_online/Base.lproj/LaunchScreen.storyboard b/runtime/ios/paraformer_online/paraformer_online/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/runtime/ios/paraformer_online/paraformer_online/Base.lproj/Main.storyboard b/runtime/ios/paraformer_online/paraformer_online/Base.lproj/Main.storyboard new file mode 100644 index 0000000..ec4b35c --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/Base.lproj/Main.storyboard @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/runtime/ios/paraformer_online/paraformer_online/Info.plist b/runtime/ios/paraformer_online/paraformer_online/Info.plist new file mode 100644 index 0000000..81ed29b --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/runtime/ios/paraformer_online/paraformer_online/SceneDelegate.h b/runtime/ios/paraformer_online/paraformer_online/SceneDelegate.h new file mode 100644 index 0000000..f574d36 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/SceneDelegate.h @@ -0,0 +1,20 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// SceneDelegate.h +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import + +@interface SceneDelegate : UIResponder + +@property (strong, nonatomic) UIWindow * window; + +@end + diff --git a/runtime/ios/paraformer_online/paraformer_online/SceneDelegate.m b/runtime/ios/paraformer_online/paraformer_online/SceneDelegate.m new file mode 100644 index 0000000..1b7b003 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/SceneDelegate.m @@ -0,0 +1,62 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// SceneDelegate.m +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import "SceneDelegate.h" + +@interface SceneDelegate () + +@end + +@implementation SceneDelegate + + +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). +} + + +- (void)sceneDidDisconnect:(UIScene *)scene { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). +} + + +- (void)sceneDidBecomeActive:(UIScene *)scene { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. +} + + +- (void)sceneWillResignActive:(UIScene *)scene { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). +} + + +- (void)sceneWillEnterForeground:(UIScene *)scene { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. +} + + +- (void)sceneDidEnterBackground:(UIScene *)scene { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. +} + + +@end diff --git a/runtime/ios/paraformer_online/paraformer_online/ViewController.h b/runtime/ios/paraformer_online/paraformer_online/ViewController.h new file mode 100644 index 0000000..b35be65 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/ViewController.h @@ -0,0 +1,19 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// ViewController.h +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/runtime/ios/paraformer_online/paraformer_online/ViewController.mm b/runtime/ios/paraformer_online/paraformer_online/ViewController.mm new file mode 100644 index 0000000..9d0f7ca --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/ViewController.mm @@ -0,0 +1,143 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +// +// ViewController.m +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import "ViewController.h" + +#include "AudioCapture.h" + +@interface ViewController () + +@property (nonatomic, strong) AudioCapture *audioCapture; +@property (nonatomic, copy) NSString *pre_partial_text; + +@property (weak, nonatomic) IBOutlet UITextView *resultView; +@property (weak, nonatomic) IBOutlet UIButton *startButton; + +@property (strong, nonatomic) UIView *coverView; +@property (strong, nonatomic) UIButton *launchOnnxButton; +@property (strong, nonatomic) UIButton *launchButton; +@property (strong, nonatomic) UIActivityIndicatorView *activityIndicator; + + +@end + +@implementation ViewController +{ + bool is_mic_; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + + self.startButton.layer.cornerRadius = 60; + self.startButton.layer.masksToBounds = YES; + self.startButton.selected = NO; + self.resultView.editable = NO; + + is_mic_ = true; + + [self.view addSubview:self.coverView]; + [self initEngine:YES]; +} + +- (UIView *)coverView { + if (!_coverView) { + NSInteger screenWidth = self.view.bounds.size.width; + NSInteger screenHeight = self.view.bounds.size.height; + _coverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)]; + _coverView.backgroundColor = [UIColor whiteColor]; + + NSInteger x = 30; + NSInteger heigh = 60; + NSInteger y = screenHeight/2-120; + NSInteger width = (screenWidth-30*2); + + UILabel *tip = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, heigh)]; + tip.backgroundColor = [UIColor clearColor]; + tip.textColor = [UIColor grayColor]; + tip.font = [UIFont systemFontOfSize:20]; + tip.textAlignment = NSTextAlignmentCenter; + tip.text = @"正在初始化模型..."; + [_coverView addSubview:tip]; + _coverView.alpha = 0.8; + } + + return _coverView; +} + +- (void)initEngine:(BOOL)onnxModel { + dispatch_async(dispatch_get_main_queue(), ^{ + NSInteger screenWidth = self.view.bounds.size.width; + NSInteger screenHeight = self.view.bounds.size.height; + NSInteger activityIndicatorWith = screenWidth/2; + NSInteger activityIndicatorHeight = activityIndicatorWith; + // UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake((screenWidth-activityIndicatorWith)/2, (screenHeight-activityIndicatorHeight)/2, activityIndicatorWith, activityIndicatorHeight)]; + self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge]; + self.activityIndicator.frame = CGRectMake((screenWidth-activityIndicatorWith)/2, (screenHeight-activityIndicatorHeight)/2, activityIndicatorWith, activityIndicatorHeight); + [self.view addSubview:self.activityIndicator]; + [self.activityIndicator startAnimating]; + + + }); + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [self initASR:onnxModel]; + }); +} + +- (void)initASR:(BOOL)onnxModel { + if (is_mic_) { + self.pre_partial_text = @""; + self.audioCapture = [[AudioCapture alloc] initWithOnnxModel:onnxModel]; + __weak __typeof(self) weakSelf = self; + + self.audioCapture.resultBlock = ^(NSString *result) { + if ([result length] == 0) { + return; + } + NSLog(@"%@", result); + NSString *text = nil; + text = [NSString stringWithFormat:@"%@%@", weakSelf.pre_partial_text, result]; + weakSelf.pre_partial_text = text; + dispatch_async(dispatch_get_main_queue(), ^{ + weakSelf.resultView.text = text; + + }); + }; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [self.activityIndicator stopAnimating]; + [self.activityIndicator removeFromSuperview]; + [self.coverView removeFromSuperview]; + }); +} + +- (IBAction)startButtonClicked:(id)sender { + self.startButton.enabled = NO; + if (!self.startButton.selected) { + if (is_mic_) [self.audioCapture startRecorder]; + } else { + if (is_mic_) [self.audioCapture stopRecorder]; + } + + self.startButton.selected = !self.startButton.selected; + self.startButton.enabled = YES; +} + +- (void)textViewDidChange:(UITextView *)textView { + [textView scrollRangeToVisible:NSMakeRange([textView.text length] - 1, 1)]; +} + + +@end diff --git a/runtime/ios/paraformer_online/paraformer_online/main.m b/runtime/ios/paraformer_online/paraformer_online/main.m new file mode 100644 index 0000000..87bf6f7 --- /dev/null +++ b/runtime/ios/paraformer_online/paraformer_online/main.m @@ -0,0 +1,18 @@ +// +// main.m +// paraformer_online +// +// Created by 邱威 on 2023/6/6. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} diff --git a/runtime/java/FunasrWsClient.java b/runtime/java/FunasrWsClient.java new file mode 100644 index 0000000..2a0c0b4 --- /dev/null +++ b/runtime/java/FunasrWsClient.java @@ -0,0 +1,398 @@ +// +// Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights +// Reserved. MIT License (https://opensource.org/licenses/MIT) +// +/* + * // 2022-2023 by zhaomingwork@qq.com + */ +// java FunasrWsClient +// usage: FunasrWsClient [-h] [--port PORT] [--host HOST] [--audio_in AUDIO_IN] [--num_threads NUM_THREADS] +// [--chunk_size CHUNK_SIZE] [--chunk_interval CHUNK_INTERVAL] [--mode MODE] +package websocket; + +import java.io.*; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.*; +import java.util.Map; +import net.sourceforge.argparse4j.ArgumentParsers; +import net.sourceforge.argparse4j.inf.ArgumentParser; +import net.sourceforge.argparse4j.inf.ArgumentParserException; +import net.sourceforge.argparse4j.inf.Namespace; +import org.java_websocket.client.WebSocketClient; +import org.java_websocket.drafts.Draft; +import org.java_websocket.handshake.ServerHandshake; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +/** This example demonstrates how to connect to websocket server. */ +public class FunasrWsClient extends WebSocketClient { + + public class RecWavThread extends Thread { + private FunasrWsClient funasrClient; + + public RecWavThread(FunasrWsClient funasrClient) { + this.funasrClient = funasrClient; + } + + public void run() { + this.funasrClient.recWav(); + } + } + + private static final Logger logger = LoggerFactory.getLogger(FunasrWsClient.class); + + public FunasrWsClient(URI serverUri, Draft draft) { + super(serverUri, draft); + } + + public FunasrWsClient(URI serverURI) { + + super(serverURI); + } + + public FunasrWsClient(URI serverUri, Map httpHeaders) { + super(serverUri, httpHeaders); + } + + public void getSslContext(String keyfile, String certfile) { + // TODO + return; + } + + // send json at first time + public void sendJson( + String mode, String strChunkSize, int chunkInterval, String wavName, boolean isSpeaking,String suffix) { + try { + + JSONObject obj = new JSONObject(); + obj.put("mode", mode); + JSONArray array = new JSONArray(); + String[] chunkList = strChunkSize.split(","); + for (int i = 0; i < chunkList.length; i++) { + array.add(Integer.valueOf(chunkList[i].trim())); + } + + obj.put("chunk_size", array); + obj.put("chunk_interval", new Integer(chunkInterval)); + obj.put("wav_name", wavName); + + if(FunasrWsClient.hotwords.trim().length()>0) + { + String regex = "\\d+"; + JSONObject jsonitems = new JSONObject(); + String[] items=FunasrWsClient.hotwords.trim().split(" "); + Pattern pattern = Pattern.compile(regex); + String tmpWords=""; + for(int i=0;i 0) { + // send when it is chunk size + if (readSize == chunkSize) { + send(bytes); // send buf to server + + } else { + // send when at last or not is chunk size + byte[] tmpBytes = new byte[readSize]; + for (int i = 0; i < readSize; i++) { + tmpBytes[i] = bytes[i]; + } + send(tmpBytes); + } + // if not in offline mode, we simulate online stream by sleep + if (!mode.equals("offline")) { + Thread.sleep(Integer.valueOf(chunkSize / 32)); + } + + readSize = fis.read(bytes, 0, chunkSize); + } + + if (!mode.equals("offline")) { + // if not offline, we send eof and wait for 3 seconds to close + Thread.sleep(2000); + sendEof(); + Thread.sleep(3000); + close(); + } else { + // if offline, just send eof + sendEof(); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onOpen(ServerHandshake handshakedata) { + + RecWavThread thread = new RecWavThread(this); + thread.start(); + } + + @Override + public void onMessage(String message) { + JSONObject jsonObject = new JSONObject(); + JSONParser jsonParser = new JSONParser(); + logger.info("received: " + message); + try { + jsonObject = (JSONObject) jsonParser.parse(message); + logger.info("text: " + jsonObject.get("text")); + if(jsonObject.containsKey("timestamp")) + { + logger.info("timestamp: " + jsonObject.get("timestamp")); + } + } catch (org.json.simple.parser.ParseException e) { + e.printStackTrace(); + } + if (iseof && mode.equals("offline") && !jsonObject.containsKey("is_final")) { + close(); + } + + if (iseof && mode.equals("offline") && jsonObject.containsKey("is_final") && jsonObject.get("is_final").equals("false")) { + close(); + } + } + + @Override + public void onClose(int code, String reason, boolean remote) { + + logger.info( + "Connection closed by " + + (remote ? "remote peer" : "us") + + " Code: " + + code + + " Reason: " + + reason); + } + + @Override + public void onError(Exception ex) { + logger.info("ex: " + ex); + ex.printStackTrace(); + // if the error is fatal then onClose will be called additionally + } + + private boolean iseof = false; + public static String wavPath; + static String mode = "online"; + static String strChunkSize = "5,10,5"; + static int chunkInterval = 10; + static int sendChunkSize = 1920; + static String hotwords=""; + static String fsthotwords=""; + + String wavName = "javatest"; + + public static void main(String[] args) throws URISyntaxException { + ArgumentParser parser = ArgumentParsers.newArgumentParser("ws client").defaultHelp(true); + parser + .addArgument("--port") + .help("Port on which to listen.") + .setDefault("8889") + .type(String.class) + .required(false); + parser + .addArgument("--host") + .help("the IP address of server.") + .setDefault("127.0.0.1") + .type(String.class) + .required(false); + parser + .addArgument("--audio_in") + .help("wav path for decoding.") + .setDefault("asr_example.wav") + .type(String.class) + .required(false); + parser + .addArgument("--num_threads") + .help("num of threads for test.") + .setDefault(1) + .type(Integer.class) + .required(false); + parser + .addArgument("--chunk_size") + .help("chunk size for asr.") + .setDefault("5, 10, 5") + .type(String.class) + .required(false); + parser + .addArgument("--chunk_interval") + .help("chunk for asr.") + .setDefault(10) + .type(Integer.class) + .required(false); + + parser + .addArgument("--mode") + .help("mode for asr.") + .setDefault("offline") + .type(String.class) + .required(false); + parser + .addArgument("--hotwords") + .help("hotwords, splited by space, hello 30 nihao 40") + .setDefault("") + .type(String.class) + .required(false); + String srvIp = ""; + String srvPort = ""; + String wavPath = ""; + int numThreads = 1; + String chunk_size = ""; + int chunk_interval = 10; + String strmode = "offline"; + String hot=""; + try { + Namespace ns = parser.parseArgs(args); + srvIp = ns.get("host"); + srvPort = ns.get("port"); + wavPath = ns.get("audio_in"); + numThreads = ns.get("num_threads"); + chunk_size = ns.get("chunk_size"); + chunk_interval = ns.get("chunk_interval"); + strmode = ns.get("mode"); + hot=ns.get("hotwords"); + System.out.println(srvPort); + + } catch (ArgumentParserException ex) { + ex.getParser().handleError(ex); + return; + } + + FunasrWsClient.strChunkSize = chunk_size; + FunasrWsClient.chunkInterval = chunk_interval; + FunasrWsClient.wavPath = wavPath; + FunasrWsClient.mode = strmode; + FunasrWsClient.hotwords=hot; + System.out.println( + "serIp=" + + srvIp + + ",srvPort=" + + srvPort + + ",wavPath=" + + wavPath + + ",strChunkSize" + + strChunkSize); + + class ClientThread implements Runnable { + + String srvIp; + String srvPort; + + ClientThread(String srvIp, String srvPort, String wavPath) { + this.srvIp = srvIp; + this.srvPort = srvPort; + } + + public void run() { + try { + + int RATE = 16000; + String[] chunkList = strChunkSize.split(","); + int int_chunk_size = 60 * Integer.valueOf(chunkList[1].trim()) / chunkInterval; + int CHUNK = Integer.valueOf(RATE / 1000 * int_chunk_size); + int stride = + Integer.valueOf( + 60 * Integer.valueOf(chunkList[1].trim()) / chunkInterval / 1000 * 16000 * 2); + System.out.println("chunk_size:" + String.valueOf(int_chunk_size)); + System.out.println("CHUNK:" + CHUNK); + System.out.println("stride:" + String.valueOf(stride)); + FunasrWsClient.sendChunkSize = CHUNK * 2; + + String wsAddress = "ws://" + srvIp + ":" + srvPort; + + FunasrWsClient c = new FunasrWsClient(new URI(wsAddress)); + + c.connect(); + + System.out.println("wsAddress:" + wsAddress); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("e:" + e); + } + } + } + for (int i = 0; i < numThreads; i++) { + System.out.println("Thread1 is running..."); + Thread t = new Thread(new ClientThread(srvIp, srvPort, wavPath)); + t.start(); + } + } +} diff --git a/runtime/java/Makefile b/runtime/java/Makefile new file mode 100644 index 0000000..8b1bd87 --- /dev/null +++ b/runtime/java/Makefile @@ -0,0 +1,76 @@ + +ENTRY_POINT = ./ + + + + +WEBSOCKET_DIR:= ./ +WEBSOCKET_FILES = \ + $(WEBSOCKET_DIR)/FunasrWsClient.java \ + + + +LIB_BUILD_DIR = ./lib + + + + +JAVAC = javac + +BUILD_DIR = build + + +RUNJFLAGS = -Dfile.encoding=utf-8 + + +vpath %.class $(BUILD_DIR) +vpath %.java src + + + + +rebuild: clean all + +.PHONY: clean run downjar + +downjar: + wget https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar -P ./lib/ + wget https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar -P ./lib/ + #wget https://github.com/TooTallNate/Java-WebSocket/releases/download/v1.5.3/Java-WebSocket-1.5.3.jar -P ./lib/ + wget https://repo1.maven.org/maven2/org/java-websocket/Java-WebSocket/1.5.3/Java-WebSocket-1.5.3.jar -P ./lib/ + wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/json-simple/json-simple-1.1.1.jar -P ./lib/ + wget https://github.com/argparse4j/argparse4j/releases/download/argparse4j-0.9.0/argparse4j-0.9.0.jar -P ./lib/ + rm -frv build + mkdir build +clean: + rm -frv $(BUILD_DIR)/* + rm -frv $(LIB_BUILD_DIR)/* + mkdir -p $(BUILD_DIR) + mkdir -p ./lib + + + + + + +runclient: + java -cp $(BUILD_DIR):lib/Java-WebSocket-1.5.3.jar:lib/slf4j-simple-1.7.25.jar:lib/slf4j-api-1.7.25.jar:lib/json-simple-1.1.1.jar:lib/argparse4j-0.9.0.jar $(RUNJFLAGS) websocket.FunasrWsClient --host localhost --port 8889 --audio_in ./asr_example.wav --num_threads 1 --mode 2pass + + + +buildwebsocket: $(WEBSOCKET_FILES:.java=.class) + + +%.class: %.java + + $(JAVAC) -cp $(BUILD_DIR):lib/slf4j-simple-1.7.25.jar:lib/slf4j-api-1.7.25.jar:lib/Java-WebSocket-1.5.3.jar:lib/json-simple-1.1.1.jar:lib/argparse4j-0.9.0.jar -d $(BUILD_DIR) -encoding UTF-8 $< + +packjar: + jar cvfe lib/funasrclient.jar . -C $(BUILD_DIR) . + +all: clean buildlib packjar buildfile buildmic downjar buildwebsocket + + + + + diff --git a/runtime/java/java_http2ws_src/http/src/Readme.md b/runtime/java/java_http2ws_src/http/src/Readme.md new file mode 100644 index 0000000..ef03d1d --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/Readme.md @@ -0,0 +1,14 @@ +dependencies { + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.json:json:20240303") + implementation("org.springframework.boot:spring-boot-starter-websocket") +} + + +使用接口测试工具 form-data格式传入文件 返回测试成功即运行成功 + +默认访问路径: + io路径: http://localhost:8081/recognition/testIO + nio路径: http://localhost:8081/recognition/testNIO + +application.yml中可根据自身需要修改对应模型参数 \ No newline at end of file diff --git a/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/FunasrJavaClientApplication.java b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/FunasrJavaClientApplication.java new file mode 100644 index 0000000..5d41892 --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/FunasrJavaClientApplication.java @@ -0,0 +1,20 @@ +package com.example.funasr_java_client; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * + * @author Virgil Qiu + * @since 2024/04/24 + * + */ + +@SpringBootApplication +public class FunasrJavaClientApplication { + + public static void main(String[] args) { + SpringApplication.run(FunasrJavaClientApplication.class, args); + } + +} diff --git a/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/RecognitionController.java b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/RecognitionController.java new file mode 100644 index 0000000..df60bea --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/RecognitionController.java @@ -0,0 +1,36 @@ +package com.example.funasr_java_client.Servcvice; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.concurrent.ExecutionException; + +/** + * + * @author Virgil Qiu + * @since 2024/04/24 + * + */ +@RestController +@RequestMapping("/recognition") +public class RecognitionController { + + private final RecognitionService recognitionService; + + public RecognitionController(RecognitionService recognitionService) { + this.recognitionService = recognitionService; + } + @PostMapping("/testNIO") + public String testIO(@RequestParam MultipartFile file) throws IOException, ExecutionException, InterruptedException { + recognitionService.recognition(file); + return "测试成功"; + } + + @PostMapping("/testIO") + public String testNIO(@RequestParam MultipartFile file) throws IOException, ExecutionException, InterruptedException { + recognitionService.recognition(file); + return "测试成功"; + } +} diff --git a/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/RecognitionService.java b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/RecognitionService.java new file mode 100644 index 0000000..44d9142 --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/RecognitionService.java @@ -0,0 +1,19 @@ +package com.example.funasr_java_client.Servcvice; + +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.concurrent.ExecutionException; + + +/** + * + * @author Virgil Qiu + * @since 2024/04/24 + * + */ + +public interface RecognitionService { + + Object recognition(MultipartFile file) throws IOException, ExecutionException, InterruptedException; +} diff --git a/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/RecognitionService2.java b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/RecognitionService2.java new file mode 100644 index 0000000..f08245c --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/RecognitionService2.java @@ -0,0 +1,18 @@ +package com.example.funasr_java_client.Servcvice; + +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.concurrent.ExecutionException; + +/** + * + * @author Virgil Qiu + * @since 2024/04/24 + * + */ + +public interface RecognitionService2 { + + Object recognition(MultipartFile file) throws IOException, ExecutionException, InterruptedException; +} diff --git a/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java new file mode 100644 index 0000000..af589a6 --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java @@ -0,0 +1,100 @@ +package com.example.funasr_java_client.Servcvice.impl; + +import com.example.funasr_java_client.Servcvice.RecognitionService; +import com.example.funasr_java_client.WebSocketClient; +import org.json.JSONObject; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.socket.BinaryMessage; +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.client.standard.StandardWebSocketClient; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.concurrent.ExecutionException; + +/** + * + * @author Virgil Qiu + * @since 2024/04/24 + * + */ +@Service +public class RecognitionServiceImpl implements RecognitionService { + @Value("${parameters.fileUrl}") + private String fileUrl; + @Value("${parameters.model}") + private String model; + @Value("${parameters.hotWords}") + private String hotWords; + @Value("${parameters.serverIpPort}") + private String serverIpPort; + @Override + public Object recognition(MultipartFile file) throws IOException, ExecutionException, InterruptedException { + if (file.isEmpty()) { + return "0"; // 文件为空,返回特殊值 + } + + + String originalFilename = file.getOriginalFilename(); + String[] parts = originalFilename.split("\\."); + String prefix = (parts.length > 0) ? parts[0] : originalFilename; + System.out.println(prefix); + String localFilePath = fileUrl + prefix + ".pcm"; + + File localFile = new File(localFilePath); + + File destDir = localFile.getParentFile(); + if (!destDir.exists() && !destDir.mkdirs()) { + throw new IOException("Unable to create destination directory: " + localFilePath); + } + + file.transferTo(localFile); + + WebSocketClient client = new WebSocketClient(); + URI uri = URI.create(serverIpPort); + StandardWebSocketClient standardWebSocketClient = new StandardWebSocketClient(); + WebSocketSession webSocketSession = standardWebSocketClient.execute(client, null, uri).get(); + + + JSONObject configJson = new JSONObject(); + configJson.put("mode", model); + configJson.put("wav_name", prefix); + configJson.put("wav_format", "pcm"); // 文件格式为pcm + configJson.put("is_speaking", true); + configJson.put("hotwords", hotWords"); + configJson.put("itn", true); + + // 发送配置参数与meta信息 + webSocketSession.sendMessage(new TextMessage(configJson.toString())); + + byte[] audioData; + try { + audioData = Files.readAllBytes(Paths.get(localFilePath)); + } catch (IOException e) { + System.err.println("Error reading file: " + e.getMessage()); + e.printStackTrace(); + return "Error reading audio file"; // Return an appropriate error message or throw an exception + } + + ByteBuffer audioByteBuffer = ByteBuffer.wrap(audioData); + + BinaryMessage binaryMessage = new BinaryMessage(audioByteBuffer); + webSocketSession.sendMessage(binaryMessage); + + // 发送音频结束标志 + JSONObject endMarkerJson = new JSONObject(); + endMarkerJson.put("is_speaking", false); + webSocketSession.sendMessage(new TextMessage(endMarkerJson.toString())); + + // TODO: 实现接收并处理服务端返回的识别结果 + + return "test"; + + } +} diff --git a/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl2.java b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl2.java new file mode 100644 index 0000000..4cbdafa --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl2.java @@ -0,0 +1,112 @@ +package com.example.funasr_java_client.Servcvice.impl; + +import com.example.funasr_java_client.Servcvice.RecognitionService; +import com.example.funasr_java_client.Servcvice.RecognitionService2; +import com.example.funasr_java_client.WebSocketClient; +import org.json.JSONObject; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.socket.BinaryMessage; +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.client.standard.StandardWebSocketClient; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URI; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.concurrent.ExecutionException; + +/** + * + * @author Virgil Qiu + * @since 2024/04/24 + * + */ + +@Service +public class RecognitionServiceImpl2 implements RecognitionService2 { + @Value("${parameters.fileUrl}") + private String fileUrl; + @Value("${parameters.model}") + private String model; + @Value("${parameters.hotWords}") + private String hotWords; + @Value("${parameters.serverIpPort}") + private String serverIpPort; + @Override + public Object recognition(MultipartFile file) throws IOException, ExecutionException, InterruptedException { + if (file.isEmpty()) { + return "0"; // 文件为空,返回特殊值 + } + + + String originalFilename = file.getOriginalFilename(); + String[] parts = originalFilename.split("\\."); + String prefix = (parts.length > 0) ? parts[0] : originalFilename; + System.out.println(prefix); + String localFilePath = fileUrl + prefix + ".pcm"; + + File localFile = new File(localFilePath); + + File destDir = localFile.getParentFile(); + if (!destDir.exists() && !destDir.mkdirs()) { + throw new IOException("Unable to create destination directory: " + localFilePath); + } + + file.transferTo(localFile); + + WebSocketClient client = new WebSocketClient(); + URI uri = URI.create(serverIpPort); + StandardWebSocketClient standardWebSocketClient = new StandardWebSocketClient(); + WebSocketSession webSocketSession = standardWebSocketClient.execute(client, null, uri).get(); + + + JSONObject configJson = new JSONObject(); + configJson.put("mode", model); + configJson.put("wav_name", prefix); + configJson.put("wav_format", "pcm"); // 文件格式为pcm + configJson.put("is_speaking", true); + configJson.put("hotwords", hotWords); + configJson.put("itn", true); + + // 发送配置参数与meta信息 + webSocketSession.sendMessage(new TextMessage(configJson.toString())); + + + try (FileInputStream fis = new FileInputStream(localFilePath)) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = fis.read(buffer)) != -1) { + baos.write(buffer, 0, bytesRead); + } + + // 将所有读取的字节合并到一个字节数组中 + byte[] completeData = baos.toByteArray(); + + // 使用字节数组创建BinaryMessage实例 + BinaryMessage binaryMessage = new BinaryMessage(completeData); + webSocketSession.sendMessage(binaryMessage); + // 使用或发送binaryMessage... + } catch (IOException e) { + System.err.println("Error reading file: " + e.getMessage()); + e.printStackTrace(); + } + + + // 发送音频结束标志 + JSONObject endMarkerJson = new JSONObject(); + endMarkerJson.put("is_speaking", false); + webSocketSession.sendMessage(new TextMessage(endMarkerJson.toString())); + + // TODO: 实现接收并处理服务端返回的识别结果 + + return "test"; + + } +} diff --git a/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/WebSocketClient.java b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/WebSocketClient.java new file mode 100644 index 0000000..1857374 --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/java/com/example/funasr_java_client/WebSocketClient.java @@ -0,0 +1,63 @@ +package com.example.funasr_java_client; + +import org.springframework.stereotype.Component; +import org.springframework.web.socket.*; + + +/** + * + * @author Virgil Qiu + * @since 2024/04/24 + * + */ + + +@Component +public class WebSocketClient implements WebSocketHandler { + + private WebSocketSession session; + + @Override + public void afterConnectionEstablished(WebSocketSession session) throws Exception { + this.session = session; + System.out.println("WebSocket connection established."); + } + + @Override + public void handleMessage(WebSocketSession session, WebSocketMessage message) throws Exception { + if (message instanceof TextMessage) { + String receivedMessage = ((TextMessage) message).getPayload(); + System.out.println("Received message from server: " + receivedMessage); + // 在这里处理接收到的消息 + } + } + + @Override + public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception { + System.err.println("WebSocket transport error: " + exception.getMessage()); + session.close(CloseStatus.SERVER_ERROR); + } + + @Override + public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { + System.out.println("WebSocket connection closed with status: " + status); + } + + @Override + public boolean supportsPartialMessages() { + return false; + } + + public void sendMessage(String message) { + if (session != null && session.isOpen()) { + try { + session.sendMessage(new TextMessage(message)); + System.out.println("Sent message to server: " + message); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + System.err.println("WebSocket session is not open. Cannot send message."); + } + } +} diff --git a/runtime/java/java_http2ws_src/http/src/main/resources/application.properties b/runtime/java/java_http2ws_src/http/src/main/resources/application.properties new file mode 100644 index 0000000..b21adeb --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.application.name=funasr_java_client +server.port=8081 diff --git a/runtime/java/java_http2ws_src/http/src/main/resources/application.yml b/runtime/java/java_http2ws_src/http/src/main/resources/application.yml new file mode 100644 index 0000000..5f179bf --- /dev/null +++ b/runtime/java/java_http2ws_src/http/src/main/resources/application.yml @@ -0,0 +1,21 @@ +#/** +# * +# * @author Virgil Qiu +# * @since 2024/04/24 +# * +# */ + +spring: + application: + name: java_http_client +server: + port: 8081 + + +parameters: + model: "offline" #离线模型为例 + hotWords: "{\"自定义\":20,\"热词\":20,\"设置\":30}" + fileUrl: "E:/EI/Audio" + serverIpPort: "ws://your_funasr_ip:port" + + diff --git a/runtime/java/readme.md b/runtime/java/readme.md new file mode 100644 index 0000000..d0f2978 --- /dev/null +++ b/runtime/java/readme.md @@ -0,0 +1,66 @@ +# Client for java websocket example + + + +## Building for Linux/Unix + +### install java environment +```shell +# in ubuntu +apt-get install openjdk-11-jdk +``` + + + +### Build and run by make + + +```shell +cd funasr/runtime/java +# download java lib +make downjar +# compile +make buildwebsocket +# run client +make runclient + +``` + +## Run java websocket client by shell + +```shell +# full command refer to Makefile runclient +usage: FunasrWsClient [-h] [--port PORT] [--host HOST] [--audio_in AUDIO_IN] [--num_threads NUM_THREADS] + [--chunk_size CHUNK_SIZE] [--chunk_interval CHUNK_INTERVAL] [--mode MODE] + +Where: + --host + (required) server-ip + + --port + (required) port + + --audio_in + (required) the wav or pcm file path + + --num_threads + thread number for test + + --mode + asr mode, support "offline" "online" "2pass" + + + +example: +FunasrWsClient --host localhost --port 8889 --audio_in ./asr_example.wav --num_threads 1 --mode 2pass + +result json, example like: +{"mode":"offline","text":"欢迎大家来体验达摩院推出的语音识别模型","wav_name":"javatest"} +``` + + +## Acknowledge +1. This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR). +2. We acknowledge [zhaoming](https://github.com/zhaomingwork/FunASR/tree/java-ws-client-support/funasr/runtime/java) for contributing the java websocket client example. + + diff --git a/runtime/onnxruntime/CMakeLists.txt b/runtime/onnxruntime/CMakeLists.txt new file mode 100644 index 0000000..d8e623e --- /dev/null +++ b/runtime/onnxruntime/CMakeLists.txt @@ -0,0 +1,80 @@ +cmake_minimum_required(VERSION 3.16) + +project(FunASROnnx) + +option(ENABLE_GLOG "Whether to build glog" ON) +option(ENABLE_FST "Whether to build openfst" ON) # ITN need openfst compiled + +# set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ version to be used.") +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +include(TestBigEndian) +test_big_endian(BIG_ENDIAN) +if(BIG_ENDIAN) + message("Big endian system") +else() + message("Little endian system") +endif() + +# json +include(FetchContent) +if(NOT EXISTS ${PROJECT_SOURCE_DIR}/third_party/json/ChangeLog.md ) +FetchContent_Declare(json + URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz +SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/json +) + +FetchContent_MakeAvailable(json) +endif() + +# for onnxruntime +IF(WIN32) + file(REMOVE ${PROJECT_SOURCE_DIR}/third_party/glog/src/config.h + ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/export.h + ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/logging.h + ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/raw_logging.h + ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/stl_logging.h + ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/vlog_is_on.h) +ELSE() + link_directories(${ONNXRUNTIME_DIR}/lib) + link_directories(${FFMPEG_DIR}/lib) +endif() +include_directories(${CMAKE_SOURCE_DIR}/src) +include_directories(${PROJECT_SOURCE_DIR}/third_party/kaldi-native-fbank) +include_directories(${PROJECT_SOURCE_DIR}/third_party/yaml-cpp/include) +include_directories(${PROJECT_SOURCE_DIR}/third_party/jieba/include) +include_directories(${PROJECT_SOURCE_DIR}/third_party/jieba/include/limonp/include) +include_directories(${PROJECT_SOURCE_DIR}/third_party/kaldi) +include_directories(${PROJECT_SOURCE_DIR}/third_party/json/include) + +if(ENABLE_GLOG) + include_directories(${PROJECT_SOURCE_DIR}/third_party/glog/src) + set(BUILD_TESTING OFF) + add_subdirectory(third_party/glog) + include_directories(${glog_BINARY_DIR}) + +endif() + +if(ENABLE_FST) + # fst depend on glog and gflags + include_directories(${PROJECT_SOURCE_DIR}/third_party/gflags) + add_subdirectory(third_party/gflags) + include_directories(${gflags_BINARY_DIR}/include) + + # the following openfst if cloned from https://github.com/kkm000/openfst.git + # with some patch to fix the make errors. + add_subdirectory(third_party/openfst) + include_directories(${openfst_SOURCE_DIR}/src/include) + if(WIN32) + include_directories(${openfst_SOURCE_DIR}/src/lib) + endif() + +endif() + +add_subdirectory(third_party/yaml-cpp) +add_subdirectory(third_party/kaldi-native-fbank/kaldi-native-fbank/csrc) +add_subdirectory(third_party/kaldi) +add_subdirectory(src) +add_subdirectory(bin) diff --git a/runtime/onnxruntime/CMakeSettings.json b/runtime/onnxruntime/CMakeSettings.json new file mode 100644 index 0000000..2eb6c5a --- /dev/null +++ b/runtime/onnxruntime/CMakeSettings.json @@ -0,0 +1,44 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ] + }, + { + "name": "Linux-GCC-Debug", + "generator": "Unix Makefiles", + "configurationType": "Debug", + "cmakeExecutable": "cmake", + "remoteCopySourcesExclusionList": [ ".vs", ".git", "out" ], + "cmakeCommandArgs": "-DONNXRUNTIME_DIR=/data/linux/thirdpart/onnxruntime-linux-x64-1.14.1", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "linux_x64" ], + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/src", + "remoteBuildRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}", + "remoteInstallRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}", + "remoteCopySources": true, + "rsyncCommandArgs": "-t --delete", + "remoteCopyBuildOutput": false, + "remoteCopySourcesMethod": "rsync" + } + ] +} \ No newline at end of file diff --git a/runtime/onnxruntime/bin/CMakeLists.txt b/runtime/onnxruntime/bin/CMakeLists.txt new file mode 100644 index 0000000..c91fbc4 --- /dev/null +++ b/runtime/onnxruntime/bin/CMakeLists.txt @@ -0,0 +1,44 @@ +include_directories(${CMAKE_SOURCE_DIR}/include) + +if(WIN32) +add_compile_options("$<$:/execution-charset:utf-8>") +add_compile_options("$<$:/source-charset:utf-8>") +include_directories(${ONNXRUNTIME_DIR}/include) +include_directories(${FFMPEG_DIR}/include) +include_directories(${PROJECT_SOURCE_DIR}/third_party) +SET(RELATION_SOURCE "../src/resample.cpp" "../src/util.cpp" "../src/alignedmem.cpp" "../src/encode_converter.cpp") +endif() + +add_executable(funasr-onnx-offline "funasr-onnx-offline.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-offline PUBLIC funasr) + +add_executable(funasr-onnx-offline-vad "funasr-onnx-offline-vad.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-offline-vad PUBLIC funasr) + +add_executable(funasr-onnx-online-vad "funasr-onnx-online-vad.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-online-vad PUBLIC funasr) + +add_executable(funasr-onnx-online-asr "funasr-onnx-online-asr.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-online-asr PUBLIC funasr) + +add_executable(funasr-onnx-offline-punc "funasr-onnx-offline-punc.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-offline-punc PUBLIC funasr) + +add_executable(funasr-onnx-online-punc "funasr-onnx-online-punc.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-online-punc PUBLIC funasr) + +add_executable(funasr-onnx-offline-rtf "funasr-onnx-offline-rtf.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-offline-rtf PUBLIC funasr) + +add_executable(funasr-onnx-2pass "funasr-onnx-2pass.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-2pass PUBLIC funasr) + +add_executable(funasr-onnx-2pass-rtf "funasr-onnx-2pass-rtf.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-2pass-rtf PUBLIC funasr) + +add_executable(funasr-onnx-online-rtf "funasr-onnx-online-rtf.cpp" ${RELATION_SOURCE}) +target_link_libraries(funasr-onnx-online-rtf PUBLIC funasr) + +# include_directories(${FFMPEG_DIR}/include) +# add_executable(ff "ffmpeg.cpp") +# target_link_libraries(ff PUBLIC avutil avcodec avformat swresample) diff --git a/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp b/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp new file mode 100644 index 0000000..d4abacd --- /dev/null +++ b/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp @@ -0,0 +1,369 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#ifndef _WIN32 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include "util.h" +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" +#include "audio.h" + +using namespace std; + +std::atomic wav_index(0); +std::mutex mtx; + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); +} + +void runReg(FUNASR_HANDLE tpass_handle, std::vector chunk_size, vector wav_list, vector wav_ids, int audio_fs, + float* total_length, long* total_time, int core_id, ASR_TYPE asr_mode_, string nn_hotwords_, + float glob_beam, float lat_beam, float am_scale, int inc_bias, unordered_map hws_map) { + + struct timeval start, end; + long seconds = 0; + float n_total_length = 0.0f; + long n_total_time = 0; + + FUNASR_DEC_HANDLE decoder_handle = FunASRWfstDecoderInit(tpass_handle, ASR_TWO_PASS, glob_beam, lat_beam, am_scale); + // load hotwords list and build graph + FunWfstDecoderLoadHwsRes(decoder_handle, inc_bias, hws_map); + + std::vector> hotwords_embedding = CompileHotwordEmbedding(tpass_handle, nn_hotwords_, ASR_TWO_PASS); + + // init online features + FUNASR_HANDLE tpass_online_handle=FunTpassOnlineInit(tpass_handle, chunk_size); + + // warm up + for (size_t i = 0; i < 2; i++) + { + int32_t sampling_rate_ = audio_fs; + funasr::Audio audio(1); + if(is_target_file(wav_list[0].c_str(), "wav")){ + if(!audio.LoadWav2Char(wav_list[0].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[0]; + exit(-1); + } + }else if(is_target_file(wav_list[0].c_str(), "pcm")){ + if (!audio.LoadPcmwav2Char(wav_list[0].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[0]; + exit(-1); + } + }else{ + if (!audio.FfmpegLoad(wav_list[0].c_str(), true)){ + LOG(ERROR)<<"Failed to load "<< wav_list[0]; + exit(-1); + } + } + char* speech_buff = audio.GetSpeechChar(); + int buff_len = audio.GetSpeechLen()*2; + + int step = 1600*2; + bool is_final = false; + std::vector> punc_cache(2); + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + FUNASR_RESULT result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, speech_buff+sample_offset, step, punc_cache, is_final, + sampling_rate_, "pcm", (ASR_TYPE)asr_mode_, hotwords_embedding, true, decoder_handle); + if (result) + { + FunASRFreeResult(result); + } + } + } + + while (true) { + // 使用原子变量获取索引并递增 + int i = wav_index.fetch_add(1); + if (i >= wav_list.size()) { + break; + } + int32_t sampling_rate_ = audio_fs; + funasr::Audio audio(1); + if(is_target_file(wav_list[i].c_str(), "wav")){ + if(!audio.LoadWav2Char(wav_list[i].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[i]; + exit(-1); + } + }else if(is_target_file(wav_list[i].c_str(), "pcm")){ + if (!audio.LoadPcmwav2Char(wav_list[i].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[i]; + exit(-1); + } + }else{ + if (!audio.FfmpegLoad(wav_list[i].c_str(), true)){ + LOG(ERROR)<<"Failed to load "<< wav_list[i]; + exit(-1); + } + } + char* speech_buff = audio.GetSpeechChar(); + int buff_len = audio.GetSpeechLen()*2; + + int step = 1600*2; + bool is_final = false; + string online_res=""; + string tpass_res=""; + string time_stamp_res=""; + std::vector> punc_cache(2); + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + gettimeofday(&start, nullptr); + FUNASR_RESULT result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, speech_buff+sample_offset, step, punc_cache, is_final, + sampling_rate_, "pcm", (ASR_TYPE)asr_mode_, hotwords_embedding, true, decoder_handle); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + n_total_time += taking_micros; + + if (result) + { + string online_msg = FunASRGetResult(result, 0); + online_res += online_msg; + if(online_msg != ""){ + LOG(INFO) <<"Thread: " << this_thread::get_id() <<" " << wav_ids[i] <<" : "< guard(mtx); + *total_length += n_total_length; + if(*total_time < n_total_time){ + *total_time = n_total_time; + } + } + FunWfstDecoderUnloadHwsRes(decoder_handle); + FunASRWfstDecoderUninit(decoder_handle); + FunTpassOnlineUninit(tpass_online_handle); +} + + +int main(int argc, char** argv) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-2pass", ' ', "1.0"); + TCLAP::ValueArg offline_model_dir("", OFFLINE_MODEL_DIR, "the asr offline model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg online_model_dir("", ONLINE_MODEL_DIR, "the asr online model path, which contains model.onnx, decoder.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + TCLAP::ValueArg vad_dir("", VAD_DIR, "the vad online model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string"); + TCLAP::ValueArg vad_quant("", VAD_QUANT, "true (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "true", "string"); + TCLAP::ValueArg punc_dir("", PUNC_DIR, "the punc online model path, which contains model.onnx, punc.yaml", false, "", "string"); + TCLAP::ValueArg punc_quant("", PUNC_QUANT, "true (Default), load the model of model.onnx in punc_dir. If set true, load the model of model_quant.onnx in punc_dir", false, "true", "string"); + TCLAP::ValueArg itn_dir("", ITN_DIR, "the itn model(fst) path, which contains zh_itn_tagger.fst and zh_itn_verbalizer.fst", false, "", "string"); + TCLAP::ValueArg lm_dir("", LM_DIR, "the lm model path, which contains compiled models: TLG.fst, config.yaml, lexicon.txt ", false, "", "string"); + TCLAP::ValueArg global_beam("", GLOB_BEAM, "the decoding beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg lattice_beam("", LAT_BEAM, "the lattice generation beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg am_scale("", AM_SCALE, "the acoustic scale for beam searching ", false, 10.0, "float"); + TCLAP::ValueArg fst_inc_wts("", FST_INC_WTS, "the fst hotwords incremental bias", false, 20, "int32_t"); + + TCLAP::ValueArg asr_mode("", ASR_MODE, "offline, online, 2pass", false, "2pass", "string"); + TCLAP::ValueArg onnx_thread("", "model-thread-num", "onnxruntime SetIntraOpNumThreads", false, 1, "int32_t"); + TCLAP::ValueArg thread_num_("", THREAD_NUM, "multi-thread num for rtf", false, 1, "int32_t"); + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + TCLAP::ValueArg hotword("", HOTWORD, "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", false, "", "string"); + + cmd.add(offline_model_dir); + cmd.add(online_model_dir); + cmd.add(quantize); + cmd.add(vad_dir); + cmd.add(vad_quant); + cmd.add(punc_dir); + cmd.add(punc_quant); + cmd.add(itn_dir); + cmd.add(lm_dir); + cmd.add(global_beam); + cmd.add(lattice_beam); + cmd.add(am_scale); + cmd.add(fst_inc_wts); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.add(asr_mode); + cmd.add(onnx_thread); + cmd.add(thread_num_); + cmd.add(hotword); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(offline_model_dir, OFFLINE_MODEL_DIR, model_path); + GetValue(online_model_dir, ONLINE_MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(vad_dir, VAD_DIR, model_path); + GetValue(vad_quant, VAD_QUANT, model_path); + GetValue(punc_dir, PUNC_DIR, model_path); + GetValue(punc_quant, PUNC_QUANT, model_path); + GetValue(itn_dir, ITN_DIR, model_path); + GetValue(lm_dir, LM_DIR, model_path); + GetValue(wav_path, WAV_PATH, model_path); + GetValue(asr_mode, ASR_MODE, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = onnx_thread.getValue(); + int asr_mode_ = -1; + if(model_path[ASR_MODE] == "offline"){ + asr_mode_ = 0; + }else if(model_path[ASR_MODE] == "online"){ + asr_mode_ = 1; + }else if(model_path[ASR_MODE] == "2pass"){ + asr_mode_ = 2; + }else{ + LOG(ERROR) << "Wrong asr-mode : " << model_path[ASR_MODE]; + exit(-1); + } + FUNASR_HANDLE tpass_hanlde=FunTpassInit(model_path, thread_num); + + if (!tpass_hanlde) + { + LOG(ERROR) << "FunTpassInit init failed"; + exit(-1); + } + float glob_beam = 3.0f; + float lat_beam = 3.0f; + float am_sc = 10.0f; + if (lm_dir.isSet()) { + glob_beam = global_beam.getValue(); + lat_beam = lattice_beam.getValue(); + am_sc = am_scale.getValue(); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // hotword file + unordered_map hws_map; + std::string nn_hotwords_ = ""; + std::string hotword_path = hotword.getValue(); + LOG(INFO) << "hotword path: " << hotword_path; + funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_); + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + + if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + + std::vector chunk_size = {5,10,5}; + // 多线程测试 + float total_length = 0.0f; + long total_time = 0; + std::vector threads; + + int rtf_threds = thread_num_.getValue(); + for (int i = 0; i < rtf_threds; i++) + { + threads.emplace_back(thread(runReg, tpass_hanlde, chunk_size, wav_list, wav_ids, audio_fs.getValue(), &total_length, &total_time, i, (ASR_TYPE)asr_mode_, nn_hotwords_, + glob_beam, lat_beam, am_sc, fst_inc_wts.getValue(), hws_map)); + } + + for (auto& thread : threads) + { + thread.join(); + } + + LOG(INFO) << "total_time_wav " << (long)(total_length * 1000) << " ms"; + LOG(INFO) << "total_time_comput " << total_time / 1000 << " ms"; + LOG(INFO) << "total_rtf " << (double)total_time/ (total_length*1000000); + LOG(INFO) << "speedup " << 1.0/((double)total_time/ (total_length*1000000)); + + FunTpassUninit(tpass_hanlde); + return 0; +} + diff --git a/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp b/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp new file mode 100644 index 0000000..6941151 --- /dev/null +++ b/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp @@ -0,0 +1,274 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#ifndef _WIN32 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "util.h" +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" +#include "audio.h" + +using namespace std; + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); +} + +int main(int argc, char** argv) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-2pass", ' ', "1.0"); + TCLAP::ValueArg offline_model_dir("", OFFLINE_MODEL_DIR, "the asr offline model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg online_model_dir("", ONLINE_MODEL_DIR, "the asr online model path, which contains model.onnx, decoder.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + TCLAP::ValueArg vad_dir("", VAD_DIR, "the vad online model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string"); + TCLAP::ValueArg vad_quant("", VAD_QUANT, "true (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "true", "string"); + TCLAP::ValueArg punc_dir("", PUNC_DIR, "the punc online model path, which contains model.onnx, punc.yaml", false, "", "string"); + TCLAP::ValueArg punc_quant("", PUNC_QUANT, "true (Default), load the model of model.onnx in punc_dir. If set true, load the model of model_quant.onnx in punc_dir", false, "true", "string"); + TCLAP::ValueArg itn_dir("", ITN_DIR, "the itn model(fst) path, which contains zh_itn_tagger.fst and zh_itn_verbalizer.fst", false, "", "string"); + TCLAP::ValueArg lm_dir("", LM_DIR, "the lm model path, which contains compiled models: TLG.fst, config.yaml, lexicon.txt ", false, "", "string"); + TCLAP::ValueArg global_beam("", GLOB_BEAM, "the decoding beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg lattice_beam("", LAT_BEAM, "the lattice generation beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg am_scale("", AM_SCALE, "the acoustic scale for beam searching ", false, 10.0, "float"); + TCLAP::ValueArg fst_inc_wts("", FST_INC_WTS, "the fst hotwords incremental bias", false, 20, "int32_t"); + TCLAP::ValueArg asr_mode("", ASR_MODE, "offline, online, 2pass", false, "2pass", "string"); + TCLAP::ValueArg onnx_thread("", "model-thread-num", "onnxruntime SetIntraOpNumThreads", false, 1, "int32_t"); + + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + TCLAP::ValueArg hotword("", HOTWORD, "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", false, "", "string"); + + cmd.add(offline_model_dir); + cmd.add(online_model_dir); + cmd.add(quantize); + cmd.add(vad_dir); + cmd.add(vad_quant); + cmd.add(punc_dir); + cmd.add(punc_quant); + cmd.add(lm_dir); + cmd.add(global_beam); + cmd.add(lattice_beam); + cmd.add(am_scale); + cmd.add(fst_inc_wts); + cmd.add(itn_dir); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.add(asr_mode); + cmd.add(onnx_thread); + cmd.add(hotword); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(offline_model_dir, OFFLINE_MODEL_DIR, model_path); + GetValue(online_model_dir, ONLINE_MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(vad_dir, VAD_DIR, model_path); + GetValue(vad_quant, VAD_QUANT, model_path); + GetValue(punc_dir, PUNC_DIR, model_path); + GetValue(punc_quant, PUNC_QUANT, model_path); + GetValue(lm_dir, LM_DIR, model_path); + GetValue(itn_dir, ITN_DIR, model_path); + GetValue(wav_path, WAV_PATH, model_path); + GetValue(asr_mode, ASR_MODE, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = onnx_thread.getValue(); + int asr_mode_ = -1; + if(model_path[ASR_MODE] == "offline"){ + asr_mode_ = 0; + }else if(model_path[ASR_MODE] == "online"){ + asr_mode_ = 1; + }else if(model_path[ASR_MODE] == "2pass"){ + asr_mode_ = 2; + }else{ + LOG(ERROR) << "Wrong asr-mode : " << model_path[ASR_MODE]; + exit(-1); + } + FUNASR_HANDLE tpass_handle=FunTpassInit(model_path, thread_num); + + if (!tpass_handle) + { + LOG(ERROR) << "FunTpassInit init failed"; + exit(-1); + } + float glob_beam = 3.0f; + float lat_beam = 3.0f; + float am_sc = 10.0f; + if (lm_dir.isSet()) { + glob_beam = global_beam.getValue(); + lat_beam = lattice_beam.getValue(); + am_sc = am_scale.getValue(); + } + // init wfst decoder + FUNASR_DEC_HANDLE decoder_handle = FunASRWfstDecoderInit(tpass_handle, ASR_TWO_PASS, glob_beam, lat_beam, am_sc); + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // hotword file + unordered_map hws_map; + std::string nn_hotwords_ = ""; + std::string hotword_path = hotword.getValue(); + LOG(INFO) << "hotword path: " << hotword_path; + funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_); + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + + if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + + // load hotwords list and build graph + FunWfstDecoderLoadHwsRes(decoder_handle, fst_inc_wts.getValue(), hws_map); + + std::vector> hotwords_embedding = CompileHotwordEmbedding(tpass_handle, nn_hotwords_, ASR_TWO_PASS); + // init online features + std::vector chunk_size = {5,10,5}; + FUNASR_HANDLE tpass_online_handle=FunTpassOnlineInit(tpass_handle, chunk_size); + float snippet_time = 0.0f; + long taking_micros = 0; + for (int i = 0; i < wav_list.size(); i++) { + auto& wav_file = wav_list[i]; + auto& wav_id = wav_ids[i]; + + int32_t sampling_rate_ = audio_fs.getValue(); + funasr::Audio audio(1); + if(is_target_file(wav_file.c_str(), "wav")){ + if(!audio.LoadWav2Char(wav_file.c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + }else if(is_target_file(wav_file.c_str(), "pcm")){ + if (!audio.LoadPcmwav2Char(wav_file.c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + }else{ + if (!audio.FfmpegLoad(wav_file.c_str(), true)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + } + char* speech_buff = audio.GetSpeechChar(); + int buff_len = audio.GetSpeechLen()*2; + + int step = 800*2; + bool is_final = false; + string online_res=""; + string tpass_res=""; + string time_stamp_res=""; + std::vector> punc_cache(2); + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + gettimeofday(&start, nullptr); + FUNASR_RESULT result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, + speech_buff+sample_offset, step, punc_cache, is_final, sampling_rate_, "pcm", + (ASR_TYPE)asr_mode_, hotwords_embedding, true, decoder_handle); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + + if (result) + { + string online_msg = FunASRGetResult(result, 0); + online_res += online_msg; + if(online_msg != ""){ + LOG(INFO)<< wav_id <<" : "< +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" + +using namespace std; + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + if (value_arg.isSet()){ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); + } +} + +int main(int argc, char *argv[]) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-offline-punc", ' ', "1.0"); + TCLAP::ValueArg model_dir("", MODEL_DIR, "the punc model path, which contains model.onnx, punc.yaml", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + TCLAP::ValueArg txt_path("", TXT_PATH, "txt file path, one sentence per line", true, "", "string"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(txt_path); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(txt_path, TXT_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = 1; + FUNASR_HANDLE punc_hanlde=CTTransformerInit(model_path, thread_num); + + if (!punc_hanlde) + { + LOG(ERROR) << "FunASR init failed"; + exit(-1); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read txt_path + vector txt_list; + + if(model_path.find(TXT_PATH)!=model_path.end()){ + ifstream in(model_path.at(TXT_PATH)); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(TXT_PATH) ; + return 0; + } + string line; + while(getline(in, line)) + { + txt_list.emplace_back(line); + } + in.close(); + } + + long taking_micros = 0; + for(auto& txt_str : txt_list){ + gettimeofday(&start, nullptr); + FUNASR_RESULT result=CTTransformerInfer(punc_hanlde, txt_str.c_str(), RASR_NONE, nullptr); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + string msg = FunASRGetResult(result, 0); + LOG(INFO)<<"Results: "< +#else +#include +#endif + +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "util.h" +using namespace std; + +std::atomic wav_index(0); +std::mutex mtx; + +void runReg(FUNASR_HANDLE asr_handle, vector wav_list, vector wav_ids, int audio_fs, + float* total_length, long* total_time, int core_id, float glob_beam = 3.0f, float lat_beam = 3.0f, float am_sc = 10.0f, + int fst_inc_wts = 20, string hotword_path = "") { + + struct timeval start, end; + long seconds = 0; + float n_total_length = 0.0f; + long n_total_time = 0; + + // init wfst decoder + FUNASR_DEC_HANDLE decoder_handle = FunASRWfstDecoderInit(asr_handle, ASR_OFFLINE, glob_beam, lat_beam, am_sc); + + // process fst hotwords list + unordered_map hws_map; + string nn_hotwords_ = ""; + funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_); + + // load hotwords list and build graph + FunWfstDecoderLoadHwsRes(decoder_handle, fst_inc_wts, hws_map); + + std::vector> hotwords_embedding = CompileHotwordEmbedding(asr_handle, nn_hotwords_); + + // warm up + for (size_t i = 0; i < 1; i++) + { + FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[0].c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs, true, decoder_handle); + if(result){ + FunASRFreeResult(result); + } + } + + while (true) { + // 使用原子变量获取索引并递增 + int i = wav_index.fetch_add(1); + if (i >= wav_list.size()) { + break; + } + + gettimeofday(&start, nullptr); + FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[i].c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs, true, decoder_handle); + + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + n_total_time += taking_micros; + + if(result){ + string msg = FunASRGetResult(result, 0); + LOG(INFO) << "Thread: " << this_thread::get_id() << "," << wav_ids[i] << " : " << msg; + string stamp = FunASRGetStamp(result); + if(stamp !=""){ + LOG(INFO) << "Thread: " << this_thread::get_id() << "," << wav_ids[i] << " : " << stamp; + } + string stamp_sents = FunASRGetStampSents(result); + if(stamp_sents !=""){ + LOG(INFO)<< wav_ids[i] <<" : "< guard(mtx); + *total_length += n_total_length; + if(*total_time < n_total_time){ + *total_time = n_total_time; + } + } + FunWfstDecoderUnloadHwsRes(decoder_handle); + FunASRWfstDecoderUninit(decoder_handle); +} + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); +} + +int main(int argc, char *argv[]) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-offline-rtf", ' ', "1.0"); + TCLAP::ValueArg model_dir("", MODEL_DIR, "the model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + TCLAP::ValueArg vad_dir("", VAD_DIR, "the vad model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string"); + TCLAP::ValueArg vad_quant("", VAD_QUANT, "true (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "true", "string"); + TCLAP::ValueArg punc_dir("", PUNC_DIR, "the punc model path, which contains model.onnx, punc.yaml", false, "", "string"); + TCLAP::ValueArg punc_quant("", PUNC_QUANT, "true (Default), load the model of model.onnx in punc_dir. If set true, load the model of model_quant.onnx in punc_dir", false, "true", "string"); + TCLAP::ValueArg lm_dir("", LM_DIR, "the lm model path, which contains compiled models: TLG.fst, config.yaml ", false, "", "string"); + TCLAP::ValueArg global_beam("", GLOB_BEAM, "the decoding beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg lattice_beam("", LAT_BEAM, "the lattice generation beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg am_scale("", AM_SCALE, "the acoustic scale for beam searching ", false, 10.0, "float"); + TCLAP::ValueArg fst_inc_wts("", FST_INC_WTS, "the fst hotwords incremental bias", false, 20, "int32_t"); + TCLAP::ValueArg itn_dir("", ITN_DIR, "the itn model(fst) path, which contains zh_itn_tagger.fst and zh_itn_verbalizer.fst", false, "", "string"); + + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + TCLAP::ValueArg thread_num("", THREAD_NUM, "multi-thread num for rtf", true, 0, "int32_t"); + TCLAP::ValueArg hotword("", HOTWORD, "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", false, "", "string"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(vad_dir); + cmd.add(vad_quant); + cmd.add(punc_dir); + cmd.add(punc_quant); + cmd.add(itn_dir); + cmd.add(lm_dir); + cmd.add(global_beam); + cmd.add(lattice_beam); + cmd.add(am_scale); + cmd.add(hotword); + cmd.add(fst_inc_wts); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.add(thread_num); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(vad_dir, VAD_DIR, model_path); + GetValue(vad_quant, VAD_QUANT, model_path); + GetValue(punc_dir, PUNC_DIR, model_path); + GetValue(punc_quant, PUNC_QUANT, model_path); + GetValue(itn_dir, ITN_DIR, model_path); + GetValue(lm_dir, LM_DIR, model_path); + GetValue(hotword, HOTWORD, model_path); + GetValue(wav_path, WAV_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + FUNASR_HANDLE asr_handle=FunOfflineInit(model_path, 1); + + if (!asr_handle) + { + LOG(ERROR) << "FunASR init failed"; + exit(-1); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + if(is_target_file(wav_path_, "wav") || is_target_file(wav_path_, "pcm")){ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + else if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + LOG(ERROR)<<"Please check the wav extension!"; + exit(-1); + } + + // 多线程测试 + float total_length = 0.0f; + long total_time = 0; + std::vector threads; + + int rtf_threds = thread_num.getValue(); + std::string hotword_path = hotword.getValue(); + int value_bias = 20; + value_bias = fst_inc_wts.getValue(); + float glob_beam = 3.0f; + float lat_beam = 3.0f; + float am_sc = 10.0f; + if (lm_dir.isSet()) { + glob_beam = global_beam.getValue(); + lat_beam = lattice_beam.getValue(); + am_sc = am_scale.getValue(); + } + for (int i = 0; i < rtf_threds; i++) + { + threads.emplace_back(thread(runReg, asr_handle, wav_list, wav_ids, audio_fs.getValue(), &total_length, &total_time, i, glob_beam, lat_beam, am_sc, value_bias, hotword_path)); + } + + for (auto& thread : threads) + { + thread.join(); + } + + LOG(INFO) << "total_time_wav " << (long)(total_length * 1000) << " ms"; + LOG(INFO) << "total_time_comput " << total_time / 1000 << " ms"; + LOG(INFO) << "total_rtf " << (double)total_time/ (total_length*1000000); + LOG(INFO) << "speedup " << 1.0/((double)total_time/ (total_length*1000000)); + + FunOfflineUninit(asr_handle); + return 0; +} diff --git a/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp b/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp new file mode 100644 index 0000000..d0cb2ee --- /dev/null +++ b/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp @@ -0,0 +1,160 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#ifndef _WIN32 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" + +using namespace std; + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + if (value_arg.isSet()){ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); + } +} + +void print_segs(vector>* vec, string &wav_id) { + string seg_out=wav_id + ": ["; + for (int i = 0; i < vec->size(); i++) { + vector inner_vec = (*vec)[i]; + seg_out += "["; + for (int j = 0; j < inner_vec.size(); j++) { + seg_out += to_string(inner_vec[j]); + if (j != inner_vec.size() - 1) { + seg_out += ","; + } + } + seg_out += "]"; + if (i != vec->size() - 1) { + seg_out += ","; + } + } + seg_out += "]"; + LOG(INFO)< model_dir("", MODEL_DIR, "the vad model path, which contains model.onnx, vad.yaml, vad.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(wav_path, WAV_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = 1; + FUNASR_HANDLE vad_hanlde=FsmnVadInit(model_path, thread_num); + + if (!vad_hanlde) + { + LOG(ERROR) << "FunVad init failed"; + exit(-1); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + if(is_target_file(wav_path_, "wav") || is_target_file(wav_path_, "pcm")){ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + else if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + LOG(ERROR)<<"Please check the wav extension!"; + exit(-1); + } + + float snippet_time = 0.0f; + long taking_micros = 0; + for (int i = 0; i < wav_list.size(); i++) { + auto& wav_file = wav_list[i]; + auto& wav_id = wav_ids[i]; + gettimeofday(&start, nullptr); + FUNASR_RESULT result=FsmnVadInfer(vad_hanlde, wav_file.c_str(), nullptr, audio_fs.getValue()); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + + if (result) + { + vector>* vad_segments = FsmnVadGetResult(result, 0); + print_segs(vad_segments, wav_id); + snippet_time += FsmnVadGetRetSnippetTime(result); + FsmnVadFreeResult(result); + } + else + { + LOG(ERROR) << ("No return data!\n"); + } + } + + LOG(INFO) << "Audio length: " << (double)snippet_time << " s"; + LOG(INFO) << "Model inference takes: " << (double)taking_micros / 1000000 <<" s"; + LOG(INFO) << "Model inference RTF: " << (double)taking_micros/ (snippet_time*1000000); + FsmnVadUninit(vad_hanlde); + return 0; +} + diff --git a/runtime/onnxruntime/bin/funasr-onnx-offline.cpp b/runtime/onnxruntime/bin/funasr-onnx-offline.cpp new file mode 100644 index 0000000..edb83bd --- /dev/null +++ b/runtime/onnxruntime/bin/funasr-onnx-offline.cpp @@ -0,0 +1,194 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#ifndef _WIN32 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" +#include +#include "util.h" +using namespace std; + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); +} + +int main(int argc, char** argv) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-offline", ' ', "1.0"); + TCLAP::ValueArg model_dir("", MODEL_DIR, "the asr model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + TCLAP::ValueArg vad_dir("", VAD_DIR, "the vad model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string"); + TCLAP::ValueArg vad_quant("", VAD_QUANT, "true (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "true", "string"); + TCLAP::ValueArg punc_dir("", PUNC_DIR, "the punc model path, which contains model.onnx, punc.yaml", false, "", "string"); + TCLAP::ValueArg punc_quant("", PUNC_QUANT, "true (Default), load the model of model.onnx in punc_dir. If set true, load the model of model_quant.onnx in punc_dir", false, "true", "string"); + TCLAP::ValueArg lm_dir("", LM_DIR, "the lm model path, which contains compiled models: TLG.fst, config.yaml, lexicon.txt ", false, "", "string"); + TCLAP::ValueArg global_beam("", GLOB_BEAM, "the decoding beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg lattice_beam("", LAT_BEAM, "the lattice generation beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg am_scale("", AM_SCALE, "the acoustic scale for beam searching ", false, 10.0, "float"); + TCLAP::ValueArg fst_inc_wts("", FST_INC_WTS, "the fst hotwords incremental bias", false, 20, "int32_t"); + TCLAP::ValueArg itn_dir("", ITN_DIR, "the itn model(fst) path, which contains zh_itn_tagger.fst and zh_itn_verbalizer.fst", false, "", "string"); + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + TCLAP::ValueArg hotword("", HOTWORD, "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", false, "", "string"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(vad_dir); + cmd.add(vad_quant); + cmd.add(punc_dir); + cmd.add(punc_quant); + cmd.add(itn_dir); + cmd.add(lm_dir); + cmd.add(global_beam); + cmd.add(lattice_beam); + cmd.add(am_scale); + cmd.add(fst_inc_wts); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.add(hotword); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(vad_dir, VAD_DIR, model_path); + GetValue(vad_quant, VAD_QUANT, model_path); + GetValue(punc_dir, PUNC_DIR, model_path); + GetValue(punc_quant, PUNC_QUANT, model_path); + GetValue(itn_dir, ITN_DIR, model_path); + GetValue(lm_dir, LM_DIR, model_path); + GetValue(wav_path, WAV_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = 1; + FUNASR_HANDLE asr_hanlde=FunOfflineInit(model_path, thread_num); + + if (!asr_hanlde) + { + LOG(ERROR) << "FunASR init failed"; + exit(-1); + } + float glob_beam = 3.0f; + float lat_beam = 3.0f; + float am_sc = 10.0f; + if (lm_dir.isSet()) { + glob_beam = global_beam.getValue(); + lat_beam = lattice_beam.getValue(); + am_sc = am_scale.getValue(); + } + // init wfst decoder + FUNASR_DEC_HANDLE decoder_handle = FunASRWfstDecoderInit(asr_hanlde, ASR_OFFLINE, glob_beam, lat_beam, am_sc); + + // hotword file + unordered_map hws_map; + std::string nn_hotwords_ = ""; + std::string hotword_path = hotword.getValue(); + LOG(INFO) << "hotword path: " << hotword_path; + funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_); + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + + if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + + float snippet_time = 0.0f; + long taking_micros = 0; + + // load hotwords list and build graph + FunWfstDecoderLoadHwsRes(decoder_handle, fst_inc_wts.getValue(), hws_map); + + std::vector> hotwords_embedding = CompileHotwordEmbedding(asr_hanlde, nn_hotwords_); + for (int i = 0; i < wav_list.size(); i++) { + auto& wav_file = wav_list[i]; + auto& wav_id = wav_ids[i]; + gettimeofday(&start, nullptr); + FUNASR_RESULT result=FunOfflineInfer(asr_hanlde, wav_file.c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs.getValue(), true, decoder_handle); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + + if (result) + { + string msg = FunASRGetResult(result, 0); + LOG(INFO)<< wav_id <<" : "< +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" +#include "audio.h" + +using namespace std; + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + if (value_arg.isSet()){ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); + } +} + +int main(int argc, char *argv[]) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-offline-vad", ' ', "1.0"); + TCLAP::ValueArg model_dir("", MODEL_DIR, "the asr online model path, which contains model.onnx, decoder.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(wav_path, WAV_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = 1; + FUNASR_HANDLE asr_handle=FunASRInit(model_path, thread_num, ASR_ONLINE); + + if (!asr_handle) + { + LOG(ERROR) << "FunVad init failed"; + exit(-1); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + + // init online features + FUNASR_HANDLE online_handle=FunASROnlineInit(asr_handle); + float snippet_time = 0.0f; + long taking_micros = 0; + for (int i = 0; i < wav_list.size(); i++) { + auto& wav_file = wav_list[i]; + auto& wav_id = wav_ids[i]; + + int32_t sampling_rate_ = audio_fs.getValue(); + funasr::Audio audio(1); + if(is_target_file(wav_file.c_str(), "wav")){ + if(!audio.LoadWav2Char(wav_file.c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + }else if(is_target_file(wav_file.c_str(), "pcm")){ + if (!audio.LoadPcmwav2Char(wav_file.c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + }else{ + if (!audio.FfmpegLoad(wav_file.c_str(), true)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + } + char* speech_buff = audio.GetSpeechChar(); + int buff_len = audio.GetSpeechLen()*2; + + int step = 9600*2; + bool is_final = false; + + string final_res=""; + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + gettimeofday(&start, nullptr); + FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + + if (result) + { + string msg = FunASRGetResult(result, 0); + final_res += msg; + LOG(INFO)<< wav_id <<" : "< +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" + +using namespace std; + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + if (value_arg.isSet()){ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); + } +} + +void splitString(vector& strings, const string& org_string, const string& seq) { + string::size_type p1 = 0; + string::size_type p2 = org_string.find(seq); + + while (p2 != string::npos) { + if (p2 == p1) { + ++p1; + p2 = org_string.find(seq, p1); + continue; + } + strings.push_back(org_string.substr(p1, p2 - p1)); + p1 = p2 + seq.size(); + p2 = org_string.find(seq, p1); + } + + if (p1 != org_string.size()) { + strings.push_back(org_string.substr(p1)); + } +} + +int main(int argc, char *argv[]) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-online-punc", ' ', "1.0"); + TCLAP::ValueArg model_dir("", MODEL_DIR, "the punc model path, which contains model.onnx, punc.yaml", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + TCLAP::ValueArg txt_path("", TXT_PATH, "txt file path, one sentence per line", true, "", "string"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(txt_path); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(txt_path, TXT_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = 1; + FUNASR_HANDLE punc_hanlde=CTTransformerInit(model_path, thread_num, PUNC_ONLINE); + + if (!punc_hanlde) + { + LOG(ERROR) << "FunASR init failed"; + exit(-1); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read txt_path + vector txt_list; + + if(model_path.find(TXT_PATH)!=model_path.end()){ + ifstream in(model_path.at(TXT_PATH)); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(TXT_PATH) ; + return 0; + } + string line; + while(getline(in, line)) + { + txt_list.emplace_back(line); + } + in.close(); + } + + long taking_micros = 0; + for(auto& txt_str : txt_list){ + vector vad_strs; + splitString(vad_strs, txt_str, "|"); + string str_out; + FUNASR_RESULT result = nullptr; + gettimeofday(&start, nullptr); + for(auto& vad_str:vad_strs){ + result=CTTransformerInfer(punc_hanlde, vad_str.c_str(), RASR_NONE, nullptr, PUNC_ONLINE, result); + if(result){ + string msg = CTTransformerGetResult(result, 0); + str_out += msg; + LOG(INFO)<<"Online result: "< +#else +#include +#endif + +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "audio.h" + +using namespace std; + +std::atomic wav_index(0); +std::mutex mtx; + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void runReg(FUNASR_HANDLE asr_handle, vector wav_list, vector wav_ids, int audio_fs, + float* total_length, long* total_time, int core_id) { + + struct timeval start, end; + long seconds = 0; + float n_total_length = 0.0f; + long n_total_time = 0; + + // init online features + FUNASR_HANDLE online_handle=FunASROnlineInit(asr_handle); + + // warm up + for (size_t i = 0; i < 10; i++) + { + int32_t sampling_rate_ = audio_fs; + funasr::Audio audio(1); + if(is_target_file(wav_list[0].c_str(), "wav")){ + if(!audio.LoadWav2Char(wav_list[0].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[0]; + exit(-1); + } + }else if(is_target_file(wav_list[0].c_str(), "pcm")){ + if (!audio.LoadPcmwav2Char(wav_list[0].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[0]; + exit(-1); + } + }else{ + if (!audio.FfmpegLoad(wav_list[0].c_str(), true)){ + LOG(ERROR)<<"Failed to load "<< wav_list[0]; + exit(-1); + } + } + char* speech_buff = audio.GetSpeechChar(); + int buff_len = audio.GetSpeechLen()*2; + + int step = 9600*2; + bool is_final = false; + + string final_res=""; + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_); + if (result) + { + FunASRFreeResult(result); + } + } + } + + while (true) { + // 使用原子变量获取索引并递增 + int i = wav_index.fetch_add(1); + if (i >= wav_list.size()) { + break; + } + int32_t sampling_rate_ = audio_fs; + funasr::Audio audio(1); + if(is_target_file(wav_list[i].c_str(), "wav")){ + if(!audio.LoadWav2Char(wav_list[i].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[i]; + exit(-1); + } + }else if(is_target_file(wav_list[i].c_str(), "pcm")){ + if (!audio.LoadPcmwav2Char(wav_list[i].c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_list[i]; + exit(-1); + } + }else{ + if (!audio.FfmpegLoad(wav_list[i].c_str(), true)){ + LOG(ERROR)<<"Failed to load "<< wav_list[i]; + exit(-1); + } + } + char* speech_buff = audio.GetSpeechChar(); + int buff_len = audio.GetSpeechLen()*2; + + int step = 9600*2; + bool is_final = false; + + string final_res=""; + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + gettimeofday(&start, nullptr); + FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + n_total_time += taking_micros; + + if (result) + { + string msg = FunASRGetResult(result, 0); + final_res += msg; + LOG(INFO) << "Thread: " << this_thread::get_id() << "," << wav_ids[i] << " : " << msg; + float snippet_time = FunASRGetRetSnippetTime(result); + n_total_length += snippet_time; + FunASRFreeResult(result); + } + else + { + LOG(ERROR) << ("No return data!\n"); + } + } + LOG(INFO) << "Thread: " << this_thread::get_id() << ", Final results " << wav_ids[i] << " : " << final_res; + + } + { + lock_guard guard(mtx); + *total_length += n_total_length; + if(*total_time < n_total_time){ + *total_time = n_total_time; + } + } + FunASRUninit(online_handle); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + if (value_arg.isSet()){ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); + } +} + +int main(int argc, char *argv[]) +{ + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-onnx-online-rtf", ' ', "1.0"); + TCLAP::ValueArg model_dir("", MODEL_DIR, "the model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "true (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + TCLAP::ValueArg vad_dir("", VAD_DIR, "the vad model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string"); + TCLAP::ValueArg vad_quant("", VAD_QUANT, "true (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "true", "string"); + TCLAP::ValueArg punc_dir("", PUNC_DIR, "the punc model path, which contains model.onnx, punc.yaml", false, "", "string"); + TCLAP::ValueArg punc_quant("", PUNC_QUANT, "true (Default), load the model of model.onnx in punc_dir. If set true, load the model of model_quant.onnx in punc_dir", false, "true", "string"); + + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + TCLAP::ValueArg thread_num("", THREAD_NUM, "multi-thread num for rtf", true, 0, "int32_t"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(vad_dir); + cmd.add(vad_quant); + cmd.add(punc_dir); + cmd.add(punc_quant); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.add(thread_num); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(vad_dir, VAD_DIR, model_path); + GetValue(vad_quant, VAD_QUANT, model_path); + GetValue(punc_dir, PUNC_DIR, model_path); + GetValue(punc_quant, PUNC_QUANT, model_path); + GetValue(wav_path, WAV_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + FUNASR_HANDLE asr_handle=FunASRInit(model_path, 1, ASR_ONLINE); + + if (!asr_handle) + { + LOG(ERROR) << "FunASR init failed"; + exit(-1); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + if(is_target_file(wav_path_, "wav") || is_target_file(wav_path_, "pcm")){ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + else if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + LOG(ERROR)<<"Please check the wav extension!"; + exit(-1); + } + + // 多线程测试 + float total_length = 0.0f; + long total_time = 0; + std::vector threads; + + int rtf_threds = thread_num.getValue(); + for (int i = 0; i < rtf_threds; i++) + { + threads.emplace_back(thread(runReg, asr_handle, wav_list, wav_ids, audio_fs.getValue(), &total_length, &total_time, i)); + } + + for (auto& thread : threads) + { + thread.join(); + } + + LOG(INFO) << "total_time_wav " << (long)(total_length * 1000) << " ms"; + LOG(INFO) << "total_time_comput " << total_time / 1000 << " ms"; + LOG(INFO) << "total_rtf " << (double)total_time/ (total_length*1000000); + LOG(INFO) << "speedup " << 1.0/((double)total_time/ (total_length*1000000)); + + FunASRUninit(asr_handle); + return 0; +} diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp new file mode 100644 index 0000000..6633dfe --- /dev/null +++ b/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp @@ -0,0 +1,200 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#ifndef _WIN32 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "funasrruntime.h" +#include "tclap/CmdLine.h" +#include "com-define.h" +#include "audio.h" + +using namespace std; + +bool is_target_file(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void GetValue(TCLAP::ValueArg& value_arg, string key, std::map& model_path) +{ + if (value_arg.isSet()){ + model_path.insert({key, value_arg.getValue()}); + LOG(INFO)<< key << " : " << value_arg.getValue(); + } +} + +void print_segs(vector>* vec, string &wav_id) { + if((*vec).size() == 0){ + return; + } + string seg_out=wav_id + ": ["; + for (int i = 0; i < vec->size(); i++) { + vector inner_vec = (*vec)[i]; + if(inner_vec.size() == 0){ + continue; + } + seg_out += "["; + for (int j = 0; j < inner_vec.size(); j++) { + seg_out += to_string(inner_vec[j]); + if (j != inner_vec.size() - 1) { + seg_out += ","; + } + } + seg_out += "]"; + if (i != vec->size() - 1) { + seg_out += ","; + } + } + seg_out += "]"; + LOG(INFO)< model_dir("", MODEL_DIR, "the vad model path, which contains model.onnx, vad.yaml, vad.mvn", true, "", "string"); + TCLAP::ValueArg quantize("", QUANTIZE, "false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); + + TCLAP::ValueArg wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string"); + TCLAP::ValueArg audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t"); + + cmd.add(model_dir); + cmd.add(quantize); + cmd.add(wav_path); + cmd.add(audio_fs); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(wav_path, WAV_PATH, model_path); + + struct timeval start, end; + gettimeofday(&start, nullptr); + int thread_num = 1; + FUNASR_HANDLE vad_hanlde=FsmnVadInit(model_path, thread_num); + + if (!vad_hanlde) + { + LOG(ERROR) << "FunVad init failed"; + exit(-1); + } + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; + + // read wav_path + vector wav_list; + vector wav_ids; + string default_id = "wav_default_id"; + string wav_path_ = model_path.at(WAV_PATH); + if(is_target_file(wav_path_, "wav") || is_target_file(wav_path_, "pcm")){ + wav_list.emplace_back(wav_path_); + wav_ids.emplace_back(default_id); + } + else if(is_target_file(wav_path_, "scp")){ + ifstream in(wav_path_); + if (!in.is_open()) { + LOG(ERROR) << "Failed to open file: " << model_path.at(WAV_SCP) ; + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + LOG(ERROR)<<"Please check the wav extension!"; + exit(-1); + } + // init online features + FUNASR_HANDLE online_hanlde=FsmnVadOnlineInit(vad_hanlde); + float snippet_time = 0.0f; + long taking_micros = 0; + for (int i = 0; i < wav_list.size(); i++) { + auto& wav_file = wav_list[i]; + auto& wav_id = wav_ids[i]; + + int32_t sampling_rate_ = audio_fs.getValue(); + funasr::Audio audio(1); + if(is_target_file(wav_file.c_str(), "wav")){ + if(!audio.LoadWav2Char(wav_file.c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + }else if(is_target_file(wav_file.c_str(), "pcm")){ + if (!audio.LoadPcmwav2Char(wav_file.c_str(), &sampling_rate_)){ + LOG(ERROR)<<"Failed to load "<< wav_file; + exit(-1); + } + }else{ + LOG(ERROR)<<"Wrong wav extension"; + exit(-1); + } + char* speech_buff = audio.GetSpeechChar(); + int buff_len = audio.GetSpeechLen()*2; + + int step = 800*2; + bool is_final = false; + + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + gettimeofday(&start, nullptr); + FUNASR_RESULT result = FsmnVadInferBuffer(online_hanlde, speech_buff+sample_offset, step, nullptr, is_final, sampling_rate_); + gettimeofday(&end, nullptr); + seconds = (end.tv_sec - start.tv_sec); + taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + + if (result) + { + vector>* vad_segments = FsmnVadGetResult(result, 0); + print_segs(vad_segments, wav_id); + snippet_time += FsmnVadGetRetSnippetTime(result); + FsmnVadFreeResult(result); + } + else + { + LOG(ERROR) << ("No return data!\n"); + } + } + } + + LOG(INFO) << "Audio length: " << (double)snippet_time << " s"; + LOG(INFO) << "Model inference takes: " << (double)taking_micros / 1000000 <<" s"; + LOG(INFO) << "Model inference RTF: " << (double)taking_micros/ (snippet_time*1000000); + FsmnVadUninit(online_hanlde); + FsmnVadUninit(vad_hanlde); + return 0; +} + diff --git a/runtime/onnxruntime/include/audio.h b/runtime/onnxruntime/include/audio.h new file mode 100644 index 0000000..9edd9c9 --- /dev/null +++ b/runtime/onnxruntime/include/audio.h @@ -0,0 +1,114 @@ +#ifndef AUDIO_H +#define AUDIO_H + +#include +#include +#include "vad-model.h" +#include "offline-stream.h" +#include "com-define.h" + +#ifndef WAV_HEADER_SIZE +#define WAV_HEADER_SIZE 44 +#endif + +using namespace std; +namespace funasr { + +class AudioFrame { + private: + int start; + int end; + + + public: + AudioFrame(); + AudioFrame(int len); + AudioFrame(const AudioFrame &other); + AudioFrame(int start, int end, bool is_final); + + ~AudioFrame(); + int SetStart(int val); + int SetEnd(int val); + int GetStart(); + int GetLen(); + int Disp(); + // 2pass + bool is_final = false; + float* data = nullptr; + int len; + int global_start = 0; // the start of a frame in the global time axis. in ms + int global_end = 0; // the end of a frame in the global time axis. in ms +}; + +#ifdef _WIN32 +#ifdef _FUNASR_API_EXPORT +#define DLLAPI __declspec(dllexport) +#else +#define DLLAPI __declspec(dllimport) +#endif +#else +#define DLLAPI +#endif +class DLLAPI Audio { + private: + float *speech_data=nullptr; + int16_t *speech_buff=nullptr; + char* speech_char=nullptr; + int speech_len; + int speech_align_len; + float align_size; + int data_type; + queue frame_queue; + queue asr_online_queue; + queue asr_offline_queue; + int dest_sample_rate; + public: + Audio(int data_type); + Audio(int model_sample_rate,int data_type); + Audio(int model_sample_rate,int data_type, int size); + ~Audio(); + void ClearQueue(std::queue& q); + void Disp(); + void WavResample(int32_t sampling_rate, const float *waveform, int32_t n); + bool LoadWav(const char* buf, int n_len, int32_t* sampling_rate); + bool LoadWav(const char* filename, int32_t* sampling_rate, bool resample=true); + bool LoadWav2Char(const char* filename, int32_t* sampling_rate); + bool LoadPcmwav(const char* buf, int n_file_len, int32_t* sampling_rate); + bool LoadPcmwav(const char* filename, int32_t* sampling_rate, bool resample=true); + bool LoadPcmwav2Char(const char* filename, int32_t* sampling_rate); + bool LoadOthers2Char(const char* filename); + bool FfmpegLoad(const char *filename, bool copy2char=false); + bool FfmpegLoad(const char* buf, int n_file_len); + int FetchChunck(AudioFrame *&frame); + int FetchTpass(AudioFrame *&frame); + int Fetch(float *&dout, int &len, int &flag); + int Fetch(float *&dout, int &len, int &flag, float &start_time); + void Padding(); + void Split(OfflineStream* offline_streamj); + void CutSplit(OfflineStream* offline_streamj); + void Split(VadModel* vad_obj, vector>& vad_segments, bool input_finished=true); + void Split(VadModel* vad_obj, int chunk_len, bool input_finished=true, ASR_TYPE asr_mode=ASR_TWO_PASS); + float GetTimeLen(); + int GetQueueSize() { return (int)frame_queue.size(); } + char* GetSpeechChar(){return speech_char;} + int GetSpeechLen(){return speech_len;} + + // 2pass + vector all_samples; + int offset = 0; + int speech_start=-1, speech_end=0; + int speech_offline_start=-1; + + int seg_sample = MODEL_SAMPLE_RATE/1000; + bool LoadPcmwavOnline(const char* buf, int n_file_len, int32_t* sampling_rate); + void ResetIndex(){ + speech_start=-1; + speech_end=0; + speech_offline_start=-1; + offset = 0; + all_samples.clear(); + } +}; + +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/include/com-define.h b/runtime/onnxruntime/include/com-define.h new file mode 100644 index 0000000..d4edd5b --- /dev/null +++ b/runtime/onnxruntime/include/com-define.h @@ -0,0 +1,127 @@ +#pragma once + +namespace funasr { +#define S_BEGIN 0 +#define S_MIDDLE 1 +#define S_END 2 +#define S_ALL 3 +#define S_ERR 4 + +#ifndef MODEL_SAMPLE_RATE +#define MODEL_SAMPLE_RATE 16000 +#endif + +// parser option +#define MODEL_DIR "model-dir" +#define OFFLINE_MODEL_DIR "model-dir" +#define ONLINE_MODEL_DIR "online-model-dir" +#define LM_DIR "lm-dir" +#define GLOB_BEAM "global-beam" +#define LAT_BEAM "lattice-beam" +#define AM_SCALE "am-scale" +// #define FST_HOTWORD "fst-hotword" +#define FST_INC_WTS "fst-inc-wts" +#define VAD_DIR "vad-dir" +#define PUNC_DIR "punc-dir" +#define QUANTIZE "quantize" +#define VAD_QUANT "vad-quant" +#define PUNC_QUANT "punc-quant" +#define ASR_MODE "mode" + +#define WAV_PATH "wav-path" +#define WAV_SCP "wav-scp" +#define TXT_PATH "txt-path" +#define THREAD_NUM "thread-num" +#define PORT_ID "port-id" +#define HOTWORD_SEP " " +#define AUDIO_FS "audio-fs" + +// #define VAD_MODEL_PATH "vad-model" +// #define VAD_CMVN_PATH "vad-cmvn" +// #define VAD_CONFIG_PATH "vad-config" +// #define AM_MODEL_PATH "am-model" +// #define AM_CMVN_PATH "am-cmvn" +// #define AM_CONFIG_PATH "am-config" +// #define PUNC_MODEL_PATH "punc-model" +// #define PUNC_CONFIG_PATH "punc-config" + +#define MODEL_NAME "model.onnx" +// hotword embedding compile model +#define MODEL_EB_NAME "model_eb.onnx" +#define QUANT_MODEL_NAME "model_quant.onnx" +#define VAD_CMVN_NAME "am.mvn" +#define VAD_CONFIG_NAME "config.yaml" +#define AM_CMVN_NAME "am.mvn" +#define AM_CONFIG_NAME "config.yaml" +#define LM_CONFIG_NAME "config.yaml" +#define PUNC_CONFIG_NAME "config.yaml" +#define MODEL_SEG_DICT "seg_dict" +#define TOKEN_PATH "tokens.json" +#define HOTWORD "hotword" +// #define NN_HOTWORD "nn-hotword" + +#define ITN_DIR "itn-dir" +#define ITN_TAGGER_NAME "zh_itn_tagger.fst" +#define ITN_VERBALIZER_NAME "zh_itn_verbalizer.fst" + +#define ENCODER_NAME "model.onnx" +#define QUANT_ENCODER_NAME "model_quant.onnx" +#define DECODER_NAME "decoder.onnx" +#define QUANT_DECODER_NAME "decoder_quant.onnx" + +#define LM_FST_RES "TLG.fst" +#define LEX_PATH "lexicon.txt" + +// vad +#ifndef VAD_SILENCE_DURATION +#define VAD_SILENCE_DURATION 800 +#endif + +#ifndef VAD_MAX_LEN +#define VAD_MAX_LEN 15000 +#endif + +#ifndef VAD_SPEECH_NOISE_THRES +#define VAD_SPEECH_NOISE_THRES 0.9 +#endif + +#ifndef VAD_LFR_M +#define VAD_LFR_M 5 +#endif + +#ifndef VAD_LFR_N +#define VAD_LFR_N 1 +#endif + +// asr +#ifndef PARA_LFR_M +#define PARA_LFR_M 7 +#endif + +#ifndef PARA_LFR_N +#define PARA_LFR_N 6 +#endif + +#ifndef ONLINE_STEP +#define ONLINE_STEP 9600 +#endif + +// punc +#define UNK_CHAR "" +#define TOKEN_LEN 20 + +#define CANDIDATE_NUM 6 +#define UNKNOW_INDEX 0 +#define NOTPUNC "_" +#define NOTPUNC_INDEX 1 +#define COMMA_INDEX 2 +#define PERIOD_INDEX 3 +#define QUESTION_INDEX 4 +#define DUN_INDEX 5 +#define CACHE_POP_TRIGGER_LIMIT 200 + +#define JIEBA_DICT "jieba.c.dict" +#define JIEBA_USERDICT "jieba_usr_dict" +#define JIEBA_HMM_MODEL "jieba.hmm" + +} // namespace funasr diff --git a/runtime/onnxruntime/include/funasrruntime.h b/runtime/onnxruntime/include/funasrruntime.h new file mode 100644 index 0000000..cff617f --- /dev/null +++ b/runtime/onnxruntime/include/funasrruntime.h @@ -0,0 +1,131 @@ +#pragma once +#include +#include +#include +#ifdef WIN32 +#ifdef _FUNASR_API_EXPORT +#define _FUNASRAPI __declspec(dllexport) +#else +#define _FUNASRAPI __declspec(dllimport) +#endif +#else +#define _FUNASRAPI +#endif + +#ifndef _WIN32 +#define FUNASR_CALLBCK_PREFIX __attribute__((__stdcall__)) +#else +#define FUNASR_CALLBCK_PREFIX __stdcall +#endif + + +typedef void* FUNASR_HANDLE; +typedef void* FUNASR_RESULT; +typedef void* FUNASR_DEC_HANDLE; +typedef unsigned char FUNASR_BOOL; + +#define FUNASR_TRUE 1 +#define FUNASR_FALSE 0 +#define QM_DEFAULT_THREAD_NUM 4 + +typedef enum +{ + RASR_NONE=-1, + RASRM_CTC_GREEDY_SEARCH=0, + RASRM_CTC_RPEFIX_BEAM_SEARCH = 1, + RASRM_ATTENSION_RESCORING = 2, +}FUNASR_MODE; + +typedef enum { + FUNASR_MODEL_PADDLE = 0, + FUNASR_MODEL_PADDLE_2 = 1, + FUNASR_MODEL_K2 = 2, + FUNASR_MODEL_PARAFORMER = 3, +}FUNASR_MODEL_TYPE; + +typedef enum { + ASR_OFFLINE=0, + ASR_ONLINE=1, + ASR_TWO_PASS=2, +}ASR_TYPE; + +typedef enum { + PUNC_OFFLINE=0, + PUNC_ONLINE=1, +}PUNC_TYPE; + +typedef void (* QM_CALLBACK)(int cur_step, int n_total); // n_total: total steps; cur_step: Current Step. + +// ASR +_FUNASRAPI FUNASR_HANDLE FunASRInit(std::map& model_path, int thread_num, ASR_TYPE type=ASR_OFFLINE); +_FUNASRAPI FUNASR_HANDLE FunASROnlineInit(FUNASR_HANDLE asr_handle, std::vector chunk_size={5,10,5}); +_FUNASRAPI void FunASRReset(FUNASR_HANDLE handle, FUNASR_DEC_HANDLE dec_handle=nullptr); + +// buffer +_FUNASRAPI FUNASR_RESULT FunASRInferBuffer(FUNASR_HANDLE handle, const char* sz_buf, int n_len, FUNASR_MODE mode, QM_CALLBACK fn_callback, bool input_finished=true, int sampling_rate=16000, std::string wav_format="pcm"); +// file, support wav & pcm +_FUNASRAPI FUNASR_RESULT FunASRInfer(FUNASR_HANDLE handle, const char* sz_filename, FUNASR_MODE mode, QM_CALLBACK fn_callback, int sampling_rate=16000); + +_FUNASRAPI const char* FunASRGetResult(FUNASR_RESULT result,int n_index); +_FUNASRAPI const char* FunASRGetStamp(FUNASR_RESULT result); +_FUNASRAPI const char* FunASRGetStampSents(FUNASR_RESULT result); +_FUNASRAPI const char* FunASRGetTpassResult(FUNASR_RESULT result,int n_index); +_FUNASRAPI const int FunASRGetRetNumber(FUNASR_RESULT result); +_FUNASRAPI void FunASRFreeResult(FUNASR_RESULT result); +_FUNASRAPI void FunASRUninit(FUNASR_HANDLE handle); +_FUNASRAPI const float FunASRGetRetSnippetTime(FUNASR_RESULT result); + +// VAD +_FUNASRAPI FUNASR_HANDLE FsmnVadInit(std::map& model_path, int thread_num); +_FUNASRAPI FUNASR_HANDLE FsmnVadOnlineInit(FUNASR_HANDLE fsmnvad_handle); +// buffer +_FUNASRAPI FUNASR_RESULT FsmnVadInferBuffer(FUNASR_HANDLE handle, const char* sz_buf, int n_len, QM_CALLBACK fn_callback, bool input_finished=true, int sampling_rate=16000, std::string wav_format="pcm"); +// file, support wav & pcm +_FUNASRAPI FUNASR_RESULT FsmnVadInfer(FUNASR_HANDLE handle, const char* sz_filename, QM_CALLBACK fn_callback, int sampling_rate=16000); + +_FUNASRAPI std::vector>* FsmnVadGetResult(FUNASR_RESULT result,int n_index); +_FUNASRAPI void FsmnVadFreeResult(FUNASR_RESULT result); +_FUNASRAPI void FsmnVadUninit(FUNASR_HANDLE handle); +_FUNASRAPI const float FsmnVadGetRetSnippetTime(FUNASR_RESULT result); + +// PUNC +_FUNASRAPI FUNASR_HANDLE CTTransformerInit(std::map& model_path, int thread_num, PUNC_TYPE type=PUNC_OFFLINE); +_FUNASRAPI FUNASR_RESULT CTTransformerInfer(FUNASR_HANDLE handle, const char* sz_sentence, FUNASR_MODE mode, QM_CALLBACK fn_callback, PUNC_TYPE type=PUNC_OFFLINE, FUNASR_RESULT pre_result=nullptr); +_FUNASRAPI const char* CTTransformerGetResult(FUNASR_RESULT result,int n_index); +_FUNASRAPI void CTTransformerFreeResult(FUNASR_RESULT result); +_FUNASRAPI void CTTransformerUninit(FUNASR_HANDLE handle); + +//OfflineStream +_FUNASRAPI FUNASR_HANDLE FunOfflineInit(std::map& model_path, int thread_num); +_FUNASRAPI void FunOfflineReset(FUNASR_HANDLE handle, FUNASR_DEC_HANDLE dec_handle=nullptr); +// buffer +_FUNASRAPI FUNASR_RESULT FunOfflineInferBuffer(FUNASR_HANDLE handle, const char* sz_buf, int n_len, + FUNASR_MODE mode, QM_CALLBACK fn_callback, const std::vector> &hw_emb, + int sampling_rate=16000, std::string wav_format="pcm", bool itn=true, FUNASR_DEC_HANDLE dec_handle=nullptr); +// file, support wav & pcm +_FUNASRAPI FUNASR_RESULT FunOfflineInfer(FUNASR_HANDLE handle, const char* sz_filename, FUNASR_MODE mode, + QM_CALLBACK fn_callback, const std::vector> &hw_emb, + int sampling_rate=16000, bool itn=true, FUNASR_DEC_HANDLE dec_handle=nullptr); +#if !defined(__APPLE__) +_FUNASRAPI const std::vector> CompileHotwordEmbedding(FUNASR_HANDLE handle, std::string &hotwords, ASR_TYPE mode=ASR_OFFLINE); +#endif + +_FUNASRAPI void FunOfflineUninit(FUNASR_HANDLE handle); + +//2passStream +_FUNASRAPI FUNASR_HANDLE FunTpassInit(std::map& model_path, int thread_num); +_FUNASRAPI FUNASR_HANDLE FunTpassOnlineInit(FUNASR_HANDLE tpass_handle, std::vector chunk_size={5,10,5}); +// buffer +_FUNASRAPI FUNASR_RESULT FunTpassInferBuffer(FUNASR_HANDLE handle, FUNASR_HANDLE online_handle, const char* sz_buf, + int n_len, std::vector> &punc_cache, bool input_finished=true, + int sampling_rate=16000, std::string wav_format="pcm", ASR_TYPE mode=ASR_TWO_PASS, + const std::vector> &hw_emb={{0.0}}, bool itn=true, FUNASR_DEC_HANDLE dec_handle=nullptr); +_FUNASRAPI void FunTpassUninit(FUNASR_HANDLE handle); +_FUNASRAPI void FunTpassOnlineUninit(FUNASR_HANDLE handle); + +// wfst decoder +_FUNASRAPI FUNASR_DEC_HANDLE FunASRWfstDecoderInit(FUNASR_HANDLE handle, int asr_type, float glob_beam, float lat_beam, float am_scale); +_FUNASRAPI void FunASRWfstDecoderUninit(FUNASR_DEC_HANDLE handle); +_FUNASRAPI void FunWfstDecoderLoadHwsRes(FUNASR_DEC_HANDLE handle, int inc_bias, std::unordered_map &hws_map); +_FUNASRAPI void FunWfstDecoderUnloadHwsRes(FUNASR_DEC_HANDLE handle); + diff --git a/runtime/onnxruntime/include/itn-model.h b/runtime/onnxruntime/include/itn-model.h new file mode 100644 index 0000000..0336cf8 --- /dev/null +++ b/runtime/onnxruntime/include/itn-model.h @@ -0,0 +1,20 @@ + +#ifndef ITN_MODEL_H +#define ITN_MODEL_H + +#include +#include +#include + +namespace funasr { +class ITNModel { + public: + virtual ~ITNModel(){}; + virtual void InitITN(const std::string &itn_tagger, const std::string &itn_verbalizer, int thread_num)=0; + virtual std::string Normalize(const std::string& input){return "";}; +}; + +ITNModel *CreateITNModel(std::map& model_path, int thread_num); + +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/include/model.h b/runtime/onnxruntime/include/model.h new file mode 100644 index 0000000..f5c4027 --- /dev/null +++ b/runtime/onnxruntime/include/model.h @@ -0,0 +1,34 @@ + +#ifndef MODEL_H +#define MODEL_H + +#include +#include +#include "funasrruntime.h" +namespace funasr { +class Model { + public: + virtual ~Model(){}; + virtual void StartUtterance() = 0; + virtual void EndUtterance() = 0; + virtual void Reset() = 0; + virtual void InitAsr(const std::string &am_model, const std::string &am_cmvn, const std::string &am_config, const std::string &token_file, int thread_num){}; + virtual void InitAsr(const std::string &en_model, const std::string &de_model, const std::string &am_cmvn, const std::string &am_config, const std::string &token_file, int thread_num){}; + virtual void InitAsr(const std::string &am_model, const std::string &en_model, const std::string &de_model, const std::string &am_cmvn, const std::string &am_config, const std::string &token_file, int thread_num){}; + virtual void InitLm(const std::string &lm_file, const std::string &lm_config, const std::string &lex_file){}; + virtual void InitFstDecoder(){}; + virtual std::string Forward(float *din, int len, bool input_finished, const std::vector> &hw_emb={{0.0}}, void* wfst_decoder=nullptr){return "";}; + virtual std::string Rescoring() = 0; + virtual void InitHwCompiler(const std::string &hw_model, int thread_num){}; + virtual void InitSegDict(const std::string &seg_dict_model){}; + virtual std::vector> CompileHotwordEmbedding(std::string &hotwords){return std::vector>();}; + virtual std::string GetLang(){return "";}; + virtual int GetAsrSampleRate() = 0; + +}; + +Model *CreateModel(std::map& model_path, int thread_num=1, ASR_TYPE type=ASR_OFFLINE); +Model *CreateModel(void* asr_handle, std::vector chunk_size); + +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/include/offline-stream.h b/runtime/onnxruntime/include/offline-stream.h new file mode 100644 index 0000000..f63de74 --- /dev/null +++ b/runtime/onnxruntime/include/offline-stream.h @@ -0,0 +1,38 @@ +#ifndef OFFLINE_STREAM_H +#define OFFLINE_STREAM_H + +#include +#include +#include +#include "model.h" +#include "punc-model.h" +#include "vad-model.h" +#if !defined(__APPLE__) +#include "itn-model.h" +#endif + +namespace funasr { +class OfflineStream { + public: + OfflineStream(std::map& model_path, int thread_num); + ~OfflineStream(){}; + + std::unique_ptr vad_handle= nullptr; + std::unique_ptr asr_handle= nullptr; + std::unique_ptr punc_handle= nullptr; +#if !defined(__APPLE__) + std::unique_ptr itn_handle = nullptr; +#endif + bool UseVad(){return use_vad;}; + bool UsePunc(){return use_punc;}; + bool UseITN(){return use_itn;}; + + private: + bool use_vad=false; + bool use_punc=false; + bool use_itn=false; +}; + +OfflineStream *CreateOfflineStream(std::map& model_path, int thread_num=1); +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/include/punc-model.h b/runtime/onnxruntime/include/punc-model.h new file mode 100644 index 0000000..3cec2c1 --- /dev/null +++ b/runtime/onnxruntime/include/punc-model.h @@ -0,0 +1,21 @@ + +#ifndef PUNC_MODEL_H +#define PUNC_MODEL_H + +#include +#include +#include +#include "funasrruntime.h" + +namespace funasr { +class PuncModel { + public: + virtual ~PuncModel(){}; + virtual void InitPunc(const std::string &punc_model, const std::string &punc_config, const std::string &token_file, int thread_num)=0; + virtual std::string AddPunc(const char* sz_input, std::string language="zh-cn"){return "";}; + virtual std::string AddPunc(const char* sz_input, std::vector& arr_cache, std::string language="zh-cn"){return "";}; +}; + +PuncModel *CreatePuncModel(std::map& model_path, int thread_num, PUNC_TYPE type=PUNC_OFFLINE); +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/include/tclap/Arg.h b/runtime/onnxruntime/include/tclap/Arg.h new file mode 100644 index 0000000..f8c4a5f --- /dev/null +++ b/runtime/onnxruntime/include/tclap/Arg.h @@ -0,0 +1,683 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: Arg.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno . + * Copyright (c) 2017 Google Inc. + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_ARGUMENT_H +#define TCLAP_ARGUMENT_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace TCLAP { + +/** + * A virtual base class that defines the essential data for all arguments. + * This class, or one of its existing children, must be subclassed to do + * anything. + */ +class Arg +{ + private: + /** + * Prevent accidental copying. + */ + Arg(const Arg& rhs); + + /** + * Prevent accidental copying. + */ + Arg& operator=(const Arg& rhs); + + /** + * Indicates whether the rest of the arguments should be ignored. + */ + static bool& ignoreRestRef() { static bool ign = false; return ign; } + + /** + * The delimiter that separates an argument flag/name from the + * value. + */ + static char& delimiterRef() { static char delim = ' '; return delim; } + + protected: + + /** + * The single char flag used to identify the argument. + * This value (preceded by a dash {-}), can be used to identify + * an argument on the command line. The _flag can be blank, + * in fact this is how unlabeled args work. Unlabeled args must + * override appropriate functions to get correct handling. Note + * that the _flag does NOT include the dash as part of the flag. + */ + std::string _flag; + + /** + * A single word namd identifying the argument. + * This value (preceded by two dashed {--}) can also be used + * to identify an argument on the command line. Note that the + * _name does NOT include the two dashes as part of the _name. The + * _name cannot be blank. + */ + std::string _name; + + /** + * Description of the argument. + */ + std::string _description; + + /** + * Indicating whether the argument is required. + */ + bool _required; + + /** + * Label to be used in usage description. Normally set to + * "required", but can be changed when necessary. + */ + std::string _requireLabel; + + /** + * Indicates whether a value is required for the argument. + * Note that the value may be required but the argument/value + * combination may not be, as specified by _required. + */ + bool _valueRequired; + + /** + * Indicates whether the argument has been set. + * Indicates that a value on the command line has matched the + * name/flag of this argument and the values have been set accordingly. + */ + bool _alreadySet; + + /** + * A pointer to a visitor object. + * The visitor allows special handling to occur as soon as the + * argument is matched. This defaults to NULL and should not + * be used unless absolutely necessary. + */ + Visitor* _visitor; + + /** + * Whether this argument can be ignored, if desired. + */ + bool _ignoreable; + + /** + * Indicates that the arg was set as part of an XOR and not on the + * command line. + */ + bool _xorSet; + + bool _acceptsMultipleValues; + + /** + * Performs the special handling described by the Visitor. + */ + void _checkWithVisitor() const; + + /** + * Primary constructor. YOU (yes you) should NEVER construct an Arg + * directly, this is a base class that is extended by various children + * that are meant to be used. Use SwitchArg, ValueArg, MultiArg, + * UnlabeledValueArg, or UnlabeledMultiArg instead. + * + * \param flag - The flag identifying the argument. + * \param name - The name identifying the argument. + * \param desc - The description of the argument, used in the usage. + * \param req - Whether the argument is required. + * \param valreq - Whether the a value is required for the argument. + * \param v - The visitor checked by the argument. Defaults to NULL. + */ + Arg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + bool valreq, + Visitor* v = NULL ); + + public: + /** + * Destructor. + */ + virtual ~Arg(); + + /** + * Adds this to the specified list of Args. + * \param argList - The list to add this to. + */ + virtual void addToList( std::list& argList ) const; + + /** + * Begin ignoring arguments since the "--" argument was specified. + */ + static void beginIgnoring() { ignoreRestRef() = true; } + + /** + * Whether to ignore the rest. + */ + static bool ignoreRest() { return ignoreRestRef(); } + + /** + * The delimiter that separates an argument flag/name from the + * value. + */ + static char delimiter() { return delimiterRef(); } + + /** + * The char used as a place holder when SwitchArgs are combined. + * Currently set to the bell char (ASCII 7). + */ + static char blankChar() { return (char)7; } + + /** + * The char that indicates the beginning of a flag. Defaults to '-', but + * clients can define TCLAP_FLAGSTARTCHAR to override. + */ +#ifndef TCLAP_FLAGSTARTCHAR +#define TCLAP_FLAGSTARTCHAR '-' +#endif + static char flagStartChar() { return TCLAP_FLAGSTARTCHAR; } + + /** + * The sting that indicates the beginning of a flag. Defaults to "-", but + * clients can define TCLAP_FLAGSTARTSTRING to override. Should be the same + * as TCLAP_FLAGSTARTCHAR. + */ +#ifndef TCLAP_FLAGSTARTSTRING +#define TCLAP_FLAGSTARTSTRING "-" +#endif + static const std::string flagStartString() { return TCLAP_FLAGSTARTSTRING; } + + /** + * The sting that indicates the beginning of a name. Defaults to "--", but + * clients can define TCLAP_NAMESTARTSTRING to override. + */ +#ifndef TCLAP_NAMESTARTSTRING +#define TCLAP_NAMESTARTSTRING "--" +#endif + static const std::string nameStartString() { return TCLAP_NAMESTARTSTRING; } + + /** + * The name used to identify the ignore rest argument. + */ + static const std::string ignoreNameString() { return "ignore_rest"; } + + /** + * Sets the delimiter for all arguments. + * \param c - The character that delimits flags/names from values. + */ + static void setDelimiter( char c ) { delimiterRef() = c; } + + /** + * Pure virtual method meant to handle the parsing and value assignment + * of the string on the command line. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. What is + * passed in from main. + */ + virtual bool processArg(int *i, std::vector& args) = 0; + + /** + * Operator ==. + * Equality operator. Must be virtual to handle unlabeled args. + * \param a - The Arg to be compared to this. + */ + virtual bool operator==(const Arg& a) const; + + /** + * Returns the argument flag. + */ + const std::string& getFlag() const; + + /** + * Returns the argument name. + */ + const std::string& getName() const; + + /** + * Returns the argument description. + */ + std::string getDescription() const; + + /** + * Indicates whether the argument is required. + */ + virtual bool isRequired() const; + + /** + * Sets _required to true. This is used by the XorHandler. + * You really have no reason to ever use it. + */ + void forceRequired(); + + /** + * Sets the _alreadySet value to true. This is used by the XorHandler. + * You really have no reason to ever use it. + */ + void xorSet(); + + /** + * Indicates whether a value must be specified for argument. + */ + bool isValueRequired() const; + + /** + * Indicates whether the argument has already been set. Only true + * if the arg has been matched on the command line. + */ + bool isSet() const; + + /** + * Indicates whether the argument can be ignored, if desired. + */ + bool isIgnoreable() const; + + /** + * A method that tests whether a string matches this argument. + * This is generally called by the processArg() method. This + * method could be re-implemented by a child to change how + * arguments are specified on the command line. + * \param s - The string to be compared to the flag/name to determine + * whether the arg matches. + */ + virtual bool argMatches( const std::string& s ) const; + + /** + * Returns a simple string representation of the argument. + * Primarily for debugging. + */ + virtual std::string toString() const; + + /** + * Returns a short ID for the usage. + * \param valueId - The value used in the id. + */ + virtual std::string shortID( const std::string& valueId = "val" ) const; + + /** + * Returns a long ID for the usage. + * \param valueId - The value used in the id. + */ + virtual std::string longID( const std::string& valueId = "val" ) const; + + /** + * Trims a value off of the flag. + * \param flag - The string from which the flag and value will be + * trimmed. Contains the flag once the value has been trimmed. + * \param value - Where the value trimmed from the string will + * be stored. + */ + virtual void trimFlag( std::string& flag, std::string& value ) const; + + /** + * Checks whether a given string has blank chars, indicating that + * it is a combined SwitchArg. If so, return true, otherwise return + * false. + * \param s - string to be checked. + */ + bool _hasBlanks( const std::string& s ) const; + + /** + * Sets the requireLabel. Used by XorHandler. You shouldn't ever + * use this. + * \param s - Set the requireLabel to this value. + */ + void setRequireLabel( const std::string& s ); + + /** + * Used for MultiArgs and XorHandler to determine whether args + * can still be set. + */ + virtual bool allowMore(); + + /** + * Use by output classes to determine whether an Arg accepts + * multiple values. + */ + virtual bool acceptsMultipleValues(); + + /** + * Clears the Arg object and allows it to be reused by new + * command lines. + */ + virtual void reset(); +}; + +/** + * Typedef of an Arg list iterator. + */ +typedef std::list::const_iterator ArgListIterator; + +/** + * Typedef of an Arg vector iterator. + */ +typedef std::vector::const_iterator ArgVectorIterator; + +/** + * Typedef of a Visitor list iterator. + */ +typedef std::list::const_iterator VisitorListIterator; + +/* + * Extract a value of type T from it's string representation contained + * in strVal. The ValueLike parameter used to select the correct + * specialization of ExtractValue depending on the value traits of T. + * ValueLike traits use operator>> to assign the value from strVal. + */ +template void +ExtractValue(T &destVal, const std::string& strVal, ValueLike vl) +{ + static_cast(vl); // Avoid warning about unused vl + istringstream is(strVal.c_str()); + + int valuesRead = 0; + while ( is.good() ) { + if ( is.peek() != EOF ) +#ifdef TCLAP_SETBASE_ZERO + is >> std::setbase(0) >> destVal; +#else + is >> destVal; +#endif + else + break; + + valuesRead++; + } + + if ( is.fail() ) + throw( ArgParseException("Couldn't read argument value " + "from string '" + strVal + "'")); + + + if ( valuesRead > 1 ) + throw( ArgParseException("More than one valid value parsed from " + "string '" + strVal + "'")); + +} + +/* + * Extract a value of type T from it's string representation contained + * in strVal. The ValueLike parameter used to select the correct + * specialization of ExtractValue depending on the value traits of T. + * StringLike uses assignment (operator=) to assign from strVal. + */ +template void +ExtractValue(T &destVal, const std::string& strVal, StringLike sl) +{ + static_cast(sl); // Avoid warning about unused sl + SetString(destVal, strVal); +} + +////////////////////////////////////////////////////////////////////// +//BEGIN Arg.cpp +////////////////////////////////////////////////////////////////////// + +inline Arg::Arg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + bool valreq, + Visitor* v) : + _flag(flag), + _name(name), + _description(desc), + _required(req), + _requireLabel("required"), + _valueRequired(valreq), + _alreadySet(false), + _visitor( v ), + _ignoreable(true), + _xorSet(false), + _acceptsMultipleValues(false) +{ + if ( _flag.length() > 1 ) + throw(SpecificationException( + "Argument flag can only be one character long", toString() ) ); + + if ( _name != ignoreNameString() && + ( _flag == Arg::flagStartString() || + _flag == Arg::nameStartString() || + _flag == " " ) ) + throw(SpecificationException("Argument flag cannot be either '" + + Arg::flagStartString() + "' or '" + + Arg::nameStartString() + "' or a space.", + toString() ) ); + + if ( ( _name.substr( 0, Arg::flagStartString().length() ) == Arg::flagStartString() ) || + ( _name.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) || + ( _name.find( " ", 0 ) != std::string::npos ) ) + throw(SpecificationException("Argument name begin with either '" + + Arg::flagStartString() + "' or '" + + Arg::nameStartString() + "' or space.", + toString() ) ); + +} + +inline Arg::~Arg() { } + +inline std::string Arg::shortID( const std::string& valueId ) const +{ + std::string id = ""; + + if ( _flag != "" ) + id = Arg::flagStartString() + _flag; + else + id = Arg::nameStartString() + _name; + + if ( _valueRequired ) + id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; + + if ( !_required ) + id = "[" + id + "]"; + + return id; +} + +inline std::string Arg::longID( const std::string& valueId ) const +{ + std::string id = ""; + + if ( _flag != "" ) + { + id += Arg::flagStartString() + _flag; + + if ( _valueRequired ) + id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; + + id += ", "; + } + + id += Arg::nameStartString() + _name; + + if ( _valueRequired ) + id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; + + return id; + +} + +inline bool Arg::operator==(const Arg& a) const +{ + if ( ( _flag != "" && _flag == a._flag ) || _name == a._name) + return true; + else + return false; +} + +inline std::string Arg::getDescription() const +{ + std::string desc = ""; + if ( _required ) + desc = "(" + _requireLabel + ") "; + +// if ( _valueRequired ) +// desc += "(value required) "; + + desc += _description; + return desc; +} + +inline const std::string& Arg::getFlag() const { return _flag; } + +inline const std::string& Arg::getName() const { return _name; } + +inline bool Arg::isRequired() const { return _required; } + +inline bool Arg::isValueRequired() const { return _valueRequired; } + +inline bool Arg::isSet() const +{ + if ( _alreadySet && !_xorSet ) + return true; + else + return false; +} + +inline bool Arg::isIgnoreable() const { return _ignoreable; } + +inline void Arg::setRequireLabel( const std::string& s) +{ + _requireLabel = s; +} + +inline bool Arg::argMatches( const std::string& argFlag ) const +{ + if ( ( argFlag == Arg::flagStartString() + _flag && _flag != "" ) || + argFlag == Arg::nameStartString() + _name ) + return true; + else + return false; +} + +inline std::string Arg::toString() const +{ + std::string s = ""; + + if ( _flag != "" ) + s += Arg::flagStartString() + _flag + " "; + + s += "(" + Arg::nameStartString() + _name + ")"; + + return s; +} + +inline void Arg::_checkWithVisitor() const +{ + if ( _visitor != NULL ) + _visitor->visit(); +} + +/** + * Implementation of trimFlag. + */ +inline void Arg::trimFlag(std::string& flag, std::string& value) const +{ + int stop = 0; + for ( int i = 0; static_cast(i) < flag.length(); i++ ) + if ( flag[i] == Arg::delimiter() ) + { + stop = i; + break; + } + + if ( stop > 1 ) + { + value = flag.substr(stop+1); + flag = flag.substr(0,stop); + } + +} + +/** + * Implementation of _hasBlanks. + */ +inline bool Arg::_hasBlanks( const std::string& s ) const +{ + for ( int i = 1; static_cast(i) < s.length(); i++ ) + if ( s[i] == Arg::blankChar() ) + return true; + + return false; +} + +inline void Arg::forceRequired() +{ + _required = true; +} + +inline void Arg::xorSet() +{ + _alreadySet = true; + _xorSet = true; +} + +/** + * Overridden by Args that need to added to the end of the list. + */ +inline void Arg::addToList( std::list& argList ) const +{ + argList.push_front( const_cast(this) ); +} + +inline bool Arg::allowMore() +{ + return false; +} + +inline bool Arg::acceptsMultipleValues() +{ + return _acceptsMultipleValues; +} + +inline void Arg::reset() +{ + _xorSet = false; + _alreadySet = false; +} + +////////////////////////////////////////////////////////////////////// +//END Arg.cpp +////////////////////////////////////////////////////////////////////// + +} //namespace TCLAP + +#endif + diff --git a/runtime/onnxruntime/include/tclap/ArgException.h b/runtime/onnxruntime/include/tclap/ArgException.h new file mode 100644 index 0000000..1e0f659 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/ArgException.h @@ -0,0 +1,213 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: ArgException.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2017 Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_ARG_EXCEPTION_H +#define TCLAP_ARG_EXCEPTION_H + +#include +#include + +namespace TCLAP { + +/** + * A simple class that defines and argument exception. Should be caught + * whenever a CmdLine is created and parsed. + */ +class ArgException : public std::exception +{ + public: + + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source. + * \param td - Text describing the type of ArgException it is. + * of the exception. + */ + ArgException( const std::string& text = "undefined exception", + const std::string& id = "undefined", + const std::string& td = "Generic ArgException") + : std::exception(), + _errorText(text), + _argId( id ), + _typeDescription(td) + { } + + /** + * Destructor. + */ + virtual ~ArgException() throw() { } + + /** + * Returns the error text. + */ + std::string error() const { return ( _errorText ); } + + /** + * Returns the argument id. + */ + std::string argId() const + { + if ( _argId == "undefined" ) + return " "; + else + return ( "Argument: " + _argId ); + } + + /** + * Returns the arg id and error text. + */ + const char* what() const throw() + { + static std::string ex; + ex = _argId + " -- " + _errorText; + return ex.c_str(); + } + + /** + * Returns the type of the exception. Used to explain and distinguish + * between different child exceptions. + */ + std::string typeDescription() const + { + return _typeDescription; + } + + + private: + + /** + * The text of the exception message. + */ + std::string _errorText; + + /** + * The argument related to this exception. + */ + std::string _argId; + + /** + * Describes the type of the exception. Used to distinguish + * between different child exceptions. + */ + std::string _typeDescription; + +}; + +/** + * Thrown from within the child Arg classes when it fails to properly + * parse the argument it has been passed. + */ +class ArgParseException : public ArgException +{ + public: + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source + * of the exception. + */ + ArgParseException( const std::string& text = "undefined exception", + const std::string& id = "undefined" ) + : ArgException( text, + id, + std::string( "Exception found while parsing " ) + + std::string( "the value the Arg has been passed." )) + { } +}; + +/** + * Thrown from CmdLine when the arguments on the command line are not + * properly specified, e.g. too many arguments, required argument missing, etc. + */ +class CmdLineParseException : public ArgException +{ + public: + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source + * of the exception. + */ + CmdLineParseException( const std::string& text = "undefined exception", + const std::string& id = "undefined" ) + : ArgException( text, + id, + std::string( "Exception found when the values ") + + std::string( "on the command line do not meet ") + + std::string( "the requirements of the defined ") + + std::string( "Args." )) + { } +}; + +/** + * Thrown from Arg and CmdLine when an Arg is improperly specified, e.g. + * same flag as another Arg, same name, etc. + */ +class SpecificationException : public ArgException +{ + public: + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source + * of the exception. + */ + SpecificationException( const std::string& text = "undefined exception", + const std::string& id = "undefined" ) + : ArgException( text, + id, + std::string("Exception found when an Arg object ")+ + std::string("is improperly defined by the ") + + std::string("developer." )) + { } + +}; + +/** + * Thrown when TCLAP thinks the program should exit. + * + * For example after parse error this exception will be thrown (and + * normally caught). This allows any resource to be clened properly + * before exit. + * + * If exception handling is disabled (CmdLine::setExceptionHandling), + * this exception will propagate to the call site, allowing the + * program to catch it and avoid program termination, or do it's own + * cleanup. See for example, https://sourceforge.net/p/tclap/bugs/29. + */ +class ExitException { +public: + ExitException(int estat) : _estat(estat) {} + + int getExitStatus() const { return _estat; } + +private: + int _estat; +}; + +} // namespace TCLAP + +#endif + diff --git a/runtime/onnxruntime/include/tclap/ArgTraits.h b/runtime/onnxruntime/include/tclap/ArgTraits.h new file mode 100644 index 0000000..0ccf5e3 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/ArgTraits.h @@ -0,0 +1,122 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: ArgTraits.h + * + * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot . + * Copyright (c) 2017 Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +// This is an internal tclap file, you should probably not have to +// include this directly + +#ifndef TCLAP_ARGTRAITS_H +#define TCLAP_ARGTRAITS_H + +namespace TCLAP { + +// We use two empty structs to get compile type specialization +// function to work + +/** + * A value like argument value type is a value that can be set using + * operator>>. This is the default value type. + */ +struct ValueLike { + typedef ValueLike ValueCategory; + virtual ~ValueLike() {} +}; + +/** + * A string like argument value type is a value that can be set using + * operator=(string). Useful if the value type contains spaces which + * will be broken up into individual tokens by operator>>. + */ +struct StringLike { + virtual ~StringLike() {} +}; + +/** + * A class can inherit from this object to make it have string like + * traits. This is a compile time thing and does not add any overhead + * to the inherenting class. + */ +struct StringLikeTrait { + typedef StringLike ValueCategory; + virtual ~StringLikeTrait() {} +}; + +/** + * A class can inherit from this object to make it have value like + * traits. This is a compile time thing and does not add any overhead + * to the inherenting class. + */ +struct ValueLikeTrait { + typedef ValueLike ValueCategory; + virtual ~ValueLikeTrait() {} +}; + +/** + * Arg traits are used to get compile type specialization when parsing + * argument values. Using an ArgTraits you can specify the way that + * values gets assigned to any particular type during parsing. The two + * supported types are StringLike and ValueLike. ValueLike is the + * default and means that operator>> will be used to assign values to + * the type. + */ +template +class ArgTraits { + // This is a bit silly, but what we want to do is: + // 1) If there exists a specialization of ArgTraits for type X, + // use it. + // + // 2) If no specialization exists but X has the typename + // X::ValueCategory, use the specialization for X::ValueCategory. + // + // 3) If neither (1) nor (2) defines the trait, use the default + // which is ValueLike. + + // This is the "how": + // + // test(0) (where 0 is the NULL ptr) will match + // test(typename C::ValueCategory*) iff type T has the + // corresponding typedef. If it does not test(...) will be + // matched. This allows us to determine if T::ValueCategory + // exists by checking the sizeof for the test function (return + // value must have different sizeof). + template static short test(typename C::ValueCategory*); + template static long test(...); + static const bool hasTrait = sizeof(test(0)) == sizeof(short); + + template + struct DefaultArgTrait { + typedef ValueLike ValueCategory; + }; + + template + struct DefaultArgTrait { + typedef typename C::ValueCategory ValueCategory; + }; + +public: + typedef typename DefaultArgTrait::ValueCategory ValueCategory; +}; + +} // namespace + +#endif + diff --git a/runtime/onnxruntime/include/tclap/CmdLine.h b/runtime/onnxruntime/include/tclap/CmdLine.h new file mode 100644 index 0000000..dc49bae --- /dev/null +++ b/runtime/onnxruntime/include/tclap/CmdLine.h @@ -0,0 +1,657 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: CmdLine.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_CMDLINE_H +#define TCLAP_CMDLINE_H + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include // Needed for exit(), which isn't defined in some envs. + +namespace TCLAP { + +template void DelPtr(T ptr) +{ + delete ptr; +} + +template void ClearContainer(C &c) +{ + typedef typename C::value_type value_type; + std::for_each(c.begin(), c.end(), DelPtr); + c.clear(); +} + + +/** + * The base class that manages the command line definition and passes + * along the parsing to the appropriate Arg classes. + */ +class CmdLine : public CmdLineInterface +{ + protected: + + /** + * The list of arguments that will be tested against the + * command line. + */ + std::list _argList; + + /** + * The name of the program. Set to argv[0]. + */ + std::string _progName; + + /** + * A message used to describe the program. Used in the usage output. + */ + std::string _message; + + /** + * The version to be displayed with the --version switch. + */ + std::string _version; + + /** + * The number of arguments that are required to be present on + * the command line. This is set dynamically, based on the + * Args added to the CmdLine object. + */ + int _numRequired; + + /** + * The character that is used to separate the argument flag/name + * from the value. Defaults to ' ' (space). + */ + char _delimiter; + + /** + * The handler that manages xoring lists of args. + */ + XorHandler _xorHandler; + + /** + * A list of Args to be explicitly deleted when the destructor + * is called. At the moment, this only includes the three default + * Args. + */ + std::list _argDeleteOnExitList; + + /** + * A list of Visitors to be explicitly deleted when the destructor + * is called. At the moment, these are the Visitors created for the + * default Args. + */ + std::list _visitorDeleteOnExitList; + + /** + * Object that handles all output for the CmdLine. + */ + CmdLineOutput* _output; + + /** + * Should CmdLine handle parsing exceptions internally? + */ + bool _handleExceptions; + + /** + * Throws an exception listing the missing args. + */ + void missingArgsException(); + + /** + * Checks whether a name/flag string matches entirely matches + * the Arg::blankChar. Used when multiple switches are combined + * into a single argument. + * \param s - The message to be used in the usage. + */ + bool _emptyCombined(const std::string& s); + + /** + * Perform a delete ptr; operation on ptr when this object is deleted. + */ + void deleteOnExit(Arg* ptr); + + /** + * Perform a delete ptr; operation on ptr when this object is deleted. + */ + void deleteOnExit(Visitor* ptr); + +private: + + /** + * Prevent accidental copying. + */ + CmdLine(const CmdLine& rhs); + CmdLine& operator=(const CmdLine& rhs); + + /** + * Encapsulates the code common to the constructors + * (which is all of it). + */ + void _constructor(); + + + /** + * Is set to true when a user sets the output object. We use this so + * that we don't delete objects that are created outside of this lib. + */ + bool _userSetOutput; + + /** + * Whether or not to automatically create help and version switches. + */ + bool _helpAndVersion; + + /** + * Whether or not to ignore unmatched args. + */ + bool _ignoreUnmatched; + + public: + + /** + * Command line constructor. Defines how the arguments will be + * parsed. + * \param message - The message to be used in the usage + * output. + * \param delimiter - The character that is used to separate + * the argument flag/name from the value. Defaults to ' ' (space). + * \param version - The version number to be used in the + * --version switch. + * \param helpAndVersion - Whether or not to create the Help and + * Version switches. Defaults to true. + */ + CmdLine(const std::string& message, + const char delimiter = ' ', + const std::string& version = "none", + bool helpAndVersion = true); + + /** + * Deletes any resources allocated by a CmdLine object. + */ + virtual ~CmdLine(); + + /** + * Adds an argument to the list of arguments to be parsed. + * \param a - Argument to be added. + */ + void add( Arg& a ); + + /** + * An alternative add. Functionally identical. + * \param a - Argument to be added. + */ + void add( Arg* a ); + + /** + * Add two Args that will be xor'd. If this method is used, add does + * not need to be called. + * \param a - Argument to be added and xor'd. + * \param b - Argument to be added and xor'd. + */ + void xorAdd( Arg& a, Arg& b ); + + /** + * Add a list of Args that will be xor'd. If this method is used, + * add does not need to be called. + * \param xors - List of Args to be added and xor'd. + */ + void xorAdd( const std::vector& xors ); + + /** + * Parses the command line. + * \param argc - Number of arguments. + * \param argv - Array of arguments. + */ + void parse(int argc, const char * const * argv); + + /** + * Parses the command line. + * \param args - A vector of strings representing the args. + * args[0] is still the program name. + */ + void parse(std::vector& args); + + /** + * + */ + CmdLineOutput* getOutput(); + + /** + * + */ + void setOutput(CmdLineOutput* co); + + /** + * + */ + std::string& getVersion(); + + /** + * + */ + std::string& getProgramName(); + + /** + * + */ + std::list& getArgList(); + + /** + * + */ + XorHandler& getXorHandler(); + + /** + * + */ + char getDelimiter(); + + /** + * + */ + std::string& getMessage(); + + /** + * + */ + bool hasHelpAndVersion(); + + /** + * Disables or enables CmdLine's internal parsing exception handling. + * + * @param state Should CmdLine handle parsing exceptions internally? + */ + void setExceptionHandling(const bool state); + + /** + * Returns the current state of the internal exception handling. + * + * @retval true Parsing exceptions are handled internally. + * @retval false Parsing exceptions are propagated to the caller. + */ + bool getExceptionHandling() const; + + /** + * Allows the CmdLine object to be reused. + */ + void reset(); + + /** + * Allows unmatched args to be ignored. By default false. + * + * @param ignore If true the cmdline will ignore any unmatched args + * and if false it will behave as normal. + */ + void ignoreUnmatched(const bool ignore); +}; + + +/////////////////////////////////////////////////////////////////////////////// +//Begin CmdLine.cpp +/////////////////////////////////////////////////////////////////////////////// + +inline CmdLine::CmdLine(const std::string& m, + char delim, + const std::string& v, + bool help ) + : + _argList(std::list()), + _progName("not_set_yet"), + _message(m), + _version(v), + _numRequired(0), + _delimiter(delim), + _xorHandler(XorHandler()), + _argDeleteOnExitList(std::list()), + _visitorDeleteOnExitList(std::list()), + _output(0), + _handleExceptions(true), + _userSetOutput(false), + _helpAndVersion(help), + _ignoreUnmatched(false) +{ + _constructor(); +} + +inline CmdLine::~CmdLine() +{ + ClearContainer(_argDeleteOnExitList); + ClearContainer(_visitorDeleteOnExitList); + + if ( !_userSetOutput ) { + delete _output; + _output = 0; + } +} + +inline void CmdLine::_constructor() +{ + _output = new StdOutput; + + Arg::setDelimiter( _delimiter ); + + Visitor* v; + + if ( _helpAndVersion ) + { + v = new HelpVisitor( this, &_output ); + SwitchArg* help = new SwitchArg("h","help", + "Displays usage information and exits.", + false, v); + add( help ); + deleteOnExit(help); + deleteOnExit(v); + + v = new VersionVisitor( this, &_output ); + SwitchArg* vers = new SwitchArg("","version", + "Displays version information and exits.", + false, v); + add( vers ); + deleteOnExit(vers); + deleteOnExit(v); + } + + v = new IgnoreRestVisitor(); + SwitchArg* ignore = new SwitchArg(Arg::flagStartString(), + Arg::ignoreNameString(), + "Ignores the rest of the labeled arguments following this flag.", + false, v); + add( ignore ); + deleteOnExit(ignore); + deleteOnExit(v); +} + +inline void CmdLine::xorAdd( const std::vector& ors ) +{ + _xorHandler.add( ors ); + + for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++) + { + (*it)->forceRequired(); + (*it)->setRequireLabel( "OR required" ); + add( *it ); + } +} + +inline void CmdLine::xorAdd( Arg& a, Arg& b ) +{ + std::vector ors; + ors.push_back( &a ); + ors.push_back( &b ); + xorAdd( ors ); +} + +inline void CmdLine::add( Arg& a ) +{ + add( &a ); +} + +inline void CmdLine::add( Arg* a ) +{ + for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ ) + if ( *a == *(*it) ) + throw( SpecificationException( + "Argument with same flag/name already exists!", + a->longID() ) ); + + a->addToList( _argList ); + + if ( a->isRequired() ) + _numRequired++; +} + + +inline void CmdLine::parse(int argc, const char * const * argv) +{ + // this step is necessary so that we have easy access to + // mutable strings. + std::vector args; + for (int i = 0; i < argc; i++) + args.push_back(argv[i]); + + parse(args); +} + +inline void CmdLine::parse(std::vector& args) +{ + bool shouldExit = false; + int estat = 0; + try { + if (args.empty()) { + // https://sourceforge.net/p/tclap/bugs/30/ + throw CmdLineParseException("The args vector must not be empty, " + "the first entry should contain the " + "program's name."); + } + + _progName = args.front(); + args.erase(args.begin()); + + int requiredCount = 0; + + for (int i = 0; static_cast(i) < args.size(); i++) + { + bool matched = false; + for (ArgListIterator it = _argList.begin(); + it != _argList.end(); it++) { + if ( (*it)->processArg( &i, args ) ) + { + requiredCount += _xorHandler.check( *it ); + matched = true; + break; + } + } + + // checks to see if the argument is an empty combined + // switch and if so, then we've actually matched it + if ( !matched && _emptyCombined( args[i] ) ) + matched = true; + + if ( !matched && !Arg::ignoreRest() && !_ignoreUnmatched) + throw(CmdLineParseException("Couldn't find match " + "for argument", + args[i])); + } + + if ( requiredCount < _numRequired ) + missingArgsException(); + + if ( requiredCount > _numRequired ) + throw(CmdLineParseException("Too many arguments!")); + + } catch ( ArgException& e ) { + // If we're not handling the exceptions, rethrow. + if ( !_handleExceptions) { + throw; + } + + try { + _output->failure(*this,e); + } catch ( ExitException &ee ) { + estat = ee.getExitStatus(); + shouldExit = true; + } + } catch (ExitException &ee) { + // If we're not handling the exceptions, rethrow. + if ( !_handleExceptions) { + throw; + } + + estat = ee.getExitStatus(); + shouldExit = true; + } + + if (shouldExit) + exit(estat); +} + +inline bool CmdLine::_emptyCombined(const std::string& s) +{ + if ( s.length() > 0 && s[0] != Arg::flagStartChar() ) + return false; + + for ( int i = 1; static_cast(i) < s.length(); i++ ) + if ( s[i] != Arg::blankChar() ) + return false; + + return true; +} + +inline void CmdLine::missingArgsException() +{ + int count = 0; + + std::string missingArgList; + for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++) + { + if ( (*it)->isRequired() && !(*it)->isSet() ) + { + missingArgList += (*it)->getName(); + missingArgList += ", "; + count++; + } + } + missingArgList = missingArgList.substr(0,missingArgList.length()-2); + + std::string msg; + if ( count > 1 ) + msg = "Required arguments missing: "; + else + msg = "Required argument missing: "; + + msg += missingArgList; + + throw(CmdLineParseException(msg)); +} + +inline void CmdLine::deleteOnExit(Arg* ptr) +{ + _argDeleteOnExitList.push_back(ptr); +} + +inline void CmdLine::deleteOnExit(Visitor* ptr) +{ + _visitorDeleteOnExitList.push_back(ptr); +} + +inline CmdLineOutput* CmdLine::getOutput() +{ + return _output; +} + +inline void CmdLine::setOutput(CmdLineOutput* co) +{ + if ( !_userSetOutput ) + delete _output; + _userSetOutput = true; + _output = co; +} + +inline std::string& CmdLine::getVersion() +{ + return _version; +} + +inline std::string& CmdLine::getProgramName() +{ + return _progName; +} + +inline std::list& CmdLine::getArgList() +{ + return _argList; +} + +inline XorHandler& CmdLine::getXorHandler() +{ + return _xorHandler; +} + +inline char CmdLine::getDelimiter() +{ + return _delimiter; +} + +inline std::string& CmdLine::getMessage() +{ + return _message; +} + +inline bool CmdLine::hasHelpAndVersion() +{ + return _helpAndVersion; +} + +inline void CmdLine::setExceptionHandling(const bool state) +{ + _handleExceptions = state; +} + +inline bool CmdLine::getExceptionHandling() const +{ + return _handleExceptions; +} + +inline void CmdLine::reset() +{ + for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ ) + (*it)->reset(); + + _progName.clear(); +} + +inline void CmdLine::ignoreUnmatched(const bool ignore) +{ + _ignoreUnmatched = ignore; +} + +/////////////////////////////////////////////////////////////////////////////// +//End CmdLine.cpp +/////////////////////////////////////////////////////////////////////////////// + + + +} //namespace TCLAP +#endif diff --git a/runtime/onnxruntime/include/tclap/CmdLineInterface.h b/runtime/onnxruntime/include/tclap/CmdLineInterface.h new file mode 100644 index 0000000..a9bdca0 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/CmdLineInterface.h @@ -0,0 +1,153 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: CmdLineInterface.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_COMMANDLINE_INTERFACE_H +#define TCLAP_COMMANDLINE_INTERFACE_H + +#include +#include +#include +#include +#include + + +namespace TCLAP { + +class Arg; +class CmdLineOutput; +class XorHandler; + +/** + * The base class that manages the command line definition and passes + * along the parsing to the appropriate Arg classes. + */ +class CmdLineInterface +{ + public: + + /** + * Destructor + */ + virtual ~CmdLineInterface() {} + + /** + * Adds an argument to the list of arguments to be parsed. + * \param a - Argument to be added. + */ + virtual void add( Arg& a )=0; + + /** + * An alternative add. Functionally identical. + * \param a - Argument to be added. + */ + virtual void add( Arg* a )=0; + + /** + * Add two Args that will be xor'd. + * If this method is used, add does + * not need to be called. + * \param a - Argument to be added and xor'd. + * \param b - Argument to be added and xor'd. + */ + virtual void xorAdd( Arg& a, Arg& b )=0; + + /** + * Add a list of Args that will be xor'd. If this method is used, + * add does not need to be called. + * \param xors - List of Args to be added and xor'd. + */ + virtual void xorAdd( const std::vector& xors )=0; + + /** + * Parses the command line. + * \param argc - Number of arguments. + * \param argv - Array of arguments. + */ + virtual void parse(int argc, const char * const * argv)=0; + + /** + * Parses the command line. + * \param args - A vector of strings representing the args. + * args[0] is still the program name. + */ + void parse(std::vector& args); + + /** + * Returns the CmdLineOutput object. + */ + virtual CmdLineOutput* getOutput()=0; + + /** + * \param co - CmdLineOutput object that we want to use instead. + */ + virtual void setOutput(CmdLineOutput* co)=0; + + /** + * Returns the version string. + */ + virtual std::string& getVersion()=0; + + /** + * Returns the program name string. + */ + virtual std::string& getProgramName()=0; + + /** + * Returns the argList. + */ + virtual std::list& getArgList()=0; + + /** + * Returns the XorHandler. + */ + virtual XorHandler& getXorHandler()=0; + + /** + * Returns the delimiter string. + */ + virtual char getDelimiter()=0; + + /** + * Returns the message string. + */ + virtual std::string& getMessage()=0; + + /** + * Indicates whether or not the help and version switches were created + * automatically. + */ + virtual bool hasHelpAndVersion()=0; + + /** + * Resets the instance as if it had just been constructed so that the + * instance can be reused. + */ + virtual void reset()=0; +}; + +} //namespace + + +#endif diff --git a/runtime/onnxruntime/include/tclap/CmdLineOutput.h b/runtime/onnxruntime/include/tclap/CmdLineOutput.h new file mode 100644 index 0000000..cbc9a32 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/CmdLineOutput.h @@ -0,0 +1,77 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + + +/****************************************************************************** + * + * file: CmdLineOutput.h + * + * Copyright (c) 2004, Michael E. Smoot + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_CMDLINEOUTPUT_H +#define TCLAP_CMDLINEOUTPUT_H + +#include +#include +#include +#include +#include +#include + +namespace TCLAP { + +class CmdLineInterface; +class ArgException; + +/** + * The interface that any output object must implement. + */ +class CmdLineOutput +{ + + public: + + /** + * Virtual destructor. + */ + virtual ~CmdLineOutput() {} + + /** + * Generates some sort of output for the USAGE. + * \param c - The CmdLine object the output is generated for. + */ + virtual void usage(CmdLineInterface& c)=0; + + /** + * Generates some sort of output for the version. + * \param c - The CmdLine object the output is generated for. + */ + virtual void version(CmdLineInterface& c)=0; + + /** + * Generates some sort of output for a failure. + * \param c - The CmdLine object the output is generated for. + * \param e - The ArgException that caused the failure. + */ + virtual void failure( CmdLineInterface& c, + ArgException& e )=0; + +}; + +} //namespace TCLAP +#endif diff --git a/runtime/onnxruntime/include/tclap/Constraint.h b/runtime/onnxruntime/include/tclap/Constraint.h new file mode 100644 index 0000000..ff869cc --- /dev/null +++ b/runtime/onnxruntime/include/tclap/Constraint.h @@ -0,0 +1,78 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: Constraint.h + * + * Copyright (c) 2005, Michael E. Smoot + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_CONSTRAINT_H +#define TCLAP_CONSTRAINT_H + +#include +#include +#include +#include +#include +#include +#include + +namespace TCLAP { + +/** + * The interface that defines the interaction between the Arg and Constraint. + */ +template +class Constraint +{ + + public: + /** + * Returns a description of the Constraint. + */ + virtual std::string description() const =0; + + /** + * Returns the short ID for the Constraint. + */ + virtual std::string shortID() const =0; + + /** + * The method used to verify that the value parsed from the command + * line meets the constraint. + * \param value - The value that will be checked. + */ + virtual bool check(const T& value) const =0; + + /** + * Destructor. + * Silences warnings about Constraint being a base class with virtual + * functions but without a virtual destructor. + */ + virtual ~Constraint() { ; } + + static std::string shortID(Constraint *constraint) { + if (!constraint) + throw std::logic_error("Cannot create a ValueArg with a NULL constraint"); + return constraint->shortID(); + } +}; + +} //namespace TCLAP +#endif diff --git a/runtime/onnxruntime/include/tclap/DocBookOutput.h b/runtime/onnxruntime/include/tclap/DocBookOutput.h new file mode 100644 index 0000000..80b10e5 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/DocBookOutput.h @@ -0,0 +1,303 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: DocBookOutput.h + * + * Copyright (c) 2004, Michael E. Smoot + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_DOCBOOKOUTPUT_H +#define TCLAP_DOCBOOKOUTPUT_H + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace TCLAP { + +/** + * A class that generates DocBook output for usage() method for the + * given CmdLine and its Args. + */ +class DocBookOutput : public CmdLineOutput +{ + + public: + + /** + * Prints the usage to stdout. Can be overridden to + * produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void usage(CmdLineInterface& c); + + /** + * Prints the version to stdout. Can be overridden + * to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void version(CmdLineInterface& c); + + /** + * Prints (to stderr) an error message, short usage + * Can be overridden to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + * \param e - The ArgException that caused the failure. + */ + virtual void failure(CmdLineInterface& c, + ArgException& e ); + + DocBookOutput() : theDelimiter('=') {} + protected: + + /** + * Substitutes the char r for string x in string s. + * \param s - The string to operate on. + * \param r - The char to replace. + * \param x - What to replace r with. + */ + void substituteSpecialChars( std::string& s, char r, std::string& x ); + void removeChar( std::string& s, char r); + void basename( std::string& s ); + + void printShortArg(Arg* it); + void printLongArg(Arg* it); + + char theDelimiter; +}; + + +inline void DocBookOutput::version(CmdLineInterface& _cmd) +{ + std::cout << _cmd.getVersion() << std::endl; +} + +inline void DocBookOutput::usage(CmdLineInterface& _cmd ) +{ + std::list argList = _cmd.getArgList(); + std::string progName = _cmd.getProgramName(); + std::string xversion = _cmd.getVersion(); + theDelimiter = _cmd.getDelimiter(); + XorHandler xorHandler = _cmd.getXorHandler(); + const std::vector< std::vector > xorList = xorHandler.getXorList(); + basename(progName); + + std::cout << "" << std::endl; + std::cout << "" << std::endl << std::endl; + + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "" << progName << "" << std::endl; + std::cout << "1" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "" << progName << "" << std::endl; + std::cout << "" << _cmd.getMessage() << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << progName << "" << std::endl; + + // xor + for ( int i = 0; (unsigned int)i < xorList.size(); i++ ) + { + std::cout << "" << std::endl; + for ( ArgVectorIterator it = xorList[i].begin(); + it != xorList[i].end(); it++ ) + printShortArg((*it)); + + std::cout << "" << std::endl; + } + + // rest of args + for (ArgListIterator it = argList.begin(); it != argList.end(); it++) + if ( !xorHandler.contains( (*it) ) ) + printShortArg((*it)); + + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "Description" << std::endl; + std::cout << "" << std::endl; + std::cout << _cmd.getMessage() << std::endl; + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "Options" << std::endl; + + std::cout << "" << std::endl; + + for (ArgListIterator it = argList.begin(); it != argList.end(); it++) + printLongArg((*it)); + + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "Version" << std::endl; + std::cout << "" << std::endl; + std::cout << xversion << std::endl; + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + +} + +inline void DocBookOutput::failure( CmdLineInterface& _cmd, + ArgException& e ) +{ + static_cast(_cmd); // unused + std::cout << e.what() << std::endl; + throw ExitException(1); +} + +inline void DocBookOutput::substituteSpecialChars( std::string& s, + char r, + std::string& x ) +{ + size_t p; + while ( (p = s.find_first_of(r)) != std::string::npos ) + { + s.erase(p,1); + s.insert(p,x); + } +} + +inline void DocBookOutput::removeChar( std::string& s, char r) +{ + size_t p; + while ( (p = s.find_first_of(r)) != std::string::npos ) + { + s.erase(p,1); + } +} + +inline void DocBookOutput::basename( std::string& s ) +{ + size_t p = s.find_last_of('/'); + if ( p != std::string::npos ) + { + s.erase(0, p + 1); + } +} + +inline void DocBookOutput::printShortArg(Arg* a) +{ + std::string lt = "<"; + std::string gt = ">"; + + std::string id = a->shortID(); + substituteSpecialChars(id,'<',lt); + substituteSpecialChars(id,'>',gt); + removeChar(id,'['); + removeChar(id,']'); + + std::string choice = "opt"; + if ( a->isRequired() ) + choice = "plain"; + + std::cout << "acceptsMultipleValues() ) + std::cout << " rep='repeat'"; + + + std::cout << '>'; + if ( !a->getFlag().empty() ) + std::cout << a->flagStartChar() << a->getFlag(); + else + std::cout << a->nameStartString() << a->getName(); + if ( a->isValueRequired() ) + { + std::string arg = a->shortID(); + removeChar(arg,'['); + removeChar(arg,']'); + removeChar(arg,'<'); + removeChar(arg,'>'); + removeChar(arg,'.'); + arg.erase(0, arg.find_last_of(theDelimiter) + 1); + std::cout << theDelimiter; + std::cout << "" << arg << ""; + } + std::cout << "" << std::endl; + +} + +inline void DocBookOutput::printLongArg(Arg* a) +{ + std::string lt = "<"; + std::string gt = ">"; + + std::string desc = a->getDescription(); + substituteSpecialChars(desc,'<',lt); + substituteSpecialChars(desc,'>',gt); + + std::cout << "" << std::endl; + + if ( !a->getFlag().empty() ) + { + std::cout << "" << std::endl; + std::cout << "" << std::endl; + std::cout << "" << std::endl; + } + + std::cout << "" << std::endl; + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "" << std::endl; + std::cout << desc << std::endl; + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + std::cout << "" << std::endl; +} + +} //namespace TCLAP +#endif diff --git a/runtime/onnxruntime/include/tclap/HelpVisitor.h b/runtime/onnxruntime/include/tclap/HelpVisitor.h new file mode 100644 index 0000000..5ee3756 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/HelpVisitor.h @@ -0,0 +1,78 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: HelpVisitor.h + * + * Copyright (c) 2003, Michael E. Smoot . + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_HELP_VISITOR_H +#define TCLAP_HELP_VISITOR_H + +#include +#include +#include + +namespace TCLAP { + +/** + * A Visitor object that calls the usage method of the given CmdLineOutput + * object for the specified CmdLine object. + */ +class HelpVisitor: public Visitor +{ + private: + /** + * Prevent accidental copying. + */ + HelpVisitor(const HelpVisitor& rhs); + HelpVisitor& operator=(const HelpVisitor& rhs); + + protected: + + /** + * The CmdLine the output will be generated for. + */ + CmdLineInterface* _cmd; + + /** + * The output object. + */ + CmdLineOutput** _out; + + public: + + /** + * Constructor. + * \param cmd - The CmdLine the output will be generated for. + * \param out - The type of output. + */ + HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) + : Visitor(), _cmd( cmd ), _out( out ) { } + + /** + * Calls the usage method of the CmdLineOutput for the + * specified CmdLine. + */ + void visit() { (*_out)->usage(*_cmd); throw ExitException(0); } + +}; + +} + +#endif diff --git a/runtime/onnxruntime/include/tclap/IgnoreRestVisitor.h b/runtime/onnxruntime/include/tclap/IgnoreRestVisitor.h new file mode 100644 index 0000000..1824c3c --- /dev/null +++ b/runtime/onnxruntime/include/tclap/IgnoreRestVisitor.h @@ -0,0 +1,54 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: IgnoreRestVisitor.h + * + * Copyright (c) 2003, Michael E. Smoot . + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_IGNORE_REST_VISITOR_H +#define TCLAP_IGNORE_REST_VISITOR_H + +#include +#include + +namespace TCLAP { + +/** + * A Visitor that tells the CmdLine to begin ignoring arguments after + * this one is parsed. + */ +class IgnoreRestVisitor: public Visitor +{ + public: + + /** + * Constructor. + */ + IgnoreRestVisitor() : Visitor() {} + + /** + * Sets Arg::_ignoreRest. + */ + void visit() { Arg::beginIgnoring(); } +}; + +} + +#endif diff --git a/runtime/onnxruntime/include/tclap/MultiArg.h b/runtime/onnxruntime/include/tclap/MultiArg.h new file mode 100644 index 0000000..e0df8b9 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/MultiArg.h @@ -0,0 +1,433 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: MultiArg.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_MULTIPLE_ARGUMENT_H +#define TCLAP_MULTIPLE_ARGUMENT_H + +#include +#include + +#include +#include + +namespace TCLAP { +/** + * An argument that allows multiple values of type T to be specified. Very + * similar to a ValueArg, except a vector of values will be returned + * instead of just one. + */ +template +class MultiArg : public Arg +{ +public: + typedef std::vector container_type; + typedef typename container_type::iterator iterator; + typedef typename container_type::const_iterator const_iterator; + +protected: + + /** + * The list of values parsed from the CmdLine. + */ + std::vector _values; + + /** + * The description of type T to be used in the usage. + */ + std::string _typeDesc; + + /** + * A list of constraint on this Arg. + */ + Constraint* _constraint; + + /** + * Extracts the value from the string. + * Attempts to parse string as type T, if this fails an exception + * is thrown. + * \param val - The string to be read. + */ + void _extractValue( const std::string& val ); + + /** + * Used by XorHandler to decide whether to keep parsing for this arg. + */ + bool _allowMore; + +public: + + /** + * Constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + Visitor* v = NULL); + + /** + * Constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param parser - A CmdLine parser object to add this Arg to + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + CmdLineInterface& parser, + Visitor* v = NULL ); + + /** + * Constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + Visitor* v = NULL ); + + /** + * Constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param parser - A CmdLine parser object to add this Arg to + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + CmdLineInterface& parser, + Visitor* v = NULL ); + + /** + * Handles the processing of the argument. + * This re-implements the Arg version of this method to set the + * _value of the argument appropriately. It knows the difference + * between labeled and unlabeled. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. Passed from main(). + */ + virtual bool processArg(int* i, std::vector& args); + + /** + * Returns a vector of type T containing the values parsed from + * the command line. + */ + const std::vector& getValue() const { return _values; } + + /** + * Returns an iterator over the values parsed from the command + * line. + */ + const_iterator begin() const { return _values.begin(); } + + /** + * Returns the end of the values parsed from the command + * line. + */ + const_iterator end() const { return _values.end(); } + + /** + * Returns the a short id string. Used in the usage. + * \param val - value to be used. + */ + virtual std::string shortID(const std::string& val="val") const; + + /** + * Returns the a long id string. Used in the usage. + * \param val - value to be used. + */ + virtual std::string longID(const std::string& val="val") const; + + /** + * Once we've matched the first value, then the arg is no longer + * required. + */ + virtual bool isRequired() const; + + virtual bool allowMore(); + + virtual void reset(); + +private: + /** + * Prevent accidental copying + */ + MultiArg(const MultiArg& rhs); + MultiArg& operator=(const MultiArg& rhs); + +}; + +template +MultiArg::MultiArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + Visitor* v) : + Arg( flag, name, desc, req, true, v ), + _values(std::vector()), + _typeDesc( typeDesc ), + _constraint( NULL ), + _allowMore(false) +{ + _acceptsMultipleValues = true; +} + +template +MultiArg::MultiArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + CmdLineInterface& parser, + Visitor* v) +: Arg( flag, name, desc, req, true, v ), + _values(std::vector()), + _typeDesc( typeDesc ), + _constraint( NULL ), + _allowMore(false) +{ + parser.add( this ); + _acceptsMultipleValues = true; +} + +/** + * + */ +template +MultiArg::MultiArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + Visitor* v) +: Arg( flag, name, desc, req, true, v ), + _values(std::vector()), + _typeDesc( Constraint::shortID(constraint) ), + _constraint( constraint ), + _allowMore(false) +{ + _acceptsMultipleValues = true; +} + +template +MultiArg::MultiArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + CmdLineInterface& parser, + Visitor* v) +: Arg( flag, name, desc, req, true, v ), + _values(std::vector()), + _typeDesc( Constraint::shortID(constraint) ), + _constraint( constraint ), + _allowMore(false) +{ + parser.add( this ); + _acceptsMultipleValues = true; +} + +template +bool MultiArg::processArg(int *i, std::vector& args) +{ + if ( _ignoreable && Arg::ignoreRest() ) + return false; + + if ( _hasBlanks( args[*i] ) ) + return false; + + std::string flag = args[*i]; + std::string value = ""; + + trimFlag( flag, value ); + + if ( argMatches( flag ) ) + { + if ( Arg::delimiter() != ' ' && value == "" ) + throw( ArgParseException( + "Couldn't find delimiter for this argument!", + toString() ) ); + + // always take the first one, regardless of start string + if ( value == "" ) + { + (*i)++; + if ( static_cast(*i) < args.size() ) + _extractValue( args[*i] ); + else + throw( ArgParseException("Missing a value for this argument!", + toString() ) ); + } + else + _extractValue( value ); + + /* + // continuing taking the args until we hit one with a start string + while ( (unsigned int)(*i)+1 < args.size() && + args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && + args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) + _extractValue( args[++(*i)] ); + */ + + _alreadySet = true; + _checkWithVisitor(); + + return true; + } + else + return false; +} + +/** + * + */ +template +std::string MultiArg::shortID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + return Arg::shortID(_typeDesc) + " ..."; +} + +/** + * + */ +template +std::string MultiArg::longID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + return Arg::longID(_typeDesc) + " (accepted multiple times)"; +} + +/** + * Once we've matched the first value, then the arg is no longer + * required. + */ +template +bool MultiArg::isRequired() const +{ + if ( _required ) + { + if ( _values.size() > 1 ) + return false; + else + return true; + } + else + return false; + +} + +template +void MultiArg::_extractValue( const std::string& val ) +{ + try { + T tmp; + ExtractValue(tmp, val, typename ArgTraits::ValueCategory()); + _values.push_back(tmp); + } catch( ArgParseException &e) { + throw ArgParseException(e.error(), toString()); + } + + if ( _constraint != NULL ) + if ( ! _constraint->check( _values.back() ) ) + throw( CmdLineParseException( "Value '" + val + + "' does not meet constraint: " + + _constraint->description(), + toString() ) ); +} + +template +bool MultiArg::allowMore() +{ + bool am = _allowMore; + _allowMore = true; + return am; +} + +template +void MultiArg::reset() +{ + Arg::reset(); + _values.clear(); +} + +} // namespace TCLAP + +#endif diff --git a/runtime/onnxruntime/include/tclap/MultiSwitchArg.h b/runtime/onnxruntime/include/tclap/MultiSwitchArg.h new file mode 100644 index 0000000..e333ea7 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/MultiSwitchArg.h @@ -0,0 +1,217 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** +* +* file: MultiSwitchArg.h +* +* Copyright (c) 2003, Michael E. Smoot . +* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. +* Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek. +* Copyright (c) 2017, Google LLC +* All rights reserved. +* +* See the file COPYING in the top directory of this distribution for +* more information. +* +* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +*****************************************************************************/ + + +#ifndef TCLAP_MULTI_SWITCH_ARG_H +#define TCLAP_MULTI_SWITCH_ARG_H + +#include +#include + +#include + +namespace TCLAP { + +/** +* A multiple switch argument. If the switch is set on the command line, then +* the getValue method will return the number of times the switch appears. +*/ +class MultiSwitchArg : public SwitchArg +{ + protected: + + /** + * The value of the switch. + */ + int _value; + + /** + * Used to support the reset() method so that ValueArg can be + * reset to their constructed value. + */ + int _default; + + public: + + /** + * MultiSwitchArg constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param init - Optional. The initial/default value of this Arg. + * Defaults to 0. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiSwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + int init = 0, + Visitor* v = NULL); + + + /** + * MultiSwitchArg constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param parser - A CmdLine parser object to add this Arg to + * \param init - Optional. The initial/default value of this Arg. + * Defaults to 0. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiSwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + CmdLineInterface& parser, + int init = 0, + Visitor* v = NULL); + + + /** + * Handles the processing of the argument. + * This re-implements the SwitchArg version of this method to set the + * _value of the argument appropriately. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. Passed + * in from main(). + */ + virtual bool processArg(int* i, std::vector& args); + + /** + * Returns int, the number of times the switch has been set. + */ + int getValue() const { return _value; } + + /** + * Returns the shortID for this Arg. + */ + std::string shortID(const std::string& val) const; + + /** + * Returns the longID for this Arg. + */ + std::string longID(const std::string& val) const; + + void reset(); + +}; + +////////////////////////////////////////////////////////////////////// +//BEGIN MultiSwitchArg.cpp +////////////////////////////////////////////////////////////////////// +inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + int init, + Visitor* v ) +: SwitchArg(flag, name, desc, false, v), +_value( init ), +_default( init ) +{ } + +inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + CmdLineInterface& parser, + int init, + Visitor* v ) +: SwitchArg(flag, name, desc, false, v), +_value( init ), +_default( init ) +{ + parser.add( this ); +} + +inline bool MultiSwitchArg::processArg(int *i, std::vector& args) +{ + if ( _ignoreable && Arg::ignoreRest() ) + return false; + + if ( argMatches( args[*i] )) + { + // so the isSet() method will work + _alreadySet = true; + + // Matched argument: increment value. + ++_value; + + _checkWithVisitor(); + + return true; + } + else if ( combinedSwitchesMatch( args[*i] ) ) + { + // so the isSet() method will work + _alreadySet = true; + + // Matched argument: increment value. + ++_value; + + // Check for more in argument and increment value. + while ( combinedSwitchesMatch( args[*i] ) ) + ++_value; + + _checkWithVisitor(); + + return false; + } + else + return false; +} + +inline std::string +MultiSwitchArg::shortID(const std::string& val) const +{ + return Arg::shortID(val) + " ..."; +} + +inline std::string +MultiSwitchArg::longID(const std::string& val) const +{ + return Arg::longID(val) + " (accepted multiple times)"; +} + +inline void +MultiSwitchArg::reset() +{ + MultiSwitchArg::_value = MultiSwitchArg::_default; +} + +////////////////////////////////////////////////////////////////////// +//END MultiSwitchArg.cpp +////////////////////////////////////////////////////////////////////// + +} //namespace TCLAP + +#endif diff --git a/runtime/onnxruntime/include/tclap/OptionalUnlabeledTracker.h b/runtime/onnxruntime/include/tclap/OptionalUnlabeledTracker.h new file mode 100644 index 0000000..aa64116 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/OptionalUnlabeledTracker.h @@ -0,0 +1,64 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + + +/****************************************************************************** + * + * file: OptionalUnlabeledTracker.h + * + * Copyright (c) 2005, Michael E. Smoot . + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H +#define TCLAP_OPTIONAL_UNLABELED_TRACKER_H + +#include + +namespace TCLAP { + +class OptionalUnlabeledTracker +{ + + public: + + static void check( bool req, const std::string& argName ); + + static void gotOptional() { alreadyOptionalRef() = true; } + + static bool& alreadyOptional() { return alreadyOptionalRef(); } + + private: + + static bool& alreadyOptionalRef() { static bool ct = false; return ct; } +}; + + +inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName ) +{ + if ( OptionalUnlabeledTracker::alreadyOptional() ) + throw( SpecificationException( + "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg", + argName ) ); + + if ( !req ) + OptionalUnlabeledTracker::gotOptional(); +} + + +} // namespace TCLAP + +#endif diff --git a/runtime/onnxruntime/include/tclap/StandardTraits.h b/runtime/onnxruntime/include/tclap/StandardTraits.h new file mode 100644 index 0000000..5864f77 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/StandardTraits.h @@ -0,0 +1,63 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: StandardTraits.h + * + * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot . + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +// This is an internal tclap file, you should probably not have to +// include this directly + +#ifndef TCLAP_STANDARD_TRAITS_H +#define TCLAP_STANDARD_TRAITS_H + +#ifdef HAVE_CONFIG_H +#include // To check for long long +#endif + +// If Microsoft has already typedef'd wchar_t as an unsigned +// short, then compiles will break because it's as if we're +// creating ArgTraits twice for unsigned short. Thus... +#ifdef _MSC_VER +#ifndef _NATIVE_WCHAR_T_DEFINED +#define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS +#endif +#endif + +namespace TCLAP { + +// Integer types (signed, unsigned and bool) and floating point types all +// have value-like semantics. + +// Strings have string like argument traits. +template<> +struct ArgTraits { + typedef StringLike ValueCategory; +}; + +template +void SetString(T &dst, const std::string &src) +{ + dst = src; +} + +} // namespace + +#endif + diff --git a/runtime/onnxruntime/include/tclap/StdOutput.h b/runtime/onnxruntime/include/tclap/StdOutput.h new file mode 100644 index 0000000..cfef79a --- /dev/null +++ b/runtime/onnxruntime/include/tclap/StdOutput.h @@ -0,0 +1,300 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: StdOutput.h + * + * Copyright (c) 2004, Michael E. Smoot + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_STDCMDLINEOUTPUT_H +#define TCLAP_STDCMDLINEOUTPUT_H + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace TCLAP { + +/** + * A class that isolates any output from the CmdLine object so that it + * may be easily modified. + */ +class StdOutput : public CmdLineOutput +{ + + public: + + /** + * Prints the usage to stdout. Can be overridden to + * produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void usage(CmdLineInterface& c); + + /** + * Prints the version to stdout. Can be overridden + * to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void version(CmdLineInterface& c); + + /** + * Prints (to stderr) an error message, short usage + * Can be overridden to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + * \param e - The ArgException that caused the failure. + */ + virtual void failure(CmdLineInterface& c, + ArgException& e ); + + protected: + + /** + * Writes a brief usage message with short args. + * \param c - The CmdLine object the output is generated for. + * \param os - The stream to write the message to. + */ + void _shortUsage( CmdLineInterface& c, std::ostream& os ) const; + + /** + * Writes a longer usage message with long and short args, + * provides descriptions and prints message. + * \param c - The CmdLine object the output is generated for. + * \param os - The stream to write the message to. + */ + void _longUsage( CmdLineInterface& c, std::ostream& os ) const; + + /** + * This function inserts line breaks and indents long strings + * according the params input. It will only break lines at spaces, + * commas and pipes. + * \param os - The stream to be printed to. + * \param s - The string to be printed. + * \param maxWidth - The maxWidth allowed for the output line. + * \param indentSpaces - The number of spaces to indent the first line. + * \param secondLineOffset - The number of spaces to indent the second + * and all subsequent lines in addition to indentSpaces. + */ + void spacePrint( std::ostream& os, + const std::string& s, + int maxWidth, + int indentSpaces, + int secondLineOffset ) const; + +}; + + +inline void StdOutput::version(CmdLineInterface& _cmd) +{ + std::string progName = _cmd.getProgramName(); + std::string xversion = _cmd.getVersion(); + + std::cout << std::endl << progName << " version: " + << xversion << std::endl << std::endl; +} + +inline void StdOutput::usage(CmdLineInterface& _cmd ) +{ + std::cout << std::endl << "USAGE: " << std::endl << std::endl; + + _shortUsage( _cmd, std::cout ); + + std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl; + + _longUsage( _cmd, std::cout ); + + std::cout << std::endl; + +} + +inline void StdOutput::failure( CmdLineInterface& _cmd, + ArgException& e ) +{ + std::string progName = _cmd.getProgramName(); + + std::cerr << "PARSE ERROR: " << e.argId() << std::endl + << " " << e.error() << std::endl << std::endl; + + if ( _cmd.hasHelpAndVersion() ) + { + std::cerr << "Brief USAGE: " << std::endl; + + _shortUsage( _cmd, std::cerr ); + + std::cerr << std::endl << "For complete USAGE and HELP type: " + << std::endl << " " << progName << " " + << Arg::nameStartString() << "help" + << std::endl << std::endl; + } + else + usage(_cmd); + + throw ExitException(1); +} + +inline void +StdOutput::_shortUsage( CmdLineInterface& _cmd, + std::ostream& os ) const +{ + std::list argList = _cmd.getArgList(); + std::string progName = _cmd.getProgramName(); + XorHandler xorHandler = _cmd.getXorHandler(); + std::vector< std::vector > xorList = xorHandler.getXorList(); + + std::string s = progName + " "; + + // first the xor + for ( int i = 0; static_cast(i) < xorList.size(); i++ ) + { + s += " {"; + for ( ArgVectorIterator it = xorList[i].begin(); + it != xorList[i].end(); it++ ) + s += (*it)->shortID() + "|"; + + s[s.length()-1] = '}'; + } + + // then the rest + for (ArgListIterator it = argList.begin(); it != argList.end(); it++) + if ( !xorHandler.contains( (*it) ) ) + s += " " + (*it)->shortID(); + + // if the program name is too long, then adjust the second line offset + int secondLineOffset = static_cast(progName.length()) + 2; + if ( secondLineOffset > 75/2 ) + secondLineOffset = static_cast(75/2); + + spacePrint( os, s, 75, 3, secondLineOffset ); +} + +inline void +StdOutput::_longUsage( CmdLineInterface& _cmd, + std::ostream& os ) const +{ + std::list argList = _cmd.getArgList(); + std::string message = _cmd.getMessage(); + XorHandler xorHandler = _cmd.getXorHandler(); + std::vector< std::vector > xorList = xorHandler.getXorList(); + + // first the xor + for ( int i = 0; static_cast(i) < xorList.size(); i++ ) + { + for ( ArgVectorIterator it = xorList[i].begin(); + it != xorList[i].end(); + it++ ) + { + spacePrint( os, (*it)->longID(), 75, 3, 3 ); + spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); + + if ( it+1 != xorList[i].end() ) + spacePrint(os, "-- OR --", 75, 9, 0); + } + os << std::endl << std::endl; + } + + // then the rest + for (ArgListIterator it = argList.begin(); it != argList.end(); it++) + if ( !xorHandler.contains( (*it) ) ) + { + spacePrint( os, (*it)->longID(), 75, 3, 3 ); + spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); + os << std::endl; + } + + os << std::endl; + + spacePrint( os, message, 75, 3, 0 ); +} + +inline void StdOutput::spacePrint( std::ostream& os, + const std::string& s, + int maxWidth, + int indentSpaces, + int secondLineOffset ) const +{ + int len = static_cast(s.length()); + + if ( (len + indentSpaces > maxWidth) && maxWidth > 0 ) + { + int allowedLen = maxWidth - indentSpaces; + int start = 0; + while ( start < len ) + { + // find the substring length + // int stringLen = std::min( len - start, allowedLen ); + // doing it this way to support a VisualC++ 2005 bug + using namespace std; + int stringLen = min( len - start, allowedLen ); + + // trim the length so it doesn't end in middle of a word + if ( stringLen == allowedLen ) + while ( stringLen >= 0 && + s[stringLen+start] != ' ' && + s[stringLen+start] != ',' && + s[stringLen+start] != '|' ) + stringLen--; + + // ok, the word is longer than the line, so just split + // wherever the line ends + if ( stringLen <= 0 ) + stringLen = allowedLen; + + // check for newlines + for ( int i = 0; i < stringLen; i++ ) + if ( s[start+i] == '\n' ) + stringLen = i+1; + + // print the indent + for ( int i = 0; i < indentSpaces; i++ ) + os << " "; + + if ( start == 0 ) + { + // handle second line offsets + indentSpaces += secondLineOffset; + + // adjust allowed len + allowedLen -= secondLineOffset; + } + + os << s.substr(start,stringLen) << std::endl; + + // so we don't start a line with a space + while ( s[stringLen+start] == ' ' && start < len ) + start++; + + start += stringLen; + } + } + else + { + for ( int i = 0; i < indentSpaces; i++ ) + os << " "; + os << s << std::endl; + } +} + +} //namespace TCLAP +#endif diff --git a/runtime/onnxruntime/include/tclap/SwitchArg.h b/runtime/onnxruntime/include/tclap/SwitchArg.h new file mode 100644 index 0000000..4ca130d --- /dev/null +++ b/runtime/onnxruntime/include/tclap/SwitchArg.h @@ -0,0 +1,273 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: SwitchArg.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_SWITCH_ARG_H +#define TCLAP_SWITCH_ARG_H + +#include +#include + +#include + +namespace TCLAP { + +/** + * A simple switch argument. If the switch is set on the command line, then + * the getValue method will return the opposite of the default value for the + * switch. + */ +class SwitchArg : public Arg +{ +protected: + + /** + * The value of the switch. + */ + bool _value; + + /** + * Used to support the reset() method so that ValueArg can be + * reset to their constructed value. + */ + bool _default; + +public: + + /** + * SwitchArg constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param def - The default value for this Switch. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + SwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool def = false, + Visitor* v = NULL); + + + /** + * SwitchArg constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param parser - A CmdLine parser object to add this Arg to + * \param def - The default value for this Switch. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + SwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + CmdLineInterface& parser, + bool def = false, + Visitor* v = NULL); + + + /** + * Handles the processing of the argument. + * This re-implements the Arg version of this method to set the + * _value of the argument appropriately. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. Passed + * in from main(). + */ + virtual bool processArg(int* i, std::vector& args); + + /** + * Checks a string to see if any of the chars in the string + * match the flag for this Switch. + */ + bool combinedSwitchesMatch(std::string& combined); + + /** + * Returns bool, whether or not the switch has been set. + */ + bool getValue() const { return _value; } + + /** + * A SwitchArg can be used as a boolean, indicating + * whether or not the switch has been set. This is the + * same as calling getValue() + */ + operator bool() const { return _value; } + + virtual void reset(); + +private: + /** + * Checks to see if we've found the last match in + * a combined string. + */ + bool lastCombined(std::string& combined); + + /** + * Does the common processing of processArg. + */ + void commonProcessing(); +}; + +////////////////////////////////////////////////////////////////////// +//BEGIN SwitchArg.cpp +////////////////////////////////////////////////////////////////////// +inline SwitchArg::SwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool default_val, + Visitor* v ) + : Arg(flag, name, desc, false, false, v), + _value( default_val ), + _default( default_val ) +{ } + +inline SwitchArg::SwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, + CmdLineInterface& parser, + bool default_val, + Visitor* v ) + : Arg(flag, name, desc, false, false, v), + _value( default_val ), + _default(default_val) +{ + parser.add( this ); +} + +inline bool SwitchArg::lastCombined(std::string& combinedSwitches ) +{ + for ( unsigned int i = 1; i < combinedSwitches.length(); i++ ) + if ( combinedSwitches[i] != Arg::blankChar() ) + return false; + + return true; +} + +inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches ) +{ + // make sure this is actually a combined switch + if ( combinedSwitches.length() > 0 && + combinedSwitches[0] != Arg::flagStartString()[0] ) + return false; + + // make sure it isn't a long name + if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) == + Arg::nameStartString() ) + return false; + + // make sure the delimiter isn't in the string + if ( combinedSwitches.find_first_of(Arg::delimiter()) != std::string::npos) + return false; + + // ok, we're not specifying a ValueArg, so we know that we have + // a combined switch list. + for ( unsigned int i = 1; i < combinedSwitches.length(); i++ ) + if ( _flag.length() > 0 && + combinedSwitches[i] == _flag[0] && + _flag[0] != Arg::flagStartString()[0] ) + { + // update the combined switches so this one is no longer present + // this is necessary so that no unlabeled args are matched + // later in the processing. + //combinedSwitches.erase(i,1); + combinedSwitches[i] = Arg::blankChar(); + return true; + } + + // none of the switches passed in the list match. + return false; +} + +inline void SwitchArg::commonProcessing() +{ + if ( _xorSet ) + throw(CmdLineParseException( + "Mutually exclusive argument already set!", toString())); + + if ( _alreadySet ) + throw(CmdLineParseException("Argument already set!", toString())); + + _alreadySet = true; + + if ( _value == true ) + _value = false; + else + _value = true; + + _checkWithVisitor(); +} + +inline bool SwitchArg::processArg(int *i, std::vector& args) +{ + if ( _ignoreable && Arg::ignoreRest() ) + return false; + + // if the whole string matches the flag or name string + if ( argMatches( args[*i] ) ) + { + commonProcessing(); + + return true; + } + // if a substring matches the flag as part of a combination + else if ( combinedSwitchesMatch( args[*i] ) ) + { + // check again to ensure we don't misinterpret + // this as a MultiSwitchArg + if ( combinedSwitchesMatch( args[*i] ) ) + throw(CmdLineParseException("Argument already set!", + toString())); + + commonProcessing(); + + // We only want to return true if we've found the last combined + // match in the string, otherwise we return true so that other + // switches in the combination will have a chance to match. + return lastCombined( args[*i] ); + } + else + return false; +} + +inline void SwitchArg::reset() +{ + Arg::reset(); + _value = _default; +} +////////////////////////////////////////////////////////////////////// +//End SwitchArg.cpp +////////////////////////////////////////////////////////////////////// + +} //namespace TCLAP + +#endif diff --git a/runtime/onnxruntime/include/tclap/UnlabeledMultiArg.h b/runtime/onnxruntime/include/tclap/UnlabeledMultiArg.h new file mode 100644 index 0000000..48feb84 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/UnlabeledMultiArg.h @@ -0,0 +1,304 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: UnlabeledMultiArg.h + * + * Copyright (c) 2003, Michael E. Smoot. + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H +#define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H + +#include +#include + +#include +#include + +namespace TCLAP { + +/** + * Just like a MultiArg, except that the arguments are unlabeled. Basically, + * this Arg will slurp up everything that hasn't been matched to another + * Arg. + */ +template +class UnlabeledMultiArg : public MultiArg +{ + + // If compiler has two stage name lookup (as gcc >= 3.4 does) + // this is required to prevent undef. symbols + using MultiArg::_ignoreable; + using MultiArg::_hasBlanks; + using MultiArg::_extractValue; + using MultiArg::_typeDesc; + using MultiArg::_name; + using MultiArg::_description; + using MultiArg::_alreadySet; + using MultiArg::toString; + + public: + + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg( const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + bool ignoreable = false, + Visitor* v = NULL ); + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param parser - A CmdLine parser object to add this Arg to + * \param ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg( const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + CmdLineInterface& parser, + bool ignoreable = false, + Visitor* v = NULL ); + + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg( const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + bool ignoreable = false, + Visitor* v = NULL ); + + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param parser - A CmdLine parser object to add this Arg to + * \param ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg( const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + CmdLineInterface& parser, + bool ignoreable = false, + Visitor* v = NULL ); + + /** + * Handles the processing of the argument. + * This re-implements the Arg version of this method to set the + * _value of the argument appropriately. It knows the difference + * between labeled and unlabeled. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. Passed from main(). + */ + virtual bool processArg(int* i, std::vector& args); + + /** + * Returns the a short id string. Used in the usage. + * \param val - value to be used. + */ + virtual std::string shortID(const std::string& val="val") const; + + /** + * Returns the a long id string. Used in the usage. + * \param val - value to be used. + */ + virtual std::string longID(const std::string& val="val") const; + + /** + * Operator ==. + * \param a - The Arg to be compared to this. + */ + virtual bool operator==(const Arg& a) const; + + /** + * Pushes this to back of list rather than front. + * \param argList - The list this should be added to. + */ + virtual void addToList( std::list& argList ) const; +}; + +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + bool ignoreable, + Visitor* v) +: MultiArg("", name, desc, req, typeDesc, v) +{ + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); +} + +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, + const std::string& desc, + bool req, + const std::string& typeDesc, + CmdLineInterface& parser, + bool ignoreable, + Visitor* v) +: MultiArg("", name, desc, req, typeDesc, v) +{ + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); + parser.add( this ); +} + + +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + bool ignoreable, + Visitor* v) +: MultiArg("", name, desc, req, constraint, v) +{ + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); +} + +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, + const std::string& desc, + bool req, + Constraint* constraint, + CmdLineInterface& parser, + bool ignoreable, + Visitor* v) +: MultiArg("", name, desc, req, constraint, v) +{ + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); + parser.add( this ); +} + + +template +bool UnlabeledMultiArg::processArg(int *i, std::vector& args) +{ + + if ( _hasBlanks( args[*i] ) ) + return false; + + // never ignore an unlabeled multi arg + + + // always take the first value, regardless of the start string + _extractValue( args[(*i)] ); + + /* + // continue taking args until we hit the end or a start string + while ( (unsigned int)(*i)+1 < args.size() && + args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && + args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) + _extractValue( args[++(*i)] ); + */ + + _alreadySet = true; + + return true; +} + +template +std::string UnlabeledMultiArg::shortID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + return std::string("<") + _typeDesc + "> ..."; +} + +template +std::string UnlabeledMultiArg::longID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + return std::string("<") + _typeDesc + "> (accepted multiple times)"; +} + +template +bool UnlabeledMultiArg::operator==(const Arg& a) const +{ + if ( _name == a.getName() || _description == a.getDescription() ) + return true; + else + return false; +} + +template +void UnlabeledMultiArg::addToList( std::list& argList ) const +{ + argList.push_back( const_cast(static_cast(this)) ); +} + +} + +#endif diff --git a/runtime/onnxruntime/include/tclap/UnlabeledValueArg.h b/runtime/onnxruntime/include/tclap/UnlabeledValueArg.h new file mode 100644 index 0000000..341a3c0 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/UnlabeledValueArg.h @@ -0,0 +1,343 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: UnlabeledValueArg.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_UNLABELED_VALUE_ARGUMENT_H +#define TCLAP_UNLABELED_VALUE_ARGUMENT_H + +#include +#include + +#include +#include + + +namespace TCLAP { + +/** + * The basic unlabeled argument that parses a value. + * This is a template class, which means the type T defines the type + * that a given object will attempt to parse when an UnlabeledValueArg + * is reached in the list of args that the CmdLine iterates over. + */ +template +class UnlabeledValueArg : public ValueArg +{ + + // If compiler has two stage name lookup (as gcc >= 3.4 does) + // this is required to prevent undef. symbols + using ValueArg::_ignoreable; + using ValueArg::_hasBlanks; + using ValueArg::_extractValue; + using ValueArg::_typeDesc; + using ValueArg::_name; + using ValueArg::_description; + using ValueArg::_alreadySet; + using ValueArg::toString; + + public: + + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg( const std::string& name, + const std::string& desc, + bool req, + T value, + const std::string& typeDesc, + bool ignoreable = false, + Visitor* v = NULL); + + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param parser - A CmdLine parser object to add this Arg to + * \param ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg( const std::string& name, + const std::string& desc, + bool req, + T value, + const std::string& typeDesc, + CmdLineInterface& parser, + bool ignoreable = false, + Visitor* v = NULL ); + + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg( const std::string& name, + const std::string& desc, + bool req, + T value, + Constraint* constraint, + bool ignoreable = false, + Visitor* v = NULL ); + + + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param parser - A CmdLine parser object to add this Arg to + * \param ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg( const std::string& name, + const std::string& desc, + bool req, + T value, + Constraint* constraint, + CmdLineInterface& parser, + bool ignoreable = false, + Visitor* v = NULL); + + /** + * Handles the processing of the argument. + * This re-implements the Arg version of this method to set the + * _value of the argument appropriately. Handling specific to + * unlabeled arguments. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. + */ + virtual bool processArg(int* i, std::vector& args); + + /** + * Overrides shortID for specific behavior. + */ + virtual std::string shortID(const std::string& val="val") const; + + /** + * Overrides longID for specific behavior. + */ + virtual std::string longID(const std::string& val="val") const; + + /** + * Overrides operator== for specific behavior. + */ + virtual bool operator==(const Arg& a ) const; + + /** + * Instead of pushing to the front of list, push to the back. + * \param argList - The list to add this to. + */ + virtual void addToList( std::list& argList ) const; + +}; + +/** + * Constructor implementation. + */ +template +UnlabeledValueArg::UnlabeledValueArg(const std::string& name, + const std::string& desc, + bool req, + T val, + const std::string& typeDesc, + bool ignoreable, + Visitor* v) +: ValueArg("", name, desc, req, val, typeDesc, v) +{ + _ignoreable = ignoreable; + + OptionalUnlabeledTracker::check(req, toString()); + +} + +template +UnlabeledValueArg::UnlabeledValueArg(const std::string& name, + const std::string& desc, + bool req, + T val, + const std::string& typeDesc, + CmdLineInterface& parser, + bool ignoreable, + Visitor* v) +: ValueArg("", name, desc, req, val, typeDesc, v) +{ + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(req, toString()); + parser.add( this ); +} + +/** + * Constructor implementation. + */ +template +UnlabeledValueArg::UnlabeledValueArg(const std::string& name, + const std::string& desc, + bool req, + T val, + Constraint* constraint, + bool ignoreable, + Visitor* v) +: ValueArg("", name, desc, req, val, constraint, v) +{ + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(req, toString()); +} + +template +UnlabeledValueArg::UnlabeledValueArg(const std::string& name, + const std::string& desc, + bool req, + T val, + Constraint* constraint, + CmdLineInterface& parser, + bool ignoreable, + Visitor* v) +: ValueArg("", name, desc, req, val, constraint, v) +{ + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(req, toString()); + parser.add( this ); +} + +/** + * Implementation of processArg(). + */ +template +bool UnlabeledValueArg::processArg(int *i, std::vector& args) +{ + + if ( _alreadySet ) + return false; + + if ( _hasBlanks( args[*i] ) ) + return false; + + // never ignore an unlabeled arg + + _extractValue( args[*i] ); + _alreadySet = true; + return true; +} + +/** + * Overriding shortID for specific output. + */ +template +std::string UnlabeledValueArg::shortID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + return std::string("<") + _typeDesc + ">"; +} + +/** + * Overriding longID for specific output. + */ +template +std::string UnlabeledValueArg::longID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + + // Ideally we would like to be able to use RTTI to return the name + // of the type required for this argument. However, g++ at least, + // doesn't appear to return terribly useful "names" of the types. + return std::string("<") + _typeDesc + ">"; +} + +/** + * Overriding operator== for specific behavior. + */ +template +bool UnlabeledValueArg::operator==(const Arg& a ) const +{ + if ( _name == a.getName() || _description == a.getDescription() ) + return true; + else + return false; +} + +template +void UnlabeledValueArg::addToList( std::list& argList ) const +{ + argList.push_back( const_cast(static_cast(this)) ); +} + +} +#endif diff --git a/runtime/onnxruntime/include/tclap/ValueArg.h b/runtime/onnxruntime/include/tclap/ValueArg.h new file mode 100644 index 0000000..791d93f --- /dev/null +++ b/runtime/onnxruntime/include/tclap/ValueArg.h @@ -0,0 +1,430 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: ValueArg.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_VALUE_ARGUMENT_H +#define TCLAP_VALUE_ARGUMENT_H + +#include +#include + +#include +#include + +namespace TCLAP { + +/** + * The basic labeled argument that parses a value. + * This is a template class, which means the type T defines the type + * that a given object will attempt to parse when the flag/name is matched + * on the command line. While there is nothing stopping you from creating + * an unflagged ValueArg, it is unwise and would cause significant problems. + * Instead use an UnlabeledValueArg. + */ +template +class ValueArg : public Arg +{ +protected: + + /** + * The value parsed from the command line. + * Can be of any type, as long as the >> operator for the type + * is defined. + */ + T _value; + + /** + * Used to support the reset() method so that ValueArg can be + * reset to their constructed value. + */ + T _default; + + /** + * A human readable description of the type to be parsed. + * This is a hack, plain and simple. Ideally we would use RTTI to + * return the name of type T, but until there is some sort of + * consistent support for human readable names, we are left to our + * own devices. + */ + std::string _typeDesc; + + /** + * A Constraint this Arg must conform to. + */ + Constraint* _constraint; + + /** + * Extracts the value from the string. + * Attempts to parse string as type T, if this fails an exception + * is thrown. + * \param val - value to be parsed. + */ + void _extractValue( const std::string& val ); + +public: + + /** + * Labeled ValueArg constructor. + * You could conceivably call this constructor with a blank flag, + * but that would make you a bad person. It would also cause + * an exception to be thrown. If you want an unlabeled argument, + * use the other constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + ValueArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T value, + const std::string& typeDesc, + Visitor* v = NULL); + + + /** + * Labeled ValueArg constructor. + * You could conceivably call this constructor with a blank flag, + * but that would make you a bad person. It would also cause + * an exception to be thrown. If you want an unlabeled argument, + * use the other constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param typeDesc - A short, human readable description of the + * type that this object expects. This is used in the generation + * of the USAGE statement. The goal is to be helpful to the end user + * of the program. + * \param parser - A CmdLine parser object to add this Arg to + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + ValueArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T value, + const std::string& typeDesc, + CmdLineInterface& parser, + Visitor* v = NULL ); + + /** + * Labeled ValueArg constructor. + * You could conceivably call this constructor with a blank flag, + * but that would make you a bad person. It would also cause + * an exception to be thrown. If you want an unlabeled argument, + * use the other constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param parser - A CmdLine parser object to add this Arg to. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + ValueArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T value, + Constraint* constraint, + CmdLineInterface& parser, + Visitor* v = NULL ); + + /** + * Labeled ValueArg constructor. + * You could conceivably call this constructor with a blank flag, + * but that would make you a bad person. It would also cause + * an exception to be thrown. If you want an unlabeled argument, + * use the other constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param value - The default value assigned to this argument if it + * is not present on the command line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + ValueArg( const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T value, + Constraint* constraint, + Visitor* v = NULL ); + + /** + * Handles the processing of the argument. + * This re-implements the Arg version of this method to set the + * _value of the argument appropriately. It knows the difference + * between labeled and unlabeled. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. Passed + * in from main(). + */ + virtual bool processArg(int* i, std::vector& args); + + /** + * Returns the value of the argument. + */ + const T& getValue() const { return _value; } + + // TODO(macbishop): Non-const variant is deprecated, don't + // use. Remove in next major. + T& getValue() { return _value; } + + /** + * A ValueArg can be used as as its value type (T) This is the + * same as calling getValue() + */ + operator const T&() const { return getValue(); } + + /** + * Specialization of shortID. + * \param val - value to be used. + */ + virtual std::string shortID(const std::string& val = "val") const; + + /** + * Specialization of longID. + * \param val - value to be used. + */ + virtual std::string longID(const std::string& val = "val") const; + + virtual void reset() ; + +private: + /** + * Prevent accidental copying + */ + ValueArg(const ValueArg& rhs); + ValueArg& operator=(const ValueArg& rhs); +}; + + +/** + * Constructor implementation. + */ +template +ValueArg::ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T val, + const std::string& typeDesc, + Visitor* v) + : Arg(flag, name, desc, req, true, v), + _value( val ), + _default( val ), + _typeDesc( typeDesc ), + _constraint( NULL ) +{ } + +template +ValueArg::ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T val, + const std::string& typeDesc, + CmdLineInterface& parser, + Visitor* v) + : Arg(flag, name, desc, req, true, v), + _value( val ), + _default( val ), + _typeDesc( typeDesc ), + _constraint( NULL ) +{ + parser.add( this ); +} + +template +ValueArg::ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T val, + Constraint* constraint, + Visitor* v) + : Arg(flag, name, desc, req, true, v), + _value( val ), + _default( val ), + _typeDesc( Constraint::shortID(constraint) ), + _constraint( constraint ) +{ } + +template +ValueArg::ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, + bool req, + T val, + Constraint* constraint, + CmdLineInterface& parser, + Visitor* v) + : Arg(flag, name, desc, req, true, v), + _value( val ), + _default( val ), + _typeDesc( Constraint::shortID(constraint) ), // TODO(macbishop): Will crash + // if constraint is NULL + _constraint( constraint ) +{ + parser.add( this ); +} + +/** + * Implementation of processArg(). + */ +template +bool ValueArg::processArg(int *i, std::vector& args) +{ + if ( _ignoreable && Arg::ignoreRest() ) + return false; + + if ( _hasBlanks( args[*i] ) ) + return false; + + std::string flag = args[*i]; + + std::string value = ""; + trimFlag( flag, value ); + + if ( argMatches( flag ) ) + { + if ( _alreadySet ) + { + if ( _xorSet ) + throw( CmdLineParseException("Mutually exclusive argument" + " already set!", toString())); + else + throw( CmdLineParseException("Argument already set!", + toString()) ); + } + + if ( Arg::delimiter() != ' ' && value == "" ) + throw( ArgParseException("Couldn't find delimiter for this argument!", + toString() ) ); + + if ( value == "" ) + { + (*i)++; + if ( static_cast(*i) < args.size() ) + _extractValue( args[*i] ); + else + throw( ArgParseException("Missing a value for this argument!", + toString() ) ); + } + else + _extractValue( value ); + + _alreadySet = true; + _checkWithVisitor(); + return true; + } + else + return false; +} + +/** + * Implementation of shortID. + */ +template +std::string ValueArg::shortID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + return Arg::shortID( _typeDesc ); +} + +/** + * Implementation of longID. + */ +template +std::string ValueArg::longID(const std::string& val) const +{ + static_cast(val); // Ignore input, don't warn + return Arg::longID( _typeDesc ); +} + +template +void ValueArg::_extractValue( const std::string& val ) +{ + try { + ExtractValue(_value, val, typename ArgTraits::ValueCategory()); + } catch( ArgParseException &e) { + throw ArgParseException(e.error(), toString()); + } + + if ( _constraint != NULL ) + if ( ! _constraint->check( _value ) ) + throw( CmdLineParseException( "Value '" + val + + + "' does not meet constraint: " + + _constraint->description(), + toString() ) ); +} + +template +void ValueArg::reset() +{ + Arg::reset(); + _value = _default; +} + +} // namespace TCLAP + +#endif diff --git a/runtime/onnxruntime/include/tclap/ValuesConstraint.h b/runtime/onnxruntime/include/tclap/ValuesConstraint.h new file mode 100644 index 0000000..9851432 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/ValuesConstraint.h @@ -0,0 +1,134 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + + +/****************************************************************************** + * + * file: ValuesConstraint.h + * + * Copyright (c) 2005, Michael E. Smoot + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_VALUESCONSTRAINT_H +#define TCLAP_VALUESCONSTRAINT_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +namespace TCLAP { + +/** + * A Constraint that constrains the Arg to only those values specified + * in the constraint. + */ +template +class ValuesConstraint : public Constraint +{ + + public: + + /** + * Constructor. + * \param allowed - vector of allowed values. + */ + ValuesConstraint(std::vectorconst& allowed); + + /** + * Virtual destructor. + */ + virtual ~ValuesConstraint() {} + + /** + * Returns a description of the Constraint. + */ + virtual std::string description() const; + + /** + * Returns the short ID for the Constraint. + */ + virtual std::string shortID() const; + + /** + * The method used to verify that the value parsed from the command + * line meets the constraint. + * \param value - The value that will be checked. + */ + virtual bool check(const T& value) const; + + protected: + + /** + * The list of valid values. + */ + std::vector _allowed; + + /** + * The string used to describe the allowed values of this constraint. + */ + std::string _typeDesc; + +}; + +template +ValuesConstraint::ValuesConstraint(std::vector const& allowed) +: _allowed(allowed), + _typeDesc("") +{ + for ( unsigned int i = 0; i < _allowed.size(); i++ ) + { + std::ostringstream os; + os << _allowed[i]; + + std::string temp( os.str() ); + + if ( i > 0 ) + _typeDesc += "|"; + _typeDesc += temp; + } +} + +template +bool ValuesConstraint::check( const T& val ) const +{ + if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() ) + return false; + else + return true; +} + +template +std::string ValuesConstraint::shortID() const +{ + return _typeDesc; +} + +template +std::string ValuesConstraint::description() const +{ + return _typeDesc; +} + + +} //namespace TCLAP +#endif + diff --git a/runtime/onnxruntime/include/tclap/VersionVisitor.h b/runtime/onnxruntime/include/tclap/VersionVisitor.h new file mode 100644 index 0000000..3ef8b58 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/VersionVisitor.h @@ -0,0 +1,81 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: VersionVisitor.h + * + * Copyright (c) 2003, Michael E. Smoot . + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_VERSION_VISITOR_H +#define TCLAP_VERSION_VISITOR_H + +#include +#include +#include + +namespace TCLAP { + +/** + * A Visitor that will call the version method of the given CmdLineOutput + * for the specified CmdLine object and then exit. + */ +class VersionVisitor: public Visitor +{ + private: + /** + * Prevent accidental copying + */ + VersionVisitor(const VersionVisitor& rhs); + VersionVisitor& operator=(const VersionVisitor& rhs); + + protected: + + /** + * The CmdLine of interest. + */ + CmdLineInterface* _cmd; + + /** + * The output object. + */ + CmdLineOutput** _out; + + public: + + /** + * Constructor. + * \param cmd - The CmdLine the output is generated for. + * \param out - The type of output. + */ + VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out ) + : Visitor(), _cmd( cmd ), _out( out ) { } + + /** + * Calls the version method of the output object using the + * specified CmdLine. + */ + void visit() { + (*_out)->version(*_cmd); + throw ExitException(0); + } + +}; + +} + +#endif diff --git a/runtime/onnxruntime/include/tclap/Visitor.h b/runtime/onnxruntime/include/tclap/Visitor.h new file mode 100644 index 0000000..2a7bfd1 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/Visitor.h @@ -0,0 +1,57 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: Visitor.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2017, Google LLC + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + + +#ifndef TCLAP_VISITOR_H +#define TCLAP_VISITOR_H + +namespace TCLAP { + +/** + * A base class that defines the interface for visitors. + */ +class Visitor +{ + public: + + /** + * Constructor. Does nothing. + */ + Visitor() { } + + /** + * Destructor. Does nothing. + */ + virtual ~Visitor() { } + + /** + * This method (to implemented by children) will be + * called when the visitor is visited. + */ + virtual void visit() = 0; +}; + +} + +#endif diff --git a/runtime/onnxruntime/include/tclap/XorHandler.h b/runtime/onnxruntime/include/tclap/XorHandler.h new file mode 100644 index 0000000..e80f9ee --- /dev/null +++ b/runtime/onnxruntime/include/tclap/XorHandler.h @@ -0,0 +1,168 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + + +/****************************************************************************** + * + * file: XorHandler.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_XORHANDLER_H +#define TCLAP_XORHANDLER_H + +#include +#include +#include +#include +#include + +namespace TCLAP { + +/** + * This class handles lists of Arg's that are to be XOR'd on the command + * line. This is used by CmdLine and you shouldn't ever use it. + */ +class XorHandler +{ + protected: + + /** + * The list of of lists of Arg's to be or'd together. + */ + std::vector< std::vector > _orList; + + public: + + /** + * Constructor. Does nothing. + */ + XorHandler( ) : _orList(std::vector< std::vector >()) {} + + /** + * Add a list of Arg*'s that will be xor'd together. + * \param ors - list of Arg* that will be xor'd. + */ + void add( const std::vector& ors ); + + /** + * Checks whether the specified Arg is in one of the xor lists and + * if it does match one, returns the size of the xor list that the + * Arg matched. If the Arg matches, then it also sets the rest of + * the Arg's in the list. You shouldn't use this. + * \param a - The Arg to be checked. + */ + int check( const Arg* a ); + + /** + * Returns the XOR specific short usage. + */ + std::string shortUsage(); + + /** + * Prints the XOR specific long usage. + * \param os - Stream to print to. + */ + void printLongUsage(std::ostream& os); + + /** + * Simply checks whether the Arg is contained in one of the arg + * lists. + * \param a - The Arg to be checked. + */ + bool contains( const Arg* a ); + + const std::vector< std::vector >& getXorList() const; + +}; + + +////////////////////////////////////////////////////////////////////// +//BEGIN XOR.cpp +////////////////////////////////////////////////////////////////////// +inline void XorHandler::add( const std::vector& ors ) +{ + _orList.push_back( ors ); +} + +inline int XorHandler::check( const Arg* a ) +{ + // iterate over each XOR list + for ( int i = 0; static_cast(i) < _orList.size(); i++ ) + { + // if the XOR list contains the arg.. + ArgVectorIterator ait = std::find( _orList[i].begin(), + _orList[i].end(), a ); + if ( ait != _orList[i].end() ) + { + // first check to see if a mutually exclusive switch + // has not already been set + for ( ArgVectorIterator it = _orList[i].begin(); + it != _orList[i].end(); + it++ ) + if ( a != (*it) && (*it)->isSet() ) + throw(CmdLineParseException( + "Mutually exclusive argument already set!", + (*it)->toString())); + + // go through and set each arg that is not a + for ( ArgVectorIterator it = _orList[i].begin(); + it != _orList[i].end(); + it++ ) + if ( a != (*it) ) + (*it)->xorSet(); + + // return the number of required args that have now been set + if ( (*ait)->allowMore() ) + return 0; + else + return static_cast(_orList[i].size()); + } + } + + if ( a->isRequired() ) + return 1; + else + return 0; +} + +inline bool XorHandler::contains( const Arg* a ) +{ + for ( int i = 0; static_cast(i) < _orList.size(); i++ ) + for ( ArgVectorIterator it = _orList[i].begin(); + it != _orList[i].end(); + it++ ) + if ( a == (*it) ) + return true; + + return false; +} + +inline const std::vector< std::vector >& XorHandler::getXorList() const +{ + return _orList; +} + + + +////////////////////////////////////////////////////////////////////// +//END XOR.cpp +////////////////////////////////////////////////////////////////////// + +} //namespace TCLAP + +#endif diff --git a/runtime/onnxruntime/include/tclap/ZshCompletionOutput.h b/runtime/onnxruntime/include/tclap/ZshCompletionOutput.h new file mode 100644 index 0000000..5a9268c --- /dev/null +++ b/runtime/onnxruntime/include/tclap/ZshCompletionOutput.h @@ -0,0 +1,336 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: ZshCompletionOutput.h + * + * Copyright (c) 2006, Oliver Kiddle + * Copyright (c) 2017 Google Inc. + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H +#define TCLAP_ZSHCOMPLETIONOUTPUT_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace TCLAP { + +/** + * A class that generates a Zsh completion function as output from the usage() + * method for the given CmdLine and its Args. + */ +class ZshCompletionOutput : public CmdLineOutput +{ + + public: + + ZshCompletionOutput(); + + /** + * Prints the usage to stdout. Can be overridden to + * produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void usage(CmdLineInterface& c); + + /** + * Prints the version to stdout. Can be overridden + * to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void version(CmdLineInterface& c); + + /** + * Prints (to stderr) an error message, short usage + * Can be overridden to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + * \param e - The ArgException that caused the failure. + */ + virtual void failure(CmdLineInterface& c, + ArgException& e ); + + protected: + + void basename( std::string& s ); + void quoteSpecialChars( std::string& s ); + + std::string getMutexList( CmdLineInterface& _cmd, Arg* a ); + void printOption( Arg* it, std::string mutex ); + void printArg( Arg* it ); + + std::map common; + char theDelimiter; +}; + +ZshCompletionOutput::ZshCompletionOutput() +: common(std::map()), + theDelimiter('=') +{ + common["host"] = "_hosts"; + common["hostname"] = "_hosts"; + common["file"] = "_files"; + common["filename"] = "_files"; + common["user"] = "_users"; + common["username"] = "_users"; + common["directory"] = "_directories"; + common["path"] = "_directories"; + common["url"] = "_urls"; +} + +inline void ZshCompletionOutput::version(CmdLineInterface& _cmd) +{ + std::cout << _cmd.getVersion() << std::endl; +} + +inline void ZshCompletionOutput::usage(CmdLineInterface& _cmd ) +{ + std::list argList = _cmd.getArgList(); + std::string progName = _cmd.getProgramName(); + std::string xversion = _cmd.getVersion(); + theDelimiter = _cmd.getDelimiter(); + basename(progName); + + std::cout << "#compdef " << progName << std::endl << std::endl << + "# " << progName << " version " << _cmd.getVersion() << std::endl << std::endl << + "_arguments -s -S"; + + for (ArgListIterator it = argList.begin(); it != argList.end(); it++) + { + if ( (*it)->shortID().at(0) == '<' ) + printArg((*it)); + else if ( (*it)->getFlag() != "-" ) + printOption((*it), getMutexList(_cmd, *it)); + } + + std::cout << std::endl; +} + +inline void ZshCompletionOutput::failure( CmdLineInterface& _cmd, + ArgException& e ) +{ + static_cast(_cmd); // unused + std::cout << e.what() << std::endl; +} + +inline void ZshCompletionOutput::quoteSpecialChars( std::string& s ) +{ + size_t idx = s.find_last_of(':'); + while ( idx != std::string::npos ) + { + s.insert(idx, 1, '\\'); + idx = s.find_last_of(':', idx); + } + idx = s.find_last_of('\''); + while ( idx != std::string::npos ) + { + s.insert(idx, "'\\'"); + if (idx == 0) + idx = std::string::npos; + else + idx = s.find_last_of('\'', --idx); + } +} + +inline void ZshCompletionOutput::basename( std::string& s ) +{ + size_t p = s.find_last_of('/'); + if ( p != std::string::npos ) + { + s.erase(0, p + 1); + } +} + +inline void ZshCompletionOutput::printArg(Arg* a) +{ + static int count = 1; + + std::cout << " \\" << std::endl << " '"; + if ( a->acceptsMultipleValues() ) + std::cout << '*'; + else + std::cout << count++; + std::cout << ':'; + if ( !a->isRequired() ) + std::cout << ':'; + + std::cout << a->getName() << ':'; + std::map::iterator compArg = common.find(a->getName()); + if ( compArg != common.end() ) + { + std::cout << compArg->second; + } + else + { + std::cout << "_guard \"^-*\" " << a->getName(); + } + std::cout << '\''; +} + +inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex) +{ + std::string flag = a->flagStartChar() + a->getFlag(); + std::string name = a->nameStartString() + a->getName(); + std::string desc = a->getDescription(); + + // remove full stop and capitalization from description as + // this is the convention for zsh function + if (!desc.compare(0, 12, "(required) ")) + { + desc.erase(0, 12); + } + if (!desc.compare(0, 15, "(OR required) ")) + { + desc.erase(0, 15); + } + size_t len = desc.length(); + if (len && desc.at(--len) == '.') + { + desc.erase(len); + } + if (len) + { + desc.replace(0, 1, 1, tolower(desc.at(0))); + } + + std::cout << " \\" << std::endl << " '" << mutex; + + if ( a->getFlag().empty() ) + { + std::cout << name; + } + else + { + std::cout << "'{" << flag << ',' << name << "}'"; + } + if ( theDelimiter == '=' && a->isValueRequired() ) + std::cout << "=-"; + quoteSpecialChars(desc); + std::cout << '[' << desc << ']'; + + if ( a->isValueRequired() ) + { + std::string arg = a->shortID(); + // Example arg: "[-A ] ..." + size_t pos = arg.rfind(" ..."); + + if (pos != std::string::npos) { + arg.erase(pos); + } + + arg.erase(0, arg.find_last_of(theDelimiter) + 1); + if ( arg.at(arg.length()-1) == ']' ) + arg.erase(arg.length()-1); + if ( arg.at(arg.length()-1) == ']' ) + { + arg.erase(arg.length()-1); + } + if ( arg.at(0) == '<' ) + { + arg.erase(arg.length()-1); + arg.erase(0, 1); + } + size_t p = arg.find('|'); + if ( p != std::string::npos ) + { + do + { + arg.replace(p, 1, 1, ' '); + } + while ( (p = arg.find_first_of('|', p)) != std::string::npos ); + quoteSpecialChars(arg); + std::cout << ": :(" << arg << ')'; + } + else + { + std::cout << ':' << arg; + std::map::iterator compArg = common.find(arg); + if ( compArg != common.end() ) + { + std::cout << ':' << compArg->second; + } + } + } + + std::cout << '\''; +} + +inline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a) +{ + XorHandler xorHandler = _cmd.getXorHandler(); + std::vector< std::vector > xorList = xorHandler.getXorList(); + + if (a->getName() == "help" || a->getName() == "version") + { + return "(-)"; + } + + ostringstream list; + if ( a->acceptsMultipleValues() ) + { + list << '*'; + } + + for ( int i = 0; static_cast(i) < xorList.size(); i++ ) + { + for ( ArgVectorIterator it = xorList[i].begin(); + it != xorList[i].end(); + it++) + if ( a == (*it) ) + { + list << '('; + for ( ArgVectorIterator iu = xorList[i].begin(); + iu != xorList[i].end(); + iu++ ) + { + bool notCur = (*iu) != a; + bool hasFlag = !(*iu)->getFlag().empty(); + if ( iu != xorList[i].begin() && (notCur || hasFlag) ) + list << ' '; + if (hasFlag) + list << (*iu)->flagStartChar() << (*iu)->getFlag() << ' '; + if ( notCur || hasFlag ) + list << (*iu)->nameStartString() << (*iu)->getName(); + } + list << ')'; + return list.str(); + } + } + + // wasn't found in xor list + if (!a->getFlag().empty()) { + list << "(" << a->flagStartChar() << a->getFlag() << ' ' << + a->nameStartString() << a->getName() << ')'; + } + + return list.str(); +} + +} //namespace TCLAP +#endif diff --git a/runtime/onnxruntime/include/tclap/sstream.h b/runtime/onnxruntime/include/tclap/sstream.h new file mode 100644 index 0000000..0118b76 --- /dev/null +++ b/runtime/onnxruntime/include/tclap/sstream.h @@ -0,0 +1,50 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: sstream.h + * + * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno . + * Copyright (c) 2017 Google Inc. + * All rights reserved. + * + * See the file COPYING in the top directory of this distribution for + * more information. + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ + +#ifndef TCLAP_SSTREAM_H +#define TCLAP_SSTREAM_H + +#if !defined(HAVE_STRSTREAM) +// Assume sstream is available if strstream is not specified +// (https://sourceforge.net/p/tclap/bugs/23/) +#define HAVE_SSTREAM +#endif + +#if defined(HAVE_SSTREAM) +#include +namespace TCLAP { + typedef std::istringstream istringstream; + typedef std::ostringstream ostringstream; +} +#elif defined(HAVE_STRSTREAM) +#include +namespace TCLAP { + typedef std::istrstream istringstream; + typedef std::ostrstream ostringstream; +} +#else +#error "Need a stringstream (sstream or strstream) to compile!" +#endif + +#endif // TCLAP_SSTREAM_H diff --git a/runtime/onnxruntime/include/tpass-online-stream.h b/runtime/onnxruntime/include/tpass-online-stream.h new file mode 100644 index 0000000..e092880 --- /dev/null +++ b/runtime/onnxruntime/include/tpass-online-stream.h @@ -0,0 +1,20 @@ +#ifndef TPASS_ONLINE_STREAM_H +#define TPASS_ONLINE_STREAM_H + +#include +#include "tpass-stream.h" +#include "model.h" +#include "vad-model.h" + +namespace funasr { +class TpassOnlineStream { + public: + TpassOnlineStream(TpassStream* tpass_stream, std::vector chunk_size); + ~TpassOnlineStream(){}; + + std::unique_ptr vad_online_handle = nullptr; + std::unique_ptr asr_online_handle = nullptr; +}; +TpassOnlineStream* CreateTpassOnlineStream(void* tpass_stream, std::vector chunk_size); +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/include/tpass-stream.h b/runtime/onnxruntime/include/tpass-stream.h new file mode 100644 index 0000000..0276631 --- /dev/null +++ b/runtime/onnxruntime/include/tpass-stream.h @@ -0,0 +1,38 @@ +#ifndef TPASS_STREAM_H +#define TPASS_STREAM_H + +#include +#include +#include +#include "model.h" +#include "punc-model.h" +#include "vad-model.h" +#if !defined(__APPLE__) +#include "itn-model.h" +#endif + +namespace funasr { +class TpassStream { + public: + TpassStream(std::map& model_path, int thread_num); + ~TpassStream(){}; + + std::unique_ptr vad_handle = nullptr; + std::unique_ptr asr_handle = nullptr; + std::unique_ptr punc_online_handle = nullptr; +#if !defined(__APPLE__) + std::unique_ptr itn_handle = nullptr; +#endif + bool UseVad(){return use_vad;}; + bool UsePunc(){return use_punc;}; + bool UseITN(){return use_itn;}; + + private: + bool use_vad=false; + bool use_punc=false; + bool use_itn=false; +}; + +TpassStream *CreateTpassStream(std::map& model_path, int thread_num=1); +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/include/vad-model.h b/runtime/onnxruntime/include/vad-model.h new file mode 100644 index 0000000..adb1e20 --- /dev/null +++ b/runtime/onnxruntime/include/vad-model.h @@ -0,0 +1,21 @@ + +#ifndef VAD_MODEL_H +#define VAD_MODEL_H + +#include +#include +#include + +namespace funasr { +class VadModel { + public: + virtual ~VadModel(){}; + virtual void InitVad(const std::string &vad_model, const std::string &vad_cmvn, const std::string &vad_config, int thread_num)=0; + virtual std::vector> Infer(std::vector &waves, bool input_finished=true)=0; + virtual int GetVadSampleRate() = 0; +}; + +VadModel *CreateVadModel(std::map& model_path, int thread_num); +VadModel *CreateVadModel(void* fsmnvad_handle); +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/readme.md b/runtime/onnxruntime/readme.md new file mode 100644 index 0000000..f6f6c48 --- /dev/null +++ b/runtime/onnxruntime/readme.md @@ -0,0 +1,60 @@ +# Please ref to [websocket service](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/websocket) + +# If you want to compile the file yourself, you can follow the steps below. +## Building for Linux/Unix +### Download onnxruntime +```shell +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-linux-x64-1.14.0.tgz +tar -zxvf onnxruntime-linux-x64-1.14.0.tgz +``` + +### Download ffmpeg +```shell +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-linux64-gpl-shared.tar.xz +tar -xvf ffmpeg-master-latest-linux64-gpl-shared.tar.xz +``` + +### Install deps +```shell +# openblas +sudo apt-get install libopenblas-dev #ubuntu +# sudo yum -y install openblas-devel #centos + +# openssl +apt-get install libssl-dev #ubuntu +# yum install openssl-devel #centos +``` + +### Build runtime +```shell +git clone https://github.com/alibaba-damo-academy/FunASR.git && cd FunASR/runtime/onnxruntime +mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=release .. -DONNXRUNTIME_DIR=/path/to/onnxruntime-linux-x64-1.14.0 -DFFMPEG_DIR=/path/to/ffmpeg-master-latest-linux64-gpl-shared +make -j 4 +``` + + +## Building for Windows +### Download onnxruntime +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-win-x64-1.16.1.zip + +Download and unzip to d:/onnxruntime-win-x64-1.16.1 + +### Download ffmpeg +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-win64-gpl-shared.zip + +Download and unzip to d:/ffmpeg-master-latest-win64-gpl-shared + +### Build runtime +``` +git clone https://github.com/alibaba-damo-academy/FunASR.git +cd FunASR/runtime/onnxruntime +mkdir build +cd build +cmake ../ -D FFMPEG_DIR=d:/ffmpeg-master-latest-win64-gpl-shared -D ONNXRUNTIME_DIR=d:/onnxruntime-win-x64-1.16.1 +``` + +Visual Studio open FunASR/runtime/onnxruntime/build/FunASROnnx.sln start build. +After compilation, the executable file is located here: FunASR/runtime/onnxruntime/build/bin/Debug. +Copy the required DLL libraries from (onnxruntime-win-x64-1.16.1/lib, ffmpeg-master-latest-win64-gpl-shared/bin) to this location: FunASR/runtime/onnxruntime/build/bin/Debug + diff --git a/runtime/onnxruntime/src/CMakeLists.txt b/runtime/onnxruntime/src/CMakeLists.txt new file mode 100644 index 0000000..9eac2b6 --- /dev/null +++ b/runtime/onnxruntime/src/CMakeLists.txt @@ -0,0 +1,31 @@ + +file(GLOB files1 "*.cpp") +set(files ${files1}) + +message("files: "${files}) + +if(WIN32) +add_compile_options("$<$:/execution-charset:utf-8>") +add_compile_options("$<$:/source-charset:utf-8>") +add_compile_options("$<$:/bigobj>") +endif() + +add_library(funasr SHARED ${files}) + +if(WIN32) + set(EXTRA_LIBS yaml-cpp csrc kaldi-decoder fst glog gflags avutil avcodec avformat swresample onnxruntime) + include_directories(${ONNXRUNTIME_DIR}/include) + include_directories(${FFMPEG_DIR}/include) + target_link_directories(funasr PUBLIC ${ONNXRUNTIME_DIR}/lib) + target_link_directories(funasr PUBLIC ${FFMPEG_DIR}/lib) + target_compile_definitions(funasr PUBLIC -D_FUNASR_API_EXPORT -DNOMINMAX -DYAML_CPP_DLL) +else() + set(EXTRA_LIBS pthread yaml-cpp csrc kaldi-decoder fst glog gflags avutil avcodec avformat swresample) + include_directories(${ONNXRUNTIME_DIR}/include) + include_directories(${FFMPEG_DIR}/include) +endif() + +#message("CXX_FLAGS "${CMAKE_CXX_FLAGS}) +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_SOURCE_DIR}/third_party) +target_link_libraries(funasr PUBLIC onnxruntime ${EXTRA_LIBS}) diff --git a/runtime/onnxruntime/src/alignedmem.cpp b/runtime/onnxruntime/src/alignedmem.cpp new file mode 100644 index 0000000..b72c623 --- /dev/null +++ b/runtime/onnxruntime/src/alignedmem.cpp @@ -0,0 +1,21 @@ +#include "precomp.h" + +namespace funasr { +void *AlignedMalloc(size_t alignment, size_t required_bytes) +{ + void *p1; // original block + void **p2; // aligned block + int offset = alignment - 1 + sizeof(void *); + if ((p1 = (void *)malloc(required_bytes + offset)) == nullptr) { + return nullptr; + } + p2 = (void **)(((size_t)(p1) + offset) & ~(alignment - 1)); + p2[-1] = p1; + return p2; +} + +void AlignedFree(void *p) +{ + free(((void **)p)[-1]); +} +} // namespace funasr \ No newline at end of file diff --git a/runtime/onnxruntime/src/alignedmem.h b/runtime/onnxruntime/src/alignedmem.h new file mode 100644 index 0000000..e4b9a78 --- /dev/null +++ b/runtime/onnxruntime/src/alignedmem.h @@ -0,0 +1,10 @@ + +#ifndef ALIGNEDMEM_H +#define ALIGNEDMEM_H + +namespace funasr { +extern void *AlignedMalloc(size_t alignment, size_t required_bytes); +extern void AlignedFree(void *p); + +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/src/audio.cpp b/runtime/onnxruntime/src/audio.cpp new file mode 100644 index 0000000..0135ab4 --- /dev/null +++ b/runtime/onnxruntime/src/audio.cpp @@ -0,0 +1,1327 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "audio.h" +#include "precomp.h" + +#ifdef _MSC_VER +#pragma warning(disable:4996) +#endif + +#if defined(__APPLE__) +#include +#else + +extern "C" { +#include +#include +#include +#include +#include +#include +} + +#endif + + + +using namespace std; + +namespace funasr { +// see http://soundfile.sapp.org/doc/WaveFormat/ +// Note: We assume little endian here +struct WaveHeader { + bool Validate() const { + // F F I R + if (chunk_id != 0x46464952) { + printf("Expected chunk_id RIFF. Given: 0x%08x\n", chunk_id); + return false; + } + // E V A W + if (format != 0x45564157) { + printf("Expected format WAVE. Given: 0x%08x\n", format); + return false; + } + + if (subchunk1_id != 0x20746d66) { + printf("Expected subchunk1_id 0x20746d66. Given: 0x%08x\n", + subchunk1_id); + return false; + } + + if (subchunk1_size != 16) { // 16 for PCM + printf("Expected subchunk1_size 16. Given: %d\n", + subchunk1_size); + return false; + } + + if (audio_format != 1) { // 1 for PCM + printf("Expected audio_format 1. Given: %d\n", audio_format); + return false; + } + + if (num_channels != 1) { // we support only single channel for now + printf("Expected single channel. Given: %d\n", num_channels); + return false; + } + if (byte_rate != (sample_rate * num_channels * bits_per_sample / 8)) { + return false; + } + + if (block_align != (num_channels * bits_per_sample / 8)) { + return false; + } + + if (bits_per_sample != 16) { // we support only 16 bits per sample + printf("Expected bits_per_sample 16. Given: %d\n", + bits_per_sample); + return false; + } + return true; + } + + // See https://en.wikipedia.org/wiki/WAV#Metadata and + // https://www.robotplanet.dk/audio/wav_meta_data/riff_mci.pdf + void SeekToDataChunk(std::istream &is) { + // a t a d + while (is && subchunk2_id != 0x61746164) { + // const char *p = reinterpret_cast(&subchunk2_id); + // printf("Skip chunk (%x): %c%c%c%c of size: %d\n", subchunk2_id, p[0], + // p[1], p[2], p[3], subchunk2_size); + is.seekg(subchunk2_size, std::istream::cur); + is.read(reinterpret_cast(&subchunk2_id), sizeof(int32_t)); + is.read(reinterpret_cast(&subchunk2_size), sizeof(int32_t)); + } + } + + int32_t chunk_id; + int32_t chunk_size; + int32_t format; + int32_t subchunk1_id; + int32_t subchunk1_size; + int16_t audio_format; + int16_t num_channels; + int32_t sample_rate; + int32_t byte_rate; + int16_t block_align; + int16_t bits_per_sample; + int32_t subchunk2_id; // a tag of this chunk + int32_t subchunk2_size; // size of subchunk2 +}; +static_assert(sizeof(WaveHeader) == WAV_HEADER_SIZE, ""); + +class AudioWindow { + private: + int *window; + int in_idx; + int out_idx; + int sum; + int window_size = 0; + + public: + AudioWindow(int window_size) : window_size(window_size) + { + window = (int *)calloc(sizeof(int), window_size + 1); + in_idx = 0; + out_idx = 1; + sum = 0; + }; + ~AudioWindow(){ + free(window); + window = nullptr; + }; + int put(int val) + { + sum = sum + val - window[out_idx]; + window[in_idx] = val; + in_idx = in_idx == window_size ? 0 : in_idx + 1; + out_idx = out_idx == window_size ? 0 : out_idx + 1; + return sum; + }; +}; + +AudioFrame::AudioFrame(){} +AudioFrame::AudioFrame(int len) : len(len) +{ + start = 0; +} +AudioFrame::AudioFrame(const AudioFrame &other) +{ + start = other.start; + end = other.end; + len = other.len; + is_final = other.is_final; +} +AudioFrame::AudioFrame(int start, int end, bool is_final):start(start),end(end),is_final(is_final){ + len = end - start; +} +AudioFrame::~AudioFrame(){ + if(data != nullptr){ + free(data); + data = nullptr; + } +} +int AudioFrame::SetStart(int val) +{ + start = val < 0 ? 0 : val; + return start; +} + +int AudioFrame::SetEnd(int val) +{ + end = val; + len = end - start; + return end; +} + +int AudioFrame::GetStart() +{ + return start; +} + +int AudioFrame::GetLen() +{ + return len; +} + +int AudioFrame::Disp() +{ + LOG(ERROR) << "Not imp!!!!"; + return 0; +} + +Audio::Audio(int data_type) : dest_sample_rate(MODEL_SAMPLE_RATE), data_type(data_type) +{ + speech_buff = nullptr; + speech_data = nullptr; + align_size = 1360; + seg_sample = dest_sample_rate / 1000; +} + +Audio::Audio(int model_sample_rate, int data_type) : dest_sample_rate(model_sample_rate), data_type(data_type) +{ + speech_buff = nullptr; + speech_data = nullptr; + align_size = 1360; + seg_sample = dest_sample_rate / 1000; +} + +Audio::Audio(int model_sample_rate, int data_type, int size) : dest_sample_rate(model_sample_rate), data_type(data_type) +{ + speech_buff = nullptr; + speech_data = nullptr; + align_size = (float)size; + seg_sample = dest_sample_rate / 1000; +} + +Audio::~Audio() +{ + if (speech_buff != nullptr) { + free(speech_buff); + speech_buff = nullptr; + } + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + if (speech_char != nullptr) { + free(speech_char); + speech_char = nullptr; + } + ClearQueue(frame_queue); + ClearQueue(asr_online_queue); + ClearQueue(asr_offline_queue); +} + +void Audio::ClearQueue(std::queue& q) { + while (!q.empty()) { + AudioFrame* frame = q.front(); + delete frame; + q.pop(); + } +} + +void Audio::Disp() +{ + LOG(INFO) << "Audio time is " << (float)speech_len / dest_sample_rate << " s. len is " << speech_len; +} + +float Audio::GetTimeLen() +{ + return (float)speech_len / dest_sample_rate; +} + +void Audio::WavResample(int32_t sampling_rate, const float *waveform, + int32_t n) +{ + LOG(INFO) << "Creating a resampler: " + << " in_sample_rate: "<< sampling_rate + << " output_sample_rate: " << static_cast(dest_sample_rate); + float min_freq = + std::min(sampling_rate, dest_sample_rate); + float lowpass_cutoff = 0.99 * 0.5 * min_freq; + + int32_t lowpass_filter_width = 6; + + auto resampler = std::make_unique( + sampling_rate, dest_sample_rate, lowpass_cutoff, lowpass_filter_width); + std::vector samples; + resampler->Resample(waveform, n, true, &samples); + //reset speech_data + speech_len = samples.size(); + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + speech_data = (float*)malloc(sizeof(float) * speech_len); + memset(speech_data, 0, sizeof(float) * speech_len); + copy(samples.begin(), samples.end(), speech_data); +} + +bool Audio::FfmpegLoad(const char *filename, bool copy2char){ +#if defined(__APPLE__) + return false; +#else + // from file + AVFormatContext* formatContext = avformat_alloc_context(); + if (avformat_open_input(&formatContext, filename, nullptr, nullptr) != 0) { + LOG(ERROR) << "Error: Could not open input file."; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + return false; + } + + if (avformat_find_stream_info(formatContext, nullptr) < 0) { + LOG(ERROR) << "Error: Could not open input file."; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + return false; + } + const AVCodec* codec = nullptr; + AVCodecParameters* codecParameters = nullptr; + int audioStreamIndex = av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0); + if (audioStreamIndex >= 0) { + codecParameters = formatContext->streams[audioStreamIndex]->codecpar; + }else { + LOG(ERROR) << "Error: Could not open input file."; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + return false; + } + AVCodecContext* codecContext = avcodec_alloc_context3(codec); + if (!codecContext) { + LOG(ERROR) << "Failed to allocate codec context"; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + return false; + } + if (avcodec_parameters_to_context(codecContext, codecParameters) != 0) { + LOG(ERROR) << "Error: Could not copy codec parameters to codec context."; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + return false; + } + if (avcodec_open2(codecContext, codec, nullptr) < 0) { + LOG(ERROR) << "Error: Could not open audio decoder."; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + return false; + } + SwrContext *swr_ctx = swr_alloc_set_opts( + nullptr, // allocate a new context + AV_CH_LAYOUT_MONO, // output channel layout (stereo) + AV_SAMPLE_FMT_S16, // output sample format (signed 16-bit) + dest_sample_rate, // output sample rate (same as input) + av_get_default_channel_layout(codecContext->channels), // input channel layout + codecContext->sample_fmt, // input sample format + codecContext->sample_rate, // input sample rate + 0, // logging level + nullptr // parent context + ); + if (swr_ctx == nullptr) { + LOG(ERROR) << "Could not initialize resampler"; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + return false; + } + if (swr_init(swr_ctx) != 0) { + LOG(ERROR) << "Could not initialize resampler"; + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + swr_free(&swr_ctx); + return false; + } + + // to pcm + AVPacket* packet = av_packet_alloc(); + AVFrame* frame = av_frame_alloc(); + std::vector resampled_buffers; + while (av_read_frame(formatContext, packet) >= 0) { + if (packet->stream_index == audioStreamIndex) { + if (avcodec_send_packet(codecContext, packet) >= 0) { + while (avcodec_receive_frame(codecContext, frame) >= 0) { + // Resample audio if necessary + std::vector resampled_buffer; + int out_samples = av_rescale_rnd(swr_get_delay(swr_ctx, codecContext->sample_rate) + frame->nb_samples, + dest_sample_rate, + codecContext->sample_rate, + AV_ROUND_DOWN); + + int resampled_size = out_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16); + if (resampled_buffer.size() < resampled_size) { + resampled_buffer.resize(resampled_size); + } + uint8_t *resampled_data = resampled_buffer.data(); + int ret = swr_convert( + swr_ctx, + &resampled_data, // output buffer + out_samples, // output buffer size + (const uint8_t **)(frame->data), // choose channel + frame->nb_samples // input buffer size + ); + if (ret < 0) { + LOG(ERROR) << "Error resampling audio"; + break; + } + resampled_buffers.insert(resampled_buffers.end(), resampled_buffer.begin(), resampled_buffer.begin() + resampled_size); + } + } + } + av_packet_unref(packet); + } + + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + swr_free(&swr_ctx); + av_packet_free(&packet); + av_frame_free(&frame); + + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + if (speech_char != nullptr) { + free(speech_char); + speech_char = nullptr; + } + offset = 0; + + if(copy2char){ + speech_char = (char *)malloc(resampled_buffers.size()); + memset(speech_char, 0, resampled_buffers.size()); + memcpy((void*)speech_char, (const void*)resampled_buffers.data(), resampled_buffers.size()); + } + + speech_len = (resampled_buffers.size()) / 2; + speech_data = (float*)malloc(sizeof(float) * speech_len); + if(speech_data){ + memset(speech_data, 0, sizeof(float) * speech_len); + float scale = 1; + if (data_type == 1) { + scale = 32768.0f; + } + for (int32_t i = 0; i < speech_len; ++i) { + int16_t val = (int16_t)((resampled_buffers[2 * i + 1] << 8) | resampled_buffers[2 * i]); + speech_data[i] = (float)val / scale; + } + AudioFrame* frame = new AudioFrame(speech_len); + frame_queue.push(frame); + + return true; + }else{ + return false; + } + +#endif +} + +bool Audio::FfmpegLoad(const char* buf, int n_file_len){ +#if defined(__APPLE__) + return false; +#else + // from buf + void* buf_copy = av_malloc(n_file_len); + memcpy(buf_copy, buf, n_file_len); + + AVIOContext* avio_ctx = avio_alloc_context( + (unsigned char*)buf_copy, // buffer + n_file_len, // buffer size + 0, // write flag (0 for read-only) + nullptr, // opaque pointer (not used here) + nullptr, // read callback (not used here) + nullptr, // write callback (not used here) + nullptr // seek callback (not used here) + ); + if (!avio_ctx) { + av_free(buf_copy); + return false; + } + AVFormatContext* formatContext = avformat_alloc_context(); + formatContext->pb = avio_ctx; + if (avformat_open_input(&formatContext, "", nullptr, nullptr) != 0) { + LOG(ERROR) << "Error: Could not open input file."; + avio_context_free(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + return false; + } + + if (avformat_find_stream_info(formatContext, nullptr) < 0) { + LOG(ERROR) << "Error: Could not find stream information."; + avio_context_free(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + return false; + } + const AVCodec* codec = nullptr; + AVCodecParameters* codecParameters = nullptr; + int audioStreamIndex = av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0); + if (audioStreamIndex >= 0) { + codecParameters = formatContext->streams[audioStreamIndex]->codecpar; + } + AVCodecContext* codecContext = avcodec_alloc_context3(codec); + if (!codecContext) { + LOG(ERROR) << "Failed to allocate codec context"; + avio_context_free(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + return false; + } + if (avcodec_parameters_to_context(codecContext, codecParameters) != 0) { + LOG(ERROR) << "Error: Could not copy codec parameters to codec context."; + avio_context_free(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + return false; + } + if (avcodec_open2(codecContext, codec, nullptr) < 0) { + LOG(ERROR) << "Error: Could not open audio decoder."; + avio_context_free(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + return false; + } + SwrContext *swr_ctx = swr_alloc_set_opts( + nullptr, // allocate a new context + AV_CH_LAYOUT_MONO, // output channel layout (stereo) + AV_SAMPLE_FMT_S16, // output sample format (signed 16-bit) + dest_sample_rate, // output sample rate (same as input) + av_get_default_channel_layout(codecContext->channels), // input channel layout + codecContext->sample_fmt, // input sample format + codecContext->sample_rate, // input sample rate + 0, // logging level + nullptr // parent context + ); + if (swr_ctx == nullptr) { + LOG(ERROR) << "Could not initialize resampler"; + avio_context_free(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + return false; + } + if (swr_init(swr_ctx) != 0) { + LOG(ERROR) << "Could not initialize resampler"; + avio_context_free(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + swr_free(&swr_ctx); + return false; + } + + // to pcm + AVPacket* packet = av_packet_alloc(); + AVFrame* frame = av_frame_alloc(); + std::vector resampled_buffers; + while (av_read_frame(formatContext, packet) >= 0) { + if (packet->stream_index == audioStreamIndex) { + if (avcodec_send_packet(codecContext, packet) >= 0) { + while (avcodec_receive_frame(codecContext, frame) >= 0) { + // Resample audio if necessary + std::vector resampled_buffer; + int out_samples = av_rescale_rnd(swr_get_delay(swr_ctx, codecContext->sample_rate) + frame->nb_samples, + dest_sample_rate, + codecContext->sample_rate, + AV_ROUND_DOWN); + + int resampled_size = out_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16); + if (resampled_buffer.size() < resampled_size) { + resampled_buffer.resize(resampled_size); + } + uint8_t *resampled_data = resampled_buffer.data(); + int ret = swr_convert( + swr_ctx, + &resampled_data, // output buffer + out_samples, // output buffer size + (const uint8_t **)(frame->data), // choose channel: channel_data + frame->nb_samples // input buffer size + ); + if (ret < 0) { + LOG(ERROR) << "Error resampling audio"; + break; + } + resampled_buffers.insert(resampled_buffers.end(), resampled_buffer.begin(), resampled_buffer.begin() + resampled_size); + } + } + } + av_packet_unref(packet); + } + + //avio_context_free(&avio_ctx); + av_freep(&avio_ctx ->buffer); + av_freep(&avio_ctx); + avformat_close_input(&formatContext); + avformat_free_context(formatContext); + avcodec_free_context(&codecContext); + swr_free(&swr_ctx); + av_packet_free(&packet); + av_frame_free(&frame); + + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + + speech_len = (resampled_buffers.size()) / 2; + speech_data = (float*)malloc(sizeof(float) * speech_len); + if(speech_data){ + memset(speech_data, 0, sizeof(float) * speech_len); + float scale = 1; + if (data_type == 1) { + scale = 32768.0f; + } + for (int32_t i = 0; i < speech_len; ++i) { + int16_t val = (int16_t)((resampled_buffers[2 * i + 1] << 8) | resampled_buffers[2 * i]); + speech_data[i] = (float)val / scale; + } + AudioFrame* frame = new AudioFrame(speech_len); + frame_queue.push(frame); + + return true; + }else{ + return false; + } + +#endif +} + + +bool Audio::LoadWav(const char *filename, int32_t* sampling_rate, bool resample) +{ + WaveHeader header; + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + if (speech_buff != nullptr) { + free(speech_buff); + speech_buff = nullptr; + } + + offset = 0; + std::ifstream is(filename, std::ifstream::binary); + is.read(reinterpret_cast(&header), sizeof(header)); + if(!is){ + LOG(ERROR) << "Failed to read " << filename; + return false; + } + + if (!header.Validate()) { + return false; + } + + header.SeekToDataChunk(is); + if (!is) { + return false; + } + + if (!header.Validate()) { + return false; + } + + header.SeekToDataChunk(is); + if (!is) { + return false; + } + + *sampling_rate = header.sample_rate; + // header.subchunk2_size contains the number of bytes in the data. + // As we assume each sample contains two bytes, so it is divided by 2 here + speech_len = header.subchunk2_size / 2; + speech_buff = (int16_t *)malloc(sizeof(int16_t) * speech_len); + + if (speech_buff) + { + memset(speech_buff, 0, sizeof(int16_t) * speech_len); + is.read(reinterpret_cast(speech_buff), header.subchunk2_size); + if (!is) { + LOG(ERROR) << "Failed to read " << filename; + return false; + } + speech_data = (float*)malloc(sizeof(float) * speech_len); + memset(speech_data, 0, sizeof(float) * speech_len); + + float scale = 1; + if (data_type == 1) { + scale = 32768; + } + for (int32_t i = 0; i != speech_len; ++i) { + speech_data[i] = (float)speech_buff[i] / scale; + } + + //resample + if(resample && *sampling_rate != dest_sample_rate){ + WavResample(*sampling_rate, speech_data, speech_len); + } + + AudioFrame* frame = new AudioFrame(speech_len); + frame_queue.push(frame); + + return true; + } + else + return false; +} + +bool Audio::LoadWav2Char(const char *filename, int32_t* sampling_rate) +{ + WaveHeader header; + if (speech_char != nullptr) { + free(speech_char); + speech_char = nullptr; + } + offset = 0; + std::ifstream is(filename, std::ifstream::binary); + is.read(reinterpret_cast(&header), sizeof(header)); + if(!is){ + LOG(ERROR) << "Failed to read " << filename; + return false; + } + if (!header.Validate()) { + return false; + } + header.SeekToDataChunk(is); + if (!is) { + return false; + } + if (!header.Validate()) { + return false; + } + header.SeekToDataChunk(is); + if (!is) { + return false; + } + + *sampling_rate = header.sample_rate; + // header.subchunk2_size contains the number of bytes in the data. + // As we assume each sample contains two bytes, so it is divided by 2 here + speech_len = header.subchunk2_size / 2; + speech_char = (char *)malloc(header.subchunk2_size); + memset(speech_char, 0, header.subchunk2_size); + is.read(speech_char, header.subchunk2_size); + + return true; +} + +bool Audio::LoadWav(const char* buf, int n_file_len, int32_t* sampling_rate) +{ + WaveHeader header; + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + if (speech_buff != nullptr) { + free(speech_buff); + speech_buff = nullptr; + } + + std::memcpy(&header, buf, sizeof(header)); + + *sampling_rate = header.sample_rate; + speech_len = header.subchunk2_size / 2; + speech_buff = (int16_t *)malloc(sizeof(int16_t) * speech_len); + if (speech_buff) + { + memset(speech_buff, 0, sizeof(int16_t) * speech_len); + memcpy((void*)speech_buff, (const void*)(buf + WAV_HEADER_SIZE), speech_len * sizeof(int16_t)); + + speech_data = (float*)malloc(sizeof(float) * speech_len); + memset(speech_data, 0, sizeof(float) * speech_len); + + float scale = 1; + if (data_type == 1) { + scale = 32768; + } + + for (int32_t i = 0; i != speech_len; ++i) { + speech_data[i] = (float)speech_buff[i] / scale; + } + + //resample + if(*sampling_rate != dest_sample_rate){ + WavResample(*sampling_rate, speech_data, speech_len); + } + + AudioFrame* frame = new AudioFrame(speech_len); + frame_queue.push(frame); + + return true; + } + else + return false; +} + +bool Audio::LoadPcmwav(const char* buf, int n_buf_len, int32_t* sampling_rate) +{ + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + + speech_len = n_buf_len / 2; + speech_data = (float*)malloc(sizeof(float) * speech_len); + if(speech_data){ + float scale = 1; + if (data_type == 1) { + scale = 32768.0f; + } + const uint8_t* byte_buf = reinterpret_cast(buf); + for (int32_t i = 0; i < speech_len; ++i) { + int16_t val = (int16_t)((byte_buf[2 * i + 1] << 8) | byte_buf[2 * i]); + speech_data[i] = (float)val / scale; + } + + //resample + if(*sampling_rate != dest_sample_rate){ + WavResample(*sampling_rate, speech_data, speech_len); + } + + AudioFrame* frame = new AudioFrame(speech_len); + frame_queue.push(frame); + + return true; + }else{ + return false; + } +} + +bool Audio::LoadPcmwavOnline(const char* buf, int n_buf_len, int32_t* sampling_rate) +{ + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + + speech_len = n_buf_len / 2; + speech_data = (float*)malloc(sizeof(float) * speech_len); + if(speech_data){ + float scale = 1; + if (data_type == 1) { + scale = 32768.0f; + } + const uint8_t* byte_buf = reinterpret_cast(buf); + for (int32_t i = 0; i < speech_len; ++i) { + int16_t val = (int16_t)((byte_buf[2 * i + 1] << 8) | byte_buf[2 * i]); + speech_data[i] = (float)val / scale; + } + + //resample + if(*sampling_rate != dest_sample_rate){ + WavResample(*sampling_rate, speech_data, speech_len); + } + + for (int32_t i = 0; i != speech_len; ++i) { + all_samples.emplace_back(speech_data[i]); + } + + AudioFrame* frame = new AudioFrame(speech_len); + frame_queue.push(frame); + + return true; + }else{ + return false; + } +} + +bool Audio::LoadPcmwav(const char* filename, int32_t* sampling_rate, bool resample) +{ + if (speech_data != nullptr) { + free(speech_data); + speech_data = nullptr; + } + if (speech_buff != nullptr) { + free(speech_buff); + speech_buff = nullptr; + } + offset = 0; + + FILE* fp; + fp = fopen(filename, "rb"); + if (fp == nullptr) + { + LOG(ERROR) << "Failed to read " << filename; + return false; + } + fseek(fp, 0, SEEK_END); + uint32_t n_file_len = ftell(fp); + fseek(fp, 0, SEEK_SET); + + speech_len = (n_file_len) / 2; + speech_buff = (int16_t*)malloc(sizeof(int16_t) * speech_len); + if (speech_buff) + { + memset(speech_buff, 0, sizeof(int16_t) * speech_len); + int ret = fread(speech_buff, sizeof(int16_t), speech_len, fp); + fclose(fp); + + speech_data = (float*)malloc(sizeof(float) * speech_len); + memset(speech_data, 0, sizeof(float) * speech_len); + + float scale = 1; + if (data_type == 1) { + scale = 32768; + } + for (int32_t i = 0; i != speech_len; ++i) { + speech_data[i] = (float)speech_buff[i] / scale; + } + + //resample + if(resample && *sampling_rate != dest_sample_rate){ + WavResample(*sampling_rate, speech_data, speech_len); + } + + AudioFrame* frame = new AudioFrame(speech_len); + frame_queue.push(frame); + + return true; + } + else + return false; + +} + +bool Audio::LoadPcmwav2Char(const char* filename, int32_t* sampling_rate) +{ + if (speech_char != nullptr) { + free(speech_char); + speech_char = nullptr; + } + offset = 0; + + FILE* fp; + fp = fopen(filename, "rb"); + if (fp == nullptr) + { + LOG(ERROR) << "Failed to read " << filename; + return false; + } + fseek(fp, 0, SEEK_END); + uint32_t n_file_len = ftell(fp); + fseek(fp, 0, SEEK_SET); + + speech_len = (n_file_len) / 2; + speech_char = (char *)malloc(n_file_len); + memset(speech_char, 0, n_file_len); + fread(speech_char, sizeof(int16_t), n_file_len/2, fp); + fclose(fp); + + return true; +} + +bool Audio::LoadOthers2Char(const char* filename) +{ + if (speech_char != nullptr) { + free(speech_char); + speech_char = nullptr; + } + + FILE* fp; + fp = fopen(filename, "rb"); + if (fp == nullptr) + { + LOG(ERROR) << "Failed to read " << filename; + return false; + } + fseek(fp, 0, SEEK_END); + uint32_t n_file_len = ftell(fp); + fseek(fp, 0, SEEK_SET); + + speech_len = n_file_len; + speech_char = (char *)malloc(n_file_len); + memset(speech_char, 0, n_file_len); + fread(speech_char, 1, n_file_len, fp); + fclose(fp); + + return true; +} + +int Audio::FetchTpass(AudioFrame *&frame) +{ + if (asr_offline_queue.size() > 0) { + frame = asr_offline_queue.front(); + asr_offline_queue.pop(); + return 1; + } else { + return 0; + } +} + +int Audio::FetchChunck(AudioFrame *&frame) +{ + if (asr_online_queue.size() > 0) { + frame = asr_online_queue.front(); + asr_online_queue.pop(); + return 1; + } else { + return 0; + } +} + +int Audio::Fetch(float *&dout, int &len, int &flag) +{ + if (frame_queue.size() > 0) { + AudioFrame *frame = frame_queue.front(); + frame_queue.pop(); + + dout = speech_data + frame->GetStart(); + len = frame->GetLen(); + delete frame; + flag = S_END; + return 1; + } else { + return 0; + } +} + +int Audio::Fetch(float *&dout, int &len, int &flag, float &start_time) +{ + if (frame_queue.size() > 0) { + AudioFrame *frame = frame_queue.front(); + frame_queue.pop(); + + start_time = (float)(frame->GetStart())/ dest_sample_rate; + dout = speech_data + frame->GetStart(); + len = frame->GetLen(); + delete frame; + flag = S_END; + return 1; + } else { + return 0; + } +} + +void Audio::Padding() +{ + float num_samples = speech_len; + float frame_length = 400; + float frame_shift = 160; + float num_frames = floor((num_samples + (frame_shift / 2)) / frame_shift); + float num_new_samples = (num_frames - 1) * frame_shift + frame_length; + float num_padding = num_new_samples - num_samples; + float num_left_padding = (frame_length - frame_shift) / 2; + float num_right_padding = num_padding - num_left_padding; + + float *new_data = (float *)malloc(num_new_samples * sizeof(float)); + int i; + int tmp_off = 0; + for (i = 0; i < num_left_padding; i++) { + int ii = num_left_padding - i - 1; + new_data[i] = speech_data[ii]; + } + tmp_off = num_left_padding; + memcpy(new_data + tmp_off, speech_data, speech_len * sizeof(float)); + tmp_off += speech_len; + + for (i = 0; i < num_right_padding; i++) { + int ii = speech_len - i - 1; + new_data[tmp_off + i] = speech_data[ii]; + } + free(speech_data); + speech_data = nullptr; + speech_data = new_data; + speech_len = num_new_samples; + + AudioFrame *frame = new AudioFrame(num_new_samples); + frame_queue.push(frame); + frame = frame_queue.front(); + frame_queue.pop(); + delete frame; +} + +void Audio::Split(OfflineStream* offline_stream) +{ + AudioFrame *frame; + + frame = frame_queue.front(); + frame_queue.pop(); + int sp_len = frame->GetLen(); + delete frame; + frame = nullptr; + + std::vector pcm_data(speech_data, speech_data+sp_len); + vector> vad_segments = (offline_stream->vad_handle)->Infer(pcm_data); + for(vector segment:vad_segments) + { + frame = new AudioFrame(); + int start = segment[0]*seg_sample; + int end = segment[1]*seg_sample; + frame->SetStart(start); + frame->SetEnd(end); + frame_queue.push(frame); + frame = nullptr; + } +} + +void Audio::CutSplit(OfflineStream* offline_stream) +{ + std::unique_ptr vad_online_handle = make_unique((FsmnVad*)(offline_stream->vad_handle).get()); + AudioFrame *frame; + + frame = frame_queue.front(); + frame_queue.pop(); + int sp_len = frame->GetLen(); + delete frame; + frame = nullptr; + + int step = dest_sample_rate*1; + bool is_final=false; + vector> vad_segments; + for (int sample_offset = 0; sample_offset < speech_len; sample_offset += std::min(step, speech_len - sample_offset)) { + if (sample_offset + step >= speech_len - 1) { + step = speech_len - sample_offset; + is_final = true; + } else { + is_final = false; + } + std::vector pcm_data(speech_data+sample_offset, speech_data+sample_offset+step); + vector> cut_segments = vad_online_handle->Infer(pcm_data, is_final); + vad_segments.insert(vad_segments.end(), cut_segments.begin(), cut_segments.end()); + } + + int speech_start_i = -1, speech_end_i =-1; + for(vector vad_segment:vad_segments) + { + if(vad_segment.size() != 2){ + LOG(ERROR) << "Size of vad_segment is not 2."; + break; + } + if(vad_segment[0] != -1){ + speech_start_i = vad_segment[0]; + } + if(vad_segment[1] != -1){ + speech_end_i = vad_segment[1]; + } + + if(speech_start_i!=-1 && speech_end_i!=-1){ + frame = new AudioFrame(); + int start = speech_start_i*seg_sample; + int end = speech_end_i*seg_sample; + frame->SetStart(start); + frame->SetEnd(end); + frame_queue.push(frame); + frame = nullptr; + speech_start_i=-1; + speech_end_i=-1; + } + } +} + +void Audio::Split(VadModel* vad_obj, vector>& vad_segments, bool input_finished) +{ + AudioFrame *frame; + + frame = frame_queue.front(); + frame_queue.pop(); + int sp_len = frame->GetLen(); + delete frame; + frame = nullptr; + + std::vector pcm_data(speech_data, speech_data+sp_len); + vad_segments = vad_obj->Infer(pcm_data, input_finished); +} + +// 2pass +void Audio::Split(VadModel* vad_obj, int chunk_len, bool input_finished, ASR_TYPE asr_mode) +{ + AudioFrame *frame; + + frame = frame_queue.front(); + frame_queue.pop(); + int sp_len = frame->GetLen(); + delete frame; + frame = nullptr; + + std::vector pcm_data(speech_data, speech_data+sp_len); + vector> vad_segments = vad_obj->Infer(pcm_data, input_finished); + + speech_end += sp_len/seg_sample; + if(vad_segments.size() == 0){ + if(speech_start != -1){ + int start = speech_start*seg_sample; + int end = speech_end*seg_sample; + int buff_len = end-start; + int step = chunk_len; + + if(asr_mode != ASR_OFFLINE){ + if(buff_len >= step){ + frame = new AudioFrame(step); + frame->global_start = speech_start; + frame->global_end = speech_start + step/seg_sample; + frame->data = (float*)malloc(sizeof(float) * step); + memcpy(frame->data, all_samples.data()+start-offset, step*sizeof(float)); + asr_online_queue.push(frame); + frame = nullptr; + speech_start += step/seg_sample; + } + } + } + }else{ + for(auto vad_segment: vad_segments){ + int speech_start_i=-1, speech_end_i=-1; + if(vad_segment[0] != -1){ + speech_start_i = vad_segment[0]; + } + if(vad_segment[1] != -1){ + speech_end_i = vad_segment[1]; + } + + // [1, 100] + if(speech_start_i != -1 && speech_end_i != -1){ + int start = speech_start_i*seg_sample; + int end = speech_end_i*seg_sample; + + if(asr_mode != ASR_OFFLINE){ + frame = new AudioFrame(end-start); + frame->is_final = true; + frame->global_start = speech_start_i; + frame->global_end = speech_end_i; + frame->data = (float*)malloc(sizeof(float) * (end-start)); + memcpy(frame->data, all_samples.data()+start-offset, (end-start)*sizeof(float)); + asr_online_queue.push(frame); + frame = nullptr; + } + + if(asr_mode != ASR_ONLINE){ + frame = new AudioFrame(end-start); + frame->is_final = true; + frame->global_start = speech_start_i; + frame->global_end = speech_end_i; + frame->data = (float*)malloc(sizeof(float) * (end-start)); + memcpy(frame->data, all_samples.data()+start-offset, (end-start)*sizeof(float)); + asr_offline_queue.push(frame); + frame = nullptr; + } + + speech_start = -1; + speech_offline_start = -1; + // [70, -1] + }else if(speech_start_i != -1){ + speech_start = speech_start_i; + speech_offline_start = speech_start_i; + + int start = speech_start*seg_sample; + int end = speech_end*seg_sample; + int buff_len = end-start; + int step = chunk_len; + + if(asr_mode != ASR_OFFLINE){ + if(buff_len >= step){ + frame = new AudioFrame(step); + frame->global_start = speech_start; + frame->global_end = speech_start + step/seg_sample; + frame->data = (float*)malloc(sizeof(float) * step); + memcpy(frame->data, all_samples.data()+start-offset, step*sizeof(float)); + asr_online_queue.push(frame); + frame = nullptr; + speech_start += step/seg_sample; + } + } + + }else if(speech_end_i != -1){ // [-1,100] + if(speech_start == -1 || speech_offline_start == -1){ + LOG(ERROR) <<"Vad start is null while vad end is available. Set vad start 0" ; + speech_start = 0; + } + + int start = speech_start*seg_sample; + int offline_start = speech_offline_start*seg_sample; + int end = speech_end_i*seg_sample; + int buff_len = end-start; + int step = chunk_len; + + if(asr_mode != ASR_ONLINE){ + frame = new AudioFrame(end-offline_start); + frame->is_final = true; + frame->global_start = speech_offline_start; + frame->global_end = speech_end_i; + frame->data = (float*)malloc(sizeof(float) * (end-offline_start)); + memcpy(frame->data, all_samples.data()+offline_start-offset, (end-offline_start)*sizeof(float)); + asr_offline_queue.push(frame); + frame = nullptr; + } + + if(asr_mode != ASR_OFFLINE){ + if(buff_len > 0){ + for (int sample_offset = 0; sample_offset < buff_len; sample_offset += std::min(step, buff_len - sample_offset)) { + bool is_final = false; + if (sample_offset + step >= buff_len - 1) { + step = buff_len - sample_offset; + is_final = true; + } + frame = new AudioFrame(step); + frame->is_final = is_final; + frame->global_start = (int)((start+sample_offset)/seg_sample); + frame->global_end = frame->global_start + step/seg_sample; + frame->data = (float*)malloc(sizeof(float) * step); + memcpy(frame->data, all_samples.data()+start-offset+sample_offset, step*sizeof(float)); + asr_online_queue.push(frame); + frame = nullptr; + } + }else{ + frame = new AudioFrame(0); + frame->is_final = true; + frame->global_start = speech_start; // in this case start >= end + frame->global_end = speech_end_i; + asr_online_queue.push(frame); + frame = nullptr; + } + } + speech_start = -1; + speech_offline_start = -1; + } + } + } + + // erase all_samples + int vector_cache = dest_sample_rate*2; + if(speech_offline_start == -1){ + if(all_samples.size() > vector_cache){ + int erase_num = all_samples.size() - vector_cache; + all_samples.erase(all_samples.begin(), all_samples.begin()+erase_num); + offset += erase_num; + } + }else{ + int offline_start = speech_offline_start*seg_sample; + if(offline_start-offset > vector_cache){ + int erase_num = offline_start-offset - vector_cache; + all_samples.erase(all_samples.begin(), all_samples.begin()+erase_num); + offset += erase_num; + } + } + +} + +} // namespace funasr diff --git a/runtime/onnxruntime/src/bias-lm.cpp b/runtime/onnxruntime/src/bias-lm.cpp new file mode 100644 index 0000000..a652f29 --- /dev/null +++ b/runtime/onnxruntime/src/bias-lm.cpp @@ -0,0 +1,180 @@ +#include "bias-lm.h" +#ifdef _WIN32 +#include "fst-types.cc" +#endif +namespace funasr { +void print(std::queue &q) { + std::queue data = q; + while (!data.empty()) + { + cout << data.front() << " "; + data.pop(); + } + cout << endl; +} + +void BiasLm::LoadCfgFromYaml(const char* filename, BiasLmOption &opt) { + YAML::Node config; + try { + config = YAML::LoadFile(filename); + } catch(exception const &e) { + LOG(INFO) << "Error loading file, yaml file error or not exist."; + exit(-1); + } + try { + YAML::Node bias_lm_conf = config["bias_lm_conf"]; + opt_.incre_bias_ = bias_lm_conf["increment_weight"].as(); + } catch(exception const &e) { + } +} + +void BiasLm::BuildGraph(std::vector> &split_id_vec, + std::vector &custom_weight) { + if (split_id_vec.empty()) { + LOG(INFO) << "Skip building biaslm graph, hotword not exits."; + return ; + } + assert(split_id_vec.size() == custom_weight.size()); + // Build prefix tree + std::unique_ptr prefix_tree(new fst::StdVectorFst()); + StateId start_state = prefix_tree->AddState(); + prefix_tree->SetStart(start_state); + int id = 0; + for (auto& x : split_id_vec) { + StateId state = start_state; + StateId next_state = state; + float w = custom_weight[id++]; + std::vector split_id = x; + for (int j = 0; j < split_id.size(); j++) { + next_state = prefix_tree->AddState(); + if (j == split_id.size() - 1) { + prefix_tree->SetFinal(next_state, w); + } + prefix_tree->AddArc(state, Arc(split_id[j], split_id[j], opt_.incre_bias_, next_state)); + state = next_state; + } + } + graph_ = std::unique_ptr(new fst::StdVectorFst()); + fst::Determinize(*prefix_tree, graph_.get()); + + int num_node = graph_->NumStates(); + node_list_.resize(num_node); + for (auto& x : split_id_vec) { + StateId cur_state = 0; + StateId next_state = 0; + std::vector split_id = x; + for (int j = 0; j < split_id.size(); j++) { + Matcher matcher(*graph_, fst::MATCH_INPUT); + matcher.SetState(cur_state); + if (matcher.Find(split_id[j])) { + next_state = matcher.Value().nextstate; + if (graph_->Final(next_state) != Weight::Zero()) { + node_list_[next_state].is_final_ = true; + } + node_list_[next_state].score_ = opt_.incre_bias_ * (j + 1); + cur_state = next_state; + } + } + } + + // Build Aho-Corasick Automata + std::queue q; + Matcher matcher(*graph_, fst::MATCH_INPUT); + // Back off state of all child nodes of the root node points to the root node + for (ArcIterator aiter(*graph_, start_state); !aiter.Done(); aiter.Next()) { + const Arc& arc = aiter.Value(); + node_list_[arc.nextstate].back_off_ = start_state; + float back_off_score = (node_list_[arc.nextstate].is_final_ ? 0 : + node_list_[start_state].score_ - node_list_[arc.nextstate].score_); + graph_->AddArc(arc.nextstate, Arc(0, 0, back_off_score, start_state)); + q.push(arc.nextstate); + } + while (!q.empty()) { + StateId state_id = q.front(); + q.pop(); + for (ArcIterator aiter(*graph_, state_id); !aiter.Done(); aiter.Next()) { + const Arc& arc = aiter.Value(); + StateId next_state = arc.nextstate; + StateId temp_state = node_list_[state_id].back_off_; + if (next_state == start_state || next_state == temp_state) { + continue; + } + while (true) { + matcher.SetState(temp_state); + if (matcher.Find(arc.ilabel)) { + node_list_[next_state].back_off_ = matcher.Value().nextstate; + break; + } else if (temp_state == start_state) { + node_list_[next_state].back_off_ = start_state; + break; + } + temp_state = node_list_[temp_state].back_off_; + } + float back_off_score = (node_list_[next_state].is_final_ ? 0 : + node_list_[node_list_[next_state].back_off_].score_ - + node_list_[next_state].score_); + graph_->AddArc(next_state, Arc(0, 0, back_off_score, + node_list_[next_state].back_off_)); + q.push(next_state); + } + } + fst::ArcSort(graph_.get(), fst::StdILabelCompare()); + //graph_->Write("graph.final.fst"); +} + +float BiasLm::BiasLmScore(const StateId &his_state, const Label &lab, Label &new_state) { + if (lab < 1 || lab > phn_set_.Size() || !graph_) { return VALUE_ZERO; } + StateId cur_state = his_state; + StateId next_state; + float score = VALUE_ZERO; + Matcher matcher(*graph_, fst::MATCH_INPUT); + while (true) { + StateId prev_state = cur_state; + matcher.SetState(cur_state); + if (matcher.Find(lab)) { + next_state = matcher.Value().nextstate; + score += matcher.Value().weight.Value(); + if (node_list_[next_state].is_final_) { + score = score + graph_->Final(next_state).Value(); + } + cur_state = next_state; + break; + } else { + ArcIterator aiter(*graph_, cur_state); + const Arc& arc = aiter.Value(); + if (arc.ilabel == 0) { + score += arc.weight.Value(); + next_state = arc.nextstate; + cur_state = next_state; + } + if (prev_state == ROOT_NODE && cur_state == ROOT_NODE) { + break; + } + } + } + new_state = cur_state; + return score; +} + +void BiasLm::VocabIdToPhnIdVector(int vocab_id, std::vector &phn_ids) { + bool is_oov = false; + phn_ids.clear(); + std::string word = vocab_.Id2String(vocab_id); + std::vector phn_vec; + Utf8ToCharset(word, phn_vec); + for (auto& phn : phn_vec) { + if (!phn_set_.Find(phn)) { + is_oov = true; + break; + } else { + phn_ids.push_back(phn_set_.String2Id(phn)); + } + } + if (is_oov) { phn_ids.clear(); } +} + +std::string BiasLm::GetPhoneLabel(int phone_id) { + if (phone_id < 0 || phone_id >= phn_set_.Size()) { return ""; } + return phn_set_.Id2String(phone_id); +} +} diff --git a/runtime/onnxruntime/src/bias-lm.h b/runtime/onnxruntime/src/bias-lm.h new file mode 100644 index 0000000..ddaf3e4 --- /dev/null +++ b/runtime/onnxruntime/src/bias-lm.h @@ -0,0 +1,150 @@ +#ifndef BIAS_LM_ +#define BIAS_LM_ +#include +#include "util.h" +#include "fst/fstlib.h" +#include "phone-set.h" +#include "vocab.h" +#include "util/text-utils.h" +#include +#ifdef _WIN32 +#include "win_func.h" +#endif +// node type +#define ROOT_NODE 0 +#define VALUE_ZERO 0.0f + +namespace funasr { +typedef fst::StdArc Arc; +typedef typename Arc::StateId StateId; +typedef typename Arc::Weight Weight; +typedef typename Arc::Label Label; +typedef typename fst::SortedMatcher Matcher; +typedef typename fst::ArcIterator ArcIterator; + +class Node { + public: + Node() : score_(0.0f), is_final_(false), back_off_(-1) {} + float score_; + bool is_final_; + StateId back_off_; +}; + +class BiasLmOption { + public: + BiasLmOption() : incre_bias_(20.0f), scale_(1.0f) {} + float incre_bias_; + float scale_; +}; + +class BiasLm { + public: + BiasLm(const string &hws_file, const string &cfg_file, + const PhoneSet& phn_set, const Vocab& vocab) : + phn_set_(phn_set), vocab_(vocab) { + std::string line; + std::ifstream ifs_hws(hws_file.c_str()); + std::vector custom_weight; + std::vector> split_id_vec; + + struct timeval start, end; + gettimeofday(&start, nullptr); + + LoadCfgFromYaml(cfg_file.c_str(), opt_); + while (getline(ifs_hws, line)) { + Trim(&line); + if (line.empty()) { + continue; + } + float score = 1.0f; + bool is_oov = false; + std::vector text; + std::vector split_str; + std::vector split_id; + SplitStringToVector(line, "\t", true, &text); + if (text.size() > 1) { + score = std::stof(text[1]); + } + SplitChiEngCharacters(text[0], split_str); + for (auto &str : split_str) { + std::vector lex_vec; + std::string lex_str = vocab_.Word2Lex(str); + SplitStringToVector(lex_str, " ", true, &lex_vec); + for (auto &token : lex_vec) { + split_id.push_back(phn_set_.String2Id(token)); + if (!phn_set_.Find(token)) { + is_oov = true; + break; + } + } + } + if (!is_oov) { + split_id_vec.push_back(split_id); + custom_weight.push_back(score); + } + } + BuildGraph(split_id_vec, custom_weight); + ifs_hws.close(); + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Build bias lm takes " << (double)modle_init_micros / 1000000 << " s"; + } + + BiasLm(unordered_map &hws_map, int inc_bias, + const PhoneSet& phn_set, const Vocab& vocab) : + phn_set_(phn_set), vocab_(vocab) { + std::vector custom_weight; + std::vector> split_id_vec; + + struct timeval start, end; + gettimeofday(&start, nullptr); + opt_.incre_bias_ = inc_bias; + for (const pair& kv : hws_map) { + float score = 1.0f; + bool is_oov = false; + std::vector text; + std::vector split_str; + std::vector split_id; + score = kv.second; + SplitChiEngCharacters(kv.first, split_str); + for (auto &str : split_str) { + std::vector lex_vec; + std::string lex_str = vocab_.Word2Lex(str); + SplitStringToVector(lex_str, " ", true, &lex_vec); + for (auto &token : lex_vec) { + split_id.push_back(phn_set_.String2Id(token)); + if (!phn_set_.Find(token)) { + is_oov = true; + break; + } + } + } + if (!is_oov) { + split_id_vec.push_back(split_id); + custom_weight.push_back(score); + } + } + BuildGraph(split_id_vec, custom_weight); + + gettimeofday(&end, nullptr); + long seconds = (end.tv_sec - start.tv_sec); + long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); + LOG(INFO) << "Build bias lm takes " << (double)modle_init_micros / 1000000 << " s"; + } + + void BuildGraph(std::vector> &vec, std::vector &wts); + float BiasLmScore(const StateId &cur_state, const Label &lab, Label &new_state); + void VocabIdToPhnIdVector(int vocab_id, std::vector &phn_ids); + void LoadCfgFromYaml(const char* filename, BiasLmOption &opt); + std::string GetPhoneLabel(int phone_id); + private: + const PhoneSet& phn_set_; + const Vocab& vocab_; + std::unique_ptr graph_ = nullptr; + std::vector node_list_; + BiasLmOption opt_; +}; +} // namespace funasr +#endif // BIAS_LM_ diff --git a/runtime/onnxruntime/src/common-struct.h b/runtime/onnxruntime/src/common-struct.h new file mode 100644 index 0000000..538d38b --- /dev/null +++ b/runtime/onnxruntime/src/common-struct.h @@ -0,0 +1,6 @@ + +#ifndef COMMONSTRUCT_H +#define COMMONSTRUCT_H + + +#endif diff --git a/runtime/onnxruntime/src/commonfunc.h b/runtime/onnxruntime/src/commonfunc.h new file mode 100644 index 0000000..3449ebc --- /dev/null +++ b/runtime/onnxruntime/src/commonfunc.h @@ -0,0 +1,83 @@ +#pragma once +#include +#ifdef _WIN32 +#include +#endif + +namespace funasr { +typedef struct +{ + std::string msg; + std::string stamp; + std::string stamp_sents; + std::string tpass_msg; + float snippet_time; +}FUNASR_RECOG_RESULT; + +typedef struct +{ + std::vector>* segments; + float snippet_time; +}FUNASR_VAD_RESULT; + +typedef struct +{ + string msg; + vector arr_cache; +}FUNASR_PUNC_RESULT; + +#ifdef _WIN32 + +#define ORTSTRING(str) StrToWstr(str) +#define ORTCHAR(str) StrToWstr(str).c_str() + +inline std::wstring String2wstring(const std::string& str, const std::string& locale) +{ + typedef std::codecvt_byname F; + std::wstring_convert strCnv(new F(locale)); + return strCnv.from_bytes(str); +} + +inline std::wstring StrToWstr(std::string str) { + if (str.length() == 0) + return L""; + return String2wstring(str, "zh-CN"); + +} + +#else + +#define ORTSTRING(str) str +#define ORTCHAR(str) str + +#endif + + + +inline void GetInputName(Ort::Session* session, string& inputName,int nIndex=0) { + size_t numInputNodes = session->GetInputCount(); + if (numInputNodes > 0) { + Ort::AllocatorWithDefaultOptions allocator; + { + auto t = session->GetInputNameAllocated(nIndex, allocator); + inputName = t.get(); + } + } +} + +inline void GetOutputName(Ort::Session* session, string& outputName, int nIndex = 0) { + size_t numOutputNodes = session->GetOutputCount(); + if (numOutputNodes > 0) { + Ort::AllocatorWithDefaultOptions allocator; + { + auto t = session->GetOutputNameAllocated(nIndex, allocator); + outputName = t.get(); + } + } +} + +template +inline static size_t Argmax(ForwardIterator first, ForwardIterator last) { + return std::distance(first, std::max_element(first, last)); +} +} // namespace funasr diff --git a/runtime/onnxruntime/src/ct-transformer-online.cpp b/runtime/onnxruntime/src/ct-transformer-online.cpp new file mode 100644 index 0000000..92fe41e --- /dev/null +++ b/runtime/onnxruntime/src/ct-transformer-online.cpp @@ -0,0 +1,283 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#include "precomp.h" + +namespace funasr { +CTTransformerOnline::CTTransformerOnline() +:env_(ORT_LOGGING_LEVEL_ERROR, ""),session_options{} +{ +} + +void CTTransformerOnline::InitPunc(const std::string &punc_model, const std::string &punc_config, const std::string &token_file, int thread_num){ + session_options.SetIntraOpNumThreads(thread_num); + session_options.SetGraphOptimizationLevel(ORT_ENABLE_ALL); + session_options.DisableCpuMemArena(); + + try{ + m_session = std::make_unique(env_, ORTSTRING(punc_model).c_str(), session_options); + LOG(INFO) << "Successfully load model from " << punc_model; + } + catch (std::exception const &e) { + LOG(ERROR) << "Error when load punc onnx model: " << e.what(); + exit(-1); + } + // read inputnames outputnames + string strName; + GetInputName(m_session.get(), strName); + m_strInputNames.push_back(strName.c_str()); + GetInputName(m_session.get(), strName, 1); + m_strInputNames.push_back(strName); + GetInputName(m_session.get(), strName, 2); + m_strInputNames.push_back(strName); + GetInputName(m_session.get(), strName, 3); + m_strInputNames.push_back(strName); + + GetOutputName(m_session.get(), strName); + m_strOutputNames.push_back(strName); + + for (auto& item : m_strInputNames) + m_szInputNames.push_back(item.c_str()); + for (auto& item : m_strOutputNames) + m_szOutputNames.push_back(item.c_str()); + + m_tokenizer.OpenYaml(punc_config.c_str(), token_file.c_str()); +} + +CTTransformerOnline::~CTTransformerOnline() +{ +} + +string CTTransformerOnline::AddPunc(const char* sz_input, vector &arr_cache, std::string language) +{ + string strResult; + vector strOut; + vector InputData; + string strText; //full_text + strText = accumulate(arr_cache.begin(), arr_cache.end(), strText); + strText += sz_input; // full_text = precache + text + m_tokenizer.Tokenize(strText.c_str(), strOut, InputData); + + int nTotalBatch = ceil((float)InputData.size() / TOKEN_LEN); + int nCurBatch = -1; + int nSentEnd = -1, nLastCommaIndex = -1; + vector RemainIDs; // + vector RemainStr; // + vector new_mini_sentence_punc; // sentence_punc_list = [] + vector sentenceOut; // sentenceOut + vector sentence_punc_list,sentence_words_list,sentence_punc_list_out; // sentence_words_list = [] + + int nSkipNum = 0; + int nDiff = 0; + for (size_t i = 0; i < InputData.size(); i += TOKEN_LEN) + { + nDiff = (i + TOKEN_LEN) < InputData.size() ? (0) : (i + TOKEN_LEN - InputData.size()); + vector InputIDs(InputData.begin() + i, InputData.begin() + i + (TOKEN_LEN - nDiff)); + vector InputStr(strOut.begin() + i, strOut.begin() + i + (TOKEN_LEN - nDiff)); + InputIDs.insert(InputIDs.begin(), RemainIDs.begin(), RemainIDs.end()); // RemainIDs+InputIDs; + InputStr.insert(InputStr.begin(), RemainStr.begin(), RemainStr.end()); // RemainStr+InputStr; + + auto Punction = Infer(InputIDs, arr_cache.size()); + nCurBatch = i / TOKEN_LEN; + if (nCurBatch < nTotalBatch - 1) // not the last minisetence + { + nSentEnd = -1; + nLastCommaIndex = -1; + for (int nIndex = Punction.size() - 2; nIndex > 0; nIndex--) + { + if (m_tokenizer.Id2Punc(Punction[nIndex]) == m_tokenizer.Id2Punc(PERIOD_INDEX) || m_tokenizer.Id2Punc(Punction[nIndex]) == m_tokenizer.Id2Punc(QUESTION_INDEX)) + { + nSentEnd = nIndex; + break; + } + if (nLastCommaIndex < 0 && m_tokenizer.Id2Punc(Punction[nIndex]) == m_tokenizer.Id2Punc(COMMA_INDEX)) + { + nLastCommaIndex = nIndex; + } + } + if (nSentEnd < 0 && InputStr.size() > CACHE_POP_TRIGGER_LIMIT && nLastCommaIndex > 0) + { + nSentEnd = nLastCommaIndex; + Punction[nSentEnd] = PERIOD_INDEX; + } + RemainStr.assign(InputStr.begin() + (nSentEnd + 1), InputStr.end()); + RemainIDs.assign(InputIDs.begin() + (nSentEnd + 1), InputIDs.end()); + InputStr.assign(InputStr.begin(), InputStr.begin() + (nSentEnd + 1)); // minit_sentence + Punction.assign(Punction.begin(), Punction.begin() + (nSentEnd + 1)); + } + + for (auto& item : Punction) + { + sentence_punc_list.push_back(m_tokenizer.Id2Punc(item)); + } + + sentence_words_list.insert(sentence_words_list.end(), InputStr.begin(), InputStr.end()); + + new_mini_sentence_punc.insert(new_mini_sentence_punc.end(), Punction.begin(), Punction.end()); + } + vector WordWithPunc; + for (int i = 0; i < sentence_words_list.size(); i++) // for i in range(0, len(sentence_words_list)): + { + if (!(sentence_words_list[i][0] & 0x80) && (i + 1) < sentence_words_list.size() && !(sentence_words_list[i + 1][0] & 0x80)) + { + sentence_words_list[i] = " " + sentence_words_list[i]; + } + if (nSkipNum < arr_cache.size()) // if skip_num < len(cache): + nSkipNum++; + else + WordWithPunc.push_back(sentence_words_list[i]); + + if (nSkipNum >= arr_cache.size()) + { + sentence_punc_list_out.push_back(sentence_punc_list[i]); + if (sentence_punc_list[i] != NOTPUNC) + { + WordWithPunc.push_back(sentence_punc_list[i]); + } + } + } + + sentenceOut.insert(sentenceOut.end(), WordWithPunc.begin(), WordWithPunc.end()); // + nSentEnd = -1; + for (int i = sentence_punc_list.size() - 2; i > 0; i--) + { + if (new_mini_sentence_punc[i] == PERIOD_INDEX || new_mini_sentence_punc[i] == QUESTION_INDEX) + { + nSentEnd = i; + break; + } + } + arr_cache.assign(sentence_words_list.begin() + (nSentEnd + 1), sentence_words_list.end()); + + if (sentenceOut.size() > 0 && m_tokenizer.IsPunc(sentenceOut[sentenceOut.size() - 1])) + { + sentenceOut.assign(sentenceOut.begin(), sentenceOut.end() - 1); + sentence_punc_list_out[sentence_punc_list_out.size() - 1] = m_tokenizer.Id2Punc(NOTPUNC_INDEX); + } + return accumulate(sentenceOut.begin(), sentenceOut.end(), string("")); +} + +vector CTTransformerOnline::Infer(vector input_data, int nCacheSize) +{ + Ort::MemoryInfo m_memoryInfo = Ort::MemoryInfo::CreateCpu(OrtArenaAllocator, OrtMemTypeDefault); + vector punction; + std::array input_shape_{ 1, (int64_t)input_data.size()}; + Ort::Value onnx_input = Ort::Value::CreateTensor( + m_memoryInfo, + input_data.data(), + input_data.size() * sizeof(int32_t), + input_shape_.data(), + input_shape_.size(), ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32); + + std::array text_lengths{ (int32_t)input_data.size() }; + std::array text_lengths_dim{ 1 }; + Ort::Value onnx_text_lengths = Ort::Value::CreateTensor( + m_memoryInfo, + text_lengths.data(), + text_lengths.size(), + text_lengths_dim.data(), + text_lengths_dim.size()); //, ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32); + + //vad_mask + // vector arVadMask,arSubMask; + vector arVadMask; + int nTextLength = input_data.size(); + + VadMask(nTextLength, nCacheSize, arVadMask); + // Triangle(nTextLength, arSubMask); + std::array VadMask_Dim{ 1,1, nTextLength ,nTextLength }; + Ort::Value onnx_vad_mask = Ort::Value::CreateTensor( + m_memoryInfo, + arVadMask.data(), + arVadMask.size(), // * sizeof(float), + VadMask_Dim.data(), + VadMask_Dim.size()); // , ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT); + //sub_masks + + std::array SubMask_Dim{ 1,1, nTextLength ,nTextLength }; + Ort::Value onnx_sub_mask = Ort::Value::CreateTensor( + m_memoryInfo, + arVadMask.data(), + arVadMask.size(), + SubMask_Dim.data(), + SubMask_Dim.size()); // , ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT); + + std::vector input_onnx; + input_onnx.emplace_back(std::move(onnx_input)); + input_onnx.emplace_back(std::move(onnx_text_lengths)); + input_onnx.emplace_back(std::move(onnx_vad_mask)); + input_onnx.emplace_back(std::move(onnx_sub_mask)); + + try { + auto outputTensor = m_session->Run(Ort::RunOptions{nullptr}, m_szInputNames.data(), input_onnx.data(), m_szInputNames.size(), m_szOutputNames.data(), m_szOutputNames.size()); + std::vector outputShape = outputTensor[0].GetTensorTypeAndShapeInfo().GetShape(); + + int64_t outputCount = std::accumulate(outputShape.begin(), outputShape.end(), 1, std::multiplies()); + float * floatData = outputTensor[0].GetTensorMutableData(); + + for (int i = 0; i < outputCount; i += CANDIDATE_NUM) + { + int index = Argmax(floatData + i, floatData + i + CANDIDATE_NUM-1); + punction.push_back(index); + } + } + catch (std::exception const &e) + { + LOG(ERROR) << "Error when run punc onnx forword: " << (e.what()); + } + return punction; +} + +void CTTransformerOnline::VadMask(int nSize, int vad_pos, vector& Result) +{ + Result.resize(0); + Result.assign(nSize * nSize, 1); + if (vad_pos <= 0 || vad_pos >= nSize) + { + return; + } + for (int i = 0; i < vad_pos-1; i++) + { + for (int j = vad_pos; j < nSize; j++) + { + Result[i * nSize + j] = 0.0f; + } + } +} + +void CTTransformerOnline::Triangle(int text_length, vector& Result) +{ + Result.resize(0); + Result.assign(text_length * text_length,1); // generate a zeros: text_length x text_length + + for (int i = 0; i < text_length; i++) // rows + { + for (int j = i+1; j& In,int nRows, int nCols) +{ + vector Out; + Out.resize(nRows * nCols); + int i = 0; + for (int j = 0; j < nCols; j++) { + for (; i < nRows * nCols; i++) { + Out[i] = In[j + nCols * (i % nRows)]; + if ((i + 1) % nRows == 0) { + i++; + break; + } + } + } + In = Out; +} + +} // namespace funasr diff --git a/runtime/onnxruntime/src/ct-transformer-online.h b/runtime/onnxruntime/src/ct-transformer-online.h new file mode 100644 index 0000000..13f40a0 --- /dev/null +++ b/runtime/onnxruntime/src/ct-transformer-online.h @@ -0,0 +1,37 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#pragma once + +namespace funasr { +class CTTransformerOnline : public PuncModel { +/** + * Author: Speech Lab of DAMO Academy, Alibaba Group + * CT-Transformer: Controllable time-delay transformer for real-time punctuation prediction and disfluency detection + * https://arxiv.org/pdf/2003.01309.pdf +*/ + +private: + + CTokenizer m_tokenizer; + vector m_strInputNames, m_strOutputNames; + vector m_szInputNames; + vector m_szOutputNames; + + std::shared_ptr m_session; + Ort::Env env_; + Ort::SessionOptions session_options; +public: + + CTTransformerOnline(); + void InitPunc(const std::string &punc_model, const std::string &punc_config, const std::string &token_file, int thread_num); + ~CTTransformerOnline(); + vector Infer(vector input_data, int nCacheSize); + string AddPunc(const char* sz_input, vector &arr_cache, std::string language="zh-cn"); + void Transport(vector& In, int nRows, int nCols); + void VadMask(int size, int vad_pos,vector& Result); + void Triangle(int text_length, vector& Result); +}; +} // namespace funasr \ No newline at end of file diff --git a/runtime/onnxruntime/src/ct-transformer.cpp b/runtime/onnxruntime/src/ct-transformer.cpp new file mode 100644 index 0000000..d1a7813 --- /dev/null +++ b/runtime/onnxruntime/src/ct-transformer.cpp @@ -0,0 +1,212 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#include "precomp.h" + +namespace funasr { +CTTransformer::CTTransformer() +:env_(ORT_LOGGING_LEVEL_ERROR, ""),session_options{} +{ +} + +void CTTransformer::InitPunc(const std::string &punc_model, const std::string &punc_config, const std::string &token_file, int thread_num){ + session_options.SetIntraOpNumThreads(thread_num); + session_options.SetGraphOptimizationLevel(ORT_ENABLE_ALL); + session_options.DisableCpuMemArena(); + + try{ + m_session = std::make_unique(env_, ORTSTRING(punc_model).c_str(), session_options); + LOG(INFO) << "Successfully load model from " << punc_model; + } + catch (std::exception const &e) { + LOG(ERROR) << "Error when load punc onnx model: " << e.what(); + exit(-1); + } + // read inputnames outputnames + string strName; + GetInputName(m_session.get(), strName); + m_strInputNames.push_back(strName.c_str()); + GetInputName(m_session.get(), strName, 1); + m_strInputNames.push_back(strName); + + GetOutputName(m_session.get(), strName); + m_strOutputNames.push_back(strName); + + for (auto& item : m_strInputNames) + m_szInputNames.push_back(item.c_str()); + for (auto& item : m_strOutputNames) + m_szOutputNames.push_back(item.c_str()); + + m_tokenizer.OpenYaml(punc_config.c_str(), token_file.c_str()); + m_tokenizer.JiebaInit(punc_config); +} + +CTTransformer::~CTTransformer() +{ +} + +string CTTransformer::AddPunc(const char* sz_input, std::string language) +{ + string strResult; + vector strOut; + vector InputData; + m_tokenizer.Tokenize(sz_input, strOut, InputData); + + int nTotalBatch = ceil((float)InputData.size() / TOKEN_LEN); + int nCurBatch = -1; + int nSentEnd = -1, nLastCommaIndex = -1; + vector RemainIDs; // + vector RemainStr; // + vector NewPunctuation; // + vector NewString; // + vector NewSentenceOut; + vector NewPuncOut; + int nDiff = 0; + for (size_t i = 0; i < InputData.size(); i += TOKEN_LEN) + { + nDiff = (i + TOKEN_LEN) < InputData.size() ? (0) : (i + TOKEN_LEN - InputData.size()); + vector InputIDs(InputData.begin() + i, InputData.begin() + i + (TOKEN_LEN - nDiff)); + vector InputStr(strOut.begin() + i, strOut.begin() + i + (TOKEN_LEN - nDiff)); + InputIDs.insert(InputIDs.begin(), RemainIDs.begin(), RemainIDs.end()); // RemainIDs+InputIDs; + InputStr.insert(InputStr.begin(), RemainStr.begin(), RemainStr.end()); // RemainStr+InputStr; + + auto Punction = Infer(InputIDs); + nCurBatch = i / TOKEN_LEN; + if (nCurBatch < nTotalBatch - 1) // not the last minisetence + { + nSentEnd = -1; + nLastCommaIndex = -1; + for (int nIndex = Punction.size() - 2; nIndex > 0; nIndex--) + { + if (m_tokenizer.Id2Punc(Punction[nIndex]) == m_tokenizer.Id2Punc(PERIOD_INDEX) || m_tokenizer.Id2Punc(Punction[nIndex]) == m_tokenizer.Id2Punc(QUESTION_INDEX)) + { + nSentEnd = nIndex; + break; + } + if (nLastCommaIndex < 0 && m_tokenizer.Id2Punc(Punction[nIndex]) == m_tokenizer.Id2Punc(COMMA_INDEX)) + { + nLastCommaIndex = nIndex; + } + } + if (nSentEnd < 0 && InputStr.size() > CACHE_POP_TRIGGER_LIMIT && nLastCommaIndex > 0) + { + nSentEnd = nLastCommaIndex; + Punction[nSentEnd] = PERIOD_INDEX; + } + RemainStr.assign(InputStr.begin() + (nSentEnd + 1), InputStr.end()); + RemainIDs.assign(InputIDs.begin() + (nSentEnd + 1), InputIDs.end()); + InputStr.assign(InputStr.begin(), InputStr.begin() + (nSentEnd + 1)); // minit_sentence + Punction.assign(Punction.begin(), Punction.begin() + (nSentEnd + 1)); + } + + NewPunctuation.insert(NewPunctuation.end(), Punction.begin(), Punction.end()); + vector WordWithPunc; + for (int i = 0; i < InputStr.size(); i++) + { + // if (i > 0 && !(InputStr[i][0] & 0x80) && (i + 1) 0 && !(InputStr[i-1][0] & 0x80) && !(InputStr[i][0] & 0x80)) + { + InputStr[i] = " " + InputStr[i]; + } + WordWithPunc.push_back(InputStr[i]); + + if (Punction[i] != NOTPUNC_INDEX) // �»��� + { + WordWithPunc.push_back(m_tokenizer.Id2Punc(Punction[i])); + } + } + + NewString.insert(NewString.end(), WordWithPunc.begin(), WordWithPunc.end()); // new_mini_sentence += "".join(words_with_punc) + NewSentenceOut = NewString; + NewPuncOut = NewPunctuation; + // last mini sentence + if(nCurBatch == nTotalBatch - 1) + { + if (NewString[NewString.size() - 1] == m_tokenizer.Id2Punc(COMMA_INDEX) || NewString[NewString.size() - 1] == m_tokenizer.Id2Punc(DUN_INDEX)) + { + NewSentenceOut.assign(NewString.begin(), NewString.end() - 1); + NewSentenceOut.push_back(m_tokenizer.Id2Punc(PERIOD_INDEX)); + NewPuncOut.assign(NewPunctuation.begin(), NewPunctuation.end() - 1); + NewPuncOut.push_back(PERIOD_INDEX); + } + else if (NewString[NewString.size() - 1] != m_tokenizer.Id2Punc(PERIOD_INDEX) && NewString[NewString.size() - 1] != m_tokenizer.Id2Punc(QUESTION_INDEX)) + { + NewSentenceOut = NewString; + NewSentenceOut.push_back(m_tokenizer.Id2Punc(PERIOD_INDEX)); + NewPuncOut = NewPunctuation; + NewPuncOut.push_back(PERIOD_INDEX); + } + } + } + + for (auto& item : NewSentenceOut){ + strResult += item; + } + + if(language == "en-bpe"){ + std::vector chineseSymbols; + chineseSymbols.push_back(","); + chineseSymbols.push_back("。"); + chineseSymbols.push_back("、"); + chineseSymbols.push_back("?"); + + std::string englishSymbols = ",.,?"; + for (size_t i = 0; i < chineseSymbols.size(); i++) { + size_t pos = 0; + while ((pos = strResult.find(chineseSymbols[i], pos)) != std::string::npos) { + strResult.replace(pos, 3, 1, englishSymbols[i]); + pos++; + } + } + } + + return strResult; +} + +vector CTTransformer::Infer(vector input_data) +{ + Ort::MemoryInfo m_memoryInfo = Ort::MemoryInfo::CreateCpu(OrtArenaAllocator, OrtMemTypeDefault); + vector punction; + std::array input_shape_{ 1, (int64_t)input_data.size()}; + Ort::Value onnx_input = Ort::Value::CreateTensor( + m_memoryInfo, + input_data.data(), + input_data.size(), + input_shape_.data(), + input_shape_.size()); + + std::array text_lengths{ (int32_t)input_data.size() }; + std::array text_lengths_dim{ 1 }; + Ort::Value onnx_text_lengths = Ort::Value::CreateTensor( + m_memoryInfo, + text_lengths.data(), + text_lengths.size() * sizeof(int32_t), + text_lengths_dim.data(), + text_lengths_dim.size(), ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32); + std::vector input_onnx; + input_onnx.emplace_back(std::move(onnx_input)); + input_onnx.emplace_back(std::move(onnx_text_lengths)); + + try { + auto outputTensor = m_session->Run(Ort::RunOptions{nullptr}, m_szInputNames.data(), input_onnx.data(), m_szInputNames.size(), m_szOutputNames.data(), m_szOutputNames.size()); + std::vector outputShape = outputTensor[0].GetTensorTypeAndShapeInfo().GetShape(); + + int64_t outputCount = std::accumulate(outputShape.begin(), outputShape.end(), 1, std::multiplies()); + float * floatData = outputTensor[0].GetTensorMutableData(); + + for (int i = 0; i < outputCount; i += CANDIDATE_NUM) + { + int index = Argmax(floatData + i, floatData + i + CANDIDATE_NUM-1); + punction.push_back(index); + } + } + catch (std::exception const &e) + { + LOG(ERROR) << "Error when run punc onnx forword: " << (e.what()); + } + return punction; +} + +} // namespace funasr diff --git a/runtime/onnxruntime/src/ct-transformer.h b/runtime/onnxruntime/src/ct-transformer.h new file mode 100644 index 0000000..f38fe12 --- /dev/null +++ b/runtime/onnxruntime/src/ct-transformer.h @@ -0,0 +1,34 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#pragma once + +namespace funasr { +class CTTransformer : public PuncModel { +/** + * Author: Speech Lab of DAMO Academy, Alibaba Group + * CT-Transformer: Controllable time-delay transformer for real-time punctuation prediction and disfluency detection + * https://arxiv.org/pdf/2003.01309.pdf +*/ + +private: + + CTokenizer m_tokenizer; + vector m_strInputNames, m_strOutputNames; + vector m_szInputNames; + vector m_szOutputNames; + + std::shared_ptr m_session; + Ort::Env env_; + Ort::SessionOptions session_options; +public: + + CTTransformer(); + void InitPunc(const std::string &punc_model, const std::string &punc_config, const std::string &token_file, int thread_num); + ~CTTransformer(); + vector Infer(vector input_data); + string AddPunc(const char* sz_input, std::string language="zh-cn"); +}; +} // namespace funasr \ No newline at end of file diff --git a/runtime/onnxruntime/src/e2e-vad.h b/runtime/onnxruntime/src/e2e-vad.h new file mode 100644 index 0000000..a887db4 --- /dev/null +++ b/runtime/onnxruntime/src/e2e-vad.h @@ -0,0 +1,785 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) + * Contributed by zhuzizyf(China Telecom). +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace funasr { +enum class VadStateMachine { + kVadInStateStartPointNotDetected = 1, + kVadInStateInSpeechSegment = 2, + kVadInStateEndPointDetected = 3 +}; + +enum class FrameState { + kFrameStateInvalid = -1, + kFrameStateSpeech = 1, + kFrameStateSil = 0 +}; + +// final voice/unvoice state per frame +enum class AudioChangeState { + kChangeStateSpeech2Speech = 0, + kChangeStateSpeech2Sil = 1, + kChangeStateSil2Sil = 2, + kChangeStateSil2Speech = 3, + kChangeStateNoBegin = 4, + kChangeStateInvalid = 5 +}; + +enum class VadDetectMode { + kVadSingleUtteranceDetectMode = 0, + kVadMutipleUtteranceDetectMode = 1 +}; + +class VADXOptions { +public: + int sample_rate; + int detect_mode; + int snr_mode; + int max_end_silence_time; + int max_start_silence_time; + bool do_start_point_detection; + bool do_end_point_detection; + int window_size_ms; + int sil_to_speech_time_thres; + int speech_to_sil_time_thres; + float speech_2_noise_ratio; + int do_extend; + int lookback_time_start_point; + int lookahead_time_end_point; + int max_single_segment_time; + int nn_eval_block_size; + int dcd_block_size; + float snr_thres; + int noise_frame_num_used_for_snr; + float decibel_thres; + float speech_noise_thres; + float fe_prior_thres; + int silence_pdf_num; + std::vector sil_pdf_ids; + float speech_noise_thresh_low; + float speech_noise_thresh_high; + bool output_frame_probs; + int frame_in_ms; + int frame_length_ms; + + explicit VADXOptions( + int sr = 16000, + int dm = static_cast(VadDetectMode::kVadMutipleUtteranceDetectMode), + int sm = 0, + int mset = 800, + int msst = 3000, + bool dspd = true, + bool depd = true, + int wsm = 200, + int ststh = 150, + int sttsh = 150, + float s2nr = 1.0, + int de = 1, + int lbtps = 200, + int latsp = 100, + int mss = 15000, + int nebs = 8, + int dbs = 4, + float st = -100.0, + int nfnus = 100, + float dt = -100.0, + float snt = 0.9, + float fept = 1e-4, + int spn = 1, + std::vector spids = {0}, + float sntl = -0.1, + float snth = 0.3, + bool ofp = false, + int fim = 10, + int flm = 25 + ) : + sample_rate(sr), + detect_mode(dm), + snr_mode(sm), + max_end_silence_time(mset), + max_start_silence_time(msst), + do_start_point_detection(dspd), + do_end_point_detection(depd), + window_size_ms(wsm), + sil_to_speech_time_thres(ststh), + speech_to_sil_time_thres(sttsh), + speech_2_noise_ratio(s2nr), + do_extend(de), + lookback_time_start_point(lbtps), + lookahead_time_end_point(latsp), + max_single_segment_time(mss), + nn_eval_block_size(nebs), + dcd_block_size(dbs), + snr_thres(st), + noise_frame_num_used_for_snr(nfnus), + decibel_thres(dt), + speech_noise_thres(snt), + fe_prior_thres(fept), + silence_pdf_num(spn), + sil_pdf_ids(std::move(spids)), + speech_noise_thresh_low(sntl), + speech_noise_thresh_high(snth), + output_frame_probs(ofp), + frame_in_ms(fim), + frame_length_ms(flm) {} +}; + +class E2EVadSpeechBufWithDoa { +public: + int start_ms; + int end_ms; + std::vector buffer; + bool contain_seg_start_point; + bool contain_seg_end_point; + int doa; + + E2EVadSpeechBufWithDoa() : + start_ms(0), + end_ms(0), + buffer(), + contain_seg_start_point(false), + contain_seg_end_point(false), + doa(0) {} + + void Reset() { + start_ms = 0; + end_ms = 0; + buffer.clear(); + contain_seg_start_point = false; + contain_seg_end_point = false; + doa = 0; + } +}; + +class E2EVadFrameProb { +public: + double noise_prob; + double speech_prob; + double score; + int frame_id; + int frm_state; + + E2EVadFrameProb() : + noise_prob(0.0), + speech_prob(0.0), + score(0.0), + frame_id(0), + frm_state(0) {} +}; + +class WindowDetector { +public: + int window_size_ms; + int sil_to_speech_time; + int speech_to_sil_time; + int frame_size_ms; + int win_size_frame; + int win_sum; + std::vector win_state; + int cur_win_pos; + FrameState pre_frame_state; + FrameState cur_frame_state; + int sil_to_speech_frmcnt_thres; + int speech_to_sil_frmcnt_thres; + int voice_last_frame_count; + int noise_last_frame_count; + int hydre_frame_count; + + WindowDetector(int window_size_ms, int sil_to_speech_time, int speech_to_sil_time, int frame_size_ms) : + window_size_ms(window_size_ms), + sil_to_speech_time(sil_to_speech_time), + speech_to_sil_time(speech_to_sil_time), + frame_size_ms(frame_size_ms), + win_size_frame(window_size_ms / frame_size_ms), + win_sum(0), + win_state(std::vector(win_size_frame, 0)), + cur_win_pos(0), + pre_frame_state(FrameState::kFrameStateSil), + cur_frame_state(FrameState::kFrameStateSil), + sil_to_speech_frmcnt_thres(sil_to_speech_time / frame_size_ms), + speech_to_sil_frmcnt_thres(speech_to_sil_time / frame_size_ms), + voice_last_frame_count(0), + noise_last_frame_count(0), + hydre_frame_count(0) {} + + void Reset() { + cur_win_pos = 0; + win_sum = 0; + win_state = std::vector(win_size_frame, 0); + pre_frame_state = FrameState::kFrameStateSil; + cur_frame_state = FrameState::kFrameStateSil; + voice_last_frame_count = 0; + noise_last_frame_count = 0; + hydre_frame_count = 0; + } + + int GetWinSize() { + return win_size_frame; + } + + AudioChangeState DetectOneFrame(FrameState frameState, int frame_count) { + int cur_frame_state = 0; + if (frameState == FrameState::kFrameStateSpeech) { + cur_frame_state = 1; + } else if (frameState == FrameState::kFrameStateSil) { + cur_frame_state = 0; + } else { + return AudioChangeState::kChangeStateInvalid; + } + win_sum -= win_state[cur_win_pos]; + win_sum += cur_frame_state; + win_state[cur_win_pos] = cur_frame_state; + cur_win_pos = (cur_win_pos + 1) % win_size_frame; + if (pre_frame_state == FrameState::kFrameStateSil && win_sum >= sil_to_speech_frmcnt_thres) { + pre_frame_state = FrameState::kFrameStateSpeech; + return AudioChangeState::kChangeStateSil2Speech; + } + if (pre_frame_state == FrameState::kFrameStateSpeech && win_sum <= speech_to_sil_frmcnt_thres) { + pre_frame_state = FrameState::kFrameStateSil; + return AudioChangeState::kChangeStateSpeech2Sil; + } + if (pre_frame_state == FrameState::kFrameStateSil) { + return AudioChangeState::kChangeStateSil2Sil; + } + if (pre_frame_state == FrameState::kFrameStateSpeech) { + return AudioChangeState::kChangeStateSpeech2Speech; + } + return AudioChangeState::kChangeStateInvalid; + } + + int FrameSizeMs() { + return frame_size_ms; + } +}; + +class E2EVadModel { +public: + E2EVadModel() { + this->vad_opts = VADXOptions(); +// this->windows_detector = WindowDetector(200,150,150,10); + // this->encoder = encoder; + // init variables + this->is_final = false; + this->data_buf_start_frame = 0; + this->frm_cnt = 0; + this->latest_confirmed_speech_frame = 0; + this->lastest_confirmed_silence_frame = -1; + this->continous_silence_frame_count = 0; + this->vad_state_machine = VadStateMachine::kVadInStateStartPointNotDetected; + this->confirmed_start_frame = -1; + this->confirmed_end_frame = -1; + this->number_end_time_detected = 0; + this->sil_frame = 0; + this->sil_pdf_ids = this->vad_opts.sil_pdf_ids; + this->noise_average_decibel = -100.0; + this->pre_end_silence_detected = false; + this->next_seg = true; +// this->output_data_buf = []; + this->output_data_buf_offset = 0; +// this->frame_probs = []; + this->max_end_sil_frame_cnt_thresh = + this->vad_opts.max_end_silence_time - this->vad_opts.speech_to_sil_time_thres; + this->speech_noise_thres = this->vad_opts.speech_noise_thres; + this->max_time_out = false; +// this->decibel = []; + this->ResetDetection(); + } + + std::vector> + operator()(const std::vector> &score, const std::vector &waveform, bool is_final = false, + bool online = false, int max_end_sil = 800, int max_single_segment_time = 15000, + float speech_noise_thres = 0.8, int sample_rate = 16000) { + max_end_sil_frame_cnt_thresh = max_end_sil - vad_opts.speech_to_sil_time_thres; + this->waveform = waveform; + this->vad_opts.max_single_segment_time = max_single_segment_time; + this->speech_noise_thres = speech_noise_thres; + this->vad_opts.sample_rate = sample_rate; + + ComputeDecibel(); + ComputeScores(score); + if (!is_final) { + DetectCommonFrames(); + } else { + DetectLastFrames(); + } + + std::vector> segment_batch; + if (output_data_buf.size() > 0) { + for (size_t i = output_data_buf_offset; i < output_data_buf.size(); i++) { + int start_ms; + int end_ms; + if (online) { + + if (!output_data_buf[i].contain_seg_start_point) { + continue; + } + if (!next_seg && !output_data_buf[i].contain_seg_end_point) { + continue; + } + start_ms = next_seg ? output_data_buf[i].start_ms : -1; + + if (output_data_buf[i].contain_seg_end_point) { + end_ms = output_data_buf[i].end_ms; + next_seg = true; + output_data_buf_offset += 1; + } else { + end_ms = -1; + next_seg = false; + } + } else { + if (!is_final && + (!output_data_buf[i].contain_seg_start_point || !output_data_buf[i].contain_seg_end_point)) { + continue; + } + start_ms = output_data_buf[i].start_ms; + end_ms = output_data_buf[i].end_ms; + output_data_buf_offset += 1; + } + std::vector segment = {start_ms, end_ms}; + segment_batch.push_back(segment); + } + } + + if (is_final) { + AllResetDetection(); + } + return segment_batch; + } + +private: + VADXOptions vad_opts; + WindowDetector windows_detector = WindowDetector(200, 150, 150, 10); + bool is_final; + int data_buf_start_frame; + int frm_cnt; + int latest_confirmed_speech_frame; + int lastest_confirmed_silence_frame; + int continous_silence_frame_count; + VadStateMachine vad_state_machine; + int confirmed_start_frame; + int confirmed_end_frame; + int number_end_time_detected; + int sil_frame; + std::vector sil_pdf_ids; + float noise_average_decibel; + bool pre_end_silence_detected; + bool next_seg; + std::vector output_data_buf; + int output_data_buf_offset; + std::vector frame_probs; + int max_end_sil_frame_cnt_thresh; + float speech_noise_thres; + std::vector> scores; + int idx_pre_chunk = 0; + bool max_time_out; + std::vector decibel; + int data_buf_size = 0; + int data_buf_all_size = 0; + std::vector waveform; + + void AllResetDetection() { + is_final = false; + data_buf_start_frame = 0; + frm_cnt = 0; + latest_confirmed_speech_frame = 0; + lastest_confirmed_silence_frame = -1; + continous_silence_frame_count = 0; + vad_state_machine = VadStateMachine::kVadInStateStartPointNotDetected; + confirmed_start_frame = -1; + confirmed_end_frame = -1; + number_end_time_detected = 0; + sil_frame = 0; + sil_pdf_ids = vad_opts.sil_pdf_ids; + noise_average_decibel = -100.0; + pre_end_silence_detected = false; + next_seg = true; + output_data_buf.clear(); + output_data_buf_offset = 0; + frame_probs.clear(); + max_end_sil_frame_cnt_thresh = vad_opts.max_end_silence_time - vad_opts.speech_to_sil_time_thres; + speech_noise_thres = vad_opts.speech_noise_thres; + scores.clear(); + idx_pre_chunk = 0; + max_time_out = false; + decibel.clear(); + int data_buf_size = 0; + int data_buf_all_size = 0; + waveform.clear(); + ResetDetection(); + } + + void ResetDetection() { + continous_silence_frame_count = 0; + latest_confirmed_speech_frame = 0; + lastest_confirmed_silence_frame = -1; + confirmed_start_frame = -1; + confirmed_end_frame = -1; + vad_state_machine = VadStateMachine::kVadInStateStartPointNotDetected; + windows_detector.Reset(); + sil_frame = 0; + frame_probs.clear(); + } + + void ComputeDecibel() { + int frame_sample_length = int(vad_opts.frame_length_ms * vad_opts.sample_rate / 1000); + int frame_shift_length = int(vad_opts.frame_in_ms * vad_opts.sample_rate / 1000); + if (data_buf_all_size == 0) { + data_buf_all_size = waveform.size(); + data_buf_size = data_buf_all_size; + } else { + data_buf_all_size += waveform.size(); + } + for (int offset = 0; offset + frame_sample_length -1 < waveform.size(); offset += frame_shift_length) { + float sum = 0.0; + for (int i = 0; i < frame_sample_length; i++) { + sum += waveform[offset + i] * waveform[offset + i]; + } + this->decibel.push_back(10 * log10(sum + 0.000001)); + } + } + + void ComputeScores(const std::vector> &scores) { + vad_opts.nn_eval_block_size = scores.size(); + frm_cnt += scores.size(); + this->scores = scores; + } + + void PopDataBufTillFrame(int frame_idx) { + int frame_sample_length = int(vad_opts.frame_in_ms * vad_opts.sample_rate / 1000); + while (data_buf_start_frame < frame_idx) { + if (data_buf_size >= frame_sample_length) { + data_buf_start_frame += 1; + data_buf_size = data_buf_all_size - data_buf_start_frame * frame_sample_length; + } + } + } + + void PopDataToOutputBuf(int start_frm, int frm_cnt, bool first_frm_is_start_point, bool last_frm_is_end_point, + bool end_point_is_sent_end) { + PopDataBufTillFrame(start_frm); + int expected_sample_number = int(frm_cnt * vad_opts.sample_rate * vad_opts.frame_in_ms / 1000); + if (last_frm_is_end_point) { + int extra_sample = std::max(0, int(vad_opts.frame_length_ms * vad_opts.sample_rate / 1000 - + vad_opts.sample_rate * vad_opts.frame_in_ms / 1000)); + expected_sample_number += int(extra_sample); + } + if (end_point_is_sent_end) { + expected_sample_number = std::max(expected_sample_number, data_buf_size); + } + if (data_buf_size < expected_sample_number) { + std::cout << "error in calling pop data_buf\n"; + } + if (output_data_buf.size() == 0 || first_frm_is_start_point) { + output_data_buf.push_back(E2EVadSpeechBufWithDoa()); + output_data_buf[output_data_buf.size() - 1].Reset(); + output_data_buf[output_data_buf.size() - 1].start_ms = start_frm * vad_opts.frame_in_ms; + output_data_buf[output_data_buf.size() - 1].end_ms = output_data_buf[output_data_buf.size() - 1].start_ms; + output_data_buf[output_data_buf.size() - 1].doa = 0; + } + E2EVadSpeechBufWithDoa &cur_seg = output_data_buf.back(); + if (cur_seg.end_ms != start_frm * vad_opts.frame_in_ms) { + std::cout << "warning\n"; + } + + int data_to_pop; + if (end_point_is_sent_end) { + data_to_pop = expected_sample_number; + } else { + data_to_pop = int(frm_cnt * vad_opts.frame_in_ms * vad_opts.sample_rate / 1000); + } + if (data_to_pop > data_buf_size) { + std::cout << "VAD data_to_pop is bigger than data_buf.size()!!!\n"; + data_to_pop = data_buf_size; + expected_sample_number = data_buf_size; + } + cur_seg.doa = 0; + + if (cur_seg.end_ms != start_frm * vad_opts.frame_in_ms) { + std::cout << "Something wrong with the VAD algorithm\n"; + } + data_buf_start_frame += frm_cnt; + cur_seg.end_ms = (start_frm + frm_cnt) * vad_opts.frame_in_ms; + if (first_frm_is_start_point) { + cur_seg.contain_seg_start_point = true; + } + if (last_frm_is_end_point) { + cur_seg.contain_seg_end_point = true; + } + } + + void OnSilenceDetected(int valid_frame) { + lastest_confirmed_silence_frame = valid_frame; + if (vad_state_machine == VadStateMachine::kVadInStateStartPointNotDetected) { + PopDataBufTillFrame(valid_frame); + } + // silence_detected_callback_ + // pass + } + + void OnVoiceDetected(int valid_frame) { + latest_confirmed_speech_frame = valid_frame; + PopDataToOutputBuf(valid_frame, 1, false, false, false); + } + + void OnVoiceStart(int start_frame, bool fake_result = false) { + if (vad_opts.do_start_point_detection) { + // pass + } + if (confirmed_start_frame != -1) { + std::cout << "not reset vad properly\n"; + } else { + confirmed_start_frame = start_frame; + } + if (!fake_result && vad_state_machine == VadStateMachine::kVadInStateStartPointNotDetected) { + PopDataToOutputBuf(confirmed_start_frame, 1, true, false, false); + } + } + + + void OnVoiceEnd(int end_frame, bool fake_result, bool is_last_frame) { + for (int t = latest_confirmed_speech_frame + 1; t < end_frame; t++) { + OnVoiceDetected(t); + } + if (vad_opts.do_end_point_detection) { + // pass + } + if (confirmed_end_frame != -1) { + std::cout << "not reset vad properly\n"; + } else { + confirmed_end_frame = end_frame; + } + if (!fake_result) { + sil_frame = 0; + PopDataToOutputBuf(confirmed_end_frame, 1, false, true, is_last_frame); + } + number_end_time_detected++; + } + + void MaybeOnVoiceEndIfLastFrame(bool is_final_frame, int cur_frm_idx) { + if (is_final_frame) { + OnVoiceEnd(cur_frm_idx, false, true); + vad_state_machine = VadStateMachine::kVadInStateEndPointDetected; + } + } + + int GetLatency() { + return int(LatencyFrmNumAtStartPoint() * vad_opts.frame_in_ms); + } + + int LatencyFrmNumAtStartPoint() { + int vad_latency = windows_detector.GetWinSize(); + if (vad_opts.do_extend) { + vad_latency += int(vad_opts.lookback_time_start_point / vad_opts.frame_in_ms); + } + return vad_latency; + } + + FrameState GetFrameState(int t) { + FrameState frame_state = FrameState::kFrameStateInvalid; + float cur_decibel = decibel[t]; + float cur_snr = cur_decibel - noise_average_decibel; + if (cur_decibel < vad_opts.decibel_thres) { + frame_state = FrameState::kFrameStateSil; + DetectOneFrame(frame_state, t, false); + return frame_state; + } + float sum_score = 0.0; + float noise_prob = 0.0; + assert(sil_pdf_ids.size() == vad_opts.silence_pdf_num); + if (sil_pdf_ids.size() > 0) { + std::vector sil_pdf_scores; + for (auto sil_pdf_id: sil_pdf_ids) { + sil_pdf_scores.push_back(scores[t - idx_pre_chunk][sil_pdf_id]); + } + sum_score = accumulate(sil_pdf_scores.begin(), sil_pdf_scores.end(), 0.0); + noise_prob = log(sum_score) * vad_opts.speech_2_noise_ratio; + float total_score = 1.0; + sum_score = total_score - sum_score; + } + float speech_prob = log(sum_score); + if (vad_opts.output_frame_probs) { + E2EVadFrameProb frame_prob; + frame_prob.noise_prob = noise_prob; + frame_prob.speech_prob = speech_prob; + frame_prob.score = sum_score; + frame_prob.frame_id = t; + frame_probs.push_back(frame_prob); + } + if (exp(speech_prob) >= exp(noise_prob) + speech_noise_thres) { + if (cur_snr >= vad_opts.snr_thres && cur_decibel >= vad_opts.decibel_thres) { + frame_state = FrameState::kFrameStateSpeech; + } else { + frame_state = FrameState::kFrameStateSil; + } + } else { + frame_state = FrameState::kFrameStateSil; + if (noise_average_decibel < -99.9) { + noise_average_decibel = cur_decibel; + } else { + noise_average_decibel = + (cur_decibel + noise_average_decibel * (vad_opts.noise_frame_num_used_for_snr - 1)) / + vad_opts.noise_frame_num_used_for_snr; + } + } + return frame_state; + } + + int DetectCommonFrames() { + if (vad_state_machine == VadStateMachine::kVadInStateEndPointDetected) { + return 0; + } + for (int i = vad_opts.nn_eval_block_size - 1; i >= 0; i--) { + FrameState frame_state = FrameState::kFrameStateInvalid; + frame_state = GetFrameState(frm_cnt - 1 - i); + DetectOneFrame(frame_state, frm_cnt - 1 - i, false); + } + idx_pre_chunk += scores.size(); + return 0; + } + + int DetectLastFrames() { + if (vad_state_machine == VadStateMachine::kVadInStateEndPointDetected) { + return 0; + } + for (int i = vad_opts.nn_eval_block_size - 1; i >= 0; i--) { + FrameState frame_state = FrameState::kFrameStateInvalid; + frame_state = GetFrameState(frm_cnt - 1 - i); + if (i != 0) { + DetectOneFrame(frame_state, frm_cnt - 1 - i, false); + } else { + DetectOneFrame(frame_state, frm_cnt - 1, true); + } + } + return 0; + } + + void DetectOneFrame(FrameState cur_frm_state, int cur_frm_idx, bool is_final_frame) { + FrameState tmp_cur_frm_state = FrameState::kFrameStateInvalid; + if (cur_frm_state == FrameState::kFrameStateSpeech) { + if (std::fabs(1.0) > vad_opts.fe_prior_thres) { + tmp_cur_frm_state = FrameState::kFrameStateSpeech; + } else { + tmp_cur_frm_state = FrameState::kFrameStateSil; + } + } else if (cur_frm_state == FrameState::kFrameStateSil) { + tmp_cur_frm_state = FrameState::kFrameStateSil; + } + AudioChangeState state_change = windows_detector.DetectOneFrame(tmp_cur_frm_state, cur_frm_idx); + int frm_shift_in_ms = vad_opts.frame_in_ms; + if (AudioChangeState::kChangeStateSil2Speech == state_change) { + int silence_frame_count = continous_silence_frame_count; + continous_silence_frame_count = 0; + pre_end_silence_detected = false; + int start_frame = 0; + if (vad_state_machine == VadStateMachine::kVadInStateStartPointNotDetected) { + start_frame = std::max(data_buf_start_frame, cur_frm_idx - LatencyFrmNumAtStartPoint()); + OnVoiceStart(start_frame); + vad_state_machine = VadStateMachine::kVadInStateInSpeechSegment; + for (int t = start_frame + 1; t <= cur_frm_idx; t++) { + OnVoiceDetected(t); + } + } else if (vad_state_machine == VadStateMachine::kVadInStateInSpeechSegment) { + for (int t = latest_confirmed_speech_frame + 1; t < cur_frm_idx; t++) { + OnVoiceDetected(t); + } + if (cur_frm_idx - confirmed_start_frame + 1 > vad_opts.max_single_segment_time / frm_shift_in_ms) { + OnVoiceEnd(cur_frm_idx, false, false); + vad_state_machine = VadStateMachine::kVadInStateEndPointDetected; + } else if (!is_final_frame) { + OnVoiceDetected(cur_frm_idx); + } else { + MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx); + } + } + } else if (AudioChangeState::kChangeStateSpeech2Sil == state_change) { + continous_silence_frame_count = 0; + if (vad_state_machine == VadStateMachine::kVadInStateStartPointNotDetected) { + // do nothing + } else if (vad_state_machine == VadStateMachine::kVadInStateInSpeechSegment) { + if (cur_frm_idx - confirmed_start_frame + 1 > + vad_opts.max_single_segment_time / frm_shift_in_ms) { + OnVoiceEnd(cur_frm_idx, false, false); + vad_state_machine = VadStateMachine::kVadInStateEndPointDetected; + } else if (!is_final_frame) { + OnVoiceDetected(cur_frm_idx); + } else { + MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx); + } + } + } else if (AudioChangeState::kChangeStateSpeech2Speech == state_change) { + continous_silence_frame_count = 0; + if (vad_state_machine == VadStateMachine::kVadInStateInSpeechSegment) { + if (cur_frm_idx - confirmed_start_frame + 1 > + vad_opts.max_single_segment_time / frm_shift_in_ms) { + max_time_out = true; + OnVoiceEnd(cur_frm_idx, false, false); + vad_state_machine = VadStateMachine::kVadInStateEndPointDetected; + } else if (!is_final_frame) { + OnVoiceDetected(cur_frm_idx); + } else { + MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx); + } + } + } else if (AudioChangeState::kChangeStateSil2Sil == state_change) { + continous_silence_frame_count += 1; + if (vad_state_machine == VadStateMachine::kVadInStateStartPointNotDetected) { + if ((vad_opts.detect_mode == static_cast(VadDetectMode::kVadSingleUtteranceDetectMode) && + (continous_silence_frame_count * frm_shift_in_ms > vad_opts.max_start_silence_time)) || + (is_final_frame && number_end_time_detected == 0)) { + for (int t = lastest_confirmed_silence_frame + 1; t < cur_frm_idx; t++) { + OnSilenceDetected(t); + } + OnVoiceStart(0, true); + OnVoiceEnd(0, true, false); + vad_state_machine = VadStateMachine::kVadInStateEndPointDetected; + } else { + if (cur_frm_idx >= LatencyFrmNumAtStartPoint()) { + OnSilenceDetected(cur_frm_idx - LatencyFrmNumAtStartPoint()); + } + } + } else if (vad_state_machine == VadStateMachine::kVadInStateInSpeechSegment) { + if (continous_silence_frame_count * frm_shift_in_ms >= max_end_sil_frame_cnt_thresh) { + int lookback_frame = max_end_sil_frame_cnt_thresh / frm_shift_in_ms; + if (vad_opts.do_extend) { + lookback_frame -= vad_opts.lookahead_time_end_point / frm_shift_in_ms; + lookback_frame -= 1; + lookback_frame = std::max(0, lookback_frame); + } + OnVoiceEnd(cur_frm_idx - lookback_frame, false, false); + vad_state_machine = VadStateMachine::kVadInStateEndPointDetected; + } else if (cur_frm_idx - confirmed_start_frame + 1 > + vad_opts.max_single_segment_time / frm_shift_in_ms) { + OnVoiceEnd(cur_frm_idx, false, false); + vad_state_machine = VadStateMachine::kVadInStateEndPointDetected; + } else if (vad_opts.do_extend && !is_final_frame) { + if (continous_silence_frame_count <= vad_opts.lookahead_time_end_point / frm_shift_in_ms) { + OnVoiceDetected(cur_frm_idx); + } + } else { + MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx); + } + } + } + if (vad_state_machine == VadStateMachine::kVadInStateEndPointDetected && + vad_opts.detect_mode == static_cast(VadDetectMode::kVadMutipleUtteranceDetectMode)) { + ResetDetection(); + } + } + +}; + +} // namespace funasr diff --git a/runtime/onnxruntime/src/encode_converter.cpp b/runtime/onnxruntime/src/encode_converter.cpp new file mode 100644 index 0000000..2ba6109 --- /dev/null +++ b/runtime/onnxruntime/src/encode_converter.cpp @@ -0,0 +1,575 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ +#include "encode_converter.h" +#include + + +namespace funasr { +using namespace std; + +U16CHAR_T UTF16[8]; +U8CHAR_T UTF8[8]; + +size_t MyUtf8ToUtf16(const U8CHAR_T* pu8, size_t ilen, U16CHAR_T* pu16); +size_t MyUtf16ToUtf8(const U16CHAR_T* pu16, U8CHAR_T* pu8); + + +void EncodeConverter::SwapEndian(U16CHAR_T* pbuf, size_t len) +{ + for (size_t i = 0; i < len; i++) { + pbuf[i] = ((pbuf[i] >> 8) | (pbuf[i] << 8)); + } +} + + +size_t MyUtf16ToUtf8(const U16CHAR_T* pu16, U8CHAR_T* pu8) +{ + size_t n = 0; + if (pu16[0] <= 0x007F) + { + pu8[0] = (pu16[0] & 0x7F); + n = 1; + } + else if (pu16[0] >= 0x0080 && pu16[0] <= 0x07FF) + { + pu8[1] = (0x80 | (pu16[0] & 0x003F)); + pu8[0] = (0xC0 | ((pu16[0] >> 6) & 0x001F)); + n = 2; + } + else if (pu16[0] >= 0x0800) + { + pu8[2] = (0x80 | (pu16[0] & 0x003F)); + pu8[1] = (0x80 | ((pu16[0] >> 6) & 0x003F)); + pu8[0] = (0xE0 | ((pu16[0] >> 12) & 0x000F)); + n = 3; + } + + return n; +} + +#define is2ByteUtf16(u16) ( (u16) >= 0x0080 && (u16) <= 0x07FF ) +#define is3ByteUtf16(u16) ( (u16) >= 0x0800 ) + +size_t EncodeConverter::Utf16ToUtf8(const U16CHAR_T* pu16, U8CHAR_T* pu8) +{ + size_t n = 0; + if (pu16[0] <= 0x007F) + { + pu8[0] = (pu16[0] & 0x7F); + n = 1; + } + else if (pu16[0] >= 0x0080 && pu16[0] <= 0x07FF) + { + pu8[1] = (0x80 | (pu16[0] & 0x003F)); + pu8[0] = (0xC0 | ((pu16[0] >> 6) & 0x001F)); + n = 2; + } + else if (pu16[0] >= 0x0800) + { + pu8[2] = (0x80 | (pu16[0] & 0x003F)); + pu8[1] = (0x80 | ((pu16[0] >> 6) & 0x003F)); + pu8[0] = (0xE0 | ((pu16[0] >> 12) & 0x000F)); + n = 3; + } + + return n; +} + +size_t EncodeConverter::Utf16ToUtf8(const U16CHAR_T* pu16, size_t ilen, + U8CHAR_T* pu8, size_t olen) +{ + size_t offset = 0; + size_t sz = 0; + /* + for (size_t i = 0; i < ilen && offset < static_cast(olen) - 3; i++) { + sz = utf16ToUtf8(pu16 + i, pu8 + offset); + offset += sz; + } + */ + for (size_t i = 0; i < ilen && static_cast(offset) < static_cast(olen); i++) { + sz = Utf16ToUtf8(pu16 + i, pu8 + offset); + if (static_cast(offset + static_cast(sz)) <= static_cast(olen)) + offset += sz; + } + + // pu8[offset] = '\0'; + return offset; +} + +u8string EncodeConverter::Utf16ToUtf8(const u16string& u16str) +{ + size_t buflen = u16str.length()*3 + 1; + U8CHAR_T* pu8 = new U8CHAR_T[buflen]; + size_t len = Utf16ToUtf8(u16str.data(), u16str.length(), + pu8, buflen); + u8string u8str(pu8, len); + delete [] pu8; + + return u8str; +} + +size_t EncodeConverter::Utf8ToUtf16(const U8CHAR_T* pu8, U16CHAR_T* pu16) +{ + size_t n = 0; + if ((pu8[0] & 0xF0) == 0xE0) + { + if ((pu8[1] & 0xC0) == 0x80 && + (pu8[2] & 0xC0) == 0x80) + { + pu16[0] = (((pu8[0] & 0x0F) << 4) | ((pu8[1] & 0x3C) >> 2)); + pu16[0] <<= 8; + pu16[0] |= (((pu8[1] & 0x03) << 6) | (pu8[2] & 0x3F)); + } + else + { + pu16[0] = defUniChar; + } + n = 3; + } + else if ((pu8[0] & 0xE0) == 0xC0) + { + if ((pu8[1] & 0xC0) == 0x80) + { + pu16[0] = ((pu8[0] & 0x1C) >> 2); + pu16[0] <<= 8; + pu16[0] |= (((pu8[0] & 0x03) << 6) | (pu8[1] & 0x3F)); + } + else + { + pu16[0] = defUniChar; + } + n = 2; + } + else if ((pu8[0] & 0x80) == 0x00) + { + pu16[0] = pu8[0]; + n = 1; + } + + return n; +} + +size_t MyUtf8ToUtf16(const U8CHAR_T* pu8, size_t ilen, U16CHAR_T* pu16) +{ + size_t n = 0; + if ((pu8[0] & 0xF0) == 0xE0 && ilen >= 3) + { + if ((pu8[1] & 0xC0) == 0x80 && + (pu8[2] & 0xC0) == 0x80) + { + pu16[0] = (((pu8[0] & 0x0F) << 4) | ((pu8[1] & 0x3C) >> 2)); + pu16[0] <<= 8; + pu16[0] |= (((pu8[1] & 0x03) << 6) | (pu8[2] & 0x3F)); + n = 3; + } + else + { + pu16[0] = 0x0000; + n = 1; + } + } + else if ((pu8[0] & 0xE0) == 0xC0 && ilen >= 2) + { + if ((pu8[1] & 0xC0) == 0x80) + { + pu16[0] = ((pu8[0] & 0x1C) >> 2); + pu16[0] <<= 8; + pu16[0] |= (((pu8[0] & 0x03) << 6) | (pu8[1] & 0x3F)); + n = 2; + } + else + { + pu16[0] = 0x0000; + n = 1; + } + } + else if ((pu8[0] & 0x80) == 0x00) + { + pu16[0] = pu8[0]; + n = 1; + } + else + { + pu16[0] = 0x0000; + n = 1; + } + return n; +} + +size_t EncodeConverter::Utf8ToUtf16(const U8CHAR_T* pu8, size_t ilen, U16CHAR_T* pu16) +{ + size_t n = 0; + if ((pu8[0] & 0xF0) == 0xE0 && ilen >= 3) + { + if ((pu8[1] & 0xC0) == 0x80 && + (pu8[2] & 0xC0) == 0x80) + { + pu16[0] = (((pu8[0] & 0x0F) << 4) | ((pu8[1] & 0x3C) >> 2)); + pu16[0] <<= 8; + pu16[0] |= (((pu8[1] & 0x03) << 6) | (pu8[2] & 0x3F)); + n = 3; + if( !is3ByteUtf16(pu16[0]) ) + { + pu16[0] = 0x0000; + n = 1; + } + } + else + { + pu16[0] = 0x0000; + n = 1; + } + } + else if ((pu8[0] & 0xE0) == 0xC0 && ilen >= 2) + { + if ((pu8[1] & 0xC0) == 0x80) + { + pu16[0] = ((pu8[0] & 0x1C) >> 2); + pu16[0] <<= 8; + pu16[0] |= (((pu8[0] & 0x03) << 6) | (pu8[1] & 0x3F)); + n = 2; + if( !is2ByteUtf16(pu16[0]) ) + { + pu16[0] = 0x0000; + n = 1; + } + } + else + { + pu16[0] = 0x0000; + n = 1; + } + } + else if ((pu8[0] & 0x80) == 0x00) + { + pu16[0] = pu8[0]; + n = 1; + } + else + { + pu16[0] = 0x0000; + n = 1; + } + + return n; + /* + size_t n = 0; + if ((pu8[0] & 0xF0) == 0xE0) + { + if (ilen >= 3 && (pu8[1] & 0xC0) == 0x80 && + (pu8[2] & 0xC0) == 0x80) + { + pu16[0] = (((pu8[0] & 0x0F) << 4) | ((pu8[1] & 0x3C) >> 2)); + pu16[0] <<= 8; + pu16[0] |= (((pu8[1] & 0x03) << 6) | (pu8[2] & 0x3F)); + } + else + { + pu16[0] = defUniChar; + } + n = 3; + } + else if ((pu8[0] & 0xE0) == 0xC0) + { + if( ilen >= 2 && (pu8[1] & 0xC0) == 0x80) + { + pu16[0] = ((pu8[0] & 0x1C) >> 2); + pu16[0] <<= 8; + pu16[0] |= (((pu8[0] & 0x03) << 6) | (pu8[1] & 0x3F)); + } + else + { + pu16[0] = defUniChar; + } + n = 2; + } + else if ((pu8[0] & 0x80) == 0x00) + { + pu16[0] = pu8[0]; + n = 1; + } + else + { + pu16[0] = defUniChar; + n = 1; + for (size_t i = 1; i < ilen; i++) + { + if ((pu8[i] & 0xF0) == 0xE0 || (pu8[i] & 0xE0) == 0xC0 || (pu8[i] & 0x80) == 0x00) + break; + n++; + } + } + + return n; + */ +} + +size_t EncodeConverter::Utf8ToUtf16(const U8CHAR_T* pu8, size_t ilen, + U16CHAR_T* pu16, size_t olen) +{ + int offset = 0; + size_t sz = 0; + for (size_t i = 0; i < ilen && offset < static_cast(olen); offset ++) + { + sz = Utf8ToUtf16(pu8 + i, ilen - i, pu16 + offset); + i += sz; + if (sz == 0) { + // failed + // assert(sz != 0); + break; + } + } +// pu16[offset] = '\0'; + + return offset; +} + +u16string EncodeConverter::Utf8ToUtf16(const u8string& u8str) +{ + U16CHAR_T* p16 = new U16CHAR_T[u8str.length() + 1]; + size_t len = Utf8ToUtf16(u8str.data(), u8str.length(), + p16, u8str.length() + 1); + u16string u16str(p16, len); + delete[] p16; + + return u16str; +} + +bool EncodeConverter::IsUTF8(const U8CHAR_T* pu8, size_t ilen) +{ + size_t i; + size_t n = 0; + for (i = 0; i < ilen; i += n) + { + if ((pu8[i] & 0xF0) == 0xE0 && + (pu8[i + 1] & 0xC0) == 0x80 && + (pu8[i + 2] & 0xC0) == 0x80) + { + n = 3; + } + else if ((pu8[i] & 0xE0) == 0xC0 && + (pu8[i + 1] & 0xC0) == 0x80) + { + n = 2; + } + else if ((pu8[i] & 0x80) == 0x00) + { + n = 1; + } + else + { + break; + } + } + + return i == ilen; +} + +bool EncodeConverter::IsUTF8(const u8string& u8str) +{ + return IsUTF8(u8str.data(), u8str.length()); +} + +size_t EncodeConverter::GetUTF8Len(const U8CHAR_T* pu8, size_t ilen) +{ + size_t i; + size_t n = 0; + size_t rlen = 0; + for (i = 0; i < ilen; i += n, rlen ++) + { + if ((pu8[i] & 0xF0) == 0xE0 && + (pu8[i + 1] & 0xC0) == 0x80 && + (pu8[i + 2] & 0xC0) == 0x80) + { + n = 3; + } + else if ((pu8[i] & 0xE0) == 0xC0 && + (pu8[i + 1] & 0xC0) == 0x80) + { + n = 2; + } + else if ((pu8[i] & 0x80) == 0x00) + { + n = 1; + } + else + { + break; + } + } + + if (i == ilen) + return 0; + else + return rlen; +} + +size_t EncodeConverter::GetUTF8Len(const u8string& u8str) +{ + return GetUTF8Len(u8str.data(), u8str.length()); +} + + +size_t EncodeConverter::Utf16ToUtf8Len(const U16CHAR_T* pu16, size_t ilen) +{ + int offset = 0; + for (size_t i = 0; i < ilen ; i++) { + if (pu16[i] <= 0x007F) + { + offset += 1; + } + else if (pu16[i] >= 0x0080 && pu16[i] <= 0x07FF) + { + offset += 2; + } + else if (pu16[i] >= 0x0800) + { + offset += 3; + } + } + + return offset; +} + +uint16_t EncodeConverter::ToUni(const char* sc, int &len) +{ + uint16_t wide[2]; + len = (int)Utf8ToUtf16((const U8CHAR_T*)sc, wide); + return wide[0]; +} + +bool EncodeConverter::IsAllChineseCharactor(const U8CHAR_T* pu8, size_t ilen) { + if (pu8 == nullptr || ilen <= 0) { + return false; + } + + U16CHAR_T* p16 = new U16CHAR_T[ilen + 1]; + size_t len = Utf8ToUtf16(pu8, ilen, p16, ilen + 1); + for (size_t i = 0; i < len; i++) { + if (p16[i] < 0x4e00 || p16[i] > 0x9fff) { + delete[] p16; + return false; + } + } + delete[] p16; + return true; +} + +bool EncodeConverter::HasAlpha(const U8CHAR_T* pu8, size_t ilen) { + if (pu8 == nullptr || ilen <= 0) { + return false; + } + for (size_t i = 0; i < ilen; i++) { + if (pu8[i]> 0 && isalpha(pu8[i])){ + return true; + } + } + return false; +} + + +bool EncodeConverter::IsAllAlpha(const U8CHAR_T* pu8, size_t ilen) { + if (pu8 == nullptr || ilen <= 0) { + return false; + } + for (size_t i = 0; i < ilen; i++) { + if (!(pu8[i]> 0 && isalpha(pu8[i]))){ + return false; + } + } + return true; +} + +bool EncodeConverter::IsAllAlphaAndPunct(const U8CHAR_T* pu8, size_t ilen) { + if (pu8 == nullptr || ilen <= 0) { + return false; + } + bool flag1 = HasAlpha(pu8, ilen); + if (flag1 == false) { + return false; + } + + for (size_t i = 0; i < ilen; i++) { + if (!(pu8[i]> 0 && (isalpha(pu8[i]) || (ispunct(pu8[i]))))){ + return false; + } + } + return true; +} + +bool EncodeConverter::IsAllAlphaAndDigit(const U8CHAR_T* pu8, size_t ilen) { + if (pu8 == nullptr || ilen <= 0) { + return false; + } + bool flag1 = HasAlpha(pu8, ilen); + if (flag1 == false) { + return false; + } + + for (size_t i = 0; i < ilen; i++) { + if (!(pu8[i]> 0 && (isalnum(pu8[i]) || isalpha(pu8[i]) || pu8[i] == '\''))){ + return false; + } + } + return true; +} +bool EncodeConverter::IsAllAlphaAndDigitAndBlank(const U8CHAR_T* pu8, size_t ilen) { + if (pu8 == nullptr || ilen <= 0) { + return false; + } + for (size_t i = 0; i < ilen; i++) { + if (!(pu8[i]> 0 && (isalnum(pu8[i]) || isalpha(pu8[i]) || isblank(pu8[i]) || pu8[i] == '\''))){ + return false; + } + } + return true; +} +bool EncodeConverter::NeedAddTailBlank(std::string str) { + U8CHAR_T *pu8 = (U8CHAR_T*)str.data(); + size_t ilen = str.size(); + if (pu8 == nullptr || ilen <= 0) { + return false; + } + if (IsAllAlpha(pu8, ilen) || IsAllAlphaAndPunct(pu8, ilen) || IsAllAlphaAndDigit(pu8, ilen)) { + return true; + } else { + return false; + } +} +std::vector EncodeConverter::MergeEnglishWord(std::vector &str_vec_input, + std::vector &merge_mask) { + std::vector output; + for (int i = 0; i < merge_mask.size(); i++) { + if (merge_mask[i] == 1 && i > 0) { + output[output.size() - 1] += str_vec_input[i]; + } else { + output.push_back(str_vec_input[i]); + } + } + str_vec_input.swap(output); + return str_vec_input; +} +size_t EncodeConverter::Utf8ToCharset(const std::string &input, std::vector &output) { + std::string ch; + for (size_t i = 0, len = 0; i != input.length(); i += len) { + unsigned char byte = (unsigned)input[i]; + if (byte >= 0xFC) // lenght 6 + len = 6; + else if (byte >= 0xF8) + len = 5; + else if (byte >= 0xF0) + len = 4; + else if (byte >= 0xE0) + len = 3; + else if (byte >= 0xC0) + len = 2; + else + len = 1; + ch = input.substr(i, len); + output.push_back(ch); + } + return output.size(); +} +} diff --git a/runtime/onnxruntime/src/encode_converter.h b/runtime/onnxruntime/src/encode_converter.h new file mode 100644 index 0000000..a135eb6 --- /dev/null +++ b/runtime/onnxruntime/src/encode_converter.h @@ -0,0 +1,109 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ +#ifndef __WS__ENCODE_CONVERTER_H__ +#define __WS__ENCODE_CONVERTER_H__ + +#include +#include +#include +#ifdef _MSC_VER +#include +#endif // _MSC_VER + +namespace funasr { + typedef unsigned char U8CHAR_T; + typedef unsigned short U16CHAR_T; + typedef std::basic_string u8string; + typedef std::basic_string u16string; + + class EncodeConverter { + public: + static const U16CHAR_T defUniChar = 0x25a1; //WHITE SQUARE + + public: + static void SwapEndian(U16CHAR_T* pbuf, size_t len); + + static size_t Utf16ToUtf8(const U16CHAR_T* pu16, U8CHAR_T* pu8); + + ///< @param pu16 UTF16 string + ///< @param pu8 UTF8 string + static size_t Utf16ToUtf8(const U16CHAR_T* pu16, size_t ilen, + U8CHAR_T* pu8, size_t olen); + + static u8string Utf16ToUtf8(const u16string& u16str); + + static size_t Utf8ToUtf16(const U8CHAR_T* pu8, U16CHAR_T* pu16); + + static size_t Utf8ToUtf16(const U8CHAR_T* pu8, size_t ilen, U16CHAR_T* pu16); + + ///< @param pu8 UTF8 string + ///< @param pu16 UTF16 string + static size_t Utf8ToUtf16(const U8CHAR_T* pu8, size_t ilen, + U16CHAR_T* pu16, size_t olen); + + static u16string Utf8ToUtf16(const u8string& u8str); + + ///< @param pu8 string + ///< @return if string is encoded as UTF8 - true, otherwise false + static bool IsUTF8(const U8CHAR_T* pu8, size_t ilen); + + ///< @param u8str string + ///< @return if string is encoded as UTF8 - true, otherwise false + static bool IsUTF8(const u8string& u8str); + + ///< @param UTF8 string + ///< @return the word number of UTF8 + static size_t GetUTF8Len(const U8CHAR_T* pu8, size_t ilen); + + ///< @param UTF8 string + ///< @return the word number of UTF8 + static size_t GetUTF8Len(const u8string& u8str); + + ///< @param pu16 UTF16 string + ///< @param ilen UTF16 length + ///< @return UTF8 string length + static size_t Utf16ToUtf8Len(const U16CHAR_T* pu16, size_t ilen); + + static uint16_t ToUni(const char* sc, int &len); + + static bool IsChineseCharacter(U16CHAR_T &u16) { + return (u16 >= 0x4e00 && u16 <= 0x9fff) // common + || (u16 >= 0x3400 && u16 <= 0x4dff); // rare, extension A + } + + // whether the string is all Chinese + static bool IsAllChineseCharactor(const U8CHAR_T* pu8, size_t ilen); + static bool HasAlpha(const U8CHAR_T* pu8, size_t ilen); + static bool NeedAddTailBlank(std::string str); + static bool IsAllAlpha(const U8CHAR_T* pu8, size_t ilen); + static bool IsAllAlphaAndPunct(const U8CHAR_T* pu8, size_t ilen); + static bool IsAllAlphaAndDigit(const U8CHAR_T* pu8, size_t ilen); + static bool IsAllAlphaAndDigitAndBlank(const U8CHAR_T* pu8, size_t ilen); + static std::vector MergeEnglishWord(std::vector &str_vec_input, + std::vector &merge_mask); + static size_t Utf8ToCharset(const std::string &input, std::vector &output); + +#ifdef _MSC_VER + // convert to the local ansi page + static std::string UTF8ToLocaleAnsi(const std::string& strUTF8) { + int len = MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, nullptr, 0); + unsigned short*wszGBK = new unsigned short[len + 1]; + memset(wszGBK, 0, len * 2 + 2); + MultiByteToWideChar(CP_UTF8, 0, (LPCCH)strUTF8.c_str(), -1, (LPWSTR)wszGBK, len); + + len = WideCharToMultiByte(CP_ACP, 0, (LPCWCH)wszGBK, -1, nullptr, 0, nullptr, nullptr); + char *szGBK = new char[len + 1]; + memset(szGBK, 0, len + 1); + WideCharToMultiByte(CP_ACP, 0, (LPCWCH)wszGBK, -1, szGBK, len, nullptr, nullptr); + std::string strTemp(szGBK); + delete[]szGBK; + delete[]wszGBK; + return strTemp; + } +#endif + }; +} + +#endif //__WS_ENCODE_CONVERTER_H__ diff --git a/runtime/onnxruntime/src/fsmn-vad-online.cpp b/runtime/onnxruntime/src/fsmn-vad-online.cpp new file mode 100644 index 0000000..30627fc --- /dev/null +++ b/runtime/onnxruntime/src/fsmn-vad-online.cpp @@ -0,0 +1,215 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. + * MIT License (https://opensource.org/licenses/MIT) +*/ + +#include +#include "precomp.h" + +namespace funasr { + +void FsmnVadOnline::FbankKaldi(float sample_rate, std::vector> &vad_feats, + std::vector &waves) { + knf::OnlineFbank fbank(fbank_opts_); + // cache merge + waves.insert(waves.begin(), input_cache_.begin(), input_cache_.end()); + int frame_number = ComputeFrameNum(waves.size(), frame_sample_length_, frame_shift_sample_length_); + // Send the audio after the last frame shift position to the cache + input_cache_.clear(); + input_cache_.insert(input_cache_.begin(), waves.begin() + frame_number * frame_shift_sample_length_, waves.end()); + if (frame_number == 0) { + return; + } + // Delete audio that haven't undergone fbank processing + waves.erase(waves.begin() + (frame_number - 1) * frame_shift_sample_length_ + frame_sample_length_, waves.end()); + + std::vector buf(waves.size()); + for (int32_t i = 0; i != waves.size(); ++i) { + buf[i] = waves[i] * 32768; + } + fbank.AcceptWaveform(sample_rate, buf.data(), buf.size()); + // fbank.AcceptWaveform(sample_rate, &waves[0], waves.size()); + int32_t frames = fbank.NumFramesReady(); + for (int32_t i = 0; i != frames; ++i) { + const float *frame = fbank.GetFrame(i); + vector frame_vector(frame, frame + fbank_opts_.mel_opts.num_bins); + vad_feats.emplace_back(frame_vector); + } +} + +void FsmnVadOnline::ExtractFeats(float sample_rate, vector> &vad_feats, + vector &waves, bool input_finished) { + FbankKaldi(sample_rate, vad_feats, waves); + // cache deal & online lfr,cmvn + if (vad_feats.size() > 0) { + if (!reserve_waveforms_.empty()) { + waves.insert(waves.begin(), reserve_waveforms_.begin(), reserve_waveforms_.end()); + } + if (lfr_splice_cache_.empty()) { + for (int i = 0; i < (lfr_m - 1) / 2; i++) { + lfr_splice_cache_.emplace_back(vad_feats[0]); + } + } + if (vad_feats.size() + lfr_splice_cache_.size() >= lfr_m) { + vad_feats.insert(vad_feats.begin(), lfr_splice_cache_.begin(), lfr_splice_cache_.end()); + int frame_from_waves = (waves.size() - frame_sample_length_) / frame_shift_sample_length_ + 1; + int minus_frame = reserve_waveforms_.empty() ? (lfr_m - 1) / 2 : 0; + int lfr_splice_frame_idxs = OnlineLfrCmvn(vad_feats, input_finished); + int reserve_frame_idx = std::abs(lfr_splice_frame_idxs - minus_frame); + reserve_waveforms_.clear(); + reserve_waveforms_.insert(reserve_waveforms_.begin(), + waves.begin() + reserve_frame_idx * frame_shift_sample_length_, + waves.begin() + frame_from_waves * frame_shift_sample_length_); + int sample_length = (frame_from_waves - 1) * frame_shift_sample_length_ + frame_sample_length_; + waves.erase(waves.begin() + sample_length, waves.end()); + } else { + reserve_waveforms_.clear(); + reserve_waveforms_.insert(reserve_waveforms_.begin(), + waves.begin() + frame_sample_length_ - frame_shift_sample_length_, waves.end()); + lfr_splice_cache_.insert(lfr_splice_cache_.end(), vad_feats.begin(), vad_feats.end()); + } + } else { + if (input_finished) { + if (!reserve_waveforms_.empty()) { + waves = reserve_waveforms_; + } + vad_feats = lfr_splice_cache_; + if(vad_feats.size() == 0){ + LOG(ERROR) << "vad_feats's size is 0"; + }else{ + OnlineLfrCmvn(vad_feats, input_finished); + } + } + } + if(input_finished){ + Reset(); + ResetCache(); + } +} + +int FsmnVadOnline::OnlineLfrCmvn(vector> &vad_feats, bool input_finished) { + vector> out_feats; + int T = vad_feats.size(); + int T_lrf = ceil((T - (lfr_m - 1) / 2) / (float)lfr_n); + int lfr_splice_frame_idxs = T_lrf; + vector p; + for (int i = 0; i < T_lrf; i++) { + if (lfr_m <= T - i * lfr_n) { + for (int j = 0; j < lfr_m; j++) { + p.insert(p.end(), vad_feats[i * lfr_n + j].begin(), vad_feats[i * lfr_n + j].end()); + } + out_feats.emplace_back(p); + p.clear(); + } else { + if (input_finished) { + int num_padding = lfr_m - (T - i * lfr_n); + for (int j = 0; j < (vad_feats.size() - i * lfr_n); j++) { + p.insert(p.end(), vad_feats[i * lfr_n + j].begin(), vad_feats[i * lfr_n + j].end()); + } + for (int j = 0; j < num_padding; j++) { + p.insert(p.end(), vad_feats[vad_feats.size() - 1].begin(), vad_feats[vad_feats.size() - 1].end()); + } + out_feats.emplace_back(p); + p.clear(); + } else { + lfr_splice_frame_idxs = i; + break; + } + } + } + lfr_splice_frame_idxs = std::min(T - 1, lfr_splice_frame_idxs * lfr_n); + lfr_splice_cache_.clear(); + lfr_splice_cache_.insert(lfr_splice_cache_.begin(), vad_feats.begin() + lfr_splice_frame_idxs, vad_feats.end()); + + // Apply cmvn + for (auto &out_feat: out_feats) { + for (int j = 0; j < means_list_.size(); j++) { + out_feat[j] = (out_feat[j] + means_list_[j]) * vars_list_[j]; + } + } + vad_feats = out_feats; + return lfr_splice_frame_idxs; +} + +std::vector> +FsmnVadOnline::Infer(std::vector &waves, bool input_finished) { + std::vector> vad_segments; + std::vector> vad_feats; + std::vector> vad_probs; + ExtractFeats(vad_sample_rate_, vad_feats, waves, input_finished); + if(vad_feats.size() == 0){ + return vad_segments; + } + fsmnvad_handle_->Forward(vad_feats, &vad_probs, &in_cache_, input_finished); + if(vad_probs.size() == 0){ + return vad_segments; + } + + vad_segments = vad_scorer(vad_probs, waves, input_finished, true, vad_silence_duration_, vad_max_len_, + vad_speech_noise_thres_, vad_sample_rate_); + return vad_segments; +} + +void FsmnVadOnline::InitCache(){ + std::vector cache_feats(128 * 19 * 1, 0); + for (int i=0;i<4;i++){ + in_cache_.emplace_back(cache_feats); + } +}; + +void FsmnVadOnline::Reset(){ + in_cache_.clear(); + InitCache(); +}; + +void FsmnVadOnline::Test() { +} + +void FsmnVadOnline::InitOnline(std::shared_ptr &vad_session, + Ort::Env &env, + std::vector &vad_in_names, + std::vector &vad_out_names, + knf::FbankOptions &fbank_opts, + std::vector &means_list, + std::vector &vars_list, + int vad_sample_rate, + int vad_silence_duration, + int vad_max_len, + double vad_speech_noise_thres) { + vad_session_ = vad_session; + vad_in_names_ = vad_in_names; + vad_out_names_ = vad_out_names; + fbank_opts_ = fbank_opts; + means_list_ = means_list; + vars_list_ = vars_list; + vad_sample_rate_ = vad_sample_rate; + vad_silence_duration_ = vad_silence_duration; + vad_max_len_ = vad_max_len; + vad_speech_noise_thres_ = vad_speech_noise_thres; + + frame_sample_length_ = vad_sample_rate_ / 1000 * 25;; + frame_shift_sample_length_ = vad_sample_rate_ / 1000 * 10; + + // 2pass + audio_handle = make_unique" || word == "") + continue; + // step2 combie phoneme to full word + { + int sub_word = !(word.find("@@") == string::npos); + // process word start and middle part + if (sub_word) { + // if badcase: lo@@ chinese + if (i == raw_char.size()-1 || i vec = {begin, timestamp_list[i][1]}; + timestamp_merge.emplace_back(vec); + begin = -1; + pre_english_len = word.size(); + } + // pre word is english word + else { + // single letter turn to upper case + // if (word.size() == 1) { + // word[0] = word[0] - 32; + // } + + if (pre_english_len > 1) { + words.push_back(" "); + words.push_back(word); + begin = (begin==-1)?timestamp_list[i][0]:begin; + std::vector vec = {begin, timestamp_list[i][1]}; + timestamp_merge.emplace_back(vec); + begin = -1; + pre_english_len = word.size(); + } + else { + // if (word.size() > 1) { + // words.push_back(" "); + // } + words.push_back(" "); + words.push_back(word); + begin = (begin==-1)?timestamp_list[i][0]:begin; + std::vector vec = {begin, timestamp_list[i][1]}; + timestamp_merge.emplace_back(vec); + begin = -1; + pre_english_len = word.size(); + } + } + is_pre_english = true; + } + } + } + string stamp_str=""; + for (i=0; i& us_alphas, + std::vector us_cif_peak, + std::vector& char_list, + std::string &res_str, + std::vector> ×tamp_vec, + float begin_time, + float total_offset){ + if (char_list.empty()) { + return ; + } + + const float START_END_THRESHOLD = 5.0; + const float MAX_TOKEN_DURATION = 30.0; + const float TIME_RATE = 10.0 * 6 / 1000 / 3; + // 3 times upsampled, cif_peak is flattened into a 1D array + std::vector cif_peak = us_cif_peak; + int num_frames = cif_peak.size(); + if (char_list.back() == "") { + char_list.pop_back(); + } + if (char_list.empty()) { + return ; + } + vector> timestamp_list; + vector new_char_list; + vector fire_place; + // for bicif model trained with large data, cif2 actually fires when a character starts + // so treat the frames between two peaks as the duration of the former token + for (int i = 0; i < num_frames; i++) { + if (cif_peak[i] > 1.0 - 1e-4) { + fire_place.push_back(i + total_offset); + } + } + int num_peak = fire_place.size(); + if(num_peak != (int)char_list.size() + 1){ + float sum = std::accumulate(us_alphas.begin(), us_alphas.end(), 0.0f); + float scale = sum/((int)char_list.size() + 1); + if(scale == 0){ + return; + } + cif_peak.clear(); + sum = 0.0; + for(auto &alpha:us_alphas){ + alpha = alpha/scale; + sum += alpha; + cif_peak.emplace_back(sum); + if(sum>=1.0 - 1e-4){ + sum -=(1.0 - 1e-4); + } + } + + fire_place.clear(); + for (int i = 0; i < num_frames; i++) { + if (cif_peak[i] > 1.0 - 1e-4) { + fire_place.push_back(i + total_offset); + } + } + } + + num_peak = fire_place.size(); + if(fire_place.size() == 0){ + return; + } + + // begin silence + if (fire_place[0] > START_END_THRESHOLD) { + new_char_list.push_back(""); + timestamp_list.push_back({0.0, fire_place[0] * TIME_RATE}); + } + + // tokens timestamp + for (int i = 0; i < num_peak - 1; i++) { + new_char_list.push_back(char_list[i]); + if (i == num_peak - 2 || MAX_TOKEN_DURATION < 0 || fire_place[i + 1] - fire_place[i] < MAX_TOKEN_DURATION) { + timestamp_list.push_back({fire_place[i] * TIME_RATE, fire_place[i + 1] * TIME_RATE}); + } else { + // cut the duration to token and sil of the 0-weight frames last long + float _split = fire_place[i] + MAX_TOKEN_DURATION; + timestamp_list.push_back({fire_place[i] * TIME_RATE, _split * TIME_RATE}); + timestamp_list.push_back({_split * TIME_RATE, fire_place[i + 1] * TIME_RATE}); + new_char_list.push_back(""); + } + } + + // tail token and end silence + if(timestamp_list.size()==0){ + LOG(ERROR)<<"timestamp_list's size is 0!"; + return; + } + if (num_frames - fire_place.back() > START_END_THRESHOLD) { + float _end = (num_frames + fire_place.back()) / 2.0; + timestamp_list.back()[1] = _end * TIME_RATE; + timestamp_list.push_back({_end * TIME_RATE, num_frames * TIME_RATE}); + new_char_list.push_back(""); + } else { + timestamp_list.back()[1] = num_frames * TIME_RATE; + } + + if (begin_time) { // add offset time in model with vad + for (auto& timestamp : timestamp_list) { + timestamp[0] += begin_time / 1000.0; + timestamp[1] += begin_time / 1000.0; + } + } + + assert(new_char_list.size() == timestamp_list.size()); + + for (int i = 0; i < (int)new_char_list.size(); i++) { + res_str += new_char_list[i] + " " + to_string(timestamp_list[i][0]) + " " + to_string(timestamp_list[i][1]) + ";"; + } + + for (int i = 0; i < (int)new_char_list.size(); i++) { + if(new_char_list[i] != ""){ + timestamp_vec.push_back(timestamp_list[i]); + } + } +} + +bool IsTargetFile(const std::string& filename, const std::string target) { + std::size_t pos = filename.find_last_of("."); + if (pos == std::string::npos) { + return false; + } + std::string extension = filename.substr(pos + 1); + return (extension == target); +} + +void Trim(std::string *str) { + const char *white_chars = " \t\n\r\f\v"; + + std::string::size_type pos = str->find_last_not_of(white_chars); + if (pos != std::string::npos) { + str->erase(pos + 1); + pos = str->find_first_not_of(white_chars); + if (pos != std::string::npos) str->erase(0, pos); + } else { + str->erase(str->begin(), str->end()); + } +} + +void SplitStringToVector(const std::string &full, const char *delim, + bool omit_empty_strings, + std::vector *out) { + size_t start = 0, found = 0, end = full.size(); + out->clear(); + while (found != std::string::npos) { + found = full.find_first_of(delim, start); + // start != end condition is for when the delimiter is at the end + if (!omit_empty_strings || (found != start && start != end)) + out->push_back(full.substr(start, found - start)); + start = found + 1; + } +} + +void ExtractHws(string hws_file, unordered_map &hws_map) +{ + if(hws_file.empty()){ + return; + } + std::string line; + std::ifstream ifs_hws(hws_file.c_str()); + if(!ifs_hws.is_open()){ + LOG(ERROR) << "Unable to open hotwords file: " << hws_file + << ". If you have not set hotwords, please ignore this message."; + return; + } + LOG(INFO) << "hotwords: "; + while (getline(ifs_hws, line)) { + Trim(&line); + if (line.empty()) { + continue; + } + float score = 1.0f; + std::vector text; + SplitStringToVector(line, " ", true, &text); + + if (text.size() > 1) { + try{ + score = std::stof(text[text.size() - 1]); + }catch (std::exception const &e) + { + LOG(ERROR)< &hws_map, string& nn_hotwords_) +{ + if(hws_file.empty()){ + return; + } + std::string line; + std::ifstream ifs_hws(hws_file.c_str()); + if(!ifs_hws.is_open()){ + LOG(ERROR) << "Unable to open hotwords file: " << hws_file + << ". If you have not set hotwords, please ignore this message."; + return; + } + LOG(INFO) << "hotwords: "; + while (getline(ifs_hws, line)) { + Trim(&line); + if (line.empty()) { + continue; + } + float score = 1.0f; + std::vector text; + SplitStringToVector(line, " ", true, &text); + + if (text.size() > 1) { + try{ + score = std::stof(text[text.size() - 1]); + }catch (std::exception const &e) + { + LOG(ERROR)< +#include +#include +#include +#include "tensor.h" + +using namespace std; + +namespace funasr { +typedef unsigned short U16CHAR_T; +extern float *LoadParams(const char *filename); + +extern void SaveDataFile(const char *filename, void *data, uint32_t len); +extern void Relu(Tensor *din); +extern void Swish(Tensor *din); +extern void Sigmoid(Tensor *din); +extern void DoubleSwish(Tensor *din); + +extern void Softmax(float *din, int mask, int len); + +extern void LogSoftmax(float *din, int len); +extern int ValAlign(int val, int align); +extern void DispParams(float *din, int size); + +extern void BasicNorm(Tensor *&din, float norm); + +extern void FindMax(float *din, int len, float &max_val, int &max_idx); + +extern void Glu(Tensor *din, Tensor *dout); + +string PathAppend(const string &p1, const string &p2); +bool is_target_file(const std::string& filename, const std::string target); + +void KeepChineseCharacterAndSplit(const std::string &input_str, + std::vector &chinese_characters); +void SplitChiEngCharacters(const std::string &input_str, + std::vector &characters); +void TimestampAdd(std::deque &alignment_str1, std::string str_word); +vector> ParseTimestamps(const std::string& str); +bool TimestampIsDigit(U16CHAR_T &u16); +bool TimestampIsAlpha(U16CHAR_T &u16); +bool TimestampIsPunctuation(U16CHAR_T &u16); +bool TimestampIsPunctuation(const std::string& str); +void TimestampSplitChiEngCharacters(const std::string &input_str, + std::vector &characters); +std::string VectorToString(const std::vector>& vec, bool out_empty=true); +std::string TimestampSmooth(std::string &text, std::string &text_itn, std::string &str_time); +std::string TimestampSentence(std::string &text, std::string &str_time); +std::vector split(const std::string &s, char delim); + +template +void PrintMat(const std::vector> &mat, const std::string &name); +void Trim(std::string *str); +size_t Utf8ToCharset(const std::string &input, std::vector &output); +void SplitStringToVector(const std::string &full, const char *delim, + bool omit_empty_strings, + std::vector *out); +string PostProcess(std::vector &raw_char, + std::vector> ×tamp_list); +void TimestampOnnx( std::vector& us_alphas, + std::vector us_cif_peak, + std::vector& char_list, + std::string &res_str, + std::vector> ×tamp_vec, + float begin_time = 0.0, + float total_offset = -1.5); +bool IsTargetFile(const std::string& filename, const std::string target); +void ExtractHws(string hws_file, unordered_map &hws_map); +void ExtractHws(string hws_file, unordered_map &hws_map, string& nn_hotwords_); +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/src/vad-model.cpp b/runtime/onnxruntime/src/vad-model.cpp new file mode 100644 index 0000000..c164c3e --- /dev/null +++ b/runtime/onnxruntime/src/vad-model.cpp @@ -0,0 +1,31 @@ +#include "precomp.h" + +namespace funasr { +VadModel *CreateVadModel(std::map& model_path, int thread_num) +{ + VadModel *mm; + mm = new FsmnVad(); + + string vad_model_path; + string vad_cmvn_path; + string vad_config_path; + + vad_model_path = PathAppend(model_path.at(MODEL_DIR), MODEL_NAME); + if(model_path.find(QUANTIZE) != model_path.end() && model_path.at(QUANTIZE) == "true"){ + vad_model_path = PathAppend(model_path.at(MODEL_DIR), QUANT_MODEL_NAME); + } + vad_cmvn_path = PathAppend(model_path.at(MODEL_DIR), VAD_CMVN_NAME); + vad_config_path = PathAppend(model_path.at(MODEL_DIR), VAD_CONFIG_NAME); + + mm->InitVad(vad_model_path, vad_cmvn_path, vad_config_path, thread_num); + return mm; +} + +VadModel *CreateVadModel(void* fsmnvad_handle) +{ + VadModel *mm; + mm = new FsmnVadOnline((FsmnVad*)fsmnvad_handle); + return mm; +} + +} // namespace funasr \ No newline at end of file diff --git a/runtime/onnxruntime/src/vocab.cpp b/runtime/onnxruntime/src/vocab.cpp new file mode 100644 index 0000000..1416dd3 --- /dev/null +++ b/runtime/onnxruntime/src/vocab.cpp @@ -0,0 +1,285 @@ +#include "vocab.h" +#include +#include + +#include +#include +#include +#include +#include + +using namespace std; + +namespace funasr { +Vocab::Vocab(const char *filename) +{ + ifstream in(filename); + LoadVocabFromJson(filename); +} +Vocab::Vocab(const char *filename, const char *lex_file) +{ + ifstream in(filename); + LoadVocabFromYaml(filename); + LoadLex(lex_file); +} +Vocab::~Vocab() +{ +} + +void Vocab::LoadVocabFromYaml(const char* filename){ + YAML::Node config; + try{ + config = YAML::LoadFile(filename); + }catch(exception const &e){ + LOG(INFO) << "Error loading file, yaml file error or not exist."; + exit(-1); + } + YAML::Node myList = config["token_list"]; + int i = 0; + for (YAML::const_iterator it = myList.begin(); it != myList.end(); ++it) { + vocab.push_back(it->as()); + token_id[it->as()] = i; + i ++; + } +} + +void Vocab::LoadVocabFromJson(const char* filename){ + nlohmann::json json_array; + std::ifstream file(filename); + if (file.is_open()) { + file >> json_array; + file.close(); + } else { + LOG(INFO) << "Error loading token file, token file error or not exist."; + exit(-1); + } + + int i = 0; + for (const auto& element : json_array) { + vocab.push_back(element); + token_id[element] = i; + i++; + } +} + +void Vocab::LoadLex(const char* filename){ + std::ifstream file(filename); + std::string line; + while (std::getline(file, line)) { + std::string key, value; + std::istringstream iss(line); + std::getline(iss, key, '\t'); + std::getline(iss, value); + + if (!key.empty() && !value.empty()) { + lex_map[key] = value; + } + } + + file.close(); +} + +string Vocab::Word2Lex(const std::string &word) const { + auto it = lex_map.find(word); + if (it != lex_map.end()) { + return it->second; + } + return ""; +} + +int Vocab::GetIdByToken(const std::string &token) const { + auto it = token_id.find(token); + if (it != token_id.end()) { + return it->second; + } + return -1; +} + +void Vocab::Vector2String(vector in, std::vector &preds) +{ + for (auto it = in.begin(); it != in.end(); it++) { + string word = vocab[*it]; + preds.emplace_back(word); + } +} + +string Vocab::Vector2String(vector in) +{ + int i; + stringstream ss; + for (auto it = in.begin(); it != in.end(); it++) { + ss << vocab[*it]; + } + return ss.str(); +} + +int Str2Int(string str) +{ + const char *ch_array = str.c_str(); + if (((ch_array[0] & 0xf0) != 0xe0) || ((ch_array[1] & 0xc0) != 0x80) || + ((ch_array[2] & 0xc0) != 0x80)) + return 0; + int val = ((ch_array[0] & 0x0f) << 12) | ((ch_array[1] & 0x3f) << 6) | + (ch_array[2] & 0x3f); + return val; +} + +string Vocab::Id2String(int id) const +{ + if (id < 0 || id >= vocab.size()) { + LOG(INFO) << "Error vocabulary id, this id do not exit."; + return ""; + } else { + return vocab[id]; + } +} + +bool Vocab::IsChinese(string ch) +{ + if (ch.size() != 3) { + return false; + } + int unicode = Str2Int(ch); + if (unicode >= 19968 && unicode <= 40959) { + return true; + } + return false; +} + +string Vocab::WordFormat(std::string word) +{ + if(word == "i"){ + return "I"; + }else if(word == "i'm"){ + return "I'm"; + }else if(word == "i've"){ + return "I've"; + }else if(word == "i'll"){ + return "I'll"; + }else{ + return word; + } +} + +string Vocab::Vector2StringV2(vector in, std::string language) +{ + int i; + list words; + int is_pre_english = false; + int pre_english_len = 0; + int is_combining = false; + std::string combine = ""; + std::string unicodeChar = "▁"; + + for (i=0; i" || word == "" || word == "") + continue; + if (language == "en-bpe"){ + size_t found = word.find(unicodeChar); + if(found != std::string::npos){ + if (combine != ""){ + combine = WordFormat(combine); + if (words.size() != 0){ + combine = " " + combine; + } + words.push_back(combine); + } + combine = word.substr(3); + }else{ + combine += word; + } + continue; + } + // step2 combie phoneme to full word + { + int sub_word = !(word.find("@@") == string::npos); + // process word start and middle part + if (sub_word) { + // if badcase: lo@@ chinese + if (i == in.size()-1 || i 1) { + words.push_back(" "); + words.push_back(word); + pre_english_len = word.size(); + } + else { + if (word.size() > 1) { + words.push_back(" "); + } + words.push_back(word); + pre_english_len = word.size(); + } + } + is_pre_english = true; + } + } + } + + if (language == "en-bpe" && combine != ""){ + combine = WordFormat(combine); + if (words.size() != 0){ + combine = " " + combine; + } + words.push_back(combine); + } + + stringstream ss; + for (auto it = words.begin(); it != words.end(); it++) { + ss << *it; + } + + return ss.str(); +} + +int Vocab::Size() const +{ + return vocab.size(); +} + +} // namespace funasr diff --git a/runtime/onnxruntime/src/vocab.h b/runtime/onnxruntime/src/vocab.h new file mode 100644 index 0000000..36fabf4 --- /dev/null +++ b/runtime/onnxruntime/src/vocab.h @@ -0,0 +1,39 @@ + +#ifndef VOCAB_H +#define VOCAB_H + +#include +#include +#include +#include +#include "nlohmann/json.hpp" +using namespace std; + +namespace funasr { +class Vocab { + private: + vector vocab; + std::map token_id; + std::map lex_map; + bool IsEnglish(string ch); + void LoadVocabFromYaml(const char* filename); + void LoadVocabFromJson(const char* filename); + void LoadLex(const char* filename); + + public: + Vocab(const char *filename); + Vocab(const char *filename, const char *lex_file); + ~Vocab(); + int Size() const; + bool IsChinese(string ch); + void Vector2String(vector in, std::vector &preds); + string Vector2String(vector in); + string Vector2StringV2(vector in, std::string language=""); + string Id2String(int id) const; + string WordFormat(std::string word); + int GetIdByToken(const std::string &token) const; + string Word2Lex(const std::string &word) const; +}; + +} // namespace funasr +#endif diff --git a/runtime/onnxruntime/src/wfst-decoder.cpp b/runtime/onnxruntime/src/wfst-decoder.cpp new file mode 100644 index 0000000..0bd2bff --- /dev/null +++ b/runtime/onnxruntime/src/wfst-decoder.cpp @@ -0,0 +1,114 @@ +#include +namespace funasr { +WfstDecoder::WfstDecoder(fst::Fst* lm, + PhoneSet* phone_set, Vocab* vocab, + float glob_beam, float lat_beam, float am_scale) +:dec_opts_(glob_beam, lat_beam, am_scale), decodable_(dec_opts_.acoustic_scale), + lm_(lm), phone_set_(phone_set), vocab_(vocab) { + decoder_ = std::shared_ptr( + new kaldi::LatticeFasterOnlineDecoder(*lm_, dec_opts_)); +} + +WfstDecoder::~WfstDecoder() { +} + +void WfstDecoder::StartUtterance() { + if (decoder_) { + cur_frame_ = 0; + cur_token_ = 0; + decodable_.Reset(); + decoder_->InitDecoding(); + } +} + +void WfstDecoder::EndUtterance() { +} + +string WfstDecoder::Search(float *in, int len, int64_t token_num) { + string result; + if (len == 0) { + return ""; + } + std::vector> logp_vec; + int blk_phn_id = phone_set_->GetBlkPhnId(); + for (int i = 0; i < len - 1; i++) { + std::vector tmp_logp; + for (int j = 0; j < token_num; j++) { + tmp_logp.push_back((in + i * token_num)[j]); + } + logp_vec.push_back(tmp_logp); + } + for (int i = 0; i < logp_vec.size(); i++) { + cur_frame_++; + decodable_.AcceptLoglikes(logp_vec[i]); + decoder_->AdvanceDecoding(&decodable_, 1); + cur_token_++; + } + if (cur_token_ > 0) { + std::vector words; + kaldi::Lattice lattice; + decoder_->GetBestPath(&lattice, false); + std::vector alignment; + kaldi::LatticeWeight weight; + fst::GetLinearSymbolSequence(lattice, &alignment, &words, &weight); + result = vocab_->Vector2StringV2(words); + } + return result; +} + +string WfstDecoder::FinalizeDecode(bool is_stamp, std::vector us_alphas, std::vector us_cif_peak) { + string result; + if (cur_token_ > 0) { + std::vector words; + kaldi::Lattice lattice; + decodable_.SetFinished(); + decoder_->FinalizeDecoding(); + decoder_->GetBestPath(&lattice, true); + std::vector alignment; + kaldi::LatticeWeight weight; + fst::GetLinearSymbolSequence(lattice, &alignment, &words, &weight); + + if(!is_stamp){ + return vocab_->Vector2StringV2(words); + }else{ + std::vector char_list; + std::vector> timestamp_list; + std::string res_str; + vocab_->Vector2String(words, char_list); + // split chinese word to char + std::vector split_chars; + for(auto& word:char_list){ + std::vector word2char; + SplitChiEngCharacters(word, word2char); + split_chars.insert(split_chars.end(), word2char.begin(), word2char.end()); + } + // std::vector raw_char(char_list); + TimestampOnnx(us_alphas, us_cif_peak, split_chars, res_str, timestamp_list); + + return PostProcess(split_chars, timestamp_list); + } + } + return result; +} + +void WfstDecoder::LoadHwsRes(int inc_bias, unordered_map &hws_map) { + try { + if (!hws_map.empty()) { + bias_lm_ = std::make_shared(hws_map, inc_bias, + *phone_set_, *vocab_); + decoder_->SetBiasLm(bias_lm_); + } + } catch (std::exception const &e) { + LOG(ERROR) << "Error when load wfst hotwords resource: " << e.what(); + exit(0); + } +} + +void WfstDecoder::UnloadHwsRes() { + if (bias_lm_) { + decoder_->ClearBiasLm(); + bias_lm_.reset(); + } +} + +} // namespace funasr diff --git a/runtime/onnxruntime/src/wfst-decoder.h b/runtime/onnxruntime/src/wfst-decoder.h new file mode 100644 index 0000000..1acf6d8 --- /dev/null +++ b/runtime/onnxruntime/src/wfst-decoder.h @@ -0,0 +1,86 @@ +#ifndef WFST_DECODER_ +#define WFST_DECODER_ +#include "kaldi/decoder/lattice-faster-online-decoder.h" +#include "model.h" +#include "fst/fstlib.h" +#include "fst/symbol-table.h" +#include "bias-lm.h" +#include "phone-set.h" +#include "util.h" + +#define MAX_SCORE 10.0f +namespace funasr { +class Decodable : public kaldi::DecodableInterface { + public: + Decodable(float scale = 1.0f) : scale_(scale) { + Reset(); + } + void Reset() { + num_frames_ = 0; + finished_ = false; + logp_.clear(); + } + + int NumFramesReady() const { return num_frames_; } + + bool IsLastFrame(int frame) const { + return finished_ && (frame == num_frames_ - 1); + } + + float LogLikelihood(int frm, int id) { + CHECK_GT(id, 0); + CHECK_LT(frm, num_frames_); + return scale_ * logp_[id - 1]; + } + + void AcceptLoglikes(const std::vector& logp) { + num_frames_++; + logp_ = logp; + } + + int NumIndices() const { return 0; } + void SetFinished() { finished_ = true; } + + private: + int num_frames_ = 0; + float scale_ = 1.0f; + bool finished_ = false; + std::vector logp_; +}; + +struct DecodeOptions : public kaldi::LatticeFasterDecoderConfig { + DecodeOptions(float glob_beam = 3.0f, float lat_beam = 3.0f, float ac_sc = 10.0f) : + kaldi::LatticeFasterDecoderConfig(glob_beam, lat_beam), acoustic_scale(ac_sc) { + } + float acoustic_scale; +}; + +class WfstDecoder { + public: + WfstDecoder(fst::Fst* lm, + PhoneSet* phone_set, + Vocab* vocab, + float glob_beam, + float lat_beam, + float am_scale); + ~WfstDecoder(); + void StartUtterance(); + void EndUtterance(); + string Search(float *in, int len, int64_t token_nums); + string FinalizeDecode(bool is_stamp=false, std::vector us_alphas={0}, std::vector us_cif_peak={0}); + void LoadHwsRes(int inc_bias, unordered_map &hws_map); + void UnloadHwsRes(); + + private: + Vocab* vocab_ = nullptr; + PhoneSet* phone_set_ = nullptr; + int cur_frame_ = 0; + int cur_token_ = 0; + DecodeOptions dec_opts_; + Decodable decodable_; + fst::Fst* lm_ = nullptr; + std::shared_ptr decoder_ = nullptr; + std::shared_ptr bias_lm_ = nullptr; +}; +} // namespace funasr +#endif // WFST_DECODER_ diff --git a/runtime/onnxruntime/src/win_func.h b/runtime/onnxruntime/src/win_func.h new file mode 100644 index 0000000..5d6696e --- /dev/null +++ b/runtime/onnxruntime/src/win_func.h @@ -0,0 +1,38 @@ +#ifndef WIN_FUNC_ +#define WIN_FUNC_ +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include + +#ifndef R_OK +#define R_OK 4 +#endif +#ifndef W_OK +#define W_OK 2 +#endif +#ifndef X_OK +#define X_OK 0 +#endif +#ifndef F_OK +#define F_OK 0 +#endif +#define access _access + +static inline int gettimeofday(struct timeval* tv, void* /*tz*/) { + FILETIME ft; + ULARGE_INTEGER li; + ULONGLONG tt; + GetSystemTimeAsFileTime(&ft); + li.LowPart = ft.dwLowDateTime; + li.HighPart = ft.dwHighDateTime; + tt = (li.QuadPart - 116444736000000000ULL) / 10; + tv->tv_sec = tt / 1000000; + tv->tv_usec = tt % 1000000; + return 0; +} +#endif +#endif \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/download_ffmpeg.sh b/runtime/onnxruntime/third_party/download_ffmpeg.sh new file mode 100644 index 0000000..c0fbcea --- /dev/null +++ b/runtime/onnxruntime/third_party/download_ffmpeg.sh @@ -0,0 +1,2 @@ +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-N-111383-g20b8688092-linux64-gpl-shared.tar.xz +tar -xvf ffmpeg-N-111383-g20b8688092-linux64-gpl-shared.tar.xz diff --git a/runtime/onnxruntime/third_party/download_onnxruntime.sh b/runtime/onnxruntime/third_party/download_onnxruntime.sh new file mode 100644 index 0000000..adaddc5 --- /dev/null +++ b/runtime/onnxruntime/third_party/download_onnxruntime.sh @@ -0,0 +1,5 @@ + +# download an appropriate onnxruntime from https://github.com/microsoft/onnxruntime/releases/tag/v1.14.0 +# here we get a copy of onnxruntime for linux 64 +wget https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-linux-x64-1.14.0.tgz +tar -zxvf onnxruntime-linux-x64-1.14.0.tgz \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/gflags/.gitattributes b/runtime/onnxruntime/third_party/gflags/.gitattributes new file mode 100644 index 0000000..87fe9c0 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/.gitattributes @@ -0,0 +1,3 @@ +# treat all files in this repository as text files +# and normalize them to LF line endings when committed +* text diff --git a/runtime/onnxruntime/third_party/gflags/.gitmodules b/runtime/onnxruntime/third_party/gflags/.gitmodules new file mode 100644 index 0000000..aa2072c --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/.gitmodules @@ -0,0 +1,4 @@ +[submodule "doc"] + path = doc + url = https://github.com/gflags/gflags.git + branch = gh-pages diff --git a/runtime/onnxruntime/third_party/gflags/.travis.yml b/runtime/onnxruntime/third_party/gflags/.travis.yml new file mode 100644 index 0000000..0989c7c --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/.travis.yml @@ -0,0 +1,20 @@ +# Ubuntu 14.04 Trusty support, to get newer cmake and compilers. +sudo: required +dist: trusty + +language: cpp + +os: + - linux + - osx + +compiler: + - clang + - gcc + +env: + - CONFIG=Release + - CONFIG=Debug + +script: + - mkdir out && cd out && cmake -D CMAKE_BUILD_TYPE=$CONFIG -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON -D GFLAGS_BUILD_TESTING=ON .. && cmake --build . --config $CONFIG && ctest diff --git a/runtime/onnxruntime/third_party/gflags/AUTHORS.txt b/runtime/onnxruntime/third_party/gflags/AUTHORS.txt new file mode 100644 index 0000000..887918b --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/AUTHORS.txt @@ -0,0 +1,2 @@ +google-gflags@googlegroups.com + diff --git a/runtime/onnxruntime/third_party/gflags/CMakeLists.txt b/runtime/onnxruntime/third_party/gflags/CMakeLists.txt new file mode 100644 index 0000000..657a1f4 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/CMakeLists.txt @@ -0,0 +1,741 @@ +## CMake configuration file of gflags project +## +## This CMakeLists.txt defines some gflags specific configuration variables +## using the "gflags_define" utility macro. The default values of these variables +## can be overridden either on the CMake command-line using the -D option of +## the cmake command or in a super-project which includes the gflags source +## tree by setting the GFLAGS_ CMake variables before adding the +## gflags source directory via CMake's "add_subdirectory" command. Only when +## the non-cached variable GFLAGS_IS_SUBPROJECT has a value equivalent to FALSE, +## these configuration variables are added to the CMake cache so they can be +## edited in the CMake GUI. By default, GFLAGS_IS_SUBPROJECT is set to TRUE when +## the CMAKE_SOURCE_DIR is not identical to the directory of this CMakeLists.txt +## file, i.e., the top-level directory of the gflags project source tree. +## +## When this project is a subproject (GFLAGS_IS_SUBPROJECT is TRUE), the default +## settings are such that only the static single-threaded library is built without +## installation of the gflags files. The "gflags::gflags" target is in this case an ALIAS +## library target for the "gflags_nothreads_static" library target. Targets which +## depend on the gflags library should link to the "gflags::gflags" library target. +## +## Example CMakeLists.txt of user project which requires separate gflags installation: +## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +## +## project(Foo) +## +## find_package(gflags REQUIRED) +## +## add_executable(foo src/foo.cc) +## target_link_libraries(foo gflags::gflags) +## +## Example CMakeLists.txt of user project which requires separate single-threaded static gflags installation: +## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +## +## project(Foo) +## +## find_package(gflags COMPONENTS nothreads_static) +## +## add_executable(foo src/foo.cc) +## target_link_libraries(foo gflags::gflags) +## +## Example CMakeLists.txt of super-project which contains gflags source tree: +## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +## +## project(Foo) +## +## add_subdirectory(gflags) +## +## add_executable(foo src/foo.cc) +## target_link_libraries(foo gflags::gflags) +## +## Variables to configure the source files: +## - GFLAGS_IS_A_DLL +## - GFLAGS_NAMESPACE +## - GFLAGS_ATTRIBUTE_UNUSED +## - GFLAGS_INTTYPES_FORMAT +## +## Variables to configure the build: +## - GFLAGS_SOVERSION +## - GFLAGS_BUILD_SHARED_LIBS +## - GFLAGS_BUILD_STATIC_LIBS +## - GFLAGS_BUILD_gflags_LIB +## - GFLAGS_BUILD_gflags_nothreads_LIB +## - GFLAGS_BUILD_TESTING +## - GFLAGS_BUILD_PACKAGING +## +## Variables to configure the installation: +## - GFLAGS_INCLUDE_DIR +## - GFLAGS_LIBRARY_INSTALL_DIR or LIB_INSTALL_DIR or LIB_SUFFIX +## - GFLAGS_INSTALL_HEADERS +## - GFLAGS_INSTALL_SHARED_LIBS +## - GFLAGS_INSTALL_STATIC_LIBS + +cmake_minimum_required (VERSION 3.0.2 FATAL_ERROR) + +if (POLICY CMP0042) + cmake_policy (SET CMP0042 NEW) +endif () + +if (POLICY CMP0048) + cmake_policy (SET CMP0048 NEW) +endif () + +# ---------------------------------------------------------------------------- +# includes +include ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake") + +# ---------------------------------------------------------------------------- +# package information +set (PACKAGE_NAME "gflags") +set (PACKAGE_VERSION "2.2.2") +set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set (PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") +set (PACKAGE_BUGREPORT "https://github.com/gflags/gflags/issues") +set (PACKAGE_DESCRIPTION "A commandline flags library that allows for distributed flags.") +set (PACKAGE_URL "http://gflags.github.io/gflags") + +project (${PACKAGE_NAME} VERSION ${PACKAGE_VERSION} LANGUAGES CXX) +if (CMAKE_VERSION VERSION_LESS 3.4) + # C language still needed because the following required CMake modules + # (or their dependencies, respectively) are not correctly handling + # the case where only CXX is enabled + # - CheckTypeSize.cmake (fixed in CMake 3.1, cf. https://cmake.org/Bug/view.php?id=14056) + # - FindThreads.cmake (fixed in CMake 3.4, cf. https://cmake.org/Bug/view.php?id=14905) + enable_language (C) +endif () + +version_numbers ( + ${PACKAGE_VERSION} + PACKAGE_VERSION_MAJOR + PACKAGE_VERSION_MINOR + PACKAGE_VERSION_PATCH +) + +# shared library ABI version number, can be overridden by package maintainers +# using -DGFLAGS_SOVERSION=XXX on the command-line +if (GFLAGS_SOVERSION) + set (PACKAGE_SOVERSION "${GFLAGS_SOVERSION}") +else () + # TODO: Change default SOVERSION back to PACKAGE_VERSION_MAJOR with the + # next increase of major version number (i.e., 3.0.0 -> SOVERSION 3) + # The . SOVERSION should be used for the 2.x releases + # versions only which temporarily broke the API by changing the default + # namespace from "google" to "gflags". + set (PACKAGE_SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}") +endif () + +# when gflags is included as subproject (e.g., as Git submodule/subtree) in the source +# tree of a project that uses it, no variables should be added to the CMake cache; +# users may set the non-cached variable GFLAGS_IS_SUBPROJECT before add_subdirectory(gflags) +if (NOT DEFINED GFLAGS_IS_SUBPROJECT) + if ("^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$") + set (GFLAGS_IS_SUBPROJECT FALSE) + else () + set (GFLAGS_IS_SUBPROJECT TRUE) + endif () +endif () + +# prefix for package variables in CMake configuration file +string (TOUPPER "${PACKAGE_NAME}" PACKAGE_PREFIX) + +# convert file path on Windows with back slashes to path with forward slashes +# otherwise this causes an issue with the cmake_install.cmake script +file (TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) + +# ---------------------------------------------------------------------------- +# options + +# maintain binary backwards compatibility with gflags library version <= 2.0, +# but at the same time enable the use of the preferred new "gflags" namespace +gflags_define (STRING NAMESPACE "Name(s) of library namespace (separate multiple options by semicolon)" "google;${PACKAGE_NAME}" "${PACKAGE_NAME}") +gflags_property (NAMESPACE ADVANCED TRUE) +set (GFLAGS_NAMESPACE_SECONDARY "${NAMESPACE}") +list (REMOVE_DUPLICATES GFLAGS_NAMESPACE_SECONDARY) +if (NOT GFLAGS_NAMESPACE_SECONDARY) + message (FATAL_ERROR "GFLAGS_NAMESPACE must be set to one (or more) valid C++ namespace identifier(s separated by semicolon \";\").") +endif () +foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY) + if (NOT ns MATCHES "^[a-zA-Z][a-zA-Z0-9_]*$") + message (FATAL_ERROR "GFLAGS_NAMESPACE contains invalid namespace identifier: ${ns}") + endif () +endforeach () +list (GET GFLAGS_NAMESPACE_SECONDARY 0 GFLAGS_NAMESPACE) +list (REMOVE_AT GFLAGS_NAMESPACE_SECONDARY 0) + +# cached build options when gflags is not a subproject, otherwise non-cached CMake variables +# usage: gflags_define(BOOL []) +gflags_define (BOOL BUILD_SHARED_LIBS "Request build of shared libraries." OFF OFF) +gflags_define (BOOL BUILD_STATIC_LIBS "Request build of static libraries (default if BUILD_SHARED_LIBS is OFF)." OFF ON) +gflags_define (BOOL BUILD_gflags_LIB "Request build of the multi-threaded gflags library." ON OFF) +gflags_define (BOOL BUILD_gflags_nothreads_LIB "Request build of the single-threaded gflags library." ON ON) +gflags_define (BOOL BUILD_PACKAGING "Enable build of distribution packages using CPack." OFF OFF) +gflags_define (BOOL BUILD_TESTING "Enable build of the unit tests and their execution using CTest." OFF OFF) +gflags_define (BOOL INSTALL_HEADERS "Request installation of headers and other development files." ON OFF) +gflags_define (BOOL INSTALL_SHARED_LIBS "Request installation of shared libraries." ON ON) +gflags_define (BOOL INSTALL_STATIC_LIBS "Request installation of static libraries." ON OFF) +gflags_define (BOOL REGISTER_BUILD_DIR "Request entry of build directory in CMake's package registry." OFF OFF) +gflags_define (BOOL REGISTER_INSTALL_PREFIX "Request entry of installed package in CMake's package registry." ON OFF) + +gflags_property (BUILD_STATIC_LIBS ADVANCED TRUE) +gflags_property (INSTALL_HEADERS ADVANCED TRUE) +gflags_property (INSTALL_SHARED_LIBS ADVANCED TRUE) +gflags_property (INSTALL_STATIC_LIBS ADVANCED TRUE) + +if (NOT GFLAGS_IS_SUBPROJECT) + foreach (varname IN ITEMS CMAKE_INSTALL_PREFIX) + gflags_property (${varname} ADVANCED FALSE) + endforeach () + foreach (varname IN ITEMS CMAKE_CONFIGURATION_TYPES CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT) + gflags_property (${varname} ADVANCED TRUE) + endforeach () + if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) + gflags_set (CMAKE_BUILD_TYPE Release) + endif () + if (CMAKE_CONFIGURATION_TYPES) + gflags_property (CMAKE_BUILD_TYPE STRINGS "${CMAKE_CONFIGURATION_TYPES}") + endif () +endif () # NOT GFLAGS_IS_SUBPROJECT + +if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) + set (BUILD_STATIC_LIBS ON) +endif () +if (NOT BUILD_gflags_LIB AND NOT BUILD_gflags_nothreads_LIB) + message (FATAL_ERROR "At least one of [GFLAGS_]BUILD_gflags_LIB and [GFLAGS_]BUILD_gflags_nothreads_LIB must be ON.") +endif () + +gflags_define (STRING INCLUDE_DIR "Name of include directory of installed header files relative to CMAKE_INSTALL_PREFIX/include/" "${PACKAGE_NAME}") +gflags_property (INCLUDE_DIR ADVANCED TRUE) +file (TO_CMAKE_PATH "${INCLUDE_DIR}" INCLUDE_DIR) +if (IS_ABSOLUTE INCLUDE_DIR) + message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must be a path relative to CMAKE_INSTALL_PREFIX/include/") +endif () +if (INCLUDE_DIR MATCHES "^\\.\\.[/\\]") + message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must not start with parent directory reference (../)") +endif () +set (GFLAGS_INCLUDE_DIR "${INCLUDE_DIR}") + +# ---------------------------------------------------------------------------- +# system checks +include (CheckTypeSize) +include (CheckIncludeFileCXX) +include (CheckCXXSymbolExists) + +if (WIN32 AND NOT CYGWIN) + set (OS_WINDOWS 1) +else () + set (OS_WINDOWS 0) +endif () + +if (MSVC) + set (HAVE_SYS_TYPES_H 1) + set (HAVE_STDDEF_H 1) # used by CheckTypeSize module + set (HAVE_UNISTD_H 0) + set (HAVE_SYS_STAT_H 1) + set (HAVE_SHLWAPI_H 1) + if (MSVC_VERSION VERSION_LESS 1600) + check_include_file_cxx ("stdint.h" HAVE_STDINT_H) + bool_to_int (HAVE_STDINT_H) # used in #if directive + else () + set (HAVE_STDINT_H 1) + endif () + if (MSVC_VERSION VERSION_LESS 1800) + check_include_file_cxx ("inttypes.h" HAVE_INTTYPES_H) + bool_to_int (HAVE_INTTYPES_H) # used in #if directive + else () + set (HAVE_INTTYPES_H 1) + endif () +else () + foreach (fname IN ITEMS unistd stdint inttypes sys/types sys/stat fnmatch) + string (TOUPPER "${fname}" FNAME) + string (REPLACE "/" "_" FNAME "${FNAME}") + if (NOT HAVE_${FNAME}_H) + check_include_file_cxx ("${fname}.h" HAVE_${FNAME}_H) + endif () + endforeach () + if (NOT HAVE_FNMATCH_H AND OS_WINDOWS) + check_include_file_cxx ("shlwapi.h" HAVE_SHLWAPI_H) + endif () + # the following are used in #if directives not #ifdef + bool_to_int (HAVE_STDINT_H) + bool_to_int (HAVE_SYS_TYPES_H) + bool_to_int (HAVE_INTTYPES_H) +endif () + +gflags_define (STRING INTTYPES_FORMAT "Format of integer types: \"C99\" (uint32_t), \"BSD\" (u_int32_t), \"VC7\" (__int32)" "") +gflags_property (INTTYPES_FORMAT STRINGS "C99;BSD;VC7") +gflags_property (INTTYPES_FORMAT ADVANCED TRUE) +if (NOT INTTYPES_FORMAT) + set (TYPES uint32_t u_int32_t) + if (MSVC) + list (INSERT TYPES 0 __int32) + endif () + foreach (type IN LISTS TYPES) + check_type_size (${type} ${type} LANGUAGE CXX) + if (HAVE_${type}) + break () + endif () + endforeach () + if (HAVE_uint32_t) + gflags_set (INTTYPES_FORMAT C99) + elseif (HAVE_u_int32_t) + gflags_set (INTTYPES_FORMAT BSD) + elseif (HAVE___int32) + gflags_set (INTTYPES_FORMAT VC7) + else () + gflags_property (INTTYPES_FORMAT ADVANCED FALSE) + message (FATAL_ERROR "Do not know how to define a 32-bit integer quantity on your system!" + " Neither uint32_t, u_int32_t, nor __int32 seem to be available." + " Set [GFLAGS_]INTTYPES_FORMAT to either C99, BSD, or VC7 and try again.") + endif () +endif () +# use of special characters in strings to circumvent bug #0008226 +if ("^${INTTYPES_FORMAT}$" STREQUAL "^WIN$") + gflags_set (INTTYPES_FORMAT VC7) +endif () +if (NOT INTTYPES_FORMAT MATCHES "^(C99|BSD|VC7)$") + message (FATAL_ERROR "Invalid value for [GFLAGS_]INTTYPES_FORMAT! Choose one of \"C99\", \"BSD\", or \"VC7\"") +endif () +set (GFLAGS_INTTYPES_FORMAT "${INTTYPES_FORMAT}") +set (GFLAGS_INTTYPES_FORMAT_C99 0) +set (GFLAGS_INTTYPES_FORMAT_BSD 0) +set (GFLAGS_INTTYPES_FORMAT_VC7 0) +set ("GFLAGS_INTTYPES_FORMAT_${INTTYPES_FORMAT}" 1) + +if (MSVC) + set (HAVE_strtoll 0) + set (HAVE_strtoq 0) +else () + check_cxx_symbol_exists (strtoll stdlib.h HAVE_STRTOLL) + if (NOT HAVE_STRTOLL) + check_cxx_symbol_exists (strtoq stdlib.h HAVE_STRTOQ) + endif () +endif () + +if (BUILD_gflags_LIB) + set (CMAKE_THREAD_PREFER_PTHREAD TRUE) + find_package (Threads) + if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) + set (HAVE_PTHREAD 1) + check_type_size (pthread_rwlock_t RWLOCK LANGUAGE CXX) + else () + set (HAVE_PTHREAD 0) + endif () + if (UNIX AND NOT HAVE_PTHREAD) + if (CMAKE_HAVE_PTHREAD_H) + set (what "library") + else () + set (what ".h file") + endif () + message (FATAL_ERROR "Could not find pthread${what}. Check the log file" + "\n\t${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" + "\nor disable the build of the multi-threaded gflags library (BUILD_gflags_LIB=OFF).") + endif () +else () + set (HAVE_PTHREAD 0) +endif () + +# ---------------------------------------------------------------------------- +# source files - excluding root subdirectory and/or .in suffix +set (PUBLIC_HDRS + "gflags.h" + "gflags_declare.h" + "gflags_completions.h" +) + +if (GFLAGS_NAMESPACE_SECONDARY) + set (INCLUDE_GFLAGS_NS_H "// Import gflags library symbols into alternative/deprecated namespace(s)") + foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY) + string (TOUPPER "${ns}" NS) + set (gflags_ns_h "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/gflags_${ns}.h") + configure_file ("${PROJECT_SOURCE_DIR}/src/gflags_ns.h.in" "${gflags_ns_h}" @ONLY) + list (APPEND PUBLIC_HDRS "${gflags_ns_h}") + set (INCLUDE_GFLAGS_NS_H "${INCLUDE_GFLAGS_NS_H}\n#include \"gflags_${ns}.h\"") + endforeach () +else () + set (INCLUDE_GFLAGS_NS_H) +endif () + +set (PRIVATE_HDRS + "defines.h" + "config.h" + "util.h" + "mutex.h" +) + +set (GFLAGS_SRCS + "gflags.cc" + "gflags_reporting.cc" + "gflags_completions.cc" +) + +if (OS_WINDOWS) + list (APPEND PRIVATE_HDRS "windows_port.h") + list (APPEND GFLAGS_SRCS "windows_port.cc") +endif () + +# ---------------------------------------------------------------------------- +# configure source files +if (NOT DEFINED GFLAGS_ATTRIBUTE_UNUSED) + if (CMAKE_COMPILER_IS_GNUCXX) + set (GFLAGS_ATTRIBUTE_UNUSED "__attribute((unused))") + else () + set (GFLAGS_ATTRIBUTE_UNUSED) + endif () +endif () + +# whenever we build a shared library (DLL on Windows), configure the public +# headers of the API for use of this shared library rather than the optionally +# also build statically linked library; users can override GFLAGS_DLL_DECL +# in particular, this done by setting the INTERFACE_COMPILE_DEFINITIONS of +# static libraries to include an empty definition for GFLAGS_DLL_DECL +if (NOT DEFINED GFLAGS_IS_A_DLL) + if (BUILD_SHARED_LIBS) + set (GFLAGS_IS_A_DLL 1) + else () + set (GFLAGS_IS_A_DLL 0) + endif () +endif () + +configure_headers (PUBLIC_HDRS ${PUBLIC_HDRS}) +configure_sources (PRIVATE_HDRS ${PRIVATE_HDRS}) +configure_sources (GFLAGS_SRCS ${GFLAGS_SRCS}) + +# ---------------------------------------------------------------------------- +# output directories +if (NOT GFLAGS_IS_SUBPROJECT) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin") + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib") + set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib") +endif () +# Set postfixes for generated libraries based on buildtype. +set(CMAKE_RELEASE_POSTFIX "") +set(CMAKE_DEBUG_POSTFIX "_debug") + +# ---------------------------------------------------------------------------- +# installation directories +if (OS_WINDOWS) + set (RUNTIME_INSTALL_DIR "bin") + set (LIBRARY_INSTALL_DIR "lib") + set (INCLUDE_INSTALL_DIR "include") + set (CONFIG_INSTALL_DIR "lib/cmake/${PACKAGE_NAME}") + set (PKGCONFIG_INSTALL_DIR) +else () + set (RUNTIME_INSTALL_DIR bin) + # The LIB_INSTALL_DIR and LIB_SUFFIX variables are used by the Fedora + # package maintainers. Also package maintainers of other distribution + # packages need to be able to specify the name of the library directory. + if (NOT GFLAGS_LIBRARY_INSTALL_DIR AND LIB_INSTALL_DIR) + set (GFLAGS_LIBRARY_INSTALL_DIR "${LIB_INSTALL_DIR}") + endif () + gflags_define (PATH LIBRARY_INSTALL_DIR "Directory of installed libraries, e.g., \"lib64\"" "lib${LIB_SUFFIX}") + gflags_property (LIBRARY_INSTALL_DIR ADVANCED TRUE) + set (INCLUDE_INSTALL_DIR include) + set (CONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/cmake/${PACKAGE_NAME}) + set (PKGCONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/pkgconfig) +endif () + +# ---------------------------------------------------------------------------- +# add library targets +set (TARGETS) +# static vs. shared +foreach (TYPE IN ITEMS STATIC SHARED) + if (BUILD_${TYPE}_LIBS) + string (TOLOWER "${TYPE}" type) + # whether or not targets are a DLL + if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^SHARED$") + set (GFLAGS_IS_A_DLL 1) + else () + set (GFLAGS_IS_A_DLL 0) + endif () + # filename suffix for static libraries on Windows + if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^STATIC$") + set (type_suffix "_${type}") + else () + set (type_suffix "") + endif () + # multi-threaded vs. single-threaded + foreach (opts IN ITEMS "" _nothreads) + if (BUILD_gflags${opts}_LIB) + set (target_name "gflags${opts}_${type}") + add_library (${target_name} ${TYPE} ${GFLAGS_SRCS} ${PRIVATE_HDRS} ${PUBLIC_HDRS}) + set_target_properties (${target_name} PROPERTIES + OUTPUT_NAME "gflags${opts}${type_suffix}" + VERSION "${PACKAGE_VERSION}" + SOVERSION "${PACKAGE_SOVERSION}" + ) + set (include_dirs "$") + if (INSTALL_HEADERS) + list (APPEND include_dirs "$") + endif () + target_include_directories (${target_name} + PUBLIC "${include_dirs}" + PRIVATE "${PROJECT_SOURCE_DIR}/src;${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}" + ) + target_compile_definitions (${target_name} PUBLIC GFLAGS_IS_A_DLL=${GFLAGS_IS_A_DLL}) + if (opts MATCHES "nothreads") + target_compile_definitions (${target_name} PRIVATE NO_THREADS) + elseif (CMAKE_USE_PTHREADS_INIT) + target_link_libraries (${target_name} ${CMAKE_THREAD_LIBS_INIT}) + endif () + if (HAVE_SHLWAPI_H) + target_link_libraries (${target_name} shlwapi.lib) + endif () + list (APPEND TARGETS ${target_name}) + # add convenience make target for build of both shared and static libraries + if (NOT GFLAGS_IS_SUBPROJECT) + if (NOT TARGET gflags${opts}) + add_custom_target (gflags${opts}) + endif () + add_dependencies (gflags${opts} ${target_name}) + endif () + endif () + endforeach () + endif () +endforeach () + +# add ALIAS target for use in super-project, prefer static over shared, single-threaded over multi-threaded +if (GFLAGS_IS_SUBPROJECT) + foreach (type IN ITEMS static shared) + foreach (opts IN ITEMS "_nothreads" "") + if (TARGET gflags${opts}_${type}) + # Define "gflags" alias for super-projects treating targets of this library as part of their own project + # (also for backwards compatibility with gflags 2.2.1 which only defined this alias) + add_library (gflags ALIAS gflags${opts}_${type}) + # Define "gflags::gflags" alias for projects that support both find_package(gflags) and add_subdirectory(gflags) + add_library (gflags::gflags ALIAS gflags${opts}_${type}) + break () + endif () + endforeach () + if (TARGET gflags::gflags) + break () + endif () + endforeach () +endif () + +# ---------------------------------------------------------------------------- +# installation rules +set (EXPORT_NAME ${PACKAGE_NAME}-targets) +file (RELATIVE_PATH INSTALL_PREFIX_REL2CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}") +configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake" @ONLY) +configure_file (cmake/version.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" @ONLY) + +if (BUILD_SHARED_LIBS AND INSTALL_SHARED_LIBS) + foreach (opts IN ITEMS "" _nothreads) + if (BUILD_gflags${opts}_LIB) + install (TARGETS gflags${opts}_shared + EXPORT ${EXPORT_NAME} + RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} + ) + endif () + endforeach () +endif () +if (BUILD_STATIC_LIBS AND INSTALL_STATIC_LIBS) + foreach (opts IN ITEMS "" _nothreads) + if (BUILD_gflags${opts}_LIB) + install (TARGETS gflags${opts}_static + EXPORT ${EXPORT_NAME} + RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} + ) + endif () + endforeach () +endif () + +if (INSTALL_HEADERS) + install (FILES ${PUBLIC_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/${GFLAGS_INCLUDE_DIR}) + install ( + FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake" + RENAME ${PACKAGE_NAME}-config.cmake + DESTINATION ${CONFIG_INSTALL_DIR} + ) + install ( + FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" + DESTINATION ${CONFIG_INSTALL_DIR} + ) + install ( + EXPORT ${EXPORT_NAME} + NAMESPACE ${PACKAGE_NAME}:: + DESTINATION ${CONFIG_INSTALL_DIR} + ) + install ( + EXPORT ${EXPORT_NAME} + FILE ${PACKAGE_NAME}-nonamespace-targets.cmake + DESTINATION ${CONFIG_INSTALL_DIR} + ) + if (UNIX) + install (PROGRAMS src/gflags_completions.sh DESTINATION ${RUNTIME_INSTALL_DIR}) + endif () +endif () + +if (PKGCONFIG_INSTALL_DIR) + configure_file ("cmake/package.pc.in" "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" @ONLY) + install (FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" DESTINATION "${PKGCONFIG_INSTALL_DIR}") +endif () + +# ---------------------------------------------------------------------------- +# support direct use of build tree +set (INSTALL_PREFIX_REL2CONFIG_DIR .) +export ( + TARGETS ${TARGETS} + NAMESPACE ${PACKAGE_NAME}:: + FILE "${PROJECT_BINARY_DIR}/${EXPORT_NAME}.cmake" +) +export ( + TARGETS ${TARGETS} + FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-nonamespace-targets.cmake" +) +if (REGISTER_BUILD_DIR) + export (PACKAGE ${PACKAGE_NAME}) +endif () +if (REGISTER_INSTALL_PREFIX) + register_gflags_package(${CONFIG_INSTALL_DIR}) +endif () +configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake" @ONLY) + +# ---------------------------------------------------------------------------- +# testing - MUST follow the generation of the build tree config file +if (BUILD_TESTING) + include (CTest) + add_subdirectory (test) +endif () + +# ---------------------------------------------------------------------------- +# packaging +if (BUILD_PACKAGING) + + if (NOT BUILD_SHARED_LIBS AND NOT INSTALL_HEADERS) + message (WARNING "Package will contain static libraries without headers!" + "\nRecommended options for generation of runtime package:" + "\n BUILD_SHARED_LIBS=ON" + "\n BUILD_STATIC_LIBS=OFF" + "\n INSTALL_HEADERS=OFF" + "\n INSTALL_SHARED_LIBS=ON" + "\nRecommended options for generation of development package:" + "\n BUILD_SHARED_LIBS=ON" + "\n BUILD_STATIC_LIBS=ON" + "\n INSTALL_HEADERS=ON" + "\n INSTALL_SHARED_LIBS=ON" + "\n INSTALL_STATIC_LIBS=ON" + ) + endif () + + # default package generators + if (APPLE) + set (PACKAGE_GENERATOR "PackageMaker") + set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP") + elseif (UNIX) + set (PACKAGE_GENERATOR "DEB;RPM") + set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP") + else () + set (PACKAGE_GENERATOR "ZIP") + set (PACKAGE_SOURCE_GENERATOR "ZIP") + endif () + + # used package generators + set (CPACK_GENERATOR "${PACKAGE_GENERATOR}" CACHE STRING "List of binary package generators (CPack).") + set (CPACK_SOURCE_GENERATOR "${PACKAGE_SOURCE_GENERATOR}" CACHE STRING "List of source package generators (CPack).") + mark_as_advanced (CPACK_GENERATOR CPACK_SOURCE_GENERATOR) + + # some package generators (e.g., PackageMaker) do not allow .md extension + configure_file ("${CMAKE_CURRENT_LIST_DIR}/README.md" "${CMAKE_CURRENT_BINARY_DIR}/README.txt" COPYONLY) + + # common package information + set (CPACK_PACKAGE_VENDOR "Andreas Schuh") + set (CPACK_PACKAGE_CONTACT "google-gflags@googlegroups.com") + set (CPACK_PACKAGE_NAME "${PACKAGE_NAME}") + set (CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}") + set (CPACK_PACKAGE_VERSION_MAJOR "${PACKAGE_VERSION_MAJOR}") + set (CPACK_PACKAGE_VERSION_MINOR "${PACKAGE_VERSION_MINOR}") + set (CPACK_PACKAGE_VERSION_PATCH "${PACKAGE_VERSION_PATCH}") + set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_DESCRIPTION}") + set (CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}/README.txt") + set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/COPYING.txt") + set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/README.txt") + set (CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + set (CPACK_OUTPUT_FILE_PREFIX packages) + set (CPACK_PACKAGE_RELOCATABLE TRUE) + set (CPACK_MONOLITHIC_INSTALL TRUE) + + # RPM package information -- used in cmake/package.cmake.in also for DEB + set (CPACK_RPM_PACKAGE_GROUP "Development/Libraries") + set (CPACK_RPM_PACKAGE_LICENSE "BSD") + set (CPACK_RPM_PACKAGE_URL "${PACKAGE_URL}") + set (CPACK_RPM_CHANGELOG_FILE "${CMAKE_CURRENT_LIST_DIR}/ChangeLog.txt") + + if (INSTALL_HEADERS) + set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/doc/index.html") + else () + set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/cmake/README_runtime.txt") + endif () + + # system/architecture + if (WINDOWS) + if (CMAKE_CL_64) + set (CPACK_SYSTEM_NAME "win64") + else () + set (CPACK_SYSTEM_NAME "win32") + endif () + set (CPACK_PACKAGE_ARCHITECTURE) + elseif (APPLE) + set (CPACK_PACKAGE_ARCHITECTURE darwin) + else () + string (TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME) + if (CMAKE_CXX_FLAGS MATCHES "-m32") + set (CPACK_PACKAGE_ARCHITECTURE i386) + else () + execute_process ( + COMMAND dpkg --print-architecture + RESULT_VARIABLE RV + OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE + ) + if (RV EQUAL 0) + string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE) + else () + execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE) + if (CPACK_PACKAGE_ARCHITECTURE MATCHES "x86_64") + set (CPACK_PACKAGE_ARCHITECTURE amd64) + else () + set (CPACK_PACKAGE_ARCHITECTURE i386) + endif () + endif () + endif () + endif () + + # source package settings + set (CPACK_SOURCE_TOPLEVEL_TAG "source") + set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;\\\\.swp$;\\\\.#;/#;\\\\.*~;cscope\\\\.*;/[Bb]uild[.+-_a-zA-Z0-9]*/") + + # default binary package settings + set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY TRUE) + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") + if (CPACK_PACKAGE_ARCHITECTURE) + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_ARCHITECTURE}") + endif () + + # generator specific configuration file + # + # allow package maintainers to use their own configuration file + # $ cmake -DCPACK_PROJECT_CONFIG_FILE:FILE=/path/to/package/config + if (NOT CPACK_PROJECT_CONFIG_FILE) + configure_file ( + "${CMAKE_CURRENT_LIST_DIR}/cmake/package.cmake.in" + "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake" @ONLY + ) + set (CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake") + endif () + + include (CPack) + +endif () # BUILD_PACKAGING + +if (NOT GFLAGS_IS_SUBPROJECT AND NOT TARGET uninstall) + configure_file ( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" @ONLY + ) + add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +endif () diff --git a/runtime/onnxruntime/third_party/gflags/COPYING.txt b/runtime/onnxruntime/third_party/gflags/COPYING.txt new file mode 100644 index 0000000..d15b0c2 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/COPYING.txt @@ -0,0 +1,28 @@ +Copyright (c) 2006, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/runtime/onnxruntime/third_party/gflags/ChangeLog.txt b/runtime/onnxruntime/third_party/gflags/ChangeLog.txt new file mode 100644 index 0000000..ecdd465 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/ChangeLog.txt @@ -0,0 +1,276 @@ +* Sun Nov 11 2018 - Andreas Schuh + +- gflags: version 2.2.2 +Fixed 267: Support build with GCC option "-fvisibility=hidden". +Fixed 262: Declare FALGS_no##name variables as static to avoid "previous extern" warning. +Fixed 261: Declare FlagRegisterer c’tor explicit template instanations as extern in header +Fixed 257: Build with _UNICODE support on Windows. +Fixed 233/234/235: Move CMake defines that are unused by Bazel to separate header; makes config.h private again +Fixed 228: Build with recent MinGW versions that define setenv. +Fixed 226: Remove obsolete and unused CleanFileName code +Merged 266: Various PVS Studio and GCC warnings. +Merged 258: Fix build with some Clang variants that define "restrict" macro. +Merged 252: Update documentation on how to use Bazel. +Merged 249: Use "_debug" postfix for debug libraries. +Merged 247: CMake "project" VERSION; no enable_testing(); "gflags::" import target prefix. +Merged 246: Add Bazel-on-Windows support. +Merged 239: Use GFLAGS_NAMESPACE instead of "gflags" in test executable. +Merged 237: Removed unused functions; fixes compilation with -Werror compiler option. +Merged 232: Fix typo in Bazel's BUILD definition +Merged 230: Remove using ::fLS::clstring. +Merged 221: Add convenience 'uninstall' target + +* Tue Jul 11 2017 - Andreas Schuh + +- gflags: version 2.2.1 +- Link to online documentation in README +- Merged 194: Include utils by file instead of CMAKE_MODULE_PATH search +- Merged 195: Remove unused program_name variable +- Merged 196: Enable language C for older CMake versions when needed +- Merged 202: Changed include directory in bazel build +- Merged 207: Mark single argument constructors in mutex.h as explicit +- Merged 209: Use inttypes.h on VC++ 2013 and later +- Merged 212: Fix statically linked gflags library with MSVC +- Meregd 213: Modify installation paths on Windows for vcpkg +- Merged 215: Fix static initialization order fiasco caused by global registry lock +- Merged 216: Fix use of ARGC in CMake macros +- Merged 222: Static code analyzer error regarding strncmp with empty kRootDir +- Merged 224: Check HAVE_STDINT_H or HAVE_INTTYPES_H for older MSVC versions + +* Fri Nov 25 2016 - Andreas Schuh + +- gflags: version 2.2.0 +- Merged 178: Implicitly convert dashes in option names to underscores +- Merged 159: CI builds and automatic tests with Travis CI and AppVeyor +- Merged 158: Use enum for flag value types +- Merged 126: File name postfix for static libraries on Windows +- Closed issue 120: Configure and install gflags.pc file for pkg-config users +- Fixed issue 127: snprintf already defined when building with MSVC 2015 +- Fixed issue 51/138: Memory leaks reported by valgrind +- Fixed issue 173: Validate flags only once +- Fixed issue 168: Unsigned and signed comparison in gflags_reporting.cc +- Fixed issues 176/153: Add -lpthread link argument to Bazel build, refactor BUILD rules +- Fixed issue 89: Add GFLAGS_IS_A_DLL to imported CMake target INTERFACE_COMPILE_DEFINITIONS +- Fixed issue 104: Set INTERFACE_INCLUDE_DIRECTORIES of exported CMake targets +- Fixed issue 174: Missing gflags-targets.cmake file after installation +- Fixed issue 186: Error linking to gflags IMPLIB with MSVC using CMake +- Closed issue 106: Add example project to test use of gflags library + +* Tue Mar 24 2014 - Andreas Schuh + +- gflags: version 2.1.2 +- Moved project to GitHub +- Added GFLAGS_NAMESPACE definition to gflags_declare.h +- Fixed issue 94: Keep "google" as primary namespace and import symbols into "gflags" namespace +- Fixed issue 96: Fix binary ABI compatibility with gflags 2.0 using "google" as primary namespace +- Fixed issue 97/101: Removed (patched) CMake modules and enabled C language instead +- Fixed issue 103: Set CMake policy CMP0042 to silence warning regarding MACOS_RPATH setting + +* Sun Mar 20 2014 - Andreas Schuh + +- gflags: version 2.1.1 +- Fixed issue 77: GFLAGS_IS_A_DLL expands to empty string in gflags_declare.h +- Fixed issue 79: GFLAGS_NAMESPACE not expanded to actual namespace in gflags_declare.h +- Fixed issue 80: Allow include path to differ from GFLAGS_NAMESPACE + +* Thu Mar 20 2014 - Andreas Schuh + +- gflags: version 2.1.0 +- Build system configuration using CMake instead of autotools +- CPack packaging support for Debian/Ubuntu, Red Hat, and Mac OS X +- Fixed issue 54: Fix "invalid suffix on literal" (C++11) +- Fixed issue 57: Use _strdup instead of strdup on Windows +- Fixed issue 62: Change all preprocessor include guards to start with GFLAGS_ +- Fixed issue 64: Add DEFINE_validator macro +- Fixed issue 73: Warnings in Visual Studio 2010 and unable to compile unit test + +* Wed Jan 25 2012 - Google Inc. + +- gflags: version 2.0 +- Changed the 'official' gflags email in setup.py/etc +- Renamed google-gflags.sln to gflags.sln +- Changed copyright text to reflect Google's relinquished ownership + +* Tue Dec 20 2011 - Google Inc. + +- google-gflags: version 1.7 +- Add CommandLineFlagInfo::flag_ptr pointing to current storage (musji) +- PORTING: flush after writing to stderr, needed on cygwin +- PORTING: Clean up the GFLAGS_DLL_DECL stuff better +- Fix a bug in StringPrintf() that affected large strings (csilvers) +- Die at configure-time when g++ isn't installed + +* Fri Jul 29 2011 - Google Inc. + +- google-gflags: version 1.6 +- BUGFIX: Fix a bug where we were leaving out a required $(top_srcdir) +- Fix definition of clstring (jyrki) +- Split up flag declares into its own file (jyrki) +- Add --version support (csilvers) +- Update the README for gflags with static libs +- Update acx_pthread.m4 for nostdlib +- Change ReparseCommandLineFlags to return void (csilvers) +- Some doc typofixes and example augmentation (various) + +* Mon Jan 24 2011 - Google Inc. + +- google-gflags: version 1.5 +- Better reporting of current vs default value (handler) +- Add API for cleaning up of memory at program-exit (jmarantz) +- Fix macros to work inside namespaces (csilvers) +- Use our own string typedef in case string is redefined (csilvers) +- Updated to autoconf 2.65 + +* Wed Oct 13 2010 - Google Inc. + +- google-gflags: version 1.4 +- Add a check to prevent passing 0 to DEFINE_string (jorg) +- Reduce compile (.o) size (jyrki) +- Some small changes to quiet debug compiles (alexk) +- PORTING: better support static linking on windows (csilvers) +- DOCUMENTATION: change default values, use validators, etc. +- Update the NEWS file to be non-empty +- Add pkg-config (.pc) files for libgflags and libgflags_nothreads + +* Mon Jan 4 2010 - Google Inc. + +- google-gflags: version 1.3 +- PORTABILITY: can now build and run tests under MSVC (csilvers) +- Remove the python gflags code, which is now its own package (tansell) +- Clarify that "last flag wins" in the docs (csilvers) +- Comment danger of using GetAllFlags in validators (wojtekm) +- PORTABILITY: Some fixes necessary for c++0x (mboerger) +- Makefile fix: $(srcdir) -> $(top_srcdir) in one place (csilvres) +- INSTALL: autotools to autoconf v2.64 + automake v1.11 (csilvers) + +* Thu Sep 10 2009 - Google Inc. + +- google-gflags: version 1.2 +- PORTABILITY: can now build and run tests under mingw (csilvers) +- Using a string arg for a bool flag is a compile-time error (rbayardo) +- Add --helpxml to gflags.py (salcianu) +- Protect against a hypothetical global d'tor mutex problem (csilvers) +- BUGFIX: can now define a flag after 'using namespace google' (hamaji) + +* Tue Apr 14 2009 - Google Inc. + +- google-gflags: version 1.1 +- Add both foo and nofoo for boolean flags, with --undefok (andychu) +- Better document how validators work (wojtekm) +- Improve binary-detection for bash-completion (mtamsky) +- Python: Add a concept of "key flags", used with --help (salcianu) +- Python: Robustify flag_values (salcianu) +- Python: Add a new DEFINE_bool alias (keir, andrewliu) +- Python: Do module introspection based on module name (dsturtevant) +- Fix autoconf a bit better, especially on windows and solaris (ajenjo) +- BUG FIX: gflags_nothreads was linking against the wrong lib (ajenjo) +- BUG FIX: threads-detection failed on FreeBSD; replace it (ajenjo) +- PORTABILITY: Quiet an internal compiler error with SUSE 10 (csilvers) +- PORTABILITY: Update deb.sh for more recenty debuilds (csilvers) +- PORTABILITY: #include more headers to satify new gcc's (csilvers) +- INSTALL: Updated to autoconf 2.61 and libtool 1.5.26 (csilvers) + +* Fri Oct 3 2008 - Google Inc. + +- google-gflags: version 1.0 +- Add a missing newline to an error string (bcmills) +- (otherwise exactly the same as gflags 1.0rc2) + +* Thu Sep 18 2008 - Google Inc. + +- google-gflags: version 1.0rc2 +- Report current flag values in --helpxml (hdn) +- Fix compilation troubles with gcc 4.3.3 (simonb) +- BUG FIX: I was missing a std:: in DECLARE_string (csilvers) +- BUG FIX: Clarify in docs how to specify --bool flags (csilvers) +- BUG FIX: Fix --helpshort for source files not in a subdir (csilvers) +- BUG FIX: Fix python unittest for 64-bit builds (bcmills) + +* Tue Aug 19 2008 - Google Inc. + +- google-gflags: version 1.0rc1 +- Move #include files from google/ to gflags/ (csilvers) +- Small optimizations to reduce binary (library) size (jyrki) +- BUGFIX: forgot a std:: in one of the .h files (csilvers) +- Speed up locking by making sure calls are inlined (ajenjo) +- 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers) +- PORTABILITY: fix Makefile to work with Cygwin (ajenjo) +- PORTABILITY: fix code to compile under Visual Studio (ajenjo) +- PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers) + +* Mon Jul 21 2008 - Google Inc. + +- google-gflags: version 0.9 +- Add the ability to validate a command-line flag (csilvers) +- Add completion support for commandline flags in bash (daven) +- Add -W compile flags to Makefile, when using gcc (csilvers) +- Allow helpstring to be NULL (cristianoc) +- Improved documentation of classes in the .cc file (csilvers) +- Fix python bug with AppendFlagValues + shortnames (jjtswan) +- Use bool instead of int for boolean flags in gflags.py (bcmills) +- Simplify the way we declare flags, now more foolproof (csilvers) +- Better error messages when bool flags collide (colohan) +- Only evaluate DEFINE_foo macro args once (csilvers) + +* Wed Mar 26 2008 - Google Inc. + +- google-gflags: version 0.8 +- Export DescribeOneFlag() in the API +- Add support for automatic line wrapping at 80 cols for gflags.py +- Bugfix: do not treat an isolated "-" the same as an isolated "--" +- Update rpm spec to point to Google Code rather than sourceforge (!) +- Improve documentation (including documenting thread-safety) +- Improve #include hygiene +- Improve testing + +* Thu Oct 18 2007 - Google Inc. + +- google-gflags: version 0.7 +- Deal even more correctly with libpthread not linked in (csilvers) +- Add STRIP_LOG, an improved DO_NOT_SHOW_COMMANDLINE_HELP (sioffe) +- Be more accurate printing default flag values in --help (dsturtevant) +- Reduce .o file size a bit by using shorter namespace names (jeff) +- Use relative install path, so 'setup.py --home' works (csilvers) +- Notice when a boolean flag has a non-boolean default (bnmouli) +- Broaden --helpshort to match foo-main.cc and foo_main.cc (hendrie) +- Fix "no modules match" message for --helpshort, etc (hendrie) + +* Wed Aug 15 2007 - Google Inc. + +- google-gflags: version 0.6 +- Deal correctly with case that libpthread is not linked in (csilvers) +- Update Makefile/tests so we pass "make distcheck" (csilvers) +- Document and test that last assignment to a flag wins (wan) + +* Tue Jun 12 2007 - Google Inc. + +- google-gflags: version 0.5 +- Include all m4 macros in the distribution (csilvers) +- Python: Fix broken data_files field in setup.py (sidlon) +- Python: better string serliaizing and unparsing (abo, csimmons) +- Fix checks for NaN and inf to work with Mac OS X (csilvers) + +* Thu Apr 19 2007 - Google Inc. + +- google-gflags: version 0.4 +- Remove is_default from GetCommandLineFlagInfo (csilvers) +- Portability fixes: includes, strtoll, gcc4.3 errors (csilvers) +- A few doc typo cleanups (csilvers) + +* Wed Mar 28 2007 - Google Inc. + +- google-gflags: version 0.3 +- python portability fix: use popen instead of subprocess (csilvers) +- Add is_default to CommandLineFlagInfo (pchien) +- Make docs a bit prettier (csilvers) +- Actually include the python files in the distribution! :-/ (csilvers) + +* Mon Jan 22 2007 - Google Inc. + +- google-gflags: version 0.2 +- added support for python commandlineflags, as well as c++ +- gflags2man, a script to turn flags into a man page (dchristian) + +* Wed Dec 13 2006 - Google Inc. + +- google-gflags: version 0.1 diff --git a/runtime/onnxruntime/third_party/gflags/INSTALL.md b/runtime/onnxruntime/third_party/gflags/INSTALL.md new file mode 100644 index 0000000..76d7edd --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/INSTALL.md @@ -0,0 +1,83 @@ +Installing a binary distribution package +======================================== + +No official binary distribution packages are provided by the gflags developers. +There may, however, be binary packages available for your OS. Please consult +also the package repositories of your Linux distribution. + +For example on Debian/Ubuntu Linux, gflags can be installed using the +following command: + + sudo apt-get install libgflags-dev + + +Compiling the source code with CMake +========================= + +The build system of gflags is since version 2.1 based on [CMake](http://cmake.org). +The common steps to build, test, and install software are therefore: + +1. Extract source files. +2. Create build directory and change to it. +3. Run CMake to configure the build tree. +4. Build the software using selected build tool. +5. Test the built software. +6. Install the built files. + +On Unix-like systems with GNU Make as build tool, these build steps can be +summarized by the following sequence of commands executed in a shell, +where ```$package``` and ```$version``` are shell variables which represent +the name of this package and the obtained version of the software. + + $ tar xzf gflags-$version-source.tar.gz + $ cd gflags-$version + $ mkdir build && cd build + $ ccmake .. + + - Press 'c' to configure the build system and 'e' to ignore warnings. + - Set CMAKE_INSTALL_PREFIX and other CMake variables and options. + - Continue pressing 'c' until the option 'g' is available. + - Then press 'g' to generate the configuration files for GNU Make. + + $ make + $ make test (optional) + $ make install (optional) + +In the following, only gflags-specific CMake settings available to +configure the build and installation are documented. Note that most of these +variables are for advanced users and binary package maintainers only. +They usually do not have to be modified. + + +CMake Option | Description +--------------------------- | ------------------------------------------------------- +CMAKE_INSTALL_PREFIX | Installation directory, e.g., "/usr/local" on Unix and "C:\Program Files\gflags" on Windows. +BUILD_SHARED_LIBS | Request build of dynamic link libraries. +BUILD_STATIC_LIBS | Request build of static link libraries. Implied if BUILD_SHARED_LIBS is OFF. +BUILD_PACKAGING | Enable binary package generation using CPack. +BUILD_TESTING | Build tests for execution by CTest. +BUILD_NC_TESTS | Request inclusion of negative compilation tests (requires Python). +BUILD_CONFIG_TESTS | Request inclusion of package configuration tests (requires Python). +BUILD_gflags_LIBS | Request build of multi-threaded gflags libraries (if threading library found). +BUILD_gflags_nothreads_LIBS | Request build of single-threaded gflags libraries. +GFLAGS_NAMESPACE | Name of the C++ namespace to be used by the gflags library. Note that the public source header files are installed in a subdirectory named after this namespace. To maintain backwards compatibility with the Google Commandline Flags, set this variable to "google". The default is "gflags". +GFLAGS_INTTYPES_FORMAT | String identifying format of built-in integer types. +GFLAGS_INCLUDE_DIR | Name of headers installation directory relative to CMAKE_INSTALL_PREFIX. +LIBRARY_INSTALL_DIR | Name of library installation directory relative to CMAKE_INSTALL_PREFIX. +INSTALL_HEADERS | Request installation of public header files. + +Using gflags with [Bazel](http://bazel.io) +========================= + +To use gflags in a Bazel project, map it in as an external dependency by editing +your WORKSPACE file: + + git_repository( + name = "com_github_gflags_gflags", + commit = "", + remote = "https://github.com/gflags/gflags.git", + ) + +You can then add `@com_github_gflags_gflags//:gflags` to the `deps` section of a +`cc_binary` or `cc_library` rule, and `#include ` to include it +in your source code. diff --git a/runtime/onnxruntime/third_party/gflags/README.md b/runtime/onnxruntime/third_party/gflags/README.md new file mode 100644 index 0000000..6e5267c --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/README.md @@ -0,0 +1,320 @@ +[![Build Status](https://travis-ci.org/gflags/gflags.svg?branch=master)](https://travis-ci.org/gflags/gflags) +[![Build status](https://ci.appveyor.com/api/projects/status/4ctod566ysraus74/branch/master?svg=true)](https://ci.appveyor.com/project/schuhschuh/gflags/branch/master) + +The documentation of the gflags library is available online at https://gflags.github.io/gflags/. + + +11 November 2018 +---------------- + +I've just released gflags 2.2.2. + +This maintenance release improves lives of Bazel users (no more "config.h" leaking into global include paths), +fixes build with recent MinGW versions, and silences a number of static code analyzer and compiler warnings. +The build targets exported by the CMake configuration of this library are now also prefixed by the package +name "gflags::" following a more recent (unwritten) CMake convention. The unprefixed target names are still +supported to avoid that dependent projects have to be modified due to this change in imported target names. + +Please report any further issues with this release using the GitHub issue tracker. + + +11 July 2017 +------------ + +I've just released gflags 2.2.1. + +This maintenance release primarily fixes build issues on Windows and +false alarms reported by static code analyzers. + +Please report any further issues with this release using the GitHub issue tracker. + + +25 November 2016 +---------------- + +I've finally released gflags 2.2.0. + +This release adds support for use of the gflags library as external dependency +not only in projects using CMake, but also [Bazel](https://bazel.build/), +or [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). +One new minor feature is added in this release: when a command flag argument +contains dashes, these are implicitly converted to underscores. +This is to allow those used to separate words of the flag name by dashes +to do so, while the flag variable names are required to use underscores. + +Memory leaks reported by valgrind should be resolved by this release. +This release fixes build errors with MS Visual Studio 2015. + +Please report any further issues with this release using the GitHub issue tracker. + + +24 March 2015 +------------- + +I've just released gflags 2.1.2. + +This release completes the namespace change fixes. In particular, +it restores binary ABI compatibility with release version 2.0. +The deprecated "google" namespace is by default still kept as +primary namespace while symbols are imported into the new "gflags" namespace. +This can be overridden using the CMake variable GFLAGS_NAMESPACE. + +Other fixes of the build configuration are related to the (patched) +CMake modules FindThreads.cmake and CheckTypeSize.cmake. These have +been removed and instead the C language is enabled again even though +gflags is written in C++ only. + +This release also marks the complete move of the gflags project +from Google Code to GitHub. Email addresses of original issue +reporters got lost in the process. Given the age of most issue reports, +this should be negligable. + +Please report any further issues using the GitHub issue tracker. + + +30 March 2014 +------------- + +I've just released gflags 2.1.1. + +This release fixes a few bugs in the configuration of gflags\_declare.h +and adds a separate GFLAGS\_INCLUDE\_DIR CMake variable to the build configuration. +Setting GFLAGS\_NAMESPACE to "google" no longer changes also the include +path of the public header files. This allows the use of the library with +other Google projects such as glog which still use the deprecated "google" +namespace for the gflags library, but include it as "gflags/gflags.h". + +20 March 2014 +------------- + +I've just released gflags 2.1. + +The major changes are the use of CMake for the build configuration instead +of the autotools and packaging support through CPack. The default namespace +of all C++ symbols is now "gflags" instead of "google". This can be +configured via the GFLAGS\_NAMESPACE variable. + +This release compiles with all major compilers without warnings and passed +the unit tests on Ubuntu 12.04, Windows 7 (Visual Studio 2008 and 2010, +Cygwin, MinGW), and Mac OS X (Xcode 5.1). + +The SVN repository on Google Code is now frozen and replaced by a Git +repository such that it can be used as Git submodule by projects. The main +hosting of this project remains at Google Code. Thanks to the distributed +character of Git, I can push (and pull) changes from both GitHub and Google Code +in order to keep the two public repositories in sync. +When fixing an issue for a pull request through either of these hosting +platforms, please reference the issue number as +[described here](https://code.google.com/p/support/wiki/IssueTracker#Integration_with_version_control). +For the further development, I am following the +[Git branching model](http://nvie.com/posts/a-successful-git-branching-model/) +with feature branch names prefixed by "feature/" and bugfix branch names +prefixed by "bugfix/", respectively. + +Binary and source [packages](https://github.com/schuhschuh/gflags/releases) are available on GitHub. + + +14 January 2014 +--------------- + +The migration of the build system to CMake is almost complete. +What remains to be done is rewriting the tests in Python such they can be +executed on non-Unix platforms and splitting them up into separate CTest tests. +Though merging these changes into the master branch yet remains to be done, +it is recommended to already start using the +[cmake-migration](https://github.com/schuhschuh/gflags/tree/cmake-migration) branch. + + +20 April 2013 +------------- + +More than a year has past since I (Andreas) took over the maintenance for +`gflags`. Only few minor changes have been made since then, much to my regret. +To get more involved and stimulate participation in the further +development of the library, I moved the project source code today to +[GitHub](https://github.com/schuhschuh/gflags). +I believe that the strengths of [Git](http://git-scm.com/) will allow for better community collaboration +as well as ease the integration of changes made by others. I encourage everyone +who would like to contribute to send me pull requests. +Git's lightweight feature branches will also provide the right tool for more +radical changes which should only be merged back into the master branch +after these are complete and implement the desired behavior. + +The SVN repository remains accessible at Google Code and I will keep the +master branch of the Git repository hosted at GitHub and the trunk of the +Subversion repository synchronized. Initially, I was going to simply switch the +Google Code project to Git, but in this case the SVN repository would be +frozen and force everyone who would like the latest development changes to +use Git as well. Therefore I decided to host the public Git repository at GitHub +instead. + +Please continue to report any issues with gflags on Google Code. The GitHub project will +only be used to host the Git repository. + +One major change of the project structure I have in mind for the next weeks +is the migration from autotools to [CMake](http://www.cmake.org/). +Check out the (unstable!) +[cmake-migration](https://github.com/schuhschuh/gflags/tree/cmake-migration) +branch on GitHub for details. + + +25 January 2012 +--------------- + +I've just released gflags 2.0. + +The `google-gflags` project has been renamed to `gflags`. I +(csilvers) am stepping down as maintainer, to be replaced by Andreas +Schuh. Welcome to the team, Andreas! I've seen the energy you have +around gflags and the ideas you have for the project going forward, +and look forward to having you on the team. + +I bumped the major version number up to 2 to reflect the new community +ownership of the project. All the [changes](ChangeLog.txt) +are related to the renaming. There are no functional changes from +gflags 1.7. In particular, I've kept the code in the namespace +`google`, though in a future version it should be renamed to `gflags`. +I've also kept the `/usr/local/include/google/` subdirectory as +synonym of `/usr/local/include/gflags/`, though the former name has +been obsolete for some time now. + + +18 January 2011 +--------------- + +The `google-gflags` Google Code page has been renamed to +`gflags`, in preparation for the project being renamed to +`gflags`. In the coming weeks, I'll be stepping down as +maintainer for the gflags project, and as part of that Google is +relinquishing ownership of the project; it will now be entirely +community run. The name change reflects that shift. + + +20 December 2011 +---------------- + +I've just released gflags 1.7. This is a minor release; the major +change is that `CommandLineFlagInfo` now exports the address in memory +where the flag is located. There has also been a bugfix involving +very long --help strings, and some other minor [changes](ChangeLog.txt). + +29 July 2011 +------------ + +I've just released gflags 1.6. The major new feature in this release +is support for setting version info, so that --version does something +useful. + +One minor change has required bumping the library number: +`ReparseCommandlineFlags` now returns `void` instead of `int` (the int +return value was always meaningless). Though I doubt anyone ever used +this (meaningless) return value, technically it's a change to the ABI +that requires a version bump. A bit sad. + +There's also a procedural change with this release: I've changed the +internal tools used to integrate Google-supplied patches for gflags +into the opensource release. These new tools should result in more +frequent updates with better change descriptions. They will also +result in future `ChangeLog` entries being much more verbose (for better +or for worse). + +See the [ChangeLog](ChangeLog.txt) for a full list of changes for this release. + +24 January 2011 +--------------- + +I've just released gflags 1.5. This release has only minor changes +from 1.4, including some slightly better reporting in --help, and +an new memory-cleanup function that can help when running gflags-using +libraries under valgrind. The major change is to fix up the macros +(`DEFINE_bool` and the like) to work more reliably inside namespaces. + +If you have not had a problem with these macros, and don't need any of +the other changes described, there is no need to upgrade. See the +[ChangeLog](ChangeLog.txt) for a full list of changes for this release. + +11 October 2010 +--------------- + +I've just released gflags 1.4. This release has only minor changes +from 1.3, including some documentation tweaks and some work to make +the library smaller. If 1.3 is working well for you, there's no +particular reason to upgrade. + +4 January 2010 +-------------- + +I've just released gflags 1.3. gflags now compiles under MSVC, and +all tests pass. I **really** never thought non-unix-y Windows folks +would want gflags, but at least some of them do. + +The major news, though, is that I've separated out the python package +into its own library, [python-gflags](http://code.google.com/p/python-gflags). +If you're interested in the Python version of gflags, that's the place to +get it now. + +10 September 2009 +----------------- + +I've just released gflags 1.2. The major change from gflags 1.1 is it +now compiles under MinGW (as well as cygwin), and all tests pass. I +never thought Windows folks would want unix-style command-line flags, +since they're so different from the Windows style, but I guess I was +wrong! + +The other changes are minor, such as support for --htmlxml in the +python version of gflags. + +15 April 2009 +------------- + +I've just released gflags 1.1. It has only minor changes fdrom gflags +1.0 (see the [ChangeLog](ChangeLog.txt) for details). +The major change is that I moved to a new system for creating .deb and .rpm files. +This allows me to create x86\_64 deb and rpm files. + +In the process of moving to this new system, I noticed an +inconsistency: the tar.gz and .rpm files created libraries named +libgflags.so, but the deb file created libgoogle-gflags.so. I have +fixed the deb file to create libraries like the others. I'm no expert +in debian packaging, but I believe this has caused the package name to +change as well. Please let me know (at +[[mailto:google-gflags@googlegroups.com](mailto:google-gflags@googlegroups.com) +google-gflags@googlegroups.com]) if this causes problems for you -- +especially if you know of a fix! I would be happy to change the deb +packages to add symlinks from the old library name to the new +(libgoogle-gflags.so -> libgflags.so), but that is beyond my knowledge +of how to make .debs. + +If you've tried to install a .rpm or .deb and it doesn't work for you, +let me know. I'm excited to finally have 64-bit package files, but +there may still be some wrinkles in the new system to iron out. + +1 October 2008 +-------------- + +gflags 1.0rc2 was out for a few weeks without any issues, so gflags +1.0 is now released. This is much like gflags 0.9. The major change +is that the .h files have been moved from `/usr/include/google` to +`/usr/include/gflags`. While I have backwards-compatibility +forwarding headeds in place, please rewrite existing code to say +``` + #include +``` +instead of +``` + #include +``` + +I've kept the default namespace to google. You can still change with +with the appropriate flag to the configure script (`./configure +--help` to see the flags). If you have feedback as to whether the +default namespace should change to gflags, which would be a +non-backwards-compatible change, send mail to +`google-gflags@googlegroups.com`! + +Version 1.0 also has some neat new features, like support for bash +commandline-completion of help flags. See the [ChangeLog](ChangeLog.txt) +for more details. + +If I don't hear any bad news for a few weeks, I'll release 1.0-final. diff --git a/runtime/onnxruntime/third_party/gflags/WORKSPACE b/runtime/onnxruntime/third_party/gflags/WORKSPACE new file mode 100644 index 0000000..f3707e9 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/WORKSPACE @@ -0,0 +1,6 @@ +# Copyright 2006 Google Inc. All Rights Reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the COPYING.txt file. + +# Bazel (http://bazel.io/) WORKSPACE file for gflags. +workspace(name="com_github_gflags_gflags") diff --git a/runtime/onnxruntime/third_party/gflags/appveyor.yml b/runtime/onnxruntime/third_party/gflags/appveyor.yml new file mode 100644 index 0000000..a5110e5 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/appveyor.yml @@ -0,0 +1,68 @@ +# Configuration for continuous integration service at appveyor.com + +version: '{build}' + +os: Visual Studio 2015 + +environment: + matrix: + - Toolset: v140 + - Toolset: v120 + - Toolset: v110 + - Toolset: v100 + - Toolset: v90 + +platform: + - Win32 + - x64 + +configuration: + - Release + +matrix: + exclude: + - Toolset: v90 + platform: x64 + - Toolset: v100 + platform: x64 + +build: + verbosity: minimal + +before_build: +- ps: | + Write-Output "Configuration: $env:CONFIGURATION" + Write-Output "Platform: $env:PLATFORM" + $generator = switch ($env:TOOLSET) + { + "v140" {"Visual Studio 14 2015"} + "v120" {"Visual Studio 12 2013"} + "v110" {"Visual Studio 11 2012"} + "v100" {"Visual Studio 10 2010"} + "v90" {"Visual Studio 9 2008"} + } + if ($env:PLATFORM -eq "x64") + { + $generator = "$generator Win64" + } + +build_script: +- ps: | + md _build -Force | Out-Null + cd _build + + & cmake -G "$generator" -D CMAKE_CONFIGURATION_TYPES="Debug;Release" -D GFLAGS_BUILD_TESTING=ON -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON .. + if ($LastExitCode -ne 0) { + throw "Exec: $ErrorMessage" + } + & cmake --build . --config $env:CONFIGURATION + if ($LastExitCode -ne 0) { + throw "Exec: $ErrorMessage" + } + +test_script: +- ps: | + & ctest -C $env:CONFIGURATION --output-on-failure + if ($LastExitCode -ne 0) { + throw "Exec: $ErrorMessage" + } diff --git a/runtime/onnxruntime/third_party/gflags/bazel/gflags.bzl b/runtime/onnxruntime/third_party/gflags/bazel/gflags.bzl new file mode 100644 index 0000000..533fd61 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/bazel/gflags.bzl @@ -0,0 +1,103 @@ +# ------------------------------------------------------------------------------ +# Add native rules to configure source files +def gflags_sources(namespace=["google", "gflags"]): + native.genrule( + name = "gflags_declare_h", + srcs = ["src/gflags_declare.h.in"], + outs = ["gflags_declare.h"], + cmd = ("awk '{ " + + "gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); " + + "gsub(/@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@/, \"1\"); " + + "gsub(/@([A-Z0-9_]+)@/, \"0\"); " + + "print; }' $(<) > $(@)") + ) + gflags_ns_h_files = [] + for ns in namespace[1:]: + gflags_ns_h_file = "gflags_{}.h".format(ns) + native.genrule( + name = gflags_ns_h_file.replace('.', '_'), + srcs = ["src/gflags_ns.h.in"], + outs = [gflags_ns_h_file], + cmd = ("awk '{ " + + "gsub(/@ns@/, \"" + ns + "\"); " + + "gsub(/@NS@/, \"" + ns.upper() + "\"); " + + "print; }' $(<) > $(@)") + ) + gflags_ns_h_files.append(gflags_ns_h_file) + native.genrule( + name = "gflags_h", + srcs = ["src/gflags.h.in"], + outs = ["gflags.h"], + cmd = ("awk '{ " + + "gsub(/@GFLAGS_ATTRIBUTE_UNUSED@/, \"\"); " + + "gsub(/@INCLUDE_GFLAGS_NS_H@/, \"" + '\n'.join(["#include \\\"gflags/{}\\\"".format(hdr) for hdr in gflags_ns_h_files]) + "\"); " + + "print; }' $(<) > $(@)") + ) + native.genrule( + name = "gflags_completions_h", + srcs = ["src/gflags_completions.h.in"], + outs = ["gflags_completions.h"], + cmd = "awk '{ gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); print; }' $(<) > $(@)" + ) + hdrs = [":gflags_h", ":gflags_declare_h", ":gflags_completions_h"] + hdrs.extend([':' + hdr.replace('.', '_') for hdr in gflags_ns_h_files]) + srcs = [ + "src/config.h", + "src/gflags.cc", + "src/gflags_completions.cc", + "src/gflags_reporting.cc", + "src/mutex.h", + "src/util.h", + ] + select({ + "//:x64_windows": [ + "src/windows_port.cc", + "src/windows_port.h", + ], + "//conditions:default": [], + }) + return [hdrs, srcs] + +# ------------------------------------------------------------------------------ +# Add native rule to build gflags library +def gflags_library(hdrs=[], srcs=[], threads=1): + name = "gflags" + copts = [ + "-DGFLAGS_BAZEL_BUILD", + "-DGFLAGS_INTTYPES_FORMAT_C99", + "-DGFLAGS_IS_A_DLL=0", + # macros otherwise defined by CMake configured defines.h file + "-DHAVE_STDINT_H", + "-DHAVE_SYS_TYPES_H", + "-DHAVE_INTTYPES_H", + "-DHAVE_SYS_STAT_H", + "-DHAVE_STRTOLL", + "-DHAVE_STRTOQ", + "-DHAVE_RWLOCK", + ] + select({ + "//:x64_windows": [ + "-DOS_WINDOWS", + ], + "//conditions:default": [ + "-DHAVE_UNISTD_H", + "-DHAVE_FNMATCH_H", + "-DHAVE_PTHREAD", + ], + }) + linkopts = [] + if threads: + linkopts += select({ + "//:x64_windows": [], + "//conditions:default": ["-lpthread"], + }) + else: + name += "_nothreads" + copts += ["-DNO_THREADS"] + native.cc_library( + name = name, + hdrs = hdrs, + srcs = srcs, + copts = copts, + linkopts = linkopts, + visibility = ["//visibility:public"], + include_prefix = 'gflags' + ) diff --git a/runtime/onnxruntime/third_party/gflags/cmake/README_runtime.txt b/runtime/onnxruntime/third_party/gflags/cmake/README_runtime.txt new file mode 100644 index 0000000..d2556b2 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/README_runtime.txt @@ -0,0 +1,4 @@ +This package contains runtime libraries only which are required +by applications that use these libraries for the commandline flags +processing. If you want to develop such application, download +and install the development package instead. diff --git a/runtime/onnxruntime/third_party/gflags/cmake/cmake_uninstall.cmake.in b/runtime/onnxruntime/third_party/gflags/cmake/cmake_uninstall.cmake.in new file mode 100644 index 0000000..d00a516 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,26 @@ +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +if (NOT DEFINED CMAKE_INSTALL_PREFIX) + set (CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") +endif () + message(${CMAKE_INSTALL_PREFIX}) + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) diff --git a/runtime/onnxruntime/third_party/gflags/cmake/config.cmake.in b/runtime/onnxruntime/third_party/gflags/cmake/config.cmake.in new file mode 100644 index 0000000..a512c2a --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/config.cmake.in @@ -0,0 +1,183 @@ +## gflags CMake configuration file + +# library version information +set (@PACKAGE_PREFIX@_VERSION_STRING "@PACKAGE_VERSION@") +set (@PACKAGE_PREFIX@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@) +set (@PACKAGE_PREFIX@_VERSION_MINOR @PACKAGE_VERSION_MINOR@) +set (@PACKAGE_PREFIX@_VERSION_PATCH @PACKAGE_VERSION_PATCH@) + +# import targets +if (NOT DEFINED @PACKAGE_PREFIX@_USE_TARGET_NAMESPACE) + set (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE FALSE) +endif () +if (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE) + include ("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@.cmake") + set (@PACKAGE_PREFIX@_TARGET_NAMESPACE @PACKAGE_NAME@) +else () + include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-nonamespace-targets.cmake") + set (@PACKAGE_PREFIX@_TARGET_NAMESPACE) +endif () +if (@PACKAGE_PREFIX@_TARGET_NAMESPACE) + set (@PACKAGE_PREFIX@_TARGET_PREFIX ${@PACKAGE_PREFIX@_TARGET_NAMESPACE}::) +else () + set (@PACKAGE_PREFIX@_TARGET_PREFIX) +endif () + +# installation prefix +get_filename_component (CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component (_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PREFIX_REL2CONFIG_DIR@" ABSOLUTE) + +# include directory +# +# Newer versions of CMake set the INTERFACE_INCLUDE_DIRECTORIES property +# of the imported targets. It is hence not necessary to add this path +# manually to the include search path for targets which link to gflags. +set (@PACKAGE_PREFIX@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@") + +if (@PACKAGE_NAME@_FIND_COMPONENTS) + foreach (@PACKAGE_NAME@_FIND_COMPONENT IN LISTS @PACKAGE_NAME@_FIND_COMPONENTS) + if (@PACKAGE_NAME@_FIND_REQUIRED_${@PACKAGE_NAME@_FIND_COMPONENT} AND NOT TARGET @PACKAGE_NAME@_${@PACKAGE_NAME@_FIND_COMPONENT}) + message (FATAL_ERROR "Package @PACKAGE_NAME@ was installed without required component ${@PACKAGE_NAME@_FIND_COMPONENT}!") + endif () + endforeach () + list (GET @PACKAGE_NAME@_FIND_COMPONENTS 0 @PACKAGE_NAME@_FIND_COMPONENT) +else () + set (@PACKAGE_NAME@_FIND_COMPONENT) +endif () + +# default settings of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS +# +# It is recommended to use either one of the following find_package commands +# instead of setting the @PACKAGE_PREFIX@_(SHARED|NOTHREADS) variables: +# - find_package(@PACKAGE_NAME@ REQUIRED) +# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_static) +# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_shared) +# - find_package(@PACKAGE_NAME@ COMPONENTS static) +# - find_package(@PACKAGE_NAME@ COMPONENTS shared) +if (NOT DEFINED @PACKAGE_PREFIX@_SHARED) + if (DEFINED @PACKAGE_NAME@_SHARED) + set (@PACKAGE_PREFIX@_SHARED ${@PACKAGE_NAME@_SHARED}) + elseif (@PACKAGE_NAME@_FIND_COMPONENT) + if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "shared") + set (@PACKAGE_PREFIX@_SHARED TRUE) + else () + set (@PACKAGE_PREFIX@_SHARED FALSE) + endif () + elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared) + set (@PACKAGE_PREFIX@_SHARED TRUE) + else () + set (@PACKAGE_PREFIX@_SHARED FALSE) + endif () +endif () +if (NOT DEFINED @PACKAGE_PREFIX@_NOTHREADS) + if (DEFINED @PACKAGE_NAME@_NOTHREADS) + set (@PACKAGE_PREFIX@_NOTHREADS ${@PACKAGE_NAME@_NOTHREADS}) + elseif (@PACKAGE_NAME@_FIND_COMPONENT) + if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "nothreads") + set (@PACKAGE_PREFIX@_NOTHREADS TRUE) + else () + set (@PACKAGE_PREFIX@_NOTHREADS FALSE) + endif () + elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared) + set (@PACKAGE_PREFIX@_NOTHREADS FALSE) + else () + set (@PACKAGE_PREFIX@_NOTHREADS TRUE) + endif () +endif () + +# choose imported library target +if (NOT @PACKAGE_PREFIX@_TARGET) + if (@PACKAGE_NAME@_TARGET) + set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_NAME@_TARGET}) + elseif (@PACKAGE_PREFIX@_SHARED) + if (@PACKAGE_PREFIX@_NOTHREADS) + set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared) + else () + set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared) + endif () + else () + if (@PACKAGE_PREFIX@_NOTHREADS) + set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_static) + else () + set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_static) + endif () + endif () +endif () +if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET}) + message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_PREFIX@_TARGET} library target!" + " Try a different combination of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS.") +endif () + +# add more convenient "${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@" import target +if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@) + if (@PACKAGE_PREFIX@_SHARED) + add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ SHARED IMPORTED) + else () + add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ STATIC IMPORTED) + endif () + # copy INTERFACE_* properties + foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS + COMPILE_DEFINITIONS + COMPILE_FEATURES + COMPILE_OPTIONS + INCLUDE_DIRECTORIES + LINK_LIBRARIES + POSITION_INDEPENDENT_CODE + ) + get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME}) + if (_@PACKAGE_PREFIX@_PROPERTY_VALUE) + set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES + INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}" + ) + endif () + endforeach () + # copy IMPORTED_*_ properties + get_target_property (_@PACKAGE_PREFIX@_CONFIGURATIONS ${@PACKAGE_PREFIX@_TARGET} IMPORTED_CONFIGURATIONS) + set_target_properties (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_PREFIX@_CONFIGURATIONS}") + foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS + IMPLIB + LOCATION + LINK_DEPENDENT_LIBRARIES + LINK_INTERFACE_LIBRARIES + LINK_INTERFACE_LANGUAGES + LINK_INTERFACE_MULTIPLICITY + NO_SONAME + SONAME + ) + foreach (_@PACKAGE_PREFIX@_CONFIG IN LISTS _@PACKAGE_PREFIX@_CONFIGURATIONS) + get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG}) + if (_@PACKAGE_PREFIX@_PROPERTY_VALUE) + set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES + IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}" + ) + endif () + endforeach () + endforeach () + unset (_@PACKAGE_PREFIX@_CONFIGURATIONS) + unset (_@PACKAGE_PREFIX@_CONFIG) + unset (_@PACKAGE_PREFIX@_PROPERTY_NAME) + unset (_@PACKAGE_PREFIX@_PROPERTY_VALUE) +endif () + +# alias for default import target to be compatible with older CMake package configurations +set (@PACKAGE_PREFIX@_LIBRARIES "${@PACKAGE_PREFIX@_TARGET}") + +# set @PACKAGE_NAME@_* variables for backwards compatibility +if (NOT "^@PACKAGE_NAME@$" STREQUAL "^@PACKAGE_PREFIX@$") + foreach (_@PACKAGE_PREFIX@_VARIABLE IN ITEMS + VERSION_STRING + VERSION_MAJOR + VERSION_MINOR + VERSION_PATCH + INCLUDE_DIR + LIBRARIES + TARGET + ) + set (@PACKAGE_NAME@_${_@PACKAGE_PREFIX@_VARIABLE} "${@PACKAGE_PREFIX@_${_@PACKAGE_PREFIX@_VARIABLE}}") + endforeach () + unset (_@PACKAGE_PREFIX@_VARIABLE) +endif () + +# unset private variables +unset (@PACKAGE_NAME@_FIND_COMPONENT) +unset (_INSTALL_PREFIX) diff --git a/runtime/onnxruntime/third_party/gflags/cmake/execute_test.cmake b/runtime/onnxruntime/third_party/gflags/cmake/execute_test.cmake new file mode 100644 index 0000000..df008cf --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/execute_test.cmake @@ -0,0 +1,53 @@ +# ---------------------------------------------------------------------------- +# sanitize string stored in variable for use in regular expression. +macro (sanitize_for_regex STRVAR) + string (REGEX REPLACE "([.+*?^$()])" "\\\\\\1" ${STRVAR} "${${STRVAR}}") +endmacro () + +# ---------------------------------------------------------------------------- +# script arguments +if (NOT COMMAND) + message (FATAL_ERROR "Test command not specified!") +endif () +if (NOT DEFINED EXPECTED_RC) + set (EXPECTED_RC 0) +endif () +if (EXPECTED_OUTPUT) + sanitize_for_regex(EXPECTED_OUTPUT) +endif () +if (UNEXPECTED_OUTPUT) + sanitize_for_regex(UNEXPECTED_OUTPUT) +endif () + +# ---------------------------------------------------------------------------- +# set a few environment variables (useful for --tryfromenv) +set (ENV{FLAGS_undefok} "foo,bar") +set (ENV{FLAGS_weirdo} "") +set (ENV{FLAGS_version} "true") +set (ENV{FLAGS_help} "false") + +# ---------------------------------------------------------------------------- +# execute test command +execute_process( + COMMAND ${COMMAND} + RESULT_VARIABLE RC + OUTPUT_VARIABLE OUTPUT + ERROR_VARIABLE OUTPUT +) + +if (OUTPUT) + message ("${OUTPUT}") +endif () + +# ---------------------------------------------------------------------------- +# check test result +if (NOT RC EQUAL EXPECTED_RC) + string (REPLACE ";" " " COMMAND "${COMMAND}") + message (FATAL_ERROR "Command:\n\t${COMMAND}\nExit status is ${RC}, expected ${EXPECTED_RC}") +endif () +if (EXPECTED_OUTPUT AND NOT OUTPUT MATCHES "${EXPECTED_OUTPUT}") + message (FATAL_ERROR "Test output does not match expected output: ${EXPECTED_OUTPUT}") +endif () +if (UNEXPECTED_OUTPUT AND OUTPUT MATCHES "${UNEXPECTED_OUTPUT}") + message (FATAL_ERROR "Test output matches unexpected output: ${UNEXPECTED_OUTPUT}") +endif () \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/gflags/cmake/package.cmake.in b/runtime/onnxruntime/third_party/gflags/cmake/package.cmake.in new file mode 100644 index 0000000..aaec792 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/package.cmake.in @@ -0,0 +1,49 @@ +# Per-generator CPack configuration file. See CPACK_PROJECT_CONFIG_FILE documented at +# http://www.cmake.org/cmake/help/v2.8.12/cpack.html#variable:CPACK_PROJECT_CONFIG_FILE +# +# All common CPACK_* variables are set in CMakeLists.txt already. This file only +# overrides some of these to provide package generator specific settings. + +# whether package contains all development files or only runtime files +set (DEVEL @INSTALL_HEADERS@) + +# ------------------------------------------------------------------------------ +# Mac OS X package +if (CPACK_GENERATOR MATCHES "PackageMaker|DragNDrop") + + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") + if (DEVEL) + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel") + endif () + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}") + +# ------------------------------------------------------------------------------ +# Debian package +elseif (CPACK_GENERATOR MATCHES "DEB") + + set (CPACK_PACKAGE_FILE_NAME "lib${CPACK_PACKAGE_NAME}") + if (DEVEL) + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-dev") + else () + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}0") + endif () + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION}-1_${CPACK_PACKAGE_ARCHITECTURE}") + + set (CPACK_DEBIAN_PACKAGE_DEPENDS) + set (CPACK_DEBIAN_PACKAGE_SECTION "devel") + set (CPACK_DEBIAN_PACKAGE_PRIORITY "optional") + set (CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_RPM_PACKAGE_URL}") + set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}") + set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_PACKAGE_ARCHITECTURE}") + +# ------------------------------------------------------------------------------ +# RPM package +elseif (CPACK_GENERATOR MATCHES "RPM") + + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") + if (DEVEL) + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel") + endif () + set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}-1.${CPACK_PACKAGE_ARCHITECTURE}") + +endif () diff --git a/runtime/onnxruntime/third_party/gflags/cmake/package.pc.in b/runtime/onnxruntime/third_party/gflags/cmake/package.pc.in new file mode 100644 index 0000000..80df818 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/package.pc.in @@ -0,0 +1,14 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +bindir=${prefix}/@RUNTIME_INSTALL_DIR@ +libdir=${prefix}/@LIBRARY_INSTALL_DIR@ +includedir=${prefix}/@INCLUDE_INSTALL_DIR@ + +Name: @PACKAGE_NAME@ +Version: @PACKAGE_VERSION@ +Description: @PACKAGE_DESCRIPTION@ +URL: @PACKAGE_URL@ +Requires: +Libs: -L${libdir} -lgflags +Libs.private: -lpthread +Cflags: -I${includedir} diff --git a/runtime/onnxruntime/third_party/gflags/cmake/utils.cmake b/runtime/onnxruntime/third_party/gflags/cmake/utils.cmake new file mode 100644 index 0000000..d039e5c --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/utils.cmake @@ -0,0 +1,205 @@ +## Utility CMake functions. + +# ---------------------------------------------------------------------------- +## Convert boolean value to 0 or 1 +macro (bool_to_int VAR) + if (${VAR}) + set (${VAR} 1) + else () + set (${VAR} 0) + endif () +endmacro () + +# ---------------------------------------------------------------------------- +## Extract version numbers from version string +function (version_numbers version major minor patch) + if (version MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?") + if (CMAKE_MATCH_1) + set (_major ${CMAKE_MATCH_1}) + else () + set (_major 0) + endif () + if (CMAKE_MATCH_2) + set (_minor ${CMAKE_MATCH_2}) + string (REGEX REPLACE "^\\." "" _minor "${_minor}") + else () + set (_minor 0) + endif () + if (CMAKE_MATCH_3) + set (_patch ${CMAKE_MATCH_3}) + string (REGEX REPLACE "^\\." "" _patch "${_patch}") + else () + set (_patch 0) + endif () + else () + set (_major 0) + set (_minor 0) + set (_patch 0) + endif () + set ("${major}" "${_major}" PARENT_SCOPE) + set ("${minor}" "${_minor}" PARENT_SCOPE) + set ("${patch}" "${_patch}" PARENT_SCOPE) +endfunction () + +# ---------------------------------------------------------------------------- +## Determine if cache entry exists +macro (gflags_is_cached retvar varname) + if (DEFINED ${varname}) + get_property (${retvar} CACHE ${varname} PROPERTY TYPE SET) + else () + set (${retvar} FALSE) + endif () +endmacro () + +# ---------------------------------------------------------------------------- +## Add gflags configuration variable +# +# The default value of the (cached) configuration value can be overridden either +# on the CMake command-line or the super-project by setting the GFLAGS_ +# variable. When gflags is a subproject of another project (GFLAGS_IS_SUBPROJECT), +# the variable is not added to the CMake cache. Otherwise it is cached. +macro (gflags_define type varname docstring default) + # note that ARGC must be expanded here, as it is not a "real" variable + # (see the CMake documentation for the macro command) + if ("${ARGC}" GREATER 5) + message (FATAL_ERROR "gflags_variable: Too many macro arguments") + endif () + if (NOT DEFINED GFLAGS_${varname}) + if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5) + set (GFLAGS_${varname} "${ARGV4}") + else () + set (GFLAGS_${varname} "${default}") + endif () + endif () + if (GFLAGS_IS_SUBPROJECT) + if (NOT DEFINED ${varname}) + set (${varname} "${GFLAGS_${varname}}") + endif () + else () + set (${varname} "${GFLAGS_${varname}}" CACHE ${type} "${docstring}") + endif () +endmacro () + +# ---------------------------------------------------------------------------- +## Set property of cached gflags configuration variable +macro (gflags_property varname property value) + gflags_is_cached (_cached ${varname}) + if (_cached) + # note that property must be expanded here, as it is not a "real" variable + # (see the CMake documentation for the macro command) + if ("${property}" STREQUAL "ADVANCED") + if (${value}) + mark_as_advanced (FORCE ${varname}) + else () + mark_as_advanced (CLEAR ${varname}) + endif () + else () + set_property (CACHE ${varname} PROPERTY "${property}" "${value}") + endif () + endif () + unset (_cached) +endmacro () + +# ---------------------------------------------------------------------------- +## Modify value of gflags configuration variable +macro (gflags_set varname value) + gflags_is_cached (_cached ${varname}) + if (_cached) + set_property (CACHE ${varname} PROPERTY VALUE "${value}") + else () + set (${varname} "${value}") + endif () + unset (_cached) +endmacro () + +# ---------------------------------------------------------------------------- +## Configure public header files +function (configure_headers out) + set (tmp) + foreach (src IN LISTS ARGN) + if (IS_ABSOLUTE "${src}") + list (APPEND tmp "${src}") + elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in") + configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY) + list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") + else () + configure_file ("${PROJECT_SOURCE_DIR}/src/${src}" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" COPYONLY) + list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") + endif () + endforeach () + set (${out} "${tmp}" PARENT_SCOPE) +endfunction () + +# ---------------------------------------------------------------------------- +## Configure source files with .in suffix +function (configure_sources out) + set (tmp) + foreach (src IN LISTS ARGN) + if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in") + configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY) + list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") + else () + list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}") + endif () + endforeach () + set (${out} "${tmp}" PARENT_SCOPE) +endfunction () + +# ---------------------------------------------------------------------------- +## Add usage test +# +# Using PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION would +# do as well, but CMake/CTest does not allow us to specify an +# expected exit status. Moreover, the execute_test.cmake script +# sets environment variables needed by the --fromenv/--tryfromenv tests. +macro (add_gflags_test name expected_rc expected_output unexpected_output cmd) + set (args "--test_tmpdir=${PROJECT_BINARY_DIR}/Testing/Temporary" + "--srcdir=${PROJECT_SOURCE_DIR}/test") + add_test ( + NAME ${name} + COMMAND "${CMAKE_COMMAND}" "-DCOMMAND:STRING=$;${args};${ARGN}" + "-DEXPECTED_RC:STRING=${expected_rc}" + "-DEXPECTED_OUTPUT:STRING=${expected_output}" + "-DUNEXPECTED_OUTPUT:STRING=${unexpected_output}" + -P "${PROJECT_SOURCE_DIR}/cmake/execute_test.cmake" + WORKING_DIRECTORY "${GFLAGS_FLAGFILES_DIR}" + ) +endmacro () + +# ------------------------------------------------------------------------------ +## Register installed package with CMake +# +# This function adds an entry to the CMake registry for packages with the +# path of the directory where the package configuration file of the installed +# package is located in order to help CMake find the package in a custom +# installation prefix. This differs from CMake's export(PACKAGE) command +# which registers the build directory instead. +function (register_gflags_package CONFIG_DIR) + if (NOT IS_ABSOLUTE "${CONFIG_DIR}") + set (CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_DIR}") + endif () + string (MD5 REGISTRY_ENTRY "${CONFIG_DIR}") + if (WIN32) + install (CODE + "execute_process ( + COMMAND reg add \"HKCU\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\" /v \"${REGISTRY_ENTRY}\" /d \"${CONFIG_DIR}\" /t REG_SZ /f + RESULT_VARIABLE RT + ERROR_VARIABLE ERR + OUTPUT_QUIET + ) + if (RT EQUAL 0) + message (STATUS \"Register: Added HKEY_CURRENT_USER\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\\\\${REGISTRY_ENTRY}\") + else () + string (STRIP \"\${ERR}\" ERR) + message (STATUS \"Register: Failed to add registry entry: \${ERR}\") + endif ()" + ) + elseif (IS_DIRECTORY "$ENV{HOME}") + file (WRITE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry" "${CONFIG_DIR}") + install ( + FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry" + DESTINATION "$ENV{HOME}/.cmake/packages/${PACKAGE_NAME}" + RENAME "${REGISTRY_ENTRY}" + ) + endif () +endfunction () diff --git a/runtime/onnxruntime/third_party/gflags/cmake/version.cmake.in b/runtime/onnxruntime/third_party/gflags/cmake/version.cmake.in new file mode 100644 index 0000000..1e1af05 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/cmake/version.cmake.in @@ -0,0 +1,21 @@ +## gflags CMake configuration version file + +# ----------------------------------------------------------------------------- +# library version +set (PACKAGE_VERSION "@PACKAGE_VERSION@") + +# ----------------------------------------------------------------------------- +# check compatibility + +# Perform compatibility check here using the input CMake variables. +# See example in http://www.cmake.org/Wiki/CMake_2.6_Notes. + +set (PACKAGE_VERSION_COMPATIBLE TRUE) +set (PACKAGE_VERSION_UNSUITABLE FALSE) + +if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@PACKAGE_VERSION_MAJOR@" AND + "${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@PACKAGE_VERSION_MINOR@") + set (PACKAGE_VERSION_EXACT TRUE) +else () + set (PACKAGE_VERSION_EXACT FALSE) +endif () diff --git a/runtime/onnxruntime/third_party/gflags/src/config.h b/runtime/onnxruntime/third_party/gflags/src/config.h new file mode 100644 index 0000000..c33d207 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/config.h @@ -0,0 +1,59 @@ +// Note: This header file is only used internally. It is not part of public interface! + +#ifndef GFLAGS_CONFIG_H_ +#define GFLAGS_CONFIG_H_ + + +// --------------------------------------------------------------------------- +// System checks + +// CMake build configuration is written to defines.h file, unused by Bazel build +#if !defined(GFLAGS_BAZEL_BUILD) +# include "defines.h" +#endif + +// gcc requires this to get PRId64, etc. +#if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS 1 +#endif + +// --------------------------------------------------------------------------- +// Path separator +#ifndef PATH_SEPARATOR +# ifdef OS_WINDOWS +# define PATH_SEPARATOR '\\' +# else +# define PATH_SEPARATOR '/' +# endif +#endif + +// --------------------------------------------------------------------------- +// Windows + +// Always export symbols when compiling a shared library as this file is only +// included by internal modules when building the gflags library itself. +// The gflags_declare.h header file will set it to import these symbols otherwise. +#ifndef GFLAGS_DLL_DECL +# if GFLAGS_IS_A_DLL && defined(_MSC_VER) +# define GFLAGS_DLL_DECL __declspec(dllexport) +# elif defined(__GNUC__) && __GNUC__ >= 4 +# define GFLAGS_DLL_DECL __attribute__((visibility("default"))) +# else +# define GFLAGS_DLL_DECL +# endif +#endif +// Flags defined by the gflags library itself must be exported +#ifndef GFLAGS_DLL_DEFINE_FLAG +# define GFLAGS_DLL_DEFINE_FLAG GFLAGS_DLL_DECL +#endif + +#ifdef OS_WINDOWS +// The unittests import the symbols of the shared gflags library +# if GFLAGS_IS_A_DLL && defined(_MSC_VER) +# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport) +# endif +# include "windows_port.h" +#endif + + +#endif // GFLAGS_CONFIG_H_ diff --git a/runtime/onnxruntime/third_party/gflags/src/defines.h.in b/runtime/onnxruntime/third_party/gflags/src/defines.h.in new file mode 100644 index 0000000..dfb214e --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/defines.h.in @@ -0,0 +1,48 @@ +/* Generated from defines.h.in during build configuration using CMake. */ + +// Note: This header file is only used internally. It is not part of public interface! +// Any cmakedefine is defined using the -D flag instead when Bazel is used. +// For Bazel, this file is thus not used to avoid a private file in $(GENDIR). + +#ifndef GFLAGS_DEFINES_H_ +#define GFLAGS_DEFINES_H_ + + +// Define if you build this library for a MS Windows OS. +#cmakedefine OS_WINDOWS + +// Define if you have the header file. +#cmakedefine HAVE_STDINT_H + +// Define if you have the header file. +#cmakedefine HAVE_SYS_TYPES_H + +// Define if you have the header file. +#cmakedefine HAVE_INTTYPES_H + +// Define if you have the header file. +#cmakedefine HAVE_SYS_STAT_H + +// Define if you have the header file. +#cmakedefine HAVE_UNISTD_H + +// Define if you have the header file. +#cmakedefine HAVE_FNMATCH_H + +// Define if you have the header file (Windows 2000/XP). +#cmakedefine HAVE_SHLWAPI_H + +// Define if you have the strtoll function. +#cmakedefine HAVE_STRTOLL + +// Define if you have the strtoq function. +#cmakedefine HAVE_STRTOQ + +// Define if you have the header file. +#cmakedefine HAVE_PTHREAD + +// Define if your pthread library defines the type pthread_rwlock_t +#cmakedefine HAVE_RWLOCK + + +#endif // GFLAGS_DEFINES_H_ diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags.cc b/runtime/onnxruntime/third_party/gflags/src/gflags.cc new file mode 100644 index 0000000..8f5aa0b --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags.cc @@ -0,0 +1,2013 @@ +// Copyright (c) 1999, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Revamped and reorganized by Craig Silverstein +// +// This file contains the implementation of all our command line flags +// stuff. Here's how everything fits together +// +// * FlagRegistry owns CommandLineFlags owns FlagValue. +// * FlagSaver holds a FlagRegistry (saves it at construct time, +// restores it at destroy time). +// * CommandLineFlagParser lives outside that hierarchy, but works on +// CommandLineFlags (modifying the FlagValues). +// * Free functions like SetCommandLineOption() work via one of the +// above (such as CommandLineFlagParser). +// +// In more detail: +// +// -- The main classes that hold flag data: +// +// FlagValue holds the current value of a flag. It's +// pseudo-templatized: every operation on a FlagValue is typed. It +// also deals with storage-lifetime issues (so flag values don't go +// away in a destructor), which is why we need a whole class to hold a +// variable's value. +// +// CommandLineFlag is all the information about a single command-line +// flag. It has a FlagValue for the flag's current value, but also +// the flag's name, type, etc. +// +// FlagRegistry is a collection of CommandLineFlags. There's the +// global registry, which is where flags defined via DEFINE_foo() +// live. But it's possible to define your own flag, manually, in a +// different registry you create. (In practice, multiple registries +// are used only by FlagSaver). +// +// A given FlagValue is owned by exactly one CommandLineFlag. A given +// CommandLineFlag is owned by exactly one FlagRegistry. FlagRegistry +// has a lock; any operation that writes to a FlagValue or +// CommandLineFlag owned by that registry must acquire the +// FlagRegistry lock before doing so. +// +// --- Some other classes and free functions: +// +// CommandLineFlagInfo is a client-exposed version of CommandLineFlag. +// Once it's instantiated, it has no dependencies or relationships +// with any other part of this file. +// +// FlagRegisterer is the helper class used by the DEFINE_* macros to +// allow work to be done at global initialization time. +// +// CommandLineFlagParser is the class that reads from the commandline +// and instantiates flag values based on that. It needs to poke into +// the innards of the FlagValue->CommandLineFlag->FlagRegistry class +// hierarchy to do that. It's careful to acquire the FlagRegistry +// lock before doing any writing or other non-const actions. +// +// GetCommandLineOption is just a hook into registry routines to +// retrieve a flag based on its name. SetCommandLineOption, on the +// other hand, hooks into CommandLineFlagParser. Other API functions +// are, similarly, mostly hooks into the functionality described above. + +#include "config.h" +#include "gflags/gflags.h" + +#include +#include +#include +#if defined(HAVE_FNMATCH_H) +# include +#elif defined(HAVE_SHLWAPI_H) +# define NO_SHLWAPI_ISOS +# include +#endif +#include // For va_list and related operations +#include +#include + +#include +#include +#include +#include // for pair<> +#include + +#include "mutex.h" +#include "util.h" + +using namespace MUTEX_NAMESPACE; + + +// Special flags, type 1: the 'recursive' flags. They set another flag's val. +DEFINE_string(flagfile, "", "load flags from file"); +DEFINE_string(fromenv, "", "set flags from the environment" + " [use 'export FLAGS_flag1=value']"); +DEFINE_string(tryfromenv, "", "set flags from the environment if present"); + +// Special flags, type 2: the 'parsing' flags. They modify how we parse. +DEFINE_string(undefok, "", "comma-separated list of flag names that it is okay to specify " + "on the command line even if the program does not define a flag " + "with that name. IMPORTANT: flags in this list that have " + "arguments MUST use the flag=value format"); + +namespace GFLAGS_NAMESPACE { + +using std::map; +using std::pair; +using std::sort; +using std::string; +using std::vector; + +// This is used by the unittest to test error-exit code +void GFLAGS_DLL_DECL (*gflags_exitfunc)(int) = &exit; // from stdlib.h + + +// The help message indicating that the commandline flag has been +// 'stripped'. It will not show up when doing "-help" and its +// variants. The flag is stripped if STRIP_FLAG_HELP is set to 1 +// before including base/gflags.h + +// This is used by this file, and also in gflags_reporting.cc +const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001"; + +namespace { + +// There are also 'reporting' flags, in gflags_reporting.cc. + +static const char kError[] = "ERROR: "; + +// Indicates that undefined options are to be ignored. +// Enables deferred processing of flags in dynamically loaded libraries. +static bool allow_command_line_reparsing = false; + +static bool logging_is_probably_set_up = false; + +// This is a 'prototype' validate-function. 'Real' validate +// functions, take a flag-value as an argument: ValidateFn(bool) or +// ValidateFn(uint64). However, for easier storage, we strip off this +// argument and then restore it when actually calling the function on +// a flag value. +typedef bool (*ValidateFnProto)(); + +// Whether we should die when reporting an error. +enum DieWhenReporting { DIE, DO_NOT_DIE }; + +// Report Error and exit if requested. +static void ReportError(DieWhenReporting should_die, const char* format, ...) { + va_list ap; + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fflush(stderr); // should be unnecessary, but cygwin's rxvt buffers stderr + if (should_die == DIE) gflags_exitfunc(1); +} + + +// -------------------------------------------------------------------- +// FlagValue +// This represent the value a single flag might have. The major +// functionality is to convert from a string to an object of a +// given type, and back. Thread-compatible. +// -------------------------------------------------------------------- + +class CommandLineFlag; +class FlagValue { + public: + enum ValueType { + FV_BOOL = 0, + FV_INT32 = 1, + FV_UINT32 = 2, + FV_INT64 = 3, + FV_UINT64 = 4, + FV_DOUBLE = 5, + FV_STRING = 6, + FV_MAX_INDEX = 6, + }; + + template + FlagValue(FlagType* valbuf, bool transfer_ownership_of_value); + ~FlagValue(); + + bool ParseFrom(const char* spec); + string ToString() const; + + ValueType Type() const { return static_cast(type_); } + + private: + friend class CommandLineFlag; // for many things, including Validate() + friend class GFLAGS_NAMESPACE::FlagSaverImpl; // calls New() + friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map + template friend T GetFromEnv(const char*, T); + friend bool TryParseLocked(const CommandLineFlag*, FlagValue*, + const char*, string*); // for New(), CopyFrom() + + template + struct FlagValueTraits; + + const char* TypeName() const; + bool Equal(const FlagValue& x) const; + FlagValue* New() const; // creates a new one with default value + void CopyFrom(const FlagValue& x); + + // Calls the given validate-fn on value_buffer_, and returns + // whatever it returns. But first casts validate_fn_proto to a + // function that takes our value as an argument (eg void + // (*validate_fn)(bool) for a bool flag). + bool Validate(const char* flagname, ValidateFnProto validate_fn_proto) const; + + void* const value_buffer_; // points to the buffer holding our data + const int8 type_; // how to interpret value_ + const bool owns_value_; // whether to free value on destruct + + FlagValue(const FlagValue&); // no copying! + void operator=(const FlagValue&); +}; + +// Map the given C++ type to a value of the ValueType enum at compile time. +#define DEFINE_FLAG_TRAITS(type, value) \ + template <> \ + struct FlagValue::FlagValueTraits { \ + static const ValueType kValueType = value; \ + } + +// Define full template specializations of the FlagValueTraits template +// for all supported flag types. +DEFINE_FLAG_TRAITS(bool, FV_BOOL); +DEFINE_FLAG_TRAITS(int32, FV_INT32); +DEFINE_FLAG_TRAITS(uint32, FV_UINT32); +DEFINE_FLAG_TRAITS(int64, FV_INT64); +DEFINE_FLAG_TRAITS(uint64, FV_UINT64); +DEFINE_FLAG_TRAITS(double, FV_DOUBLE); +DEFINE_FLAG_TRAITS(std::string, FV_STRING); + +#undef DEFINE_FLAG_TRAITS + + +// This could be a templated method of FlagValue, but doing so adds to the +// size of the .o. Since there's no type-safety here anyway, macro is ok. +#define VALUE_AS(type) *reinterpret_cast(value_buffer_) +#define OTHER_VALUE_AS(fv, type) *reinterpret_cast(fv.value_buffer_) +#define SET_VALUE_AS(type, value) VALUE_AS(type) = (value) + +template +FlagValue::FlagValue(FlagType* valbuf, + bool transfer_ownership_of_value) + : value_buffer_(valbuf), + type_(FlagValueTraits::kValueType), + owns_value_(transfer_ownership_of_value) { +} + +FlagValue::~FlagValue() { + if (!owns_value_) { + return; + } + switch (type_) { + case FV_BOOL: delete reinterpret_cast(value_buffer_); break; + case FV_INT32: delete reinterpret_cast(value_buffer_); break; + case FV_UINT32: delete reinterpret_cast(value_buffer_); break; + case FV_INT64: delete reinterpret_cast(value_buffer_); break; + case FV_UINT64: delete reinterpret_cast(value_buffer_); break; + case FV_DOUBLE: delete reinterpret_cast(value_buffer_); break; + case FV_STRING: delete reinterpret_cast(value_buffer_); break; + } +} + +bool FlagValue::ParseFrom(const char* value) { + if (type_ == FV_BOOL) { + const char* kTrue[] = { "1", "t", "true", "y", "yes" }; + const char* kFalse[] = { "0", "f", "false", "n", "no" }; + COMPILE_ASSERT(sizeof(kTrue) == sizeof(kFalse), true_false_equal); + for (size_t i = 0; i < sizeof(kTrue)/sizeof(*kTrue); ++i) { + if (strcasecmp(value, kTrue[i]) == 0) { + SET_VALUE_AS(bool, true); + return true; + } else if (strcasecmp(value, kFalse[i]) == 0) { + SET_VALUE_AS(bool, false); + return true; + } + } + return false; // didn't match a legal input + + } else if (type_ == FV_STRING) { + SET_VALUE_AS(string, value); + return true; + } + + // OK, it's likely to be numeric, and we'll be using a strtoXXX method. + if (value[0] == '\0') // empty-string is only allowed for string type. + return false; + char* end; + // Leading 0x puts us in base 16. But leading 0 does not put us in base 8! + // It caused too many bugs when we had that behavior. + int base = 10; // by default + if (value[0] == '0' && (value[1] == 'x' || value[1] == 'X')) + base = 16; + errno = 0; + + switch (type_) { + case FV_INT32: { + const int64 r = strto64(value, &end, base); + if (errno || end != value + strlen(value)) return false; // bad parse + if (static_cast(r) != r) // worked, but number out of range + return false; + SET_VALUE_AS(int32, static_cast(r)); + return true; + } + case FV_UINT32: { + while (*value == ' ') value++; + if (*value == '-') return false; // negative number + const uint64 r = strtou64(value, &end, base); + if (errno || end != value + strlen(value)) return false; // bad parse + if (static_cast(r) != r) // worked, but number out of range + return false; + SET_VALUE_AS(uint32, static_cast(r)); + return true; + } + case FV_INT64: { + const int64 r = strto64(value, &end, base); + if (errno || end != value + strlen(value)) return false; // bad parse + SET_VALUE_AS(int64, r); + return true; + } + case FV_UINT64: { + while (*value == ' ') value++; + if (*value == '-') return false; // negative number + const uint64 r = strtou64(value, &end, base); + if (errno || end != value + strlen(value)) return false; // bad parse + SET_VALUE_AS(uint64, r); + return true; + } + case FV_DOUBLE: { + const double r = strtod(value, &end); + if (errno || end != value + strlen(value)) return false; // bad parse + SET_VALUE_AS(double, r); + return true; + } + default: { + assert(false); // unknown type + return false; + } + } +} + +string FlagValue::ToString() const { + char intbuf[64]; // enough to hold even the biggest number + switch (type_) { + case FV_BOOL: + return VALUE_AS(bool) ? "true" : "false"; + case FV_INT32: + snprintf(intbuf, sizeof(intbuf), "%" PRId32, VALUE_AS(int32)); + return intbuf; + case FV_UINT32: + snprintf(intbuf, sizeof(intbuf), "%" PRIu32, VALUE_AS(uint32)); + return intbuf; + case FV_INT64: + snprintf(intbuf, sizeof(intbuf), "%" PRId64, VALUE_AS(int64)); + return intbuf; + case FV_UINT64: + snprintf(intbuf, sizeof(intbuf), "%" PRIu64, VALUE_AS(uint64)); + return intbuf; + case FV_DOUBLE: + snprintf(intbuf, sizeof(intbuf), "%.17g", VALUE_AS(double)); + return intbuf; + case FV_STRING: + return VALUE_AS(string); + default: + assert(false); + return ""; // unknown type + } +} + +bool FlagValue::Validate(const char* flagname, + ValidateFnProto validate_fn_proto) const { + switch (type_) { + case FV_BOOL: + return reinterpret_cast( + validate_fn_proto)(flagname, VALUE_AS(bool)); + case FV_INT32: + return reinterpret_cast( + validate_fn_proto)(flagname, VALUE_AS(int32)); + case FV_UINT32: + return reinterpret_cast( + validate_fn_proto)(flagname, VALUE_AS(uint32)); + case FV_INT64: + return reinterpret_cast( + validate_fn_proto)(flagname, VALUE_AS(int64)); + case FV_UINT64: + return reinterpret_cast( + validate_fn_proto)(flagname, VALUE_AS(uint64)); + case FV_DOUBLE: + return reinterpret_cast( + validate_fn_proto)(flagname, VALUE_AS(double)); + case FV_STRING: + return reinterpret_cast( + validate_fn_proto)(flagname, VALUE_AS(string)); + default: + assert(false); // unknown type + return false; + } +} + +const char* FlagValue::TypeName() const { + static const char types[] = + "bool\0xx" + "int32\0x" + "uint32\0" + "int64\0x" + "uint64\0" + "double\0" + "string"; + if (type_ > FV_MAX_INDEX) { + assert(false); + return ""; + } + // Directly indexing the strings in the 'types' string, each of them is 7 bytes long. + return &types[type_ * 7]; +} + +bool FlagValue::Equal(const FlagValue& x) const { + if (type_ != x.type_) + return false; + switch (type_) { + case FV_BOOL: return VALUE_AS(bool) == OTHER_VALUE_AS(x, bool); + case FV_INT32: return VALUE_AS(int32) == OTHER_VALUE_AS(x, int32); + case FV_UINT32: return VALUE_AS(uint32) == OTHER_VALUE_AS(x, uint32); + case FV_INT64: return VALUE_AS(int64) == OTHER_VALUE_AS(x, int64); + case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64); + case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double); + case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string); + default: assert(false); return false; // unknown type + } +} + +FlagValue* FlagValue::New() const { + switch (type_) { + case FV_BOOL: return new FlagValue(new bool(false), true); + case FV_INT32: return new FlagValue(new int32(0), true); + case FV_UINT32: return new FlagValue(new uint32(0), true); + case FV_INT64: return new FlagValue(new int64(0), true); + case FV_UINT64: return new FlagValue(new uint64(0), true); + case FV_DOUBLE: return new FlagValue(new double(0.0), true); + case FV_STRING: return new FlagValue(new string, true); + default: assert(false); return NULL; // unknown type + } +} + +void FlagValue::CopyFrom(const FlagValue& x) { + assert(type_ == x.type_); + switch (type_) { + case FV_BOOL: SET_VALUE_AS(bool, OTHER_VALUE_AS(x, bool)); break; + case FV_INT32: SET_VALUE_AS(int32, OTHER_VALUE_AS(x, int32)); break; + case FV_UINT32: SET_VALUE_AS(uint32, OTHER_VALUE_AS(x, uint32)); break; + case FV_INT64: SET_VALUE_AS(int64, OTHER_VALUE_AS(x, int64)); break; + case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64)); break; + case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double)); break; + case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string)); break; + default: assert(false); // unknown type + } +} + +// -------------------------------------------------------------------- +// CommandLineFlag +// This represents a single flag, including its name, description, +// default value, and current value. Mostly this serves as a +// struct, though it also knows how to register itself. +// All CommandLineFlags are owned by a (exactly one) +// FlagRegistry. If you wish to modify fields in this class, you +// should acquire the FlagRegistry lock for the registry that owns +// this flag. +// -------------------------------------------------------------------- + +class CommandLineFlag { + public: + // Note: we take over memory-ownership of current_val and default_val. + CommandLineFlag(const char* name, const char* help, const char* filename, + FlagValue* current_val, FlagValue* default_val); + ~CommandLineFlag(); + + const char* name() const { return name_; } + const char* help() const { return help_; } + const char* filename() const { return file_; } + const char* CleanFileName() const; // nixes irrelevant prefix such as homedir + string current_value() const { return current_->ToString(); } + string default_value() const { return defvalue_->ToString(); } + const char* type_name() const { return defvalue_->TypeName(); } + ValidateFnProto validate_function() const { return validate_fn_proto_; } + const void* flag_ptr() const { return current_->value_buffer_; } + + FlagValue::ValueType Type() const { return defvalue_->Type(); } + + void FillCommandLineFlagInfo(struct CommandLineFlagInfo* result); + + // If validate_fn_proto_ is non-NULL, calls it on value, returns result. + bool Validate(const FlagValue& value) const; + bool ValidateCurrent() const { return Validate(*current_); } + bool Modified() const { return modified_; } + + private: + // for SetFlagLocked() and setting flags_by_ptr_ + friend class FlagRegistry; + friend class GFLAGS_NAMESPACE::FlagSaverImpl; // for cloning the values + // set validate_fn + friend bool AddFlagValidator(const void*, ValidateFnProto); + + // This copies all the non-const members: modified, processed, defvalue, etc. + void CopyFrom(const CommandLineFlag& src); + + void UpdateModifiedBit(); + + const char* const name_; // Flag name + const char* const help_; // Help message + const char* const file_; // Which file did this come from? + bool modified_; // Set after default assignment? + FlagValue* defvalue_; // Default value for flag + FlagValue* current_; // Current value for flag + // This is a casted, 'generic' version of validate_fn, which actually + // takes a flag-value as an arg (void (*validate_fn)(bool), say). + // When we pass this to current_->Validate(), it will cast it back to + // the proper type. This may be NULL to mean we have no validate_fn. + ValidateFnProto validate_fn_proto_; + + CommandLineFlag(const CommandLineFlag&); // no copying! + void operator=(const CommandLineFlag&); +}; + +CommandLineFlag::CommandLineFlag(const char* name, const char* help, + const char* filename, + FlagValue* current_val, FlagValue* default_val) + : name_(name), help_(help), file_(filename), modified_(false), + defvalue_(default_val), current_(current_val), validate_fn_proto_(NULL) { +} + +CommandLineFlag::~CommandLineFlag() { + delete current_; + delete defvalue_; +} + +const char* CommandLineFlag::CleanFileName() const { + // This function has been used to strip off a common prefix from + // flag source file names. Because flags can be defined in different + // shared libraries, there may not be a single common prefix. + // Further, this functionality hasn't been active for many years. + // Need a better way to produce more user friendly help output or + // "anonymize" file paths in help output, respectively. + // Follow issue at: https://github.com/gflags/gflags/issues/86 + return filename(); +} + +void CommandLineFlag::FillCommandLineFlagInfo( + CommandLineFlagInfo* result) { + result->name = name(); + result->type = type_name(); + result->description = help(); + result->current_value = current_value(); + result->default_value = default_value(); + result->filename = CleanFileName(); + UpdateModifiedBit(); + result->is_default = !modified_; + result->has_validator_fn = validate_function() != NULL; + result->flag_ptr = flag_ptr(); +} + +void CommandLineFlag::UpdateModifiedBit() { + // Update the "modified" bit in case somebody bypassed the + // Flags API and wrote directly through the FLAGS_name variable. + if (!modified_ && !current_->Equal(*defvalue_)) { + modified_ = true; + } +} + +void CommandLineFlag::CopyFrom(const CommandLineFlag& src) { + // Note we only copy the non-const members; others are fixed at construct time + if (modified_ != src.modified_) modified_ = src.modified_; + if (!current_->Equal(*src.current_)) current_->CopyFrom(*src.current_); + if (!defvalue_->Equal(*src.defvalue_)) defvalue_->CopyFrom(*src.defvalue_); + if (validate_fn_proto_ != src.validate_fn_proto_) + validate_fn_proto_ = src.validate_fn_proto_; +} + +bool CommandLineFlag::Validate(const FlagValue& value) const { + + if (validate_function() == NULL) + return true; + else + return value.Validate(name(), validate_function()); +} + + +// -------------------------------------------------------------------- +// FlagRegistry +// A FlagRegistry singleton object holds all flag objects indexed +// by their names so that if you know a flag's name (as a C +// string), you can access or set it. If the function is named +// FooLocked(), you must own the registry lock before calling +// the function; otherwise, you should *not* hold the lock, and +// the function will acquire it itself if needed. +// -------------------------------------------------------------------- + +struct StringCmp { // Used by the FlagRegistry map class to compare char*'s + bool operator() (const char* s1, const char* s2) const { + return (strcmp(s1, s2) < 0); + } +}; + + +class FlagRegistry { + public: + FlagRegistry() { + } + ~FlagRegistry() { + // Not using STLDeleteElements as that resides in util and this + // class is base. + for (FlagMap::iterator p = flags_.begin(), e = flags_.end(); p != e; ++p) { + CommandLineFlag* flag = p->second; + delete flag; + } + } + + static void DeleteGlobalRegistry() { + delete global_registry_; + global_registry_ = NULL; + } + + // Store a flag in this registry. Takes ownership of the given pointer. + void RegisterFlag(CommandLineFlag* flag); + + void Lock() { lock_.Lock(); } + void Unlock() { lock_.Unlock(); } + + // Returns the flag object for the specified name, or NULL if not found. + CommandLineFlag* FindFlagLocked(const char* name); + + // Returns the flag object whose current-value is stored at flag_ptr. + // That is, for whom current_->value_buffer_ == flag_ptr + CommandLineFlag* FindFlagViaPtrLocked(const void* flag_ptr); + + // A fancier form of FindFlag that works correctly if name is of the + // form flag=value. In that case, we set key to point to flag, and + // modify v to point to the value (if present), and return the flag + // with the given name. If the flag does not exist, returns NULL + // and sets error_message. + CommandLineFlag* SplitArgumentLocked(const char* argument, + string* key, const char** v, + string* error_message); + + // Set the value of a flag. If the flag was successfully set to + // value, set msg to indicate the new flag-value, and return true. + // Otherwise, set msg to indicate the error, leave flag unchanged, + // and return false. msg can be NULL. + bool SetFlagLocked(CommandLineFlag* flag, const char* value, + FlagSettingMode set_mode, string* msg); + + static FlagRegistry* GlobalRegistry(); // returns a singleton registry + + private: + friend class GFLAGS_NAMESPACE::FlagSaverImpl; // reads all the flags in order to copy them + friend class CommandLineFlagParser; // for ValidateUnmodifiedFlags + friend void GFLAGS_NAMESPACE::GetAllFlags(vector*); + + // The map from name to flag, for FindFlagLocked(). + typedef map FlagMap; + typedef FlagMap::iterator FlagIterator; + typedef FlagMap::const_iterator FlagConstIterator; + FlagMap flags_; + + // The map from current-value pointer to flag, fo FindFlagViaPtrLocked(). + typedef map FlagPtrMap; + FlagPtrMap flags_by_ptr_; + + static FlagRegistry* global_registry_; // a singleton registry + + Mutex lock_; + + static void InitGlobalRegistry(); + + // Disallow + FlagRegistry(const FlagRegistry&); + FlagRegistry& operator=(const FlagRegistry&); +}; + +class FlagRegistryLock { + public: + explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); } + ~FlagRegistryLock() { fr_->Unlock(); } + private: + FlagRegistry *const fr_; +}; + + +void FlagRegistry::RegisterFlag(CommandLineFlag* flag) { + Lock(); + pair ins = + flags_.insert(pair(flag->name(), flag)); + if (ins.second == false) { // means the name was already in the map + if (strcmp(ins.first->second->filename(), flag->filename()) != 0) { + ReportError(DIE, "ERROR: flag '%s' was defined more than once " + "(in files '%s' and '%s').\n", + flag->name(), + ins.first->second->filename(), + flag->filename()); + } else { + ReportError(DIE, "ERROR: something wrong with flag '%s' in file '%s'. " + "One possibility: file '%s' is being linked both statically " + "and dynamically into this executable.\n", + flag->name(), + flag->filename(), flag->filename()); + } + } + // Also add to the flags_by_ptr_ map. + flags_by_ptr_[flag->current_->value_buffer_] = flag; + Unlock(); +} + +CommandLineFlag* FlagRegistry::FindFlagLocked(const char* name) { + FlagConstIterator i = flags_.find(name); + if (i == flags_.end()) { + // If the name has dashes in it, try again after replacing with + // underscores. + if (strchr(name, '-') == NULL) return NULL; + string name_rep = name; + std::replace(name_rep.begin(), name_rep.end(), '-', '_'); + return FindFlagLocked(name_rep.c_str()); + } else { + return i->second; + } +} + +CommandLineFlag* FlagRegistry::FindFlagViaPtrLocked(const void* flag_ptr) { + FlagPtrMap::const_iterator i = flags_by_ptr_.find(flag_ptr); + if (i == flags_by_ptr_.end()) { + return NULL; + } else { + return i->second; + } +} + +CommandLineFlag* FlagRegistry::SplitArgumentLocked(const char* arg, + string* key, + const char** v, + string* error_message) { + // Find the flag object for this option + const char* flag_name; + const char* value = strchr(arg, '='); + if (value == NULL) { + key->assign(arg); + *v = NULL; + } else { + // Strip out the "=value" portion from arg + key->assign(arg, value-arg); + *v = ++value; // advance past the '=' + } + flag_name = key->c_str(); + + CommandLineFlag* flag = FindFlagLocked(flag_name); + + if (flag == NULL) { + // If we can't find the flag-name, then we should return an error. + // The one exception is if 1) the flag-name is 'nox', 2) there + // exists a flag named 'x', and 3) 'x' is a boolean flag. + // In that case, we want to return flag 'x'. + if (!(flag_name[0] == 'n' && flag_name[1] == 'o')) { + // flag-name is not 'nox', so we're not in the exception case. + *error_message = StringPrintf("%sunknown command line flag '%s'\n", + kError, key->c_str()); + return NULL; + } + flag = FindFlagLocked(flag_name+2); + if (flag == NULL) { + // No flag named 'x' exists, so we're not in the exception case. + *error_message = StringPrintf("%sunknown command line flag '%s'\n", + kError, key->c_str()); + return NULL; + } + if (flag->Type() != FlagValue::FV_BOOL) { + // 'x' exists but is not boolean, so we're not in the exception case. + *error_message = StringPrintf( + "%sboolean value (%s) specified for %s command line flag\n", + kError, key->c_str(), flag->type_name()); + return NULL; + } + // We're in the exception case! + // Make up a fake value to replace the "no" we stripped out + key->assign(flag_name+2); // the name without the "no" + *v = "0"; + } + + // Assign a value if this is a boolean flag + if (*v == NULL && flag->Type() == FlagValue::FV_BOOL) { + *v = "1"; // the --nox case was already handled, so this is the --x case + } + + return flag; +} + +bool TryParseLocked(const CommandLineFlag* flag, FlagValue* flag_value, + const char* value, string* msg) { + // Use tenative_value, not flag_value, until we know value is valid. + FlagValue* tentative_value = flag_value->New(); + if (!tentative_value->ParseFrom(value)) { + if (msg) { + StringAppendF(msg, + "%sillegal value '%s' specified for %s flag '%s'\n", + kError, value, + flag->type_name(), flag->name()); + } + delete tentative_value; + return false; + } else if (!flag->Validate(*tentative_value)) { + if (msg) { + StringAppendF(msg, + "%sfailed validation of new value '%s' for flag '%s'\n", + kError, tentative_value->ToString().c_str(), + flag->name()); + } + delete tentative_value; + return false; + } else { + flag_value->CopyFrom(*tentative_value); + if (msg) { + StringAppendF(msg, "%s set to %s\n", + flag->name(), flag_value->ToString().c_str()); + } + delete tentative_value; + return true; + } +} + +bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag, + const char* value, + FlagSettingMode set_mode, + string* msg) { + flag->UpdateModifiedBit(); + switch (set_mode) { + case SET_FLAGS_VALUE: { + // set or modify the flag's value + if (!TryParseLocked(flag, flag->current_, value, msg)) + return false; + flag->modified_ = true; + break; + } + case SET_FLAG_IF_DEFAULT: { + // set the flag's value, but only if it hasn't been set by someone else + if (!flag->modified_) { + if (!TryParseLocked(flag, flag->current_, value, msg)) + return false; + flag->modified_ = true; + } else { + *msg = StringPrintf("%s set to %s", + flag->name(), flag->current_value().c_str()); + } + break; + } + case SET_FLAGS_DEFAULT: { + // modify the flag's default-value + if (!TryParseLocked(flag, flag->defvalue_, value, msg)) + return false; + if (!flag->modified_) { + // Need to set both defvalue *and* current, in this case + TryParseLocked(flag, flag->current_, value, NULL); + } + break; + } + default: { + // unknown set_mode + assert(false); + return false; + } + } + + return true; +} + +// Get the singleton FlagRegistry object +FlagRegistry* FlagRegistry::global_registry_ = NULL; + +FlagRegistry* FlagRegistry::GlobalRegistry() { + static Mutex lock(Mutex::LINKER_INITIALIZED); + MutexLock acquire_lock(&lock); + if (!global_registry_) { + global_registry_ = new FlagRegistry; + } + return global_registry_; +} + +// -------------------------------------------------------------------- +// CommandLineFlagParser +// Parsing is done in two stages. In the first, we go through +// argv. For every flag-like arg we can make sense of, we parse +// it and set the appropriate FLAGS_* variable. For every flag- +// like arg we can't make sense of, we store it in a vector, +// along with an explanation of the trouble. In stage 2, we +// handle the 'reporting' flags like --help and --mpm_version. +// (This is via a call to HandleCommandLineHelpFlags(), in +// gflags_reporting.cc.) +// An optional stage 3 prints out the error messages. +// This is a bit of a simplification. For instance, --flagfile +// is handled as soon as it's seen in stage 1, not in stage 2. +// -------------------------------------------------------------------- + +class CommandLineFlagParser { + public: + // The argument is the flag-registry to register the parsed flags in + explicit CommandLineFlagParser(FlagRegistry* reg) : registry_(reg) {} + ~CommandLineFlagParser() {} + + // Stage 1: Every time this is called, it reads all flags in argv. + // However, it ignores all flags that have been successfully set + // before. Typically this is only called once, so this 'reparsing' + // behavior isn't important. It can be useful when trying to + // reparse after loading a dll, though. + uint32 ParseNewCommandLineFlags(int* argc, char*** argv, bool remove_flags); + + // Stage 2: print reporting info and exit, if requested. + // In gflags_reporting.cc:HandleCommandLineHelpFlags(). + + // Stage 3: validate all the commandline flags that have validators + // registered and were not set/modified by ParseNewCommandLineFlags. + void ValidateFlags(bool all); + void ValidateUnmodifiedFlags(); + + // Stage 4: report any errors and return true if any were found. + bool ReportErrors(); + + // Set a particular command line option. "newval" is a string + // describing the new value that the option has been set to. If + // option_name does not specify a valid option name, or value is not + // a valid value for option_name, newval is empty. Does recursive + // processing for --flagfile and --fromenv. Returns the new value + // if everything went ok, or empty-string if not. (Actually, the + // return-string could hold many flag/value pairs due to --flagfile.) + // NB: Must have called registry_->Lock() before calling this function. + string ProcessSingleOptionLocked(CommandLineFlag* flag, + const char* value, + FlagSettingMode set_mode); + + // Set a whole batch of command line options as specified by contentdata, + // which is in flagfile format (and probably has been read from a flagfile). + // Returns the new value if everything went ok, or empty-string if + // not. (Actually, the return-string could hold many flag/value + // pairs due to --flagfile.) + // NB: Must have called registry_->Lock() before calling this function. + string ProcessOptionsFromStringLocked(const string& contentdata, + FlagSettingMode set_mode); + + // These are the 'recursive' flags, defined at the top of this file. + // Whenever we see these flags on the commandline, we must take action. + // These are called by ProcessSingleOptionLocked and, similarly, return + // new values if everything went ok, or the empty-string if not. + string ProcessFlagfileLocked(const string& flagval, FlagSettingMode set_mode); + // diff fromenv/tryfromenv + string ProcessFromenvLocked(const string& flagval, FlagSettingMode set_mode, + bool errors_are_fatal); + + private: + FlagRegistry* const registry_; + map error_flags_; // map from name to error message + // This could be a set, but we reuse the map to minimize the .o size + map undefined_names_; // --[flag] name was not registered +}; + + +// Parse a list of (comma-separated) flags. +static void ParseFlagList(const char* value, vector* flags) { + for (const char *p = value; p && *p; value = p) { + p = strchr(value, ','); + size_t len; + if (p) { + len = p - value; + p++; + } else { + len = strlen(value); + } + + if (len == 0) + ReportError(DIE, "ERROR: empty flaglist entry\n"); + if (value[0] == '-') + ReportError(DIE, "ERROR: flag \"%*s\" begins with '-'\n", len, value); + + flags->push_back(string(value, len)); + } +} + +// Snarf an entire file into a C++ string. This is just so that we +// can do all the I/O in one place and not worry about it everywhere. +// Plus, it's convenient to have the whole file contents at hand. +// Adds a newline at the end of the file. +#define PFATAL(s) do { perror(s); gflags_exitfunc(1); } while (0) + +static string ReadFileIntoString(const char* filename) { + const int kBufSize = 8092; + char buffer[kBufSize]; + string s; + FILE* fp; + if ((errno = SafeFOpen(&fp, filename, "r")) != 0) PFATAL(filename); + size_t n; + while ( (n=fread(buffer, 1, kBufSize, fp)) > 0 ) { + if (ferror(fp)) PFATAL(filename); + s.append(buffer, n); + } + fclose(fp); + return s; +} + +uint32 CommandLineFlagParser::ParseNewCommandLineFlags(int* argc, char*** argv, + bool remove_flags) { + int first_nonopt = *argc; // for non-options moved to the end + + registry_->Lock(); + for (int i = 1; i < first_nonopt; i++) { + char* arg = (*argv)[i]; + + // Like getopt(), we permute non-option flags to be at the end. + if (arg[0] != '-' || arg[1] == '\0') { // must be a program argument: "-" is an argument, not a flag + memmove((*argv) + i, (*argv) + i+1, (*argc - (i+1)) * sizeof((*argv)[i])); + (*argv)[*argc-1] = arg; // we go last + first_nonopt--; // we've been pushed onto the stack + i--; // to undo the i++ in the loop + continue; + } + arg++; // skip leading '-' + if (arg[0] == '-') arg++; // or leading '--' + + // -- alone means what it does for GNU: stop options parsing + if (*arg == '\0') { + first_nonopt = i+1; + break; + } + + // Find the flag object for this option + string key; + const char* value; + string error_message; + CommandLineFlag* flag = registry_->SplitArgumentLocked(arg, &key, &value, + &error_message); + if (flag == NULL) { + undefined_names_[key] = ""; // value isn't actually used + error_flags_[key] = error_message; + continue; + } + + if (value == NULL) { + // Boolean options are always assigned a value by SplitArgumentLocked() + assert(flag->Type() != FlagValue::FV_BOOL); + if (i+1 >= first_nonopt) { + // This flag needs a value, but there is nothing available + error_flags_[key] = (string(kError) + "flag '" + (*argv)[i] + "'" + + " is missing its argument"); + if (flag->help() && flag->help()[0] > '\001') { + // Be useful in case we have a non-stripped description. + error_flags_[key] += string("; flag description: ") + flag->help(); + } + error_flags_[key] += "\n"; + break; // we treat this as an unrecoverable error + } else { + value = (*argv)[++i]; // read next arg for value + + // Heuristic to detect the case where someone treats a string arg + // like a bool: + // --my_string_var --foo=bar + // We look for a flag of string type, whose value begins with a + // dash, and where the flag-name and value are separated by a + // space rather than an '='. + // To avoid false positives, we also require the word "true" + // or "false" in the help string. Without this, a valid usage + // "-lat -30.5" would trigger the warning. The common cases we + // want to solve talk about true and false as values. + if (value[0] == '-' + && flag->Type() == FlagValue::FV_STRING + && (strstr(flag->help(), "true") + || strstr(flag->help(), "false"))) { + LOG(WARNING) << "Did you really mean to set flag '" + << flag->name() << "' to the value '" + << value << "'?"; + } + } + } + + // TODO(csilvers): only set a flag if we hadn't set it before here + ProcessSingleOptionLocked(flag, value, SET_FLAGS_VALUE); + } + registry_->Unlock(); + + if (remove_flags) { // Fix up argc and argv by removing command line flags + (*argv)[first_nonopt-1] = (*argv)[0]; + (*argv) += (first_nonopt-1); + (*argc) -= (first_nonopt-1); + first_nonopt = 1; // because we still don't count argv[0] + } + + logging_is_probably_set_up = true; // because we've parsed --logdir, etc. + + return first_nonopt; +} + +string CommandLineFlagParser::ProcessFlagfileLocked(const string& flagval, + FlagSettingMode set_mode) { + if (flagval.empty()) + return ""; + + string msg; + vector filename_list; + ParseFlagList(flagval.c_str(), &filename_list); // take a list of filenames + for (size_t i = 0; i < filename_list.size(); ++i) { + const char* file = filename_list[i].c_str(); + msg += ProcessOptionsFromStringLocked(ReadFileIntoString(file), set_mode); + } + return msg; +} + +string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval, + FlagSettingMode set_mode, + bool errors_are_fatal) { + if (flagval.empty()) + return ""; + + string msg; + vector flaglist; + ParseFlagList(flagval.c_str(), &flaglist); + + for (size_t i = 0; i < flaglist.size(); ++i) { + const char* flagname = flaglist[i].c_str(); + CommandLineFlag* flag = registry_->FindFlagLocked(flagname); + if (flag == NULL) { + error_flags_[flagname] = + StringPrintf("%sunknown command line flag '%s' " + "(via --fromenv or --tryfromenv)\n", + kError, flagname); + undefined_names_[flagname] = ""; + continue; + } + + const string envname = string("FLAGS_") + string(flagname); + string envval; + if (!SafeGetEnv(envname.c_str(), envval)) { + if (errors_are_fatal) { + error_flags_[flagname] = (string(kError) + envname + + " not found in environment\n"); + } + continue; + } + + // Avoid infinite recursion. + if (envval == "fromenv" || envval == "tryfromenv") { + error_flags_[flagname] = + StringPrintf("%sinfinite recursion on environment flag '%s'\n", + kError, envval.c_str()); + continue; + } + + msg += ProcessSingleOptionLocked(flag, envval.c_str(), set_mode); + } + return msg; +} + +string CommandLineFlagParser::ProcessSingleOptionLocked( + CommandLineFlag* flag, const char* value, FlagSettingMode set_mode) { + string msg; + if (value && !registry_->SetFlagLocked(flag, value, set_mode, &msg)) { + error_flags_[flag->name()] = msg; + return ""; + } + + // The recursive flags, --flagfile and --fromenv and --tryfromenv, + // must be dealt with as soon as they're seen. They will emit + // messages of their own. + if (strcmp(flag->name(), "flagfile") == 0) { + msg += ProcessFlagfileLocked(FLAGS_flagfile, set_mode); + + } else if (strcmp(flag->name(), "fromenv") == 0) { + // last arg indicates envval-not-found is fatal (unlike in --tryfromenv) + msg += ProcessFromenvLocked(FLAGS_fromenv, set_mode, true); + + } else if (strcmp(flag->name(), "tryfromenv") == 0) { + msg += ProcessFromenvLocked(FLAGS_tryfromenv, set_mode, false); + } + + return msg; +} + +void CommandLineFlagParser::ValidateFlags(bool all) { + FlagRegistryLock frl(registry_); + for (FlagRegistry::FlagConstIterator i = registry_->flags_.begin(); + i != registry_->flags_.end(); ++i) { + if ((all || !i->second->Modified()) && !i->second->ValidateCurrent()) { + // only set a message if one isn't already there. (If there's + // an error message, our job is done, even if it's not exactly + // the same error.) + if (error_flags_[i->second->name()].empty()) { + error_flags_[i->second->name()] = + string(kError) + "--" + i->second->name() + + " must be set on the commandline"; + if (!i->second->Modified()) { + error_flags_[i->second->name()] += " (default value fails validation)"; + } + error_flags_[i->second->name()] += "\n"; + } + } + } +} + +void CommandLineFlagParser::ValidateUnmodifiedFlags() { + ValidateFlags(false); +} + +bool CommandLineFlagParser::ReportErrors() { + // error_flags_ indicates errors we saw while parsing. + // But we ignore undefined-names if ok'ed by --undef_ok + if (!FLAGS_undefok.empty()) { + vector flaglist; + ParseFlagList(FLAGS_undefok.c_str(), &flaglist); + for (size_t i = 0; i < flaglist.size(); ++i) { + // We also deal with --no, in case the flagname was boolean + const string no_version = string("no") + flaglist[i]; + if (undefined_names_.find(flaglist[i]) != undefined_names_.end()) { + error_flags_[flaglist[i]] = ""; // clear the error message + } else if (undefined_names_.find(no_version) != undefined_names_.end()) { + error_flags_[no_version] = ""; + } + } + } + // Likewise, if they decided to allow reparsing, all undefined-names + // are ok; we just silently ignore them now, and hope that a future + // parse will pick them up somehow. + if (allow_command_line_reparsing) { + for (map::const_iterator it = undefined_names_.begin(); + it != undefined_names_.end(); ++it) + error_flags_[it->first] = ""; // clear the error message + } + + bool found_error = false; + string error_message; + for (map::const_iterator it = error_flags_.begin(); + it != error_flags_.end(); ++it) { + if (!it->second.empty()) { + error_message.append(it->second.data(), it->second.size()); + found_error = true; + } + } + if (found_error) + ReportError(DO_NOT_DIE, "%s", error_message.c_str()); + return found_error; +} + +string CommandLineFlagParser::ProcessOptionsFromStringLocked( + const string& contentdata, FlagSettingMode set_mode) { + string retval; + const char* flagfile_contents = contentdata.c_str(); + bool flags_are_relevant = true; // set to false when filenames don't match + bool in_filename_section = false; + + const char* line_end = flagfile_contents; + // We read this file a line at a time. + for (; line_end; flagfile_contents = line_end + 1) { + while (*flagfile_contents && isspace(*flagfile_contents)) + ++flagfile_contents; + // Windows uses "\r\n" + line_end = strchr(flagfile_contents, '\r'); + if (line_end == NULL) + line_end = strchr(flagfile_contents, '\n'); + + size_t len = line_end ? line_end - flagfile_contents + : strlen(flagfile_contents); + string line(flagfile_contents, len); + + // Each line can be one of four things: + // 1) A comment line -- we skip it + // 2) An empty line -- we skip it + // 3) A list of filenames -- starts a new filenames+flags section + // 4) A --flag=value line -- apply if previous filenames match + if (line.empty() || line[0] == '#') { + // comment or empty line; just ignore + + } else if (line[0] == '-') { // flag + in_filename_section = false; // instead, it was a flag-line + if (!flags_are_relevant) // skip this flag; applies to someone else + continue; + + const char* name_and_val = line.c_str() + 1; // skip the leading - + if (*name_and_val == '-') + name_and_val++; // skip second - too + string key; + const char* value; + string error_message; + CommandLineFlag* flag = registry_->SplitArgumentLocked(name_and_val, + &key, &value, + &error_message); + // By API, errors parsing flagfile lines are silently ignored. + if (flag == NULL) { + // "WARNING: flagname '" + key + "' not found\n" + } else if (value == NULL) { + // "WARNING: flagname '" + key + "' missing a value\n" + } else { + retval += ProcessSingleOptionLocked(flag, value, set_mode); + } + + } else { // a filename! + if (!in_filename_section) { // start over: assume filenames don't match + in_filename_section = true; + flags_are_relevant = false; + } + + // Split the line up at spaces into glob-patterns + const char* space = line.c_str(); // just has to be non-NULL + for (const char* word = line.c_str(); *space; word = space+1) { + if (flags_are_relevant) // we can stop as soon as we match + break; + space = strchr(word, ' '); + if (space == NULL) + space = word + strlen(word); + const string glob(word, space - word); + // We try matching both against the full argv0 and basename(argv0) + if (glob == ProgramInvocationName() // small optimization + || glob == ProgramInvocationShortName() +#if defined(HAVE_FNMATCH_H) + || fnmatch(glob.c_str(), ProgramInvocationName(), FNM_PATHNAME) == 0 + || fnmatch(glob.c_str(), ProgramInvocationShortName(), FNM_PATHNAME) == 0 +#elif defined(HAVE_SHLWAPI_H) + || PathMatchSpecA(glob.c_str(), ProgramInvocationName()) + || PathMatchSpecA(glob.c_str(), ProgramInvocationShortName()) +#endif + ) { + flags_are_relevant = true; + } + } + } + } + return retval; +} + +// -------------------------------------------------------------------- +// GetFromEnv() +// AddFlagValidator() +// These are helper functions for routines like BoolFromEnv() and +// RegisterFlagValidator, defined below. They're defined here so +// they can live in the unnamed namespace (which makes friendship +// declarations for these classes possible). +// -------------------------------------------------------------------- + +template +T GetFromEnv(const char *varname, T dflt) { + std::string valstr; + if (SafeGetEnv(varname, valstr)) { + FlagValue ifv(new T, true); + if (!ifv.ParseFrom(valstr.c_str())) { + ReportError(DIE, "ERROR: error parsing env variable '%s' with value '%s'\n", + varname, valstr.c_str()); + } + return OTHER_VALUE_AS(ifv, T); + } else return dflt; +} + +bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) { + // We want a lock around this routine, in case two threads try to + // add a validator (hopefully the same one!) at once. We could use + // our own thread, but we need to loook at the registry anyway, so + // we just steal that one. + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + // First, find the flag whose current-flag storage is 'flag'. + // This is the CommandLineFlag whose current_->value_buffer_ == flag + CommandLineFlag* flag = registry->FindFlagViaPtrLocked(flag_ptr); + if (!flag) { + LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag pointer " + << flag_ptr << ": no flag found at that address"; + return false; + } else if (validate_fn_proto == flag->validate_function()) { + return true; // ok to register the same function over and over again + } else if (validate_fn_proto != NULL && flag->validate_function() != NULL) { + LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag '" + << flag->name() << "': validate-fn already registered"; + return false; + } else { + flag->validate_fn_proto_ = validate_fn_proto; + return true; + } +} + +} // end unnamed namespaces + + +// Now define the functions that are exported via the .h file + +// -------------------------------------------------------------------- +// FlagRegisterer +// This class exists merely to have a global constructor (the +// kind that runs before main(), that goes an initializes each +// flag that's been declared. Note that it's very important we +// don't have a destructor that deletes flag_, because that would +// cause us to delete current_storage/defvalue_storage as well, +// which can cause a crash if anything tries to access the flag +// values in a global destructor. +// -------------------------------------------------------------------- + +namespace { +void RegisterCommandLineFlag(const char* name, + const char* help, + const char* filename, + FlagValue* current, + FlagValue* defvalue) { + if (help == NULL) + help = ""; + // Importantly, flag_ will never be deleted, so storage is always good. + CommandLineFlag* flag = + new CommandLineFlag(name, help, filename, current, defvalue); + FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry +} +} + +template +FlagRegisterer::FlagRegisterer(const char* name, + const char* help, + const char* filename, + FlagType* current_storage, + FlagType* defvalue_storage) { + FlagValue* const current = new FlagValue(current_storage, false); + FlagValue* const defvalue = new FlagValue(defvalue_storage, false); + RegisterCommandLineFlag(name, help, filename, current, defvalue); +} + +// Force compiler to generate code for the given template specialization. +#define INSTANTIATE_FLAG_REGISTERER_CTOR(type) \ + template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer( \ + const char* name, const char* help, const char* filename, \ + type* current_storage, type* defvalue_storage) + +// Do this for all supported flag types. +INSTANTIATE_FLAG_REGISTERER_CTOR(bool); +INSTANTIATE_FLAG_REGISTERER_CTOR(int32); +INSTANTIATE_FLAG_REGISTERER_CTOR(uint32); +INSTANTIATE_FLAG_REGISTERER_CTOR(int64); +INSTANTIATE_FLAG_REGISTERER_CTOR(uint64); +INSTANTIATE_FLAG_REGISTERER_CTOR(double); +INSTANTIATE_FLAG_REGISTERER_CTOR(std::string); + +#undef INSTANTIATE_FLAG_REGISTERER_CTOR + +// -------------------------------------------------------------------- +// GetAllFlags() +// The main way the FlagRegistry class exposes its data. This +// returns, as strings, all the info about all the flags in +// the main registry, sorted first by filename they are defined +// in, and then by flagname. +// -------------------------------------------------------------------- + +struct FilenameFlagnameCmp { + bool operator()(const CommandLineFlagInfo& a, + const CommandLineFlagInfo& b) const { + int cmp = strcmp(a.filename.c_str(), b.filename.c_str()); + if (cmp == 0) + cmp = strcmp(a.name.c_str(), b.name.c_str()); // secondary sort key + return cmp < 0; + } +}; + +void GetAllFlags(vector* OUTPUT) { + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + registry->Lock(); + for (FlagRegistry::FlagConstIterator i = registry->flags_.begin(); + i != registry->flags_.end(); ++i) { + CommandLineFlagInfo fi; + i->second->FillCommandLineFlagInfo(&fi); + OUTPUT->push_back(fi); + } + registry->Unlock(); + // Now sort the flags, first by filename they occur in, then alphabetically + sort(OUTPUT->begin(), OUTPUT->end(), FilenameFlagnameCmp()); +} + +// -------------------------------------------------------------------- +// SetArgv() +// GetArgvs() +// GetArgv() +// GetArgv0() +// ProgramInvocationName() +// ProgramInvocationShortName() +// SetUsageMessage() +// ProgramUsage() +// Functions to set and get argv. Typically the setter is called +// by ParseCommandLineFlags. Also can get the ProgramUsage string, +// set by SetUsageMessage. +// -------------------------------------------------------------------- + +// These values are not protected by a Mutex because they are normally +// set only once during program startup. +static string argv0("UNKNOWN"); // just the program name +static string cmdline; // the entire command-line +static string program_usage; +static vector argvs; +static uint32 argv_sum = 0; + +void SetArgv(int argc, const char** argv) { + static bool called_set_argv = false; + if (called_set_argv) return; + called_set_argv = true; + + assert(argc > 0); // every program has at least a name + argv0 = argv[0]; + + cmdline.clear(); + for (int i = 0; i < argc; i++) { + if (i != 0) cmdline += " "; + cmdline += argv[i]; + argvs.push_back(argv[i]); + } + + // Compute a simple sum of all the chars in argv + argv_sum = 0; + for (string::const_iterator c = cmdline.begin(); c != cmdline.end(); ++c) { + argv_sum += *c; + } +} + +const vector& GetArgvs() { return argvs; } +const char* GetArgv() { return cmdline.c_str(); } +const char* GetArgv0() { return argv0.c_str(); } +uint32 GetArgvSum() { return argv_sum; } +const char* ProgramInvocationName() { // like the GNU libc fn + return GetArgv0(); +} +const char* ProgramInvocationShortName() { // like the GNU libc fn + size_t pos = argv0.rfind('/'); +#ifdef OS_WINDOWS + if (pos == string::npos) pos = argv0.rfind('\\'); +#endif + return (pos == string::npos ? argv0.c_str() : (argv0.c_str() + pos + 1)); +} + +void SetUsageMessage(const string& usage) { + program_usage = usage; +} + +const char* ProgramUsage() { + if (program_usage.empty()) { + return "Warning: SetUsageMessage() never called"; + } + return program_usage.c_str(); +} + +// -------------------------------------------------------------------- +// SetVersionString() +// VersionString() +// -------------------------------------------------------------------- + +static string version_string; + +void SetVersionString(const string& version) { + version_string = version; +} + +const char* VersionString() { + return version_string.c_str(); +} + + +// -------------------------------------------------------------------- +// GetCommandLineOption() +// GetCommandLineFlagInfo() +// GetCommandLineFlagInfoOrDie() +// SetCommandLineOption() +// SetCommandLineOptionWithMode() +// The programmatic way to set a flag's value, using a string +// for its name rather than the variable itself (that is, +// SetCommandLineOption("foo", x) rather than FLAGS_foo = x). +// There's also a bit more flexibility here due to the various +// set-modes, but typically these are used when you only have +// that flag's name as a string, perhaps at runtime. +// All of these work on the default, global registry. +// For GetCommandLineOption, return false if no such flag +// is known, true otherwise. We clear "value" if a suitable +// flag is found. +// -------------------------------------------------------------------- + + +bool GetCommandLineOption(const char* name, string* value) { + if (NULL == name) + return false; + assert(value); + + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + CommandLineFlag* flag = registry->FindFlagLocked(name); + if (flag == NULL) { + return false; + } else { + *value = flag->current_value(); + return true; + } +} + +bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT) { + if (NULL == name) return false; + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + CommandLineFlag* flag = registry->FindFlagLocked(name); + if (flag == NULL) { + return false; + } else { + assert(OUTPUT); + flag->FillCommandLineFlagInfo(OUTPUT); + return true; + } +} + +CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name) { + CommandLineFlagInfo info; + if (!GetCommandLineFlagInfo(name, &info)) { + fprintf(stderr, "FATAL ERROR: flag name '%s' doesn't exist\n", name); + gflags_exitfunc(1); // almost certainly gflags_exitfunc() + } + return info; +} + +string SetCommandLineOptionWithMode(const char* name, const char* value, + FlagSettingMode set_mode) { + string result; + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + CommandLineFlag* flag = registry->FindFlagLocked(name); + if (flag) { + CommandLineFlagParser parser(registry); + result = parser.ProcessSingleOptionLocked(flag, value, set_mode); + if (!result.empty()) { // in the error case, we've already logged + // Could consider logging this change + } + } + // The API of this function is that we return empty string on error + return result; +} + +string SetCommandLineOption(const char* name, const char* value) { + return SetCommandLineOptionWithMode(name, value, SET_FLAGS_VALUE); +} + +// -------------------------------------------------------------------- +// FlagSaver +// FlagSaverImpl +// This class stores the states of all flags at construct time, +// and restores all flags to that state at destruct time. +// Its major implementation challenge is that it never modifies +// pointers in the 'main' registry, so global FLAG_* vars always +// point to the right place. +// -------------------------------------------------------------------- + +class FlagSaverImpl { + public: + // Constructs an empty FlagSaverImpl object. + explicit FlagSaverImpl(FlagRegistry* main_registry) + : main_registry_(main_registry) { } + ~FlagSaverImpl() { + // reclaim memory from each of our CommandLineFlags + vector::const_iterator it; + for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) + delete *it; + } + + // Saves the flag states from the flag registry into this object. + // It's an error to call this more than once. + // Must be called when the registry mutex is not held. + void SaveFromRegistry() { + FlagRegistryLock frl(main_registry_); + assert(backup_registry_.empty()); // call only once! + for (FlagRegistry::FlagConstIterator it = main_registry_->flags_.begin(); + it != main_registry_->flags_.end(); + ++it) { + const CommandLineFlag* main = it->second; + // Sets up all the const variables in backup correctly + CommandLineFlag* backup = new CommandLineFlag( + main->name(), main->help(), main->filename(), + main->current_->New(), main->defvalue_->New()); + // Sets up all the non-const variables in backup correctly + backup->CopyFrom(*main); + backup_registry_.push_back(backup); // add it to a convenient list + } + } + + // Restores the saved flag states into the flag registry. We + // assume no flags were added or deleted from the registry since + // the SaveFromRegistry; if they were, that's trouble! Must be + // called when the registry mutex is not held. + void RestoreToRegistry() { + FlagRegistryLock frl(main_registry_); + vector::const_iterator it; + for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) { + CommandLineFlag* main = main_registry_->FindFlagLocked((*it)->name()); + if (main != NULL) { // if NULL, flag got deleted from registry(!) + main->CopyFrom(**it); + } + } + } + + private: + FlagRegistry* const main_registry_; + vector backup_registry_; + + FlagSaverImpl(const FlagSaverImpl&); // no copying! + void operator=(const FlagSaverImpl&); +}; + +FlagSaver::FlagSaver() + : impl_(new FlagSaverImpl(FlagRegistry::GlobalRegistry())) { + impl_->SaveFromRegistry(); +} + +FlagSaver::~FlagSaver() { + impl_->RestoreToRegistry(); + delete impl_; +} + + +// -------------------------------------------------------------------- +// CommandlineFlagsIntoString() +// ReadFlagsFromString() +// AppendFlagsIntoFile() +// ReadFromFlagsFile() +// These are mostly-deprecated routines that stick the +// commandline flags into a file/string and read them back +// out again. I can see a use for CommandlineFlagsIntoString, +// for creating a flagfile, but the rest don't seem that useful +// -- some, I think, are a poor-man's attempt at FlagSaver -- +// and are included only until we can delete them from callers. +// Note they don't save --flagfile flags (though they do save +// the result of having called the flagfile, of course). +// -------------------------------------------------------------------- + +static string TheseCommandlineFlagsIntoString( + const vector& flags) { + vector::const_iterator i; + + size_t retval_space = 0; + for (i = flags.begin(); i != flags.end(); ++i) { + // An (over)estimate of how much space it will take to print this flag + retval_space += i->name.length() + i->current_value.length() + 5; + } + + string retval; + retval.reserve(retval_space); + for (i = flags.begin(); i != flags.end(); ++i) { + retval += "--"; + retval += i->name; + retval += "="; + retval += i->current_value; + retval += "\n"; + } + return retval; +} + +string CommandlineFlagsIntoString() { + vector sorted_flags; + GetAllFlags(&sorted_flags); + return TheseCommandlineFlagsIntoString(sorted_flags); +} + +bool ReadFlagsFromString(const string& flagfilecontents, + const char* /*prog_name*/, // TODO(csilvers): nix this + bool errors_are_fatal) { + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagSaverImpl saved_states(registry); + saved_states.SaveFromRegistry(); + + CommandLineFlagParser parser(registry); + registry->Lock(); + parser.ProcessOptionsFromStringLocked(flagfilecontents, SET_FLAGS_VALUE); + registry->Unlock(); + // Should we handle --help and such when reading flags from a string? Sure. + HandleCommandLineHelpFlags(); + if (parser.ReportErrors()) { + // Error. Restore all global flags to their previous values. + if (errors_are_fatal) + gflags_exitfunc(1); + saved_states.RestoreToRegistry(); + return false; + } + return true; +} + +// TODO(csilvers): nix prog_name in favor of ProgramInvocationShortName() +bool AppendFlagsIntoFile(const string& filename, const char *prog_name) { + FILE *fp; + if (SafeFOpen(&fp, filename.c_str(), "a") != 0) { + return false; + } + + if (prog_name) + fprintf(fp, "%s\n", prog_name); + + vector flags; + GetAllFlags(&flags); + // But we don't want --flagfile, which leads to weird recursion issues + vector::iterator i; + for (i = flags.begin(); i != flags.end(); ++i) { + if (strcmp(i->name.c_str(), "flagfile") == 0) { + flags.erase(i); + break; + } + } + fprintf(fp, "%s", TheseCommandlineFlagsIntoString(flags).c_str()); + + fclose(fp); + return true; +} + +bool ReadFromFlagsFile(const string& filename, const char* prog_name, + bool errors_are_fatal) { + return ReadFlagsFromString(ReadFileIntoString(filename.c_str()), + prog_name, errors_are_fatal); +} + + +// -------------------------------------------------------------------- +// BoolFromEnv() +// Int32FromEnv() +// Uint32FromEnv() +// Int64FromEnv() +// Uint64FromEnv() +// DoubleFromEnv() +// StringFromEnv() +// Reads the value from the environment and returns it. +// We use an FlagValue to make the parsing easy. +// Example usage: +// DEFINE_bool(myflag, BoolFromEnv("MYFLAG_DEFAULT", false), "whatever"); +// -------------------------------------------------------------------- + +bool BoolFromEnv(const char *v, bool dflt) { + return GetFromEnv(v, dflt); +} +int32 Int32FromEnv(const char *v, int32 dflt) { + return GetFromEnv(v, dflt); +} +uint32 Uint32FromEnv(const char *v, uint32 dflt) { + return GetFromEnv(v, dflt); +} +int64 Int64FromEnv(const char *v, int64 dflt) { + return GetFromEnv(v, dflt); +} +uint64 Uint64FromEnv(const char *v, uint64 dflt) { + return GetFromEnv(v, dflt); +} +double DoubleFromEnv(const char *v, double dflt) { + return GetFromEnv(v, dflt); +} + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4996) // ignore getenv security warning +#endif +const char *StringFromEnv(const char *varname, const char *dflt) { + const char* const val = getenv(varname); + return val ? val : dflt; +} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + + +// -------------------------------------------------------------------- +// RegisterFlagValidator() +// RegisterFlagValidator() is the function that clients use to +// 'decorate' a flag with a validation function. Once this is +// done, every time the flag is set (including when the flag +// is parsed from argv), the validator-function is called. +// These functions return true if the validator was added +// successfully, or false if not: the flag already has a validator, +// (only one allowed per flag), the 1st arg isn't a flag, etc. +// This function is not thread-safe. +// -------------------------------------------------------------------- + +bool RegisterFlagValidator(const bool* flag, + bool (*validate_fn)(const char*, bool)) { + return AddFlagValidator(flag, reinterpret_cast(validate_fn)); +} +bool RegisterFlagValidator(const int32* flag, + bool (*validate_fn)(const char*, int32)) { + return AddFlagValidator(flag, reinterpret_cast(validate_fn)); +} +bool RegisterFlagValidator(const uint32* flag, + bool (*validate_fn)(const char*, uint32)) { + return AddFlagValidator(flag, reinterpret_cast(validate_fn)); +} +bool RegisterFlagValidator(const int64* flag, + bool (*validate_fn)(const char*, int64)) { + return AddFlagValidator(flag, reinterpret_cast(validate_fn)); +} +bool RegisterFlagValidator(const uint64* flag, + bool (*validate_fn)(const char*, uint64)) { + return AddFlagValidator(flag, reinterpret_cast(validate_fn)); +} +bool RegisterFlagValidator(const double* flag, + bool (*validate_fn)(const char*, double)) { + return AddFlagValidator(flag, reinterpret_cast(validate_fn)); +} +bool RegisterFlagValidator(const string* flag, + bool (*validate_fn)(const char*, const string&)) { + return AddFlagValidator(flag, reinterpret_cast(validate_fn)); +} + + +// -------------------------------------------------------------------- +// ParseCommandLineFlags() +// ParseCommandLineNonHelpFlags() +// HandleCommandLineHelpFlags() +// This is the main function called from main(), to actually +// parse the commandline. It modifies argc and argv as described +// at the top of gflags.h. You can also divide this +// function into two parts, if you want to do work between +// the parsing of the flags and the printing of any help output. +// -------------------------------------------------------------------- + +static uint32 ParseCommandLineFlagsInternal(int* argc, char*** argv, + bool remove_flags, bool do_report) { + SetArgv(*argc, const_cast(*argv)); // save it for later + + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + CommandLineFlagParser parser(registry); + + // When we parse the commandline flags, we'll handle --flagfile, + // --tryfromenv, etc. as we see them (since flag-evaluation order + // may be important). But sometimes apps set FLAGS_tryfromenv/etc. + // manually before calling ParseCommandLineFlags. We want to evaluate + // those too, as if they were the first flags on the commandline. + registry->Lock(); + parser.ProcessFlagfileLocked(FLAGS_flagfile, SET_FLAGS_VALUE); + // Last arg here indicates whether flag-not-found is a fatal error or not + parser.ProcessFromenvLocked(FLAGS_fromenv, SET_FLAGS_VALUE, true); + parser.ProcessFromenvLocked(FLAGS_tryfromenv, SET_FLAGS_VALUE, false); + registry->Unlock(); + + // Now get the flags specified on the commandline + const int r = parser.ParseNewCommandLineFlags(argc, argv, remove_flags); + + if (do_report) + HandleCommandLineHelpFlags(); // may cause us to exit on --help, etc. + + // See if any of the unset flags fail their validation checks + parser.ValidateUnmodifiedFlags(); + + if (parser.ReportErrors()) // may cause us to exit on illegal flags + gflags_exitfunc(1); + return r; +} + +uint32 ParseCommandLineFlags(int* argc, char*** argv, bool remove_flags) { + return ParseCommandLineFlagsInternal(argc, argv, remove_flags, true); +} + +uint32 ParseCommandLineNonHelpFlags(int* argc, char*** argv, + bool remove_flags) { + return ParseCommandLineFlagsInternal(argc, argv, remove_flags, false); +} + +// -------------------------------------------------------------------- +// AllowCommandLineReparsing() +// ReparseCommandLineNonHelpFlags() +// This is most useful for shared libraries. The idea is if +// a flag is defined in a shared library that is dlopen'ed +// sometime after main(), you can ParseCommandLineFlags before +// the dlopen, then ReparseCommandLineNonHelpFlags() after the +// dlopen, to get the new flags. But you have to explicitly +// Allow() it; otherwise, you get the normal default behavior +// of unrecognized flags calling a fatal error. +// TODO(csilvers): this isn't used. Just delete it? +// -------------------------------------------------------------------- + +void AllowCommandLineReparsing() { + allow_command_line_reparsing = true; +} + +void ReparseCommandLineNonHelpFlags() { + // We make a copy of argc and argv to pass in + const vector& argvs = GetArgvs(); + int tmp_argc = static_cast(argvs.size()); + char** tmp_argv = new char* [tmp_argc + 1]; + for (int i = 0; i < tmp_argc; ++i) + tmp_argv[i] = strdup(argvs[i].c_str()); // TODO(csilvers): don't dup + + ParseCommandLineNonHelpFlags(&tmp_argc, &tmp_argv, false); + + for (int i = 0; i < tmp_argc; ++i) + free(tmp_argv[i]); + delete[] tmp_argv; +} + +void ShutDownCommandLineFlags() { + FlagRegistry::DeleteGlobalRegistry(); +} + + +} // namespace GFLAGS_NAMESPACE diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags.h.in b/runtime/onnxruntime/third_party/gflags/src/gflags.h.in new file mode 100644 index 0000000..7b218b9 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags.h.in @@ -0,0 +1,626 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Revamped and reorganized by Craig Silverstein +// +// This is the file that should be included by any file which declares +// or defines a command line flag or wants to parse command line flags +// or print a program usage message (which will include information about +// flags). Executive summary, in the form of an example foo.cc file: +// +// #include "foo.h" // foo.h has a line "DECLARE_int32(start);" +// #include "validators.h" // hypothetical file defining ValidateIsFile() +// +// DEFINE_int32(end, 1000, "The last record to read"); +// +// DEFINE_string(filename, "my_file.txt", "The file to read"); +// // Crash if the specified file does not exist. +// static bool dummy = RegisterFlagValidator(&FLAGS_filename, +// &ValidateIsFile); +// +// DECLARE_bool(verbose); // some other file has a DEFINE_bool(verbose, ...) +// +// void MyFunc() { +// if (FLAGS_verbose) printf("Records %d-%d\n", FLAGS_start, FLAGS_end); +// } +// +// Then, at the command-line: +// ./foo --noverbose --start=5 --end=100 +// +// For more details, see +// doc/gflags.html +// +// --- A note about thread-safety: +// +// We describe many functions in this routine as being thread-hostile, +// thread-compatible, or thread-safe. Here are the meanings we use: +// +// thread-safe: it is safe for multiple threads to call this routine +// (or, when referring to a class, methods of this class) +// concurrently. +// thread-hostile: it is not safe for multiple threads to call this +// routine (or methods of this class) concurrently. In gflags, +// most thread-hostile routines are intended to be called early in, +// or even before, main() -- that is, before threads are spawned. +// thread-compatible: it is safe for multiple threads to read from +// this variable (when applied to variables), or to call const +// methods of this class (when applied to classes), as long as no +// other thread is writing to the variable or calling non-const +// methods of this class. + +#ifndef GFLAGS_GFLAGS_H_ +#define GFLAGS_GFLAGS_H_ + +#include +#include + +#include "gflags/gflags_declare.h" // IWYU pragma: export + + +// We always want to export variables defined in user code +#ifndef GFLAGS_DLL_DEFINE_FLAG +# if GFLAGS_IS_A_DLL && defined(_MSC_VER) +# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport) +# else +# define GFLAGS_DLL_DEFINE_FLAG +# endif +#endif + + +namespace GFLAGS_NAMESPACE { + + +// -------------------------------------------------------------------- +// To actually define a flag in a file, use DEFINE_bool, +// DEFINE_string, etc. at the bottom of this file. You may also find +// it useful to register a validator with the flag. This ensures that +// when the flag is parsed from the commandline, or is later set via +// SetCommandLineOption, we call the validation function. It is _not_ +// called when you assign the value to the flag directly using the = operator. +// +// The validation function should return true if the flag value is valid, and +// false otherwise. If the function returns false for the new setting of the +// flag, the flag will retain its current value. If it returns false for the +// default value, ParseCommandLineFlags() will die. +// +// This function is safe to call at global construct time (as in the +// example below). +// +// Example use: +// static bool ValidatePort(const char* flagname, int32 value) { +// if (value > 0 && value < 32768) // value is ok +// return true; +// printf("Invalid value for --%s: %d\n", flagname, (int)value); +// return false; +// } +// DEFINE_int32(port, 0, "What port to listen on"); +// static bool dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort); + +// Returns true if successfully registered, false if not (because the +// first argument doesn't point to a command-line flag, or because a +// validator is already registered for this flag). +extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const bool* flag, bool (*validate_fn)(const char*, bool)); +extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int32* flag, bool (*validate_fn)(const char*, int32)); +extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint32* flag, bool (*validate_fn)(const char*, uint32)); +extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int64* flag, bool (*validate_fn)(const char*, int64)); +extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint64* flag, bool (*validate_fn)(const char*, uint64)); +extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const double* flag, bool (*validate_fn)(const char*, double)); +extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool (*validate_fn)(const char*, const std::string&)); + +// Convenience macro for the registration of a flag validator +#define DEFINE_validator(name, validator) \ + static const bool name##_validator_registered = \ + GFLAGS_NAMESPACE::RegisterFlagValidator(&FLAGS_##name, validator) + + +// -------------------------------------------------------------------- +// These methods are the best way to get access to info about the +// list of commandline flags. Note that these routines are pretty slow. +// GetAllFlags: mostly-complete info about the list, sorted by file. +// ShowUsageWithFlags: pretty-prints the list to stdout (what --help does) +// ShowUsageWithFlagsRestrict: limit to filenames with restrict as a substr +// +// In addition to accessing flags, you can also access argv[0] (the program +// name) and argv (the entire commandline), which we sock away a copy of. +// These variables are static, so you should only set them once. +// +// No need to export this data only structure from DLL, avoiding VS warning 4251. +struct CommandLineFlagInfo { + std::string name; // the name of the flag + std::string type; // the type of the flag: int32, etc + std::string description; // the "help text" associated with the flag + std::string current_value; // the current value, as a string + std::string default_value; // the default value, as a string + std::string filename; // 'cleaned' version of filename holding the flag + bool has_validator_fn; // true if RegisterFlagValidator called on this flag + bool is_default; // true if the flag has the default value and + // has not been set explicitly from the cmdline + // or via SetCommandLineOption + const void* flag_ptr; // pointer to the flag's current value (i.e. FLAGS_foo) +}; + +// Using this inside of a validator is a recipe for a deadlock. +// TODO(user) Fix locking when validators are running, to make it safe to +// call validators during ParseAllFlags. +// Also make sure then to uncomment the corresponding unit test in +// gflags_unittest.sh +extern GFLAGS_DLL_DECL void GetAllFlags(std::vector* OUTPUT); +// These two are actually defined in gflags_reporting.cc. +extern GFLAGS_DLL_DECL void ShowUsageWithFlags(const char *argv0); // what --help does +extern GFLAGS_DLL_DECL void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); + +// Create a descriptive string for a flag. +// Goes to some trouble to make pretty line breaks. +extern GFLAGS_DLL_DECL std::string DescribeOneFlag(const CommandLineFlagInfo& flag); + +// Thread-hostile; meant to be called before any threads are spawned. +extern GFLAGS_DLL_DECL void SetArgv(int argc, const char** argv); + +// The following functions are thread-safe as long as SetArgv() is +// only called before any threads start. +extern GFLAGS_DLL_DECL const std::vector& GetArgvs(); +extern GFLAGS_DLL_DECL const char* GetArgv(); // all of argv as a string +extern GFLAGS_DLL_DECL const char* GetArgv0(); // only argv0 +extern GFLAGS_DLL_DECL uint32 GetArgvSum(); // simple checksum of argv +extern GFLAGS_DLL_DECL const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set +extern GFLAGS_DLL_DECL const char* ProgramInvocationShortName(); // basename(argv0) + +// ProgramUsage() is thread-safe as long as SetUsageMessage() is only +// called before any threads start. +extern GFLAGS_DLL_DECL const char* ProgramUsage(); // string set by SetUsageMessage() + +// VersionString() is thread-safe as long as SetVersionString() is only +// called before any threads start. +extern GFLAGS_DLL_DECL const char* VersionString(); // string set by SetVersionString() + + + +// -------------------------------------------------------------------- +// Normally you access commandline flags by just saying "if (FLAGS_foo)" +// or whatever, and set them by calling "FLAGS_foo = bar" (or, more +// commonly, via the DEFINE_foo macro). But if you need a bit more +// control, we have programmatic ways to get/set the flags as well. +// These programmatic ways to access flags are thread-safe, but direct +// access is only thread-compatible. + +// Return true iff the flagname was found. +// OUTPUT is set to the flag's value, or unchanged if we return false. +extern GFLAGS_DLL_DECL bool GetCommandLineOption(const char* name, std::string* OUTPUT); + +// Return true iff the flagname was found. OUTPUT is set to the flag's +// CommandLineFlagInfo or unchanged if we return false. +extern GFLAGS_DLL_DECL bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT); + +// Return the CommandLineFlagInfo of the flagname. exit() if name not found. +// Example usage, to check if a flag's value is currently the default value: +// if (GetCommandLineFlagInfoOrDie("foo").is_default) ... +extern GFLAGS_DLL_DECL CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); + +enum GFLAGS_DLL_DECL FlagSettingMode { + // update the flag's value (can call this multiple times). + SET_FLAGS_VALUE, + // update the flag's value, but *only if* it has not yet been updated + // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef". + SET_FLAG_IF_DEFAULT, + // set the flag's default value to this. If the flag has not yet updated + // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef") + // change the flag's current value to the new default value as well. + SET_FLAGS_DEFAULT +}; + +// Set a particular flag ("command line option"). Returns a string +// describing the new value that the option has been set to. The +// return value API is not well-specified, so basically just depend on +// it to be empty if the setting failed for some reason -- the name is +// not a valid flag name, or the value is not a valid value -- and +// non-empty else. + +// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) +extern GFLAGS_DLL_DECL std::string SetCommandLineOption (const char* name, const char* value); +extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name, const char* value, FlagSettingMode set_mode); + + +// -------------------------------------------------------------------- +// Saves the states (value, default value, whether the user has set +// the flag, registered validators, etc) of all flags, and restores +// them when the FlagSaver is destroyed. This is very useful in +// tests, say, when you want to let your tests change the flags, but +// make sure that they get reverted to the original states when your +// test is complete. +// +// Example usage: +// void TestFoo() { +// FlagSaver s1; +// FLAG_foo = false; +// FLAG_bar = "some value"; +// +// // test happens here. You can return at any time +// // without worrying about restoring the FLAG values. +// } +// +// Note: This class is marked with GFLAGS_ATTRIBUTE_UNUSED because all +// the work is done in the constructor and destructor, so in the standard +// usage example above, the compiler would complain that it's an +// unused variable. +// +// This class is thread-safe. However, its destructor writes to +// exactly the set of flags that have changed value during its +// lifetime, so concurrent _direct_ access to those flags +// (i.e. FLAGS_foo instead of {Get,Set}CommandLineOption()) is unsafe. + +class GFLAGS_DLL_DECL FlagSaver { + public: + FlagSaver(); + ~FlagSaver(); + + private: + class FlagSaverImpl* impl_; // we use pimpl here to keep API steady + + FlagSaver(const FlagSaver&); // no copying! + void operator=(const FlagSaver&); +}@GFLAGS_ATTRIBUTE_UNUSED@; + +// -------------------------------------------------------------------- +// Some deprecated or hopefully-soon-to-be-deprecated functions. + +// This is often used for logging. TODO(csilvers): figure out a better way +extern GFLAGS_DLL_DECL std::string CommandlineFlagsIntoString(); +// Usually where this is used, a FlagSaver should be used instead. +extern GFLAGS_DLL_DECL +bool ReadFlagsFromString(const std::string& flagfilecontents, + const char* prog_name, + bool errors_are_fatal); // uses SET_FLAGS_VALUE + +// These let you manually implement --flagfile functionality. +// DEPRECATED. +extern GFLAGS_DLL_DECL bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); +extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, bool errors_are_fatal); // uses SET_FLAGS_VALUE + + +// -------------------------------------------------------------------- +// Useful routines for initializing flags from the environment. +// In each case, if 'varname' does not exist in the environment +// return defval. If 'varname' does exist but is not valid +// (e.g., not a number for an int32 flag), abort with an error. +// Otherwise, return the value. NOTE: for booleans, for true use +// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'. + +extern GFLAGS_DLL_DECL bool BoolFromEnv(const char *varname, bool defval); +extern GFLAGS_DLL_DECL int32 Int32FromEnv(const char *varname, int32 defval); +extern GFLAGS_DLL_DECL uint32 Uint32FromEnv(const char *varname, uint32 defval); +extern GFLAGS_DLL_DECL int64 Int64FromEnv(const char *varname, int64 defval); +extern GFLAGS_DLL_DECL uint64 Uint64FromEnv(const char *varname, uint64 defval); +extern GFLAGS_DLL_DECL double DoubleFromEnv(const char *varname, double defval); +extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char *defval); + + +// -------------------------------------------------------------------- +// The next two functions parse gflags from main(): + +// Set the "usage" message for this program. For example: +// string usage("This program does nothing. Sample usage:\n"); +// usage += argv[0] + " "; +// SetUsageMessage(usage); +// Do not include commandline flags in the usage: we do that for you! +// Thread-hostile; meant to be called before any threads are spawned. +extern GFLAGS_DLL_DECL void SetUsageMessage(const std::string& usage); + +// Sets the version string, which is emitted with --version. +// For instance: SetVersionString("1.3"); +// Thread-hostile; meant to be called before any threads are spawned. +extern GFLAGS_DLL_DECL void SetVersionString(const std::string& version); + + +// Looks for flags in argv and parses them. Rearranges argv to put +// flags first, or removes them entirely if remove_flags is true. +// If a flag is defined more than once in the command line or flag +// file, the last definition is used. Returns the index (into argv) +// of the first non-flag argument. +// See top-of-file for more details on this function. +#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. +extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags); +#endif + + +// Calls to ParseCommandLineNonHelpFlags and then to +// HandleCommandLineHelpFlags can be used instead of a call to +// ParseCommandLineFlags during initialization, in order to allow for +// changing default values for some FLAGS (via +// e.g. SetCommandLineOptionWithMode calls) between the time of +// command line parsing and the time of dumping help information for +// the flags as a result of command line parsing. If a flag is +// defined more than once in the command line or flag file, the last +// definition is used. Returns the index (into argv) of the first +// non-flag argument. (If remove_flags is true, will always return 1.) +extern GFLAGS_DLL_DECL uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, bool remove_flags); + +// This is actually defined in gflags_reporting.cc. +// This function is misnamed (it also handles --version, etc.), but +// it's too late to change that now. :-( +extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in gflags_reporting.cc + +// Allow command line reparsing. Disables the error normally +// generated when an unknown flag is found, since it may be found in a +// later parse. Thread-hostile; meant to be called before any threads +// are spawned. +extern GFLAGS_DLL_DECL void AllowCommandLineReparsing(); + +// Reparse the flags that have not yet been recognized. Only flags +// registered since the last parse will be recognized. Any flag value +// must be provided as part of the argument using "=", not as a +// separate command line argument that follows the flag argument. +// Intended for handling flags from dynamically loaded libraries, +// since their flags are not registered until they are loaded. +extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags(); + +// Clean up memory allocated by flags. This is only needed to reduce +// the quantity of "potentially leaked" reports emitted by memory +// debugging tools such as valgrind. It is not required for normal +// operation, or for the google perftools heap-checker. It must only +// be called when the process is about to exit, and all threads that +// might access flags are quiescent. Referencing flags after this is +// called will have unexpected consequences. This is not safe to run +// when multiple threads might be running: the function is +// thread-hostile. +extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags(); + + +// -------------------------------------------------------------------- +// Now come the command line flag declaration/definition macros that +// will actually be used. They're kind of hairy. A major reason +// for this is initialization: we want people to be able to access +// variables in global constructors and have that not crash, even if +// their global constructor runs before the global constructor here. +// (Obviously, we can't guarantee the flags will have the correct +// default value in that case, but at least accessing them is safe.) +// The only way to do that is have flags point to a static buffer. +// So we make one, using a union to ensure proper alignment, and +// then use placement-new to actually set up the flag with the +// correct default value. In the same vein, we have to worry about +// flag access in global destructors, so FlagRegisterer has to be +// careful never to destroy the flag-values it constructs. +// +// Note that when we define a flag variable FLAGS_, we also +// preemptively define a junk variable, FLAGS_no. This is to +// cause a link-time error if someone tries to define 2 flags with +// names like "logging" and "nologging". We do this because a bool +// flag FLAG can be set from the command line to true with a "-FLAG" +// argument, and to false with a "-noFLAG" argument, and so this can +// potentially avert confusion. +// +// We also put flags into their own namespace. It is purposefully +// named in an opaque way that people should have trouble typing +// directly. The idea is that DEFINE puts the flag in the weird +// namespace, and DECLARE imports the flag from there into the current +// namespace. The net result is to force people to use DECLARE to get +// access to a flag, rather than saying "extern GFLAGS_DLL_DECL bool FLAGS_whatever;" +// or some such instead. We want this so we can put extra +// functionality (like sanity-checking) in DECLARE if we want, and +// make sure it is picked up everywhere. +// +// We also put the type of the variable in the namespace, so that +// people can't DECLARE_int32 something that they DEFINE_bool'd +// elsewhere. + +class GFLAGS_DLL_DECL FlagRegisterer { + public: + // We instantiate this template ctor for all supported types, + // so it is possible to place implementation of the FlagRegisterer ctor in + // .cc file. + // Calling this constructor with unsupported type will produce linker error. + template + FlagRegisterer(const char* name, + const char* help, const char* filename, + FlagType* current_storage, FlagType* defvalue_storage); +}; + +// Force compiler to not generate code for the given template specialization. +#if defined(_MSC_VER) && _MSC_VER < 1800 // Visual Studio 2013 version 12.0 + #define GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(type) +#else + #define GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(type) \ + extern template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer( \ + const char* name, const char* help, const char* filename, \ + type* current_storage, type* defvalue_storage) +#endif + +// Do this for all supported flag types. +GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(bool); +GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(int32); +GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(uint32); +GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(int64); +GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(uint64); +GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(double); +GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(std::string); + +#undef GFLAGS_DECLARE_FLAG_REGISTERER_CTOR + +// If your application #defines STRIP_FLAG_HELP to a non-zero value +// before #including this file, we remove the help message from the +// binary file. This can reduce the size of the resulting binary +// somewhat, and may also be useful for security reasons. + +extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[]; + + +} // namespace GFLAGS_NAMESPACE + + +#ifndef SWIG // In swig, ignore the main flag declarations + +#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 +// Need this construct to avoid the 'defined but not used' warning. +#define MAYBE_STRIPPED_HELP(txt) \ + (false ? (txt) : GFLAGS_NAMESPACE::kStrippedFlagHelp) +#else +#define MAYBE_STRIPPED_HELP(txt) txt +#endif + +// Each command-line flag has two variables associated with it: one +// with the current value, and one with the default value. However, +// we have a third variable, which is where value is assigned; it's a +// constant. This guarantees that FLAG_##value is initialized at +// static initialization time (e.g. before program-start) rather than +// than global construction time (which is after program-start but +// before main), at least when 'value' is a compile-time constant. We +// use a small trick for the "default value" variable, and call it +// FLAGS_no. This serves the second purpose of assuring a +// compile error if someone tries to define a flag named no +// which is illegal (--foo and --nofoo both affect the "foo" flag). +#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ + namespace fL##shorttype { \ + static const type FLAGS_nono##name = value; \ + /* We always want to export defined variables, dll or no */ \ + GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \ + static type FLAGS_no##name = FLAGS_nono##name; \ + static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \ + #name, MAYBE_STRIPPED_HELP(help), __FILE__, \ + &FLAGS_##name, &FLAGS_no##name); \ + } \ + using fL##shorttype::FLAGS_##name + +// For DEFINE_bool, we want to do the extra check that the passed-in +// value is actually a bool, and not a string or something that can be +// coerced to a bool. These declarations (no definition needed!) will +// help us do that, and never evaluate From, which is important. +// We'll use 'sizeof(IsBool(val))' to distinguish. This code requires +// that the compiler have different sizes for bool & double. Since +// this is not guaranteed by the standard, we check it with a +// COMPILE_ASSERT. +namespace fLB { +struct CompileAssert {}; +typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[ + (sizeof(double) != sizeof(bool)) ? 1 : -1]; +template double GFLAGS_DLL_DECL IsBoolFlag(const From& from); +GFLAGS_DLL_DECL bool IsBoolFlag(bool from); +} // namespace fLB + +// Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros +// are in a separate include, gflags_declare.h, for reducing +// the physical transitive size for DECLARE use. +#define DEFINE_bool(name, val, txt) \ + namespace fLB { \ + typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \ + (sizeof(::fLB::IsBoolFlag(val)) != sizeof(double))? 1: -1]; \ + } \ + DEFINE_VARIABLE(bool, B, name, val, txt) + +#define DEFINE_int32(name, val, txt) \ + DEFINE_VARIABLE(GFLAGS_NAMESPACE::int32, I, \ + name, val, txt) + +#define DEFINE_uint32(name,val, txt) \ + DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint32, U, \ + name, val, txt) + +#define DEFINE_int64(name, val, txt) \ + DEFINE_VARIABLE(GFLAGS_NAMESPACE::int64, I64, \ + name, val, txt) + +#define DEFINE_uint64(name,val, txt) \ + DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint64, U64, \ + name, val, txt) + +#define DEFINE_double(name, val, txt) \ + DEFINE_VARIABLE(double, D, name, val, txt) + +// Strings are trickier, because they're not a POD, so we can't +// construct them at static-initialization time (instead they get +// constructed at global-constructor time, which is much later). To +// try to avoid crashes in that case, we use a char buffer to store +// the string, which we can static-initialize, and then placement-new +// into it later. It's not perfect, but the best we can do. + +namespace fLS { + +inline clstring* dont_pass0toDEFINE_string(char *stringspot, + const char *value) { + return new(stringspot) clstring(value); +} +inline clstring* dont_pass0toDEFINE_string(char *stringspot, + const clstring &value) { + return new(stringspot) clstring(value); +} +inline clstring* dont_pass0toDEFINE_string(char *stringspot, + int value); + +// Auxiliary class used to explicitly call destructor of string objects +// allocated using placement new during static program deinitialization. +// The destructor MUST be an inline function such that the explicit +// destruction occurs in the same compilation unit as the placement new. +class StringFlagDestructor { + void *current_storage_; + void *defvalue_storage_; + +public: + + StringFlagDestructor(void *current, void *defvalue) + : current_storage_(current), defvalue_storage_(defvalue) {} + + ~StringFlagDestructor() { + reinterpret_cast(current_storage_ )->~clstring(); + reinterpret_cast(defvalue_storage_)->~clstring(); + } +}; + +} // namespace fLS + +// We need to define a var named FLAGS_no##name so people don't define +// --string and --nostring. And we need a temporary place to put val +// so we don't have to evaluate it twice. Two great needs that go +// great together! +// The weird 'using' + 'extern' inside the fLS namespace is to work around +// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See +// http://code.google.com/p/google-gflags/issues/detail?id=20 +#define DEFINE_string(name, val, txt) \ + namespace fLS { \ + using ::fLS::clstring; \ + using ::fLS::StringFlagDestructor; \ + static union { void* align; char s[sizeof(clstring)]; } s_##name[2]; \ + clstring* const FLAGS_no##name = ::fLS:: \ + dont_pass0toDEFINE_string(s_##name[0].s, \ + val); \ + static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \ + #name, MAYBE_STRIPPED_HELP(txt), __FILE__, \ + FLAGS_no##name, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ + static StringFlagDestructor d_##name(s_##name[0].s, s_##name[1].s); \ + extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \ + using fLS::FLAGS_##name; \ + clstring& FLAGS_##name = *FLAGS_no##name; \ + } \ + using fLS::FLAGS_##name + +#endif // SWIG + + +@INCLUDE_GFLAGS_NS_H@ + + +#endif // GFLAGS_GFLAGS_H_ diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags_completions.cc b/runtime/onnxruntime/third_party/gflags/src/gflags_completions.cc new file mode 100644 index 0000000..c53a128 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags_completions.cc @@ -0,0 +1,772 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- + +// Bash-style command line flag completion for C++ binaries +// +// This module implements bash-style completions. It achieves this +// goal in the following broad chunks: +// +// 1) Take a to-be-completed word, and examine it for search hints +// 2) Identify all potentially matching flags +// 2a) If there are no matching flags, do nothing. +// 2b) If all matching flags share a common prefix longer than the +// completion word, output just that matching prefix +// 3) Categorize those flags to produce a rough ordering of relevence. +// 4) Potentially trim the set of flags returned to a smaller number +// that bash is happier with +// 5) Output the matching flags in groups ordered by relevence. +// 5a) Force bash to place most-relevent groups at the top of the list +// 5b) Trim most flag's descriptions to fit on a single terminal line + +#include +#include +#include // for strlen + +#include +#include +#include +#include + +#include "config.h" +#include "gflags/gflags.h" +#include "gflags/gflags_completions.h" +#include "util.h" + +using std::set; +using std::string; +using std::vector; + + +DEFINE_string(tab_completion_word, "", + "If non-empty, HandleCommandLineCompletions() will hijack the " + "process and attempt to do bash-style command line flag " + "completion on this value."); +DEFINE_int32(tab_completion_columns, 80, + "Number of columns to use in output for tab completion"); + + +namespace GFLAGS_NAMESPACE { + + +namespace { +// Function prototypes and Type forward declarations. Code may be +// more easily understood if it is roughly ordered according to +// control flow, rather than by C's "declare before use" ordering +struct CompletionOptions; +struct NotableFlags; + +// The entry point if flag completion is to be used. +static void PrintFlagCompletionInfo(void); + + +// 1) Examine search word +static void CanonicalizeCursorWordAndSearchOptions( + const string &cursor_word, + string *canonical_search_token, + CompletionOptions *options); + +static bool RemoveTrailingChar(string *str, char c); + + +// 2) Find all matches +static void FindMatchingFlags( + const vector &all_flags, + const CompletionOptions &options, + const string &match_token, + set *all_matches, + string *longest_common_prefix); + +static bool DoesSingleFlagMatch( + const CommandLineFlagInfo &flag, + const CompletionOptions &options, + const string &match_token); + + +// 3) Categorize matches +static void CategorizeAllMatchingFlags( + const set &all_matches, + const string &search_token, + const string &module, + const string &package_dir, + NotableFlags *notable_flags); + +static void TryFindModuleAndPackageDir( + const vector &all_flags, + string *module, + string *package_dir); + + +// 4) Decide which flags to use +static void FinalizeCompletionOutput( + const set &matching_flags, + CompletionOptions *options, + NotableFlags *notable_flags, + vector *completions); + +static void RetrieveUnusedFlags( + const set &matching_flags, + const NotableFlags ¬able_flags, + set *unused_flags); + + +// 5) Output matches +static void OutputSingleGroupWithLimit( + const set &group, + const string &line_indentation, + const string &header, + const string &footer, + bool long_output_format, + int *remaining_line_limit, + size_t *completion_elements_added, + vector *completions); + +// (helpers for #5) +static string GetShortFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info); + +static string GetLongFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info); + + +// +// Useful types + +// Try to deduce the intentions behind this completion attempt. Return the +// canonical search term in 'canonical_search_token'. Binary search options +// are returned in the various booleans, which should all have intuitive +// semantics, possibly except: +// - return_all_matching_flags: Generally, we'll trim the number of +// returned candidates to some small number, showing those that are +// most likely to be useful first. If this is set, however, the user +// really does want us to return every single flag as an option. +// - force_no_update: Any time we output lines, all of which share a +// common prefix, bash will 'helpfully' not even bother to show the +// output, instead changing the current word to be that common prefix. +// If it's clear this shouldn't happen, we'll set this boolean +struct CompletionOptions { + bool flag_name_substring_search; + bool flag_location_substring_search; + bool flag_description_substring_search; + bool return_all_matching_flags; + bool force_no_update; + CompletionOptions(): flag_name_substring_search(false), + flag_location_substring_search(false), + flag_description_substring_search(false), + return_all_matching_flags(false), + force_no_update(false) { } +}; + +// Notable flags are flags that are special or preferred for some +// reason. For example, flags that are defined in the binary's module +// are expected to be much more relevent than flags defined in some +// other random location. These sets are specified roughly in precedence +// order. Once a flag is placed in one of these 'higher' sets, it won't +// be placed in any of the 'lower' sets. +struct NotableFlags { + typedef set FlagSet; + FlagSet perfect_match_flag; + FlagSet module_flags; // Found in module file + FlagSet package_flags; // Found in same directory as module file + FlagSet most_common_flags; // One of the XXX most commonly supplied flags + FlagSet subpackage_flags; // Found in subdirectories of package +}; + + +// +// Tab completion implementation - entry point +static void PrintFlagCompletionInfo(void) { + string cursor_word = FLAGS_tab_completion_word; + string canonical_token; + CompletionOptions options = CompletionOptions(); + CanonicalizeCursorWordAndSearchOptions( + cursor_word, + &canonical_token, + &options); + + DVLOG(1) << "Identified canonical_token: '" << canonical_token << "'"; + + vector all_flags; + set matching_flags; + GetAllFlags(&all_flags); + DVLOG(2) << "Found " << all_flags.size() << " flags overall"; + + string longest_common_prefix; + FindMatchingFlags( + all_flags, + options, + canonical_token, + &matching_flags, + &longest_common_prefix); + DVLOG(1) << "Identified " << matching_flags.size() << " matching flags"; + DVLOG(1) << "Identified " << longest_common_prefix + << " as longest common prefix."; + if (longest_common_prefix.size() > canonical_token.size()) { + // There's actually a shared common prefix to all matching flags, + // so may as well output that and quit quickly. + DVLOG(1) << "The common prefix '" << longest_common_prefix + << "' was longer than the token '" << canonical_token + << "'. Returning just this prefix for completion."; + fprintf(stdout, "--%s", longest_common_prefix.c_str()); + return; + } + if (matching_flags.empty()) { + VLOG(1) << "There were no matching flags, returning nothing."; + return; + } + + string module; + string package_dir; + TryFindModuleAndPackageDir(all_flags, &module, &package_dir); + DVLOG(1) << "Identified module: '" << module << "'"; + DVLOG(1) << "Identified package_dir: '" << package_dir << "'"; + + NotableFlags notable_flags; + CategorizeAllMatchingFlags( + matching_flags, + canonical_token, + module, + package_dir, + ¬able_flags); + DVLOG(2) << "Categorized matching flags:"; + DVLOG(2) << " perfect_match: " << notable_flags.perfect_match_flag.size(); + DVLOG(2) << " module: " << notable_flags.module_flags.size(); + DVLOG(2) << " package: " << notable_flags.package_flags.size(); + DVLOG(2) << " most common: " << notable_flags.most_common_flags.size(); + DVLOG(2) << " subpackage: " << notable_flags.subpackage_flags.size(); + + vector completions; + FinalizeCompletionOutput( + matching_flags, + &options, + ¬able_flags, + &completions); + + if (options.force_no_update) + completions.push_back("~"); + + DVLOG(1) << "Finalized with " << completions.size() + << " chosen completions"; + + for (vector::const_iterator it = completions.begin(); + it != completions.end(); + ++it) { + DVLOG(9) << " Completion entry: '" << *it << "'"; + fprintf(stdout, "%s\n", it->c_str()); + } +} + + +// 1) Examine search word (and helper method) +static void CanonicalizeCursorWordAndSearchOptions( + const string &cursor_word, + string *canonical_search_token, + CompletionOptions *options) { + *canonical_search_token = cursor_word; + if (canonical_search_token->empty()) return; + + // Get rid of leading quotes and dashes in the search term + if ((*canonical_search_token)[0] == '"') + *canonical_search_token = canonical_search_token->substr(1); + while ((*canonical_search_token)[0] == '-') + *canonical_search_token = canonical_search_token->substr(1); + + options->flag_name_substring_search = false; + options->flag_location_substring_search = false; + options->flag_description_substring_search = false; + options->return_all_matching_flags = false; + options->force_no_update = false; + + // Look for all search options we can deduce now. Do this by walking + // backwards through the term, looking for up to three '?' and up to + // one '+' as suffixed characters. Consume them if found, and remove + // them from the canonical search token. + int found_question_marks = 0; + int found_plusses = 0; + while (true) { + if (found_question_marks < 3 && + RemoveTrailingChar(canonical_search_token, '?')) { + ++found_question_marks; + continue; + } + if (found_plusses < 1 && + RemoveTrailingChar(canonical_search_token, '+')) { + ++found_plusses; + continue; + } + break; + } + + switch (found_question_marks) { // all fallthroughs + case 3: options->flag_description_substring_search = true; + case 2: options->flag_location_substring_search = true; + case 1: options->flag_name_substring_search = true; + }; + + options->return_all_matching_flags = (found_plusses > 0); +} + +// Returns true if a char was removed +static bool RemoveTrailingChar(string *str, char c) { + if (str->empty()) return false; + if ((*str)[str->size() - 1] == c) { + *str = str->substr(0, str->size() - 1); + return true; + } + return false; +} + + +// 2) Find all matches (and helper methods) +static void FindMatchingFlags( + const vector &all_flags, + const CompletionOptions &options, + const string &match_token, + set *all_matches, + string *longest_common_prefix) { + all_matches->clear(); + bool first_match = true; + for (vector::const_iterator it = all_flags.begin(); + it != all_flags.end(); + ++it) { + if (DoesSingleFlagMatch(*it, options, match_token)) { + all_matches->insert(&*it); + if (first_match) { + first_match = false; + *longest_common_prefix = it->name; + } else { + if (longest_common_prefix->empty() || it->name.empty()) { + longest_common_prefix->clear(); + continue; + } + string::size_type pos = 0; + while (pos < longest_common_prefix->size() && + pos < it->name.size() && + (*longest_common_prefix)[pos] == it->name[pos]) + ++pos; + longest_common_prefix->erase(pos); + } + } + } +} + +// Given the set of all flags, the parsed match options, and the +// canonical search token, produce the set of all candidate matching +// flags for subsequent analysis or filtering. +static bool DoesSingleFlagMatch( + const CommandLineFlagInfo &flag, + const CompletionOptions &options, + const string &match_token) { + // Is there a prefix match? + string::size_type pos = flag.name.find(match_token); + if (pos == 0) return true; + + // Is there a substring match if we want it? + if (options.flag_name_substring_search && + pos != string::npos) + return true; + + // Is there a location match if we want it? + if (options.flag_location_substring_search && + flag.filename.find(match_token) != string::npos) + return true; + + // TODO(user): All searches should probably be case-insensitive + // (especially this one...) + if (options.flag_description_substring_search && + flag.description.find(match_token) != string::npos) + return true; + + return false; +} + +// 3) Categorize matches (and helper method) + +// Given a set of matching flags, categorize them by +// likely relevence to this specific binary +static void CategorizeAllMatchingFlags( + const set &all_matches, + const string &search_token, + const string &module, // empty if we couldn't find any + const string &package_dir, // empty if we couldn't find any + NotableFlags *notable_flags) { + notable_flags->perfect_match_flag.clear(); + notable_flags->module_flags.clear(); + notable_flags->package_flags.clear(); + notable_flags->most_common_flags.clear(); + notable_flags->subpackage_flags.clear(); + + for (set::const_iterator it = + all_matches.begin(); + it != all_matches.end(); + ++it) { + DVLOG(2) << "Examining match '" << (*it)->name << "'"; + DVLOG(7) << " filename: '" << (*it)->filename << "'"; + string::size_type pos = string::npos; + if (!package_dir.empty()) + pos = (*it)->filename.find(package_dir); + string::size_type slash = string::npos; + if (pos != string::npos) // candidate for package or subpackage match + slash = (*it)->filename.find( + PATH_SEPARATOR, + pos + package_dir.size() + 1); + + if ((*it)->name == search_token) { + // Exact match on some flag's name + notable_flags->perfect_match_flag.insert(*it); + DVLOG(3) << "Result: perfect match"; + } else if (!module.empty() && (*it)->filename == module) { + // Exact match on module filename + notable_flags->module_flags.insert(*it); + DVLOG(3) << "Result: module match"; + } else if (!package_dir.empty() && + pos != string::npos && slash == string::npos) { + // In the package, since there was no slash after the package portion + notable_flags->package_flags.insert(*it); + DVLOG(3) << "Result: package match"; + } else if (false) { + // In the list of the XXX most commonly supplied flags overall + // TODO(user): Compile this list. + DVLOG(3) << "Result: most-common match"; + } else if (!package_dir.empty() && + pos != string::npos && slash != string::npos) { + // In a subdirectory of the package + notable_flags->subpackage_flags.insert(*it); + DVLOG(3) << "Result: subpackage match"; + } + + DVLOG(3) << "Result: not special match"; + } +} + +static void PushNameWithSuffix(vector* suffixes, const char* suffix) { + suffixes->push_back( + StringPrintf("/%s%s", ProgramInvocationShortName(), suffix)); +} + +static void TryFindModuleAndPackageDir( + const vector &all_flags, + string *module, + string *package_dir) { + module->clear(); + package_dir->clear(); + + vector suffixes; + // TODO(user): There's some inherant ambiguity here - multiple directories + // could share the same trailing folder and file structure (and even worse, + // same file names), causing us to be unsure as to which of the two is the + // actual package for this binary. In this case, we'll arbitrarily choose. + PushNameWithSuffix(&suffixes, "."); + PushNameWithSuffix(&suffixes, "-main."); + PushNameWithSuffix(&suffixes, "_main."); + // These four are new but probably merited? + PushNameWithSuffix(&suffixes, "-test."); + PushNameWithSuffix(&suffixes, "_test."); + PushNameWithSuffix(&suffixes, "-unittest."); + PushNameWithSuffix(&suffixes, "_unittest."); + + for (vector::const_iterator it = all_flags.begin(); + it != all_flags.end(); + ++it) { + for (vector::const_iterator suffix = suffixes.begin(); + suffix != suffixes.end(); + ++suffix) { + // TODO(user): Make sure the match is near the end of the string + if (it->filename.find(*suffix) != string::npos) { + *module = it->filename; + string::size_type sep = it->filename.rfind(PATH_SEPARATOR); + *package_dir = it->filename.substr(0, (sep == string::npos) ? 0 : sep); + return; + } + } + } +} + +// Can't specialize template type on a locally defined type. Silly C++... +struct DisplayInfoGroup { + const char* header; + const char* footer; + set *group; + + int SizeInLines() const { + int size_in_lines = static_cast(group->size()) + 1; + if (strlen(header) > 0) { + size_in_lines++; + } + if (strlen(footer) > 0) { + size_in_lines++; + } + return size_in_lines; + } +}; + +// 4) Finalize and trim output flag set +static void FinalizeCompletionOutput( + const set &matching_flags, + CompletionOptions *options, + NotableFlags *notable_flags, + vector *completions) { + + // We want to output lines in groups. Each group needs to be indented + // the same to keep its lines together. Unless otherwise required, + // only 99 lines should be output to prevent bash from harassing the + // user. + + // First, figure out which output groups we'll actually use. For each + // nonempty group, there will be ~3 lines of header & footer, plus all + // output lines themselves. + int max_desired_lines = // "999999 flags should be enough for anyone. -dave" + (options->return_all_matching_flags ? 999999 : 98); + int lines_so_far = 0; + + vector output_groups; + bool perfect_match_found = false; + if (!notable_flags->perfect_match_flag.empty()) { + perfect_match_found = true; + DisplayInfoGroup group = + { "", + "==========", + ¬able_flags->perfect_match_flag }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->module_flags.empty()) { + DisplayInfoGroup group = { + "-* Matching module flags *-", + "===========================", + ¬able_flags->module_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->package_flags.empty()) { + DisplayInfoGroup group = { + "-* Matching package flags *-", + "============================", + ¬able_flags->package_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->most_common_flags.empty()) { + DisplayInfoGroup group = { + "-* Commonly used flags *-", + "=========================", + ¬able_flags->most_common_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->subpackage_flags.empty()) { + DisplayInfoGroup group = { + "-* Matching sub-package flags *-", + "================================", + ¬able_flags->subpackage_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + + set obscure_flags; // flags not notable + if (lines_so_far < max_desired_lines) { + RetrieveUnusedFlags(matching_flags, *notable_flags, &obscure_flags); + if (!obscure_flags.empty()) { + DisplayInfoGroup group = { + "-* Other flags *-", + "", + &obscure_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + } + + // Second, go through each of the chosen output groups and output + // as many of those flags as we can, while remaining below our limit + int remaining_lines = max_desired_lines; + size_t completions_output = 0; + int indent = static_cast(output_groups.size()) - 1; + for (vector::const_iterator it = + output_groups.begin(); + it != output_groups.end(); + ++it, --indent) { + OutputSingleGroupWithLimit( + *it->group, // group + string(indent, ' '), // line indentation + string(it->header), // header + string(it->footer), // footer + perfect_match_found, // long format + &remaining_lines, // line limit - reduces this by number printed + &completions_output, // completions (not lines) added + completions); // produced completions + perfect_match_found = false; + } + + if (completions_output != matching_flags.size()) { + options->force_no_update = false; + completions->push_back("~ (Remaining flags hidden) ~"); + } else { + options->force_no_update = true; + } +} + +static void RetrieveUnusedFlags( + const set &matching_flags, + const NotableFlags ¬able_flags, + set *unused_flags) { + // Remove from 'matching_flags' set all members of the sets of + // flags we've already printed (specifically, those in notable_flags) + for (set::const_iterator it = + matching_flags.begin(); + it != matching_flags.end(); + ++it) { + if (notable_flags.perfect_match_flag.count(*it) || + notable_flags.module_flags.count(*it) || + notable_flags.package_flags.count(*it) || + notable_flags.most_common_flags.count(*it) || + notable_flags.subpackage_flags.count(*it)) + continue; + unused_flags->insert(*it); + } +} + +// 5) Output matches (and helper methods) + +static void OutputSingleGroupWithLimit( + const set &group, + const string &line_indentation, + const string &header, + const string &footer, + bool long_output_format, + int *remaining_line_limit, + size_t *completion_elements_output, + vector *completions) { + if (group.empty()) return; + if (!header.empty()) { + if (*remaining_line_limit < 2) return; + *remaining_line_limit -= 2; + completions->push_back(line_indentation + header); + completions->push_back(line_indentation + string(header.size(), '-')); + } + for (set::const_iterator it = group.begin(); + it != group.end() && *remaining_line_limit > 0; + ++it) { + --*remaining_line_limit; + ++*completion_elements_output; + completions->push_back( + (long_output_format + ? GetLongFlagLine(line_indentation, **it) + : GetShortFlagLine(line_indentation, **it))); + } + if (!footer.empty()) { + if (*remaining_line_limit < 1) return; + --*remaining_line_limit; + completions->push_back(line_indentation + footer); + } +} + +static string GetShortFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info) { + string prefix; + bool is_string = (info.type == "string"); + SStringPrintf(&prefix, "%s--%s [%s%s%s] ", + line_indentation.c_str(), + info.name.c_str(), + (is_string ? "'" : ""), + info.default_value.c_str(), + (is_string ? "'" : "")); + int remainder = + FLAGS_tab_completion_columns - static_cast(prefix.size()); + string suffix; + if (remainder > 0) + suffix = + (static_cast(info.description.size()) > remainder ? + (info.description.substr(0, remainder - 3) + "...").c_str() : + info.description.c_str()); + return prefix + suffix; +} + +static string GetLongFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info) { + + string output = DescribeOneFlag(info); + + // Replace '-' with '--', and remove trailing newline before appending + // the module definition location. + string old_flagname = "-" + info.name; + output.replace( + output.find(old_flagname), + old_flagname.size(), + "-" + old_flagname); + // Stick a newline and indentation in front of the type and default + // portions of DescribeOneFlag()s description + static const char kNewlineWithIndent[] = "\n "; + output.replace(output.find(" type:"), 1, string(kNewlineWithIndent)); + output.replace(output.find(" default:"), 1, string(kNewlineWithIndent)); + output = StringPrintf("%s Details for '--%s':\n" + "%s defined: %s", + line_indentation.c_str(), + info.name.c_str(), + output.c_str(), + info.filename.c_str()); + + // Eliminate any doubled newlines that crept in. Specifically, if + // DescribeOneFlag() decided to break the line just before "type" + // or "default", we don't want to introduce an extra blank line + static const string line_of_spaces(FLAGS_tab_completion_columns, ' '); + static const char kDoubledNewlines[] = "\n \n"; + for (string::size_type newlines = output.find(kDoubledNewlines); + newlines != string::npos; + newlines = output.find(kDoubledNewlines)) + // Replace each 'doubled newline' with a single newline + output.replace(newlines, sizeof(kDoubledNewlines) - 1, string("\n")); + + for (string::size_type newline = output.find('\n'); + newline != string::npos; + newline = output.find('\n')) { + int newline_pos = static_cast(newline) % FLAGS_tab_completion_columns; + int missing_spaces = FLAGS_tab_completion_columns - newline_pos; + output.replace(newline, 1, line_of_spaces, 1, missing_spaces); + } + return output; +} +} // anonymous + +void HandleCommandLineCompletions(void) { + if (FLAGS_tab_completion_word.empty()) return; + PrintFlagCompletionInfo(); + gflags_exitfunc(0); +} + + +} // namespace GFLAGS_NAMESPACE diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags_completions.h.in b/runtime/onnxruntime/third_party/gflags/src/gflags_completions.h.in new file mode 100644 index 0000000..b27e5fd --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags_completions.h.in @@ -0,0 +1,121 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- + +// +// Implement helpful bash-style command line flag completions +// +// ** Functional API: +// HandleCommandLineCompletions() should be called early during +// program startup, but after command line flag code has been +// initialized, such as the beginning of HandleCommandLineHelpFlags(). +// It checks the value of the flag --tab_completion_word. If this +// flag is empty, nothing happens here. If it contains a string, +// however, then HandleCommandLineCompletions() will hijack the +// process, attempting to identify the intention behind this +// completion. Regardless of the outcome of this deduction, the +// process will be terminated, similar to --helpshort flag +// handling. +// +// ** Overview of Bash completions: +// Bash can be told to programatically determine completions for the +// current 'cursor word'. It does this by (in this case) invoking a +// command with some additional arguments identifying the command +// being executed, the word being completed, and the previous word +// (if any). Bash then expects a sequence of output lines to be +// printed to stdout. If these lines all contain a common prefix +// longer than the cursor word, bash will replace the cursor word +// with that common prefix, and display nothing. If there isn't such +// a common prefix, bash will display the lines in pages using 'more'. +// +// ** Strategy taken for command line completions: +// If we can deduce either the exact flag intended, or a common flag +// prefix, we'll output exactly that. Otherwise, if information +// must be displayed to the user, we'll take the opportunity to add +// some helpful information beyond just the flag name (specifically, +// we'll include the default flag value and as much of the flag's +// description as can fit on a single terminal line width, as specified +// by the flag --tab_completion_columns). Furthermore, we'll try to +// make bash order the output such that the most useful or relevent +// flags are the most likely to be shown at the top. +// +// ** Additional features: +// To assist in finding that one really useful flag, substring matching +// was implemented. Before pressing a to get completion for the +// current word, you can append one or more '?' to the flag to do +// substring matching. Here's the semantics: +// --foo Show me all flags with names prefixed by 'foo' +// --foo? Show me all flags with 'foo' somewhere in the name +// --foo?? Same as prior case, but also search in module +// definition path for 'foo' +// --foo??? Same as prior case, but also search in flag +// descriptions for 'foo' +// Finally, we'll trim the output to a relatively small number of +// flags to keep bash quiet about the verbosity of output. If one +// really wanted to see all possible matches, appending a '+' to the +// search word will force the exhaustive list of matches to be printed. +// +// ** How to have bash accept completions from a binary: +// Bash requires that it be informed about each command that programmatic +// completion should be enabled for. Example addition to a .bashrc +// file would be (your path to gflags_completions.sh file may differ): + +/* +$ complete -o bashdefault -o default -o nospace -C \ + '/home/build/eng/bash/bash_completions.sh --tab_completion_columns $COLUMNS' \ + time env binary_name another_binary [...] +*/ + +// This would allow the following to work: +// $ /path/to/binary_name --vmodule +// Or: +// $ ./bin/path/another_binary --gfs_u +// (etc) +// +// Sadly, it appears that bash gives no easy way to force this behavior for +// all commands. That's where the "time" in the above example comes in. +// If you haven't specifically added a command to the list of completion +// supported commands, you can still get completions by prefixing the +// entire command with "env". +// $ env /some/brand/new/binary --vmod +// Assuming that "binary" is a newly compiled binary, this should still +// produce the expected completion output. + + +#ifndef GFLAGS_COMPLETIONS_H_ +#define GFLAGS_COMPLETIONS_H_ + +namespace @GFLAGS_NAMESPACE@ { + +extern void HandleCommandLineCompletions(void); + +} + +#endif // GFLAGS_COMPLETIONS_H_ diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags_completions.sh b/runtime/onnxruntime/third_party/gflags/src/gflags_completions.sh new file mode 100644 index 0000000..c5fb7e6 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags_completions.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +# Copyright (c) 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# --- +# Author: Dave Nicponski +# +# This script is invoked by bash in response to a matching compspec. When +# this happens, bash calls this script using the command shown in the -C +# block of the complete entry, but also appends 3 arguments. They are: +# - The command being used for completion +# - The word being completed +# - The word preceding the completion word. +# +# Here's an example of how you might use this script: +# $ complete -o bashdefault -o default -o nospace -C \ +# '/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ +# time env binary_name another_binary [...] + +# completion_word_index gets the index of the (N-1)th argument for +# this command line. completion_word gets the actual argument from +# this command line at the (N-1)th position +completion_word_index="$(($# - 1))" +completion_word="${!completion_word_index}" + +# TODO(user): Replace this once gflags_completions.cc has +# a bool parameter indicating unambiguously to hijack the process for +# completion purposes. +if [ -z "$completion_word" ]; then + # Until an empty value for the completion word stops being misunderstood + # by binaries, don't actually execute the binary or the process + # won't be hijacked! + exit 0 +fi + +# binary_index gets the index of the command being completed (which bash +# places in the (N-2)nd position. binary gets the actual command from +# this command line at that (N-2)nd position +binary_index="$(($# - 2))" +binary="${!binary_index}" + +# For completions to be universal, we may have setup the compspec to +# trigger on 'harmless pass-through' commands, like 'time' or 'env'. +# If the command being completed is one of those two, we'll need to +# identify the actual command being executed. To do this, we need +# the actual command line that the was pressed on. Bash helpfully +# places this in the $COMP_LINE variable. +if [ "$binary" == "time" ] || [ "$binary" == "env" ]; then + # we'll assume that the first 'argument' is actually the + # binary + + + # TODO(user): This is not perfect - the 'env' command, for instance, + # is allowed to have options between the 'env' and 'the command to + # be executed'. For example, consider: + # $ env FOO="bar" bin/do_something --help + # In this case, we'll mistake the FOO="bar" portion as the binary. + # Perhaps we should continuing consuming leading words until we + # either run out of words, or find a word that is a valid file + # marked as executable. I can't think of any reason this wouldn't + # work. + + # Break up the 'original command line' (not this script's command line, + # rather the one the was pressed on) and find the second word. + parts=( ${COMP_LINE} ) + binary=${parts[1]} +fi + +# Build the command line to use for completion. Basically it involves +# passing through all the arguments given to this script (except the 3 +# that bash added), and appending a '--tab_completion_word "WORD"' to +# the arguments. +params="" +for ((i=1; i<=$(($# - 3)); ++i)); do + params="$params \"${!i}\""; +done +params="$params --tab_completion_word \"$completion_word\"" + +# TODO(user): Perhaps stash the output in a temporary file somewhere +# in /tmp, and only cat it to stdout if the command returned a success +# code, to prevent false positives + +# If we think we have a reasonable command to execute, then execute it +# and hope for the best. +candidate=$(type -p "$binary") +if [ ! -z "$candidate" ]; then + eval "$candidate 2>/dev/null $params" +elif [ -f "$binary" ] && [ -x "$binary" ]; then + eval "$binary 2>/dev/null $params" +fi diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags_declare.h.in b/runtime/onnxruntime/third_party/gflags/src/gflags_declare.h.in new file mode 100644 index 0000000..ab7bd24 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags_declare.h.in @@ -0,0 +1,156 @@ +// Copyright (c) 1999, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// Revamped and reorganized by Craig Silverstein +// +// This is the file that should be included by any file which declares +// command line flag. + +#ifndef GFLAGS_DECLARE_H_ +#define GFLAGS_DECLARE_H_ + + +// --------------------------------------------------------------------------- +// Namespace of gflags library symbols. +#define GFLAGS_NAMESPACE @GFLAGS_NAMESPACE@ + +// --------------------------------------------------------------------------- +// Windows DLL import/export. + +// Whether gflags library is a DLL. +// +// Set to 1 by default when the shared gflags library was built on Windows. +// Must be overwritten when this header file is used with the optionally also +// built static library instead; set by CMake's INTERFACE_COMPILE_DEFINITIONS. +#ifndef GFLAGS_IS_A_DLL +# define GFLAGS_IS_A_DLL @GFLAGS_IS_A_DLL@ +#endif + +// We always want to import the symbols of the gflags library. +#ifndef GFLAGS_DLL_DECL +# if GFLAGS_IS_A_DLL && defined(_MSC_VER) +# define GFLAGS_DLL_DECL __declspec(dllimport) +# elif defined(__GNUC__) && __GNUC__ >= 4 +# define GFLAGS_DLL_DECL __attribute__((visibility("default"))) +# else +# define GFLAGS_DLL_DECL +# endif +#endif + +// We always want to import variables declared in user code. +#ifndef GFLAGS_DLL_DECLARE_FLAG +# if GFLAGS_IS_A_DLL && defined(_MSC_VER) +# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport) +# elif defined(__GNUC__) && __GNUC__ >= 4 +# define GFLAGS_DLL_DECLARE_FLAG __attribute__((visibility("default"))) +# else +# define GFLAGS_DLL_DECLARE_FLAG +# endif +#endif + +// --------------------------------------------------------------------------- +// Flag types +#include +#if @HAVE_STDINT_H@ +# include // the normal place uint32_t is defined +#elif @HAVE_SYS_TYPES_H@ +# include // the normal place u_int32_t is defined +#elif @HAVE_INTTYPES_H@ +# include // a third place for uint32_t or u_int32_t +#endif + +namespace GFLAGS_NAMESPACE { + +#if @GFLAGS_INTTYPES_FORMAT_C99@ // C99 +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; +#elif @GFLAGS_INTTYPES_FORMAT_BSD@ // BSD +typedef int32_t int32; +typedef u_int32_t uint32; +typedef int64_t int64; +typedef u_int64_t uint64; +#elif @GFLAGS_INTTYPES_FORMAT_VC7@ // Windows +typedef __int32 int32; +typedef unsigned __int32 uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; +#else +# error Do not know how to define a 32-bit integer quantity on your system +#endif + +} // namespace GFLAGS_NAMESPACE + + +namespace fLS { + +// The meaning of "string" might be different between now and when the +// macros below get invoked (e.g., if someone is experimenting with +// other string implementations that get defined after this file is +// included). Save the current meaning now and use it in the macros. +typedef std::string clstring; + +} // namespace fLS + + +#define DECLARE_VARIABLE(type, shorttype, name) \ + /* We always want to import declared variables, dll or no */ \ + namespace fL##shorttype { extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; } \ + using fL##shorttype::FLAGS_##name + +#define DECLARE_bool(name) \ + DECLARE_VARIABLE(bool, B, name) + +#define DECLARE_int32(name) \ + DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int32, I, name) + +#define DECLARE_uint32(name) \ + DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint32, U, name) + +#define DECLARE_int64(name) \ + DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int64, I64, name) + +#define DECLARE_uint64(name) \ + DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint64, U64, name) + +#define DECLARE_double(name) \ + DECLARE_VARIABLE(double, D, name) + +#define DECLARE_string(name) \ + /* We always want to import declared variables, dll or no */ \ + namespace fLS { \ + extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \ + } \ + using fLS::FLAGS_##name + + +#endif // GFLAGS_DECLARE_H_ diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags_ns.h.in b/runtime/onnxruntime/third_party/gflags/src/gflags_ns.h.in new file mode 100644 index 0000000..ef6ac29 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags_ns.h.in @@ -0,0 +1,102 @@ +// Copyright (c) 2014, Andreas Schuh +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// ----------------------------------------------------------------------------- +// Imports the gflags library symbols into an alternative/deprecated namespace. + +#ifndef GFLAGS_GFLAGS_H_ +# error The internal header gflags_@ns@.h may only be included by gflags.h +#endif + +#ifndef GFLAGS_NS_@NS@_H_ +#define GFLAGS_NS_@NS@_H_ + + +namespace @ns@ { + + +using GFLAGS_NAMESPACE::int32; +using GFLAGS_NAMESPACE::uint32; +using GFLAGS_NAMESPACE::int64; +using GFLAGS_NAMESPACE::uint64; + +using GFLAGS_NAMESPACE::RegisterFlagValidator; +using GFLAGS_NAMESPACE::CommandLineFlagInfo; +using GFLAGS_NAMESPACE::GetAllFlags; +using GFLAGS_NAMESPACE::ShowUsageWithFlags; +using GFLAGS_NAMESPACE::ShowUsageWithFlagsRestrict; +using GFLAGS_NAMESPACE::DescribeOneFlag; +using GFLAGS_NAMESPACE::SetArgv; +using GFLAGS_NAMESPACE::GetArgvs; +using GFLAGS_NAMESPACE::GetArgv; +using GFLAGS_NAMESPACE::GetArgv0; +using GFLAGS_NAMESPACE::GetArgvSum; +using GFLAGS_NAMESPACE::ProgramInvocationName; +using GFLAGS_NAMESPACE::ProgramInvocationShortName; +using GFLAGS_NAMESPACE::ProgramUsage; +using GFLAGS_NAMESPACE::VersionString; +using GFLAGS_NAMESPACE::GetCommandLineOption; +using GFLAGS_NAMESPACE::GetCommandLineFlagInfo; +using GFLAGS_NAMESPACE::GetCommandLineFlagInfoOrDie; +using GFLAGS_NAMESPACE::FlagSettingMode; +using GFLAGS_NAMESPACE::SET_FLAGS_VALUE; +using GFLAGS_NAMESPACE::SET_FLAG_IF_DEFAULT; +using GFLAGS_NAMESPACE::SET_FLAGS_DEFAULT; +using GFLAGS_NAMESPACE::SetCommandLineOption; +using GFLAGS_NAMESPACE::SetCommandLineOptionWithMode; +using GFLAGS_NAMESPACE::FlagSaver; +using GFLAGS_NAMESPACE::CommandlineFlagsIntoString; +using GFLAGS_NAMESPACE::ReadFlagsFromString; +using GFLAGS_NAMESPACE::AppendFlagsIntoFile; +using GFLAGS_NAMESPACE::ReadFromFlagsFile; +using GFLAGS_NAMESPACE::BoolFromEnv; +using GFLAGS_NAMESPACE::Int32FromEnv; +using GFLAGS_NAMESPACE::Uint32FromEnv; +using GFLAGS_NAMESPACE::Int64FromEnv; +using GFLAGS_NAMESPACE::Uint64FromEnv; +using GFLAGS_NAMESPACE::DoubleFromEnv; +using GFLAGS_NAMESPACE::StringFromEnv; +using GFLAGS_NAMESPACE::SetUsageMessage; +using GFLAGS_NAMESPACE::SetVersionString; +using GFLAGS_NAMESPACE::ParseCommandLineNonHelpFlags; +using GFLAGS_NAMESPACE::HandleCommandLineHelpFlags; +using GFLAGS_NAMESPACE::AllowCommandLineReparsing; +using GFLAGS_NAMESPACE::ReparseCommandLineNonHelpFlags; +using GFLAGS_NAMESPACE::ShutDownCommandLineFlags; +using GFLAGS_NAMESPACE::FlagRegisterer; + +#ifndef SWIG +using GFLAGS_NAMESPACE::ParseCommandLineFlags; +#endif + + +} // namespace @ns@ + + +#endif // GFLAGS_NS_@NS@_H_ diff --git a/runtime/onnxruntime/third_party/gflags/src/gflags_reporting.cc b/runtime/onnxruntime/third_party/gflags/src/gflags_reporting.cc new file mode 100644 index 0000000..29be922 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/gflags_reporting.cc @@ -0,0 +1,442 @@ +// Copyright (c) 1999, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// Revamped and reorganized by Craig Silverstein +// +// This file contains code for handling the 'reporting' flags. These +// are flags that, when present, cause the program to report some +// information and then exit. --help and --version are the canonical +// reporting flags, but we also have flags like --helpxml, etc. +// +// There's only one function that's meant to be called externally: +// HandleCommandLineHelpFlags(). (Well, actually, ShowUsageWithFlags(), +// ShowUsageWithFlagsRestrict(), and DescribeOneFlag() can be called +// externally too, but there's little need for it.) These are all +// declared in the main gflags.h header file. +// +// HandleCommandLineHelpFlags() will check what 'reporting' flags have +// been defined, if any -- the "help" part of the function name is a +// bit misleading -- and do the relevant reporting. It should be +// called after all flag-values have been assigned, that is, after +// parsing the command-line. + +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "gflags/gflags.h" +#include "gflags/gflags_completions.h" +#include "util.h" + + +// The 'reporting' flags. They all call gflags_exitfunc(). +DEFINE_bool (help, false, "show help on all flags [tip: all flags can have two dashes]"); +DEFINE_bool (helpfull, false, "show help on all flags -- same as -help"); +DEFINE_bool (helpshort, false, "show help on only the main module for this program"); +DEFINE_string(helpon, "", "show help on the modules named by this flag value"); +DEFINE_string(helpmatch, "", "show help on modules whose name contains the specified substr"); +DEFINE_bool (helppackage, false, "show help on all modules in the main package"); +DEFINE_bool (helpxml, false, "produce an xml version of help"); +DEFINE_bool (version, false, "show version and build info and exit"); + + +namespace GFLAGS_NAMESPACE { + + +using std::string; +using std::vector; + + +// -------------------------------------------------------------------- +// DescribeOneFlag() +// DescribeOneFlagInXML() +// Routines that pretty-print info about a flag. These use +// a CommandLineFlagInfo, which is the way the gflags +// API exposes static info about a flag. +// -------------------------------------------------------------------- + +static const int kLineLength = 80; + +static void AddString(const string& s, + string* final_string, int* chars_in_line) { + const int slen = static_cast(s.length()); + if (*chars_in_line + 1 + slen >= kLineLength) { // < 80 chars/line + *final_string += "\n "; + *chars_in_line = 6; + } else { + *final_string += " "; + *chars_in_line += 1; + } + *final_string += s; + *chars_in_line += slen; +} + +static string PrintStringFlagsWithQuotes(const CommandLineFlagInfo& flag, + const string& text, bool current) { + const char* c_string = (current ? flag.current_value.c_str() : + flag.default_value.c_str()); + if (strcmp(flag.type.c_str(), "string") == 0) { // add quotes for strings + return StringPrintf("%s: \"%s\"", text.c_str(), c_string); + } else { + return StringPrintf("%s: %s", text.c_str(), c_string); + } +} + +// Create a descriptive string for a flag. +// Goes to some trouble to make pretty line breaks. +string DescribeOneFlag(const CommandLineFlagInfo& flag) { + string main_part; + SStringPrintf(&main_part, " -%s (%s)", + flag.name.c_str(), + flag.description.c_str()); + const char* c_string = main_part.c_str(); + int chars_left = static_cast(main_part.length()); + string final_string = ""; + int chars_in_line = 0; // how many chars in current line so far? + while (1) { + assert(static_cast(chars_left) + == strlen(c_string)); // Unless there's a \0 in there? + const char* newline = strchr(c_string, '\n'); + if (newline == NULL && chars_in_line+chars_left < kLineLength) { + // The whole remainder of the string fits on this line + final_string += c_string; + chars_in_line += chars_left; + break; + } + if (newline != NULL && newline - c_string < kLineLength - chars_in_line) { + int n = static_cast(newline - c_string); + final_string.append(c_string, n); + chars_left -= n + 1; + c_string += n + 1; + } else { + // Find the last whitespace on this 80-char line + int whitespace = kLineLength-chars_in_line-1; // < 80 chars/line + while ( whitespace > 0 && !isspace(c_string[whitespace]) ) { + --whitespace; + } + if (whitespace <= 0) { + // Couldn't find any whitespace to make a line break. Just dump the + // rest out! + final_string += c_string; + chars_in_line = kLineLength; // next part gets its own line for sure! + break; + } + final_string += string(c_string, whitespace); + chars_in_line += whitespace; + while (isspace(c_string[whitespace])) ++whitespace; + c_string += whitespace; + chars_left -= whitespace; + } + if (*c_string == '\0') + break; + StringAppendF(&final_string, "\n "); + chars_in_line = 6; + } + + // Append data type + AddString(string("type: ") + flag.type, &final_string, &chars_in_line); + // The listed default value will be the actual default from the flag + // definition in the originating source file, unless the value has + // subsequently been modified using SetCommandLineOptionWithMode() with mode + // SET_FLAGS_DEFAULT, or by setting FLAGS_foo = bar before ParseCommandLineFlags(). + AddString(PrintStringFlagsWithQuotes(flag, "default", false), &final_string, + &chars_in_line); + if (!flag.is_default) { + AddString(PrintStringFlagsWithQuotes(flag, "currently", true), + &final_string, &chars_in_line); + } + + StringAppendF(&final_string, "\n"); + return final_string; +} + +// Simple routine to xml-escape a string: escape & and < only. +static string XMLText(const string& txt) { + string ans = txt; + for (string::size_type pos = 0; (pos = ans.find("&", pos)) != string::npos; ) + ans.replace(pos++, 1, "&"); + for (string::size_type pos = 0; (pos = ans.find("<", pos)) != string::npos; ) + ans.replace(pos++, 1, "<"); + return ans; +} + +static void AddXMLTag(string* r, const char* tag, const string& txt) { + StringAppendF(r, "<%s>%s", tag, XMLText(txt).c_str(), tag); +} + + +static string DescribeOneFlagInXML(const CommandLineFlagInfo& flag) { + // The file and flagname could have been attributes, but default + // and meaning need to avoid attribute normalization. This way it + // can be parsed by simple programs, in addition to xml parsers. + string r(""); + AddXMLTag(&r, "file", flag.filename); + AddXMLTag(&r, "name", flag.name); + AddXMLTag(&r, "meaning", flag.description); + AddXMLTag(&r, "default", flag.default_value); + AddXMLTag(&r, "current", flag.current_value); + AddXMLTag(&r, "type", flag.type); + r += ""; + return r; +} + +// -------------------------------------------------------------------- +// ShowUsageWithFlags() +// ShowUsageWithFlagsRestrict() +// ShowXMLOfFlags() +// These routines variously expose the registry's list of flag +// values. ShowUsage*() prints the flag-value information +// to stdout in a user-readable format (that's what --help uses). +// The Restrict() version limits what flags are shown. +// ShowXMLOfFlags() prints the flag-value information to stdout +// in a machine-readable format. In all cases, the flags are +// sorted: first by filename they are defined in, then by flagname. +// -------------------------------------------------------------------- + +static const char* Basename(const char* filename) { + const char* sep = strrchr(filename, PATH_SEPARATOR); + return sep ? sep + 1 : filename; +} + +static string Dirname(const string& filename) { + string::size_type sep = filename.rfind(PATH_SEPARATOR); + return filename.substr(0, (sep == string::npos) ? 0 : sep); +} + +// Test whether a filename contains at least one of the substrings. +static bool FileMatchesSubstring(const string& filename, + const vector& substrings) { + for (vector::const_iterator target = substrings.begin(); + target != substrings.end(); + ++target) { + if (strstr(filename.c_str(), target->c_str()) != NULL) + return true; + // If the substring starts with a '/', that means that we want + // the string to be at the beginning of a directory component. + // That should match the first directory component as well, so + // we allow '/foo' to match a filename of 'foo'. + if (!target->empty() && (*target)[0] == PATH_SEPARATOR && + strncmp(filename.c_str(), target->c_str() + 1, + strlen(target->c_str() + 1)) == 0) + return true; + } + return false; +} + +// Show help for every filename which matches any of the target substrings. +// If substrings is empty, shows help for every file. If a flag's help message +// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' +// before including gflags/gflags.h), then this flag will not be displayed +// by '--help' and its variants. +static void ShowUsageWithFlagsMatching(const char *argv0, + const vector &substrings) { + fprintf(stdout, "%s: %s\n", Basename(argv0), ProgramUsage()); + + vector flags; + GetAllFlags(&flags); // flags are sorted by filename, then flagname + + string last_filename; // so we know when we're at a new file + bool first_directory = true; // controls blank lines between dirs + bool found_match = false; // stays false iff no dir matches restrict + for (vector::const_iterator flag = flags.begin(); + flag != flags.end(); + ++flag) { + if (substrings.empty() || + FileMatchesSubstring(flag->filename, substrings)) { + // If the flag has been stripped, pretend that it doesn't exist. + if (flag->description == kStrippedFlagHelp) continue; + found_match = true; // this flag passed the match! + if (flag->filename != last_filename) { // new file + if (Dirname(flag->filename) != Dirname(last_filename)) { // new dir! + if (!first_directory) + fprintf(stdout, "\n\n"); // put blank lines between directories + first_directory = false; + } + fprintf(stdout, "\n Flags from %s:\n", flag->filename.c_str()); + last_filename = flag->filename; + } + // Now print this flag + fprintf(stdout, "%s", DescribeOneFlag(*flag).c_str()); + } + } + if (!found_match && !substrings.empty()) { + fprintf(stdout, "\n No modules matched: use -help\n"); + } +} + +void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict_) { + vector substrings; + if (restrict_ != NULL && *restrict_ != '\0') { + substrings.push_back(restrict_); + } + ShowUsageWithFlagsMatching(argv0, substrings); +} + +void ShowUsageWithFlags(const char *argv0) { + ShowUsageWithFlagsRestrict(argv0, ""); +} + +// Convert the help, program, and usage to xml. +static void ShowXMLOfFlags(const char *prog_name) { + vector flags; + GetAllFlags(&flags); // flags are sorted: by filename, then flagname + + // XML. There is no corresponding schema yet + fprintf(stdout, "\n"); + // The document + fprintf(stdout, "\n"); + // the program name and usage + fprintf(stdout, "%s\n", + XMLText(Basename(prog_name)).c_str()); + fprintf(stdout, "%s\n", + XMLText(ProgramUsage()).c_str()); + // All the flags + for (vector::const_iterator flag = flags.begin(); + flag != flags.end(); + ++flag) { + if (flag->description != kStrippedFlagHelp) + fprintf(stdout, "%s\n", DescribeOneFlagInXML(*flag).c_str()); + } + // The end of the document + fprintf(stdout, "\n"); +} + +// -------------------------------------------------------------------- +// ShowVersion() +// Called upon --version. Prints build-related info. +// -------------------------------------------------------------------- + +static void ShowVersion() { + const char* version_string = VersionString(); + if (version_string && *version_string) { + fprintf(stdout, "%s version %s\n", + ProgramInvocationShortName(), version_string); + } else { + fprintf(stdout, "%s\n", ProgramInvocationShortName()); + } +# if !defined(NDEBUG) + fprintf(stdout, "Debug build (NDEBUG not #defined)\n"); +# endif +} + +static void AppendPrognameStrings(vector* substrings, + const char* progname) { + string r(""); + r += PATH_SEPARATOR; + r += progname; + substrings->push_back(r + "."); + substrings->push_back(r + "-main."); + substrings->push_back(r + "_main."); +} + +// -------------------------------------------------------------------- +// HandleCommandLineHelpFlags() +// Checks all the 'reporting' commandline flags to see if any +// have been set. If so, handles them appropriately. Note +// that all of them, by definition, cause the program to exit +// if they trigger. +// -------------------------------------------------------------------- + +void HandleCommandLineHelpFlags() { + const char* progname = ProgramInvocationShortName(); + + HandleCommandLineCompletions(); + + vector substrings; + AppendPrognameStrings(&substrings, progname); + + if (FLAGS_helpshort) { + // show only flags related to this binary: + // E.g. for fileutil.cc, want flags containing ... "/fileutil." cc + ShowUsageWithFlagsMatching(progname, substrings); + gflags_exitfunc(1); + + } else if (FLAGS_help || FLAGS_helpfull) { + // show all options + ShowUsageWithFlagsRestrict(progname, ""); // empty restrict + gflags_exitfunc(1); + + } else if (!FLAGS_helpon.empty()) { + string restrict_ = PATH_SEPARATOR + FLAGS_helpon + "."; + ShowUsageWithFlagsRestrict(progname, restrict_.c_str()); + gflags_exitfunc(1); + + } else if (!FLAGS_helpmatch.empty()) { + ShowUsageWithFlagsRestrict(progname, FLAGS_helpmatch.c_str()); + gflags_exitfunc(1); + + } else if (FLAGS_helppackage) { + // Shows help for all files in the same directory as main(). We + // don't want to resort to looking at dirname(progname), because + // the user can pick progname, and it may not relate to the file + // where main() resides. So instead, we search the flags for a + // filename like "/progname.cc", and take the dirname of that. + vector flags; + GetAllFlags(&flags); + string last_package; + for (vector::const_iterator flag = flags.begin(); + flag != flags.end(); + ++flag) { + if (!FileMatchesSubstring(flag->filename, substrings)) + continue; + const string package = Dirname(flag->filename) + PATH_SEPARATOR; + if (package != last_package) { + ShowUsageWithFlagsRestrict(progname, package.c_str()); + VLOG(7) << "Found package: " << package; + if (!last_package.empty()) { // means this isn't our first pkg + LOG(WARNING) << "Multiple packages contain a file=" << progname; + } + last_package = package; + } + } + if (last_package.empty()) { // never found a package to print + LOG(WARNING) << "Unable to find a package for file=" << progname; + } + gflags_exitfunc(1); + + } else if (FLAGS_helpxml) { + ShowXMLOfFlags(progname); + gflags_exitfunc(1); + + } else if (FLAGS_version) { + ShowVersion(); + // Unlike help, we may be asking for version in a script, so return 0 + gflags_exitfunc(0); + + } +} + + +} // namespace GFLAGS_NAMESPACE diff --git a/runtime/onnxruntime/third_party/gflags/src/mutex.h b/runtime/onnxruntime/third_party/gflags/src/mutex.h new file mode 100644 index 0000000..7d7c364 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/mutex.h @@ -0,0 +1,348 @@ +// Copyright (c) 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// +// A simple mutex wrapper, supporting locks and read-write locks. +// You should assume the locks are *not* re-entrant. +// +// This class is meant to be internal-only and should be wrapped by an +// internal namespace. Before you use this module, please give the +// name of your internal namespace for this module. Or, if you want +// to expose it, you'll want to move it to the Google namespace. We +// cannot put this class in global namespace because there can be some +// problems when we have multiple versions of Mutex in each shared object. +// +// NOTE: by default, we have #ifdef'ed out the TryLock() method. +// This is for two reasons: +// 1) TryLock() under Windows is a bit annoying (it requires a +// #define to be defined very early). +// 2) TryLock() is broken for NO_THREADS mode, at least in NDEBUG +// mode. +// If you need TryLock(), and either these two caveats are not a +// problem for you, or you're willing to work around them, then +// feel free to #define GMUTEX_TRYLOCK, or to remove the #ifdefs +// in the code below. +// +// CYGWIN NOTE: Cygwin support for rwlock seems to be buggy: +// http://www.cygwin.com/ml/cygwin/2008-12/msg00017.html +// Because of that, we might as well use windows locks for +// cygwin. They seem to be more reliable than the cygwin pthreads layer. +// +// TRICKY IMPLEMENTATION NOTE: +// This class is designed to be safe to use during +// dynamic-initialization -- that is, by global constructors that are +// run before main() starts. The issue in this case is that +// dynamic-initialization happens in an unpredictable order, and it +// could be that someone else's dynamic initializer could call a +// function that tries to acquire this mutex -- but that all happens +// before this mutex's constructor has run. (This can happen even if +// the mutex and the function that uses the mutex are in the same .cc +// file.) Basically, because Mutex does non-trivial work in its +// constructor, it's not, in the naive implementation, safe to use +// before dynamic initialization has run on it. +// +// The solution used here is to pair the actual mutex primitive with a +// bool that is set to true when the mutex is dynamically initialized. +// (Before that it's false.) Then we modify all mutex routines to +// look at the bool, and not try to lock/unlock until the bool makes +// it to true (which happens after the Mutex constructor has run.) +// +// This works because before main() starts -- particularly, during +// dynamic initialization -- there are no threads, so a) it's ok that +// the mutex operations are a no-op, since we don't need locking then +// anyway; and b) we can be quite confident our bool won't change +// state between a call to Lock() and a call to Unlock() (that would +// require a global constructor in one translation unit to call Lock() +// and another global constructor in another translation unit to call +// Unlock() later, which is pretty perverse). +// +// That said, it's tricky, and can conceivably fail; it's safest to +// avoid trying to acquire a mutex in a global constructor, if you +// can. One way it can fail is that a really smart compiler might +// initialize the bool to true at static-initialization time (too +// early) rather than at dynamic-initialization time. To discourage +// that, we set is_safe_ to true in code (not the constructor +// colon-initializer) and set it to true via a function that always +// evaluates to true, but that the compiler can't know always +// evaluates to true. This should be good enough. +// +// A related issue is code that could try to access the mutex +// after it's been destroyed in the global destructors (because +// the Mutex global destructor runs before some other global +// destructor, that tries to acquire the mutex). The way we +// deal with this is by taking a constructor arg that global +// mutexes should pass in, that causes the destructor to do no +// work. We still depend on the compiler not doing anything +// weird to a Mutex's memory after it is destroyed, but for a +// static global variable, that's pretty safe. + +#ifndef GFLAGS_MUTEX_H_ +#define GFLAGS_MUTEX_H_ + +#include "gflags/gflags_declare.h" // to figure out pthreads support + +#if defined(NO_THREADS) + typedef int MutexType; // to keep a lock-count +#elif defined(OS_WINDOWS) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN // We only need minimal includes +# endif +# ifndef NOMINMAX +# define NOMINMAX // Don't want windows to override min()/max() +# endif +# ifdef GMUTEX_TRYLOCK + // We need Windows NT or later for TryEnterCriticalSection(). If you + // don't need that functionality, you can remove these _WIN32_WINNT + // lines, and change TryLock() to assert(0) or something. +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +# endif +# endif +# include + typedef CRITICAL_SECTION MutexType; +#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) + // Needed for pthread_rwlock_*. If it causes problems, you could take it + // out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it + // *does* cause problems for FreeBSD, or MacOSX, but isn't needed + // for locking there.) +# ifdef __linux__ +# if _XOPEN_SOURCE < 500 // including not being defined at all +# undef _XOPEN_SOURCE +# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls +# endif +# endif +# include + typedef pthread_rwlock_t MutexType; +#elif defined(HAVE_PTHREAD) +# include + typedef pthread_mutex_t MutexType; +#else +# error Need to implement mutex.h for your architecture, or #define NO_THREADS +#endif + +#include +#include // for abort() + +#define MUTEX_NAMESPACE gflags_mutex_namespace + +namespace MUTEX_NAMESPACE { + +class Mutex { + public: + // This is used for the single-arg constructor + enum LinkerInitialized { LINKER_INITIALIZED }; + + // Create a Mutex that is not held by anybody. This constructor is + // typically used for Mutexes allocated on the heap or the stack. + inline Mutex(); + // This constructor should be used for global, static Mutex objects. + // It inhibits work being done by the destructor, which makes it + // safer for code that tries to acqiure this mutex in their global + // destructor. + explicit inline Mutex(LinkerInitialized); + + // Destructor + inline ~Mutex(); + + inline void Lock(); // Block if needed until free then acquire exclusively + inline void Unlock(); // Release a lock acquired via Lock() +#ifdef GMUTEX_TRYLOCK + inline bool TryLock(); // If free, Lock() and return true, else return false +#endif + // Note that on systems that don't support read-write locks, these may + // be implemented as synonyms to Lock() and Unlock(). So you can use + // these for efficiency, but don't use them anyplace where being able + // to do shared reads is necessary to avoid deadlock. + inline void ReaderLock(); // Block until free or shared then acquire a share + inline void ReaderUnlock(); // Release a read share of this Mutex + inline void WriterLock() { Lock(); } // Acquire an exclusive lock + inline void WriterUnlock() { Unlock(); } // Release a lock from WriterLock() + + private: + MutexType mutex_; + // We want to make sure that the compiler sets is_safe_ to true only + // when we tell it to, and never makes assumptions is_safe_ is + // always true. volatile is the most reliable way to do that. + volatile bool is_safe_; + // This indicates which constructor was called. + bool destroy_; + + inline void SetIsSafe() { is_safe_ = true; } + + // Catch the error of writing Mutex when intending MutexLock. + explicit Mutex(Mutex* /*ignored*/) {} + // Disallow "evil" constructors + Mutex(const Mutex&); + void operator=(const Mutex&); +}; + +// Now the implementation of Mutex for various systems +#if defined(NO_THREADS) + +// When we don't have threads, we can be either reading or writing, +// but not both. We can have lots of readers at once (in no-threads +// mode, that's most likely to happen in recursive function calls), +// but only one writer. We represent this by having mutex_ be -1 when +// writing and a number > 0 when reading (and 0 when no lock is held). +// +// In debug mode, we assert these invariants, while in non-debug mode +// we do nothing, for efficiency. That's why everything is in an +// assert. + +Mutex::Mutex() : mutex_(0) { } +Mutex::Mutex(Mutex::LinkerInitialized) : mutex_(0) { } +Mutex::~Mutex() { assert(mutex_ == 0); } +void Mutex::Lock() { assert(--mutex_ == -1); } +void Mutex::Unlock() { assert(mutex_++ == -1); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } +#endif +void Mutex::ReaderLock() { assert(++mutex_ > 0); } +void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } + +#elif defined(OS_WINDOWS) + +Mutex::Mutex() : destroy_(true) { + InitializeCriticalSection(&mutex_); + SetIsSafe(); +} +Mutex::Mutex(LinkerInitialized) : destroy_(false) { + InitializeCriticalSection(&mutex_); + SetIsSafe(); +} +Mutex::~Mutex() { if (destroy_) DeleteCriticalSection(&mutex_); } +void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); } +void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + TryEnterCriticalSection(&mutex_) != 0 : true; } +#endif +void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks +void Mutex::ReaderUnlock() { Unlock(); } + +#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) + +#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ + if (is_safe_ && fncall(&mutex_) != 0) abort(); \ +} while (0) + +Mutex::Mutex() : destroy_(true) { + SetIsSafe(); + if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort(); +} +Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { + SetIsSafe(); + if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort(); +} +Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_rwlock_destroy); } +void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); } +void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + pthread_rwlock_trywrlock(&mutex_) == 0 : true; } +#endif +void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); } +void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } +#undef SAFE_PTHREAD + +#elif defined(HAVE_PTHREAD) + +#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ + if (is_safe_ && fncall(&mutex_) != 0) abort(); \ +} while (0) + +Mutex::Mutex() : destroy_(true) { + SetIsSafe(); + if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort(); +} +Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { + SetIsSafe(); + if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort(); +} +Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_mutex_destroy); } +void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); } +void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + pthread_mutex_trylock(&mutex_) == 0 : true; } +#endif +void Mutex::ReaderLock() { Lock(); } +void Mutex::ReaderUnlock() { Unlock(); } +#undef SAFE_PTHREAD + +#endif + +// -------------------------------------------------------------------------- +// Some helper classes + +// MutexLock(mu) acquires mu when constructed and releases it when destroyed. +class MutexLock { + public: + explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } + ~MutexLock() { mu_->Unlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + MutexLock(const MutexLock&); + void operator=(const MutexLock&); +}; + +// ReaderMutexLock and WriterMutexLock do the same, for rwlocks +class ReaderMutexLock { + public: + explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } + ~ReaderMutexLock() { mu_->ReaderUnlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + ReaderMutexLock(const ReaderMutexLock&); + void operator=(const ReaderMutexLock&); +}; + +class WriterMutexLock { + public: + explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } + ~WriterMutexLock() { mu_->WriterUnlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + WriterMutexLock(const WriterMutexLock&); + void operator=(const WriterMutexLock&); +}; + +// Catch bug where variable name is omitted, e.g. MutexLock (&mu); +#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name) +#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name) +#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name) + +} // namespace MUTEX_NAMESPACE + + +#endif /* #define GFLAGS_MUTEX_H__ */ diff --git a/runtime/onnxruntime/third_party/gflags/src/util.h b/runtime/onnxruntime/third_party/gflags/src/util.h new file mode 100644 index 0000000..164e3cf --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/util.h @@ -0,0 +1,373 @@ +// Copyright (c) 2011, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// --- +// +// Some generically useful utility routines that in google-land would +// be their own projects. We make a shortened version here. + +#ifndef GFLAGS_UTIL_H_ +#define GFLAGS_UTIL_H_ + +#include "config.h" + +#include +#ifdef HAVE_INTTYPES_H +# include +#endif +#include // for va_* +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_STAT_H +# include // for mkdir +#endif + + +namespace GFLAGS_NAMESPACE { + + +// This is used for unittests for death-testing. It is defined in gflags.cc. +extern GFLAGS_DLL_DECL void (*gflags_exitfunc)(int); + +// Work properly if either strtoll or strtoq is on this system. +#if defined(strtoll) || defined(HAVE_STRTOLL) +# define strto64 strtoll +# define strtou64 strtoull +#elif defined(HAVE_STRTOQ) +# define strto64 strtoq +# define strtou64 strtouq +// Neither strtoll nor strtoq are defined. I hope strtol works! +#else +# define strto64 strtol +# define strtou64 strtoul +#endif + +// If we have inttypes.h, it will have defined PRId32/etc for us. +// If not, take our best guess. +#ifndef PRId32 +# define PRId32 "d" +#endif +#ifndef PRId64 +# define PRId64 "lld" +#endif +#ifndef PRIu64 +# define PRIu64 "llu" +#endif + +typedef signed char int8; +typedef unsigned char uint8; + +// -- utility macros --------------------------------------------------------- + +template struct CompileAssert; +template <> struct CompileAssert {}; +#define COMPILE_ASSERT(expr, msg) \ + enum { assert_##msg = sizeof(CompileAssert) } + +// Returns the number of elements in an array. +#define arraysize(arr) (sizeof(arr)/sizeof(*(arr))) + + +// -- logging and testing --------------------------------------------------- + +// For now, we ignore the level for logging, and don't show *VLOG's at +// all, except by hand-editing the lines below +#define LOG(level) std::cerr +#define VLOG(level) if (true) {} else std::cerr +#define DVLOG(level) if (true) {} else std::cerr + +// CHECK dies with a fatal error if condition is not true. It is *not* +// controlled by NDEBUG, so the check will be executed regardless of +// compilation mode. Therefore, it is safe to do things like: +// CHECK(fp->Write(x) == 4) +// We allow stream-like objects after this for debugging, but they're ignored. +#define EXPECT_TRUE(condition) \ + if (true) { \ + if (!(condition)) { \ + fprintf(stderr, "Check failed: %s\n", #condition); \ + exit(1); \ + } \ + } else std::cerr << "" + +#define EXPECT_OP(op, val1, val2) \ + if (true) { \ + if (!((val1) op (val2))) { \ + fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \ + exit(1); \ + } \ + } else std::cerr << "" + +#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2) +#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2) +#define EXPECT_LE(val1, val2) EXPECT_OP(<=, val1, val2) +#define EXPECT_LT(val1, val2) EXPECT_OP(< , val1, val2) +#define EXPECT_GE(val1, val2) EXPECT_OP(>=, val1, val2) +#define EXPECT_GT(val1, val2) EXPECT_OP(> , val1, val2) +#define EXPECT_FALSE(cond) EXPECT_TRUE(!(cond)) + +// C99 declares isnan and isinf should be macros, so the #ifdef test +// should be reliable everywhere. Of course, it's not, but these +// are testing pertty marginal functionality anyway, so it's ok to +// not-run them even in situations they might, with effort, be made to work. +#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_NAN(arg) \ + do { \ + if (!isnan(arg)) { \ + fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_NAN(arg) +#endif + +#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_INF(arg) \ + do { \ + if (!isinf(arg)) { \ + fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_INF(arg) +#endif + +#define EXPECT_DOUBLE_EQ(val1, val2) \ + do { \ + if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \ + fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_STREQ(val1, val2) \ + do { \ + if (strcmp((val1), (val2)) != 0) { \ + fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +// Call this in a .cc file where you will later call RUN_ALL_TESTS in main(). +#define TEST_INIT \ + static std::vector g_testlist; /* the tests to run */ \ + static int RUN_ALL_TESTS() { \ + std::vector::const_iterator it; \ + for (it = g_testlist.begin(); it != g_testlist.end(); ++it) { \ + (*it)(); /* The test will error-exit if there's a problem. */ \ + } \ + fprintf(stderr, "\nPassed %d tests\n\nPASS\n", \ + static_cast(g_testlist.size())); \ + return 0; \ + } + +// Note that this macro uses a FlagSaver to keep tests isolated. +#define TEST(a, b) \ + struct Test_##a##_##b { \ + Test_##a##_##b() { g_testlist.push_back(&Run); } \ + static void Run() { \ + FlagSaver fs; \ + fprintf(stderr, "Running test %s/%s\n", #a, #b); \ + RunTest(); \ + } \ + static void RunTest(); \ + }; \ + static Test_##a##_##b g_test_##a##_##b; \ + void Test_##a##_##b::RunTest() + +// This is a dummy class that eases the google->opensource transition. +namespace testing { +class Test {}; +} + +// Call this in a .cc file where you will later call EXPECT_DEATH +#define EXPECT_DEATH_INIT \ + static bool g_called_exit; \ + static void CalledExit(int) { g_called_exit = true; } + +#define EXPECT_DEATH(fn, msg) \ + do { \ + g_called_exit = false; \ + gflags_exitfunc = &CalledExit; \ + fn; \ + gflags_exitfunc = &exit; /* set back to its default */ \ + if (!g_called_exit) { \ + fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \ + exit(1); \ + } \ + } while (0) + +#define GTEST_HAS_DEATH_TEST 1 + +// -- path routines ---------------------------------------------------------- + +// Tries to create the directory path as a temp-dir. If it fails, +// changes path to some directory it *can* create. +#if defined(__MINGW32__) +#include +inline void MakeTmpdir(std::string* path) { + if (!path->empty()) { + path->append("/gflags_unittest_testdir"); + int err = mkdir(path->c_str()); + if (err == 0 || errno == EEXIST) return; + } + // I had trouble creating a directory in /tmp from mingw + *path = "./gflags_unittest"; + mkdir(path->c_str()); +} +#elif defined(_MSC_VER) +#include +inline void MakeTmpdir(std::string* path) { + if (!path->empty()) { + int err = _mkdir(path->c_str()); + if (err == 0 || errno == EEXIST) return; + } + char tmppath_buffer[1024]; + int tmppath_len = GetTempPathA(sizeof(tmppath_buffer), tmppath_buffer); + assert(tmppath_len > 0 && tmppath_len < sizeof(tmppath_buffer)); + assert(tmppath_buffer[tmppath_len - 1] == '\\'); // API guarantees it + *path = std::string(tmppath_buffer) + "gflags_unittest"; + _mkdir(path->c_str()); +} +#else +inline void MakeTmpdir(std::string* path) { + if (!path->empty()) { + int err = mkdir(path->c_str(), 0755); + if (err == 0 || errno == EEXIST) return; + } + mkdir("/tmp/gflags_unittest", 0755); +} +#endif + +// -- string routines -------------------------------------------------------- + +inline void InternalStringPrintf(std::string* output, const char* format, + va_list ap) { + char space[128]; // try a small buffer and hope it fits + + // It's possible for methods that use a va_list to invalidate + // the data in it upon use. The fix is to make a copy + // of the structure before using it and use that copy instead. + va_list backup_ap; + va_copy(backup_ap, ap); + int bytes_written = vsnprintf(space, sizeof(space), format, backup_ap); + va_end(backup_ap); + + if ((bytes_written >= 0) && (static_cast(bytes_written) < sizeof(space))) { + output->append(space, bytes_written); + return; + } + + // Repeatedly increase buffer size until it fits. + int length = sizeof(space); + while (true) { + if (bytes_written < 0) { + // Older snprintf() behavior. :-( Just try doubling the buffer size + length *= 2; + } else { + // We need exactly "bytes_written+1" characters + length = bytes_written+1; + } + char* buf = new char[length]; + + // Restore the va_list before we use it again + va_copy(backup_ap, ap); + bytes_written = vsnprintf(buf, length, format, backup_ap); + va_end(backup_ap); + + if ((bytes_written >= 0) && (bytes_written < length)) { + output->append(buf, bytes_written); + delete[] buf; + return; + } + delete[] buf; + } +} + +// Clears output before writing to it. +inline void SStringPrintf(std::string* output, const char* format, ...) { + va_list ap; + va_start(ap, format); + output->clear(); + InternalStringPrintf(output, format, ap); + va_end(ap); +} + +inline void StringAppendF(std::string* output, const char* format, ...) { + va_list ap; + va_start(ap, format); + InternalStringPrintf(output, format, ap); + va_end(ap); +} + +inline std::string StringPrintf(const char* format, ...) { + va_list ap; + va_start(ap, format); + std::string output; + InternalStringPrintf(&output, format, ap); + va_end(ap); + return output; +} + +inline bool SafeGetEnv(const char *varname, std::string &valstr) +{ +#if defined(_MSC_VER) && _MSC_VER >= 1400 + char *val; + size_t sz; + if (_dupenv_s(&val, &sz, varname) != 0 || !val) return false; + valstr = val; + free(val); +#else + const char * const val = getenv(varname); + if (!val) return false; + valstr = val; +#endif + return true; +} + +inline int SafeFOpen(FILE **fp, const char* fname, const char *mode) +{ +#if defined(_MSC_VER) && _MSC_VER >= 1400 + return fopen_s(fp, fname, mode); +#else + assert(fp != NULL); + *fp = fopen(fname, mode); + // errno only guaranteed to be set on failure + return ((*fp == NULL) ? errno : 0); +#endif +} + + +} // namespace GFLAGS_NAMESPACE + + +#endif // GFLAGS_UTIL_H_ diff --git a/runtime/onnxruntime/third_party/gflags/src/windows_port.cc b/runtime/onnxruntime/third_party/gflags/src/windows_port.cc new file mode 100644 index 0000000..b5b7194 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/windows_port.cc @@ -0,0 +1,73 @@ +/* Copyright (c) 2009, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * --- + * Author: Craig Silverstein + */ + +#ifndef _WIN32 +# error You should only be including windows/port.cc in a windows environment! +#endif + +#include // for strlen(), memset(), memcmp() +#include +#include // for va_list, va_start, va_end +#include + +#include "windows_port.h" + +// These call the windows _vsnprintf, but always NUL-terminate. +#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ +#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4996) // ignore _vsnprintf security warning +#endif +int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { + if (size == 0) // not even room for a \0? + return -1; // not what C99 says to do, but what windows does + str[size-1] = '\0'; + return _vsnprintf(str, size-1, format, ap); +} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +int snprintf(char *str, size_t size, const char *format, ...) { + int r; + va_list ap; + va_start(ap, format); + r = vsnprintf(str, size, format, ap); + va_end(ap); + return r; +} + +#endif /* if !(defined(_MSC_VER) && _MSC_VER >= 1900) */ +#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ diff --git a/runtime/onnxruntime/third_party/gflags/src/windows_port.h b/runtime/onnxruntime/third_party/gflags/src/windows_port.h new file mode 100644 index 0000000..59a310e --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/src/windows_port.h @@ -0,0 +1,135 @@ +/* Copyright (c) 2009, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * --- + * Author: Craig Silverstein + * + * These are some portability typedefs and defines to make it a bit + * easier to compile this code under VC++. + * + * Several of these are taken from glib: + * http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html + */ + +#ifndef GFLAGS_WINDOWS_PORT_H_ +#define GFLAGS_WINDOWS_PORT_H_ + +#include "config.h" + +// This must be defined before the windows.h is included. +// It's needed for mutex.h, to give access to the TryLock method. +# if !defined(_WIN32_WINNT) && !(defined( __MINGW32__) || defined(__MINGW64__)) +# define _WIN32_WINNT 0x0400 +# endif +// We always want minimal includes +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include +#include /* for mkdir */ +#include /* for _putenv, getenv */ +#include /* need this to override stdio's snprintf, also defines _unlink used by unit tests */ +#include /* util.h uses va_copy */ +#include /* for _stricmp and _strdup */ + +/* We can't just use _vsnprintf and _snprintf as drop-in-replacements, + * because they don't always NUL-terminate. :-( We also can't use the + * name vsnprintf, since windows defines that (but not snprintf (!)). + */ +#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ +#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ +extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size, + const char *format, ...); +extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size, + const char *format, va_list ap); +#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) +#define va_copy(dst, src) (dst) = (src) +#endif +#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4996) // ignore getenv security warning +#endif +#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L +inline void setenv(const char* name, const char* value, int) { + // In windows, it's impossible to set a variable to the empty string. + // We handle this by setting it to "0" and the NUL-ing out the \0. + // That is, we putenv("FOO=0") and then find out where in memory the + // putenv wrote "FOO=0", and change it in-place to "FOO=\0". + // c.f. http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/environ.cpp?r1=611451&r2=637508&pathrev=637508 + static const char* const kFakeZero = "0"; + if (*value == '\0') + value = kFakeZero; + // Apparently the semantics of putenv() is that the input + // must live forever, so we leak memory here. :-( + const size_t nameval_len = strlen(name) + 1 + strlen(value) + 1; + char* nameval = reinterpret_cast(malloc(nameval_len)); + snprintf(nameval, nameval_len, "%s=%s", name, value); + _putenv(nameval); + if (value == kFakeZero) { + nameval[nameval_len - 2] = '\0'; // works when putenv() makes no copy + if (*getenv(name) != '\0') + *getenv(name) = '\0'; // works when putenv() copies nameval + } +} +#endif +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +#define strcasecmp _stricmp + +#if defined(_MSC_VER) && _MSC_VER >= 1400 +#define strdup _strdup +#define unlink _unlink +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1800 +#include +#else +#define PRId32 "d" +#define PRIu32 "u" +#define PRId64 "I64d" +#define PRIu64 "I64u" +#endif + +#if !defined(__MINGW32__) && !defined(__MINGW64__) +#define strtoq _strtoi64 +#define strtouq _strtoui64 +#define strtoll _strtoi64 +#define strtoull _strtoui64 +#define atoll _atoi64 +#endif + +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +#endif /* GFLAGS_WINDOWS_PORT_H_ */ diff --git a/runtime/onnxruntime/third_party/gflags/test/CMakeLists.txt b/runtime/onnxruntime/third_party/gflags/test/CMakeLists.txt new file mode 100644 index 0000000..4cd1e69 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/CMakeLists.txt @@ -0,0 +1,209 @@ +## gflags tests + +# ---------------------------------------------------------------------------- +# output directories +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + +# set working directory of test commands +set (GFLAGS_FLAGFILES_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +# ---------------------------------------------------------------------------- +# common include directories and link libraries +include_directories ("${CMAKE_CURRENT_SOURCE_DIR}") +include_directories ("${gflags_SOURCE_DIR}/src") +include_directories ("${gflags_BINARY_DIR}/include") +include_directories ("${gflags_BINARY_DIR}/include/gflags") + +if (BUILD_SHARED_LIBS) + set (type shared) + if (GFLAGS_IS_A_DLL) + add_definitions(-DGFLAGS_IS_A_DLL) + endif () +else () + set (type static) +endif () +if (BUILD_gflags_LIB) + link_libraries (gflags_${type}) +else () + link_libraries (gflags_nothreads_${type}) +endif () + +# ---------------------------------------------------------------------------- +# STRIP_FLAG_HELP +add_executable (gflags_strip_flags_test gflags_strip_flags_test.cc) +# Make sure the --help output doesn't print the stripped text. +add_gflags_test (strip_flags_help 1 "" "This text should be stripped out" gflags_strip_flags_test --help) +# Make sure the stripped text isn't in the binary at all. +add_test ( + NAME strip_flags_binary + COMMAND "${CMAKE_COMMAND}" "-DBINARY=$" + -P "${CMAKE_CURRENT_SOURCE_DIR}/gflags_strip_flags_test.cmake" + CONFIGURATIONS Release MinSizeRel +) + +# ---------------------------------------------------------------------------- +# unit tests +configure_file (gflags_unittest.cc gflags_unittest-main.cc COPYONLY) +configure_file (gflags_unittest.cc gflags_unittest_main.cc COPYONLY) + +add_executable (gflags_unittest gflags_unittest.cc) +add_executable (gflags_unittest-main gflags_unittest-main.cc) +add_executable (gflags_unittest_main gflags_unittest_main.cc) + +if (OS_WINDOWS) + set (SLASH "\\\\") +else () + set (SLASH "/") +endif () + +# First, just make sure the gflags_unittest works as-is +add_gflags_test(unittest 0 "" "" gflags_unittest) + +# --help should show all flags, including flags from gflags_reporting +add_gflags_test(help-reporting 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --help) + +# Make sure that --help prints even very long helpstrings. +add_gflags_test(long-helpstring 1 "end of a long helpstring" "" gflags_unittest --help) + +# Make sure --help reflects flag changes made before flag-parsing +add_gflags_test(changed_bool1 1 "-changed_bool1 (changed) type: bool default: true" "" gflags_unittest --help) +add_gflags_test(changed_bool2 1 "-changed_bool2 (changed) type: bool default: false currently: true" "" gflags_unittest --help) +# And on the command-line, too +add_gflags_test(changeable_string_var 1 "-changeable_string_var () type: string default: \"1\" currently: \"2\"" "" gflags_unittest --changeable_string_var 2 --help) + +# --nohelp and --help=false should be as if we didn't say anything +add_gflags_test(nohelp 0 "PASS" "" gflags_unittest --nohelp) +add_gflags_test(help=false 0 "PASS" "" gflags_unittest --help=false) + +# --helpfull is the same as help +add_gflags_test(helpfull 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --helpfull) + +# --helpshort should show only flags from the gflags_unittest itself +add_gflags_test(helpshort 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest --helpshort) + +# --helpshort should show the tldflag we created in the gflags_unittest dir +add_gflags_test(helpshort-tldflag1 1 "tldflag1" "${SLASH}google.cc:" gflags_unittest --helpshort) +add_gflags_test(helpshort-tldflag2 1 "tldflag2" "${SLASH}google.cc:" gflags_unittest --helpshort) + +# --helpshort should work if the main source file is suffixed with [_-]main +add_gflags_test(helpshort-main 1 "${SLASH}gflags_unittest-main.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest-main --helpshort) +add_gflags_test(helpshort_main 1 "${SLASH}gflags_unittest_main.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest_main --helpshort) + +# --helpon needs an argument +add_gflags_test(helpon 1 "'--helpon' is missing its argument; flag description: show help on" "" gflags_unittest --helpon) +# --helpon argument indicates what file we'll show args from +add_gflags_test(helpon=gflags 1 "${SLASH}gflags.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpon=gflags) +# another way of specifying the argument +add_gflags_test(helpon_gflags 1 "${SLASH}gflags.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpon gflags) +# test another argument +add_gflags_test(helpon=gflags_unittest 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags.cc:" gflags_unittest --helpon=gflags_unittest) + +# helpmatch is like helpon but takes substrings +add_gflags_test(helpmatch_reporting 1 "${SLASH}gflags_reporting.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpmatch reporting) +add_gflags_test(helpmatch=unittest 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags.cc:" gflags_unittest -helpmatch=unittest) + +# if no flags are found with helpmatch or helpon, suggest --help +add_gflags_test(helpmatch=nosuchsubstring 1 "No modules matched" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpmatch=nosuchsubstring) +add_gflags_test(helpon=nosuchmodule 1 "No modules matched" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpon=nosuchmodule) + +# helppackage shows all the flags in the same dir as this unittest +# --help should show all flags, including flags from google.cc +add_gflags_test(helppackage 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --helppackage) + +# xml! +add_gflags_test(helpxml 1 "${SLASH}gflags_unittest.cc" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpxml) + +# just print the version info and exit +add_gflags_test(version-1 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --version) +add_gflags_test(version-2 0 "version test_version" "${SLASH}gflags_unittest.cc:" gflags_unittest --version) + +# --undefok is a fun flag... +add_gflags_test(undefok-1 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok= --foo --unused_bool) +add_gflags_test(undefok-2 0 "PASS" "" gflags_unittest --undefok=foo --foo --unused_bool) +# If you say foo is ok to be undefined, we'll accept --nofoo as well +add_gflags_test(undefok-3 0 "PASS" "" gflags_unittest --undefok=foo --nofoo --unused_bool) +# It's ok if the foo is in the middle +add_gflags_test(undefok-4 0 "PASS" "" gflags_unittest --undefok=fee,fi,foo,fum --foo --unused_bool) +# But the spelling has to be just right... +add_gflags_test(undefok-5 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok=fo --foo --unused_bool) +add_gflags_test(undefok-6 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok=foot --foo --unused_bool) + +# See if we can successfully load our flags from the flagfile +add_gflags_test(flagfile.1 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest "--flagfile=flagfile.1") +add_gflags_test(flagfile.2 0 "PASS" "" gflags_unittest "--flagfile=flagfile.2") +add_gflags_test(flagfile.3 0 "PASS" "" gflags_unittest "--flagfile=flagfile.3") + +# Also try to load flags from the environment +add_gflags_test(fromenv=version 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --fromenv=version) +add_gflags_test(tryfromenv=version 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --tryfromenv=version) +add_gflags_test(fromenv=help 0 "PASS" "" gflags_unittest --fromenv=help) +add_gflags_test(tryfromenv=help 0 "PASS" "" gflags_unittest --tryfromenv=help) +add_gflags_test(fromenv=helpfull 1 "helpfull not found in environment" "" gflags_unittest --fromenv=helpfull) +add_gflags_test(tryfromenv=helpfull 0 "PASS" "" gflags_unittest --tryfromenv=helpfull) +add_gflags_test(tryfromenv=undefok 0 "PASS" "" gflags_unittest --tryfromenv=undefok --foo) +add_gflags_test(tryfromenv=weirdo 1 "unknown command line flag" "" gflags_unittest --tryfromenv=weirdo) +add_gflags_test(tryfromenv-multiple 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --tryfromenv=test_bool,version,unused_bool) +add_gflags_test(fromenv=test_bool 1 "not found in environment" "" gflags_unittest --fromenv=test_bool) +add_gflags_test(fromenv=test_bool-ok 1 "unknown command line flag" "" gflags_unittest --fromenv=test_bool,ok) +# Here, the --version overrides the fromenv +add_gflags_test(version-overrides-fromenv 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --fromenv=test_bool,version,ok) + +# Make sure -- by itself stops argv processing +add_gflags_test(dashdash 0 "PASS" "" gflags_unittest -- --help) + +# And we should die if the flag value doesn't pass the validator +add_gflags_test(always_fail 1 "ERROR: failed validation of new value 'true' for flag 'always_fail'" "" gflags_unittest --always_fail) + +# And if locking in validators fails +# TODO(andreas): Worked on Windows 7 Release configuration, but causes +# debugger abort() intervention in case of Debug configuration. +#add_gflags_test(deadlock_if_cant_lock 0 "PASS" "" gflags_unittest --deadlock_if_cant_lock) + +# ---------------------------------------------------------------------------- +# use gflags_declare.h +add_executable (gflags_declare_test gflags_declare_test.cc gflags_declare_flags.cc) + +add_test(NAME gflags_declare COMMAND gflags_declare_test --message "Hello gflags!") +set_tests_properties(gflags_declare PROPERTIES PASS_REGULAR_EXPRESSION "Hello gflags!") + +# ---------------------------------------------------------------------------- +# configure Python script which configures and builds a test project +if (BUILD_NC_TESTS OR BUILD_CONFIG_TESTS) + find_package (PythonInterp) + if (NOT PYTHON_EXECUTABLE) + message (FATAL_ERROR "No Python installation found! It is required by the (negative) compilation tests." + " Either install Python or set BUILD_NC_TESTS and BUILD_CONFIG_TESTS to FALSE.") + endif () + set (TMPDIR "${PROJECT_BINARY_DIR}/Testing/Temporary") + configure_file (gflags_build.py.in "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build.py" @ONLY) + function (add_gflags_build_test name srcdir expect_fail) + set (srcdir "${CMAKE_CURRENT_SOURCE_DIR}/${srcdir}") + add_test ( + NAME "${name}" + COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build.py" + ${name} ${srcdir} ${expect_fail} + ) + endfunction () +endif () + +# ---------------------------------------------------------------------------- +# negative compilation tests +option (BUILD_NC_TESTS "Request addition of negative compilation tests." OFF) +mark_as_advanced (BUILD_NC_TESTS) +if (BUILD_NC_TESTS) + add_gflags_build_test (nc_sanity nc 0) + add_gflags_build_test (nc_swapped_args nc 1) + add_gflags_build_test (nc_int_instead_of_bool nc 1) + add_gflags_build_test (nc_bool_in_quotes nc 1) + add_gflags_build_test (nc_define_string_with_0 nc 1) +endif () + +# ---------------------------------------------------------------------------- +# build configuration test +option (BUILD_CONFIG_TESTS "Request addition of package configuration tests." OFF) +mark_as_advanced (BUILD_CONFIG_TESTS) +if (BUILD_CONFIG_TESTS) + add_gflags_build_test (cmake_config config 0) +endif () diff --git a/runtime/onnxruntime/third_party/gflags/test/config/CMakeLists.txt b/runtime/onnxruntime/third_party/gflags/test/config/CMakeLists.txt new file mode 100644 index 0000000..6190b25 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/config/CMakeLists.txt @@ -0,0 +1,10 @@ +## gflags package configuration tests + +cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) + +project (gflags_${TEST_NAME}) + +find_package (gflags REQUIRED) + +add_executable (foo main.cc) +target_link_libraries (foo gflags::gflags) diff --git a/runtime/onnxruntime/third_party/gflags/test/config/main.cc b/runtime/onnxruntime/third_party/gflags/test/config/main.cc new file mode 100644 index 0000000..3c033e3 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/config/main.cc @@ -0,0 +1,20 @@ +#include +#include + +DEFINE_string(message, "Hello World!", "The message to print"); + +static bool ValidateMessage(const char* flagname, const std::string &message) +{ + return !message.empty(); +} +DEFINE_validator(message, ValidateMessage); + +int main(int argc, char **argv) +{ + gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)"); + gflags::SetVersionString("0.1"); + gflags::ParseCommandLineFlags(&argc, &argv, true); + std::cout << FLAGS_message << std::endl; + gflags::ShutDownCommandLineFlags(); + return 0; +} diff --git a/runtime/onnxruntime/third_party/gflags/test/flagfile.1 b/runtime/onnxruntime/third_party/gflags/test/flagfile.1 new file mode 100644 index 0000000..e0f9217 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/flagfile.1 @@ -0,0 +1 @@ +--version \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/gflags/test/flagfile.2 b/runtime/onnxruntime/third_party/gflags/test/flagfile.2 new file mode 100644 index 0000000..864f8e8 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/flagfile.2 @@ -0,0 +1,2 @@ +--foo=bar +--nounused_bool \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/gflags/test/flagfile.3 b/runtime/onnxruntime/third_party/gflags/test/flagfile.3 new file mode 100644 index 0000000..76d92bb --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/flagfile.3 @@ -0,0 +1 @@ +--flagfile=flagfile.2 \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/gflags/test/gflags_build.py.in b/runtime/onnxruntime/third_party/gflags/test/gflags_build.py.in new file mode 100644 index 0000000..a8cba2b --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/gflags_build.py.in @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import os +import sys +import subprocess +import shutil + +CMAKE = '@CMAKE_COMMAND@' +CMAKE_BUILD_TYPE = '@CMAKE_BUILD_TYPE@' +TMPDIR = '@TMPDIR@' +SRCDIR = '@SRCDIR@' +GFLAGS_DIR = '@gflags_BINARY_DIR@' + +if __name__ == "__main__": + if len(sys.argv) != 4: + sys.stderr.write(' '.join(['usage:', sys.argv[0], ' \n'])) + sys.exit(1) + test_name = sys.argv[1] + srcdir = sys.argv[2] + expect_fail = (sys.argv[3].lower() in ['true', 'yes', 'on', '1']) + bindir = os.path.join(TMPDIR, test_name) + if TMPDIR == '': + sys.stderr.write('Temporary directory not set!\n') + sys.exit(1) + # create build directory + if os.path.isdir(bindir): shutil.rmtree(bindir) + os.makedirs(bindir) + # configure the build tree + if subprocess.call([CMAKE, '-DCMAKE_BUILD_TYPE:STRING='+CMAKE_BUILD_TYPE, + '-Dgflags_DIR:PATH='+GFLAGS_DIR, + '-DTEST_NAME:STRING='+test_name, srcdir], cwd=bindir) != 0: + sys.stderr.write('Failed to configure the build tree!\n') + sys.exit(1) + # build the test project + exit_code = subprocess.call([CMAKE, '--build', bindir, '--config', CMAKE_BUILD_TYPE], cwd=bindir) + if expect_fail == True: + if exit_code == 0: + sys.stderr.write('Build expected to fail, but it succeeded!\n') + sys.exit(1) + else: + sys.stderr.write('Build failed as expected\n') + exit_code = 0 + sys.exit(exit_code) diff --git a/runtime/onnxruntime/third_party/gflags/test/gflags_declare_flags.cc b/runtime/onnxruntime/third_party/gflags/test/gflags_declare_flags.cc new file mode 100644 index 0000000..3d952a8 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/gflags_declare_flags.cc @@ -0,0 +1,12 @@ +#define GFLAGS_DLL_DECLARE_FLAG + +#include +#include + +DECLARE_string(message); // in gflags_delcare_test.cc + +void print_message(); +void print_message() +{ + std::cout << FLAGS_message << std::endl; +} diff --git a/runtime/onnxruntime/third_party/gflags/test/gflags_declare_test.cc b/runtime/onnxruntime/third_party/gflags/test/gflags_declare_test.cc new file mode 100644 index 0000000..47d11c2 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/gflags_declare_test.cc @@ -0,0 +1,12 @@ +#include + +DEFINE_string(message, "", "The message to print"); +void print_message(); // in gflags_declare_flags.cc + +int main(int argc, char **argv) +{ + GFLAGS_NAMESPACE::SetUsageMessage("Test compilation and use of gflags_declare.h"); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); + print_message(); + return 0; +} diff --git a/runtime/onnxruntime/third_party/gflags/test/gflags_strip_flags_test.cc b/runtime/onnxruntime/third_party/gflags/test/gflags_strip_flags_test.cc new file mode 100644 index 0000000..143f0c6 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/gflags_strip_flags_test.cc @@ -0,0 +1,60 @@ +// Copyright (c) 2011, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// Author: csilvers@google.com (Craig Silverstein) +// +// A simple program that uses STRIP_FLAG_HELP. We'll have a shell +// script that runs 'strings' over this program and makes sure +// that the help string is not in there. + +#define STRIP_FLAG_HELP 1 +#include + +#include + +using GFLAGS_NAMESPACE::SetUsageMessage; +using GFLAGS_NAMESPACE::ParseCommandLineFlags; + + +DEFINE_bool(test, true, "This text should be stripped out"); + +int main(int argc, char** argv) { + SetUsageMessage("Usage message"); + ParseCommandLineFlags(&argc, &argv, false); + + // Unfortunately, for us, libtool can replace executables with a shell + // script that does some work before calling the 'real' executable + // under a different name. We need the 'real' executable name to run + // 'strings' on it, so we construct this binary to print the real + // name (argv[0]) on stdout when run. + puts(argv[0]); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/gflags/test/gflags_strip_flags_test.cmake b/runtime/onnxruntime/third_party/gflags/test/gflags_strip_flags_test.cmake new file mode 100644 index 0000000..5bb5cc1 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/gflags_strip_flags_test.cmake @@ -0,0 +1,7 @@ +if (NOT BINARY) + message (FATAL_ERROR "BINARY file to check not specified!") +endif () +file (STRINGS "${BINARY}" strings REGEX "This text should be stripped out") +if (strings) + message (FATAL_ERROR "Text not stripped from binary like it should be: ${BINARY}") +endif () diff --git a/runtime/onnxruntime/third_party/gflags/test/gflags_unittest.cc b/runtime/onnxruntime/third_party/gflags/test/gflags_unittest.cc new file mode 100644 index 0000000..9a922ef --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/gflags_unittest.cc @@ -0,0 +1,1572 @@ +// Copyright (c) 2005, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// For now, this unit test does not cover all features of +// gflags.cc + +#include + +#include "config.h" +#include "util.h" + +#include // for isinf() and isnan() +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include // for unlink() +#endif +#include +#include +TEST_INIT +EXPECT_DEATH_INIT + +// I don't actually use this header file, but #include it under the +// old location to make sure that the include-header-forwarding +// works. But don't bother on windows; the windows port is so new +// it never had the old location-names. +#ifndef _MSC_VER +#include +void (*unused_fn)() = &GFLAGS_NAMESPACE::HandleCommandLineCompletions; +#endif + +using std::string; +using std::vector; +using GFLAGS_NAMESPACE::int32; +using GFLAGS_NAMESPACE::FlagRegisterer; +using GFLAGS_NAMESPACE::StringFromEnv; +using GFLAGS_NAMESPACE::RegisterFlagValidator; +using GFLAGS_NAMESPACE::CommandLineFlagInfo; +using GFLAGS_NAMESPACE::GetAllFlags; + +DEFINE_string(test_tmpdir, "", "Dir we use for temp files"); +DEFINE_string(srcdir, StringFromEnv("SRCDIR", "."), "Source-dir root, needed to find gflags_unittest_flagfile"); + +DECLARE_string(tryfromenv); // in gflags.cc + +DEFINE_bool(test_bool, false, "tests bool-ness"); +DEFINE_int32(test_int32, -1, ""); +DEFINE_int64(test_int64, -2, ""); +DEFINE_uint32(test_uint32, 1, ""); +DEFINE_uint64(test_uint64, 2, ""); +DEFINE_double(test_double, -1.0, ""); +DEFINE_string(test_string, "initial", ""); + +// +// The below ugliness gets some additional code coverage in the -helpxml +// and -helpmatch test cases having to do with string lengths and formatting +// +DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name, + false, + "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning"); + +DEFINE_string(test_str1, "initial", ""); +DEFINE_string(test_str2, "initial", ""); +DEFINE_string(test_str3, "initial", ""); + +// This is used to test setting tryfromenv manually +DEFINE_string(test_tryfromenv, "initial", ""); + +// Don't try this at home! +static int changeable_var = 12; +DEFINE_int32(changeable_var, ++changeable_var, ""); + +static int changeable_bool_var = 8008; +DEFINE_bool(changeable_bool_var, ++changeable_bool_var == 8009, ""); + +static int changeable_string_var = 0; +static string ChangeableString() { + char r[] = {static_cast('0' + ++changeable_string_var), '\0'}; + return r; +} +DEFINE_string(changeable_string_var, ChangeableString(), ""); + +// These are never used in this unittest, but can be used by +// gflags_unittest.sh when it needs to specify flags +// that are legal for gflags_unittest but don't need to +// be a particular value. +DEFINE_bool(unused_bool, true, "unused bool-ness"); +DEFINE_int32(unused_int32, -1001, ""); +DEFINE_int64(unused_int64, -2001, ""); +DEFINE_uint32(unused_uint32, 1000, ""); +DEFINE_uint64(unused_uint64, 2000, ""); +DEFINE_double(unused_double, -1000.0, ""); +DEFINE_string(unused_string, "unused", ""); + +// These flags are used by gflags_unittest.sh +DEFINE_bool(changed_bool1, false, "changed"); +DEFINE_bool(changed_bool2, false, "changed"); +DEFINE_bool(long_helpstring, false, + "This helpstring goes on forever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever and ever and ever and ever and ever and ever and ever and " + "ever. This is the end of a long helpstring"); + + +static bool AlwaysFail(const char* flag, bool value) { return value == false; } +DEFINE_bool(always_fail, false, "will fail to validate when you set it"); +DEFINE_validator(always_fail, AlwaysFail); + +// See the comment by GetAllFlags in gflags.h +static bool DeadlockIfCantLockInValidators(const char* flag, bool value) { + if (!value) { + return true; + } + vector dummy; + GetAllFlags(&dummy); + return true; +} +DEFINE_bool(deadlock_if_cant_lock, + false, + "will deadlock if set to true and " + "if locking of registry in validators fails."); +DEFINE_validator(deadlock_if_cant_lock, DeadlockIfCantLockInValidators); + +#define MAKEFLAG(x) DEFINE_int32(test_flag_num##x, x, "Test flag") + +// Define 10 flags +#define MAKEFLAG10(x) \ + MAKEFLAG(x##0); \ + MAKEFLAG(x##1); \ + MAKEFLAG(x##2); \ + MAKEFLAG(x##3); \ + MAKEFLAG(x##4); \ + MAKEFLAG(x##5); \ + MAKEFLAG(x##6); \ + MAKEFLAG(x##7); \ + MAKEFLAG(x##8); \ + MAKEFLAG(x##9) + +// Define 100 flags +#define MAKEFLAG100(x) \ + MAKEFLAG10(x##0); \ + MAKEFLAG10(x##1); \ + MAKEFLAG10(x##2); \ + MAKEFLAG10(x##3); \ + MAKEFLAG10(x##4); \ + MAKEFLAG10(x##5); \ + MAKEFLAG10(x##6); \ + MAKEFLAG10(x##7); \ + MAKEFLAG10(x##8); \ + MAKEFLAG10(x##9) + +// Define a bunch of command-line flags. Each occurrence of the MAKEFLAG100 +// macro defines 100 integer flags. This lets us test the effect of having +// many flags on startup time. +MAKEFLAG100(1); +MAKEFLAG100(2); +MAKEFLAG100(3); +MAKEFLAG100(4); +MAKEFLAG100(5); +MAKEFLAG100(6); +MAKEFLAG100(7); +MAKEFLAG100(8); +MAKEFLAG100(9); +MAKEFLAG100(10); +MAKEFLAG100(11); +MAKEFLAG100(12); +MAKEFLAG100(13); +MAKEFLAG100(14); +MAKEFLAG100(15); + +#undef MAKEFLAG100 +#undef MAKEFLAG10 +#undef MAKEFLAG + +// This is a pseudo-flag -- we want to register a flag with a filename +// at the top level, but there is no way to do this except by faking +// the filename. +namespace fLI { + static const int32 FLAGS_nonotldflag1 = 12; + int32 FLAGS_tldflag1 = FLAGS_nonotldflag1; + int32 FLAGS_notldflag1 = FLAGS_nonotldflag1; + static FlagRegisterer o_tldflag1( + "tldflag1", + "should show up in --helpshort", "gflags_unittest.cc", + &FLAGS_tldflag1, &FLAGS_notldflag1); +} +using fLI::FLAGS_tldflag1; + +namespace fLI { + static const int32 FLAGS_nonotldflag2 = 23; + int32 FLAGS_tldflag2 = FLAGS_nonotldflag2; + int32 FLAGS_notldflag2 = FLAGS_nonotldflag2; + static FlagRegisterer o_tldflag2( + "tldflag2", + "should show up in --helpshort", "gflags_unittest.", + &FLAGS_tldflag2, &FLAGS_notldflag2); +} +using fLI::FLAGS_tldflag2; + +namespace GFLAGS_NAMESPACE { + +namespace { + + +static string TmpFile(const string& basename) { +#ifdef _MSC_VER + return FLAGS_test_tmpdir + "\\" + basename; +#else + return FLAGS_test_tmpdir + "/" + basename; +#endif +} + +// Returns the definition of the --flagfile flag to be used in the tests. +// Must be called after ParseCommandLineFlags(). +static const char* GetFlagFileFlag() { +#ifdef _MSC_VER + static const string flagfile = FLAGS_srcdir + "\\gflags_unittest_flagfile"; +#else + static const string flagfile = FLAGS_srcdir + "/gflags_unittest_flagfile"; +#endif + static const string flagfile_flag = string("--flagfile=") + flagfile; + return flagfile_flag.c_str(); +} + + +// Defining a variable of type CompileAssertTypesEqual will cause a +// compiler error iff T1 and T2 are different types. +template +struct CompileAssertTypesEqual; + +template +struct CompileAssertTypesEqual { +}; + + +template +void AssertIsType(Actual& x) { + CompileAssertTypesEqual(); +} + +// Verify all the flags are the right type. +TEST(FlagTypes, FlagTypes) { + AssertIsType(FLAGS_test_bool); + AssertIsType(FLAGS_test_int32); + AssertIsType(FLAGS_test_int64); + AssertIsType(FLAGS_test_uint32); + AssertIsType(FLAGS_test_uint64); + AssertIsType(FLAGS_test_double); + AssertIsType(FLAGS_test_string); +} + +#ifdef GTEST_HAS_DEATH_TEST +// Death tests for "help" options. +// +// The help system automatically calls gflags_exitfunc(1) when you specify any of +// the help-related flags ("-helpmatch", "-helpxml") so we can't test +// those mainline. + +// Tests that "-helpmatch" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpMatch) { + EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true), + ""); +} + + +// Tests that "-helpxml" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpXml) { + EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true), + ""); +} +#endif + + +// A subroutine needed for testing reading flags from a string. +void TestFlagString(const string& flags, + const string& expected_string, + bool expected_bool, + int32 expected_int32, + double expected_double) { + EXPECT_TRUE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + true)); + + EXPECT_EQ(expected_string, FLAGS_test_string); + EXPECT_EQ(expected_bool, FLAGS_test_bool); + EXPECT_EQ(expected_int32, FLAGS_test_int32); + EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double); +} + + +// Tests reading flags from a string. +TEST(FlagFileTest, ReadFlagsFromString) { + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "-test_bool=true\n" + " -test_int32=1\n" + "-test_double=0.0\n", + // Expected values + "continued", + true, + 1, + 0.0); + + TestFlagString( + // Flag string + "# let's make sure it can update values\n" + "-test_string=initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=123.0\n", + // Expected values + "initial", + false, + 123, + 123.0); + + // Test that flags can use dashes instead of underscores. + TestFlagString( + // Flag string + "-test-string=initial\n" + "--test-bool=false\n" + "--test-int32=123\n" + "--test-double=123.0\n", + // Expected values + "initial", + false, + 123, + 123.0); +} + +// Tests the filename part of the flagfile +TEST(FlagFileTest, FilenamesOurfileLast) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "not_our_filename\n" + "-test_bool=true\n" + " -test_int32=1\n" + "gflags_unittest\n" + "-test_double=1000.0\n", + // Expected values + "continued", + false, + -1, + 1000.0); +} + +TEST(FlagFileTest, FilenamesOurfileFirst) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "gflags_unittest\n" + "-test_bool=true\n" + " -test_int32=1\n" + "not_our_filename\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +#if defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) // otherwise glob isn't supported +TEST(FlagFileTest, FilenamesOurfileGlob) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*flags*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +TEST(FlagFileTest, FilenamesOurfileInBigList) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*first* *flags* *third*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} +#endif // defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) + +// Tests that a failed flag-from-string read keeps flags at default values +TEST(FlagFileTest, FailReadFlagsFromString) { + FLAGS_test_int32 = 119; + string flags("# let's make sure it can update values\n" + "-test_string=non_initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=illegal\n"); + + EXPECT_FALSE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + false)); + + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ("initial", FLAGS_test_string); +} + +// Tests that flags can be set to ordinary values. +TEST(SetFlagValueTest, OrdinaryValues) { + EXPECT_EQ("initial", FLAGS_test_str1); + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // set; was default + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // already set once + + FLAGS_test_str1 = "initial"; + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("initial", FLAGS_test_str1); // still already set before + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str1); // changed value + + SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str1); + // value not changed (already set before) + + EXPECT_EQ("initial", FLAGS_test_str2); + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); // changed (was default) + + FLAGS_test_str2 = "extra"; + EXPECT_EQ("extra", FLAGS_test_str2); + + FLAGS_test_str2 = "second"; + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str2); // still changed (was equal to default) + + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str2); // changed (was default) + + EXPECT_EQ("initial", FLAGS_test_str3); + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str3); // changed + + FLAGS_test_str3 = "third"; + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE); + EXPECT_EQ("fourth", FLAGS_test_str3); // changed value +} + + +// Tests that flags can be set to exceptional values. +// Note: apparently MINGW doesn't parse inf and nan correctly: +// http://www.mail-archive.com/bug-gnulib@gnu.org/msg09573.html +// This url says FreeBSD also has a problem, but I didn't see that. +TEST(SetFlagValueTest, ExceptionalValues) { +#if defined(isinf) && !defined(__MINGW32__) + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "inf")); + EXPECT_INF(FLAGS_test_double); + + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "INF")); + EXPECT_INF(FLAGS_test_double); +#endif + + // set some bad values + EXPECT_EQ("", + SetCommandLineOption("test_double", "0.1xxx")); + EXPECT_EQ("", + SetCommandLineOption("test_double", " ")); + EXPECT_EQ("", + SetCommandLineOption("test_double", "")); +#if defined(isinf) && !defined(__MINGW32__) + EXPECT_EQ("test_double set to -inf\n", + SetCommandLineOption("test_double", "-inf")); + EXPECT_INF(FLAGS_test_double); + EXPECT_GT(0, FLAGS_test_double); +#endif + +#if defined(isnan) && !defined(__MINGW32__) + EXPECT_EQ("test_double set to nan\n", + SetCommandLineOption("test_double", "NaN")); + EXPECT_NAN(FLAGS_test_double); +#endif +} + +// Tests that integer flags can be specified in many ways +TEST(SetFlagValueTest, DifferentRadices) { + EXPECT_EQ("test_int32 set to 12\n", + SetCommandLineOption("test_int32", "12")); + + EXPECT_EQ("test_int32 set to 16\n", + SetCommandLineOption("test_int32", "0x10")); + + EXPECT_EQ("test_int32 set to 34\n", + SetCommandLineOption("test_int32", "0X22")); + + // Leading 0 is *not* octal; it's still decimal + EXPECT_EQ("test_int32 set to 10\n", + SetCommandLineOption("test_int32", "010")); +} + +// Tests what happens when you try to set a flag to an illegal value +TEST(SetFlagValueTest, IllegalValues) { + FLAGS_test_bool = true; + FLAGS_test_int32 = 119; + FLAGS_test_int64 = 1191; + FLAGS_test_uint32 = 11911; + FLAGS_test_uint64 = 119111; + + EXPECT_EQ("", + SetCommandLineOption("test_bool", "12")); + + EXPECT_EQ("", + SetCommandLineOption("test_uint32", "-1970")); + + EXPECT_EQ("", + SetCommandLineOption("test_int32", "7000000000000")); + + EXPECT_EQ("", + SetCommandLineOption("test_uint64", "-1")); + + EXPECT_EQ("", + SetCommandLineOption("test_int64", "not a number!")); + + // Test the empty string with each type of input + EXPECT_EQ("", SetCommandLineOption("test_bool", "")); + EXPECT_EQ("", SetCommandLineOption("test_int32", "")); + EXPECT_EQ("", SetCommandLineOption("test_int64", "")); + EXPECT_EQ("", SetCommandLineOption("test_uint32", "")); + EXPECT_EQ("", SetCommandLineOption("test_uint64", "")); + EXPECT_EQ("", SetCommandLineOption("test_double", "")); + EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", "")); + + EXPECT_TRUE(FLAGS_test_bool); + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ(1191, FLAGS_test_int64); + EXPECT_EQ(11911, FLAGS_test_uint32); + EXPECT_EQ(119111, FLAGS_test_uint64); +} + + +// Tests that we only evaluate macro args once +TEST(MacroArgs, EvaluateOnce) { + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure we don't ++ the value somehow, when evaluating the flag. + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure the macro only evaluated this var once. + EXPECT_EQ(13, changeable_var); + // Make sure the actual value and default value are the same + SetCommandLineOptionWithMode("changeable_var", "21", SET_FLAG_IF_DEFAULT); + EXPECT_EQ(21, FLAGS_changeable_var); +} + +TEST(MacroArgs, EvaluateOnceBool) { + EXPECT_TRUE(FLAGS_changeable_bool_var); + EXPECT_TRUE(FLAGS_changeable_bool_var); + EXPECT_EQ(8009, changeable_bool_var); + SetCommandLineOptionWithMode("changeable_bool_var", "false", + SET_FLAG_IF_DEFAULT); + EXPECT_FALSE(FLAGS_changeable_bool_var); +} + +TEST(MacroArgs, EvaluateOnceStrings) { + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ(1, changeable_string_var); + SetCommandLineOptionWithMode("changeable_string_var", "different", + SET_FLAG_IF_DEFAULT); + EXPECT_EQ("different", FLAGS_changeable_string_var); +} + +// Tests that the FooFromEnv does the right thing +TEST(FromEnvTest, LegalValues) { + setenv("BOOL_VAL1", "true", 1); + setenv("BOOL_VAL2", "false", 1); + setenv("BOOL_VAL3", "1", 1); + setenv("BOOL_VAL4", "F", 1); + EXPECT_TRUE(BoolFromEnv("BOOL_VAL1", false)); + EXPECT_FALSE(BoolFromEnv("BOOL_VAL2", true)); + EXPECT_TRUE(BoolFromEnv("BOOL_VAL3", false)); + EXPECT_FALSE(BoolFromEnv("BOOL_VAL4", true)); + EXPECT_TRUE(BoolFromEnv("BOOL_VAL_UNKNOWN", true)); + EXPECT_FALSE(BoolFromEnv("BOOL_VAL_UNKNOWN", false)); + + setenv("INT_VAL1", "1", 1); + setenv("INT_VAL2", "-1", 1); + EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10)); + EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10)); + EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10)); + + setenv("INT_VAL3", "4294967295", 1); + EXPECT_EQ(1, Uint32FromEnv("INT_VAL1", 10)); + EXPECT_EQ(4294967295L, Uint32FromEnv("INT_VAL3", 30)); + EXPECT_EQ(10, Uint32FromEnv("INT_VAL_UNKNOWN", 10)); + + setenv("INT_VAL4", "1099511627776", 1); + EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20)); + EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20)); + EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL4", 20)); + EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20)); + + EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30)); + EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL4", 30)); + EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30)); + + // I pick values here that can be easily represented exactly in floating-point + setenv("DOUBLE_VAL1", "0.0", 1); + setenv("DOUBLE_VAL2", "1.0", 1); + setenv("DOUBLE_VAL3", "-1.0", 1); + EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0)); + EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0)); + EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0)); + EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0)); + + setenv("STRING_VAL1", "", 1); + setenv("STRING_VAL2", "my happy string!", 1); + EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown")); + EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown")); + EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown")); +} + +#ifdef GTEST_HAS_DEATH_TEST +// Tests that the FooFromEnv dies on parse-error +TEST(FromEnvDeathTest, IllegalValues) { + setenv("BOOL_BAD1", "so true!", 1); + setenv("BOOL_BAD2", "", 1); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable"); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable"); + + setenv("INT_BAD1", "one", 1); + setenv("INT_BAD2", "100000000000000000", 1); + setenv("INT_BAD3", "0xx10", 1); + setenv("INT_BAD4", "", 1); + EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable"); + + EXPECT_DEATH(Uint32FromEnv("INT_BAD1", 10), "error parsing env variable"); + EXPECT_DEATH(Uint32FromEnv("INT_BAD2", 10), "error parsing env variable"); + EXPECT_DEATH(Uint32FromEnv("INT_BAD3", 10), "error parsing env variable"); + EXPECT_DEATH(Uint32FromEnv("INT_BAD4", 10), "error parsing env variable"); + + setenv("BIGINT_BAD1", "18446744073709551616000", 1); + EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable"); + + setenv("BIGINT_BAD2", "-1", 1); + EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable"); + // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 +#if 0 + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable"); +#endif + + setenv("DOUBLE_BAD1", "0.0.0", 1); + setenv("DOUBLE_BAD2", "", 1); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable"); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable"); +} +#endif + + +// Tests that FlagSaver can save the states of string flags. +TEST(FlagSaverTest, CanSaveStringFlagStates) { + // 1. Initializes the flags. + + // State of flag test_str1: + // default value - "initial" + // current value - "initial" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE); + // State of flag test_str2: + // default value - "initial" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + // State of flag test_str3: + // default value - "second" + // current value - "second" + // not set - true + + // 2. Saves the flag states. + + { + FlagSaver fs; + + // 3. Modifies the flag states. + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE); + EXPECT_EQ("second", FLAGS_test_str1); + // State of flag test_str1: + // default value - "second" + // current value - "second" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + // State of flag test_str2: + // default value - "third" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str3); + // State of flag test_str1: + // default value - "second" + // current value - "third" + // not set - false + + // 4. Restores the flag states. + } + + // 5. Verifies that the states were restored. + + // Verifies that the value of test_str1 was restored. + EXPECT_EQ("initial", FLAGS_test_str1); + // Verifies that the "not set" attribute of test_str1 was restored to true. + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); + + // Verifies that the value of test_str2 was restored. + EXPECT_EQ("second", FLAGS_test_str2); + // Verifies that the "not set" attribute of test_str2 was restored to false. + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + + // Verifies that the value of test_str3 was restored. + EXPECT_EQ("second", FLAGS_test_str3); + // Verifies that the "not set" attribute of test_str3 was restored to true. + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str3); +} + + +// Tests that FlagSaver can save the values of various-typed flags. +TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) { + // Initializes the flags. + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_uint32 = 2; + FLAGS_test_int64 = -3; + FLAGS_test_uint64 = 4; + FLAGS_test_double = 5.0; + FLAGS_test_string = "good"; + + // Saves the flag states. + { + FlagSaver fs; + + // Modifies the flags. + FLAGS_test_bool = true; + FLAGS_test_int32 = -5; + FLAGS_test_uint32 = 6; + FLAGS_test_int64 = -7; + FLAGS_test_uint64 = 8; + FLAGS_test_double = 8.0; + FLAGS_test_string = "bad"; + + // Restores the flag states. + } + + // Verifies the flag values were restored. + EXPECT_FALSE(FLAGS_test_bool); + EXPECT_EQ(-1, FLAGS_test_int32); + EXPECT_EQ(2, FLAGS_test_uint32); + EXPECT_EQ(-3, FLAGS_test_int64); + EXPECT_EQ(4, FLAGS_test_uint64); + EXPECT_DOUBLE_EQ(5.0, FLAGS_test_double); + EXPECT_EQ("good", FLAGS_test_string); +} + +TEST(GetAllFlagsTest, BaseTest) { + vector flags; + GetAllFlags(&flags); + bool found_test_bool = false; + vector::const_iterator i; + for (i = flags.begin(); i != flags.end(); ++i) { + if (i->name == "test_bool") { + found_test_bool = true; + EXPECT_EQ(i->type, "bool"); + EXPECT_EQ(i->default_value, "false"); + EXPECT_EQ(i->flag_ptr, &FLAGS_test_bool); + break; + } + } + EXPECT_TRUE(found_test_bool); +} + +TEST(ShowUsageWithFlagsTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --help. +} + +TEST(ShowUsageWithFlagsRestrictTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --helpmatch. +} + +// Note: all these argv-based tests depend on SetArgv being called +// before ParseCommandLineFlags() in main(), below. +TEST(GetArgvsTest, BaseTest) { + vector argvs = GetArgvs(); + EXPECT_EQ(4, argvs.size()); + EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]); + EXPECT_EQ("argv 2", argvs[1]); + EXPECT_EQ("3rd argv", argvs[2]); + EXPECT_EQ("argv #4", argvs[3]); +} + +TEST(GetArgvTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest " + "argv 2 3rd argv argv #4", GetArgv()); +} + +TEST(GetArgv0Test, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0()); +} + +TEST(GetArgvSumTest, BaseTest) { + // This number is just the sum of the ASCII values of all the chars + // in GetArgv(). + EXPECT_EQ(4904, GetArgvSum()); +} + +TEST(ProgramInvocationNameTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", + ProgramInvocationName()); +} + +TEST(ProgramInvocationShortNameTest, BaseTest) { + EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName()); +} + +TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to ParseCommandLineFlags() + EXPECT_STREQ("/test/argv/for/gflags_unittest: " + " [...]\nDoes something useless.\n", + ProgramUsage()); +} + +TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { + string value("will be changed"); + bool r = GetCommandLineOption("test_bool", &value); + EXPECT_TRUE(r); + EXPECT_EQ("false", value); + + r = GetCommandLineOption("test_int32", &value); + EXPECT_TRUE(r); + EXPECT_EQ("-1", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_TRUE(r); + EXPECT_EQ("400", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { + SetCommandLineOption("test_int32", "700"); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_TRUE(r); + EXPECT_EQ("700", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { + // This doesn't set the flag's value, but rather its default value. + // is_default is still true, but the 'default' value returned has changed! + SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_TRUE(r); + EXPECT_EQ("800", value); + EXPECT_TRUE(GetCommandLineFlagInfoOrDie("test_int32").is_default); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { + SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_TRUE(r); + EXPECT_EQ("900", value); +} + +TEST(GetCommandLineOptionTest, NameDoesNotExist) { + string value("will not be changed"); + const bool r = GetCommandLineOption("test_int3210", &value); + EXPECT_FALSE(r); + EXPECT_EQ("will not be changed", value); +} + +TEST(GetCommandLineFlagInfoTest, FlagExists) { + CommandLineFlagInfo info; + bool r = GetCommandLineFlagInfo("test_int32", &info); + EXPECT_TRUE(r); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_TRUE(info.is_default); + EXPECT_FALSE(info.has_validator_fn); + EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); + + FLAGS_test_bool = true; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_TRUE(r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_FALSE(info.is_default); + EXPECT_FALSE(info.has_validator_fn); + EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); + + FLAGS_test_bool = false; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_TRUE(r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_FALSE(info.is_default); // value is same, but flag *was* modified + EXPECT_FALSE(info.has_validator_fn); + EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); +} + +TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { + CommandLineFlagInfo info; + // Set to some random values that GetCommandLineFlagInfo should not change + info.name = "name"; + info.type = "type"; + info.current_value = "curr"; + info.default_value = "def"; + info.filename = "/"; + info.is_default = false; + info.has_validator_fn = true; + info.flag_ptr = NULL; + bool r = GetCommandLineFlagInfo("test_int3210", &info); + EXPECT_FALSE(r); + EXPECT_EQ("name", info.name); + EXPECT_EQ("type", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("curr", info.current_value); + EXPECT_EQ("def", info.default_value); + EXPECT_EQ("/", info.filename); + EXPECT_FALSE(info.is_default); + EXPECT_TRUE(info.has_validator_fn); + EXPECT_EQ(NULL, info.flag_ptr); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_TRUE(info.is_default); + EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_TRUE(info.is_default); + EXPECT_FALSE(info.has_validator_fn); + EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("400", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_FALSE(info.is_default); + EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); + FLAGS_test_bool = true; + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_FALSE(info.is_default); + EXPECT_FALSE(info.has_validator_fn); + EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); +} + +#ifdef GTEST_HAS_DEATH_TEST +TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) { + EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"), + ".*: flag test_int3210 does not exist"); +} +#endif + + +// These are lightly tested because they're deprecated. Basically, +// the tests are meant to cover how existing users use these functions, +// but not necessarily how new users could use them. +TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) { + string s = CommandlineFlagsIntoString(); + EXPECT_NE(string::npos, s.find("--test_bool=")); +} + +TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { + FLAGS_test_int32 = 10; // just to make the test more interesting + string filename(TmpFile("flagfile")); + unlink(filename.c_str()); // just to be safe + const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); + EXPECT_TRUE(r); + + FILE* fp; + EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "r")); + EXPECT_TRUE(fp != NULL); + char line[8192]; + EXPECT_TRUE(fgets(line, sizeof(line)-1, fp) != NULL); // get the first line + // First line should be progname. + EXPECT_STREQ("not the real argv0\n", line); + + bool found_bool = false, found_int32 = false; + while (fgets(line, sizeof(line)-1, fp)) { + line[sizeof(line)-1] = '\0'; // just to be safe + if (strcmp(line, "--test_bool=false\n") == 0) + found_bool = true; + if (strcmp(line, "--test_int32=10\n") == 0) + found_int32 = true; + } + EXPECT_TRUE(found_int32); + EXPECT_TRUE(found_bool); + fclose(fp); +} + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { + FLAGS_test_int32 = -10; // just to make the test more interesting + string filename(TmpFile("flagfile2")); + unlink(filename.c_str()); // just to be safe + bool r = AppendFlagsIntoFile(filename, GetArgv0()); + EXPECT_TRUE(r); + + FLAGS_test_int32 = -11; + r = ReadFromFlagsFile(filename, GetArgv0(), true); + EXPECT_TRUE(r); + EXPECT_EQ(-10, FLAGS_test_int32); +} // unnamed namespace + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { + FLAGS_test_int32 = -20; + string filename(TmpFile("flagfile3")); + FILE* fp; + EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "w")); + EXPECT_TRUE(fp != NULL); + // Note the error in the bool assignment below... + fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); + fclose(fp); + + FLAGS_test_int32 = -22; + const bool r = ReadFromFlagsFile(filename, GetArgv0(), false); + EXPECT_FALSE(r); + EXPECT_EQ(-22, FLAGS_test_int32); // the -21 from the flagsfile didn't take +} + +TEST(FlagsSetBeforeInitTest, TryFromEnv) { + EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); +} + +// The following test case verifies that ParseCommandLineFlags() and +// ParseCommandLineNonHelpFlags() uses the last definition of a flag +// in case it's defined more than once. + +DEFINE_int32(test_flag, -1, "used for testing gflags.cc"); + +// Parses and returns the --test_flag flag. +// If with_help is true, calls ParseCommandLineFlags; otherwise calls +// ParseCommandLineNonHelpFlags. +int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) { + FlagSaver fs; // Restores the flags before returning. + + // Makes a copy of the input array s.t. it can be reused + // (ParseCommandLineFlags() will alter the array). + char** const argv_save = new char*[argc + 1]; + char** argv = argv_save; + memcpy(argv, const_argv, sizeof(*argv)*(argc + 1)); + + if (with_help) { + ParseCommandLineFlags(&argc, &argv, true); + } else { + ParseCommandLineNonHelpFlags(&argc, &argv, true); + } + + delete[] argv_save; + return FLAGS_test_flag; +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceOnCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=1", + "--test_flag=2", + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceInFlagFile) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndThenFlagFile) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgFirst) { + const char* argv[] = { + "my_test", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(-1, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(-1, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgMiddle) { + const char* argv[] = { + "my_test", + "--test_flag=7", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(7, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(7, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) { + const char* argv[] = { + "my_test", + "-", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(0, ParseTestFlag(true, arraysize(argv) - 1, argv)); + EXPECT_EQ(0, ParseTestFlag(false, arraysize(argv) - 1, argv)); +} + +#ifdef GTEST_HAS_DEATH_TEST +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--this_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + BoolFlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--nothis_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsNotABool) { + const char* argv[] = { + "my_test", + "--notest_string", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); + EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); +} +#endif + +TEST(ParseCommandLineFlagsWrongFields, + DescriptionIsInvalid) { + // These must not be automatic variables, since command line flags + // aren't unregistered and gUnit uses FlagSaver to save and restore + // command line flags' values. If these are on the stack, then when + // later tests attempt to save and restore their values, the stack + // addresses of these variables will be overwritten... Stack smash! + static bool current_storage; + static bool defvalue_storage; + FlagRegisterer fr("flag_name", NULL, "filename", + ¤t_storage, &defvalue_storage); + CommandLineFlagInfo fi; + EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); + EXPECT_EQ("", fi.description); + EXPECT_EQ(¤t_storage, fi.flag_ptr); +} + +static bool ValidateTestFlagIs5(const char* flagname, int32 flagval) { + if (flagval == 5) + return true; + printf("%s isn't 5!\n", flagname); + return false; +} + +static bool ValidateTestFlagIs10(const char* flagname, int32 flagval) { + return flagval == 10; +} + + +TEST(FlagsValidator, ValidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=5", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ(5, ParseTestFlag(true, arraysize(argv) - 1, argv)); + // Undo the flag validator setting + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAG_IF_DEFAULT)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_VALUE)); + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_DEFAULT)); + EXPECT_NE("", SetCommandLineOption("test_flag", "5")); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +#ifdef GTEST_HAS_DEATH_TEST +TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=50", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), + "ERROR: failed validation of new value '50' for flag 'test_flag'"); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} +#endif + +TEST(FlagsValidator, InvalidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAG_IF_DEFAULT)); + EXPECT_EQ(-1, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, InvalidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_VALUE)); + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_DEFAULT)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); + EXPECT_EQ(100, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +#ifdef GTEST_HAS_DEATH_TEST +TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) { + // If a flag keeps its default value, and that default value is + // invalid, we should die at argv-parse time. + const char* argv[] = { + "my_test", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), + "ERROR: --test_flag must be set on the commandline"); +} +#endif + +TEST(FlagsValidator, InvalidFlagPtr) { + int32 dummy; + EXPECT_FALSE(RegisterFlagValidator(NULL, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&dummy, &ValidateTestFlagIs5)); +} + +TEST(FlagsValidator, RegisterValidatorTwice) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, CommandLineFlagInfo) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_TRUE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); +} + +TEST(FlagsValidator, FlagSaver) { + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // fails validation + } + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // validator is gone + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // no validator + } + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // validator is back +} + + +} // unnamed namespace + +static int main(int argc, char **argv) { + + // Run unit tests only if called without arguments, otherwise this program + // is used by an "external" usage test + const bool run_tests = (argc == 1); + + // We need to call SetArgv before parsing flags, so our "test" argv will + // win out over this executable's real argv. That makes running this + // test with a real --help flag kinda annoying, unfortunately. + const char* test_argv[] = { "/test/argv/for/gflags_unittest", + "argv 2", "3rd argv", "argv #4" }; + SetArgv(arraysize(test_argv), test_argv); + + // The first arg is the usage message, also important for testing. + string usage_message = (string(GetArgv0()) + + ": [...]\nDoes something useless.\n"); + + // We test setting tryfromenv manually, and making sure + // ParseCommandLineFlags still evaluates it. + FLAGS_tryfromenv = "test_tryfromenv"; + setenv("FLAGS_test_tryfromenv", "pre-set", 1); + + // Modify flag values from declared default value in two ways. + // The recommended way: + SetCommandLineOptionWithMode("changed_bool1", "true", SET_FLAGS_DEFAULT); + + // The non-recommended way: + FLAGS_changed_bool2 = true; + + SetUsageMessage(usage_message); + SetVersionString("test_version"); + ParseCommandLineFlags(&argc, &argv, true); + MakeTmpdir(&FLAGS_test_tmpdir); + + int exit_status = 0; + if (run_tests) { + fprintf(stdout, "Running the unit tests now...\n\n"); fflush(stdout); + exit_status = RUN_ALL_TESTS(); + } else fprintf(stderr, "\n\nPASS\n"); + ShutDownCommandLineFlags(); + return exit_status; +} + +} // GFLAGS_NAMESPACE + +int main(int argc, char** argv) { + return GFLAGS_NAMESPACE::main(argc, argv); +} + diff --git a/runtime/onnxruntime/third_party/gflags/test/gflags_unittest_flagfile b/runtime/onnxruntime/third_party/gflags/test/gflags_unittest_flagfile new file mode 100644 index 0000000..f4fa0c4 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/gflags_unittest_flagfile @@ -0,0 +1,2 @@ +--test_flag=1 +--test_flag=2 diff --git a/runtime/onnxruntime/third_party/gflags/test/nc/CMakeLists.txt b/runtime/onnxruntime/third_party/gflags/test/nc/CMakeLists.txt new file mode 100644 index 0000000..d00b07d --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/nc/CMakeLists.txt @@ -0,0 +1,16 @@ +## gflags negative compilation tests + +cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) + +if (NOT TEST_NAME) + message (FATAL_ERROR "Missing TEST_NAME CMake flag") +endif () +string (TOUPPER ${TEST_NAME} TEST_NAME_UPPER) + +project (gflags_${TEST_NAME}) + +find_package (gflags REQUIRED) +include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/..") +add_definitions (-DTEST_${TEST_NAME_UPPER}) +add_executable (gflags_${TEST_NAME} gflags_nc.cc) +target_link_libraries(gflags_${TEST_NAME} gflags) diff --git a/runtime/onnxruntime/third_party/gflags/test/nc/gflags_nc.cc b/runtime/onnxruntime/third_party/gflags/test/nc/gflags_nc.cc new file mode 100644 index 0000000..1990c30 --- /dev/null +++ b/runtime/onnxruntime/third_party/gflags/test/nc/gflags_nc.cc @@ -0,0 +1,73 @@ +// Copyright (c) 2009, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// A negative comiple test for gflags. + +#include + +#if defined(TEST_NC_SWAPPED_ARGS) + +DEFINE_bool(some_bool_flag, + "the default value should go here, not the description", + false); + + +#elif defined(TEST_NC_INT_INSTEAD_OF_BOOL) + +DEFINE_bool(some_bool_flag_2, + 0, + "should have been an int32 flag but mistakenly used bool instead"); + +#elif defined(TEST_NC_BOOL_IN_QUOTES) + + +DEFINE_bool(some_bool_flag_3, + "false", + "false in in quotes, which is wrong"); + +#elif defined(TEST_NC_SANITY) + +DEFINE_bool(some_bool_flag_4, + true, + "this is the correct usage of DEFINE_bool"); + +#elif defined(TEST_NC_DEFINE_STRING_WITH_0) + +DEFINE_string(some_string_flag, + 0, + "Trying to construct a string by passing 0 would cause a crash."); + +#endif + +int main(int, char **) +{ + return 0; +} diff --git a/runtime/onnxruntime/third_party/glog/CMakeLists.txt b/runtime/onnxruntime/third_party/glog/CMakeLists.txt new file mode 100644 index 0000000..f5c1e55 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/CMakeLists.txt @@ -0,0 +1,941 @@ +cmake_minimum_required (VERSION 3.16) +project (glog + VERSION 0.7.0 + DESCRIPTION "C++ implementation of the Google logging module" + HOMEPAGE_URL https://github.com/google/glog + LANGUAGES CXX +) + +set (CPACK_PACKAGE_NAME glog) +set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Google logging library") +set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) +set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + +list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +include (CheckCXXCompilerFlag) +include (CheckCXXSourceCompiles) +include (CheckCXXSourceRuns) +include (CheckCXXSymbolExists) +include (CheckFunctionExists) +include (CheckIncludeFileCXX) +include (CheckLibraryExists) +include (CheckStructHasMember) +include (CheckTypeSize) +include (CMakeDependentOption) +include (CMakePackageConfigHelpers) +include (CMakePushCheckState) +include (CPack) +include (CTest) +include (DetermineGflagsNamespace) +include (GenerateExportHeader) +include (GetCacheVariables) +include (GNUInstallDirs) + +option (BUILD_SHARED_LIBS "Build shared libraries" ON) +option (PRINT_UNSYMBOLIZED_STACK_TRACES + "Print file offsets in traces instead of symbolizing" OFF) +option (WITH_GFLAGS "Use gflags" ON) +option (WITH_GTEST "Use Google Test" ON) +option (WITH_PKGCONFIG "Enable pkg-config support" ON) +option (WITH_SYMBOLIZE "Enable symbolize module" ON) +option (WITH_THREADS "Enable multithreading support" ON) +option (WITH_TLS "Enable Thread Local Storage (TLS) support" ON) +option (WITH_UNWIND "Enable libunwind support" ON) + +cmake_dependent_option (WITH_GMOCK "Use Google Mock" ON WITH_GTEST OFF) + +set (WITH_FUZZING none CACHE STRING "Fuzzing engine") +set_property (CACHE WITH_FUZZING PROPERTY STRINGS none libfuzzer ossfuzz) + +if (NOT WITH_UNWIND) + set (CMAKE_DISABLE_FIND_PACKAGE_Unwind ON) +endif (NOT WITH_UNWIND) + +if (NOT WITH_GTEST) + set (CMAKE_DISABLE_FIND_PACKAGE_GTest ON) +endif (NOT WITH_GTEST) + +if (NOT WITH_THREADS) + set (CMAKE_DISABLE_FIND_PACKAGE_Threads ON) +endif (NOT WITH_THREADS) + +set (CMAKE_C_VISIBILITY_PRESET hidden) +set (CMAKE_CXX_VISIBILITY_PRESET hidden) +set (CMAKE_POSITION_INDEPENDENT_CODE ON) +set (CMAKE_VISIBILITY_INLINES_HIDDEN ON) + +set (CMAKE_DEBUG_POSTFIX d) +set (CMAKE_THREAD_PREFER_PTHREAD 1) + +find_package (GTest NO_MODULE) + +if (GTest_FOUND) + set (HAVE_LIB_GTEST 1) +endif (GTest_FOUND) + +if (WITH_GMOCK AND TARGET GTest::gmock) + set (HAVE_LIB_GMOCK 1) +endif (WITH_GMOCK AND TARGET GTest::gmock) + +if (WITH_GFLAGS) + find_package (gflags 2.2.2) + + if (gflags_FOUND) + set (HAVE_LIB_GFLAGS 1) + determine_gflags_namespace (gflags_NAMESPACE) + endif (gflags_FOUND) +endif (WITH_GFLAGS) + +find_package (Threads) +find_package (Unwind) + +if (Unwind_FOUND) + set (HAVE_LIB_UNWIND 1) +else (Unwind_FOUND) + # Check whether linking actually succeeds. ARM toolchains of LLVM unwind + # implementation do not necessarily provide the _Unwind_Backtrace function + # which causes the previous check to succeed but the linking to fail. + check_cxx_symbol_exists (_Unwind_Backtrace unwind.h HAVE__UNWIND_BACKTRACE) + check_cxx_symbol_exists (_Unwind_GetIP unwind.h HAVE__UNWIND_GETIP) +endif (Unwind_FOUND) + +check_include_file_cxx (dlfcn.h HAVE_DLFCN_H) +check_include_file_cxx (glob.h HAVE_GLOB_H) +check_include_file_cxx (memory.h HAVE_MEMORY_H) +check_include_file_cxx (pwd.h HAVE_PWD_H) +check_include_file_cxx (strings.h HAVE_STRINGS_H) +check_include_file_cxx (sys/stat.h HAVE_SYS_STAT_H) +check_include_file_cxx (sys/syscall.h HAVE_SYS_SYSCALL_H) +check_include_file_cxx (sys/time.h HAVE_SYS_TIME_H) +check_include_file_cxx (sys/types.h HAVE_SYS_TYPES_H) +check_include_file_cxx (sys/utsname.h HAVE_SYS_UTSNAME_H) +check_include_file_cxx (sys/wait.h HAVE_SYS_WAIT_H) +check_include_file_cxx (syscall.h HAVE_SYSCALL_H) +check_include_file_cxx (syslog.h HAVE_SYSLOG_H) +check_include_file_cxx (ucontext.h HAVE_UCONTEXT_H) +check_include_file_cxx (unistd.h HAVE_UNISTD_H) + +check_type_size (mode_t HAVE_MODE_T LANGUAGE CXX) +check_type_size (ssize_t HAVE_SSIZE_T LANGUAGE CXX) + +check_function_exists (dladdr HAVE_DLADDR) +check_function_exists (fcntl HAVE_FCNTL) +check_function_exists (pread HAVE_PREAD) +check_function_exists (pwrite HAVE_PWRITE) +check_function_exists (sigaction HAVE_SIGACTION) +check_function_exists (sigaltstack HAVE_SIGALTSTACK) + +check_cxx_symbol_exists (backtrace execinfo.h HAVE_EXECINFO_BACKTRACE) +check_cxx_symbol_exists (backtrace_symbols execinfo.h + HAVE_EXECINFO_BACKTRACE_SYMBOLS) + +# NOTE gcc does not fail if you pass a non-existent -Wno-* option as an +# argument. However, it will happily fail if you pass the corresponding -W* +# option. So, we check whether options that disable warnings exist by testing +# the availability of the corresponding option that enables the warning. This +# eliminates the need to check for compiler for several (mainly Clang) options. + +check_cxx_compiler_flag (-Wdeprecated HAVE_NO_DEPRECATED) +check_cxx_compiler_flag (-Wunnamed-type-template-args + HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS) + +cmake_push_check_state (RESET) + +if (Threads_FOUND) + set (CMAKE_REQUIRED_LIBRARIES Threads::Threads) +endif (Threads_FOUND) + +check_cxx_symbol_exists (pthread_threadid_np "pthread.h" HAVE_PTHREAD_THREADID_NP) +cmake_pop_check_state () + +# NOTE: Cannot use check_function_exists here since >=vc-14.0 can define +# snprintf as an inline function +check_cxx_symbol_exists (snprintf cstdio HAVE_SNPRINTF) + +check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP) + +check_cxx_source_compiles (" +#include +static void foo(void) __attribute__ ((unused)); +int main(void) { return 0; } +" HAVE___ATTRIBUTE__) + +check_cxx_source_compiles (" +#include +static void foo(void) __attribute__ ((visibility(\"default\"))); +int main(void) { return 0; } +" HAVE___ATTRIBUTE__VISIBILITY_DEFAULT) + +check_cxx_source_compiles (" +#include +static void foo(void) __attribute__ ((visibility(\"hidden\"))); +int main(void) { return 0; } +" HAVE___ATTRIBUTE__VISIBILITY_HIDDEN) + +check_cxx_source_compiles (" +int main(void) { if (__builtin_expect(0, 0)) return 1; return 0; } +" HAVE___BUILTIN_EXPECT) + +check_cxx_source_compiles (" +int main(void) +{ + int a; if (__sync_val_compare_and_swap(&a, 0, 1)) return 1; return 0; +} +" HAVE___SYNC_VAL_COMPARE_AND_SWAP) + +if (Threads_FOUND) + cmake_push_check_state (RESET) + set (CMAKE_REQUIRED_LIBRARIES Threads::Threads) + check_cxx_source_compiles (" +#define _XOPEN_SOURCE 500 +#include +int main(void) +{ + pthread_rwlock_t l; + pthread_rwlock_init(&l, NULL); + pthread_rwlock_rdlock(&l); + return 0; +} + " HAVE_RWLOCK) + cmake_pop_check_state () +endif (Threads_FOUND) + +check_cxx_source_compiles (" +__declspec(selectany) int a; +int main(void) { return 0; } +" HAVE___DECLSPEC) + +if (WITH_TLS) + set (GLOG_THREAD_LOCAL_STORAGE 1) +endif (WITH_TLS) + +set (_PC_FIELDS + "gregs[REG_PC]" + "gregs[REG_EIP]" + "gregs[REG_RIP]" + "sc_ip" + "uc_regs->gregs[PT_NIP]" + "gregs[R15]" + "arm_pc" + "mc_eip" + "mc_rip" + "__gregs[REG_EIP]" + "__gregs[REG_RIP]" + "ss.eip" + "__ss.__eip" + "ss.rip" + "__ss.__rip" + "ss.srr0" + "__ss.__srr0" +) + +set (_PC_HEADERS ucontext.h signal.h) + +if (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT) + foreach (_PC_FIELD ${_PC_FIELDS}) + foreach (_PC_HEADER ${_PC_HEADERS}) + set (_TMP + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/uctfield.cpp) + file (WRITE ${_TMP} " +#define _GNU_SOURCE 1 +#include <${_PC_HEADER}> +int main(void) +{ + ucontext_t u; + return u.${_PC_FIELD} == 0; +} +") + try_compile (HAVE_PC_FROM_UCONTEXT ${CMAKE_CURRENT_BINARY_DIR} ${_TMP} + COMPILE_DEFINITIONS _GNU_SOURCE=1) + + if (HAVE_PC_FROM_UCONTEXT) + set (PC_FROM_UCONTEXT ${_PC_FIELD} CACHE) + endif (HAVE_PC_FROM_UCONTEXT) + endforeach (_PC_HEADER) + endforeach (_PC_FIELD) +endif (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT) + +set (GOOGLE_NAMESPACE google) +set (_START_GOOGLE_NAMESPACE_ "namespace ${GOOGLE_NAMESPACE} {") +set (_END_GOOGLE_NAMESPACE_ "}") +set (ac_cv_have_glog_export 1) + +if (HAVE_LIB_GFLAGS) + set (ac_cv_have_libgflags 1) +else (HAVE_LIB_GFLAGS) + set (ac_cv_have_libgflags 0) +endif (HAVE_LIB_GFLAGS) + +if (HAVE_SYS_TYPES_H) + set (ac_cv_have_systypes_h 1) +else (HAVE_SYS_TYPES_H) + set (ac_cv_have_systypes_h 0) +endif (HAVE_SYS_TYPES_H) + +if (HAVE_SSIZE_T) + set (ac_cv_have_ssize_t 1) +else (HAVE_SSIZE_T) + set (ac_cv_have_ssize_t 0) +endif (HAVE_SSIZE_T) + +if (HAVE_MODE_T) + set (ac_cv_have_mode_t 1) +else (HAVE_MODE_T) + set (ac_cv_have_mode_t 0) +endif (HAVE_MODE_T) + +if (HAVE_UNISTD_H) + set (ac_cv_have_unistd_h 1) +else (HAVE_UNISTD_H) + set (ac_cv_have_unistd_h 0) +endif (HAVE_UNISTD_H) + +set (ac_google_namespace ${GOOGLE_NAMESPACE}) +set (ac_google_end_namespace ${_END_GOOGLE_NAMESPACE_}) +set (ac_google_start_namespace ${_START_GOOGLE_NAMESPACE_}) + +if (HAVE___ATTRIBUTE__) + set (ac_cv___attribute___noinline "__attribute__((noinline))") + set (ac_cv___attribute___printf_4_5 "__attribute__((__format__(__printf__, 4, 5)))") +elseif (HAVE___DECLSPEC) + #set (ac_cv___attribute___noinline "__declspec(noinline)") +endif (HAVE___ATTRIBUTE__) + +if (HAVE___BUILTIN_EXPECT) + set (ac_cv_have___builtin_expect 1) +else (HAVE___BUILTIN_EXPECT) + set (ac_cv_have___builtin_expect 0) +endif (HAVE___BUILTIN_EXPECT) + +if (HAVE_EXECINFO_BACKTRACE AND HAVE_EXECINFO_BACKTRACE_SYMBOLS) + set (HAVE_STACKTRACE 1) +endif (HAVE_EXECINFO_BACKTRACE AND HAVE_EXECINFO_BACKTRACE_SYMBOLS) + +if (WITH_SYMBOLIZE) + if (WIN32 OR CYGWIN) + cmake_push_check_state (RESET) + set (CMAKE_REQUIRED_LIBRARIES DbgHelp) + + check_cxx_source_runs ([=[ + #include + #include + #include + + void foobar() { } + + int main() + { + HANDLE process = GetCurrentProcess(); + + if (!SymInitialize(process, NULL, TRUE)) + return EXIT_FAILURE; + + char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; + SYMBOL_INFO *symbol = reinterpret_cast(buf); + symbol->SizeOfStruct = sizeof(SYMBOL_INFO); + symbol->MaxNameLen = MAX_SYM_NAME; + + void* const pc = reinterpret_cast(&foobar); + BOOL ret = SymFromAddr(process, reinterpret_cast(pc), 0, symbol); + + return ret ? EXIT_SUCCESS : EXIT_FAILURE; + } + ]=] HAVE_SYMBOLIZE) + + cmake_pop_check_state () + + if (HAVE_SYMBOLIZE) + set (HAVE_STACKTRACE 1) + endif (HAVE_SYMBOLIZE) + elseif (UNIX) + cmake_push_check_state (RESET) + check_cxx_source_compiles ([=[ + int main() + { + #ifndef __ELF__ + #error __ELF__ not defined + #endif + } + ]=] HAVE_SYMBOLIZE) + cmake_pop_check_state () + elseif (APPLE AND HAVE_DLADDR) + set (HAVE_SYMBOLIZE 1) + endif (WIN32 OR CYGWIN) +endif (WITH_SYMBOLIZE) + +# CMake manages symbolize availability. The definition is necessary only when +# building the library. +add_compile_definitions (GLOG_NO_SYMBOLIZE_DETECTION) + +check_cxx_source_compiles (" +#include +#include +int main() +{ + time_t timep; + struct tm result; + localtime_r(&timep, &result); + return EXIT_SUCCESS; +} +" HAVE_LOCALTIME_R) + +set (SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) + +if (WITH_THREADS AND Threads_FOUND) + if (CMAKE_USE_PTHREADS_INIT) + set (HAVE_PTHREAD 1) + endif (CMAKE_USE_PTHREADS_INIT) +else (WITH_THREADS AND Threads_FOUND) + set (NO_THREADS 1) +endif (WITH_THREADS AND Threads_FOUND) + +# fopen/open on Cygwin can not handle unix-type paths like /home/.... +# therefore we translate TEST_SRC_DIR to windows-path. +if (CYGWIN) + execute_process (COMMAND cygpath.exe -m ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE TEST_SRC_DIR) + set (TEST_SRC_DIR \"${TEST_SRC_DIR}\") +else (CYGWIN) + set (TEST_SRC_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\") +endif (CYGWIN) + +configure_file (src/config.h.cmake.in config.h) +configure_file (src/glog/logging.h.in glog/logging.h @ONLY) +configure_file (src/glog/raw_logging.h.in glog/raw_logging.h @ONLY) +configure_file (src/glog/stl_logging.h.in glog/stl_logging.h @ONLY) +configure_file (src/glog/vlog_is_on.h.in glog/vlog_is_on.h @ONLY) + +add_compile_options ($<$,$>>:-Wno-unnamed-type-template-args>) + +set (_glog_CMake_BINDIR ${CMAKE_INSTALL_BINDIR}) +set (_glog_CMake_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR}) +set (_glog_CMake_LIBDIR ${CMAKE_INSTALL_LIBDIR}) +set (_glog_CMake_INSTALLDIR ${_glog_CMake_LIBDIR}/cmake/glog) + +set (_glog_CMake_DIR glog/cmake) +set (_glog_CMake_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/${_glog_CMake_DIR}) +set (_glog_BINARY_CMake_DATADIR + ${CMAKE_CURRENT_BINARY_DIR}/${_glog_CMake_DATADIR}) + +# Add additional CMake find modules here. +set (_glog_CMake_MODULES) + +if (Unwind_FOUND) + # Copy the module only if libunwind is actually used. + list (APPEND _glog_CMake_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindUnwind.cmake) +endif (Unwind_FOUND) + +# Generate file name for each module in the binary directory +foreach (_file ${_glog_CMake_MODULES}) + get_filename_component (_module "${_file}" NAME) + + list (APPEND _glog_BINARY_CMake_MODULES + ${_glog_BINARY_CMake_DATADIR}/${_module}) +endforeach (_file) + +if (_glog_CMake_MODULES) + # Copy modules to binary directory during the build + add_custom_command (OUTPUT ${_glog_BINARY_CMake_MODULES} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${_glog_BINARY_CMake_DATADIR} + COMMAND ${CMAKE_COMMAND} -E copy ${_glog_CMake_MODULES} + ${_glog_BINARY_CMake_DATADIR} + DEPENDS ${_glog_CMake_MODULES} + COMMENT "Copying find modules..." + ) +endif (_glog_CMake_MODULES) + +set (GLOG_PUBLIC_H + ${CMAKE_CURRENT_BINARY_DIR}/glog/export.h + ${CMAKE_CURRENT_BINARY_DIR}/glog/logging.h + ${CMAKE_CURRENT_BINARY_DIR}/glog/raw_logging.h + ${CMAKE_CURRENT_BINARY_DIR}/glog/stl_logging.h + ${CMAKE_CURRENT_BINARY_DIR}/glog/vlog_is_on.h + src/glog/log_severity.h + src/glog/platform.h +) + +set (GLOG_SRCS + ${GLOG_PUBLIC_H} + src/base/commandlineflags.h + src/base/googleinit.h + src/base/mutex.h + src/demangle.cc + src/demangle.h + src/logging.cc + src/raw_logging.cc + src/symbolize.cc + src/symbolize.h + src/utilities.cc + src/utilities.h + src/vlog_is_on.cc +) + +if (HAVE_PTHREAD OR WIN32 OR CYGWIN) + list (APPEND GLOG_SRCS src/signalhandler.cc) +endif (HAVE_PTHREAD OR WIN32 OR CYGWIN) + +if (CYGWIN OR WIN32) + list (APPEND GLOG_SRCS + src/windows/port.cc + src/windows/port.h + ) +endif (CYGWIN OR WIN32) + +add_library (glog_internal OBJECT + ${_glog_BINARY_CMake_MODULES} + ${GLOG_SRCS} +) +target_compile_features (glog_internal PUBLIC $) + +add_library (glog + $ +) +target_compile_features (glog PUBLIC cxx_std_14) + +add_library (glog::glog ALIAS glog) + +set (glog_libraries_options_for_static_linking) + +if (Unwind_FOUND) + target_link_libraries (glog PRIVATE unwind::unwind) + set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lunwind") + set (Unwind_DEPENDENCY "find_dependency (Unwind ${Unwind_VERSION})") +endif (Unwind_FOUND) + +if (HAVE_DBGHELP) + target_link_libraries (glog PRIVATE dbghelp) + set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -ldbghelp") +endif (HAVE_DBGHELP) + +if (HAVE_PTHREAD) + target_link_libraries (glog PRIVATE ${CMAKE_THREAD_LIBS_INIT}) + + if (CMAKE_THREAD_LIBS_INIT) + set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} ${CMAKE_THREAD_LIBS_INIT}") + endif (CMAKE_THREAD_LIBS_INIT) +endif (HAVE_PTHREAD) + +if (gflags_FOUND) + # Prefer the gflags target that uses double colon convention + if (TARGET gflags::gflags) + target_link_libraries (glog PUBLIC gflags::gflags) + else (TARGET gflags::gflags) + target_link_libraries (glog PUBLIC gflags) + endif (TARGET gflags::gflags) + + set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lgflags") +endif (gflags_FOUND) + +if (ANDROID) + target_link_libraries (glog PRIVATE log) + set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -llog") +endif (ANDROID) + +set_target_properties (glog PROPERTIES VERSION ${PROJECT_VERSION}) +set_target_properties (glog PROPERTIES SOVERSION 1) + +if (CYGWIN OR WIN32) + target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES) +endif (CYGWIN OR WIN32) + +set_target_properties (glog PROPERTIES PUBLIC_HEADER "${GLOG_PUBLIC_H}") + +target_include_directories (glog BEFORE PUBLIC + "$" + "$" + "$" + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) + +if (CYGWIN OR WIN32) + target_include_directories (glog_internal PUBLIC + "$" + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/windows) + + target_include_directories (glog PUBLIC + "$" + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/windows) +endif (CYGWIN OR WIN32) + +set_target_properties (glog PROPERTIES DEFINE_SYMBOL GOOGLE_GLOG_IS_A_DLL) + +target_include_directories (glog_internal PUBLIC + $) +target_compile_definitions (glog_internal PUBLIC + $ + PRIVATE GOOGLE_GLOG_IS_A_DLL) + +generate_export_header (glog + EXPORT_MACRO_NAME GLOG_EXPORT + EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/glog/export.h) + +string (STRIP "${glog_libraries_options_for_static_linking}" glog_libraries_options_for_static_linking) + +if (WITH_PKGCONFIG) + set (VERSION ${PROJECT_VERSION}) + set (prefix ${CMAKE_INSTALL_PREFIX}) + set (exec_prefix ${CMAKE_INSTALL_FULL_BINDIR}) + set (libdir ${CMAKE_INSTALL_FULL_LIBDIR}) + set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) + + configure_file ( + "${PROJECT_SOURCE_DIR}/libglog.pc.in" + "${PROJECT_BINARY_DIR}/libglog.pc" + @ONLY + ) + + unset (VERSION) + unset (prefix) + unset (exec_prefix) + unset (libdir) + unset (includedir) +endif (WITH_PKGCONFIG) + +# Unit testing + +if (NOT WITH_FUZZING STREQUAL "none") + add_executable (fuzz_demangle + src/fuzz_demangle.cc + ) + + if (WITH_FUZZING STREQUAL "ossfuzz") + set (LIB_FUZZING_ENGINE $ENV{LIB_FUZZING_ENGINE}) + target_link_libraries (fuzz_demangle PRIVATE glog ${LIB_FUZZING_ENGINE}) + elseif (WITH_FUZZING STREQUAL "libfuzzer") + target_compile_options (fuzz_demangle PRIVATE -fsanitize=fuzzer) + target_link_libraries (fuzz_demangle PRIVATE glog) + else (WITH_FUZZING STREQUAL "libfuzzer") + message (FATAL_ERROR "Unsupported fuzzing engine ${WITH_FUZZING}") + endif (WITH_FUZZING STREQUAL "ossfuzz") +endif (NOT WITH_FUZZING STREQUAL "none") + +if (BUILD_TESTING) + add_library (glogtest STATIC + $ + ) + + target_include_directories (glogtest PUBLIC + $) + target_compile_definitions (glogtest PUBLIC + $ GLOG_STATIC_DEFINE) + target_link_libraries (glogtest PUBLIC + $) + + set (_GLOG_TEST_LIBS glogtest) + + if (HAVE_LIB_GTEST) + list (APPEND _GLOG_TEST_LIBS GTest::gtest) + endif (HAVE_LIB_GTEST) + + if (HAVE_LIB_GMOCK) + list (APPEND _GLOG_TEST_LIBS GTest::gmock) + endif (HAVE_LIB_GMOCK) + + add_executable (logging_unittest + src/logging_unittest.cc + ) + + target_link_libraries (logging_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + add_executable (stl_logging_unittest + src/stl_logging_unittest.cc + ) + + target_link_libraries (stl_logging_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + if (HAVE_NO_DEPRECATED) + set_property (TARGET stl_logging_unittest APPEND PROPERTY COMPILE_OPTIONS + -Wno-deprecated) + endif (HAVE_NO_DEPRECATED) + + if (HAVE_EXT_SLIST) + target_compile_definitions (stl_logging_unittest PRIVATE + GLOG_STL_LOGGING_FOR_EXT_SLIST) + endif (HAVE_EXT_SLIST) + + if (HAVE_SYMBOLIZE) + add_executable (symbolize_unittest + src/symbolize_unittest.cc + ) + + target_link_libraries (symbolize_unittest PRIVATE ${_GLOG_TEST_LIBS}) + endif (HAVE_SYMBOLIZE) + + add_executable (demangle_unittest + src/demangle_unittest.cc + ) + + target_link_libraries (demangle_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + if (HAVE_STACKTRACE) + add_executable (stacktrace_unittest + src/stacktrace_unittest.cc + ) + + target_link_libraries (stacktrace_unittest PRIVATE ${_GLOG_TEST_LIBS}) + endif (HAVE_STACKTRACE) + + add_executable (utilities_unittest + src/utilities_unittest.cc + ) + + target_link_libraries (utilities_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + if (HAVE_STACKTRACE AND HAVE_SYMBOLIZE) + add_executable (signalhandler_unittest + src/signalhandler_unittest.cc + ) + + target_link_libraries (signalhandler_unittest PRIVATE ${_GLOG_TEST_LIBS}) + endif (HAVE_STACKTRACE AND HAVE_SYMBOLIZE) + + add_test (NAME demangle COMMAND demangle_unittest) + add_test (NAME logging COMMAND logging_unittest) + + set_tests_properties (logging PROPERTIES TIMEOUT 30) + # MacOS diff is not deterministic: use the output to determine whether the + # test passed. + set_tests_properties (logging PROPERTIES PASS_REGULAR_EXPRESSION ".*\nPASS\n.*") + + # FIXME: Skip flaky test + set_tests_properties (logging PROPERTIES SKIP_REGULAR_EXPRESSION + "Check failed: time_ns within LogTimes::LOG_PERIOD_TOL_NS of LogTimes::LOG_PERIOD_NS") + + if (APPLE) + # FIXME: Skip flaky test + set_property (TEST logging APPEND PROPERTY SKIP_REGULAR_EXPRESSION + "unexpected new.*PASS\nTest with golden file failed. We'll try to show the diff:") + endif (APPLE) + + if (TARGET signalhandler_unittest) + add_test (NAME signalhandler COMMAND signalhandler_unittest) + endif (TARGET signalhandler_unittest) + + if (TARGET stacktrace_unittest) + add_test (NAME stacktrace COMMAND stacktrace_unittest) + set_tests_properties (stacktrace PROPERTIES TIMEOUT 30) + endif (TARGET stacktrace_unittest) + + add_test (NAME stl_logging COMMAND stl_logging_unittest) + + if (TARGET symbolize_unittest) + add_test (NAME symbolize COMMAND symbolize_unittest) + + # FIXME: Skip flaky test when compiled in C++20 mode + set_tests_properties (symbolize PROPERTIES SKIP_REGULAR_EXPRESSION + [=[Check failed: streq\("nonstatic_func"\, TrySymbolize\(\(void \*\)\(&nonstatic_func\)\)\)]=]) + endif (TARGET symbolize_unittest) + + if (HAVE_LIB_GMOCK) + add_executable (mock-log_unittest + src/mock-log_unittest.cc + src/mock-log.h + ) + + target_link_libraries (mock-log_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + add_test (NAME mock-log COMMAND mock-log_unittest) + endif (HAVE_LIB_GMOCK) + + # Generate an initial cache + + get_cache_variables (_CACHEVARS) + + set (_INITIAL_CACHE + ${CMAKE_CURRENT_BINARY_DIR}/test_package_config/glog_package_config_initial_cache.cmake) + + # Package config test + + add_test (NAME cmake_package_config_init COMMAND ${CMAKE_COMMAND} + -DTEST_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_package_config + -DINITIAL_CACHE=${_INITIAL_CACHE} + -DCACHEVARS=${_CACHEVARS} + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestInitPackageConfig.cmake + ) + + add_test (NAME cmake_package_config_generate COMMAND ${CMAKE_COMMAND} + -DGENERATOR=${CMAKE_GENERATOR} + -DGENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -DGENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} + -DINITIAL_CACHE=${_INITIAL_CACHE} + -DPACKAGE_DIR=${CMAKE_CURRENT_BINARY_DIR} + -DPATH=$ENV{PATH} + -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/src/package_config_unittest/working_config + -DTEST_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_package_config/working_config + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestPackageConfig.cmake + ) + + add_test (NAME cmake_package_config_build COMMAND + ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/test_package_config/working_config + --config $ + ) + + add_test (NAME cmake_package_config_cleanup COMMAND ${CMAKE_COMMAND} -E + remove_directory + ${CMAKE_CURRENT_BINARY_DIR}/test_package_config + ) + + # Fixtures setup + set_tests_properties (cmake_package_config_init PROPERTIES FIXTURES_SETUP + cmake_package_config) + set_tests_properties (cmake_package_config_generate PROPERTIES FIXTURES_SETUP + cmake_package_config_working) + + # Fixtures cleanup + set_tests_properties (cmake_package_config_cleanup PROPERTIES FIXTURES_CLEANUP + cmake_package_config) + + # Fixture requirements + set_tests_properties (cmake_package_config_generate PROPERTIES + FIXTURES_REQUIRED cmake_package_config) + set_tests_properties (cmake_package_config_build PROPERTIES + FIXTURES_REQUIRED "cmake_package_config;cmake_package_config_working") + + add_executable (cleanup_immediately_unittest + src/cleanup_immediately_unittest.cc) + + target_link_libraries (cleanup_immediately_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + add_executable (cleanup_with_absolute_prefix_unittest + src/cleanup_with_absolute_prefix_unittest.cc) + + target_link_libraries (cleanup_with_absolute_prefix_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + add_executable (cleanup_with_relative_prefix_unittest + src/cleanup_with_relative_prefix_unittest.cc) + + target_link_libraries (cleanup_with_relative_prefix_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + set (CLEANUP_LOG_DIR ${CMAKE_CURRENT_BINARY_DIR}/cleanup_tests) + + add_test (NAME cleanup_init COMMAND + ${CMAKE_COMMAND} -E make_directory ${CLEANUP_LOG_DIR}) + add_test (NAME cleanup_logdir COMMAND + ${CMAKE_COMMAND} -E remove_directory ${CLEANUP_LOG_DIR}) + add_test (NAME cleanup_immediately COMMAND + ${CMAKE_COMMAND} + -DLOGCLEANUP=$ + # NOTE The trailing slash is important + -DTEST_DIR=${CLEANUP_LOG_DIR}/ + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RunCleanerTest1.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test (NAME cleanup_with_absolute_prefix COMMAND + ${CMAKE_COMMAND} + -DLOGCLEANUP=$ + -DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/ + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RunCleanerTest2.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test (NAME cleanup_with_relative_prefix COMMAND + ${CMAKE_COMMAND} + -DLOGCLEANUP=$ + -DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/ + -DTEST_SUBDIR=test_subdir/ + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RunCleanerTest3.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + # Fixtures setup + set_tests_properties (cleanup_init PROPERTIES FIXTURES_SETUP logcleanuptest) + ## Fixtures cleanup + set_tests_properties (cleanup_logdir PROPERTIES FIXTURES_CLEANUP logcleanuptest) + # Fixture requirements + set_tests_properties (cleanup_immediately PROPERTIES FIXTURES_REQUIRED logcleanuptest) + set_tests_properties (cleanup_with_absolute_prefix PROPERTIES FIXTURES_REQUIRED logcleanuptest) + set_tests_properties (cleanup_with_relative_prefix PROPERTIES FIXTURES_REQUIRED logcleanuptest) +endif (BUILD_TESTING) + +install (TARGETS glog + EXPORT glog-targets + RUNTIME DESTINATION ${_glog_CMake_BINDIR} + PUBLIC_HEADER DESTINATION ${_glog_CMake_INCLUDE_DIR}/glog + LIBRARY DESTINATION ${_glog_CMake_LIBDIR} + ARCHIVE DESTINATION ${_glog_CMake_LIBDIR}) + +if (WITH_PKGCONFIG) + install ( + FILES "${PROJECT_BINARY_DIR}/libglog.pc" + DESTINATION "${_glog_CMake_LIBDIR}/pkgconfig" + ) +endif (WITH_PKGCONFIG) + +set (glog_CMake_VERSION 3.0) + +if (gflags_FOUND) + # Ensure clients locate only the package config and not third party find + # modules having the same name. This avoid cmake_policy PUSH/POP errors. + if (CMAKE_VERSION VERSION_LESS 3.9) + set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION})") + else (CMAKE_VERSION VERSION_LESS 3.9) + # Passing additional find_package arguments to find_dependency is possible + # starting with CMake 3.9. + set (glog_CMake_VERSION 3.9) + set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION} NO_MODULE)") + endif (CMAKE_VERSION VERSION_LESS 3.9) +endif (gflags_FOUND) + +configure_package_config_file (glog-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake + INSTALL_DESTINATION ${_glog_CMake_INSTALLDIR} + NO_CHECK_REQUIRED_COMPONENTS_MACRO) + +write_basic_package_version_file ( + ${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake + COMPATIBILITY SameMajorVersion) + +export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake) +export (PACKAGE glog) + +get_filename_component (_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) + +# Directory containing the find modules relative to the config install +# directory. +file (RELATIVE_PATH glog_REL_CMake_MODULES + ${_PREFIX}/${_glog_CMake_INSTALLDIR} + ${_PREFIX}/${_glog_CMake_DATADIR}/glog-modules.cmake) + +get_filename_component (glog_REL_CMake_DATADIR ${glog_REL_CMake_MODULES} + DIRECTORY) + +set (glog_FULL_CMake_DATADIR + ${CMAKE_CURRENT_BINARY_DIR}/${_glog_CMake_DATADIR}) + +configure_file (glog-modules.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/glog-modules.cmake @ONLY) + +install (CODE +" +set (glog_FULL_CMake_DATADIR \"\\\${CMAKE_CURRENT_LIST_DIR}/${glog_REL_CMake_DATADIR}\") +set (glog_DATADIR_DESTINATION ${_glog_CMake_INSTALLDIR}) + +if (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR}) + set (glog_DATADIR_DESTINATION \"\${CMAKE_INSTALL_PREFIX}/\${glog_DATADIR_DESTINATION}\") +endif (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR}) + +configure_file (\"${CMAKE_CURRENT_SOURCE_DIR}/glog-modules.cmake.in\" + \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" @ONLY) +file (INSTALL + \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" + DESTINATION + \"\${glog_DATADIR_DESTINATION}\") +" + COMPONENT Development +) + +install (FILES + ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake + DESTINATION ${_glog_CMake_INSTALLDIR}) + +# Find modules in share/glog/cmake +install (DIRECTORY ${_glog_BINARY_CMake_DATADIR} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/glog + COMPONENT Development + FILES_MATCHING PATTERN "*.cmake" +) + +install (EXPORT glog-targets NAMESPACE glog:: DESTINATION + ${_glog_CMake_INSTALLDIR}) diff --git a/runtime/onnxruntime/third_party/glog/cmake/DetermineGflagsNamespace.cmake b/runtime/onnxruntime/third_party/glog/cmake/DetermineGflagsNamespace.cmake new file mode 100644 index 0000000..3dde42b --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/DetermineGflagsNamespace.cmake @@ -0,0 +1,69 @@ +macro(determine_gflags_namespace VARIABLE) + if (NOT DEFINED "${VARIABLE}") + if (CMAKE_REQUIRED_INCLUDES) + set (CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") + else () + set (CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS) + endif () + + set(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS}) + + set(_NAMESPACES gflags google) + set(_check_code +" +#include + +int main(int argc, char**argv) +{ + GLOG_GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); +} +") + if (NOT CMAKE_REQUIRED_QUIET) + message (STATUS "Looking for gflags namespace") + endif () + if (${ARGC} EQUAL 3) + set (CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") + endif () + + set (_check_file + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/DetermineGflagsNamespace.cxx) + + foreach (_namespace ${_NAMESPACES}) + file (WRITE "${_check_file}" "${_check_code}") + try_compile (${VARIABLE} + "${CMAKE_BINARY_DIR}" "${_check_file}" + COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}" -DGLOG_GFLAGS_NAMESPACE=${_namespace} + LINK_LIBRARIES gflags + CMAKE_FLAGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + OUTPUT_VARIABLE OUTPUT) + + if (${VARIABLE}) + set (${VARIABLE} ${_namespace} CACHE INTERNAL "gflags namespace" FORCE) + break () + else () + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the gflags namespace ${_namespace} failed with the following output:\n" + "${OUTPUT}\n\n") + endif () + endforeach (_namespace) + + if (${ARGC} EQUAL 3) + set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE}) + endif () + + if (${VARIABLE}) + if (NOT CMAKE_REQUIRED_QUIET) + message (STATUS "Looking for gflags namespace - ${${VARIABLE}}") + endif () + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the gflags namespace passed with the following output:\n" + "${OUTPUT}\n\n") + else () + if (NOT CMAKE_REQUIRED_QUIET) + message (STATUS "Looking for gflags namespace - failed") + endif () + set (${VARIABLE} ${_namespace} CACHE INTERNAL "gflags namespace") + endif () + endif () +endmacro () diff --git a/runtime/onnxruntime/third_party/glog/cmake/FindUnwind.cmake b/runtime/onnxruntime/third_party/glog/cmake/FindUnwind.cmake new file mode 100644 index 0000000..a7a976b --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/FindUnwind.cmake @@ -0,0 +1,61 @@ +# - Try to find libunwind +# Once done this will define +# +# Unwind_FOUND - system has libunwind +# unwind::unwind - cmake target for libunwind + +include (FindPackageHandleStandardArgs) + +find_path (Unwind_INCLUDE_DIR NAMES unwind.h libunwind.h DOC "unwind include directory") +find_library (Unwind_LIBRARY NAMES unwind DOC "unwind library") + +mark_as_advanced (Unwind_INCLUDE_DIR Unwind_LIBRARY) + +# Extract version information +if (Unwind_LIBRARY) + set (_Unwind_VERSION_HEADER ${Unwind_INCLUDE_DIR}/libunwind-common.h) + + if (EXISTS ${_Unwind_VERSION_HEADER}) + file (READ ${_Unwind_VERSION_HEADER} _Unwind_VERSION_CONTENTS) + + string (REGEX REPLACE ".*#define UNW_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" + Unwind_VERSION_MAJOR "${_Unwind_VERSION_CONTENTS}") + string (REGEX REPLACE ".*#define UNW_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" + Unwind_VERSION_MINOR "${_Unwind_VERSION_CONTENTS}") + string (REGEX REPLACE ".*#define UNW_VERSION_EXTRA[ \t]+([0-9]+).*" "\\1" + Unwind_VERSION_PATCH "${_Unwind_VERSION_CONTENTS}") + + set (Unwind_VERSION ${Unwind_VERSION_MAJOR}.${Unwind_VERSION_MINOR}) + + if (CMAKE_MATCH_0) + # Third version component may be empty + set (Unwind_VERSION ${Unwind_VERSION}.${Unwind_VERSION_PATCH}) + set (Unwind_VERSION_COMPONENTS 3) + else (CMAKE_MATCH_0) + set (Unwind_VERSION_COMPONENTS 2) + endif (CMAKE_MATCH_0) + endif (EXISTS ${_Unwind_VERSION_HEADER}) +endif (Unwind_LIBRARY) + +# handle the QUIETLY and REQUIRED arguments and set Unwind_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args (Unwind + REQUIRED_VARS Unwind_INCLUDE_DIR Unwind_LIBRARY + VERSION_VAR Unwind_VERSION +) + +if (Unwind_FOUND) + if (NOT TARGET unwind::unwind) + add_library (unwind::unwind INTERFACE IMPORTED) + + set_property (TARGET unwind::unwind PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${Unwind_INCLUDE_DIR} + ) + set_property (TARGET unwind::unwind PROPERTY + INTERFACE_LINK_LIBRARIES ${Unwind_LIBRARY} + ) + set_property (TARGET unwind::unwind PROPERTY + IMPORTED_CONFIGURATIONS RELEASE + ) + endif (NOT TARGET unwind::unwind) +endif (Unwind_FOUND) diff --git a/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake b/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake new file mode 100644 index 0000000..ead3589 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake @@ -0,0 +1,70 @@ +cmake_policy (PUSH) +cmake_policy (VERSION 3.3) + +include (CMakeParseArguments) + +function (get_cache_variables _CACHEVARS) + set (_SINGLE) + set (_MULTI EXCLUDE) + set (_OPTIONS) + + cmake_parse_arguments (_ARGS "${_OPTIONS}" "${_SINGLE}" "${_MULTI}" ${ARGS} ${ARGN}) + + get_cmake_property (_VARIABLES VARIABLES) + + set (CACHEVARS) + + foreach (_VAR ${_VARIABLES}) + if (DEFINED _ARGS_EXCLUDE) + if ("${_VAR}" IN_LIST _ARGS_EXCLUDE) + continue () + endif ("${_VAR}" IN_LIST _ARGS_EXCLUDE) + endif (DEFINED _ARGS_EXCLUDE) + + get_property (_CACHEVARTYPE CACHE ${_VAR} PROPERTY TYPE) + + if ("${_CACHEVARTYPE}" STREQUAL INTERNAL OR + "${_CACHEVARTYPE}" STREQUAL STATIC OR + "${_CACHEVARTYPE}" STREQUAL UNINITIALIZED) + continue () + endif ("${_CACHEVARTYPE}" STREQUAL INTERNAL OR + "${_CACHEVARTYPE}" STREQUAL STATIC OR + "${_CACHEVARTYPE}" STREQUAL UNINITIALIZED) + + get_property (_CACHEVARVAL CACHE ${_VAR} PROPERTY VALUE) + + if ("${_CACHEVARVAL}" STREQUAL "") + continue () + endif ("${_CACHEVARVAL}" STREQUAL "") + + get_property (_CACHEVARDOC CACHE ${_VAR} PROPERTY HELPSTRING) + + # Escape " in values + string (REPLACE "\"" "\\\"" _CACHEVARVAL "${_CACHEVARVAL}") + # Escape " in help strings + string (REPLACE "\"" "\\\"" _CACHEVARDOC "${_CACHEVARDOC}") + # Escape ; in values + string (REPLACE ";" "\\\;" _CACHEVARVAL "${_CACHEVARVAL}") + # Escape ; in help strings + string (REPLACE ";" "\\\;" _CACHEVARDOC "${_CACHEVARDOC}") + # Escape backslashes in values except those that are followed by a + # quote. + string (REGEX REPLACE "\\\\([^\"])" "\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}") + # Escape backslashes in values that are followed by a letter to avoid + # invalid escape sequence errors. + string (REGEX REPLACE "\\\\([a-zA-Z])" "\\\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}") + string (REPLACE "\\\\" "\\\\\\\\" _CACHEVARDOC "${_CACHEVARDOC}") + + if (NOT "${_CACHEVARTYPE}" STREQUAL BOOL) + set (_CACHEVARVAL "\"${_CACHEVARVAL}\"") + endif (NOT "${_CACHEVARTYPE}" STREQUAL BOOL) + + if (NOT "${_CACHEVARTYPE}" STREQUAL "" AND NOT "${_CACHEVARVAL}" STREQUAL "") + set (CACHEVARS "${CACHEVARS}set (${_VAR} ${_CACHEVARVAL} CACHE ${_CACHEVARTYPE} \"${_CACHEVARDOC}\")\n") + endif (NOT "${_CACHEVARTYPE}" STREQUAL "" AND NOT "${_CACHEVARVAL}" STREQUAL "") + endforeach (_VAR) + + set (${_CACHEVARS} ${CACHEVARS} PARENT_SCOPE) +endfunction (get_cache_variables) + +cmake_policy (POP) diff --git a/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest1.cmake b/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest1.cmake new file mode 100644 index 0000000..7fbf463 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest1.cmake @@ -0,0 +1,22 @@ +set (RUNS 3) + +foreach (iter RANGE 1 ${RUNS}) + set (ENV{GOOGLE_LOG_DIR} ${TEST_DIR}) + execute_process (COMMAND ${LOGCLEANUP} RESULT_VARIABLE _RESULT) + + if (NOT _RESULT EQUAL 0) + message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})") + endif (NOT _RESULT EQUAL 0) + + # Ensure the log files to have different modification timestamps such that + # exactly one log file remains at the end. Otherwise all log files will be + # retained. + execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 1) +endforeach (iter) + +file (GLOB LOG_FILES ${TEST_DIR}/*.foobar) +list (LENGTH LOG_FILES NUM_FILES) + +if (NOT NUM_FILES EQUAL 1) + message (SEND_ERROR "Expected 1 log file in log directory but found ${NUM_FILES}") +endif (NOT NUM_FILES EQUAL 1) diff --git a/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest2.cmake b/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest2.cmake new file mode 100644 index 0000000..d3b51e3 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest2.cmake @@ -0,0 +1,22 @@ +set (RUNS 3) + +foreach (iter RANGE 1 ${RUNS}) + execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR} + RESULT_VARIABLE _RESULT) + + if (NOT _RESULT EQUAL 0) + message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})") + endif (NOT _RESULT EQUAL 0) + + # Ensure the log files to have different modification timestamps such that + # exactly one log file remains at the end. Otherwise all log files will be + # retained. + execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 1) +endforeach (iter) + +file (GLOB LOG_FILES ${TEST_DIR}/test_cleanup_*.barfoo) +list (LENGTH LOG_FILES NUM_FILES) + +if (NOT NUM_FILES EQUAL 1) + message (SEND_ERROR "Expected 1 log file in build directory ${TEST_DIR} but found ${NUM_FILES}") +endif (NOT NUM_FILES EQUAL 1) diff --git a/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest3.cmake b/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest3.cmake new file mode 100644 index 0000000..e8105d1 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest3.cmake @@ -0,0 +1,28 @@ +set (RUNS 3) + +# Create the subdirectory required by this unit test. +file (MAKE_DIRECTORY ${TEST_DIR}/${TEST_SUBDIR}) + +foreach (iter RANGE 1 ${RUNS}) + execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR} + RESULT_VARIABLE _RESULT) + + if (NOT _RESULT EQUAL 0) + message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})") + endif (NOT _RESULT EQUAL 0) + + # Ensure the log files to have different modification timestamps such that + # exactly one log file remains at the end. Otherwise all log files will be + # retained. + execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2) +endforeach (iter) + +file (GLOB LOG_FILES ${TEST_DIR}/${TEST_SUBDIR}/test_cleanup_*.relativefoo) +list (LENGTH LOG_FILES NUM_FILES) + +if (NOT NUM_FILES EQUAL 1) + message (SEND_ERROR "Expected 1 log file in build directory ${TEST_DIR}${TEST_SUBDIR} but found ${NUM_FILES}") +endif (NOT NUM_FILES EQUAL 1) + +# Remove the subdirectory required by this unit test. +file (REMOVE_RECURSE ${TEST_DIR}/${TEST_SUBDIR}) diff --git a/runtime/onnxruntime/third_party/glog/cmake/TestInitPackageConfig.cmake b/runtime/onnxruntime/third_party/glog/cmake/TestInitPackageConfig.cmake new file mode 100644 index 0000000..01d3a40 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/TestInitPackageConfig.cmake @@ -0,0 +1,11 @@ +# Create the build directory +execute_process ( + COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR} + RESULT_VARIABLE _DIRECTORY_CREATED_SUCCEEDED +) + +if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0) + message (FATAL_ERROR "Failed to create build directory") +endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0) + +file (WRITE ${INITIAL_CACHE} "${CACHEVARS}") diff --git a/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake b/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake new file mode 100644 index 0000000..97244ab --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake @@ -0,0 +1,40 @@ +# Create the build directory +execute_process ( + COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR} + RESULT_VARIABLE _DIRECTORY_CREATED_SUCCEEDED +) + +if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0) + message (FATAL_ERROR "Failed to create build directory") +endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0) + +if (GENERATOR_TOOLSET) + list (APPEND _ADDITIONAL_ARGS -T ${GENERATOR_TOOLSET}) +endif (GENERATOR_TOOLSET) + +if (GENERATOR_PLATFORM) + list (APPEND _ADDITIONAL_ARGS -A ${GENERATOR_PLATFORM}) +endif (GENERATOR_PLATFORM) + +# Run CMake +execute_process ( + # Capture the PATH environment variable content set during project generation + # stage. This is required because later during the build stage the PATH is + # modified again (e.g., for MinGW AppVeyor CI builds) by adding back the + # directory containing git.exe. Incidently, the Git installation directory + # also contains sh.exe which causes MinGW Makefile generation to fail. + COMMAND ${CMAKE_COMMAND} -E env PATH=${PATH} + ${CMAKE_COMMAND} -C ${INITIAL_CACHE} + -G ${GENERATOR} + ${_ADDITIONAL_ARGS} + -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON + -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON + -DCMAKE_PREFIX_PATH=${PACKAGE_DIR} + ${SOURCE_DIR} + WORKING_DIRECTORY ${TEST_BINARY_DIR} + RESULT_VARIABLE _GENERATE_SUCCEEDED +) + +if (NOT _GENERATE_SUCCEEDED EQUAL 0) + message (FATAL_ERROR "Failed to generate project files using CMake") +endif (NOT _GENERATE_SUCCEEDED EQUAL 0) diff --git a/runtime/onnxruntime/third_party/glog/glog-config.cmake.in b/runtime/onnxruntime/third_party/glog/glog-config.cmake.in new file mode 100644 index 0000000..5c5c9c0 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/glog-config.cmake.in @@ -0,0 +1,13 @@ +if (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@) + message (FATAL_ERROR "CMake >= @glog_CMake_VERSION@ required") +endif (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@) + +@PACKAGE_INIT@ + +include (CMakeFindDependencyMacro) +include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake) + +@gflags_DEPENDENCY@ +@Unwind_DEPENDENCY@ + +include (${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake) diff --git a/runtime/onnxruntime/third_party/glog/glog-modules.cmake.in b/runtime/onnxruntime/third_party/glog/glog-modules.cmake.in new file mode 100644 index 0000000..71c5160 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/glog-modules.cmake.in @@ -0,0 +1,18 @@ +cmake_policy (PUSH) +cmake_policy (SET CMP0057 NEW) + +if (CMAKE_VERSION VERSION_LESS 3.3) + message (FATAL_ERROR "glog-modules.cmake requires the consumer " + "to use CMake 3.3 (or newer)") +endif (CMAKE_VERSION VERSION_LESS 3.3) + +set (glog_MODULE_PATH "@glog_FULL_CMake_DATADIR@") +list (APPEND CMAKE_MODULE_PATH ${glog_MODULE_PATH}) + +if (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH) + message (FATAL_ERROR "Cannot add '${glog_MODULE_PATH}' to " + "CMAKE_MODULE_PATH. This will cause glog-config.cmake to fail at " + "locating required find modules. Make sure CMAKE_MODULE_PATH is not a cache variable.") +endif (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH) + +cmake_policy (POP) diff --git a/runtime/onnxruntime/third_party/glog/libglog.pc.in b/runtime/onnxruntime/third_party/glog/libglog.pc.in new file mode 100644 index 0000000..2303e2e --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/libglog.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libglog +Description: Google Log (glog) C++ logging framework +Version: @VERSION@ +Libs: -L${libdir} -lglog +Libs.private: @glog_libraries_options_for_static_linking@ +Cflags: -I${includedir} diff --git a/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h b/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h new file mode 100644 index 0000000..c011df4 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h @@ -0,0 +1,148 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// This file is a compatibility layer that defines Google's version of +// command line flags that are used for configuration. +// +// We put flags into their own namespace. It is purposefully +// named in an opaque way that people should have trouble typing +// directly. The idea is that DEFINE puts the flag in the weird +// namespace, and DECLARE imports the flag from there into the +// current namespace. The net result is to force people to use +// DECLARE to get access to a flag, rather than saying +// extern bool FLAGS_logtostderr; +// or some such instead. We want this so we can put extra +// functionality (like sanity-checking) in DECLARE if we want, +// and make sure it is picked up everywhere. +// +// We also put the type of the variable in the namespace, so that +// people can't DECLARE_int32 something that they DEFINE_bool'd +// elsewhere. +#ifndef BASE_COMMANDLINEFLAGS_H__ +#define BASE_COMMANDLINEFLAGS_H__ + +#include "config.h" +#include // for getenv +#include // for memchr +#include + +#ifdef HAVE_LIB_GFLAGS + +#include + +#else + +#include + +#define DECLARE_VARIABLE(type, shorttype, name, tn) \ + namespace fL##shorttype { \ + extern GLOG_EXPORT type FLAGS_##name; \ + } \ + using fL##shorttype::FLAGS_##name +#define DEFINE_VARIABLE(type, shorttype, name, value, meaning, tn) \ + namespace fL##shorttype { \ + GLOG_EXPORT type FLAGS_##name(value); \ + char FLAGS_no##name; \ + } \ + using fL##shorttype::FLAGS_##name + +// bool specialization +#define DECLARE_bool(name) \ + DECLARE_VARIABLE(bool, B, name, bool) +#define DEFINE_bool(name, value, meaning) \ + DEFINE_VARIABLE(bool, B, name, value, meaning, bool) + +// int32 specialization +#define DECLARE_int32(name) \ + DECLARE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, int32) +#define DEFINE_int32(name, value, meaning) \ + DEFINE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, value, meaning, int32) + +// uint32 specialization +#ifndef DECLARE_uint32 +#define DECLARE_uint32(name) \ + DECLARE_VARIABLE(GOOGLE_NAMESPACE::uint32, U, name, uint32) +#endif // DECLARE_uint64 +#define DEFINE_uint32(name, value, meaning) \ + DEFINE_VARIABLE(GOOGLE_NAMESPACE::uint32, U, name, value, meaning, uint32) + +// Special case for string, because we have to specify the namespace +// std::string, which doesn't play nicely with our FLAG__namespace hackery. +#define DECLARE_string(name) \ + namespace fLS { \ + extern GLOG_EXPORT std::string& FLAGS_##name; \ + } \ + using fLS::FLAGS_##name +#define DEFINE_string(name, value, meaning) \ + namespace fLS { \ + std::string FLAGS_##name##_buf(value); \ + GLOG_EXPORT std::string& FLAGS_##name = FLAGS_##name##_buf; \ + char FLAGS_no##name; \ + } \ + using fLS::FLAGS_##name + +#endif // HAVE_LIB_GFLAGS + +// Define GLOG_DEFINE_* using DEFINE_* . By using these macros, we +// have GLOG_* environ variables even if we have gflags installed. +// +// If both an environment variable and a flag are specified, the value +// specified by a flag wins. E.g., if GLOG_v=0 and --v=1, the +// verbosity will be 1, not 0. + +#define GLOG_DEFINE_bool(name, value, meaning) \ + DEFINE_bool(name, EnvToBool("GLOG_" #name, value), meaning) + +#define GLOG_DEFINE_int32(name, value, meaning) \ + DEFINE_int32(name, EnvToInt("GLOG_" #name, value), meaning) + +#define GLOG_DEFINE_uint32(name, value, meaning) \ + DEFINE_uint32(name, EnvToUInt("GLOG_" #name, value), meaning) + +#define GLOG_DEFINE_string(name, value, meaning) \ + DEFINE_string(name, EnvToString("GLOG_" #name, value), meaning) + +// These macros (could be functions, but I don't want to bother with a .cc +// file), make it easier to initialize flags from the environment. + +#define EnvToString(envname, dflt) \ + (!getenv(envname) ? (dflt) : getenv(envname)) + +#define EnvToBool(envname, dflt) \ + (!getenv(envname) ? (dflt) \ + : memchr("tTyY1\0", getenv(envname)[0], 6) != nullptr) + +#define EnvToInt(envname, dflt) \ + (!getenv(envname) ? (dflt) : strtol(getenv(envname), nullptr, 10)) + +#define EnvToUInt(envname, dflt) \ + (!getenv(envname) ? (dflt) : strtoul(getenv(envname), nullptr, 10)) + +#endif // BASE_COMMANDLINEFLAGS_H__ diff --git a/runtime/onnxruntime/third_party/glog/src/base/googleinit.h b/runtime/onnxruntime/third_party/glog/src/base/googleinit.h new file mode 100644 index 0000000..b5f4436 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/base/googleinit.h @@ -0,0 +1,51 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Jacob Hoffman-Andrews + +#ifndef _GOOGLEINIT_H +#define _GOOGLEINIT_H + +class GoogleInitializer { + public: + using void_function = void (*)(); + GoogleInitializer(const char*, void_function f) { + f(); + } +}; + +#define REGISTER_MODULE_INITIALIZER(name, body) \ + namespace { \ + static void google_init_module_##name () { body; } \ + GoogleInitializer google_initializer_module_##name(#name, \ + google_init_module_##name); \ + } + +#endif /* _GOOGLEINIT_H */ diff --git a/runtime/onnxruntime/third_party/glog/src/base/mutex.h b/runtime/onnxruntime/third_party/glog/src/base/mutex.h new file mode 100644 index 0000000..6d10df1 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/base/mutex.h @@ -0,0 +1,333 @@ +// Copyright (c) 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// Author: Craig Silverstein. +// +// A simple mutex wrapper, supporting locks and read-write locks. +// You should assume the locks are *not* re-entrant. +// +// To use: you should define the following macros in your configure.ac: +// ACX_PTHREAD +// AC_RWLOCK +// The latter is defined in ../autoconf. +// +// This class is meant to be internal-only and should be wrapped by an +// internal namespace. Before you use this module, please give the +// name of your internal namespace for this module. Or, if you want +// to expose it, you'll want to move it to the Google namespace. We +// cannot put this class in global namespace because there can be some +// problems when we have multiple versions of Mutex in each shared object. +// +// NOTE: by default, we have #ifdef'ed out the TryLock() method. +// This is for two reasons: +// 1) TryLock() under Windows is a bit annoying (it requires a +// #define to be defined very early). +// 2) TryLock() is broken for NO_THREADS mode, at least in NDEBUG +// mode. +// If you need TryLock(), and either these two caveats are not a +// problem for you, or you're willing to work around them, then +// feel free to #define GMUTEX_TRYLOCK, or to remove the #ifdefs +// in the code below. +// +// CYGWIN NOTE: Cygwin support for rwlock seems to be buggy: +// http://www.cygwin.com/ml/cygwin/2008-12/msg00017.html +// Because of that, we might as well use windows locks for +// cygwin. They seem to be more reliable than the cygwin pthreads layer. +// +// TRICKY IMPLEMENTATION NOTE: +// This class is designed to be safe to use during +// dynamic-initialization -- that is, by global constructors that are +// run before main() starts. The issue in this case is that +// dynamic-initialization happens in an unpredictable order, and it +// could be that someone else's dynamic initializer could call a +// function that tries to acquire this mutex -- but that all happens +// before this mutex's constructor has run. (This can happen even if +// the mutex and the function that uses the mutex are in the same .cc +// file.) Basically, because Mutex does non-trivial work in its +// constructor, it's not, in the naive implementation, safe to use +// before dynamic initialization has run on it. +// +// The solution used here is to pair the actual mutex primitive with a +// bool that is set to true when the mutex is dynamically initialized. +// (Before that it's false.) Then we modify all mutex routines to +// look at the bool, and not try to lock/unlock until the bool makes +// it to true (which happens after the Mutex constructor has run.) +// +// This works because before main() starts -- particularly, during +// dynamic initialization -- there are no threads, so a) it's ok that +// the mutex operations are a no-op, since we don't need locking then +// anyway; and b) we can be quite confident our bool won't change +// state between a call to Lock() and a call to Unlock() (that would +// require a global constructor in one translation unit to call Lock() +// and another global constructor in another translation unit to call +// Unlock() later, which is pretty perverse). +// +// That said, it's tricky, and can conceivably fail; it's safest to +// avoid trying to acquire a mutex in a global constructor, if you +// can. One way it can fail is that a really smart compiler might +// initialize the bool to true at static-initialization time (too +// early) rather than at dynamic-initialization time. To discourage +// that, we set is_safe_ to true in code (not the constructor +// colon-initializer) and set it to true via a function that always +// evaluates to true, but that the compiler can't know always +// evaluates to true. This should be good enough. + +#ifndef GOOGLE_MUTEX_H_ +#define GOOGLE_MUTEX_H_ + +#include "config.h" // to figure out pthreads support + +#if defined(NO_THREADS) + typedef int MutexType; // to keep a lock-count +#elif defined(_WIN32) || defined(__CYGWIN__) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN // We only need minimal includes +# endif +# ifdef GMUTEX_TRYLOCK + // We need Windows NT or later for TryEnterCriticalSection(). If you + // don't need that functionality, you can remove these _WIN32_WINNT + // lines, and change TryLock() to assert(0) or something. +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +# endif +# endif +// To avoid macro definition of ERROR. +# ifndef NOGDI +# define NOGDI +# endif +// To avoid macro definition of min/max. +# ifndef NOMINMAX +# define NOMINMAX +# endif +# include + typedef CRITICAL_SECTION MutexType; +#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) + // Needed for pthread_rwlock_*. If it causes problems, you could take it + // out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it + // *does* cause problems for FreeBSD, or MacOSX, but isn't needed + // for locking there.) +# ifdef __linux__ +# ifndef _XOPEN_SOURCE // Some other header might have already set it for us. +# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls +# endif +# endif +# include +using MutexType = pthread_rwlock_t; +#elif defined(HAVE_PTHREAD) +# include + typedef pthread_mutex_t MutexType; +#else +# error Need to implement mutex.h for your architecture, or #define NO_THREADS +#endif + +// We need to include these header files after defining _XOPEN_SOURCE +// as they may define the _XOPEN_SOURCE macro. +#include +#include // for abort() + +#define MUTEX_NAMESPACE glog_internal_namespace_ + +namespace MUTEX_NAMESPACE { + +class Mutex { + public: + // Create a Mutex that is not held by anybody. This constructor is + // typically used for Mutexes allocated on the heap or the stack. + // See below for a recommendation for constructing global Mutex + // objects. + inline Mutex(); + + // Destructor + inline ~Mutex(); + + inline void Lock(); // Block if needed until free then acquire exclusively + inline void Unlock(); // Release a lock acquired via Lock() +#ifdef GMUTEX_TRYLOCK + inline bool TryLock(); // If free, Lock() and return true, else return false +#endif + // Note that on systems that don't support read-write locks, these may + // be implemented as synonyms to Lock() and Unlock(). So you can use + // these for efficiency, but don't use them anyplace where being able + // to do shared reads is necessary to avoid deadlock. + inline void ReaderLock(); // Block until free or shared then acquire a share + inline void ReaderUnlock(); // Release a read share of this Mutex + inline void WriterLock() { Lock(); } // Acquire an exclusive lock + inline void WriterUnlock() { Unlock(); } // Release a lock from WriterLock() + + // TODO(hamaji): Do nothing, implement correctly. + inline void AssertHeld() {} + + private: + MutexType mutex_; + // We want to make sure that the compiler sets is_safe_ to true only + // when we tell it to, and never makes assumptions is_safe_ is + // always true. volatile is the most reliable way to do that. + volatile bool is_safe_; + + inline void SetIsSafe() { is_safe_ = true; } + + // Catch the error of writing Mutex when intending MutexLock. + explicit Mutex(Mutex * /*ignored*/) {} + // Disallow "evil" constructors + Mutex(const Mutex &) = delete; + void operator=(const Mutex &) = delete; +}; + +// Now the implementation of Mutex for various systems +#if defined(NO_THREADS) + +// When we don't have threads, we can be either reading or writing, +// but not both. We can have lots of readers at once (in no-threads +// mode, that's most likely to happen in recursive function calls), +// but only one writer. We represent this by having mutex_ be -1 when +// writing and a number > 0 when reading (and 0 when no lock is held). +// +// In debug mode, we assert these invariants, while in non-debug mode +// we do nothing, for efficiency. That's why everything is in an +// assert. + +Mutex::Mutex() : mutex_(0) { } +Mutex::~Mutex() { assert(mutex_ == 0); } +void Mutex::Lock() { assert(--mutex_ == -1); } +void Mutex::Unlock() { assert(mutex_++ == -1); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } +#endif +void Mutex::ReaderLock() { assert(++mutex_ > 0); } +void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } + +#elif defined(_WIN32) || defined(__CYGWIN__) + +Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); } +Mutex::~Mutex() { DeleteCriticalSection(&mutex_); } +void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); } +void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + TryEnterCriticalSection(&mutex_) != 0 : true; } +#endif +void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks +void Mutex::ReaderUnlock() { Unlock(); } + +#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) + +#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ + if (is_safe_ && fncall(&mutex_) != 0) abort(); \ +} while (0) + +Mutex::Mutex() { + SetIsSafe(); + if (is_safe_ && pthread_rwlock_init(&mutex_, nullptr) != 0) abort(); +} +Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy); } +void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); } +void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + pthread_rwlock_trywrlock(&mutex_) == 0 : + true; } +#endif +void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); } +void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } +#undef SAFE_PTHREAD + +#elif defined(HAVE_PTHREAD) + +#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ + if (is_safe_ && fncall(&mutex_) != 0) abort(); \ +} while (0) + +Mutex::Mutex() { + SetIsSafe(); + if (is_safe_ && pthread_mutex_init(&mutex_, nullptr) != 0) abort(); +} +Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy); } +void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); } +void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + pthread_mutex_trylock(&mutex_) == 0 : true; } +#endif +void Mutex::ReaderLock() { Lock(); } +void Mutex::ReaderUnlock() { Unlock(); } +#undef SAFE_PTHREAD + +#endif + +// -------------------------------------------------------------------------- +// Some helper classes + +// MutexLock(mu) acquires mu when constructed and releases it when destroyed. +class MutexLock { + public: + explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } + ~MutexLock() { mu_->Unlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + MutexLock(const MutexLock &) = delete; + void operator=(const MutexLock &) = delete; +}; + +// ReaderMutexLock and WriterMutexLock do the same, for rwlocks +class ReaderMutexLock { + public: + explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } + ~ReaderMutexLock() { mu_->ReaderUnlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + ReaderMutexLock(const ReaderMutexLock &) = delete; + void operator=(const ReaderMutexLock &) = delete; +}; + +class WriterMutexLock { + public: + explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } + ~WriterMutexLock() { mu_->WriterUnlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + WriterMutexLock(const WriterMutexLock &) = delete; + void operator=(const WriterMutexLock &) = delete; +}; + +// Catch bug where variable name is omitted, e.g. MutexLock (&mu); +#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name) +#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name) +#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name) + +} // namespace MUTEX_NAMESPACE + +using namespace MUTEX_NAMESPACE; + +#undef MUTEX_NAMESPACE + +#endif /* #define GOOGLE_MUTEX_H__ */ diff --git a/runtime/onnxruntime/third_party/glog/src/config.h b/runtime/onnxruntime/third_party/glog/src/config.h new file mode 100644 index 0000000..fb17d23 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/config.h @@ -0,0 +1,177 @@ +#ifndef GLOG_CONFIG_H +#define GLOG_CONFIG_H + +/* Namespace for Google classes */ +#define GOOGLE_NAMESPACE google + +/* Define if you have the `dladdr' function */ +#define HAVE_DLADDR + +/* Define if you have the `snprintf' function */ +#define HAVE_SNPRINTF + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H + +/* Define if you have the `backtrace' function in */ +#define HAVE_EXECINFO_BACKTRACE + +/* Define if you have the `backtrace_symbols' function in */ +#define HAVE_EXECINFO_BACKTRACE_SYMBOLS + +/* Define if you have the `fcntl' function */ +#define HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#define HAVE_GLOB_H + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +/* #undef HAVE_LIBPTHREAD */ + +/* define if you have google gflags library */ +/* #undef HAVE_LIB_GFLAGS */ + +/* define if you have google gmock library */ +/* #undef HAVE_LIB_GMOCK */ + +/* define if you have google gtest library */ +/* #undef HAVE_LIB_GTEST */ + +/* define if you have dbghelp library */ +/* #undef HAVE_DBGHELP */ + +/* define if you have libunwind */ +/* #undef HAVE_LIB_UNWIND */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H + +/* define to disable multithreading support. */ +/* #undef NO_THREADS */ + +/* Define if you have the 'pread' function */ +#define HAVE_PREAD + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H + +/* Define if you have the 'pwrite' function */ +#define HAVE_PWRITE + +/* define if the compiler implements pthread_rwlock_* */ +#define HAVE_RWLOCK + +/* Define if you have the 'sigaction' function */ +#define HAVE_SIGACTION + +/* Define if you have the `sigaltstack' function */ +#define HAVE_SIGALTSTACK + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYSCALL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSCALL_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UCONTEXT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UCONTEXT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you linking to _Unwind_Backtrace is possible. */ +#define HAVE__UNWIND_BACKTRACE + +/* Define if you linking to _Unwind_GetIP is possible. */ +#define HAVE__UNWIND_GETIP + +/* define if your compiler has __attribute__ */ +#define HAVE___ATTRIBUTE__ + +/* define if your compiler has __builtin_expect */ +#define HAVE___BUILTIN_EXPECT 1 + +/* define if your compiler has __sync_val_compare_and_swap */ +#define HAVE___SYNC_VAL_COMPARE_AND_SWAP + +/* define if symbolize support is available */ +/* #undef HAVE_SYMBOLIZE */ + +/* define if localtime_r is available in time.h */ +#define HAVE_LOCALTIME_R + +/* define if gmtime_r is available in time.h */ +/* #undef HAVE_GMTIME_R */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +/* #undef LT_OBJDIR */ + +/* How to access the PC from a struct ucontext */ +/* #undef PC_FROM_UCONTEXT */ + +/* define if we should print file offsets in traces instead of symbolizing. */ +/* #undef PRINT_UNSYMBOLIZED_STACK_TRACES */ + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 8 + +/* location of source code */ +#define TEST_SRC_DIR "/Users/qiuwei/Documents/邱威/语音识别-asr/to_alibaba-damo-academy/FunASR/funasr/runtime/onnxruntime/third_party/glog" + +/* Define if thread-local storage is enabled. */ +#define GLOG_THREAD_LOCAL_STORAGE + +#ifdef GLOG_BAZEL_BUILD + +/* TODO(rodrigoq): remove this workaround once bazel#3979 is resolved: + * https://github.com/bazelbuild/bazel/issues/3979 */ +#define _START_GOOGLE_NAMESPACE_ namespace GOOGLE_NAMESPACE { + +#define _END_GOOGLE_NAMESPACE_ } + +#else + +/* Stops putting the code inside the Google namespace */ +#define _END_GOOGLE_NAMESPACE_ } + +/* Puts following code inside the Google namespace */ +#define _START_GOOGLE_NAMESPACE_ namespace google { + +#endif + +/* Replacement for deprecated syscall(SYS_gettid) on macOS. */ +#define HAVE_PTHREAD_THREADID_NP 1 + +#endif // GLOG_CONFIG_H diff --git a/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in b/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in new file mode 100644 index 0000000..9d61010 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in @@ -0,0 +1,177 @@ +#ifndef GLOG_CONFIG_H +#define GLOG_CONFIG_H + +/* Namespace for Google classes */ +#cmakedefine GOOGLE_NAMESPACE ${GOOGLE_NAMESPACE} + +/* Define if you have the `dladdr' function */ +#cmakedefine HAVE_DLADDR + +/* Define if you have the `snprintf' function */ +#cmakedefine HAVE_SNPRINTF + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H + +/* Define if you have the `backtrace' function in */ +#cmakedefine HAVE_EXECINFO_BACKTRACE + +/* Define if you have the `backtrace_symbols' function in */ +#cmakedefine HAVE_EXECINFO_BACKTRACE_SYMBOLS + +/* Define if you have the `fcntl' function */ +#cmakedefine HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GLOB_H + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#cmakedefine HAVE_LIBPTHREAD + +/* define if you have google gflags library */ +#cmakedefine HAVE_LIB_GFLAGS + +/* define if you have google gmock library */ +#cmakedefine HAVE_LIB_GMOCK + +/* define if you have google gtest library */ +#cmakedefine HAVE_LIB_GTEST + +/* define if you have dbghelp library */ +#cmakedefine HAVE_DBGHELP + +/* define if you have libunwind */ +#cmakedefine HAVE_LIB_UNWIND + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H + +/* define to disable multithreading support. */ +#cmakedefine NO_THREADS + +/* Define if you have the 'pread' function */ +#cmakedefine HAVE_PREAD + +/* Define if you have POSIX threads libraries and header files. */ +#cmakedefine HAVE_PTHREAD + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PWD_H + +/* Define if you have the 'pwrite' function */ +#cmakedefine HAVE_PWRITE + +/* define if the compiler implements pthread_rwlock_* */ +#cmakedefine HAVE_RWLOCK + +/* Define if you have the 'sigaction' function */ +#cmakedefine HAVE_SIGACTION + +/* Define if you have the `sigaltstack' function */ +#cmakedefine HAVE_SIGALTSTACK + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYSCALL_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYSLOG_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SYSCALL_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UCONTEXT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UCONTEXT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} + +/* Define if you linking to _Unwind_Backtrace is possible. */ +#cmakedefine HAVE__UNWIND_BACKTRACE + +/* Define if you linking to _Unwind_GetIP is possible. */ +#cmakedefine HAVE__UNWIND_GETIP + +/* define if your compiler has __attribute__ */ +#cmakedefine HAVE___ATTRIBUTE__ + +/* define if your compiler has __builtin_expect */ +#cmakedefine HAVE___BUILTIN_EXPECT ${HAVE___BUILTIN_EXPECT} + +/* define if your compiler has __sync_val_compare_and_swap */ +#cmakedefine HAVE___SYNC_VAL_COMPARE_AND_SWAP + +/* define if symbolize support is available */ +#cmakedefine HAVE_SYMBOLIZE + +/* define if localtime_r is available in time.h */ +#cmakedefine HAVE_LOCALTIME_R + +/* define if gmtime_r is available in time.h */ +#cmakedefine HAVE_GMTIME_R + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#cmakedefine LT_OBJDIR + +/* How to access the PC from a struct ucontext */ +#cmakedefine PC_FROM_UCONTEXT + +/* define if we should print file offsets in traces instead of symbolizing. */ +#cmakedefine PRINT_UNSYMBOLIZED_STACK_TRACES + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#cmakedefine PTHREAD_CREATE_JOINABLE + +/* The size of `void *', as computed by sizeof. */ +#cmakedefine SIZEOF_VOID_P ${SIZEOF_VOID_P} + +/* location of source code */ +#cmakedefine TEST_SRC_DIR ${TEST_SRC_DIR} + +/* Define if thread-local storage is enabled. */ +#cmakedefine GLOG_THREAD_LOCAL_STORAGE + +#ifdef GLOG_BAZEL_BUILD + +/* TODO(rodrigoq): remove this workaround once bazel#3979 is resolved: + * https://github.com/bazelbuild/bazel/issues/3979 */ +#define _START_GOOGLE_NAMESPACE_ namespace GOOGLE_NAMESPACE { + +#define _END_GOOGLE_NAMESPACE_ } + +#else + +/* Stops putting the code inside the Google namespace */ +#cmakedefine _END_GOOGLE_NAMESPACE_ ${_END_GOOGLE_NAMESPACE_} + +/* Puts following code inside the Google namespace */ +#cmakedefine _START_GOOGLE_NAMESPACE_ ${_START_GOOGLE_NAMESPACE_} + +#endif + +/* Replacement for deprecated syscall(SYS_gettid) on macOS. */ +#cmakedefine HAVE_PTHREAD_THREADID_NP ${HAVE_PTHREAD_THREADID_NP} + +#endif // GLOG_CONFIG_H diff --git a/runtime/onnxruntime/third_party/glog/src/demangle.cc b/runtime/onnxruntime/third_party/glog/src/demangle.cc new file mode 100644 index 0000000..b19d446 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/demangle.cc @@ -0,0 +1,1310 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Satoru Takabayashi +// +// For reference check out: +// http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling +// +// Note that we only have partial C++0x support yet. + +#include "demangle.h" + +#include // for nullptr + +#include "utilities.h" + +#if defined(GLOG_OS_WINDOWS) +#include +#endif + +_START_GOOGLE_NAMESPACE_ + +#if !defined(GLOG_OS_WINDOWS) +struct AbbrevPair { + const char *abbrev; + const char *real_name; +}; + +// List of operators from Itanium C++ ABI. +static const AbbrevPair kOperatorList[] = { + {"nw", "new"}, {"na", "new[]"}, {"dl", "delete"}, {"da", "delete[]"}, + {"ps", "+"}, {"ng", "-"}, {"ad", "&"}, {"de", "*"}, + {"co", "~"}, {"pl", "+"}, {"mi", "-"}, {"ml", "*"}, + {"dv", "/"}, {"rm", "%"}, {"an", "&"}, {"or", "|"}, + {"eo", "^"}, {"aS", "="}, {"pL", "+="}, {"mI", "-="}, + {"mL", "*="}, {"dV", "/="}, {"rM", "%="}, {"aN", "&="}, + {"oR", "|="}, {"eO", "^="}, {"ls", "<<"}, {"rs", ">>"}, + {"lS", "<<="}, {"rS", ">>="}, {"eq", "=="}, {"ne", "!="}, + {"lt", "<"}, {"gt", ">"}, {"le", "<="}, {"ge", ">="}, + {"nt", "!"}, {"aa", "&&"}, {"oo", "||"}, {"pp", "++"}, + {"mm", "--"}, {"cm", ","}, {"pm", "->*"}, {"pt", "->"}, + {"cl", "()"}, {"ix", "[]"}, {"qu", "?"}, {"st", "sizeof"}, + {"sz", "sizeof"}, {nullptr, nullptr}, +}; + +// List of builtin types from Itanium C++ ABI. +static const AbbrevPair kBuiltinTypeList[] = { + {"v", "void"}, {"w", "wchar_t"}, + {"b", "bool"}, {"c", "char"}, + {"a", "signed char"}, {"h", "unsigned char"}, + {"s", "short"}, {"t", "unsigned short"}, + {"i", "int"}, {"j", "unsigned int"}, + {"l", "long"}, {"m", "unsigned long"}, + {"x", "long long"}, {"y", "unsigned long long"}, + {"n", "__int128"}, {"o", "unsigned __int128"}, + {"f", "float"}, {"d", "double"}, + {"e", "long double"}, {"g", "__float128"}, + {"z", "ellipsis"}, {nullptr, nullptr}}; + +// List of substitutions Itanium C++ ABI. +static const AbbrevPair kSubstitutionList[] = { + {"St", ""}, + {"Sa", "allocator"}, + {"Sb", "basic_string"}, + // std::basic_string,std::allocator > + {"Ss", "string"}, + // std::basic_istream > + {"Si", "istream"}, + // std::basic_ostream > + {"So", "ostream"}, + // std::basic_iostream > + {"Sd", "iostream"}, + {nullptr, nullptr}}; + +// State needed for demangling. +struct State { + const char *mangled_cur; // Cursor of mangled name. + char *out_cur; // Cursor of output string. + const char *out_begin; // Beginning of output string. + const char *out_end; // End of output string. + const char *prev_name; // For constructors/destructors. + ssize_t prev_name_length; // For constructors/destructors. + short nest_level; // For nested names. + bool append; // Append flag. + bool overflowed; // True if output gets overflowed. +}; + +// We don't use strlen() in libc since it's not guaranteed to be async +// signal safe. +static size_t StrLen(const char *str) { + size_t len = 0; + while (*str != '\0') { + ++str; + ++len; + } + return len; +} + +// Returns true if "str" has at least "n" characters remaining. +static bool AtLeastNumCharsRemaining(const char *str, ssize_t n) { + for (ssize_t i = 0; i < n; ++i) { + if (str[i] == '\0') { + return false; + } + } + return true; +} + +// Returns true if "str" has "prefix" as a prefix. +static bool StrPrefix(const char *str, const char *prefix) { + size_t i = 0; + while (str[i] != '\0' && prefix[i] != '\0' && + str[i] == prefix[i]) { + ++i; + } + return prefix[i] == '\0'; // Consumed everything in "prefix". +} + +static void InitState(State *state, const char *mangled, + char *out, size_t out_size) { + state->mangled_cur = mangled; + state->out_cur = out; + state->out_begin = out; + state->out_end = out + out_size; + state->prev_name = nullptr; + state->prev_name_length = -1; + state->nest_level = -1; + state->append = true; + state->overflowed = false; +} + +// Returns true and advances "mangled_cur" if we find "one_char_token" +// at "mangled_cur" position. It is assumed that "one_char_token" does +// not contain '\0'. +static bool ParseOneCharToken(State *state, const char one_char_token) { + if (state->mangled_cur[0] == one_char_token) { + ++state->mangled_cur; + return true; + } + return false; +} + +// Returns true and advances "mangled_cur" if we find "two_char_token" +// at "mangled_cur" position. It is assumed that "two_char_token" does +// not contain '\0'. +static bool ParseTwoCharToken(State *state, const char *two_char_token) { + if (state->mangled_cur[0] == two_char_token[0] && + state->mangled_cur[1] == two_char_token[1]) { + state->mangled_cur += 2; + return true; + } + return false; +} + +// Returns true and advances "mangled_cur" if we find any character in +// "char_class" at "mangled_cur" position. +static bool ParseCharClass(State *state, const char *char_class) { + const char *p = char_class; + for (; *p != '\0'; ++p) { + if (state->mangled_cur[0] == *p) { + ++state->mangled_cur; + return true; + } + } + return false; +} + +// This function is used for handling an optional non-terminal. +static bool Optional(bool) { + return true; +} + +// This function is used for handling + syntax. +using ParseFunc = bool (*)(State *); +static bool OneOrMore(ParseFunc parse_func, State *state) { + if (parse_func(state)) { + while (parse_func(state)) { + } + return true; + } + return false; +} + +// This function is used for handling * syntax. The function +// always returns true and must be followed by a termination token or a +// terminating sequence not handled by parse_func (e.g. +// ParseOneCharToken(state, 'E')). +static bool ZeroOrMore(ParseFunc parse_func, State *state) { + while (parse_func(state)) { + } + return true; +} + +// Append "str" at "out_cur". If there is an overflow, "overflowed" +// is set to true for later use. The output string is ensured to +// always terminate with '\0' as long as there is no overflow. +static void Append(State *state, const char * const str, ssize_t length) { + for (ssize_t i = 0; i < length; ++i) { + if (state->out_cur + 1 < state->out_end) { // +1 for '\0' + *state->out_cur = str[i]; + ++state->out_cur; + } else { + state->overflowed = true; + break; + } + } + if (!state->overflowed) { + *state->out_cur = '\0'; // Terminate it with '\0' + } +} + +// We don't use equivalents in libc to avoid locale issues. +static bool IsLower(char c) { + return c >= 'a' && c <= 'z'; +} + +static bool IsAlpha(char c) { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); +} + +static bool IsDigit(char c) { + return c >= '0' && c <= '9'; +} + +// Returns true if "str" is a function clone suffix. These suffixes are used +// by GCC 4.5.x and later versions to indicate functions which have been +// cloned during optimization. We treat any sequence (.+.+)+ as +// a function clone suffix. +static bool IsFunctionCloneSuffix(const char *str) { + size_t i = 0; + while (str[i] != '\0') { + // Consume a single .+.+ sequence. + if (str[i] != '.' || !IsAlpha(str[i + 1])) { + return false; + } + i += 2; + while (IsAlpha(str[i])) { + ++i; + } + if (str[i] != '.' || !IsDigit(str[i + 1])) { + return false; + } + i += 2; + while (IsDigit(str[i])) { + ++i; + } + } + return true; // Consumed everything in "str". +} + +// Append "str" with some tweaks, iff "append" state is true. +// Returns true so that it can be placed in "if" conditions. +static void MaybeAppendWithLength(State *state, const char * const str, + ssize_t length) { + if (state->append && length > 0) { + // Append a space if the output buffer ends with '<' and "str" + // starts with '<' to avoid <<<. + if (str[0] == '<' && state->out_begin < state->out_cur && + state->out_cur[-1] == '<') { + Append(state, " ", 1); + } + // Remember the last identifier name for ctors/dtors. + if (IsAlpha(str[0]) || str[0] == '_') { + state->prev_name = state->out_cur; + state->prev_name_length = length; + } + Append(state, str, length); + } +} + +// A convenient wrapper arount MaybeAppendWithLength(). +static bool MaybeAppend(State *state, const char * const str) { + if (state->append) { + size_t length = StrLen(str); + MaybeAppendWithLength(state, str, static_cast(length)); + } + return true; +} + +// This function is used for handling nested names. +static bool EnterNestedName(State *state) { + state->nest_level = 0; + return true; +} + +// This function is used for handling nested names. +static bool LeaveNestedName(State *state, short prev_value) { + state->nest_level = prev_value; + return true; +} + +// Disable the append mode not to print function parameters, etc. +static bool DisableAppend(State *state) { + state->append = false; + return true; +} + +// Restore the append mode to the previous state. +static bool RestoreAppend(State *state, bool prev_value) { + state->append = prev_value; + return true; +} + +// Increase the nest level for nested names. +static void MaybeIncreaseNestLevel(State *state) { + if (state->nest_level > -1) { + ++state->nest_level; + } +} + +// Appends :: for nested names if necessary. +static void MaybeAppendSeparator(State *state) { + if (state->nest_level >= 1) { + MaybeAppend(state, "::"); + } +} + +// Cancel the last separator if necessary. +static void MaybeCancelLastSeparator(State *state) { + if (state->nest_level >= 1 && state->append && + state->out_begin <= state->out_cur - 2) { + state->out_cur -= 2; + *state->out_cur = '\0'; + } +} + +// Returns true if the identifier of the given length pointed to by +// "mangled_cur" is anonymous namespace. +static bool IdentifierIsAnonymousNamespace(State *state, ssize_t length) { + static const char anon_prefix[] = "_GLOBAL__N_"; + return (length > static_cast(sizeof(anon_prefix)) - + 1 && // Should be longer. + StrPrefix(state->mangled_cur, anon_prefix)); +} + +// Forward declarations of our parsing functions. +static bool ParseMangledName(State *state); +static bool ParseEncoding(State *state); +static bool ParseName(State *state); +static bool ParseUnscopedName(State *state); +static bool ParseUnscopedTemplateName(State *state); +static bool ParseNestedName(State *state); +static bool ParsePrefix(State *state); +static bool ParseUnqualifiedName(State *state); +static bool ParseSourceName(State *state); +static bool ParseLocalSourceName(State *state); +static bool ParseNumber(State *state, int *number_out); +static bool ParseFloatNumber(State *state); +static bool ParseSeqId(State *state); +static bool ParseIdentifier(State *state, ssize_t length); +static bool ParseAbiTags(State *state); +static bool ParseAbiTag(State *state); +static bool ParseOperatorName(State *state); +static bool ParseSpecialName(State *state); +static bool ParseCallOffset(State *state); +static bool ParseNVOffset(State *state); +static bool ParseVOffset(State *state); +static bool ParseCtorDtorName(State *state); +static bool ParseType(State *state); +static bool ParseCVQualifiers(State *state); +static bool ParseBuiltinType(State *state); +static bool ParseFunctionType(State *state); +static bool ParseBareFunctionType(State *state); +static bool ParseClassEnumType(State *state); +static bool ParseArrayType(State *state); +static bool ParsePointerToMemberType(State *state); +static bool ParseTemplateParam(State *state); +static bool ParseTemplateTemplateParam(State *state); +static bool ParseTemplateArgs(State *state); +static bool ParseTemplateArg(State *state); +static bool ParseExpression(State *state); +static bool ParseExprPrimary(State *state); +static bool ParseLocalName(State *state); +static bool ParseDiscriminator(State *state); +static bool ParseSubstitution(State *state); + +// Implementation note: the following code is a straightforward +// translation of the Itanium C++ ABI defined in BNF with a couple of +// exceptions. +// +// - Support GNU extensions not defined in the Itanium C++ ABI +// - and are combined to avoid infinite loop +// - Reorder patterns to shorten the code +// - Reorder patterns to give greedier functions precedence +// We'll mark "Less greedy than" for these cases in the code +// +// Each parsing function changes the state and returns true on +// success. Otherwise, don't change the state and returns false. To +// ensure that the state isn't changed in the latter case, we save the +// original state before we call more than one parsing functions +// consecutively with &&, and restore the state if unsuccessful. See +// ParseEncoding() as an example of this convention. We follow the +// convention throughout the code. +// +// Originally we tried to do demangling without following the full ABI +// syntax but it turned out we needed to follow the full syntax to +// parse complicated cases like nested template arguments. Note that +// implementing a full-fledged demangler isn't trivial (libiberty's +// cp-demangle.c has +4300 lines). +// +// Note that (foo) in <(foo) ...> is a modifier to be ignored. +// +// Reference: +// - Itanium C++ ABI +// + +// ::= _Z +static bool ParseMangledName(State *state) { + return ParseTwoCharToken(state, "_Z") && ParseEncoding(state); +} + +// ::= <(function) name> +// ::= <(data) name> +// ::= +static bool ParseEncoding(State *state) { + State copy = *state; + if (ParseName(state) && ParseBareFunctionType(state)) { + return true; + } + *state = copy; + + if (ParseName(state) || ParseSpecialName(state)) { + return true; + } + return false; +} + +// ::= +// ::= +// ::= +// ::= +static bool ParseName(State *state) { + if (ParseNestedName(state) || ParseLocalName(state)) { + return true; + } + + State copy = *state; + if (ParseUnscopedTemplateName(state) && + ParseTemplateArgs(state)) { + return true; + } + *state = copy; + + // Less greedy than . + if (ParseUnscopedName(state)) { + return true; + } + return false; +} + +// ::= +// ::= St +static bool ParseUnscopedName(State *state) { + if (ParseUnqualifiedName(state)) { + return true; + } + + State copy = *state; + if (ParseTwoCharToken(state, "St") && + MaybeAppend(state, "std::") && + ParseUnqualifiedName(state)) { + return true; + } + *state = copy; + return false; +} + +// ::= +// ::= +static bool ParseUnscopedTemplateName(State *state) { + return ParseUnscopedName(state) || ParseSubstitution(state); +} + +// ::= N [] E +// ::= N [] E +static bool ParseNestedName(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'N') && + EnterNestedName(state) && + Optional(ParseCVQualifiers(state)) && + ParsePrefix(state) && + LeaveNestedName(state, copy.nest_level) && + ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + return false; +} + +// This part is tricky. If we literally translate them to code, we'll +// end up infinite loop. Hence we merge them to avoid the case. +// +// ::= +// ::= +// ::= +// ::= +// ::= # empty +// ::= <(template) unqualified-name> +// ::= +// ::= +static bool ParsePrefix(State *state) { + bool has_something = false; + while (true) { + MaybeAppendSeparator(state); + if (ParseTemplateParam(state) || + ParseSubstitution(state) || + ParseUnscopedName(state)) { + has_something = true; + MaybeIncreaseNestLevel(state); + continue; + } + MaybeCancelLastSeparator(state); + if (has_something && ParseTemplateArgs(state)) { + return ParsePrefix(state); + } else { + break; + } + } + return true; +} + +// ::= +// ::= +// ::= [] +// ::= [] +static bool ParseUnqualifiedName(State *state) { + return (ParseOperatorName(state) || + ParseCtorDtorName(state) || + (ParseSourceName(state) && Optional(ParseAbiTags(state))) || + (ParseLocalSourceName(state) && Optional(ParseAbiTags(state)))); +} + +// ::= +static bool ParseSourceName(State *state) { + State copy = *state; + int length = -1; + if (ParseNumber(state, &length) && ParseIdentifier(state, length)) { + return true; + } + *state = copy; + return false; +} + +// ::= L [] +// +// References: +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775 +// http://gcc.gnu.org/viewcvs?view=rev&revision=124467 +static bool ParseLocalSourceName(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'L') && ParseSourceName(state) && + Optional(ParseDiscriminator(state))) { + return true; + } + *state = copy; + return false; +} + +// ::= [n] +// If "number_out" is non-null, then *number_out is set to the value of the +// parsed number on success. +static bool ParseNumber(State *state, int *number_out) { + int sign = 1; + if (ParseOneCharToken(state, 'n')) { + sign = -1; + } + const char *p = state->mangled_cur; + int number = 0; + for (;*p != '\0'; ++p) { + if (IsDigit(*p)) { + number = number * 10 + (*p - '0'); + } else { + break; + } + } + if (p != state->mangled_cur) { // Conversion succeeded. + state->mangled_cur = p; + if (number_out != nullptr) { + *number_out = number * sign; + } + return true; + } + return false; +} + +// Floating-point literals are encoded using a fixed-length lowercase +// hexadecimal string. +static bool ParseFloatNumber(State *state) { + const char *p = state->mangled_cur; + for (;*p != '\0'; ++p) { + if (!IsDigit(*p) && !(*p >= 'a' && *p <= 'f')) { + break; + } + } + if (p != state->mangled_cur) { // Conversion succeeded. + state->mangled_cur = p; + return true; + } + return false; +} + +// The is a sequence number in base 36, +// using digits and upper case letters +static bool ParseSeqId(State *state) { + const char *p = state->mangled_cur; + for (;*p != '\0'; ++p) { + if (!IsDigit(*p) && !(*p >= 'A' && *p <= 'Z')) { + break; + } + } + if (p != state->mangled_cur) { // Conversion succeeded. + state->mangled_cur = p; + return true; + } + return false; +} + +// ::= (of given length) +static bool ParseIdentifier(State *state, ssize_t length) { + if (length == -1 || + !AtLeastNumCharsRemaining(state->mangled_cur, length)) { + return false; + } + if (IdentifierIsAnonymousNamespace(state, length)) { + MaybeAppend(state, "(anonymous namespace)"); + } else { + MaybeAppendWithLength(state, state->mangled_cur, length); + } + state->mangled_cur += length; + return true; +} + +// ::= [] +static bool ParseAbiTags(State *state) { + State copy = *state; + DisableAppend(state); + if (OneOrMore(ParseAbiTag, state)) { + RestoreAppend(state, copy.append); + return true; + } + *state = copy; + return false; +} + +// ::= B +static bool ParseAbiTag(State *state) { + return ParseOneCharToken(state, 'B') && ParseSourceName(state); +} + +// ::= nw, and other two letters cases +// ::= cv # (cast) +// ::= v # vendor extended operator +static bool ParseOperatorName(State *state) { + if (!AtLeastNumCharsRemaining(state->mangled_cur, 2)) { + return false; + } + // First check with "cv" (cast) case. + State copy = *state; + if (ParseTwoCharToken(state, "cv") && + MaybeAppend(state, "operator ") && + EnterNestedName(state) && + ParseType(state) && + LeaveNestedName(state, copy.nest_level)) { + return true; + } + *state = copy; + + // Then vendor extended operators. + if (ParseOneCharToken(state, 'v') && ParseCharClass(state, "0123456789") && + ParseSourceName(state)) { + return true; + } + *state = copy; + + // Other operator names should start with a lower alphabet followed + // by a lower/upper alphabet. + if (!(IsLower(state->mangled_cur[0]) && + IsAlpha(state->mangled_cur[1]))) { + return false; + } + // We may want to perform a binary search if we really need speed. + const AbbrevPair *p; + for (p = kOperatorList; p->abbrev != nullptr; ++p) { + if (state->mangled_cur[0] == p->abbrev[0] && + state->mangled_cur[1] == p->abbrev[1]) { + MaybeAppend(state, "operator"); + if (IsLower(*p->real_name)) { // new, delete, etc. + MaybeAppend(state, " "); + } + MaybeAppend(state, p->real_name); + state->mangled_cur += 2; + return true; + } + } + return false; +} + +// ::= TV +// ::= TT +// ::= TI +// ::= TS +// ::= Tc <(base) encoding> +// ::= GV <(object) name> +// ::= T <(base) encoding> +// G++ extensions: +// ::= TC <(offset) number> _ <(base) type> +// ::= TF +// ::= TJ +// ::= GR +// ::= GA +// ::= Th <(base) encoding> +// ::= Tv <(base) encoding> +// +// Note: we don't care much about them since they don't appear in +// stack traces. The are special data. +static bool ParseSpecialName(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'T') && + ParseCharClass(state, "VTIS") && + ParseType(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "Tc") && ParseCallOffset(state) && + ParseCallOffset(state) && ParseEncoding(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "GV") && + ParseName(state)) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'T') && ParseCallOffset(state) && + ParseEncoding(state)) { + return true; + } + *state = copy; + + // G++ extensions + if (ParseTwoCharToken(state, "TC") && ParseType(state) && + ParseNumber(state, nullptr) && ParseOneCharToken(state, '_') && + DisableAppend(state) && ParseType(state)) { + RestoreAppend(state, copy.append); + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "FJ") && + ParseType(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "GR") && ParseName(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "GA") && ParseEncoding(state)) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "hv") && + ParseCallOffset(state) && ParseEncoding(state)) { + return true; + } + *state = copy; + return false; +} + +// ::= h _ +// ::= v _ +static bool ParseCallOffset(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'h') && + ParseNVOffset(state) && ParseOneCharToken(state, '_')) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'v') && + ParseVOffset(state) && ParseOneCharToken(state, '_')) { + return true; + } + *state = copy; + + return false; +} + +// ::= <(offset) number> +static bool ParseNVOffset(State *state) { return ParseNumber(state, nullptr); } + +// ::= <(offset) number> _ <(virtual offset) number> +static bool ParseVOffset(State *state) { + State copy = *state; + if (ParseNumber(state, nullptr) && ParseOneCharToken(state, '_') && + ParseNumber(state, nullptr)) { + return true; + } + *state = copy; + return false; +} + +// ::= C1 | C2 | C3 +// ::= D0 | D1 | D2 +static bool ParseCtorDtorName(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'C') && + ParseCharClass(state, "123")) { + const char * const prev_name = state->prev_name; + const ssize_t prev_name_length = state->prev_name_length; + MaybeAppendWithLength(state, prev_name, prev_name_length); + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'D') && + ParseCharClass(state, "012")) { + const char * const prev_name = state->prev_name; + const ssize_t prev_name_length = state->prev_name_length; + MaybeAppend(state, "~"); + MaybeAppendWithLength(state, prev_name, prev_name_length); + return true; + } + *state = copy; + return false; +} + +// ::= +// ::= P # pointer-to +// ::= R # reference-to +// ::= O # rvalue reference-to (C++0x) +// ::= C # complex pair (C 2000) +// ::= G # imaginary (C 2000) +// ::= U # vendor extended type qualifier +// ::= +// ::= +// ::= +// ::= +// ::= +// ::= +// ::= +// ::= +// ::= Dp # pack expansion of (C++0x) +// ::= Dt E # decltype of an id-expression or class +// # member access (C++0x) +// ::= DT E # decltype of an expression (C++0x) +// +static bool ParseType(State *state) { + // We should check CV-qualifers, and PRGC things first. + State copy = *state; + if (ParseCVQualifiers(state) && ParseType(state)) { + return true; + } + *state = copy; + + if (ParseCharClass(state, "OPRCG") && ParseType(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "Dp") && ParseType(state)) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'D') && ParseCharClass(state, "tT") && + ParseExpression(state) && ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'U') && ParseSourceName(state) && + ParseType(state)) { + return true; + } + *state = copy; + + if (ParseBuiltinType(state) || + ParseFunctionType(state) || + ParseClassEnumType(state) || + ParseArrayType(state) || + ParsePointerToMemberType(state) || + ParseSubstitution(state)) { + return true; + } + + if (ParseTemplateTemplateParam(state) && + ParseTemplateArgs(state)) { + return true; + } + *state = copy; + + // Less greedy than . + if (ParseTemplateParam(state)) { + return true; + } + + return false; +} + +// ::= [r] [V] [K] +// We don't allow empty to avoid infinite loop in +// ParseType(). +static bool ParseCVQualifiers(State *state) { + int num_cv_qualifiers = 0; + num_cv_qualifiers += ParseOneCharToken(state, 'r'); + num_cv_qualifiers += ParseOneCharToken(state, 'V'); + num_cv_qualifiers += ParseOneCharToken(state, 'K'); + return num_cv_qualifiers > 0; +} + +// ::= v, etc. +// ::= u +static bool ParseBuiltinType(State *state) { + const AbbrevPair *p; + for (p = kBuiltinTypeList; p->abbrev != nullptr; ++p) { + if (state->mangled_cur[0] == p->abbrev[0]) { + MaybeAppend(state, p->real_name); + ++state->mangled_cur; + return true; + } + } + + State copy = *state; + if (ParseOneCharToken(state, 'u') && ParseSourceName(state)) { + return true; + } + *state = copy; + return false; +} + +// ::= F [Y] E +static bool ParseFunctionType(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'F') && + Optional(ParseOneCharToken(state, 'Y')) && + ParseBareFunctionType(state) && ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + return false; +} + +// ::= <(signature) type>+ +static bool ParseBareFunctionType(State *state) { + State copy = *state; + DisableAppend(state); + if (OneOrMore(ParseType, state)) { + RestoreAppend(state, copy.append); + MaybeAppend(state, "()"); + return true; + } + *state = copy; + return false; +} + +// ::= +static bool ParseClassEnumType(State *state) { + return ParseName(state); +} + +// ::= A <(positive dimension) number> _ <(element) type> +// ::= A [<(dimension) expression>] _ <(element) type> +static bool ParseArrayType(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'A') && ParseNumber(state, nullptr) && + ParseOneCharToken(state, '_') && ParseType(state)) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'A') && Optional(ParseExpression(state)) && + ParseOneCharToken(state, '_') && ParseType(state)) { + return true; + } + *state = copy; + return false; +} + +// ::= M <(class) type> <(member) type> +static bool ParsePointerToMemberType(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'M') && ParseType(state) && + ParseType(state)) { + return true; + } + *state = copy; + return false; +} + +// ::= T_ +// ::= T _ +static bool ParseTemplateParam(State *state) { + if (ParseTwoCharToken(state, "T_")) { + MaybeAppend(state, "?"); // We don't support template substitutions. + return true; + } + + State copy = *state; + if (ParseOneCharToken(state, 'T') && ParseNumber(state, nullptr) && + ParseOneCharToken(state, '_')) { + MaybeAppend(state, "?"); // We don't support template substitutions. + return true; + } + *state = copy; + return false; +} + + +// ::= +// ::= +static bool ParseTemplateTemplateParam(State *state) { + return (ParseTemplateParam(state) || + ParseSubstitution(state)); +} + +// ::= I + E +static bool ParseTemplateArgs(State *state) { + State copy = *state; + DisableAppend(state); + if (ParseOneCharToken(state, 'I') && + OneOrMore(ParseTemplateArg, state) && + ParseOneCharToken(state, 'E')) { + RestoreAppend(state, copy.append); + MaybeAppend(state, "<>"); + return true; + } + *state = copy; + return false; +} + +// ::= +// ::= +// ::= I * E # argument pack +// ::= J * E # argument pack +// ::= X E +static bool ParseTemplateArg(State *state) { + State copy = *state; + if ((ParseOneCharToken(state, 'I') || ParseOneCharToken(state, 'J')) && + ZeroOrMore(ParseTemplateArg, state) && + ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + + if (ParseType(state) || + ParseExprPrimary(state)) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'X') && ParseExpression(state) && + ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + return false; +} + +// ::= +// ::= +// ::= +// ::= +// ::= +// +// ::= st +// ::= sr +// ::= sr +static bool ParseExpression(State *state) { + if (ParseTemplateParam(state) || ParseExprPrimary(state)) { + return true; + } + + State copy = *state; + if (ParseOperatorName(state) && + ParseExpression(state) && + ParseExpression(state) && + ParseExpression(state)) { + return true; + } + *state = copy; + + if (ParseOperatorName(state) && + ParseExpression(state) && + ParseExpression(state)) { + return true; + } + *state = copy; + + if (ParseOperatorName(state) && + ParseExpression(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "st") && ParseType(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "sr") && ParseType(state) && + ParseUnqualifiedName(state) && + ParseTemplateArgs(state)) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "sr") && ParseType(state) && + ParseUnqualifiedName(state)) { + return true; + } + *state = copy; + return false; +} + +// ::= L <(value) number> E +// ::= L <(value) float> E +// ::= L E +// // A bug in g++'s C++ ABI version 2 (-fabi-version=2). +// ::= LZ E +static bool ParseExprPrimary(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'L') && ParseType(state) && + ParseNumber(state, nullptr) && ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'L') && ParseType(state) && + ParseFloatNumber(state) && + ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'L') && ParseMangledName(state) && + ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + + if (ParseTwoCharToken(state, "LZ") && ParseEncoding(state) && + ParseOneCharToken(state, 'E')) { + return true; + } + *state = copy; + + return false; +} + +// := Z <(function) encoding> E <(entity) name> +// [] +// := Z <(function) encoding> E s [] +static bool ParseLocalName(State *state) { + State copy = *state; + if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) && + ParseOneCharToken(state, 'E') && MaybeAppend(state, "::") && + ParseName(state) && Optional(ParseDiscriminator(state))) { + return true; + } + *state = copy; + + if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) && + ParseTwoCharToken(state, "Es") && Optional(ParseDiscriminator(state))) { + return true; + } + *state = copy; + return false; +} + +// := _ <(non-negative) number> +static bool ParseDiscriminator(State *state) { + State copy = *state; + if (ParseOneCharToken(state, '_') && ParseNumber(state, nullptr)) { + return true; + } + *state = copy; + return false; +} + +// ::= S_ +// ::= S _ +// ::= St, etc. +static bool ParseSubstitution(State *state) { + if (ParseTwoCharToken(state, "S_")) { + MaybeAppend(state, "?"); // We don't support substitutions. + return true; + } + + State copy = *state; + if (ParseOneCharToken(state, 'S') && ParseSeqId(state) && + ParseOneCharToken(state, '_')) { + MaybeAppend(state, "?"); // We don't support substitutions. + return true; + } + *state = copy; + + // Expand abbreviations like "St" => "std". + if (ParseOneCharToken(state, 'S')) { + const AbbrevPair *p; + for (p = kSubstitutionList; p->abbrev != nullptr; ++p) { + if (state->mangled_cur[0] == p->abbrev[1]) { + MaybeAppend(state, "std"); + if (p->real_name[0] != '\0') { + MaybeAppend(state, "::"); + MaybeAppend(state, p->real_name); + } + ++state->mangled_cur; + return true; + } + } + } + *state = copy; + return false; +} + +// Parse , optionally followed by either a function-clone suffix +// or version suffix. Returns true only if all of "mangled_cur" was consumed. +static bool ParseTopLevelMangledName(State *state) { + if (ParseMangledName(state)) { + if (state->mangled_cur[0] != '\0') { + // Drop trailing function clone suffix, if any. + if (IsFunctionCloneSuffix(state->mangled_cur)) { + return true; + } + // Append trailing version suffix if any. + // ex. _Z3foo@@GLIBCXX_3.4 + if (state->mangled_cur[0] == '@') { + MaybeAppend(state, state->mangled_cur); + return true; + } + return false; // Unconsumed suffix. + } + return true; + } + return false; +} +#endif + +// The demangler entry point. +bool Demangle(const char *mangled, char *out, size_t out_size) { +#if defined(GLOG_OS_WINDOWS) +#if defined(HAVE_DBGHELP) + // When built with incremental linking, the Windows debugger + // library provides a more complicated `Symbol->Name` with the + // Incremental Linking Table offset, which looks like + // `@ILT+1105(?func@Foo@@SAXH@Z)`. However, the demangler expects + // only the mangled symbol, `?func@Foo@@SAXH@Z`. Fortunately, the + // mangled symbol is guaranteed not to have parentheses, + // so we search for `(` and extract up to `)`. + // + // Since we may be in a signal handler here, we cannot use `std::string`. + char buffer[1024]; // Big enough for a sane symbol. + const char *lparen = strchr(mangled, '('); + if (lparen) { + // Extract the string `(?...)` + const char *rparen = strchr(lparen, ')'); + size_t length = static_cast(rparen - lparen) - 1; + strncpy(buffer, lparen + 1, length); + buffer[length] = '\0'; + mangled = buffer; + } // Else the symbol wasn't inside a set of parentheses + // We use the ANSI version to ensure the string type is always `char *`. + return UnDecorateSymbolName(mangled, out, out_size, UNDNAME_COMPLETE); +#else + (void)mangled; + (void)out; + (void)out_size; + return false; +#endif +#else + State state; + InitState(&state, mangled, out, out_size); + return ParseTopLevelMangledName(&state) && !state.overflowed; +#endif +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/demangle.h b/runtime/onnxruntime/third_party/glog/src/demangle.h new file mode 100644 index 0000000..f347b98 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/demangle.h @@ -0,0 +1,85 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Satoru Takabayashi +// +// An async-signal-safe and thread-safe demangler for Itanium C++ ABI +// (aka G++ V3 ABI). + +// The demangler is implemented to be used in async signal handlers to +// symbolize stack traces. We cannot use libstdc++'s +// abi::__cxa_demangle() in such signal handlers since it's not async +// signal safe (it uses malloc() internally). +// +// Note that this demangler doesn't support full demangling. More +// specifically, it doesn't print types of function parameters and +// types of template arguments. It just skips them. However, it's +// still very useful to extract basic information such as class, +// function, constructor, destructor, and operator names. +// +// See the implementation note in demangle.cc if you are interested. +// +// Example: +// +// | Mangled Name | The Demangler | abi::__cxa_demangle() +// |---------------|---------------|----------------------- +// | _Z1fv | f() | f() +// | _Z1fi | f() | f(int) +// | _Z3foo3bar | foo() | foo(bar) +// | _Z1fIiEvi | f<>() | void f(int) +// | _ZN1N1fE | N::f | N::f +// | _ZN3Foo3BarEv | Foo::Bar() | Foo::Bar() +// | _Zrm1XS_" | operator%() | operator%(X, X) +// | _ZN3FooC1Ev | Foo::Foo() | Foo::Foo() +// | _Z1fSs | f() | f(std::basic_string, +// | | | std::allocator >) +// +// See the unit test for more examples. +// +// Note: we might want to write demanglers for ABIs other than Itanium +// C++ ABI in the future. +// + +#ifndef BASE_DEMANGLE_H_ +#define BASE_DEMANGLE_H_ + +#include "config.h" +#include + +_START_GOOGLE_NAMESPACE_ + +// Demangle "mangled". On success, return true and write the +// demangled symbol name to "out". Otherwise, return false. +// "out" is modified even if demangling is unsuccessful. +bool GLOG_EXPORT Demangle(const char *mangled, char *out, size_t out_size); + +_END_GOOGLE_NAMESPACE_ + +#endif // BASE_DEMANGLE_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/fuzz_demangle.cc b/runtime/onnxruntime/third_party/glog/src/fuzz_demangle.cc new file mode 100644 index 0000000..c6ee4b5 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/fuzz_demangle.cc @@ -0,0 +1,32 @@ +// Copyright 2023 Google LLC +// +// 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 applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +#include "demangle.h" + +extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, + unsigned Size) { + if (Size >= 4095) { + return 0; + } + char Buffer[Size + 1]; + std::memcpy(Buffer, Data, Size); + Buffer[Size] = 0; + char demangled[4096]; + google::Demangle(Buffer, demangled, Size); + return 0; +} diff --git a/runtime/onnxruntime/third_party/glog/src/glog/export.h b/runtime/onnxruntime/third_party/glog/src/glog/export.h new file mode 100644 index 0000000..6e2691e --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/export.h @@ -0,0 +1,42 @@ + +#ifndef GLOG_EXPORT_H +#define GLOG_EXPORT_H + +#ifdef GLOG_STATIC_DEFINE +# define GLOG_EXPORT +# define GLOG_NO_EXPORT +#else +# ifndef GLOG_EXPORT +# ifdef GOOGLE_GLOG_IS_A_DLL + /* We are building this library */ +# define GLOG_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define GLOG_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef GLOG_NO_EXPORT +# define GLOG_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef GLOG_DEPRECATED +# define GLOG_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef GLOG_DEPRECATED_EXPORT +# define GLOG_DEPRECATED_EXPORT GLOG_EXPORT GLOG_DEPRECATED +#endif + +#ifndef GLOG_DEPRECATED_NO_EXPORT +# define GLOG_DEPRECATED_NO_EXPORT GLOG_NO_EXPORT GLOG_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef GLOG_NO_DEPRECATED +# define GLOG_NO_DEPRECATED +# endif +#endif + +#endif /* GLOG_EXPORT_H */ diff --git a/runtime/onnxruntime/third_party/glog/src/glog/log_severity.h b/runtime/onnxruntime/third_party/glog/src/glog/log_severity.h new file mode 100644 index 0000000..d52989d --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/log_severity.h @@ -0,0 +1,98 @@ +// Copyright (c) 2023, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef BASE_LOG_SEVERITY_H__ +#define BASE_LOG_SEVERITY_H__ + +// The recommended semantics of the log levels are as follows: +// +// INFO: +// Use for state changes or other major events, or to aid debugging. +// WARNING: +// Use for undesired but relatively expected events, which may indicate a +// problem +// ERROR: +// Use for undesired and unexpected events that the program can recover from. +// All ERRORs should be actionable - it should be appropriate to file a bug +// whenever an ERROR occurs in production. +// FATAL: +// Use for undesired and unexpected events that the program cannot recover +// from. + +// Variables of type LogSeverity are widely taken to lie in the range +// [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if +// you ever need to change their values or add a new severity. +using LogSeverity = int; + +const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3, + NUM_SEVERITIES = 4; +#ifndef GLOG_NO_ABBREVIATED_SEVERITIES +# ifdef ERROR +# error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail. +# endif +const int INFO = GLOG_INFO, WARNING = GLOG_WARNING, + ERROR = GLOG_ERROR, FATAL = GLOG_FATAL; +#endif + +// DFATAL is FATAL in debug mode, ERROR in normal mode +#ifdef NDEBUG +#define DFATAL_LEVEL ERROR +#else +#define DFATAL_LEVEL FATAL +#endif + +extern GLOG_EXPORT const char* const LogSeverityNames[NUM_SEVERITIES]; + +// NDEBUG usage helpers related to (RAW_)DCHECK: +// +// DEBUG_MODE is for small !NDEBUG uses like +// if (DEBUG_MODE) foo.CheckThatFoo(); +// instead of substantially more verbose +// #ifndef NDEBUG +// foo.CheckThatFoo(); +// #endif +// +// IF_DEBUG_MODE is for small !NDEBUG uses like +// IF_DEBUG_MODE( string error; ) +// DCHECK(Foo(&error)) << error; +// instead of substantially more verbose +// #ifndef NDEBUG +// string error; +// DCHECK(Foo(&error)) << error; +// #endif +// +#ifdef NDEBUG +enum { DEBUG_MODE = 0 }; +#define IF_DEBUG_MODE(x) +#else +enum { DEBUG_MODE = 1 }; +#define IF_DEBUG_MODE(x) x +#endif + +#endif // BASE_LOG_SEVERITY_H__ diff --git a/runtime/onnxruntime/third_party/glog/src/glog/logging.h b/runtime/onnxruntime/third_party/glog/src/glog/logging.h new file mode 100644 index 0000000..6f6685a --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/logging.h @@ -0,0 +1,1842 @@ +// Copyright (c) 2023, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Ray Sidney +// +// This file contains #include information about logging-related stuff. +// Pretty much everybody needs to #include this file so that they can +// log various happenings. +// +#ifndef GLOG_LOGGING_H +#define GLOG_LOGGING_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if 1 +# include +#endif +#include + +#if defined(_MSC_VER) +#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \ + __pragma(warning(disable:n)) +#define GLOG_MSVC_POP_WARNING() __pragma(warning(pop)) +#else +#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) +#define GLOG_MSVC_POP_WARNING() +#endif + +#include + +#if 1 +#include +#endif + +// We care a lot about number of bits things take up. Unfortunately, +// systems define their bit-specific ints in a lot of different ways. +// We use our own way, and have a typedef to get there. +// Note: these commands below may look like "#if 1" or "#if 0", but +// that's because they were constructed that way at ./configure time. +// Look at logging.h.in to see how they're calculated (based on your config). +#include // the normal place uint16_t is defined +#if 1 +#include // the normal place u_int16_t is defined +#endif + +#if 0 +#include +#endif + +#include + +namespace google { + + typedef std::int32_t int32; +typedef std::uint32_t uint32; +typedef std::int64_t int64; +typedef std::uint64_t uint64; + +#if !(1) +typedef ptrdiff_t ssize_t; +#endif + +#if !(1) +typedef int mode_t; +#endif + +typedef double WallTime; + +struct GLOG_EXPORT LogMessageTime { + LogMessageTime(); + LogMessageTime(std::tm t); + LogMessageTime(std::time_t timestamp, WallTime now); + + const time_t& timestamp() const { return timestamp_; } + const int& sec() const { return time_struct_.tm_sec; } + const int32_t& usec() const { return usecs_; } + const int&(min)() const { return time_struct_.tm_min; } + const int& hour() const { return time_struct_.tm_hour; } + const int& day() const { return time_struct_.tm_mday; } + const int& month() const { return time_struct_.tm_mon; } + const int& year() const { return time_struct_.tm_year; } + const int& dayOfWeek() const { return time_struct_.tm_wday; } + const int& dayInYear() const { return time_struct_.tm_yday; } + const int& dst() const { return time_struct_.tm_isdst; } + const long int& gmtoff() const { return gmtoffset_; } + const std::tm& tm() const { return time_struct_; } + + private: + void init(const std::tm& t, std::time_t timestamp, WallTime now); + std::tm time_struct_; // Time of creation of LogMessage + time_t timestamp_; // Time of creation of LogMessage in seconds + int32_t usecs_; // Time of creation of LogMessage - microseconds part + long int gmtoffset_; + + void CalcGmtOffset(); +}; + +struct LogMessageInfo { + explicit LogMessageInfo(const char* const severity_, + const char* const filename_, + const int& line_number_, + const int& thread_id_, + const LogMessageTime& time_): + severity(severity_), filename(filename_), line_number(line_number_), + thread_id(thread_id_), time(time_) + {} + + const char* const severity; + const char* const filename; + const int &line_number; + const int &thread_id; + const LogMessageTime& time; +}; + +typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, void* data); + +} + + +// The global value of GOOGLE_STRIP_LOG. All the messages logged to +// LOG(XXX) with severity less than GOOGLE_STRIP_LOG will not be displayed. +// If it can be determined at compile time that the message will not be +// printed, the statement will be compiled out. +// +// Example: to strip out all INFO and WARNING messages, use the value +// of 2 below. To make an exception for WARNING messages from a single +// file, add "#define GOOGLE_STRIP_LOG 1" to that file _before_ including +// base/logging.h +#ifndef GOOGLE_STRIP_LOG +#define GOOGLE_STRIP_LOG 0 +#endif + +// GCC can be told that a certain branch is not likely to be taken (for +// instance, a CHECK failure), and use that information in static analysis. +// Giving it this information can help it optimize for the common case in +// the absence of better information (ie. -fprofile-arcs). +// +#ifndef GOOGLE_PREDICT_BRANCH_NOT_TAKEN +#if 1 +#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) (__builtin_expect(x, 0)) +#else +#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) x +#endif +#endif + +#ifndef GOOGLE_PREDICT_FALSE +#if 1 +#define GOOGLE_PREDICT_FALSE(x) (__builtin_expect(x, 0)) +#else +#define GOOGLE_PREDICT_FALSE(x) x +#endif +#endif + +#ifndef GOOGLE_PREDICT_TRUE +#if 1 +#define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) +#else +#define GOOGLE_PREDICT_TRUE(x) x +#endif +#endif + + +// Make a bunch of macros for logging. The way to log things is to stream +// things to LOG(). E.g., +// +// LOG(INFO) << "Found " << num_cookies << " cookies"; +// +// You can capture log messages in a string, rather than reporting them +// immediately: +// +// vector errors; +// LOG_STRING(ERROR, &errors) << "Couldn't parse cookie #" << cookie_num; +// +// This pushes back the new error onto 'errors'; if given a NULL pointer, +// it reports the error via LOG(ERROR). +// +// You can also do conditional logging: +// +// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; +// +// You can also do occasional logging (log every n'th occurrence of an +// event): +// +// LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; +// +// The above will cause log messages to be output on the 1st, 11th, 21st, ... +// times it is executed. Note that the special google::COUNTER value is used +// to identify which repetition is happening. +// +// You can also do occasional conditional logging (log every n'th +// occurrence of an event, when condition is satisfied): +// +// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER +// << "th big cookie"; +// +// You can log messages the first N times your code executes a line. E.g. +// +// LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie"; +// +// Outputs log messages for the first 20 times it is executed. +// +// Analogous SYSLOG, SYSLOG_IF, and SYSLOG_EVERY_N macros are available. +// These log to syslog as well as to the normal logs. If you use these at +// all, you need to be aware that syslog can drastically reduce performance, +// especially if it is configured for remote logging! Don't use these +// unless you fully understand this and have a concrete need to use them. +// Even then, try to minimize your use of them. +// +// There are also "debug mode" logging macros like the ones above: +// +// DLOG(INFO) << "Found cookies"; +// +// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; +// +// DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; +// +// All "debug mode" logging is compiled away to nothing for non-debug mode +// compiles. +// +// We also have +// +// LOG_ASSERT(assertion); +// DLOG_ASSERT(assertion); +// +// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion; +// +// There are "verbose level" logging macros. They look like +// +// VLOG(1) << "I'm printed when you run the program with --v=1 or more"; +// VLOG(2) << "I'm printed when you run the program with --v=2 or more"; +// +// These always log at the INFO log level (when they log at all). +// The verbose logging can also be turned on module-by-module. For instance, +// --vmodule=mapreduce=2,file=1,gfs*=3 --v=0 +// will cause: +// a. VLOG(2) and lower messages to be printed from mapreduce.{h,cc} +// b. VLOG(1) and lower messages to be printed from file.{h,cc} +// c. VLOG(3) and lower messages to be printed from files prefixed with "gfs" +// d. VLOG(0) and lower messages to be printed from elsewhere +// +// The wildcarding functionality shown by (c) supports both '*' (match +// 0 or more characters) and '?' (match any single character) wildcards. +// +// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as +// +// if (VLOG_IS_ON(2)) { +// // do some logging preparation and logging +// // that can't be accomplished with just VLOG(2) << ...; +// } +// +// There are also VLOG_IF, VLOG_EVERY_N and VLOG_IF_EVERY_N "verbose level" +// condition macros for sample cases, when some extra computation and +// preparation for logs is not needed. +// VLOG_IF(1, (size > 1024)) +// << "I'm printed when size is more than 1024 and when you run the " +// "program with --v=1 or more"; +// VLOG_EVERY_N(1, 10) +// << "I'm printed every 10th occurrence, and when you run the program " +// "with --v=1 or more. Present occurence is " << google::COUNTER; +// VLOG_IF_EVERY_N(1, (size > 1024), 10) +// << "I'm printed on every 10th occurence of case when size is more " +// " than 1024, when you run the program with --v=1 or more. "; +// "Present occurence is " << google::COUNTER; +// +// The supported severity levels for macros that allow you to specify one +// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL. +// Note that messages of a given severity are logged not only in the +// logfile for that severity, but also in all logfiles of lower severity. +// E.g., a message of severity FATAL will be logged to the logfiles of +// severity FATAL, ERROR, WARNING, and INFO. +// +// There is also the special severity of DFATAL, which logs FATAL in +// debug mode, ERROR in normal mode. +// +// Very important: logging a message at the FATAL severity level causes +// the program to terminate (after the message is logged). +// +// Unless otherwise specified, logs will be written to the filename +// "...log..", followed +// by the date, time, and pid (you can't prevent the date, time, and pid +// from being in the filename). +// +// The logging code takes two flags: +// --v=# set the verbose level +// --logtostderr log all the messages to stderr instead of to logfiles + +// LOG LINE PREFIX FORMAT +// +// Log lines have this form: +// +// Lyyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg... +// +// where the fields are defined as follows: +// +// L A single character, representing the log level +// (eg 'I' for INFO) +// yyyy The year +// mm The month (zero padded; ie May is '05') +// dd The day (zero padded) +// hh:mm:ss.uuuuuu Time in hours, minutes and fractional seconds +// threadid The space-padded thread ID as returned by GetTID() +// (this matches the PID on Linux) +// file The file name +// line The line number +// msg The user-supplied message +// +// Example: +// +// I1103 11:57:31.739339 24395 google.cc:2341] Command line: ./some_prog +// I1103 11:57:31.739403 24395 google.cc:2342] Process id 24395 +// +// NOTE: although the microseconds are useful for comparing events on +// a single machine, clocks on different machines may not be well +// synchronized. Hence, use caution when comparing the low bits of +// timestamps from different machines. + +#pragma push_macro("DECLARE_VARIABLE") +#pragma push_macro("DECLARE_bool") +#pragma push_macro("DECLARE_string") +#pragma push_macro("DECLARE_int32") +#pragma push_macro("DECLARE_uint32") + +#ifdef DECLARE_VARIABLE +#undef DECLARE_VARIABLE +#endif + +#ifdef DECLARE_bool +#undef DECLARE_bool +#endif + +#ifdef DECLARE_string +#undef DECLARE_string +#endif + +#ifdef DECLARE_int32 +#undef DECLARE_int32 +#endif + +#ifdef DECLARE_uint32 +#undef DECLARE_uint32 +#endif + +#ifndef DECLARE_VARIABLE +#define DECLARE_VARIABLE(type, shorttype, name, tn) \ + namespace fL##shorttype { \ + extern GLOG_EXPORT type FLAGS_##name; \ + } \ + using fL##shorttype::FLAGS_##name + +// bool specialization +#define DECLARE_bool(name) \ + DECLARE_VARIABLE(bool, B, name, bool) + +// int32 specialization +#define DECLARE_int32(name) \ + DECLARE_VARIABLE(google::int32, I, name, int32) + +#if !defined(DECLARE_uint32) +// uint32 specialization +#define DECLARE_uint32(name) \ + DECLARE_VARIABLE(google::uint32, U, name, uint32) +#endif // !defined(DECLARE_uint32) && !(0) + +// Special case for string, because we have to specify the namespace +// std::string, which doesn't play nicely with our FLAG__namespace hackery. +#define DECLARE_string(name) \ + namespace fLS { \ + extern GLOG_EXPORT std::string& FLAGS_##name; \ + } \ + using fLS::FLAGS_##name +#endif + +// Set whether appending a timestamp to the log file name +DECLARE_bool(timestamp_in_logfile_name); + +// Set whether log messages go to stdout instead of logfiles +DECLARE_bool(logtostdout); + +// Set color messages logged to stdout (if supported by terminal). +DECLARE_bool(colorlogtostdout); + +// Set whether log messages go to stderr instead of logfiles +DECLARE_bool(logtostderr); + +// Set whether log messages go to stderr in addition to logfiles. +DECLARE_bool(alsologtostderr); + +// Set color messages logged to stderr (if supported by terminal). +DECLARE_bool(colorlogtostderr); + +// Log messages at a level >= this flag are automatically sent to +// stderr in addition to log files. +DECLARE_int32(stderrthreshold); + +// Set whether the log file header should be written upon creating a file. +DECLARE_bool(log_file_header); + +// Set whether the log prefix should be prepended to each line of output. +DECLARE_bool(log_prefix); + +// Set whether the year should be included in the log prefix. +DECLARE_bool(log_year_in_prefix); + +// Log messages at a level <= this flag are buffered. +// Log messages at a higher level are flushed immediately. +DECLARE_int32(logbuflevel); + +// Sets the maximum number of seconds which logs may be buffered for. +DECLARE_int32(logbufsecs); + +// Log suppression level: messages logged at a lower level than this +// are suppressed. +DECLARE_int32(minloglevel); + +// If specified, logfiles are written into this directory instead of the +// default logging directory. +DECLARE_string(log_dir); + +// Set the log file mode. +DECLARE_int32(logfile_mode); + +// Sets the path of the directory into which to put additional links +// to the log files. +DECLARE_string(log_link); + +DECLARE_int32(v); // in vlog_is_on.cc + +DECLARE_string(vmodule); // also in vlog_is_on.cc + +// Sets the maximum log file size (in MB). +DECLARE_uint32(max_log_size); + +// Sets whether to avoid logging to the disk if the disk is full. +DECLARE_bool(stop_logging_if_full_disk); + +// Use UTC time for logging +DECLARE_bool(log_utc_time); + +// Log messages below the GOOGLE_STRIP_LOG level will be compiled away for +// security reasons. See LOG(severtiy) below. + +// A few definitions of macros that don't generate much code. Since +// LOG(INFO) and its ilk are used all over our code, it's +// better to have compact code for these operations. + +#if GOOGLE_STRIP_LOG == 0 +#define COMPACT_GOOGLE_LOG_INFO google::LogMessage( \ + __FILE__, __LINE__) +#define LOG_TO_STRING_INFO(message) google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_INFO, message) +#else +#define COMPACT_GOOGLE_LOG_INFO google::NullStream() +#define LOG_TO_STRING_INFO(message) google::NullStream() +#endif + +#if GOOGLE_STRIP_LOG <= 1 +#define COMPACT_GOOGLE_LOG_WARNING google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_WARNING) +#define LOG_TO_STRING_WARNING(message) google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_WARNING, message) +#else +#define COMPACT_GOOGLE_LOG_WARNING google::NullStream() +#define LOG_TO_STRING_WARNING(message) google::NullStream() +#endif + +#if GOOGLE_STRIP_LOG <= 2 +#define COMPACT_GOOGLE_LOG_ERROR google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_ERROR) +#define LOG_TO_STRING_ERROR(message) google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_ERROR, message) +#else +#define COMPACT_GOOGLE_LOG_ERROR google::NullStream() +#define LOG_TO_STRING_ERROR(message) google::NullStream() +#endif + +#if GOOGLE_STRIP_LOG <= 3 +#define COMPACT_GOOGLE_LOG_FATAL google::LogMessageFatal( \ + __FILE__, __LINE__) +#define LOG_TO_STRING_FATAL(message) google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_FATAL, message) +#else +#define COMPACT_GOOGLE_LOG_FATAL google::NullStreamFatal() +#define LOG_TO_STRING_FATAL(message) google::NullStreamFatal() +#endif + +#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) +#define DCHECK_IS_ON() 0 +#else +#define DCHECK_IS_ON() 1 +#endif + +// For DFATAL, we want to use LogMessage (as opposed to +// LogMessageFatal), to be consistent with the original behavior. +#if !DCHECK_IS_ON() +#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR +#elif GOOGLE_STRIP_LOG <= 3 +#define COMPACT_GOOGLE_LOG_DFATAL google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_FATAL) +#else +#define COMPACT_GOOGLE_LOG_DFATAL google::NullStreamFatal() +#endif + +#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, &google::LogMessage::SendToLog) +#define SYSLOG_INFO(counter) \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, \ + &google::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_WARNING(counter) \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \ + &google::LogMessage::SendToLog) +#define SYSLOG_WARNING(counter) \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \ + &google::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_ERROR(counter) \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \ + &google::LogMessage::SendToLog) +#define SYSLOG_ERROR(counter) \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \ + &google::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_FATAL(counter) \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \ + &google::LogMessage::SendToLog) +#define SYSLOG_FATAL(counter) \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \ + &google::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_DFATAL(counter) \ + google::LogMessage(__FILE__, __LINE__, google::DFATAL_LEVEL, counter, \ + &google::LogMessage::SendToLog) +#define SYSLOG_DFATAL(counter) \ + google::LogMessage(__FILE__, __LINE__, google::DFATAL_LEVEL, counter, \ + &google::LogMessage::SendToSyslogAndLog) + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || defined(__CYGWIN32__) +// A very useful logging macro to log windows errors: +#define LOG_SYSRESULT(result) \ + if (FAILED(HRESULT_FROM_WIN32(result))) { \ + LPSTR message = NULL; \ + LPSTR msg = reinterpret_cast(&message); \ + DWORD message_length = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | \ + FORMAT_MESSAGE_FROM_SYSTEM | \ + FORMAT_MESSAGE_IGNORE_INSERTS, \ + 0, result, 0, msg, 100, NULL); \ + if (message_length > 0) { \ + google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, 0, \ + &google::LogMessage::SendToLog).stream() \ + << reinterpret_cast(message); \ + LocalFree(message); \ + } \ + } +#endif + +// We use the preprocessor's merging operator, "##", so that, e.g., +// LOG(INFO) becomes the token GOOGLE_LOG_INFO. There's some funny +// subtle difference between ostream member streaming functions (e.g., +// ostream::operator<<(int) and ostream non-member streaming functions +// (e.g., ::operator<<(ostream&, string&): it turns out that it's +// impossible to stream something like a string directly to an unnamed +// ostream. We employ a neat hack by calling the stream() member +// function of LogMessage which seems to avoid the problem. +#define LOG(severity) COMPACT_GOOGLE_LOG_ ## severity.stream() +#define SYSLOG(severity) SYSLOG_ ## severity(0).stream() + +namespace google { + +// They need the definitions of integer types. +#include +#include + +// Initialize google's logging library. You will see the program name +// specified by argv0 in log outputs. +GLOG_EXPORT void InitGoogleLogging(const char* argv0); + +GLOG_EXPORT void InitGoogleLogging(const char* argv0, + CustomPrefixCallback prefix_callback, + void* prefix_callback_data = NULL); + +// Check if google's logging library has been initialized. +GLOG_EXPORT bool IsGoogleLoggingInitialized(); + +// Shutdown google's logging library. +GLOG_EXPORT void ShutdownGoogleLogging(); + +#if defined(__GNUC__) +typedef void (*logging_fail_func_t)() __attribute__((noreturn)); +#else +typedef void (*logging_fail_func_t)(); +#endif + +// Install a function which will be called after LOG(FATAL). +GLOG_EXPORT void InstallFailureFunction(logging_fail_func_t fail_func); + +// Enable/Disable old log cleaner. +GLOG_EXPORT void EnableLogCleaner(unsigned int overdue_days); +GLOG_EXPORT void DisableLogCleaner(); +GLOG_EXPORT void SetApplicationFingerprint(const std::string& fingerprint); + +class LogSink; // defined below + +// If a non-NULL sink pointer is given, we push this message to that sink. +// For LOG_TO_SINK we then do normal LOG(severity) logging as well. +// This is useful for capturing messages and passing/storing them +// somewhere more specific than the global log of the process. +// Argument types: +// LogSink* sink; +// LogSeverity severity; +// The cast is to disambiguate NULL arguments. +#define LOG_TO_SINK(sink, severity) \ + google::LogMessage( \ + __FILE__, __LINE__, \ + google::GLOG_ ## severity, \ + static_cast(sink), true).stream() +#define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity) \ + google::LogMessage( \ + __FILE__, __LINE__, \ + google::GLOG_ ## severity, \ + static_cast(sink), false).stream() + +// If a non-NULL string pointer is given, we write this message to that string. +// We then do normal LOG(severity) logging as well. +// This is useful for capturing messages and storing them somewhere more +// specific than the global log of the process. +// Argument types: +// string* message; +// LogSeverity severity; +// The cast is to disambiguate NULL arguments. +// NOTE: LOG(severity) expands to LogMessage().stream() for the specified +// severity. +#define LOG_TO_STRING(severity, message) \ + LOG_TO_STRING_##severity(static_cast(message)).stream() + +// If a non-NULL pointer is given, we push the message onto the end +// of a vector of strings; otherwise, we report it with LOG(severity). +// This is handy for capturing messages and perhaps passing them back +// to the caller, rather than reporting them immediately. +// Argument types: +// LogSeverity severity; +// vector *outvec; +// The cast is to disambiguate NULL arguments. +#define LOG_STRING(severity, outvec) \ + LOG_TO_STRING_##severity(static_cast*>(outvec)).stream() + +#define LOG_IF(severity, condition) \ + static_cast(0), \ + !(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) +#define SYSLOG_IF(severity, condition) \ + static_cast(0), \ + !(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity) + +#define LOG_ASSERT(condition) \ + LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition +#define SYSLOG_ASSERT(condition) \ + SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition + +// CHECK dies with a fatal error if condition is not true. It is *not* +// controlled by DCHECK_IS_ON(), so the check will be executed regardless of +// compilation mode. Therefore, it is safe to do things like: +// CHECK(fp->Write(x) == 4) +#define CHECK(condition) \ + LOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN(!(condition))) \ + << "Check failed: " #condition " " + +// A container for a string pointer which can be evaluated to a bool - +// true iff the pointer is NULL. +struct CheckOpString { + CheckOpString(std::string* str) : str_(str) { } + // No destructor: if str_ is non-NULL, we're about to LOG(FATAL), + // so there's no point in cleaning up str_. + operator bool() const { + return GOOGLE_PREDICT_BRANCH_NOT_TAKEN(str_ != NULL); + } + std::string* str_; +}; + +// Function is overloaded for integral types to allow static const +// integrals declared in classes and not defined to be used as arguments to +// CHECK* macros. It's not encouraged though. +template +inline const T& GetReferenceableValue(const T& t) { return t; } +inline char GetReferenceableValue(char t) { return t; } +inline unsigned char GetReferenceableValue(unsigned char t) { return t; } +inline signed char GetReferenceableValue(signed char t) { return t; } +inline short GetReferenceableValue(short t) { return t; } +inline unsigned short GetReferenceableValue(unsigned short t) { return t; } +inline int GetReferenceableValue(int t) { return t; } +inline unsigned int GetReferenceableValue(unsigned int t) { return t; } +inline long GetReferenceableValue(long t) { return t; } +inline unsigned long GetReferenceableValue(unsigned long t) { return t; } +inline long long GetReferenceableValue(long long t) { return t; } +inline unsigned long long GetReferenceableValue(unsigned long long t) { + return t; +} + +// This is a dummy class to define the following operator. +struct DummyClassToDefineOperator {}; + +} + +// Define global operator<< to declare using ::operator<<. +// This declaration will allow use to use CHECK macros for user +// defined classes which have operator<< (e.g., stl_logging.h). +inline std::ostream& operator<<( + std::ostream& out, const google::DummyClassToDefineOperator&) { + return out; +} + +namespace google { + +// This formats a value for a failing CHECK_XX statement. Ordinarily, +// it uses the definition for operator<<, with a few special cases below. +template +inline void MakeCheckOpValueString(std::ostream* os, const T& v) { + (*os) << v; +} + +// Overrides for char types provide readable values for unprintable +// characters. +template <> GLOG_EXPORT +void MakeCheckOpValueString(std::ostream* os, const char& v); +template <> GLOG_EXPORT +void MakeCheckOpValueString(std::ostream* os, const signed char& v); +template <> GLOG_EXPORT +void MakeCheckOpValueString(std::ostream* os, const unsigned char& v); + +// Provide printable value for nullptr_t +template <> +GLOG_EXPORT void MakeCheckOpValueString(std::ostream* os, + const std::nullptr_t& v); + +// Build the error message string. Specify no inlining for code size. +template +std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext) + __attribute__((noinline)); + +namespace base { +namespace internal { + +// If "s" is less than base_logging::INFO, returns base_logging::INFO. +// If "s" is greater than base_logging::FATAL, returns +// base_logging::ERROR. Otherwise, returns "s". +LogSeverity NormalizeSeverity(LogSeverity s); + +} // namespace internal + +// A helper class for formatting "expr (V1 vs. V2)" in a CHECK_XX +// statement. See MakeCheckOpString for sample usage. Other +// approaches were considered: use of a template method (e.g., +// base::BuildCheckOpString(exprtext, base::Print, &v1, +// base::Print, &v2), however this approach has complications +// related to volatile arguments and function-pointer arguments). +class GLOG_EXPORT CheckOpMessageBuilder { + public: + // Inserts "exprtext" and " (" to the stream. + explicit CheckOpMessageBuilder(const char *exprtext); + // Deletes "stream_". + ~CheckOpMessageBuilder(); + // For inserting the first variable. + std::ostream* ForVar1() { return stream_; } + // For inserting the second variable (adds an intermediate " vs. "). + std::ostream* ForVar2(); + // Get the result (inserts the closing ")"). + std::string* NewString(); + + private: + std::ostringstream *stream_; +}; + +} // namespace base + +template +std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext) { + base::CheckOpMessageBuilder comb(exprtext); + MakeCheckOpValueString(comb.ForVar1(), v1); + MakeCheckOpValueString(comb.ForVar2(), v2); + return comb.NewString(); +} + +// Helper functions for CHECK_OP macro. +// The (int, int) specialization works around the issue that the compiler +// will not instantiate the template version of the function on values of +// unnamed enum type - see comment below. +#define DEFINE_CHECK_OP_IMPL(name, op) \ + template \ + inline std::string* name##Impl(const T1& v1, const T2& v2, \ + const char* exprtext) { \ + if (GOOGLE_PREDICT_TRUE(v1 op v2)) return NULL; \ + else return MakeCheckOpString(v1, v2, exprtext); \ + } \ + inline std::string* name##Impl(int v1, int v2, const char* exprtext) { \ + return name##Impl(v1, v2, exprtext); \ + } + +// We use the full name Check_EQ, Check_NE, etc. in case the file including +// base/logging.h provides its own #defines for the simpler names EQ, NE, etc. +// This happens if, for example, those are used as token names in a +// yacc grammar. +DEFINE_CHECK_OP_IMPL(Check_EQ, ==) // Compilation error with CHECK_EQ(NULL, x)? +DEFINE_CHECK_OP_IMPL(Check_NE, !=) // Use CHECK(x == NULL) instead. +DEFINE_CHECK_OP_IMPL(Check_LE, <=) +DEFINE_CHECK_OP_IMPL(Check_LT, < ) +DEFINE_CHECK_OP_IMPL(Check_GE, >=) +DEFINE_CHECK_OP_IMPL(Check_GT, > ) +#undef DEFINE_CHECK_OP_IMPL + +// Helper macro for binary operators. +// Don't use this macro directly in your code, use CHECK_EQ et al below. + +#if defined(STATIC_ANALYSIS) +// Only for static analysis tool to know that it is equivalent to assert +#define CHECK_OP_LOG(name, op, val1, val2, log) CHECK((val1) op (val2)) +#elif DCHECK_IS_ON() +// In debug mode, avoid constructing CheckOpStrings if possible, +// to reduce the overhead of CHECK statments by 2x. +// Real DCHECK-heavy tests have seen 1.5x speedups. + +// The meaning of "string" might be different between now and +// when this macro gets invoked (e.g., if someone is experimenting +// with other string implementations that get defined after this +// file is included). Save the current meaning now and use it +// in the macro. +typedef std::string _Check_string; +#define CHECK_OP_LOG(name, op, val1, val2, log) \ + while (google::_Check_string* _result = \ + google::Check##name##Impl( \ + google::GetReferenceableValue(val1), \ + google::GetReferenceableValue(val2), \ + #val1 " " #op " " #val2)) \ + log(__FILE__, __LINE__, \ + google::CheckOpString(_result)).stream() +#else +// In optimized mode, use CheckOpString to hint to compiler that +// the while condition is unlikely. +#define CHECK_OP_LOG(name, op, val1, val2, log) \ + while (google::CheckOpString _result = \ + google::Check##name##Impl( \ + google::GetReferenceableValue(val1), \ + google::GetReferenceableValue(val2), \ + #val1 " " #op " " #val2)) \ + log(__FILE__, __LINE__, _result).stream() +#endif // STATIC_ANALYSIS, DCHECK_IS_ON() + +#if GOOGLE_STRIP_LOG <= 3 +#define CHECK_OP(name, op, val1, val2) \ + CHECK_OP_LOG(name, op, val1, val2, google::LogMessageFatal) +#else +#define CHECK_OP(name, op, val1, val2) \ + CHECK_OP_LOG(name, op, val1, val2, google::NullStreamFatal) +#endif // STRIP_LOG <= 3 + +// Equality/Inequality checks - compare two values, and log a FATAL message +// including the two values when the result is not as expected. The values +// must have operator<<(ostream, ...) defined. +// +// You may append to the error message like so: +// CHECK_NE(1, 2) << ": The world must be ending!"; +// +// We are very careful to ensure that each argument is evaluated exactly +// once, and that anything which is legal to pass as a function argument is +// legal here. In particular, the arguments may be temporary expressions +// which will end up being destroyed at the end of the apparent statement, +// for example: +// CHECK_EQ(string("abc")[1], 'b'); +// +// WARNING: These don't compile correctly if one of the arguments is a pointer +// and the other is NULL. To work around this, simply static_cast NULL to the +// type of the desired pointer. + +#define CHECK_EQ(val1, val2) CHECK_OP(_EQ, ==, val1, val2) +#define CHECK_NE(val1, val2) CHECK_OP(_NE, !=, val1, val2) +#define CHECK_LE(val1, val2) CHECK_OP(_LE, <=, val1, val2) +#define CHECK_LT(val1, val2) CHECK_OP(_LT, < , val1, val2) +#define CHECK_GE(val1, val2) CHECK_OP(_GE, >=, val1, val2) +#define CHECK_GT(val1, val2) CHECK_OP(_GT, > , val1, val2) + +// Check that the input is non NULL. This very useful in constructor +// initializer lists. + +#define CHECK_NOTNULL(val) \ + google::CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val)) + +// Helper functions for string comparisons. +// To avoid bloat, the definitions are in logging.cc. +#define DECLARE_CHECK_STROP_IMPL(func, expected) \ + GLOG_EXPORT std::string* Check##func##expected##Impl( \ + const char* s1, const char* s2, const char* names); +DECLARE_CHECK_STROP_IMPL(strcmp, true) +DECLARE_CHECK_STROP_IMPL(strcmp, false) +DECLARE_CHECK_STROP_IMPL(strcasecmp, true) +DECLARE_CHECK_STROP_IMPL(strcasecmp, false) +#undef DECLARE_CHECK_STROP_IMPL + +// Helper macro for string comparisons. +// Don't use this macro directly in your code, use CHECK_STREQ et al below. +#define CHECK_STROP(func, op, expected, s1, s2) \ + while (google::CheckOpString _result = \ + google::Check##func##expected##Impl((s1), (s2), \ + #s1 " " #op " " #s2)) \ + LOG(FATAL) << *_result.str_ + + +// String (char*) equality/inequality checks. +// CASE versions are case-insensitive. +// +// Note that "s1" and "s2" may be temporary strings which are destroyed +// by the compiler at the end of the current "full expression" +// (e.g. CHECK_STREQ(Foo().c_str(), Bar().c_str())). + +#define CHECK_STREQ(s1, s2) CHECK_STROP(strcmp, ==, true, s1, s2) +#define CHECK_STRNE(s1, s2) CHECK_STROP(strcmp, !=, false, s1, s2) +#define CHECK_STRCASEEQ(s1, s2) CHECK_STROP(strcasecmp, ==, true, s1, s2) +#define CHECK_STRCASENE(s1, s2) CHECK_STROP(strcasecmp, !=, false, s1, s2) + +#define CHECK_INDEX(I,A) CHECK(I < (sizeof(A)/sizeof(A[0]))) +#define CHECK_BOUND(B,A) CHECK(B <= (sizeof(A)/sizeof(A[0]))) + +#define CHECK_DOUBLE_EQ(val1, val2) \ + do { \ + CHECK_LE((val1), (val2)+0.000000000000001L); \ + CHECK_GE((val1), (val2)-0.000000000000001L); \ + } while (0) + +#define CHECK_NEAR(val1, val2, margin) \ + do { \ + CHECK_LE((val1), (val2)+(margin)); \ + CHECK_GE((val1), (val2)-(margin)); \ + } while (0) + +// perror()..googly style! +// +// PLOG() and PLOG_IF() and PCHECK() behave exactly like their LOG* and +// CHECK equivalents with the addition that they postpend a description +// of the current state of errno to their output lines. + +#define PLOG(severity) GOOGLE_PLOG(severity, 0).stream() + +#define GOOGLE_PLOG(severity, counter) \ + google::ErrnoLogMessage( \ + __FILE__, __LINE__, google::GLOG_ ## severity, counter, \ + &google::LogMessage::SendToLog) + +#define PLOG_IF(severity, condition) \ + static_cast(0), \ + !(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity) + +// A CHECK() macro that postpends errno if the condition is false. E.g. +// +// if (poll(fds, nfds, timeout) == -1) { PCHECK(errno == EINTR); ... } +#define PCHECK(condition) \ + PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN(!(condition))) \ + << "Check failed: " #condition " " + +// A CHECK() macro that lets you assert the success of a function that +// returns -1 and sets errno in case of an error. E.g. +// +// CHECK_ERR(mkdir(path, 0700)); +// +// or +// +// int fd = open(filename, flags); CHECK_ERR(fd) << ": open " << filename; +#define CHECK_ERR(invocation) \ +PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \ + << #invocation + +// Use macro expansion to create, for each use of LOG_EVERY_N(), static +// variables with the __LINE__ expansion as part of the variable name. +#define LOG_EVERY_N_VARNAME(base, line) LOG_EVERY_N_VARNAME_CONCAT(base, line) +#define LOG_EVERY_N_VARNAME_CONCAT(base, line) base ## line + +#define LOG_OCCURRENCES LOG_EVERY_N_VARNAME(occurrences_, __LINE__) +#define LOG_OCCURRENCES_MOD_N LOG_EVERY_N_VARNAME(occurrences_mod_n_, __LINE__) + +#define LOG_TIME_PERIOD LOG_EVERY_N_VARNAME(timePeriod_, __LINE__) +#define LOG_PREVIOUS_TIME_RAW LOG_EVERY_N_VARNAME(previousTimeRaw_, __LINE__) +#define LOG_TIME_DELTA LOG_EVERY_N_VARNAME(deltaTime_, __LINE__) +#define LOG_CURRENT_TIME LOG_EVERY_N_VARNAME(currentTime_, __LINE__) +#define LOG_PREVIOUS_TIME LOG_EVERY_N_VARNAME(previousTime_, __LINE__) + +#if defined(__has_feature) +# if __has_feature(thread_sanitizer) +# define GLOG_SANITIZE_THREAD 1 +# endif +#endif + +#if !defined(GLOG_SANITIZE_THREAD) && defined(__SANITIZE_THREAD__) && __SANITIZE_THREAD__ +# define GLOG_SANITIZE_THREAD 1 +#endif + +#if defined(GLOG_SANITIZE_THREAD) +#define GLOG_IFDEF_THREAD_SANITIZER(X) X +#else +#define GLOG_IFDEF_THREAD_SANITIZER(X) +#endif + +#if defined(GLOG_SANITIZE_THREAD) +} // namespace google + +// We need to identify the static variables as "benign" races +// to avoid noisy reports from TSAN. +extern "C" void AnnotateBenignRaceSized( + const char *file, + int line, + const volatile void *mem, + size_t size, + const char *description); + +namespace google { +#endif + +#define SOME_KIND_OF_LOG_EVERY_T(severity, seconds) \ + constexpr std::chrono::nanoseconds LOG_TIME_PERIOD = \ + std::chrono::duration_cast( \ + std::chrono::duration(seconds)); \ + static std::atomic LOG_PREVIOUS_TIME_RAW; \ + GLOG_IFDEF_THREAD_SANITIZER( \ + AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_TIME_PERIOD, \ + sizeof(@ac_google_namespace @ ::int64), "")); \ + GLOG_IFDEF_THREAD_SANITIZER( \ + AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_PREVIOUS_TIME_RAW, \ + sizeof(@ac_google_namespace @ ::int64), "")); \ + const auto LOG_CURRENT_TIME = \ + std::chrono::duration_cast( \ + std::chrono::steady_clock::now().time_since_epoch()); \ + const auto LOG_PREVIOUS_TIME = \ + LOG_PREVIOUS_TIME_RAW.load(std::memory_order_relaxed); \ + const auto LOG_TIME_DELTA = \ + LOG_CURRENT_TIME - std::chrono::nanoseconds(LOG_PREVIOUS_TIME); \ + if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \ + LOG_PREVIOUS_TIME_RAW.store( \ + std::chrono::duration_cast(LOG_CURRENT_TIME) \ + .count(), \ + std::memory_order_relaxed); \ + if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \ + google ::LogMessage( \ + __FILE__, __LINE__, google ::GLOG_##severity) \ + .stream() + +#define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \ + ++LOG_OCCURRENCES; \ + if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \ + if (LOG_OCCURRENCES_MOD_N == 1) \ + google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \ + ++LOG_OCCURRENCES; \ + if ((condition) && \ + ((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \ + google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \ + ++LOG_OCCURRENCES; \ + if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \ + if (LOG_OCCURRENCES_MOD_N == 1) \ + google::ErrnoLogMessage( \ + __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + if (LOG_OCCURRENCES <= n) \ + ++LOG_OCCURRENCES; \ + if (LOG_OCCURRENCES <= n) \ + google::LogMessage( \ + __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +namespace glog_internal_namespace_ { +template +struct CompileAssert { +}; +struct CrashReason; + +// Returns true if FailureSignalHandler is installed. +// Needs to be exported since it's used by the signalhandler_unittest. +GLOG_EXPORT bool IsFailureSignalHandlerInstalled(); +} // namespace glog_internal_namespace_ + +#define LOG_EVERY_N(severity, n) \ + SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog) + +#define LOG_EVERY_T(severity, T) SOME_KIND_OF_LOG_EVERY_T(severity, (T)) + +#define SYSLOG_EVERY_N(severity, n) \ + SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToSyslogAndLog) + +#define PLOG_EVERY_N(severity, n) \ + SOME_KIND_OF_PLOG_EVERY_N(severity, (n), google::LogMessage::SendToLog) + +#define LOG_FIRST_N(severity, n) \ + SOME_KIND_OF_LOG_FIRST_N(severity, (n), google::LogMessage::SendToLog) + +#define LOG_IF_EVERY_N(severity, condition, n) \ + SOME_KIND_OF_LOG_IF_EVERY_N(severity, (condition), (n), google::LogMessage::SendToLog) + +// We want the special COUNTER value available for LOG_EVERY_X()'ed messages +enum PRIVATE_Counter {COUNTER}; + +#ifdef GLOG_NO_ABBREVIATED_SEVERITIES +// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets +// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us +// to keep using this syntax, we define this macro to do the same thing +// as COMPACT_GOOGLE_LOG_ERROR. +#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR +#define SYSLOG_0 SYSLOG_ERROR +#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR +// Needed for LOG_IS_ON(ERROR). +const LogSeverity GLOG_0 = GLOG_ERROR; +#else +// Users may include windows.h after logging.h without +// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN. +// For this case, we cannot detect if ERROR is defined before users +// actually use ERROR. Let's make an undefined symbol to warn users. +# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail +# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG +# define SYSLOG_0 GLOG_ERROR_MSG +# define LOG_TO_STRING_0 GLOG_ERROR_MSG +# define GLOG_0 GLOG_ERROR_MSG +#endif + +// Plus some debug-logging macros that get compiled to nothing for production + +#if DCHECK_IS_ON() + +#define DLOG(severity) LOG(severity) +#define DVLOG(verboselevel) VLOG(verboselevel) +#define DLOG_IF(severity, condition) LOG_IF(severity, condition) +#define DLOG_EVERY_N(severity, n) LOG_EVERY_N(severity, n) +#define DLOG_IF_EVERY_N(severity, condition, n) \ + LOG_IF_EVERY_N(severity, condition, n) +#define DLOG_ASSERT(condition) LOG_ASSERT(condition) + +// debug-only checking. executed if DCHECK_IS_ON(). +#define DCHECK(condition) CHECK(condition) +#define DCHECK_EQ(val1, val2) CHECK_EQ(val1, val2) +#define DCHECK_NE(val1, val2) CHECK_NE(val1, val2) +#define DCHECK_LE(val1, val2) CHECK_LE(val1, val2) +#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2) +#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2) +#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2) +#define DCHECK_NOTNULL(val) CHECK_NOTNULL(val) +#define DCHECK_STREQ(str1, str2) CHECK_STREQ(str1, str2) +#define DCHECK_STRCASEEQ(str1, str2) CHECK_STRCASEEQ(str1, str2) +#define DCHECK_STRNE(str1, str2) CHECK_STRNE(str1, str2) +#define DCHECK_STRCASENE(str1, str2) CHECK_STRCASENE(str1, str2) + +#else // !DCHECK_IS_ON() + +#define DLOG(severity) \ + static_cast(0), \ + true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) + +#define DVLOG(verboselevel) \ + static_cast(0), \ + (true || !VLOG_IS_ON(verboselevel)) ? \ + (void) 0 : google::LogMessageVoidify() & LOG(INFO) + +#define DLOG_IF(severity, condition) \ + static_cast(0), \ + (true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) + +#define DLOG_EVERY_N(severity, n) \ + static_cast(0), \ + true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) + +#define DLOG_IF_EVERY_N(severity, condition, n) \ + static_cast(0), \ + (true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity) + +#define DLOG_ASSERT(condition) \ + static_cast(0), \ + true ? (void) 0 : LOG_ASSERT(condition) + +// MSVC warning C4127: conditional expression is constant +#define DCHECK(condition) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK(condition) + +#define DCHECK_EQ(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_EQ(val1, val2) + +#define DCHECK_NE(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_NE(val1, val2) + +#define DCHECK_LE(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_LE(val1, val2) + +#define DCHECK_LT(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_LT(val1, val2) + +#define DCHECK_GE(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_GE(val1, val2) + +#define DCHECK_GT(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_GT(val1, val2) + +// You may see warnings in release mode if you don't use the return +// value of DCHECK_NOTNULL. Please just use DCHECK for such cases. +#define DCHECK_NOTNULL(val) (val) + +#define DCHECK_STREQ(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STREQ(str1, str2) + +#define DCHECK_STRCASEEQ(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STRCASEEQ(str1, str2) + +#define DCHECK_STRNE(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STRNE(str1, str2) + +#define DCHECK_STRCASENE(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STRCASENE(str1, str2) + +#endif // DCHECK_IS_ON() + +// Log only in verbose mode. + +#define VLOG(verboselevel) LOG_IF(INFO, VLOG_IS_ON(verboselevel)) + +#define VLOG_IF(verboselevel, condition) \ + LOG_IF(INFO, (condition) && VLOG_IS_ON(verboselevel)) + +#define VLOG_EVERY_N(verboselevel, n) \ + LOG_IF_EVERY_N(INFO, VLOG_IS_ON(verboselevel), n) + +#define VLOG_IF_EVERY_N(verboselevel, condition, n) \ + LOG_IF_EVERY_N(INFO, (condition) && VLOG_IS_ON(verboselevel), n) + +namespace base_logging { + +// LogMessage::LogStream is a std::ostream backed by this streambuf. +// This class ignores overflow and leaves two bytes at the end of the +// buffer to allow for a '\n' and '\0'. +class GLOG_EXPORT LogStreamBuf : public std::streambuf { + public: + // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'. + LogStreamBuf(char *buf, int len) { + setp(buf, buf + len - 2); + } + + // This effectively ignores overflow. + int_type overflow(int_type ch) { + return ch; + } + + // Legacy public ostrstream method. + size_t pcount() const { return static_cast(pptr() - pbase()); } + char* pbase() const { return std::streambuf::pbase(); } +}; + +} // namespace base_logging + +// +// This class more or less represents a particular log message. You +// create an instance of LogMessage and then stream stuff to it. +// When you finish streaming to it, ~LogMessage is called and the +// full message gets streamed to the appropriate destination. +// +// You shouldn't actually use LogMessage's constructor to log things, +// though. You should use the LOG() macro (and variants thereof) +// above. +class GLOG_EXPORT LogMessage { +public: + enum { + // Passing kNoLogPrefix for the line number disables the + // log-message prefix. Useful for using the LogMessage + // infrastructure as a printing utility. See also the --log_prefix + // flag for controlling the log-message prefix on an + // application-wide basis. + kNoLogPrefix = -1 + }; + + // LogStream inherit from non-DLL-exported class (std::ostrstream) + // and VC++ produces a warning for this situation. + // However, MSDN says "C4275 can be ignored in Microsoft Visual C++ + // 2005 if you are deriving from a type in the Standard C++ Library" + // http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx + // Let's just ignore the warning. +GLOG_MSVC_PUSH_DISABLE_WARNING(4275) + class GLOG_EXPORT LogStream : public std::ostream { +GLOG_MSVC_POP_WARNING() + public: + LogStream(char *buf, int len, int64 ctr) + : std::ostream(NULL), + streambuf_(buf, len), + ctr_(ctr), + self_(this) { + rdbuf(&streambuf_); + } + + int64 ctr() const { return ctr_; } + void set_ctr(int64 ctr) { ctr_ = ctr; } + LogStream* self() const { return self_; } + + // Legacy std::streambuf methods. + size_t pcount() const { return streambuf_.pcount(); } + char* pbase() const { return streambuf_.pbase(); } + char* str() const { return pbase(); } + + private: + LogStream(const LogStream&); + LogStream& operator=(const LogStream&); + base_logging::LogStreamBuf streambuf_; + int64 ctr_; // Counter hack (for the LOG_EVERY_X() macro) + LogStream *self_; // Consistency check hack + }; + +public: + // icc 8 requires this typedef to avoid an internal compiler error. + typedef void (LogMessage::*SendMethod)(); + + LogMessage(const char* file, int line, LogSeverity severity, int64 ctr, + SendMethod send_method); + + // Two special constructors that generate reduced amounts of code at + // LOG call sites for common cases. + + // Used for LOG(INFO): Implied are: + // severity = INFO, ctr = 0, send_method = &LogMessage::SendToLog. + // + // Using this constructor instead of the more complex constructor above + // saves 19 bytes per call site. + LogMessage(const char* file, int line); + + // Used for LOG(severity) where severity != INFO. Implied + // are: ctr = 0, send_method = &LogMessage::SendToLog + // + // Using this constructor instead of the more complex constructor above + // saves 17 bytes per call site. + LogMessage(const char* file, int line, LogSeverity severity); + + // Constructor to log this message to a specified sink (if not NULL). + // Implied are: ctr = 0, send_method = &LogMessage::SendToSinkAndLog if + // also_send_to_log is true, send_method = &LogMessage::SendToSink otherwise. + LogMessage(const char* file, int line, LogSeverity severity, LogSink* sink, + bool also_send_to_log); + + // Constructor where we also give a vector pointer + // for storing the messages (if the pointer is not NULL). + // Implied are: ctr = 0, send_method = &LogMessage::SaveOrSendToLog. + LogMessage(const char* file, int line, LogSeverity severity, + std::vector* outvec); + + // Constructor where we also give a string pointer for storing the + // message (if the pointer is not NULL). Implied are: ctr = 0, + // send_method = &LogMessage::WriteToStringAndLog. + LogMessage(const char* file, int line, LogSeverity severity, + std::string* message); + + // A special constructor used for check failures + LogMessage(const char* file, int line, const CheckOpString& result); + + ~LogMessage(); + + // Flush a buffered message to the sink set in the constructor. Always + // called by the destructor, it may also be called from elsewhere if + // needed. Only the first call is actioned; any later ones are ignored. + void Flush(); + + // An arbitrary limit on the length of a single log message. This + // is so that streaming can be done more efficiently. + static const size_t kMaxLogMessageLen; + + // Theses should not be called directly outside of logging.*, + // only passed as SendMethod arguments to other LogMessage methods: + void SendToLog(); // Actually dispatch to the logs + void SendToSyslogAndLog(); // Actually dispatch to syslog and the logs + + // Call abort() or similar to perform LOG(FATAL) crash. + [[noreturn]] static void Fail(); + + std::ostream& stream(); + + int preserved_errno() const; + + // Must be called without the log_mutex held. (L < log_mutex) + static int64 num_messages(int severity); + + const LogMessageTime& getLogMessageTime() const; + + struct LogMessageData; + +private: + // Fully internal SendMethod cases: + void SendToSinkAndLog(); // Send to sink if provided and dispatch to the logs + void SendToSink(); // Send to sink if provided, do nothing otherwise. + + // Write to string if provided and dispatch to the logs. + void WriteToStringAndLog(); + + void SaveOrSendToLog(); // Save to stringvec if provided, else to logs + + void Init(const char* file, int line, LogSeverity severity, + void (LogMessage::*send_method)()); + + // Used to fill in crash information during LOG(FATAL) failures. + void RecordCrashReason(glog_internal_namespace_::CrashReason* reason); + + // Counts of messages sent at each priority: + static int64 num_messages_[NUM_SEVERITIES]; // under log_mutex + + // We keep the data in a separate struct so that each instance of + // LogMessage uses less stack space. + LogMessageData* allocated_; + LogMessageData* data_; + LogMessageTime logmsgtime_; + + friend class LogDestination; + + LogMessage(const LogMessage&); + void operator=(const LogMessage&); +}; + +// This class happens to be thread-hostile because all instances share +// a single data buffer, but since it can only be created just before +// the process dies, we don't worry so much. +class GLOG_EXPORT LogMessageFatal : public LogMessage { + public: + LogMessageFatal(const char* file, int line); + LogMessageFatal(const char* file, int line, const CheckOpString& result); + [[noreturn]] ~LogMessageFatal(); +}; + +// A non-macro interface to the log facility; (useful +// when the logging level is not a compile-time constant). +inline void LogAtLevel(int const severity, std::string const &msg) { + LogMessage(__FILE__, __LINE__, severity).stream() << msg; +} + +// A macro alternative of LogAtLevel. New code may want to use this +// version since there are two advantages: 1. this version outputs the +// file name and the line number where this macro is put like other +// LOG macros, 2. this macro can be used as C++ stream. +#define LOG_AT_LEVEL(severity) google::LogMessage(__FILE__, __LINE__, severity).stream() + +// Helper for CHECK_NOTNULL(). +// +// In C++11, all cases can be handled by a single function. Since the value +// category of the argument is preserved (also for rvalue references), +// member initializer lists like the one below will compile correctly: +// +// Foo() +// : x_(CHECK_NOTNULL(MethodReturningUniquePtr())) {} +template +T CheckNotNull(const char* file, int line, const char* names, T&& t) { + if (t == nullptr) { + LogMessageFatal(file, line, new std::string(names)); + } + return std::forward(t); +} + +// Allow folks to put a counter in the LOG_EVERY_X()'ed messages. This +// only works if ostream is a LogStream. If the ostream is not a +// LogStream you'll get an assert saying as much at runtime. +GLOG_EXPORT std::ostream& operator<<(std::ostream &os, + const PRIVATE_Counter&); + + +// Derived class for PLOG*() above. +class GLOG_EXPORT ErrnoLogMessage : public LogMessage { + public: + ErrnoLogMessage(const char* file, int line, LogSeverity severity, int64 ctr, + void (LogMessage::*send_method)()); + + // Postpends ": strerror(errno) [errno]". + ~ErrnoLogMessage(); + + private: + ErrnoLogMessage(const ErrnoLogMessage&); + void operator=(const ErrnoLogMessage&); +}; + + +// This class is used to explicitly ignore values in the conditional +// logging macros. This avoids compiler warnings like "value computed +// is not used" and "statement has no effect". + +class GLOG_EXPORT LogMessageVoidify { + public: + LogMessageVoidify() { } + // This has to be an operator with a precedence lower than << but + // higher than ?: + void operator&(std::ostream&) { } +}; + + +// Flushes all log files that contains messages that are at least of +// the specified severity level. Thread-safe. +GLOG_EXPORT void FlushLogFiles(LogSeverity min_severity); + +// Flushes all log files that contains messages that are at least of +// the specified severity level. Thread-hostile because it ignores +// locking -- used for catastrophic failures. +GLOG_EXPORT void FlushLogFilesUnsafe(LogSeverity min_severity); + +// +// Set the destination to which a particular severity level of log +// messages is sent. If base_filename is "", it means "don't log this +// severity". Thread-safe. +// +GLOG_EXPORT void SetLogDestination(LogSeverity severity, + const char* base_filename); + +// +// Set the basename of the symlink to the latest log file at a given +// severity. If symlink_basename is empty, do not make a symlink. If +// you don't call this function, the symlink basename is the +// invocation name of the program. Thread-safe. +// +GLOG_EXPORT void SetLogSymlink(LogSeverity severity, + const char* symlink_basename); + +// +// Used to send logs to some other kind of destination +// Users should subclass LogSink and override send to do whatever they want. +// Implementations must be thread-safe because a shared instance will +// be called from whichever thread ran the LOG(XXX) line. +class GLOG_EXPORT LogSink { + public: + virtual ~LogSink(); + + // Sink's logging logic (message_len is such as to exclude '\n' at the end). + // This method can't use LOG() or CHECK() as logging system mutex(s) are held + // during this call. + virtual void send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, + const LogMessageTime& logmsgtime, const char* message, + size_t message_len); + // Provide an overload for compatibility purposes + GLOG_DEPRECATED + virtual void send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, const std::tm* t, + const char* message, size_t message_len); + + // Redefine this to implement waiting for + // the sink's logging logic to complete. + // It will be called after each send() returns, + // but before that LogMessage exits or crashes. + // By default this function does nothing. + // Using this function one can implement complex logic for send() + // that itself involves logging; and do all this w/o causing deadlocks and + // inconsistent rearrangement of log messages. + // E.g. if a LogSink has thread-specific actions, the send() method + // can simply add the message to a queue and wake up another thread that + // handles real logging while itself making some LOG() calls; + // WaitTillSent() can be implemented to wait for that logic to complete. + // See our unittest for an example. + virtual void WaitTillSent(); + + // Returns the normal text output of the log message. + // Can be useful to implement send(). + static std::string ToString(LogSeverity severity, const char* file, int line, + const LogMessageTime &logmsgtime, + const char* message, size_t message_len); +}; + +// Add or remove a LogSink as a consumer of logging data. Thread-safe. +GLOG_EXPORT void AddLogSink(LogSink *destination); +GLOG_EXPORT void RemoveLogSink(LogSink *destination); + +// +// Specify an "extension" added to the filename specified via +// SetLogDestination. This applies to all severity levels. It's +// often used to append the port we're listening on to the logfile +// name. Thread-safe. +// +GLOG_EXPORT void SetLogFilenameExtension( + const char* filename_extension); + +// +// Make it so that all log messages of at least a particular severity +// are logged to stderr (in addition to logging to the usual log +// file(s)). Thread-safe. +// +GLOG_EXPORT void SetStderrLogging(LogSeverity min_severity); + +// +// Make it so that all log messages go only to stderr. Thread-safe. +// +GLOG_EXPORT void LogToStderr(); + +// +// Make it so that all log messages of at least a particular severity are +// logged via email to a list of addresses (in addition to logging to the +// usual log file(s)). The list of addresses is just a string containing +// the email addresses to send to (separated by spaces, say). Thread-safe. +// +GLOG_EXPORT void SetEmailLogging(LogSeverity min_severity, + const char* addresses); + +// A simple function that sends email. dest is a commma-separated +// list of addressess. Thread-safe. +GLOG_EXPORT bool SendEmail(const char* dest, const char* subject, + const char* body); + +GLOG_EXPORT const std::vector& GetLoggingDirectories(); + +// For tests only: Clear the internal [cached] list of logging directories to +// force a refresh the next time GetLoggingDirectories is called. +// Thread-hostile. +void TestOnly_ClearLoggingDirectoriesList(); + +// Returns a set of existing temporary directories, which will be a +// subset of the directories returned by GetLoggingDirectories(). +// Thread-safe. +GLOG_EXPORT void GetExistingTempDirectories( + std::vector* list); + +// Print any fatal message again -- useful to call from signal handler +// so that the last thing in the output is the fatal message. +// Thread-hostile, but a race is unlikely. +GLOG_EXPORT void ReprintFatalMessage(); + +// Truncate a log file that may be the append-only output of multiple +// processes and hence can't simply be renamed/reopened (typically a +// stdout/stderr). If the file "path" is > "limit" bytes, copy the +// last "keep" bytes to offset 0 and truncate the rest. Since we could +// be racing with other writers, this approach has the potential to +// lose very small amounts of data. For security, only follow symlinks +// if the path is /proc/self/fd/* +GLOG_EXPORT void TruncateLogFile(const char* path, uint64 limit, uint64 keep); + +// Truncate stdout and stderr if they are over the value specified by +// --max_log_size; keep the final 1MB. This function has the same +// race condition as TruncateLogFile. +GLOG_EXPORT void TruncateStdoutStderr(); + +// Return the string representation of the provided LogSeverity level. +// Thread-safe. +GLOG_EXPORT const char* GetLogSeverityName(LogSeverity severity); + +// --------------------------------------------------------------------- +// Implementation details that are not useful to most clients +// --------------------------------------------------------------------- + +// A Logger is the interface used by logging modules to emit entries +// to a log. A typical implementation will dump formatted data to a +// sequence of files. We also provide interfaces that will forward +// the data to another thread so that the invoker never blocks. +// Implementations should be thread-safe since the logging system +// will write to them from multiple threads. + +namespace base { + +class GLOG_EXPORT Logger { + public: + virtual ~Logger(); + + // Writes "message[0,message_len-1]" corresponding to an event that + // occurred at "timestamp". If "force_flush" is true, the log file + // is flushed immediately. + // + // The input message has already been formatted as deemed + // appropriate by the higher level logging facility. For example, + // textual log messages already contain timestamps, and the + // file:linenumber header. + virtual void Write(bool force_flush, + time_t timestamp, + const char* message, + size_t message_len) = 0; + + // Flush any buffered messages + virtual void Flush() = 0; + + // Get the current LOG file size. + // The returned value is approximate since some + // logged data may not have been flushed to disk yet. + virtual uint32 LogSize() = 0; +}; + +// Get the logger for the specified severity level. The logger +// remains the property of the logging module and should not be +// deleted by the caller. Thread-safe. +extern GLOG_EXPORT Logger* GetLogger(LogSeverity level); + +// Set the logger for the specified severity level. The logger +// becomes the property of the logging module and should not +// be deleted by the caller. Thread-safe. +extern GLOG_EXPORT void SetLogger(LogSeverity level, Logger* logger); + +} + +// glibc has traditionally implemented two incompatible versions of +// strerror_r(). There is a poorly defined convention for picking the +// version that we want, but it is not clear whether it even works with +// all versions of glibc. +// So, instead, we provide this wrapper that automatically detects the +// version that is in use, and then implements POSIX semantics. +// N.B. In addition to what POSIX says, we also guarantee that "buf" will +// be set to an empty string, if this function failed. This means, in most +// cases, you do not need to check the error code and you can directly +// use the value of "buf". It will never have an undefined value. +// DEPRECATED: Use StrError(int) instead. +GLOG_EXPORT int posix_strerror_r(int err, char *buf, size_t len); + +// A thread-safe replacement for strerror(). Returns a string describing the +// given POSIX error code. +GLOG_EXPORT std::string StrError(int err); + +// A class for which we define operator<<, which does nothing. +class GLOG_EXPORT NullStream : public LogMessage::LogStream { + public: + // Initialize the LogStream so the messages can be written somewhere + // (they'll never be actually displayed). This will be needed if a + // NullStream& is implicitly converted to LogStream&, in which case + // the overloaded NullStream::operator<< will not be invoked. + NullStream() : LogMessage::LogStream(message_buffer_, 1, 0) { } + NullStream(const char* /*file*/, int /*line*/, + const CheckOpString& /*result*/) : + LogMessage::LogStream(message_buffer_, 1, 0) { } + NullStream &stream() { return *this; } + private: + // A very short buffer for messages (which we discard anyway). This + // will be needed if NullStream& converted to LogStream& (e.g. as a + // result of a conditional expression). + char message_buffer_[2]; +}; + +// Do nothing. This operator is inline, allowing the message to be +// compiled away. The message will not be compiled away if we do +// something like (flag ? LOG(INFO) : LOG(ERROR)) << message; when +// SKIP_LOG=WARNING. In those cases, NullStream will be implicitly +// converted to LogStream and the message will be computed and then +// quietly discarded. +template +inline NullStream& operator<<(NullStream &str, const T &) { return str; } + +// Similar to NullStream, but aborts the program (without stack +// trace), like LogMessageFatal. +class GLOG_EXPORT NullStreamFatal : public NullStream { + public: + NullStreamFatal() { } + NullStreamFatal(const char* file, int line, const CheckOpString& result) : + NullStream(file, line, result) { } +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable : 4722) +#endif // _MSC_VER + [[noreturn]] ~NullStreamFatal() throw() { _exit(EXIT_FAILURE); } +#if defined(_MSC_VER) +#pragma warning(pop) +#endif // _MSC_VER +}; + +// Install a signal handler that will dump signal information and a stack +// trace when the program crashes on certain signals. We'll install the +// signal handler for the following signals. +// +// SIGSEGV, SIGILL, SIGFPE, SIGABRT, SIGBUS, and SIGTERM. +// +// By default, the signal handler will write the failure dump to the +// standard error. You can customize the destination by installing your +// own writer function by InstallFailureWriter() below. +// +// Note on threading: +// +// The function should be called before threads are created, if you want +// to use the failure signal handler for all threads. The stack trace +// will be shown only for the thread that receives the signal. In other +// words, stack traces of other threads won't be shown. +GLOG_EXPORT void InstallFailureSignalHandler(); + +// Installs a function that is used for writing the failure dump. "data" +// is the pointer to the beginning of a message to be written, and "size" +// is the size of the message. You should not expect the data is +// terminated with '\0'. +GLOG_EXPORT void InstallFailureWriter( + void (*writer)(const char* data, size_t size)); + +} + +#pragma pop_macro("DECLARE_VARIABLE") +#pragma pop_macro("DECLARE_bool") +#pragma pop_macro("DECLARE_string") +#pragma pop_macro("DECLARE_int32") +#pragma pop_macro("DECLARE_uint32") + +#endif // GLOG_LOGGING_H diff --git a/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in b/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in new file mode 100644 index 0000000..e8e6c41 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in @@ -0,0 +1,1842 @@ +// Copyright (c) 2023, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Ray Sidney +// +// This file contains #include information about logging-related stuff. +// Pretty much everybody needs to #include this file so that they can +// log various happenings. +// +#ifndef GLOG_LOGGING_H +#define GLOG_LOGGING_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if @ac_cv_have_unistd_h@ +# include +#endif +#include + +#if defined(_MSC_VER) +#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \ + __pragma(warning(disable:n)) +#define GLOG_MSVC_POP_WARNING() __pragma(warning(pop)) +#else +#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) +#define GLOG_MSVC_POP_WARNING() +#endif + +#include + +#if @ac_cv_have_glog_export@ +#include +#endif + +// We care a lot about number of bits things take up. Unfortunately, +// systems define their bit-specific ints in a lot of different ways. +// We use our own way, and have a typedef to get there. +// Note: these commands below may look like "#if 1" or "#if 0", but +// that's because they were constructed that way at ./configure time. +// Look at logging.h.in to see how they're calculated (based on your config). +#include // the normal place uint16_t is defined +#if @ac_cv_have_systypes_h@ +#include // the normal place u_int16_t is defined +#endif + +#if @ac_cv_have_libgflags@ +#include +#endif + +#include + +@ac_google_start_namespace@ + + typedef std::int32_t int32; +typedef std::uint32_t uint32; +typedef std::int64_t int64; +typedef std::uint64_t uint64; + +#if !(@ac_cv_have_ssize_t@) +typedef ptrdiff_t ssize_t; +#endif + +#if !(@ac_cv_have_mode_t@) +typedef int mode_t; +#endif + +typedef double WallTime; + +struct GLOG_EXPORT LogMessageTime { + LogMessageTime(); + LogMessageTime(std::tm t); + LogMessageTime(std::time_t timestamp, WallTime now); + + const time_t& timestamp() const { return timestamp_; } + const int& sec() const { return time_struct_.tm_sec; } + const int32_t& usec() const { return usecs_; } + const int&(min)() const { return time_struct_.tm_min; } + const int& hour() const { return time_struct_.tm_hour; } + const int& day() const { return time_struct_.tm_mday; } + const int& month() const { return time_struct_.tm_mon; } + const int& year() const { return time_struct_.tm_year; } + const int& dayOfWeek() const { return time_struct_.tm_wday; } + const int& dayInYear() const { return time_struct_.tm_yday; } + const int& dst() const { return time_struct_.tm_isdst; } + const long int& gmtoff() const { return gmtoffset_; } + const std::tm& tm() const { return time_struct_; } + + private: + void init(const std::tm& t, std::time_t timestamp, WallTime now); + std::tm time_struct_; // Time of creation of LogMessage + time_t timestamp_; // Time of creation of LogMessage in seconds + int32_t usecs_; // Time of creation of LogMessage - microseconds part + long int gmtoffset_; + + void CalcGmtOffset(); +}; + +struct LogMessageInfo { + explicit LogMessageInfo(const char* const severity_, + const char* const filename_, + const int& line_number_, + const int& thread_id_, + const LogMessageTime& time_): + severity(severity_), filename(filename_), line_number(line_number_), + thread_id(thread_id_), time(time_) + {} + + const char* const severity; + const char* const filename; + const int &line_number; + const int &thread_id; + const LogMessageTime& time; +}; + +typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, void* data); + +@ac_google_end_namespace@ + + +// The global value of GOOGLE_STRIP_LOG. All the messages logged to +// LOG(XXX) with severity less than GOOGLE_STRIP_LOG will not be displayed. +// If it can be determined at compile time that the message will not be +// printed, the statement will be compiled out. +// +// Example: to strip out all INFO and WARNING messages, use the value +// of 2 below. To make an exception for WARNING messages from a single +// file, add "#define GOOGLE_STRIP_LOG 1" to that file _before_ including +// base/logging.h +#ifndef GOOGLE_STRIP_LOG +#define GOOGLE_STRIP_LOG 0 +#endif + +// GCC can be told that a certain branch is not likely to be taken (for +// instance, a CHECK failure), and use that information in static analysis. +// Giving it this information can help it optimize for the common case in +// the absence of better information (ie. -fprofile-arcs). +// +#ifndef GOOGLE_PREDICT_BRANCH_NOT_TAKEN +#if @ac_cv_have___builtin_expect@ +#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) (__builtin_expect(x, 0)) +#else +#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) x +#endif +#endif + +#ifndef GOOGLE_PREDICT_FALSE +#if @ac_cv_have___builtin_expect@ +#define GOOGLE_PREDICT_FALSE(x) (__builtin_expect(x, 0)) +#else +#define GOOGLE_PREDICT_FALSE(x) x +#endif +#endif + +#ifndef GOOGLE_PREDICT_TRUE +#if @ac_cv_have___builtin_expect@ +#define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) +#else +#define GOOGLE_PREDICT_TRUE(x) x +#endif +#endif + + +// Make a bunch of macros for logging. The way to log things is to stream +// things to LOG(). E.g., +// +// LOG(INFO) << "Found " << num_cookies << " cookies"; +// +// You can capture log messages in a string, rather than reporting them +// immediately: +// +// vector errors; +// LOG_STRING(ERROR, &errors) << "Couldn't parse cookie #" << cookie_num; +// +// This pushes back the new error onto 'errors'; if given a NULL pointer, +// it reports the error via LOG(ERROR). +// +// You can also do conditional logging: +// +// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; +// +// You can also do occasional logging (log every n'th occurrence of an +// event): +// +// LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; +// +// The above will cause log messages to be output on the 1st, 11th, 21st, ... +// times it is executed. Note that the special google::COUNTER value is used +// to identify which repetition is happening. +// +// You can also do occasional conditional logging (log every n'th +// occurrence of an event, when condition is satisfied): +// +// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER +// << "th big cookie"; +// +// You can log messages the first N times your code executes a line. E.g. +// +// LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie"; +// +// Outputs log messages for the first 20 times it is executed. +// +// Analogous SYSLOG, SYSLOG_IF, and SYSLOG_EVERY_N macros are available. +// These log to syslog as well as to the normal logs. If you use these at +// all, you need to be aware that syslog can drastically reduce performance, +// especially if it is configured for remote logging! Don't use these +// unless you fully understand this and have a concrete need to use them. +// Even then, try to minimize your use of them. +// +// There are also "debug mode" logging macros like the ones above: +// +// DLOG(INFO) << "Found cookies"; +// +// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; +// +// DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; +// +// All "debug mode" logging is compiled away to nothing for non-debug mode +// compiles. +// +// We also have +// +// LOG_ASSERT(assertion); +// DLOG_ASSERT(assertion); +// +// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion; +// +// There are "verbose level" logging macros. They look like +// +// VLOG(1) << "I'm printed when you run the program with --v=1 or more"; +// VLOG(2) << "I'm printed when you run the program with --v=2 or more"; +// +// These always log at the INFO log level (when they log at all). +// The verbose logging can also be turned on module-by-module. For instance, +// --vmodule=mapreduce=2,file=1,gfs*=3 --v=0 +// will cause: +// a. VLOG(2) and lower messages to be printed from mapreduce.{h,cc} +// b. VLOG(1) and lower messages to be printed from file.{h,cc} +// c. VLOG(3) and lower messages to be printed from files prefixed with "gfs" +// d. VLOG(0) and lower messages to be printed from elsewhere +// +// The wildcarding functionality shown by (c) supports both '*' (match +// 0 or more characters) and '?' (match any single character) wildcards. +// +// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as +// +// if (VLOG_IS_ON(2)) { +// // do some logging preparation and logging +// // that can't be accomplished with just VLOG(2) << ...; +// } +// +// There are also VLOG_IF, VLOG_EVERY_N and VLOG_IF_EVERY_N "verbose level" +// condition macros for sample cases, when some extra computation and +// preparation for logs is not needed. +// VLOG_IF(1, (size > 1024)) +// << "I'm printed when size is more than 1024 and when you run the " +// "program with --v=1 or more"; +// VLOG_EVERY_N(1, 10) +// << "I'm printed every 10th occurrence, and when you run the program " +// "with --v=1 or more. Present occurence is " << google::COUNTER; +// VLOG_IF_EVERY_N(1, (size > 1024), 10) +// << "I'm printed on every 10th occurence of case when size is more " +// " than 1024, when you run the program with --v=1 or more. "; +// "Present occurence is " << google::COUNTER; +// +// The supported severity levels for macros that allow you to specify one +// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL. +// Note that messages of a given severity are logged not only in the +// logfile for that severity, but also in all logfiles of lower severity. +// E.g., a message of severity FATAL will be logged to the logfiles of +// severity FATAL, ERROR, WARNING, and INFO. +// +// There is also the special severity of DFATAL, which logs FATAL in +// debug mode, ERROR in normal mode. +// +// Very important: logging a message at the FATAL severity level causes +// the program to terminate (after the message is logged). +// +// Unless otherwise specified, logs will be written to the filename +// "...log..", followed +// by the date, time, and pid (you can't prevent the date, time, and pid +// from being in the filename). +// +// The logging code takes two flags: +// --v=# set the verbose level +// --logtostderr log all the messages to stderr instead of to logfiles + +// LOG LINE PREFIX FORMAT +// +// Log lines have this form: +// +// Lyyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg... +// +// where the fields are defined as follows: +// +// L A single character, representing the log level +// (eg 'I' for INFO) +// yyyy The year +// mm The month (zero padded; ie May is '05') +// dd The day (zero padded) +// hh:mm:ss.uuuuuu Time in hours, minutes and fractional seconds +// threadid The space-padded thread ID as returned by GetTID() +// (this matches the PID on Linux) +// file The file name +// line The line number +// msg The user-supplied message +// +// Example: +// +// I1103 11:57:31.739339 24395 google.cc:2341] Command line: ./some_prog +// I1103 11:57:31.739403 24395 google.cc:2342] Process id 24395 +// +// NOTE: although the microseconds are useful for comparing events on +// a single machine, clocks on different machines may not be well +// synchronized. Hence, use caution when comparing the low bits of +// timestamps from different machines. + +#pragma push_macro("DECLARE_VARIABLE") +#pragma push_macro("DECLARE_bool") +#pragma push_macro("DECLARE_string") +#pragma push_macro("DECLARE_int32") +#pragma push_macro("DECLARE_uint32") + +#ifdef DECLARE_VARIABLE +#undef DECLARE_VARIABLE +#endif + +#ifdef DECLARE_bool +#undef DECLARE_bool +#endif + +#ifdef DECLARE_string +#undef DECLARE_string +#endif + +#ifdef DECLARE_int32 +#undef DECLARE_int32 +#endif + +#ifdef DECLARE_uint32 +#undef DECLARE_uint32 +#endif + +#ifndef DECLARE_VARIABLE +#define DECLARE_VARIABLE(type, shorttype, name, tn) \ + namespace fL##shorttype { \ + extern GLOG_EXPORT type FLAGS_##name; \ + } \ + using fL##shorttype::FLAGS_##name + +// bool specialization +#define DECLARE_bool(name) \ + DECLARE_VARIABLE(bool, B, name, bool) + +// int32 specialization +#define DECLARE_int32(name) \ + DECLARE_VARIABLE(@ac_google_namespace@::int32, I, name, int32) + +#if !defined(DECLARE_uint32) +// uint32 specialization +#define DECLARE_uint32(name) \ + DECLARE_VARIABLE(@ac_google_namespace@::uint32, U, name, uint32) +#endif // !defined(DECLARE_uint32) && !(@ac_cv_have_libgflags@) + +// Special case for string, because we have to specify the namespace +// std::string, which doesn't play nicely with our FLAG__namespace hackery. +#define DECLARE_string(name) \ + namespace fLS { \ + extern GLOG_EXPORT std::string& FLAGS_##name; \ + } \ + using fLS::FLAGS_##name +#endif + +// Set whether appending a timestamp to the log file name +DECLARE_bool(timestamp_in_logfile_name); + +// Set whether log messages go to stdout instead of logfiles +DECLARE_bool(logtostdout); + +// Set color messages logged to stdout (if supported by terminal). +DECLARE_bool(colorlogtostdout); + +// Set whether log messages go to stderr instead of logfiles +DECLARE_bool(logtostderr); + +// Set whether log messages go to stderr in addition to logfiles. +DECLARE_bool(alsologtostderr); + +// Set color messages logged to stderr (if supported by terminal). +DECLARE_bool(colorlogtostderr); + +// Log messages at a level >= this flag are automatically sent to +// stderr in addition to log files. +DECLARE_int32(stderrthreshold); + +// Set whether the log file header should be written upon creating a file. +DECLARE_bool(log_file_header); + +// Set whether the log prefix should be prepended to each line of output. +DECLARE_bool(log_prefix); + +// Set whether the year should be included in the log prefix. +DECLARE_bool(log_year_in_prefix); + +// Log messages at a level <= this flag are buffered. +// Log messages at a higher level are flushed immediately. +DECLARE_int32(logbuflevel); + +// Sets the maximum number of seconds which logs may be buffered for. +DECLARE_int32(logbufsecs); + +// Log suppression level: messages logged at a lower level than this +// are suppressed. +DECLARE_int32(minloglevel); + +// If specified, logfiles are written into this directory instead of the +// default logging directory. +DECLARE_string(log_dir); + +// Set the log file mode. +DECLARE_int32(logfile_mode); + +// Sets the path of the directory into which to put additional links +// to the log files. +DECLARE_string(log_link); + +DECLARE_int32(v); // in vlog_is_on.cc + +DECLARE_string(vmodule); // also in vlog_is_on.cc + +// Sets the maximum log file size (in MB). +DECLARE_uint32(max_log_size); + +// Sets whether to avoid logging to the disk if the disk is full. +DECLARE_bool(stop_logging_if_full_disk); + +// Use UTC time for logging +DECLARE_bool(log_utc_time); + +// Log messages below the GOOGLE_STRIP_LOG level will be compiled away for +// security reasons. See LOG(severtiy) below. + +// A few definitions of macros that don't generate much code. Since +// LOG(INFO) and its ilk are used all over our code, it's +// better to have compact code for these operations. + +#if GOOGLE_STRIP_LOG == 0 +#define COMPACT_GOOGLE_LOG_INFO @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__) +#define LOG_TO_STRING_INFO(message) @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, message) +#else +#define COMPACT_GOOGLE_LOG_INFO @ac_google_namespace@::NullStream() +#define LOG_TO_STRING_INFO(message) @ac_google_namespace@::NullStream() +#endif + +#if GOOGLE_STRIP_LOG <= 1 +#define COMPACT_GOOGLE_LOG_WARNING @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING) +#define LOG_TO_STRING_WARNING(message) @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, message) +#else +#define COMPACT_GOOGLE_LOG_WARNING @ac_google_namespace@::NullStream() +#define LOG_TO_STRING_WARNING(message) @ac_google_namespace@::NullStream() +#endif + +#if GOOGLE_STRIP_LOG <= 2 +#define COMPACT_GOOGLE_LOG_ERROR @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR) +#define LOG_TO_STRING_ERROR(message) @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, message) +#else +#define COMPACT_GOOGLE_LOG_ERROR @ac_google_namespace@::NullStream() +#define LOG_TO_STRING_ERROR(message) @ac_google_namespace@::NullStream() +#endif + +#if GOOGLE_STRIP_LOG <= 3 +#define COMPACT_GOOGLE_LOG_FATAL @ac_google_namespace@::LogMessageFatal( \ + __FILE__, __LINE__) +#define LOG_TO_STRING_FATAL(message) @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, message) +#else +#define COMPACT_GOOGLE_LOG_FATAL @ac_google_namespace@::NullStreamFatal() +#define LOG_TO_STRING_FATAL(message) @ac_google_namespace@::NullStreamFatal() +#endif + +#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) +#define DCHECK_IS_ON() 0 +#else +#define DCHECK_IS_ON() 1 +#endif + +// For DFATAL, we want to use LogMessage (as opposed to +// LogMessageFatal), to be consistent with the original behavior. +#if !DCHECK_IS_ON() +#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR +#elif GOOGLE_STRIP_LOG <= 3 +#define COMPACT_GOOGLE_LOG_DFATAL @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL) +#else +#define COMPACT_GOOGLE_LOG_DFATAL @ac_google_namespace@::NullStreamFatal() +#endif + +#define GOOGLE_LOG_INFO(counter) @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, counter, &@ac_google_namespace@::LogMessage::SendToLog) +#define SYSLOG_INFO(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, counter, \ + &@ac_google_namespace@::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_WARNING(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, counter, \ + &@ac_google_namespace@::LogMessage::SendToLog) +#define SYSLOG_WARNING(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, counter, \ + &@ac_google_namespace@::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_ERROR(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, counter, \ + &@ac_google_namespace@::LogMessage::SendToLog) +#define SYSLOG_ERROR(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, counter, \ + &@ac_google_namespace@::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_FATAL(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, counter, \ + &@ac_google_namespace@::LogMessage::SendToLog) +#define SYSLOG_FATAL(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, counter, \ + &@ac_google_namespace@::LogMessage::SendToSyslogAndLog) +#define GOOGLE_LOG_DFATAL(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::DFATAL_LEVEL, counter, \ + &@ac_google_namespace@::LogMessage::SendToLog) +#define SYSLOG_DFATAL(counter) \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::DFATAL_LEVEL, counter, \ + &@ac_google_namespace@::LogMessage::SendToSyslogAndLog) + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || defined(__CYGWIN32__) +// A very useful logging macro to log windows errors: +#define LOG_SYSRESULT(result) \ + if (FAILED(HRESULT_FROM_WIN32(result))) { \ + LPSTR message = NULL; \ + LPSTR msg = reinterpret_cast(&message); \ + DWORD message_length = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | \ + FORMAT_MESSAGE_FROM_SYSTEM | \ + FORMAT_MESSAGE_IGNORE_INSERTS, \ + 0, result, 0, msg, 100, NULL); \ + if (message_length > 0) { \ + @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, 0, \ + &@ac_google_namespace@::LogMessage::SendToLog).stream() \ + << reinterpret_cast(message); \ + LocalFree(message); \ + } \ + } +#endif + +// We use the preprocessor's merging operator, "##", so that, e.g., +// LOG(INFO) becomes the token GOOGLE_LOG_INFO. There's some funny +// subtle difference between ostream member streaming functions (e.g., +// ostream::operator<<(int) and ostream non-member streaming functions +// (e.g., ::operator<<(ostream&, string&): it turns out that it's +// impossible to stream something like a string directly to an unnamed +// ostream. We employ a neat hack by calling the stream() member +// function of LogMessage which seems to avoid the problem. +#define LOG(severity) COMPACT_GOOGLE_LOG_ ## severity.stream() +#define SYSLOG(severity) SYSLOG_ ## severity(0).stream() + +@ac_google_start_namespace@ + +// They need the definitions of integer types. +#include +#include + +// Initialize google's logging library. You will see the program name +// specified by argv0 in log outputs. +GLOG_EXPORT void InitGoogleLogging(const char* argv0); + +GLOG_EXPORT void InitGoogleLogging(const char* argv0, + CustomPrefixCallback prefix_callback, + void* prefix_callback_data = NULL); + +// Check if google's logging library has been initialized. +GLOG_EXPORT bool IsGoogleLoggingInitialized(); + +// Shutdown google's logging library. +GLOG_EXPORT void ShutdownGoogleLogging(); + +#if defined(__GNUC__) +typedef void (*logging_fail_func_t)() __attribute__((noreturn)); +#else +typedef void (*logging_fail_func_t)(); +#endif + +// Install a function which will be called after LOG(FATAL). +GLOG_EXPORT void InstallFailureFunction(logging_fail_func_t fail_func); + +// Enable/Disable old log cleaner. +GLOG_EXPORT void EnableLogCleaner(unsigned int overdue_days); +GLOG_EXPORT void DisableLogCleaner(); +GLOG_EXPORT void SetApplicationFingerprint(const std::string& fingerprint); + +class LogSink; // defined below + +// If a non-NULL sink pointer is given, we push this message to that sink. +// For LOG_TO_SINK we then do normal LOG(severity) logging as well. +// This is useful for capturing messages and passing/storing them +// somewhere more specific than the global log of the process. +// Argument types: +// LogSink* sink; +// LogSeverity severity; +// The cast is to disambiguate NULL arguments. +#define LOG_TO_SINK(sink, severity) \ + @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, \ + @ac_google_namespace@::GLOG_ ## severity, \ + static_cast<@ac_google_namespace@::LogSink*>(sink), true).stream() +#define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity) \ + @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, \ + @ac_google_namespace@::GLOG_ ## severity, \ + static_cast<@ac_google_namespace@::LogSink*>(sink), false).stream() + +// If a non-NULL string pointer is given, we write this message to that string. +// We then do normal LOG(severity) logging as well. +// This is useful for capturing messages and storing them somewhere more +// specific than the global log of the process. +// Argument types: +// string* message; +// LogSeverity severity; +// The cast is to disambiguate NULL arguments. +// NOTE: LOG(severity) expands to LogMessage().stream() for the specified +// severity. +#define LOG_TO_STRING(severity, message) \ + LOG_TO_STRING_##severity(static_cast(message)).stream() + +// If a non-NULL pointer is given, we push the message onto the end +// of a vector of strings; otherwise, we report it with LOG(severity). +// This is handy for capturing messages and perhaps passing them back +// to the caller, rather than reporting them immediately. +// Argument types: +// LogSeverity severity; +// vector *outvec; +// The cast is to disambiguate NULL arguments. +#define LOG_STRING(severity, outvec) \ + LOG_TO_STRING_##severity(static_cast*>(outvec)).stream() + +#define LOG_IF(severity, condition) \ + static_cast(0), \ + !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) +#define SYSLOG_IF(severity, condition) \ + static_cast(0), \ + !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & SYSLOG(severity) + +#define LOG_ASSERT(condition) \ + LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition +#define SYSLOG_ASSERT(condition) \ + SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition + +// CHECK dies with a fatal error if condition is not true. It is *not* +// controlled by DCHECK_IS_ON(), so the check will be executed regardless of +// compilation mode. Therefore, it is safe to do things like: +// CHECK(fp->Write(x) == 4) +#define CHECK(condition) \ + LOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN(!(condition))) \ + << "Check failed: " #condition " " + +// A container for a string pointer which can be evaluated to a bool - +// true iff the pointer is NULL. +struct CheckOpString { + CheckOpString(std::string* str) : str_(str) { } + // No destructor: if str_ is non-NULL, we're about to LOG(FATAL), + // so there's no point in cleaning up str_. + operator bool() const { + return GOOGLE_PREDICT_BRANCH_NOT_TAKEN(str_ != NULL); + } + std::string* str_; +}; + +// Function is overloaded for integral types to allow static const +// integrals declared in classes and not defined to be used as arguments to +// CHECK* macros. It's not encouraged though. +template +inline const T& GetReferenceableValue(const T& t) { return t; } +inline char GetReferenceableValue(char t) { return t; } +inline unsigned char GetReferenceableValue(unsigned char t) { return t; } +inline signed char GetReferenceableValue(signed char t) { return t; } +inline short GetReferenceableValue(short t) { return t; } +inline unsigned short GetReferenceableValue(unsigned short t) { return t; } +inline int GetReferenceableValue(int t) { return t; } +inline unsigned int GetReferenceableValue(unsigned int t) { return t; } +inline long GetReferenceableValue(long t) { return t; } +inline unsigned long GetReferenceableValue(unsigned long t) { return t; } +inline long long GetReferenceableValue(long long t) { return t; } +inline unsigned long long GetReferenceableValue(unsigned long long t) { + return t; +} + +// This is a dummy class to define the following operator. +struct DummyClassToDefineOperator {}; + +@ac_google_end_namespace@ + +// Define global operator<< to declare using ::operator<<. +// This declaration will allow use to use CHECK macros for user +// defined classes which have operator<< (e.g., stl_logging.h). +inline std::ostream& operator<<( + std::ostream& out, const google::DummyClassToDefineOperator&) { + return out; +} + +@ac_google_start_namespace@ + +// This formats a value for a failing CHECK_XX statement. Ordinarily, +// it uses the definition for operator<<, with a few special cases below. +template +inline void MakeCheckOpValueString(std::ostream* os, const T& v) { + (*os) << v; +} + +// Overrides for char types provide readable values for unprintable +// characters. +template <> GLOG_EXPORT +void MakeCheckOpValueString(std::ostream* os, const char& v); +template <> GLOG_EXPORT +void MakeCheckOpValueString(std::ostream* os, const signed char& v); +template <> GLOG_EXPORT +void MakeCheckOpValueString(std::ostream* os, const unsigned char& v); + +// Provide printable value for nullptr_t +template <> +GLOG_EXPORT void MakeCheckOpValueString(std::ostream* os, + const std::nullptr_t& v); + +// Build the error message string. Specify no inlining for code size. +template +std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext) + @ac_cv___attribute___noinline@; + +namespace base { +namespace internal { + +// If "s" is less than base_logging::INFO, returns base_logging::INFO. +// If "s" is greater than base_logging::FATAL, returns +// base_logging::ERROR. Otherwise, returns "s". +LogSeverity NormalizeSeverity(LogSeverity s); + +} // namespace internal + +// A helper class for formatting "expr (V1 vs. V2)" in a CHECK_XX +// statement. See MakeCheckOpString for sample usage. Other +// approaches were considered: use of a template method (e.g., +// base::BuildCheckOpString(exprtext, base::Print, &v1, +// base::Print, &v2), however this approach has complications +// related to volatile arguments and function-pointer arguments). +class GLOG_EXPORT CheckOpMessageBuilder { + public: + // Inserts "exprtext" and " (" to the stream. + explicit CheckOpMessageBuilder(const char *exprtext); + // Deletes "stream_". + ~CheckOpMessageBuilder(); + // For inserting the first variable. + std::ostream* ForVar1() { return stream_; } + // For inserting the second variable (adds an intermediate " vs. "). + std::ostream* ForVar2(); + // Get the result (inserts the closing ")"). + std::string* NewString(); + + private: + std::ostringstream *stream_; +}; + +} // namespace base + +template +std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext) { + base::CheckOpMessageBuilder comb(exprtext); + MakeCheckOpValueString(comb.ForVar1(), v1); + MakeCheckOpValueString(comb.ForVar2(), v2); + return comb.NewString(); +} + +// Helper functions for CHECK_OP macro. +// The (int, int) specialization works around the issue that the compiler +// will not instantiate the template version of the function on values of +// unnamed enum type - see comment below. +#define DEFINE_CHECK_OP_IMPL(name, op) \ + template \ + inline std::string* name##Impl(const T1& v1, const T2& v2, \ + const char* exprtext) { \ + if (GOOGLE_PREDICT_TRUE(v1 op v2)) return NULL; \ + else return MakeCheckOpString(v1, v2, exprtext); \ + } \ + inline std::string* name##Impl(int v1, int v2, const char* exprtext) { \ + return name##Impl(v1, v2, exprtext); \ + } + +// We use the full name Check_EQ, Check_NE, etc. in case the file including +// base/logging.h provides its own #defines for the simpler names EQ, NE, etc. +// This happens if, for example, those are used as token names in a +// yacc grammar. +DEFINE_CHECK_OP_IMPL(Check_EQ, ==) // Compilation error with CHECK_EQ(NULL, x)? +DEFINE_CHECK_OP_IMPL(Check_NE, !=) // Use CHECK(x == NULL) instead. +DEFINE_CHECK_OP_IMPL(Check_LE, <=) +DEFINE_CHECK_OP_IMPL(Check_LT, < ) +DEFINE_CHECK_OP_IMPL(Check_GE, >=) +DEFINE_CHECK_OP_IMPL(Check_GT, > ) +#undef DEFINE_CHECK_OP_IMPL + +// Helper macro for binary operators. +// Don't use this macro directly in your code, use CHECK_EQ et al below. + +#if defined(STATIC_ANALYSIS) +// Only for static analysis tool to know that it is equivalent to assert +#define CHECK_OP_LOG(name, op, val1, val2, log) CHECK((val1) op (val2)) +#elif DCHECK_IS_ON() +// In debug mode, avoid constructing CheckOpStrings if possible, +// to reduce the overhead of CHECK statments by 2x. +// Real DCHECK-heavy tests have seen 1.5x speedups. + +// The meaning of "string" might be different between now and +// when this macro gets invoked (e.g., if someone is experimenting +// with other string implementations that get defined after this +// file is included). Save the current meaning now and use it +// in the macro. +typedef std::string _Check_string; +#define CHECK_OP_LOG(name, op, val1, val2, log) \ + while (@ac_google_namespace@::_Check_string* _result = \ + @ac_google_namespace@::Check##name##Impl( \ + @ac_google_namespace@::GetReferenceableValue(val1), \ + @ac_google_namespace@::GetReferenceableValue(val2), \ + #val1 " " #op " " #val2)) \ + log(__FILE__, __LINE__, \ + @ac_google_namespace@::CheckOpString(_result)).stream() +#else +// In optimized mode, use CheckOpString to hint to compiler that +// the while condition is unlikely. +#define CHECK_OP_LOG(name, op, val1, val2, log) \ + while (@ac_google_namespace@::CheckOpString _result = \ + @ac_google_namespace@::Check##name##Impl( \ + @ac_google_namespace@::GetReferenceableValue(val1), \ + @ac_google_namespace@::GetReferenceableValue(val2), \ + #val1 " " #op " " #val2)) \ + log(__FILE__, __LINE__, _result).stream() +#endif // STATIC_ANALYSIS, DCHECK_IS_ON() + +#if GOOGLE_STRIP_LOG <= 3 +#define CHECK_OP(name, op, val1, val2) \ + CHECK_OP_LOG(name, op, val1, val2, @ac_google_namespace@::LogMessageFatal) +#else +#define CHECK_OP(name, op, val1, val2) \ + CHECK_OP_LOG(name, op, val1, val2, @ac_google_namespace@::NullStreamFatal) +#endif // STRIP_LOG <= 3 + +// Equality/Inequality checks - compare two values, and log a FATAL message +// including the two values when the result is not as expected. The values +// must have operator<<(ostream, ...) defined. +// +// You may append to the error message like so: +// CHECK_NE(1, 2) << ": The world must be ending!"; +// +// We are very careful to ensure that each argument is evaluated exactly +// once, and that anything which is legal to pass as a function argument is +// legal here. In particular, the arguments may be temporary expressions +// which will end up being destroyed at the end of the apparent statement, +// for example: +// CHECK_EQ(string("abc")[1], 'b'); +// +// WARNING: These don't compile correctly if one of the arguments is a pointer +// and the other is NULL. To work around this, simply static_cast NULL to the +// type of the desired pointer. + +#define CHECK_EQ(val1, val2) CHECK_OP(_EQ, ==, val1, val2) +#define CHECK_NE(val1, val2) CHECK_OP(_NE, !=, val1, val2) +#define CHECK_LE(val1, val2) CHECK_OP(_LE, <=, val1, val2) +#define CHECK_LT(val1, val2) CHECK_OP(_LT, < , val1, val2) +#define CHECK_GE(val1, val2) CHECK_OP(_GE, >=, val1, val2) +#define CHECK_GT(val1, val2) CHECK_OP(_GT, > , val1, val2) + +// Check that the input is non NULL. This very useful in constructor +// initializer lists. + +#define CHECK_NOTNULL(val) \ + @ac_google_namespace@::CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val)) + +// Helper functions for string comparisons. +// To avoid bloat, the definitions are in logging.cc. +#define DECLARE_CHECK_STROP_IMPL(func, expected) \ + GLOG_EXPORT std::string* Check##func##expected##Impl( \ + const char* s1, const char* s2, const char* names); +DECLARE_CHECK_STROP_IMPL(strcmp, true) +DECLARE_CHECK_STROP_IMPL(strcmp, false) +DECLARE_CHECK_STROP_IMPL(strcasecmp, true) +DECLARE_CHECK_STROP_IMPL(strcasecmp, false) +#undef DECLARE_CHECK_STROP_IMPL + +// Helper macro for string comparisons. +// Don't use this macro directly in your code, use CHECK_STREQ et al below. +#define CHECK_STROP(func, op, expected, s1, s2) \ + while (@ac_google_namespace@::CheckOpString _result = \ + @ac_google_namespace@::Check##func##expected##Impl((s1), (s2), \ + #s1 " " #op " " #s2)) \ + LOG(FATAL) << *_result.str_ + + +// String (char*) equality/inequality checks. +// CASE versions are case-insensitive. +// +// Note that "s1" and "s2" may be temporary strings which are destroyed +// by the compiler at the end of the current "full expression" +// (e.g. CHECK_STREQ(Foo().c_str(), Bar().c_str())). + +#define CHECK_STREQ(s1, s2) CHECK_STROP(strcmp, ==, true, s1, s2) +#define CHECK_STRNE(s1, s2) CHECK_STROP(strcmp, !=, false, s1, s2) +#define CHECK_STRCASEEQ(s1, s2) CHECK_STROP(strcasecmp, ==, true, s1, s2) +#define CHECK_STRCASENE(s1, s2) CHECK_STROP(strcasecmp, !=, false, s1, s2) + +#define CHECK_INDEX(I,A) CHECK(I < (sizeof(A)/sizeof(A[0]))) +#define CHECK_BOUND(B,A) CHECK(B <= (sizeof(A)/sizeof(A[0]))) + +#define CHECK_DOUBLE_EQ(val1, val2) \ + do { \ + CHECK_LE((val1), (val2)+0.000000000000001L); \ + CHECK_GE((val1), (val2)-0.000000000000001L); \ + } while (0) + +#define CHECK_NEAR(val1, val2, margin) \ + do { \ + CHECK_LE((val1), (val2)+(margin)); \ + CHECK_GE((val1), (val2)-(margin)); \ + } while (0) + +// perror()..googly style! +// +// PLOG() and PLOG_IF() and PCHECK() behave exactly like their LOG* and +// CHECK equivalents with the addition that they postpend a description +// of the current state of errno to their output lines. + +#define PLOG(severity) GOOGLE_PLOG(severity, 0).stream() + +#define GOOGLE_PLOG(severity, counter) \ + @ac_google_namespace@::ErrnoLogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, counter, \ + &@ac_google_namespace@::LogMessage::SendToLog) + +#define PLOG_IF(severity, condition) \ + static_cast(0), \ + !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & PLOG(severity) + +// A CHECK() macro that postpends errno if the condition is false. E.g. +// +// if (poll(fds, nfds, timeout) == -1) { PCHECK(errno == EINTR); ... } +#define PCHECK(condition) \ + PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN(!(condition))) \ + << "Check failed: " #condition " " + +// A CHECK() macro that lets you assert the success of a function that +// returns -1 and sets errno in case of an error. E.g. +// +// CHECK_ERR(mkdir(path, 0700)); +// +// or +// +// int fd = open(filename, flags); CHECK_ERR(fd) << ": open " << filename; +#define CHECK_ERR(invocation) \ +PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \ + << #invocation + +// Use macro expansion to create, for each use of LOG_EVERY_N(), static +// variables with the __LINE__ expansion as part of the variable name. +#define LOG_EVERY_N_VARNAME(base, line) LOG_EVERY_N_VARNAME_CONCAT(base, line) +#define LOG_EVERY_N_VARNAME_CONCAT(base, line) base ## line + +#define LOG_OCCURRENCES LOG_EVERY_N_VARNAME(occurrences_, __LINE__) +#define LOG_OCCURRENCES_MOD_N LOG_EVERY_N_VARNAME(occurrences_mod_n_, __LINE__) + +#define LOG_TIME_PERIOD LOG_EVERY_N_VARNAME(timePeriod_, __LINE__) +#define LOG_PREVIOUS_TIME_RAW LOG_EVERY_N_VARNAME(previousTimeRaw_, __LINE__) +#define LOG_TIME_DELTA LOG_EVERY_N_VARNAME(deltaTime_, __LINE__) +#define LOG_CURRENT_TIME LOG_EVERY_N_VARNAME(currentTime_, __LINE__) +#define LOG_PREVIOUS_TIME LOG_EVERY_N_VARNAME(previousTime_, __LINE__) + +#if defined(__has_feature) +# if __has_feature(thread_sanitizer) +# define GLOG_SANITIZE_THREAD 1 +# endif +#endif + +#if !defined(GLOG_SANITIZE_THREAD) && defined(__SANITIZE_THREAD__) && __SANITIZE_THREAD__ +# define GLOG_SANITIZE_THREAD 1 +#endif + +#if defined(GLOG_SANITIZE_THREAD) +#define GLOG_IFDEF_THREAD_SANITIZER(X) X +#else +#define GLOG_IFDEF_THREAD_SANITIZER(X) +#endif + +#if defined(GLOG_SANITIZE_THREAD) +} // namespace google + +// We need to identify the static variables as "benign" races +// to avoid noisy reports from TSAN. +extern "C" void AnnotateBenignRaceSized( + const char *file, + int line, + const volatile void *mem, + size_t size, + const char *description); + +namespace google { +#endif + +#define SOME_KIND_OF_LOG_EVERY_T(severity, seconds) \ + constexpr std::chrono::nanoseconds LOG_TIME_PERIOD = \ + std::chrono::duration_cast( \ + std::chrono::duration(seconds)); \ + static std::atomic<@ac_google_namespace@ ::int64> LOG_PREVIOUS_TIME_RAW; \ + GLOG_IFDEF_THREAD_SANITIZER( \ + AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_TIME_PERIOD, \ + sizeof(@ac_google_namespace @ ::int64), "")); \ + GLOG_IFDEF_THREAD_SANITIZER( \ + AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_PREVIOUS_TIME_RAW, \ + sizeof(@ac_google_namespace @ ::int64), "")); \ + const auto LOG_CURRENT_TIME = \ + std::chrono::duration_cast( \ + std::chrono::steady_clock::now().time_since_epoch()); \ + const auto LOG_PREVIOUS_TIME = \ + LOG_PREVIOUS_TIME_RAW.load(std::memory_order_relaxed); \ + const auto LOG_TIME_DELTA = \ + LOG_CURRENT_TIME - std::chrono::nanoseconds(LOG_PREVIOUS_TIME); \ + if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \ + LOG_PREVIOUS_TIME_RAW.store( \ + std::chrono::duration_cast(LOG_CURRENT_TIME) \ + .count(), \ + std::memory_order_relaxed); \ + if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \ + @ac_google_namespace@ ::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@ ::GLOG_##severity) \ + .stream() + +#define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \ + ++LOG_OCCURRENCES; \ + if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \ + if (LOG_OCCURRENCES_MOD_N == 1) \ + @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \ + ++LOG_OCCURRENCES; \ + if ((condition) && \ + ((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \ + @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \ + ++LOG_OCCURRENCES; \ + if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \ + if (LOG_OCCURRENCES_MOD_N == 1) \ + @ac_google_namespace@::ErrnoLogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \ + static std::atomic LOG_OCCURRENCES(0); \ + GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ + if (LOG_OCCURRENCES <= n) \ + ++LOG_OCCURRENCES; \ + if (LOG_OCCURRENCES <= n) \ + @ac_google_namespace@::LogMessage( \ + __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \ + &what_to_do).stream() + +namespace glog_internal_namespace_ { +template +struct CompileAssert { +}; +struct CrashReason; + +// Returns true if FailureSignalHandler is installed. +// Needs to be exported since it's used by the signalhandler_unittest. +GLOG_EXPORT bool IsFailureSignalHandlerInstalled(); +} // namespace glog_internal_namespace_ + +#define LOG_EVERY_N(severity, n) \ + SOME_KIND_OF_LOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog) + +#define LOG_EVERY_T(severity, T) SOME_KIND_OF_LOG_EVERY_T(severity, (T)) + +#define SYSLOG_EVERY_N(severity, n) \ + SOME_KIND_OF_LOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToSyslogAndLog) + +#define PLOG_EVERY_N(severity, n) \ + SOME_KIND_OF_PLOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog) + +#define LOG_FIRST_N(severity, n) \ + SOME_KIND_OF_LOG_FIRST_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog) + +#define LOG_IF_EVERY_N(severity, condition, n) \ + SOME_KIND_OF_LOG_IF_EVERY_N(severity, (condition), (n), @ac_google_namespace@::LogMessage::SendToLog) + +// We want the special COUNTER value available for LOG_EVERY_X()'ed messages +enum PRIVATE_Counter {COUNTER}; + +#ifdef GLOG_NO_ABBREVIATED_SEVERITIES +// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets +// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us +// to keep using this syntax, we define this macro to do the same thing +// as COMPACT_GOOGLE_LOG_ERROR. +#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR +#define SYSLOG_0 SYSLOG_ERROR +#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR +// Needed for LOG_IS_ON(ERROR). +const LogSeverity GLOG_0 = GLOG_ERROR; +#else +// Users may include windows.h after logging.h without +// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN. +// For this case, we cannot detect if ERROR is defined before users +// actually use ERROR. Let's make an undefined symbol to warn users. +# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail +# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG +# define SYSLOG_0 GLOG_ERROR_MSG +# define LOG_TO_STRING_0 GLOG_ERROR_MSG +# define GLOG_0 GLOG_ERROR_MSG +#endif + +// Plus some debug-logging macros that get compiled to nothing for production + +#if DCHECK_IS_ON() + +#define DLOG(severity) LOG(severity) +#define DVLOG(verboselevel) VLOG(verboselevel) +#define DLOG_IF(severity, condition) LOG_IF(severity, condition) +#define DLOG_EVERY_N(severity, n) LOG_EVERY_N(severity, n) +#define DLOG_IF_EVERY_N(severity, condition, n) \ + LOG_IF_EVERY_N(severity, condition, n) +#define DLOG_ASSERT(condition) LOG_ASSERT(condition) + +// debug-only checking. executed if DCHECK_IS_ON(). +#define DCHECK(condition) CHECK(condition) +#define DCHECK_EQ(val1, val2) CHECK_EQ(val1, val2) +#define DCHECK_NE(val1, val2) CHECK_NE(val1, val2) +#define DCHECK_LE(val1, val2) CHECK_LE(val1, val2) +#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2) +#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2) +#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2) +#define DCHECK_NOTNULL(val) CHECK_NOTNULL(val) +#define DCHECK_STREQ(str1, str2) CHECK_STREQ(str1, str2) +#define DCHECK_STRCASEEQ(str1, str2) CHECK_STRCASEEQ(str1, str2) +#define DCHECK_STRNE(str1, str2) CHECK_STRNE(str1, str2) +#define DCHECK_STRCASENE(str1, str2) CHECK_STRCASENE(str1, str2) + +#else // !DCHECK_IS_ON() + +#define DLOG(severity) \ + static_cast(0), \ + true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) + +#define DVLOG(verboselevel) \ + static_cast(0), \ + (true || !VLOG_IS_ON(verboselevel)) ? \ + (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(INFO) + +#define DLOG_IF(severity, condition) \ + static_cast(0), \ + (true || !(condition)) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) + +#define DLOG_EVERY_N(severity, n) \ + static_cast(0), \ + true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) + +#define DLOG_IF_EVERY_N(severity, condition, n) \ + static_cast(0), \ + (true || !(condition))? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) + +#define DLOG_ASSERT(condition) \ + static_cast(0), \ + true ? (void) 0 : LOG_ASSERT(condition) + +// MSVC warning C4127: conditional expression is constant +#define DCHECK(condition) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK(condition) + +#define DCHECK_EQ(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_EQ(val1, val2) + +#define DCHECK_NE(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_NE(val1, val2) + +#define DCHECK_LE(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_LE(val1, val2) + +#define DCHECK_LT(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_LT(val1, val2) + +#define DCHECK_GE(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_GE(val1, val2) + +#define DCHECK_GT(val1, val2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_GT(val1, val2) + +// You may see warnings in release mode if you don't use the return +// value of DCHECK_NOTNULL. Please just use DCHECK for such cases. +#define DCHECK_NOTNULL(val) (val) + +#define DCHECK_STREQ(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STREQ(str1, str2) + +#define DCHECK_STRCASEEQ(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STRCASEEQ(str1, str2) + +#define DCHECK_STRNE(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STRNE(str1, str2) + +#define DCHECK_STRCASENE(str1, str2) \ + GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \ + while (false) \ + GLOG_MSVC_POP_WARNING() CHECK_STRCASENE(str1, str2) + +#endif // DCHECK_IS_ON() + +// Log only in verbose mode. + +#define VLOG(verboselevel) LOG_IF(INFO, VLOG_IS_ON(verboselevel)) + +#define VLOG_IF(verboselevel, condition) \ + LOG_IF(INFO, (condition) && VLOG_IS_ON(verboselevel)) + +#define VLOG_EVERY_N(verboselevel, n) \ + LOG_IF_EVERY_N(INFO, VLOG_IS_ON(verboselevel), n) + +#define VLOG_IF_EVERY_N(verboselevel, condition, n) \ + LOG_IF_EVERY_N(INFO, (condition) && VLOG_IS_ON(verboselevel), n) + +namespace base_logging { + +// LogMessage::LogStream is a std::ostream backed by this streambuf. +// This class ignores overflow and leaves two bytes at the end of the +// buffer to allow for a '\n' and '\0'. +class GLOG_EXPORT LogStreamBuf : public std::streambuf { + public: + // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'. + LogStreamBuf(char *buf, int len) { + setp(buf, buf + len - 2); + } + + // This effectively ignores overflow. + int_type overflow(int_type ch) { + return ch; + } + + // Legacy public ostrstream method. + size_t pcount() const { return static_cast(pptr() - pbase()); } + char* pbase() const { return std::streambuf::pbase(); } +}; + +} // namespace base_logging + +// +// This class more or less represents a particular log message. You +// create an instance of LogMessage and then stream stuff to it. +// When you finish streaming to it, ~LogMessage is called and the +// full message gets streamed to the appropriate destination. +// +// You shouldn't actually use LogMessage's constructor to log things, +// though. You should use the LOG() macro (and variants thereof) +// above. +class GLOG_EXPORT LogMessage { +public: + enum { + // Passing kNoLogPrefix for the line number disables the + // log-message prefix. Useful for using the LogMessage + // infrastructure as a printing utility. See also the --log_prefix + // flag for controlling the log-message prefix on an + // application-wide basis. + kNoLogPrefix = -1 + }; + + // LogStream inherit from non-DLL-exported class (std::ostrstream) + // and VC++ produces a warning for this situation. + // However, MSDN says "C4275 can be ignored in Microsoft Visual C++ + // 2005 if you are deriving from a type in the Standard C++ Library" + // http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx + // Let's just ignore the warning. +GLOG_MSVC_PUSH_DISABLE_WARNING(4275) + class GLOG_EXPORT LogStream : public std::ostream { +GLOG_MSVC_POP_WARNING() + public: + LogStream(char *buf, int len, int64 ctr) + : std::ostream(NULL), + streambuf_(buf, len), + ctr_(ctr), + self_(this) { + rdbuf(&streambuf_); + } + + int64 ctr() const { return ctr_; } + void set_ctr(int64 ctr) { ctr_ = ctr; } + LogStream* self() const { return self_; } + + // Legacy std::streambuf methods. + size_t pcount() const { return streambuf_.pcount(); } + char* pbase() const { return streambuf_.pbase(); } + char* str() const { return pbase(); } + + private: + LogStream(const LogStream&); + LogStream& operator=(const LogStream&); + base_logging::LogStreamBuf streambuf_; + int64 ctr_; // Counter hack (for the LOG_EVERY_X() macro) + LogStream *self_; // Consistency check hack + }; + +public: + // icc 8 requires this typedef to avoid an internal compiler error. + typedef void (LogMessage::*SendMethod)(); + + LogMessage(const char* file, int line, LogSeverity severity, int64 ctr, + SendMethod send_method); + + // Two special constructors that generate reduced amounts of code at + // LOG call sites for common cases. + + // Used for LOG(INFO): Implied are: + // severity = INFO, ctr = 0, send_method = &LogMessage::SendToLog. + // + // Using this constructor instead of the more complex constructor above + // saves 19 bytes per call site. + LogMessage(const char* file, int line); + + // Used for LOG(severity) where severity != INFO. Implied + // are: ctr = 0, send_method = &LogMessage::SendToLog + // + // Using this constructor instead of the more complex constructor above + // saves 17 bytes per call site. + LogMessage(const char* file, int line, LogSeverity severity); + + // Constructor to log this message to a specified sink (if not NULL). + // Implied are: ctr = 0, send_method = &LogMessage::SendToSinkAndLog if + // also_send_to_log is true, send_method = &LogMessage::SendToSink otherwise. + LogMessage(const char* file, int line, LogSeverity severity, LogSink* sink, + bool also_send_to_log); + + // Constructor where we also give a vector pointer + // for storing the messages (if the pointer is not NULL). + // Implied are: ctr = 0, send_method = &LogMessage::SaveOrSendToLog. + LogMessage(const char* file, int line, LogSeverity severity, + std::vector* outvec); + + // Constructor where we also give a string pointer for storing the + // message (if the pointer is not NULL). Implied are: ctr = 0, + // send_method = &LogMessage::WriteToStringAndLog. + LogMessage(const char* file, int line, LogSeverity severity, + std::string* message); + + // A special constructor used for check failures + LogMessage(const char* file, int line, const CheckOpString& result); + + ~LogMessage(); + + // Flush a buffered message to the sink set in the constructor. Always + // called by the destructor, it may also be called from elsewhere if + // needed. Only the first call is actioned; any later ones are ignored. + void Flush(); + + // An arbitrary limit on the length of a single log message. This + // is so that streaming can be done more efficiently. + static const size_t kMaxLogMessageLen; + + // Theses should not be called directly outside of logging.*, + // only passed as SendMethod arguments to other LogMessage methods: + void SendToLog(); // Actually dispatch to the logs + void SendToSyslogAndLog(); // Actually dispatch to syslog and the logs + + // Call abort() or similar to perform LOG(FATAL) crash. + [[noreturn]] static void Fail(); + + std::ostream& stream(); + + int preserved_errno() const; + + // Must be called without the log_mutex held. (L < log_mutex) + static int64 num_messages(int severity); + + const LogMessageTime& getLogMessageTime() const; + + struct LogMessageData; + +private: + // Fully internal SendMethod cases: + void SendToSinkAndLog(); // Send to sink if provided and dispatch to the logs + void SendToSink(); // Send to sink if provided, do nothing otherwise. + + // Write to string if provided and dispatch to the logs. + void WriteToStringAndLog(); + + void SaveOrSendToLog(); // Save to stringvec if provided, else to logs + + void Init(const char* file, int line, LogSeverity severity, + void (LogMessage::*send_method)()); + + // Used to fill in crash information during LOG(FATAL) failures. + void RecordCrashReason(glog_internal_namespace_::CrashReason* reason); + + // Counts of messages sent at each priority: + static int64 num_messages_[NUM_SEVERITIES]; // under log_mutex + + // We keep the data in a separate struct so that each instance of + // LogMessage uses less stack space. + LogMessageData* allocated_; + LogMessageData* data_; + LogMessageTime logmsgtime_; + + friend class LogDestination; + + LogMessage(const LogMessage&); + void operator=(const LogMessage&); +}; + +// This class happens to be thread-hostile because all instances share +// a single data buffer, but since it can only be created just before +// the process dies, we don't worry so much. +class GLOG_EXPORT LogMessageFatal : public LogMessage { + public: + LogMessageFatal(const char* file, int line); + LogMessageFatal(const char* file, int line, const CheckOpString& result); + [[noreturn]] ~LogMessageFatal(); +}; + +// A non-macro interface to the log facility; (useful +// when the logging level is not a compile-time constant). +inline void LogAtLevel(int const severity, std::string const &msg) { + LogMessage(__FILE__, __LINE__, severity).stream() << msg; +} + +// A macro alternative of LogAtLevel. New code may want to use this +// version since there are two advantages: 1. this version outputs the +// file name and the line number where this macro is put like other +// LOG macros, 2. this macro can be used as C++ stream. +#define LOG_AT_LEVEL(severity) @ac_google_namespace@::LogMessage(__FILE__, __LINE__, severity).stream() + +// Helper for CHECK_NOTNULL(). +// +// In C++11, all cases can be handled by a single function. Since the value +// category of the argument is preserved (also for rvalue references), +// member initializer lists like the one below will compile correctly: +// +// Foo() +// : x_(CHECK_NOTNULL(MethodReturningUniquePtr())) {} +template +T CheckNotNull(const char* file, int line, const char* names, T&& t) { + if (t == nullptr) { + LogMessageFatal(file, line, new std::string(names)); + } + return std::forward(t); +} + +// Allow folks to put a counter in the LOG_EVERY_X()'ed messages. This +// only works if ostream is a LogStream. If the ostream is not a +// LogStream you'll get an assert saying as much at runtime. +GLOG_EXPORT std::ostream& operator<<(std::ostream &os, + const PRIVATE_Counter&); + + +// Derived class for PLOG*() above. +class GLOG_EXPORT ErrnoLogMessage : public LogMessage { + public: + ErrnoLogMessage(const char* file, int line, LogSeverity severity, int64 ctr, + void (LogMessage::*send_method)()); + + // Postpends ": strerror(errno) [errno]". + ~ErrnoLogMessage(); + + private: + ErrnoLogMessage(const ErrnoLogMessage&); + void operator=(const ErrnoLogMessage&); +}; + + +// This class is used to explicitly ignore values in the conditional +// logging macros. This avoids compiler warnings like "value computed +// is not used" and "statement has no effect". + +class GLOG_EXPORT LogMessageVoidify { + public: + LogMessageVoidify() { } + // This has to be an operator with a precedence lower than << but + // higher than ?: + void operator&(std::ostream&) { } +}; + + +// Flushes all log files that contains messages that are at least of +// the specified severity level. Thread-safe. +GLOG_EXPORT void FlushLogFiles(LogSeverity min_severity); + +// Flushes all log files that contains messages that are at least of +// the specified severity level. Thread-hostile because it ignores +// locking -- used for catastrophic failures. +GLOG_EXPORT void FlushLogFilesUnsafe(LogSeverity min_severity); + +// +// Set the destination to which a particular severity level of log +// messages is sent. If base_filename is "", it means "don't log this +// severity". Thread-safe. +// +GLOG_EXPORT void SetLogDestination(LogSeverity severity, + const char* base_filename); + +// +// Set the basename of the symlink to the latest log file at a given +// severity. If symlink_basename is empty, do not make a symlink. If +// you don't call this function, the symlink basename is the +// invocation name of the program. Thread-safe. +// +GLOG_EXPORT void SetLogSymlink(LogSeverity severity, + const char* symlink_basename); + +// +// Used to send logs to some other kind of destination +// Users should subclass LogSink and override send to do whatever they want. +// Implementations must be thread-safe because a shared instance will +// be called from whichever thread ran the LOG(XXX) line. +class GLOG_EXPORT LogSink { + public: + virtual ~LogSink(); + + // Sink's logging logic (message_len is such as to exclude '\n' at the end). + // This method can't use LOG() or CHECK() as logging system mutex(s) are held + // during this call. + virtual void send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, + const LogMessageTime& logmsgtime, const char* message, + size_t message_len); + // Provide an overload for compatibility purposes + GLOG_DEPRECATED + virtual void send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, const std::tm* t, + const char* message, size_t message_len); + + // Redefine this to implement waiting for + // the sink's logging logic to complete. + // It will be called after each send() returns, + // but before that LogMessage exits or crashes. + // By default this function does nothing. + // Using this function one can implement complex logic for send() + // that itself involves logging; and do all this w/o causing deadlocks and + // inconsistent rearrangement of log messages. + // E.g. if a LogSink has thread-specific actions, the send() method + // can simply add the message to a queue and wake up another thread that + // handles real logging while itself making some LOG() calls; + // WaitTillSent() can be implemented to wait for that logic to complete. + // See our unittest for an example. + virtual void WaitTillSent(); + + // Returns the normal text output of the log message. + // Can be useful to implement send(). + static std::string ToString(LogSeverity severity, const char* file, int line, + const LogMessageTime &logmsgtime, + const char* message, size_t message_len); +}; + +// Add or remove a LogSink as a consumer of logging data. Thread-safe. +GLOG_EXPORT void AddLogSink(LogSink *destination); +GLOG_EXPORT void RemoveLogSink(LogSink *destination); + +// +// Specify an "extension" added to the filename specified via +// SetLogDestination. This applies to all severity levels. It's +// often used to append the port we're listening on to the logfile +// name. Thread-safe. +// +GLOG_EXPORT void SetLogFilenameExtension( + const char* filename_extension); + +// +// Make it so that all log messages of at least a particular severity +// are logged to stderr (in addition to logging to the usual log +// file(s)). Thread-safe. +// +GLOG_EXPORT void SetStderrLogging(LogSeverity min_severity); + +// +// Make it so that all log messages go only to stderr. Thread-safe. +// +GLOG_EXPORT void LogToStderr(); + +// +// Make it so that all log messages of at least a particular severity are +// logged via email to a list of addresses (in addition to logging to the +// usual log file(s)). The list of addresses is just a string containing +// the email addresses to send to (separated by spaces, say). Thread-safe. +// +GLOG_EXPORT void SetEmailLogging(LogSeverity min_severity, + const char* addresses); + +// A simple function that sends email. dest is a commma-separated +// list of addressess. Thread-safe. +GLOG_EXPORT bool SendEmail(const char* dest, const char* subject, + const char* body); + +GLOG_EXPORT const std::vector& GetLoggingDirectories(); + +// For tests only: Clear the internal [cached] list of logging directories to +// force a refresh the next time GetLoggingDirectories is called. +// Thread-hostile. +void TestOnly_ClearLoggingDirectoriesList(); + +// Returns a set of existing temporary directories, which will be a +// subset of the directories returned by GetLoggingDirectories(). +// Thread-safe. +GLOG_EXPORT void GetExistingTempDirectories( + std::vector* list); + +// Print any fatal message again -- useful to call from signal handler +// so that the last thing in the output is the fatal message. +// Thread-hostile, but a race is unlikely. +GLOG_EXPORT void ReprintFatalMessage(); + +// Truncate a log file that may be the append-only output of multiple +// processes and hence can't simply be renamed/reopened (typically a +// stdout/stderr). If the file "path" is > "limit" bytes, copy the +// last "keep" bytes to offset 0 and truncate the rest. Since we could +// be racing with other writers, this approach has the potential to +// lose very small amounts of data. For security, only follow symlinks +// if the path is /proc/self/fd/* +GLOG_EXPORT void TruncateLogFile(const char* path, uint64 limit, uint64 keep); + +// Truncate stdout and stderr if they are over the value specified by +// --max_log_size; keep the final 1MB. This function has the same +// race condition as TruncateLogFile. +GLOG_EXPORT void TruncateStdoutStderr(); + +// Return the string representation of the provided LogSeverity level. +// Thread-safe. +GLOG_EXPORT const char* GetLogSeverityName(LogSeverity severity); + +// --------------------------------------------------------------------- +// Implementation details that are not useful to most clients +// --------------------------------------------------------------------- + +// A Logger is the interface used by logging modules to emit entries +// to a log. A typical implementation will dump formatted data to a +// sequence of files. We also provide interfaces that will forward +// the data to another thread so that the invoker never blocks. +// Implementations should be thread-safe since the logging system +// will write to them from multiple threads. + +namespace base { + +class GLOG_EXPORT Logger { + public: + virtual ~Logger(); + + // Writes "message[0,message_len-1]" corresponding to an event that + // occurred at "timestamp". If "force_flush" is true, the log file + // is flushed immediately. + // + // The input message has already been formatted as deemed + // appropriate by the higher level logging facility. For example, + // textual log messages already contain timestamps, and the + // file:linenumber header. + virtual void Write(bool force_flush, + time_t timestamp, + const char* message, + size_t message_len) = 0; + + // Flush any buffered messages + virtual void Flush() = 0; + + // Get the current LOG file size. + // The returned value is approximate since some + // logged data may not have been flushed to disk yet. + virtual uint32 LogSize() = 0; +}; + +// Get the logger for the specified severity level. The logger +// remains the property of the logging module and should not be +// deleted by the caller. Thread-safe. +extern GLOG_EXPORT Logger* GetLogger(LogSeverity level); + +// Set the logger for the specified severity level. The logger +// becomes the property of the logging module and should not +// be deleted by the caller. Thread-safe. +extern GLOG_EXPORT void SetLogger(LogSeverity level, Logger* logger); + +} + +// glibc has traditionally implemented two incompatible versions of +// strerror_r(). There is a poorly defined convention for picking the +// version that we want, but it is not clear whether it even works with +// all versions of glibc. +// So, instead, we provide this wrapper that automatically detects the +// version that is in use, and then implements POSIX semantics. +// N.B. In addition to what POSIX says, we also guarantee that "buf" will +// be set to an empty string, if this function failed. This means, in most +// cases, you do not need to check the error code and you can directly +// use the value of "buf". It will never have an undefined value. +// DEPRECATED: Use StrError(int) instead. +GLOG_EXPORT int posix_strerror_r(int err, char *buf, size_t len); + +// A thread-safe replacement for strerror(). Returns a string describing the +// given POSIX error code. +GLOG_EXPORT std::string StrError(int err); + +// A class for which we define operator<<, which does nothing. +class GLOG_EXPORT NullStream : public LogMessage::LogStream { + public: + // Initialize the LogStream so the messages can be written somewhere + // (they'll never be actually displayed). This will be needed if a + // NullStream& is implicitly converted to LogStream&, in which case + // the overloaded NullStream::operator<< will not be invoked. + NullStream() : LogMessage::LogStream(message_buffer_, 1, 0) { } + NullStream(const char* /*file*/, int /*line*/, + const CheckOpString& /*result*/) : + LogMessage::LogStream(message_buffer_, 1, 0) { } + NullStream &stream() { return *this; } + private: + // A very short buffer for messages (which we discard anyway). This + // will be needed if NullStream& converted to LogStream& (e.g. as a + // result of a conditional expression). + char message_buffer_[2]; +}; + +// Do nothing. This operator is inline, allowing the message to be +// compiled away. The message will not be compiled away if we do +// something like (flag ? LOG(INFO) : LOG(ERROR)) << message; when +// SKIP_LOG=WARNING. In those cases, NullStream will be implicitly +// converted to LogStream and the message will be computed and then +// quietly discarded. +template +inline NullStream& operator<<(NullStream &str, const T &) { return str; } + +// Similar to NullStream, but aborts the program (without stack +// trace), like LogMessageFatal. +class GLOG_EXPORT NullStreamFatal : public NullStream { + public: + NullStreamFatal() { } + NullStreamFatal(const char* file, int line, const CheckOpString& result) : + NullStream(file, line, result) { } +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable : 4722) +#endif // _MSC_VER + [[noreturn]] ~NullStreamFatal() throw() { _exit(EXIT_FAILURE); } +#if defined(_MSC_VER) +#pragma warning(pop) +#endif // _MSC_VER +}; + +// Install a signal handler that will dump signal information and a stack +// trace when the program crashes on certain signals. We'll install the +// signal handler for the following signals. +// +// SIGSEGV, SIGILL, SIGFPE, SIGABRT, SIGBUS, and SIGTERM. +// +// By default, the signal handler will write the failure dump to the +// standard error. You can customize the destination by installing your +// own writer function by InstallFailureWriter() below. +// +// Note on threading: +// +// The function should be called before threads are created, if you want +// to use the failure signal handler for all threads. The stack trace +// will be shown only for the thread that receives the signal. In other +// words, stack traces of other threads won't be shown. +GLOG_EXPORT void InstallFailureSignalHandler(); + +// Installs a function that is used for writing the failure dump. "data" +// is the pointer to the beginning of a message to be written, and "size" +// is the size of the message. You should not expect the data is +// terminated with '\0'. +GLOG_EXPORT void InstallFailureWriter( + void (*writer)(const char* data, size_t size)); + +@ac_google_end_namespace@ + +#pragma pop_macro("DECLARE_VARIABLE") +#pragma pop_macro("DECLARE_bool") +#pragma pop_macro("DECLARE_string") +#pragma pop_macro("DECLARE_int32") +#pragma pop_macro("DECLARE_uint32") + +#endif // GLOG_LOGGING_H diff --git a/runtime/onnxruntime/third_party/glog/src/glog/platform.h b/runtime/onnxruntime/third_party/glog/src/glog/platform.h new file mode 100644 index 0000000..7893c45 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/platform.h @@ -0,0 +1,60 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Shinichiro Hamaji +// +// Detect supported platforms. + +#ifndef GLOG_PLATFORM_H +#define GLOG_PLATFORM_H + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +#define GLOG_OS_WINDOWS +#elif defined(__CYGWIN__) || defined(__CYGWIN32__) +#define GLOG_OS_CYGWIN +#elif defined(linux) || defined(__linux) || defined(__linux__) +#ifndef GLOG_OS_LINUX +#define GLOG_OS_LINUX +#endif +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +#define GLOG_OS_MACOSX +#elif defined(__FreeBSD__) +#define GLOG_OS_FREEBSD +#elif defined(__NetBSD__) +#define GLOG_OS_NETBSD +#elif defined(__OpenBSD__) +#define GLOG_OS_OPENBSD +#elif defined(__EMSCRIPTEN__) +#define GLOG_OS_EMSCRIPTEN +#else +// TODO(hamaji): Add other platforms. +#error Platform not supported by glog. Please consider to contribute platform information by submitting a pull request on Github. +#endif + +#endif // GLOG_PLATFORM_H diff --git a/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h b/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h new file mode 100644 index 0000000..eda5fb4 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h @@ -0,0 +1,179 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Maxim Lifantsev +// +// Thread-safe logging routines that do not allocate any memory or +// acquire any locks, and can therefore be used by low-level memory +// allocation and synchronization code. + +#ifndef GLOG_RAW_LOGGING_H +#define GLOG_RAW_LOGGING_H + +#include + +namespace google { + +#include +#include +#include + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wvariadic-macros" +#endif + +// This is similar to LOG(severity) << format... and VLOG(level) << format.., +// but +// * it is to be used ONLY by low-level modules that can't use normal LOG() +// * it is desiged to be a low-level logger that does not allocate any +// memory and does not need any locks, hence: +// * it logs straight and ONLY to STDERR w/o buffering +// * it uses an explicit format and arguments list +// * it will silently chop off really long message strings +// Usage example: +// RAW_LOG(ERROR, "Failed foo with %i: %s", status, error); +// RAW_VLOG(3, "status is %i", status); +// These will print an almost standard log lines like this to stderr only: +// E20200821 211317 file.cc:123] RAW: Failed foo with 22: bad_file +// I20200821 211317 file.cc:142] RAW: status is 20 +#define RAW_LOG(severity, ...) \ + do { \ + switch (google::GLOG_ ## severity) { \ + case 0: \ + RAW_LOG_INFO(__VA_ARGS__); \ + break; \ + case 1: \ + RAW_LOG_WARNING(__VA_ARGS__); \ + break; \ + case 2: \ + RAW_LOG_ERROR(__VA_ARGS__); \ + break; \ + case 3: \ + RAW_LOG_FATAL(__VA_ARGS__); \ + break; \ + default: \ + break; \ + } \ + } while (0) + +// The following STRIP_LOG testing is performed in the header file so that it's +// possible to completely compile out the logging code and the log messages. +#if !defined(STRIP_LOG) || STRIP_LOG == 0 +#define RAW_VLOG(verboselevel, ...) \ + do { \ + if (VLOG_IS_ON(verboselevel)) { \ + RAW_LOG_INFO(__VA_ARGS__); \ + } \ + } while (0) +#else +#define RAW_VLOG(verboselevel, ...) RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG == 0 + +#if !defined(STRIP_LOG) || STRIP_LOG == 0 +#define RAW_LOG_INFO(...) google::RawLog__(google::GLOG_INFO, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_INFO(...) google::RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG == 0 + +#if !defined(STRIP_LOG) || STRIP_LOG <= 1 +#define RAW_LOG_WARNING(...) google::RawLog__(google::GLOG_WARNING, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_WARNING(...) google::RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG <= 1 + +#if !defined(STRIP_LOG) || STRIP_LOG <= 2 +#define RAW_LOG_ERROR(...) google::RawLog__(google::GLOG_ERROR, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_ERROR(...) google::RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG <= 2 + +#if !defined(STRIP_LOG) || STRIP_LOG <= 3 +#define RAW_LOG_FATAL(...) google::RawLog__(google::GLOG_FATAL, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_FATAL(...) \ + do { \ + google::RawLogStub__(0, __VA_ARGS__); \ + exit(EXIT_FAILURE); \ + } while (0) +#endif // STRIP_LOG <= 3 + +// Similar to CHECK(condition) << message, +// but for low-level modules: we use only RAW_LOG that does not allocate memory. +// We do not want to provide args list here to encourage this usage: +// if (!cond) RAW_LOG(FATAL, "foo ...", hard_to_compute_args); +// so that the args are not computed when not needed. +#define RAW_CHECK(condition, message) \ + do { \ + if (!(condition)) { \ + RAW_LOG(FATAL, "Check %s failed: %s", #condition, message); \ + } \ + } while (0) + +// Debug versions of RAW_LOG and RAW_CHECK +#ifndef NDEBUG + +#define RAW_DLOG(severity, ...) RAW_LOG(severity, __VA_ARGS__) +#define RAW_DCHECK(condition, message) RAW_CHECK(condition, message) + +#else // NDEBUG + +#define RAW_DLOG(severity, ...) \ + while (false) \ + RAW_LOG(severity, __VA_ARGS__) +#define RAW_DCHECK(condition, message) \ + while (false) \ + RAW_CHECK(condition, message) + +#endif // NDEBUG + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + +// Stub log function used to work around for unused variable warnings when +// building with STRIP_LOG > 0. +static inline void RawLogStub__(int /* ignored */, ...) { +} + +// Helper function to implement RAW_LOG and RAW_VLOG +// Logs format... at "severity" level, reporting it +// as called from file:line. +// This does not allocate memory or acquire locks. +GLOG_EXPORT void RawLog__(LogSeverity severity, const char* file, int line, + const char* format, ...) + __attribute__((__format__(__printf__, 4, 5))); + +} + +#endif // GLOG_RAW_LOGGING_H diff --git a/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in b/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in new file mode 100644 index 0000000..66fec91 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in @@ -0,0 +1,179 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Maxim Lifantsev +// +// Thread-safe logging routines that do not allocate any memory or +// acquire any locks, and can therefore be used by low-level memory +// allocation and synchronization code. + +#ifndef GLOG_RAW_LOGGING_H +#define GLOG_RAW_LOGGING_H + +#include + +@ac_google_start_namespace@ + +#include +#include +#include + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wvariadic-macros" +#endif + +// This is similar to LOG(severity) << format... and VLOG(level) << format.., +// but +// * it is to be used ONLY by low-level modules that can't use normal LOG() +// * it is desiged to be a low-level logger that does not allocate any +// memory and does not need any locks, hence: +// * it logs straight and ONLY to STDERR w/o buffering +// * it uses an explicit format and arguments list +// * it will silently chop off really long message strings +// Usage example: +// RAW_LOG(ERROR, "Failed foo with %i: %s", status, error); +// RAW_VLOG(3, "status is %i", status); +// These will print an almost standard log lines like this to stderr only: +// E20200821 211317 file.cc:123] RAW: Failed foo with 22: bad_file +// I20200821 211317 file.cc:142] RAW: status is 20 +#define RAW_LOG(severity, ...) \ + do { \ + switch (@ac_google_namespace@::GLOG_ ## severity) { \ + case 0: \ + RAW_LOG_INFO(__VA_ARGS__); \ + break; \ + case 1: \ + RAW_LOG_WARNING(__VA_ARGS__); \ + break; \ + case 2: \ + RAW_LOG_ERROR(__VA_ARGS__); \ + break; \ + case 3: \ + RAW_LOG_FATAL(__VA_ARGS__); \ + break; \ + default: \ + break; \ + } \ + } while (0) + +// The following STRIP_LOG testing is performed in the header file so that it's +// possible to completely compile out the logging code and the log messages. +#if !defined(STRIP_LOG) || STRIP_LOG == 0 +#define RAW_VLOG(verboselevel, ...) \ + do { \ + if (VLOG_IS_ON(verboselevel)) { \ + RAW_LOG_INFO(__VA_ARGS__); \ + } \ + } while (0) +#else +#define RAW_VLOG(verboselevel, ...) RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG == 0 + +#if !defined(STRIP_LOG) || STRIP_LOG == 0 +#define RAW_LOG_INFO(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_INFO, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_INFO(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG == 0 + +#if !defined(STRIP_LOG) || STRIP_LOG <= 1 +#define RAW_LOG_WARNING(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_WARNING, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_WARNING(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG <= 1 + +#if !defined(STRIP_LOG) || STRIP_LOG <= 2 +#define RAW_LOG_ERROR(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_ERROR, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_ERROR(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__) +#endif // STRIP_LOG <= 2 + +#if !defined(STRIP_LOG) || STRIP_LOG <= 3 +#define RAW_LOG_FATAL(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_FATAL, \ + __FILE__, __LINE__, __VA_ARGS__) +#else +#define RAW_LOG_FATAL(...) \ + do { \ + @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__); \ + exit(EXIT_FAILURE); \ + } while (0) +#endif // STRIP_LOG <= 3 + +// Similar to CHECK(condition) << message, +// but for low-level modules: we use only RAW_LOG that does not allocate memory. +// We do not want to provide args list here to encourage this usage: +// if (!cond) RAW_LOG(FATAL, "foo ...", hard_to_compute_args); +// so that the args are not computed when not needed. +#define RAW_CHECK(condition, message) \ + do { \ + if (!(condition)) { \ + RAW_LOG(FATAL, "Check %s failed: %s", #condition, message); \ + } \ + } while (0) + +// Debug versions of RAW_LOG and RAW_CHECK +#ifndef NDEBUG + +#define RAW_DLOG(severity, ...) RAW_LOG(severity, __VA_ARGS__) +#define RAW_DCHECK(condition, message) RAW_CHECK(condition, message) + +#else // NDEBUG + +#define RAW_DLOG(severity, ...) \ + while (false) \ + RAW_LOG(severity, __VA_ARGS__) +#define RAW_DCHECK(condition, message) \ + while (false) \ + RAW_CHECK(condition, message) + +#endif // NDEBUG + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + +// Stub log function used to work around for unused variable warnings when +// building with STRIP_LOG > 0. +static inline void RawLogStub__(int /* ignored */, ...) { +} + +// Helper function to implement RAW_LOG and RAW_VLOG +// Logs format... at "severity" level, reporting it +// as called from file:line. +// This does not allocate memory or acquire locks. +GLOG_EXPORT void RawLog__(LogSeverity severity, const char* file, int line, + const char* format, ...) + @ac_cv___attribute___printf_4_5@; + +@ac_google_end_namespace@ + +#endif // GLOG_RAW_LOGGING_H diff --git a/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h b/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h new file mode 100644 index 0000000..96304e5 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h @@ -0,0 +1,177 @@ +// Copyright (c) 2003, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Stream output operators for STL containers; to be used for logging *only*. +// Inclusion of this file lets you do: +// +// list x; +// LOG(INFO) << "data: " << x; +// vector v1, v2; +// CHECK_EQ(v1, v2); +// +// If you want to use this header file with hash maps or slist, you +// need to define macros before including this file: +// +// - GLOG_STL_LOGGING_FOR_UNORDERED - and +// - GLOG_STL_LOGGING_FOR_TR1_UNORDERED - +// - GLOG_STL_LOGGING_FOR_EXT_HASH - +// - GLOG_STL_LOGGING_FOR_EXT_SLIST - +// + +#ifndef UTIL_GTL_STL_LOGGING_INL_H_ +#define UTIL_GTL_STL_LOGGING_INL_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Forward declare these two, and define them after all the container streams +// operators so that we can recurse from pair -> container -> container -> pair +// properly. +template +std::ostream& operator<<(std::ostream& out, const std::pair& p); + +namespace google { + +template +void PrintSequence(std::ostream& out, Iter begin, Iter end); + +} +#define OUTPUT_TWO_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + google::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + + OUTPUT_TWO_ARG_CONTAINER(std::vector) OUTPUT_TWO_ARG_CONTAINER(std::deque) + OUTPUT_TWO_ARG_CONTAINER(std::list) + +#undef OUTPUT_TWO_ARG_CONTAINER + +#define OUTPUT_THREE_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + google::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + + OUTPUT_THREE_ARG_CONTAINER(std::set) OUTPUT_THREE_ARG_CONTAINER( + std::multiset) + +#undef OUTPUT_THREE_ARG_CONTAINER + +#define OUTPUT_FOUR_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + google::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + + OUTPUT_FOUR_ARG_CONTAINER(std::map) OUTPUT_FOUR_ARG_CONTAINER( + std::multimap) OUTPUT_FOUR_ARG_CONTAINER(std::unordered_set) + OUTPUT_FOUR_ARG_CONTAINER(std::unordered_multiset) + +#undef OUTPUT_FOUR_ARG_CONTAINER + +#define OUTPUT_FIVE_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + google::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + +#if defined(GLOG_STL_LOGGING_FOR_UNORDERED) && __cplusplus >= 201103L + OUTPUT_FIVE_ARG_CONTAINER(std::unordered_map) + OUTPUT_FIVE_ARG_CONTAINER(std::unordered_multimap) +#endif + +#undef OUTPUT_FIVE_ARG_CONTAINER + + template + inline std::ostream& operator<<( + std::ostream& out, + const std::pair& p) { + out << '(' << p.first << ", " << p.second << ')'; + return out; +} + +namespace google { + +template +inline void PrintSequence(std::ostream& out, Iter begin, Iter end) { + // Output at most 100 elements -- appropriate if used for logging. + for (int i = 0; begin != end && i < 100; ++i, ++begin) { + if (i > 0) out << ' '; + out << *begin; + } + if (begin != end) { + out << " ..."; + } +} + +} + +// Note that this is technically undefined behavior! We are adding things into +// the std namespace for a reason though -- we are providing new operations on +// types which are themselves defined with this namespace. Without this, these +// operator overloads cannot be found via ADL. If these definitions are not +// found via ADL, they must be #included before they're used, which requires +// this header to be included before apparently independent other headers. +// +// For example, base/logging.h defines various template functions to implement +// CHECK_EQ(x, y) and stream x and y into the log in the event the check fails. +// It does so via the function template MakeCheckOpValueString: +// template +// void MakeCheckOpValueString(strstream* ss, const T& v) { +// (*ss) << v; +// } +// Because 'glog/logging.h' is included before 'glog/stl_logging.h', +// subsequent CHECK_EQ(v1, v2) for vector<...> typed variable v1 and v2 can only +// find these operator definitions via ADL. +// +// Even this solution has problems -- it may pull unintended operators into the +// namespace as well, allowing them to also be found via ADL, and creating code +// that only works with a particular order of includes. Long term, we need to +// move all of the *definitions* into namespace std, bet we need to ensure no +// one references them first. This lets us take that step. We cannot define them +// in both because that would create ambiguous overloads when both are found. +namespace std { using ::operator<<; } + +#endif // UTIL_GTL_STL_LOGGING_INL_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.in b/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.in new file mode 100644 index 0000000..49eec03 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.in @@ -0,0 +1,177 @@ +// Copyright (c) 2003, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Stream output operators for STL containers; to be used for logging *only*. +// Inclusion of this file lets you do: +// +// list x; +// LOG(INFO) << "data: " << x; +// vector v1, v2; +// CHECK_EQ(v1, v2); +// +// If you want to use this header file with hash maps or slist, you +// need to define macros before including this file: +// +// - GLOG_STL_LOGGING_FOR_UNORDERED - and +// - GLOG_STL_LOGGING_FOR_TR1_UNORDERED - +// - GLOG_STL_LOGGING_FOR_EXT_HASH - +// - GLOG_STL_LOGGING_FOR_EXT_SLIST - +// + +#ifndef UTIL_GTL_STL_LOGGING_INL_H_ +#define UTIL_GTL_STL_LOGGING_INL_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Forward declare these two, and define them after all the container streams +// operators so that we can recurse from pair -> container -> container -> pair +// properly. +template +std::ostream& operator<<(std::ostream& out, const std::pair& p); + +@ac_google_start_namespace@ + +template +void PrintSequence(std::ostream& out, Iter begin, Iter end); + +@ac_google_end_namespace@ +#define OUTPUT_TWO_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + + OUTPUT_TWO_ARG_CONTAINER(std::vector) OUTPUT_TWO_ARG_CONTAINER(std::deque) + OUTPUT_TWO_ARG_CONTAINER(std::list) + +#undef OUTPUT_TWO_ARG_CONTAINER + +#define OUTPUT_THREE_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + + OUTPUT_THREE_ARG_CONTAINER(std::set) OUTPUT_THREE_ARG_CONTAINER( + std::multiset) + +#undef OUTPUT_THREE_ARG_CONTAINER + +#define OUTPUT_FOUR_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + + OUTPUT_FOUR_ARG_CONTAINER(std::map) OUTPUT_FOUR_ARG_CONTAINER( + std::multimap) OUTPUT_FOUR_ARG_CONTAINER(std::unordered_set) + OUTPUT_FOUR_ARG_CONTAINER(std::unordered_multiset) + +#undef OUTPUT_FOUR_ARG_CONTAINER + +#define OUTPUT_FIVE_ARG_CONTAINER(Sequence) \ +template \ +inline std::ostream& operator<<(std::ostream& out, \ + const Sequence& seq) { \ + @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \ + return out; \ +} + +#if defined(GLOG_STL_LOGGING_FOR_UNORDERED) && __cplusplus >= 201103L + OUTPUT_FIVE_ARG_CONTAINER(std::unordered_map) + OUTPUT_FIVE_ARG_CONTAINER(std::unordered_multimap) +#endif + +#undef OUTPUT_FIVE_ARG_CONTAINER + + template + inline std::ostream& operator<<( + std::ostream& out, + const std::pair& p) { + out << '(' << p.first << ", " << p.second << ')'; + return out; +} + +@ac_google_start_namespace@ + +template +inline void PrintSequence(std::ostream& out, Iter begin, Iter end) { + // Output at most 100 elements -- appropriate if used for logging. + for (int i = 0; begin != end && i < 100; ++i, ++begin) { + if (i > 0) out << ' '; + out << *begin; + } + if (begin != end) { + out << " ..."; + } +} + +@ac_google_end_namespace@ + +// Note that this is technically undefined behavior! We are adding things into +// the std namespace for a reason though -- we are providing new operations on +// types which are themselves defined with this namespace. Without this, these +// operator overloads cannot be found via ADL. If these definitions are not +// found via ADL, they must be #included before they're used, which requires +// this header to be included before apparently independent other headers. +// +// For example, base/logging.h defines various template functions to implement +// CHECK_EQ(x, y) and stream x and y into the log in the event the check fails. +// It does so via the function template MakeCheckOpValueString: +// template +// void MakeCheckOpValueString(strstream* ss, const T& v) { +// (*ss) << v; +// } +// Because 'glog/logging.h' is included before 'glog/stl_logging.h', +// subsequent CHECK_EQ(v1, v2) for vector<...> typed variable v1 and v2 can only +// find these operator definitions via ADL. +// +// Even this solution has problems -- it may pull unintended operators into the +// namespace as well, allowing them to also be found via ADL, and creating code +// that only works with a particular order of includes. Long term, we need to +// move all of the *definitions* into namespace std, bet we need to ensure no +// one references them first. This lets us take that step. We cannot define them +// in both because that would create ambiguous overloads when both are found. +namespace std { using ::operator<<; } + +#endif // UTIL_GTL_STL_LOGGING_INL_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h b/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h new file mode 100644 index 0000000..44c2048 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h @@ -0,0 +1,120 @@ +// Copyright (c) 2023, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Ray Sidney and many others +// +// Defines the VLOG_IS_ON macro that controls the variable-verbosity +// conditional logging. +// +// It's used by VLOG and VLOG_IF in logging.h +// and by RAW_VLOG in raw_logging.h to trigger the logging. +// +// It can also be used directly e.g. like this: +// if (VLOG_IS_ON(2)) { +// // do some logging preparation and logging +// // that can't be accomplished e.g. via just VLOG(2) << ...; +// } +// +// The truth value that VLOG_IS_ON(level) returns is determined by +// the three verbosity level flags: +// --v= Gives the default maximal active V-logging level; +// 0 is the default. +// Normally positive values are used for V-logging levels. +// --vmodule= Gives the per-module maximal V-logging levels to override +// the value given by --v. +// E.g. "my_module=2,foo*=3" would change the logging level +// for all code in source files "my_module.*" and "foo*.*" +// ("-inl" suffixes are also disregarded for this matching). +// +// SetVLOGLevel helper function is provided to do limited dynamic control over +// V-logging by overriding the per-module settings given via --vmodule flag. +// +// CAVEAT: --vmodule functionality is not available in non gcc compilers. +// + +#ifndef BASE_VLOG_IS_ON_H_ +#define BASE_VLOG_IS_ON_H_ + +#include + +#include + +#if defined(__GNUC__) +// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site. +// (Normally) the first time every VLOG_IS_ON(n) site is hit, +// we determine what variable will dynamically control logging at this site: +// it's either FLAGS_v or an appropriate internal variable +// matching the current source file that represents results of +// parsing of --vmodule flag and/or SetVLOGLevel calls. +#define VLOG_IS_ON(verboselevel) \ + __extension__ \ + ({ static google::SiteFlag vlocal__ = {NULL, NULL, 0, NULL}; \ + google::int32 verbose_level__ = (verboselevel); \ + (vlocal__.level == NULL ? google::InitVLOG3__(&vlocal__, &FLAGS_v, \ + __FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \ + }) +#else +// GNU extensions not available, so we do not support --vmodule. +// Dynamic value of FLAGS_v always controls the logging level. +#define VLOG_IS_ON(verboselevel) (FLAGS_v >= (verboselevel)) +#endif + +// Set VLOG(_IS_ON) level for module_pattern to log_level. +// This lets us dynamically control what is normally set by the --vmodule flag. +// Returns the level that previously applied to module_pattern. +// NOTE: To change the log level for VLOG(_IS_ON) sites +// that have already executed after/during InitGoogleLogging, +// one needs to supply the exact --vmodule pattern that applied to them. +// (If no --vmodule pattern applied to them +// the value of FLAGS_v will continue to control them.) +extern GLOG_EXPORT int SetVLOGLevel(const char* module_pattern, int log_level); + +// Various declarations needed for VLOG_IS_ON above: ========================= + +struct SiteFlag { + google::int32* level; + const char* base_name; + std::size_t base_len; + SiteFlag* next; +}; + +// Helper routine which determines the logging info for a particalur VLOG site. +// site_flag is the address of the site-local pointer to the controlling +// verbosity level +// site_default is the default to use for *site_flag +// fname is the current source file name +// verbose_level is the argument to VLOG_IS_ON +// We will return the return value for VLOG_IS_ON +// and if possible set *site_flag appropriately. +extern GLOG_EXPORT bool InitVLOG3__( + google::SiteFlag* site_flag, + google::int32* site_default, const char* fname, + google::int32 verbose_level); + +#endif // BASE_VLOG_IS_ON_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in b/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in new file mode 100644 index 0000000..ed37e0d --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in @@ -0,0 +1,120 @@ +// Copyright (c) 2023, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Ray Sidney and many others +// +// Defines the VLOG_IS_ON macro that controls the variable-verbosity +// conditional logging. +// +// It's used by VLOG and VLOG_IF in logging.h +// and by RAW_VLOG in raw_logging.h to trigger the logging. +// +// It can also be used directly e.g. like this: +// if (VLOG_IS_ON(2)) { +// // do some logging preparation and logging +// // that can't be accomplished e.g. via just VLOG(2) << ...; +// } +// +// The truth value that VLOG_IS_ON(level) returns is determined by +// the three verbosity level flags: +// --v= Gives the default maximal active V-logging level; +// 0 is the default. +// Normally positive values are used for V-logging levels. +// --vmodule= Gives the per-module maximal V-logging levels to override +// the value given by --v. +// E.g. "my_module=2,foo*=3" would change the logging level +// for all code in source files "my_module.*" and "foo*.*" +// ("-inl" suffixes are also disregarded for this matching). +// +// SetVLOGLevel helper function is provided to do limited dynamic control over +// V-logging by overriding the per-module settings given via --vmodule flag. +// +// CAVEAT: --vmodule functionality is not available in non gcc compilers. +// + +#ifndef BASE_VLOG_IS_ON_H_ +#define BASE_VLOG_IS_ON_H_ + +#include + +#include + +#if defined(__GNUC__) +// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site. +// (Normally) the first time every VLOG_IS_ON(n) site is hit, +// we determine what variable will dynamically control logging at this site: +// it's either FLAGS_v or an appropriate internal variable +// matching the current source file that represents results of +// parsing of --vmodule flag and/or SetVLOGLevel calls. +#define VLOG_IS_ON(verboselevel) \ + __extension__ \ + ({ static @ac_google_namespace@::SiteFlag vlocal__ = {NULL, NULL, 0, NULL}; \ + @ac_google_namespace@::int32 verbose_level__ = (verboselevel); \ + (vlocal__.level == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \ + __FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \ + }) +#else +// GNU extensions not available, so we do not support --vmodule. +// Dynamic value of FLAGS_v always controls the logging level. +#define VLOG_IS_ON(verboselevel) (FLAGS_v >= (verboselevel)) +#endif + +// Set VLOG(_IS_ON) level for module_pattern to log_level. +// This lets us dynamically control what is normally set by the --vmodule flag. +// Returns the level that previously applied to module_pattern. +// NOTE: To change the log level for VLOG(_IS_ON) sites +// that have already executed after/during InitGoogleLogging, +// one needs to supply the exact --vmodule pattern that applied to them. +// (If no --vmodule pattern applied to them +// the value of FLAGS_v will continue to control them.) +extern GLOG_EXPORT int SetVLOGLevel(const char* module_pattern, int log_level); + +// Various declarations needed for VLOG_IS_ON above: ========================= + +struct SiteFlag { + @ac_google_namespace@::int32* level; + const char* base_name; + std::size_t base_len; + SiteFlag* next; +}; + +// Helper routine which determines the logging info for a particalur VLOG site. +// site_flag is the address of the site-local pointer to the controlling +// verbosity level +// site_default is the default to use for *site_flag +// fname is the current source file name +// verbose_level is the argument to VLOG_IS_ON +// We will return the return value for VLOG_IS_ON +// and if possible set *site_flag appropriately. +extern GLOG_EXPORT bool InitVLOG3__( + @ac_google_namespace@::SiteFlag* site_flag, + @ac_google_namespace@::int32* site_default, const char* fname, + @ac_google_namespace@::int32 verbose_level); + +#endif // BASE_VLOG_IS_ON_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/logging.cc b/runtime/onnxruntime/third_party/glog/src/logging.cc new file mode 100644 index 0000000..53b485c --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/logging.cc @@ -0,0 +1,2678 @@ +// Copyright (c) 1999, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#define _GNU_SOURCE 1 // needed for O_NOFOLLOW and pread()/pwrite() + +#include "utilities.h" + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include // For _exit. +#endif +#include +#include +#include +#ifdef HAVE_SYS_UTSNAME_H +# include // For uname. +#endif +#include +#include +#include +#include +#include +#include +#ifdef HAVE_PWD_H +# include +#endif +#ifdef HAVE_SYSLOG_H +# include +#endif +#include +#include // for errno +#include +#ifdef GLOG_OS_WINDOWS +#include "windows/dirent.h" +#else +#include // for automatic removal of old logs +#endif +#include "base/commandlineflags.h" // to get the program name +#include +#include +#include "base/googleinit.h" + +#ifdef HAVE_STACKTRACE +# include "stacktrace.h" +#endif + +#ifdef __ANDROID__ +#include +#endif + +using std::string; +using std::vector; +using std::setw; +using std::setfill; +using std::hex; +using std::dec; +using std::min; +using std::ostream; +using std::ostringstream; + +using std::FILE; +using std::fwrite; +using std::fclose; +using std::fflush; +using std::fprintf; +using std::perror; + +#ifdef __QNX__ +using std::fdopen; +#endif + +#ifdef _WIN32 +#define fdopen _fdopen +#endif + +// There is no thread annotation support. +#define EXCLUSIVE_LOCKS_REQUIRED(mu) + +static bool BoolFromEnv(const char *varname, bool defval) { + const char* const valstr = getenv(varname); + if (!valstr) { + return defval; + } + return memchr("tTyY1\0", valstr[0], 6) != nullptr; +} + +GLOG_DEFINE_bool(timestamp_in_logfile_name, + BoolFromEnv("GOOGLE_TIMESTAMP_IN_LOGFILE_NAME", true), + "put a timestamp at the end of the log file name"); +GLOG_DEFINE_bool(logtostderr, BoolFromEnv("GOOGLE_LOGTOSTDERR", false), + "log messages go to stderr instead of logfiles"); +GLOG_DEFINE_bool(alsologtostderr, BoolFromEnv("GOOGLE_ALSOLOGTOSTDERR", false), + "log messages go to stderr in addition to logfiles"); +GLOG_DEFINE_bool(colorlogtostderr, false, + "color messages logged to stderr (if supported by terminal)"); +GLOG_DEFINE_bool(colorlogtostdout, false, + "color messages logged to stdout (if supported by terminal)"); +GLOG_DEFINE_bool(logtostdout, BoolFromEnv("GOOGLE_LOGTOSTDOUT", false), + "log messages go to stdout instead of logfiles"); +#ifdef GLOG_OS_LINUX +GLOG_DEFINE_bool(drop_log_memory, true, "Drop in-memory buffers of log contents. " + "Logs can grow very quickly and they are rarely read before they " + "need to be evicted from memory. Instead, drop them from memory " + "as soon as they are flushed to disk."); +#endif + +// By default, errors (including fatal errors) get logged to stderr as +// well as the file. +// +// The default is ERROR instead of FATAL so that users can see problems +// when they run a program without having to look in another file. +DEFINE_int32(stderrthreshold, + GOOGLE_NAMESPACE::GLOG_ERROR, + "log messages at or above this level are copied to stderr in " + "addition to logfiles. This flag obsoletes --alsologtostderr."); + +GLOG_DEFINE_string(alsologtoemail, "", + "log messages go to these email addresses " + "in addition to logfiles"); +GLOG_DEFINE_bool(log_file_header, true, + "Write the file header at the start of each log file"); +GLOG_DEFINE_bool(log_prefix, true, + "Prepend the log prefix to the start of each log line"); +GLOG_DEFINE_bool(log_year_in_prefix, true, + "Include the year in the log prefix"); +GLOG_DEFINE_int32(minloglevel, 0, "Messages logged at a lower level than this don't " + "actually get logged anywhere"); +GLOG_DEFINE_int32(logbuflevel, 0, + "Buffer log messages logged at this level or lower" + " (-1 means don't buffer; 0 means buffer INFO only;" + " ...)"); +GLOG_DEFINE_int32(logbufsecs, 30, + "Buffer log messages for at most this many seconds"); + +GLOG_DEFINE_int32(logcleansecs, 60 * 5, // every 5 minutes + "Clean overdue logs every this many seconds"); + +GLOG_DEFINE_int32(logemaillevel, 999, + "Email log messages logged at this level or higher" + " (0 means email all; 3 means email FATAL only;" + " ...)"); +GLOG_DEFINE_string(logmailer, "", + "Mailer used to send logging email"); + +// Compute the default value for --log_dir +static const char* DefaultLogDir() { + const char* env; + env = getenv("GOOGLE_LOG_DIR"); + if (env != nullptr && env[0] != '\0') { + return env; + } + env = getenv("TEST_TMPDIR"); + if (env != nullptr && env[0] != '\0') { + return env; + } + return ""; +} + +GLOG_DEFINE_int32(logfile_mode, 0664, "Log file mode/permissions."); + +GLOG_DEFINE_string(log_dir, DefaultLogDir(), + "If specified, logfiles are written into this directory instead " + "of the default logging directory."); +GLOG_DEFINE_string(log_link, "", "Put additional links to the log " + "files in this directory"); + +GLOG_DEFINE_uint32(max_log_size, 1800, + "approx. maximum log file size (in MB). A value of 0 will " + "be silently overridden to 1."); + +GLOG_DEFINE_bool(stop_logging_if_full_disk, false, + "Stop attempting to log to disk if the disk is full."); + +GLOG_DEFINE_string(log_backtrace_at, "", + "Emit a backtrace when logging at file:linenum."); + +GLOG_DEFINE_bool(log_utc_time, false, + "Use UTC time for logging."); + +// TODO(hamaji): consider windows +enum { PATH_SEPARATOR = '/' }; + +#ifndef HAVE_PREAD +#if defined(GLOG_OS_WINDOWS) +#include +#define ssize_t SSIZE_T +#endif +static ssize_t pread(int fd, void* buf, size_t count, off_t offset) { + off_t orig_offset = lseek(fd, 0, SEEK_CUR); + if (orig_offset == (off_t)-1) + return -1; + if (lseek(fd, offset, SEEK_CUR) == (off_t)-1) + return -1; + ssize_t len = read(fd, buf, count); + if (len < 0) + return len; + if (lseek(fd, orig_offset, SEEK_SET) == (off_t)-1) + return -1; + return len; +} +#endif // !HAVE_PREAD + +#ifndef HAVE_PWRITE +static ssize_t pwrite(int fd, void* buf, size_t count, off_t offset) { + off_t orig_offset = lseek(fd, 0, SEEK_CUR); + if (orig_offset == (off_t)-1) + return -1; + if (lseek(fd, offset, SEEK_CUR) == (off_t)-1) + return -1; + ssize_t len = write(fd, buf, count); + if (len < 0) + return len; + if (lseek(fd, orig_offset, SEEK_SET) == (off_t)-1) + return -1; + return len; +} +#endif // !HAVE_PWRITE + +static void GetHostName(string* hostname) { +#if defined(HAVE_SYS_UTSNAME_H) + struct utsname buf; + if (uname(&buf) < 0) { + // ensure null termination on failure + *buf.nodename = '\0'; + } + *hostname = buf.nodename; +#elif defined(GLOG_OS_WINDOWS) + char buf[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD len = MAX_COMPUTERNAME_LENGTH + 1; + if (GetComputerNameA(buf, &len)) { + *hostname = buf; + } else { + hostname->clear(); + } +#else +# warning There is no way to retrieve the host name. + *hostname = "(unknown)"; +#endif +} + +// Returns true iff terminal supports using colors in output. +static bool TerminalSupportsColor() { + bool term_supports_color = false; +#ifdef GLOG_OS_WINDOWS + // on Windows TERM variable is usually not set, but the console does + // support colors. + term_supports_color = true; +#else + // On non-Windows platforms, we rely on the TERM variable. + const char* const term = getenv("TERM"); + if (term != nullptr && term[0] != '\0') { + term_supports_color = + !strcmp(term, "xterm") || + !strcmp(term, "xterm-color") || + !strcmp(term, "xterm-256color") || + !strcmp(term, "screen-256color") || + !strcmp(term, "konsole") || + !strcmp(term, "konsole-16color") || + !strcmp(term, "konsole-256color") || + !strcmp(term, "screen") || + !strcmp(term, "linux") || + !strcmp(term, "cygwin"); + } +#endif + return term_supports_color; +} + +_START_GOOGLE_NAMESPACE_ + +enum GLogColor { + COLOR_DEFAULT, + COLOR_RED, + COLOR_GREEN, + COLOR_YELLOW +}; + +static GLogColor SeverityToColor(LogSeverity severity) { + assert(severity >= 0 && severity < NUM_SEVERITIES); + GLogColor color = COLOR_DEFAULT; + switch (severity) { + case GLOG_INFO: + color = COLOR_DEFAULT; + break; + case GLOG_WARNING: + color = COLOR_YELLOW; + break; + case GLOG_ERROR: + case GLOG_FATAL: + color = COLOR_RED; + break; + default: + // should never get here. + assert(false); + } + return color; +} + +#ifdef GLOG_OS_WINDOWS + +// Returns the character attribute for the given color. +static WORD GetColorAttribute(GLogColor color) { + switch (color) { + case COLOR_RED: return FOREGROUND_RED; + case COLOR_GREEN: return FOREGROUND_GREEN; + case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN; + default: return 0; + } +} + +#else + +// Returns the ANSI color code for the given color. +static const char* GetAnsiColorCode(GLogColor color) { + switch (color) { + case COLOR_RED: return "1"; + case COLOR_GREEN: return "2"; + case COLOR_YELLOW: return "3"; + case COLOR_DEFAULT: return ""; + }; + return nullptr; // stop warning about return type. +} + +#endif // GLOG_OS_WINDOWS + +// Safely get max_log_size, overriding to 1 if it somehow gets defined as 0 +static uint32 MaxLogSize() { + return (FLAGS_max_log_size > 0 && FLAGS_max_log_size < 4096 + ? FLAGS_max_log_size + : 1); +} + +// An arbitrary limit on the length of a single log message. This +// is so that streaming can be done more efficiently. +const size_t LogMessage::kMaxLogMessageLen = 30000; + +struct LogMessage::LogMessageData { + LogMessageData(); + + int preserved_errno_; // preserved errno + // Buffer space; contains complete message text. + char message_text_[LogMessage::kMaxLogMessageLen+1]; + LogStream stream_; + char severity_; // What level is this LogMessage logged at? + int line_; // line number where logging call is. + void (LogMessage::*send_method_)(); // Call this in destructor to send + union { // At most one of these is used: union to keep the size low. + LogSink* sink_; // nullptr or sink to send message to + std::vector* + outvec_; // nullptr or vector to push message onto + std::string* message_; // nullptr or string to write message into + }; + size_t num_prefix_chars_; // # of chars of prefix in this message + size_t num_chars_to_log_; // # of chars of msg to send to log + size_t num_chars_to_syslog_; // # of chars of msg to send to syslog + const char* basename_; // basename of file that called LOG + const char* fullname_; // fullname of file that called LOG + bool has_been_flushed_; // false => data has not been flushed + bool first_fatal_; // true => this was first fatal msg + + private: + LogMessageData(const LogMessageData&) = delete; + void operator=(const LogMessageData&) = delete; +}; + +// A mutex that allows only one thread to log at a time, to keep things from +// getting jumbled. Some other very uncommon logging operations (like +// changing the destination file for log messages of a given severity) also +// lock this mutex. Please be sure that anybody who might possibly need to +// lock it does so. +static Mutex log_mutex; + +// Number of messages sent at each severity. Under log_mutex. +int64 LogMessage::num_messages_[NUM_SEVERITIES] = {0, 0, 0, 0}; + +// Globally disable log writing (if disk is full) +static bool stop_writing = false; + +const char*const LogSeverityNames[NUM_SEVERITIES] = { + "INFO", "WARNING", "ERROR", "FATAL" +}; + +// Has the user called SetExitOnDFatal(true)? +static bool exit_on_dfatal = true; + +const char* GetLogSeverityName(LogSeverity severity) { + return LogSeverityNames[severity]; +} + +static bool SendEmailInternal(const char*dest, const char *subject, + const char*body, bool use_logging); + +base::Logger::~Logger() = default; + +namespace { + // Optional user-configured callback to print custom prefixes. +CustomPrefixCallback custom_prefix_callback = nullptr; +// User-provided data to pass to the callback: +void* custom_prefix_callback_data = nullptr; +} + +namespace { + +// Encapsulates all file-system related state +class LogFileObject : public base::Logger { + public: + LogFileObject(LogSeverity severity, const char* base_filename); + ~LogFileObject() override; + + void Write(bool force_flush, // Should we force a flush here? + time_t timestamp, // Timestamp for this entry + const char* message, size_t message_len) override; + + // Configuration options + void SetBasename(const char* basename); + void SetExtension(const char* ext); + void SetSymlinkBasename(const char* symlink_basename); + + // Normal flushing routine + void Flush() override; + + // It is the actual file length for the system loggers, + // i.e., INFO, ERROR, etc. + uint32 LogSize() override { + MutexLock l(&lock_); + return file_length_; + } + + // Internal flush routine. Exposed so that FlushLogFilesUnsafe() + // can avoid grabbing a lock. Usually Flush() calls it after + // acquiring lock_. + void FlushUnlocked(); + + private: + static const uint32 kRolloverAttemptFrequency = 0x20; + + Mutex lock_; + bool base_filename_selected_; + string base_filename_; + string symlink_basename_; + string filename_extension_; // option users can specify (eg to add port#) + FILE* file_{nullptr}; + LogSeverity severity_; + uint32 bytes_since_flush_{0}; + uint32 dropped_mem_length_{0}; + uint32 file_length_{0}; + unsigned int rollover_attempt_; + int64 next_flush_time_{0}; // cycle count at which to flush log + WallTime start_time_; + + // Actually create a logfile using the value of base_filename_ and the + // optional argument time_pid_string + // REQUIRES: lock_ is held + bool CreateLogfile(const string& time_pid_string); +}; + +// Encapsulate all log cleaner related states +class LogCleaner { + public: + LogCleaner(); + + // Setting overdue_days to 0 days will delete all logs. + void Enable(unsigned int overdue_days); + void Disable(); + + // update next_cleanup_time_ + void UpdateCleanUpTime(); + + void Run(bool base_filename_selected, + const string& base_filename, + const string& filename_extension); + + bool enabled() const { return enabled_; } + + private: + vector GetOverdueLogNames(string log_directory, unsigned int days, + const string& base_filename, + const string& filename_extension) const; + + bool IsLogFromCurrentProject(const string& filepath, + const string& base_filename, + const string& filename_extension) const; + + bool IsLogLastModifiedOver(const string& filepath, unsigned int days) const; + + bool enabled_{false}; + unsigned int overdue_days_{7}; + int64 next_cleanup_time_{0}; // cycle count at which to clean overdue log +}; + +LogCleaner log_cleaner; + +} // namespace + +class LogDestination { + public: + friend class LogMessage; + friend void ReprintFatalMessage(); + friend base::Logger* base::GetLogger(LogSeverity); + friend void base::SetLogger(LogSeverity, base::Logger*); + + // These methods are just forwarded to by their global versions. + static void SetLogDestination(LogSeverity severity, + const char* base_filename); + static void SetLogSymlink(LogSeverity severity, + const char* symlink_basename); + static void AddLogSink(LogSink *destination); + static void RemoveLogSink(LogSink *destination); + static void SetLogFilenameExtension(const char* filename_extension); + static void SetStderrLogging(LogSeverity min_severity); + static void SetEmailLogging(LogSeverity min_severity, const char* addresses); + static void LogToStderr(); + // Flush all log files that are at least at the given severity level + static void FlushLogFiles(int min_severity); + static void FlushLogFilesUnsafe(int min_severity); + + // we set the maximum size of our packet to be 1400, the logic being + // to prevent fragmentation. + // Really this number is arbitrary. + static const int kNetworkBytes = 1400; + + static const string& hostname(); + static const bool& terminal_supports_color() { + return terminal_supports_color_; + } + + static void DeleteLogDestinations(); + + private: + LogDestination(LogSeverity severity, const char* base_filename); + ~LogDestination(); + + // Take a log message of a particular severity and log it to stderr + // iff it's of a high enough severity to deserve it. + static void MaybeLogToStderr(LogSeverity severity, const char* message, + size_t message_len, size_t prefix_len); + + // Take a log message of a particular severity and log it to email + // iff it's of a high enough severity to deserve it. + static void MaybeLogToEmail(LogSeverity severity, const char* message, + size_t len); + // Take a log message of a particular severity and log it to a file + // iff the base filename is not "" (which means "don't log to me") + static void MaybeLogToLogfile(LogSeverity severity, + time_t timestamp, + const char* message, size_t len); + // Take a log message of a particular severity and log it to the file + // for that severity and also for all files with severity less than + // this severity. + static void LogToAllLogfiles(LogSeverity severity, + time_t timestamp, + const char* message, size_t len); + + // Send logging info to all registered sinks. + static void LogToSinks(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, + const LogMessageTime& logmsgtime, const char* message, + size_t message_len); + + // Wait for all registered sinks via WaitTillSent + // including the optional one in "data". + static void WaitForSinks(LogMessage::LogMessageData* data); + + static LogDestination* log_destination(LogSeverity severity); + + base::Logger* GetLoggerImpl() const { return logger_; } + void SetLoggerImpl(base::Logger* logger); + void ResetLoggerImpl() { SetLoggerImpl(&fileobject_); } + + LogFileObject fileobject_; + base::Logger* logger_; // Either &fileobject_, or wrapper around it + + static LogDestination* log_destinations_[NUM_SEVERITIES]; + static LogSeverity email_logging_severity_; + static string addresses_; + static string hostname_; + static bool terminal_supports_color_; + + // arbitrary global logging destinations. + static vector* sinks_; + + // Protects the vector sinks_, + // but not the LogSink objects its elements reference. + static Mutex sink_mutex_; + + // Disallow + LogDestination(const LogDestination&) = delete; + LogDestination& operator=(const LogDestination&) = delete; +}; + +// Errors do not get logged to email by default. +LogSeverity LogDestination::email_logging_severity_ = 99999; + +string LogDestination::addresses_; +string LogDestination::hostname_; + +vector* LogDestination::sinks_ = nullptr; +Mutex LogDestination::sink_mutex_; +bool LogDestination::terminal_supports_color_ = TerminalSupportsColor(); + +/* static */ +const string& LogDestination::hostname() { + if (hostname_.empty()) { + GetHostName(&hostname_); + if (hostname_.empty()) { + hostname_ = "(unknown)"; + } + } + return hostname_; +} + +LogDestination::LogDestination(LogSeverity severity, + const char* base_filename) + : fileobject_(severity, base_filename), + logger_(&fileobject_) { +} + +LogDestination::~LogDestination() { + ResetLoggerImpl(); +} + +void LogDestination::SetLoggerImpl(base::Logger* logger) { + if (logger_ == logger) { + // Prevent releasing currently held sink on reset + return; + } + + if (logger_ && logger_ != &fileobject_) { + // Delete user-specified logger set via SetLogger(). + delete logger_; + } + logger_ = logger; +} + +inline void LogDestination::FlushLogFilesUnsafe(int min_severity) { + // assume we have the log_mutex or we simply don't care + // about it + for (int i = min_severity; i < NUM_SEVERITIES; i++) { + LogDestination* log = log_destinations_[i]; + if (log != nullptr) { + // Flush the base fileobject_ logger directly instead of going + // through any wrappers to reduce chance of deadlock. + log->fileobject_.FlushUnlocked(); + } + } +} + +inline void LogDestination::FlushLogFiles(int min_severity) { + // Prevent any subtle race conditions by wrapping a mutex lock around + // all this stuff. + MutexLock l(&log_mutex); + for (int i = min_severity; i < NUM_SEVERITIES; i++) { + LogDestination* log = log_destination(i); + if (log != nullptr) { + log->logger_->Flush(); + } + } +} + +inline void LogDestination::SetLogDestination(LogSeverity severity, + const char* base_filename) { + assert(severity >= 0 && severity < NUM_SEVERITIES); + // Prevent any subtle race conditions by wrapping a mutex lock around + // all this stuff. + MutexLock l(&log_mutex); + log_destination(severity)->fileobject_.SetBasename(base_filename); +} + +inline void LogDestination::SetLogSymlink(LogSeverity severity, + const char* symlink_basename) { + CHECK_GE(severity, 0); + CHECK_LT(severity, NUM_SEVERITIES); + MutexLock l(&log_mutex); + log_destination(severity)->fileobject_.SetSymlinkBasename(symlink_basename); +} + +inline void LogDestination::AddLogSink(LogSink *destination) { + // Prevent any subtle race conditions by wrapping a mutex lock around + // all this stuff. + MutexLock l(&sink_mutex_); + if (!sinks_) sinks_ = new vector; + sinks_->push_back(destination); +} + +inline void LogDestination::RemoveLogSink(LogSink *destination) { + // Prevent any subtle race conditions by wrapping a mutex lock around + // all this stuff. + MutexLock l(&sink_mutex_); + // This doesn't keep the sinks in order, but who cares? + if (sinks_) { + sinks_->erase(std::remove(sinks_->begin(), sinks_->end(), destination), sinks_->end()); + } +} + +inline void LogDestination::SetLogFilenameExtension(const char* ext) { + // Prevent any subtle race conditions by wrapping a mutex lock around + // all this stuff. + MutexLock l(&log_mutex); + for ( int severity = 0; severity < NUM_SEVERITIES; ++severity ) { + log_destination(severity)->fileobject_.SetExtension(ext); + } +} + +inline void LogDestination::SetStderrLogging(LogSeverity min_severity) { + assert(min_severity >= 0 && min_severity < NUM_SEVERITIES); + // Prevent any subtle race conditions by wrapping a mutex lock around + // all this stuff. + MutexLock l(&log_mutex); + FLAGS_stderrthreshold = min_severity; +} + +inline void LogDestination::LogToStderr() { + // *Don't* put this stuff in a mutex lock, since SetStderrLogging & + // SetLogDestination already do the locking! + SetStderrLogging(0); // thus everything is "also" logged to stderr + for ( int i = 0; i < NUM_SEVERITIES; ++i ) { + SetLogDestination(i, ""); // "" turns off logging to a logfile + } +} + +inline void LogDestination::SetEmailLogging(LogSeverity min_severity, + const char* addresses) { + assert(min_severity >= 0 && min_severity < NUM_SEVERITIES); + // Prevent any subtle race conditions by wrapping a mutex lock around + // all this stuff. + MutexLock l(&log_mutex); + LogDestination::email_logging_severity_ = min_severity; + LogDestination::addresses_ = addresses; +} + +static void ColoredWriteToStderrOrStdout(FILE* output, LogSeverity severity, + const char* message, size_t len) { + bool is_stdout = (output == stdout); + const GLogColor color = (LogDestination::terminal_supports_color() && + ((!is_stdout && FLAGS_colorlogtostderr) || + (is_stdout && FLAGS_colorlogtostdout))) + ? SeverityToColor(severity) + : COLOR_DEFAULT; + + // Avoid using cerr from this module since we may get called during + // exit code, and cerr may be partially or fully destroyed by then. + if (COLOR_DEFAULT == color) { + fwrite(message, len, 1, output); + return; + } +#ifdef GLOG_OS_WINDOWS + const HANDLE output_handle = + GetStdHandle(is_stdout ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); + + // Gets the current text color. + CONSOLE_SCREEN_BUFFER_INFO buffer_info; + GetConsoleScreenBufferInfo(output_handle, &buffer_info); + const WORD old_color_attrs = buffer_info.wAttributes; + + // We need to flush the stream buffers into the console before each + // SetConsoleTextAttribute call lest it affect the text that is already + // printed but has not yet reached the console. + fflush(output); + SetConsoleTextAttribute(output_handle, + GetColorAttribute(color) | FOREGROUND_INTENSITY); + fwrite(message, len, 1, output); + fflush(output); + // Restores the text color. + SetConsoleTextAttribute(output_handle, old_color_attrs); +#else + fprintf(output, "\033[0;3%sm", GetAnsiColorCode(color)); + fwrite(message, len, 1, output); + fprintf(output, "\033[m"); // Resets the terminal to default. +#endif // GLOG_OS_WINDOWS +} + +static void ColoredWriteToStdout(LogSeverity severity, const char* message, + size_t len) { + FILE* output = stdout; + // We also need to send logs to the stderr when the severity is + // higher or equal to the stderr threshold. + if (severity >= FLAGS_stderrthreshold) { + output = stderr; + } + ColoredWriteToStderrOrStdout(output, severity, message, len); +} + +static void ColoredWriteToStderr(LogSeverity severity, const char* message, + size_t len) { + ColoredWriteToStderrOrStdout(stderr, severity, message, len); +} + +static void WriteToStderr(const char* message, size_t len) { + // Avoid using cerr from this module since we may get called during + // exit code, and cerr may be partially or fully destroyed by then. + fwrite(message, len, 1, stderr); +} + +inline void LogDestination::MaybeLogToStderr(LogSeverity severity, + const char* message, size_t message_len, size_t prefix_len) { + if ((severity >= FLAGS_stderrthreshold) || FLAGS_alsologtostderr) { + ColoredWriteToStderr(severity, message, message_len); +#ifdef GLOG_OS_WINDOWS + (void) prefix_len; + // On Windows, also output to the debugger + ::OutputDebugStringA(message); +#elif defined(__ANDROID__) + // On Android, also output to logcat + const int android_log_levels[NUM_SEVERITIES] = { + ANDROID_LOG_INFO, + ANDROID_LOG_WARN, + ANDROID_LOG_ERROR, + ANDROID_LOG_FATAL, + }; + __android_log_write(android_log_levels[severity], + glog_internal_namespace_::ProgramInvocationShortName(), + message + prefix_len); +#else + (void) prefix_len; +#endif + } +} + + +inline void LogDestination::MaybeLogToEmail(LogSeverity severity, + const char* message, size_t len) { + if (severity >= email_logging_severity_ || + severity >= FLAGS_logemaillevel) { + string to(FLAGS_alsologtoemail); + if (!addresses_.empty()) { + if (!to.empty()) { + to += ","; + } + to += addresses_; + } + const string subject(string("[LOG] ") + LogSeverityNames[severity] + ": " + + glog_internal_namespace_::ProgramInvocationShortName()); + string body(hostname()); + body += "\n\n"; + body.append(message, len); + + // should NOT use SendEmail(). The caller of this function holds the + // log_mutex and SendEmail() calls LOG/VLOG which will block trying to + // acquire the log_mutex object. Use SendEmailInternal() and set + // use_logging to false. + SendEmailInternal(to.c_str(), subject.c_str(), body.c_str(), false); + } +} + + +inline void LogDestination::MaybeLogToLogfile(LogSeverity severity, + time_t timestamp, + const char* message, + size_t len) { + const bool should_flush = severity > FLAGS_logbuflevel; + LogDestination* destination = log_destination(severity); + destination->logger_->Write(should_flush, timestamp, message, len); +} + +inline void LogDestination::LogToAllLogfiles(LogSeverity severity, + time_t timestamp, + const char* message, + size_t len) { + if (FLAGS_logtostdout) { // global flag: never log to file + ColoredWriteToStdout(severity, message, len); + } else if (FLAGS_logtostderr) { // global flag: never log to file + ColoredWriteToStderr(severity, message, len); + } else { + for (int i = severity; i >= 0; --i) { + LogDestination::MaybeLogToLogfile(i, timestamp, message, len); + } + } +} + +inline void LogDestination::LogToSinks(LogSeverity severity, + const char* full_filename, + const char* base_filename, int line, + const LogMessageTime& logmsgtime, + const char* message, + size_t message_len) { + ReaderMutexLock l(&sink_mutex_); + if (sinks_) { + for (size_t i = sinks_->size(); i-- > 0; ) { + (*sinks_)[i]->send(severity, full_filename, base_filename, + line, logmsgtime, message, message_len); + } + } +} + +inline void LogDestination::WaitForSinks(LogMessage::LogMessageData* data) { + ReaderMutexLock l(&sink_mutex_); + if (sinks_) { + for (size_t i = sinks_->size(); i-- > 0; ) { + (*sinks_)[i]->WaitTillSent(); + } + } + const bool send_to_sink = + (data->send_method_ == &LogMessage::SendToSink) || + (data->send_method_ == &LogMessage::SendToSinkAndLog); + if (send_to_sink && data->sink_ != nullptr) { + data->sink_->WaitTillSent(); + } +} + +LogDestination* LogDestination::log_destinations_[NUM_SEVERITIES]; + +inline LogDestination* LogDestination::log_destination(LogSeverity severity) { + assert(severity >=0 && severity < NUM_SEVERITIES); + if (!log_destinations_[severity]) { + log_destinations_[severity] = new LogDestination(severity, nullptr); + } + return log_destinations_[severity]; +} + +void LogDestination::DeleteLogDestinations() { + for (auto& log_destination : log_destinations_) { + delete log_destination; + log_destination = nullptr; + } + MutexLock l(&sink_mutex_); + delete sinks_; + sinks_ = nullptr; +} + +namespace { + +std::string g_application_fingerprint; + +} // namespace + +void SetApplicationFingerprint(const std::string& fingerprint) { + g_application_fingerprint = fingerprint; +} + +namespace { + +// Directory delimiter; Windows supports both forward slashes and backslashes +#ifdef GLOG_OS_WINDOWS +const char possible_dir_delim[] = {'\\', '/'}; +#else +const char possible_dir_delim[] = {'/'}; +#endif + +string PrettyDuration(int secs) { + std::stringstream result; + int mins = secs / 60; + int hours = mins / 60; + mins = mins % 60; + secs = secs % 60; + result.fill('0'); + result << hours << ':' << setw(2) << mins << ':' << setw(2) << secs; + return result.str(); +} + +LogFileObject::LogFileObject(LogSeverity severity, const char* base_filename) + : base_filename_selected_(base_filename != nullptr), + base_filename_((base_filename != nullptr) ? base_filename : ""), + symlink_basename_(glog_internal_namespace_::ProgramInvocationShortName()), + filename_extension_(), + + severity_(severity), + + rollover_attempt_(kRolloverAttemptFrequency - 1), + + start_time_(WallTime_Now()) { + assert(severity >= 0); + assert(severity < NUM_SEVERITIES); +} + +LogFileObject::~LogFileObject() { + MutexLock l(&lock_); + if (file_ != nullptr) { + fclose(file_); + file_ = nullptr; + } +} + +void LogFileObject::SetBasename(const char* basename) { + MutexLock l(&lock_); + base_filename_selected_ = true; + if (base_filename_ != basename) { + // Get rid of old log file since we are changing names + if (file_ != nullptr) { + fclose(file_); + file_ = nullptr; + rollover_attempt_ = kRolloverAttemptFrequency-1; + } + base_filename_ = basename; + } +} + +void LogFileObject::SetExtension(const char* ext) { + MutexLock l(&lock_); + if (filename_extension_ != ext) { + // Get rid of old log file since we are changing names + if (file_ != nullptr) { + fclose(file_); + file_ = nullptr; + rollover_attempt_ = kRolloverAttemptFrequency-1; + } + filename_extension_ = ext; + } +} + +void LogFileObject::SetSymlinkBasename(const char* symlink_basename) { + MutexLock l(&lock_); + symlink_basename_ = symlink_basename; +} + +void LogFileObject::Flush() { + MutexLock l(&lock_); + FlushUnlocked(); +} + +void LogFileObject::FlushUnlocked(){ + if (file_ != nullptr) { + fflush(file_); + bytes_since_flush_ = 0; + } + // Figure out when we are due for another flush. + const int64 next = (FLAGS_logbufsecs + * static_cast(1000000)); // in usec + next_flush_time_ = CycleClock_Now() + UsecToCycles(next); +} + +bool LogFileObject::CreateLogfile(const string& time_pid_string) { + string string_filename = base_filename_; + if (FLAGS_timestamp_in_logfile_name) { + string_filename += time_pid_string; + } + string_filename += filename_extension_; + const char* filename = string_filename.c_str(); + //only write to files, create if non-existant. + int flags = O_WRONLY | O_CREAT; + if (FLAGS_timestamp_in_logfile_name) { + //demand that the file is unique for our timestamp (fail if it exists). + flags = flags | O_EXCL; + } + int fd = open(filename, flags, static_cast(FLAGS_logfile_mode)); + if (fd == -1) return false; +#ifdef HAVE_FCNTL + // Mark the file close-on-exec. We don't really care if this fails + fcntl(fd, F_SETFD, FD_CLOEXEC); + + // Mark the file as exclusive write access to avoid two clients logging to the + // same file. This applies particularly when !FLAGS_timestamp_in_logfile_name + // (otherwise open would fail because the O_EXCL flag on similar filename). + // locks are released on unlock or close() automatically, only after log is + // released. + // This will work after a fork as it is not inherited (not stored in the fd). + // Lock will not be lost because the file is opened with exclusive lock + // (write) and we will never read from it inside the process. + // TODO: windows implementation of this (as flock is not available on + // mingw). + static struct flock w_lock; + + w_lock.l_type = F_WRLCK; + w_lock.l_start = 0; + w_lock.l_whence = SEEK_SET; + w_lock.l_len = 0; + + int wlock_ret = fcntl(fd, F_SETLK, &w_lock); + if (wlock_ret == -1) { + close(fd); //as we are failing already, do not check errors here + return false; + } +#endif + + //fdopen in append mode so if the file exists it will fseek to the end + file_ = fdopen(fd, "a"); // Make a FILE*. + if (file_ == nullptr) { // Man, we're screwed! + close(fd); + if (FLAGS_timestamp_in_logfile_name) { + unlink(filename); // Erase the half-baked evidence: an unusable log file, only if we just created it. + } + return false; + } +#ifdef GLOG_OS_WINDOWS + // https://github.com/golang/go/issues/27638 - make sure we seek to the end to append + // empirically replicated with wine over mingw build + if (!FLAGS_timestamp_in_logfile_name) { + if (fseek(file_, 0, SEEK_END) != 0) { + return false; + } + } +#endif + // We try to create a symlink called ., + // which is easier to use. (Every time we create a new logfile, + // we destroy the old symlink and create a new one, so it always + // points to the latest logfile.) If it fails, we're sad but it's + // no error. + if (!symlink_basename_.empty()) { + // take directory from filename + const char* slash = strrchr(filename, PATH_SEPARATOR); + const string linkname = + symlink_basename_ + '.' + LogSeverityNames[severity_]; + string linkpath; + if ( slash ) linkpath = string(filename, static_cast(slash-filename+1)); // get dirname + linkpath += linkname; + unlink(linkpath.c_str()); // delete old one if it exists + +#if defined(GLOG_OS_WINDOWS) + // TODO(hamaji): Create lnk file on Windows? +#elif defined(HAVE_UNISTD_H) + // We must have unistd.h. + // Make the symlink be relative (in the same dir) so that if the + // entire log directory gets relocated the link is still valid. + const char *linkdest = slash ? (slash + 1) : filename; + if (symlink(linkdest, linkpath.c_str()) != 0) { + // silently ignore failures + } + + // Make an additional link to the log file in a place specified by + // FLAGS_log_link, if indicated + if (!FLAGS_log_link.empty()) { + linkpath = FLAGS_log_link + "/" + linkname; + unlink(linkpath.c_str()); // delete old one if it exists + if (symlink(filename, linkpath.c_str()) != 0) { + // silently ignore failures + } + } +#endif + } + + return true; // Everything worked +} + +void LogFileObject::Write(bool force_flush, + time_t timestamp, + const char* message, + size_t message_len) { + MutexLock l(&lock_); + + // We don't log if the base_name_ is "" (which means "don't write") + if (base_filename_selected_ && base_filename_.empty()) { + return; + } + + if (file_length_ >> 20U >= MaxLogSize() || PidHasChanged()) { + if (file_ != nullptr) fclose(file_); + file_ = nullptr; + file_length_ = bytes_since_flush_ = dropped_mem_length_ = 0; + rollover_attempt_ = kRolloverAttemptFrequency - 1; + } + + // If there's no destination file, make one before outputting + if (file_ == nullptr) { + // Try to rollover the log file every 32 log messages. The only time + // this could matter would be when we have trouble creating the log + // file. If that happens, we'll lose lots of log messages, of course! + if (++rollover_attempt_ != kRolloverAttemptFrequency) return; + rollover_attempt_ = 0; + + struct ::tm tm_time; + if (FLAGS_log_utc_time) { + gmtime_r(×tamp, &tm_time); + } else { + localtime_r(×tamp, &tm_time); + } + + // The logfile's filename will have the date/time & pid in it + ostringstream time_pid_stream; + time_pid_stream.fill('0'); + time_pid_stream << 1900+tm_time.tm_year + << setw(2) << 1+tm_time.tm_mon + << setw(2) << tm_time.tm_mday + << '-' + << setw(2) << tm_time.tm_hour + << setw(2) << tm_time.tm_min + << setw(2) << tm_time.tm_sec + << '.' + << GetMainThreadPid(); + const string& time_pid_string = time_pid_stream.str(); + + if (base_filename_selected_) { + if (!CreateLogfile(time_pid_string)) { + perror("Could not create log file"); + fprintf(stderr, "COULD NOT CREATE LOGFILE '%s'!\n", + time_pid_string.c_str()); + return; + } + } else { + // If no base filename for logs of this severity has been set, use a + // default base filename of + // "...log..". So + // logfiles will have names like + // webserver.examplehost.root.log.INFO.19990817-150000.4354, where + // 19990817 is a date (1999 August 17), 150000 is a time (15:00:00), + // and 4354 is the pid of the logging process. The date & time reflect + // when the file was created for output. + // + // Where does the file get put? Successively try the directories + // "/tmp", and "." + string stripped_filename( + glog_internal_namespace_::ProgramInvocationShortName()); + string hostname; + GetHostName(&hostname); + + string uidname = MyUserName(); + // We should not call CHECK() here because this function can be + // called after holding on to log_mutex. We don't want to + // attempt to hold on to the same mutex, and get into a + // deadlock. Simply use a name like invalid-user. + if (uidname.empty()) uidname = "invalid-user"; + + stripped_filename = stripped_filename+'.'+hostname+'.' + +uidname+".log." + +LogSeverityNames[severity_]+'.'; + // We're going to (potentially) try to put logs in several different dirs + const vector & log_dirs = GetLoggingDirectories(); + + // Go through the list of dirs, and try to create the log file in each + // until we succeed or run out of options + bool success = false; + for (const auto& log_dir : log_dirs) { + base_filename_ = log_dir + "/" + stripped_filename; + if ( CreateLogfile(time_pid_string) ) { + success = true; + break; + } + } + // If we never succeeded, we have to give up + if ( success == false ) { + perror("Could not create logging file"); + fprintf(stderr, "COULD NOT CREATE A LOGGINGFILE %s!", + time_pid_string.c_str()); + return; + } + } + + // Write a header message into the log file + if (FLAGS_log_file_header) { + ostringstream file_header_stream; + file_header_stream.fill('0'); + file_header_stream << "Log file created at: " + << 1900+tm_time.tm_year << '/' + << setw(2) << 1+tm_time.tm_mon << '/' + << setw(2) << tm_time.tm_mday + << ' ' + << setw(2) << tm_time.tm_hour << ':' + << setw(2) << tm_time.tm_min << ':' + << setw(2) << tm_time.tm_sec << (FLAGS_log_utc_time ? " UTC\n" : "\n") + << "Running on machine: " + << LogDestination::hostname() << '\n'; + + if(!g_application_fingerprint.empty()) { + file_header_stream << "Application fingerprint: " << g_application_fingerprint << '\n'; + } + const char* const date_time_format = FLAGS_log_year_in_prefix + ? "yyyymmdd hh:mm:ss.uuuuuu" + : "mmdd hh:mm:ss.uuuuuu"; + file_header_stream << "Running duration (h:mm:ss): " + << PrettyDuration(static_cast(WallTime_Now() - start_time_)) << '\n' + << "Log line format: [IWEF]" << date_time_format << " " + << "threadid file:line] msg" << '\n'; + const string& file_header_string = file_header_stream.str(); + + const size_t header_len = file_header_string.size(); + fwrite(file_header_string.data(), 1, header_len, file_); + file_length_ += header_len; + bytes_since_flush_ += header_len; + } + } + + // Write to LOG file + if ( !stop_writing ) { + // fwrite() doesn't return an error when the disk is full, for + // messages that are less than 4096 bytes. When the disk is full, + // it returns the message length for messages that are less than + // 4096 bytes. fwrite() returns 4096 for message lengths that are + // greater than 4096, thereby indicating an error. + errno = 0; + fwrite(message, 1, message_len, file_); + if ( FLAGS_stop_logging_if_full_disk && + errno == ENOSPC ) { // disk full, stop writing to disk + stop_writing = true; // until the disk is + return; + } else { + file_length_ += message_len; + bytes_since_flush_ += message_len; + } + } else { + if (CycleClock_Now() >= next_flush_time_) { + stop_writing = false; // check to see if disk has free space. + } + return; // no need to flush + } + + // See important msgs *now*. Also, flush logs at least every 10^6 chars, + // or every "FLAGS_logbufsecs" seconds. + if ( force_flush || + (bytes_since_flush_ >= 1000000) || + (CycleClock_Now() >= next_flush_time_) ) { + FlushUnlocked(); +#ifdef GLOG_OS_LINUX + // Only consider files >= 3MiB + if (FLAGS_drop_log_memory && file_length_ >= (3U << 20U)) { + // Don't evict the most recent 1-2MiB so as not to impact a tailer + // of the log file and to avoid page rounding issue on linux < 4.7 + uint32 total_drop_length = + (file_length_ & ~((1U << 20U) - 1U)) - (1U << 20U); + uint32 this_drop_length = total_drop_length - dropped_mem_length_; + if (this_drop_length >= (2U << 20U)) { + // Only advise when >= 2MiB to drop +# if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21) + // 'posix_fadvise' introduced in API 21: + // * https://android.googlesource.com/platform/bionic/+/6880f936173081297be0dc12f687d341b86a4cfa/libc/libc.map.txt#732 +# else + posix_fadvise(fileno(file_), static_cast(dropped_mem_length_), + static_cast(this_drop_length), + POSIX_FADV_DONTNEED); +# endif + dropped_mem_length_ = total_drop_length; + } + } +#endif + + // Remove old logs + if (log_cleaner.enabled()) { + log_cleaner.Run(base_filename_selected_, + base_filename_, + filename_extension_); + } + } +} + +LogCleaner::LogCleaner() = default; + +void LogCleaner::Enable(unsigned int overdue_days) { + enabled_ = true; + overdue_days_ = overdue_days; +} + +void LogCleaner::Disable() { + enabled_ = false; +} + +void LogCleaner::UpdateCleanUpTime() { + const int64 next = (FLAGS_logcleansecs + * 1000000); // in usec + next_cleanup_time_ = CycleClock_Now() + UsecToCycles(next); +} + +void LogCleaner::Run(bool base_filename_selected, + const string& base_filename, + const string& filename_extension) { + assert(enabled_); + assert(!base_filename_selected || !base_filename.empty()); + + // avoid scanning logs too frequently + if (CycleClock_Now() < next_cleanup_time_) { + return; + } + UpdateCleanUpTime(); + + vector dirs; + + if (!base_filename_selected) { + dirs = GetLoggingDirectories(); + } else { + size_t pos = base_filename.find_last_of(possible_dir_delim, string::npos, + sizeof(possible_dir_delim)); + if (pos != string::npos) { + string dir = base_filename.substr(0, pos + 1); + dirs.push_back(dir); + } else { + dirs.emplace_back("."); + } + } + + for (auto& dir : dirs) { + vector logs = GetOverdueLogNames(dir, overdue_days_, base_filename, + filename_extension); + for (auto& log : logs) { + static_cast(unlink(log.c_str())); + } + } +} + +vector LogCleaner::GetOverdueLogNames( + string log_directory, unsigned int days, const string& base_filename, + const string& filename_extension) const { + // The names of overdue logs. + vector overdue_log_names; + + // Try to get all files within log_directory. + DIR *dir; + struct dirent *ent; + + if ((dir = opendir(log_directory.c_str()))) { + while ((ent = readdir(dir))) { + if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { + continue; + } + + string filepath = ent->d_name; + const char* const dir_delim_end = + possible_dir_delim + sizeof(possible_dir_delim); + + if (!log_directory.empty() && + std::find(possible_dir_delim, dir_delim_end, + log_directory[log_directory.size() - 1]) != dir_delim_end) { + filepath = log_directory + filepath; + } + + if (IsLogFromCurrentProject(filepath, base_filename, filename_extension) && + IsLogLastModifiedOver(filepath, days)) { + overdue_log_names.push_back(filepath); + } + } + closedir(dir); + } + + return overdue_log_names; +} + +bool LogCleaner::IsLogFromCurrentProject(const string& filepath, + const string& base_filename, + const string& filename_extension) const { + // We should remove duplicated delimiters from `base_filename`, e.g., + // before: "/tmp//.." + // after: "/tmp/.." + string cleaned_base_filename; + + const char* const dir_delim_end = + possible_dir_delim + sizeof(possible_dir_delim); + + size_t real_filepath_size = filepath.size(); + for (char c : base_filename) { + if (cleaned_base_filename.empty()) { + cleaned_base_filename += c; + } else if (std::find(possible_dir_delim, dir_delim_end, c) == + dir_delim_end || + (!cleaned_base_filename.empty() && + c != cleaned_base_filename[cleaned_base_filename.size() - 1])) { + cleaned_base_filename += c; + } + } + + // Return early if the filename doesn't start with `cleaned_base_filename`. + if (filepath.find(cleaned_base_filename) != 0) { + return false; + } + + // Check if in the string `filename_extension` is right next to + // `cleaned_base_filename` in `filepath` if the user + // has set a custom filename extension. + if (!filename_extension.empty()) { + if (cleaned_base_filename.size() >= real_filepath_size) { + return false; + } + // for origin version, `filename_extension` is middle of the `filepath`. + string ext = filepath.substr(cleaned_base_filename.size(), filename_extension.size()); + if (ext == filename_extension) { + cleaned_base_filename += filename_extension; + } + else { + // for new version, `filename_extension` is right of the `filepath`. + if (filename_extension.size() >= real_filepath_size) { + return false; + } + real_filepath_size = filepath.size() - filename_extension.size(); + if (filepath.substr(real_filepath_size) != filename_extension) { + return false; + } + } + } + + // The characters after `cleaned_base_filename` should match the format: + // YYYYMMDD-HHMMSS.pid + for (size_t i = cleaned_base_filename.size(); i < real_filepath_size; i++) { + const char& c = filepath[i]; + + if (i <= cleaned_base_filename.size() + 7) { // 0 ~ 7 : YYYYMMDD + if (c < '0' || c > '9') { return false; } + + } else if (i == cleaned_base_filename.size() + 8) { // 8: - + if (c != '-') { return false; } + + } else if (i <= cleaned_base_filename.size() + 14) { // 9 ~ 14: HHMMSS + if (c < '0' || c > '9') { return false; } + + } else if (i == cleaned_base_filename.size() + 15) { // 15: . + if (c != '.') { return false; } + + } else if (i >= cleaned_base_filename.size() + 16) { // 16+: pid + if (c < '0' || c > '9') { return false; } + } + } + + return true; +} + +bool LogCleaner::IsLogLastModifiedOver(const string& filepath, + unsigned int days) const { + // Try to get the last modified time of this file. + struct stat file_stat; + + if (stat(filepath.c_str(), &file_stat) == 0) { + const time_t seconds_in_a_day = 60 * 60 * 24; + time_t last_modified_time = file_stat.st_mtime; + time_t current_time = time(nullptr); + return difftime(current_time, last_modified_time) > days * seconds_in_a_day; + } + + // If failed to get file stat, don't return true! + return false; +} + +} // namespace + +// Static log data space to avoid alloc failures in a LOG(FATAL) +// +// Since multiple threads may call LOG(FATAL), and we want to preserve +// the data from the first call, we allocate two sets of space. One +// for exclusive use by the first thread, and one for shared use by +// all other threads. +static Mutex fatal_msg_lock; +static CrashReason crash_reason; +static bool fatal_msg_exclusive = true; +static LogMessage::LogMessageData fatal_msg_data_exclusive; +static LogMessage::LogMessageData fatal_msg_data_shared; + +#ifdef GLOG_THREAD_LOCAL_STORAGE +// Static thread-local log data space to use, because typically at most one +// LogMessageData object exists (in this case glog makes zero heap memory +// allocations). +static thread_local bool thread_data_available = true; + +static thread_local std::aligned_storage< + sizeof(LogMessage::LogMessageData), + alignof(LogMessage::LogMessageData)>::type thread_msg_data; +#endif // defined(GLOG_THREAD_LOCAL_STORAGE) + +LogMessage::LogMessageData::LogMessageData() + : stream_(message_text_, LogMessage::kMaxLogMessageLen, 0) { +} + +LogMessage::LogMessage(const char* file, int line, LogSeverity severity, + int64 ctr, void (LogMessage::*send_method)()) + : allocated_(nullptr) { + Init(file, line, severity, send_method); + data_->stream_.set_ctr(ctr); +} + +LogMessage::LogMessage(const char* file, int line, const CheckOpString& result) + : allocated_(nullptr) { + Init(file, line, GLOG_FATAL, &LogMessage::SendToLog); + stream() << "Check failed: " << (*result.str_) << " "; +} + +LogMessage::LogMessage(const char* file, int line) : allocated_(nullptr) { + Init(file, line, GLOG_INFO, &LogMessage::SendToLog); +} + +LogMessage::LogMessage(const char* file, int line, LogSeverity severity) + : allocated_(nullptr) { + Init(file, line, severity, &LogMessage::SendToLog); +} + +LogMessage::LogMessage(const char* file, int line, LogSeverity severity, + LogSink* sink, bool also_send_to_log) + : allocated_(nullptr) { + Init(file, line, severity, also_send_to_log ? &LogMessage::SendToSinkAndLog : + &LogMessage::SendToSink); + data_->sink_ = sink; // override Init()'s setting to nullptr +} + +LogMessage::LogMessage(const char* file, int line, LogSeverity severity, + vector* outvec) + : allocated_(nullptr) { + Init(file, line, severity, &LogMessage::SaveOrSendToLog); + data_->outvec_ = outvec; // override Init()'s setting to nullptr +} + +LogMessage::LogMessage(const char* file, int line, LogSeverity severity, + string* message) + : allocated_(nullptr) { + Init(file, line, severity, &LogMessage::WriteToStringAndLog); + data_->message_ = message; // override Init()'s setting to nullptr +} + +void LogMessage::Init(const char* file, + int line, + LogSeverity severity, + void (LogMessage::*send_method)()) { + allocated_ = nullptr; + if (severity != GLOG_FATAL || !exit_on_dfatal) { +#ifdef GLOG_THREAD_LOCAL_STORAGE + // No need for locking, because this is thread local. + if (thread_data_available) { + thread_data_available = false; + data_ = new (&thread_msg_data) LogMessageData; + } else { + allocated_ = new LogMessageData(); + data_ = allocated_; + } +#else // !defined(GLOG_THREAD_LOCAL_STORAGE) + allocated_ = new LogMessageData(); + data_ = allocated_; +#endif // defined(GLOG_THREAD_LOCAL_STORAGE) + data_->first_fatal_ = false; + } else { + MutexLock l(&fatal_msg_lock); + if (fatal_msg_exclusive) { + fatal_msg_exclusive = false; + data_ = &fatal_msg_data_exclusive; + data_->first_fatal_ = true; + } else { + data_ = &fatal_msg_data_shared; + data_->first_fatal_ = false; + } + } + + data_->preserved_errno_ = errno; + data_->severity_ = severity; + data_->line_ = line; + data_->send_method_ = send_method; + data_->sink_ = nullptr; + data_->outvec_ = nullptr; + WallTime now = WallTime_Now(); + auto timestamp_now = static_cast(now); + logmsgtime_ = LogMessageTime(timestamp_now, now); + + data_->num_chars_to_log_ = 0; + data_->num_chars_to_syslog_ = 0; + data_->basename_ = const_basename(file); + data_->fullname_ = file; + data_->has_been_flushed_ = false; + + // If specified, prepend a prefix to each line. For example: + // I20201018 160715 f5d4fbb0 logging.cc:1153] + // (log level, GMT year, month, date, time, thread_id, file basename, line) + // We exclude the thread_id for the default thread. + if (FLAGS_log_prefix && (line != kNoLogPrefix)) { + std::ios saved_fmt(nullptr); + saved_fmt.copyfmt(stream()); + stream().fill('0'); + if (custom_prefix_callback == nullptr) { + stream() << LogSeverityNames[severity][0]; + if (FLAGS_log_year_in_prefix) { + stream() << setw(4) << 1900 + logmsgtime_.year(); + } + stream() << setw(2) << 1 + logmsgtime_.month() << setw(2) + << logmsgtime_.day() << ' ' << setw(2) << logmsgtime_.hour() + << ':' << setw(2) << logmsgtime_.min() << ':' << setw(2) + << logmsgtime_.sec() << "." << setw(6) << logmsgtime_.usec() + << ' ' << setfill(' ') << setw(5) + << static_cast(GetTID()) << setfill('0') << ' ' + << data_->basename_ << ':' << data_->line_ << "] "; + } else { + custom_prefix_callback( + stream(), + LogMessageInfo(LogSeverityNames[severity], data_->basename_, + data_->line_, GetTID(), logmsgtime_), + custom_prefix_callback_data); + stream() << " "; + } + stream().copyfmt(saved_fmt); + } + data_->num_prefix_chars_ = data_->stream_.pcount(); + + if (!FLAGS_log_backtrace_at.empty()) { + char fileline[128]; + snprintf(fileline, sizeof(fileline), "%s:%d", data_->basename_, line); +#ifdef HAVE_STACKTRACE + if (FLAGS_log_backtrace_at == fileline) { + string stacktrace; + DumpStackTraceToString(&stacktrace); + stream() << " (stacktrace:\n" << stacktrace << ") "; + } +#endif + } +} + +const LogMessageTime& LogMessage::getLogMessageTime() const { + return logmsgtime_; +} + +LogMessage::~LogMessage() { + Flush(); +#ifdef GLOG_THREAD_LOCAL_STORAGE + if (data_ == static_cast(&thread_msg_data)) { + data_->~LogMessageData(); + thread_data_available = true; + } + else { + delete allocated_; + } +#else // !defined(GLOG_THREAD_LOCAL_STORAGE) + delete allocated_; +#endif // defined(GLOG_THREAD_LOCAL_STORAGE) +} + +int LogMessage::preserved_errno() const { + return data_->preserved_errno_; +} + +ostream& LogMessage::stream() { + return data_->stream_; +} + +// Flush buffered message, called by the destructor, or any other function +// that needs to synchronize the log. +void LogMessage::Flush() { + if (data_->has_been_flushed_ || data_->severity_ < FLAGS_minloglevel) { + return; + } + + data_->num_chars_to_log_ = data_->stream_.pcount(); + data_->num_chars_to_syslog_ = + data_->num_chars_to_log_ - data_->num_prefix_chars_; + + // Do we need to add a \n to the end of this message? + bool append_newline = + (data_->message_text_[data_->num_chars_to_log_-1] != '\n'); + char original_final_char = '\0'; + + // If we do need to add a \n, we'll do it by violating the memory of the + // ostrstream buffer. This is quick, and we'll make sure to undo our + // modification before anything else is done with the ostrstream. It + // would be preferable not to do things this way, but it seems to be + // the best way to deal with this. + if (append_newline) { + original_final_char = data_->message_text_[data_->num_chars_to_log_]; + data_->message_text_[data_->num_chars_to_log_++] = '\n'; + } + data_->message_text_[data_->num_chars_to_log_] = '\0'; + + // Prevent any subtle race conditions by wrapping a mutex lock around + // the actual logging action per se. + { + MutexLock l(&log_mutex); + (this->*(data_->send_method_))(); + ++num_messages_[static_cast(data_->severity_)]; + } + LogDestination::WaitForSinks(data_); + + if (append_newline) { + // Fix the ostrstream back how it was before we screwed with it. + // It's 99.44% certain that we don't need to worry about doing this. + data_->message_text_[data_->num_chars_to_log_-1] = original_final_char; + } + + // If errno was already set before we enter the logging call, we'll + // set it back to that value when we return from the logging call. + // It happens often that we log an error message after a syscall + // failure, which can potentially set the errno to some other + // values. We would like to preserve the original errno. + if (data_->preserved_errno_ != 0) { + errno = data_->preserved_errno_; + } + + // Note that this message is now safely logged. If we're asked to flush + // again, as a result of destruction, say, we'll do nothing on future calls. + data_->has_been_flushed_ = true; +} + +// Copy of first FATAL log message so that we can print it out again +// after all the stack traces. To preserve legacy behavior, we don't +// use fatal_msg_data_exclusive. +static time_t fatal_time; +static char fatal_message[256]; + +void ReprintFatalMessage() { + if (fatal_message[0]) { + const size_t n = strlen(fatal_message); + if (!FLAGS_logtostderr) { + // Also write to stderr (don't color to avoid terminal checks) + WriteToStderr(fatal_message, n); + } + LogDestination::LogToAllLogfiles(GLOG_ERROR, fatal_time, fatal_message, n); + } +} + +// L >= log_mutex (callers must hold the log_mutex). +void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { + static bool already_warned_before_initgoogle = false; + + log_mutex.AssertHeld(); + + RAW_DCHECK(data_->num_chars_to_log_ > 0 && + data_->message_text_[data_->num_chars_to_log_-1] == '\n', ""); + + // Messages of a given severity get logged to lower severity logs, too + + if (!already_warned_before_initgoogle && !IsGoogleLoggingInitialized()) { + const char w[] = "WARNING: Logging before InitGoogleLogging() is " + "written to STDERR\n"; + WriteToStderr(w, strlen(w)); + already_warned_before_initgoogle = true; + } + + // global flag: never log to file if set. Also -- don't log to a + // file if we haven't parsed the command line flags to get the + // program name. + if (FLAGS_logtostderr || FLAGS_logtostdout || !IsGoogleLoggingInitialized()) { + if (FLAGS_logtostdout) { + ColoredWriteToStdout(data_->severity_, data_->message_text_, + data_->num_chars_to_log_); + } else { + ColoredWriteToStderr(data_->severity_, data_->message_text_, + data_->num_chars_to_log_); + } + + // this could be protected by a flag if necessary. + LogDestination::LogToSinks(data_->severity_, + data_->fullname_, data_->basename_, + data_->line_, logmsgtime_, + data_->message_text_ + data_->num_prefix_chars_, + (data_->num_chars_to_log_ - + data_->num_prefix_chars_ - 1) ); + } else { + // log this message to all log files of severity <= severity_ + LogDestination::LogToAllLogfiles(data_->severity_, logmsgtime_.timestamp(), + data_->message_text_, + data_->num_chars_to_log_); + + LogDestination::MaybeLogToStderr(data_->severity_, data_->message_text_, + data_->num_chars_to_log_, + data_->num_prefix_chars_); + LogDestination::MaybeLogToEmail(data_->severity_, data_->message_text_, + data_->num_chars_to_log_); + LogDestination::LogToSinks(data_->severity_, + data_->fullname_, data_->basename_, + data_->line_, logmsgtime_, + data_->message_text_ + data_->num_prefix_chars_, + (data_->num_chars_to_log_ + - data_->num_prefix_chars_ - 1) ); + // NOTE: -1 removes trailing \n + } + + // If we log a FATAL message, flush all the log destinations, then toss + // a signal for others to catch. We leave the logs in a state that + // someone else can use them (as long as they flush afterwards) + if (data_->severity_ == GLOG_FATAL && exit_on_dfatal) { + if (data_->first_fatal_) { + // Store crash information so that it is accessible from within signal + // handlers that may be invoked later. + RecordCrashReason(&crash_reason); + SetCrashReason(&crash_reason); + + // Store shortened fatal message for other logs and GWQ status + const size_t copy = min(data_->num_chars_to_log_, + sizeof(fatal_message)-1); + memcpy(fatal_message, data_->message_text_, copy); + fatal_message[copy] = '\0'; + fatal_time = logmsgtime_.timestamp(); + } + + if (!FLAGS_logtostderr && !FLAGS_logtostdout) { + for (auto& log_destination : LogDestination::log_destinations_) { + if (log_destination) { + log_destination->logger_->Write(true, 0, "", 0); + } + } + } + + // release the lock that our caller (directly or indirectly) + // LogMessage::~LogMessage() grabbed so that signal handlers + // can use the logging facility. Alternately, we could add + // an entire unsafe logging interface to bypass locking + // for signal handlers but this seems simpler. + log_mutex.Unlock(); + LogDestination::WaitForSinks(data_); + + const char* message = "*** Check failure stack trace: ***\n"; + if (write(STDERR_FILENO, message, strlen(message)) < 0) { + // Ignore errors. + } +#if defined(__ANDROID__) + // ANDROID_LOG_FATAL as this message is of FATAL severity. + __android_log_write(ANDROID_LOG_FATAL, + glog_internal_namespace_::ProgramInvocationShortName(), + message); +#endif + Fail(); + } +} + +void LogMessage::RecordCrashReason( + glog_internal_namespace_::CrashReason* reason) { + reason->filename = fatal_msg_data_exclusive.fullname_; + reason->line_number = fatal_msg_data_exclusive.line_; + reason->message = fatal_msg_data_exclusive.message_text_ + + fatal_msg_data_exclusive.num_prefix_chars_; +#ifdef HAVE_STACKTRACE + // Retrieve the stack trace, omitting the logging frames that got us here. + reason->depth = GetStackTrace(reason->stack, ARRAYSIZE(reason->stack), 4); +#else + reason->depth = 0; +#endif +} + +GLOG_EXPORT logging_fail_func_t g_logging_fail_func = + reinterpret_cast(&abort); + +void InstallFailureFunction(logging_fail_func_t fail_func) { + g_logging_fail_func = fail_func; +} + +void LogMessage::Fail() { + g_logging_fail_func(); +} + +// L >= log_mutex (callers must hold the log_mutex). +void LogMessage::SendToSink() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { + if (data_->sink_ != nullptr) { + RAW_DCHECK(data_->num_chars_to_log_ > 0 && + data_->message_text_[data_->num_chars_to_log_-1] == '\n', ""); + data_->sink_->send(data_->severity_, data_->fullname_, data_->basename_, + data_->line_, logmsgtime_, + data_->message_text_ + data_->num_prefix_chars_, + (data_->num_chars_to_log_ - + data_->num_prefix_chars_ - 1) ); + } +} + +// L >= log_mutex (callers must hold the log_mutex). +void LogMessage::SendToSinkAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { + SendToSink(); + SendToLog(); +} + +// L >= log_mutex (callers must hold the log_mutex). +void LogMessage::SaveOrSendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { + if (data_->outvec_ != nullptr) { + RAW_DCHECK(data_->num_chars_to_log_ > 0 && + data_->message_text_[data_->num_chars_to_log_-1] == '\n', ""); + // Omit prefix of message and trailing newline when recording in outvec_. + const char *start = data_->message_text_ + data_->num_prefix_chars_; + size_t len = data_->num_chars_to_log_ - data_->num_prefix_chars_ - 1; + data_->outvec_->push_back(string(start, len)); + } else { + SendToLog(); + } +} + +void LogMessage::WriteToStringAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { + if (data_->message_ != nullptr) { + RAW_DCHECK(data_->num_chars_to_log_ > 0 && + data_->message_text_[data_->num_chars_to_log_-1] == '\n', ""); + // Omit prefix of message and trailing newline when writing to message_. + const char *start = data_->message_text_ + data_->num_prefix_chars_; + size_t len = data_->num_chars_to_log_ - data_->num_prefix_chars_ - 1; + data_->message_->assign(start, len); + } + SendToLog(); +} + +// L >= log_mutex (callers must hold the log_mutex). +void LogMessage::SendToSyslogAndLog() { +#ifdef HAVE_SYSLOG_H + // Before any calls to syslog(), make a single call to openlog() + static bool openlog_already_called = false; + if (!openlog_already_called) { + openlog(glog_internal_namespace_::ProgramInvocationShortName(), + LOG_CONS | LOG_NDELAY | LOG_PID, + LOG_USER); + openlog_already_called = true; + } + + // This array maps Google severity levels to syslog levels + const int SEVERITY_TO_LEVEL[] = { LOG_INFO, LOG_WARNING, LOG_ERR, LOG_EMERG }; + syslog(LOG_USER | SEVERITY_TO_LEVEL[static_cast(data_->severity_)], + "%.*s", static_cast(data_->num_chars_to_syslog_), + data_->message_text_ + data_->num_prefix_chars_); + SendToLog(); +#else + LOG(ERROR) << "No syslog support: message=" << data_->message_text_; +#endif +} + +base::Logger* base::GetLogger(LogSeverity severity) { + MutexLock l(&log_mutex); + return LogDestination::log_destination(severity)->GetLoggerImpl(); +} + +void base::SetLogger(LogSeverity severity, base::Logger* logger) { + MutexLock l(&log_mutex); + LogDestination::log_destination(severity)->SetLoggerImpl(logger); +} + +// L < log_mutex. Acquires and releases mutex_. +int64 LogMessage::num_messages(int severity) { + MutexLock l(&log_mutex); + return num_messages_[severity]; +} + +// Output the COUNTER value. This is only valid if ostream is a +// LogStream. +ostream& operator<<(ostream &os, const PRIVATE_Counter&) { +#ifdef DISABLE_RTTI + LogMessage::LogStream *log = static_cast(&os); +#else + auto* log = dynamic_cast(&os); +#endif + CHECK(log && log == log->self()) + << "You must not use COUNTER with non-glog ostream"; + os << log->ctr(); + return os; +} + +ErrnoLogMessage::ErrnoLogMessage(const char* file, int line, + LogSeverity severity, int64 ctr, + void (LogMessage::*send_method)()) + : LogMessage(file, line, severity, ctr, send_method) {} + +ErrnoLogMessage::~ErrnoLogMessage() { + // Don't access errno directly because it may have been altered + // while streaming the message. + stream() << ": " << StrError(preserved_errno()) << " [" + << preserved_errno() << "]"; +} + +void FlushLogFiles(LogSeverity min_severity) { + LogDestination::FlushLogFiles(min_severity); +} + +void FlushLogFilesUnsafe(LogSeverity min_severity) { + LogDestination::FlushLogFilesUnsafe(min_severity); +} + +void SetLogDestination(LogSeverity severity, const char* base_filename) { + LogDestination::SetLogDestination(severity, base_filename); +} + +void SetLogSymlink(LogSeverity severity, const char* symlink_basename) { + LogDestination::SetLogSymlink(severity, symlink_basename); +} + +LogSink::~LogSink() = default; + +void LogSink::send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, + const LogMessageTime& time, const char* message, + size_t message_len) { +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#elif defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable : 4996) +#endif // __GNUC__ + send(severity, full_filename, base_filename, line, &time.tm(), message, + message_len); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#elif defined(_MSC_VER) +#pragma warning(pop) +#endif // __GNUC__ +} + +void LogSink::send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, const std::tm* t, + const char* message, size_t message_len) { + (void)severity; + (void)full_filename; + (void)base_filename; + (void)line; + (void)t; + (void)message; + (void)message_len; +} + +void LogSink::WaitTillSent() { + // noop default +} + +string LogSink::ToString(LogSeverity severity, const char* file, int line, + const LogMessageTime& logmsgtime, const char* message, + size_t message_len) { + ostringstream stream; + stream.fill('0'); + + stream << LogSeverityNames[severity][0]; + if (FLAGS_log_year_in_prefix) { + stream << setw(4) << 1900 + logmsgtime.year(); + } + stream << setw(2) << 1 + logmsgtime.month() + << setw(2) << logmsgtime.day() + << ' ' + << setw(2) << logmsgtime.hour() << ':' + << setw(2) << logmsgtime.min() << ':' + << setw(2) << logmsgtime.sec() << '.' + << setw(6) << logmsgtime.usec() + << ' ' + << setfill(' ') << setw(5) << GetTID() << setfill('0') + << ' ' + << file << ':' << line << "] "; + + // A call to `write' is enclosed in parenthneses to prevent possible macro + // expansion. On Windows, `write' could be a macro defined for portability. + (stream.write)(message, static_cast(message_len)); + return stream.str(); +} + +void AddLogSink(LogSink *destination) { + LogDestination::AddLogSink(destination); +} + +void RemoveLogSink(LogSink *destination) { + LogDestination::RemoveLogSink(destination); +} + +void SetLogFilenameExtension(const char* ext) { + LogDestination::SetLogFilenameExtension(ext); +} + +void SetStderrLogging(LogSeverity min_severity) { + LogDestination::SetStderrLogging(min_severity); +} + +void SetEmailLogging(LogSeverity min_severity, const char* addresses) { + LogDestination::SetEmailLogging(min_severity, addresses); +} + +void LogToStderr() { + LogDestination::LogToStderr(); +} + +namespace base { +namespace internal { + +bool GetExitOnDFatal(); +bool GetExitOnDFatal() { + MutexLock l(&log_mutex); + return exit_on_dfatal; +} + +// Determines whether we exit the program for a LOG(DFATAL) message in +// debug mode. It does this by skipping the call to Fail/FailQuietly. +// This is intended for testing only. +// +// This can have some effects on LOG(FATAL) as well. Failure messages +// are always allocated (rather than sharing a buffer), the crash +// reason is not recorded, the "gwq" status message is not updated, +// and the stack trace is not recorded. The LOG(FATAL) *will* still +// exit the program. Since this function is used only in testing, +// these differences are acceptable. +void SetExitOnDFatal(bool value); +void SetExitOnDFatal(bool value) { + MutexLock l(&log_mutex); + exit_on_dfatal = value; +} + +} // namespace internal +} // namespace base + +#ifndef GLOG_OS_EMSCRIPTEN +// Shell-escaping as we need to shell out ot /bin/mail. +static const char kDontNeedShellEscapeChars[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+-_.=/:,@"; + +static string ShellEscape(const string& src) { + string result; + if (!src.empty() && // empty string needs quotes + src.find_first_not_of(kDontNeedShellEscapeChars) == string::npos) { + // only contains chars that don't need quotes; it's fine + result.assign(src); + } else if (src.find_first_of('\'') == string::npos) { + // no single quotes; just wrap it in single quotes + result.assign("'"); + result.append(src); + result.append("'"); + } else { + // needs double quote escaping + result.assign("\""); + for (size_t i = 0; i < src.size(); ++i) { + switch (src[i]) { + case '\\': + case '$': + case '"': + case '`': + result.append("\\"); + } + result.append(src, i, 1); + } + result.append("\""); + } + return result; +} +#endif + +// use_logging controls whether the logging functions LOG/VLOG are used +// to log errors. It should be set to false when the caller holds the +// log_mutex. +static bool SendEmailInternal(const char*dest, const char *subject, + const char*body, bool use_logging) { +#ifndef GLOG_OS_EMSCRIPTEN + if (dest && *dest) { + if ( use_logging ) { + VLOG(1) << "Trying to send TITLE:" << subject + << " BODY:" << body << " to " << dest; + } else { + fprintf(stderr, "Trying to send TITLE: %s BODY: %s to %s\n", + subject, body, dest); + } + + string logmailer = FLAGS_logmailer; + if (logmailer.empty()) { + logmailer = "/bin/mail"; + } + string cmd = + logmailer + " -s" + + ShellEscape(subject) + " " + ShellEscape(dest); + if (use_logging) { + VLOG(4) << "Mailing command: " << cmd; + } + + FILE* pipe = popen(cmd.c_str(), "w"); + if (pipe != nullptr) { + // Add the body if we have one + if (body) { + fwrite(body, sizeof(char), strlen(body), pipe); + } + bool ok = pclose(pipe) != -1; + if ( !ok ) { + if ( use_logging ) { + LOG(ERROR) << "Problems sending mail to " << dest << ": " + << StrError(errno); + } else { + fprintf(stderr, "Problems sending mail to %s: %s\n", + dest, StrError(errno).c_str()); + } + } + return ok; + } else { + if ( use_logging ) { + LOG(ERROR) << "Unable to send mail to " << dest; + } else { + fprintf(stderr, "Unable to send mail to %s\n", dest); + } + } + } +#else + (void)dest; + (void)subject; + (void)body; + (void)use_logging; + LOG(WARNING) << "Email support not available; not sending message"; +#endif + return false; +} + +bool SendEmail(const char*dest, const char *subject, const char*body){ + return SendEmailInternal(dest, subject, body, true); +} + +static void GetTempDirectories(vector* list) { + list->clear(); +#ifdef GLOG_OS_WINDOWS + // On windows we'll try to find a directory in this order: + // C:/Documents & Settings/whomever/TEMP (or whatever GetTempPath() is) + // C:/TMP/ + // C:/TEMP/ + // C:/WINDOWS/ or C:/WINNT/ + // . + char tmp[MAX_PATH]; + if (GetTempPathA(MAX_PATH, tmp)) + list->push_back(tmp); + list->push_back("C:\\tmp\\"); + list->push_back("C:\\temp\\"); +#else + // Directories, in order of preference. If we find a dir that + // exists, we stop adding other less-preferred dirs + const char * candidates[] = { + // Non-null only during unittest/regtest + getenv("TEST_TMPDIR"), + + // Explicitly-supplied temp dirs + getenv("TMPDIR"), getenv("TMP"), + + // If all else fails + "/tmp", + }; + + for (auto d : candidates) { + if (!d) continue; // Empty env var + + // Make sure we don't surprise anyone who's expecting a '/' + string dstr = d; + if (dstr[dstr.size() - 1] != '/') { + dstr += "/"; + } + list->push_back(dstr); + + struct stat statbuf; + if (!stat(d, &statbuf) && S_ISDIR(statbuf.st_mode)) { + // We found a dir that exists - we're done. + return; + } + } + +#endif +} + +static vector* logging_directories_list; + +const vector& GetLoggingDirectories() { + // Not strictly thread-safe but we're called early in InitGoogle(). + if (logging_directories_list == nullptr) { + logging_directories_list = new vector; + + if ( !FLAGS_log_dir.empty() ) { + // A dir was specified, we should use it + logging_directories_list->push_back(FLAGS_log_dir); + } else { + GetTempDirectories(logging_directories_list); +#ifdef GLOG_OS_WINDOWS + char tmp[MAX_PATH]; + if (GetWindowsDirectoryA(tmp, MAX_PATH)) + logging_directories_list->push_back(tmp); + logging_directories_list->push_back(".\\"); +#else + logging_directories_list->push_back("./"); +#endif + } + } + return *logging_directories_list; +} + +void TestOnly_ClearLoggingDirectoriesList() { + fprintf(stderr, "TestOnly_ClearLoggingDirectoriesList should only be " + "called from test code.\n"); + delete logging_directories_list; + logging_directories_list = nullptr; +} + +void GetExistingTempDirectories(vector* list) { + GetTempDirectories(list); + auto i_dir = list->begin(); + while( i_dir != list->end() ) { + // zero arg to access means test for existence; no constant + // defined on windows + if ( access(i_dir->c_str(), 0) ) { + i_dir = list->erase(i_dir); + } else { + ++i_dir; + } + } +} + +void TruncateLogFile(const char *path, uint64 limit, uint64 keep) { +#ifdef HAVE_UNISTD_H + struct stat statbuf; + const int kCopyBlockSize = 8 << 10; + char copybuf[kCopyBlockSize]; + off_t read_offset, write_offset; + // Don't follow symlinks unless they're our own fd symlinks in /proc + int flags = O_RDWR; + // TODO(hamaji): Support other environments. +#ifdef GLOG_OS_LINUX + const char *procfd_prefix = "/proc/self/fd/"; + if (strncmp(procfd_prefix, path, strlen(procfd_prefix))) flags |= O_NOFOLLOW; +#endif + + int fd = open(path, flags); + if (fd == -1) { + if (errno == EFBIG) { + // The log file in question has got too big for us to open. The + // real fix for this would be to compile logging.cc (or probably + // all of base/...) with -D_FILE_OFFSET_BITS=64 but that's + // rather scary. + // Instead just truncate the file to something we can manage + if (truncate(path, 0) == -1) { + PLOG(ERROR) << "Unable to truncate " << path; + } else { + LOG(ERROR) << "Truncated " << path << " due to EFBIG error"; + } + } else { + PLOG(ERROR) << "Unable to open " << path; + } + return; + } + + if (fstat(fd, &statbuf) == -1) { + PLOG(ERROR) << "Unable to fstat()"; + goto out_close_fd; + } + + // See if the path refers to a regular file bigger than the + // specified limit + if (!S_ISREG(statbuf.st_mode)) goto out_close_fd; + if (statbuf.st_size <= static_cast(limit)) goto out_close_fd; + if (statbuf.st_size <= static_cast(keep)) goto out_close_fd; + + // This log file is too large - we need to truncate it + LOG(INFO) << "Truncating " << path << " to " << keep << " bytes"; + + // Copy the last "keep" bytes of the file to the beginning of the file + read_offset = statbuf.st_size - static_cast(keep); + write_offset = 0; + ssize_t bytesin, bytesout; + while ((bytesin = pread(fd, copybuf, sizeof(copybuf), read_offset)) > 0) { + bytesout = pwrite(fd, copybuf, static_cast(bytesin), write_offset); + if (bytesout == -1) { + PLOG(ERROR) << "Unable to write to " << path; + break; + } else if (bytesout != bytesin) { + LOG(ERROR) << "Expected to write " << bytesin << ", wrote " << bytesout; + } + read_offset += bytesin; + write_offset += bytesout; + } + if (bytesin == -1) PLOG(ERROR) << "Unable to read from " << path; + + // Truncate the remainder of the file. If someone else writes to the + // end of the file after our last read() above, we lose their latest + // data. Too bad ... + if (ftruncate(fd, write_offset) == -1) { + PLOG(ERROR) << "Unable to truncate " << path; + } + + out_close_fd: + close(fd); +#else + LOG(ERROR) << "No log truncation support."; +#endif + } + +void TruncateStdoutStderr() { +#ifdef HAVE_UNISTD_H + uint64 limit = MaxLogSize() << 20U; + uint64 keep = 1U << 20U; + TruncateLogFile("/proc/self/fd/1", limit, keep); + TruncateLogFile("/proc/self/fd/2", limit, keep); +#else + LOG(ERROR) << "No log truncation support."; +#endif +} + + +// Helper functions for string comparisons. +#define DEFINE_CHECK_STROP_IMPL(name, func, expected) \ + string* Check##func##expected##Impl(const char* s1, const char* s2, \ + const char* names) { \ + bool equal = s1 == s2 || (s1 && s2 && !func(s1, s2)); \ + if (equal == expected) \ + return nullptr; \ + else { \ + ostringstream ss; \ + if (!s1) s1 = ""; \ + if (!s2) s2 = ""; \ + ss << #name " failed: " << names << " (" << s1 << " vs. " << s2 << ")"; \ + return new string(ss.str()); \ + } \ + } +DEFINE_CHECK_STROP_IMPL(CHECK_STREQ, strcmp, true) +DEFINE_CHECK_STROP_IMPL(CHECK_STRNE, strcmp, false) +DEFINE_CHECK_STROP_IMPL(CHECK_STRCASEEQ, strcasecmp, true) +DEFINE_CHECK_STROP_IMPL(CHECK_STRCASENE, strcasecmp, false) +#undef DEFINE_CHECK_STROP_IMPL + +int posix_strerror_r(int err, char *buf, size_t len) { + // Sanity check input parameters + if (buf == nullptr || len <= 0) { + errno = EINVAL; + return -1; + } + + // Reset buf and errno, and try calling whatever version of strerror_r() + // is implemented by glibc + buf[0] = '\000'; + int old_errno = errno; + errno = 0; + char *rc = reinterpret_cast(strerror_r(err, buf, len)); + + // Both versions set errno on failure + if (errno) { + // Should already be there, but better safe than sorry + buf[0] = '\000'; + return -1; + } + errno = old_errno; + + // POSIX is vague about whether the string will be terminated, although + // is indirectly implies that typically ERANGE will be returned, instead + // of truncating the string. This is different from the GNU implementation. + // We play it safe by always terminating the string explicitly. + buf[len-1] = '\000'; + + // If the function succeeded, we can use its exit code to determine the + // semantics implemented by glibc + if (!rc) { + return 0; + } else { + // GNU semantics detected + if (rc == buf) { + return 0; + } else { + buf[0] = '\000'; +#if defined(GLOG_OS_MACOSX) || defined(GLOG_OS_FREEBSD) || defined(GLOG_OS_OPENBSD) + if (reinterpret_cast(rc) < sys_nerr) { + // This means an error on MacOSX or FreeBSD. + return -1; + } +#endif + strncat(buf, rc, len-1); + return 0; + } + } +} + +string StrError(int err) { + char buf[100]; + int rc = posix_strerror_r(err, buf, sizeof(buf)); + if ((rc < 0) || (buf[0] == '\000')) { + snprintf(buf, sizeof(buf), "Error number %d", err); + } + return buf; +} + +LogMessageFatal::LogMessageFatal(const char* file, int line) : + LogMessage(file, line, GLOG_FATAL) {} + +LogMessageFatal::LogMessageFatal(const char* file, int line, + const CheckOpString& result) : + LogMessage(file, line, result) {} + +LogMessageFatal::~LogMessageFatal() { + Flush(); + LogMessage::Fail(); +} + +namespace base { + +CheckOpMessageBuilder::CheckOpMessageBuilder(const char *exprtext) + : stream_(new ostringstream) { + *stream_ << exprtext << " ("; +} + +CheckOpMessageBuilder::~CheckOpMessageBuilder() { + delete stream_; +} + +ostream* CheckOpMessageBuilder::ForVar2() { + *stream_ << " vs. "; + return stream_; +} + +string* CheckOpMessageBuilder::NewString() { + *stream_ << ")"; + return new string(stream_->str()); +} + +} // namespace base + +template <> +void MakeCheckOpValueString(std::ostream* os, const char& v) { + if (v >= 32 && v <= 126) { + (*os) << "'" << v << "'"; + } else { + (*os) << "char value " << static_cast(v); + } +} + +template <> +void MakeCheckOpValueString(std::ostream* os, const signed char& v) { + if (v >= 32 && v <= 126) { + (*os) << "'" << v << "'"; + } else { + (*os) << "signed char value " << static_cast(v); + } +} + +template <> +void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) { + if (v >= 32 && v <= 126) { + (*os) << "'" << v << "'"; + } else { + (*os) << "unsigned char value " << static_cast(v); + } +} + +template <> +void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& /*v*/) { + (*os) << "nullptr"; +} + +void InitGoogleLogging(const char* argv0) { + glog_internal_namespace_::InitGoogleLoggingUtilities(argv0); +} + +void InitGoogleLogging(const char* argv0, + CustomPrefixCallback prefix_callback, + void* prefix_callback_data) { + custom_prefix_callback = prefix_callback; + custom_prefix_callback_data = prefix_callback_data; + InitGoogleLogging(argv0); +} + +void ShutdownGoogleLogging() { + glog_internal_namespace_::ShutdownGoogleLoggingUtilities(); + LogDestination::DeleteLogDestinations(); + delete logging_directories_list; + logging_directories_list = nullptr; +} + +void EnableLogCleaner(unsigned int overdue_days) { + log_cleaner.Enable(overdue_days); +} + +void DisableLogCleaner() { + log_cleaner.Disable(); +} + +LogMessageTime::LogMessageTime() + : time_struct_(), timestamp_(0), usecs_(0), gmtoffset_(0) {} + +LogMessageTime::LogMessageTime(std::tm t) { + std::time_t timestamp = std::mktime(&t); + init(t, timestamp, 0); +} + +LogMessageTime::LogMessageTime(std::time_t timestamp, WallTime now) { + std::tm t; + if (FLAGS_log_utc_time) { + gmtime_r(×tamp, &t); + } else { + localtime_r(×tamp, &t); + } + init(t, timestamp, now); +} + +void LogMessageTime::init(const std::tm& t, std::time_t timestamp, + WallTime now) { + time_struct_ = t; + timestamp_ = timestamp; + usecs_ = static_cast((now - timestamp) * 1000000); + + CalcGmtOffset(); +} + +void LogMessageTime::CalcGmtOffset() { + std::tm gmt_struct; + int isDst = 0; + if ( FLAGS_log_utc_time ) { + localtime_r(×tamp_, &gmt_struct); + isDst = gmt_struct.tm_isdst; + gmt_struct = time_struct_; + } else { + isDst = time_struct_.tm_isdst; + gmtime_r(×tamp_, &gmt_struct); + } + + time_t gmt_sec = mktime(&gmt_struct); + const long hour_secs = 3600; + // If the Daylight Saving Time(isDst) is active subtract an hour from the current timestamp. + gmtoffset_ = static_cast(timestamp_ - gmt_sec + (isDst ? hour_secs : 0) ) ; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/mock-log.h b/runtime/onnxruntime/third_party/glog/src/mock-log.h new file mode 100644 index 0000000..62999b2 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/mock-log.h @@ -0,0 +1,155 @@ +// Copyright (c) 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Zhanyong Wan +// +// Defines the ScopedMockLog class (using Google C++ Mocking +// Framework), which is convenient for testing code that uses LOG(). + +#ifndef GLOG_SRC_MOCK_LOG_H_ +#define GLOG_SRC_MOCK_LOG_H_ + +// For GOOGLE_NAMESPACE. This must go first so we get _XOPEN_SOURCE. +#include "utilities.h" + +#include + +#include + +#include + +_START_GOOGLE_NAMESPACE_ +namespace glog_testing { + +// A ScopedMockLog object intercepts LOG() messages issued during its +// lifespan. Using this together with Google C++ Mocking Framework, +// it's very easy to test how a piece of code calls LOG(). The +// typical usage: +// +// TEST(FooTest, LogsCorrectly) { +// ScopedMockLog log; +// +// // We expect the WARNING "Something bad!" exactly twice. +// EXPECT_CALL(log, Log(WARNING, _, "Something bad!")) +// .Times(2); +// +// // We allow foo.cc to call LOG(INFO) any number of times. +// EXPECT_CALL(log, Log(INFO, HasSubstr("/foo.cc"), _)) +// .Times(AnyNumber()); +// +// Foo(); // Exercises the code under test. +// } +class ScopedMockLog : public GOOGLE_NAMESPACE::LogSink { + public: + // When a ScopedMockLog object is constructed, it starts to + // intercept logs. + ScopedMockLog() { AddLogSink(this); } + + // When the object is destructed, it stops intercepting logs. + ~ScopedMockLog() override { RemoveLogSink(this); } + + // Implements the mock method: + // + // void Log(LogSeverity severity, const string& file_path, + // const string& message); + // + // The second argument to Send() is the full path of the source file + // in which the LOG() was issued. + // + // Note, that in a multi-threaded environment, all LOG() messages from a + // single thread will be handled in sequence, but that cannot be guaranteed + // for messages from different threads. In fact, if the same or multiple + // expectations are matched on two threads concurrently, their actions will + // be executed concurrently as well and may interleave. + MOCK_METHOD3(Log, void(GOOGLE_NAMESPACE::LogSeverity severity, + const std::string& file_path, + const std::string& message)); + + private: + // Implements the send() virtual function in class LogSink. + // Whenever a LOG() statement is executed, this function will be + // invoked with information presented in the LOG(). + // + // The method argument list is long and carries much information a + // test usually doesn't care about, so we trim the list before + // forwarding the call to Log(), which is much easier to use in + // tests. + // + // We still cannot call Log() directly, as it may invoke other LOG() + // messages, either due to Invoke, or due to an error logged in + // Google C++ Mocking Framework code, which would trigger a deadlock + // since a lock is held during send(). + // + // Hence, we save the message for WaitTillSent() which will be called after + // the lock on send() is released, and we'll call Log() inside + // WaitTillSent(). Since while a single send() call may be running at a + // time, multiple WaitTillSent() calls (along with the one send() call) may + // be running simultaneously, we ensure thread-safety of the exchange between + // send() and WaitTillSent(), and that for each message, LOG(), send(), + // WaitTillSent() and Log() are executed in the same thread. + void send(GOOGLE_NAMESPACE::LogSeverity severity, const char* full_filename, + const char* /*base_filename*/, int /*line*/, + const LogMessageTime& /*logmsgtime*/, const char* message, + size_t message_len) override { + // We are only interested in the log severity, full file name, and + // log message. + message_info_.severity = severity; + message_info_.file_path = full_filename; + message_info_.message = std::string(message, message_len); + } + + // Implements the WaitTillSent() virtual function in class LogSink. + // It will be executed after send() and after the global logging lock is + // released, so calls within it (or rather within the Log() method called + // within) may also issue LOG() statements. + // + // LOG(), send(), WaitTillSent() and Log() will occur in the same thread for + // a given log message. + void WaitTillSent() override { + // First, and very importantly, we save a copy of the message being + // processed before calling Log(), since Log() may indirectly call send() + // and WaitTillSent() in the same thread again. + MessageInfo message_info = message_info_; + Log(message_info.severity, message_info.file_path, message_info.message); + } + + // All relevant information about a logged message that needs to be passed + // from send() to WaitTillSent(). + struct MessageInfo { + GOOGLE_NAMESPACE::LogSeverity severity; + std::string file_path; + std::string message; + }; + MessageInfo message_info_; +}; + +} // namespace glog_testing +_END_GOOGLE_NAMESPACE_ + +#endif // GLOG_SRC_MOCK_LOG_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/raw_logging.cc b/runtime/onnxruntime/third_party/glog/src/raw_logging.cc new file mode 100644 index 0000000..9e6cf17 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/raw_logging.cc @@ -0,0 +1,179 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Maxim Lifantsev +// +// logging_unittest.cc covers the functionality herein + +#include +#include +#include + +#include "utilities.h" +#ifdef HAVE_UNISTD_H +# include // for close() and write() +#endif +#include // for open() +#include +#include "config.h" +#include // To pick up flag settings etc. +#include +#include "base/commandlineflags.h" + +#ifdef HAVE_STACKTRACE +# include "stacktrace.h" +#endif + +#if defined(HAVE_SYSCALL_H) +#include // for syscall() +#elif defined(HAVE_SYS_SYSCALL_H) +#include // for syscall() +#endif +#ifdef HAVE_UNISTD_H +# include +#endif + +#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && \ + (!(defined(GLOG_OS_MACOSX))) && !defined(GLOG_OS_EMSCRIPTEN) +#define safe_write(fd, s, len) syscall(SYS_write, fd, s, len) +#else +// Not so safe, but what can you do? +#define safe_write(fd, s, len) write(fd, s, len) +#endif + +_START_GOOGLE_NAMESPACE_ + +#if defined(__GNUC__) +#define GLOG_ATTRIBUTE_FORMAT(archetype, stringIndex, firstToCheck) \ + __attribute__((format(archetype, stringIndex, firstToCheck))) +#define GLOG_ATTRIBUTE_FORMAT_ARG(stringIndex) \ + __attribute__((format_arg(stringIndex))) +#else +#define GLOG_ATTRIBUTE_FORMAT(archetype, stringIndex, firstToCheck) +#define GLOG_ATTRIBUTE_FORMAT_ARG(stringIndex) +#endif + +// CAVEAT: vsnprintf called from *DoRawLog below has some (exotic) code paths +// that invoke malloc() and getenv() that might acquire some locks. +// If this becomes a problem we should reimplement a subset of vsnprintf +// that does not need locks and malloc. + +// Helper for RawLog__ below. +// *DoRawLog writes to *buf of *size and move them past the written portion. +// It returns true iff there was no overflow or error. +GLOG_ATTRIBUTE_FORMAT(printf, 3, 4) +static bool DoRawLog(char** buf, size_t* size, const char* format, ...) { + va_list ap; + va_start(ap, format); + int n = vsnprintf(*buf, *size, format, ap); + va_end(ap); + if (n < 0 || static_cast(n) > *size) return false; + *size -= static_cast(n); + *buf += n; + return true; +} + +// Helper for RawLog__ below. +inline static bool VADoRawLog(char** buf, size_t* size, + const char* format, va_list ap) { +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif + int n = vsnprintf(*buf, *size, format, ap); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + if (n < 0 || static_cast(n) > *size) return false; + *size -= static_cast(n); + *buf += n; + return true; +} + +static const int kLogBufSize = 3000; +static bool crashed = false; +static CrashReason crash_reason; +static char crash_buf[kLogBufSize + 1] = { 0 }; // Will end in '\0' + +GLOG_ATTRIBUTE_FORMAT(printf, 4, 5) +void RawLog__(LogSeverity severity, const char* file, int line, + const char* format, ...) { + if (!(FLAGS_logtostdout || FLAGS_logtostderr || + severity >= FLAGS_stderrthreshold || FLAGS_alsologtostderr || + !IsGoogleLoggingInitialized())) { + return; // this stderr log message is suppressed + } + // can't call localtime_r here: it can allocate + char buffer[kLogBufSize]; + char* buf = buffer; + size_t size = sizeof(buffer); + + // NOTE: this format should match the specification in base/logging.h + DoRawLog(&buf, &size, "%c00000000 00:00:00.000000 %5u %s:%d] RAW: ", + LogSeverityNames[severity][0], + static_cast(GetTID()), + const_basename(const_cast(file)), line); + + // Record the position and size of the buffer after the prefix + const char* msg_start = buf; + const size_t msg_size = size; + + va_list ap; + va_start(ap, format); + bool no_chop = VADoRawLog(&buf, &size, format, ap); + va_end(ap); + if (no_chop) { + DoRawLog(&buf, &size, "\n"); + } else { + DoRawLog(&buf, &size, "RAW_LOG ERROR: The Message was too long!\n"); + } + // We make a raw syscall to write directly to the stderr file descriptor, + // avoiding FILE buffering (to avoid invoking malloc()), and bypassing + // libc (to side-step any libc interception). + // We write just once to avoid races with other invocations of RawLog__. + safe_write(STDERR_FILENO, buffer, strlen(buffer)); + if (severity == GLOG_FATAL) { + if (!sync_val_compare_and_swap(&crashed, false, true)) { + crash_reason.filename = file; + crash_reason.line_number = line; + memcpy(crash_buf, msg_start, msg_size); // Don't include prefix + crash_reason.message = crash_buf; +#ifdef HAVE_STACKTRACE + crash_reason.depth = + GetStackTrace(crash_reason.stack, ARRAYSIZE(crash_reason.stack), 1); +#else + crash_reason.depth = 0; +#endif + SetCrashReason(&crash_reason); + } + LogMessage::Fail(); // abort() + } +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/signalhandler.cc b/runtime/onnxruntime/third_party/glog/src/signalhandler.cc new file mode 100644 index 0000000..657e15c --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/signalhandler.cc @@ -0,0 +1,412 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Satoru Takabayashi +// +// Implementation of InstallFailureSignalHandler(). + +#include "utilities.h" +#include "stacktrace.h" +#include "symbolize.h" +#include + +#include +#include +#ifdef HAVE_UCONTEXT_H +# include +#endif +#ifdef HAVE_SYS_UCONTEXT_H +# include +#endif +#include + +_START_GOOGLE_NAMESPACE_ + +namespace { + +// We'll install the failure signal handler for these signals. We could +// use strsignal() to get signal names, but we don't use it to avoid +// introducing yet another #ifdef complication. +// +// The list should be synced with the comment in signalhandler.h. +const struct { + int number; + const char *name; +} kFailureSignals[] = { + { SIGSEGV, "SIGSEGV" }, + { SIGILL, "SIGILL" }, + { SIGFPE, "SIGFPE" }, + { SIGABRT, "SIGABRT" }, +#if !defined(GLOG_OS_WINDOWS) + { SIGBUS, "SIGBUS" }, +#endif + { SIGTERM, "SIGTERM" }, +}; + +static bool kFailureSignalHandlerInstalled = false; + +#if !defined(GLOG_OS_WINDOWS) +// Returns the program counter from signal context, nullptr if unknown. +void* GetPC(void* ucontext_in_void) { +#if (defined(HAVE_UCONTEXT_H) || defined(HAVE_SYS_UCONTEXT_H)) && defined(PC_FROM_UCONTEXT) + if (ucontext_in_void != nullptr) { + ucontext_t *context = reinterpret_cast(ucontext_in_void); + return (void*)context->PC_FROM_UCONTEXT; + } +#else + (void)ucontext_in_void; +#endif + return nullptr; +} +#endif + +// The class is used for formatting error messages. We don't use printf() +// as it's not async signal safe. +class MinimalFormatter { + public: + MinimalFormatter(char *buffer, size_t size) + : buffer_(buffer), + cursor_(buffer), + end_(buffer + size) { + } + + // Returns the number of bytes written in the buffer. + std::size_t num_bytes_written() const { return static_cast(cursor_ - buffer_); } + + // Appends string from "str" and updates the internal cursor. + void AppendString(const char* str) { + ptrdiff_t i = 0; + while (str[i] != '\0' && cursor_ + i < end_) { + cursor_[i] = str[i]; + ++i; + } + cursor_ += i; + } + + // Formats "number" in "radix" and updates the internal cursor. + // Lowercase letters are used for 'a' - 'z'. + void AppendUint64(uint64 number, unsigned radix) { + unsigned i = 0; + while (cursor_ + i < end_) { + const uint64 tmp = number % radix; + number /= radix; + cursor_[i] = static_cast(tmp < 10 ? '0' + tmp : 'a' + tmp - 10); + ++i; + if (number == 0) { + break; + } + } + // Reverse the bytes written. + std::reverse(cursor_, cursor_ + i); + cursor_ += i; + } + + // Formats "number" as hexadecimal number, and updates the internal + // cursor. Padding will be added in front if needed. + void AppendHexWithPadding(uint64 number, int width) { + char* start = cursor_; + AppendString("0x"); + AppendUint64(number, 16); + // Move to right and add padding in front if needed. + if (cursor_ < start + width) { + const int64 delta = start + width - cursor_; + std::copy(start, cursor_, start + delta); + std::fill(start, start + delta, ' '); + cursor_ = start + width; + } + } + + private: + char *buffer_; + char *cursor_; + const char * const end_; +}; + +// Writes the given data with the size to the standard error. +void WriteToStderr(const char* data, size_t size) { + if (write(STDERR_FILENO, data, size) < 0) { + // Ignore errors. + } +} + +// The writer function can be changed by InstallFailureWriter(). +void (*g_failure_writer)(const char* data, size_t size) = WriteToStderr; + +// Dumps time information. We don't dump human-readable time information +// as localtime() is not guaranteed to be async signal safe. +void DumpTimeInfo() { + time_t time_in_sec = time(nullptr); + char buf[256]; // Big enough for time info. + MinimalFormatter formatter(buf, sizeof(buf)); + formatter.AppendString("*** Aborted at "); + formatter.AppendUint64(static_cast(time_in_sec), 10); + formatter.AppendString(" (unix time)"); + formatter.AppendString(" try \"date -d @"); + formatter.AppendUint64(static_cast(time_in_sec), 10); + formatter.AppendString("\" if you are using GNU date ***\n"); + g_failure_writer(buf, formatter.num_bytes_written()); +} + +// TODO(hamaji): Use signal instead of sigaction? +#if defined(HAVE_STACKTRACE) && defined(HAVE_SIGACTION) + +// Dumps information about the signal to STDERR. +void DumpSignalInfo(int signal_number, siginfo_t *siginfo) { + // Get the signal name. + const char* signal_name = nullptr; + for (auto kFailureSignal : kFailureSignals) { + if (signal_number == kFailureSignal.number) { + signal_name = kFailureSignal.name; + } + } + + char buf[256]; // Big enough for signal info. + MinimalFormatter formatter(buf, sizeof(buf)); + + formatter.AppendString("*** "); + if (signal_name) { + formatter.AppendString(signal_name); + } else { + // Use the signal number if the name is unknown. The signal name + // should be known, but just in case. + formatter.AppendString("Signal "); + formatter.AppendUint64(static_cast(signal_number), 10); + } + formatter.AppendString(" (@0x"); + formatter.AppendUint64(reinterpret_cast(siginfo->si_addr), 16); + formatter.AppendString(")"); + formatter.AppendString(" received by PID "); + formatter.AppendUint64(static_cast(getpid()), 10); + formatter.AppendString(" (TID 0x"); + // We assume pthread_t is an integral number or a pointer, rather + // than a complex struct. In some environments, pthread_self() + // returns an uint64 but in some other environments pthread_self() + // returns a pointer. + pthread_t id = pthread_self(); + formatter.AppendUint64( + reinterpret_cast(reinterpret_cast(id)), 16); + formatter.AppendString(") "); + // Only linux has the PID of the signal sender in si_pid. +#ifdef GLOG_OS_LINUX + formatter.AppendString("from PID "); + formatter.AppendUint64(static_cast(siginfo->si_pid), 10); + formatter.AppendString("; "); +#endif + formatter.AppendString("stack trace: ***\n"); + g_failure_writer(buf, formatter.num_bytes_written()); +} + +#endif // HAVE_SIGACTION + +// Dumps information about the stack frame to STDERR. +void DumpStackFrameInfo(const char* prefix, void* pc) { + // Get the symbol name. + const char *symbol = "(unknown)"; + char symbolized[1024]; // Big enough for a sane symbol. + // Symbolizes the previous address of pc because pc may be in the + // next function. + if (Symbolize(reinterpret_cast(pc) - 1, + symbolized, sizeof(symbolized))) { + symbol = symbolized; + } + + char buf[1024]; // Big enough for stack frame info. + MinimalFormatter formatter(buf, sizeof(buf)); + + formatter.AppendString(prefix); + formatter.AppendString("@ "); + const int width = 2 * sizeof(void*) + 2; // + 2 for "0x". + formatter.AppendHexWithPadding(reinterpret_cast(pc), width); + formatter.AppendString(" "); + formatter.AppendString(symbol); + formatter.AppendString("\n"); + g_failure_writer(buf, formatter.num_bytes_written()); +} + +// Invoke the default signal handler. +void InvokeDefaultSignalHandler(int signal_number) { +#ifdef HAVE_SIGACTION + struct sigaction sig_action; + memset(&sig_action, 0, sizeof(sig_action)); + sigemptyset(&sig_action.sa_mask); + sig_action.sa_handler = SIG_DFL; + sigaction(signal_number, &sig_action, nullptr); + kill(getpid(), signal_number); +#elif defined(GLOG_OS_WINDOWS) + signal(signal_number, SIG_DFL); + raise(signal_number); +#endif +} + +// This variable is used for protecting FailureSignalHandler() from +// dumping stuff while another thread is doing it. Our policy is to let +// the first thread dump stuff and let other threads wait. +// See also comments in FailureSignalHandler(). +static pthread_t* g_entered_thread_id_pointer = nullptr; + +// Dumps signal and stack frame information, and invokes the default +// signal handler once our job is done. +#if defined(GLOG_OS_WINDOWS) +void FailureSignalHandler(int signal_number) +#else +void FailureSignalHandler(int signal_number, + siginfo_t *signal_info, + void *ucontext) +#endif +{ + // First check if we've already entered the function. We use an atomic + // compare and swap operation for platforms that support it. For other + // platforms, we use a naive method that could lead to a subtle race. + + // We assume pthread_self() is async signal safe, though it's not + // officially guaranteed. + pthread_t my_thread_id = pthread_self(); + // NOTE: We could simply use pthread_t rather than pthread_t* for this, + // if pthread_self() is guaranteed to return non-zero value for thread + // ids, but there is no such guarantee. We need to distinguish if the + // old value (value returned from __sync_val_compare_and_swap) is + // different from the original value (in this case nullptr). + pthread_t* old_thread_id_pointer = + glog_internal_namespace_::sync_val_compare_and_swap( + &g_entered_thread_id_pointer, static_cast(nullptr), + &my_thread_id); + if (old_thread_id_pointer != nullptr) { + // We've already entered the signal handler. What should we do? + if (pthread_equal(my_thread_id, *g_entered_thread_id_pointer)) { + // It looks the current thread is reentering the signal handler. + // Something must be going wrong (maybe we are reentering by another + // type of signal?). Kill ourself by the default signal handler. + InvokeDefaultSignalHandler(signal_number); + } + // Another thread is dumping stuff. Let's wait until that thread + // finishes the job and kills the process. + while (true) { + sleep(1); + } + } + // This is the first time we enter the signal handler. We are going to + // do some interesting stuff from here. + // TODO(satorux): We might want to set timeout here using alarm(), but + // mixing alarm() and sleep() can be a bad idea. + + // First dump time info. + DumpTimeInfo(); + +#if !defined(GLOG_OS_WINDOWS) + // Get the program counter from ucontext. + void *pc = GetPC(ucontext); + DumpStackFrameInfo("PC: ", pc); +#endif + +#ifdef HAVE_STACKTRACE + // Get the stack traces. + void *stack[32]; + // +1 to exclude this function. + const int depth = GetStackTrace(stack, ARRAYSIZE(stack), 1); +# ifdef HAVE_SIGACTION + DumpSignalInfo(signal_number, signal_info); +#elif !defined(GLOG_OS_WINDOWS) + (void)signal_info; +# endif + // Dump the stack traces. + for (int i = 0; i < depth; ++i) { + DumpStackFrameInfo(" ", stack[i]); + } +#elif !defined(GLOG_OS_WINDOWS) + (void)signal_info; +#endif + + // *** TRANSITION *** + // + // BEFORE this point, all code must be async-termination-safe! + // (See WARNING above.) + // + // AFTER this point, we do unsafe things, like using LOG()! + // The process could be terminated or hung at any time. We try to + // do more useful things first and riskier things later. + + // Flush the logs before we do anything in case 'anything' + // causes problems. + FlushLogFilesUnsafe(0); + + // Kill ourself by the default signal handler. + InvokeDefaultSignalHandler(signal_number); +} + +} // namespace + +namespace glog_internal_namespace_ { + +bool IsFailureSignalHandlerInstalled() { +#ifdef HAVE_SIGACTION + // TODO(andschwa): Return kFailureSignalHandlerInstalled? + struct sigaction sig_action; + memset(&sig_action, 0, sizeof(sig_action)); + sigemptyset(&sig_action.sa_mask); + sigaction(SIGABRT, nullptr, &sig_action); + if (sig_action.sa_sigaction == &FailureSignalHandler) { + return true; + } +#elif defined(GLOG_OS_WINDOWS) + return kFailureSignalHandlerInstalled; +#endif // HAVE_SIGACTION + return false; +} + +} // namespace glog_internal_namespace_ + +void InstallFailureSignalHandler() { +#ifdef HAVE_SIGACTION + // Build the sigaction struct. + struct sigaction sig_action; + memset(&sig_action, 0, sizeof(sig_action)); + sigemptyset(&sig_action.sa_mask); + sig_action.sa_flags |= SA_SIGINFO; + sig_action.sa_sigaction = &FailureSignalHandler; + + for (auto kFailureSignal : kFailureSignals) { + CHECK_ERR(sigaction(kFailureSignal.number, &sig_action, nullptr)); + } + kFailureSignalHandlerInstalled = true; +#elif defined(GLOG_OS_WINDOWS) + for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) { + CHECK_NE(signal(kFailureSignals[i].number, &FailureSignalHandler), + SIG_ERR); + } + kFailureSignalHandlerInstalled = true; +#endif // HAVE_SIGACTION +} + +void InstallFailureWriter(void (*writer)(const char* data, size_t size)) { +#if defined(HAVE_SIGACTION) || defined(GLOG_OS_WINDOWS) + g_failure_writer = writer; +#endif // HAVE_SIGACTION +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace.h b/runtime/onnxruntime/third_party/glog/src/stacktrace.h new file mode 100644 index 0000000..bf23e19 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace.h @@ -0,0 +1,61 @@ +// Copyright (c) 2000 - 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Routines to extract the current stack trace. These functions are +// thread-safe. + +#ifndef BASE_STACKTRACE_H_ +#define BASE_STACKTRACE_H_ + +#include "config.h" +#include + +_START_GOOGLE_NAMESPACE_ + +// This is similar to the GetStackFrames routine, except that it returns +// the stack trace only, and not the stack frame sizes as well. +// Example: +// main() { foo(); } +// foo() { bar(); } +// bar() { +// void* result[10]; +// int depth = GetStackFrames(result, 10, 1); +// } +// +// This produces: +// result[0] foo +// result[1] main +// .... ... +// +// "result" must not be nullptr. +GLOG_EXPORT int GetStackTrace(void** result, int max_depth, int skip_count); + +_END_GOOGLE_NAMESPACE_ + +#endif // BASE_STACKTRACE_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_generic-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_generic-inl.h new file mode 100644 index 0000000..0e473a9 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_generic-inl.h @@ -0,0 +1,64 @@ +// Copyright (c) 2000 - 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Portable implementation - just use glibc +// +// Note: The glibc implementation may cause a call to malloc. +// This can cause a deadlock in HeapProfiler. +#include + +#include + +#include "stacktrace.h" + +_START_GOOGLE_NAMESPACE_ + +// If you change this function, also change GetStackFrames below. +int GetStackTrace(void** result, int max_depth, int skip_count) { + static const int kStackLength = 64; + void * stack[kStackLength]; + int size; + + size = backtrace(stack, kStackLength); + skip_count++; // we want to skip the current frame as well + int result_count = size - skip_count; + if (result_count < 0) { + result_count = 0; + } + if (result_count > max_depth) { + result_count = max_depth; + } + for (int i = 0; i < result_count; i++) { + result[i] = stack[i + skip_count]; + } + + return result_count; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h new file mode 100644 index 0000000..0b20d23 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h @@ -0,0 +1,93 @@ +// Copyright (c) 2005 - 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Arun Sharma +// +// Produce stack trace using libunwind + +#include "utilities.h" + +extern "C" { +#define UNW_LOCAL_ONLY +#include +} +#include +#include "stacktrace.h" + +_START_GOOGLE_NAMESPACE_ + +// Sometimes, we can try to get a stack trace from within a stack +// trace, because libunwind can call mmap (maybe indirectly via an +// internal mmap based memory allocator), and that mmap gets trapped +// and causes a stack-trace request. If were to try to honor that +// recursive request, we'd end up with infinite recursion or deadlock. +// Luckily, it's safe to ignore those subsequent traces. In such +// cases, we return 0 to indicate the situation. +// We can use the GCC __thread syntax here since libunwind is not supported on +// Windows. +static __thread bool g_tl_entered; // Initialized to false. + +// If you change this function, also change GetStackFrames below. +int GetStackTrace(void** result, int max_depth, int skip_count) { + void *ip; + int n = 0; + unw_cursor_t cursor; + unw_context_t uc; + + if (g_tl_entered) { + return 0; + } + g_tl_entered = true; + + unw_getcontext(&uc); + RAW_CHECK(unw_init_local(&cursor, &uc) >= 0, "unw_init_local failed"); + skip_count++; // Do not include the "GetStackTrace" frame + + while (n < max_depth) { + int ret = + unw_get_reg(&cursor, UNW_REG_IP, reinterpret_cast(&ip)); + if (ret < 0) { + break; + } + if (skip_count > 0) { + skip_count--; + } else { + result[n++] = ip; + } + ret = unw_step(&cursor); + if (ret <= 0) { + break; + } + } + + g_tl_entered = false; + return n; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h new file mode 100644 index 0000000..30217db --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h @@ -0,0 +1,133 @@ +// Copyright (c) 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Craig Silverstein +// +// Produce stack trace. I'm guessing (hoping!) the code is much like +// for x86. For apple machines, at least, it seems to be; see +// http://developer.apple.com/documentation/mac/runtimehtml/RTArch-59.html +// http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK +// Linux has similar code: http://patchwork.ozlabs.org/linuxppc/patch?id=8882 + +#include // for uintptr_t +#include + +#include "stacktrace.h" + +_START_GOOGLE_NAMESPACE_ + +// Given a pointer to a stack frame, locate and return the calling +// stackframe, or return nullptr if no stackframe can be found. Perform sanity +// checks (the strictness of which is controlled by the boolean parameter +// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned. +template +static void **NextStackFrame(void **old_sp) { + void **new_sp = static_cast(*old_sp); + + // Check that the transition from frame pointer old_sp to frame + // pointer new_sp isn't clearly bogus + if (STRICT_UNWINDING) { + // With the stack growing downwards, older stack frame must be + // at a greater address that the current one. + if (new_sp <= old_sp) return nullptr; + // Assume stack frames larger than 100,000 bytes are bogus. + if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return nullptr; + } else { + // In the non-strict mode, allow discontiguous stack frames. + // (alternate-signal-stacks for example). + if (new_sp == old_sp) return nullptr; + // And allow frames upto about 1MB. + if ((new_sp > old_sp) && + ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000)) { + return nullptr; + } + } + if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return nullptr; + return new_sp; +} + +// This ensures that GetStackTrace stes up the Link Register properly. +void StacktracePowerPCDummyFunction() __attribute__((noinline)); +void StacktracePowerPCDummyFunction() { __asm__ volatile(""); } + +// If you change this function, also change GetStackFrames below. +int GetStackTrace(void** result, int max_depth, int skip_count) { + void **sp; + // Apple OS X uses an old version of gnu as -- both Darwin 7.9.0 (Panther) + // and Darwin 8.8.1 (Tiger) use as 1.38. This means we have to use a + // different asm syntax. I don't know quite the best way to discriminate + // systems using the old as from the new one; I've gone with __APPLE__. +#ifdef __APPLE__ + __asm__ volatile ("mr %0,r1" : "=r" (sp)); +#else + __asm__ volatile ("mr %0,1" : "=r" (sp)); +#endif + + // On PowerPC, the "Link Register" or "Link Record" (LR), is a stack + // entry that holds the return address of the subroutine call (what + // instruction we run after our function finishes). This is the + // same as the stack-pointer of our parent routine, which is what we + // want here. While the compiler will always(?) set up LR for + // subroutine calls, it may not for leaf functions (such as this one). + // This routine forces the compiler (at least gcc) to push it anyway. + StacktracePowerPCDummyFunction(); + + // The LR save area is used by the callee, so the top entry is bogus. + skip_count++; + + int n = 0; + while (sp && n < max_depth) { + if (skip_count > 0) { + skip_count--; + } else { + // PowerPC has 3 main ABIs, which say where in the stack the + // Link Register is. For DARWIN and AIX (used by apple and + // linux ppc64), it's in sp[2]. For SYSV (used by linux ppc), + // it's in sp[1]. +#if defined(_CALL_AIX) || defined(_CALL_DARWIN) + result[n++] = *(sp+2); +#elif defined(_CALL_SYSV) + result[n++] = *(sp+1); +#elif defined(__APPLE__) || ((defined(__linux) || defined(__linux__)) && defined(__PPC64__)) + // This check is in case the compiler doesn't define _CALL_AIX/etc. + result[n++] = *(sp+2); +#elif defined(__linux) || defined(__OpenBSD__) + // This check is in case the compiler doesn't define _CALL_SYSV. + result[n++] = *(sp+1); +#else +#error Need to specify the PPC ABI for your archiecture. +#endif + } + // Use strict unwinding rules. + sp = NextStackFrame(sp); + } + return n; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc b/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc new file mode 100644 index 0000000..6d3c21a --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc @@ -0,0 +1,245 @@ +// Copyright (c) 2004, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "utilities.h" + +#include +#include +#include "config.h" +#include "base/commandlineflags.h" +#include +#include "stacktrace.h" + +#ifdef HAVE_EXECINFO_BACKTRACE_SYMBOLS +# include +#endif + +using namespace GOOGLE_NAMESPACE; + +#ifdef HAVE_STACKTRACE + +// Obtain a backtrace, verify that the expected callers are present in the +// backtrace, and maybe print the backtrace to stdout. + +// The sequence of functions whose return addresses we expect to see in the +// backtrace. +const int BACKTRACE_STEPS = 6; + +struct AddressRange { + const void *start, *end; +}; + +// Expected function [start,end] range. +AddressRange expected_range[BACKTRACE_STEPS]; + +#if __GNUC__ +// Using GCC extension: address of a label can be taken with '&&label'. +// Start should be a label somewhere before recursive call, end somewhere +// after it. +#define INIT_ADDRESS_RANGE(fn, start_label, end_label, prange) \ + do { \ + (prange)->start = &&start_label; \ + (prange)->end = &&end_label; \ + CHECK_LT((prange)->start, (prange)->end); \ + } while (0) +// This macro expands into "unmovable" code (opaque to GCC), and that +// prevents GCC from moving a_label up or down in the code. +// Without it, there is no code following the 'end' label, and GCC +// (4.3.1, 4.4.0) thinks it safe to assign &&end an address that is before +// the recursive call. +#define DECLARE_ADDRESS_LABEL(a_label) \ + a_label: do { __asm__ __volatile__(""); } while (0) +// Gcc 4.4.0 may split function into multiple chunks, and the chunk +// performing recursive call may end up later in the code then the return +// instruction (this actually happens with FDO). +// Adjust function range from __builtin_return_address. +#define ADJUST_ADDRESS_RANGE_FROM_RA(prange) \ + do { \ + void *ra = __builtin_return_address(0); \ + CHECK_LT((prange)->start, ra); \ + if (ra > (prange)->end) { \ + printf("Adjusting range from %p..%p to %p..%p\n", \ + (prange)->start, (prange)->end, \ + (prange)->start, ra); \ + (prange)->end = ra; \ + } \ + } while (0) +#else +// Assume the Check* functions below are not longer than 256 bytes. +#define INIT_ADDRESS_RANGE(fn, start_label, end_label, prange) \ + do { \ + (prange)->start = reinterpret_cast(&fn); \ + (prange)->end = reinterpret_cast(&fn) + 256; \ + } while (0) +#define DECLARE_ADDRESS_LABEL(a_label) do { } while (0) +#define ADJUST_ADDRESS_RANGE_FROM_RA(prange) do { } while (0) +#endif // __GNUC__ + +//-----------------------------------------------------------------------// + +static void CheckRetAddrIsInFunction(void *ret_addr, const AddressRange &range) +{ + CHECK_GE(ret_addr, range.start); + CHECK_LE(ret_addr, range.end); +} + +//-----------------------------------------------------------------------// + +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-label-as-value" +#endif + +void ATTRIBUTE_NOINLINE CheckStackTrace(int); +static void ATTRIBUTE_NOINLINE CheckStackTraceLeaf() { + const int STACK_LEN = 10; + void *stack[STACK_LEN]; + int size; + + ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[1]); + INIT_ADDRESS_RANGE(CheckStackTraceLeaf, start, end, &expected_range[0]); + DECLARE_ADDRESS_LABEL(start); + size = GetStackTrace(stack, STACK_LEN, 0); + printf("Obtained %d stack frames.\n", size); + CHECK_GE(size, 1); + CHECK_LE(size, STACK_LEN); + + if (true) { +#ifdef HAVE_EXECINFO_BACKTRACE_SYMBOLS + char **strings = backtrace_symbols(stack, size); + printf("Obtained %d stack frames.\n", size); + for (int i = 0; i < size; i++) { + printf("%s %p\n", strings[i], stack[i]); + } + + union { + void (*p1)(int); + void* p2; + } p = {&CheckStackTrace}; + + printf("CheckStackTrace() addr: %p\n", p.p2); + free(strings); +#endif + } + for (int i = 0; i < BACKTRACE_STEPS; i++) { + printf("Backtrace %d: expected: %p..%p actual: %p ... ", + i, expected_range[i].start, expected_range[i].end, stack[i]); + fflush(stdout); + CheckRetAddrIsInFunction(stack[i], expected_range[i]); + printf("OK\n"); + } + DECLARE_ADDRESS_LABEL(end); +} + +//-----------------------------------------------------------------------// + +/* Dummy functions to make the backtrace more interesting. */ +static void ATTRIBUTE_NOINLINE CheckStackTrace4(int i) { + ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[2]); + INIT_ADDRESS_RANGE(CheckStackTrace4, start, end, &expected_range[1]); + DECLARE_ADDRESS_LABEL(start); + for (int j = i; j >= 0; j--) { + CheckStackTraceLeaf(); + } + DECLARE_ADDRESS_LABEL(end); +} +static void ATTRIBUTE_NOINLINE CheckStackTrace3(int i) { + ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[3]); + INIT_ADDRESS_RANGE(CheckStackTrace3, start, end, &expected_range[2]); + DECLARE_ADDRESS_LABEL(start); + for (int j = i; j >= 0; j--) { + CheckStackTrace4(j); + } + DECLARE_ADDRESS_LABEL(end); +} +static void ATTRIBUTE_NOINLINE CheckStackTrace2(int i) { + ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[4]); + INIT_ADDRESS_RANGE(CheckStackTrace2, start, end, &expected_range[3]); + DECLARE_ADDRESS_LABEL(start); + for (int j = i; j >= 0; j--) { + CheckStackTrace3(j); + } + DECLARE_ADDRESS_LABEL(end); +} +static void ATTRIBUTE_NOINLINE CheckStackTrace1(int i) { + ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[5]); + INIT_ADDRESS_RANGE(CheckStackTrace1, start, end, &expected_range[4]); + DECLARE_ADDRESS_LABEL(start); + for (int j = i; j >= 0; j--) { + CheckStackTrace2(j); + } + DECLARE_ADDRESS_LABEL(end); +} + +#ifndef __GNUC__ +// On non-GNU environment, we use the address of `CheckStackTrace` to +// guess the address range of this function. This guess is wrong for +// non-static function on Windows. This is probably because +// `&CheckStackTrace` returns the address of a trampoline like PLT, +// not the actual address of `CheckStackTrace`. +// See https://github.com/google/glog/issues/421 for the detail. +static +#endif +void ATTRIBUTE_NOINLINE CheckStackTrace(int i) { + INIT_ADDRESS_RANGE(CheckStackTrace, start, end, &expected_range[5]); + DECLARE_ADDRESS_LABEL(start); + for (int j = i; j >= 0; j--) { + CheckStackTrace1(j); + } + DECLARE_ADDRESS_LABEL(end); +} + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + +//-----------------------------------------------------------------------// + +int main(int, char ** argv) { + FLAGS_logtostderr = true; + InitGoogleLogging(argv[0]); + + CheckStackTrace(0); + + printf("PASS\n"); + return 0; +} + +#else +int main() { + +#ifdef GLOG_BAZEL_BUILD + printf("HAVE_STACKTRACE is expected to be defined in Bazel tests\n"); + exit(EXIT_FAILURE); +#endif // GLOG_BAZEL_BUILD + + printf("PASS (no stacktrace support)\n"); + return 0; +} +#endif // HAVE_STACKTRACE diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_unwind-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_unwind-inl.h new file mode 100644 index 0000000..3a4b4c5 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_unwind-inl.h @@ -0,0 +1,106 @@ +// Copyright (c) 2005 - 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Arun Sharma +// +// Produce stack trace using libgcc + +#include // ABI defined unwinder + +#include // for nullptr + +#include "stacktrace.h" + +_START_GOOGLE_NAMESPACE_ + +struct trace_arg_t { + void **result; + int max_depth; + int skip_count; + int count; +}; + +// Workaround for the malloc() in _Unwind_Backtrace() issue. +static _Unwind_Reason_Code nop_backtrace(struct _Unwind_Context */*uc*/, void */*opq*/) { + return _URC_NO_REASON; +} + + +// This code is not considered ready to run until +// static initializers run so that we are guaranteed +// that any malloc-related initialization is done. +static bool ready_to_run = false; +class StackTraceInit { + public: + StackTraceInit() { + // Extra call to force initialization + _Unwind_Backtrace(nop_backtrace, nullptr); + ready_to_run = true; + } +}; + +static StackTraceInit module_initializer; // Force initialization + +static _Unwind_Reason_Code GetOneFrame(struct _Unwind_Context *uc, void *opq) { + auto *targ = static_cast(opq); + + if (targ->skip_count > 0) { + targ->skip_count--; + } else { + targ->result[targ->count++] = reinterpret_cast(_Unwind_GetIP(uc)); + } + + if (targ->count == targ->max_depth) { + return _URC_END_OF_STACK; + } + + return _URC_NO_REASON; +} + +// If you change this function, also change GetStackFrames below. +int GetStackTrace(void** result, int max_depth, int skip_count) { + if (!ready_to_run) { + return 0; + } + + trace_arg_t targ; + + skip_count += 1; // Do not include the "GetStackTrace" frame + + targ.result = result; + targ.max_depth = max_depth; + targ.skip_count = skip_count; + targ.count = 0; + + _Unwind_Backtrace(GetOneFrame, &targ); + + return targ.count; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_windows-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_windows-inl.h new file mode 100644 index 0000000..9c27664 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_windows-inl.h @@ -0,0 +1,51 @@ +// Copyright (c) 2000 - 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Andrew Schwartzmeyer +// +// Windows implementation - just use CaptureStackBackTrace + +#include "config.h" +#include "port.h" +#include "stacktrace.h" +#include + +_START_GOOGLE_NAMESPACE_ + +int GetStackTrace(void** result, int max_depth, int skip_count) { + if (max_depth > 64) { + max_depth = 64; + } + skip_count++; // we want to skip the current frame as well + // This API is thread-safe (moreover it walks only the current thread). + return CaptureStackBackTrace(static_cast(skip_count), + static_cast(max_depth), result, nullptr); +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_x86-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_x86-inl.h new file mode 100644 index 0000000..f7afe87 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_x86-inl.h @@ -0,0 +1,159 @@ +// Copyright (c) 2000 - 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Produce stack trace + +#include // for uintptr_t + +#include "utilities.h" // for OS_* macros + +#if !defined(GLOG_OS_WINDOWS) +#include +#include +#endif + +#include // for nullptr + +#include "stacktrace.h" + +_START_GOOGLE_NAMESPACE_ + +// Given a pointer to a stack frame, locate and return the calling +// stackframe, or return nullptr if no stackframe can be found. Perform sanity +// checks (the strictness of which is controlled by the boolean parameter +// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned. +template +static void **NextStackFrame(void **old_sp) { + void **new_sp = static_cast(*old_sp); + + // Check that the transition from frame pointer old_sp to frame + // pointer new_sp isn't clearly bogus + if (STRICT_UNWINDING) { + // With the stack growing downwards, older stack frame must be + // at a greater address that the current one. + if (new_sp <= old_sp) return nullptr; + // Assume stack frames larger than 100,000 bytes are bogus. + if (reinterpret_cast(new_sp) - + reinterpret_cast(old_sp) > + 100000) { + return nullptr; + } + } else { + // In the non-strict mode, allow discontiguous stack frames. + // (alternate-signal-stacks for example). + if (new_sp == old_sp) return nullptr; + // And allow frames upto about 1MB. + if ((new_sp > old_sp) && (reinterpret_cast(new_sp) - + reinterpret_cast(old_sp) > + 1000000)) { + return nullptr; + } + } + if (reinterpret_cast(new_sp) & (sizeof(void *) - 1)) { + return nullptr; + } +#ifdef __i386__ + // On 64-bit machines, the stack pointer can be very close to + // 0xffffffff, so we explicitly check for a pointer into the + // last two pages in the address space + if ((uintptr_t)new_sp >= 0xffffe000) return nullptr; +#endif +#if !defined(GLOG_OS_WINDOWS) + if (!STRICT_UNWINDING) { + // Lax sanity checks cause a crash in 32-bit tcmalloc/crash_reason_test + // on AMD-based machines with VDSO-enabled kernels. + // Make an extra sanity check to insure new_sp is readable. + // Note: NextStackFrame() is only called while the program + // is already on its last leg, so it's ok to be slow here. + static int page_size = getpagesize(); + void *new_sp_aligned = + reinterpret_cast(reinterpret_cast(new_sp) & + static_cast(~(page_size - 1))); + if (msync(new_sp_aligned, static_cast(page_size), MS_ASYNC) == -1) { + return nullptr; + } + } +#endif + return new_sp; +} + +// If you change this function, also change GetStackFrames below. +int GetStackTrace(void** result, int max_depth, int skip_count) { + void **sp; + +#ifdef __GNUC__ +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402 +#define USE_BUILTIN_FRAME_ADDRESS +#endif +#endif + +#ifdef USE_BUILTIN_FRAME_ADDRESS + sp = reinterpret_cast(__builtin_frame_address(0)); +#elif defined(__i386__) + // Stack frame format: + // sp[0] pointer to previous frame + // sp[1] caller address + // sp[2] first argument + // ... + sp = (void **)&result - 2; +#elif defined(__x86_64__) + // __builtin_frame_address(0) can return the wrong address on gcc-4.1.0-k8 + unsigned long rbp; + // Move the value of the register %rbp into the local variable rbp. + // We need 'volatile' to prevent this instruction from getting moved + // around during optimization to before function prologue is done. + // An alternative way to achieve this + // would be (before this __asm__ instruction) to call Noop() defined as + // static void Noop() __attribute__ ((noinline)); // prevent inlining + // static void Noop() { asm(""); } // prevent optimizing-away + __asm__ volatile ("mov %%rbp, %0" : "=r" (rbp)); + // Arguments are passed in registers on x86-64, so we can't just + // offset from &result + sp = (void **) rbp; +#endif + + int n = 0; + while (sp && n < max_depth) { + if (*(sp + 1) == nullptr) { + // In 64-bit code, we often see a frame that + // points to itself and has a return address of 0. + break; + } + if (skip_count > 0) { + skip_count--; + } else { + result[n++] = *(sp+1); + } + // Use strict unwinding rules. + sp = NextStackFrame(sp); + } + return n; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/symbolize.cc b/runtime/onnxruntime/third_party/glog/src/symbolize.cc new file mode 100644 index 0000000..f95fccc --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/symbolize.cc @@ -0,0 +1,956 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Satoru Takabayashi +// Stack-footprint reduction work done by Raksit Ashok +// +// Implementation note: +// +// We don't use heaps but only use stacks. We want to reduce the +// stack consumption so that the symbolizer can run on small stacks. +// +// Here are some numbers collected with GCC 4.1.0 on x86: +// - sizeof(Elf32_Sym) = 16 +// - sizeof(Elf32_Shdr) = 40 +// - sizeof(Elf64_Sym) = 24 +// - sizeof(Elf64_Shdr) = 64 +// +// This implementation is intended to be async-signal-safe but uses +// some functions which are not guaranteed to be so, such as memchr() +// and memmove(). We assume they are async-signal-safe. +// +// Additional header can be specified by the GLOG_BUILD_CONFIG_INCLUDE +// macro to add platform specific defines (e.g. GLOG_OS_OPENBSD). + +#ifdef GLOG_BUILD_CONFIG_INCLUDE +#include GLOG_BUILD_CONFIG_INCLUDE +#endif // GLOG_BUILD_CONFIG_INCLUDE + +#include "utilities.h" + +#if defined(HAVE_SYMBOLIZE) + +#include + +#include +#include + +#include "symbolize.h" +#include "demangle.h" + +_START_GOOGLE_NAMESPACE_ + +// We don't use assert() since it's not guaranteed to be +// async-signal-safe. Instead we define a minimal assertion +// macro. So far, we don't need pretty printing for __FILE__, etc. + +// A wrapper for abort() to make it callable in ? :. +static int AssertFail() { + abort(); + return 0; // Should not reach. +} + +#define SAFE_ASSERT(expr) ((expr) ? 0 : AssertFail()) + +static SymbolizeCallback g_symbolize_callback = nullptr; +void InstallSymbolizeCallback(SymbolizeCallback callback) { + g_symbolize_callback = callback; +} + +static SymbolizeOpenObjectFileCallback g_symbolize_open_object_file_callback = + nullptr; +void InstallSymbolizeOpenObjectFileCallback( + SymbolizeOpenObjectFileCallback callback) { + g_symbolize_open_object_file_callback = callback; +} + +// This function wraps the Demangle function to provide an interface +// where the input symbol is demangled in-place. +// To keep stack consumption low, we would like this function to not +// get inlined. +static ATTRIBUTE_NOINLINE void DemangleInplace(char *out, size_t out_size) { + char demangled[256]; // Big enough for sane demangled symbols. + if (Demangle(out, demangled, sizeof(demangled))) { + // Demangling succeeded. Copy to out if the space allows. + size_t len = strlen(demangled); + if (len + 1 <= out_size) { // +1 for '\0'. + SAFE_ASSERT(len < sizeof(demangled)); + memmove(out, demangled, len + 1); + } + } +} + +_END_GOOGLE_NAMESPACE_ + +#if defined(__ELF__) + +#if defined(HAVE_DLFCN_H) +#include +#endif +#if defined(GLOG_OS_OPENBSD) +#include +#else +#include +#endif +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "symbolize.h" + +// Re-runs fn until it doesn't cause EINTR. +#define NO_INTR(fn) do {} while ((fn) < 0 && errno == EINTR) + +_START_GOOGLE_NAMESPACE_ + +// Read up to "count" bytes from "offset" in the file pointed by file +// descriptor "fd" into the buffer starting at "buf" while handling short reads +// and EINTR. On success, return the number of bytes read. Otherwise, return +// -1. +static ssize_t ReadFromOffset(const int fd, void *buf, const size_t count, + const size_t offset) { + SAFE_ASSERT(fd >= 0); + SAFE_ASSERT(count <= static_cast(std::numeric_limits::max())); + char *buf0 = reinterpret_cast(buf); + size_t num_bytes = 0; + while (num_bytes < count) { + ssize_t len; + NO_INTR(len = pread(fd, buf0 + num_bytes, count - num_bytes, + static_cast(offset + num_bytes))); + if (len < 0) { // There was an error other than EINTR. + return -1; + } + if (len == 0) { // Reached EOF. + break; + } + num_bytes += static_cast(len); + } + SAFE_ASSERT(num_bytes <= count); + return static_cast(num_bytes); +} + +// Try reading exactly "count" bytes from "offset" bytes in a file +// pointed by "fd" into the buffer starting at "buf" while handling +// short reads and EINTR. On success, return true. Otherwise, return +// false. +static bool ReadFromOffsetExact(const int fd, void *buf, + const size_t count, const size_t offset) { + ssize_t len = ReadFromOffset(fd, buf, count, offset); + return static_cast(len) == count; +} + +// Returns elf_header.e_type if the file pointed by fd is an ELF binary. +static int FileGetElfType(const int fd) { + ElfW(Ehdr) elf_header; + if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) { + return -1; + } + if (memcmp(elf_header.e_ident, ELFMAG, SELFMAG) != 0) { + return -1; + } + return elf_header.e_type; +} + +// Read the section headers in the given ELF binary, and if a section +// of the specified type is found, set the output to this section header +// and return true. Otherwise, return false. +// To keep stack consumption low, we would like this function to not get +// inlined. +static ATTRIBUTE_NOINLINE bool +GetSectionHeaderByType(const int fd, ElfW(Half) sh_num, const size_t sh_offset, + ElfW(Word) type, ElfW(Shdr) *out) { + // Read at most 16 section headers at a time to save read calls. + ElfW(Shdr) buf[16]; + for (size_t i = 0; i < sh_num;) { + const size_t num_bytes_left = (sh_num - i) * sizeof(buf[0]); + const size_t num_bytes_to_read = + (sizeof(buf) > num_bytes_left) ? num_bytes_left : sizeof(buf); + const ssize_t len = ReadFromOffset(fd, buf, num_bytes_to_read, + sh_offset + i * sizeof(buf[0])); + if (len == -1) { + return false; + } + SAFE_ASSERT(static_cast(len) % sizeof(buf[0]) == 0); + const size_t num_headers_in_buf = static_cast(len) / sizeof(buf[0]); + SAFE_ASSERT(num_headers_in_buf <= sizeof(buf) / sizeof(buf[0])); + for (size_t j = 0; j < num_headers_in_buf; ++j) { + if (buf[j].sh_type == type) { + *out = buf[j]; + return true; + } + } + i += num_headers_in_buf; + } + return false; +} + +// There is no particular reason to limit section name to 63 characters, +// but there has (as yet) been no need for anything longer either. +const int kMaxSectionNameLen = 64; + +// name_len should include terminating '\0'. +bool GetSectionHeaderByName(int fd, const char *name, size_t name_len, + ElfW(Shdr) *out) { + ElfW(Ehdr) elf_header; + if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) { + return false; + } + + ElfW(Shdr) shstrtab; + size_t shstrtab_offset = + (elf_header.e_shoff + static_cast(elf_header.e_shentsize) * + static_cast(elf_header.e_shstrndx)); + if (!ReadFromOffsetExact(fd, &shstrtab, sizeof(shstrtab), shstrtab_offset)) { + return false; + } + + for (size_t i = 0; i < elf_header.e_shnum; ++i) { + size_t section_header_offset = (elf_header.e_shoff + + elf_header.e_shentsize * i); + if (!ReadFromOffsetExact(fd, out, sizeof(*out), section_header_offset)) { + return false; + } + char header_name[kMaxSectionNameLen]; + if (sizeof(header_name) < name_len) { + RAW_LOG(WARNING, "Section name '%s' is too long (%" PRIuS "); " + "section will not be found (even if present).", name, name_len); + // No point in even trying. + return false; + } + size_t name_offset = shstrtab.sh_offset + out->sh_name; + ssize_t n_read = ReadFromOffset(fd, &header_name, name_len, name_offset); + if (n_read == -1) { + return false; + } else if (static_cast(n_read) != name_len) { + // Short read -- name could be at end of file. + continue; + } + if (memcmp(header_name, name, name_len) == 0) { + return true; + } + } + return false; +} + +// Read a symbol table and look for the symbol containing the +// pc. Iterate over symbols in a symbol table and look for the symbol +// containing "pc". On success, return true and write the symbol name +// to out. Otherwise, return false. +// To keep stack consumption low, we would like this function to not get +// inlined. +static ATTRIBUTE_NOINLINE bool +FindSymbol(uint64_t pc, const int fd, char *out, size_t out_size, + uint64_t symbol_offset, const ElfW(Shdr) *strtab, + const ElfW(Shdr) *symtab) { + if (symtab == nullptr) { + return false; + } + const size_t num_symbols = symtab->sh_size / symtab->sh_entsize; + for (unsigned i = 0; i < num_symbols;) { + size_t offset = symtab->sh_offset + i * symtab->sh_entsize; + + // If we are reading Elf64_Sym's, we want to limit this array to + // 32 elements (to keep stack consumption low), otherwise we can + // have a 64 element Elf32_Sym array. +#if defined(__WORDSIZE) && __WORDSIZE == 64 + const size_t NUM_SYMBOLS = 32U; +#else + const size_t NUM_SYMBOLS = 64U; +#endif + + // Read at most NUM_SYMBOLS symbols at once to save read() calls. + ElfW(Sym) buf[NUM_SYMBOLS]; + size_t num_symbols_to_read = std::min(NUM_SYMBOLS, num_symbols - i); + const ssize_t len = + ReadFromOffset(fd, &buf, sizeof(buf[0]) * num_symbols_to_read, offset); + SAFE_ASSERT(static_cast(len) % sizeof(buf[0]) == 0); + const size_t num_symbols_in_buf = static_cast(len) / sizeof(buf[0]); + SAFE_ASSERT(num_symbols_in_buf <= num_symbols_to_read); + for (unsigned j = 0; j < num_symbols_in_buf; ++j) { + const ElfW(Sym)& symbol = buf[j]; + uint64_t start_address = symbol.st_value; + start_address += symbol_offset; + uint64_t end_address = start_address + symbol.st_size; + if (symbol.st_value != 0 && // Skip null value symbols. + symbol.st_shndx != 0 && // Skip undefined symbols. + start_address <= pc && pc < end_address) { + ssize_t len1 = ReadFromOffset(fd, out, out_size, + strtab->sh_offset + symbol.st_name); + if (len1 <= 0 || memchr(out, '\0', out_size) == nullptr) { + memset(out, 0, out_size); + return false; + } + return true; // Obtained the symbol name. + } + } + i += num_symbols_in_buf; + } + return false; +} + +// Get the symbol name of "pc" from the file pointed by "fd". Process +// both regular and dynamic symbol tables if necessary. On success, +// write the symbol name to "out" and return true. Otherwise, return +// false. +static bool GetSymbolFromObjectFile(const int fd, + uint64_t pc, + char* out, + size_t out_size, + uint64_t base_address) { + // Read the ELF header. + ElfW(Ehdr) elf_header; + if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) { + return false; + } + + ElfW(Shdr) symtab, strtab; + + // Consult a regular symbol table first. + if (GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff, + SHT_SYMTAB, &symtab)) { + if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff + + symtab.sh_link * sizeof(symtab))) { + return false; + } + if (FindSymbol(pc, fd, out, out_size, base_address, &strtab, &symtab)) { + return true; // Found the symbol in a regular symbol table. + } + } + + // If the symbol is not found, then consult a dynamic symbol table. + if (GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff, + SHT_DYNSYM, &symtab)) { + if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff + + symtab.sh_link * sizeof(symtab))) { + return false; + } + if (FindSymbol(pc, fd, out, out_size, base_address, &strtab, &symtab)) { + return true; // Found the symbol in a dynamic symbol table. + } + } + + return false; +} + +namespace { +// Thin wrapper around a file descriptor so that the file descriptor +// gets closed for sure. +struct FileDescriptor { + const int fd_; + explicit FileDescriptor(int fd) : fd_(fd) {} + ~FileDescriptor() { + if (fd_ >= 0) { + close(fd_); + } + } + int get() { return fd_; } + + private: + FileDescriptor(const FileDescriptor &) = delete; + void operator=(const FileDescriptor &) = delete; +}; + +// Helper class for reading lines from file. +// +// Note: we don't use ProcMapsIterator since the object is big (it has +// a 5k array member) and uses async-unsafe functions such as sscanf() +// and snprintf(). +class LineReader { + public: + explicit LineReader(int fd, char *buf, size_t buf_len, size_t offset) + : fd_(fd), + buf_(buf), + buf_len_(buf_len), + offset_(offset), + bol_(buf), + eol_(buf), + eod_(buf) {} + + // Read '\n'-terminated line from file. On success, modify "bol" + // and "eol", then return true. Otherwise, return false. + // + // Note: if the last line doesn't end with '\n', the line will be + // dropped. It's an intentional behavior to make the code simple. + bool ReadLine(const char **bol, const char **eol) { + if (BufferIsEmpty()) { // First time. + const ssize_t num_bytes = ReadFromOffset(fd_, buf_, buf_len_, offset_); + if (num_bytes <= 0) { // EOF or error. + return false; + } + offset_ += static_cast(num_bytes); + eod_ = buf_ + num_bytes; + bol_ = buf_; + } else { + bol_ = eol_ + 1; // Advance to the next line in the buffer. + SAFE_ASSERT(bol_ <= eod_); // "bol_" can point to "eod_". + if (!HasCompleteLine()) { + const auto incomplete_line_length = static_cast(eod_ - bol_); + // Move the trailing incomplete line to the beginning. + memmove(buf_, bol_, incomplete_line_length); + // Read text from file and append it. + char * const append_pos = buf_ + incomplete_line_length; + const size_t capacity_left = buf_len_ - incomplete_line_length; + const ssize_t num_bytes = + ReadFromOffset(fd_, append_pos, capacity_left, offset_); + if (num_bytes <= 0) { // EOF or error. + return false; + } + offset_ += static_cast(num_bytes); + eod_ = append_pos + num_bytes; + bol_ = buf_; + } + } + eol_ = FindLineFeed(); + if (eol_ == nullptr) { // '\n' not found. Malformed line. + return false; + } + *eol_ = '\0'; // Replace '\n' with '\0'. + + *bol = bol_; + *eol = eol_; + return true; + } + + // Beginning of line. + const char *bol() { + return bol_; + } + + // End of line. + const char *eol() { + return eol_; + } + + private: + LineReader(const LineReader &) = delete; + void operator=(const LineReader &) = delete; + + char *FindLineFeed() { + return reinterpret_cast(memchr(bol_, '\n', static_cast(eod_ - bol_))); + } + + bool BufferIsEmpty() { + return buf_ == eod_; + } + + bool HasCompleteLine() { + return !BufferIsEmpty() && FindLineFeed() != nullptr; + } + + const int fd_; + char * const buf_; + const size_t buf_len_; + size_t offset_; + char *bol_; + char *eol_; + const char *eod_; // End of data in "buf_". +}; +} // namespace + +// Place the hex number read from "start" into "*hex". The pointer to +// the first non-hex character or "end" is returned. +static char *GetHex(const char *start, const char *end, uint64_t *hex) { + *hex = 0; + const char *p; + for (p = start; p < end; ++p) { + int ch = *p; + if ((ch >= '0' && ch <= '9') || + (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) { + *hex = (*hex << 4U) | (ch < 'A' ? static_cast(ch - '0') : (ch & 0xF) + 9U); + } else { // Encountered the first non-hex character. + break; + } + } + SAFE_ASSERT(p <= end); + return const_cast(p); +} + +// Searches for the object file (from /proc/self/maps) that contains +// the specified pc. If found, sets |start_address| to the start address +// of where this object file is mapped in memory, sets the module base +// address into |base_address|, copies the object file name into +// |out_file_name|, and attempts to open the object file. If the object +// file is opened successfully, returns the file descriptor. Otherwise, +// returns -1. |out_file_name_size| is the size of the file name buffer +// (including the null-terminator). +static ATTRIBUTE_NOINLINE int +OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc, + uint64_t &start_address, + uint64_t &base_address, + char *out_file_name, + size_t out_file_name_size) { + int object_fd; + + int maps_fd; + NO_INTR(maps_fd = open("/proc/self/maps", O_RDONLY)); + FileDescriptor wrapped_maps_fd(maps_fd); + if (wrapped_maps_fd.get() < 0) { + return -1; + } + + int mem_fd; + NO_INTR(mem_fd = open("/proc/self/mem", O_RDONLY)); + FileDescriptor wrapped_mem_fd(mem_fd); + if (wrapped_mem_fd.get() < 0) { + return -1; + } + + // Iterate over maps and look for the map containing the pc. Then + // look into the symbol tables inside. + char buf[1024]; // Big enough for line of sane /proc/self/maps + unsigned num_maps = 0; + LineReader reader(wrapped_maps_fd.get(), buf, sizeof(buf), 0); + while (true) { + num_maps++; + const char *cursor; + const char *eol; + if (!reader.ReadLine(&cursor, &eol)) { // EOF or malformed line. + return -1; + } + + // Start parsing line in /proc/self/maps. Here is an example: + // + // 08048000-0804c000 r-xp 00000000 08:01 2142121 /bin/cat + // + // We want start address (08048000), end address (0804c000), flags + // (r-xp) and file name (/bin/cat). + + // Read start address. + cursor = GetHex(cursor, eol, &start_address); + if (cursor == eol || *cursor != '-') { + return -1; // Malformed line. + } + ++cursor; // Skip '-'. + + // Read end address. + uint64_t end_address; + cursor = GetHex(cursor, eol, &end_address); + if (cursor == eol || *cursor != ' ') { + return -1; // Malformed line. + } + ++cursor; // Skip ' '. + + // Read flags. Skip flags until we encounter a space or eol. + const char * const flags_start = cursor; + while (cursor < eol && *cursor != ' ') { + ++cursor; + } + // We expect at least four letters for flags (ex. "r-xp"). + if (cursor == eol || cursor < flags_start + 4) { + return -1; // Malformed line. + } + + // Determine the base address by reading ELF headers in process memory. + ElfW(Ehdr) ehdr; + // Skip non-readable maps. + if (flags_start[0] == 'r' && + ReadFromOffsetExact(mem_fd, &ehdr, sizeof(ElfW(Ehdr)), start_address) && + memcmp(ehdr.e_ident, ELFMAG, SELFMAG) == 0) { + switch (ehdr.e_type) { + case ET_EXEC: + base_address = 0; + break; + case ET_DYN: + // Find the segment containing file offset 0. This will correspond + // to the ELF header that we just read. Normally this will have + // virtual address 0, but this is not guaranteed. We must subtract + // the virtual address from the address where the ELF header was + // mapped to get the base address. + // + // If we fail to find a segment for file offset 0, use the address + // of the ELF header as the base address. + base_address = start_address; + for (unsigned i = 0; i != ehdr.e_phnum; ++i) { + ElfW(Phdr) phdr; + if (ReadFromOffsetExact( + mem_fd, &phdr, sizeof(phdr), + start_address + ehdr.e_phoff + i * sizeof(phdr)) && + phdr.p_type == PT_LOAD && phdr.p_offset == 0) { + base_address = start_address - phdr.p_vaddr; + break; + } + } + break; + default: + // ET_REL or ET_CORE. These aren't directly executable, so they don't + // affect the base address. + break; + } + } + + // Check start and end addresses. + if (!(start_address <= pc && pc < end_address)) { + continue; // We skip this map. PC isn't in this map. + } + + // Check flags. We are only interested in "r*x" maps. + if (flags_start[0] != 'r' || flags_start[2] != 'x') { + continue; // We skip this map. + } + ++cursor; // Skip ' '. + + // Read file offset. + uint64_t file_offset; + cursor = GetHex(cursor, eol, &file_offset); + if (cursor == eol || *cursor != ' ') { + return -1; // Malformed line. + } + ++cursor; // Skip ' '. + + // Skip to file name. "cursor" now points to dev. We need to + // skip at least two spaces for dev and inode. + int num_spaces = 0; + while (cursor < eol) { + if (*cursor == ' ') { + ++num_spaces; + } else if (num_spaces >= 2) { + // The first non-space character after skipping two spaces + // is the beginning of the file name. + break; + } + ++cursor; + } + if (cursor == eol) { + return -1; // Malformed line. + } + + // Finally, "cursor" now points to file name of our interest. + NO_INTR(object_fd = open(cursor, O_RDONLY)); + if (object_fd < 0) { + // Failed to open object file. Copy the object file name to + // |out_file_name|. + strncpy(out_file_name, cursor, out_file_name_size); + // Making sure |out_file_name| is always null-terminated. + out_file_name[out_file_name_size - 1] = '\0'; + return -1; + } + return object_fd; + } +} + +// POSIX doesn't define any async-signal safe function for converting +// an integer to ASCII. We'll have to define our own version. +// itoa_r() converts an (unsigned) integer to ASCII. It returns "buf", if the +// conversion was successful or nullptr otherwise. It never writes more than +// "sz" bytes. Output will be truncated as needed, and a NUL character is always +// appended. +// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc. +static char *itoa_r(uintptr_t i, char *buf, size_t sz, unsigned base, size_t padding) { + // Make sure we can write at least one NUL byte. + size_t n = 1; + if (n > sz) { + return nullptr; + } + + if (base < 2 || base > 16) { + buf[0] = '\000'; + return nullptr; + } + + char *start = buf; + + // Loop until we have converted the entire number. Output at least one + // character (i.e. '0'). + char *ptr = start; + do { + // Make sure there is still enough space left in our output buffer. + if (++n > sz) { + buf[0] = '\000'; + return nullptr; + } + + // Output the next digit. + *ptr++ = "0123456789abcdef"[i % base]; + i /= base; + + if (padding > 0) { + padding--; + } + } while (i > 0 || padding > 0); + + // Terminate the output with a NUL character. + *ptr = '\000'; + + // Conversion to ASCII actually resulted in the digits being in reverse + // order. We can't easily generate them in forward order, as we can't tell + // the number of characters needed until we are done converting. + // So, now, we reverse the string (except for the possible "-" sign). + while (--ptr > start) { + char ch = *ptr; + *ptr = *start; + *start++ = ch; + } + return buf; +} + +// Safely appends string |source| to string |dest|. Never writes past the +// buffer size |dest_size| and guarantees that |dest| is null-terminated. +static void SafeAppendString(const char* source, char* dest, size_t dest_size) { + size_t dest_string_length = strlen(dest); + SAFE_ASSERT(dest_string_length < dest_size); + dest += dest_string_length; + dest_size -= dest_string_length; + strncpy(dest, source, dest_size); + // Making sure |dest| is always null-terminated. + dest[dest_size - 1] = '\0'; +} + +// Converts a 64-bit value into a hex string, and safely appends it to |dest|. +// Never writes past the buffer size |dest_size| and guarantees that |dest| is +// null-terminated. +static void SafeAppendHexNumber(uint64_t value, char* dest, size_t dest_size) { + // 64-bit numbers in hex can have up to 16 digits. + char buf[17] = {'\0'}; + SafeAppendString(itoa_r(value, buf, sizeof(buf), 16, 0), dest, dest_size); +} + +// The implementation of our symbolization routine. If it +// successfully finds the symbol containing "pc" and obtains the +// symbol name, returns true and write the symbol name to "out". +// Otherwise, returns false. If Callback function is installed via +// InstallSymbolizeCallback(), the function is also called in this function, +// and "out" is used as its output. +// To keep stack consumption low, we would like this function to not +// get inlined. +static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, + size_t out_size) { + auto pc0 = reinterpret_cast(pc); + uint64_t start_address = 0; + uint64_t base_address = 0; + int object_fd = -1; + + if (out_size < 1) { + return false; + } + out[0] = '\0'; + SafeAppendString("(", out, out_size); + + if (g_symbolize_open_object_file_callback) { + object_fd = g_symbolize_open_object_file_callback(pc0, start_address, + base_address, out + 1, + out_size - 1); + } else { + object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0, start_address, + base_address, + out + 1, + out_size - 1); + } + + FileDescriptor wrapped_object_fd(object_fd); + +#if defined(PRINT_UNSYMBOLIZED_STACK_TRACES) + { +#else + // Check whether a file name was returned. + if (object_fd < 0) { +#endif + if (out[1]) { + // The object file containing PC was determined successfully however the + // object file was not opened successfully. This is still considered + // success because the object file name and offset are known and tools + // like asan_symbolize.py can be used for the symbolization. + out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated. + SafeAppendString("+0x", out, out_size); + SafeAppendHexNumber(pc0 - base_address, out, out_size); + SafeAppendString(")", out, out_size); + return true; + } + // Failed to determine the object file containing PC. Bail out. + return false; + } + int elf_type = FileGetElfType(wrapped_object_fd.get()); + if (elf_type == -1) { + return false; + } + if (g_symbolize_callback) { + // Run the call back if it's installed. + // Note: relocation (and much of the rest of this code) will be + // wrong for prelinked shared libraries and PIE executables. + uint64_t relocation = (elf_type == ET_DYN) ? start_address : 0; + int num_bytes_written = g_symbolize_callback(wrapped_object_fd.get(), + pc, out, out_size, + relocation); + if (num_bytes_written > 0) { + out += static_cast(num_bytes_written); + out_size -= static_cast(num_bytes_written); + } + } + if (!GetSymbolFromObjectFile(wrapped_object_fd.get(), pc0, + out, out_size, base_address)) { + if (out[1] && !g_symbolize_callback) { + // The object file containing PC was opened successfully however the + // symbol was not found. The object may have been stripped. This is still + // considered success because the object file name and offset are known + // and tools like asan_symbolize.py can be used for the symbolization. + out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated. + SafeAppendString("+0x", out, out_size); + SafeAppendHexNumber(pc0 - base_address, out, out_size); + SafeAppendString(")", out, out_size); + return true; + } + return false; + } + + // Symbolization succeeded. Now we try to demangle the symbol. + DemangleInplace(out, out_size); + return true; +} + +_END_GOOGLE_NAMESPACE_ + +#elif defined(GLOG_OS_MACOSX) && defined(HAVE_DLADDR) + +#include +#include + +_START_GOOGLE_NAMESPACE_ + +static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, + size_t out_size) { + Dl_info info; + if (dladdr(pc, &info)) { + if (info.dli_sname) { + if (strlen(info.dli_sname) < out_size) { + strcpy(out, info.dli_sname); + // Symbolization succeeded. Now we try to demangle the symbol. + DemangleInplace(out, out_size); + return true; + } + } + } + return false; +} + +_END_GOOGLE_NAMESPACE_ + +#elif defined(GLOG_OS_WINDOWS) || defined(GLOG_OS_CYGWIN) + +#include +#include + +#ifdef _MSC_VER +#pragma comment(lib, "dbghelp") +#endif + +_START_GOOGLE_NAMESPACE_ + +class SymInitializer { +public: + HANDLE process; + bool ready; + SymInitializer() : process(nullptr), ready(false) { + // Initialize the symbol handler. + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680344(v=vs.85).aspx + process = GetCurrentProcess(); + // Defer symbol loading. + // We do not request undecorated symbols with SYMOPT_UNDNAME + // because the mangling library calls UnDecorateSymbolName. + SymSetOptions(SYMOPT_DEFERRED_LOADS); + if (SymInitialize(process, nullptr, true)) { + ready = true; + } + } + ~SymInitializer() { + SymCleanup(process); + // We do not need to close `HANDLE process` because it's a "pseudo handle." + } +private: + SymInitializer(const SymInitializer&); + SymInitializer& operator=(const SymInitializer&); +}; + +static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, + size_t out_size) { + const static SymInitializer symInitializer; + if (!symInitializer.ready) { + return false; + } + // Resolve symbol information from address. + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680578(v=vs.85).aspx + char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; + SYMBOL_INFO *symbol = reinterpret_cast(buf); + symbol->SizeOfStruct = sizeof(SYMBOL_INFO); + symbol->MaxNameLen = MAX_SYM_NAME; + // We use the ANSI version to ensure the string type is always `char *`. + // This could break if a symbol has Unicode in it. + BOOL ret = SymFromAddr(symInitializer.process, + reinterpret_cast(pc), 0, symbol); + if (ret == 1 && static_cast(symbol->NameLen) < out_size) { + // `NameLen` does not include the null terminating character. + strncpy(out, symbol->Name, static_cast(symbol->NameLen) + 1); + out[static_cast(symbol->NameLen)] = '\0'; + // Symbolization succeeded. Now we try to demangle the symbol. + DemangleInplace(out, out_size); + return true; + } + return false; +} + +_END_GOOGLE_NAMESPACE_ + +#else +# error BUG: HAVE_SYMBOLIZE was wrongly set +#endif + +_START_GOOGLE_NAMESPACE_ + +bool Symbolize(void *pc, char *out, size_t out_size) { + return SymbolizeAndDemangle(pc, out, out_size); +} + +_END_GOOGLE_NAMESPACE_ + +#else /* HAVE_SYMBOLIZE */ + +#include + +#include "config.h" + +_START_GOOGLE_NAMESPACE_ + +// TODO: Support other environments. +bool Symbolize(void* /*pc*/, char* /*out*/, size_t /*out_size*/) { + assert(0); + return false; +} + +_END_GOOGLE_NAMESPACE_ + +#endif diff --git a/runtime/onnxruntime/third_party/glog/src/symbolize.h b/runtime/onnxruntime/third_party/glog/src/symbolize.h new file mode 100644 index 0000000..86c22e3 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/symbolize.h @@ -0,0 +1,152 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Satoru Takabayashi +// +// This library provides Symbolize() function that symbolizes program +// counters to their corresponding symbol names on linux platforms. +// This library has a minimal implementation of an ELF symbol table +// reader (i.e. it doesn't depend on libelf, etc.). +// +// The algorithm used in Symbolize() is as follows. +// +// 1. Go through a list of maps in /proc/self/maps and find the map +// containing the program counter. +// +// 2. Open the mapped file and find a regular symbol table inside. +// Iterate over symbols in the symbol table and look for the symbol +// containing the program counter. If such a symbol is found, +// obtain the symbol name, and demangle the symbol if possible. +// If the symbol isn't found in the regular symbol table (binary is +// stripped), try the same thing with a dynamic symbol table. +// +// Note that Symbolize() is originally implemented to be used in +// FailureSignalHandler() in base/google.cc. Hence it doesn't use +// malloc() and other unsafe operations. It should be both +// thread-safe and async-signal-safe. + +#ifndef BASE_SYMBOLIZE_H_ +#define BASE_SYMBOLIZE_H_ + +#include "utilities.h" +#include "config.h" +#include + +#ifdef HAVE_SYMBOLIZE + +#if defined(__ELF__) // defined by gcc +#if defined(__OpenBSD__) +#include +#else +#include +#endif + +#if !defined(ANDROID) +#include // For ElfW() macro. +#endif + +// For systems where SIZEOF_VOID_P is not defined, determine it +// based on __LP64__ (defined by gcc on 64-bit systems) +#if !defined(SIZEOF_VOID_P) +# if defined(__LP64__) +# define SIZEOF_VOID_P 8 +# else +# define SIZEOF_VOID_P 4 +# endif +#endif + +// If there is no ElfW macro, let's define it by ourself. +#ifndef ElfW +# if SIZEOF_VOID_P == 4 +# define ElfW(type) Elf32_##type +# elif SIZEOF_VOID_P == 8 +# define ElfW(type) Elf64_##type +# else +# error "Unknown sizeof(void *)" +# endif +#endif + +_START_GOOGLE_NAMESPACE_ + +// Gets the section header for the given name, if it exists. Returns true on +// success. Otherwise, returns false. +bool GetSectionHeaderByName(int fd, const char *name, size_t name_len, + ElfW(Shdr) *out); + +_END_GOOGLE_NAMESPACE_ + +#endif /* __ELF__ */ + +_START_GOOGLE_NAMESPACE_ + +// Restrictions on the callbacks that follow: +// - The callbacks must not use heaps but only use stacks. +// - The callbacks must be async-signal-safe. + +// Installs a callback function, which will be called right before a symbol name +// is printed. The callback is intended to be used for showing a file name and a +// line number preceding a symbol name. +// "fd" is a file descriptor of the object file containing the program +// counter "pc". The callback function should write output to "out" +// and return the size of the output written. On error, the callback +// function should return -1. +using SymbolizeCallback = int (*)(int, void *, char *, size_t, uint64_t); +GLOG_EXPORT +void InstallSymbolizeCallback(SymbolizeCallback callback); + +// Installs a callback function, which will be called instead of +// OpenObjectFileContainingPcAndGetStartAddress. The callback is expected +// to searches for the object file (from /proc/self/maps) that contains +// the specified pc. If found, sets |start_address| to the start address +// of where this object file is mapped in memory, sets the module base +// address into |base_address|, copies the object file name into +// |out_file_name|, and attempts to open the object file. If the object +// file is opened successfully, returns the file descriptor. Otherwise, +// returns -1. |out_file_name_size| is the size of the file name buffer +// (including the null-terminator). +using SymbolizeOpenObjectFileCallback = int (*)(uint64_t, uint64_t &, + uint64_t &, char *, size_t); +void InstallSymbolizeOpenObjectFileCallback( + SymbolizeOpenObjectFileCallback callback); + +_END_GOOGLE_NAMESPACE_ + +#endif + +_START_GOOGLE_NAMESPACE_ + +// Symbolizes a program counter. On success, returns true and write the +// symbol name to "out". The symbol name is demangled if possible +// (supports symbols generated by GCC 3.x or newer). Otherwise, +// returns false. +GLOG_EXPORT bool Symbolize(void* pc, char* out, size_t out_size); + +_END_GOOGLE_NAMESPACE_ + +#endif // BASE_SYMBOLIZE_H_ diff --git a/runtime/onnxruntime/third_party/glog/src/utilities.cc b/runtime/onnxruntime/third_party/glog/src/utilities.cc new file mode 100644 index 0000000..8b0a1ea --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/utilities.cc @@ -0,0 +1,400 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Shinichiro Hamaji + +#include "config.h" +#include "utilities.h" + +#include +#include + +#include +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include +#if defined(HAVE_SYSCALL_H) +#include // for syscall() +#elif defined(HAVE_SYS_SYSCALL_H) +#include // for syscall() +#endif +#ifdef HAVE_SYSLOG_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include // For geteuid. +#endif +#ifdef HAVE_PWD_H +# include +#endif +#ifdef __ANDROID__ +#include +#endif + +#include "base/googleinit.h" + +using std::string; + +_START_GOOGLE_NAMESPACE_ + +static const char* g_program_invocation_short_name = nullptr; + +bool IsGoogleLoggingInitialized() { + return g_program_invocation_short_name != nullptr; +} + +_END_GOOGLE_NAMESPACE_ + +// The following APIs are all internal. +#ifdef HAVE_STACKTRACE + +#include "stacktrace.h" +#include "symbolize.h" +#include "base/commandlineflags.h" + +GLOG_DEFINE_bool(symbolize_stacktrace, true, + "Symbolize the stack trace in the tombstone"); + +_START_GOOGLE_NAMESPACE_ + +using DebugWriter = void(const char*, void*); + +// The %p field width for printf() functions is two characters per byte. +// For some environments, add two extra bytes for the leading "0x". +static const int kPrintfPointerFieldWidth = 2 + 2 * sizeof(void*); + +static void DebugWriteToStderr(const char* data, void *) { + // This one is signal-safe. + if (write(STDERR_FILENO, data, strlen(data)) < 0) { + // Ignore errors. + } +#if defined(__ANDROID__) + // ANDROID_LOG_FATAL as fatal error occurred and now is dumping call stack. + __android_log_write(ANDROID_LOG_FATAL, + glog_internal_namespace_::ProgramInvocationShortName(), + data); +#endif +} + +static void DebugWriteToString(const char* data, void *arg) { + reinterpret_cast(arg)->append(data); +} + +#ifdef HAVE_SYMBOLIZE +// Print a program counter and its symbol name. +static void DumpPCAndSymbol(DebugWriter *writerfn, void *arg, void *pc, + const char * const prefix) { + char tmp[1024]; + const char *symbol = "(unknown)"; + // Symbolizes the previous address of pc because pc may be in the + // next function. The overrun happens when the function ends with + // a call to a function annotated noreturn (e.g. CHECK). + if (Symbolize(reinterpret_cast(pc) - 1, tmp, sizeof(tmp))) { + symbol = tmp; + } + char buf[1024]; + snprintf(buf, sizeof(buf), "%s@ %*p %s\n", + prefix, kPrintfPointerFieldWidth, pc, symbol); + writerfn(buf, arg); +} +#endif + +static void DumpPC(DebugWriter *writerfn, void *arg, void *pc, + const char * const prefix) { + char buf[100]; + snprintf(buf, sizeof(buf), "%s@ %*p\n", + prefix, kPrintfPointerFieldWidth, pc); + writerfn(buf, arg); +} + +// Dump current stack trace as directed by writerfn +static void DumpStackTrace(int skip_count, DebugWriter *writerfn, void *arg) { + // Print stack trace + void* stack[32]; + int depth = GetStackTrace(stack, ARRAYSIZE(stack), skip_count+1); + for (int i = 0; i < depth; i++) { +#if defined(HAVE_SYMBOLIZE) + if (FLAGS_symbolize_stacktrace) { + DumpPCAndSymbol(writerfn, arg, stack[i], " "); + } else { + DumpPC(writerfn, arg, stack[i], " "); + } +#else + DumpPC(writerfn, arg, stack[i], " "); +#endif + } +} + +#ifdef __GNUC__ +__attribute__((noreturn)) +#endif +static void +DumpStackTraceAndExit() { + DumpStackTrace(1, DebugWriteToStderr, nullptr); + + // TODO(hamaji): Use signal instead of sigaction? + if (IsFailureSignalHandlerInstalled()) { + // Set the default signal handler for SIGABRT, to avoid invoking our + // own signal handler installed by InstallFailureSignalHandler(). +#ifdef HAVE_SIGACTION + struct sigaction sig_action; + memset(&sig_action, 0, sizeof(sig_action)); + sigemptyset(&sig_action.sa_mask); + sig_action.sa_handler = SIG_DFL; + sigaction(SIGABRT, &sig_action, nullptr); +#elif defined(GLOG_OS_WINDOWS) + signal(SIGABRT, SIG_DFL); +#endif // HAVE_SIGACTION + } + + abort(); +} + +_END_GOOGLE_NAMESPACE_ + +#endif // HAVE_STACKTRACE + +_START_GOOGLE_NAMESPACE_ + +namespace glog_internal_namespace_ { + +const char* ProgramInvocationShortName() { + if (g_program_invocation_short_name != nullptr) { + return g_program_invocation_short_name; + } else { + // TODO(hamaji): Use /proc/self/cmdline and so? + return "UNKNOWN"; + } +} + +#ifdef GLOG_OS_WINDOWS +struct timeval { + long tv_sec, tv_usec; +}; + +// Based on: http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/os_win32.c&q=GetSystemTimeAsFileTime%20license:bsd +// See COPYING for copyright information. +static int gettimeofday(struct timeval *tv, void* /*tz*/) { +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" +#endif +#define EPOCHFILETIME (116444736000000000ULL) + FILETIME ft; + ULARGE_INTEGER li; + uint64 tt; + + GetSystemTimeAsFileTime(&ft); + li.LowPart = ft.dwLowDateTime; + li.HighPart = ft.dwHighDateTime; + tt = (li.QuadPart - EPOCHFILETIME) / 10; + tv->tv_sec = tt / 1000000; + tv->tv_usec = tt % 1000000; +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + + return 0; +} +#endif + +int64 CycleClock_Now() { + // TODO(hamaji): temporary impementation - it might be too slow. + struct timeval tv; + gettimeofday(&tv, nullptr); + return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; +} + +int64 UsecToCycles(int64 usec) { + return usec; +} + +WallTime WallTime_Now() { + // Now, cycle clock is retuning microseconds since the epoch. + return CycleClock_Now() * 0.000001; +} + +static int32 g_main_thread_pid = getpid(); +int32 GetMainThreadPid() { + return g_main_thread_pid; +} + +bool PidHasChanged() { + int32 pid = getpid(); + if (g_main_thread_pid == pid) { + return false; + } + g_main_thread_pid = pid; + return true; +} + +pid_t GetTID() { + // On Linux and MacOSX, we try to use gettid(). +#if defined GLOG_OS_LINUX || defined GLOG_OS_MACOSX +#ifndef __NR_gettid +#ifdef GLOG_OS_MACOSX +#define __NR_gettid SYS_gettid +#elif ! defined __i386__ +#error "Must define __NR_gettid for non-x86 platforms" +#else +#define __NR_gettid 224 +#endif +#endif + static bool lacks_gettid = false; + if (!lacks_gettid) { +#if (defined(GLOG_OS_MACOSX) && defined(HAVE_PTHREAD_THREADID_NP)) + uint64_t tid64; + const int error = pthread_threadid_np(nullptr, &tid64); + pid_t tid = error ? -1 : static_cast(tid64); +#else + auto tid = static_cast(syscall(__NR_gettid)); +#endif + if (tid != -1) { + return tid; + } + // Technically, this variable has to be volatile, but there is a small + // performance penalty in accessing volatile variables and there should + // not be any serious adverse effect if a thread does not immediately see + // the value change to "true". + lacks_gettid = true; + } +#endif // GLOG_OS_LINUX || GLOG_OS_MACOSX + + // If gettid() could not be used, we use one of the following. +#if defined GLOG_OS_LINUX + return getpid(); // Linux: getpid returns thread ID when gettid is absent +#elif defined GLOG_OS_WINDOWS && !defined GLOG_OS_CYGWIN + return static_cast(GetCurrentThreadId()); +#elif defined(HAVE_PTHREAD) + // If none of the techniques above worked, we use pthread_self(). + return (pid_t)(uintptr_t)pthread_self(); +#else + return -1; +#endif +} + +const char* const_basename(const char* filepath) { + const char* base = strrchr(filepath, '/'); +#ifdef GLOG_OS_WINDOWS // Look for either path separator in Windows + if (!base) + base = strrchr(filepath, '\\'); +#endif + return base ? (base+1) : filepath; +} + +static string g_my_user_name; +const string& MyUserName() { + return g_my_user_name; +} +static void MyUserNameInitializer() { + // TODO(hamaji): Probably this is not portable. +#if defined(GLOG_OS_WINDOWS) + const char* user = getenv("USERNAME"); +#else + const char* user = getenv("USER"); +#endif + if (user != nullptr) { + g_my_user_name = user; + } else { +#if defined(HAVE_PWD_H) && defined(HAVE_UNISTD_H) + struct passwd pwd; + struct passwd* result = nullptr; + char buffer[1024] = {'\0'}; + uid_t uid = geteuid(); + int pwuid_res = getpwuid_r(uid, &pwd, buffer, sizeof(buffer), &result); + if (pwuid_res == 0 && result) { + g_my_user_name = pwd.pw_name; + } else { + snprintf(buffer, sizeof(buffer), "uid%d", uid); + g_my_user_name = buffer; + } +#endif + if (g_my_user_name.empty()) { + g_my_user_name = "invalid-user"; + } + } +} +REGISTER_MODULE_INITIALIZER(utilities, MyUserNameInitializer()) + +#ifdef HAVE_STACKTRACE +void DumpStackTraceToString(string* stacktrace) { + DumpStackTrace(1, DebugWriteToString, stacktrace); +} +#endif + +// We use an atomic operation to prevent problems with calling CrashReason +// from inside the Mutex implementation (potentially through RAW_CHECK). +static const CrashReason* g_reason = nullptr; + +void SetCrashReason(const CrashReason* r) { + sync_val_compare_and_swap(&g_reason, + reinterpret_cast(0), + r); +} + +void InitGoogleLoggingUtilities(const char* argv0) { + CHECK(!IsGoogleLoggingInitialized()) + << "You called InitGoogleLogging() twice!"; + const char* slash = strrchr(argv0, '/'); +#ifdef GLOG_OS_WINDOWS + if (!slash) slash = strrchr(argv0, '\\'); +#endif + g_program_invocation_short_name = slash ? slash + 1 : argv0; + +#ifdef HAVE_STACKTRACE + InstallFailureFunction(&DumpStackTraceAndExit); +#endif +} + +void ShutdownGoogleLoggingUtilities() { + CHECK(IsGoogleLoggingInitialized()) + << "You called ShutdownGoogleLogging() without calling InitGoogleLogging() first!"; + g_program_invocation_short_name = nullptr; +#ifdef HAVE_SYSLOG_H + closelog(); +#endif +} + +} // namespace glog_internal_namespace_ + +_END_GOOGLE_NAMESPACE_ + +// Make an implementation of stacktrace compiled. +#ifdef STACKTRACE_H +# include STACKTRACE_H +# if 0 +// For include scanners which can't handle macro expansions. +# include "stacktrace_libunwind-inl.h" +# include "stacktrace_x86-inl.h" +# include "stacktrace_x86_64-inl.h" +# include "stacktrace_powerpc-inl.h" +# include "stacktrace_generic-inl.h" +# endif +#endif diff --git a/runtime/onnxruntime/third_party/glog/src/utilities.h b/runtime/onnxruntime/third_party/glog/src/utilities.h new file mode 100644 index 0000000..45e555b --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/utilities.h @@ -0,0 +1,217 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Shinichiro Hamaji +// +// Define utilties for glog internal usage. + +#ifndef UTILITIES_H__ +#define UTILITIES_H__ + +// printf macros for size_t, in the style of inttypes.h +#ifdef _LP64 +#define __PRIS_PREFIX "z" +#else +#define __PRIS_PREFIX +#endif + +// Use these macros after a % in a printf format string +// to get correct 32/64 bit behavior, like this: +// size_t size = records.size(); +// printf("%"PRIuS"\n", size); + +#define PRIdS __PRIS_PREFIX "d" +#define PRIxS __PRIS_PREFIX "x" +#define PRIuS __PRIS_PREFIX "u" +#define PRIXS __PRIS_PREFIX "X" +#define PRIoS __PRIS_PREFIX "o" + +#include "base/mutex.h" // This must go first so we get _XOPEN_SOURCE + +#include + +#include + +#if defined(GLOG_OS_WINDOWS) +# include "port.h" +#endif + +#include "config.h" + +// There are three different ways we can try to get the stack trace: +// +// 1) The libunwind library. This is still in development, and as a +// separate library adds a new dependency, but doesn't need a frame +// pointer. It also doesn't call malloc. +// +// 2) Our hand-coded stack-unwinder. This depends on a certain stack +// layout, which is used by gcc (and those systems using a +// gcc-compatible ABI) on x86 systems, at least since gcc 2.95. +// It uses the frame pointer to do its work. +// +// 3) The gdb unwinder -- also the one used by the c++ exception code. +// It's obviously well-tested, but has a fatal flaw: it can call +// malloc() from the unwinder. This is a problem because we're +// trying to use the unwinder to instrument malloc(). +// +// 4) The Windows API CaptureStackTrace. +// +// Note: if you add a new implementation here, make sure it works +// correctly when GetStackTrace() is called with max_depth == 0. +// Some code may do that. + +#if defined(HAVE_LIB_UNWIND) +# define STACKTRACE_H "stacktrace_libunwind-inl.h" +#elif defined(HAVE__UNWIND_BACKTRACE) && defined(HAVE__UNWIND_GETIP) +# define STACKTRACE_H "stacktrace_unwind-inl.h" +#elif !defined(NO_FRAME_POINTER) +# if defined(__i386__) && __GNUC__ >= 2 +# define STACKTRACE_H "stacktrace_x86-inl.h" +# elif (defined(__ppc__) || defined(__PPC__)) && __GNUC__ >= 2 +# define STACKTRACE_H "stacktrace_powerpc-inl.h" +# elif defined(GLOG_OS_WINDOWS) +# define STACKTRACE_H "stacktrace_windows-inl.h" +# endif +#endif + +#if !defined(STACKTRACE_H) && defined(HAVE_EXECINFO_BACKTRACE) +# define STACKTRACE_H "stacktrace_generic-inl.h" +#endif + +#if defined(STACKTRACE_H) +# define HAVE_STACKTRACE +#endif + +#ifndef GLOG_NO_SYMBOLIZE_DETECTION +#ifndef HAVE_SYMBOLIZE +// defined by gcc +#if defined(__ELF__) && defined(GLOG_OS_LINUX) +# define HAVE_SYMBOLIZE +#elif defined(GLOG_OS_MACOSX) && defined(HAVE_DLADDR) +// Use dladdr to symbolize. +# define HAVE_SYMBOLIZE +#elif defined(GLOG_OS_WINDOWS) +// Use DbgHelp to symbolize +# define HAVE_SYMBOLIZE +#endif +#endif // !defined(HAVE_SYMBOLIZE) +#endif // !defined(GLOG_NO_SYMBOLIZE_DETECTION) + +#ifndef ARRAYSIZE +// There is a better way, but this is good enough for our purpose. +# define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a))) +#endif + +_START_GOOGLE_NAMESPACE_ + +namespace glog_internal_namespace_ { + +#ifdef HAVE___ATTRIBUTE__ +# define ATTRIBUTE_NOINLINE __attribute__ ((noinline)) +# define HAVE_ATTRIBUTE_NOINLINE +#elif defined(GLOG_OS_WINDOWS) +# define ATTRIBUTE_NOINLINE __declspec(noinline) +# define HAVE_ATTRIBUTE_NOINLINE +#else +# define ATTRIBUTE_NOINLINE +#endif + +const char* ProgramInvocationShortName(); + +int64 CycleClock_Now(); + +int64 UsecToCycles(int64 usec); +WallTime WallTime_Now(); + +int32 GetMainThreadPid(); +bool PidHasChanged(); + +pid_t GetTID(); + +const std::string& MyUserName(); + +// Get the part of filepath after the last path separator. +// (Doesn't modify filepath, contrary to basename() in libgen.h.) +const char* const_basename(const char* filepath); + +// Wrapper of __sync_val_compare_and_swap. If the GCC extension isn't +// defined, we try the CPU specific logics (we only support x86 and +// x86_64 for now) first, then use a naive implementation, which has a +// race condition. +template +inline T sync_val_compare_and_swap(T* ptr, T oldval, T newval) { +#if defined(HAVE___SYNC_VAL_COMPARE_AND_SWAP) + return __sync_val_compare_and_swap(ptr, oldval, newval); +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + T ret; + __asm__ __volatile__("lock; cmpxchg %1, (%2);" + :"=a"(ret) + // GCC may produces %sil or %dil for + // constraint "r", but some of apple's gas + // dosn't know the 8 bit registers. + // We use "q" to avoid these registers. + :"q"(newval), "q"(ptr), "a"(oldval) + :"memory", "cc"); + return ret; +#else + T ret = *ptr; + if (ret == oldval) { + *ptr = newval; + } + return ret; +#endif +} + +void DumpStackTraceToString(std::string* stacktrace); + +struct CrashReason { + CrashReason() = default; + + const char* filename{nullptr}; + int line_number{0}; + const char* message{nullptr}; + + // We'll also store a bit of stack trace context at the time of crash as + // it may not be available later on. + void* stack[32]; + int depth{0}; +}; + +void SetCrashReason(const CrashReason* r); + +void InitGoogleLoggingUtilities(const char* argv0); +void ShutdownGoogleLoggingUtilities(); + +} // namespace glog_internal_namespace_ + +_END_GOOGLE_NAMESPACE_ + +using namespace GOOGLE_NAMESPACE::glog_internal_namespace_; + +#endif // UTILITIES_H__ diff --git a/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc b/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc new file mode 100644 index 0000000..ac60d02 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc @@ -0,0 +1,294 @@ +// Copyright (c) 1999, 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: Ray Sidney and many others +// +// Broken out from logging.cc by Soren Lassen +// logging_unittest.cc covers the functionality herein + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include "base/commandlineflags.h" +#include +#include +#include "base/googleinit.h" + +// glog doesn't have annotation +#define ANNOTATE_BENIGN_RACE(address, description) + +using std::string; + +GLOG_DEFINE_int32(v, 0, "Show all VLOG(m) messages for m <= this." +" Overridable by --vmodule."); + +GLOG_DEFINE_string(vmodule, "", "per-module verbose level." +" Argument is a comma-separated list of =." +" is a glob pattern, matched against the filename base" +" (that is, name ignoring .cc/.h./-inl.h)." +" overrides any value given by --v."); + +_START_GOOGLE_NAMESPACE_ + +namespace glog_internal_namespace_ { + +// Used by logging_unittests.cc so can't make it static here. +GLOG_EXPORT bool SafeFNMatch_(const char* pattern, size_t patt_len, + const char* str, size_t str_len); + +// Implementation of fnmatch that does not need 0-termination +// of arguments and does not allocate any memory, +// but we only support "*" and "?" wildcards, not the "[...]" patterns. +// It's not a static function for the unittest. +GLOG_EXPORT bool SafeFNMatch_(const char* pattern, size_t patt_len, + const char* str, size_t str_len) { + size_t p = 0; + size_t s = 0; + while (true) { + if (p == patt_len && s == str_len) return true; + if (p == patt_len) return false; + if (s == str_len) return p+1 == patt_len && pattern[p] == '*'; + if (pattern[p] == str[s] || pattern[p] == '?') { + p += 1; + s += 1; + continue; + } + if (pattern[p] == '*') { + if (p+1 == patt_len) return true; + do { + if (SafeFNMatch_(pattern+(p+1), patt_len-(p+1), str+s, str_len-s)) { + return true; + } + s += 1; + } while (s != str_len); + return false; + } + return false; + } +} + +} // namespace glog_internal_namespace_ + +using glog_internal_namespace_::SafeFNMatch_; + +// List of per-module log levels from FLAGS_vmodule. +// Once created each element is never deleted/modified +// except for the vlog_level: other threads will read VModuleInfo blobs +// w/o locks and we'll store pointers to vlog_level at VLOG locations +// that will never go away. +// We can't use an STL struct here as we wouldn't know +// when it's safe to delete/update it: other threads need to use it w/o locks. +struct VModuleInfo { + string module_pattern; + mutable int32 vlog_level; // Conceptually this is an AtomicWord, but it's + // too much work to use AtomicWord type here + // w/o much actual benefit. + const VModuleInfo* next; +}; + +// This protects the following global variables. +static Mutex vmodule_lock; +// Pointer to head of the VModuleInfo list. +// It's a map from module pattern to logging level for those module(s). +static VModuleInfo* vmodule_list = nullptr; +static SiteFlag* cached_site_list = nullptr; + +// Boolean initialization flag. +static bool inited_vmodule = false; + +// L >= vmodule_lock. +static void VLOG2Initializer() { + vmodule_lock.AssertHeld(); + // Can now parse --vmodule flag and initialize mapping of module-specific + // logging levels. + inited_vmodule = false; + const char* vmodule = FLAGS_vmodule.c_str(); + const char* sep; + VModuleInfo* head = nullptr; + VModuleInfo* tail = nullptr; + while ((sep = strchr(vmodule, '=')) != nullptr) { + string pattern(vmodule, static_cast(sep - vmodule)); + int module_level; + if (sscanf(sep, "=%d", &module_level) == 1) { + auto* info = new VModuleInfo; + info->module_pattern = pattern; + info->vlog_level = module_level; + if (head) { + tail->next = info; + } else { + head = info; + } + tail = info; + } + // Skip past this entry + vmodule = strchr(sep, ','); + if (vmodule == nullptr) break; + vmodule++; // Skip past "," + } + if (head) { // Put them into the list at the head: + tail->next = vmodule_list; + vmodule_list = head; + } + inited_vmodule = true; +} + +// This can be called very early, so we use SpinLock and RAW_VLOG here. +int SetVLOGLevel(const char* module_pattern, int log_level) { + int result = FLAGS_v; + size_t const pattern_len = strlen(module_pattern); + bool found = false; + { + MutexLock l(&vmodule_lock); // protect whole read-modify-write + for (const VModuleInfo* info = vmodule_list; info != nullptr; + info = info->next) { + if (info->module_pattern == module_pattern) { + if (!found) { + result = info->vlog_level; + found = true; + } + info->vlog_level = log_level; + } else if (!found && + SafeFNMatch_(info->module_pattern.c_str(), + info->module_pattern.size(), + module_pattern, pattern_len)) { + result = info->vlog_level; + found = true; + } + } + if (!found) { + auto* info = new VModuleInfo; + info->module_pattern = module_pattern; + info->vlog_level = log_level; + info->next = vmodule_list; + vmodule_list = info; + + SiteFlag** item_ptr = &cached_site_list; + SiteFlag* item = cached_site_list; + + // We traverse the list fully because the pattern can match several items + // from the list. + while (item) { + if (SafeFNMatch_(module_pattern, pattern_len, item->base_name, + item->base_len)) { + // Redirect the cached value to its module override. + item->level = &info->vlog_level; + *item_ptr = item->next; // Remove the item from the list. + } else { + item_ptr = &item->next; + } + item = *item_ptr; + } + } + } + RAW_VLOG(1, "Set VLOG level for \"%s\" to %d", module_pattern, log_level); + return result; +} + +// NOTE: Individual VLOG statements cache the integer log level pointers. +// NOTE: This function must not allocate memory or require any locks. +bool InitVLOG3__(SiteFlag* site_flag, int32* level_default, + const char* fname, int32 verbose_level) { + MutexLock l(&vmodule_lock); + bool read_vmodule_flag = inited_vmodule; + if (!read_vmodule_flag) { + VLOG2Initializer(); + } + + // protect the errno global in case someone writes: + // VLOG(..) << "The last error was " << strerror(errno) + int old_errno = errno; + + // site_default normally points to FLAGS_v + int32* site_flag_value = level_default; + + // Get basename for file + const char* base = strrchr(fname, '/'); + +#ifdef _WIN32 + if (!base) { + base = strrchr(fname, '\\'); + } +#endif + + base = base ? (base+1) : fname; + const char* base_end = strchr(base, '.'); + size_t base_length = + base_end ? static_cast(base_end - base) : strlen(base); + + // Trim out trailing "-inl" if any + if (base_length >= 4 && (memcmp(base+base_length-4, "-inl", 4) == 0)) { + base_length -= 4; + } + + // TODO: Trim out _unittest suffix? Perhaps it is better to have + // the extra control and just leave it there. + + // find target in vector of modules, replace site_flag_value with + // a module-specific verbose level, if any. + for (const VModuleInfo* info = vmodule_list; info != nullptr; + info = info->next) { + if (SafeFNMatch_(info->module_pattern.c_str(), info->module_pattern.size(), + base, base_length)) { + site_flag_value = &info->vlog_level; + // value at info->vlog_level is now what controls + // the VLOG at the caller site forever + break; + } + } + + // Cache the vlog value pointer if --vmodule flag has been parsed. + ANNOTATE_BENIGN_RACE(site_flag, + "*site_flag may be written by several threads," + " but the value will be the same"); + if (read_vmodule_flag) { + site_flag->level = site_flag_value; + // If VLOG flag has been cached to the default site pointer, + // we want to add to the cached list in order to invalidate in case + // SetVModule is called afterwards with new modules. + // The performance penalty here is neglible, because InitVLOG3__ is called + // once per site. + if (site_flag_value == level_default && !site_flag->base_name) { + site_flag->base_name = base; + site_flag->base_len = base_length; + site_flag->next = cached_site_list; + cached_site_list = site_flag; + } + } + + // restore the errno in case something recoverable went wrong during + // the initialization of the VLOG mechanism (see above note "protect the..") + errno = old_errno; + return *site_flag_value >= verbose_level; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/runtime/onnxruntime/third_party/glog/src/windows/dirent.h b/runtime/onnxruntime/third_party/glog/src/windows/dirent.h new file mode 100644 index 0000000..097ad20 --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/windows/dirent.h @@ -0,0 +1,1145 @@ +/* + * Dirent interface for Microsoft Visual Studio + * + * Copyright (C) 1998-2019 Toni Ronkko + * This file is part of dirent. Dirent may be freely distributed + * under the MIT license. For all details and documentation, see + * https://github.com/tronkko/dirent + */ +#ifndef DIRENT_H +#define DIRENT_H + +/* Hide warnings about unreferenced local functions */ +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wunused-function" +#elif defined(_MSC_VER) +# pragma warning(disable:4505) +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wunused-function" +#endif + +/* + * Include windows.h without Windows Sockets 1.1 to prevent conflicts with + * Windows Sockets 2.0. + */ +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* Indicates that d_type field is available in dirent structure */ +#define _DIRENT_HAVE_D_TYPE + +/* Indicates that d_namlen field is available in dirent structure */ +#define _DIRENT_HAVE_D_NAMLEN + +/* Entries missing from MSVC 6.0 */ +#if !defined(FILE_ATTRIBUTE_DEVICE) +# define FILE_ATTRIBUTE_DEVICE 0x40 +#endif + +/* File type and permission flags for stat(), general mask */ +#if !defined(S_IFMT) +# define S_IFMT _S_IFMT +#endif + +/* Directory bit */ +#if !defined(S_IFDIR) +# define S_IFDIR _S_IFDIR +#endif + +/* Character device bit */ +#if !defined(S_IFCHR) +# define S_IFCHR _S_IFCHR +#endif + +/* Pipe bit */ +#if !defined(S_IFFIFO) +# define S_IFFIFO _S_IFFIFO +#endif + +/* Regular file bit */ +#if !defined(S_IFREG) +# define S_IFREG _S_IFREG +#endif + +/* Read permission */ +#if !defined(S_IREAD) +# define S_IREAD _S_IREAD +#endif + +/* Write permission */ +#if !defined(S_IWRITE) +# define S_IWRITE _S_IWRITE +#endif + +/* Execute permission */ +#if !defined(S_IEXEC) +# define S_IEXEC _S_IEXEC +#endif + +/* Pipe */ +#if !defined(S_IFIFO) +# define S_IFIFO _S_IFIFO +#endif + +/* Block device */ +#if !defined(S_IFBLK) +# define S_IFBLK 0 +#endif + +/* Link */ +#if !defined(S_IFLNK) +# define S_IFLNK 0 +#endif + +/* Socket */ +#if !defined(S_IFSOCK) +# define S_IFSOCK 0 +#endif + +/* Read user permission */ +#if !defined(S_IRUSR) +# define S_IRUSR S_IREAD +#endif + +/* Write user permission */ +#if !defined(S_IWUSR) +# define S_IWUSR S_IWRITE +#endif + +/* Execute user permission */ +#if !defined(S_IXUSR) +# define S_IXUSR 0 +#endif + +/* Read group permission */ +#if !defined(S_IRGRP) +# define S_IRGRP 0 +#endif + +/* Write group permission */ +#if !defined(S_IWGRP) +# define S_IWGRP 0 +#endif + +/* Execute group permission */ +#if !defined(S_IXGRP) +# define S_IXGRP 0 +#endif + +/* Read others permission */ +#if !defined(S_IROTH) +# define S_IROTH 0 +#endif + +/* Write others permission */ +#if !defined(S_IWOTH) +# define S_IWOTH 0 +#endif + +/* Execute others permission */ +#if !defined(S_IXOTH) +# define S_IXOTH 0 +#endif + +/* Maximum length of file name */ +#if !defined(PATH_MAX) +# define PATH_MAX MAX_PATH +#endif +#if !defined(FILENAME_MAX) +# define FILENAME_MAX MAX_PATH +#endif +#if !defined(NAME_MAX) +# define NAME_MAX FILENAME_MAX +#endif + +/* File type flags for d_type */ +#define DT_UNKNOWN 0 +#define DT_REG S_IFREG +#define DT_DIR S_IFDIR +#define DT_FIFO S_IFIFO +#define DT_SOCK S_IFSOCK +#define DT_CHR S_IFCHR +#define DT_BLK S_IFBLK +#define DT_LNK S_IFLNK + +/* Macros for converting between st_mode and d_type */ +#define IFTODT(mode) ((mode) & S_IFMT) +#define DTTOIF(type) (type) + +/* + * File type macros. Note that block devices, sockets and links cannot be + * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are + * only defined for compatibility. These macros should always return false + * on Windows. + */ +#if !defined(S_ISFIFO) +# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#endif +#if !defined(S_ISDIR) +# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif +#if !defined(S_ISREG) +# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif +#if !defined(S_ISLNK) +# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#endif +#if !defined(S_ISSOCK) +# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) +#endif +#if !defined(S_ISCHR) +# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#endif +#if !defined(S_ISBLK) +# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#endif + +/* Return the exact length of the file name without zero terminator */ +#define _D_EXACT_NAMLEN(p) ((p)->d_namlen) + +/* Return the maximum size of a file name */ +#define _D_ALLOC_NAMLEN(p) ((PATH_MAX)+1) + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Wide-character version */ +struct _wdirent { + /* Always zero */ + long d_ino; + + /* File position within stream */ + long d_off; + + /* Structure size */ + unsigned short d_reclen; + + /* Length of name without \0 */ + size_t d_namlen; + + /* File type */ + int d_type; + + /* File name */ + wchar_t d_name[PATH_MAX+1]; +}; + +struct _WDIR { + /* Current directory entry */ + _wdirent ent; + + /* Private file data */ + WIN32_FIND_DATAW data; + + /* True if data is valid */ + int cached; + + /* Win32 search handle */ + HANDLE handle; + + /* Initial directory name */ + wchar_t *patt; +}; + +/* Multi-byte character version */ +struct dirent { + /* Always zero */ + long d_ino; + + /* File position within stream */ + long d_off; + + /* Structure size */ + unsigned short d_reclen; + + /* Length of name without \0 */ + size_t d_namlen; + + /* File type */ + int d_type; + + /* File name */ + char d_name[PATH_MAX+1]; +}; + +struct DIR { + struct dirent ent; + struct _WDIR *wdirp; +}; + +/* Dirent functions */ +static DIR *opendir (const char *dirname); +static _WDIR *_wopendir (const wchar_t *dirname); + +static struct dirent *readdir (DIR *dirp); +static struct _wdirent *_wreaddir (_WDIR *dirp); + +static int readdir_r( + DIR *dirp, struct dirent *entry, struct dirent **result); +static int _wreaddir_r( + _WDIR *dirp, struct _wdirent *entry, struct _wdirent **result); + +static int closedir (DIR *dirp); +static int _wclosedir (_WDIR *dirp); + +static void rewinddir (DIR* dirp); +static void _wrewinddir (_WDIR* dirp); + +static int scandir (const char *dirname, struct dirent ***namelist, + int (*filter)(const struct dirent*), + int (*compare)(const struct dirent**, const struct dirent**)); + +static int alphasort (const struct dirent **a, const struct dirent **b); + +static int versionsort (const struct dirent **a, const struct dirent **b); + + +/* For compatibility with Symbian */ +#define wdirent _wdirent +#define WDIR _WDIR +#define wopendir _wopendir +#define wreaddir _wreaddir +#define wclosedir _wclosedir +#define wrewinddir _wrewinddir + + +/* Internal utility functions */ +static WIN32_FIND_DATAW *dirent_first (_WDIR *dirp); +static WIN32_FIND_DATAW *dirent_next (_WDIR *dirp); + +static int dirent_mbstowcs_s( + size_t *pReturnValue, + wchar_t *wcstr, + size_t sizeInWords, + const char *mbstr, + size_t count); + +static int dirent_wcstombs_s( + size_t *pReturnValue, + char *mbstr, + size_t sizeInBytes, + const wchar_t *wcstr, + size_t count); + +static void dirent_set_errno (int error); + + +/* + * Open directory stream DIRNAME for read and return a pointer to the + * internal working area that is used to retrieve individual directory + * entries. + */ +static _WDIR* +_wopendir( + const wchar_t *dirname) +{ + _WDIR *dirp; + DWORD n; + wchar_t *p; + + /* Must have directory name */ + if (dirname == nullptr || dirname[0] == '\0') { + dirent_set_errno(ENOENT); + return nullptr; + } + + /* Allocate new _WDIR structure */ + dirp = (_WDIR*) malloc (sizeof (struct _WDIR)); + if (!dirp) { + return nullptr; + } + + /* Reset _WDIR structure */ + dirp->handle = INVALID_HANDLE_VALUE; + dirp->patt = nullptr; + dirp->cached = 0; + + /* + * Compute the length of full path plus zero terminator + * + * Note that on WinRT there's no way to convert relative paths + * into absolute paths, so just assume it is an absolute path. + */ +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + /* Desktop */ + n = GetFullPathNameW(dirname, 0, nullptr, nullptr); +#else + /* WinRT */ + n = wcslen (dirname); +#endif + + /* Allocate room for absolute directory name and search pattern */ + dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16); + if (dirp->patt == nullptr) { + goto exit_closedir; + } + + /* + * Convert relative directory name to an absolute one. This + * allows rewinddir() to function correctly even when current + * working directory is changed between opendir() and rewinddir(). + * + * Note that on WinRT there's no way to convert relative paths + * into absolute paths, so just assume it is an absolute path. + */ +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + /* Desktop */ + n = GetFullPathNameW(dirname, n, dirp->patt, nullptr); + if (n <= 0) { + goto exit_closedir; + } +#else + /* WinRT */ + wcsncpy_s (dirp->patt, n+1, dirname, n); +#endif + + /* Append search pattern \* to the directory name */ + p = dirp->patt + n; + switch (p[-1]) { + case '\\': + case '/': + case ':': + /* Directory ends in path separator, e.g. c:\temp\ */ + /*NOP*/; + break; + + default: + /* Directory name doesn't end in path separator */ + *p++ = '\\'; + } + *p++ = '*'; + *p = '\0'; + + /* Open directory stream and retrieve the first entry */ + if (!dirent_first (dirp)) { + goto exit_closedir; + } + + /* Success */ + return dirp; + + /* Failure */ +exit_closedir: + _wclosedir (dirp); + return nullptr; +} + +/* + * Read next directory entry. + * + * Returns pointer to static directory entry which may be overwritten by + * subsequent calls to _wreaddir(). + */ +static struct _wdirent* +_wreaddir( + _WDIR *dirp) +{ + struct _wdirent *entry; + + /* + * Read directory entry to buffer. We can safely ignore the return value + * as entry will be set to nullptr in case of error. + */ + (void) _wreaddir_r (dirp, &dirp->ent, &entry); + + /* Return pointer to statically allocated directory entry */ + return entry; +} + +/* + * Read next directory entry. + * + * Returns zero on success. If end of directory stream is reached, then sets + * result to nullptr and returns zero. + */ +static int +_wreaddir_r( + _WDIR *dirp, + struct _wdirent *entry, + struct _wdirent **result) +{ + WIN32_FIND_DATAW *datap; + + /* Read next directory entry */ + datap = dirent_next (dirp); + if (datap) { + size_t n; + DWORD attr; + + /* + * Copy file name as wide-character string. If the file name is too + * long to fit in to the destination buffer, then truncate file name + * to PATH_MAX characters and zero-terminate the buffer. + */ + n = 0; + while (n < PATH_MAX && datap->cFileName[n] != 0) { + entry->d_name[n] = datap->cFileName[n]; + n++; + } + entry->d_name[n] = 0; + + /* Length of file name excluding zero terminator */ + entry->d_namlen = n; + + /* File type */ + attr = datap->dwFileAttributes; + if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) { + entry->d_type = DT_CHR; + } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) { + entry->d_type = DT_DIR; + } else { + entry->d_type = DT_REG; + } + + /* Reset dummy fields */ + entry->d_ino = 0; + entry->d_off = 0; + entry->d_reclen = sizeof (struct _wdirent); + + /* Set result address */ + *result = entry; + + } else { + /* Return nullptr to indicate end of directory */ + *result = nullptr; + } + + return /*OK*/0; +} + +/* + * Close directory stream opened by opendir() function. This invalidates the + * DIR structure as well as any directory entry read previously by + * _wreaddir(). + */ +static int +_wclosedir( + _WDIR *dirp) +{ + int ok; + if (dirp) { + + /* Release search handle */ + if (dirp->handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->handle); + } + + /* Release search pattern */ + free (dirp->patt); + + /* Release directory structure */ + free (dirp); + ok = /*success*/0; + + } else { + + /* Invalid directory stream */ + dirent_set_errno (EBADF); + ok = /*failure*/-1; + + } + return ok; +} + +/* + * Rewind directory stream such that _wreaddir() returns the very first + * file name again. + */ +static void +_wrewinddir( + _WDIR* dirp) +{ + if (dirp) { + /* Release existing search handle */ + if (dirp->handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->handle); + } + + /* Open new search handle */ + dirent_first (dirp); + } +} + +/* Get first directory entry (internal) */ +static WIN32_FIND_DATAW* +dirent_first( + _WDIR *dirp) +{ + WIN32_FIND_DATAW *datap; + DWORD error; + + /* Open directory and retrieve the first entry */ + dirp->handle = FindFirstFileExW(dirp->patt, FindExInfoStandard, &dirp->data, + FindExSearchNameMatch, nullptr, 0); + if (dirp->handle != INVALID_HANDLE_VALUE) { + + /* a directory entry is now waiting in memory */ + datap = &dirp->data; + dirp->cached = 1; + + } else { + + /* Failed to open directory: no directory entry in memory */ + dirp->cached = 0; + datap = nullptr; + + /* Set error code */ + error = GetLastError (); + switch (error) { + case ERROR_ACCESS_DENIED: + /* No read access to directory */ + dirent_set_errno (EACCES); + break; + + case ERROR_DIRECTORY: + /* Directory name is invalid */ + dirent_set_errno (ENOTDIR); + break; + + case ERROR_PATH_NOT_FOUND: + default: + /* Cannot find the file */ + dirent_set_errno (ENOENT); + } + + } + return datap; +} + +/* + * Get next directory entry (internal). + * + * Returns + */ +static WIN32_FIND_DATAW* +dirent_next( + _WDIR *dirp) +{ + WIN32_FIND_DATAW *p; + + /* Get next directory entry */ + if (dirp->cached != 0) { + + /* A valid directory entry already in memory */ + p = &dirp->data; + dirp->cached = 0; + + } else if (dirp->handle != INVALID_HANDLE_VALUE) { + + /* Get the next directory entry from stream */ + if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) { + /* Got a file */ + p = &dirp->data; + } else { + /* The very last entry has been processed or an error occurred */ + FindClose (dirp->handle); + dirp->handle = INVALID_HANDLE_VALUE; + p = nullptr; + } + + } else { + + /* End of directory stream reached */ + p = nullptr; + } + + return p; +} + +/* + * Open directory stream using plain old C-string. + */ +static DIR* +opendir( + const char *dirname) +{ + struct DIR *dirp; + + /* Must have directory name */ + if (dirname == nullptr || dirname[0] == '\0') { + dirent_set_errno (ENOENT); + return nullptr; + } + + /* Allocate memory for DIR structure */ + dirp = (DIR*) malloc (sizeof (struct DIR)); + if (!dirp) { + return nullptr; + } + { + int error; + wchar_t wname[PATH_MAX + 1]; + size_t n; + + /* Convert directory name to wide-character string */ + error = dirent_mbstowcs_s( + &n, wname, PATH_MAX + 1, dirname, PATH_MAX + 1); + if (error) { + /* + * Cannot convert file name to wide-character string. This + * occurs if the string contains invalid multi-byte sequences or + * the output buffer is too small to contain the resulting + * string. + */ + goto exit_free; + } + + + /* Open directory stream using wide-character name */ + dirp->wdirp = _wopendir (wname); + if (!dirp->wdirp) { + goto exit_free; + } + + } + + /* Success */ + return dirp; + + /* Failure */ +exit_free: + free (dirp); + return nullptr; +} + +/* + * Read next directory entry. + */ +static struct dirent* +readdir( + DIR *dirp) +{ + struct dirent *entry; + + /* + * Read directory entry to buffer. We can safely ignore the return value + * as entry will be set to nullptr in case of error. + */ + (void) readdir_r (dirp, &dirp->ent, &entry); + + /* Return pointer to statically allocated directory entry */ + return entry; +} + +/* + * Read next directory entry into called-allocated buffer. + * + * Returns zero on success. If the end of directory stream is reached, then + * sets result to nullptr and returns zero. + */ +static int +readdir_r( + DIR *dirp, + struct dirent *entry, + struct dirent **result) +{ + WIN32_FIND_DATAW *datap; + + /* Read next directory entry */ + datap = dirent_next (dirp->wdirp); + if (datap) { + size_t n; + int error; + + /* Attempt to convert file name to multi-byte string */ + error = dirent_wcstombs_s( + &n, entry->d_name, PATH_MAX + 1, datap->cFileName, PATH_MAX + 1); + + /* + * If the file name cannot be represented by a multi-byte string, + * then attempt to use old 8+3 file name. This allows traditional + * Unix-code to access some file names despite of unicode + * characters, although file names may seem unfamiliar to the user. + * + * Be ware that the code below cannot come up with a short file + * name unless the file system provides one. At least + * VirtualBox shared folders fail to do this. + */ + if (error && datap->cAlternateFileName[0] != '\0') { + error = dirent_wcstombs_s( + &n, entry->d_name, PATH_MAX + 1, + datap->cAlternateFileName, PATH_MAX + 1); + } + + if (!error) { + DWORD attr; + + /* Length of file name excluding zero terminator */ + entry->d_namlen = n - 1; + + /* File attributes */ + attr = datap->dwFileAttributes; + if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) { + entry->d_type = DT_CHR; + } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) { + entry->d_type = DT_DIR; + } else { + entry->d_type = DT_REG; + } + + /* Reset dummy fields */ + entry->d_ino = 0; + entry->d_off = 0; + entry->d_reclen = sizeof (struct dirent); + + } else { + /* + * Cannot convert file name to multi-byte string so construct + * an erroneous directory entry and return that. Note that + * we cannot return nullptr as that would stop the processing + * of directory entries completely. + */ + entry->d_name[0] = '?'; + entry->d_name[1] = '\0'; + entry->d_namlen = 1; + entry->d_type = DT_UNKNOWN; + entry->d_ino = 0; + entry->d_off = -1; + entry->d_reclen = 0; + + } + + /* Return pointer to directory entry */ + *result = entry; + + } else { + + /* No more directory entries */ + *result = nullptr; + } + + return /*OK*/0; +} + +/* + * Close directory stream. + */ +static int +closedir( + DIR *dirp) +{ + int ok; + if (dirp) { + + /* Close wide-character directory stream */ + ok = _wclosedir (dirp->wdirp); + dirp->wdirp = nullptr; + + /* Release multi-byte character version */ + free (dirp); + + } else { + + /* Invalid directory stream */ + dirent_set_errno (EBADF); + ok = /*failure*/-1; + + } + return ok; +} + +/* + * Rewind directory stream to beginning. + */ +static void +rewinddir( + DIR* dirp) +{ + /* Rewind wide-character string directory stream */ + _wrewinddir (dirp->wdirp); +} + +/* + * Scan directory for entries. + */ +static int +scandir( + const char *dirname, + struct dirent ***namelist, + int (*filter)(const struct dirent*), + int (*compare)(const struct dirent**, const struct dirent**)) +{ + struct dirent **files = nullptr; + size_t size = 0; + size_t allocated = 0; + const size_t init_size = 1; + DIR *dir = nullptr; + struct dirent *entry; + struct dirent *tmp = nullptr; + size_t i; + int result = 0; + + /* Open directory stream */ + dir = opendir (dirname); + if (dir) { + + /* Read directory entries to memory */ + while (1) { + + /* Enlarge pointer table to make room for another pointer */ + if (size >= allocated) { + void *p; + size_t num_entries; + + /* Compute number of entries in the enlarged pointer table */ + if (size < init_size) { + /* Allocate initial pointer table */ + num_entries = init_size; + } else { + /* Double the size */ + num_entries = size * 2; + } + + /* Allocate first pointer table or enlarge existing table */ + p = realloc (files, sizeof (void*) * num_entries); + if (p != nullptr) { + /* Got the memory */ + files = (dirent**) p; + allocated = num_entries; + } else { + /* Out of memory */ + result = -1; + break; + } + } + + /* Allocate room for temporary directory entry */ + if (tmp == nullptr) { + tmp = (struct dirent*) malloc (sizeof (struct dirent)); + if (tmp == nullptr) { + /* Cannot allocate temporary directory entry */ + result = -1; + break; + } + } + + /* Read directory entry to temporary area */ + if (readdir_r (dir, tmp, &entry) == /*OK*/0) { + + /* Did we get an entry? */ + if (entry != nullptr) { + int pass; + + /* Determine whether to include the entry in result */ + if (filter) { + /* Let the filter function decide */ + pass = filter (tmp); + } else { + /* No filter function, include everything */ + pass = 1; + } + + if (pass) { + /* Store the temporary entry to pointer table */ + files[size++] = tmp; + tmp = nullptr; + + /* Keep up with the number of files */ + result++; + } + + } else { + /* + * End of directory stream reached => sort entries and + * exit. + */ + qsort (files, size, sizeof (void*), + (int (*) (const void*, const void*)) compare); + break; + } + + } else { + /* Error reading directory entry */ + result = /*Error*/ -1; + break; + } + + } + + } else { + /* Cannot open directory */ + result = /*Error*/ -1; + } + + /* Release temporary directory entry */ + free (tmp); + + /* Release allocated memory on error */ + if (result < 0) { + for (i = 0; i < size; i++) { + free (files[i]); + } + free (files); + files = nullptr; + } + + /* Close directory stream */ + if (dir) { + closedir (dir); + } + + /* Pass pointer table to caller */ + if (namelist) { + *namelist = files; + } + return result; +} + +/* Alphabetical sorting */ +static int +alphasort( + const struct dirent **a, const struct dirent **b) +{ + return strcoll ((*a)->d_name, (*b)->d_name); +} + +/* Sort versions */ +static int +versionsort( + const struct dirent **a, const struct dirent **b) +{ + /* FIXME: implement strverscmp and use that */ + return alphasort (a, b); +} + +/* Convert multi-byte string to wide character string */ +static int +dirent_mbstowcs_s( + size_t *pReturnValue, + wchar_t *wcstr, + size_t sizeInWords, + const char *mbstr, + size_t count) +{ + int error; + +#if defined(_MSC_VER) && _MSC_VER >= 1400 + + /* Microsoft Visual Studio 2005 or later */ + error = mbstowcs_s (pReturnValue, wcstr, sizeInWords, mbstr, count); + +#else + + /* Older Visual Studio or non-Microsoft compiler */ + size_t n; + + /* Convert to wide-character string (or count characters) */ + n = mbstowcs (wcstr, mbstr, sizeInWords); + if (!wcstr || n < count) { + + /* Zero-terminate output buffer */ + if (wcstr && sizeInWords) { + if (n >= sizeInWords) { + n = sizeInWords - 1; + } + wcstr[n] = 0; + } + + /* Length of resulting multi-byte string WITH zero terminator */ + if (pReturnValue) { + *pReturnValue = n + 1; + } + + /* Success */ + error = 0; + + } else { + + /* Could not convert string */ + error = 1; + + } + +#endif + return error; +} + +/* Convert wide-character string to multi-byte string */ +static int +dirent_wcstombs_s( + size_t *pReturnValue, + char *mbstr, + size_t sizeInBytes, /* max size of mbstr */ + const wchar_t *wcstr, + size_t count) +{ + int error; + +#if defined(_MSC_VER) && _MSC_VER >= 1400 + + /* Microsoft Visual Studio 2005 or later */ + error = wcstombs_s (pReturnValue, mbstr, sizeInBytes, wcstr, count); + +#else + + /* Older Visual Studio or non-Microsoft compiler */ + size_t n; + + /* Convert to multi-byte string (or count the number of bytes needed) */ + n = wcstombs (mbstr, wcstr, sizeInBytes); + if (!mbstr || n < count) { + + /* Zero-terminate output buffer */ + if (mbstr && sizeInBytes) { + if (n >= sizeInBytes) { + n = sizeInBytes - 1; + } + mbstr[n] = '\0'; + } + + /* Length of resulting multi-bytes string WITH zero-terminator */ + if (pReturnValue) { + *pReturnValue = n + 1; + } + + /* Success */ + error = 0; + + } else { + + /* Cannot convert string */ + error = 1; + + } + +#endif + return error; +} + +/* Set errno variable */ +static void +dirent_set_errno( + int error) +{ +#if defined(_MSC_VER) && _MSC_VER >= 1400 + + /* Microsoft Visual Studio 2005 and later */ + _set_errno (error); + +#else + + /* Non-Microsoft compiler or older Microsoft compiler */ + errno = error; + +#endif +} + + +#ifdef __cplusplus +} +#endif +#endif /*DIRENT_H*/ diff --git a/runtime/onnxruntime/third_party/glog/src/windows/port.cc b/runtime/onnxruntime/third_party/glog/src/windows/port.cc new file mode 100644 index 0000000..f80a54a --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/windows/port.cc @@ -0,0 +1,75 @@ +/* Copyright (c) 2008, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * --- + * Author: Craig Silverstein + * Copied from google-perftools and modified by Shinichiro Hamaji + */ + +#ifndef _WIN32 +# error You should only be including windows/port.cc in a windows environment! +#endif + +#include "port.h" + +#include // for va_list, va_start, va_end +#include + +#include "config.h" + +// These call the windows _vsnprintf, but always NUL-terminate. +int safe_vsnprintf(char* str, std::size_t size, const char* format, + va_list ap) { + if (size == 0) // not even room for a \0? + return -1; // not what C99 says to do, but what windows does + str[size-1] = '\0'; + return _vsnprintf(str, size-1, format, ap); +} + +#ifndef HAVE_LOCALTIME_R +struct tm* localtime_r(const std::time_t* timep, std::tm* result) { + localtime_s(result, timep); + return result; +} +#endif // not HAVE_LOCALTIME_R +#ifndef HAVE_GMTIME_R +struct tm* gmtime_r(const std::time_t* timep, std::tm* result) { + gmtime_s(result, timep); + return result; +} +#endif // not HAVE_GMTIME_R +#ifndef HAVE_SNPRINTF +int snprintf(char *str, size_t size, const char *format, ...) { + va_list ap; + va_start(ap, format); + const int r = vsnprintf(str, size, format, ap); + va_end(ap); + return r; +} +#endif diff --git a/runtime/onnxruntime/third_party/glog/src/windows/port.h b/runtime/onnxruntime/third_party/glog/src/windows/port.h new file mode 100644 index 0000000..eecc46f --- /dev/null +++ b/runtime/onnxruntime/third_party/glog/src/windows/port.h @@ -0,0 +1,181 @@ +/* Copyright (c) 2023, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * --- + * Author: Craig Silverstein + * Copied from google-perftools and modified by Shinichiro Hamaji + * + * These are some portability typedefs and defines to make it a bit + * easier to compile this code under VC++. + * + * Several of these are taken from glib: + * http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html + */ + +#ifndef CTEMPLATE_WINDOWS_PORT_H_ +#define CTEMPLATE_WINDOWS_PORT_H_ + +#include "config.h" + +#ifdef _WIN32 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN /* We always want minimal includes */ +#endif + +#include +#include /* for gethostname */ +#include /* because we so often use open/close/etc */ +#include /* for _getcwd() */ +#include /* for _getpid() */ +#include /* template_dictionary.cc uses va_copy */ +#include /* read in vsnprintf decl. before redifining it */ +#include /* for _strnicmp(), strerror_s() */ +#include /* for localtime_s() */ +/* Note: the C++ #includes are all together at the bottom. This file is + * used by both C and C++ code, so we put all the C++ together. + */ + +#include "glog/logging.h" + +#ifdef _MSC_VER + +/* 4244: otherwise we get problems when substracting two size_t's to an int + * 4251: it's complaining about a private struct I've chosen not to dllexport + * 4355: we use this in a constructor, but we do it safely + * 4715: for some reason VC++ stopped realizing you can't return after abort() + * 4800: we know we're casting ints/char*'s to bools, and we're ok with that + * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror() + * 4312: Converting uint32_t to a pointer when testing %p + * 4267: also subtracting two size_t to int + * 4722: Destructor never returns due to abort() + */ +#pragma warning(disable:4244 4251 4355 4715 4800 4996 4267 4312 4722) + +/* file I/O */ +#define PATH_MAX 1024 +#define access _access +#define getcwd _getcwd +#define open _open +#define read _read +#define write(fd, p, n) _write(fd, p, n) +#define lseek _lseek +#define close _close +#define popen _popen +#define pclose _pclose +#define R_OK 04 /* read-only (for access()) */ +#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) + +#define O_WRONLY _O_WRONLY +#define O_CREAT _O_CREAT +#define O_EXCL _O_EXCL + +#ifndef __MINGW32__ +enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 }; +#endif +#define S_IRUSR S_IREAD +#define S_IWUSR S_IWRITE + +/* Not quite as lightweight as a hard-link, but more than good enough for us. */ +#define link(oldpath, newpath) CopyFileA(oldpath, newpath, false) + +#define strcasecmp _stricmp +#define strncasecmp _strnicmp + +/* In windows-land, hash<> is called hash_compare<> (from xhash.h) */ +/* VC11 provides std::hash */ +#if defined(_MSC_VER) && (_MSC_VER < 1700) +#define hash hash_compare +#endif + +/* Sleep is in ms, on windows */ +#define sleep(secs) Sleep((secs) * 1000) + +/* We can't just use _vsnprintf and _snprintf as drop-in-replacements, + * because they don't always NUL-terminate. :-( We also can't use the + * name vsnprintf, since windows defines that (but not snprintf (!)). + */ +#ifndef HAVE_SNPRINTF +extern int GLOG_EXPORT snprintf(char* str, size_t size, const char* format, + ...); +#endif +extern int GLOG_EXPORT safe_vsnprintf(char* str, size_t size, + const char* format, va_list ap); +#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) +#ifndef va_copy +#define va_copy(dst, src) (dst) = (src) +#endif + +/* Windows doesn't support specifying the number of buckets as a + * hash_map constructor arg, so we leave this blank. + */ +#define CTEMPLATE_SMALL_HASHTABLE + +#define DEFAULT_TEMPLATE_ROOTDIR ".." + +// ----------------------------------- SYSTEM/PROCESS +typedef int pid_t; +#define getpid _getpid + +#endif // _MSC_VER + +// ----------------------------------- THREADS +#if defined(HAVE_PTHREAD) +# include +#else // no PTHREAD +typedef DWORD pthread_t; +typedef DWORD pthread_key_t; +typedef LONG pthread_once_t; +enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock +#define pthread_self GetCurrentThreadId +#define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2)) +#endif // HAVE_PTHREAD + +#ifndef HAVE_LOCALTIME_R +extern GLOG_EXPORT std::tm* localtime_r(const std::time_t* timep, + std::tm* result); +#endif // not HAVE_LOCALTIME_R + +#ifndef HAVE_GMTIME_R +extern GLOG_EXPORT std::tm* gmtime_r(const std::time_t* timep, std::tm* result); +#endif // not HAVE_GMTIME_R + +inline char* strerror_r(int errnum, char* buf, std::size_t buflen) { + strerror_s(buf, buflen, errnum); + return buf; +} + +#ifndef __cplusplus +/* I don't see how to get inlining for C code in MSVC. Ah well. */ +#define inline +#endif + +#endif /* _WIN32 */ + +#endif /* CTEMPLATE_WINDOWS_PORT_H_ */ diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/DictTrie.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/DictTrie.hpp new file mode 100644 index 0000000..c219a01 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/DictTrie.hpp @@ -0,0 +1,274 @@ +#ifndef CPPJIEBA_DICT_TRIE_HPP +#define CPPJIEBA_DICT_TRIE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "limonp/StringUtil.hpp" +#include "limonp/Logging.hpp" +#include "Unicode.hpp" +#include "Trie.hpp" + +namespace cppjieba { + +using namespace limonp; + +const double MIN_DOUBLE = -3.14e+100; +const double MAX_DOUBLE = 3.14e+100; +const size_t DICT_COLUMN_NUM = 3; +const char* const UNKNOWN_TAG = ""; + +class DictTrie { + public: + enum UserWordWeightOption { + WordWeightMin, + WordWeightMedian, + WordWeightMax, + }; // enum UserWordWeightOption + + DictTrie(const string& dict_path, const string& user_dict_paths = "", UserWordWeightOption user_word_weight_opt = WordWeightMedian) { + Init(dict_path, user_dict_paths, user_word_weight_opt); + } + ~DictTrie() { + delete trie_; + } + + bool InsertUserWord(const string& word, const string& tag = UNKNOWN_TAG) { + DictUnit node_info; + if (!MakeNodeInfo(node_info, word, user_word_default_weight_, tag)) { + return false; + } + active_node_infos_.push_back(node_info); + trie_->InsertNode(node_info.word, &active_node_infos_.back()); + return true; + } + + bool InsertUserWord(const string& word,int freq, const string& tag = UNKNOWN_TAG) { + DictUnit node_info; + double weight = freq ? log(1.0 * freq / freq_sum_) : user_word_default_weight_ ; + if (!MakeNodeInfo(node_info, word, weight , tag)) { + return false; + } + active_node_infos_.push_back(node_info); + trie_->InsertNode(node_info.word, &active_node_infos_.back()); + return true; + } + + bool DeleteUserWord(const string& word, const string& tag = UNKNOWN_TAG) { + DictUnit node_info; + if (!MakeNodeInfo(node_info, word, user_word_default_weight_, tag)) { + return false; + } + trie_->DeleteNode(node_info.word, &node_info); + return true; + } + + const DictUnit* Find(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end) const { + return trie_->Find(begin, end); + } + + void Find(RuneStrArray::const_iterator begin, + RuneStrArray::const_iterator end, + vector&res, + size_t max_word_len = MAX_WORD_LENGTH) const { + trie_->Find(begin, end, res, max_word_len); + } + + bool Find(const string& word) + { + const DictUnit *tmp = NULL; + RuneStrArray runes; + if (!DecodeRunesInString(word, runes)) + { + XLOG(ERROR) << "Decode failed."; + } + tmp = Find(runes.begin(), runes.end()); + if (tmp == NULL) + { + return false; + } + else + { + return true; + } + } + + bool IsUserDictSingleChineseWord(const Rune& word) const { + return IsIn(user_dict_single_chinese_word_, word); + } + + double GetMinWeight() const { + return min_weight_; + } + + void InserUserDictNode(const string& line) { + vector buf; + DictUnit node_info; + Split(line, buf, " "); + if(buf.size() == 1){ + MakeNodeInfo(node_info, + buf[0], + user_word_default_weight_, + UNKNOWN_TAG); + } else if (buf.size() == 2) { + MakeNodeInfo(node_info, + buf[0], + user_word_default_weight_, + buf[1]); + } else if (buf.size() == 3) { + int freq = atoi(buf[1].c_str()); + assert(freq_sum_ > 0.0); + double weight = log(1.0 * freq / freq_sum_); + MakeNodeInfo(node_info, buf[0], weight, buf[2]); + } + static_node_infos_.push_back(node_info); + if (node_info.word.size() == 1) { + user_dict_single_chinese_word_.insert(node_info.word[0]); + } + } + + void LoadUserDict(const vector& buf) { + for (size_t i = 0; i < buf.size(); i++) { + InserUserDictNode(buf[i]); + } + } + + void LoadUserDict(const set& buf) { + std::set::const_iterator iter; + for (iter = buf.begin(); iter != buf.end(); iter++){ + InserUserDictNode(*iter); + } + } + + void LoadUserDict(const string& filePaths) { + vector files = limonp::Split(filePaths, "|;"); + size_t lineno = 0; + for (size_t i = 0; i < files.size(); i++) { + ifstream ifs(files[i].c_str()); + XCHECK(ifs.is_open()) << "open " << files[i] << " failed"; + string line; + + for (; getline(ifs, line); lineno++) { + if (line.size() == 0) { + continue; + } + InserUserDictNode(line); + } + } + } + + + private: + void Init(const string& dict_path, const string& user_dict_paths, UserWordWeightOption user_word_weight_opt) { + LoadDict(dict_path); + Shrink(static_node_infos_); + CreateTrie(static_node_infos_); + } + + void CreateTrie(const vector& dictUnits) { + assert(dictUnits.size()); + vector words; + vector valuePointers; + for (size_t i = 0 ; i < dictUnits.size(); i ++) { + words.push_back(dictUnits[i].word); + valuePointers.push_back(&dictUnits[i]); + } + trie_ = new Trie(words, valuePointers); + } + + bool MakeNodeInfo(DictUnit& node_info, + const string& word, + double weight, + const string& tag) { + if (!DecodeRunesInString(word, node_info.word)) { + XLOG(ERROR) << "Decode " << word << " failed."; + return false; + } + node_info.weight = weight; + node_info.tag = tag; + return true; + } + + void LoadDict(const string& filePath) { + ifstream ifs(filePath.c_str()); + XCHECK(ifs.is_open()) << "open " << filePath << " failed."; + string line; + vector buf; + + DictUnit node_info; + for (size_t lineno = 0; getline(ifs, line); lineno++) { + Split(line, buf, " "); + XCHECK(buf.size() == DICT_COLUMN_NUM) << "split result illegal, line:" << line; + MakeNodeInfo(node_info, + buf[0], + atof(buf[1].c_str()), + buf[2]); + static_node_infos_.push_back(node_info); + } + } + + static bool WeightCompare(const DictUnit& lhs, const DictUnit& rhs) { + return lhs.weight < rhs.weight; + } + + void SetStaticWordWeights(UserWordWeightOption option) { + XCHECK(!static_node_infos_.empty()); + vector x = static_node_infos_; + sort(x.begin(), x.end(), WeightCompare); + min_weight_ = x[0].weight; + max_weight_ = x[x.size() - 1].weight; + median_weight_ = x[x.size() / 2].weight; + switch (option) { + case WordWeightMin: + user_word_default_weight_ = min_weight_; + break; + case WordWeightMedian: + user_word_default_weight_ = median_weight_; + break; + default: + user_word_default_weight_ = max_weight_; + break; + } + } + + double CalcFreqSum(const vector& node_infos) const { + double sum = 0.0; + for (size_t i = 0; i < node_infos.size(); i++) { + sum += node_infos[i].weight; + } + return sum; + } + + void CalculateWeight(vector& node_infos, double sum) const { + assert(sum > 0.0); + for (size_t i = 0; i < node_infos.size(); i++) { + DictUnit& node_info = node_infos[i]; + assert(node_info.weight > 0.0); + node_info.weight = log(double(node_info.weight)/sum); + } + } + + void Shrink(vector& units) const { + vector(units.begin(), units.end()).swap(units); + } + + vector static_node_infos_; + deque active_node_infos_; // must not be vector + Trie * trie_; + + double freq_sum_; + double min_weight_; + double max_weight_; + double median_weight_; + double user_word_default_weight_; + unordered_set user_dict_single_chinese_word_; +}; +} + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/FullSegment.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/FullSegment.hpp new file mode 100644 index 0000000..2295ceb --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/FullSegment.hpp @@ -0,0 +1,102 @@ +#ifndef CPPJIEBA_FULLSEGMENT_H +#define CPPJIEBA_FULLSEGMENT_H + +#include +#include +#include +#include "limonp/Logging.hpp" +#include "DictTrie.hpp" +#include "SegmentBase.hpp" +#include "Unicode.hpp" + +namespace cppjieba { +class FullSegment: public SegmentBase { + public: + FullSegment(const string& dictPath) { + dictTrie_ = new DictTrie(dictPath); + isNeedDestroy_ = true; + } + FullSegment(const DictTrie* dictTrie) + : dictTrie_(dictTrie), isNeedDestroy_(false) { + assert(dictTrie_); + } + FullSegment() { + dictTrie_ = NULL; + } + ~FullSegment() { + if (isNeedDestroy_) { + delete dictTrie_; + } + } + + void setRes(DictTrie *&dictTrie) { + dictTrie_ = dictTrie; + isNeedDestroy_ = false; + assert(dictTrie_); + } + void Cut(const string& sentence, + vector& words) const { + vector tmp; + Cut(sentence, tmp); + GetStringsFromWords(tmp, words); + } + void Cut(const string& sentence, + vector& words) const { + PreFilter pre_filter(symbols_, sentence); + PreFilter::Range range; + vector wrs; + wrs.reserve(sentence.size()/2); + while (pre_filter.HasNext()) { + range = pre_filter.Next(); + Cut(range.begin, range.end, wrs); + } + words.clear(); + words.reserve(wrs.size()); + GetWordsFromWordRanges(sentence, wrs, words); + } + void Cut(RuneStrArray::const_iterator begin, + RuneStrArray::const_iterator end, + vector& res) const { + // result of searching in trie tree + LocalVector > tRes; + + // max index of res's words + size_t maxIdx = 0; + + // always equals to (uItr - begin) + size_t uIdx = 0; + + // tmp variables + size_t wordLen = 0; + assert(dictTrie_); + vector dags; + dictTrie_->Find(begin, end, dags); + for (size_t i = 0; i < dags.size(); i++) { + for (size_t j = 0; j < dags[i].nexts.size(); j++) { + size_t nextoffset = dags[i].nexts[j].first; + assert(nextoffset < dags.size()); + const DictUnit* du = dags[i].nexts[j].second; + if (du == NULL) { + if (dags[i].nexts.size() == 1 && maxIdx <= uIdx) { + WordRange wr(begin + i, begin + nextoffset); + res.push_back(wr); + } + } else { + wordLen = du->word.size(); + if (wordLen >= 2 || (dags[i].nexts.size() == 1 && maxIdx <= uIdx)) { + WordRange wr(begin + i, begin + nextoffset); + res.push_back(wr); + } + } + maxIdx = uIdx + wordLen > maxIdx ? uIdx + wordLen : maxIdx; + } + uIdx++; + } + } + private: + const DictTrie* dictTrie_; + bool isNeedDestroy_; +}; +} + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/HMMModel.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/HMMModel.hpp new file mode 100644 index 0000000..27e6b66 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/HMMModel.hpp @@ -0,0 +1,129 @@ +#ifndef CPPJIEBA_HMMMODEL_H +#define CPPJIEBA_HMMMODEL_H + +#include "limonp/StringUtil.hpp" +#include "Trie.hpp" + +namespace cppjieba { + +using namespace limonp; +typedef unordered_map EmitProbMap; + +struct HMMModel { + /* + * STATUS: + * 0: HMMModel::B, 1: HMMModel::E, 2: HMMModel::M, 3:HMMModel::S + * */ + enum {B = 0, E = 1, M = 2, S = 3, STATUS_SUM = 4}; + + HMMModel(const string& modelPath) { + memset(startProb, 0, sizeof(startProb)); + memset(transProb, 0, sizeof(transProb)); + statMap[0] = 'B'; + statMap[1] = 'E'; + statMap[2] = 'M'; + statMap[3] = 'S'; + emitProbVec.push_back(&emitProbB); + emitProbVec.push_back(&emitProbE); + emitProbVec.push_back(&emitProbM); + emitProbVec.push_back(&emitProbS); + LoadModel(modelPath); + } + ~HMMModel() { + } + void LoadModel(const string& filePath) { + ifstream ifile(filePath.c_str()); + XCHECK(ifile.is_open()) << "open " << filePath << " failed"; + string line; + vector tmp; + vector tmp2; + //Load startProb + XCHECK(GetLine(ifile, line)); + Split(line, tmp, " "); + XCHECK(tmp.size() == STATUS_SUM); + for (size_t j = 0; j< tmp.size(); j++) { + startProb[j] = atof(tmp[j].c_str()); + } + + //Load transProb + for (size_t i = 0; i < STATUS_SUM; i++) { + XCHECK(GetLine(ifile, line)); + Split(line, tmp, " "); + XCHECK(tmp.size() == STATUS_SUM); + for (size_t j =0; j < STATUS_SUM; j++) { + transProb[i][j] = atof(tmp[j].c_str()); + } + } + + //Load emitProbB + XCHECK(GetLine(ifile, line)); + XCHECK(LoadEmitProb(line, emitProbB)); + + //Load emitProbE + XCHECK(GetLine(ifile, line)); + XCHECK(LoadEmitProb(line, emitProbE)); + + //Load emitProbM + XCHECK(GetLine(ifile, line)); + XCHECK(LoadEmitProb(line, emitProbM)); + + //Load emitProbS + XCHECK(GetLine(ifile, line)); + XCHECK(LoadEmitProb(line, emitProbS)); + } + double GetEmitProb(const EmitProbMap* ptMp, Rune key, + double defVal)const { + EmitProbMap::const_iterator cit = ptMp->find(key); + if (cit == ptMp->end()) { + return defVal; + } + return cit->second; + } + bool GetLine(ifstream& ifile, string& line) { + while (getline(ifile, line)) { + Trim(line); + if (line.empty()) { + continue; + } + if (StartsWith(line, "#")) { + continue; + } + return true; + } + return false; + } + bool LoadEmitProb(const string& line, EmitProbMap& mp) { + if (line.empty()) { + return false; + } + vector tmp, tmp2; + Unicode unicode; + Split(line, tmp, ","); + for (size_t i = 0; i < tmp.size(); i++) { + Split(tmp[i], tmp2, ":"); + if (2 != tmp2.size()) { + XLOG(ERROR) << "emitProb illegal."; + return false; + } + if (!DecodeRunesInString(tmp2[0], unicode) || unicode.size() != 1) { + XLOG(ERROR) << "TransCode failed."; + return false; + } + mp[unicode[0]] = atof(tmp2[1].c_str()); + } + return true; + } + + char statMap[STATUS_SUM]; + double startProb[STATUS_SUM]; + double transProb[STATUS_SUM][STATUS_SUM]; + EmitProbMap emitProbB; + EmitProbMap emitProbE; + EmitProbMap emitProbM; + EmitProbMap emitProbS; + vector emitProbVec; +}; // struct HMMModel + +} // namespace cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/HMMSegment.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/HMMSegment.hpp new file mode 100644 index 0000000..91a311d --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/HMMSegment.hpp @@ -0,0 +1,197 @@ +#ifndef CPPJIBEA_HMMSEGMENT_H +#define CPPJIBEA_HMMSEGMENT_H + +#include +#include +#include +#include +#include "HMMModel.hpp" +#include "SegmentBase.hpp" + +namespace cppjieba { +class HMMSegment: public SegmentBase { + public: + HMMSegment(const string& filePath) + : model_(new HMMModel(filePath)), isNeedDestroy_(true) { + } + HMMSegment(const HMMModel* model) + : model_(model), isNeedDestroy_(false) { + } + HMMSegment() { + model_ = NULL; + } + + ~HMMSegment() { + if (isNeedDestroy_) { + delete model_; + } + } + void setRes(HMMModel *&model) { + model_ = model; + isNeedDestroy_ = false; + } + void Cut(const string& sentence, + vector& words) const { + vector tmp; + Cut(sentence, tmp); + GetStringsFromWords(tmp, words); + } + void Cut(const string& sentence, + vector& words) const { + PreFilter pre_filter(symbols_, sentence); + PreFilter::Range range; + vector wrs; + wrs.reserve(sentence.size()/2); + while (pre_filter.HasNext()) { + range = pre_filter.Next(); + Cut(range.begin, range.end, wrs); + } + words.clear(); + words.reserve(wrs.size()); + GetWordsFromWordRanges(sentence, wrs, words); + } + void Cut(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end, vector& res) const { + RuneStrArray::const_iterator left = begin; + RuneStrArray::const_iterator right = begin; + while (right != end) { + if (right->rune < 0x80) { + if (left != right) { + InternalCut(left, right, res); + } + left = right; + do { + right = SequentialLetterRule(left, end); + if (right != left) { + break; + } + right = NumbersRule(left, end); + if (right != left) { + break; + } + right ++; + } while (false); + WordRange wr(left, right - 1); + res.push_back(wr); + left = right; + } else { + right++; + } + } + if (left != right) { + InternalCut(left, right, res); + } + } + private: + // sequential letters rule + RuneStrArray::const_iterator SequentialLetterRule(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end) const { + Rune x = begin->rune; + if (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z')) { + begin ++; + } else { + return begin; + } + while (begin != end) { + x = begin->rune; + if (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z') || ('0' <= x && x <= '9')) { + begin ++; + } else { + break; + } + } + return begin; + } + // + RuneStrArray::const_iterator NumbersRule(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end) const { + Rune x = begin->rune; + if ('0' <= x && x <= '9') { + begin ++; + } else { + return begin; + } + while (begin != end) { + x = begin->rune; + if ( ('0' <= x && x <= '9') || x == '.') { + begin++; + } else { + break; + } + } + return begin; + } + void InternalCut(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end, vector& res) const { + vector status; + Viterbi(begin, end, status); + + RuneStrArray::const_iterator left = begin; + RuneStrArray::const_iterator right; + for (size_t i = 0; i < status.size(); i++) { + if (status[i] % 2) { //if (HMMModel::E == status[i] || HMMModel::S == status[i]) + right = begin + i + 1; + WordRange wr(left, right - 1); + res.push_back(wr); + left = right; + } + } + } + + void Viterbi(RuneStrArray::const_iterator begin, + RuneStrArray::const_iterator end, + vector& status) const { + size_t Y = HMMModel::STATUS_SUM; + size_t X = end - begin; + + size_t XYSize = X * Y; + size_t now, old, stat; + double tmp, endE, endS; + + vector path(XYSize); + vector weight(XYSize); + + //start + for (size_t y = 0; y < Y; y++) { + weight[0 + y * X] = model_->startProb[y] + model_->GetEmitProb(model_->emitProbVec[y], begin->rune, MIN_DOUBLE); + path[0 + y * X] = -1; + } + + double emitProb; + + for (size_t x = 1; x < X; x++) { + for (size_t y = 0; y < Y; y++) { + now = x + y*X; + weight[now] = MIN_DOUBLE; + path[now] = HMMModel::E; // warning + emitProb = model_->GetEmitProb(model_->emitProbVec[y], (begin+x)->rune, MIN_DOUBLE); + for (size_t preY = 0; preY < Y; preY++) { + old = x - 1 + preY * X; + tmp = weight[old] + model_->transProb[preY][y] + emitProb; + if (tmp > weight[now]) { + weight[now] = tmp; + path[now] = preY; + } + } + } + } + + endE = weight[X-1+HMMModel::E*X]; + endS = weight[X-1+HMMModel::S*X]; + stat = 0; + if (endE >= endS) { + stat = HMMModel::E; + } else { + stat = HMMModel::S; + } + + status.resize(X); + for (int x = X -1 ; x >= 0; x--) { + status[x] = stat; + stat = path[x + stat*X]; + } + } + + const HMMModel* model_; + bool isNeedDestroy_; +}; // class HMMSegment + +} // namespace cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/Jieba.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/Jieba.hpp new file mode 100644 index 0000000..0e778f9 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/Jieba.hpp @@ -0,0 +1,141 @@ +#ifndef CPPJIEAB_JIEBA_H +#define CPPJIEAB_JIEBA_H + +#include "QuerySegment.hpp" +#include "KeywordExtractor.hpp" + +namespace cppjieba { + +class Jieba { + public: + Jieba(DictTrie *jieba_dict_trie, + HMMModel *jieba_model) + : dict_trie_(jieba_dict_trie), + model_(jieba_model), + mp_seg_(dict_trie_), + hmm_seg_(model_), + mix_seg_(dict_trie_, model_), + full_seg_(dict_trie_), + query_seg_(dict_trie_, model_) { + } + Jieba() { + dict_trie_ = NULL; + model_ = NULL; + } + ~Jieba() { + } + + struct LocWord { + string word; + size_t begin; + size_t end; + }; // struct LocWord + void SetJiebaRes(cppjieba::DictTrie *&dict, cppjieba::HMMModel *&hmm) { + dict_trie_ = dict; + model_ = hmm; + mp_seg_.setRes(dict); + hmm_seg_.setRes(hmm); + mix_seg_.setRes(dict, hmm); + full_seg_.setRes(dict); + query_seg_.setRes(dict, hmm); + } + void Cut(const string& sentence, vector& words, bool hmm = true) const { + mix_seg_.Cut(sentence, words, hmm); + } + void Cut(const string& sentence, vector& words, bool hmm = true) const { + mix_seg_.Cut(sentence, words, hmm); + } + void CutAll(const string& sentence, vector& words) const { + full_seg_.Cut(sentence, words); + } + void CutAll(const string& sentence, vector& words) const { + full_seg_.Cut(sentence, words); + } + void CutForSearch(const string& sentence, vector& words, bool hmm = true) const { + query_seg_.Cut(sentence, words, hmm); + } + void CutForSearch(const string& sentence, vector& words, bool hmm = true) const { + query_seg_.Cut(sentence, words, hmm); + } + void CutHMM(const string& sentence, vector& words) const { + hmm_seg_.Cut(sentence, words); + } + void CutHMM(const string& sentence, vector& words) const { + hmm_seg_.Cut(sentence, words); + } + void CutSmall(const string& sentence, vector& words, size_t max_word_len) const { + mp_seg_.Cut(sentence, words, max_word_len); + } + void CutSmall(const string& sentence, vector& words, size_t max_word_len) const { + mp_seg_.Cut(sentence, words, max_word_len); + } + + void Tag(const string& sentence, vector >& words) const { + mix_seg_.Tag(sentence, words); + } + string LookupTag(const string &str) const { + return mix_seg_.LookupTag(str); + } + bool InsertUserWord(const string& word, const string& tag = UNKNOWN_TAG) { + return dict_trie_->InsertUserWord(word, tag); + } + + bool InsertUserWord(const string& word,int freq, const string& tag = UNKNOWN_TAG) { + return dict_trie_->InsertUserWord(word,freq, tag); + } + + bool DeleteUserWord(const string& word, const string& tag = UNKNOWN_TAG) { + return dict_trie_->DeleteUserWord(word, tag); + } + + bool Find(const string& word) + { + return dict_trie_->Find(word); + } + + void ResetSeparators(const string& s) { + //TODO + mp_seg_.ResetSeparators(s); + hmm_seg_.ResetSeparators(s); + mix_seg_.ResetSeparators(s); + full_seg_.ResetSeparators(s); + query_seg_.ResetSeparators(s); + } + + const DictTrie* GetDictTrie() const { + return dict_trie_; + } + + const HMMModel* GetHMMModel() const { + return model_; + } + + void LoadUserDict(const vector& buf) { + dict_trie_->LoadUserDict(buf); + } + + void LoadUserDict(const set& buf) { + dict_trie_->LoadUserDict(buf); + } + + void LoadUserDict(const string& path) { + dict_trie_->LoadUserDict(path); + } + + private: + DictTrie *dict_trie_; + HMMModel *model_; + + // They share the same dict trie and model + MPSegment mp_seg_; + HMMSegment hmm_seg_; + MixSegment mix_seg_; + FullSegment full_seg_; + QuerySegment query_seg_; + + public: +}; // class Jieba + +} // namespace cppjieba + +#endif // CPPJIEAB_JIEBA_H diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/KeywordExtractor.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/KeywordExtractor.hpp new file mode 100644 index 0000000..15b50b9 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/KeywordExtractor.hpp @@ -0,0 +1,154 @@ +#ifndef CPPJIEBA_KEYWORD_EXTRACTOR_H +#define CPPJIEBA_KEYWORD_EXTRACTOR_H + +#include +#include +#include "MixSegment.hpp" + +namespace cppjieba { + +using namespace limonp; +using namespace std; + +/*utf8*/ +class KeywordExtractor { + public: + struct Word { + string word; + vector offsets; + double weight; + }; // struct Word + + KeywordExtractor(const string& dictPath, + const string& hmmFilePath, + const string& idfPath, + const string& stopWordPath, + const string& userDict = "") + : segment_(dictPath, hmmFilePath, userDict) { + LoadIdfDict(idfPath); + LoadStopWordDict(stopWordPath); + } + KeywordExtractor(const DictTrie* dictTrie, + const HMMModel* model, + const string& idfPath, + const string& stopWordPath) + : segment_(dictTrie, model) { + LoadIdfDict(idfPath); + LoadStopWordDict(stopWordPath); + } + KeywordExtractor() {} + ~KeywordExtractor() { + } + + void Extract(const string& sentence, vector& keywords, size_t topN) const { + vector topWords; + Extract(sentence, topWords, topN); + for (size_t i = 0; i < topWords.size(); i++) { + keywords.push_back(topWords[i].word); + } + } + + void Extract(const string& sentence, vector >& keywords, size_t topN) const { + vector topWords; + Extract(sentence, topWords, topN); + for (size_t i = 0; i < topWords.size(); i++) { + keywords.push_back(pair(topWords[i].word, topWords[i].weight)); + } + } + + void Extract(const string& sentence, vector& keywords, size_t topN) const { + vector words; + segment_.Cut(sentence, words); + + map wordmap; + size_t offset = 0; + for (size_t i = 0; i < words.size(); ++i) { + size_t t = offset; + offset += words[i].size(); + if (IsSingleWord(words[i]) || stopWords_.find(words[i]) != stopWords_.end()) { + continue; + } + wordmap[words[i]].offsets.push_back(t); + wordmap[words[i]].weight += 1.0; + } + if (offset != sentence.size()) { + XLOG(ERROR) << "words illegal"; + return; + } + + keywords.clear(); + keywords.reserve(wordmap.size()); + for (map::iterator itr = wordmap.begin(); itr != wordmap.end(); ++itr) { + unordered_map::const_iterator cit = idfMap_.find(itr->first); + if (cit != idfMap_.end()) { + itr->second.weight *= cit->second; + } else { + itr->second.weight *= idfAverage_; + } + itr->second.word = itr->first; + keywords.push_back(itr->second); + } + topN = min(topN, keywords.size()); + partial_sort(keywords.begin(), keywords.begin() + topN, keywords.end(), Compare); + keywords.resize(topN); + } + private: + void LoadIdfDict(const string& idfPath) { + ifstream ifs(idfPath.c_str()); + XCHECK(ifs.is_open()) << "open " << idfPath << " failed"; + string line ; + vector buf; + double idf = 0.0; + double idfSum = 0.0; + size_t lineno = 0; + for (; getline(ifs, line); lineno++) { + buf.clear(); + if (line.empty()) { + XLOG(ERROR) << "lineno: " << lineno << " empty. skipped."; + continue; + } + Split(line, buf, " "); + if (buf.size() != 2) { + XLOG(ERROR) << "line: " << line << ", lineno: " << lineno << " empty. skipped."; + continue; + } + idf = atof(buf[1].c_str()); + idfMap_[buf[0]] = idf; + idfSum += idf; + + } + + assert(lineno); + idfAverage_ = idfSum / lineno; + assert(idfAverage_ > 0.0); + } + void LoadStopWordDict(const string& filePath) { + ifstream ifs(filePath.c_str()); + XCHECK(ifs.is_open()) << "open " << filePath << " failed"; + string line ; + while (getline(ifs, line)) { + stopWords_.insert(line); + } + assert(stopWords_.size()); + } + + static bool Compare(const Word& lhs, const Word& rhs) { + return lhs.weight > rhs.weight; + } + + MixSegment segment_; + unordered_map idfMap_; + double idfAverage_; + + unordered_set stopWords_; +}; // class KeywordExtractor + +inline ostream& operator << (ostream& os, const KeywordExtractor::Word& word) { + return os << "{\"word\": \"" << word.word << "\", \"offset\": " << word.offsets << ", \"weight\": " << word.weight << "}"; +} + +} // namespace cppjieba + +#endif + + diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/MPSegment.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/MPSegment.hpp new file mode 100644 index 0000000..524dcb0 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/MPSegment.hpp @@ -0,0 +1,144 @@ +#ifndef CPPJIEBA_MPSEGMENT_H +#define CPPJIEBA_MPSEGMENT_H + +#include +#include +#include +#include "limonp/Logging.hpp" +#include "DictTrie.hpp" +#include "SegmentTagged.hpp" +#include "PosTagger.hpp" + +namespace cppjieba { + +class MPSegment: public SegmentTagged { + public: + MPSegment(const string& dictPath, const string& userDictPath = "") + : dictTrie_(new DictTrie(dictPath, userDictPath)), isNeedDestroy_(true) { + } + MPSegment(const DictTrie* dictTrie) + : dictTrie_(dictTrie), isNeedDestroy_(false) { + assert(dictTrie_); + } + MPSegment() { + dictTrie_ = NULL; + } + ~MPSegment() { + if (isNeedDestroy_) { + delete dictTrie_; + } + } + void setRes(DictTrie *&dictTrie) { + dictTrie_ = dictTrie; + isNeedDestroy_ = false; + assert(dictTrie_); + } + void Cut(const string& sentence, vector& words) const { + Cut(sentence, words, MAX_WORD_LENGTH); + } + + void Cut(const string& sentence, + vector& words, + size_t max_word_len) const { + vector tmp; + Cut(sentence, tmp, max_word_len); + GetStringsFromWords(tmp, words); + } + void Cut(const string& sentence, + vector& words, + size_t max_word_len = MAX_WORD_LENGTH) const { + PreFilter pre_filter(symbols_, sentence); + PreFilter::Range range; + vector wrs; + wrs.reserve(sentence.size()/2); + while (pre_filter.HasNext()) { + range = pre_filter.Next(); + Cut(range.begin, range.end, wrs, max_word_len); + } + words.clear(); + words.reserve(wrs.size()); + GetWordsFromWordRanges(sentence, wrs, words); + } + void Cut(RuneStrArray::const_iterator begin, + RuneStrArray::const_iterator end, + vector& words, + size_t max_word_len = MAX_WORD_LENGTH) const { + vector dags; + dictTrie_->Find(begin, + end, + dags, + max_word_len); + CalcDP(dags); + CutByDag(begin, end, dags, words); + } + + const DictTrie* GetDictTrie() const { + return dictTrie_; + } + + bool Tag(const string& src, vector >& res) const { + return tagger_.Tag(src, res, *this); + } + + bool IsUserDictSingleChineseWord(const Rune& value) const { + return dictTrie_->IsUserDictSingleChineseWord(value); + } + private: + void CalcDP(vector& dags) const { + size_t nextPos; + const DictUnit* p; + double val; + + for (vector::reverse_iterator rit = dags.rbegin(); rit != dags.rend(); rit++) { + rit->pInfo = NULL; + rit->weight = MIN_DOUBLE; + assert(!rit->nexts.empty()); + for (LocalVector >::const_iterator it = rit->nexts.begin(); it != rit->nexts.end(); it++) { + nextPos = it->first; + p = it->second; + val = 0.0; + if (nextPos + 1 < dags.size()) { + val += dags[nextPos + 1].weight; + } + + if (p) { + val += p->weight; + } else { + val += dictTrie_->GetMinWeight(); + } + if (val > rit->weight) { + rit->pInfo = p; + rit->weight = val; + } + } + } + } + void CutByDag(RuneStrArray::const_iterator begin, + RuneStrArray::const_iterator end, + const vector& dags, + vector& words) const { + size_t i = 0; + while (i < dags.size()) { + const DictUnit* p = dags[i].pInfo; + if (p) { + assert(p->word.size() >= 1); + WordRange wr(begin + i, begin + i + p->word.size() - 1); + words.push_back(wr); + i += p->word.size(); + } else { //single chinese word + WordRange wr(begin + i, begin + i); + words.push_back(wr); + i++; + } + } + } + + const DictTrie* dictTrie_; + bool isNeedDestroy_; + PosTagger tagger_; + +}; // class MPSegment + +} // namespace cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/MixSegment.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/MixSegment.hpp new file mode 100644 index 0000000..c058219 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/MixSegment.hpp @@ -0,0 +1,113 @@ +#ifndef CPPJIEBA_MIXSEGMENT_H +#define CPPJIEBA_MIXSEGMENT_H + +#include +#include "MPSegment.hpp" +#include "HMMSegment.hpp" +#include "limonp/StringUtil.hpp" +#include "PosTagger.hpp" + +namespace cppjieba { +class MixSegment: public SegmentTagged { + public: + MixSegment(const string& mpSegDict, const string& hmmSegDict, + const string& userDict = "") + : mpSeg_(mpSegDict, userDict), + hmmSeg_(hmmSegDict) { + } + MixSegment(const DictTrie* dictTrie, const HMMModel* model) + : mpSeg_(dictTrie), hmmSeg_(model) { + } + MixSegment() {} + ~MixSegment() { + } + void setRes(DictTrie *&dictTrie, HMMModel *&model) { + mpSeg_.setRes(dictTrie); + hmmSeg_.setRes(model); + } + void Cut(const string& sentence, vector& words) const { + Cut(sentence, words, true); + } + void Cut(const string& sentence, vector& words, bool hmm) const { + vector tmp; + Cut(sentence, tmp, hmm); + GetStringsFromWords(tmp, words); + } + void Cut(const string& sentence, vector& words, bool hmm = true) const { + PreFilter pre_filter(symbols_, sentence); + PreFilter::Range range; + vector wrs; + wrs.reserve(sentence.size() / 2); + while (pre_filter.HasNext()) { + range = pre_filter.Next(); + Cut(range.begin, range.end, wrs, hmm); + } + words.clear(); + words.reserve(wrs.size()); + GetWordsFromWordRanges(sentence, wrs, words); + } + + void Cut(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end, vector& res, bool hmm) const { + if (!hmm) { + mpSeg_.Cut(begin, end, res); + return; + } + vector words; + assert(end >= begin); + words.reserve(end - begin); + mpSeg_.Cut(begin, end, words); + + vector hmmRes; + hmmRes.reserve(end - begin); + for (size_t i = 0; i < words.size(); i++) { + //if mp Get a word, it's ok, put it into result + if (words[i].left != words[i].right || (words[i].left == words[i].right && mpSeg_.IsUserDictSingleChineseWord(words[i].left->rune))) { + res.push_back(words[i]); + continue; + } + + // if mp Get a single one and it is not in userdict, collect it in sequence + size_t j = i; + while (j < words.size() && words[j].left == words[j].right && !mpSeg_.IsUserDictSingleChineseWord(words[j].left->rune)) { + j++; + } + + // Cut the sequence with hmm + assert(j - 1 >= i); + // TODO + hmmSeg_.Cut(words[i].left, words[j - 1].left + 1, hmmRes); + //put hmm result to result + for (size_t k = 0; k < hmmRes.size(); k++) { + res.push_back(hmmRes[k]); + } + + //clear tmp vars + hmmRes.clear(); + + //let i jump over this piece + i = j - 1; + } + } + + const DictTrie* GetDictTrie() const { + return mpSeg_.GetDictTrie(); + } + + bool Tag(const string& src, vector >& res) const { + return tagger_.Tag(src, res, *this); + } + + string LookupTag(const string &str) const { + return tagger_.LookupTag(str, *this); + } + + private: + MPSegment mpSeg_; + HMMSegment hmmSeg_; + PosTagger tagger_; + +}; // class MixSegment + +} // namespace cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/PosTagger.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/PosTagger.hpp new file mode 100644 index 0000000..78853d5 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/PosTagger.hpp @@ -0,0 +1,77 @@ +#ifndef CPPJIEBA_POS_TAGGING_H +#define CPPJIEBA_POS_TAGGING_H + +#include "limonp/StringUtil.hpp" +#include "SegmentTagged.hpp" +#include "DictTrie.hpp" + +namespace cppjieba { +using namespace limonp; + +static const char* const POS_M = "m"; +static const char* const POS_ENG = "eng"; +static const char* const POS_X = "x"; + +class PosTagger { + public: + PosTagger() { + } + ~PosTagger() { + } + + bool Tag(const string& src, vector >& res, const SegmentTagged& segment) const { + vector CutRes; + segment.Cut(src, CutRes); + + for (vector::iterator itr = CutRes.begin(); itr != CutRes.end(); ++itr) { + res.push_back(make_pair(*itr, LookupTag(*itr, segment))); + } + return !res.empty(); + } + + string LookupTag(const string &str, const SegmentTagged& segment) const { + const DictUnit *tmp = NULL; + RuneStrArray runes; + const DictTrie * dict = segment.GetDictTrie(); + assert(dict != NULL); + if (!DecodeRunesInString(str, runes)) { + XLOG(ERROR) << "Decode failed."; + return POS_X; + } + tmp = dict->Find(runes.begin(), runes.end()); + if (tmp == NULL || tmp->tag.empty()) { + return SpecialRule(runes); + } else { + return tmp->tag; + } + } + + private: + const char* SpecialRule(const RuneStrArray& unicode) const { + size_t m = 0; + size_t eng = 0; + for (size_t i = 0; i < unicode.size() && eng < unicode.size() / 2; i++) { + if (unicode[i].rune < 0x80) { + eng ++; + if ('0' <= unicode[i].rune && unicode[i].rune <= '9') { + m++; + } + } + } + // ascii char is not found + if (eng == 0) { + return POS_X; + } + // all the ascii is number char + if (m == eng) { + return POS_M; + } + // the ascii chars contain english letter + return POS_ENG; + } + +}; // class PosTagger + +} // namespace cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/PreFilter.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/PreFilter.hpp new file mode 100644 index 0000000..ecb81c0 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/PreFilter.hpp @@ -0,0 +1,54 @@ +#ifndef CPPJIEBA_PRE_FILTER_H +#define CPPJIEBA_PRE_FILTER_H + +#include "Trie.hpp" +#include "limonp/Logging.hpp" + +namespace cppjieba { + +class PreFilter { + public: + //TODO use WordRange instead of Range + struct Range { + RuneStrArray::const_iterator begin; + RuneStrArray::const_iterator end; + }; // struct Range + + PreFilter(const unordered_set& symbols, + const string& sentence) + : symbols_(symbols) { + if (!DecodeRunesInString(sentence, sentence_)) { + XLOG(ERROR) << "decode failed. "; + } + cursor_ = sentence_.begin(); + } + ~PreFilter() { + } + bool HasNext() const { + return cursor_ != sentence_.end(); + } + Range Next() { + Range range; + range.begin = cursor_; + while (cursor_ != sentence_.end()) { + if (IsIn(symbols_, cursor_->rune)) { + if (range.begin == cursor_) { + cursor_ ++; + } + range.end = cursor_; + return range; + } + cursor_ ++; + } + range.end = sentence_.end(); + return range; + } + private: + RuneStrArray::const_iterator cursor_; + RuneStrArray sentence_; + const unordered_set& symbols_; +}; // class PreFilter + +} // namespace cppjieba + +#endif // CPPJIEBA_PRE_FILTER_H diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/QuerySegment.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/QuerySegment.hpp new file mode 100644 index 0000000..8ba7a9f --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/QuerySegment.hpp @@ -0,0 +1,95 @@ +#ifndef CPPJIEBA_QUERYSEGMENT_H +#define CPPJIEBA_QUERYSEGMENT_H + +#include +#include +#include +#include "limonp/Logging.hpp" +#include "DictTrie.hpp" +#include "SegmentBase.hpp" +#include "FullSegment.hpp" +#include "MixSegment.hpp" +#include "Unicode.hpp" + +namespace cppjieba { +class QuerySegment: public SegmentBase { + public: + QuerySegment(const string& dict, const string& model, const string& userDict = "") + : mixSeg_(dict, model, userDict), + trie_(mixSeg_.GetDictTrie()) { + } + QuerySegment(const DictTrie* dictTrie, const HMMModel* model) + : mixSeg_(dictTrie, model), trie_(dictTrie) { + } + QuerySegment() { + trie_ = NULL; + } + ~QuerySegment() { + } + void setRes(DictTrie *&dictTrie, HMMModel *&model) { + mixSeg_.setRes(dictTrie, model); + trie_ = dictTrie; + } + void Cut(const string& sentence, vector& words) const { + Cut(sentence, words, true); + } + void Cut(const string& sentence, vector& words, bool hmm) const { + vector tmp; + Cut(sentence, tmp, hmm); + GetStringsFromWords(tmp, words); + } + void Cut(const string& sentence, vector& words, bool hmm = true) const { + PreFilter pre_filter(symbols_, sentence); + PreFilter::Range range; + vector wrs; + wrs.reserve(sentence.size()/2); + while (pre_filter.HasNext()) { + range = pre_filter.Next(); + Cut(range.begin, range.end, wrs, hmm); + } + words.clear(); + words.reserve(wrs.size()); + GetWordsFromWordRanges(sentence, wrs, words); + } + void Cut(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end, vector& res, bool hmm) const { + //use mix Cut first + vector mixRes; + mixSeg_.Cut(begin, end, mixRes, hmm); + + vector fullRes; + for (vector::const_iterator mixResItr = mixRes.begin(); mixResItr != mixRes.end(); mixResItr++) { + if (mixResItr->Length() > 2) { + for (size_t i = 0; i + 1 < mixResItr->Length(); i++) { + WordRange wr(mixResItr->left + i, mixResItr->left + i + 1); + if (trie_->Find(wr.left, wr.right + 1) != NULL) { + res.push_back(wr); + } + } + } + if (mixResItr->Length() > 3) { + for (size_t i = 0; i + 2 < mixResItr->Length(); i++) { + WordRange wr(mixResItr->left + i, mixResItr->left + i + 2); + if (trie_->Find(wr.left, wr.right + 1) != NULL) { + res.push_back(wr); + } + } + } + res.push_back(*mixResItr); + } + } + private: + bool IsAllAscii(const Unicode& s) const { + for(size_t i = 0; i < s.size(); i++) { + if (s[i] >= 0x80) { + return false; + } + } + return true; + } + MixSegment mixSeg_; + const DictTrie* trie_; +}; // QuerySegment + +} // namespace cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/SegmentBase.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/SegmentBase.hpp new file mode 100644 index 0000000..79c8009 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/SegmentBase.hpp @@ -0,0 +1,46 @@ +#ifndef CPPJIEBA_SEGMENTBASE_H +#define CPPJIEBA_SEGMENTBASE_H + +#include "limonp/Logging.hpp" +#include "PreFilter.hpp" +#include + + +namespace cppjieba { + +const char* const SPECIAL_SEPARATORS = " \t\n\xEF\xBC\x8C\xE3\x80\x82"; + +using namespace limonp; + +class SegmentBase { + public: + SegmentBase() { + XCHECK(ResetSeparators(SPECIAL_SEPARATORS)); + } + virtual ~SegmentBase() { + } + + virtual void Cut(const string& sentence, vector& words) const = 0; + + bool ResetSeparators(const string& s) { + symbols_.clear(); + RuneStrArray runes; + if (!DecodeRunesInString(s, runes)) { + XLOG(ERROR) << "decode " << s << " failed"; + return false; + } + for (size_t i = 0; i < runes.size(); i++) { + if (!symbols_.insert(runes[i].rune).second) { + XLOG(ERROR) << s.substr(runes[i].offset, runes[i].len) << " already exists"; + return false; + } + } + return true; + } + protected: + unordered_set symbols_; +}; // class SegmentBase + +} // cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/SegmentTagged.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/SegmentTagged.hpp new file mode 100644 index 0000000..4d99a31 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/SegmentTagged.hpp @@ -0,0 +1,23 @@ +#ifndef CPPJIEBA_SEGMENTTAGGED_H +#define CPPJIEBA_SEGMENTTAGGED_H + +#include "SegmentBase.hpp" + +namespace cppjieba { + +class SegmentTagged : public SegmentBase{ + public: + SegmentTagged() { + } + virtual ~SegmentTagged() { + } + + virtual bool Tag(const string& src, vector >& res) const = 0; + + virtual const DictTrie* GetDictTrie() const = 0; + +}; // class SegmentTagged + +} // cppjieba + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/TextRankExtractor.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/TextRankExtractor.hpp new file mode 100644 index 0000000..83f63b2 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/TextRankExtractor.hpp @@ -0,0 +1,190 @@ +#ifndef CPPJIEBA_TEXTRANK_EXTRACTOR_H +#define CPPJIEBA_TEXTRANK_EXTRACTOR_H + +#include +#include "Jieba.hpp" + +namespace cppjieba { + using namespace limonp; + using namespace std; + + class TextRankExtractor { + public: + typedef struct _Word {string word;vector offsets;double weight;} Word; // struct Word + private: + typedef std::map WordMap; + + class WordGraph{ + private: + typedef double Score; + typedef string Node; + typedef std::set NodeSet; + + typedef std::map Edges; + typedef std::map Graph; + //typedef std::unordered_map Edges; + //typedef std::unordered_map Graph; + + double d; + Graph graph; + NodeSet nodeSet; + public: + WordGraph(): d(0.85) {}; + WordGraph(double in_d): d(in_d) {}; + + void addEdge(Node start,Node end,double weight){ + Edges temp; + Edges::iterator gotEdges; + nodeSet.insert(start); + nodeSet.insert(end); + graph[start][end]+=weight; + graph[end][start]+=weight; + } + + void rank(WordMap &ws,size_t rankTime=10){ + WordMap outSum; + Score wsdef, min_rank, max_rank; + + if( graph.size() == 0) + return; + + wsdef = 1.0 / graph.size(); + + for(Graph::iterator edges=graph.begin();edges!=graph.end();++edges){ + // edges->first start节点;edge->first end节点;edge->second 权重 + ws[edges->first].word=edges->first; + ws[edges->first].weight=wsdef; + outSum[edges->first].weight=0; + for(Edges::iterator edge=edges->second.begin();edge!=edges->second.end();++edge){ + outSum[edges->first].weight+=edge->second; + } + } + //sort(nodeSet.begin(),nodeSet.end()); 是否需要排序? + for( size_t i=0; ifirst end节点;edge->second 权重 + s += edge->second / outSum[edge->first].weight * ws[edge->first].weight; + ws[*node].weight = (1 - d) + d * s; + } + } + + min_rank=max_rank=ws.begin()->second.weight; + for(WordMap::iterator i = ws.begin(); i != ws.end(); i ++){ + if( i->second.weight < min_rank ){ + min_rank = i->second.weight; + } + if( i->second.weight > max_rank ){ + max_rank = i->second.weight; + } + } + for(WordMap::iterator i = ws.begin(); i != ws.end(); i ++){ + ws[i->first].weight = (i->second.weight - min_rank / 10.0) / (max_rank - min_rank / 10.0); + } + } + }; + + public: + TextRankExtractor(const string& dictPath, + const string& hmmFilePath, + const string& stopWordPath, + const string& userDict = "") + : segment_(dictPath, hmmFilePath, userDict) { + LoadStopWordDict(stopWordPath); + } + TextRankExtractor(const DictTrie* dictTrie, + const HMMModel* model, + const string& stopWordPath) + : segment_(dictTrie, model) { + LoadStopWordDict(stopWordPath); + } + TextRankExtractor(const Jieba& jieba, const string& stopWordPath) : segment_(jieba.GetDictTrie(), jieba.GetHMMModel()) { + LoadStopWordDict(stopWordPath); + } + ~TextRankExtractor() { + } + + void Extract(const string& sentence, vector& keywords, size_t topN) const { + vector topWords; + Extract(sentence, topWords, topN); + for (size_t i = 0; i < topWords.size(); i++) { + keywords.push_back(topWords[i].word); + } + } + + void Extract(const string& sentence, vector >& keywords, size_t topN) const { + vector topWords; + Extract(sentence, topWords, topN); + for (size_t i = 0; i < topWords.size(); i++) { + keywords.push_back(pair(topWords[i].word, topWords[i].weight)); + } + } + + void Extract(const string& sentence, vector& keywords, size_t topN, size_t span=5,size_t rankTime=10) const { + vector words; + segment_.Cut(sentence, words); + + TextRankExtractor::WordGraph graph; + WordMap wordmap; + size_t offset = 0; + + for(size_t i=0; i < words.size(); i++){ + size_t t = offset; + offset += words[i].size(); + if (IsSingleWord(words[i]) || stopWords_.find(words[i]) != stopWords_.end()) { + continue; + } + for(size_t j=i+1,skip=0;jsecond); + } + + topN = min(topN, keywords.size()); + partial_sort(keywords.begin(), keywords.begin() + topN, keywords.end(), Compare); + keywords.resize(topN); + } + private: + void LoadStopWordDict(const string& filePath) { + ifstream ifs(filePath.c_str()); + XCHECK(ifs.is_open()) << "open " << filePath << " failed"; + string line ; + while (getline(ifs, line)) { + stopWords_.insert(line); + } + assert(stopWords_.size()); + } + + static bool Compare(const Word &x,const Word &y){ + return x.weight > y.weight; + } + + MixSegment segment_; + unordered_set stopWords_; + }; // class TextRankExtractor + + inline ostream& operator << (ostream& os, const TextRankExtractor::Word& word) { + return os << "{\"word\": \"" << word.word << "\", \"offset\": " << word.offsets << ", \"weight\": " << word.weight << "}"; + } +} // namespace cppjieba + +#endif + + diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/Trie.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/Trie.hpp new file mode 100644 index 0000000..e6f71b1 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/Trie.hpp @@ -0,0 +1,200 @@ +#ifndef CPPJIEBA_TRIE_HPP +#define CPPJIEBA_TRIE_HPP + +#include +#include +#include "limonp/StdExtension.hpp" +#include "Unicode.hpp" + +namespace cppjieba { + +using namespace std; + +const size_t MAX_WORD_LENGTH = 512; + +struct DictUnit { + Unicode word; + double weight; + string tag; +}; // struct DictUnit + +// for debugging +// inline ostream & operator << (ostream& os, const DictUnit& unit) { +// string s; +// s << unit.word; +// return os << StringFormat("%s %s %.3lf", s.c_str(), unit.tag.c_str(), unit.weight); +// } + +struct Dag { + RuneStr runestr; + // [offset, nexts.first] + limonp::LocalVector > nexts; + const DictUnit * pInfo; + double weight; + size_t nextPos; // TODO + Dag():runestr(), pInfo(NULL), weight(0.0), nextPos(0) { + } +}; // struct Dag + +typedef Rune TrieKey; + +class TrieNode { + public : + TrieNode(): next(NULL), ptValue(NULL) { + } + public: + typedef unordered_map NextMap; + NextMap *next; + const DictUnit *ptValue; +}; + +class Trie { + public: + Trie(const vector& keys, const vector& valuePointers) + : root_(new TrieNode) { + CreateTrie(keys, valuePointers); + } + ~Trie() { + DeleteNode(root_); + } + + const DictUnit* Find(RuneStrArray::const_iterator begin, RuneStrArray::const_iterator end) const { + if (begin == end) { + return NULL; + } + + const TrieNode* ptNode = root_; + TrieNode::NextMap::const_iterator citer; + for (RuneStrArray::const_iterator it = begin; it != end; it++) { + if (NULL == ptNode->next) { + return NULL; + } + citer = ptNode->next->find(it->rune); + if (ptNode->next->end() == citer) { + return NULL; + } + ptNode = citer->second; + } + return ptNode->ptValue; + } + + void Find(RuneStrArray::const_iterator begin, + RuneStrArray::const_iterator end, + vector&res, + size_t max_word_len = MAX_WORD_LENGTH) const { + assert(root_ != NULL); + res.resize(end - begin); + + const TrieNode *ptNode = NULL; + TrieNode::NextMap::const_iterator citer; + for (size_t i = 0; i < size_t(end - begin); i++) { + res[i].runestr = *(begin + i); + + if (root_->next != NULL && root_->next->end() != (citer = root_->next->find(res[i].runestr.rune))) { + ptNode = citer->second; + } else { + ptNode = NULL; + } + if (ptNode != NULL) { + res[i].nexts.push_back(pair(i, ptNode->ptValue)); + } else { + res[i].nexts.push_back(pair(i, static_cast(NULL))); + } + + for (size_t j = i + 1; j < size_t(end - begin) && (j - i + 1) <= max_word_len; j++) { + if (ptNode == NULL || ptNode->next == NULL) { + break; + } + citer = ptNode->next->find((begin + j)->rune); + if (ptNode->next->end() == citer) { + break; + } + ptNode = citer->second; + if (NULL != ptNode->ptValue) { + res[i].nexts.push_back(pair(j, ptNode->ptValue)); + } + } + } + } + + void InsertNode(const Unicode& key, const DictUnit* ptValue) { + if (key.begin() == key.end()) { + return; + } + + TrieNode::NextMap::const_iterator kmIter; + TrieNode *ptNode = root_; + for (Unicode::const_iterator citer = key.begin(); citer != key.end(); ++citer) { + if (NULL == ptNode->next) { + ptNode->next = new TrieNode::NextMap; + } + kmIter = ptNode->next->find(*citer); + if (ptNode->next->end() == kmIter) { + TrieNode *nextNode = new TrieNode; + + ptNode->next->insert(make_pair(*citer, nextNode)); + ptNode = nextNode; + } else { + ptNode = kmIter->second; + } + } + assert(ptNode != NULL); + ptNode->ptValue = ptValue; + } + void DeleteNode(const Unicode& key, const DictUnit* ptValue) { + if (key.begin() == key.end()) { + return; + } + //定义一个NextMap迭代器 + TrieNode::NextMap::const_iterator kmIter; + //定义一个指向root的TrieNode指针 + TrieNode *ptNode = root_; + for (Unicode::const_iterator citer = key.begin(); citer != key.end(); ++citer) { + //链表不存在元素 + if (NULL == ptNode->next) { + return; + } + kmIter = ptNode->next->find(*citer); + //如果map中不存在,跳出循环 + if (ptNode->next->end() == kmIter) { + break; + } + //从unordered_map中擦除该项 + ptNode->next->erase(*citer); + //删除该node + ptNode = kmIter->second; + delete ptNode; + break; + } + return; + } + private: + void CreateTrie(const vector& keys, const vector& valuePointers) { + if (valuePointers.empty() || keys.empty()) { + return; + } + assert(keys.size() == valuePointers.size()); + + for (size_t i = 0; i < keys.size(); i++) { + InsertNode(keys[i], valuePointers[i]); + } + } + + void DeleteNode(TrieNode* node) { + if (NULL == node) { + return; + } + if (NULL != node->next) { + for (TrieNode::NextMap::iterator it = node->next->begin(); it != node->next->end(); ++it) { + DeleteNode(it->second); + } + delete node->next; + } + delete node; + } + + TrieNode* root_; +}; // class Trie +} // namespace cppjieba + +#endif // CPPJIEBA_TRIE_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/cppjieba/Unicode.hpp b/runtime/onnxruntime/third_party/jieba/include/cppjieba/Unicode.hpp new file mode 100644 index 0000000..7f06456 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/cppjieba/Unicode.hpp @@ -0,0 +1,227 @@ +#ifndef CPPJIEBA_UNICODE_H +#define CPPJIEBA_UNICODE_H + +#include +#include +#include +#include +#include +#include "limonp/LocalVector.hpp" + +namespace cppjieba { + +using std::string; +using std::vector; + +typedef uint32_t Rune; + +struct Word { + string word; + uint32_t offset; + uint32_t unicode_offset; + uint32_t unicode_length; + Word(const string& w, uint32_t o) + : word(w), offset(o) { + } + Word(const string& w, uint32_t o, uint32_t unicode_offset, uint32_t unicode_length) + : word(w), offset(o), unicode_offset(unicode_offset), unicode_length(unicode_length) { + } +}; // struct Word + +inline std::ostream& operator << (std::ostream& os, const Word& w) { + return os << "{\"word\": \"" << w.word << "\", \"offset\": " << w.offset << "}"; +} + +struct RuneStr { + Rune rune; + uint32_t offset; + uint32_t len; + uint32_t unicode_offset; + uint32_t unicode_length; + RuneStr(): rune(0), offset(0), len(0), unicode_offset(0), unicode_length(0) { + } + RuneStr(Rune r, uint32_t o, uint32_t l) + : rune(r), offset(o), len(l), unicode_offset(0), unicode_length(0) { + } + RuneStr(Rune r, uint32_t o, uint32_t l, uint32_t unicode_offset, uint32_t unicode_length) + : rune(r), offset(o), len(l), unicode_offset(unicode_offset), unicode_length(unicode_length) { + } +}; // struct RuneStr + +inline std::ostream& operator << (std::ostream& os, const RuneStr& r) { + return os << "{\"rune\": \"" << r.rune << "\", \"offset\": " << r.offset << ", \"len\": " << r.len << "}"; +} + +typedef limonp::LocalVector Unicode; +typedef limonp::LocalVector RuneStrArray; + +// [left, right] +struct WordRange { + RuneStrArray::const_iterator left; + RuneStrArray::const_iterator right; + WordRange(RuneStrArray::const_iterator l, RuneStrArray::const_iterator r) + : left(l), right(r) { + } + size_t Length() const { + return right - left + 1; + } + bool IsAllAscii() const { + for (RuneStrArray::const_iterator iter = left; iter <= right; ++iter) { + if (iter->rune >= 0x80) { + return false; + } + } + return true; + } +}; // struct WordRange + +struct RuneStrLite { + uint32_t rune; + uint32_t len; + RuneStrLite(): rune(0), len(0) { + } + RuneStrLite(uint32_t r, uint32_t l): rune(r), len(l) { + } +}; // struct RuneStrLite + +inline RuneStrLite DecodeRuneInString(const char* str, size_t len) { + RuneStrLite rp(0, 0); + if (str == NULL || len == 0) { + return rp; + } + if (!(str[0] & 0x80)) { // 0xxxxxxx + // 7bit, total 7bit + rp.rune = (uint8_t)(str[0]) & 0x7f; + rp.len = 1; + } else if ((uint8_t)str[0] <= 0xdf && 1 < len) { + // 110xxxxxx + // 5bit, total 5bit + rp.rune = (uint8_t)(str[0]) & 0x1f; + + // 6bit, total 11bit + rp.rune <<= 6; + rp.rune |= (uint8_t)(str[1]) & 0x3f; + rp.len = 2; + } else if((uint8_t)str[0] <= 0xef && 2 < len) { // 1110xxxxxx + // 4bit, total 4bit + rp.rune = (uint8_t)(str[0]) & 0x0f; + + // 6bit, total 10bit + rp.rune <<= 6; + rp.rune |= (uint8_t)(str[1]) & 0x3f; + + // 6bit, total 16bit + rp.rune <<= 6; + rp.rune |= (uint8_t)(str[2]) & 0x3f; + + rp.len = 3; + } else if((uint8_t)str[0] <= 0xf7 && 3 < len) { // 11110xxxx + // 3bit, total 3bit + rp.rune = (uint8_t)(str[0]) & 0x07; + + // 6bit, total 9bit + rp.rune <<= 6; + rp.rune |= (uint8_t)(str[1]) & 0x3f; + + // 6bit, total 15bit + rp.rune <<= 6; + rp.rune |= (uint8_t)(str[2]) & 0x3f; + + // 6bit, total 21bit + rp.rune <<= 6; + rp.rune |= (uint8_t)(str[3]) & 0x3f; + + rp.len = 4; + } else { + rp.rune = 0; + rp.len = 0; + } + return rp; +} + +inline bool DecodeRunesInString(const char* s, size_t len, RuneStrArray& runes) { + runes.clear(); + runes.reserve(len / 2); + for (uint32_t i = 0, j = 0; i < len;) { + RuneStrLite rp = DecodeRuneInString(s + i, len - i); + if (rp.len == 0) { + runes.clear(); + return false; + } + RuneStr x(rp.rune, i, rp.len, j, 1); + runes.push_back(x); + i += rp.len; + ++j; + } + return true; +} + +inline bool DecodeRunesInString(const string& s, RuneStrArray& runes) { + return DecodeRunesInString(s.c_str(), s.size(), runes); +} + +inline bool DecodeRunesInString(const char* s, size_t len, Unicode& unicode) { + unicode.clear(); + RuneStrArray runes; + if (!DecodeRunesInString(s, len, runes)) { + return false; + } + unicode.reserve(runes.size()); + for (size_t i = 0; i < runes.size(); i++) { + unicode.push_back(runes[i].rune); + } + return true; +} + +inline bool IsSingleWord(const string& str) { + RuneStrLite rp = DecodeRuneInString(str.c_str(), str.size()); + return rp.len == str.size(); +} + +inline bool DecodeRunesInString(const string& s, Unicode& unicode) { + return DecodeRunesInString(s.c_str(), s.size(), unicode); +} + +inline Unicode DecodeRunesInString(const string& s) { + Unicode result; + DecodeRunesInString(s, result); + return result; +} + + +// [left, right] +inline Word GetWordFromRunes(const string& s, RuneStrArray::const_iterator left, RuneStrArray::const_iterator right) { + assert(right->offset >= left->offset); + uint32_t len = right->offset - left->offset + right->len; + uint32_t unicode_length = right->unicode_offset - left->unicode_offset + right->unicode_length; + return Word(s.substr(left->offset, len), left->offset, left->unicode_offset, unicode_length); +} + +inline string GetStringFromRunes(const string& s, RuneStrArray::const_iterator left, RuneStrArray::const_iterator right) { + assert(right->offset >= left->offset); + uint32_t len = right->offset - left->offset + right->len; + return s.substr(left->offset, len); +} + +inline void GetWordsFromWordRanges(const string& s, const vector& wrs, vector& words) { + for (size_t i = 0; i < wrs.size(); i++) { + words.push_back(GetWordFromRunes(s, wrs[i].left, wrs[i].right)); + } +} + +inline vector GetWordsFromWordRanges(const string& s, const vector& wrs) { + vector result; + GetWordsFromWordRanges(s, wrs, result); + return result; +} + +inline void GetStringsFromWords(const vector& words, vector& strs) { + strs.resize(words.size()); + for (size_t i = 0; i < words.size(); ++i) { + strs[i] = words[i].word; + } +} + +} // namespace cppjieba + +#endif // CPPJIEBA_UNICODE_H diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/ArgvContext.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/ArgvContext.hpp new file mode 100644 index 0000000..ba3abe0 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/ArgvContext.hpp @@ -0,0 +1,70 @@ +/************************************ + * file enc : ascii + * author : wuyanyi09@gmail.com + ************************************/ + +#ifndef LIMONP_ARGV_FUNCTS_H +#define LIMONP_ARGV_FUNCTS_H + +#include +#include +#include "StringUtil.hpp" + +namespace limonp { + +using namespace std; + +class ArgvContext { + public : + ArgvContext(int argc, const char* const * argv) { + for(int i = 0; i < argc; i++) { + if(StartsWith(argv[i], "-")) { + if(i + 1 < argc && !StartsWith(argv[i + 1], "-")) { + mpss_[argv[i]] = argv[i+1]; + i++; + } else { + sset_.insert(argv[i]); + } + } else { + args_.push_back(argv[i]); + } + } + } + ~ArgvContext() { + } + + friend ostream& operator << (ostream& os, const ArgvContext& args); + string operator [](size_t i) const { + if(i < args_.size()) { + return args_[i]; + } + return ""; + } + string operator [](const string& key) const { + map::const_iterator it = mpss_.find(key); + if(it != mpss_.end()) { + return it->second; + } + return ""; + } + + bool HasKey(const string& key) const { + if(mpss_.find(key) != mpss_.end() || sset_.find(key) != sset_.end()) { + return true; + } + return false; + } + + private: + vector args_; + map mpss_; + set sset_; +}; // class ArgvContext + +inline ostream& operator << (ostream& os, const ArgvContext& args) { + return os< +#include "Condition.hpp" + +namespace limonp { +template +class BlockingQueue: NonCopyable { + public: + BlockingQueue() + : mutex_(), notEmpty_(mutex_), queue_() { + } + + void Push(const T& x) { + MutexLockGuard lock(mutex_); + queue_.push(x); + notEmpty_.Notify(); // Wait morphing saves us + } + + T Pop() { + MutexLockGuard lock(mutex_); + // always use a while-loop, due to spurious wakeup + while (queue_.empty()) { + notEmpty_.Wait(); + } + assert(!queue_.empty()); + T front(queue_.front()); + queue_.pop(); + return front; + } + + size_t Size() const { + MutexLockGuard lock(mutex_); + return queue_.size(); + } + bool Empty() const { + return Size() == 0; + } + + private: + mutable MutexLock mutex_; + Condition notEmpty_; + std::queue queue_; +}; // class BlockingQueue + +} // namespace limonp + +#endif // LIMONP_BLOCKINGQUEUE_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/BoundedBlockingQueue.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/BoundedBlockingQueue.hpp new file mode 100644 index 0000000..598d099 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/BoundedBlockingQueue.hpp @@ -0,0 +1,67 @@ +#ifndef LIMONP_BOUNDED_BLOCKING_QUEUE_HPP +#define LIMONP_BOUNDED_BLOCKING_QUEUE_HPP + +#include "BoundedQueue.hpp" + +namespace limonp { + +template +class BoundedBlockingQueue : NonCopyable { + public: + explicit BoundedBlockingQueue(size_t maxSize) + : mutex_(), + notEmpty_(mutex_), + notFull_(mutex_), + queue_(maxSize) { + } + + void Push(const T& x) { + MutexLockGuard lock(mutex_); + while (queue_.Full()) { + notFull_.Wait(); + } + assert(!queue_.Full()); + queue_.Push(x); + notEmpty_.Notify(); + } + + T Pop() { + MutexLockGuard lock(mutex_); + while (queue_.Empty()) { + notEmpty_.Wait(); + } + assert(!queue_.Empty()); + T res = queue_.Pop(); + notFull_.Notify(); + return res; + } + + bool Empty() const { + MutexLockGuard lock(mutex_); + return queue_.Empty(); + } + + bool Full() const { + MutexLockGuard lock(mutex_); + return queue_.Full(); + } + + size_t size() const { + MutexLockGuard lock(mutex_); + return queue_.size(); + } + + size_t capacity() const { + return queue_.capacity(); + } + + private: + mutable MutexLock mutex_; + Condition notEmpty_; + Condition notFull_; + BoundedQueue queue_; +}; // class BoundedBlockingQueue + +} // namespace limonp + +#endif // LIMONP_BOUNDED_BLOCKING_QUEUE_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/BoundedQueue.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/BoundedQueue.hpp new file mode 100644 index 0000000..f52a107 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/BoundedQueue.hpp @@ -0,0 +1,65 @@ +#ifndef LIMONP_BOUNDED_QUEUE_HPP +#define LIMONP_BOUNDED_QUEUE_HPP + +#include +#include +#include + +namespace limonp { +using namespace std; +template +class BoundedQueue { + public: + explicit BoundedQueue(size_t capacity): capacity_(capacity), circular_buffer_(capacity) { + head_ = 0; + tail_ = 0; + size_ = 0; + assert(capacity_); + } + ~BoundedQueue() { + } + + void Clear() { + head_ = 0; + tail_ = 0; + size_ = 0; + } + bool Empty() const { + return !size_; + } + bool Full() const { + return capacity_ == size_; + } + size_t Size() const { + return size_; + } + size_t Capacity() const { + return capacity_; + } + + void Push(const T& t) { + assert(!Full()); + circular_buffer_[tail_] = t; + tail_ = (tail_ + 1) % capacity_; + size_ ++; + } + + T Pop() { + assert(!Empty()); + size_t oldPos = head_; + head_ = (head_ + 1) % capacity_; + size_ --; + return circular_buffer_[oldPos]; + } + + private: + size_t head_; + size_t tail_; + size_t size_; + const size_t capacity_; + vector circular_buffer_; + +}; // class BoundedQueue +} // namespace limonp + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/Closure.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/Closure.hpp new file mode 100644 index 0000000..c9d9dd4 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/Closure.hpp @@ -0,0 +1,206 @@ +#ifndef LIMONP_CLOSURE_HPP +#define LIMONP_CLOSURE_HPP + +namespace limonp { + +class ClosureInterface { + public: + virtual ~ClosureInterface() { + } + virtual void Run() = 0; +}; + +template +class Closure0: public ClosureInterface { + public: + Closure0(Funct fun) { + fun_ = fun; + } + virtual ~Closure0() { + } + virtual void Run() { + (*fun_)(); + } + private: + Funct fun_; +}; + +template +class Closure1: public ClosureInterface { + public: + Closure1(Funct fun, Arg1 arg1) { + fun_ = fun; + arg1_ = arg1; + } + virtual ~Closure1() { + } + virtual void Run() { + (*fun_)(arg1_); + } + private: + Funct fun_; + Arg1 arg1_; +}; + +template +class Closure2: public ClosureInterface { + public: + Closure2(Funct fun, Arg1 arg1, Arg2 arg2) { + fun_ = fun; + arg1_ = arg1; + arg2_ = arg2; + } + virtual ~Closure2() { + } + virtual void Run() { + (*fun_)(arg1_, arg2_); + } + private: + Funct fun_; + Arg1 arg1_; + Arg2 arg2_; +}; + +template +class Closure3: public ClosureInterface { + public: + Closure3(Funct fun, Arg1 arg1, Arg2 arg2, Arg3 arg3) { + fun_ = fun; + arg1_ = arg1; + arg2_ = arg2; + arg3_ = arg3; + } + virtual ~Closure3() { + } + virtual void Run() { + (*fun_)(arg1_, arg2_, arg3_); + } + private: + Funct fun_; + Arg1 arg1_; + Arg2 arg2_; + Arg3 arg3_; +}; + +template +class ObjClosure0: public ClosureInterface { + public: + ObjClosure0(Obj* p, Funct fun) { + p_ = p; + fun_ = fun; + } + virtual ~ObjClosure0() { + } + virtual void Run() { + (p_->*fun_)(); + } + private: + Obj* p_; + Funct fun_; +}; + +template +class ObjClosure1: public ClosureInterface { + public: + ObjClosure1(Obj* p, Funct fun, Arg1 arg1) { + p_ = p; + fun_ = fun; + arg1_ = arg1; + } + virtual ~ObjClosure1() { + } + virtual void Run() { + (p_->*fun_)(arg1_); + } + private: + Obj* p_; + Funct fun_; + Arg1 arg1_; +}; + +template +class ObjClosure2: public ClosureInterface { + public: + ObjClosure2(Obj* p, Funct fun, Arg1 arg1, Arg2 arg2) { + p_ = p; + fun_ = fun; + arg1_ = arg1; + arg2_ = arg2; + } + virtual ~ObjClosure2() { + } + virtual void Run() { + (p_->*fun_)(arg1_, arg2_); + } + private: + Obj* p_; + Funct fun_; + Arg1 arg1_; + Arg2 arg2_; +}; +template +class ObjClosure3: public ClosureInterface { + public: + ObjClosure3(Obj* p, Funct fun, Arg1 arg1, Arg2 arg2, Arg3 arg3) { + p_ = p; + fun_ = fun; + arg1_ = arg1; + arg2_ = arg2; + arg3_ = arg3; + } + virtual ~ObjClosure3() { + } + virtual void Run() { + (p_->*fun_)(arg1_, arg2_, arg3_); + } + private: + Obj* p_; + Funct fun_; + Arg1 arg1_; + Arg2 arg2_; + Arg3 arg3_; +}; + +template +ClosureInterface* NewClosure(R (*fun)()) { + return new Closure0(fun); +} + +template +ClosureInterface* NewClosure(R (*fun)(Arg1), Arg1 arg1) { + return new Closure1(fun, arg1); +} + +template +ClosureInterface* NewClosure(R (*fun)(Arg1, Arg2), Arg1 arg1, Arg2 arg2) { + return new Closure2(fun, arg1, arg2); +} + +template +ClosureInterface* NewClosure(R (*fun)(Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3) { + return new Closure3(fun, arg1, arg2, arg3); +} + +template +ClosureInterface* NewClosure(Obj* obj, R (Obj::* fun)()) { + return new ObjClosure0(obj, fun); +} + +template +ClosureInterface* NewClosure(Obj* obj, R (Obj::* fun)(Arg1), Arg1 arg1) { + return new ObjClosure1(obj, fun, arg1); +} + +template +ClosureInterface* NewClosure(Obj* obj, R (Obj::* fun)(Arg1, Arg2), Arg1 arg1, Arg2 arg2) { + return new ObjClosure2(obj, fun, arg1, arg2); +} + +template +ClosureInterface* NewClosure(Obj* obj, R (Obj::* fun)(Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3) { + return new ObjClosure3(obj, fun, arg1, arg2, arg3); +} + +} // namespace limonp + +#endif // LIMONP_CLOSURE_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/Colors.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/Colors.hpp new file mode 100644 index 0000000..04edd7e --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/Colors.hpp @@ -0,0 +1,31 @@ +#ifndef LIMONP_COLOR_PRINT_HPP +#define LIMONP_COLOR_PRINT_HPP + +#include +#include + +namespace limonp { + +using std::string; + +enum Color { + BLACK = 30, + RED, + GREEN, + YELLOW, + BLUE, + PURPLE +}; // enum Color + +static void ColorPrintln(enum Color color, const char * fmt, ...) { + va_list ap; + printf("\033[0;%dm", color); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + printf("\033[0m\n"); // if not \n , in some situation , the next lines will be set the same color unexpectedly +} + +} // namespace limonp + +#endif // LIMONP_COLOR_PRINT_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/Condition.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/Condition.hpp new file mode 100644 index 0000000..656a61d --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/Condition.hpp @@ -0,0 +1,38 @@ +#ifndef LIMONP_CONDITION_HPP +#define LIMONP_CONDITION_HPP + +#include "MutexLock.hpp" + +namespace limonp { + +class Condition : NonCopyable { + public: + explicit Condition(MutexLock& mutex) + : mutex_(mutex) { + XCHECK(!pthread_cond_init(&pcond_, NULL)); + } + + ~Condition() { + XCHECK(!pthread_cond_destroy(&pcond_)); + } + + void Wait() { + XCHECK(!pthread_cond_wait(&pcond_, mutex_.GetPthreadMutex())); + } + + void Notify() { + XCHECK(!pthread_cond_signal(&pcond_)); + } + + void NotifyAll() { + XCHECK(!pthread_cond_broadcast(&pcond_)); + } + + private: + MutexLock& mutex_; + pthread_cond_t pcond_; +}; // class Condition + +} // namespace limonp + +#endif // LIMONP_CONDITION_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/Config.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/Config.hpp new file mode 100644 index 0000000..c98f222 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/Config.hpp @@ -0,0 +1,103 @@ +/************************************ + * file enc : utf8 + * author : wuyanyi09@gmail.com + ************************************/ +#ifndef LIMONP_CONFIG_H +#define LIMONP_CONFIG_H + +#include +#include +#include +#include +#include "StringUtil.hpp" + +namespace limonp { + +using namespace std; + +class Config { + public: + explicit Config(const string& filePath) { + LoadFile(filePath); + } + + operator bool () { + return !map_.empty(); + } + + string Get(const string& key, const string& defaultvalue) const { + map::const_iterator it = map_.find(key); + if(map_.end() != it) { + return it->second; + } + return defaultvalue; + } + int Get(const string& key, int defaultvalue) const { + string str = Get(key, ""); + if("" == str) { + return defaultvalue; + } + return atoi(str.c_str()); + } + const char* operator [] (const char* key) const { + if(NULL == key) { + return NULL; + } + map::const_iterator it = map_.find(key); + if(map_.end() != it) { + return it->second.c_str(); + } + return NULL; + } + + string GetConfigInfo() const { + string res; + res << *this; + return res; + } + + private: + void LoadFile(const string& filePath) { + ifstream ifs(filePath.c_str()); + assert(ifs); + string line; + vector vecBuf; + size_t lineno = 0; + while(getline(ifs, line)) { + lineno ++; + Trim(line); + if(line.empty() || StartsWith(line, "#")) { + continue; + } + vecBuf.clear(); + Split(line, vecBuf, "="); + if(2 != vecBuf.size()) { + fprintf(stderr, "line[%s] illegal.\n", line.c_str()); + assert(false); + continue; + } + string& key = vecBuf[0]; + string& value = vecBuf[1]; + Trim(key); + Trim(value); + if(!map_.insert(make_pair(key, value)).second) { + fprintf(stderr, "key[%s] already exits.\n", key.c_str()); + assert(false); + continue; + } + } + ifs.close(); + } + + friend ostream& operator << (ostream& os, const Config& config); + + map map_; +}; // class Config + +inline ostream& operator << (ostream& os, const Config& config) { + return os << config.map_; +} + +} // namespace limonp + +#endif // LIMONP_CONFIG_H diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/FileLock.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/FileLock.hpp new file mode 100644 index 0000000..56a478a --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/FileLock.hpp @@ -0,0 +1,74 @@ +#ifndef LIMONP_FILELOCK_HPP +#define LIMONP_FILELOCK_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace limonp { + +using std::string; + +class FileLock { + public: + FileLock() : fd_(-1), ok_(true) { + } + ~FileLock() { + if(fd_ > 0) { + Close(); + } + } + void Open(const string& fname) { + assert(fd_ == -1); + fd_ = open(fname.c_str(), O_RDWR | O_CREAT, 0644); + if(fd_ < 0) { + ok_ = false; + err_ = strerror(errno); + } + } + void Close() { + ::close(fd_); + } + void Lock() { + if(LockOrUnlock(fd_, true) < 0) { + ok_ = false; + err_ = strerror(errno); + } + } + void UnLock() { + if(LockOrUnlock(fd_, false) < 0) { + ok_ = false; + err_ = strerror(errno); + } + } + bool Ok() const { + return ok_; + } + string Error() const { + return err_; + } + private: + static int LockOrUnlock(int fd, bool lock) { + errno = 0; + struct flock f; + memset(&f, 0, sizeof(f)); + f.l_type = (lock ? F_WRLCK : F_UNLCK); + f.l_whence = SEEK_SET; + f.l_start = 0; + f.l_len = 0; // Lock/unlock entire file + return fcntl(fd, F_SETLK, &f); + } + + int fd_; + bool ok_; + string err_; +}; // class FileLock + +}// namespace limonp + +#endif // LIMONP_FILELOCK_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/ForcePublic.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/ForcePublic.hpp new file mode 100644 index 0000000..2076682 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/ForcePublic.hpp @@ -0,0 +1,7 @@ +#ifndef LIMONP_FORCE_PUBLIC_H +#define LIMONP_FORCE_PUBLIC_H + +#define private public +#define protected public + +#endif // LIMONP_FORCE_PUBLIC_H diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/LocalVector.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/LocalVector.hpp new file mode 100644 index 0000000..11339cc --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/LocalVector.hpp @@ -0,0 +1,139 @@ +#ifndef LIMONP_LOCAL_VECTOR_HPP +#define LIMONP_LOCAL_VECTOR_HPP + +#include +#include +#include +#include + +namespace limonp { +using namespace std; +/* + * LocalVector : T must be primitive type (char , int, size_t), if T is struct or class, LocalVector may be dangerous.. + * LocalVector is simple and not well-tested. + */ +const size_t LOCAL_VECTOR_BUFFER_SIZE = 16; +template +class LocalVector { + public: + typedef const T* const_iterator ; + typedef T value_type; + typedef size_t size_type; + private: + T buffer_[LOCAL_VECTOR_BUFFER_SIZE]; + T * ptr_; + size_t size_; + size_t capacity_; + public: + LocalVector() { + init_(); + }; + LocalVector(const LocalVector& vec) { + init_(); + *this = vec; + } + LocalVector(const_iterator begin, const_iterator end) { // TODO: make it faster + init_(); + while(begin != end) { + push_back(*begin++); + } + } + LocalVector(size_t size, const T& t) { // TODO: make it faster + init_(); + while(size--) { + push_back(t); + } + } + ~LocalVector() { + if(ptr_ != buffer_) { + free(ptr_); + } + }; + public: + LocalVector& operator = (const LocalVector& vec) { + clear(); + size_ = vec.size(); + capacity_ = vec.capacity(); + if(vec.buffer_ == vec.ptr_) { + memcpy(static_cast(buffer_), vec.buffer_, sizeof(T) * size_); + ptr_ = buffer_; + } else { + ptr_ = (T*) malloc(vec.capacity() * sizeof(T)); + assert(ptr_); + memcpy(static_cast(ptr_), vec.ptr_, vec.size() * sizeof(T)); + } + return *this; + } + private: + void init_() { + ptr_ = buffer_; + size_ = 0; + capacity_ = LOCAL_VECTOR_BUFFER_SIZE; + } + public: + T& operator [] (size_t i) { + return ptr_[i]; + } + const T& operator [] (size_t i) const { + return ptr_[i]; + } + void push_back(const T& t) { + if(size_ == capacity_) { + assert(capacity_); + reserve(capacity_ * 2); + } + ptr_[size_ ++ ] = t; + } + void reserve(size_t size) { + if(size <= capacity_) { + return; + } + T * next = (T*)malloc(sizeof(T) * size); + assert(next); + T * old = ptr_; + ptr_ = next; + memcpy(static_cast(ptr_), old, sizeof(T) * capacity_); + capacity_ = size; + if(old != buffer_) { + free(old); + } + } + bool empty() const { + return 0 == size(); + } + size_t size() const { + return size_; + } + size_t capacity() const { + return capacity_; + } + const_iterator begin() const { + return ptr_; + } + const_iterator end() const { + return ptr_ + size_; + } + void clear() { + if(ptr_ != buffer_) { + free(ptr_); + } + init_(); + } +}; + +template +ostream & operator << (ostream& os, const LocalVector& vec) { + if(vec.empty()) { + return os << "[]"; + } + os<<"[\""< +#include +#include +#include +#include + +#ifdef XLOG +#error "XLOG has been defined already" +#endif // XLOG +#ifdef XCHECK +#error "XCHECK has been defined already" +#endif // XCHECK + +#define XLOG(level) limonp::Logger(limonp::LL_##level, __FILE__, __LINE__).Stream() +#define XCHECK(exp) if(!(exp)) XLOG(FATAL) << "exp: ["#exp << "] false. " + +namespace limonp { + +enum { + LL_DEBUG = 0, + LL_INFO = 1, + LL_WARNING = 2, + LL_ERROR = 3, + LL_FATAL = 4, +}; // enum + +static const char * LOG_LEVEL_ARRAY[] = {"DEBUG","INFO","WARN","ERROR","FATAL"}; +static const char * LOG_TIME_FORMAT = "%Y-%m-%d %H:%M:%S"; + +class Logger { + public: + Logger(size_t level, const char* filename, int lineno) + : level_(level) { +#ifdef LOGGING_LEVEL + if (level_ < LOGGING_LEVEL) { + return; + } +#endif + assert(level_ <= sizeof(LOG_LEVEL_ARRAY)/sizeof(*LOG_LEVEL_ARRAY)); + + char buf[32]; + + time_t timeNow; + time(&timeNow); + + struct tm tmNow; + + #if defined(_WIN32) || defined(_WIN64) + errno_t e = localtime_s(&tmNow, &timeNow); + assert(e == 0); + #else + struct tm * tm_tmp = localtime_r(&timeNow, &tmNow); + assert(tm_tmp != nullptr); + #endif + + strftime(buf, sizeof(buf), LOG_TIME_FORMAT, &tmNow); + + stream_ << buf + << " " << filename + << ":" << lineno + << " " << LOG_LEVEL_ARRAY[level_] + << " "; + } + ~Logger() { +#ifdef LOGGING_LEVEL + if (level_ < LOGGING_LEVEL) { + return; + } +#endif + std::cerr << stream_.str() << std::endl; + if (level_ == LL_FATAL) { + abort(); + } + } + + std::ostream& Stream() { + return stream_; + } + + private: + std::ostringstream stream_; + size_t level_; +}; // class Logger + +} // namespace limonp + +#endif // LIMONP_LOGGING_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/Md5.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/Md5.hpp new file mode 100644 index 0000000..68e1d01 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/Md5.hpp @@ -0,0 +1,411 @@ +#ifndef __MD5_H__ +#define __MD5_H__ + +// Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +// rights reserved. + +// License to copy and use this software is granted provided that it +// is identified as the "RSA Data Security, Inc. MD5 Message-Digest +// Algorithm" in all material mentioning or referencing this software +// or this function. +// +// License is also granted to make and use derivative works provided +// that such works are identified as "derived from the RSA Data +// Security, Inc. MD5 Message-Digest Algorithm" in all material +// mentioning or referencing the derived work. +// +// RSA Data Security, Inc. makes no representations concerning either +// the merchantability of this software or the suitability of this +// software for any particular purpose. It is provided "as is" +// without express or implied warranty of any kind. +// +// These notices must be retained in any copies of any part of this +// documentation and/or software. + + + +// The original md5 implementation avoids external libraries. +// This version has dependency on stdio.h for file input and +// string.h for memcpy. +#include +#include +#include + +namespace limonp { + +//#pragma region MD5 defines +// Constants for MD5Transform routine. +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + + +// F, G, H and I are basic MD5 functions. +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +// ROTATE_LEFT rotates x left n bits. +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +// Rotation is separate from addition to prevent recomputation. +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +//#pragma endregion + + +typedef unsigned char BYTE ; + +// POINTER defines a generic pointer type +typedef unsigned char *POINTER; + +// UINT2 defines a two byte word +typedef unsigned short int UINT2; + +// UINT4 defines a four byte word +typedef unsigned int UINT4; + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +// convenient object that wraps +// the C-functions for use in C++ only +class MD5 { + private: + struct __context_t { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ + } context ; + + //#pragma region static helper functions + // The core of the MD5 algorithm is here. + // MD5 basic transformation. Transforms state based on block. + static void MD5Transform( UINT4 state[4], unsigned char block[64] ) { + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + // Zeroize sensitive information. + memset((POINTER)x, 0, sizeof (x)); + } + + // Encodes input (UINT4) into output (unsigned char). Assumes len is + // a multiple of 4. + static void Encode( unsigned char *output, UINT4 *input, unsigned int len ) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } + } + + // Decodes input (unsigned char) into output (UINT4). Assumes len is + // a multiple of 4. + static void Decode( UINT4 *output, unsigned char *input, unsigned int len ) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); + } + //#pragma endregion + + + public: + // MAIN FUNCTIONS + MD5() { + Init() ; + } + + // MD5 initialization. Begins an MD5 operation, writing a new context. + void Init() { + context.count[0] = context.count[1] = 0; + + // Load magic initialization constants. + context.state[0] = 0x67452301; + context.state[1] = 0xefcdab89; + context.state[2] = 0x98badcfe; + context.state[3] = 0x10325476; + } + + // MD5 block update operation. Continues an MD5 message-digest + // operation, processing another message block, and updating the + // context. + void Update( + unsigned char *input, // input block + unsigned int inputLen ) { // length of input block + unsigned int i, index, partLen; + + // Compute number of bytes mod 64 + index = (unsigned int)((context.count[0] >> 3) & 0x3F); + + // Update number of bits + if ((context.count[0] += ((UINT4)inputLen << 3)) + < ((UINT4)inputLen << 3)) + context.count[1]++; + context.count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - index; + + // Transform as many times as possible. + if (inputLen >= partLen) { + memcpy((POINTER)&context.buffer[index], (POINTER)input, partLen); + MD5Transform (context.state, context.buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context.state, &input[i]); + + index = 0; + } else + i = 0; + + /* Buffer remaining input */ + memcpy((POINTER)&context.buffer[index], (POINTER)&input[i], inputLen-i); + } + + // MD5 finalization. Ends an MD5 message-digest operation, writing the + // the message digest and zeroizing the context. + // Writes to digestRaw + void Final() { + unsigned char bits[8]; + unsigned int index, padLen; + + // Save number of bits + Encode( bits, context.count, 8 ); + + // Pad out to 56 mod 64. + index = (unsigned int)((context.count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + Update( PADDING, padLen ); + + // Append length (before padding) + Update( bits, 8 ); + + // Store state in digest + Encode( digestRaw, context.state, 16); + + // Zeroize sensitive information. + memset((POINTER)&context, 0, sizeof (context)); + + writeToString() ; + } + + /// Buffer must be 32+1 (nul) = 33 chars long at least + void writeToString() { + int pos ; + + for( pos = 0 ; pos < 16 ; pos++ ) + sprintf( digestChars+(pos*2), "%02x", digestRaw[pos] ) ; + } + + + public: + // an MD5 digest is a 16-byte number (32 hex digits) + BYTE digestRaw[ 16 ] ; + + // This version of the digest is actually + // a "printf'd" version of the digest. + char digestChars[ 33 ] ; + + /// Load a file from disk and digest it + // Digests a file and returns the result. + const char* digestFile( const char *filename ) { + if (NULL == filename || strcmp(filename, "") == 0) + return NULL; + + Init() ; + + FILE *file; + + unsigned char buffer[1024] ; + + if((file = fopen (filename, "rb")) == NULL) { + return NULL; + } + int len; + while( (len = fread( buffer, 1, 1024, file )) ) + Update( buffer, len ) ; + Final(); + + fclose( file ); + + return digestChars ; + } + + /// Digests a byte-array already in memory + const char* digestMemory( BYTE *memchunk, int len ) { + if (NULL == memchunk) + return NULL; + + Init() ; + Update( memchunk, len ) ; + Final() ; + + return digestChars ; + } + + // Digests a string and prints the result. + const char* digestString(const char *string ) { + if (string == NULL) + return NULL; + + Init() ; + Update( (unsigned char*)string, strlen(string) ) ; + Final() ; + + return digestChars ; + } +}; + +inline bool md5String(const char* str, std::string& res) { + if (NULL == str) { + res = ""; + return false; + } + + MD5 md5; + const char *pRes = md5.digestString(str); + if (NULL == pRes) { + res = ""; + return false; + } + + res = pRes; + return true; +} + +inline bool md5File(const char* filepath, std::string& res) { + if (NULL == filepath || strcmp(filepath, "") == 0) { + res = ""; + return false; + } + + MD5 md5; + const char *pRes = md5.digestFile(filepath); + + if (NULL == pRes) { + res = ""; + return false; + } + + res = pRes; + return true; +} +} +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/MutexLock.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/MutexLock.hpp new file mode 100644 index 0000000..ea10d6d --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/MutexLock.hpp @@ -0,0 +1,51 @@ +#ifndef LIMONP_MUTEX_LOCK_HPP +#define LIMONP_MUTEX_LOCK_HPP + +#include +#include "NonCopyable.hpp" +#include "Logging.hpp" + +namespace limonp { + +class MutexLock: NonCopyable { + public: + MutexLock() { + XCHECK(!pthread_mutex_init(&mutex_, NULL)); + } + ~MutexLock() { + XCHECK(!pthread_mutex_destroy(&mutex_)); + } + pthread_mutex_t* GetPthreadMutex() { + return &mutex_; + } + + private: + void Lock() { + XCHECK(!pthread_mutex_lock(&mutex_)); + } + void Unlock() { + XCHECK(!pthread_mutex_unlock(&mutex_)); + } + friend class MutexLockGuard; + + pthread_mutex_t mutex_; +}; // class MutexLock + +class MutexLockGuard: NonCopyable { + public: + explicit MutexLockGuard(MutexLock & mutex) + : mutex_(mutex) { + mutex_.Lock(); + } + ~MutexLockGuard() { + mutex_.Unlock(); + } + private: + MutexLock & mutex_; +}; // class MutexLockGuard + +#define MutexLockGuard(x) XCHECK(false); + +} // namespace limonp + +#endif // LIMONP_MUTEX_LOCK_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/NonCopyable.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/NonCopyable.hpp new file mode 100644 index 0000000..145400f --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/NonCopyable.hpp @@ -0,0 +1,21 @@ +/************************************ + ************************************/ +#ifndef LIMONP_NONCOPYABLE_H +#define LIMONP_NONCOPYABLE_H + +namespace limonp { + +class NonCopyable { + protected: + NonCopyable() { + } + ~NonCopyable() { + } + private: + NonCopyable(const NonCopyable& ); + const NonCopyable& operator=(const NonCopyable& ); +}; // class NonCopyable + +} // namespace limonp + +#endif // LIMONP_NONCOPYABLE_H diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/StdExtension.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/StdExtension.hpp new file mode 100644 index 0000000..cf00e94 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/StdExtension.hpp @@ -0,0 +1,157 @@ +#ifndef LIMONP_STD_EXTEMSION_HPP +#define LIMONP_STD_EXTEMSION_HPP + +#include + +#ifdef __APPLE__ +#include +#include +#elif(__cplusplus >= 201103L) +#include +#include +#elif defined _MSC_VER +#include +#include +#else +#include +#include +namespace std { +using std::tr1::unordered_map; +using std::tr1::unordered_set; +} + +#endif + +#include +#include +#include +#include +#include +#include + +namespace std { + +template +ostream& operator << (ostream& os, const vector& v) { + if(v.empty()) { + return os << "[]"; + } + os<<"["< +inline ostream& operator << (ostream& os, const vector& v) { + if(v.empty()) { + return os << "[]"; + } + os<<"[\""< +ostream& operator << (ostream& os, const deque& dq) { + if(dq.empty()) { + return os << "[]"; + } + os<<"[\""< +ostream& operator << (ostream& os, const pair& pr) { + os << pr.first << ":" << pr.second ; + return os; +} + + +template +string& operator << (string& str, const T& obj) { + stringstream ss; + ss << obj; // call ostream& operator << (ostream& os, + return str = ss.str(); +} + +template +ostream& operator << (ostream& os, const map& mp) { + if(mp.empty()) { + os<<"{}"; + return os; + } + os<<'{'; + typename map::const_iterator it = mp.begin(); + os<<*it; + it++; + while(it != mp.end()) { + os<<", "<<*it; + it++; + } + os<<'}'; + return os; +} +template +ostream& operator << (ostream& os, const std::unordered_map& mp) { + if(mp.empty()) { + return os << "{}"; + } + os<<'{'; + typename std::unordered_map::const_iterator it = mp.begin(); + os<<*it; + it++; + while(it != mp.end()) { + os<<", "<<*it++; + } + return os<<'}'; +} + +template +ostream& operator << (ostream& os, const set& st) { + if(st.empty()) { + os << "{}"; + return os; + } + os<<'{'; + typename set::const_iterator it = st.begin(); + os<<*it; + it++; + while(it != st.end()) { + os<<", "<<*it; + it++; + } + os<<'}'; + return os; +} + +template +bool IsIn(const ContainType& contain, const KeyType& key) { + return contain.end() != contain.find(key); +} + +template +basic_string & operator << (basic_string & s, ifstream & ifs) { + return s.assign((istreambuf_iterator(ifs)), istreambuf_iterator()); +} + +template +ofstream & operator << (ofstream & ofs, const basic_string& s) { + ostreambuf_iterator itr (ofs); + copy(s.begin(), s.end(), itr); + return ofs; +} + +} // namespace std + +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/StringUtil.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/StringUtil.hpp new file mode 100644 index 0000000..ad3be56 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/StringUtil.hpp @@ -0,0 +1,405 @@ +/************************************ + * file enc : ascii + * author : wuyanyi09@gmail.com + ************************************/ +#ifndef LIMONP_STR_FUNCTS_H +#define LIMONP_STR_FUNCTS_H +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "StdExtension.hpp" + +namespace limonp { +using namespace std; +inline string StringFormat(const char* fmt, ...) { + int size = 256; + std::string str; + va_list ap; + while (1) { + str.resize(size); + va_start(ap, fmt); + int n = vsnprintf((char *)str.c_str(), size, fmt, ap); + va_end(ap); + if (n > -1 && n < size) { + str.resize(n); + return str; + } + if (n > -1) + size = n + 1; + else + size *= 2; + } + return str; +} + +template +void Join(T begin, T end, string& res, const string& connector) { + if(begin == end) { + return; + } + stringstream ss; + ss<<*begin; + begin++; + while(begin != end) { + ss << connector << *begin; + begin ++; + } + res = ss.str(); +} + +template +string Join(T begin, T end, const string& connector) { + string res; + Join(begin ,end, res, connector); + return res; +} + +inline string& Upper(string& str) { + transform(str.begin(), str.end(), str.begin(), (int (*)(int))toupper); + return str; +} + +inline string& Lower(string& str) { + transform(str.begin(), str.end(), str.begin(), (int (*)(int))tolower); + return str; +} + +inline bool IsSpace(unsigned c) { + // when passing large int as the argument of isspace, it core dump, so here need a type cast. + return c > 0xff ? false : std::isspace(c & 0xff) != 0; +} + +inline std::string& LTrim(std::string &s) { +#if defined(_MSC_VER) && _MSC_VER >= 1910 + s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { + return !std::isspace(ch); + })); +#else + // Use lower version of MSVC + s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(IsSpace)))); +#endif + return s; +} + +inline std::string& RTrim(std::string &s) { +#if defined(_MSC_VER) && _MSC_VER >= 1910 + // Use MSVC 2017 or higher version + s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) { + return !std::isspace(ch); + }).base(), s.end()); +#else + // Use lower version of MSVC + s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(IsSpace))).base(), s.end()); +#endif + return s; +} + +inline std::string& Trim(std::string &s) { + return LTrim(RTrim(s)); +} + +inline std::string& LTrim(std::string& s, char x) { +#if defined(_MSC_VER) && _MSC_VER >= 1910 + s.erase(s.begin(), std::find_if(s.begin(), s.end(), + [x](unsigned char c) { return !std::isspace(c) && c != x; })); +#else + s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::bind2nd(std::equal_to(), x)))); +#endif + return s; +} + +inline std::string& RTrim(std::string& s, char x) { +#if defined(_MSC_VER) && _MSC_VER >= 1910 + s.erase(std::find_if(s.rbegin(), s.rend(), + [x](unsigned char c) { return !std::isspace(c) && c != x; }).base(), s.end()); +#else + s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::bind2nd(std::equal_to(), x))).base(), s.end()); +#endif + return s; +} + +inline std::string& Trim(std::string &s, char x) { + return LTrim(RTrim(s, x), x); +} + +inline void Split(const string& src, vector& res, const string& pattern, size_t maxsplit = string::npos) { + res.clear(); + size_t Start = 0; + size_t end = 0; + string sub; + while(Start < src.size()) { + end = src.find_first_of(pattern, Start); + if(string::npos == end || res.size() >= maxsplit) { + sub = src.substr(Start); + res.push_back(sub); + return; + } + sub = src.substr(Start, end - Start); + res.push_back(sub); + Start = end + 1; + } + return; +} + +inline vector Split(const string& src, const string& pattern, size_t maxsplit = string::npos) { + vector res; + Split(src, res, pattern, maxsplit); + return res; +} + +inline bool StartsWith(const string& str, const string& prefix) { + if(prefix.length() > str.length()) { + return false; + } + return 0 == str.compare(0, prefix.length(), prefix); +} + +inline bool EndsWith(const string& str, const string& suffix) { + if(suffix.length() > str.length()) { + return false; + } + return 0 == str.compare(str.length() - suffix.length(), suffix.length(), suffix); +} + +inline bool IsInStr(const string& str, char ch) { + return str.find(ch) != string::npos; +} + +inline uint16_t TwocharToUint16(char high, char low) { + return (((uint16_t(high) & 0x00ff ) << 8) | (uint16_t(low) & 0x00ff)); +} + +template +bool Utf8ToUnicode(const char * const str, size_t len, Uint16Container& vec) { + if(!str) { + return false; + } + char ch1, ch2; + uint16_t tmp; + vec.clear(); + for(size_t i = 0; i < len;) { + if(!(str[i] & 0x80)) { // 0xxxxxxx + vec.push_back(str[i]); + i++; + } else if ((uint8_t)str[i] <= 0xdf && i + 1 < len) { // 110xxxxxx + ch1 = (str[i] >> 2) & 0x07; + ch2 = (str[i+1] & 0x3f) | ((str[i] & 0x03) << 6 ); + tmp = (((uint16_t(ch1) & 0x00ff ) << 8) | (uint16_t(ch2) & 0x00ff)); + vec.push_back(tmp); + i += 2; + } else if((uint8_t)str[i] <= 0xef && i + 2 < len) { + ch1 = ((uint8_t)str[i] << 4) | ((str[i+1] >> 2) & 0x0f ); + ch2 = (((uint8_t)str[i+1]<<6) & 0xc0) | (str[i+2] & 0x3f); + tmp = (((uint16_t(ch1) & 0x00ff ) << 8) | (uint16_t(ch2) & 0x00ff)); + vec.push_back(tmp); + i += 3; + } else { + return false; + } + } + return true; +} + +template +bool Utf8ToUnicode(const string& str, Uint16Container& vec) { + return Utf8ToUnicode(str.c_str(), str.size(), vec); +} + +template +bool Utf8ToUnicode32(const string& str, Uint32Container& vec) { + uint32_t tmp; + vec.clear(); + for(size_t i = 0; i < str.size();) { + if(!(str[i] & 0x80)) { // 0xxxxxxx + // 7bit, total 7bit + tmp = (uint8_t)(str[i]) & 0x7f; + i++; + } else if ((uint8_t)str[i] <= 0xdf && i + 1 < str.size()) { // 110xxxxxx + // 5bit, total 5bit + tmp = (uint8_t)(str[i]) & 0x1f; + + // 6bit, total 11bit + tmp <<= 6; + tmp |= (uint8_t)(str[i+1]) & 0x3f; + i += 2; + } else if((uint8_t)str[i] <= 0xef && i + 2 < str.size()) { // 1110xxxxxx + // 4bit, total 4bit + tmp = (uint8_t)(str[i]) & 0x0f; + + // 6bit, total 10bit + tmp <<= 6; + tmp |= (uint8_t)(str[i+1]) & 0x3f; + + // 6bit, total 16bit + tmp <<= 6; + tmp |= (uint8_t)(str[i+2]) & 0x3f; + + i += 3; + } else if((uint8_t)str[i] <= 0xf7 && i + 3 < str.size()) { // 11110xxxx + // 3bit, total 3bit + tmp = (uint8_t)(str[i]) & 0x07; + + // 6bit, total 9bit + tmp <<= 6; + tmp |= (uint8_t)(str[i+1]) & 0x3f; + + // 6bit, total 15bit + tmp <<= 6; + tmp |= (uint8_t)(str[i+2]) & 0x3f; + + // 6bit, total 21bit + tmp <<= 6; + tmp |= (uint8_t)(str[i+3]) & 0x3f; + + i += 4; + } else { + return false; + } + vec.push_back(tmp); + } + return true; +} + +template +void Unicode32ToUtf8(Uint32ContainerConIter begin, Uint32ContainerConIter end, string& res) { + res.clear(); + uint32_t ui; + while(begin != end) { + ui = *begin; + if(ui <= 0x7f) { + res += char(ui); + } else if(ui <= 0x7ff) { + res += char(((ui >> 6) & 0x1f) | 0xc0); + res += char((ui & 0x3f) | 0x80); + } else if(ui <= 0xffff) { + res += char(((ui >> 12) & 0x0f) | 0xe0); + res += char(((ui >> 6) & 0x3f) | 0x80); + res += char((ui & 0x3f) | 0x80); + } else { + res += char(((ui >> 18) & 0x03) | 0xf0); + res += char(((ui >> 12) & 0x3f) | 0x80); + res += char(((ui >> 6) & 0x3f) | 0x80); + res += char((ui & 0x3f) | 0x80); + } + begin ++; + } +} + +template +void UnicodeToUtf8(Uint16ContainerConIter begin, Uint16ContainerConIter end, string& res) { + res.clear(); + uint16_t ui; + while(begin != end) { + ui = *begin; + if(ui <= 0x7f) { + res += char(ui); + } else if(ui <= 0x7ff) { + res += char(((ui>>6) & 0x1f) | 0xc0); + res += char((ui & 0x3f) | 0x80); + } else { + res += char(((ui >> 12) & 0x0f )| 0xe0); + res += char(((ui>>6) & 0x3f )| 0x80 ); + res += char((ui & 0x3f) | 0x80); + } + begin ++; + } +} + + +template +bool GBKTrans(const char* const str, size_t len, Uint16Container& vec) { + vec.clear(); + if(!str) { + return true; + } + size_t i = 0; + while(i < len) { + if(0 == (str[i] & 0x80)) { + vec.push_back(uint16_t(str[i])); + i++; + } else { + if(i + 1 < len) { //&& (str[i+1] & 0x80)) + uint16_t tmp = (((uint16_t(str[i]) & 0x00ff ) << 8) | (uint16_t(str[i+1]) & 0x00ff)); + vec.push_back(tmp); + i += 2; + } else { + return false; + } + } + } + return true; +} + +template +bool GBKTrans(const string& str, Uint16Container& vec) { + return GBKTrans(str.c_str(), str.size(), vec); +} + +template +void GBKTrans(Uint16ContainerConIter begin, Uint16ContainerConIter end, string& res) { + res.clear(); + //pair pa; + char first, second; + while(begin != end) { + //pa = uint16ToChar2(*begin); + first = ((*begin)>>8) & 0x00ff; + second = (*begin) & 0x00ff; + if(first & 0x80) { + res += first; + res += second; + } else { + res += second; + } + begin++; + } +} + +/* + * format example: "%Y-%m-%d %H:%M:%S" + */ +inline void GetTime(const string& format, string& timeStr) { + time_t timeNow; + time(&timeNow); + + struct tm tmNow; + + #if defined(_WIN32) || defined(_WIN64) + errno_t e = localtime_s(&tmNow, &timeNow); + assert(e = 0); + #else + struct tm * tm_tmp = localtime_r(&timeNow, &tmNow); + assert(tm_tmp != nullptr); + #endif + + timeStr.resize(64); + + size_t len = strftime((char*)timeStr.c_str(), timeStr.size(), format.c_str(), &tmNow); + + timeStr.resize(len); +} + +inline string PathJoin(const string& path1, const string& path2) { + if(EndsWith(path1, "/")) { + return path1 + path2; + } + return path1 + "/" + path2; +} + +} +#endif diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/Thread.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/Thread.hpp new file mode 100644 index 0000000..4e3c084 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/Thread.hpp @@ -0,0 +1,44 @@ +#ifndef LIMONP_THREAD_HPP +#define LIMONP_THREAD_HPP + +#include "Logging.hpp" +#include "NonCopyable.hpp" + +namespace limonp { + +class IThread: NonCopyable { + public: + IThread(): isStarted(false), isJoined(false) { + } + virtual ~IThread() { + if(isStarted && !isJoined) { + XCHECK(!pthread_detach(thread_)); + } + }; + + virtual void Run() = 0; + void Start() { + XCHECK(!isStarted); + XCHECK(!pthread_create(&thread_, NULL, Worker, this)); + isStarted = true; + } + void Join() { + XCHECK(!isJoined); + XCHECK(!pthread_join(thread_, NULL)); + isJoined = true; + } + private: + static void * Worker(void * data) { + IThread * ptr = (IThread* ) data; + ptr->Run(); + return NULL; + } + + pthread_t thread_; + bool isStarted; + bool isJoined; +}; // class IThread + +} // namespace limonp + +#endif // LIMONP_THREAD_HPP diff --git a/runtime/onnxruntime/third_party/jieba/include/limonp/ThreadPool.hpp b/runtime/onnxruntime/third_party/jieba/include/limonp/ThreadPool.hpp new file mode 100644 index 0000000..fb0ee57 --- /dev/null +++ b/runtime/onnxruntime/third_party/jieba/include/limonp/ThreadPool.hpp @@ -0,0 +1,86 @@ +#ifndef LIMONP_THREAD_POOL_HPP +#define LIMONP_THREAD_POOL_HPP + +#include "Thread.hpp" +#include "BlockingQueue.hpp" +#include "BoundedBlockingQueue.hpp" +#include "Closure.hpp" + +namespace limonp { + +using namespace std; + +//class ThreadPool; +class ThreadPool: NonCopyable { + public: + class Worker: public IThread { + public: + Worker(ThreadPool* pool): ptThreadPool_(pool) { + assert(ptThreadPool_); + } + virtual ~Worker() { + } + + virtual void Run() { + while (true) { + ClosureInterface* closure = ptThreadPool_->queue_.Pop(); + if (closure == NULL) { + break; + } + try { + closure->Run(); + } catch(std::exception& e) { + XLOG(ERROR) << e.what(); + } catch(...) { + XLOG(ERROR) << " unknown exception."; + } + delete closure; + } + } + private: + ThreadPool * ptThreadPool_; + }; // class Worker + + ThreadPool(size_t thread_num) + : threads_(thread_num), + queue_(thread_num) { + assert(thread_num); + for(size_t i = 0; i < threads_.size(); i ++) { + threads_[i] = new Worker(this); + } + } + ~ThreadPool() { + Stop(); + } + + void Start() { + for(size_t i = 0; i < threads_.size(); i++) { + threads_[i]->Start(); + } + } + void Stop() { + for(size_t i = 0; i < threads_.size(); i ++) { + queue_.Push(NULL); + } + for(size_t i = 0; i < threads_.size(); i ++) { + threads_[i]->Join(); + delete threads_[i]; + } + threads_.clear(); + } + + void Add(ClosureInterface* task) { + assert(task); + queue_.Push(task); + } + + private: + friend class Worker; + + vector threads_; + BoundedBlockingQueue queue_; +}; // class ThreadPool + +} // namespace limonp + +#endif // LIMONP_THREAD_POOL_HPP diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/CMakeLists.txt b/runtime/onnxruntime/third_party/kaldi-native-fbank/CMakeLists.txt new file mode 100644 index 0000000..e931a03 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/CMakeLists.txt @@ -0,0 +1,115 @@ +if("x${CMAKE_SOURCE_DIR}" STREQUAL "x${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "\ +In-source build is not a good practice. +Please use: + mkdir build + cd build + cmake .. +to build this project" + ) +endif() + +if(CMAKE_TOOLCHAIN_FILE) + set(_BUILD_PYTHON OFF) + set(_BUILD_TESTS OFF) +else() + set(_BUILD_PYTHON ON) + set(_BUILD_TESTS ON) +endif() + +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) +endif() + +cmake_minimum_required(VERSION 3.3 FATAL_ERROR) + +project(kaldi-native-fbank CXX C) + +set(KALDI_NATIVE_FBANK_VERSION "1.13") + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +set(CMAKE_SKIP_BUILD_RPATH FALSE) +set(BUILD_RPATH_USE_ORIGIN TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +if(NOT APPLE) + set(kaldi_native_fbank_rpath_origin "$ORIGIN") +else() + set(kaldi_native_fbank_rpath_origin "@loader_path") +endif() + +set(CMAKE_INSTALL_RPATH ${kaldi_native_fbank_rpath_origin}) +set(CMAKE_BUILD_RPATH ${kaldi_native_fbank_rpath_origin}) + +set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ version to be used.") + +if(NOT DEFINED BUILD_SHARED_LIBS) + set(BUILD_SHARED_LIBS ON) +endif() +message(STATUS "BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") + +option(KALDI_NATIVE_FBANK_BUILD_TESTS "Whether to build tests or not" ${_BUILD_TESTS}) +option(KALDI_NATIVE_FBANK_BUILD_PYTHON "Whether to build Python extension" ${_BUILD_PYTHON}) +option(KALDI_NATIVE_FBANK_ENABLE_CHECK "Whether to build with log" OFF) + +message(STATUS "KALDI_NATIVE_FBANK_BUILD_TESTS: ${KALDI_NATIVE_FBANK_BUILD_TESTS}") +message(STATUS "KALDI_NATIVE_FBANK_BUILD_PYTHON: ${KALDI_NATIVE_FBANK_BUILD_PYTHON}") +message(STATUS "KALDI_NATIVE_FBANK_ENABLE_CHECK: ${KALDI_NATIVE_FBANK_ENABLE_CHECK}") + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + +message(STATUS "KALDI_NATIVE_FBANK_ENABLE_CHECK: ${KALDI_NATIVE_FBANK_ENABLE_CHECK}") + +if(WIN32) + add_definitions(-DNOMINMAX) # Otherwise, std::max() and std::min() won't work +endif() + +if(KALDI_NATIVE_FBANK_BUILD_PYTHON) + include(pybind11) +endif() + +if(KALDI_NATIVE_FBANK_BUILD_TESTS) + enable_testing() + include(googletest) +endif() + +if(NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install") +endif() + +message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") + +include(CheckIncludeFileCXX) +check_include_file_cxx(cxxabi.h KNF_HAVE_CXXABI_H) +check_include_file_cxx(execinfo.h KNF_HAVE_EXECINFO_H) + +include_directories(${CMAKE_SOURCE_DIR}) + +if(WIN32 AND MSVC) + # disable various warnings for MSVC + # 4244: '=': conversion from 'double' to 'float', possible loss of data + # 4267: 'return': conversion from 'size_t' to 'int32_t', possible loss of data + # 4624: destructor was implicitly defined as deleted because a base class destructor is inaccessible or deleted + set(disabled_warnings + /wd4244 + /wd4267 + /wd4624 + ) + message(STATUS "Disabled warnings: ${disabled_warnings}") + foreach(w IN LISTS disabled_warnings) + string(APPEND CMAKE_CXX_FLAGS " ${w} ") + endforeach() +endif() + +add_subdirectory(kaldi-native-fbank) diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/FetchContent.cmake b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/FetchContent.cmake new file mode 100644 index 0000000..98cdf6c --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/FetchContent.cmake @@ -0,0 +1,916 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FetchContent +------------------ + +.. only:: html + + .. contents:: + +Overview +^^^^^^^^ + +This module enables populating content at configure time via any method +supported by the :module:`ExternalProject` module. Whereas +:command:`ExternalProject_Add` downloads at build time, the +``FetchContent`` module makes content available immediately, allowing the +configure step to use the content in commands like :command:`add_subdirectory`, +:command:`include` or :command:`file` operations. + +Content population details would normally be defined separately from the +command that performs the actual population. Projects should also +check whether the content has already been populated somewhere else in the +project hierarchy. Typical usage would look something like this: + +.. code-block:: cmake + + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.8.0 + ) + + FetchContent_GetProperties(googletest) + if(NOT googletest_POPULATED) + FetchContent_Populate(googletest) + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) + endif() + +When using the above pattern with a hierarchical project arrangement, +projects at higher levels in the hierarchy are able to define or override +the population details of content specified anywhere lower in the project +hierarchy. The ability to detect whether content has already been +populated ensures that even if multiple child projects want certain content +to be available, the first one to populate it wins. The other child project +can simply make use of the already available content instead of repeating +the population for itself. See the +:ref:`Examples ` section which demonstrates +this scenario. + +The ``FetchContent`` module also supports defining and populating +content in a single call, with no check for whether the content has been +populated elsewhere in the project already. This is a more low level +operation and would not normally be the way the module is used, but it is +sometimes useful as part of implementing some higher level feature or to +populate some content in CMake's script mode. + + +Declaring Content Details +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. command:: FetchContent_Declare + + .. code-block:: cmake + + FetchContent_Declare( ...) + + The ``FetchContent_Declare()`` function records the options that describe + how to populate the specified content, but if such details have already + been recorded earlier in this project (regardless of where in the project + hierarchy), this and all later calls for the same content ```` are + ignored. This "first to record, wins" approach is what allows hierarchical + projects to have parent projects override content details of child projects. + + The content ```` can be any string without spaces, but good practice + would be to use only letters, numbers and underscores. The name will be + treated case-insensitively and it should be obvious for the content it + represents, often being the name of the child project or the value given + to its top level :command:`project` command (if it is a CMake project). + For well-known public projects, the name should generally be the official + name of the project. Choosing an unusual name makes it unlikely that other + projects needing that same content will use the same name, leading to + the content being populated multiple times. + + The ```` can be any of the download or update/patch options + that the :command:`ExternalProject_Add` command understands. The configure, + build, install and test steps are explicitly disabled and therefore options + related to them will be ignored. In most cases, ```` will + just be a couple of options defining the download method and method-specific + details like a commit tag or archive hash. For example: + + .. code-block:: cmake + + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.8.0 + ) + + FetchContent_Declare( + myCompanyIcons + URL https://intranet.mycompany.com/assets/iconset_1.12.tar.gz + URL_HASH 5588a7b18261c20068beabfb4f530b87 + ) + + FetchContent_Declare( + myCompanyCertificates + SVN_REPOSITORY svn+ssh://svn.mycompany.com/srv/svn/trunk/certs + SVN_REVISION -r12345 + ) + +Populating The Content +^^^^^^^^^^^^^^^^^^^^^^ + +.. command:: FetchContent_Populate + + .. code-block:: cmake + + FetchContent_Populate( ) + + In most cases, the only argument given to ``FetchContent_Populate()`` is the + ````. When used this way, the command assumes the content details have + been recorded by an earlier call to :command:`FetchContent_Declare`. The + details are stored in a global property, so they are unaffected by things + like variable or directory scope. Therefore, it doesn't matter where in the + project the details were previously declared, as long as they have been + declared before the call to ``FetchContent_Populate()``. Those saved details + are then used to construct a call to :command:`ExternalProject_Add` in a + private sub-build to perform the content population immediately. The + implementation of ``ExternalProject_Add()`` ensures that if the content has + already been populated in a previous CMake run, that content will be reused + rather than repopulating them again. For the common case where population + involves downloading content, the cost of the download is only paid once. + + An internal global property records when a particular content population + request has been processed. If ``FetchContent_Populate()`` is called more + than once for the same content name within a configure run, the second call + will halt with an error. Projects can and should check whether content + population has already been processed with the + :command:`FetchContent_GetProperties` command before calling + ``FetchContent_Populate()``. + + ``FetchContent_Populate()`` will set three variables in the scope of the + caller; ``_POPULATED``, ``_SOURCE_DIR`` and + ``_BINARY_DIR``, where ```` is the lowercased ````. + ``_POPULATED`` will always be set to ``True`` by the call. + ``_SOURCE_DIR`` is the location where the + content can be found upon return (it will have already been populated), while + ``_BINARY_DIR`` is a directory intended for use as a corresponding + build directory. The main use case for the two directory variables is to + call :command:`add_subdirectory` immediately after population, i.e.: + + .. code-block:: cmake + + FetchContent_Populate(FooBar ...) + add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR}) + + The values of the three variables can also be retrieved from anywhere in the + project hierarchy using the :command:`FetchContent_GetProperties` command. + + A number of cache variables influence the behavior of all content population + performed using details saved from a :command:`FetchContent_Declare` call: + + ``FETCHCONTENT_BASE_DIR`` + In most cases, the saved details do not specify any options relating to the + directories to use for the internal sub-build, final source and build areas. + It is generally best to leave these decisions up to the ``FetchContent`` + module to handle on the project's behalf. The ``FETCHCONTENT_BASE_DIR`` + cache variable controls the point under which all content population + directories are collected, but in most cases developers would not need to + change this. The default location is ``${CMAKE_BINARY_DIR}/_deps``, but if + developers change this value, they should aim to keep the path short and + just below the top level of the build tree to avoid running into path + length problems on Windows. + + ``FETCHCONTENT_QUIET`` + The logging output during population can be quite verbose, making the + configure stage quite noisy. This cache option (``ON`` by default) hides + all population output unless an error is encountered. If experiencing + problems with hung downloads, temporarily switching this option off may + help diagnose which content population is causing the issue. + + ``FETCHCONTENT_FULLY_DISCONNECTED`` + When this option is enabled, no attempt is made to download or update + any content. It is assumed that all content has already been populated in + a previous run or the source directories have been pointed at existing + contents the developer has provided manually (using options described + further below). When the developer knows that no changes have been made to + any content details, turning this option ``ON`` can significantly speed up + the configure stage. It is ``OFF`` by default. + + ``FETCHCONTENT_UPDATES_DISCONNECTED`` + This is a less severe download/update control compared to + ``FETCHCONTENT_FULLY_DISCONNECTED``. Instead of bypassing all download and + update logic, the ``FETCHCONTENT_UPDATES_DISCONNECTED`` only disables the + update stage. Therefore, if content has not been downloaded previously, + it will still be downloaded when this option is enabled. This can speed up + the configure stage, but not as much as + ``FETCHCONTENT_FULLY_DISCONNECTED``. It is ``OFF`` by default. + + In addition to the above cache variables, the following cache variables are + also defined for each content name (```` is the uppercased value of + ````): + + ``FETCHCONTENT_SOURCE_DIR_`` + If this is set, no download or update steps are performed for the specified + content and the ``_SOURCE_DIR`` variable returned to the caller is + pointed at this location. This gives developers a way to have a separate + checkout of the content that they can modify freely without interference + from the build. The build simply uses that existing source, but it still + defines ``_BINARY_DIR`` to point inside its own build area. + Developers are strongly encouraged to use this mechanism rather than + editing the sources populated in the default location, as changes to + sources in the default location can be lost when content population details + are changed by the project. + + ``FETCHCONTENT_UPDATES_DISCONNECTED_`` + This is the per-content equivalent of + ``FETCHCONTENT_UPDATES_DISCONNECTED``. If the global option or this option + is ``ON``, then updates will be disabled for the named content. + Disabling updates for individual content can be useful for content whose + details rarely change, while still leaving other frequently changing + content with updates enabled. + + + The ``FetchContent_Populate()`` command also supports a syntax allowing the + content details to be specified directly rather than using any saved + details. This is more low-level and use of this form is generally to be + avoided in favour of using saved content details as outlined above. + Nevertheless, in certain situations it can be useful to invoke the content + population as an isolated operation (typically as part of implementing some + other higher level feature or when using CMake in script mode): + + .. code-block:: cmake + + FetchContent_Populate( + [QUIET] + [SUBBUILD_DIR ] + [SOURCE_DIR ] + [BINARY_DIR ] + ... + ) + + This form has a number of key differences to that where only ```` is + provided: + + - All required population details are assumed to have been provided directly + in the call to ``FetchContent_Populate()``. Any saved details for + ```` are ignored. + - No check is made for whether content for ```` has already been + populated. + - No global property is set to record that the population has occurred. + - No global properties record the source or binary directories used for the + populated content. + - The ``FETCHCONTENT_FULLY_DISCONNECTED`` and + ``FETCHCONTENT_UPDATES_DISCONNECTED`` cache variables are ignored. + + The ``_SOURCE_DIR`` and ``_BINARY_DIR`` variables are still + returned to the caller, but since these locations are not stored as global + properties when this form is used, they are only available to the calling + scope and below rather than the entire project hierarchy. No + ``_POPULATED`` variable is set in the caller's scope with this form. + + The supported options for ``FetchContent_Populate()`` are the same as those + for :command:`FetchContent_Declare()`. Those few options shown just + above are either specific to ``FetchContent_Populate()`` or their behavior is + slightly modified from how :command:`ExternalProject_Add` treats them. + + ``QUIET`` + The ``QUIET`` option can be given to hide the output associated with + populating the specified content. If the population fails, the output will + be shown regardless of whether this option was given or not so that the + cause of the failure can be diagnosed. The global ``FETCHCONTENT_QUIET`` + cache variable has no effect on ``FetchContent_Populate()`` calls where the + content details are provided directly. + + ``SUBBUILD_DIR`` + The ``SUBBUILD_DIR`` argument can be provided to change the location of the + sub-build created to perform the population. The default value is + ``${CMAKE_CURRENT_BINARY_DIR}/-subbuild`` and it would be unusual + to need to override this default. If a relative path is specified, it will + be interpreted as relative to :variable:`CMAKE_CURRENT_BINARY_DIR`. + + ``SOURCE_DIR``, ``BINARY_DIR`` + The ``SOURCE_DIR`` and ``BINARY_DIR`` arguments are supported by + :command:`ExternalProject_Add`, but different default values are used by + ``FetchContent_Populate()``. ``SOURCE_DIR`` defaults to + ``${CMAKE_CURRENT_BINARY_DIR}/-src`` and ``BINARY_DIR`` defaults to + ``${CMAKE_CURRENT_BINARY_DIR}/-build``. If a relative path is + specified, it will be interpreted as relative to + :variable:`CMAKE_CURRENT_BINARY_DIR`. + + In addition to the above explicit options, any other unrecognized options are + passed through unmodified to :command:`ExternalProject_Add` to perform the + download, patch and update steps. The following options are explicitly + prohibited (they are disabled by the ``FetchContent_Populate()`` command): + + - ``CONFIGURE_COMMAND`` + - ``BUILD_COMMAND`` + - ``INSTALL_COMMAND`` + - ``TEST_COMMAND`` + + If using ``FetchContent_Populate()`` within CMake's script mode, be aware + that the implementation sets up a sub-build which therefore requires a CMake + generator and build tool to be available. If these cannot be found by + default, then the :variable:`CMAKE_GENERATOR` and/or + :variable:`CMAKE_MAKE_PROGRAM` variables will need to be set appropriately + on the command line invoking the script. + + +Retrieve Population Properties +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. command:: FetchContent_GetProperties + + When using saved content details, a call to :command:`FetchContent_Populate` + records information in global properties which can be queried at any time. + This information includes the source and binary directories associated with + the content and also whether or not the content population has been processed + during the current configure run. + + .. code-block:: cmake + + FetchContent_GetProperties( + [SOURCE_DIR ] + [BINARY_DIR ] + [POPULATED ] + ) + + The ``SOURCE_DIR``, ``BINARY_DIR`` and ``POPULATED`` options can be used to + specify which properties should be retrieved. Each option accepts a value + which is the name of the variable in which to store that property. Most of + the time though, only ```` is given, in which case the call will then + set the same variables as a call to + :command:`FetchContent_Populate(name) `. This allows + the following canonical pattern to be used, which ensures that the relevant + variables will always be defined regardless of whether or not the population + has been performed elsewhere in the project already: + + .. code-block:: cmake + + FetchContent_GetProperties(foobar) + if(NOT foobar_POPULATED) + FetchContent_Populate(foobar) + + # Set any custom variables, etc. here, then + # populate the content as part of this build + + add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR}) + endif() + + The above pattern allows other parts of the overall project hierarchy to + re-use the same content and ensure that it is only populated once. + + +.. _`fetch-content-examples`: + +Examples +^^^^^^^^ + +Consider a project hierarchy where ``projA`` is the top level project and it +depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC`` +can be built standalone and they also both depend on another project +``projD``. For simplicity, this example will assume that all four projects +are available on a company git server. The ``CMakeLists.txt`` of each project +might have sections like the following: + +*projA*: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + projB + GIT_REPOSITORY git@mycompany.com/git/projB.git + GIT_TAG 4a89dc7e24ff212a7b5167bef7ab079d + ) + FetchContent_Declare( + projC + GIT_REPOSITORY git@mycompany.com/git/projC.git + GIT_TAG 4ad4016bd1d8d5412d135cf8ceea1bb9 + ) + FetchContent_Declare( + projD + GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_TAG origin/integrationBranch + ) + + FetchContent_GetProperties(projB) + if(NOT projb_POPULATED) + FetchContent_Populate(projB) + add_subdirectory(${projb_SOURCE_DIR} ${projb_BINARY_DIR}) + endif() + + FetchContent_GetProperties(projC) + if(NOT projc_POPULATED) + FetchContent_Populate(projC) + add_subdirectory(${projc_SOURCE_DIR} ${projc_BINARY_DIR}) + endif() + +*projB*: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + projD + GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_TAG 20b415f9034bbd2a2e8216e9a5c9e632 + ) + + FetchContent_GetProperties(projD) + if(NOT projd_POPULATED) + FetchContent_Populate(projD) + add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) + endif() + + +*projC*: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + projD + GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_TAG 7d9a17ad2c962aa13e2fbb8043fb6b8a + ) + + FetchContent_GetProperties(projD) + if(NOT projd_POPULATED) + FetchContent_Populate(projD) + add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) + endif() + +A few key points should be noted in the above: + +- ``projB`` and ``projC`` define different content details for ``projD``, + but ``projA`` also defines a set of content details for ``projD`` and + because ``projA`` will define them first, the details from ``projB`` and + ``projC`` will not be used. The override details defined by ``projA`` + are not required to match either of those from ``projB`` or ``projC``, but + it is up to the higher level project to ensure that the details it does + define still make sense for the child projects. +- While ``projA`` defined content details for ``projD``, it did not need + to explicitly call ``FetchContent_Populate(projD)`` itself. Instead, it + leaves that to a child project to do (in this case it will be ``projB`` + since it is added to the build ahead of ``projC``). If ``projA`` needed to + customize how the ``projD`` content was brought into the build as well + (e.g. define some CMake variables before calling + :command:`add_subdirectory` after populating), it would do the call to + ``FetchContent_Populate()``, etc. just as it did for the ``projB`` and + ``projC`` content. For higher level projects, it is usually enough to + just define the override content details and leave the actual population + to the child projects. This saves repeating the same thing at each level + of the project hierarchy unnecessarily. +- Even though ``projA`` is the top level project in this example, it still + checks whether ``projB`` and ``projC`` have already been populated before + going ahead to do those populations. This makes ``projA`` able to be more + easily incorporated as a child of some other higher level project in the + future if required. Always protect a call to + :command:`FetchContent_Populate` with a check to + :command:`FetchContent_GetProperties`, even in what may be considered a top + level project at the time. + + +The following example demonstrates how one might download and unpack a +firmware tarball using CMake's :manual:`script mode `. The call to +:command:`FetchContent_Populate` specifies all the content details and the +unpacked firmware will be placed in a ``firmware`` directory below the +current working directory. + +*getFirmware.cmake*: + +.. code-block:: cmake + + # NOTE: Intended to be run in script mode with cmake -P + include(FetchContent) + FetchContent_Populate( + firmware + URL https://mycompany.com/assets/firmware-1.23-arm.tar.gz + URL_HASH MD5=68247684da89b608d466253762b0ff11 + SOURCE_DIR firmware + ) + +#]=======================================================================] + + +set(__FetchContent_privateDir "${CMAKE_CURRENT_LIST_DIR}/FetchContent") + +#======================================================================= +# Recording and retrieving content details for later population +#======================================================================= + +# Internal use, projects must not call this directly. It is +# intended for use by FetchContent_Declare() only. +# +# Sets a content-specific global property (not meant for use +# outside of functions defined here in this file) which can later +# be retrieved using __FetchContent_getSavedDetails() with just the +# same content name. If there is already a value stored in the +# property, it is left unchanged and this call has no effect. +# This allows parent projects to define the content details, +# overriding anything a child project may try to set (properties +# are not cached between runs, so the first thing to set it in a +# build will be in control). +function(__FetchContent_declareDetails contentName) + + string(TOLOWER ${contentName} contentNameLower) + set(propertyName "_FetchContent_${contentNameLower}_savedDetails") + get_property(alreadyDefined GLOBAL PROPERTY ${propertyName} DEFINED) + if(NOT alreadyDefined) + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} ${ARGN}) + endif() + +endfunction() + + +# Internal use, projects must not call this directly. It is +# intended for use by the FetchContent_Declare() function. +# +# Retrieves details saved for the specified content in an +# earlier call to __FetchContent_declareDetails(). +function(__FetchContent_getSavedDetails contentName outVar) + + string(TOLOWER ${contentName} contentNameLower) + set(propertyName "_FetchContent_${contentNameLower}_savedDetails") + get_property(alreadyDefined GLOBAL PROPERTY ${propertyName} DEFINED) + if(NOT alreadyDefined) + message(FATAL_ERROR "No content details recorded for ${contentName}") + endif() + get_property(propertyValue GLOBAL PROPERTY ${propertyName}) + set(${outVar} "${propertyValue}" PARENT_SCOPE) + +endfunction() + + +# Saves population details of the content, sets defaults for the +# SOURCE_DIR and BUILD_DIR. +function(FetchContent_Declare contentName) + + set(options "") + set(oneValueArgs SVN_REPOSITORY) + set(multiValueArgs "") + + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + unset(srcDirSuffix) + unset(svnRepoArgs) + if(ARG_SVN_REPOSITORY) + # Add a hash of the svn repository URL to the source dir. This works + # around the problem where if the URL changes, the download would + # fail because it tries to checkout/update rather than switch the + # old URL to the new one. We limit the hash to the first 7 characters + # so that the source path doesn't get overly long (which can be a + # problem on windows due to path length limits). + string(SHA1 urlSHA ${ARG_SVN_REPOSITORY}) + string(SUBSTRING ${urlSHA} 0 7 urlSHA) + set(srcDirSuffix "-${urlSHA}") + set(svnRepoArgs SVN_REPOSITORY ${ARG_SVN_REPOSITORY}) + endif() + + string(TOLOWER ${contentName} contentNameLower) + __FetchContent_declareDetails( + ${contentNameLower} + SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src${srcDirSuffix}" + BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build" + ${svnRepoArgs} + # List these last so they can override things we set above + ${ARG_UNPARSED_ARGUMENTS} + ) + +endfunction() + + +#======================================================================= +# Set/get whether the specified content has been populated yet. +# The setter also records the source and binary dirs used. +#======================================================================= + +# Internal use, projects must not call this directly. It is +# intended for use by the FetchContent_Populate() function to +# record when FetchContent_Populate() is called for a particular +# content name. +function(__FetchContent_setPopulated contentName sourceDir binaryDir) + + string(TOLOWER ${contentName} contentNameLower) + set(prefix "_FetchContent_${contentNameLower}") + + set(propertyName "${prefix}_sourceDir") + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} ${sourceDir}) + + set(propertyName "${prefix}_binaryDir") + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} ${binaryDir}) + + set(propertyName "${prefix}_populated") + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} True) + +endfunction() + + +# Set variables in the calling scope for any of the retrievable +# properties. If no specific properties are requested, variables +# will be set for all retrievable properties. +# +# This function is intended to also be used by projects as the canonical +# way to detect whether they should call FetchContent_Populate() +# and pull the populated source into the build with add_subdirectory(), +# if they are using the populated content in that way. +function(FetchContent_GetProperties contentName) + + string(TOLOWER ${contentName} contentNameLower) + + set(options "") + set(oneValueArgs SOURCE_DIR BINARY_DIR POPULATED) + set(multiValueArgs "") + + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ARG_SOURCE_DIR AND + NOT ARG_BINARY_DIR AND + NOT ARG_POPULATED) + # No specific properties requested, provide them all + set(ARG_SOURCE_DIR ${contentNameLower}_SOURCE_DIR) + set(ARG_BINARY_DIR ${contentNameLower}_BINARY_DIR) + set(ARG_POPULATED ${contentNameLower}_POPULATED) + endif() + + set(prefix "_FetchContent_${contentNameLower}") + + if(ARG_SOURCE_DIR) + set(propertyName "${prefix}_sourceDir") + get_property(value GLOBAL PROPERTY ${propertyName}) + if(value) + set(${ARG_SOURCE_DIR} ${value} PARENT_SCOPE) + endif() + endif() + + if(ARG_BINARY_DIR) + set(propertyName "${prefix}_binaryDir") + get_property(value GLOBAL PROPERTY ${propertyName}) + if(value) + set(${ARG_BINARY_DIR} ${value} PARENT_SCOPE) + endif() + endif() + + if(ARG_POPULATED) + set(propertyName "${prefix}_populated") + get_property(value GLOBAL PROPERTY ${propertyName} DEFINED) + set(${ARG_POPULATED} ${value} PARENT_SCOPE) + endif() + +endfunction() + + +#======================================================================= +# Performing the population +#======================================================================= + +# The value of contentName will always have been lowercased by the caller. +# All other arguments are assumed to be options that are understood by +# ExternalProject_Add(), except for QUIET and SUBBUILD_DIR. +function(__FetchContent_directPopulate contentName) + + set(options + QUIET + ) + set(oneValueArgs + SUBBUILD_DIR + SOURCE_DIR + BINARY_DIR + # Prevent the following from being passed through + CONFIGURE_COMMAND + BUILD_COMMAND + INSTALL_COMMAND + TEST_COMMAND + ) + set(multiValueArgs "") + + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ARG_SUBBUILD_DIR) + message(FATAL_ERROR "Internal error: SUBBUILD_DIR not set") + elseif(NOT IS_ABSOLUTE "${ARG_SUBBUILD_DIR}") + set(ARG_SUBBUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_SUBBUILD_DIR}") + endif() + + if(NOT ARG_SOURCE_DIR) + message(FATAL_ERROR "Internal error: SOURCE_DIR not set") + elseif(NOT IS_ABSOLUTE "${ARG_SOURCE_DIR}") + set(ARG_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_SOURCE_DIR}") + endif() + + if(NOT ARG_BINARY_DIR) + message(FATAL_ERROR "Internal error: BINARY_DIR not set") + elseif(NOT IS_ABSOLUTE "${ARG_BINARY_DIR}") + set(ARG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_BINARY_DIR}") + endif() + + # Ensure the caller can know where to find the source and build directories + # with some convenient variables. Doing this here ensures the caller sees + # the correct result in the case where the default values are overridden by + # the content details set by the project. + set(${contentName}_SOURCE_DIR "${ARG_SOURCE_DIR}" PARENT_SCOPE) + set(${contentName}_BINARY_DIR "${ARG_BINARY_DIR}" PARENT_SCOPE) + + # The unparsed arguments may contain spaces, so build up ARG_EXTRA + # in such a way that it correctly substitutes into the generated + # CMakeLists.txt file with each argument quoted. + unset(ARG_EXTRA) + foreach(arg IN LISTS ARG_UNPARSED_ARGUMENTS) + set(ARG_EXTRA "${ARG_EXTRA} \"${arg}\"") + endforeach() + + # Hide output if requested, but save it to a variable in case there's an + # error so we can show the output upon failure. When not quiet, don't + # capture the output to a variable because the user may want to see the + # output as it happens (e.g. progress during long downloads). Combine both + # stdout and stderr in the one capture variable so the output stays in order. + if (ARG_QUIET) + set(outputOptions + OUTPUT_VARIABLE capturedOutput + ERROR_VARIABLE capturedOutput + ) + else() + set(capturedOutput) + set(outputOptions) + message(STATUS "Populating ${contentName}") + endif() + + if(CMAKE_GENERATOR) + set(generatorOpts "-G${CMAKE_GENERATOR}") + if(CMAKE_GENERATOR_PLATFORM) + list(APPEND generatorOpts "-A${CMAKE_GENERATOR_PLATFORM}") + endif() + if(CMAKE_GENERATOR_TOOLSET) + list(APPEND generatorOpts "-T${CMAKE_GENERATOR_TOOLSET}") + endif() + + if(CMAKE_MAKE_PROGRAM) + list(APPEND generatorOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") + endif() + + else() + # Likely we've been invoked via CMake's script mode where no + # generator is set (and hence CMAKE_MAKE_PROGRAM could not be + # trusted even if provided). We will have to rely on being + # able to find the default generator and build tool. + unset(generatorOpts) + endif() + + # Create and build a separate CMake project to carry out the population. + # If we've already previously done these steps, they will not cause + # anything to be updated, so extra rebuilds of the project won't occur. + # Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project + # has this set to something not findable on the PATH. + configure_file("${__FetchContent_privateDir}/CMakeLists.cmake.in" + "${ARG_SUBBUILD_DIR}/CMakeLists.txt") + execute_process( + COMMAND ${CMAKE_COMMAND} ${generatorOpts} . + RESULT_VARIABLE result + ${outputOptions} + WORKING_DIRECTORY "${ARG_SUBBUILD_DIR}" + ) + if(result) + if(capturedOutput) + message("${capturedOutput}") + endif() + message(FATAL_ERROR "CMake step for ${contentName} failed: ${result}") + endif() + execute_process( + COMMAND ${CMAKE_COMMAND} --build . + RESULT_VARIABLE result + ${outputOptions} + WORKING_DIRECTORY "${ARG_SUBBUILD_DIR}" + ) + if(result) + if(capturedOutput) + message("${capturedOutput}") + endif() + message(FATAL_ERROR "Build step for ${contentName} failed: ${result}") + endif() + +endfunction() + + +option(FETCHCONTENT_FULLY_DISCONNECTED "Disables all attempts to download or update content and assumes source dirs already exist") +option(FETCHCONTENT_UPDATES_DISCONNECTED "Enables UPDATE_DISCONNECTED behavior for all content population") +option(FETCHCONTENT_QUIET "Enables QUIET option for all content population" ON) +set(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/_deps" CACHE PATH "Directory under which to collect all populated content") + +# Populate the specified content using details stored from +# an earlier call to FetchContent_Declare(). +function(FetchContent_Populate contentName) + + if(NOT contentName) + message(FATAL_ERROR "Empty contentName not allowed for FetchContent_Populate()") + endif() + + string(TOLOWER ${contentName} contentNameLower) + + if(ARGN) + # This is the direct population form with details fully specified + # as part of the call, so we already have everything we need + __FetchContent_directPopulate( + ${contentNameLower} + SUBBUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-subbuild" + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-build" + ${ARGN} # Could override any of the above ..._DIR variables + ) + + # Pass source and binary dir variables back to the caller + set(${contentNameLower}_SOURCE_DIR "${${contentNameLower}_SOURCE_DIR}" PARENT_SCOPE) + set(${contentNameLower}_BINARY_DIR "${${contentNameLower}_BINARY_DIR}" PARENT_SCOPE) + + # Don't set global properties, or record that we did this population, since + # this was a direct call outside of the normal declared details form. + # We only want to save values in the global properties for content that + # honours the hierarchical details mechanism so that projects are not + # robbed of the ability to override details set in nested projects. + return() + endif() + + # No details provided, so assume they were saved from an earlier call + # to FetchContent_Declare(). Do a check that we haven't already + # populated this content before in case the caller forgot to check. + FetchContent_GetProperties(${contentName}) + if(${contentNameLower}_POPULATED) + message(FATAL_ERROR "Content ${contentName} already populated in ${${contentNameLower}_SOURCE_DIR}") + endif() + + string(TOUPPER ${contentName} contentNameUpper) + set(FETCHCONTENT_SOURCE_DIR_${contentNameUpper} + "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}" + CACHE PATH "When not empty, overrides where to find pre-populated content for ${contentName}") + + if(FETCHCONTENT_SOURCE_DIR_${contentNameUpper}) + # The source directory has been explicitly provided in the cache, + # so no population is required + set(${contentNameLower}_SOURCE_DIR "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + set(${contentNameLower}_BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build") + + elseif(FETCHCONTENT_FULLY_DISCONNECTED) + # Bypass population and assume source is already there from a previous run + set(${contentNameLower}_SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src") + set(${contentNameLower}_BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build") + + else() + # Support both a global "disconnect all updates" and a per-content + # update test (either one being set disables updates for this content). + option(FETCHCONTENT_UPDATES_DISCONNECTED_${contentNameUpper} + "Enables UPDATE_DISCONNECTED behavior just for population of ${contentName}") + if(FETCHCONTENT_UPDATES_DISCONNECTED OR + FETCHCONTENT_UPDATES_DISCONNECTED_${contentNameUpper}) + set(disconnectUpdates True) + else() + set(disconnectUpdates False) + endif() + + if(FETCHCONTENT_QUIET) + set(quietFlag QUIET) + else() + unset(quietFlag) + endif() + + __FetchContent_getSavedDetails(${contentName} contentDetails) + if("${contentDetails}" STREQUAL "") + message(FATAL_ERROR "No details have been set for content: ${contentName}") + endif() + + __FetchContent_directPopulate( + ${contentNameLower} + ${quietFlag} + UPDATE_DISCONNECTED ${disconnectUpdates} + SUBBUILD_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-subbuild" + SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src" + BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build" + # Put the saved details last so they can override any of the + # the options we set above (this can include SOURCE_DIR or + # BUILD_DIR) + ${contentDetails} + ) + endif() + + __FetchContent_setPopulated( + ${contentName} + ${${contentNameLower}_SOURCE_DIR} + ${${contentNameLower}_BINARY_DIR} + ) + + # Pass variables back to the caller. The variables passed back here + # must match what FetchContent_GetProperties() sets when it is called + # with just the content name. + set(${contentNameLower}_SOURCE_DIR "${${contentNameLower}_SOURCE_DIR}" PARENT_SCOPE) + set(${contentNameLower}_BINARY_DIR "${${contentNameLower}_BINARY_DIR}" PARENT_SCOPE) + set(${contentNameLower}_POPULATED True PARENT_SCOPE) + +endfunction() diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/FetchContent/CMakeLists.cmake.in b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/FetchContent/CMakeLists.cmake.in new file mode 100644 index 0000000..9a7a771 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/FetchContent/CMakeLists.cmake.in @@ -0,0 +1,21 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION ${CMAKE_VERSION}) + +# We name the project and the target for the ExternalProject_Add() call +# to something that will highlight to the user what we are working on if +# something goes wrong and an error message is produced. + +project(${contentName}-populate NONE) + +include(ExternalProject) +ExternalProject_Add(${contentName}-populate + ${ARG_EXTRA} + SOURCE_DIR "${ARG_SOURCE_DIR}" + BINARY_DIR "${ARG_BINARY_DIR}" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/README.md b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/README.md new file mode 100644 index 0000000..c8d275f --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/Modules/README.md @@ -0,0 +1,5 @@ + +## FetchContent + +`FetchContent.cmake` and `FetchContent/CMakeLists.cmake.in` +are copied from `cmake/3.11.0/share/cmake-3.11/Modules`. diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/cmake_extension.py b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/cmake_extension.py new file mode 100644 index 0000000..25e5209 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/cmake_extension.py @@ -0,0 +1,115 @@ +# Copyright (c) 2021 Xiaomi Corporation (author: Fangjun Kuang) + +import glob +import os +import platform +import shutil +import sys +from pathlib import Path + +import setuptools +from setuptools.command.build_ext import build_ext + + +def is_for_pypi(): + ans = os.environ.get("KALDI_NATIVE_FBANK_IS_FOR_PYPI", None) + return ans is not None + + +def is_macos(): + return platform.system() == "Darwin" + + +def is_windows(): + return platform.system() == "Windows" + + +try: + from wheel.bdist_wheel import bdist_wheel as _bdist_wheel + + class bdist_wheel(_bdist_wheel): + def finalize_options(self): + _bdist_wheel.finalize_options(self) + # In this case, the generated wheel has a name in the form + # kaldifeat-xxx-pyxx-none-any.whl + if is_for_pypi() and not is_macos(): + self.root_is_pure = True + else: + # The generated wheel has a name ending with + # -linux_x86_64.whl + self.root_is_pure = False + +except ImportError: + bdist_wheel = None + + +def cmake_extension(name, *args, **kwargs) -> setuptools.Extension: + kwargs["language"] = "c++" + sources = [] + return setuptools.Extension(name, sources, *args, **kwargs) + + +class BuildExtension(build_ext): + def build_extension(self, ext: setuptools.extension.Extension): + # build/temp.linux-x86_64-3.8 + os.makedirs(self.build_temp, exist_ok=True) + + # build/lib.linux-x86_64-3.8 + os.makedirs(self.build_lib, exist_ok=True) + + install_dir = Path(self.build_lib).resolve() / "kaldi_native_fbank" + + kaldi_native_fbank_dir = Path(__file__).parent.parent.resolve() + + cmake_args = os.environ.get("KALDI_NATIVE_FBANK_CMAKE_ARGS", "") + make_args = os.environ.get("KALDI_NATIVE_FBANK_MAKE_ARGS", "") + system_make_args = os.environ.get("MAKEFLAGS", "") + + if cmake_args == "": + cmake_args = "-DCMAKE_BUILD_TYPE=Release" + + extra_cmake_args = f" -DCMAKE_INSTALL_PREFIX={install_dir} " + extra_cmake_args += " -DKALDI_NATIVE_FBANK_BUILD_TESTS=OFF " + + if "PYTHON_EXECUTABLE" not in cmake_args: + print(f"Setting PYTHON_EXECUTABLE to {sys.executable}") + cmake_args += f" -DPYTHON_EXECUTABLE={sys.executable}" + + cmake_args += extra_cmake_args + + if is_windows(): + build_cmd = f""" + cmake {cmake_args} -B {self.build_temp} -S {kaldi_native_fbank_dir} + cmake --build {self.build_temp} --target install --config Release -- -m + """ + print(f"build command is:\n{build_cmd}") + ret = os.system(f"cmake {cmake_args} -B {self.build_temp} -S {kaldi_native_fbank_dir}") + if ret != 0: + raise Exception("Failed to configure kaldi_native_fbank") + + ret = os.system( + f"cmake --build {self.build_temp} --target install --config Release -- -m" + ) + if ret != 0: + raise Exception("Failed to install kaldi_native_fbank") + else: + if make_args == "" and system_make_args == "": + print("For fast compilation, run:") + print('export KALDI_NATIVE_FBANK_MAKE_ARGS="-j"; python setup.py install') + + build_cmd = f""" + cd {self.build_temp} + + cmake {cmake_args} {kaldi_native_fbank_dir} + + make {make_args} install + """ + print(f"build command is:\n{build_cmd}") + + ret = os.system(build_cmd) + if ret != 0: + raise Exception( + "\nBuild kaldi-native-fbank failed. Please check the error message.\n" + "You can ask for help by creating an issue on GitHub.\n" + "\nClick:\n\thttps://github.com/csukuangfj/kaldi-native-fbank/issues/new\n" # noqa + ) diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/googletest.cmake b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/googletest.cmake new file mode 100644 index 0000000..a732dc7 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/googletest.cmake @@ -0,0 +1,57 @@ +function(download_googltest) + if(CMAKE_VERSION VERSION_LESS 3.11) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + endif() + + include(FetchContent) + + set(googletest_URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz") + set(googletest_HASH "SHA256=9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb") + + set(BUILD_GMOCK ON CACHE BOOL "" FORCE) + set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) + set(gtest_disable_pthreads ON CACHE BOOL "" FORCE) + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + + FetchContent_Declare(googletest + URL ${googletest_URL} + URL_HASH ${googletest_HASH} + ) + + FetchContent_GetProperties(googletest) + if(NOT googletest_POPULATED) + message(STATUS "Downloading googletest from ${googletest_URL}") + FetchContent_Populate(googletest) + endif() + message(STATUS "googletest is downloaded to ${googletest_SOURCE_DIR}") + message(STATUS "googletest's binary dir is ${googletest_BINARY_DIR}") + + if(APPLE) + set(CMAKE_MACOSX_RPATH ON) # to solve the following warning on macOS + endif() + #[==[ + -- Generating done + Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake + --help-policy CMP0042" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + MACOSX_RPATH is not specified for the following targets: + + gmock + gmock_main + gtest + gtest_main + + This warning is for project developers. Use -Wno-dev to suppress it. + ]==] + + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL) + + target_include_directories(gtest + INTERFACE + ${googletest_SOURCE_DIR}/googletest/include + ${googletest_SOURCE_DIR}/googlemock/include + ) +endfunction() + +download_googltest() diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/pybind11.cmake b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/pybind11.cmake new file mode 100644 index 0000000..464f399 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/cmake/pybind11.cmake @@ -0,0 +1,35 @@ +function(download_pybind11) + if(CMAKE_VERSION VERSION_LESS 3.11) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + endif() + + include(FetchContent) + + set(pybind11_URL "https://github.com/pybind/pybind11/archive/refs/tags/v2.9.2.tar.gz") + set(pybind11_HASH "SHA256=6bd528c4dbe2276635dc787b6b1f2e5316cf6b49ee3e150264e455a0d68d19c1") + + # If you don't have access to the Internet, please download it to your + # local drive and modify the following line according to your needs. + if(EXISTS "/star-fj/fangjun/download/github/pybind11-2.9.2.tar.gz") + set(pybind11_URL "file:///star-fj/fangjun/download/github/pybind11-2.9.2.tar.gz") + elseif(EXISTS "/Users/fangjun/Downloads/pybind11-2.9.2.tar.gz") + set(pybind11_URL "file:///Users/fangjun/Downloads/pybind11-2.9.2.tar.gz") + elseif(EXISTS "/tmp/pybind11-2.9.2.tar.gz") + set(pybind11_URL "file:///tmp/pybind11-2.9.2.tar.gz") + endif() + + FetchContent_Declare(pybind11 + URL ${pybind11_URL} + URL_HASH ${pybind11_HASH} + ) + + FetchContent_GetProperties(pybind11) + if(NOT pybind11_POPULATED) + message(STATUS "Downloading pybind11 from ${pybind11_URL}") + FetchContent_Populate(pybind11) + endif() + message(STATUS "pybind11 is downloaded to ${pybind11_SOURCE_DIR}") + add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR} EXCLUDE_FROM_ALL) +endfunction() + +download_pybind11() diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/CMakeLists.txt b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/CMakeLists.txt new file mode 100644 index 0000000..2037626 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(csrc) + +if(KALDI_NATIVE_FBANK_BUILD_PYTHON) + message(STATUS "Building Python") + add_subdirectory(python) +else() + message(STATUS "Disable building Python") +endif() diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/CMakeLists.txt b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/CMakeLists.txt new file mode 100644 index 0000000..bd61361 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(csrc STATIC + feature-fbank.cc + feature-functions.cc + feature-window.cc + fftsg.c + mel-computations.cc + online-feature.cc + rfft.cc) \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/CMakeLists.txt.bak b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/CMakeLists.txt.bak new file mode 100644 index 0000000..6eb693d --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/CMakeLists.txt.bak @@ -0,0 +1,93 @@ + +include_directories(${PROJECT_SOURCE_DIR}) +set(sources + feature-fbank.cc + feature-functions.cc + feature-window.cc + fftsg.c + mel-computations.cc + online-feature.cc + rfft.cc +) + +if(KALDI_NATIVE_FBANK_ENABLE_CHECK) + list(APPEND sources log.cc) +endif() + +add_library(kaldi-native-fbank-core ${sources}) +if(KALDI_NATIVE_FBANK_ENABLE_CHECK) + target_compile_definitions(kaldi-native-fbank-core PUBLIC KNF_ENABLE_CHECK=1) + + if(KNF_HAVE_EXECINFO_H) + target_compile_definitions(kaldi-native-fbank-core PRIVATE KNF_HAVE_EXECINFO_H=1) + endif() + + if(KNF_HAVE_CXXABI_H) + target_compile_definitions(kaldi-native-fbank-core PRIVATE KNF_HAVE_CXXABI_H=1) + endif() +endif() + +# We are using std::call_once() in log.h,which requires us to link with -pthread +if(NOT WIN32 AND KALDI_NATIVE_FBANK_ENABLE_CHECK) + target_link_libraries(kaldi-native-fbank-core -pthread) +endif() + +if(KALDI_NATIVE_FBANK_BUILD_TESTS) + add_executable(test-online-fbank test-online-fbank.cc) + target_link_libraries(test-online-fbank kaldi-native-fbank-core) +endif() + +function(kaldi_native_fbank_add_test source) + get_filename_component(name ${source} NAME_WE) + add_executable(${name} "${source}") + target_link_libraries(${name} + PRIVATE + kaldi-native-fbank-core + gtest + gtest_main + ) + + add_test(NAME "Test.${name}" + COMMAND + $ + ) +endfunction() + +# please sort the source files alphabetically +set(test_srcs + # test-online-feature.cc + test-log.cc + test-rfft.cc +) + +if(KALDI_NATIVE_FBANK_BUILD_TESTS) + foreach(source IN LISTS test_srcs) + kaldi_native_fbank_add_test(${source}) + endforeach() +endif() + +install(TARGETS kaldi-native-fbank-core + DESTINATION lib +) + +if(KALDI_NATIVE_FBANK_BUILD_TESTS) + install(TARGETS test-online-fbank + DESTINATION bin + ) +endif() + +file(MAKE_DIRECTORY + DESTINATION + ${PROJECT_BINARY_DIR}/include/kaldi-native-fbank/csrc +) +file(GLOB_RECURSE all_headers *.h) + +file(COPY + ${all_headers} + DESTINATION + ${PROJECT_BINARY_DIR}/include/kaldi-native-fbank/csrc +) + +install(FILES ${all_headers} + DESTINATION include/kaldi-native-fbank/csrc +) diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-fbank.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-fbank.cc new file mode 100644 index 0000000..068f495 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-fbank.cc @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is copied/modified from kaldi/src/feat/feature-fbank.cc +// +#include "kaldi-native-fbank/csrc/feature-fbank.h" + +#include +#include +#include +#include + +#include "kaldi-native-fbank/csrc/feature-functions.h" + +namespace knf { + +static void Sqrt(float *in_out, int32_t n) { + for (int32_t i = 0; i != n; ++i) { + in_out[i] = std::sqrt(in_out[i]); + } +} + +std::ostream &operator<<(std::ostream &os, const FbankOptions &opts) { + os << opts.ToString(); + return os; +} + +FbankComputer::FbankComputer(const FbankOptions &opts) + : opts_(opts), rfft_(opts.frame_opts.PaddedWindowSize()) { + if (opts.energy_floor > 0.0f) { + log_energy_floor_ = logf(opts.energy_floor); + } + + // We'll definitely need the filterbanks info for VTLN warping factor 1.0. + // [note: this call caches it.] + GetMelBanks(1.0f); +} + +FbankComputer::~FbankComputer() { + for (auto iter = mel_banks_.begin(); iter != mel_banks_.end(); ++iter) + delete iter->second; +} + +const MelBanks *FbankComputer::GetMelBanks(float vtln_warp) { + MelBanks *this_mel_banks = nullptr; + + // std::map::iterator iter = mel_banks_.find(vtln_warp); + auto iter = mel_banks_.find(vtln_warp); + if (iter == mel_banks_.end()) { + this_mel_banks = new MelBanks(opts_.mel_opts, opts_.frame_opts, vtln_warp); + mel_banks_[vtln_warp] = this_mel_banks; + } else { + this_mel_banks = iter->second; + } + return this_mel_banks; +} + +void FbankComputer::Compute(float signal_raw_log_energy, float vtln_warp, + std::vector *signal_frame, float *feature) { + const MelBanks &mel_banks = *(GetMelBanks(vtln_warp)); + + KNF_CHECK_EQ(signal_frame->size(), opts_.frame_opts.PaddedWindowSize()); + + // Compute energy after window function (not the raw one). + if (opts_.use_energy && !opts_.raw_energy) { + signal_raw_log_energy = std::log( + std::max(InnerProduct(signal_frame->data(), signal_frame->data(), + signal_frame->size()), + std::numeric_limits::epsilon())); + } + rfft_.Compute(signal_frame->data()); // signal_frame is modified in-place + ComputePowerSpectrum(signal_frame); + + // Use magnitude instead of power if requested. + if (!opts_.use_power) { + Sqrt(signal_frame->data(), signal_frame->size() / 2 + 1); + } + + int32_t mel_offset = ((opts_.use_energy && !opts_.htk_compat) ? 1 : 0); + + // Its length is opts_.mel_opts.num_bins + float *mel_energies = feature + mel_offset; + + // Sum with mel filter banks over the power spectrum + mel_banks.Compute(signal_frame->data(), mel_energies); + + if (opts_.use_log_fbank) { + // Avoid log of zero (which should be prevented anyway by dithering). + for (int32_t i = 0; i != opts_.mel_opts.num_bins; ++i) { + auto t = std::max(mel_energies[i], std::numeric_limits::epsilon()); + mel_energies[i] = std::log(t); + } + } + + // Copy energy as first value (or the last, if htk_compat == true). + if (opts_.use_energy) { + if (opts_.energy_floor > 0.0 && signal_raw_log_energy < log_energy_floor_) { + signal_raw_log_energy = log_energy_floor_; + } + int32_t energy_index = opts_.htk_compat ? opts_.mel_opts.num_bins : 0; + feature[energy_index] = signal_raw_log_energy; + } +} + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-fbank.h b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-fbank.h new file mode 100644 index 0000000..0786aad --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-fbank.h @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is copied/modified from kaldi/src/feat/feature-fbank.h + +#ifndef KALDI_NATIVE_FBANK_CSRC_FEATURE_FBANK_H_ +#define KALDI_NATIVE_FBANK_CSRC_FEATURE_FBANK_H_ + +#include +#include +#include + +#include "kaldi-native-fbank/csrc/feature-window.h" +#include "kaldi-native-fbank/csrc/mel-computations.h" +#include "kaldi-native-fbank/csrc/rfft.h" + +namespace knf { + +struct FbankOptions { + FrameExtractionOptions frame_opts; + MelBanksOptions mel_opts; + // append an extra dimension with energy to the filter banks + bool use_energy = false; + float energy_floor = 0.0f; // active iff use_energy==true + + // If true, compute log_energy before preemphasis and windowing + // If false, compute log_energy after preemphasis ans windowing + bool raw_energy = true; // active iff use_energy==true + + // If true, put energy last (if using energy) + // If false, put energy first + bool htk_compat = false; // active iff use_energy==true + + // if true (default), produce log-filterbank, else linear + bool use_log_fbank = true; + + // if true (default), use power in filterbank + // analysis, else magnitude. + bool use_power = true; + + FbankOptions() { mel_opts.num_bins = 23; } + + std::string ToString() const { + std::ostringstream os; + os << "frame_opts: \n"; + os << frame_opts << "\n"; + os << "\n"; + + os << "mel_opts: \n"; + os << mel_opts << "\n"; + + os << "use_energy: " << use_energy << "\n"; + os << "energy_floor: " << energy_floor << "\n"; + os << "raw_energy: " << raw_energy << "\n"; + os << "htk_compat: " << htk_compat << "\n"; + os << "use_log_fbank: " << use_log_fbank << "\n"; + os << "use_power: " << use_power << "\n"; + return os.str(); + } +}; + +std::ostream &operator<<(std::ostream &os, const FbankOptions &opts); + +class FbankComputer { + public: + using Options = FbankOptions; + + explicit FbankComputer(const FbankOptions &opts); + ~FbankComputer(); + + int32_t Dim() const { + return opts_.mel_opts.num_bins + (opts_.use_energy ? 1 : 0); + } + + // if true, compute log_energy_pre_window but after dithering and dc removal + bool NeedRawLogEnergy() const { return opts_.use_energy && opts_.raw_energy; } + + const FrameExtractionOptions &GetFrameOptions() const { + return opts_.frame_opts; + } + + const FbankOptions &GetOptions() const { return opts_; } + + /** + Function that computes one frame of features from + one frame of signal. + + @param [in] signal_raw_log_energy The log-energy of the frame of the signal + prior to windowing and pre-emphasis, or + log(numeric_limits::min()), whichever is greater. Must be + ignored by this function if this class returns false from + this->NeedsRawLogEnergy(). + @param [in] vtln_warp The VTLN warping factor that the user wants + to be applied when computing features for this utterance. Will + normally be 1.0, meaning no warping is to be done. The value will + be ignored for feature types that don't support VLTN, such as + spectrogram features. + @param [in] signal_frame One frame of the signal, + as extracted using the function ExtractWindow() using the options + returned by this->GetFrameOptions(). The function will use the + vector as a workspace, which is why it's a non-const pointer. + @param [out] feature Pointer to a vector of size this->Dim(), to which + the computed feature will be written. It should be pre-allocated. + */ + void Compute(float signal_raw_log_energy, float vtln_warp, + std::vector *signal_frame, float *feature); + + private: + const MelBanks *GetMelBanks(float vtln_warp); + + FbankOptions opts_; + float log_energy_floor_; + std::map mel_banks_; // float is VTLN coefficient. + Rfft rfft_; +}; + +} // namespace knf + +#endif // KALDI_NATIVE_FBANK_CSRC_FEATURE_FBANK_H_ diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-functions.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-functions.cc new file mode 100644 index 0000000..00ae4c7 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-functions.cc @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is copied/modified from kaldi/src/feat/feature-functions.cc + +#include "kaldi-native-fbank/csrc/feature-functions.h" + +#include +#include + +namespace knf { + +void ComputePowerSpectrum(std::vector *complex_fft) { + int32_t dim = complex_fft->size(); + + // now we have in complex_fft, first half of complex spectrum + // it's stored as [real0, realN/2, real1, im1, real2, im2, ...] + + float *p = complex_fft->data(); + int32_t half_dim = dim / 2; + float first_energy = p[0] * p[0]; + float last_energy = p[1] * p[1]; // handle this special case + + for (int32_t i = 1; i < half_dim; ++i) { + float real = p[i * 2]; + float im = p[i * 2 + 1]; + p[i] = real * real + im * im; + } + p[0] = first_energy; + p[half_dim] = last_energy; // Will actually never be used, and anyway + // if the signal has been bandlimited sensibly this should be zero. +} + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-functions.h b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-functions.h new file mode 100644 index 0000000..b221622 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-functions.h @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is copied/modified from kaldi/src/feat/feature-functions.h +#ifndef KALDI_NATIVE_FBANK_CSRC_FEATURE_FUNCTIONS_H_ +#define KALDI_NATIVE_FBANK_CSRC_FEATURE_FUNCTIONS_H_ + +#include +namespace knf { + +// ComputePowerSpectrum converts a complex FFT (as produced by the FFT +// functions in csrc/rfft.h), and converts it into +// a power spectrum. If the complex FFT is a vector of size n (representing +// half of the complex FFT of a real signal of size n, as described there), +// this function computes in the first (n/2) + 1 elements of it, the +// energies of the fft bins from zero to the Nyquist frequency. Contents of the +// remaining (n/2) - 1 elements are undefined at output. + +void ComputePowerSpectrum(std::vector *complex_fft); + +} // namespace knf + +#endif // KALDI_NATIVE_FBANK_CSRC_FEATURE_FUNCTIONS_H_ diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-window.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-window.cc new file mode 100644 index 0000000..dc189a6 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-window.cc @@ -0,0 +1,247 @@ +// kaldi-native-fbank/csrc/feature-window.cc +// +// Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + +// This file is copied/modified from kaldi/src/feat/feature-window.cc + +#include "kaldi-native-fbank/csrc/feature-window.h" + +#include +#include +#include +#include + +#ifndef M_2PI +#define M_2PI 6.283185307179586476925286766559005 +#endif + +namespace knf { + +std::ostream &operator<<(std::ostream &os, const FrameExtractionOptions &opts) { + os << opts.ToString(); + return os; +} + +FeatureWindowFunction::FeatureWindowFunction(const FrameExtractionOptions &opts) + : window_(opts.WindowSize()) { + int32_t frame_length = opts.WindowSize(); + KNF_CHECK_GT(frame_length, 0); + + float *window_data = window_.data(); + + double a = M_2PI / (frame_length - 1); + for (int32_t i = 0; i < frame_length; i++) { + double i_fl = static_cast(i); + if (opts.window_type == "hanning") { + window_data[i] = 0.5 - 0.5 * cos(a * i_fl); + } else if (opts.window_type == "sine") { + // when you are checking ws wikipedia, please + // note that 0.5 * a = M_PI/(frame_length-1) + window_data[i] = sin(0.5 * a * i_fl); + } else if (opts.window_type == "hamming") { + window_data[i] = 0.54 - 0.46 * cos(a * i_fl); + } else if (opts.window_type == + "povey") { // like hamming but goes to zero at edges. + window_data[i] = pow(0.5 - 0.5 * cos(a * i_fl), 0.85); + } else if (opts.window_type == "rectangular") { + window_data[i] = 1.0; + } else if (opts.window_type == "blackman") { + window_data[i] = opts.blackman_coeff - 0.5 * cos(a * i_fl) + + (0.5 - opts.blackman_coeff) * cos(2 * a * i_fl); + } else { + KNF_LOG(FATAL) << "Invalid window type " << opts.window_type; + } + } +} + +void FeatureWindowFunction::Apply(float *wave) const { + int32_t window_size = window_.size(); + const float *p = window_.data(); + for (int32_t k = 0; k != window_size; ++k) { + wave[k] *= p[k]; + } +} + +int64_t FirstSampleOfFrame(int32_t frame, const FrameExtractionOptions &opts) { + int64_t frame_shift = opts.WindowShift(); + if (opts.snip_edges) { + return frame * frame_shift; + } else { + int64_t midpoint_of_frame = frame_shift * frame + frame_shift / 2, + beginning_of_frame = midpoint_of_frame - opts.WindowSize() / 2; + return beginning_of_frame; + } +} + +int32_t NumFrames(int64_t num_samples, const FrameExtractionOptions &opts, + bool flush /*= true*/) { + int64_t frame_shift = opts.WindowShift(); + int64_t frame_length = opts.WindowSize(); + if (opts.snip_edges) { + // with --snip-edges=true (the default), we use a HTK-like approach to + // determining the number of frames-- all frames have to fit completely into + // the waveform, and the first frame begins at sample zero. + if (num_samples < frame_length) + return 0; + else + return (1 + ((num_samples - frame_length) / frame_shift)); + // You can understand the expression above as follows: 'num_samples - + // frame_length' is how much room we have to shift the frame within the + // waveform; 'frame_shift' is how much we shift it each time; and the ratio + // is how many times we can shift it (integer arithmetic rounds down). + } else { + // if --snip-edges=false, the number of frames is determined by rounding the + // (file-length / frame-shift) to the nearest integer. The point of this + // formula is to make the number of frames an obvious and predictable + // function of the frame shift and signal length, which makes many + // segmentation-related questions simpler. + // + // Because integer division in C++ rounds toward zero, we add (half the + // frame-shift minus epsilon) before dividing, to have the effect of + // rounding towards the closest integer. + int32_t num_frames = (num_samples + (frame_shift / 2)) / frame_shift; + + if (flush) return num_frames; + + // note: 'end' always means the last plus one, i.e. one past the last. + int64_t end_sample_of_last_frame = + FirstSampleOfFrame(num_frames - 1, opts) + frame_length; + + // the following code is optimized more for clarity than efficiency. + // If flush == false, we can't output frames that extend past the end + // of the signal. + while (num_frames > 0 && end_sample_of_last_frame > num_samples) { + num_frames--; + end_sample_of_last_frame -= frame_shift; + } + return num_frames; + } +} + +void ExtractWindow(int64_t sample_offset, const std::vector &wave, + int32_t f, const FrameExtractionOptions &opts, + const FeatureWindowFunction &window_function, + std::vector *window, + float *log_energy_pre_window /*= nullptr*/) { + KNF_CHECK(sample_offset >= 0 && wave.size() != 0); + + int32_t frame_length = opts.WindowSize(); + int32_t frame_length_padded = opts.PaddedWindowSize(); + + int64_t num_samples = sample_offset + wave.size(); + int64_t start_sample = FirstSampleOfFrame(f, opts); + int64_t end_sample = start_sample + frame_length; + + if (opts.snip_edges) { + KNF_CHECK(start_sample >= sample_offset && end_sample <= num_samples); + } else { + KNF_CHECK(sample_offset == 0 || start_sample >= sample_offset); + } + + if (window->size() != frame_length_padded) { + window->resize(frame_length_padded); + } + + // wave_start and wave_end are start and end indexes into 'wave', for the + // piece of wave that we're trying to extract. + int32_t wave_start = int32_t(start_sample - sample_offset); + int32_t wave_end = wave_start + frame_length; + + if (wave_start >= 0 && wave_end <= wave.size()) { + // the normal case-- no edge effects to consider. + std::copy(wave.begin() + wave_start, + wave.begin() + wave_start + frame_length, window->data()); + } else { + // Deal with any end effects by reflection, if needed. This code will only + // be reached for about two frames per utterance, so we don't concern + // ourselves excessively with efficiency. + int32_t wave_dim = wave.size(); + for (int32_t s = 0; s < frame_length; ++s) { + int32_t s_in_wave = s + wave_start; + while (s_in_wave < 0 || s_in_wave >= wave_dim) { + // reflect around the beginning or end of the wave. + // e.g. -1 -> 0, -2 -> 1. + // dim -> dim - 1, dim + 1 -> dim - 2. + // the code supports repeated reflections, although this + // would only be needed in pathological cases. + if (s_in_wave < 0) + s_in_wave = -s_in_wave - 1; + else + s_in_wave = 2 * wave_dim - 1 - s_in_wave; + } + (*window)[s] = wave[s_in_wave]; + } + } + + ProcessWindow(opts, window_function, window->data(), log_energy_pre_window); +} + +static void RemoveDcOffset(float *d, int32_t n) { + float sum = 0; + for (int32_t i = 0; i != n; ++i) { + sum += d[i]; + } + + float mean = sum / n; + + for (int32_t i = 0; i != n; ++i) { + d[i] -= mean; + } +} + +float InnerProduct(const float *a, const float *b, int32_t n) { + float sum = 0; + for (int32_t i = 0; i != n; ++i) { + sum += a[i] * b[i]; + } + return sum; +} + +static void Preemphasize(float *d, int32_t n, float preemph_coeff) { + if (preemph_coeff == 0.0) { + return; + } + + KNF_CHECK(preemph_coeff >= 0.0 && preemph_coeff <= 1.0); + + for (int32_t i = n - 1; i > 0; --i) { + d[i] -= preemph_coeff * d[i - 1]; + } + d[0] -= preemph_coeff * d[0]; +} + +void ProcessWindow(const FrameExtractionOptions &opts, + const FeatureWindowFunction &window_function, float *window, + float *log_energy_pre_window /*= nullptr*/) { + int32_t frame_length = opts.WindowSize(); + +// // TODO(fangjun): Remove dither +// KNF_CHECK_EQ(opts.dither, 0); + + // Add dither function + // https://github.com/kaldi-asr/kaldi/blob/master/src/feat/feature-window.cc + if (opts.dither!=0) { +// kaldi::RandomState rstate; +// rstate.seed=0; +// for (int32 i = 0; i < frame_length; i++) +// window[i] += RandGauss(&rstate) * opts.dither; + } + + if (opts.remove_dc_offset) { + RemoveDcOffset(window, frame_length); + } + + if (log_energy_pre_window != NULL) { + float energy = std::max(InnerProduct(window, window, frame_length), + std::numeric_limits::epsilon()); + *log_energy_pre_window = std::log(energy); + } + + if (opts.preemph_coeff != 0.0) { + Preemphasize(window, frame_length, opts.preemph_coeff); + } + + window_function.Apply(window); +} + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-window.h b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-window.h new file mode 100644 index 0000000..32e8e2a --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-window.h @@ -0,0 +1,178 @@ +// kaldi-native-fbank/csrc/feature-window.h +// +// Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + +// This file is copied/modified from kaldi/src/feat/feature-window.h + +#ifndef KALDI_NATIVE_FBANK_CSRC_FEATURE_WINDOW_H_ +#define KALDI_NATIVE_FBANK_CSRC_FEATURE_WINDOW_H_ + +#include +#include +#include + +#include "kaldi-native-fbank/csrc/log.h" + +namespace knf { + +inline int32_t RoundUpToNearestPowerOfTwo(int32_t n) { + // copied from kaldi/src/base/kaldi-math.cc + KNF_CHECK_GT(n, 0); + n--; + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + return n + 1; +} + +struct FrameExtractionOptions { + float samp_freq = 16000; + float frame_shift_ms = 10.0f; // in milliseconds. + float frame_length_ms = 25.0f; // in milliseconds. + float dither = 1.0f; // Amount of dithering, 0.0 means no dither. + float preemph_coeff = 0.97f; // Preemphasis coefficient. + bool remove_dc_offset = true; // Subtract mean of wave before FFT. + std::string window_type = "povey"; // e.g. Hamming window + // May be "hamming", "rectangular", "povey", "hanning", "sine", "blackman" + // "povey" is a window I made to be similar to Hamming but to go to zero at + // the edges, it's pow((0.5 - 0.5*cos(n/N*2*pi)), 0.85) I just don't think the + // Hamming window makes sense as a windowing function. + bool round_to_power_of_two = true; + float blackman_coeff = 0.42f; + bool snip_edges = true; + // bool allow_downsample = false; + // bool allow_upsample = false; + + // Used for streaming feature extraction. It indicates the number + // of feature frames to keep in the recycling vector. -1 means to + // keep all feature frames. + int32_t max_feature_vectors = -1; + + int32_t WindowShift() const { + return static_cast(samp_freq * 0.001f * frame_shift_ms); + } + int32_t WindowSize() const { + return static_cast(samp_freq * 0.001f * frame_length_ms); + } + int32_t PaddedWindowSize() const { + return (round_to_power_of_two ? RoundUpToNearestPowerOfTwo(WindowSize()) + : WindowSize()); + } + std::string ToString() const { + std::ostringstream os; +#define KNF_PRINT(x) os << #x << ": " << x << "\n" + KNF_PRINT(samp_freq); + KNF_PRINT(frame_shift_ms); + KNF_PRINT(frame_length_ms); + KNF_PRINT(dither); + KNF_PRINT(preemph_coeff); + KNF_PRINT(remove_dc_offset); + KNF_PRINT(window_type); + KNF_PRINT(round_to_power_of_two); + KNF_PRINT(blackman_coeff); + KNF_PRINT(snip_edges); + // KNF_PRINT(allow_downsample); + // KNF_PRINT(allow_upsample); + KNF_PRINT(max_feature_vectors); +#undef KNF_PRINT + return os.str(); + } +}; + +std::ostream &operator<<(std::ostream &os, const FrameExtractionOptions &opts); + +class FeatureWindowFunction { + public: + FeatureWindowFunction() = default; + explicit FeatureWindowFunction(const FrameExtractionOptions &opts); + /** + * @param wave Pointer to a 1-D array of shape [window_size]. + * It is modified in-place: wave[i] = wave[i] * window_[i]. + * @param + */ + void Apply(float *wave) const; + + private: + std::vector window_; // of size opts.WindowSize() +}; + +int64_t FirstSampleOfFrame(int32_t frame, const FrameExtractionOptions &opts); + +/** + This function returns the number of frames that we can extract from a wave + file with the given number of samples in it (assumed to have the same + sampling rate as specified in 'opts'). + + @param [in] num_samples The number of samples in the wave file. + @param [in] opts The frame-extraction options class + + @param [in] flush True if we are asserting that this number of samples + is 'all there is', false if we expecting more data to possibly come in. This + only makes a difference to the answer + if opts.snips_edges== false. For offline feature extraction you always want + flush == true. In an online-decoding context, once you know (or decide) that + no more data is coming in, you'd call it with flush == true at the end to + flush out any remaining data. +*/ +int32_t NumFrames(int64_t num_samples, const FrameExtractionOptions &opts, + bool flush = true); + +/* + ExtractWindow() extracts a windowed frame of waveform (possibly with a + power-of-two, padded size, depending on the config), including all the + processing done by ProcessWindow(). + + @param [in] sample_offset If 'wave' is not the entire waveform, but + part of it to the left has been discarded, then the + number of samples prior to 'wave' that we have + already discarded. Set this to zero if you are + processing the entire waveform in one piece, or + if you get 'no matching function' compilation + errors when updating the code. + @param [in] wave The waveform + @param [in] f The frame index to be extracted, with + 0 <= f < NumFrames(sample_offset + wave.Dim(), opts, true) + @param [in] opts The options class to be used + @param [in] window_function The windowing function, as derived from the + options class. + @param [out] window The windowed, possibly-padded waveform to be + extracted. Will be resized as needed. + @param [out] log_energy_pre_window If non-NULL, the log-energy of + the signal prior to pre-emphasis and multiplying by + the windowing function will be written to here. +*/ +void ExtractWindow(int64_t sample_offset, const std::vector &wave, + int32_t f, const FrameExtractionOptions &opts, + const FeatureWindowFunction &window_function, + std::vector *window, + float *log_energy_pre_window = nullptr); + +/** + This function does all the windowing steps after actually + extracting the windowed signal: depending on the + configuration, it does dithering, dc offset removal, + preemphasis, and multiplication by the windowing function. + @param [in] opts The options class to be used + @param [in] window_function The windowing function-- should have + been initialized using 'opts'. + @param [in,out] window A vector of size opts.WindowSize(). Note: + it will typically be a sub-vector of a larger vector of size + opts.PaddedWindowSize(), with the remaining samples zero, + as the FFT code is more efficient if it operates on data with + power-of-two size. + @param [out] log_energy_pre_window If non-NULL, then after dithering and + DC offset removal, this function will write to this pointer the log of + the total energy (i.e. sum-squared) of the frame. + */ +void ProcessWindow(const FrameExtractionOptions &opts, + const FeatureWindowFunction &window_function, float *window, + float *log_energy_pre_window = nullptr); + +// Compute the inner product of two vectors +float InnerProduct(const float *a, const float *b, int32_t n); + +} // namespace knf + +#endif // KALDI_NATIVE_FBANK_CSRC_FEATURE_WINDOW_H_ diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/fftsg.c b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/fftsg.c new file mode 100644 index 0000000..40242c0 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/fftsg.c @@ -0,0 +1,2968 @@ +/* This file is copied from + * https://www.kurims.kyoto-u.ac.jp/~ooura/fft.html + */ +/* +Fast Fourier/Cosine/Sine Transform + dimension :one + data length :power of 2 + decimation :frequency + radix :split-radix + data :inplace + table :use +functions + cdft: Complex Discrete Fourier Transform + rdft: Real Discrete Fourier Transform + ddct: Discrete Cosine Transform + ddst: Discrete Sine Transform + dfct: Cosine Transform of RDFT (Real Symmetric DFT) + dfst: Sine Transform of RDFT (Real Anti-symmetric DFT) +function prototypes + void cdft(int, int, double *, int *, double *); + void rdft(int, int, double *, int *, double *); + void ddct(int, int, double *, int *, double *); + void ddst(int, int, double *, int *, double *); + void dfct(int, double *, double *, int *, double *); + void dfst(int, double *, double *, int *, double *); +macro definitions + USE_CDFT_PTHREADS : default=not defined + CDFT_THREADS_BEGIN_N : must be >= 512, default=8192 + CDFT_4THREADS_BEGIN_N : must be >= 512, default=65536 + USE_CDFT_WINTHREADS : default=not defined + CDFT_THREADS_BEGIN_N : must be >= 512, default=32768 + CDFT_4THREADS_BEGIN_N : must be >= 512, default=524288 + + +-------- Complex DFT (Discrete Fourier Transform) -------- + [definition] + + X[k] = sum_j=0^n-1 x[j]*exp(2*pi*i*j*k/n), 0<=k + X[k] = sum_j=0^n-1 x[j]*exp(-2*pi*i*j*k/n), 0<=k + ip[0] = 0; // first time only + cdft(2*n, 1, a, ip, w); + + ip[0] = 0; // first time only + cdft(2*n, -1, a, ip, w); + [parameters] + 2*n :data length (int) + n >= 1, n = power of 2 + a[0...2*n-1] :input/output data (double *) + input data + a[2*j] = Re(x[j]), + a[2*j+1] = Im(x[j]), 0<=j= 2+sqrt(n) + strictly, + length of ip >= + 2+(1<<(int)(log(n+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n/2-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + cdft(2*n, -1, a, ip, w); + is + cdft(2*n, 1, a, ip, w); + for (j = 0; j <= 2 * n - 1; j++) { + a[j] *= 1.0 / n; + } + . + + +-------- Real DFT / Inverse of Real DFT -------- + [definition] + RDFT + R[k] = sum_j=0^n-1 a[j]*cos(2*pi*j*k/n), 0<=k<=n/2 + I[k] = sum_j=0^n-1 a[j]*sin(2*pi*j*k/n), 0 IRDFT (excluding scale) + a[k] = (R[0] + R[n/2]*cos(pi*k))/2 + + sum_j=1^n/2-1 R[j]*cos(2*pi*j*k/n) + + sum_j=1^n/2-1 I[j]*sin(2*pi*j*k/n), 0<=k + ip[0] = 0; // first time only + rdft(n, 1, a, ip, w); + + ip[0] = 0; // first time only + rdft(n, -1, a, ip, w); + [parameters] + n :data length (int) + n >= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + + output data + a[2*k] = R[k], 0<=k + input data + a[2*j] = R[j], 0<=j= 2+sqrt(n/2) + strictly, + length of ip >= + 2+(1<<(int)(log(n/2+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n/2-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + rdft(n, 1, a, ip, w); + is + rdft(n, -1, a, ip, w); + for (j = 0; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + +-------- DCT (Discrete Cosine Transform) / Inverse of DCT -------- + [definition] + IDCT (excluding scale) + C[k] = sum_j=0^n-1 a[j]*cos(pi*j*(k+1/2)/n), 0<=k DCT + C[k] = sum_j=0^n-1 a[j]*cos(pi*(j+1/2)*k/n), 0<=k + ip[0] = 0; // first time only + ddct(n, 1, a, ip, w); + + ip[0] = 0; // first time only + ddct(n, -1, a, ip, w); + [parameters] + n :data length (int) + n >= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + output data + a[k] = C[k], 0<=k= 2+sqrt(n/2) + strictly, + length of ip >= + 2+(1<<(int)(log(n/2+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/4-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + ddct(n, -1, a, ip, w); + is + a[0] *= 0.5; + ddct(n, 1, a, ip, w); + for (j = 0; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + +-------- DST (Discrete Sine Transform) / Inverse of DST -------- + [definition] + IDST (excluding scale) + S[k] = sum_j=1^n A[j]*sin(pi*j*(k+1/2)/n), 0<=k DST + S[k] = sum_j=0^n-1 a[j]*sin(pi*(j+1/2)*k/n), 0 + ip[0] = 0; // first time only + ddst(n, 1, a, ip, w); + + ip[0] = 0; // first time only + ddst(n, -1, a, ip, w); + [parameters] + n :data length (int) + n >= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + + input data + a[j] = A[j], 0 + output data + a[k] = S[k], 0= 2+sqrt(n/2) + strictly, + length of ip >= + 2+(1<<(int)(log(n/2+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/4-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + ddst(n, -1, a, ip, w); + is + a[0] *= 0.5; + ddst(n, 1, a, ip, w); + for (j = 0; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + +-------- Cosine Transform of RDFT (Real Symmetric DFT) -------- + [definition] + C[k] = sum_j=0^n a[j]*cos(pi*j*k/n), 0<=k<=n + [usage] + ip[0] = 0; // first time only + dfct(n, a, t, ip, w); + [parameters] + n :data length - 1 (int) + n >= 2, n = power of 2 + a[0...n] :input/output data (double *) + output data + a[k] = C[k], 0<=k<=n + t[0...n/2] :work area (double *) + ip[0...*] :work area for bit reversal (int *) + length of ip >= 2+sqrt(n/4) + strictly, + length of ip >= + 2+(1<<(int)(log(n/4+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/8-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + a[0] *= 0.5; + a[n] *= 0.5; + dfct(n, a, t, ip, w); + is + a[0] *= 0.5; + a[n] *= 0.5; + dfct(n, a, t, ip, w); + for (j = 0; j <= n; j++) { + a[j] *= 2.0 / n; + } + . + + +-------- Sine Transform of RDFT (Real Anti-symmetric DFT) -------- + [definition] + S[k] = sum_j=1^n-1 a[j]*sin(pi*j*k/n), 0= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + output data + a[k] = S[k], 0= 2+sqrt(n/4) + strictly, + length of ip >= + 2+(1<<(int)(log(n/4+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/8-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + dfst(n, a, t, ip, w); + is + dfst(n, a, t, ip, w); + for (j = 1; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + +Appendix : + The cos/sin table is recalculated when the larger table required. + w[] and ip[] are compatible with all routines. +*/ + + + +void rdft(int n, int isgn, double *a, int *ip, double *w) +{ + void makewt(int nw, int *ip, double *w); + void makect(int nc, int *ip, double *c); + void cftfsub(int n, double *a, int *ip, int nw, double *w); + void cftbsub(int n, double *a, int *ip, int nw, double *w); + void rftfsub(int n, double *a, int nc, double *c); + void rftbsub(int n, double *a, int nc, double *c); + int nw, nc; + double xi; + + nw = ip[0]; + if (n > (nw << 2)) { + nw = n >> 2; + makewt(nw, ip, w); + } + nc = ip[1]; + if (n > (nc << 2)) { + nc = n >> 2; + makect(nc, ip, w + nw); + } + if (isgn >= 0) { + if (n > 4) { + cftfsub(n, a, ip, nw, w); + rftfsub(n, a, nc, w + nw); + } else if (n == 4) { + cftfsub(n, a, ip, nw, w); + } + xi = a[0] - a[1]; + a[0] += a[1]; + a[1] = xi; + } else { + a[1] = 0.5 * (a[0] - a[1]); + a[0] -= a[1]; + if (n > 4) { + rftbsub(n, a, nc, w + nw); + cftbsub(n, a, ip, nw, w); + } else if (n == 4) { + cftbsub(n, a, ip, nw, w); + } + } +} + + +/* -------- initializing routines -------- */ + + +#include + +void makewt(int nw, int *ip, double *w) +{ + void makeipt(int nw, int *ip); + int j, nwh, nw0, nw1; + double delta, wn4r, wk1r, wk1i, wk3r, wk3i; + + ip[0] = nw; + ip[1] = 1; + if (nw > 2) { + nwh = nw >> 1; + delta = atan(1.0) / nwh; + wn4r = cos(delta * nwh); + w[0] = 1; + w[1] = wn4r; + if (nwh == 4) { + w[2] = cos(delta * 2); + w[3] = sin(delta * 2); + } else if (nwh > 4) { + makeipt(nw, ip); + w[2] = 0.5 / cos(delta * 2); + w[3] = 0.5 / cos(delta * 6); + for (j = 4; j < nwh; j += 4) { + w[j] = cos(delta * j); + w[j + 1] = sin(delta * j); + w[j + 2] = cos(3 * delta * j); + w[j + 3] = -sin(3 * delta * j); + } + } + nw0 = 0; + while (nwh > 2) { + nw1 = nw0 + nwh; + nwh >>= 1; + w[nw1] = 1; + w[nw1 + 1] = wn4r; + if (nwh == 4) { + wk1r = w[nw0 + 4]; + wk1i = w[nw0 + 5]; + w[nw1 + 2] = wk1r; + w[nw1 + 3] = wk1i; + } else if (nwh > 4) { + wk1r = w[nw0 + 4]; + wk3r = w[nw0 + 6]; + w[nw1 + 2] = 0.5 / wk1r; + w[nw1 + 3] = 0.5 / wk3r; + for (j = 4; j < nwh; j += 4) { + wk1r = w[nw0 + 2 * j]; + wk1i = w[nw0 + 2 * j + 1]; + wk3r = w[nw0 + 2 * j + 2]; + wk3i = w[nw0 + 2 * j + 3]; + w[nw1 + j] = wk1r; + w[nw1 + j + 1] = wk1i; + w[nw1 + j + 2] = wk3r; + w[nw1 + j + 3] = wk3i; + } + } + nw0 = nw1; + } + } +} + + +void makeipt(int nw, int *ip) +{ + int j, l, m, m2, p, q; + + ip[2] = 0; + ip[3] = 16; + m = 2; + for (l = nw; l > 32; l >>= 2) { + m2 = m << 1; + q = m2 << 3; + for (j = m; j < m2; j++) { + p = ip[j] << 2; + ip[m + j] = p; + ip[m2 + j] = p + q; + } + m = m2; + } +} + + +void makect(int nc, int *ip, double *c) +{ + int j, nch; + double delta; + + ip[1] = nc; + if (nc > 1) { + nch = nc >> 1; + delta = atan(1.0) / nch; + c[0] = cos(delta * nch); + c[nch] = 0.5 * c[0]; + for (j = 1; j < nch; j++) { + c[j] = 0.5 * cos(delta * j); + c[nc - j] = 0.5 * sin(delta * j); + } + } +} + + +/* -------- child routines -------- */ + + +#ifdef USE_CDFT_PTHREADS +#define USE_CDFT_THREADS +#ifndef CDFT_THREADS_BEGIN_N +#define CDFT_THREADS_BEGIN_N 8192 +#endif +#ifndef CDFT_4THREADS_BEGIN_N +#define CDFT_4THREADS_BEGIN_N 65536 +#endif +#include +#include +#include +#define cdft_thread_t pthread_t +#define cdft_thread_create(thp,func,argp) { \ + if (pthread_create(thp, NULL, func, (void *) argp) != 0) { \ + fprintf(stderr, "cdft thread error\n"); \ + exit(1); \ + } \ +} +#define cdft_thread_wait(th) { \ + if (pthread_join(th, NULL) != 0) { \ + fprintf(stderr, "cdft thread error\n"); \ + exit(1); \ + } \ +} +#endif /* USE_CDFT_PTHREADS */ + + +#ifdef USE_CDFT_WINTHREADS +#define USE_CDFT_THREADS +#ifndef CDFT_THREADS_BEGIN_N +#define CDFT_THREADS_BEGIN_N 32768 +#endif +#ifndef CDFT_4THREADS_BEGIN_N +#define CDFT_4THREADS_BEGIN_N 524288 +#endif +#include +#include +#include +#define cdft_thread_t HANDLE +#define cdft_thread_create(thp,func,argp) { \ + DWORD thid; \ + *(thp) = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) func, (LPVOID) argp, 0, &thid); \ + if (*(thp) == 0) { \ + fprintf(stderr, "cdft thread error\n"); \ + exit(1); \ + } \ +} +#define cdft_thread_wait(th) { \ + WaitForSingleObject(th, INFINITE); \ + CloseHandle(th); \ +} +#endif /* USE_CDFT_WINTHREADS */ + + +void cftfsub(int n, double *a, int *ip, int nw, double *w) +{ + void bitrv2(int n, int *ip, double *a); + void bitrv216(double *a); + void bitrv208(double *a); + void cftf1st(int n, double *a, double *w); + void cftrec4(int n, double *a, int nw, double *w); + void cftleaf(int n, int isplt, double *a, int nw, double *w); + void cftfx41(int n, double *a, int nw, double *w); + void cftf161(double *a, double *w); + void cftf081(double *a, double *w); + void cftf040(double *a); + void cftx020(double *a); +#ifdef USE_CDFT_THREADS + void cftrec4_th(int n, double *a, int nw, double *w); +#endif /* USE_CDFT_THREADS */ + + if (n > 8) { + if (n > 32) { + cftf1st(n, a, &w[nw - (n >> 2)]); +#ifdef USE_CDFT_THREADS + if (n > CDFT_THREADS_BEGIN_N) { + cftrec4_th(n, a, nw, w); + } else +#endif /* USE_CDFT_THREADS */ + if (n > 512) { + cftrec4(n, a, nw, w); + } else if (n > 128) { + cftleaf(n, 1, a, nw, w); + } else { + cftfx41(n, a, nw, w); + } + bitrv2(n, ip, a); + } else if (n == 32) { + cftf161(a, &w[nw - 8]); + bitrv216(a); + } else { + cftf081(a, w); + bitrv208(a); + } + } else if (n == 8) { + cftf040(a); + } else if (n == 4) { + cftx020(a); + } +} + + +void cftbsub(int n, double *a, int *ip, int nw, double *w) +{ + void bitrv2conj(int n, int *ip, double *a); + void bitrv216neg(double *a); + void bitrv208neg(double *a); + void cftb1st(int n, double *a, double *w); + void cftrec4(int n, double *a, int nw, double *w); + void cftleaf(int n, int isplt, double *a, int nw, double *w); + void cftfx41(int n, double *a, int nw, double *w); + void cftf161(double *a, double *w); + void cftf081(double *a, double *w); + void cftb040(double *a); + void cftx020(double *a); +#ifdef USE_CDFT_THREADS + void cftrec4_th(int n, double *a, int nw, double *w); +#endif /* USE_CDFT_THREADS */ + + if (n > 8) { + if (n > 32) { + cftb1st(n, a, &w[nw - (n >> 2)]); +#ifdef USE_CDFT_THREADS + if (n > CDFT_THREADS_BEGIN_N) { + cftrec4_th(n, a, nw, w); + } else +#endif /* USE_CDFT_THREADS */ + if (n > 512) { + cftrec4(n, a, nw, w); + } else if (n > 128) { + cftleaf(n, 1, a, nw, w); + } else { + cftfx41(n, a, nw, w); + } + bitrv2conj(n, ip, a); + } else if (n == 32) { + cftf161(a, &w[nw - 8]); + bitrv216neg(a); + } else { + cftf081(a, w); + bitrv208neg(a); + } + } else if (n == 8) { + cftb040(a); + } else if (n == 4) { + cftx020(a); + } +} + + +void bitrv2(int n, int *ip, double *a) +{ + int j, j1, k, k1, l, m, nh, nm; + double xr, xi, yr, yi; + + m = 1; + for (l = n >> 2; l > 8; l >>= 2) { + m <<= 1; + } + nh = n >> 1; + nm = 4 * m; + if (l == 8) { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 4 * j + 2 * ip[m + k]; + k1 = 4 * k + 2 * ip[m + j]; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 -= nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nh; + k1 += 2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 += nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += 2; + k1 += nh; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 -= nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nh; + k1 -= 2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 += nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 4 * k + 2 * ip[m + k]; + j1 = k1 + 2; + k1 += nh; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 -= nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= 2; + k1 -= nh; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nh + 2; + k1 += nh + 2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nh - nm; + k1 += 2 * nm - 2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + } else { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 4 * j + ip[m + k]; + k1 = 4 * k + ip[m + j]; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nh; + k1 += 2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += 2; + k1 += nh; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nh; + k1 -= 2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 4 * k + ip[m + k]; + j1 = k1 + 2; + k1 += nh; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += nm; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + } +} + + +void bitrv2conj(int n, int *ip, double *a) +{ + int j, j1, k, k1, l, m, nh, nm; + double xr, xi, yr, yi; + + m = 1; + for (l = n >> 2; l > 8; l >>= 2) { + m <<= 1; + } + nh = n >> 1; + nm = 4 * m; + if (l == 8) { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 4 * j + 2 * ip[m + k]; + k1 = 4 * k + 2 * ip[m + j]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 -= nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nh; + k1 += 2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 += nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += 2; + k1 += nh; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 -= nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nh; + k1 -= 2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 += nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 4 * k + 2 * ip[m + k]; + j1 = k1 + 2; + k1 += nh; + a[j1 - 1] = -a[j1 - 1]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + a[k1 + 3] = -a[k1 + 3]; + j1 += nm; + k1 += 2 * nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 -= nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= 2; + k1 -= nh; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nh + 2; + k1 += nh + 2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nh - nm; + k1 += 2 * nm - 2; + a[j1 - 1] = -a[j1 - 1]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + a[k1 + 3] = -a[k1 + 3]; + } + } else { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 4 * j + ip[m + k]; + k1 = 4 * k + ip[m + j]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nh; + k1 += 2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += 2; + k1 += nh; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += nm; + k1 += nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nh; + k1 -= 2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 -= nm; + k1 -= nm; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 4 * k + ip[m + k]; + j1 = k1 + 2; + k1 += nh; + a[j1 - 1] = -a[j1 - 1]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + a[k1 + 3] = -a[k1 + 3]; + j1 += nm; + k1 += nm; + a[j1 - 1] = -a[j1 - 1]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + a[k1 + 3] = -a[k1 + 3]; + } + } +} + + +void bitrv216(double *a) +{ + double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, + x5r, x5i, x7r, x7i, x8r, x8i, x10r, x10i, + x11r, x11i, x12r, x12i, x13r, x13i, x14r, x14i; + + x1r = a[2]; + x1i = a[3]; + x2r = a[4]; + x2i = a[5]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x5r = a[10]; + x5i = a[11]; + x7r = a[14]; + x7i = a[15]; + x8r = a[16]; + x8i = a[17]; + x10r = a[20]; + x10i = a[21]; + x11r = a[22]; + x11i = a[23]; + x12r = a[24]; + x12i = a[25]; + x13r = a[26]; + x13i = a[27]; + x14r = a[28]; + x14i = a[29]; + a[2] = x8r; + a[3] = x8i; + a[4] = x4r; + a[5] = x4i; + a[6] = x12r; + a[7] = x12i; + a[8] = x2r; + a[9] = x2i; + a[10] = x10r; + a[11] = x10i; + a[14] = x14r; + a[15] = x14i; + a[16] = x1r; + a[17] = x1i; + a[20] = x5r; + a[21] = x5i; + a[22] = x13r; + a[23] = x13i; + a[24] = x3r; + a[25] = x3i; + a[26] = x11r; + a[27] = x11i; + a[28] = x7r; + a[29] = x7i; +} + + +void bitrv216neg(double *a) +{ + double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, + x5r, x5i, x6r, x6i, x7r, x7i, x8r, x8i, + x9r, x9i, x10r, x10i, x11r, x11i, x12r, x12i, + x13r, x13i, x14r, x14i, x15r, x15i; + + x1r = a[2]; + x1i = a[3]; + x2r = a[4]; + x2i = a[5]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x5r = a[10]; + x5i = a[11]; + x6r = a[12]; + x6i = a[13]; + x7r = a[14]; + x7i = a[15]; + x8r = a[16]; + x8i = a[17]; + x9r = a[18]; + x9i = a[19]; + x10r = a[20]; + x10i = a[21]; + x11r = a[22]; + x11i = a[23]; + x12r = a[24]; + x12i = a[25]; + x13r = a[26]; + x13i = a[27]; + x14r = a[28]; + x14i = a[29]; + x15r = a[30]; + x15i = a[31]; + a[2] = x15r; + a[3] = x15i; + a[4] = x7r; + a[5] = x7i; + a[6] = x11r; + a[7] = x11i; + a[8] = x3r; + a[9] = x3i; + a[10] = x13r; + a[11] = x13i; + a[12] = x5r; + a[13] = x5i; + a[14] = x9r; + a[15] = x9i; + a[16] = x1r; + a[17] = x1i; + a[18] = x14r; + a[19] = x14i; + a[20] = x6r; + a[21] = x6i; + a[22] = x10r; + a[23] = x10i; + a[24] = x2r; + a[25] = x2i; + a[26] = x12r; + a[27] = x12i; + a[28] = x4r; + a[29] = x4i; + a[30] = x8r; + a[31] = x8i; +} + + +void bitrv208(double *a) +{ + double x1r, x1i, x3r, x3i, x4r, x4i, x6r, x6i; + + x1r = a[2]; + x1i = a[3]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x6r = a[12]; + x6i = a[13]; + a[2] = x4r; + a[3] = x4i; + a[6] = x6r; + a[7] = x6i; + a[8] = x1r; + a[9] = x1i; + a[12] = x3r; + a[13] = x3i; +} + + +void bitrv208neg(double *a) +{ + double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, + x5r, x5i, x6r, x6i, x7r, x7i; + + x1r = a[2]; + x1i = a[3]; + x2r = a[4]; + x2i = a[5]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x5r = a[10]; + x5i = a[11]; + x6r = a[12]; + x6i = a[13]; + x7r = a[14]; + x7i = a[15]; + a[2] = x7r; + a[3] = x7i; + a[4] = x3r; + a[5] = x3i; + a[6] = x5r; + a[7] = x5i; + a[8] = x1r; + a[9] = x1i; + a[10] = x6r; + a[11] = x6i; + a[12] = x2r; + a[13] = x2i; + a[14] = x4r; + a[15] = x4i; +} + + +void cftf1st(int n, double *a, double *w) +{ + int j, j0, j1, j2, j3, k, m, mh; + double wn4r, csc1, csc3, wk1r, wk1i, wk3r, wk3i, + wd1r, wd1i, wd3r, wd3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i; + + mh = n >> 3; + m = 2 * mh; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] + a[j2]; + x0i = a[1] + a[j2 + 1]; + x1r = a[0] - a[j2]; + x1i = a[1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j2] = x1r - x3i; + a[j2 + 1] = x1i + x3r; + a[j3] = x1r + x3i; + a[j3 + 1] = x1i - x3r; + wn4r = w[1]; + csc1 = w[2]; + csc3 = w[3]; + wd1r = 1; + wd1i = 0; + wd3r = 1; + wd3i = 0; + k = 0; + for (j = 2; j < mh - 2; j += 4) { + k += 4; + wk1r = csc1 * (wd1r + w[k]); + wk1i = csc1 * (wd1i + w[k + 1]); + wk3r = csc3 * (wd3r + w[k + 2]); + wk3i = csc3 * (wd3i + w[k + 3]); + wd1r = w[k]; + wd1i = w[k + 1]; + wd3r = w[k + 2]; + wd3i = w[k + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] + a[j2]; + x0i = a[j + 1] + a[j2 + 1]; + x1r = a[j] - a[j2]; + x1i = a[j + 1] - a[j2 + 1]; + y0r = a[j + 2] + a[j2 + 2]; + y0i = a[j + 3] + a[j2 + 3]; + y1r = a[j + 2] - a[j2 + 2]; + y1i = a[j + 3] - a[j2 + 3]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 + 2] + a[j3 + 2]; + y2i = a[j1 + 3] + a[j3 + 3]; + y3r = a[j1 + 2] - a[j3 + 2]; + y3i = a[j1 + 3] - a[j3 + 3]; + a[j] = x0r + x2r; + a[j + 1] = x0i + x2i; + a[j + 2] = y0r + y2r; + a[j + 3] = y0i + y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j1 + 2] = y0r - y2r; + a[j1 + 3] = y0i - y2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1r * x0r - wk1i * x0i; + a[j2 + 1] = wk1r * x0i + wk1i * x0r; + x0r = y1r - y3i; + x0i = y1i + y3r; + a[j2 + 2] = wd1r * x0r - wd1i * x0i; + a[j2 + 3] = wd1r * x0i + wd1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3r * x0r + wk3i * x0i; + a[j3 + 1] = wk3r * x0i - wk3i * x0r; + x0r = y1r + y3i; + x0i = y1i - y3r; + a[j3 + 2] = wd3r * x0r + wd3i * x0i; + a[j3 + 3] = wd3r * x0i - wd3i * x0r; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + y0r = a[j0 - 2] + a[j2 - 2]; + y0i = a[j0 - 1] + a[j2 - 1]; + y1r = a[j0 - 2] - a[j2 - 2]; + y1i = a[j0 - 1] - a[j2 - 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 - 2] + a[j3 - 2]; + y2i = a[j1 - 1] + a[j3 - 1]; + y3r = a[j1 - 2] - a[j3 - 2]; + y3i = a[j1 - 1] - a[j3 - 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j0 - 2] = y0r + y2r; + a[j0 - 1] = y0i + y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j1 - 2] = y0r - y2r; + a[j1 - 1] = y0i - y2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1i * x0r - wk1r * x0i; + a[j2 + 1] = wk1i * x0i + wk1r * x0r; + x0r = y1r - y3i; + x0i = y1i + y3r; + a[j2 - 2] = wd1i * x0r - wd1r * x0i; + a[j2 - 1] = wd1i * x0i + wd1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3i * x0r + wk3r * x0i; + a[j3 + 1] = wk3i * x0i - wk3r * x0r; + x0r = y1r + y3i; + x0i = y1i - y3r; + a[j3 - 2] = wd3i * x0r + wd3r * x0i; + a[j3 - 1] = wd3i * x0i - wd3r * x0r; + } + wk1r = csc1 * (wd1r + wn4r); + wk1i = csc1 * (wd1i + wn4r); + wk3r = csc3 * (wd3r - wn4r); + wk3i = csc3 * (wd3i - wn4r); + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0 - 2] + a[j2 - 2]; + x0i = a[j0 - 1] + a[j2 - 1]; + x1r = a[j0 - 2] - a[j2 - 2]; + x1i = a[j0 - 1] - a[j2 - 1]; + x2r = a[j1 - 2] + a[j3 - 2]; + x2i = a[j1 - 1] + a[j3 - 1]; + x3r = a[j1 - 2] - a[j3 - 2]; + x3i = a[j1 - 1] - a[j3 - 1]; + a[j0 - 2] = x0r + x2r; + a[j0 - 1] = x0i + x2i; + a[j1 - 2] = x0r - x2r; + a[j1 - 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2 - 2] = wk1r * x0r - wk1i * x0i; + a[j2 - 1] = wk1r * x0i + wk1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3 - 2] = wk3r * x0r + wk3i * x0i; + a[j3 - 1] = wk3r * x0i - wk3i * x0r; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wn4r * (x0r - x0i); + a[j2 + 1] = wn4r * (x0i + x0r); + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = -wn4r * (x0r + x0i); + a[j3 + 1] = -wn4r * (x0i - x0r); + x0r = a[j0 + 2] + a[j2 + 2]; + x0i = a[j0 + 3] + a[j2 + 3]; + x1r = a[j0 + 2] - a[j2 + 2]; + x1i = a[j0 + 3] - a[j2 + 3]; + x2r = a[j1 + 2] + a[j3 + 2]; + x2i = a[j1 + 3] + a[j3 + 3]; + x3r = a[j1 + 2] - a[j3 + 2]; + x3i = a[j1 + 3] - a[j3 + 3]; + a[j0 + 2] = x0r + x2r; + a[j0 + 3] = x0i + x2i; + a[j1 + 2] = x0r - x2r; + a[j1 + 3] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2 + 2] = wk1i * x0r - wk1r * x0i; + a[j2 + 3] = wk1i * x0i + wk1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3 + 2] = wk3i * x0r + wk3r * x0i; + a[j3 + 3] = wk3i * x0i - wk3r * x0r; +} + + +void cftb1st(int n, double *a, double *w) +{ + int j, j0, j1, j2, j3, k, m, mh; + double wn4r, csc1, csc3, wk1r, wk1i, wk3r, wk3i, + wd1r, wd1i, wd3r, wd3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i; + + mh = n >> 3; + m = 2 * mh; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] + a[j2]; + x0i = -a[1] - a[j2 + 1]; + x1r = a[0] - a[j2]; + x1i = -a[1] + a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[0] = x0r + x2r; + a[1] = x0i - x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + a[j2] = x1r + x3i; + a[j2 + 1] = x1i + x3r; + a[j3] = x1r - x3i; + a[j3 + 1] = x1i - x3r; + wn4r = w[1]; + csc1 = w[2]; + csc3 = w[3]; + wd1r = 1; + wd1i = 0; + wd3r = 1; + wd3i = 0; + k = 0; + for (j = 2; j < mh - 2; j += 4) { + k += 4; + wk1r = csc1 * (wd1r + w[k]); + wk1i = csc1 * (wd1i + w[k + 1]); + wk3r = csc3 * (wd3r + w[k + 2]); + wk3i = csc3 * (wd3i + w[k + 3]); + wd1r = w[k]; + wd1i = w[k + 1]; + wd3r = w[k + 2]; + wd3i = w[k + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] + a[j2]; + x0i = -a[j + 1] - a[j2 + 1]; + x1r = a[j] - a[j2]; + x1i = -a[j + 1] + a[j2 + 1]; + y0r = a[j + 2] + a[j2 + 2]; + y0i = -a[j + 3] - a[j2 + 3]; + y1r = a[j + 2] - a[j2 + 2]; + y1i = -a[j + 3] + a[j2 + 3]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 + 2] + a[j3 + 2]; + y2i = a[j1 + 3] + a[j3 + 3]; + y3r = a[j1 + 2] - a[j3 + 2]; + y3i = a[j1 + 3] - a[j3 + 3]; + a[j] = x0r + x2r; + a[j + 1] = x0i - x2i; + a[j + 2] = y0r + y2r; + a[j + 3] = y0i - y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + a[j1 + 2] = y0r - y2r; + a[j1 + 3] = y0i + y2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2] = wk1r * x0r - wk1i * x0i; + a[j2 + 1] = wk1r * x0i + wk1i * x0r; + x0r = y1r + y3i; + x0i = y1i + y3r; + a[j2 + 2] = wd1r * x0r - wd1i * x0i; + a[j2 + 3] = wd1r * x0i + wd1i * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3] = wk3r * x0r + wk3i * x0i; + a[j3 + 1] = wk3r * x0i - wk3i * x0r; + x0r = y1r - y3i; + x0i = y1i - y3r; + a[j3 + 2] = wd3r * x0r + wd3i * x0i; + a[j3 + 3] = wd3r * x0i - wd3i * x0r; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = -a[j0 + 1] - a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = -a[j0 + 1] + a[j2 + 1]; + y0r = a[j0 - 2] + a[j2 - 2]; + y0i = -a[j0 - 1] - a[j2 - 1]; + y1r = a[j0 - 2] - a[j2 - 2]; + y1i = -a[j0 - 1] + a[j2 - 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 - 2] + a[j3 - 2]; + y2i = a[j1 - 1] + a[j3 - 1]; + y3r = a[j1 - 2] - a[j3 - 2]; + y3i = a[j1 - 1] - a[j3 - 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i - x2i; + a[j0 - 2] = y0r + y2r; + a[j0 - 1] = y0i - y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + a[j1 - 2] = y0r - y2r; + a[j1 - 1] = y0i + y2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2] = wk1i * x0r - wk1r * x0i; + a[j2 + 1] = wk1i * x0i + wk1r * x0r; + x0r = y1r + y3i; + x0i = y1i + y3r; + a[j2 - 2] = wd1i * x0r - wd1r * x0i; + a[j2 - 1] = wd1i * x0i + wd1r * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3] = wk3i * x0r + wk3r * x0i; + a[j3 + 1] = wk3i * x0i - wk3r * x0r; + x0r = y1r - y3i; + x0i = y1i - y3r; + a[j3 - 2] = wd3i * x0r + wd3r * x0i; + a[j3 - 1] = wd3i * x0i - wd3r * x0r; + } + wk1r = csc1 * (wd1r + wn4r); + wk1i = csc1 * (wd1i + wn4r); + wk3r = csc3 * (wd3r - wn4r); + wk3i = csc3 * (wd3i - wn4r); + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0 - 2] + a[j2 - 2]; + x0i = -a[j0 - 1] - a[j2 - 1]; + x1r = a[j0 - 2] - a[j2 - 2]; + x1i = -a[j0 - 1] + a[j2 - 1]; + x2r = a[j1 - 2] + a[j3 - 2]; + x2i = a[j1 - 1] + a[j3 - 1]; + x3r = a[j1 - 2] - a[j3 - 2]; + x3i = a[j1 - 1] - a[j3 - 1]; + a[j0 - 2] = x0r + x2r; + a[j0 - 1] = x0i - x2i; + a[j1 - 2] = x0r - x2r; + a[j1 - 1] = x0i + x2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2 - 2] = wk1r * x0r - wk1i * x0i; + a[j2 - 1] = wk1r * x0i + wk1i * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3 - 2] = wk3r * x0r + wk3i * x0i; + a[j3 - 1] = wk3r * x0i - wk3i * x0r; + x0r = a[j0] + a[j2]; + x0i = -a[j0 + 1] - a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = -a[j0 + 1] + a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i - x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2] = wn4r * (x0r - x0i); + a[j2 + 1] = wn4r * (x0i + x0r); + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3] = -wn4r * (x0r + x0i); + a[j3 + 1] = -wn4r * (x0i - x0r); + x0r = a[j0 + 2] + a[j2 + 2]; + x0i = -a[j0 + 3] - a[j2 + 3]; + x1r = a[j0 + 2] - a[j2 + 2]; + x1i = -a[j0 + 3] + a[j2 + 3]; + x2r = a[j1 + 2] + a[j3 + 2]; + x2i = a[j1 + 3] + a[j3 + 3]; + x3r = a[j1 + 2] - a[j3 + 2]; + x3i = a[j1 + 3] - a[j3 + 3]; + a[j0 + 2] = x0r + x2r; + a[j0 + 3] = x0i - x2i; + a[j1 + 2] = x0r - x2r; + a[j1 + 3] = x0i + x2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2 + 2] = wk1i * x0r - wk1r * x0i; + a[j2 + 3] = wk1i * x0i + wk1r * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3 + 2] = wk3i * x0r + wk3r * x0i; + a[j3 + 3] = wk3i * x0i - wk3r * x0r; +} + + +#ifdef USE_CDFT_THREADS +struct cdft_arg_st { + int n0; + int n; + double *a; + int nw; + double *w; +}; +typedef struct cdft_arg_st cdft_arg_t; + + +void cftrec4_th(int n, double *a, int nw, double *w) +{ + void *cftrec1_th(void *p); + void *cftrec2_th(void *p); + int i, idiv4, m, nthread; + cdft_thread_t th[4]; + cdft_arg_t ag[4]; + + nthread = 2; + idiv4 = 0; + m = n >> 1; + if (n > CDFT_4THREADS_BEGIN_N) { + nthread = 4; + idiv4 = 1; + m >>= 1; + } + for (i = 0; i < nthread; i++) { + ag[i].n0 = n; + ag[i].n = m; + ag[i].a = &a[i * m]; + ag[i].nw = nw; + ag[i].w = w; + if (i != idiv4) { + cdft_thread_create(&th[i], cftrec1_th, &ag[i]); + } else { + cdft_thread_create(&th[i], cftrec2_th, &ag[i]); + } + } + for (i = 0; i < nthread; i++) { + cdft_thread_wait(th[i]); + } +} + + +void *cftrec1_th(void *p) +{ + int cfttree(int n, int j, int k, double *a, int nw, double *w); + void cftleaf(int n, int isplt, double *a, int nw, double *w); + void cftmdl1(int n, double *a, double *w); + int isplt, j, k, m, n, n0, nw; + double *a, *w; + + n0 = ((cdft_arg_t *) p)->n0; + n = ((cdft_arg_t *) p)->n; + a = ((cdft_arg_t *) p)->a; + nw = ((cdft_arg_t *) p)->nw; + w = ((cdft_arg_t *) p)->w; + m = n0; + while (m > 512) { + m >>= 2; + cftmdl1(m, &a[n - m], &w[nw - (m >> 1)]); + } + cftleaf(m, 1, &a[n - m], nw, w); + k = 0; + for (j = n - m; j > 0; j -= m) { + k++; + isplt = cfttree(m, j, k, a, nw, w); + cftleaf(m, isplt, &a[j - m], nw, w); + } + return (void *) 0; +} + + +void *cftrec2_th(void *p) +{ + int cfttree(int n, int j, int k, double *a, int nw, double *w); + void cftleaf(int n, int isplt, double *a, int nw, double *w); + void cftmdl2(int n, double *a, double *w); + int isplt, j, k, m, n, n0, nw; + double *a, *w; + + n0 = ((cdft_arg_t *) p)->n0; + n = ((cdft_arg_t *) p)->n; + a = ((cdft_arg_t *) p)->a; + nw = ((cdft_arg_t *) p)->nw; + w = ((cdft_arg_t *) p)->w; + k = 1; + m = n0; + while (m > 512) { + m >>= 2; + k <<= 2; + cftmdl2(m, &a[n - m], &w[nw - m]); + } + cftleaf(m, 0, &a[n - m], nw, w); + k >>= 1; + for (j = n - m; j > 0; j -= m) { + k++; + isplt = cfttree(m, j, k, a, nw, w); + cftleaf(m, isplt, &a[j - m], nw, w); + } + return (void *) 0; +} +#endif /* USE_CDFT_THREADS */ + + +void cftrec4(int n, double *a, int nw, double *w) +{ + int cfttree(int n, int j, int k, double *a, int nw, double *w); + void cftleaf(int n, int isplt, double *a, int nw, double *w); + void cftmdl1(int n, double *a, double *w); + int isplt, j, k, m; + + m = n; + while (m > 512) { + m >>= 2; + cftmdl1(m, &a[n - m], &w[nw - (m >> 1)]); + } + cftleaf(m, 1, &a[n - m], nw, w); + k = 0; + for (j = n - m; j > 0; j -= m) { + k++; + isplt = cfttree(m, j, k, a, nw, w); + cftleaf(m, isplt, &a[j - m], nw, w); + } +} + + +int cfttree(int n, int j, int k, double *a, int nw, double *w) +{ + void cftmdl1(int n, double *a, double *w); + void cftmdl2(int n, double *a, double *w); + int i, isplt, m; + + if ((k & 3) != 0) { + isplt = k & 1; + if (isplt != 0) { + cftmdl1(n, &a[j - n], &w[nw - (n >> 1)]); + } else { + cftmdl2(n, &a[j - n], &w[nw - n]); + } + } else { + m = n; + for (i = k; (i & 3) == 0; i >>= 2) { + m <<= 2; + } + isplt = i & 1; + if (isplt != 0) { + while (m > 128) { + cftmdl1(m, &a[j - m], &w[nw - (m >> 1)]); + m >>= 2; + } + } else { + while (m > 128) { + cftmdl2(m, &a[j - m], &w[nw - m]); + m >>= 2; + } + } + } + return isplt; +} + + +void cftleaf(int n, int isplt, double *a, int nw, double *w) +{ + void cftmdl1(int n, double *a, double *w); + void cftmdl2(int n, double *a, double *w); + void cftf161(double *a, double *w); + void cftf162(double *a, double *w); + void cftf081(double *a, double *w); + void cftf082(double *a, double *w); + + if (n == 512) { + cftmdl1(128, a, &w[nw - 64]); + cftf161(a, &w[nw - 8]); + cftf162(&a[32], &w[nw - 32]); + cftf161(&a[64], &w[nw - 8]); + cftf161(&a[96], &w[nw - 8]); + cftmdl2(128, &a[128], &w[nw - 128]); + cftf161(&a[128], &w[nw - 8]); + cftf162(&a[160], &w[nw - 32]); + cftf161(&a[192], &w[nw - 8]); + cftf162(&a[224], &w[nw - 32]); + cftmdl1(128, &a[256], &w[nw - 64]); + cftf161(&a[256], &w[nw - 8]); + cftf162(&a[288], &w[nw - 32]); + cftf161(&a[320], &w[nw - 8]); + cftf161(&a[352], &w[nw - 8]); + if (isplt != 0) { + cftmdl1(128, &a[384], &w[nw - 64]); + cftf161(&a[480], &w[nw - 8]); + } else { + cftmdl2(128, &a[384], &w[nw - 128]); + cftf162(&a[480], &w[nw - 32]); + } + cftf161(&a[384], &w[nw - 8]); + cftf162(&a[416], &w[nw - 32]); + cftf161(&a[448], &w[nw - 8]); + } else { + cftmdl1(64, a, &w[nw - 32]); + cftf081(a, &w[nw - 8]); + cftf082(&a[16], &w[nw - 8]); + cftf081(&a[32], &w[nw - 8]); + cftf081(&a[48], &w[nw - 8]); + cftmdl2(64, &a[64], &w[nw - 64]); + cftf081(&a[64], &w[nw - 8]); + cftf082(&a[80], &w[nw - 8]); + cftf081(&a[96], &w[nw - 8]); + cftf082(&a[112], &w[nw - 8]); + cftmdl1(64, &a[128], &w[nw - 32]); + cftf081(&a[128], &w[nw - 8]); + cftf082(&a[144], &w[nw - 8]); + cftf081(&a[160], &w[nw - 8]); + cftf081(&a[176], &w[nw - 8]); + if (isplt != 0) { + cftmdl1(64, &a[192], &w[nw - 32]); + cftf081(&a[240], &w[nw - 8]); + } else { + cftmdl2(64, &a[192], &w[nw - 64]); + cftf082(&a[240], &w[nw - 8]); + } + cftf081(&a[192], &w[nw - 8]); + cftf082(&a[208], &w[nw - 8]); + cftf081(&a[224], &w[nw - 8]); + } +} + + +void cftmdl1(int n, double *a, double *w) +{ + int j, j0, j1, j2, j3, k, m, mh; + double wn4r, wk1r, wk1i, wk3r, wk3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; + + mh = n >> 3; + m = 2 * mh; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] + a[j2]; + x0i = a[1] + a[j2 + 1]; + x1r = a[0] - a[j2]; + x1i = a[1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j2] = x1r - x3i; + a[j2 + 1] = x1i + x3r; + a[j3] = x1r + x3i; + a[j3 + 1] = x1i - x3r; + wn4r = w[1]; + k = 0; + for (j = 2; j < mh; j += 2) { + k += 4; + wk1r = w[k]; + wk1i = w[k + 1]; + wk3r = w[k + 2]; + wk3i = w[k + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] + a[j2]; + x0i = a[j + 1] + a[j2 + 1]; + x1r = a[j] - a[j2]; + x1i = a[j + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j] = x0r + x2r; + a[j + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1r * x0r - wk1i * x0i; + a[j2 + 1] = wk1r * x0i + wk1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3r * x0r + wk3i * x0i; + a[j3 + 1] = wk3r * x0i - wk3i * x0r; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1i * x0r - wk1r * x0i; + a[j2 + 1] = wk1i * x0i + wk1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3i * x0r + wk3r * x0i; + a[j3 + 1] = wk3i * x0i - wk3r * x0r; + } + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wn4r * (x0r - x0i); + a[j2 + 1] = wn4r * (x0i + x0r); + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = -wn4r * (x0r + x0i); + a[j3 + 1] = -wn4r * (x0i - x0r); +} + + +void cftmdl2(int n, double *a, double *w) +{ + int j, j0, j1, j2, j3, k, kr, m, mh; + double wn4r, wk1r, wk1i, wk3r, wk3i, wd1r, wd1i, wd3r, wd3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, y0r, y0i, y2r, y2i; + + mh = n >> 3; + m = 2 * mh; + wn4r = w[1]; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] - a[j2 + 1]; + x0i = a[1] + a[j2]; + x1r = a[0] + a[j2 + 1]; + x1i = a[1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wn4r * (x2r - x2i); + y0i = wn4r * (x2i + x2r); + a[0] = x0r + y0r; + a[1] = x0i + y0i; + a[j1] = x0r - y0r; + a[j1 + 1] = x0i - y0i; + y0r = wn4r * (x3r - x3i); + y0i = wn4r * (x3i + x3r); + a[j2] = x1r - y0i; + a[j2 + 1] = x1i + y0r; + a[j3] = x1r + y0i; + a[j3 + 1] = x1i - y0r; + k = 0; + kr = 2 * m; + for (j = 2; j < mh; j += 2) { + k += 4; + wk1r = w[k]; + wk1i = w[k + 1]; + wk3r = w[k + 2]; + wk3i = w[k + 3]; + kr -= 4; + wd1i = w[kr]; + wd1r = w[kr + 1]; + wd3i = w[kr + 2]; + wd3r = w[kr + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] - a[j2 + 1]; + x0i = a[j + 1] + a[j2]; + x1r = a[j] + a[j2 + 1]; + x1i = a[j + 1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wk1r * x0r - wk1i * x0i; + y0i = wk1r * x0i + wk1i * x0r; + y2r = wd1r * x2r - wd1i * x2i; + y2i = wd1r * x2i + wd1i * x2r; + a[j] = y0r + y2r; + a[j + 1] = y0i + y2i; + a[j1] = y0r - y2r; + a[j1 + 1] = y0i - y2i; + y0r = wk3r * x1r + wk3i * x1i; + y0i = wk3r * x1i - wk3i * x1r; + y2r = wd3r * x3r + wd3i * x3i; + y2i = wd3r * x3i - wd3i * x3r; + a[j2] = y0r + y2r; + a[j2 + 1] = y0i + y2i; + a[j3] = y0r - y2r; + a[j3 + 1] = y0i - y2i; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] - a[j2 + 1]; + x0i = a[j0 + 1] + a[j2]; + x1r = a[j0] + a[j2 + 1]; + x1i = a[j0 + 1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wd1i * x0r - wd1r * x0i; + y0i = wd1i * x0i + wd1r * x0r; + y2r = wk1i * x2r - wk1r * x2i; + y2i = wk1i * x2i + wk1r * x2r; + a[j0] = y0r + y2r; + a[j0 + 1] = y0i + y2i; + a[j1] = y0r - y2r; + a[j1 + 1] = y0i - y2i; + y0r = wd3i * x1r + wd3r * x1i; + y0i = wd3i * x1i - wd3r * x1r; + y2r = wk3i * x3r + wk3r * x3i; + y2i = wk3i * x3i - wk3r * x3r; + a[j2] = y0r + y2r; + a[j2 + 1] = y0i + y2i; + a[j3] = y0r - y2r; + a[j3 + 1] = y0i - y2i; + } + wk1r = w[m]; + wk1i = w[m + 1]; + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] - a[j2 + 1]; + x0i = a[j0 + 1] + a[j2]; + x1r = a[j0] + a[j2 + 1]; + x1i = a[j0 + 1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wk1r * x0r - wk1i * x0i; + y0i = wk1r * x0i + wk1i * x0r; + y2r = wk1i * x2r - wk1r * x2i; + y2i = wk1i * x2i + wk1r * x2r; + a[j0] = y0r + y2r; + a[j0 + 1] = y0i + y2i; + a[j1] = y0r - y2r; + a[j1 + 1] = y0i - y2i; + y0r = wk1i * x1r - wk1r * x1i; + y0i = wk1i * x1i + wk1r * x1r; + y2r = wk1r * x3r - wk1i * x3i; + y2i = wk1r * x3i + wk1i * x3r; + a[j2] = y0r - y2r; + a[j2 + 1] = y0i - y2i; + a[j3] = y0r + y2r; + a[j3 + 1] = y0i + y2i; +} + + +void cftfx41(int n, double *a, int nw, double *w) +{ + void cftf161(double *a, double *w); + void cftf162(double *a, double *w); + void cftf081(double *a, double *w); + void cftf082(double *a, double *w); + + if (n == 128) { + cftf161(a, &w[nw - 8]); + cftf162(&a[32], &w[nw - 32]); + cftf161(&a[64], &w[nw - 8]); + cftf161(&a[96], &w[nw - 8]); + } else { + cftf081(a, &w[nw - 8]); + cftf082(&a[16], &w[nw - 8]); + cftf081(&a[32], &w[nw - 8]); + cftf081(&a[48], &w[nw - 8]); + } +} + + +void cftf161(double *a, double *w) +{ + double wn4r, wk1r, wk1i, + x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i, + y8r, y8i, y9r, y9i, y10r, y10i, y11r, y11i, + y12r, y12i, y13r, y13i, y14r, y14i, y15r, y15i; + + wn4r = w[1]; + wk1r = w[2]; + wk1i = w[3]; + x0r = a[0] + a[16]; + x0i = a[1] + a[17]; + x1r = a[0] - a[16]; + x1i = a[1] - a[17]; + x2r = a[8] + a[24]; + x2i = a[9] + a[25]; + x3r = a[8] - a[24]; + x3i = a[9] - a[25]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y4r = x0r - x2r; + y4i = x0i - x2i; + y8r = x1r - x3i; + y8i = x1i + x3r; + y12r = x1r + x3i; + y12i = x1i - x3r; + x0r = a[2] + a[18]; + x0i = a[3] + a[19]; + x1r = a[2] - a[18]; + x1i = a[3] - a[19]; + x2r = a[10] + a[26]; + x2i = a[11] + a[27]; + x3r = a[10] - a[26]; + x3i = a[11] - a[27]; + y1r = x0r + x2r; + y1i = x0i + x2i; + y5r = x0r - x2r; + y5i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + y9r = wk1r * x0r - wk1i * x0i; + y9i = wk1r * x0i + wk1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + y13r = wk1i * x0r - wk1r * x0i; + y13i = wk1i * x0i + wk1r * x0r; + x0r = a[4] + a[20]; + x0i = a[5] + a[21]; + x1r = a[4] - a[20]; + x1i = a[5] - a[21]; + x2r = a[12] + a[28]; + x2i = a[13] + a[29]; + x3r = a[12] - a[28]; + x3i = a[13] - a[29]; + y2r = x0r + x2r; + y2i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + y10r = wn4r * (x0r - x0i); + y10i = wn4r * (x0i + x0r); + x0r = x1r + x3i; + x0i = x1i - x3r; + y14r = wn4r * (x0r + x0i); + y14i = wn4r * (x0i - x0r); + x0r = a[6] + a[22]; + x0i = a[7] + a[23]; + x1r = a[6] - a[22]; + x1i = a[7] - a[23]; + x2r = a[14] + a[30]; + x2i = a[15] + a[31]; + x3r = a[14] - a[30]; + x3i = a[15] - a[31]; + y3r = x0r + x2r; + y3i = x0i + x2i; + y7r = x0r - x2r; + y7i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + y11r = wk1i * x0r - wk1r * x0i; + y11i = wk1i * x0i + wk1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + y15r = wk1r * x0r - wk1i * x0i; + y15i = wk1r * x0i + wk1i * x0r; + x0r = y12r - y14r; + x0i = y12i - y14i; + x1r = y12r + y14r; + x1i = y12i + y14i; + x2r = y13r - y15r; + x2i = y13i - y15i; + x3r = y13r + y15r; + x3i = y13i + y15i; + a[24] = x0r + x2r; + a[25] = x0i + x2i; + a[26] = x0r - x2r; + a[27] = x0i - x2i; + a[28] = x1r - x3i; + a[29] = x1i + x3r; + a[30] = x1r + x3i; + a[31] = x1i - x3r; + x0r = y8r + y10r; + x0i = y8i + y10i; + x1r = y8r - y10r; + x1i = y8i - y10i; + x2r = y9r + y11r; + x2i = y9i + y11i; + x3r = y9r - y11r; + x3i = y9i - y11i; + a[16] = x0r + x2r; + a[17] = x0i + x2i; + a[18] = x0r - x2r; + a[19] = x0i - x2i; + a[20] = x1r - x3i; + a[21] = x1i + x3r; + a[22] = x1r + x3i; + a[23] = x1i - x3r; + x0r = y5r - y7i; + x0i = y5i + y7r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + x0r = y5r + y7i; + x0i = y5i - y7r; + x3r = wn4r * (x0r - x0i); + x3i = wn4r * (x0i + x0r); + x0r = y4r - y6i; + x0i = y4i + y6r; + x1r = y4r + y6i; + x1i = y4i - y6r; + a[8] = x0r + x2r; + a[9] = x0i + x2i; + a[10] = x0r - x2r; + a[11] = x0i - x2i; + a[12] = x1r - x3i; + a[13] = x1i + x3r; + a[14] = x1r + x3i; + a[15] = x1i - x3r; + x0r = y0r + y2r; + x0i = y0i + y2i; + x1r = y0r - y2r; + x1i = y0i - y2i; + x2r = y1r + y3r; + x2i = y1i + y3i; + x3r = y1r - y3r; + x3i = y1i - y3i; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[2] = x0r - x2r; + a[3] = x0i - x2i; + a[4] = x1r - x3i; + a[5] = x1i + x3r; + a[6] = x1r + x3i; + a[7] = x1i - x3r; +} + + +void cftf162(double *a, double *w) +{ + double wn4r, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, + x0r, x0i, x1r, x1i, x2r, x2i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i, + y8r, y8i, y9r, y9i, y10r, y10i, y11r, y11i, + y12r, y12i, y13r, y13i, y14r, y14i, y15r, y15i; + + wn4r = w[1]; + wk1r = w[4]; + wk1i = w[5]; + wk3r = w[6]; + wk3i = -w[7]; + wk2r = w[8]; + wk2i = w[9]; + x1r = a[0] - a[17]; + x1i = a[1] + a[16]; + x0r = a[8] - a[25]; + x0i = a[9] + a[24]; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + y0r = x1r + x2r; + y0i = x1i + x2i; + y4r = x1r - x2r; + y4i = x1i - x2i; + x1r = a[0] + a[17]; + x1i = a[1] - a[16]; + x0r = a[8] + a[25]; + x0i = a[9] - a[24]; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + y8r = x1r - x2i; + y8i = x1i + x2r; + y12r = x1r + x2i; + y12i = x1i - x2r; + x0r = a[2] - a[19]; + x0i = a[3] + a[18]; + x1r = wk1r * x0r - wk1i * x0i; + x1i = wk1r * x0i + wk1i * x0r; + x0r = a[10] - a[27]; + x0i = a[11] + a[26]; + x2r = wk3i * x0r - wk3r * x0i; + x2i = wk3i * x0i + wk3r * x0r; + y1r = x1r + x2r; + y1i = x1i + x2i; + y5r = x1r - x2r; + y5i = x1i - x2i; + x0r = a[2] + a[19]; + x0i = a[3] - a[18]; + x1r = wk3r * x0r - wk3i * x0i; + x1i = wk3r * x0i + wk3i * x0r; + x0r = a[10] + a[27]; + x0i = a[11] - a[26]; + x2r = wk1r * x0r + wk1i * x0i; + x2i = wk1r * x0i - wk1i * x0r; + y9r = x1r - x2r; + y9i = x1i - x2i; + y13r = x1r + x2r; + y13i = x1i + x2i; + x0r = a[4] - a[21]; + x0i = a[5] + a[20]; + x1r = wk2r * x0r - wk2i * x0i; + x1i = wk2r * x0i + wk2i * x0r; + x0r = a[12] - a[29]; + x0i = a[13] + a[28]; + x2r = wk2i * x0r - wk2r * x0i; + x2i = wk2i * x0i + wk2r * x0r; + y2r = x1r + x2r; + y2i = x1i + x2i; + y6r = x1r - x2r; + y6i = x1i - x2i; + x0r = a[4] + a[21]; + x0i = a[5] - a[20]; + x1r = wk2i * x0r - wk2r * x0i; + x1i = wk2i * x0i + wk2r * x0r; + x0r = a[12] + a[29]; + x0i = a[13] - a[28]; + x2r = wk2r * x0r - wk2i * x0i; + x2i = wk2r * x0i + wk2i * x0r; + y10r = x1r - x2r; + y10i = x1i - x2i; + y14r = x1r + x2r; + y14i = x1i + x2i; + x0r = a[6] - a[23]; + x0i = a[7] + a[22]; + x1r = wk3r * x0r - wk3i * x0i; + x1i = wk3r * x0i + wk3i * x0r; + x0r = a[14] - a[31]; + x0i = a[15] + a[30]; + x2r = wk1i * x0r - wk1r * x0i; + x2i = wk1i * x0i + wk1r * x0r; + y3r = x1r + x2r; + y3i = x1i + x2i; + y7r = x1r - x2r; + y7i = x1i - x2i; + x0r = a[6] + a[23]; + x0i = a[7] - a[22]; + x1r = wk1i * x0r + wk1r * x0i; + x1i = wk1i * x0i - wk1r * x0r; + x0r = a[14] + a[31]; + x0i = a[15] - a[30]; + x2r = wk3i * x0r - wk3r * x0i; + x2i = wk3i * x0i + wk3r * x0r; + y11r = x1r + x2r; + y11i = x1i + x2i; + y15r = x1r - x2r; + y15i = x1i - x2i; + x1r = y0r + y2r; + x1i = y0i + y2i; + x2r = y1r + y3r; + x2i = y1i + y3i; + a[0] = x1r + x2r; + a[1] = x1i + x2i; + a[2] = x1r - x2r; + a[3] = x1i - x2i; + x1r = y0r - y2r; + x1i = y0i - y2i; + x2r = y1r - y3r; + x2i = y1i - y3i; + a[4] = x1r - x2i; + a[5] = x1i + x2r; + a[6] = x1r + x2i; + a[7] = x1i - x2r; + x1r = y4r - y6i; + x1i = y4i + y6r; + x0r = y5r - y7i; + x0i = y5i + y7r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[8] = x1r + x2r; + a[9] = x1i + x2i; + a[10] = x1r - x2r; + a[11] = x1i - x2i; + x1r = y4r + y6i; + x1i = y4i - y6r; + x0r = y5r + y7i; + x0i = y5i - y7r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[12] = x1r - x2i; + a[13] = x1i + x2r; + a[14] = x1r + x2i; + a[15] = x1i - x2r; + x1r = y8r + y10r; + x1i = y8i + y10i; + x2r = y9r - y11r; + x2i = y9i - y11i; + a[16] = x1r + x2r; + a[17] = x1i + x2i; + a[18] = x1r - x2r; + a[19] = x1i - x2i; + x1r = y8r - y10r; + x1i = y8i - y10i; + x2r = y9r + y11r; + x2i = y9i + y11i; + a[20] = x1r - x2i; + a[21] = x1i + x2r; + a[22] = x1r + x2i; + a[23] = x1i - x2r; + x1r = y12r - y14i; + x1i = y12i + y14r; + x0r = y13r + y15i; + x0i = y13i - y15r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[24] = x1r + x2r; + a[25] = x1i + x2i; + a[26] = x1r - x2r; + a[27] = x1i - x2i; + x1r = y12r + y14i; + x1i = y12i - y14r; + x0r = y13r - y15i; + x0i = y13i + y15r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[28] = x1r - x2i; + a[29] = x1i + x2r; + a[30] = x1r + x2i; + a[31] = x1i - x2r; +} + + +void cftf081(double *a, double *w) +{ + double wn4r, x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; + + wn4r = w[1]; + x0r = a[0] + a[8]; + x0i = a[1] + a[9]; + x1r = a[0] - a[8]; + x1i = a[1] - a[9]; + x2r = a[4] + a[12]; + x2i = a[5] + a[13]; + x3r = a[4] - a[12]; + x3i = a[5] - a[13]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[2] + a[10]; + x0i = a[3] + a[11]; + x1r = a[2] - a[10]; + x1i = a[3] - a[11]; + x2r = a[6] + a[14]; + x2i = a[7] + a[15]; + x3r = a[6] - a[14]; + x3i = a[7] - a[15]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x1i - x3r; + y5r = wn4r * (x0r - x0i); + y5i = wn4r * (x0r + x0i); + y7r = wn4r * (x2r - x2i); + y7i = wn4r * (x2r + x2i); + a[8] = y1r + y5r; + a[9] = y1i + y5i; + a[10] = y1r - y5r; + a[11] = y1i - y5i; + a[12] = y3r - y7i; + a[13] = y3i + y7r; + a[14] = y3r + y7i; + a[15] = y3i - y7r; + a[0] = y0r + y4r; + a[1] = y0i + y4i; + a[2] = y0r - y4r; + a[3] = y0i - y4i; + a[4] = y2r - y6i; + a[5] = y2i + y6r; + a[6] = y2r + y6i; + a[7] = y2i - y6r; +} + + +void cftf082(double *a, double *w) +{ + double wn4r, wk1r, wk1i, x0r, x0i, x1r, x1i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; + + wn4r = w[1]; + wk1r = w[2]; + wk1i = w[3]; + y0r = a[0] - a[9]; + y0i = a[1] + a[8]; + y1r = a[0] + a[9]; + y1i = a[1] - a[8]; + x0r = a[4] - a[13]; + x0i = a[5] + a[12]; + y2r = wn4r * (x0r - x0i); + y2i = wn4r * (x0i + x0r); + x0r = a[4] + a[13]; + x0i = a[5] - a[12]; + y3r = wn4r * (x0r - x0i); + y3i = wn4r * (x0i + x0r); + x0r = a[2] - a[11]; + x0i = a[3] + a[10]; + y4r = wk1r * x0r - wk1i * x0i; + y4i = wk1r * x0i + wk1i * x0r; + x0r = a[2] + a[11]; + x0i = a[3] - a[10]; + y5r = wk1i * x0r - wk1r * x0i; + y5i = wk1i * x0i + wk1r * x0r; + x0r = a[6] - a[15]; + x0i = a[7] + a[14]; + y6r = wk1i * x0r - wk1r * x0i; + y6i = wk1i * x0i + wk1r * x0r; + x0r = a[6] + a[15]; + x0i = a[7] - a[14]; + y7r = wk1r * x0r - wk1i * x0i; + y7i = wk1r * x0i + wk1i * x0r; + x0r = y0r + y2r; + x0i = y0i + y2i; + x1r = y4r + y6r; + x1i = y4i + y6i; + a[0] = x0r + x1r; + a[1] = x0i + x1i; + a[2] = x0r - x1r; + a[3] = x0i - x1i; + x0r = y0r - y2r; + x0i = y0i - y2i; + x1r = y4r - y6r; + x1i = y4i - y6i; + a[4] = x0r - x1i; + a[5] = x0i + x1r; + a[6] = x0r + x1i; + a[7] = x0i - x1r; + x0r = y1r - y3i; + x0i = y1i + y3r; + x1r = y5r - y7r; + x1i = y5i - y7i; + a[8] = x0r + x1r; + a[9] = x0i + x1i; + a[10] = x0r - x1r; + a[11] = x0i - x1i; + x0r = y1r + y3i; + x0i = y1i - y3r; + x1r = y5r + y7r; + x1i = y5i + y7i; + a[12] = x0r - x1i; + a[13] = x0i + x1r; + a[14] = x0r + x1i; + a[15] = x0i - x1r; +} + + +void cftf040(double *a) +{ + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; + + x0r = a[0] + a[4]; + x0i = a[1] + a[5]; + x1r = a[0] - a[4]; + x1i = a[1] - a[5]; + x2r = a[2] + a[6]; + x2i = a[3] + a[7]; + x3r = a[2] - a[6]; + x3i = a[3] - a[7]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[2] = x1r - x3i; + a[3] = x1i + x3r; + a[4] = x0r - x2r; + a[5] = x0i - x2i; + a[6] = x1r + x3i; + a[7] = x1i - x3r; +} + + +void cftb040(double *a) +{ + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; + + x0r = a[0] + a[4]; + x0i = a[1] + a[5]; + x1r = a[0] - a[4]; + x1i = a[1] - a[5]; + x2r = a[2] + a[6]; + x2i = a[3] + a[7]; + x3r = a[2] - a[6]; + x3i = a[3] - a[7]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[2] = x1r + x3i; + a[3] = x1i - x3r; + a[4] = x0r - x2r; + a[5] = x0i - x2i; + a[6] = x1r - x3i; + a[7] = x1i + x3r; +} + + +void cftx020(double *a) +{ + double x0r, x0i; + + x0r = a[0] - a[2]; + x0i = a[1] - a[3]; + a[0] += a[2]; + a[1] += a[3]; + a[2] = x0r; + a[3] = x0i; +} + + +void rftfsub(int n, double *a, int nc, double *c) +{ + int j, k, kk, ks, m; + double wkr, wki, xr, xi, yr, yi; + + m = n >> 1; + ks = 2 * nc / m; + kk = 0; + for (j = 2; j < m; j += 2) { + k = n - j; + kk += ks; + wkr = 0.5 - c[nc - kk]; + wki = c[kk]; + xr = a[j] - a[k]; + xi = a[j + 1] + a[k + 1]; + yr = wkr * xr - wki * xi; + yi = wkr * xi + wki * xr; + a[j] -= yr; + a[j + 1] -= yi; + a[k] += yr; + a[k + 1] -= yi; + } +} + + +void rftbsub(int n, double *a, int nc, double *c) +{ + int j, k, kk, ks, m; + double wkr, wki, xr, xi, yr, yi; + + m = n >> 1; + ks = 2 * nc / m; + kk = 0; + for (j = 2; j < m; j += 2) { + k = n - j; + kk += ks; + wkr = 0.5 - c[nc - kk]; + wki = c[kk]; + xr = a[j] - a[k]; + xi = a[j + 1] + a[k + 1]; + yr = wkr * xr + wki * xi; + yi = wkr * xi - wki * xr; + a[j] -= yr; + a[j + 1] -= yi; + a[k] += yr; + a[k + 1] -= yi; + } +} + + diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/log.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/log.cc new file mode 100644 index 0000000..7223337 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/log.cc @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Stack trace related stuff is from kaldi. + * Refer to + * https://github.com/kaldi-asr/kaldi/blob/master/src/base/kaldi-error.cc + */ + +#include "kaldi-native-fbank/csrc/log.h" + +#ifdef KNF_HAVE_EXECINFO_H +#include // To get stack trace in error messages. +#ifdef KNF_HAVE_CXXABI_H +#include // For name demangling. +// Useful to decode the stack trace, but only used if we have execinfo.h +#endif // KNF_HAVE_CXXABI_H +#endif // KNF_HAVE_EXECINFO_H + +#include + +#include +#include +#include + +namespace knf { + +std::string GetDateTimeStr() { + std::ostringstream os; + std::time_t t = std::time(nullptr); + std::tm tm = *std::localtime(&t); + os << std::put_time(&tm, "%F %T"); // yyyy-mm-dd hh:mm:ss + return os.str(); +} + +static bool LocateSymbolRange(const std::string &trace_name, std::size_t *begin, + std::size_t *end) { + // Find the first '_' with leading ' ' or '('. + *begin = std::string::npos; + for (std::size_t i = 1; i < trace_name.size(); ++i) { + if (trace_name[i] != '_') { + continue; + } + if (trace_name[i - 1] == ' ' || trace_name[i - 1] == '(') { + *begin = i; + break; + } + } + if (*begin == std::string::npos) { + return false; + } + *end = trace_name.find_first_of(" +", *begin); + return *end != std::string::npos; +} + +#ifdef KNF_HAVE_EXECINFO_H +static std::string Demangle(const std::string &trace_name) { +#ifndef KNF_HAVE_CXXABI_H + return trace_name; +#else // KNF_HAVE_CXXABI_H + // Try demangle the symbol. We are trying to support the following formats + // produced by different platforms: + // + // Linux: + // ./kaldi-error-test(_ZN5kaldi13UnitTestErrorEv+0xb) [0x804965d] + // + // Mac: + // 0 server 0x000000010f67614d _ZNK5kaldi13MessageLogger10LogMessageEv + 813 + // + // We want to extract the name e.g., '_ZN5kaldi13UnitTestErrorEv' and + // demangle it info a readable name like kaldi::UnitTextError. + std::size_t begin, end; + if (!LocateSymbolRange(trace_name, &begin, &end)) { + return trace_name; + } + std::string symbol = trace_name.substr(begin, end - begin); + int status; + char *demangled_name = abi::__cxa_demangle(symbol.c_str(), 0, 0, &status); + if (status == 0 && demangled_name != nullptr) { + symbol = demangled_name; + free(demangled_name); + } + return trace_name.substr(0, begin) + symbol + + trace_name.substr(end, std::string::npos); +#endif // KNF_HAVE_CXXABI_H +} +#endif // KNF_HAVE_EXECINFO_H + +std::string GetStackTrace() { + std::string ans; +#ifdef KNF_HAVE_EXECINFO_H + constexpr const std::size_t kMaxTraceSize = 50; + constexpr const std::size_t kMaxTracePrint = 50; // Must be even. + // Buffer for the trace. + void *trace[kMaxTraceSize]; + // Get the trace. + std::size_t size = backtrace(trace, kMaxTraceSize); + // Get the trace symbols. + char **trace_symbol = backtrace_symbols(trace, size); + if (trace_symbol == nullptr) return ans; + + // Compose a human-readable backtrace string. + ans += "[ Stack-Trace: ]\n"; + if (size <= kMaxTracePrint) { + for (std::size_t i = 0; i < size; ++i) { + ans += Demangle(trace_symbol[i]) + "\n"; + } + } else { // Print out first+last (e.g.) 5. + for (std::size_t i = 0; i < kMaxTracePrint / 2; ++i) { + ans += Demangle(trace_symbol[i]) + "\n"; + } + ans += ".\n.\n.\n"; + for (std::size_t i = size - kMaxTracePrint / 2; i < size; ++i) { + ans += Demangle(trace_symbol[i]) + "\n"; + } + if (size == kMaxTraceSize) + ans += ".\n.\n.\n"; // Stack was too long, probably a bug. + } + + // We must free the array of pointers allocated by backtrace_symbols(), + // but not the strings themselves. + free(trace_symbol); +#endif // KNF_HAVE_EXECINFO_H + return ans; +} + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/log.h b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/log.h new file mode 100644 index 0000000..bd21cc3 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/log.h @@ -0,0 +1,383 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The content in this file is copied/modified from +// https://github.com/k2-fsa/k2/blob/master/k2/csrc/log.h +#ifndef KALDI_NATIVE_FBANK_CSRC_LOG_H_ +#define KALDI_NATIVE_FBANK_CSRC_LOG_H_ + +#include + +#include // NOLINT +#include +#include + +namespace knf { + +#if KNF_ENABLE_CHECK + +#if defined(NDEBUG) +constexpr bool kDisableDebug = true; +#else +constexpr bool kDisableDebug = false; +#endif + +enum class LogLevel { + kTrace = 0, + kDebug = 1, + kInfo = 2, + kWarning = 3, + kError = 4, + kFatal = 5, // print message and abort the program +}; + +// They are used in KNF_LOG(xxx), so their names +// do not follow the google c++ code style +// +// You can use them in the following way: +// +// KNF_LOG(TRACE) << "some message"; +// KNF_LOG(DEBUG) << "some message"; +#ifndef _MSC_VER +constexpr LogLevel TRACE = LogLevel::kTrace; +constexpr LogLevel DEBUG = LogLevel::kDebug; +constexpr LogLevel INFO = LogLevel::kInfo; +constexpr LogLevel WARNING = LogLevel::kWarning; +constexpr LogLevel ERROR = LogLevel::kError; +constexpr LogLevel FATAL = LogLevel::kFatal; +#else +#define TRACE LogLevel::kTrace +#define DEBUG LogLevel::kDebug +#define INFO LogLevel::kInfo +#define WARNING LogLevel::kWarning +#define ERROR LogLevel::kError +#define FATAL LogLevel::kFatal +#endif + +std::string GetStackTrace(); + +/* Return the current log level. + + + If the current log level is TRACE, then all logged messages are printed out. + + If the current log level is DEBUG, log messages with "TRACE" level are not + shown and all other levels are printed out. + + Similarly, if the current log level is INFO, log message with "TRACE" and + "DEBUG" are not shown and all other levels are printed out. + + If it is FATAL, then only FATAL messages are shown. + */ +inline LogLevel GetCurrentLogLevel() { + static LogLevel log_level = INFO; + static std::once_flag init_flag; + std::call_once(init_flag, []() { + const char *env_log_level = std::getenv("KNF_LOG_LEVEL"); + if (env_log_level == nullptr) return; + + std::string s = env_log_level; + if (s == "TRACE") + log_level = TRACE; + else if (s == "DEBUG") + log_level = DEBUG; + else if (s == "INFO") + log_level = INFO; + else if (s == "WARNING") + log_level = WARNING; + else if (s == "ERROR") + log_level = ERROR; + else if (s == "FATAL") + log_level = FATAL; + else + fprintf(stderr, + "Unknown KNF_LOG_LEVEL: %s" + "\nSupported values are: " + "TRACE, DEBUG, INFO, WARNING, ERROR, FATAL", + s.c_str()); + }); + return log_level; +} + +inline bool EnableAbort() { + static std::once_flag init_flag; + static bool enable_abort = false; + std::call_once(init_flag, []() { + enable_abort = (std::getenv("KNF_ABORT") != nullptr); + }); + return enable_abort; +} + +class Logger { + public: + Logger(const char *filename, const char *func_name, uint32_t line_num, + LogLevel level) + : filename_(filename), + func_name_(func_name), + line_num_(line_num), + level_(level) { + cur_level_ = GetCurrentLogLevel(); + fprintf(stderr, "here\n"); + switch (level) { + case TRACE: + if (cur_level_ <= TRACE) fprintf(stderr, "[T] "); + break; + case DEBUG: + if (cur_level_ <= DEBUG) fprintf(stderr, "[D] "); + break; + case INFO: + if (cur_level_ <= INFO) fprintf(stderr, "[I] "); + break; + case WARNING: + if (cur_level_ <= WARNING) fprintf(stderr, "[W] "); + break; + case ERROR: + if (cur_level_ <= ERROR) fprintf(stderr, "[E] "); + break; + case FATAL: + if (cur_level_ <= FATAL) fprintf(stderr, "[F] "); + break; + } + + if (cur_level_ <= level_) { + fprintf(stderr, "%s:%u:%s ", filename, line_num, func_name); + } + } + + ~Logger() noexcept(false) { + static constexpr const char *kErrMsg = R"( + Some bad things happened. Please read the above error messages and stack + trace. If you are using Python, the following command may be helpful: + + gdb --args python /path/to/your/code.py + + (You can use `gdb` to debug the code. Please consider compiling + a debug version of KNF.). + + If you are unable to fix it, please open an issue at: + + https://github.com/csukuangfj/kaldi-native-fbank/issues/new + )"; + fprintf(stderr, "\n"); + if (level_ == FATAL) { + std::string stack_trace = GetStackTrace(); + if (!stack_trace.empty()) { + fprintf(stderr, "\n\n%s\n", stack_trace.c_str()); + } + + fflush(nullptr); + +#ifndef __ANDROID_API__ + if (EnableAbort()) { + // NOTE: abort() will terminate the program immediately without + // printing the Python stack backtrace. + abort(); + } + + throw std::runtime_error(kErrMsg); +#else + abort(); +#endif + } + } + + const Logger &operator<<(bool b) const { + if (cur_level_ <= level_) { + fprintf(stderr, b ? "true" : "false"); + } + return *this; + } + + const Logger &operator<<(int8_t i) const { + if (cur_level_ <= level_) fprintf(stderr, "%d", i); + return *this; + } + + const Logger &operator<<(const char *s) const { + if (cur_level_ <= level_) fprintf(stderr, "%s", s); + return *this; + } + + const Logger &operator<<(int32_t i) const { + if (cur_level_ <= level_) fprintf(stderr, "%d", i); + return *this; + } + + const Logger &operator<<(uint32_t i) const { + if (cur_level_ <= level_) fprintf(stderr, "%u", i); + return *this; + } + + const Logger &operator<<(uint64_t i) const { + if (cur_level_ <= level_) + fprintf(stderr, "%llu", (long long unsigned int)i); // NOLINT + return *this; + } + + const Logger &operator<<(int64_t i) const { + if (cur_level_ <= level_) + fprintf(stderr, "%lli", (long long int)i); // NOLINT + return *this; + } + + const Logger &operator<<(float f) const { + if (cur_level_ <= level_) fprintf(stderr, "%f", f); + return *this; + } + + const Logger &operator<<(double d) const { + if (cur_level_ <= level_) fprintf(stderr, "%f", d); + return *this; + } + + template + const Logger &operator<<(const T &t) const { + // require T overloads operator<< + std::ostringstream os; + os << t; + return *this << os.str().c_str(); + } + + // specialization to fix compile error: `stringstream << nullptr` is ambiguous + const Logger &operator<<(const std::nullptr_t &null) const { + if (cur_level_ <= level_) *this << "(null)"; + return *this; + } + + private: + const char *filename_; + const char *func_name_; + uint32_t line_num_; + LogLevel level_; + LogLevel cur_level_; +}; +#endif // KNF_ENABLE_CHECK + +class Voidifier { + public: +#if KNF_ENABLE_CHECK + void operator&(const Logger &) const {} +#endif +}; +#if !defined(KNF_ENABLE_CHECK) +template +const Voidifier &operator<<(const Voidifier &v, T &&) { + return v; +} +#endif + +} // namespace knf + +#define KNF_STATIC_ASSERT(x) static_assert(x, "") + +#ifdef KNF_ENABLE_CHECK + +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || \ + defined(__PRETTY_FUNCTION__) +// for clang and GCC +#define KNF_FUNC __PRETTY_FUNCTION__ +#else +// for other compilers +#define KNF_FUNC __func__ +#endif + +#define KNF_CHECK(x) \ + (x) ? (void)0 \ + : ::knf::Voidifier() & \ + ::knf::Logger(__FILE__, KNF_FUNC, __LINE__, ::knf::FATAL) \ + << "Check failed: " << #x << " " + +// WARNING: x and y may be evaluated multiple times, but this happens only +// when the check fails. Since the program aborts if it fails, we don't think +// the extra evaluation of x and y matters. +// +// CAUTION: we recommend the following use case: +// +// auto x = Foo(); +// auto y = Bar(); +// KNF_CHECK_EQ(x, y) << "Some message"; +// +// And please avoid +// +// KNF_CHECK_EQ(Foo(), Bar()); +// +// if `Foo()` or `Bar()` causes some side effects, e.g., changing some +// local static variables or global variables. +#define _KNF_CHECK_OP(x, y, op) \ + ((x)op(y)) ? (void)0 \ + : ::knf::Voidifier() & \ + ::knf::Logger(__FILE__, KNF_FUNC, __LINE__, ::knf::FATAL) \ + << "Check failed: " << #x << " " << #op << " " << #y \ + << " (" << (x) << " vs. " << (y) << ") " + +#define KNF_CHECK_EQ(x, y) _KNF_CHECK_OP(x, y, ==) +#define KNF_CHECK_NE(x, y) _KNF_CHECK_OP(x, y, !=) +#define KNF_CHECK_LT(x, y) _KNF_CHECK_OP(x, y, <) +#define KNF_CHECK_LE(x, y) _KNF_CHECK_OP(x, y, <=) +#define KNF_CHECK_GT(x, y) _KNF_CHECK_OP(x, y, >) +#define KNF_CHECK_GE(x, y) _KNF_CHECK_OP(x, y, >=) + +#define KNF_LOG(x) ::knf::Logger(__FILE__, KNF_FUNC, __LINE__, ::knf::x) + +// ------------------------------------------------------------ +// For debug check +// ------------------------------------------------------------ +// If you define the macro "-D NDEBUG" while compiling kaldi-native-fbank, +// the following macros are in fact empty and does nothing. + +#define KNF_DCHECK(x) ::knf::kDisableDebug ? (void)0 : KNF_CHECK(x) + +#define KNF_DCHECK_EQ(x, y) ::knf::kDisableDebug ? (void)0 : KNF_CHECK_EQ(x, y) + +#define KNF_DCHECK_NE(x, y) ::knf::kDisableDebug ? (void)0 : KNF_CHECK_NE(x, y) + +#define KNF_DCHECK_LT(x, y) ::knf::kDisableDebug ? (void)0 : KNF_CHECK_LT(x, y) + +#define KNF_DCHECK_LE(x, y) ::knf::kDisableDebug ? (void)0 : KNF_CHECK_LE(x, y) + +#define KNF_DCHECK_GT(x, y) ::knf::kDisableDebug ? (void)0 : KNF_CHECK_GT(x, y) + +#define KNF_DCHECK_GE(x, y) ::knf::kDisableDebug ? (void)0 : KNF_CHECK_GE(x, y) + +#define KNF_DLOG(x) \ + ::knf::kDisableDebug ? (void)0 : ::knf::Voidifier() & KNF_LOG(x) + +#else + +#define KNF_CHECK(x) ::knf::Voidifier() +#define KNF_LOG(x) ::knf::Voidifier() + +#define KNF_CHECK_EQ(x, y) ::knf::Voidifier() +#define KNF_CHECK_NE(x, y) ::knf::Voidifier() +#define KNF_CHECK_LT(x, y) ::knf::Voidifier() +#define KNF_CHECK_LE(x, y) ::knf::Voidifier() +#define KNF_CHECK_GT(x, y) ::knf::Voidifier() +#define KNF_CHECK_GE(x, y) ::knf::Voidifier() + +#define KNF_DCHECK(x) ::knf::Voidifier() +#define KNF_DLOG(x) ::knf::Voidifier() +#define KNF_DCHECK_EQ(x, y) ::knf::Voidifier() +#define KNF_DCHECK_NE(x, y) ::knf::Voidifier() +#define KNF_DCHECK_LT(x, y) ::knf::Voidifier() +#define KNF_DCHECK_LE(x, y) ::knf::Voidifier() +#define KNF_DCHECK_GT(x, y) ::knf::Voidifier() +#define KNF_DCHECK_GE(x, y) ::knf::Voidifier() + +#endif // KNF_CHECK_NE + +#endif // KALDI_NATIVE_FBANK_CSRC_LOG_H_ diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/mel-computations.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/mel-computations.cc new file mode 100644 index 0000000..50c857f --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/mel-computations.cc @@ -0,0 +1,257 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is copied/modified from kaldi/src/feat/mel-computations.cc + +#include "kaldi-native-fbank/csrc/mel-computations.h" + +#include +#include +#include + +#include "kaldi-native-fbank/csrc/feature-window.h" + +namespace knf { + +std::ostream &operator<<(std::ostream &os, const MelBanksOptions &opts) { + os << opts.ToString(); + return os; +} + +float MelBanks::VtlnWarpFreq( + float vtln_low_cutoff, // upper+lower frequency cutoffs for VTLN. + float vtln_high_cutoff, + float low_freq, // upper+lower frequency cutoffs in mel computation + float high_freq, float vtln_warp_factor, float freq) { + /// This computes a VTLN warping function that is not the same as HTK's one, + /// but has similar inputs (this function has the advantage of never producing + /// empty bins). + + /// This function computes a warp function F(freq), defined between low_freq + /// and high_freq inclusive, with the following properties: + /// F(low_freq) == low_freq + /// F(high_freq) == high_freq + /// The function is continuous and piecewise linear with two inflection + /// points. + /// The lower inflection point (measured in terms of the unwarped + /// frequency) is at frequency l, determined as described below. + /// The higher inflection point is at a frequency h, determined as + /// described below. + /// If l <= f <= h, then F(f) = f/vtln_warp_factor. + /// If the higher inflection point (measured in terms of the unwarped + /// frequency) is at h, then max(h, F(h)) == vtln_high_cutoff. + /// Since (by the last point) F(h) == h/vtln_warp_factor, then + /// max(h, h/vtln_warp_factor) == vtln_high_cutoff, so + /// h = vtln_high_cutoff / max(1, 1/vtln_warp_factor). + /// = vtln_high_cutoff * min(1, vtln_warp_factor). + /// If the lower inflection point (measured in terms of the unwarped + /// frequency) is at l, then min(l, F(l)) == vtln_low_cutoff + /// This implies that l = vtln_low_cutoff / min(1, 1/vtln_warp_factor) + /// = vtln_low_cutoff * max(1, vtln_warp_factor) + + if (freq < low_freq || freq > high_freq) + return freq; // in case this gets called + // for out-of-range frequencies, just return the freq. + + KNF_CHECK_GT(vtln_low_cutoff, low_freq); + KNF_CHECK_LT(vtln_high_cutoff, high_freq); + + float one = 1.0f; + float l = vtln_low_cutoff * std::max(one, vtln_warp_factor); + float h = vtln_high_cutoff * std::min(one, vtln_warp_factor); + float scale = 1.0f / vtln_warp_factor; + float Fl = scale * l; // F(l); + float Fh = scale * h; // F(h); + KNF_CHECK(l > low_freq && h < high_freq); + // slope of left part of the 3-piece linear function + float scale_left = (Fl - low_freq) / (l - low_freq); + // [slope of center part is just "scale"] + + // slope of right part of the 3-piece linear function + float scale_right = (high_freq - Fh) / (high_freq - h); + + if (freq < l) { + return low_freq + scale_left * (freq - low_freq); + } else if (freq < h) { + return scale * freq; + } else { // freq >= h + return high_freq + scale_right * (freq - high_freq); + } +} + +float MelBanks::VtlnWarpMelFreq( + float vtln_low_cutoff, // upper+lower frequency cutoffs for VTLN. + float vtln_high_cutoff, + float low_freq, // upper+lower frequency cutoffs in mel computation + float high_freq, float vtln_warp_factor, float mel_freq) { + return MelScale(VtlnWarpFreq(vtln_low_cutoff, vtln_high_cutoff, low_freq, + high_freq, vtln_warp_factor, + InverseMelScale(mel_freq))); +} + +MelBanks::MelBanks(const MelBanksOptions &opts, + const FrameExtractionOptions &frame_opts, + float vtln_warp_factor) + : htk_mode_(opts.htk_mode) { + int32_t num_bins = opts.num_bins; + if (num_bins < 3) KNF_LOG(FATAL) << "Must have at least 3 mel bins"; + + float sample_freq = frame_opts.samp_freq; + int32_t window_length_padded = frame_opts.PaddedWindowSize(); + KNF_CHECK_EQ(window_length_padded % 2, 0); + + int32_t num_fft_bins = window_length_padded / 2; + float nyquist = 0.5f * sample_freq; + + float low_freq = opts.low_freq, high_freq; + if (opts.high_freq > 0.0f) + high_freq = opts.high_freq; + else + high_freq = nyquist + opts.high_freq; + + if (low_freq < 0.0f || low_freq >= nyquist || high_freq <= 0.0f || + high_freq > nyquist || high_freq <= low_freq) { + KNF_LOG(FATAL) << "Bad values in options: low-freq " << low_freq + << " and high-freq " << high_freq << " vs. nyquist " + << nyquist; + } + + float fft_bin_width = sample_freq / window_length_padded; + // fft-bin width [think of it as Nyquist-freq / half-window-length] + + float mel_low_freq = MelScale(low_freq); + float mel_high_freq = MelScale(high_freq); + + debug_ = opts.debug_mel; + + // divide by num_bins+1 in next line because of end-effects where the bins + // spread out to the sides. + float mel_freq_delta = (mel_high_freq - mel_low_freq) / (num_bins + 1); + + float vtln_low = opts.vtln_low, vtln_high = opts.vtln_high; + if (vtln_high < 0.0f) { + vtln_high += nyquist; + } + + if (vtln_warp_factor != 1.0f && + (vtln_low < 0.0f || vtln_low <= low_freq || vtln_low >= high_freq || + vtln_high <= 0.0f || vtln_high >= high_freq || vtln_high <= vtln_low)) { + KNF_LOG(FATAL) << "Bad values in options: vtln-low " << vtln_low + << " and vtln-high " << vtln_high << ", versus " + << "low-freq " << low_freq << " and high-freq " << high_freq; + } + + bins_.resize(num_bins); + center_freqs_.resize(num_bins); + + for (int32_t bin = 0; bin < num_bins; ++bin) { + float left_mel = mel_low_freq + bin * mel_freq_delta, + center_mel = mel_low_freq + (bin + 1) * mel_freq_delta, + right_mel = mel_low_freq + (bin + 2) * mel_freq_delta; + + if (vtln_warp_factor != 1.0f) { + left_mel = VtlnWarpMelFreq(vtln_low, vtln_high, low_freq, high_freq, + vtln_warp_factor, left_mel); + center_mel = VtlnWarpMelFreq(vtln_low, vtln_high, low_freq, high_freq, + vtln_warp_factor, center_mel); + right_mel = VtlnWarpMelFreq(vtln_low, vtln_high, low_freq, high_freq, + vtln_warp_factor, right_mel); + } + center_freqs_[bin] = InverseMelScale(center_mel); + + // this_bin will be a vector of coefficients that is only + // nonzero where this mel bin is active. + std::vector this_bin(num_fft_bins); + + int32_t first_index = -1, last_index = -1; + for (int32_t i = 0; i < num_fft_bins; ++i) { + float freq = (fft_bin_width * i); // Center frequency of this fft + // bin. + float mel = MelScale(freq); + if (mel > left_mel && mel < right_mel) { + float weight; + if (mel <= center_mel) + weight = (mel - left_mel) / (center_mel - left_mel); + else + weight = (right_mel - mel) / (right_mel - center_mel); + this_bin[i] = weight; + if (first_index == -1) first_index = i; + last_index = i; + } + } + KNF_CHECK(first_index != -1 && last_index >= first_index && + "You may have set num_mel_bins too large."); + + bins_[bin].first = first_index; + int32_t size = last_index + 1 - first_index; + bins_[bin].second.insert(bins_[bin].second.end(), + this_bin.begin() + first_index, + this_bin.begin() + first_index + size); + + // Replicate a bug in HTK, for testing purposes. + if (opts.htk_mode && bin == 0 && mel_low_freq != 0.0f) { + bins_[bin].second[0] = 0.0; + } + } // for (int32_t bin = 0; bin < num_bins; ++bin) { + + if (debug_) { + std::ostringstream os; + for (size_t i = 0; i < bins_.size(); i++) { + os << "bin " << i << ", offset = " << bins_[i].first << ", vec = "; + for (auto k : bins_[i].second) os << k << ", "; + os << "\n"; + } + KNF_LOG(INFO) << os.str(); + } +} + +// "power_spectrum" contains fft energies. +void MelBanks::Compute(const float *power_spectrum, + float *mel_energies_out) const { + int32_t num_bins = bins_.size(); + + for (int32_t i = 0; i < num_bins; i++) { + int32_t offset = bins_[i].first; + const auto &v = bins_[i].second; + float energy = 0; + for (int32_t k = 0; k != v.size(); ++k) { + energy += v[k] * power_spectrum[k + offset]; + } + + // HTK-like flooring- for testing purposes (we prefer dither) + if (htk_mode_ && energy < 1.0) { + energy = 1.0; + } + + mel_energies_out[i] = energy; + + // The following assert was added due to a problem with OpenBlas that + // we had at one point (it was a bug in that library). Just to detect + // it early. + KNF_CHECK_EQ(energy, energy); // check that energy is not nan + } + + if (debug_) { + fprintf(stderr, "MEL BANKS:\n"); + for (int32_t i = 0; i < num_bins; i++) + fprintf(stderr, " %f", mel_energies_out[i]); + fprintf(stderr, "\n"); + } +} + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/mel-computations.h b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/mel-computations.h new file mode 100644 index 0000000..c186cc2 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/mel-computations.h @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is copied/modified from kaldi/src/feat/mel-computations.h +#ifndef KALDI_NATIVE_FBANK_CSRC_MEL_COMPUTATIONS_H_ +#define KALDI_NATIVE_FBANK_CSRC_MEL_COMPUTATIONS_H_ + +#include +#include +#include +#include + +#include "kaldi-native-fbank/csrc/feature-window.h" + +namespace knf { + +struct MelBanksOptions { + int32_t num_bins = 25; // e.g. 25; number of triangular bins + float low_freq = 20; // e.g. 20; lower frequency cutoff + + // an upper frequency cutoff; 0 -> no cutoff, negative + // ->added to the Nyquist frequency to get the cutoff. + float high_freq = 0; + + float vtln_low = 100; // vtln lower cutoff of warping function. + + // vtln upper cutoff of warping function: if negative, added + // to the Nyquist frequency to get the cutoff. + float vtln_high = -500; + + bool debug_mel = false; + // htk_mode is a "hidden" config, it does not show up on command line. + // Enables more exact compatibility with HTK, for testing purposes. Affects + // mel-energy flooring and reproduces a bug in HTK. + bool htk_mode = false; + + std::string ToString() const { + std::ostringstream os; + os << "num_bins: " << num_bins << "\n"; + os << "low_freq: " << low_freq << "\n"; + os << "high_freq: " << high_freq << "\n"; + os << "vtln_low: " << vtln_low << "\n"; + os << "vtln_high: " << vtln_high << "\n"; + os << "debug_mel: " << debug_mel << "\n"; + os << "htk_mode: " << htk_mode << "\n"; + return os.str(); + } +}; + +std::ostream &operator<<(std::ostream &os, const MelBanksOptions &opts); + +class MelBanks { + public: + static inline float InverseMelScale(float mel_freq) { + return 700.0f * (expf(mel_freq / 1127.0f) - 1.0f); + } + + static inline float MelScale(float freq) { + return 1127.0f * logf(1.0f + freq / 700.0f); + } + + static float VtlnWarpFreq( + float vtln_low_cutoff, + float vtln_high_cutoff, // discontinuities in warp func + float low_freq, + float high_freq, // upper+lower frequency cutoffs in + // the mel computation + float vtln_warp_factor, float freq); + + static float VtlnWarpMelFreq(float vtln_low_cutoff, float vtln_high_cutoff, + float low_freq, float high_freq, + float vtln_warp_factor, float mel_freq); + + // TODO(fangjun): Remove vtln_warp_factor + MelBanks(const MelBanksOptions &opts, + const FrameExtractionOptions &frame_opts, float vtln_warp_factor); + + /// Compute Mel energies (note: not log energies). + /// At input, "fft_energies" contains the FFT energies (not log). + /// + /// @param fft_energies 1-D array of size num_fft_bins/2+1 + /// @param mel_energies_out 1-D array of size num_mel_bins + void Compute(const float *fft_energies, float *mel_energies_out) const; + + int32_t NumBins() const { return bins_.size(); } + + private: + // center frequencies of bins, numbered from 0 ... num_bins-1. + // Needed by GetCenterFreqs(). + std::vector center_freqs_; + + // the "bins_" vector is a vector, one for each bin, of a pair: + // (the first nonzero fft-bin), (the vector of weights). + std::vector>> bins_; + + // TODO(fangjun): Remove debug_ and htk_mode_ + bool debug_; + bool htk_mode_; +}; + +} // namespace knf + +#endif // KALDI_NATIVE_FBANK_CSRC_MEL_COMPUTATIONS_H_ diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/online-feature.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/online-feature.cc new file mode 100644 index 0000000..833a6f0 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/online-feature.cc @@ -0,0 +1,165 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The content in this file is copied/modified from +// This file is copied/modified from kaldi/src/feat/online-feature.cc + +#include "kaldi-native-fbank/csrc/online-feature.h" + +#include +#include +#include + +#include "kaldi-native-fbank/csrc/feature-window.h" +#include "kaldi-native-fbank/csrc/log.h" + +namespace knf { + +RecyclingVector::RecyclingVector(int32_t items_to_hold) + : items_to_hold_(items_to_hold == 0 ? -1 : items_to_hold), + first_available_index_(0) {} + +const float *RecyclingVector::At(int32_t index) const { + if (index < first_available_index_) { + KNF_LOG(FATAL) << "Attempted to retrieve feature vector that was " + "already removed by the RecyclingVector (index = " + << index << "; " + << "first_available_index = " << first_available_index_ + << "; " + << "size = " << Size() << ")"; + } + // 'at' does size checking. + return items_.at(index - first_available_index_).data(); +} + +void RecyclingVector::PushBack(std::vector item) { + // Note: -1 is a larger number when treated as unsigned + if (items_.size() == static_cast(items_to_hold_)) { + items_.pop_front(); + ++first_available_index_; + } + items_.push_back(std::move(item)); +} + +int32_t RecyclingVector::Size() const { + return first_available_index_ + static_cast(items_.size()); +} + +template +OnlineGenericBaseFeature::OnlineGenericBaseFeature( + const typename C::Options &opts) + : computer_(opts), + window_function_(computer_.GetFrameOptions()), + features_(opts.frame_opts.max_feature_vectors), + input_finished_(false), + waveform_offset_(0) { + // RE the following assert: search for ONLINE_IVECTOR_LIMIT in + // online-ivector-feature.cc. + // Casting to uint32, an unsigned type, means that -1 would be treated + // as `very large`. + KNF_CHECK(static_cast(opts.frame_opts.max_feature_vectors) > 200); +} + +template +void OnlineGenericBaseFeature::AcceptWaveform(float sampling_rate, + const float *waveform, + int32_t n) { + if (n == 0) { + return; // Nothing to do. + } + + if (input_finished_) { + KNF_LOG(FATAL) << "AcceptWaveform called after InputFinished() was called."; + } + + KNF_CHECK_EQ(sampling_rate, computer_.GetFrameOptions().samp_freq); + + waveform_remainder_.insert(waveform_remainder_.end(), waveform, waveform + n); + + ComputeFeatures(); +} + +template +void OnlineGenericBaseFeature::InputFinished() { + input_finished_ = true; + ComputeFeatures(); +} + +template +void OnlineGenericBaseFeature::ComputeFeatures() { + const FrameExtractionOptions &frame_opts = computer_.GetFrameOptions(); + + int64_t num_samples_total = waveform_offset_ + waveform_remainder_.size(); + + int32_t num_frames_old = features_.Size(); + + int32_t num_frames_new = + NumFrames(num_samples_total, frame_opts, input_finished_); + + KNF_CHECK_GE(num_frames_new, num_frames_old); + + // note: this online feature-extraction code does not support VTLN. + float vtln_warp = 1.0; + + std::vector window; + bool need_raw_log_energy = computer_.NeedRawLogEnergy(); + + for (int32_t frame = num_frames_old; frame < num_frames_new; ++frame) { + std::fill(window.begin(), window.end(), 0); + float raw_log_energy = 0.0; + ExtractWindow(waveform_offset_, waveform_remainder_, frame, frame_opts, + window_function_, &window, + need_raw_log_energy ? &raw_log_energy : nullptr); + + std::vector this_feature(computer_.Dim()); + + computer_.Compute(raw_log_energy, vtln_warp, &window, this_feature.data()); + features_.PushBack(std::move(this_feature)); + } + + // OK, we will now discard any portion of the signal that will not be + // necessary to compute frames in the future. + int64_t first_sample_of_next_frame = + FirstSampleOfFrame(num_frames_new, frame_opts); + + int32_t samples_to_discard = first_sample_of_next_frame - waveform_offset_; + + if (samples_to_discard > 0) { + // discard the leftmost part of the waveform that we no longer need. + int32_t new_num_samples = + static_cast(waveform_remainder_.size()) - samples_to_discard; + + if (new_num_samples <= 0) { + // odd, but we'll try to handle it. + waveform_offset_ += waveform_remainder_.size(); + waveform_remainder_.resize(0); + } else { + std::vector new_remainder(new_num_samples); + + std::copy(waveform_remainder_.begin() + samples_to_discard, + waveform_remainder_.end(), new_remainder.begin()); + waveform_offset_ += samples_to_discard; + + waveform_remainder_.swap(new_remainder); + } + } +} + +template class OnlineGenericBaseFeature; + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/online-feature.h b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/online-feature.h new file mode 100644 index 0000000..5ca5511 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/online-feature.h @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The content in this file is copied/modified from +// This file is copied/modified from kaldi/src/feat/online-feature.h +#ifndef KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_ +#define KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_ + +#include +#include +#include + +#include "kaldi-native-fbank/csrc/feature-fbank.h" + +namespace knf { + +/// This class serves as a storage for feature vectors with an option to limit +/// the memory usage by removing old elements. The deleted frames indices are +/// "remembered" so that regardless of the MAX_ITEMS setting, the user always +/// provides the indices as if no deletion was being performed. +/// This is useful when processing very long recordings which would otherwise +/// cause the memory to eventually blow up when the features are not being +/// removed. +class RecyclingVector { + public: + /// By default it does not remove any elements. + explicit RecyclingVector(int32_t items_to_hold = -1); + + ~RecyclingVector() = default; + RecyclingVector(const RecyclingVector &) = delete; + RecyclingVector &operator=(const RecyclingVector &) = delete; + + // The pointer is owned by RecyclingVector + // Users should not free it + const float *At(int32_t index) const; + + void PushBack(std::vector item); + + /// This method returns the size as if no "recycling" had happened, + /// i.e. equivalent to the number of times the PushBack method has been + /// called. + int32_t Size() const; + + private: + std::deque> items_; + int32_t items_to_hold_; + int32_t first_available_index_; +}; + +/// This is a templated class for online feature extraction; +/// it's templated on a class like MfccComputer or PlpComputer +/// that does the basic feature extraction. +template +class OnlineGenericBaseFeature { + public: + // Constructor from options class + explicit OnlineGenericBaseFeature(const typename C::Options &opts); + + int32_t Dim() const { return computer_.Dim(); } + + float FrameShiftInSeconds() const { + return computer_.GetFrameOptions().frame_shift_ms / 1000.0f; + } + + int32_t NumFramesReady() const { return features_.Size(); } + + // Note: IsLastFrame() will only ever return true if you have called + // InputFinished() (and this frame is the last frame). + bool IsLastFrame(int32_t frame) const { + return input_finished_ && frame == NumFramesReady() - 1; + } + + const float *GetFrame(int32_t frame) const { return features_.At(frame); } + + // This would be called from the application, when you get + // more wave data. Note: the sampling_rate is only provided so + // the code can assert that it matches the sampling rate + // expected in the options. + // + // @param sampling_rate The sampling_rate of the input waveform + // @param waveform Pointer to a 1-D array of size n + // @param n Number of entries in waveform + void AcceptWaveform(float sampling_rate, const float *waveform, int32_t n); + + // InputFinished() tells the class you won't be providing any + // more waveform. This will help flush out the last frame or two + // of features, in the case where snip-edges == false; it also + // affects the return value of IsLastFrame(). + void InputFinished(); + + private: + // This function computes any additional feature frames that it is possible to + // compute from 'waveform_remainder_', which at this point may contain more + // than just a remainder-sized quantity (because AcceptWaveform() appends to + // waveform_remainder_ before calling this function). It adds these feature + // frames to features_, and shifts off any now-unneeded samples of input from + // waveform_remainder_ while incrementing waveform_offset_ by the same amount. + void ComputeFeatures(); + + C computer_; // class that does the MFCC or PLP or filterbank computation + + FeatureWindowFunction window_function_; + + // features_ is the Mfcc or Plp or Fbank features that we have already + // computed. + + RecyclingVector features_; + + // True if the user has called "InputFinished()" + bool input_finished_; + + // waveform_offset_ is the number of samples of waveform that we have + // already discarded, i.e. that were prior to 'waveform_remainder_'. + int64_t waveform_offset_; + + // waveform_remainder_ is a short piece of waveform that we may need to keep + // after extracting all the whole frames we can (whatever length of feature + // will be required for the next phase of computation). + // It is a 1-D tensor + std::vector waveform_remainder_; +}; + +using OnlineFbank = OnlineGenericBaseFeature; + +} // namespace knf + +#endif // KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_ diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/rfft.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/rfft.cc new file mode 100644 index 0000000..8cb4b84 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/rfft.cc @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kaldi-native-fbank/csrc/rfft.h" + +#include +#include +#include + +#include "kaldi-native-fbank/csrc/log.h" + +// see fftsg.c +#ifdef __cplusplus +extern "C" void rdft(int n, int isgn, double *a, int *ip, double *w); +#else +void rdft(int n, int isgn, double *a, int *ip, double *w); +#endif + +namespace knf { +class Rfft::RfftImpl { + public: + explicit RfftImpl(int32_t n) : n_(n), ip_(2 + std::sqrt(n / 2)), w_(n / 2) { + KNF_CHECK_EQ(n & (n - 1), 0); + } + + void Compute(float *in_out) { + std::vector d(in_out, in_out + n_); + + Compute(d.data()); + + std::copy(d.begin(), d.end(), in_out); + } + + void Compute(double *in_out) { + // 1 means forward fft + rdft(n_, 1, in_out, ip_.data(), w_.data()); + } + + private: + int32_t n_; + std::vector ip_; + std::vector w_; +}; + +Rfft::Rfft(int32_t n) : impl_(std::make_unique(n)) {} + +Rfft::~Rfft() = default; + +void Rfft::Compute(float *in_out) { impl_->Compute(in_out); } +void Rfft::Compute(double *in_out) { impl_->Compute(in_out); } + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/rfft.h b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/rfft.h new file mode 100644 index 0000000..c8cb9f8 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/rfft.h @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef KALDI_NATIVE_FBANK_CSRC_RFFT_H_ +#define KALDI_NATIVE_FBANK_CSRC_RFFT_H_ + +#include + +namespace knf { + +// n-point Real discrete Fourier transform +// where n is a power of 2. n >= 2 +// +// R[k] = sum_j=0^n-1 in[j]*cos(2*pi*j*k/n), 0<=k<=n/2 +// I[k] = sum_j=0^n-1 in[j]*sin(2*pi*j*k/n), 0 impl_; +}; + +} // namespace knf + +#endif // KALDI_NATIVE_FBANK_CSRC_RFFT_H_ diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-log.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-log.cc new file mode 100644 index 0000000..6379633 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-log.cc @@ -0,0 +1,73 @@ +/** + * Copyright 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" +#include "kaldi-native-fbank/csrc/log.h" + +namespace knf { + +#if KNF_ENABLE_CHECK + +TEST(Log, TestLog) { + KNF_LOG(TRACE) << "this is a trace message"; + KNF_LOG(DEBUG) << "this is a debug message"; + KNF_LOG(INFO) << "this is an info message"; + KNF_LOG(WARNING) << "this is a warning message"; + KNF_LOG(ERROR) << "this is an error message"; + + ASSERT_THROW(KNF_LOG(FATAL) << "This will crash the program", + std::runtime_error); + + // For debug build + + KNF_DLOG(TRACE) << "this is a trace message for debug build"; + KNF_DLOG(DEBUG) << "this is a trace message for debug build"; + KNF_DLOG(INFO) << "this is a trace message for debug build"; + KNF_DLOG(ERROR) << "this is an error message for debug build"; + KNF_DLOG(WARNING) << "this is a trace message for debug build"; + +#if !defined(NDEBUG) + ASSERT_THROW(KNF_DLOG(FATAL) << "this is a trace message for debug build", + std::runtime_error); +#endif +} + +TEST(Log, TestCheck) { + KNF_CHECK_EQ(1, 1) << "ok"; + KNF_CHECK_LE(1, 3) << "ok"; + KNF_CHECK_LT(1, 2) << "ok"; + KNF_CHECK_GT(2, 1) << "ok"; + KNF_CHECK_GE(2, 1) << "ok"; + + ASSERT_THROW(KNF_CHECK_EQ(2, 1) << "bad things happened", std::runtime_error); + + // for debug build + KNF_DCHECK_EQ(1, 1) << "ok"; + KNF_DCHECK_LE(1, 3) << "ok"; + KNF_DCHECK_LT(1, 2) << "ok"; + KNF_DCHECK_GT(2, 1) << "ok"; + KNF_DCHECK_GE(2, 1) << "ok"; + +#if !defined(NDEBUG) + ASSERT_THROW(KNF_CHECK_EQ(2, 1) << "bad things happened", std::runtime_error); +#endif +} + +#endif + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-online-fbank.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-online-fbank.cc new file mode 100644 index 0000000..9f595cf --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-online-fbank.cc @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "kaldi-native-fbank/csrc/online-feature.h" + +int main() { + knf::FbankOptions opts; + opts.frame_opts.dither = 0; + opts.mel_opts.num_bins = 10; + + knf::OnlineFbank fbank(opts); + for (int32_t i = 0; i < 1600; ++i) { + float s = (i * i - i / 2) / 32767.; + fbank.AcceptWaveform(16000, &s, 1); + } + + std::ostringstream os; + + int32_t n = fbank.NumFramesReady(); + for (int32_t i = 0; i != n; ++i) { + const float *frame = fbank.GetFrame(i); + for (int32_t k = 0; k != opts.mel_opts.num_bins; ++k) { + os << frame[k] << ", "; + } + os << "\n"; + } + + std::cout << os.str() << "\n"; + + return 0; +} diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-online-feature.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-online-feature.cc new file mode 100644 index 0000000..bfbe621 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-online-feature.cc @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" +#include "kaldi-native-fbank/csrc/online-feature.h" +namespace knf { + +TEST(RecyclingVector, TestUnlimited) { + RecyclingVector v(-1); + constexpr int32_t N = 100; + for (int32_t i = 0; i != N; ++i) { + std::unique_ptr p(new float[3]{i, i + 1, i + 2}); + v.PushBack(std::move(p)); + } + ASSERT_EQ(v.Size(), N); + + for (int32_t i = 0; i != N; ++i) { + const float *t = v.At(i); + for (int32_t k = 0; k != 3; ++k) { + EXPECT_EQ(t[k], (i + k)); + } + } +} + +TEST(RecyclingVector, Testlimited) { + constexpr int32_t K = 3; + constexpr int32_t N = 10; + RecyclingVector v(K); + for (int32_t i = 0; i != N; ++i) { + std::unique_ptr p(new float[3]{i, i + 1, i + 2}); + v.PushBack(std::move(p)); + } + + ASSERT_EQ(v.Size(), N); + + for (int32_t i = N - K; i != N; ++i) { + const float *t = v.At(i); + + for (int32_t k = 0; k != 3; ++k) { + EXPECT_EQ(t[k], (i + k)); + } + } +} +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-rfft.cc b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-rfft.cc new file mode 100644 index 0000000..47f9904 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc/test-rfft.cc @@ -0,0 +1,52 @@ +/** + * Copyright 2022 Xiaomi Corporation (authors: Fangjun Kuang) + * + * See LICENSE for clarification regarding multiple authors + * + * 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 applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" +#include "kaldi-native-fbank/csrc/rfft.h" + +namespace knf { + +#if 0 +>>> import torch +>>> a = torch.tensor([1., -1, 3, 8, 20, 6, 0, 2]) +>>> torch.fft.rfft(a) +tensor([ 39.0000+0.0000j, -28.1924-2.2929j, 18.0000+5.0000j, -9.8076+3.7071j, + 9.0000+0.0000j]) +#endif + +TEST(Rfft, TestRfft) { + knf::Rfft fft(8); + for (int32_t i = 0; i != 10; ++i) { + std::vector d = {1, -1, 3, 8, 20, 6, 0, 2}; + fft.Compute(d.data()); + + EXPECT_EQ(d[0], 39); + EXPECT_EQ(d[1], 9); + + EXPECT_NEAR(d[2], -28.1924, 1e-3); + EXPECT_NEAR(-d[3], -2.2929, 1e-3); + + EXPECT_NEAR(d[4], 18, 1e-3); + EXPECT_NEAR(-d[5], 5, 1e-3); + + EXPECT_NEAR(d[6], -9.8076, 1e-3); + EXPECT_NEAR(-d[7], 3.7071, 1e-3); + } +} + +} // namespace knf diff --git a/runtime/onnxruntime/third_party/kaldi/CMakeLists.txt b/runtime/onnxruntime/third_party/kaldi/CMakeLists.txt new file mode 100644 index 0000000..f253cb4 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/CMakeLists.txt @@ -0,0 +1,71 @@ +cmake_minimum_required(VERSION 3.10 FATAL_ERROR) + +project(kaldi) + +add_library(kaldi-util STATIC + base/kaldi-error.cc + base/kaldi-math.cc + util/kaldi-io.cc + util/parse-options.cc + util/simple-io-funcs.cc + util/text-utils.cc +) +#target_link_libraries(kaldi-util PUBLIC utils) + +add_library(kaldi-decoder STATIC + lat/determinize-lattice-pruned.cc + lat/lattice-functions.cc + decoder/lattice-faster-decoder.cc + decoder/lattice-faster-online-decoder.cc +) + +if (WIN32) +target_link_libraries(kaldi-decoder PUBLIC kaldi-util) +else() +target_link_libraries(kaldi-decoder PUBLIC kaldi-util dl) +endif (WIN32) + + +if (WIN32) + target_compile_definitions (kaldi-decoder PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES) +endif (WIN32) + +include_directories(${CMAKE_SOURCE_DIR}/build/third_party/glog) +include_directories(${CMAKE_SOURCE_DIR}/third_party/glog/src) +include_directories(${CMAKE_SOURCE_DIR}/third_party/gflags/src/include) +if(TRUE) + # Arpa binary + add_executable(arpa2fst + lm/arpa-file-parser.cc + lm/arpa-lm-compiler.cc + lmbin/arpa2fst.cc + ) + +if (WIN32) +target_link_libraries(arpa2fst PUBLIC kaldi-util fst) +else() +target_link_libraries(arpa2fst PUBLIC kaldi-util fst dl) +endif (WIN32) + + + # FST tools binary + set(FST_BINS + fstaddselfloops + fstdeterminizestar + fstisstochastic + fstminimizeencoded + fsttablecompose + ) + + foreach(name IN LISTS FST_BINS) + add_executable(${name} + fstbin/${name}.cc + fstext/kaldi-fst-io.cc + ) +if (WIN32) + target_link_libraries(${name} PUBLIC kaldi-util fst) +else() + target_link_libraries(${name} PUBLIC kaldi-util fst dl) +endif (WIN32) + endforeach() +endif() diff --git a/runtime/onnxruntime/third_party/kaldi/base/Makefile b/runtime/onnxruntime/third_party/kaldi/base/Makefile new file mode 100644 index 0000000..49af4f8 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/Makefile @@ -0,0 +1,27 @@ +# Whenever make is run in this directory, call ./get_version.sh as the +# first thing. This script regenereates ./version.h if necessary, e.g. +# if it does not already exist or if the version number has changed. +LOG := $(shell ./get_version.sh; echo " $$?") +ifneq ($(strip $(LOG)), 0) + RC := $(lastword $(LOG)) + OUT := $(wordlist 1,$(shell echo $$(($(words $(LOG))-1))),$(LOG)) + ifeq ($(RC),0) + $(info $(OUT)) + else + $(error $(OUT)) + endif +endif + +all: + +include ../kaldi.mk + +TESTFILES = kaldi-math-test io-funcs-test kaldi-error-test timer-test + +OBJFILES = kaldi-math.o kaldi-error.o io-funcs.o kaldi-utils.o timer.o + +LIBNAME = kaldi-base + +ADDLIBS = + +include ../makefiles/default_rules.mk diff --git a/runtime/onnxruntime/third_party/kaldi/base/get_version.sh b/runtime/onnxruntime/third_party/kaldi/base/get_version.sh new file mode 100644 index 0000000..610bc22 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/get_version.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +# Copyright 2017 University of Southern California (Author: Dogan Can) + +# See ../../COPYING for clarification regarding multiple authors +# +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# Kaldi versioning is loosely based on the semantic versioning scheme. This +# script tries to work out the version string from the partial version number +# specified in src/.version along with the recent git history. By convention +# src/.version specifies the first two components (MAJOR.MINOR) of the version +# number. The third component (PATCH) is determined by counting how many +# commits there are that are newer than than the last commit modifiying +# src/.version. If there are uncommitted changes in the src/ directory, then +# the version string is extended with a suffix (~N) specifiying the number of +# files with uncommitted changes. The last component of the version string is +# the abbreviated hash of the HEAD commit. If git history is not available or +# if the file src/.short_version exists, then the version string defaults to +# the number specified in src/.version. + +set -e + +# Change working directory to the directory where this script is located. +cd "$(dirname ${BASH_SOURCE[0]})" + +# Read the partial version number specified in the first line of src/.version. +version=$(head -1 ../.version) + +if [ -e ../.short_version ]; then + echo "$0: File src/.short_version exists." + echo "$0: Stopping the construction of full version number from git history." +elif ! [[ $version =~ ^[0-9][0-9]*.[0-9][0-9]*$ ]]; then + echo "$0: The version number \"$version\" specified in src/.version is not" \ + "in MAJOR.MINOR format." + echo "$0: Stopping the construction of full version number from git history." +elif ! which git >&/dev/null; then + echo "$0: Git is not installed." + echo "$0: Using the version number \"$version\" specified in src/.version." +elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" != true ]; then + echo "$0: Git history is not available." + echo "$0: Using the version number \"$version\" specified in src/.version." +else + # Figure out patch number. + version_commit=$(git log -1 --pretty=oneline ../.version | awk '{print $1}') + patch_number=$(git rev-list ${version_commit}..HEAD | wc -l | awk '{print $1}') + version="$version.$patch_number" + + # Check for uncommitted changes in src/. + uncommitted_changes=$(git diff-index HEAD -- .. | wc -l | awk '{print $1}') + if [ $uncommitted_changes -gt 0 ]; then + # Add suffix ~N if there are N files in src/ with uncommitted changes + version="$version~$uncommitted_changes" + fi + + # Figure out HEAD commit SHA-1. + head_commit=$(git log -1 --pretty=oneline | awk '{print $1}') + head_commit_short=$(git log -1 --oneline --abbrev=4 | awk '{print $1}') + version="$version-${head_commit_short}" +fi + +# Empty version number is not allowed. +if [ -z "$version" ]; then + version="?" +fi + +# Write version info to a temporary file. +temp=$(mktemp /tmp/temp.XXXXXX) +trap 'rm -f "$temp"' EXIT +echo "// This file was automatically created by ./get_version.sh." > $temp +echo "// It is only included by ./kaldi-error.cc." >> $temp +echo "#define KALDI_VERSION \"$version\"" >> $temp +if [ -n "$head_commit" ]; then + echo "#define KALDI_GIT_HEAD \"$head_commit\"" >> $temp +fi + +# Overwrite ./version.h with the temporary file if they are different. +if ! cmp -s $temp version.h; then + cp $temp version.h + chmod 644 version.h +fi +exit 0 diff --git a/runtime/onnxruntime/third_party/kaldi/base/io-funcs-inl.h b/runtime/onnxruntime/third_party/kaldi/base/io-funcs-inl.h new file mode 100644 index 0000000..b703ef5 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/io-funcs-inl.h @@ -0,0 +1,327 @@ +// base/io-funcs-inl.h + +// Copyright 2009-2011 Microsoft Corporation; Saarland University; +// Jan Silovsky; Yanmin Qian; +// Johns Hopkins University (Author: Daniel Povey) +// 2016 Xiaohui Zhang + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_BASE_IO_FUNCS_INL_H_ +#define KALDI_BASE_IO_FUNCS_INL_H_ 1 + +// Do not include this file directly. It is included by base/io-funcs.h + +#include +#include + +namespace kaldi { + +// Template that covers integers. +template void WriteBasicType(std::ostream &os, + bool binary, T t) { + // Compile time assertion that this is not called with a wrong type. + KALDI_ASSERT_IS_INTEGER_TYPE(T); + if (binary) { + char len_c = (std::numeric_limits::is_signed ? 1 : -1) + * static_cast(sizeof(t)); + os.put(len_c); + os.write(reinterpret_cast(&t), sizeof(t)); + } else { + if (sizeof(t) == 1) + os << static_cast(t) << " "; + else + os << t << " "; + } + if (os.fail()) { + KALDI_ERR << "Write failure in WriteBasicType."; + } +} + +// Template that covers integers. +template inline void ReadBasicType(std::istream &is, + bool binary, T *t) { + KALDI_PARANOID_ASSERT(t != NULL); + // Compile time assertion that this is not called with a wrong type. + KALDI_ASSERT_IS_INTEGER_TYPE(T); + if (binary) { + int len_c_in = is.get(); + if (len_c_in == -1) + KALDI_ERR << "ReadBasicType: encountered end of stream."; + char len_c = static_cast(len_c_in), len_c_expected + = (std::numeric_limits::is_signed ? 1 : -1) + * static_cast(sizeof(*t)); + if (len_c != len_c_expected) { + KALDI_ERR << "ReadBasicType: did not get expected integer type, " + << static_cast(len_c) + << " vs. " << static_cast(len_c_expected) + << ". You can change this code to successfully" + << " read it later, if needed."; + // insert code here to read "wrong" type. Might have a switch statement. + } + is.read(reinterpret_cast(t), sizeof(*t)); + } else { + if (sizeof(*t) == 1) { + int16 i; + is >> i; + *t = i; + } else { + is >> *t; + } + } + if (is.fail()) { + KALDI_ERR << "Read failure in ReadBasicType, file position is " + << is.tellg() << ", next char is " << is.peek(); + } +} + +// Template that covers integers. +template +inline void WriteIntegerPairVector(std::ostream &os, bool binary, + const std::vector > &v) { + // Compile time assertion that this is not called with a wrong type. + KALDI_ASSERT_IS_INTEGER_TYPE(T); + if (binary) { + char sz = sizeof(T); // this is currently just a check. + os.write(&sz, 1); + int32 vecsz = static_cast(v.size()); + KALDI_ASSERT((size_t)vecsz == v.size()); + os.write(reinterpret_cast(&vecsz), sizeof(vecsz)); + if (vecsz != 0) { + os.write(reinterpret_cast(&(v[0])), sizeof(T) * vecsz * 2); + } + } else { + // focus here is on prettiness of text form rather than + // efficiency of reading-in. + // reading-in is dominated by low-level operations anyway: + // for efficiency use binary. + os << "[ "; + typename std::vector >::const_iterator iter = v.begin(), + end = v.end(); + for (; iter != end; ++iter) { + if (sizeof(T) == 1) + os << static_cast(iter->first) << ',' + << static_cast(iter->second) << ' '; + else + os << iter->first << ',' + << iter->second << ' '; + } + os << "]\n"; + } + if (os.fail()) { + KALDI_ERR << "Write failure in WriteIntegerPairVector."; + } +} + +// Template that covers integers. +template +inline void ReadIntegerPairVector(std::istream &is, bool binary, + std::vector > *v) { + KALDI_ASSERT_IS_INTEGER_TYPE(T); + KALDI_ASSERT(v != NULL); + if (binary) { + int sz = is.peek(); + if (sz == sizeof(T)) { + is.get(); + } else { // this is currently just a check. + KALDI_ERR << "ReadIntegerPairVector: expected to see type of size " + << sizeof(T) << ", saw instead " << sz << ", at file position " + << is.tellg(); + } + int32 vecsz; + is.read(reinterpret_cast(&vecsz), sizeof(vecsz)); + if (is.fail() || vecsz < 0) goto bad; + v->resize(vecsz); + if (vecsz > 0) { + is.read(reinterpret_cast(&((*v)[0])), sizeof(T)*vecsz*2); + } + } else { + std::vector > tmp_v; // use temporary so v doesn't use extra memory + // due to resizing. + is >> std::ws; + if (is.peek() != static_cast('[')) { + KALDI_ERR << "ReadIntegerPairVector: expected to see [, saw " + << is.peek() << ", at file position " << is.tellg(); + } + is.get(); // consume the '['. + is >> std::ws; // consume whitespace. + while (is.peek() != static_cast(']')) { + if (sizeof(T) == 1) { // read/write chars as numbers. + int16 next_t1, next_t2; + is >> next_t1; + if (is.fail()) goto bad; + if (is.peek() != static_cast(',')) + KALDI_ERR << "ReadIntegerPairVector: expected to see ',', saw " + << is.peek() << ", at file position " << is.tellg(); + is.get(); // consume the ','. + is >> next_t2 >> std::ws; + if (is.fail()) goto bad; + else + tmp_v.push_back(std::make_pair((T)next_t1, (T)next_t2)); + } else { + T next_t1, next_t2; + is >> next_t1; + if (is.fail()) goto bad; + if (is.peek() != static_cast(',')) + KALDI_ERR << "ReadIntegerPairVector: expected to see ',', saw " + << is.peek() << ", at file position " << is.tellg(); + is.get(); // consume the ','. + is >> next_t2 >> std::ws; + if (is.fail()) goto bad; + else + tmp_v.push_back(std::pair(next_t1, next_t2)); + } + } + is.get(); // get the final ']'. + *v = tmp_v; // could use std::swap to use less temporary memory, but this + // uses less permanent memory. + } + if (!is.fail()) return; + bad: + KALDI_ERR << "ReadIntegerPairVector: read failure at file position " + << is.tellg(); +} + +template inline void WriteIntegerVector(std::ostream &os, bool binary, + const std::vector &v) { + // Compile time assertion that this is not called with a wrong type. + KALDI_ASSERT_IS_INTEGER_TYPE(T); + if (binary) { + char sz = sizeof(T); // this is currently just a check. + os.write(&sz, 1); + int32 vecsz = static_cast(v.size()); + KALDI_ASSERT((size_t)vecsz == v.size()); + os.write(reinterpret_cast(&vecsz), sizeof(vecsz)); + if (vecsz != 0) { + os.write(reinterpret_cast(&(v[0])), sizeof(T)*vecsz); + } + } else { + // focus here is on prettiness of text form rather than + // efficiency of reading-in. + // reading-in is dominated by low-level operations anyway: + // for efficiency use binary. + os << "[ "; + typename std::vector::const_iterator iter = v.begin(), end = v.end(); + for (; iter != end; ++iter) { + if (sizeof(T) == 1) + os << static_cast(*iter) << " "; + else + os << *iter << " "; + } + os << "]\n"; + } + if (os.fail()) { + KALDI_ERR << "Write failure in WriteIntegerVector."; + } +} + + +template inline void ReadIntegerVector(std::istream &is, + bool binary, + std::vector *v) { + KALDI_ASSERT_IS_INTEGER_TYPE(T); + KALDI_ASSERT(v != NULL); + if (binary) { + int sz = is.peek(); + if (sz == sizeof(T)) { + is.get(); + } else { // this is currently just a check. + KALDI_ERR << "ReadIntegerVector: expected to see type of size " + << sizeof(T) << ", saw instead " << sz << ", at file position " + << is.tellg(); + } + int32 vecsz; + is.read(reinterpret_cast(&vecsz), sizeof(vecsz)); + if (is.fail() || vecsz < 0) goto bad; + v->resize(vecsz); + if (vecsz > 0) { + is.read(reinterpret_cast(&((*v)[0])), sizeof(T)*vecsz); + } + } else { + std::vector tmp_v; // use temporary so v doesn't use extra memory + // due to resizing. + is >> std::ws; + if (is.peek() != static_cast('[')) { + KALDI_ERR << "ReadIntegerVector: expected to see [, saw " + << is.peek() << ", at file position " << is.tellg(); + } + is.get(); // consume the '['. + is >> std::ws; // consume whitespace. + while (is.peek() != static_cast(']')) { + if (sizeof(T) == 1) { // read/write chars as numbers. + int16 next_t; + is >> next_t >> std::ws; + if (is.fail()) goto bad; + else + tmp_v.push_back((T)next_t); + } else { + T next_t; + is >> next_t >> std::ws; + if (is.fail()) goto bad; + else + tmp_v.push_back(next_t); + } + } + is.get(); // get the final ']'. + *v = tmp_v; // could use std::swap to use less temporary memory, but this + // uses less permanent memory. + } + if (!is.fail()) return; + bad: + KALDI_ERR << "ReadIntegerVector: read failure at file position " + << is.tellg(); +} + + +// Initialize an opened stream for writing by writing an optional binary +// header and modifying the floating-point precision. +inline void InitKaldiOutputStream(std::ostream &os, bool binary) { + // This does not throw exceptions (does not check for errors). + if (binary) { + os.put('\0'); + os.put('B'); + } + // Note, in non-binary mode we may at some point want to mess with + // the precision a bit. + // 7 is a bit more than the precision of float.. + if (os.precision() < 7) + os.precision(7); +} + +/// Initialize an opened stream for reading by detecting the binary header and +// setting the "binary" value appropriately. +inline bool InitKaldiInputStream(std::istream &is, bool *binary) { + // Sets the 'binary' variable. + // Throws exception in the very unusual situation that stream + // starts with '\0' but not then 'B'. + + if (is.peek() == '\0') { // seems to be binary + is.get(); + if (is.peek() != 'B') { + return false; + } + is.get(); + *binary = true; + return true; + } else { + *binary = false; + return true; + } +} + +} // end namespace kaldi. + +#endif // KALDI_BASE_IO_FUNCS_INL_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/base/io-funcs-test.cc b/runtime/onnxruntime/third_party/kaldi/base/io-funcs-test.cc new file mode 100644 index 0000000..dd05326 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/io-funcs-test.cc @@ -0,0 +1,160 @@ +// base/io-funcs-test.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. +#include "base/io-funcs.h" +#include "base/kaldi-math.h" + +namespace kaldi { + +void UnitTestIo(bool binary) { + { + const char *filename = "tmpf"; + std::ofstream outfile(filename, std::ios_base::out | std::ios_base::binary); + InitKaldiOutputStream(outfile, binary); + if (!binary) outfile << "\t"; + int64 i1 = Rand() % 10000; + WriteBasicType(outfile, binary, i1); + uint16 i2 = Rand() % 10000; + WriteBasicType(outfile, binary, i2); + if (!binary) outfile << "\t"; + char c = Rand(); + WriteBasicType(outfile, binary, c); + if (!binary && Rand()%2 == 0) outfile << " \n"; + std::vector vec1; + WriteIntegerVector(outfile, binary, vec1); + if (!binary && Rand()%2 == 0) outfile << " \n"; + std::vector vec2; + for (size_t i = 0; i < 10; i++) vec2.push_back(Rand()%100 - 10); + WriteIntegerVector(outfile, binary, vec2); + if (!binary) outfile << " \n"; + std::vector vec3; + + int32 size = RandInt(0, 10); + for (size_t i = 0; i < size; i++) vec3.push_back(Rand()%100); + WriteIntegerVector(outfile, binary, vec3); + std::vector > vec4; + WriteIntegerPairVector(outfile, binary, vec4); + if (!binary && Rand()%2 == 0) outfile << " \n"; + std::vector > vec5; + for (size_t i = 0; i < size; i++) vec5.push_back(std::make_pair(Rand()%100 - 10, Rand()%100 - 10)); + WriteIntegerPairVector(outfile, binary, vec5); + if (!binary) outfile << " \n"; + std::vector > vec6; + for (size_t i = 0; i < size; i++) vec6.push_back(std::make_pair(Rand()%100, Rand()%100)); + WriteIntegerPairVector(outfile, binary, vec6); + if (!binary && Rand()%2 == 0) outfile << " \n"; + const char *token1 = "Hi"; + WriteToken(outfile, binary, token1); + if (!binary) outfile << " \n"; + std::string token2 = "There."; + WriteToken(outfile, binary, token2); + if (!binary && Rand()%2 == 0) outfile << " \n"; + std::string token3 = "You."; + WriteToken(outfile, binary, token3); + if (!binary && Rand()%2 == 0) outfile << " "; + float f1 = RandUniform(); + WriteBasicType(outfile, binary, f1); + if (!binary && Rand()%2 == 0) outfile << "\t"; + float f2 = RandUniform(); + WriteBasicType(outfile, binary, f2); + double d1 = RandUniform(); + WriteBasicType(outfile, binary, d1); + if (!binary && Rand()%2 == 0) outfile << "\t"; + double d2 = RandUniform(); + WriteBasicType(outfile, binary, d2); + if (!binary && Rand()%2 == 0) outfile << "\t"; + outfile.close(); + + { + std::ifstream infile(filename, std::ios_base::in | std::ios_base::binary); + bool binary_in; + InitKaldiInputStream(infile, &binary_in); + int64 i1_in; + ReadBasicType(infile, binary_in, &i1_in); + KALDI_ASSERT(i1_in == i1); + uint16 i2_in; + ReadBasicType(infile, binary_in, &i2_in); + KALDI_ASSERT(i2_in == i2); + char c_in; + ReadBasicType(infile, binary_in, &c_in); + KALDI_ASSERT(c_in == c); + std::vector vec1_in; + ReadIntegerVector(infile, binary_in, &vec1_in); + KALDI_ASSERT(vec1_in == vec1); + std::vector vec2_in; + ReadIntegerVector(infile, binary_in, &vec2_in); + KALDI_ASSERT(vec2_in == vec2); + std::vector vec3_in; + ReadIntegerVector(infile, binary_in, &vec3_in); + KALDI_ASSERT(vec3_in == vec3); + std::vector > vec4_in; + ReadIntegerPairVector(infile, binary_in, &vec4_in); + KALDI_ASSERT(vec4_in == vec4); + std::vector > vec5_in; + ReadIntegerPairVector(infile, binary_in, &vec5_in); + KALDI_ASSERT(vec5_in == vec5); + std::vector > vec6_in; + ReadIntegerPairVector(infile, binary_in, &vec6_in); + KALDI_ASSERT(vec6_in == vec6); + std::string token1_in, token2_in; + KALDI_ASSERT(Peek(infile, binary_in) == static_cast(*token1)); + KALDI_ASSERT(PeekToken(infile, binary_in) == static_cast(*token1)); + // Note: + // the stuff with skipping over '<' is tested in ../util/kaldi-io-test.cc, + // since we need to make sure it works with pipes. + ReadToken(infile, binary_in, &token1_in); + KALDI_ASSERT(token1_in == std::string(token1)); + ReadToken(infile, binary_in, &token2_in); + KALDI_ASSERT(token2_in == std::string(token2)); + if (Rand() % 2 == 0) + ExpectToken(infile, binary_in, token3.c_str()); + else + ExpectToken(infile, binary_in, token3); + float f1_in; // same type. + ReadBasicType(infile, binary_in, &f1_in); + AssertEqual(f1_in, f1); + double f2_in; // wrong type. + ReadBasicType(infile, binary_in, &f2_in); + AssertEqual(f2_in, f2); + double d1_in; // same type. + ReadBasicType(infile, binary_in, &d1_in); + AssertEqual(d1_in, d1); + float d2_in; // wrong type. + ReadBasicType(infile, binary_in, &d2_in); + AssertEqual(d2_in, d2); + KALDI_ASSERT(Peek(infile, binary_in) == -1); + KALDI_ASSERT(PeekToken(infile, binary_in) == -1); + } + unlink(filename); + } +} + + + +} // end namespace kaldi. + +int main() { + using namespace kaldi; + for (size_t i = 0; i < 10; i++) { + UnitTestIo(false); + UnitTestIo(true); + } + KALDI_ASSERT(1); // just to check that KALDI_ASSERT does not fail for 1. + return 0; +} + diff --git a/runtime/onnxruntime/third_party/kaldi/base/io-funcs.cc b/runtime/onnxruntime/third_party/kaldi/base/io-funcs.cc new file mode 100644 index 0000000..150f740 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/io-funcs.cc @@ -0,0 +1,218 @@ +// base/io-funcs.cc + +// Copyright 2009-2011 Microsoft Corporation; Saarland University + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "base/io-funcs.h" +#include "base/kaldi-math.h" + +namespace kaldi { + +template<> +void WriteBasicType(std::ostream &os, bool binary, bool b) { + os << (b ? "T":"F"); + if (!binary) os << " "; + if (os.fail()) + KALDI_ERR << "Write failure in WriteBasicType"; +} + +template<> +void ReadBasicType(std::istream &is, bool binary, bool *b) { + KALDI_PARANOID_ASSERT(b != NULL); + if (!binary) is >> std::ws; // eat up whitespace. + char c = is.peek(); + if (c == 'T') { + *b = true; + is.get(); + } else if (c == 'F') { + *b = false; + is.get(); + } else { + KALDI_ERR << "Read failure in ReadBasicType, file position is " + << is.tellg() << ", next char is " << CharToString(c); + } +} + +template<> +void WriteBasicType(std::ostream &os, bool binary, float f) { + if (binary) { + char c = sizeof(f); + os.put(c); + os.write(reinterpret_cast(&f), sizeof(f)); + } else { + os << f << " "; + } +} + +template<> +void WriteBasicType(std::ostream &os, bool binary, double f) { + if (binary) { + char c = sizeof(f); + os.put(c); + os.write(reinterpret_cast(&f), sizeof(f)); + } else { + os << f << " "; + } +} + +template<> +void ReadBasicType(std::istream &is, bool binary, float *f) { + KALDI_PARANOID_ASSERT(f != NULL); + if (binary) { + double d; + int c = is.peek(); + if (c == sizeof(*f)) { + is.get(); + is.read(reinterpret_cast(f), sizeof(*f)); + } else if (c == sizeof(d)) { + ReadBasicType(is, binary, &d); + *f = d; + } else { + KALDI_ERR << "ReadBasicType: expected float, saw " << is.peek() + << ", at file position " << is.tellg(); + } + } else { + is >> *f; + } + if (is.fail()) { + KALDI_ERR << "ReadBasicType: failed to read, at file position " + << is.tellg(); + } +} + +template<> +void ReadBasicType(std::istream &is, bool binary, double *d) { + KALDI_PARANOID_ASSERT(d != NULL); + if (binary) { + float f; + int c = is.peek(); + if (c == sizeof(*d)) { + is.get(); + is.read(reinterpret_cast(d), sizeof(*d)); + } else if (c == sizeof(f)) { + ReadBasicType(is, binary, &f); + *d = f; + } else { + KALDI_ERR << "ReadBasicType: expected float, saw " << is.peek() + << ", at file position " << is.tellg(); + } + } else { + is >> *d; + } + if (is.fail()) { + KALDI_ERR << "ReadBasicType: failed to read, at file position " + << is.tellg(); + } +} + +void CheckToken(const char *token) { + if (*token == '\0') + KALDI_ERR << "Token is empty (not a valid token)"; + const char *orig_token = token; + while (*token != '\0') { + if (::isspace(*token)) + KALDI_ERR << "Token is not a valid token (contains space): '" + << orig_token << "'"; + token++; + } +} + +void WriteToken(std::ostream &os, bool binary, const char *token) { + // binary mode is ignored; + // we use space as termination character in either case. + KALDI_ASSERT(token != NULL); + CheckToken(token); // make sure it's valid (can be read back) + os << token << " "; + if (os.fail()) { + KALDI_ERR << "Write failure in WriteToken."; + } +} + +int Peek(std::istream &is, bool binary) { + if (!binary) is >> std::ws; // eat up whitespace. + return is.peek(); +} + +void WriteToken(std::ostream &os, bool binary, const std::string & token) { + WriteToken(os, binary, token.c_str()); +} + +void ReadToken(std::istream &is, bool binary, std::string *str) { + KALDI_ASSERT(str != NULL); + if (!binary) is >> std::ws; // consume whitespace. + is >> *str; + if (is.fail()) { + KALDI_ERR << "ReadToken, failed to read token at file position " + << is.tellg(); + } + if (!isspace(is.peek())) { + KALDI_ERR << "ReadToken, expected space after token, saw instead " + << CharToString(static_cast(is.peek())) + << ", at file position " << is.tellg(); + } + is.get(); // consume the space. +} + +int PeekToken(std::istream &is, bool binary) { + if (!binary) is >> std::ws; // consume whitespace. + bool read_bracket; + if (static_cast(is.peek()) == '<') { + read_bracket = true; + is.get(); + } else { + read_bracket = false; + } + int ans = is.peek(); + if (read_bracket) { + if (!is.unget()) { + // Clear the bad bit. This code can be (and is in fact) reached, since the + // C++ standard does not guarantee that a call to unget() must succeed. + is.clear(); + } + } + return ans; +} + + +void ExpectToken(std::istream &is, bool binary, const char *token) { + int pos_at_start = is.tellg(); + KALDI_ASSERT(token != NULL); + CheckToken(token); // make sure it's valid (can be read back) + if (!binary) is >> std::ws; // consume whitespace. + std::string str; + is >> str; + is.get(); // consume the space. + if (is.fail()) { + KALDI_ERR << "Failed to read token [started at file position " + << pos_at_start << "], expected " << token; + } + // The second half of the '&&' expression below is so that if we're expecting + // "", we will accept "Foo>" instead. This is so that the model-reading + // code will tolerate errors in PeekToken where is.unget() failed; search for + // is.clear() in PeekToken() for an explanation. + if (strcmp(str.c_str(), token) != 0 && + !(token[0] == '<' && strcmp(str.c_str(), token + 1) == 0)) { + KALDI_ERR << "Expected token \"" << token << "\", got instead \"" + << str <<"\"."; + } +} + +void ExpectToken(std::istream &is, bool binary, const std::string &token) { + ExpectToken(is, binary, token.c_str()); +} + +} // end namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/base/io-funcs.h b/runtime/onnxruntime/third_party/kaldi/base/io-funcs.h new file mode 100644 index 0000000..895f661 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/io-funcs.h @@ -0,0 +1,245 @@ +// base/io-funcs.h + +// Copyright 2009-2011 Microsoft Corporation; Saarland University; +// Jan Silovsky; Yanmin Qian +// 2016 Xiaohui Zhang + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_BASE_IO_FUNCS_H_ +#define KALDI_BASE_IO_FUNCS_H_ + +// This header only contains some relatively low-level I/O functions. +// The full Kaldi I/O declarations are in ../util/kaldi-io.h +// and ../util/kaldi-table.h +// They were put in util/ in order to avoid making the Matrix library +// dependent on them. + +#include +#include +#include + +#include "base/kaldi-common.h" +#include "base/io-funcs-inl.h" + +namespace kaldi { + + + +/* + This comment describes the Kaldi approach to I/O. All objects can be written + and read in two modes: binary and text. In addition we want to make the I/O + work if we redefine the typedef "BaseFloat" between floats and doubles. + We also want to have control over whitespace in text mode without affecting + the meaning of the file, for pretty-printing purposes. + + Errors are handled by throwing a KaldiFatalError exception. + + For integer and floating-point types (and boolean values): + + WriteBasicType(std::ostream &, bool binary, const T&); + ReadBasicType(std::istream &, bool binary, T*); + + and we expect these functions to be defined in such a way that they work when + the type T changes between float and double, so you can read float into double + and vice versa]. Note that for efficiency and space-saving reasons, the Vector + and Matrix classes do not use these functions [but they preserve the type + interchangeability in their own way] + + For a class (or struct) C: + class C { + .. + Write(std::ostream &, bool binary, [possibly extra optional args for specific classes]) const; + Read(std::istream &, bool binary, [possibly extra optional args for specific classes]); + .. + } + NOTE: The only actual optional args we used are the "add" arguments in + Vector/Matrix classes, which specify whether we should sum the data already + in the class with the data being read. + + For types which are typedef's involving stl classes, I/O is as follows: + typedef std::vector > MyTypedefName; + + The user should define something like: + + WriteMyTypedefName(std::ostream &, bool binary, const MyTypedefName &t); + ReadMyTypedefName(std::ostream &, bool binary, MyTypedefName *t); + + The user would have to write these functions. + + For a type std::vector: + + void WriteIntegerVector(std::ostream &os, bool binary, const std::vector &v); + void ReadIntegerVector(std::istream &is, bool binary, std::vector *v); + + For other types, e.g. vectors of pairs, the user should create a routine of the + type WriteMyTypedefName. This is to avoid introducing confusing templated functions; + we could easily create templated functions to handle most of these cases but they + would have to share the same name. + + It also often happens that the user needs to write/read special tokens as part + of a file. These might be class headers, or separators/identifiers in the class. + We provide special functions for manipulating these. These special tokens must + be nonempty and must not contain any whitespace. + + void WriteToken(std::ostream &os, bool binary, const char*); + void WriteToken(std::ostream &os, bool binary, const std::string & token); + int Peek(std::istream &is, bool binary); + void ReadToken(std::istream &is, bool binary, std::string *str); + void PeekToken(std::istream &is, bool binary, std::string *str); + + WriteToken writes the token and one space (whether in binary or text mode). + + Peek returns the first character of the next token, by consuming whitespace + (in text mode) and then returning the peek() character. It returns -1 at EOF; + it doesn't throw. It's useful if a class can have various forms based on + typedefs and virtual classes, and wants to know which version to read. + + ReadToken allows the caller to obtain the next token. PeekToken works just + like ReadToken, but seeks back to the beginning of the token. A subsequent + call to ReadToken will read the same token again. This is useful when + different object types are written to the same file; using PeekToken one can + decide which of the objects to read. + + There is currently no special functionality for writing/reading strings (where the strings + contain data rather than "special tokens" that are whitespace-free and nonempty). This is + because Kaldi is structured in such a way that strings don't appear, except as OpenFst symbol + table entries (and these have their own format). + + + NOTE: you should not call ReadIntegerType and WriteIntegerType with types, + such as int and size_t, that are machine-independent -- at least not + if you want your file formats to port between machines. Use int32 and + int64 where necessary. There is no way to detect this using compile-time + assertions because C++ only keeps track of the internal representation of + the type. +*/ + +/// \addtogroup io_funcs_basic +/// @{ + + +/// WriteBasicType is the name of the write function for bool, integer types, +/// and floating-point types. They all throw on error. +template void WriteBasicType(std::ostream &os, bool binary, T t); + +/// ReadBasicType is the name of the read function for bool, integer types, +/// and floating-point types. They all throw on error. +template void ReadBasicType(std::istream &is, bool binary, T *t); + + +// Declare specialization for bool. +template<> +void WriteBasicType(std::ostream &os, bool binary, bool b); + +template <> +void ReadBasicType(std::istream &is, bool binary, bool *b); + +// Declare specializations for float and double. +template<> +void WriteBasicType(std::ostream &os, bool binary, float f); + +template<> +void WriteBasicType(std::ostream &os, bool binary, double f); + +template<> +void ReadBasicType(std::istream &is, bool binary, float *f); + +template<> +void ReadBasicType(std::istream &is, bool binary, double *f); + +// Define ReadBasicType that accepts an "add" parameter to add to +// the destination. Caution: if used in Read functions, be careful +// to initialize the parameters concerned to zero in the default +// constructor. +template +inline void ReadBasicType(std::istream &is, bool binary, T *t, bool add) { + if (!add) { + ReadBasicType(is, binary, t); + } else { + T tmp = T(0); + ReadBasicType(is, binary, &tmp); + *t += tmp; + } +} + +/// Function for writing STL vectors of integer types. +template inline void WriteIntegerVector(std::ostream &os, bool binary, + const std::vector &v); + +/// Function for reading STL vector of integer types. +template inline void ReadIntegerVector(std::istream &is, bool binary, + std::vector *v); + +/// Function for writing STL vectors of pairs of integer types. +template +inline void WriteIntegerPairVector(std::ostream &os, bool binary, + const std::vector > &v); + +/// Function for reading STL vector of pairs of integer types. +template +inline void ReadIntegerPairVector(std::istream &is, bool binary, + std::vector > *v); + +/// The WriteToken functions are for writing nonempty sequences of non-space +/// characters. They are not for general strings. +void WriteToken(std::ostream &os, bool binary, const char *token); +void WriteToken(std::ostream &os, bool binary, const std::string & token); + +/// Peek consumes whitespace (if binary == false) and then returns the peek() +/// value of the stream. +int Peek(std::istream &is, bool binary); + +/// ReadToken gets the next token and puts it in str (exception on failure). If +/// PeekToken() had been previously called, it is possible that the stream had +/// failed to unget the starting '<' character. In this case ReadToken() returns +/// the token string without the leading '<'. You must be prepared to handle +/// this case. ExpectToken() handles this internally, and is not affected. +void ReadToken(std::istream &is, bool binary, std::string *token); + +/// PeekToken will return the first character of the next token, or -1 if end of +/// file. It's the same as Peek(), except if the first character is '<' it will +/// skip over it and will return the next character. It will attempt to unget +/// the '<' so the stream is where it was before you did PeekToken(), however, +/// this is not guaranteed (see ReadToken()). +int PeekToken(std::istream &is, bool binary); + +/// ExpectToken tries to read in the given token, and throws an exception +/// on failure. +void ExpectToken(std::istream &is, bool binary, const char *token); +void ExpectToken(std::istream &is, bool binary, const std::string & token); + +/// ExpectPretty attempts to read the text in "token", but only in non-binary +/// mode. Throws exception on failure. It expects an exact match except that +/// arbitrary whitespace matches arbitrary whitespace. +void ExpectPretty(std::istream &is, bool binary, const char *token); +void ExpectPretty(std::istream &is, bool binary, const std::string & token); + +/// @} end "addtogroup io_funcs_basic" + + +/// InitKaldiOutputStream initializes an opened stream for writing by writing an +/// optional binary header and modifying the floating-point precision; it will +/// typically not be called by users directly. +inline void InitKaldiOutputStream(std::ostream &os, bool binary); + +/// InitKaldiInputStream initializes an opened stream for reading by detecting +/// the binary header and setting the "binary" value appropriately; +/// It will typically not be called by users directly. +inline bool InitKaldiInputStream(std::istream &is, bool *binary); + +} // end namespace kaldi. +#endif // KALDI_BASE_IO_FUNCS_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-common.h b/runtime/onnxruntime/third_party/kaldi/base/kaldi-common.h new file mode 100644 index 0000000..264565d --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-common.h @@ -0,0 +1,41 @@ +// base/kaldi-common.h + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_BASE_KALDI_COMMON_H_ +#define KALDI_BASE_KALDI_COMMON_H_ 1 + +#include +#include +#include // C string stuff like strcpy +#include +#include +#include +#include +#include +#include +#include + +#include "base/kaldi-utils.h" +#include "base/kaldi-error.h" +#include "base/kaldi-types.h" +#include "base/io-funcs.h" +#include "base/kaldi-math.h" +#include "base/timer.h" + +#endif // KALDI_BASE_KALDI_COMMON_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-error-test.cc b/runtime/onnxruntime/third_party/kaldi/base/kaldi-error-test.cc new file mode 100644 index 0000000..31440ed --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-error-test.cc @@ -0,0 +1,82 @@ +// base/kaldi-error-test.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "base/kaldi-common.h" + +// testing that we get the stack trace. +namespace kaldi { + +void MyFunction2() { KALDI_ERR << "Ignore this error"; } + +void MyFunction1() { MyFunction2(); } + +void UnitTestError() { + { + std::cerr << "Ignore next error:\n"; + MyFunction1(); + } +} + +void VerifySymbolRange(const std::string &trace, const bool want_found, + const std::string &want_symbol) { + size_t begin, end; + const bool found = internal::LocateSymbolRange(trace, &begin, &end); + if (found != want_found) { + KALDI_ERR << "Found mismatch, got " << found << " want " << want_found; + } + if (!found) { + return; + } + const std::string symbol = trace.substr(begin, end - begin); + if (symbol != want_symbol) { + KALDI_ERR << "Symbol mismatch, got " << symbol << " want " << want_symbol; + } +} + +void TestLocateSymbolRange() { + VerifySymbolRange("", false, ""); + VerifySymbolRange( + R"TRACE(./kaldi-error-test(_ZN5kaldi13UnitTestErrorEv+0xb) [0x804965d])TRACE", + true, "_ZN5kaldi13UnitTestErrorEv"); + // It is ok thread_start is not found because it is a C symbol. + VerifySymbolRange( + R"TRACE(31 libsystem_pthread.dylib 0x00007fff6fe4e40d thread_start + 13)TRACE", + false, ""); + VerifySymbolRange( + R"TRACE(0 server 0x000000010f67614d _ZNK5kaldi13MessageLogger10LogMessageEv + 813)TRACE", + true, "_ZNK5kaldi13MessageLogger10LogMessageEv"); + VerifySymbolRange( + R"TRACE(29 libsystem_pthread.dylib 0x00007fff6fe4f2eb _pthread_body + 126)TRACE", + true, "_pthread_body"); +} + +} // namespace kaldi + +int main() { + kaldi::TestLocateSymbolRange(); + + kaldi::SetProgramName("/foo/bar/kaldi-error-test"); + try { + kaldi::UnitTestError(); + KALDI_ASSERT(0); // should not happen. + exit(1); + } catch (kaldi::KaldiFatalError &e) { + std::cout << "The error we generated was: '" << e.KaldiMessage() << "'\n"; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-error.cc b/runtime/onnxruntime/third_party/kaldi/base/kaldi-error.cc new file mode 100644 index 0000000..2970bbe --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-error.cc @@ -0,0 +1,248 @@ +// base/kaldi-error.cc + +// Copyright 2019 LAIX (Yi Sun) +// Copyright 2019 SmartAction LLC (kkm) +// Copyright 2016 Brno University of Technology (author: Karel Vesely) +// Copyright 2009-2011 Microsoft Corporation; Lukas Burget; Ondrej Glembek + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifdef HAVE_EXECINFO_H +#include // To get stack trace in error messages. +// If this #include fails there is an error in the Makefile, it does not +// support your platform well. Make sure HAVE_EXECINFO_H is undefined, +// and the code will compile. +#ifdef HAVE_CXXABI_H +#include // For name demangling. +// Useful to decode the stack trace, but only used if we have execinfo.h +#endif // HAVE_CXXABI_H +#endif // HAVE_EXECINFO_H + +#include "base/kaldi-common.h" +#include "base/kaldi-error.h" + +// KALDI_GIT_HEAD is useless currently in full repo +//#if !defined(KALDI_VERSION) +//#include "base/version.h" +//#endif + +namespace kaldi { + +/***** GLOBAL VARIABLES FOR LOGGING *****/ + +int32 g_kaldi_verbose_level = 0; +static std::string program_name; +static LogHandler log_handler = NULL; + +void SetProgramName(const char *basename) { + // Using the 'static std::string' for the program name is mostly harmless, + // because (a) Kaldi logging is undefined before main(), and (b) no stdc++ + // string implementation has been found in the wild that would not be just + // an empty string when zero-initialized but not yet constructed. + program_name = basename; +} + +/***** HELPER FUNCTIONS *****/ + +// Trim filename to at most 1 trailing directory long. Given a filename like +// "/a/b/c/d/e/f.cc", return "e/f.cc". Support both '/' and '\' as the path +// separator. +static const char *GetShortFileName(const char *path) { + if (path == nullptr) + return ""; + + const char *prev = path, *last = path; + while ((path = std::strpbrk(path, "\\/")) != nullptr) { + ++path; + prev = last; + last = path; + } + return prev; +} + +/***** STACK TRACE *****/ + +namespace internal { +bool LocateSymbolRange(const std::string &trace_name, size_t *begin, + size_t *end) { + // Find the first '_' with leading ' ' or '('. + *begin = std::string::npos; + for (size_t i = 1; i < trace_name.size(); i++) { + if (trace_name[i] != '_') { + continue; + } + if (trace_name[i - 1] == ' ' || trace_name[i - 1] == '(') { + *begin = i; + break; + } + } + if (*begin == std::string::npos) { + return false; + } + *end = trace_name.find_first_of(" +", *begin); + return *end != std::string::npos; +} +} // namespace internal + +#ifdef HAVE_EXECINFO_H +static std::string Demangle(std::string trace_name) { +#ifndef HAVE_CXXABI_H + return trace_name; +#else // HAVE_CXXABI_H + // Try demangle the symbol. We are trying to support the following formats + // produced by different platforms: + // + // Linux: + // ./kaldi-error-test(_ZN5kaldi13UnitTestErrorEv+0xb) [0x804965d] + // + // Mac: + // 0 server 0x000000010f67614d _ZNK5kaldi13MessageLogger10LogMessageEv + 813 + // + // We want to extract the name e.g., '_ZN5kaldi13UnitTestErrorEv' and + // demangle it info a readable name like kaldi::UnitTextError. + size_t begin, end; + if (!internal::LocateSymbolRange(trace_name, &begin, &end)) { + return trace_name; + } + std::string symbol = trace_name.substr(begin, end - begin); + int status; + char *demangled_name = abi::__cxa_demangle(symbol.c_str(), 0, 0, &status); + if (status == 0 && demangled_name != nullptr) { + symbol = demangled_name; + free(demangled_name); + } + return trace_name.substr(0, begin) + symbol + + trace_name.substr(end, std::string::npos); +#endif // HAVE_CXXABI_H +} +#endif // HAVE_EXECINFO_H + +static std::string KaldiGetStackTrace() { + std::string ans; +#ifdef HAVE_EXECINFO_H + const size_t KALDI_MAX_TRACE_SIZE = 50; + const size_t KALDI_MAX_TRACE_PRINT = 50; // Must be even. + // Buffer for the trace. + void *trace[KALDI_MAX_TRACE_SIZE]; + // Get the trace. + size_t size = backtrace(trace, KALDI_MAX_TRACE_SIZE); + // Get the trace symbols. + char **trace_symbol = backtrace_symbols(trace, size); + if (trace_symbol == NULL) + return ans; + + // Compose a human-readable backtrace string. + ans += "[ Stack-Trace: ]\n"; + if (size <= KALDI_MAX_TRACE_PRINT) { + for (size_t i = 0; i < size; i++) { + ans += Demangle(trace_symbol[i]) + "\n"; + } + } else { // Print out first+last (e.g.) 5. + for (size_t i = 0; i < KALDI_MAX_TRACE_PRINT / 2; i++) { + ans += Demangle(trace_symbol[i]) + "\n"; + } + ans += ".\n.\n.\n"; + for (size_t i = size - KALDI_MAX_TRACE_PRINT / 2; i < size; i++) { + ans += Demangle(trace_symbol[i]) + "\n"; + } + if (size == KALDI_MAX_TRACE_SIZE) + ans += ".\n.\n.\n"; // Stack was too long, probably a bug. + } + + // We must free the array of pointers allocated by backtrace_symbols(), + // but not the strings themselves. + free(trace_symbol); +#endif // HAVE_EXECINFO_H + return ans; +} + +/***** KALDI LOGGING *****/ + +MessageLogger::MessageLogger(LogMessageEnvelope::Severity severity, + const char *func, const char *file, int32 line) { + // Obviously, we assume the strings survive the destruction of this object. + envelope_.severity = severity; + envelope_.func = func; + envelope_.file = GetShortFileName(file); // Points inside 'file'. + envelope_.line = line; +} + +void MessageLogger::LogMessage() const { + // Send to the logging handler if provided. + if (log_handler != NULL) { + log_handler(envelope_, GetMessage().c_str()); + return; + } + + // Otherwise, use the default Kaldi logging. + // Build the log-message header. + std::stringstream full_message; + if (envelope_.severity > LogMessageEnvelope::kInfo) { + full_message << "VLOG[" << envelope_.severity << "] ("; + } else { + switch (envelope_.severity) { + case LogMessageEnvelope::kInfo: + //full_message << "LOG (\n"; + break; + case LogMessageEnvelope::kWarning: + //full_message << "WARNING (\n"; + break; + case LogMessageEnvelope::kAssertFailed: + full_message << "ASSERTION_FAILED (\n"; + break; + case LogMessageEnvelope::kError: + default: // If not the ERROR, it still an error! + full_message << "ERROR (\n"; + break; + } + } + // Add other info from the envelope and the message text. + //full_message << program_name.c_str() << "[" KALDI_VERSION "]" << ':' + // << envelope_.func << "():" << envelope_.file << ':' + // << envelope_.line << ") " << GetMessage().c_str(); + + // Add stack trace for errors and assertion failures, if available. + if (envelope_.severity < LogMessageEnvelope::kWarning) { + const std::string &stack_trace = KaldiGetStackTrace(); + if (!stack_trace.empty()) { + full_message << "\n\n" << stack_trace; + } + } + + // Print the complete message to stderr. + std::cerr << full_message.str(); +} + +/***** KALDI ASSERTS *****/ + +void KaldiAssertFailure_(const char *func, const char *file, int32 line, + const char *cond_str) { + MessageLogger::Log() = + MessageLogger(LogMessageEnvelope::kAssertFailed, func, file, line) + << "Assertion failed: (" << cond_str << ")"; + fflush(NULL); // Flush all pending buffers, abort() may not flush stderr. + std::abort(); +} + +/***** THIRD-PARTY LOG-HANDLER *****/ + +LogHandler SetLogHandler(LogHandler handler) { + LogHandler old_handler = log_handler; + log_handler = handler; + return old_handler; +} + +} // namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-error.h b/runtime/onnxruntime/third_party/kaldi/base/kaldi-error.h new file mode 100644 index 0000000..b150a02 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-error.h @@ -0,0 +1,231 @@ +// base/kaldi-error.h + +// Copyright 2019 LAIX (Yi Sun) +// Copyright 2019 SmartAction LLC (kkm) +// Copyright 2016 Brno University of Technology (author: Karel Vesely) +// Copyright 2009-2011 Microsoft Corporation; Ondrej Glembek; Lukas Burget; +// Saarland University + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_BASE_KALDI_ERROR_H_ +#define KALDI_BASE_KALDI_ERROR_H_ 1 + +#include +#include +#include +#include +#include +#include + +#include "base/kaldi-types.h" +#include "base/kaldi-utils.h" +/* Important that this file does not depend on any other kaldi headers. */ + +#ifdef _MSC_VER +#define __func__ __FUNCTION__ +#endif + +namespace kaldi { + +/// \addtogroup error_group +/// @{ + +/***** PROGRAM NAME AND VERBOSITY LEVEL *****/ + +/// Called by ParseOptions to set base name (no directory) of the executing +/// program. The name is printed in logging code along with every message, +/// because in our scripts, we often mix together the stderr of many programs. +/// This function is very thread-unsafe. +void SetProgramName(const char *basename); + +/// This is set by util/parse-options.{h,cc} if you set --verbose=? option. +/// Do not use directly, prefer {Get,Set}VerboseLevel(). +extern int32 g_kaldi_verbose_level; + +/// Get verbosity level, usually set via command line '--verbose=' switch. +inline int32 GetVerboseLevel() { return g_kaldi_verbose_level; } + +/// This should be rarely used, except by programs using Kaldi as library; +/// command-line programs set the verbose level automatically from ParseOptions. +inline void SetVerboseLevel(int32 i) { g_kaldi_verbose_level = i; } + +/***** KALDI LOGGING *****/ + +/// Log message severity and source location info. +struct LogMessageEnvelope { + /// Message severity. In addition to these levels, positive values (1 to 6) + /// specify verbose logging level. Verbose messages are produced only when + /// SetVerboseLevel() has been called to set logging level to at least the + /// corresponding value. + enum Severity { + kAssertFailed = -3, //!< Assertion failure. abort() will be called. + kError = -2, //!< Fatal error. KaldiFatalError will be thrown. + kWarning = -1, //!< Indicates a recoverable but abnormal condition. + kInfo = 0, //!< Informational message. + }; + int severity; //!< A Severity value, or positive verbosity level. + const char *func; //!< Name of the function invoking the logging. + const char *file; //!< Source file name with up to 1 leading directory. + int32 line; // MessageLogger &operator<<(const T &val) { + ss_ << val; + return *this; + } + + // When assigned a MessageLogger, log its contents. + struct Log final { + void operator=(const MessageLogger &logger) { logger.LogMessage(); } + }; + + // When assigned a MessageLogger, log its contents and then throw + // a KaldiFatalError. + struct LogAndThrow final { + [[noreturn]] void operator=(const MessageLogger &logger) { + logger.LogMessage(); + throw KaldiFatalError(logger.GetMessage()); + } + }; + +private: + std::string GetMessage() const { return ss_.str(); } + void LogMessage() const; + + LogMessageEnvelope envelope_; + std::ostringstream ss_; +}; + +// Logging macros. +#define KALDI_ERR \ + ::kaldi::MessageLogger::LogAndThrow() = ::kaldi::MessageLogger( \ + ::kaldi::LogMessageEnvelope::kError, __func__, __FILE__, __LINE__) +#define KALDI_WARN \ + ::kaldi::MessageLogger::Log() = ::kaldi::MessageLogger( \ + ::kaldi::LogMessageEnvelope::kWarning, __func__, __FILE__, __LINE__) +#define KALDI_LOG \ + ::kaldi::MessageLogger::Log() = ::kaldi::MessageLogger( \ + ::kaldi::LogMessageEnvelope::kInfo, __func__, __FILE__, __LINE__) +#define KALDI_VLOG(v) \ + if ((v) <= ::kaldi::GetVerboseLevel()) \ + ::kaldi::MessageLogger::Log() = \ + ::kaldi::MessageLogger((::kaldi::LogMessageEnvelope::Severity)(v), \ + __func__, __FILE__, __LINE__) + +/***** KALDI ASSERTS *****/ + +[[noreturn]] void KaldiAssertFailure_(const char *func, const char *file, + int32 line, const char *cond_str); + +// Note on KALDI_ASSERT and KALDI_PARANOID_ASSERT: +// +// A single block {} around if /else does not work, because it causes +// syntax error (unmatched else block) in the following code: +// +// if (condition) +// KALDI_ASSERT(condition2); +// else +// SomethingElse(); +// +// do {} while(0) -- note there is no semicolon at the end! -- works nicely, +// and compilers will be able to optimize the loop away (as the condition +// is always false). +// +// Also see KALDI_COMPILE_TIME_ASSERT, defined in base/kaldi-utils.h, and +// KALDI_ASSERT_IS_INTEGER_TYPE and KALDI_ASSERT_IS_FLOATING_TYPE, also defined +// there. +#ifndef NDEBUG +#define KALDI_ASSERT(cond) \ + do { \ + if (cond) \ + (void)0; \ + else \ + ::kaldi::KaldiAssertFailure_(__func__, __FILE__, __LINE__, #cond); \ + } while (0) +#else +#define KALDI_ASSERT(cond) (void)0 +#endif + +// Some more expensive asserts only checked if this defined. +#ifdef KALDI_PARANOID +#define KALDI_PARANOID_ASSERT(cond) \ + do { \ + if (cond) \ + (void)0; \ + else \ + ::kaldi::KaldiAssertFailure_(__func__, __FILE__, __LINE__, #cond); \ + } while (0) +#else +#define KALDI_PARANOID_ASSERT(cond) (void)0 +#endif + +/***** THIRD-PARTY LOG-HANDLER *****/ + +/// Type of third-party logging function. +typedef void (*LogHandler)(const LogMessageEnvelope &envelope, + const char *message); + +/// Set logging handler. If called with a non-NULL function pointer, the +/// function pointed by it is called to send messages to a caller-provided log. +/// If called with a NULL pointer, restores default Kaldi error logging to +/// stderr. This function is obviously not thread safe; the log handler must be. +/// Returns a previously set logging handler pointer, or NULL. +LogHandler SetLogHandler(LogHandler); + +/// @} end "addtogroup error_group" + +//// Functions within internal is exported for testing only, do not use. +//namespace internal { +//bool LocateSymbolRange(const std::string &trace_name, size_t *begin, +// size_t *end); +//} // namespace internal +} // namespace kaldi + +#endif // KALDI_BASE_KALDI_ERROR_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-math-test.cc b/runtime/onnxruntime/third_party/kaldi/base/kaldi-math-test.cc new file mode 100644 index 0000000..8d6e616 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-math-test.cc @@ -0,0 +1,334 @@ +// base/kaldi-math-test.cc +// +// Copyright 2009-2011 Microsoft Corporation; Yanmin Qian; Jan Silovsky + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. +#include "base/kaldi-math.h" +#include +#include "base/timer.h" + +namespace kaldi { + +template void UnitTestGcdLcmTpl() { + for (I a = 1; a < 15; a++) { // a is min gcd. + I b = (I)(Rand() % 10); + I c = (I)(Rand() % 10); + if (std::numeric_limits::is_signed) { + if (Rand() % 2 == 0) b = -b; + if (Rand() % 2 == 0) c = -c; + } + if (b == 0 && c == 0) continue; // gcd not defined for such numbers. + I g = Gcd(b*a, c*a); + KALDI_ASSERT(g >= a); + KALDI_ASSERT((b*a) % g == 0); + KALDI_ASSERT((c*a) % g == 0); + + // test least common multiple + if (b <= 0 || c <= 0) continue; // lcm not defined unless both positive. + I h = Lcm(b*a, c*a); + KALDI_ASSERT(h != 0 && (h % (b*a)) == 0 && + (h % (c*a)) == 0); + } +} + +void UnitTestRoundUpToNearestPowerOfTwo() { + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(1) == 1); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(2) == 2); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(3) == 4); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(4) == 4); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(7) == 8); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(8) == 8); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(255) == 256); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(256) == 256); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(257) == 512); + KALDI_ASSERT(RoundUpToNearestPowerOfTwo(1073700000) == 1073741824); +} + +void UnitTestDivideRoundingDown() { + for (int32 i = 0; i < 100; i++) { + int32 a = RandInt(-100, 100); + int32 b = 0; + while (b == 0) + b = RandInt(-100, 100); + KALDI_ASSERT(DivideRoundingDown(a, b) == + std::floor(static_cast(a) / static_cast(b))); + } +} + +void UnitTestGcdLcm() { + UnitTestGcdLcmTpl(); + UnitTestGcdLcmTpl(); + UnitTestGcdLcmTpl(); +} + +void UnitTestRand() { + // Testing random-number generation. + std::cout << "Testing random-number generation. " + << "If there is an error this may not terminate.\n"; + std::cout << "If this does not terminate, look more closely. " + << "There might be a problem [but might not be]\n"; + for (int i = 1; i < 10; i++) { + { // test RandUniform. + std::cout << "Test RandUniform\n"; + KALDI_ASSERT(RandUniform() >= 0 && RandUniform() <= 1); + float sum = RandUniform()-0.5; + for (int j = 0; ; j++) { + sum += RandUniform()-0.5; + if (std::abs(sum) < 0.5*sqrt(static_cast(j))) break; + } + } + { // test RandGauss. + float sum = RandGauss(); + for (int j = 0; ; j++) { + sum += RandGauss(); + if (std::abs(sum) < 0.5*sqrt(static_cast(j))) break; + } + } + { // test RandGauss. + float sum = RandGauss(); + for (int j = 0; ; j++) { + float a, b; + RandGauss2(&a, &b); + if (i % 2 == 0) sum += a; + else + sum += b; + if (std::abs(sum) < 0.5*sqrt(static_cast(j))) break; + } + } + { // test poisson_Rand(). + KALDI_ASSERT(RandPoisson(3.0) >= 0); + KALDI_ASSERT(RandPoisson(0.0) == 0); + std::cout << "Test RandPoisson\n"; + float lambda = RandUniform() * 3.0; // between 0 and 3. + double sum = RandPoisson(lambda) - lambda; // expected value is zero. + for (int j = 0; ; j++) { + sum += RandPoisson(lambda) - lambda; + if (std::abs(sum) < 0.5*sqrt(static_cast(j))) break; + } + } + + { // test WithProb(). + for (int32 i = 0; i < 10; i++) { + KALDI_ASSERT((WithProb(0.0) == false) && (WithProb(1.0) == true)); + } + { + int32 tot = 0, n = 10000; + BaseFloat p = 0.5; + for (int32 i = 0; i < n; i++) + tot += WithProb(p); + KALDI_ASSERT(tot > (n * p * 0.8) && tot < (n * p * 1.2)); + } + { + int32 tot = 0, n = 10000; + BaseFloat p = 0.25; + for (int32 i = 0; i < n; i++) + tot += WithProb(p); + KALDI_ASSERT(tot > (n * p * 0.8) && tot < (n * p * 1.2)); + } + } + { // test RandInt(). + KALDI_ASSERT(RandInt(0, 3) >= 0 && RandInt(0, 3) <= 3); + + std::cout << "Test RandInt\n"; + int minint = Rand() % 200; + int maxint = minint + 1 + Rand() % 20; + + float sum = RandInt(minint, maxint) + 0.5*(minint+maxint); + for (int j = 0; ; j++) { + sum += RandInt(minint, maxint) - 0.5*(minint+maxint); + if (std::abs(static_cast(sum)) < + 0.5*sqrt(static_cast(j))*(maxint-minint)) break; + } + } + { // test RandPrune in basic way. + KALDI_ASSERT(RandPrune(1.1, 1.0) == 1.1); + KALDI_ASSERT(RandPrune(0.0, 0.0) == 0.0); + KALDI_ASSERT(RandPrune(-1.1, 1.0) == -1.1); + KALDI_ASSERT(RandPrune(0.0, 1.0) == 0.0); + KALDI_ASSERT(RandPrune(0.5, 1.0) >= 0.0); + KALDI_ASSERT(RandPrune(-0.5, 1.0) <= 0.0); + BaseFloat f = RandPrune(-0.5, 1.0); + KALDI_ASSERT(f == 0.0 || f == -1.0); + f = RandPrune(0.5, 1.0); + KALDI_ASSERT(f == 0.0 || f == 1.0); + } + } +} + +void UnitTestLogAddSub() { + for (int i = 0; i < 100; i++) { + double f1 = Rand() % 10000, f2 = Rand() % 20; + double add1 = Exp(LogAdd(Log(f1), Log(f2))); + double add2 = Exp(LogAdd(Log(f2), Log(f1))); + double add = f1 + f2, thresh = add*0.00001; + KALDI_ASSERT(std::abs(add-add1) < thresh && std::abs(add-add2) < thresh); + + + try { + double f2_check = Exp(LogSub(Log(add), Log(f1))), + thresh = (f2*0.01)+0.001; + KALDI_ASSERT(std::abs(f2_check-f2) < thresh); + } catch(...) { + KALDI_ASSERT(f2 == 0); // It will probably crash for f2=0. + } + } +} + +void UnitTestDefines() { // Yes, we even unit-test the preprocessor statements. + KALDI_ASSERT(Exp(kLogZeroFloat) == 0.0); + KALDI_ASSERT(Exp(kLogZeroDouble) == 0.0); + BaseFloat den = 0.0; + KALDI_ASSERT(KALDI_ISNAN(0.0 / den)); + KALDI_ASSERT(!KALDI_ISINF(0.0 / den)); + KALDI_ASSERT(!KALDI_ISFINITE(0.0 / den)); + KALDI_ASSERT(!KALDI_ISNAN(1.0 / den)); + KALDI_ASSERT(KALDI_ISINF(1.0 / den)); + KALDI_ASSERT(!KALDI_ISFINITE(1.0 / den)); + KALDI_ASSERT(KALDI_ISFINITE(0.0)); + KALDI_ASSERT(!KALDI_ISINF(0.0)); + KALDI_ASSERT(!KALDI_ISNAN(0.0)); + + std::cout << 1.0+DBL_EPSILON; + std::cout << 1.0 + 0.5*DBL_EPSILON; + KALDI_ASSERT(1.0 + DBL_EPSILON != 1.0 && 1.0 + (0.5*DBL_EPSILON) == 1.0 + && "If this test fails, you can probably just comment it out-- " + "may mean your CPU exceeds expected floating point precision"); + KALDI_ASSERT(1.0f + FLT_EPSILON != 1.0f && 1.0f + (0.5f*FLT_EPSILON) == 1.0f + && "If this test fails, you can probably just comment it out-- " + "may mean your CPU exceeds expected floating point precision"); + KALDI_ASSERT(std::abs(sin(M_PI)) < 1.0e-05 + && std::abs(cos(M_PI)+1.0) < 1.0e-05); + KALDI_ASSERT(std::abs(sin(M_2PI)) < 1.0e-05 + && std::abs(cos(M_2PI)-1.0) < 1.0e-05); + KALDI_ASSERT(std::abs(sin(Exp(M_LOG_2PI))) < 1.0e-05); + KALDI_ASSERT(std::abs(cos(Exp(M_LOG_2PI)) - 1.0) < 1.0e-05); +} + +void UnitTestAssertFunc() { // Testing Assert** *functions + for (int i = 1; i < 100; i++) { + float f1 = Rand() % 10000 + 1, f2 = Rand() % 20 + 1; + float tmp1 = f1 * f2; + float tmp2 = (1/f1 + 1/f2); + float add = f1 + f2; + float addeql = tmp1 * tmp2; + float thresh = 0.00001; + AssertEqual(add, addeql, thresh); // test AssertEqual() + } +} + +template void UnitTestFactorizeTpl() { + for (int p= 0; p < 100; p++) { + I m = Rand() % 100000; + if (m >= 1) { + std::vector factors; + Factorize(m, &factors); + I m2 = 1; + for (size_t i = 0; i < factors.size(); i++) { + m2 *= factors[i]; + if (i+1 < factors.size()) + KALDI_ASSERT(factors[i+1] >= factors[i]); // check sorted. + } + KALDI_ASSERT(m2 == m); // check correctness. + } + } +} + +void UnitTestFactorize() { + UnitTestFactorizeTpl(); + UnitTestFactorizeTpl(); + UnitTestFactorizeTpl(); +} + +void UnitTestApproxEqual() { + KALDI_ASSERT(ApproxEqual(1.0, 1.00001)); + KALDI_ASSERT(ApproxEqual(1.0, 1.00001, 0.001)); + KALDI_ASSERT(!ApproxEqual(1.0, 1.1)); + KALDI_ASSERT(!ApproxEqual(1.0, 1.01, 0.001)); + KALDI_ASSERT(!ApproxEqual(1.0, 0.0)); + KALDI_ASSERT(ApproxEqual(0.0, 0.0)); + KALDI_ASSERT(!ApproxEqual(0.0, 0.00001)); + KALDI_ASSERT(!ApproxEqual(std::numeric_limits::infinity(), + -std::numeric_limits::infinity())); + KALDI_ASSERT(ApproxEqual(std::numeric_limits::infinity(), + std::numeric_limits::infinity())); + KALDI_ASSERT(ApproxEqual(-std::numeric_limits::infinity(), + -std::numeric_limits::infinity())); + KALDI_ASSERT(!ApproxEqual(-std::numeric_limits::infinity(), + 0)); + KALDI_ASSERT(!ApproxEqual(-std::numeric_limits::infinity(), + 1)); +} + +template +void UnitTestExpSpeed() { + Real sum = 0.0; // compute the sum to avoid optimizing it away. + Real time = 0.01; // how long this should last. + int block_size = 10; + int num_ops = 0; + Timer tim; + while (tim.Elapsed() < time) { + for (int i = 0; i < block_size; i++) { + sum += Exp((Real)i); + } + num_ops += block_size; + } + KALDI_ASSERT(sum > 0.0); // make it harder for the compiler to optimize Exp + // away, as we have a conditional. + Real flops = 1.0e-06 * num_ops / tim.Elapsed(); + KALDI_LOG << "Megaflops doing Exp(" + << (sizeof(Real) == 4 ? "float" : "double") << ") is " << flops; +} + + +template +void UnitTestLogSpeed() { + Real sum = 0.0; // compute the sum to avoid optimizing it away. + Real time = 0.01; // how long this should last. + int block_size = 10; + int num_ops = 0; + Timer tim; + while (tim.Elapsed() < time) { + for (int i = 0; i < block_size; i++) { + sum += Log(static_cast(i + 1)); + } + num_ops += block_size; + } + KALDI_ASSERT(sum > 0.0); // make it harder for the compiler to optimize Log + // away, as we have a conditional. + Real flops = 1.0e-06 * num_ops / tim.Elapsed(); + KALDI_LOG << "Megaflops doing Log(" + << (sizeof(Real) == 4 ? "float" : "double") << ") is " << flops; +} + +} // end namespace kaldi. + +int main() { + using namespace kaldi; + UnitTestApproxEqual(); + UnitTestGcdLcm(); + UnitTestFactorize(); + UnitTestDefines(); + UnitTestLogAddSub(); + UnitTestRand(); + UnitTestAssertFunc(); + UnitTestRoundUpToNearestPowerOfTwo(); + UnitTestDivideRoundingDown(); + UnitTestExpSpeed(); + UnitTestExpSpeed(); + UnitTestLogSpeed(); + UnitTestLogSpeed(); +} + diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-math.cc b/runtime/onnxruntime/third_party/kaldi/base/kaldi-math.cc new file mode 100644 index 0000000..f60d6c0 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-math.cc @@ -0,0 +1,162 @@ +// base/kaldi-math.cc + +// Copyright 2009-2011 Microsoft Corporation; Yanmin Qian; +// Saarland University; Jan Silovsky + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "base/kaldi-math.h" +#ifndef _MSC_VER +#include +#include +#endif +#include +#include + +namespace kaldi { +// These routines are tested in matrix/matrix-test.cc + +int32 RoundUpToNearestPowerOfTwo(int32 n) { + KALDI_ASSERT(n > 0); + n--; + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + return n+1; +} + +static std::mutex _RandMutex; + +int Rand(struct RandomState* state) { +#if !defined(_POSIX_THREAD_SAFE_FUNCTIONS) + // On Windows and Cygwin, just call Rand() + return rand(); +#else + if (state) { + return rand_r(&(state->seed)); + } else { + std::lock_guard lock(_RandMutex); + return rand(); + } +#endif +} + +RandomState::RandomState() { + // we initialize it as Rand() + 27437 instead of just Rand(), because on some + // systems, e.g. at the very least Mac OSX Yosemite and later, it seems to be + // the case that rand_r when initialized with rand() will give you the exact + // same sequence of numbers that rand() will give if you keep calling rand() + // after that initial call. This can cause problems with repeated sequences. + // For example if you initialize two RandomState structs one after the other + // without calling rand() in between, they would give you the same sequence + // offset by one (if we didn't have the "+ 27437" in the code). 27437 is just + // a randomly chosen prime number. + seed = unsigned(Rand()) + 27437; +} + +bool WithProb(BaseFloat prob, struct RandomState* state) { + KALDI_ASSERT(prob >= 0 && prob <= 1.1); // prob should be <= 1.0, + // but we allow slightly larger values that could arise from roundoff in + // previous calculations. + KALDI_COMPILE_TIME_ASSERT(RAND_MAX > 128 * 128); + if (prob == 0) return false; + else if (prob == 1.0) return true; + else if (prob * RAND_MAX < 128.0) { + // prob is very small but nonzero, and the "main algorithm" + // wouldn't work that well. So: with probability 1/128, we + // return WithProb (prob * 128), else return false. + if (Rand(state) < RAND_MAX / 128) { // with probability 128... + // Note: we know that prob * 128.0 < 1.0, because + // we asserted RAND_MAX > 128 * 128. + return WithProb(prob * 128.0); + } else { + return false; + } + } else { + return (Rand(state) < ((RAND_MAX + static_cast(1.0)) * prob)); + } +} + +int32 RandInt(int32 min_val, int32 max_val, struct RandomState* state) { + // This is not exact. + KALDI_ASSERT(max_val >= min_val); + if (max_val == min_val) return min_val; + +#ifdef _MSC_VER + // RAND_MAX is quite small on Windows -> may need to handle larger numbers. + if (RAND_MAX > (max_val-min_val)*8) { + // *8 to avoid large inaccuracies in probability, from the modulus... + return min_val + + ((unsigned int)Rand(state) % (unsigned int)(max_val+1-min_val)); + } else { + if ((unsigned int)(RAND_MAX*RAND_MAX) > + (unsigned int)((max_val+1-min_val)*8)) { + // *8 to avoid inaccuracies in probability, from the modulus... + return min_val + ( (unsigned int)( (Rand(state)+RAND_MAX*Rand(state))) + % (unsigned int)(max_val+1-min_val)); + } else { + KALDI_ERR << "rand_int failed because we do not support such large " + "random numbers. (Extend this function)."; + } + } +#else + return min_val + + (static_cast(Rand(state)) % static_cast(max_val+1-min_val)); +#endif +} + +// Returns poisson-distributed random number. +// Take care: this takes time proportional +// to lambda. Faster algorithms exist but are more complex. +int32 RandPoisson(float lambda, struct RandomState* state) { + // Knuth's algorithm. + KALDI_ASSERT(lambda >= 0); + float L = expf(-lambda), p = 1.0; + int32 k = 0; + do { + k++; + float u = RandUniform(state); + p *= u; + } while (p > L); + return k-1; +} + +void RandGauss2(float *a, float *b, RandomState *state) { + KALDI_ASSERT(a); + KALDI_ASSERT(b); + float u1 = RandUniform(state); + float u2 = RandUniform(state); + u1 = sqrtf(-2.0f * logf(u1)); + u2 = 2.0f * M_PI * u2; + *a = u1 * cosf(u2); + *b = u1 * sinf(u2); +} + +void RandGauss2(double *a, double *b, RandomState *state) { + KALDI_ASSERT(a); + KALDI_ASSERT(b); + float a_float, b_float; + // Just because we're using doubles doesn't mean we need super-high-quality + // random numbers, so we just use the floating-point version internally. + RandGauss2(&a_float, &b_float, state); + *a = a_float; + *b = b_float; +} + + +} // end namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-math.h b/runtime/onnxruntime/third_party/kaldi/base/kaldi-math.h new file mode 100644 index 0000000..93c265e --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-math.h @@ -0,0 +1,363 @@ +// base/kaldi-math.h + +// Copyright 2009-2011 Ondrej Glembek; Microsoft Corporation; Yanmin Qian; +// Jan Silovsky; Saarland University +// +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_BASE_KALDI_MATH_H_ +#define KALDI_BASE_KALDI_MATH_H_ 1 + +#ifdef _MSC_VER +#include +#endif + +#include +#include +#include + +#include "base/kaldi-types.h" +#include "base/kaldi-common.h" + + +#ifndef DBL_EPSILON +#define DBL_EPSILON 2.2204460492503131e-16 +#endif +#ifndef FLT_EPSILON +#define FLT_EPSILON 1.19209290e-7f +#endif + +#ifndef M_PI +#define M_PI 3.1415926535897932384626433832795 +#endif + +#ifndef M_SQRT2 +#define M_SQRT2 1.4142135623730950488016887 +#endif + +#ifndef M_2PI +#define M_2PI 6.283185307179586476925286766559005 +#endif + +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.7071067811865475244008443621048490 +#endif + +#ifndef M_LOG_2PI +#define M_LOG_2PI 1.8378770664093454835606594728112 +#endif + +#ifndef M_LN2 +#define M_LN2 0.693147180559945309417232121458 +#endif + +#ifndef M_LN10 +#define M_LN10 2.302585092994045684017991454684 +#endif + + +#define KALDI_ISNAN std::isnan +#define KALDI_ISINF std::isinf +#define KALDI_ISFINITE(x) std::isfinite(x) + +#if !defined(KALDI_SQR) +# define KALDI_SQR(x) ((x) * (x)) +#endif + +namespace kaldi { + +#if !defined(_MSC_VER) || (_MSC_VER >= 1900) +inline double Exp(double x) { return exp(x); } +#ifndef KALDI_NO_EXPF +inline float Exp(float x) { return expf(x); } +#else +inline float Exp(float x) { return exp(static_cast(x)); } +#endif // KALDI_NO_EXPF +#else +inline double Exp(double x) { return exp(x); } +#if !defined(__INTEL_COMPILER) && _MSC_VER == 1800 && defined(_M_X64) +// Microsoft CL v18.0 buggy 64-bit implementation of +// expf() incorrectly returns -inf for exp(-inf). +inline float Exp(float x) { return exp(static_cast(x)); } +#else +inline float Exp(float x) { return expf(x); } +#endif // !defined(__INTEL_COMPILER) && _MSC_VER == 1800 && defined(_M_X64) +#endif // !defined(_MSC_VER) || (_MSC_VER >= 1900) + +inline double Log(double x) { return log(x); } +inline float Log(float x) { return logf(x); } + +#if !defined(_MSC_VER) || (_MSC_VER >= 1700) +inline double Log1p(double x) { return log1p(x); } +inline float Log1p(float x) { return log1pf(x); } +#else +inline double Log1p(double x) { + const double cutoff = 1.0e-08; + if (x < cutoff) + return x - 0.5 * x * x; + else + return Log(1.0 + x); +} + +inline float Log1p(float x) { + const float cutoff = 1.0e-07; + if (x < cutoff) + return x - 0.5 * x * x; + else + return Log(1.0 + x); +} +#endif + +static const double kMinLogDiffDouble = Log(DBL_EPSILON); // negative! +static const float kMinLogDiffFloat = Log(FLT_EPSILON); // negative! + +// -infinity +const float kLogZeroFloat = -std::numeric_limits::infinity(); +const double kLogZeroDouble = -std::numeric_limits::infinity(); +const BaseFloat kLogZeroBaseFloat = -std::numeric_limits::infinity(); + +// Returns a random integer between 0 and RAND_MAX, inclusive +int Rand(struct RandomState* state = NULL); + +// State for thread-safe random number generator +struct RandomState { + RandomState(); + unsigned seed; +}; + +// Returns a random integer between first and last inclusive. +int32 RandInt(int32 first, int32 last, struct RandomState* state = NULL); + +// Returns true with probability "prob", +bool WithProb(BaseFloat prob, struct RandomState* state = NULL); +// with 0 <= prob <= 1 [we check this]. +// Internally calls Rand(). This function is carefully implemented so +// that it should work even if prob is very small. + +/// Returns a random number strictly between 0 and 1. +inline float RandUniform(struct RandomState* state = NULL) { + return static_cast((Rand(state) + 1.0) / (RAND_MAX+2.0)); +} + +inline float RandGauss(struct RandomState* state = NULL) { + return static_cast(sqrtf (-2 * Log(RandUniform(state))) + * cosf(2*M_PI*RandUniform(state))); +} + +// Returns poisson-distributed random number. Uses Knuth's algorithm. +// Take care: this takes time proportional +// to lambda. Faster algorithms exist but are more complex. +int32 RandPoisson(float lambda, struct RandomState* state = NULL); + +// Returns a pair of gaussian random numbers. Uses Box-Muller transform +void RandGauss2(float *a, float *b, RandomState *state = NULL); +void RandGauss2(double *a, double *b, RandomState *state = NULL); + +// Also see Vector::RandCategorical(). + +// This is a randomized pruning mechanism that preserves expectations, +// that we typically use to prune posteriors. +template +inline Float RandPrune(Float post, BaseFloat prune_thresh, + struct RandomState* state = NULL) { + KALDI_ASSERT(prune_thresh >= 0.0); + if (post == 0.0 || std::abs(post) >= prune_thresh) + return post; + return (post >= 0 ? 1.0 : -1.0) * + (RandUniform(state) <= fabs(post)/prune_thresh ? prune_thresh : 0.0); +} + +// returns log(exp(x) + exp(y)). +inline double LogAdd(double x, double y) { + double diff; + + if (x < y) { + diff = x - y; + x = y; + } else { + diff = y - x; + } + // diff is negative. x is now the larger one. + + if (diff >= kMinLogDiffDouble) { + double res; + res = x + Log1p(Exp(diff)); + return res; + } else { + return x; // return the larger one. + } +} + + +// returns log(exp(x) + exp(y)). +inline float LogAdd(float x, float y) { + float diff; + + if (x < y) { + diff = x - y; + x = y; + } else { + diff = y - x; + } + // diff is negative. x is now the larger one. + + if (diff >= kMinLogDiffFloat) { + float res; + res = x + Log1p(Exp(diff)); + return res; + } else { + return x; // return the larger one. + } +} + + +// returns log(exp(x) - exp(y)). +inline double LogSub(double x, double y) { + if (y >= x) { // Throws exception if y>=x. + if (y == x) + return kLogZeroDouble; + else + KALDI_ERR << "Cannot subtract a larger from a smaller number."; + } + + double diff = y - x; // Will be negative. + double res = x + Log(1.0 - Exp(diff)); + + // res might be NAN if diff ~0.0, and 1.0-exp(diff) == 0 to machine precision + if (KALDI_ISNAN(res)) + return kLogZeroDouble; + return res; +} + + +// returns log(exp(x) - exp(y)). +inline float LogSub(float x, float y) { + if (y >= x) { // Throws exception if y>=x. + if (y == x) + return kLogZeroDouble; + else + KALDI_ERR << "Cannot subtract a larger from a smaller number."; + } + + float diff = y - x; // Will be negative. + float res = x + Log(1.0f - Exp(diff)); + + // res might be NAN if diff ~0.0, and 1.0-exp(diff) == 0 to machine precision + if (KALDI_ISNAN(res)) + return kLogZeroFloat; + return res; +} + +/// return abs(a - b) <= relative_tolerance * (abs(a)+abs(b)). +static inline bool ApproxEqual(float a, float b, + float relative_tolerance = 0.001) { + // a==b handles infinities. + if (a == b) return true; + float diff = std::abs(a-b); + if (diff == std::numeric_limits::infinity() + || diff != diff) return false; // diff is +inf or nan. + return (diff <= relative_tolerance*(std::abs(a)+std::abs(b))); +} + +/// assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b)) +static inline void AssertEqual(float a, float b, + float relative_tolerance = 0.001) { + // a==b handles infinities. + KALDI_ASSERT(ApproxEqual(a, b, relative_tolerance)); +} + + +// RoundUpToNearestPowerOfTwo does the obvious thing. It crashes if n <= 0. +int32 RoundUpToNearestPowerOfTwo(int32 n); + +/// Returns a / b, rounding towards negative infinity in all cases. +static inline int32 DivideRoundingDown(int32 a, int32 b) { + KALDI_ASSERT(b != 0); + if (a * b >= 0) + return a / b; + else if (a < 0) + return (a - b + 1) / b; + else + return (a - b - 1) / b; +} + +template I Gcd(I m, I n) { + if (m == 0 || n == 0) { + if (m == 0 && n == 0) { // gcd not defined, as all integers are divisors. + KALDI_ERR << "Undefined GCD since m = 0, n = 0."; + } + return (m == 0 ? (n > 0 ? n : -n) : ( m > 0 ? m : -m)); + // return absolute value of whichever is nonzero + } + // could use compile-time assertion + // but involves messing with complex template stuff. + KALDI_ASSERT(std::numeric_limits::is_integer); + while (1) { + m %= n; + if (m == 0) return (n > 0 ? n : -n); + n %= m; + if (n == 0) return (m > 0 ? m : -m); + } +} + +/// Returns the least common multiple of two integers. Will +/// crash unless the inputs are positive. +template I Lcm(I m, I n) { + KALDI_ASSERT(m > 0 && n > 0); + I gcd = Gcd(m, n); + return gcd * (m/gcd) * (n/gcd); +} + + +template void Factorize(I m, std::vector *factors) { + // Splits a number into its prime factors, in sorted order from + // least to greatest, with duplication. A very inefficient + // algorithm, which is mainly intended for use in the + // mixed-radix FFT computation (where we assume most factors + // are small). + KALDI_ASSERT(factors != NULL); + KALDI_ASSERT(m >= 1); // Doesn't work for zero or negative numbers. + factors->clear(); + I small_factors[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 }; + + // First try small factors. + for (I i = 0; i < 10; i++) { + if (m == 1) return; // We're done. + while (m % small_factors[i] == 0) { + m /= small_factors[i]; + factors->push_back(small_factors[i]); + } + } + // Next try all odd numbers starting from 31. + for (I j = 31;; j += 2) { + if (m == 1) return; + while (m % j == 0) { + m /= j; + factors->push_back(j); + } + } +} + +inline double Hypot(double x, double y) { return hypot(x, y); } +inline float Hypot(float x, float y) { return hypotf(x, y); } + + + + +} // namespace kaldi + + +#endif // KALDI_BASE_KALDI_MATH_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-types.h b/runtime/onnxruntime/third_party/kaldi/base/kaldi-types.h new file mode 100644 index 0000000..7ebf4f8 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-types.h @@ -0,0 +1,75 @@ +// base/kaldi-types.h + +// Copyright 2009-2011 Microsoft Corporation; Saarland University; +// Jan Silovsky; Yanmin Qian + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_BASE_KALDI_TYPES_H_ +#define KALDI_BASE_KALDI_TYPES_H_ 1 + +namespace kaldi { +// TYPEDEFS .................................................................. +#if (KALDI_DOUBLEPRECISION != 0) +typedef double BaseFloat; +#else +typedef float BaseFloat; +#endif +} + +#ifdef _MSC_VER +#include +#define ssize_t SSIZE_T +#endif + +// we can do this a different way if some platform +// we find in the future lacks stdint.h +#include + +// for discussion on what to do if you need compile kaldi +// without OpenFST, see the bottom of this this file +#include + +namespace kaldi { + using ::int16; + using ::int32; + using ::int64; + using ::uint16; + using ::uint32; + using ::uint64; + typedef float float32; + typedef double double64; +} // end namespace kaldi + +// In a theoretical case you decide compile Kaldi without the OpenFST +// comment the previous namespace statement and uncomment the following +/* +namespace kaldi { + typedef int8_t int8; + typedef int16_t int16; + typedef int32_t int32; + typedef int64_t int64; + + typedef uint8_t uint8; + typedef uint16_t uint16; + typedef uint32_t uint32; + typedef uint64_t uint64; + typedef float float32; + typedef double double64; +} // end namespace kaldi +*/ + +#endif // KALDI_BASE_KALDI_TYPES_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-utils.cc b/runtime/onnxruntime/third_party/kaldi/base/kaldi-utils.cc new file mode 100644 index 0000000..0c0f1d4 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-utils.cc @@ -0,0 +1,46 @@ +// base/kaldi-utils.cc +// Copyright 2009-2011 Karel Vesely; Yanmin Qian; Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "base/kaldi-utils.h" + +#include +#include +#include +#include + + +namespace kaldi { + +std::string CharToString(const char &c) { + char buf[20]; + if (std::isprint(c)) + std::snprintf(buf, sizeof(buf), "\'%c\'", c); + else + std::snprintf(buf, sizeof(buf), "[character %d]", static_cast(c)); + return buf; +} + +void Sleep(double sec) { + // duration_cast<> rounds down, add 0.5 to compensate. + auto dur_nanos = std::chrono::duration(sec * 1E9 + 0.5); + auto dur_syshires = std::chrono::duration_cast< + typename std::chrono::high_resolution_clock::duration>(dur_nanos); + std::this_thread::sleep_for(dur_syshires); +} + +} // end namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/base/kaldi-utils.h b/runtime/onnxruntime/third_party/kaldi/base/kaldi-utils.h new file mode 100644 index 0000000..9f2c897 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/kaldi-utils.h @@ -0,0 +1,162 @@ +// base/kaldi-utils.h + +// Copyright 2009-2011 Ondrej Glembek; Microsoft Corporation; +// Saarland University; Karel Vesely; Yanmin Qian + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_BASE_KALDI_UTILS_H_ +#define KALDI_BASE_KALDI_UTILS_H_ 1 + +#if _MSC_VER +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#ifndef NOMINMAX +#define NOMINMAX 1 +#endif +#include +#endif + +#ifdef _MSC_VER +#include +#define unlink _unlink +#else +#include +#endif + +#include +#include + +#if defined(_MSC_VER) +#pragma warning(disable: 4244 4056 4305 4800 4267 4996 4756 4661) +#if _MSC_VER < 1400 +#define __restrict__ +#else +#define __restrict__ __restrict +#endif +#endif + +#if defined(_MSC_VER) +# define KALDI_MEMALIGN(align, size, pp_orig) \ + (*(pp_orig) = _aligned_malloc(size, align)) +# define KALDI_MEMALIGN_FREE(x) _aligned_free(x) +#elif defined(__CYGWIN__) +# define KALDI_MEMALIGN(align, size, pp_orig) \ + (*(pp_orig) = aligned_alloc(align, size)) +# define KALDI_MEMALIGN_FREE(x) free(x) +#else +# define KALDI_MEMALIGN(align, size, pp_orig) \ + (!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL) +# define KALDI_MEMALIGN_FREE(x) free(x) +#endif + +#ifdef __ICC +#pragma warning(disable: 383) // ICPC remark we don't want. +#pragma warning(disable: 810) // ICPC remark we don't want. +#pragma warning(disable: 981) // ICPC remark we don't want. +#pragma warning(disable: 1418) // ICPC remark we don't want. +#pragma warning(disable: 444) // ICPC remark we don't want. +#pragma warning(disable: 869) // ICPC remark we don't want. +#pragma warning(disable: 1287) // ICPC remark we don't want. +#pragma warning(disable: 279) // ICPC remark we don't want. +#pragma warning(disable: 981) // ICPC remark we don't want. +#endif + + +namespace kaldi { + + +// CharToString prints the character in a human-readable form, for debugging. +std::string CharToString(const char &c); + + +inline int MachineIsLittleEndian() { + int check = 1; + return (*reinterpret_cast(&check) != 0); +} + +// This function kaldi::Sleep() provides a portable way +// to sleep for a possibly fractional +// number of seconds. On Windows it's only accurate to microseconds. +void Sleep(double seconds); +} + +#define KALDI_SWAP8(a) do { \ + int t = (reinterpret_cast(&a))[0];\ + (reinterpret_cast(&a))[0]=(reinterpret_cast(&a))[7];\ + (reinterpret_cast(&a))[7]=t;\ + t = (reinterpret_cast(&a))[1];\ + (reinterpret_cast(&a))[1]=(reinterpret_cast(&a))[6];\ + (reinterpret_cast(&a))[6]=t;\ + t = (reinterpret_cast(&a))[2];\ + (reinterpret_cast(&a))[2]=(reinterpret_cast(&a))[5];\ + (reinterpret_cast(&a))[5]=t;\ + t = (reinterpret_cast(&a))[3];\ + (reinterpret_cast(&a))[3]=(reinterpret_cast(&a))[4];\ + (reinterpret_cast(&a))[4]=t;} while (0) +#define KALDI_SWAP4(a) do { \ + int t = (reinterpret_cast(&a))[0];\ + (reinterpret_cast(&a))[0]=(reinterpret_cast(&a))[3];\ + (reinterpret_cast(&a))[3]=t;\ + t = (reinterpret_cast(&a))[1];\ + (reinterpret_cast(&a))[1]=(reinterpret_cast(&a))[2];\ + (reinterpret_cast(&a))[2]=t;} while (0) +#define KALDI_SWAP2(a) do { \ + int t = (reinterpret_cast(&a))[0];\ + (reinterpret_cast(&a))[0]=(reinterpret_cast(&a))[1];\ + (reinterpret_cast(&a))[1]=t;} while (0) + + +///\brief Declare deleted copy constructor and copy assignment operator=(). +/// +/// Use this macro in the \e public part of a class declaration in a header +/// file, next to its constructors, so that uncopyability of the type is +/// clearly readable. Place a semicolon after it. +///\param type The exact enclosing class name. +#define KALDI_DISALLOW_COPY_AND_ASSIGN(type) \ + type(const type&) = delete; \ + type& operator=(const type&) = delete + +#if __cplusplus >= 201703L +#define KALDI_COMPILE_TIME_ASSERT static_assert +#else +#define KALDI_COMPILE_TIME_ASSERT(b) static_assert((b), #b) +#endif + +#define KALDI_ASSERT_IS_INTEGER_TYPE(I) \ + KALDI_COMPILE_TIME_ASSERT(std::numeric_limits::is_specialized \ + && std::numeric_limits::is_integer) + +#define KALDI_ASSERT_IS_FLOATING_TYPE(F) \ + KALDI_COMPILE_TIME_ASSERT(std::numeric_limits::is_specialized \ + && !std::numeric_limits::is_integer) + +#if defined(_MSC_VER) +#define KALDI_STRCASECMP _stricmp +#elif defined(__CYGWIN__) +#include +#define KALDI_STRCASECMP strcasecmp +#else +#define KALDI_STRCASECMP strcasecmp +#endif +#ifdef _MSC_VER +# define KALDI_STRTOLL(cur_cstr, end_cstr) _strtoi64(cur_cstr, end_cstr, 10); +#else +# define KALDI_STRTOLL(cur_cstr, end_cstr) strtoll(cur_cstr, end_cstr, 10); +#endif + +#endif // KALDI_BASE_KALDI_UTILS_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/base/timer-test.cc b/runtime/onnxruntime/third_party/kaldi/base/timer-test.cc new file mode 100644 index 0000000..86a20b4 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/timer-test.cc @@ -0,0 +1,45 @@ +// base/timer-test.cc + +// Copyright 2009-2011 Microsoft Corporation +// 2014 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "base/timer.h" +#include "base/kaldi-common.h" +#include "base/kaldi-utils.h" + + +namespace kaldi { + +void TimerTest() { + float time_secs = 0.025 * (rand() % 10); + std::cout << "target is " << time_secs << "\n"; + Timer timer; + Sleep(time_secs); + BaseFloat f = timer.Elapsed(); + std::cout << "time is " << f << std::endl; + if (fabs(time_secs - f) > 0.05) + KALDI_ERR << "Timer fail: waited " << f << " seconds instead of " + << time_secs << " secs."; +} +} + + +int main() { + for (int i = 0; i < 4; i++) + kaldi::TimerTest(); +} diff --git a/runtime/onnxruntime/third_party/kaldi/base/timer.cc b/runtime/onnxruntime/third_party/kaldi/base/timer.cc new file mode 100644 index 0000000..ce4ef29 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/timer.cc @@ -0,0 +1,85 @@ +// base/timer.cc + +// Copyright 2018 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "base/timer.h" +#include "base/kaldi-error.h" +#include +#include +#include +#include + +namespace kaldi { + +class ProfileStats { + public: + void AccStats(const char *function_name, double elapsed) { + std::unordered_map::iterator + iter = map_.find(function_name); + if (iter == map_.end()) { + map_[function_name] = ProfileStatsEntry(function_name); + map_[function_name].total_time = elapsed; + } else { + iter->second.total_time += elapsed; + } + } + ~ProfileStats() { + // This map makes sure we agglomerate the time if there were any duplicate + // addresses of strings. + std::unordered_map total_time; + for (auto iter = map_.begin(); iter != map_.end(); iter++) + total_time[iter->second.name] += iter->second.total_time; + + ReverseSecondComparator comp; + std::vector > pairs(total_time.begin(), + total_time.end()); + std::sort(pairs.begin(), pairs.end(), comp); + for (size_t i = 0; i < pairs.size(); i++) { + KALDI_LOG << "Time taken in " << pairs[i].first << " is " + << std::fixed << std::setprecision(2) << pairs[i].second << "s."; + } + } + private: + + struct ProfileStatsEntry { + std::string name; + double total_time; + ProfileStatsEntry() { } + ProfileStatsEntry(const char *name): name(name) { } + }; + + struct ReverseSecondComparator { + bool operator () (const std::pair &a, + const std::pair &b) { + return a.second > b.second; + } + }; + + // Note: this map is keyed on the address of the string, there is no proper + // hash function. The assumption is that the strings are compile-time + // constants. + std::unordered_map map_; +}; + +ProfileStats g_profile_stats; + +Profiler::~Profiler() { + g_profile_stats.AccStats(name_, tim_.Elapsed()); +} + +} // namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/base/timer.h b/runtime/onnxruntime/third_party/kaldi/base/timer.h new file mode 100644 index 0000000..0e03376 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/base/timer.h @@ -0,0 +1,115 @@ +// base/timer.h + +// Copyright 2009-2011 Ondrej Glembek; Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. +#ifndef KALDI_BASE_TIMER_H_ +#define KALDI_BASE_TIMER_H_ + +#include "base/kaldi-utils.h" +#include "base/kaldi-error.h" + + +#if defined(_MSC_VER) || defined(MINGW) + +namespace kaldi { +class Timer { + public: + Timer() { Reset(); } + + // You can initialize with bool to control whether or not you want the time to + // be set when the object is created. + explicit Timer(bool set_timer) { if (set_timer) Reset(); } + + void Reset() { + QueryPerformanceCounter(&time_start_); + } + double Elapsed() const { + LARGE_INTEGER time_end; + LARGE_INTEGER freq; + QueryPerformanceCounter(&time_end); + + if (QueryPerformanceFrequency(&freq) == 0) { + // Hardware does not support this. + return 0.0; + } + return (static_cast(time_end.QuadPart) - + static_cast(time_start_.QuadPart)) / + (static_cast(freq.QuadPart)); + } + private: + LARGE_INTEGER time_start_; +}; + + +#else +#include +#include + +namespace kaldi { +class Timer { + public: + Timer() { Reset(); } + + // You can initialize with bool to control whether or not you want the time to + // be set when the object is created. + explicit Timer(bool set_timer) { if (set_timer) Reset(); } + + void Reset() { gettimeofday(&this->time_start_, &time_zone_); } + + /// Returns time in seconds. + double Elapsed() const { + struct timeval time_end; + struct timezone time_zone; + gettimeofday(&time_end, &time_zone); + double t1, t2; + t1 = static_cast(time_start_.tv_sec) + + static_cast(time_start_.tv_usec)/(1000*1000); + t2 = static_cast(time_end.tv_sec) + + static_cast(time_end.tv_usec)/(1000*1000); + return t2-t1; + } + + private: + struct timeval time_start_; + struct timezone time_zone_; +}; + +#endif + +class Profiler { + public: + // Caution: the 'const char' should always be a string constant; for speed, + // internally the profiling code uses the address of it as a lookup key. + Profiler(const char *function_name): name_(function_name) { } + ~Profiler(); + private: + Timer tim_; + const char *name_; +}; + +// To add timing info for a function, you just put +// KALDI_PROFILE; +// at the beginning of the function. Caution: this doesn't +// include the class name. +#define KALDI_PROFILE Profiler _profiler(__func__) + + + +} // namespace kaldi + + +#endif // KALDI_BASE_TIMER_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/Makefile b/runtime/onnxruntime/third_party/kaldi/decoder/Makefile new file mode 100644 index 0000000..a814931 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/Makefile @@ -0,0 +1,20 @@ +all: + +EXTRA_CXXFLAGS = -Wno-sign-compare +include ../kaldi.mk + +TESTFILES = + +OBJFILES = training-graph-compiler.o lattice-simple-decoder.o lattice-faster-decoder.o \ + lattice-faster-online-decoder.o simple-decoder.o faster-decoder.o \ + decoder-wrappers.o grammar-fst.o decodable-matrix.o \ + lattice-incremental-decoder.o lattice-incremental-online-decoder.o + +LIBNAME = kaldi-decoder + +ADDLIBS = ../lat/kaldi-lat.a ../fstext/kaldi-fstext.a ../hmm/kaldi-hmm.a \ + ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a \ + ../tree/kaldi-tree.a ../util/kaldi-util.a ../matrix/kaldi-matrix.a \ + ../base/kaldi-base.a + +include ../makefiles/default_rules.mk diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/biglm-faster-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/biglm-faster-decoder.h new file mode 100644 index 0000000..8e36deb --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/biglm-faster-decoder.h @@ -0,0 +1,502 @@ +// decoder/biglm-faster-decoder.h + +// Copyright 2009-2011 Microsoft Corporation, Gilles Boulianne + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_BIGLM_FASTER_DECODER_H_ +#define KALDI_DECODER_BIGLM_FASTER_DECODER_H_ + +#include "util/stl-utils.h" +#include "util/hash-list.h" +#include "fst/fstlib.h" +#include "itf/decodable-itf.h" +#include "lat/kaldi-lattice.h" // for CompactLatticeArc +#include "decoder/faster-decoder.h" // for options class +#include "fstext/deterministic-fst.h" + +namespace kaldi { + +struct BiglmFasterDecoderOptions: public FasterDecoderOptions { + BiglmFasterDecoderOptions() { + min_active = 200; + } +}; + +/** This is as FasterDecoder, but does online composition between + HCLG and the "difference language model", which is a deterministic + FST that represents the difference between the language model you want + and the language model you compiled HCLG with. The class + DeterministicOnDemandFst follows through the epsilons in G for you + (assuming G is a standard backoff language model) and makes it look + like a determinized FST. Actually, in practice, + DeterministicOnDemandFst operates in a mode where it composes two + G's together; one has negated likelihoods and works by removing the + LM probabilities that you made HCLG with, and one is the language model + you want to use. +*/ +class BiglmFasterDecoder { + public: + typedef fst::StdArc Arc; + typedef Arc::Label Label; + typedef Arc::StateId StateId; + // A PairId will be constructed as: (StateId in fst) + (StateId in lm_diff_fst) << 32; + typedef uint64 PairId; + typedef Arc::Weight Weight; + + // This constructor is the same as for FasterDecoder, except the second + // argument (lm_diff_fst) is new; it's an FST (actually, a + // DeterministicOnDemandFst) that represents the difference in LM scores + // between the LM we want and the LM the decoding-graph "fst" was built with. + // See e.g. gmm-decode-biglm-faster.cc for an example of how this is called. + // Basically, we are using fst o lm_diff_fst (where o is composition) + // as the decoding graph. Instead of having everything indexed by the state in + // "fst", we now index by the pair of states in (fst, lm_diff_fst). + // Whenever we cross a word, we need to propagate the state within + // lm_diff_fst. + BiglmFasterDecoder(const fst::Fst &fst, + const BiglmFasterDecoderOptions &opts, + fst::DeterministicOnDemandFst *lm_diff_fst): + fst_(fst), lm_diff_fst_(lm_diff_fst), opts_(opts), warned_noarc_(false) { + KALDI_ASSERT(opts_.hash_ratio >= 1.0); // less doesn't make much sense. + KALDI_ASSERT(opts_.max_active > 1); + KALDI_ASSERT(fst.Start() != fst::kNoStateId && + lm_diff_fst->Start() != fst::kNoStateId); + toks_.SetSize(1000); // just so on the first frame we do something reasonable. + } + + void SetOptions(const BiglmFasterDecoderOptions &opts) { opts_ = opts; } + + ~BiglmFasterDecoder() { + ClearToks(toks_.Clear()); + } + + void Decode(DecodableInterface *decodable) { + // clean up from last time: + ClearToks(toks_.Clear()); + PairId start_pair = ConstructPair(fst_.Start(), lm_diff_fst_->Start()); + Arc dummy_arc(0, 0, Weight::One(), fst_.Start()); // actually, the last element of + // the Arcs (fst_.Start(), here) is never needed. + toks_.Insert(start_pair, new Token(dummy_arc, NULL)); + ProcessNonemitting(std::numeric_limits::max()); + for (int32 frame = 0; !decodable->IsLastFrame(frame-1); frame++) { + BaseFloat weight_cutoff = ProcessEmitting(decodable, frame); + ProcessNonemitting(weight_cutoff); + } + } + + bool ReachedFinal() { + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) { + PairId state_pair = e->key; + StateId state = PairToState(state_pair), + lm_state = PairToLmState(state_pair); + Weight this_weight = + Times(e->val->weight_, + Times(fst_.Final(state), lm_diff_fst_->Final(lm_state))); + if (this_weight != Weight::Zero()) + return true; + } + return false; + } + + bool GetBestPath(fst::MutableFst *fst_out, + bool use_final_probs = true) { + // GetBestPath gets the decoding output. If "use_final_probs" is true + // AND we reached a final state, it limits itself to final states; + // otherwise it gets the most likely token not taking into + // account final-probs. fst_out will be empty (Start() == kNoStateId) if + // nothing was available. It returns true if it got output (thus, fst_out + // will be nonempty). + fst_out->DeleteStates(); + Token *best_tok = NULL; + Weight best_final = Weight::Zero(); // set only if is_final == true. The + // final-prob corresponding to the best final token (i.e. the one with best + // weight best_weight, below). + bool is_final = ReachedFinal(); + if (!is_final) { + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) + if (best_tok == NULL || *best_tok < *(e->val) ) + best_tok = e->val; + } else { + Weight best_weight = Weight::Zero(); + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) { + Weight fst_final = fst_.Final(PairToState(e->key)), + lm_final = lm_diff_fst_->Final(PairToLmState(e->key)), + final = Times(fst_final, lm_final); + Weight this_weight = Times(e->val->weight_, final); + if (this_weight != Weight::Zero() && + this_weight.Value() < best_weight.Value()) { + best_weight = this_weight; + best_final = final; + best_tok = e->val; + } + } + } + if (best_tok == NULL) return false; // No output. + + std::vector arcs_reverse; // arcs in reverse order. + + for (Token *tok = best_tok; tok != NULL; tok = tok->prev_) { + BaseFloat tot_cost = tok->weight_.Value() - + (tok->prev_ ? tok->prev_->weight_.Value() : 0.0), + graph_cost = tok->arc_.weight.Value(), + ac_cost = tot_cost - graph_cost; + LatticeArc l_arc(tok->arc_.ilabel, + tok->arc_.olabel, + LatticeWeight(graph_cost, ac_cost), + tok->arc_.nextstate); + arcs_reverse.push_back(l_arc); + } + KALDI_ASSERT(arcs_reverse.back().nextstate == fst_.Start()); + arcs_reverse.pop_back(); // that was a "fake" token... gives no info. + + StateId cur_state = fst_out->AddState(); + fst_out->SetStart(cur_state); + for (ssize_t i = static_cast(arcs_reverse.size())-1; i >= 0; i--) { + LatticeArc arc = arcs_reverse[i]; + arc.nextstate = fst_out->AddState(); + fst_out->AddArc(cur_state, arc); + cur_state = arc.nextstate; + } + if (is_final && use_final_probs) { + fst_out->SetFinal(cur_state, LatticeWeight(best_final.Value(), 0.0)); + } else { + fst_out->SetFinal(cur_state, LatticeWeight::One()); + } + RemoveEpsLocal(fst_out); + return true; + } + + private: + inline PairId ConstructPair(StateId fst_state, StateId lm_state) { + return static_cast(fst_state) + (static_cast(lm_state) << 32); + } + + static inline StateId PairToState(PairId state_pair) { + return static_cast(static_cast(state_pair)); + } + static inline StateId PairToLmState(PairId state_pair) { + return static_cast(static_cast(state_pair >> 32)); + } + + class Token { + public: + Arc arc_; // contains only the graph part of the cost, + // including the part in "fst" (== HCLG) plus lm_diff_fst. + // We can work out the acoustic part from difference between + // "weight_" and prev->weight_. + Token *prev_; + int32 ref_count_; + Weight weight_; // weight up to current point. + inline Token(const Arc &arc, Weight &ac_weight, Token *prev): + arc_(arc), prev_(prev), ref_count_(1) { + if (prev) { + prev->ref_count_++; + weight_ = Times(Times(prev->weight_, arc.weight), ac_weight); + } else { + weight_ = Times(arc.weight, ac_weight); + } + } + inline Token(const Arc &arc, Token *prev): + arc_(arc), prev_(prev), ref_count_(1) { + if (prev) { + prev->ref_count_++; + weight_ = Times(prev->weight_, arc.weight); + } else { + weight_ = arc.weight; + } + } + inline bool operator < (const Token &other) { + return weight_.Value() > other.weight_.Value(); + // This makes sense for log + tropical semiring. + } + + inline ~Token() { + KALDI_ASSERT(ref_count_ == 1); + if (prev_ != NULL) TokenDelete(prev_); + } + inline static void TokenDelete(Token *tok) { + if (tok->ref_count_ == 1) { + delete tok; + } else { + tok->ref_count_--; + } + } + }; + typedef HashList::Elem Elem; + + + /// Gets the weight cutoff. Also counts the active tokens. + BaseFloat GetCutoff(Elem *list_head, size_t *tok_count, + BaseFloat *adaptive_beam, Elem **best_elem) { + BaseFloat best_weight = 1.0e+10; // positive == high cost == bad. + size_t count = 0; + if (opts_.max_active == std::numeric_limits::max() && + opts_.min_active == 0) { + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = static_cast(e->val->weight_.Value()); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + if (adaptive_beam != NULL) *adaptive_beam = opts_.beam; + return best_weight + opts_.beam; + } else { + tmp_array_.clear(); + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = e->val->weight_.Value(); + tmp_array_.push_back(w); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + + BaseFloat beam_cutoff = best_weight + opts_.beam, + min_active_cutoff = std::numeric_limits::infinity(), + max_active_cutoff = std::numeric_limits::infinity(); + + if (tmp_array_.size() > static_cast(opts_.max_active)) { + std::nth_element(tmp_array_.begin(), + tmp_array_.begin() + opts_.max_active, + tmp_array_.end()); + max_active_cutoff = tmp_array_[opts_.max_active]; + } + if (tmp_array_.size() > static_cast(opts_.min_active)) { + if (opts_.min_active == 0) min_active_cutoff = best_weight; + else { + std::nth_element(tmp_array_.begin(), + tmp_array_.begin() + opts_.min_active, + tmp_array_.size() > static_cast(opts_.max_active) ? + tmp_array_.begin() + opts_.max_active : + tmp_array_.end()); + min_active_cutoff = tmp_array_[opts_.min_active]; + } + } + + if (max_active_cutoff < beam_cutoff) { // max_active is tighter than beam. + if (adaptive_beam) + *adaptive_beam = max_active_cutoff - best_weight + opts_.beam_delta; + return max_active_cutoff; + } else if (min_active_cutoff > beam_cutoff) { // min_active is looser than beam. + if (adaptive_beam) + *adaptive_beam = min_active_cutoff - best_weight + opts_.beam_delta; + return min_active_cutoff; + } else { + *adaptive_beam = opts_.beam; + return beam_cutoff; + } + } + } + + void PossiblyResizeHash(size_t num_toks) { + size_t new_sz = static_cast(static_cast(num_toks) + * opts_.hash_ratio); + if (new_sz > toks_.Size()) { + toks_.SetSize(new_sz); + } + } + + inline StateId PropagateLm(StateId lm_state, + Arc *arc) { // returns new LM state. + if (arc->olabel == 0) { + return lm_state; // no change in LM state if no word crossed. + } else { // Propagate in the LM-diff FST. + Arc lm_arc; + bool ans = lm_diff_fst_->GetArc(lm_state, arc->olabel, &lm_arc); + if (!ans) { // this case is unexpected for statistical LMs. + if (!warned_noarc_) { + warned_noarc_ = true; + KALDI_WARN << "No arc available in LM (unlikely to be correct " + "if a statistical language model); will not warn again"; + } + arc->weight = Weight::Zero(); + return lm_state; // doesn't really matter what we return here; will + // be pruned. + } else { + arc->weight = Times(arc->weight, lm_arc.weight); + arc->olabel = lm_arc.olabel; // probably will be the same. + return lm_arc.nextstate; // return the new LM state. + } + } + } + + // ProcessEmitting returns the likelihood cutoff used. + BaseFloat ProcessEmitting(DecodableInterface *decodable, int frame) { + Elem *last_toks = toks_.Clear(); + size_t tok_cnt; + BaseFloat adaptive_beam; + Elem *best_elem = NULL; + BaseFloat weight_cutoff = GetCutoff(last_toks, &tok_cnt, + &adaptive_beam, &best_elem); + PossiblyResizeHash(tok_cnt); // This makes sure the hash is always big enough. + + // This is the cutoff we use after adding in the log-likes (i.e. + // for the next frame). This is a bound on the cutoff we will use + // on the next frame. + BaseFloat next_weight_cutoff = 1.0e+10; + + // First process the best token to get a hopefully + // reasonably tight bound on the next cutoff. + if (best_elem) { + PairId state_pair = best_elem->key; + StateId state = PairToState(state_pair), + lm_state = PairToLmState(state_pair); + Token *tok = best_elem->val; + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + Arc arc = aiter.Value(); + if (arc.ilabel != 0) { // we'd propagate.. + PropagateLm(lm_state, &arc); // may affect "arc.weight". + // We don't need the return value (the new LM state). + BaseFloat ac_cost = - decodable->LogLikelihood(frame, arc.ilabel), + new_weight = arc.weight.Value() + tok->weight_.Value() + ac_cost; + if (new_weight + adaptive_beam < next_weight_cutoff) + next_weight_cutoff = new_weight + adaptive_beam; + } + } + } + + // the tokens are now owned here, in last_toks, and the hash is empty. + // 'owned' is a complex thing here; the point is we need to call toks_.Delete(e) + // on each elem 'e' to let toks_ know we're done with them. + for (Elem *e = last_toks, *e_tail; e != NULL; e = e_tail) { // loop this way + // because we delete "e" as we go. + PairId state_pair = e->key; + StateId state = PairToState(state_pair), + lm_state = PairToLmState(state_pair); + Token *tok = e->val; + if (tok->weight_.Value() < weight_cutoff) { // not pruned. + KALDI_ASSERT(state == tok->arc_.nextstate); + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + Arc arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate. + StateId next_lm_state = PropagateLm(lm_state, &arc); + Weight ac_weight(-decodable->LogLikelihood(frame, arc.ilabel)); + BaseFloat new_weight = arc.weight.Value() + tok->weight_.Value() + + ac_weight.Value(); + if (new_weight < next_weight_cutoff) { // not pruned.. + PairId next_pair = ConstructPair(arc.nextstate, next_lm_state); + Token *new_tok = new Token(arc, ac_weight, tok); + Elem *e_found = toks_.Insert(next_pair, new_tok); + if (new_weight + adaptive_beam < next_weight_cutoff) + next_weight_cutoff = new_weight + adaptive_beam; + if (e_found->val != new_tok) { + if (*(e_found->val) < *new_tok) { + Token::TokenDelete(e_found->val); + e_found->val = new_tok; + } else { + Token::TokenDelete(new_tok); + } + } + } + } + } + } + e_tail = e->tail; + Token::TokenDelete(e->val); + toks_.Delete(e); + } + return next_weight_cutoff; + } + + // TODO: first time we go through this, could avoid using the queue. + void ProcessNonemitting(BaseFloat cutoff) { + // Processes nonemitting arcs for one frame. + KALDI_ASSERT(queue_.empty()); + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) + queue_.push_back(e); + while (!queue_.empty()) { + const Elem *e = queue_.back(); + queue_.pop_back(); + PairId state_pair = e->key; + Token *tok = e->val; // would segfault if state not + // in toks_ but this can't happen. + if (tok->weight_.Value() > cutoff) { // Don't bother processing successors. + continue; + } + KALDI_ASSERT(tok != NULL); + StateId state = PairToState(state_pair), + lm_state = PairToLmState(state_pair); + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc_ref = aiter.Value(); + if (arc_ref.ilabel == 0) { // propagate nonemitting only... + Arc arc(arc_ref); + StateId next_lm_state = PropagateLm(lm_state, &arc); + PairId next_pair = ConstructPair(arc.nextstate, next_lm_state); + Token *new_tok = new Token(arc, tok); + if (new_tok->weight_.Value() > cutoff) { // prune + Token::TokenDelete(new_tok); + } else { + Elem *e_found = toks_.Insert(next_pair, new_tok); + if (e_found->val == new_tok) { + queue_.push_back(e_found); + } else { + if ( *(e_found->val) < *new_tok ) { + Token::TokenDelete(e_found->val); + e_found->val = new_tok; + queue_.push_back(e_found); + } else { + Token::TokenDelete(new_tok); + } + } + } + } + } + } + } + + // HashList defined in ../util/hash-list.h. It actually allows us to maintain + // more than one list (e.g. for current and previous frames), but only one of + // them at a time can be indexed by PairId. + HashList toks_; + const fst::Fst &fst_; + fst::DeterministicOnDemandFst *lm_diff_fst_; + BiglmFasterDecoderOptions opts_; + bool warned_noarc_; + std::vector queue_; // temp variable used in ProcessNonemitting, + std::vector tmp_array_; // used in GetCutoff. + // make it class member to avoid internal new/delete. + + // It might seem unclear why we call ClearToks(toks_.Clear()). + // There are two separate cleanup tasks we need to do at when we start a new file. + // one is to delete the Token objects in the list; the other is to delete + // the Elem objects. toks_.Clear() just clears them from the hash and gives ownership + // to the caller, who then has to call toks_.Delete(e) for each one. It was designed + // this way for convenience in propagating tokens from one frame to the next. + void ClearToks(Elem *list) { + for (Elem *e = list, *e_tail; e != NULL; e = e_tail) { + Token::TokenDelete(e->val); + e_tail = e->tail; + toks_.Delete(e); + } + } + KALDI_DISALLOW_COPY_AND_ASSIGN(BiglmFasterDecoder); +}; + + +} // end namespace kaldi. + + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/decodable-mapped.h b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-mapped.h new file mode 100644 index 0000000..daebfb5 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-mapped.h @@ -0,0 +1,69 @@ +// decoder/decodable-mapped.h + +// Copyright 2009-2011 Saarland University; Microsoft Corporation; +// Lukas Burget + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_DECODABLE_MAPPED_H_ +#define KALDI_DECODER_DECODABLE_MAPPED_H_ + +#include + +#include "base/kaldi-common.h" +#include "itf/decodable-itf.h" + +namespace kaldi { + +// The DecodableMapped object is initialized by a normal decodable object, +// and a vector that maps indices. The "pdf index" into this decodable object +// is the index into the vector, and the value it finds there is used +// to index into the base decodable object. + +class DecodableMapped: public DecodableInterface { + public: + DecodableMapped(const std::vector &index_map, DecodableInterface *d): + index_map_(index_map), decodable_(d) { } + + // Note, frames are numbered from zero. But state_index is numbered + // from one (this routine is called by FSTs). + virtual BaseFloat LogLikelihood(int32 frame, int32 state_index) { + KALDI_ASSERT(static_cast(state_index) < index_map_.size()); + return decodable_->LogLikelihood(frame, index_map_[state_index]); + } + + // note: indices are assumed to be numbered from one, so + // NumIndices() will be the same as the largest index. + virtual int32 NumIndices() const { return static_cast(index_map_.size()) - 1; } + + virtual bool IsLastFrame(int32 frame) const { + // We require all the decodables have the same #frames. We don't check this though. + return decodable_->IsLastFrame(frame); + } + + private: + std::vector index_map_; + DecodableInterface *decodable_; + + KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableMapped); +}; + + + +} // namespace kaldi + +#endif // KALDI_DECODER_DECODABLE_MAPPED_H_ + diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/decodable-matrix.cc b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-matrix.cc new file mode 100644 index 0000000..5cbc0a5 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-matrix.cc @@ -0,0 +1,112 @@ +// decoder/decodable-matrix.cc + +// Copyright 2018 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "decoder/decodable-matrix.h" + +namespace kaldi { + +DecodableMatrixMapped::DecodableMatrixMapped( + const TransitionInformation &tm, + const MatrixBase &likes, + int32 frame_offset): + trans_model_(tm), + tid_to_pdf_(trans_model_.TransitionIdToPdfArray()), + likes_(&likes), likes_to_delete_(NULL), + frame_offset_(frame_offset) { + stride_ = likes.Stride(); + raw_data_ = likes.Data() - (stride_ * frame_offset); + + if (likes.NumCols() != tm.NumPdfs()) + KALDI_ERR << "Mismatch, matrix has " + << likes.NumCols() << " cols but transition-model has " + << tm.NumPdfs() << " pdf-ids."; +} + +DecodableMatrixMapped::DecodableMatrixMapped( + const TransitionInformation &tm, const Matrix *likes, + int32 frame_offset): + trans_model_(tm), + tid_to_pdf_(trans_model_.TransitionIdToPdfArray()), + likes_(likes), likes_to_delete_(likes), + frame_offset_(frame_offset) { + stride_ = likes->Stride(); + raw_data_ = likes->Data() - (stride_ * frame_offset_); + if (likes->NumCols() != tm.NumPdfs()) + KALDI_ERR << "Mismatch, matrix has " + << likes->NumCols() << " cols but transition-model has " + << tm.NumPdfs() << " pdf-ids."; +} + + +BaseFloat DecodableMatrixMapped::LogLikelihood(int32 frame, int32 tid) { + KALDI_PARANOID_ASSERT(tid >= 1 && tid < tid_to_pdf_.size()); + int32 pdf_id = tid_to_pdf_[tid]; +#ifdef KALDI_PARANOID + return (*likes_)(frame - frame_offset_, pdf_id); +#else + return raw_data_[frame * stride_ + pdf_id]; +#endif +} + +int32 DecodableMatrixMapped::NumFramesReady() const { + return frame_offset_ + likes_->NumRows(); +} + +bool DecodableMatrixMapped::IsLastFrame(int32 frame) const { + KALDI_ASSERT(frame < NumFramesReady()); + return (frame == NumFramesReady() - 1); +} + +// Indices are one-based! This is for compatibility with OpenFst. +int32 DecodableMatrixMapped::NumIndices() const { + return trans_model_.NumTransitionIds(); +} + +DecodableMatrixMapped::~DecodableMatrixMapped() { + delete likes_to_delete_; +} + + +void DecodableMatrixMappedOffset::AcceptLoglikes( + Matrix *loglikes, int32 frames_to_discard) { + if (loglikes->NumRows() == 0) return; + KALDI_ASSERT(loglikes->NumCols() == trans_model_.NumPdfs()); + KALDI_ASSERT(frames_to_discard <= loglikes_.NumRows() && + frames_to_discard >= 0); + if (frames_to_discard == loglikes_.NumRows()) { + loglikes_.Swap(loglikes); + loglikes->Resize(0, 0); + } else { + int32 old_rows_kept = loglikes_.NumRows() - frames_to_discard, + new_num_rows = old_rows_kept + loglikes->NumRows(); + Matrix new_loglikes(new_num_rows, loglikes->NumCols()); + new_loglikes.RowRange(0, old_rows_kept).CopyFromMat( + loglikes_.RowRange(frames_to_discard, old_rows_kept)); + new_loglikes.RowRange(old_rows_kept, loglikes->NumRows()).CopyFromMat( + *loglikes); + loglikes_.Swap(&new_loglikes); + } + frame_offset_ += frames_to_discard; + stride_ = loglikes_.Stride(); + raw_data_ = loglikes_.Data() - (frame_offset_ * stride_); +} + + + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/decodable-matrix.h b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-matrix.h new file mode 100644 index 0000000..94e141d --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-matrix.h @@ -0,0 +1,253 @@ +// decoder/decodable-matrix.h + +// Copyright 2009-2011 Microsoft Corporation +// 2013 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_DECODABLE_MATRIX_H_ +#define KALDI_DECODER_DECODABLE_MATRIX_H_ + +#include + +#include "base/kaldi-common.h" +#include "itf/decodable-itf.h" +#include "itf/transition-information.h" +#include "matrix/kaldi-matrix.h" + +namespace kaldi { + + +class DecodableMatrixScaledMapped: public DecodableInterface { + public: + // This constructor creates an object that will not delete "likes" when done. + DecodableMatrixScaledMapped(const TransitionInformation &tm, + const Matrix &likes, + BaseFloat scale): trans_model_(tm), likes_(&likes), + tid_to_pdf_(trans_model_.TransitionIdToPdfArray()), + scale_(scale), delete_likes_(false) { + if (likes.NumCols() != tm.NumPdfs()) + KALDI_ERR << "DecodableMatrixScaledMapped: mismatch, matrix has " + << likes.NumCols() << " cols but transition-model has " + << tm.NumPdfs() << " pdf-ids."; + } + + // This constructor creates an object that will delete "likes" + // when done. + DecodableMatrixScaledMapped(const TransitionInformation &tm, + BaseFloat scale, + const Matrix *likes): + trans_model_(tm), likes_(likes), + tid_to_pdf_(trans_model_.TransitionIdToPdfArray()), + scale_(scale), delete_likes_(true) { + if (likes->NumCols() != tm.NumPdfs()) + KALDI_ERR << "DecodableMatrixScaledMapped: mismatch, matrix has " + << likes->NumCols() << " cols but transition-model has " + << tm.NumPdfs() << " pdf-ids."; + } + + virtual int32 NumFramesReady() const { return likes_->NumRows(); } + + virtual bool IsLastFrame(int32 frame) const { + KALDI_ASSERT(frame < NumFramesReady()); + return (frame == NumFramesReady() - 1); + } + + // Note, frames are numbered from zero. + virtual BaseFloat LogLikelihood(int32 frame, int32 tid) { + KALDI_PARANOID_ASSERT(tid >= 1 && tid < tid_to_pdf_.size()); + return scale_ * (*likes_)(frame, tid_to_pdf_[tid]); + } + + // Indices are one-based! This is for compatibility with OpenFst. + virtual int32 NumIndices() const { return trans_model_.NumTransitionIds(); } + + virtual ~DecodableMatrixScaledMapped() { + if (delete_likes_) delete likes_; + } + private: + const TransitionInformation &trans_model_; // for tid to pdf mapping + const Matrix *likes_; + const std::vector &tid_to_pdf_; + BaseFloat scale_; + bool delete_likes_; + KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableMatrixScaledMapped); +}; + +/** + This is like DecodableMatrixScaledMapped, but it doesn't support an acoustic + scale, and it does support a frame offset, whereby you can state that the + first row of 'likes' is actually the n'th row of the matrix of available + log-likelihoods. It's useful if the neural net output comes in chunks for + different frame ranges. + + Note: DecodableMatrixMappedOffset solves the same problem in a slightly + different way, where you use the same decodable object. This one, unlike + DecodableMatrixMappedOffset, is compatible with when the loglikes are in a + SubMatrix. + */ +class DecodableMatrixMapped: public DecodableInterface { + public: + // This constructor creates an object that will not delete "likes" when done. + // the frame_offset is the frame the row 0 of 'likes' corresponds to, would be + // greater than one if this is not the first chunk of likelihoods. + DecodableMatrixMapped(const TransitionInformation &tm, + const MatrixBase &likes, + int32 frame_offset = 0); + + // This constructor creates an object that will delete "likes" + // when done. + DecodableMatrixMapped(const TransitionInformation &tm, + const Matrix *likes, + int32 frame_offset = 0); + + virtual int32 NumFramesReady() const; + + virtual bool IsLastFrame(int32 frame) const; + + virtual BaseFloat LogLikelihood(int32 frame, int32 tid); + + // Note: these indices are 1-based. + virtual int32 NumIndices() const; + + virtual ~DecodableMatrixMapped(); + + private: + const TransitionInformation &trans_model_; // for tid to pdf mapping + const std::vector& tid_to_pdf_; + const MatrixBase *likes_; + const Matrix *likes_to_delete_; + int32 frame_offset_; + + // raw_data_ and stride_ are a kind of fast look-aside for 'likes_', to be + // used when KALDI_PARANOID is false. + const BaseFloat *raw_data_; + int32 stride_; + + KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableMatrixMapped); +}; + + +/** + This decodable class returns log-likes stored in a matrix; it supports + repeatedly writing to the matrix and setting a time-offset representing the + frame-index of the first row of the matrix. It's intended for use in + multi-threaded decoding; mutex and semaphores are not included. External + code will call SetLoglikes() each time more log-likelihods are available. + If you try to access a log-likelihood that's no longer available because + the frame index is less than the current offset, it is of course an error. + + See also DecodableMatrixMapped, which supports the same type of thing but + with a different interface where you are expected to re-construct the + object each time you want to decode. +*/ +class DecodableMatrixMappedOffset: public DecodableInterface { + public: + DecodableMatrixMappedOffset(const TransitionInformation &tm): + trans_model_(tm), tid_to_pdf_(trans_model_.TransitionIdToPdfArray()), + frame_offset_(0), input_is_finished_(false) { } + + // this is not part of the generic Decodable interface. + int32 FirstAvailableFrame() const { return frame_offset_; } + + // Logically, this function appends 'loglikes' (interpreted as newly available + // frames) to the log-likelihoods stored in the class. + // + // This function is destructive of the input "loglikes" because it may + // under some circumstances do a shallow copy using Swap(). This function + // appends loglikes to any existing likelihoods you've previously supplied. + void AcceptLoglikes(Matrix *loglikes, + int32 frames_to_discard); + + void InputIsFinished() { input_is_finished_ = true; } + + virtual int32 NumFramesReady() const { + return loglikes_.NumRows() + frame_offset_; + } + + virtual bool IsLastFrame(int32 frame) const { + KALDI_ASSERT(frame < NumFramesReady()); + return (frame == NumFramesReady() - 1 && input_is_finished_); + } + + virtual BaseFloat LogLikelihood(int32 frame, int32 tid) { + KALDI_PARANOID_ASSERT(tid >= 1 && tid < tid_to_pdf_.size()); + int32 pdf_id = tid_to_pdf_[tid]; +#ifdef KALDI_PARANOID + return loglikes_(frame - frame_offset_, pdf_id); +#else + // This does no checking, so will be faster. + return raw_data_[frame * stride_ + pdf_id]; +#endif + } + + virtual int32 NumIndices() const { return trans_model_.NumTransitionIds(); } + + // nothing special to do in destructor. + virtual ~DecodableMatrixMappedOffset() { } + private: + const TransitionInformation &trans_model_; // for tid to pdf mapping + const std::vector& tid_to_pdf_; + Matrix loglikes_; + int32 frame_offset_; + bool input_is_finished_; + + // 'raw_data_' and 'stride_' are intended as a fast look-aside which is an + // alternative to accessing data_. raw_data_ is a faked version of + // data_->Data() as if it started from frame zero rather than frame_offset_. + // This simplifies the code of LogLikelihood(), in cases where KALDI_PARANOID + // is not defined. + BaseFloat *raw_data_; + int32 stride_; + + KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableMatrixMappedOffset); +}; + + +class DecodableMatrixScaled: public DecodableInterface { + public: + DecodableMatrixScaled(const Matrix &likes, + BaseFloat scale): + likes_(likes), scale_(scale) { } + + virtual int32 NumFramesReady() const { return likes_.NumRows(); } + + virtual bool IsLastFrame(int32 frame) const { + KALDI_ASSERT(frame < NumFramesReady()); + return (frame == NumFramesReady() - 1); + } + + // Note, frames are numbered from zero. + virtual BaseFloat LogLikelihood(int32 frame, int32 index) { + if (index > likes_.NumCols() || index <= 0 || + frame < 0 || frame >= likes_.NumRows()) + KALDI_ERR << "Invalid (frame, index - 1) = (" + << frame << ", " << index - 1 << ") for matrix of size " + << likes_.NumRows() << " x " << likes_.NumCols(); + return scale_ * likes_(frame, index - 1); + } + + // Indices are one-based! This is for compatibility with OpenFst. + virtual int32 NumIndices() const { return likes_.NumCols(); } + + private: + const Matrix &likes_; + BaseFloat scale_; + KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableMatrixScaled); +}; +} // namespace kaldi + +#endif // KALDI_DECODER_DECODABLE_MATRIX_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/decodable-sum.h b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-sum.h new file mode 100644 index 0000000..e3ff60a --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/decodable-sum.h @@ -0,0 +1,109 @@ +// decoder/decodable-sum.h + +// Copyright 2009-2011 Saarland University; Microsoft Corporation; +// Lukas Burget, Pawel Swietojanski + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_DECODABLE_SUM_H_ +#define KALDI_DECODER_DECODABLE_SUM_H_ + +#include +#include + +#include "base/kaldi-common.h" +#include "itf/decodable-itf.h" + +namespace kaldi { + +// The DecodableSum object is a very simple object that just sums +// scores over a number of Decodable objects. They must all have +// the same dimensions. + +class DecodableSum: public DecodableInterface { + public: + // Does not take ownership of pointers! They are just + // pointers because they are non-const. + DecodableSum(DecodableInterface *d1, BaseFloat w1, + DecodableInterface *d2, BaseFloat w2) { + decodables_.push_back(std::make_pair(d1, w1)); + decodables_.push_back(std::make_pair(d2, w2)); + CheckSizes(); + } + + // Does not take ownership of pointers! + DecodableSum( + const std::vector > &decodables) : + decodables_(decodables) { CheckSizes(); } + + void CheckSizes() const { + KALDI_ASSERT(decodables_.size() >= 1 + && decodables_[0].first != NULL); + for (size_t i = 1; i < decodables_.size(); i++) + KALDI_ASSERT(decodables_[i].first != NULL && + decodables_[i].first->NumIndices() == + decodables_[0].first->NumIndices()); + } + + // Note, frames are numbered from zero. But state_index is numbered + // from one (this routine is called by FSTs). + virtual BaseFloat LogLikelihood(int32 frame, int32 state_index) { + BaseFloat sum = 0.0; + // int32 i=1; + for (std::vector >::iterator iter = decodables_.begin(); + iter != decodables_.end(); + ++iter) { + sum += iter->first->LogLikelihood(frame, state_index) * iter->second; + } + return sum; + } + + virtual int32 NumIndices() const { return decodables_[0].first->NumIndices(); } + + virtual bool IsLastFrame(int32 frame) const { + // We require all the decodables have the same #frames. We don't check this though. + return decodables_[0].first->IsLastFrame(frame); + } + + private: + std::vector > decodables_; + KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableSum); +}; + +class DecodableSumScaled : public DecodableSum { + public: + DecodableSumScaled(DecodableInterface *d1, BaseFloat w1, + DecodableInterface *d2, BaseFloat w2, + BaseFloat scale) + : DecodableSum(d1, w1, d2, w2), scale_(scale) {} + + DecodableSumScaled(const std::vector > &decodables, + BaseFloat scale) + : DecodableSum(decodables), scale_(scale) {} + + virtual BaseFloat LogLikelihood(int32 frame, int32 state_index) { + return scale_ * DecodableSum::LogLikelihood(frame, state_index); + } + + private: + BaseFloat scale_; + KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableSumScaled); +}; + +} // namespace kaldi + +#endif // KALDI_DECODER_DECODABLE_SUM_H_ + diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/decoder-wrappers.cc b/runtime/onnxruntime/third_party/kaldi/decoder/decoder-wrappers.cc new file mode 100644 index 0000000..626a693 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/decoder-wrappers.cc @@ -0,0 +1,665 @@ +// decoder/decoder-wrappers.cc + +// Copyright 2014 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "decoder/decoder-wrappers.h" +#include "decoder/faster-decoder.h" +#include "decoder/lattice-faster-decoder.h" +#include "decoder/grammar-fst.h" +#include "lat/lattice-functions.h" + +namespace kaldi { + + + + + +DecodeUtteranceLatticeFasterClass::DecodeUtteranceLatticeFasterClass( + LatticeFasterDecoder *decoder, + DecodableInterface *decodable, + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + const std::string &utt, + BaseFloat acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignments_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_sum, // on success, adds likelihood to this. + int64 *frame_sum, // on success, adds #frames to this. + int32 *num_done, // on success (including partial decode), increments this. + int32 *num_err, // on failure, increments this. + int32 *num_partial): // If partial decode (final-state not reached), increments this. + decoder_(decoder), decodable_(decodable), trans_model_(&trans_model), + word_syms_(word_syms), utt_(utt), acoustic_scale_(acoustic_scale), + determinize_(determinize), allow_partial_(allow_partial), + alignments_writer_(alignments_writer), + words_writer_(words_writer), + compact_lattice_writer_(compact_lattice_writer), + lattice_writer_(lattice_writer), + like_sum_(like_sum), frame_sum_(frame_sum), + num_done_(num_done), num_err_(num_err), + num_partial_(num_partial), + computed_(false), success_(false), partial_(false), + clat_(NULL), lat_(NULL) { } + + +void DecodeUtteranceLatticeFasterClass::operator () () { + // Decoding and lattice determinization happens here. + computed_ = true; // Just means this function was called-- a check on the + // calling code. + success_ = true; + using fst::VectorFst; + if (!decoder_->Decode(decodable_)) { + KALDI_WARN << "Failed to decode utterance with id " << utt_; + success_ = false; + } + if (!decoder_->ReachedFinal()) { + if (allow_partial_) { + KALDI_WARN << "Outputting partial output for utterance " << utt_ + << " since no final-state reached\n"; + partial_ = true; + } else { + KALDI_WARN << "Not producing output for utterance " << utt_ + << " since no final-state reached and " + << "--allow-partial=false.\n"; + success_ = false; + } + } + if (!success_) return; + + // Get lattice, and do determinization if requested. + lat_ = new Lattice; + decoder_->GetRawLattice(lat_); + if (lat_->NumStates() == 0) + KALDI_ERR << "Unexpected problem getting lattice for utterance " << utt_; + fst::Connect(lat_); + if (determinize_) { + clat_ = new CompactLattice; + if (!DeterminizeLatticePhonePrunedWrapper( + *trans_model_, + lat_, + decoder_->GetOptions().lattice_beam, + clat_, + decoder_->GetOptions().det_opts)) + KALDI_WARN << "Determinization finished earlier than the beam for " + << "utterance " << utt_; + delete lat_; + lat_ = NULL; + // We'll write the lattice without acoustic scaling. + if (acoustic_scale_ != 0.0) + fst::ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale_), clat_); + } else { + // We'll write the lattice without acoustic scaling. + if (acoustic_scale_ != 0.0) + fst::ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale_), lat_); + } +} + +DecodeUtteranceLatticeFasterClass::~DecodeUtteranceLatticeFasterClass() { + if (!computed_) + KALDI_ERR << "Destructor called without operator (), error in calling code."; + + if (!success_) { + if (num_err_ != NULL) (*num_err_)++; + } else { // successful decode. + // Getting the one-best output is lightweight enough that we can do it in + // the destructor (easier than adding more variables to the class, and + // will rarely slow down the main thread.) + double likelihood; + LatticeWeight weight; + int32 num_frames; + { // First do some stuff with word-level traceback... + // This is basically for diagnostics. + fst::VectorFst decoded; + decoder_->GetBestPath(&decoded); + if (decoded.NumStates() == 0) { + // Shouldn't really reach this point as already checked success. + KALDI_ERR << "Failed to get traceback for utterance " << utt_; + } + std::vector alignment; + std::vector words; + GetLinearSymbolSequence(decoded, &alignment, &words, &weight); + num_frames = alignment.size(); + if (words_writer_->IsOpen()) + words_writer_->Write(utt_, words); + if (alignments_writer_->IsOpen()) + alignments_writer_->Write(utt_, alignment); + if (word_syms_ != NULL) { + std::cerr << utt_ << ' '; + for (size_t i = 0; i < words.size(); i++) { + std::string s = word_syms_->Find(words[i]); + if (s == "") + KALDI_ERR << "Word-id " << words[i] << " not in symbol table."; + std::cerr << s << ' '; + } + std::cerr << '\n'; + } + likelihood = -(weight.Value1() + weight.Value2()); + } + + // Ouptut the lattices. + if (determinize_) { // CompactLattice output. + KALDI_ASSERT(compact_lattice_writer_ != NULL && clat_ != NULL); + if (clat_->NumStates() == 0) { + KALDI_WARN << "Empty lattice for utterance " << utt_; + } else { + compact_lattice_writer_->Write(utt_, *clat_); + } + delete clat_; + clat_ = NULL; + } else { + KALDI_ASSERT(lattice_writer_ != NULL && lat_ != NULL); + if (lat_->NumStates() == 0) { + KALDI_WARN << "Empty lattice for utterance " << utt_; + } else { + lattice_writer_->Write(utt_, *lat_); + } + delete lat_; + lat_ = NULL; + } + + // Print out logging information. + KALDI_LOG << "Log-like per frame for utterance " << utt_ << " is " + << (likelihood / num_frames) << " over " + << num_frames << " frames."; + KALDI_VLOG(2) << "Cost for utterance " << utt_ << " is " + << weight.Value1() << " + " << weight.Value2(); + + // Now output the various diagnostic variables. + if (like_sum_ != NULL) *like_sum_ += likelihood; + if (frame_sum_ != NULL) *frame_sum_ += num_frames; + if (num_done_ != NULL) (*num_done_)++; + if (partial_ && num_partial_ != NULL) (*num_partial_)++; + } + // We were given ownership of these two objects that were passed in in + // the initializer. + delete decoder_; + delete decodable_; +} + +template +bool DecodeUtteranceLatticeIncremental( + LatticeIncrementalDecoderTpl &decoder, // not const but is really an input. + DecodableInterface &decodable, // not const but is really an input. + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignment_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr) { // puts utterance's like in like_ptr on success. + using fst::VectorFst; + if (!decoder.Decode(&decodable)) { + KALDI_WARN << "Failed to decode utterance with id " << utt; + return false; + } + if (!decoder.ReachedFinal()) { + if (allow_partial) { + KALDI_WARN << "Outputting partial output for utterance " << utt + << " since no final-state reached\n"; + } else { + KALDI_WARN << "Not producing output for utterance " << utt + << " since no final-state reached and " + << "--allow-partial=false.\n"; + return false; + } + } + + // Get lattice + CompactLattice clat = decoder.GetLattice(decoder.NumFramesDecoded(), true); + if (clat.NumStates() == 0) + KALDI_ERR << "Unexpected problem getting lattice for utterance " << utt; + + double likelihood; + LatticeWeight weight; + int32 num_frames; + { // First do some stuff with word-level traceback... + CompactLattice decoded_clat; + CompactLatticeShortestPath(clat, &decoded_clat); + Lattice decoded; + fst::ConvertLattice(decoded_clat, &decoded); + + if (decoded.Start() == fst::kNoStateId) + // Shouldn't really reach this point as already checked success. + KALDI_ERR << "Failed to get traceback for utterance " << utt; + + std::vector alignment; + std::vector words; + GetLinearSymbolSequence(decoded, &alignment, &words, &weight); + num_frames = alignment.size(); + KALDI_ASSERT(num_frames == decoder.NumFramesDecoded()); + if (words_writer->IsOpen()) + words_writer->Write(utt, words); + if (alignment_writer->IsOpen()) + alignment_writer->Write(utt, alignment); + if (word_syms != NULL) { + std::cerr << utt << ' '; + for (size_t i = 0; i < words.size(); i++) { + std::string s = word_syms->Find(words[i]); + if (s == "") + KALDI_ERR << "Word-id " << words[i] << " not in symbol table."; + std::cerr << s << ' '; + } + std::cerr << '\n'; + } + likelihood = -(weight.Value1() + weight.Value2()); + } + + // We'll write the lattice without acoustic scaling. + if (acoustic_scale != 0.0) + fst::ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale), &clat); + Connect(&clat); + compact_lattice_writer->Write(utt, clat); + KALDI_LOG << "Log-like per frame for utterance " << utt << " is " + << (likelihood / num_frames) << " over " + << num_frames << " frames."; + KALDI_VLOG(2) << "Cost for utterance " << utt << " is " + << weight.Value1() << " + " << weight.Value2(); + *like_ptr = likelihood; + return true; +} + + +// Takes care of output. Returns true on success. +template +bool DecodeUtteranceLatticeFaster( + LatticeFasterDecoderTpl &decoder, // not const but is really an input. + DecodableInterface &decodable, // not const but is really an input. + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignment_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr) { // puts utterance's like in like_ptr on success. + using fst::VectorFst; + + if (!decoder.Decode(&decodable)) { + KALDI_WARN << "Failed to decode utterance with id " << utt; + return false; + } + if (!decoder.ReachedFinal()) { + if (allow_partial) { + KALDI_WARN << "Outputting partial output for utterance " << utt + << " since no final-state reached\n"; + } else { + KALDI_WARN << "Not producing output for utterance " << utt + << " since no final-state reached and " + << "--allow-partial=false.\n"; + return false; + } + } + + double likelihood; + LatticeWeight weight; + int32 num_frames; + { // First do some stuff with word-level traceback... + VectorFst decoded; + if (!decoder.GetBestPath(&decoded)) + // Shouldn't really reach this point as already checked success. + KALDI_ERR << "Failed to get traceback for utterance " << utt; + + std::vector alignment; + std::vector words; + GetLinearSymbolSequence(decoded, &alignment, &words, &weight); + num_frames = alignment.size(); + if (words_writer->IsOpen()) + words_writer->Write(utt, words); + if (alignment_writer->IsOpen()) + alignment_writer->Write(utt, alignment); + if (word_syms != NULL) { + std::cerr << utt << ' '; + for (size_t i = 0; i < words.size(); i++) { + std::string s = word_syms->Find(words[i]); + if (s == "") + KALDI_ERR << "Word-id " << words[i] << " not in symbol table."; + std::cerr << s << ' '; + } + std::cerr << '\n'; + } + likelihood = -(weight.Value1() + weight.Value2()); + } + + // Get lattice, and do determinization if requested. + Lattice lat; + decoder.GetRawLattice(&lat); + if (lat.NumStates() == 0) + KALDI_ERR << "Unexpected problem getting lattice for utterance " << utt; + fst::Connect(&lat); + if (determinize) { + CompactLattice clat; + if (!DeterminizeLatticePhonePrunedWrapper( + trans_model, + &lat, + decoder.GetOptions().lattice_beam, + &clat, + decoder.GetOptions().det_opts)) + KALDI_WARN << "Determinization finished earlier than the beam for " + << "utterance " << utt; + // We'll write the lattice without acoustic scaling. + if (acoustic_scale != 0.0) + fst::ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale), &clat); + compact_lattice_writer->Write(utt, clat); + } else { + // We'll write the lattice without acoustic scaling. + if (acoustic_scale != 0.0) + fst::ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale), &lat); + lattice_writer->Write(utt, lat); + } + KALDI_LOG << "Log-like per frame for utterance " << utt << " is " + << (likelihood / num_frames) << " over " + << num_frames << " frames."; + KALDI_VLOG(2) << "Cost for utterance " << utt << " is " + << weight.Value1() << " + " << weight.Value2(); + *like_ptr = likelihood; + return true; +} + +// Instantiate the template above for the two required FST types. +template bool DecodeUtteranceLatticeIncremental( + LatticeIncrementalDecoderTpl > &decoder, + DecodableInterface &decodable, + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignment_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr); + +template bool DecodeUtteranceLatticeIncremental( + LatticeIncrementalDecoderTpl &decoder, + DecodableInterface &decodable, + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignment_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr); + +template bool DecodeUtteranceLatticeFaster( + LatticeFasterDecoderTpl > &decoder, + DecodableInterface &decodable, + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignment_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr); + +template bool DecodeUtteranceLatticeFaster( + LatticeFasterDecoderTpl &decoder, + DecodableInterface &decodable, + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignment_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr); + + +// Takes care of output. Returns true on success. +bool DecodeUtteranceLatticeSimple( + LatticeSimpleDecoder &decoder, // not const but is really an input. + DecodableInterface &decodable, // not const but is really an input. + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignment_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr) { // puts utterance's like in like_ptr on success. + using fst::VectorFst; + + if (!decoder.Decode(&decodable)) { + KALDI_WARN << "Failed to decode utterance with id " << utt; + return false; + } + if (!decoder.ReachedFinal()) { + if (allow_partial) { + KALDI_WARN << "Outputting partial output for utterance " << utt + << " since no final-state reached\n"; + } else { + KALDI_WARN << "Not producing output for utterance " << utt + << " since no final-state reached and " + << "--allow-partial=false.\n"; + return false; + } + } + + double likelihood; + LatticeWeight weight = LatticeWeight::Zero(); + int32 num_frames; + { // First do some stuff with word-level traceback... + VectorFst decoded; + if (!decoder.GetBestPath(&decoded)) + // Shouldn't really reach this point as already checked success. + KALDI_ERR << "Failed to get traceback for utterance " << utt; + + std::vector alignment; + std::vector words; + GetLinearSymbolSequence(decoded, &alignment, &words, &weight); + num_frames = alignment.size(); + if (words_writer->IsOpen()) + words_writer->Write(utt, words); + if (alignment_writer->IsOpen()) + alignment_writer->Write(utt, alignment); + if (word_syms != NULL) { + std::cerr << utt << ' '; + for (size_t i = 0; i < words.size(); i++) { + std::string s = word_syms->Find(words[i]); + if (s == "") + KALDI_ERR << "Word-id " << words[i] << " not in symbol table."; + std::cerr << s << ' '; + } + std::cerr << '\n'; + } + likelihood = -(weight.Value1() + weight.Value2()); + } + + // Get lattice, and do determinization if requested. + Lattice lat; + if (!decoder.GetRawLattice(&lat)) + KALDI_ERR << "Unexpected problem getting lattice for utterance " << utt; + fst::Connect(&lat); + if (determinize) { + CompactLattice clat; + if (!DeterminizeLatticePhonePrunedWrapper( + trans_model, + &lat, + decoder.GetOptions().lattice_beam, + &clat, + decoder.GetOptions().det_opts)) + KALDI_WARN << "Determinization finished earlier than the beam for " + << "utterance " << utt; + // We'll write the lattice without acoustic scaling. + if (acoustic_scale != 0.0) + fst::ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale), &clat); + compact_lattice_writer->Write(utt, clat); + } else { + // We'll write the lattice without acoustic scaling. + if (acoustic_scale != 0.0) + fst::ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale), &lat); + lattice_writer->Write(utt, lat); + } + KALDI_LOG << "Log-like per frame for utterance " << utt << " is " + << (likelihood / num_frames) << " over " + << num_frames << " frames."; + KALDI_VLOG(2) << "Cost for utterance " << utt << " is " + << weight.Value1() << " + " << weight.Value2(); + *like_ptr = likelihood; + return true; +} + + +// see comment in header. +void ModifyGraphForCarefulAlignment( + fst::VectorFst *fst) { + typedef fst::StdArc Arc; + typedef Arc::StateId StateId; + typedef Arc::Label Label; + typedef Arc::Weight Weight; + StateId num_states = fst->NumStates(); + if (num_states == 0) { + KALDI_WARN << "Empty FST input."; + return; + } + Weight zero = Weight::Zero(); + // fst_rhs will be the right hand side of the Concat operation. + fst::VectorFst fst_rhs(*fst); + // first remove the final-probs from fst_rhs. + for (StateId state = 0; state < num_states; state++) + fst_rhs.SetFinal(state, zero); + StateId pre_initial = fst_rhs.AddState(); + Arc to_initial(0, 0, Weight::One(), fst_rhs.Start()); + fst_rhs.AddArc(pre_initial, to_initial); + fst_rhs.SetStart(pre_initial); + // make the pre_initial state final with probability one; + // this is equivalent to keeping the final-probs of the first + // FST when we do concat (otherwise they would get deleted). + fst_rhs.SetFinal(pre_initial, Weight::One()); + fst::VectorFst fst_concat; + fst::Concat(fst, fst_rhs); +} + + +void AlignUtteranceWrapper( + const AlignConfig &config, + const std::string &utt, + BaseFloat acoustic_scale, // affects scores written to scores_writer, if + // present + fst::VectorFst *fst, // non-const in case config.careful == + // true. + DecodableInterface *decodable, // not const but is really an input. + Int32VectorWriter *alignment_writer, + BaseFloatWriter *scores_writer, + int32 *num_done, + int32 *num_error, + int32 *num_retried, + double *tot_like, + int64 *frame_count, + BaseFloatVectorWriter *per_frame_acwt_writer) { + + if ((config.retry_beam != 0 && config.retry_beam <= config.beam) || + config.beam <= 0.0) { + KALDI_ERR << "Beams do not make sense: beam " << config.beam + << ", retry-beam " << config.retry_beam; + } + + if (fst->Start() == fst::kNoStateId) { + KALDI_WARN << "Empty decoding graph for " << utt; + if (num_error != NULL) (*num_error)++; + return; + } + + if (config.careful) + ModifyGraphForCarefulAlignment(fst); + + FasterDecoderOptions decode_opts; + decode_opts.beam = config.beam; + + FasterDecoder decoder(*fst, decode_opts); + decoder.Decode(decodable); + + bool ans = decoder.ReachedFinal(); // consider only final states. + + if (!ans && config.retry_beam != 0.0) { + if (num_retried != NULL) (*num_retried)++; + KALDI_WARN << "Retrying utterance " << utt << " with beam " + << config.retry_beam; + decode_opts.beam = config.retry_beam; + decoder.SetOptions(decode_opts); + decoder.Decode(decodable); + ans = decoder.ReachedFinal(); + } + + if (!ans) { // Still did not reach final state. + KALDI_WARN << "Did not successfully decode file " << utt << ", len = " + << decodable->NumFramesReady(); + if (num_error != NULL) (*num_error)++; + return; + } + + fst::VectorFst decoded; // linear FST. + decoder.GetBestPath(&decoded); + if (decoded.NumStates() == 0) { + KALDI_WARN << "Error getting best path from decoder (likely a bug)"; + if (num_error != NULL) (*num_error)++; + return; + } + + std::vector alignment; + std::vector words; + LatticeWeight weight; + + GetLinearSymbolSequence(decoded, &alignment, &words, &weight); + BaseFloat like = -(weight.Value1()+weight.Value2()) / acoustic_scale; + + if (num_done != NULL) (*num_done)++; + if (tot_like != NULL) (*tot_like) += like; + if (frame_count != NULL) (*frame_count) += decodable->NumFramesReady(); + + if (alignment_writer != NULL && alignment_writer->IsOpen()) + alignment_writer->Write(utt, alignment); + + if (scores_writer != NULL && scores_writer->IsOpen()) + scores_writer->Write(utt, -(weight.Value1()+weight.Value2())); + + Vector per_frame_loglikes; + if (per_frame_acwt_writer != NULL && per_frame_acwt_writer->IsOpen()) { + GetPerFrameAcousticCosts(decoded, &per_frame_loglikes); + per_frame_loglikes.Scale(-1 / acoustic_scale); + per_frame_acwt_writer->Write(utt, per_frame_loglikes); + } +} + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/decoder-wrappers.h b/runtime/onnxruntime/third_party/kaldi/decoder/decoder-wrappers.h new file mode 100644 index 0000000..edea6cf --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/decoder-wrappers.h @@ -0,0 +1,221 @@ +// decoder/decoder-wrappers.h + +// Copyright 2014 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_DECODER_WRAPPERS_H_ +#define KALDI_DECODER_DECODER_WRAPPERS_H_ + +#include "itf/options-itf.h" +#include "decoder/lattice-faster-decoder.h" +#include "decoder/lattice-incremental-decoder.h" +#include "decoder/lattice-simple-decoder.h" + +// This header contains declarations from various convenience functions that are called +// from binary-level programs such as gmm-decode-faster.cc, gmm-align-compiled.cc, and +// so on. + +namespace kaldi { + + +struct AlignConfig { + BaseFloat beam; + BaseFloat retry_beam; + bool careful; + + AlignConfig(): beam(200.0), retry_beam(0.0), careful(false) { } + + void Register(OptionsItf *opts) { + opts->Register("beam", &beam, "Decoding beam used in alignment"); + opts->Register("retry-beam", &retry_beam, + "Decoding beam for second try at alignment"); + opts->Register("careful", &careful, + "If true, do 'careful' alignment, which is better at detecting " + "alignment failure (involves loop to start of decoding graph)."); + } +}; + + +/// AlignUtteranceWapper is a wrapper for alignment code used in training, that +/// is called from many different binaries, e.g. gmm-align, gmm-align-compiled, +/// sgmm-align, etc. The writers for alignments and words will only be written +/// to if they are open. The num_done, num_error, num_retried, tot_like and +/// frame_count pointers will (if non-NULL) be incremented or added to, not set, +/// by this function. +void AlignUtteranceWrapper( + const AlignConfig &config, + const std::string &utt, + BaseFloat acoustic_scale, // affects scores written to scores_writer, if + // present + fst::VectorFst *fst, // non-const in case config.careful == + // true, we add loop. + DecodableInterface *decodable, // not const but is really an input. + Int32VectorWriter *alignment_writer, + BaseFloatWriter *scores_writer, + int32 *num_done, + int32 *num_error, + int32 *num_retried, + double *tot_like, + int64 *frame_count, + BaseFloatVectorWriter *per_frame_acwt_writer = NULL); + + + +/// This function modifies the decoding graph for what we call "careful +/// alignment". The problem we are trying to solve is that if the decoding eats +/// up the words in the graph too fast, it can get stuck at the end, and produce +/// what looks like a valid alignment even though there was really a failure. +/// So what we want to do is to introduce, after the final-states of the graph, +/// a "blind alley" with no final-probs reachable, where the decoding can go to +/// get lost. Our basic idea is to append the decoding-graph to itself using +/// the fst Concat operation; but in order that there should be final-probs at the end of +/// the first but not the second FST, we modify the right-hand argument to the +/// Concat operation so that it has none of the original final-probs, and add +/// a "pre-initial" state that is final. +void ModifyGraphForCarefulAlignment( + fst::VectorFst *fst); + +/// TODO +template +bool DecodeUtteranceLatticeIncremental( + LatticeIncrementalDecoderTpl &decoder, // not const but is really an input. + DecodableInterface &decodable, // not const but is really an input. + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignments_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr); // puts utterance's likelihood in like_ptr on success. + + +/// This function DecodeUtteranceLatticeFaster is used in several decoders, and +/// we have moved it here. Note: this is really "binary-level" code as it +/// involves table readers and writers; we've just put it here as there is no +/// other obvious place to put it. If determinize == false, it writes to +/// lattice_writer, else to compact_lattice_writer. The writers for +/// alignments and words will only be written to if they are open. +/// +/// Caution: this will only link correctly if FST is either fst::Fst, +/// or fst::GrammarFst, as the template function is defined in the .cc file and +/// only instantiated for those two types. +template +bool DecodeUtteranceLatticeFaster( + LatticeFasterDecoderTpl &decoder, // not const but is really an input. + DecodableInterface &decodable, // not const but is really an input. + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignments_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr); // puts utterance's likelihood in like_ptr on success. + + +/// This class basically does the same job as the function +/// DecodeUtteranceLatticeFaster, but in a way that allows us +/// to build a multi-threaded command line program more easily. +/// The main computation takes place in operator (), and the output +/// happens in the destructor. +class DecodeUtteranceLatticeFasterClass { + public: + // Initializer sets various variables. + // NOTE: we "take ownership" of "decoder" and "decodable". These + // are deleted by the destructor. On error, "num_err" is incremented. + DecodeUtteranceLatticeFasterClass( + LatticeFasterDecoder *decoder, + DecodableInterface *decodable, + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + const std::string &utt, + BaseFloat acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignments_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_sum, // on success, adds likelihood to this. + int64 *frame_sum, // on success, adds #frames to this. + int32 *num_done, // on success (including partial decode), increments this. + int32 *num_err, // on failure, increments this. + int32 *num_partial); // If partial decode (final-state not reached), increments this. + void operator () (); // The decoding happens here. + ~DecodeUtteranceLatticeFasterClass(); // Output happens here. + private: + // The following variables correspond to inputs: + LatticeFasterDecoder *decoder_; + DecodableInterface *decodable_; + const TransitionInformation *trans_model_; + const fst::SymbolTable *word_syms_; + std::string utt_; + BaseFloat acoustic_scale_; + bool determinize_; + bool allow_partial_; + Int32VectorWriter *alignments_writer_; + Int32VectorWriter *words_writer_; + CompactLatticeWriter *compact_lattice_writer_; + LatticeWriter *lattice_writer_; + double *like_sum_; + int64 *frame_sum_; + int32 *num_done_; + int32 *num_err_; + int32 *num_partial_; + + // The following variables are stored by the computation. + bool computed_; // operator () was called. + bool success_; // decoding succeeded (possibly partial) + bool partial_; // decoding was partial. + CompactLattice *clat_; // Stored output, if determinize_ == true. + Lattice *lat_; // Stored output, if determinize_ == false. +}; + +// This function DecodeUtteranceLatticeSimple is used in several decoders, and +// we have moved it here. Note: this is really "binary-level" code as it +// involves table readers and writers; we've just put it here as there is no +// other obvious place to put it. If determinize == false, it writes to +// lattice_writer, else to compact_lattice_writer. The writers for +// alignments and words will only be written to if they are open. +bool DecodeUtteranceLatticeSimple( + LatticeSimpleDecoder &decoder, // not const but is really an input. + DecodableInterface &decodable, // not const but is really an input. + const TransitionInformation &trans_model, + const fst::SymbolTable *word_syms, + std::string utt, + double acoustic_scale, + bool determinize, + bool allow_partial, + Int32VectorWriter *alignments_writer, + Int32VectorWriter *words_writer, + CompactLatticeWriter *compact_lattice_writer, + LatticeWriter *lattice_writer, + double *like_ptr); // puts utterance's likelihood in like_ptr on success. + + + +} // end namespace kaldi. + + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/faster-decoder.cc b/runtime/onnxruntime/third_party/kaldi/decoder/faster-decoder.cc new file mode 100644 index 0000000..9e87758 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/faster-decoder.cc @@ -0,0 +1,351 @@ +// decoder/faster-decoder.cc + +// Copyright 2009-2011 Microsoft Corporation +// 2012-2013 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "decoder/faster-decoder.h" + +namespace kaldi { + + +FasterDecoder::FasterDecoder(const fst::Fst &fst, + const FasterDecoderOptions &opts): + fst_(fst), config_(opts), num_frames_decoded_(-1) { + KALDI_ASSERT(config_.hash_ratio >= 1.0); // less doesn't make much sense. + KALDI_ASSERT(config_.max_active > 1); + KALDI_ASSERT(config_.min_active >= 0 && config_.min_active < config_.max_active); + toks_.SetSize(1000); // just so on the first frame we do something reasonable. +} + + +void FasterDecoder::InitDecoding() { + // clean up from last time: + ClearToks(toks_.Clear()); + StateId start_state = fst_.Start(); + KALDI_ASSERT(start_state != fst::kNoStateId); + Arc dummy_arc(0, 0, Weight::One(), start_state); + toks_.Insert(start_state, new Token(dummy_arc, NULL)); + ProcessNonemitting(std::numeric_limits::max()); + num_frames_decoded_ = 0; +} + + +void FasterDecoder::Decode(DecodableInterface *decodable) { + InitDecoding(); + AdvanceDecoding(decodable); +} + +void FasterDecoder::AdvanceDecoding(DecodableInterface *decodable, + int32 max_num_frames) { + KALDI_ASSERT(num_frames_decoded_ >= 0 && + "You must call InitDecoding() before AdvanceDecoding()"); + int32 num_frames_ready = decodable->NumFramesReady(); + // num_frames_ready must be >= num_frames_decoded, or else + // the number of frames ready must have decreased (which doesn't + // make sense) or the decodable object changed between calls + // (which isn't allowed). + KALDI_ASSERT(num_frames_ready >= num_frames_decoded_); + int32 target_frames_decoded = num_frames_ready; + if (max_num_frames >= 0) + target_frames_decoded = std::min(target_frames_decoded, + num_frames_decoded_ + max_num_frames); + while (num_frames_decoded_ < target_frames_decoded) { + // note: ProcessEmitting() increments num_frames_decoded_ + double weight_cutoff = ProcessEmitting(decodable); + ProcessNonemitting(weight_cutoff); + } +} + + +bool FasterDecoder::ReachedFinal() const { + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) { + if (e->val->cost_ != std::numeric_limits::infinity() && + fst_.Final(e->key) != Weight::Zero()) + return true; + } + return false; +} + +bool FasterDecoder::GetBestPath(fst::MutableFst *fst_out, + bool use_final_probs) { + // GetBestPath gets the decoding output. If "use_final_probs" is true + // AND we reached a final state, it limits itself to final states; + // otherwise it gets the most likely token not taking into + // account final-probs. fst_out will be empty (Start() == kNoStateId) if + // nothing was available. It returns true if it got output (thus, fst_out + // will be nonempty). + fst_out->DeleteStates(); + Token *best_tok = NULL; + bool is_final = ReachedFinal(); + if (!is_final) { + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) + if (best_tok == NULL || *best_tok < *(e->val) ) + best_tok = e->val; + } else { + double infinity = std::numeric_limits::infinity(), + best_cost = infinity; + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) { + double this_cost = e->val->cost_ + fst_.Final(e->key).Value(); + if (this_cost < best_cost && this_cost != infinity) { + best_cost = this_cost; + best_tok = e->val; + } + } + } + if (best_tok == NULL) return false; // No output. + + std::vector arcs_reverse; // arcs in reverse order. + + for (Token *tok = best_tok; tok != NULL; tok = tok->prev_) { + BaseFloat tot_cost = tok->cost_ - + (tok->prev_ ? tok->prev_->cost_ : 0.0), + graph_cost = tok->arc_.weight.Value(), + ac_cost = tot_cost - graph_cost; + LatticeArc l_arc(tok->arc_.ilabel, + tok->arc_.olabel, + LatticeWeight(graph_cost, ac_cost), + tok->arc_.nextstate); + arcs_reverse.push_back(l_arc); + } + KALDI_ASSERT(arcs_reverse.back().nextstate == fst_.Start()); + arcs_reverse.pop_back(); // that was a "fake" token... gives no info. + + StateId cur_state = fst_out->AddState(); + fst_out->SetStart(cur_state); + for (ssize_t i = static_cast(arcs_reverse.size())-1; i >= 0; i--) { + LatticeArc arc = arcs_reverse[i]; + arc.nextstate = fst_out->AddState(); + fst_out->AddArc(cur_state, arc); + cur_state = arc.nextstate; + } + if (is_final && use_final_probs) { + Weight final_weight = fst_.Final(best_tok->arc_.nextstate); + fst_out->SetFinal(cur_state, LatticeWeight(final_weight.Value(), 0.0)); + } else { + fst_out->SetFinal(cur_state, LatticeWeight::One()); + } + RemoveEpsLocal(fst_out); + return true; +} + + +// Gets the weight cutoff. Also counts the active tokens. +double FasterDecoder::GetCutoff(Elem *list_head, size_t *tok_count, + BaseFloat *adaptive_beam, Elem **best_elem) { + double best_cost = std::numeric_limits::infinity(); + size_t count = 0; + if (config_.max_active == std::numeric_limits::max() && + config_.min_active == 0) { + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + double w = e->val->cost_; + if (w < best_cost) { + best_cost = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + if (adaptive_beam != NULL) *adaptive_beam = config_.beam; + return best_cost + config_.beam; + } else { + tmp_array_.clear(); + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + double w = e->val->cost_; + tmp_array_.push_back(w); + if (w < best_cost) { + best_cost = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + double beam_cutoff = best_cost + config_.beam, + min_active_cutoff = std::numeric_limits::infinity(), + max_active_cutoff = std::numeric_limits::infinity(); + + if (tmp_array_.size() > static_cast(config_.max_active)) { + std::nth_element(tmp_array_.begin(), + tmp_array_.begin() + config_.max_active, + tmp_array_.end()); + max_active_cutoff = tmp_array_[config_.max_active]; + } + if (max_active_cutoff < beam_cutoff) { // max_active is tighter than beam. + if (adaptive_beam) + *adaptive_beam = max_active_cutoff - best_cost + config_.beam_delta; + return max_active_cutoff; + } + if (tmp_array_.size() > static_cast(config_.min_active)) { + if (config_.min_active == 0) min_active_cutoff = best_cost; + else { + std::nth_element(tmp_array_.begin(), + tmp_array_.begin() + config_.min_active, + tmp_array_.size() > static_cast(config_.max_active) ? + tmp_array_.begin() + config_.max_active : + tmp_array_.end()); + min_active_cutoff = tmp_array_[config_.min_active]; + } + } + if (min_active_cutoff > beam_cutoff) { // min_active is looser than beam. + if (adaptive_beam) + *adaptive_beam = min_active_cutoff - best_cost + config_.beam_delta; + return min_active_cutoff; + } else { + *adaptive_beam = config_.beam; + return beam_cutoff; + } + } +} + +void FasterDecoder::PossiblyResizeHash(size_t num_toks) { + size_t new_sz = static_cast(static_cast(num_toks) + * config_.hash_ratio); + if (new_sz > toks_.Size()) { + toks_.SetSize(new_sz); + } +} + +// ProcessEmitting returns the likelihood cutoff used. +double FasterDecoder::ProcessEmitting(DecodableInterface *decodable) { + int32 frame = num_frames_decoded_; + Elem *last_toks = toks_.Clear(); + size_t tok_cnt; + BaseFloat adaptive_beam; + Elem *best_elem = NULL; + double weight_cutoff = GetCutoff(last_toks, &tok_cnt, + &adaptive_beam, &best_elem); + KALDI_VLOG(3) << tok_cnt << " tokens active."; + PossiblyResizeHash(tok_cnt); // This makes sure the hash is always big enough. + + // This is the cutoff we use after adding in the log-likes (i.e. + // for the next frame). This is a bound on the cutoff we will use + // on the next frame. + double next_weight_cutoff = std::numeric_limits::infinity(); + + // First process the best token to get a hopefully + // reasonably tight bound on the next cutoff. + if (best_elem) { + StateId state = best_elem->key; + Token *tok = best_elem->val; + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel != 0) { // we'd propagate.. + BaseFloat ac_cost = - decodable->LogLikelihood(frame, arc.ilabel); + double new_weight = arc.weight.Value() + tok->cost_ + ac_cost; + if (new_weight + adaptive_beam < next_weight_cutoff) + next_weight_cutoff = new_weight + adaptive_beam; + } + } + } + + // int32 n = 0, np = 0; + + // the tokens are now owned here, in last_toks, and the hash is empty. + // 'owned' is a complex thing here; the point is we need to call TokenDelete + // on each elem 'e' to let toks_ know we're done with them. + for (Elem *e = last_toks, *e_tail; e != NULL; e = e_tail) { // loop this way + // n++; + // because we delete "e" as we go. + StateId state = e->key; + Token *tok = e->val; + if (tok->cost_ < weight_cutoff) { // not pruned. + // np++; + KALDI_ASSERT(state == tok->arc_.nextstate); + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + Arc arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + BaseFloat ac_cost = - decodable->LogLikelihood(frame, arc.ilabel); + double new_weight = arc.weight.Value() + tok->cost_ + ac_cost; + if (new_weight < next_weight_cutoff) { // not pruned.. + Token *new_tok = new Token(arc, ac_cost, tok); + Elem *e_found = toks_.Insert(arc.nextstate, new_tok); + if (new_weight + adaptive_beam < next_weight_cutoff) + next_weight_cutoff = new_weight + adaptive_beam; + if (e_found->val != new_tok) { + if (*(e_found->val) < *new_tok) { + Token::TokenDelete(e_found->val); + e_found->val = new_tok; + } else { + Token::TokenDelete(new_tok); + } + } + } + } + } + } + e_tail = e->tail; + Token::TokenDelete(e->val); + toks_.Delete(e); + } + num_frames_decoded_++; + return next_weight_cutoff; +} + +// TODO: first time we go through this, could avoid using the queue. +void FasterDecoder::ProcessNonemitting(double cutoff) { + // Processes nonemitting arcs for one frame. + KALDI_ASSERT(queue_.empty()); + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) + queue_.push_back(e); + while (!queue_.empty()) { + const Elem* e = queue_.back(); + queue_.pop_back(); + StateId state = e->key; + Token *tok = e->val; // would segfault if state not + // in toks_ but this can't happen. + if (tok->cost_ > cutoff) { // Don't bother processing successors. + continue; + } + KALDI_ASSERT(tok != NULL && state == tok->arc_.nextstate); + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel == 0) { // propagate nonemitting only... + Token *new_tok = new Token(arc, tok); + if (new_tok->cost_ > cutoff) { // prune + Token::TokenDelete(new_tok); + } else { + Elem *e_found = toks_.Insert(arc.nextstate, new_tok); + if (e_found->val == new_tok) { + queue_.push_back(e_found); + } else { + if (*(e_found->val) < *new_tok) { + Token::TokenDelete(e_found->val); + e_found->val = new_tok; + queue_.push_back(e_found); + } else { + Token::TokenDelete(new_tok); + } + } + } + } + } + } +} + +void FasterDecoder::ClearToks(Elem *list) { + for (Elem *e = list, *e_tail; e != NULL; e = e_tail) { + Token::TokenDelete(e->val); + e_tail = e->tail; + toks_.Delete(e); + } +} + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/faster-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/faster-decoder.h new file mode 100644 index 0000000..88f78a6 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/faster-decoder.h @@ -0,0 +1,195 @@ +// decoder/faster-decoder.h + +// Copyright 2009-2011 Microsoft Corporation +// 2013 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_FASTER_DECODER_H_ +#define KALDI_DECODER_FASTER_DECODER_H_ + +#include "util/stl-utils.h" +#include "itf/options-itf.h" +#include "util/hash-list.h" +#include "fst/fstlib.h" +#include "itf/decodable-itf.h" +#include "lat/kaldi-lattice.h" // for CompactLatticeArc + +namespace kaldi { + +struct FasterDecoderOptions { + BaseFloat beam; + int32 max_active; + int32 min_active; + BaseFloat beam_delta; + BaseFloat hash_ratio; + FasterDecoderOptions(): beam(16.0), + max_active(std::numeric_limits::max()), + min_active(20), // This decoder mostly used for + // alignment, use small default. + beam_delta(0.5), + hash_ratio(2.0) { } + void Register(OptionsItf *opts, bool full) { /// if "full", use obscure + /// options too. + /// Depends on program. + opts->Register("beam", &beam, "Decoding beam. Larger->slower, more accurate."); + opts->Register("max-active", &max_active, "Decoder max active states. Larger->slower; " + "more accurate"); + opts->Register("min-active", &min_active, + "Decoder min active states (don't prune if #active less than this)."); + if (full) { + opts->Register("beam-delta", &beam_delta, + "Increment used in decoder [obscure setting]"); + opts->Register("hash-ratio", &hash_ratio, + "Setting used in decoder to control hash behavior"); + } + } +}; + +class FasterDecoder { + public: + typedef fst::StdArc Arc; + typedef Arc::Label Label; + typedef Arc::StateId StateId; + typedef Arc::Weight Weight; + + FasterDecoder(const fst::Fst &fst, + const FasterDecoderOptions &config); + + void SetOptions(const FasterDecoderOptions &config) { config_ = config; } + + ~FasterDecoder() { ClearToks(toks_.Clear()); } + + void Decode(DecodableInterface *decodable); + + /// Returns true if a final state was active on the last frame. + bool ReachedFinal() const; + + /// GetBestPath gets the decoding traceback. If "use_final_probs" is true + /// AND we reached a final state, it limits itself to final states; + /// otherwise it gets the most likely token not taking into account + /// final-probs. Returns true if the output best path was not the empty + /// FST (will only return false in unusual circumstances where + /// no tokens survived). + bool GetBestPath(fst::MutableFst *fst_out, + bool use_final_probs = true); + + /// As a new alternative to Decode(), you can call InitDecoding + /// and then (possibly multiple times) AdvanceDecoding(). + void InitDecoding(); + + + /// This will decode until there are no more frames ready in the decodable + /// object, but if max_num_frames is >= 0 it will decode no more than + /// that many frames. + void AdvanceDecoding(DecodableInterface *decodable, + int32 max_num_frames = -1); + + /// Returns the number of frames already decoded. + int32 NumFramesDecoded() const { return num_frames_decoded_; } + + protected: + + class Token { + public: + Arc arc_; // contains only the graph part of the cost; + // we can work out the acoustic part from difference between + // "cost_" and prev->cost_. + Token *prev_; + int32 ref_count_; + // if you are looking for weight_ here, it was removed and now we just have + // cost_, which corresponds to ConvertToCost(weight_). + double cost_; + inline Token(const Arc &arc, BaseFloat ac_cost, Token *prev): + arc_(arc), prev_(prev), ref_count_(1) { + if (prev) { + prev->ref_count_++; + cost_ = prev->cost_ + arc.weight.Value() + ac_cost; + } else { + cost_ = arc.weight.Value() + ac_cost; + } + } + inline Token(const Arc &arc, Token *prev): + arc_(arc), prev_(prev), ref_count_(1) { + if (prev) { + prev->ref_count_++; + cost_ = prev->cost_ + arc.weight.Value(); + } else { + cost_ = arc.weight.Value(); + } + } + inline bool operator < (const Token &other) { + return cost_ > other.cost_; + } + + inline static void TokenDelete(Token *tok) { + while (--tok->ref_count_ == 0) { + Token *prev = tok->prev_; + delete tok; + if (prev == NULL) return; + else tok = prev; + } +#ifdef KALDI_PARANOID + KALDI_ASSERT(tok->ref_count_ > 0); +#endif + } + }; + typedef HashList::Elem Elem; + + + /// Gets the weight cutoff. Also counts the active tokens. + double GetCutoff(Elem *list_head, size_t *tok_count, + BaseFloat *adaptive_beam, Elem **best_elem); + + void PossiblyResizeHash(size_t num_toks); + + // ProcessEmitting returns the likelihood cutoff used. + // It decodes the frame num_frames_decoded_ of the decodable object + // and then increments num_frames_decoded_ + double ProcessEmitting(DecodableInterface *decodable); + + // TODO: first time we go through this, could avoid using the queue. + void ProcessNonemitting(double cutoff); + + // HashList defined in ../util/hash-list.h. It actually allows us to maintain + // more than one list (e.g. for current and previous frames), but only one of + // them at a time can be indexed by StateId. + HashList toks_; + const fst::Fst &fst_; + FasterDecoderOptions config_; + std::vector queue_; // temp variable used in ProcessNonemitting, + std::vector tmp_array_; // used in GetCutoff. + // make it class member to avoid internal new/delete. + + // Keep track of the number of frames decoded in the current file. + int32 num_frames_decoded_; + + // It might seem unclear why we call ClearToks(toks_.Clear()). + // There are two separate cleanup tasks we need to do at when we start a new file. + // one is to delete the Token objects in the list; the other is to delete + // the Elem objects. toks_.Clear() just clears them from the hash and gives ownership + // to the caller, who then has to call toks_.Delete(e) for each one. It was designed + // this way for convenience in propagating tokens from one frame to the next. + void ClearToks(Elem *list); + + KALDI_DISALLOW_COPY_AND_ASSIGN(FasterDecoder); +}; + + +} // end namespace kaldi. + + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-biglm-faster-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-biglm-faster-decoder.h new file mode 100644 index 0000000..9f50739 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-biglm-faster-decoder.h @@ -0,0 +1,886 @@ +// decoder/lattice-biglm-faster-decoder.h + +// Copyright 2009-2011 Microsoft Corporation, Mirko Hannemann, +// Gilles Boulianne + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_LATTICE_BIGLM_FASTER_DECODER_H_ +#define KALDI_DECODER_LATTICE_BIGLM_FASTER_DECODER_H_ + + +#include "util/stl-utils.h" +#include "util/hash-list.h" +#include "fst/fstlib.h" +#include "itf/decodable-itf.h" +#include "fstext/fstext-lib.h" +#include "lat/kaldi-lattice.h" +#include "decoder/lattice-faster-decoder.h" // for options. + + +namespace kaldi { + +// The options are the same as for lattice-faster-decoder.h for now. +typedef LatticeFasterDecoderConfig LatticeBiglmFasterDecoderConfig; + +/** This is as LatticeFasterDecoder, but does online composition between + HCLG and the "difference language model", which is a deterministic + FST that represents the difference between the language model you want + and the language model you compiled HCLG with. The class + DeterministicOnDemandFst follows through the epsilons in G for you + (assuming G is a standard backoff language model) and makes it look + like a determinized FST. +*/ + +class LatticeBiglmFasterDecoder { + public: + typedef fst::StdArc Arc; + typedef Arc::Label Label; + typedef Arc::StateId StateId; + // A PairId will be constructed as: (StateId in fst) + (StateId in lm_diff_fst) << 32; + typedef uint64 PairId; + typedef Arc::Weight Weight; + // instantiate this class once for each thing you have to decode. + LatticeBiglmFasterDecoder( + const fst::Fst &fst, + const LatticeBiglmFasterDecoderConfig &config, + fst::DeterministicOnDemandFst *lm_diff_fst): + fst_(fst), lm_diff_fst_(lm_diff_fst), config_(config), + warned_noarc_(false), num_toks_(0) { + config.Check(); + KALDI_ASSERT(fst.Start() != fst::kNoStateId && + lm_diff_fst->Start() != fst::kNoStateId); + toks_.SetSize(1000); // just so on the first frame we do something reasonable. + } + void SetOptions(const LatticeBiglmFasterDecoderConfig &config) { config_ = config; } + LatticeBiglmFasterDecoderConfig GetOptions() { return config_; } + ~LatticeBiglmFasterDecoder() { + DeleteElems(toks_.Clear()); + ClearActiveTokens(); + } + + // Returns true if any kind of traceback is available (not necessarily from + // a final state). + bool Decode(DecodableInterface *decodable) { + // clean up from last time: + DeleteElems(toks_.Clear()); + ClearActiveTokens(); + warned_ = false; + final_active_ = false; + final_costs_.clear(); + num_toks_ = 0; + PairId start_pair = ConstructPair(fst_.Start(), lm_diff_fst_->Start()); + active_toks_.resize(1); + Token *start_tok = new Token(0.0, 0.0, NULL, NULL); + active_toks_[0].toks = start_tok; + toks_.Insert(start_pair, start_tok); + num_toks_++; + ProcessNonemitting(0); + + // We use 1-based indexing for frames in this decoder (if you view it in + // terms of features), but note that the decodable object uses zero-based + // numbering, which we have to correct for when we call it. + for (int32 frame = 1; !decodable->IsLastFrame(frame-2); frame++) { + active_toks_.resize(frame+1); // new column + + ProcessEmitting(decodable, frame); + + ProcessNonemitting(frame); + + if (decodable->IsLastFrame(frame-1)) + PruneActiveTokensFinal(frame); + else if (frame % config_.prune_interval == 0) + PruneActiveTokens(frame, config_.lattice_beam * 0.1); // use larger delta. + } + // Returns true if we have any kind of traceback available (not necessarily + // to the end state; query ReachedFinal() for that). + return !final_costs_.empty(); + } + + /// says whether a final-state was active on the last frame. If it was not, the + /// lattice (or traceback) will end with states that are not final-states. + bool ReachedFinal() const { return final_active_; } + + + // Outputs an FST corresponding to the single best path + // through the lattice. + bool GetBestPath(fst::MutableFst *ofst, + bool use_final_probs = true) const { + fst::VectorFst fst; + if (!GetRawLattice(&fst, use_final_probs)) return false; + // std::cout << "Raw lattice is:\n"; + // fst::FstPrinter fstprinter(fst, NULL, NULL, NULL, false, true); + // fstprinter.Print(&std::cout, "standard output"); + ShortestPath(fst, ofst); + return true; + } + + // Outputs an FST corresponding to the raw, state-level + // tracebacks. + bool GetRawLattice(fst::MutableFst *ofst, + bool use_final_probs = true) const { + typedef LatticeArc Arc; + typedef Arc::StateId StateId; + // A PairId will be constructed as: (StateId in fst) + (StateId in lm_diff_fst) << 32; + typedef uint64 PairId; + typedef Arc::Weight Weight; + typedef Arc::Label Label; + ofst->DeleteStates(); + // num-frames plus one (since frames are one-based, and we have + // an extra frame for the start-state). + int32 num_frames = active_toks_.size() - 1; + KALDI_ASSERT(num_frames > 0); + unordered_map tok_map(num_toks_/2 + 3); // bucket count + // First create all states. + for (int32 f = 0; f <= num_frames; f++) { + if (active_toks_[f].toks == NULL) { + KALDI_WARN << "GetRawLattice: no tokens active on frame " << f + << ": not producing lattice.\n"; + return false; + } + for (Token *tok = active_toks_[f].toks; tok != NULL; tok = tok->next) + tok_map[tok] = ofst->AddState(); + // The next statement sets the start state of the output FST. + // Because we always add new states to the head of the list + // active_toks_[f].toks, and the start state was the first one + // added, it will be the last one added to ofst. + if (f == 0 && ofst->NumStates() > 0) + ofst->SetStart(ofst->NumStates()-1); + } + KALDI_VLOG(3) << "init:" << num_toks_/2 + 3 << " buckets:" + << tok_map.bucket_count() << " load:" << tok_map.load_factor() + << " max:" << tok_map.max_load_factor(); + // Now create all arcs. + StateId cur_state = 0; // we rely on the fact that we numbered these + // consecutively (AddState() returns the numbers in order..) + for (int32 f = 0; f <= num_frames; f++) { + for (Token *tok = active_toks_[f].toks; tok != NULL; tok = tok->next, + cur_state++) { + for (ForwardLink *l = tok->links; + l != NULL; + l = l->next) { + unordered_map::const_iterator iter = + tok_map.find(l->next_tok); + StateId nextstate = iter->second; + KALDI_ASSERT(iter != tok_map.end()); + Arc arc(l->ilabel, l->olabel, + Weight(l->graph_cost, l->acoustic_cost), + nextstate); + ofst->AddArc(cur_state, arc); + } + if (f == num_frames) { + if (use_final_probs && !final_costs_.empty()) { + std::map::const_iterator iter = + final_costs_.find(tok); + if (iter != final_costs_.end()) + ofst->SetFinal(cur_state, LatticeWeight(iter->second, 0)); + } else { + ofst->SetFinal(cur_state, LatticeWeight::One()); + } + } + } + } + KALDI_ASSERT(cur_state == ofst->NumStates()); + return (cur_state != 0); + } + + // This function is now deprecated, since now we do determinization from + // outside the LatticeBiglmFasterDecoder class. + // Outputs an FST corresponding to the lattice-determinized + // lattice (one path per word sequence). + bool GetLattice(fst::MutableFst *ofst, + bool use_final_probs = true) const { + Lattice raw_fst; + if (!GetRawLattice(&raw_fst, use_final_probs)) return false; + Invert(&raw_fst); // make it so word labels are on the input. + if (!TopSort(&raw_fst)) // topological sort makes lattice-determinization more efficient + KALDI_WARN << "Topological sorting of state-level lattice failed " + "(probably your lexicon has empty words or your LM has epsilon cycles; this " + " is a bad idea.)"; + // (in phase where we get backward-costs). + fst::ILabelCompare ilabel_comp; + ArcSort(&raw_fst, ilabel_comp); // sort on ilabel; makes + // lattice-determinization more efficient. + + fst::DeterminizeLatticePrunedOptions lat_opts; + lat_opts.max_mem = config_.det_opts.max_mem; + + DeterminizeLatticePruned(raw_fst, config_.lattice_beam, ofst, lat_opts); + raw_fst.DeleteStates(); // Free memory-- raw_fst no longer needed. + Connect(ofst); // Remove unreachable states... there might be + // a small number of these, in some cases. + return true; + } + + private: + inline PairId ConstructPair(StateId fst_state, StateId lm_state) { + return static_cast(fst_state) + (static_cast(lm_state) << 32); + } + + static inline StateId PairToState(PairId state_pair) { + return static_cast(static_cast(state_pair)); + } + static inline StateId PairToLmState(PairId state_pair) { + return static_cast(static_cast(state_pair >> 32)); + } + + struct Token; + // ForwardLinks are the links from a token to a token on the next frame. + // or sometimes on the current frame (for input-epsilon links). + struct ForwardLink { + Token *next_tok; // the next token [or NULL if represents final-state] + Label ilabel; // ilabel on link. + Label olabel; // olabel on link. + BaseFloat graph_cost; // graph cost of traversing link (contains LM, etc.) + BaseFloat acoustic_cost; // acoustic cost (pre-scaled) of traversing link + ForwardLink *next; // next in singly-linked list of forward links from a + // token. + inline ForwardLink(Token *next_tok, Label ilabel, Label olabel, + BaseFloat graph_cost, BaseFloat acoustic_cost, + ForwardLink *next): + next_tok(next_tok), ilabel(ilabel), olabel(olabel), + graph_cost(graph_cost), acoustic_cost(acoustic_cost), + next(next) { } + }; + + // Token is what's resident in a particular state at a particular time. + // In this decoder a Token actually contains *forward* links. + // When first created, a Token just has the (total) cost. We add forward + // links to it when we process the next frame. + struct Token { + BaseFloat tot_cost; // would equal weight.Value()... cost up to this point. + BaseFloat extra_cost; // >= 0. After calling PruneForwardLinks, this equals + // the minimum difference between the cost of the best path, and the cost of + // this is on, and the cost of the absolute best path, under the assumption + // that any of the currently active states at the decoding front may + // eventually succeed (e.g. if you were to take the currently active states + // one by one and compute this difference, and then take the minimum). + + ForwardLink *links; // Head of singly linked list of ForwardLinks + + Token *next; // Next in list of tokens for this frame. + + inline Token(BaseFloat tot_cost, BaseFloat extra_cost, ForwardLink *links, + Token *next): tot_cost(tot_cost), extra_cost(extra_cost), + links(links), next(next) { } + inline void DeleteForwardLinks() { + ForwardLink *l = links, *m; + while (l != NULL) { + m = l->next; + delete l; + l = m; + } + links = NULL; + } + }; + + // head and tail of per-frame list of Tokens (list is in topological order), + // and something saying whether we ever pruned it using PruneForwardLinks. + struct TokenList { + Token *toks; + bool must_prune_forward_links; + bool must_prune_tokens; + TokenList(): toks(NULL), must_prune_forward_links(true), + must_prune_tokens(true) { } + }; + + typedef HashList::Elem Elem; + + void PossiblyResizeHash(size_t num_toks) { + size_t new_sz = static_cast(static_cast(num_toks) + * config_.hash_ratio); + if (new_sz > toks_.Size()) { + toks_.SetSize(new_sz); + } + } + + // FindOrAddToken either locates a token in hash of toks_, + // or if necessary inserts a new, empty token (i.e. with no forward links) + // for the current frame. [note: it's inserted if necessary into hash toks_ + // and also into the singly linked list of tokens active on this frame + // (whose head is at active_toks_[frame]). + inline Elem *FindOrAddToken(PairId state_pair, int32 frame, + BaseFloat tot_cost, bool emitting, bool *changed) { + // Returns the Token pointer. Sets "changed" (if non-NULL) to true + // if the token was newly created or the cost changed. + KALDI_ASSERT(frame < active_toks_.size()); + Token *&toks = active_toks_[frame].toks; + Elem *e_found = toks_.Insert(state_pair, NULL); + if (e_found->val == NULL) { // no such token presently. + const BaseFloat extra_cost = 0.0; + // tokens on the currently final frame have zero extra_cost + // as any of them could end up + // on the winning path. + Token *new_tok = new Token (tot_cost, extra_cost, NULL, toks); + // NULL: no forward links yet + toks = new_tok; + num_toks_++; + e_found->val = new_tok; + if (changed) *changed = true; + return e_found; + } else { + Token *tok = e_found->val; // There is an existing Token for this state. + if (tok->tot_cost > tot_cost) { // replace old token + tok->tot_cost = tot_cost; + // we don't allocate a new token, the old stays linked in active_toks_ + // we only replace the tot_cost + // in the current frame, there are no forward links (and no extra_cost) + // only in ProcessNonemitting we have to delete forward links + // in case we visit a state for the second time + // those forward links, that lead to this replaced token before: + // they remain and will hopefully be pruned later (PruneForwardLinks...) + if (changed) *changed = true; + } else { + if (changed) *changed = false; + } + return e_found; + } + } + + // prunes outgoing links for all tokens in active_toks_[frame] + // it's called by PruneActiveTokens + // all links, that have link_extra_cost > lattice_beam are pruned + void PruneForwardLinks(int32 frame, bool *extra_costs_changed, + bool *links_pruned, + BaseFloat delta) { + // delta is the amount by which the extra_costs must change + // If delta is larger, we'll tend to go back less far + // toward the beginning of the file. + // extra_costs_changed is set to true if extra_cost was changed for any token + // links_pruned is set to true if any link in any token was pruned + + *extra_costs_changed = false; + *links_pruned = false; + KALDI_ASSERT(frame >= 0 && frame < active_toks_.size()); + if (active_toks_[frame].toks == NULL ) { // empty list; should not happen. + if (!warned_) { + KALDI_WARN << "No tokens alive [doing pruning].. warning first " + "time only for each utterance\n"; + warned_ = true; + } + } + + // We have to iterate until there is no more change, because the links + // are not guaranteed to be in topological order. + bool changed = true; // difference new minus old extra cost >= delta ? + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + ForwardLink *link, *prev_link=NULL; + // will recompute tok_extra_cost for tok. + BaseFloat tok_extra_cost = std::numeric_limits::infinity(); + // tok_extra_cost is the best (min) of link_extra_cost of outgoing links + for (link = tok->links; link != NULL; ) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) + - next_tok->tot_cost); // difference in brackets is >= 0 + // link_exta_cost is the difference in score between the best paths + // through link source state and through link destination state + KALDI_ASSERT(link_extra_cost == link_extra_cost); // check for NaN + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLink *next_link = link->next; + if (prev_link != NULL) prev_link->next = next_link; + else tok->links = next_link; + delete link; + link = next_link; // advance link but leave prev_link the same. + *links_pruned = true; + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + if (link_extra_cost < -0.01) + KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) + tok_extra_cost = link_extra_cost; + prev_link = link; // move to next link + link = link->next; + } + } // for all outgoing links + if (fabs(tok_extra_cost - tok->extra_cost) > delta) + changed = true; // difference new minus old is bigger than delta + tok->extra_cost = tok_extra_cost; + // will be +infinity or <= lattice_beam_. + // infinity indicates, that no forward link survived pruning + } // for all Token on active_toks_[frame] + if (changed) *extra_costs_changed = true; + + // Note: it's theoretically possible that aggressive compiler + // optimizations could cause an infinite loop here for small delta and + // high-dynamic-range scores. + } // while changed + } + + // PruneForwardLinksFinal is a version of PruneForwardLinks that we call + // on the final frame. If there are final tokens active, it uses + // the final-probs for pruning, otherwise it treats all tokens as final. + void PruneForwardLinksFinal(int32 frame) { + KALDI_ASSERT(static_cast(frame+1) == active_toks_.size()); + if (active_toks_[frame].toks == NULL ) // empty list; should not happen. + KALDI_WARN << "No tokens alive at end of file\n"; + + // First go through, working out the best token (do it in parallel + // including final-probs and not including final-probs; we'll take + // the one with final-probs if it's valid). + const BaseFloat infinity = std::numeric_limits::infinity(); + BaseFloat best_cost_final = infinity, + best_cost_nofinal = infinity; + unordered_map tok_to_final_cost; + Elem *cur_toks = toks_.Clear(); // swapping prev_toks_ / cur_toks_ + for (Elem *e = cur_toks, *e_tail; e != NULL; e = e_tail) { + PairId state_pair = e->key; + StateId state = PairToState(state_pair), + lm_state = PairToLmState(state_pair); + Token *tok = e->val; + BaseFloat final_cost = fst_.Final(state).Value() + + lm_diff_fst_->Final(lm_state).Value(); + tok_to_final_cost[tok] = final_cost; + best_cost_final = std::min(best_cost_final, tok->tot_cost + final_cost); + best_cost_nofinal = std::min(best_cost_nofinal, tok->tot_cost); + e_tail = e->tail; + toks_.Delete(e); + } + final_active_ = (best_cost_final != infinity); + + // Now go through tokens on this frame, pruning forward links... may have + // to iterate a few times until there is no more change, because the list is + // not in topological order. + + bool changed = true; + BaseFloat delta = 1.0e-05; + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + ForwardLink *link, *prev_link=NULL; + // will recompute tok_extra_cost. It has a term in it that corresponds + // to the "final-prob", so instead of initializing tok_extra_cost to infinity + // below we set it to the difference between the (score+final_prob) of this token, + // and the best such (score+final_prob). + BaseFloat tok_extra_cost; + if (final_active_) { + BaseFloat final_cost = tok_to_final_cost[tok]; + tok_extra_cost = (tok->tot_cost + final_cost) - best_cost_final; + } else + tok_extra_cost = tok->tot_cost - best_cost_nofinal; + + for (link = tok->links; link != NULL; ) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) + - next_tok->tot_cost); + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLink *next_link = link->next; + if (prev_link != NULL) prev_link->next = next_link; + else tok->links = next_link; + delete link; + link = next_link; // advance link but leave prev_link the same. + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + if (link_extra_cost < -0.01) + KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) + tok_extra_cost = link_extra_cost; + prev_link = link; + link = link->next; + } + } + // prune away tokens worse than lattice_beam above best path. This step + // was not necessary in the non-final case because then, this case + // showed up as having no forward links. Here, the tok_extra_cost has + // an extra component relating to the final-prob. + if (tok_extra_cost > config_.lattice_beam) + tok_extra_cost = infinity; + // to be pruned in PruneTokensForFrame + + if (!ApproxEqual(tok->extra_cost, tok_extra_cost, delta)) + changed = true; + tok->extra_cost = tok_extra_cost; // will be +infinity or <= lattice_beam_. + } + } // while changed + + // Now put surviving Tokens in the final_costs_ hash, which is a class + // member (unlike tok_to_final_costs). + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + if (tok->extra_cost != infinity) { + // If the token was not pruned away, + if (final_active_) { + BaseFloat final_cost = tok_to_final_cost[tok]; + if (final_cost != infinity) + final_costs_[tok] = final_cost; + } else { + final_costs_[tok] = 0; + } + } + } + } + + // Prune away any tokens on this frame that have no forward links. + // [we don't do this in PruneForwardLinks because it would give us + // a problem with dangling pointers]. + // It's called by PruneActiveTokens if any forward links have been pruned + void PruneTokensForFrame(int32 frame) { + KALDI_ASSERT(frame >= 0 && frame < active_toks_.size()); + Token *&toks = active_toks_[frame].toks; + if (toks == NULL) + KALDI_WARN << "No tokens alive [doing pruning]\n"; + Token *tok, *next_tok, *prev_tok = NULL; + for (tok = toks; tok != NULL; tok = next_tok) { + next_tok = tok->next; + if (tok->extra_cost == std::numeric_limits::infinity()) { + // token is unreachable from end of graph; (no forward links survived) + // excise tok from list and delete tok. + if (prev_tok != NULL) prev_tok->next = tok->next; + else toks = tok->next; + delete tok; + num_toks_--; + } else { // fetch next Token + prev_tok = tok; + } + } + } + + // Go backwards through still-alive tokens, pruning them. note: cur_frame is + // where hash toks_ are (so we do not want to mess with it because these tokens + // don't yet have forward pointers), but we do all previous frames, unless we + // know that we can safely ignore them because the frame after them was unchanged. + // delta controls when it considers a cost to have changed enough to continue + // going backward and propagating the change. + // for a larger delta, we will recurse less far back + void PruneActiveTokens(int32 cur_frame, BaseFloat delta) { + int32 num_toks_begin = num_toks_; + for (int32 frame = cur_frame-1; frame >= 0; frame--) { + // Reason why we need to prune forward links in this situation: + // (1) we have never pruned them (new TokenList) + // (2) we have not yet pruned the forward links to the next frame, + // after any of those tokens have changed their extra_cost. + if (active_toks_[frame].must_prune_forward_links) { + bool extra_costs_changed = false, links_pruned = false; + PruneForwardLinks(frame, &extra_costs_changed, &links_pruned, delta); + if (extra_costs_changed && frame > 0) // any token has changed extra_cost + active_toks_[frame-1].must_prune_forward_links = true; + if (links_pruned) // any link was pruned + active_toks_[frame].must_prune_tokens = true; + active_toks_[frame].must_prune_forward_links = false; // job done + } + if (frame+1 < cur_frame && // except for last frame (no forward links) + active_toks_[frame+1].must_prune_tokens) { + PruneTokensForFrame(frame+1); + active_toks_[frame+1].must_prune_tokens = false; + } + } + KALDI_VLOG(3) << "PruneActiveTokens: pruned tokens from " << num_toks_begin + << " to " << num_toks_; + } + + // Version of PruneActiveTokens that we call on the final frame. + // Takes into account the final-prob of tokens. + void PruneActiveTokensFinal(int32 cur_frame) { + // returns true if there were final states active + // else returns false and treats all states as final while doing the pruning + // (this can be useful if you want partial lattice output, + // although it can be dangerous, depending what you want the lattices for). + // final_active_ and final_probs_ (a hash) are set internally + // by PruneForwardLinksFinal + int32 num_toks_begin = num_toks_; + PruneForwardLinksFinal(cur_frame); // prune final frame (with final-probs) + // sets final_active_ and final_probs_ + for (int32 frame = cur_frame-1; frame >= 0; frame--) { + bool b1, b2; // values not used. + BaseFloat dontcare = 0.0; // delta of zero means we must always update + PruneForwardLinks(frame, &b1, &b2, dontcare); + PruneTokensForFrame(frame+1); + } + PruneTokensForFrame(0); + KALDI_VLOG(3) << "PruneActiveTokensFinal: pruned tokens from " << num_toks_begin + << " to " << num_toks_; + } + + /// Gets the weight cutoff. Also counts the active tokens. + BaseFloat GetCutoff(Elem *list_head, size_t *tok_count, + BaseFloat *adaptive_beam, Elem **best_elem) { + BaseFloat best_weight = std::numeric_limits::infinity(); + // positive == high cost == bad. + size_t count = 0; + if (config_.max_active == std::numeric_limits::max()) { + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = static_cast(e->val->tot_cost); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + if (adaptive_beam != NULL) *adaptive_beam = config_.beam; + return best_weight + config_.beam; + } else { + tmp_array_.clear(); + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = e->val->tot_cost; + tmp_array_.push_back(w); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + if (tmp_array_.size() <= static_cast(config_.max_active)) { + if (adaptive_beam) *adaptive_beam = config_.beam; + return best_weight + config_.beam; + } else { + // the lowest elements (lowest costs, highest likes) + // will be put in the left part of tmp_array. + std::nth_element(tmp_array_.begin(), + tmp_array_.begin()+config_.max_active, + tmp_array_.end()); + // return the tighter of the two beams. + BaseFloat ans = std::min(best_weight + config_.beam, + *(tmp_array_.begin()+config_.max_active)); + if (adaptive_beam) + *adaptive_beam = std::min(config_.beam, + ans - best_weight + config_.beam_delta); + return ans; + } + } + } + + inline StateId PropagateLm(StateId lm_state, + Arc *arc) { // returns new LM state. + if (arc->olabel == 0) { + return lm_state; // no change in LM state if no word crossed. + } else { // Propagate in the LM-diff FST. + Arc lm_arc; + bool ans = lm_diff_fst_->GetArc(lm_state, arc->olabel, &lm_arc); + if (!ans) { // this case is unexpected for statistical LMs. + if (!warned_noarc_) { + warned_noarc_ = true; + KALDI_WARN << "No arc available in LM (unlikely to be correct " + "if a statistical language model); will not warn again"; + } + arc->weight = Weight::Zero(); + return lm_state; // doesn't really matter what we return here; will + // be pruned. + } else { + arc->weight = Times(arc->weight, lm_arc.weight); + arc->olabel = lm_arc.olabel; // probably will be the same. + return lm_arc.nextstate; // return the new LM state. + } + } + } + + void ProcessEmitting(DecodableInterface *decodable, int32 frame) { + // Processes emitting arcs for one frame. Propagates from prev_toks_ to cur_toks_. + Elem *last_toks = toks_.Clear(); // swapping prev_toks_ / cur_toks_ + Elem *best_elem = NULL; + BaseFloat adaptive_beam; + size_t tok_cnt; + BaseFloat cur_cutoff = GetCutoff(last_toks, &tok_cnt, &adaptive_beam, &best_elem); + PossiblyResizeHash(tok_cnt); // This makes sure the hash is always big enough. + + BaseFloat next_cutoff = std::numeric_limits::infinity(); + // pruning "online" before having seen all tokens + + // First process the best token to get a hopefully + // reasonably tight bound on the next cutoff. + if (best_elem) { + PairId state_pair = best_elem->key; + StateId state = PairToState(state_pair), // state in "fst" + lm_state = PairToLmState(state_pair); + Token *tok = best_elem->val; + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + Arc arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + PropagateLm(lm_state, &arc); // may affect "arc.weight". + // We don't need the return value (the new LM state). + arc.weight = Times(arc.weight, + Weight(-decodable->LogLikelihood(frame-1, arc.ilabel))); + BaseFloat new_weight = arc.weight.Value() + tok->tot_cost; + if (new_weight + adaptive_beam < next_cutoff) + next_cutoff = new_weight + adaptive_beam; + } + } + } + + // the tokens are now owned here, in last_toks, and the hash is empty. + // 'owned' is a complex thing here; the point is we need to call DeleteElem + // on each elem 'e' to let toks_ know we're done with them. + for (Elem *e = last_toks, *e_tail; e != NULL; e = e_tail) { + // loop this way because we delete "e" as we go. + PairId state_pair = e->key; + StateId state = PairToState(state_pair), + lm_state = PairToLmState(state_pair); + Token *tok = e->val; + if (tok->tot_cost <= cur_cutoff) { + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc_ref = aiter.Value(); + if (arc_ref.ilabel != 0) { // propagate.. + Arc arc(arc_ref); + StateId next_lm_state = PropagateLm(lm_state, &arc); + BaseFloat ac_cost = -decodable->LogLikelihood(frame-1, arc.ilabel), + graph_cost = arc.weight.Value(), + cur_cost = tok->tot_cost, + tot_cost = cur_cost + ac_cost + graph_cost; + if (tot_cost >= next_cutoff) continue; + else if (tot_cost + adaptive_beam < next_cutoff) + next_cutoff = tot_cost + adaptive_beam; // prune by best current token + PairId next_pair = ConstructPair(arc.nextstate, next_lm_state); + Elem *e_next = FindOrAddToken(next_pair, frame, tot_cost, true, NULL); + // true: emitting, NULL: no change indicator needed + + // Add ForwardLink from tok to next_tok (put on head of list tok->links) + tok->links = new ForwardLink(e_next->val, arc.ilabel, arc.olabel, + graph_cost, ac_cost, tok->links); + } + } // for all arcs + } + e_tail = e->tail; + toks_.Delete(e); // delete Elem + } + } + + void ProcessNonemitting(int32 frame) { + // note: "frame" is the same as emitting states just processed. + + // Processes nonemitting arcs for one frame. Propagates within toks_. + // Note-- this queue structure is is not very optimal as + // it may cause us to process states unnecessarily (e.g. more than once), + // but in the baseline code, turning this vector into a set to fix this + // problem did not improve overall speed. + + KALDI_ASSERT(queue_.empty()); + BaseFloat best_cost = std::numeric_limits::infinity(); + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) { + queue_.push_back(e); + // for pruning with current best token + best_cost = std::min(best_cost, static_cast(e->val->tot_cost)); + } + if (queue_.empty()) { + if (!warned_) { + KALDI_ERR << "Error in ProcessNonemitting: no surviving tokens: frame is " + << frame; + warned_ = true; + } + } + BaseFloat cutoff = best_cost + config_.beam; + + while (!queue_.empty()) { + const Elem *e = queue_.back(); + queue_.pop_back(); + + PairId state_pair = e->key; + Token *tok = e->val; // would segfault if state not in + // toks_ but this can't happen. + BaseFloat cur_cost = tok->tot_cost; + if (cur_cost >= cutoff) // Don't bother processing successors. + continue; + StateId state = PairToState(state_pair), + lm_state = PairToLmState(state_pair); + // If "tok" has any existing forward links, delete them, + // because we're about to regenerate them. This is a kind + // of non-optimality (remember, this is the simple decoder), + // but since most states are emitting it's not a huge issue. + tok->DeleteForwardLinks(); // necessary when re-visiting + tok->links = NULL; + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc_ref = aiter.Value(); + if (arc_ref.ilabel == 0) { // propagate nonemitting only... + Arc arc(arc_ref); + StateId next_lm_state = PropagateLm(lm_state, &arc); + BaseFloat graph_cost = arc.weight.Value(), + tot_cost = cur_cost + graph_cost; + if (tot_cost < cutoff) { + bool changed; + PairId next_pair = ConstructPair(arc.nextstate, next_lm_state); + Elem *e_new = FindOrAddToken(next_pair, frame, tot_cost, + false, &changed); // false: non-emit + + tok->links = new ForwardLink(e_new->val, 0, arc.olabel, + graph_cost, 0, tok->links); + + // "changed" tells us whether the new token has a different + // cost from before, or is new [if so, add into queue]. + if (changed) queue_.push_back(e_new); + } + } + } // for all arcs + } // while queue not empty + } + + + // HashList defined in ../util/hash-list.h. It actually allows us to maintain + // more than one list (e.g. for current and previous frames), but only one of + // them at a time can be indexed by StateId. + HashList toks_; + std::vector active_toks_; // Lists of tokens, indexed by + // frame (members of TokenList are toks, must_prune_forward_links, + // must_prune_tokens). + std::vector queue_; // temp variable used in ProcessNonemitting, + std::vector tmp_array_; // used in GetCutoff. + // make it class member to avoid internal new/delete. + const fst::Fst &fst_; + fst::DeterministicOnDemandFst *lm_diff_fst_; + LatticeBiglmFasterDecoderConfig config_; + bool warned_noarc_; + int32 num_toks_; // current total #toks allocated... + bool warned_; + bool final_active_; // use this to say whether we found active final tokens + // on the last frame. + std::map final_costs_; // A cache of final-costs + // of tokens on the last frame-- it's just convenient to store it this way. + + // It might seem unclear why we call DeleteElems(toks_.Clear()). + // There are two separate cleanup tasks we need to do at when we start a new file. + // one is to delete the Token objects in the list; the other is to delete + // the Elem objects. toks_.Clear() just clears them from the hash and gives ownership + // to the caller, who then has to call toks_.Delete(e) for each one. It was designed + // this way for convenience in propagating tokens from one frame to the next. + void DeleteElems(Elem *list) { + for (Elem *e = list, *e_tail; e != NULL; e = e_tail) { + e_tail = e->tail; + toks_.Delete(e); + } + toks_.Clear(); + } + + void ClearActiveTokens() { // a cleanup routine, at utt end/begin + for (size_t i = 0; i < active_toks_.size(); i++) { + // Delete all tokens alive on this frame, and any forward + // links they may have. + for (Token *tok = active_toks_[i].toks; tok != NULL; ) { + tok->DeleteForwardLinks(); + Token *next_tok = tok->next; + delete tok; + num_toks_--; + tok = next_tok; + } + } + active_toks_.clear(); + KALDI_ASSERT(num_toks_ == 0); + } +}; + +} // end namespace kaldi. + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-decoder.cc b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-decoder.cc new file mode 100644 index 0000000..6cd63d9 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-decoder.cc @@ -0,0 +1,1061 @@ +// decoder/lattice-faster-decoder.cc + +// Copyright 2009-2012 Microsoft Corporation Mirko Hannemann +// 2013-2018 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen +// 2018 Zhehuai Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "decoder/lattice-faster-decoder.h" +#include "lat/lattice-functions.h" + +namespace kaldi { +int niter = 0; +// instantiate this class once for each thing you have to decode. +template +LatticeFasterDecoderTpl::LatticeFasterDecoderTpl( + const FST &fst, const LatticeFasterDecoderConfig &config) + : fst_(&fst), + delete_fst_(false), + config_(config), + num_toks_(0), + token_pool_(config.memory_pool_tokens_block_size), + forward_link_pool_(config.memory_pool_links_block_size) { + config.Check(); + toks_.SetSize(1000); // just so on the first frame we do something reasonable. +} + +template +LatticeFasterDecoderTpl::LatticeFasterDecoderTpl( + const LatticeFasterDecoderConfig &config, FST *fst) + : fst_(fst), + delete_fst_(true), + config_(config), + num_toks_(0), + token_pool_(config.memory_pool_tokens_block_size), + forward_link_pool_(config.memory_pool_links_block_size) { + config.Check(); + toks_.SetSize(1000); // just so on the first frame we do something reasonable. +} + +template +LatticeFasterDecoderTpl::~LatticeFasterDecoderTpl() { + DeleteElems(toks_.Clear()); + ClearActiveTokens(); + if (delete_fst_) delete fst_; +} + +template +void LatticeFasterDecoderTpl::InitDecoding() { + // clean up from last time: + DeleteElems(toks_.Clear()); + cost_offsets_.clear(); + ClearActiveTokens(); + warned_ = false; + num_toks_ = 0; + decoding_finalized_ = false; + final_costs_.clear(); + StateId start_state = fst_->Start(); + KALDI_ASSERT(start_state != fst::kNoStateId); + active_toks_.resize(1); + Token *start_tok = + new (token_pool_.Allocate()) Token(0.0, 0.0, NULL, NULL, NULL); + active_toks_[0].toks = start_tok; + toks_.Insert(start_state, start_tok); + num_toks_++; + ProcessNonemitting(config_.beam); +} + +// Returns true if any kind of traceback is available (not necessarily from +// a final state). It should only very rarely return false; this indicates +// an unusual search error. +template +bool LatticeFasterDecoderTpl::Decode(DecodableInterface *decodable) { + InitDecoding(); + // We use 1-based indexing for frames in this decoder (if you view it in + // terms of features), but note that the decodable object uses zero-based + // numbering, which we have to correct for when we call it. + AdvanceDecoding(decodable); + FinalizeDecoding(); + + // Returns true if we have any kind of traceback available (not necessarily + // to the end state; query ReachedFinal() for that). + return !active_toks_.empty() && active_toks_.back().toks != NULL; +} + + +// Outputs an FST corresponding to the single best path through the lattice. +template +bool LatticeFasterDecoderTpl::GetBestPath(Lattice *olat, + bool use_final_probs) const { + Lattice raw_lat; + GetRawLattice(&raw_lat, use_final_probs); + ShortestPath(raw_lat, olat); + return (olat->NumStates() != 0); +} + + +// Outputs an FST corresponding to the raw, state-level lattice +template +bool LatticeFasterDecoderTpl::GetRawLattice( + Lattice *ofst, + bool use_final_probs) const { + typedef LatticeArc Arc; + typedef Arc::StateId StateId; + typedef Arc::Weight Weight; + typedef Arc::Label Label; + + // Note: you can't use the old interface (Decode()) if you want to + // get the lattice with use_final_probs = false. You'd have to do + // InitDecoding() and then AdvanceDecoding(). + if (decoding_finalized_ && !use_final_probs) + KALDI_ERR << "You cannot call FinalizeDecoding() and then call " + << "GetRawLattice() with use_final_probs == false"; + + unordered_map final_costs_local; + + const unordered_map &final_costs = + (decoding_finalized_ ? final_costs_ : final_costs_local); + if (!decoding_finalized_ && use_final_probs) + ComputeFinalCosts(&final_costs_local, NULL, NULL); + + ofst->DeleteStates(); + // num-frames plus one (since frames are one-based, and we have + // an extra frame for the start-state). + int32 num_frames = active_toks_.size() - 1; + KALDI_ASSERT(num_frames > 0); + const int32 bucket_count = num_toks_/2 + 3; + unordered_map tok_map(bucket_count); + // First create all states. + std::vector token_list; + for (int32 f = 0; f <= num_frames; f++) { + if (active_toks_[f].toks == NULL) { + KALDI_WARN << "GetRawLattice: no tokens active on frame " << f + << ": not producing lattice.\n"; + return false; + } + TopSortTokens(active_toks_[f].toks, &token_list); + for (size_t i = 0; i < token_list.size(); i++) + if (token_list[i] != NULL) + tok_map[token_list[i]] = ofst->AddState(); + } + // The next statement sets the start state of the output FST. Because we + // topologically sorted the tokens, state zero must be the start-state. + ofst->SetStart(0); + + KALDI_VLOG(4) << "init:" << num_toks_/2 + 3 << " buckets:" + << tok_map.bucket_count() << " load:" << tok_map.load_factor() + << " max:" << tok_map.max_load_factor(); + // Now create all arcs. + for (int32 f = 0; f <= num_frames; f++) { + for (Token *tok = active_toks_[f].toks; tok != NULL; tok = tok->next) { + StateId cur_state = tok_map[tok]; + for (ForwardLinkT *l = tok->links; + l != NULL; + l = l->next) { + typename unordered_map::const_iterator + iter = tok_map.find(l->next_tok); + StateId nextstate = iter->second; + KALDI_ASSERT(iter != tok_map.end()); + BaseFloat cost_offset = 0.0; + if (l->ilabel != 0) { // emitting.. + KALDI_ASSERT(f >= 0 && f < cost_offsets_.size()); + cost_offset = cost_offsets_[f]; + } + Arc arc(l->ilabel, l->olabel, + Weight(l->graph_cost, l->acoustic_cost - cost_offset), + nextstate); + ofst->AddArc(cur_state, arc); + } + if (f == num_frames) { + if (use_final_probs && !final_costs.empty()) { + typename unordered_map::const_iterator + iter = final_costs.find(tok); + if (iter != final_costs.end()) + ofst->SetFinal(cur_state, LatticeWeight(iter->second, 0)); + } else { + ofst->SetFinal(cur_state, LatticeWeight::One()); + } + } + } + } + return (ofst->NumStates() > 0); +} + + +// This function is now deprecated, since now we do determinization from outside +// the LatticeFasterDecoder class. Outputs an FST corresponding to the +// lattice-determinized lattice (one path per word sequence). +template +bool LatticeFasterDecoderTpl::GetLattice(CompactLattice *ofst, + bool use_final_probs) const { + Lattice raw_fst; + GetRawLattice(&raw_fst, use_final_probs); + Invert(&raw_fst); // make it so word labels are on the input. + // (in phase where we get backward-costs). + fst::ILabelCompare ilabel_comp; + ArcSort(&raw_fst, ilabel_comp); // sort on ilabel; makes + // lattice-determinization more efficient. + + fst::DeterminizeLatticePrunedOptions lat_opts; + lat_opts.max_mem = config_.det_opts.max_mem; + + DeterminizeLatticePruned(raw_fst, config_.lattice_beam, ofst, lat_opts); + raw_fst.DeleteStates(); // Free memory-- raw_fst no longer needed. + Connect(ofst); // Remove unreachable states... there might be + // a small number of these, in some cases. + // Note: if something went wrong and the raw lattice was empty, + // we should still get to this point in the code without warnings or failures. + return (ofst->NumStates() != 0); +} + +template +void LatticeFasterDecoderTpl::PossiblyResizeHash(size_t num_toks) { + size_t new_sz = static_cast(static_cast(num_toks) + * config_.hash_ratio); + if (new_sz > toks_.Size()) { + toks_.SetSize(new_sz); + } +} + +/* + A note on the definition of extra_cost. + + extra_cost is used in pruning tokens, to save memory. + + extra_cost can be thought of as a beta (backward) cost assuming + we had set the betas on currently-active tokens to all be the negative + of the alphas for those tokens. (So all currently active tokens would + be on (tied) best paths). + + We can use the extra_cost to accurately prune away tokens that we know will + never appear in the lattice. If the extra_cost is greater than the desired + lattice beam, the token would provably never appear in the lattice, so we can + prune away the token. + + (Note: we don't update all the extra_costs every time we update a frame; we + only do it every 'config_.prune_interval' frames). + */ + +// FindOrAddToken either locates a token in hash of toks_, +// or if necessary inserts a new, empty token (i.e. with no forward links) +// for the current frame. [note: it's inserted if necessary into hash toks_ +// and also into the singly linked list of tokens active on this frame +// (whose head is at active_toks_[frame]). +template +inline typename LatticeFasterDecoderTpl::Elem* +LatticeFasterDecoderTpl::FindOrAddToken( + StateId state, int32 frame_plus_one, BaseFloat tot_cost, + Token *backpointer, bool *changed, StateId bias_lm_state) { + // Returns the Token pointer. Sets "changed" (if non-NULL) to true + // if the token was newly created or the cost changed. + KALDI_ASSERT(frame_plus_one < active_toks_.size()); + Token *&toks = active_toks_[frame_plus_one].toks; + Elem *e_found = toks_.Insert(state, NULL); + if (e_found->val == NULL) { // no such token presently. + const BaseFloat extra_cost = 0.0; + // tokens on the currently final frame have zero extra_cost + // as any of them could end up + // on the winning path. + Token *new_tok = new (token_pool_.Allocate()) + Token(tot_cost, extra_cost, NULL, toks, backpointer); + // NULL: no forward links yet + new_tok->bias_lm_state = bias_lm_state; + toks = new_tok; + num_toks_++; + e_found->val = new_tok; + if (changed) *changed = true; + return e_found; + } else { + Token *tok = e_found->val; // There is an existing Token for this state. + if (tok->tot_cost > tot_cost) { // replace old token + tok->bias_lm_state = bias_lm_state; + tok->tot_cost = tot_cost; + // SetBackpointer() just does tok->backpointer = backpointer in + // the case where Token == BackpointerToken, else nothing. + tok->SetBackpointer(backpointer); + // we don't allocate a new token, the old stays linked in active_toks_ + // we only replace the tot_cost + // in the current frame, there are no forward links (and no extra_cost) + // only in ProcessNonemitting we have to delete forward links + // in case we visit a state for the second time + // those forward links, that lead to this replaced token before: + // they remain and will hopefully be pruned later (PruneForwardLinks...) + if (changed) *changed = true; + } else { + if (changed) *changed = false; + } + return e_found; + } +} + +// prunes outgoing links for all tokens in active_toks_[frame] +// it's called by PruneActiveTokens +// all links, that have link_extra_cost > lattice_beam are pruned +template +void LatticeFasterDecoderTpl::PruneForwardLinks( + int32 frame_plus_one, bool *extra_costs_changed, + bool *links_pruned, BaseFloat delta) { + // delta is the amount by which the extra_costs must change + // If delta is larger, we'll tend to go back less far + // toward the beginning of the file. + // extra_costs_changed is set to true if extra_cost was changed for any token + // links_pruned is set to true if any link in any token was pruned + + *extra_costs_changed = false; + *links_pruned = false; + KALDI_ASSERT(frame_plus_one >= 0 && frame_plus_one < active_toks_.size()); + if (active_toks_[frame_plus_one].toks == NULL) { // empty list; should not happen. + if (!warned_) { + KALDI_WARN << "No tokens alive [doing pruning].. warning first " + "time only for each utterance\n"; + warned_ = true; + } + } + + // We have to iterate until there is no more change, because the links + // are not guaranteed to be in topological order. + bool changed = true; // difference new minus old extra cost >= delta ? + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame_plus_one].toks; + tok != NULL; tok = tok->next) { + ForwardLinkT *link, *prev_link = NULL; + // will recompute tok_extra_cost for tok. + BaseFloat tok_extra_cost = std::numeric_limits::infinity(); + // tok_extra_cost is the best (min) of link_extra_cost of outgoing links + for (link = tok->links; link != NULL; ) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) + - next_tok->tot_cost); // difference in brackets is >= 0 + // link_exta_cost is the difference in score between the best paths + // through link source state and through link destination state + KALDI_ASSERT(link_extra_cost == link_extra_cost); // check for NaN + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLinkT *next_link = link->next; + if (prev_link != NULL) prev_link->next = next_link; + else tok->links = next_link; + forward_link_pool_.Free(link); + link = next_link; // advance link but leave prev_link the same. + *links_pruned = true; + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + //if (link_extra_cost < -0.01) + // KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) + tok_extra_cost = link_extra_cost; + prev_link = link; // move to next link + link = link->next; + } + } // for all outgoing links + if (fabs(tok_extra_cost - tok->extra_cost) > delta) + changed = true; // difference new minus old is bigger than delta + tok->extra_cost = tok_extra_cost; + // will be +infinity or <= lattice_beam_. + // infinity indicates, that no forward link survived pruning + } // for all Token on active_toks_[frame] + if (changed) *extra_costs_changed = true; + + // Note: it's theoretically possible that aggressive compiler + // optimizations could cause an infinite loop here for small delta and + // high-dynamic-range scores. + } // while changed +} + +// PruneForwardLinksFinal is a version of PruneForwardLinks that we call +// on the final frame. If there are final tokens active, it uses +// the final-probs for pruning, otherwise it treats all tokens as final. +template +void LatticeFasterDecoderTpl::PruneForwardLinksFinal() { + KALDI_ASSERT(!active_toks_.empty()); + int32 frame_plus_one = active_toks_.size() - 1; + + if (active_toks_[frame_plus_one].toks == NULL) // empty list; should not happen. + KALDI_WARN << "No tokens alive at end of file"; + + typedef typename unordered_map::const_iterator IterType; + ComputeFinalCosts(&final_costs_, &final_relative_cost_, &final_best_cost_); + decoding_finalized_ = true; + // We call DeleteElems() as a nicety, not because it's really necessary; + // otherwise there would be a time, after calling PruneTokensForFrame() on the + // final frame, when toks_.GetList() or toks_.Clear() would contain pointers + // to nonexistent tokens. + DeleteElems(toks_.Clear()); + + // Now go through tokens on this frame, pruning forward links... may have to + // iterate a few times until there is no more change, because the list is not + // in topological order. This is a modified version of the code in + // PruneForwardLinks, but here we also take account of the final-probs. + bool changed = true; + BaseFloat delta = 1.0e-05; + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame_plus_one].toks; + tok != NULL; tok = tok->next) { + ForwardLinkT *link, *prev_link = NULL; + // will recompute tok_extra_cost. It has a term in it that corresponds + // to the "final-prob", so instead of initializing tok_extra_cost to infinity + // below we set it to the difference between the (score+final_prob) of this token, + // and the best such (score+final_prob). + BaseFloat final_cost; + if (final_costs_.empty()) { + final_cost = 0.0; + } else { + IterType iter = final_costs_.find(tok); + if (iter != final_costs_.end()) + final_cost = iter->second; + else + final_cost = std::numeric_limits::infinity(); + } + BaseFloat tok_extra_cost = tok->tot_cost + final_cost - final_best_cost_; + // tok_extra_cost will be a "min" over either directly being final, or + // being indirectly final through other links, and the loop below may + // decrease its value: + for (link = tok->links; link != NULL; ) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) + - next_tok->tot_cost); + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLinkT *next_link = link->next; + if (prev_link != NULL) prev_link->next = next_link; + else tok->links = next_link; + forward_link_pool_.Free(link); + link = next_link; // advance link but leave prev_link the same. + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + //if (link_extra_cost < -0.01) + // KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) + tok_extra_cost = link_extra_cost; + prev_link = link; + link = link->next; + } + } + // prune away tokens worse than lattice_beam above best path. This step + // was not necessary in the non-final case because then, this case + // showed up as having no forward links. Here, the tok_extra_cost has + // an extra component relating to the final-prob. + if (tok_extra_cost > config_.lattice_beam) + tok_extra_cost = std::numeric_limits::infinity(); + // to be pruned in PruneTokensForFrame + + if (!ApproxEqual(tok->extra_cost, tok_extra_cost, delta)) + changed = true; + tok->extra_cost = tok_extra_cost; // will be +infinity or <= lattice_beam_. + } + } // while changed +} + +template +BaseFloat LatticeFasterDecoderTpl::FinalRelativeCost() const { + if (!decoding_finalized_) { + BaseFloat relative_cost; + ComputeFinalCosts(NULL, &relative_cost, NULL); + return relative_cost; + } else { + // we're not allowed to call that function if FinalizeDecoding() has + // been called; return a cached value. + return final_relative_cost_; + } +} + + +// Prune away any tokens on this frame that have no forward links. +// [we don't do this in PruneForwardLinks because it would give us +// a problem with dangling pointers]. +// It's called by PruneActiveTokens if any forward links have been pruned +template +void LatticeFasterDecoderTpl::PruneTokensForFrame(int32 frame_plus_one) { + KALDI_ASSERT(frame_plus_one >= 0 && frame_plus_one < active_toks_.size()); + Token *&toks = active_toks_[frame_plus_one].toks; + if (toks == NULL) + KALDI_WARN << "No tokens alive [doing pruning]"; + Token *tok, *next_tok, *prev_tok = NULL; + for (tok = toks; tok != NULL; tok = next_tok) { + next_tok = tok->next; + if (tok->extra_cost == std::numeric_limits::infinity()) { + // token is unreachable from end of graph; (no forward links survived) + // excise tok from list and delete tok. + if (prev_tok != NULL) prev_tok->next = tok->next; + else toks = tok->next; + token_pool_.Free(tok); + num_toks_--; + } else { // fetch next Token + prev_tok = tok; + } + } +} + +// Go backwards through still-alive tokens, pruning them, starting not from +// the current frame (where we want to keep all tokens) but from the frame before +// that. We go backwards through the frames and stop when we reach a point +// where the delta-costs are not changing (and the delta controls when we consider +// a cost to have "not changed"). +template +void LatticeFasterDecoderTpl::PruneActiveTokens(BaseFloat delta) { + int32 cur_frame_plus_one = NumFramesDecoded(); + int32 num_toks_begin = num_toks_; + // The index "f" below represents a "frame plus one", i.e. you'd have to subtract + // one to get the corresponding index for the decodable object. + for (int32 f = cur_frame_plus_one - 1; f >= 0; f--) { + // Reason why we need to prune forward links in this situation: + // (1) we have never pruned them (new TokenList) + // (2) we have not yet pruned the forward links to the next f, + // after any of those tokens have changed their extra_cost. + if (active_toks_[f].must_prune_forward_links) { + bool extra_costs_changed = false, links_pruned = false; + PruneForwardLinks(f, &extra_costs_changed, &links_pruned, delta); + if (extra_costs_changed && f > 0) // any token has changed extra_cost + active_toks_[f-1].must_prune_forward_links = true; + if (links_pruned) // any link was pruned + active_toks_[f].must_prune_tokens = true; + active_toks_[f].must_prune_forward_links = false; // job done + } + if (f+1 < cur_frame_plus_one && // except for last f (no forward links) + active_toks_[f+1].must_prune_tokens) { + PruneTokensForFrame(f+1); + active_toks_[f+1].must_prune_tokens = false; + } + } + KALDI_VLOG(4) << "PruneActiveTokens: pruned tokens from " << num_toks_begin + << " to " << num_toks_; +} + +template +void LatticeFasterDecoderTpl::ComputeFinalCosts( + unordered_map *final_costs, + BaseFloat *final_relative_cost, + BaseFloat *final_best_cost) const { + KALDI_ASSERT(!decoding_finalized_); + if (final_costs != NULL) + final_costs->clear(); + const Elem *final_toks = toks_.GetList(); + BaseFloat infinity = std::numeric_limits::infinity(); + BaseFloat best_cost = infinity, + best_cost_with_final = infinity; + + while (final_toks != NULL) { + StateId state = final_toks->key; + Token *tok = final_toks->val; + const Elem *next = final_toks->tail; + BaseFloat final_cost = fst_->Final(state).Value(); + BaseFloat cost = tok->tot_cost, + cost_with_final = cost + final_cost; + best_cost = std::min(cost, best_cost); + best_cost_with_final = std::min(cost_with_final, best_cost_with_final); + if (final_costs != NULL && final_cost != infinity) + (*final_costs)[tok] = final_cost; + final_toks = next; + } + if (final_relative_cost != NULL) { + if (best_cost == infinity && best_cost_with_final == infinity) { + // Likely this will only happen if there are no tokens surviving. + // This seems the least bad way to handle it. + *final_relative_cost = infinity; + } else { + *final_relative_cost = best_cost_with_final - best_cost; + } + } + if (final_best_cost != NULL) { + if (best_cost_with_final != infinity) { // final-state exists. + *final_best_cost = best_cost_with_final; + } else { // no final-state exists. + *final_best_cost = best_cost; + } + } +} + +template +void LatticeFasterDecoderTpl::AdvanceDecoding(DecodableInterface *decodable, + int32 max_num_frames) { + if (std::is_same >::value) { + // if the type 'FST' is the FST base-class, then see if the FST type of fst_ + // is actually VectorFst or ConstFst. If so, call the AdvanceDecoding() + // function after casting *this to the more specific type. + if (fst_->Type() == "const") { + LatticeFasterDecoderTpl, Token> *this_cast = + reinterpret_cast, Token>* >(this); + this_cast->AdvanceDecoding(decodable, max_num_frames); + return; + } else if (fst_->Type() == "vector") { + LatticeFasterDecoderTpl, Token> *this_cast = + reinterpret_cast, Token>* >(this); + this_cast->AdvanceDecoding(decodable, max_num_frames); + return; + } + } + + + KALDI_ASSERT(!active_toks_.empty() && !decoding_finalized_ && + "You must call InitDecoding() before AdvanceDecoding"); + int32 num_frames_ready = decodable->NumFramesReady(); + // num_frames_ready must be >= num_frames_decoded, or else + // the number of frames ready must have decreased (which doesn't + // make sense) or the decodable object changed between calls + // (which isn't allowed). + KALDI_ASSERT(num_frames_ready >= NumFramesDecoded()); + int32 target_frames_decoded = num_frames_ready; + if (max_num_frames >= 0) + target_frames_decoded = std::min(target_frames_decoded, + NumFramesDecoded() + max_num_frames); + while (NumFramesDecoded() < target_frames_decoded) { + if (NumFramesDecoded() % config_.prune_interval == 0) { + PruneActiveTokens(config_.lattice_beam * config_.prune_scale); + } + BaseFloat cost_cutoff = ProcessEmitting(decodable); + ProcessNonemitting(cost_cutoff); + } +} + +// FinalizeDecoding() is a version of PruneActiveTokens that we call +// (optionally) on the final frame. Takes into account the final-prob of +// tokens. This function used to be called PruneActiveTokensFinal(). +template +void LatticeFasterDecoderTpl::FinalizeDecoding() { + int32 final_frame_plus_one = NumFramesDecoded(); + int32 num_toks_begin = num_toks_; + // PruneForwardLinksFinal() prunes final frame (with final-probs), and + // sets decoding_finalized_. + PruneForwardLinksFinal(); + for (int32 f = final_frame_plus_one - 1; f >= 0; f--) { + bool b1, b2; // values not used. + BaseFloat dontcare = 0.0; // delta of zero means we must always update + PruneForwardLinks(f, &b1, &b2, dontcare); + PruneTokensForFrame(f + 1); + } + PruneTokensForFrame(0); + KALDI_VLOG(4) << "pruned tokens from " << num_toks_begin + << " to " << num_toks_; +} + +/// Gets the weight cutoff. Also counts the active tokens. +template +BaseFloat LatticeFasterDecoderTpl::GetCutoff(Elem *list_head, size_t *tok_count, + BaseFloat *adaptive_beam, Elem **best_elem) { + BaseFloat best_weight = std::numeric_limits::infinity(); + // positive == high cost == bad. + size_t count = 0; + if (config_.max_active == std::numeric_limits::max() && + config_.min_active == 0) { + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = static_cast(e->val->tot_cost); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + if (adaptive_beam != NULL) *adaptive_beam = config_.beam; + return best_weight + config_.beam; + } else { + tmp_array_.clear(); + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = e->val->tot_cost; + tmp_array_.push_back(w); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + + BaseFloat beam_cutoff = best_weight + config_.beam, + min_active_cutoff = std::numeric_limits::infinity(), + max_active_cutoff = std::numeric_limits::infinity(); + + KALDI_VLOG(6) << "Number of tokens active on frame " << NumFramesDecoded() + << " is " << tmp_array_.size(); + + if (tmp_array_.size() > static_cast(config_.max_active)) { + std::nth_element(tmp_array_.begin(), + tmp_array_.begin() + config_.max_active, + tmp_array_.end()); + max_active_cutoff = tmp_array_[config_.max_active]; + } + if (max_active_cutoff < beam_cutoff) { // max_active is tighter than beam. + if (adaptive_beam) + *adaptive_beam = max_active_cutoff - best_weight + config_.beam_delta; + return max_active_cutoff; + } + if (tmp_array_.size() > static_cast(config_.min_active)) { + if (config_.min_active == 0) min_active_cutoff = best_weight; + else { + std::nth_element(tmp_array_.begin(), + tmp_array_.begin() + config_.min_active, + tmp_array_.size() > static_cast(config_.max_active) ? + tmp_array_.begin() + config_.max_active : + tmp_array_.end()); + min_active_cutoff = tmp_array_[config_.min_active]; + } + } + if (min_active_cutoff > beam_cutoff) { // min_active is looser than beam. + if (adaptive_beam) + *adaptive_beam = min_active_cutoff - best_weight + config_.beam_delta; + return min_active_cutoff; + } else { + *adaptive_beam = config_.beam; + return beam_cutoff; + } + } +} + +template +BaseFloat LatticeFasterDecoderTpl::ProcessEmitting( + DecodableInterface *decodable) { + KALDI_ASSERT(active_toks_.size() > 0); + int32 frame = active_toks_.size() - 1; // frame is the frame-index + // (zero-based) used to get likelihoods + // from the decodable object. + active_toks_.resize(active_toks_.size() + 1); + + Elem *final_toks = toks_.Clear(); // analogous to swapping prev_toks_ / cur_toks_ + // in simple-decoder.h. Removes the Elems from + // being indexed in the hash in toks_. + Elem *best_elem = NULL; + BaseFloat adaptive_beam; + size_t tok_cnt; + BaseFloat cur_cutoff = GetCutoff(final_toks, &tok_cnt, &adaptive_beam, &best_elem); + KALDI_VLOG(6) << "Adaptive beam on frame " << NumFramesDecoded() << " is " + << adaptive_beam; + + PossiblyResizeHash(tok_cnt); // This makes sure the hash is always big enough. + + BaseFloat next_cutoff = std::numeric_limits::infinity(); + // pruning "online" before having seen all tokens + + BaseFloat cost_offset = 0.0; // Used to keep probabilities in a good + // dynamic range. + + + // First process the best token to get a hopefully + // reasonably tight bound on the next cutoff. The only + // products of the next block are "next_cutoff" and "cost_offset". + if (best_elem) { + StateId state = best_elem->key; + Token *tok = best_elem->val; + cost_offset = - tok->tot_cost; + for (fst::ArcIterator aiter(*fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + if (arc.nextstate == state) continue; + BaseFloat new_weight = arc.weight.Value() + cost_offset - + decodable->LogLikelihood(frame, arc.ilabel) + tok->tot_cost; + + if (new_weight + adaptive_beam < next_cutoff) + next_cutoff = new_weight + adaptive_beam; + } + } + } + + // Store the offset on the acoustic likelihoods that we're applying. + // Could just do cost_offsets_.push_back(cost_offset), but we + // do it this way as it's more robust to future code changes. + cost_offsets_.resize(frame + 1, 0.0); + cost_offsets_[frame] = cost_offset; + + // the tokens are now owned here, in final_toks, and the hash is empty. + // 'owned' is a complex thing here; the point is we need to call DeleteElem + // on each elem 'e' to let toks_ know we're done with them. + for (Elem *e = final_toks, *e_tail; e != NULL; e = e_tail) { + // loop this way because we delete "e" as we go. + StateId state = e->key; + Token *tok = e->val; + + if (tok->tot_cost <= cur_cutoff) { + for (fst::ArcIterator aiter(*fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + if (arc.nextstate == state) continue; + StateId new_bias_state = 0; + BaseFloat ac_cost = cost_offset - + decodable->LogLikelihood(frame, arc.ilabel), + graph_cost = arc.weight.Value(), + cur_cost = tok->tot_cost, + tot_cost = cur_cost + ac_cost + graph_cost; + + + if (bias_lm_) { + float bias_lm_score = 0.0f; + int frm = frame; + int stat = state; + int ilab = arc.ilabel-1; + if (arc.ilabel - 1 == 0) { + new_bias_state = tok->bias_lm_state; + } else { + bias_lm_score = bias_lm_->BiasLmScore(tok->bias_lm_state, + arc.ilabel - 1, new_bias_state); + } + graph_cost -= bias_lm_score; + tot_cost -= bias_lm_score; + } + + if (tot_cost >= next_cutoff) { + continue; + } else if (tot_cost + adaptive_beam < next_cutoff) { + next_cutoff = tot_cost + adaptive_beam; // prune by best current token + } + // Note: the frame indexes into active_toks_ are one-based, + // hence the + 1. + Elem *e_next = FindOrAddToken(arc.nextstate, + frame + 1, tot_cost, tok, NULL, new_bias_state); + // NULL: no change indicator needed + + // Add ForwardLink from tok to next_tok (put on head of list tok->links) + tok->links = new (forward_link_pool_.Allocate()) + ForwardLinkT(e_next->val, arc.ilabel, arc.olabel, graph_cost, + ac_cost, tok->links); + } + } // for all arcs + } + e_tail = e->tail; + toks_.Delete(e); // delete Elem + } + return next_cutoff; +} + +template +std::string LatticeFasterDecoderTpl::GetTokResult(Token *tok) { + if (!tok) { return ""; } + std::string res; + ForwardLinkT* link; + std::vector phn_id; + tok->GetLabelSeq(tok, phn_id); + for (int i = 0; i < phn_id.size(); i++) { + res = bias_lm_->GetPhoneLabel(phn_id[i]) + res; + } + return res; +} + +// static inline +template +void LatticeFasterDecoderTpl::DeleteForwardLinks(Token *tok) { + ForwardLinkT *l = tok->links, *m; + while (l != NULL) { + m = l->next; + forward_link_pool_.Free(l); + l = m; + } + tok->links = NULL; +} + +template +void LatticeFasterDecoderTpl::ProcessNonemitting(BaseFloat cutoff) { + KALDI_ASSERT(!active_toks_.empty()); + int32 frame = static_cast(active_toks_.size()) - 2; + // Note: "frame" is the time-index we just processed, or -1 if + // we are processing the nonemitting transitions before the + // first frame (called from InitDecoding()). + + // Processes nonemitting arcs for one frame. Propagates within toks_. + // Note-- this queue structure is not very optimal as + // it may cause us to process states unnecessarily (e.g. more than once), + // but in the baseline code, turning this vector into a set to fix this + // problem did not improve overall speed. + + KALDI_ASSERT(queue_.empty()); + + if (toks_.GetList() == NULL) { + if (!warned_) { + KALDI_WARN << "Error, no surviving tokens: frame is " << frame; + warned_ = true; + } + } + + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) { + StateId state = e->key; + if (fst_->NumInputEpsilons(state) != 0) + queue_.push_back(e); + } + + while (!queue_.empty()) { + const Elem *e = queue_.back(); + queue_.pop_back(); + + StateId state = e->key; + Token *tok = e->val; // would segfault if e is a NULL pointer but this can't happen. + BaseFloat cur_cost = tok->tot_cost; + if (cur_cost >= cutoff) // Don't bother processing successors. + continue; + // If "tok" has any existing forward links, delete them, + // because we're about to regenerate them. This is a kind + // of non-optimality (remember, this is the simple decoder), + // but since most states are emitting it's not a huge issue. + DeleteForwardLinks(tok); // necessary when re-visiting + tok->links = NULL; + for (fst::ArcIterator aiter(*fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel == 0) { // propagate nonemitting only... + BaseFloat graph_cost = arc.weight.Value(), + tot_cost = cur_cost + graph_cost; + if (tot_cost < cutoff) { + bool changed; + + Elem *e_new = FindOrAddToken(arc.nextstate, frame + 1, tot_cost, + tok, &changed); + if (bias_lm_ && changed) { + e_new->val->bias_lm_state = tok->bias_lm_state; + } + + tok->links = new (forward_link_pool_.Allocate()) ForwardLinkT( + e_new->val, 0, arc.olabel, graph_cost, 0, tok->links); + + // "changed" tells us whether the new token has a different + // cost from before, or is new [if so, add into queue]. + if (changed && fst_->NumInputEpsilons(arc.nextstate) != 0) + queue_.push_back(e_new); + } + } + } // for all arcs + } // while queue not empty +} + + +template +void LatticeFasterDecoderTpl::DeleteElems(Elem *list) { + for (Elem *e = list, *e_tail; e != NULL; e = e_tail) { + e_tail = e->tail; + toks_.Delete(e); + } +} + +template +void LatticeFasterDecoderTpl::ClearActiveTokens() { // a cleanup routine, at utt end/begin + for (size_t i = 0; i < active_toks_.size(); i++) { + // Delete all tokens alive on this frame, and any forward + // links they may have. + for (Token *tok = active_toks_[i].toks; tok != NULL; ) { + DeleteForwardLinks(tok); + Token *next_tok = tok->next; + token_pool_.Free(tok); + num_toks_--; + tok = next_tok; + } + } + active_toks_.clear(); + KALDI_ASSERT(num_toks_ == 0); +} + +// static +template +void LatticeFasterDecoderTpl::TopSortTokens( + Token *tok_list, std::vector *topsorted_list) { + unordered_map token2pos; + typedef typename unordered_map::iterator IterType; + int32 num_toks = 0; + for (Token *tok = tok_list; tok != NULL; tok = tok->next) + num_toks++; + int32 cur_pos = 0; + // We assign the tokens numbers num_toks - 1, ... , 2, 1, 0. + // This is likely to be in closer to topological order than + // if we had given them ascending order, because of the way + // new tokens are put at the front of the list. + for (Token *tok = tok_list; tok != NULL; tok = tok->next) + token2pos[tok] = num_toks - ++cur_pos; + + unordered_set reprocess; + + for (IterType iter = token2pos.begin(); iter != token2pos.end(); ++iter) { + Token *tok = iter->first; + int32 pos = iter->second; + for (ForwardLinkT *link = tok->links; link != NULL; link = link->next) { + if (link->ilabel == 0) { + // We only need to consider epsilon links, since non-epsilon links + // transition between frames and this function only needs to sort a list + // of tokens from a single frame. + IterType following_iter = token2pos.find(link->next_tok); + if (following_iter != token2pos.end()) { // another token on this frame, + // so must consider it. + int32 next_pos = following_iter->second; + if (next_pos < pos) { // reassign the position of the next Token. + following_iter->second = cur_pos++; + reprocess.insert(link->next_tok); + } + } + } + } + // In case we had previously assigned this token to be reprocessed, we can + // erase it from that set because it's "happy now" (we just processed it). + reprocess.erase(tok); + } + + size_t max_loop = 1000000, loop_count; // max_loop is to detect epsilon cycles. + for (loop_count = 0; + !reprocess.empty() && loop_count < max_loop; ++loop_count) { + std::vector reprocess_vec; + for (typename unordered_set::iterator iter = reprocess.begin(); + iter != reprocess.end(); ++iter) + reprocess_vec.push_back(*iter); + reprocess.clear(); + for (typename std::vector::iterator iter = reprocess_vec.begin(); + iter != reprocess_vec.end(); ++iter) { + Token *tok = *iter; + int32 pos = token2pos[tok]; + // Repeat the processing we did above (for comments, see above). + for (ForwardLinkT *link = tok->links; link != NULL; link = link->next) { + if (link->ilabel == 0) { + IterType following_iter = token2pos.find(link->next_tok); + if (following_iter != token2pos.end()) { + int32 next_pos = following_iter->second; + if (next_pos < pos) { + following_iter->second = cur_pos++; + reprocess.insert(link->next_tok); + } + } + } + } + } + } + KALDI_ASSERT(loop_count < max_loop && "Epsilon loops exist in your decoding " + "graph (this is not allowed!)"); + + topsorted_list->clear(); + topsorted_list->resize(cur_pos, NULL); // create a list with NULLs in between. + for (IterType iter = token2pos.begin(); iter != token2pos.end(); ++iter) + (*topsorted_list)[iter->second] = iter->first; +} + +// Instantiate the template for the combination of token types and FST types +// that we'll need. +template class LatticeFasterDecoderTpl, decoder::StdToken>; +template class LatticeFasterDecoderTpl, decoder::StdToken >; +template class LatticeFasterDecoderTpl, decoder::StdToken >; + +//template class LatticeFasterDecoderTpl; +//template class LatticeFasterDecoderTpl; + +template class LatticeFasterDecoderTpl , decoder::BackpointerToken>; +template class LatticeFasterDecoderTpl, decoder::BackpointerToken >; +template class LatticeFasterDecoderTpl, decoder::BackpointerToken >; +//template class LatticeFasterDecoderTpl; +//template class LatticeFasterDecoderTpl; + + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-decoder.h new file mode 100644 index 0000000..b752e17 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-decoder.h @@ -0,0 +1,597 @@ +// decoder/lattice-faster-decoder.h + +// Copyright 2009-2013 Microsoft Corporation; Mirko Hannemann; +// 2013-2014 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen +// 2018 Zhehuai Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_LATTICE_FASTER_DECODER_H_ +#define KALDI_DECODER_LATTICE_FASTER_DECODER_H_ + +//#include "decoder/grammar-fst.h" +#include "fst/fstlib.h" +#include "fst/memory.h" +#include "fstext/fstext-lib.h" +#include "itf/decodable-itf.h" +#include "lat/determinize-lattice-pruned.h" +#include "lat/kaldi-lattice.h" +#include "util/hash-list.h" +#include "util/stl-utils.h" +#include "bias-lm.h" + +namespace kaldi { + +struct LatticeFasterDecoderConfig { + BaseFloat beam; + int32 max_active; + int32 min_active; + BaseFloat lattice_beam; + int32 prune_interval; + bool determinize_lattice; // not inspected by this class... used in + // command-line program. + BaseFloat beam_delta; + BaseFloat hash_ratio; + // Note: we don't make prune_scale configurable on the command line, it's not + // a very important parameter. It affects the algorithm that prunes the + // tokens as we go. + BaseFloat prune_scale; + + // Number of elements in the block for Token and ForwardLink memory + // pool allocation. + int32 memory_pool_tokens_block_size; + int32 memory_pool_links_block_size; + + // Most of the options inside det_opts are not actually queried by the + // LatticeFasterDecoder class itself, but by the code that calls it, for + // example in the function DecodeUtteranceLatticeFaster. + fst::DeterminizeLatticePhonePrunedOptions det_opts; + + LatticeFasterDecoderConfig(float glob_beam, float lat_beam) + : beam(glob_beam), + max_active(std::numeric_limits::max()), + min_active(200), + lattice_beam(lat_beam), + prune_interval(25), + determinize_lattice(true), + beam_delta(0.5), + hash_ratio(2.0), + prune_scale(0.1), + memory_pool_tokens_block_size(1 << 8), + memory_pool_links_block_size(1 << 8) {} + + LatticeFasterDecoderConfig() + : beam(3.0), + max_active(std::numeric_limits::max()), + min_active(200), + lattice_beam(3.0), + prune_interval(25), + determinize_lattice(true), + beam_delta(0.5), + hash_ratio(2.0), + prune_scale(0.1), + memory_pool_tokens_block_size(1 << 8), + memory_pool_links_block_size(1 << 8) {} + void Register(OptionsItf *opts) { + det_opts.Register(opts); + opts->Register("beam", &beam, "Decoding beam. Larger->slower, more accurate."); + opts->Register("max-active", &max_active, "Decoder max active states. Larger->slower; " + "more accurate"); + opts->Register("min-active", &min_active, "Decoder minimum #active states."); + opts->Register("lattice-beam", &lattice_beam, "Lattice generation beam. Larger->slower, " + "and deeper lattices"); + opts->Register("prune-interval", &prune_interval, "Interval (in frames) at " + "which to prune tokens"); + opts->Register("determinize-lattice", &determinize_lattice, "If true, " + "determinize the lattice (lattice-determinization, keeping only " + "best pdf-sequence for each word-sequence)."); + opts->Register("beam-delta", &beam_delta, "Increment used in decoding-- this " + "parameter is obscure and relates to a speedup in the way the " + "max-active constraint is applied. Larger is more accurate."); + opts->Register("hash-ratio", &hash_ratio, "Setting used in decoder to " + "control hash behavior"); + opts->Register("memory-pool-tokens-block-size", &memory_pool_tokens_block_size, + "Memory pool block size suggestion for storing tokens (in elements). " + "Smaller uses less memory but increases cache misses."); + opts->Register("memory-pool-links-block-size", &memory_pool_links_block_size, + "Memory pool block size suggestion for storing links (in elements). " + "Smaller uses less memory but increases cache misses."); + } + void Check() const { + KALDI_ASSERT(beam > 0.0 && max_active > 1 && lattice_beam > 0.0 + && min_active <= max_active + && prune_interval > 0 && beam_delta > 0.0 && hash_ratio >= 1.0 + && prune_scale > 0.0 && prune_scale < 1.0); + } +}; + +namespace decoder { +// We will template the decoder on the token type as well as the FST type; this +// is a mechanism so that we can use the same underlying decoder code for +// versions of the decoder that support quickly getting the best path +// (LatticeFasterOnlineDecoder, see lattice-faster-online-decoder.h) and also +// those that do not (LatticeFasterDecoder). + + +// ForwardLinks are the links from a token to a token on the next frame. +// or sometimes on the current frame (for input-epsilon links). +template +struct ForwardLink { + using Label = fst::StdArc::Label; + + Token *next_tok; // the next token [or NULL if represents final-state] + Label ilabel; // ilabel on arc + Label olabel; // olabel on arc + BaseFloat graph_cost; // graph cost of traversing arc (contains LM, etc.) + BaseFloat acoustic_cost; // acoustic cost (pre-scaled) of traversing arc + ForwardLink *next; // next in singly-linked list of forward arcs (arcs + // in the state-level lattice) from a token. + inline ForwardLink(Token *next_tok, Label ilabel, Label olabel, + BaseFloat graph_cost, BaseFloat acoustic_cost, + ForwardLink *next): + next_tok(next_tok), ilabel(ilabel), olabel(olabel), + graph_cost(graph_cost), acoustic_cost(acoustic_cost), + next(next) { } +}; + + +struct StdToken { + using ForwardLinkT = ForwardLink; + using Token = StdToken; + + // Standard token type for LatticeFasterDecoder. Each active HCLG + // (decoding-graph) state on each frame has one token. + + // tot_cost is the total (LM + acoustic) cost from the beginning of the + // utterance up to this point. (but see cost_offset_, which is subtracted + // to keep it in a good numerical range). + BaseFloat tot_cost; + + // exta_cost is >= 0. After calling PruneForwardLinks, this equals the + // minimum difference between the cost of the best path that this link is a + // part of, and the cost of the absolute best path, under the assumption that + // any of the currently active states at the decoding front may eventually + // succeed (e.g. if you were to take the currently active states one by one + // and compute this difference, and then take the minimum). + BaseFloat extra_cost; + // 'links' is the head of singly-linked list of ForwardLinks, which is what we + // use for lattice generation. + ForwardLinkT *links; + + //'next' is the next in the singly-linked list of tokens for this frame. + Token *next; + + // bias_lm_state is used to record the state of tokens in the bias lm network + LatticeArc::StateId bias_lm_state; + + // This function does nothing and should be optimized out; it's needed + // so we can share the regular LatticeFasterDecoderTpl code and the code + // for LatticeFasterOnlineDecoder that supports fast traceback. + inline void SetBackpointer (Token *backpointer) { } + + // This constructor just ignores the 'backpointer' argument. That argument is + // needed so that we can use the same decoder code for LatticeFasterDecoderTpl + // and LatticeFasterOnlineDecoderTpl (which needs backpointers to support a + // fast way to obtain the best path). + inline StdToken(BaseFloat tot_cost, BaseFloat extra_cost, ForwardLinkT *links, + Token *next, Token *backpointer): + tot_cost(tot_cost), extra_cost(extra_cost), links(links), next(next), bias_lm_state(0) { } + + inline void GetLabelSeq(Token *tok, std::vector &phn_id) {} +}; + +struct BackpointerToken { + using ForwardLinkT = ForwardLink; + using Token = BackpointerToken; + + // BackpointerToken is like Token but also + // Standard token type for LatticeFasterDecoder. Each active HCLG + // (decoding-graph) state on each frame has one token. + + // tot_cost is the total (LM + acoustic) cost from the beginning of the + // utterance up to this point. (but see cost_offset_, which is subtracted + // to keep it in a good numerical range). + BaseFloat tot_cost; + + // exta_cost is >= 0. After calling PruneForwardLinks, this equals + // the minimum difference between the cost of the best path, and the cost of + // this is on, and the cost of the absolute best path, under the assumption + // that any of the currently active states at the decoding front may + // eventually succeed (e.g. if you were to take the currently active states + // one by one and compute this difference, and then take the minimum). + BaseFloat extra_cost; + + // 'links' is the head of singly-linked list of ForwardLinks, which is what we + // use for lattice generation. + ForwardLinkT *links; + + //'next' is the next in the singly-linked list of tokens for this frame. + BackpointerToken *next; + + // Best preceding BackpointerToken (could be a on this frame, connected to + // this via an epsilon transition, or on a previous frame). This is only + // required for an efficient GetBestPath function in + // LatticeFasterOnlineDecoderTpl; it plays no part in the lattice generation + // (the "links" list is what stores the forward links, for that). + Token *backpointer; + + // bias_lm_state is used to record the state of tokens in the bias lm network + LatticeArc::StateId bias_lm_state; + + inline void SetBackpointer (Token *backpointer) { + this->backpointer = backpointer; + } + + inline BackpointerToken(BaseFloat tot_cost, BaseFloat extra_cost, ForwardLinkT *links, + Token *next, Token *backpointer): + tot_cost(tot_cost), extra_cost(extra_cost), links(links), next(next), + backpointer(backpointer), bias_lm_state(0) { } + + inline void GetLabelSeq(Token *token, std::vector &phn_id) { + ForwardLinkT* link; + Token *tok = token; + while (tok && tok->backpointer) { + for (link = tok->backpointer->links; link != NULL; link = link->next) { + if (link->next_tok == tok) { + phn_id.push_back(link->ilabel - 1); + break; + } + } + tok = tok->backpointer; + } + } +}; + +} // namespace decoder + + +/** This is the "normal" lattice-generating decoder. + See \ref lattices_generation \ref decoders_faster and \ref decoders_simple + for more information. + + The decoder is templated on the FST type and the token type. The token type + will normally be StdToken, but also may be BackpointerToken which is to support + quick lookup of the current best path (see lattice-faster-online-decoder.h) + + The FST you invoke this decoder which is expected to equal + Fst::Fst, a.k.a. StdFst, or GrammarFst. If you invoke it with + FST == StdFst and it notices that the actual FST type is + fst::VectorFst or fst::ConstFst, the decoder object + will internally cast itself to one that is templated on those more specific + types; this is an optimization for speed. + */ +template +class LatticeFasterDecoderTpl { + public: + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using ForwardLinkT = decoder::ForwardLink; + + // Instantiate this class once for each thing you have to decode. + // This version of the constructor does not take ownership of + // 'fst'. + LatticeFasterDecoderTpl(const FST &fst, + const LatticeFasterDecoderConfig &config); + + // This version of the constructor takes ownership of the fst, and will delete + // it when this object is destroyed. + LatticeFasterDecoderTpl(const LatticeFasterDecoderConfig &config, + FST *fst); + //LatticeFasterDecoderTpl() { } + + void SetOptions(const LatticeFasterDecoderConfig &config) { + config_ = config; + } + + const LatticeFasterDecoderConfig &GetOptions() const { + return config_; + } + + ~LatticeFasterDecoderTpl(); + + /// Decodes until there are no more frames left in the "decodable" object.. + /// note, this may block waiting for input if the "decodable" object blocks. + /// Returns true if any kind of traceback is available (not necessarily from a + /// final state). + bool Decode(DecodableInterface *decodable); + + + /// says whether a final-state was active on the last frame. If it was not, the + /// lattice (or traceback) will end with states that are not final-states. + bool ReachedFinal() const { + return FinalRelativeCost() != std::numeric_limits::infinity(); + } + + /// Outputs an FST corresponding to the single best path through the lattice. + /// Returns true if result is nonempty (using the return status is deprecated, + /// it will become void). If "use_final_probs" is true AND we reached the + /// final-state of the graph then it will include those as final-probs, else + /// it will treat all final-probs as one. Note: this just calls GetRawLattice() + /// and figures out the shortest path. + bool GetBestPath(Lattice *ofst, + bool use_final_probs = true) const; + + /// Outputs an FST corresponding to the raw, state-level + /// tracebacks. Returns true if result is nonempty. + /// If "use_final_probs" is true AND we reached the final-state + /// of the graph then it will include those as final-probs, else + /// it will treat all final-probs as one. + /// The raw lattice will be topologically sorted. + /// + /// See also GetRawLatticePruned in lattice-faster-online-decoder.h, + /// which also supports a pruning beam, in case for some reason + /// you want it pruned tighter than the regular lattice beam. + /// We could put that here in future needed. + bool GetRawLattice(Lattice *ofst, bool use_final_probs = true) const; + + + + /// [Deprecated, users should now use GetRawLattice and determinize it + /// themselves, e.g. using DeterminizeLatticePhonePrunedWrapper]. + /// Outputs an FST corresponding to the lattice-determinized + /// lattice (one path per word sequence). Returns true if result is nonempty. + /// If "use_final_probs" is true AND we reached the final-state of the graph + /// then it will include those as final-probs, else it will treat all + /// final-probs as one. + bool GetLattice(CompactLattice *ofst, + bool use_final_probs = true) const; + + /// InitDecoding initializes the decoding, and should only be used if you + /// intend to call AdvanceDecoding(). If you call Decode(), you don't need to + /// call this. You can also call InitDecoding if you have already decoded an + /// utterance and want to start with a new utterance. + void InitDecoding(); + + /// This will decode until there are no more frames ready in the decodable + /// object. You can keep calling it each time more frames become available. + /// If max_num_frames is specified, it specifies the maximum number of frames + /// the function will decode before returning. + void AdvanceDecoding(DecodableInterface *decodable, + int32 max_num_frames = -1); + + /// This function may be optionally called after AdvanceDecoding(), when you + /// do not plan to decode any further. It does an extra pruning step that + /// will help to prune the lattices output by GetLattice and (particularly) + /// GetRawLattice more completely, particularly toward the end of the + /// utterance. If you call this, you cannot call AdvanceDecoding again (it + /// will fail), and you cannot call GetLattice() and related functions with + /// use_final_probs = false. Used to be called PruneActiveTokensFinal(). + void FinalizeDecoding(); + + /// FinalRelativeCost() serves the same purpose as ReachedFinal(), but gives + /// more information. It returns the difference between the best (final-cost + /// plus cost) of any token on the final frame, and the best cost of any token + /// on the final frame. If it is infinity it means no final-states were + /// present on the final frame. It will usually be nonnegative. If it not + /// too positive (e.g. < 5 is my first guess, but this is not tested) you can + /// take it as a good indication that we reached the final-state with + /// reasonable likelihood. + BaseFloat FinalRelativeCost() const; + + + // Returns the number of frames decoded so far. The value returned changes + // whenever we call ProcessEmitting(). + inline int32 NumFramesDecoded() const { return active_toks_.size() - 1; } + + std::string GetTokResult(Token *tok); + + void SetBiasLm(std::shared_ptr &bias_lm) { + bias_lm_ = bias_lm; + } + + void ClearBiasLm() { + bias_lm_.reset(); + } + + protected: + // we make things protected instead of private, as code in + // LatticeFasterOnlineDecoderTpl, which inherits from this, also uses the + // internals. + + // Deletes the elements of the singly linked list tok->links. + void DeleteForwardLinks(Token *tok); + + // head of per-frame list of Tokens (list is in topological order), + // and something saying whether we ever pruned it using PruneForwardLinks. + struct TokenList { + Token *toks; + bool must_prune_forward_links; + bool must_prune_tokens; + TokenList(): toks(NULL), must_prune_forward_links(true), + must_prune_tokens(true) { } + }; + + using Elem = typename HashList::Elem; + // Equivalent to: + // struct Elem { + // StateId key; + // Token *val; + // Elem *tail; + // }; + + void PossiblyResizeHash(size_t num_toks); + + // FindOrAddToken either locates a token in hash of toks_, or if necessary + // inserts a new, empty token (i.e. with no forward links) for the current + // frame. [note: it's inserted if necessary into hash toks_ and also into the + // singly linked list of tokens active on this frame (whose head is at + // active_toks_[frame]). The frame_plus_one argument is the acoustic frame + // index plus one, which is used to index into the active_toks_ array. + // Returns the Token pointer. Sets "changed" (if non-NULL) to true if the + // token was newly created or the cost changed. + // If Token == StdToken, the 'backpointer' argument has no purpose (and will + // hopefully be optimized out). + inline Elem *FindOrAddToken(StateId state, int32 frame_plus_one, + BaseFloat tot_cost, Token *backpointer, + bool *changed, StateId bias_lm_state = 0); + + // prunes outgoing links for all tokens in active_toks_[frame] + // it's called by PruneActiveTokens + // all links, that have link_extra_cost > lattice_beam are pruned + // delta is the amount by which the extra_costs must change + // before we set *extra_costs_changed = true. + // If delta is larger, we'll tend to go back less far + // toward the beginning of the file. + // extra_costs_changed is set to true if extra_cost was changed for any token + // links_pruned is set to true if any link in any token was pruned + void PruneForwardLinks(int32 frame_plus_one, bool *extra_costs_changed, + bool *links_pruned, + BaseFloat delta); + + // This function computes the final-costs for tokens active on the final + // frame. It outputs to final-costs, if non-NULL, a map from the Token* + // pointer to the final-prob of the corresponding state, for all Tokens + // that correspond to states that have final-probs. This map will be + // empty if there were no final-probs. It outputs to + // final_relative_cost, if non-NULL, the difference between the best + // forward-cost including the final-prob cost, and the best forward-cost + // without including the final-prob cost (this will usually be positive), or + // infinity if there were no final-probs. [c.f. FinalRelativeCost(), which + // outputs this quanitity]. It outputs to final_best_cost, if + // non-NULL, the lowest for any token t active on the final frame, of + // forward-cost[t] + final-cost[t], where final-cost[t] is the final-cost in + // the graph of the state corresponding to token t, or the best of + // forward-cost[t] if there were no final-probs active on the final frame. + // You cannot call this after FinalizeDecoding() has been called; in that + // case you should get the answer from class-member variables. + void ComputeFinalCosts(unordered_map *final_costs, + BaseFloat *final_relative_cost, + BaseFloat *final_best_cost) const; + + // PruneForwardLinksFinal is a version of PruneForwardLinks that we call + // on the final frame. If there are final tokens active, it uses + // the final-probs for pruning, otherwise it treats all tokens as final. + void PruneForwardLinksFinal(); + + // Prune away any tokens on this frame that have no forward links. + // [we don't do this in PruneForwardLinks because it would give us + // a problem with dangling pointers]. + // It's called by PruneActiveTokens if any forward links have been pruned + void PruneTokensForFrame(int32 frame_plus_one); + + + // Go backwards through still-alive tokens, pruning them if the + // forward+backward cost is more than lat_beam away from the best path. It's + // possible to prove that this is "correct" in the sense that we won't lose + // anything outside of lat_beam, regardless of what happens in the future. + // delta controls when it considers a cost to have changed enough to continue + // going backward and propagating the change. larger delta -> will recurse + // less far. + void PruneActiveTokens(BaseFloat delta); + + /// Gets the weight cutoff. Also counts the active tokens. + BaseFloat GetCutoff(Elem *list_head, size_t *tok_count, + BaseFloat *adaptive_beam, Elem **best_elem); + + /// Processes emitting arcs for one frame. Propagates from prev_toks_ to + /// cur_toks_. Returns the cost cutoff for subsequent ProcessNonemitting() to + /// use. + BaseFloat ProcessEmitting(DecodableInterface *decodable); + + /// Processes nonemitting (epsilon) arcs for one frame. Called after + /// ProcessEmitting() on each frame. The cost cutoff is computed by the + /// preceding ProcessEmitting(). + void ProcessNonemitting(BaseFloat cost_cutoff); + + // HashList defined in ../util/hash-list.h. It actually allows us to maintain + // more than one list (e.g. for current and previous frames), but only one of + // them at a time can be indexed by StateId. It is indexed by frame-index + // plus one, where the frame-index is zero-based, as used in decodable object. + // That is, the emitting probs of frame t are accounted for in tokens at + // toks_[t+1]. The zeroth frame is for nonemitting transition at the start of + // the graph. + HashList toks_; + + std::vector active_toks_; // Lists of tokens, indexed by + // frame (members of TokenList are toks, must_prune_forward_links, + // must_prune_tokens). + std::vector queue_; // temp variable used in ProcessNonemitting, + std::vector tmp_array_; // used in GetCutoff. + + // fst_ is a pointer to the FST we are decoding from. + const FST *fst_; + // delete_fst_ is true if the pointer fst_ needs to be deleted when this + // object is destroyed. + bool delete_fst_; + + std::vector cost_offsets_; // This contains, for each + // frame, an offset that was added to the acoustic log-likelihoods on that + // frame in order to keep everything in a nice dynamic range i.e. close to + // zero, to reduce roundoff errors. + LatticeFasterDecoderConfig config_; + int32 num_toks_; // current total #toks allocated... + bool warned_; + + /// decoding_finalized_ is true if someone called FinalizeDecoding(). [note, + /// calling this is optional]. If true, it's forbidden to decode more. Also, + /// if this is set, then the output of ComputeFinalCosts() is in the next + /// three variables. The reason we need to do this is that after + /// FinalizeDecoding() calls PruneTokensForFrame() for the final frame, some + /// of the tokens on the last frame are freed, so we free the list from toks_ + /// to avoid having dangling pointers hanging around. + bool decoding_finalized_; + /// For the meaning of the next 3 variables, see the comment for + /// decoding_finalized_ above., and ComputeFinalCosts(). + unordered_map final_costs_; + BaseFloat final_relative_cost_; + BaseFloat final_best_cost_; + + // Memory pools for storing tokens and forward links. + // We use it to decrease the work put on allocator and to move some of data + // together. Too small block sizes will result in more work to allocator but + // bigger ones increase the memory usage. + fst::MemoryPool token_pool_; + fst::MemoryPool forward_link_pool_; + + // There are various cleanup tasks... the toks_ structure contains + // singly linked lists of Token pointers, where Elem is the list type. + // It also indexes them in a hash, indexed by state (this hash is only + // maintained for the most recent frame). toks_.Clear() + // deletes them from the hash and returns the list of Elems. The + // function DeleteElems calls toks_.Delete(elem) for each elem in + // the list, which returns ownership of the Elem to the toks_ structure + // for reuse, but does not delete the Token pointer. The Token pointers + // are reference-counted and are ultimately deleted in PruneTokensForFrame, + // but are also linked together on each frame by their own linked-list, + // using the "next" pointer. We delete them manually. + void DeleteElems(Elem *list); + + // This function takes a singly linked list of tokens for a single frame, and + // outputs a list of them in topological order (it will crash if no such order + // can be found, which will typically be due to decoding graphs with epsilon + // cycles, which are not allowed). Note: the output list may contain NULLs, + // which the caller should pass over; it just happens to be more efficient for + // the algorithm to output a list that contains NULLs. + static void TopSortTokens(Token *tok_list, + std::vector *topsorted_list); + + void ClearActiveTokens(); + + KALDI_DISALLOW_COPY_AND_ASSIGN(LatticeFasterDecoderTpl); + + std::shared_ptr bias_lm_ = nullptr; +}; + +typedef LatticeFasterDecoderTpl LatticeFasterDecoder; + + + +} // end namespace kaldi. + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-online-decoder.cc b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-online-decoder.cc new file mode 100644 index 0000000..b526150 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-online-decoder.cc @@ -0,0 +1,285 @@ +// decoder/lattice-faster-online-decoder.cc + +// Copyright 2009-2012 Microsoft Corporation Mirko Hannemann +// 2013-2014 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen +// 2014 IMSL, PKU-HKUST (author: Wei Shi) +// 2018 Zhehuai Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +// see note at the top of lattice-faster-decoder.cc, about how to maintain this +// file in sync with lattice-faster-decoder.cc + +#include "decoder/lattice-faster-online-decoder.h" +#include "lat/lattice-functions.h" + +namespace kaldi { + +template +bool LatticeFasterOnlineDecoderTpl::TestGetBestPath( + bool use_final_probs) const { + Lattice lat1; + { + Lattice raw_lat; + this->GetRawLattice(&raw_lat, use_final_probs); + ShortestPath(raw_lat, &lat1); + } + Lattice lat2; + GetBestPath(&lat2, use_final_probs); + BaseFloat delta = 0.1; + int32 num_paths = 1; + if (!fst::RandEquivalent(lat1, lat2, num_paths, delta, rand())) { + KALDI_WARN << "Best-path test failed"; + return false; + } else { + return true; + } +} + + +// Outputs an FST corresponding to the single best path through the lattice. +template +bool LatticeFasterOnlineDecoderTpl::GetBestPath(Lattice *olat, + bool use_final_probs) const { + olat->DeleteStates(); + BaseFloat final_graph_cost; + BestPathIterator iter = BestPathEnd(use_final_probs, &final_graph_cost); + if (iter.Done()) + return false; // would have printed warning. + StateId state = olat->AddState(); + olat->SetFinal(state, LatticeWeight(final_graph_cost, 0.0)); + while (!iter.Done()) { + LatticeArc arc; + iter = TraceBackBestPath(iter, &arc); + arc.nextstate = state; + StateId new_state = olat->AddState(); + olat->AddArc(new_state, arc); + state = new_state; + } + olat->SetStart(state); + return true; +} + +template +typename LatticeFasterOnlineDecoderTpl::BestPathIterator LatticeFasterOnlineDecoderTpl::BestPathEnd( + bool use_final_probs, + BaseFloat *final_cost_out) const { + if (this->decoding_finalized_ && !use_final_probs) + KALDI_ERR << "You cannot call FinalizeDecoding() and then call " + << "BestPathEnd() with use_final_probs == false"; + KALDI_ASSERT(this->NumFramesDecoded() > 0 && + "You cannot call BestPathEnd if no frames were decoded."); + + unordered_map final_costs_local; + + const unordered_map &final_costs = + (this->decoding_finalized_ ? this->final_costs_ :final_costs_local); + if (!this->decoding_finalized_ && use_final_probs) + this->ComputeFinalCosts(&final_costs_local, NULL, NULL); + + // Singly linked list of tokens on last frame (access list through "next" + // pointer). + BaseFloat best_cost = std::numeric_limits::infinity(); + BaseFloat best_final_cost = 0; + Token *best_tok = NULL; + for (Token *tok = this->active_toks_.back().toks; + tok != NULL; tok = tok->next) { + BaseFloat cost = tok->tot_cost, final_cost = 0.0; + if (use_final_probs && !final_costs.empty()) { + // if we are instructed to use final-probs, and any final tokens were + // active on final frame, include the final-prob in the cost of the token. + typename unordered_map::const_iterator + iter = final_costs.find(tok); + if (iter != final_costs.end()) { + final_cost = iter->second; + cost += final_cost; + } else { + cost = std::numeric_limits::infinity(); + } + } + if (cost < best_cost) { + best_cost = cost; + best_tok = tok; + best_final_cost = final_cost; + } + } + if (best_tok == NULL) { // this should not happen, and is likely a code error or + // caused by infinities in likelihoods, but I'm not making + // it a fatal error for now. + KALDI_WARN << "No final token found."; + } + if (final_cost_out) + *final_cost_out = best_final_cost; + return BestPathIterator(best_tok, this->NumFramesDecoded() - 1); +} + + +template +typename LatticeFasterOnlineDecoderTpl::BestPathIterator LatticeFasterOnlineDecoderTpl::TraceBackBestPath( + BestPathIterator iter, LatticeArc *oarc) const { + KALDI_ASSERT(!iter.Done() && oarc != NULL); + Token *tok = static_cast(iter.tok); + int32 cur_t = iter.frame, step_t = 0; + if (tok->backpointer != NULL) { + // retrieve the correct forward link(with the best link cost) + BaseFloat best_cost = std::numeric_limits::infinity(); + ForwardLinkT *link; + for (link = tok->backpointer->links; + link != NULL; link = link->next) { + if (link->next_tok == tok) { // this is a link to "tok" + BaseFloat graph_cost = link->graph_cost, + acoustic_cost = link->acoustic_cost; + BaseFloat cost = graph_cost + acoustic_cost; + if (cost < best_cost) { + oarc->ilabel = link->ilabel; + oarc->olabel = link->olabel; + if (link->ilabel != 0) { + KALDI_ASSERT(static_cast(cur_t) < this->cost_offsets_.size()); + acoustic_cost -= this->cost_offsets_[cur_t]; + step_t = -1; + } else { + step_t = 0; + } + oarc->weight = LatticeWeight(graph_cost, acoustic_cost); + best_cost = cost; + } + } + } + if (link == NULL && + best_cost == std::numeric_limits::infinity()) { // Did not find correct link. + KALDI_ERR << "Error tracing best-path back (likely " + << "bug in token-pruning algorithm)"; + } + } else { + oarc->ilabel = 0; + oarc->olabel = 0; + oarc->weight = LatticeWeight::One(); // zero costs. + } + return BestPathIterator(tok->backpointer, cur_t + step_t); +} + +template +bool LatticeFasterOnlineDecoderTpl::GetRawLatticePruned( + Lattice *ofst, + bool use_final_probs, + BaseFloat beam) const { + typedef LatticeArc Arc; + typedef Arc::StateId StateId; + typedef Arc::Weight Weight; + typedef Arc::Label Label; + + // Note: you can't use the old interface (Decode()) if you want to + // get the lattice with use_final_probs = false. You'd have to do + // InitDecoding() and then AdvanceDecoding(). + if (this->decoding_finalized_ && !use_final_probs) + KALDI_ERR << "You cannot call FinalizeDecoding() and then call " + << "GetRawLattice() with use_final_probs == false"; + + unordered_map final_costs_local; + + const unordered_map &final_costs = + (this->decoding_finalized_ ? this->final_costs_ : final_costs_local); + if (!this->decoding_finalized_ && use_final_probs) + this->ComputeFinalCosts(&final_costs_local, NULL, NULL); + + ofst->DeleteStates(); + // num-frames plus one (since frames are one-based, and we have + // an extra frame for the start-state). + int32 num_frames = this->active_toks_.size() - 1; + KALDI_ASSERT(num_frames > 0); + for (int32 f = 0; f <= num_frames; f++) { + if (this->active_toks_[f].toks == NULL) { + KALDI_WARN << "No tokens active on frame " << f + << ": not producing lattice.\n"; + return false; + } + } + unordered_map tok_map; + std::queue > tok_queue; + // First initialize the queue and states. Put the initial state on the queue; + // this is the last token in the list active_toks_[0].toks. + for (Token *tok = this->active_toks_[0].toks; + tok != NULL; tok = tok->next) { + if (tok->next == NULL) { + tok_map[tok] = ofst->AddState(); + ofst->SetStart(tok_map[tok]); + std::pair tok_pair(tok, 0); // #frame = 0 + tok_queue.push(tok_pair); + } + } + + // Next create states for "good" tokens + while (!tok_queue.empty()) { + std::pair cur_tok_pair = tok_queue.front(); + tok_queue.pop(); + Token *cur_tok = cur_tok_pair.first; + int32 cur_frame = cur_tok_pair.second; + KALDI_ASSERT(cur_frame >= 0 && + cur_frame <= this->cost_offsets_.size()); + + typename unordered_map::const_iterator iter = + tok_map.find(cur_tok); + KALDI_ASSERT(iter != tok_map.end()); + StateId cur_state = iter->second; + + for (ForwardLinkT *l = cur_tok->links; + l != NULL; + l = l->next) { + Token *next_tok = l->next_tok; + if (next_tok->extra_cost < beam) { + // so both the current and the next token are good; create the arc + int32 next_frame = l->ilabel == 0 ? cur_frame : cur_frame + 1; + StateId nextstate; + if (tok_map.find(next_tok) == tok_map.end()) { + nextstate = tok_map[next_tok] = ofst->AddState(); + tok_queue.push(std::pair(next_tok, next_frame)); + } else { + nextstate = tok_map[next_tok]; + } + BaseFloat cost_offset = (l->ilabel != 0 ? + this->cost_offsets_[cur_frame] : 0); + Arc arc(l->ilabel, l->olabel, + Weight(l->graph_cost, l->acoustic_cost - cost_offset), + nextstate); + ofst->AddArc(cur_state, arc); + } + } + if (cur_frame == num_frames) { + if (use_final_probs && !final_costs.empty()) { + typename unordered_map::const_iterator iter = + final_costs.find(cur_tok); + if (iter != final_costs.end()) + ofst->SetFinal(cur_state, LatticeWeight(iter->second, 0)); + } else { + ofst->SetFinal(cur_state, LatticeWeight::One()); + } + } + } + return (ofst->NumStates() != 0); +} + + + +// Instantiate the template for the FST types that we'll need. +template class LatticeFasterOnlineDecoderTpl >; +template class LatticeFasterOnlineDecoderTpl >; +template class LatticeFasterOnlineDecoderTpl >; +//template class LatticeFasterOnlineDecoderTpl; +//template class LatticeFasterOnlineDecoderTpl; + + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-online-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-online-decoder.h new file mode 100644 index 0000000..4040d8f --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-faster-online-decoder.h @@ -0,0 +1,146 @@ +// decoder/lattice-faster-online-decoder.h + +// Copyright 2009-2013 Microsoft Corporation; Mirko Hannemann; +// 2013-2014 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen +// 2018 Zhehuai Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +// see note at the top of lattice-faster-decoder.h, about how to maintain this +// file in sync with lattice-faster-decoder.h + + +#ifndef KALDI_DECODER_LATTICE_FASTER_ONLINE_DECODER_H_ +#define KALDI_DECODER_LATTICE_FASTER_ONLINE_DECODER_H_ + +#include "util/stl-utils.h" +#include "util/hash-list.h" +#include "fst/fstlib.h" +#include "itf/decodable-itf.h" +#include "fstext/fstext-lib.h" +#include "lat/determinize-lattice-pruned.h" +#include "lat/kaldi-lattice.h" +#include "decoder/lattice-faster-decoder.h" + +namespace kaldi { + + + +/** LatticeFasterOnlineDecoderTpl is as LatticeFasterDecoderTpl but also + supports an efficient way to get the best path (see the function + BestPathEnd()), which is useful in endpointing and in situations where you + might want to frequently access the best path. + + This is only templated on the FST type, since the Token type is required to + be BackpointerToken. Actually it only makes sense to instantiate + LatticeFasterDecoderTpl with Token == BackpointerToken if you do so indirectly via + this child class. + */ +template +class LatticeFasterOnlineDecoderTpl: + public LatticeFasterDecoderTpl { + public: + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using Token = decoder::BackpointerToken; + using ForwardLinkT = decoder::ForwardLink; + + // Instantiate this class once for each thing you have to decode. + // This version of the constructor does not take ownership of + // 'fst'. + LatticeFasterOnlineDecoderTpl(const FST &fst, + const LatticeFasterDecoderConfig &config): + LatticeFasterDecoderTpl(fst, config) { } + + // This version of the initializer takes ownership of 'fst', and will delete + // it when this object is destroyed. + LatticeFasterOnlineDecoderTpl(const LatticeFasterDecoderConfig &config, FST *fst): + LatticeFasterDecoderTpl(config, fst) { } + //LatticeFasterOnlineDecoderTpl() {} + + struct BestPathIterator { + void *tok; + int32 frame; + // note, "frame" is the frame-index of the frame you'll get the + // transition-id for next time, if you call TraceBackBestPath on this + // iterator (assuming it's not an epsilon transition). Note that this + // is one less than you might reasonably expect, e.g. it's -1 for + // the nonemitting transitions before the first frame. + BestPathIterator(void *t, int32 f): tok(t), frame(f) { } + bool Done() const { return tok == NULL; } + }; + + + /// Outputs an FST corresponding to the single best path through the lattice. + /// This is quite efficient because it doesn't get the entire raw lattice and find + /// the best path through it; instead, it uses the BestPathEnd and BestPathIterator + /// so it basically traces it back through the lattice. + /// Returns true if result is nonempty (using the return status is deprecated, + /// it will become void). If "use_final_probs" is true AND we reached the + /// final-state of the graph then it will include those as final-probs, else + /// it will treat all final-probs as one. + bool GetBestPath(Lattice *ofst, + bool use_final_probs = true) const; + + + /// This function does a self-test of GetBestPath(). Returns true on + /// success; returns false and prints a warning on failure. + bool TestGetBestPath(bool use_final_probs = true) const; + + + /// This function returns an iterator that can be used to trace back + /// the best path. If use_final_probs == true and at least one final state + /// survived till the end, it will use the final-probs in working out the best + /// final Token, and will output the final cost to *final_cost (if non-NULL), + /// else it will use only the forward likelihood, and will put zero in + /// *final_cost (if non-NULL). + /// Requires that NumFramesDecoded() > 0. + BestPathIterator BestPathEnd(bool use_final_probs, + BaseFloat *final_cost = NULL) const; + + + /// This function can be used in conjunction with BestPathEnd() to trace back + /// the best path one link at a time (e.g. this can be useful in endpoint + /// detection). By "link" we mean a link in the graph; not all links cross + /// frame boundaries, but each time you see a nonzero ilabel you can interpret + /// that as a frame. The return value is the updated iterator. It outputs + /// the ilabel and olabel, and the (graph and acoustic) weight to the "arc" pointer, + /// while leaving its "nextstate" variable unchanged. + BestPathIterator TraceBackBestPath( + BestPathIterator iter, LatticeArc *arc) const; + + + /// Behaves the same as GetRawLattice but only processes tokens whose + /// extra_cost is smaller than the best-cost plus the specified beam. + /// It is only worthwhile to call this function if beam is less than + /// the lattice_beam specified in the config; otherwise, it would + /// return essentially the same thing as GetRawLattice, but more slowly. + bool GetRawLatticePruned(Lattice *ofst, + bool use_final_probs, + BaseFloat beam) const; + + KALDI_DISALLOW_COPY_AND_ASSIGN(LatticeFasterOnlineDecoderTpl); +}; + +typedef LatticeFasterOnlineDecoderTpl LatticeFasterOnlineDecoder; + + +} // end namespace kaldi. + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-decoder.cc b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-decoder.cc new file mode 100644 index 0000000..b022474 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-decoder.cc @@ -0,0 +1,1730 @@ +// decoder/lattice-incremental-decoder.cc + +// Copyright 2019 Zhehuai Chen, Daniel Povey + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "decoder/lattice-incremental-decoder.h" +#include "lat/lattice-functions.h" +#include "base/timer.h" + +namespace kaldi { + +// instantiate this class once for each thing you have to decode. +template +LatticeIncrementalDecoderTpl::LatticeIncrementalDecoderTpl( + const FST &fst, const TransitionInformation &trans_model, + const LatticeIncrementalDecoderConfig &config) + : fst_(&fst), + delete_fst_(false), + num_toks_(0), + config_(config), + determinizer_(trans_model, config) { + config.Check(); + toks_.SetSize(1000); // just so on the first frame we do something reasonable. +} + +template +LatticeIncrementalDecoderTpl::LatticeIncrementalDecoderTpl( + const LatticeIncrementalDecoderConfig &config, FST *fst, + const TransitionInformation &trans_model) + : fst_(fst), + delete_fst_(true), + num_toks_(0), + config_(config), + determinizer_(trans_model, config) { + config.Check(); + toks_.SetSize(1000); // just so on the first frame we do something reasonable. +} + +template +LatticeIncrementalDecoderTpl::~LatticeIncrementalDecoderTpl() { + DeleteElems(toks_.Clear()); + ClearActiveTokens(); + if (delete_fst_) delete fst_; +} + +template +void LatticeIncrementalDecoderTpl::InitDecoding() { + // clean up from last time: + DeleteElems(toks_.Clear()); + cost_offsets_.clear(); + ClearActiveTokens(); + warned_ = false; + num_toks_ = 0; + decoding_finalized_ = false; + final_costs_.clear(); + StateId start_state = fst_->Start(); + KALDI_ASSERT(start_state != fst::kNoStateId); + active_toks_.resize(1); + Token *start_tok = new Token(0.0, 0.0, NULL, NULL, NULL); + active_toks_[0].toks = start_tok; + toks_.Insert(start_state, start_tok); + num_toks_++; + + determinizer_.Init(); + num_frames_in_lattice_ = 0; + token2label_map_.clear(); + next_token_label_ = LatticeIncrementalDeterminizer::kTokenLabelOffset; + ProcessNonemitting(config_.beam); +} + +template +void LatticeIncrementalDecoderTpl::UpdateLatticeDeterminization() { + if (NumFramesDecoded() - num_frames_in_lattice_ < + config_.determinize_max_delay) + return; + + + /* Make sure the token-pruning is active. Note: PruneActiveTokens() has + internal logic that prevents it from doing unnecessary work if you + call it and then immediately call it again. */ + PruneActiveTokens(config_.lattice_beam * config_.prune_scale); + + int32 first = num_frames_in_lattice_ + config_.determinize_min_chunk_size, + last = NumFramesDecoded(), + fewest_tokens = std::numeric_limits::max(), + best_frame = -1; + for (int32 t = last; t >= first; t--) { + /* Make sure PruneActiveTokens() has computed num_toks for all these + frames... */ + KALDI_ASSERT(active_toks_[t].num_toks != -1); + if (active_toks_[t].num_toks < fewest_tokens) { + // <= because we want the latest one in case of ties. + fewest_tokens = active_toks_[t].num_toks; + best_frame = t; + } + } + /* Skip this update if we have too many tokens, determinization will take too long, + postpone it to the next update */ + if (fewest_tokens > config_.determinize_max_active) + return; + + /* OK, determinize the chunk that spans from num_frames_in_lattice_ to + best_frame. */ + bool use_final_probs = false; + GetLattice(best_frame, use_final_probs); + return; +} +// Returns true if any kind of traceback is available (not necessarily from +// a final state). It should only very rarely return false; this indicates +// an unusual search error. +template +bool LatticeIncrementalDecoderTpl::Decode(DecodableInterface *decodable) { + InitDecoding(); + + // We use 1-based indexing for frames in this decoder (if you view it in + // terms of features), but note that the decodable object uses zero-based + // numbering, which we have to correct for when we call it. + + while (!decodable->IsLastFrame(NumFramesDecoded() - 1)) { + if (NumFramesDecoded() % config_.prune_interval == 0) { + PruneActiveTokens(config_.lattice_beam * config_.prune_scale); + } + UpdateLatticeDeterminization(); + + BaseFloat cost_cutoff = ProcessEmitting(decodable); + ProcessNonemitting(cost_cutoff); + } + Timer timer; + FinalizeDecoding(); + bool use_final_probs = true; + GetLattice(NumFramesDecoded(), use_final_probs); + KALDI_VLOG(2) << "Delay time during and after FinalizeDecoding()" + << "(secs): " << timer.Elapsed(); + + // Returns true if we have any kind of traceback available (not necessarily + // to the end state; query ReachedFinal() for that). + return !active_toks_.empty() && active_toks_.back().toks != NULL; +} + + +template +void LatticeIncrementalDecoderTpl::PossiblyResizeHash(size_t num_toks) { + size_t new_sz = + static_cast(static_cast(num_toks) * config_.hash_ratio); + if (new_sz > toks_.Size()) { + toks_.SetSize(new_sz); + } +} + +/* + A note on the definition of extra_cost. + + extra_cost is used in pruning tokens, to save memory. + + extra_cost can be thought of as a beta (backward) cost assuming + we had set the betas on currently-active tokens to all be the negative + of the alphas for those tokens. (So all currently active tokens would + be on (tied) best paths). + + + Define the 'forward cost' of a token as zero for any token on the frame + we're currently decoding; and for other frames, as the shortest-path cost + between that token and a token on the frame we're currently decoding. + (by "currently decoding" I mean the most recently processed frame). + + Then define the extra_cost of a token (always >= 0) as the forward-cost of + the token minus the smallest forward-cost of any token on the same frame. + + We can use the extra_cost to accurately prune away tokens that we know will + never appear in the lattice. If the extra_cost is greater than the desired + lattice beam, the token would provably never appear in the lattice, so we can + prune away the token. + + The advantage of storing the extra_cost rather than the forward-cost, is that + it is less costly to keep the extra_cost up-to-date when we process new frames. + When we process a new frame, *all* the previous frames' forward-costs would change; + but in general the extra_cost will change only for a finite number of frames. + (Actually we don't update all the extra_costs every time we update a frame; we + only do it every 'config_.prune_interval' frames). + */ + +// FindOrAddToken either locates a token in hash of toks_, +// or if necessary inserts a new, empty token (i.e. with no forward links) +// for the current frame. [note: it's inserted if necessary into hash toks_ +// and also into the singly linked list of tokens active on this frame +// (whose head is at active_toks_[frame]). +template +inline Token *LatticeIncrementalDecoderTpl::FindOrAddToken( + StateId state, int32 frame_plus_one, BaseFloat tot_cost, Token *backpointer, + bool *changed) { + // Returns the Token pointer. Sets "changed" (if non-NULL) to true + // if the token was newly created or the cost changed. + KALDI_ASSERT(frame_plus_one < active_toks_.size()); + Token *&toks = active_toks_[frame_plus_one].toks; + Elem *e_found = toks_.Find(state); + if (e_found == NULL) { // no such token presently. + const BaseFloat extra_cost = 0.0; + // tokens on the currently final frame have zero extra_cost + // as any of them could end up + // on the winning path. + Token *new_tok = new Token(tot_cost, extra_cost, NULL, toks, backpointer); + // NULL: no forward links yet + toks = new_tok; + num_toks_++; + toks_.Insert(state, new_tok); + if (changed) *changed = true; + return new_tok; + } else { + Token *tok = e_found->val; // There is an existing Token for this state. + if (tok->tot_cost > tot_cost) { // replace old token + tok->tot_cost = tot_cost; + // SetBackpointer() just does tok->backpointer = backpointer in + // the case where Token == BackpointerToken, else nothing. + tok->SetBackpointer(backpointer); + // we don't allocate a new token, the old stays linked in active_toks_ + // we only replace the tot_cost + // in the current frame, there are no forward links (and no extra_cost) + // only in ProcessNonemitting we have to delete forward links + // in case we visit a state for the second time + // those forward links, that lead to this replaced token before: + // they remain and will hopefully be pruned later (PruneForwardLinks...) + if (changed) *changed = true; + } else { + if (changed) *changed = false; + } + return tok; + } +} + +// prunes outgoing links for all tokens in active_toks_[frame] +// it's called by PruneActiveTokens +// all links, that have link_extra_cost > lattice_beam are pruned +template +void LatticeIncrementalDecoderTpl::PruneForwardLinks( + int32 frame_plus_one, bool *extra_costs_changed, bool *links_pruned, + BaseFloat delta) { + // delta is the amount by which the extra_costs must change + // If delta is larger, we'll tend to go back less far + // toward the beginning of the file. + // extra_costs_changed is set to true if extra_cost was changed for any token + // links_pruned is set to true if any link in any token was pruned + + *extra_costs_changed = false; + *links_pruned = false; + KALDI_ASSERT(frame_plus_one >= 0 && frame_plus_one < active_toks_.size()); + if (active_toks_[frame_plus_one].toks == NULL) { // empty list; should not happen. + if (!warned_) { + KALDI_WARN << "No tokens alive [doing pruning].. warning first " + "time only for each utterance\n"; + warned_ = true; + } + } + + // We have to iterate until there is no more change, because the links + // are not guaranteed to be in topological order. + bool changed = true; // difference new minus old extra cost >= delta ? + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame_plus_one].toks; tok != NULL; + tok = tok->next) { + ForwardLinkT *link, *prev_link = NULL; + // will recompute tok_extra_cost for tok. + BaseFloat tok_extra_cost = std::numeric_limits::infinity(); + // tok_extra_cost is the best (min) of link_extra_cost of outgoing links + for (link = tok->links; link != NULL;) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = + next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) - + next_tok->tot_cost); // difference in brackets is >= 0 + // link_exta_cost is the difference in score between the best paths + // through link source state and through link destination state + KALDI_ASSERT(link_extra_cost == link_extra_cost); // check for NaN + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLinkT *next_link = link->next; + if (prev_link != NULL) + prev_link->next = next_link; + else + tok->links = next_link; + delete link; + link = next_link; // advance link but leave prev_link the same. + *links_pruned = true; + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + if (link_extra_cost < -0.01) + KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) tok_extra_cost = link_extra_cost; + prev_link = link; // move to next link + link = link->next; + } + } // for all outgoing links + if (fabs(tok_extra_cost - tok->extra_cost) > delta) + changed = true; // difference new minus old is bigger than delta + tok->extra_cost = tok_extra_cost; + // will be +infinity or <= lattice_beam_. + // infinity indicates, that no forward link survived pruning + } // for all Token on active_toks_[frame] + if (changed) *extra_costs_changed = true; + + // Note: it's theoretically possible that aggressive compiler + // optimizations could cause an infinite loop here for small delta and + // high-dynamic-range scores. + } // while changed +} + +// PruneForwardLinksFinal is a version of PruneForwardLinks that we call +// on the final frame. If there are final tokens active, it uses +// the final-probs for pruning, otherwise it treats all tokens as final. +template +void LatticeIncrementalDecoderTpl::PruneForwardLinksFinal() { + KALDI_ASSERT(!active_toks_.empty()); + int32 frame_plus_one = active_toks_.size() - 1; + + if (active_toks_[frame_plus_one].toks == NULL) // empty list; should not happen. + KALDI_WARN << "No tokens alive at end of file"; + + typedef typename unordered_map::const_iterator IterType; + ComputeFinalCosts(&final_costs_, &final_relative_cost_, &final_best_cost_); + decoding_finalized_ = true; + // We call DeleteElems() as a nicety, not because it's really necessary; + // otherwise there would be a time, after calling PruneTokensForFrame() on the + // final frame, when toks_.GetList() or toks_.Clear() would contain pointers + // to nonexistent tokens. + DeleteElems(toks_.Clear()); + + // Now go through tokens on this frame, pruning forward links... may have to + // iterate a few times until there is no more change, because the list is not + // in topological order. This is a modified version of the code in + // PruneForwardLinks, but here we also take account of the final-probs. + bool changed = true; + BaseFloat delta = 1.0e-05; + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame_plus_one].toks; tok != NULL; + tok = tok->next) { + ForwardLinkT *link, *prev_link = NULL; + // will recompute tok_extra_cost. It has a term in it that corresponds + // to the "final-prob", so instead of initializing tok_extra_cost to infinity + // below we set it to the difference between the (score+final_prob) of this + // token, + // and the best such (score+final_prob). + BaseFloat final_cost; + if (final_costs_.empty()) { + final_cost = 0.0; + } else { + IterType iter = final_costs_.find(tok); + if (iter != final_costs_.end()) + final_cost = iter->second; + else + final_cost = std::numeric_limits::infinity(); + } + BaseFloat tok_extra_cost = tok->tot_cost + final_cost - final_best_cost_; + // tok_extra_cost will be a "min" over either directly being final, or + // being indirectly final through other links, and the loop below may + // decrease its value: + for (link = tok->links; link != NULL;) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = + next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) - + next_tok->tot_cost); + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLinkT *next_link = link->next; + if (prev_link != NULL) + prev_link->next = next_link; + else + tok->links = next_link; + delete link; + link = next_link; // advance link but leave prev_link the same. + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + if (link_extra_cost < -0.01) + KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) tok_extra_cost = link_extra_cost; + prev_link = link; + link = link->next; + } + } + // prune away tokens worse than lattice_beam above best path. This step + // was not necessary in the non-final case because then, this case + // showed up as having no forward links. Here, the tok_extra_cost has + // an extra component relating to the final-prob. + if (tok_extra_cost > config_.lattice_beam) + tok_extra_cost = std::numeric_limits::infinity(); + // to be pruned in PruneTokensForFrame + + if (!ApproxEqual(tok->extra_cost, tok_extra_cost, delta)) changed = true; + tok->extra_cost = tok_extra_cost; // will be +infinity or <= lattice_beam_. + } + } // while changed +} + +template +BaseFloat LatticeIncrementalDecoderTpl::FinalRelativeCost() const { + BaseFloat relative_cost; + ComputeFinalCosts(NULL, &relative_cost, NULL); + return relative_cost; +} + +// Prune away any tokens on this frame that have no forward links. +// [we don't do this in PruneForwardLinks because it would give us +// a problem with dangling pointers]. +// It's called by PruneActiveTokens if any forward links have been pruned +template +void LatticeIncrementalDecoderTpl::PruneTokensForFrame( + int32 frame_plus_one) { + KALDI_ASSERT(frame_plus_one >= 0 && frame_plus_one < active_toks_.size()); + Token *&toks = active_toks_[frame_plus_one].toks; + if (toks == NULL) KALDI_WARN << "No tokens alive [doing pruning]"; + Token *tok, *next_tok, *prev_tok = NULL; + int32 num_toks = 0; + for (tok = toks; tok != NULL; tok = next_tok, num_toks++) { + next_tok = tok->next; + if (tok->extra_cost == std::numeric_limits::infinity()) { + // token is unreachable from end of graph; (no forward links survived) + // excise tok from list and delete tok. + if (prev_tok != NULL) + prev_tok->next = tok->next; + else + toks = tok->next; + delete tok; + num_toks_--; + } else { // fetch next Token + prev_tok = tok; + } + } + active_toks_[frame_plus_one].num_toks = num_toks; +} + +// Go backwards through still-alive tokens, pruning them, starting not from +// the current frame (where we want to keep all tokens) but from the frame before +// that. We go backwards through the frames and stop when we reach a point +// where the delta-costs are not changing (and the delta controls when we consider +// a cost to have "not changed"). +template +void LatticeIncrementalDecoderTpl::PruneActiveTokens(BaseFloat delta) { + int32 cur_frame_plus_one = NumFramesDecoded(); + int32 num_toks_begin = num_toks_; + + if (active_toks_[cur_frame_plus_one].num_toks == -1){ + // The current frame's tokens don't get pruned so they don't get counted + // (the count is needed by the incremental determinization code). + // Fix this. + int this_frame_num_toks = 0; + for (Token *t = active_toks_[cur_frame_plus_one].toks; t != NULL; t = t->next) + this_frame_num_toks++; + active_toks_[cur_frame_plus_one].num_toks = this_frame_num_toks; + } + + // The index "f" below represents a "frame plus one", i.e. you'd have to subtract + // one to get the corresponding index for the decodable object. + for (int32 f = cur_frame_plus_one - 1; f >= 0; f--) { + // Reason why we need to prune forward links in this situation: + // (1) we have never pruned them (new TokenList) + // (2) we have not yet pruned the forward links to the next f, + // after any of those tokens have changed their extra_cost. + if (active_toks_[f].must_prune_forward_links) { + bool extra_costs_changed = false, links_pruned = false; + PruneForwardLinks(f, &extra_costs_changed, &links_pruned, delta); + if (extra_costs_changed && f > 0) // any token has changed extra_cost + active_toks_[f - 1].must_prune_forward_links = true; + if (links_pruned) // any link was pruned + active_toks_[f].must_prune_tokens = true; + active_toks_[f].must_prune_forward_links = false; // job done + } + if (f + 1 < cur_frame_plus_one && // except for last f (no forward links) + active_toks_[f + 1].must_prune_tokens) { + PruneTokensForFrame(f + 1); + active_toks_[f + 1].must_prune_tokens = false; + } + } + KALDI_VLOG(4) << "pruned tokens from " << num_toks_begin + << " to " << num_toks_; +} + +template +void LatticeIncrementalDecoderTpl::ComputeFinalCosts( + unordered_map *final_costs, BaseFloat *final_relative_cost, + BaseFloat *final_best_cost) const { + if (decoding_finalized_) { + // If we finalized decoding, the list toks_ will no longer exist, so return + // something we already computed. + if (final_costs) *final_costs = final_costs_; + if (final_relative_cost) *final_relative_cost = final_relative_cost_; + if (final_best_cost) *final_best_cost = final_best_cost_; + return; + } + if (final_costs != NULL) final_costs->clear(); + const Elem *final_toks = toks_.GetList(); + BaseFloat infinity = std::numeric_limits::infinity(); + BaseFloat best_cost = infinity, best_cost_with_final = infinity; + + while (final_toks != NULL) { + StateId state = final_toks->key; + Token *tok = final_toks->val; + const Elem *next = final_toks->tail; + BaseFloat final_cost = fst_->Final(state).Value(); + BaseFloat cost = tok->tot_cost, cost_with_final = cost + final_cost; + best_cost = std::min(cost, best_cost); + best_cost_with_final = std::min(cost_with_final, best_cost_with_final); + if (final_costs != NULL && final_cost != infinity) + (*final_costs)[tok] = final_cost; + final_toks = next; + } + if (final_relative_cost != NULL) { + if (best_cost == infinity && best_cost_with_final == infinity) { + // Likely this will only happen if there are no tokens surviving. + // This seems the least bad way to handle it. + *final_relative_cost = infinity; + } else { + *final_relative_cost = best_cost_with_final - best_cost; + } + } + if (final_best_cost != NULL) { + if (best_cost_with_final != infinity) { // final-state exists. + *final_best_cost = best_cost_with_final; + } else { // no final-state exists. + *final_best_cost = best_cost; + } + } +} + +template +void LatticeIncrementalDecoderTpl::AdvanceDecoding( + DecodableInterface *decodable, int32 max_num_frames) { + if (std::is_same >::value) { + // if the type 'FST' is the FST base-class, then see if the FST type of fst_ + // is actually VectorFst or ConstFst. If so, call the AdvanceDecoding() + // function after casting *this to the more specific type. + if (fst_->Type() == "const") { + LatticeIncrementalDecoderTpl, Token> *this_cast = + reinterpret_cast< + LatticeIncrementalDecoderTpl, Token> *>( + this); + this_cast->AdvanceDecoding(decodable, max_num_frames); + return; + } else if (fst_->Type() == "vector") { + LatticeIncrementalDecoderTpl, Token> *this_cast = + reinterpret_cast< + LatticeIncrementalDecoderTpl, Token> *>( + this); + this_cast->AdvanceDecoding(decodable, max_num_frames); + return; + } + } + + KALDI_ASSERT(!active_toks_.empty() && !decoding_finalized_ && + "You must call InitDecoding() before AdvanceDecoding"); + int32 num_frames_ready = decodable->NumFramesReady(); + // num_frames_ready must be >= num_frames_decoded, or else + // the number of frames ready must have decreased (which doesn't + // make sense) or the decodable object changed between calls + // (which isn't allowed). + KALDI_ASSERT(num_frames_ready >= NumFramesDecoded()); + int32 target_frames_decoded = num_frames_ready; + if (max_num_frames >= 0) + target_frames_decoded = + std::min(target_frames_decoded, NumFramesDecoded() + max_num_frames); + while (NumFramesDecoded() < target_frames_decoded) { + if (NumFramesDecoded() % config_.prune_interval == 0) { + PruneActiveTokens(config_.lattice_beam * config_.prune_scale); + } + BaseFloat cost_cutoff = ProcessEmitting(decodable); + ProcessNonemitting(cost_cutoff); + } + UpdateLatticeDeterminization(); +} + +// FinalizeDecoding() is a version of PruneActiveTokens that we call +// (optionally) on the final frame. Takes into account the final-prob of +// tokens. This function used to be called PruneActiveTokensFinal(). +template +void LatticeIncrementalDecoderTpl::FinalizeDecoding() { + int32 final_frame_plus_one = NumFramesDecoded(); + int32 num_toks_begin = num_toks_; + // PruneForwardLinksFinal() prunes the final frame (with final-probs), and + // sets decoding_finalized_. + PruneForwardLinksFinal(); + for (int32 f = final_frame_plus_one - 1; f >= 0; f--) { + bool b1, b2; // values not used. + BaseFloat dontcare = 0.0; // delta of zero means we must always update + PruneForwardLinks(f, &b1, &b2, dontcare); + PruneTokensForFrame(f + 1); + } + PruneTokensForFrame(0); + KALDI_VLOG(4) << "pruned tokens from " << num_toks_begin << " to " << num_toks_; +} + +/// Gets the weight cutoff. Also counts the active tokens. +template +BaseFloat LatticeIncrementalDecoderTpl::GetCutoff( + Elem *list_head, size_t *tok_count, BaseFloat *adaptive_beam, Elem **best_elem) { + BaseFloat best_weight = std::numeric_limits::infinity(); + // positive == high cost == bad. + size_t count = 0; + if (config_.max_active == std::numeric_limits::max() && + config_.min_active == 0) { + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = static_cast(e->val->tot_cost); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + if (adaptive_beam != NULL) *adaptive_beam = config_.beam; + return best_weight + config_.beam; + } else { + tmp_array_.clear(); + for (Elem *e = list_head; e != NULL; e = e->tail, count++) { + BaseFloat w = e->val->tot_cost; + tmp_array_.push_back(w); + if (w < best_weight) { + best_weight = w; + if (best_elem) *best_elem = e; + } + } + if (tok_count != NULL) *tok_count = count; + + BaseFloat beam_cutoff = best_weight + config_.beam, + min_active_cutoff = std::numeric_limits::infinity(), + max_active_cutoff = std::numeric_limits::infinity(); + + KALDI_VLOG(6) << "Number of tokens active on frame " << NumFramesDecoded() + << " is " << tmp_array_.size(); + + if (tmp_array_.size() > static_cast(config_.max_active)) { + std::nth_element(tmp_array_.begin(), tmp_array_.begin() + config_.max_active, + tmp_array_.end()); + max_active_cutoff = tmp_array_[config_.max_active]; + } + if (max_active_cutoff < beam_cutoff) { // max_active is tighter than beam. + if (adaptive_beam) + *adaptive_beam = max_active_cutoff - best_weight + config_.beam_delta; + return max_active_cutoff; + } + if (tmp_array_.size() > static_cast(config_.min_active)) { + if (config_.min_active == 0) + min_active_cutoff = best_weight; + else { + std::nth_element(tmp_array_.begin(), tmp_array_.begin() + config_.min_active, + tmp_array_.size() > static_cast(config_.max_active) + ? tmp_array_.begin() + config_.max_active + : tmp_array_.end()); + min_active_cutoff = tmp_array_[config_.min_active]; + } + } + if (min_active_cutoff > beam_cutoff) { // min_active is looser than beam. + if (adaptive_beam) + *adaptive_beam = min_active_cutoff - best_weight + config_.beam_delta; + return min_active_cutoff; + } else { + *adaptive_beam = config_.beam; + return beam_cutoff; + } + } +} + +template +BaseFloat LatticeIncrementalDecoderTpl::ProcessEmitting( + DecodableInterface *decodable) { + KALDI_ASSERT(active_toks_.size() > 0); + int32 frame = active_toks_.size() - 1; // frame is the frame-index + // (zero-based) used to get likelihoods + // from the decodable object. + active_toks_.resize(active_toks_.size() + 1); + + Elem *final_toks = toks_.Clear(); // analogous to swapping prev_toks_ / cur_toks_ + // in simple-decoder.h. Removes the Elems from + // being indexed in the hash in toks_. + Elem *best_elem = NULL; + BaseFloat adaptive_beam; + size_t tok_cnt; + BaseFloat cur_cutoff = GetCutoff(final_toks, &tok_cnt, &adaptive_beam, &best_elem); + KALDI_VLOG(6) << "Adaptive beam on frame " << NumFramesDecoded() << " is " + << adaptive_beam; + + PossiblyResizeHash(tok_cnt); // This makes sure the hash is always big enough. + + BaseFloat next_cutoff = std::numeric_limits::infinity(); + // pruning "online" before having seen all tokens + + BaseFloat cost_offset = 0.0; // Used to keep probabilities in a good + // dynamic range. + + // First process the best token to get a hopefully + // reasonably tight bound on the next cutoff. The only + // products of the next block are "next_cutoff" and "cost_offset". + if (best_elem) { + StateId state = best_elem->key; + Token *tok = best_elem->val; + cost_offset = -tok->tot_cost; + for (fst::ArcIterator aiter(*fst_, state); !aiter.Done(); aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + BaseFloat new_weight = arc.weight.Value() + cost_offset - + decodable->LogLikelihood(frame, arc.ilabel) + + tok->tot_cost; + if (new_weight + adaptive_beam < next_cutoff) + next_cutoff = new_weight + adaptive_beam; + } + } + } + + // Store the offset on the acoustic likelihoods that we're applying. + // Could just do cost_offsets_.push_back(cost_offset), but we + // do it this way as it's more robust to future code changes. + cost_offsets_.resize(frame + 1, 0.0); + cost_offsets_[frame] = cost_offset; + + // the tokens are now owned here, in final_toks, and the hash is empty. + // 'owned' is a complex thing here; the point is we need to call DeleteElem + // on each elem 'e' to let toks_ know we're done with them. + for (Elem *e = final_toks, *e_tail; e != NULL; e = e_tail) { + // loop this way because we delete "e" as we go. + StateId state = e->key; + Token *tok = e->val; + if (tok->tot_cost <= cur_cutoff) { + for (fst::ArcIterator aiter(*fst_, state); !aiter.Done(); aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + BaseFloat ac_cost = + cost_offset - decodable->LogLikelihood(frame, arc.ilabel), + graph_cost = arc.weight.Value(), cur_cost = tok->tot_cost, + tot_cost = cur_cost + ac_cost + graph_cost; + if (tot_cost >= next_cutoff) + continue; + else if (tot_cost + adaptive_beam < next_cutoff) + next_cutoff = tot_cost + adaptive_beam; // prune by best current token + // Note: the frame indexes into active_toks_ are one-based, + // hence the + 1. + Token *next_tok = + FindOrAddToken(arc.nextstate, frame + 1, tot_cost, tok, NULL); + // NULL: no change indicator needed + + // Add ForwardLink from tok to next_tok (put on head of list tok->links) + tok->links = new ForwardLinkT(next_tok, arc.ilabel, arc.olabel, graph_cost, + ac_cost, tok->links); + } + } // for all arcs + } + e_tail = e->tail; + toks_.Delete(e); // delete Elem + } + return next_cutoff; +} + +// static inline +template +void LatticeIncrementalDecoderTpl::DeleteForwardLinks(Token *tok) { + ForwardLinkT *l = tok->links, *m; + while (l != NULL) { + m = l->next; + delete l; + l = m; + } + tok->links = NULL; +} + +template +void LatticeIncrementalDecoderTpl::ProcessNonemitting(BaseFloat cutoff) { + KALDI_ASSERT(!active_toks_.empty()); + int32 frame = static_cast(active_toks_.size()) - 2; + // Note: "frame" is the time-index we just processed, or -1 if + // we are processing the nonemitting transitions before the + // first frame (called from InitDecoding()). + + // Processes nonemitting arcs for one frame. Propagates within toks_. + // Note-- this queue structure is is not very optimal as + // it may cause us to process states unnecessarily (e.g. more than once), + // but in the baseline code, turning this vector into a set to fix this + // problem did not improve overall speed. + + KALDI_ASSERT(queue_.empty()); + + if (toks_.GetList() == NULL) { + if (!warned_) { + KALDI_WARN << "Error, no surviving tokens: frame is " << frame; + warned_ = true; + } + } + + for (const Elem *e = toks_.GetList(); e != NULL; e = e->tail) { + StateId state = e->key; + if (fst_->NumInputEpsilons(state) != 0) queue_.push_back(state); + } + + while (!queue_.empty()) { + StateId state = queue_.back(); + queue_.pop_back(); + + Token *tok = + toks_.Find(state) + ->val; // would segfault if state not in toks_ but this can't happen. + BaseFloat cur_cost = tok->tot_cost; + if (cur_cost >= cutoff) // Don't bother processing successors. + continue; + // If "tok" has any existing forward links, delete them, + // because we're about to regenerate them. This is a kind + // of non-optimality (remember, this is the simple decoder), + // but since most states are emitting it's not a huge issue. + DeleteForwardLinks(tok); // necessary when re-visiting + tok->links = NULL; + for (fst::ArcIterator aiter(*fst_, state); !aiter.Done(); aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel == 0) { // propagate nonemitting only... + BaseFloat graph_cost = arc.weight.Value(), tot_cost = cur_cost + graph_cost; + if (tot_cost < cutoff) { + bool changed; + + Token *new_tok = + FindOrAddToken(arc.nextstate, frame + 1, tot_cost, tok, &changed); + + tok->links = + new ForwardLinkT(new_tok, 0, arc.olabel, graph_cost, 0, tok->links); + + // "changed" tells us whether the new token has a different + // cost from before, or is new [if so, add into queue]. + if (changed && fst_->NumInputEpsilons(arc.nextstate) != 0) + queue_.push_back(arc.nextstate); + } + } + } // for all arcs + } // while queue not empty +} + +template +void LatticeIncrementalDecoderTpl::DeleteElems(Elem *list) { + for (Elem *e = list, *e_tail; e != NULL; e = e_tail) { + e_tail = e->tail; + toks_.Delete(e); + } +} + +template +void LatticeIncrementalDecoderTpl< + FST, Token>::ClearActiveTokens() { // a cleanup routine, at utt end/begin + for (size_t i = 0; i < active_toks_.size(); i++) { + // Delete all tokens alive on this frame, and any forward + // links they may have. + for (Token *tok = active_toks_[i].toks; tok != NULL;) { + DeleteForwardLinks(tok); + Token *next_tok = tok->next; + delete tok; + num_toks_--; + tok = next_tok; + } + } + active_toks_.clear(); + KALDI_ASSERT(num_toks_ == 0); +} + + +template +const CompactLattice& LatticeIncrementalDecoderTpl::GetLattice( + int32 num_frames_to_include, + bool use_final_probs) { + KALDI_ASSERT(num_frames_to_include >= num_frames_in_lattice_ && + num_frames_to_include <= NumFramesDecoded()); + + + if (num_frames_in_lattice_ > 0 && + determinizer_.GetLattice().NumStates() == 0) { + /* Something went wrong, lattice is empty and will continue to be empty. + User-level code should detect and deal with this. + */ + num_frames_in_lattice_ = num_frames_to_include; + return determinizer_.GetLattice(); + } + + if (decoding_finalized_ && !use_final_probs) { + // This is not supported + KALDI_ERR << "You cannot get the lattice without final-probs after " + "calling FinalizeDecoding()."; + } + if (use_final_probs && num_frames_to_include != NumFramesDecoded()) { + /* This is because we only remember the relation between HCLG states and + Tokens for the current frame; the Token does not have a `state` field. */ + KALDI_ERR << "use-final-probs may no be true if you are not " + "getting a lattice for all frames decoded so far."; + } + + + if (num_frames_to_include > num_frames_in_lattice_) { + /* Make sure the token-pruning is up to date. If we just pruned the tokens, + this will do very little work. */ + PruneActiveTokens(config_.lattice_beam * config_.prune_scale); + + if (determinizer_.GetLattice().NumStates() == 0 || + determinizer_.GetLattice().Final(0) != CompactLatticeWeight::Zero()) { + num_frames_in_lattice_ = 0; + determinizer_.Init(); + } + + Lattice chunk_lat; + + unordered_map token_label2state; + if (num_frames_in_lattice_ != 0) { + determinizer_.InitializeRawLatticeChunk(&chunk_lat, + &token_label2state); + } + + // tok_map will map from Token* to state-id in chunk_lat. + // The cur and prev versions alternate on different frames. + unordered_map &tok2state_map(temp_token_map_); + tok2state_map.clear(); + + unordered_map &next_token2label_map(token2label_map_temp_); + next_token2label_map.clear(); + + { // Deal with the last frame in the chunk, the one numbered `num_frames_to_include`. + // (Yes, this is backwards). We allocate token labels, and set tokens as + // final, but don't add any transitions. This may leave some states + // disconnected (e.g. due to chains of nonemitting arcs), but it's OK; we'll + // fix it when we generate the next chunk of lattice. + int32 frame = num_frames_to_include; + // Allocate state-ids for all tokens on this frame. + + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + /* If we included the final-costs at this stage, they will cause + non-final states to be pruned out from the end of the lattice. */ + BaseFloat final_cost; + { // This block computes final_cost + if (decoding_finalized_) { + if (final_costs_.empty()) { + final_cost = 0.0; /* No final-state survived, so treat all as final + * with probability One(). */ + } else { + auto iter = final_costs_.find(tok); + if (iter == final_costs_.end()) + final_cost = std::numeric_limits::infinity(); + else + final_cost = iter->second; + } + } else { + /* this is a `fake` final-cost used to guide pruning. It's as if we + set the betas (backward-probs) on the final frame to the + negatives of the corresponding alphas, so all tokens on the last + frae will be on a best path.. the extra_cost for each token + always corresponds to its alpha+beta on this assumption. We want + the final_cost here to correspond to the beta (backward-prob), so + we get that by final_cost = extra_cost - tot_cost. + [The tot_cost is the forward/alpha cost.] + */ + final_cost = tok->extra_cost - tok->tot_cost; + } + } + + StateId state = chunk_lat.AddState(); + tok2state_map[tok] = state; + if (final_cost < std::numeric_limits::infinity()) { + next_token2label_map[tok] = AllocateNewTokenLabel(); + StateId token_final_state = chunk_lat.AddState(); + LatticeArc::Label ilabel = 0, + olabel = (next_token2label_map[tok] = AllocateNewTokenLabel()); + chunk_lat.AddArc(state, + LatticeArc(ilabel, olabel, + LatticeWeight::One(), + token_final_state)); + chunk_lat.SetFinal(token_final_state, LatticeWeight(final_cost, 0.0)); + } + } + } + + // Go in reverse order over the remaining frames so we can create arcs as we + // go, and their destination-states will already be in the map. + for (int32 frame = num_frames_to_include; + frame >= num_frames_in_lattice_; frame--) { + // The conditional below is needed for the last frame of the utterance. + BaseFloat cost_offset = (frame < cost_offsets_.size() ? + cost_offsets_[frame] : 0.0); + + // For the first frame of the chunk, we need to make sure the states are + // the ones created by InitializeRawLatticeChunk() (where not pruned away). + if (frame == num_frames_in_lattice_ && num_frames_in_lattice_ != 0) { + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + auto iter = token2label_map_.find(tok); + KALDI_ASSERT(iter != token2label_map_.end()); + Label token_label = iter->second; + auto iter2 = token_label2state.find(token_label); + if (iter2 != token_label2state.end()) { + StateId state = iter2->second; + tok2state_map[tok] = state; + } else { + // Some states may have been pruned out, but we should still allocate + // them. They might have been part of chains of nonemitting arcs + // where the state became disconnected because the last chunk didn't + // include arcs starting at this frame. + StateId state = chunk_lat.AddState(); + tok2state_map[tok] = state; + } + } + } else if (frame != num_frames_to_include) { // We already created states + // for the last frame. + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + StateId state = chunk_lat.AddState(); + tok2state_map[tok] = state; + } + } + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + auto iter = tok2state_map.find(tok); + KALDI_ASSERT(iter != tok2state_map.end()); + StateId cur_state = iter->second; + for (ForwardLinkT *l = tok->links; l != NULL; l = l->next) { + auto next_iter = tok2state_map.find(l->next_tok); + if (next_iter == tok2state_map.end()) { + // Emitting arcs from the last frame we're including -- ignore + // these. + KALDI_ASSERT(frame == num_frames_to_include); + continue; + } + StateId next_state = next_iter->second; + BaseFloat this_offset = (l->ilabel != 0 ? cost_offset : 0); + LatticeArc arc(l->ilabel, l->olabel, + LatticeWeight(l->graph_cost, l->acoustic_cost - this_offset), + next_state); + // Note: the epsilons get redundantly included at the end and beginning + // of successive chunks. These will get removed in the determinization. + chunk_lat.AddArc(cur_state, arc); + } + } + } + if (num_frames_in_lattice_ == 0) { + // This block locates the start token. NOTE: we use the fact that in the + // linked list of tokens, things are added at the head, so the start state + // must be at the tail. If this data structure is changed in future, we + // might need to explicitly store the start token as a class member. + Token *tok = active_toks_[0].toks; + if (tok == NULL) { + KALDI_WARN << "No tokens exist on start frame"; + return determinizer_.GetLattice(); // will be empty. + } + while (tok->next != NULL) + tok = tok->next; + Token *start_token = tok; + auto iter = tok2state_map.find(start_token); + KALDI_ASSERT(iter != tok2state_map.end()); + StateId start_state = iter->second; + chunk_lat.SetStart(start_state); + } + token2label_map_.swap(next_token2label_map); + + // bool finished_before_beam = + determinizer_.AcceptRawLatticeChunk(&chunk_lat); + // We are ignoring the return status, which say whether it finished before the beam. + + num_frames_in_lattice_ = num_frames_to_include; + + if (determinizer_.GetLattice().NumStates() == 0) + return determinizer_.GetLattice(); // Something went wrong, lattice is empty. + } + + unordered_map token2final_cost; + unordered_map token_label2final_cost; + if (use_final_probs) { + ComputeFinalCosts(&token2final_cost, NULL, NULL); + for (const auto &p: token2final_cost) { + Token *tok = p.first; + BaseFloat cost = p.second; + auto iter = token2label_map_.find(tok); + if (iter != token2label_map_.end()) { + /* Some tokens may not have survived the pruned determinization. */ + Label token_label = iter->second; + bool ret = token_label2final_cost.insert({token_label, cost}).second; + KALDI_ASSERT(ret); /* Make sure it was inserted. */ + } + } + } + /* Note: these final-probs won't affect the next chunk, only the lattice + returned from GetLattice(). They are kind of temporaries. */ + determinizer_.SetFinalCosts(token_label2final_cost.empty() ? NULL : + &token_label2final_cost); + + return determinizer_.GetLattice(); +} + + +template +int32 LatticeIncrementalDecoderTpl::GetNumToksForFrame(int32 frame) { + int32 r = 0; + for (Token *tok = active_toks_[frame].toks; tok; tok = tok->next) r++; + return r; +} + + + +/* This utility function adds an arc to a Lattice, but where the source is a + CompactLatticeArc. If the CompactLatticeArc has a string with length greater + than 1, this will require adding extra states to `lat`. + */ +static void AddCompactLatticeArcToLattice( + const CompactLatticeArc &clat_arc, + LatticeArc::StateId src_state, + Lattice *lat) { + const std::vector &string = clat_arc.weight.String(); + size_t N = string.size(); + if (N == 0) { + LatticeArc arc; + arc.ilabel = 0; + arc.olabel = clat_arc.ilabel; + arc.nextstate = clat_arc.nextstate; + arc.weight = clat_arc.weight.Weight(); + lat->AddArc(src_state, arc); + } else { + LatticeArc::StateId cur_state = src_state; + for (size_t i = 0; i < N; i++) { + LatticeArc arc; + arc.ilabel = string[i]; + arc.olabel = (i == 0 ? clat_arc.ilabel : 0); + arc.nextstate = (i + 1 == N ? clat_arc.nextstate : lat->AddState()); + arc.weight = (i == 0 ? clat_arc.weight.Weight() : LatticeWeight::One()); + lat->AddArc(cur_state, arc); + cur_state = arc.nextstate; + } + } +} + + +void LatticeIncrementalDeterminizer::Init() { + non_final_redet_states_.clear(); + clat_.DeleteStates(); + final_arcs_.clear(); + forward_costs_.clear(); + arcs_in_.clear(); +} + +CompactLattice::StateId LatticeIncrementalDeterminizer::AddStateToClat() { + CompactLattice::StateId ans = clat_.AddState(); + forward_costs_.push_back(std::numeric_limits::infinity()); + KALDI_ASSERT(forward_costs_.size() == ans + 1); + arcs_in_.resize(ans + 1); + return ans; +} + +void LatticeIncrementalDeterminizer::AddArcToClat( + CompactLattice::StateId state, + const CompactLatticeArc &arc) { + BaseFloat forward_cost = forward_costs_[state] + + ConvertToCost(arc.weight); + if (forward_cost == std::numeric_limits::infinity()) + return; + int32 arc_idx = clat_.NumArcs(state); + clat_.AddArc(state, arc); + arcs_in_[arc.nextstate].push_back({state, arc_idx}); + if (forward_cost < forward_costs_[arc.nextstate]) + forward_costs_[arc.nextstate] = forward_cost; +} + +// See documentation in header +void LatticeIncrementalDeterminizer::IdentifyTokenFinalStates( + const CompactLattice &chunk_clat, + std::unordered_map *token_map) const { + token_map->clear(); + using StateId = CompactLattice::StateId; + using Label = CompactLatticeArc::Label; + + StateId num_states = chunk_clat.NumStates(); + for (StateId state = 0; state < num_states; state++) { + for (fst::ArcIterator aiter(chunk_clat, state); + !aiter.Done(); aiter.Next()) { + const CompactLatticeArc &arc = aiter.Value(); + if (arc.olabel >= kTokenLabelOffset && arc.olabel < kMaxTokenLabel) { + StateId nextstate = arc.nextstate; + auto r = token_map->insert({nextstate, arc.olabel}); + // Check consistency of labels on incoming arcs + KALDI_ASSERT(r.first->second == arc.olabel); + } + } + } +} + + + + +void LatticeIncrementalDeterminizer::GetNonFinalRedetStates() { + using StateId = CompactLattice::StateId; + non_final_redet_states_.clear(); + non_final_redet_states_.reserve(final_arcs_.size()); + + std::vector state_queue; + for (const CompactLatticeArc &arc: final_arcs_) { + // Note: we abuse the .nextstate field to store the state which is really + // the source of that arc. + StateId redet_state = arc.nextstate; + if (forward_costs_[redet_state] != std::numeric_limits::infinity()) { + // if it is accessible.. + if (non_final_redet_states_.insert(redet_state).second) { + // it was not already there + state_queue.push_back(redet_state); + } + } + } + // Add any states that are reachable from the states above. + while (!state_queue.empty()) { + StateId s = state_queue.back(); + state_queue.pop_back(); + for (fst::ArcIterator aiter(clat_, s); !aiter.Done(); + aiter.Next()) { + const CompactLatticeArc &arc = aiter.Value(); + StateId nextstate = arc.nextstate; + if (non_final_redet_states_.insert(nextstate).second) + state_queue.push_back(nextstate); // it was not already there + } + } +} + + +void LatticeIncrementalDeterminizer::InitializeRawLatticeChunk( + Lattice *olat, + unordered_map *token_label2state) { + using namespace fst; + + olat->DeleteStates(); + LatticeArc::StateId start_state = olat->AddState(); + olat->SetStart(start_state); + token_label2state->clear(); + + // redet_state_map maps from state-ids in clat_ to state-ids in olat. This + // will be the set of states from which the arcs to final-states in the + // canonical appended lattice leave (physically, these are in the .nextstate + // elements of arcs_, since we use that field for the source state), plus any + // states reachable from those states. + unordered_map redet_state_map; + + for (CompactLattice::StateId redet_state: non_final_redet_states_) + redet_state_map[redet_state] = olat->AddState(); + + // First, process any arcs leaving the non-final redeterminized states that + // are not to final-states. (What we mean by "not to final states" is, not to + // stats that are final in the `canonical appended lattice`.. they may + // actually be physically final in clat_, because we make clat_ what we want + // to return to the user. + for (CompactLattice::StateId redet_state: non_final_redet_states_) { + LatticeArc::StateId lat_state = redet_state_map[redet_state]; + + for (ArcIterator aiter(clat_, redet_state); + !aiter.Done(); aiter.Next()) { + const CompactLatticeArc &arc = aiter.Value(); + CompactLattice::StateId nextstate = arc.nextstate; + LatticeArc::StateId lat_nextstate = olat->NumStates(); + auto r = redet_state_map.insert({nextstate, lat_nextstate}); + if (r.second) { // Was inserted. + LatticeArc::StateId s = olat->AddState(); + KALDI_ASSERT(s == lat_nextstate); + } else { + // was not inserted -> was already there. + lat_nextstate = r.first->second; + } + CompactLatticeArc clat_arc(arc); + clat_arc.nextstate = lat_nextstate; + AddCompactLatticeArcToLattice(clat_arc, lat_state, olat); + } + clat_.DeleteArcs(redet_state); + clat_.SetFinal(redet_state, CompactLatticeWeight::Zero()); + } + + for (const CompactLatticeArc &arc: final_arcs_) { + // We abuse the `nextstate` field to store the source state. + CompactLattice::StateId src_state = arc.nextstate; + auto iter = redet_state_map.find(src_state); + if (forward_costs_[src_state] == std::numeric_limits::infinity()) + continue; /* Unreachable state */ + KALDI_ASSERT(iter != redet_state_map.end()); + LatticeArc::StateId src_lat_state = iter->second; + Label token_label = arc.ilabel; // will be == arc.olabel. + KALDI_ASSERT(token_label >= kTokenLabelOffset && + token_label < kMaxTokenLabel); + auto r = token_label2state->insert({token_label, + olat->NumStates()}); + LatticeArc::StateId dest_lat_state = r.first->second; + if (r.second) { // was inserted + LatticeArc::StateId new_state = olat->AddState(); + KALDI_ASSERT(new_state == dest_lat_state); + } + CompactLatticeArc new_arc; + new_arc.nextstate = dest_lat_state; + /* We convert the token-label to epsilon; it's not needed anymore. */ + new_arc.ilabel = new_arc.olabel = 0; + new_arc.weight = arc.weight; + AddCompactLatticeArcToLattice(new_arc, src_lat_state, olat); + } + + // Now deal with the initial-probs. Arcs from initial-states to + // redeterminized-states in the raw lattice have an olabel that identifies the + // id of that redeterminized-state in clat_, and a cost that is derived from + // its entry in forward_costs_. These forward-probs are used to get the + // pruned lattice determinization to behave correctly, and will be canceled + // out later on. + // + // In the paper this is the second-from-last bullet in Sec. 5.2. NOTE: in the + // paper we state that we only include such arcs for "each redeterminized + // state that is either initial in det(A) or that has an arc entering it from + // a state that is not a redeterminized state." In fact, we include these + // arcs for all redeterminized states. I realized that it won't make a + // difference to the outcome, and it's easier to do it this way. + for (CompactLattice::StateId state_id: non_final_redet_states_) { + BaseFloat forward_cost = forward_costs_[state_id]; + LatticeArc arc; + arc.ilabel = 0; + // The olabel (which appears where the word-id would) is what + // we call a 'state-label'. It identifies a state in clat_. + arc.olabel = state_id + kStateLabelOffset; + // It doesn't matter what field we put forward_cost in (or whether we + // divide it among them both; the effect on pruning is the same, and + // we will cancel it out later anyway. + arc.weight = LatticeWeight(forward_cost, 0); + auto iter = redet_state_map.find(state_id); + KALDI_ASSERT(iter != redet_state_map.end()); + arc.nextstate = iter->second; + olat->AddArc(start_state, arc); + } +} + +void LatticeIncrementalDeterminizer::GetRawLatticeFinalCosts( + const Lattice &raw_fst, + std::unordered_map *old_final_costs) { + LatticeArc::StateId raw_fst_num_states = raw_fst.NumStates(); + for (LatticeArc::StateId s = 0; s < raw_fst_num_states; s++) { + for (fst::ArcIterator aiter(raw_fst, s); !aiter.Done(); + aiter.Next()) { + const LatticeArc &value = aiter.Value(); + if (value.olabel >= (Label)kTokenLabelOffset && + value.olabel < (Label)kMaxTokenLabel) { + LatticeWeight final_weight = raw_fst.Final(value.nextstate); + if (final_weight != LatticeWeight::Zero() && + final_weight.Value2() != 0) { + KALDI_ERR << "Label " << value.olabel << " from state " << s + << " looks like a token-label but its next-state " + << value.nextstate << + " has unexpected final-weight " << final_weight.Value1() << ',' + << final_weight.Value2(); + } + auto r = old_final_costs->insert({value.olabel, + final_weight.Value1()}); + if (!r.second && r.first->second != final_weight.Value1()) { + // For any given token-label, all arcs in raw_fst with that + // olabel should go to the same state, so this should be + // impossible. + KALDI_ERR << "Unexpected mismatch in final-costs for tokens, " + << r.first->second << " vs " << final_weight.Value1(); + } + } + } + } +} + + +bool LatticeIncrementalDeterminizer::ProcessArcsFromChunkStartState( + const CompactLattice &chunk_clat, + std::unordered_map *state_map) { + using StateId = CompactLattice::StateId; + StateId clat_num_states = clat_.NumStates(); + + // Process arcs leaving the start state of chunk_clat. These arcs will have + // state-labels on them (unless this is the first chunk). + // For destination-states of those arcs, work out which states in + // clat_ they correspond to and update their forward_costs. + for (fst::ArcIterator aiter(chunk_clat, chunk_clat.Start()); + !aiter.Done(); aiter.Next()) { + const CompactLatticeArc &arc = aiter.Value(); + Label label = arc.ilabel; // ilabel == olabel; would be the olabel + // in a Lattice. + if (!(label >= kStateLabelOffset && + label - kStateLabelOffset < clat_num_states)) { + // The label was not a state-label. This should only be possible on the + // first chunk. + KALDI_ASSERT(state_map->empty()); + return true; // this is the first chunk. + } + StateId clat_state = label - kStateLabelOffset; + StateId chunk_state = arc.nextstate; + auto p = state_map->insert({chunk_state, clat_state}); + StateId dest_clat_state = p.first->second; + // We deleted all its arcs in InitializeRawLatticeChunk + KALDI_ASSERT(clat_.NumArcs(clat_state) == 0); + /* + In almost all cases, dest_clat_state and clat_state will be the same state; + but there may be situations where two arcs with different state-labels + left the start state and entered the same next-state in chunk_clat; and in + these cases, they will be different. + + We didn't address this issue in the paper (or actually realize it could be + a problem). What we do is pick one of the clat_states as the "canonical" + one, and redirect all incoming transitions of the others to enter the + "canonical" one. (Search below for new_in_arc.nextstate = + dest_clat_state). + */ + if (clat_state != dest_clat_state) { + // Check that the start state isn't getting merged with any other state. + // If this were possible, we'd need to deal with it specially, but it + // can't be, because to be merged, 2 states must have identical arcs + // leaving them with identical weights, so we'd need to have another state + // on frame 0 identical to the start state, which is not possible if the + // lattice is deterministic and epsilon-free. + KALDI_ASSERT(clat_state != 0 && dest_clat_state != 0); + } + + // in_weight is an extra weight that we'll include on arcs entering this + // state from the previous chunk. We need to cancel out + // `forward_costs[clat_state]`, which was included in the corresponding arc + // in the raw lattice for pruning purposes; and we need to include the + // weight on the arc from the start-state of `chunk_clat` to this state. + CompactLatticeWeight extra_weight_in = arc.weight; + extra_weight_in.SetWeight( + fst::Times(extra_weight_in.Weight(), + LatticeWeight(-forward_costs_[clat_state], 0.0))); + + // We don't allow state 0 to be a redeterminized-state; calling code assures + // this. Search for `determinizer_.GetLattice().Final(0) != + // CompactLatticeWeight::Zero())` to find that calling code. + KALDI_ASSERT(clat_state != 0); + + // Note: 0 is the start state of clat_. This was checked. + forward_costs_[clat_state] = (clat_state == 0 ? 0 : + std::numeric_limits::infinity()); + std::vector > arcs_in; + arcs_in.swap(arcs_in_[clat_state]); + for (auto p: arcs_in) { + // Note: we'll be doing `continue` below if this input arc came from + // another redeterminized-state, because we did DeleteArcs() for them in + // InitializeRawLatticeChunk(). Those arcs will be transferred + // from chunk_clat later on. + CompactLattice::StateId src_state = p.first; + int32 arc_pos = p.second; + + if (arc_pos >= (int32)clat_.NumArcs(src_state)) + continue; + fst::MutableArcIterator aiter(&clat_, src_state); + aiter.Seek(arc_pos); + if (aiter.Value().nextstate != clat_state) + continue; // This arc record has become invalidated. + CompactLatticeArc new_in_arc(aiter.Value()); + // In most cases we will have dest_clat_state == clat_state, so the next + // line won't change the value of .nextstate + new_in_arc.nextstate = dest_clat_state; + new_in_arc.weight = fst::Times(new_in_arc.weight, extra_weight_in); + aiter.SetValue(new_in_arc); + + BaseFloat new_forward_cost = forward_costs_[src_state] + + ConvertToCost(new_in_arc.weight); + if (new_forward_cost < forward_costs_[dest_clat_state]) + forward_costs_[dest_clat_state] = new_forward_cost; + arcs_in_[dest_clat_state].push_back(p); + } + } + return false; // this is not the first chunk. +} + +void LatticeIncrementalDeterminizer::TransferArcsToClat( + const CompactLattice &chunk_clat, + bool is_first_chunk, + const std::unordered_map &state_map, + const std::unordered_map &chunk_state_to_token, + const std::unordered_map &old_final_costs) { + using StateId = CompactLattice::StateId; + StateId chunk_num_states = chunk_clat.NumStates(); + + // Now transfer arcs from chunk_clat to clat_. + for (StateId chunk_state = (is_first_chunk ? 0 : 1); + chunk_state < chunk_num_states; chunk_state++) { + auto iter = state_map.find(chunk_state); + if (iter == state_map.end()) { + KALDI_ASSERT(chunk_state_to_token.count(chunk_state) != 0); + // Don't process token-final states. Anyway they have no arcs leaving + // them. + continue; + } + StateId clat_state = iter->second; + + // We know that this point that `clat_state` is not a token-final state + // (see glossary for definition) as if it were, we would have done + // `continue` above. + // + // Only in the last chunk of the lattice would be there be a final-prob on + // states that are not `token-final states`; these final-probs would + // normally all be Zero() at this point. So in almost all cases the following + // call will do nothing. + clat_.SetFinal(clat_state, chunk_clat.Final(chunk_state)); + + // Process arcs leaving this state. + for (fst::ArcIterator aiter(chunk_clat, chunk_state); + !aiter.Done(); aiter.Next()) { + CompactLatticeArc arc(aiter.Value()); + + auto next_iter = state_map.find(arc.nextstate); + if (next_iter != state_map.end()) { + // The normal case (when the .nextstate has a corresponding + // state in clat_) is very simple. Just copy the arc over. + arc.nextstate = next_iter->second; + KALDI_ASSERT(arc.ilabel < kTokenLabelOffset || + arc.ilabel > kMaxTokenLabel); + AddArcToClat(clat_state, arc); + } else { + // This is the case when the arc is to a `token-final` state (see + // glossary.) + + // TODO: remove the following slightly excessive assertion? + KALDI_ASSERT(chunk_clat.Final(arc.nextstate) != CompactLatticeWeight::Zero() && + arc.olabel >= (Label)kTokenLabelOffset && + arc.olabel < (Label)kMaxTokenLabel && + chunk_state_to_token.count(arc.nextstate) != 0 && + old_final_costs.count(arc.olabel) != 0); + + // Include the final-cost of the next state (which should be final) + // in arc.weight. + arc.weight = fst::Times(arc.weight, + chunk_clat.Final(arc.nextstate)); + + auto cost_iter = old_final_costs.find(arc.olabel); + KALDI_ASSERT(cost_iter != old_final_costs.end()); + BaseFloat old_final_cost = cost_iter->second; + + // `arc` is going to become an element of final_arcs_. These + // contain information about transitions from states in clat_ to + // `token-final` states (i.e. states that have a token-label on the arc + // to them and that are final in the canonical compact lattice). + // We subtract the old_final_cost as it was just a temporary cost + // introduced for pruning purposes. + arc.weight.SetWeight(fst::Times(arc.weight.Weight(), + LatticeWeight{-old_final_cost, 0.0})); + // In a slight abuse of the Arc data structure, the nextstate is set to + // the source state. The label (ilabel == olabel) indicates the + // token it is associated with. + arc.nextstate = clat_state; + final_arcs_.push_back(arc); + } + } + } + +} + +bool LatticeIncrementalDeterminizer::AcceptRawLatticeChunk( + Lattice *raw_fst) { + using Label = CompactLatticeArc::Label; + using StateId = CompactLattice::StateId; + + // old_final_costs is a map from a `token-label` (see glossary) to the + // associated final-prob in a final-state of `raw_fst`, that is associated + // with that Token. These are Tokens that were active at the end of the + // chunk. The final-probs may arise from beta (backward) costs, introduced + // for pruning purposes, and/or from final-probs in HCLG. Those costs will + // not be included in anything we store permamently in this class; they used + // only to guide pruned determinization, and we will use `old_final_costs` + // later to cancel them out. + std::unordered_map old_final_costs; + GetRawLatticeFinalCosts(*raw_fst, &old_final_costs); + + CompactLattice chunk_clat; + bool determinized_till_beam = DeterminizeLatticePhonePrunedWrapper( + trans_model_, raw_fst, config_.lattice_beam, &chunk_clat, + config_.det_opts); + + TopSortCompactLatticeIfNeeded(&chunk_clat); + + std::unordered_map chunk_state_to_token; + IdentifyTokenFinalStates(chunk_clat, + &chunk_state_to_token); + + StateId chunk_num_states = chunk_clat.NumStates(); + if (chunk_num_states == 0) { + // This will be an error but user-level calling code can detect it from the + // lattice being empty. + KALDI_WARN << "Empty lattice, something went wrong."; + clat_.DeleteStates(); + return false; + } + + StateId start_state = chunk_clat.Start(); // would be 0. + KALDI_ASSERT(start_state == 0); + + // Process arcs leaving the start state of chunk_clat. Unless this is the + // first chunk in the lattice, all arcs leaving the start state of chunk_clat + // will have `state labels` on them (identifying redeterminized-states in + // clat_), and will transition to a state in `chunk_clat` that we can identify + // with that redeterminized-state. + + // state_map maps from (non-initial, non-token-final state s in chunk_clat) to + // a state in clat_. + std::unordered_map state_map; + + + bool is_first_chunk = ProcessArcsFromChunkStartState(chunk_clat, &state_map); + + // Remove any existing arcs in clat_ that leave redeterminized-states, and + // make those states non-final. Below, we'll add arcs leaving those states + // (and possibly new final-probs.) + for (StateId clat_state: non_final_redet_states_) { + clat_.DeleteArcs(clat_state); + clat_.SetFinal(clat_state, CompactLatticeWeight::Zero()); + } + + // The previous final-arc info is no longer relevant; we'll recreate it below. + final_arcs_.clear(); + + // assume chunk_lat.Start() == 0; we asserted it above. Allocate state-ids + // for all remaining states in chunk_clat, except for token-final states. + for (StateId state = (is_first_chunk ? 0 : 1); + state < chunk_num_states; state++) { + if (chunk_state_to_token.count(state) != 0) + continue; // these `token-final` states don't get a state allocated. + + StateId new_clat_state = clat_.NumStates(); + if (state_map.insert({state, new_clat_state}).second) { + // If it was inserted then we need to actually allocate that state + StateId s = AddStateToClat(); + KALDI_ASSERT(s == new_clat_state); + } // else do nothing; it would have been a redeterminized-state and no + } // allocation is needed since they already exist in clat_. and + // in state_map. + + if (is_first_chunk) { + auto iter = state_map.find(start_state); + KALDI_ASSERT(iter != state_map.end()); + CompactLattice::StateId clat_start_state = iter->second; + KALDI_ASSERT(clat_start_state == 0); // topological order. + clat_.SetStart(clat_start_state); + forward_costs_[clat_start_state] = 0.0; + } + + TransferArcsToClat(chunk_clat, is_first_chunk, + state_map, chunk_state_to_token, old_final_costs); + + GetNonFinalRedetStates(); + + return determinized_till_beam; +} + + + +void LatticeIncrementalDeterminizer::SetFinalCosts( + const unordered_map *token_label2final_cost) { + if (final_arcs_.empty()) { + KALDI_WARN << "SetFinalCosts() called when final_arcs_.empty()... possibly " + "means you are calling this after Finalize()? Not allowed: could " + "indicate a code error. Or possibly decoding failed somehow."; + } + + /* + prefinal states a terminology that does not appear in the paper. What it + means is: the set of states that have an arc with a Token-label as the label + leaving them in the canonical appended lattice. + */ + std::unordered_set &prefinal_states(temp_); + prefinal_states.clear(); + for (const auto &arc: final_arcs_) { + /* Caution: `state` is actually the state the arc would + leave from in the canonical appended lattice; we just store + that in the .nextstate field. */ + CompactLattice::StateId state = arc.nextstate; + prefinal_states.insert(state); + } + + for (int32 state: prefinal_states) + clat_.SetFinal(state, CompactLatticeWeight::Zero()); + + + for (const CompactLatticeArc &arc: final_arcs_) { + Label token_label = arc.ilabel; + /* Note: we store the source state in the .nextstate field. */ + CompactLattice::StateId src_state = arc.nextstate; + BaseFloat graph_final_cost; + if (token_label2final_cost == NULL) { + graph_final_cost = 0.0; + } else { + auto iter = token_label2final_cost->find(token_label); + if (iter == token_label2final_cost->end()) + continue; + else + graph_final_cost = iter->second; + } + /* It might seem odd to set a final-prob on the src-state of the arc.. + the point is that the symbol on the arc is a token-label, which should not + appear in the lattice the user sees, so after that token-label is removed + the arc would just become a final-prob. + */ + clat_.SetFinal(src_state, + fst::Plus(clat_.Final(src_state), + fst::Times(arc.weight, + CompactLatticeWeight( + LatticeWeight(graph_final_cost, 0), {})))); + } +} + + + + +// Instantiate the template for the combination of token types and FST types +// that we'll need. +template class LatticeIncrementalDecoderTpl, decoder::StdToken>; +template class LatticeIncrementalDecoderTpl, + decoder::StdToken>; +template class LatticeIncrementalDecoderTpl, + decoder::StdToken>; +template class LatticeIncrementalDecoderTpl; +template class LatticeIncrementalDecoderTpl; + +template class LatticeIncrementalDecoderTpl, + decoder::BackpointerToken>; +template class LatticeIncrementalDecoderTpl, + decoder::BackpointerToken>; +template class LatticeIncrementalDecoderTpl, + decoder::BackpointerToken>; +template class LatticeIncrementalDecoderTpl; +template class LatticeIncrementalDecoderTpl; + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-decoder.h new file mode 100644 index 0000000..575a926 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-decoder.h @@ -0,0 +1,734 @@ +// decoder/lattice-incremental-decoder.h + +// Copyright 2019 Zhehuai Chen, Daniel Povey + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_LATTICE_INCREMENTAL_DECODER_H_ +#define KALDI_DECODER_LATTICE_INCREMENTAL_DECODER_H_ + +#include "util/stl-utils.h" +#include "util/hash-list.h" +#include "fst/fstlib.h" +#include "itf/decodable-itf.h" +#include "fstext/fstext-lib.h" +#include "lat/determinize-lattice-pruned.h" +#include "lat/kaldi-lattice.h" +#include "decoder/grammar-fst.h" +#include "decoder/lattice-faster-decoder.h" + +namespace kaldi { +/** + The normal decoder, lattice-faster-decoder.h, sometimes has an issue when + doing real-time applications with long utterances, that each time you get the + lattice the lattice determinization can take a considerable amount of time; + this introduces latency. This version of the decoder spreads the work of + lattice determinization out throughout the decoding process. + + NOTE: + + Please see https://www.danielpovey.com/files/ *TBD* .pdf for a technical + explanation of what is going on here. + + GLOSSARY OF TERMS: + chunk: We do the determinization on chunks of frames; these + may coincide with the chunks on which the user calls + AdvanceDecoding(). The basic idea is to extract chunks + of the raw lattice and determinize them individually, but + it gets much more complicated than that. The chunks + should normally be at least as long as a word (let's say, + at least 20 frames), or the overhead of this algorithm + might become excessive and affect RTF. + + raw lattice chunk: A chunk of raw (i.e. undeterminized) lattice + that we will determinize. In the paper this corresponds + to the FST B that is described in Section 5.2. + + token_label, state_label / token-label, state-label: + + In the paper these are both referred to as `state labels` (these are + special, large integer id's that refer to states in the undeterminized + lattice and in the the determinized lattice); but we use two separate + terms here, for more clarity, when referring to the undeterminized + vs. determinized lattice. + + token_label conceptually refers to states in the + raw lattice, but we don't materialize the entire + raw lattice as a physical FST and and these tokens + are actually tokens (template type Token) held by + the decoder + + state_label when used in this code refers specifically + to labels that identify states in the determinized + lattice (i.e. state indexes in lat_). + + token-final state + A state in a raw lattice or in a determinized chunk that has an arc + entering it that has a `token-label` on it (as defined above). + These states will have nonzero final-probs. + + redeterminized-non-splice-state, aka ns_redet: + A redeterminized state which is not also a splice state; + refer to the paper for explanation. In the already-determinized + part this means a redeterminized state which is not final. + + canonical appended lattice: This is the appended compact lattice + that we conceptually have (i.e. what we described in the paper). + The difference from the "actual appended lattice" stored + in LatticeIncrementalDeterminizer::clat_ is that the + actual appended lattice has all its final-arcs replaced with + final-probs, and we keep the real final-arcs "on the side" in a + separate data structure. The final-probs in clat_ aren't + necessarily related to the costs on the final-arcs; instead + they can have arbitrary values passed in by the user (e.g. + if we want to include final-probs). This means that the + clat_ can be returned without modification to the user who wants + a partially determinized result. + + final-arc: An arc in the canonical appended CompactLattice which + goes to a final-state. These arcs will have `state-labels` as + their labels. + + */ +struct LatticeIncrementalDecoderConfig { + // All the configuration values until det_opts are the same as in + // LatticeFasterDecoder. For clarity we repeat them rather than inheriting. + BaseFloat beam; + int32 max_active; + int32 min_active; + BaseFloat lattice_beam; + int32 prune_interval; + BaseFloat beam_delta; // has nothing to do with beam_ratio + BaseFloat hash_ratio; + BaseFloat prune_scale; // Note: we don't make this configurable on the command line, + // it's not a very important parameter. It affects the + // algorithm that prunes the tokens as we go. + // Most of the options inside det_opts are not actually queried by the + // LatticeIncrementalDecoder class itself, but by the code that calls it, for + // example in the function DecodeUtteranceLatticeIncremental. + fst::DeterminizeLatticePhonePrunedOptions det_opts; + + // The configuration values from this point on are specific to the + // incremental determinization. See where they are registered for + // explanation. + // Caution: these are only inspected in UpdateLatticeDeterminization(). + // If you call + int32 determinize_max_delay; + int32 determinize_min_chunk_size; + int32 determinize_max_active; + + + LatticeIncrementalDecoderConfig() + : beam(16.0), + max_active(std::numeric_limits::max()), + min_active(200), + lattice_beam(10.0), + prune_interval(25), + beam_delta(0.5), + hash_ratio(2.0), + prune_scale(0.01), + determinize_max_delay(60), + determinize_min_chunk_size(20), + determinize_max_active(200) { + det_opts.minimize = false; + } + void Register(OptionsItf *opts) { + det_opts.Register(opts); + opts->Register("beam", &beam, "Decoding beam. Larger->slower, more accurate."); + opts->Register("max-active", &max_active, + "Decoder max active states. Larger->slower; " + "more accurate"); + opts->Register("min-active", &min_active, "Decoder minimum #active states."); + opts->Register("lattice-beam", &lattice_beam, + "Lattice generation beam. Larger->slower, " + "and deeper lattices"); + opts->Register("prune-interval", &prune_interval, + "Interval (in frames) at " + "which to prune tokens"); + opts->Register("beam-delta", &beam_delta, + "Increment used in decoding-- this " + "parameter is obscure and relates to a speedup in the way the " + "max-active constraint is applied. Larger is more accurate."); + opts->Register("hash-ratio", &hash_ratio, + "Setting used in decoder to " + "control hash behavior"); + opts->Register("determinize-max-delay", &determinize_max_delay, + "Maximum frames of delay between decoding a frame and " + "determinizing it"); + opts->Register("determinize-min-chunk-size", &determinize_min_chunk_size, + "Minimum chunk size used in determinization"); + opts->Register("determinize-max-active", &determinize_max_active, + "Maximum number of active tokens to update determinization"); + + } + void Check() const { + if (!(beam > 0.0 && max_active > 1 && lattice_beam > 0.0 && + min_active <= max_active && prune_interval > 0 && + beam_delta > 0.0 && hash_ratio >= 1.0 && + prune_scale > 0.0 && prune_scale < 1.0 && + determinize_max_delay > determinize_min_chunk_size && + determinize_min_chunk_size > 0 && + determinize_max_active >= 0)) + KALDI_ERR << "Invalid options given to decoder"; + /* Minimization of the chunks is not compatible withour algorithm (or at + least, would require additional complexity to implement.) */ + if (det_opts.minimize || !det_opts.word_determinize) + KALDI_ERR << "Invalid determinization options given to decoder."; + } +}; + + + +/** + This class is used inside LatticeIncrementalDecoderTpl; it handles + some of the details of incremental determinization. + https://www.danielpovey.com/files/ *TBD*.pdf for the paper. + +*/ +class LatticeIncrementalDeterminizer { + public: + using Label = typename LatticeArc::Label; /* Actualy the same labels appear + in both lattice and compact + lattice, so we don't use the + specific type all the time but + just say 'Label' */ + LatticeIncrementalDeterminizer( + const TransitionInformation &trans_model, + const LatticeIncrementalDecoderConfig &config): + trans_model_(trans_model), config_(config) { } + + // Resets the lattice determinization data for new utterance + void Init(); + + // Returns the current determinized lattice. + const CompactLattice &GetDeterminizedLattice() const { return clat_; } + + /** + Starts the process of creating a raw lattice chunk. (Search the glossary + for "raw lattice chunk"). This just sets up the initial states and + redeterminized-states in the chunk. Relates to sec. 5.2 in the paper, + specifically the initial-state i and the redeterminized-states. + + After calling this, the caller would add the remaining arcs and states + to `olat` and then call AcceptRawLatticeChunk() with the result. + + @param [out] olat The lattice to be (partially) created + + @param [out] token_label2state This function outputs to here + a map from `token-label` to the state we created for + it in *olat. See glossary for `token-label`. + The keys actually correspond to the .nextstate fields + in the arcs in final_arcs_; values are states in `olat`. + See the last bullet point before Sec. 5.3 in the paper. + */ + void InitializeRawLatticeChunk( + Lattice *olat, + unordered_map *token_label2state); + + /** + This function accepts the raw FST (state-level lattice) corresponding to a + single chunk of the lattice, determinizes it and appends it to this->clat_. + Unless this was the + + Note: final-probs in `raw_fst` are treated specially: they are used to + guide the pruned determinization, but when you call GetLattice() it will be + -- except for pruning effects-- as if all nonzero final-probs in `raw_fst` + were: One() if final_costs == NULL; else the value present in `final_costs`. + + @param [in] raw_fst (Consumed destructively). The input + raw (state-level) lattice. Would correspond to the + FST A in the paper if first_frame == 0, and B + otherwise. + + @return returns false if determinization finished earlier than the beam + or the determinized lattice was empty; true otherwise. + + NOTE: if this is not the final chunk, you will probably want to call + SetFinalCosts() directly after calling this. + */ + bool AcceptRawLatticeChunk(Lattice *raw_fst); + + /* + Sets final-probs in `clat_`. Must only be called if the final chunk + has not been processed. (The final chunk is whenever GetLattice() is + called with finalize == true). + + The reason this is a separate function from AcceptRawLatticeChunk() is that + there may be situations where a user wants to get the latice with + final-probs in it, after previously getting it without final-probs; or + vice versa. By final-probs, we mean the Final() probabilities in the + HCLG (decoding graph; this->fst_). + + @param [in] token_label2final_cost A map from the token-label + corresponding to Tokens active on the final frame of the + lattice in the object, to the final-cost we want to use for + those tokens. If NULL, it means all Tokens should be treated + as final with probability One(). If non-NULL, and a particular + token-label is not a key of this map, it means that Token + corresponded to a state that was not final in HCLG; and + such tokens will be treated as non-final. However, + if this would result in no states in the lattice being final, + we will treat all Tokens as final with probability One(), + a warning will be printed (this should not happen.) + */ + void SetFinalCosts(const unordered_map *token_label2final_cost = NULL); + + const CompactLattice &GetLattice() { return clat_; } + + // kStateLabelOffset is what we add to state-ids in clat_ to produce labels + // to identify them in the raw lattice chunk + // kTokenLabelOffset is where we start allocating labels corresponding to Tokens + // (these correspond with raw lattice states); + enum { kStateLabelOffset = (int)1e8, kTokenLabelOffset = (int)2e8, kMaxTokenLabel = (int)3e8 }; + + private: + + // [called from AcceptRawLatticeChunk()] + // Gets the final costs from token-final states in the raw lattice (see + // glossary for definition). These final costs will be subtracted after + // determinization; in the normal case they are `temporaries` used to guide + // pruning. NOTE: the index of the array is not the FST state that is final, + // but the label on arcs entering it (these will be `token-labels`). Each + // token-final state will have the same label on all arcs entering it. + // + // `old_final_costs` is assumed to be empty at entry. + void GetRawLatticeFinalCosts(const Lattice &raw_fst, + std::unordered_map *old_final_costs); + + // Sets up non_final_redet_states_. See documentation for that variable. + void GetNonFinalRedetStates(); + + /** [called from AcceptRawLatticeChunk()] Processes arcs that leave the + start-state of `chunk_clat` (if this is not the first chunk); does nothing + if this is the first chunk. This includes using the `state-labels` to + work out which states in clat_ these states correspond to, and writing + that mapping to `state_map`. + + Also modifies forward_costs_, because it has to do a kind of reweighting + of the clat states that are the values it puts in `state_map`, to take + account of the probabilities on the arcs from the start state of + chunk_clat to the states corresponding to those redeterminized-states + (i.e. the states in clat corresponding to the values it puts in + `*state_map`). It also modifies arcs_in_, mostly because there + are rare cases when we end up `merging` sets of those redeterminized-states, + because the determinization process mapped them to a single state, + and that means we need to reroute the arcs into members of that + set into one single member (which will appear as a value in + `*state_map`). + + @param [in] chunk_clat The determinized chunk of lattice we are + processing + @param [out] state_map Mapping from states in chunk_clat to + the state in clat_ they correspond to. + @return Returns true if this is the first chunk. + */ + bool ProcessArcsFromChunkStartState( + const CompactLattice &chunk_clat, + std::unordered_map *state_map); + + /** + This function, called from AcceptRawLatticeChunk(), transfers arcs from + `chunk_clat` to clat_. For those arcs that have `token-labels` on them, + they don't get written to clat_ but instead are stored in the arcs_ array. + + @param [in] chunk_clat The determinized lattice for the chunk + we are processing; this is the source of the arcs + we are moving. + @param [in] is_first_chunk True if this is the first chunk in the + utterance; it's needed because if it is, we + will also transfer arcs from the start state of + chunk_clat. + @param [in] state_map Map from state-ids in chunk_clat to state-ids + in clat_. + @param [in] chunk_state_to_token Map from `token-final states` + (see glossary) in chunk_clat, to the token-label + on arcs entering those states. + @param [in] old_final_costs Map from token-label to the + final-costs that were on the corresponding + token-final states in the undeterminized lattice; + these final-costs need to be removed when + we record the weights in final_arcs_, because + they were just temporary. + */ + void TransferArcsToClat( + const CompactLattice &chunk_clat, + bool is_first_chunk, + const std::unordered_map &state_map, + const std::unordered_map &chunk_state_to_token, + const std::unordered_map &old_final_costs); + + + + /** + Adds one arc to `clat_`. It's like clat_.AddArc(state, arc), except + it also modifies arcs_in_ and forward_costs_. + */ + void AddArcToClat(CompactLattice::StateId state, + const CompactLatticeArc &arc); + CompactLattice::StateId AddStateToClat(); + + + // Identifies token-final states in `chunk_clat`; see glossary above for + // definition of `token-final`. This function outputs a map from such states + // in chunk_clat, to the `token-label` on arcs entering them. (It is not + // possible that the same state would have multiple arcs entering it with + // different token-labels, or some arcs entering with one token-label and some + // another, or be both initial and have such arcs; this is true due to how we + // construct the raw lattice.) + void IdentifyTokenFinalStates( + const CompactLattice &chunk_clat, + std::unordered_map *token_map) const; + + // trans_model_ is needed by DeterminizeLatticePhonePrunedWrapper() which this + // class calls. + const TransitionInformation &trans_model_; + // config_ is needed by DeterminizeLatticePhonePrunedWrapper() which this + // class calls. + const LatticeIncrementalDecoderConfig &config_; + + + // Contains the set of redeterminized-states which are not final in the + // canonical appended lattice. Since the final ones don't physically appear + // in clat_, this means the set of redeterminized-states which are physically + // in clat_. In code terms, this means set of .first elements in final_arcs, + // plus whatever other states in clat_ are reachable from such states. + std::unordered_set non_final_redet_states_; + + + // clat_ is the appended lattice (containing all chunks processed so + // far), except its `final-arcs` (i.e. arcs which in the canonical + // lattice would go to final-states) are not present (they are stored + // separately in final_arcs_) and states which in the canonical lattice + // should have final-arcs leaving them will instead have a final-prob. + CompactLattice clat_; + + + // arcs_in_ is indexed by (state-id in clat_), and is a list of + // arcs that come into this state, in the form (prev-state, + // arc-index). CAUTION: not all these input-arc records will always + // be valid (some may be out-of-date, and may refer to an out-of-range + // arc or an arc that does not point to this state). But all + // input arcs will always be listed. + std::vector > > arcs_in_; + + // final_arcs_ contains arcs which would appear in the canonical appended + // lattice but for implementation reasons are not physically present in clat_. + // These are arcs to final states in the canonical appended lattice. The + // .first elements are the source states in clat_ (these will all be elements + // of non_final_redet_states_); the .nextstate elements of the arcs does not + // contain a physical state, but contain state-labels allocated by + // AllocateNewStateLabel(). + std::vector final_arcs_; + + // forward_costs_, indexed by the state-id in clat_, stores the alpha + // (forward) costs, i.e. the minimum cost from the start state to each state + // in clat_. This is relevant for pruned determinization. The BaseFloat can + // be thought of as the sum of a Value1() + Value2() in a LatticeWeight. + std::vector forward_costs_; + + // temporary used in a function, kept here to avoid excessive reallocation. + std::unordered_set temp_; + + KALDI_DISALLOW_COPY_AND_ASSIGN(LatticeIncrementalDeterminizer); +}; + + +/** This is an extention to the "normal" lattice-generating decoder. + See \ref lattices_generation \ref decoders_faster and \ref decoders_simple + for more information. + + The main difference is the incremental determinization which will be + discussed in the function GetLattice(). This means that the work of determinizatin + isn't done all at once at the end of the file, but incrementally while decoding. + See the comment at the top of this file for more explanation. + + The decoder is templated on the FST type and the token type. The token type + will normally be StdToken, but also may be BackpointerToken which is to support + quick lookup of the current best path (see lattice-faster-online-decoder.h) + + The FST you invoke this decoder with is expected to be of type + Fst::Fst, a.k.a. StdFst, or GrammarFst. If you invoke it with + FST == StdFst and it notices that the actual FST type is + fst::VectorFst or fst::ConstFst, the decoder object + will internally cast itself to one that is templated on those more specific + types; this is an optimization for speed. + */ +template +class LatticeIncrementalDecoderTpl { + public: + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using ForwardLinkT = decoder::ForwardLink; + + // Instantiate this class once for each thing you have to decode. + // This version of the constructor does not take ownership of + // 'fst'. + LatticeIncrementalDecoderTpl(const FST &fst, const TransitionInformation &trans_model, + const LatticeIncrementalDecoderConfig &config); + + // This version of the constructor takes ownership of the fst, and will delete + // it when this object is destroyed. + LatticeIncrementalDecoderTpl(const LatticeIncrementalDecoderConfig &config, + FST *fst, const TransitionInformation &trans_model); + + void SetOptions(const LatticeIncrementalDecoderConfig &config) { config_ = config; } + + const LatticeIncrementalDecoderConfig &GetOptions() const { return config_; } + + ~LatticeIncrementalDecoderTpl(); + + /** + CAUTION: it's unlikely that you will ever want to call this function. In a + scenario where you have the entire file and just want to decode it, there + is no point using this decoder. + + An example of how to do decoding together with incremental + determinization. It decodes until there are no more frames left in the + "decodable" object. + + In this example, config_.determinize_max_delay, config_.determinize_min_chunk_size + and config_.determinize_max_active are used to determine the time to + call GetLattice(). + + Users will probably want to use appropriate combinations of + AdvanceDecoding() and GetLattice() to build their application; this just + gives you some idea how. + + The function returns true if any kind of traceback is available (not + necessarily from a final state). + */ + bool Decode(DecodableInterface *decodable); + + /// says whether a final-state was active on the last frame. If it was not, + /// the lattice (or traceback) will end with states that are not final-states. + bool ReachedFinal() const { + return FinalRelativeCost() != std::numeric_limits::infinity(); + } + + /** + This decoder has no GetBestPath() function. + If you need that functionality you should probably use lattice-incremental-online-decoder.h, + which makes it very efficient to obtain the best path. */ + + /** + This GetLattice() function returns the lattice containing + `num_frames_to_decode` frames; this will be all frames decoded so + far, if you let num_frames_to_decode == NumFramesDecoded(), + but it will generally be better to make it a few frames less than + that to avoid the lattice having too many active states at + the end. + + @param [in] num_frames_to_include The number of frames that you want + to be included in the lattice. Must be >= + NumFramesInLattice() and <= NumFramesDecoded(). + + @param [in] use_final_probs True if you want the final-probs + of HCLG to be included in the output lattice. Must not + be set to true if num_frames_to_include != + NumFramesDecoded(). Must be set to true if you have + previously called FinalizeDecoding(). + + (If no state was final on frame `num_frames_to_include`, the + final-probs won't be included regardless of + `use_final_probs`; you can test whether this + was the case by calling ReachedFinal(). + + @return clat The CompactLattice representing what has been decoded + up until `num_frames_to_include` (e.g., LatticeStateTimes() + on this lattice would return `num_frames_to_include`). + + See also UpdateLatticeDeterminizaton(). Caution: this const ref + is only valid until the next time you call AdvanceDecoding() or + GetLattice(). + + CAUTION: the lattice may contain disconnnected states; you should + call Connect() on the output before writing it out. + */ + const CompactLattice &GetLattice(int32 num_frames_to_include, + bool use_final_probs = false); + + /* + Returns the number of frames in the currently-determinized part of the + lattice which will be a number in [0, NumFramesDecoded()]. It will + be the largest number that GetLattice() was called with, but note + that GetLattice() may be called from UpdateLatticeDeterminization(). + + Made available in case the user wants to give that same number to + GetLattice(). + */ + int NumFramesInLattice() const { return num_frames_in_lattice_; } + + /** + InitDecoding initializes the decoding, and should only be used if you + intend to call AdvanceDecoding(). If you call Decode(), you don't need to + call this. You can also call InitDecoding if you have already decoded an + utterance and want to start with a new utterance. + */ + void InitDecoding(); + + /** + This will decode until there are no more frames ready in the decodable + object. You can keep calling it each time more frames become available + (this is the normal pattern in a real-time/online decoding scenario). + If max_num_frames is specified, it specifies the maximum number of frames + the function will decode before returning. + */ + void AdvanceDecoding(DecodableInterface *decodable, int32 max_num_frames = -1); + + + /** FinalRelativeCost() serves the same purpose as ReachedFinal(), but gives + more information. It returns the difference between the best (final-cost + plus cost) of any token on the final frame, and the best cost of any token + on the final frame. If it is infinity it means no final-states were + present on the final frame. It will usually be nonnegative. If it not + too positive (e.g. < 5 is my first guess, but this is not tested) you can + take it as a good indication that we reached the final-state with + reasonable likelihood. */ + BaseFloat FinalRelativeCost() const; + + /** Returns the number of frames decoded so far. */ + inline int32 NumFramesDecoded() const { return active_toks_.size() - 1; } + + /** + Finalizes the decoding, doing an extra pruning step on the last frame + that uses the final-probs. May be called only once. + */ + void FinalizeDecoding(); + + protected: + /* Some protected things are needed in LatticeIncrementalOnlineDecoderTpl. */ + + /** NOTE: for parts the internal implementation that are shared with LatticeFasterDecoer, + we have removed the comments.*/ + inline static void DeleteForwardLinks(Token *tok); + struct TokenList { + Token *toks; + bool must_prune_forward_links; + bool must_prune_tokens; + int32 num_toks; /* Note: you can only trust `num_toks` if must_prune_tokens + * == false, because it is only set in + * PruneTokensForFrame(). */ + TokenList() + : toks(NULL), must_prune_forward_links(true), must_prune_tokens(true), + num_toks(-1) {} + }; + using Elem = typename HashList::Elem; + void PossiblyResizeHash(size_t num_toks); + inline Token *FindOrAddToken(StateId state, int32 frame_plus_one, + BaseFloat tot_cost, Token *backpointer, bool *changed); + void PruneForwardLinks(int32 frame_plus_one, bool *extra_costs_changed, + bool *links_pruned, BaseFloat delta); + void ComputeFinalCosts(unordered_map *final_costs, + BaseFloat *final_relative_cost, + BaseFloat *final_best_cost) const; + void PruneForwardLinksFinal(); + void PruneTokensForFrame(int32 frame_plus_one); + void PruneActiveTokens(BaseFloat delta); + BaseFloat GetCutoff(Elem *list_head, size_t *tok_count, BaseFloat *adaptive_beam, + Elem **best_elem); + BaseFloat ProcessEmitting(DecodableInterface *decodable); + void ProcessNonemitting(BaseFloat cost_cutoff); + + HashList toks_; + std::vector active_toks_; // indexed by frame. + std::vector queue_; // temp variable used in ProcessNonemitting, + std::vector tmp_array_; // used in GetCutoff. + const FST *fst_; + bool delete_fst_; + std::vector cost_offsets_; + int32 num_toks_; + bool warned_; + bool decoding_finalized_; + + unordered_map final_costs_; + BaseFloat final_relative_cost_; + BaseFloat final_best_cost_; + + /*********************** + Variables below this point relate to the incremental + determinization. + *********************/ + LatticeIncrementalDecoderConfig config_; + /** Much of the the incremental determinization algorithm is encapsulated in + the determinize_ object. */ + LatticeIncrementalDeterminizer determinizer_; + + + /* Just a temporary used in a function; stored here to avoid reallocation. */ + unordered_map temp_token_map_; + + /** num_frames_in_lattice_ is the highest `num_frames_to_include_` argument + for any prior call to GetLattice(). */ + int32 num_frames_in_lattice_; + + // A map from Token to its token_label. Will contain an entry for + // each Token in active_toks_[num_frames_in_lattice_]. + unordered_map token2label_map_; + + // A temporary used in a function, kept here to avoid reallocation. + unordered_map token2label_map_temp_; + + // we allocate a unique id for each Token + Label next_token_label_; + + inline Label AllocateNewTokenLabel() { return next_token_label_++; } + + + // There are various cleanup tasks... the the toks_ structure contains + // singly linked lists of Token pointers, where Elem is the list type. + // It also indexes them in a hash, indexed by state (this hash is only + // maintained for the most recent frame). toks_.Clear() + // deletes them from the hash and returns the list of Elems. The + // function DeleteElems calls toks_.Delete(elem) for each elem in + // the list, which returns ownership of the Elem to the toks_ structure + // for reuse, but does not delete the Token pointer. The Token pointers + // are reference-counted and are ultimately deleted in PruneTokensForFrame, + // but are also linked together on each frame by their own linked-list, + // using the "next" pointer. We delete them manually. + void DeleteElems(Elem *list); + + void ClearActiveTokens(); + + + // Returns the number of active tokens on frame `frame`. Can be used as part + // of a heuristic to decide which frame to determinize until, if you are not + // at the end of an utterance. + int32 GetNumToksForFrame(int32 frame); + + /** + UpdateLatticeDeterminization() ensures the work of determinization is kept + up to date so that when you do need the lattice you can get it fast. It + uses the configuration values `determinize_max_delay`, `determinize_min_chunk_size` + and `determinize_max_active`, to decide whether and when to call + GetLattice(). You can safely call this as often as you want (e.g. after + each time you call AdvanceDecoding(); it won't do subtantially more work if + it is called frequently. + */ + void UpdateLatticeDeterminization(); + + + KALDI_DISALLOW_COPY_AND_ASSIGN(LatticeIncrementalDecoderTpl); +}; + +typedef LatticeIncrementalDecoderTpl + LatticeIncrementalDecoder; + + +} // end namespace kaldi. + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-online-decoder.cc b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-online-decoder.cc new file mode 100644 index 0000000..cacac2c --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-online-decoder.cc @@ -0,0 +1,158 @@ +// decoder/lattice-incremental-online-decoder.cc + +// Copyright 2019 Zhehuai Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +// see note at the top of lattice-faster-decoder.cc, about how to maintain this +// file in sync with lattice-faster-decoder.cc + +#include "decoder/lattice-incremental-decoder.h" +#include "decoder/lattice-incremental-online-decoder.h" +#include "lat/lattice-functions.h" +#include "base/timer.h" + +namespace kaldi { + +// Outputs an FST corresponding to the single best path through the lattice. +template +bool LatticeIncrementalOnlineDecoderTpl::GetBestPath(Lattice *olat, + bool use_final_probs) const { + olat->DeleteStates(); + BaseFloat final_graph_cost; + BestPathIterator iter = BestPathEnd(use_final_probs, &final_graph_cost); + if (iter.Done()) + return false; // would have printed warning. + StateId state = olat->AddState(); + olat->SetFinal(state, LatticeWeight(final_graph_cost, 0.0)); + while (!iter.Done()) { + LatticeArc arc; + iter = TraceBackBestPath(iter, &arc); + arc.nextstate = state; + StateId new_state = olat->AddState(); + olat->AddArc(new_state, arc); + state = new_state; + } + olat->SetStart(state); + return true; +} + +template +typename LatticeIncrementalOnlineDecoderTpl::BestPathIterator LatticeIncrementalOnlineDecoderTpl::BestPathEnd( + bool use_final_probs, + BaseFloat *final_cost_out) const { + if (this->decoding_finalized_ && !use_final_probs) + KALDI_ERR << "You cannot call FinalizeDecoding() and then call " + << "BestPathEnd() with use_final_probs == false"; + KALDI_ASSERT(this->NumFramesDecoded() > 0 && + "You cannot call BestPathEnd if no frames were decoded."); + + unordered_map final_costs_local; + + const unordered_map &final_costs = + (this->decoding_finalized_ ? this->final_costs_ :final_costs_local); + if (!this->decoding_finalized_ && use_final_probs) + this->ComputeFinalCosts(&final_costs_local, NULL, NULL); + + // Singly linked list of tokens on last frame (access list through "next" + // pointer). + BaseFloat best_cost = std::numeric_limits::infinity(); + BaseFloat best_final_cost = 0; + Token *best_tok = NULL; + for (Token *tok = this->active_toks_.back().toks; + tok != NULL; tok = tok->next) { + BaseFloat cost = tok->tot_cost, final_cost = 0.0; + if (use_final_probs && !final_costs.empty()) { + // if we are instructed to use final-probs, and any final tokens were + // active on final frame, include the final-prob in the cost of the token. + typename unordered_map::const_iterator + iter = final_costs.find(tok); + if (iter != final_costs.end()) { + final_cost = iter->second; + cost += final_cost; + } else { + cost = std::numeric_limits::infinity(); + } + } + if (cost < best_cost) { + best_cost = cost; + best_tok = tok; + best_final_cost = final_cost; + } + } + if (best_tok == NULL) { // this should not happen, and is likely a code error or + // caused by infinities in likelihoods, but I'm not making + // it a fatal error for now. + KALDI_WARN << "No final token found."; + } + if (final_cost_out != NULL) + *final_cost_out = best_final_cost; + return BestPathIterator(best_tok, this->NumFramesDecoded() - 1); +} + + +template +typename LatticeIncrementalOnlineDecoderTpl::BestPathIterator LatticeIncrementalOnlineDecoderTpl::TraceBackBestPath( + BestPathIterator iter, LatticeArc *oarc) const { + KALDI_ASSERT(!iter.Done() && oarc != NULL); + Token *tok = static_cast(iter.tok); + int32 cur_t = iter.frame, step_t = 0; + if (tok->backpointer != NULL) { + // retrieve the correct forward link(with the best link cost) + BaseFloat best_cost = std::numeric_limits::infinity(); + ForwardLinkT *link; + for (link = tok->backpointer->links; + link != NULL; link = link->next) { + if (link->next_tok == tok) { // this is the a to "tok" + BaseFloat graph_cost = link->graph_cost, + acoustic_cost = link->acoustic_cost; + BaseFloat cost = graph_cost + acoustic_cost; + if (cost < best_cost) { + oarc->ilabel = link->ilabel; + oarc->olabel = link->olabel; + if (link->ilabel != 0) { + KALDI_ASSERT(static_cast(cur_t) < this->cost_offsets_.size()); + acoustic_cost -= this->cost_offsets_[cur_t]; + step_t = -1; + } else { + step_t = 0; + } + oarc->weight = LatticeWeight(graph_cost, acoustic_cost); + best_cost = cost; + } + } + } + if (link == NULL && + best_cost == std::numeric_limits::infinity()) { // Did not find correct link. + KALDI_ERR << "Error tracing best-path back (likely " + << "bug in token-pruning algorithm)"; + } + } else { + oarc->ilabel = 0; + oarc->olabel = 0; + oarc->weight = LatticeWeight::One(); // zero costs. + } + return BestPathIterator(tok->backpointer, cur_t + step_t); +} + +// Instantiate the template for the FST types that we'll need. +template class LatticeIncrementalOnlineDecoderTpl >; +template class LatticeIncrementalOnlineDecoderTpl >; +template class LatticeIncrementalOnlineDecoderTpl >; +template class LatticeIncrementalOnlineDecoderTpl; +template class LatticeIncrementalOnlineDecoderTpl; + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-online-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-online-decoder.h new file mode 100644 index 0000000..c82abed --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-incremental-online-decoder.h @@ -0,0 +1,132 @@ +// decoder/lattice-incremental-online-decoder.h + +// Copyright 2019 Zhehuai Chen +// +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +// see note at the top of lattice-faster-decoder.h, about how to maintain this +// file in sync with lattice-faster-decoder.h + + +#ifndef KALDI_DECODER_LATTICE_INCREMENTAL_ONLINE_DECODER_H_ +#define KALDI_DECODER_LATTICE_INCREMENTAL_ONLINE_DECODER_H_ + +#include "util/stl-utils.h" +#include "util/hash-list.h" +#include "fst/fstlib.h" +#include "itf/decodable-itf.h" +#include "fstext/fstext-lib.h" +#include "lat/determinize-lattice-pruned.h" +#include "lat/kaldi-lattice.h" +#include "decoder/lattice-incremental-decoder.h" + +namespace kaldi { + + + +/** LatticeIncrementalOnlineDecoderTpl is as LatticeIncrementalDecoderTpl but also + supports an efficient way to get the best path (see the function + BestPathEnd()), which is useful in endpointing and in situations where you + might want to frequently access the best path. + + This is only templated on the FST type, since the Token type is required to + be BackpointerToken. Actually it only makes sense to instantiate + LatticeIncrementalDecoderTpl with Token == BackpointerToken if you do so indirectly via + this child class. + */ +template +class LatticeIncrementalOnlineDecoderTpl: + public LatticeIncrementalDecoderTpl { + public: + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using Token = decoder::BackpointerToken; + using ForwardLinkT = decoder::ForwardLink; + + // Instantiate this class once for each thing you have to decode. + // This version of the constructor does not take ownership of + // 'fst'. + LatticeIncrementalOnlineDecoderTpl(const FST &fst, + const TransitionInformation &trans_model, + const LatticeIncrementalDecoderConfig &config): + LatticeIncrementalDecoderTpl(fst, trans_model, config) { } + + // This version of the initializer takes ownership of 'fst', and will delete + // it when this object is destroyed. + LatticeIncrementalOnlineDecoderTpl(const LatticeIncrementalDecoderConfig &config, + FST *fst, + const TransitionInformation &trans_model): + LatticeIncrementalDecoderTpl(config, fst, trans_model) { } + + + struct BestPathIterator { + void *tok; + int32 frame; + // note, "frame" is the frame-index of the frame you'll get the + // transition-id for next time, if you call TraceBackBestPath on this + // iterator (assuming it's not an epsilon transition). Note that this + // is one less than you might reasonably expect, e.g. it's -1 for + // the nonemitting transitions before the first frame. + BestPathIterator(void *t, int32 f): tok(t), frame(f) { } + bool Done() { return tok == NULL; } + }; + + + /// Outputs an FST corresponding to the single best path through the lattice. + /// This is quite efficient because it doesn't get the entire raw lattice and find + /// the best path through it; instead, it uses the BestPathEnd and BestPathIterator + /// so it basically traces it back through the lattice. + /// Returns true if result is nonempty (using the return status is deprecated, + /// it will become void). If "use_final_probs" is true AND we reached the + /// final-state of the graph then it will include those as final-probs, else + /// it will treat all final-probs as one. + bool GetBestPath(Lattice *ofst, + bool use_final_probs = true) const; + + + + /// This function returns an iterator that can be used to trace back + /// the best path. If use_final_probs == true and at least one final state + /// survived till the end, it will use the final-probs in working out the best + /// final Token, and will output the final cost to *final_cost (if non-NULL), + /// else it will use only the forward likelihood, and will put zero in + /// *final_cost (if non-NULL). + /// Requires that NumFramesDecoded() > 0. + BestPathIterator BestPathEnd(bool use_final_probs, + BaseFloat *final_cost = NULL) const; + + + /// This function can be used in conjunction with BestPathEnd() to trace back + /// the best path one link at a time (e.g. this can be useful in endpoint + /// detection). By "link" we mean a link in the graph; not all links cross + /// frame boundaries, but each time you see a nonzero ilabel you can interpret + /// that as a frame. The return value is the updated iterator. It outputs + /// the ilabel and olabel, and the (graph and acoustic) weight to the "arc" pointer, + /// while leaving its "nextstate" variable unchanged. + BestPathIterator TraceBackBestPath( + BestPathIterator iter, LatticeArc *arc) const; + + KALDI_DISALLOW_COPY_AND_ASSIGN(LatticeIncrementalOnlineDecoderTpl); +}; + +typedef LatticeIncrementalOnlineDecoderTpl LatticeIncrementalOnlineDecoder; + + +} // end namespace kaldi. + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-simple-decoder.cc b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-simple-decoder.cc new file mode 100644 index 0000000..cc8712e --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-simple-decoder.cc @@ -0,0 +1,666 @@ +// decoder/lattice-simple-decoder.cc + +// Copyright 2009-2012 Microsoft Corporation +// 2013-2014 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "decoder/lattice-simple-decoder.h" + +namespace kaldi { + + +void LatticeSimpleDecoder::InitDecoding() { + // clean up from last time: + cur_toks_.clear(); + prev_toks_.clear(); + ClearActiveTokens(); + warned_ = false; + decoding_finalized_ = false; + final_costs_.clear(); + num_toks_ = 0; + StateId start_state = fst_.Start(); + KALDI_ASSERT(start_state != fst::kNoStateId); + active_toks_.resize(1); + Token *start_tok = new Token(0.0, 0.0, NULL, NULL); + active_toks_[0].toks = start_tok; + cur_toks_[start_state] = start_tok; + num_toks_++; + ProcessNonemitting(); +} + +bool LatticeSimpleDecoder::Decode(DecodableInterface *decodable) { + InitDecoding(); + + while (!decodable->IsLastFrame(NumFramesDecoded() - 1)) { + if (NumFramesDecoded() % config_.prune_interval == 0) + PruneActiveTokens(config_.lattice_beam * config_.prune_scale); + ProcessEmitting(decodable); + // Important to call PruneCurrentTokens before ProcessNonemitting, or we + // would get dangling forward pointers. Anyway, ProcessNonemitting uses the + // beam. + PruneCurrentTokens(config_.beam, &cur_toks_); + ProcessNonemitting(); + } + FinalizeDecoding(); + + // Returns true if we have any kind of traceback available (not necessarily + // to the end state; query ReachedFinal() for that). + return !final_costs_.empty(); +} + +// Outputs an FST corresponding to the single best path +// through the lattice. +bool LatticeSimpleDecoder::GetBestPath(Lattice *ofst, + bool use_final_probs) const { + fst::VectorFst fst; + GetRawLattice(&fst, use_final_probs); + ShortestPath(fst, ofst); + return (ofst->NumStates() > 0); +} + +// Outputs an FST corresponding to the raw, state-level +// tracebacks. +bool LatticeSimpleDecoder::GetRawLattice(Lattice *ofst, + bool use_final_probs) const { + typedef LatticeArc Arc; + typedef Arc::StateId StateId; + typedef Arc::Weight Weight; + typedef Arc::Label Label; + + // Note: you can't use the old interface (Decode()) if you want to + // get the lattice with use_final_probs = false. You'd have to do + // InitDecoding() and then AdvanceDecoding(). + if (decoding_finalized_ && !use_final_probs) + KALDI_ERR << "You cannot call FinalizeDecoding() and then call " + << "GetRawLattice() with use_final_probs == false"; + + unordered_map final_costs_local; + + const unordered_map &final_costs = + (decoding_finalized_ ? final_costs_ : final_costs_local); + + if (!decoding_finalized_ && use_final_probs) + ComputeFinalCosts(&final_costs_local, NULL, NULL); + + ofst->DeleteStates(); + int32 num_frames = NumFramesDecoded(); + KALDI_ASSERT(num_frames > 0); + const int32 bucket_count = num_toks_/2 + 3; + unordered_map tok_map(bucket_count); + // First create all states. + for (int32 f = 0; f <= num_frames; f++) { + if (active_toks_[f].toks == NULL) { + KALDI_WARN << "GetRawLattice: no tokens active on frame " << f + << ": not producing lattice.\n"; + return false; + } + for (Token *tok = active_toks_[f].toks; tok != NULL; tok = tok->next) + tok_map[tok] = ofst->AddState(); + // The next statement sets the start state of the output FST. + // Because we always add new states to the head of the list + // active_toks_[f].toks, and the start state was the first one + // added, it will be the last one added to ofst. + if (f == 0 && ofst->NumStates() > 0) + ofst->SetStart(ofst->NumStates()-1); + } + StateId cur_state = 0; // we rely on the fact that we numbered these + // consecutively (AddState() returns the numbers in order..) + for (int32 f = 0; f <= num_frames; f++) { + for (Token *tok = active_toks_[f].toks; tok != NULL; tok = tok->next, + cur_state++) { + for (ForwardLink *l = tok->links; + l != NULL; + l = l->next) { + unordered_map::const_iterator iter = + tok_map.find(l->next_tok); + StateId nextstate = iter->second; + KALDI_ASSERT(iter != tok_map.end()); + Arc arc(l->ilabel, l->olabel, + Weight(l->graph_cost, l->acoustic_cost), + nextstate); + ofst->AddArc(cur_state, arc); + } + if (f == num_frames) { + if (use_final_probs && !final_costs.empty()) { + unordered_map::const_iterator iter = + final_costs.find(tok); + if (iter != final_costs.end()) + ofst->SetFinal(cur_state, LatticeWeight(iter->second, 0)); + } else { + ofst->SetFinal(cur_state, LatticeWeight::One()); + } + } + } + } + KALDI_ASSERT(cur_state == ofst->NumStates()); + return (cur_state != 0); +} + +// This function is now deprecated, since now we do determinization from outside +// the LatticeSimpleDecoder class. +// Outputs an FST corresponding to the lattice-determinized +// lattice (one path per word sequence). +bool LatticeSimpleDecoder::GetLattice( + CompactLattice *ofst, + bool use_final_probs) const { + Lattice raw_fst; + GetRawLattice(&raw_fst, use_final_probs); + Invert(&raw_fst); // make it so word labels are on the input. + if (!TopSort(&raw_fst)) // topological sort makes lattice-determinization more efficient + KALDI_WARN << "Topological sorting of state-level lattice failed " + "(probably your lexicon has empty words or your LM has epsilon cycles; this " + " is a bad idea.)"; + // (in phase where we get backward-costs). + fst::ILabelCompare ilabel_comp; + ArcSort(&raw_fst, ilabel_comp); // sort on ilabel; makes + // lattice-determinization more efficient. + + fst::DeterminizeLatticePrunedOptions lat_opts; + lat_opts.max_mem = config_.det_opts.max_mem; + + DeterminizeLatticePruned(raw_fst, config_.lattice_beam, ofst, lat_opts); + raw_fst.DeleteStates(); // Free memory-- raw_fst no longer needed. + Connect(ofst); // Remove unreachable states... there might be + // a small number of these, in some cases. + // Note: if something went wrong and the raw lattice was empty, + // we should still get to this point in the code without warnings or failures. + return (ofst->NumStates() != 0); +} + + + +// FindOrAddToken either locates a token in cur_toks_, or if necessary inserts a new, +// empty token (i.e. with no forward links) for the current frame. [note: it's +// inserted if necessary into cur_toks_ and also into the singly linked list +// of tokens active on this frame (whose head is at active_toks_[frame]). +// +// Returns the Token pointer. Sets "changed" (if non-NULL) to true +// if the token was newly created or the cost changed. +inline LatticeSimpleDecoder::Token *LatticeSimpleDecoder::FindOrAddToken( + StateId state, int32 frame, BaseFloat tot_cost, + bool emitting, bool *changed) { + KALDI_ASSERT(frame < active_toks_.size()); + Token *&toks = active_toks_[frame].toks; + + unordered_map::iterator find_iter = cur_toks_.find(state); + if (find_iter == cur_toks_.end()) { // no such token presently. + // Create one. + const BaseFloat extra_cost = 0.0; + // tokens on the currently final frame have zero extra_cost + // as any of them could end up + // on the winning path. + Token *new_tok = new Token (tot_cost, extra_cost, NULL, toks); + toks = new_tok; + num_toks_++; + cur_toks_[state] = new_tok; + if (changed) *changed = true; + return new_tok; + } else { + Token *tok = find_iter->second; // There is an existing Token for this state. + if (tok->tot_cost > tot_cost) { + tok->tot_cost = tot_cost; + if (changed) *changed = true; + } else { + if (changed) *changed = false; + } + return tok; + } +} + +// delta is the amount by which the extra_costs must +// change before it sets "extra_costs_changed" to true. If delta is larger, +// we'll tend to go back less far toward the beginning of the file. +void LatticeSimpleDecoder::PruneForwardLinks( + int32 frame, bool *extra_costs_changed, + bool *links_pruned, BaseFloat delta) { + // We have to iterate until there is no more change, because the links + // are not guaranteed to be in topological order. + + *extra_costs_changed = false; + *links_pruned = false; + KALDI_ASSERT(frame >= 0 && frame < active_toks_.size()); + if (active_toks_[frame].toks == NULL ) { // empty list; this should + // not happen. + if (!warned_) { + KALDI_WARN << "No tokens alive [doing pruning].. warning first " + "time only for each utterance\n"; + warned_ = true; + } + } + + bool changed = true; + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame].toks; tok != NULL; tok = tok->next) { + ForwardLink *link, *prev_link = NULL; + // will recompute tok_extra_cost. + BaseFloat tok_extra_cost = std::numeric_limits::infinity(); + for (link = tok->links; link != NULL; ) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) + - next_tok->tot_cost); + KALDI_ASSERT(link_extra_cost == link_extra_cost); // check for NaN + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLink *next_link = link->next; + if (prev_link != NULL) prev_link->next = next_link; + else tok->links = next_link; + delete link; + link = next_link; // advance link but leave prev_link the same. + *links_pruned = true; + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + if (link_extra_cost < -0.01) + KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) + tok_extra_cost = link_extra_cost; + prev_link = link; + link = link->next; + } + } + if (fabs(tok_extra_cost - tok->extra_cost) > delta) + changed = true; + tok->extra_cost = tok_extra_cost; // will be +infinity or <= lattice_beam_. + } + if (changed) *extra_costs_changed = true; + + // Note: it's theoretically possible that aggressive compiler + // optimizations could cause an infinite loop here for small delta and + // high-dynamic-range scores. + } +} + + +void LatticeSimpleDecoder::ComputeFinalCosts( + unordered_map *final_costs, + BaseFloat *final_relative_cost, + BaseFloat *final_best_cost) const { + KALDI_ASSERT(!decoding_finalized_); + if (final_costs != NULL) + final_costs->clear(); + + BaseFloat infinity = std::numeric_limits::infinity(); + BaseFloat best_cost = infinity, + best_cost_with_final = infinity; + + for (unordered_map::const_iterator iter = cur_toks_.begin(); + iter != cur_toks_.end(); ++iter) { + StateId state = iter->first; + Token *tok = iter->second; + BaseFloat final_cost = fst_.Final(state).Value(); + BaseFloat cost = tok->tot_cost, + cost_with_final = cost + final_cost; + best_cost = std::min(cost, best_cost); + best_cost_with_final = std::min(cost_with_final, best_cost_with_final); + if (final_costs != NULL && final_cost != infinity) + (*final_costs)[tok] = final_cost; + } + if (final_relative_cost != NULL) { + if (best_cost == infinity && best_cost_with_final == infinity) { + // Likely this will only happen if there are no tokens surviving. + // This seems the least bad way to handle it. + *final_relative_cost = infinity; + } else { + *final_relative_cost = best_cost_with_final - best_cost; + } + } + if (final_best_cost != NULL) { + if (best_cost_with_final != infinity) { // final-state exists. + *final_best_cost = best_cost_with_final; + } else { // no final-state exists. + *final_best_cost = best_cost; + } + } +} + + +// PruneForwardLinksFinal is a version of PruneForwardLinks that we call +// on the final frame. If there are final tokens active, it uses the final-probs +// for pruning, otherwise it treats all tokens as final. +void LatticeSimpleDecoder::PruneForwardLinksFinal() { + KALDI_ASSERT(!active_toks_.empty()); + int32 frame_plus_one = active_toks_.size() - 1; + + if (active_toks_[frame_plus_one].toks == NULL) // empty list; should not happen. + KALDI_WARN << "No tokens alive at end of file\n"; + + typedef unordered_map::const_iterator IterType; + ComputeFinalCosts(&final_costs_, &final_relative_cost_, &final_best_cost_); + decoding_finalized_ = true; + // We're about to delete some of the tokens active on the final frame, so we + // clear cur_toks_ because otherwise it would then contain dangling pointers. + cur_toks_.clear(); + + // Now go through tokens on this frame, pruning forward links... may have to + // iterate a few times until there is no more change, because the list is not + // in topological order. This is a modified version of the code in + // PruneForwardLinks, but here we also take account of the final-probs. + bool changed = true; + BaseFloat delta = 1.0e-05; + while (changed) { + changed = false; + for (Token *tok = active_toks_[frame_plus_one].toks; + tok != NULL; tok = tok->next) { + ForwardLink *link, *prev_link=NULL; + // will recompute tok_extra_cost. It has a term in it that corresponds + // to the "final-prob", so instead of initializing tok_extra_cost to infinity + // below we set it to the difference between the (score+final_prob) of this token, + // and the best such (score+final_prob). + + BaseFloat final_cost; + if (final_costs_.empty()) { + final_cost = 0.0; + } else { + IterType iter = final_costs_.find(tok); + if (iter != final_costs_.end()) + final_cost = iter->second; + else + final_cost = std::numeric_limits::infinity(); + } + BaseFloat tok_extra_cost = tok->tot_cost + final_cost - final_best_cost_; + // tok_extra_cost will be a "min" over either directly being final, or + // being indirectly final through other links, and the loop below may + // decrease its value: + for (link = tok->links; link != NULL; ) { + // See if we need to excise this link... + Token *next_tok = link->next_tok; + BaseFloat link_extra_cost = next_tok->extra_cost + + ((tok->tot_cost + link->acoustic_cost + link->graph_cost) + - next_tok->tot_cost); + if (link_extra_cost > config_.lattice_beam) { // excise link + ForwardLink *next_link = link->next; + if (prev_link != NULL) prev_link->next = next_link; + else tok->links = next_link; + delete link; + link = next_link; // advance link but leave prev_link the same. + } else { // keep the link and update the tok_extra_cost if needed. + if (link_extra_cost < 0.0) { // this is just a precaution. + if (link_extra_cost < -0.01) + KALDI_WARN << "Negative extra_cost: " << link_extra_cost; + link_extra_cost = 0.0; + } + if (link_extra_cost < tok_extra_cost) + tok_extra_cost = link_extra_cost; + prev_link = link; + link = link->next; + } + } + // prune away tokens worse than lattice_beam above best path. This step + // was not necessary in the non-final case because then, this case + // showed up as having no forward links. Here, the tok_extra_cost has + // an extra component relating to the final-prob. + if (tok_extra_cost > config_.lattice_beam) + tok_extra_cost = std::numeric_limits::infinity(); + // to be pruned in PruneTokensForFrame + + if (!ApproxEqual(tok->extra_cost, tok_extra_cost, delta)) + changed = true; + tok->extra_cost = tok_extra_cost; // will be +infinity or <= lattice_beam_. + } + } // while changed +} + +BaseFloat LatticeSimpleDecoder::FinalRelativeCost() const { + if (!decoding_finalized_) { + BaseFloat relative_cost; + ComputeFinalCosts(NULL, &relative_cost, NULL); + return relative_cost; + } else { + // we're not allowed to call that function if FinalizeDecoding() has + // been called; return a cached value. + return final_relative_cost_; + } +} + +// Prune away any tokens on this frame that have no forward links. [we don't do +// this in PruneForwardLinks because it would give us a problem with dangling +// pointers]. +void LatticeSimpleDecoder::PruneTokensForFrame(int32 frame) { + KALDI_ASSERT(frame >= 0 && frame < active_toks_.size()); + Token *&toks = active_toks_[frame].toks; + if (toks == NULL) + KALDI_WARN << "No tokens alive [doing pruning]"; + Token *tok, *next_tok, *prev_tok = NULL; + for (tok = toks; tok != NULL; tok = next_tok) { + next_tok = tok->next; + if (tok->extra_cost == std::numeric_limits::infinity()) { + // Next token is unreachable from end of graph; excise tok from list + // and delete tok. + if (prev_tok != NULL) prev_tok->next = tok->next; + else toks = tok->next; + delete tok; + num_toks_--; + } else { + prev_tok = tok; + } + } +} + +// Go backwards through still-alive tokens, pruning them, starting not from +// the current frame (where we want to keep all tokens) but from the frame before +// that. We go backwards through the frames and stop when we reach a point +// where the delta-costs are not changing (and the delta controls when we consider +// a cost to have "not changed"). +void LatticeSimpleDecoder::PruneActiveTokens(BaseFloat delta) { + int32 cur_frame_plus_one = NumFramesDecoded(); + int32 num_toks_begin = num_toks_; + // The index "f" below represents a "frame plus one", i.e. you'd have to subtract + // one to get the corresponding index for the decodable object. + for (int32 f = cur_frame_plus_one - 1; f >= 0; f--) { + // Reason why we need to prune forward links in this situation: + // (1) we have never pruned them + // (2) we never pruned the forward links on the next frame, which + // + if (active_toks_[f].must_prune_forward_links) { + bool extra_costs_changed = false, links_pruned = false; + PruneForwardLinks(f, &extra_costs_changed, &links_pruned, delta); + if (extra_costs_changed && f > 0) + active_toks_[f-1].must_prune_forward_links = true; + if (links_pruned) + active_toks_[f].must_prune_tokens = true; + active_toks_[f].must_prune_forward_links = false; + } + if (f+1 < cur_frame_plus_one && + active_toks_[f+1].must_prune_tokens) { + PruneTokensForFrame(f+1); + active_toks_[f+1].must_prune_tokens = false; + } + } + KALDI_VLOG(3) << "PruneActiveTokens: pruned tokens from " << num_toks_begin + << " to " << num_toks_; +} + + +// FinalizeDecoding() is a version of PruneActiveTokens that we call +// (optionally) on the final frame. Takes into account the final-prob of +// tokens. This function used to be called PruneActiveTokensFinal(). +void LatticeSimpleDecoder::FinalizeDecoding() { + int32 final_frame_plus_one = NumFramesDecoded(); + int32 num_toks_begin = num_toks_; + PruneForwardLinksFinal(); + for (int32 f = final_frame_plus_one - 1; f >= 0; f--) { + bool b1, b2; // values not used. + BaseFloat dontcare = 0.0; + PruneForwardLinks(f, &b1, &b2, dontcare); + PruneTokensForFrame(f + 1); + } + PruneTokensForFrame(0); + KALDI_VLOG(3) << "pruned tokens from " << num_toks_begin + << " to " << num_toks_; +} + +void LatticeSimpleDecoder::ProcessEmitting(DecodableInterface *decodable) { + int32 frame = active_toks_.size() - 1; // frame is the frame-index + // (zero-based) used to get likelihoods + // from the decodable object. + active_toks_.resize(active_toks_.size() + 1); + prev_toks_.clear(); + cur_toks_.swap(prev_toks_); + + // Processes emitting arcs for one frame. Propagates from + // prev_toks_ to cur_toks_. + BaseFloat cutoff = std::numeric_limits::infinity(); + for (unordered_map::iterator iter = prev_toks_.begin(); + iter != prev_toks_.end(); + ++iter) { + StateId state = iter->first; + Token *tok = iter->second; + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + BaseFloat ac_cost = -decodable->LogLikelihood(frame, arc.ilabel), + graph_cost = arc.weight.Value(), + cur_cost = tok->tot_cost, + tot_cost = cur_cost + ac_cost + graph_cost; + if (tot_cost >= cutoff) continue; + else if (tot_cost + config_.beam < cutoff) + cutoff = tot_cost + config_.beam; + // AddToken adds the next_tok to cur_toks_ (if not already present). + Token *next_tok = FindOrAddToken(arc.nextstate, frame + 1, tot_cost, + true, NULL); + + // Add ForwardLink from tok to next_tok (put on head of list tok->links) + tok->links = new ForwardLink(next_tok, arc.ilabel, arc.olabel, + graph_cost, ac_cost, tok->links); + } + } + } +} + +void LatticeSimpleDecoder::ProcessNonemitting() { + KALDI_ASSERT(!active_toks_.empty()); + int32 frame = static_cast(active_toks_.size()) - 2; + // Note: "frame" is the time-index we just processed, or -1 if + // we are processing the nonemitting transitions before the + // first frame (called from InitDecoding()). + + // Processes nonemitting arcs for one frame. Propagates within + // cur_toks_. Note-- this queue structure is is not very optimal as + // it may cause us to process states unnecessarily (e.g. more than once), + // but in the baseline code, turning this vector into a set to fix this + // problem did not improve overall speed. + std::vector queue; + BaseFloat best_cost = std::numeric_limits::infinity(); + for (unordered_map::iterator iter = cur_toks_.begin(); + iter != cur_toks_.end(); + ++iter) { + StateId state = iter->first; + if (fst_.NumInputEpsilons(state) != 0) + queue.push_back(state); + best_cost = std::min(best_cost, iter->second->tot_cost); + } + if (queue.empty()) { + if (!warned_) { + KALDI_ERR << "Error in ProcessEmitting: no surviving tokens: frame is " + << frame; + warned_ = true; + } + } + BaseFloat cutoff = best_cost + config_.beam; + + while (!queue.empty()) { + StateId state = queue.back(); + queue.pop_back(); + Token *tok = cur_toks_[state]; + // If "tok" has any existing forward links, delete them, + // because we're about to regenerate them. This is a kind + // of non-optimality (remember, this is the simple decoder), + // but since most states are emitting it's not a huge issue. + tok->DeleteForwardLinks(); + tok->links = NULL; + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel == 0) { // propagate nonemitting only... + BaseFloat graph_cost = arc.weight.Value(), + cur_cost = tok->tot_cost, + tot_cost = cur_cost + graph_cost; + if (tot_cost < cutoff) { + bool changed; + Token *new_tok = FindOrAddToken(arc.nextstate, frame + 1, tot_cost, + false, &changed); + + tok->links = new ForwardLink(new_tok, 0, arc.olabel, + graph_cost, 0, tok->links); + + // "changed" tells us whether the new token has a different + // cost from before, or is new [if so, add into queue]. + if (changed && fst_.NumInputEpsilons(arc.nextstate) != 0) + queue.push_back(arc.nextstate); + } + } + } + } +} + +void LatticeSimpleDecoder::ClearActiveTokens() { // a cleanup routine, at utt end/begin + for (size_t i = 0; i < active_toks_.size(); i++) { + // Delete all tokens alive on this frame, and any forward + // links they may have. + for (Token *tok = active_toks_[i].toks; tok != NULL; ) { + tok->DeleteForwardLinks(); + Token *next_tok = tok->next; + delete tok; + num_toks_--; + tok = next_tok; + } + } + active_toks_.clear(); + KALDI_ASSERT(num_toks_ == 0); +} + +// PruneCurrentTokens deletes the tokens from the "toks" map, but not +// from the active_toks_ list, which could cause dangling forward pointers +// (will delete it during regular pruning operation). +void LatticeSimpleDecoder::PruneCurrentTokens(BaseFloat beam, unordered_map *toks) { + if (toks->empty()) { + KALDI_VLOG(2) << "No tokens to prune.\n"; + return; + } + BaseFloat best_cost = 1.0e+10; // positive == high cost == bad. + for (unordered_map::iterator iter = toks->begin(); + iter != toks->end(); ++iter) { + best_cost = + std::min(best_cost, + static_cast(iter->second->tot_cost)); + } + std::vector retained; + BaseFloat cutoff = best_cost + beam; + for (unordered_map::iterator iter = toks->begin(); + iter != toks->end(); ++iter) { + if (iter->second->tot_cost < cutoff) + retained.push_back(iter->first); + } + unordered_map tmp; + for (size_t i = 0; i < retained.size(); i++) { + tmp[retained[i]] = (*toks)[retained[i]]; + } + KALDI_VLOG(2) << "Pruned to "<<(retained.size())<<" toks.\n"; + tmp.swap(*toks); +} + + +} // end namespace kaldi. + + diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/lattice-simple-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-simple-decoder.h new file mode 100644 index 0000000..dd8de81 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/lattice-simple-decoder.h @@ -0,0 +1,318 @@ +// decoder/lattice-simple-decoder.h + +// Copyright 2009-2012 Microsoft Corporation +// 2012-2014 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_LATTICE_SIMPLE_DECODER_H_ +#define KALDI_DECODER_LATTICE_SIMPLE_DECODER_H_ + + +#include "util/stl-utils.h" +#include "fst/fstlib.h" +#include "itf/decodable-itf.h" +#include "fstext/fstext-lib.h" +#include "lat/determinize-lattice-pruned.h" +#include "lat/kaldi-lattice.h" + +#include + +namespace kaldi { + +struct LatticeSimpleDecoderConfig { + BaseFloat beam; + BaseFloat lattice_beam; + int32 prune_interval; + bool determinize_lattice; // not inspected by this class... used in + // command-line program. + bool prune_lattice; + BaseFloat beam_ratio; + BaseFloat prune_scale; // Note: we don't make this configurable on the command line, + // it's not a very important parameter. It affects the + // algorithm that prunes the tokens as we go. + fst::DeterminizeLatticePhonePrunedOptions det_opts; + + LatticeSimpleDecoderConfig(): beam(16.0), + lattice_beam(10.0), + prune_interval(25), + determinize_lattice(true), + beam_ratio(0.9), + prune_scale(0.1) { } + void Register(OptionsItf *opts) { + det_opts.Register(opts); + opts->Register("beam", &beam, "Decoding beam."); + opts->Register("lattice-beam", &lattice_beam, "Lattice generation beam"); + opts->Register("prune-interval", &prune_interval, "Interval (in frames) at " + "which to prune tokens"); + opts->Register("determinize-lattice", &determinize_lattice, "If true, " + "determinize the lattice (in a special sense, keeping only " + "best pdf-sequence for each word-sequence)."); + } + void Check() const { + KALDI_ASSERT(beam > 0.0 && lattice_beam > 0.0 && prune_interval > 0); + } +}; + + +/** Simplest possible decoder, included largely for didactic purposes and as a + means to debug more highly optimized decoders. See \ref decoders_simple + for more information. + */ +class LatticeSimpleDecoder { + public: + typedef fst::StdArc Arc; + typedef Arc::Label Label; + typedef Arc::StateId StateId; + typedef Arc::Weight Weight; + // instantiate this class once for each thing you have to decode. + LatticeSimpleDecoder(const fst::Fst &fst, + const LatticeSimpleDecoderConfig &config): + fst_(fst), config_(config), num_toks_(0) { config.Check(); } + + ~LatticeSimpleDecoder() { ClearActiveTokens(); } + + const LatticeSimpleDecoderConfig &GetOptions() const { + return config_; + } + + // Returns true if any kind of traceback is available (not necessarily from + // a final state). + bool Decode(DecodableInterface *decodable); + + + /// says whether a final-state was active on the last frame. If it was not, the + /// lattice (or traceback) will end with states that are not final-states. + bool ReachedFinal() const { + return FinalRelativeCost() != std::numeric_limits::infinity(); + } + + /// InitDecoding initializes the decoding, and should only be used if you + /// intend to call AdvanceDecoding(). If you call Decode(), you don't need + /// to call this. You can call InitDecoding if you have already decoded an + /// utterance and want to start with a new utterance. + void InitDecoding(); + + /// This function may be optionally called after AdvanceDecoding(), when you + /// do not plan to decode any further. It does an extra pruning step that + /// will help to prune the lattices output by GetLattice and (particularly) + /// GetRawLattice more accurately, particularly toward the end of the + /// utterance. It does this by using the final-probs in pruning (if any + /// final-state survived); it also does a final pruning step that visits all + /// states (the pruning that is done during decoding may fail to prune states + /// that are within kPruningScale = 0.1 outside of the beam). If you call + /// this, you cannot call AdvanceDecoding again (it will fail), and you + /// cannot call GetLattice() and related functions with use_final_probs = + /// false. + /// Used to be called PruneActiveTokensFinal(). + void FinalizeDecoding(); + + /// FinalRelativeCost() serves the same purpose as ReachedFinal(), but gives + /// more information. It returns the difference between the best (final-cost + /// plus cost) of any token on the final frame, and the best cost of any token + /// on the final frame. If it is infinity it means no final-states were + /// present on the final frame. It will usually be nonnegative. If it not + /// too positive (e.g. < 5 is my first guess, but this is not tested) you can + /// take it as a good indication that we reached the final-state with + /// reasonable likelihood. + BaseFloat FinalRelativeCost() const; + + // Outputs an FST corresponding to the single best path + // through the lattice. Returns true if result is nonempty + // (using the return status is deprecated, it will become void). + // If "use_final_probs" is true AND we reached the final-state + // of the graph then it will include those as final-probs, else + // it will treat all final-probs as one. + bool GetBestPath(Lattice *lat, + bool use_final_probs = true) const; + + // Outputs an FST corresponding to the raw, state-level + // tracebacks. Returns true if result is nonempty + // (using the return status is deprecated, it will become void). + // If "use_final_probs" is true AND we reached the final-state + // of the graph then it will include those as final-probs, else + // it will treat all final-probs as one. + bool GetRawLattice(Lattice *lat, + bool use_final_probs = true) const; + + // This function is now deprecated, since now we do determinization from + // outside the LatticeTrackingDecoder class. + // Outputs an FST corresponding to the lattice-determinized + // lattice (one path per word sequence). [will become deprecated, + // users should determinize themselves.] + bool GetLattice(CompactLattice *clat, + bool use_final_probs = true) const; + + inline int32 NumFramesDecoded() const { return active_toks_.size() - 1; } + private: + struct Token; + // ForwardLinks are the links from a token to a token on the next frame. + // or sometimes on the current frame (for input-epsilon links). + struct ForwardLink { + Token *next_tok; // the next token [or NULL if represents final-state] + Label ilabel; // ilabel on link. + Label olabel; // olabel on link. + BaseFloat graph_cost; // graph cost of traversing link (contains LM, etc.) + BaseFloat acoustic_cost; // acoustic cost (pre-scaled) of traversing link + ForwardLink *next; // next in singly-linked list of forward links from a + // token. + ForwardLink(Token *next_tok, Label ilabel, Label olabel, + BaseFloat graph_cost, BaseFloat acoustic_cost, + ForwardLink *next): + next_tok(next_tok), ilabel(ilabel), olabel(olabel), + graph_cost(graph_cost), acoustic_cost(acoustic_cost), + next(next) { } + }; + + // Token is what's resident in a particular state at a particular time. + // In this decoder a Token actually contains *forward* links. + // When first created, a Token just has the (total) cost. We add forward + // links from it when we process the next frame. + struct Token { + BaseFloat tot_cost; // would equal weight.Value()... cost up to this point. + BaseFloat extra_cost; // >= 0. After calling PruneForwardLinks, this equals + // the minimum difference between the cost of the best path this is on, + // and the cost of the absolute best path, under the assumption + // that any of the currently active states at the decoding front may + // eventually succeed (e.g. if you were to take the currently active states + // one by one and compute this difference, and then take the minimum). + + ForwardLink *links; // Head of singly linked list of ForwardLinks + + Token *next; // Next in list of tokens for this frame. + + Token(BaseFloat tot_cost, BaseFloat extra_cost, ForwardLink *links, + Token *next): tot_cost(tot_cost), extra_cost(extra_cost), links(links), + next(next) { } + Token() {} + void DeleteForwardLinks() { + ForwardLink *l = links, *m; + while (l != NULL) { + m = l->next; + delete l; + l = m; + } + links = NULL; + } + }; + + // head and tail of per-frame list of Tokens (list is in topological order), + // and something saying whether we ever pruned it using PruneForwardLinks. + struct TokenList { + Token *toks; + bool must_prune_forward_links; + bool must_prune_tokens; + TokenList(): toks(NULL), must_prune_forward_links(true), + must_prune_tokens(true) { } + }; + + + // FindOrAddToken either locates a token in cur_toks_, or if necessary inserts a new, + // empty token (i.e. with no forward links) for the current frame. [note: it's + // inserted if necessary into cur_toks_ and also into the singly linked list + // of tokens active on this frame (whose head is at active_toks_[frame]). + // + // Returns the Token pointer. Sets "changed" (if non-NULL) to true + // if the token was newly created or the cost changed. + inline Token *FindOrAddToken(StateId state, int32 frame_plus_one, + BaseFloat tot_cost, bool emitting, bool *changed); + + // delta is the amount by which the extra_costs must + // change before it sets "extra_costs_changed" to true. If delta is larger, + // we'll tend to go back less far toward the beginning of the file. + void PruneForwardLinks(int32 frame, bool *extra_costs_changed, + bool *links_pruned, + BaseFloat delta); + + // PruneForwardLinksFinal is a version of PruneForwardLinks that we call + // on the final frame. If there are final tokens active, it uses the final-probs + // for pruning, otherwise it treats all tokens as final. + void PruneForwardLinksFinal(); + + // Prune away any tokens on this frame that have no forward links. [we don't do + // this in PruneForwardLinks because it would give us a problem with dangling + // pointers]. + void PruneTokensForFrame(int32 frame); + + // Go backwards through still-alive tokens, pruning them if the + // forward+backward cost is more than lat_beam away from the best path. It's + // possible to prove that this is "correct" in the sense that we won't lose + // anything outside of lat_beam, regardless of what happens in the future. + // delta controls when it considers a cost to have changed enough to continue + // going backward and propagating the change. larger delta -> will recurse + // less far. + void PruneActiveTokens(BaseFloat delta); + + void ProcessEmitting(DecodableInterface *decodable); + + void ProcessNonemitting(); + + void ClearActiveTokens(); // a cleanup routine, at utt end/begin + + // This function computes the final-costs for tokens active on the final + // frame. It outputs to final-costs, if non-NULL, a map from the Token* + // pointer to the final-prob of the corresponding state, or zero for all states if + // none were final. It outputs to final_relative_cost, if non-NULL, the + // difference between the best forward-cost including the final-prob cost, and + // the best forward-cost without including the final-prob cost (this will + // usually be positive), or infinity if there were no final-probs. It outputs + // to final_best_cost, if non-NULL, the lowest for any token t active on the + // final frame, of t + final-cost[t], where final-cost[t] is the final-cost + // in the graph of the state corresponding to token t, or zero if there + // were no final-probs active on the final frame. + // You cannot call this after FinalizeDecoding() has been called; in that + // case you should get the answer from class-member variables. + void ComputeFinalCosts(unordered_map *final_costs, + BaseFloat *final_relative_cost, + BaseFloat *final_best_cost) const; + + + // PruneCurrentTokens deletes the tokens from the "toks" map, but not + // from the active_toks_ list, which could cause dangling forward pointers + // (will delete it during regular pruning operation). + void PruneCurrentTokens(BaseFloat beam, unordered_map *toks); + + unordered_map cur_toks_; + unordered_map prev_toks_; + std::vector active_toks_; // Lists of tokens, indexed by + // frame_plus_one + const fst::Fst &fst_; + LatticeSimpleDecoderConfig config_; + int32 num_toks_; // current total #toks allocated... + bool warned_; + + + /// decoding_finalized_ is true if someone called FinalizeDecoding(). [note, + /// calling this is optional]. If true, it's forbidden to decode more. Also, + /// if this is set, then the output of ComputeFinalCosts() is in the next + /// three variables. The reason we need to do this is that after + /// FinalizeDecoding() calls PruneTokensForFrame() for the final frame, some + /// of the tokens on the last frame are freed, so we free the list from + /// cur_toks_ to avoid having dangling pointers hanging around. + bool decoding_finalized_; + /// For the meaning of the next 3 variables, see the comment for + /// decoding_finalized_ above., and ComputeFinalCosts(). + unordered_map final_costs_; + BaseFloat final_relative_cost_; + BaseFloat final_best_cost_; +}; + + +} // end namespace kaldi. + + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/simple-decoder.cc b/runtime/onnxruntime/third_party/kaldi/decoder/simple-decoder.cc new file mode 100644 index 0000000..f6d799a --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/simple-decoder.cc @@ -0,0 +1,293 @@ +// decoder/simple-decoder.cc + +// Copyright 2009-2011 Microsoft Corporation +// 2012-2013 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "decoder/simple-decoder.h" +#include "fstext/remove-eps-local.h" +#include + +namespace kaldi { + +SimpleDecoder::~SimpleDecoder() { + ClearToks(cur_toks_); + ClearToks(prev_toks_); +} + + +bool SimpleDecoder::Decode(DecodableInterface *decodable) { + InitDecoding(); + AdvanceDecoding(decodable); + return (!cur_toks_.empty()); +} + +void SimpleDecoder::InitDecoding() { + // clean up from last time: + ClearToks(cur_toks_); + ClearToks(prev_toks_); + // initialize decoding: + StateId start_state = fst_.Start(); + KALDI_ASSERT(start_state != fst::kNoStateId); + StdArc dummy_arc(0, 0, StdWeight::One(), start_state); + cur_toks_[start_state] = new Token(dummy_arc, 0.0, NULL); + num_frames_decoded_ = 0; + ProcessNonemitting(); +} + +void SimpleDecoder::AdvanceDecoding(DecodableInterface *decodable, + int32 max_num_frames) { + KALDI_ASSERT(num_frames_decoded_ >= 0 && + "You must call InitDecoding() before AdvanceDecoding()"); + int32 num_frames_ready = decodable->NumFramesReady(); + // num_frames_ready must be >= num_frames_decoded, or else + // the number of frames ready must have decreased (which doesn't + // make sense) or the decodable object changed between calls + // (which isn't allowed). + KALDI_ASSERT(num_frames_ready >= num_frames_decoded_); + int32 target_frames_decoded = num_frames_ready; + if (max_num_frames >= 0) + target_frames_decoded = std::min(target_frames_decoded, + num_frames_decoded_ + max_num_frames); + while (num_frames_decoded_ < target_frames_decoded) { + // note: ProcessEmitting() increments num_frames_decoded_ + ClearToks(prev_toks_); + cur_toks_.swap(prev_toks_); + ProcessEmitting(decodable); + ProcessNonemitting(); + PruneToks(beam_, &cur_toks_); + } +} + +bool SimpleDecoder::ReachedFinal() const { + for (unordered_map::const_iterator iter = cur_toks_.begin(); + iter != cur_toks_.end(); + ++iter) { + if (iter->second->cost_ != std::numeric_limits::infinity() && + fst_.Final(iter->first) != StdWeight::Zero()) + return true; + } + return false; +} + +BaseFloat SimpleDecoder::FinalRelativeCost() const { + // as a special case, if there are no active tokens at all (e.g. some kind of + // pruning failure), return infinity. + double infinity = std::numeric_limits::infinity(); + if (cur_toks_.empty()) + return infinity; + double best_cost = infinity, + best_cost_with_final = infinity; + for (unordered_map::const_iterator iter = cur_toks_.begin(); + iter != cur_toks_.end(); + ++iter) { + // Note: Plus is taking the minimum cost, since we're in the tropical + // semiring. + best_cost = std::min(best_cost, iter->second->cost_); + best_cost_with_final = std::min(best_cost_with_final, + iter->second->cost_ + + fst_.Final(iter->first).Value()); + } + BaseFloat extra_cost = best_cost_with_final - best_cost; + if (extra_cost != extra_cost) { // NaN. This shouldn't happen; it indicates some + // kind of error, most likely. + KALDI_WARN << "Found NaN (likely search failure in decoding)"; + return infinity; + } + // Note: extra_cost will be infinity if no states were final. + return extra_cost; +} + +// Outputs an FST corresponding to the single best path +// through the lattice. +bool SimpleDecoder::GetBestPath(Lattice *fst_out, bool use_final_probs) const { + fst_out->DeleteStates(); + Token *best_tok = NULL; + bool is_final = ReachedFinal(); + if (!is_final) { + for (unordered_map::const_iterator iter = cur_toks_.begin(); + iter != cur_toks_.end(); + ++iter) + if (best_tok == NULL || *best_tok < *(iter->second) ) + best_tok = iter->second; + } else { + double infinity =std::numeric_limits::infinity(), + best_cost = infinity; + for (unordered_map::const_iterator iter = cur_toks_.begin(); + iter != cur_toks_.end(); + ++iter) { + double this_cost = iter->second->cost_ + fst_.Final(iter->first).Value(); + if (this_cost != infinity && this_cost < best_cost) { + best_cost = this_cost; + best_tok = iter->second; + } + } + } + if (best_tok == NULL) return false; // No output. + + std::vector arcs_reverse; // arcs in reverse order. + for (Token *tok = best_tok; tok != NULL; tok = tok->prev_) + arcs_reverse.push_back(tok->arc_); + KALDI_ASSERT(arcs_reverse.back().nextstate == fst_.Start()); + arcs_reverse.pop_back(); // that was a "fake" token... gives no info. + + StateId cur_state = fst_out->AddState(); + fst_out->SetStart(cur_state); + for (ssize_t i = static_cast(arcs_reverse.size())-1; i >= 0; i--) { + LatticeArc arc = arcs_reverse[i]; + arc.nextstate = fst_out->AddState(); + fst_out->AddArc(cur_state, arc); + cur_state = arc.nextstate; + } + if (is_final && use_final_probs) + fst_out->SetFinal(cur_state, + LatticeWeight(fst_.Final(best_tok->arc_.nextstate).Value(), + 0.0)); + else + fst_out->SetFinal(cur_state, LatticeWeight::One()); + fst::RemoveEpsLocal(fst_out); + return true; +} + + +void SimpleDecoder::ProcessEmitting(DecodableInterface *decodable) { + int32 frame = num_frames_decoded_; + // Processes emitting arcs for one frame. Propagates from + // prev_toks_ to cur_toks_. + double cutoff = std::numeric_limits::infinity(); + for (unordered_map::iterator iter = prev_toks_.begin(); + iter != prev_toks_.end(); + ++iter) { + StateId state = iter->first; + Token *tok = iter->second; + KALDI_ASSERT(state == tok->arc_.nextstate); + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const StdArc &arc = aiter.Value(); + if (arc.ilabel != 0) { // propagate.. + BaseFloat acoustic_cost = -decodable->LogLikelihood(frame, arc.ilabel); + double total_cost = tok->cost_ + arc.weight.Value() + acoustic_cost; + + if (total_cost >= cutoff) continue; + if (total_cost + beam_ < cutoff) + cutoff = total_cost + beam_; + Token *new_tok = new Token(arc, acoustic_cost, tok); + unordered_map::iterator find_iter + = cur_toks_.find(arc.nextstate); + if (find_iter == cur_toks_.end()) { + cur_toks_[arc.nextstate] = new_tok; + } else { + if ( *(find_iter->second) < *new_tok ) { + Token::TokenDelete(find_iter->second); + find_iter->second = new_tok; + } else { + Token::TokenDelete(new_tok); + } + } + } + } + } + num_frames_decoded_++; +} + +void SimpleDecoder::ProcessNonemitting() { + // Processes nonemitting arcs for one frame. Propagates within + // cur_toks_. + std::vector queue; + double infinity = std::numeric_limits::infinity(); + double best_cost = infinity; + for (unordered_map::iterator iter = cur_toks_.begin(); + iter != cur_toks_.end(); + ++iter) { + queue.push_back(iter->first); + best_cost = std::min(best_cost, iter->second->cost_); + } + double cutoff = best_cost + beam_; + + while (!queue.empty()) { + StateId state = queue.back(); + queue.pop_back(); + Token *tok = cur_toks_[state]; + KALDI_ASSERT(tok != NULL && state == tok->arc_.nextstate); + for (fst::ArcIterator > aiter(fst_, state); + !aiter.Done(); + aiter.Next()) { + const StdArc &arc = aiter.Value(); + if (arc.ilabel == 0) { // propagate nonemitting only... + const BaseFloat acoustic_cost = 0.0; + Token *new_tok = new Token(arc, acoustic_cost, tok); + if (new_tok->cost_ > cutoff) { + Token::TokenDelete(new_tok); + } else { + unordered_map::iterator find_iter + = cur_toks_.find(arc.nextstate); + if (find_iter == cur_toks_.end()) { + cur_toks_[arc.nextstate] = new_tok; + queue.push_back(arc.nextstate); + } else { + if ( *(find_iter->second) < *new_tok ) { + Token::TokenDelete(find_iter->second); + find_iter->second = new_tok; + queue.push_back(arc.nextstate); + } else { + Token::TokenDelete(new_tok); + } + } + } + } + } + } +} + +// static +void SimpleDecoder::ClearToks(unordered_map &toks) { + for (unordered_map::iterator iter = toks.begin(); + iter != toks.end(); ++iter) { + Token::TokenDelete(iter->second); + } + toks.clear(); +} + +// static +void SimpleDecoder::PruneToks(BaseFloat beam, unordered_map *toks) { + if (toks->empty()) { + KALDI_VLOG(2) << "No tokens to prune.\n"; + return; + } + double best_cost = std::numeric_limits::infinity(); + for (unordered_map::iterator iter = toks->begin(); + iter != toks->end(); ++iter) + best_cost = std::min(best_cost, iter->second->cost_); + std::vector retained; + double cutoff = best_cost + beam; + for (unordered_map::iterator iter = toks->begin(); + iter != toks->end(); ++iter) { + if (iter->second->cost_ < cutoff) + retained.push_back(iter->first); + else + Token::TokenDelete(iter->second); + } + unordered_map tmp; + for (size_t i = 0; i < retained.size(); i++) { + tmp[retained[i]] = (*toks)[retained[i]]; + } + KALDI_VLOG(2) << "Pruned to " << (retained.size()) << " toks.\n"; + tmp.swap(*toks); +} + +} // end namespace kaldi. diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/simple-decoder.h b/runtime/onnxruntime/third_party/kaldi/decoder/simple-decoder.h new file mode 100644 index 0000000..cd3a690 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/simple-decoder.h @@ -0,0 +1,156 @@ +// decoder/simple-decoder.h + +// Copyright 2009-2013 Microsoft Corporation; Lukas Burget; +// Saarland University (author: Arnab Ghoshal); +// Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_DECODER_SIMPLE_DECODER_H_ +#define KALDI_DECODER_SIMPLE_DECODER_H_ + + +#include "util/stl-utils.h" +#include "fst/fstlib.h" +#include "lat/kaldi-lattice.h" +#include "itf/decodable-itf.h" + +namespace kaldi { + +/** Simplest possible decoder, included largely for didactic purposes and as a + means to debug more highly optimized decoders. See \ref decoders_simple + for more information. + */ +class SimpleDecoder { + public: + typedef fst::StdArc StdArc; + typedef StdArc::Weight StdWeight; + typedef StdArc::Label Label; + typedef StdArc::StateId StateId; + + SimpleDecoder(const fst::Fst &fst, BaseFloat beam): fst_(fst), beam_(beam) { } + + ~SimpleDecoder(); + + /// Decode this utterance. + /// Returns true if any tokens reached the end of the file (regardless of + /// whether they are in a final state); query ReachedFinal() after Decode() + /// to see whether we reached a final state. + bool Decode(DecodableInterface *decodable); + + bool ReachedFinal() const; + + // GetBestPath gets the decoding traceback. If "use_final_probs" is true + // AND we reached a final state, it limits itself to final states; + // otherwise it gets the most likely token not taking into account final-probs. + // fst_out will be empty (Start() == kNoStateId) if nothing was available due to + // search error. + // If Decode() returned true, it is safe to assume GetBestPath will return true. + // It returns true if the output lattice was nonempty (i.e. had states in it); + // using the return value is deprecated. + bool GetBestPath(Lattice *fst_out, bool use_final_probs = true) const; + + /// *** The next functions are from the "new interface". *** + + /// FinalRelativeCost() serves the same function as ReachedFinal(), but gives + /// more information. It returns the difference between the best (final-cost plus + /// cost) of any token on the final frame, and the best cost of any token + /// on the final frame. If it is infinity it means no final-states were present + /// on the final frame. It will usually be nonnegative. + BaseFloat FinalRelativeCost() const; + + /// InitDecoding initializes the decoding, and should only be used if you + /// intend to call AdvanceDecoding(). If you call Decode(), you don't need + /// to call this. You can call InitDecoding if you have already decoded an + /// utterance and want to start with a new utterance. + void InitDecoding(); + + /// This will decode until there are no more frames ready in the decodable + /// object, but if max_num_frames is >= 0 it will decode no more than + /// that many frames. If it returns false, then no tokens are alive, + /// which is a kind of error state. + void AdvanceDecoding(DecodableInterface *decodable, + int32 max_num_frames = -1); + + /// Returns the number of frames already decoded. + int32 NumFramesDecoded() const { return num_frames_decoded_; } + + private: + + class Token { + public: + LatticeArc arc_; // We use LatticeArc so that we can separately + // store the acoustic and graph cost, in case + // we need to produce lattice-formatted output. + Token *prev_; + int32 ref_count_; + double cost_; // accumulated total cost up to this point. + Token(const StdArc &arc, + BaseFloat acoustic_cost, + Token *prev): prev_(prev), ref_count_(1) { + arc_.ilabel = arc.ilabel; + arc_.olabel = arc.olabel; + arc_.weight = LatticeWeight(arc.weight.Value(), acoustic_cost); + arc_.nextstate = arc.nextstate; + if (prev) { + prev->ref_count_++; + cost_ = prev->cost_ + (arc.weight.Value() + acoustic_cost); + } else { + cost_ = arc.weight.Value() + acoustic_cost; + } + } + bool operator < (const Token &other) { + return cost_ > other.cost_; + } + + static void TokenDelete(Token *tok) { + while (--tok->ref_count_ == 0) { + Token *prev = tok->prev_; + delete tok; + if (prev == NULL) return; + else tok = prev; + } +#ifdef KALDI_PARANOID + KALDI_ASSERT(tok->ref_count_ > 0); +#endif + } + }; + + // ProcessEmitting decodes the frame num_frames_decoded_ of the + // decodable object, then increments num_frames_decoded_. + void ProcessEmitting(DecodableInterface *decodable); + + void ProcessNonemitting(); + + unordered_map cur_toks_; + unordered_map prev_toks_; + const fst::Fst &fst_; + BaseFloat beam_; + // Keep track of the number of frames decoded in the current file. + int32 num_frames_decoded_; + + static void ClearToks(unordered_map &toks); + + static void PruneToks(BaseFloat beam, unordered_map *toks); + + KALDI_DISALLOW_COPY_AND_ASSIGN(SimpleDecoder); +}; + + +} // end namespace kaldi. + + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/training-graph-compiler.cc b/runtime/onnxruntime/third_party/kaldi/decoder/training-graph-compiler.cc new file mode 100644 index 0000000..f610ce5 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/training-graph-compiler.cc @@ -0,0 +1,182 @@ +// decoder/training-graph-compiler.cc + +// Copyright 2009-2011 Microsoft Corporation +// 2018 Johns Hopkins University (author: Daniel Povey) +// 2021 Xiaomi Corporation (Author: Junbo Zhang) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. +#include "decoder/training-graph-compiler.h" +#include "hmm/hmm-utils.h" // for GetHTransducer + +namespace kaldi { + + +TrainingGraphCompiler::TrainingGraphCompiler(const TransitionModel &trans_model, + const ContextDependency &ctx_dep, // Does not maintain reference to this. + fst::VectorFst *lex_fst, + const std::vector &disambig_syms, + const TrainingGraphCompilerOptions &opts): + trans_model_(trans_model), ctx_dep_(ctx_dep), lex_fst_(lex_fst), + disambig_syms_(disambig_syms), opts_(opts) { + using namespace fst; + const std::vector &phone_syms = trans_model_.GetPhones(); // needed to create context fst. + + KALDI_ASSERT(!phone_syms.empty()); + KALDI_ASSERT(IsSortedAndUniq(phone_syms)); + SortAndUniq(&disambig_syms_); + for (int32 i = 0; i < disambig_syms_.size(); i++) + if (std::binary_search(phone_syms.begin(), phone_syms.end(), + disambig_syms_[i])) + KALDI_ERR << "Disambiguation symbol " << disambig_syms_[i] + << " is also a phone."; + + subsequential_symbol_ = 1 + phone_syms.back(); + if (!disambig_syms_.empty() && subsequential_symbol_ <= disambig_syms_.back()) + subsequential_symbol_ = 1 + disambig_syms_.back(); + + if (lex_fst == NULL) return; + + { + int32 N = ctx_dep.ContextWidth(), + P = ctx_dep.CentralPosition(); + if (P != N-1) + AddSubsequentialLoop(subsequential_symbol_, lex_fst_); // This is needed for + // systems with right-context or we will not successfully compose + // with C. + } + + { // make sure lexicon is olabel sorted. + fst::OLabelCompare olabel_comp; + fst::ArcSort(lex_fst_, olabel_comp); + } +} + +bool TrainingGraphCompiler::CompileGraphFromText( + const std::vector &transcript, + fst::VectorFst *out_fst) { + using namespace fst; + VectorFst word_fst; + MakeLinearAcceptor(transcript, &word_fst); + return CompileGraph(word_fst, out_fst); +} + +bool TrainingGraphCompiler::CompileGraphFromLG(const fst::VectorFst &phone2word_fst, + fst::VectorFst *out_fst) { + using namespace fst; + + KALDI_ASSERT(phone2word_fst.Start() != kNoStateId); + + const std::vector &phone_syms = trans_model_.GetPhones(); // needed to create context fst. + + // inv_cfst will be expanded on the fly, as needed. + InverseContextFst inv_cfst(subsequential_symbol_, + phone_syms, + disambig_syms_, + ctx_dep_.ContextWidth(), + ctx_dep_.CentralPosition()); + + + VectorFst ctx2word_fst; + ComposeDeterministicOnDemandInverse(phone2word_fst, &inv_cfst, &ctx2word_fst); + // now ctx2word_fst is C * LG, assuming phone2word_fst is written as LG. + KALDI_ASSERT(ctx2word_fst.Start() != kNoStateId); + + HTransducerConfig h_cfg; + h_cfg.transition_scale = opts_.transition_scale; + + std::vector disambig_syms_h; // disambiguation symbols on + // input side of H. + VectorFst *H = GetHTransducer(inv_cfst.IlabelInfo(), + ctx_dep_, + trans_model_, + h_cfg, + &disambig_syms_h); + + VectorFst &trans2word_fst = *out_fst; // transition-id to word. + TableCompose(*H, ctx2word_fst, &trans2word_fst); + + KALDI_ASSERT(trans2word_fst.Start() != kNoStateId); + + // Epsilon-removal and determinization combined. This will fail if not determinizable. + DeterminizeStarInLog(&trans2word_fst); + + if (!disambig_syms_h.empty()) { + RemoveSomeInputSymbols(disambig_syms_h, &trans2word_fst); + // we elect not to remove epsilons after this phase, as it is + // a little slow. + if (opts_.rm_eps) + RemoveEpsLocal(&trans2word_fst); + } + + + // Encoded minimization. + MinimizeEncoded(&trans2word_fst); + + std::vector disambig; + bool check_no_self_loops = true; + AddSelfLoops(trans_model_, + disambig, + opts_.self_loop_scale, + opts_.reorder, + check_no_self_loops, + &trans2word_fst); + + delete H; + return true; +} + +bool TrainingGraphCompiler::CompileGraph(const fst::VectorFst &word_fst, + fst::VectorFst *out_fst) { + using namespace fst; + KALDI_ASSERT(lex_fst_ !=NULL); + KALDI_ASSERT(out_fst != NULL); + + VectorFst phone2word_fst; + // TableCompose more efficient than compose. + TableCompose(*lex_fst_, word_fst, &phone2word_fst, &lex_cache_); + return CompileGraphFromLG(phone2word_fst, out_fst); +} + +bool TrainingGraphCompiler::CompileGraphsFromText( + const std::vector > &transcripts, + std::vector*> *out_fsts) { + using namespace fst; + std::vector* > word_fsts(transcripts.size()); + for (size_t i = 0; i < transcripts.size(); i++) { + VectorFst *word_fst = new VectorFst(); + MakeLinearAcceptor(transcripts[i], word_fst); + word_fsts[i] = word_fst; + } + bool ans = CompileGraphs(word_fsts, out_fsts); + for (size_t i = 0; i < transcripts.size(); i++) + delete word_fsts[i]; + return ans; +} + +bool TrainingGraphCompiler::CompileGraphs( + const std::vector* > &word_fsts, + std::vector* > *out_fsts) { + out_fsts->resize(word_fsts.size(), NULL); + for (size_t i = 0; i < word_fsts.size(); i++) { + fst::VectorFst trans2word_fst; + if (!CompileGraph(*(word_fsts[i]), &trans2word_fst)) return false; + (*out_fsts)[i] = trans2word_fst.Copy(); + } + return true; +} + + +} // end namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/decoder/training-graph-compiler.h b/runtime/onnxruntime/third_party/kaldi/decoder/training-graph-compiler.h new file mode 100644 index 0000000..f6128d8 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/decoder/training-graph-compiler.h @@ -0,0 +1,117 @@ +// decoder/training-graph-compiler.h + +// Copyright 2009-2011 Microsoft Corporation +// 2018 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. +#ifndef KALDI_DECODER_TRAINING_GRAPH_COMPILER_H_ +#define KALDI_DECODER_TRAINING_GRAPH_COMPILER_H_ + +#include "base/kaldi-common.h" +#include "hmm/transition-model.h" +#include "fst/fstlib.h" +#include "fstext/fstext-lib.h" +#include "tree/context-dep.h" + + +namespace kaldi { + +struct TrainingGraphCompilerOptions { + + BaseFloat transition_scale; + BaseFloat self_loop_scale; + bool rm_eps; + bool reorder; // (Dan-style graphs) + + explicit TrainingGraphCompilerOptions(BaseFloat transition_scale = 1.0, + BaseFloat self_loop_scale = 1.0, + bool b = true) : + transition_scale(transition_scale), + self_loop_scale(self_loop_scale), + rm_eps(false), + reorder(b) { } + + void Register(OptionsItf *opts) { + opts->Register("transition-scale", &transition_scale, "Scale of transition " + "probabilities (excluding self-loops)"); + opts->Register("self-loop-scale", &self_loop_scale, "Scale of self-loop vs. " + "non-self-loop probability mass "); + opts->Register("reorder", &reorder, "Reorder transition ids for greater decoding efficiency."); + opts->Register("rm-eps", &rm_eps, "Remove [most] epsilons before minimization (only applicable " + "if disambig symbols present)"); + } +}; + + +class TrainingGraphCompiler { + public: + TrainingGraphCompiler(const TransitionModel &trans_model, // Maintains reference to this object. + const ContextDependency &ctx_dep, // And this. + fst::VectorFst *lex_fst, // Takes ownership of this object. + // It should not contain disambiguation symbols or subsequential symbol, + // but it should contain optional silence. + const std::vector &disambig_syms, // disambig symbols in phone symbol table. + const TrainingGraphCompilerOptions &opts); + + + // CompileGraph compiles a single training graph its input is a + // weighted acceptor (G) at the word level, its output is HCLG. + // Note: G could actually be a transducer, it would also work. + // This function is not const for technical reasons involving the cache. + // if not for "table_compose" we could make it const. + bool CompileGraph(const fst::VectorFst &word_grammar, + fst::VectorFst *out_fst); + + // Same as `CompileGraph`, but uses an external LG fst. + bool CompileGraphFromLG(const fst::VectorFst &phone2word_fst, + fst::VectorFst * out_fst); + + // CompileGraphs allows you to compile a number of graphs at the same + // time. This consumes more memory but is faster. + bool CompileGraphs( + const std::vector *> &word_fsts, + std::vector *> *out_fsts); + + // This version creates an FST from the text and calls CompileGraph. + bool CompileGraphFromText(const std::vector &transcript, + fst::VectorFst *out_fst); + + // This function creates FSTs from the text and calls CompileGraphs. + bool CompileGraphsFromText( + const std::vector > &word_grammar, + std::vector *> *out_fsts); + + + ~TrainingGraphCompiler() { delete lex_fst_; } + private: + const TransitionModel &trans_model_; + const ContextDependency &ctx_dep_; + fst::VectorFst *lex_fst_; // lexicon FST (an input; we take + // ownership as we need to modify it). + std::vector disambig_syms_; // disambig symbols (if any) in the phone + int32 subsequential_symbol_; // search in ../fstext/context-fst.h for more info. + // symbol table. + fst::TableComposeCache > lex_cache_; // stores matcher.. + // this is one of Dan's extensions. + + TrainingGraphCompilerOptions opts_; +}; + + + +} // end namespace kaldi. + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/Makefile b/runtime/onnxruntime/third_party/kaldi/fstbin/Makefile new file mode 100644 index 0000000..a22c014 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/Makefile @@ -0,0 +1,31 @@ + +# make "all" the target. +all: + +# Disable linking math libs because not needed here. Just for compilation speed. +# no, it's now needed for context-fst-test. +# MATHLIB = NONE + +EXTRA_CXXFLAGS = -Wno-sign-compare + +include ../kaldi.mk + +BINFILES = fstdeterminizestar \ + fstrmsymbols fstisstochastic fstminimizeencoded fstmakecontextfst \ + fstmakecontextsyms fstaddsubsequentialloop fstaddselfloops \ + fstrmepslocal fstcomposecontext fsttablecompose fstrand \ + fstdeterminizelog fstphicompose fstcopy \ + fstpushspecial fsts-to-transcripts fsts-project fsts-union \ + fsts-concat make-grammar-fst + +OBJFILES = + +TESTFILES = + +# actually, this library is currently empty. Everything is a header. +LIBFILE = + +ADDLIBS = ../decoder/kaldi-decoder.a ../fstext/kaldi-fstext.a \ + ../util/kaldi-util.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a + +include ../makefiles/default_rules.mk diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstaddselfloops.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstaddselfloops.cc new file mode 100644 index 0000000..a84b316 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstaddselfloops.cc @@ -0,0 +1,93 @@ +// fstbin/fstaddselfloops.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "fst/fstlib.h" +#include "fstext/determinize-star.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" +#include "util/parse-options.h" +#include "util/simple-io-funcs.h" +/* some test examples: + pushd ~/tmpdir + ( echo 3; echo 4) > in.list + ( echo 5; echo 6) > out.list + ( echo "0 0 0 0"; echo "0 0" ) | fstcompile | fstaddselfloops in.list out.list | fstprint + ( echo "0 1 0 1"; echo " 0 2 1 0"; echo "1 0"; echo "2 0"; ) | fstcompile | fstaddselfloops in.list out.list | fstprint +*/ + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Adds self-loops to states of an FST to propagate disambiguation symbols through it\n" + "They are added on each final state and each state with non-epsilon output symbols\n" + "on at least one arc out of the state. Useful in conjunction with predeterminize\n" + "\n" + "Usage: fstaddselfloops in-disambig-list out-disambig-list [in.fst [out.fst] ]\n" + "E.g: fstaddselfloops in.list out.list < in.fst > withloops.fst\n" + "in.list and out.list are lists of integers, one per line, of the\n" + "same length.\n"; + + ParseOptions po(usage); + po.Read(argc, argv); + + if (po.NumArgs() < 2 || po.NumArgs() > 4) { + po.PrintUsage(); + exit(1); + } + + std::string disambig_in_rxfilename = po.GetArg(1), + disambig_out_rxfilename = po.GetArg(2), + fst_in_filename = po.GetOptArg(3), + fst_out_filename = po.GetOptArg(4); + + VectorFst *fst = ReadFstKaldi(fst_in_filename); + + std::vector disambig_in; + if (!ReadIntegerVectorSimple(disambig_in_rxfilename, &disambig_in)) + KALDI_ERR << "fstaddselfloops: Could not read disambiguation symbols from " + << kaldi::PrintableRxfilename(disambig_in_rxfilename); + + std::vector disambig_out; + if (!ReadIntegerVectorSimple(disambig_out_rxfilename, &disambig_out)) + KALDI_ERR << "fstaddselfloops: Could not read disambiguation symbols from " + << kaldi::PrintableRxfilename(disambig_out_rxfilename); + + if (disambig_in.size() != disambig_out.size()) + KALDI_ERR << "fstaddselfloops: mismatch in size of disambiguation symbols"; + + AddSelfLoops(fst, disambig_in, disambig_out); + + WriteFstKaldi(*fst, fst_out_filename); + + delete fst; + + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } + return 0; +} + diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstaddsubsequentialloop.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstaddsubsequentialloop.cc new file mode 100644 index 0000000..7f81334 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstaddsubsequentialloop.cc @@ -0,0 +1,85 @@ +// fstbin/fstaddsubsequentialloop.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/kaldi-io.h" +#include "util/parse-options.h" +#include "util/text-utils.h" +#include "fst/fstlib.h" +#include "fstext/fstext-utils.h" +#include "fstext/context-fst.h" +#include "fstext/kaldi-fst-io.h" + + + +/* some test examples: + ( echo "0 0 0 0"; echo "0 0" ) | fstcompile | fstaddsubsequentialloop 1 | fstprint + ( echo "0 1 0 0"; echo " 0 2 0 0"; echo "1 0"; echo "2 0"; ) | fstcompile | fstaddsubsequentialloop 1 | fstprint +*/ + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Minimizes FST after encoding [this algorithm applicable to all FSTs in tropical semiring]\n" + "\n" + "Usage: fstaddsubsequentialloop subseq_sym [in.fst [out.fst] ]\n" + "E.g.: fstaddsubsequentialloop 52 < LG.fst > LG_sub.fst\n"; + + float delta = kDelta; + ParseOptions po(usage); + po.Register("delta", &delta, + "Delta likelihood used for quantization of weights"); + po.Read(argc, argv); + + if (po.NumArgs() < 1 || po.NumArgs() > 3) { + po.PrintUsage(); + exit(1); + } + + int32 subseq_sym; + if (!ConvertStringToInteger(po.GetArg(1), &subseq_sym)) + KALDI_ERR << "Invalid subsequential symbol "< *fst = ReadFstKaldi(fst_in_filename); + + int32 h = HighestNumberedInputSymbol(*fst); + if (subseq_sym <= h) { + std::cerr << "fstaddsubsequentialloop.cc: subseq symbol does not seem right, "< tmp.fst + ( echo " 0"; echo "a 1"; echo "b 2"; echo "c 3" ) > phones.txt + fstmakecontextsyms phones.txt ilabels.sym > context.txt + fstprint --isymbols=context.txt --osymbols=phones.txt tmp.fst + # and the result is: + +WARNING (fstcomposecontext[5.4]:main():fstcomposecontext.cc:130) Disambiguation symbols list is empty; this likely indicates an error in data preparation. +0 1 a +1 2 /a/b b +2 3 a/b/c c +3 4 b/c/ +4 + + + # (2) with disambig syms: + ( echo 4; echo 5) > disambig.list + ( echo " 0"; echo "a 1"; echo "b 2"; echo "c 3"; echo "#0 4"; echo "#1 5") > phones.txt + ( echo "0 1 1 1"; echo "1 2 2 2"; echo " 2 3 4 4"; echo "3 4 3 3"; echo "4 5 5 5"; echo "5 0" ) | fstcompile > in.fst + fstcomposecontext --read-disambig-syms=disambig.list ilabels.sym in.fst tmp.fst + fstmakecontextsyms phones.txt ilabels.sym > context.txt + cp phones.txt phones_disambig.txt; ( echo "#0 4"; echo "#1 5" ) >> phones_disambig.txt + fstprint --isymbols=context.txt --osymbols=phones_disambig.txt tmp.fst + +0 1 #-1 a +1 2 /a/b b +2 3 #0 #0 +3 4 a/b/c c +4 5 #1 #1 +5 6 b/c/ + +*/ + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + /* + # fstcomposecontext composes efficiently with a context fst + # that it generates. Without --disambig-syms specified, it + # assumes that all input symbols of in.fst are phones. + # It adds the subsequential symbol itself (it does not + # appear in the output so doesn't need to be specified by the user). + # the disambig.list is a list of disambiguation symbols on the LHS + # of in.fst. The symbols on the LHS of out.fst are indexes into + # the ilabels.list file, which is a kaldi-format file containing a + # vector >, which specifies what the labels mean in + # terms of windows of symbols. + fstcomposecontext ilabels.sym [ in.fst [ out.fst ] ] + --disambig-syms=disambig.list + --context-size=3 + --central-position=1 + --binary=false + */ + + const char *usage = + "Composes on the left with a dynamically created context FST\n" + "\n" + "Usage: fstcomposecontext [ [] ]\n" + "E.g: fstcomposecontext ilabels.sym < LG.fst > CLG.fst\n"; + + + ParseOptions po(usage); + bool binary = true; + std::string disambig_rxfilename, + disambig_wxfilename; + int32 context_width = 3, central_position = 1; + int32 nonterm_phones_offset = -1; + po.Register("binary", &binary, + "If true, output ilabels-output-file in binary format"); + po.Register("read-disambig-syms", &disambig_rxfilename, + "List of disambiguation symbols on input of in.fst"); + po.Register("write-disambig-syms", &disambig_wxfilename, + "List of disambiguation symbols on input of out.fst"); + po.Register("context-size", &context_width, "Size of phone context window"); + po.Register("central-position", ¢ral_position, + "Designated central position in context window"); + po.Register("nonterm-phones-offset", &nonterm_phones_offset, + "The integer id of #nonterm_bos in your phones.txt, if present " + "(only relevant for grammar-FST construction, see " + "doc/grammar.dox"); + + po.Read(argc, argv); + + if (po.NumArgs() < 1 || po.NumArgs() > 3) { + po.PrintUsage(); + exit(1); + } + + std::string ilabels_out_filename = po.GetArg(1), + fst_in_filename = po.GetOptArg(2), + fst_out_filename = po.GetOptArg(3); + + VectorFst *fst = ReadFstKaldi(fst_in_filename); + + if ( (disambig_wxfilename != "") && (disambig_rxfilename == "") ) + KALDI_ERR << "fstcomposecontext: cannot specify --write-disambig-syms if " + "not specifying --read-disambig-syms\n"; + + std::vector disambig_in; + if (disambig_rxfilename != "") + if (!ReadIntegerVectorSimple(disambig_rxfilename, &disambig_in)) + KALDI_ERR << "fstcomposecontext: Could not read disambiguation symbols from " + << PrintableRxfilename(disambig_rxfilename); + + if (disambig_in.empty()) { + KALDI_WARN << "Disambiguation symbols list is empty; this likely " + << "indicates an error in data preparation."; + } + + std::vector > ilabels; + VectorFst composed_fst; + + // Work gets done here (see context-fst.h) + if (nonterm_phones_offset < 0) { + // The normal case. + ComposeContext(disambig_in, context_width, central_position, + fst, &composed_fst, &ilabels); + } else { + // The grammar-FST case. See ../doc/grammar.dox for an intro. + if (context_width != 2 || central_position != 1) { + KALDI_ERR << "Grammar-fst graph creation only supports models with left-" + "biphone context. (--nonterm-phones-offset option was supplied)."; + } + ComposeContextLeftBiphone(nonterm_phones_offset, disambig_in, + *fst, &composed_fst, &ilabels); + } + WriteILabelInfo(Output(ilabels_out_filename, binary).Stream(), + binary, ilabels); + + if (disambig_wxfilename != "") { + std::vector disambig_out; + for (size_t i = 0; i < ilabels.size(); i++) + if (ilabels[i].size() == 1 && ilabels[i][0] <= 0) + disambig_out.push_back(static_cast(i)); + if (!WriteIntegerVectorSimple(disambig_wxfilename, disambig_out)) { + std::cerr << "fstcomposecontext: Could not write disambiguation symbols to " + << PrintableWxfilename(disambig_wxfilename) << '\n'; + return 1; + } + } + + WriteFstKaldi(composed_fst, fst_out_filename); + delete fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstcopy.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstcopy.cc new file mode 100644 index 0000000..a22b148 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstcopy.cc @@ -0,0 +1,78 @@ +// fstbin/fstcopy.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fst/fstlib.h" +#include "fstext/table-matcher.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + +/* +Test: +the command below should print out something similar to the given +input. and if you remove ,t from the output side it should print something +binary. +cat < \n"; + + ParseOptions po(usage); + + po.Read(argc, argv); + + if (po.NumArgs() != 2) { + po.PrintUsage(); + exit(1); + } + + std::string fst_rspecifier = po.GetArg(1), + fst_wspecifier = po.GetArg(2); + + SequentialTableReader fst_reader(fst_rspecifier); + TableWriter fst_writer(fst_wspecifier); + int32 n_done = 0; + + for (; !fst_reader.Done(); fst_reader.Next(), n_done++) + fst_writer.Write(fst_reader.Key(), fst_reader.Value()); + + KALDI_LOG << "Copied " << n_done << " FSTs."; + return (n_done != 0 ? 0 : 1); + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} + diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstdeterminizelog.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstdeterminizelog.cc new file mode 100644 index 0000000..f446241 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstdeterminizelog.cc @@ -0,0 +1,65 @@ +// fstbin/fstdeterminizelog.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/kaldi-io.h" +#include "util/parse-options.h" +#include "util/text-utils.h" +#include "fst/fstlib.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Determinizes in the log semiring\n" + "\n" + "Usage: fstdeterminizelog [in.fst [out.fst] ]\n" + "\n" + "See also fstdeterminizestar\n"; + + ParseOptions po(usage); + po.Read(argc, argv); + + if (po.NumArgs() > 2) { + po.PrintUsage(); + exit(1); + } + + std::string fst_in_filename = po.GetOptArg(1), + fst_out_filename = po.GetOptArg(2); + + VectorFst *fst = ReadFstKaldi(fst_in_filename); + + DeterminizeInLog(fst); + + WriteFstKaldi(*fst, fst_out_filename); + delete fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} + diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstdeterminizestar.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstdeterminizestar.cc new file mode 100644 index 0000000..82cc7f6 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstdeterminizestar.cc @@ -0,0 +1,119 @@ +// fstbin/fstdeterminizestar.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "fst/fstlib.h" +#include "fstext/determinize-star.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" +#include "util/parse-options.h" + +#if !defined(_MSC_VER) && !defined(__APPLE__) +#include // Comment this line and the call to signal below if +// it causes compilation problems. It is only to enable a debugging procedure +// when determinization does not terminate. We are disabling this code if +// compiling on Windows because signal.h is not available there, and on +// MacOS due to a problem with in the initial release of Sierra. +#endif + +/* some test examples: + ( echo "0 0 0 0"; echo "0 0" ) | fstcompile | fstdeterminizestar | fstprint + ( echo "0 0 1 0"; echo "0 0" ) | fstcompile | fstdeterminizestar | fstprint + ( echo "0 0 1 0"; echo "0 1 1 0"; echo "0 0" ) | fstcompile | fstdeterminizestar | fstprint + # this last one fails [correctly]: + ( echo "0 0 0 1"; echo "0 0" ) | fstcompile | fstdeterminizestar | fstprint + + cd ~/tmpdir + while true; do + fstrand > 1.fst + fstpredeterminize out.lst 1.fst | fstdeterminizestar | fstrmsymbols out.lst > 2.fst + fstequivalent --random=true 1.fst 2.fst || echo "Test failed" + echo -n "." + done + + Test of debugging [with non-determinizable input]: + ( echo " 0 0 1 0 1.0"; echo "0 1 1 0"; echo "1 1 1 0 0"; echo "0 2 2 0"; echo "2"; echo "1" ) | fstcompile | fstdeterminizestar + kill -SIGUSR1 [the process-id of fstdeterminizestar] + # prints out a bunch of debugging output showing the mess it got itself into. +*/ + + +bool debug_location = false; +void signal_handler(int) { + debug_location = true; +} + + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Removes epsilons and determinizes in one step\n" + "\n" + "Usage: fstdeterminizestar [in.fst [out.fst] ]\n" + "\n" + "See also: fstdeterminizelog, lattice-determinize\n"; + + float delta = kDelta; + int max_states = -1; + bool use_log = false; + ParseOptions po(usage); + po.Register("use-log", &use_log, "Determinize in log semiring."); + po.Register("delta", &delta, "Delta value used to determine equivalence of weights."); + po.Register("max-states", &max_states, "Maximum number of states in determinized FST before it will abort."); + po.Read(argc, argv); + + if (po.NumArgs() > 2) { + po.PrintUsage(); + exit(1); + } + + std::string fst_in_str = po.GetOptArg(1), + fst_out_str = po.GetOptArg(2); + + // This enables us to get traceback info from determinization that is + // not seeming to terminate. +#if !defined(_MSC_VER) && !defined(__APPLE__) + signal(SIGUSR1, signal_handler); +#endif + // Normal case: just files. + VectorFst *fst = ReadFstKaldi(fst_in_str); + + ArcSort(fst, ILabelCompare()); // improves speed. + if (use_log) { + DeterminizeStarInLog(fst, delta, &debug_location, max_states); + } else { + VectorFst det_fst; + DeterminizeStar(*fst, &det_fst, delta, &debug_location, max_states); + *fst = det_fst; // will do shallow copy and then det_fst goes + // out of scope anyway. + } + WriteFstKaldi(*fst, fst_out_str); + delete fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstisstochastic.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstisstochastic.cc new file mode 100644 index 0000000..3e0f165 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstisstochastic.cc @@ -0,0 +1,85 @@ +// fstbin/fstisstochastic.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/kaldi-io.h" +#include "util/parse-options.h" +#include "fst/fstlib.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + +// e.g. of test: +// echo " 0 0" | fstcompile | fstisstochastic +// should return 0 and print "0 0" [meaning, min and +// max weight are one = exp(0)] +// echo " 0 1" | fstcompile | fstisstochastic +// should return 1, not stochastic, and print 1 1 +// (echo "0 0 0 0 0.693147 "; echo "0 1 0 0 0.693147 "; echo "1 0" ) | fstcompile | fstisstochastic +// should return 0, stochastic; it prints "0 -1.78e-07" for me +// (echo "0 0 0 0 0.693147 "; echo "0 1 0 0 0.693147 "; echo "1 0" ) | fstcompile | fstisstochastic --test-in-log=false +// should return 1, not stochastic in tropical; it prints "0 0.693147" for me +// (echo "0 0 0 0 0 "; echo "0 1 0 0 0 "; echo "1 0" ) | fstcompile | fstisstochastic --test-in-log=false +// should return 0, stochastic in tropical; it prints "0 0" for me +// (echo "0 0 0 0 0.693147 "; echo "0 1 0 0 0.693147 "; echo "1 0" ) | fstcompile | fstisstochastic --test-in-log=false --delta=1 +// returns 0 even though not stochastic because we gave it an absurdly large delta. + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Checks whether an FST is stochastic and exits with success if so.\n" + "Prints out maximum error (in log units).\n" + "\n" + "Usage: fstisstochastic [ in.fst ]\n"; + + float delta = 0.01; + bool test_in_log = true; + + ParseOptions po(usage); + po.Register("delta", &delta, "Maximum error to accept."); + po.Register("test-in-log", &test_in_log, "Test stochasticity in log semiring."); + po.Read(argc, argv); + + if (po.NumArgs() > 1) { + po.PrintUsage(); + exit(1); + } + + std::string fst_in_filename = po.GetOptArg(1); + + Fst *fst = ReadFstKaldiGeneric(fst_in_filename); + + bool ans; + StdArc::Weight min, max; + if (test_in_log) ans = IsStochasticFstInLog(*fst, delta, &min, &max); + else ans = IsStochasticFst(*fst, delta, &min, &max); + + std::cout << min.Value() << " " << max.Value() << '\n'; + delete fst; + if (ans) return 0; // success; + else return 1; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstmakecontextfst.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstmakecontextfst.cc new file mode 100644 index 0000000..818bf00 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstmakecontextfst.cc @@ -0,0 +1,143 @@ +// fstbin/fstmakecontextfst.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/kaldi-io.h" +#include "util/common-utils.h" +#include "fst/fstlib.h" +#include "fstext/fstext-utils.h" +#include "fstext/context-fst.h" +#include "fstext/kaldi-fst-io.h" + + +/* for example of testing setup, see fstmakecontextsymbols.cc */ + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Constructs a context FST with a specified context-width and context-position.\n" + "Outputs the context FST, and a file in Kaldi format that describes what the\n" + "input labels mean. Note: this is very inefficient if there are a lot of phones,\n" + "better to use fstcomposecontext instead\n" + "\n" + "Usage: fstmakecontextfst []\n" + "E.g.: fstmakecontextfst phones.txt 42 ilabels.sym > C.fst\n"; + + bool binary = true; // binary output to ilabels_output_file. + std::string disambig_rxfilename, disambig_wxfilename; + int32 context_width = 3, central_position = 1; + + ParseOptions po(usage); + po.Register("read-disambig-syms", &disambig_rxfilename, + "List of disambiguation symbols to read"); + po.Register("write-disambig-syms", &disambig_wxfilename, + "List of disambiguation symbols to write"); + po.Register("context-size", &context_width, "Size of phonetic context window"); + po.Register("central-position", ¢ral_position, + "Designated central position in context window"); + po.Register("binary", &binary, + "Write ilabels output file in binary Kaldi format"); + + po.Read(argc, argv); + + if (po.NumArgs() < 3 || po.NumArgs() > 4) { + po.PrintUsage(); + exit(1); + } + + std::string phones_symtab_filename = po.GetArg(1); + int32 subseq_sym; + if (!ConvertStringToInteger(po.GetArg(2), &subseq_sym)) + KALDI_ERR << "Invalid subsequential symbol " << po.GetArg(2); + std::string ilabels_out_filename = po.GetArg(3); + std::string fst_out_filename = po.GetOptArg(4); + + + std::vector phone_syms; + { + fst::SymbolTable *phones_symtab = NULL; + { // read phone symbol table. + std::ifstream is(phones_symtab_filename.c_str()); + phones_symtab = fst::SymbolTable::ReadText(is, phones_symtab_filename); + if (!phones_symtab) KALDI_ERR << "Could not read phones symbol-table file "< disambig_in; + if (disambig_rxfilename != "") { + if (!ReadIntegerVectorSimple(disambig_rxfilename, &disambig_in)) + KALDI_ERR << "fstcomposecontext: Could not read disambiguation symbols from " + << PrintableRxfilename(disambig_rxfilename); + } + + if (std::binary_search(phone_syms.begin(), phone_syms.end(), subseq_sym) + || std::binary_search(disambig_in.begin(), disambig_in.end(), subseq_sym)) + KALDI_ERR << "Invalid subsequential symbol " << subseq_sym + << ", already a phone or disambiguation symbol."; + + // 'loop_fst' will be an acceptor FST with single (initial and final) state, with + // a loop for each phone and disambiguation symbol. + StdVectorFst loop_fst; + loop_fst.AddState(); // Add state zero. + loop_fst.SetStart(0); + loop_fst.SetFinal(0, TropicalWeight::One()); + for (size_t i = 0; i < phone_syms.size(); i++) { + int32 sym = phone_syms[i]; + loop_fst.AddArc(0, StdArc(sym, sym, TropicalWeight::One(), 0)); + } + + std::vector > ilabels; + VectorFst context_fst; + + ComposeContext(disambig_in, context_width, central_position, + &loop_fst, &context_fst, &ilabels, true); + + WriteFstKaldi(context_fst, fst_out_filename); + + WriteILabelInfo(Output(ilabels_out_filename, binary).Stream(), + binary, ilabels); + + if (disambig_wxfilename != "") { + std::vector disambig_out; + for (size_t i = 0; i < ilabels.size(); i++) + if (ilabels[i].size() == 1 && ilabels[i][0] <= 0) + disambig_out.push_back(static_cast(i)); + if (!WriteIntegerVectorSimple(disambig_wxfilename, disambig_out)) + KALDI_ERR << "fstcomposecontext: Could not write disambiguation symbols to " + << PrintableWxfilename(disambig_wxfilename); + } + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstmakecontextsyms.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstmakecontextsyms.cc new file mode 100644 index 0000000..c9d4939 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstmakecontextsyms.cc @@ -0,0 +1,122 @@ +// fstbin/fstmakecontextsyms.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "tree/context-dep.h" +#include "util/common-utils.h" +#include "fst/fstlib.h" +#include "fstext/fstext-utils.h" +#include "fstext/context-fst.h" + + +/* + Test for this and makecontextfst: + mkdir -p ~/tmpdir + pushd ~/tmpdir + (echo " 0"; echo "a 1"; echo "b 2"; echo "#0 3"; echo "#1 4"; echo "#$ 5" ) > phones.txt + ( echo 3; echo 4 ) > disambig.list + fstmakecontextfst --read-disambig-syms=disambig.list <(grep -v '#' phones.txt) 5 ilabels.int > C.fst + fstmakecontextsyms phones.txt ilabels.int > context_syms.txt + fstprint --isymbols=context_syms.txt --osymbols=phones.txt C.fst > C.txt + + fstrandgen C.fst | fstprint --isymbols=context_syms.txt --osymbols=phones.txt + + Example output: + + fstrandgen C.fst | fstprint --isymbols=context_syms.txt --osymbols=phones.txt +0 1 #-1 b +1 2 /b/ #$ +2 3 #1 #1 +3 4 #0 #0 +4 5 #0 #0 +5 6 #0 #0 +6 7 #0 #0 +7 8 #0 #0 +8 9 #1 #1 +9 +*/ + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + typedef fst::StdArc::Label Label; + const char *usage = "Create input symbols for CLG\n" + "Usage: fstmakecontextsyms phones-symtab ilabels_input_file [output-symtab.txt]\n" + "E.g.: fstmakecontextsyms phones.txt ilabels.sym > context_symbols.txt\n"; + + ParseOptions po(usage); + + std::string disambig_list_file = "", + phone_separator = "/", + initial_disambig = "#-1"; + + po.Register("phone-separator", &phone_separator, + "Separator for phones in phone-in-context symbols."); + po.Register("initial-disambig", &initial_disambig, + "Name for special disambiguation symbol that occurs at start " + "of context-dependent phone sequences"); + + po.Read(argc, argv); + + if (po.NumArgs() < 2 || po.NumArgs() > 3) { + po.PrintUsage(); + exit(1); + } + + std::string phones_symtab_filename = po.GetArg(1), + ilabel_info_filename = po.GetArg(2), + clg_symtab_filename = po.GetOptArg(3); + + std::vector > ilabel_info; + { + bool binary; + Input ki(ilabel_info_filename, &binary); + ReadILabelInfo(ki.Stream(), + binary, &ilabel_info); + } + + fst::SymbolTable *phones_symtab = NULL; + { // read phone symbol table. + std::ifstream is(phones_symtab_filename.c_str()); + phones_symtab = fst::SymbolTable::ReadText(is, phones_symtab_filename); + if (!phones_symtab) KALDI_ERR << "Could not read phones symbol-table file "<WriteText(std::cout)) + KALDI_ERR << "Cannot write symbol table to standard output."; + } else { + if (!clg_symtab->WriteText(clg_symtab_filename)) + KALDI_ERR << "Cannot open symbol table file "< 2) { + po.PrintUsage(); + exit(1); + } + + std::string fst_in_filename = po.GetOptArg(1), + fst_out_filename = po.GetOptArg(2); + + VectorFst *fst = ReadFstKaldi(fst_in_filename); + + MinimizeEncoded(fst, delta); + + WriteFstKaldi(*fst, fst_out_filename); + + delete fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } + return 0; +} + diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstphicompose.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstphicompose.cc new file mode 100644 index 0000000..13ffcf3 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstphicompose.cc @@ -0,0 +1,183 @@ +// fstbin/fstphicompose.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fst/fstlib.h" +#include "fstext/table-matcher.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + +/* +The following commands represent a basic test of this program. + +cat < a.fst +0 1 10 10 +0 1 11 11 +1 +EOF + +cat < g.fst +0 1 10 10 2.0 +0 2 100 100 6.6 +2 1 10 10 0.0 +2 1 11 11 1.0 +1 +EOF +fstcompose a.fst g.fst | fstprint +# gives, as expected: +# 0 1 10 10 2 +# 1 +fstphicompose 100 a.fst g.fst | fstprint +# gives, again correctly: +#0 1 10 10 2 +#0 1 11 11 7.5999999 +#1 + +Next, test that it's working as desired for final-probs, +i.e. it takes the backoff arc when looking for a final-prob, +only if no final-prob present at current state. + +cat < a.fst +0 1 10 10 +0 1 11 11 +1 +EOF +cat < g.fst +0 1 10 10 2.0 +0 3 11 11 2.0 +1 2 100 110 6.6 +3 10.0 +3 2 100 110 0.0 +2 +EOF +fstphicompose 100 a.fst g.fst | fstprint +# output is: +#0 1 10 10 2 +#0 2 11 11 2 +#1 6.5999999 +#2 10 + +*/ + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + /* + fstphicompose does composition, but treats the second FST + specially (basically, like a backoff LM); whenever the + composition algorithm fails to find a match for a label + in the second FST, if it sees a phi transition it will + take it instead, and look for a match at the destination. + phi is the label on the input side of the backoff arc of + the LM (the label on the output side doesn't matter). + + Also modifies the second fst so that it treats final-probs + "correctly", i.e. takes the failure transition when looking + for a final-prob. This would not work if there were + epsilons. + */ + + const char *usage = + "Composition, where the right FST has \"failure\" (phi) transitions\n" + "that are only taken where there was no match of a \"real\" label\n" + "You supply the label corresponding to phi.\n" + "\n" + "Usage: fstphicompose phi-label (fst1-rxfilename|fst1-rspecifier) " + "(fst2-rxfilename|fst2-rspecifier) [(out-rxfilename|out-rspecifier)]\n" + "E.g.: fstphicompose 54 a.fst b.fst c.fst\n" + "or: fstphicompose 11 ark:a.fsts G.fst ark:b.fsts\n"; + + ParseOptions po(usage); + + po.Read(argc, argv); + + if (po.NumArgs() < 3 || po.NumArgs() > 4) { + po.PrintUsage(); + exit(1); + } + + std::string + phi_str = po.GetArg(1), + fst1_in_str = po.GetArg(2), + fst2_in_str = po.GetArg(3), + fst_out_str = po.GetOptArg(4); + + bool is_table_1 = + (ClassifyRspecifier(fst1_in_str, NULL, NULL) != kNoRspecifier), + is_table_2 = + (ClassifyRspecifier(fst2_in_str, NULL, NULL) != kNoRspecifier), + is_table_out = + (ClassifyWspecifier(fst_out_str, NULL, NULL, NULL) != kNoWspecifier); + + int32 phi_label; + if (!ConvertStringToInteger(phi_str, &phi_label) + || phi_label <= 0) + KALDI_ERR << "Invalid first argument (phi label), expect positive integer."; + + if (is_table_out != (is_table_1 || is_table_2)) + KALDI_ERR << "Incompatible combination of archives and files"; + + if (!is_table_1 && !is_table_2) { // Only dealing with files... + VectorFst *fst1 = ReadFstKaldi(fst1_in_str); + + VectorFst *fst2 = ReadFstKaldi(fst2_in_str); + + PropagateFinal(phi_label, fst2); // makes it work correctly + // w.r.t. final-probs. + + VectorFst composed_fst; + + PhiCompose(*fst1, *fst2, phi_label, &composed_fst); + + delete fst1; + delete fst2; + + WriteFstKaldi(composed_fst, fst_out_str); + return 0; + } else if (is_table_1 && !is_table_2) { + + VectorFst *fst2 = ReadFstKaldi(fst2_in_str); + PropagateFinal(phi_label, fst2); // makes it work correctly + // w.r.t. final-probs. + SequentialTableReader fst1_reader(fst1_in_str); + TableWriter fst_writer(fst_out_str); + int32 n_done = 0; + for (; !fst1_reader.Done(); fst1_reader.Next(), n_done++) { + VectorFst fst1(fst1_reader.Value()); + VectorFst fst_out; + PhiCompose(fst1, *fst2, phi_label, &fst_out); + fst_writer.Write(fst1_reader.Key(), fst_out); + } + KALDI_LOG << "Composed " << n_done << " FSTs."; + return (n_done != 0 ? 0 : 1); + } else { + KALDI_ERR << "The combination of tables/non-tables that you " + << "supplied is not currently supported. Either implement this, " + << "ask the maintainers to implement it, or call this program " + << "differently."; + } + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstpushspecial.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstpushspecial.cc new file mode 100644 index 0000000..b7428f2 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstpushspecial.cc @@ -0,0 +1,72 @@ +// fstbin/fstpushspecial.cc + +// Copyright 2012 Daniel Povey + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/kaldi-io.h" +#include "util/parse-options.h" +#include "util/text-utils.h" +#include "fst/fstlib.h" +#include "fstext/fstext-utils.h" +#include "fstext/push-special.h" +#include "fstext/kaldi-fst-io.h" + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Pushes weights in an FST such that all the states\n" + "in the FST have arcs and final-probs with weights that\n" + "sum to the same amount (viewed as being in the log semiring).\n" + "Thus, the \"extra weight\" is distributed throughout the FST.\n" + "Tolerance parameter --delta controls how exact this is, and the\n" + "speed.\n" + "\n" + "Usage: fstpushspecial [options] [in.fst [out.fst] ]\n"; + + BaseFloat delta = kDelta; + ParseOptions po(usage); + po.Register("delta", &delta, "Delta cost: after pushing, all states will " + "have a total weight that differs from the average by no more " + "than this."); + po.Read(argc, argv); + + if (po.NumArgs() > 2) { + po.PrintUsage(); + exit(1); + } + + std::string fst_in_filename = po.GetOptArg(1), + fst_out_filename = po.GetOptArg(2); + + VectorFst *fst = ReadFstKaldi(fst_in_filename); + + PushSpecial(fst, delta); + + WriteFstKaldi(*fst, fst_out_filename); + delete fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstrand.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstrand.cc new file mode 100644 index 0000000..f0bc393 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstrand.cc @@ -0,0 +1,67 @@ +// fstbin/fstrand.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/kaldi-io.h" +#include "util/parse-options.h" +#include "util/text-utils.h" +#include "fstext/rand-fst.h" +#include "time.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + +int main(int argc, char *argv[]) { + try { + using namespace fst; + using kaldi::int32; + + const char *usage = + "Generate random FST\n" + "\n" + "Usage: fstrand [out.fst]\n"; + + srand(time(NULL)); + RandFstOptions opts; + + + kaldi::ParseOptions po(usage); + po.Register("allow-empty", &opts.allow_empty, + "If true, we may generate an empty FST."); + + po.Read(argc, argv); + + if (po.NumArgs() > 1) { + po.PrintUsage(); + exit(1); + } + + std::string fst_out_filename = po.GetOptArg(1); + + VectorFst *rand_fst = RandFst(opts); + + WriteFstKaldi(*rand_fst, fst_out_filename); + delete rand_fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} + diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstrmepslocal.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstrmepslocal.cc new file mode 100644 index 0000000..3aedd6d --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstrmepslocal.cc @@ -0,0 +1,101 @@ +// fstbin/fstrmepslocal.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/kaldi-io.h" +#include "util/parse-options.h" +#include "util/text-utils.h" +#include "fst/fstlib.h" +#include "fstext/determinize-star.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + + +/* + A test example: + ( echo "0 1 1 0"; echo "1 2 0 2"; echo "2 0"; ) | fstcompile | fstrmepslocal | fstprint +# prints: +# 0 1 1 2 +# 1 + ( echo "0 1 0 0"; echo "0 0"; echo "1 0" ) | fstcompile | fstrmepslocal | fstprint +# 0 + ( echo "0 1 0 0"; echo "0 0"; echo "1 0" ) | fstcompile | fstrmepslocal | fstprint + ( echo "0 1 0 0"; echo "0 0"; echo "1 0" ) | fstcompile | fstrmepslocal --use-log=true | fstprint +# 0 -0.693147182 + +*/ + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Removes some (but not all) epsilons in an algorithm that will always reduce the number of\n" + "arcs+states. Option to preserves equivalence in tropical or log semiring, and\n" + "if in tropical, stochasticit in either log or tropical.\n" + "\n" + "Usage: fstrmepslocal [in.fst [out.fst] ]\n"; + + ParseOptions po(usage); + bool use_log = false; + bool stochastic_in_log = true; + po.Register("use-log", &use_log, + "Preserve equivalence in log semiring [false->tropical]\n"); + po.Register("stochastic-in-log", &stochastic_in_log, + "Preserve stochasticity in log semiring [false->tropical]\n"); + po.Read(argc, argv); + + if (po.NumArgs() > 2) { + po.PrintUsage(); + exit(1); + } + + std::string fst_in_filename = po.GetOptArg(1), + fst_out_filename = po.GetOptArg(2); + + VectorFst *fst = ReadFstKaldi(fst_in_filename); + + if (!use_log && stochastic_in_log) { + RemoveEpsLocalSpecial(fst); + } else if (use_log && !stochastic_in_log) { + std::cerr << "fstrmsymbols: invalid combination of flags\n"; + return 1; + } else if (use_log) { + VectorFst log_fst; + Cast(*fst, &log_fst); + delete fst; + RemoveEpsLocal(&log_fst); + fst = new VectorFst; + Cast(log_fst, fst); + } else { + RemoveEpsLocal(fst); + } + + WriteFstKaldi(*fst, fst_out_filename); + delete fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} + diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fstrmsymbols.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fstrmsymbols.cc new file mode 100644 index 0000000..a365b01 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fstrmsymbols.cc @@ -0,0 +1,193 @@ +// fstbin/fstrmsymbols.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fst/fstlib.h" +#include "fstext/determinize-star.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + +namespace fst { +// we can move these functions elsewhere later, if they are needed in other +// places. + +template +void RemoveArcsWithSomeInputSymbols(const std::vector &symbols_in, + VectorFst *fst) { + typedef typename Arc::StateId StateId; + + kaldi::ConstIntegerSet symbol_set(symbols_in); + + StateId num_states = fst->NumStates(); + StateId dead_state = fst->AddState(); + for (StateId s = 0; s < num_states; s++) { + for (MutableArcIterator > iter(fst, s); + !iter.Done(); iter.Next()) { + if (symbol_set.count(iter.Value().ilabel) != 0) { + Arc arc = iter.Value(); + arc.nextstate = dead_state; + iter.SetValue(arc); + } + } + } + // Connect() will actually remove the arcs, and the dead state. + Connect(fst); + if (fst->NumStates() == 0) + KALDI_WARN << "After Connect(), fst was empty."; +} + +template +void PenalizeArcsWithSomeInputSymbols(const std::vector &symbols_in, + float penalty, + VectorFst *fst) { + typedef typename Arc::StateId StateId; + typedef typename Arc::Label Label; + typedef typename Arc::Weight Weight; + + Weight penalty_weight(penalty); + + kaldi::ConstIntegerSet symbol_set(symbols_in); + + StateId num_states = fst->NumStates(); + for (StateId s = 0; s < num_states; s++) { + for (MutableArcIterator > iter(fst, s); + !iter.Done(); iter.Next()) { + if (symbol_set.count(iter.Value().ilabel) != 0) { + Arc arc = iter.Value(); + arc.weight = Times(arc.weight, penalty_weight); + iter.SetValue(arc); + } + } + } +} + +} + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + bool apply_to_output = false; + bool remove_arcs = false; + float penalty = -std::numeric_limits::infinity(); + + const char *usage = + "With no options, replaces a subset of symbols with epsilon, wherever\n" + "they appear on the input side of an FST." + "With --remove-arcs=true, will remove arcs that contain these symbols\n" + "on the input\n" + "With --penalty=, will add the specified penalty to the\n" + "cost of any arc that has one of the given symbols on its input side\n" + "In all cases, the option --apply-to-output=true (or for\n" + "back-compatibility, --remove-from-output=true) makes this apply\n" + "to the output side.\n" + "\n" + "Usage: fstrmsymbols [options] [ []]\n" + "E.g: fstrmsymbols in.list < in.fst > out.fst\n" + " is an rxfilename specifying a file containing list of integers\n" + "representing symbols, in text form, one per line.\n"; + + ParseOptions po(usage); + po.Register("remove-from-output", &apply_to_output, "If true, this applies to symbols " + "on the output, not the input, side. (For back compatibility; use " + "--apply-to-output insead)"); + po.Register("apply-to-output", &apply_to_output, "If true, this applies to symbols " + "on the output, not the input, side."); + po.Register("remove-arcs", &remove_arcs, "If true, instead of converting the symbol " + "to , remove the arcs."); + po.Register("penalty", &penalty, "If specified, instead of converting " + "the symbol to , penalize the arc it is on by adding this " + "value to its cost."); + + + po.Read(argc, argv); + + if (remove_arcs && + penalty != -std::numeric_limits::infinity()) + KALDI_ERR << "--remove-arc and --penalty options are mutually exclusive"; + + if (po.NumArgs() < 1 || po.NumArgs() > 3) { + po.PrintUsage(); + exit(1); + } + + std::string disambig_rxfilename = po.GetArg(1), + fst_rxfilename = po.GetOptArg(2), + fst_wxfilename = po.GetOptArg(3); + + VectorFst *fst = CastOrConvertToVectorFst( + ReadFstKaldiGeneric(fst_rxfilename)); + + std::vector disambig_in; + if (!ReadIntegerVectorSimple(disambig_rxfilename, &disambig_in)) + KALDI_ERR << "fstrmsymbols: Could not read disambiguation symbols from " + << (disambig_rxfilename == "" ? "standard input" : disambig_rxfilename); + + if (apply_to_output) Invert(fst); + if (remove_arcs) { + RemoveArcsWithSomeInputSymbols(disambig_in, fst); + } else if (penalty != -std::numeric_limits::infinity()) { + PenalizeArcsWithSomeInputSymbols(disambig_in, penalty, fst); + } else { + RemoveSomeInputSymbols(disambig_in, fst); + } + if (apply_to_output) Invert(fst); + + WriteFstKaldi(*fst, fst_wxfilename); + + delete fst; + return 0; + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} + +/* some test examples: + + ( echo "0 0 1 1"; echo " 0 0 3 2"; echo "0 0"; ) | fstcompile | fstrmsymbols "echo 3; echo 4|" | fstprint + # should produce: + # 0 0 1 1 + # 0 0 0 2 + # 0 + + ( echo "0 0 1 1"; echo " 0 0 3 2"; echo "0 0"; ) | fstcompile | fstrmsymbols --apply-to-output=true "echo 2; echo 3|" | fstprint + # should produce: + # 0 0 1 1 + # 0 0 3 0 + # 0 + + + ( echo "0 0 1 1"; echo " 0 0 3 2"; echo "0 0"; ) | fstcompile | fstrmsymbols --remove-arcs=true "echo 3; echo 4|" | fstprint + # should produce: + # 0 0 1 1 + # 0 + + ( echo "0 0 1 1"; echo " 0 0 3 2"; echo "0 0"; ) | fstcompile | fstrmsymbols --penalty=2 "echo 3; echo 4; echo 5|" | fstprint +# should produce: + # 0 0 1 1 + # 0 0 3 2 2 + # 0 + +*/ diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-concat.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-concat.cc new file mode 100644 index 0000000..2a217ed --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-concat.cc @@ -0,0 +1,112 @@ +// fstbin/fsts-concat.cc + +// Copyright 2016 Johns Hopkins University (Authors: Jan "Yenda" Trmal) +// 2018 Soapbox Labs (Author: Karel Vesely) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + typedef kaldi::int32 int32; + typedef kaldi::uint64 uint64; + + const char *usage = + "Reads kaldi archives with FSTs. Concatenates the fsts from all the rspecifiers.\n" + "The fsts to concatenate must have same key. The sequencing is given by the position of arguments.\n" + "\n" + "Usage: fsts-concat [options] ... \n" + " e.g.: fsts-concat scp:fsts1.scp scp:fsts2.scp ... ark:fsts_out.ark\n" + "\n" + "see also: fstconcat (from the OpenFst toolkit)\n"; + + ParseOptions po(usage); + + po.Read(argc, argv); + + if (po.NumArgs() < 3) { + po.PrintUsage(); + exit(1); + } + + std::string fsts_rspecifier = po.GetArg(1), + fsts_wspecifier = po.GetArg(po.NumArgs()); + + SequentialTableReader fst_reader(fsts_rspecifier); + std::vector*> fst_readers; + TableWriter fst_writer(fsts_wspecifier); + + for (int32 i = 2; i < po.NumArgs(); i++) + fst_readers.push_back(new RandomAccessTableReader(po.GetArg(i))); + const int32 num_fst_readers = fst_readers.size(); + + int32 n_done = 0, + n_skipped = 0; + + for (; !fst_reader.Done(); fst_reader.Next()) { + std::string key = fst_reader.Key(); + + // Check that the key exists in all 'fst_readers'. + bool skip_key = false; + for (int32 i = 0; i < num_fst_readers; i++) { + if (!fst_readers[i]->HasKey(key)) { + KALDI_WARN << "Skipping '" << key << "'" + << " due to missing the fst in " << (i+2) << "th : " + << "'" << po.GetArg(i+2) << "'"; + skip_key = true; + } + } + if (skip_key) { + n_skipped++; + continue; + } + + // Concatenate! + VectorFst fst_out = fst_readers.back()->Value(key); + // Loop from (last-1) to first, as 'prepending' the fsts is faster, + // see: http://www.openfst.org/twiki/bin/view/FST/ConcatDoc + for (int32 i = num_fst_readers-2; i >= 0; i--) { + fst::Concat(fst_readers[i]->Value(key), &fst_out); + } + // Finally, prepend the fst from the 'Sequential' reader. + fst::Concat(fst_reader.Value(), &fst_out); + + // Write the output. + fst_writer.Write(key, fst_out); + n_done++; + } + + // Cleanup. + for (int32 i = 0; i < num_fst_readers; i++) + delete fst_readers[i]; + fst_readers.clear(); + + KALDI_LOG << "Produced " << n_done << " FSTs by concatenating " << po.NumArgs()-1 + << " streams " << "(" << n_skipped << " keys skipped)."; + return (n_done != 0 ? 0 : 1); + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-project.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-project.cc new file mode 100644 index 0000000..015f143 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-project.cc @@ -0,0 +1,82 @@ +// fstbin/fsts-project.cc + +// Copyright 2016 Johns Hopkins University (Authors: Jan "Yenda" Trmal) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + typedef kaldi::int32 int32; + typedef kaldi::uint64 uint64; + + const char *usage = + "Reads kaldi archive of FSTs; for each element, performs the project\n" + "operation either on input (default) or on the output (if the option\n" + "--project-output is true).\n" + "\n" + "Usage: fsts-project [options] \n" + " e.g.: fsts-project ark:train.fsts ark,t:train.fsts\n" + "\n" + "see also: fstproject (from the OpenFst toolkit)\n"; + + ParseOptions po(usage); + + bool project_output = false; + + po.Register("project-output", &project_output, + "If true, project output vs input"); + + po.Read(argc, argv); + + if (po.NumArgs() != 2) { + po.PrintUsage(); + exit(1); + } + + std::string fsts_rspecifier = po.GetArg(1), + fsts_wspecifier = po.GetArg(2); + + + SequentialTableReader fst_reader(fsts_rspecifier); + TableWriter fst_writer(fsts_wspecifier); + + int32 n_done = 0; + for (; !fst_reader.Done(); fst_reader.Next()) { + std::string key = fst_reader.Key(); + VectorFst fst(fst_reader.Value()); + + Project(&fst, project_output ? PROJECT_OUTPUT : PROJECT_INPUT); + + fst_writer.Write(key, fst); + n_done++; + } + + KALDI_LOG << "Projected " << n_done << " FSTs"; + return (n_done != 0 ? 0 : 1); + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-to-transcripts.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-to-transcripts.cc new file mode 100644 index 0000000..ae74d5d --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-to-transcripts.cc @@ -0,0 +1,103 @@ +// fstbin/fsts-to-transcripts.cc + +// Copyright 2012-2013 Johns Hopkins University (Authors: Guoguo Chen, +// Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + typedef kaldi::int32 int32; + typedef kaldi::uint64 uint64; + + const char *usage = + "Reads a table of FSTs; for each element, finds the best path and \n" + "prints out the output-symbol sequence (if --output-side=true), or \n" + "input-symbol sequence otherwise.\n" + "\n" + "Usage:\n" + " fsts-to-transcripts [options] " + " \n" + "e.g.:\n" + " fsts-to-transcripts ark:train.fsts ark,t:train.text\n"; + + ParseOptions po(usage); + + bool output_side = true; + + po.Register("output-side", &output_side, "If true, extract the symbols on " + "the output side of the FSTs, else the input side."); + + po.Read(argc, argv); + + if (po.NumArgs() != 2) { + po.PrintUsage(); + exit(1); + } + + std::string fst_rspecifier = po.GetArg(1), + transcript_wspecifier = po.GetArg(2); + + + SequentialTableReader fst_reader(fst_rspecifier); + Int32VectorWriter transcript_writer(transcript_wspecifier); + + int32 n_done = 0, n_err = 0; + for (; !fst_reader.Done(); fst_reader.Next()) { + std::string key = fst_reader.Key(); + const VectorFst &fst = fst_reader.Value(); + + + VectorFst shortest_path; + ShortestPath(fst, &shortest_path); // the OpenFst algorithm ShortestPath. + + if (shortest_path.NumStates() == 0) { + KALDI_WARN << "Input FST (after shortest path) was empty. Producing " + << "no output for key " << key; + n_err++; + continue; + } + + std::vector transcript; + bool ans; + if (output_side) ans = fst::GetLinearSymbolSequence( + shortest_path, NULL, &transcript, NULL); + else + ans = fst::GetLinearSymbolSequence( + shortest_path, &transcript, NULL, NULL); + if (!ans) { + KALDI_ERR << "GetLinearSymbolSequence returned false (code error);"; + } + transcript_writer.Write(key, transcript); + n_done++; + } + + KALDI_LOG << "Converted " << n_done << " FSTs, " << n_err << " with errors"; + return (n_done != 0 ? 0 : 1); + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-union.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-union.cc new file mode 100644 index 0000000..ed68cea --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fsts-union.cc @@ -0,0 +1,100 @@ +// fstbin/fsts-union.cc + +// Copyright 2016 Johns Hopkins University (Authors: Jan "Yenda" Trmal) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + typedef kaldi::int32 int32; + typedef kaldi::uint64 uint64; + + const char *usage = + "Reads a kaldi archive of FSTs. Performs the FST operation union on\n" + "all fsts sharing the same key. Assumes the archive is sorted by key.\n" + "\n" + "Usage: fsts-union [options] \n" + " e.g.: fsts-union ark:keywords_tmp.fsts ark,t:keywords.fsts\n" + "\n" + "see also: fstunion (from the OpenFst toolkit)\n"; + + ParseOptions po(usage); + + po.Read(argc, argv); + + if (po.NumArgs() != 2) { + po.PrintUsage(); + exit(1); + } + + std::string fsts_rspecifier = po.GetArg(1), + fsts_wspecifier = po.GetArg(2); + + + SequentialTableReader fst_reader(fsts_rspecifier); + TableWriter fst_writer(fsts_wspecifier); + + int32 n_out_done = 0, + n_in_done = 0; + std::string res_key = ""; + VectorFst res_fst; + + for (; !fst_reader.Done(); fst_reader.Next()) { + std::string key = fst_reader.Key(); + VectorFst fst(fst_reader.Value()); + + n_in_done++; + if (key == res_key) { + fst::Union(&res_fst, fst); + } else { + if (res_key != "") { + VectorFst out_fst; + fst::Determinize(res_fst, &out_fst); + fst::Minimize(&out_fst); + fst::RmEpsilon(&out_fst); + fst_writer.Write(res_key, out_fst); + n_out_done++; + } + res_fst = fst; + res_key = key; + } + } + if (res_key != "") { + VectorFst out_fst; + fst::Determinize(res_fst, &out_fst); + fst::Minimize(&out_fst); + fst::RmEpsilon(&out_fst); + fst_writer.Write(res_key, out_fst); + n_out_done++; + } + + KALDI_LOG << "Applied fst union on " << n_in_done + << " FSTs, produced " << n_out_done << " FSTs"; + return (n_out_done != 0 ? 0 : 1); + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/fsttablecompose.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/fsttablecompose.cc new file mode 100644 index 0000000..6652a8c --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/fsttablecompose.cc @@ -0,0 +1,202 @@ +// fstbin/fsttablecompose.cc + +// Copyright 2009-2011 Microsoft Corporation +// 2013 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +//#include "util/common-utils.h" +#include "fst/fstlib.h" +#include "fstext/table-matcher.h" +#include "fstext/fstext-utils.h" +#include "fstext/kaldi-fst-io.h" +#include "util/parse-options.h" + +/* + cd ~/tmpdir + while true; do + fstrand | fstarcsort --sort_type=olabel > 1.fst; fstrand | fstarcsort > 2.fst + fstcompose 1.fst 2.fst > 3a.fst + fsttablecompose 1.fst 2.fst > 3b.fst + fstequivalent --random=true 3a.fst 3b.fst || echo "Test failed" + echo -n "." + done + +*/ + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + /* + fsttablecompose should always give equivalent results to compose, + but it is more efficient for certain kinds of inputs. + In particular, it is useful when, say, the left FST has states + that typically either have epsilon olabels, or + one transition out for each of the possible symbols (as the + olabel). The same with the input symbols of the right-hand FST + is possible. + */ + + const char *usage = + "Composition algorithm [between two FSTs of standard type, in tropical\n" + "semiring] that is more efficient for certain cases-- in particular,\n" + "where one of the FSTs (the left one, if --match-side=left) has large\n" + "out-degree\n" + "\n" + "Usage: fsttablecompose (fst1-rxfilename|fst1-rspecifier) " + "(fst2-rxfilename|fst2-rspecifier) [(out-rxfilename|out-rspecifier)]\n"; + + ParseOptions po(usage); + + TableComposeOptions opts; + std::string match_side = "left"; + std::string compose_filter = "sequence"; + + po.Register("connect", &opts.connect, "If true, trim FST before output."); + po.Register("match-side", &match_side, "Side of composition to do table " + "match, one of: \"left\" or \"right\"."); + po.Register("compose-filter", &compose_filter, "Composition filter to use, " + "one of: \"alt_sequence\", \"auto\", \"match\", \"sequence\""); + + po.Read(argc, argv); + + if (match_side == "left") { + opts.table_match_type = MATCH_OUTPUT; + } else if (match_side == "right") { + opts.table_match_type = MATCH_INPUT; + } else { + KALDI_ERR << "Invalid match-side option: " << match_side; + } + + if (compose_filter == "alt_sequence") { + opts.filter_type = ALT_SEQUENCE_FILTER; + } else if (compose_filter == "auto") { + opts.filter_type = AUTO_FILTER; + } else if (compose_filter == "match") { + opts.filter_type = MATCH_FILTER; + } else if (compose_filter == "sequence") { + opts.filter_type = SEQUENCE_FILTER; + } else { + KALDI_ERR << "Invalid compose-filter option: " << compose_filter; + } + + if (po.NumArgs() < 2 || po.NumArgs() > 3) { + po.PrintUsage(); + exit(1); + } + + std::string fst1_in_str = po.GetArg(1), + fst2_in_str = po.GetArg(2), + fst_out_str = po.GetOptArg(3); + + + //// Note: the "table" in is_table_1 and similar variables has nothing + //// to do with the "table" in "fsttablecompose"; is_table_1 relates to + //// whether we are dealing with a single FST or a whole set of FSTs. + //bool is_table_1 = + // (ClassifyRspecifier(fst1_in_str, NULL, NULL) != kNoRspecifier), + // is_table_2 = + // (ClassifyRspecifier(fst2_in_str, NULL, NULL) != kNoRspecifier), + // is_table_out = + // (ClassifyWspecifier(fst_out_str, NULL, NULL, NULL) != kNoWspecifier); + //if (is_table_out != (is_table_1 || is_table_2)) + // KALDI_ERR << "Incompatible combination of archives and files"; + // + //if (!is_table_1 && !is_table_2) { // Only dealing with files... + VectorFst *fst1 = ReadFstKaldi(fst1_in_str); + + VectorFst *fst2 = ReadFstKaldi(fst2_in_str); + + // Checks if is olabel sorted and is ilabel sorted. + if (fst1->Properties(fst::kOLabelSorted, true) == 0) { + KALDI_WARN << "The first FST is not olabel sorted."; + } + if (fst2->Properties(fst::kILabelSorted, true) == 0) { + KALDI_WARN << "The second FST is not ilabel sorted."; + } + + VectorFst composed_fst; + + TableCompose(*fst1, *fst2, &composed_fst, opts); + + delete fst1; + delete fst2; + + WriteFstKaldi(composed_fst, fst_out_str); + return 0; + //} else if (!is_table_1 && is_table_2 + // && opts.table_match_type == MATCH_OUTPUT) { + // // second arg is an archive, and match-side=left (default). + // TableComposeCache > cache(opts); + // VectorFst *fst1 = ReadFstKaldi(fst1_in_str); + // SequentialTableReader fst2_reader(fst2_in_str); + // TableWriter fst_writer(fst_out_str); + // int32 n_done = 0; + + // // Checks if is olabel sorted. + // if (fst1->Properties(fst::kOLabelSorted, true) == 0) { + // KALDI_WARN << "The first FST is not olabel sorted."; + // } + // for (; !fst2_reader.Done(); fst2_reader.Next(), n_done++) { + // VectorFst fst2(fst2_reader.Value()); + // VectorFst fst_out; + // TableCompose(*fst1, fst2, &fst_out, &cache); + // fst_writer.Write(fst2_reader.Key(), fst_out); + // } + // KALDI_LOG << "Composed " << n_done << " FSTs."; + // return (n_done != 0 ? 0 : 1); + //} else if (is_table_1 && is_table_2) { + // SequentialTableReader fst1_reader(fst1_in_str); + // RandomAccessTableReader fst2_reader(fst2_in_str); + // TableWriter fst_writer(fst_out_str); + // int32 n_done = 0, n_err = 0; + // for (; !fst1_reader.Done(); fst1_reader.Next()) { + // std::string key = fst1_reader.Key(); + // if (!fst2_reader.HasKey(key)) { + // KALDI_WARN << "No such key " << key << " in second table."; + // n_err++; + // } else { + // const VectorFst &fst1(fst1_reader.Value()), + // &fst2(fst2_reader.Value(key)); + // VectorFst result; + // TableCompose(fst1, fst2, &result, opts); + // if (result.NumStates() == 0) { + // KALDI_WARN << "Empty output for key " << key; + // n_err++; + // } else { + // fst_writer.Write(key, result); + // n_done++; + // } + // } + // } + // KALDI_LOG << "Successfully composed " << n_done << " FSTs, errors or " + // << "empty output on " << n_err; + //} else { + // KALDI_ERR << "The combination of tables/non-tables and match-type that you " + // << "supplied is not currently supported. Either implement this, " + // << "ask the maintainers to implement it, or call this program " + // << "differently."; + //} + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} + diff --git a/runtime/onnxruntime/third_party/kaldi/fstbin/make-grammar-fst.cc b/runtime/onnxruntime/third_party/kaldi/fstbin/make-grammar-fst.cc new file mode 100644 index 0000000..564f255 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstbin/make-grammar-fst.cc @@ -0,0 +1,167 @@ +// fstbin/make-grammar-fst.cc + +// Copyright 2018 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fst/fstlib.h" +#include "fstext/table-matcher.h" +#include "fstext/kaldi-fst-io.h" +#include "decoder/grammar-fst.h" + +template +void MakeGrammarFst(kaldi::ParseOptions po, + int32 nonterm_phones_offset, + bool write_as_grammar){ + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + std::string fst_out_str = po.GetArg(po.NumArgs()); + std::string top_fst_str = po.GetArg(1); + + ConstFst *top_tmp_fst = ConstFst::Read(top_fst_str); + std::shared_ptr top_fst(new FST(*top_tmp_fst)); + + std::vector > > pairs; + + int32 num_pairs = (po.NumArgs() - 2) / 2; + for (int32 i = 1; i <= num_pairs; i++) { + int32 nonterminal; + std::string nonterm_str = po.GetArg(2*i); + if (!ConvertStringToInteger(nonterm_str, &nonterminal) || + nonterminal <= 0) + KALDI_ERR << "Expected positive integer as nonterminal, got: " + << nonterm_str; + std::string fst_str = po.GetArg(2*i + 1); + + ConstFst *tmp_fst = ConstFst::Read(fst_str); + std::shared_ptr this_fst(new FST(*tmp_fst)); + + pairs.push_back(std::pair >( + nonterminal, this_fst)); + }; + + GrammarFstTpl *grammar_fst = new GrammarFstTpl(nonterm_phones_offset, + top_fst, + pairs); + + if (write_as_grammar) { + bool binary = true; // GrammarFst does not support non-binary write. + WriteKaldiObject(*grammar_fst, fst_out_str, binary); + } else { + VectorFst vfst; + CopyToVectorFst(grammar_fst, &vfst); + ConstFst cfst(vfst); + // We don't have a wrapper in kaldi-fst-io.h for writing type + // ConstFst, so do it manually. + bool binary = true, write_binary_header = false; // suppress the ^@B + Output ko(fst_out_str, binary, write_binary_header); + FstWriteOptions wopts(kaldi::PrintableWxfilename(fst_out_str)); + cfst.Write(ko.Stream(), wopts); + } + + KALDI_LOG << "Created grammar FST and wrote it to " + << fst_out_str; +} + + +int main(int argc, char *argv[]) { + try { + using namespace kaldi; + using namespace fst; + using kaldi::int32; + + const char *usage = + "Construct GrammarFst and write it to disk (or convert it to ConstFst\n" + "and write that to disk instead). Mostly intended for demonstration\n" + "and testing purposes (since it may be more convenient to construct\n" + "GrammarFst from code). See kaldi-asr.org/doc/grammar.html\n" + "Can also be used to prepares FSTs for this use, by calling\n" + "PrepareForGrammarFst(), which does things like adding final-probs and\n" + "making small structural tweaks to the FST\n" + "\n" + "Usage (1): make-grammar-fst [options] \\\n" + " [ ...]] \n" + "\n" + ", are the integer ids of the corresponding\n" + " user-defined nonterminal symbols (e.g. #nonterm:contact_list) in the\n" + " phones.txt file.\n" + "e.g.: make-grammar-fst --nonterm-phones-offset=317 HCLG.fst \\\n" + " 320 HCLG1.fst HCLG_grammar.fst\n" + "\n" + "Usage (2): make-grammar-fst \n" + " Prepare individual FST for compilation into GrammarFst.\n" + " E.g. make-grammar-fst HCLG.fst HCLGmod.fst. The outputs of this\n" + " will then become the arguments , , ... for usage\n" + " pattern (1).\n" + "\n" + "The --nonterm-phones-offset option is required for both usage patterns.\n"; + + + ParseOptions po(usage); + + + int32 nonterm_phones_offset = -1; + bool write_as_grammar = true; + bool make_mutable = false; + + po.Register("nonterm-phones-offset", &nonterm_phones_offset, + "Integer id of #nonterm_bos in phones.txt"); + po.Register("write-as-grammar", &write_as_grammar, "If true, " + "write as GrammarFst object; if false, convert to " + "ConstFst (readable by standard decoders) " + "and write that."); + po.Register("make-mutable", &make_mutable, "If true, " + "Make a GrammarFst using StdVectorFst as the " + "underlying FST instance type." + "Use const ConstFst otherwise."); + + po.Read(argc, argv); + + if (po.NumArgs() < 2 || po.NumArgs() % 2 != 0) { + po.PrintUsage(); + exit(1); + } + + if (nonterm_phones_offset < 0) + KALDI_ERR << "The --nonterm-phones-offset option must be supplied " + "and positive."; + + if (po.NumArgs() == 2) { + // this usage pattern calls PrepareForGrammarFst(). + VectorFst *fst = ReadFstKaldi(po.GetArg(1)); + PrepareForGrammarFst(nonterm_phones_offset, fst); + // This will write it as VectorFst; to avoid it having to be converted to + // ConstFst when read again by make-grammar-fst, you may want to pipe + // through fstconvert --fst_type=const. + WriteFstKaldi(*fst, po.GetArg(2)); + exit(0); + } + + if (make_mutable) { + MakeGrammarFst(po, nonterm_phones_offset, write_as_grammar); + } else { + MakeGrammarFst >(po, nonterm_phones_offset, write_as_grammar); + } + } catch(const std::exception &e) { + std::cerr << e.what(); + return -1; + } +} diff --git a/runtime/onnxruntime/third_party/kaldi/fstext/Makefile b/runtime/onnxruntime/third_party/kaldi/fstext/Makefile new file mode 100644 index 0000000..b76bd41 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstext/Makefile @@ -0,0 +1,30 @@ + +# make "all" the target. +all: + +# Disable linking math libs because not needed here. Just for compilation speed. +# no, it's now needed for context-fst-test. +# MATHLIB = NONE + +EXTRA_CXXFLAGS = -Wno-sign-compare + +include ../kaldi.mk + +TESTFILES = determinize-star-test \ + pre-determinize-test trivial-factor-weight-test \ + context-fst-test factor-test table-matcher-test fstext-utils-test \ + remove-eps-local-test lattice-weight-test \ + determinize-lattice-test lattice-utils-test deterministic-fst-test \ + push-special-test epsilon-property-test prune-special-test + +OBJFILES = push-special.o kaldi-fst-io.o context-fst.o grammar-context-fst.o + + +LIBNAME = kaldi-fstext + +# tree and matrix archives needed for test-context-fst +# matrix archive needed for push-special. +ADDLIBS = ../tree/kaldi-tree.a ../util/kaldi-util.a ../matrix/kaldi-matrix.a \ + ../base/kaldi-base.a + +include ../makefiles/default_rules.mk diff --git a/runtime/onnxruntime/third_party/kaldi/fstext/context-fst-test.cc b/runtime/onnxruntime/third_party/kaldi/fstext/context-fst-test.cc new file mode 100644 index 0000000..65da1bb --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/fstext/context-fst-test.cc @@ -0,0 +1,256 @@ +// fstext/context-fst-test.cc + +// Copyright 2009-2011 Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "fstext/context-fst.h" +#include "fstext/fst-test-utils.h" +#include "tree/context-dep.h" +#include "util/kaldi-io.h" +#include "base/kaldi-math.h" + +namespace fst +{ +using std::vector; +using std::cout; + +// GenAcceptorFromSequence generates a linear acceptor (identical input+output symbols) that has this +// sequence of symbols, and +template +static VectorFst *GenAcceptorFromSequence(const vector &symbols, float cost) { + typedef typename Arc::Weight Weight; + typedef typename Arc::StateId StateId; + + vector split_cost(symbols.size()+1, 0.0); // for #-arcs + end-state. + { // compute split_cost. it must sum to "cost". + std::set indices; + size_t num_indices = 1 + (kaldi::Rand() % split_cost.size()); + while (indices.size() < num_indices) indices.insert(kaldi::Rand() % split_cost.size()); + for (std::set::iterator iter = indices.begin(); iter != indices.end(); ++iter) { + split_cost[*iter] = cost / num_indices; + } + } + + VectorFst *fst = new VectorFst(); + StateId cur_state = fst->AddState(); + fst->SetStart(cur_state); + for (size_t i = 0; i < symbols.size(); i++) { + StateId next_state = fst->AddState(); + Arc arc; + arc.ilabel = symbols[i]; + arc.olabel = symbols[i]; + arc.nextstate = next_state; + arc.weight = (Weight) split_cost[i]; + fst->AddArc(cur_state, arc); + cur_state = next_state; + + } + fst->SetFinal(cur_state, (Weight)split_cost[symbols.size()]); + return fst; +} + + + +// CheckPhones is used to test the correctness of an FST that is the result of +// composition with a ContextFst. +template +static float CheckPhones(const VectorFst &linear_fst, + const vector &phone_ids, + const vector &disambig_ids, + const vector &phone_seq, + const vector > &ilabel_info, + int N, int P) { + typedef typename Arc::Label Label; + typedef typename Arc::StateId StateId; + typedef typename Arc::Weight Weight; + + assert(kaldi::IsSorted(phone_ids)); // so we can do binary_search. + + + vector input_syms; + vector output_syms; + Weight tot_cost; + bool ans = GetLinearSymbolSequence(linear_fst, &input_syms, + &output_syms, &tot_cost); + assert(ans); // should be linear. + + vector phone_seq_check; + for (size_t i = 0; i < output_syms.size(); i++) + if (std::binary_search(phone_ids.begin(), phone_ids.end(), output_syms[i])) + phone_seq_check.push_back(output_syms[i]); + + assert(phone_seq_check == phone_seq); + + vector > input_syms_long; + for (size_t i = 0; i < input_syms.size(); i++) { + Label isym = input_syms[i]; + if (ilabel_info[isym].size() == 0) continue; // epsilon. + if ( (ilabel_info[isym].size() == 1 && + ilabel_info[isym][0] <= 0) ) continue; // disambig. + input_syms_long.push_back(ilabel_info[isym]); + } + + for (size_t i = 0; i < input_syms_long.size(); i++) { + vector phone_context_window(N); // phone at pos i will be at pos P in this window. + int pos = ((int)i) - P; // pos of first phone in window [ may be out of range] . + for (int j = 0; j < N; j++, pos++) { + if (static_cast(pos) < phone_seq.size()) phone_context_window[j] = phone_seq[pos]; + else phone_context_window[j] = 0; // 0 is a special symbol that context-dep-itf expects to see + // when no phone is present due to out-of-window. context-fst knows about this too. + } + assert(input_syms_long[i] == phone_context_window); + } + return tot_cost.Value(); +} + + + + +template +static VectorFst *GenRandPhoneSeq(vector &phone_syms, + vector &disambig_syms, + typename Arc::Label subsequential_symbol, + int num_subseq_syms, + float seq_prob, + vector *phoneseq_out) { + KALDI_ASSERT(phoneseq_out != NULL); + typedef typename Arc::Label Label; + // Generate an FST that is a random phone sequence, ending + // with "num_subseq_syms" subsequential symbols. It will + // have disambiguation symbols randomly interspersed throughout. + // The number of phones is random (possibly zero). + size_t len = (kaldi::Rand() % 4) * (kaldi::Rand() % 3); // up to 3*2=6 phones. + float disambig_prob = 0.33; + phoneseq_out->clear(); + vector { + public: + using CacheImpl::PushArc; + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::Properties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheBaseImpl< CacheState >::HasStart; + using CacheBaseImpl< CacheState >::HasFinal; + using CacheBaseImpl< CacheState >::HasArcs; + + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::Weight Weight; + typedef typename A::StateId StateId; + typedef F FactorIterator; + + typedef DefaultCacheStore Store; + typedef typename Store::State State; + + struct Element { + Element() {} + + Element(StateId s, Weight w) : state(s), weight(w) {} + + StateId state; // Input state Id + Weight weight; // Residual weight + }; + + TrivialFactorWeightFstImpl(const Fst &fst, const TrivialFactorWeightOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + delta_(opts.delta), + extra_ilabel_(opts.extra_ilabel), + extra_olabel_(opts.extra_olabel) { + SetType("factor-weight"); + uint64 props = fst.Properties(kFstProperties, false); + SetProperties(FactorWeightProperties(props), kCopyProperties); + + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + } + + TrivialFactorWeightFstImpl(const TrivialFactorWeightFstImpl &impl) + : CacheImpl(impl), + fst_(impl.fst_->Copy(true)), + delta_(impl.delta_), + extra_ilabel_(impl.extra_ilabel_), + extra_olabel_(impl.extra_olabel_) { + SetType("factor-weight"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + StateId Start() { + if (!HasStart()) { + StateId s = fst_->Start(); + if (s == kNoStateId) + return kNoStateId; + StateId start = this->FindState(Element(fst_->Start(), Weight::One())); + this->SetStart(start); + } + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) { + const Element &e = elements_[s]; + Weight w; + if (e.state == kNoStateId) { // extra state inserted to represent final weights. + FactorIterator fit(e.weight); + if (fit.Done()) { // cannot be factored. + w = e.weight; // so it's final + } else { + w = Weight::Zero(); // need another transition. + } + } else { + if (e.weight != Weight::One()) { // Not a real state. + w = Weight::Zero(); + } else { // corresponds to a "real" state. + w = fst_->Final(e.state); + FactorIterator fit(w); + if (!fit.Done()) // we would have intermediate states representing this final state. + w = Weight::Zero(); + } + } + this->SetFinal(s, w); + return w; + } else { + return CacheImpl::Final(s); + } + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) + Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) + Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) + Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) + Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + + // Find state corresponding to an element. Create new state + // if element not found. + StateId FindState(const Element &e) { + typename ElementMap::iterator eit = element_map_.find(e); + if (eit != element_map_.end()) { + return (*eit).second; + } else { + StateId s = elements_.size(); + elements_.push_back(e); + element_map_.insert(std::pair(e, s)); + return s; + } + } + + // Computes the outgoing transitions from a state, creating new destination + // states as needed. + void Expand(StateId s) { + CHECK(static_cast(s) < elements_.size()); + Element e = elements_[s]; + if (e.weight != Weight::One()) { + FactorIterator fit(e.weight); + if (fit.Done()) { // Cannot be factored-> create a link to dest state directly + if (e.state != kNoStateId) { + StateId dest = FindState(Element(e.state, Weight::One())); + PushArc(s, Arc(extra_ilabel_, extra_olabel_, e.weight, dest)); + } // else we're done. This is a final state. + } else { // Can be factored. + const std::pair &p = fit.Value(); + StateId dest = FindState(Element(e.state, p.second.Quantize(delta_))); + PushArc(s, Arc(extra_ilabel_, extra_olabel_, p.first, dest)); + } + } else { // Unit weight. This corresponds to a "real" state. + CHECK(e.state != kNoStateId); + for (ArcIterator< Fst > ait(*fst_, e.state); + !ait.Done(); + ait.Next()) { + const A &arc = ait.Value(); + FactorIterator fit(arc.weight); + if (fit.Done()) { // cannot be factored->just link directly to dest. + StateId dest = FindState(Element(arc.nextstate, Weight::One())); + PushArc(s, Arc(arc.ilabel, arc.olabel, arc.weight, dest)); + } else { + const std::pair &p = fit.Value(); + StateId dest = FindState(Element(arc.nextstate, p.second.Quantize(delta_))); + PushArc(s, Arc(arc.ilabel, arc.olabel, p.first, dest)); + } + } + // See if we have to add arcs for final-states [only if final-weight is factorable]. + Weight final_w = fst_->Final(e.state); + if (final_w != Weight::Zero()) { + FactorIterator fit(final_w); + if (!fit.Done()) { + const std::pair &p = fit.Value(); + StateId dest = FindState(Element(kNoStateId, p.second.Quantize(delta_))); + PushArc(s, Arc(extra_ilabel_, extra_olabel_, p.first, dest)); + } + } + } + this->SetArcs(s); + } + + private: + // Equality function for Elements, assume weights have been quantized. + class ElementEqual { + public: + bool operator()(const Element &x, const Element &y) const { + return x.state == y.state && x.weight == y.weight; + } + }; + + // Hash function for Elements to Fst states. + class ElementKey { + public: + size_t operator()(const Element &x) const { + return static_cast(x.state * kPrime + x.weight.Hash()); + } + private: + static const int kPrime = 7853; + }; + + typedef unordered_map ElementMap; + + std::unique_ptr> fst_; + float delta_; + uint32 mode_; // factoring arc and/or final weights + Label extra_ilabel_; // ilabel of arc created when factoring final w's + Label extra_olabel_; // olabel of arc created when factoring final w's + std::vector elements_; // mapping Fst state to Elements + ElementMap element_map_; // mapping Elements to Fst state + +}; + +} // namespace internal + +/// TrivialFactorWeightFst takes as template parameter a FactorIterator as +/// defined above. The result of weight factoring is a transducer +/// equivalent to the input whose path weights have been factored +/// according to the FactorIterator. States and transitions will be +/// added as necessary. +/// This algorithm differs from the one implemented in FactorWeightFst +/// in that it does not attempt to push the extra weight forward to the +/// next state: it uses a sequence of "extra" intermediate state, and +/// outputs the remaining weight right away. This ensures that it will +/// always succeed, even for Gallic representations of FSTs that have cycles +/// with more output than input symbols. + +/// Note that the code below was modified from factor-weight.h by just +/// search-and-replacing "FactorWeight" by "TrivialFactorWeight". + + +template +class TrivialFactorWeightFst : + public ImplToFst> { + public: + friend class ArcIterator< TrivialFactorWeightFst >; + friend class StateIterator< TrivialFactorWeightFst >; + + typedef A Arc; + typedef typename A::Weight Weight; + typedef typename A::StateId StateId; + typedef DefaultCacheStore Store; + typedef typename Store::State State; + typedef internal::TrivialFactorWeightFstImpl Impl; + + explicit TrivialFactorWeightFst(const Fst &fst) + : ImplToFst(std::make_shared(fst, TrivialFactorWeightOptions())) {} + + TrivialFactorWeightFst(const Fst &fst, const TrivialFactorWeightOptions &opts) + : ImplToFst(std::make_shared(fst, opts)) {} + + // See Fst<>::Copy() for doc. + TrivialFactorWeightFst(const TrivialFactorWeightFst &fst, bool copy) + : ImplToFst(fst, copy) {} + + // Get a copy of this TrivialFactorWeightFst. See Fst<>::Copy() for further doc. + TrivialFactorWeightFst *Copy(bool copy = false) const override { + return new TrivialFactorWeightFst(*this, copy); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + TrivialFactorWeightFst &operator=(const TrivialFactorWeightFst &fst) = delete; +}; + + +// Specialization for TrivialFactorWeightFst. +template +class StateIterator< TrivialFactorWeightFst > + : public CacheStateIterator< TrivialFactorWeightFst > { + public: + explicit StateIterator(const TrivialFactorWeightFst &fst) + : CacheStateIterator< TrivialFactorWeightFst >(fst, fst.GetMutableImpl()) {} +}; + + +// Specialization for TrivialFactorWeightFst. +template +class ArcIterator< TrivialFactorWeightFst > + : public CacheArcIterator< TrivialFactorWeightFst > { + public: + typedef typename A::StateId StateId; + + ArcIterator(const TrivialFactorWeightFst &fst, StateId s) + : CacheArcIterator< TrivialFactorWeightFst>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void TrivialFactorWeightFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator< TrivialFactorWeightFst >(*this); +} + + + + +} // namespace fst + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/itf/clusterable-itf.h b/runtime/onnxruntime/third_party/kaldi/itf/clusterable-itf.h new file mode 100644 index 0000000..7ef9ae0 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/itf/clusterable-itf.h @@ -0,0 +1,97 @@ +// itf/clusterable-itf.h + +// Copyright 2009-2011 Microsoft Corporation; Go Vivace Inc. + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#ifndef KALDI_ITF_CLUSTERABLE_ITF_H_ +#define KALDI_ITF_CLUSTERABLE_ITF_H_ 1 + +#include +#include "base/kaldi-common.h" + +namespace kaldi { + + +/** \addtogroup clustering_group + @{ + A virtual class for clusterable objects; see \ref clustering for an + explanation if its function. +*/ + + + +class Clusterable { + public: + /// \name Functions that must be overridden + /// @{ + + /// Return a copy of this object. + virtual Clusterable *Copy() const = 0; + /// Return the objective function associated with the stats + /// [assuming ML estimation] + virtual BaseFloat Objf() const = 0; + /// Return the normalizer (typically, count) associated with the stats + virtual BaseFloat Normalizer() const = 0; + /// Set stats to empty. + virtual void SetZero() = 0; + /// Add other stats. + virtual void Add(const Clusterable &other) = 0; + /// Subtract other stats. + virtual void Sub(const Clusterable &other) = 0; + /// Scale the stats by a positive number f [not mandatory to supply this]. + virtual void Scale(BaseFloat f) { + KALDI_ERR << "This Clusterable object does not implement Scale()."; + } + + /// Return a string that describes the inherited type. + virtual std::string Type() const = 0; + + /// Write data to stream. + virtual void Write(std::ostream &os, bool binary) const = 0; + + /// Read data from a stream and return the corresponding object (const + /// function; it's a class member because we need access to the vtable + /// so generic code can read derived types). + virtual Clusterable* ReadNew(std::istream &os, bool binary) const = 0; + + virtual ~Clusterable() {} + + /// @} + + /// \name Functions that have default implementations + /// @{ + + // These functions have default implementations (but may be overridden for + // speed). Implementatons in tree/clusterable-classes.cc + + /// Return the objective function of the combined object this + other. + virtual BaseFloat ObjfPlus(const Clusterable &other) const; + /// Return the objective function of the subtracted object this - other. + virtual BaseFloat ObjfMinus(const Clusterable &other) const; + /// Return the objective function decrease from merging the two + /// clusters, negated to be a positive number (or zero). + virtual BaseFloat Distance(const Clusterable &other) const; + /// @} + +}; +/// @} end of "ingroup clustering_group" + +} // end namespace kaldi + +#endif // KALDI_ITF_CLUSTERABLE_ITF_H_ + diff --git a/runtime/onnxruntime/third_party/kaldi/itf/context-dep-itf.h b/runtime/onnxruntime/third_party/kaldi/itf/context-dep-itf.h new file mode 100644 index 0000000..b62bd11 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/itf/context-dep-itf.h @@ -0,0 +1,114 @@ +// itf/context-dep-itf.h + +// Copyright 2009-2011 Microsoft Corporation; Go Vivace Inc. + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#ifndef KALDI_ITF_CONTEXT_DEP_ITF_H_ +#define KALDI_ITF_CONTEXT_DEP_ITF_H_ +#include "base/kaldi-common.h" + +namespace kaldi { +/// @ingroup tree_group +/// @{ + +/// context-dep-itf.h provides a link between +/// the tree-building code in ../tree/, and the FST code in ../fstext/ +/// (particularly, ../fstext/context-dep.h). It is an abstract +/// interface that describes an object that can map from a +/// phone-in-context to a sequence of integer leaf-ids. +class ContextDependencyInterface { + public: + /// ContextWidth() returns the value N (e.g. 3 for triphone models) that says how many phones + /// are considered for computing context. + virtual int ContextWidth() const = 0; + + /// Central position P of the phone context, in 0-based numbering, e.g. P = 1 for typical + /// triphone system. We have to see if we can do without this function. + virtual int CentralPosition() const = 0; + + /// The "new" Compute interface. For typical topologies, + /// pdf_class would be 0, 1, 2. + /// Returns success or failure; outputs the pdf-id. + /// + /// "Compute" is the main function of this interface, that takes a + /// sequence of N phones (and it must be N phones), possibly + /// including epsilons (symbol id zero) but only at positions other + /// than P [these represent unknown phone context due to end or + /// begin of sequence]. We do not insist that Compute must always + /// output (into stateseq) a nonempty sequence of states, but we + /// anticipate that stateseq will always be nonempty at output in + /// typical use cases. "Compute" returns false if expansion somehow + /// failed. Normally the calling code should raise an exception if + /// this happens. We can define a different interface later in + /// order to handle other kinds of information-- the underlying + /// data-structures from event-map.h are very flexible. + virtual bool Compute(const std::vector &phoneseq, int32 pdf_class, + int32 *pdf_id) const = 0; + + /// GetPdfInfo returns a vector indexed by pdf-id, saying for each pdf which + /// pairs of (phone, pdf-class) it can correspond to. (Usually just one). + /// c.f. hmm/hmm-topology.h for meaning of pdf-class. + /// This is the old, simpler interface of GetPdfInfo(), and that this one can + /// only be called if the HmmTopology object's IsHmm() function call returns + /// true. + virtual void GetPdfInfo( + const std::vector &phones, // list of phones + const std::vector &num_pdf_classes, // indexed by phone, + std::vector > > *pdf_info) + const = 0; + + /// This function outputs information about what possible pdf-ids can + /// be generated for HMM-states; it covers the general case where + /// the self-loop pdf-class may be different from the forward-transition + /// pdf-class, so we are asking not about the set of possible pdf-ids + /// for a given (phone, pdf-class), but the set of possible ordered pairs + /// (forward-transition-pdf, self-loop-pdf) for a given (phone, + /// forward-transition-pdf-class, self-loop-pdf-class). + /// Note: 'phones' is a list of integer ids of phones, and + /// 'pdf-class-pairs', indexed by phone, is a list of pairs + /// (forward-transition-pdf-class, self-loop-pdf-class) that we can have for + /// that phone. + /// The output 'pdf_info' is indexed first by phone and then by the + /// same index that indexes each element of 'pdf_class_pairs', + /// and tells us for each pair in 'pdf_class_pairs', what is the + /// list of possible (forward-transition-pdf-id, self-loop-pdf-id) that + /// we can have. + /// This is less efficient than the other version of GetPdfInfo(). + virtual void GetPdfInfo( + const std::vector &phones, + const std::vector > > &pdf_class_pairs, + std::vector > > > *pdf_info) + const = 0; + + + /// NumPdfs() returns the number of acoustic pdfs (they are numbered 0.. NumPdfs()-1). + virtual int32 NumPdfs() const = 0; + + virtual ~ContextDependencyInterface() {}; + ContextDependencyInterface() {} + + /// Returns pointer to new object which is copy of current one. + virtual ContextDependencyInterface *Copy() const = 0; + private: + KALDI_DISALLOW_COPY_AND_ASSIGN(ContextDependencyInterface); +}; +/// @} +} // namespace Kaldi + + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/itf/decodable-itf.h b/runtime/onnxruntime/third_party/kaldi/itf/decodable-itf.h new file mode 100644 index 0000000..20934dd --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/itf/decodable-itf.h @@ -0,0 +1,122 @@ +// itf/decodable-itf.h + +// Copyright 2009-2011 Microsoft Corporation; Saarland University; +// Mirko Hannemann; Go Vivace Inc.; +// 2013 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_ITF_DECODABLE_ITF_H_ +#define KALDI_ITF_DECODABLE_ITF_H_ 1 +#include "base/kaldi-common.h" + +namespace kaldi { +/// @ingroup Interfaces +/// @{ + + +/** + DecodableInterface provides a link between the (acoustic-modeling and + feature-processing) code and the decoder. The idea is to make this + interface as small as possible, and to make it as agnostic as possible about + the form of the acoustic model (e.g. don't assume the probabilities are a + function of just a vector of floats), and about the decoder (e.g. don't + assume it accesses frames in strict left-to-right order). For normal + models, without on-line operation, the "decodable" sub-class will just be a + wrapper around a matrix of features and an acoustic model, and it will + answer the question 'what is the acoustic likelihood for this index and this + frame?'. + + For online decoding, where the features are coming in in real time, it is + important to understand the IsLastFrame() and NumFramesReady() functions. + There are two ways these are used: the old online-decoding code, in ../online/, + and the new online-decoding code, in ../online2/. In the old online-decoding + code, the decoder would do: + \code{.cc} + for (int frame = 0; !decodable.IsLastFrame(frame); frame++) { + // Process this frame + } + \endcode + and the call to IsLastFrame would block if the features had not arrived yet. + The decodable object would have to know when to terminate the decoding. This + online-decoding mode is still supported, it is what happens when you call, for + example, LatticeFasterDecoder::Decode(). + + We realized that this "blocking" mode of decoding is not very convenient + because it forces the program to be multi-threaded and makes it complex to + control endpointing. In the "new" decoding code, you don't call (for example) + LatticeFasterDecoder::Decode(), you call LatticeFasterDecoder::InitDecoding(), + and then each time you get more features, you provide them to the decodable + object, and you call LatticeFasterDecoder::AdvanceDecoding(), which does + something like this: + \code{.cc} + while (num_frames_decoded_ < decodable.NumFramesReady()) { + // Decode one more frame [increments num_frames_decoded_] + } + \endcode + So the decodable object never has IsLastFrame() called. For decoding where + you are starting with a matrix of features, the NumFramesReady() function will + always just return the number of frames in the file, and IsLastFrame() will + return true for the last frame. + + For truly online decoding, the "old" online decodable objects in ../online/ + have a "blocking" IsLastFrame() and will crash if you call NumFramesReady(). + The "new" online decodable objects in ../online2/ return the number of frames + currently accessible if you call NumFramesReady(). You will likely not need + to call IsLastFrame(), but we implement it to only return true for the last + frame of the file once we've decided to terminate decoding. +*/ +class DecodableInterface { + public: + /// Returns the log likelihood, which will be negated in the decoder. + /// The "frame" starts from zero. You should verify that NumFramesReady() > frame + /// before calling this. + virtual BaseFloat LogLikelihood(int32 frame, int32 index) = 0; + + /// Returns true if this is the last frame. Frames are zero-based, so the + /// first frame is zero. IsLastFrame(-1) will return false, unless the file + /// is empty (which is a case that I'm not sure all the code will handle, so + /// be careful). Caution: the behavior of this function in an online setting + /// is being changed somewhat. In future it may return false in cases where + /// we haven't yet decided to terminate decoding, but later true if we decide + /// to terminate decoding. The plan in future is to rely more on + /// NumFramesReady(), and in future, IsLastFrame() would always return false + /// in an online-decoding setting, and would only return true in a + /// decoding-from-matrix setting where we want to allow the last delta or LDA + /// features to be flushed out for compatibility with the baseline setup. + virtual bool IsLastFrame(int32 frame) const = 0; + + /// The call NumFramesReady() will return the number of frames currently available + /// for this decodable object. This is for use in setups where you don't want the + /// decoder to block while waiting for input. This is newly added as of Jan 2014, + /// and I hope, going forward, to rely on this mechanism more than IsLastFrame to + /// know when to stop decoding. + virtual int32 NumFramesReady() const { + KALDI_ERR << "NumFramesReady() not implemented for this decodable type."; + return -1; + } + + /// Returns the number of states in the acoustic model + /// (they will be indexed one-based, i.e. from 1 to NumIndices(); + /// this is for compatibility with OpenFst). + virtual int32 NumIndices() const = 0; + + virtual ~DecodableInterface() {} +}; +/// @} +} // namespace Kaldi + +#endif // KALDI_ITF_DECODABLE_ITF_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/itf/online-feature-itf.h b/runtime/onnxruntime/third_party/kaldi/itf/online-feature-itf.h new file mode 100644 index 0000000..3d139b4 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/itf/online-feature-itf.h @@ -0,0 +1,125 @@ +// itf/online-feature-itf.h + +// Copyright 2013 Johns Hopkins University (author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_ITF_ONLINE_FEATURE_ITF_H_ +#define KALDI_ITF_ONLINE_FEATURE_ITF_H_ 1 +#include "base/kaldi-common.h" +#include "matrix/matrix-lib.h" + +namespace kaldi { +/// @ingroup Interfaces +/// @{ + +/** + OnlineFeatureInterface is an interface for online feature processing (it is + also usable in the offline setting, but currently we're not using it for + that). This is for use in the online2/ directory, and it supersedes the + interface in ../online/online-feat-input.h. We have a slightly different + model that puts more control in the hands of the calling thread, and won't + involve waiting on semaphores in the decoding thread. + + This interface only specifies how the object *outputs* the features. + How it obtains the features, e.g. from a previous object or objects of type + OnlineFeatureInterface, is not specified in the interface and you will + likely define new constructors or methods in the derived type to do that. + + You should appreciate that this interface is designed to allow random + access to features, as long as they are ready. That is, the user + can call GetFrame for any frame less than NumFramesReady(), and when + implementing a child class you must not make assumptions about the + order in which the user makes these calls. +*/ + +class OnlineFeatureInterface { + public: + virtual int32 Dim() const = 0; /// returns the feature dimension. + + /// Returns the total number of frames, since the start of the utterance, that + /// are now available. In an online-decoding context, this will likely + /// increase with time as more data becomes available. + virtual int32 NumFramesReady() const = 0; + + /// Returns true if this is the last frame. Frame indices are zero-based, so the + /// first frame is zero. IsLastFrame(-1) will return false, unless the file + /// is empty (which is a case that I'm not sure all the code will handle, so + /// be careful). This function may return false for some frame if + /// we haven't yet decided to terminate decoding, but later true if we decide + /// to terminate decoding. This function exists mainly to correctly handle + /// end effects in feature extraction, and is not a mechanism to determine how + /// many frames are in the decodable object (as it used to be, and for backward + /// compatibility, still is, in the Decodable interface). + virtual bool IsLastFrame(int32 frame) const = 0; + + /// Gets the feature vector for this frame. Before calling this for a given + /// frame, it is assumed that you called NumFramesReady() and it returned a + /// number greater than "frame". Otherwise this call will likely crash with + /// an assert failure. This function is not declared const, in case there is + /// some kind of caching going on, but most of the time it shouldn't modify + /// the class. + virtual void GetFrame(int32 frame, VectorBase *feat) = 0; + + + /// This is like GetFrame() but for a collection of frames. There is a + /// default implementation that just gets the frames one by one, but it + /// may be overridden for efficiency by child classes (since sometimes + /// it's more efficient to do things in a batch). + virtual void GetFrames(const std::vector &frames, + MatrixBase *feats) { + KALDI_ASSERT(static_cast(frames.size()) == feats->NumRows()); + for (size_t i = 0; i < frames.size(); i++) { + SubVector feat(*feats, i); + GetFrame(frames[i], &feat); + } + } + + + // Returns frame shift in seconds. Helps to estimate duration from frame + // counts. + virtual BaseFloat FrameShiftInSeconds() const = 0; + + /// Virtual destructor. Note: constructors that take another member of + /// type OnlineFeatureInterface are not expected to take ownership of + /// that pointer; the caller needs to keep track of that manually. + virtual ~OnlineFeatureInterface() { } + +}; + + +/// Add a virtual class for "source" features such as MFCC or PLP or pitch +/// features. +class OnlineBaseFeature: public OnlineFeatureInterface { + public: + /// This would be called from the application, when you get more wave data. + /// Note: the sampling_rate is typically only provided so the code can assert + /// that it matches the sampling rate expected in the options. + virtual void AcceptWaveform(BaseFloat sampling_rate, + const VectorBase &waveform) = 0; + + /// InputFinished() tells the class you won't be providing any + /// more waveform. This will help flush out the last few frames + /// of delta or LDA features (it will typically affect the return value + /// of IsLastFrame. + virtual void InputFinished() = 0; +}; + + +/// @} +} // namespace Kaldi + +#endif // KALDI_ITF_ONLINE_FEATURE_ITF_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/itf/optimizable-itf.h b/runtime/onnxruntime/third_party/kaldi/itf/optimizable-itf.h new file mode 100644 index 0000000..1b8f54b --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/itf/optimizable-itf.h @@ -0,0 +1,51 @@ +// itf/optimizable-itf.h + +// Copyright 2009-2011 Go Vivace Inc.; Microsoft Corporation; Georg Stemmer + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. +#ifndef KALDI_ITF_OPTIMIZABLE_ITF_H_ +#define KALDI_ITF_OPTIMIZABLE_ITF_H_ + +#include "base/kaldi-common.h" +#include "matrix/matrix-lib.h" + +namespace kaldi { +/// @ingroup Interfaces +/// @{ + +/// OptimizableInterface provides +/// a virtual class for optimizable objects. +/// E.g. a class that computed a likelihood function and +/// its gradient using some parameter +/// that has to be optimized on data +/// could inherit from it. +template +class OptimizableInterface { + public: + /// computes gradient for a parameter params and returns it + /// in gradient_out + virtual void ComputeGradient(const Vector ¶ms, + Vector *gradient_out) = 0; + /// computes the function value for a parameter params + /// and returns it + virtual Real ComputeValue(const Vector ¶ms) = 0; + + virtual ~OptimizableInterface() {} +}; +/// @} end of "Interfaces" +} // end namespace kaldi + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/itf/options-itf.h b/runtime/onnxruntime/third_party/kaldi/itf/options-itf.h new file mode 100644 index 0000000..204f46d --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/itf/options-itf.h @@ -0,0 +1,49 @@ +// itf/options-itf.h + +// Copyright 2013 Tanel Alumae, Tallinn University of Technology + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_ITF_OPTIONS_ITF_H_ +#define KALDI_ITF_OPTIONS_ITF_H_ 1 +#include "base/kaldi-common.h" + +namespace kaldi { + +class OptionsItf { + public: + + virtual void Register(const std::string &name, + bool *ptr, const std::string &doc) = 0; + virtual void Register(const std::string &name, + int32 *ptr, const std::string &doc) = 0; + virtual void Register(const std::string &name, + uint32 *ptr, const std::string &doc) = 0; + virtual void Register(const std::string &name, + float *ptr, const std::string &doc) = 0; + virtual void Register(const std::string &name, + double *ptr, const std::string &doc) = 0; + virtual void Register(const std::string &name, + std::string *ptr, const std::string &doc) = 0; + + virtual ~OptionsItf() {} +}; + +} // namespace Kaldi + +#endif // KALDI_ITF_OPTIONS_ITF_H_ + + diff --git a/runtime/onnxruntime/third_party/kaldi/itf/transition-information.h b/runtime/onnxruntime/third_party/kaldi/itf/transition-information.h new file mode 100644 index 0000000..4592e8c --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/itf/transition-information.h @@ -0,0 +1,108 @@ +// itf/transition-information.h + +// Copyright 2021 NVIDIA (author: Daniel Galvez) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_ITF_TRANSITION_INFORMATION_H_ +#define KALDI_ITF_TRANSITION_INFORMATION_H_ + +#include +#include + +namespace kaldi { + +/** + * Class that abstracts out TransitionModel's methods originally used + * in the lat/ directory. By instantiating a subclass of this abstract + * class other than TransitionModel, you can use kaldi's lattice tools + * without a dependency on the hmm/ and tree/ directories. For + * example, you can consider creating a subclass that implements these + * via extracting information from Eesen's CTC T.fst object. + * + * TransitionId values must be contiguous, and starting from 1, rather + * than 0, since 0 corresponds to epsilon in OpenFST. + */ +class TransitionInformation { + public: + virtual ~TransitionInformation() {}; + /** + * Returns true if trans_id1 and trans_id2 can correspond to the + * same phone when trans_id1 immediately precedes trans_id2 (i.e., + * trans_id1 occurss at timestep t, and trans_id2 ocurs at timestep + * 2) (possibly with epsilons between trans_id1 and trans_id2) OR + * trans_id1 ocurs before trans_id2, with some number of + * trans_id_{k} values, all of which fulfill + * TransitionIdsEquivalent(trans_id1, trans_id_{k}) + * + * If trans_id1 == trans_id2, it must be the case that + * TransitionIdsEquivalent(trans_id1, trans_id2) == true + */ + virtual bool TransitionIdsEquivalent(int32_t trans_id1, int32_t trans_id2) const = 0; + /** + * Returns true if this trans_id corresponds to the start of a + * phone. + */ + virtual bool TransitionIdIsStartOfPhone(int32_t trans_id) const = 0; + /** + * Phone is a historical term, and should be understood in a wider + * sense that also includes graphemes, word pieces, etc.: any + * minimal entity in your problem domain which is represented by a + * sequence of transitions with a PDF assigned to each of them by + * the model. In this sense, Token is a better word. Since + * TransitionInformation was added to subsume TransitionModel, we + * did not want to change the call site of every + * TransitionModel::TransitionIdToPhone to + * TransitionInformation::TransitionIdToToken. + */ + virtual int32_t TransitionIdToPhone(int32_t trans_id) const = 0; + /** + * Returns true if the destination of any edge with this trans_id + * as its ilabel is a final state (or if a final state is + * epsilon-reachable from its destination state). + */ + virtual bool IsFinal(int32_t trans_id) const = 0; + /** + * Returns true if *all* of the FST edge labeled by this trans_id + * have the same start and end states. + */ + virtual bool IsSelfLoop(int32_t trans_id) const = 0; + int32_t TransitionIdToPdf(int32_t trans_id) const { + return TransitionIdToPdfArray()[trans_id]; + } + /** + * Returns the contiguous array that backs calls to + * TransitionIdToPdf(). + * + * Ideally, this would return a std::span, but it doesn't because + * kaldi doesn't support C++20 at the time this interface was + * written. + */ + virtual const std::vector& TransitionIdToPdfArray() const = 0; + int32_t NumTransitionIds() const { + return TransitionIdToPdfArray().size() - 1; + } + /** + * Return the number of distinct outputs from + * TransitionIdToPdf(). Another way to look at this is as the number + * of outputs over which your acoustic model does a softmax. + */ + virtual int32_t NumPdfs() const = 0; +}; + +} // namespace kaldi + +#endif // KALDI_TRANSITION_INFORMATION_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/lat/Makefile b/runtime/onnxruntime/third_party/kaldi/lat/Makefile new file mode 100644 index 0000000..7718f47 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/Makefile @@ -0,0 +1,24 @@ + +all: + +include ../kaldi.mk + +EXTRA_CXXFLAGS += -Wno-sign-compare + +TESTFILES = kaldi-lattice-test push-lattice-test minimize-lattice-test \ + determinize-lattice-pruned-test word-align-lattice-lexicon-test + +OBJFILES = kaldi-lattice.o lattice-functions.o \ + lattice-functions-transition-model.o word-align-lattice.o \ + phone-align-lattice.o word-align-lattice-lexicon.o sausages.o \ + push-lattice.o minimize-lattice.o determinize-lattice-pruned.o \ + confidence.o compose-lattice-pruned.o + +LIBNAME = kaldi-lat + +ADDLIBS = ../hmm/kaldi-hmm.a ../tree/kaldi-tree.a ../util/kaldi-util.a \ + ../matrix/kaldi-matrix.a ../base/kaldi-base.a + + +include ../makefiles/default_rules.mk + diff --git a/runtime/onnxruntime/third_party/kaldi/lat/arctic-weight.h b/runtime/onnxruntime/third_party/kaldi/lat/arctic-weight.h new file mode 100644 index 0000000..5c0c6d3 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/arctic-weight.h @@ -0,0 +1,153 @@ +// lat/arctic-weight.h + +// Copyright 2012 Johns Hopkins University (Author: Guoguo Chen) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#ifndef KALDI_LAT_ARCTIC_WEIGHT_H_ +#define KALDI_LAT_ARCTIC_WEIGHT_H_ + +#include "fst/float-weight.h" + +namespace fst { + +// Arctic semiring: (max, +, inf, 0) +// We define the Arctic semiring T' = (R \cup {-inf, +inf}, max, +, -inf, 0). +// The term "Arctic" came from Keith Kintzley (kintzley@jhu.edu), as opposite +// to the Tropical semiring. +template +class ArcticWeightTpl : public FloatWeightTpl { + public: + using FloatWeightTpl::Value; + + typedef ArcticWeightTpl ReverseWeight; + + ArcticWeightTpl() : FloatWeightTpl() {} + + ArcticWeightTpl(T f) : FloatWeightTpl(f) {} + + ArcticWeightTpl(const ArcticWeightTpl &w) : FloatWeightTpl(w) {} + + static const ArcticWeightTpl Zero() { + return ArcticWeightTpl(-std::numeric_limits::infinity()); } + + static const ArcticWeightTpl One() { + return ArcticWeightTpl(0.0F); } + + static const std::string &Type() { + static const std::string type = std::string("arctic") + + FloatWeightTpl::GetPrecisionString(); + return type; + } + + static ArcticWeightTpl NoWeight() { + return ArcticWeightTpl(std::numeric_limits::infinity()); + } + + bool Member() const { + // First part fails for IEEE NaN + return Value() == Value() && Value() != std::numeric_limits::infinity(); + } + + ArcticWeightTpl Quantize(float delta = kDelta) const { + if (Value() == -std::numeric_limits::infinity() || + Value() == std::numeric_limits::infinity() || + Value() != Value()) + return *this; + else + return ArcticWeightTpl(floor(Value()/delta + 0.5F) * delta); + } + + ArcticWeightTpl Reverse() const { return *this; } + + static uint64 Properties() { + return kLeftSemiring | kRightSemiring | kCommutative | + kPath | kIdempotent; + } +}; + +// Single precision arctic weight +typedef ArcticWeightTpl ArcticWeight; + +template +inline ArcticWeightTpl Plus(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2) { + return w1.Value() > w2.Value() ? w1 : w2; +} + +inline ArcticWeightTpl Plus(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2) { + return Plus(w1, w2); +} + +inline ArcticWeightTpl Plus(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2) { + return Plus(w1, w2); +} + +template +inline ArcticWeightTpl Times(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2) { + T f1 = w1.Value(), f2 = w2.Value(); + if (f1 == -std::numeric_limits::infinity()) + return w1; + else if (f2 == -std::numeric_limits::infinity()) + return w2; + else + return ArcticWeightTpl(f1 + f2); +} + +inline ArcticWeightTpl Times(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2) { + return Times(w1, w2); +} + +inline ArcticWeightTpl Times(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2) { + return Times(w1, w2); +} + +template +inline ArcticWeightTpl Divide(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2, + DivideType typ = DIVIDE_ANY) { + T f1 = w1.Value(), f2 = w2.Value(); + if (f2 == -std::numeric_limits::infinity()) + return std::numeric_limits::quiet_NaN(); + else if (f1 == -std::numeric_limits::infinity()) + return -std::numeric_limits::infinity(); + else + return ArcticWeightTpl(f1 - f2); +} + +inline ArcticWeightTpl Divide(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2, + DivideType typ = DIVIDE_ANY) { + return Divide(w1, w2, typ); +} + +inline ArcticWeightTpl Divide(const ArcticWeightTpl &w1, + const ArcticWeightTpl &w2, + DivideType typ = DIVIDE_ANY) { + return Divide(w1, w2, typ); +} + + + +} // namespace fst + +#endif // KALDI_LAT_ARCTIC_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/lat/compose-lattice-pruned.cc b/runtime/onnxruntime/third_party/kaldi/lat/compose-lattice-pruned.cc new file mode 100644 index 0000000..cc71db3 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/compose-lattice-pruned.cc @@ -0,0 +1,955 @@ +// lat/compose-lattice-pruned.cc + +// Copyright 2009-2012 Microsoft Corporation +// 2012-2013 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "lat/compose-lattice-pruned.h" +#include "lat/lattice-functions.h" + +namespace kaldi { + +/** + PrunedCompactLatticeComposer implements an algorithm for pruned composition. + It uses a heuristic (like the heuristics used in A*) to estimate the + cost to the end of a graph, of the best path that we might get if + we expand a particular transition out of a particular state. This enables + us to use a priority queue to expand arcs in the composed result in an + order roughly from most promising to least promising. + + Because some of the quantities used in the heuristic are hard to efficiently + keep updated as the composed output is incrementally added to, we + periodically recompute these quantities (c.f. RecomputePruningInfo()). + In order to prevent this periodic recomputation from dominating the time + taken to produce the lattice, we recompute these things on a schedule where, + between each computation, we allow the size of the output to grow by + a constant factor (default: 1.5). Since the time taken to do the + recomputation of quantities used in the heuristic takes time linear in the + size of the so-far existing composed output, doing so on this type of schedule + will add no more than a constant factor to the runtime. + + */ +class PrunedCompactLatticeComposer { + public: + PrunedCompactLatticeComposer( + const ComposeLatticePrunedOptions &opts, + const CompactLattice &clat, + fst::DeterministicOnDemandFst *det_fst, + CompactLattice* composed_clat); + + // Does the composition. You must call this just once per object. + void Compose(); + + private: + + // Gets the num-arcs limit for this iteration of the algorithm, which will be + // opts_.initial_num_arcs if there are currently no arcs; or otherwise + // opts_.growth_ration * the current number of arcs (subject to the + // opts_.max_arcs limit if we have already reached a final-state). This helps + // ensure that we call RecomputePruningInfo() on an appropriate schedule. + int32 GetCurrentArcLimit() const; + + // This function, called just once at the start, computes all the static + // information about the input lattice 'clat', in lat_state_info_. (however, + // the 'composed_states' members are just set to the empty vector for now. + void ComputeLatticeStateInfo(); + + // Called just once at the start, this sets up the first state in the + // composed output. + void AddFirstState(); + + // This function processes the next un-expanded transition (or final-state) + // out of the composed state numbered 'composed_state_to_expand'. + void ProcessQueueElement(int32 composed_state_to_expand); + + // This is a part of ProcessQueueElements() that has been broken out + // for clarity. it process the arc_index'th arc out of this source state. + void ProcessTransition(int32 composed_src_state, + int32 arc_index); + + // This function recomputes certain members of the ComposedStateInfo relating + // to the output states: namely, 'forward_cost', 'backward_cost' and + // 'delta_backward_cost'. In between calls to this function, we try to + // keep those quantities as accurate as possible, but they aren't + // completely accurate (see comments by their declarations for more info). + void RecomputePruningInfo(); + + // Sets '*composed_states' to a list of the states that currently + // exist in the composed output, in topologically sorted order. + // At exit, *composed_states will be a permutation of numbers + // [0, 1, ... clat_out_->NumStates() - 1], beginning with the + // start-state 0. + void GetTopsortedStateList(std::vector *composed_states) const; + + // Called from RecomputePruningInfo(), this computes all the 'forward_cost' + // and 'prev_composed_state' members of the ComposedStateInfo. + // @param [in] composed_states This is expected to be a list, + // in topological order, of all currently existing composed states, + // as produced by GetTopsortedStateList(). + void ComputeForwardCosts(const std::vector &composed_states); + + // Called from RecomputePruningInfo(), this computes all the 'backward_cost' + // members of the ComposedStateInfo. It also sets 'output_best_cost_'. + // 'composed_states' is expected to be a list, in topological order, of all + // currently existing composed states, as produced by GetTopsortedStateList(). + void ComputeBackwardCosts(const std::vector &composed_states); + + // Called from RecomputePruningInfo(), this computes all the + // 'delta_backward_cost' members of the ComposedStateInfo. 'composed_states' + // is expected to be a list, in topological order, of all currently existing + // composed states, as produced by GetTopsortedStateList(). It also computes + // the 'expected_cost_offset' values for all states, and uses them recreate + // 'composed_state_queue_'. + void ComputeDeltaBackwardCosts(const std::vector &composed_states); + + + // This struct contains information about a state of the input lattice. + struct LatticeStateInfo { + // 'backward_cost' is the total cost of the best path from this state to + // the final state in the source lattice, including the final-prob. + double backward_cost; + + // 'arc_delta_costs' is an array, one for each arc (and the final-prob, if + // present), showing how much the cost to the final-state for the best path + // starting in this state and exiting through each arc (or final-prob), + // differs from 'backward_cost'. Specifically, it contains pairs + // (delta_cost, arc_index), where delta_cost >= 0 and arc_index is + // either the index into this state's array of arcs (for arcs), or -1 + // if this represents the final-prob. + // + // 'arc_delta_costs' will be sorted, so that the first element has + // .first=0.0 and the delta-costs will be increasing order. This means that + // we expand them from the start of the array, in order to process the best + // arcs first. + // lat_state_info_[i].arc_delta_costs.size() will equal will equal + // clat_.NumStates(i), plus one if clat_.Final(i) != Zero(). + std::vector > arc_delta_costs; + + + // 'composed_states' is a list of the state-ids in the composed output + // that correspond to this state in the lattice, so we expect + // that composed_state_info_[composed_states[i]].lat_state + // equals the index of this lattice state. This is helpful in + // accessing the states in the output lattice in topological + // order. + std::vector composed_states; + }; + + // This struct contains information about a state of the composed + // output. + struct ComposedStateInfo { + // 'lat_state' and 'lm_state' form the pair of states in the two FSTs + // that this state corresponds to. The unordered map 'pair_to_state_' maps these + // state-pairs to the index of the composed state (the state-index in clat_out_). + int32 lat_state; + int32 lm_state; + + // the number of arcs on the path from the start state to this state, in the + // composed lattice, by which this state was first reached. + int32 depth; + + // If you have just called RecomputePruningInfo(), then + // 'forward_cost' will equal the cost of the best path from the start-state + // to this state, in the composed output. + // + // In between calls to RecomputePruningInfo() it may not always be fully up + // to date; instead it will be an upper bound on what it would be if you had + // just called RecomputePruningInfo(); it will be the cost of some path but + // not necessarily the best path. + double forward_cost; + + // 'backward_cost' relates to the cost from this state to the final-state in + // the composed FST. (By this we mean, more precisely, the cost of the best + // path from this state to any final state, including the final-prob in that + // final state). + // + // If we have just called RecomputePruningInfo(), then the following rules + // specify what the value of 'backward_cost' will be: + // - If a final state is reachable from this state, backward_cost + // will contain the cost of the best path from this state to the + // final state (including the corresponding final-prob). + // - Otherwise, it will contain +infinity. + // + // If RecomputePruningInfo() has not just been called), it may contain any + // value that is >= the value the the rules above specify (since, for + // existing states, we don't modify it between calls to + // RecomputePruningInfo()). For states that have been added since + // RecomputePruningInfo() was last called, it will be infinity. + double backward_cost; + + // 'delta_backward_cost' is a quantity that is used in our heuristic of the + // cost to an end-state from expanding a previously un-expanded arc. It is + // an estimate of the difference between the backward cost in this struct + // (this->backward_cost) and the backward cost in the input lattice + // (LatticeStateInfo::backward_cost). This term reflects the anticipated + // extra costs from 'det_fst_', which, while fairly close to zero, may be + // substantial enough to want to correct for. + // + // The following is the value that 'delta_backward_cost' will have if + // RecomputePruningInfo() has just been called: + // - If backward_cost is finite (this state in the composed result can + // reach the final state via currently expanded states), then + // delta_backward_cost is this->backward_cost minus + // lat_state_info_[lat_state].backward_cost. (It will mostly, but + // not always, be <= 0, reflecting that the new LM is better than + // the old LM). + // - On the other hand, if backward_cost is infinite: delta_backward_cost + // is set to the delta_backward_cost of the previous state on the best + // path from the start state of the composed result to this state (or + // zero if this is the start state). + // + // If RecomputePruningInfo() has not just been called, then: + // - For states created since RecomputePruningInfo() was last called, + // delta_backward_cost will be inherited from the source state from + // which the new state was expanded. + // - For other states, delta_backward_cost will be unchanged since + // RecomputePruningInfo() was last called. + // The above rules may make the delta_backward_cost a less accurate, but + // still probably reasonable, heuristic. What it is a heuristic for, + // is: if we were to successfully reach an end-state of the composed output + // from this state, what would be the resulting backward_cost + // minus lat_state_info_[lat_state].backward_cost. + BaseFloat delta_backward_cost; + + // 'prev_composed_state' is the previous state on the best path from + // the start-state to the current state (or -1 if this is the start state). + // It is computed in RecomputePruningInfo() when setting up 'forward_cost', + // and then used to compute delta_backward_cost. It is not otherwise + // used. + int32 prev_composed_state; + + // 'sorted_arc_index' is an index into the 'arc_delta_costs' array which is + // a member of the LatticeStateInfo object corresponding to the lattice + // state 'lat_state'. It corresponds to the next arc (or final-prob) out of + // the input lattice that we have yet to expand in the composition; or -1 if + // we have expanded all of them. When we first reach a composed state, + // 'sorted_arc_index' will be zero; then it will increase one at a time as + // we expand arcs until either the composition terminates or we have + // expanded all the arcs and it becomes -1. + int32 sorted_arc_index; + + // 'arc_delta_cost' is a derived quantity that we store here for easier + // access. Suppose this_lat_info is lat_state_info_[lat_state]; then + // if sorted_arc_index >= 0, then: + // arc_delta_cost == this_lat_info.arc_delta_costs[sorted_arc_index].first + // else: arc_delta_cost == +infinity. + // + // what 'arc_delta_cost' represents (or is a heuristic for), is the expected + // cost of a path to the final-state leaving through the arc we're about to + // expand, minus the expected cost of any path to the final-state starting + // from this state. + BaseFloat arc_delta_cost; + + // view 'expected_cost_offset' a phantom field of this struct, that has + // been optimized out. It's clearer if we act like it's a field, but + // actually it's not stored. + // + // 'expected_cost_offset' is a derived quantity that reflects the expected + // cost (according to our heuristic) of the best path we might encounter + // when expanding the next previously unseen arc (or final-prob), + // corresponding to 'sorted_arc_index'. (This is the expected cost of a + // successful path, from the beginning to the end of the lattice, but + // constrained to be a path that contains the arc we're about to expand). + // + // The 'offset' part is about subtracting the best cost of the lattice, so we + // can cast to float without too much loss of accuracy: + // expected_cost_offset = expected_cost - lat_best_cost_. + // + // We define expected_cost_offset by defining the 'expected_cost' part; + // for clarity: + // First, let lat_backward_cost equal the backward_cost of the LatticeStateInfo + // corresponding to 'lat_state', i.e. + // lat_backward_cost = lat_state_info_[lat_state].backward_cost. Then: + // expected_cost = forward_cost + lat_backward_cost + + // delta_backward_cost + arc_delta_cost. + // expected_cost_offset will always equal the above minus lat_best_cost_. + // + // The formula for expected_cost above is a pretty good heuristic for what + // the cost to the end-state will be. If the costs in det_fst_ were zero, + // then the expression (forward_cost + lat_backward_cost + arc_delta_cost) + // would be exact, and we would expand things in the ideal, best-first + // order. "delta_backward_cost" is a reasonable approximation for the extra + // costs from 'det_fst_'. + // BaseFloat expected_cost_offset; + }; + + // This bool variable is initialized to false, and will be updated to true + // the first time a Final() function is called on the det_fst_. Then we will + // immediately call RecomputeRruningInfo() so that the output_best_cost_ is + // changed from +inf to a finite value, to be used in beam search. This is the + // only time the RecomputeRruningInfo() function is called manually; otherwise + // it always follows an automatic schedule based on the num-arcs of the output + // lattice. + bool output_reached_final_; + + // This variable, which we set initially to -1000, makes sure that in the + // beginning of the algorithm, we always prioritize exploring the lattice + // in a depth-first way. Once we find a path reaching a final state, this + // variable will be reset to 0. + // The reason we do this is because the beam-search depends on a good estimate + // of the composed-best-cost, which before we reach a final state, we instead + // borrow the value from best-cost from the input lattice, which is usually + // systematically worse than the RNNLM scores, and makes the algorithm spend + // a lot of time before reaching any final state, especially if the input + // lattices are large. + float depth_penalty_; + const ComposeLatticePrunedOptions &opts_; + const CompactLattice &clat_in_; + fst::DeterministicOnDemandFst *det_fst_; + CompactLattice *clat_out_; + + // This counter keeps track of the number of arcs in the output lattice + // clat_out_. When it exceeds max_arcs, + int32 num_arcs_out_; + + std::vector lat_state_info_; + + // 'lat_best_cost' is the cost of the best path in the input lattice, + // equal to lat_state_info_[0].backward_cost (we check that 0 is the + // start state in the input lattice). + double lat_best_cost_; + + // 'output_best_cost_' is the cost of the best successful path in the output + // lattice 'clat_out_'; or +infinity if 'clat_out_' does not yet have any + // successful paths. It is updated only when RecomputePruningInfo() is + // called. + double output_best_cost_; + + + // current_cutoff_ is a value used in deciding which composed states + // need to be included in the queue. Each time RecomputePruningInfo() + // called, current_cutoff_ is set to + // (output_best_cost_ - lat_best_cost_ + opts_.lattice_compose_beam). + // It will be +infinity if the output lattice doesn't yet have any + // successful paths. It decreases with time. You can compare the + // phantom 'expected_cost_offset' members of ComposedStateInfo with this + // value; if they are more than this value, then there is no need + // to enter the corresponding state into the queue. + BaseFloat current_cutoff_; + + typedef std::priority_queue, + std::vector >, + std::greater > > QueueType; + + // composed_state_queue_ is a priority queue of the composed states + // that we are intending to expand. It contains pairs + // (expected_cost_offset, composed_state_index), + // where expected_cost_offset == the phantom variable + // composed_state_info_[composed_state_index].expected_cost_offset. + // We process the states from lowest cost first. + // Every time RecomputePruningInfo() is called, this is cleared and repopulated + // (since the states' expected_cost_offset values may change), and in between + // calls to RecomputePruningInfo(), we do insert elements for newly created + // states. + QueueType composed_state_queue_; + + + std::vector composed_state_info_; + + // This maps a pair (lat_state, lm_state) to the index of the + // state in the composed FST. That would correspond to a state-id in + // clat_out_, and also to an index into 'composed_state_info_'. + unordered_map, + int32, PairHasher > pair_to_state_; + + // This contains the set of state-indexes of the input lattice that already + // have states in the composed output (i.e. is in accessed_lat_states_ if and + // only if !lat_state_info_[i].composed_states.empty(). The point is to be + // able to enumerate, in order or in reverse order, just those states in the + // lattice that appear in the composed output (it's an efficiency thing that + // will matter more for early iterations of the composition, when we need + // to access the output lattice in topological order). + std::set accessed_lat_states_; +}; + + +void PrunedCompactLatticeComposer::GetTopsortedStateList( + std::vector *composed_states) const { + composed_states->clear(); + composed_states->reserve(clat_out_->NumStates()); + std::set::const_iterator iter = accessed_lat_states_.begin(), + end = accessed_lat_states_.end(); + for (; iter != end; ++iter) { + int32 lat_state = *iter; + const LatticeStateInfo &input_lat_info = lat_state_info_[lat_state]; + composed_states->insert(composed_states->end(), + input_lat_info.composed_states.begin(), + input_lat_info.composed_states.end()); + } + KALDI_ASSERT((*composed_states)[0] == 0 && + static_cast(composed_states->size()) == + clat_out_->NumStates()); +} + +int32 PrunedCompactLatticeComposer::GetCurrentArcLimit() const { + int32 current_num_arcs = num_arcs_out_; + if (current_num_arcs == 0) { + return opts_.initial_num_arcs; + } else { + KALDI_ASSERT(opts_.growth_ratio > 1.0); + int32 ans = static_cast(current_num_arcs * + opts_.growth_ratio); + if (ans == current_num_arcs) // make sure the target increases. + ans = current_num_arcs + 1; + // if we have already reached a final state, then + // apply the max_arcs limit. + if (output_best_cost_ - output_best_cost_ == 0.0 && + ans > opts_.max_arcs) + ans = opts_.max_arcs; + return ans; + } + +} + + +void PrunedCompactLatticeComposer::RecomputePruningInfo() { + std::vector all_composed_states; + GetTopsortedStateList(&all_composed_states); + ComputeForwardCosts(all_composed_states); + ComputeBackwardCosts(all_composed_states); + ComputeDeltaBackwardCosts(all_composed_states); +} + +void PrunedCompactLatticeComposer::ComputeForwardCosts( + const std::vector &composed_states) { + KALDI_ASSERT(composed_states[0] == 0); + + // Note: when we initialized composed_state_info_[0] + // we set forward_cost = 0.0, prev_composed_state = -1. + + std::vector::iterator + state_iter = composed_state_info_.begin(), + state_end = composed_state_info_.end(); + + state_iter->depth = 0; // start state has depth 0 + ++state_iter; // Skip over the start state. + // Set all other forward_cost fields to infinity and prev_composed_state to + // -1. + for (; state_iter != state_end; ++state_iter) { + state_iter->forward_cost = std::numeric_limits::infinity(); + state_iter->prev_composed_state = -1; + } + + std::vector::const_iterator state_index_iter = composed_states.begin(), + state_index_end = composed_states.end(); + for (; state_index_iter != state_index_end; ++state_index_iter) { + int32 composed_state_index = *state_index_iter; + const ComposedStateInfo &info = composed_state_info_[ + composed_state_index]; + double forward_cost = info.forward_cost; + // The next line is a check for infinity. If infinities have appeared, it + // either means there is a bug in the algorithm or there were infinities or + // NaN's in the lattice. + KALDI_ASSERT(forward_cost - forward_cost == 0.0); + fst::ArcIterator aiter(*clat_out_, + composed_state_index); + for (; !aiter.Done(); aiter.Next()) { + const CompactLatticeArc &arc = aiter.Value(); + double arc_cost = ConvertToCost(arc.weight), + next_forward_cost = forward_cost + arc_cost; + ComposedStateInfo &next_info = composed_state_info_[arc.nextstate]; + if (next_info.forward_cost > next_forward_cost) { + next_info.forward_cost = next_forward_cost; + next_info.prev_composed_state = composed_state_index; + next_info.depth = composed_state_info_[composed_state_index].depth + 1; + } + } + } +} + +void PrunedCompactLatticeComposer::ComputeBackwardCosts( + const std::vector &composed_states) { + // Access the composed states in reverse topological order from latest to + // earliest. + std::vector::const_reverse_iterator iter = composed_states.rbegin(), + end = composed_states.rend(); + for (; iter != end; ++iter) { + int32 composed_state_index = *iter; + ComposedStateInfo &info = composed_state_info_[composed_state_index]; + double backward_cost = + ConvertToCost(clat_out_->Final(composed_state_index)); + fst::ArcIterator aiter(*clat_out_, + composed_state_index); + for (; !aiter.Done(); aiter.Next()) { + const CompactLatticeArc &arc = aiter.Value(); + double arc_cost = ConvertToCost(arc.weight), + next_backward_cost = composed_state_info_[arc.nextstate].backward_cost, + this_backward_cost = arc_cost + next_backward_cost; + if (this_backward_cost < backward_cost) + backward_cost = this_backward_cost; + } + // It's OK if at this point, backward_cost is still +infinity. This means + // that this state cannot reach the end yet, which means we have not yet + // expanded any path from this state all the way to a final-state of the + // output. + info.backward_cost = backward_cost; + } + output_best_cost_ = composed_state_info_[0].backward_cost; + // See the declaration of current_cutoff_ for more information. Note: on + // early iterations, before any path reaches a final state of the composed + // lattice, current_cutoff_ may be +infinity, and this is OK. + current_cutoff_ = + output_best_cost_ - lat_best_cost_ + opts_.lattice_compose_beam; +} + +void PrunedCompactLatticeComposer::ComputeDeltaBackwardCosts( + const std::vector &composed_states) { + + int32 num_states = clat_out_->NumStates(); + for (int32 composed_state_index = 0; composed_state_index < num_states; + ++composed_state_index) { + ComposedStateInfo &info = composed_state_info_[composed_state_index]; + int32 lat_state = info.lat_state; + // Note: delta_backward_cost will be +infinity at this stage if the + // backward_cost was +infinity. This is OK; we'll set them all to + // finite values later in this function. + info.delta_backward_cost = + info.backward_cost - lat_state_info_[lat_state].backward_cost + info.depth * depth_penalty_; + } + + // 'queue_elements' is a list of items (expected_cost_offset, + // composed_state_index) that we are going to add to composed_state_queue_, + // after clearing it. It's more efficient to accumulate them as a vector + // and add them all at once, than adding them one by one (search online for + // "heapify" if this seems confusing). + std::vector > queue_elements; + queue_elements.reserve(num_states); + + double lat_best_cost = lat_best_cost_; + BaseFloat current_cutoff = current_cutoff_; + std::vector::const_iterator iter = composed_states.begin(), + end = composed_states.end(); + for (; iter != end; ++iter) { + int32 composed_state_index = *iter; + ComposedStateInfo &info = composed_state_info_[composed_state_index]; + if (info.delta_backward_cost - info.delta_backward_cost != 0) { + // if info.delta_backward_cost is +infinity... + int32 prev_composed_state = info.prev_composed_state; + if (prev_composed_state < 0) { + KALDI_ASSERT(composed_state_index == 0); + info.delta_backward_cost = 0.0; + } else { + const ComposedStateInfo &prev_info = + composed_state_info_[prev_composed_state]; + // Check that prev_info.delta_backward_cost is finite. + KALDI_ASSERT(prev_info.delta_backward_cost - + prev_info.delta_backward_cost == 0.0); + info.delta_backward_cost = prev_info.delta_backward_cost + depth_penalty_; + } + } + double lat_backward_cost = lat_state_info_[info.lat_state].backward_cost; + // See the formula by where expected_cost_offset is declared in the + // struct for explanation. + BaseFloat expected_cost_offset = + info.forward_cost + lat_backward_cost + info.delta_backward_cost + + info.arc_delta_cost - lat_best_cost; + // If info.expected_cost_offset were real, we'd set it here: + //info.expected_cost_offset = expected_cost_offset; + + // At this point expected_cost_offset may be infinite, if arc_delta_cost was + // infinite (reflecting that we processed all the arcs, and the final-state + // if applicable, of the lattice state corresponding to this composed state. + if (expected_cost_offset < current_cutoff) { + queue_elements.push_back(std::pair( + expected_cost_offset, composed_state_index)); + } + } + + // Reinitialize composed_state_queue_ from 'queue_elements'. + QueueType temp_queue(queue_elements.begin(), queue_elements.end()); + composed_state_queue_.swap(temp_queue); +} + +void PrunedCompactLatticeComposer::ComputeLatticeStateInfo() { + KALDI_ASSERT(clat_in_.Properties(fst::kTopSorted, true) == + fst::kTopSorted && clat_in_.NumStates() > 0 && + clat_in_.Start() == 0); + int32 num_lat_states = clat_in_.NumStates(); + lat_state_info_.resize(num_lat_states); + + for (int32 s = num_lat_states - 1; s >= 0; s--) { + LatticeStateInfo &info = lat_state_info_[s]; + std::vector > arc_costs; + double backward_cost = ConvertToCost(clat_in_.Final(s)); + if (backward_cost != std::numeric_limits::infinity()) + arc_costs.push_back(std::pair(backward_cost, -1)); + fst::ArcIterator aiter(clat_in_, s); + int32 arc_index = 0; + for (; !aiter.Done(); aiter.Next(), ++arc_index) { + const CompactLatticeArc &arc = aiter.Value(); + KALDI_ASSERT(arc.nextstate > s); + backward_cost = lat_state_info_[arc.nextstate].backward_cost + + ConvertToCost(arc.weight); + KALDI_ASSERT(backward_cost - backward_cost == 0.0 && + "Possibly not all states of input lattice are co-accessible?"); + arc_costs.push_back(std::pair(backward_cost, arc_index)); + } + std::sort(arc_costs.begin(), arc_costs.end()); + KALDI_ASSERT(!arc_costs.empty() && + "Possibly not all states of input lattice are co-accessible?"); + backward_cost = arc_costs[0].first; + info.backward_cost = backward_cost; // this is the state's backward_cost, + // reflecting the best path to the end. + info.arc_delta_costs.resize(arc_costs.size()); + std::vector >::const_iterator + src_iter = arc_costs.begin(), src_end = arc_costs.end(); + std::vector >::iterator + dest_iter = info.arc_delta_costs.begin(); + for (; src_iter != src_end; ++src_iter, ++dest_iter) { + dest_iter->first = BaseFloat(src_iter->first - backward_cost); + dest_iter->second = src_iter->second; + } + } + lat_best_cost_ = lat_state_info_[0].backward_cost; +} + +PrunedCompactLatticeComposer::PrunedCompactLatticeComposer( + const ComposeLatticePrunedOptions &opts, + const CompactLattice &clat_in, + fst::DeterministicOnDemandFst *det_fst, + CompactLattice* composed_clat): output_reached_final_(false), + opts_(opts), clat_in_(clat_in), det_fst_(det_fst), + clat_out_(composed_clat), + num_arcs_out_(0), + output_best_cost_(std::numeric_limits::infinity()), + current_cutoff_(std::numeric_limits::infinity()) { + clat_out_->DeleteStates(); + depth_penalty_ = -1000; +} + + +void PrunedCompactLatticeComposer::AddFirstState() { + int32 state_id = clat_out_->AddState(); + clat_out_->SetStart(state_id); + KALDI_ASSERT(state_id == 0); + composed_state_info_.resize(1); + ComposedStateInfo &composed_state = composed_state_info_[0]; + composed_state.lat_state = 0; + composed_state.lm_state = det_fst_->Start(); + composed_state.depth = 0; + composed_state.forward_cost = 0.0; + composed_state.backward_cost = std::numeric_limits::infinity(); + composed_state.delta_backward_cost = 0.0; + composed_state.prev_composed_state = -1; + composed_state.sorted_arc_index = 0; + composed_state.arc_delta_cost = 0.0; // the first arc_delta_cost is always 0.0 + // due to sorting; no need to look it up. + lat_state_info_[0].composed_states.push_back(state_id); + accessed_lat_states_.insert(state_id); + pair_to_state_[std::pair(0, det_fst_->Start())] = state_id; + + BaseFloat expected_cost_offset = 0.0; // the formula simplifies to zero + // in this case. + composed_state_queue_.push( + std::pair(expected_cost_offset, + state_id)); // actually (0.0, 0). + +} + + +void PrunedCompactLatticeComposer::ProcessQueueElement( + int32 src_composed_state) { + KALDI_ASSERT(static_cast(src_composed_state) < + composed_state_info_.size()); + + ComposedStateInfo &src_composed_state_info = composed_state_info_[ + src_composed_state]; + int32 lat_state = src_composed_state_info.lat_state; + const LatticeStateInfo &lat_state_info = + lat_state_info_[lat_state]; + + int32 sorted_arc_index = src_composed_state_info.sorted_arc_index, + num_sorted_arcs = lat_state_info.arc_delta_costs.size(); + // note: num_sorted_arcs will be the number of arcs from this + // lattice state; plus one if there is a final-prob. + KALDI_ASSERT(sorted_arc_index >= 0); + + { // this block update the state's 'sorted_arc_index', 'arc_delta_cost' and + // 'expected_cost_offset' to reflect the fact that (by the time we exit from + // this function) we will have processed this arc (or the final-prob); + // it also re-inserts this state into the queue, if appropriate. + BaseFloat expected_cost_offset; + if (sorted_arc_index + 1 == num_sorted_arcs) { + src_composed_state_info.sorted_arc_index = -1; + src_composed_state_info.arc_delta_cost = + std::numeric_limits::infinity(); + expected_cost_offset = + std::numeric_limits::infinity(); + } else { + src_composed_state_info.sorted_arc_index = sorted_arc_index + 1; + src_composed_state_info.arc_delta_cost = + lat_state_info.arc_delta_costs[sorted_arc_index+1].first; + expected_cost_offset = + (src_composed_state_info.forward_cost + + lat_state_info.backward_cost + + src_composed_state_info.delta_backward_cost + + src_composed_state_info.arc_delta_cost - lat_best_cost_); + } + // We do '<' here rather than '<=', so that if current_cutoff_ is infinity + // and expected_cost_offset is infinity (because we've exhausted all the + // transitions from this state, and sorted_arc_index is now -1), we don't + // add this element to the queue. + if (expected_cost_offset < current_cutoff_) { + // this state has another exit arc (or final prob) that is good + // enough to re-enter into the queue. Note: if we are processing + // an arc out of this state and the destination state is new, + // we may also add something new to the queue at that time. + + // the following call should be equivalent to + // composed_state_queue_.push(std::pair(...)) with + // the same pair of args. + composed_state_queue_.emplace( + expected_cost_offset, src_composed_state); + } + } + + int32 arc_index = lat_state_info.arc_delta_costs[sorted_arc_index].second; + if (arc_index < 0) { // This (arc_index == -1) means it is not really an arc + // index; it's a final-prob. + int32 lm_state = src_composed_state_info.lm_state; + BaseFloat lm_final_cost = det_fst_->Final(lm_state).Value(); + if (lm_final_cost != std::numeric_limits::infinity()) { + // If there is a final-prob on this LM state (note: there always will be + // for conventional language models), then add the final-prob of this + // state... + CompactLattice::Weight final_weight = clat_in_.Final(lat_state); + // assume 'final_weight' is not Zero(); otherwise the final-prob should + // not have been present in 'arc_delta_costs'. + Lattice::Weight final_lat_weight = final_weight.Weight(); + final_lat_weight.SetValue1(final_lat_weight.Value1() + + lm_final_cost); + final_weight.SetWeight(final_lat_weight); + clat_out_->SetFinal(src_composed_state, final_weight); + double final_cost = ConvertToCost(final_lat_weight); + if (final_cost < src_composed_state_info.backward_cost) + src_composed_state_info.backward_cost = final_cost; + if (!output_reached_final_) { + output_reached_final_ = true; + depth_penalty_ = 0.0; + RecomputePruningInfo(); + } + } + } else { + // It really was an arc. This code is very complicated, so we make it its + // own function. + ProcessTransition(src_composed_state, arc_index); + } +} + +void PrunedCompactLatticeComposer::ProcessTransition(int32 src_composed_state, + int32 arc_index) { + // Make src_composed_state a const pointer not a reference, as we may have to + // modify the pointer if composed_state_info_ is resized. + const ComposedStateInfo *src_info = &(composed_state_info_[ + src_composed_state]); + int32 src_lat_state = src_info->lat_state; + // Get the arc we are going to expand. + fst::ArcIterator aiter(clat_in_, src_lat_state); + aiter.Seek(arc_index); + const CompactLatticeArc &lat_arc = aiter.Value(); + // Note: this code is for CompactLatticeArc, in which the ilabel and olabel + // are the same, but we're writing it in such a way that it will naturally + // generalize to LatticeArc, so there are separate variables for the ilabel + // and the olabel. + int32 dest_lat_state = lat_arc.nextstate, + ilabel = lat_arc.ilabel, + olabel = lat_arc.olabel; + // Note: we expect that ilabel == olabel, since this is a CompactLattice, but this + // may not be so if we extend this to work with Lattice. + fst::StdArc lm_arc; + + // the input lattice might have epsilons + if (olabel == 0) { + lm_arc.ilabel = 0; + lm_arc.olabel = 0; + lm_arc.nextstate = src_info->lm_state; + lm_arc.weight = fst::StdArc::Weight(0.0); + } else if (!det_fst_->GetArc(src_info->lm_state, olabel, &lm_arc)) { + // for normal language models we don't expect this to happen, but the + // appropriate behavior is to do nothing; the composed arc does not exist, + // so there is no arc to add and no new state to create. + return; + } + int32 dest_lm_state = lm_arc.nextstate; + // The following assertion is necessary because CompactLattice cannot support + // different ilabel vs. olabel; and also it's an expectation about + // language-models. + KALDI_ASSERT(lm_arc.ilabel == lm_arc.olabel); + + LatticeStateInfo &dest_lat_state_info = + lat_state_info_[dest_lat_state]; + + int32 dest_composed_state; + ComposedStateInfo *dest_info; + + { // The next block works out 'dest_composed_state' and + // 'dest_info', and if the destination state did not already + // exist, creates a new composed state. + typedef std::unordered_map, int32, + PairHasher > MapType; + int32 new_composed_state = clat_out_->NumStates(); + std::pair, int32> value( + std::pair(dest_lat_state, dest_lm_state), new_composed_state); + std::pair ret = + pair_to_state_.insert(value); + if (ret.second) { + // Successfully inserted: this dest-state did not already exist. Most of + // the rest of this block deals with the consequences of adding a new + // state. + int32 ans = clat_out_->AddState(); + KALDI_ASSERT(ans == new_composed_state); + dest_composed_state = new_composed_state; + composed_state_info_.resize(dest_composed_state + 1); + dest_info = &(composed_state_info_[dest_composed_state]); + // Re-assign src_composed_state as the vector might have been reallocated. + src_info = &(composed_state_info_[src_composed_state]); + if (dest_lat_state_info.composed_states.empty()) + accessed_lat_states_.insert(dest_lat_state); + dest_lat_state_info.composed_states.push_back(new_composed_state); + dest_info->lat_state = dest_lat_state; + dest_info->lm_state = dest_lm_state; + dest_info->depth = src_info->depth + 1; + dest_info->forward_cost = + src_info->forward_cost + + ConvertToCost(lat_arc.weight) + lm_arc.weight.Value(); + dest_info->backward_cost = + std::numeric_limits::infinity(); + dest_info->delta_backward_cost = + src_info->delta_backward_cost + dest_info->depth * depth_penalty_; + // The 'prev_composed_state' field will not be read again until after it's + // overwritten; we set it as below only for debugging purposes (the + // negation is also for debugging purposes). + dest_info->prev_composed_state = -src_composed_state; + dest_info->sorted_arc_index = 0; + dest_info->arc_delta_cost = 0.0; + // Note: in the expression below, which can be understood with reference + // to the comment by the declaration of the phantom variable + // 'expected_cost_offset', 'arc_delta_cost' is known to equal 0.0 so it + // has been removed. + BaseFloat expected_cost_offset = + (dest_info->forward_cost + + dest_lat_state_info.backward_cost + + dest_info->delta_backward_cost - + lat_best_cost_); + if (expected_cost_offset < current_cutoff_) { + // the following call should be equivalent to + // composed_state_queue_.push(std::pair(...)) with + // the same pair of args. + composed_state_queue_.emplace(expected_cost_offset, + dest_composed_state); + } + } else { // the destination composed state already existed. + dest_composed_state = ret.first->second; + dest_info = &(composed_state_info_[dest_composed_state]); + } + } + // Add the arc from the src to dest state in the composed output. + CompactLatticeArc new_arc; + new_arc.nextstate = dest_composed_state; + // Actually the ilabel and olabel are the same, but writing it this way will + // generalize better to type Lattice if we need that later. + new_arc.ilabel = ilabel; + new_arc.olabel = olabel; + new_arc.weight = lat_arc.weight; + // 'weight' is the weight part, as opposed to the string part. + LatticeArc::Weight weight = new_arc.weight.Weight(); + // include the LM-arc's weight in the weight of the new arc. + weight.SetValue1(fst::Times(weight.Value1(), lm_arc.weight).Value()); + new_arc.weight.SetWeight(weight); + clat_out_->AddArc(src_composed_state, new_arc); + num_arcs_out_++; +} + +static int32 TotalNumArcs(const CompactLattice &clat) { + int32 num_states = clat.NumStates(), + num_arcs = 0; + for (int32 s = 0; s < num_states; s++) + num_arcs += clat.NumArcs(s); + return num_arcs; +} + + +void PrunedCompactLatticeComposer::Compose() { + if (clat_in_.NumStates() == 0) { + KALDI_WARN << "Input lattice to composition is empty."; + return; + } + ComputeLatticeStateInfo(); + AddFirstState(); + // while (we have not reached final state || + // num-arcs produced < target num-arcs) { ... + while (output_best_cost_ == std::numeric_limits::infinity() || + num_arcs_out_ < opts_.max_arcs) { + RecomputePruningInfo(); + int32 this_iter_arc_limit = GetCurrentArcLimit(); + while (num_arcs_out_ < this_iter_arc_limit && + !composed_state_queue_.empty()) { + int32 src_composed_state = composed_state_queue_.top().second; + composed_state_queue_.pop(); + ProcessQueueElement(src_composed_state); + } + if (composed_state_queue_.empty()) + break; + } + + fst::Connect(clat_out_); + TopSortCompactLatticeIfNeeded(clat_out_); + + if (GetVerboseLevel() >= 2) { + int32 num_arcs_in = TotalNumArcs(clat_in_), + orig_num_arcs_out = num_arcs_out_, + num_arcs_out = TotalNumArcs(*clat_out_), + num_states_in = clat_in_.NumStates(), + orig_num_states_out = composed_state_info_.size(), + num_states_out = clat_out_->NumStates(); + std::ostringstream os; + os << "Input lattice had " << num_arcs_in << '/' << num_states_in + << " arcs/states; output lattice has " << num_arcs_out << '/' + << num_states_out; + if (num_arcs_out != orig_num_arcs_out) { + os << " (before pruning: " << orig_num_arcs_out << '/' + << orig_num_states_out << ")"; + } + if (!composed_state_queue_.empty()) { + // Below, composed_state_queue_.top().first + lat_best_cost is an + // expected-cost of the best path from the composed output that we *did + // not* expand. This, minus the best cost in the output compact lattice, + // can be interpreted as the beam that we effecctively pruned the output + // lattice to. + BaseFloat effective_beam = + composed_state_queue_.top().first + lat_best_cost_ - output_best_cost_; + os << ". Effective beam was " << effective_beam; + } + KALDI_VLOG(2) << os.str(); + } + + if (clat_out_->NumStates() == 0) { + KALDI_WARN << "Composed lattice has no states: something went wrong."; + } +} + +void ComposeCompactLatticePruned( + const ComposeLatticePrunedOptions &opts, + const CompactLattice &clat, + fst::DeterministicOnDemandFst *det_fst, + CompactLattice* composed_clat) { + PrunedCompactLatticeComposer composer(opts, clat, det_fst, composed_clat); + composer.Compose(); +} + +} // namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/lat/compose-lattice-pruned.h b/runtime/onnxruntime/third_party/kaldi/lat/compose-lattice-pruned.h new file mode 100644 index 0000000..160b9f3 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/compose-lattice-pruned.h @@ -0,0 +1,179 @@ +// lat/compose-lattice-pruned.h + +// Copyright 2017 Johns Hopkins University (Author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_LAT_COMPOSE_LATTICE_PRUNED_H_ +#define KALDI_LAT_COMPOSE_LATTICE_PRUNED_H_ +#include +#include +#include +#include +#include +#include +#include "fstext/lattice-weight.h" +#include "itf/options-itf.h" +#include "lat/kaldi-lattice.h" + +namespace kaldi { + + +/* + This header implements pruned lattice composition, via the functions + ComposeCompactLatticePruned (we may later add ComposeLatticePruned if + needed). + + ComposeCompactLatticePruned does composition of a CompactLattice with a + DeterministicOnDemandFst, producing a CompactLattice. It's + intended for language model rescoring of lattices. + + The scenario is that you have produced a Lattice or CompactLattice via + conventional decoding, and you want to replace (or partially replace) the + language model scores in the lattice (which will probably will come from the + LM used to generate the HCLG.fst) with the language model scores from a + larger language model. + + The simpler alternative to using ComposeCompactLatticePruned is to use + ComposeCompactLatticeDeterministic. The advantages of ComposedCompactLatticePruned are: + + (1) The alternative might be too slow, because when you compose a lattice + with a high-order n-gram language model (or an RNNLM with a high-order + n-gram approximation) it can generate a lot more arcs than were present + in the original lattice. + + (2) For RNNLM rescoring, the n-gram approximation may not always + be choosing a very good history. In the n-gram approximation, + the LM score for a particular word given a history is taken + from a history that is the same as the desired history up to + the last, say, 4 words, but beyond that may differ. The + advantage of ComposeCompactLatticePruned functions over the alternative is + that it will often take, in a suitable sense, the "best" history + (instead of an arbitrary history); this happens simply because the + paths that are expected to be the best paths are visited first. + + + We now describe how you are expected to get the thing to compose with, + i.e. the DeterministicOnDemandFst that corrects the LM weights. It + will normally contain the LM used to create the original HCLG, with a + negative weight, composed with the LM you want to use, with a positive + weights (these weights might not be -1 and 1 if there is interpolation in the + picture). The LM we want to use will often be e.g. a 4-gram ARPA-type LM + (stored as a regular FST or, more compactly, as a .carpa file which is a + ConstArpaFst), or it will be some kind of RNNLM. You would use a + ComposeDeterministicOnDemandFst to combine the "base" language model + (with a negative weight, using either ConstArpaLm or + BackoffDeterministicOnDemandFst wrapped in ScaleDeterministicOnDemandFst) + with the RNNLM language model (the name of FST TBD, Hainan needs to write + this). +*/ + + + + +// This options class is used for ComposeCompactLatticePruned, +// and if in future we write a function ComposeLatticePruned, we'll +// use the same options class. +// Note: the binary that uses this may want to use an --acoustic-scale +// option, in case the acoustics need to be scaled down before this +// composition, because it will make a difference to which paths +// are explored in the lattice. +struct ComposeLatticePrunedOptions { + // 'lattice_compose_beam' is a beam that determines + // how much of a given composition space we will expand (at least, + // until we hit the limit imposed by 'max_arcs'.. This + // beam is applied using heuristically-estimated expected costs + // to the end of the lattice, so if you specify, for example, + // beam=5.0, it doesn't guarantee that all paths with best-cost + // within 5.0 of the best path in the composed output will be + // retained (However, this would be exact if the LM we were + // rescoring with had zero costs). + float lattice_compose_beam; + + // 'max_arcs' is the maximum number of arcs that we are willing to expand per + // lattice; once this limit is reached, we terminate the composition (however, + // this limit is not applied until at least one path to a final-state has been + // produced). + int32 max_arcs; + + // 'initial_num_arcs' is the number of arcs we use on the first outer + // iteration of the algorithm. This is so unimportant that we do not expose + // it on the command line. + int32 initial_num_arcs; + + // 'growth_ratio' determines how much we allow the num-arcs to grow on each + // outer iteration of the algorithm. 1.5 is a reasonable value; if it is set + // too small, too much time will be taken in RecomputePruningInfo(), and if + // too large, the paths searched may be less optimal than they could be (the + // heuristics will be less accurate). + BaseFloat growth_ratio; + + ComposeLatticePrunedOptions(): lattice_compose_beam(6.0), + max_arcs(100000), + initial_num_arcs(100), + growth_ratio(1.5) { } + void Register(OptionsItf *po) { + po->Register("lattice-compose-beam", &lattice_compose_beam, + "Beam used in pruned lattice composition, which determines how " + "large the composed lattice may be."); + po->Register("max-arcs", &max_arcs, "Maximum number of arcs we allow in " + "any given lattice, during pruned composition (limits max size " + "of lattices; also see lattice-compose-beam)."); + po->Register("growth-ratio", &growth_ratio, "Factor used in the lattice " + "composition algorithm; must be >1.0. Affects speed vs. " + "the optimality of the best-first composition."); + } +}; + + +/** + Does pruned composition of a lattice 'clat' with a DeterministicOnDemandFst + 'det_fst'; implements LM rescoring. + + @param [in] opts Class containing options + @param [in] clat The input lattice, which is expected to already have a + reasonable acoustic scale applied (e.g. 0.1 if it's a normal + cross-entropy system, but 1.0 for a chain system); this scale + affects the pruning. + @param [in] det_fst The on-demand FST that we are composing with; its + ilabels will correspond to words and it should be an acceptor + in practice (ilabel == olabel). Will often contain a + weighted difference of language model scores, with scores + of the form alpha * new - alpha * old, where alpha + is the interpolation weight for the 'new' language model + (e.g. 0.5 or 0.8). It's non-const because 'det_fst' is + on-demand. + @param [out] composed_clat The output, which is a result of composing + 'clat' with '*det_fst'. Notionally, '*det_fst' is on the + right, although both are acceptors so it doesn't really + matter in practice. + Although the two FSTs are of different types, the code + manually does the conversion. The weights in '*det_fst' + will be interpreted as graph weights (Value1()) in the + lattice semiring. + */ +void ComposeCompactLatticePruned( + const ComposeLatticePrunedOptions &opts, + const CompactLattice &clat, + fst::DeterministicOnDemandFst *det_fst, + CompactLattice* composed_clat); + + + + +} // namespace kaldi + +#endif diff --git a/runtime/onnxruntime/third_party/kaldi/lat/confidence.cc b/runtime/onnxruntime/third_party/kaldi/lat/confidence.cc new file mode 100644 index 0000000..0700de3 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/confidence.cc @@ -0,0 +1,117 @@ +// lat/confidence.cc + +// Copyright 2013 Johns Hopkins University (Author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "lat/confidence.h" +#include "lat/lattice-functions.h" +#include "lat/determinize-lattice-pruned.h" + +namespace kaldi { + +BaseFloat SentenceLevelConfidence(const CompactLattice &clat, + int32 *num_paths, + std::vector *best_sentence, + std::vector *second_best_sentence) { + /* It may seem strange that the first thing we do is to convert the + CompactLattice to a Lattice, given that we may have just created the + CompactLattice by determinizing a Lattice. However, this is not just + a circular conversion; "lat" will have the property that distinct + paths have distinct word sequences. + Below, we could run NbestAsFsts on a CompactLattice, but the time + taken would be quadratic in the length in words of the CompactLattice, + because of the alignment information getting appended as vectors. + That's why we convert back to Lattice. + */ + Lattice lat; + ConvertLattice(clat, &lat); + + std::vector lats; + NbestAsFsts(lat, 2, &lats); + int32 n = lats.size(); + KALDI_ASSERT(n >= 0 && n <= 2); + if (num_paths != NULL) *num_paths = n; + if (best_sentence != NULL) best_sentence->clear(); + if (second_best_sentence != NULL) second_best_sentence->clear(); + + LatticeWeight weight1, weight2; + if (n >= 1) + fst::GetLinearSymbolSequence(lats[0], NULL, + best_sentence, + &weight1); + if (n >= 2) + fst::GetLinearSymbolSequence(lats[1], NULL, + second_best_sentence, + &weight2); + + if (n == 0) { + return 0; // this seems most appropriate because it will be interpreted as + // zero confidence, and something definitely went wrong for this + // to happen. + } else if (n == 1) { + // If there is only one sentence in the lattice, we interpret this as there + // being perfect confidence + return std::numeric_limits::infinity(); + } else { + BaseFloat best_cost = ConvertToCost(weight1), + second_best_cost = ConvertToCost(weight2); + BaseFloat ans = second_best_cost - best_cost; + if (!(ans >= -0.001 * (fabs(best_cost) + fabs(second_best_cost)))) { + // Answer should be positive. Make sure it's at at least not + // substantially negative. This would be very strange. + KALDI_WARN << "Very negative difference." << ans; + } + if (ans < 0) ans = 0; + return ans; + } +} + + + +BaseFloat SentenceLevelConfidence(const Lattice &lat, + int32 *num_paths, + std::vector *best_sentence, + std::vector *second_best_sentence) { + int32 max_sentence_length = LongestSentenceLength(lat); + fst::DeterminizeLatticePrunedOptions determinize_opts; + // The basic idea of expanding only up to "max_sentence_length * 2" arcs, + // is that that should be sufficient to get the best and second-best paths + // through the lattice, which is all we need for this particular application. + // "safety_term" is just in case there is some reason why we might need a few + // extra arcs, e.g. in case of a tie on the weights of the second-best path. + int32 safety_term = 4 + max_sentence_length; + determinize_opts.max_arcs = max_sentence_length * 2 + safety_term; + // set prune_beam to a large value... we don't really rely on the beam; we + // rely on the max_arcs variable to limit the size of the lattice. + double prune_beam = std::numeric_limits::infinity(); + + CompactLattice clat; + // We ignore the return status of DeterminizeLatticePruned. It will likely + // return false, but this is expected because the expansion is limited + // by "max_arcs" not "prune_beam". + Lattice inverse_lat(lat); + fst::Invert(&inverse_lat); // Swap input and output symbols. + DeterminizeLatticePruned(inverse_lat, prune_beam, &clat, determinize_opts); + + // Call the version of this function that takes a CompactLattice. + return SentenceLevelConfidence(clat, num_paths, + best_sentence, second_best_sentence); +} + + + +} // namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/lat/confidence.h b/runtime/onnxruntime/third_party/kaldi/lat/confidence.h new file mode 100644 index 0000000..e1b1eae --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/confidence.h @@ -0,0 +1,77 @@ +// lat/confidence.h + +// Copyright 2013 Johns Hopkins University (Author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#ifndef KALDI_LAT_CONFIDENCE_H_ +#define KALDI_LAT_CONFIDENCE_H_ + +#include +#include + +#include "base/kaldi-common.h" +#include "util/common-utils.h" +#include "fstext/fstext-lib.h" +#include "lat/kaldi-lattice.h" + +namespace kaldi { + +/// Caution: this function is not the only way to get confidences in Kaldi. +/// This only gives you sentence-level (utterance-level) confidence. You can +/// get word-by-word confidence within a sentence, along with Minimum Bayes Risk +/// decoding, by looking at sausages.h. +/// Caution: confidences estimated using this type of method are not very +/// accurate. +/// This function will return the difference between the best path in clat and +/// the second-best path in clat (a positive number), or zero if clat was +/// equivalent to the empty FST (no successful paths), or infinity if there +/// was only one path in "clat". It will output to "num_paths" (if non-NULL) +/// a number n = 0, 1 or 2 saying how many n-best paths (up to two) were found. +/// If n >= 1 it outputs to "best_sentence" (if non-NULL) the best word-sequence; +/// if n == 2 it outputs to "second_best_sentence" (if non-NULL) the second best +/// word-sequence (this may be useful for testing whether the two best word +/// sequences are somehow equivalent for the task at hand). If you need more +/// information than this or want to look deeper inside the n-best list, then +/// look at the implementation of this function. +/// This function requires that distinct paths in "lat" have distinct word +/// sequences; this will automatically be the case if you generated "clat" +/// in any normal way, such as from a decoder, because a deterministic FST +/// has this property. +/// This function assumes that any acoustic scaling you want to apply, +/// has already been applied. +BaseFloat SentenceLevelConfidence(const CompactLattice &clat, + int32 *num_paths, + std::vector *best_sentence, + std::vector *second_best_sentence); + + +/// This version of SentenceLevelConfidence takes as input a state-level lattice. +/// It needs to determinize it first, but it does so in a "smart" way that only generates +/// about as many output paths as it needs. +BaseFloat SentenceLevelConfidence(const Lattice &lat, + int32 *num_paths, + std::vector *best_sentence, + std::vector *second_best_sentence); + + + + + +} // namespace kaldi + +#endif // KALDI_LAT_CONFIDENCE_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/lat/determinize-lattice-pruned-test.cc b/runtime/onnxruntime/third_party/kaldi/lat/determinize-lattice-pruned-test.cc new file mode 100644 index 0000000..f6684f0 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/determinize-lattice-pruned-test.cc @@ -0,0 +1,147 @@ +// lat/determinize-lattice-pruned-test.cc + +// Copyright 2009-2012 Microsoft Corporation +// 2012-2013 Johns Hopkins University (Author: Daniel Povey) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "lat/determinize-lattice-pruned.h" +#include "fstext/lattice-utils.h" +#include "fstext/fst-test-utils.h" +#include "lat/kaldi-lattice.h" +#include "lat/lattice-functions.h" + +namespace fst { +// Caution: these tests are not as generic as you might think from all the +// templates in the code. They are basically only valid for LatticeArc. +// This is partly due to the fact that certain templates need to be instantiated +// in other .cc files in this directory. + +// test that determinization proceeds correctly on general +// FSTs (not guaranteed determinzable, but we use the +// max-states option to stop it getting out of control). +template void TestDeterminizeLatticePruned() { + typedef kaldi::int32 Int; + typedef typename Arc::Weight Weight; + typedef ArcTpl > CompactArc; + + for(int i = 0; i < 100; i++) { + RandFstOptions opts; + opts.n_states = 4; + opts.n_arcs = 10; + opts.n_final = 2; + opts.allow_empty = false; + opts.weight_multiplier = 0.5; // impt for the randomly generated weights + opts.acyclic = true; + // to be exactly representable in float, + // or this test fails because numerical differences can cause symmetry in + // weights to be broken, which causes the wrong path to be chosen as far + // as the string part is concerned. + + VectorFst *fst = RandPairFst(opts); + + bool sorted = TopSort(fst); + KALDI_ASSERT(sorted); + + ILabelCompare ilabel_comp; + if (kaldi::Rand() % 2 == 0) + ArcSort(fst, ilabel_comp); + + std::cout << "FST before lattice-determinizing is:\n"; + { + FstPrinter fstprinter(*fst, NULL, NULL, NULL, false, true, "\t"); + fstprinter.Print(&std::cout, "standard output"); + } + VectorFst det_fst; + try { + DeterminizeLatticePrunedOptions lat_opts; + lat_opts.max_mem = ((kaldi::Rand() % 2 == 0) ? 100 : 1000); + lat_opts.max_states = ((kaldi::Rand() % 2 == 0) ? -1 : 20); + lat_opts.max_arcs = ((kaldi::Rand() % 2 == 0) ? -1 : 30); + bool ans = DeterminizeLatticePruned(*fst, 10.0, &det_fst, lat_opts); + + std::cout << "FST after lattice-determinizing is:\n"; + { + FstPrinter fstprinter(det_fst, NULL, NULL, NULL, false, true, "\t"); + fstprinter.Print(&std::cout, "standard output"); + } + KALDI_ASSERT(det_fst.Properties(kIDeterministic, true) & kIDeterministic); + // OK, now determinize it a different way and check equivalence. + // [note: it's not normal determinization, it's taking the best path + // for any input-symbol sequence.... + + + VectorFst pruned_fst(*fst); + if (pruned_fst.NumStates() != 0) + kaldi::PruneLattice(10.0, &pruned_fst); + + VectorFst compact_pruned_fst, compact_pruned_det_fst; + ConvertLattice(pruned_fst, &compact_pruned_fst, false); + std::cout << "Compact pruned FST is:\n"; + { + FstPrinter fstprinter(compact_pruned_fst, NULL, NULL, NULL, false, true, "\t"); + fstprinter.Print(&std::cout, "standard output"); + } + ConvertLattice(det_fst, &compact_pruned_det_fst, false); + + std::cout << "Compact version of determinized FST is:\n"; + { + FstPrinter fstprinter(compact_pruned_det_fst, NULL, NULL, NULL, false, true, "\t"); + fstprinter.Print(&std::cout, "standard output"); + } + + if (ans) + KALDI_ASSERT(RandEquivalent(compact_pruned_det_fst, compact_pruned_fst, 5/*paths*/, 0.01/*delta*/, kaldi::Rand()/*seed*/, 100/*path length, max*/)); + } catch (...) { + std::cout << "Failed to lattice-determinize this FST (probably not determinizable)\n"; + } + delete fst; + } +} + +// test that determinization proceeds without crash on acyclic FSTs +// (guaranteed determinizable in this sense). +template void TestDeterminizeLatticePruned2() { + typedef typename Arc::Weight Weight; + RandFstOptions opts; + opts.acyclic = true; + for(int i = 0; i < 100; i++) { + VectorFst *fst = RandPairFst(opts); + std::cout << "FST before lattice-determinizing is:\n"; + { + FstPrinter fstprinter(*fst, NULL, NULL, NULL, false, true, "\t"); + fstprinter.Print(&std::cout, "standard output"); + } + VectorFst ofst; + DeterminizeLatticePruned(*fst, 10.0, &ofst); + std::cout << "FST after lattice-determinizing is:\n"; + { + FstPrinter fstprinter(ofst, NULL, NULL, NULL, false, true, "\t"); + fstprinter.Print(&std::cout, "standard output"); + } + delete fst; + } +} + + +} // end namespace fst + +int main() { + using namespace fst; + TestDeterminizeLatticePruned(); + TestDeterminizeLatticePruned2(); + std::cout << "Tests succeeded\n"; +} diff --git a/runtime/onnxruntime/third_party/kaldi/lat/determinize-lattice-pruned.cc b/runtime/onnxruntime/third_party/kaldi/lat/determinize-lattice-pruned.cc new file mode 100644 index 0000000..c4aa2e7 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/lat/determinize-lattice-pruned.cc @@ -0,0 +1,1541 @@ +// lat/determinize-lattice-pruned.cc + +// Copyright 2009-2012 Microsoft Corporation +// 2012-2013 Johns Hopkins University (Author: Daniel Povey) +// 2014 Guoguo Chen + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "fstext/determinize-lattice.h" // for LatticeStringRepository +#include "fstext/fstext-utils.h" +#include "lat/lattice-functions.h" // for PruneLattice +//#include "lat/minimize-lattice.h" // for minimization +//#include "lat/push-lattice.h" // for minimization +#include "lat/determinize-lattice-pruned.h" + +namespace fst { + +using std::vector; +using std::pair; +using std::greater; + +// class LatticeDeterminizerPruned is templated on the same types that +// CompactLatticeWeight is templated on: the base weight (Weight), typically +// LatticeWeightTpl etc. but could also be e.g. TropicalWeight, and the +// IntType, typically int32, used for the output symbols in the compact +// representation of strings [note: the output symbols would usually be +// p.d.f. id's in the anticipated use of this code] It has a special requirement +// on the Weight type: that there should be a Compare function on the weights +// such that Compare(w1, w2) returns -1 if w1 < w2, 0 if w1 == w2, and +1 if w1 > +// w2. This requires that there be a total order on the weights. + +template class LatticeDeterminizerPruned { + public: + // Output to Gallic acceptor (so the strings go on weights, and there is a 1-1 correspondence + // between our states and the states in ofst. If destroy == true, release memory as we go + // (but we cannot output again). + + typedef CompactLatticeWeightTpl CompactWeight; + typedef ArcTpl CompactArc; // arc in compact, acceptor form of lattice + typedef ArcTpl Arc; // arc in non-compact version of lattice + + // Output to standard FST with CompactWeightTpl as its weight type (the + // weight stores the original output-symbol strings). If destroy == true, + // release memory as we go (but we cannot output again). + void Output(MutableFst *ofst, bool destroy = true) { + KALDI_ASSERT(determinized_); + typedef typename Arc::StateId StateId; + StateId nStates = static_cast(output_states_.size()); + if (destroy) + FreeMostMemory(); + ofst->DeleteStates(); + ofst->SetStart(kNoStateId); + if (nStates == 0) { + return; + } + for (StateId s = 0;s < nStates;s++) { + OutputStateId news = ofst->AddState(); + KALDI_ASSERT(news == s); + } + ofst->SetStart(0); + // now process transitions. + for (StateId this_state_id = 0; this_state_id < nStates; this_state_id++) { + OutputState &this_state = *(output_states_[this_state_id]); + vector &this_vec(this_state.arcs); + typename vector::const_iterator iter = this_vec.begin(), end = this_vec.end(); + + for (;iter != end; ++iter) { + const TempArc &temp_arc(*iter); + CompactArc new_arc; + vector *v) { + KALDI_ASSERT(v != NULL); + v->resize(m.size()); + typename std::map::const_iterator miter = m.begin(), mend = m.end(); + typename std::vector::iterator viter = v->begin(); + for (; miter != mend; ++miter, ++viter) { + *viter = miter->first; + } +} + +/// Copies the values in a map to a vector. +template +void CopyMapValuesToVector(const std::map &m, std::vector *v) { + KALDI_ASSERT(v != NULL); + v->resize(m.size()); + typename std::map::const_iterator miter = m.begin(), mend = m.end(); + typename std::vector::iterator viter = v->begin(); + for (; miter != mend; ++miter, ++viter) { + *viter = miter->second; + } +} + +/// Copies the keys in a map to a set. +template +void CopyMapKeysToSet(const std::map &m, std::set *s) { + KALDI_ASSERT(s != NULL); + s->clear(); + typename std::map::const_iterator miter = m.begin(), mend = m.end(); + for (; miter != mend; ++miter) { + s->insert(s->end(), miter->first); + } +} + +/// Copies the values in a map to a set. +template +void CopyMapValuesToSet(const std::map &m, std::set *s) { + KALDI_ASSERT(s != NULL); + s->clear(); + typename std::map::const_iterator miter = m.begin(), mend = m.end(); + for (; miter != mend; ++miter) + s->insert(s->end(), miter->second); +} + + +/// Copies the contents of a vector to a set. +template +void CopyVectorToSet(const std::vector &v, std::set *s) { + KALDI_ASSERT(s != NULL); + s->clear(); + typename std::vector::const_iterator iter = v.begin(), end = v.end(); + for (; iter != end; ++iter) + s->insert(s->end(), *iter); + // s->end() is a hint in case v was sorted. will work regardless. +} + +/// Deletes any non-NULL pointers in the vector v, and sets +/// the corresponding entries of v to NULL +template +void DeletePointers(std::vector *v) { + KALDI_ASSERT(v != NULL); + typename std::vector::iterator iter = v->begin(), end = v->end(); + for (; iter != end; ++iter) { + if (*iter != NULL) { + delete *iter; + *iter = NULL; // set to NULL for extra safety. + } + } +} + +/// Returns true if the vector of pointers contains NULL pointers. +template +bool ContainsNullPointers(const std::vector &v) { + typename std::vector::const_iterator iter = v.begin(), end = v.end(); + for (; iter != end; ++iter) + if (*iter == static_cast (NULL)) return true; + return false; +} + +/// Copies the contents a vector of one type to a vector +/// of another type. +template +void CopyVectorToVector(const std::vector &vec_in, std::vector *vec_out) { + KALDI_ASSERT(vec_out != NULL); + vec_out->resize(vec_in.size()); + for (size_t i = 0; i < vec_in.size(); i++) + (*vec_out)[i] = static_cast (vec_in[i]); +} + +/// A hashing function-object for vectors. +template +struct VectorHasher { // hashing function for vector. + size_t operator()(const std::vector &x) const noexcept { + size_t ans = 0; + typename std::vector::const_iterator iter = x.begin(), end = x.end(); + for (; iter != end; ++iter) { + ans *= kPrime; + ans += *iter; + } + return ans; + } + VectorHasher() { // Check we're instantiated with an integer type. + KALDI_ASSERT_IS_INTEGER_TYPE(Int); + } + private: + static const int kPrime = 7853; +}; + +/// A hashing function-object for pairs of ints +template +struct PairHasher { // hashing function for pair + size_t operator()(const std::pair &x) const noexcept { + // 7853 was chosen at random from a list of primes. + return x.first + x.second * 7853; + } + PairHasher() { // Check we're instantiated with an integer type. + KALDI_ASSERT_IS_INTEGER_TYPE(Int1); + KALDI_ASSERT_IS_INTEGER_TYPE(Int2); + } +}; + + +/// A hashing function object for strings. +struct StringHasher { // hashing function for std::string + size_t operator()(const std::string &str) const noexcept { + size_t ans = 0, len = str.length(); + const char *c = str.c_str(), *end = c + len; + for (; c != end; c++) { + ans *= kPrime; + ans += *c; + } + return ans; + } + private: + static const int kPrime = 7853; +}; + +/// Reverses the contents of a vector. +template +inline void ReverseVector(std::vector *vec) { + KALDI_ASSERT(vec != NULL); + size_t sz = vec->size(); + for (size_t i = 0; i < sz/2; i++) + std::swap( (*vec)[i], (*vec)[sz-1-i]); +} + + +/// Comparator object for pairs that compares only the first pair. +template +struct CompareFirstMemberOfPair { + inline bool operator() (const std::pair &p1, + const std::pair &p2) { + return p1.first < p2.first; + } +}; + +/// For a vector of pair where I is an integer and F a floating-point or +/// integer type, this function sorts a vector of type vector > on +/// the I value and then merges elements with equal I values, summing these over +/// the F component and then removing any F component with zero value. This +/// is for where the vector of pairs represents a map from the integer to float +/// component, with an "adding" type of semantics for combining the elements. +template +inline void MergePairVectorSumming(std::vector > *vec) { + KALDI_ASSERT_IS_INTEGER_TYPE(I); + CompareFirstMemberOfPair c; + std::sort(vec->begin(), vec->end(), c); // sort on 1st element. + typename std::vector >::iterator out = vec->begin(), + in = vec->begin(), end = vec->end(); + // special case: while there is nothing to be changed, skip over + // initial input (avoids unnecessary copying). + while (in + 1 < end && in[0].first != in[1].first && in[0].second != 0.0) { + in++; + out++; + } + while (in < end) { + // We reach this point only at the first element of + // each stretch of identical .first elements. + *out = *in; + ++in; + while (in < end && in->first == out->first) { + out->second += in->second; // this is the merge operation. + ++in; + } + if (out->second != static_cast(0)) // Don't keep zero elements. + out++; + } + vec->erase(out, end); +} + +} // namespace kaldi + +#endif // KALDI_UTIL_STL_UTILS_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/util/table-types.h b/runtime/onnxruntime/third_party/kaldi/util/table-types.h new file mode 100644 index 0000000..b6c19de --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/util/table-types.h @@ -0,0 +1,207 @@ +// util/table-types.h + +// Copyright 2009-2011 Microsoft Corporation +// 2020 Mobvoi AI Lab, Beijing, China (author: Fangjun Kuang) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#ifndef KALDI_UTIL_TABLE_TYPES_H_ +#define KALDI_UTIL_TABLE_TYPES_H_ +#include "base/kaldi-common.h" +#include "util/kaldi-table.h" +#include "util/kaldi-holder.h" +#include "matrix/matrix-lib.h" + +namespace kaldi { + +// This header defines typedefs that are specific instantiations of +// the Table types. + +/// \addtogroup table_types +/// @{ + +typedef TableWriter > > + BaseFloatMatrixWriter; +typedef SequentialTableReader > > + SequentialBaseFloatMatrixReader; +typedef RandomAccessTableReader > > + RandomAccessBaseFloatMatrixReader; +typedef RandomAccessTableReaderMapped > > + RandomAccessBaseFloatMatrixReaderMapped; + +typedef TableWriter > > + DoubleMatrixWriter; +typedef SequentialTableReader > > + SequentialDoubleMatrixReader; +typedef RandomAccessTableReader > > + RandomAccessDoubleMatrixReader; +typedef RandomAccessTableReaderMapped > > + RandomAccessDoubleMatrixReaderMapped; + +typedef TableWriter > + CompressedMatrixWriter; + +typedef TableWriter > > + BaseFloatVectorWriter; +typedef SequentialTableReader > > + SequentialBaseFloatVectorReader; +typedef RandomAccessTableReader > > + RandomAccessBaseFloatVectorReader; +typedef RandomAccessTableReaderMapped > > + RandomAccessBaseFloatVectorReaderMapped; + +typedef TableWriter > > + DoubleVectorWriter; +typedef SequentialTableReader > > + SequentialDoubleVectorReader; +typedef RandomAccessTableReader > > + RandomAccessDoubleVectorReader; + +typedef TableWriter>> + BaseFloatNumpyArrayWriter; +typedef SequentialTableReader>> + SequentialBaseFloatNumpyArrayReader; +typedef RandomAccessTableReader>> + RandomAccessBaseFloatNumpyArrayReader; + +typedef TableWriter>> + DoubleNumpyArrayWriter; +typedef SequentialTableReader>> + SequentialDoubleNumpyArrayReader; +typedef RandomAccessTableReader>> + RandomAccessDoubleNumpyArrayReader; + +typedef TableWriter > > + BaseFloatCuMatrixWriter; +typedef SequentialTableReader > > + SequentialBaseFloatCuMatrixReader; +typedef RandomAccessTableReader > > + RandomAccessBaseFloatCuMatrixReader; +typedef RandomAccessTableReaderMapped > > + RandomAccessBaseFloatCuMatrixReaderMapped; + +typedef TableWriter > > + DoubleCuMatrixWriter; +typedef SequentialTableReader > > + SequentialDoubleCuMatrixReader; +typedef RandomAccessTableReader > > + RandomAccessDoubleCuMatrixReader; +typedef RandomAccessTableReaderMapped > > + RandomAccessDoubleCuMatrixReaderMapped; + +typedef TableWriter > > + BaseFloatCuVectorWriter; +typedef SequentialTableReader > > + SequentialBaseFloatCuVectorReader; +typedef RandomAccessTableReader > > + RandomAccessBaseFloatCuVectorReader; +typedef RandomAccessTableReaderMapped > > + RandomAccessBaseFloatCuVectorReaderMapped; + +typedef TableWriter > > + DoubleCuVectorWriter; +typedef SequentialTableReader > > + SequentialDoubleCuVectorReader; +typedef RandomAccessTableReader > > + RandomAccessDoubleCuVectorReader; + + +typedef TableWriter > Int32Writer; +typedef SequentialTableReader > SequentialInt32Reader; +typedef RandomAccessTableReader > RandomAccessInt32Reader; + +typedef TableWriter > Int32VectorWriter; +typedef SequentialTableReader > + SequentialInt32VectorReader; +typedef RandomAccessTableReader > + RandomAccessInt32VectorReader; + +typedef TableWriter > Int32VectorVectorWriter; +typedef SequentialTableReader > + SequentialInt32VectorVectorReader; +typedef RandomAccessTableReader > + RandomAccessInt32VectorVectorReader; + +typedef TableWriter > Int32PairVectorWriter; +typedef SequentialTableReader > + SequentialInt32PairVectorReader; +typedef RandomAccessTableReader > + RandomAccessInt32PairVectorReader; + +typedef TableWriter > + BaseFloatPairVectorWriter; +typedef SequentialTableReader > + SequentialBaseFloatPairVectorReader; +typedef RandomAccessTableReader > + RandomAccessBaseFloatPairVectorReader; + +typedef TableWriter > BaseFloatWriter; +typedef SequentialTableReader > + SequentialBaseFloatReader; +typedef RandomAccessTableReader > + RandomAccessBaseFloatReader; +typedef RandomAccessTableReaderMapped > + RandomAccessBaseFloatReaderMapped; + +typedef TableWriter > DoubleWriter; +typedef SequentialTableReader > SequentialDoubleReader; +typedef RandomAccessTableReader > RandomAccessDoubleReader; + +typedef TableWriter > BoolWriter; +typedef SequentialTableReader > SequentialBoolReader; +typedef RandomAccessTableReader > RandomAccessBoolReader; + + + +/// TokenWriter is a writer specialized for std::string where the strings +/// are nonempty and whitespace-free. T == std::string +typedef TableWriter TokenWriter; +typedef SequentialTableReader SequentialTokenReader; +typedef RandomAccessTableReader RandomAccessTokenReader; + + +/// TokenVectorWriter is a writer specialized for sequences of +/// std::string where the strings are nonempty and whitespace-free. +/// T == std::vector +typedef TableWriter TokenVectorWriter; +// Ditto for SequentialTokenVectorReader. +typedef SequentialTableReader SequentialTokenVectorReader; +typedef RandomAccessTableReader + RandomAccessTokenVectorReader; + + +typedef TableWriter > + GeneralMatrixWriter; +typedef SequentialTableReader > + SequentialGeneralMatrixReader; +typedef RandomAccessTableReader > + RandomAccessGeneralMatrixReader; +typedef RandomAccessTableReaderMapped > + RandomAccessGeneralMatrixReaderMapped; + + + +/// @} + +// Note: for FST reader/writer, see ../fstext/fstext-utils.h +// [not done yet]. + +} // end namespace kaldi + + + +#endif // KALDI_UTIL_TABLE_TYPES_H_ diff --git a/runtime/onnxruntime/third_party/kaldi/util/text-utils-test.cc b/runtime/onnxruntime/third_party/kaldi/util/text-utils-test.cc new file mode 100644 index 0000000..3b58f4f --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/util/text-utils-test.cc @@ -0,0 +1,538 @@ +// util/text-utils-test.cc + +// Copyright 2009-2011 Microsoft Corporation +// 2017 Johns Hopkins University (author: Daniel Povey) +// 2015 Vimal Manohar (Johns Hopkins University) + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + + +#include "base/kaldi-common.h" +#include "util/text-utils.h" + +namespace kaldi { + +char GetRandChar() { + return static_cast(32 + Rand() % 95); // between ' ' and '~' +} + +const char *ws_delim = " \t\n\r"; +char GetRandDelim() { + if (Rand() % 2 == 0) + return static_cast(33 + Rand() % 94); // between '!' and '~'; + else + return ws_delim[Rand() % 4]; +} + + +void TestSplitStringToVector() { + // srand((unsigned int)time(NULL)); + // didn't compile on cygwin. + + { + std::vector str_vec; + SplitStringToVector("", " ", false, &str_vec); + KALDI_ASSERT(str_vec.size() == 1); // If this fails it may just mean + // that someone changed the + // semantics of SplitStringToVector in a reasonable way. + SplitStringToVector("", " ", true, &str_vec); + KALDI_ASSERT(str_vec.empty()); + } + for (int j = 0; j < 100; j++) { + std::vector str_vec; + int sz = Rand() % 73; + std::string full; + for (int i = 0; i < sz-1; i++) { + full.push_back((Rand() % 7 == 0)? GetRandDelim() : GetRandChar()); + } + std::string delim; + delim.push_back(GetRandDelim()); + bool omit_empty_strings = (Rand() %2 == 0)? true : false; + SplitStringToVector(full, delim.c_str(), omit_empty_strings, &str_vec); + std::string new_full; + for (size_t i = 0; i < str_vec.size(); i++) { + if (omit_empty_strings) KALDI_ASSERT(str_vec[i] != ""); + new_full.append(str_vec[i]); + if (i < str_vec.size() -1) new_full.append(delim); + } + std::string new_full2; + JoinVectorToString(str_vec, delim.c_str(), omit_empty_strings, &new_full2); + if (omit_empty_strings) { // sequences of delimiters cannot be matched + size_t start = full.find_first_not_of(delim), + end = full.find_last_not_of(delim); + if (start == std::string::npos) { // only delimiters + KALDI_ASSERT(end == std::string::npos); + } else { + std::string full_test; + char last = '\0'; + for (size_t i = start; i <= end; i++) { + if (full[i] != last || last != *delim.c_str()) + full_test.push_back(full[i]); + last = full[i]; + } + if (!full.empty()) { + KALDI_ASSERT(new_full.compare(full_test) == 0); + KALDI_ASSERT(new_full2.compare(full_test) == 0); + } + } + } else if (!full.empty()) { + KALDI_ASSERT(new_full.compare(full) == 0); + KALDI_ASSERT(new_full2.compare(full) == 0); + } + } +} + +void TestSplitStringToIntegers() { + { + std::vector v; + KALDI_ASSERT(SplitStringToIntegers("-1:2:4", ":", false, &v) == true + && v.size() == 3 && v[0] == -1 && v[1] == 2 && v[2] == 4); + KALDI_ASSERT(SplitStringToIntegers("-1:2:4:", ":", false, &v) == false); + KALDI_ASSERT(SplitStringToIntegers(":-1::2:4:", ":", true, &v) == true + && v.size() == 3 && v[0] == -1 && v[1] == 2 && v[2] == 4); + KALDI_ASSERT(SplitStringToIntegers("-1\n2\t4", " \n\t\r", false, &v) == true + && v.size() == 3 && v[0] == -1 && v[1] == 2 && v[2] == 4); + KALDI_ASSERT(SplitStringToIntegers(" ", " \n\t\r", true, &v) == true + && v.size() == 0); + KALDI_ASSERT(SplitStringToIntegers("", " \n\t\r", false, &v) == true + && v.size() == 0); + } + + { + std::vector v; + KALDI_ASSERT(SplitStringToIntegers("-1:2:4", ":", false, &v) == false); + // cannot put negative number in uint32. + } +} + + + +void TestSplitStringToFloats() { + { + std::vector v; + KALDI_ASSERT(SplitStringToFloats("-1:2.5:4", ":", false, &v) == true + && v.size() == 3 && v[0] == -1 && v[1] == 2.5 && v[2] == 4); + KALDI_ASSERT(SplitStringToFloats("-1:2.5:4:", ":", false, &v) == false); + KALDI_ASSERT(SplitStringToFloats(":-1::2:4:", ":", true, &v) == true + && v.size() == 3 && v[0] == -1 && v[1] == 2 && v[2] == 4); + KALDI_ASSERT(SplitStringToFloats("-1\n2.5\t4", " \n\t\r", false, &v) == true + && v.size() == 3 && v[0] == -1 && v[1] == 2.5 && v[2] == 4); + KALDI_ASSERT(SplitStringToFloats(" ", " \n\t\r", true, &v) == true + && v.size() == 0); + KALDI_ASSERT(SplitStringToFloats("", " \n\t\r", false, &v) == true + && v.size() == 0); + } + + { + std::vector v; + KALDI_ASSERT(SplitStringToFloats("-1:2:4", ":", false, &v) == true); + } +} + +void TestConvertStringToInteger() { + int32 i; + KALDI_ASSERT(ConvertStringToInteger("12345", &i) && i == 12345); + KALDI_ASSERT(ConvertStringToInteger("-12345", &i) && i == -12345); + char j; + KALDI_ASSERT(!ConvertStringToInteger("-12345", &j)); // too big for char. + + KALDI_ASSERT(ConvertStringToInteger(" -12345 ", &i)); // whitespace accepted + + KALDI_ASSERT(!ConvertStringToInteger("a ", &i)); // non-integers rejected. + + KALDI_ASSERT(ConvertStringToInteger("0", &i) && i == 0); + + uint64 k; + KALDI_ASSERT(ConvertStringToInteger("12345", &k) && k == 12345); + KALDI_ASSERT(!ConvertStringToInteger("-12345", &k)); // unsigned, + // cannot convert. +} + +template +void TestConvertStringToReal() { + Real d; + KALDI_ASSERT(ConvertStringToReal("1", &d) && d == 1.0); + KALDI_ASSERT(ConvertStringToReal("-1", &d) && d == -1.0); + KALDI_ASSERT(ConvertStringToReal("-1", &d) && d == -1.0); + KALDI_ASSERT(ConvertStringToReal(" -1 ", &d) && d == -1.0); + KALDI_ASSERT(!ConvertStringToReal("-1 x", &d)); + KALDI_ASSERT(!ConvertStringToReal("-1f", &d)); + KALDI_ASSERT(ConvertStringToReal("12345.2", &d) && fabs(d-12345.2) < 1.0); + KALDI_ASSERT(ConvertStringToReal("1.0e+08", &d) && fabs(d-1.0e+08) < 100.0); + + // it also works for inf or nan. + KALDI_ASSERT(ConvertStringToReal("inf", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal(" inf", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("inf ", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal(" inf ", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("+inf", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("-inf", &d) && d < 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("Inf", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("INF", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("InF", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("infinity", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("-infinity", &d) && d < 0 && d - d != 0); + KALDI_ASSERT(!ConvertStringToReal("GARBAGE inf", &d)); + KALDI_ASSERT(!ConvertStringToReal("GARBAGEinf", &d)); + KALDI_ASSERT(!ConvertStringToReal("infGARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("inf_GARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("inf GARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("GARBAGE infinity", &d)); + KALDI_ASSERT(!ConvertStringToReal("GARBAGEinfinity", &d)); + KALDI_ASSERT(!ConvertStringToReal("infinityGARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("infinity_GARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("infinity GARBAGE", &d)); + KALDI_ASSERT(ConvertStringToReal("1.#INF", &d) && d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("-1.#INF", &d) && d < 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal("-1.#INF ", &d) && d < 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal(" -1.#INF ", &d) && d < 0 && d - d != 0); + KALDI_ASSERT(!ConvertStringToReal("GARBAGE 1.#INF", &d)); + KALDI_ASSERT(!ConvertStringToReal("GARBAGE1.#INF", &d)); + KALDI_ASSERT(!ConvertStringToReal("2.#INF", &d)); + KALDI_ASSERT(!ConvertStringToReal("-2.#INF", &d)); + KALDI_ASSERT(!ConvertStringToReal("1.#INFGARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("1.#INF_GARBAGE", &d)); + + KALDI_ASSERT(ConvertStringToReal("nan", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("+nan", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("-nan", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("Nan", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("NAN", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("NaN", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal(" NaN", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("NaN ", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal(" NaN ", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("1.#QNAN", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("-1.#QNAN", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal("1.#QNAN ", &d) && d != d); + KALDI_ASSERT(ConvertStringToReal(" 1.#QNAN ", &d) && d != d); + KALDI_ASSERT(!ConvertStringToReal("GARBAGE nan", &d)); + KALDI_ASSERT(!ConvertStringToReal("GARBAGEnan", &d)); + KALDI_ASSERT(!ConvertStringToReal("nanGARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("nan_GARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("nan GARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("GARBAGE 1.#QNAN", &d)); + KALDI_ASSERT(!ConvertStringToReal("GARBAGE1.#QNAN", &d)); + KALDI_ASSERT(!ConvertStringToReal("2.#QNAN", &d)); + KALDI_ASSERT(!ConvertStringToReal("-2.#QNAN", &d)); + KALDI_ASSERT(!ConvertStringToReal("-1.#QNAN_GARBAGE", &d)); + KALDI_ASSERT(!ConvertStringToReal("-1.#QNANGARBAGE", &d)); +} + +template +void TestNan() { + Real d; + KALDI_ASSERT(ConvertStringToReal(std::to_string(sqrt(-1)), &d) && d != d); +} + +template +void TestInf() { + Real d; + KALDI_ASSERT(ConvertStringToReal(std::to_string(exp(10000)), &d) && + d > 0 && d - d != 0); + KALDI_ASSERT(ConvertStringToReal(std::to_string(-exp(10000)), &d) && + d < 0 && d - d != 0); +} + + +std::string TrimTmp(std::string s) { + Trim(&s); + return s; +} + +void TestTrim() { + KALDI_ASSERT(TrimTmp(" a ") == "a"); + KALDI_ASSERT(TrimTmp(" a b c") == "a b c"); + KALDI_ASSERT(TrimTmp("") == ""); + KALDI_ASSERT(TrimTmp("X\n") == "X"); + KALDI_ASSERT(TrimTmp("X\n\t") == "X"); + KALDI_ASSERT(TrimTmp("\n\tX") == "X"); +} // end namespace kaldi + + +void TestSplitStringOnFirstSpace() { + std::string a, b; + SplitStringOnFirstSpace("a b", &a, &b); + KALDI_ASSERT(a == "a" && b == "b"); + SplitStringOnFirstSpace("aa bb", &a, &b); + KALDI_ASSERT(a == "aa" && b == "bb"); + SplitStringOnFirstSpace("aa", &a, &b); + KALDI_ASSERT(a == "aa" && b == ""); + SplitStringOnFirstSpace(" aa \n\t ", &a, &b); + KALDI_ASSERT(a == "aa" && b == ""); + SplitStringOnFirstSpace(" \n\t ", &a, &b); + KALDI_ASSERT(a == "" && b == ""); + SplitStringOnFirstSpace(" aa bb \n\t ", &a, &b); + KALDI_ASSERT(a == "aa" && b == "bb"); + SplitStringOnFirstSpace(" aa bb cc ", &a, &b); + KALDI_ASSERT(a == "aa" && b == "bb cc"); + SplitStringOnFirstSpace(" aa bb cc ", &a, &b); + KALDI_ASSERT(a == "aa" && b == "bb cc"); + SplitStringOnFirstSpace(" aa bb cc", &a, &b); + KALDI_ASSERT(a == "aa" && b == "bb cc"); +} + +void TestIsToken() { + KALDI_ASSERT(IsToken("a")); + KALDI_ASSERT(IsToken("ab")); + KALDI_ASSERT(!IsToken("ab ")); + KALDI_ASSERT(!IsToken(" ab")); + KALDI_ASSERT(!IsToken("a b")); + KALDI_ASSERT(IsToken("\231")); // typical non-ASCII printable character, + // something with an accent. + KALDI_ASSERT(!IsToken("\377")); // character 255, which is a form of space. + KALDI_ASSERT(IsToken("a-b,c,d=ef")); + KALDI_ASSERT(!IsToken("a\nb")); + KALDI_ASSERT(!IsToken("a\tb")); + KALDI_ASSERT(!IsToken("ab\t")); + KALDI_ASSERT(!IsToken("")); +} + +void TestIsLine() { + KALDI_ASSERT(IsLine("a")); + KALDI_ASSERT(IsLine("a b")); + KALDI_ASSERT(!IsLine("a\nb")); + KALDI_ASSERT(!IsLine("a b ")); + KALDI_ASSERT(!IsLine(" a b")); +} + + +void TestStringsApproxEqual() { + // we must test the test. + KALDI_ASSERT(!StringsApproxEqual("a", "b")); + KALDI_ASSERT(!StringsApproxEqual("1", "2")); + KALDI_ASSERT(StringsApproxEqual("1.234", "1.235", 2)); + KALDI_ASSERT(!StringsApproxEqual("1.234", "1.235", 3)); + KALDI_ASSERT(StringsApproxEqual("x 1.234 y", "x 1.2345 y", 3)); + KALDI_ASSERT(!StringsApproxEqual("x 1.234 y", "x 1.2345 y", 4)); + KALDI_ASSERT(StringsApproxEqual("x 1.234 y 6.41", "x 1.235 y 6.49", 1)); + KALDI_ASSERT(!StringsApproxEqual("x 1.234 y 6.41", "x 1.235 y 6.49", 2)); + KALDI_ASSERT(StringsApproxEqual("x 1.234 y 6.41", "x 1.235 y 6.411", 2)); + KALDI_ASSERT(StringsApproxEqual("x 1.0 y", "x 1.0001 y", 3)); + KALDI_ASSERT(!StringsApproxEqual("x 1.0 y", "x 1.0001 y", 4)); +} + +void UnitTestConfigLineParse() { + std::string str; + { + ConfigLine cfl; + str = "a-b xx=yyy foo=bar baz=123 ba=1:2"; + bool status = cfl.ParseLine(str); + KALDI_ASSERT(status && cfl.FirstToken() == "a-b"); + + KALDI_ASSERT(cfl.HasUnusedValues()); + std::string str_value; + KALDI_ASSERT(cfl.GetValue("xx", &str_value)); + KALDI_ASSERT(str_value == "yyy"); + KALDI_ASSERT(cfl.HasUnusedValues()); + KALDI_ASSERT(cfl.GetValue("foo", &str_value)); + KALDI_ASSERT(str_value == "bar"); + KALDI_ASSERT(cfl.HasUnusedValues()); + KALDI_ASSERT(!cfl.GetValue("xy", &str_value)); + KALDI_ASSERT(cfl.GetValue("baz", &str_value)); + KALDI_ASSERT(str_value == "123"); + + std::vector int_values; + KALDI_ASSERT(!cfl.GetValue("xx", &int_values)); + KALDI_ASSERT(cfl.GetValue("baz", &int_values)); + KALDI_ASSERT(cfl.HasUnusedValues()); + KALDI_ASSERT(int_values.size() == 1 && int_values[0] == 123); + KALDI_ASSERT(cfl.GetValue("ba", &int_values)); + KALDI_ASSERT(int_values.size() == 2 && int_values[0] == 1 && int_values[1] == 2); + KALDI_ASSERT(!cfl.HasUnusedValues()); + } + + { + ConfigLine cfl; + str = "a-b baz=x y z pp = qq ab =cd ac= bd"; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = "a-b baz=x y z pp = qq ab=cd ac=bd"; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = "foo-bar"; + KALDI_ASSERT(cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = "foo-bar a=b c d f=g"; + std::string value; + KALDI_ASSERT(cfl.ParseLine(str) && cfl.FirstToken() == "foo-bar" && + cfl.GetValue("a", &value) && value == "b c d" && + cfl.GetValue("f", &value) && value == "g" && + !cfl.HasUnusedValues()); + } + { + ConfigLine cfl; + str = "zzz a=b baz"; + KALDI_ASSERT(cfl.ParseLine(str) && cfl.FirstToken() == "zzz" && + cfl.UnusedValues() == "a=b baz"); + } + { + ConfigLine cfl; + str = "xxx a=b baz "; + KALDI_ASSERT(cfl.ParseLine(str) && cfl.UnusedValues() == "a=b baz"); + } + { + ConfigLine cfl; + str = "xxx a=b =c"; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = "xxx baz='x y z' pp=qq ab=cd ac=bd"; + KALDI_ASSERT(cfl.ParseLine(str) && cfl.FirstToken() == "xxx"); + std::string str_value; + KALDI_ASSERT(cfl.GetValue("baz", &str_value)); + KALDI_ASSERT(str_value == "x y z"); + KALDI_ASSERT(cfl.GetValue("pp", &str_value)); + KALDI_ASSERT(str_value == "qq"); + KALDI_ASSERT(cfl.UnusedValues() == "ab=cd ac=bd"); + KALDI_ASSERT(cfl.GetValue("ab", &str_value)); + KALDI_ASSERT(str_value == "cd"); + KALDI_ASSERT(cfl.UnusedValues() == "ac=bd"); + KALDI_ASSERT(cfl.HasUnusedValues()); + KALDI_ASSERT(cfl.GetValue("ac", &str_value)); + KALDI_ASSERT(str_value == "bd"); + KALDI_ASSERT(!cfl.HasUnusedValues()); + } + + { + ConfigLine cfl; + str = "x baz= pp = qq flag=t "; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = " x baz= pp=qq flag=t "; + KALDI_ASSERT(cfl.ParseLine(str) && cfl.FirstToken() == "x"); + + std::string str_value; + KALDI_ASSERT(cfl.GetValue("baz", &str_value)); + KALDI_ASSERT(str_value == ""); + KALDI_ASSERT(cfl.GetValue("pp", &str_value)); + KALDI_ASSERT(str_value == "qq"); + KALDI_ASSERT(cfl.HasUnusedValues()); + KALDI_ASSERT(cfl.GetValue("flag", &str_value)); + KALDI_ASSERT(str_value == "t"); + KALDI_ASSERT(!cfl.HasUnusedValues()); + + bool bool_value = false; + KALDI_ASSERT(cfl.GetValue("flag", &bool_value)); + KALDI_ASSERT(bool_value); + } + + { + ConfigLine cfl; + str = "xx _baz=a -pp=qq"; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = "xx 0baz=a pp=qq"; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = "xx -baz=a pp=qq"; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = "xx _baz'=a pp=qq"; + KALDI_ASSERT(!cfl.ParseLine(str)); + } + { + ConfigLine cfl; + str = " baz=g"; + KALDI_ASSERT(cfl.ParseLine(str) && cfl.FirstToken() == ""); + bool flag; + KALDI_ASSERT(!cfl.GetValue("baz", &flag)); + } + { + ConfigLine cfl; + str = "xx _baz1=a pp=qq"; + KALDI_ASSERT(cfl.ParseLine(str)); + + std::string str_value; + KALDI_ASSERT(cfl.GetValue("_baz1", &str_value)); + } +} + +void UnitTestReadConfig() { + std::string str = "a-b alpha=aa beta=\"b b\"# String test\n" + "a-b beta2='b c' beta3=bd # \n" + "a-b gamma=1:2:3:4 # Int Vector test\n" + " a-b de1ta=f # Bool + Integer in key Comment test delta=t \n" + "a-b _epsilon=-1 # Int Vector test _epsilon=1 \n" + "a-b zet-_a=0.15 theta=1.1# Float, -, _ test\n" + "a-b quoted='a b c' # quoted string\n" + "a-b quoted2=\"d e 'a b=c' f\" # string quoted with double quotes"; + + std::istringstream is(str); + std::vector lines; + ReadConfigLines(is, &lines); + KALDI_ASSERT(lines.size() == 8); + + ConfigLine cfl; + for (size_t i = 0; i < lines.size(); i++) { + KALDI_ASSERT(cfl.ParseLine(lines[i]) && cfl.FirstToken() == "a-b"); + if (i == 1) { + KALDI_ASSERT(cfl.GetValue("beta2", &str) && str == "b c"); + } + if (i == 4) { + KALDI_ASSERT(cfl.GetValue("_epsilon", &str) && str == "-1"); + } + if (i == 5) { + BaseFloat float_val = 0; + KALDI_ASSERT(cfl.GetValue("zet-_a", &float_val) && ApproxEqual(float_val, 0.15)); + } + if (i == 6) { + KALDI_ASSERT(cfl.GetValue("quoted", &str) && str == "a b c"); + } + if (i == 7) { + KALDI_ASSERT(cfl.GetValue("quoted2", &str) && str == "d e 'a b=c' f"); + } + } +} + +} // end namespace kaldi + +int main() { + using namespace kaldi; + TestSplitStringToVector(); + TestSplitStringToIntegers(); + TestSplitStringToFloats(); + TestConvertStringToInteger(); + TestConvertStringToReal(); + TestConvertStringToReal(); + TestTrim(); + TestSplitStringOnFirstSpace(); + TestIsToken(); + TestIsLine(); + TestStringsApproxEqual(); + TestNan(); + TestNan(); + TestInf(); + TestInf(); + UnitTestConfigLineParse(); + UnitTestReadConfig(); + std::cout << "Test OK\n"; +} diff --git a/runtime/onnxruntime/third_party/kaldi/util/text-utils.cc b/runtime/onnxruntime/third_party/kaldi/util/text-utils.cc new file mode 100644 index 0000000..85006e9 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/util/text-utils.cc @@ -0,0 +1,591 @@ +// util/text-utils.cc + +// Copyright 2009-2011 Saarland University; Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 + +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#include "util/text-utils.h" +#include +#include +#include +#include "base/kaldi-common.h" + +namespace kaldi { + + +template +bool SplitStringToFloats(const std::string &full, + const char *delim, + bool omit_empty_strings, // typically false + std::vector *out) { + KALDI_ASSERT(out != NULL); + if (*(full.c_str()) == '\0') { + out->clear(); + return true; + } + std::vector split; + SplitStringToVector(full, delim, omit_empty_strings, &split); + out->resize(split.size()); + for (size_t i = 0; i < split.size(); i++) { + F f = 0; + if (!ConvertStringToReal(split[i], &f)) + return false; + (*out)[i] = f; + } + return true; +} + +// Instantiate the template above for float and double. +template +bool SplitStringToFloats(const std::string &full, + const char *delim, + bool omit_empty_strings, + std::vector *out); +template +bool SplitStringToFloats(const std::string &full, + const char *delim, + bool omit_empty_strings, + std::vector *out); + +void SplitStringToVector(const std::string &full, const char *delim, + bool omit_empty_strings, + std::vector *out) { + size_t start = 0, found = 0, end = full.size(); + out->clear(); + while (found != std::string::npos) { + found = full.find_first_of(delim, start); + // start != end condition is for when the delimiter is at the end + if (!omit_empty_strings || (found != start && start != end)) + out->push_back(full.substr(start, found - start)); + start = found + 1; + } +} + +void JoinVectorToString(const std::vector &vec_in, + const char *delim, bool omit_empty_strings, + std::string *str_out) { + std::string tmp_str; + for (size_t i = 0; i < vec_in.size(); i++) { + if (!omit_empty_strings || !vec_in[i].empty()) { + tmp_str.append(vec_in[i]); + if (i < vec_in.size() - 1) + if (!omit_empty_strings || !vec_in[i+1].empty()) + tmp_str.append(delim); + } + } + str_out->swap(tmp_str); +} + +void Trim(std::string *str) { + const char *white_chars = " \t\n\r\f\v"; + + std::string::size_type pos = str->find_last_not_of(white_chars); + if (pos != std::string::npos) { + str->erase(pos + 1); + pos = str->find_first_not_of(white_chars); + if (pos != std::string::npos) str->erase(0, pos); + } else { + str->erase(str->begin(), str->end()); + } +} + +bool IsToken(const std::string &token) { + size_t l = token.length(); + if (l == 0) return false; + for (size_t i = 0; i < l; i++) { + unsigned char c = token[i]; + if ((!isprint(c) || isspace(c)) && (isascii(c) || c == (unsigned char)255)) + return false; + // The "&& (isascii(c) || c == 255)" was added so that we won't reject + // non-ASCII characters such as French characters with accents [except for + // 255 which is "nbsp", a form of space]. + } + return true; +} + + +void SplitStringOnFirstSpace(const std::string &str, + std::string *first, + std::string *rest) { + const char *white_chars = " \t\n\r\f\v"; + typedef std::string::size_type I; + const I npos = std::string::npos; + I first_nonwhite = str.find_first_not_of(white_chars); + if (first_nonwhite == npos) { + first->clear(); + rest->clear(); + return; + } + // next_white is first whitespace after first nonwhitespace. + I next_white = str.find_first_of(white_chars, first_nonwhite); + + if (next_white == npos) { // no more whitespace... + *first = std::string(str, first_nonwhite); + rest->clear(); + return; + } + I next_nonwhite = str.find_first_not_of(white_chars, next_white); + if (next_nonwhite == npos) { + *first = std::string(str, first_nonwhite, next_white-first_nonwhite); + rest->clear(); + return; + } + + I last_nonwhite = str.find_last_not_of(white_chars); + KALDI_ASSERT(last_nonwhite != npos); // or coding error. + + *first = std::string(str, first_nonwhite, next_white-first_nonwhite); + *rest = std::string(str, next_nonwhite, last_nonwhite+1-next_nonwhite); +} + +bool IsLine(const std::string &line) { + if (line.find('\n') != std::string::npos) return false; + if (line.empty()) return true; + if (isspace(*(line.begin()))) return false; + if (isspace(*(line.rbegin()))) return false; + std::string::const_iterator iter = line.begin(), end = line.end(); + for (; iter != end; iter++) + if (!isprint(*iter)) return false; + return true; +} + +template +class NumberIstream{ + public: + explicit NumberIstream(std::istream &i) : in_(i) {} + + NumberIstream & operator >> (T &x) { + if (!in_.good()) return *this; + in_ >> x; + if (!in_.fail() && RemainderIsOnlySpaces()) return *this; + return ParseOnFail(&x); + } + + private: + std::istream &in_; + + bool RemainderIsOnlySpaces() { + if (in_.tellg() != std::istream::pos_type(-1)) { + std::string rem; + in_ >> rem; + + if (rem.find_first_not_of(' ') != std::string::npos) { + // there is not only spaces + return false; + } + } + + in_.clear(); + return true; + } + + NumberIstream & ParseOnFail(T *x) { + std::string str; + in_.clear(); + in_.seekg(0); + // If the stream is broken even before trying + // to read from it or if there are many tokens, + // it's pointless to try. + if (!(in_ >> str) || !RemainderIsOnlySpaces()) { + in_.setstate(std::ios_base::failbit); + return *this; + } + + std::map inf_nan_map; + // we'll keep just uppercase values. + inf_nan_map["INF"] = std::numeric_limits::infinity(); + inf_nan_map["+INF"] = std::numeric_limits::infinity(); + inf_nan_map["-INF"] = - std::numeric_limits::infinity(); + inf_nan_map["INFINITY"] = std::numeric_limits::infinity(); + inf_nan_map["+INFINITY"] = std::numeric_limits::infinity(); + inf_nan_map["-INFINITY"] = - std::numeric_limits::infinity(); + inf_nan_map["NAN"] = std::numeric_limits::quiet_NaN(); + inf_nan_map["+NAN"] = std::numeric_limits::quiet_NaN(); + inf_nan_map["-NAN"] = - std::numeric_limits::quiet_NaN(); + // MSVC + inf_nan_map["1.#INF"] = std::numeric_limits::infinity(); + inf_nan_map["-1.#INF"] = - std::numeric_limits::infinity(); + inf_nan_map["1.#QNAN"] = std::numeric_limits::quiet_NaN(); + inf_nan_map["-1.#QNAN"] = - std::numeric_limits::quiet_NaN(); + + std::transform(str.begin(), str.end(), str.begin(), ::toupper); + + if (inf_nan_map.find(str) != inf_nan_map.end()) { + *x = inf_nan_map[str]; + } else { + in_.setstate(std::ios_base::failbit); + } + + return *this; + } +}; + + +template +bool ConvertStringToReal(const std::string &str, + T *out) { + std::istringstream iss(str); + + NumberIstream i(iss); + + i >> *out; + + if (iss.fail()) { + // Number conversion failed. + return false; + } + + return true; +} + +template +bool ConvertStringToReal(const std::string &str, + float *out); +template +bool ConvertStringToReal(const std::string &str, + double *out); + + + +/* + This function is a helper function of StringsApproxEqual. It should be + thought of as a recursive function-- it was designed that way-- but rather + than actually recursing (which would cause problems with stack overflow), we + just set the args and return to the start. + + The 'decimal_places_tolerance' argument is just passed in from outside, + see the documentation for StringsApproxEqual in text-utils.h to see an + explanation. The argument 'places_into_number' provides some information + about the strings 'a' and 'b' that precedes the current pointers. + For purposes of this comment, let's define the 'decimal' of a number + as the part that comes after the decimal point, e.g. in '99.123', + '123' would be the decimal. If 'places_into_number' is -1, it means + we're not currently inside some place like that (i.e. it's not the + case that we're pointing to the '1' or the '2' or the '3'). + If it's 0, then we'd be pointing to the first place after the decimal, + '1' in this case. Note if one of the numbers is shorter than the + other, like '99.123' versus '99.1234' and 'a' points to the first '3' + while 'b' points to the second '4', 'places_into_number' referes to the + shorter of the two, i.e. it would be 2 in this example. + + + */ +bool StringsApproxEqualInternal(const char *a, const char *b, + int32 decimal_places_tolerance, + int32 places_into_number) { +start: + char ca = *a, cb = *b; + if (ca == cb) { + if (ca == '\0') { + return true; + } else { + if (places_into_number >= 0) { + if (isdigit(ca)) { + places_into_number++; + } else { + places_into_number = -1; + } + } else { + if (ca == '.') { + places_into_number = 0; + } + } + a++; + b++; + goto start; + } + } else { + if (places_into_number >= decimal_places_tolerance && + (isdigit(ca) || isdigit(cb))) { + // we're potentially willing to accept this difference between the + // strings. + if (isdigit(ca)) a++; + if (isdigit(cb)) b++; + // we'll have advanced at least one of the two strings. + goto start; + } else if (places_into_number >= 0 && + ((ca == '0' && !isdigit(cb)) || (cb == '0' && !isdigit(ca)))) { + // this clause is designed to ensure that, for example, + // "0.1" would count the same as "0.100001". + if (ca == '0') a++; + else b++; + places_into_number++; + goto start; + } else { + return false; + } + } + +} + + +bool StringsApproxEqual(const std::string &a, + const std::string &b, + int32 decimal_places_tolerance) { + return StringsApproxEqualInternal(a.c_str(), b.c_str(), + decimal_places_tolerance, -1); +} + + +bool ConfigLine::ParseLine(const std::string &line) { + data_.clear(); + whole_line_ = line; + if (line.size() == 0) return false; // Empty line + size_t pos = 0, size = line.size(); + while (isspace(line[pos]) && pos < size) pos++; + if (pos == size) + return false; // whitespace-only line + size_t first_token_start_pos = pos; + // first get first_token_. + while (!isspace(line[pos]) && pos < size) { + if (line[pos] == '=') { + // If the first block of non-whitespace looks like "foo-bar=...", + // then we ignore it: there is no initial token, and FirstToken() + // is empty. + pos = first_token_start_pos; + break; + } + pos++; + } + first_token_ = std::string(line, first_token_start_pos, pos - first_token_start_pos); + // first_token_ is expected to be either empty or something like + // "component-node", which actually is a slightly more restrictive set of + // strings than IsValidName() checks for this is a convenient way to check it. + if (!first_token_.empty() && !IsValidName(first_token_)) + return false; + + while (pos < size) { + if (isspace(line[pos])) { + pos++; + continue; + } + + // OK, at this point we know that we are pointing at nonspace. + size_t next_equals_sign = line.find_first_of("=", pos); + if (next_equals_sign == pos || next_equals_sign == std::string::npos) { + // we're looking for something like 'key=value'. If there is no equals sign, + // or it's not preceded by something, it's a parsing failure. + return false; + } + std::string key(line, pos, next_equals_sign - pos); + if (!IsValidName(key)) return false; + + // handle any quotes. we support key='blah blah' or key="foo bar". + // no escaping is supported. + if (line[next_equals_sign+1] == '\'' || line[next_equals_sign+1] == '"') { + char my_quote = line[next_equals_sign+1]; + size_t next_quote = line.find_first_of(my_quote, next_equals_sign + 2); + if (next_quote == std::string::npos) { // no matching quote was found. + KALDI_WARN << "No matching quote for " << my_quote << " in config line '" + << line << "'"; + return false; + } else { + std::string value(line, next_equals_sign + 2, + next_quote - next_equals_sign - 2); + data_.insert(std::make_pair(key, std::make_pair(value, false))); + pos = next_quote + 1; + continue; + } + } else { + // we want to be able to parse something like "... input=Offset(a, -1) foo=bar": + // in general, config values with spaces in them, even without quoting. + + size_t next_next_equals_sign = line.find_first_of("=", next_equals_sign + 1), + terminating_space = size; + + if (next_next_equals_sign != std::string::npos) { // found a later equals sign. + size_t preceding_space = line.find_last_of(" \t", next_next_equals_sign); + if (preceding_space != std::string::npos && + preceding_space > next_equals_sign) + terminating_space = preceding_space; + } + while (isspace(line[terminating_space - 1]) && terminating_space > 0) + terminating_space--; + + std::string value(line, next_equals_sign + 1, + terminating_space - (next_equals_sign + 1)); + data_.insert(std::make_pair(key, std::make_pair(value, false))); + pos = terminating_space; + } + } + return true; +} + +bool ConfigLine::GetValue(const std::string &key, std::string *value) { + KALDI_ASSERT(value != NULL); + std::map >::iterator it = data_.begin(); + for (; it != data_.end(); ++it) { + if (it->first == key) { + *value = (it->second).first; + (it->second).second = true; + return true; + } + } + return false; +} + +bool ConfigLine::GetValue(const std::string &key, BaseFloat *value) { + KALDI_ASSERT(value != NULL); + std::map >::iterator it = data_.begin(); + for (; it != data_.end(); ++it) { + if (it->first == key) { + if (!ConvertStringToReal((it->second).first, value)) + return false; + (it->second).second = true; + return true; + } + } + return false; +} + +bool ConfigLine::GetValue(const std::string &key, int32 *value) { + KALDI_ASSERT(value != NULL); + std::map >::iterator it = data_.begin(); + for (; it != data_.end(); ++it) { + if (it->first == key) { + if (!ConvertStringToInteger((it->second).first, value)) + return false; + (it->second).second = true; + return true; + } + } + return false; +} + +bool ConfigLine::GetValue(const std::string &key, std::vector *value) { + KALDI_ASSERT(value != NULL); + value->clear(); + std::map >::iterator it = data_.begin(); + for (; it != data_.end(); ++it) { + if (it->first == key) { + if (!SplitStringToIntegers((it->second).first, ":,", true, value)) { + // KALDI_WARN << "Bad option " << (it->second).first; + return false; + } + (it->second).second = true; + return true; + } + } + return false; +} + +bool ConfigLine::GetValue(const std::string &key, bool *value) { + KALDI_ASSERT(value != NULL); + std::map >::iterator it = data_.begin(); + for (; it != data_.end(); ++it) { + if (it->first == key) { + if ((it->second).first.size() == 0) return false; + switch (((it->second).first)[0]) { + case 'F': + case 'f': + *value = false; + break; + case 'T': + case 't': + *value = true; + break; + default: + return false; + } + (it->second).second = true; + return true; + } + } + return false; +} + +bool ConfigLine::HasUnusedValues() const { + std::map >::const_iterator it = data_.begin(); + for (; it != data_.end(); ++it) { + if (!(it->second).second) return true; + } + return false; +} + +std::string ConfigLine::UnusedValues() const { + std::string unused_str; + std::map >::const_iterator it = data_.begin(); + for (; it != data_.end(); ++it) { + if (!(it->second).second) { + if (unused_str == "") + unused_str = it->first + "=" + (it->second).first; + else + unused_str += " " + it->first + "=" + (it->second).first; + } + } + return unused_str; +} + +//// This is like ExpectToken but for two tokens, and it +//// will either accept token1 and then token2, or just token2. +//// This is useful in Read functions where the first token +//// may already have been consumed. +//void ExpectOneOrTwoTokens(std::istream &is, bool binary, +// const std::string &token1, +// const std::string &token2) { +// KALDI_ASSERT(token1 != token2); +// std::string temp; +// ReadToken(is, binary, &temp); +// if (temp == token1) { +// ExpectToken(is, binary, token2); +// } else { +// if (temp != token2) { +// KALDI_ERR << "Expecting token " << token1 << " or " << token2 +// << " but got " << temp; +// } +// } +//} + + +bool IsValidName(const std::string &name) { + if (name.size() == 0) return false; + for (size_t i = 0; i < name.size(); i++) { + if (i == 0 && !isalpha(name[i]) && name[i] != '_') + return false; + if (!isalnum(name[i]) && name[i] != '_' && name[i] != '-' && name[i] != '.') + return false; + } + return true; +} + +void ReadConfigLines(std::istream &is, + std::vector *lines) { + KALDI_ASSERT(lines != NULL); + std::string line; + while (std::getline(is, line)) { + if (line.size() == 0) continue; + size_t start = line.find_first_not_of(" \t"); + size_t end = line.find_first_of('#'); + if (start == std::string::npos || start == end) continue; + end = line.find_last_not_of(" \t", end - 1); + KALDI_ASSERT(end >= start); + lines->push_back(line.substr(start, end - start + 1)); + } +} + +void ParseConfigLines(const std::vector &lines, + std::vector *config_lines) { + config_lines->resize(lines.size()); + for (size_t i = 0; i < lines.size(); i++) { + bool ret = (*config_lines)[i].ParseLine(lines[i]); + if (!ret) { + KALDI_ERR << "Error parsing config line: " << lines[i]; + } + } +} + + +} // end namespace kaldi diff --git a/runtime/onnxruntime/third_party/kaldi/util/text-utils.h b/runtime/onnxruntime/third_party/kaldi/util/text-utils.h new file mode 100644 index 0000000..02f4bf4 --- /dev/null +++ b/runtime/onnxruntime/third_party/kaldi/util/text-utils.h @@ -0,0 +1,281 @@ +// util/text-utils.h + +// Copyright 2009-2011 Saarland University; Microsoft Corporation + +// See ../../COPYING for clarification regarding multiple authors +// +// 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 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +// MERCHANTABLITY OR NON-INFRINGEMENT. +// See the Apache 2 License for the specific language governing permissions and +// limitations under the License. + +#ifndef KALDI_UTIL_TEXT_UTILS_H_ +#define KALDI_UTIL_TEXT_UTILS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include "base/kaldi-common.h" + + +namespace kaldi { + +/// Split a string using any of the single character delimiters. +/// If omit_empty_strings == true, the output will contain any +/// nonempty strings after splitting on any of the +/// characters in the delimiter. If omit_empty_strings == false, +/// the output will contain n+1 strings if there are n characters +/// in the set "delim" within the input string. In this case +/// the empty string is split to a single empty string. +void SplitStringToVector(const std::string &full, const char *delim, + bool omit_empty_strings, + std::vector *out); + +/// Joins the elements of a vector of strings into a single string using +/// "delim" as the delimiter. If omit_empty_strings == true, any empty strings +/// in the vector are skipped. A vector of empty strings results in an empty +/// string on the output. +void JoinVectorToString(const std::vector &vec_in, + const char *delim, bool omit_empty_strings, + std::string *str_out); + +/** + \brief Split a string (e.g. 1:2:3) into a vector of integers. + + \param [in] delim String containing a list of characters, any of which + is allowed as a delimiter. + \param [in] omit_empty_strings If true, empty strings between delimiters are + allowed and will not produce an output integer; if false, + instances of characters in 'delim' that are consecutive or + at the start or end of the string would be an error. + You'll normally want this to be true if 'delim' consists + of spaces, and false otherwise. + \param [out] out The output list of integers. +*/ +template +bool SplitStringToIntegers(const std::string &full, + const char *delim, + bool omit_empty_strings, // typically false [but + // should probably be true + // if "delim" is spaces]. + std::vector *out) { + KALDI_ASSERT(out != NULL); + KALDI_ASSERT_IS_INTEGER_TYPE(I); + if (*(full.c_str()) == '\0') { + out->clear(); + return true; + } + std::vector split; + SplitStringToVector(full, delim, omit_empty_strings, &split); + out->resize(split.size()); + for (size_t i = 0; i < split.size(); i++) { + const char *this_str = split[i].c_str(); + char *end = NULL; + int64 j = 0; + j = KALDI_STRTOLL(this_str, &end); + if (end == this_str || *end != '\0') { + out->clear(); + return false; + } else { + I jI = static_cast(j); + if (static_cast(jI) != j) { + // output type cannot fit this integer. + out->clear(); + return false; + } + (*out)[i] = jI; + } + } + return true; +} + +// This is defined for F = float and double. +template +bool SplitStringToFloats(const std::string &full, + const char *delim, + bool omit_empty_strings, // typically false + std::vector *out); + + +/// Converts a string into an integer via strtoll and returns false if there was +/// any kind of problem (i.e. the string was not an integer or contained extra +/// non-whitespace junk, or the integer was too large to fit into the type it is +/// being converted into). Only sets *out if everything was OK and it returns +/// true. +template +bool ConvertStringToInteger(const std::string &str, + Int *out) { + KALDI_ASSERT_IS_INTEGER_TYPE(Int); + const char *this_str = str.c_str(); + char *end = NULL; + errno = 0; + int64 i = KALDI_STRTOLL(this_str, &end); + if (end != this_str) + while (isspace(*end)) end++; + if (end == this_str || *end != '\0' || errno != 0) + return false; + Int iInt = static_cast(i); + if (static_cast(iInt) != i || + (i < 0 && !std::numeric_limits::is_signed)) { + return false; + } + *out = iInt; + return true; +} + + +/// ConvertStringToReal converts a string into either float or double +/// and returns false if there was any kind of problem (i.e. the string +/// was not a floating point number or contained extra non-whitespace junk). +/// Be careful- this function will successfully read inf's or nan's. +template +bool ConvertStringToReal(const std::string &str, + T *out); + +/// Removes the beginning and trailing whitespaces from a string +void Trim(std::string *str); + + +/// Removes leading and trailing white space from the string, then splits on the +/// first section of whitespace found (if present), putting the part before the +/// whitespace in "first" and the rest in "rest". If there is no such space, +/// everything that remains after removing leading and trailing whitespace goes +/// in "first". +void SplitStringOnFirstSpace(const std::string &line, + std::string *first, + std::string *rest); + + +/// Returns true if "token" is nonempty, and all characters are +/// printable and whitespace-free. +bool IsToken(const std::string &token); + + +/// Returns true if "line" is free of \n characters and unprintable +/// characters, and does not contain leading or trailing whitespace. +bool IsLine(const std::string &line); + + + +/** + This function returns true when two text strings are approximately equal, and + false when they are not. The definition of 'equal' is normal string + equality, except that two substrings like "0.31134" and "0.311341" would be + considered equal. 'decimal_places_tolerance' controls how many digits after + the '.' have to match up. + E.g. StringsApproxEqual("hello 0.23 there", "hello 0.24 there", 2) would + return false because there is a difference in the 2nd decimal, but with + an argument of 1 it would return true. + */ +bool StringsApproxEqual(const std::string &a, + const std::string &b, + int32 decimal_places_check = 2); + +/** + This class is responsible for parsing input like + hi-there xx=yyy a=b c empty= f-oo=Append(bar, sss) ba_z=123 bing='a b c' baz="a b c d='a b' e" + and giving you access to the fields, in this case + + FirstToken() == "hi-there", and key->value pairs: + + xx->yyy, a->"b c", empty->"", f-oo->"Append(bar, sss)", ba_z->"123", + bing->"a b c", baz->"a b c d='a b' e" + + The first token is optional, if the line started with a key-value pair then + FirstValue() will be empty. + + Note: it can parse value fields with space inside them only if they are free of the '=' + character. If values are going to contain the '=' character, you need to quote them + with either single or double quotes. + + Key values may contain -_a-zA-Z0-9, but must begin with a-zA-Z_. + */ +class ConfigLine { + public: + // Tries to parse the line as a config-file line. Returns false + // if it could not for some reason, e.g. parsing failure. In most cases + // prints no warnings; the user should do this. Does not expect comments. + bool ParseLine(const std::string &line); + + // the GetValue functions are overloaded for various types. They return true + // if the key exists with value that can be converted to that type, and false + // otherwise. They also mark the key-value pair as having been read. It is + // not an error to read values twice. + bool GetValue(const std::string &key, std::string *value); + bool GetValue(const std::string &key, BaseFloat *value); + bool GetValue(const std::string &key, int32 *value); + // Values may be separated by ":" or by ",". + bool GetValue(const std::string &key, std::vector *value); + bool GetValue(const std::string &key, bool *value); + + bool HasUnusedValues() const; + /// returns e.g. foo=bar xxx=yyy if foo and xxx were not consumed by one + /// of the GetValue() functions. + std::string UnusedValues() const; + + const std::string &FirstToken() const { return first_token_; } + + const std::string WholeLine() { return whole_line_; } + // use default assignment operator and copy constructor. + private: + std::string whole_line_; + // the first token of the line, e.g. if line is + // foo-bar baz=bing + // then first_token_ would be "foo-bar". + std::string first_token_; + + // data_ maps from key to (value, is-this-value-consumed?). + std::map > data_; + +}; + +/// This function is like ExpectToken but for two tokens, and it will either +/// accept token1 and then token2, or just token2. This is useful in Read +/// functions where the first token may already have been consumed. +void ExpectOneOrTwoTokens(std::istream &is, bool binary, + const std::string &token1, + const std::string &token2); + + +/** + This function reads in a config file and *appends* its contents to a vector of + lines; it is responsible for removing comments (anything after '#') and + stripping out any lines that contain only whitespace after comment removal. + */ +void ReadConfigLines(std::istream &is, + std::vector *lines); + + +/** + This function converts config-lines from a simple sequence of strings + as output by ReadConfigLines(), into a sequence of first-tokens and + name-value pairs. The general format is: + "command-type bar=baz xx=yyy" + etc., although there are subtleties as to what exactly is allowed, see + documentation for class ConfigLine for details. + This function will die if there was a parsing failure. + */ +void ParseConfigLines(const std::vector &lines, + std::vector *config_lines); + + +/// Returns true if 'name' would be a valid name for a component or node in a +/// nnet3Nnet. This is a nonempty string beginning with A-Za-z_, and containing only +/// '-', '_', '.', A-Z, a-z, or 0-9. +bool IsValidName(const std::string &name); + +} // namespace kaldi + +#endif // KALDI_UTIL_TEXT_UTILS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/.editorconfig b/runtime/onnxruntime/third_party/openfst/.editorconfig new file mode 100644 index 0000000..b2bfe87 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/.editorconfig @@ -0,0 +1,11 @@ +; EditorConfig to support per-solution formatting. +; Use the EditorConfig VS add-in to make this work before VS 2017 + +; This is the default for the codeline. +root = true + +[*] +charset = utf-8 ; Remove the pesky BOM from files. +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/runtime/onnxruntime/third_party/openfst/.gitignore b/runtime/onnxruntime/third_party/openfst/.gitignore new file mode 100644 index 0000000..5cb5d5d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/.gitignore @@ -0,0 +1,31 @@ +# Ignore extensionless files +* +!*.* +!*/ + +# Other patterns +/config.h +/config.log +/config.status +.deps/ +.libs/ +.dirstamp +*.la +*.lo +*.o + +# Windows-specific files +.vs/ +*.VC.db +Win32/ +x64/ +Debug/ +Release/ +obj/ +/bin/ +*.binlog +*proj.user +/cmake +/cmake64 +/CMakeSettings.json +/*.zip \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/openfst/BUILD.bazel b/runtime/onnxruntime/third_party/openfst/BUILD.bazel new file mode 100644 index 0000000..7a1d7a0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/BUILD.bazel @@ -0,0 +1,931 @@ +# Copyright 2015-2019 Google LLC. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) # Apache 2.0 + +exports_files(["COPYING"]) + +prefix_dir = "src/" + +static_binary = 1 + +# Core library (lib/) + +cc_library( + name = "fst-decl", + hdrs = [prefix_dir + "include/fst/fst-decl.h"], + includes = [prefix_dir + "include"], + deps = [":base"], +) + +PUBLIC_HEADERS = [ + # One-stop header file which includes the remaining headers below: + prefix_dir + "include/fst/fstlib.h", + + # Fine-grained headers: + prefix_dir + "include/fst/accumulator.h", + prefix_dir + "include/fst/add-on.h", + prefix_dir + "include/fst/arc-arena.h", + prefix_dir + "include/fst/arc-map.h", + prefix_dir + "include/fst/arc.h", + prefix_dir + "include/fst/arcfilter.h", + prefix_dir + "include/fst/arcsort.h", + prefix_dir + "include/fst/bi-table.h", + prefix_dir + "include/fst/cache.h", + prefix_dir + "include/fst/closure.h", + prefix_dir + "include/fst/compact-fst.h", + prefix_dir + "include/fst/complement.h", + prefix_dir + "include/fst/compose-filter.h", + prefix_dir + "include/fst/compose.h", + prefix_dir + "include/fst/concat.h", + prefix_dir + "include/fst/connect.h", + prefix_dir + "include/fst/const-fst.h", + prefix_dir + "include/fst/determinize.h", + prefix_dir + "include/fst/dfs-visit.h", + prefix_dir + "include/fst/difference.h", + prefix_dir + "include/fst/disambiguate.h", + prefix_dir + "include/fst/edit-fst.h", + prefix_dir + "include/fst/encode.h", + prefix_dir + "include/fst/epsnormalize.h", + prefix_dir + "include/fst/equal.h", + prefix_dir + "include/fst/equivalent.h", + prefix_dir + "include/fst/expanded-fst.h", + prefix_dir + "include/fst/factor-weight.h", + prefix_dir + "include/fst/filter-state.h", + prefix_dir + "include/fst/fst.h", + prefix_dir + "include/fst/heap.h", + prefix_dir + "include/fst/intersect.h", + prefix_dir + "include/fst/invert.h", + prefix_dir + "include/fst/isomorphic.h", + prefix_dir + "include/fst/label-reachable.h", + prefix_dir + "include/fst/lookahead-filter.h", + prefix_dir + "include/fst/lookahead-matcher.h", + prefix_dir + "include/fst/map.h", + prefix_dir + "include/fst/matcher-fst.h", + prefix_dir + "include/fst/matcher.h", + prefix_dir + "include/fst/memory.h", + prefix_dir + "include/fst/minimize.h", + prefix_dir + "include/fst/mutable-fst.h", + prefix_dir + "include/fst/partition.h", + prefix_dir + "include/fst/project.h", + prefix_dir + "include/fst/properties.h", + prefix_dir + "include/fst/prune.h", + prefix_dir + "include/fst/push.h", + prefix_dir + "include/fst/queue.h", + prefix_dir + "include/fst/randequivalent.h", + prefix_dir + "include/fst/randgen.h", + prefix_dir + "include/fst/rational.h", + prefix_dir + "include/fst/relabel.h", + prefix_dir + "include/fst/replace-util.h", + prefix_dir + "include/fst/replace.h", + prefix_dir + "include/fst/reverse.h", + prefix_dir + "include/fst/reweight.h", + prefix_dir + "include/fst/rmepsilon.h", + prefix_dir + "include/fst/rmfinalepsilon.h", + prefix_dir + "include/fst/shortest-distance.h", + prefix_dir + "include/fst/shortest-path.h", + prefix_dir + "include/fst/state-map.h", + prefix_dir + "include/fst/state-reachable.h", + prefix_dir + "include/fst/state-table.h", + prefix_dir + "include/fst/statesort.h", + prefix_dir + "include/fst/string.h", + prefix_dir + "include/fst/symbol-table-ops.h", + prefix_dir + "include/fst/synchronize.h", + prefix_dir + "include/fst/test-properties.h", + prefix_dir + "include/fst/topsort.h", + prefix_dir + "include/fst/union.h", + prefix_dir + "include/fst/vector-fst.h", + prefix_dir + "include/fst/verify.h", + prefix_dir + "include/fst/visit.h", +] + +# This version does not have the export-dynamic flag set and should not be +# used to load dynamic-shared object FST extensions. Please see the +# "lib_export_dynamic" target below for binaries that need DSO loading. +cc_library( + name = "lib_lite", + srcs = [ + prefix_dir + "lib/fst.cc", + prefix_dir + "lib/properties.cc", + prefix_dir + "lib/symbol-table-ops.cc", + ], + hdrs = PUBLIC_HEADERS, + copts = ["-Wno-sign-compare"], + includes = [prefix_dir + "include"], + linkopts = ["-lm"], + deps = [ + ":base", + ":fst-decl", + ":icu", + ":interval-set", + ":register", + ":symbol-table", + ":union-find", + ":util", + ":weight", + ], +) + +cc_library( + name = "fst", + hdrs = PUBLIC_HEADERS, + includes = [prefix_dir + "include"], + deps = [ + ":fst-types", + ":lib_lite", + ], +) + +cc_library( + name = "lib_export_dynamic", + linkopts = ["-Wl,--export-dynamic"], + deps = [":fst"], +) + +cc_library( + name = "fst-types", + srcs = [prefix_dir + "lib/fst-types.cc"], + deps = [":lib_lite"], + alwayslink = 1, # because of registration +) + +cc_library( + name = "symbol-table", + srcs = [prefix_dir + "lib/symbol-table.cc"], + hdrs = [prefix_dir + "include/fst/symbol-table.h"], + copts = ["-Wno-sign-compare"], + includes = [prefix_dir + "include"], + deps = [ + ":base", + ":util", + ], +) + +cc_library( + name = "weight", + srcs = [prefix_dir + "lib/weight.cc"], + hdrs = [ + prefix_dir + "include/fst/expectation-weight.h", + prefix_dir + "include/fst/float-weight.h", + prefix_dir + "include/fst/lexicographic-weight.h", + prefix_dir + "include/fst/pair-weight.h", + prefix_dir + "include/fst/power-weight.h", + prefix_dir + "include/fst/product-weight.h", + prefix_dir + "include/fst/set-weight.h", + prefix_dir + "include/fst/signed-log-weight.h", + prefix_dir + "include/fst/sparse-power-weight.h", + prefix_dir + "include/fst/sparse-tuple-weight.h", + prefix_dir + "include/fst/string-weight.h", + prefix_dir + "include/fst/tuple-weight.h", + prefix_dir + "include/fst/union-weight.h", + prefix_dir + "include/fst/weight.h", + ], + includes = [prefix_dir + "include"], + linkopts = ["-lm"], + deps = [ + ":base", + ":util", + ], +) + +cc_library( + name = "interval-set", + hdrs = [prefix_dir + "include/fst/interval-set.h"], + includes = [prefix_dir + "include"], + deps = [ + ":base", + ":util", + ], +) + +cc_library( + name = "register", + hdrs = [ + prefix_dir + "include/fst/generic-register.h", + prefix_dir + "include/fst/register.h", + ], + includes = [prefix_dir + "include"], + linkopts = ["-ldl"], + deps = [ + ":base", + ":util", + ], +) + +cc_library( + name = "icu", + hdrs = [ + prefix_dir + "include/fst/icu.h", + ], +) + +cc_library( + name = "union-find", + hdrs = [prefix_dir + "include/fst/union-find.h"], + includes = [prefix_dir + "include"], + deps = [":base"], +) + +cc_library( + name = "util", + srcs = [ + prefix_dir + "lib/mapped-file.cc", + prefix_dir + "lib/util.cc", + ], + hdrs = [ + prefix_dir + "include/fst/mapped-file.h", + prefix_dir + "include/fst/util.h", + ], + includes = [prefix_dir + "include"], + deps = [":base"], +) + +cc_library( + name = "base", + srcs = [ + prefix_dir + "lib/compat.cc", + prefix_dir + "lib/flags.cc", + ], + hdrs = [ + prefix_dir + "include/fst/compat.h", + prefix_dir + "include/fst/config.h", + prefix_dir + "include/fst/flags.h", + prefix_dir + "include/fst/icu.h", + prefix_dir + "include/fst/lock.h", + prefix_dir + "include/fst/log.h", + prefix_dir + "include/fst/types.h", + ], + includes = [prefix_dir + "include"], +) + +# Core library tests (test/) + +cc_test( + name = "fst_test", + timeout = "short", + srcs = [ + prefix_dir + "test/fst_test.cc", + prefix_dir + "include/fst/test/fst_test.h", + ], + deps = [":fst"], +) + +cc_library( + name = "weight-tester", + testonly = 1, + hdrs = [prefix_dir + "include/fst/test/weight-tester.h"], + includes = [prefix_dir], + deps = [":weight"], +) + +cc_test( + name = "weight_test", + timeout = "short", + srcs = [prefix_dir + "test/weight_test.cc"], + copts = ["-Wno-unused-local-typedefs"], + deps = [ + ":fst", + ":weight-tester", + ], +) + +[ + cc_test( + name = "algo_test_%s" % weight, + srcs = [ + prefix_dir + "test/algo_test.cc", + prefix_dir + "include/fst/test/algo_test.h", + prefix_dir + "include/fst/test/rand-fst.h", + ], + defines = ["TEST_%s" % weight.upper()], + deps = [":fst"], + ) + for weight in [ + "tropical", + "log", + "minmax", + "lexicographic", + "power", + ] +] + +# Non-template scripting-language integration (script/) + +cc_library( + name = "fstscript_base", + srcs = [ + prefix_dir + "script/arciterator-class.cc", + prefix_dir + "script/encodemapper-class.cc", + prefix_dir + "script/fst-class.cc", + prefix_dir + "script/getters.cc", + prefix_dir + "script/stateiterator-class.cc", + prefix_dir + "script/text-io.cc", + prefix_dir + "script/weight-class.cc", + ], + hdrs = [ + prefix_dir + "include/fst/script/arc-class.h", + prefix_dir + "include/fst/script/arciterator-class.h", + prefix_dir + "include/fst/script/arg-packs.h", + prefix_dir + "include/fst/script/encodemapper-class.h", + prefix_dir + "include/fst/script/fst-class.h", + prefix_dir + "include/fst/script/fstscript-decl.h", + prefix_dir + "include/fst/script/fstscript.h", + prefix_dir + "include/fst/script/getters.h", + prefix_dir + "include/fst/script/register.h", + prefix_dir + "include/fst/script/script-impl.h", + prefix_dir + "include/fst/script/stateiterator-class.h", + prefix_dir + "include/fst/script/text-io.h", + prefix_dir + "include/fst/script/weight-class.h", + # + prefix_dir + "include/fst/script/arcsort.h", + prefix_dir + "include/fst/script/closure.h", + prefix_dir + "include/fst/script/compile.h", + prefix_dir + "include/fst/script/compile-impl.h", + prefix_dir + "include/fst/script/compose.h", + prefix_dir + "include/fst/script/concat.h", + prefix_dir + "include/fst/script/connect.h", + prefix_dir + "include/fst/script/convert.h", + prefix_dir + "include/fst/script/decode.h", + prefix_dir + "include/fst/script/determinize.h", + prefix_dir + "include/fst/script/difference.h", + prefix_dir + "include/fst/script/disambiguate.h", + prefix_dir + "include/fst/script/draw.h", + prefix_dir + "include/fst/script/draw-impl.h", + prefix_dir + "include/fst/script/encode.h", + prefix_dir + "include/fst/script/epsnormalize.h", + prefix_dir + "include/fst/script/equal.h", + prefix_dir + "include/fst/script/equivalent.h", + prefix_dir + "include/fst/script/info.h", + prefix_dir + "include/fst/script/info-impl.h", + prefix_dir + "include/fst/script/intersect.h", + prefix_dir + "include/fst/script/invert.h", + prefix_dir + "include/fst/script/isomorphic.h", + prefix_dir + "include/fst/script/map.h", + prefix_dir + "include/fst/script/minimize.h", + prefix_dir + "include/fst/script/print.h", + prefix_dir + "include/fst/script/print-impl.h", + prefix_dir + "include/fst/script/project.h", + prefix_dir + "include/fst/script/prune.h", + prefix_dir + "include/fst/script/push.h", + prefix_dir + "include/fst/script/randequivalent.h", + prefix_dir + "include/fst/script/randgen.h", + prefix_dir + "include/fst/script/relabel.h", + prefix_dir + "include/fst/script/replace.h", + prefix_dir + "include/fst/script/reverse.h", + prefix_dir + "include/fst/script/reweight.h", + prefix_dir + "include/fst/script/rmepsilon.h", + prefix_dir + "include/fst/script/shortest-distance.h", + prefix_dir + "include/fst/script/shortest-path.h", + prefix_dir + "include/fst/script/synchronize.h", + prefix_dir + "include/fst/script/topsort.h", + prefix_dir + "include/fst/script/union.h", + prefix_dir + "include/fst/script/verify.h", + ], + copts = ["-Wno-sign-compare"], + includes = [prefix_dir + "include"], + deps = [":fst"], +) + +[ + cc_library( + name = "fstscript_%s" % operation, + srcs = [prefix_dir + "script/%s.cc" % operation], + hdrs = [prefix_dir + "include/fst/script/%s.h" % operation], + includes = [prefix_dir + "include"], + deps = [":fstscript_base"], + ) + for operation in [ + "arcsort", + "closure", + "concat", + "connect", + "convert", + "decode", + "determinize", + "disambiguate", + "encode", + "epsnormalize", + "equal", + "equivalent", + "invert", + "isomorphic", + "map", + "minimize", + "project", + "prune", + "push", + "randgen", + "relabel", + "replace", + "reverse", + "reweight", + "synchronize", + "topsort", + "union", + "verify", + ] +] + +cc_library( + name = "fstscript_compile", + srcs = [prefix_dir + "script/compile.cc"], + hdrs = [ + prefix_dir + "include/fst/script/compile.h", + prefix_dir + "include/fst/script/compile-impl.h", + ], + includes = [prefix_dir + "include"], + deps = [":fstscript_base"], +) + +cc_library( + name = "fstscript_compose", + srcs = [prefix_dir + "script/compose.cc"], + hdrs = [prefix_dir + "include/fst/script/compose.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fstscript_base", + ":fstscript_connect", + ], +) + +cc_library( + name = "fstscript_difference", + srcs = [prefix_dir + "script/difference.cc"], + hdrs = [prefix_dir + "include/fst/script/difference.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fstscript_base", + ":fstscript_compose", + ], +) + +cc_library( + name = "fstscript_draw", + srcs = [prefix_dir + "script/draw.cc"], + hdrs = [ + prefix_dir + "include/fst/script/draw.h", + prefix_dir + "include/fst/script/draw-impl.h", + ], + includes = [prefix_dir + "include"], + deps = [":fstscript_base"], +) + +cc_library( + name = "fstscript_info", + srcs = [ + prefix_dir + "script/info.cc", + prefix_dir + "script/info-impl.cc", + ], + hdrs = [ + prefix_dir + "include/fst/script/info.h", + prefix_dir + "include/fst/script/info-impl.h", + ], + includes = [prefix_dir + "include"], + deps = [":fstscript_base"], +) + +cc_library( + name = "fstscript_intersect", + srcs = [prefix_dir + "script/intersect.cc"], + hdrs = [prefix_dir + "include/fst/script/intersect.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fstscript_base", + ":fstscript_compose", + ], +) + +cc_library( + name = "fstscript_print", + srcs = [prefix_dir + "script/print.cc"], + hdrs = [ + prefix_dir + "include/fst/script/print.h", + prefix_dir + "include/fst/script/print-impl.h", + ], + includes = [prefix_dir + "include"], + deps = [":fstscript_base"], +) + +cc_library( + name = "fstscript_randequivalent", + srcs = [prefix_dir + "script/randequivalent.cc"], + hdrs = [prefix_dir + "include/fst/script/randequivalent.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fstscript_base", + ":fstscript_randgen", + ], +) + +cc_library( + name = "fstscript_rmepsilon", + srcs = [prefix_dir + "script/rmepsilon.cc"], + hdrs = [prefix_dir + "include/fst/script/rmepsilon.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fstscript_base", + ":fstscript_shortest_distance", + ], +) + +cc_library( + name = "fstscript_shortest_distance", + srcs = [prefix_dir + "script/shortest-distance.cc"], + hdrs = [prefix_dir + "include/fst/script/shortest-distance.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fstscript_base", + ":fstscript_prune", + ], +) + +cc_library( + name = "fstscript_shortest_path", + srcs = [prefix_dir + "script/shortest-path.cc"], + hdrs = [prefix_dir + "include/fst/script/shortest-path.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fstscript_base", + ":fstscript_shortest_distance", + ], +) + +cc_library( + name = "fstscript", + deps = [ + ":fstscript_arcsort", + ":fstscript_closure", + ":fstscript_compile", + ":fstscript_compose", + ":fstscript_concat", + ":fstscript_connect", + ":fstscript_convert", + ":fstscript_decode", + ":fstscript_determinize", + ":fstscript_difference", + ":fstscript_disambiguate", + ":fstscript_draw", + ":fstscript_encode", + ":fstscript_epsnormalize", + ":fstscript_equal", + ":fstscript_equivalent", + ":fstscript_info", + ":fstscript_intersect", + ":fstscript_invert", + ":fstscript_isomorphic", + ":fstscript_map", + ":fstscript_minimize", + ":fstscript_print", + ":fstscript_project", + ":fstscript_prune", + ":fstscript_push", + ":fstscript_randequivalent", + ":fstscript_randgen", + ":fstscript_relabel", + ":fstscript_replace", + ":fstscript_reverse", + ":fstscript_reweight", + ":fstscript_rmepsilon", + ":fstscript_shortest_distance", + ":fstscript_shortest_path", + ":fstscript_synchronize", + ":fstscript_topsort", + ":fstscript_union", + ":fstscript_verify", + ], +) + +# Command-line binaries (bin/) + +[ + cc_binary( + name = "fst%s" % operation.replace("_", ""), + srcs = [ + prefix_dir + "bin/fst%s.cc" % operation.replace("_", ""), + prefix_dir + "bin/fst%s-main.cc" % operation.replace("_", ""), + ], + linkstatic = static_binary, + deps = [":fstscript_%s" % operation], + ) + for operation in [ + "arcsort", + "closure", + "compile", + "compose", + "concat", + "connect", + "convert", + "determinize", + "difference", + "disambiguate", + "draw", + "epsnormalize", + "equal", + "info", + "intersect", + "invert", + "isomorphic", + "map", + "minimize", + "print", + "project", + "prune", + "push", + "randgen", + "relabel", + "replace", + "reverse", + "reweight", + "rmepsilon", + "shortest_distance", + "shortest_path", + "synchronize", + "topsort", + "union", + ] +] + +cc_binary( + name = "fstencode", + srcs = [ + prefix_dir + "bin/fstencode.cc", + prefix_dir + "bin/fstencode-main.cc", + ], + linkstatic = static_binary, + deps = [ + ":fstscript_decode", + ":fstscript_encode", + ], +) + +cc_binary( + name = "fstequivalent", + srcs = [ + prefix_dir + "bin/fstequivalent.cc", + prefix_dir + "bin/fstequivalent-main.cc", + ], + linkstatic = static_binary, + deps = [ + ":fstscript_equivalent", + ":fstscript_randequivalent", + ], +) + +cc_binary( + name = "fstsymbols", + srcs = [ + prefix_dir + "bin/fstsymbols.cc", + prefix_dir + "bin/fstsymbols-main.cc", + ], + linkstatic = static_binary, + deps = [":fstscript_verify"], +) + +# Extension: Fst ARchive a/k/a FAR (extensions/far/) + +cc_library( + name = "sttable", + srcs = [ + prefix_dir + "extensions/far/stlist.cc", + prefix_dir + "extensions/far/sttable.cc", + ], + hdrs = [ + prefix_dir + "include/fst/extensions/far/stlist.h", + prefix_dir + "include/fst/extensions/far/sttable.h", + ], + includes = [prefix_dir + "include"], + deps = [":util"], +) + +cc_library( + name = "far_base", + hdrs = [ + prefix_dir + "include/fst/extensions/far/far.h", + ], + includes = [prefix_dir + "include"], + deps = [ + ":fst", + ":sttable", + ], +) + +cc_library( + name = "far", + srcs = [prefix_dir + "extensions/far/strings.cc"], + hdrs = [ + prefix_dir + "include/fst/extensions/far/compile-strings.h", + prefix_dir + "include/fst/extensions/far/create.h", + prefix_dir + "include/fst/extensions/far/equal.h", + prefix_dir + "include/fst/extensions/far/extract.h", + prefix_dir + "include/fst/extensions/far/farlib.h", + prefix_dir + "include/fst/extensions/far/info.h", + prefix_dir + "include/fst/extensions/far/isomorphic.h", + prefix_dir + "include/fst/extensions/far/print-strings.h", + ], + includes = [prefix_dir + "include"], + deps = [ + ":far_base", + ":fst", + ], +) + +cc_library( + name = "farscript", + srcs = [ + prefix_dir + "extensions/far/far-class.cc", + prefix_dir + "extensions/far/farscript.cc", + prefix_dir + "extensions/far/getters.cc", + prefix_dir + "extensions/far/script-impl.cc", + prefix_dir + "extensions/far/strings.cc", + ], + hdrs = [ + prefix_dir + "include/fst/extensions/far/compile-strings.h", + prefix_dir + "include/fst/extensions/far/far-class.h", + prefix_dir + "include/fst/extensions/far/farscript.h", + prefix_dir + "include/fst/extensions/far/getters.h", + prefix_dir + "include/fst/extensions/far/script-impl.h", + ], + includes = [prefix_dir + "include"], + deps = [ + ":base", + ":far", + ":fstscript_base", + ], +) + +[ + cc_binary( + name = "far%s" % operation, + srcs = [prefix_dir + "extensions/far/far%s.cc" % operation], + linkstatic = static_binary, + deps = [":farscript"], + ) + for operation in [ + "compilestrings", + "create", + "equal", + "extract", + "info", + "isomorphic", + "printstrings", + ] +] + +# Extension: PushDown Transducers a/k/a PDT (extensions/pdt/) + +cc_library( + name = "pdt", + hdrs = [ + prefix_dir + "include/fst/extensions/pdt/collection.h", + prefix_dir + "include/fst/extensions/pdt/compose.h", + prefix_dir + "include/fst/extensions/pdt/expand.h", + prefix_dir + "include/fst/extensions/pdt/getters.h", + prefix_dir + "include/fst/extensions/pdt/info.h", + prefix_dir + "include/fst/extensions/pdt/paren.h", + prefix_dir + "include/fst/extensions/pdt/pdt.h", + prefix_dir + "include/fst/extensions/pdt/pdtlib.h", + prefix_dir + "include/fst/extensions/pdt/replace.h", + prefix_dir + "include/fst/extensions/pdt/reverse.h", + prefix_dir + "include/fst/extensions/pdt/shortest-path.h", + ], + includes = [prefix_dir + "include"], + deps = [ + ":fst", + ], +) + +cc_library( + name = "pdtscript", + srcs = [ + prefix_dir + "extensions/pdt/getters.cc", + prefix_dir + "extensions/pdt/pdtscript.cc", + ], + hdrs = [ + prefix_dir + "include/fst/extensions/pdt/getters.h", + prefix_dir + "include/fst/extensions/pdt/pdtscript.h", + ], + includes = [prefix_dir + "include"], + deps = [ + ":fst", + ":fstscript_base", + ":pdt", + ], +) + +cc_binary( + name = "pdtcompose", + srcs = [prefix_dir + "extensions/pdt/pdtcompose.cc"], + linkstatic = static_binary, + deps = [ + ":fstscript_connect", + ":pdtscript", + ], +) + +[ + cc_binary( + name = "pdt%s" % operation, + srcs = [prefix_dir + "extensions/pdt/pdt%s.cc" % operation], + linkstatic = static_binary, + deps = [":pdtscript"], + ) + for operation in [ + "expand", + "info", + "replace", + "reverse", + "shortestpath", + ] +] + +# Extension: Multi PushDown Transducers a/k/a MPDT (extensions/mpdt/) + +cc_library( + name = "mpdt", + hdrs = [ + prefix_dir + "include/fst/extensions/mpdt/compose.h", + prefix_dir + "include/fst/extensions/mpdt/expand.h", + prefix_dir + "include/fst/extensions/mpdt/info.h", + prefix_dir + "include/fst/extensions/mpdt/mpdt.h", + prefix_dir + "include/fst/extensions/mpdt/mpdtlib.h", + prefix_dir + "include/fst/extensions/mpdt/read_write_utils.h", + prefix_dir + "include/fst/extensions/mpdt/reverse.h", + ], + includes = [prefix_dir + "include"], + deps = [ + ":fst", + ":pdt", + ], +) + +cc_library( + name = "mpdtscript", + srcs = [prefix_dir + "extensions/mpdt/mpdtscript.cc"], + hdrs = [prefix_dir + "include/fst/extensions/mpdt/mpdtscript.h"], + includes = [prefix_dir + "include"], + deps = [ + ":fst", + ":fstscript_base", + ":mpdt", + ":pdtscript", + ], +) + +cc_binary( + name = "mpdtcompose", + srcs = [prefix_dir + "extensions/mpdt/mpdtcompose.cc"], + linkstatic = static_binary, + deps = [ + ":fstscript_connect", + ":mpdtscript", + ], +) + +[ + cc_binary( + name = "mpdt%s" % operation, + srcs = [prefix_dir + "extensions/mpdt/mpdt%s.cc" % operation], + linkstatic = static_binary, + deps = [":mpdtscript"], + ) + for operation in [ + "expand", + "info", + "reverse", + ] +] + +# Extension: LOUDS compressed n-gram language models (extensions/ngram/) + +cc_library( + name = "ngram", + srcs = [ + prefix_dir + "extensions/ngram/bitmap-index.cc", + prefix_dir + "extensions/ngram/ngram-fst.cc", + prefix_dir + "extensions/ngram/nthbit.cc", + ], + hdrs = [ + prefix_dir + "include/fst/extensions/ngram/bitmap-index.h", + prefix_dir + "include/fst/extensions/ngram/ngram-fst.h", + prefix_dir + "include/fst/extensions/ngram/nthbit.h", + ], + includes = [prefix_dir + "include"], + deps = [ + ":fst", + ], +) + +# TODO: Extensions compact, compress, const, linear, lookahead, python, special diff --git a/runtime/onnxruntime/third_party/openfst/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/CMakeLists.txt new file mode 100644 index 0000000..eda6a96 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/CMakeLists.txt @@ -0,0 +1,71 @@ +project(openfst) +include(CTest) +find_package(ICU COMPONENTS data i18n io test tu uc) +if (ICU_FOUND) + include_directories(${ICU_INCLUDE_DIRS}) + set(LIBS ${LIBS} ${ICU_LIBRARIES}) +endif (ICU_FOUND) + +find_package(ZLIB) +if (ZLIB_FOUND) + include_directories(${ZLIB_INCLUDE_DIRECTORIES}) + set(ZLIBS ${ZLIB_LIBRARIES}) +endif (ZLIB_FOUND) + +cmake_minimum_required(VERSION 3.1) +set(CMAKE_MACOSX_RPATH 1) +set(CMAKE_CXX_STANDARD 11) + +if (WIN32) + add_definitions(/bigobj) + set(WHOLEFST "/WHOLEARCHIVE:fst") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WHOLEFST}") + #set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1) + #this must be disabled unless the previous option (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS) is enabled + option(BUILD_SHARED_LIBS "Build shared libraries" OFF) +else() + option(BUILD_SHARED_LIBS "Build shared libraries" ON) +endif (WIN32) + +set(SOVERSION "16") +OPTION(BUILD_USE_SOLUTION_FOLDERS "Enable grouping of projects in VS" ON) +SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ${BUILD_USE_SOLUTION_FOLDERS}) + + +option(HAVE_BIN "Build the fst binaries" ON) +option(HAVE_SCRIPT "Build the fstscript" ON) +option(HAVE_COMPACT "Build compact" ON) +option(HAVE_COMPRESS "Build compress" OFF) +option(HAVE_CONST "Build const" ON) +option(HAVE_FAR "Build far" ON) +option(HAVE_GRM "Build grm" ON) +option(HAVE_PDT "Build pdt" ON) +option(HAVE_MPDT "Build mpdt" ON) +option(HAVE_LINEAR "Build linear" ON) +option(HAVE_LOOKAHEAD "Build lookahead" ON) +option(HAVE_NGRAM "Build ngram" ON) +option(HAVE_PYTHON "Build python" OFF) +option(HAVE_SPECIAL "Build special" ON) + + set(WITH_GFLAGS OFF CACHE BOOL "whether build glog with gflags" FORCE) + if (WIN32) + set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE) + set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE) + else() + set(HAVE_BIN ON CACHE BOOL "Build the fst binaries" FORCE) + set(HAVE_SCRIPT ON CACHE BOOL "Build the fstscript" FORCE) + endif (WIN32) + + set(HAVE_COMPACT OFF CACHE BOOL "Build compact" FORCE) + set(HAVE_CONST OFF CACHE BOOL "Build const" FORCE) + set(HAVE_GRM OFF CACHE BOOL "Build grm" FORCE) + set(HAVE_FAR OFF CACHE BOOL "Build far" FORCE) + set(HAVE_PDT OFF CACHE BOOL "Build pdt" FORCE) + set(HAVE_MPDT OFF CACHE BOOL "Build mpdt" FORCE) + set(HAVE_LINEAR OFF CACHE BOOL "Build linear" FORCE) + set(HAVE_LOOKAHEAD OFF CACHE BOOL "Build lookahead" FORCE) + set(HAVE_NGRAM OFF CACHE BOOL "Build ngram" FORCE) + set(HAVE_SPECIAL OFF CACHE BOOL "Build special" FORCE) + +add_subdirectory(src) + diff --git a/runtime/onnxruntime/third_party/openfst/Makefile.am b/runtime/onnxruntime/third_party/openfst/Makefile.am new file mode 100644 index 0000000..809d5c1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = src +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = BUILD.bazel diff --git a/runtime/onnxruntime/third_party/openfst/Makefile.in b/runtime/onnxruntime/third_party/openfst/Makefile.in new file mode 100644 index 0000000..0d29489 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/Makefile.in @@ -0,0 +1,842 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/src/include/fst/config.h.in AUTHORS COPYING \ + INSTALL NEWS README ar-lib compile config.guess config.sub \ + install-sh ltmain.sh missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src +ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = BUILD.bazel +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +src/include/fst/config.h: src/include/fst/stamp-h2 + @test -f $@ || rm -f src/include/fst/stamp-h2 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) src/include/fst/stamp-h2 + +src/include/fst/stamp-h2: $(top_srcdir)/src/include/fst/config.h.in $(top_builddir)/config.status + @rm -f src/include/fst/stamp-h2 + cd $(top_builddir) && $(SHELL) ./config.status src/include/fst/config.h + +distclean-hdr: + -rm -f config.h stamp-h1 src/include/fst/config.h src/include/fst/stamp-h2 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/README.md b/runtime/onnxruntime/third_party/openfst/README.md new file mode 100644 index 0000000..05a3d08 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/README.md @@ -0,0 +1,113 @@ +# OpenFST port for Windows + +OpenFst is a library for constructing, combining, optimizing, and searching +weighted finite-state transducers (FSTs), maintained by Google and released +under the [Apache 2.0 license](./COPYING). The home page for the library is +located at http://openfst.org/. Check the [original README file](./README) +for the current version, as we are not updating this file with the current +release version. Make sure also to check the [NEWS](./NEWS) file for the +latest changes. + +## Releases + +We track [original releases](http://www.openfst.org/twiki/bin/view/FST/FstDownload) +of the library, and try to keep [ours](https://github.com/kkm000/openfst/releases) +in step. Sometimes we may skip a release, but we strive for that to be rather an +exception. With each release, we drop a set of pre-built .exe files compiled for +the x64 architecture and optimized for execution speed. We use the latest +Microsoft compilers for it, so you may find you need to download and install the +latest Microsoft C runtime. See [Microsoft KB2977003](https://support.microsoft.com/help/2977003/) +for instructions. + +We do not release pre-built libraries, however, because Microsoft compiler ABI +changes between versions, and is different for Debug and Release builds. You +must build a library matching your toolset on your own. + +## Build + +There are two build options: Visual Studio and CMake. We maintain a set of +build scripts for both. You will need a recent enough Visual Studio for either +build flavor. Microsoft provides an option to download the free Visual Studio +[Community Edition](https://visualstudio.microsoft.com/downloads/), which is +adequate. + +### Visual Studio + +Open `openfst.sln`, then read the comments in files under the "READ ME BEFORE +BUILD" solution folder. Generally, you may just hit Build and get the +libraries, unless you need fine-tuning, such as selecting a different toolset, +or want to build with MSBuild from command line. The solutions builds only +static libraries, with debug information embedded in C7 format for the +simplicity of use. Set the platform to `x86` or `x64` to build a respective +32- or 64-bit version of the library and tools. + +The `bin` project builds multiple executable files by invoking itself +recursively once for each executable. All .vcxproj files have been scripted and +are maintained by hand. It takes a long time to build in Release mode. If you +only need the libfst library, build it alone from the Project Explorer. + +All build outputs are placed into the `build_output` directory under the +solution root. + +### CMake + +Follow the normal CMake build procedure to generate build files. With CMake you +have an option of building dynamic libraries shared by the executables. + +## Limitations + +* Memory-mapped files are not supported (we may add the support in the future + though), because it is very system-dependent. OpenFST supports reading e. g. + CompactFST files into allocated memoty when memory mapping is not compiled in. +* Dynamic registration of arc and FST types is not supported in the Visual Studio + project versions (as they build only static libraries). CMake build does not + have this limitation. Due to ABI being specific to Microsoft compiler version, + dynamically registered types must be compiled with strictly the same compiler + of the same major version, and mostly same build flags. This is quite hard to + get right, and is not recommended. + +## Structure of the repository and tagging + +The `original` branch contains only imported original OpenFST files, with one +exception of .gitignore file added. Tags of the form `orig/1.6.9.1` specify the +version and revision number of the library. Every commit on the `orignal` branch +contains the source URL for the tarball release of OpenFST that was committed. +The last version point corresponds to the revision of OpenFST version. Most (but +not all) of the versions has had only one revision, and therefore end in `.1`. +The `winport` branch contains the port, with corresponding tags of the form +`win/1.6.9.1`. + +You can review the changes to source code only with the git command e. g. + +`git diff orig/1.6.9.1..win/1.6.9.1 -- "*.cc" "*.h"` + +The GitHub interface does not provide filtering by extension, so you will see +all CMakefiles and MSBuild files added, but it may be useful if you want to +examine changes in a particular file. + +We try to keep changes to an absolute minimum. Most of them are due to +incompatibilities between the gcc and cl compilers, and only a minor portion +is due to the differences between the Linux and Windows platforms. + +## Maintainers + +The repository is maintained by [@kkm000](https://github.com/kkm000) and +[@jtrmal](https://github.com/jtrmal). + +Open an issue to let us know if you discover a problem with the port. We react +to them promptly. Be sure to include a problem description, error text id any, +and the compiler or Visual Studio version (and CMake version, if you use it). +Do not hesitate to ask questions. We will try to help you. + +Since we do not (by the definition of port) extend the OpenFST library itself, +please contact its authors with questions and suggestions related to the +original library. If in doubt, contact both teams. + +Also let us know if you have a related development that you believe should be +linked to from this file. + +--- + +_Copyright (c) 2008-current Google Inc._ +_Copyright (c) 2016-current SmartAction LLC (kkm)_ +_Copyright (c) 2016-current Johns Hopkins University (J. Trmal)_ diff --git a/runtime/onnxruntime/third_party/openfst/_import_release.sh b/runtime/onnxruntime/third_party/openfst/_import_release.sh new file mode 100644 index 0000000..8d13774 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/_import_release.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# This is a port port maintainer's file, and is not part of OpenFST. +# Licensed under the same Apache 2.0 license (see the file COPYING), +# or just delete it if in legal doubt; you do not need it anyway. +# Copyright 2019 SmartAction LLC. + +set -euo pipefail; shopt -s extglob + +LF=$'\n' + +say() { echo >&2 "$0: $@"; } +die() { echo >&2 "$0: error: $@"; exit 1; } + +# This is Spar^H^H Windooows! +miss=(); for tool in gawk git grep gzip tar wget; do + command -v $tool >/dev/null || miss+=($tool) +done +test ${#miss[@]} -eq 0 || die "missing required program(s): ${miss[@]}" +unset miss + +[[ "$#" == [12] ]] || { + echo >&2 -e "Usage: $0 [=1]${LF} e.g.: $0 1.7.0 1" + exit 2; } + +ver=$1 +rev=${2:-1} +tag="orig/$ver.$rev" +url="http://www.openfst.org/twiki/bin/viewfile/FST/FstDownload?filename=openfst-${ver}.tar.gz;rev=${rev}" + +grep -qP '^1(\.1?\d){3}$' <<<"$ver.$rev" || + die "revision $ver.$rev does not look correct to me" + +pfx="$(git rev-parse --show-prefix)" && test -z "$pfx" || + die "must be in the root of the work tree" + +# Must be on the 'original' branch, in sync with the main repo, +# and with no local changes, although we can ignore deletions, +# since we are deleting files before import anyway. We must be +# squeaky clean, lest stray random files be added. Also, ignore +# changes to this file to allow for debugging. +git fetch origin +git status --porcelain=2 --branch | gawk -v me=$0 >&2 ' + $0 == "# branch.head original" { branch_ok = 1 } + $1$2 == "#branch.ab" { ab_bad = $4 != "-0" } + $1 == "#" { next } + $1$2 == "1.D" { next } # Deleted files are fine. + $1$9 == "1_import_release.sh" { next } + { modf_bad=1; nextfile } + END { + me = me ": error: " + if (!branch_ok) print me "current branch must be \"original\"" + if (ab_bad) print me "current branch is not in sync with remote" + if (modf_bad) print me "there are locally modified files" + exit !(branch_ok && !ab_bad && !modf_bad) }' + +git rev-parse -q --verify "refs/tags/$tag" >/dev/null && + die "tag $tag already exists" + +say "Removing (almost) all files from worktree" +rm -rf -- !(.|..|.git|.gitignore|_import_release.sh) + +say "Fetching and unpacking OpenFST v$ver r$rev${LF} ... from: $url" +wget -nv -O - -- "$url" | tar -xzf - --strip-components=1 + +test -f NEWS || + die "file NEWS was not unpacked. Something went horribly wrong." + +message="Import v$ver r$rev${LF}${LF}$url" + +say "committing and tagging new version" +git add -A +git commit -m "$message" +git tag -a "$tag" -m "$message" + +say "summary of changes to the previous version, and a NEWS snippet" + +git --no-pager show --stat +echo +git --no-pager show --format='' --unified=1 -w -- NEWS +echo + +say "tag ${tag} created for the imported version. Import complete." diff --git a/runtime/onnxruntime/third_party/openfst/_package_release.cmd b/runtime/onnxruntime/third_party/openfst/_package_release.cmd new file mode 100644 index 0000000..7a89bec --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/_package_release.cmd @@ -0,0 +1,50 @@ +@echo off +setlocal enableextensions + +:: Locate winrar.exe +set winrar="%ProgramFiles%\winrar\winrar.exe" +if not exist %winrar% set winrar="%ProgramFiles(x86)%\winrar\winrar.exe" +if not exist %winrar% ( + echo ERROR: Cannot find winrar.exe 1>&2 + exit /b 1 +) + +:: Get head tag and make sure it is sane. +for /f %%i in ('git describe --long --dirty') do set longtag=%%i +set insane=0 +if not %longtag:-dirty=%.==%longtag%. set insane=1 +if %longtag:-0-g=%.==%longtag%. set insane=1 +if %longtag:win/=%.==%longtag%. set insane=1 +if %insane%==1 ( + echo ERROR: Best HEAD description '%longtag%' is not at a clean tag on winport branch 1>&2 + exit /b 1 +) + +:: Get short description now, strip "win/" for version only +for /f %%i in ('git describe') do set tag=%%i +set tag=%tag:win/=% + +:: Create archive with a comment +set cmtfile=%TEMP%\openfst-package-comment.txt +del /q %cmtfile% 2>nul +echo OpenFST binaries for Windows x64, optimized build. >>%cmtfile% +echo Copyright 2005-2019 Google, Inc. (Original source). >>%cmtfile% +echo Copyright 2016-2019 SmartAction LLC (Windows port). >>%cmtfile% +echo Copyright 2016-2019 Johns Hopkins Uni (Windows port). >>%cmtfile% +echo.>>%cmtfile% +echo OpenFST home page: http://www.openfst.org/ >>%cmtfile% +echo Git Repository: https://github.com/kkm000/openfst/ >>%cmtfile% +echo Build tag: %longtag% >>%cmtfile% + +set zipfile=openfst-bin-win-x64-%tag%.zip +del /q %zipfile% 2>nul +%winrar% a -ep -m5 -z%cmtfile% %zipfile% NEWS COPYING build_output\x64\Release\bin\*.exe +if errorlevel 1 ( + echo "ERROR: Cannot create archive '%zipfile%' 1>&2 + del /q %cmtfile% 2>nul + exit /b 1 +) + +echo SUCCESS: Created archive '%zipfile%' 1>&2 +del /q %cmtfile% 2>nul +exit /b 0 diff --git a/runtime/onnxruntime/third_party/openfst/aclocal.m4 b/runtime/onnxruntime/third_party/openfst/aclocal.m4 new file mode 100644 index 0000000..7e761fb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/aclocal.m4 @@ -0,0 +1,1454 @@ +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# Copyright (C) 2002-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.15' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.15.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.15.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# Copyright (C) 2011-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_AR([ACT-IF-FAIL]) +# ------------------------- +# Try to determine the archiver interface, and trigger the ar-lib wrapper +# if it is needed. If the detection of archiver interface fails, run +# ACT-IF-FAIL (default is to abort configure with a proper error message). +AC_DEFUN([AM_PROG_AR], +[AC_BEFORE([$0], [LT_INIT])dnl +AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([ar-lib])dnl +AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) +: ${AR=ar} + +AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], + [AC_LANG_PUSH([C]) + am_cv_ar_interface=ar + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], + [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + ]) + AC_LANG_POP([C])]) + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + m4_default([$1], + [AC_MSG_ERROR([could not determine $AR interface])]) + ;; +esac +AC_SUBST([AR])dnl +]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each '.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------------- +# Adds support for distributing Python modules and packages. To +# install modules, copy them to $(pythondir), using the python_PYTHON +# automake variable. To install a package with the same name as the +# automake package, install to $(pkgpythondir), or use the +# pkgpython_PYTHON automake variable. +# +# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as +# locations to install python extension modules (shared libraries). +# Another macro is required to find the appropriate flags to compile +# extension modules. +# +# If your package is configured with a different prefix to python, +# users will have to add the install directory to the PYTHONPATH +# environment variable, or create a .pth file (see the python +# documentation for details). +# +# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will +# cause an error if the version of python installed on the system +# doesn't meet the requirement. MINIMUM-VERSION should consist of +# numbers and dots only. +AC_DEFUN([AM_PATH_PYTHON], + [ + dnl Find a Python interpreter. Python versions prior to 2.0 are not + dnl supported. (2.0 was released on October 16, 2000). + dnl FIXME: Remove the need to hard-code Python versions here. + m4_define_default([_AM_PYTHON_INTERPRETER_LIST], +[python python2 python3 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 dnl + python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) + + AC_ARG_VAR([PYTHON], [the Python interpreter]) + + m4_if([$1],[],[ + dnl No version check is needed. + # Find any Python interpreter. + if test -z "$PYTHON"; then + AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) + fi + am_display_PYTHON=python + ], [ + dnl A version check is needed. + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + AC_MSG_CHECKING([whether $PYTHON version is >= $1]) + AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python interpreter is too old])]) + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + AC_CACHE_CHECK([for a Python interpreter with version >= $1], + [am_cv_pathless_PYTHON],[ + for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do + test "$am_cv_pathless_PYTHON" = none && break + AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) + done]) + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + ]) + + if test "$PYTHON" = :; then + dnl Run any user-specified action, or abort. + m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) + else + + dnl Query Python for its version number. Getting [:3] seems to be + dnl the best way to do this; it's what "site.py" does in the standard + dnl library. + + AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], + [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) + AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) + + dnl Use the values of $prefix and $exec_prefix for the corresponding + dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made + dnl distinct variables so they can be overridden if need be. However, + dnl general consensus is that you shouldn't need this ability. + + AC_SUBST([PYTHON_PREFIX], ['${prefix}']) + AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) + + dnl At times (like when building shared libraries) you may want + dnl to know which OS platform Python thinks this is. + + AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], + [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) + AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) + + # Just factor out some code duplication. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" + + dnl Set up 4 directories: + + dnl pythondir -- where to install python scripts. This is the + dnl site-packages directory, not the python standard library + dnl directory like in previous automake betas. This behavior + dnl is more consistent with lispdir.m4 for example. + dnl Query distutils for this directory. + AC_CACHE_CHECK([for $am_display_PYTHON script directory], + [am_cv_python_pythondir], + [if test "x$prefix" = xNONE + then + am_py_prefix=$ac_default_prefix + else + am_py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + ]) + AC_SUBST([pythondir], [$am_cv_python_pythondir]) + + dnl pkgpythondir -- $PACKAGE directory under pythondir. Was + dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is + dnl more consistent with the rest of automake. + + AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) + + dnl pyexecdir -- directory for installing python extension modules + dnl (shared libraries) + dnl Query distutils for this directory. + AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], + [am_cv_python_pyexecdir], + [if test "x$exec_prefix" = xNONE + then + am_py_exec_prefix=$am_py_prefix + else + am_py_exec_prefix=$exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + ]) + AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) + + dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) + + AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) + + dnl Run any user-specified action. + $2 + fi + +]) + + +# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalent (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). +AC_DEFUN([AM_PYTHON_CHECK_VERSION], + [prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex)" + AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/ac_python_devel.m4]) +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) diff --git a/runtime/onnxruntime/third_party/openfst/config.guess b/runtime/onnxruntime/third_party/openfst/config.guess new file mode 100644 index 0000000..f50dcdb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/config.guess @@ -0,0 +1,1480 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2018 Free Software Foundation, Inc. + +timestamp='2018-02-24' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2018 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > "$dummy.c" ; + for c in cc gcc c89 c99 ; do + if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "$UNAME_SYSTEM" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval "$set_cc_for_build" + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ + echo unknown)` + case "$UNAME_MACHINE_ARCH" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine="${arch}${endian}"-unknown + ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case "$UNAME_MACHINE_ARCH" in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval "$set_cc_for_build" + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case "$UNAME_MACHINE_ARCH" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "$UNAME_VERSION" in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "$machine-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; + *:ekkoBSD:*:*) + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + exit ;; + *:SolidBSD:*:*) + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:MirBSD:*:*) + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:Sortix:*:*) + echo "$UNAME_MACHINE"-unknown-sortix + exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix"$UNAME_RELEASE" + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux"$UNAME_RELEASE" + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval "$set_cc_for_build" + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos"$UNAME_RELEASE" + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos"$UNAME_RELEASE" + ;; + sun4) + echo sparc-sun-sunos"$UNAME_RELEASE" + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos"$UNAME_RELEASE" + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint"$UNAME_RELEASE" + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint"$UNAME_RELEASE" + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint"$UNAME_RELEASE" + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten"$UNAME_RELEASE" + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten"$UNAME_RELEASE" + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix"$UNAME_RELEASE" + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix"$UNAME_RELEASE" + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix"$UNAME_RELEASE" + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos"$UNAME_RELEASE" + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + then + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ + [ "$TARGET_BINARY_INTERFACE"x = x ] + then + echo m88k-dg-dgux"$UNAME_RELEASE" + else + echo m88k-dg-dguxbcs"$UNAME_RELEASE" + fi + else + echo i586-dg-dgux"$UNAME_RELEASE" + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + case "$UNAME_MACHINE" in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "$sc_cpu_version" in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "$sc_kernel_bits" in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "$HP_ARCH" = "" ]; then + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ "$HP_ARCH" = hppa2.0w ] + then + eval "$set_cc_for_build" + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux"$HPUX_REV" + exit ;; + 3050*:HI-UX:*:*) + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo "$UNAME_MACHINE"-unknown-osf1mk + else + echo "$UNAME_MACHINE"-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:BSD/OS:*:*) + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case "$UNAME_PROCESSOR" in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; + i*:CYGWIN*:*) + echo "$UNAME_MACHINE"-pc-cygwin + exit ;; + *:MINGW64*:*) + echo "$UNAME_MACHINE"-pc-mingw64 + exit ;; + *:MINGW*:*) + echo "$UNAME_MACHINE"-pc-mingw32 + exit ;; + *:MSYS*:*) + echo "$UNAME_MACHINE"-pc-msys + exit ;; + i*:PW*:*) + echo "$UNAME_MACHINE"-pc-pw32 + exit ;; + *:Interix*:*) + case "$UNAME_MACHINE" in + x86) + echo i586-pc-interix"$UNAME_RELEASE" + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix"$UNAME_RELEASE" + exit ;; + IA64) + echo ia64-unknown-interix"$UNAME_RELEASE" + exit ;; + esac ;; + i*:UWIN*:*) + echo "$UNAME_MACHINE"-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + *:GNU:*:*) + # the GNU system + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + exit ;; + i*86:Minix:*:*) + echo "$UNAME_MACHINE"-pc-minix + exit ;; + aarch64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arm*:Linux:*:*) + eval "$set_cc_for_build" + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + else + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + cris:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + crisv32:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + e2k:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + frv:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + hexagon:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:Linux:*:*) + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + ia64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m32r*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m68*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" + test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } + ;; + mips64el:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-"$LIBC" + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-"$LIBC" + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-"$LIBC" + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-"$LIBC" + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-"$LIBC" + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-"$LIBC" + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-"$LIBC" + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + exit ;; + sh64*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sh*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + tile*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + vax:Linux:*:*) + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + exit ;; + x86_64:Linux:*:*) + if objdump -f /bin/sh | grep -q elf32-x86-64; then + echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 + else + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + fi + exit ;; + xtensa*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo "$UNAME_MACHINE"-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo "$UNAME_MACHINE"-unknown-stop + exit ;; + i*86:atheos:*:*) + echo "$UNAME_MACHINE"-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo "$UNAME_MACHINE"-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos"$UNAME_RELEASE" + exit ;; + i*86:*DOS:*:*) + echo "$UNAME_MACHINE"-pc-msdosdjgpp + exit ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos"$UNAME_RELEASE" + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos"$UNAME_RELEASE" + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv"$UNAME_RELEASE" + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo "$UNAME_MACHINE"-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo "$UNAME_MACHINE"-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux"$UNAME_RELEASE" + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv"$UNAME_RELEASE" + else + echo mips-unknown-sysv"$UNAME_RELEASE" + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux"$UNAME_RELEASE" + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux"$UNAME_RELEASE" + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux"$UNAME_RELEASE" + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux"$UNAME_RELEASE" + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Rhapsody:*:*) + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval "$set_cc_for_build" + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = 386; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo "$UNAME_MACHINE"-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux"$UNAME_RELEASE" + exit ;; + *:DragonFly:*:*) + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "$UNAME_MACHINE" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + exit ;; + i*86:rdos:*:*) + echo "$UNAME_MACHINE"-pc-rdos + exit ;; + i*86:AROS:*:*) + echo "$UNAME_MACHINE"-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; +esac + +echo "$0: unable to guess system type" >&2 + +case "$UNAME_MACHINE:$UNAME_SYSTEM" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-functions 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/runtime/onnxruntime/third_party/openfst/config.h.in b/runtime/onnxruntime/third_party/openfst/config.h.in new file mode 100644 index 0000000..8de1159 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/config.h.in @@ -0,0 +1,61 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/runtime/onnxruntime/third_party/openfst/config.sub b/runtime/onnxruntime/third_party/openfst/config.sub new file mode 100644 index 0000000..1d8e98b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/config.sub @@ -0,0 +1,1801 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2018 Free Software Foundation, Inc. + +timestamp='2018-02-22' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2018 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo "$1" | sed 's/-[^-]*$//'` + if [ "$basic_machine" != "$1" ] + then os=`echo "$1" | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 | or1k | or1knd | or32 \ + | pdp10 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ + | pyramid \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | wasm32 \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | ba-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ + | pyramid-* \ + | riscv32-* | riscv64-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | wasm32-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-pc + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + asmjs) + basic_machine=asmjs-unknown + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2*) + basic_machine=m68k-bull + os=-sysv3 + ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=$os"spe" + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + nsv-tandem) + basic_machine=nsv-tandem + ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + x64) + basic_machine=x86_64-pc + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases that might get confused + # with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # es1800 is here to avoid being matched by es* (a different OS) + -es1800*) + os=-ose + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ + | -midnightbsd*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -xray | -os68k* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo "$os" | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4*) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $basic_machine in + arm*) + os=-eabi + ;; + *) + os=-elf + ;; + esac + ;; + -nacl*) + ;; + -ios) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + pru-*) + os=-elf + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` + ;; +esac + +echo "$basic_machine$os" +exit + +# Local variables: +# eval: (add-hook 'write-file-functions 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/runtime/onnxruntime/third_party/openfst/configure.ac b/runtime/onnxruntime/third_party/openfst/configure.ac new file mode 100644 index 0000000..ea450da --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/configure.ac @@ -0,0 +1,180 @@ +AC_INIT([OpenFst], [1.7.2], [help@www.openfst.org]) +AM_INIT_AUTOMAKE([foreign nostdinc -Wall -Werror subdir-objects]) +AM_PROG_AR + +# OpenFst does not throw exceptions, so we do not generate exception handling +# code. However, users are free to re-enable exception handling. +# OpenFst assumes char is unsigned; -fsigned-char is likely unsafe. +CPPFLAGS="$CPPFLAGS -fno-exceptions -funsigned-char" +CXXFLAGS="$CXXFLAGS -std=c++11" + +AC_PROG_CXX +AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +AC_CONFIG_HEADERS([config.h src/include/fst/config.h]) +AC_CONFIG_SRCDIR([src/lib/fst.cc]) +AC_CONFIG_FILES([ + Makefile + src/Makefile + src/include/Makefile + src/lib/Makefile + src/bin/Makefile + src/test/Makefile + src/extensions/Makefile + src/extensions/compact/Makefile + src/extensions/compress/Makefile + src/extensions/const/Makefile + src/extensions/far/Makefile + src/extensions/linear/Makefile + src/extensions/lookahead/Makefile + src/extensions/mpdt/Makefile + src/extensions/ngram/Makefile + src/extensions/pdt/Makefile + src/extensions/python/Makefile + src/extensions/special/Makefile + src/script/Makefile +]) +AC_CONFIG_MACRO_DIR([m4]) +AC_LANG([C++]) + +AC_ARG_ENABLE([compact-fsts], + [AS_HELP_STRING([--enable-compact-fsts], + [enable CompactFst extensions])], + [], + [enable_compact_fsts=no]) +AM_CONDITIONAL([HAVE_COMPACT], [test "x$enable_compact_fsts" != xno]) + +AC_ARG_ENABLE([compress], + [AS_HELP_STRING([--enable-compress], + [enable compression extension])], + [], + [enable_compress=no]) +AM_CONDITIONAL([HAVE_COMPRESS], [test "x$enable_compress" != xno]) + +AC_ARG_ENABLE([const-fsts], + [AS_HELP_STRING([--enable-const-fsts], + [enable ConstFst extensions])], + [], + [enable_const_fsts=no]) +AM_CONDITIONAL([HAVE_CONST], [test "x$enable_const_fsts" != xno]) + +AC_ARG_ENABLE([far], + [AS_HELP_STRING([--enable-far], [enable FAR extensions])], + [], + [enable_far=no]) +AM_CONDITIONAL([HAVE_FAR], [test "x$enable_far" != xno]) + +AC_ARG_ENABLE([linear-fsts], + [AS_HELP_STRING([--enable-linear-fsts], + [enable LinearTagger/ClassifierFst extensions])], + [], + [enable_linear_fsts=no]) +AM_CONDITIONAL([HAVE_LINEAR], [test "x$enable_linear_fsts" != xno]) + +AC_ARG_ENABLE([lookahead-fsts], + [AS_HELP_STRING([--enable-lookahead-fsts], + [enable LookAheadFst extensions])], + [], + [enable_lookahead_fsts=no]) +AM_CONDITIONAL([HAVE_LOOKAHEAD], [test "x$enable_lookahead_fsts" != xno]) + +AC_ARG_ENABLE([mpdt], + [AS_HELP_STRING([--enable-mpdt], + [enable MPDT extensions])], + [], + [enable_mpdt=no]) +AM_CONDITIONAL([HAVE_MPDT], [test "x$enable_mpdt" != xno]) + +AC_ARG_ENABLE([ngram-fsts], + [AS_HELP_STRING([--enable-ngram-fsts], + [enable NGramFst extension])], + [], + [enable_ngram_fsts=no]) +AM_CONDITIONAL([HAVE_NGRAM], [test "x$enable_ngram_fsts" != xno]) + +AC_ARG_ENABLE([pdt], + [AS_HELP_STRING([--enable-pdt], + [enable PDT extensions])], + [], + [enable_pdt=no]) +AM_CONDITIONAL([HAVE_PDT], [test "x$enable_pdt" != xno]) + +AC_ARG_ENABLE([python], + [AS_HELP_STRING([--enable-python], + [enable Python extensions])], + [], + [enable_python=no]) +AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" != xno]) +if test "x$enable_python" != xno; then + AM_PATH_PYTHON(2.7) + AC_PYTHON_DEVEL([>= '2.7']) +fi + +AC_ARG_ENABLE([special], + [AS_HELP_STRING([--enable-special], + [enable special-matcher extensions])], + [], + [enable_special=no]) +AM_CONDITIONAL([HAVE_SPECIAL], [test "x$enable_special" != xno]) + +# --enable-bin enables script and bin "extensions". +AC_ARG_ENABLE([bin], + [AS_HELP_STRING([--enable-bin], + [enable fst::script and command-line binaries])], + [], + [enable_bin=yes]) +AM_CONDITIONAL([HAVE_BIN], [test "x$enable_bin" != xno]) +AM_CONDITIONAL([HAVE_SCRIPT], [test "x$enable_bin" != xno]) + +# --enable-grm enables dependencies of OpenGrm: far, mpdt, and pdt. +AC_ARG_ENABLE([grm], + [AS_HELP_STRING([--enable-grm], + [enable all dependencies of OpenGrm])], + [], + [enable_grm=no]) +AM_CONDITIONAL([HAVE_GRM], [test "x$enable_grm" != xno]) + +AC_ARG_WITH([libfstdir], +[--with-libfstdir[=DIR] fst dynamic extensions [[LIBDIR/fst]]], +[], [with_libfstdir=[${libdir}/fst]]) + +AC_SUBST([libfstdir], $with_libfstdir) + +# Flags may be changed after configuring, so this is checked again by +# weight_test.cc. The check here is to save time in the common case, +# or when someone does not run `make check`. +AC_RUN_IFELSE([AC_LANG_PROGRAM([ + #include + + template + bool FloatEqIsReflexive(T m) { + volatile T x = 1.111; + x *= m; + + T y = 1.111; + y *= m; + + return x == y; + } + ], [ + volatile double test_value = 1.1; + if (!FloatEqIsReflexive(static_cast(test_value))) { + printf("float FAIL\n"); + return 1; + } + if (!FloatEqIsReflexive(test_value)) { + printf("double FAIL\n"); + return 1; + } + ])], + [echo "Float equality is good"], + [AC_MSG_FAILURE(m4_normalize([ + Test float equality failed! + Compile with -msse -mfpmath=sse if using g++. + ]))]) + +AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl]) +AC_SUBST([DL_LIBS]) + +AC_OUTPUT diff --git a/runtime/onnxruntime/third_party/openfst/ltmain.sh b/runtime/onnxruntime/third_party/openfst/ltmain.sh new file mode 100644 index 0000000..b6f1800 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/ltmain.sh @@ -0,0 +1,11170 @@ +#! /bin/sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2014-01-03.01 + +# libtool (GNU libtool) 2.4.6 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.6 +package_revision=2.4.6 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2015-01-20.17; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# Copyright (C) 2004-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# As a special exception to the GNU General Public License, if you distribute +# this file as part of a program or library that is built using GNU Libtool, +# you may include this file under the same distribution terms that you use +# for the rest of that program. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac +fi + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' + +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () +{ + $debug_cmd + + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in + *[\\\`\"\$]*) + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi + + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; + esac + + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done +} + + +# func_quote_for_expand ARG +# ------------------------- +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + $debug_cmd + + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; + esac + + case $_G_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_arg=\"$_G_arg\" + ;; + esac + + func_quote_for_expand_result=$_G_arg +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_tr_sh +# ---------- +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# Set a version string for this script. +scriptversion=2014-01-07.03; # UTC + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# Copyright (C) 2010-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# warranty; '. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# to the main code. A hook is just a named list of of function, that can +# be run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It is assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook funcions.n" ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + eval $_G_hook '"$@"' + + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + done + + func_quote_for_eval ${1+"$@"} + func_run_hooks_result=$func_quote_for_eval_result +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list in your hook function, remove any +# options that you action, and then pass back the remaining unprocessed +# options in '_result', escaped suitably for +# 'eval'. Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# +# func_quote_for_eval ${1+"$@"} +# my_options_prep_result=$func_quote_for_eval_result +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# # Note that for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# ;; +# *) set dummy "$_G_opt" "$*"; shift; break ;; +# esac +# done +# +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# +# func_quote_for_eval ${1+"$@"} +# my_option_validation_result=$func_quote_for_eval_result +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll alse need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + func_options_prep ${1+"$@"} + eval func_parse_options \ + ${func_options_prep_result+"$func_options_prep_result"} + eval func_validate_options \ + ${func_parse_options_result+"$func_parse_options_result"} + + eval func_run_hooks func_options \ + ${func_validate_options_result+"$func_validate_options_result"} + + # save modified positional parameters for caller + func_options_result=$func_run_hooks_result +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propogate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before +# returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + func_parse_options_result= + + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + + # Adjust func_parse_options positional parameters to match + eval set dummy "$func_run_hooks_result"; shift + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + test $# = 0 && func_missing_arg $_G_opt && break + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE + + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after +# splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + test "x$func_split_equals_lhs" = "x$1" \ + && func_split_equals_rhs= + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more + } + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p + } + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.6' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname (GNU libtool) 2.4.6 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func__fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." +} + + +# func_config +# ----------- +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + + +# func_features +# ------------- +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + + +# func_enable_tag TAGNAME +# ----------------------- +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname=$1 + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + + +# func_check_version_match +# ------------------------ +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if 'file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case $lalib_p_line in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test yes = "$lalib_p" +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# 'FILE.' does not work on cygwin managed mounts. +func_source () +{ + $debug_cmd + + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case $lt_sysroot:$1 in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result='='$func_stripname_result + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $debug_cmd + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with '--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $debug_cmd + + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result= + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $debug_cmd + + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $debug_cmd + + if test -z "$2" && test -n "$1"; then + func_error "Could not determine host file name corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result=$1 + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $debug_cmd + + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " '$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result=$3 + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $debug_cmd + + case $4 in + $1 ) func_to_host_path_result=$3$func_to_host_path_result + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via '$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $debug_cmd + + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $debug_cmd + + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result=$1 +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result=$func_convert_core_msys_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via '$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $debug_cmd + + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd=func_convert_path_$func_stripname_result + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $debug_cmd + + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result=$1 +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # Get the compilation command and the source file. + base_compile= + srcfile=$nonopt # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify '-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs=$IFS; IFS=, + for arg in $args; do + IFS=$save_ifs + func_append_quoted lastarg "$arg" + done + IFS=$save_ifs + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg=$srcfile + srcfile=$arg + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with '-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj=$func_basename_result + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from '$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name '$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test yes = "$build_old_libs"; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test yes = "$need_locks"; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test warn = "$need_locks"; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a 'standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to '-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the '--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the 'install' or 'cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with '-') are ignored. + +Every other argument is treated as a filename. Files ending in '.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. + +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode '$opt_mode'" + ;; + esac + + echo + $ECHO "Try '$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test : = "$opt_help"; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + $SED '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $debug_cmd + + # The first argument is the command name. + cmd=$nonopt + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "'$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "'$file' was not linked with '-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir=$func_dirname_result + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir=$func_dirname_result + ;; + + *) + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir=$absdir + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic=$magic + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file=$progdir/$program + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file=$progdir/$program + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd=\$cmd$args + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "'$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument '$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and '=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_quiet && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the '$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac + then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=false + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=: ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the '$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir=$func_dirname_result + destname=$func_basename_result + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "'$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "'$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir=$func_dirname_result + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking '$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname=$1 + shift + + srcname=$realname + test -n "$relink_command" && srcname=${realname}T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme=$stripme + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try 'ln -sf' first, because the 'ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib=$destdir/$realname + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name=$func_basename_result + instname=$dir/${name}i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest=$destfile + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to '$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test yes = "$build_old_libs"; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext= + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=.exe + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script '$wrapper'" + + finalize=: + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file=$func_basename_result + outputname=$tmpdir/$file + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_quiet || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink '$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file=$outputname + else + func_warning "cannot relink '$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name=$func_basename_result + + # Set up the ranlib parameters. + oldlib=$destdir/$name + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run '$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test install = "$opt_mode" && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms=${my_outputname}S.c + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist=$output_objdir/$my_outputname.nm + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + + # Transform the symbol file into the correct name. + symfileobj=$output_objdir/${my_outputname}S.$objext + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for '$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $debug_cmd + + win32_libid_type=unknown + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s|.*|import| + p + q + } + }'` + ;; + esac + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $debug_cmd + + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $debug_cmd + + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1"; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result= + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $debug_cmd + + my_gentop=$1; shift + my_oldlibs=${1+"$@"} + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib=$func_basename_result + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" + cd "$darwin_curdir" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result=$my_oldobjs +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory where it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test yes = "$fast_install"; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + \$ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* declarations of non-ANSI functions */ +#if defined __MINGW32__ +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined __CYGWIN__ +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined other_platform || defined ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined _MSC_VER +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +#elif defined __MINGW32__ +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined __CYGWIN__ +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined other platforms ... */ +#endif + +#if defined PATH_MAX +# define LT_PATHMAX PATH_MAX +#elif defined MAXPATHLEN +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined HAVE_DOS_BASED_FILE_SYSTEM + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined HAVE_DOS_BASED_FILE_SYSTEM + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = (size_t) (q - p); + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (STREQ (str, pat)) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + size_t len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + size_t orig_value_len = strlen (orig_value); + size_t add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # what system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll that has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module=$wl-single_module + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg=$1 + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir=$arg + prev= + continue + ;; + dlfiles|dlprefiles) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols=$arg + test -f "$arg" \ + || func_fatal_error "symbol file '$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex=$arg + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + if test none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + fi + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file '$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; + precious_regex) + precious_files_regex=$arg + prev= + continue + ;; + release) + release=-$arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test rpath = "$prev"; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds=$arg + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg=$arg + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "'-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test X-export-symbols = "X$arg"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between '-L' and '$1'" + else + func_fatal_error "need path for '-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test X-lc = "X$arg" || test X-lm = "X$arg"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test X-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test X-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module=$wl-multi_module + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -os2dllname) + prev=os2dllname + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,--as-needed) + deplibs="$deplibs $arg" + continue + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -stdlib=* select c++ std lib with clang + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + fi + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the '$prevarg' option requires an argument" + + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname=$func_basename_result + libobjs_save=$libobjs + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + func_dirname "$output" "/" "" + output_objdir=$func_dirname_result$objdir + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test lib = "$linkmode"; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + as_needed_flag= + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + as_needed_flag= + compile_deplibs= + finalize_deplibs= + alldeplibs=false + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test lib,link = "$linkmode,$pass"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs=$tmp_deplibs + fi + + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs=$dlprefiles + fi + if test dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -Wl,--as-needed) + if test prog,link = "$linkmode,$pass" || + test lib,link = "$linkmode,$pass"; then + as_needed_flag="$deplib " + else + deplibs="$deplib $deplibs" + fi + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib=$searchdir/lib$name$search_ext + if test -f "$lib"; then + if test .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll=$l + done + if test "X$ll" = "X$old_library"; then # only static version available + found=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test conv = "$pass" && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "'-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test link = "$pass"; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=false + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=: + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "'$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir=$func_dirname_result + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib=$l + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + + # This library was specified with -dlopen. + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir=$ladir + fi + ;; + esac + func_basename "$lib" + laname=$func_basename_result + + # Find the relevant object directory and library name. + if test yes = "$installed"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir + else + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir + fi + test yes = "$hardcode_automatic" && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir=$ladir + absdir=$abs_ladir + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + fi + case $host in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if $linkalldeplibs; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + # Make sure the rpath contains only unique directories. + case $temp_rpath: in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule= + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule=$dlpremoduletest + break + fi + done + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname=$1 + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname=$dlname + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc* | *os2*) + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + esac + eval soname=\"$soname_spec\" + else + soname=$realname + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot=$soname + func_basename "$soroot" + soname=$func_basename_result + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from '$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for '$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; then + add=$dir/$linklib + case $host in + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir=-L$dir ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we cannot + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library"; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add=$dir/$old_library + fi + elif test -n "$old_library"; then + add=$dir/$old_library + fi + fi + esac + elif test no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test prog = "$linkmode"; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib + else + add=$libdir/$linklib + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir=-L$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + fi + + if test prog = "$linkmode"; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test prog = "$linkmode"; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system cannot link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test yes = "$module"; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs=$temp_deplibs + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test no != "$link_all_deplibs"; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path=$deplib ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + path= + fi + fi + ;; + *) + path=-L$absdir/$objdir + ;; + esac + else + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test link = "$pass"; then + if test prog = "$linkmode"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=deplibs + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i= + ;; + esac + if test -n "$i"; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "'-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "'-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs=$output + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form 'libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; then + # Building a libtool convenience library. + # Some compilers have problems with a '.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "'-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs=$IFS; IFS=: + set dummy $vinfo 0 0 0 + shift + IFS=$save_ifs + + test -n "$7" && \ + func_fatal_help "too many parameters to '-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major=$1 + number_minor=$2 + number_revision=$3 + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_minor + lt_irix_increment=no + ;; + esac + ;; + no) + current=$1 + revision=$2 + age=$3 + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring=$verstring_prefix$major.$revision + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test 0 -ne "$loop"; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring_prefix$major.$iface:$verstring + done + + # Before this point, $major must not contain '.'. + major=.$major + versuffix=$major.$revision + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision + + # Add in all the interfaces that we are compatible with. + loop=$age + while test 0 -ne "$loop"; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring:$iface.0 + done + + # Make executables depend on our current version. + func_append verstring ":$current.0" + ;; + + qnx) + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + + *) + func_fatal_configuration "unknown library version type '$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring=0.0 + ;; + esac + if test no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles=$dlfiles + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles=$dlprefiles + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test yes = "$build_libtool_libs"; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib=$potent_lib # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs= + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test none = "$deplibs_check_method"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test yes = "$droppeddeps"; then + if test yes = "$module"; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test no = "$allow_undefined"; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs=$new_libs + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname=$1 + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname=$realname + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib=$output_objdir/$realname + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + func_dll_def_p "$export_symbols" || { + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols=$export_symbols + export_symbols= + always_export_symbols=yes + } + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs=$IFS; IFS='~' + for cmd1 in $cmds; do + IFS=$save_ifs + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test yes = "$try_normal_branch" \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=$output_objdir/$output_la.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs=$tmp_deplibs + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test yes = "$compiler_needs_object" && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test : != "$skipped_export" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-$k.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test -z "$objlist" || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test 1 -eq "$k"; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-$k.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-$k.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + } + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs=$IFS; IFS='~' + for cmd in $concat_cmds; do + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + ${skipped_export-false} && { + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + } + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + # A bit hacky. I had wanted to add \$as_needed_flag to archive_cmds instead, but that + # comes from libtool.m4 which is part of the project being built. This should put it + # in the right place though. + if test lib,link = "$linkmode,$pass" && test -n "$as_needed_flag"; then + libobjs=$as_needed_flag$libobjs + fi + + save_ifs=$IFS; IFS='~' + for cmd in $cmds; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "'-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object '$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj=$output + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + else + gentop=$output_objdir/${obj}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + + # Create the old-style object. + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + + output=$obj + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + test yes = "$build_libtool_libs" || { + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + } + + if test -n "$pic_flag" || test default != "$pic_mode"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output=$libobj + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "'-release' is ignored for programs" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test CXX = "$tagname"; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs=$new_libs + + + func_append compile_command " $as_needed_flag $compile_deplibs" + func_append finalize_command " $as_needed_flag $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath=$rpath + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath=$rpath + + if test -n "$libobjs" && test yes = "$build_old_libs"; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=$compile_command$compile_rpath + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + fi + + exit $exit_status + } + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test yes = "$no_install"; then + # We don't need to create a wrapper script. + link_command=$compile_var$compile_command$compile_rpath + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + if test -n "$addlibs"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase=$func_basename_result + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj"; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test -z "$oldobjs"; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test yes = "$build_old_libs" && old_library=$libname.$libext + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; then + if test -z "$install_libdir"; then + break + fi + output=$output_objdir/${outputname}i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name=$func_basename_result + func_resolve_sysroot "$deplib" + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs=$newdependency_libs + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles=$newdlprefiles + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles=$newdlprefiles + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test -n "$bindir"; then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result/$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test no,yes = "$installed,$need_relink"; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=: ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif $rmforce; then + continue + fi + + rmfiles=$file + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case $opt_mode in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && test none != "$pic_object"; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && test none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the $objdir's in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +test -z "$opt_mode" && { + help=$generic_help + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode '$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# where we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/runtime/onnxruntime/third_party/openfst/m4/ac_python_devel.m4 b/runtime/onnxruntime/third_party/openfst/m4/ac_python_devel.m4 new file mode 100644 index 0000000..4855156 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/m4/ac_python_devel.m4 @@ -0,0 +1,230 @@ +dnl @synopsis AC_PYTHON_DEVEL([version]) +dnl +dnl Note: Defines as a precious variable "PYTHON_VERSION". Don't +dnl override it in your configure.ac. +dnl +dnl This macro checks for Python and tries to get the include path to +dnl 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and +dnl $(PYTHON_LDFLAGS) output variables. It also exports +dnl $(PYTHON_EXTRA_LIBS) and $(PYTHON_EXTRA_LDFLAGS) for embedding +dnl Python in your code. +dnl +dnl You can search for some particular version of Python by passing a +dnl parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". +dnl Please note that you *have* to pass also an operator along with the +dnl version to match, and pay special attention to the single quotes +dnl surrounding the version number. Don't use "PYTHON_VERSION" for +dnl this: that environment variable is declared as precious and thus +dnl reserved for the end-user. +dnl +dnl This macro should work for all versions of Python >= 2.1.0. As an +dnl end user, you can disable the check for the python version by +dnl setting the PYTHON_NOVERSIONCHECK environment variable to something +dnl else than the empty string. +dnl +dnl If you need to use this macro for an older Python version, please +dnl contact the authors. We're always open for feedback. +dnl +dnl @category InstalledPackages +dnl @author Sebastian Huber +dnl @author Alan W. Irwin +dnl @author Rafael Laboissiere +dnl @author Andrew Collier +dnl @author Matteo Settenvini +dnl @author Horst Knorr +dnl @version 2006-05-27 +dnl @license GPLWithACException + +AC_DEFUN([AC_PYTHON_DEVEL],[ + # + # Allow the use of a (user set) custom python version + # + AC_ARG_VAR([PYTHON_VERSION],[The installed Python + version to use, for example '2.3'. This string + will be appended to the Python interpreter + canonical name.]) + + AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) + if test -z "$PYTHON"; then + AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) + PYTHON_VERSION="" + fi + + # + # Check for a version of Python >= 2.1.0 + # + AC_MSG_CHECKING([for a version of Python >= '2.1.0']) + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[[0]]; \ + print ver >= '2.1.0'"` + if test "$ac_supports_python_ver" != "True"; then + if test -z "$PYTHON_NOVERSIONCHECK"; then + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([ +This version of the AC@&t@_PYTHON_DEVEL macro +doesn't work properly with versions of Python before +2.1.0. You may need to re-run configure, setting the +variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, +PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. +Moreover, to disable this check, set PYTHON_NOVERSIONCHECK +to something else than an empty string. +]) + else + AC_MSG_RESULT([skip at user request]) + fi + else + AC_MSG_RESULT([yes]) + fi + + # + # if the macro parameter ``version'' is set, honour it + # + if test -n "$1"; then + AC_MSG_CHECKING([for a version of Python $1]) + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[[0]]; \ + print ver $1"` + if test "$ac_supports_python_ver" = "True"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([this package requires Python $1. +If you have it installed, but it isn't the default Python +interpreter in your system path, please pass the PYTHON_VERSION +variable to configure. See ``configure --help'' for reference. +]) + PYTHON_VERSION="" + fi + fi + + # + # Check if you have distutils, else fail + # + AC_MSG_CHECKING([for the distutils Python package]) + ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` + if test -z "$ac_distutils_result"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([cannot import Python module "distutils". +Please check your Python installation. The error was: +$ac_distutils_result]) + PYTHON_VERSION="" + fi + + # + # Check for Python include path + # + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON_CPPFLAGS"; then + python_path=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_inc();"` + if test -n "${python_path}"; then + python_path="-I$python_path" + fi + PYTHON_CPPFLAGS=$python_path + fi + AC_MSG_RESULT([$PYTHON_CPPFLAGS]) + AC_SUBST([PYTHON_CPPFLAGS]) + + # + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) + if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + py_version=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print join(get_config_vars('VERSION'))"` + if test "$py_version" == "[None]"; then + if test -n "$PYTHON_VERSION"; then + py_version=$PYTHON_VERSION + else + py_version=`$PYTHON -c "import sys; \ + print sys.version[[:3]]"` + fi + fi + + PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print '-L' + get_python_lib(0,1), \ + '-lpython';"`$py_version + fi + AC_MSG_RESULT([$PYTHON_LDFLAGS]) + AC_SUBST([PYTHON_LDFLAGS]) + + # + # Check for site packages + # + AC_MSG_CHECKING([for Python site-packages path]) + if test -z "$PYTHON_SITE_PKG"; then + PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_lib(0,0);"` + fi + AC_MSG_RESULT([$PYTHON_SITE_PKG]) + AC_SUBST([PYTHON_SITE_PKG]) + + # + # libraries which must be linked in when embedding + # + AC_MSG_CHECKING(python extra libraries) + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LOCALMODLIBS'), conf('LIBS')"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) + AC_SUBST(PYTHON_EXTRA_LIBS) + + # + # linking flags needed when embedding + # + AC_MSG_CHECKING(python extra linking flags) + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LINKFORSHARED')"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) + AC_SUBST(PYTHON_EXTRA_LDFLAGS) + + # + # final check to see if everything compiles alright + # + AC_MSG_CHECKING([consistency of all components of python development environment]) + AC_LANG_PUSH([C]) + # save current global flags + LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + AC_TRY_LINK([ + #include + ],[ + Py_Initialize(); + ],[pythonexists=yes],[pythonexists=no]) + + AC_MSG_RESULT([$pythonexists]) + + if test ! "$pythonexists" = "yes"; then + AC_MSG_ERROR([ + Could not link test program to Python. Maybe the main Python library has been + installed in some non-standard library path. If so, pass it to configure, + via the LDFLAGS environment variable. + Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" + ============================================================================ + ERROR! + You probably have to install the development version of the Python package + for your distribution. The exact name of this package varies among them. + ============================================================================ + ]) + PYTHON_VERSION="" + fi + AC_LANG_POP + # turn back to default flags + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + + # + # all done! + # +]) diff --git a/runtime/onnxruntime/third_party/openfst/m4/libtool.m4 b/runtime/onnxruntime/third_party/openfst/m4/libtool.m4 new file mode 100644 index 0000000..a3bc337 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/m4/libtool.m4 @@ -0,0 +1,8369 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +]) + +# serial 58 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# '#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS=$save_LDFLAGS + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[[012]][[,.]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + m4_if([$1], [CXX], +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case $ECHO in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program that can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test yes = "$GCC"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + osf3*) + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting $shlibpath_var if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC=$CC +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report what library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC=$lt_save_CC +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)=$prev$p + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)=$p + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)=$p + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test no = "$F77"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_F77"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test no = "$FC"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_FC"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f "$lt_ac_sed" && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test 10 -lt "$lt_ac_count" && break + lt_ac_count=`expr $lt_ac_count + 1` + if test "$lt_ac_count" -gt "$lt_ac_max"; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/runtime/onnxruntime/third_party/openfst/m4/ltoptions.m4 b/runtime/onnxruntime/third_party/openfst/m4/ltoptions.m4 new file mode 100644 index 0000000..94b0829 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/m4/ltoptions.m4 @@ -0,0 +1,437 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 8 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option '$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# LT_INIT options. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/runtime/onnxruntime/third_party/openfst/m4/ltsugar.m4 b/runtime/onnxruntime/third_party/openfst/m4/ltsugar.m4 new file mode 100644 index 0000000..48bc934 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/m4/ltsugar.m4 @@ -0,0 +1,124 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/runtime/onnxruntime/third_party/openfst/m4/ltversion.m4 b/runtime/onnxruntime/third_party/openfst/m4/ltversion.m4 new file mode 100644 index 0000000..fa04b52 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 4179 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.6' +macro_revision='2.4.6' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/runtime/onnxruntime/third_party/openfst/m4/lt~obsolete.m4 b/runtime/onnxruntime/third_party/openfst/m4/lt~obsolete.m4 new file mode 100644 index 0000000..c6b26f8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/m4/lt~obsolete.m4 @@ -0,0 +1,99 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/runtime/onnxruntime/third_party/openfst/openfst.sln b/runtime/onnxruntime/third_party/openfst/openfst.sln new file mode 100644 index 0000000..577c266 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/openfst.sln @@ -0,0 +1,68 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfst", "src\lib\libfst.vcxproj", "{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Control and build files", "Control and build files", "{F14A9AF0-0D79-4553-AA8E-B3905A9B6431}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + .gitignore = .gitignore + src\openfst-multibin.targets = src\openfst-multibin.targets + src\openfst.props = src\openfst.props + src\openfst.targets = src\openfst.targets + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfstscript", "src\script\libfstscript.vcxproj", "{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bin", "src\bin\bin.vcxproj", "{84657A19-CAF2-49E8-8DB3-A428C19F460D}" + ProjectSection(ProjectDependencies) = postProject + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6} = {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "!! READ ME BEFORE BUILD !!", "!! READ ME BEFORE BUILD !!", "{3BAF0BB0-34BF-4E28-BC17-A80D7CF4130F}" + ProjectSection(SolutionItems) = preProject + src\openfst.user.props = src\openfst.user.props + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x64.ActiveCfg = Debug|x64 + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x64.Build.0 = Debug|x64 + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x86.ActiveCfg = Debug|Win32 + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x86.Build.0 = Debug|Win32 + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x64.ActiveCfg = Release|x64 + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x64.Build.0 = Release|x64 + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x86.ActiveCfg = Release|Win32 + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x86.Build.0 = Release|Win32 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x64.ActiveCfg = Debug|x64 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x64.Build.0 = Debug|x64 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x86.ActiveCfg = Debug|Win32 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x86.Build.0 = Debug|Win32 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x64.ActiveCfg = Release|x64 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x64.Build.0 = Release|x64 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x86.ActiveCfg = Release|Win32 + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x86.Build.0 = Release|Win32 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x64.ActiveCfg = Debug|x64 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x64.Build.0 = Debug|x64 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x86.ActiveCfg = Debug|Win32 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x86.Build.0 = Debug|Win32 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x64.ActiveCfg = Release|x64 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x64.Build.0 = Release|x64 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x86.ActiveCfg = Release|Win32 + {84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {14CFFA93-2ED0-43D3-A3E9-5203D4CB19BF} + EndGlobalSection +EndGlobal diff --git a/runtime/onnxruntime/third_party/openfst/src/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/CMakeLists.txt new file mode 100644 index 0000000..04051ef --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/CMakeLists.txt @@ -0,0 +1,23 @@ + +#-DHAVE_CONFIG_H -I./../include -fno-exceptions -funsigned-char -std=c++11 -MT symbol-table.lo -MD -MP -MF .deps/symbol-table.Tpo -c symbol-table.cc -fno-common -DPIC -o .libs/symbol-table.o + +include_directories(./include/) +install(DIRECTORY include/ DESTINATION include/ + FILES_MATCHING PATTERN "*.h") + +add_subdirectory(lib) + +if(HAVE_SCRIPT) + add_subdirectory(script) +endif(HAVE_SCRIPT) + +if(HAVE_BIN) + add_subdirectory(bin) +endif(HAVE_BIN) + +add_subdirectory(extensions) + +if(BUILD_TESTING) + enable_testing() + add_subdirectory(test) +endif(BUILD_TESTING) diff --git a/runtime/onnxruntime/third_party/openfst/src/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/Makefile.am new file mode 100644 index 0000000..b3ca481 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = include lib script bin test extensions diff --git a/runtime/onnxruntime/third_party/openfst/src/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/Makefile.in new file mode 100644 index 0000000..21d9d41 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/Makefile.in @@ -0,0 +1,638 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = include lib script bin test extensions +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/bin/CMakeLists.txt new file mode 100644 index 0000000..3407150 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/CMakeLists.txt @@ -0,0 +1,86 @@ +function (add_executable2 _name) + add_executable(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fstscript fst ${CMAKE_DL_LIBS}) + set_target_properties(${_name} PROPERTIES FOLDER bin) + endif() + + install(TARGETS ${_name} RUNTIME DESTINATION bin) +endfunction() + +include_directories(../include ../script/) + +add_executable2(fstarcsort fstarcsort-main.cc fstarcsort.cc) + +add_executable2(fstclosure fstclosure-main.cc fstclosure.cc) + +add_executable2(fstcompile fstcompile-main.cc fstcompile.cc) + +add_executable2(fstcompose fstcompose-main.cc fstcompose.cc) + +add_executable2(fstconcat fstconcat-main.cc fstconcat.cc) + +add_executable2(fstconnect fstconnect-main.cc fstconnect.cc) + +add_executable2(fstconvert fstconvert-main.cc fstconvert.cc) + +add_executable2(fstdeterminize fstdeterminize-main.cc fstdeterminize.cc) + +add_executable2(fstdifference fstdifference-main.cc fstdifference.cc) + +add_executable2(fstdisambiguate fstdisambiguate-main.cc fstdisambiguate.cc) + +add_executable2(fstdraw fstdraw-main.cc fstdraw.cc) + +add_executable2(fstencode fstencode-main.cc fstencode.cc) + +add_executable2(fstepsnormalize fstepsnormalize-main.cc fstepsnormalize.cc) + +add_executable2(fstequal fstequal-main.cc fstequal.cc) + +add_executable2(fstequivalent fstequivalent-main.cc fstequivalent.cc) + +add_executable2(fstinfo fstinfo-main.cc fstinfo.cc) + +add_executable2(fstintersect fstintersect-main.cc fstintersect.cc) + +add_executable2(fstinvert fstinvert-main.cc fstinvert.cc) + +add_executable2(fstisomorphic fstisomorphic-main.cc fstisomorphic.cc) + +add_executable2(fstmap fstmap-main.cc fstmap.cc) + +add_executable2(fstminimize fstminimize-main.cc fstminimize.cc) + +add_executable2(fstprint fstprint-main.cc fstprint.cc) + +add_executable2(fstproject fstproject-main.cc fstproject.cc) + +add_executable2(fstprune fstprune-main.cc fstprune.cc) + +add_executable2(fstpush fstpush-main.cc fstpush.cc) + +add_executable2(fstrandgen fstrandgen-main.cc fstrandgen.cc) + +add_executable2(fstrelabel fstrelabel-main.cc fstrelabel.cc) + +add_executable2(fstreplace fstreplace-main.cc fstreplace.cc) + +add_executable2(fstreverse fstreverse-main.cc fstreverse.cc) + +add_executable2(fstreweight fstreweight-main.cc fstreweight.cc) + +add_executable2(fstrmepsilon fstrmepsilon-main.cc fstrmepsilon.cc) + +add_executable2(fstshortestdistance fstshortestdistance-main.cc fstshortestdistance.cc) + +add_executable2(fstshortestpath fstshortestpath-main.cc fstshortestpath.cc) + +add_executable2(fstsymbols fstsymbols-main.cc fstsymbols.cc) + +add_executable2(fstsynchronize fstsynchronize-main.cc fstsynchronize.cc) + +add_executable2(fsttopsort fsttopsort-main.cc fsttopsort.cc) + +add_executable2(fstunion fstunion-main.cc fstunion.cc) + diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/bin/Makefile.am new file mode 100644 index 0000000..b4069c4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/Makefile.am @@ -0,0 +1,86 @@ +AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../script $(ICU_FLAGS) +LDADD = ../script/libfstscript.la ../lib/libfst.la -lm $(DL_LIBS) + +if HAVE_BIN +bin_PROGRAMS = fstarcsort fstclosure fstcompile fstcompose fstconcat \ +fstconnect fstconvert fstdeterminize fstdifference fstdisambiguate fstdraw \ +fstencode fstepsnormalize fstequal fstequivalent fstinfo fstintersect \ +fstinvert fstisomorphic fstmap fstminimize fstprint fstproject fstprune \ +fstpush fstrandgen fstrelabel fstreplace fstreverse fstreweight fstrmepsilon \ +fstshortestdistance fstshortestpath fstsymbols fstsynchronize fsttopsort \ +fstunion + +fstarcsort_SOURCES = fstarcsort.cc fstarcsort-main.cc + +fstclosure_SOURCES = fstclosure.cc fstclosure-main.cc + +fstcompile_SOURCES = fstcompile.cc fstcompile-main.cc + +fstcompose_SOURCES = fstcompose.cc fstcompose-main.cc + +fstconcat_SOURCES = fstconcat.cc fstconcat-main.cc + +fstconnect_SOURCES = fstconnect.cc fstconnect-main.cc + +fstconvert_SOURCES = fstconvert.cc fstconvert-main.cc + +fstdeterminize_SOURCES = fstdeterminize.cc fstdeterminize-main.cc + +fstdifference_SOURCES = fstdifference.cc fstdifference-main.cc + +fstdisambiguate_SOURCES = fstdisambiguate.cc fstdisambiguate-main.cc + +fstdraw_SOURCES = fstdraw.cc fstdraw-main.cc + +fstencode_SOURCES = fstencode.cc fstencode-main.cc + +fstepsnormalize_SOURCES = fstepsnormalize.cc fstepsnormalize-main.cc + +fstequal_SOURCES = fstequal.cc fstequal-main.cc + +fstequivalent_SOURCES = fstequivalent.cc fstequivalent-main.cc + +fstinfo_SOURCES = fstinfo.cc fstinfo-main.cc + +fstintersect_SOURCES = fstintersect.cc fstintersect-main.cc + +fstinvert_SOURCES = fstinvert.cc fstinvert-main.cc + +fstisomorphic_SOURCES = fstisomorphic.cc fstisomorphic-main.cc + +fstmap_SOURCES = fstmap.cc fstmap-main.cc + +fstminimize_SOURCES = fstminimize.cc fstminimize-main.cc + +fstprint_SOURCES = fstprint.cc fstprint-main.cc + +fstproject_SOURCES = fstproject.cc fstproject-main.cc + +fstprune_SOURCES = fstprune.cc fstprune-main.cc + +fstpush_SOURCES = fstpush.cc fstpush-main.cc + +fstrandgen_SOURCES = fstrandgen.cc fstrandgen-main.cc + +fstrelabel_SOURCES = fstrelabel.cc fstrelabel-main.cc + +fstreplace_SOURCES = fstreplace.cc fstreplace-main.cc + +fstreverse_SOURCES = fstreverse.cc fstreverse-main.cc + +fstreweight_SOURCES = fstreweight.cc fstreweight-main.cc + +fstrmepsilon_SOURCES = fstrmepsilon.cc fstrmepsilon-main.cc + +fstshortestdistance_SOURCES = fstshortestdistance.cc fstshortestdistance-main.cc + +fstshortestpath_SOURCES = fstshortestpath.cc fstshortestpath-main.cc + +fstsymbols_SOURCES = fstsymbols.cc fstsymbols-main.cc + +fstsynchronize_SOURCES = fstsynchronize.cc fstsynchronize-main.cc + +fsttopsort_SOURCES = fsttopsort.cc fsttopsort-main.cc + +fstunion_SOURCES = fstunion.cc fstunion-main.cc +endif diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/bin/Makefile.in new file mode 100644 index 0000000..237b97d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/Makefile.in @@ -0,0 +1,1231 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_BIN_TRUE@bin_PROGRAMS = fstarcsort$(EXEEXT) fstclosure$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstcompile$(EXEEXT) fstcompose$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstconcat$(EXEEXT) fstconnect$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstconvert$(EXEEXT) fstdeterminize$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstdifference$(EXEEXT) fstdisambiguate$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstdraw$(EXEEXT) fstencode$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstepsnormalize$(EXEEXT) fstequal$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstequivalent$(EXEEXT) fstinfo$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstintersect$(EXEEXT) fstinvert$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstisomorphic$(EXEEXT) fstmap$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstminimize$(EXEEXT) fstprint$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstproject$(EXEEXT) fstprune$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstpush$(EXEEXT) fstrandgen$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstrelabel$(EXEEXT) fstreplace$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstreverse$(EXEEXT) fstreweight$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstrmepsilon$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstshortestdistance$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstshortestpath$(EXEEXT) fstsymbols$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstsynchronize$(EXEEXT) fsttopsort$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstunion$(EXEEXT) +subdir = src/bin +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am__fstarcsort_SOURCES_DIST = fstarcsort.cc fstarcsort-main.cc +@HAVE_BIN_TRUE@am_fstarcsort_OBJECTS = fstarcsort.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstarcsort-main.$(OBJEXT) +fstarcsort_OBJECTS = $(am_fstarcsort_OBJECTS) +fstarcsort_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +fstarcsort_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am__fstclosure_SOURCES_DIST = fstclosure.cc fstclosure-main.cc +@HAVE_BIN_TRUE@am_fstclosure_OBJECTS = fstclosure.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstclosure-main.$(OBJEXT) +fstclosure_OBJECTS = $(am_fstclosure_OBJECTS) +fstclosure_LDADD = $(LDADD) +fstclosure_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstcompile_SOURCES_DIST = fstcompile.cc fstcompile-main.cc +@HAVE_BIN_TRUE@am_fstcompile_OBJECTS = fstcompile.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstcompile-main.$(OBJEXT) +fstcompile_OBJECTS = $(am_fstcompile_OBJECTS) +fstcompile_LDADD = $(LDADD) +fstcompile_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstcompose_SOURCES_DIST = fstcompose.cc fstcompose-main.cc +@HAVE_BIN_TRUE@am_fstcompose_OBJECTS = fstcompose.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstcompose-main.$(OBJEXT) +fstcompose_OBJECTS = $(am_fstcompose_OBJECTS) +fstcompose_LDADD = $(LDADD) +fstcompose_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstconcat_SOURCES_DIST = fstconcat.cc fstconcat-main.cc +@HAVE_BIN_TRUE@am_fstconcat_OBJECTS = fstconcat.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstconcat-main.$(OBJEXT) +fstconcat_OBJECTS = $(am_fstconcat_OBJECTS) +fstconcat_LDADD = $(LDADD) +fstconcat_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstconnect_SOURCES_DIST = fstconnect.cc fstconnect-main.cc +@HAVE_BIN_TRUE@am_fstconnect_OBJECTS = fstconnect.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstconnect-main.$(OBJEXT) +fstconnect_OBJECTS = $(am_fstconnect_OBJECTS) +fstconnect_LDADD = $(LDADD) +fstconnect_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstconvert_SOURCES_DIST = fstconvert.cc fstconvert-main.cc +@HAVE_BIN_TRUE@am_fstconvert_OBJECTS = fstconvert.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstconvert-main.$(OBJEXT) +fstconvert_OBJECTS = $(am_fstconvert_OBJECTS) +fstconvert_LDADD = $(LDADD) +fstconvert_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstdeterminize_SOURCES_DIST = fstdeterminize.cc \ + fstdeterminize-main.cc +@HAVE_BIN_TRUE@am_fstdeterminize_OBJECTS = fstdeterminize.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstdeterminize-main.$(OBJEXT) +fstdeterminize_OBJECTS = $(am_fstdeterminize_OBJECTS) +fstdeterminize_LDADD = $(LDADD) +fstdeterminize_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstdifference_SOURCES_DIST = fstdifference.cc \ + fstdifference-main.cc +@HAVE_BIN_TRUE@am_fstdifference_OBJECTS = fstdifference.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstdifference-main.$(OBJEXT) +fstdifference_OBJECTS = $(am_fstdifference_OBJECTS) +fstdifference_LDADD = $(LDADD) +fstdifference_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstdisambiguate_SOURCES_DIST = fstdisambiguate.cc \ + fstdisambiguate-main.cc +@HAVE_BIN_TRUE@am_fstdisambiguate_OBJECTS = fstdisambiguate.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstdisambiguate-main.$(OBJEXT) +fstdisambiguate_OBJECTS = $(am_fstdisambiguate_OBJECTS) +fstdisambiguate_LDADD = $(LDADD) +fstdisambiguate_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstdraw_SOURCES_DIST = fstdraw.cc fstdraw-main.cc +@HAVE_BIN_TRUE@am_fstdraw_OBJECTS = fstdraw.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstdraw-main.$(OBJEXT) +fstdraw_OBJECTS = $(am_fstdraw_OBJECTS) +fstdraw_LDADD = $(LDADD) +fstdraw_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstencode_SOURCES_DIST = fstencode.cc fstencode-main.cc +@HAVE_BIN_TRUE@am_fstencode_OBJECTS = fstencode.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstencode-main.$(OBJEXT) +fstencode_OBJECTS = $(am_fstencode_OBJECTS) +fstencode_LDADD = $(LDADD) +fstencode_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstepsnormalize_SOURCES_DIST = fstepsnormalize.cc \ + fstepsnormalize-main.cc +@HAVE_BIN_TRUE@am_fstepsnormalize_OBJECTS = fstepsnormalize.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstepsnormalize-main.$(OBJEXT) +fstepsnormalize_OBJECTS = $(am_fstepsnormalize_OBJECTS) +fstepsnormalize_LDADD = $(LDADD) +fstepsnormalize_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstequal_SOURCES_DIST = fstequal.cc fstequal-main.cc +@HAVE_BIN_TRUE@am_fstequal_OBJECTS = fstequal.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstequal-main.$(OBJEXT) +fstequal_OBJECTS = $(am_fstequal_OBJECTS) +fstequal_LDADD = $(LDADD) +fstequal_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstequivalent_SOURCES_DIST = fstequivalent.cc \ + fstequivalent-main.cc +@HAVE_BIN_TRUE@am_fstequivalent_OBJECTS = fstequivalent.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstequivalent-main.$(OBJEXT) +fstequivalent_OBJECTS = $(am_fstequivalent_OBJECTS) +fstequivalent_LDADD = $(LDADD) +fstequivalent_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstinfo_SOURCES_DIST = fstinfo.cc fstinfo-main.cc +@HAVE_BIN_TRUE@am_fstinfo_OBJECTS = fstinfo.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstinfo-main.$(OBJEXT) +fstinfo_OBJECTS = $(am_fstinfo_OBJECTS) +fstinfo_LDADD = $(LDADD) +fstinfo_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstintersect_SOURCES_DIST = fstintersect.cc fstintersect-main.cc +@HAVE_BIN_TRUE@am_fstintersect_OBJECTS = fstintersect.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstintersect-main.$(OBJEXT) +fstintersect_OBJECTS = $(am_fstintersect_OBJECTS) +fstintersect_LDADD = $(LDADD) +fstintersect_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstinvert_SOURCES_DIST = fstinvert.cc fstinvert-main.cc +@HAVE_BIN_TRUE@am_fstinvert_OBJECTS = fstinvert.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstinvert-main.$(OBJEXT) +fstinvert_OBJECTS = $(am_fstinvert_OBJECTS) +fstinvert_LDADD = $(LDADD) +fstinvert_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstisomorphic_SOURCES_DIST = fstisomorphic.cc \ + fstisomorphic-main.cc +@HAVE_BIN_TRUE@am_fstisomorphic_OBJECTS = fstisomorphic.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstisomorphic-main.$(OBJEXT) +fstisomorphic_OBJECTS = $(am_fstisomorphic_OBJECTS) +fstisomorphic_LDADD = $(LDADD) +fstisomorphic_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstmap_SOURCES_DIST = fstmap.cc fstmap-main.cc +@HAVE_BIN_TRUE@am_fstmap_OBJECTS = fstmap.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstmap-main.$(OBJEXT) +fstmap_OBJECTS = $(am_fstmap_OBJECTS) +fstmap_LDADD = $(LDADD) +fstmap_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstminimize_SOURCES_DIST = fstminimize.cc fstminimize-main.cc +@HAVE_BIN_TRUE@am_fstminimize_OBJECTS = fstminimize.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstminimize-main.$(OBJEXT) +fstminimize_OBJECTS = $(am_fstminimize_OBJECTS) +fstminimize_LDADD = $(LDADD) +fstminimize_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstprint_SOURCES_DIST = fstprint.cc fstprint-main.cc +@HAVE_BIN_TRUE@am_fstprint_OBJECTS = fstprint.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstprint-main.$(OBJEXT) +fstprint_OBJECTS = $(am_fstprint_OBJECTS) +fstprint_LDADD = $(LDADD) +fstprint_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstproject_SOURCES_DIST = fstproject.cc fstproject-main.cc +@HAVE_BIN_TRUE@am_fstproject_OBJECTS = fstproject.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstproject-main.$(OBJEXT) +fstproject_OBJECTS = $(am_fstproject_OBJECTS) +fstproject_LDADD = $(LDADD) +fstproject_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstprune_SOURCES_DIST = fstprune.cc fstprune-main.cc +@HAVE_BIN_TRUE@am_fstprune_OBJECTS = fstprune.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstprune-main.$(OBJEXT) +fstprune_OBJECTS = $(am_fstprune_OBJECTS) +fstprune_LDADD = $(LDADD) +fstprune_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstpush_SOURCES_DIST = fstpush.cc fstpush-main.cc +@HAVE_BIN_TRUE@am_fstpush_OBJECTS = fstpush.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstpush-main.$(OBJEXT) +fstpush_OBJECTS = $(am_fstpush_OBJECTS) +fstpush_LDADD = $(LDADD) +fstpush_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstrandgen_SOURCES_DIST = fstrandgen.cc fstrandgen-main.cc +@HAVE_BIN_TRUE@am_fstrandgen_OBJECTS = fstrandgen.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstrandgen-main.$(OBJEXT) +fstrandgen_OBJECTS = $(am_fstrandgen_OBJECTS) +fstrandgen_LDADD = $(LDADD) +fstrandgen_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstrelabel_SOURCES_DIST = fstrelabel.cc fstrelabel-main.cc +@HAVE_BIN_TRUE@am_fstrelabel_OBJECTS = fstrelabel.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstrelabel-main.$(OBJEXT) +fstrelabel_OBJECTS = $(am_fstrelabel_OBJECTS) +fstrelabel_LDADD = $(LDADD) +fstrelabel_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstreplace_SOURCES_DIST = fstreplace.cc fstreplace-main.cc +@HAVE_BIN_TRUE@am_fstreplace_OBJECTS = fstreplace.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstreplace-main.$(OBJEXT) +fstreplace_OBJECTS = $(am_fstreplace_OBJECTS) +fstreplace_LDADD = $(LDADD) +fstreplace_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstreverse_SOURCES_DIST = fstreverse.cc fstreverse-main.cc +@HAVE_BIN_TRUE@am_fstreverse_OBJECTS = fstreverse.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstreverse-main.$(OBJEXT) +fstreverse_OBJECTS = $(am_fstreverse_OBJECTS) +fstreverse_LDADD = $(LDADD) +fstreverse_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstreweight_SOURCES_DIST = fstreweight.cc fstreweight-main.cc +@HAVE_BIN_TRUE@am_fstreweight_OBJECTS = fstreweight.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstreweight-main.$(OBJEXT) +fstreweight_OBJECTS = $(am_fstreweight_OBJECTS) +fstreweight_LDADD = $(LDADD) +fstreweight_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstrmepsilon_SOURCES_DIST = fstrmepsilon.cc fstrmepsilon-main.cc +@HAVE_BIN_TRUE@am_fstrmepsilon_OBJECTS = fstrmepsilon.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstrmepsilon-main.$(OBJEXT) +fstrmepsilon_OBJECTS = $(am_fstrmepsilon_OBJECTS) +fstrmepsilon_LDADD = $(LDADD) +fstrmepsilon_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstshortestdistance_SOURCES_DIST = fstshortestdistance.cc \ + fstshortestdistance-main.cc +@HAVE_BIN_TRUE@am_fstshortestdistance_OBJECTS = \ +@HAVE_BIN_TRUE@ fstshortestdistance.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstshortestdistance-main.$(OBJEXT) +fstshortestdistance_OBJECTS = $(am_fstshortestdistance_OBJECTS) +fstshortestdistance_LDADD = $(LDADD) +fstshortestdistance_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstshortestpath_SOURCES_DIST = fstshortestpath.cc \ + fstshortestpath-main.cc +@HAVE_BIN_TRUE@am_fstshortestpath_OBJECTS = fstshortestpath.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstshortestpath-main.$(OBJEXT) +fstshortestpath_OBJECTS = $(am_fstshortestpath_OBJECTS) +fstshortestpath_LDADD = $(LDADD) +fstshortestpath_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstsymbols_SOURCES_DIST = fstsymbols.cc fstsymbols-main.cc +@HAVE_BIN_TRUE@am_fstsymbols_OBJECTS = fstsymbols.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstsymbols-main.$(OBJEXT) +fstsymbols_OBJECTS = $(am_fstsymbols_OBJECTS) +fstsymbols_LDADD = $(LDADD) +fstsymbols_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstsynchronize_SOURCES_DIST = fstsynchronize.cc \ + fstsynchronize-main.cc +@HAVE_BIN_TRUE@am_fstsynchronize_OBJECTS = fstsynchronize.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstsynchronize-main.$(OBJEXT) +fstsynchronize_OBJECTS = $(am_fstsynchronize_OBJECTS) +fstsynchronize_LDADD = $(LDADD) +fstsynchronize_DEPENDENCIES = ../script/libfstscript.la \ + ../lib/libfst.la $(am__DEPENDENCIES_1) +am__fsttopsort_SOURCES_DIST = fsttopsort.cc fsttopsort-main.cc +@HAVE_BIN_TRUE@am_fsttopsort_OBJECTS = fsttopsort.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fsttopsort-main.$(OBJEXT) +fsttopsort_OBJECTS = $(am_fsttopsort_OBJECTS) +fsttopsort_LDADD = $(LDADD) +fsttopsort_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am__fstunion_SOURCES_DIST = fstunion.cc fstunion-main.cc +@HAVE_BIN_TRUE@am_fstunion_OBJECTS = fstunion.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstunion-main.$(OBJEXT) +fstunion_OBJECTS = $(am_fstunion_OBJECTS) +fstunion_LDADD = $(LDADD) +fstunion_DEPENDENCIES = ../script/libfstscript.la ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(fstarcsort_SOURCES) $(fstclosure_SOURCES) \ + $(fstcompile_SOURCES) $(fstcompose_SOURCES) \ + $(fstconcat_SOURCES) $(fstconnect_SOURCES) \ + $(fstconvert_SOURCES) $(fstdeterminize_SOURCES) \ + $(fstdifference_SOURCES) $(fstdisambiguate_SOURCES) \ + $(fstdraw_SOURCES) $(fstencode_SOURCES) \ + $(fstepsnormalize_SOURCES) $(fstequal_SOURCES) \ + $(fstequivalent_SOURCES) $(fstinfo_SOURCES) \ + $(fstintersect_SOURCES) $(fstinvert_SOURCES) \ + $(fstisomorphic_SOURCES) $(fstmap_SOURCES) \ + $(fstminimize_SOURCES) $(fstprint_SOURCES) \ + $(fstproject_SOURCES) $(fstprune_SOURCES) $(fstpush_SOURCES) \ + $(fstrandgen_SOURCES) $(fstrelabel_SOURCES) \ + $(fstreplace_SOURCES) $(fstreverse_SOURCES) \ + $(fstreweight_SOURCES) $(fstrmepsilon_SOURCES) \ + $(fstshortestdistance_SOURCES) $(fstshortestpath_SOURCES) \ + $(fstsymbols_SOURCES) $(fstsynchronize_SOURCES) \ + $(fsttopsort_SOURCES) $(fstunion_SOURCES) +DIST_SOURCES = $(am__fstarcsort_SOURCES_DIST) \ + $(am__fstclosure_SOURCES_DIST) $(am__fstcompile_SOURCES_DIST) \ + $(am__fstcompose_SOURCES_DIST) $(am__fstconcat_SOURCES_DIST) \ + $(am__fstconnect_SOURCES_DIST) $(am__fstconvert_SOURCES_DIST) \ + $(am__fstdeterminize_SOURCES_DIST) \ + $(am__fstdifference_SOURCES_DIST) \ + $(am__fstdisambiguate_SOURCES_DIST) \ + $(am__fstdraw_SOURCES_DIST) $(am__fstencode_SOURCES_DIST) \ + $(am__fstepsnormalize_SOURCES_DIST) \ + $(am__fstequal_SOURCES_DIST) $(am__fstequivalent_SOURCES_DIST) \ + $(am__fstinfo_SOURCES_DIST) $(am__fstintersect_SOURCES_DIST) \ + $(am__fstinvert_SOURCES_DIST) \ + $(am__fstisomorphic_SOURCES_DIST) $(am__fstmap_SOURCES_DIST) \ + $(am__fstminimize_SOURCES_DIST) $(am__fstprint_SOURCES_DIST) \ + $(am__fstproject_SOURCES_DIST) $(am__fstprune_SOURCES_DIST) \ + $(am__fstpush_SOURCES_DIST) $(am__fstrandgen_SOURCES_DIST) \ + $(am__fstrelabel_SOURCES_DIST) $(am__fstreplace_SOURCES_DIST) \ + $(am__fstreverse_SOURCES_DIST) $(am__fstreweight_SOURCES_DIST) \ + $(am__fstrmepsilon_SOURCES_DIST) \ + $(am__fstshortestdistance_SOURCES_DIST) \ + $(am__fstshortestpath_SOURCES_DIST) \ + $(am__fstsymbols_SOURCES_DIST) \ + $(am__fstsynchronize_SOURCES_DIST) \ + $(am__fsttopsort_SOURCES_DIST) $(am__fstunion_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../script $(ICU_FLAGS) +LDADD = ../script/libfstscript.la ../lib/libfst.la -lm $(DL_LIBS) +@HAVE_BIN_TRUE@fstarcsort_SOURCES = fstarcsort.cc fstarcsort-main.cc +@HAVE_BIN_TRUE@fstclosure_SOURCES = fstclosure.cc fstclosure-main.cc +@HAVE_BIN_TRUE@fstcompile_SOURCES = fstcompile.cc fstcompile-main.cc +@HAVE_BIN_TRUE@fstcompose_SOURCES = fstcompose.cc fstcompose-main.cc +@HAVE_BIN_TRUE@fstconcat_SOURCES = fstconcat.cc fstconcat-main.cc +@HAVE_BIN_TRUE@fstconnect_SOURCES = fstconnect.cc fstconnect-main.cc +@HAVE_BIN_TRUE@fstconvert_SOURCES = fstconvert.cc fstconvert-main.cc +@HAVE_BIN_TRUE@fstdeterminize_SOURCES = fstdeterminize.cc fstdeterminize-main.cc +@HAVE_BIN_TRUE@fstdifference_SOURCES = fstdifference.cc fstdifference-main.cc +@HAVE_BIN_TRUE@fstdisambiguate_SOURCES = fstdisambiguate.cc fstdisambiguate-main.cc +@HAVE_BIN_TRUE@fstdraw_SOURCES = fstdraw.cc fstdraw-main.cc +@HAVE_BIN_TRUE@fstencode_SOURCES = fstencode.cc fstencode-main.cc +@HAVE_BIN_TRUE@fstepsnormalize_SOURCES = fstepsnormalize.cc fstepsnormalize-main.cc +@HAVE_BIN_TRUE@fstequal_SOURCES = fstequal.cc fstequal-main.cc +@HAVE_BIN_TRUE@fstequivalent_SOURCES = fstequivalent.cc fstequivalent-main.cc +@HAVE_BIN_TRUE@fstinfo_SOURCES = fstinfo.cc fstinfo-main.cc +@HAVE_BIN_TRUE@fstintersect_SOURCES = fstintersect.cc fstintersect-main.cc +@HAVE_BIN_TRUE@fstinvert_SOURCES = fstinvert.cc fstinvert-main.cc +@HAVE_BIN_TRUE@fstisomorphic_SOURCES = fstisomorphic.cc fstisomorphic-main.cc +@HAVE_BIN_TRUE@fstmap_SOURCES = fstmap.cc fstmap-main.cc +@HAVE_BIN_TRUE@fstminimize_SOURCES = fstminimize.cc fstminimize-main.cc +@HAVE_BIN_TRUE@fstprint_SOURCES = fstprint.cc fstprint-main.cc +@HAVE_BIN_TRUE@fstproject_SOURCES = fstproject.cc fstproject-main.cc +@HAVE_BIN_TRUE@fstprune_SOURCES = fstprune.cc fstprune-main.cc +@HAVE_BIN_TRUE@fstpush_SOURCES = fstpush.cc fstpush-main.cc +@HAVE_BIN_TRUE@fstrandgen_SOURCES = fstrandgen.cc fstrandgen-main.cc +@HAVE_BIN_TRUE@fstrelabel_SOURCES = fstrelabel.cc fstrelabel-main.cc +@HAVE_BIN_TRUE@fstreplace_SOURCES = fstreplace.cc fstreplace-main.cc +@HAVE_BIN_TRUE@fstreverse_SOURCES = fstreverse.cc fstreverse-main.cc +@HAVE_BIN_TRUE@fstreweight_SOURCES = fstreweight.cc fstreweight-main.cc +@HAVE_BIN_TRUE@fstrmepsilon_SOURCES = fstrmepsilon.cc fstrmepsilon-main.cc +@HAVE_BIN_TRUE@fstshortestdistance_SOURCES = fstshortestdistance.cc fstshortestdistance-main.cc +@HAVE_BIN_TRUE@fstshortestpath_SOURCES = fstshortestpath.cc fstshortestpath-main.cc +@HAVE_BIN_TRUE@fstsymbols_SOURCES = fstsymbols.cc fstsymbols-main.cc +@HAVE_BIN_TRUE@fstsynchronize_SOURCES = fstsynchronize.cc fstsynchronize-main.cc +@HAVE_BIN_TRUE@fsttopsort_SOURCES = fsttopsort.cc fsttopsort-main.cc +@HAVE_BIN_TRUE@fstunion_SOURCES = fstunion.cc fstunion-main.cc +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/bin/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/bin/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +fstarcsort$(EXEEXT): $(fstarcsort_OBJECTS) $(fstarcsort_DEPENDENCIES) $(EXTRA_fstarcsort_DEPENDENCIES) + @rm -f fstarcsort$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstarcsort_OBJECTS) $(fstarcsort_LDADD) $(LIBS) + +fstclosure$(EXEEXT): $(fstclosure_OBJECTS) $(fstclosure_DEPENDENCIES) $(EXTRA_fstclosure_DEPENDENCIES) + @rm -f fstclosure$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstclosure_OBJECTS) $(fstclosure_LDADD) $(LIBS) + +fstcompile$(EXEEXT): $(fstcompile_OBJECTS) $(fstcompile_DEPENDENCIES) $(EXTRA_fstcompile_DEPENDENCIES) + @rm -f fstcompile$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstcompile_OBJECTS) $(fstcompile_LDADD) $(LIBS) + +fstcompose$(EXEEXT): $(fstcompose_OBJECTS) $(fstcompose_DEPENDENCIES) $(EXTRA_fstcompose_DEPENDENCIES) + @rm -f fstcompose$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstcompose_OBJECTS) $(fstcompose_LDADD) $(LIBS) + +fstconcat$(EXEEXT): $(fstconcat_OBJECTS) $(fstconcat_DEPENDENCIES) $(EXTRA_fstconcat_DEPENDENCIES) + @rm -f fstconcat$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstconcat_OBJECTS) $(fstconcat_LDADD) $(LIBS) + +fstconnect$(EXEEXT): $(fstconnect_OBJECTS) $(fstconnect_DEPENDENCIES) $(EXTRA_fstconnect_DEPENDENCIES) + @rm -f fstconnect$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstconnect_OBJECTS) $(fstconnect_LDADD) $(LIBS) + +fstconvert$(EXEEXT): $(fstconvert_OBJECTS) $(fstconvert_DEPENDENCIES) $(EXTRA_fstconvert_DEPENDENCIES) + @rm -f fstconvert$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstconvert_OBJECTS) $(fstconvert_LDADD) $(LIBS) + +fstdeterminize$(EXEEXT): $(fstdeterminize_OBJECTS) $(fstdeterminize_DEPENDENCIES) $(EXTRA_fstdeterminize_DEPENDENCIES) + @rm -f fstdeterminize$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstdeterminize_OBJECTS) $(fstdeterminize_LDADD) $(LIBS) + +fstdifference$(EXEEXT): $(fstdifference_OBJECTS) $(fstdifference_DEPENDENCIES) $(EXTRA_fstdifference_DEPENDENCIES) + @rm -f fstdifference$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstdifference_OBJECTS) $(fstdifference_LDADD) $(LIBS) + +fstdisambiguate$(EXEEXT): $(fstdisambiguate_OBJECTS) $(fstdisambiguate_DEPENDENCIES) $(EXTRA_fstdisambiguate_DEPENDENCIES) + @rm -f fstdisambiguate$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstdisambiguate_OBJECTS) $(fstdisambiguate_LDADD) $(LIBS) + +fstdraw$(EXEEXT): $(fstdraw_OBJECTS) $(fstdraw_DEPENDENCIES) $(EXTRA_fstdraw_DEPENDENCIES) + @rm -f fstdraw$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstdraw_OBJECTS) $(fstdraw_LDADD) $(LIBS) + +fstencode$(EXEEXT): $(fstencode_OBJECTS) $(fstencode_DEPENDENCIES) $(EXTRA_fstencode_DEPENDENCIES) + @rm -f fstencode$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstencode_OBJECTS) $(fstencode_LDADD) $(LIBS) + +fstepsnormalize$(EXEEXT): $(fstepsnormalize_OBJECTS) $(fstepsnormalize_DEPENDENCIES) $(EXTRA_fstepsnormalize_DEPENDENCIES) + @rm -f fstepsnormalize$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstepsnormalize_OBJECTS) $(fstepsnormalize_LDADD) $(LIBS) + +fstequal$(EXEEXT): $(fstequal_OBJECTS) $(fstequal_DEPENDENCIES) $(EXTRA_fstequal_DEPENDENCIES) + @rm -f fstequal$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstequal_OBJECTS) $(fstequal_LDADD) $(LIBS) + +fstequivalent$(EXEEXT): $(fstequivalent_OBJECTS) $(fstequivalent_DEPENDENCIES) $(EXTRA_fstequivalent_DEPENDENCIES) + @rm -f fstequivalent$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstequivalent_OBJECTS) $(fstequivalent_LDADD) $(LIBS) + +fstinfo$(EXEEXT): $(fstinfo_OBJECTS) $(fstinfo_DEPENDENCIES) $(EXTRA_fstinfo_DEPENDENCIES) + @rm -f fstinfo$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstinfo_OBJECTS) $(fstinfo_LDADD) $(LIBS) + +fstintersect$(EXEEXT): $(fstintersect_OBJECTS) $(fstintersect_DEPENDENCIES) $(EXTRA_fstintersect_DEPENDENCIES) + @rm -f fstintersect$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstintersect_OBJECTS) $(fstintersect_LDADD) $(LIBS) + +fstinvert$(EXEEXT): $(fstinvert_OBJECTS) $(fstinvert_DEPENDENCIES) $(EXTRA_fstinvert_DEPENDENCIES) + @rm -f fstinvert$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstinvert_OBJECTS) $(fstinvert_LDADD) $(LIBS) + +fstisomorphic$(EXEEXT): $(fstisomorphic_OBJECTS) $(fstisomorphic_DEPENDENCIES) $(EXTRA_fstisomorphic_DEPENDENCIES) + @rm -f fstisomorphic$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstisomorphic_OBJECTS) $(fstisomorphic_LDADD) $(LIBS) + +fstmap$(EXEEXT): $(fstmap_OBJECTS) $(fstmap_DEPENDENCIES) $(EXTRA_fstmap_DEPENDENCIES) + @rm -f fstmap$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstmap_OBJECTS) $(fstmap_LDADD) $(LIBS) + +fstminimize$(EXEEXT): $(fstminimize_OBJECTS) $(fstminimize_DEPENDENCIES) $(EXTRA_fstminimize_DEPENDENCIES) + @rm -f fstminimize$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstminimize_OBJECTS) $(fstminimize_LDADD) $(LIBS) + +fstprint$(EXEEXT): $(fstprint_OBJECTS) $(fstprint_DEPENDENCIES) $(EXTRA_fstprint_DEPENDENCIES) + @rm -f fstprint$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstprint_OBJECTS) $(fstprint_LDADD) $(LIBS) + +fstproject$(EXEEXT): $(fstproject_OBJECTS) $(fstproject_DEPENDENCIES) $(EXTRA_fstproject_DEPENDENCIES) + @rm -f fstproject$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstproject_OBJECTS) $(fstproject_LDADD) $(LIBS) + +fstprune$(EXEEXT): $(fstprune_OBJECTS) $(fstprune_DEPENDENCIES) $(EXTRA_fstprune_DEPENDENCIES) + @rm -f fstprune$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstprune_OBJECTS) $(fstprune_LDADD) $(LIBS) + +fstpush$(EXEEXT): $(fstpush_OBJECTS) $(fstpush_DEPENDENCIES) $(EXTRA_fstpush_DEPENDENCIES) + @rm -f fstpush$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstpush_OBJECTS) $(fstpush_LDADD) $(LIBS) + +fstrandgen$(EXEEXT): $(fstrandgen_OBJECTS) $(fstrandgen_DEPENDENCIES) $(EXTRA_fstrandgen_DEPENDENCIES) + @rm -f fstrandgen$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstrandgen_OBJECTS) $(fstrandgen_LDADD) $(LIBS) + +fstrelabel$(EXEEXT): $(fstrelabel_OBJECTS) $(fstrelabel_DEPENDENCIES) $(EXTRA_fstrelabel_DEPENDENCIES) + @rm -f fstrelabel$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstrelabel_OBJECTS) $(fstrelabel_LDADD) $(LIBS) + +fstreplace$(EXEEXT): $(fstreplace_OBJECTS) $(fstreplace_DEPENDENCIES) $(EXTRA_fstreplace_DEPENDENCIES) + @rm -f fstreplace$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstreplace_OBJECTS) $(fstreplace_LDADD) $(LIBS) + +fstreverse$(EXEEXT): $(fstreverse_OBJECTS) $(fstreverse_DEPENDENCIES) $(EXTRA_fstreverse_DEPENDENCIES) + @rm -f fstreverse$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstreverse_OBJECTS) $(fstreverse_LDADD) $(LIBS) + +fstreweight$(EXEEXT): $(fstreweight_OBJECTS) $(fstreweight_DEPENDENCIES) $(EXTRA_fstreweight_DEPENDENCIES) + @rm -f fstreweight$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstreweight_OBJECTS) $(fstreweight_LDADD) $(LIBS) + +fstrmepsilon$(EXEEXT): $(fstrmepsilon_OBJECTS) $(fstrmepsilon_DEPENDENCIES) $(EXTRA_fstrmepsilon_DEPENDENCIES) + @rm -f fstrmepsilon$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstrmepsilon_OBJECTS) $(fstrmepsilon_LDADD) $(LIBS) + +fstshortestdistance$(EXEEXT): $(fstshortestdistance_OBJECTS) $(fstshortestdistance_DEPENDENCIES) $(EXTRA_fstshortestdistance_DEPENDENCIES) + @rm -f fstshortestdistance$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstshortestdistance_OBJECTS) $(fstshortestdistance_LDADD) $(LIBS) + +fstshortestpath$(EXEEXT): $(fstshortestpath_OBJECTS) $(fstshortestpath_DEPENDENCIES) $(EXTRA_fstshortestpath_DEPENDENCIES) + @rm -f fstshortestpath$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstshortestpath_OBJECTS) $(fstshortestpath_LDADD) $(LIBS) + +fstsymbols$(EXEEXT): $(fstsymbols_OBJECTS) $(fstsymbols_DEPENDENCIES) $(EXTRA_fstsymbols_DEPENDENCIES) + @rm -f fstsymbols$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstsymbols_OBJECTS) $(fstsymbols_LDADD) $(LIBS) + +fstsynchronize$(EXEEXT): $(fstsynchronize_OBJECTS) $(fstsynchronize_DEPENDENCIES) $(EXTRA_fstsynchronize_DEPENDENCIES) + @rm -f fstsynchronize$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstsynchronize_OBJECTS) $(fstsynchronize_LDADD) $(LIBS) + +fsttopsort$(EXEEXT): $(fsttopsort_OBJECTS) $(fsttopsort_DEPENDENCIES) $(EXTRA_fsttopsort_DEPENDENCIES) + @rm -f fsttopsort$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fsttopsort_OBJECTS) $(fsttopsort_LDADD) $(LIBS) + +fstunion$(EXEEXT): $(fstunion_OBJECTS) $(fstunion_DEPENDENCIES) $(EXTRA_fstunion_DEPENDENCIES) + @rm -f fstunion$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstunion_OBJECTS) $(fstunion_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstarcsort-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstarcsort.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstclosure-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstclosure.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstcompile-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstcompile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstcompose-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstcompose.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstconcat-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstconcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstconnect-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstconnect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstconvert-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstconvert.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdeterminize-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdeterminize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdifference-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdifference.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdisambiguate-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdisambiguate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdraw-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstdraw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstencode-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstencode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstepsnormalize-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstepsnormalize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstequal-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstequal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstequivalent-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstequivalent.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstinfo-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstintersect-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstintersect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstinvert-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstinvert.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstisomorphic-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstisomorphic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstmap-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstminimize-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstminimize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstprint-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstprint.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstproject-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstproject.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstprune-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstprune.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstpush-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstpush.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstrandgen-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstrandgen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstrelabel-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstrelabel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstreplace-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstreplace.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstreverse-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstreverse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstreweight-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstreweight.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstrmepsilon-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstrmepsilon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstshortestdistance-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstshortestdistance.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstshortestpath-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstshortestpath.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstsymbols-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstsymbols.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstsynchronize-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstsynchronize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsttopsort-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsttopsort.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstunion-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstunion.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/bin.vcxproj b/runtime/onnxruntime/third_party/openfst/src/bin/bin.vcxproj new file mode 100644 index 0000000..c235567 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/bin.vcxproj @@ -0,0 +1,27 @@ + + + + {84657A19-CAF2-49E8-8DB3-A428C19F460D} + Application + true + + + + + + + + + + {de80efec-9ed9-4631-bd96-8568c31ed26d} + + + {111f46ed-da1f-469b-b912-ba2acc2ff8e6} + + + + + + diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstarcsort-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstarcsort-main.cc new file mode 100644 index 0000000..b1a67ca --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstarcsort-main.cc @@ -0,0 +1,51 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Sorts arcs of an FST. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_string(sort_type); + +int fstarcsort_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + + string usage = "Sorts arcs of an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + s::ArcSortType sort_type; + if (!s::GetArcSortType(FLAGS_sort_type, &sort_type)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported sort type: " + << FLAGS_sort_type; + return 1; + } + + s::ArcSort(fst.get(), sort_type); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstarcsort.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstarcsort.cc new file mode 100644 index 0000000..9d7cf2e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstarcsort.cc @@ -0,0 +1,12 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +DEFINE_string(sort_type, "ilabel", + "Comparison method, one of: \"ilabel\", \"olabel\""); + +int fstarcsort_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstarcsort_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstclosure-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstclosure-main.cc new file mode 100644 index 0000000..4743a0b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstclosure-main.cc @@ -0,0 +1,41 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Creates the Kleene closure of an FST. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_bool(closure_plus); + +int fstclosure_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + + string usage = "Creates the Kleene closure of an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + s::Closure(fst.get(), s::GetClosureType(FLAGS_closure_plus)); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstclosure.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstclosure.cc new file mode 100644 index 0000000..fb3c22f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstclosure.cc @@ -0,0 +1,11 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(closure_plus, false, + "Do not add the empty path (T+ instead of T*)?"); + +int fstclosure_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstclosure_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstcompile-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompile-main.cc new file mode 100644 index 0000000..99c5009 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompile-main.cc @@ -0,0 +1,84 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Creates binary FSTs from simple text format used by AT&T. + +#include + +#include +#include +#include +#include + +#include +#include +#include + +DECLARE_bool(acceptor); +DECLARE_string(arc_type); +DECLARE_string(fst_type); +DECLARE_string(isymbols); +DECLARE_string(osymbols); +DECLARE_string(ssymbols); +DECLARE_bool(keep_isymbols); +DECLARE_bool(keep_osymbols); +DECLARE_bool(keep_state_numbering); +DECLARE_bool(allow_negative_labels); + +int fstcompile_main(int argc, char **argv) { + namespace s = fst::script; + using fst::SymbolTable; + using fst::SymbolTableTextOptions; + + string usage = "Creates binary FSTs from simple text format.\n\n Usage: "; + usage += argv[0]; + usage += " [text.fst [binary.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + string source = "standard input"; + std::ifstream fstrm; + if (argc > 1 && strcmp(argv[1], "-") != 0) { + fstrm.open(argv[1]); + if (!fstrm) { + LOG(ERROR) << argv[0] << ": Open failed, file = " << argv[1]; + return 1; + } + source = argv[1]; + } + std::istream &istrm = fstrm.is_open() ? fstrm : std::cin; + + const SymbolTableTextOptions opts(FLAGS_allow_negative_labels); + + std::unique_ptr isyms; + if (!FLAGS_isymbols.empty()) { + isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts)); + if (!isyms) return 1; + } + + std::unique_ptr osyms; + if (!FLAGS_osymbols.empty()) { + osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts)); + if (!osyms) return 1; + } + + std::unique_ptr ssyms; + if (!FLAGS_ssymbols.empty()) { + ssyms.reset(SymbolTable::ReadText(FLAGS_ssymbols)); + if (!ssyms) return 1; + } + + const string dest = argc > 2 ? argv[2] : ""; + + s::CompileFst(istrm, source, dest, FLAGS_fst_type, FLAGS_arc_type, + isyms.get(), osyms.get(), ssyms.get(), FLAGS_acceptor, + FLAGS_keep_isymbols, FLAGS_keep_osymbols, + FLAGS_keep_state_numbering, FLAGS_allow_negative_labels); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstcompile.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompile.cc new file mode 100644 index 0000000..9b758b6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompile.cc @@ -0,0 +1,20 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(acceptor, false, "Input in acceptor format"); +DEFINE_string(arc_type, "standard", "Output arc type"); +DEFINE_string(fst_type, "vector", "Output FST type"); +DEFINE_string(isymbols, "", "Input label symbol table"); +DEFINE_string(osymbols, "", "Output label symbol table"); +DEFINE_string(ssymbols, "", "State label symbol table"); +DEFINE_bool(keep_isymbols, false, "Store input label symbol table with FST"); +DEFINE_bool(keep_osymbols, false, "Store output label symbol table with FST"); +DEFINE_bool(keep_state_numbering, false, "Do not renumber input states"); +DEFINE_bool(allow_negative_labels, false, + "Allow negative labels (not recommended; may cause conflicts)"); + +int fstcompile_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstcompile_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstcompose-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompose-main.cc new file mode 100644 index 0000000..df5afd7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompose-main.cc @@ -0,0 +1,72 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Composes two FSTs. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_string(compose_filter); +DECLARE_bool(connect); + +int fstcompose_main(int argc, char **argv) { + namespace s = fst::script; + using fst::ComposeFilter; + using fst::ComposeOptions; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Composes two FSTs.\n\n Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") != 0 ? argv[1] : ""; + const string in2_name = + (argc > 2 && (strcmp(argv[2], "-") != 0)) ? argv[2] : ""; + const string out_name = argc > 3 ? argv[3] : ""; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + if (ifst1->ArcType() != ifst2->ArcType()) { + LOG(ERROR) << argv[0] << ": Input FSTs must have the same arc type"; + return 1; + } + + VectorFstClass ofst(ifst1->ArcType()); + + ComposeFilter compose_filter; + if (!s::GetComposeFilter(FLAGS_compose_filter, &compose_filter)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: " + << FLAGS_compose_filter; + return 1; + } + + const ComposeOptions opts(FLAGS_connect, compose_filter); + + s::Compose(*ifst1, *ifst2, &ofst, opts); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstcompose.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompose.cc new file mode 100644 index 0000000..297a6e1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstcompose.cc @@ -0,0 +1,13 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(compose_filter, "auto", + "Composition filter, one of: \"alt_sequence\", \"auto\", " + "\"match\", \"no_match\", \"null\", \"sequence\", \"trivial\""); +DEFINE_bool(connect, true, "Trim output"); + +int fstcompose_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstcompose_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstconcat-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstconcat-main.cc new file mode 100644 index 0000000..07609ec --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstconcat-main.cc @@ -0,0 +1,49 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Concatenates two FSTs. + +#include + +#include +#include + +#include +#include +#include + +int fstconcat_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::MutableFstClass; + + string usage = "Concatenates two FSTs.\n\n Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + const string out_name = argc > 3 ? argv[3] : ""; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr fst1(MutableFstClass::Read(in1_name, true)); + if (!fst1) return 1; + + std::unique_ptr fst2(FstClass::Read(in2_name)); + if (!fst2) return 1; + + s::Concat(fst1.get(), *fst2); + + return !fst1->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstconcat.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstconcat.cc new file mode 100644 index 0000000..68ce58c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstconcat.cc @@ -0,0 +1,6 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +int fstconcat_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstconcat_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstconnect-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstconnect-main.cc new file mode 100644 index 0000000..6de987d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstconnect-main.cc @@ -0,0 +1,40 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Removes useless (inaccessible or non-coaccessible) states and arcs from an +// FST. + +#include + +#include +#include + +#include +#include + +int fstconnect_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::MutableFstClass; + + string usage = "Removes useless states and arcs from an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + s::Connect(fst.get()); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstconnect.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstconnect.cc new file mode 100644 index 0000000..c31a357 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstconnect.cc @@ -0,0 +1,6 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +int fstconnect_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstconnect_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstconvert-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstconvert-main.cc new file mode 100644 index 0000000..60dc7ab --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstconvert-main.cc @@ -0,0 +1,44 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Converts an FST to another type. + +#include + +#include +#include + +#include +#include + +DECLARE_string(fst_type); + +int fstconvert_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + + string usage = "Converts an FST to another type.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (ifst->FstType() != FLAGS_fst_type) { + std::unique_ptr ofst(s::Convert(*ifst, FLAGS_fst_type)); + if (!ofst) return 1; + return !ofst->Write(out_name); + } else { + return !ifst->Write(out_name); + } +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstconvert.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstconvert.cc new file mode 100644 index 0000000..331977a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstconvert.cc @@ -0,0 +1,10 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(fst_type, "vector", "Output FST type"); + +int fstconvert_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstconvert_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdeterminize-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdeterminize-main.cc new file mode 100644 index 0000000..53e3e1d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdeterminize-main.cc @@ -0,0 +1,66 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Determinizes an FST. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_double(delta); +DECLARE_string(weight); +DECLARE_int64(nstate); +DECLARE_int64(subsequential_label); +DECLARE_string(det_type); +DECLARE_bool(increment_subsequential_label); + +int fstdeterminize_main(int argc, char **argv) { + namespace s = fst::script; + using fst::DeterminizeType; + using fst::script::FstClass; + using fst::script::VectorFstClass; + using fst::script::WeightClass; + + string usage = "Determinizes an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + DeterminizeType det_type; + if (!s::GetDeterminizeType(FLAGS_det_type, &det_type)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported determinization type: " + << FLAGS_det_type; + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + const auto weight_threshold = + FLAGS_weight.empty() ? WeightClass::Zero(ifst->WeightType()) + : WeightClass(ifst->WeightType(), FLAGS_weight); + + const s::DeterminizeOptions opts(FLAGS_delta, weight_threshold, FLAGS_nstate, + FLAGS_subsequential_label, det_type, + FLAGS_increment_subsequential_label); + + s::Determinize(*ifst, &ofst, opts); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdeterminize.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdeterminize.cc new file mode 100644 index 0000000..613522b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdeterminize.cc @@ -0,0 +1,23 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); +DEFINE_string(weight, "", "Weight threshold"); +DEFINE_int64(nstate, fst::kNoStateId, "State number threshold"); +DEFINE_int64(subsequential_label, 0, + "Input label of arc corresponding to residual final output when" + " producing a subsequential transducer"); +DEFINE_string(det_type, "functional", + "Type of determinization: \"functional\", " + "\"nonfunctional\", \"disambiguate\""); +DEFINE_bool(increment_subsequential_label, false, + "Increment subsequential_label to obtain distinct labels for " + " subsequential arcs at a given state"); + +int fstdeterminize_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstdeterminize_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdifference-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdifference-main.cc new file mode 100644 index 0000000..d31fb9e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdifference-main.cc @@ -0,0 +1,66 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Subtracts an unweighted DFA from an FSA. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_string(compose_filter); +DECLARE_bool(connect); + +int fstdifference_main(int argc, char **argv) { + namespace s = fst::script; + using fst::ComposeFilter; + using fst::DifferenceOptions; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Subtracts an unweighted DFA from an FSA.\n\n Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + const string out_name = argc > 3 ? argv[3] : ""; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + VectorFstClass ofst(ifst1->ArcType()); + + ComposeFilter compose_filter; + if (!s::GetComposeFilter(FLAGS_compose_filter, &compose_filter)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: " + << FLAGS_compose_filter; + return 1; + } + + const DifferenceOptions opts(FLAGS_connect, compose_filter); + + s::Difference(*ifst1, *ifst2, &ofst, opts); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdifference.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdifference.cc new file mode 100644 index 0000000..2086bbf --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdifference.cc @@ -0,0 +1,13 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(compose_filter, "auto", + "Composition filter, one of: \"alt_sequence\", \"auto\", " + "\"match\", \"null\", \"sequence\", \"trivial\""); +DEFINE_bool(connect, true, "Trim output"); + +int fstdifference_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstdifference_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdisambiguate-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdisambiguate-main.cc new file mode 100644 index 0000000..b906af3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdisambiguate-main.cc @@ -0,0 +1,54 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Disambiguates an FST. + +#include + +#include +#include + +#include +#include + +DECLARE_double(delta); +DECLARE_int64(nstate); +DECLARE_string(weight); +DECLARE_int64(subsequential_label); + +int fstdisambiguate_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + using fst::script::WeightClass; + + string usage = "Disambiguates an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + const auto weight_threshold = + FLAGS_weight.empty() ? WeightClass::Zero(ifst->WeightType()) + : WeightClass(ifst->WeightType(), FLAGS_weight); + + const s::DisambiguateOptions opts(FLAGS_delta, weight_threshold, FLAGS_nstate, + FLAGS_subsequential_label); + + s::Disambiguate(*ifst, &ofst, opts); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdisambiguate.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdisambiguate.cc new file mode 100644 index 0000000..9aa13f3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdisambiguate.cc @@ -0,0 +1,17 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); +DEFINE_int64(nstate, fst::kNoStateId, "State number threshold"); +DEFINE_string(weight, "", "Weight threshold"); +DEFINE_int64(subsequential_label, 0, + "Input label of arc corresponding to residual final output when" + " producing a subsequential transducer"); + +int fstdisambiguate_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstdisambiguate_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdraw-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdraw-main.cc new file mode 100644 index 0000000..d28299e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdraw-main.cc @@ -0,0 +1,104 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Draws a binary FSTs in the Graphviz dot text format. + +#include + +#include +#include +#include +#include + +#include +#include +#include + +DECLARE_bool(acceptor); +DECLARE_string(isymbols); +DECLARE_string(osymbols); +DECLARE_string(ssymbols); +DECLARE_bool(numeric); +DECLARE_int32(precision); +DECLARE_string(float_format); +DECLARE_bool(show_weight_one); +DECLARE_string(title); +DECLARE_bool(portrait); +DECLARE_bool(vertical); +DECLARE_int32(fontsize); +DECLARE_double(height); +DECLARE_double(width); +DECLARE_double(nodesep); +DECLARE_double(ranksep); +DECLARE_bool(allow_negative_labels); + +int fstdraw_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::SymbolTable; + using fst::SymbolTableTextOptions; + + string usage = "Prints out binary FSTs in dot text format.\n\n Usage: "; + usage += argv[0]; + usage += " [binary.fst [text.dot]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + + std::unique_ptr fst(FstClass::Read(in_name)); + if (!fst) return 1; + + string dest = "stdout"; + std::ofstream fstrm; + if (argc == 3) { + fstrm.open(argv[2]); + if (!fstrm) { + LOG(ERROR) << argv[0] << ": Open failed, file = " << argv[2]; + return 1; + } + dest = argv[2]; + } + std::ostream &ostrm = fstrm.is_open() ? fstrm : std::cout; + + const SymbolTableTextOptions opts(FLAGS_allow_negative_labels); + + std::unique_ptr isyms; + if (!FLAGS_isymbols.empty() && !FLAGS_numeric) { + isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts)); + if (!isyms) return 1; + } + + std::unique_ptr osyms; + if (!FLAGS_osymbols.empty() && !FLAGS_numeric) { + osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts)); + if (!osyms) return 1; + } + + std::unique_ptr ssyms; + if (!FLAGS_ssymbols.empty() && !FLAGS_numeric) { + ssyms.reset(SymbolTable::ReadText(FLAGS_ssymbols)); + if (!ssyms) return 1; + } + + if (!isyms && !FLAGS_numeric && fst->InputSymbols()) { + isyms.reset(fst->InputSymbols()->Copy()); + } + + if (!osyms && !FLAGS_numeric && fst->OutputSymbols()) { + osyms.reset(fst->OutputSymbols()->Copy()); + } + + s::DrawFst(*fst, isyms.get(), osyms.get(), ssyms.get(), FLAGS_acceptor, + FLAGS_title, FLAGS_width, FLAGS_height, FLAGS_portrait, + FLAGS_vertical, FLAGS_ranksep, FLAGS_nodesep, FLAGS_fontsize, + FLAGS_precision, FLAGS_float_format, FLAGS_show_weight_one, + &ostrm, dest); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstdraw.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstdraw.cc new file mode 100644 index 0000000..69f6fb8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstdraw.cc @@ -0,0 +1,31 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(acceptor, false, "Input in acceptor format"); +DEFINE_string(isymbols, "", "Input label symbol table"); +DEFINE_string(osymbols, "", "Output label symbol table"); +DEFINE_string(ssymbols, "", "State label symbol table"); +DEFINE_bool(numeric, false, "Print numeric labels"); +DEFINE_int32(precision, 5, "Set precision (number of char/float)"); +DEFINE_string(float_format, "g", + "Floating-point format, one of: \"e\", \"f\", or \"g\""); +DEFINE_bool(show_weight_one, false, + "Print/draw arc weights and final weights equal to Weight::One()"); +DEFINE_string(title, "", "Set figure title"); +DEFINE_bool(portrait, false, "Portrait mode (def: landscape)"); +DEFINE_bool(vertical, false, "Draw bottom-to-top instead of left-to-right"); +DEFINE_int32(fontsize, 14, "Set fontsize"); +DEFINE_double(height, 11, "Set height"); +DEFINE_double(width, 8.5, "Set width"); +DEFINE_double(nodesep, 0.25, + "Set minimum separation between nodes (see dot documentation)"); +DEFINE_double(ranksep, 0.40, + "Set minimum separation between ranks (see dot documentation)"); +DEFINE_bool(allow_negative_labels, false, + "Allow negative labels (not recommended; may cause conflicts)"); + +int fstdraw_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstdraw_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstencode-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstencode-main.cc new file mode 100644 index 0000000..9441480 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstencode-main.cc @@ -0,0 +1,53 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Encode transducer labels and/or weights. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_bool(encode_labels); +DECLARE_bool(encode_weights); +DECLARE_bool(encode_reuse); +DECLARE_bool(decode); + +int fstencode_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::MutableFstClass; + + string usage = "Encodes transducer labels and/or weights.\n\n Usage: "; + usage += argv[0]; + usage += " in.fst codex [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in_name = (strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string codex_name = argv[2]; + const string out_name = argc > 3 ? argv[3] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + if (FLAGS_decode) { + s::Decode(fst.get(), codex_name); + return !fst->Write(out_name); + } else { + const auto flags = + s::GetEncodeFlags(FLAGS_encode_labels, FLAGS_encode_weights); + s::Encode(fst.get(), flags, FLAGS_encode_reuse, codex_name); + return !fst->Write(out_name); + } +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstencode.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstencode.cc new file mode 100644 index 0000000..94c19aa --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstencode.cc @@ -0,0 +1,13 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(encode_labels, false, "Encode output labels"); +DEFINE_bool(encode_weights, false, "Encode weights"); +DEFINE_bool(encode_reuse, false, "Re-use existing codex"); +DEFINE_bool(decode, false, "Decode labels and/or weights"); + +int fstencode_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstencode_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstepsnormalize-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstepsnormalize-main.cc new file mode 100644 index 0000000..acadd17 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstepsnormalize-main.cc @@ -0,0 +1,44 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Epsilon-normalizes an FST. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_bool(eps_norm_output); + +int fstepsnormalize_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Epsilon normalizes an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + s::EpsNormalize(*ifst, &ofst, s::GetEpsNormalizeType(FLAGS_eps_norm_output)); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstepsnormalize.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstepsnormalize.cc new file mode 100644 index 0000000..b8091d5 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstepsnormalize.cc @@ -0,0 +1,10 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(eps_norm_output, false, "Normalize output epsilons"); + +int fstepsnormalize_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstepsnormalize_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstequal-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstequal-main.cc new file mode 100644 index 0000000..f7b2248 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstequal-main.cc @@ -0,0 +1,50 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Two FSTS are equal iff their exit status is zero. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_double(delta); + +int fstequal_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + + string usage = "Two FSTs are equal iff the exit status is zero.\n\n Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc != 3) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + bool result = s::Equal(*ifst1, *ifst2, FLAGS_delta); + if (!result) VLOG(1) << "FSTs are not equal."; + + return result ? 0 : 2; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstequal.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstequal.cc new file mode 100644 index 0000000..e1212a0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstequal.cc @@ -0,0 +1,11 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); + +int fstequal_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstequal_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstequivalent-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstequivalent-main.cc new file mode 100644 index 0000000..8b4b151 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstequivalent-main.cc @@ -0,0 +1,73 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Two DFAs are equivalent iff their exit status is zero. + +#include + +#include +#include + +#include +#include +#include +#include +#include + +DECLARE_double(delta); +DECLARE_bool(random); +DECLARE_int32(max_length); +DECLARE_int32(npath); +DECLARE_int32(seed); +DECLARE_string(select); + +int fstequivalent_main(int argc, char **argv) { + namespace s = fst::script; + using fst::RandGenOptions; + using fst::script::FstClass; + + string usage = + "Two DFAs are equivalent iff the exit status is zero.\n\n" + " Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc != 3) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + if (!FLAGS_random) { + bool result = s::Equivalent(*ifst1, *ifst2, FLAGS_delta); + if (!result) VLOG(1) << "FSTs are not equivalent"; + return result ? 0 : 2; + } else { + s::RandArcSelection ras; + if (!s::GetRandArcSelection(FLAGS_select, &ras)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported select type " + << FLAGS_select; + return 1; + } + const RandGenOptions opts(ras, FLAGS_max_length); + bool result = s::RandEquivalent(*ifst1, *ifst2, FLAGS_npath, FLAGS_delta, + FLAGS_seed, opts); + if (!result) VLOG(1) << "FSTs are not equivalent"; + return result ? 0 : 2; + } +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstequivalent.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstequivalent.cc new file mode 100644 index 0000000..e799f99 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstequivalent.cc @@ -0,0 +1,27 @@ +#ifndef _MSC_VER +#include +#else +#include +#define getpid _getpid +#endif + +#include +#include + +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); +DEFINE_bool(random, false, + "Test equivalence by randomly selecting paths in the input FSTs"); +DEFINE_int32(max_length, INT32_MAX, "Maximum path length"); +DEFINE_int32(npath, 1, "Number of paths to generate"); +DEFINE_int32(seed, time(nullptr) + getpid(), "Random seed"); +DEFINE_string(select, "uniform", + "Selection type: one of: " + " \"uniform\", \"log_prob\" (when appropriate)," + " \"fast_log_prob\" (when appropriate)"); + +int fstequivalent_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstequivalent_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstinfo-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstinfo-main.cc new file mode 100644 index 0000000..9877e07 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstinfo-main.cc @@ -0,0 +1,46 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prints out various information about an FST such as number of states +// and arcs and property values (see properties.h). + +#include + +#include +#include + +#include +#include + +DECLARE_string(arc_filter); +DECLARE_string(info_type); +DECLARE_bool(pipe); +DECLARE_bool(test_properties); +DECLARE_bool(fst_verify); + +int fstinfo_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + + string usage = "Prints out information about an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 2) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + s::PrintFstInfo(*ifst, FLAGS_test_properties, FLAGS_arc_filter, + FLAGS_info_type, FLAGS_fst_verify, FLAGS_pipe); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstinfo.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstinfo.cc new file mode 100644 index 0000000..6d083e8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstinfo.cc @@ -0,0 +1,20 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(arc_filter, "any", + "Arc filter: one of:" + " \"any\", \"epsilon\", \"iepsilon\", \"oepsilon\"; " + "this only affects the counts of (co)accessible states, " + "connected states, and (strongly) connected components"); +DEFINE_string(info_type, "auto", + "Info format: one of: \"auto\", \"long\", \"short\""); +DEFINE_bool(pipe, false, "Send info to stderr, input to stdout"); +DEFINE_bool(test_properties, true, + "Compute property values (if unknown to FST)"); +DEFINE_bool(fst_verify, true, "Verify FST sanity"); + +int fstinfo_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstinfo_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstintersect-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstintersect-main.cc new file mode 100644 index 0000000..9d1c9a3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstintersect-main.cc @@ -0,0 +1,65 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Intersects two FSTs. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_string(compose_filter); +DECLARE_bool(connect); + +int fstintersect_main(int argc, char **argv) { + namespace s = fst::script; + using fst::ComposeFilter; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Intersects two FSAs.\n\n Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst [out.fst]\n"; + usage += " Flags: connect\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + const string out_name = argc > 3 ? argv[3] : ""; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + VectorFstClass ofst(ifst1->ArcType()); + + ComposeFilter compose_filter; + if (!s::GetComposeFilter(FLAGS_compose_filter, &compose_filter)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: " + << FLAGS_compose_filter; + return 1; + } + + const fst::IntersectOptions opts(FLAGS_connect, compose_filter); + + s::Intersect(*ifst1, *ifst2, &ofst, opts); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstintersect.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstintersect.cc new file mode 100644 index 0000000..802cc1c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstintersect.cc @@ -0,0 +1,13 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(compose_filter, "auto", + "Composition filter, one of: \"alt_sequence\", \"auto\", " + "\"match\", \"null\", \"sequence\", \"trivial\""); +DEFINE_bool(connect, true, "Trim output"); + +int fstintersect_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstintersect_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstinvert-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstinvert-main.cc new file mode 100644 index 0000000..61e858a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstinvert-main.cc @@ -0,0 +1,38 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Inverts a transduction. + +#include + +#include +#include + +#include +#include + +int fstinvert_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + + string usage = "Inverts a transduction.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + s::Invert(fst.get()); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstinvert.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstinvert.cc new file mode 100644 index 0000000..3ead13c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstinvert.cc @@ -0,0 +1,6 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +int fstinvert_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstinvert_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstisomorphic-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstisomorphic-main.cc new file mode 100644 index 0000000..2b7c6bf --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstisomorphic-main.cc @@ -0,0 +1,53 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Two FSTS are isomorphic (equal up to state and arc re-ordering) iff their +// exit status is zero. FSTs should be deterministic when viewed as unweighted +// automata. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_double(delta); + +int fstisomorphic_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + + string usage = + "Two FSTs are isomorphic iff the exit status is zero.\n\n Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc != 3) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + bool result = s::Isomorphic(*ifst1, *ifst2, FLAGS_delta); + if (!result) VLOG(1) << "FSTs are not isomorphic"; + + return result ? 0 : 2; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstisomorphic.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstisomorphic.cc new file mode 100644 index 0000000..bb32962 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstisomorphic.cc @@ -0,0 +1,11 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); + +int fstisomorphic_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstisomorphic_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstmap-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstmap-main.cc new file mode 100644 index 0000000..56a8198 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstmap-main.cc @@ -0,0 +1,60 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Applies an operation to each arc of an FST. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_double(delta); +DECLARE_string(map_type); +DECLARE_double(power); +DECLARE_string(weight); + +int fstmap_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::WeightClass; + + string usage = "Applies an operation to each arc of an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + s::MapType map_type; + if (!s::GetMapType(FLAGS_map_type, &map_type)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported map type " + << FLAGS_map_type; + return 1; + } + + const auto weight_param = + !FLAGS_weight.empty() + ? WeightClass(ifst->WeightType(), FLAGS_weight) + : (FLAGS_map_type == "times" ? WeightClass::One(ifst->WeightType()) + : WeightClass::Zero(ifst->WeightType())); + + std::unique_ptr ofst( + s::Map(*ifst, map_type, FLAGS_delta, FLAGS_power, weight_param)); + + return !ofst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstmap.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstmap.cc new file mode 100644 index 0000000..cf8ddca --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstmap.cc @@ -0,0 +1,20 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); +DEFINE_string(map_type, "identity", + "Map operation, one of: \"arc_sum\", \"arc_unique\", " + "\"float_power\" (--power)\", \"identity\", \"input_epsilon\", " + "\"invert\", \"output_epsilon\", \"plus (--weight)\", " + "\"quantize (--delta)\", \"rmweight\", \"superfinal\", " + "\"power (--power)\", \"times (--weight)\", \"to_log\", " + "\"to_log64\", \"to_std\""); +DEFINE_double(power, 1.0, "Power parameter"); +DEFINE_string(weight, "", "Weight parameter"); + +int fstmap_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstmap_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstminimize-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstminimize-main.cc new file mode 100644 index 0000000..f189f94 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstminimize-main.cc @@ -0,0 +1,57 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Minimizes a deterministic FST. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_double(delta); +DECLARE_bool(allow_nondet); + +int fstminimize_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + using fst::script::VectorFstClass; + + string usage = "Minimizes a deterministic FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out1.fst [out2.fst]]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 4) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out1_name = + (argc > 2 && strcmp(argv[2], "-") != 0) ? argv[2] : ""; + const string out2_name = + (argc > 3 && strcmp(argv[3], "-") != 0) ? argv[3] : ""; + + if (out1_name.empty() && out2_name.empty() && argc > 3) { + LOG(ERROR) << argv[0] << ": Both outputs can't be standard output."; + return 1; + } + + std::unique_ptr fst1(MutableFstClass::Read(in_name, true)); + if (!fst1) return 1; + + if (argc > 3) { + std::unique_ptr fst2(new VectorFstClass(fst1->ArcType())); + s::Minimize(fst1.get(), fst2.get(), FLAGS_delta, FLAGS_allow_nondet); + if (!fst2->Write(out2_name)) return 1; + } else { + s::Minimize(fst1.get(), nullptr, FLAGS_delta, FLAGS_allow_nondet); + } + + return !fst1->Write(out1_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstminimize.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstminimize.cc new file mode 100644 index 0000000..ef602f7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstminimize.cc @@ -0,0 +1,13 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta"); +DEFINE_bool(allow_nondet, false, "Minimize non-deterministic FSTs"); + +int fstminimize_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstminimize_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstprint-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstprint-main.cc new file mode 100644 index 0000000..95884dd --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstprint-main.cc @@ -0,0 +1,104 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prints out binary FSTs in simple text format used by AT&T. + +#include + +#include +#include +#include +#include + +#include +#include +#include + +DECLARE_bool(acceptor); +DECLARE_string(isymbols); +DECLARE_string(osymbols); +DECLARE_string(ssymbols); +DECLARE_bool(numeric); +DECLARE_string(save_isymbols); +DECLARE_string(save_osymbols); +DECLARE_bool(show_weight_one); +DECLARE_bool(allow_negative_labels); +DECLARE_string(missing_symbol); + +int fstprint_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::SymbolTable; + using fst::SymbolTableTextOptions; + + string usage = "Prints out binary FSTs in simple text format.\n\n Usage: "; + usage += argv[0]; + usage += " [binary.fst [text.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(FstClass::Read(in_name)); + if (!fst) return 1; + + string dest = "standard output"; + std::ofstream fstrm; + if (argc == 3) { + fstrm.open(argv[2]); + if (!fstrm) { + LOG(ERROR) << argv[0] << ": Open failed, file = " << argv[2]; + return 1; + } + dest = argv[2]; + } + std::ostream &ostrm = fstrm.is_open() ? fstrm : std::cout; + ostrm.precision(9); + + const SymbolTableTextOptions opts(FLAGS_allow_negative_labels); + + std::unique_ptr isyms; + if (!FLAGS_isymbols.empty() && !FLAGS_numeric) { + isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts)); + if (!isyms) return 1; + } + + std::unique_ptr osyms; + if (!FLAGS_osymbols.empty() && !FLAGS_numeric) { + osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts)); + if (!osyms) return 1; + } + + std::unique_ptr ssyms; + if (!FLAGS_ssymbols.empty() && !FLAGS_numeric) { + ssyms.reset(SymbolTable::ReadText(FLAGS_ssymbols)); + if (!ssyms) return 1; + } + + if (!isyms && !FLAGS_numeric && fst->InputSymbols()) { + isyms.reset(fst->InputSymbols()->Copy()); + } + + if (!osyms && !FLAGS_numeric && fst->OutputSymbols()) { + osyms.reset(fst->OutputSymbols()->Copy()); + } + + s::PrintFst(*fst, ostrm, dest, isyms.get(), osyms.get(), ssyms.get(), + FLAGS_acceptor, FLAGS_show_weight_one, FLAGS_missing_symbol); + + if (isyms && !FLAGS_save_isymbols.empty()) { + if (!isyms->WriteText(FLAGS_save_isymbols)) return 1; + } + + if (osyms && !FLAGS_save_osymbols.empty()) { + if (!osyms->WriteText(FLAGS_save_osymbols)) return 1; + } + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstprint.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstprint.cc new file mode 100644 index 0000000..8f42727 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstprint.cc @@ -0,0 +1,22 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(acceptor, false, "Input in acceptor format?"); +DEFINE_string(isymbols, "", "Input label symbol table"); +DEFINE_string(osymbols, "", "Output label symbol table"); +DEFINE_string(ssymbols, "", "State label symbol table"); +DEFINE_bool(numeric, false, "Print numeric labels?"); +DEFINE_string(save_isymbols, "", "Save input symbol table to file"); +DEFINE_string(save_osymbols, "", "Save output symbol table to file"); +DEFINE_bool(show_weight_one, false, + "Print/draw arc weights and final weights equal to semiring One?"); +DEFINE_bool(allow_negative_labels, false, + "Allow negative labels (not recommended; may cause conflicts)?"); +DEFINE_string(missing_symbol, "", + "Symbol to print when lookup fails (default raises error)"); + +int fstprint_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstprint_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstproject-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstproject-main.cc new file mode 100644 index 0000000..746cf82 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstproject-main.cc @@ -0,0 +1,43 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Projects a transduction onto its input or output language. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_bool(project_output); + +int fstproject_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + + string usage = + "Projects a transduction onto its input" + " or output language.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + s::Project(fst.get(), s::GetProjectType(FLAGS_project_output)); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstproject.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstproject.cc new file mode 100644 index 0000000..1cfb913 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstproject.cc @@ -0,0 +1,10 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(project_output, false, "Project on output (vs. input)"); + +int fstproject_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstproject_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstprune-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstprune-main.cc new file mode 100644 index 0000000..7d802ad --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstprune-main.cc @@ -0,0 +1,47 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prunes states and arcs of an FST w.r.t. the shortest path weight. + +#include + +#include +#include + +#include +#include + +DECLARE_double(delta); +DECLARE_int64(nstate); +DECLARE_string(weight); + +int fstprune_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + using fst::script::WeightClass; + + string usage = "Prunes states and arcs of an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + const auto weight_threshold = + FLAGS_weight.empty() ? WeightClass::Zero(fst->WeightType()) + : WeightClass(fst->WeightType(), FLAGS_weight); + + s::Prune(fst.get(), weight_threshold, FLAGS_nstate, FLAGS_delta); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstprune.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstprune.cc new file mode 100644 index 0000000..3902f45 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstprune.cc @@ -0,0 +1,14 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); +DEFINE_int64(nstate, fst::kNoStateId, "State number threshold"); +DEFINE_string(weight, "", "Weight threshold"); + +int fstprune_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstprune_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstpush-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstpush-main.cc new file mode 100644 index 0000000..c70067b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstpush-main.cc @@ -0,0 +1,55 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Pushes weights and/or output labels in an FST toward the initial or final +// states. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_double(delta); +DECLARE_bool(push_weights); +DECLARE_bool(push_labels); +DECLARE_bool(remove_total_weight); +DECLARE_bool(remove_common_affix); +DECLARE_bool(to_final); + +int fstpush_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Pushes weights and/or olabels in an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + const auto flags = + s::GetPushFlags(FLAGS_push_weights, FLAGS_push_labels, + FLAGS_remove_total_weight, FLAGS_remove_common_affix); + + VectorFstClass ofst(ifst->ArcType()); + + s::Push(*ifst, &ofst, flags, s::GetReweightType(FLAGS_to_final), + FLAGS_delta); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstpush.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstpush.cc new file mode 100644 index 0000000..c04d38d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstpush.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); +DEFINE_bool(push_weights, false, "Push weights"); +DEFINE_bool(push_labels, false, "Push output labels"); +DEFINE_bool(remove_total_weight, false, + "Remove total weight when pushing weights"); +DEFINE_bool(remove_common_affix, false, + "Remove common prefix/suffix when pushing labels"); +DEFINE_bool(to_final, false, "Push/reweight to final (vs. to initial) states"); + +int fstpush_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstpush_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstrandgen-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstrandgen-main.cc new file mode 100644 index 0000000..7504736 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstrandgen-main.cc @@ -0,0 +1,62 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Generates random paths through an FST. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_int32(max_length); +DECLARE_int32(npath); +DECLARE_int32(seed); +DECLARE_string(select); +DECLARE_bool(weighted); +DECLARE_bool(remove_total_weight); + +int fstrandgen_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Generates random paths through an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + VLOG(1) << argv[0] << ": Seed = " << FLAGS_seed; + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + s::RandArcSelection ras; + if (!s::GetRandArcSelection(FLAGS_select, &ras)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported select type " + << FLAGS_select; + return 1; + } + + s::RandGen(*ifst, &ofst, FLAGS_seed, + fst::RandGenOptions( + ras, FLAGS_max_length, FLAGS_npath, FLAGS_weighted, + FLAGS_remove_total_weight)); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstrandgen.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstrandgen.cc new file mode 100644 index 0000000..37a57a2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstrandgen.cc @@ -0,0 +1,27 @@ +#ifndef _MSC_VER +#include +#else +#include +#define getpid _getpid +#endif + +#include +#include + +#include + +DEFINE_int32(max_length, INT32_MAX, "Maximum path length"); +DEFINE_int32(npath, 1, "Number of paths to generate"); +DEFINE_int32(seed, time(nullptr) + getpid(), "Random seed"); +DEFINE_string(select, "uniform", + "Selection type: one of: " + " \"uniform\", \"log_prob\" (when appropriate)," + " \"fast_log_prob\" (when appropriate)"); +DEFINE_bool(weighted, false, + "Output tree weighted by path count vs. unweighted paths"); +DEFINE_bool(remove_total_weight, false, + "Remove total weight when output weighted"); + +int fstrandgen_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstrandgen_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstrelabel-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstrelabel-main.cc new file mode 100644 index 0000000..41970d7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstrelabel-main.cc @@ -0,0 +1,104 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Relabels input or output space of an FST. + +#include + +#include +#include +#include + +#include +#include +#include +#include + +DECLARE_string(isymbols); +DECLARE_string(osymbols); +DECLARE_string(relabel_isymbols); +DECLARE_string(relabel_osymbols); +DECLARE_string(relabel_ipairs); +DECLARE_string(relabel_opairs); +DECLARE_string(unknown_isymbol); +DECLARE_string(unknown_osymbol); +DECLARE_bool(allow_negative_labels); + +int fstrelabel_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + using fst::SymbolTable; + using fst::SymbolTableTextOptions; + + string usage = + "Relabels the input and/or the output labels of the FST.\n\n" + " Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + usage += "\n Using SymbolTables flags:\n"; + usage += " --relabel_isymbols isyms.map\n"; + usage += " --relabel_osymbols osyms.map\n"; + usage += "\n Using numeric labels flags:\n"; + usage += " --relabel_ipairs ipairs.txt\n"; + usage += " --relabel_opairs opairs.txt\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + // Relabel with symbol tables. + const SymbolTableTextOptions opts(FLAGS_allow_negative_labels); + + if (!FLAGS_relabel_isymbols.empty() || !FLAGS_relabel_osymbols.empty()) { + bool attach_new_isymbols = (fst->InputSymbols() != nullptr); + std::unique_ptr old_isymbols( + FLAGS_isymbols.empty() ? nullptr + : SymbolTable::ReadText(FLAGS_isymbols, opts)); + const std::unique_ptr relabel_isymbols( + FLAGS_relabel_isymbols.empty() + ? nullptr + : SymbolTable::ReadText(FLAGS_relabel_isymbols, opts)); + bool attach_new_osymbols = (fst->OutputSymbols() != nullptr); + std::unique_ptr old_osymbols( + FLAGS_osymbols.empty() ? nullptr + : SymbolTable::ReadText(FLAGS_osymbols, opts)); + const std::unique_ptr relabel_osymbols( + FLAGS_relabel_osymbols.empty() + ? nullptr + : SymbolTable::ReadText(FLAGS_relabel_osymbols, opts)); + s::Relabel(fst.get(), + old_isymbols ? old_isymbols.get() : fst->InputSymbols(), + relabel_isymbols.get(), FLAGS_unknown_isymbol, + attach_new_isymbols, + old_osymbols ? old_osymbols.get() : fst->OutputSymbols(), + relabel_osymbols.get(), FLAGS_unknown_osymbol, + attach_new_osymbols); + } else { + // Reads in relabeling pairs. + std::vector ipairs; + std::vector opairs; + if (!FLAGS_relabel_ipairs.empty()) { + if (!fst::ReadLabelPairs(FLAGS_relabel_ipairs, &ipairs, + FLAGS_allow_negative_labels)) + return 1; + } + if (!FLAGS_relabel_opairs.empty()) { + if (!fst::ReadLabelPairs(FLAGS_relabel_opairs, &opairs, + FLAGS_allow_negative_labels)) + return 1; + } + s::Relabel(fst.get(), ipairs, opairs); + } + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstrelabel.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstrelabel.cc new file mode 100644 index 0000000..29f24ef --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstrelabel.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(isymbols, "", "Input label symbol table"); +DEFINE_string(osymbols, "", "Output label symbol table"); +DEFINE_string(relabel_isymbols, "", "Input symbol set to relabel to"); +DEFINE_string(relabel_osymbols, "", "Output symbol set to relabel to"); +DEFINE_string(relabel_ipairs, "", "Input relabel pairs (numeric)"); +DEFINE_string(relabel_opairs, "", "Output relabel pairs (numeric)"); +DEFINE_string(unknown_isymbol, "", + "Input symbol to use to relabel OOVs (default: OOVs are errors)"); +DEFINE_string(unknown_osymbol, "", + "Output symbol to use to relabel OOVs (default: OOVs are errors)"); +DEFINE_bool(allow_negative_labels, false, + "Allow negative labels (not recommended; may cause conflicts)"); + +int fstrelabel_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstrelabel_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstreplace-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstreplace-main.cc new file mode 100644 index 0000000..0c4eeb0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstreplace-main.cc @@ -0,0 +1,91 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Performs the dynamic replacement of arcs in one FST with another FST, +// allowing for the definition of FSTs analogous to RTNs. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_string(call_arc_labeling); +DECLARE_string(return_arc_labeling); +DECLARE_int64(return_label); +DECLARE_bool(epsilon_on_replace); + +void Cleanup(std::vector *pairs) { + for (const auto &pair : *pairs) { + delete pair.second; + } + pairs->clear(); +} + +int fstreplace_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + using fst::ReplaceLabelType; + + string usage = "Recursively replaces FST arcs with other FST(s).\n\n" + " Usage: "; + usage += argv[0]; + usage += " root.fst rootlabel [rule1.fst label1 ...] [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 4) { + ShowUsage(); + return 1; + } + + const string in_name = argv[1]; + const string out_name = argc % 2 == 0 ? argv[argc - 1] : ""; + + auto *ifst = FstClass::Read(in_name); + if (!ifst) return 1; + + std::vector pairs; + // Note that if the root label is beyond the range of the underlying FST's + // labels, truncation will occur. + const auto root = atoll(argv[2]); + pairs.emplace_back(root, ifst); + + for (auto i = 3; i < argc - 1; i += 2) { + ifst = FstClass::Read(argv[i]); + if (!ifst) { + Cleanup(&pairs); + return 1; + } + // Note that if the root label is beyond the range of the underlying FST's + // labels, truncation will occur. + const auto label = atoll(argv[i + 1]); + pairs.emplace_back(label, ifst); + } + + ReplaceLabelType call_label_type; + if (!s::GetReplaceLabelType(FLAGS_call_arc_labeling, FLAGS_epsilon_on_replace, + &call_label_type)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported call arc replace " + << "label type: " << FLAGS_call_arc_labeling; + } + ReplaceLabelType return_label_type; + if (!s::GetReplaceLabelType(FLAGS_return_arc_labeling, + FLAGS_epsilon_on_replace, &return_label_type)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported return arc replace " + << "label type: " << FLAGS_return_arc_labeling; + } + + s::ReplaceOptions opts(root, call_label_type, return_label_type, + FLAGS_return_label); + + VectorFstClass ofst(ifst->ArcType()); + s::Replace(pairs, &ofst, opts); + Cleanup(&pairs); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstreplace.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstreplace.cc new file mode 100644 index 0000000..0cab330 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstreplace.cc @@ -0,0 +1,17 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(call_arc_labeling, "input", + "Which labels to make non-epsilon on the call arc. " + "One of: \"input\" (default), \"output\", \"both\", \"neither\""); +DEFINE_string(return_arc_labeling, "neither", + "Which labels to make non-epsilon on the return arc. " + "One of: \"input\", \"output\", \"both\", \"neither\" (default)"); +DEFINE_int64(return_label, 0, "Label to put on return arc"); +DEFINE_bool(epsilon_on_replace, false, "Call/return arcs are epsilon arcs?"); + +int fstreplace_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstreplace_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstreverse-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstreverse-main.cc new file mode 100644 index 0000000..86f18c2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstreverse-main.cc @@ -0,0 +1,45 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Reverses the paths in an FST. + +#include + +#include +#include + +#include +#include +#include + +DECLARE_bool(require_superinitial); + +int fstreverse_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Reverses the paths in an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + s::Reverse(*ifst, &ofst, FLAGS_require_superinitial); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstreverse.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstreverse.cc new file mode 100644 index 0000000..cdc10d6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstreverse.cc @@ -0,0 +1,10 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(require_superinitial, true, "Always create a superinitial state"); + +int fstreverse_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstreverse_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstreweight-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstreweight-main.cc new file mode 100644 index 0000000..8ca8d84 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstreweight-main.cc @@ -0,0 +1,50 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Reweights an FST. + +#include + +#include +#include +#include + +#include +#include +#include +#include + +DECLARE_bool(to_final); + +int fstreweight_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + using fst::script::WeightClass; + + string usage = "Reweights an FST.\n\n Usage: "; + usage += argv[0]; + usage += " in.fst potential.txt [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in_name = argv[1]; + const string potentials_name = argv[2]; + const string out_name = argc > 3 ? argv[3] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + std::vector potential; + if (!s::ReadPotentials(fst->WeightType(), potentials_name, &potential)) { + return 1; + } + + s::Reweight(fst.get(), potential, s::GetReweightType(FLAGS_to_final)); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstreweight.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstreweight.cc new file mode 100644 index 0000000..6e2c83c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstreweight.cc @@ -0,0 +1,10 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_bool(to_final, false, "Push/reweight to final (vs. to initial) states"); + +int fstreweight_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstreweight_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstrmepsilon-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstrmepsilon-main.cc new file mode 100644 index 0000000..c457d17 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstrmepsilon-main.cc @@ -0,0 +1,61 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Removes epsilons from an FST. + +#include + +#include +#include + +#include +#include +#include +#include + +DECLARE_bool(connect); +DECLARE_double(delta); +DECLARE_int64(nstate); +DECLARE_string(queue_type); +DECLARE_string(weight); + +int fstrmepsilon_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + using fst::script::WeightClass; + + string usage = "Removes epsilons from an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + const auto weight_threshold = + FLAGS_weight.empty() ? WeightClass::Zero(fst->WeightType()) + : WeightClass(fst->WeightType(), FLAGS_weight); + + fst::QueueType queue_type; + if (!s::GetQueueType(FLAGS_queue_type, &queue_type)) { + LOG(ERROR) << argv[0] + << ": Unknown or unsupported queue type: " << FLAGS_queue_type; + return 1; + } + + const s::RmEpsilonOptions opts(queue_type, FLAGS_connect, weight_threshold, + FLAGS_nstate, FLAGS_delta); + + s::RmEpsilon(fst.get(), opts); + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstrmepsilon.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstrmepsilon.cc new file mode 100644 index 0000000..c249c52 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstrmepsilon.cc @@ -0,0 +1,19 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include +#include + +DEFINE_bool(connect, true, "Trim output"); +DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta"); +DEFINE_int64(nstate, fst::kNoStateId, "State number threshold"); +DEFINE_string(queue_type, "auto", + "Queue type: one of: \"auto\", " + "\"fifo\", \"lifo\", \"shortest\", \"state\", \"top\""); +DEFINE_string(weight, "", "Weight threshold"); + +int fstrmepsilon_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstrmepsilon_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestdistance-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestdistance-main.cc new file mode 100644 index 0000000..1bf2eb3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestdistance-main.cc @@ -0,0 +1,70 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Find shortest distances in an FST. + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +DECLARE_bool(reverse); +DECLARE_double(delta); +DECLARE_int64(nstate); +DECLARE_string(queue_type); + +int fstshortestdistance_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::WeightClass; + using fst::QueueType; + using fst::AUTO_QUEUE; + + string usage = "Finds shortest distance(s) in an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [distance.txt]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + string in_name = (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + std::vector distance; + + QueueType queue_type; + if (!s::GetQueueType(FLAGS_queue_type, &queue_type)) { + LOG(ERROR) << argv[0] + << ": Unknown or unsupported queue type: " << FLAGS_queue_type; + return 1; + } + + if (FLAGS_reverse && queue_type != AUTO_QUEUE) { + LOG(ERROR) << argv[0] << ": Can't use non-default queue with reverse"; + return 1; + } + + if (FLAGS_reverse) { + s::ShortestDistance(*ifst, &distance, FLAGS_reverse, FLAGS_delta); + } else { + const s::ShortestDistanceOptions opts(queue_type, s::ANY_ARC_FILTER, + FLAGS_nstate, FLAGS_delta); + s::ShortestDistance(*ifst, &distance, opts); + } + + return !s::WritePotentials(out_name, distance); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestdistance.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestdistance.cc new file mode 100644 index 0000000..63e6537 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestdistance.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include +#include + +DEFINE_bool(reverse, false, "Perform in the reverse direction"); +DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta"); +DEFINE_int64(nstate, fst::kNoStateId, "State number threshold"); +DEFINE_string(queue_type, "auto", + "Queue type: one of: \"auto\", " + "\"fifo\", \"lifo\", \"shortest\", \"state\", \"top\""); + +int fstshortestdistance_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstshortestdistance_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestpath-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestpath-main.cc new file mode 100644 index 0000000..9becf8f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestpath-main.cc @@ -0,0 +1,67 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Find shortest path(s) in an FST. + +#include + +#include +#include +#include + +#include +#include +#include +#include + +DECLARE_double(delta); +DECLARE_int32(nshortest); +DECLARE_int64(nstate); +DECLARE_string(queue_type); +DECLARE_bool(unique); +DECLARE_string(weight); + +int fstshortestpath_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::WeightClass; + using fst::script::VectorFstClass; + + string usage = "Finds shortest path(s) in an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + const auto weight_threshold = + FLAGS_weight.empty() ? WeightClass::Zero(ifst->WeightType()) + : WeightClass(ifst->WeightType(), FLAGS_weight); + + VectorFstClass ofst(ifst->ArcType()); + + fst::QueueType queue_type; + if (!s::GetQueueType(FLAGS_queue_type, &queue_type)) { + LOG(ERROR) << "Unknown or unsupported queue type: " << FLAGS_queue_type; + return 1; + } + + const s::ShortestPathOptions opts(queue_type, FLAGS_nshortest, + FLAGS_unique, FLAGS_delta, + weight_threshold, FLAGS_nstate); + + s::ShortestPath(*ifst, &ofst, opts); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestpath.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestpath.cc new file mode 100644 index 0000000..722897a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstshortestpath.cc @@ -0,0 +1,20 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include +#include + +DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta"); +DEFINE_int32(nshortest, 1, "Return N-shortest paths"); +DEFINE_int64(nstate, fst::kNoStateId, "State number threshold"); +DEFINE_string(queue_type, "auto", + "Queue type: one of \"auto\", " + "\"fifo\", \"lifo\", \"shortest\', \"state\", \"top\""); +DEFINE_bool(unique, false, "Return unique strings"); +DEFINE_string(weight, "", "Weight threshold"); + +int fstshortestpath_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstshortestpath_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstsymbols-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstsymbols-main.cc new file mode 100644 index 0000000..bf6f974 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstsymbols-main.cc @@ -0,0 +1,111 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Performs operations (set, clear, relabel) on the symbols table attached to an +// input FST. + +#include + +#include +#include +#include + +#include +#include +#include +#include + +DECLARE_string(isymbols); +DECLARE_string(osymbols); +DECLARE_bool(clear_isymbols); +DECLARE_bool(clear_osymbols); +DECLARE_string(relabel_ipairs); +DECLARE_string(relabel_opairs); +DECLARE_string(save_isymbols); +DECLARE_string(save_osymbols); +DECLARE_bool(allow_negative_labels); +DECLARE_bool(verify); + +int fstsymbols_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + using fst::ReadLabelPairs; + using fst::SymbolTable; + using fst::SymbolTableTextOptions; + + string usage = + "Performs operations (set, clear, relabel) on the symbol" + " tables attached to an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = argc > 1 && strcmp(argv[1], "-") != 0 ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + if (!FLAGS_save_isymbols.empty()) { + const auto *isyms = fst->InputSymbols(); + if (isyms) { + isyms->WriteText(FLAGS_save_isymbols); + } else { + LOG(ERROR) << argv[0] + << ": Saving isymbols but there are no input symbols."; + } + } + + if (!FLAGS_save_osymbols.empty()) { + const auto *osyms = fst->OutputSymbols(); + if (osyms) { + osyms->WriteText(FLAGS_save_osymbols); + } else { + LOG(ERROR) << argv[0] + << ": Saving osymbols but there are no output symbols."; + } + } + + const SymbolTableTextOptions opts(FLAGS_allow_negative_labels); + + std::unique_ptr isyms; + if (!FLAGS_isymbols.empty()) { + isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts)); + fst->SetInputSymbols(isyms.get()); + } else if (FLAGS_clear_isymbols) { + fst->SetInputSymbols(nullptr); + } + std::unique_ptr osyms; + if (!FLAGS_osymbols.empty()) { + osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts)); + fst->SetOutputSymbols(osyms.get()); + } else if (FLAGS_clear_osymbols) { + fst->SetOutputSymbols(nullptr); + } + + using Label = int64; + if (!FLAGS_relabel_ipairs.empty()) { + std::vector> ipairs; + ReadLabelPairs(FLAGS_relabel_ipairs, &ipairs, FLAGS_allow_negative_labels); + std::unique_ptr isyms_relabel( + RelabelSymbolTable(fst->InputSymbols(), ipairs)); + fst->SetInputSymbols(isyms_relabel.get()); + } + if (!FLAGS_relabel_opairs.empty()) { + std::vector> opairs; + ReadLabelPairs(FLAGS_relabel_opairs, &opairs, FLAGS_allow_negative_labels); + std::unique_ptr osyms_relabel( + RelabelSymbolTable(fst->OutputSymbols(), opairs)); + fst->SetOutputSymbols(osyms_relabel.get()); + } + + if (FLAGS_verify && !s::Verify(*fst)) return 1; + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstsymbols.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstsymbols.cc new file mode 100644 index 0000000..62085fe --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstsymbols.cc @@ -0,0 +1,20 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +DEFINE_string(isymbols, "", "Input label symbol table"); +DEFINE_string(osymbols, "", "Output label symbol table"); +DEFINE_bool(clear_isymbols, false, "Clear input symbol table"); +DEFINE_bool(clear_osymbols, false, "Clear output symbol table"); +DEFINE_string(relabel_ipairs, "", "Input relabel pairs (numeric)"); +DEFINE_string(relabel_opairs, "", "Output relabel pairs (numeric)"); +DEFINE_string(save_isymbols, "", "Save fst file's input symbol table to file"); +DEFINE_string(save_osymbols, "", "Save fst file's output symbol table to file"); +DEFINE_bool(allow_negative_labels, false, + "Allow negative labels (not recommended; may cause conflicts)"); +DEFINE_bool(verify, false, "Verify fst properities before saving"); + +int fstsymbols_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstsymbols_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstsynchronize-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstsynchronize-main.cc new file mode 100644 index 0000000..fe23093 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstsynchronize-main.cc @@ -0,0 +1,41 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Synchronizes an FST. + +#include + +#include +#include + +#include +#include + +int fstsynchronize_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Synchronizes an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + s::Synchronize(*ifst, &ofst); + + return !ofst.Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstsynchronize.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstsynchronize.cc new file mode 100644 index 0000000..a0525fc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstsynchronize.cc @@ -0,0 +1,6 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +int fstsynchronize_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstsynchronize_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fsttopsort-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fsttopsort-main.cc new file mode 100644 index 0000000..879d5dc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fsttopsort-main.cc @@ -0,0 +1,41 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Topologically sorts an FST. + +#include + +#include +#include + +#include +#include +#include + +int fsttopsort_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::MutableFstClass; + + string usage = "Topologically sorts an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = argc > 1 && strcmp(argv[1], "-") != 0 ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr fst(MutableFstClass::Read(in_name, true)); + if (!fst) return 1; + + bool acyclic = TopSort(fst.get()); + + if (!acyclic) LOG(WARNING) << argv[0] << ": Input FST is cyclic"; + + return !fst->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fsttopsort.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fsttopsort.cc new file mode 100644 index 0000000..68726c7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fsttopsort.cc @@ -0,0 +1,6 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +int fsttopsort_main(int argc, char **argv); + +int main(int argc, char **argv) { return fsttopsort_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstunion-main.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstunion-main.cc new file mode 100644 index 0000000..995d03e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstunion-main.cc @@ -0,0 +1,49 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Creates the union of two FSTs. + +#include + +#include +#include + +#include +#include +#include + +int fstunion_main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::MutableFstClass; + + string usage = "Creates the union of two FSTs.\n\n Usage: "; + usage += argv[0]; + usage += " in1.fst in2.fst [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") != 0 ? argv[1] : ""; + const string in2_name = strcmp(argv[2], "-") != 0 ? argv[2] : ""; + const string out_name = argc > 3 ? argv[3] : ""; + + if (in1_name == "" && in2_name == "") { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input"; + return 1; + } + + std::unique_ptr fst1(MutableFstClass::Read(in1_name, true)); + if (!fst1) return 1; + + std::unique_ptr fst2(FstClass::Read(in2_name)); + if (!fst2) return 1; + + s::Union(fst1.get(), *fst2); + + return !fst1->Write(out_name); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/bin/fstunion.cc b/runtime/onnxruntime/third_party/openfst/src/bin/fstunion.cc new file mode 100644 index 0000000..2aba499 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/bin/fstunion.cc @@ -0,0 +1,6 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +int fstunion_main(int argc, char **argv); + +int main(int argc, char **argv) { return fstunion_main(argc, argv); } diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/CMakeLists.txt new file mode 100644 index 0000000..63d275a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/CMakeLists.txt @@ -0,0 +1,46 @@ + +if(HAVE_COMPACT) + add_subdirectory(compact) +endif(HAVE_COMPACT) + +if(HAVE_COMPRESS) + add_subdirectory(compress) +endif(HAVE_COMPRESS) + +if(HAVE_CONST) + add_subdirectory(const) +endif(HAVE_CONST) + +if(HAVE_FAR OR HAVE_GRM) + add_subdirectory(far) +endif(HAVE_FAR OR HAVE_GRM) + +if(HAVE_LINEAR) + add_subdirectory(linear) +endif(HAVE_LINEAR) + +if(HAVE_LOOKAHEAD) + add_subdirectory(lookahead) +endif(HAVE_LOOKAHEAD) + +if(HAVE_MPDT OR HAVE_GRM) + add_subdirectory(mpdt) +endif(HAVE_MPDT OR HAVE_GRM) + +if(HAVE_NGRAM) + add_subdirectory(ngram) +endif(HAVE_NGRAM) + +#if(HAVE_PYTHON) +# add_subdirectory(far) +# add_subdirectory(python) +#endif(HAVE_PDT) +# +if(HAVE_PDT OR HAVE_MPDT OR HAVE_GRM) + add_subdirectory(pdt) +endif(HAVE_PDT OR HAVE_MPDT OR HAVE_GRM) + +if(HAVE_SPECIAL) + add_subdirectory(special) +endif(HAVE_SPECIAL) + diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/Makefile.am new file mode 100644 index 0000000..f42e078 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/Makefile.am @@ -0,0 +1,55 @@ +if HAVE_COMPACT +compactdir = compact +endif + +if HAVE_COMPRESS +compressdir = compress +endif + +if HAVE_CONST +constdir = const +endif + +if HAVE_FAR +fardir = far +endif + +if HAVE_GRM +fardir = far +pdtdir = pdt +mpdtdir = mpdt +endif + +if HAVE_LINEAR +lineardir = linear +endif + +if HAVE_LOOKAHEAD +lookaheaddir = lookahead +endif + +if HAVE_MPDT +pdtdir = pdt +mpdtdir = mpdt +endif + +if HAVE_NGRAM +ngramdir = ngram +endif + +if HAVE_PYTHON +fardir = far +pywrapfstdir = python +endif + +if HAVE_PDT +pdtdir = pdt +endif + +if HAVE_SPECIAL +specialdir = special +endif + +SUBDIRS = $(compactdir) $(compressdir) $(constdir) $(fardir) $(lineardir) \ + $(lookaheaddir) $(pdtdir) $(mpdtdir) $(ngramdir) $(pywrapfstdir) \ + $(specialdir) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/Makefile.in new file mode 100644 index 0000000..9d28508 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/Makefile.in @@ -0,0 +1,658 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/extensions +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = compact compress const far linear lookahead pdt mpdt \ + ngram python special +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@HAVE_COMPACT_TRUE@compactdir = compact +@HAVE_COMPRESS_TRUE@compressdir = compress +@HAVE_CONST_TRUE@constdir = const +@HAVE_FAR_TRUE@fardir = far +@HAVE_GRM_TRUE@fardir = far +@HAVE_PYTHON_TRUE@fardir = far +@HAVE_GRM_TRUE@pdtdir = pdt +@HAVE_MPDT_TRUE@pdtdir = pdt +@HAVE_PDT_TRUE@pdtdir = pdt +@HAVE_GRM_TRUE@mpdtdir = mpdt +@HAVE_MPDT_TRUE@mpdtdir = mpdt +@HAVE_LINEAR_TRUE@lineardir = linear +@HAVE_LOOKAHEAD_TRUE@lookaheaddir = lookahead +@HAVE_NGRAM_TRUE@ngramdir = ngram +@HAVE_PYTHON_TRUE@pywrapfstdir = python +@HAVE_SPECIAL_TRUE@specialdir = special +SUBDIRS = $(compactdir) $(compressdir) $(constdir) $(fardir) $(lineardir) \ + $(lookaheaddir) $(pdtdir) $(mpdtdir) $(ngramdir) $(pywrapfstdir) \ + $(specialdir) + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/CMakeLists.txt new file mode 100644 index 0000000..4d40a2f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/CMakeLists.txt @@ -0,0 +1,93 @@ +add_library(fstcompact + compact8_acceptor-fst.cc + compact8_string-fst.cc + compact8_unweighted-fst.cc + compact8_unweighted_acceptor-fst.cc + compact8_weighted_string-fst.cc + compact16_acceptor-fst.cc + compact16_string-fst.cc + compact16_unweighted-fst.cc + compact16_unweighted_acceptor-fst.cc + compact16_weighted_string-fst.cc + compact64_acceptor-fst.cc + compact64_string-fst.cc + compact64_unweighted-fst.cc + compact64_unweighted_acceptor-fst.cc + compact64_weighted_string-fst.cc +) + +target_link_libraries(fstcompact fst) +set_target_properties(fstcompact PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER compact +) + +install(TARGETS fstcompact + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib +) + +function (add_module _name) + add_library(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fst) + set_target_properties(${_name} PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS true + FOLDER compact/modules + ) + endif() + + #set_target_properties(${_name} PROPERTIES SOVERSION "1") + install(TARGETS ${_name} + LIBRARY DESTINATION lib/fst + ARCHIVE DESTINATION lib/fst + RUNTIME DESTINATION lib/fst) +endfunction() + +add_module(compact8_acceptor-fst MODULE + compact8_acceptor-fst.cc) + +add_module(compact8_string-fst MODULE + compact8_string-fst.cc) + +add_module(compact8_unweighted-fst MODULE + compact8_unweighted-fst.cc) + +add_module(compact8_unweighted_acceptor-fst MODULE + compact8_unweighted_acceptor-fst.cc) + +add_module(compact8_weighted_string-fst MODULE + compact8_weighted_string-fst.cc) + +add_module(compact16_acceptor-fst MODULE + compact16_acceptor-fst.cc) + +add_module(compact16_string-fst MODULE + compact16_string-fst.cc) + +add_module(compact16_unweighted-fst MODULE + compact16_unweighted-fst.cc) + +add_module(compact16_unweighted_acceptor-fst MODULE + compact16_unweighted_acceptor-fst.cc) + +add_module(compact16_weighted_string-fst MODULE + compact16_weighted_string-fst.cc) + +add_module(compact64_acceptor-fst MODULE + compact64_acceptor-fst.cc) + +add_module(compact64_string-fst MODULE + compact64_string-fst.cc) + +add_module(compact64_unweighted-fst MODULE + compact64_unweighted-fst.cc) + +add_module(compact64_unweighted_acceptor-fst MODULE + compact64_unweighted_acceptor-fst.cc) + +add_module(compact64_weighted_string-fst MODULE + compact64_weighted_string-fst.cc) + + diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/Makefile.am new file mode 100644 index 0000000..cc28550 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/Makefile.am @@ -0,0 +1,55 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +libfstdir = @libfstdir@ +libfst_LTLIBRARIES = compact8_acceptor-fst.la compact8_string-fst.la compact8_unweighted-fst.la compact8_unweighted_acceptor-fst.la compact8_weighted_string-fst.la compact16_acceptor-fst.la compact16_string-fst.la compact16_unweighted-fst.la compact16_unweighted_acceptor-fst.la compact16_weighted_string-fst.la compact64_acceptor-fst.la compact64_string-fst.la compact64_unweighted-fst.la compact64_unweighted_acceptor-fst.la compact64_weighted_string-fst.la + +lib_LTLIBRARIES = libfstcompact.la + +libfstcompact_la_SOURCES = compact8_acceptor-fst.cc compact8_string-fst.cc compact8_unweighted-fst.cc compact8_unweighted_acceptor-fst.cc compact8_weighted_string-fst.cc compact16_acceptor-fst.cc compact16_string-fst.cc compact16_unweighted-fst.cc compact16_unweighted_acceptor-fst.cc compact16_weighted_string-fst.cc compact64_acceptor-fst.cc compact64_string-fst.cc compact64_unweighted-fst.cc compact64_unweighted_acceptor-fst.cc compact64_weighted_string-fst.cc +libfstcompact_la_LDFLAGS = -version-info 16:0:0 +libfstcompact_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) + +compact8_acceptor_fst_la_SOURCES = compact8_acceptor-fst.cc +compact8_acceptor_fst_la_LDFLAGS = -module + +compact8_string_fst_la_SOURCES = compact8_string-fst.cc +compact8_string_fst_la_LDFLAGS = -module + +compact8_unweighted_fst_la_SOURCES = compact8_unweighted-fst.cc +compact8_unweighted_fst_la_LDFLAGS = -module + +compact8_unweighted_acceptor_fst_la_SOURCES = compact8_unweighted_acceptor-fst.cc +compact8_unweighted_acceptor_fst_la_LDFLAGS = -module + +compact8_weighted_string_fst_la_SOURCES = compact8_weighted_string-fst.cc +compact8_weighted_string_fst_la_LDFLAGS = -module + +compact16_acceptor_fst_la_SOURCES = compact16_acceptor-fst.cc +compact16_acceptor_fst_la_LDFLAGS = -module + +compact16_string_fst_la_SOURCES = compact16_string-fst.cc +compact16_string_fst_la_LDFLAGS = -module + +compact16_unweighted_fst_la_SOURCES = compact16_unweighted-fst.cc +compact16_unweighted_fst_la_LDFLAGS = -module + +compact16_unweighted_acceptor_fst_la_SOURCES = compact16_unweighted_acceptor-fst.cc +compact16_unweighted_acceptor_fst_la_LDFLAGS = -module + +compact16_weighted_string_fst_la_SOURCES = compact16_weighted_string-fst.cc +compact16_weighted_string_fst_la_LDFLAGS = -module + +compact64_acceptor_fst_la_SOURCES = compact64_acceptor-fst.cc +compact64_acceptor_fst_la_LDFLAGS = -module + +compact64_string_fst_la_SOURCES = compact64_string-fst.cc +compact64_string_fst_la_LDFLAGS = -module + +compact64_unweighted_fst_la_SOURCES = compact64_unweighted-fst.cc +compact64_unweighted_fst_la_LDFLAGS = -module + +compact64_unweighted_acceptor_fst_la_SOURCES = compact64_unweighted_acceptor-fst.cc +compact64_unweighted_acceptor_fst_la_LDFLAGS = -module + +compact64_weighted_string_fst_la_SOURCES = compact64_weighted_string-fst.cc +compact64_weighted_string_fst_la_LDFLAGS = -module diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/Makefile.in new file mode 100644 index 0000000..bcb292f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/Makefile.in @@ -0,0 +1,966 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/extensions/compact +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(libfst_LTLIBRARIES) +compact16_acceptor_fst_la_LIBADD = +am_compact16_acceptor_fst_la_OBJECTS = compact16_acceptor-fst.lo +compact16_acceptor_fst_la_OBJECTS = \ + $(am_compact16_acceptor_fst_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +compact16_acceptor_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact16_acceptor_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +compact16_string_fst_la_LIBADD = +am_compact16_string_fst_la_OBJECTS = compact16_string-fst.lo +compact16_string_fst_la_OBJECTS = \ + $(am_compact16_string_fst_la_OBJECTS) +compact16_string_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(compact16_string_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +compact16_unweighted_fst_la_LIBADD = +am_compact16_unweighted_fst_la_OBJECTS = compact16_unweighted-fst.lo +compact16_unweighted_fst_la_OBJECTS = \ + $(am_compact16_unweighted_fst_la_OBJECTS) +compact16_unweighted_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact16_unweighted_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +compact16_unweighted_acceptor_fst_la_LIBADD = +am_compact16_unweighted_acceptor_fst_la_OBJECTS = \ + compact16_unweighted_acceptor-fst.lo +compact16_unweighted_acceptor_fst_la_OBJECTS = \ + $(am_compact16_unweighted_acceptor_fst_la_OBJECTS) +compact16_unweighted_acceptor_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) \ + --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact16_unweighted_acceptor_fst_la_LDFLAGS) $(LDFLAGS) -o \ + $@ +compact16_weighted_string_fst_la_LIBADD = +am_compact16_weighted_string_fst_la_OBJECTS = \ + compact16_weighted_string-fst.lo +compact16_weighted_string_fst_la_OBJECTS = \ + $(am_compact16_weighted_string_fst_la_OBJECTS) +compact16_weighted_string_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) \ + --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact16_weighted_string_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +compact64_acceptor_fst_la_LIBADD = +am_compact64_acceptor_fst_la_OBJECTS = compact64_acceptor-fst.lo +compact64_acceptor_fst_la_OBJECTS = \ + $(am_compact64_acceptor_fst_la_OBJECTS) +compact64_acceptor_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact64_acceptor_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +compact64_string_fst_la_LIBADD = +am_compact64_string_fst_la_OBJECTS = compact64_string-fst.lo +compact64_string_fst_la_OBJECTS = \ + $(am_compact64_string_fst_la_OBJECTS) +compact64_string_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(compact64_string_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +compact64_unweighted_fst_la_LIBADD = +am_compact64_unweighted_fst_la_OBJECTS = compact64_unweighted-fst.lo +compact64_unweighted_fst_la_OBJECTS = \ + $(am_compact64_unweighted_fst_la_OBJECTS) +compact64_unweighted_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact64_unweighted_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +compact64_unweighted_acceptor_fst_la_LIBADD = +am_compact64_unweighted_acceptor_fst_la_OBJECTS = \ + compact64_unweighted_acceptor-fst.lo +compact64_unweighted_acceptor_fst_la_OBJECTS = \ + $(am_compact64_unweighted_acceptor_fst_la_OBJECTS) +compact64_unweighted_acceptor_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) \ + --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact64_unweighted_acceptor_fst_la_LDFLAGS) $(LDFLAGS) -o \ + $@ +compact64_weighted_string_fst_la_LIBADD = +am_compact64_weighted_string_fst_la_OBJECTS = \ + compact64_weighted_string-fst.lo +compact64_weighted_string_fst_la_OBJECTS = \ + $(am_compact64_weighted_string_fst_la_OBJECTS) +compact64_weighted_string_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) \ + --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact64_weighted_string_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +compact8_acceptor_fst_la_LIBADD = +am_compact8_acceptor_fst_la_OBJECTS = compact8_acceptor-fst.lo +compact8_acceptor_fst_la_OBJECTS = \ + $(am_compact8_acceptor_fst_la_OBJECTS) +compact8_acceptor_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(compact8_acceptor_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +compact8_string_fst_la_LIBADD = +am_compact8_string_fst_la_OBJECTS = compact8_string-fst.lo +compact8_string_fst_la_OBJECTS = $(am_compact8_string_fst_la_OBJECTS) +compact8_string_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(compact8_string_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +compact8_unweighted_fst_la_LIBADD = +am_compact8_unweighted_fst_la_OBJECTS = compact8_unweighted-fst.lo +compact8_unweighted_fst_la_OBJECTS = \ + $(am_compact8_unweighted_fst_la_OBJECTS) +compact8_unweighted_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact8_unweighted_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +compact8_unweighted_acceptor_fst_la_LIBADD = +am_compact8_unweighted_acceptor_fst_la_OBJECTS = \ + compact8_unweighted_acceptor-fst.lo +compact8_unweighted_acceptor_fst_la_OBJECTS = \ + $(am_compact8_unweighted_acceptor_fst_la_OBJECTS) +compact8_unweighted_acceptor_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) \ + --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact8_unweighted_acceptor_fst_la_LDFLAGS) $(LDFLAGS) -o \ + $@ +compact8_weighted_string_fst_la_LIBADD = +am_compact8_weighted_string_fst_la_OBJECTS = \ + compact8_weighted_string-fst.lo +compact8_weighted_string_fst_la_OBJECTS = \ + $(am_compact8_weighted_string_fst_la_OBJECTS) +compact8_weighted_string_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(compact8_weighted_string_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +am__DEPENDENCIES_1 = +libfstcompact_la_DEPENDENCIES = ../../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am_libfstcompact_la_OBJECTS = compact8_acceptor-fst.lo \ + compact8_string-fst.lo compact8_unweighted-fst.lo \ + compact8_unweighted_acceptor-fst.lo \ + compact8_weighted_string-fst.lo compact16_acceptor-fst.lo \ + compact16_string-fst.lo compact16_unweighted-fst.lo \ + compact16_unweighted_acceptor-fst.lo \ + compact16_weighted_string-fst.lo compact64_acceptor-fst.lo \ + compact64_string-fst.lo compact64_unweighted-fst.lo \ + compact64_unweighted_acceptor-fst.lo \ + compact64_weighted_string-fst.lo +libfstcompact_la_OBJECTS = $(am_libfstcompact_la_OBJECTS) +libfstcompact_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstcompact_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(compact16_acceptor_fst_la_SOURCES) \ + $(compact16_string_fst_la_SOURCES) \ + $(compact16_unweighted_fst_la_SOURCES) \ + $(compact16_unweighted_acceptor_fst_la_SOURCES) \ + $(compact16_weighted_string_fst_la_SOURCES) \ + $(compact64_acceptor_fst_la_SOURCES) \ + $(compact64_string_fst_la_SOURCES) \ + $(compact64_unweighted_fst_la_SOURCES) \ + $(compact64_unweighted_acceptor_fst_la_SOURCES) \ + $(compact64_weighted_string_fst_la_SOURCES) \ + $(compact8_acceptor_fst_la_SOURCES) \ + $(compact8_string_fst_la_SOURCES) \ + $(compact8_unweighted_fst_la_SOURCES) \ + $(compact8_unweighted_acceptor_fst_la_SOURCES) \ + $(compact8_weighted_string_fst_la_SOURCES) \ + $(libfstcompact_la_SOURCES) +DIST_SOURCES = $(compact16_acceptor_fst_la_SOURCES) \ + $(compact16_string_fst_la_SOURCES) \ + $(compact16_unweighted_fst_la_SOURCES) \ + $(compact16_unweighted_acceptor_fst_la_SOURCES) \ + $(compact16_weighted_string_fst_la_SOURCES) \ + $(compact64_acceptor_fst_la_SOURCES) \ + $(compact64_string_fst_la_SOURCES) \ + $(compact64_unweighted_fst_la_SOURCES) \ + $(compact64_unweighted_acceptor_fst_la_SOURCES) \ + $(compact64_weighted_string_fst_la_SOURCES) \ + $(compact8_acceptor_fst_la_SOURCES) \ + $(compact8_string_fst_la_SOURCES) \ + $(compact8_unweighted_fst_la_SOURCES) \ + $(compact8_unweighted_acceptor_fst_la_SOURCES) \ + $(compact8_weighted_string_fst_la_SOURCES) \ + $(libfstcompact_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +libfst_LTLIBRARIES = compact8_acceptor-fst.la compact8_string-fst.la compact8_unweighted-fst.la compact8_unweighted_acceptor-fst.la compact8_weighted_string-fst.la compact16_acceptor-fst.la compact16_string-fst.la compact16_unweighted-fst.la compact16_unweighted_acceptor-fst.la compact16_weighted_string-fst.la compact64_acceptor-fst.la compact64_string-fst.la compact64_unweighted-fst.la compact64_unweighted_acceptor-fst.la compact64_weighted_string-fst.la +lib_LTLIBRARIES = libfstcompact.la +libfstcompact_la_SOURCES = compact8_acceptor-fst.cc compact8_string-fst.cc compact8_unweighted-fst.cc compact8_unweighted_acceptor-fst.cc compact8_weighted_string-fst.cc compact16_acceptor-fst.cc compact16_string-fst.cc compact16_unweighted-fst.cc compact16_unweighted_acceptor-fst.cc compact16_weighted_string-fst.cc compact64_acceptor-fst.cc compact64_string-fst.cc compact64_unweighted-fst.cc compact64_unweighted_acceptor-fst.cc compact64_weighted_string-fst.cc +libfstcompact_la_LDFLAGS = -version-info 16:0:0 +libfstcompact_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +compact8_acceptor_fst_la_SOURCES = compact8_acceptor-fst.cc +compact8_acceptor_fst_la_LDFLAGS = -module +compact8_string_fst_la_SOURCES = compact8_string-fst.cc +compact8_string_fst_la_LDFLAGS = -module +compact8_unweighted_fst_la_SOURCES = compact8_unweighted-fst.cc +compact8_unweighted_fst_la_LDFLAGS = -module +compact8_unweighted_acceptor_fst_la_SOURCES = compact8_unweighted_acceptor-fst.cc +compact8_unweighted_acceptor_fst_la_LDFLAGS = -module +compact8_weighted_string_fst_la_SOURCES = compact8_weighted_string-fst.cc +compact8_weighted_string_fst_la_LDFLAGS = -module +compact16_acceptor_fst_la_SOURCES = compact16_acceptor-fst.cc +compact16_acceptor_fst_la_LDFLAGS = -module +compact16_string_fst_la_SOURCES = compact16_string-fst.cc +compact16_string_fst_la_LDFLAGS = -module +compact16_unweighted_fst_la_SOURCES = compact16_unweighted-fst.cc +compact16_unweighted_fst_la_LDFLAGS = -module +compact16_unweighted_acceptor_fst_la_SOURCES = compact16_unweighted_acceptor-fst.cc +compact16_unweighted_acceptor_fst_la_LDFLAGS = -module +compact16_weighted_string_fst_la_SOURCES = compact16_weighted_string-fst.cc +compact16_weighted_string_fst_la_LDFLAGS = -module +compact64_acceptor_fst_la_SOURCES = compact64_acceptor-fst.cc +compact64_acceptor_fst_la_LDFLAGS = -module +compact64_string_fst_la_SOURCES = compact64_string-fst.cc +compact64_string_fst_la_LDFLAGS = -module +compact64_unweighted_fst_la_SOURCES = compact64_unweighted-fst.cc +compact64_unweighted_fst_la_LDFLAGS = -module +compact64_unweighted_acceptor_fst_la_SOURCES = compact64_unweighted_acceptor-fst.cc +compact64_unweighted_acceptor_fst_la_LDFLAGS = -module +compact64_weighted_string_fst_la_SOURCES = compact64_weighted_string-fst.cc +compact64_weighted_string_fst_la_LDFLAGS = -module +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/compact/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/compact/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-libfstLTLIBRARIES: $(libfst_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libfstdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libfstdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libfstdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libfstdir)"; \ + } + +uninstall-libfstLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libfstdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libfstdir)/$$f"; \ + done + +clean-libfstLTLIBRARIES: + -test -z "$(libfst_LTLIBRARIES)" || rm -f $(libfst_LTLIBRARIES) + @list='$(libfst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +compact16_acceptor-fst.la: $(compact16_acceptor_fst_la_OBJECTS) $(compact16_acceptor_fst_la_DEPENDENCIES) $(EXTRA_compact16_acceptor_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact16_acceptor_fst_la_LINK) -rpath $(libfstdir) $(compact16_acceptor_fst_la_OBJECTS) $(compact16_acceptor_fst_la_LIBADD) $(LIBS) + +compact16_string-fst.la: $(compact16_string_fst_la_OBJECTS) $(compact16_string_fst_la_DEPENDENCIES) $(EXTRA_compact16_string_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact16_string_fst_la_LINK) -rpath $(libfstdir) $(compact16_string_fst_la_OBJECTS) $(compact16_string_fst_la_LIBADD) $(LIBS) + +compact16_unweighted-fst.la: $(compact16_unweighted_fst_la_OBJECTS) $(compact16_unweighted_fst_la_DEPENDENCIES) $(EXTRA_compact16_unweighted_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact16_unweighted_fst_la_LINK) -rpath $(libfstdir) $(compact16_unweighted_fst_la_OBJECTS) $(compact16_unweighted_fst_la_LIBADD) $(LIBS) + +compact16_unweighted_acceptor-fst.la: $(compact16_unweighted_acceptor_fst_la_OBJECTS) $(compact16_unweighted_acceptor_fst_la_DEPENDENCIES) $(EXTRA_compact16_unweighted_acceptor_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact16_unweighted_acceptor_fst_la_LINK) -rpath $(libfstdir) $(compact16_unweighted_acceptor_fst_la_OBJECTS) $(compact16_unweighted_acceptor_fst_la_LIBADD) $(LIBS) + +compact16_weighted_string-fst.la: $(compact16_weighted_string_fst_la_OBJECTS) $(compact16_weighted_string_fst_la_DEPENDENCIES) $(EXTRA_compact16_weighted_string_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact16_weighted_string_fst_la_LINK) -rpath $(libfstdir) $(compact16_weighted_string_fst_la_OBJECTS) $(compact16_weighted_string_fst_la_LIBADD) $(LIBS) + +compact64_acceptor-fst.la: $(compact64_acceptor_fst_la_OBJECTS) $(compact64_acceptor_fst_la_DEPENDENCIES) $(EXTRA_compact64_acceptor_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact64_acceptor_fst_la_LINK) -rpath $(libfstdir) $(compact64_acceptor_fst_la_OBJECTS) $(compact64_acceptor_fst_la_LIBADD) $(LIBS) + +compact64_string-fst.la: $(compact64_string_fst_la_OBJECTS) $(compact64_string_fst_la_DEPENDENCIES) $(EXTRA_compact64_string_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact64_string_fst_la_LINK) -rpath $(libfstdir) $(compact64_string_fst_la_OBJECTS) $(compact64_string_fst_la_LIBADD) $(LIBS) + +compact64_unweighted-fst.la: $(compact64_unweighted_fst_la_OBJECTS) $(compact64_unweighted_fst_la_DEPENDENCIES) $(EXTRA_compact64_unweighted_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact64_unweighted_fst_la_LINK) -rpath $(libfstdir) $(compact64_unweighted_fst_la_OBJECTS) $(compact64_unweighted_fst_la_LIBADD) $(LIBS) + +compact64_unweighted_acceptor-fst.la: $(compact64_unweighted_acceptor_fst_la_OBJECTS) $(compact64_unweighted_acceptor_fst_la_DEPENDENCIES) $(EXTRA_compact64_unweighted_acceptor_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact64_unweighted_acceptor_fst_la_LINK) -rpath $(libfstdir) $(compact64_unweighted_acceptor_fst_la_OBJECTS) $(compact64_unweighted_acceptor_fst_la_LIBADD) $(LIBS) + +compact64_weighted_string-fst.la: $(compact64_weighted_string_fst_la_OBJECTS) $(compact64_weighted_string_fst_la_DEPENDENCIES) $(EXTRA_compact64_weighted_string_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact64_weighted_string_fst_la_LINK) -rpath $(libfstdir) $(compact64_weighted_string_fst_la_OBJECTS) $(compact64_weighted_string_fst_la_LIBADD) $(LIBS) + +compact8_acceptor-fst.la: $(compact8_acceptor_fst_la_OBJECTS) $(compact8_acceptor_fst_la_DEPENDENCIES) $(EXTRA_compact8_acceptor_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact8_acceptor_fst_la_LINK) -rpath $(libfstdir) $(compact8_acceptor_fst_la_OBJECTS) $(compact8_acceptor_fst_la_LIBADD) $(LIBS) + +compact8_string-fst.la: $(compact8_string_fst_la_OBJECTS) $(compact8_string_fst_la_DEPENDENCIES) $(EXTRA_compact8_string_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact8_string_fst_la_LINK) -rpath $(libfstdir) $(compact8_string_fst_la_OBJECTS) $(compact8_string_fst_la_LIBADD) $(LIBS) + +compact8_unweighted-fst.la: $(compact8_unweighted_fst_la_OBJECTS) $(compact8_unweighted_fst_la_DEPENDENCIES) $(EXTRA_compact8_unweighted_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact8_unweighted_fst_la_LINK) -rpath $(libfstdir) $(compact8_unweighted_fst_la_OBJECTS) $(compact8_unweighted_fst_la_LIBADD) $(LIBS) + +compact8_unweighted_acceptor-fst.la: $(compact8_unweighted_acceptor_fst_la_OBJECTS) $(compact8_unweighted_acceptor_fst_la_DEPENDENCIES) $(EXTRA_compact8_unweighted_acceptor_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact8_unweighted_acceptor_fst_la_LINK) -rpath $(libfstdir) $(compact8_unweighted_acceptor_fst_la_OBJECTS) $(compact8_unweighted_acceptor_fst_la_LIBADD) $(LIBS) + +compact8_weighted_string-fst.la: $(compact8_weighted_string_fst_la_OBJECTS) $(compact8_weighted_string_fst_la_DEPENDENCIES) $(EXTRA_compact8_weighted_string_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(compact8_weighted_string_fst_la_LINK) -rpath $(libfstdir) $(compact8_weighted_string_fst_la_OBJECTS) $(compact8_weighted_string_fst_la_LIBADD) $(LIBS) + +libfstcompact.la: $(libfstcompact_la_OBJECTS) $(libfstcompact_la_DEPENDENCIES) $(EXTRA_libfstcompact_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstcompact_la_LINK) -rpath $(libdir) $(libfstcompact_la_OBJECTS) $(libfstcompact_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact16_acceptor-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact16_string-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact16_unweighted-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact16_unweighted_acceptor-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact16_weighted_string-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact64_acceptor-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact64_string-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact64_unweighted-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact64_unweighted_acceptor-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact64_weighted_string-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact8_acceptor-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact8_string-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact8_unweighted-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact8_unweighted_acceptor-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compact8_weighted_string-fst.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libfstLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libfstLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-libfstLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libfstLTLIBRARIES clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libfstLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-libfstLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_acceptor-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_acceptor-fst.cc new file mode 100644 index 0000000..fa15beb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_acceptor-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactAcceptorFst_StdArc_uint16_registerer; + +static FstRegisterer> + CompactAcceptorFst_LogArc_uint16_registerer; + +static FstRegisterer> + CompactAcceptorFst_Log64Arc_uint16_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_string-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_string-fst.cc new file mode 100644 index 0000000..1bb013e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_string-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactStringFst_StdArc_uint16_registerer; + +static FstRegisterer> + CompactStringFst_LogArc_uint16_registerer; + +static FstRegisterer> + CompactStringFst_Log64Arc_uint16_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_unweighted-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_unweighted-fst.cc new file mode 100644 index 0000000..95b72c6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_unweighted-fst.cc @@ -0,0 +1,19 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactUnweightedFst_StdArc_uint16_registerer; + +static FstRegisterer> + CompactUnweightedFst_LogArc_uint16_registerer; + +static FstRegisterer> + CompactUnweightedFst_Log64Arc_uint16_registerer; + + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_unweighted_acceptor-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_unweighted_acceptor-fst.cc new file mode 100644 index 0000000..533a0a1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_unweighted_acceptor-fst.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_StdArc_uint16_registerer; + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_LogArc_uint16_registerer; + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_Log64Arc_uint16_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_weighted_string-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_weighted_string-fst.cc new file mode 100644 index 0000000..27daceb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact16_weighted_string-fst.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_StdArc_uint16_registerer; + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_LogArc_uint16_registerer; + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_Log64Arc_uint16_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_acceptor-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_acceptor-fst.cc new file mode 100644 index 0000000..951d0f7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_acceptor-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactAcceptorFst_StdArc_uint64_registerer; + +static FstRegisterer> + CompactAcceptorFst_LogArc_uint64_registerer; + +static FstRegisterer> + CompactAcceptorFst_Log64Arc_uint64_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_string-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_string-fst.cc new file mode 100644 index 0000000..ab77014 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_string-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactStringFst_StdArc_uint64_registerer; + +static FstRegisterer> + CompactStringFst_LogArc_uint64_registerer; + +static FstRegisterer> + CompactStringFst_Log64Arc_uint64_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_unweighted-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_unweighted-fst.cc new file mode 100644 index 0000000..366a00f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_unweighted-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactUnweightedFst_StdArc_uint64_registerer; + +static FstRegisterer> + CompactUnweightedFst_LogArc_uint64_registerer; + +static FstRegisterer> + CompactUnweightedFst_Log64Arc_uint64_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_unweighted_acceptor-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_unweighted_acceptor-fst.cc new file mode 100644 index 0000000..db819db --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_unweighted_acceptor-fst.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_StdArc_uint64_registerer; + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_LogArc_uint64_registerer; + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_Log64Arc_uint64_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_weighted_string-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_weighted_string-fst.cc new file mode 100644 index 0000000..001af1b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact64_weighted_string-fst.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_StdArc_uint64_registerer; + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_LogArc_uint64_registerer; + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_Log64Arc_uint64_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_acceptor-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_acceptor-fst.cc new file mode 100644 index 0000000..7da949e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_acceptor-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactAcceptorFst_StdArc_uint8_registerer; + +static FstRegisterer> + CompactAcceptorFst_LogArc_uint8_registerer; + +static FstRegisterer> + CompactAcceptorFst_Log64Arc_uint8_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_string-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_string-fst.cc new file mode 100644 index 0000000..d97d02f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_string-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactStringFst_StdArc_uint8_registerer; + +static FstRegisterer> + CompactStringFst_LogArc_uint8_registerer; + +static FstRegisterer> + CompactStringFst_Log64Arc_uint8_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_unweighted-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_unweighted-fst.cc new file mode 100644 index 0000000..19ce43a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_unweighted-fst.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + CompactUnweightedFst_StdArc_uint8_registerer; + +static FstRegisterer> + CompactUnweightedFst_LogArc_uint8_registerer; + +static FstRegisterer> + CompactUnweightedFst_Log64Arc_uint8_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_unweighted_acceptor-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_unweighted_acceptor-fst.cc new file mode 100644 index 0000000..72ae73e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_unweighted_acceptor-fst.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_StdArc_uint8_registerer; + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_LogArc_uint8_registerer; + +static FstRegisterer< + CompactUnweightedAcceptorFst> + CompactUnweightedAcceptorFst_Log64Arc_uint8_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_weighted_string-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_weighted_string-fst.cc new file mode 100644 index 0000000..0c92127 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compact/compact8_weighted_string-fst.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_StdArc_uint8_registerer; + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_LogArc_uint8_registerer; + +static FstRegisterer< + CompactWeightedStringFst> + CompactWeightedStringFst_Log64Arc_uint8_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compress/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/CMakeLists.txt new file mode 100644 index 0000000..9274c74 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/CMakeLists.txt @@ -0,0 +1,52 @@ +file(GLOB HEADER_FILES ../../include/fst/extensions/compress/*.h) +message(STATUS "${HEADER_FILES}") + +add_library(fstcompressscript + compress-script.cc + ${HEADER_FILES} + ) + +target_link_libraries(fstcompressscript + fstscript + fst + ${ZLIBS} +) +set_target_properties(fstcompressscript PROPERTIES + SOVERSION "${SOVERSION}" +) +install(TARGETS fstcompressscript + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib + ) + +if(HAVE_BIN) + add_executable(fstcompress + fstcompress.cc) + + target_link_libraries(fstcompress + fstcompressscript + fstscript + fst + ${ZLIBS} + ${CMAKE_DL_LIBS} + ) + + add_executable(fstrandmod + fstrandmod.cc + ) + + target_link_libraries(fstrandmod + fstcompressscript + fstscript + fst + ${ZLIBS} + ${CMAKE_DL_LIBS} + ) + + install(TARGETS fstcompress fstrandmod + LIBRARY DESTINATION bin + ARCHIVE DESTINATION bin + RUNTIME DESTINATION bin + ) +endif(HAVE_BIN) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compress/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/Makefile.am new file mode 100644 index 0000000..af715ae --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/Makefile.am @@ -0,0 +1,25 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +if HAVE_BIN +bin_PROGRAMS = fstcompress fstrandmod + +LDADD = libfstcompressscript.la \ + ../../script/libfstscript.la \ + ../../lib/libfst.la \ + -lm $(DL_LIBS) + +fstcompress_SOURCES = fstcompress.cc +fstrandmod_SOURCES = fstrandmod.cc +endif + +if HAVE_SCRIPT +libfstcompressscript_la_SOURCES = compress-script.cc +libfstcompressscript_la_LDFLAGS = -version-info 16:0:0 +libfstcompressscript_la_LIBADD = \ + ../../script/libfstscript.la \ + ../../lib/libfst.la -lz -lm $(DL_LIBS) +endif + +if HAVE_SCRIPT +lib_LTLIBRARIES = libfstcompressscript.la +endif diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compress/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/Makefile.in new file mode 100644 index 0000000..b5fa35d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/Makefile.in @@ -0,0 +1,769 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_BIN_TRUE@bin_PROGRAMS = fstcompress$(EXEEXT) fstrandmod$(EXEEXT) +subdir = src/extensions/compress +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +@HAVE_SCRIPT_TRUE@libfstcompressscript_la_DEPENDENCIES = \ +@HAVE_SCRIPT_TRUE@ ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__libfstcompressscript_la_SOURCES_DIST = compress-script.cc +@HAVE_SCRIPT_TRUE@am_libfstcompressscript_la_OBJECTS = \ +@HAVE_SCRIPT_TRUE@ compress-script.lo +libfstcompressscript_la_OBJECTS = \ + $(am_libfstcompressscript_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstcompressscript_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstcompressscript_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_TRUE@am_libfstcompressscript_la_rpath = -rpath $(libdir) +PROGRAMS = $(bin_PROGRAMS) +am__fstcompress_SOURCES_DIST = fstcompress.cc +@HAVE_BIN_TRUE@am_fstcompress_OBJECTS = fstcompress.$(OBJEXT) +fstcompress_OBJECTS = $(am_fstcompress_OBJECTS) +fstcompress_LDADD = $(LDADD) +@HAVE_BIN_TRUE@fstcompress_DEPENDENCIES = libfstcompressscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstrandmod_SOURCES_DIST = fstrandmod.cc +@HAVE_BIN_TRUE@am_fstrandmod_OBJECTS = fstrandmod.$(OBJEXT) +fstrandmod_OBJECTS = $(am_fstrandmod_OBJECTS) +fstrandmod_LDADD = $(LDADD) +@HAVE_BIN_TRUE@fstrandmod_DEPENDENCIES = libfstcompressscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstcompressscript_la_SOURCES) $(fstcompress_SOURCES) \ + $(fstrandmod_SOURCES) +DIST_SOURCES = $(am__libfstcompressscript_la_SOURCES_DIST) \ + $(am__fstcompress_SOURCES_DIST) $(am__fstrandmod_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +@HAVE_BIN_TRUE@LDADD = libfstcompressscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la \ +@HAVE_BIN_TRUE@ -lm $(DL_LIBS) + +@HAVE_BIN_TRUE@fstcompress_SOURCES = fstcompress.cc +@HAVE_BIN_TRUE@fstrandmod_SOURCES = fstrandmod.cc +@HAVE_SCRIPT_TRUE@libfstcompressscript_la_SOURCES = compress-script.cc +@HAVE_SCRIPT_TRUE@libfstcompressscript_la_LDFLAGS = -version-info 16:0:0 +@HAVE_SCRIPT_TRUE@libfstcompressscript_la_LIBADD = \ +@HAVE_SCRIPT_TRUE@ ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la -lz -lm $(DL_LIBS) + +@HAVE_SCRIPT_TRUE@lib_LTLIBRARIES = libfstcompressscript.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/compress/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/compress/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstcompressscript.la: $(libfstcompressscript_la_OBJECTS) $(libfstcompressscript_la_DEPENDENCIES) $(EXTRA_libfstcompressscript_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstcompressscript_la_LINK) $(am_libfstcompressscript_la_rpath) $(libfstcompressscript_la_OBJECTS) $(libfstcompressscript_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +fstcompress$(EXEEXT): $(fstcompress_OBJECTS) $(fstcompress_DEPENDENCIES) $(EXTRA_fstcompress_DEPENDENCIES) + @rm -f fstcompress$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstcompress_OBJECTS) $(fstcompress_LDADD) $(LIBS) + +fstrandmod$(EXEEXT): $(fstrandmod_OBJECTS) $(fstrandmod_DEPENDENCIES) $(EXTRA_fstrandmod_DEPENDENCIES) + @rm -f fstrandmod$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstrandmod_OBJECTS) $(fstrandmod_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress-script.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstcompress.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstrandmod.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compress/compress-script.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/compress-script.cc new file mode 100644 index 0000000..85225a4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/compress-script.cc @@ -0,0 +1,39 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Definitions of 'scriptable' versions of compression operations, that is, +// those that can be called with FstClass-type arguments. +// +// See comments in nlp/fst/script/script-impl.h for how the registration +// mechanism allows these to work with various arc types. + +#include + +#include +#include + +namespace fst { +namespace script { + +void Compress(const FstClass &fst, const string &filename, const bool gzip) { + CompressArgs args(fst, filename, gzip); + Apply>("Compress", fst.ArcType(), &args); +} + +void Decompress(const string &filename, MutableFstClass *fst, const bool gzip) { + DecompressArgs args(filename, fst, gzip); + Apply>("Decompress", fst->ArcType(), &args); +} + +// Register operations for common arc types. + +REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs); +REGISTER_FST_OPERATION(Compress, LogArc, CompressArgs); +REGISTER_FST_OPERATION(Compress, Log64Arc, CompressArgs); + +REGISTER_FST_OPERATION(Decompress, StdArc, DecompressArgs); +REGISTER_FST_OPERATION(Decompress, LogArc, DecompressArgs); +REGISTER_FST_OPERATION(Decompress, Log64Arc, DecompressArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compress/fstcompress.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/fstcompress.cc new file mode 100644 index 0000000..38d3209 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/fstcompress.cc @@ -0,0 +1,55 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Compresses/decompresses an FST. + +#include +#include +#include + +#include +#include +#include +#include +#include + +DEFINE_string(arc_type, "standard", "Output arc type"); +DEFINE_bool(decode, false, "Decode"); +DEFINE_bool(gzip, false, + "Applies gzip compression after LZA compression and " + "gzip decompression before LZA decompression " + "(recommended)" + ""); + +int main(int argc, char **argv) { + namespace s = fst::script; + + using s::FstClass; + using s::VectorFstClass; + + string usage = "Compresses/decompresses an FST.\n\n Usage: "; + usage += argv[0]; + usage += " [in.fst [out.fstz]]\n"; + usage += " --decode [in.fstz [out.fst]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + string in_name = (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + string out_name = argc > 2 ? argv[2] : ""; + + if (FLAGS_decode == false) { + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + s::Compress(*ifst, out_name, FLAGS_gzip); + } else { + VectorFstClass ofst(FLAGS_arc_type); + s::Decompress(in_name, &ofst, FLAGS_gzip); + ofst.Write(out_name); + } + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/compress/fstrandmod.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/fstrandmod.cc new file mode 100644 index 0000000..17f5ba0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/compress/fstrandmod.cc @@ -0,0 +1,58 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Generates a random FST according to a class-specific transition model. + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +DEFINE_int32(seed, time(0), "Random seed"); +DEFINE_int32(states, 10, "# of states"); +DEFINE_int32(labels, 2, "# of labels"); +DEFINE_int32(classes, 1, "# of probability distributions"); +DEFINE_bool(transducer, false, "Output a transducer"); +DEFINE_bool(weights, false, "Output a weighted FST"); + +int main(int argc, char **argv) { + using fst::StdVectorFst; + using fst::StdArc; + using fst::TropicalWeight; + using fst::WeightGenerate; + + string usage = "Generates a random FST.\n\n Usage: "; + usage += argv[0]; + usage += "[out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 2) { + ShowUsage(); + return 1; + } + + string out_name = (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + + srand(FLAGS_seed); + + int num_states = (rand() % FLAGS_states) + 1; // NOLINT + int num_classes = (rand() % FLAGS_classes) + 1; // NOLINT + int num_labels = (rand() % FLAGS_labels) + 1; // NOLINT + + StdVectorFst fst; + using TropicalWeightGenerate = WeightGenerate; + std::unique_ptr generate(FLAGS_weights ? + new TropicalWeightGenerate(false) : nullptr); + fst::RandMod rand_mod(num_states, + num_classes, num_labels, FLAGS_transducer, generate.get()); + rand_mod.Generate(&fst); + fst.Write(out_name); + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/const/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/const/CMakeLists.txt new file mode 100644 index 0000000..834b707 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/const/CMakeLists.txt @@ -0,0 +1,35 @@ +function (add_module _name) + add_library(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fst) + set_target_properties(${_name} PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS true + FOLDER constant/modules + ) + endif() + + install(TARGETS ${_name} LIBRARY DESTINATION lib/fst) +endfunction() + + +add_module(const8-fst MODULE const8-fst.cc) + +add_module(const16-fst MODULE const16-fst.cc) + +add_module(const64-fst MODULE const64-fst.cc) + +add_library(fstconst + const8-fst.cc + const16-fst.cc + const64-fst.cc) +target_link_libraries(fstconst fst) +set_target_properties(fstconst PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER constant +) + +install(TARGETS fstconst + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib + ) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/const/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/const/Makefile.am new file mode 100644 index 0000000..4ad7ab0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/const/Makefile.am @@ -0,0 +1,19 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +libfstdir = @libfstdir@ +libfst_LTLIBRARIES = const8-fst.la const16-fst.la const64-fst.la + +lib_LTLIBRARIES = libfstconst.la + +libfstconst_la_SOURCES = const8-fst.cc const16-fst.cc const64-fst.cc +libfstconst_la_LDFLAGS = -version-info 16:0:0 -lm $(DL_LIBS) +libfstconst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) + +const8_fst_la_SOURCES = const8-fst.cc +const8_fst_la_LDFLAGS = -module + +const16_fst_la_SOURCES = const16-fst.cc +const16_fst_la_LDFLAGS = -module + +const64_fst_la_SOURCES = const64-fst.cc +const64_fst_la_LDFLAGS = -module diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/const/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/const/Makefile.in new file mode 100644 index 0000000..21e369f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/const/Makefile.in @@ -0,0 +1,751 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/extensions/const +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(libfst_LTLIBRARIES) +const16_fst_la_LIBADD = +am_const16_fst_la_OBJECTS = const16-fst.lo +const16_fst_la_OBJECTS = $(am_const16_fst_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +const16_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(const16_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +const64_fst_la_LIBADD = +am_const64_fst_la_OBJECTS = const64-fst.lo +const64_fst_la_OBJECTS = $(am_const64_fst_la_OBJECTS) +const64_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(const64_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +const8_fst_la_LIBADD = +am_const8_fst_la_OBJECTS = const8-fst.lo +const8_fst_la_OBJECTS = $(am_const8_fst_la_OBJECTS) +const8_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(const8_fst_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__DEPENDENCIES_1 = +libfstconst_la_DEPENDENCIES = ../../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am_libfstconst_la_OBJECTS = const8-fst.lo const16-fst.lo \ + const64-fst.lo +libfstconst_la_OBJECTS = $(am_libfstconst_la_OBJECTS) +libfstconst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstconst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(const16_fst_la_SOURCES) $(const64_fst_la_SOURCES) \ + $(const8_fst_la_SOURCES) $(libfstconst_la_SOURCES) +DIST_SOURCES = $(const16_fst_la_SOURCES) $(const64_fst_la_SOURCES) \ + $(const8_fst_la_SOURCES) $(libfstconst_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +libfst_LTLIBRARIES = const8-fst.la const16-fst.la const64-fst.la +lib_LTLIBRARIES = libfstconst.la +libfstconst_la_SOURCES = const8-fst.cc const16-fst.cc const64-fst.cc +libfstconst_la_LDFLAGS = -version-info 16:0:0 -lm $(DL_LIBS) +libfstconst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +const8_fst_la_SOURCES = const8-fst.cc +const8_fst_la_LDFLAGS = -module +const16_fst_la_SOURCES = const16-fst.cc +const16_fst_la_LDFLAGS = -module +const64_fst_la_SOURCES = const64-fst.cc +const64_fst_la_LDFLAGS = -module +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/const/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/const/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-libfstLTLIBRARIES: $(libfst_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libfstdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libfstdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libfstdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libfstdir)"; \ + } + +uninstall-libfstLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libfstdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libfstdir)/$$f"; \ + done + +clean-libfstLTLIBRARIES: + -test -z "$(libfst_LTLIBRARIES)" || rm -f $(libfst_LTLIBRARIES) + @list='$(libfst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +const16-fst.la: $(const16_fst_la_OBJECTS) $(const16_fst_la_DEPENDENCIES) $(EXTRA_const16_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(const16_fst_la_LINK) -rpath $(libfstdir) $(const16_fst_la_OBJECTS) $(const16_fst_la_LIBADD) $(LIBS) + +const64-fst.la: $(const64_fst_la_OBJECTS) $(const64_fst_la_DEPENDENCIES) $(EXTRA_const64_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(const64_fst_la_LINK) -rpath $(libfstdir) $(const64_fst_la_OBJECTS) $(const64_fst_la_LIBADD) $(LIBS) + +const8-fst.la: $(const8_fst_la_OBJECTS) $(const8_fst_la_DEPENDENCIES) $(EXTRA_const8_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(const8_fst_la_LINK) -rpath $(libfstdir) $(const8_fst_la_OBJECTS) $(const8_fst_la_LIBADD) $(LIBS) + +libfstconst.la: $(libfstconst_la_OBJECTS) $(libfstconst_la_DEPENDENCIES) $(EXTRA_libfstconst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstconst_la_LINK) -rpath $(libdir) $(libfstconst_la_OBJECTS) $(libfstconst_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const16-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const64-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const8-fst.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libfstLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libfstLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-libfstLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libfstLTLIBRARIES clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libfstLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-libfstLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/const/const16-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/const/const16-fst.cc new file mode 100644 index 0000000..b6859fb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/const/const16-fst.cc @@ -0,0 +1,16 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + ConstFst_StdArc_uint16_registerer; +static FstRegisterer> + ConstFst_LogArc_uint16_registerer; +static FstRegisterer> + ConstFst_Log64Arc_uint16_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/const/const64-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/const/const64-fst.cc new file mode 100644 index 0000000..9f059bf --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/const/const64-fst.cc @@ -0,0 +1,16 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> + ConstFst_StdArc_uint64_registerer; +static FstRegisterer> + ConstFst_LogArc_uint64_registerer; +static FstRegisterer> + ConstFst_Log64Arc_uint64_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/const/const8-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/const/const8-fst.cc new file mode 100644 index 0000000..04b8064 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/const/const8-fst.cc @@ -0,0 +1,14 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer> ConstFst_StdArc_uint8_registerer; +static FstRegisterer> ConstFst_LogArc_uint8_registerer; +static FstRegisterer> + ConstFst_Log64Arc_uint8_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/far/CMakeLists.txt new file mode 100644 index 0000000..38930a3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/CMakeLists.txt @@ -0,0 +1,62 @@ +file(GLOB HEADER_FILES ../../include/fst/extensions/far/*.h) +message(STATUS "${HEADER_FILES}") + +add_library(fstfar + sttable.cc + stlist.cc + ${HEADER_FILES} +) +target_link_libraries(fstfar fst) +set_target_properties(fstfar PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER far +) + +install(TARGETS fstfar + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib +) + +if(HAVE_SCRIPT) + add_library(fstfarscript + far-class.cc + farscript.cc + getters.cc + script-impl.cc + strings.cc + ) + target_link_libraries(fstfarscript fstfar fstscript fst) + set_target_properties(fstfarscript PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER far + ) + + install(TARGETS fstfarscript + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib + ) +endif(HAVE_SCRIPT) + +if(HAVE_BIN) + function (add_executable2 _name) + add_executable(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fstfarscript fstscript fst ${CMAKE_DL_LIBS}) + set_target_properties(${_name} PROPERTIES FOLDER far/bin) + endif() + install(TARGETS ${_name} RUNTIME DESTINATION bin) + endfunction() + + add_executable2(farcompilestrings farcompilestrings.cc) + add_executable2(farcreate farcreate.cc) + add_executable2(farequal farequal.cc) + add_executable2(farextract farextract.cc) + add_executable2(farinfo farinfo.cc) + add_executable2(farisomorphic farisomorphic.cc) + add_executable2(farprintstrings farprintstrings.cc) +endif(HAVE_BIN) + + + diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/far/Makefile.am new file mode 100644 index 0000000..7a7c985 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/Makefile.am @@ -0,0 +1,42 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +if HAVE_SCRIPT +lib_LTLIBRARIES = libfstfar.la libfstfarscript.la +else +lib_LTLIBRARIES = libfstfar.la +endif + +libfstfar_la_SOURCES = sttable.cc stlist.cc +libfstfar_la_LDFLAGS = -version-info 16:0:0 +libfstfar_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) + +if HAVE_SCRIPT +libfstfarscript_la_SOURCES = far-class.cc farscript.cc getters.cc script-impl.cc \ + strings.cc +libfstfarscript_la_LDFLAGS = -version-info 16:0:0 +libfstfarscript_la_LIBADD = \ + libfstfar.la ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) +endif + +if HAVE_BIN +bin_PROGRAMS = farcompilestrings farcreate farequal farextract farinfo \ + farisomorphic farprintstrings + +LDADD = libfstfarscript.la ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) + +farcompilestrings_SOURCES = farcompilestrings.cc + +farcreate_SOURCES = farcreate.cc + +farequal_SOURCES = farequal.cc + +farextract_SOURCES = farextract.cc + +farinfo_SOURCES = farinfo.cc + +farisomorphic_SOURCES = farisomorphic.cc + +farprintstrings_SOURCES = farprintstrings.cc +endif diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/far/Makefile.in new file mode 100644 index 0000000..4e1623c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/Makefile.in @@ -0,0 +1,867 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_BIN_TRUE@bin_PROGRAMS = farcompilestrings$(EXEEXT) \ +@HAVE_BIN_TRUE@ farcreate$(EXEEXT) farequal$(EXEEXT) \ +@HAVE_BIN_TRUE@ farextract$(EXEEXT) farinfo$(EXEEXT) \ +@HAVE_BIN_TRUE@ farisomorphic$(EXEEXT) farprintstrings$(EXEEXT) +subdir = src/extensions/far +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libfstfar_la_DEPENDENCIES = ../../lib/libfst.la $(am__DEPENDENCIES_1) +am_libfstfar_la_OBJECTS = sttable.lo stlist.lo +libfstfar_la_OBJECTS = $(am_libfstfar_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstfar_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(libfstfar_la_LDFLAGS) $(LDFLAGS) -o $@ +@HAVE_SCRIPT_FALSE@am_libfstfar_la_rpath = -rpath $(libdir) +@HAVE_SCRIPT_TRUE@am_libfstfar_la_rpath = -rpath $(libdir) +@HAVE_SCRIPT_TRUE@libfstfarscript_la_DEPENDENCIES = libfstfar.la \ +@HAVE_SCRIPT_TRUE@ ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__libfstfarscript_la_SOURCES_DIST = far-class.cc farscript.cc \ + getters.cc script-impl.cc strings.cc +@HAVE_SCRIPT_TRUE@am_libfstfarscript_la_OBJECTS = far-class.lo \ +@HAVE_SCRIPT_TRUE@ farscript.lo getters.lo script-impl.lo \ +@HAVE_SCRIPT_TRUE@ strings.lo +libfstfarscript_la_OBJECTS = $(am_libfstfarscript_la_OBJECTS) +libfstfarscript_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstfarscript_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_TRUE@am_libfstfarscript_la_rpath = -rpath $(libdir) +PROGRAMS = $(bin_PROGRAMS) +am__farcompilestrings_SOURCES_DIST = farcompilestrings.cc +@HAVE_BIN_TRUE@am_farcompilestrings_OBJECTS = \ +@HAVE_BIN_TRUE@ farcompilestrings.$(OBJEXT) +farcompilestrings_OBJECTS = $(am_farcompilestrings_OBJECTS) +farcompilestrings_LDADD = $(LDADD) +@HAVE_BIN_TRUE@farcompilestrings_DEPENDENCIES = libfstfarscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__farcreate_SOURCES_DIST = farcreate.cc +@HAVE_BIN_TRUE@am_farcreate_OBJECTS = farcreate.$(OBJEXT) +farcreate_OBJECTS = $(am_farcreate_OBJECTS) +farcreate_LDADD = $(LDADD) +@HAVE_BIN_TRUE@farcreate_DEPENDENCIES = libfstfarscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__farequal_SOURCES_DIST = farequal.cc +@HAVE_BIN_TRUE@am_farequal_OBJECTS = farequal.$(OBJEXT) +farequal_OBJECTS = $(am_farequal_OBJECTS) +farequal_LDADD = $(LDADD) +@HAVE_BIN_TRUE@farequal_DEPENDENCIES = libfstfarscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__farextract_SOURCES_DIST = farextract.cc +@HAVE_BIN_TRUE@am_farextract_OBJECTS = farextract.$(OBJEXT) +farextract_OBJECTS = $(am_farextract_OBJECTS) +farextract_LDADD = $(LDADD) +@HAVE_BIN_TRUE@farextract_DEPENDENCIES = libfstfarscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__farinfo_SOURCES_DIST = farinfo.cc +@HAVE_BIN_TRUE@am_farinfo_OBJECTS = farinfo.$(OBJEXT) +farinfo_OBJECTS = $(am_farinfo_OBJECTS) +farinfo_LDADD = $(LDADD) +@HAVE_BIN_TRUE@farinfo_DEPENDENCIES = libfstfarscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__farisomorphic_SOURCES_DIST = farisomorphic.cc +@HAVE_BIN_TRUE@am_farisomorphic_OBJECTS = farisomorphic.$(OBJEXT) +farisomorphic_OBJECTS = $(am_farisomorphic_OBJECTS) +farisomorphic_LDADD = $(LDADD) +@HAVE_BIN_TRUE@farisomorphic_DEPENDENCIES = libfstfarscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__farprintstrings_SOURCES_DIST = farprintstrings.cc +@HAVE_BIN_TRUE@am_farprintstrings_OBJECTS = farprintstrings.$(OBJEXT) +farprintstrings_OBJECTS = $(am_farprintstrings_OBJECTS) +farprintstrings_LDADD = $(LDADD) +@HAVE_BIN_TRUE@farprintstrings_DEPENDENCIES = libfstfarscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstfar_la_SOURCES) $(libfstfarscript_la_SOURCES) \ + $(farcompilestrings_SOURCES) $(farcreate_SOURCES) \ + $(farequal_SOURCES) $(farextract_SOURCES) $(farinfo_SOURCES) \ + $(farisomorphic_SOURCES) $(farprintstrings_SOURCES) +DIST_SOURCES = $(libfstfar_la_SOURCES) \ + $(am__libfstfarscript_la_SOURCES_DIST) \ + $(am__farcompilestrings_SOURCES_DIST) \ + $(am__farcreate_SOURCES_DIST) $(am__farequal_SOURCES_DIST) \ + $(am__farextract_SOURCES_DIST) $(am__farinfo_SOURCES_DIST) \ + $(am__farisomorphic_SOURCES_DIST) \ + $(am__farprintstrings_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +@HAVE_SCRIPT_FALSE@lib_LTLIBRARIES = libfstfar.la +@HAVE_SCRIPT_TRUE@lib_LTLIBRARIES = libfstfar.la libfstfarscript.la +libfstfar_la_SOURCES = sttable.cc stlist.cc +libfstfar_la_LDFLAGS = -version-info 16:0:0 +libfstfar_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +@HAVE_SCRIPT_TRUE@libfstfarscript_la_SOURCES = far-class.cc farscript.cc getters.cc script-impl.cc \ +@HAVE_SCRIPT_TRUE@ strings.cc + +@HAVE_SCRIPT_TRUE@libfstfarscript_la_LDFLAGS = -version-info 16:0:0 +@HAVE_SCRIPT_TRUE@libfstfarscript_la_LIBADD = \ +@HAVE_SCRIPT_TRUE@ libfstfar.la ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +@HAVE_BIN_TRUE@LDADD = libfstfarscript.la ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +@HAVE_BIN_TRUE@farcompilestrings_SOURCES = farcompilestrings.cc +@HAVE_BIN_TRUE@farcreate_SOURCES = farcreate.cc +@HAVE_BIN_TRUE@farequal_SOURCES = farequal.cc +@HAVE_BIN_TRUE@farextract_SOURCES = farextract.cc +@HAVE_BIN_TRUE@farinfo_SOURCES = farinfo.cc +@HAVE_BIN_TRUE@farisomorphic_SOURCES = farisomorphic.cc +@HAVE_BIN_TRUE@farprintstrings_SOURCES = farprintstrings.cc +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/far/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/far/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstfar.la: $(libfstfar_la_OBJECTS) $(libfstfar_la_DEPENDENCIES) $(EXTRA_libfstfar_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstfar_la_LINK) $(am_libfstfar_la_rpath) $(libfstfar_la_OBJECTS) $(libfstfar_la_LIBADD) $(LIBS) + +libfstfarscript.la: $(libfstfarscript_la_OBJECTS) $(libfstfarscript_la_DEPENDENCIES) $(EXTRA_libfstfarscript_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstfarscript_la_LINK) $(am_libfstfarscript_la_rpath) $(libfstfarscript_la_OBJECTS) $(libfstfarscript_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +farcompilestrings$(EXEEXT): $(farcompilestrings_OBJECTS) $(farcompilestrings_DEPENDENCIES) $(EXTRA_farcompilestrings_DEPENDENCIES) + @rm -f farcompilestrings$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(farcompilestrings_OBJECTS) $(farcompilestrings_LDADD) $(LIBS) + +farcreate$(EXEEXT): $(farcreate_OBJECTS) $(farcreate_DEPENDENCIES) $(EXTRA_farcreate_DEPENDENCIES) + @rm -f farcreate$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(farcreate_OBJECTS) $(farcreate_LDADD) $(LIBS) + +farequal$(EXEEXT): $(farequal_OBJECTS) $(farequal_DEPENDENCIES) $(EXTRA_farequal_DEPENDENCIES) + @rm -f farequal$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(farequal_OBJECTS) $(farequal_LDADD) $(LIBS) + +farextract$(EXEEXT): $(farextract_OBJECTS) $(farextract_DEPENDENCIES) $(EXTRA_farextract_DEPENDENCIES) + @rm -f farextract$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(farextract_OBJECTS) $(farextract_LDADD) $(LIBS) + +farinfo$(EXEEXT): $(farinfo_OBJECTS) $(farinfo_DEPENDENCIES) $(EXTRA_farinfo_DEPENDENCIES) + @rm -f farinfo$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(farinfo_OBJECTS) $(farinfo_LDADD) $(LIBS) + +farisomorphic$(EXEEXT): $(farisomorphic_OBJECTS) $(farisomorphic_DEPENDENCIES) $(EXTRA_farisomorphic_DEPENDENCIES) + @rm -f farisomorphic$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(farisomorphic_OBJECTS) $(farisomorphic_LDADD) $(LIBS) + +farprintstrings$(EXEEXT): $(farprintstrings_OBJECTS) $(farprintstrings_DEPENDENCIES) $(EXTRA_farprintstrings_DEPENDENCIES) + @rm -f farprintstrings$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(farprintstrings_OBJECTS) $(farprintstrings_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/far-class.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farcompilestrings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farcreate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farequal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farextract.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farisomorphic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farprintstrings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/farscript.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getters.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script-impl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strings.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sttable.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/far-class.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/far-class.cc new file mode 100644 index 0000000..e6ac495 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/far-class.cc @@ -0,0 +1,56 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include +#include + +namespace fst { +namespace script { + + +// FarReaderClass. + +FarReaderClass *FarReaderClass::Open(const string &filename) { + const std::vector filenames{filename}; + return FarReaderClass::Open(filenames); +} + +FarReaderClass *FarReaderClass::Open(const std::vector &filenames) { + if (filenames.empty()) { + LOG(ERROR) << "FarReaderClass::Open: No files specified"; + return nullptr; + } + const auto arc_type = LoadArcTypeFromFar(filenames.front()); + if (arc_type.empty()) return nullptr; + OpenFarReaderClassArgs args(filenames); + args.retval = nullptr; + Apply>("OpenFarReaderClass", arc_type, + &args); + return args.retval; +} + +REGISTER_FST_OPERATION(OpenFarReaderClass, StdArc, OpenFarReaderClassArgs); +REGISTER_FST_OPERATION(OpenFarReaderClass, LogArc, OpenFarReaderClassArgs); +REGISTER_FST_OPERATION(OpenFarReaderClass, Log64Arc, OpenFarReaderClassArgs); + +// FarWriterClass. + +FarWriterClass *FarWriterClass::Create(const string &filename, + const string &arc_type, FarType type) { + CreateFarWriterClassInnerArgs iargs(filename, type); + CreateFarWriterClassArgs args(iargs); + args.retval = nullptr; + Apply>("CreateFarWriterClass", arc_type, + &args); + return args.retval; +} + +REGISTER_FST_OPERATION(CreateFarWriterClass, StdArc, CreateFarWriterClassArgs); +REGISTER_FST_OPERATION(CreateFarWriterClass, LogArc, CreateFarWriterClassArgs); +REGISTER_FST_OPERATION(CreateFarWriterClass, Log64Arc, + CreateFarWriterClassArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farcompilestrings.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farcompilestrings.cc new file mode 100644 index 0000000..d510f17 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farcompilestrings.cc @@ -0,0 +1,91 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Compiles a set of stings as FSTs and stores them in a finite-state archive. + +#include +#include + +#include +#include +#include +#include + +DEFINE_string(key_prefix, "", "Prefix to append to keys"); +DEFINE_string(key_suffix, "", "Suffix to append to keys"); +DEFINE_int32(generate_keys, 0, + "Generate N digit numeric keys (def: use file basenames)"); +DEFINE_string(far_type, "default", + "FAR file format type: one of: \"default\", \"fst\", " + "\"stlist\", \"sttable\""); +DEFINE_bool(allow_negative_labels, false, + "Allow negative labels (not recommended; may cause conflicts)"); +DEFINE_string(arc_type, "standard", "Output arc type"); +DEFINE_string(entry_type, "line", + "Entry type: one of : " + "\"file\" (one FST per file), \"line\" (one FST per line)"); +DEFINE_string(fst_type, "vector", "Output FST type"); +DEFINE_string(token_type, "symbol", + "Token type: one of : " + "\"symbol\", \"byte\", \"utf8\""); +DEFINE_string(symbols, "", "Label symbol table"); +DEFINE_string(unknown_symbol, "", ""); +DEFINE_bool(file_list_input, false, + "Each input file contains a list of files to be processed"); +DEFINE_bool(keep_symbols, false, "Store symbol table in the FAR file"); +DEFINE_bool(initial_symbols, true, + "When keep_symbols is true, stores symbol table only for the first" + " FST in archive."); + +int main(int argc, char **argv) { + namespace s = fst::script; + + string usage = "Compiles a set of strings as FSTs and stores them in"; + usage += " a finite-state archive.\n\n Usage:"; + usage += argv[0]; + usage += " [in1.txt [[in2.txt ...] out.far]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + s::ExpandArgs(argc, argv, &argc, &argv); + + std::vector in_fnames; + if (FLAGS_file_list_input) { + for (int i = 1; i < argc - 1; ++i) { + std::ifstream istrm(argv[i]); + string str; + while (getline(istrm, str)) in_fnames.push_back(str); + } + } else { + for (int i = 1; i < argc - 1; ++i) + in_fnames.push_back(argv[i]); + } + if (in_fnames.empty()) { + in_fnames.push_back(argc == 2 && strcmp(argv[1], "-") != 0 ? argv[1] : ""); + } + + string out_fname = + argc > 2 && strcmp(argv[argc - 1], "-") != 0 ? argv[argc - 1] : ""; + + fst::FarEntryType entry_type; + if (!s::GetFarEntryType(FLAGS_entry_type, &entry_type)) { + LOG(ERROR) << "Unknown or unsupported FAR entry type: " << FLAGS_entry_type; + return 1; + } + + fst::FarTokenType token_type; + if (!s::GetFarTokenType(FLAGS_token_type, &token_type)) { + LOG(ERROR) << "Unkonwn or unsupported FAR token type: " << FLAGS_token_type; + return 1; + } + + const auto far_type = s::GetFarType(FLAGS_far_type); + + s::FarCompileStrings(in_fnames, out_fname, FLAGS_arc_type, FLAGS_fst_type, + far_type, FLAGS_generate_keys, entry_type, token_type, + FLAGS_symbols, FLAGS_unknown_symbol, FLAGS_keep_symbols, + FLAGS_initial_symbols, FLAGS_allow_negative_labels, + FLAGS_key_prefix, FLAGS_key_suffix); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farcreate.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farcreate.cc new file mode 100644 index 0000000..1f26c64 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farcreate.cc @@ -0,0 +1,61 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Creates a finite-state archive from input FSTs. + +#include +#include + +#include +#include +#include +#include + +DEFINE_string(key_prefix, "", "Prefix to append to keys"); +DEFINE_string(key_suffix, "", "Suffix to append to keys"); +DEFINE_int32(generate_keys, 0, + "Generate N digit numeric keys (def: use file basenames)"); +DEFINE_string(far_type, "default", + "FAR file format type: one of: \"default\", " + "\"stlist\", \"sttable\""); +DEFINE_bool(file_list_input, false, + "Each input file contains a list of files to be processed"); + +int main(int argc, char **argv) { + namespace s = fst::script; + + string usage = "Creates a finite-state archive from input FSTs.\n\n Usage:"; + usage += argv[0]; + usage += " [in1.fst [[in2.fst ...] out.far]]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + s::ExpandArgs(argc, argv, &argc, &argv); + + std::vector in_fnames; + if (FLAGS_file_list_input) { + for (int i = 1; i < argc - 1; ++i) { + std::ifstream istrm(argv[i]); + string str; + while (getline(istrm, str)) in_fnames.push_back(str); + } + } else { + for (int i = 1; i < argc - 1; ++i) + in_fnames.push_back(argv[i]); + } + if (in_fnames.empty()) + in_fnames.push_back(argc == 2 && strcmp(argv[1], "-") != 0 ? argv[1] : ""); + + string out_fname = + argc > 2 && strcmp(argv[argc - 1], "-") != 0 ? argv[argc - 1] : ""; + + const auto arc_type = s::LoadArcTypeFromFst(in_fnames[0]); + if (arc_type.empty()) return 1; + + const auto far_type = s::GetFarType(FLAGS_far_type); + + s::FarCreate(in_fnames, out_fname, arc_type, FLAGS_generate_keys, far_type, + FLAGS_key_prefix, FLAGS_key_suffix); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farequal.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farequal.cc new file mode 100644 index 0000000..8b98faa --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farequal.cc @@ -0,0 +1,42 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Tests if two Far files contains the same (key,fst) pairs. + +#include + +#include +#include +#include + +DEFINE_string(begin_key, "", + "First key to extract (def: first key in archive)"); +DEFINE_string(end_key, "", "Last key to extract (def: last key in archive)"); +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); + +int main(int argc, char **argv) { + namespace s = fst::script; + + string usage = "Compares the FSTs in two FST archives for equality."; + usage += "\n\n Usage:"; + usage += argv[0]; + usage += " in1.far in2.far"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + s::ExpandArgs(argc, argv, &argc, &argv); + if (argc != 3) { + ShowUsage(); + return 1; + } + + const auto arc_type = s::LoadArcTypeFromFar(argv[1]); + if (arc_type.empty()) return 1; + + bool result = s::FarEqual(argv[1], argv[2], arc_type, FLAGS_delta, + FLAGS_begin_key, FLAGS_end_key); + + if (!result) VLOG(1) << "FARs are not equal."; + + return result ? 0 : 2; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farextract.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farextract.cc new file mode 100644 index 0000000..df40bd4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farextract.cc @@ -0,0 +1,46 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Extracts component FSTs from an finite-state archive. + +#include +#include + +#include +#include +#include + +DEFINE_string(filename_prefix, "", "Prefix to append to filenames"); +DEFINE_string(filename_suffix, "", "Suffix to append to filenames"); +DEFINE_int32(generate_filenames, 0, + "Generate N digit numeric filenames (def: use keys)"); +DEFINE_string(keys, "", + "Extract set of keys separated by comma (default) " + "including ranges delimited by dash (default)"); +DEFINE_string(key_separator, ",", "Separator for individual keys"); +DEFINE_string(range_delimiter, "-", "Delimiter for ranges of keys"); + +int main(int argc, char **argv) { + namespace s = fst::script; + + string usage = "Extracts FSTs from a finite-state archive.\n\n Usage:"; + usage += argv[0]; + usage += " [in1.far in2.far...]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + s::ExpandArgs(argc, argv, &argc, &argv); + + std::vector in_fnames; + for (int i = 1; i < argc; ++i) in_fnames.push_back(argv[i]); + if (in_fnames.empty()) in_fnames.push_back(""); + + const auto arc_type = s::LoadArcTypeFromFar(in_fnames[0]); + if (arc_type.empty()) return 1; + + s::FarExtract(in_fnames, arc_type, FLAGS_generate_filenames, FLAGS_keys, + FLAGS_key_separator, FLAGS_range_delimiter, + FLAGS_filename_prefix, FLAGS_filename_suffix); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farinfo.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farinfo.cc new file mode 100644 index 0000000..f004d3e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farinfo.cc @@ -0,0 +1,44 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prints some basic information about the FSTs in an FST archive. + +#include +#include + +#include +#include +#include + +DEFINE_string(begin_key, "", + "First key to extract (default: first key in archive)"); +DEFINE_string(end_key, "", + "Last key to extract (default: last key in archive)"); + +DEFINE_bool(list_fsts, false, "Display FST information for each key"); + +int main(int argc, char **argv) { + namespace s = fst::script; + + string usage = "Prints some basic information about the FSTs in an FST "; + usage += "archive.\n\n Usage:"; + usage += argv[0]; + usage += " [in1.far in2.far...]\n"; + usage += " Flags: begin_key end_key list_fsts"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + s::ExpandArgs(argc, argv, &argc, &argv); + + std::vector in_fnames; + for (int i = 1; i < argc; ++i) in_fnames.push_back(argv[i]); + if (in_fnames.empty()) in_fnames.push_back(""); + + const auto arc_type = s::LoadArcTypeFromFar(in_fnames[0]); + if (arc_type.empty()) return 1; + + s::FarInfo(in_fnames, arc_type, FLAGS_begin_key, FLAGS_end_key, + FLAGS_list_fsts); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farisomorphic.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farisomorphic.cc new file mode 100644 index 0000000..6efda1d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farisomorphic.cc @@ -0,0 +1,44 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Tests if two Far files contains isomorphic (key,fst) pairs. + +#include + +#include +#include +#include + +DEFINE_string(begin_key, "", + "First key to extract (def: first key in archive)"); +DEFINE_string(end_key, "", "Last key to extract (def: last key in archive)"); +DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta"); + +int main(int argc, char **argv) { + namespace s = fst::script; + + string usage = "Compares the FSTs in two FST archives for isomorphism."; + usage += "\n\n Usage:"; + usage += argv[0]; + usage += " in1.far in2.far\n"; + usage += " Flags: begin_key end_key"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + s::ExpandArgs(argc, argv, &argc, &argv); + + if (argc != 3) { + ShowUsage(); + return 1; + } + + const auto arc_type = s::LoadArcTypeFromFar(argv[1]); + if (arc_type.empty()) return 1; + + bool result = s::FarIsomorphic(argv[1], argv[2], arc_type, + FLAGS_delta, FLAGS_begin_key, FLAGS_end_key); + + if (!result) VLOG(1) << "FARs are not isomorphic."; + + return result ? 0 : 2; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farprintstrings.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farprintstrings.cc new file mode 100644 index 0000000..bcd5d45 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farprintstrings.cc @@ -0,0 +1,70 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Outputs as strings the string FSTs in a finite-state archive. + +#include +#include + +#include +#include +#include + +DEFINE_string(filename_prefix, "", "Prefix to append to filenames"); +DEFINE_string(filename_suffix, "", "Suffix to append to filenames"); +DEFINE_int32(generate_filenames, 0, + "Generate N digit numeric filenames (def: use keys)"); +DEFINE_string(begin_key, "", + "First key to extract (def: first key in archive)"); +DEFINE_string(end_key, "", "Last key to extract (def: last key in archive)"); +// PrintStringsMain specific flag definitions. +DEFINE_bool(print_key, false, "Prefix each string by its key"); +DEFINE_bool(print_weight, false, "Suffix each string by its weight"); +DEFINE_string(entry_type, "line", + "Entry type: one of : " + "\"file\" (one FST per file), \"line\" (one FST per line)"); +DEFINE_string(token_type, "symbol", + "Token type: one of : " + "\"symbol\", \"byte\", \"utf8\""); +DEFINE_string(symbols, "", "Label symbol table"); +DEFINE_bool(initial_symbols, true, + "Uses symbol table from the first Fst in archive for all entries."); + +int main(int argc, char **argv) { + namespace s = fst::script; + + string usage = "Print as string the string FSTs in an archive.\n\n Usage:"; + usage += argv[0]; + usage += " [in1.far in2.far ...]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + s::ExpandArgs(argc, argv, &argc, &argv); + + std::vector in_fnames; + for (int i = 1; i < argc; ++i) in_fnames.push_back(argv[i]); + if (in_fnames.empty()) in_fnames.push_back(""); + + const auto arc_type = s::LoadArcTypeFromFar(in_fnames[0]); + if (arc_type.empty()) return 1; + + fst::FarEntryType entry_type; + if (!s::GetFarEntryType(FLAGS_entry_type, &entry_type)) { + LOG(ERROR) << "Unknown or unsupported FAR entry type: " << FLAGS_entry_type; + return 1; + } + + fst::FarTokenType token_type; + if (!s::GetFarTokenType(FLAGS_token_type, &token_type)) { + LOG(ERROR) << "Unknown or unsupported FAR token type: " << FLAGS_token_type; + return 1; + } + + s::FarPrintStrings(in_fnames, arc_type, entry_type, token_type, + FLAGS_begin_key, FLAGS_end_key, FLAGS_print_key, + FLAGS_print_weight, FLAGS_symbols, FLAGS_initial_symbols, + FLAGS_generate_filenames, FLAGS_filename_prefix, + FLAGS_filename_suffix); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/farscript.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farscript.cc new file mode 100644 index 0000000..17c6c46 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/farscript.cc @@ -0,0 +1,102 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Definitions of 'scriptable' versions of FAR operations, that is, +// those that can be called with FstClass-type arguments. + +#include +#include +#include + +namespace fst { +namespace script { + +void FarCompileStrings(const std::vector &in_fnames, + const string &out_fname, const string &arc_type, + const string &fst_type, const FarType &far_type, + int32 generate_keys, FarEntryType fet, FarTokenType tt, + const string &symbols_fname, + const string &unknown_symbol, bool keep_symbols, + bool initial_symbols, bool allow_negative_labels, + const string &key_prefix, const string &key_suffix) { + FarCompileStringsArgs args(in_fnames, out_fname, fst_type, far_type, + generate_keys, fet, tt, symbols_fname, + unknown_symbol, keep_symbols, initial_symbols, + allow_negative_labels, key_prefix, key_suffix); + Apply>("FarCompileStrings", arc_type, &args); +} + +void FarCreate(const std::vector &in_fnames, const string &out_fname, + const string &arc_type, const int32 generate_keys, + const FarType &far_type, const string &key_prefix, + const string &key_suffix) { + FarCreateArgs args(in_fnames, out_fname, generate_keys, far_type, key_prefix, + key_suffix); + Apply>("FarCreate", arc_type, &args); +} + +bool FarEqual(const string &filename1, const string &filename2, + const string &arc_type, float delta, const string &begin_key, + const string &end_key) { + FarEqualInnerArgs args(filename1, filename2, delta, begin_key, end_key); + FarEqualArgs args_with_retval(args); + Apply>("FarEqual", arc_type, &args_with_retval); + return args_with_retval.retval; +} + +void FarExtract(const std::vector &ifilenames, const string &arc_type, + int32 generate_filenames, const string &keys, + const string &key_separator, const string &range_delimiter, + const string &filename_prefix, const string &filename_suffix) { + FarExtractArgs args(ifilenames, generate_filenames, keys, key_separator, + range_delimiter, filename_prefix, filename_suffix); + Apply>("FarExtract", arc_type, &args); +} + +void FarInfo(const std::vector &filenames, const string &arc_type, + const string &begin_key, const string &end_key, + const bool list_fsts) { + FarInfoArgs args(filenames, begin_key, end_key, list_fsts); + Apply>("FarInfo", arc_type, &args); +} + +void GetFarInfo(const std::vector &filenames, const string &arc_type, + const string &begin_key, const string &end_key, + const bool list_fsts, FarInfoData *data) { + GetFarInfoArgs args(filenames, begin_key, end_key, list_fsts, data); + Apply>("GetFarInfo", arc_type, &args); +} + +bool FarIsomorphic(const string &filename1, const string &filename2, + const string &arc_type, float delta, const string &begin_key, + const string &end_key) { + FarIsomorphicInnerArgs args(filename1, filename2, delta, begin_key, end_key); + FarIsomorphicArgs args_with_retval(args); + Apply>("FarIsomorphic", arc_type, + &args_with_retval); + return args_with_retval.retval; +} + +void FarPrintStrings(const std::vector &ifilenames, + const string &arc_type, const FarEntryType entry_type, + const FarTokenType token_type, const string &begin_key, + const string &end_key, const bool print_key, + const bool print_weight, const string &symbols_fname, + const bool initial_symbols, const int32 generate_filenames, + const string &filename_prefix, + const string &filename_suffix) { + FarPrintStringsArgs args(ifilenames, entry_type, token_type, begin_key, + end_key, print_key, print_weight, symbols_fname, + initial_symbols, generate_filenames, filename_prefix, + filename_suffix); + Apply>("FarPrintStrings", arc_type, &args); +} + +// Instantiate all templates for common arc types. + +REGISTER_FST_FAR_OPERATIONS(StdArc); +REGISTER_FST_FAR_OPERATIONS(LogArc); +REGISTER_FST_FAR_OPERATIONS(Log64Arc); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/getters.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/getters.cc new file mode 100644 index 0000000..a2ffe5f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/getters.cc @@ -0,0 +1,75 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// +// Definitions and functions for invoking and using Far main functions that +// support multiple and extensible arc types. + +#include + +#include +#include + +#include + +namespace fst { + +namespace script { + +FarType GetFarType(const string &str) { + if (str == "fst") { + return FAR_FST; + } else if (str == "stlist") { + return FAR_STLIST; + } else if (str == "sttable") { + return FAR_STTABLE; + } else { + return FAR_DEFAULT; + } +} + +bool GetFarEntryType(const string &str, FarEntryType *entry_type) { + if (str == "line") { + *entry_type = FET_LINE; + } else if (str == "file") { + *entry_type = FET_FILE; + } else { + return false; + } + return true; +} + +bool GetFarTokenType(const string &str, FarTokenType *token_type) { + if (str == "symbol") { + *token_type = FTT_SYMBOL; + } else if (str == "byte") { + *token_type = FTT_BYTE; + } else if (str == "utf8") { + *token_type = FTT_UTF8; + } else { + return false; + } + return true; +} + +void ExpandArgs(int argc, char **argv, int *argcp, char ***argvp) { +} + +} // namespace script + +string GetFarTypeString(FarType type) { + switch (type) { + case FAR_FST: + return "fst"; + case FAR_STLIST: + return "stlist"; + case FAR_STTABLE: + return "sttable"; + case FAR_DEFAULT: + return "default"; + default: + return ""; + } +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/script-impl.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/script-impl.cc new file mode 100644 index 0000000..6fd1331 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/script-impl.cc @@ -0,0 +1,42 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Definitions and functions for invoking and using Far main functions that +// support multiple and extensible arc types. + +#include + +#include + +#include +#include + +namespace fst { +namespace script { + +string LoadArcTypeFromFar(const string &far_fname) { + FarHeader hdr; + if (!hdr.Read(far_fname)) { + LOG(ERROR) << "Error reading FAR: " << far_fname; + return ""; + } + string atype = hdr.ArcType(); + if (atype == "unknown") { + LOG(ERROR) << "Empty FST archive: " << far_fname; + return ""; + } + return atype; +} + +string LoadArcTypeFromFst(const string &fst_fname) { + FstHeader hdr; + std::ifstream in(fst_fname, std::ios_base::in | std::ios_base::binary); + if (!hdr.Read(in, fst_fname)) { + LOG(ERROR) << "Error reading FST: " << fst_fname; + return ""; + } + return hdr.ArcType(); +} + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/stlist.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/stlist.cc new file mode 100644 index 0000000..89e4b90 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/stlist.cc @@ -0,0 +1,19 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include +#include + +namespace fst { + +bool IsSTList(const string &filename) { + std::ifstream strm(filename, std::ios_base::in | std::ios_base::binary); + if (!strm) return false; + int32 magic_number = 0; + ReadType(strm, &magic_number); + return magic_number == kSTListMagicNumber; +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/strings.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/strings.cc new file mode 100644 index 0000000..ad516d1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/strings.cc @@ -0,0 +1,28 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +#include +#include +#include + +DEFINE_string(far_field_separator, "\t", + "Set of characters used as a separator between printed fields"); + +namespace fst { + +// Computes the minimal length required to encode each line number as a decimal +// number. +int KeySize(const char *filename) { + std::ifstream istrm(filename); + istrm.seekg(0); + string s; + int nline = 0; + while (getline(istrm, s)) ++nline; + istrm.seekg(0); + return nline ? ceil(log10(nline + 1)) : 1; +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/far/sttable.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/far/sttable.cc new file mode 100644 index 0000000..bf7d4a2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/far/sttable.cc @@ -0,0 +1,18 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +bool IsSTTable(const string &filename) { + std::ifstream strm(filename); + if (!strm.good()) return false; + + int32 magic_number = 0; + ReadType(strm, &magic_number); + return magic_number == kSTTableMagicNumber; +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/CMakeLists.txt new file mode 100644 index 0000000..abf0af4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/CMakeLists.txt @@ -0,0 +1,71 @@ +file(GLOB HEADER_FILES ../../include/fst/extensions/linear/*.h) +message(STATUS "${HEADER_FILES}") + + +if(HAVE_SCRIPT) + add_library(fstlinearscript + linearscript.cc + ${HEADER_FILES} + ) + target_link_libraries(fstlinearscript + fstscript + fst + ) + set_target_properties(fstlinearscript PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER linear + ) + + install(TARGETS fstlinearscript + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib + ) +endif(HAVE_SCRIPT) + +if(HAVE_BIN) + add_executable(fstlinear + fstlinear.cc) + target_link_libraries(fstlinear + fstlinearscript + fstscript + fst + ${CMAKE_DL_LIBS} + ) + + add_executable(fstloglinearapply + fstloglinearapply.cc) + target_link_libraries(fstloglinearapply + fstlinearscript + fstscript + fst + ${CMAKE_DL_LIBS} + ) + install(TARGETS fstlinear fstloglinearapply + RUNTIME DESTINATION bin + ) + set_target_properties(fstlinear fstloglinearapply PROPERTIES + FOLDER linear/bin + ) +endif(HAVE_BIN) + + +function (add_module _name) + add_library(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fst) + set_target_properties(${_name} PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS true + FOLDER linear/modules + ) + endif() + + install(TARGETS ${_name} LIBRARY DESTINATION lib/fst) +endfunction() + +add_module(linear-tagger-fst MODULE + linear-tagger-fst.cc) + +add_module(linear-classifier-fst MODULE + linear-classifier-fst.cc) + diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/Makefile.am new file mode 100644 index 0000000..a7bbb1c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/Makefile.am @@ -0,0 +1,35 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +if HAVE_BIN +bin_PROGRAMS = fstlinear fstloglinearapply + +LDADD = libfstlinearscript.la ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) + +fstlinear_SOURCES = fstlinear.cc + +fstloglinearapply_SOURCES = fstloglinearapply.cc +endif + +if HAVE_SCRIPT +libfstlinearscript_la_SOURCES = linearscript.cc +libfstlinearscript_la_LDFLAGS = -version-info 16:0:0 -lm $(DL_LIBS) +libfstlinearscript_la_LIBADD = ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) +endif + +if HAVE_SCRIPT +libfst_LTLIBRARIES = linear_tagger-fst.la \ + linear_classifier-fst.la +lib_LTLIBRARIES = libfstlinearscript.la +else +libfst_LTLIBRARIES = linear_tagger-fst.la linear_classifier-fst.la +endif + +libfstdir = @libfstdir@ + +linear_tagger_fst_la_SOURCES = linear-tagger-fst.cc +linear_tagger_fst_la_LDFLAGS = -module + +linear_classifier_fst_la_SOURCES = linear-classifier-fst.cc +linear_classifier_fst_la_LDFLAGS = -module diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/Makefile.in new file mode 100644 index 0000000..dba29dc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/Makefile.in @@ -0,0 +1,845 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_BIN_TRUE@bin_PROGRAMS = fstlinear$(EXEEXT) \ +@HAVE_BIN_TRUE@ fstloglinearapply$(EXEEXT) +subdir = src/extensions/linear +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" \ + "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(libfst_LTLIBRARIES) +am__DEPENDENCIES_1 = +@HAVE_SCRIPT_TRUE@libfstlinearscript_la_DEPENDENCIES = \ +@HAVE_SCRIPT_TRUE@ ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__libfstlinearscript_la_SOURCES_DIST = linearscript.cc +@HAVE_SCRIPT_TRUE@am_libfstlinearscript_la_OBJECTS = linearscript.lo +libfstlinearscript_la_OBJECTS = $(am_libfstlinearscript_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstlinearscript_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstlinearscript_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_TRUE@am_libfstlinearscript_la_rpath = -rpath $(libdir) +linear_classifier_fst_la_LIBADD = +am_linear_classifier_fst_la_OBJECTS = linear-classifier-fst.lo +linear_classifier_fst_la_OBJECTS = \ + $(am_linear_classifier_fst_la_OBJECTS) +linear_classifier_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(linear_classifier_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_FALSE@am_linear_classifier_fst_la_rpath = -rpath \ +@HAVE_SCRIPT_FALSE@ $(libfstdir) +@HAVE_SCRIPT_TRUE@am_linear_classifier_fst_la_rpath = -rpath \ +@HAVE_SCRIPT_TRUE@ $(libfstdir) +linear_tagger_fst_la_LIBADD = +am_linear_tagger_fst_la_OBJECTS = linear-tagger-fst.lo +linear_tagger_fst_la_OBJECTS = $(am_linear_tagger_fst_la_OBJECTS) +linear_tagger_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(linear_tagger_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_FALSE@am_linear_tagger_fst_la_rpath = -rpath $(libfstdir) +@HAVE_SCRIPT_TRUE@am_linear_tagger_fst_la_rpath = -rpath $(libfstdir) +PROGRAMS = $(bin_PROGRAMS) +am__fstlinear_SOURCES_DIST = fstlinear.cc +@HAVE_BIN_TRUE@am_fstlinear_OBJECTS = fstlinear.$(OBJEXT) +fstlinear_OBJECTS = $(am_fstlinear_OBJECTS) +fstlinear_LDADD = $(LDADD) +@HAVE_BIN_TRUE@fstlinear_DEPENDENCIES = libfstlinearscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__fstloglinearapply_SOURCES_DIST = fstloglinearapply.cc +@HAVE_BIN_TRUE@am_fstloglinearapply_OBJECTS = \ +@HAVE_BIN_TRUE@ fstloglinearapply.$(OBJEXT) +fstloglinearapply_OBJECTS = $(am_fstloglinearapply_OBJECTS) +fstloglinearapply_LDADD = $(LDADD) +@HAVE_BIN_TRUE@fstloglinearapply_DEPENDENCIES = libfstlinearscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstlinearscript_la_SOURCES) \ + $(linear_classifier_fst_la_SOURCES) \ + $(linear_tagger_fst_la_SOURCES) $(fstlinear_SOURCES) \ + $(fstloglinearapply_SOURCES) +DIST_SOURCES = $(am__libfstlinearscript_la_SOURCES_DIST) \ + $(linear_classifier_fst_la_SOURCES) \ + $(linear_tagger_fst_la_SOURCES) $(am__fstlinear_SOURCES_DIST) \ + $(am__fstloglinearapply_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +@HAVE_BIN_TRUE@LDADD = libfstlinearscript.la ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +@HAVE_BIN_TRUE@fstlinear_SOURCES = fstlinear.cc +@HAVE_BIN_TRUE@fstloglinearapply_SOURCES = fstloglinearapply.cc +@HAVE_SCRIPT_TRUE@libfstlinearscript_la_SOURCES = linearscript.cc +@HAVE_SCRIPT_TRUE@libfstlinearscript_la_LDFLAGS = -version-info 16:0:0 -lm $(DL_LIBS) +@HAVE_SCRIPT_TRUE@libfstlinearscript_la_LIBADD = ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +@HAVE_SCRIPT_FALSE@libfst_LTLIBRARIES = linear_tagger-fst.la linear_classifier-fst.la +@HAVE_SCRIPT_TRUE@libfst_LTLIBRARIES = linear_tagger-fst.la \ +@HAVE_SCRIPT_TRUE@ linear_classifier-fst.la + +@HAVE_SCRIPT_TRUE@lib_LTLIBRARIES = libfstlinearscript.la +linear_tagger_fst_la_SOURCES = linear-tagger-fst.cc +linear_tagger_fst_la_LDFLAGS = -module +linear_classifier_fst_la_SOURCES = linear-classifier-fst.cc +linear_classifier_fst_la_LDFLAGS = -module +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/linear/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/linear/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-libfstLTLIBRARIES: $(libfst_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libfstdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libfstdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libfstdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libfstdir)"; \ + } + +uninstall-libfstLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libfstdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libfstdir)/$$f"; \ + done + +clean-libfstLTLIBRARIES: + -test -z "$(libfst_LTLIBRARIES)" || rm -f $(libfst_LTLIBRARIES) + @list='$(libfst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstlinearscript.la: $(libfstlinearscript_la_OBJECTS) $(libfstlinearscript_la_DEPENDENCIES) $(EXTRA_libfstlinearscript_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstlinearscript_la_LINK) $(am_libfstlinearscript_la_rpath) $(libfstlinearscript_la_OBJECTS) $(libfstlinearscript_la_LIBADD) $(LIBS) + +linear_classifier-fst.la: $(linear_classifier_fst_la_OBJECTS) $(linear_classifier_fst_la_DEPENDENCIES) $(EXTRA_linear_classifier_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(linear_classifier_fst_la_LINK) $(am_linear_classifier_fst_la_rpath) $(linear_classifier_fst_la_OBJECTS) $(linear_classifier_fst_la_LIBADD) $(LIBS) + +linear_tagger-fst.la: $(linear_tagger_fst_la_OBJECTS) $(linear_tagger_fst_la_DEPENDENCIES) $(EXTRA_linear_tagger_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(linear_tagger_fst_la_LINK) $(am_linear_tagger_fst_la_rpath) $(linear_tagger_fst_la_OBJECTS) $(linear_tagger_fst_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +fstlinear$(EXEEXT): $(fstlinear_OBJECTS) $(fstlinear_DEPENDENCIES) $(EXTRA_fstlinear_DEPENDENCIES) + @rm -f fstlinear$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstlinear_OBJECTS) $(fstlinear_LDADD) $(LIBS) + +fstloglinearapply$(EXEEXT): $(fstloglinearapply_OBJECTS) $(fstloglinearapply_DEPENDENCIES) $(EXTRA_fstloglinearapply_DEPENDENCIES) + @rm -f fstloglinearapply$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstloglinearapply_OBJECTS) $(fstloglinearapply_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstlinear.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstloglinearapply.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linear-classifier-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linear-tagger-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linearscript.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libfstLTLIBRARIES clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libfstLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ + uninstall-libfstLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libfstLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libfstLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-libLTLIBRARIES uninstall-libfstLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/fstlinear.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/fstlinear.cc new file mode 100644 index 0000000..502a385 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/fstlinear.cc @@ -0,0 +1,36 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include + +DEFINE_string(arc_type, "standard", "Output arc type"); + +DEFINE_string(epsilon_symbol, "", "Epsilon symbol"); +DEFINE_string(unknown_symbol, "", "Unknown word symbol"); + +DEFINE_string(vocab, "", "Path to the vocabulary file"); +DEFINE_string(out, "", "Path to the output binary"); + +DEFINE_string(save_isymbols, "", "Save input symbol table to file"); +DEFINE_string(save_fsymbols, "", "Save feature symbol table to file"); +DEFINE_string(save_osymbols, "", "Save output symbol table to file"); + +int main(int argc, char **argv) { + // TODO(wuke): more detailed usage + std::set_new_handler(FailedNewHandler); + SET_FLAGS(argv[0], &argc, &argv, true); + fst::script::ValidateDelimiter(); + fst::script::ValidateEmptySymbol(); + + if (argc == 1) { + ShowUsage(); + return 1; + } + + fst::script::LinearCompile(FLAGS_arc_type, FLAGS_epsilon_symbol, + FLAGS_unknown_symbol, FLAGS_vocab, argv + 1, + argc - 1, FLAGS_out, FLAGS_save_isymbols, + FLAGS_save_fsymbols, FLAGS_save_osymbols); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/fstloglinearapply.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/fstloglinearapply.cc new file mode 100644 index 0000000..69e269d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/fstloglinearapply.cc @@ -0,0 +1,51 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include +#include + +#include +#include + +DEFINE_bool(normalize, true, "Normalize to get posterior"); + +int main(int argc, char **argv) { + string usage = + "Applies an FST to another FST, treating the second as a log-linear " + "model.\n\n " + "Usage: "; + usage += argv[0]; + usage += " in.fst linear.fst [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + string in_name = strcmp(argv[1], "-") != 0 ? argv[1] : ""; + string linear_name = (argc > 2 && (strcmp(argv[2], "-") != 0)) ? argv[2] : ""; + string out_name = argc > 3 ? argv[3] : ""; + + if (in_name.empty() && linear_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input."; + return 1; + } + + fst::StdFst *ifst1 = fst::StdFst::Read(in_name); + if (!ifst1) return 1; + + fst::StdFst *ifst2 = fst::StdFst::Read(linear_name); + if (!ifst2) return 1; + + fst::StdVectorFst ofst; + + LogLinearApply(*ifst1, *ifst2, &ofst, FLAGS_normalize); + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linear-classifier-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linear-classifier-fst.cc new file mode 100644 index 0000000..d2e248e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linear-classifier-fst.cc @@ -0,0 +1,12 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +using fst::LinearClassifierFst; +using fst::StdArc; +using fst::LogArc; + +REGISTER_FST(LinearClassifierFst, StdArc); +REGISTER_FST(LinearClassifierFst, LogArc); diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linear-tagger-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linear-tagger-fst.cc new file mode 100644 index 0000000..0110fa7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linear-tagger-fst.cc @@ -0,0 +1,12 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +using fst::LinearTaggerFst; +using fst::StdArc; +using fst::LogArc; + +REGISTER_FST(LinearTaggerFst, StdArc); +REGISTER_FST(LinearTaggerFst, LogArc); diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linearscript.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linearscript.cc new file mode 100644 index 0000000..be15886 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/linear/linearscript.cc @@ -0,0 +1,91 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +DEFINE_string(delimiter, "|", + "Single non-white-space character delimiter inside sequences of " + "feature symbols and output symbols"); +DEFINE_string(empty_symbol, "", + "Special symbol that designates an empty sequence"); + +DEFINE_string(start_symbol, "", "Start of sentence symbol"); +DEFINE_string(end_symbol, "", "End of sentence symbol"); + +DEFINE_bool(classifier, false, + "Treat input model as a classifier instead of a tagger"); + +namespace fst { +namespace script { + +bool ValidateDelimiter() { + if (FLAGS_delimiter.size() == 1 && !std::isspace(FLAGS_delimiter[0])) + return true; + return false; +} + +bool ValidateEmptySymbol() { + bool okay = !FLAGS_empty_symbol.empty(); + for (size_t i = 0; i < FLAGS_empty_symbol.size(); ++i) { + char c = FLAGS_empty_symbol[i]; + if (std::isspace(c)) okay = false; + } + return okay; +} + +void LinearCompile(const string &arc_type, const string &epsilon_symbol, + const string &unknown_symbol, const string &vocab, + char **models, int models_len, const string &out, + const string &save_isymbols, const string &save_fsymbols, + const string &save_osymbols) { + LinearCompileArgs args(epsilon_symbol, unknown_symbol, vocab, models, + models_len, out, save_isymbols, save_fsymbols, + save_osymbols); + Apply>("LinearCompileTpl", arc_type, &args); +} + +// Instantiate templates for common arc types +REGISTER_FST_LINEAR_OPERATIONS(StdArc); +REGISTER_FST_LINEAR_OPERATIONS(LogArc); + +void SplitByWhitespace(const string &str, std::vector *out) { + out->clear(); + std::istringstream strm(str); + string buf; + while (strm >> buf) out->push_back(buf); +} + +int ScanNumClasses(char **models, int models_len) { + std::set preds; + for (int i = 0; i < models_len; ++i) { + std::ifstream in(models[i]); + if (!in) LOG(FATAL) << "Failed to open " << models[i]; + + string line; + std::getline(in, line); + + size_t num_line = 1; + while (std::getline(in, line)) { + ++num_line; + std::vector fields; + SplitByWhitespace(line, &fields); + if (fields.size() != 3) + LOG(FATAL) << "Wrong number of fields in source " << models[i] + << ", line " << num_line; + preds.insert(fields[1]); + } + } + return preds.size(); +} + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/CMakeLists.txt new file mode 100644 index 0000000..8366d50 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/CMakeLists.txt @@ -0,0 +1,41 @@ + +add_library(fstlookahead + arc_lookahead-fst.cc + ilabel_lookahead-fst.cc + olabel_lookahead-fst.cc +) +target_link_libraries(fstlookahead fst) +set_target_properties(fstlookahead PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER lookahead +) + +install(TARGETS fstlookahead + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib +) + +function (add_module _name) + add_library(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fst) + endif() + set_target_properties(${_name} PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS true + FOLDER lookahead/modules + ) + + install(TARGETS ${_name} LIBRARY DESTINATION lib/fst) +endfunction() + +add_module(arc_lookahead-fst MODULE + arc_lookahead-fst.cc) + +add_module(ilabel_lookahead-fst MODULE + ilabel_lookahead-fst.cc) + +add_module(olabel_lookahead-fst MODULE + olabel_lookahead-fst.cc) + + diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/Makefile.am new file mode 100644 index 0000000..42190c7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/Makefile.am @@ -0,0 +1,21 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +libfstdir = @libfstdir@ +libfst_LTLIBRARIES = arc_lookahead-fst.la \ +ilabel_lookahead-fst.la olabel_lookahead-fst.la + +lib_LTLIBRARIES = libfstlookahead.la + +libfstlookahead_la_SOURCES = arc_lookahead-fst.cc ilabel_lookahead-fst.cc \ + olabel_lookahead-fst.cc +libfstlookahead_la_LDFLAGS = -version-info 16:0:0 +libfstlookahead_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) + +arc_lookahead_fst_la_SOURCES = arc_lookahead-fst.cc +arc_lookahead_fst_la_LDFLAGS = -module + +ilabel_lookahead_fst_la_SOURCES = ilabel_lookahead-fst.cc +ilabel_lookahead_fst_la_LDFLAGS = -module + +olabel_lookahead_fst_la_SOURCES = olabel_lookahead-fst.cc +olabel_lookahead_fst_la_LDFLAGS = -module diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/Makefile.in new file mode 100644 index 0000000..8d32bf3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/Makefile.in @@ -0,0 +1,761 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/extensions/lookahead +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(libfst_LTLIBRARIES) +arc_lookahead_fst_la_LIBADD = +am_arc_lookahead_fst_la_OBJECTS = arc_lookahead-fst.lo +arc_lookahead_fst_la_OBJECTS = $(am_arc_lookahead_fst_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +arc_lookahead_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(arc_lookahead_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +ilabel_lookahead_fst_la_LIBADD = +am_ilabel_lookahead_fst_la_OBJECTS = ilabel_lookahead-fst.lo +ilabel_lookahead_fst_la_OBJECTS = \ + $(am_ilabel_lookahead_fst_la_OBJECTS) +ilabel_lookahead_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(ilabel_lookahead_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__DEPENDENCIES_1 = +libfstlookahead_la_DEPENDENCIES = ../../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am_libfstlookahead_la_OBJECTS = arc_lookahead-fst.lo \ + ilabel_lookahead-fst.lo olabel_lookahead-fst.lo +libfstlookahead_la_OBJECTS = $(am_libfstlookahead_la_OBJECTS) +libfstlookahead_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstlookahead_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +olabel_lookahead_fst_la_LIBADD = +am_olabel_lookahead_fst_la_OBJECTS = olabel_lookahead-fst.lo +olabel_lookahead_fst_la_OBJECTS = \ + $(am_olabel_lookahead_fst_la_OBJECTS) +olabel_lookahead_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(olabel_lookahead_fst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(arc_lookahead_fst_la_SOURCES) \ + $(ilabel_lookahead_fst_la_SOURCES) \ + $(libfstlookahead_la_SOURCES) \ + $(olabel_lookahead_fst_la_SOURCES) +DIST_SOURCES = $(arc_lookahead_fst_la_SOURCES) \ + $(ilabel_lookahead_fst_la_SOURCES) \ + $(libfstlookahead_la_SOURCES) \ + $(olabel_lookahead_fst_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +libfst_LTLIBRARIES = arc_lookahead-fst.la \ +ilabel_lookahead-fst.la olabel_lookahead-fst.la + +lib_LTLIBRARIES = libfstlookahead.la +libfstlookahead_la_SOURCES = arc_lookahead-fst.cc ilabel_lookahead-fst.cc \ + olabel_lookahead-fst.cc + +libfstlookahead_la_LDFLAGS = -version-info 16:0:0 +libfstlookahead_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +arc_lookahead_fst_la_SOURCES = arc_lookahead-fst.cc +arc_lookahead_fst_la_LDFLAGS = -module +ilabel_lookahead_fst_la_SOURCES = ilabel_lookahead-fst.cc +ilabel_lookahead_fst_la_LDFLAGS = -module +olabel_lookahead_fst_la_SOURCES = olabel_lookahead-fst.cc +olabel_lookahead_fst_la_LDFLAGS = -module +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/lookahead/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/lookahead/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-libfstLTLIBRARIES: $(libfst_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libfstdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libfstdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libfstdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libfstdir)"; \ + } + +uninstall-libfstLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libfstdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libfstdir)/$$f"; \ + done + +clean-libfstLTLIBRARIES: + -test -z "$(libfst_LTLIBRARIES)" || rm -f $(libfst_LTLIBRARIES) + @list='$(libfst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +arc_lookahead-fst.la: $(arc_lookahead_fst_la_OBJECTS) $(arc_lookahead_fst_la_DEPENDENCIES) $(EXTRA_arc_lookahead_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(arc_lookahead_fst_la_LINK) -rpath $(libfstdir) $(arc_lookahead_fst_la_OBJECTS) $(arc_lookahead_fst_la_LIBADD) $(LIBS) + +ilabel_lookahead-fst.la: $(ilabel_lookahead_fst_la_OBJECTS) $(ilabel_lookahead_fst_la_DEPENDENCIES) $(EXTRA_ilabel_lookahead_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(ilabel_lookahead_fst_la_LINK) -rpath $(libfstdir) $(ilabel_lookahead_fst_la_OBJECTS) $(ilabel_lookahead_fst_la_LIBADD) $(LIBS) + +libfstlookahead.la: $(libfstlookahead_la_OBJECTS) $(libfstlookahead_la_DEPENDENCIES) $(EXTRA_libfstlookahead_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstlookahead_la_LINK) -rpath $(libdir) $(libfstlookahead_la_OBJECTS) $(libfstlookahead_la_LIBADD) $(LIBS) + +olabel_lookahead-fst.la: $(olabel_lookahead_fst_la_OBJECTS) $(olabel_lookahead_fst_la_DEPENDENCIES) $(EXTRA_olabel_lookahead_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(olabel_lookahead_fst_la_LINK) -rpath $(libfstdir) $(olabel_lookahead_fst_la_OBJECTS) $(olabel_lookahead_fst_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc_lookahead-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ilabel_lookahead-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/olabel_lookahead-fst.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libfstLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libfstLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-libfstLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libfstLTLIBRARIES clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libfstLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-libfstLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/arc_lookahead-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/arc_lookahead-fst.cc new file mode 100644 index 0000000..63b16e4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/arc_lookahead-fst.cc @@ -0,0 +1,19 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer ArcLookAheadFst_StdArc_registerer; +static FstRegisterer, ArcLookAheadMatcher>>, + arc_lookahead_fst_type>> + ArcLookAheadFst_LogArc_registerer; +static FstRegisterer, ArcLookAheadMatcher>>, + arc_lookahead_fst_type>> + ArcLookAheadFst_Log64Arc_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/ilabel_lookahead-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/ilabel_lookahead-fst.cc new file mode 100644 index 0000000..5b7fa69 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/ilabel_lookahead-fst.cc @@ -0,0 +1,24 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer + ILabelLookAheadFst_StdArc_registerer; +static FstRegisterer, + LabelLookAheadMatcher>, + ilabel_lookahead_flags, FastLogAccumulator>, + ilabel_lookahead_fst_type, LabelLookAheadRelabeler>> + ILabelLookAheadFst_LogArc_registerer; +static FstRegisterer, + LabelLookAheadMatcher>, + ilabel_lookahead_flags, FastLogAccumulator>, + ilabel_lookahead_fst_type, LabelLookAheadRelabeler>> + ILabelLookAheadFst_Log64Arc_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/olabel_lookahead-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/olabel_lookahead-fst.cc new file mode 100644 index 0000000..9d3067f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/lookahead/olabel_lookahead-fst.cc @@ -0,0 +1,24 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { + +static FstRegisterer + OLabelLookAheadFst_StdArc_registerer; +static FstRegisterer, + LabelLookAheadMatcher>, + olabel_lookahead_flags, FastLogAccumulator>, + olabel_lookahead_fst_type, LabelLookAheadRelabeler>> + OLabelLookAheadFst_LogArc_registerer; +static FstRegisterer, + LabelLookAheadMatcher>, + olabel_lookahead_flags, FastLogAccumulator>, + olabel_lookahead_fst_type, LabelLookAheadRelabeler>> + OLabelLookAheadFst_Log64Arc_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/CMakeLists.txt new file mode 100644 index 0000000..834f952 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/CMakeLists.txt @@ -0,0 +1,34 @@ +file(GLOB HEADER_FILES ../../include/fst/extensions/mpdt/*.h) +message(STATUS "${HEADER_FILES}") + +if(HAVE_SCRIPT) + add_library(fstmpdtscript mpdtscript.cc ${HEADER_FILES}) + target_link_libraries(fstmpdtscript fstscript fst) + set_target_properties(fstmpdtscript PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER mpdt + ) + install(TARGETS fstmpdtscript + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib + ) +endif(HAVE_SCRIPT) + +if(HAVE_BIN) + function (add_executable2 _name) + add_executable(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fstmpdtscript fstpdtscript fstscript fst ${CMAKE_DL_LIBS}) + set_target_properties(${_name} PROPERTIES + FOLDER mpdt/bin + ) + endif() + install(TARGETS ${_name} RUNTIME DESTINATION bin) + endfunction() + add_executable2(mpdtcompose mpdtcompose.cc) + add_executable2(mpdtexpand mpdtexpand.cc) + add_executable2(mpdtinfo mpdtinfo.cc) + add_executable2(mpdtreverse mpdtreverse.cc) +endif(HAVE_BIN) + diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/Makefile.am new file mode 100644 index 0000000..3474bff --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/Makefile.am @@ -0,0 +1,26 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +if HAVE_BIN +bin_PROGRAMS = mpdtcompose mpdtexpand mpdtinfo mpdtreverse + +LDADD = libfstmpdtscript.la \ + ../pdt/libfstpdtscript.la \ + ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) + +mpdtcompose_SOURCES = mpdtcompose.cc + +mpdtexpand_SOURCES = mpdtexpand.cc + +mpdtinfo_SOURCES = mpdtinfo.cc + +mpdtreverse_SOURCES = mpdtreverse.cc +endif + +if HAVE_SCRIPT +lib_LTLIBRARIES = libfstmpdtscript.la +libfstmpdtscript_la_SOURCES = mpdtscript.cc +libfstmpdtscript_la_LDFLAGS = -version-info 16:0:0 +libfstmpdtscript_la_LIBADD = ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) +endif diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/Makefile.in new file mode 100644 index 0000000..89544af --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/Makefile.in @@ -0,0 +1,799 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_BIN_TRUE@bin_PROGRAMS = mpdtcompose$(EXEEXT) mpdtexpand$(EXEEXT) \ +@HAVE_BIN_TRUE@ mpdtinfo$(EXEEXT) mpdtreverse$(EXEEXT) +subdir = src/extensions/mpdt +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +@HAVE_SCRIPT_TRUE@libfstmpdtscript_la_DEPENDENCIES = \ +@HAVE_SCRIPT_TRUE@ ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__libfstmpdtscript_la_SOURCES_DIST = mpdtscript.cc +@HAVE_SCRIPT_TRUE@am_libfstmpdtscript_la_OBJECTS = mpdtscript.lo +libfstmpdtscript_la_OBJECTS = $(am_libfstmpdtscript_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstmpdtscript_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstmpdtscript_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_TRUE@am_libfstmpdtscript_la_rpath = -rpath $(libdir) +PROGRAMS = $(bin_PROGRAMS) +am__mpdtcompose_SOURCES_DIST = mpdtcompose.cc +@HAVE_BIN_TRUE@am_mpdtcompose_OBJECTS = mpdtcompose.$(OBJEXT) +mpdtcompose_OBJECTS = $(am_mpdtcompose_OBJECTS) +mpdtcompose_LDADD = $(LDADD) +@HAVE_BIN_TRUE@mpdtcompose_DEPENDENCIES = libfstmpdtscript.la \ +@HAVE_BIN_TRUE@ ../pdt/libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__mpdtexpand_SOURCES_DIST = mpdtexpand.cc +@HAVE_BIN_TRUE@am_mpdtexpand_OBJECTS = mpdtexpand.$(OBJEXT) +mpdtexpand_OBJECTS = $(am_mpdtexpand_OBJECTS) +mpdtexpand_LDADD = $(LDADD) +@HAVE_BIN_TRUE@mpdtexpand_DEPENDENCIES = libfstmpdtscript.la \ +@HAVE_BIN_TRUE@ ../pdt/libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__mpdtinfo_SOURCES_DIST = mpdtinfo.cc +@HAVE_BIN_TRUE@am_mpdtinfo_OBJECTS = mpdtinfo.$(OBJEXT) +mpdtinfo_OBJECTS = $(am_mpdtinfo_OBJECTS) +mpdtinfo_LDADD = $(LDADD) +@HAVE_BIN_TRUE@mpdtinfo_DEPENDENCIES = libfstmpdtscript.la \ +@HAVE_BIN_TRUE@ ../pdt/libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__mpdtreverse_SOURCES_DIST = mpdtreverse.cc +@HAVE_BIN_TRUE@am_mpdtreverse_OBJECTS = mpdtreverse.$(OBJEXT) +mpdtreverse_OBJECTS = $(am_mpdtreverse_OBJECTS) +mpdtreverse_LDADD = $(LDADD) +@HAVE_BIN_TRUE@mpdtreverse_DEPENDENCIES = libfstmpdtscript.la \ +@HAVE_BIN_TRUE@ ../pdt/libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstmpdtscript_la_SOURCES) $(mpdtcompose_SOURCES) \ + $(mpdtexpand_SOURCES) $(mpdtinfo_SOURCES) \ + $(mpdtreverse_SOURCES) +DIST_SOURCES = $(am__libfstmpdtscript_la_SOURCES_DIST) \ + $(am__mpdtcompose_SOURCES_DIST) $(am__mpdtexpand_SOURCES_DIST) \ + $(am__mpdtinfo_SOURCES_DIST) $(am__mpdtreverse_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +@HAVE_BIN_TRUE@LDADD = libfstmpdtscript.la \ +@HAVE_BIN_TRUE@ ../pdt/libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +@HAVE_BIN_TRUE@mpdtcompose_SOURCES = mpdtcompose.cc +@HAVE_BIN_TRUE@mpdtexpand_SOURCES = mpdtexpand.cc +@HAVE_BIN_TRUE@mpdtinfo_SOURCES = mpdtinfo.cc +@HAVE_BIN_TRUE@mpdtreverse_SOURCES = mpdtreverse.cc +@HAVE_SCRIPT_TRUE@lib_LTLIBRARIES = libfstmpdtscript.la +@HAVE_SCRIPT_TRUE@libfstmpdtscript_la_SOURCES = mpdtscript.cc +@HAVE_SCRIPT_TRUE@libfstmpdtscript_la_LDFLAGS = -version-info 16:0:0 +@HAVE_SCRIPT_TRUE@libfstmpdtscript_la_LIBADD = ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/mpdt/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/mpdt/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstmpdtscript.la: $(libfstmpdtscript_la_OBJECTS) $(libfstmpdtscript_la_DEPENDENCIES) $(EXTRA_libfstmpdtscript_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstmpdtscript_la_LINK) $(am_libfstmpdtscript_la_rpath) $(libfstmpdtscript_la_OBJECTS) $(libfstmpdtscript_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +mpdtcompose$(EXEEXT): $(mpdtcompose_OBJECTS) $(mpdtcompose_DEPENDENCIES) $(EXTRA_mpdtcompose_DEPENDENCIES) + @rm -f mpdtcompose$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(mpdtcompose_OBJECTS) $(mpdtcompose_LDADD) $(LIBS) + +mpdtexpand$(EXEEXT): $(mpdtexpand_OBJECTS) $(mpdtexpand_DEPENDENCIES) $(EXTRA_mpdtexpand_DEPENDENCIES) + @rm -f mpdtexpand$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(mpdtexpand_OBJECTS) $(mpdtexpand_LDADD) $(LIBS) + +mpdtinfo$(EXEEXT): $(mpdtinfo_OBJECTS) $(mpdtinfo_DEPENDENCIES) $(EXTRA_mpdtinfo_DEPENDENCIES) + @rm -f mpdtinfo$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(mpdtinfo_OBJECTS) $(mpdtinfo_LDADD) $(LIBS) + +mpdtreverse$(EXEEXT): $(mpdtreverse_OBJECTS) $(mpdtreverse_DEPENDENCIES) $(EXTRA_mpdtreverse_DEPENDENCIES) + @rm -f mpdtreverse$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(mpdtreverse_OBJECTS) $(mpdtreverse_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpdtcompose.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpdtexpand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpdtinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpdtreverse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpdtscript.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtcompose.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtcompose.cc new file mode 100644 index 0000000..351033a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtcompose.cc @@ -0,0 +1,89 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Composes an MPDT and an FST. + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +DEFINE_string(mpdt_parentheses, "", + "MPDT parenthesis label pairs with assignments"); +DEFINE_bool(left_mpdt, true, "Is the first argument the MPDT?"); +DEFINE_bool(connect, true, "Trim output?"); +DEFINE_string(compose_filter, "paren", + "Composition filter, one of: \"expand\", \"expand_paren\", " + "\"paren\""); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::MPdtComposeOptions; + using fst::PdtComposeFilter; + using fst::ReadLabelTriples; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Compose an MPDT and an FST.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt in.fst [out.mpdt]\n"; + usage += " in.fst in.pdt [out.mpdt]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + const string out_name = argc > 3 ? argv[3] : ""; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input."; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + if (FLAGS_mpdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No MPDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + std::vector assignments; + if (!ReadLabelTriples(FLAGS_mpdt_parentheses, &parens, &assignments, false)) + return 1; + + VectorFstClass ofst(ifst1->ArcType()); + + PdtComposeFilter compose_filter; + if (!s::GetPdtComposeFilter(FLAGS_compose_filter, &compose_filter)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: " + << FLAGS_compose_filter; + return 1; + } + + const MPdtComposeOptions opts(FLAGS_connect, compose_filter); + + s::MPdtCompose(*ifst1, *ifst2, parens, assignments, &ofst, opts, + FLAGS_left_mpdt); + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtexpand.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtexpand.cc new file mode 100644 index 0000000..fb24b3a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtexpand.cc @@ -0,0 +1,68 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Expands a (bounded-stack) MPDT as an FST. + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +DEFINE_string(mpdt_parentheses, "", + "MPDT parenthesis label pairs with assignments"); +DEFINE_bool(connect, true, "Trim output?"); +DEFINE_bool(keep_parentheses, false, "Keep PDT parentheses in result?"); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + using fst::ReadLabelTriples; + using fst::MPdtExpandOptions; + + string usage = "Expand a (bounded-stack) MPDT as an FST.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (FLAGS_mpdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No MPDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + std::vector assignments; + if (!ReadLabelTriples(FLAGS_mpdt_parentheses, &parens, &assignments, false)) + return 1; + + VectorFstClass ofst(ifst->ArcType()); + + const MPdtExpandOptions opts(FLAGS_connect, FLAGS_keep_parentheses); + + s::MPdtExpand(*ifst, parens, assignments, &ofst, opts); + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtinfo.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtinfo.cc new file mode 100644 index 0000000..b8d7d4a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtinfo.cc @@ -0,0 +1,58 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prints out various information about an MPDT such as number of states, arcs, +// and parentheses. + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +DEFINE_string(mpdt_parentheses, "", + "MPDT parenthesis label pairs with assignments"); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::ReadLabelTriples; + + string usage = "Prints out information about an MPDT.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 2) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (FLAGS_mpdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No MPDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + std::vector assignments; + if (!ReadLabelTriples(FLAGS_mpdt_parentheses, &parens, &assignments, false)) + return 1; + + s::PrintMPdtInfo(*ifst, parens, assignments); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtreverse.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtreverse.cc new file mode 100644 index 0000000..7bde1a1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtreverse.cc @@ -0,0 +1,75 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Reverses an MPDT. + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +DEFINE_string(mpdt_parentheses, "", + "MPDT parenthesis label pairs with assignments."); + +DEFINE_string(mpdt_new_parentheses, "", + "Output for reassigned parentheses and stacks"); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::ReadLabelTriples; + using fst::WriteLabelTriples; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Reverse an MPDT.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (FLAGS_mpdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No MPDT parenthesis label pairs provided"; + return 1; + } + + if (FLAGS_mpdt_new_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No MPDT output parenthesis label file provided"; + return 1; + } + + std::vector parens; + std::vector assignments; + if (!ReadLabelTriples(FLAGS_mpdt_parentheses, &parens, &assignments, false)) + return 1; + + VectorFstClass ofst(ifst->ArcType()); + + s::MPdtReverse(*ifst, parens, &assignments, &ofst); + + ofst.Write(out_name); + + if (!WriteLabelTriples(FLAGS_mpdt_new_parentheses, parens, assignments)) + return 1; + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtscript.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtscript.cc new file mode 100644 index 0000000..7573494 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/mpdt/mpdtscript.cc @@ -0,0 +1,65 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Definitions of 'scriptable' versions of mpdt operations, that is, +// those that can be called with FstClass-type arguments. +// +// See comments in nlp/fst/script/script-impl.h for how the registration +// mechanism allows these to work with various arc types. + +#include +#include + +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +void MPdtCompose(const FstClass &ifst1, const FstClass &ifst2, + const std::vector &parens, + const std::vector &assignments, MutableFstClass *ofst, + const MPdtComposeOptions &copts, bool left_pdt) { + if (!internal::ArcTypesMatch(ifst1, ifst2, "MPdtCompose") || + !internal::ArcTypesMatch(ifst1, *ofst, "MPdtCompose")) return; + MPdtComposeArgs args(ifst1, ifst2, parens, assignments, ofst, copts, + left_pdt); + Apply>("MPdtCompose", ifst1.ArcType(), &args); +} + +void MPdtExpand(const FstClass &ifst, const std::vector &parens, + const std::vector &assignments, MutableFstClass *ofst, + const MPdtExpandOptions &opts) { + MPdtExpandArgs args(ifst, parens, assignments, ofst, opts); + Apply>("MPdtExpand", ifst.ArcType(), &args); +} + +void MPdtExpand(const FstClass &ifst, const std::vector &parens, + const std::vector &assignments, MutableFstClass *ofst, + bool connect) { + MPdtExpand(ifst, parens, assignments, ofst, MPdtExpandOptions(connect)); +} + +void MPdtReverse(const FstClass &ifst, const std::vector &parens, + std::vector *assignments, MutableFstClass *ofst) { + MPdtReverseArgs args(ifst, parens, assignments, ofst); + Apply>("MPdtReverse", ifst.ArcType(), &args); +} + +void PrintMPdtInfo(const FstClass &ifst, const std::vector &parens, + const std::vector &assignments) { + PrintMPdtInfoArgs args(ifst, parens, assignments); + Apply>("PrintMPdtInfo", ifst.ArcType(), &args); +} + +// Register operations for common arc types. + +REGISTER_FST_MPDT_OPERATIONS(StdArc); +REGISTER_FST_MPDT_OPERATIONS(LogArc); +REGISTER_FST_MPDT_OPERATIONS(Log64Arc); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/CMakeLists.txt new file mode 100644 index 0000000..bb58f45 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/CMakeLists.txt @@ -0,0 +1,44 @@ +file(GLOB HEADER_FILES ../../include/fst/extensions/ngram/*.h) +message(STATUS "${HEADER_FILES}") + +add_library(fstngram + bitmap-index.cc + ngram-fst.cc + nthbit.cc + ${HEADER_FILES} +) + +target_link_libraries(fstngram + fst +) + +set_target_properties(fstngram PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER ngram +) + +install(TARGETS fstngram + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib +) + +add_library(ngram_fst MODULE + bitmap-index.cc + ngram-fst.cc + nthbit.cc +) + +set_target_properties(ngram_fst PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS true + FOLDER ngram/modules +) + +target_link_libraries(ngram_fst + fst +) + +install(TARGETS ngram_fst + LIBRARY DESTINATION lib/fst +) + diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/Makefile.am new file mode 100644 index 0000000..6174873 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/Makefile.am @@ -0,0 +1,13 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +libfstdir = @libfstdir@ +libfst_LTLIBRARIES = ngram-fst.la + +lib_LTLIBRARIES = libfstngram.la + +ngram_fst_la_SOURCES = bitmap-index.cc ngram-fst.cc nthbit.cc +ngram_fst_la_LDFLAGS = -module + +libfstngram_la_SOURCES = bitmap-index.cc ngram-fst.cc nthbit.cc +libfstngram_la_LDFLAGS = -version-info 16:0:0 +libfstngram_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/Makefile.in new file mode 100644 index 0000000..7cdf643 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/Makefile.in @@ -0,0 +1,723 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/extensions/ngram +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(libfst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libfstngram_la_DEPENDENCIES = ../../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am_libfstngram_la_OBJECTS = bitmap-index.lo ngram-fst.lo nthbit.lo +libfstngram_la_OBJECTS = $(am_libfstngram_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstngram_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstngram_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +ngram_fst_la_LIBADD = +am_ngram_fst_la_OBJECTS = bitmap-index.lo ngram-fst.lo nthbit.lo +ngram_fst_la_OBJECTS = $(am_ngram_fst_la_OBJECTS) +ngram_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(ngram_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstngram_la_SOURCES) $(ngram_fst_la_SOURCES) +DIST_SOURCES = $(libfstngram_la_SOURCES) $(ngram_fst_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +libfst_LTLIBRARIES = ngram-fst.la +lib_LTLIBRARIES = libfstngram.la +ngram_fst_la_SOURCES = bitmap-index.cc ngram-fst.cc nthbit.cc +ngram_fst_la_LDFLAGS = -module +libfstngram_la_SOURCES = bitmap-index.cc ngram-fst.cc nthbit.cc +libfstngram_la_LDFLAGS = -version-info 16:0:0 +libfstngram_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/ngram/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/ngram/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-libfstLTLIBRARIES: $(libfst_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libfstdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libfstdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libfstdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libfstdir)"; \ + } + +uninstall-libfstLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libfstdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libfstdir)/$$f"; \ + done + +clean-libfstLTLIBRARIES: + -test -z "$(libfst_LTLIBRARIES)" || rm -f $(libfst_LTLIBRARIES) + @list='$(libfst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstngram.la: $(libfstngram_la_OBJECTS) $(libfstngram_la_DEPENDENCIES) $(EXTRA_libfstngram_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstngram_la_LINK) -rpath $(libdir) $(libfstngram_la_OBJECTS) $(libfstngram_la_LIBADD) $(LIBS) + +ngram-fst.la: $(ngram_fst_la_OBJECTS) $(ngram_fst_la_DEPENDENCIES) $(EXTRA_ngram_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(ngram_fst_la_LINK) -rpath $(libfstdir) $(ngram_fst_la_OBJECTS) $(ngram_fst_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap-index.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ngram-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nthbit.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libfstLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libfstLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-libfstLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libfstLTLIBRARIES clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libfstLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-libfstLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/bitmap-index.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/bitmap-index.cc new file mode 100644 index 0000000..b62bb98 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/bitmap-index.cc @@ -0,0 +1,225 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include +#include + +#include +#include + +namespace fst { +namespace { +const size_t kPrimaryBlockBits = + BitmapIndex::kStorageBitSize * BitmapIndex::kSecondaryBlockSize; + +// If [begin, begin+size) is a monotonically increasing running sum of +// popcounts for a bitmap, this will return the index of the word that contains +// the value'th zero. If value is larger then the number of zeros in the +// bitmap, size will be returned. The idea is that the number of zerocounts +// (i.e. the popcount of logical NOT of values) is offset * kStorageBitSize +// minus the value for each element of the running sum. +template +size_t InvertedSearch(const Container& c, + size_t first_idx, + size_t last_idx, + size_t value) { + const size_t begin_idx = first_idx; + while (first_idx != last_idx) { + // Invariant: [first_idx, last_idx) is the search range. + size_t mid_idx = first_idx + ((last_idx - first_idx) / 2); + size_t mid_value = BlockSize * (1 + (mid_idx - begin_idx)) - c[mid_idx]; + if (mid_value < value) { + first_idx = mid_idx + 1; + } else { + last_idx = mid_idx; + } + } + return first_idx; +} +} // namespace + +size_t BitmapIndex::Rank1(size_t end) const { + if (end == 0) return 0; + const uint32 end_word = (end - 1) >> BitmapIndex::kStorageLogBitSize; + const uint32 sum = get_index_ones_count(end_word); + const size_t masked = end & kStorageBlockMask; + if (masked == 0) { + return sum + __builtin_popcountll(bits_[end_word]); + } else { + const uint64 zero = 0; + return sum + __builtin_popcountll(bits_[end_word] & + (~zero >> (kStorageBitSize - masked))); + } +} + +size_t BitmapIndex::Select1(size_t bit_index) const { + if (bit_index >= GetOnesCount()) return Bits(); + // search primary index for the relevant block + uint32 rembits = bit_index + 1; + const uint32 block = find_primary_block(bit_index + 1); + uint32 offset = 0; + if (block > 0) { + rembits -= primary_index_[block - 1]; + offset += block * kSecondaryBlockSize; + } + // search the secondary index + uint32 word = find_secondary_block(offset, rembits); + if (word > 0) { + rembits -= secondary_index_[offset + word - 1]; + offset += word; + } + int nth = nth_bit(bits_[offset], rembits); + return (offset << BitmapIndex::kStorageLogBitSize) + nth; +} + +size_t BitmapIndex::Select0(size_t bit_index) const { + if (bit_index >= Bits() - GetOnesCount()) return Bits(); + // search inverted primary index for relevant block + uint32 remzeros = bit_index + 1; + uint32 offset = 0; + const uint32 block = find_inverted_primary_block(bit_index + 1); + if (block > 0) { + remzeros -= kPrimaryBlockBits * block - primary_index_[block - 1]; + offset += block * kSecondaryBlockSize; + } + // search the inverted secondary index + uint32 word = find_inverted_secondary_block(offset, remzeros); + if (word > 0) { + remzeros -= BitmapIndex::kStorageBitSize * word - + secondary_index_[offset + word - 1]; + offset += word; + } + int nth = nth_bit(~bits_[offset], remzeros); + return (offset << BitmapIndex::kStorageLogBitSize) + nth; +} + +std::pair BitmapIndex::Select0s(size_t bit_index) const { + const uint64 zero = 0; + const uint64 ones = ~zero; + size_t zeros_count = Bits() - GetOnesCount(); + if (bit_index >= zeros_count) return std::make_pair(Bits(), Bits()); + if (bit_index + 1 >= zeros_count) { + return std::make_pair(Select0(bit_index), Bits()); + } + // search inverted primary index for relevant block + uint32 remzeros = bit_index + 1; + uint32 offset = 0; + const uint32 block = find_inverted_primary_block(bit_index + 1); + size_t num_zeros_in_block = + kPrimaryBlockBits * (1 + block) - primary_index_[block]; + if (block > 0) { + size_t num_zeros_next = + kPrimaryBlockBits * block - primary_index_[block - 1]; + num_zeros_in_block -= num_zeros_next; + remzeros -= num_zeros_next; + offset += block * kSecondaryBlockSize; + } + // search the inverted secondary index + uint32 word = find_inverted_secondary_block(offset, remzeros); + uint32 sum_zeros_next_word = BitmapIndex::kStorageBitSize * (1 + word) - + secondary_index_[offset + word]; + uint32 sum_zeros_this_word = 0; + if (word > 0) { + sum_zeros_this_word = BitmapIndex::kStorageBitSize * word - + secondary_index_[offset + word - 1]; + remzeros -= sum_zeros_this_word; + offset += word; + } + int nth = nth_bit(~bits_[offset], remzeros); + size_t current_zero = (offset << BitmapIndex::kStorageLogBitSize) + nth; + + size_t next_zero; + // Does the current block contain the next zero? + if (num_zeros_in_block > remzeros + 1) { + if (sum_zeros_next_word - sum_zeros_this_word >= remzeros + 1) { + // the next zero is in this word + next_zero = (offset << BitmapIndex::kStorageLogBitSize) + + nth_bit(~bits_[offset], remzeros + 1); + } else { + // Find the first field that is not all ones by linear scan. + // In the worst case, this may scan 8Kbytes. The alternative is + // to inspect secondary_index_ looking for a place to jump to, but + // that would probably use more cache. + while (bits_[++offset] == ones) { + } + next_zero = (offset << BitmapIndex::kStorageLogBitSize) + + __builtin_ctzll(~bits_[offset]); + } + } else { + // the next zero is in a different block, a full search is required. + next_zero = Select0(bit_index + 1); + } + return std::make_pair(current_zero, next_zero); +} + +size_t BitmapIndex::get_index_ones_count(size_t array_index) const { + uint32 sum = 0; + if (array_index > 0) { + sum += secondary_index_[array_index - 1]; + uint32 end_block = (array_index - 1) / kSecondaryBlockSize; + if (end_block > 0) sum += primary_index_[end_block - 1]; + } + return sum; +} + +void BitmapIndex::BuildIndex(const uint64 *bits, size_t size) { + bits_ = bits; + size_ = size; + primary_index_.resize(primary_index_size()); + secondary_index_.resize(ArraySize()); + const uint64 zero = 0; + const uint64 ones = ~zero; + uint32 popcount = 0; + for (uint32 block = 0; block * kSecondaryBlockSize < ArraySize(); block++) { + uint32 block_popcount = 0; + uint32 block_begin = block * kSecondaryBlockSize; + uint32 block_end = block_begin + kSecondaryBlockSize; + if (block_end > ArraySize()) block_end = ArraySize(); + for (uint32 j = block_begin; j < block_end; ++j) { + uint64 mask = ones; + if (j == ArraySize() - 1) { + mask = ones >> (-size_ & BitmapIndex::kStorageBlockMask); + } + block_popcount += __builtin_popcountll(bits_[j] & mask); + secondary_index_[j] = block_popcount; + } + popcount += block_popcount; + primary_index_[block] = popcount; + } +} + +size_t BitmapIndex::find_secondary_block(size_t block_begin, + size_t rem_bit_index) const { + size_t block_end = block_begin + kSecondaryBlockSize; + if (block_end > ArraySize()) block_end = ArraySize(); + return std::distance( + secondary_index_.begin() + block_begin, + std::lower_bound(secondary_index_.begin() + block_begin, + secondary_index_.begin() + block_end, rem_bit_index)); +} + +size_t BitmapIndex::find_inverted_secondary_block(size_t block_begin, + size_t rem_bit_index) const { + size_t block_end = block_begin + kSecondaryBlockSize; + if (block_end > ArraySize()) block_end = ArraySize(); + return InvertedSearch(secondary_index_, + block_begin, block_end, + rem_bit_index) + - block_begin; +} + +inline size_t BitmapIndex::find_primary_block(size_t bit_index) const { + return std::distance( + primary_index_.begin(), + std::lower_bound(primary_index_.begin(), + primary_index_.begin() + primary_index_size(), + bit_index)); +} + +size_t BitmapIndex::find_inverted_primary_block(size_t bit_index) const { + return InvertedSearch( + primary_index_, 0, primary_index_.size(), bit_index); +} +} // end namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/ngram-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/ngram-fst.cc new file mode 100644 index 0000000..15940eb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/ngram-fst.cc @@ -0,0 +1,16 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include + +#include +#include + +using fst::NGramFst; +using fst::StdArc; +using fst::LogArc; + +REGISTER_FST(NGramFst, StdArc); +REGISTER_FST(NGramFst, LogArc); diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/nthbit.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/nthbit.cc new file mode 100644 index 0000000..be26f3d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/ngram/nthbit.cc @@ -0,0 +1,74 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#ifndef __BMI2__ +// This table is generated using: +// +// unsigned int nth_bit_scan(uint64 v, unsigned int r) { +// int i=0; +// for (; i<64; i++) { +// if ((r -= v & 1) == 0) return i; +// v >>= 1; +// } +// return i; +// } +// +// for (size_t i = 0; i < 256; ++i) { +// uint32 offsets = 0; +// for (size_t b = 1; b <= 8; ++b) { +// uint32 offset = min(nth_bit_scan(i, b), 8); +// offsets |= (offset << ((b - 1) << 2)); +// } +// bit_offset = offsets; +// printf("0x%x, ", bit_offset); +// if (i % 4 == 3) printf("\n"); +// } +// +const uint32 nth_bit_bit_offset[] = { + 0x88888888, 0x88888880, 0x88888881, 0x88888810, 0x88888882, 0x88888820, + 0x88888821, 0x88888210, 0x88888883, 0x88888830, 0x88888831, 0x88888310, + 0x88888832, 0x88888320, 0x88888321, 0x88883210, 0x88888884, 0x88888840, + 0x88888841, 0x88888410, 0x88888842, 0x88888420, 0x88888421, 0x88884210, + 0x88888843, 0x88888430, 0x88888431, 0x88884310, 0x88888432, 0x88884320, + 0x88884321, 0x88843210, 0x88888885, 0x88888850, 0x88888851, 0x88888510, + 0x88888852, 0x88888520, 0x88888521, 0x88885210, 0x88888853, 0x88888530, + 0x88888531, 0x88885310, 0x88888532, 0x88885320, 0x88885321, 0x88853210, + 0x88888854, 0x88888540, 0x88888541, 0x88885410, 0x88888542, 0x88885420, + 0x88885421, 0x88854210, 0x88888543, 0x88885430, 0x88885431, 0x88854310, + 0x88885432, 0x88854320, 0x88854321, 0x88543210, 0x88888886, 0x88888860, + 0x88888861, 0x88888610, 0x88888862, 0x88888620, 0x88888621, 0x88886210, + 0x88888863, 0x88888630, 0x88888631, 0x88886310, 0x88888632, 0x88886320, + 0x88886321, 0x88863210, 0x88888864, 0x88888640, 0x88888641, 0x88886410, + 0x88888642, 0x88886420, 0x88886421, 0x88864210, 0x88888643, 0x88886430, + 0x88886431, 0x88864310, 0x88886432, 0x88864320, 0x88864321, 0x88643210, + 0x88888865, 0x88888650, 0x88888651, 0x88886510, 0x88888652, 0x88886520, + 0x88886521, 0x88865210, 0x88888653, 0x88886530, 0x88886531, 0x88865310, + 0x88886532, 0x88865320, 0x88865321, 0x88653210, 0x88888654, 0x88886540, + 0x88886541, 0x88865410, 0x88886542, 0x88865420, 0x88865421, 0x88654210, + 0x88886543, 0x88865430, 0x88865431, 0x88654310, 0x88865432, 0x88654320, + 0x88654321, 0x86543210, 0x88888887, 0x88888870, 0x88888871, 0x88888710, + 0x88888872, 0x88888720, 0x88888721, 0x88887210, 0x88888873, 0x88888730, + 0x88888731, 0x88887310, 0x88888732, 0x88887320, 0x88887321, 0x88873210, + 0x88888874, 0x88888740, 0x88888741, 0x88887410, 0x88888742, 0x88887420, + 0x88887421, 0x88874210, 0x88888743, 0x88887430, 0x88887431, 0x88874310, + 0x88887432, 0x88874320, 0x88874321, 0x88743210, 0x88888875, 0x88888750, + 0x88888751, 0x88887510, 0x88888752, 0x88887520, 0x88887521, 0x88875210, + 0x88888753, 0x88887530, 0x88887531, 0x88875310, 0x88887532, 0x88875320, + 0x88875321, 0x88753210, 0x88888754, 0x88887540, 0x88887541, 0x88875410, + 0x88887542, 0x88875420, 0x88875421, 0x88754210, 0x88887543, 0x88875430, + 0x88875431, 0x88754310, 0x88875432, 0x88754320, 0x88754321, 0x87543210, + 0x88888876, 0x88888760, 0x88888761, 0x88887610, 0x88888762, 0x88887620, + 0x88887621, 0x88876210, 0x88888763, 0x88887630, 0x88887631, 0x88876310, + 0x88887632, 0x88876320, 0x88876321, 0x88763210, 0x88888764, 0x88887640, + 0x88887641, 0x88876410, 0x88887642, 0x88876420, 0x88876421, 0x88764210, + 0x88887643, 0x88876430, 0x88876431, 0x88764310, 0x88876432, 0x88764320, + 0x88764321, 0x87643210, 0x88888765, 0x88887650, 0x88887651, 0x88876510, + 0x88887652, 0x88876520, 0x88876521, 0x88765210, 0x88887653, 0x88876530, + 0x88876531, 0x88765310, 0x88876532, 0x88765320, 0x88765321, 0x87653210, + 0x88887654, 0x88876540, 0x88876541, 0x88765410, 0x88876542, 0x88765420, + 0x88765421, 0x87654210, 0x88876543, 0x88765430, 0x88765431, 0x87654310, + 0x88765432, 0x87654320, 0x87654321, 0x76543210, +}; +#endif // !defined(__BMI2__) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/CMakeLists.txt new file mode 100644 index 0000000..ccf5d00 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/CMakeLists.txt @@ -0,0 +1,37 @@ +file(GLOB HEADER_FILES ../../include/fst/extensions/pdt/*.h) +message(STATUS "${HEADER_FILES}") + +if(HAVE_SCRIPT) + add_library(fstpdtscript getters.cc pdtscript.cc ${HEADER_FILES}) + target_link_libraries(fstpdtscript fstscript fst) + set_target_properties(fstpdtscript PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER pdt + ) + + install(TARGETS fstpdtscript + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib + ) +endif(HAVE_SCRIPT) + +if(HAVE_BIN) + function (add_executable2 _name) + add_executable(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fstpdtscript fstscript fst ${CMAKE_DL_LIBS}) + set_target_properties(${_name} PROPERTIES + FOLDER pdt/bin + ) + endif() + install(TARGETS ${_name} RUNTIME DESTINATION bin) + endfunction() + + add_executable2(pdtcompose pdtcompose.cc) + add_executable2(pdtexpand pdtexpand.cc) + add_executable2(pdtinfo pdtinfo.cc) + add_executable2(pdtreplace pdtreplace.cc) + add_executable2(pdtreverse pdtreverse.cc) + add_executable2(pdtshortestpath pdtshortestpath.cc) +endif(HAVE_BIN) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/Makefile.am new file mode 100644 index 0000000..5ede45b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/Makefile.am @@ -0,0 +1,30 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) + +if HAVE_BIN +bin_PROGRAMS = pdtcompose pdtexpand pdtinfo pdtreplace pdtreverse \ + pdtshortestpath + +LDADD = libfstpdtscript.la \ + ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) + +pdtcompose_SOURCES = pdtcompose.cc + +pdtexpand_SOURCES = pdtexpand.cc + +pdtinfo_SOURCES = pdtinfo.cc + +pdtreplace_SOURCES = pdtreplace.cc + +pdtreverse_SOURCES = pdtreverse.cc + +pdtshortestpath_SOURCES = pdtshortestpath.cc +endif + +if HAVE_SCRIPT +lib_LTLIBRARIES = libfstpdtscript.la +libfstpdtscript_la_SOURCES = getters.cc pdtscript.cc +libfstpdtscript_la_LDFLAGS = -version-info 16:0:0 +libfstpdtscript_la_LIBADD = ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) +endif diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/Makefile.in new file mode 100644 index 0000000..243db7f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/Makefile.in @@ -0,0 +1,825 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_BIN_TRUE@bin_PROGRAMS = pdtcompose$(EXEEXT) pdtexpand$(EXEEXT) \ +@HAVE_BIN_TRUE@ pdtinfo$(EXEEXT) pdtreplace$(EXEEXT) \ +@HAVE_BIN_TRUE@ pdtreverse$(EXEEXT) pdtshortestpath$(EXEEXT) +subdir = src/extensions/pdt +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +@HAVE_SCRIPT_TRUE@libfstpdtscript_la_DEPENDENCIES = \ +@HAVE_SCRIPT_TRUE@ ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__libfstpdtscript_la_SOURCES_DIST = getters.cc pdtscript.cc +@HAVE_SCRIPT_TRUE@am_libfstpdtscript_la_OBJECTS = getters.lo \ +@HAVE_SCRIPT_TRUE@ pdtscript.lo +libfstpdtscript_la_OBJECTS = $(am_libfstpdtscript_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstpdtscript_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstpdtscript_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_TRUE@am_libfstpdtscript_la_rpath = -rpath $(libdir) +PROGRAMS = $(bin_PROGRAMS) +am__pdtcompose_SOURCES_DIST = pdtcompose.cc +@HAVE_BIN_TRUE@am_pdtcompose_OBJECTS = pdtcompose.$(OBJEXT) +pdtcompose_OBJECTS = $(am_pdtcompose_OBJECTS) +pdtcompose_LDADD = $(LDADD) +@HAVE_BIN_TRUE@pdtcompose_DEPENDENCIES = libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__pdtexpand_SOURCES_DIST = pdtexpand.cc +@HAVE_BIN_TRUE@am_pdtexpand_OBJECTS = pdtexpand.$(OBJEXT) +pdtexpand_OBJECTS = $(am_pdtexpand_OBJECTS) +pdtexpand_LDADD = $(LDADD) +@HAVE_BIN_TRUE@pdtexpand_DEPENDENCIES = libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__pdtinfo_SOURCES_DIST = pdtinfo.cc +@HAVE_BIN_TRUE@am_pdtinfo_OBJECTS = pdtinfo.$(OBJEXT) +pdtinfo_OBJECTS = $(am_pdtinfo_OBJECTS) +pdtinfo_LDADD = $(LDADD) +@HAVE_BIN_TRUE@pdtinfo_DEPENDENCIES = libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__pdtreplace_SOURCES_DIST = pdtreplace.cc +@HAVE_BIN_TRUE@am_pdtreplace_OBJECTS = pdtreplace.$(OBJEXT) +pdtreplace_OBJECTS = $(am_pdtreplace_OBJECTS) +pdtreplace_LDADD = $(LDADD) +@HAVE_BIN_TRUE@pdtreplace_DEPENDENCIES = libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__pdtreverse_SOURCES_DIST = pdtreverse.cc +@HAVE_BIN_TRUE@am_pdtreverse_OBJECTS = pdtreverse.$(OBJEXT) +pdtreverse_OBJECTS = $(am_pdtreverse_OBJECTS) +pdtreverse_LDADD = $(LDADD) +@HAVE_BIN_TRUE@pdtreverse_DEPENDENCIES = libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +am__pdtshortestpath_SOURCES_DIST = pdtshortestpath.cc +@HAVE_BIN_TRUE@am_pdtshortestpath_OBJECTS = pdtshortestpath.$(OBJEXT) +pdtshortestpath_OBJECTS = $(am_pdtshortestpath_OBJECTS) +pdtshortestpath_LDADD = $(LDADD) +@HAVE_BIN_TRUE@pdtshortestpath_DEPENDENCIES = libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstpdtscript_la_SOURCES) $(pdtcompose_SOURCES) \ + $(pdtexpand_SOURCES) $(pdtinfo_SOURCES) $(pdtreplace_SOURCES) \ + $(pdtreverse_SOURCES) $(pdtshortestpath_SOURCES) +DIST_SOURCES = $(am__libfstpdtscript_la_SOURCES_DIST) \ + $(am__pdtcompose_SOURCES_DIST) $(am__pdtexpand_SOURCES_DIST) \ + $(am__pdtinfo_SOURCES_DIST) $(am__pdtreplace_SOURCES_DIST) \ + $(am__pdtreverse_SOURCES_DIST) \ + $(am__pdtshortestpath_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS) +@HAVE_BIN_TRUE@LDADD = libfstpdtscript.la \ +@HAVE_BIN_TRUE@ ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +@HAVE_BIN_TRUE@pdtcompose_SOURCES = pdtcompose.cc +@HAVE_BIN_TRUE@pdtexpand_SOURCES = pdtexpand.cc +@HAVE_BIN_TRUE@pdtinfo_SOURCES = pdtinfo.cc +@HAVE_BIN_TRUE@pdtreplace_SOURCES = pdtreplace.cc +@HAVE_BIN_TRUE@pdtreverse_SOURCES = pdtreverse.cc +@HAVE_BIN_TRUE@pdtshortestpath_SOURCES = pdtshortestpath.cc +@HAVE_SCRIPT_TRUE@lib_LTLIBRARIES = libfstpdtscript.la +@HAVE_SCRIPT_TRUE@libfstpdtscript_la_SOURCES = getters.cc pdtscript.cc +@HAVE_SCRIPT_TRUE@libfstpdtscript_la_LDFLAGS = -version-info 16:0:0 +@HAVE_SCRIPT_TRUE@libfstpdtscript_la_LIBADD = ../../script/libfstscript.la \ +@HAVE_SCRIPT_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/pdt/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/pdt/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstpdtscript.la: $(libfstpdtscript_la_OBJECTS) $(libfstpdtscript_la_DEPENDENCIES) $(EXTRA_libfstpdtscript_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstpdtscript_la_LINK) $(am_libfstpdtscript_la_rpath) $(libfstpdtscript_la_OBJECTS) $(libfstpdtscript_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +pdtcompose$(EXEEXT): $(pdtcompose_OBJECTS) $(pdtcompose_DEPENDENCIES) $(EXTRA_pdtcompose_DEPENDENCIES) + @rm -f pdtcompose$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(pdtcompose_OBJECTS) $(pdtcompose_LDADD) $(LIBS) + +pdtexpand$(EXEEXT): $(pdtexpand_OBJECTS) $(pdtexpand_DEPENDENCIES) $(EXTRA_pdtexpand_DEPENDENCIES) + @rm -f pdtexpand$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(pdtexpand_OBJECTS) $(pdtexpand_LDADD) $(LIBS) + +pdtinfo$(EXEEXT): $(pdtinfo_OBJECTS) $(pdtinfo_DEPENDENCIES) $(EXTRA_pdtinfo_DEPENDENCIES) + @rm -f pdtinfo$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(pdtinfo_OBJECTS) $(pdtinfo_LDADD) $(LIBS) + +pdtreplace$(EXEEXT): $(pdtreplace_OBJECTS) $(pdtreplace_DEPENDENCIES) $(EXTRA_pdtreplace_DEPENDENCIES) + @rm -f pdtreplace$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(pdtreplace_OBJECTS) $(pdtreplace_LDADD) $(LIBS) + +pdtreverse$(EXEEXT): $(pdtreverse_OBJECTS) $(pdtreverse_DEPENDENCIES) $(EXTRA_pdtreverse_DEPENDENCIES) + @rm -f pdtreverse$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(pdtreverse_OBJECTS) $(pdtreverse_LDADD) $(LIBS) + +pdtshortestpath$(EXEEXT): $(pdtshortestpath_OBJECTS) $(pdtshortestpath_DEPENDENCIES) $(EXTRA_pdtshortestpath_DEPENDENCIES) + @rm -f pdtshortestpath$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(pdtshortestpath_OBJECTS) $(pdtshortestpath_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getters.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdtcompose.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdtexpand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdtinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdtreplace.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdtreverse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdtscript.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdtshortestpath.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/getters.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/getters.cc new file mode 100644 index 0000000..e1c6877 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/getters.cc @@ -0,0 +1,34 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +namespace fst { +namespace script { + +bool GetPdtComposeFilter(const string &str, PdtComposeFilter *cf) { + if (str == "expand") { + *cf = EXPAND_FILTER; + } else if (str == "expand_paren") { + *cf = EXPAND_PAREN_FILTER; + } else if (str == "paren") { + *cf = PAREN_FILTER; + } else { + return false; + } + return true; +} + +bool GetPdtParserType(const string &str, PdtParserType *pt) { + if (str == "left") { + *pt = PDT_LEFT_PARSER; + } else if (str == "left_sr") { + *pt = PDT_LEFT_SR_PARSER; + } else { + return false; + } + return true; +} + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtcompose.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtcompose.cc new file mode 100644 index 0000000..a6cdb38 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtcompose.cc @@ -0,0 +1,84 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Composes a PDT and an FST. + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +DEFINE_string(pdt_parentheses, "", "PDT parenthesis label pairs"); +DEFINE_bool(left_pdt, true, "Is the first argument the PDT?"); +DEFINE_bool(connect, true, "Trim output?"); +DEFINE_string(compose_filter, "paren", + "Composition filter, one of: \"expand\", \"expand_paren\", " + "\"paren\""); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::ReadLabelPairs; + using fst::PdtComposeFilter; + using fst::PdtComposeOptions; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Compose a PDT and an FST.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt in.fst [out.pdt]\n"; + usage += " in.fst in.pdt [out.pdt]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 3 || argc > 4) { + ShowUsage(); + return 1; + } + + const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1]; + const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2]; + const string out_name = argc > 3 ? argv[3] : ""; + + if (in1_name.empty() && in2_name.empty()) { + LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input."; + return 1; + } + + std::unique_ptr ifst1(FstClass::Read(in1_name)); + if (!ifst1) return 1; + std::unique_ptr ifst2(FstClass::Read(in2_name)); + if (!ifst2) return 1; + + if (FLAGS_pdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No PDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + if (!ReadLabelPairs(FLAGS_pdt_parentheses, &parens, false)) return 1; + + VectorFstClass ofst(ifst1->ArcType()); + + PdtComposeFilter compose_filter; + if (!s::GetPdtComposeFilter(FLAGS_compose_filter, &compose_filter)) { + LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: " + << FLAGS_compose_filter; + return 1; + } + + const PdtComposeOptions copts(FLAGS_connect, compose_filter); + + s::PdtCompose(*ifst1, *ifst2, parens, &ofst, copts, FLAGS_left_pdt); + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtexpand.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtexpand.cc new file mode 100644 index 0000000..f605dc8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtexpand.cc @@ -0,0 +1,68 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Expands a (bounded-stack) PDT as an FST. + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +DEFINE_string(pdt_parentheses, "", "PDT parenthesis label pairs"); +DEFINE_bool(connect, true, "Trim output?"); +DEFINE_bool(keep_parentheses, false, "Keep PDT parentheses in result?"); +DEFINE_string(weight, "", "Weight threshold"); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + using fst::script::WeightClass; + using fst::ReadLabelPairs; + + string usage = "Expand a (bounded-stack) PDT as an FST.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (FLAGS_pdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No PDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + if (!ReadLabelPairs(FLAGS_pdt_parentheses, &parens, false)) return 1; + + const auto weight_threshold = + FLAGS_weight.empty() ? WeightClass::Zero(ifst->WeightType()) + : WeightClass(ifst->WeightType(), FLAGS_weight); + + VectorFstClass ofst(ifst->ArcType()); + s::PdtExpand(*ifst, parens, &ofst, + s::PdtExpandOptions(FLAGS_connect, FLAGS_keep_parentheses, + weight_threshold)); + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtinfo.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtinfo.cc new file mode 100644 index 0000000..ca32150 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtinfo.cc @@ -0,0 +1,54 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prints out various information about a PDT such as number of states, arcs, +// and parentheses. + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +DEFINE_string(pdt_parentheses, "", "PDT parenthesis label pairs"); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::ReadLabelPairs; + using fst::script::FstClass; + + string usage = "Prints out information about a PDT.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 2) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (FLAGS_pdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No PDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + if (!ReadLabelPairs(FLAGS_pdt_parentheses, &parens, false)) return 1; + + s::PrintPdtInfo(*ifst, parens); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtreplace.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtreplace.cc new file mode 100644 index 0000000..7a5f47d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtreplace.cc @@ -0,0 +1,102 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Converts an RTN represented by FSTs and non-terminal labels into a PDT. + +#include + +#include +#include + +#include + +#include +#include +#include +#include + +DEFINE_string(pdt_parentheses, "", "PDT parenthesis label pairs"); +DEFINE_string(pdt_parser_type, "left", + "Construction method, one of: \"left\", \"left_sr\""); +DEFINE_int64(start_paren_labels, fst::kNoLabel, + "Index to use for the first inserted parentheses; if not " + "specified, the next available label beyond the highest output " + "label is used"); +DEFINE_string(left_paren_prefix, "(_", "Prefix to attach to SymbolTable " + "labels for inserted left parentheses"); +DEFINE_string(right_paren_prefix, ")_", "Prefix to attach to SymbolTable " + "labels for inserted right parentheses"); + +void Cleanup(std::vector *pairs) { + for (const auto &pair : *pairs) { + delete pair.second; + } + pairs->clear(); +} + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + using fst::PdtParserType; + using fst::WriteLabelPairs; + + string usage = "Converts an RTN represented by FSTs"; + usage += " and non-terminal labels into PDT.\n\n Usage: "; + usage += argv[0]; + usage += " root.fst rootlabel [rule1.fst label1 ...] [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc < 4) { + ShowUsage(); + return 1; + } + + const string in_name = argv[1]; + const string out_name = argc % 2 == 0 ? argv[argc - 1] : ""; + + auto *ifst = FstClass::Read(in_name); + if (!ifst) return 1; + + PdtParserType parser_type; + if (!s::GetPdtParserType(FLAGS_pdt_parser_type, &parser_type)) { + LOG(ERROR) << argv[0] << ": Unknown PDT parser type: " + << FLAGS_pdt_parser_type; + delete ifst; + return 1; + } + + std::vector pairs; + // Note that if the root label is beyond the range of the underlying FST's + // labels, truncation will occur. + const auto root = atoll(argv[2]); + pairs.emplace_back(root, ifst); + + for (auto i = 3; i < argc - 1; i += 2) { + ifst = FstClass::Read(argv[i]); + if (!ifst) { + Cleanup(&pairs); + return 1; + } + // Note that if the root label is beyond the range of the underlying FST's + // labels, truncation will occur. + const auto label = atoll(argv[i + 1]); + pairs.emplace_back(label, ifst); + } + + VectorFstClass ofst(ifst->ArcType()); + std::vector parens; + s::PdtReplace(pairs, &ofst, &parens, root, parser_type, + FLAGS_start_paren_labels, FLAGS_left_paren_prefix, + FLAGS_right_paren_prefix); + Cleanup(&pairs); + + if (!FLAGS_pdt_parentheses.empty()) { + if (!WriteLabelPairs(FLAGS_pdt_parentheses, parens)) return 1; + } + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtreverse.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtreverse.cc new file mode 100644 index 0000000..042f757 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtreverse.cc @@ -0,0 +1,59 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Reverses a PDT. + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +DEFINE_string(pdt_parentheses, "", "PDT parenthesis label pairs"); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::ReadLabelPairs; + using fst::script::FstClass; + using fst::script::VectorFstClass; + + string usage = "Reverse a PDT.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (FLAGS_pdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No PDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + if (!ReadLabelPairs(FLAGS_pdt_parentheses, &parens, false)) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + s::PdtReverse(*ifst, parens, &ofst); + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtscript.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtscript.cc new file mode 100644 index 0000000..64da244 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtscript.cc @@ -0,0 +1,96 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Definitions of 'scriptable' versions of pdt operations, that is, +// those that can be called with FstClass-type arguments. +// +// See comments in nlp/fst/script/script-impl.h for how the registration +// mechanism allows these to work with various arc types. + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +void PdtCompose(const FstClass &ifst1, const FstClass &ifst2, + const std::vector &parens, + MutableFstClass *ofst, const PdtComposeOptions &copts, + bool left_pdt) { + if (!internal::ArcTypesMatch(ifst1, ifst2, "PdtCompose") || + !internal::ArcTypesMatch(ifst1, *ofst, "PdtCompose")) + return; + PdtComposeArgs args(ifst1, ifst2, parens, ofst, copts, left_pdt); + Apply>("PdtCompose", ifst1.ArcType(), &args); +} + +void PdtExpand(const FstClass &ifst, + const std::vector &parens, + MutableFstClass *ofst, const PdtExpandOptions &opts) { + PdtExpandArgs args(ifst, parens, ofst, opts); + Apply>("PdtExpand", ifst.ArcType(), &args); +} + +void PdtExpand(const FstClass &ifst, + const std::vector> &parens, + MutableFstClass *ofst, bool connect, bool keep_parentheses, + const WeightClass &weight_threshold) { + PdtExpand(ifst, parens, ofst, + PdtExpandOptions(connect, keep_parentheses, weight_threshold)); +} + +void PdtReplace(const std::vector &pairs, + MutableFstClass *ofst, std::vector *parens, + int64 root, PdtParserType parser_type, int64 start_paren_labels, + const string &left_paren_prefix, + const string &right_paren_prefix) { + for (size_t i = 1; i < pairs.size(); ++i) { + if (!internal::ArcTypesMatch(*pairs[i - 1].second, *pairs[i].second, + "PdtReplace")) + return; + } + if (!internal::ArcTypesMatch(*pairs[0].second, *ofst, "PdtReplace")) return; + PdtReplaceArgs args(pairs, ofst, parens, root, parser_type, + start_paren_labels, left_paren_prefix, + right_paren_prefix); + Apply>("PdtReplace", ofst->ArcType(), &args); +} + +void PdtReverse(const FstClass &ifst, + const std::vector &parens, + MutableFstClass *ofst) { + PdtReverseArgs args(ifst, parens, ofst); + Apply>("PdtReverse", ifst.ArcType(), &args); +} + +void PdtShortestPath(const FstClass &ifst, + const std::vector &parens, + MutableFstClass *ofst, + const PdtShortestPathOptions &opts) { + PdtShortestPathArgs args(ifst, parens, ofst, opts); + Apply>("PdtShortestPath", ifst.ArcType(), + &args); +} + +void PrintPdtInfo(const FstClass &ifst, + const std::vector &parens) { + PrintPdtInfoArgs args(ifst, parens); + Apply>("PrintPdtInfo", ifst.ArcType(), &args); +} + +// Register operations for common arc types. + +REGISTER_FST_PDT_OPERATIONS(StdArc); +REGISTER_FST_PDT_OPERATIONS(LogArc); +REGISTER_FST_PDT_OPERATIONS(Log64Arc); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtshortestpath.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtshortestpath.cc new file mode 100644 index 0000000..a7956b0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/pdt/pdtshortestpath.cc @@ -0,0 +1,80 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Returns the shortest path in a (bounded-stack) PDT. + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +DEFINE_bool(keep_parentheses, false, "Keep PDT parentheses in result?"); +DEFINE_string(queue_type, "fifo", + "Queue type: one of: " + "\"fifo\", \"lifo\", \"state\""); +DEFINE_bool(path_gc, true, "Garbage collect shortest path data?"); +DEFINE_string(pdt_parentheses, "", "PDT parenthesis label pairs"); + +int main(int argc, char **argv) { + namespace s = fst::script; + using fst::script::FstClass; + using fst::script::VectorFstClass; + using fst::QueueType; + using fst::ReadLabelPairs; + + string usage = "Shortest path in a (bounded-stack) PDT.\n\n Usage: "; + usage += argv[0]; + usage += " in.pdt [out.fst]\n"; + + std::set_new_handler(FailedNewHandler); + SET_FLAGS(usage.c_str(), &argc, &argv, true); + if (argc > 3) { + ShowUsage(); + return 1; + } + + const string in_name = + (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : ""; + const string out_name = argc > 2 ? argv[2] : ""; + + std::unique_ptr ifst(FstClass::Read(in_name)); + if (!ifst) return 1; + + if (FLAGS_pdt_parentheses.empty()) { + LOG(ERROR) << argv[0] << ": No PDT parenthesis label pairs provided"; + return 1; + } + + std::vector parens; + if (!ReadLabelPairs(FLAGS_pdt_parentheses, &parens, false)) return 1; + + VectorFstClass ofst(ifst->ArcType()); + + QueueType qt; + if (FLAGS_queue_type == "fifo") { + qt = fst::FIFO_QUEUE; + } else if (FLAGS_queue_type == "lifo") { + qt = fst::LIFO_QUEUE; + } else if (FLAGS_queue_type == "state") { + qt = fst::STATE_ORDER_QUEUE; + } else { + LOG(ERROR) << "Unknown queue type: " << FLAGS_queue_type; + return 1; + } + + const s::PdtShortestPathOptions opts(qt, FLAGS_keep_parentheses, + FLAGS_path_gc); + + s::PdtShortestPath(*ifst, parens, &ofst, opts); + + ofst.Write(out_name); + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/python/Makefile.am new file mode 100644 index 0000000..3406524 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/Makefile.am @@ -0,0 +1,18 @@ +# NB: we use the Cython-generated .cc files rather than the *.pxd/.pyx sources +# used to generate them. Consequently, modifications to the .pyx files will not +# influence the build unless the .cc files are regenerated using Cython. + +python_LTLIBRARIES = pywrapfst.la + +pyexec_LTILIBRARIES = pywrapfst.la + +pywrapfst_la_SOURCES = pywrapfst.cc +pywrapfst_la_CPPFLAGS = -I$(srcdir)/../../include $(PYTHON_CPPFLAGS) +pywrapfst_la_LDFLAGS = $(PYTHON_LDFLAGS) -avoid-version -module +pywrapfst_la_LIBADD = ../far/libfstfarscript.la ../far/libfstfar.la \ + ../../script/libfstscript.la ../../lib/libfst.la \ + -lm $(DL_LIBS) + +# Exports the *.pxd/*.pxd source files. +EXTRA_DIST = basictypes.pxd fst.pxd ios.pxd memory.pxd pywrapfst.pxd \ + pywrapfst.pyx diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/python/Makefile.in new file mode 100644 index 0000000..9742573 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/Makefile.in @@ -0,0 +1,693 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# NB: we use the Cython-generated .cc files rather than the *.pxd/.pyx sources +# used to generate them. Consequently, modifications to the .pyx files will not +# influence the build unless the .cc files are regenerated using Cython. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/extensions/python +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pythondir)" +LTLIBRARIES = $(python_LTLIBRARIES) +am__DEPENDENCIES_1 = +pywrapfst_la_DEPENDENCIES = ../far/libfstfarscript.la \ + ../far/libfstfar.la ../../script/libfstscript.la \ + ../../lib/libfst.la $(am__DEPENDENCIES_1) +am_pywrapfst_la_OBJECTS = pywrapfst_la-pywrapfst.lo +pywrapfst_la_OBJECTS = $(am_pywrapfst_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +pywrapfst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(pywrapfst_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(pywrapfst_la_SOURCES) +DIST_SOURCES = $(pywrapfst_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +python_LTLIBRARIES = pywrapfst.la +pyexec_LTILIBRARIES = pywrapfst.la +pywrapfst_la_SOURCES = pywrapfst.cc +pywrapfst_la_CPPFLAGS = -I$(srcdir)/../../include $(PYTHON_CPPFLAGS) +pywrapfst_la_LDFLAGS = $(PYTHON_LDFLAGS) -avoid-version -module +pywrapfst_la_LIBADD = ../far/libfstfarscript.la ../far/libfstfar.la \ + ../../script/libfstscript.la ../../lib/libfst.la \ + -lm $(DL_LIBS) + + +# Exports the *.pxd/*.pxd source files. +EXTRA_DIST = basictypes.pxd fst.pxd ios.pxd memory.pxd pywrapfst.pxd \ + pywrapfst.pyx + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/python/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/python/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-pythonLTLIBRARIES: $(python_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(python_LTLIBRARIES)'; test -n "$(pythondir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(pythondir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pythondir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pythondir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pythondir)"; \ + } + +uninstall-pythonLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(python_LTLIBRARIES)'; test -n "$(pythondir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pythondir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pythondir)/$$f"; \ + done + +clean-pythonLTLIBRARIES: + -test -z "$(python_LTLIBRARIES)" || rm -f $(python_LTLIBRARIES) + @list='$(python_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +pywrapfst.la: $(pywrapfst_la_OBJECTS) $(pywrapfst_la_DEPENDENCIES) $(EXTRA_pywrapfst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(pywrapfst_la_LINK) -rpath $(pythondir) $(pywrapfst_la_OBJECTS) $(pywrapfst_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pywrapfst_la-pywrapfst.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +pywrapfst_la-pywrapfst.lo: pywrapfst.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pywrapfst_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pywrapfst_la-pywrapfst.lo -MD -MP -MF $(DEPDIR)/pywrapfst_la-pywrapfst.Tpo -c -o pywrapfst_la-pywrapfst.lo `test -f 'pywrapfst.cc' || echo '$(srcdir)/'`pywrapfst.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pywrapfst_la-pywrapfst.Tpo $(DEPDIR)/pywrapfst_la-pywrapfst.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='pywrapfst.cc' object='pywrapfst_la-pywrapfst.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pywrapfst_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pywrapfst_la-pywrapfst.lo `test -f 'pywrapfst.cc' || echo '$(srcdir)/'`pywrapfst.cc + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pythondir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pythonLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pythonLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pythonLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pythonLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-pythonLTLIBRARIES \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pythonLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/basictypes.pxd b/runtime/onnxruntime/third_party/openfst/src/extensions/python/basictypes.pxd new file mode 100644 index 0000000..0d93677 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/basictypes.pxd @@ -0,0 +1,17 @@ +# See www.openfst.org for extensive documentation on this weighted +# finite-state transducer library. + + +from libc.stdint cimport * + + +cdef extern from "" nogil: + + ctypedef int8_t int8 + ctypedef int16_t int16 + ctypedef int32_t int32 + ctypedef int64_t int64 + ctypedef uint8_t uint8 + ctypedef uint16_t uint16 + ctypedef uint32_t uint32 + ctypedef uint64_t uint64 diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/fst.pxd b/runtime/onnxruntime/third_party/openfst/src/extensions/python/fst.pxd new file mode 100644 index 0000000..51cef72 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/fst.pxd @@ -0,0 +1,765 @@ +# See www.openfst.org for extensive documentation on this weighted +# finite-state transducer library. + + +from libc.time cimport time_t +from libc.time cimport time + +from libcpp cimport bool +from libcpp.vector cimport vector +from libcpp.utility cimport pair + +from libcpp.string cimport string +from basictypes cimport int32 +from basictypes cimport int64 +from basictypes cimport uint32 +from basictypes cimport uint64 +from ios cimport istream +from ios cimport ostream + + +cdef extern from "" nogil: + + # Note that this is a copy, so it should be viewed as read-only. + + bool FLAGS_fst_error_fatal + + +cdef extern from "" namespace "fst" nogil: + + # FST properties. + const uint64 kExpanded + const uint64 kMutable + const uint64 kError + const uint64 kAcceptor + const uint64 kNotAcceptor + const uint64 kIDeterministic + const uint64 kNonIDeterministic + const uint64 kODeterministic + const uint64 kNonODeterministic + const uint64 kEpsilons + const uint64 kNoEpsilons + const uint64 kIEpsilons + const uint64 kNoIEpsilons + const uint64 kOEpsilons + const uint64 kNoOEpsilons + const uint64 kILabelSorted + const uint64 kNotILabelSorted + const uint64 kOLabelSorted + const uint64 kNotOLabelSorted + const uint64 kWeighted + const uint64 kUnweighted + const uint64 kCyclic + const uint64 kAcyclic + const uint64 kInitialCyclic + const uint64 kInitialAcyclic + const uint64 kTopSorted + const uint64 kNotTopSorted + const uint64 kAccessible + const uint64 kNotAccessible + const uint64 kCoAccessible + const uint64 kNotCoAccessible + const uint64 kString + const uint64 kNotString + const uint64 kWeightedCycles + const uint64 kUnweightedCycles + const uint64 kNullProperties + const uint64 kCopyProperties + const uint64 kIntrinsicProperties + const uint64 kExtrinsicProperties + const uint64 kSetStartProperties + const uint64 kSetFinalProperties + const uint64 kAddStateProperties + const uint64 kAddArcProperties + const uint64 kSetArcProperties + const uint64 kDeleteStatesProperties + const uint64 kDeleteArcsProperties + const uint64 kStateSortProperties + const uint64 kArcSortProperties + const uint64 kILabelInvariantProperties + const uint64 kOLabelInvariantProperties + const uint64 kWeightInvariantProperties + const uint64 kAddSuperFinalProperties + const uint64 kRmSuperFinalProperties + const uint64 kBinaryProperties + const uint64 kTrinaryProperties + const uint64 kPosTrinaryProperties + const uint64 kNegTrinaryProperties + const uint64 kFstProperties + + # ArcIterator flags. + const uint32 kArcILabelValue + const uint32 kArcOLabelValue + const uint32 kArcWeightValue + const uint32 kArcNextStateValue + const uint32 kArcNoCache + const uint32 kArcValueFlags + const uint32 kArcFlags + + # EncodeMapper flags. + const uint32 kEncodeLabels + const uint32 kEncodeWeights + const uint32 kEncodeFlags + + # Default argument constants. + const float kDelta + const float kShortestDelta + const int kNoLabel + const int kNoStateId + const int64 kNoSymbol + + + enum ClosureType: + CLOSURE_STAR + CLOSURE_PLUS + + + enum ComposeFilter: + AUTO_FILTER + NULL_FILTER + SEQUENCE_FILTER + ALT_SEQUENCE_FILTER + MATCH_FILTER + TRIVIAL_FILTER + + + cdef cppclass ComposeOptions: + + ComposeOptions(bool, ComposeFilter) + + + enum DeterminizeType: + DETERMINIZE_FUNCTIONAL + DETERMINIZE_NONFUNCTIONAL + DETERMINIZE_DISAMBIGUATE + + + enum EncodeType: + DECODE + ENCODE + + + enum EpsNormalizeType: + EPS_NORM_INPUT + EPS_NORM_OUTPUT + + + enum ProjectType: + PROJECT_INPUT + PROJECT_OUTPUT + + + enum QueueType: + TRIVIAL_QUEUE + FIFO_QUEUE + LIFO_QUEUE + SHORTEST_FIRST_QUEUE + TOP_ORDER_QUEUE + STATE_ORDER_QUEUE + SCC_QUEUE + AUTO_QUEUE + OTHER_QUEUE + + + # This is a templated struct at the C++ level, but Cython does not support + # templated structs unless we pretend they are full-blown classes. + cdef cppclass RandGenOptions[RandArcSelection]: + + RandGenOptions(const RandArcSelection &, int32, int32, bool, bool) + + + enum ReplaceLabelType: + REPLACE_LABEL_NEITHER + REPLACE_LABEL_INPUT + REPLACE_LABEL_OUTPUT + REPLACE_LABEL_BOTH + + + enum ReweightType: + REWEIGHT_TO_INITIAL + REWEIGHT_TO_FINAL + + + cdef cppclass SymbolTableTextOptions: + + SymbolTableTextOptions(bool) + + # Symbol tables. + cdef cppclass SymbolTable: + + @staticmethod + int64 kNoSymbol + + SymbolTable() + + SymbolTable(const string &) + + @staticmethod + SymbolTable *Read(const string &) + + # Aliased for overload. + @staticmethod + SymbolTable *ReadStream "Read"(istream &, const string &) + + @staticmethod + SymbolTable *ReadText(const string &, const SymbolTableTextOptions &) + + int64 AddSymbol(const string &, int64) + + int64 AddSymbol(const string &) + + SymbolTable *Copy() + + # Aliased for overload. + string FindSymbol "Find"(int64) + + # Aliased for overload. + int64 FindIndex "Find"(string) + + # Aliased for overload. + bool MemberSymbol "Member"(string) + + # Aliased for overload. + bool MemberIndex "Member"(int64) + + void AddTable(const SymbolTable &) + + int64 GetNthKey(ssize_t) + + const string &Name() + + void SetName(const string &) + + const string &CheckSum() + + const string &LabeledCheckSum() + + bool Write(ostream &) + + bool Write(const string &) + + bool WriteToString(ostream &) + + bool WriteToString(const string &) + + bool WriteText(ostream &) + + bool WriteText(const string &) + + int64 AvailableKey() + + size_t NumSymbols() + + + SymbolTable *CompactSymbolTable(const SymbolTable &syms) + + SymbolTable *MergeSymbolTable(const SymbolTable &, const SymbolTable &, + bool *) + + SymbolTable *FstReadSymbols(const string &, bool) + + + cdef cppclass SymbolTableIterator: + + SymbolTableIterator(const SymbolTable &) + + bool Done() + + void Next() + + void Reset() + + string Symbol() + + int64 Value() + + +cdef extern from "" namespace "fst::script" nogil: + + + # Weights. + cdef cppclass WeightClass: + + WeightClass() + + WeightClass(const WeightClass &) + + WeightClass(const string &, const string &) + + const string &Type() + + string ToString() + + bool Member() + + @staticmethod + const WeightClass &Zero(const string &) + + @staticmethod + const WeightClass &One(const string &) + + @staticmethod + const WeightClass &NoWeight(const string &) + + # Alias. + cdef bool Eq "operator=="(const WeightClass &, const WeightClass &) + + # Alias. + cdef bool Ne "operator!="(const WeightClass &, const WeightClass &) + + cdef WeightClass Plus(const WeightClass &, const WeightClass &) + + cdef WeightClass Times(const WeightClass &, const WeightClass &) + + cdef WeightClass Divide(const WeightClass &, const WeightClass &) + + cdef WeightClass Power(const WeightClass &, size_t) + + # Arcs. + cdef cppclass ArcClass: + + ArcClass(const ArcClass &) + + ArcClass(int64, int64, const WeightClass &, int64) + + int64 ilabel + int64 olabel + WeightClass weight + int64 nextstate + + + # FSTs. + + + cdef cppclass FstClass: + + FstClass(const FstClass &) + + @staticmethod + FstClass *Read(const string &) + + # Aliased for overload. + @staticmethod + FstClass *ReadStream "Read"(istream &, const string &) + + int64 Start() + + WeightClass Final(int64) + + size_t NumArcs(int64) + + size_t NumInputEpsilons(int64) + + size_t NumOutputEpsilons(int64) + + const string &ArcType() + + const string &FstType() + + const SymbolTable *InputSymbols() + + const SymbolTable *OutputSymbols() + + const string &WeightType() + + bool Write(const string &) + + bool Write(ostream &, const string &) + + uint64 Properties(uint64, bool) + + bool ValidStateId(int64) + + + cdef cppclass MutableFstClass(FstClass): + + bool AddArc(int64, const ArcClass &) + + int64 AddState() + + bool DeleteArcs(int64, size_t) + + bool DeleteArcs(int64) + + bool DeleteStates(const vector[int64] &) + + void DeleteStates() + + SymbolTable *MutableInputSymbols() + + SymbolTable *MutableOutputSymbols() + + int64 NumStates() + + bool ReserveArcs(int64, size_t) + + void ReserveStates(int64) + + bool SetStart(int64) + + bool SetFinal(int64, const WeightClass &) + + void SetInputSymbols(SymbolTable *) + + void SetOutputSymbols(SymbolTable *) + + void SetProperties(uint64, uint64) + + cdef cppclass VectorFstClass(MutableFstClass): + + VectorFstClass(const FstClass &) + + VectorFstClass(const string &) + + + # EncodeMapper. + cdef cppclass EncodeMapperClass: + + EncodeMapperClass(const string &, uint32, EncodeType) + + # Aliased to __call__ as Cython doesn't have good support for operator(). + ArcClass __call__ "operator()"(const ArcClass &) + + const string &ArcType() + + uint32 Flags() + + uint64 Properties(uint64) + + EncodeType Type() + + const SymbolTable *InputSymbols() + + const SymbolTable *OutputSymbols() + + void SetInputSymbols(const SymbolTable *) + + void SetOutputSymbols(const SymbolTable *) + + const string &WeightType() + + + # Iterators. + + + cdef cppclass ArcIteratorClass: + + ArcIteratorClass(const FstClass &, int64) + + bool Done() + + ArcClass Value() + + void Next() + + void Reset() + + void Seek(size_t) + + size_t Position() + + uint32 Flags() + + void SetFlags(uint32, uint32) + + cdef cppclass MutableArcIteratorClass: + + MutableArcIteratorClass(MutableFstClass *, int64) + + bool Done() + + ArcClass Value() + + void Next() + + void Reset() + + void Seek(size_t) + + void SetValue(const ArcClass &) + + size_t Position() + + uint32 Flags() + + void SetFlags(uint32, uint32) + + cdef cppclass StateIteratorClass: + + StateIteratorClass(const FstClass &) + + bool Done() + + int64 Value() + + void Next() + + void Reset() + + +ctypedef pair[int64, const FstClass *] LabelFstClassPair + +ctypedef pair[int64, int64] LabelPair + + +cdef extern from "" namespace "fst::script" nogil: + + enum ArcFilterType: + ANY_ARC_FILTER + EPSILON_ARC_FILTER + INPUT_EPSILON_ARC_FILTER + OUTPUT_EPSILON_ARC_FILTER + + enum ArcSortType: + ILABEL_SORT + OLABEL_SORT + + cdef void ArcSort(MutableFstClass *, ArcSortType) + + cdef ClosureType GetClosureType(bool) + + cdef void Closure(MutableFstClass *, ClosureType) + + cdef FstClass *CompileFstInternal(istream &, const string &, + const string &, const string &, + const SymbolTable *, const SymbolTable *, + const SymbolTable*, bool, bool, bool, bool, + bool) + + cdef void Compose(FstClass &, FstClass &, MutableFstClass *, + const ComposeOptions &) + + cdef void Concat(MutableFstClass *, const FstClass &) + + cdef void Connect(MutableFstClass *) + + cdef FstClass *Convert(const FstClass &, const string &) + + cdef void Decode(MutableFstClass *, const EncodeMapperClass &) + + cdef cppclass DeterminizeOptions: + + DeterminizeOptions(float, const WeightClass &, int64, int64, + DeterminizeType, bool) + + cdef void Determinize(const FstClass &, MutableFstClass *, + const DeterminizeOptions &) + + cdef cppclass DisambiguateOptions: + + DisambiguateOptions(float, const WeightClass &, int64, int64) + + cdef void Disambiguate(const FstClass &, MutableFstClass *, + const DisambiguateOptions &) + + cdef void Difference(const FstClass &, const FstClass &, MutableFstClass *, + const ComposeOptions &) + + cdef void DrawFst(const FstClass &fst, const SymbolTable *, + const SymbolTable *, const SymbolTable *, bool, + const string &, float, float, bool, bool, float, float, int, + int, const string &, bool, ostream *, const string &) + + cdef void Encode(MutableFstClass *, EncodeMapperClass *) + + cdef EpsNormalizeType GetEpsNormalizeType(bool) + + cdef void EpsNormalize(const FstClass &, MutableFstClass *, EpsNormalizeType) + + cdef bool Equal(const FstClass &, const FstClass &, float) + + cdef bool Equivalent(const FstClass &, const FstClass &, float) + + cdef void Intersect(const FstClass &, const FstClass &, MutableFstClass *, + const ComposeOptions &) + + cdef void Invert(MutableFstClass *fst) + + cdef bool Isomorphic(const FstClass &, const FstClass &, float) + + enum MapType: + ARC_SUM_MAPPER + IDENTITY_MAPPER + INPUT_EPSILON_MAPPER + INVERT_MAPPER + OUTPUT_EPSILON_MAPPER + PLUS_MAPPER + QUANTIZE_MAPPER + RMWEIGHT_MAPPER + SUPERFINAL_MAPPER + TIMES_MAPPER + TO_LOG_MAPPER + TO_LOG64_MAPPER + TO_STD_MAPPER + + cdef FstClass *Map(const FstClass &, MapType, float, double, + const WeightClass &) + + cdef void Minimize(MutableFstClass *, MutableFstClass *, float, bool) + + cdef ProjectType GetProjectType(bool) + + cdef void Project(MutableFstClass *, ProjectType) + + cdef void PrintFst(const FstClass &, ostream &, const string &, + const SymbolTable *, const SymbolTable *, + const SymbolTable *, bool, bool, const string &) + + cdef void Prune(const FstClass &, MutableFstClass *, const WeightClass &, + int64, float) + + cdef void Prune(MutableFstClass *, const WeightClass &, int64, float) + + cdef void Push(const FstClass &, MutableFstClass *, uint32 flags, + ReweightType, float) + + cdef void Push(MutableFstClass *, ReweightType, float, bool) + + enum RandArcSelection: + UNIFORM_ARC_SELECTOR + LOG_PROB_ARC_SELECTOR + FAST_LOG_PROB_ARC_SELECTOR + + cdef bool RandEquivalent(const FstClass &, const FstClass &, int32, float, + time_t, const RandGenOptions[RandArcSelection] &) + + cdef void RandGen(const FstClass &, MutableFstClass *, time_t, + const RandGenOptions[RandArcSelection] &) + + cdef void Relabel(MutableFstClass *, const SymbolTable *, + const SymbolTable *, const string &, bool, + const SymbolTable *, const SymbolTable *, const string &, + bool) + + cdef void Relabel(MutableFstClass *, const vector[LabelPair] &, + const vector[LabelPair] &) + + cdef cppclass ReplaceOptions: + + ReplaceOptions(int64, ReplaceLabelType, ReplaceLabelType, int64) + + cdef void Replace(const vector[LabelFstClassPair] &, MutableFstClass *, + const ReplaceOptions &) + + cdef void Reverse(const FstClass &, MutableFstClass *, bool) + + cdef void Reweight(MutableFstClass *, const vector[WeightClass] &, + ReweightType) + + cdef cppclass RmEpsilonOptions: + + RmEpsilonOptions(QueueType, bool, const WeightClass &, int64, float) + + cdef void RmEpsilon(MutableFstClass *, const RmEpsilonOptions &) + + cdef cppclass ShortestDistanceOptions: + + ShortestDistanceOptions(QueueType, ArcFilterType, int64, float) + + cdef void ShortestDistance(const FstClass &, vector[WeightClass] *, + const ShortestDistanceOptions &) + + cdef void ShortestDistance(const FstClass &, vector[WeightClass] *, bool, + float) + + cdef cppclass ShortestPathOptions: + + ShortestPathOptions(QueueType, int32, bool, float, const WeightClass &, + int64) + + cdef void ShortestPath(const FstClass &, MutableFstClass *, + const ShortestPathOptions &) + + cdef void Synchronize(const FstClass &, MutableFstClass *) + + cdef bool TopSort(MutableFstClass *) + + cdef void Union(MutableFstClass *, const FstClass &) + + cdef bool Verify(const FstClass &) + + +cdef extern from "" namespace "fst::script" nogil: + + cdef bool GetArcSortType(const string &, ArcSortType *) + + cdef bool GetComposeFilter(const string &, ComposeFilter *) + + cdef bool GetDeterminizeType(const string &, DeterminizeType *) + + cdef uint32 GetEncodeFlags(bool, bool) + + cdef bool GetMapType(const string &, MapType *) + + cdef uint32 GetPushFlags(bool, bool, bool, bool) + + cdef bool GetQueueType(const string &, QueueType *) + + cdef bool GetRandArcSelection(const string &, RandArcSelection *) + + cdef bool GetReplaceLabelType(string, bool, ReplaceLabelType *) + + cdef ReweightType GetReweightType(bool) + + +cdef extern from "" namespace "fst" nogil: + + enum FarType: + FAR_DEFAULT + FAR_STTABLE + FAR_STLIST + FAR_FST + FAR_SSTABLE + +cdef extern from "" \ + namespace "fst" nogil: + + string GetFarTypeString(FarType) + + +cdef extern from "" \ + namespace "fst::script" nogil: + + FarType GetFarType(const string &) + + +cdef extern from "" \ + namespace "fst::script" nogil: + + cdef cppclass FarReaderClass: + + const string &ArcType() + + bool Done() + + bool Error() + + bool Find(const string &) + + const FstClass *GetFstClass() + + const string &GetKey() + + void Next() + + void Reset() + + FarType Type() + + # For simplicity, we always use the multiple-file one. + + @staticmethod + FarReaderClass *Open(const vector[string] &) + + cdef cppclass FarWriterClass: + + bool Add(const string &, const FstClass &) + + bool Error() + + const string &ArcType() + + FarType Type() + + @staticmethod + FarWriterClass *Create(const string &, const string &, FarType) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/ios.pxd b/runtime/onnxruntime/third_party/openfst/src/extensions/python/ios.pxd new file mode 100644 index 0000000..173e3c9 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/ios.pxd @@ -0,0 +1,77 @@ +# See www.openfst.org for extensive documentation on this weighted +# finite-state transducer library. + + +from libcpp.string cimport string +from basictypes cimport int8 +from basictypes cimport int16 +from basictypes cimport int32 +from basictypes cimport int64 +from basictypes cimport uint8 +from basictypes cimport uint16 +from basictypes cimport uint32 +from basictypes cimport uint64 + + +cdef extern from "" namespace "std" nogil: + + cdef cppclass iostream: + + pass + + cdef cppclass istream(iostream): + + pass + + cdef cppclass ostream(iostream): + + pass + + +# We are ignoring openmodes for the moment. + + +cdef extern from "" namespace "std" nogil: + + cdef cppclass ifstream(istream): + + ifstream(const string &) + + cdef cppclass ofstream(ostream): + + ofstream(const string &) + + +cdef extern from "" namespace "std" nogil: + + cdef cppclass stringstream(istream, ostream): + + stringstream() + + string str() + + stringstream &operator<<(const string &) + + stringstream &operator<<(bool) + + # We define these in terms of the Google basictypes. + + stringstream &operator<<(int8) + + stringstream &operator<<(uint8) + + stringstream &operator<<(int16) + + stringstream &operator<<(uint16) + + stringstream &operator<<(int32) + + stringstream &operator<<(uint32) + + stringstream &operator<<(int64) + + stringstream &operator<<(uint64) + + stringstream &operator<<(double) + + stringstream &operator<<(long double) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/memory.pxd b/runtime/onnxruntime/third_party/openfst/src/extensions/python/memory.pxd new file mode 100644 index 0000000..9b42edd --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/memory.pxd @@ -0,0 +1,12 @@ +# See www.openfst.org for extensive documentation on this weighted +# finite-state transducer library. + + +from libcpp.memory cimport shared_ptr + + +# This is mysteriously missing from libcpp.memory. + +cdef extern from "" namespace "std" nogil: + + shared_ptr[T] static_pointer_cast[T, U](const shared_ptr[U] &) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.cc new file mode 100644 index 0000000..be72573 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.cc @@ -0,0 +1,57504 @@ +/* Generated by Cython 0.29.6 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.6+ or Python 3.3+. +#else +#define CYTHON_ABI "0_29_6" +#define CYTHON_HEX_VERSION 0x001D06F0 +#define CYTHON_FUTURE_DIVISION 1 +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef HAVE_LONG_LONG + #if PY_VERSION_HEX >= 0x02070000 + #define HAVE_LONG_LONG + #endif +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 +#elif defined(PYSTON_VERSION) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #endif + #ifndef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #endif +#endif +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) && __cplusplus >= 201103L + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif + +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(U other) { return *ptr == other; } + template bool operator !=(U other) { return *ptr != other; } + private: + T *ptr; +}; + +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define Py_OptimizeFlag 0 +#endif +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords +#endif +#if CYTHON_FAST_PYCCALL +#define __Pyx_PyFastCFunction_Check(func)\ + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#else +#define __Pyx_PyFastCFunction_Check(func) 0 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 + #define PyMem_RawMalloc(n) PyMem_Malloc(n) + #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) + #define PyMem_RawFree(p) PyMem_Free(p) +#endif +#if CYTHON_COMPILING_IN_PYSTON + #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#else +#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) +#else + #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact + #define PyObject_Unicode PyObject_Str +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) +#else + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) +#else + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) +#endif +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) + #else + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) + #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL +#endif +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) + #define _USE_MATH_DEFINES +#endif +#include +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + + +#define __PYX_ERR(f_index, lineno, Ln_error) \ +{ \ + __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ +} + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#define __PYX_HAVE__pywrapfst +#define __PYX_HAVE_API__pywrapfst +/* Early includes */ +#include +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 1 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) +#define __PYX_DEFAULT_STRING_ENCODING "utf8" +#define __Pyx_PyObject_FromString __Pyx_PyUnicode_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +#if CYTHON_ASSUME_SAFE_MACROS +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } + +static PyObject *__pyx_m = NULL; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_cython_runtime = NULL; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static PyObject *__pyx_empty_unicode; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "pywrapfst.pyx", + "stringsource", +}; + +/* "basictypes.pxd":22 + * + * + * ctypedef int8_t int8 # <<<<<<<<<<<<<< + * ctypedef int16_t int16 + * ctypedef int32_t int32 + */ +typedef int8_t __pyx_t_10basictypes_int8; + +/* "basictypes.pxd":23 + * + * ctypedef int8_t int8 + * ctypedef int16_t int16 # <<<<<<<<<<<<<< + * ctypedef int32_t int32 + * ctypedef int64_t int64 + */ +typedef int16_t __pyx_t_10basictypes_int16; + +/* "basictypes.pxd":24 + * ctypedef int8_t int8 + * ctypedef int16_t int16 + * ctypedef int32_t int32 # <<<<<<<<<<<<<< + * ctypedef int64_t int64 + * ctypedef uint8_t uint8 + */ +typedef int32_t __pyx_t_10basictypes_int32; + +/* "basictypes.pxd":25 + * ctypedef int16_t int16 + * ctypedef int32_t int32 + * ctypedef int64_t int64 # <<<<<<<<<<<<<< + * ctypedef uint8_t uint8 + * ctypedef uint16_t uint16 + */ +typedef int64_t __pyx_t_10basictypes_int64; + +/* "basictypes.pxd":26 + * ctypedef int32_t int32 + * ctypedef int64_t int64 + * ctypedef uint8_t uint8 # <<<<<<<<<<<<<< + * ctypedef uint16_t uint16 + * ctypedef uint32_t uint32 + */ +typedef uint8_t __pyx_t_10basictypes_uint8; + +/* "basictypes.pxd":27 + * ctypedef int64_t int64 + * ctypedef uint8_t uint8 + * ctypedef uint16_t uint16 # <<<<<<<<<<<<<< + * ctypedef uint32_t uint32 + * ctypedef uint64_t uint64 + */ +typedef uint16_t __pyx_t_10basictypes_uint16; + +/* "basictypes.pxd":28 + * ctypedef uint8_t uint8 + * ctypedef uint16_t uint16 + * ctypedef uint32_t uint32 # <<<<<<<<<<<<<< + * ctypedef uint64_t uint64 + */ +typedef uint32_t __pyx_t_10basictypes_uint32; + +/* "basictypes.pxd":29 + * ctypedef uint16_t uint16 + * ctypedef uint32_t uint32 + * ctypedef uint64_t uint64 # <<<<<<<<<<<<<< + */ +typedef uint64_t __pyx_t_10basictypes_uint64; + +/*--- Type declarations ---*/ +struct __pyx_obj_9pywrapfst_Weight; +struct __pyx_obj_9pywrapfst__SymbolTable; +struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable; +struct __pyx_obj_9pywrapfst__FstSymbolTable; +struct __pyx_obj_9pywrapfst__MutableSymbolTable; +struct __pyx_obj_9pywrapfst__MutableFstSymbolTable; +struct __pyx_obj_9pywrapfst_SymbolTable; +struct __pyx_obj_9pywrapfst_SymbolTableIterator; +struct __pyx_obj_9pywrapfst_EncodeMapper; +struct __pyx_obj_9pywrapfst__Fst; +struct __pyx_obj_9pywrapfst__MutableFst; +struct __pyx_obj_9pywrapfst_Arc; +struct __pyx_obj_9pywrapfst_ArcIterator; +struct __pyx_obj_9pywrapfst_MutableArcIterator; +struct __pyx_obj_9pywrapfst_StateIterator; +struct __pyx_obj_9pywrapfst_Compiler; +struct __pyx_obj_9pywrapfst_FarReader; +struct __pyx_obj_9pywrapfst_FarWriter; +struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__; + +/* "fst.pxd":514 + * + * + * ctypedef pair[int64, const FstClass *] LabelFstClassPair # <<<<<<<<<<<<<< + * + * ctypedef pair[int64, int64] LabelPair + */ +typedef std::pair<__pyx_t_10basictypes_int64,fst::script::FstClass const *> __pyx_t_3fst_LabelFstClassPair; + +/* "fst.pxd":516 + * ctypedef pair[int64, const FstClass *] LabelFstClassPair + * + * ctypedef pair[int64, int64] LabelPair # <<<<<<<<<<<<<< + * + * + */ +typedef std::pair<__pyx_t_10basictypes_int64,__pyx_t_10basictypes_int64> __pyx_t_3fst_LabelPair; +struct __pyx_opt_args_9pywrapfst_19_MutableSymbolTable_add_symbol; +struct __pyx_opt_args_9pywrapfst_4_Fst_draw; +struct __pyx_opt_args_9pywrapfst_4_Fst_text; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__arcsort; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__closure; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_arcs; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_states; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__minimize; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__project; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__prune; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__push; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_pairs; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_tables; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__reweight; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__rmepsilon; +struct __pyx_opt_args_9pywrapfst_11_MutableFst__set_final; +struct __pyx_opt_args_9pywrapfst__create_Fst; +struct __pyx_opt_args_9pywrapfst__map; +struct __pyx_opt_args_9pywrapfst_arcmap; +struct __pyx_opt_args_9pywrapfst_compose; +struct __pyx_opt_args_9pywrapfst_convert; +struct __pyx_opt_args_9pywrapfst_determinize; +struct __pyx_opt_args_9pywrapfst_difference; +struct __pyx_opt_args_9pywrapfst_disambiguate; +struct __pyx_opt_args_9pywrapfst_epsnormalize; +struct __pyx_opt_args_9pywrapfst_equal; +struct __pyx_opt_args_9pywrapfst_equivalent; +struct __pyx_opt_args_9pywrapfst_intersect; +struct __pyx_opt_args_9pywrapfst_isomorphic; +struct __pyx_opt_args_9pywrapfst_prune; +struct __pyx_opt_args_9pywrapfst_push; +struct __pyx_opt_args_9pywrapfst_randequivalent; +struct __pyx_opt_args_9pywrapfst_randgen; +struct __pyx_opt_args_9pywrapfst_replace; +struct __pyx_opt_args_9pywrapfst_reverse; +struct __pyx_opt_args_9pywrapfst__shortestdistance; +struct __pyx_opt_args_9pywrapfst_shortestpath; + +/* "pywrapfst.pxd":100 + * # SymbolTable. + * + * ctypedef fst.SymbolTable * SymbolTable_ptr # <<<<<<<<<<<<<< + * + * + */ +typedef fst::SymbolTable *__pyx_t_9pywrapfst_SymbolTable_ptr; + +/* "pywrapfst.pxd":142 + * cdef class _MutableSymbolTable(_SymbolTable): + * + * cpdef int64 add_symbol(self, symbol, int64 key=?) # <<<<<<<<<<<<<< + * + * cpdef void add_table(self, _SymbolTable syms) + */ +struct __pyx_opt_args_9pywrapfst_19_MutableSymbolTable_add_symbol { + int __pyx_n; + __pyx_t_10basictypes_int64 key; +}; + +/* "pywrapfst.pxd":220 + * + * + * ctypedef fst.FstClass * FstClass_ptr # <<<<<<<<<<<<<< + * ctypedef fst.MutableFstClass * MutableFstClass_ptr + * ctypedef fst.VectorFstClass * VectorFstClass_ptr + */ +typedef fst::script::FstClass *__pyx_t_9pywrapfst_FstClass_ptr; + +/* "pywrapfst.pxd":221 + * + * ctypedef fst.FstClass * FstClass_ptr + * ctypedef fst.MutableFstClass * MutableFstClass_ptr # <<<<<<<<<<<<<< + * ctypedef fst.VectorFstClass * VectorFstClass_ptr + * + */ +typedef fst::script::MutableFstClass *__pyx_t_9pywrapfst_MutableFstClass_ptr; + +/* "pywrapfst.pxd":222 + * ctypedef fst.FstClass * FstClass_ptr + * ctypedef fst.MutableFstClass * MutableFstClass_ptr + * ctypedef fst.VectorFstClass * VectorFstClass_ptr # <<<<<<<<<<<<<< + * + * + */ +typedef fst::script::VectorFstClass *__pyx_t_9pywrapfst_VectorFstClass_ptr; + +/* "pywrapfst.pxd":238 + * cpdef _Fst copy(self) + * + * cpdef void draw(self, filename, _SymbolTable isymbols=?, # <<<<<<<<<<<<<< + * _SymbolTable osymbols=?, SymbolTable ssymbols=?, + * bool acceptor=?, title=?, double width=?, + */ +struct __pyx_opt_args_9pywrapfst_4_Fst_draw { + int __pyx_n; + struct __pyx_obj_9pywrapfst__SymbolTable *isymbols; + struct __pyx_obj_9pywrapfst__SymbolTable *osymbols; + struct __pyx_obj_9pywrapfst_SymbolTable *ssymbols; + bool acceptor; + PyObject *title; + double width; + double height; + bool portrait; + bool vertical; + double ranksep; + double nodesep; + __pyx_t_10basictypes_int32 fontsize; + __pyx_t_10basictypes_int32 precision; + PyObject *float_format; + bool show_weight_one; +}; + +/* "pywrapfst.pxd":266 + * cpdef StateIterator states(self) + * + * cpdef string text(self, _SymbolTable isymbols=?, _SymbolTable osymbols=?, # <<<<<<<<<<<<<< + * _SymbolTable ssymbols=?, bool acceptor=?, + * bool show_weight_one=?, missing_sym=?) + */ +struct __pyx_opt_args_9pywrapfst_4_Fst_text { + int __pyx_n; + struct __pyx_obj_9pywrapfst__SymbolTable *isymbols; + struct __pyx_obj_9pywrapfst__SymbolTable *osymbols; + struct __pyx_obj_9pywrapfst__SymbolTable *ssymbols; + bool acceptor; + bool show_weight_one; + PyObject *missing_sym; +}; + +/* "pywrapfst.pxd":289 + * cpdef int64 add_state(self) except * + * + * cdef void _arcsort(self, sort_type=?) except * # <<<<<<<<<<<<<< + * + * cdef void _closure(self, bool closure_plus=?) except * + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__arcsort { + int __pyx_n; + PyObject *sort_type; +}; + +/* "pywrapfst.pxd":291 + * cdef void _arcsort(self, sort_type=?) except * + * + * cdef void _closure(self, bool closure_plus=?) except * # <<<<<<<<<<<<<< + * + * cdef void _concat(self, _Fst ifst) except * + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__closure { + int __pyx_n; + bool closure_plus; +}; + +/* "pywrapfst.pxd":299 + * cdef void _decode(self, EncodeMapper) except * + * + * cdef void _delete_arcs(self, int64 state, size_t n=?) except * # <<<<<<<<<<<<<< + * + * cdef void _delete_states(self, states=?) except * + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_arcs { + int __pyx_n; + size_t n; +}; + +/* "pywrapfst.pxd":301 + * cdef void _delete_arcs(self, int64 state, size_t n=?) except * + * + * cdef void _delete_states(self, states=?) except * # <<<<<<<<<<<<<< + * + * cdef void _encode(self, EncodeMapper) except * + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_states { + int __pyx_n; + PyObject *states; +}; + +/* "pywrapfst.pxd":307 + * cdef void _invert(self) except * + * + * cdef void _minimize(self, float delta=?, bool allow_nondet=?) except * # <<<<<<<<<<<<<< + * + * cpdef MutableArcIterator mutable_arcs(self, int64 state) + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__minimize { + int __pyx_n; + float delta; + bool allow_nondet; +}; + +/* "pywrapfst.pxd":313 + * cpdef int64 num_states(self) + * + * cdef void _project(self, bool project_output=?) except * # <<<<<<<<<<<<<< + * + * cdef void _prune(self, float delta=?, int64 nstate=?, weight=?) except * + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__project { + int __pyx_n; + bool project_output; +}; + +/* "pywrapfst.pxd":315 + * cdef void _project(self, bool project_output=?) except * + * + * cdef void _prune(self, float delta=?, int64 nstate=?, weight=?) except * # <<<<<<<<<<<<<< + * + * cdef void _push(self, float delta=?, bool remove_total_weight=?, + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__prune { + int __pyx_n; + float delta; + __pyx_t_10basictypes_int64 nstate; + PyObject *weight; +}; + +/* "pywrapfst.pxd":317 + * cdef void _prune(self, float delta=?, int64 nstate=?, weight=?) except * + * + * cdef void _push(self, float delta=?, bool remove_total_weight=?, # <<<<<<<<<<<<<< + * bool to_final=?) except * + * + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__push { + int __pyx_n; + float delta; + bool remove_total_weight; + bool to_final; +}; + +/* "pywrapfst.pxd":320 + * bool to_final=?) except * + * + * cdef void _relabel_pairs(self, ipairs=?, opairs=?) except * # <<<<<<<<<<<<<< + * + * cdef void _relabel_tables(self, _SymbolTable old_isymbols=?, + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_pairs { + int __pyx_n; + PyObject *ipairs; + PyObject *opairs; +}; + +/* "pywrapfst.pxd":322 + * cdef void _relabel_pairs(self, ipairs=?, opairs=?) except * + * + * cdef void _relabel_tables(self, _SymbolTable old_isymbols=?, # <<<<<<<<<<<<<< + * _SymbolTable new_isymbols=?, unknown_isymbol=?, + * bool attach_new_isymbols=?, + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_tables { + int __pyx_n; + struct __pyx_obj_9pywrapfst__SymbolTable *old_isymbols; + struct __pyx_obj_9pywrapfst__SymbolTable *new_isymbols; + PyObject *unknown_isymbol; + bool attach_new_isymbols; + struct __pyx_obj_9pywrapfst__SymbolTable *old_osymbols; + struct __pyx_obj_9pywrapfst__SymbolTable *new_osymbols; + PyObject *unknown_osymbol; + bool attach_new_osymbols; +}; + +/* "pywrapfst.pxd":332 + * cdef void _reserve_states(self, int64 n) except * + * + * cdef void _reweight(self, potentials, bool to_final=?) except * # <<<<<<<<<<<<<< + * + * cdef void _rmepsilon(self, queue_type=?, bool connect=?, weight=?, + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__reweight { + int __pyx_n; + bool to_final; +}; + +/* "pywrapfst.pxd":334 + * cdef void _reweight(self, potentials, bool to_final=?) except * + * + * cdef void _rmepsilon(self, queue_type=?, bool connect=?, weight=?, # <<<<<<<<<<<<<< + * int64 nstate=?, float delta=?) except * + * + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__rmepsilon { + int __pyx_n; + PyObject *queue_type; + bool connect; + PyObject *weight; + __pyx_t_10basictypes_int64 nstate; + float delta; +}; + +/* "pywrapfst.pxd":337 + * int64 nstate=?, float delta=?) except * + * + * cdef void _set_final(self, int64 state, weight=?) except * # <<<<<<<<<<<<<< + * + * cdef void _set_properties(self, uint64 props, uint64 mask) + */ +struct __pyx_opt_args_9pywrapfst_11_MutableFst__set_final { + int __pyx_n; + PyObject *weight; +}; + +/* "pywrapfst.pxd":361 + * cdef _Fst _init_XFst(FstClass_ptr tfst) + * + * cdef _MutableFst _create_Fst(arc_type=?) # <<<<<<<<<<<<<< + * + * cpdef _Fst _read(filename) + */ +struct __pyx_opt_args_9pywrapfst__create_Fst { + int __pyx_n; + PyObject *arc_type; +}; + +/* "pywrapfst.pxd":444 + * + * + * cdef _Fst _map(_Fst ifst, float delta=?, map_type=?, double power=?, weight=?) # <<<<<<<<<<<<<< + * + * cpdef _Fst arcmap(_Fst ifst, float delta=?, map_type=?, double power=?, + */ +struct __pyx_opt_args_9pywrapfst__map { + int __pyx_n; + float delta; + PyObject *map_type; + double power; + PyObject *weight; +}; + +/* "pywrapfst.pxd":446 + * cdef _Fst _map(_Fst ifst, float delta=?, map_type=?, double power=?, weight=?) + * + * cpdef _Fst arcmap(_Fst ifst, float delta=?, map_type=?, double power=?, # <<<<<<<<<<<<<< + * weight=?) + * + */ +struct __pyx_opt_args_9pywrapfst_arcmap { + int __pyx_n; + float delta; + PyObject *map_type; + double power; + PyObject *weight; +}; + +/* "pywrapfst.pxd":449 + * weight=?) + * + * cpdef _MutableFst compose(_Fst ifst1, _Fst ifst2, compose_filter=?, # <<<<<<<<<<<<<< + * bool connect=?) + * + */ +struct __pyx_opt_args_9pywrapfst_compose { + int __pyx_n; + PyObject *compose_filter; + bool connect; +}; + +/* "pywrapfst.pxd":452 + * bool connect=?) + * + * cpdef _Fst convert(_Fst ifst, fst_type=?) # <<<<<<<<<<<<<< + * + * cpdef _MutableFst determinize(_Fst ifst, float delta=?, det_type=?, + */ +struct __pyx_opt_args_9pywrapfst_convert { + int __pyx_n; + PyObject *fst_type; +}; + +/* "pywrapfst.pxd":454 + * cpdef _Fst convert(_Fst ifst, fst_type=?) + * + * cpdef _MutableFst determinize(_Fst ifst, float delta=?, det_type=?, # <<<<<<<<<<<<<< + * int64 nstate=?, int64 subsequential_label=?, + * weight=?, bool increment_subsequential_label=?) + */ +struct __pyx_opt_args_9pywrapfst_determinize { + int __pyx_n; + float delta; + PyObject *det_type; + __pyx_t_10basictypes_int64 nstate; + __pyx_t_10basictypes_int64 subsequential_label; + PyObject *weight; + bool increment_subsequential_label; +}; + +/* "pywrapfst.pxd":458 + * weight=?, bool increment_subsequential_label=?) + * + * cpdef _MutableFst difference(_Fst ifst1, _Fst ifst2, compose_filter=?, # <<<<<<<<<<<<<< + * bool connect=?) + * + */ +struct __pyx_opt_args_9pywrapfst_difference { + int __pyx_n; + PyObject *compose_filter; + bool connect; +}; + +/* "pywrapfst.pxd":461 + * bool connect=?) + * + * cpdef _MutableFst disambiguate(_Fst ifst, float delta=?, int64 nstate=?, # <<<<<<<<<<<<<< + * int64 subsequential_label=?, weight=?) + * + */ +struct __pyx_opt_args_9pywrapfst_disambiguate { + int __pyx_n; + float delta; + __pyx_t_10basictypes_int64 nstate; + __pyx_t_10basictypes_int64 subsequential_label; + PyObject *weight; +}; + +/* "pywrapfst.pxd":464 + * int64 subsequential_label=?, weight=?) + * + * cpdef _MutableFst epsnormalize(_Fst ifst, bool eps_norm_output=?) # <<<<<<<<<<<<<< + * + * cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=?) + */ +struct __pyx_opt_args_9pywrapfst_epsnormalize { + int __pyx_n; + bool eps_norm_output; +}; + +/* "pywrapfst.pxd":466 + * cpdef _MutableFst epsnormalize(_Fst ifst, bool eps_norm_output=?) + * + * cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=?) # <<<<<<<<<<<<<< + * + * cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=?) except * + */ +struct __pyx_opt_args_9pywrapfst_equal { + int __pyx_n; + float delta; +}; + +/* "pywrapfst.pxd":468 + * cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=?) + * + * cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=?) except * # <<<<<<<<<<<<<< + * + * cpdef _MutableFst intersect(_Fst ifst1, _Fst ifst2, compose_filter=?, + */ +struct __pyx_opt_args_9pywrapfst_equivalent { + int __pyx_n; + float delta; +}; + +/* "pywrapfst.pxd":470 + * cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=?) except * + * + * cpdef _MutableFst intersect(_Fst ifst1, _Fst ifst2, compose_filter=?, # <<<<<<<<<<<<<< + * bool connect=?) + * + */ +struct __pyx_opt_args_9pywrapfst_intersect { + int __pyx_n; + PyObject *compose_filter; + bool connect; +}; + +/* "pywrapfst.pxd":473 + * bool connect=?) + * + * cpdef bool isomorphic(_Fst ifst1, _Fst ifst2, float delta=?) # <<<<<<<<<<<<<< + * + * cpdef _MutableFst prune(_Fst ifst, float delta=?, int64 nstate=?, + */ +struct __pyx_opt_args_9pywrapfst_isomorphic { + int __pyx_n; + float delta; +}; + +/* "pywrapfst.pxd":475 + * cpdef bool isomorphic(_Fst ifst1, _Fst ifst2, float delta=?) + * + * cpdef _MutableFst prune(_Fst ifst, float delta=?, int64 nstate=?, # <<<<<<<<<<<<<< + * weight=?) + * + */ +struct __pyx_opt_args_9pywrapfst_prune { + int __pyx_n; + float delta; + __pyx_t_10basictypes_int64 nstate; + PyObject *weight; +}; + +/* "pywrapfst.pxd":478 + * weight=?) + * + * cpdef _MutableFst push(_Fst ifst, float delta=?, bool push_weights=?, # <<<<<<<<<<<<<< + * bool push_labels=?, bool remove_common_affix=?, + * bool remove_total_weight=?, bool to_final=?) + */ +struct __pyx_opt_args_9pywrapfst_push { + int __pyx_n; + float delta; + bool push_weights; + bool push_labels; + bool remove_common_affix; + bool remove_total_weight; + bool to_final; +}; + +/* "pywrapfst.pxd":482 + * bool remove_total_weight=?, bool to_final=?) + * + * cpdef bool randequivalent(_Fst ifst1, _Fst ifst2, int32 npath=?, # <<<<<<<<<<<<<< + * float delta=?, time_t seed=?, select=?, + * int32 max_length=?) except * + */ +struct __pyx_opt_args_9pywrapfst_randequivalent { + int __pyx_n; + __pyx_t_10basictypes_int32 npath; + float delta; + time_t seed; + PyObject *select; + __pyx_t_10basictypes_int32 max_length; +}; + +/* "pywrapfst.pxd":486 + * int32 max_length=?) except * + * + * cpdef _MutableFst randgen(_Fst ifst, int32 npath=?, time_t seed=?, # <<<<<<<<<<<<<< + * select=?, int32 max_length=?, + * bool remove_total_weight=?, bool weighted=?) + */ +struct __pyx_opt_args_9pywrapfst_randgen { + int __pyx_n; + __pyx_t_10basictypes_int32 npath; + time_t seed; + PyObject *select; + __pyx_t_10basictypes_int32 max_length; + bool remove_total_weight; + bool weighted; +}; + +/* "pywrapfst.pxd":493 + * bool epsilon_on_replace) except * + * + * cpdef _MutableFst replace(pairs, call_arc_labeling=?, return_arc_labeling=?, # <<<<<<<<<<<<<< + * bool epsilon_on_replace=?, int64 return_label=?) + * + */ +struct __pyx_opt_args_9pywrapfst_replace { + int __pyx_n; + PyObject *call_arc_labeling; + PyObject *return_arc_labeling; + bool epsilon_on_replace; + __pyx_t_10basictypes_int64 return_label; +}; + +/* "pywrapfst.pxd":496 + * bool epsilon_on_replace=?, int64 return_label=?) + * + * cpdef _MutableFst reverse(_Fst ifst, bool require_superinitial=?) # <<<<<<<<<<<<<< + * + * cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, float delta=?, + */ +struct __pyx_opt_args_9pywrapfst_reverse { + int __pyx_n; + bool require_superinitial; +}; + +/* "pywrapfst.pxd":498 + * cpdef _MutableFst reverse(_Fst ifst, bool require_superinitial=?) + * + * cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, float delta=?, # <<<<<<<<<<<<<< + * int64 nstate=?, queue_type=?, + * bool reverse=?) except * + */ +struct __pyx_opt_args_9pywrapfst__shortestdistance { + int __pyx_n; + float delta; + __pyx_t_10basictypes_int64 nstate; + PyObject *queue_type; + bool reverse; +}; + +/* "pywrapfst.pxd":502 + * bool reverse=?) except * + * + * cpdef _MutableFst shortestpath(_Fst ifst, float delta=?, int32 nshortest=?, # <<<<<<<<<<<<<< + * int64 nstate=?, queue_type=?, bool unique=?, + * weight=?) + */ +struct __pyx_opt_args_9pywrapfst_shortestpath { + int __pyx_n; + float delta; + __pyx_t_10basictypes_int32 nshortest; + __pyx_t_10basictypes_int64 nstate; + PyObject *queue_type; + bool unique; + PyObject *weight; +}; + +/* "pywrapfst.pxd":68 + * + * + * cdef class Weight(object): # <<<<<<<<<<<<<< + * + * cdef unique_ptr[fst.WeightClass] _weight + */ +struct __pyx_obj_9pywrapfst_Weight { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_Weight *__pyx_vtab; + std::unique_ptr _weight; +}; + + +/* "pywrapfst.pxd":103 + * + * + * cdef class _SymbolTable(object): # <<<<<<<<<<<<<< + * + * cdef fst.SymbolTable *_table + */ +struct __pyx_obj_9pywrapfst__SymbolTable { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst__SymbolTable *__pyx_vtab; + fst::SymbolTable *_table; +}; + + +/* "pywrapfst.pxd":130 + * + * + * cdef class _EncodeMapperSymbolTable(_SymbolTable): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.EncodeMapperClass] _encoder + */ +struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable { + struct __pyx_obj_9pywrapfst__SymbolTable __pyx_base; + std::shared_ptr _encoder; +}; + + +/* "pywrapfst.pxd":135 + * + * + * cdef class _FstSymbolTable(_SymbolTable): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.FstClass] _fst + */ +struct __pyx_obj_9pywrapfst__FstSymbolTable { + struct __pyx_obj_9pywrapfst__SymbolTable __pyx_base; + std::shared_ptr _fst; +}; + + +/* "pywrapfst.pxd":140 + * + * + * cdef class _MutableSymbolTable(_SymbolTable): # <<<<<<<<<<<<<< + * + * cpdef int64 add_symbol(self, symbol, int64 key=?) + */ +struct __pyx_obj_9pywrapfst__MutableSymbolTable { + struct __pyx_obj_9pywrapfst__SymbolTable __pyx_base; +}; + + +/* "pywrapfst.pxd":149 + * + * + * cdef class _MutableFstSymbolTable(_MutableSymbolTable): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.MutableFstClass] _mfst + */ +struct __pyx_obj_9pywrapfst__MutableFstSymbolTable { + struct __pyx_obj_9pywrapfst__MutableSymbolTable __pyx_base; + std::shared_ptr _mfst; +}; + + +/* "pywrapfst.pxd":154 + * + * + * cdef class SymbolTable(_MutableSymbolTable): # <<<<<<<<<<<<<< + * + * cdef unique_ptr[fst.SymbolTable] _smart_table + */ +struct __pyx_obj_9pywrapfst_SymbolTable { + struct __pyx_obj_9pywrapfst__MutableSymbolTable __pyx_base; + std::unique_ptr _smart_table; +}; + + +/* "pywrapfst.pxd":177 + * + * + * cdef class SymbolTableIterator(object): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.SymbolTable] _table + */ +struct __pyx_obj_9pywrapfst_SymbolTableIterator { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator *__pyx_vtab; + std::shared_ptr _table; + std::unique_ptr _siter; +}; + + +/* "pywrapfst.pxd":196 + * + * + * cdef class EncodeMapper(object): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.EncodeMapperClass] _encoder + */ +struct __pyx_obj_9pywrapfst_EncodeMapper { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_EncodeMapper *__pyx_vtab; + std::shared_ptr _encoder; +}; + + +/* "pywrapfst.pxd":225 + * + * + * cdef class _Fst(object): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.FstClass] _fst + */ +struct __pyx_obj_9pywrapfst__Fst { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst__Fst *__pyx_vtab; + std::shared_ptr _fst; +}; + + +/* "pywrapfst.pxd":279 + * + * + * cdef class _MutableFst(_Fst): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.MutableFstClass] _mfst + */ +struct __pyx_obj_9pywrapfst__MutableFst { + struct __pyx_obj_9pywrapfst__Fst __pyx_base; + std::shared_ptr _mfst; +}; + + +/* "pywrapfst.pxd":371 + * + * + * cdef class Arc(object): # <<<<<<<<<<<<<< + * + * cdef unique_ptr[fst.ArcClass] _arc + */ +struct __pyx_obj_9pywrapfst_Arc { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_Arc *__pyx_vtab; + std::unique_ptr _arc; +}; + + +/* "pywrapfst.pxd":381 + * + * + * cdef class ArcIterator(object): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.FstClass] _fst + */ +struct __pyx_obj_9pywrapfst_ArcIterator { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_ArcIterator *__pyx_vtab; + std::shared_ptr _fst; + std::unique_ptr _aiter; +}; + + +/* "pywrapfst.pxd":403 + * + * + * cdef class MutableArcIterator(object): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.MutableFstClass] _mfst + */ +struct __pyx_obj_9pywrapfst_MutableArcIterator { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_MutableArcIterator *__pyx_vtab; + std::shared_ptr _mfst; + std::unique_ptr _aiter; +}; + + +/* "pywrapfst.pxd":427 + * + * + * cdef class StateIterator(object): # <<<<<<<<<<<<<< + * + * cdef shared_ptr[fst.FstClass] _fst + */ +struct __pyx_obj_9pywrapfst_StateIterator { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_StateIterator *__pyx_vtab; + std::shared_ptr _fst; + std::unique_ptr _siter; +}; + + +/* "pywrapfst.pxd":514 + * + * + * cdef class Compiler(object): # <<<<<<<<<<<<<< + * + * cdef unique_ptr[stringstream] _sstrm + */ +struct __pyx_obj_9pywrapfst_Compiler { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_Compiler *__pyx_vtab; + std::unique_ptr _sstrm; + std::string _fst_type; + std::string _arc_type; + fst::SymbolTable const *_isymbols; + fst::SymbolTable const *_osymbols; + fst::SymbolTable const *_ssymbols; + bool _acceptor; + bool _keep_isymbols; + bool _keep_osymbols; + bool _keep_state_numbering; + bool _allow_negative_labels; +}; + + +/* "pywrapfst.pxd":535 + * # FarReader. + * + * cdef class FarReader(object): # <<<<<<<<<<<<<< + * + * cdef unique_ptr[fst.FarReaderClass] _reader + */ +struct __pyx_obj_9pywrapfst_FarReader { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_FarReader *__pyx_vtab; + std::unique_ptr _reader; +}; + + +/* "pywrapfst.pxd":560 + * # FarWriter. + * + * cdef class FarWriter(object): # <<<<<<<<<<<<<< + * + * cdef unique_ptr[fst.FarWriterClass] _writer + */ +struct __pyx_obj_9pywrapfst_FarWriter { + PyObject_HEAD + struct __pyx_vtabstruct_9pywrapfst_FarWriter *__pyx_vtab; + std::unique_ptr _writer; +}; + + +/* "pywrapfst.pyx":3118 + * + * # Magic method used to get a Pythonic Iterator API out of the C++ API + * def __iter__(self): # <<<<<<<<<<<<<< + * while not self.done(): + * yield self.value() + */ +struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ { + PyObject_HEAD + struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self; +}; + + + +/* "pywrapfst.pyx":334 + * + * + * cdef class Weight(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_Weight { + void (*_check_weight)(struct __pyx_obj_9pywrapfst_Weight *); + struct __pyx_obj_9pywrapfst_Weight *(*copy)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch); + std::string (*to_string)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch); + std::string (*type)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch); + bool (*member)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_Weight *__pyx_vtabptr_9pywrapfst_Weight; + + +/* "pywrapfst.pyx":664 + * + * + * cdef class _SymbolTable(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst__SymbolTable { + __pyx_t_10basictypes_int64 (*available_key)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + PyObject *(*checksum)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst_SymbolTable *(*copy)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_int64 (*get_nth_key)(struct __pyx_obj_9pywrapfst__SymbolTable *, Py_ssize_t, int __pyx_skip_dispatch); + PyObject *(*labeled_checksum)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + bool (*member)(struct __pyx_obj_9pywrapfst__SymbolTable *, PyObject *, int __pyx_skip_dispatch); + std::string (*name)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + size_t (*num_symbols)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + void (*write)(struct __pyx_obj_9pywrapfst__SymbolTable *, PyObject *, int __pyx_skip_dispatch); + void (*write_text)(struct __pyx_obj_9pywrapfst__SymbolTable *, PyObject *, int __pyx_skip_dispatch); + PyObject *(*write_to_string)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst__SymbolTable *__pyx_vtabptr_9pywrapfst__SymbolTable; + + +/* "pywrapfst.pyx":852 + * + * + * cdef class _EncodeMapperSymbolTable(_SymbolTable): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst__EncodeMapperSymbolTable { + struct __pyx_vtabstruct_9pywrapfst__SymbolTable __pyx_base; +}; +static struct __pyx_vtabstruct_9pywrapfst__EncodeMapperSymbolTable *__pyx_vtabptr_9pywrapfst__EncodeMapperSymbolTable; + + +/* "pywrapfst.pyx":872 + * + * + * cdef class _FstSymbolTable(_SymbolTable): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst__FstSymbolTable { + struct __pyx_vtabstruct_9pywrapfst__SymbolTable __pyx_base; +}; +static struct __pyx_vtabstruct_9pywrapfst__FstSymbolTable *__pyx_vtabptr_9pywrapfst__FstSymbolTable; + + +/* "pywrapfst.pyx":891 + * + * + * cdef class _MutableSymbolTable(_SymbolTable): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst__MutableSymbolTable { + struct __pyx_vtabstruct_9pywrapfst__SymbolTable __pyx_base; + __pyx_t_10basictypes_int64 (*add_symbol)(struct __pyx_obj_9pywrapfst__MutableSymbolTable *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_19_MutableSymbolTable_add_symbol *__pyx_optional_args); + void (*add_table)(struct __pyx_obj_9pywrapfst__MutableSymbolTable *, struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + void (*set_name)(struct __pyx_obj_9pywrapfst__MutableSymbolTable *, PyObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst__MutableSymbolTable *__pyx_vtabptr_9pywrapfst__MutableSymbolTable; + + +/* "pywrapfst.pyx":943 + * + * + * cdef class _MutableFstSymbolTable(_MutableSymbolTable): # <<<<<<<<<<<<<< + * """ + * (No constructor.) + */ + +struct __pyx_vtabstruct_9pywrapfst__MutableFstSymbolTable { + struct __pyx_vtabstruct_9pywrapfst__MutableSymbolTable __pyx_base; +}; +static struct __pyx_vtabstruct_9pywrapfst__MutableFstSymbolTable *__pyx_vtabptr_9pywrapfst__MutableFstSymbolTable; + + +/* "pywrapfst.pyx":954 + * + * + * cdef class SymbolTable(_MutableSymbolTable): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_SymbolTable { + struct __pyx_vtabstruct_9pywrapfst__MutableSymbolTable __pyx_base; +}; +static struct __pyx_vtabstruct_9pywrapfst_SymbolTable *__pyx_vtabptr_9pywrapfst_SymbolTable; + + +/* "pywrapfst.pyx":1149 + * + * + * cdef class SymbolTableIterator(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator { + bool (*done)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch); + void (*next)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch); + void (*reset)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch); + std::string (*symbol)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_int64 (*value)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator *__pyx_vtabptr_9pywrapfst_SymbolTableIterator; + + +/* "pywrapfst.pyx":1231 + * + * + * cdef class EncodeMapper(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_EncodeMapper { + std::string (*arc_type)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_uint32 (*flags)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *(*input_symbols)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *(*output_symbols)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_uint64 (*properties)(struct __pyx_obj_9pywrapfst_EncodeMapper *, __pyx_t_10basictypes_uint64, int __pyx_skip_dispatch); + void (*set_input_symbols)(struct __pyx_obj_9pywrapfst_EncodeMapper *, struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + void (*set_output_symbols)(struct __pyx_obj_9pywrapfst_EncodeMapper *, struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); + std::string (*weight_type)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_EncodeMapper *__pyx_vtabptr_9pywrapfst_EncodeMapper; + + +/* "pywrapfst.pyx":1387 + * + * + * cdef class _Fst(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst__Fst { + std::string (*_local_render_svg)(std::string const &); + std::string (*arc_type)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst_ArcIterator *(*arcs)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst__Fst *(*copy)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + void (*draw)(struct __pyx_obj_9pywrapfst__Fst *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_draw *__pyx_optional_args); + struct __pyx_obj_9pywrapfst_Weight *(*final)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch); + std::string (*fst_type)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst__FstSymbolTable *(*input_symbols)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + size_t (*num_arcs)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch); + size_t (*num_input_epsilons)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch); + size_t (*num_output_epsilons)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst__FstSymbolTable *(*output_symbols)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_uint64 (*properties)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_uint64, bool, int __pyx_skip_dispatch); + __pyx_t_10basictypes_int64 (*start)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst_StateIterator *(*states)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + std::string (*text)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_text *__pyx_optional_args); + bool (*verify)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + std::string (*weight_type)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + void (*write)(struct __pyx_obj_9pywrapfst__Fst *, PyObject *, int __pyx_skip_dispatch); + PyObject *(*write_to_string)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst__Fst *__pyx_vtabptr_9pywrapfst__Fst; + + +/* "pywrapfst.pyx":1802 + * + * + * cdef class _MutableFst(_Fst): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst__MutableFst { + struct __pyx_vtabstruct_9pywrapfst__Fst __pyx_base; + void (*_check_mutating_imethod)(struct __pyx_obj_9pywrapfst__MutableFst *); + void (*_add_arc)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, struct __pyx_obj_9pywrapfst_Arc *); + __pyx_t_10basictypes_int64 (*add_state)(struct __pyx_obj_9pywrapfst__MutableFst *, int __pyx_skip_dispatch); + void (*_arcsort)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__arcsort *__pyx_optional_args); + void (*_closure)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__closure *__pyx_optional_args); + void (*_concat)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__Fst *); + void (*_connect)(struct __pyx_obj_9pywrapfst__MutableFst *); + void (*_decode)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst_EncodeMapper *); + void (*_delete_arcs)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_arcs *__pyx_optional_args); + void (*_delete_states)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_states *__pyx_optional_args); + void (*_encode)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst_EncodeMapper *); + void (*_invert)(struct __pyx_obj_9pywrapfst__MutableFst *); + void (*_minimize)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__minimize *__pyx_optional_args); + struct __pyx_obj_9pywrapfst_MutableArcIterator *(*mutable_arcs)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch); + __pyx_t_10basictypes_int64 (*num_states)(struct __pyx_obj_9pywrapfst__MutableFst *, int __pyx_skip_dispatch); + void (*_project)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__project *__pyx_optional_args); + void (*_prune)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__prune *__pyx_optional_args); + void (*_push)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__push *__pyx_optional_args); + void (*_relabel_pairs)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_pairs *__pyx_optional_args); + void (*_relabel_tables)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_tables *__pyx_optional_args); + void (*_reserve_arcs)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, size_t); + void (*_reserve_states)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64); + void (*_reweight)(struct __pyx_obj_9pywrapfst__MutableFst *, PyObject *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__reweight *__pyx_optional_args); + void (*_rmepsilon)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__rmepsilon *__pyx_optional_args); + void (*_set_final)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, struct __pyx_opt_args_9pywrapfst_11_MutableFst__set_final *__pyx_optional_args); + void (*_set_properties)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_uint64, __pyx_t_10basictypes_uint64); + void (*_set_start)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64); + void (*_set_input_symbols)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__SymbolTable *); + void (*_set_output_symbols)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__SymbolTable *); + void (*_topsort)(struct __pyx_obj_9pywrapfst__MutableFst *); + void (*_union)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__Fst *); +}; +static struct __pyx_vtabstruct_9pywrapfst__MutableFst *__pyx_vtabptr_9pywrapfst__MutableFst; + + +/* "pywrapfst.pyx":2920 + * + * + * cdef class Arc(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_Arc { + struct __pyx_obj_9pywrapfst_Arc *(*copy)(struct __pyx_obj_9pywrapfst_Arc *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_Arc *__pyx_vtabptr_9pywrapfst_Arc; + + +/* "pywrapfst.pyx":2987 + * + * + * cdef class ArcIterator(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_ArcIterator { + bool (*done)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_uint32 (*flags)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch); + void (*next)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch); + size_t (*position)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch); + void (*reset)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch); + void (*seek)(struct __pyx_obj_9pywrapfst_ArcIterator *, size_t, int __pyx_skip_dispatch); + void (*set_flags)(struct __pyx_obj_9pywrapfst_ArcIterator *, __pyx_t_10basictypes_uint32, __pyx_t_10basictypes_uint32, int __pyx_skip_dispatch); + PyObject *(*value)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_ArcIterator *__pyx_vtabptr_9pywrapfst_ArcIterator; + + +/* "pywrapfst.pyx":3098 + * + * + * cdef class MutableArcIterator(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_MutableArcIterator { + bool (*done)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_uint32 (*flags)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch); + void (*next)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch); + size_t (*position)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch); + void (*reset)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch); + void (*seek)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, size_t, int __pyx_skip_dispatch); + void (*set_flags)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, __pyx_t_10basictypes_uint32, __pyx_t_10basictypes_uint32, int __pyx_skip_dispatch); + void (*set_value)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, struct __pyx_obj_9pywrapfst_Arc *, int __pyx_skip_dispatch); + PyObject *(*value)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_MutableArcIterator *__pyx_vtabptr_9pywrapfst_MutableArcIterator; + + +/* "pywrapfst.pyx":3218 + * + * + * cdef class StateIterator(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_StateIterator { + bool (*done)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch); + void (*next)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch); + void (*reset)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch); + __pyx_t_10basictypes_int64 (*value)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_StateIterator *__pyx_vtabptr_9pywrapfst_StateIterator; + + +/* "pywrapfst.pyx":4119 + * + * + * cdef class Compiler(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_Compiler { + struct __pyx_obj_9pywrapfst__Fst *(*compile)(struct __pyx_obj_9pywrapfst_Compiler *, int __pyx_skip_dispatch); + void (*write)(struct __pyx_obj_9pywrapfst_Compiler *, PyObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_Compiler *__pyx_vtabptr_9pywrapfst_Compiler; + + +/* "pywrapfst.pyx":4249 + * + * + * cdef class FarReader(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_FarReader { + std::string (*arc_type)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); + bool (*done)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); + bool (*error)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); + std::string (*far_type)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); + bool (*find)(struct __pyx_obj_9pywrapfst_FarReader *, PyObject *, int __pyx_skip_dispatch); + struct __pyx_obj_9pywrapfst__Fst *(*get_fst)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); + std::string (*get_key)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); + void (*next)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); + void (*reset)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_FarReader *__pyx_vtabptr_9pywrapfst_FarReader; + + +/* "pywrapfst.pyx":4396 + * + * + * cdef class FarWriter(object): # <<<<<<<<<<<<<< + * + * """ + */ + +struct __pyx_vtabstruct_9pywrapfst_FarWriter { + std::string (*arc_type)(struct __pyx_obj_9pywrapfst_FarWriter *, int __pyx_skip_dispatch); + void (*close)(struct __pyx_obj_9pywrapfst_FarWriter *); + void (*add)(struct __pyx_obj_9pywrapfst_FarWriter *, PyObject *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); + bool (*error)(struct __pyx_obj_9pywrapfst_FarWriter *, int __pyx_skip_dispatch); + std::string (*far_type)(struct __pyx_obj_9pywrapfst_FarWriter *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_9pywrapfst_FarWriter *__pyx_vtabptr_9pywrapfst_FarWriter; + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + +/* PyObjectCallNoArg.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* IterNext.proto */ +#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); + +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* IncludeStringH.proto */ +#include + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* PyObject_GenericGetAttr.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#endif + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyObject *dict, void *vtable); + +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* CalculateMetaclass.proto */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); + +/* Py3ClassCreate.proto */ +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, + PyObject *mkw, PyObject *modname, PyObject *doc); +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, + PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); + +/* ClassMethod.proto */ +#include "descrobject.h" +static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method); + +/* GetNameInClass.proto */ +#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name); + +/* FetchCommonType.proto */ +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); + +/* CythonFunction.proto */ +#define __Pyx_CyFunction_USED 1 +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; +#if PY_VERSION_HEX < 0x030500A0 + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; + void *defaults; + int defaults_pyobjects; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(void); + +/* SetNameInClass.proto */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) +#elif CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) +#else +#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) +#endif + +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + +/* CodeObjectCache.proto */ +typedef struct { + PyCodeObject* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* None.proto */ +#include + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value); + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE time_t __Pyx_PyInt_As_time_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* CoroutineBase.proto */ +typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Coroutine_Close(PyObject *self); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); + +/* PatchModuleWithCoroutine.proto */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); + +/* PatchGeneratorABC.proto */ +static int __Pyx_patch_abc(void); + +/* Generator.proto */ +#define __Pyx_Generator_USED +static PyTypeObject *__pyx_GeneratorType = 0; +#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(void); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(void); + +/* FunctionExport.proto */ +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); + +/* InitStrings.proto */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +static void __pyx_f_9pywrapfst_6Weight__check_weight(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst_6Weight_copy(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_6Weight_to_string(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_6Weight_type(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_6Weight_member(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_12_SymbolTable_available_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_9pywrapfst_12_SymbolTable_checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst_12_SymbolTable_copy(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_12_SymbolTable_get_nth_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, Py_ssize_t __pyx_v_pos, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_9pywrapfst_12_SymbolTable_labeled_checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_12_SymbolTable_member(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_12_SymbolTable_name(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static size_t __pyx_f_9pywrapfst_12_SymbolTable_num_symbols(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_12_SymbolTable_write(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_12_SymbolTable_write_text(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_9pywrapfst_12_SymbolTable_write_to_string(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_19_MutableSymbolTable_add_symbol(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_symbol, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_19_MutableSymbolTable_add_symbol *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_19_MutableSymbolTable_add_table(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_19_MutableSymbolTable_set_name(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_new_name, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_19SymbolTableIterator_done(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_19SymbolTableIterator_next(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_19SymbolTableIterator_reset(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_19SymbolTableIterator_symbol(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_19SymbolTableIterator_value(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_12EncodeMapper_arc_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_uint32 __pyx_f_9pywrapfst_12EncodeMapper_flags(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_f_9pywrapfst_12EncodeMapper_input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_f_9pywrapfst_12EncodeMapper_output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_uint64 __pyx_f_9pywrapfst_12EncodeMapper_properties(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_12EncodeMapper_set_input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_12EncodeMapper_set_output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_12EncodeMapper_weight_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst__local_render_svg(std::string const &__pyx_v_dot); /* proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_arc_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_f_9pywrapfst_4_Fst_arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_4_Fst_copy(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_4_Fst_draw(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_draw *__pyx_optional_args); /* proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst_4_Fst_final(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_fst_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_f_9pywrapfst_4_Fst_input_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static size_t __pyx_f_9pywrapfst_4_Fst_num_arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch); /* proto*/ +static size_t __pyx_f_9pywrapfst_4_Fst_num_input_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch); /* proto*/ +static size_t __pyx_f_9pywrapfst_4_Fst_num_output_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_f_9pywrapfst_4_Fst_output_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_uint64 __pyx_f_9pywrapfst_4_Fst_properties(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask, bool __pyx_v_test, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_4_Fst_start(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst_StateIterator *__pyx_f_9pywrapfst_4_Fst_states(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_text(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_text *__pyx_optional_args); /* proto*/ +static bool __pyx_f_9pywrapfst_4_Fst_verify(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_weight_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_4_Fst_write(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_9pywrapfst_4_Fst_write_to_string(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__check_mutating_imethod(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__add_arc(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_11_MutableFst_add_state(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__arcsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__arcsort *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__closure(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__closure *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__concat(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__connect(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__decode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__delete_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_arcs *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__delete_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_states *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__encode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__invert(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__minimize(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__minimize *__pyx_optional_args); /* proto*/ +static struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_f_9pywrapfst_11_MutableFst_mutable_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_11_MutableFst_num_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__project(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__project *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__prune(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__prune *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__push(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__push *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__relabel_pairs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_pairs *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__relabel_tables(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_tables *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__reserve_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, size_t __pyx_v_n); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__reserve_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_n); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__reweight(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_potentials, struct __pyx_opt_args_9pywrapfst_11_MutableFst__reweight *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__rmepsilon(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__rmepsilon *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__set_final(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_opt_args_9pywrapfst_11_MutableFst__set_final *__pyx_optional_args); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__set_input_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__set_output_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__set_properties(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_props, __pyx_t_10basictypes_uint64 __pyx_v_mask); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__set_start(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__topsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto*/ +static void __pyx_f_9pywrapfst_11_MutableFst__union(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst); /* proto*/ +static struct __pyx_obj_9pywrapfst_Arc *__pyx_f_9pywrapfst_3Arc_copy(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_11ArcIterator_done(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_uint32 __pyx_f_9pywrapfst_11ArcIterator_flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_next(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static size_t __pyx_f_9pywrapfst_11ArcIterator_position(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_reset(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_seek(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, size_t __pyx_v_a, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_set_flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_9pywrapfst_11ArcIterator_value(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_18MutableArcIterator_done(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_uint32 __pyx_f_9pywrapfst_18MutableArcIterator_flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_next(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static size_t __pyx_f_9pywrapfst_18MutableArcIterator_position(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_reset(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_seek(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, size_t __pyx_v_a, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_set_flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_set_value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_9pywrapfst_18MutableArcIterator_value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_13StateIterator_done(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_13StateIterator_next(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_13StateIterator_reset(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_13StateIterator_value(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_8Compiler_compile(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_8Compiler_write(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, PyObject *__pyx_v_expression, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_9FarReader_arc_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_9FarReader_done(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_9FarReader_error(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_9FarReader_far_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_9FarReader_find(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_9FarReader_get_fst(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_9FarReader_get_key(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_9FarReader_next(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_9FarReader_reset(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_9pywrapfst_9FarWriter_close(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self); /* proto*/ +static void __pyx_f_9pywrapfst_9FarWriter_add(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_9FarWriter_arc_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static bool __pyx_f_9pywrapfst_9FarWriter_error(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static std::string __pyx_f_9pywrapfst_9FarWriter_far_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ + +/* Module declarations from 'libc.stddef' */ + +/* Module declarations from 'libc.time' */ + +/* Module declarations from 'libcpp' */ + +/* Module declarations from 'libcpp.memory' */ + +/* Module declarations from 'libcpp.utility' */ + +/* Module declarations from 'libcpp.vector' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libcpp.string' */ + +/* Module declarations from 'libc.stdint' */ + +/* Module declarations from 'basictypes' */ + +/* Module declarations from 'ios' */ + +/* Module declarations from 'fst' */ + +/* Module declarations from 'posix.types' */ + +/* Module declarations from 'posix.unistd' */ + +/* Module declarations from 'libcpp.cast' */ + +/* Module declarations from 'memory' */ + +/* Module declarations from 'pywrapfst' */ +static PyTypeObject *__pyx_ptype_9pywrapfst_Weight = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst__SymbolTable = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst__EncodeMapperSymbolTable = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst__FstSymbolTable = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst__MutableSymbolTable = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst__MutableFstSymbolTable = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_SymbolTable = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_SymbolTableIterator = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_EncodeMapper = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst__Fst = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst__MutableFst = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_Arc = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_ArcIterator = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_MutableArcIterator = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_StateIterator = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_Compiler = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_FarReader = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst_FarWriter = 0; +static PyTypeObject *__pyx_ptype_9pywrapfst___pyx_scope_struct____iter__ = 0; +static std::string __pyx_f_9pywrapfst_tostring(PyObject *); /*proto*/ +static std::string __pyx_f_9pywrapfst_weight_tostring(PyObject *); /*proto*/ +static enum fst::ComposeFilter __pyx_f_9pywrapfst__get_compose_filter(std::string const &); /*proto*/ +static enum fst::QueueType __pyx_f_9pywrapfst__get_queue_type(std::string const &); /*proto*/ +static enum fst::script::RandArcSelection __pyx_f_9pywrapfst__get_rand_arc_selection(std::string const &); /*proto*/ +static enum fst::ReplaceLabelType __pyx_f_9pywrapfst__get_replace_label_type(std::string const &, bool); /*proto*/ +static fst::script::WeightClass __pyx_f_9pywrapfst__get_WeightClass_or_One(std::string const &, PyObject *); /*proto*/ +static fst::script::WeightClass __pyx_f_9pywrapfst__get_WeightClass_or_Zero(std::string const &, PyObject *); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__Zero(PyObject *); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__One(PyObject *); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__NoWeight(PyObject *); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__plus(struct __pyx_obj_9pywrapfst_Weight *, struct __pyx_obj_9pywrapfst_Weight *); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__times(struct __pyx_obj_9pywrapfst_Weight *, struct __pyx_obj_9pywrapfst_Weight *); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__divide(struct __pyx_obj_9pywrapfst_Weight *, struct __pyx_obj_9pywrapfst_Weight *); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__power(struct __pyx_obj_9pywrapfst_Weight *, size_t); /*proto*/ +static struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_f_9pywrapfst__init_EncodeMapperSymbolTable(fst::SymbolTable *, std::shared_ptr ); /*proto*/ +static struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_f_9pywrapfst__init_FstSymbolTable(fst::SymbolTable *, std::shared_ptr ); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *__pyx_f_9pywrapfst__init_MutableFstSymbolTable(fst::SymbolTable *, std::shared_ptr ); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst__init_SymbolTable(fst::SymbolTable *); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst__read_SymbolTable_from_string(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__init_Fst(__pyx_t_9pywrapfst_FstClass_ptr); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst__init_MutableFst(__pyx_t_9pywrapfst_MutableFstClass_ptr); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__init_XFst(__pyx_t_9pywrapfst_FstClass_ptr); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst__create_Fst(struct __pyx_opt_args_9pywrapfst__create_Fst *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__read(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__read_Fst_from_string(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static struct __pyx_obj_9pywrapfst_Arc *__pyx_f_9pywrapfst__init_Arc(fst::script::ArcClass const &); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__map(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_opt_args_9pywrapfst__map *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_arcmap(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_arcmap *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_compose(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_compose *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_convert(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_convert *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_determinize(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_determinize *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_difference(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_difference *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_disambiguate(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_disambiguate *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_epsnormalize(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_epsnormalize *__pyx_optional_args); /*proto*/ +static bool __pyx_f_9pywrapfst_equal(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_equal *__pyx_optional_args); /*proto*/ +static bool __pyx_f_9pywrapfst_equivalent(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_equivalent *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_intersect(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_intersect *__pyx_optional_args); /*proto*/ +static bool __pyx_f_9pywrapfst_isomorphic(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_isomorphic *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_prune(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_prune *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_push(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_push *__pyx_optional_args); /*proto*/ +static bool __pyx_f_9pywrapfst_randequivalent(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_randequivalent *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_randgen(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_randgen *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_replace(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_replace *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_reverse(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_reverse *__pyx_optional_args); /*proto*/ +static std::vector *__pyx_f_9pywrapfst__shortestdistance(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_opt_args_9pywrapfst__shortestdistance *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_shortestpath(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_shortestpath *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_statemap(struct __pyx_obj_9pywrapfst__Fst *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_synchronize(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst_compact_symbol_table(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst_merge_symbol_table(struct __pyx_obj_9pywrapfst__SymbolTable *, struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch); /*proto*/ +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ +static std::vector<__pyx_t_10basictypes_int64> __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(PyObject *); /*proto*/ +#define __Pyx_MODULE_NAME "pywrapfst" +extern int __pyx_module_is_main_pywrapfst; +int __pyx_module_is_main_pywrapfst = 0; + +/* Implementation of 'pywrapfst' */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_IOError; +static PyObject *__pyx_builtin_object; +static PyObject *__pyx_builtin_staticmethod; +static PyObject *__pyx_builtin_id; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_KeyError; +static const char __pyx_k_g[] = "g"; +static const char __pyx_k_n[] = "n"; +static const char __pyx_k_w[] = "w"; +static const char __pyx_k_id[] = "id"; +static const char __pyx_k_Arc[] = "Arc"; +static const char __pyx_k_Fst[] = "_Fst"; +static const char __pyx_k_One[] = "One"; +static const char __pyx_k__10[] = ""; +static const char __pyx_k_add[] = "add"; +static const char __pyx_k_arc[] = "arc"; +static const char __pyx_k_cls[] = "cls"; +static const char __pyx_k_doc[] = "__doc__"; +static const char __pyx_k_dot[] = "dot"; +static const char __pyx_k_key[] = "key"; +static const char __pyx_k_lhs[] = "lhs"; +static const char __pyx_k_new[] = "__new__"; +static const char __pyx_k_rhs[] = "rhs"; +static const char __pyx_k_PIPE[] = "PIPE"; +static const char __pyx_k_Tsvg[] = "-Tsvg"; +static const char __pyx_k_Zero[] = "Zero"; +static const char __pyx_k_arcs[] = "arcs"; +static const char __pyx_k_args[] = "args"; +static const char __pyx_k_auto[] = "auto"; +static const char __pyx_k_copy[] = "copy"; +static const char __pyx_k_done[] = "done"; +static const char __pyx_k_draw[] = "draw"; +static const char __pyx_k_find[] = "find"; +static const char __pyx_k_ifst[] = "ifst"; +static const char __pyx_k_iter[] = "__iter__"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_mask[] = "mask"; +static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_next[] = "next"; +static const char __pyx_k_open[] = "open"; +static const char __pyx_k_plus[] = "plus"; +static const char __pyx_k_read[] = "read"; +static const char __pyx_k_seed[] = "seed"; +static const char __pyx_k_seek[] = "seek"; +static const char __pyx_k_send[] = "send"; +static const char __pyx_k_syms[] = "syms"; +static const char __pyx_k_test[] = "test"; +static const char __pyx_k_text[] = "text"; +static const char __pyx_k_type[] = "type"; +static const char __pyx_k_utf8[] = "utf8"; +static const char __pyx_k_ERROR[] = "ERROR"; +static const char __pyx_k_Fst_2[] = "Fst"; +static const char __pyx_k_Popen[] = "Popen"; +static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_close[] = "close"; +static const char __pyx_k_delta[] = "delta"; +static const char __pyx_k_error[] = "error"; +static const char __pyx_k_final[] = "final"; +static const char __pyx_k_flags[] = "flags"; +static const char __pyx_k_ifst1[] = "ifst1"; +static const char __pyx_k_ifst2[] = "ifst2"; +static const char __pyx_k_input[] = "input"; +static const char __pyx_k_npath[] = "npath"; +static const char __pyx_k_pairs[] = "pairs"; +static const char __pyx_k_power[] = "power"; +static const char __pyx_k_props[] = "props"; +static const char __pyx_k_reset[] = "reset"; +static const char __pyx_k_start[] = "start"; +static const char __pyx_k_state[] = "state"; +static const char __pyx_k_stdin[] = "stdin"; +static const char __pyx_k_throw[] = "throw"; +static const char __pyx_k_times[] = "times"; +static const char __pyx_k_title[] = "title"; +static const char __pyx_k_value[] = "value"; +static const char __pyx_k_width[] = "width"; +static const char __pyx_k_write[] = "write"; +static const char __pyx_k_CYCLIC[] = "CYCLIC"; +static const char __pyx_k_Number[] = "Number"; +static const char __pyx_k_STRING[] = "STRING"; +static const char __pyx_k_Weight[] = "Weight"; +static const char __pyx_k_create[] = "create"; +static const char __pyx_k_divide[] = "divide"; +static const char __pyx_k_encode[] = "encode"; +static const char __pyx_k_format[] = "format"; +static const char __pyx_k_height[] = "height"; +static const char __pyx_k_ilabel[] = "ilabel"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_ipairs[] = "ipairs"; +static const char __pyx_k_member[] = "member"; +static const char __pyx_k_module[] = "__module__"; +static const char __pyx_k_name_2[] = "name"; +static const char __pyx_k_nstate[] = "nstate"; +static const char __pyx_k_object[] = "object"; +static const char __pyx_k_olabel[] = "olabel"; +static const char __pyx_k_opairs[] = "opairs"; +static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_result[] = "result"; +static const char __pyx_k_select[] = "select"; +static const char __pyx_k_states[] = "states"; +static const char __pyx_k_stdout[] = "stdout"; +static const char __pyx_k_symbol[] = "symbol"; +static const char __pyx_k_test_2[] = "__test__"; +static const char __pyx_k_unique[] = "unique"; +static const char __pyx_k_vector[] = "vector"; +static const char __pyx_k_verify[] = "verify"; +static const char __pyx_k_weight[] = "weight"; +static const char __pyx_k_ACYCLIC[] = "ACYCLIC"; +static const char __pyx_k_IOError[] = "IOError"; +static const char __pyx_k_MUTABLE[] = "MUTABLE"; +static const char __pyx_k_compile[] = "compile"; +static const char __pyx_k_connect[] = "connect"; +static const char __pyx_k_default[] = "default"; +static const char __pyx_k_get_fst[] = "get_fst"; +static const char __pyx_k_get_key[] = "get_key"; +static const char __pyx_k_logging[] = "logging"; +static const char __pyx_k_neither[] = "neither"; +static const char __pyx_k_nodesep[] = "nodesep"; +static const char __pyx_k_numbers[] = "numbers"; +static const char __pyx_k_prepare[] = "__prepare__"; +static const char __pyx_k_ranksep[] = "ranksep"; +static const char __pyx_k_reverse[] = "reverse"; +static const char __pyx_k_uniform[] = "uniform"; +static const char __pyx_k_warning[] = "warning"; +static const char __pyx_k_ACCEPTOR[] = "ACCEPTOR"; +static const char __pyx_k_Compiler[] = "Compiler"; +static const char __pyx_k_EPSILONS[] = "EPSILONS"; +static const char __pyx_k_EXPANDED[] = "EXPANDED"; +static const char __pyx_k_FstError[] = "FstError"; +static const char __pyx_k_Fst_read[] = "Fst.read"; +static const char __pyx_k_KeyError[] = "KeyError"; +static const char __pyx_k_NO_LABEL[] = "NO_LABEL"; +static const char __pyx_k_NoWeight[] = "NoWeight"; +static const char __pyx_k_WEIGHTED[] = "WEIGHTED"; +static const char __pyx_k_acceptor[] = "acceptor"; +static const char __pyx_k_arc_type[] = "arc_type"; +static const char __pyx_k_checksum[] = "checksum"; +static const char __pyx_k_det_type[] = "det_type"; +static const char __pyx_k_distance[] = "distance"; +static const char __pyx_k_far_type[] = "far_type"; +static const char __pyx_k_filename[] = "filename"; +static const char __pyx_k_fontsize[] = "fontsize"; +static const char __pyx_k_fst_type[] = "fst_type"; +static const char __pyx_k_getstate[] = "__getstate__"; +static const char __pyx_k_identity[] = "identity"; +static const char __pyx_k_isymbols[] = "isymbols"; +static const char __pyx_k_map_type[] = "map_type"; +static const char __pyx_k_num_arcs[] = "num_arcs"; +static const char __pyx_k_osymbols[] = "osymbols"; +static const char __pyx_k_portrait[] = "portrait"; +static const char __pyx_k_position[] = "position"; +static const char __pyx_k_qualname[] = "__qualname__"; +static const char __pyx_k_read_fst[] = "read_fst"; +static const char __pyx_k_set_name[] = "set_name"; +static const char __pyx_k_setstate[] = "__setstate__"; +static const char __pyx_k_ssymbols[] = "ssymbols"; +static const char __pyx_k_standard[] = "standard"; +static const char __pyx_k_to_final[] = "to_final"; +static const char __pyx_k_tropical[] = "tropical"; +static const char __pyx_k_vertical[] = "vertical"; +static const char __pyx_k_weighted[] = "weighted"; +static const char __pyx_k_ARC_FLAGS[] = "ARC_FLAGS"; +static const char __pyx_k_FarReader[] = "FarReader"; +static const char __pyx_k_FarWriter[] = "FarWriter"; +static const char __pyx_k_Fst___new[] = "Fst.__new__"; +static const char __pyx_k_NO_SYMBOL[] = "NO_SYMBOL"; +static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_add_state[] = "add_state"; +static const char __pyx_k_add_table[] = "add_table"; +static const char __pyx_k_metaclass[] = "__metaclass__"; +static const char __pyx_k_nextstate[] = "nextstate"; +static const char __pyx_k_nshortest[] = "nshortest"; +static const char __pyx_k_precision[] = "precision"; +static const char __pyx_k_pywrapfst[] = ""; +static const char __pyx_k_read_text[] = "read_text"; +static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_set_flags[] = "set_flags"; +static const char __pyx_k_set_value[] = "set_value"; +static const char __pyx_k_sort_type[] = "sort_type"; +static const char __pyx_k_to_string[] = "to_string"; +static const char __pyx_k_ACCESSIBLE[] = "ACCESSIBLE"; +static const char __pyx_k_FstIOError[] = "FstIOError"; +static const char __pyx_k_FstOpError[] = "FstOpError"; +static const char __pyx_k_I_EPSILONS[] = "I_EPSILONS"; +static const char __pyx_k_IndexError[] = "IndexError"; +static const char __pyx_k_MutableFst[] = "_MutableFst"; +static const char __pyx_k_NOT_STRING[] = "NOT_STRING"; +static const char __pyx_k_O_EPSILONS[] = "O_EPSILONS"; +static const char __pyx_k_TOP_SORTED[] = "TOP_SORTED"; +static const char __pyx_k_UNWEIGHTED[] = "UNWEIGHTED"; +static const char __pyx_k_ValueError[] = "ValueError"; +static const char __pyx_k_add_symbol[] = "add_symbol"; +static const char __pyx_k_functional[] = "functional"; +static const char __pyx_k_max_length[] = "max_length"; +static const char __pyx_k_num_states[] = "num_states"; +static const char __pyx_k_potentials[] = "potentials"; +static const char __pyx_k_properties[] = "properties"; +static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static const char __pyx_k_queue_type[] = "queue_type"; +static const char __pyx_k_subprocess[] = "subprocess"; +static const char __pyx_k_write_text[] = "write_text"; +static const char __pyx_k_ArcIterator[] = "ArcIterator"; +static const char __pyx_k_Arc_at_0x_x[] = ""; +static const char __pyx_k_FstArgError[] = "FstArgError"; +static const char __pyx_k_Fst_at_0x_x[] = "<{} Fst at 0x{:x}>"; +static const char __pyx_k_NO_EPSILONS[] = "NO_EPSILONS"; +static const char __pyx_k_NO_STATE_ID[] = "NO_STATE_ID"; +static const char __pyx_k_Read_failed[] = "Read failed"; +static const char __pyx_k_SymbolTable[] = "_SymbolTable"; +static const char __pyx_k_communicate[] = "communicate"; +static const char __pyx_k_get_nth_key[] = "get_nth_key"; +static const char __pyx_k_input_table[] = "input_table"; +static const char __pyx_k_missing_sym[] = "missing_sym"; +static const char __pyx_k_num_symbols[] = "num_symbols"; +static const char __pyx_k_push_labels[] = "push_labels"; +static const char __pyx_k_pywrapfst_2[] = "pywrapfst"; +static const char __pyx_k_unspecified[] = ""; +static const char __pyx_k_weight_type[] = "weight_type"; +static const char __pyx_k_ARC_NO_CACHE[] = "ARC_NO_CACHE"; +static const char __pyx_k_COACCESSIBLE[] = "COACCESSIBLE"; +static const char __pyx_k_ENCODE_FLAGS[] = "ENCODE_FLAGS"; +static const char __pyx_k_EncodeMapper[] = "EncodeMapper"; +static const char __pyx_k_NOT_ACCEPTOR[] = "NOT_ACCEPTOR"; +static const char __pyx_k_RuntimeError[] = "RuntimeError"; +static const char __pyx_k_allow_nondet[] = "allow_nondet"; +static const char __pyx_k_closure_plus[] = "closure_plus"; +static const char __pyx_k_float_format[] = "float_format"; +static const char __pyx_k_mutable_arcs[] = "mutable_arcs"; +static const char __pyx_k_new_isymbols[] = "new_isymbols"; +static const char __pyx_k_new_osymbols[] = "new_osymbols"; +static const char __pyx_k_old_isymbols[] = "old_isymbols"; +static const char __pyx_k_old_osymbols[] = "old_osymbols"; +static const char __pyx_k_push_weights[] = "push_weights"; +static const char __pyx_k_return_label[] = "return_label"; +static const char __pyx_k_staticmethod[] = "staticmethod"; +static const char __pyx_k_ENCODE_LABELS[] = "ENCODE_LABELS"; +static const char __pyx_k_FstIndexError[] = "FstIndexError"; +static const char __pyx_k_NO_I_EPSILONS[] = "NO_I_EPSILONS"; +static const char __pyx_k_NO_O_EPSILONS[] = "NO_O_EPSILONS"; +static const char __pyx_k_Open_failed_r[] = "Open failed: {!r}"; +static const char __pyx_k_Read_failed_r[] = "Read failed: {!r}"; +static const char __pyx_k_StateIterator[] = "StateIterator"; +static const char __pyx_k_StopIteration[] = "StopIteration"; +static const char __pyx_k_SymbolTable_2[] = "SymbolTable"; +static const char __pyx_k_available_key[] = "available_key"; +static const char __pyx_k_encode_labels[] = "encode_labels"; +static const char __pyx_k_input_symbols[] = "input_symbols"; +static const char __pyx_k_keep_isymbols[] = "keep_isymbols"; +static const char __pyx_k_keep_osymbols[] = "keep_osymbols"; +static const char __pyx_k_pywrapfst_pyx[] = "pywrapfst.pyx"; +static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_ENCODE_WEIGHTS[] = "ENCODE_WEIGHTS"; +static const char __pyx_k_FST_PROPERTIES[] = "FST_PROPERTIES"; +static const char __pyx_k_FstSymbolTable[] = "_FstSymbolTable"; +static const char __pyx_k_INITIAL_CYCLIC[] = "INITIAL_CYCLIC"; +static const char __pyx_k_I_LABEL_SORTED[] = "I_LABEL_SORTED"; +static const char __pyx_k_Invalid_weight[] = "Invalid weight"; +static const char __pyx_k_NOT_ACCESSIBLE[] = "NOT_ACCESSIBLE"; +static const char __pyx_k_NOT_TOP_SORTED[] = "NOT_TOP_SORTED"; +static const char __pyx_k_O_LABEL_SORTED[] = "O_LABEL_SORTED"; +static const char __pyx_k_Weight_at_0x_x[] = "<{} Weight {} at 0x{:x}>"; +static const char __pyx_k_Write_failed_r[] = "Write failed: {!r}"; +static const char __pyx_k_compose_filter[] = "compose_filter"; +static const char __pyx_k_encode_weights[] = "encode_weights"; +static const char __pyx_k_output_symbols[] = "output_symbols"; +static const char __pyx_k_project_output[] = "project_output"; +static const char __pyx_k_ARC_VALUE_FLAGS[] = "ARC_VALUE_FLAGS"; +static const char __pyx_k_COPY_PROPERTIES[] = "COPY_PROPERTIES"; +static const char __pyx_k_INITIAL_ACYCLIC[] = "INITIAL_ACYCLIC"; +static const char __pyx_k_I_DETERMINISTIC[] = "I_DETERMINISTIC"; +static const char __pyx_k_NULL_PROPERTIES[] = "NULL_PROPERTIES"; +static const char __pyx_k_O_DETERMINISTIC[] = "O_DETERMINISTIC"; +static const char __pyx_k_WEIGHTED_CYCLES[] = "WEIGHTED_CYCLES"; +static const char __pyx_k_eps_norm_output[] = "eps_norm_output"; +static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_show_weight_one[] = "show_weight_one"; +static const char __pyx_k_unknown_isymbol[] = "unknown_isymbol"; +static const char __pyx_k_unknown_osymbol[] = "unknown_osymbol"; +static const char __pyx_k_write_to_string[] = "write_to_string"; +static const char __pyx_k_ARC_WEIGHT_VALUE[] = "ARC_WEIGHT_VALUE"; +static const char __pyx_k_Cannot_construct[] = "Cannot construct {}"; +static const char __pyx_k_Key_out_of_order[] = "Key out of order"; +static const char __pyx_k_NOT_COACCESSIBLE[] = "NOT_COACCESSIBLE"; +static const char __pyx_k_Operation_failed[] = "Operation failed"; +static const char __pyx_k_labeled_checksum[] = "labeled_checksum"; +static const char __pyx_k_read_from_string[] = "read_from_string"; +static const char __pyx_k_shortestdistance[] = "shortestdistance"; +static const char __pyx_k_ARC_I_LABEL_VALUE[] = "ARC_I_LABEL_VALUE"; +static const char __pyx_k_ARC_O_LABEL_VALUE[] = "ARC_O_LABEL_VALUE"; +static const char __pyx_k_BINARY_PROPERTIES[] = "BINARY_PROPERTIES"; +static const char __pyx_k_FarReader_at_0x_x[] = "<{} FarReader at 0x{:x}>"; +static const char __pyx_k_FarWriter_at_0x_x[] = "<{} FarWriter at 0x{:x}>"; +static const char __pyx_k_FstBadWeightError[] = "FstBadWeightError"; +static const char __pyx_k_UNWEIGHTED_CYCLES[] = "UNWEIGHTED_CYCLES"; +static const char __pyx_k_call_arc_labeling[] = "call_arc_labeling"; +static const char __pyx_k_set_input_symbols[] = "set_input_symbols"; +static const char __pyx_k_ADD_ARC_PROPERTIES[] = "ADD_ARC_PROPERTIES"; +static const char __pyx_k_Compilation_failed[] = "Compilation failed"; +static const char __pyx_k_MutableArcIterator[] = "MutableArcIterator"; +static const char __pyx_k_MutableSymbolTable[] = "_MutableSymbolTable"; +static const char __pyx_k_NOT_I_LABEL_SORTED[] = "NOT_I_LABEL_SORTED"; +static const char __pyx_k_NOT_O_LABEL_SORTED[] = "NOT_O_LABEL_SORTED"; +static const char __pyx_k_SET_ARC_PROPERTIES[] = "SET_ARC_PROPERTIES"; +static const char __pyx_k_TRINARY_PROPERTIES[] = "TRINARY_PROPERTIES"; +static const char __pyx_k_Unknown_arc_type_r[] = "Unknown arc type: {!r}"; +static const char __pyx_k_Unknown_map_type_r[] = "Unknown map type: {!r}"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_epsilon_on_replace[] = "epsilon_on_replace"; +static const char __pyx_k_num_input_epsilons[] = "num_input_epsilons"; +static const char __pyx_k_set_output_symbols[] = "set_output_symbols"; +static const char __pyx_k_ARC_SORT_PROPERTIES[] = "ARC_SORT_PROPERTIES"; +static const char __pyx_k_ArcIterator_at_0x_x[] = ""; +static const char __pyx_k_NON_I_DETERMINISTIC[] = "NON_I_DETERMINISTIC"; +static const char __pyx_k_NON_O_DETERMINISTIC[] = "NON_O_DETERMINISTIC"; +static const char __pyx_k_SymbolTableIterator[] = "SymbolTableIterator"; +static const char __pyx_k_Unknown_sort_type_r[] = "Unknown sort type {!r}"; +static const char __pyx_k_attach_new_isymbols[] = "attach_new_isymbols"; +static const char __pyx_k_attach_new_osymbols[] = "attach_new_osymbols"; +static const char __pyx_k_num_output_epsilons[] = "num_output_epsilons"; +static const char __pyx_k_remove_common_affix[] = "remove_common_affix"; +static const char __pyx_k_remove_total_weight[] = "remove_total_weight"; +static const char __pyx_k_return_arc_labeling[] = "return_arc_labeling"; +static const char __pyx_k_subsequential_label[] = "subsequential_label"; +static const char __pyx_k_ADD_STATE_PROPERTIES[] = "ADD_STATE_PROPERTIES"; +static const char __pyx_k_ARC_NEXT_STATE_VALUE[] = "ARC_NEXT_STATE_VALUE"; +static const char __pyx_k_EXTRINSIC_PROPERTIES[] = "EXTRINSIC_PROPERTIES"; +static const char __pyx_k_EncodeMapper_at_0x_x[] = ""; +static const char __pyx_k_Fst_read_from_string[] = "Fst.read_from_string"; +static const char __pyx_k_INTRINSIC_PROPERTIES[] = "INTRINSIC_PROPERTIES"; +static const char __pyx_k_SET_FINAL_PROPERTIES[] = "SET_FINAL_PROPERTIES"; +static const char __pyx_k_SET_START_PROPERTIES[] = "SET_START_PROPERTIES"; +static const char __pyx_k_Unknown_queue_type_r[] = "Unknown queue type: {!r}"; +static const char __pyx_k_keep_state_numbering[] = "keep_state_numbering"; +static const char __pyx_k_read_Fst_from_string[] = "_read_Fst_from_string"; +static const char __pyx_k_require_superinitial[] = "require_superinitial"; +static const char __pyx_k_DELETE_ARC_PROPERTIES[] = "DELETE_ARC_PROPERTIES"; +static const char __pyx_k_MutableFstSymbolTable[] = "_MutableFstSymbolTable"; +static const char __pyx_k_STATE_SORT_PROPERTIES[] = "STATE_SORT_PROPERTIES"; +static const char __pyx_k_StateIterator_at_0x_x[] = ""; +static const char __pyx_k_SymbolTable_r_at_0x_x[] = ""; +static const char __pyx_k_Weight_type_not_found[] = "Weight type not found"; +static const char __pyx_k_allow_negative_labels[] = "allow_negative_labels"; +static const char __pyx_k_Conversion_to_r_failed[] = "Conversion to {!r} failed"; +static const char __pyx_k_Dot_rendering_failed_s[] = "Dot rendering failed: %s"; +static const char __pyx_k_NEG_TRINARY_PROPERTIES[] = "NEG_TRINARY_PROPERTIES"; +static const char __pyx_k_POS_TRINARY_PROPERTIES[] = "POS_TRINARY_PROPERTIES"; +static const char __pyx_k_Write_to_string_failed[] = "Write to string failed"; +static const char __pyx_k_DELETE_STATE_PROPERTIES[] = "DELETE_STATE_PROPERTIES"; +static const char __pyx_k_EncodeMapperSymbolTable[] = "_EncodeMapperSymbolTable"; +static const char __pyx_k_RM_SUPERFINAL_PROPERTIES[] = "RM_SUPERFINAL_PROPERTIES"; +static const char __pyx_k_State_index_out_of_range[] = "State index out of range"; +static const char __pyx_k_ADD_SUPERFINAL_PROPERTIES[] = "ADD_SUPERFINAL_PROPERTIES"; +static const char __pyx_k_Cannot_encode_as_string_r[] = "Cannot encode as string: {!r}"; +static const char __pyx_k_Cannot_topsort_cyclic_FST[] = "Cannot topsort cyclic FST"; +static const char __pyx_k_Fst_SymbolTable_r_at_0x_x[] = ""; +static const char __pyx_k_MutableArcIterator___iter[] = "MutableArcIterator.__iter__"; +static const char __pyx_k_FstDeletedConstructorError[] = "FstDeletedConstructorError"; +static const char __pyx_k_MutableArcIterator_at_0x_x[] = ""; +static const char __pyx_k_SymbolTableIterator_at_0x_x[] = ""; +static const char __pyx_k_WEIGHT_INVARIANT_PROPERTIES[] = "WEIGHT_INVARIANT_PROPERTIES"; +static const char __pyx_k_I_LABEL_INVARIANT_PROPERTIES[] = "I_LABEL_INVARIANT_PROPERTIES"; +static const char __pyx_k_O_LABEL_INVARIANT_PROPERTIES[] = "O_LABEL_INVARIANT_PROPERTIES"; +static const char __pyx_k_Unknown_replace_label_type_r[] = "Unknown replace label type: {!r}"; +static const char __pyx_k_read_SymbolTable_from_string[] = "_read_SymbolTable_from_string"; +static const char __pyx_k_No_new_SymbolTables_specified[] = "No new SymbolTables specified"; +static const char __pyx_k_No_relabeling_pairs_specified[] = "No relabeling pairs specified."; +static const char __pyx_k_Unknown_compose_filter_type_r[] = "Unknown compose filter type: {!r}"; +static const char __pyx_k_increment_subsequential_label[] = "increment_subsequential_label"; +static const char __pyx_k_Incompatible_or_invalid_weight[] = "Incompatible or invalid weight"; +static const char __pyx_k_Unknown_determinization_type_r[] = "Unknown determinization type: {!r}"; +static const char __pyx_k_const_EncodeMapper_SymbolTable[] = ""; +static const char __pyx_k_Fst_arc_type_standard_Construct[] = "\n Fst(arc_type=\"standard\")\n\n Constructs an empty FST.\n\n Args:\n arc_type: A string indicating the arc type.\n\n Raises:\n FstError: Unknown arc type.\n\n Raises:\n FstOpError: operation failed.\n "; +static const char __pyx_k_const_Fst_SymbolTable_r_at_0x_x[] = ""; +static const char __pyx_k_self__aiter_self__fst_cannot_be[] = "self._aiter,self._fst cannot be converted to a Python object for pickling"; +static const char __pyx_k_self__fst_self__siter_cannot_be[] = "self._fst,self._siter cannot be converted to a Python object for pickling"; +static const char __pyx_k_Incompatible_or_invalid_arc_type[] = "Incompatible or invalid arc type"; +static const char __pyx_k_Incompatible_or_invalid_weight_t[] = "Incompatible or invalid weight type"; +static const char __pyx_k_Python_interface_to_the_FST_scri[] = "Python interface to the FST scripting API.\n\nOperations which construct new FSTs are implemented as traditional functions, as\nare two-argument boolean functions like `equal` and `equivalent`. Destructive\noperations---those that mutate an FST, in place---are instance methods, as is\n`write`. Operator overloading is not used. The following example, based on\nMohri et al. 2002, shows the construction of an ASR system given a pronunciation\nlexicon L, grammar G, a transducer from context-dependent phones to\ncontext-independent phones C, and an HMM set H:\n\n L = fst.Fst.read(\"L.fst\")\n G = fst.Fst.read(\"G.fst\")\n C = fst.Fst.read(\"C.fst\")\n H = fst.Fst.read(\"H.fst\")\n LG = fst.determinize(fst.compose(L, G))\n CLG = fst.determinize(fst.compose(C, LG))\n HCLG = fst.determinize(fst.compose(H, CLG))\n HCLG.minimize() # NB: works in-place.\n\nPython variables here use snake_case and constants are in all caps, minus the\nnormal `k` prefix.\n"; +static const char __pyx_k_Unknown_random_arc_selection_typ[] = "Unknown random arc selection type: {!r}"; +static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; +static const char __pyx_k_self__aiter_self__mfst_cannot_be[] = "self._aiter,self._mfst cannot be converted to a Python object for pickling"; +static const char __pyx_k_self__arc_cannot_be_converted_to[] = "self._arc cannot be converted to a Python object for pickling"; +static const char __pyx_k_self__encoder_cannot_be_converte[] = "self._encoder cannot be converted to a Python object for pickling"; +static const char __pyx_k_self__reader_cannot_be_converted[] = "self._reader cannot be converted to a Python object for pickling"; +static const char __pyx_k_self__siter_self__table_cannot_b[] = "self._siter,self._table cannot be converted to a Python object for pickling"; +static const char __pyx_k_self__weight_cannot_be_converted[] = "self._weight cannot be converted to a Python object for pickling"; +static const char __pyx_k_self__writer_cannot_be_converted[] = "self._writer cannot be converted to a Python object for pickling"; +static PyObject *__pyx_n_s_ACCEPTOR; +static PyObject *__pyx_n_s_ACCESSIBLE; +static PyObject *__pyx_n_s_ACYCLIC; +static PyObject *__pyx_n_s_ADD_ARC_PROPERTIES; +static PyObject *__pyx_n_s_ADD_STATE_PROPERTIES; +static PyObject *__pyx_n_s_ADD_SUPERFINAL_PROPERTIES; +static PyObject *__pyx_n_s_ARC_FLAGS; +static PyObject *__pyx_n_s_ARC_I_LABEL_VALUE; +static PyObject *__pyx_n_s_ARC_NEXT_STATE_VALUE; +static PyObject *__pyx_n_s_ARC_NO_CACHE; +static PyObject *__pyx_n_s_ARC_O_LABEL_VALUE; +static PyObject *__pyx_n_s_ARC_SORT_PROPERTIES; +static PyObject *__pyx_n_s_ARC_VALUE_FLAGS; +static PyObject *__pyx_n_s_ARC_WEIGHT_VALUE; +static PyObject *__pyx_n_s_Arc; +static PyObject *__pyx_n_s_ArcIterator; +static PyObject *__pyx_kp_u_ArcIterator_at_0x_x; +static PyObject *__pyx_kp_u_Arc_at_0x_x; +static PyObject *__pyx_n_s_BINARY_PROPERTIES; +static PyObject *__pyx_n_s_COACCESSIBLE; +static PyObject *__pyx_n_s_COPY_PROPERTIES; +static PyObject *__pyx_n_s_CYCLIC; +static PyObject *__pyx_kp_u_Cannot_construct; +static PyObject *__pyx_kp_u_Cannot_encode_as_string_r; +static PyObject *__pyx_kp_u_Cannot_topsort_cyclic_FST; +static PyObject *__pyx_kp_u_Compilation_failed; +static PyObject *__pyx_n_s_Compiler; +static PyObject *__pyx_kp_u_Conversion_to_r_failed; +static PyObject *__pyx_n_s_DELETE_ARC_PROPERTIES; +static PyObject *__pyx_n_s_DELETE_STATE_PROPERTIES; +static PyObject *__pyx_kp_u_Dot_rendering_failed_s; +static PyObject *__pyx_n_s_ENCODE_FLAGS; +static PyObject *__pyx_n_s_ENCODE_LABELS; +static PyObject *__pyx_n_s_ENCODE_WEIGHTS; +static PyObject *__pyx_n_s_EPSILONS; +static PyObject *__pyx_n_s_ERROR; +static PyObject *__pyx_n_s_EXPANDED; +static PyObject *__pyx_n_s_EXTRINSIC_PROPERTIES; +static PyObject *__pyx_n_s_EncodeMapper; +static PyObject *__pyx_n_s_EncodeMapperSymbolTable; +static PyObject *__pyx_kp_u_EncodeMapper_at_0x_x; +static PyObject *__pyx_n_s_FST_PROPERTIES; +static PyObject *__pyx_n_s_FarReader; +static PyObject *__pyx_kp_u_FarReader_at_0x_x; +static PyObject *__pyx_n_s_FarWriter; +static PyObject *__pyx_kp_u_FarWriter_at_0x_x; +static PyObject *__pyx_n_s_Fst; +static PyObject *__pyx_n_s_FstArgError; +static PyObject *__pyx_n_s_FstBadWeightError; +static PyObject *__pyx_n_s_FstDeletedConstructorError; +static PyObject *__pyx_n_s_FstError; +static PyObject *__pyx_n_s_FstIOError; +static PyObject *__pyx_n_s_FstIndexError; +static PyObject *__pyx_n_s_FstOpError; +static PyObject *__pyx_n_s_FstSymbolTable; +static PyObject *__pyx_n_s_Fst_2; +static PyObject *__pyx_kp_u_Fst_SymbolTable_r_at_0x_x; +static PyObject *__pyx_n_s_Fst___new; +static PyObject *__pyx_kp_s_Fst_arc_type_standard_Construct; +static PyObject *__pyx_kp_u_Fst_at_0x_x; +static PyObject *__pyx_n_s_Fst_read; +static PyObject *__pyx_n_s_Fst_read_from_string; +static PyObject *__pyx_n_s_INITIAL_ACYCLIC; +static PyObject *__pyx_n_s_INITIAL_CYCLIC; +static PyObject *__pyx_n_s_INTRINSIC_PROPERTIES; +static PyObject *__pyx_n_s_IOError; +static PyObject *__pyx_n_s_I_DETERMINISTIC; +static PyObject *__pyx_n_s_I_EPSILONS; +static PyObject *__pyx_n_s_I_LABEL_INVARIANT_PROPERTIES; +static PyObject *__pyx_n_s_I_LABEL_SORTED; +static PyObject *__pyx_kp_u_Incompatible_or_invalid_arc_type; +static PyObject *__pyx_kp_u_Incompatible_or_invalid_weight; +static PyObject *__pyx_kp_u_Incompatible_or_invalid_weight_t; +static PyObject *__pyx_n_s_IndexError; +static PyObject *__pyx_kp_u_Invalid_weight; +static PyObject *__pyx_n_s_KeyError; +static PyObject *__pyx_kp_u_Key_out_of_order; +static PyObject *__pyx_n_s_MUTABLE; +static PyObject *__pyx_n_s_MutableArcIterator; +static PyObject *__pyx_n_s_MutableArcIterator___iter; +static PyObject *__pyx_kp_u_MutableArcIterator_at_0x_x; +static PyObject *__pyx_n_s_MutableFst; +static PyObject *__pyx_n_s_MutableFstSymbolTable; +static PyObject *__pyx_n_s_MutableSymbolTable; +static PyObject *__pyx_n_s_NEG_TRINARY_PROPERTIES; +static PyObject *__pyx_n_s_NON_I_DETERMINISTIC; +static PyObject *__pyx_n_s_NON_O_DETERMINISTIC; +static PyObject *__pyx_n_s_NOT_ACCEPTOR; +static PyObject *__pyx_n_s_NOT_ACCESSIBLE; +static PyObject *__pyx_n_s_NOT_COACCESSIBLE; +static PyObject *__pyx_n_s_NOT_I_LABEL_SORTED; +static PyObject *__pyx_n_s_NOT_O_LABEL_SORTED; +static PyObject *__pyx_n_s_NOT_STRING; +static PyObject *__pyx_n_s_NOT_TOP_SORTED; +static PyObject *__pyx_n_s_NO_EPSILONS; +static PyObject *__pyx_n_s_NO_I_EPSILONS; +static PyObject *__pyx_n_s_NO_LABEL; +static PyObject *__pyx_n_s_NO_O_EPSILONS; +static PyObject *__pyx_n_s_NO_STATE_ID; +static PyObject *__pyx_n_s_NO_SYMBOL; +static PyObject *__pyx_n_s_NULL_PROPERTIES; +static PyObject *__pyx_n_s_NoWeight; +static PyObject *__pyx_kp_u_No_new_SymbolTables_specified; +static PyObject *__pyx_kp_u_No_relabeling_pairs_specified; +static PyObject *__pyx_n_s_Number; +static PyObject *__pyx_n_s_O_DETERMINISTIC; +static PyObject *__pyx_n_s_O_EPSILONS; +static PyObject *__pyx_n_s_O_LABEL_INVARIANT_PROPERTIES; +static PyObject *__pyx_n_s_O_LABEL_SORTED; +static PyObject *__pyx_n_s_One; +static PyObject *__pyx_kp_u_Open_failed_r; +static PyObject *__pyx_kp_u_Operation_failed; +static PyObject *__pyx_n_s_PIPE; +static PyObject *__pyx_n_s_POS_TRINARY_PROPERTIES; +static PyObject *__pyx_n_s_Popen; +static PyObject *__pyx_n_s_RM_SUPERFINAL_PROPERTIES; +static PyObject *__pyx_kp_u_Read_failed; +static PyObject *__pyx_kp_u_Read_failed_r; +static PyObject *__pyx_n_s_RuntimeError; +static PyObject *__pyx_n_s_SET_ARC_PROPERTIES; +static PyObject *__pyx_n_s_SET_FINAL_PROPERTIES; +static PyObject *__pyx_n_s_SET_START_PROPERTIES; +static PyObject *__pyx_n_s_STATE_SORT_PROPERTIES; +static PyObject *__pyx_n_s_STRING; +static PyObject *__pyx_n_s_StateIterator; +static PyObject *__pyx_kp_u_StateIterator_at_0x_x; +static PyObject *__pyx_kp_u_State_index_out_of_range; +static PyObject *__pyx_n_s_StopIteration; +static PyObject *__pyx_n_s_SymbolTable; +static PyObject *__pyx_n_s_SymbolTableIterator; +static PyObject *__pyx_kp_u_SymbolTableIterator_at_0x_x; +static PyObject *__pyx_n_s_SymbolTable_2; +static PyObject *__pyx_kp_u_SymbolTable_r_at_0x_x; +static PyObject *__pyx_n_s_TOP_SORTED; +static PyObject *__pyx_n_s_TRINARY_PROPERTIES; +static PyObject *__pyx_kp_u_Tsvg; +static PyObject *__pyx_n_s_TypeError; +static PyObject *__pyx_n_s_UNWEIGHTED; +static PyObject *__pyx_n_s_UNWEIGHTED_CYCLES; +static PyObject *__pyx_kp_u_Unknown_arc_type_r; +static PyObject *__pyx_kp_u_Unknown_compose_filter_type_r; +static PyObject *__pyx_kp_u_Unknown_determinization_type_r; +static PyObject *__pyx_kp_u_Unknown_map_type_r; +static PyObject *__pyx_kp_u_Unknown_queue_type_r; +static PyObject *__pyx_kp_u_Unknown_random_arc_selection_typ; +static PyObject *__pyx_kp_u_Unknown_replace_label_type_r; +static PyObject *__pyx_kp_u_Unknown_sort_type_r; +static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_WEIGHTED; +static PyObject *__pyx_n_s_WEIGHTED_CYCLES; +static PyObject *__pyx_n_s_WEIGHT_INVARIANT_PROPERTIES; +static PyObject *__pyx_n_s_Weight; +static PyObject *__pyx_kp_u_Weight_at_0x_x; +static PyObject *__pyx_kp_u_Weight_type_not_found; +static PyObject *__pyx_kp_u_Write_failed_r; +static PyObject *__pyx_kp_u_Write_to_string_failed; +static PyObject *__pyx_n_s_Zero; +static PyObject *__pyx_kp_b__10; +static PyObject *__pyx_n_s_acceptor; +static PyObject *__pyx_n_s_add; +static PyObject *__pyx_n_s_add_state; +static PyObject *__pyx_n_s_add_symbol; +static PyObject *__pyx_n_s_add_table; +static PyObject *__pyx_n_s_allow_negative_labels; +static PyObject *__pyx_n_s_allow_nondet; +static PyObject *__pyx_n_s_arc; +static PyObject *__pyx_n_s_arc_type; +static PyObject *__pyx_n_s_arcs; +static PyObject *__pyx_n_s_args; +static PyObject *__pyx_n_s_attach_new_isymbols; +static PyObject *__pyx_n_s_attach_new_osymbols; +static PyObject *__pyx_n_b_auto; +static PyObject *__pyx_n_s_available_key; +static PyObject *__pyx_n_s_call_arc_labeling; +static PyObject *__pyx_n_s_checksum; +static PyObject *__pyx_n_s_class; +static PyObject *__pyx_n_s_cline_in_traceback; +static PyObject *__pyx_n_s_close; +static PyObject *__pyx_n_s_closure_plus; +static PyObject *__pyx_n_s_cls; +static PyObject *__pyx_n_s_communicate; +static PyObject *__pyx_n_s_compile; +static PyObject *__pyx_n_s_compose_filter; +static PyObject *__pyx_n_s_connect; +static PyObject *__pyx_kp_u_const_EncodeMapper_SymbolTable; +static PyObject *__pyx_kp_u_const_Fst_SymbolTable_r_at_0x_x; +static PyObject *__pyx_n_s_copy; +static PyObject *__pyx_n_s_create; +static PyObject *__pyx_n_b_default; +static PyObject *__pyx_n_s_delta; +static PyObject *__pyx_n_s_det_type; +static PyObject *__pyx_n_s_distance; +static PyObject *__pyx_n_s_divide; +static PyObject *__pyx_n_s_doc; +static PyObject *__pyx_n_s_done; +static PyObject *__pyx_n_u_dot; +static PyObject *__pyx_n_s_draw; +static PyObject *__pyx_n_s_encode; +static PyObject *__pyx_n_s_encode_labels; +static PyObject *__pyx_n_s_encode_weights; +static PyObject *__pyx_n_s_eps_norm_output; +static PyObject *__pyx_n_s_epsilon_on_replace; +static PyObject *__pyx_n_s_error; +static PyObject *__pyx_n_s_far_type; +static PyObject *__pyx_n_s_filename; +static PyObject *__pyx_n_s_final; +static PyObject *__pyx_n_s_find; +static PyObject *__pyx_n_s_flags; +static PyObject *__pyx_n_s_float_format; +static PyObject *__pyx_n_s_fontsize; +static PyObject *__pyx_n_s_format; +static PyObject *__pyx_n_s_fst_type; +static PyObject *__pyx_n_b_functional; +static PyObject *__pyx_n_b_g; +static PyObject *__pyx_n_s_get_fst; +static PyObject *__pyx_n_s_get_key; +static PyObject *__pyx_n_s_get_nth_key; +static PyObject *__pyx_n_s_getstate; +static PyObject *__pyx_n_s_height; +static PyObject *__pyx_n_s_id; +static PyObject *__pyx_n_b_identity; +static PyObject *__pyx_n_s_ifst; +static PyObject *__pyx_n_s_ifst1; +static PyObject *__pyx_n_s_ifst2; +static PyObject *__pyx_n_b_ilabel; +static PyObject *__pyx_n_s_ilabel; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_increment_subsequential_label; +static PyObject *__pyx_n_b_input; +static PyObject *__pyx_n_s_input_symbols; +static PyObject *__pyx_n_s_input_table; +static PyObject *__pyx_n_s_ipairs; +static PyObject *__pyx_n_s_isymbols; +static PyObject *__pyx_n_s_iter; +static PyObject *__pyx_n_s_keep_isymbols; +static PyObject *__pyx_n_s_keep_osymbols; +static PyObject *__pyx_n_s_keep_state_numbering; +static PyObject *__pyx_n_s_key; +static PyObject *__pyx_n_s_labeled_checksum; +static PyObject *__pyx_n_s_lhs; +static PyObject *__pyx_n_s_logging; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_map_type; +static PyObject *__pyx_n_s_mask; +static PyObject *__pyx_n_s_max_length; +static PyObject *__pyx_n_s_member; +static PyObject *__pyx_n_s_metaclass; +static PyObject *__pyx_n_s_missing_sym; +static PyObject *__pyx_n_s_module; +static PyObject *__pyx_n_s_mutable_arcs; +static PyObject *__pyx_n_s_n; +static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_name_2; +static PyObject *__pyx_n_b_neither; +static PyObject *__pyx_n_s_new; +static PyObject *__pyx_n_s_new_isymbols; +static PyObject *__pyx_n_s_new_osymbols; +static PyObject *__pyx_n_s_next; +static PyObject *__pyx_n_s_nextstate; +static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; +static PyObject *__pyx_n_s_nodesep; +static PyObject *__pyx_n_s_npath; +static PyObject *__pyx_n_s_nshortest; +static PyObject *__pyx_n_s_nstate; +static PyObject *__pyx_n_s_num_arcs; +static PyObject *__pyx_n_s_num_input_epsilons; +static PyObject *__pyx_n_s_num_output_epsilons; +static PyObject *__pyx_n_s_num_states; +static PyObject *__pyx_n_s_num_symbols; +static PyObject *__pyx_n_s_numbers; +static PyObject *__pyx_n_s_object; +static PyObject *__pyx_n_s_olabel; +static PyObject *__pyx_n_s_old_isymbols; +static PyObject *__pyx_n_s_old_osymbols; +static PyObject *__pyx_n_s_opairs; +static PyObject *__pyx_n_s_open; +static PyObject *__pyx_n_s_osymbols; +static PyObject *__pyx_n_s_output_symbols; +static PyObject *__pyx_n_s_pairs; +static PyObject *__pyx_n_s_plus; +static PyObject *__pyx_n_s_portrait; +static PyObject *__pyx_n_s_position; +static PyObject *__pyx_n_s_potentials; +static PyObject *__pyx_n_s_power; +static PyObject *__pyx_n_s_precision; +static PyObject *__pyx_n_s_prepare; +static PyObject *__pyx_n_s_project_output; +static PyObject *__pyx_n_s_properties; +static PyObject *__pyx_n_s_props; +static PyObject *__pyx_n_s_push_labels; +static PyObject *__pyx_n_s_push_weights; +static PyObject *__pyx_n_s_pywrapfst_2; +static PyObject *__pyx_kp_s_pywrapfst_pyx; +static PyObject *__pyx_n_s_pyx_vtable; +static PyObject *__pyx_n_s_qualname; +static PyObject *__pyx_n_s_queue_type; +static PyObject *__pyx_n_s_ranksep; +static PyObject *__pyx_n_s_read; +static PyObject *__pyx_n_s_read_Fst_from_string; +static PyObject *__pyx_n_s_read_SymbolTable_from_string; +static PyObject *__pyx_n_s_read_from_string; +static PyObject *__pyx_n_s_read_fst; +static PyObject *__pyx_n_s_read_text; +static PyObject *__pyx_n_s_reduce; +static PyObject *__pyx_n_s_reduce_cython; +static PyObject *__pyx_n_s_reduce_ex; +static PyObject *__pyx_n_s_remove_common_affix; +static PyObject *__pyx_n_s_remove_total_weight; +static PyObject *__pyx_n_s_require_superinitial; +static PyObject *__pyx_n_s_reset; +static PyObject *__pyx_n_s_result; +static PyObject *__pyx_n_s_return_arc_labeling; +static PyObject *__pyx_n_s_return_label; +static PyObject *__pyx_n_s_reverse; +static PyObject *__pyx_n_s_rhs; +static PyObject *__pyx_n_s_seed; +static PyObject *__pyx_n_s_seek; +static PyObject *__pyx_n_s_select; +static PyObject *__pyx_kp_s_self__aiter_self__fst_cannot_be; +static PyObject *__pyx_kp_s_self__aiter_self__mfst_cannot_be; +static PyObject *__pyx_kp_s_self__arc_cannot_be_converted_to; +static PyObject *__pyx_kp_s_self__encoder_cannot_be_converte; +static PyObject *__pyx_kp_s_self__fst_self__siter_cannot_be; +static PyObject *__pyx_kp_s_self__reader_cannot_be_converted; +static PyObject *__pyx_kp_s_self__siter_self__table_cannot_b; +static PyObject *__pyx_kp_s_self__weight_cannot_be_converted; +static PyObject *__pyx_kp_s_self__writer_cannot_be_converted; +static PyObject *__pyx_n_s_send; +static PyObject *__pyx_n_s_set_flags; +static PyObject *__pyx_n_s_set_input_symbols; +static PyObject *__pyx_n_s_set_name; +static PyObject *__pyx_n_s_set_output_symbols; +static PyObject *__pyx_n_s_set_value; +static PyObject *__pyx_n_s_setstate; +static PyObject *__pyx_n_s_setstate_cython; +static PyObject *__pyx_n_s_shortestdistance; +static PyObject *__pyx_n_s_show_weight_one; +static PyObject *__pyx_n_s_sort_type; +static PyObject *__pyx_n_s_ssymbols; +static PyObject *__pyx_n_b_standard; +static PyObject *__pyx_n_s_start; +static PyObject *__pyx_n_s_state; +static PyObject *__pyx_n_s_states; +static PyObject *__pyx_n_s_staticmethod; +static PyObject *__pyx_n_s_stdin; +static PyObject *__pyx_n_s_stdout; +static PyObject *__pyx_n_s_subprocess; +static PyObject *__pyx_n_s_subsequential_label; +static PyObject *__pyx_n_s_symbol; +static PyObject *__pyx_n_s_syms; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_test_2; +static PyObject *__pyx_n_s_text; +static PyObject *__pyx_n_s_throw; +static PyObject *__pyx_n_s_times; +static PyObject *__pyx_n_s_title; +static PyObject *__pyx_n_s_to_final; +static PyObject *__pyx_n_s_to_string; +static PyObject *__pyx_n_s_type; +static PyObject *__pyx_n_b_uniform; +static PyObject *__pyx_n_s_unique; +static PyObject *__pyx_n_s_unknown_isymbol; +static PyObject *__pyx_n_s_unknown_osymbol; +static PyObject *__pyx_kp_u_unspecified; +static PyObject *__pyx_n_u_utf8; +static PyObject *__pyx_n_s_value; +static PyObject *__pyx_n_b_vector; +static PyObject *__pyx_n_s_verify; +static PyObject *__pyx_n_s_vertical; +static PyObject *__pyx_n_s_w; +static PyObject *__pyx_n_s_warning; +static PyObject *__pyx_n_s_weight; +static PyObject *__pyx_n_s_weight_type; +static PyObject *__pyx_n_s_weighted; +static PyObject *__pyx_n_s_width; +static PyObject *__pyx_n_s_write; +static PyObject *__pyx_n_s_write_text; +static PyObject *__pyx_n_s_write_to_string; +static PyObject *__pyx_pf_9pywrapfst_6Weight___repr__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_2__str__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_4__float__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_6Weight_6__init__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, PyObject *__pyx_v_weight_type, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_8copy(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_10Zero(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_weight_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_12One(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_weight_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_14NoWeight(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_weight_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_16__eq__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w1, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w2); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_18__ne__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w1, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w2); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_20to_string(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_22type(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_24member(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6Weight_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_plus(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_2times(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4divide(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_6power(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w, size_t __pyx_v_n); /* proto */ +static int __pyx_pf_9pywrapfst_12_SymbolTable___init__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_2__iter__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_4__reduce__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_6available_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_8checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_10copy(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_12find(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_14get_nth_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, Py_ssize_t __pyx_v_pos); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_16labeled_checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_18member(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static int __pyx_pf_9pywrapfst_12_SymbolTable_20__contains__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_22name(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_24num_symbols(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_26write(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_28write_text(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_30write_to_string(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_24_EncodeMapperSymbolTable___repr__(struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_15_FstSymbolTable___repr__(struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19_MutableSymbolTable_add_symbol(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_symbol, __pyx_t_10basictypes_int64 __pyx_v_key); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19_MutableSymbolTable_2add_table(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19_MutableSymbolTable_4set_name(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_new_name); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_22_MutableFstSymbolTable___repr__(struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable___repr__(struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_11SymbolTable_2__init__(struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable_4read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable_6read_text(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename, bool __pyx_v_allow_negative_labels); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable_8read_fst(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename, bool __pyx_v_input_table); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_8_read_SymbolTable_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_10compact_symbol_table(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12merge_symbol_table(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_lhs, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_rhs); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator___repr__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_19SymbolTableIterator_2__init__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_4__iter__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_6__next__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_8done(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_10next(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_12reset(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_14symbol(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_16value(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper___repr__(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_12EncodeMapper_2__init__(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, PyObject *__pyx_v_arc_type, bool __pyx_v_encode_labels, bool __pyx_v_encode_weights); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_4arc_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_6__call__(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_8flags(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_10input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_12output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_14properties(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_16set_input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_18set_output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_20weight_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst__repr_svg_(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_4_Fst_2__init__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_4__reduce__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_6__repr__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_8__str__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_10arc_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_12arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_14copy(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_16draw(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_ssymbols, bool __pyx_v_acceptor, PyObject *__pyx_v_title, double __pyx_v_width, double __pyx_v_height, bool __pyx_v_portrait, bool __pyx_v_vertical, double __pyx_v_ranksep, double __pyx_v_nodesep, __pyx_t_10basictypes_int32 __pyx_v_fontsize, __pyx_t_10basictypes_int32 __pyx_v_precision, PyObject *__pyx_v_float_format, bool __pyx_v_show_weight_one); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_18final(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_20fst_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_22input_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_24num_arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_26num_input_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_28num_output_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_30output_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_32properties(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask, bool __pyx_v_test); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_34start(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_36states(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_38text(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_ssymbols, bool __pyx_v_acceptor, bool __pyx_v_show_weight_one, PyObject *__pyx_v_missing_sym); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_40verify(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_42weight_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_44write(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_4_Fst_46write_to_string(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_add_arc(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_2add_state(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_4arcsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_sort_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_6closure(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, bool __pyx_v_closure_plus); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_8concat(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_10connect(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_12decode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_14delete_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, size_t __pyx_v_n); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_16delete_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_states); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_18encode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_20invert(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_22minimize(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, float __pyx_v_delta, bool __pyx_v_allow_nondet); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_24mutable_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_26mutable_input_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_28mutable_output_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_30num_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_32project(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, bool __pyx_v_project_output); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_34prune(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_36push(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, float __pyx_v_delta, bool __pyx_v_remove_total_weight, bool __pyx_v_to_final); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_38relabel_pairs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_ipairs, PyObject *__pyx_v_opairs); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_40relabel_tables(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_isymbols, PyObject *__pyx_v_unknown_isymbol, bool __pyx_v_attach_new_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_osymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_osymbols, PyObject *__pyx_v_unknown_osymbol, bool __pyx_v_attach_new_osymbols); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_42reserve_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, size_t __pyx_v_n); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_44reserve_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_n); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_46reweight(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_potentials, bool __pyx_v_to_final); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_48rmepsilon(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_queue_type, bool __pyx_v_connect, PyObject *__pyx_v_weight, __pyx_t_10basictypes_int64 __pyx_v_nstate, float __pyx_v_delta); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_50set_final(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_52set_input_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_54set_output_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_56set_properties(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_props, __pyx_t_10basictypes_uint64 __pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_58set_start(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_60topsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_62union(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_14_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_16_read_Fst_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Fst___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, PyObject *__pyx_v_arc_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Fst_2read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Fst_4read_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc___repr__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_3Arc_2__init__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_ilabel, __pyx_t_10basictypes_int64 __pyx_v_olabel, PyObject *__pyx_v_weight, __pyx_t_10basictypes_int64 __pyx_v_nextstate); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc_4copy(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc_6ilabel___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_3Arc_6ilabel_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc_6olabel___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_3Arc_6olabel_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc_6weight___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_3Arc_6weight_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc_9nextstate___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_3Arc_9nextstate_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_3Arc_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator___repr__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_11ArcIterator_2__init__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_4__iter__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_6__next__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_8done(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_10flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_12next(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_14position(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_16reset(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_18seek(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, size_t __pyx_v_a); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_20set_flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_22value(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator___repr__(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_18MutableArcIterator_2__init__(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_ifst, __pyx_t_10basictypes_int64 __pyx_v_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_4__iter__(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_7done(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_9flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_11next(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_13position(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_15reset(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_17seek(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, size_t __pyx_v_a); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_19set_flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_21set_value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_23value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_25__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_27__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator___repr__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_13StateIterator_2__init__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_4__iter__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_6__next__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_8done(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_10next(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_12reset(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_14value(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_18arcmap(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, PyObject *__pyx_v_map_type, double __pyx_v_power, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_20compose(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_22convert(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, PyObject *__pyx_v_fst_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_24determinize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, PyObject *__pyx_v_det_type, __pyx_t_10basictypes_int64 __pyx_v_nstate, __pyx_t_10basictypes_int64 __pyx_v_subsequential_label, PyObject *__pyx_v_weight, bool __pyx_v_increment_subsequential_label); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_26difference(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_28disambiguate(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, __pyx_t_10basictypes_int64 __pyx_v_subsequential_label, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_30epsnormalize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, bool __pyx_v_eps_norm_output); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_32equal(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, float __pyx_v_delta); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_34equivalent(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, float __pyx_v_delta); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_36intersect(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_38isomorphic(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, float __pyx_v_delta); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_40prune(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_42push(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, bool __pyx_v_push_weights, bool __pyx_v_push_labels, bool __pyx_v_remove_common_affix, bool __pyx_v_remove_total_weight, bool __pyx_v_to_final); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_44randequivalent(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, __pyx_t_10basictypes_int32 __pyx_v_npath, float __pyx_v_delta, time_t __pyx_v_seed, PyObject *__pyx_v_select, __pyx_t_10basictypes_int32 __pyx_v_max_length); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_46randgen(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, __pyx_t_10basictypes_int32 __pyx_v_npath, time_t __pyx_v_seed, PyObject *__pyx_v_select, __pyx_t_10basictypes_int32 __pyx_v_max_length, bool __pyx_v_weighted, bool __pyx_v_remove_total_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_48replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs, PyObject *__pyx_v_call_arc_labeling, PyObject *__pyx_v_return_arc_labeling, bool __pyx_v_epsilon_on_replace, __pyx_t_10basictypes_int64 __pyx_v_return_label); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_50reverse(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, bool __pyx_v_require_superinitial); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_52shortestdistance(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_queue_type, bool __pyx_v_reverse); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_54shortestpath(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int32 __pyx_v_nshortest, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_queue_type, bool __pyx_v_unique, PyObject *__pyx_v_weight); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_56statemap(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, PyObject *__pyx_v_map_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_58synchronize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst); /* proto */ +static int __pyx_pf_9pywrapfst_8Compiler___cinit__(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, std::string __pyx_v_fst_type, std::string __pyx_v_arc_type, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_isymbols, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_osymbols, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_ssymbols, bool __pyx_v_acceptor, bool __pyx_v_keep_isymbols, bool __pyx_v_keep_osymbols, bool __pyx_v_keep_state_numbering, bool __pyx_v_allow_negative_labels); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_8Compiler_2compile(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_8Compiler_4write(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, PyObject *__pyx_v_expression); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_8Compiler_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_8Compiler_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_9pywrapfst_9FarReader___init__(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_2__repr__(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_4open(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filenames); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_6arc_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_8done(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_10error(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_12far_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_14find(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_16get_fst(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_18get_key(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_20next(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_22reset(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_24__getitem__(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarReader_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_9pywrapfst_9FarWriter___init__(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_2__repr__(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_4create(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_far_type); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_6add(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_8arc_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_10error(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_12far_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self); /* proto */ +static int __pyx_pf_9pywrapfst_9FarWriter_14__setitem__(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_fst); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_9pywrapfst_Weight(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst__SymbolTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst__EncodeMapperSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst__FstSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst__MutableSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst__MutableFstSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_SymbolTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_SymbolTableIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_EncodeMapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst__Fst(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst__MutableFst(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_Arc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_ArcIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_MutableArcIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_StateIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_Compiler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_FarReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst_FarWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_9pywrapfst___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_k__3; +static float __pyx_k__11; +static float __pyx_k__12; +static float __pyx_k__13; +static __pyx_t_10basictypes_int64 __pyx_k__14; +static float __pyx_k__15; +static __pyx_t_10basictypes_int64 __pyx_k__16; +static float __pyx_k__17; +static float __pyx_k__18; +static __pyx_t_10basictypes_int64 __pyx_k__19; +static float __pyx_k__20; +static __pyx_t_10basictypes_int64 __pyx_k__21; +static float __pyx_k__22; +static float __pyx_k__31; +static float __pyx_k__32; +static float __pyx_k__33; +static __pyx_t_10basictypes_int64 __pyx_k__34; +static float __pyx_k__35; +static __pyx_t_10basictypes_int64 __pyx_k__36; +static float __pyx_k__37; +static float __pyx_k__38; +static float __pyx_k__39; +static float __pyx_k__40; +static __pyx_t_10basictypes_int64 __pyx_k__41; +static float __pyx_k__42; +static float __pyx_k__43; +static __pyx_t_10basictypes_int32 __pyx_k__44; +static __pyx_t_10basictypes_int32 __pyx_k__45; +static float __pyx_k__46; +static __pyx_t_10basictypes_int64 __pyx_k__47; +static float __pyx_k__48; +static __pyx_t_10basictypes_int64 __pyx_k__49; +static float __pyx_k__50; +static __pyx_t_10basictypes_int64 __pyx_k__51; +static std::string __pyx_k__52; +static std::string __pyx_k__53; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__2; +static PyObject *__pyx_tuple__4; +static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; +static PyObject *__pyx_tuple__23; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__54; +static PyObject *__pyx_tuple__55; +static PyObject *__pyx_tuple__56; +static PyObject *__pyx_tuple__57; +static PyObject *__pyx_tuple__58; +static PyObject *__pyx_tuple__59; +static PyObject *__pyx_tuple__60; +static PyObject *__pyx_tuple__62; +static PyObject *__pyx_tuple__64; +static PyObject *__pyx_tuple__66; +static PyObject *__pyx_tuple__68; +static PyObject *__pyx_tuple__69; +static PyObject *__pyx_tuple__71; +static PyObject *__pyx_tuple__72; +static PyObject *__pyx_tuple__74; +static PyObject *__pyx_tuple__76; +static PyObject *__pyx_codeobj__61; +static PyObject *__pyx_codeobj__63; +static PyObject *__pyx_codeobj__65; +static PyObject *__pyx_codeobj__67; +static PyObject *__pyx_codeobj__70; +static PyObject *__pyx_codeobj__73; +static PyObject *__pyx_codeobj__75; +static PyObject *__pyx_codeobj__77; +/* Late includes */ + +/* "pywrapfst.pyx":145 + * + * + * cdef string tostring(data) except *: # <<<<<<<<<<<<<< + * """Converts strings to bytestrings. + * + */ + +static std::string __pyx_f_9pywrapfst_tostring(PyObject *__pyx_v_data) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + std::string __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("tostring", 0); + + /* "pywrapfst.pyx":165 + * """ + * # A Python bytestring can be implicitly cast to a C++ string. + * if isinstance(data, bytes): # <<<<<<<<<<<<<< + * return data + * elif isinstance(data, unicode): + */ + __pyx_t_1 = PyBytes_Check(__pyx_v_data); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":166 + * # A Python bytestring can be implicitly cast to a C++ string. + * if isinstance(data, bytes): + * return data # <<<<<<<<<<<<<< + * elif isinstance(data, unicode): + * return data.encode("utf8") + */ + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "pywrapfst.pyx":165 + * """ + * # A Python bytestring can be implicitly cast to a C++ string. + * if isinstance(data, bytes): # <<<<<<<<<<<<<< + * return data + * elif isinstance(data, unicode): + */ + } + + /* "pywrapfst.pyx":167 + * if isinstance(data, bytes): + * return data + * elif isinstance(data, unicode): # <<<<<<<<<<<<<< + * return data.encode("utf8") + * raise FstArgError("Cannot encode as string: {!r}".format(data)) + */ + __pyx_t_2 = PyUnicode_Check(__pyx_v_data); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":168 + * return data + * elif isinstance(data, unicode): + * return data.encode("utf8") # <<<<<<<<<<<<<< + * raise FstArgError("Cannot encode as string: {!r}".format(data)) + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_u_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_utf8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "pywrapfst.pyx":167 + * if isinstance(data, bytes): + * return data + * elif isinstance(data, unicode): # <<<<<<<<<<<<<< + * return data.encode("utf8") + * raise FstArgError("Cannot encode as string: {!r}".format(data)) + */ + } + + /* "pywrapfst.pyx":169 + * elif isinstance(data, unicode): + * return data.encode("utf8") + * raise FstArgError("Cannot encode as string: {!r}".format(data)) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Cannot_encode_as_string_r, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_data); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 169, __pyx_L1_error) + + /* "pywrapfst.pyx":145 + * + * + * cdef string tostring(data) except *: # <<<<<<<<<<<<<< + * """Converts strings to bytestrings. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":172 + * + * + * cdef string weight_tostring(data) except *: # <<<<<<<<<<<<<< + * """Converts strings or numerics to bytestrings. + * + */ + +static std::string __pyx_f_9pywrapfst_weight_tostring(PyObject *__pyx_v_data) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + std::string __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("weight_tostring", 0); + + /* "pywrapfst.pyx":196 + * """ + * # A Python bytestring can be implicitly cast to a C++ string. + * if isinstance(data, bytes): # <<<<<<<<<<<<<< + * return data + * elif isinstance(data, unicode): + */ + __pyx_t_1 = PyBytes_Check(__pyx_v_data); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":197 + * # A Python bytestring can be implicitly cast to a C++ string. + * if isinstance(data, bytes): + * return data # <<<<<<<<<<<<<< + * elif isinstance(data, unicode): + * return data.encode("utf8") + */ + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "pywrapfst.pyx":196 + * """ + * # A Python bytestring can be implicitly cast to a C++ string. + * if isinstance(data, bytes): # <<<<<<<<<<<<<< + * return data + * elif isinstance(data, unicode): + */ + } + + /* "pywrapfst.pyx":198 + * if isinstance(data, bytes): + * return data + * elif isinstance(data, unicode): # <<<<<<<<<<<<<< + * return data.encode("utf8") + * elif isinstance(data, numbers.Number): + */ + __pyx_t_2 = PyUnicode_Check(__pyx_v_data); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":199 + * return data + * elif isinstance(data, unicode): + * return data.encode("utf8") # <<<<<<<<<<<<<< + * elif isinstance(data, numbers.Number): + * return str(data).encode("utf8") + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_u_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_utf8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "pywrapfst.pyx":198 + * if isinstance(data, bytes): + * return data + * elif isinstance(data, unicode): # <<<<<<<<<<<<<< + * return data.encode("utf8") + * elif isinstance(data, numbers.Number): + */ + } + + /* "pywrapfst.pyx":200 + * elif isinstance(data, unicode): + * return data.encode("utf8") + * elif isinstance(data, numbers.Number): # <<<<<<<<<<<<<< + * return str(data).encode("utf8") + * raise FstArgError("Cannot encode as string: {!r}".format(data)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numbers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Number); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyObject_IsInstance(__pyx_v_data, __pyx_t_5); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":201 + * return data.encode("utf8") + * elif isinstance(data, numbers.Number): + * return str(data).encode("utf8") # <<<<<<<<<<<<<< + * raise FstArgError("Cannot encode as string: {!r}".format(data)) + * + */ + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "pywrapfst.pyx":200 + * elif isinstance(data, unicode): + * return data.encode("utf8") + * elif isinstance(data, numbers.Number): # <<<<<<<<<<<<<< + * return str(data).encode("utf8") + * raise FstArgError("Cannot encode as string: {!r}".format(data)) + */ + } + + /* "pywrapfst.pyx":202 + * elif isinstance(data, numbers.Number): + * return str(data).encode("utf8") + * raise FstArgError("Cannot encode as string: {!r}".format(data)) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Cannot_encode_as_string_r, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_data); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 202, __pyx_L1_error) + + /* "pywrapfst.pyx":172 + * + * + * cdef string weight_tostring(data) except *: # <<<<<<<<<<<<<< + * """Converts strings or numerics to bytestrings. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst.weight_tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":205 + * + * + * cdef fst.ComposeFilter _get_compose_filter( # <<<<<<<<<<<<<< + * const string &compose_filter) except *: + * """Matches string with the appropriate ComposeFilter enum value. + */ + +static enum fst::ComposeFilter __pyx_f_9pywrapfst__get_compose_filter(std::string const &__pyx_v_compose_filter) { + enum fst::ComposeFilter __pyx_v_compose_filter_enum; + enum fst::ComposeFilter __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_get_compose_filter", 0); + + /* "pywrapfst.pyx":227 + * """ + * cdef fst.ComposeFilter compose_filter_enum + * if not fst.GetComposeFilter(compose_filter, addr(compose_filter_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown compose filter type: {!r}".format( + * compose_filter)) + */ + __pyx_t_1 = ((!(fst::script::GetComposeFilter(__pyx_v_compose_filter, (&__pyx_v_compose_filter_enum)) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":228 + * cdef fst.ComposeFilter compose_filter_enum + * if not fst.GetComposeFilter(compose_filter, addr(compose_filter_enum)): + * raise FstArgError("Unknown compose filter type: {!r}".format( # <<<<<<<<<<<<<< + * compose_filter)) + * return compose_filter_enum + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_compose_filter_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "pywrapfst.pyx":229 + * if not fst.GetComposeFilter(compose_filter, addr(compose_filter_enum)): + * raise FstArgError("Unknown compose filter type: {!r}".format( + * compose_filter)) # <<<<<<<<<<<<<< + * return compose_filter_enum + * + */ + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_compose_filter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 228, __pyx_L1_error) + + /* "pywrapfst.pyx":227 + * """ + * cdef fst.ComposeFilter compose_filter_enum + * if not fst.GetComposeFilter(compose_filter, addr(compose_filter_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown compose filter type: {!r}".format( + * compose_filter)) + */ + } + + /* "pywrapfst.pyx":230 + * raise FstArgError("Unknown compose filter type: {!r}".format( + * compose_filter)) + * return compose_filter_enum # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_compose_filter_enum; + goto __pyx_L0; + + /* "pywrapfst.pyx":205 + * + * + * cdef fst.ComposeFilter _get_compose_filter( # <<<<<<<<<<<<<< + * const string &compose_filter) except *: + * """Matches string with the appropriate ComposeFilter enum value. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._get_compose_filter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = (enum fst::ComposeFilter) 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":233 + * + * + * cdef fst.DeterminizeType _get_determinize_type(const string &det_type) except *: # <<<<<<<<<<<<<< + * """Matches string with the appropriate DeterminizeType enum value. + * + */ + +static enum fst::DeterminizeType __pyx_f_9pywrapfst__get_determinize_type(std::string const &__pyx_v_det_type) { + enum fst::DeterminizeType __pyx_v_det_type_enum; + enum fst::DeterminizeType __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_get_determinize_type", 0); + + /* "pywrapfst.pyx":249 + * """ + * cdef fst.DeterminizeType det_type_enum + * if not fst.GetDeterminizeType(det_type, addr(det_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + * return det_type_enum + */ + __pyx_t_1 = ((!(fst::script::GetDeterminizeType(__pyx_v_det_type, (&__pyx_v_det_type_enum)) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":250 + * cdef fst.DeterminizeType det_type_enum + * if not fst.GetDeterminizeType(det_type, addr(det_type_enum)): + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) # <<<<<<<<<<<<<< + * return det_type_enum + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_determinization_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_det_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 250, __pyx_L1_error) + + /* "pywrapfst.pyx":249 + * """ + * cdef fst.DeterminizeType det_type_enum + * if not fst.GetDeterminizeType(det_type, addr(det_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + * return det_type_enum + */ + } + + /* "pywrapfst.pyx":251 + * if not fst.GetDeterminizeType(det_type, addr(det_type_enum)): + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + * return det_type_enum # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_det_type_enum; + goto __pyx_L0; + + /* "pywrapfst.pyx":233 + * + * + * cdef fst.DeterminizeType _get_determinize_type(const string &det_type) except *: # <<<<<<<<<<<<<< + * """Matches string with the appropriate DeterminizeType enum value. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._get_determinize_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = (enum fst::DeterminizeType) 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":254 + * + * + * cdef fst.QueueType _get_queue_type(const string &queue_type) except *: # <<<<<<<<<<<<<< + * """Matches string with the appropriate QueueType enum value. + * + */ + +static enum fst::QueueType __pyx_f_9pywrapfst__get_queue_type(std::string const &__pyx_v_queue_type) { + enum fst::QueueType __pyx_v_queue_type_enum; + enum fst::QueueType __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_get_queue_type", 0); + + /* "pywrapfst.pyx":273 + * """ + * cdef fst.QueueType queue_type_enum + * if not fst.GetQueueType(queue_type, addr(queue_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown queue type: {!r}".format(queue_type)) + * return queue_type_enum + */ + __pyx_t_1 = ((!(fst::script::GetQueueType(__pyx_v_queue_type, (&__pyx_v_queue_type_enum)) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":274 + * cdef fst.QueueType queue_type_enum + * if not fst.GetQueueType(queue_type, addr(queue_type_enum)): + * raise FstArgError("Unknown queue type: {!r}".format(queue_type)) # <<<<<<<<<<<<<< + * return queue_type_enum + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_queue_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_queue_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 274, __pyx_L1_error) + + /* "pywrapfst.pyx":273 + * """ + * cdef fst.QueueType queue_type_enum + * if not fst.GetQueueType(queue_type, addr(queue_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown queue type: {!r}".format(queue_type)) + * return queue_type_enum + */ + } + + /* "pywrapfst.pyx":275 + * if not fst.GetQueueType(queue_type, addr(queue_type_enum)): + * raise FstArgError("Unknown queue type: {!r}".format(queue_type)) + * return queue_type_enum # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_queue_type_enum; + goto __pyx_L0; + + /* "pywrapfst.pyx":254 + * + * + * cdef fst.QueueType _get_queue_type(const string &queue_type) except *: # <<<<<<<<<<<<<< + * """Matches string with the appropriate QueueType enum value. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._get_queue_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = (enum fst::QueueType) 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":278 + * + * + * cdef fst.RandArcSelection _get_rand_arc_selection( # <<<<<<<<<<<<<< + * const string &select) except *: + * """Matches string with the appropriate RandArcSelection enum value. + */ + +static enum fst::script::RandArcSelection __pyx_f_9pywrapfst__get_rand_arc_selection(std::string const &__pyx_v_select) { + enum fst::script::RandArcSelection __pyx_v_select_enum; + enum fst::script::RandArcSelection __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_get_rand_arc_selection", 0); + + /* "pywrapfst.pyx":298 + * """ + * cdef fst.RandArcSelection select_enum + * if not fst.GetRandArcSelection(select, addr(select_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown random arc selection type: {!r}".format(select)) + * return select_enum + */ + __pyx_t_1 = ((!(fst::script::GetRandArcSelection(__pyx_v_select, (&__pyx_v_select_enum)) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":299 + * cdef fst.RandArcSelection select_enum + * if not fst.GetRandArcSelection(select, addr(select_enum)): + * raise FstArgError("Unknown random arc selection type: {!r}".format(select)) # <<<<<<<<<<<<<< + * return select_enum + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_random_arc_selection_typ, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_select); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 299, __pyx_L1_error) + + /* "pywrapfst.pyx":298 + * """ + * cdef fst.RandArcSelection select_enum + * if not fst.GetRandArcSelection(select, addr(select_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown random arc selection type: {!r}".format(select)) + * return select_enum + */ + } + + /* "pywrapfst.pyx":300 + * if not fst.GetRandArcSelection(select, addr(select_enum)): + * raise FstArgError("Unknown random arc selection type: {!r}".format(select)) + * return select_enum # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_select_enum; + goto __pyx_L0; + + /* "pywrapfst.pyx":278 + * + * + * cdef fst.RandArcSelection _get_rand_arc_selection( # <<<<<<<<<<<<<< + * const string &select) except *: + * """Matches string with the appropriate RandArcSelection enum value. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._get_rand_arc_selection", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = (enum fst::script::RandArcSelection) 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":303 + * + * + * cdef fst.ReplaceLabelType _get_replace_label_type( # <<<<<<<<<<<<<< + * const string &replace_label_type, bool epsilon_on_replace) except *: + * """Matches string with the appropriate ReplaceLabelType enum value. + */ + +static enum fst::ReplaceLabelType __pyx_f_9pywrapfst__get_replace_label_type(std::string const &__pyx_v_replace_label_type, bool __pyx_v_epsilon_on_replace) { + enum fst::ReplaceLabelType __pyx_v_replace_label_type_enum; + enum fst::ReplaceLabelType __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_get_replace_label_type", 0); + + /* "pywrapfst.pyx":324 + * """ + * cdef fst.ReplaceLabelType replace_label_type_enum + * if not fst.GetReplaceLabelType(replace_label_type, epsilon_on_replace, # <<<<<<<<<<<<<< + * addr(replace_label_type_enum)): + * raise FstArgError("Unknown replace label type: {!r}".format( + */ + __pyx_t_1 = ((!(fst::script::GetReplaceLabelType(__pyx_v_replace_label_type, __pyx_v_epsilon_on_replace, (&__pyx_v_replace_label_type_enum)) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":326 + * if not fst.GetReplaceLabelType(replace_label_type, epsilon_on_replace, + * addr(replace_label_type_enum)): + * raise FstArgError("Unknown replace label type: {!r}".format( # <<<<<<<<<<<<<< + * replace_label_type)) + * return replace_label_type_enum + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_replace_label_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "pywrapfst.pyx":327 + * addr(replace_label_type_enum)): + * raise FstArgError("Unknown replace label type: {!r}".format( + * replace_label_type)) # <<<<<<<<<<<<<< + * return replace_label_type_enum + * + */ + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_replace_label_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 326, __pyx_L1_error) + + /* "pywrapfst.pyx":324 + * """ + * cdef fst.ReplaceLabelType replace_label_type_enum + * if not fst.GetReplaceLabelType(replace_label_type, epsilon_on_replace, # <<<<<<<<<<<<<< + * addr(replace_label_type_enum)): + * raise FstArgError("Unknown replace label type: {!r}".format( + */ + } + + /* "pywrapfst.pyx":328 + * raise FstArgError("Unknown replace label type: {!r}".format( + * replace_label_type)) + * return replace_label_type_enum # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_replace_label_type_enum; + goto __pyx_L0; + + /* "pywrapfst.pyx":303 + * + * + * cdef fst.ReplaceLabelType _get_replace_label_type( # <<<<<<<<<<<<<< + * const string &replace_label_type, bool epsilon_on_replace) except *: + * """Matches string with the appropriate ReplaceLabelType enum value. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._get_replace_label_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = (enum fst::ReplaceLabelType) 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":354 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} Weight {} at 0x{:x}>".format(self.type(), self.to_string(), + * id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight___repr__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight___repr__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":355 + * + * def __repr__(self): + * return "<{} Weight {} at 0x{:x}>".format(self.type(), self.to_string(), # <<<<<<<<<<<<<< + * id(self)) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Weight_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "type"); + __PYX_ERR(0, 355, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_self->__pyx_vtab)->type(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "to_string"); + __PYX_ERR(0, 355, __pyx_L1_error) + } + __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_self->__pyx_vtab)->to_string(__pyx_v_self, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "pywrapfst.pyx":356 + * def __repr__(self): + * return "<{} Weight {} at 0x{:x}>".format(self.type(), self.to_string(), + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":354 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} Weight {} at 0x{:x}>".format(self.type(), self.to_string(), + * id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst.Weight.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":358 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return self.to_string() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_3__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_3__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_2__str__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_2__str__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "pywrapfst.pyx":359 + * + * def __str__(self): + * return self.to_string() # <<<<<<<<<<<<<< + * + * # This attempts to convert the string form into a float, raising + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "to_string"); + __PYX_ERR(0, 359, __pyx_L1_error) + } + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_self->__pyx_vtab)->to_string(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":358 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return self.to_string() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":364 + * # ValueError when that is not appropriate. + * + * def __float__(self): # <<<<<<<<<<<<<< + * return float(self.to_string()) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_5__float__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_5__float__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__float__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_4__float__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_4__float__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__float__", 0); + + /* "pywrapfst.pyx":365 + * + * def __float__(self): + * return float(self.to_string()) # <<<<<<<<<<<<<< + * + * def __init__(self, weight_type, weight): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "to_string"); + __PYX_ERR(0, 365, __pyx_L1_error) + } + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_self->__pyx_vtab)->to_string(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":364 + * # ValueError when that is not appropriate. + * + * def __float__(self): # <<<<<<<<<<<<<< + * return float(self.to_string()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst.Weight.__float__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":367 + * return float(self.to_string()) + * + * def __init__(self, weight_type, weight): # <<<<<<<<<<<<<< + * self._weight.reset(new fst.WeightClass(tostring(weight_type), + * weight_tostring(weight))) + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_6Weight_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_6Weight_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_weight_type = 0; + PyObject *__pyx_v_weight = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_weight_type,&__pyx_n_s_weight,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 367, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 367, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_weight_type = values[0]; + __pyx_v_weight = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 367, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.Weight.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_6Weight_6__init__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self), __pyx_v_weight_type, __pyx_v_weight); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_6Weight_6__init__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, PyObject *__pyx_v_weight_type, PyObject *__pyx_v_weight) { + int __pyx_r; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + std::string __pyx_t_2; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":368 + * + * def __init__(self, weight_type, weight): + * self._weight.reset(new fst.WeightClass(tostring(weight_type), # <<<<<<<<<<<<<< + * weight_tostring(weight))) + * self._check_weight() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 368, __pyx_L1_error) + } + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_weight_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L1_error) + + /* "pywrapfst.pyx":369 + * def __init__(self, weight_type, weight): + * self._weight.reset(new fst.WeightClass(tostring(weight_type), + * weight_tostring(weight))) # <<<<<<<<<<<<<< + * self._check_weight() + * + */ + __pyx_t_2 = __pyx_f_9pywrapfst_weight_tostring(__pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L1_error) + + /* "pywrapfst.pyx":368 + * + * def __init__(self, weight_type, weight): + * self._weight.reset(new fst.WeightClass(tostring(weight_type), # <<<<<<<<<<<<<< + * weight_tostring(weight))) + * self._check_weight() + */ + __pyx_v_self->_weight.reset(new fst::script::WeightClass(__pyx_t_1, __pyx_t_2)); + + /* "pywrapfst.pyx":370 + * self._weight.reset(new fst.WeightClass(tostring(weight_type), + * weight_tostring(weight))) + * self._check_weight() # <<<<<<<<<<<<<< + * + * cdef void _check_weight(self) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_weight"); + __PYX_ERR(0, 370, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_self->__pyx_vtab)->_check_weight(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L1_error) + + /* "pywrapfst.pyx":367 + * return float(self.to_string()) + * + * def __init__(self, weight_type, weight): # <<<<<<<<<<<<<< + * self._weight.reset(new fst.WeightClass(tostring(weight_type), + * weight_tostring(weight))) + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.Weight.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":372 + * self._check_weight() + * + * cdef void _check_weight(self) except *: # <<<<<<<<<<<<<< + * if self.type() == b"none": + * raise FstArgError("Weight type not found") + */ + +static void __pyx_f_9pywrapfst_6Weight__check_weight(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_check_weight", 0); + + /* "pywrapfst.pyx":373 + * + * cdef void _check_weight(self) except *: + * if self.type() == b"none": # <<<<<<<<<<<<<< + * raise FstArgError("Weight type not found") + * if not self.member(): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "type"); + __PYX_ERR(0, 373, __pyx_L1_error) + } + __pyx_t_1 = ((((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_self->__pyx_vtab)->type(__pyx_v_self, 0) == ((char const *)"none")) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":374 + * cdef void _check_weight(self) except *: + * if self.type() == b"none": + * raise FstArgError("Weight type not found") # <<<<<<<<<<<<<< + * if not self.member(): + * raise FstBadWeightError("Invalid weight") + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_Weight_type_not_found) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Weight_type_not_found); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 374, __pyx_L1_error) + + /* "pywrapfst.pyx":373 + * + * cdef void _check_weight(self) except *: + * if self.type() == b"none": # <<<<<<<<<<<<<< + * raise FstArgError("Weight type not found") + * if not self.member(): + */ + } + + /* "pywrapfst.pyx":375 + * if self.type() == b"none": + * raise FstArgError("Weight type not found") + * if not self.member(): # <<<<<<<<<<<<<< + * raise FstBadWeightError("Invalid weight") + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "member"); + __PYX_ERR(0, 375, __pyx_L1_error) + } + __pyx_t_1 = ((!(((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_self->__pyx_vtab)->member(__pyx_v_self, 0) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":376 + * raise FstArgError("Weight type not found") + * if not self.member(): + * raise FstBadWeightError("Invalid weight") # <<<<<<<<<<<<<< + * + * cpdef Weight copy(self): + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstBadWeightError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_Invalid_weight) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Invalid_weight); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 376, __pyx_L1_error) + + /* "pywrapfst.pyx":375 + * if self.type() == b"none": + * raise FstArgError("Weight type not found") + * if not self.member(): # <<<<<<<<<<<<<< + * raise FstBadWeightError("Invalid weight") + * + */ + } + + /* "pywrapfst.pyx":372 + * self._check_weight() + * + * cdef void _check_weight(self) except *: # <<<<<<<<<<<<<< + * if self.type() == b"none": + * raise FstArgError("Weight type not found") + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.Weight._check_weight", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":378 + * raise FstBadWeightError("Invalid weight") + * + * cpdef Weight copy(self): # <<<<<<<<<<<<<< + * """ + * copy(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_6Weight_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst_6Weight_copy(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_6Weight_9copy)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst_Weight))))) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":384 + * Returns a copy of the Weight. + * """ + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass(deref(self._weight))) + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":385 + * """ + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(deref(self._weight))) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 385, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 385, __pyx_L1_error) + } + __pyx_v_result->_weight.reset(new fst::script::WeightClass((*__pyx_v_self->_weight))); + + /* "pywrapfst.pyx":386 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(deref(self._weight))) + * return result # <<<<<<<<<<<<<< + * + * # To get around the inability to declare cdef class methods, we define the + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":378 + * raise FstBadWeightError("Invalid weight") + * + * cpdef Weight copy(self): # <<<<<<<<<<<<<< + * """ + * copy(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.Weight.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_6Weight_8copy[] = "\n copy(self)\n\n Returns a copy of the Weight.\n "; +static PyObject *__pyx_pw_9pywrapfst_6Weight_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_8copy(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_8copy(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_6Weight_copy(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":392 + * + * @classmethod + * def Zero(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.Zero(weight_type) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_11Zero(PyObject *__pyx_v_cls, PyObject *__pyx_v_weight_type); /*proto*/ +static char __pyx_doc_9pywrapfst_6Weight_10Zero[] = "\n Weight.Zero(weight_type)\n\n Constructs semiring zero.\n "; +static PyObject *__pyx_pw_9pywrapfst_6Weight_11Zero(PyObject *__pyx_v_cls, PyObject *__pyx_v_weight_type) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("Zero (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_10Zero(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_weight_type)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_10Zero(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_weight_type) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("Zero", 0); + + /* "pywrapfst.pyx":398 + * Constructs semiring zero. + * """ + * return _Zero(weight_type) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__Zero(__pyx_v_weight_type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":392 + * + * @classmethod + * def Zero(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.Zero(weight_type) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.Zero", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":401 + * + * @classmethod + * def One(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.One(weight_type) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_13One(PyObject *__pyx_v_cls, PyObject *__pyx_v_weight_type); /*proto*/ +static char __pyx_doc_9pywrapfst_6Weight_12One[] = "\n Weight.One(weight_type)\n\n Constructs semiring One.\n "; +static PyObject *__pyx_pw_9pywrapfst_6Weight_13One(PyObject *__pyx_v_cls, PyObject *__pyx_v_weight_type) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("One (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_12One(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_weight_type)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_12One(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_weight_type) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("One", 0); + + /* "pywrapfst.pyx":407 + * Constructs semiring One. + * """ + * return _One(weight_type) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__One(__pyx_v_weight_type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":401 + * + * @classmethod + * def One(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.One(weight_type) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.One", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":410 + * + * @classmethod + * def NoWeight(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.NoWeight(weight_type) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_15NoWeight(PyObject *__pyx_v_cls, PyObject *__pyx_v_weight_type); /*proto*/ +static char __pyx_doc_9pywrapfst_6Weight_14NoWeight[] = "\n Weight.NoWeight(weight_type)\n\n Constructs a non-member weight in the semiring.\n "; +static PyObject *__pyx_pw_9pywrapfst_6Weight_15NoWeight(PyObject *__pyx_v_cls, PyObject *__pyx_v_weight_type) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("NoWeight (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_14NoWeight(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_weight_type)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_14NoWeight(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_weight_type) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("NoWeight", 0); + + /* "pywrapfst.pyx":416 + * Constructs a non-member weight in the semiring. + * """ + * return _NoWeight(weight_type) # <<<<<<<<<<<<<< + * + * def __eq__(Weight w1, Weight w2): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__NoWeight(__pyx_v_weight_type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":410 + * + * @classmethod + * def NoWeight(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.NoWeight(weight_type) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.NoWeight", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":418 + * return _NoWeight(weight_type) + * + * def __eq__(Weight w1, Weight w2): # <<<<<<<<<<<<<< + * return fst.Eq(deref(w1._weight), deref(w2._weight)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_17__eq__(PyObject *__pyx_v_w1, PyObject *__pyx_v_w2); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_17__eq__(PyObject *__pyx_v_w1, PyObject *__pyx_v_w2) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w2), __pyx_ptype_9pywrapfst_Weight, 1, "w2", 0))) __PYX_ERR(0, 418, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_6Weight_16__eq__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_w1), ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_w2)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_16__eq__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w1, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w2) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__eq__", 0); + + /* "pywrapfst.pyx":419 + * + * def __eq__(Weight w1, Weight w2): + * return fst.Eq(deref(w1._weight), deref(w2._weight)) # <<<<<<<<<<<<<< + * + * def __ne__(Weight w1, Weight w2): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_w1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 419, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_w2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 419, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyBool_FromLong(operator==((*__pyx_v_w1->_weight), (*__pyx_v_w2->_weight))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":418 + * return _NoWeight(weight_type) + * + * def __eq__(Weight w1, Weight w2): # <<<<<<<<<<<<<< + * return fst.Eq(deref(w1._weight), deref(w2._weight)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":421 + * return fst.Eq(deref(w1._weight), deref(w2._weight)) + * + * def __ne__(Weight w1, Weight w2): # <<<<<<<<<<<<<< + * return not w1 == w2 + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_19__ne__(PyObject *__pyx_v_w1, PyObject *__pyx_v_w2); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_19__ne__(PyObject *__pyx_v_w1, PyObject *__pyx_v_w2) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__ne__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w2), __pyx_ptype_9pywrapfst_Weight, 1, "w2", 0))) __PYX_ERR(0, 421, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_6Weight_18__ne__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_w1), ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_w2)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_18__ne__(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w1, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w2) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__ne__", 0); + + /* "pywrapfst.pyx":422 + * + * def __ne__(Weight w1, Weight w2): + * return not w1 == w2 # <<<<<<<<<<<<<< + * + * cpdef string to_string(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_w1), ((PyObject *)__pyx_v_w2), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":421 + * return fst.Eq(deref(w1._weight), deref(w2._weight)) + * + * def __ne__(Weight w1, Weight w2): # <<<<<<<<<<<<<< + * return not w1 == w2 + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":424 + * return not w1 == w2 + * + * cpdef string to_string(self): # <<<<<<<<<<<<<< + * return self._weight.get().ToString() + * + */ + +static PyObject *__pyx_pw_9pywrapfst_6Weight_21to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_6Weight_to_string(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("to_string", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_6Weight_21to_string)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":425 + * + * cpdef string to_string(self): + * return self._weight.get().ToString() # <<<<<<<<<<<<<< + * + * cpdef string type(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 425, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_weight.get()->ToString(); + goto __pyx_L0; + + /* "pywrapfst.pyx":424 + * return not w1 == w2 + * + * cpdef string to_string(self): # <<<<<<<<<<<<<< + * return self._weight.get().ToString() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.Weight.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_21to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_21to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_string (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_20to_string(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_20to_string(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("to_string", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_6Weight_to_string(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":427 + * return self._weight.get().ToString() + * + * cpdef string type(self): # <<<<<<<<<<<<<< + * """type(self) + * + */ + +static PyObject *__pyx_pw_9pywrapfst_6Weight_23type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_6Weight_type(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_6Weight_23type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":432 + * Returns a string indicating the weight type. + * """ + * return self._weight.get().Type() # <<<<<<<<<<<<<< + * + * cpdef bool member(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 432, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_weight.get()->Type(); + goto __pyx_L0; + + /* "pywrapfst.pyx":427 + * return self._weight.get().ToString() + * + * cpdef string type(self): # <<<<<<<<<<<<<< + * """type(self) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.Weight.type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_23type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_6Weight_22type[] = "type(self)\n\n Returns a string indicating the weight type.\n "; +static PyObject *__pyx_pw_9pywrapfst_6Weight_23type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_22type(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_22type(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_6Weight_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":434 + * return self._weight.get().Type() + * + * cpdef bool member(self): # <<<<<<<<<<<<<< + * return self._weight.get().Member() + * + */ + +static PyObject *__pyx_pw_9pywrapfst_6Weight_25member(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_6Weight_member(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("member", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_member); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_6Weight_25member)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":435 + * + * cpdef bool member(self): + * return self._weight.get().Member() # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 435, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_weight.get()->Member(); + goto __pyx_L0; + + /* "pywrapfst.pyx":434 + * return self._weight.get().Type() + * + * cpdef bool member(self): # <<<<<<<<<<<<<< + * return self._weight.get().Member() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.Weight.member", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_25member(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_25member(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("member (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_24member(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_24member(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("member", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_6Weight_member(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.member", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_26__reduce_cython__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_6Weight_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_6Weight_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_6Weight_28__setstate_cython__(((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6Weight_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Weight *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Weight.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":438 + * + * + * cdef Weight _plus(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), + */ + +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__plus(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_plus", 0); + + /* "pywrapfst.pyx":439 + * + * cdef Weight _plus(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), + * deref(rhs._weight)))) + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":440 + * cdef Weight _plus(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), # <<<<<<<<<<<<<< + * deref(rhs._weight)))) + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 440, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_lhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 440, __pyx_L1_error) + } + + /* "pywrapfst.pyx":441 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), + * deref(rhs._weight)))) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_rhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 441, __pyx_L1_error) + } + + /* "pywrapfst.pyx":440 + * cdef Weight _plus(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), # <<<<<<<<<<<<<< + * deref(rhs._weight)))) + * return result + */ + __pyx_v_result->_weight.reset(new fst::script::WeightClass(fst::script::Plus((*__pyx_v_lhs->_weight), (*__pyx_v_rhs->_weight)))); + + /* "pywrapfst.pyx":442 + * result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), + * deref(rhs._weight)))) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":438 + * + * + * cdef Weight _plus(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._plus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":445 + * + * + * def plus(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * plus(lhs, rhs) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_1plus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_plus[] = "\n plus(lhs, rhs)\n\n Computes the sum of two Weights in the same semiring.\n\n This function computes lhs \\oplus rhs, raising an exception if lhs and rhs\n are not in the same semiring.\n\n Args:\n lhs: Left-hand side Weight.\n rhs: Right-hand side Weight.\n\n Returns:\n A Weight object.\n\n Raises:\n FstArgError: Weight type not found (or not in same semiring).\n FstBadWeightError: invalid weight.\n "; +static PyMethodDef __pyx_mdef_9pywrapfst_1plus = {"plus", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_1plus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_plus}; +static PyObject *__pyx_pw_9pywrapfst_1plus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("plus (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_rhs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plus", 1, 2, 2, 1); __PYX_ERR(0, 445, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plus") < 0)) __PYX_ERR(0, 445, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_lhs = ((struct __pyx_obj_9pywrapfst_Weight *)values[0]); + __pyx_v_rhs = ((struct __pyx_obj_9pywrapfst_Weight *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("plus", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 445, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.plus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_9pywrapfst_Weight, 1, "lhs", 0))) __PYX_ERR(0, 445, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_9pywrapfst_Weight, 1, "rhs", 0))) __PYX_ERR(0, 445, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_plus(__pyx_self, __pyx_v_lhs, __pyx_v_rhs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_plus(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("plus", 0); + + /* "pywrapfst.pyx":465 + * FstBadWeightError: invalid weight. + * """ + * cdef Weight result = _plus(lhs, rhs) # <<<<<<<<<<<<<< + * result._check_weight() + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__plus(__pyx_v_lhs, __pyx_v_rhs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":466 + * """ + * cdef Weight result = _plus(lhs, rhs) + * result._check_weight() # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_weight"); + __PYX_ERR(0, 466, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_result->__pyx_vtab)->_check_weight(__pyx_v_result); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) + + /* "pywrapfst.pyx":467 + * cdef Weight result = _plus(lhs, rhs) + * result._check_weight() + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "pywrapfst.pyx":445 + * + * + * def plus(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * plus(lhs, rhs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.plus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":470 + * + * + * cdef Weight _times(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), + */ + +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__times(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_times", 0); + + /* "pywrapfst.pyx":471 + * + * cdef Weight _times(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), + * deref(rhs._weight)))) + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":472 + * cdef Weight _times(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), # <<<<<<<<<<<<<< + * deref(rhs._weight)))) + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 472, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_lhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 472, __pyx_L1_error) + } + + /* "pywrapfst.pyx":473 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), + * deref(rhs._weight)))) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_rhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 473, __pyx_L1_error) + } + + /* "pywrapfst.pyx":472 + * cdef Weight _times(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), # <<<<<<<<<<<<<< + * deref(rhs._weight)))) + * return result + */ + __pyx_v_result->_weight.reset(new fst::script::WeightClass(fst::script::Times((*__pyx_v_lhs->_weight), (*__pyx_v_rhs->_weight)))); + + /* "pywrapfst.pyx":474 + * result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), + * deref(rhs._weight)))) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":470 + * + * + * cdef Weight _times(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._times", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":477 + * + * + * def times(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * times(lhs, rhs) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3times(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_2times[] = "\n times(lhs, rhs)\n\n Computes the product of two Weights in the same semiring.\n\n This function computes lhs \\otimes rhs, raising an exception if lhs and rhs\n are not in the same semiring.\n\n Args:\n lhs: Left-hand side Weight.\n rhs: Right-hand side Weight.\n\n Returns:\n A Weight object.\n\n Raises:\n FstArgError: Weight type not found (or not in same semiring).\n FstBadWeightError: Invalid weight.\n "; +static PyMethodDef __pyx_mdef_9pywrapfst_3times = {"times", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_3times, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_2times}; +static PyObject *__pyx_pw_9pywrapfst_3times(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("times (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_rhs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("times", 1, 2, 2, 1); __PYX_ERR(0, 477, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "times") < 0)) __PYX_ERR(0, 477, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_lhs = ((struct __pyx_obj_9pywrapfst_Weight *)values[0]); + __pyx_v_rhs = ((struct __pyx_obj_9pywrapfst_Weight *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("times", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 477, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.times", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_9pywrapfst_Weight, 1, "lhs", 0))) __PYX_ERR(0, 477, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_9pywrapfst_Weight, 1, "rhs", 0))) __PYX_ERR(0, 477, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_2times(__pyx_self, __pyx_v_lhs, __pyx_v_rhs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_2times(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("times", 0); + + /* "pywrapfst.pyx":497 + * FstBadWeightError: Invalid weight. + * """ + * cdef Weight result = _times(lhs, rhs) # <<<<<<<<<<<<<< + * result._check_weight() + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__times(__pyx_v_lhs, __pyx_v_rhs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":498 + * """ + * cdef Weight result = _times(lhs, rhs) + * result._check_weight() # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_weight"); + __PYX_ERR(0, 498, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_result->__pyx_vtab)->_check_weight(__pyx_v_result); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 498, __pyx_L1_error) + + /* "pywrapfst.pyx":499 + * cdef Weight result = _times(lhs, rhs) + * result._check_weight() + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "pywrapfst.pyx":477 + * + * + * def times(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * times(lhs, rhs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.times", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":502 + * + * + * cdef Weight _divide(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), + */ + +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__divide(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_divide", 0); + + /* "pywrapfst.pyx":503 + * + * cdef Weight _divide(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), + * deref(rhs._weight)))) + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":504 + * cdef Weight _divide(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), # <<<<<<<<<<<<<< + * deref(rhs._weight)))) + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 504, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_lhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 504, __pyx_L1_error) + } + + /* "pywrapfst.pyx":505 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), + * deref(rhs._weight)))) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_rhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 505, __pyx_L1_error) + } + + /* "pywrapfst.pyx":504 + * cdef Weight _divide(Weight lhs, Weight rhs): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), # <<<<<<<<<<<<<< + * deref(rhs._weight)))) + * return result + */ + __pyx_v_result->_weight.reset(new fst::script::WeightClass(fst::script::Divide((*__pyx_v_lhs->_weight), (*__pyx_v_rhs->_weight)))); + + /* "pywrapfst.pyx":506 + * result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), + * deref(rhs._weight)))) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":502 + * + * + * cdef Weight _divide(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._divide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":509 + * + * + * def divide(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * divide(lhs, rhs) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_5divide(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_4divide[] = "\n divide(lhs, rhs)\n\n Computes the quotient of two Weights in the same semiring.\n\n This function computes lhs \\oslash rhs, raising an exception if lhs and rhs\n are not in the same semiring. As there is no way to specify whether to use\n left vs. right division, this assumes a commutative semiring in which these\n are equivalent operations.\n\n Args:\n lhs: Left-hand side Weight.\n rhs: Right-hand side Weight.\n\n Returns:\n A Weight object.\n\n Raises:\n FstArgError: Weight type not found (or not in same semiring).\n FstBadWeightError: Invalid weight.\n "; +static PyMethodDef __pyx_mdef_9pywrapfst_5divide = {"divide", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_5divide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_4divide}; +static PyObject *__pyx_pw_9pywrapfst_5divide(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("divide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_rhs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("divide", 1, 2, 2, 1); __PYX_ERR(0, 509, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divide") < 0)) __PYX_ERR(0, 509, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_lhs = ((struct __pyx_obj_9pywrapfst_Weight *)values[0]); + __pyx_v_rhs = ((struct __pyx_obj_9pywrapfst_Weight *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("divide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 509, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.divide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_9pywrapfst_Weight, 1, "lhs", 0))) __PYX_ERR(0, 509, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_9pywrapfst_Weight, 1, "rhs", 0))) __PYX_ERR(0, 509, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_4divide(__pyx_self, __pyx_v_lhs, __pyx_v_rhs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4divide(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_lhs, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_rhs) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("divide", 0); + + /* "pywrapfst.pyx":531 + * FstBadWeightError: Invalid weight. + * """ + * cdef Weight result = _divide(lhs, rhs) # <<<<<<<<<<<<<< + * result._check_weight() + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__divide(__pyx_v_lhs, __pyx_v_rhs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":532 + * """ + * cdef Weight result = _divide(lhs, rhs) + * result._check_weight() # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_weight"); + __PYX_ERR(0, 532, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_result->__pyx_vtab)->_check_weight(__pyx_v_result); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L1_error) + + /* "pywrapfst.pyx":533 + * cdef Weight result = _divide(lhs, rhs) + * result._check_weight() + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "pywrapfst.pyx":509 + * + * + * def divide(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * divide(lhs, rhs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.divide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":536 + * + * + * cdef Weight _power(Weight w, size_t n): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Power(deref(w._weight), n))) + */ + +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__power(struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w, size_t __pyx_v_n) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_power", 0); + + /* "pywrapfst.pyx":537 + * + * cdef Weight _power(Weight w, size_t n): + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass(fst.Power(deref(w._weight), n))) + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":538 + * cdef Weight _power(Weight w, size_t n): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Power(deref(w._weight), n))) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 538, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_w) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 538, __pyx_L1_error) + } + __pyx_v_result->_weight.reset(new fst::script::WeightClass(fst::script::Power((*__pyx_v_w->_weight), __pyx_v_n))); + + /* "pywrapfst.pyx":539 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Power(deref(w._weight), n))) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":536 + * + * + * cdef Weight _power(Weight w, size_t n): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.Power(deref(w._weight), n))) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._power", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":542 + * + * + * def power(Weight w, size_t n): # <<<<<<<<<<<<<< + * """ + * power(lhs, rhs) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_7power(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_6power[] = "\n power(lhs, rhs)\n\n Computes the iterated product of a weight.\n\n Args:\n w: The weight.\n n: The power.\n\n Returns:\n A Weight object.\n\n Raises:\n FstArgError: Weight type not found (or not in same semiring).\n FstBadWeightError: Invalid weight.\n "; +static PyMethodDef __pyx_mdef_9pywrapfst_7power = {"power", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_7power, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_6power}; +static PyObject *__pyx_pw_9pywrapfst_7power(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w = 0; + size_t __pyx_v_n; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("power (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_n,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("power", 1, 2, 2, 1); __PYX_ERR(0, 542, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "power") < 0)) __PYX_ERR(0, 542, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_w = ((struct __pyx_obj_9pywrapfst_Weight *)values[0]); + __pyx_v_n = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_n == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("power", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 542, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.power", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_9pywrapfst_Weight, 1, "w", 0))) __PYX_ERR(0, 542, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_6power(__pyx_self, __pyx_v_w, __pyx_v_n); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_6power(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst_Weight *__pyx_v_w, size_t __pyx_v_n) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("power", 0); + + /* "pywrapfst.pyx":559 + * FstBadWeightError: Invalid weight. + * """ + * cdef Weight result = _power(w, n) # <<<<<<<<<<<<<< + * result._check_weight() + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__power(__pyx_v_w, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":560 + * """ + * cdef Weight result = _power(w, n) + * result._check_weight() # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_weight"); + __PYX_ERR(0, 560, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_result->__pyx_vtab)->_check_weight(__pyx_v_result); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L1_error) + + /* "pywrapfst.pyx":561 + * cdef Weight result = _power(w, n) + * result._check_weight() + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "pywrapfst.pyx":542 + * + * + * def power(Weight w, size_t n): # <<<<<<<<<<<<<< + * """ + * power(lhs, rhs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.power", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":564 + * + * + * cdef fst.WeightClass _get_WeightClass_or_Zero(const string &weight_type, # <<<<<<<<<<<<<< + * weight) except *: + * """Converts weight string to a WeightClass. + */ + +static fst::script::WeightClass __pyx_f_9pywrapfst__get_WeightClass_or_Zero(std::string const &__pyx_v_weight_type, PyObject *__pyx_v_weight) { + fst::script::WeightClass __pyx_v_result; + fst::script::WeightClass __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + std::string __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_get_WeightClass_or_Zero", 0); + + /* "pywrapfst.pyx":582 + * """ + * cdef fst.WeightClass result + * if weight is None: # <<<<<<<<<<<<<< + * result = fst.WeightClass.Zero(weight_type) + * elif isinstance(weight, Weight): + */ + __pyx_t_1 = (__pyx_v_weight == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":583 + * cdef fst.WeightClass result + * if weight is None: + * result = fst.WeightClass.Zero(weight_type) # <<<<<<<<<<<<<< + * elif isinstance(weight, Weight): + * result = deref( ( weight)._weight.get()) + */ + __pyx_v_result = fst::script::WeightClass::Zero(__pyx_v_weight_type); + + /* "pywrapfst.pyx":582 + * """ + * cdef fst.WeightClass result + * if weight is None: # <<<<<<<<<<<<<< + * result = fst.WeightClass.Zero(weight_type) + * elif isinstance(weight, Weight): + */ + goto __pyx_L3; + } + + /* "pywrapfst.pyx":584 + * if weight is None: + * result = fst.WeightClass.Zero(weight_type) + * elif isinstance(weight, Weight): # <<<<<<<<<<<<<< + * result = deref( ( weight)._weight.get()) + * else: + */ + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weight, __pyx_ptype_9pywrapfst_Weight); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":585 + * result = fst.WeightClass.Zero(weight_type) + * elif isinstance(weight, Weight): + * result = deref( ( weight)._weight.get()) # <<<<<<<<<<<<<< + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + */ + if (unlikely(__pyx_v_weight == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 585, __pyx_L1_error) + } + __pyx_v_result = (*((fst::script::WeightClass *)((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_weight)->_weight.get())); + + /* "pywrapfst.pyx":584 + * if weight is None: + * result = fst.WeightClass.Zero(weight_type) + * elif isinstance(weight, Weight): # <<<<<<<<<<<<<< + * result = deref( ( weight)._weight.get()) + * else: + */ + goto __pyx_L3; + } + + /* "pywrapfst.pyx":587 + * result = deref( ( weight)._weight.get()) + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) # <<<<<<<<<<<<<< + * if not result.Member(): + * raise FstBadWeightError(weight_tostring(weight)) + */ + /*else*/ { + __pyx_t_3 = __pyx_f_9pywrapfst_weight_tostring(__pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L1_error) + __pyx_v_result = fst::script::WeightClass(__pyx_v_weight_type, __pyx_t_3); + + /* "pywrapfst.pyx":588 + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + * if not result.Member(): # <<<<<<<<<<<<<< + * raise FstBadWeightError(weight_tostring(weight)) + * return result + */ + __pyx_t_1 = ((!(__pyx_v_result.Member() != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":589 + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + * if not result.Member(): + * raise FstBadWeightError(weight_tostring(weight)) # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FstBadWeightError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __pyx_f_9pywrapfst_weight_tostring(__pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 589, __pyx_L1_error) + + /* "pywrapfst.pyx":588 + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + * if not result.Member(): # <<<<<<<<<<<<<< + * raise FstBadWeightError(weight_tostring(weight)) + * return result + */ + } + } + __pyx_L3:; + + /* "pywrapfst.pyx":590 + * if not result.Member(): + * raise FstBadWeightError(weight_tostring(weight)) + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":564 + * + * + * cdef fst.WeightClass _get_WeightClass_or_Zero(const string &weight_type, # <<<<<<<<<<<<<< + * weight) except *: + * """Converts weight string to a WeightClass. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._get_WeightClass_or_Zero", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":593 + * + * + * cdef fst.WeightClass _get_WeightClass_or_One(const string &weight_type, # <<<<<<<<<<<<<< + * weight) except *: + * """Converts weight string to a WeightClass. + */ + +static fst::script::WeightClass __pyx_f_9pywrapfst__get_WeightClass_or_One(std::string const &__pyx_v_weight_type, PyObject *__pyx_v_weight) { + fst::script::WeightClass __pyx_v_result; + fst::script::WeightClass __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + std::string __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_get_WeightClass_or_One", 0); + + /* "pywrapfst.pyx":611 + * """ + * cdef fst.WeightClass result + * if weight is None: # <<<<<<<<<<<<<< + * result = fst.WeightClass.One(weight_type) + * elif isinstance(weight, Weight): + */ + __pyx_t_1 = (__pyx_v_weight == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":612 + * cdef fst.WeightClass result + * if weight is None: + * result = fst.WeightClass.One(weight_type) # <<<<<<<<<<<<<< + * elif isinstance(weight, Weight): + * result = deref( ( weight)._weight.get()) + */ + __pyx_v_result = fst::script::WeightClass::One(__pyx_v_weight_type); + + /* "pywrapfst.pyx":611 + * """ + * cdef fst.WeightClass result + * if weight is None: # <<<<<<<<<<<<<< + * result = fst.WeightClass.One(weight_type) + * elif isinstance(weight, Weight): + */ + goto __pyx_L3; + } + + /* "pywrapfst.pyx":613 + * if weight is None: + * result = fst.WeightClass.One(weight_type) + * elif isinstance(weight, Weight): # <<<<<<<<<<<<<< + * result = deref( ( weight)._weight.get()) + * else: + */ + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weight, __pyx_ptype_9pywrapfst_Weight); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":614 + * result = fst.WeightClass.One(weight_type) + * elif isinstance(weight, Weight): + * result = deref( ( weight)._weight.get()) # <<<<<<<<<<<<<< + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + */ + if (unlikely(__pyx_v_weight == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 614, __pyx_L1_error) + } + __pyx_v_result = (*((fst::script::WeightClass *)((struct __pyx_obj_9pywrapfst_Weight *)__pyx_v_weight)->_weight.get())); + + /* "pywrapfst.pyx":613 + * if weight is None: + * result = fst.WeightClass.One(weight_type) + * elif isinstance(weight, Weight): # <<<<<<<<<<<<<< + * result = deref( ( weight)._weight.get()) + * else: + */ + goto __pyx_L3; + } + + /* "pywrapfst.pyx":616 + * result = deref( ( weight)._weight.get()) + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) # <<<<<<<<<<<<<< + * if not result.Member(): + * raise FstBadWeightError(weight_tostring(weight)) + */ + /*else*/ { + __pyx_t_3 = __pyx_f_9pywrapfst_weight_tostring(__pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 616, __pyx_L1_error) + __pyx_v_result = fst::script::WeightClass(__pyx_v_weight_type, __pyx_t_3); + + /* "pywrapfst.pyx":617 + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + * if not result.Member(): # <<<<<<<<<<<<<< + * raise FstBadWeightError(weight_tostring(weight)) + * return result + */ + __pyx_t_1 = ((!(__pyx_v_result.Member() != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":618 + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + * if not result.Member(): + * raise FstBadWeightError(weight_tostring(weight)) # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FstBadWeightError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __pyx_f_9pywrapfst_weight_tostring(__pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 618, __pyx_L1_error) + + /* "pywrapfst.pyx":617 + * else: + * result = fst.WeightClass(weight_type, weight_tostring(weight)) + * if not result.Member(): # <<<<<<<<<<<<<< + * raise FstBadWeightError(weight_tostring(weight)) + * return result + */ + } + } + __pyx_L3:; + + /* "pywrapfst.pyx":619 + * if not result.Member(): + * raise FstBadWeightError(weight_tostring(weight)) + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":593 + * + * + * cdef fst.WeightClass _get_WeightClass_or_One(const string &weight_type, # <<<<<<<<<<<<<< + * weight) except *: + * """Converts weight string to a WeightClass. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._get_WeightClass_or_One", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":622 + * + * + * cdef Weight _Zero(weight_type): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( + */ + +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__Zero(PyObject *__pyx_v_weight_type) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::string __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("_Zero", 0); + + /* "pywrapfst.pyx":623 + * + * cdef Weight _Zero(weight_type): + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( + * tostring(weight_type)))) + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":624 + * cdef Weight _Zero(weight_type): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( # <<<<<<<<<<<<<< + * tostring(weight_type)))) + * if result._weight.get().Type() == b"none": + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 624, __pyx_L1_error) + } + + /* "pywrapfst.pyx":625 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( + * tostring(weight_type)))) # <<<<<<<<<<<<<< + * if result._weight.get().Type() == b"none": + * raise FstArgError("Weight type not found") + */ + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_v_weight_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 625, __pyx_L1_error) + + /* "pywrapfst.pyx":624 + * cdef Weight _Zero(weight_type): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( # <<<<<<<<<<<<<< + * tostring(weight_type)))) + * if result._weight.get().Type() == b"none": + */ + __pyx_v_result->_weight.reset(new fst::script::WeightClass(fst::script::WeightClass::Zero(__pyx_t_2))); + + /* "pywrapfst.pyx":626 + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( + * tostring(weight_type)))) + * if result._weight.get().Type() == b"none": # <<<<<<<<<<<<<< + * raise FstArgError("Weight type not found") + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 626, __pyx_L1_error) + } + __pyx_t_3 = ((__pyx_v_result->_weight.get()->Type() == ((char const *)"none")) != 0); + if (unlikely(__pyx_t_3)) { + + /* "pywrapfst.pyx":627 + * tostring(weight_type)))) + * if result._weight.get().Type() == b"none": + * raise FstArgError("Weight type not found") # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_Weight_type_not_found) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Weight_type_not_found); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 627, __pyx_L1_error) + + /* "pywrapfst.pyx":626 + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( + * tostring(weight_type)))) + * if result._weight.get().Type() == b"none": # <<<<<<<<<<<<<< + * raise FstArgError("Weight type not found") + * return result + */ + } + + /* "pywrapfst.pyx":628 + * if result._weight.get().Type() == b"none": + * raise FstArgError("Weight type not found") + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":622 + * + * + * cdef Weight _Zero(weight_type): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._Zero", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":631 + * + * + * cdef Weight _One(weight_type): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( + */ + +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__One(PyObject *__pyx_v_weight_type) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::string __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("_One", 0); + + /* "pywrapfst.pyx":632 + * + * cdef Weight _One(weight_type): + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass( + * fst.WeightClass.One(tostring(weight_type)))) + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":633 + * cdef Weight _One(weight_type): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( # <<<<<<<<<<<<<< + * fst.WeightClass.One(tostring(weight_type)))) + * if result._weight.get().Type() == b"none": + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 633, __pyx_L1_error) + } + + /* "pywrapfst.pyx":634 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( + * fst.WeightClass.One(tostring(weight_type)))) # <<<<<<<<<<<<<< + * if result._weight.get().Type() == b"none": + * raise FstArgError("Weight type not found") + */ + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_v_weight_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 634, __pyx_L1_error) + + /* "pywrapfst.pyx":633 + * cdef Weight _One(weight_type): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( # <<<<<<<<<<<<<< + * fst.WeightClass.One(tostring(weight_type)))) + * if result._weight.get().Type() == b"none": + */ + __pyx_v_result->_weight.reset(new fst::script::WeightClass(fst::script::WeightClass::One(__pyx_t_2))); + + /* "pywrapfst.pyx":635 + * result._weight.reset(new fst.WeightClass( + * fst.WeightClass.One(tostring(weight_type)))) + * if result._weight.get().Type() == b"none": # <<<<<<<<<<<<<< + * raise FstArgError("Weight type not found") + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 635, __pyx_L1_error) + } + __pyx_t_3 = ((__pyx_v_result->_weight.get()->Type() == ((char const *)"none")) != 0); + if (unlikely(__pyx_t_3)) { + + /* "pywrapfst.pyx":636 + * fst.WeightClass.One(tostring(weight_type)))) + * if result._weight.get().Type() == b"none": + * raise FstArgError("Weight type not found") # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_Weight_type_not_found) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Weight_type_not_found); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 636, __pyx_L1_error) + + /* "pywrapfst.pyx":635 + * result._weight.reset(new fst.WeightClass( + * fst.WeightClass.One(tostring(weight_type)))) + * if result._weight.get().Type() == b"none": # <<<<<<<<<<<<<< + * raise FstArgError("Weight type not found") + * return result + */ + } + + /* "pywrapfst.pyx":637 + * if result._weight.get().Type() == b"none": + * raise FstArgError("Weight type not found") + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":631 + * + * + * cdef Weight _One(weight_type): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._One", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":640 + * + * + * cdef Weight _NoWeight(weight_type): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( + */ + +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst__NoWeight(PyObject *__pyx_v_weight_type) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::string __pyx_t_2; + __Pyx_RefNannySetupContext("_NoWeight", 0); + + /* "pywrapfst.pyx":641 + * + * cdef Weight _NoWeight(weight_type): + * cdef Weight result = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * result._weight.reset(new fst.WeightClass( + * fst.WeightClass.NoWeight(tostring(weight_type)))) + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":642 + * cdef Weight _NoWeight(weight_type): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( # <<<<<<<<<<<<<< + * fst.WeightClass.NoWeight(tostring(weight_type)))) + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 642, __pyx_L1_error) + } + + /* "pywrapfst.pyx":643 + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( + * fst.WeightClass.NoWeight(tostring(weight_type)))) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_v_weight_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 643, __pyx_L1_error) + + /* "pywrapfst.pyx":642 + * cdef Weight _NoWeight(weight_type): + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( # <<<<<<<<<<<<<< + * fst.WeightClass.NoWeight(tostring(weight_type)))) + * return result + */ + __pyx_v_result->_weight.reset(new fst::script::WeightClass(fst::script::WeightClass::NoWeight(__pyx_t_2))); + + /* "pywrapfst.pyx":644 + * result._weight.reset(new fst.WeightClass( + * fst.WeightClass.NoWeight(tostring(weight_type)))) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":640 + * + * + * cdef Weight _NoWeight(weight_type): # <<<<<<<<<<<<<< + * cdef Weight result = Weight.__new__(Weight) + * result._weight.reset(new fst.WeightClass( + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._NoWeight", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":678 + * # Doing so will allow undefined behavior. + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_12_SymbolTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_12_SymbolTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable___init__(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_12_SymbolTable___init__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":679 + * + * def __init__(self): + * raise FstDeletedConstructorError( # <<<<<<<<<<<<<< + * "Cannot construct {}".format(self.__class__.__name__)) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstDeletedConstructorError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":680 + * def __init__(self): + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Cannot_construct, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 679, __pyx_L1_error) + + /* "pywrapfst.pyx":678 + * # Doing so will allow undefined behavior. + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pywrapfst._SymbolTable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":682 + * "Cannot construct {}".format(self.__class__.__name__)) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return SymbolTableIterator(self) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_3__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_3__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_2__iter__(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_2__iter__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "pywrapfst.pyx":683 + * + * def __iter__(self): + * return SymbolTableIterator(self) # <<<<<<<<<<<<<< + * + * # Registers the class for pickling. + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_9pywrapfst_SymbolTableIterator), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":682 + * "Cannot construct {}".format(self.__class__.__name__)) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return SymbolTableIterator(self) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":687 + * # Registers the class for pickling. + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (_read_SymbolTable_from_string, (self.write_to_string(),)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_4__reduce__(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_4__reduce__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "pywrapfst.pyx":688 + * + * def __reduce__(self): + * return (_read_SymbolTable_from_string, (self.write_to_string(),)) # <<<<<<<<<<<<<< + * + * cpdef int64 available_key(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_read_SymbolTable_from_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "write_to_string"); + __PYX_ERR(0, 688, __pyx_L1_error) + } + __pyx_t_2 = ((struct __pyx_vtabstruct_9pywrapfst__SymbolTable *)__pyx_v_self->__pyx_vtab)->write_to_string(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":687 + * # Registers the class for pickling. + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (_read_SymbolTable_from_string, (self.write_to_string(),)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst._SymbolTable.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":690 + * return (_read_SymbolTable_from_string, (self.write_to_string(),)) + * + * cpdef int64 available_key(self): # <<<<<<<<<<<<<< + * """ + * available_key(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_7available_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_12_SymbolTable_available_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_5; + __Pyx_RefNannySetupContext("available_key", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_available_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_7available_key)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":696 + * Returns an integer indicating the next available key index in the table. + * """ + * return self._table.AvailableKey() # <<<<<<<<<<<<<< + * + * cpdef bytes checksum(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 696, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_table->AvailableKey(); + goto __pyx_L0; + + /* "pywrapfst.pyx":690 + * return (_read_SymbolTable_from_string, (self.write_to_string(),)) + * + * cpdef int64 available_key(self): # <<<<<<<<<<<<<< + * """ + * available_key(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._SymbolTable.available_key", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_7available_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_6available_key[] = "\n available_key(self)\n\n Returns an integer indicating the next available key index in the table.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_7available_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("available_key (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_6available_key(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_6available_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("available_key", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_f_9pywrapfst_12_SymbolTable_available_key(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.available_key", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":698 + * return self._table.AvailableKey() + * + * cpdef bytes checksum(self): # <<<<<<<<<<<<<< + * """ + * checksum(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_9checksum(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_9pywrapfst_12_SymbolTable_checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("checksum", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_9checksum)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 698, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":704 + * Returns a bytestring indicating the label-independent MD5 checksum. + * """ + * return self._table.CheckSum() # <<<<<<<<<<<<<< + * + * cpdef SymbolTable copy(self): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 704, __pyx_L1_error) + } + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->_table->CheckSum()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":698 + * return self._table.AvailableKey() + * + * cpdef bytes checksum(self): # <<<<<<<<<<<<<< + * """ + * checksum(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._SymbolTable.checksum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_9checksum(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_8checksum[] = "\n checksum(self)\n\n Returns a bytestring indicating the label-independent MD5 checksum.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_9checksum(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("checksum (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_8checksum(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_8checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("checksum", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_12_SymbolTable_checksum(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.checksum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":706 + * return self._table.CheckSum() + * + * cpdef SymbolTable copy(self): # <<<<<<<<<<<<<< + * """ + * copy(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_11copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst_12_SymbolTable_copy(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_11copy)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst_SymbolTable))))) __PYX_ERR(0, 706, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":712 + * Returns a mutable copy of the SymbolTable. + * """ + * return _init_SymbolTable(self._table.Copy()) # <<<<<<<<<<<<<< + * + * def find(self, key): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 712, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_SymbolTable(__pyx_v_self->_table->Copy())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":706 + * return self._table.CheckSum() + * + * cpdef SymbolTable copy(self): # <<<<<<<<<<<<<< + * """ + * copy(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._SymbolTable.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_11copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_10copy[] = "\n copy(self)\n\n Returns a mutable copy of the SymbolTable.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_11copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_10copy(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_10copy(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_12_SymbolTable_copy(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":714 + * return _init_SymbolTable(self._table.Copy()) + * + * def find(self, key): # <<<<<<<<<<<<<< + * """ + * find(self, key) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_13find(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_12find[] = "\n find(self, key)\n\n Given a symbol or index, finds the other one.\n\n This method returns the index associated with a symbol key, or the symbol\n associated with a index key.\n\n Args:\n key: Either a string or an index.\n\n Returns:\n If the key is a string, the associated index or NO_LABEL if not found; if\n the key is an integer, the associated symbol or an empty string if\n not found.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_13find(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_12find(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_12find(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + std::string __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __pyx_t_10basictypes_int64 __pyx_t_10; + __Pyx_RefNannySetupContext("find", 0); + + /* "pywrapfst.pyx":731 + * not found. + * """ + * try: # <<<<<<<<<<<<<< + * return self._table.FindIndex(tostring(key)) + * except FstArgError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "pywrapfst.pyx":732 + * """ + * try: + * return self._table.FindIndex(tostring(key)) # <<<<<<<<<<<<<< + * except FstArgError: + * return self._table.FindSymbol(key) + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 732, __pyx_L3_error) + } + __pyx_t_4 = __pyx_f_9pywrapfst_tostring(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L3_error) + __pyx_t_5 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_table->Find(__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 732, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L7_try_return; + + /* "pywrapfst.pyx":731 + * not found. + * """ + * try: # <<<<<<<<<<<<<< + * return self._table.FindIndex(tostring(key)) + * except FstArgError: + */ + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pywrapfst.pyx":733 + * try: + * return self._table.FindIndex(tostring(key)) + * except FstArgError: # <<<<<<<<<<<<<< + * return self._table.FindSymbol(key) + * + */ + __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 733, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; + if (__pyx_t_9) { + __Pyx_AddTraceback("pywrapfst._SymbolTable.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 733, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_5); + + /* "pywrapfst.pyx":734 + * return self._table.FindIndex(tostring(key)) + * except FstArgError: + * return self._table.FindSymbol(key) # <<<<<<<<<<<<<< + * + * cpdef int64 get_nth_key(self, ssize_t pos) except *: + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 734, __pyx_L5_except_error) + } + __pyx_t_10 = __Pyx_PyInt_As_int64_t(__pyx_v_key); if (unlikely((__pyx_t_10 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 734, __pyx_L5_except_error) + __pyx_t_8 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_table->Find(__pyx_t_10)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 734, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_except_return; + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; + + /* "pywrapfst.pyx":731 + * not found. + * """ + * try: # <<<<<<<<<<<<<< + * return self._table.FindIndex(tostring(key)) + * except FstArgError: + */ + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L7_try_return:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L0; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L0; + } + + /* "pywrapfst.pyx":714 + * return _init_SymbolTable(self._table.Copy()) + * + * def find(self, key): # <<<<<<<<<<<<<< + * """ + * find(self, key) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst._SymbolTable.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":736 + * return self._table.FindSymbol(key) + * + * cpdef int64 get_nth_key(self, ssize_t pos) except *: # <<<<<<<<<<<<<< + * """ + * get_nth_key(self, pos) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_15get_nth_key(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_12_SymbolTable_get_nth_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, Py_ssize_t __pyx_v_pos, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_6; + __Pyx_RefNannySetupContext("get_nth_key", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_nth_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_15get_nth_key)) { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":748 + * The integer index of the n-th key, or NO_LABEL if not found. + * """ + * return self._table.GetNthKey(pos) # <<<<<<<<<<<<<< + * + * cpdef bytes labeled_checksum(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 748, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_table->GetNthKey(__pyx_v_pos); + goto __pyx_L0; + + /* "pywrapfst.pyx":736 + * return self._table.FindSymbol(key) + * + * cpdef int64 get_nth_key(self, ssize_t pos) except *: # <<<<<<<<<<<<<< + * """ + * get_nth_key(self, pos) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._SymbolTable.get_nth_key", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_15get_nth_key(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_14get_nth_key[] = "\n get_nth_key(self, pos)\n\n Retrieves the integer index of the n-th key in the table.\n\n Args:\n pos: The n-th key to retrieve.\n\n Returns:\n The integer index of the n-th key, or NO_LABEL if not found.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_15get_nth_key(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos) { + Py_ssize_t __pyx_v_pos; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_nth_key (wrapper)", 0); + assert(__pyx_arg_pos); { + __pyx_v_pos = PyInt_AsSsize_t(__pyx_arg_pos); if (unlikely((__pyx_v_pos == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._SymbolTable.get_nth_key", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_14get_nth_key(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), ((Py_ssize_t)__pyx_v_pos)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_14get_nth_key(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, Py_ssize_t __pyx_v_pos) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_10basictypes_int64 __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("get_nth_key", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_12_SymbolTable_get_nth_key(__pyx_v_self, __pyx_v_pos, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._SymbolTable.get_nth_key", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":750 + * return self._table.GetNthKey(pos) + * + * cpdef bytes labeled_checksum(self): # <<<<<<<<<<<<<< + * """ + * labeled_checksum(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_17labeled_checksum(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_9pywrapfst_12_SymbolTable_labeled_checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("labeled_checksum", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_labeled_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_17labeled_checksum)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 750, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":756 + * Returns a bytestring indicating the label-dependent MD5 checksum. + * """ + * return self._table.LabeledCheckSum() # <<<<<<<<<<<<<< + * + * cpdef bool member(self, key): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 756, __pyx_L1_error) + } + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->_table->LabeledCheckSum()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":750 + * return self._table.GetNthKey(pos) + * + * cpdef bytes labeled_checksum(self): # <<<<<<<<<<<<<< + * """ + * labeled_checksum(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._SymbolTable.labeled_checksum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_17labeled_checksum(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_16labeled_checksum[] = "\n labeled_checksum(self)\n\n Returns a bytestring indicating the label-dependent MD5 checksum.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_17labeled_checksum(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("labeled_checksum (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_16labeled_checksum(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_16labeled_checksum(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("labeled_checksum", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_12_SymbolTable_labeled_checksum(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.labeled_checksum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":758 + * return self._table.LabeledCheckSum() + * + * cpdef bool member(self, key): # <<<<<<<<<<<<<< + * """ + * member(self, key) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_19member(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static bool __pyx_f_9pywrapfst_12_SymbolTable_member(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + std::string __pyx_t_9; + int __pyx_t_10; + __pyx_t_10basictypes_int64 __pyx_t_11; + __Pyx_RefNannySetupContext("member", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_member); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_19member)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":774 + * Whether or not the key is present (as a string or a index) in the table. + * """ + * try: # <<<<<<<<<<<<<< + * return self._table.MemberSymbol(tostring(key)) + * except FstArgError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { + + /* "pywrapfst.pyx":775 + * """ + * try: + * return self._table.MemberSymbol(tostring(key)) # <<<<<<<<<<<<<< + * except FstArgError: + * return self._table.MemberIndex(key) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 775, __pyx_L3_error) + } + __pyx_t_9 = __pyx_f_9pywrapfst_tostring(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 775, __pyx_L3_error) + __pyx_r = __pyx_v_self->_table->Member(__pyx_t_9); + goto __pyx_L7_try_return; + + /* "pywrapfst.pyx":774 + * Whether or not the key is present (as a string or a index) in the table. + * """ + * try: # <<<<<<<<<<<<<< + * return self._table.MemberSymbol(tostring(key)) + * except FstArgError: + */ + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pywrapfst.pyx":776 + * try: + * return self._table.MemberSymbol(tostring(key)) + * except FstArgError: # <<<<<<<<<<<<<< + * return self._table.MemberIndex(key) + * + */ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; + if (__pyx_t_10) { + __Pyx_AddTraceback("pywrapfst._SymbolTable.member", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + + /* "pywrapfst.pyx":777 + * return self._table.MemberSymbol(tostring(key)) + * except FstArgError: + * return self._table.MemberIndex(key) # <<<<<<<<<<<<<< + * + * def __contains__(self, key): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 777, __pyx_L5_except_error) + } + __pyx_t_11 = __Pyx_PyInt_As_int64_t(__pyx_v_key); if (unlikely((__pyx_t_11 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L5_except_error) + __pyx_r = __pyx_v_self->_table->Member(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6_except_return; + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; + + /* "pywrapfst.pyx":774 + * Whether or not the key is present (as a string or a index) in the table. + * """ + * try: # <<<<<<<<<<<<<< + * return self._table.MemberSymbol(tostring(key)) + * except FstArgError: + */ + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L1_error; + __pyx_L7_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + } + + /* "pywrapfst.pyx":758 + * return self._table.LabeledCheckSum() + * + * cpdef bool member(self, key): # <<<<<<<<<<<<<< + * """ + * member(self, key) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._SymbolTable.member", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_19member(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_18member[] = "\n member(self, key)\n\n Given a symbol or index, returns whether it is found in the table.\n\n This method returns a boolean indicating whether the given symbol or index\n is present in the table. If one intends to perform subsequent lookup, it is\n better to simply call the find method, catching the KeyError.\n\n Args:\n key: Either a string or an index.\n\n Returns:\n Whether or not the key is present (as a string or a index) in the table.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_19member(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("member (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_18member(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_18member(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("member", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_12_SymbolTable_member(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.member", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":779 + * return self._table.MemberIndex(key) + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * return self.member(key) + * + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_12_SymbolTable_21__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static int __pyx_pw_9pywrapfst_12_SymbolTable_21__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_20__contains__(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_12_SymbolTable_20__contains__(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_key) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__", 0); + + /* "pywrapfst.pyx":780 + * + * def __contains__(self, key): + * return self.member(key) # <<<<<<<<<<<<<< + * + * cpdef string name(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "member"); + __PYX_ERR(0, 780, __pyx_L1_error) + } + __pyx_r = ((struct __pyx_vtabstruct_9pywrapfst__SymbolTable *)__pyx_v_self->__pyx_vtab)->member(__pyx_v_self, __pyx_v_key, 0); + goto __pyx_L0; + + /* "pywrapfst.pyx":779 + * return self._table.MemberIndex(key) + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * return self.member(key) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._SymbolTable.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":782 + * return self.member(key) + * + * cpdef string name(self): # <<<<<<<<<<<<<< + * """ + * name(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_23name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_12_SymbolTable_name(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("name", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_23name)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":788 + * Returns the symbol table's name. + * """ + * return self._table.Name() # <<<<<<<<<<<<<< + * + * cpdef size_t num_symbols(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 788, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_table->Name(); + goto __pyx_L0; + + /* "pywrapfst.pyx":782 + * return self.member(key) + * + * cpdef string name(self): # <<<<<<<<<<<<<< + * """ + * name(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._SymbolTable.name", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_23name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_22name[] = "\n name(self)\n\n Returns the symbol table's name.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_23name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("name (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_22name(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_22name(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("name", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_12_SymbolTable_name(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":790 + * return self._table.Name() + * + * cpdef size_t num_symbols(self): # <<<<<<<<<<<<<< + * """ + * num_symbols(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_25num_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static size_t __pyx_f_9pywrapfst_12_SymbolTable_num_symbols(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch) { + size_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + __Pyx_RefNannySetupContext("num_symbols", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_25num_symbols)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":796 + * Returns the number of symbols in the symbol table. + * """ + * return self._table.NumSymbols() # <<<<<<<<<<<<<< + * + * cpdef void write(self, filename) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 796, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_table->NumSymbols(); + goto __pyx_L0; + + /* "pywrapfst.pyx":790 + * return self._table.Name() + * + * cpdef size_t num_symbols(self): # <<<<<<<<<<<<<< + * """ + * num_symbols(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._SymbolTable.num_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_25num_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_24num_symbols[] = "\n num_symbols(self)\n\n Returns the number of symbols in the symbol table.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_25num_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_symbols (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_24num_symbols(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_24num_symbols(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("num_symbols", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_9pywrapfst_12_SymbolTable_num_symbols(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.num_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":798 + * return self._table.NumSymbols() + * + * cpdef void write(self, filename) except *: # <<<<<<<<<<<<<< + * """ + * write(self, filename) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_27write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ +static void __pyx_f_9pywrapfst_12_SymbolTable_write(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("write", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_27write)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":812 + * FstIOError: Write failed. + * """ + * if not self._table.Write(tostring(filename)): # <<<<<<<<<<<<<< + * raise FstIOError("Write failed: {!r}".format(filename)) + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 812, __pyx_L1_error) + } + __pyx_t_5 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_t_6 = ((!(__pyx_v_self->_table->Write(__pyx_t_5) != 0)) != 0); + if (unlikely(__pyx_t_6)) { + + /* "pywrapfst.pyx":813 + * """ + * if not self._table.Write(tostring(filename)): + * raise FstIOError("Write failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * + * cpdef void write_text(self, filename) except *: + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 813, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Write_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 813, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 813, __pyx_L1_error) + + /* "pywrapfst.pyx":812 + * FstIOError: Write failed. + * """ + * if not self._table.Write(tostring(filename)): # <<<<<<<<<<<<<< + * raise FstIOError("Write failed: {!r}".format(filename)) + * + */ + } + + /* "pywrapfst.pyx":798 + * return self._table.NumSymbols() + * + * cpdef void write(self, filename) except *: # <<<<<<<<<<<<<< + * """ + * write(self, filename) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._SymbolTable.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_27write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_26write[] = "\n write(self, filename)\n\n Serializes symbol table to a file.\n\n This methods writes the SymbolTable to a file in binary format.\n\n Args:\n filename: The string location of the output file.\n\n Raises:\n FstIOError: Write failed.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_27write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_26write(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), ((PyObject *)__pyx_v_filename)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_26write(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("write", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_9pywrapfst_12_SymbolTable_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 798, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":815 + * raise FstIOError("Write failed: {!r}".format(filename)) + * + * cpdef void write_text(self, filename) except *: # <<<<<<<<<<<<<< + * """ + * write_text(self, filename) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_29write_text(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ +static void __pyx_f_9pywrapfst_12_SymbolTable_write_text(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("write_text", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_29write_text)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":829 + * FstIOError: Write failed. + * """ + * if not self._table.WriteText(tostring(filename)): # <<<<<<<<<<<<<< + * raise FstIOError("Write failed: {!r}".format(filename)) + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 829, __pyx_L1_error) + } + __pyx_t_5 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 829, __pyx_L1_error) + __pyx_t_6 = ((!(__pyx_v_self->_table->WriteText(__pyx_t_5) != 0)) != 0); + if (unlikely(__pyx_t_6)) { + + /* "pywrapfst.pyx":830 + * """ + * if not self._table.WriteText(tostring(filename)): + * raise FstIOError("Write failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * + * cpdef bytes write_to_string(self): + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Write_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 830, __pyx_L1_error) + + /* "pywrapfst.pyx":829 + * FstIOError: Write failed. + * """ + * if not self._table.WriteText(tostring(filename)): # <<<<<<<<<<<<<< + * raise FstIOError("Write failed: {!r}".format(filename)) + * + */ + } + + /* "pywrapfst.pyx":815 + * raise FstIOError("Write failed: {!r}".format(filename)) + * + * cpdef void write_text(self, filename) except *: # <<<<<<<<<<<<<< + * """ + * write_text(self, filename) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._SymbolTable.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_29write_text(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_28write_text[] = "\n write_text(self, filename)\n\n Writes symbol table to text file.\n\n This method writes the SymbolTable to a file in human-readable format.\n\n Args:\n filename: The string location of the output file.\n\n Raises:\n FstIOError: Write failed.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_29write_text(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_text (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_28write_text(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), ((PyObject *)__pyx_v_filename)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_28write_text(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("write_text", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_9pywrapfst_12_SymbolTable_write_text(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":832 + * raise FstIOError("Write failed: {!r}".format(filename)) + * + * cpdef bytes write_to_string(self): # <<<<<<<<<<<<<< + * """ + * write_to_string(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_31write_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_9pywrapfst_12_SymbolTable_write_to_string(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self, int __pyx_skip_dispatch) { + std::stringstream __pyx_v_sstrm; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("write_to_string", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write_to_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12_SymbolTable_31write_to_string)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 832, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":847 + * """ + * cdef stringstream sstrm + * if not self._table.Write(sstrm): # <<<<<<<<<<<<<< + * raise FstIOError("Write to string failed") + * return sstrm.str() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 847, __pyx_L1_error) + } + __pyx_t_5 = ((!(__pyx_v_self->_table->Write(__pyx_v_sstrm) != 0)) != 0); + if (unlikely(__pyx_t_5)) { + + /* "pywrapfst.pyx":848 + * cdef stringstream sstrm + * if not self._table.Write(sstrm): + * raise FstIOError("Write to string failed") # <<<<<<<<<<<<<< + * return sstrm.str() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Write_to_string_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Write_to_string_failed); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 848, __pyx_L1_error) + + /* "pywrapfst.pyx":847 + * """ + * cdef stringstream sstrm + * if not self._table.Write(sstrm): # <<<<<<<<<<<<<< + * raise FstIOError("Write to string failed") + * return sstrm.str() + */ + } + + /* "pywrapfst.pyx":849 + * if not self._table.Write(sstrm): + * raise FstIOError("Write to string failed") + * return sstrm.str() # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_sstrm.str()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":832 + * raise FstIOError("Write failed: {!r}".format(filename)) + * + * cpdef bytes write_to_string(self): # <<<<<<<<<<<<<< + * """ + * write_to_string(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._SymbolTable.write_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_31write_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12_SymbolTable_30write_to_string[] = "\n write_to_string(self)\n\n Serializes SymbolTable to a string.\n\n Returns:\n A bytestring.\n\n Raises:\n FstIOError: Write to string failed.\n\n See also: `read_from_string`.\n "; +static PyObject *__pyx_pw_9pywrapfst_12_SymbolTable_31write_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_to_string (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12_SymbolTable_30write_to_string(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12_SymbolTable_30write_to_string(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("write_to_string", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_12_SymbolTable_write_to_string(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._SymbolTable.write_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":867 + * # Doing so will allow undefined behavior. + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), + * id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_24_EncodeMapperSymbolTable_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_24_EncodeMapperSymbolTable_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_24_EncodeMapperSymbolTable___repr__(((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_24_EncodeMapperSymbolTable___repr__(struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":868 + * + * def __repr__(self): + * return "".format(self.name(), # <<<<<<<<<<<<<< + * id(self)) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_const_EncodeMapper_SymbolTable, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "name"); + __PYX_ERR(0, 868, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst__EncodeMapperSymbolTable *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.name(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "pywrapfst.pyx":869 + * def __repr__(self): + * return "".format(self.name(), + * id(self)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":867 + * # Doing so will allow undefined behavior. + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), + * id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._EncodeMapperSymbolTable.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":886 + * # Doing so will allow undefined behavior. + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), + * id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_15_FstSymbolTable_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_15_FstSymbolTable_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_15_FstSymbolTable___repr__(((struct __pyx_obj_9pywrapfst__FstSymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_15_FstSymbolTable___repr__(struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":887 + * + * def __repr__(self): + * return "".format(self.name(), # <<<<<<<<<<<<<< + * id(self)) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_const_Fst_SymbolTable_r_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "name"); + __PYX_ERR(0, 887, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst__FstSymbolTable *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.name(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "pywrapfst.pyx":888 + * def __repr__(self): + * return "".format(self.name(), + * id(self)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 888, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":886 + * # Doing so will allow undefined behavior. + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), + * id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._FstSymbolTable.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":902 + * """ + * + * cpdef int64 add_symbol(self, symbol, int64 key=fst.kNoSymbol): # <<<<<<<<<<<<<< + * """ + * add_symbol(self, symbol, key=NO_SYMBOL) + */ + +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_1add_symbol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_19_MutableSymbolTable_add_symbol(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_symbol, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_19_MutableSymbolTable_add_symbol *__pyx_optional_args) { + __pyx_t_10basictypes_int64 __pyx_v_key = __pyx_k__3; + std::string __pyx_v_symbol_string; + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_8; + std::string __pyx_t_9; + int __pyx_t_10; + __Pyx_RefNannySetupContext("add_symbol", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_key = __pyx_optional_args->key; + } + } + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19_MutableSymbolTable_1add_symbol)) { + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_symbol, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_symbol, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_INCREF(__pyx_v_symbol); + __Pyx_GIVEREF(__pyx_v_symbol); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_symbol); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_8; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":919 + * The integer key of the new symbol. + * """ + * cdef string symbol_string = tostring(symbol) # <<<<<<<<<<<<<< + * if key != fst.kNoSymbol: + * return self._table.AddSymbol(symbol_string, key) + */ + __pyx_t_9 = __pyx_f_9pywrapfst_tostring(__pyx_v_symbol); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 919, __pyx_L1_error) + __pyx_v_symbol_string = __pyx_t_9; + + /* "pywrapfst.pyx":920 + * """ + * cdef string symbol_string = tostring(symbol) + * if key != fst.kNoSymbol: # <<<<<<<<<<<<<< + * return self._table.AddSymbol(symbol_string, key) + * else: + */ + __pyx_t_10 = ((__pyx_v_key != fst::kNoSymbol) != 0); + if (__pyx_t_10) { + + /* "pywrapfst.pyx":921 + * cdef string symbol_string = tostring(symbol) + * if key != fst.kNoSymbol: + * return self._table.AddSymbol(symbol_string, key) # <<<<<<<<<<<<<< + * else: + * return self._table.AddSymbol(symbol_string) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 921, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->__pyx_base._table->AddSymbol(__pyx_v_symbol_string, __pyx_v_key); + goto __pyx_L0; + + /* "pywrapfst.pyx":920 + * """ + * cdef string symbol_string = tostring(symbol) + * if key != fst.kNoSymbol: # <<<<<<<<<<<<<< + * return self._table.AddSymbol(symbol_string, key) + * else: + */ + } + + /* "pywrapfst.pyx":923 + * return self._table.AddSymbol(symbol_string, key) + * else: + * return self._table.AddSymbol(symbol_string) # <<<<<<<<<<<<<< + * + * cpdef void add_table(self, _SymbolTable syms): + */ + /*else*/ { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 923, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->__pyx_base._table->AddSymbol(__pyx_v_symbol_string); + goto __pyx_L0; + } + + /* "pywrapfst.pyx":902 + * """ + * + * cpdef int64 add_symbol(self, symbol, int64 key=fst.kNoSymbol): # <<<<<<<<<<<<<< + * """ + * add_symbol(self, symbol, key=NO_SYMBOL) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_WriteUnraisable("pywrapfst._MutableSymbolTable.add_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_1add_symbol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_19_MutableSymbolTable_add_symbol[] = "\n add_symbol(self, symbol, key=NO_SYMBOL)\n\n Adds a symbol to the table and returns the index.\n\n This method adds a symbol to the table. The caller can optionally\n specify a non-negative integer index for the key.\n\n Args:\n symbol: A symbol string.\n key: An index for the symbol; if not specified, the next index will be\n used.\n\n Returns:\n The integer key of the new symbol.\n "; +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_1add_symbol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_symbol = 0; + __pyx_t_10basictypes_int64 __pyx_v_key; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_symbol (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_symbol,&__pyx_n_s_key,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_symbol)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_symbol") < 0)) __PYX_ERR(0, 902, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_symbol = values[0]; + if (values[1]) { + __pyx_v_key = __Pyx_PyInt_As_int64_t(values[1]); if (unlikely((__pyx_v_key == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 902, __pyx_L3_error) + } else { + __pyx_v_key = __pyx_k__3; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_symbol", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 902, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableSymbolTable.add_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_19_MutableSymbolTable_add_symbol(((struct __pyx_obj_9pywrapfst__MutableSymbolTable *)__pyx_v_self), __pyx_v_symbol, __pyx_v_key); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19_MutableSymbolTable_add_symbol(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_symbol, __pyx_t_10basictypes_int64 __pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_10basictypes_int64 __pyx_t_1; + struct __pyx_opt_args_9pywrapfst_19_MutableSymbolTable_add_symbol __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("add_symbol", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.key = __pyx_v_key; + __pyx_t_1 = __pyx_vtabptr_9pywrapfst__MutableSymbolTable->add_symbol(__pyx_v_self, __pyx_v_symbol, 1, &__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst._MutableSymbolTable.add_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":925 + * return self._table.AddSymbol(symbol_string) + * + * cpdef void add_table(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * add_table(self, syms) + */ + +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_3add_table(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static void __pyx_f_9pywrapfst_19_MutableSymbolTable_add_table(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("add_table", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_table); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19_MutableSymbolTable_3add_table)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_syms)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_syms)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":937 + * syms: A SymbolTable to be merged with the current table. + * """ + * self._table.AddTable(deref(syms._table)) # <<<<<<<<<<<<<< + * + * cpdef void set_name(self, new_name) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 937, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_syms) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 937, __pyx_L1_error) + } + __pyx_v_self->__pyx_base._table->AddTable((*__pyx_v_syms->_table)); + + /* "pywrapfst.pyx":925 + * return self._table.AddSymbol(symbol_string) + * + * cpdef void add_table(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * add_table(self, syms) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._MutableSymbolTable.add_table", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_3add_table(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static char __pyx_doc_9pywrapfst_19_MutableSymbolTable_2add_table[] = "\n add_table(self, syms)\n\n Adds another SymbolTable to this table.\n\n This method merges another symbol table into the current table. All key\n values will be offset by the current available key.\n\n Args:\n syms: A SymbolTable to be merged with the current table.\n "; +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_3add_table(PyObject *__pyx_v_self, PyObject *__pyx_v_syms) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_table (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_syms), __pyx_ptype_9pywrapfst__SymbolTable, 1, "syms", 0))) __PYX_ERR(0, 925, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_19_MutableSymbolTable_2add_table(((struct __pyx_obj_9pywrapfst__MutableSymbolTable *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_syms)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19_MutableSymbolTable_2add_table(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("add_table", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_19_MutableSymbolTable_add_table(__pyx_v_self, __pyx_v_syms, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._MutableSymbolTable.add_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":939 + * self._table.AddTable(deref(syms._table)) + * + * cpdef void set_name(self, new_name) except *: # <<<<<<<<<<<<<< + * self._table.SetName(tostring(new_name)) + * + */ + +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_5set_name(PyObject *__pyx_v_self, PyObject *__pyx_v_new_name); /*proto*/ +static void __pyx_f_9pywrapfst_19_MutableSymbolTable_set_name(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_new_name, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("set_name", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19_MutableSymbolTable_5set_name)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_new_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_new_name); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":940 + * + * cpdef void set_name(self, new_name) except *: + * self._table.SetName(tostring(new_name)) # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 940, __pyx_L1_error) + } + __pyx_t_5 = __pyx_f_9pywrapfst_tostring(__pyx_v_new_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error) + __pyx_v_self->__pyx_base._table->SetName(__pyx_t_5); + + /* "pywrapfst.pyx":939 + * self._table.AddTable(deref(syms._table)) + * + * cpdef void set_name(self, new_name) except *: # <<<<<<<<<<<<<< + * self._table.SetName(tostring(new_name)) + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableSymbolTable.set_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_5set_name(PyObject *__pyx_v_self, PyObject *__pyx_v_new_name); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_19_MutableSymbolTable_5set_name(PyObject *__pyx_v_self, PyObject *__pyx_v_new_name) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_name (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19_MutableSymbolTable_4set_name(((struct __pyx_obj_9pywrapfst__MutableSymbolTable *)__pyx_v_self), ((PyObject *)__pyx_v_new_name)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19_MutableSymbolTable_4set_name(struct __pyx_obj_9pywrapfst__MutableSymbolTable *__pyx_v_self, PyObject *__pyx_v_new_name) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("set_name", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_9pywrapfst_19_MutableSymbolTable_set_name(__pyx_v_self, __pyx_v_new_name, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 939, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._MutableSymbolTable.set_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":950 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_22_MutableFstSymbolTable_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_22_MutableFstSymbolTable_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_22_MutableFstSymbolTable___repr__(((struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_22_MutableFstSymbolTable___repr__(struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":951 + * + * def __repr__(self): + * return "".format(self.name(), id(self)) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Fst_SymbolTable_r_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "name"); + __PYX_ERR(0, 951, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst__MutableFstSymbolTable *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.name(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":950 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._MutableFstSymbolTable.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":971 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11SymbolTable___repr__(((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable___repr__(struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":972 + * + * def __repr__(self): + * return "".format(self.name(), id(self)) # <<<<<<<<<<<<<< + * + * def __init__(self, name=""): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_SymbolTable_r_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "name"); + __PYX_ERR(0, 972, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst_SymbolTable *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.name(((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":971 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(self.name(), id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.SymbolTable.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":974 + * return "".format(self.name(), id(self)) + * + * def __init__(self, name=""): # <<<<<<<<<<<<<< + * self._table = new fst.SymbolTable(tostring(name)) + * self._smart_table.reset(self._table) + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_11SymbolTable_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_11SymbolTable_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)__pyx_kp_u_unspecified); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name_2); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 974, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_name = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 974, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.SymbolTable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11SymbolTable_2__init__(((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_11SymbolTable_2__init__(struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":975 + * + * def __init__(self, name=""): + * self._table = new fst.SymbolTable(tostring(name)) # <<<<<<<<<<<<<< + * self._smart_table.reset(self._table) + * + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 975, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 975, __pyx_L1_error) + } + __pyx_v_self->__pyx_base.__pyx_base._table = new fst::SymbolTable(__pyx_t_1); + + /* "pywrapfst.pyx":976 + * def __init__(self, name=""): + * self._table = new fst.SymbolTable(tostring(name)) + * self._smart_table.reset(self._table) # <<<<<<<<<<<<<< + * + * @classmethod + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_smart_table"); + __PYX_ERR(0, 976, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 976, __pyx_L1_error) + } + __pyx_v_self->_smart_table.reset(__pyx_v_self->__pyx_base.__pyx_base._table); + + /* "pywrapfst.pyx":974 + * return "".format(self.name(), id(self)) + * + * def __init__(self, name=""): # <<<<<<<<<<<<<< + * self._table = new fst.SymbolTable(tostring(name)) + * self._smart_table.reset(self._table) + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.SymbolTable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":979 + * + * @classmethod + * def read(cls, filename): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read(filename) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_5read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename); /*proto*/ +static char __pyx_doc_9pywrapfst_11SymbolTable_4read[] = "\n SymbolTable.read(filename)\n\n Reads symbol table from binary file.\n\n This class method creates a new SymbolTable from a symbol table binary file.\n\n Args:\n filename: The string location of the input binary file.\n\n Returns:\n A new SymbolTable instance.\n\n See also: `SymbolTable.read_fst`, `SymbolTable.read_text`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_5read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11SymbolTable_4read(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_filename)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable_4read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename) { + std::unique_ptr __pyx_v_syms; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("read", 0); + + /* "pywrapfst.pyx":996 + * """ + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.Read(tostring(filename))) # <<<<<<<<<<<<<< + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 996, __pyx_L1_error) + __pyx_v_syms.reset(fst::SymbolTable::Read(__pyx_t_1)); + + /* "pywrapfst.pyx":997 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.Read(tostring(filename))) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) + */ + __pyx_t_2 = ((__pyx_v_syms.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":998 + * syms.reset(fst.SymbolTable.Read(tostring(filename))) + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * return _init_SymbolTable(syms.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 998, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Read_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 998, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 998, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 998, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 998, __pyx_L1_error) + + /* "pywrapfst.pyx":997 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.Read(tostring(filename))) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) + */ + } + + /* "pywrapfst.pyx":999 + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_SymbolTable(__pyx_v_syms.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 999, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":979 + * + * @classmethod + * def read(cls, filename): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read(filename) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.SymbolTable.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1002 + * + * @classmethod + * def read_text(cls, filename, bool allow_negative_labels=False): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read_text(filename) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_7read_text(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11SymbolTable_6read_text[] = "\n SymbolTable.read_text(filename)\n\n Reads symbol table from text file.\n\n This class method creates a new SymbolTable from a symbol table text file.\n\n Args:\n filename: The string location of the input text file.\n allow_negative_labels: Should negative labels be allowed? (Not\n recommended; may cause conflicts).\n\n Returns:\n A new SymbolTable instance.\n\n See also: `SymbolTable.read`, `SymbolTable.read_fst`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_7read_text(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + bool __pyx_v_allow_negative_labels; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_text (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_allow_negative_labels,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allow_negative_labels); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_text") < 0)) __PYX_ERR(0, 1002, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_filename = values[0]; + if (values[1]) { + __pyx_v_allow_negative_labels = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_allow_negative_labels == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1002, __pyx_L3_error) + } else { + __pyx_v_allow_negative_labels = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_text", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1002, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.SymbolTable.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11SymbolTable_6read_text(((PyTypeObject*)__pyx_v_cls), __pyx_v_filename, __pyx_v_allow_negative_labels); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable_6read_text(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename, bool __pyx_v_allow_negative_labels) { + std::unique_ptr __pyx_v_opts; + std::unique_ptr __pyx_v_syms; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("read_text", 0); + + /* "pywrapfst.pyx":1021 + * """ + * cdef unique_ptr[fst.SymbolTableTextOptions] opts + * opts.reset(new fst.SymbolTableTextOptions(allow_negative_labels)) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadText(tostring(filename), deref(opts))) + */ + __pyx_v_opts.reset(new fst::SymbolTableTextOptions(__pyx_v_allow_negative_labels)); + + /* "pywrapfst.pyx":1023 + * opts.reset(new fst.SymbolTableTextOptions(allow_negative_labels)) + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadText(tostring(filename), deref(opts))) # <<<<<<<<<<<<<< + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L1_error) + __pyx_v_syms.reset(fst::SymbolTable::ReadText(__pyx_t_1, (*__pyx_v_opts))); + + /* "pywrapfst.pyx":1024 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadText(tostring(filename), deref(opts))) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) + */ + __pyx_t_2 = ((__pyx_v_syms.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":1025 + * syms.reset(fst.SymbolTable.ReadText(tostring(filename), deref(opts))) + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * return _init_SymbolTable(syms.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1025, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Read_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1025, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1025, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1025, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1025, __pyx_L1_error) + + /* "pywrapfst.pyx":1024 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadText(tostring(filename), deref(opts))) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) + */ + } + + /* "pywrapfst.pyx":1026 + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_SymbolTable(__pyx_v_syms.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1026, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1002 + * + * @classmethod + * def read_text(cls, filename, bool allow_negative_labels=False): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read_text(filename) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.SymbolTable.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1029 + * + * @classmethod + * def read_fst(cls, filename, bool input_table): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read_fst(filename, input_table) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_9read_fst(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11SymbolTable_8read_fst[] = "\n SymbolTable.read_fst(filename, input_table)\n\n Reads symbol table from an FST file without loading the corresponding FST.\n\n This class method creates a new SymbolTable by reading either the input or\n output symbol table from an FST file, without loading the corresponding FST.\n\n Args:\n filename: The string location of the input FST file.\n input_table: Should the input table be read (True) or the output table\n (False)?\n\n Returns:\n A new SymbolTable instance, or None if none can be read.\n\n Raises:\n FstIOError: Read failed.\n\n See also: `SymbolTable.read`, `SymbolTable.read_text`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11SymbolTable_9read_fst(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + bool __pyx_v_input_table; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_fst (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_input_table,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input_table)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_fst", 1, 2, 2, 1); __PYX_ERR(0, 1029, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_fst") < 0)) __PYX_ERR(0, 1029, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_filename = values[0]; + __pyx_v_input_table = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_input_table == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_fst", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1029, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.SymbolTable.read_fst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11SymbolTable_8read_fst(((PyTypeObject*)__pyx_v_cls), __pyx_v_filename, __pyx_v_input_table); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11SymbolTable_8read_fst(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename, bool __pyx_v_input_table) { + std::unique_ptr __pyx_v_syms; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("read_fst", 0); + + /* "pywrapfst.pyx":1052 + * """ + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.FstReadSymbols(tostring(filename), input_table)) # <<<<<<<<<<<<<< + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L1_error) + __pyx_v_syms.reset(fst::FstReadSymbols(__pyx_t_1, __pyx_v_input_table)); + + /* "pywrapfst.pyx":1053 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.FstReadSymbols(tostring(filename), input_table)) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) + */ + __pyx_t_2 = ((__pyx_v_syms.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":1054 + * syms.reset(fst.FstReadSymbols(tostring(filename), input_table)) + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * return _init_SymbolTable(syms.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1054, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Read_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1054, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1054, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1054, __pyx_L1_error) + + /* "pywrapfst.pyx":1053 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.FstReadSymbols(tostring(filename), input_table)) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) + */ + } + + /* "pywrapfst.pyx":1055 + * if syms.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_SymbolTable(syms.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_SymbolTable(__pyx_v_syms.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1055, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1029 + * + * @classmethod + * def read_fst(cls, filename, bool input_table): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read_fst(filename, input_table) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.SymbolTable.read_fst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1058 + * + * + * cdef _EncodeMapperSymbolTable _init_EncodeMapperSymbolTable( # <<<<<<<<<<<<<< + * fst.SymbolTable *table, shared_ptr[fst.EncodeMapperClass] encoder): + * cdef _EncodeMapperSymbolTable result = ( + */ + +static struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_f_9pywrapfst__init_EncodeMapperSymbolTable(fst::SymbolTable *__pyx_v_table, std::shared_ptr __pyx_v_encoder) { + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_init_EncodeMapperSymbolTable", 0); + + /* "pywrapfst.pyx":1061 + * fst.SymbolTable *table, shared_ptr[fst.EncodeMapperClass] encoder): + * cdef _EncodeMapperSymbolTable result = ( + * _EncodeMapperSymbolTable.__new__(_EncodeMapperSymbolTable)) # <<<<<<<<<<<<<< + * result._table = table + * result._encoder = encoder + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst__EncodeMapperSymbolTable(((PyTypeObject *)__pyx_ptype_9pywrapfst__EncodeMapperSymbolTable), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":1062 + * cdef _EncodeMapperSymbolTable result = ( + * _EncodeMapperSymbolTable.__new__(_EncodeMapperSymbolTable)) + * result._table = table # <<<<<<<<<<<<<< + * result._encoder = encoder + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1062, __pyx_L1_error) + } + __pyx_v_result->__pyx_base._table = __pyx_v_table; + + /* "pywrapfst.pyx":1063 + * _EncodeMapperSymbolTable.__new__(_EncodeMapperSymbolTable)) + * result._table = table + * result._encoder = encoder # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1063, __pyx_L1_error) + } + __pyx_v_result->_encoder = __pyx_v_encoder; + + /* "pywrapfst.pyx":1064 + * result._table = table + * result._encoder = encoder + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1058 + * + * + * cdef _EncodeMapperSymbolTable _init_EncodeMapperSymbolTable( # <<<<<<<<<<<<<< + * fst.SymbolTable *table, shared_ptr[fst.EncodeMapperClass] encoder): + * cdef _EncodeMapperSymbolTable result = ( + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._init_EncodeMapperSymbolTable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1067 + * + * + * cdef _FstSymbolTable _init_FstSymbolTable(fst.SymbolTable *table, # <<<<<<<<<<<<<< + * shared_ptr[fst.FstClass] ifst): + * cdef _FstSymbolTable result = _FstSymbolTable.__new__(_FstSymbolTable) + */ + +static struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_f_9pywrapfst__init_FstSymbolTable(fst::SymbolTable *__pyx_v_table, std::shared_ptr __pyx_v_ifst) { + struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_init_FstSymbolTable", 0); + + /* "pywrapfst.pyx":1069 + * cdef _FstSymbolTable _init_FstSymbolTable(fst.SymbolTable *table, + * shared_ptr[fst.FstClass] ifst): + * cdef _FstSymbolTable result = _FstSymbolTable.__new__(_FstSymbolTable) # <<<<<<<<<<<<<< + * result._table = table + * result._fst = ifst + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst__FstSymbolTable(((PyTypeObject *)__pyx_ptype_9pywrapfst__FstSymbolTable), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":1070 + * shared_ptr[fst.FstClass] ifst): + * cdef _FstSymbolTable result = _FstSymbolTable.__new__(_FstSymbolTable) + * result._table = table # <<<<<<<<<<<<<< + * result._fst = ifst + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1070, __pyx_L1_error) + } + __pyx_v_result->__pyx_base._table = __pyx_v_table; + + /* "pywrapfst.pyx":1071 + * cdef _FstSymbolTable result = _FstSymbolTable.__new__(_FstSymbolTable) + * result._table = table + * result._fst = ifst # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1071, __pyx_L1_error) + } + __pyx_v_result->_fst = __pyx_v_ifst; + + /* "pywrapfst.pyx":1072 + * result._table = table + * result._fst = ifst + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1067 + * + * + * cdef _FstSymbolTable _init_FstSymbolTable(fst.SymbolTable *table, # <<<<<<<<<<<<<< + * shared_ptr[fst.FstClass] ifst): + * cdef _FstSymbolTable result = _FstSymbolTable.__new__(_FstSymbolTable) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._init_FstSymbolTable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1075 + * + * + * cdef _MutableFstSymbolTable _init_MutableFstSymbolTable(fst.SymbolTable *table, # <<<<<<<<<<<<<< + * shared_ptr[fst.MutableFstClass] ifst): + * cdef _MutableFstSymbolTable result = ( + */ + +static struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *__pyx_f_9pywrapfst__init_MutableFstSymbolTable(fst::SymbolTable *__pyx_v_table, std::shared_ptr __pyx_v_ifst) { + struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_init_MutableFstSymbolTable", 0); + + /* "pywrapfst.pyx":1078 + * shared_ptr[fst.MutableFstClass] ifst): + * cdef _MutableFstSymbolTable result = ( + * _MutableFstSymbolTable.__new__(_MutableFstSymbolTable)) # <<<<<<<<<<<<<< + * result._table = table + * result._mfst = ifst + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst__MutableFstSymbolTable(((PyTypeObject *)__pyx_ptype_9pywrapfst__MutableFstSymbolTable), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1078, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":1079 + * cdef _MutableFstSymbolTable result = ( + * _MutableFstSymbolTable.__new__(_MutableFstSymbolTable)) + * result._table = table # <<<<<<<<<<<<<< + * result._mfst = ifst + * return result + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1079, __pyx_L1_error) + } + __pyx_v_result->__pyx_base.__pyx_base._table = __pyx_v_table; + + /* "pywrapfst.pyx":1080 + * _MutableFstSymbolTable.__new__(_MutableFstSymbolTable)) + * result._table = table + * result._mfst = ifst # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1080, __pyx_L1_error) + } + __pyx_v_result->_mfst = __pyx_v_ifst; + + /* "pywrapfst.pyx":1081 + * result._table = table + * result._mfst = ifst + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1075 + * + * + * cdef _MutableFstSymbolTable _init_MutableFstSymbolTable(fst.SymbolTable *table, # <<<<<<<<<<<<<< + * shared_ptr[fst.MutableFstClass] ifst): + * cdef _MutableFstSymbolTable result = ( + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._init_MutableFstSymbolTable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1084 + * + * + * cdef SymbolTable _init_SymbolTable(fst.SymbolTable *table): # <<<<<<<<<<<<<< + * cdef SymbolTable result = SymbolTable.__new__(SymbolTable) + * result._table = table + */ + +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst__init_SymbolTable(fst::SymbolTable *__pyx_v_table) { + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_result = 0; + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_init_SymbolTable", 0); + + /* "pywrapfst.pyx":1085 + * + * cdef SymbolTable _init_SymbolTable(fst.SymbolTable *table): + * cdef SymbolTable result = SymbolTable.__new__(SymbolTable) # <<<<<<<<<<<<<< + * result._table = table + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_SymbolTable(((PyTypeObject *)__pyx_ptype_9pywrapfst_SymbolTable), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":1086 + * cdef SymbolTable _init_SymbolTable(fst.SymbolTable *table): + * cdef SymbolTable result = SymbolTable.__new__(SymbolTable) + * result._table = table # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1086, __pyx_L1_error) + } + __pyx_v_result->__pyx_base.__pyx_base._table = __pyx_v_table; + + /* "pywrapfst.pyx":1087 + * cdef SymbolTable result = SymbolTable.__new__(SymbolTable) + * result._table = table + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1084 + * + * + * cdef SymbolTable _init_SymbolTable(fst.SymbolTable *table): # <<<<<<<<<<<<<< + * cdef SymbolTable result = SymbolTable.__new__(SymbolTable) + * result._table = table + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._init_SymbolTable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1090 + * + * + * cpdef SymbolTable _read_SymbolTable_from_string(state): # <<<<<<<<<<<<<< + * cdef stringstream sstrm + * sstrm << tostring(state) + */ + +static PyObject *__pyx_pw_9pywrapfst_9_read_SymbolTable_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst__read_SymbolTable_from_string(PyObject *__pyx_v_state, CYTHON_UNUSED int __pyx_skip_dispatch) { + std::stringstream __pyx_v_sstrm; + std::unique_ptr __pyx_v_syms; + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("_read_SymbolTable_from_string", 0); + + /* "pywrapfst.pyx":1092 + * cpdef SymbolTable _read_SymbolTable_from_string(state): + * cdef stringstream sstrm + * sstrm << tostring(state) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadStream(sstrm, b"")) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_state); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1092, __pyx_L1_error) + (void)((__pyx_v_sstrm << __pyx_t_1)); + + /* "pywrapfst.pyx":1094 + * sstrm << tostring(state) + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadStream(sstrm, b"")) # <<<<<<<<<<<<<< + * if syms.get() == NULL: + * raise FstIOError("Read failed") + */ + __pyx_v_syms.reset(fst::SymbolTable::Read(__pyx_v_sstrm, __pyx_k_pywrapfst)); + + /* "pywrapfst.pyx":1095 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadStream(sstrm, b"")) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed") + * return _init_SymbolTable(syms.release()) + */ + __pyx_t_2 = ((__pyx_v_syms.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":1096 + * syms.reset(fst.SymbolTable.ReadStream(sstrm, b"")) + * if syms.get() == NULL: + * raise FstIOError("Read failed") # <<<<<<<<<<<<<< + * return _init_SymbolTable(syms.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1096, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_Read_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Read_failed); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1096, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1096, __pyx_L1_error) + + /* "pywrapfst.pyx":1095 + * cdef unique_ptr[fst.SymbolTable] syms + * syms.reset(fst.SymbolTable.ReadStream(sstrm, b"")) + * if syms.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed") + * return _init_SymbolTable(syms.release()) + */ + } + + /* "pywrapfst.pyx":1097 + * if syms.get() == NULL: + * raise FstIOError("Read failed") + * return _init_SymbolTable(syms.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_SymbolTable(__pyx_v_syms.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1097, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1090 + * + * + * cpdef SymbolTable _read_SymbolTable_from_string(state): # <<<<<<<<<<<<<< + * cdef stringstream sstrm + * sstrm << tostring(state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._read_SymbolTable_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9_read_SymbolTable_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9_read_SymbolTable_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_read_SymbolTable_from_string (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_8_read_SymbolTable_from_string(__pyx_self, ((PyObject *)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_8_read_SymbolTable_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_read_SymbolTable_from_string", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__read_SymbolTable_from_string(__pyx_v_state, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._read_SymbolTable_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1103 + * + * + * cpdef SymbolTable compact_symbol_table(_SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * compact_symbol_table(syms) + */ + +static PyObject *__pyx_pw_9pywrapfst_11compact_symbol_table(PyObject *__pyx_self, PyObject *__pyx_v_syms); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst_compact_symbol_table(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms, CYTHON_UNUSED int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("compact_symbol_table", 0); + + /* "pywrapfst.pyx":1115 + * A new compacted SymbolTable. + * """ + * return _init_SymbolTable(fst.CompactSymbolTable(deref(syms._table))) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_syms) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1115, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_SymbolTable(fst::CompactSymbolTable((*__pyx_v_syms->_table)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1103 + * + * + * cpdef SymbolTable compact_symbol_table(_SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * compact_symbol_table(syms) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.compact_symbol_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11compact_symbol_table(PyObject *__pyx_self, PyObject *__pyx_v_syms); /*proto*/ +static char __pyx_doc_9pywrapfst_10compact_symbol_table[] = "\n compact_symbol_table(syms)\n\n Constructively relabels a SymbolTable to make it a contiguous mapping.\n\n Args:\n syms: Input SymbolTable.\n\n Returns:\n A new compacted SymbolTable.\n "; +static PyObject *__pyx_pw_9pywrapfst_11compact_symbol_table(PyObject *__pyx_self, PyObject *__pyx_v_syms) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("compact_symbol_table (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_syms), __pyx_ptype_9pywrapfst__SymbolTable, 1, "syms", 0))) __PYX_ERR(0, 1103, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_10compact_symbol_table(__pyx_self, ((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_syms)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_10compact_symbol_table(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("compact_symbol_table", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_compact_symbol_table(__pyx_v_syms, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.compact_symbol_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1118 + * + * + * cpdef SymbolTable merge_symbol_table(_SymbolTable lhs, _SymbolTable rhs): # <<<<<<<<<<<<<< + * """ + * merge_symbol_table(lhs, rhs) + */ + +static PyObject *__pyx_pw_9pywrapfst_13merge_symbol_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_f_9pywrapfst_merge_symbol_table(struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_lhs, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_rhs, CYTHON_UNUSED int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("merge_symbol_table", 0); + + /* "pywrapfst.pyx":1142 + * See also: `relabel_symbols`. + * """ + * return _init_SymbolTable(fst.MergeSymbolTable(deref(lhs._table), # <<<<<<<<<<<<<< + * deref(rhs._table), NULL)) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_lhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1142, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1143 + * """ + * return _init_SymbolTable(fst.MergeSymbolTable(deref(lhs._table), + * deref(rhs._table), NULL)) # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_rhs) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1143, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1142 + * See also: `relabel_symbols`. + * """ + * return _init_SymbolTable(fst.MergeSymbolTable(deref(lhs._table), # <<<<<<<<<<<<<< + * deref(rhs._table), NULL)) + * + */ + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_SymbolTable(fst::MergeSymbolTable((*__pyx_v_lhs->_table), (*__pyx_v_rhs->_table), NULL))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst_SymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1118 + * + * + * cpdef SymbolTable merge_symbol_table(_SymbolTable lhs, _SymbolTable rhs): # <<<<<<<<<<<<<< + * """ + * merge_symbol_table(lhs, rhs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.merge_symbol_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13merge_symbol_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_12merge_symbol_table[] = "\n merge_symbol_table(lhs, rhs)\n\n Merges all symbols from the left table into the right.\n\n This function creates a new SymbolTable which is the merger of the two input\n symbol Tables. Symbols in the right-hand table that conflict with those in the\n left-hand table will be assigned values from the left-hand table. Thus the\n returned table will never modify symbol assignments from the left-hand side,\n but may do so on the right.\n\n If the left-hand table is associated with an FST, it may be necessary to\n relabel it using the output table.\n\n Args:\n lhs: Left-hand side SymbolTable.\n rhs: Left-hand side SymbolTable.\n\n Returns:\n A new merged SymbolTable.\n\n See also: `relabel_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_13merge_symbol_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_lhs = 0; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_rhs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("merge_symbol_table (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_rhs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("merge_symbol_table", 1, 2, 2, 1); __PYX_ERR(0, 1118, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge_symbol_table") < 0)) __PYX_ERR(0, 1118, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_lhs = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[0]); + __pyx_v_rhs = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("merge_symbol_table", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1118, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.merge_symbol_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_9pywrapfst__SymbolTable, 1, "lhs", 0))) __PYX_ERR(0, 1118, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_9pywrapfst__SymbolTable, 1, "rhs", 0))) __PYX_ERR(0, 1118, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_12merge_symbol_table(__pyx_self, __pyx_v_lhs, __pyx_v_rhs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12merge_symbol_table(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_lhs, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_rhs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("merge_symbol_table", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_merge_symbol_table(__pyx_v_lhs, __pyx_v_rhs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.merge_symbol_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1157 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator___repr__(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator___repr__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":1158 + * + * def __repr__(self): + * return "".format(id(self)) # <<<<<<<<<<<<<< + * + * def __init__(self, _SymbolTable syms): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_SymbolTableIterator_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1157 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1160 + * return "".format(id(self)) + * + * def __init__(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * self._siter.reset(new fst.SymbolTableIterator(deref(syms._table))) + * + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_19SymbolTableIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_19SymbolTableIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_syms,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_syms)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1160, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_syms = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1160, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_syms), __pyx_ptype_9pywrapfst__SymbolTable, 1, "syms", 0))) __PYX_ERR(0, 1160, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_2__init__(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self), __pyx_v_syms); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_19SymbolTableIterator_2__init__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":1161 + * + * def __init__(self, _SymbolTable syms): + * self._siter.reset(new fst.SymbolTableIterator(deref(syms._table))) # <<<<<<<<<<<<<< + * + * # This just registers this class as a possible iterator. + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 1161, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_syms) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1161, __pyx_L1_error) + } + __pyx_v_self->_siter.reset(new fst::SymbolTableIterator((*__pyx_v_syms->_table))); + + /* "pywrapfst.pyx":1160 + * return "".format(id(self)) + * + * def __init__(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * self._siter.reset(new fst.SymbolTableIterator(deref(syms._table))) + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1164 + * + * # This just registers this class as a possible iterator. + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_4__iter__(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_4__iter__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "pywrapfst.pyx":1165 + * # This just registers this class as a possible iterator. + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * # Magic method used to get a Pythonic API out of the C++ API. + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1164 + * + * # This just registers this class as a possible iterator. + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1168 + * + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done(): + * raise StopIteration + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_7__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_7__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_6__next__(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_6__next__(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + __pyx_t_10basictypes_int64 __pyx_v_value; + std::string __pyx_v_symbol; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "pywrapfst.pyx":1169 + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): + * if self.done(): # <<<<<<<<<<<<<< + * raise StopIteration + * cdef int64 value = self.value() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "done"); + __PYX_ERR(0, 1169, __pyx_L1_error) + } + __pyx_t_1 = (((struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator *)__pyx_v_self->__pyx_vtab)->done(__pyx_v_self, 0) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":1170 + * def __next__(self): + * if self.done(): + * raise StopIteration # <<<<<<<<<<<<<< + * cdef int64 value = self.value() + * cdef string symbol = self.symbol() + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); + __PYX_ERR(0, 1170, __pyx_L1_error) + + /* "pywrapfst.pyx":1169 + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): + * if self.done(): # <<<<<<<<<<<<<< + * raise StopIteration + * cdef int64 value = self.value() + */ + } + + /* "pywrapfst.pyx":1171 + * if self.done(): + * raise StopIteration + * cdef int64 value = self.value() # <<<<<<<<<<<<<< + * cdef string symbol = self.symbol() + * self.next() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "value"); + __PYX_ERR(0, 1171, __pyx_L1_error) + } + __pyx_v_value = ((struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator *)__pyx_v_self->__pyx_vtab)->value(__pyx_v_self, 0); + + /* "pywrapfst.pyx":1172 + * raise StopIteration + * cdef int64 value = self.value() + * cdef string symbol = self.symbol() # <<<<<<<<<<<<<< + * self.next() + * return (value, symbol) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "symbol"); + __PYX_ERR(0, 1172, __pyx_L1_error) + } + __pyx_v_symbol = ((struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator *)__pyx_v_self->__pyx_vtab)->symbol(__pyx_v_self, 0); + + /* "pywrapfst.pyx":1173 + * cdef int64 value = self.value() + * cdef string symbol = self.symbol() + * self.next() # <<<<<<<<<<<<<< + * return (value, symbol) + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "next"); + __PYX_ERR(0, 1173, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator *)__pyx_v_self->__pyx_vtab)->next(__pyx_v_self, 0); + + /* "pywrapfst.pyx":1174 + * cdef string symbol = self.symbol() + * self.next() + * return (value, symbol) # <<<<<<<<<<<<<< + * + * cpdef bool done(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_symbol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1168 + * + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done(): + * raise StopIteration + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1176 + * return (value, symbol) + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_19SymbolTableIterator_done(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("done", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19SymbolTableIterator_9done)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1176, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1185 + * True if the iterator is exhausted, False otherwise. + * """ + * return self._siter.get().Done() # <<<<<<<<<<<<<< + * + * cpdef void next(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 1185, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_siter.get()->Done(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1176 + * return (value, symbol) + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.SymbolTableIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_19SymbolTableIterator_8done[] = "\n done(self)\n\n Indicates whether the iterator is exhausted or not.\n\n Returns:\n True if the iterator is exhausted, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("done (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_8done(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_8done(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("done", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_19SymbolTableIterator_done(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1187 + * return self._siter.get().Done() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_11next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_19SymbolTableIterator_next(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("next", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19SymbolTableIterator_11next)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1193 + * Advances the iterator. + * """ + * self._siter.get().Next() # <<<<<<<<<<<<<< + * + * cpdef void reset(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 1193, __pyx_L1_error) + } + __pyx_v_self->_siter.get()->Next(); + + /* "pywrapfst.pyx":1187 + * return self._siter.get().Done() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.SymbolTableIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_11next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_19SymbolTableIterator_10next[] = "\n next(self)\n\n Advances the iterator.\n "; +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_11next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("next (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_10next(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_10next(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("next", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_19SymbolTableIterator_next(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1195 + * self._siter.get().Next() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_19SymbolTableIterator_reset(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19SymbolTableIterator_13reset)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1201 + * Resets the iterator to the initial position. + * """ + * self._siter.get().Reset() # <<<<<<<<<<<<<< + * + * cpdef string symbol(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 1201, __pyx_L1_error) + } + __pyx_v_self->_siter.get()->Reset(); + + /* "pywrapfst.pyx":1195 + * self._siter.get().Next() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.SymbolTableIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_19SymbolTableIterator_12reset[] = "\n reset(self)\n\n Resets the iterator to the initial position.\n "; +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_12reset(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_12reset(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_19SymbolTableIterator_reset(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1203 + * self._siter.get().Reset() + * + * cpdef string symbol(self): # <<<<<<<<<<<<<< + * """ + * symbol(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_15symbol(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_19SymbolTableIterator_symbol(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("symbol", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19SymbolTableIterator_15symbol)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1203, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1214 + * A symbol string. + * """ + * return self._siter.get().Symbol() # <<<<<<<<<<<<<< + * + * cpdef int64 value(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 1214, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_siter.get()->Symbol(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1203 + * self._siter.get().Reset() + * + * cpdef string symbol(self): # <<<<<<<<<<<<<< + * """ + * symbol(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.SymbolTableIterator.symbol", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_15symbol(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_19SymbolTableIterator_14symbol[] = "\n symbol(self)\n\n Returns the current symbol string.\n\n This method returns the current symbol string at this point in the table.\n\n Returns:\n A symbol string.\n "; +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_15symbol(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("symbol (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_14symbol(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_14symbol(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("symbol", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_19SymbolTableIterator_symbol(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.symbol", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1216 + * return self._siter.get().Symbol() + * + * cpdef int64 value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_17value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_19SymbolTableIterator_value(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_5; + __Pyx_RefNannySetupContext("value", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_19SymbolTableIterator_17value)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1216, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1225 + * An integer index. + * """ + * return self._siter.get().Value() # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 1225, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_siter.get()->Value(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1216 + * return self._siter.get().Symbol() + * + * cpdef int64 value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.SymbolTableIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_17value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_19SymbolTableIterator_16value[] = "\n value(self)\n\n Returns the current integer index of the symbol.\n\n Returns:\n An integer index.\n "; +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_17value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("value (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_16value(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_16value(struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("value", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_f_9pywrapfst_19SymbolTableIterator_value(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_18__reduce_cython__(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_19SymbolTableIterator_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_19SymbolTableIterator_20__setstate_cython__(((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_19SymbolTableIterator_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_SymbolTableIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.SymbolTableIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1254 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper___repr__(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper___repr__(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":1255 + * + * def __repr__(self): + * return "".format(id(self)) # <<<<<<<<<<<<<< + * + * def __init__(self, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_EncodeMapper_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1254 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1257 + * return "".format(id(self)) + * + * def __init__(self, # <<<<<<<<<<<<<< + * arc_type=b"standard", + * bool encode_labels=False, + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_12EncodeMapper_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_12EncodeMapper_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_arc_type = 0; + bool __pyx_v_encode_labels; + bool __pyx_v_encode_weights; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arc_type,&__pyx_n_s_encode_labels,&__pyx_n_s_encode_weights,0}; + PyObject* values[3] = {0,0,0}; + values[0] = ((PyObject *)__pyx_n_b_standard); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arc_type); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encode_labels); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encode_weights); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1257, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_arc_type = values[0]; + if (values[1]) { + __pyx_v_encode_labels = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_encode_labels == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1259, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":1259 + * def __init__(self, + * arc_type=b"standard", + * bool encode_labels=False, # <<<<<<<<<<<<<< + * bool encode_weights=False): + * cdef uint32 flags = fst.GetEncodeFlags(encode_labels, encode_weights) + */ + __pyx_v_encode_labels = ((bool)0); + } + if (values[2]) { + __pyx_v_encode_weights = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_encode_weights == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1260, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":1260 + * arc_type=b"standard", + * bool encode_labels=False, + * bool encode_weights=False): # <<<<<<<<<<<<<< + * cdef uint32 flags = fst.GetEncodeFlags(encode_labels, encode_weights) + * self._encoder.reset(new fst.EncodeMapperClass(tostring(arc_type), flags, + */ + __pyx_v_encode_weights = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1257, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.EncodeMapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_2__init__(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self), __pyx_v_arc_type, __pyx_v_encode_labels, __pyx_v_encode_weights); + + /* "pywrapfst.pyx":1257 + * return "".format(id(self)) + * + * def __init__(self, # <<<<<<<<<<<<<< + * arc_type=b"standard", + * bool encode_labels=False, + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_12EncodeMapper_2__init__(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, PyObject *__pyx_v_arc_type, bool __pyx_v_encode_labels, bool __pyx_v_encode_weights) { + __pyx_t_10basictypes_uint32 __pyx_v_flags; + int __pyx_r; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":1261 + * bool encode_labels=False, + * bool encode_weights=False): + * cdef uint32 flags = fst.GetEncodeFlags(encode_labels, encode_weights) # <<<<<<<<<<<<<< + * self._encoder.reset(new fst.EncodeMapperClass(tostring(arc_type), flags, + * fst.ENCODE)) + */ + __pyx_v_flags = fst::script::GetEncodeFlags(__pyx_v_encode_labels, __pyx_v_encode_weights); + + /* "pywrapfst.pyx":1262 + * bool encode_weights=False): + * cdef uint32 flags = fst.GetEncodeFlags(encode_labels, encode_weights) + * self._encoder.reset(new fst.EncodeMapperClass(tostring(arc_type), flags, # <<<<<<<<<<<<<< + * fst.ENCODE)) + * if not self._encoder: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1262, __pyx_L1_error) + } + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_arc_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1262, __pyx_L1_error) + + /* "pywrapfst.pyx":1263 + * cdef uint32 flags = fst.GetEncodeFlags(encode_labels, encode_weights) + * self._encoder.reset(new fst.EncodeMapperClass(tostring(arc_type), flags, + * fst.ENCODE)) # <<<<<<<<<<<<<< + * if not self._encoder: + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + */ + __pyx_v_self->_encoder.reset(new fst::script::EncodeMapperClass(__pyx_t_1, __pyx_v_flags, fst::ENCODE)); + + /* "pywrapfst.pyx":1264 + * self._encoder.reset(new fst.EncodeMapperClass(tostring(arc_type), flags, + * fst.ENCODE)) + * if not self._encoder: # <<<<<<<<<<<<<< + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1264, __pyx_L1_error) + } + __pyx_t_2 = ((!__pyx_v_self->_encoder) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":1265 + * fst.ENCODE)) + * if not self._encoder: + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) # <<<<<<<<<<<<<< + * + * cpdef string arc_type(self): + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_arc_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_arc_type) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_arc_type); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1265, __pyx_L1_error) + + /* "pywrapfst.pyx":1264 + * self._encoder.reset(new fst.EncodeMapperClass(tostring(arc_type), flags, + * fst.ENCODE)) + * if not self._encoder: # <<<<<<<<<<<<<< + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + * + */ + } + + /* "pywrapfst.pyx":1257 + * return "".format(id(self)) + * + * def __init__(self, # <<<<<<<<<<<<<< + * arc_type=b"standard", + * bool encode_labels=False, + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1267 + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_5arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_12EncodeMapper_arc_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("arc_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_5arc_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1267, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1273 + * Returns a string indicating the arc type. + * """ + * return self._encoder.get().ArcType() # <<<<<<<<<<<<<< + * + * # Python's equivalent to operator(). + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1273, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_encoder.get()->ArcType(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1267 + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.EncodeMapper.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_5arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_4arc_type[] = "\n arc_type(self)\n\n Returns a string indicating the arc type.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_5arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arc_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_4arc_type(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_4arc_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("arc_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_12EncodeMapper_arc_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1277 + * # Python's equivalent to operator(). + * + * def __call__(self, Arc arc): # <<<<<<<<<<<<<< + * """ + * self(state, ilabel, olabel, weight, nextstate) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_6__call__[] = "\n self(state, ilabel, olabel, weight, nextstate)\n\n Uses the encoder to encode an arc.\n\n Args:\n ilabel: The integer index of the input label.\n olabel: The integer index of the output label.\n weight: A Weight or weight string indicating the desired final weight; if\n null, it is set to semiring One.\n nextstate: The integer index of the destination state.\n\n Raises:\n FstOpError: Incompatible or invalid weight.\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_9pywrapfst_12EncodeMapper_6__call__; +#endif +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arc,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arc)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 1277, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_arc = ((struct __pyx_obj_9pywrapfst_Arc *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1277, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.EncodeMapper.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arc), __pyx_ptype_9pywrapfst_Arc, 1, "arc", 0))) __PYX_ERR(0, 1277, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_6__call__(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self), __pyx_v_arc); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_6__call__(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__call__", 0); + + /* "pywrapfst.pyx":1293 + * FstOpError: Incompatible or invalid weight. + * """ + * return _init_Arc(self._encoder.get().__call__(deref(arc._arc))) # <<<<<<<<<<<<<< + * + * cpdef uint32 flags(self): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1293, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_arc) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 1293, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_Arc(__pyx_v_self->_encoder.get()->operator()((*__pyx_v_arc->_arc)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1277 + * # Python's equivalent to operator(). + * + * def __call__(self, Arc arc): # <<<<<<<<<<<<<< + * """ + * self(state, ilabel, olabel, weight, nextstate) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1295 + * return _init_Arc(self._encoder.get().__call__(deref(arc._arc))) + * + * cpdef uint32 flags(self): # <<<<<<<<<<<<<< + * """ + * flags(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_9flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_uint32 __pyx_f_9pywrapfst_12EncodeMapper_flags(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_uint32 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_uint32 __pyx_t_5; + __Pyx_RefNannySetupContext("flags", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_9flags)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1295, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1301 + * Returns the encoder's flags. + * """ + * return self._encoder.get().Flags() # <<<<<<<<<<<<<< + * + * cpdef _EncodeMapperSymbolTable input_symbols(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1301, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_encoder.get()->Flags(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1295 + * return _init_Arc(self._encoder.get().__call__(deref(arc._arc))) + * + * cpdef uint32 flags(self): # <<<<<<<<<<<<<< + * """ + * flags(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.EncodeMapper.flags", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_9flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_8flags[] = "\n flags(self)\n\n Returns the encoder's flags.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_9flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("flags (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_8flags(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_8flags(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("flags", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_f_9pywrapfst_12EncodeMapper_flags(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1303 + * return self._encoder.get().Flags() + * + * cpdef _EncodeMapperSymbolTable input_symbols(self): # <<<<<<<<<<<<<< + * """ + * input_symbols(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_11input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_f_9pywrapfst_12EncodeMapper_input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch) { + fst::SymbolTable *__pyx_v_syms; + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("input_symbols", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_input_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_11input_symbols)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst__EncodeMapperSymbolTable))))) __PYX_ERR(0, 1303, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1310 + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._encoder.get().InputSymbols()) # <<<<<<<<<<<<<< + * if syms == NULL: + * return + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1310, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1309 + * Returns the encoder's input symbol table, or None if none is present. + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( # <<<<<<<<<<<<<< + * self._encoder.get().InputSymbols()) + * if syms == NULL: + */ + __pyx_v_syms = const_cast<__pyx_t_9pywrapfst_SymbolTable_ptr>(__pyx_v_self->_encoder.get()->InputSymbols()); + + /* "pywrapfst.pyx":1311 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._encoder.get().InputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + */ + __pyx_t_5 = ((__pyx_v_syms == NULL) != 0); + if (__pyx_t_5) { + + /* "pywrapfst.pyx":1312 + * self._encoder.get().InputSymbols()) + * if syms == NULL: + * return # <<<<<<<<<<<<<< + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_r = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pywrapfst.pyx":1311 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._encoder.get().InputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + */ + } + + /* "pywrapfst.pyx":1313 + * if syms == NULL: + * return + * return _init_EncodeMapperSymbolTable(syms, self._encoder) # <<<<<<<<<<<<<< + * + * cpdef _EncodeMapperSymbolTable output_symbols(self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1313, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_EncodeMapperSymbolTable(__pyx_v_syms, __pyx_v_self->_encoder)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1303 + * return self._encoder.get().Flags() + * + * cpdef _EncodeMapperSymbolTable input_symbols(self): # <<<<<<<<<<<<<< + * """ + * input_symbols(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_11input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_10input_symbols[] = "\n input_symbols(self)\n\n Returns the encoder's input symbol table, or None if none is present.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_11input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("input_symbols (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_10input_symbols(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_10input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("input_symbols", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_12EncodeMapper_input_symbols(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1315 + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + * + * cpdef _EncodeMapperSymbolTable output_symbols(self): # <<<<<<<<<<<<<< + * """ + * output_symbols(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_13output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_f_9pywrapfst_12EncodeMapper_output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch) { + fst::SymbolTable *__pyx_v_syms; + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("output_symbols", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_output_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_13output_symbols)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst__EncodeMapperSymbolTable))))) __PYX_ERR(0, 1315, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1322 + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._encoder.get().OutputSymbols()) # <<<<<<<<<<<<<< + * if syms == NULL: + * return + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1322, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1321 + * Returns the encoder's output symbol table, or None if none is present. + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( # <<<<<<<<<<<<<< + * self._encoder.get().OutputSymbols()) + * if syms == NULL: + */ + __pyx_v_syms = const_cast<__pyx_t_9pywrapfst_SymbolTable_ptr>(__pyx_v_self->_encoder.get()->OutputSymbols()); + + /* "pywrapfst.pyx":1323 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._encoder.get().OutputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + */ + __pyx_t_5 = ((__pyx_v_syms == NULL) != 0); + if (__pyx_t_5) { + + /* "pywrapfst.pyx":1324 + * self._encoder.get().OutputSymbols()) + * if syms == NULL: + * return # <<<<<<<<<<<<<< + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_r = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pywrapfst.pyx":1323 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._encoder.get().OutputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + */ + } + + /* "pywrapfst.pyx":1325 + * if syms == NULL: + * return + * return _init_EncodeMapperSymbolTable(syms, self._encoder) # <<<<<<<<<<<<<< + * + * cpdef uint64 properties(self, uint64 mask): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1325, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_EncodeMapperSymbolTable(__pyx_v_syms, __pyx_v_self->_encoder)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1315 + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + * + * cpdef _EncodeMapperSymbolTable output_symbols(self): # <<<<<<<<<<<<<< + * """ + * output_symbols(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_13output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_12output_symbols[] = "\n output_symbols(self)\n\n Returns the encoder's output symbol table, or None if none is present.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_13output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("output_symbols (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_12output_symbols(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_12output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("output_symbols", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_12EncodeMapper_output_symbols(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1327 + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + * + * cpdef uint64 properties(self, uint64 mask): # <<<<<<<<<<<<<< + * """ + * properties(self, mask) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_15properties(PyObject *__pyx_v_self, PyObject *__pyx_arg_mask); /*proto*/ +static __pyx_t_10basictypes_uint64 __pyx_f_9pywrapfst_12EncodeMapper_properties(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_uint64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __pyx_t_10basictypes_uint64 __pyx_t_6; + __Pyx_RefNannySetupContext("properties", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_properties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_15properties)) { + __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_mask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1327, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1341 + * A 64-bit bitmask representing the requested properties. + * """ + * return self._encoder.get().Properties(mask) # <<<<<<<<<<<<<< + * + * cpdef void set_input_symbols(self, _SymbolTable syms) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1341, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_encoder.get()->Properties(__pyx_v_mask); + goto __pyx_L0; + + /* "pywrapfst.pyx":1327 + * return _init_EncodeMapperSymbolTable(syms, self._encoder) + * + * cpdef uint64 properties(self, uint64 mask): # <<<<<<<<<<<<<< + * """ + * properties(self, mask) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("pywrapfst.EncodeMapper.properties", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_15properties(PyObject *__pyx_v_self, PyObject *__pyx_arg_mask); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_14properties[] = "\n properties(self, mask)\n\n Provides property bits.\n\n This method provides user access to the properties of the encoder.\n\n Args:\n mask: The property mask to be compared to the encoder's properties.\n\n Returns:\n A 64-bit bitmask representing the requested properties.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_15properties(PyObject *__pyx_v_self, PyObject *__pyx_arg_mask) { + __pyx_t_10basictypes_uint64 __pyx_v_mask; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("properties (wrapper)", 0); + assert(__pyx_arg_mask); { + __pyx_v_mask = __Pyx_PyInt_As_uint64_t(__pyx_arg_mask); if (unlikely((__pyx_v_mask == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1327, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.EncodeMapper.properties", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_14properties(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self), ((__pyx_t_10basictypes_uint64)__pyx_v_mask)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_14properties(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("properties", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_f_9pywrapfst_12EncodeMapper_properties(__pyx_v_self, __pyx_v_mask, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.properties", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1343 + * return self._encoder.get().Properties(mask) + * + * cpdef void set_input_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * """ + * set_input_symbols(self, syms) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_17set_input_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static void __pyx_f_9pywrapfst_12EncodeMapper_set_input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("set_input_symbols", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_input_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_17set_input_symbols)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_syms)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_syms)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1354 + * See also: `set_output_symbols`. + * """ + * self._encoder.get().SetInputSymbols(syms._table) # <<<<<<<<<<<<<< + * + * cpdef void set_output_symbols(self, _SymbolTable syms) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1354, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_syms) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1354, __pyx_L1_error) + } + __pyx_v_self->_encoder.get()->SetInputSymbols(__pyx_v_syms->_table); + + /* "pywrapfst.pyx":1343 + * return self._encoder.get().Properties(mask) + * + * cpdef void set_input_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * """ + * set_input_symbols(self, syms) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.set_input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_17set_input_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_16set_input_symbols[] = "\n set_input_symbols(self, syms)\n\n Sets the encoder's input symbol table.\n\n Args:\n syms: A SymbolTable.\n\n See also: `set_output_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_17set_input_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_input_symbols (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_syms), __pyx_ptype_9pywrapfst__SymbolTable, 1, "syms", 0))) __PYX_ERR(0, 1343, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_16set_input_symbols(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_syms)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_16set_input_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("set_input_symbols", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_9pywrapfst_12EncodeMapper_set_input_symbols(__pyx_v_self, __pyx_v_syms, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.set_input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1356 + * self._encoder.get().SetInputSymbols(syms._table) + * + * cpdef void set_output_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * """ + * set_output_symbols(self, syms) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_19set_output_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static void __pyx_f_9pywrapfst_12EncodeMapper_set_output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("set_output_symbols", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_output_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_19set_output_symbols)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_syms)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_syms)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1367 + * See also: `set_input_symbols`. + * """ + * self._encoder.get().SetOutputSymbols(syms._table) # <<<<<<<<<<<<<< + * + * cpdef string weight_type(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1367, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_syms) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1367, __pyx_L1_error) + } + __pyx_v_self->_encoder.get()->SetOutputSymbols(__pyx_v_syms->_table); + + /* "pywrapfst.pyx":1356 + * self._encoder.get().SetInputSymbols(syms._table) + * + * cpdef void set_output_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * """ + * set_output_symbols(self, syms) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.set_output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_19set_output_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_18set_output_symbols[] = "\n set_output_symbols(self, syms)\n\n Sets the encoder's output symbol table.\n\n Args:\n syms: A SymbolTable.\n\n See also: `set_input_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_19set_output_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_output_symbols (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_syms), __pyx_ptype_9pywrapfst__SymbolTable, 1, "syms", 0))) __PYX_ERR(0, 1356, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_18set_output_symbols(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_syms)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_18set_output_symbols(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("set_output_symbols", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_9pywrapfst_12EncodeMapper_set_output_symbols(__pyx_v_self, __pyx_v_syms, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1356, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.set_output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1369 + * self._encoder.get().SetOutputSymbols(syms._table) + * + * cpdef string weight_type(self): # <<<<<<<<<<<<<< + * """ + * weight_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_21weight_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_12EncodeMapper_weight_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("weight_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_weight_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_12EncodeMapper_21weight_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1375 + * Returns a string indicating the weight type. + * """ + * return self._encoder.get().WeightType() # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1375, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_encoder.get()->WeightType(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1369 + * self._encoder.get().SetOutputSymbols(syms._table) + * + * cpdef string weight_type(self): # <<<<<<<<<<<<<< + * """ + * weight_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.EncodeMapper.weight_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_21weight_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_12EncodeMapper_20weight_type[] = "\n weight_type(self)\n\n Returns a string indicating the weight type.\n "; +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_21weight_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("weight_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_20weight_type(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_20weight_type(struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("weight_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_12EncodeMapper_weight_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.weight_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_22__reduce_cython__(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_12EncodeMapper_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_12EncodeMapper_24__setstate_cython__(((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_12EncodeMapper_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.EncodeMapper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1401 + * + * @staticmethod + * cdef string _local_render_svg(const string &dot): # <<<<<<<<<<<<<< + * proc = subprocess.Popen(("dot", "-Tsvg"), + * stdin=subprocess.PIPE, + */ + +static std::string __pyx_f_9pywrapfst_4_Fst__local_render_svg(std::string const &__pyx_v_dot) { + PyObject *__pyx_v_proc = NULL; + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("_local_render_svg", 0); + + /* "pywrapfst.pyx":1402 + * @staticmethod + * cdef string _local_render_svg(const string &dot): + * proc = subprocess.Popen(("dot", "-Tsvg"), # <<<<<<<<<<<<<< + * stdin=subprocess.PIPE, + * stdout=subprocess.PIPE) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Popen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":1403 + * cdef string _local_render_svg(const string &dot): + * proc = subprocess.Popen(("dot", "-Tsvg"), + * stdin=subprocess.PIPE, # <<<<<<<<<<<<<< + * stdout=subprocess.PIPE) + * return proc.communicate(dot.encode("utf8"))[0] + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_stdin, __pyx_t_4) < 0) __PYX_ERR(0, 1403, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pywrapfst.pyx":1404 + * proc = subprocess.Popen(("dot", "-Tsvg"), + * stdin=subprocess.PIPE, + * stdout=subprocess.PIPE) # <<<<<<<<<<<<<< + * return proc.communicate(dot.encode("utf8"))[0] + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_stdout, __pyx_t_3) < 0) __PYX_ERR(0, 1403, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pywrapfst.pyx":1402 + * @staticmethod + * cdef string _local_render_svg(const string &dot): + * proc = subprocess.Popen(("dot", "-Tsvg"), # <<<<<<<<<<<<<< + * stdin=subprocess.PIPE, + * stdout=subprocess.PIPE) + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_proc = __pyx_t_3; + __pyx_t_3 = 0; + + /* "pywrapfst.pyx":1405 + * stdin=subprocess.PIPE, + * stdout=subprocess.PIPE) + * return proc.communicate(dot.encode("utf8"))[0] # <<<<<<<<<<<<<< + * + * def _repr_svg_(self): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_communicate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 1405, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L0; + + /* "pywrapfst.pyx":1401 + * + * @staticmethod + * cdef string _local_render_svg(const string &dot): # <<<<<<<<<<<<<< + * proc = subprocess.Popen(("dot", "-Tsvg"), + * stdin=subprocess.PIPE, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._Fst._local_render_svg", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_proc); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1407 + * return proc.communicate(dot.encode("utf8"))[0] + * + * def _repr_svg_(self): # <<<<<<<<<<<<<< + * """IPython notebook magic to produce an SVG of the FST using GraphViz. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_1_repr_svg_(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst__repr_svg_[] = "IPython notebook magic to produce an SVG of the FST using GraphViz.\n\n This method produces an SVG of the internal graph. Users wishing to create\n publication-quality graphs should instead use the method `draw`, which\n exposes additional parameters.\n\n See also: `draw`, `text`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_1_repr_svg_(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_repr_svg_ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst__repr_svg_(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst__repr_svg_(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + std::stringstream __pyx_v_sstrm; + bool __pyx_v_acceptor; + PyObject *__pyx_v_e = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + char const *__pyx_t_13; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + __Pyx_RefNannySetupContext("_repr_svg_", 0); + + /* "pywrapfst.pyx":1417 + * """ + * cdef stringstream sstrm + * cdef bool acceptor = (self._fst.get().Properties(fst.kAcceptor, True) == # <<<<<<<<<<<<<< + * fst.kAcceptor) + * fst.DrawFst(deref(self._fst), self._fst.get().InputSymbols(), + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1417, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1418 + * cdef stringstream sstrm + * cdef bool acceptor = (self._fst.get().Properties(fst.kAcceptor, True) == + * fst.kAcceptor) # <<<<<<<<<<<<<< + * fst.DrawFst(deref(self._fst), self._fst.get().InputSymbols(), + * self._fst.get().OutputSymbols(), NULL, acceptor, + */ + __pyx_v_acceptor = (__pyx_v_self->_fst.get()->Properties(fst::kAcceptor, 1) == fst::kAcceptor); + + /* "pywrapfst.pyx":1419 + * cdef bool acceptor = (self._fst.get().Properties(fst.kAcceptor, True) == + * fst.kAcceptor) + * fst.DrawFst(deref(self._fst), self._fst.get().InputSymbols(), # <<<<<<<<<<<<<< + * self._fst.get().OutputSymbols(), NULL, acceptor, + * b"", 8.5, 11, True, False, 0.4, 0.25, 14, 5, b"g", False, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1419, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1419, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1420 + * fst.kAcceptor) + * fst.DrawFst(deref(self._fst), self._fst.get().InputSymbols(), + * self._fst.get().OutputSymbols(), NULL, acceptor, # <<<<<<<<<<<<<< + * b"", 8.5, 11, True, False, 0.4, 0.25, 14, 5, b"g", False, + * addr(sstrm), b"") + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1420, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1419 + * cdef bool acceptor = (self._fst.get().Properties(fst.kAcceptor, True) == + * fst.kAcceptor) + * fst.DrawFst(deref(self._fst), self._fst.get().InputSymbols(), # <<<<<<<<<<<<<< + * self._fst.get().OutputSymbols(), NULL, acceptor, + * b"", 8.5, 11, True, False, 0.4, 0.25, 14, 5, b"g", False, + */ + fst::script::DrawFst((*__pyx_v_self->_fst), __pyx_v_self->_fst.get()->InputSymbols(), __pyx_v_self->_fst.get()->OutputSymbols(), NULL, __pyx_v_acceptor, __pyx_k__10, 8.5, 11.0, 1, 0, 0.4, 0.25, 14, 5, __pyx_k_g, 0, (&__pyx_v_sstrm), __pyx_k_pywrapfst); + + /* "pywrapfst.pyx":1423 + * b"", 8.5, 11, True, False, 0.4, 0.25, 14, 5, b"g", False, + * addr(sstrm), b"") + * try: # <<<<<<<<<<<<<< + * return _Fst._local_render_svg(sstrm.str()) + * except Exception as e: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "pywrapfst.pyx":1424 + * addr(sstrm), b"") + * try: + * return _Fst._local_render_svg(sstrm.str()) # <<<<<<<<<<<<<< + * except Exception as e: + * logging.error("Dot rendering failed: %s", e) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_4_Fst__local_render_svg(__pyx_v_sstrm.str())); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1424, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L7_try_return; + + /* "pywrapfst.pyx":1423 + * b"", 8.5, 11, True, False, 0.4, 0.25, 14, 5, b"g", False, + * addr(sstrm), b"") + * try: # <<<<<<<<<<<<<< + * return _Fst._local_render_svg(sstrm.str()) + * except Exception as e: + */ + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pywrapfst.pyx":1425 + * try: + * return _Fst._local_render_svg(sstrm.str()) + * except Exception as e: # <<<<<<<<<<<<<< + * logging.error("Dot rendering failed: %s", e) + * + */ + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_5) { + __Pyx_AddTraceback("pywrapfst._Fst._repr_svg_", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1425, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __pyx_v_e = __pyx_t_6; + /*try:*/ { + + /* "pywrapfst.pyx":1426 + * return _Fst._local_render_svg(sstrm.str()) + * except Exception as e: + * logging.error("Dot rendering failed: %s", e) # <<<<<<<<<<<<<< + * + * def __init__(self): + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_logging); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1426, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1426, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_u_Dot_rendering_failed_s, __pyx_v_e}; + __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1426, __pyx_L14_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_8); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_u_Dot_rendering_failed_s, __pyx_v_e}; + __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1426, __pyx_L14_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_8); + } else + #endif + { + __pyx_t_11 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1426, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_11); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_INCREF(__pyx_kp_u_Dot_rendering_failed_s); + __Pyx_GIVEREF(__pyx_kp_u_Dot_rendering_failed_s); + PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_5, __pyx_kp_u_Dot_rendering_failed_s); + __Pyx_INCREF(__pyx_v_e); + __Pyx_GIVEREF(__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_5, __pyx_v_e); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1426, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + + /* "pywrapfst.pyx":1425 + * try: + * return _Fst._local_render_svg(sstrm.str()) + * except Exception as e: # <<<<<<<<<<<<<< + * logging.error("Dot rendering failed: %s", e) + * + */ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_DECREF(__pyx_v_e); + __pyx_v_e = NULL; + goto __pyx_L15; + } + __pyx_L14_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_t_19); + __pyx_t_5 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; + { + __Pyx_DECREF(__pyx_v_e); + __pyx_v_e = NULL; + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); + } + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16); + __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; + __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; + goto __pyx_L5_except_error; + } + __pyx_L15:; + } + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L4_exception_handled; + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; + + /* "pywrapfst.pyx":1423 + * b"", 8.5, 11, True, False, 0.4, 0.25, 14, 5, b"g", False, + * addr(sstrm), b"") + * try: # <<<<<<<<<<<<<< + * return _Fst._local_render_svg(sstrm.str()) + * except Exception as e: + */ + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L7_try_return:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L0; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + } + + /* "pywrapfst.pyx":1407 + * return proc.communicate(dot.encode("utf8"))[0] + * + * def _repr_svg_(self): # <<<<<<<<<<<<<< + * """IPython notebook magic to produce an SVG of the FST using GraphViz. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("pywrapfst._Fst._repr_svg_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1428 + * logging.error("Dot rendering failed: %s", e) + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_4_Fst_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_4_Fst_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_2__init__(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_4_Fst_2__init__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":1429 + * + * def __init__(self): + * raise FstDeletedConstructorError( # <<<<<<<<<<<<<< + * "Cannot construct {}".format(self.__class__.__name__)) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstDeletedConstructorError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":1430 + * def __init__(self): + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) # <<<<<<<<<<<<<< + * + * # Registers the class for pickling; must be repeated in any subclass which + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Cannot_construct, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1429, __pyx_L1_error) + + /* "pywrapfst.pyx":1428 + * logging.error("Dot rendering failed: %s", e) + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pywrapfst._Fst.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1435 + * # can't be derived by _init_XFst. + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (_read_Fst_from_string, (self.write_to_string(),)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_4__reduce__(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_4__reduce__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "pywrapfst.pyx":1436 + * + * def __reduce__(self): + * return (_read_Fst_from_string, (self.write_to_string(),)) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_read_Fst_from_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "write_to_string"); + __PYX_ERR(0, 1436, __pyx_L1_error) + } + __pyx_t_2 = ((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_self->__pyx_vtab)->write_to_string(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1435 + * # can't be derived by _init_XFst. + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (_read_Fst_from_string, (self.write_to_string(),)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst._Fst.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1438 + * return (_read_Fst_from_string, (self.write_to_string(),)) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} Fst at 0x{:x}>".format(self.fst_type(), id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_7__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_7__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_6__repr__(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_6__repr__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":1439 + * + * def __repr__(self): + * return "<{} Fst at 0x{:x}>".format(self.fst_type(), id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Fst_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "fst_type"); + __PYX_ERR(0, 1439, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_self->__pyx_vtab)->fst_type(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1438 + * return (_read_Fst_from_string, (self.write_to_string(),)) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} Fst at 0x{:x}>".format(self.fst_type(), id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._Fst.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1441 + * return "<{} Fst at 0x{:x}>".format(self.fst_type(), id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return self.text() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_9__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_9__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_8__str__(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_8__str__(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "pywrapfst.pyx":1442 + * + * def __str__(self): + * return self.text() # <<<<<<<<<<<<<< + * + * cpdef string arc_type(self): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "text"); + __PYX_ERR(0, 1442, __pyx_L1_error) + } + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_self->__pyx_vtab)->text(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1441 + * return "<{} Fst at 0x{:x}>".format(self.fst_type(), id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return self.text() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1444 + * return self.text() + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_11arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_arc_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("arc_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_11arc_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1450 + * Returns a string indicating the arc type. + * """ + * return self._fst.get().ArcType() # <<<<<<<<<<<<<< + * + * cpdef ArcIterator arcs(self, int64 state): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1450, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_fst.get()->ArcType(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1444 + * return self.text() + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._Fst.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_11arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_10arc_type[] = "\n arc_type(self)\n\n Returns a string indicating the arc type.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_11arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arc_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_10arc_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_10arc_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("arc_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_4_Fst_arc_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1452 + * return self._fst.get().ArcType() + * + * cpdef ArcIterator arcs(self, int64 state): # <<<<<<<<<<<<<< + * """ + * arcs(self, state) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_13arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_f_9pywrapfst_4_Fst_arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("arcs", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_arcs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_13arcs)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst_ArcIterator))))) __PYX_ERR(0, 1452, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1466 + * See also: `mutable_arcs`, `states`. + * """ + * return ArcIterator(self, state) # <<<<<<<<<<<<<< + * + * cpdef _Fst copy(self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9pywrapfst_ArcIterator), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1452 + * return self._fst.get().ArcType() + * + * cpdef ArcIterator arcs(self, int64 state): # <<<<<<<<<<<<<< + * """ + * arcs(self, state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._Fst.arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_13arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_12arcs[] = "\n arcs(self, state)\n\n Returns an iterator over arcs leaving the specified state.\n\n Args:\n state: The source state ID.\n\n Returns:\n An ArcIterator.\n\n See also: `mutable_arcs`, `states`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_13arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arcs (wrapper)", 0); + assert(__pyx_arg_state); { + __pyx_v_state = __Pyx_PyInt_As_int64_t(__pyx_arg_state); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1452, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_12arcs(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_12arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("arcs", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_4_Fst_arcs(__pyx_v_self, __pyx_v_state, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1468 + * return ArcIterator(self, state) + * + * cpdef _Fst copy(self): # <<<<<<<<<<<<<< + * """ + * copy(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_4_Fst_copy(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_15copy)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst__Fst))))) __PYX_ERR(0, 1468, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1474 + * Makes a copy of the FST. + * """ + * return _init_XFst(new fst.FstClass(deref(self._fst))) # <<<<<<<<<<<<<< + * + * cpdef void draw(self, + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1474, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_XFst(new fst::script::FstClass((*__pyx_v_self->_fst)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1468 + * return ArcIterator(self, state) + * + * cpdef _Fst copy(self): # <<<<<<<<<<<<<< + * """ + * copy(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._Fst.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_14copy[] = "\n copy(self)\n\n Makes a copy of the FST.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_14copy(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_14copy(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_4_Fst_copy(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1476 + * return _init_XFst(new fst.FstClass(deref(self._fst))) + * + * cpdef void draw(self, # <<<<<<<<<<<<<< + * filename, + * _SymbolTable isymbols=None, + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_17draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_9pywrapfst_4_Fst_draw(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_draw *__pyx_optional_args) { + + /* "pywrapfst.pyx":1478 + * cpdef void draw(self, + * filename, + * _SymbolTable isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable osymbols=None, + * SymbolTable ssymbols=None, + */ + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1479 + * filename, + * _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, # <<<<<<<<<<<<<< + * SymbolTable ssymbols=None, + * bool acceptor=False, + */ + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1480 + * _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, + * SymbolTable ssymbols=None, # <<<<<<<<<<<<<< + * bool acceptor=False, + * title=b"", + */ + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_ssymbols = ((struct __pyx_obj_9pywrapfst_SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1481 + * _SymbolTable osymbols=None, + * SymbolTable ssymbols=None, + * bool acceptor=False, # <<<<<<<<<<<<<< + * title=b"", + * double width=8.5, + */ + bool __pyx_v_acceptor = ((bool)0); + PyObject *__pyx_v_title = ((PyObject *)__pyx_kp_b__10); + double __pyx_v_width = ((double)8.5); + double __pyx_v_height = ((double)11.0); + + /* "pywrapfst.pyx":1485 + * double width=8.5, + * double height=11, + * bool portrait=False, # <<<<<<<<<<<<<< + * bool vertical=False, + * double ranksep=0.4, + */ + bool __pyx_v_portrait = ((bool)0); + + /* "pywrapfst.pyx":1486 + * double height=11, + * bool portrait=False, + * bool vertical=False, # <<<<<<<<<<<<<< + * double ranksep=0.4, + * double nodesep=0.25, + */ + bool __pyx_v_vertical = ((bool)0); + double __pyx_v_ranksep = ((double)0.4); + double __pyx_v_nodesep = ((double)0.25); + __pyx_t_10basictypes_int32 __pyx_v_fontsize = ((__pyx_t_10basictypes_int32)14); + __pyx_t_10basictypes_int32 __pyx_v_precision = ((__pyx_t_10basictypes_int32)5); + PyObject *__pyx_v_float_format = ((PyObject *)__pyx_n_b_g); + + /* "pywrapfst.pyx":1492 + * int32 precision=5, + * float_format=b"g", + * bool show_weight_one=False): # <<<<<<<<<<<<<< + * """ + * draw(self, filename, isymbols=None, osymbols=None, ssymbols=None, + */ + bool __pyx_v_show_weight_one = ((bool)0); + std::string __pyx_v_filename_string; + std::unique_ptr __pyx_v_ostrm; + fst::SymbolTable *__pyx_v_ssymbols_ptr; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + std::string __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + fst::SymbolTable *__pyx_t_20; + fst::SymbolTable const *__pyx_t_21; + fst::SymbolTable const *__pyx_t_22; + std::string __pyx_t_23; + __Pyx_RefNannySetupContext("draw", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_isymbols = __pyx_optional_args->isymbols; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_osymbols = __pyx_optional_args->osymbols; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_ssymbols = __pyx_optional_args->ssymbols; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_acceptor = __pyx_optional_args->acceptor; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_title = __pyx_optional_args->title; + if (__pyx_optional_args->__pyx_n > 5) { + __pyx_v_width = __pyx_optional_args->width; + if (__pyx_optional_args->__pyx_n > 6) { + __pyx_v_height = __pyx_optional_args->height; + if (__pyx_optional_args->__pyx_n > 7) { + __pyx_v_portrait = __pyx_optional_args->portrait; + if (__pyx_optional_args->__pyx_n > 8) { + __pyx_v_vertical = __pyx_optional_args->vertical; + if (__pyx_optional_args->__pyx_n > 9) { + __pyx_v_ranksep = __pyx_optional_args->ranksep; + if (__pyx_optional_args->__pyx_n > 10) { + __pyx_v_nodesep = __pyx_optional_args->nodesep; + if (__pyx_optional_args->__pyx_n > 11) { + __pyx_v_fontsize = __pyx_optional_args->fontsize; + if (__pyx_optional_args->__pyx_n > 12) { + __pyx_v_precision = __pyx_optional_args->precision; + if (__pyx_optional_args->__pyx_n > 13) { + __pyx_v_float_format = __pyx_optional_args->float_format; + if (__pyx_optional_args->__pyx_n > 14) { + __pyx_v_show_weight_one = __pyx_optional_args->show_weight_one; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + + /* "pywrapfst.pyx":1476 + * return _init_XFst(new fst.FstClass(deref(self._fst))) + * + * cpdef void draw(self, # <<<<<<<<<<<<<< + * filename, + * _SymbolTable isymbols=None, + */ + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_17draw)) { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_acceptor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_portrait); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_vertical); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_ranksep); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_nodesep); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyInt_From_int32_t(__pyx_v_fontsize); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyInt_From_int32_t(__pyx_v_precision); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_v_show_weight_one); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_13 = __pyx_t_1; __pyx_t_14 = NULL; + __pyx_t_15 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_15 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_13)) { + PyObject *__pyx_temp[17] = {__pyx_t_14, __pyx_v_filename, ((PyObject *)__pyx_v_isymbols), ((PyObject *)__pyx_v_osymbols), ((PyObject *)__pyx_v_ssymbols), __pyx_t_3, __pyx_v_title, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_v_float_format, __pyx_t_12}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 16+__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { + PyObject *__pyx_temp[17] = {__pyx_t_14, __pyx_v_filename, ((PyObject *)__pyx_v_isymbols), ((PyObject *)__pyx_v_osymbols), ((PyObject *)__pyx_v_ssymbols), __pyx_t_3, __pyx_v_title, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_v_float_format, __pyx_t_12}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 16+__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + #endif + { + __pyx_t_16 = PyTuple_New(16+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + if (__pyx_t_14) { + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL; + } + __Pyx_INCREF(__pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_v_filename); + __Pyx_INCREF(((PyObject *)__pyx_v_isymbols)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_isymbols)); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, ((PyObject *)__pyx_v_isymbols)); + __Pyx_INCREF(((PyObject *)__pyx_v_osymbols)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_osymbols)); + PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_15, ((PyObject *)__pyx_v_osymbols)); + __Pyx_INCREF(((PyObject *)__pyx_v_ssymbols)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ssymbols)); + PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_15, ((PyObject *)__pyx_v_ssymbols)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_15, __pyx_t_3); + __Pyx_INCREF(__pyx_v_title); + __Pyx_GIVEREF(__pyx_v_title); + PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_15, __pyx_v_title); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_16, 6+__pyx_t_15, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_16, 7+__pyx_t_15, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_16, 8+__pyx_t_15, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_16, 9+__pyx_t_15, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_16, 10+__pyx_t_15, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_16, 11+__pyx_t_15, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_16, 12+__pyx_t_15, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_16, 13+__pyx_t_15, __pyx_t_11); + __Pyx_INCREF(__pyx_v_float_format); + __Pyx_GIVEREF(__pyx_v_float_format); + PyTuple_SET_ITEM(__pyx_t_16, 14+__pyx_t_15, __pyx_v_float_format); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_16, 15+__pyx_t_15, __pyx_t_12); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1526 + * See also: `text`. + * """ + * cdef string filename_string = tostring(filename) # <<<<<<<<<<<<<< + * cdef unique_ptr[ofstream] ostrm + * ostrm.reset(new ofstream(filename_string)) + */ + __pyx_t_17 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1526, __pyx_L1_error) + __pyx_v_filename_string = __pyx_t_17; + + /* "pywrapfst.pyx":1528 + * cdef string filename_string = tostring(filename) + * cdef unique_ptr[ofstream] ostrm + * ostrm.reset(new ofstream(filename_string)) # <<<<<<<<<<<<<< + * cdef fst.SymbolTable *ssymbols_ptr = NULL + * if ssymbols is not None: + */ + __pyx_v_ostrm.reset(new std::ofstream(__pyx_v_filename_string)); + + /* "pywrapfst.pyx":1529 + * cdef unique_ptr[ofstream] ostrm + * ostrm.reset(new ofstream(filename_string)) + * cdef fst.SymbolTable *ssymbols_ptr = NULL # <<<<<<<<<<<<<< + * if ssymbols is not None: + * ssymbols_ptr = ssymbols._table + */ + __pyx_v_ssymbols_ptr = NULL; + + /* "pywrapfst.pyx":1530 + * ostrm.reset(new ofstream(filename_string)) + * cdef fst.SymbolTable *ssymbols_ptr = NULL + * if ssymbols is not None: # <<<<<<<<<<<<<< + * ssymbols_ptr = ssymbols._table + * fst.DrawFst(deref(self._fst), + */ + __pyx_t_18 = (((PyObject *)__pyx_v_ssymbols) != Py_None); + __pyx_t_19 = (__pyx_t_18 != 0); + if (__pyx_t_19) { + + /* "pywrapfst.pyx":1531 + * cdef fst.SymbolTable *ssymbols_ptr = NULL + * if ssymbols is not None: + * ssymbols_ptr = ssymbols._table # <<<<<<<<<<<<<< + * fst.DrawFst(deref(self._fst), + * self._fst.get().InputSymbols() if isymbols is None + */ + if (unlikely(((PyObject *)__pyx_v_ssymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1531, __pyx_L1_error) + } + __pyx_t_20 = __pyx_v_ssymbols->__pyx_base.__pyx_base._table; + __pyx_v_ssymbols_ptr = __pyx_t_20; + + /* "pywrapfst.pyx":1530 + * ostrm.reset(new ofstream(filename_string)) + * cdef fst.SymbolTable *ssymbols_ptr = NULL + * if ssymbols is not None: # <<<<<<<<<<<<<< + * ssymbols_ptr = ssymbols._table + * fst.DrawFst(deref(self._fst), + */ + } + + /* "pywrapfst.pyx":1532 + * if ssymbols is not None: + * ssymbols_ptr = ssymbols._table + * fst.DrawFst(deref(self._fst), # <<<<<<<<<<<<<< + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1532, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1533 + * ssymbols_ptr = ssymbols._table + * fst.DrawFst(deref(self._fst), + * self._fst.get().InputSymbols() if isymbols is None # <<<<<<<<<<<<<< + * else isymbols._table, + * self._fst.get().OutputSymbols() if osymbols is None + */ + __pyx_t_19 = (((PyObject *)__pyx_v_isymbols) == Py_None); + if ((__pyx_t_19 != 0)) { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1533, __pyx_L1_error) + } + __pyx_t_21 = __pyx_v_self->_fst.get()->InputSymbols(); + } else { + + /* "pywrapfst.pyx":1534 + * fst.DrawFst(deref(self._fst), + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, # <<<<<<<<<<<<<< + * self._fst.get().OutputSymbols() if osymbols is None + * else osymbols._table, + */ + if (unlikely(((PyObject *)__pyx_v_isymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1534, __pyx_L1_error) + } + __pyx_t_21 = __pyx_v_isymbols->_table; + } + + /* "pywrapfst.pyx":1535 + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, + * self._fst.get().OutputSymbols() if osymbols is None # <<<<<<<<<<<<<< + * else osymbols._table, + * ssymbols_ptr, acceptor, tostring(title), width, height, portrait, + */ + __pyx_t_19 = (((PyObject *)__pyx_v_osymbols) == Py_None); + if ((__pyx_t_19 != 0)) { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1535, __pyx_L1_error) + } + __pyx_t_22 = __pyx_v_self->_fst.get()->OutputSymbols(); + } else { + + /* "pywrapfst.pyx":1536 + * else isymbols._table, + * self._fst.get().OutputSymbols() if osymbols is None + * else osymbols._table, # <<<<<<<<<<<<<< + * ssymbols_ptr, acceptor, tostring(title), width, height, portrait, + * vertical, ranksep, nodesep, fontsize, precision, + */ + if (unlikely(((PyObject *)__pyx_v_osymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1536, __pyx_L1_error) + } + __pyx_t_22 = __pyx_v_osymbols->_table; + } + + /* "pywrapfst.pyx":1537 + * self._fst.get().OutputSymbols() if osymbols is None + * else osymbols._table, + * ssymbols_ptr, acceptor, tostring(title), width, height, portrait, # <<<<<<<<<<<<<< + * vertical, ranksep, nodesep, fontsize, precision, + * tostring(float_format), show_weight_one, ostrm.get(), + */ + __pyx_t_17 = __pyx_f_9pywrapfst_tostring(__pyx_v_title); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1537, __pyx_L1_error) + + /* "pywrapfst.pyx":1539 + * ssymbols_ptr, acceptor, tostring(title), width, height, portrait, + * vertical, ranksep, nodesep, fontsize, precision, + * tostring(float_format), show_weight_one, ostrm.get(), # <<<<<<<<<<<<<< + * filename_string) + * + */ + __pyx_t_23 = __pyx_f_9pywrapfst_tostring(__pyx_v_float_format); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1539, __pyx_L1_error) + + /* "pywrapfst.pyx":1532 + * if ssymbols is not None: + * ssymbols_ptr = ssymbols._table + * fst.DrawFst(deref(self._fst), # <<<<<<<<<<<<<< + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, + */ + fst::script::DrawFst((*__pyx_v_self->_fst), __pyx_t_21, __pyx_t_22, __pyx_v_ssymbols_ptr, __pyx_v_acceptor, __pyx_t_17, __pyx_v_width, __pyx_v_height, __pyx_v_portrait, __pyx_v_vertical, __pyx_v_ranksep, __pyx_v_nodesep, __pyx_v_fontsize, __pyx_v_precision, __pyx_t_23, __pyx_v_show_weight_one, __pyx_v_ostrm.get(), __pyx_v_filename_string); + + /* "pywrapfst.pyx":1476 + * return _init_XFst(new fst.FstClass(deref(self._fst))) + * + * cpdef void draw(self, # <<<<<<<<<<<<<< + * filename, + * _SymbolTable isymbols=None, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_WriteUnraisable("pywrapfst._Fst.draw", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_17draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_16draw[] = "\n draw(self, filename, isymbols=None, osymbols=None, ssymbols=None,\n acceptor=False, title=\"\", width=8.5, height=11, portrait=False,\n vertical=False, ranksep=0.4, nodesep=0.25, fontsize=14,\n precision=5, float_format=\"g\", show_weight_one=False):\n\n Writes out the FST in Graphviz text format.\n\n This method writes out the FST in the dot graph description language. The\n graph can be rendered using the `dot` executable provided by Graphviz.\n\n Args:\n filename: The string location of the output dot/Graphviz file.\n isymbols: An optional symbol table used to label input symbols.\n osymbols: An optional symbol table used to label output symbols.\n ssymbols: An optional symbol table used to label states.\n acceptor: Should the figure be rendered in acceptor format if possible?\n title: An optional string indicating the figure title.\n width: The figure width, in inches.\n height: The figure height, in inches.\n portrait: Should the figure be rendered in portrait rather than\n landscape?\n vertical: Should the figure be rendered bottom-to-top rather than\n left-to-right?\n ranksep: The minimum separation separation between ranks, in inches.\n nodesep: The minimum separation between nodes, in inches.\n fontsize: Font size, in points.\n precision: Numeric precision for floats, in number of chars.\n float_format: One of: 'e', 'f' or 'g'.\n show_weight_one: Should weights equivalent to semiring One be printed?\n\n See also: `text`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_17draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols = 0; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols = 0; + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_ssymbols = 0; + bool __pyx_v_acceptor; + PyObject *__pyx_v_title = 0; + double __pyx_v_width; + double __pyx_v_height; + bool __pyx_v_portrait; + bool __pyx_v_vertical; + double __pyx_v_ranksep; + double __pyx_v_nodesep; + __pyx_t_10basictypes_int32 __pyx_v_fontsize; + __pyx_t_10basictypes_int32 __pyx_v_precision; + PyObject *__pyx_v_float_format = 0; + bool __pyx_v_show_weight_one; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("draw (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_isymbols,&__pyx_n_s_osymbols,&__pyx_n_s_ssymbols,&__pyx_n_s_acceptor,&__pyx_n_s_title,&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_portrait,&__pyx_n_s_vertical,&__pyx_n_s_ranksep,&__pyx_n_s_nodesep,&__pyx_n_s_fontsize,&__pyx_n_s_precision,&__pyx_n_s_float_format,&__pyx_n_s_show_weight_one,0}; + PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + + /* "pywrapfst.pyx":1478 + * cpdef void draw(self, + * filename, + * _SymbolTable isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable osymbols=None, + * SymbolTable ssymbols=None, + */ + values[1] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1479 + * filename, + * _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, # <<<<<<<<<<<<<< + * SymbolTable ssymbols=None, + * bool acceptor=False, + */ + values[2] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1480 + * _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, + * SymbolTable ssymbols=None, # <<<<<<<<<<<<<< + * bool acceptor=False, + * title=b"", + */ + values[3] = (PyObject *)((struct __pyx_obj_9pywrapfst_SymbolTable *)Py_None); + values[5] = ((PyObject *)__pyx_kp_b__10); + values[14] = ((PyObject *)__pyx_n_b_g); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); + CYTHON_FALLTHROUGH; + case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + CYTHON_FALLTHROUGH; + case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isymbols); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_osymbols); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ssymbols); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acceptor); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_title); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width); + if (value) { values[6] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height); + if (value) { values[7] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_portrait); + if (value) { values[8] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 9: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vertical); + if (value) { values[9] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 10: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ranksep); + if (value) { values[10] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 11: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodesep); + if (value) { values[11] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 12: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fontsize); + if (value) { values[12] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 13: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision); + if (value) { values[13] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 14: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_float_format); + if (value) { values[14] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 15: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_show_weight_one); + if (value) { values[15] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw") < 0)) __PYX_ERR(0, 1476, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); + CYTHON_FALLTHROUGH; + case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + CYTHON_FALLTHROUGH; + case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_filename = values[0]; + __pyx_v_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[1]); + __pyx_v_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[2]); + __pyx_v_ssymbols = ((struct __pyx_obj_9pywrapfst_SymbolTable *)values[3]); + if (values[4]) { + __pyx_v_acceptor = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_acceptor == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1481, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":1481 + * _SymbolTable osymbols=None, + * SymbolTable ssymbols=None, + * bool acceptor=False, # <<<<<<<<<<<<<< + * title=b"", + * double width=8.5, + */ + __pyx_v_acceptor = ((bool)0); + } + __pyx_v_title = values[5]; + if (values[6]) { + __pyx_v_width = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_width == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L3_error) + } else { + __pyx_v_width = ((double)8.5); + } + if (values[7]) { + __pyx_v_height = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_height == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1484, __pyx_L3_error) + } else { + __pyx_v_height = ((double)11.0); + } + if (values[8]) { + __pyx_v_portrait = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_portrait == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1485, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":1485 + * double width=8.5, + * double height=11, + * bool portrait=False, # <<<<<<<<<<<<<< + * bool vertical=False, + * double ranksep=0.4, + */ + __pyx_v_portrait = ((bool)0); + } + if (values[9]) { + __pyx_v_vertical = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_vertical == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1486, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":1486 + * double height=11, + * bool portrait=False, + * bool vertical=False, # <<<<<<<<<<<<<< + * double ranksep=0.4, + * double nodesep=0.25, + */ + __pyx_v_vertical = ((bool)0); + } + if (values[10]) { + __pyx_v_ranksep = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_ranksep == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1487, __pyx_L3_error) + } else { + __pyx_v_ranksep = ((double)0.4); + } + if (values[11]) { + __pyx_v_nodesep = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_nodesep == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1488, __pyx_L3_error) + } else { + __pyx_v_nodesep = ((double)0.25); + } + if (values[12]) { + __pyx_v_fontsize = __Pyx_PyInt_As_int32_t(values[12]); if (unlikely((__pyx_v_fontsize == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1489, __pyx_L3_error) + } else { + __pyx_v_fontsize = ((__pyx_t_10basictypes_int32)14); + } + if (values[13]) { + __pyx_v_precision = __Pyx_PyInt_As_int32_t(values[13]); if (unlikely((__pyx_v_precision == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1490, __pyx_L3_error) + } else { + __pyx_v_precision = ((__pyx_t_10basictypes_int32)5); + } + __pyx_v_float_format = values[14]; + if (values[15]) { + __pyx_v_show_weight_one = __Pyx_PyObject_IsTrue(values[15]); if (unlikely((__pyx_v_show_weight_one == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1492, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":1492 + * int32 precision=5, + * float_format=b"g", + * bool show_weight_one=False): # <<<<<<<<<<<<<< + * """ + * draw(self, filename, isymbols=None, osymbols=None, ssymbols=None, + */ + __pyx_v_show_weight_one = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("draw", 0, 1, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1476, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.draw", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "isymbols", 0))) __PYX_ERR(0, 1478, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_osymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "osymbols", 0))) __PYX_ERR(0, 1479, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ssymbols), __pyx_ptype_9pywrapfst_SymbolTable, 1, "ssymbols", 0))) __PYX_ERR(0, 1480, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_16draw(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), __pyx_v_filename, __pyx_v_isymbols, __pyx_v_osymbols, __pyx_v_ssymbols, __pyx_v_acceptor, __pyx_v_title, __pyx_v_width, __pyx_v_height, __pyx_v_portrait, __pyx_v_vertical, __pyx_v_ranksep, __pyx_v_nodesep, __pyx_v_fontsize, __pyx_v_precision, __pyx_v_float_format, __pyx_v_show_weight_one); + + /* "pywrapfst.pyx":1476 + * return _init_XFst(new fst.FstClass(deref(self._fst))) + * + * cpdef void draw(self, # <<<<<<<<<<<<<< + * filename, + * _SymbolTable isymbols=None, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_16draw(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_ssymbols, bool __pyx_v_acceptor, PyObject *__pyx_v_title, double __pyx_v_width, double __pyx_v_height, bool __pyx_v_portrait, bool __pyx_v_vertical, double __pyx_v_ranksep, double __pyx_v_nodesep, __pyx_t_10basictypes_int32 __pyx_v_fontsize, __pyx_t_10basictypes_int32 __pyx_v_precision, PyObject *__pyx_v_float_format, bool __pyx_v_show_weight_one) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_4_Fst_draw __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("draw", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1.__pyx_n = 15; + __pyx_t_1.isymbols = __pyx_v_isymbols; + __pyx_t_1.osymbols = __pyx_v_osymbols; + __pyx_t_1.ssymbols = __pyx_v_ssymbols; + __pyx_t_1.acceptor = __pyx_v_acceptor; + __pyx_t_1.title = __pyx_v_title; + __pyx_t_1.width = __pyx_v_width; + __pyx_t_1.height = __pyx_v_height; + __pyx_t_1.portrait = __pyx_v_portrait; + __pyx_t_1.vertical = __pyx_v_vertical; + __pyx_t_1.ranksep = __pyx_v_ranksep; + __pyx_t_1.nodesep = __pyx_v_nodesep; + __pyx_t_1.fontsize = __pyx_v_fontsize; + __pyx_t_1.precision = __pyx_v_precision; + __pyx_t_1.float_format = __pyx_v_float_format; + __pyx_t_1.show_weight_one = __pyx_v_show_weight_one; + __pyx_vtabptr_9pywrapfst__Fst->draw(__pyx_v_self, __pyx_v_filename, 1, &__pyx_t_1); + __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._Fst.draw", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1542 + * filename_string) + * + * cpdef Weight final(self, int64 state): # <<<<<<<<<<<<<< + * """ + * final(self, state) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_19final(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static struct __pyx_obj_9pywrapfst_Weight *__pyx_f_9pywrapfst_4_Fst_final(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_weight = 0; + struct __pyx_obj_9pywrapfst_Weight *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("final", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_final); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_19final)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst_Weight))))) __PYX_ERR(0, 1542, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1557 + * FstIndexError: State index out of range. + * """ + * cdef Weight weight = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * weight._weight.reset(new fst.WeightClass(self._fst.get().Final(state))) + * if not weight.member(): + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_weight = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":1558 + * """ + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(self._fst.get().Final(state))) # <<<<<<<<<<<<<< + * if not weight.member(): + * raise FstIndexError("State index out of range") + */ + if (unlikely(((PyObject *)__pyx_v_weight) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 1558, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1558, __pyx_L1_error) + } + __pyx_v_weight->_weight.reset(new fst::script::WeightClass(__pyx_v_self->_fst.get()->Final(__pyx_v_state))); + + /* "pywrapfst.pyx":1559 + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(self._fst.get().Final(state))) + * if not weight.member(): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return weight + */ + if (unlikely(((PyObject *)__pyx_v_weight) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "member"); + __PYX_ERR(0, 1559, __pyx_L1_error) + } + __pyx_t_6 = ((!(((struct __pyx_vtabstruct_9pywrapfst_Weight *)__pyx_v_weight->__pyx_vtab)->member(__pyx_v_weight, 0) != 0)) != 0); + if (unlikely(__pyx_t_6)) { + + /* "pywrapfst.pyx":1560 + * weight._weight.reset(new fst.WeightClass(self._fst.get().Final(state))) + * if not weight.member(): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * return weight + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1560, __pyx_L1_error) + + /* "pywrapfst.pyx":1559 + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(self._fst.get().Final(state))) + * if not weight.member(): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return weight + */ + } + + /* "pywrapfst.pyx":1561 + * if not weight.member(): + * raise FstIndexError("State index out of range") + * return weight # <<<<<<<<<<<<<< + * + * cpdef string fst_type(self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_weight)); + __pyx_r = __pyx_v_weight; + goto __pyx_L0; + + /* "pywrapfst.pyx":1542 + * filename_string) + * + * cpdef Weight final(self, int64 state): # <<<<<<<<<<<<<< + * """ + * final(self, state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._Fst.final", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_weight); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_19final(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_18final[] = "\n final(self, state)\n\n Returns the final weight of a state.\n\n Args:\n state: The integer index of a state.\n\n Returns:\n The final Weight of that state.\n\n Raises:\n FstIndexError: State index out of range.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_19final(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("final (wrapper)", 0); + assert(__pyx_arg_state); { + __pyx_v_state = __Pyx_PyInt_As_int64_t(__pyx_arg_state); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1542, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.final", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_18final(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_18final(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("final", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_4_Fst_final(__pyx_v_self, __pyx_v_state, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.final", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1563 + * return weight + * + * cpdef string fst_type(self): # <<<<<<<<<<<<<< + * """ + * fst_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_21fst_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_fst_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("fst_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fst_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_21fst_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1569 + * Returns a string indicating the FST type. + * """ + * return self._fst.get().FstType() # <<<<<<<<<<<<<< + * + * cpdef _FstSymbolTable input_symbols(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1569, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_fst.get()->FstType(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1563 + * return weight + * + * cpdef string fst_type(self): # <<<<<<<<<<<<<< + * """ + * fst_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._Fst.fst_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_21fst_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_20fst_type[] = "\n fst_type(self)\n\n Returns a string indicating the FST type.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_21fst_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fst_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_20fst_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_20fst_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("fst_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_4_Fst_fst_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.fst_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1571 + * return self._fst.get().FstType() + * + * cpdef _FstSymbolTable input_symbols(self): # <<<<<<<<<<<<<< + * """ + * input_symbols(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_23input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_f_9pywrapfst_4_Fst_input_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + fst::SymbolTable *__pyx_v_syms; + struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("input_symbols", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_input_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_23input_symbols)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst__FstSymbolTable))))) __PYX_ERR(0, 1571, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1580 + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._fst.get().InputSymbols()) # <<<<<<<<<<<<<< + * if syms == NULL: + * return + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1580, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1579 + * See also: `input_symbols`. + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( # <<<<<<<<<<<<<< + * self._fst.get().InputSymbols()) + * if syms == NULL: + */ + __pyx_v_syms = const_cast<__pyx_t_9pywrapfst_SymbolTable_ptr>(__pyx_v_self->_fst.get()->InputSymbols()); + + /* "pywrapfst.pyx":1581 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._fst.get().InputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_FstSymbolTable(syms, self._fst) + */ + __pyx_t_5 = ((__pyx_v_syms == NULL) != 0); + if (__pyx_t_5) { + + /* "pywrapfst.pyx":1582 + * self._fst.get().InputSymbols()) + * if syms == NULL: + * return # <<<<<<<<<<<<<< + * return _init_FstSymbolTable(syms, self._fst) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_r = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pywrapfst.pyx":1581 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._fst.get().InputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_FstSymbolTable(syms, self._fst) + */ + } + + /* "pywrapfst.pyx":1583 + * if syms == NULL: + * return + * return _init_FstSymbolTable(syms, self._fst) # <<<<<<<<<<<<<< + * + * cpdef size_t num_arcs(self, int64 state) except *: + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1583, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_FstSymbolTable(__pyx_v_syms, __pyx_v_self->_fst)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1571 + * return self._fst.get().FstType() + * + * cpdef _FstSymbolTable input_symbols(self): # <<<<<<<<<<<<<< + * """ + * input_symbols(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._Fst.input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_23input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_22input_symbols[] = "\n input_symbols(self)\n\n Returns the FST's input symbol table, or None if none is present.\n\n See also: `input_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_23input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("input_symbols (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_22input_symbols(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_22input_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("input_symbols", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_4_Fst_input_symbols(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1585 + * return _init_FstSymbolTable(syms, self._fst) + * + * cpdef size_t num_arcs(self, int64 state) except *: # <<<<<<<<<<<<<< + * """ + * num_arcs(self, state) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_25num_arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static size_t __pyx_f_9pywrapfst_4_Fst_num_arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch) { + size_t __pyx_v_result; + size_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("num_arcs", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_arcs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_25num_arcs)) { + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1602 + * See also: `num_states`. + * """ + * cdef size_t result = self._fst.get().NumArcs(state) # <<<<<<<<<<<<<< + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1602, __pyx_L1_error) + } + __pyx_v_result = __pyx_v_self->_fst.get()->NumArcs(__pyx_v_state); + + /* "pywrapfst.pyx":1603 + * """ + * cdef size_t result = self._fst.get().NumArcs(state) + * if result == SIZE_MAX: # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return result + */ + __pyx_t_7 = ((__pyx_v_result == SIZE_MAX) != 0); + if (unlikely(__pyx_t_7)) { + + /* "pywrapfst.pyx":1604 + * cdef size_t result = self._fst.get().NumArcs(state) + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1604, __pyx_L1_error) + + /* "pywrapfst.pyx":1603 + * """ + * cdef size_t result = self._fst.get().NumArcs(state) + * if result == SIZE_MAX: # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return result + */ + } + + /* "pywrapfst.pyx":1605 + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") + * return result # <<<<<<<<<<<<<< + * + * cpdef size_t num_input_epsilons(self, int64 state) except *: + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1585 + * return _init_FstSymbolTable(syms, self._fst) + * + * cpdef size_t num_arcs(self, int64 state) except *: # <<<<<<<<<<<<<< + * """ + * num_arcs(self, state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._Fst.num_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_25num_arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_24num_arcs[] = "\n num_arcs(self, state)\n\n Returns the number of arcs leaving a state.\n\n Args:\n state: The integer index of a state.\n\n Returns:\n The number of arcs leaving that state.\n\n Raises:\n FstIndexError: State index out of range.\n\n See also: `num_states`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_25num_arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_arcs (wrapper)", 0); + assert(__pyx_arg_state); { + __pyx_v_state = __Pyx_PyInt_As_int64_t(__pyx_arg_state); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.num_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_24num_arcs(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_24num_arcs(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("num_arcs", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_4_Fst_num_arcs(__pyx_v_self, __pyx_v_state, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._Fst.num_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1607 + * return result + * + * cpdef size_t num_input_epsilons(self, int64 state) except *: # <<<<<<<<<<<<<< + * """ + * num_input_epsilons(self, state) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_27num_input_epsilons(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static size_t __pyx_f_9pywrapfst_4_Fst_num_input_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch) { + size_t __pyx_v_result; + size_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("num_input_epsilons", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_input_epsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_27num_input_epsilons)) { + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1624 + * See also: `num_output_epsilons`. + * """ + * cdef size_t result = self._fst.get().NumInputEpsilons(state) # <<<<<<<<<<<<<< + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1624, __pyx_L1_error) + } + __pyx_v_result = __pyx_v_self->_fst.get()->NumInputEpsilons(__pyx_v_state); + + /* "pywrapfst.pyx":1625 + * """ + * cdef size_t result = self._fst.get().NumInputEpsilons(state) + * if result == SIZE_MAX: # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return result + */ + __pyx_t_7 = ((__pyx_v_result == SIZE_MAX) != 0); + if (unlikely(__pyx_t_7)) { + + /* "pywrapfst.pyx":1626 + * cdef size_t result = self._fst.get().NumInputEpsilons(state) + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1626, __pyx_L1_error) + + /* "pywrapfst.pyx":1625 + * """ + * cdef size_t result = self._fst.get().NumInputEpsilons(state) + * if result == SIZE_MAX: # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return result + */ + } + + /* "pywrapfst.pyx":1627 + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") + * return result # <<<<<<<<<<<<<< + * + * cpdef size_t num_output_epsilons(self, int64 state) except *: + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1607 + * return result + * + * cpdef size_t num_input_epsilons(self, int64 state) except *: # <<<<<<<<<<<<<< + * """ + * num_input_epsilons(self, state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._Fst.num_input_epsilons", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_27num_input_epsilons(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_26num_input_epsilons[] = "\n num_input_epsilons(self, state)\n\n Returns the number of arcs with epsilon input labels leaving a state.\n\n Args:\n state: The integer index of a state.\n\n Returns:\n The number of epsilon-input-labeled arcs leaving that state.\n\n Raises:\n FstIndexError: State index out of range.\n\n See also: `num_output_epsilons`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_27num_input_epsilons(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_input_epsilons (wrapper)", 0); + assert(__pyx_arg_state); { + __pyx_v_state = __Pyx_PyInt_As_int64_t(__pyx_arg_state); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.num_input_epsilons", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_26num_input_epsilons(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_26num_input_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("num_input_epsilons", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_4_Fst_num_input_epsilons(__pyx_v_self, __pyx_v_state, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._Fst.num_input_epsilons", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1629 + * return result + * + * cpdef size_t num_output_epsilons(self, int64 state) except *: # <<<<<<<<<<<<<< + * """ + * num_output_epsilons(self, state) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_29num_output_epsilons(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static size_t __pyx_f_9pywrapfst_4_Fst_num_output_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch) { + size_t __pyx_v_result; + size_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("num_output_epsilons", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_output_epsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_29num_output_epsilons)) { + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1646 + * See also: `num_input_epsilons`. + * """ + * cdef size_t result = self._fst.get().NumOutputEpsilons(state) # <<<<<<<<<<<<<< + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1646, __pyx_L1_error) + } + __pyx_v_result = __pyx_v_self->_fst.get()->NumOutputEpsilons(__pyx_v_state); + + /* "pywrapfst.pyx":1647 + * """ + * cdef size_t result = self._fst.get().NumOutputEpsilons(state) + * if result == SIZE_MAX: # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return result + */ + __pyx_t_7 = ((__pyx_v_result == SIZE_MAX) != 0); + if (unlikely(__pyx_t_7)) { + + /* "pywrapfst.pyx":1648 + * cdef size_t result = self._fst.get().NumOutputEpsilons(state) + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1648, __pyx_L1_error) + + /* "pywrapfst.pyx":1647 + * """ + * cdef size_t result = self._fst.get().NumOutputEpsilons(state) + * if result == SIZE_MAX: # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * return result + */ + } + + /* "pywrapfst.pyx":1649 + * if result == SIZE_MAX: + * raise FstIndexError("State index out of range") + * return result # <<<<<<<<<<<<<< + * + * cpdef _FstSymbolTable output_symbols(self): + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1629 + * return result + * + * cpdef size_t num_output_epsilons(self, int64 state) except *: # <<<<<<<<<<<<<< + * """ + * num_output_epsilons(self, state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._Fst.num_output_epsilons", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_29num_output_epsilons(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_28num_output_epsilons[] = "\n num_output_epsilons(self, state)\n\n Returns the number of arcs with epsilon output labels leaving a state.\n\n Args:\n state: The integer index of a state.\n\n Returns:\n The number of epsilon-output-labeled arcs leaving that state.\n\n Raises:\n FstIndexError: State index out of range.\n\n See also: `num_input_epsilons`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_29num_output_epsilons(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_output_epsilons (wrapper)", 0); + assert(__pyx_arg_state); { + __pyx_v_state = __Pyx_PyInt_As_int64_t(__pyx_arg_state); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1629, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.num_output_epsilons", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_28num_output_epsilons(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_28num_output_epsilons(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("num_output_epsilons", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_4_Fst_num_output_epsilons(__pyx_v_self, __pyx_v_state, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1629, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._Fst.num_output_epsilons", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1651 + * return result + * + * cpdef _FstSymbolTable output_symbols(self): # <<<<<<<<<<<<<< + * """ + * output_symbols(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_31output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_f_9pywrapfst_4_Fst_output_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + fst::SymbolTable *__pyx_v_syms; + struct __pyx_obj_9pywrapfst__FstSymbolTable *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("output_symbols", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_output_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_31output_symbols)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst__FstSymbolTable))))) __PYX_ERR(0, 1651, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1660 + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._fst.get().OutputSymbols()) # <<<<<<<<<<<<<< + * if syms == NULL: + * return + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1660, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1659 + * See also: `input_symbols`. + * """ + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( # <<<<<<<<<<<<<< + * self._fst.get().OutputSymbols()) + * if syms == NULL: + */ + __pyx_v_syms = const_cast<__pyx_t_9pywrapfst_SymbolTable_ptr>(__pyx_v_self->_fst.get()->OutputSymbols()); + + /* "pywrapfst.pyx":1661 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._fst.get().OutputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_FstSymbolTable(syms, self._fst) + */ + __pyx_t_5 = ((__pyx_v_syms == NULL) != 0); + if (__pyx_t_5) { + + /* "pywrapfst.pyx":1662 + * self._fst.get().OutputSymbols()) + * if syms == NULL: + * return # <<<<<<<<<<<<<< + * return _init_FstSymbolTable(syms, self._fst) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_r = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pywrapfst.pyx":1661 + * cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + * self._fst.get().OutputSymbols()) + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_FstSymbolTable(syms, self._fst) + */ + } + + /* "pywrapfst.pyx":1663 + * if syms == NULL: + * return + * return _init_FstSymbolTable(syms, self._fst) # <<<<<<<<<<<<<< + * + * cpdef uint64 properties(self, uint64 mask, bool test): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1663, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_FstSymbolTable(__pyx_v_syms, __pyx_v_self->_fst)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1651 + * return result + * + * cpdef _FstSymbolTable output_symbols(self): # <<<<<<<<<<<<<< + * """ + * output_symbols(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._Fst.output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_31output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_30output_symbols[] = "\n output_symbols(self)\n\n Returns the FST's output symbol table, or None if none is present.\n\n See also: `input_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_31output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("output_symbols (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_30output_symbols(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_30output_symbols(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("output_symbols", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_4_Fst_output_symbols(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1665 + * return _init_FstSymbolTable(syms, self._fst) + * + * cpdef uint64 properties(self, uint64 mask, bool test): # <<<<<<<<<<<<<< + * """ + * properties(self, mask, test) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_33properties(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_10basictypes_uint64 __pyx_f_9pywrapfst_4_Fst_properties(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask, bool __pyx_v_test, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_uint64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + __pyx_t_10basictypes_uint64 __pyx_t_9; + __Pyx_RefNannySetupContext("properties", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_properties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_33properties)) { + __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_mask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_test); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_9 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_9 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_9; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1683 + * A 64-bit bitmask representing the requested properties. + * """ + * return self._fst.get().Properties(mask, test) # <<<<<<<<<<<<<< + * + * cpdef int64 start(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1683, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_fst.get()->Properties(__pyx_v_mask, __pyx_v_test); + goto __pyx_L0; + + /* "pywrapfst.pyx":1665 + * return _init_FstSymbolTable(syms, self._fst) + * + * cpdef uint64 properties(self, uint64 mask, bool test): # <<<<<<<<<<<<<< + * """ + * properties(self, mask, test) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("pywrapfst._Fst.properties", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_33properties(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_32properties[] = "\n properties(self, mask, test)\n\n Provides property bits.\n\n This method provides user access to the properties attributes for the FST.\n The resulting value is a long integer, but when it is cast to a boolean,\n it represents whether or not the FST has the `mask` property.\n\n Args:\n mask: The property mask to be compared to the FST's properties.\n test: Should any unknown values be computed before comparing against\n the mask?\n\n Returns:\n A 64-bit bitmask representing the requested properties.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_33properties(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_uint64 __pyx_v_mask; + bool __pyx_v_test; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("properties (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mask,&__pyx_n_s_test,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_test)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("properties", 1, 2, 2, 1); __PYX_ERR(0, 1665, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "properties") < 0)) __PYX_ERR(0, 1665, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_mask = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_mask == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L3_error) + __pyx_v_test = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_test == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("properties", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1665, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.properties", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_32properties(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), __pyx_v_mask, __pyx_v_test); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_32properties(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_mask, bool __pyx_v_test) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("properties", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_f_9pywrapfst_4_Fst_properties(__pyx_v_self, __pyx_v_mask, __pyx_v_test, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.properties", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1685 + * return self._fst.get().Properties(mask, test) + * + * cpdef int64 start(self): # <<<<<<<<<<<<<< + * """ + * start(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_35start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_4_Fst_start(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_5; + __Pyx_RefNannySetupContext("start", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1685, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_35start)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1685, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1691 + * Returns the start state. + * """ + * return self._fst.get().Start() # <<<<<<<<<<<<<< + * + * cpdef StateIterator states(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1691, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_fst.get()->Start(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1685 + * return self._fst.get().Properties(mask, test) + * + * cpdef int64 start(self): # <<<<<<<<<<<<<< + * """ + * start(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._Fst.start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_35start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_34start[] = "\n start(self)\n\n Returns the start state.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_35start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_34start(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_34start(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("start", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_f_9pywrapfst_4_Fst_start(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1685, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1693 + * return self._fst.get().Start() + * + * cpdef StateIterator states(self): # <<<<<<<<<<<<<< + * """ + * states(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_37states(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst_StateIterator *__pyx_f_9pywrapfst_4_Fst_states(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_StateIterator *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("states", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_states); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_37states)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst_StateIterator))))) __PYX_ERR(0, 1693, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1704 + * See also: `arcs`, `mutable_arcs`. + * """ + * return StateIterator(self) # <<<<<<<<<<<<<< + * + * cpdef string text(self, _SymbolTable isymbols=None, + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_9pywrapfst_StateIterator), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1693 + * return self._fst.get().Start() + * + * cpdef StateIterator states(self): # <<<<<<<<<<<<<< + * """ + * states(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._Fst.states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_37states(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_36states[] = "\n states(self)\n\n Returns an iterator over all states in the FST.\n\n Returns:\n A StateIterator object for the FST.\n\n See also: `arcs`, `mutable_arcs`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_37states(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("states (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_36states(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_36states(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("states", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_4_Fst_states(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1706 + * return StateIterator(self) + * + * cpdef string text(self, _SymbolTable isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_39text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_text(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_text *__pyx_optional_args) { + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1707 + * + * cpdef string text(self, _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, # <<<<<<<<<<<<<< + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): + * """ + */ + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_ssymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1708 + * cpdef string text(self, _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): # <<<<<<<<<<<<<< + * """ + * text(self, isymbols=None, osymbols=None, ssymbols=None, acceptor=False, + */ + bool __pyx_v_acceptor = ((bool)0); + bool __pyx_v_show_weight_one = ((bool)0); + PyObject *__pyx_v_missing_sym = ((PyObject *)__pyx_kp_b__10); + fst::SymbolTable *__pyx_v_ssymbols_ptr; + std::stringstream __pyx_v_sstrm; + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + std::string __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + fst::SymbolTable *__pyx_t_12; + fst::SymbolTable const *__pyx_t_13; + fst::SymbolTable const *__pyx_t_14; + __Pyx_RefNannySetupContext("text", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_isymbols = __pyx_optional_args->isymbols; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_osymbols = __pyx_optional_args->osymbols; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_ssymbols = __pyx_optional_args->ssymbols; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_acceptor = __pyx_optional_args->acceptor; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_show_weight_one = __pyx_optional_args->show_weight_one; + if (__pyx_optional_args->__pyx_n > 5) { + __pyx_v_missing_sym = __pyx_optional_args->missing_sym; + } + } + } + } + } + } + } + + /* "pywrapfst.pyx":1706 + * return StateIterator(self) + * + * cpdef string text(self, _SymbolTable isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): + */ + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_39text)) { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_acceptor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_show_weight_one); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[7] = {__pyx_t_6, ((PyObject *)__pyx_v_isymbols), ((PyObject *)__pyx_v_osymbols), ((PyObject *)__pyx_v_ssymbols), __pyx_t_3, __pyx_t_4, __pyx_v_missing_sym}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[7] = {__pyx_t_6, ((PyObject *)__pyx_v_isymbols), ((PyObject *)__pyx_v_osymbols), ((PyObject *)__pyx_v_ssymbols), __pyx_t_3, __pyx_t_4, __pyx_v_missing_sym}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_isymbols)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_isymbols)); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_isymbols)); + __Pyx_INCREF(((PyObject *)__pyx_v_osymbols)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_osymbols)); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)__pyx_v_osymbols)); + __Pyx_INCREF(((PyObject *)__pyx_v_ssymbols)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ssymbols)); + PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, ((PyObject *)__pyx_v_ssymbols)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_t_4); + __Pyx_INCREF(__pyx_v_missing_sym); + __Pyx_GIVEREF(__pyx_v_missing_sym); + PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_v_missing_sym); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_9; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1731 + * """ + * # Prints FST to stringstream, then returns resulting string. + * cdef fst.SymbolTable *ssymbols_ptr = NULL # <<<<<<<<<<<<<< + * if ssymbols is not None: + * ssymbols_ptr = ssymbols._table + */ + __pyx_v_ssymbols_ptr = NULL; + + /* "pywrapfst.pyx":1732 + * # Prints FST to stringstream, then returns resulting string. + * cdef fst.SymbolTable *ssymbols_ptr = NULL + * if ssymbols is not None: # <<<<<<<<<<<<<< + * ssymbols_ptr = ssymbols._table + * cdef stringstream sstrm + */ + __pyx_t_10 = (((PyObject *)__pyx_v_ssymbols) != Py_None); + __pyx_t_11 = (__pyx_t_10 != 0); + if (__pyx_t_11) { + + /* "pywrapfst.pyx":1733 + * cdef fst.SymbolTable *ssymbols_ptr = NULL + * if ssymbols is not None: + * ssymbols_ptr = ssymbols._table # <<<<<<<<<<<<<< + * cdef stringstream sstrm + * fst.PrintFst(deref(self._fst), sstrm, b"", + */ + if (unlikely(((PyObject *)__pyx_v_ssymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1733, __pyx_L1_error) + } + __pyx_t_12 = __pyx_v_ssymbols->_table; + __pyx_v_ssymbols_ptr = __pyx_t_12; + + /* "pywrapfst.pyx":1732 + * # Prints FST to stringstream, then returns resulting string. + * cdef fst.SymbolTable *ssymbols_ptr = NULL + * if ssymbols is not None: # <<<<<<<<<<<<<< + * ssymbols_ptr = ssymbols._table + * cdef stringstream sstrm + */ + } + + /* "pywrapfst.pyx":1735 + * ssymbols_ptr = ssymbols._table + * cdef stringstream sstrm + * fst.PrintFst(deref(self._fst), sstrm, b"", # <<<<<<<<<<<<<< + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1735, __pyx_L1_error) + } + + /* "pywrapfst.pyx":1736 + * cdef stringstream sstrm + * fst.PrintFst(deref(self._fst), sstrm, b"", + * self._fst.get().InputSymbols() if isymbols is None # <<<<<<<<<<<<<< + * else isymbols._table, + * self._fst.get().OutputSymbols() if osymbols is None + */ + __pyx_t_11 = (((PyObject *)__pyx_v_isymbols) == Py_None); + if ((__pyx_t_11 != 0)) { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1736, __pyx_L1_error) + } + __pyx_t_13 = __pyx_v_self->_fst.get()->InputSymbols(); + } else { + + /* "pywrapfst.pyx":1737 + * fst.PrintFst(deref(self._fst), sstrm, b"", + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, # <<<<<<<<<<<<<< + * self._fst.get().OutputSymbols() if osymbols is None + * else osymbols._table, + */ + if (unlikely(((PyObject *)__pyx_v_isymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1737, __pyx_L1_error) + } + __pyx_t_13 = __pyx_v_isymbols->_table; + } + + /* "pywrapfst.pyx":1738 + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, + * self._fst.get().OutputSymbols() if osymbols is None # <<<<<<<<<<<<<< + * else osymbols._table, + * ssymbols_ptr, acceptor, show_weight_one, tostring(missing_sym)) + */ + __pyx_t_11 = (((PyObject *)__pyx_v_osymbols) == Py_None); + if ((__pyx_t_11 != 0)) { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1738, __pyx_L1_error) + } + __pyx_t_14 = __pyx_v_self->_fst.get()->OutputSymbols(); + } else { + + /* "pywrapfst.pyx":1739 + * else isymbols._table, + * self._fst.get().OutputSymbols() if osymbols is None + * else osymbols._table, # <<<<<<<<<<<<<< + * ssymbols_ptr, acceptor, show_weight_one, tostring(missing_sym)) + * return sstrm.str() + */ + if (unlikely(((PyObject *)__pyx_v_osymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 1739, __pyx_L1_error) + } + __pyx_t_14 = __pyx_v_osymbols->_table; + } + + /* "pywrapfst.pyx":1740 + * self._fst.get().OutputSymbols() if osymbols is None + * else osymbols._table, + * ssymbols_ptr, acceptor, show_weight_one, tostring(missing_sym)) # <<<<<<<<<<<<<< + * return sstrm.str() + * + */ + __pyx_t_9 = __pyx_f_9pywrapfst_tostring(__pyx_v_missing_sym); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1740, __pyx_L1_error) + + /* "pywrapfst.pyx":1735 + * ssymbols_ptr = ssymbols._table + * cdef stringstream sstrm + * fst.PrintFst(deref(self._fst), sstrm, b"", # <<<<<<<<<<<<<< + * self._fst.get().InputSymbols() if isymbols is None + * else isymbols._table, + */ + fst::script::PrintFst((*__pyx_v_self->_fst), __pyx_v_sstrm, __pyx_k_pywrapfst, __pyx_t_13, __pyx_t_14, __pyx_v_ssymbols_ptr, __pyx_v_acceptor, __pyx_v_show_weight_one, __pyx_t_9); + + /* "pywrapfst.pyx":1741 + * else osymbols._table, + * ssymbols_ptr, acceptor, show_weight_one, tostring(missing_sym)) + * return sstrm.str() # <<<<<<<<<<<<<< + * + * cpdef bool verify(self): + */ + __pyx_r = __pyx_v_sstrm.str(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1706 + * return StateIterator(self) + * + * cpdef string text(self, _SymbolTable isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("pywrapfst._Fst.text", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_39text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_38text[] = "\n text(self, isymbols=None, osymbols=None, ssymbols=None, acceptor=False,\n show_weight_one=False, missing_sym=\"\")\n\n Produces a human-readable string representation of the FST.\n\n This method generates a human-readable string representation of the FST.\n The caller may optionally specify SymbolTables used to label input labels,\n output labels, or state labels, respectively.\n\n Args:\n isymbols: An optional symbol table used to label input symbols.\n osymbols: An optional symbol table used to label output symbols.\n ssymbols: An optional symbol table used to label states.\n acceptor: Should the FST be rendered in acceptor format if possible?\n show_weight_one: Should weights equivalent to semiring One be printed?\n missing_symbol: The string to be printed when symbol table lookup fails.\n\n Returns:\n A formatted string representing the machine.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_39text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols = 0; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols = 0; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_ssymbols = 0; + bool __pyx_v_acceptor; + bool __pyx_v_show_weight_one; + PyObject *__pyx_v_missing_sym = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("text (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isymbols,&__pyx_n_s_osymbols,&__pyx_n_s_ssymbols,&__pyx_n_s_acceptor,&__pyx_n_s_show_weight_one,&__pyx_n_s_missing_sym,0}; + PyObject* values[6] = {0,0,0,0,0,0}; + values[0] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":1707 + * + * cpdef string text(self, _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, # <<<<<<<<<<<<<< + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): + * """ + */ + values[1] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + values[2] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + values[5] = ((PyObject *)__pyx_kp_b__10); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isymbols); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_osymbols); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ssymbols); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acceptor); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_show_weight_one); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_missing_sym); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "text") < 0)) __PYX_ERR(0, 1706, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[0]); + __pyx_v_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[1]); + __pyx_v_ssymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[2]); + if (values[3]) { + __pyx_v_acceptor = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_acceptor == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1708, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":1708 + * cpdef string text(self, _SymbolTable isymbols=None, + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): # <<<<<<<<<<<<<< + * """ + * text(self, isymbols=None, osymbols=None, ssymbols=None, acceptor=False, + */ + __pyx_v_acceptor = ((bool)0); + } + if (values[4]) { + __pyx_v_show_weight_one = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_show_weight_one == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1708, __pyx_L3_error) + } else { + __pyx_v_show_weight_one = ((bool)0); + } + __pyx_v_missing_sym = values[5]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("text", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1706, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._Fst.text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "isymbols", 0))) __PYX_ERR(0, 1706, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_osymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "osymbols", 0))) __PYX_ERR(0, 1707, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ssymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "ssymbols", 0))) __PYX_ERR(0, 1707, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_38text(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), __pyx_v_isymbols, __pyx_v_osymbols, __pyx_v_ssymbols, __pyx_v_acceptor, __pyx_v_show_weight_one, __pyx_v_missing_sym); + + /* "pywrapfst.pyx":1706 + * return StateIterator(self) + * + * cpdef string text(self, _SymbolTable isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable osymbols=None, _SymbolTable ssymbols=None, + * bool acceptor=False, bool show_weight_one=False, missing_sym=b""): + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_38text(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_osymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_ssymbols, bool __pyx_v_acceptor, bool __pyx_v_show_weight_one, PyObject *__pyx_v_missing_sym) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + struct __pyx_opt_args_9pywrapfst_4_Fst_text __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("text", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 6; + __pyx_t_2.isymbols = __pyx_v_isymbols; + __pyx_t_2.osymbols = __pyx_v_osymbols; + __pyx_t_2.ssymbols = __pyx_v_ssymbols; + __pyx_t_2.acceptor = __pyx_v_acceptor; + __pyx_t_2.show_weight_one = __pyx_v_show_weight_one; + __pyx_t_2.missing_sym = __pyx_v_missing_sym; + __pyx_t_1 = __pyx_vtabptr_9pywrapfst__Fst->text(__pyx_v_self, 1, &__pyx_t_2); + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst._Fst.text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1743 + * return sstrm.str() + * + * cpdef bool verify(self): # <<<<<<<<<<<<<< + * """ + * verify(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_41verify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_4_Fst_verify(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("verify", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_verify); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_41verify)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1743, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1752 + * True if the contents are sane, False otherwise. + * """ + * return fst.Verify(deref(self._fst)) # <<<<<<<<<<<<<< + * + * cpdef string weight_type(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1752, __pyx_L1_error) + } + __pyx_r = fst::script::Verify((*__pyx_v_self->_fst)); + goto __pyx_L0; + + /* "pywrapfst.pyx":1743 + * return sstrm.str() + * + * cpdef bool verify(self): # <<<<<<<<<<<<<< + * """ + * verify(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._Fst.verify", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_41verify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_40verify[] = "\n verify(self)\n\n Verifies that an FST's contents are sane.\n\n Returns:\n True if the contents are sane, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_41verify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("verify (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_40verify(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_40verify(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("verify", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_4_Fst_verify(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.verify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1754 + * return fst.Verify(deref(self._fst)) + * + * cpdef string weight_type(self): # <<<<<<<<<<<<<< + * """ + * weight_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_43weight_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_4_Fst_weight_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("weight_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_weight_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_43weight_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1754, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1763 + * A string representing the weight type. + * """ + * return self._fst.get().WeightType() # <<<<<<<<<<<<<< + * + * cpdef void write(self, filename) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1763, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_fst.get()->WeightType(); + goto __pyx_L0; + + /* "pywrapfst.pyx":1754 + * return fst.Verify(deref(self._fst)) + * + * cpdef string weight_type(self): # <<<<<<<<<<<<<< + * """ + * weight_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._Fst.weight_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_43weight_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_42weight_type[] = "\n weight_type(self)\n\n Provides the FST's weight type.\n\n Returns:\n A string representing the weight type.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_43weight_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("weight_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_42weight_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_42weight_type(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("weight_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_4_Fst_weight_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.weight_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1765 + * return self._fst.get().WeightType() + * + * cpdef void write(self, filename) except *: # <<<<<<<<<<<<<< + * """ + * write(self, filename) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_45write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ +static void __pyx_f_9pywrapfst_4_Fst_write(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("write", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_45write)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1779 + * FstIOError: Write failed. + * """ + * if not self._fst.get().Write(tostring(filename)): # <<<<<<<<<<<<<< + * raise FstIOError("Write failed: {!r}".format(filename)) + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1779, __pyx_L1_error) + } + __pyx_t_5 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1779, __pyx_L1_error) + __pyx_t_6 = ((!(__pyx_v_self->_fst.get()->Write(__pyx_t_5) != 0)) != 0); + if (unlikely(__pyx_t_6)) { + + /* "pywrapfst.pyx":1780 + * """ + * if not self._fst.get().Write(tostring(filename)): + * raise FstIOError("Write failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * + * cpdef bytes write_to_string(self): + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Write_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1780, __pyx_L1_error) + + /* "pywrapfst.pyx":1779 + * FstIOError: Write failed. + * """ + * if not self._fst.get().Write(tostring(filename)): # <<<<<<<<<<<<<< + * raise FstIOError("Write failed: {!r}".format(filename)) + * + */ + } + + /* "pywrapfst.pyx":1765 + * return self._fst.get().WeightType() + * + * cpdef void write(self, filename) except *: # <<<<<<<<<<<<<< + * """ + * write(self, filename) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._Fst.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_45write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_44write[] = "\n write(self, filename)\n\n Serializes FST to a file.\n\n This method writes the FST to a file in a binary format.\n\n Args:\n filename: The string location of the output file.\n\n Raises:\n FstIOError: Write failed.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_45write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_44write(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), ((PyObject *)__pyx_v_filename)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_44write(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("write", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_9pywrapfst_4_Fst_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1765, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1782 + * raise FstIOError("Write failed: {!r}".format(filename)) + * + * cpdef bytes write_to_string(self): # <<<<<<<<<<<<<< + * """ + * write_to_string(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_4_Fst_47write_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_9pywrapfst_4_Fst_write_to_string(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self, int __pyx_skip_dispatch) { + std::stringstream __pyx_v_sstrm; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("write_to_string", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write_to_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_4_Fst_47write_to_string)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1782, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1797 + * """ + * cdef stringstream sstrm + * if not self._fst.get().Write(sstrm, b""): # <<<<<<<<<<<<<< + * raise FstIOError("Write to string failed") + * return sstrm.str() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1797, __pyx_L1_error) + } + __pyx_t_5 = ((!(__pyx_v_self->_fst.get()->Write(__pyx_v_sstrm, __pyx_k_pywrapfst) != 0)) != 0); + if (unlikely(__pyx_t_5)) { + + /* "pywrapfst.pyx":1798 + * cdef stringstream sstrm + * if not self._fst.get().Write(sstrm, b""): + * raise FstIOError("Write to string failed") # <<<<<<<<<<<<<< + * return sstrm.str() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Write_to_string_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Write_to_string_failed); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1798, __pyx_L1_error) + + /* "pywrapfst.pyx":1797 + * """ + * cdef stringstream sstrm + * if not self._fst.get().Write(sstrm, b""): # <<<<<<<<<<<<<< + * raise FstIOError("Write to string failed") + * return sstrm.str() + */ + } + + /* "pywrapfst.pyx":1799 + * if not self._fst.get().Write(sstrm, b""): + * raise FstIOError("Write to string failed") + * return sstrm.str() # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_sstrm.str()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":1782 + * raise FstIOError("Write failed: {!r}".format(filename)) + * + * cpdef bytes write_to_string(self): # <<<<<<<<<<<<<< + * """ + * write_to_string(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._Fst.write_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_4_Fst_47write_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_4_Fst_46write_to_string[] = "\n write_to_string(self)\n\n Serializes FST to a string.\n\n Returns:\n A bytestring.\n\n Raises:\n FstIOError: Write to string failed.\n\n See also: `read_from_string`.\n "; +static PyObject *__pyx_pw_9pywrapfst_4_Fst_47write_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_to_string (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_4_Fst_46write_to_string(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_4_Fst_46write_to_string(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("write_to_string", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_4_Fst_write_to_string(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._Fst.write_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1812 + * """ + * + * cdef void _check_mutating_imethod(self) except *: # <<<<<<<<<<<<<< + * """Checks whether an operation mutating the FST has produced an error. + * + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__check_mutating_imethod(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_check_mutating_imethod", 0); + + /* "pywrapfst.pyx":1817 + * This function is not visible to Python users. + * """ + * if self._fst.get().Properties(fst.kError, True) == fst.kError: # <<<<<<<<<<<<<< + * raise FstOpError("Operation failed") + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1817, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_v_self->__pyx_base._fst.get()->Properties(fst::kError, 1) == fst::kError) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":1818 + * """ + * if self._fst.get().Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") # <<<<<<<<<<<<<< + * + * cdef void _add_arc(self, int64 state, Arc arc) except *: + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_Operation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Operation_failed); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1818, __pyx_L1_error) + + /* "pywrapfst.pyx":1817 + * This function is not visible to Python users. + * """ + * if self._fst.get().Properties(fst.kError, True) == fst.kError: # <<<<<<<<<<<<<< + * raise FstOpError("Operation failed") + * + */ + } + + /* "pywrapfst.pyx":1812 + * """ + * + * cdef void _check_mutating_imethod(self) except *: # <<<<<<<<<<<<<< + * """Checks whether an operation mutating the FST has produced an error. + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableFst._check_mutating_imethod", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1820 + * raise FstOpError("Operation failed") + * + * cdef void _add_arc(self, int64 state, Arc arc) except *: # <<<<<<<<<<<<<< + * if not self._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__add_arc(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_add_arc", 0); + + /* "pywrapfst.pyx":1821 + * + * cdef void _add_arc(self, int64 state, Arc arc) except *: + * if not self._fst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * if not self._mfst.get().AddArc(state, deref(arc._arc)): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1821, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_self->__pyx_base._fst.get()->ValidStateId(__pyx_v_state) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":1822 + * cdef void _add_arc(self, int64 state, Arc arc) except *: + * if not self._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * if not self._mfst.get().AddArc(state, deref(arc._arc)): + * raise FstOpError("Incompatible or invalid weight type") + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1822, __pyx_L1_error) + + /* "pywrapfst.pyx":1821 + * + * cdef void _add_arc(self, int64 state, Arc arc) except *: + * if not self._fst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * if not self._mfst.get().AddArc(state, deref(arc._arc)): + */ + } + + /* "pywrapfst.pyx":1823 + * if not self._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + * if not self._mfst.get().AddArc(state, deref(arc._arc)): # <<<<<<<<<<<<<< + * raise FstOpError("Incompatible or invalid weight type") + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1823, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_arc) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 1823, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_self->_mfst.get()->AddArc(__pyx_v_state, (*__pyx_v_arc->_arc)) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":1824 + * raise FstIndexError("State index out of range") + * if not self._mfst.get().AddArc(state, deref(arc._arc)): + * raise FstOpError("Incompatible or invalid weight type") # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_Incompatible_or_invalid_weight_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Incompatible_or_invalid_weight_t); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1824, __pyx_L1_error) + + /* "pywrapfst.pyx":1823 + * if not self._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + * if not self._mfst.get().AddArc(state, deref(arc._arc)): # <<<<<<<<<<<<<< + * raise FstOpError("Incompatible or invalid weight type") + * self._check_mutating_imethod() + */ + } + + /* "pywrapfst.pyx":1825 + * if not self._mfst.get().AddArc(state, deref(arc._arc)): + * raise FstOpError("Incompatible or invalid weight type") + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def add_arc(self, int64 state, Arc arc): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1825, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L1_error) + + /* "pywrapfst.pyx":1820 + * raise FstOpError("Operation failed") + * + * cdef void _add_arc(self, int64 state, Arc arc) except *: # <<<<<<<<<<<<<< + * if not self._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableFst._add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1827 + * self._check_mutating_imethod() + * + * def add_arc(self, int64 state, Arc arc): # <<<<<<<<<<<<<< + * """ + * add_arc(self, state, arc) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_1add_arc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_add_arc[] = "\n add_arc(self, state, arc)\n\n Adds a new arc to the FST and return self.\n\n Args:\n state: The integer index of the source state.\n arc: The arc to add.\n\n Returns:\n self.\n\n Raises:\n FstIndexError: State index out of range.\n FstOpdexError: Incompatible or invalid weight type.\n\n See also: `add_state`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_1add_arc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_int64 __pyx_v_state; + struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_arc (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_arc,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arc)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_arc", 1, 2, 2, 1); __PYX_ERR(0, 1827, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_arc") < 0)) __PYX_ERR(0, 1827, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_state = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1827, __pyx_L3_error) + __pyx_v_arc = ((struct __pyx_obj_9pywrapfst_Arc *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_arc", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1827, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arc), __pyx_ptype_9pywrapfst_Arc, 1, "arc", 0))) __PYX_ERR(0, 1827, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_add_arc(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_state, __pyx_v_arc); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_add_arc(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_arc", 0); + + /* "pywrapfst.pyx":1846 + * See also: `add_state`. + * """ + * self._add_arc(state, arc) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_add_arc"); + __PYX_ERR(0, 1846, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_add_arc(__pyx_v_self, __pyx_v_state, __pyx_v_arc); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1846, __pyx_L1_error) + + /* "pywrapfst.pyx":1847 + * """ + * self._add_arc(state, arc) + * return self # <<<<<<<<<<<<<< + * + * cpdef int64 add_state(self) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1827 + * self._check_mutating_imethod() + * + * def add_arc(self, int64 state, Arc arc): # <<<<<<<<<<<<<< + * """ + * add_arc(self, state, arc) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1849 + * return self + * + * cpdef int64 add_state(self) except *: # <<<<<<<<<<<<<< + * """ + * add_state(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_3add_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_11_MutableFst_add_state(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_int64 __pyx_v_result; + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_5; + __Pyx_RefNannySetupContext("add_state", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11_MutableFst_3add_state)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1849, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":1860 + * See also: `add_arc`, `set_start`, `set_final`. + * """ + * cdef int64 result = self._mfst.get().AddState() # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * return result + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1860, __pyx_L1_error) + } + __pyx_v_result = __pyx_v_self->_mfst.get()->AddState(); + + /* "pywrapfst.pyx":1861 + * """ + * cdef int64 result = self._mfst.get().AddState() + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1861, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1861, __pyx_L1_error) + + /* "pywrapfst.pyx":1862 + * cdef int64 result = self._mfst.get().AddState() + * self._check_mutating_imethod() + * return result # <<<<<<<<<<<<<< + * + * cdef void _arcsort(self, sort_type=b"ilabel") except *: + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":1849 + * return self + * + * cpdef int64 add_state(self) except *: # <<<<<<<<<<<<<< + * """ + * add_state(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableFst.add_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_3add_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_2add_state[] = "\n add_state(self)\n\n Adds a new state to the FST and returns the state ID.\n\n Returns:\n The integer index of the new state.\n\n See also: `add_arc`, `set_start`, `set_final`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_3add_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_state (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_2add_state(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_2add_state(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_10basictypes_int64 __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("add_state", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_11_MutableFst_add_state(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1849, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._MutableFst.add_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1864 + * return result + * + * cdef void _arcsort(self, sort_type=b"ilabel") except *: # <<<<<<<<<<<<<< + * cdef fst.ArcSortType sort_type_enum + * if not fst.GetArcSortType(tostring(sort_type), addr(sort_type_enum)): + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__arcsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__arcsort *__pyx_optional_args) { + PyObject *__pyx_v_sort_type = ((PyObject *)__pyx_n_b_ilabel); + enum fst::script::ArcSortType __pyx_v_sort_type_enum; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_arcsort", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_sort_type = __pyx_optional_args->sort_type; + } + } + + /* "pywrapfst.pyx":1866 + * cdef void _arcsort(self, sort_type=b"ilabel") except *: + * cdef fst.ArcSortType sort_type_enum + * if not fst.GetArcSortType(tostring(sort_type), addr(sort_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown sort type {!r}".format(sort_type)) + * fst.ArcSort(self._mfst.get(), sort_type_enum) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_sort_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1866, __pyx_L1_error) + __pyx_t_2 = ((!(fst::script::GetArcSortType(__pyx_t_1, (&__pyx_v_sort_type_enum)) != 0)) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":1867 + * cdef fst.ArcSortType sort_type_enum + * if not fst.GetArcSortType(tostring(sort_type), addr(sort_type_enum)): + * raise FstArgError("Unknown sort type {!r}".format(sort_type)) # <<<<<<<<<<<<<< + * fst.ArcSort(self._mfst.get(), sort_type_enum) + * self._check_mutating_imethod() + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_sort_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_sort_type) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sort_type); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1867, __pyx_L1_error) + + /* "pywrapfst.pyx":1866 + * cdef void _arcsort(self, sort_type=b"ilabel") except *: + * cdef fst.ArcSortType sort_type_enum + * if not fst.GetArcSortType(tostring(sort_type), addr(sort_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown sort type {!r}".format(sort_type)) + * fst.ArcSort(self._mfst.get(), sort_type_enum) + */ + } + + /* "pywrapfst.pyx":1868 + * if not fst.GetArcSortType(tostring(sort_type), addr(sort_type_enum)): + * raise FstArgError("Unknown sort type {!r}".format(sort_type)) + * fst.ArcSort(self._mfst.get(), sort_type_enum) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1868, __pyx_L1_error) + } + fst::script::ArcSort(__pyx_v_self->_mfst.get(), __pyx_v_sort_type_enum); + + /* "pywrapfst.pyx":1869 + * raise FstArgError("Unknown sort type {!r}".format(sort_type)) + * fst.ArcSort(self._mfst.get(), sort_type_enum) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def arcsort(self, sort_type=b"ilabel"): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1869, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1869, __pyx_L1_error) + + /* "pywrapfst.pyx":1864 + * return result + * + * cdef void _arcsort(self, sort_type=b"ilabel") except *: # <<<<<<<<<<<<<< + * cdef fst.ArcSortType sort_type_enum + * if not fst.GetArcSortType(tostring(sort_type), addr(sort_type_enum)): + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._MutableFst._arcsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1871 + * self._check_mutating_imethod() + * + * def arcsort(self, sort_type=b"ilabel"): # <<<<<<<<<<<<<< + * """ + * arcsort(self, sort_type="ilabel") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_5arcsort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_4arcsort[] = "\n arcsort(self, sort_type=\"ilabel\")\n\n Sorts arcs leaving each state of the FST.\n\n This operation destructively sorts arcs leaving each state using either\n input or output labels.\n\n Args:\n sort_type: Either \"ilabel\" (sort arcs according to input labels) or\n \"olabel\" (sort arcs according to output labels).\n\n Returns:\n self.\n\n Raises:\n FstArgError: Unknown sort type.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_5arcsort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sort_type = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arcsort (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sort_type,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)__pyx_n_b_ilabel); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sort_type); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arcsort") < 0)) __PYX_ERR(0, 1871, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_sort_type = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("arcsort", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1871, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.arcsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_4arcsort(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_sort_type); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_4arcsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_sort_type) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__arcsort __pyx_t_1; + __Pyx_RefNannySetupContext("arcsort", 0); + + /* "pywrapfst.pyx":1890 + * FstArgError: Unknown sort type. + * """ + * self._arcsort(sort_type) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arcsort"); + __PYX_ERR(0, 1890, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.sort_type = __pyx_v_sort_type; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_arcsort(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1890, __pyx_L1_error) + + /* "pywrapfst.pyx":1891 + * """ + * self._arcsort(sort_type) + * return self # <<<<<<<<<<<<<< + * + * cdef void _closure(self, bool closure_plus=False) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1871 + * self._check_mutating_imethod() + * + * def arcsort(self, sort_type=b"ilabel"): # <<<<<<<<<<<<<< + * """ + * arcsort(self, sort_type="ilabel") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.arcsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1893 + * return self + * + * cdef void _closure(self, bool closure_plus=False) except *: # <<<<<<<<<<<<<< + * fst.Closure(self._mfst.get(), fst.GetClosureType(closure_plus)) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__closure(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__closure *__pyx_optional_args) { + bool __pyx_v_closure_plus = ((bool)0); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_closure", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_closure_plus = __pyx_optional_args->closure_plus; + } + } + + /* "pywrapfst.pyx":1894 + * + * cdef void _closure(self, bool closure_plus=False) except *: + * fst.Closure(self._mfst.get(), fst.GetClosureType(closure_plus)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1894, __pyx_L1_error) + } + fst::script::Closure(__pyx_v_self->_mfst.get(), fst::script::GetClosureType(__pyx_v_closure_plus)); + + /* "pywrapfst.pyx":1895 + * cdef void _closure(self, bool closure_plus=False) except *: + * fst.Closure(self._mfst.get(), fst.GetClosureType(closure_plus)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def closure(self, bool closure_plus=False): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1895, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1895, __pyx_L1_error) + + /* "pywrapfst.pyx":1893 + * return self + * + * cdef void _closure(self, bool closure_plus=False) except *: # <<<<<<<<<<<<<< + * fst.Closure(self._mfst.get(), fst.GetClosureType(closure_plus)) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._closure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1897 + * self._check_mutating_imethod() + * + * def closure(self, bool closure_plus=False): # <<<<<<<<<<<<<< + * """ + * closure(self, closure_plus=False) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_7closure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_6closure[] = "\n closure(self, closure_plus=False)\n\n Computes concatenative closure.\n\n This operation destructively converts the FST to its concatenative closure.\n If A transduces string x to y with weight a, then the closure transduces x\n to y with weight a, xx to yy with weight a \\otimes a, xxx to yyy with weight\n a \\otimes a \\otimes a, and so on. The empty string is also transduced to\n itself with semiring One if `closure_plus` is False.\n\n Args:\n closure_plus: If False, do not accept the empty string.\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_7closure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + bool __pyx_v_closure_plus; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("closure (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_closure_plus,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_closure_plus); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "closure") < 0)) __PYX_ERR(0, 1897, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_closure_plus = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_closure_plus == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1897, __pyx_L3_error) + } else { + __pyx_v_closure_plus = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("closure", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1897, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.closure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_6closure(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_closure_plus); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_6closure(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, bool __pyx_v_closure_plus) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__closure __pyx_t_1; + __Pyx_RefNannySetupContext("closure", 0); + + /* "pywrapfst.pyx":1915 + * self. + * """ + * self._closure(closure_plus) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_closure"); + __PYX_ERR(0, 1915, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.closure_plus = __pyx_v_closure_plus; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_closure(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1915, __pyx_L1_error) + + /* "pywrapfst.pyx":1916 + * """ + * self._closure(closure_plus) + * return self # <<<<<<<<<<<<<< + * + * cdef void _concat(self, _Fst ifst) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1897 + * self._check_mutating_imethod() + * + * def closure(self, bool closure_plus=False): # <<<<<<<<<<<<<< + * """ + * closure(self, closure_plus=False) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.closure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1918 + * return self + * + * cdef void _concat(self, _Fst ifst) except *: # <<<<<<<<<<<<<< + * fst.Concat(self._mfst.get(), deref(ifst._fst)) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__concat(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_concat", 0); + + /* "pywrapfst.pyx":1919 + * + * cdef void _concat(self, _Fst ifst) except *: + * fst.Concat(self._mfst.get(), deref(ifst._fst)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1919, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 1919, __pyx_L1_error) + } + fst::script::Concat(__pyx_v_self->_mfst.get(), (*__pyx_v_ifst->_fst)); + + /* "pywrapfst.pyx":1920 + * cdef void _concat(self, _Fst ifst) except *: + * fst.Concat(self._mfst.get(), deref(ifst._fst)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def concat(self, _Fst ifst): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1920, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1920, __pyx_L1_error) + + /* "pywrapfst.pyx":1918 + * return self + * + * cdef void _concat(self, _Fst ifst) except *: # <<<<<<<<<<<<<< + * fst.Concat(self._mfst.get(), deref(ifst._fst)) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._concat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1922 + * self._check_mutating_imethod() + * + * def concat(self, _Fst ifst): # <<<<<<<<<<<<<< + * """ + * concat(self, ifst) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_9concat(PyObject *__pyx_v_self, PyObject *__pyx_v_ifst); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_8concat[] = "\n concat(self, ifst)\n\n Computes the concatenation (product) of two FSTs.\n\n This operation destructively concatenates the FST with a second FST. If A\n transduces string x to y with weight a and B transduces string w to v with\n weight b, then their concatenation transduces string xw to yv with weight a\n \\otimes b.\n\n Args:\n ifst: The second input FST.\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_9concat(PyObject *__pyx_v_self, PyObject *__pyx_v_ifst) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("concat (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 1922, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_8concat(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_ifst)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_8concat(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("concat", 0); + + /* "pywrapfst.pyx":1939 + * self. + * """ + * self._concat(ifst) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_concat"); + __PYX_ERR(0, 1939, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_concat(__pyx_v_self, __pyx_v_ifst); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1939, __pyx_L1_error) + + /* "pywrapfst.pyx":1940 + * """ + * self._concat(ifst) + * return self # <<<<<<<<<<<<<< + * + * cdef void _connect(self) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1922 + * self._check_mutating_imethod() + * + * def concat(self, _Fst ifst): # <<<<<<<<<<<<<< + * """ + * concat(self, ifst) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.concat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1942 + * return self + * + * cdef void _connect(self) except *: # <<<<<<<<<<<<<< + * fst.Connect(self._mfst.get()) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__connect(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_connect", 0); + + /* "pywrapfst.pyx":1943 + * + * cdef void _connect(self) except *: + * fst.Connect(self._mfst.get()) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1943, __pyx_L1_error) + } + fst::script::Connect(__pyx_v_self->_mfst.get()); + + /* "pywrapfst.pyx":1944 + * cdef void _connect(self) except *: + * fst.Connect(self._mfst.get()) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def connect(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1944, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1944, __pyx_L1_error) + + /* "pywrapfst.pyx":1942 + * return self + * + * cdef void _connect(self) except *: # <<<<<<<<<<<<<< + * fst.Connect(self._mfst.get()) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._connect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1946 + * self._check_mutating_imethod() + * + * def connect(self): # <<<<<<<<<<<<<< + * """ + * connect(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_11connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_10connect[] = "\n connect(self)\n\n Removes unsuccessful paths.\n\n This operation destructively trims the FST, removing states and arcs that\n are not part of any successful path.\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_11connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("connect (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_10connect(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_10connect(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("connect", 0); + + /* "pywrapfst.pyx":1958 + * self. + * """ + * self._connect() # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_connect"); + __PYX_ERR(0, 1958, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_connect(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1958, __pyx_L1_error) + + /* "pywrapfst.pyx":1959 + * """ + * self._connect() + * return self # <<<<<<<<<<<<<< + * + * cdef void _decode(self, EncodeMapper encoder) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1946 + * self._check_mutating_imethod() + * + * def connect(self): # <<<<<<<<<<<<<< + * """ + * connect(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.connect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1961 + * return self + * + * cdef void _decode(self, EncodeMapper encoder) except *: # <<<<<<<<<<<<<< + * fst.Decode(self._mfst.get(), deref(encoder._encoder)) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__decode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_decode", 0); + + /* "pywrapfst.pyx":1962 + * + * cdef void _decode(self, EncodeMapper encoder) except *: + * fst.Decode(self._mfst.get(), deref(encoder._encoder)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1962, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_encoder) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 1962, __pyx_L1_error) + } + fst::script::Decode(__pyx_v_self->_mfst.get(), (*__pyx_v_encoder->_encoder)); + + /* "pywrapfst.pyx":1963 + * cdef void _decode(self, EncodeMapper encoder) except *: + * fst.Decode(self._mfst.get(), deref(encoder._encoder)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def decode(self, EncodeMapper encoder): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1963, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1963, __pyx_L1_error) + + /* "pywrapfst.pyx":1961 + * return self + * + * cdef void _decode(self, EncodeMapper encoder) except *: # <<<<<<<<<<<<<< + * fst.Decode(self._mfst.get(), deref(encoder._encoder)) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._decode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1965 + * self._check_mutating_imethod() + * + * def decode(self, EncodeMapper encoder): # <<<<<<<<<<<<<< + * """ + * decode(self, encoder) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_13decode(PyObject *__pyx_v_self, PyObject *__pyx_v_encoder); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_12decode[] = "\n decode(self, encoder)\n\n Decodes encoded labels and/or weights.\n\n This operation reverses the encoding performed by `encode`.\n\n Args:\n encoder: An EncodeMapper object used to encode the FST.\n\n Returns:\n self.\n\n See also: `encode`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_13decode(PyObject *__pyx_v_self, PyObject *__pyx_v_encoder) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoder), __pyx_ptype_9pywrapfst_EncodeMapper, 1, "encoder", 0))) __PYX_ERR(0, 1965, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_12decode(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_encoder)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_12decode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode", 0); + + /* "pywrapfst.pyx":1981 + * See also: `encode`. + * """ + * self._decode(encoder) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_decode"); + __PYX_ERR(0, 1981, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_decode(__pyx_v_self, __pyx_v_encoder); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1981, __pyx_L1_error) + + /* "pywrapfst.pyx":1982 + * """ + * self._decode(encoder) + * return self # <<<<<<<<<<<<<< + * + * cdef void _delete_arcs(self, int64 state, size_t n=0) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1965 + * self._check_mutating_imethod() + * + * def decode(self, EncodeMapper encoder): # <<<<<<<<<<<<<< + * """ + * decode(self, encoder) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":1984 + * return self + * + * cdef void _delete_arcs(self, int64 state, size_t n=0) except *: # <<<<<<<<<<<<<< + * if not (self._mfst.get().DeleteArcs(state, n) if n else + * self._mfst.get().DeleteArcs(state)): + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__delete_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_arcs *__pyx_optional_args) { + size_t __pyx_v_n = ((size_t)0); + __Pyx_RefNannyDeclarations + bool __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("_delete_arcs", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_n = __pyx_optional_args->n; + } + } + + /* "pywrapfst.pyx":1985 + * + * cdef void _delete_arcs(self, int64 state, size_t n=0) except *: + * if not (self._mfst.get().DeleteArcs(state, n) if n else # <<<<<<<<<<<<<< + * self._mfst.get().DeleteArcs(state)): + * raise FstIndexError("State index out of range") + */ + if ((__pyx_v_n != 0)) { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1985, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_self->_mfst.get()->DeleteArcs(__pyx_v_state, __pyx_v_n); + } else { + + /* "pywrapfst.pyx":1986 + * cdef void _delete_arcs(self, int64 state, size_t n=0) except *: + * if not (self._mfst.get().DeleteArcs(state, n) if n else + * self._mfst.get().DeleteArcs(state)): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 1986, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_self->_mfst.get()->DeleteArcs(__pyx_v_state); + } + + /* "pywrapfst.pyx":1985 + * + * cdef void _delete_arcs(self, int64 state, size_t n=0) except *: + * if not (self._mfst.get().DeleteArcs(state, n) if n else # <<<<<<<<<<<<<< + * self._mfst.get().DeleteArcs(state)): + * raise FstIndexError("State index out of range") + */ + __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":1987 + * if not (self._mfst.get().DeleteArcs(state, n) if n else + * self._mfst.get().DeleteArcs(state)): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1987, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1987, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1987, __pyx_L1_error) + + /* "pywrapfst.pyx":1985 + * + * cdef void _delete_arcs(self, int64 state, size_t n=0) except *: + * if not (self._mfst.get().DeleteArcs(state, n) if n else # <<<<<<<<<<<<<< + * self._mfst.get().DeleteArcs(state)): + * raise FstIndexError("State index out of range") + */ + } + + /* "pywrapfst.pyx":1988 + * self._mfst.get().DeleteArcs(state)): + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def delete_arcs(self, int64 state, size_t n=0): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 1988, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1988, __pyx_L1_error) + + /* "pywrapfst.pyx":1984 + * return self + * + * cdef void _delete_arcs(self, int64 state, size_t n=0) except *: # <<<<<<<<<<<<<< + * if not (self._mfst.get().DeleteArcs(state, n) if n else + * self._mfst.get().DeleteArcs(state)): + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._MutableFst._delete_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":1990 + * self._check_mutating_imethod() + * + * def delete_arcs(self, int64 state, size_t n=0): # <<<<<<<<<<<<<< + * """ + * delete_arcs(self, state, n=0) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_15delete_arcs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_14delete_arcs[] = "\n delete_arcs(self, state, n=0)\n\n Deletes arcs leaving a particular state.\n\n Args:\n state: The integer index of a state.\n n: An optional argument indicating how many arcs to be deleted. If this\n argument is omitted or passed as zero, all arcs from this state are\n deleted.\n\n Returns:\n self.\n\n Raises:\n FstIndexError: State index out of range.\n\n See also: `delete_states`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_15delete_arcs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_int64 __pyx_v_state; + size_t __pyx_v_n; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("delete_arcs (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_n,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "delete_arcs") < 0)) __PYX_ERR(0, 1990, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_state = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1990, __pyx_L3_error) + if (values[1]) { + __pyx_v_n = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_n == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1990, __pyx_L3_error) + } else { + __pyx_v_n = ((size_t)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("delete_arcs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1990, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.delete_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_14delete_arcs(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_state, __pyx_v_n); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_14delete_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, size_t __pyx_v_n) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_arcs __pyx_t_1; + __Pyx_RefNannySetupContext("delete_arcs", 0); + + /* "pywrapfst.pyx":2010 + * See also: `delete_states`. + * """ + * self._delete_arcs(state, n) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_delete_arcs"); + __PYX_ERR(0, 2010, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.n = __pyx_v_n; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_delete_arcs(__pyx_v_self, __pyx_v_state, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2010, __pyx_L1_error) + + /* "pywrapfst.pyx":2011 + * """ + * self._delete_arcs(state, n) + * return self # <<<<<<<<<<<<<< + * + * cdef void _delete_states(self, states=None) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":1990 + * self._check_mutating_imethod() + * + * def delete_arcs(self, int64 state, size_t n=0): # <<<<<<<<<<<<<< + * """ + * delete_arcs(self, state, n=0) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.delete_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2013 + * return self + * + * cdef void _delete_states(self, states=None) except *: # <<<<<<<<<<<<<< + * # Only the former signature has a possible indexing failure. + * if states: + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__delete_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_states *__pyx_optional_args) { + PyObject *__pyx_v_states = ((PyObject *)Py_None); + __Pyx_RefNannyDeclarations + int __pyx_t_1; + std::vector<__pyx_t_10basictypes_int64> __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("_delete_states", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_states = __pyx_optional_args->states; + } + } + + /* "pywrapfst.pyx":2015 + * cdef void _delete_states(self, states=None) except *: + * # Only the former signature has a possible indexing failure. + * if states: # <<<<<<<<<<<<<< + * if not self._mfst.get().DeleteStates( states): + * raise FstIndexError("State index out of range") + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_states); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2015, __pyx_L1_error) + if (__pyx_t_1) { + + /* "pywrapfst.pyx":2016 + * # Only the former signature has a possible indexing failure. + * if states: + * if not self._mfst.get().DeleteStates( states): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * else: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2016, __pyx_L1_error) + } + __pyx_t_2 = __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(__pyx_v_states); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2016, __pyx_L1_error) + __pyx_t_1 = ((!(__pyx_v_self->_mfst.get()->DeleteStates(((std::vector<__pyx_t_10basictypes_int64> const )__pyx_t_2)) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2017 + * if states: + * if not self._mfst.get().DeleteStates( states): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * else: + * self._mfst.get().DeleteStates() + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2017, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2017, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2017, __pyx_L1_error) + + /* "pywrapfst.pyx":2016 + * # Only the former signature has a possible indexing failure. + * if states: + * if not self._mfst.get().DeleteStates( states): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * else: + */ + } + + /* "pywrapfst.pyx":2015 + * cdef void _delete_states(self, states=None) except *: + * # Only the former signature has a possible indexing failure. + * if states: # <<<<<<<<<<<<<< + * if not self._mfst.get().DeleteStates( states): + * raise FstIndexError("State index out of range") + */ + goto __pyx_L3; + } + + /* "pywrapfst.pyx":2019 + * raise FstIndexError("State index out of range") + * else: + * self._mfst.get().DeleteStates() # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + /*else*/ { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2019, __pyx_L1_error) + } + __pyx_v_self->_mfst.get()->DeleteStates(); + } + __pyx_L3:; + + /* "pywrapfst.pyx":2020 + * else: + * self._mfst.get().DeleteStates() + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def delete_states(self, states=None): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2020, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2020, __pyx_L1_error) + + /* "pywrapfst.pyx":2013 + * return self + * + * cdef void _delete_states(self, states=None) except *: # <<<<<<<<<<<<<< + * # Only the former signature has a possible indexing failure. + * if states: + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._MutableFst._delete_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2022 + * self._check_mutating_imethod() + * + * def delete_states(self, states=None): # <<<<<<<<<<<<<< + * """ + * delete_states(self, states=None) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_17delete_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_16delete_states[] = "\n delete_states(self, states=None)\n\n Deletes states.\n\n Args:\n states: An optional iterable of integer indices of the states to be\n deleted. If this argument is omitted, all states are deleted.\n\n Returns:\n self.\n\n Raises:\n FstIndexError: State index out of range.\n\n See also: `delete_arcs`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_17delete_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_states = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("delete_states (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_states,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_states); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "delete_states") < 0)) __PYX_ERR(0, 2022, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_states = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("delete_states", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2022, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.delete_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_16delete_states(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_states); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_16delete_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_states) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_states __pyx_t_1; + __Pyx_RefNannySetupContext("delete_states", 0); + + /* "pywrapfst.pyx":2040 + * See also: `delete_arcs`. + * """ + * self._delete_states(states) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_delete_states"); + __PYX_ERR(0, 2040, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.states = __pyx_v_states; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_delete_states(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2040, __pyx_L1_error) + + /* "pywrapfst.pyx":2041 + * """ + * self._delete_states(states) + * return self # <<<<<<<<<<<<<< + * + * cdef void _encode(self, EncodeMapper encoder) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2022 + * self._check_mutating_imethod() + * + * def delete_states(self, states=None): # <<<<<<<<<<<<<< + * """ + * delete_states(self, states=None) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.delete_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2043 + * return self + * + * cdef void _encode(self, EncodeMapper encoder) except *: # <<<<<<<<<<<<<< + * fst.Encode(self._mfst.get(), encoder._encoder.get()) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__encode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_encode", 0); + + /* "pywrapfst.pyx":2044 + * + * cdef void _encode(self, EncodeMapper encoder) except *: + * fst.Encode(self._mfst.get(), encoder._encoder.get()) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2044, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_encoder) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encoder"); + __PYX_ERR(0, 2044, __pyx_L1_error) + } + fst::script::Encode(__pyx_v_self->_mfst.get(), __pyx_v_encoder->_encoder.get()); + + /* "pywrapfst.pyx":2045 + * cdef void _encode(self, EncodeMapper encoder) except *: + * fst.Encode(self._mfst.get(), encoder._encoder.get()) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def encode(self, EncodeMapper encoder): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2045, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2045, __pyx_L1_error) + + /* "pywrapfst.pyx":2043 + * return self + * + * cdef void _encode(self, EncodeMapper encoder) except *: # <<<<<<<<<<<<<< + * fst.Encode(self._mfst.get(), encoder._encoder.get()) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._encode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2047 + * self._check_mutating_imethod() + * + * def encode(self, EncodeMapper encoder): # <<<<<<<<<<<<<< + * """ + * encode(self, encoder) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_19encode(PyObject *__pyx_v_self, PyObject *__pyx_v_encoder); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_18encode[] = "\n encode(self, encoder)\n\n Encodes labels and/or weights.\n\n This operation allows for the representation of a weighted transducer as a\n weighted acceptor, an unweighted transducer, or an unweighted acceptor by\n considering the pair (input label, output label), the pair (input label,\n weight), or the triple (input label, output label, weight) as a single\n label. Applying this operation mutates the EncodeMapper argument, which\n can then be used to decode.\n\n Args:\n encoder: An EncodeMapper object to be used as the encoder.\n\n Returns:\n self.\n\n See also: `decode`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_19encode(PyObject *__pyx_v_self, PyObject *__pyx_v_encoder) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("encode (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoder), __pyx_ptype_9pywrapfst_EncodeMapper, 1, "encoder", 0))) __PYX_ERR(0, 2047, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_18encode(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst_EncodeMapper *)__pyx_v_encoder)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_18encode(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst_EncodeMapper *__pyx_v_encoder) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("encode", 0); + + /* "pywrapfst.pyx":2068 + * See also: `decode`. + * """ + * self._encode(encoder) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_encode"); + __PYX_ERR(0, 2068, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_encode(__pyx_v_self, __pyx_v_encoder); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2068, __pyx_L1_error) + + /* "pywrapfst.pyx":2069 + * """ + * self._encode(encoder) + * return self # <<<<<<<<<<<<<< + * + * cdef void _invert(self) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2047 + * self._check_mutating_imethod() + * + * def encode(self, EncodeMapper encoder): # <<<<<<<<<<<<<< + * """ + * encode(self, encoder) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2071 + * return self + * + * cdef void _invert(self) except *: # <<<<<<<<<<<<<< + * fst.Invert(self._mfst.get()) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__invert(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_invert", 0); + + /* "pywrapfst.pyx":2072 + * + * cdef void _invert(self) except *: + * fst.Invert(self._mfst.get()) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2072, __pyx_L1_error) + } + fst::script::Invert(__pyx_v_self->_mfst.get()); + + /* "pywrapfst.pyx":2073 + * cdef void _invert(self) except *: + * fst.Invert(self._mfst.get()) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def invert(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2073, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2073, __pyx_L1_error) + + /* "pywrapfst.pyx":2071 + * return self + * + * cdef void _invert(self) except *: # <<<<<<<<<<<<<< + * fst.Invert(self._mfst.get()) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._invert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2075 + * self._check_mutating_imethod() + * + * def invert(self): # <<<<<<<<<<<<<< + * """ + * invert(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_21invert(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_20invert[] = "\n invert(self)\n\n Inverts the FST's transduction.\n\n This operation destructively inverts the FST's transduction by exchanging\n input and output labels.\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_21invert(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("invert (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_20invert(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_20invert(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("invert", 0); + + /* "pywrapfst.pyx":2087 + * self. + * """ + * self._invert() # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_invert"); + __PYX_ERR(0, 2087, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_invert(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2087, __pyx_L1_error) + + /* "pywrapfst.pyx":2088 + * """ + * self._invert() + * return self # <<<<<<<<<<<<<< + * + * cdef void _minimize(self, float delta=fst.kShortestDelta, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2075 + * self._check_mutating_imethod() + * + * def invert(self): # <<<<<<<<<<<<<< + * """ + * invert(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.invert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2090 + * return self + * + * cdef void _minimize(self, float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * bool allow_nondet=False) except *: + * # This runs in-place when the second argument is null. + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__minimize(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__minimize *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__11; + + /* "pywrapfst.pyx":2091 + * + * cdef void _minimize(self, float delta=fst.kShortestDelta, + * bool allow_nondet=False) except *: # <<<<<<<<<<<<<< + * # This runs in-place when the second argument is null. + * fst.Minimize(self._mfst.get(), NULL, delta, allow_nondet) + */ + bool __pyx_v_allow_nondet = ((bool)0); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_minimize", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_allow_nondet = __pyx_optional_args->allow_nondet; + } + } + } + + /* "pywrapfst.pyx":2093 + * bool allow_nondet=False) except *: + * # This runs in-place when the second argument is null. + * fst.Minimize(self._mfst.get(), NULL, delta, allow_nondet) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2093, __pyx_L1_error) + } + fst::script::Minimize(__pyx_v_self->_mfst.get(), NULL, __pyx_v_delta, __pyx_v_allow_nondet); + + /* "pywrapfst.pyx":2094 + * # This runs in-place when the second argument is null. + * fst.Minimize(self._mfst.get(), NULL, delta, allow_nondet) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def minimize(self, float delta=fst.kShortestDelta, bool allow_nondet=False): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2094, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2094, __pyx_L1_error) + + /* "pywrapfst.pyx":2090 + * return self + * + * cdef void _minimize(self, float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * bool allow_nondet=False) except *: + * # This runs in-place when the second argument is null. + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._minimize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2096 + * self._check_mutating_imethod() + * + * def minimize(self, float delta=fst.kShortestDelta, bool allow_nondet=False): # <<<<<<<<<<<<<< + * """ + * minimize(self, delta=1e-6, allow_nondet=False) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_23minimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_22minimize[] = "\n minimize(self, delta=1e-6, allow_nondet=False)\n\n Minimizes the FST.\n\n This operation destructively performs the minimization of deterministic\n weighted automata and transducers. If the input FST A is an acceptor, this\n operation produces the minimal acceptor B equivalent to A, i.e. the\n acceptor with a minimal number of states that is equivalent to A. If the\n input FST A is a transducer, this operation internally builds an equivalent\n transducer with a minimal number of states. However, this minimality is\n obtained by allowing transition having strings of symbols as output labels,\n this known in the litterature as a real-time transducer. Such transducers\n are not directly supported by the library. This function will convert such\n transducer by expanding each string-labeled transition into a sequence of\n transitions. This will results in the creation of new states, hence losing\n the minimality property.\n\n Args:\n delta: Comparison/quantization delta.\n allow_nondet: Attempt minimization of non-deterministic FST?\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_23minimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_delta; + bool __pyx_v_allow_nondet; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("minimize (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_delta,&__pyx_n_s_allow_nondet,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allow_nondet); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minimize") < 0)) __PYX_ERR(0, 2096, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 2096, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__12; + } + if (values[1]) { + __pyx_v_allow_nondet = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_allow_nondet == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2096, __pyx_L3_error) + } else { + __pyx_v_allow_nondet = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("minimize", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2096, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.minimize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_22minimize(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_delta, __pyx_v_allow_nondet); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_22minimize(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, float __pyx_v_delta, bool __pyx_v_allow_nondet) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__minimize __pyx_t_1; + __Pyx_RefNannySetupContext("minimize", 0); + + /* "pywrapfst.pyx":2122 + * self. + * """ + * self._minimize(delta, allow_nondet) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_minimize"); + __PYX_ERR(0, 2122, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 2; + __pyx_t_1.delta = __pyx_v_delta; + __pyx_t_1.allow_nondet = __pyx_v_allow_nondet; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_minimize(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2122, __pyx_L1_error) + + /* "pywrapfst.pyx":2123 + * """ + * self._minimize(delta, allow_nondet) + * return self # <<<<<<<<<<<<<< + * + * cpdef MutableArcIterator mutable_arcs(self, int64 state): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2096 + * self._check_mutating_imethod() + * + * def minimize(self, float delta=fst.kShortestDelta, bool allow_nondet=False): # <<<<<<<<<<<<<< + * """ + * minimize(self, delta=1e-6, allow_nondet=False) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.minimize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2125 + * return self + * + * cpdef MutableArcIterator mutable_arcs(self, int64 state): # <<<<<<<<<<<<<< + * """ + * mutable_arcs(self, state) + */ + +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_25mutable_arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_f_9pywrapfst_11_MutableFst_mutable_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("mutable_arcs", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mutable_arcs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11_MutableFst_25mutable_arcs)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst_MutableArcIterator))))) __PYX_ERR(0, 2125, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":2139 + * See also: `arcs`, `states`. + * """ + * return MutableArcIterator(self, state) # <<<<<<<<<<<<<< + * + * def mutable_input_symbols(self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9pywrapfst_MutableArcIterator), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2125 + * return self + * + * cpdef MutableArcIterator mutable_arcs(self, int64 state): # <<<<<<<<<<<<<< + * """ + * mutable_arcs(self, state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._MutableFst.mutable_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_25mutable_arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_24mutable_arcs[] = "\n mutable_arcs(self, state)\n\n Returns a mutable iterator over arcs leaving the specified state.\n\n Args:\n state: The source state ID.\n\n Returns:\n A MutableArcIterator.\n\n See also: `arcs`, `states`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_25mutable_arcs(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mutable_arcs (wrapper)", 0); + assert(__pyx_arg_state); { + __pyx_v_state = __Pyx_PyInt_As_int64_t(__pyx_arg_state); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2125, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.mutable_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_24mutable_arcs(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_24mutable_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("mutable_arcs", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_11_MutableFst_mutable_arcs(__pyx_v_self, __pyx_v_state, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._MutableFst.mutable_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2141 + * return MutableArcIterator(self, state) + * + * def mutable_input_symbols(self): # <<<<<<<<<<<<<< + * """ + * mutable_input_symbols(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_27mutable_input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_26mutable_input_symbols[] = "\n mutable_input_symbols(self)\n\n Returns the FST's (mutable) input symbol table, or None if none is present.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_27mutable_input_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mutable_input_symbols (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_26mutable_input_symbols(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_26mutable_input_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + fst::SymbolTable *__pyx_v_syms; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("mutable_input_symbols", 0); + + /* "pywrapfst.pyx":2147 + * Returns the FST's (mutable) input symbol table, or None if none is present. + * """ + * cdef fst.SymbolTable *syms = self._mfst.get().MutableInputSymbols() # <<<<<<<<<<<<<< + * if syms == NULL: + * return + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2147, __pyx_L1_error) + } + __pyx_v_syms = __pyx_v_self->_mfst.get()->MutableInputSymbols(); + + /* "pywrapfst.pyx":2148 + * """ + * cdef fst.SymbolTable *syms = self._mfst.get().MutableInputSymbols() + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_MutableFstSymbolTable(syms, self._mfst) + */ + __pyx_t_1 = ((__pyx_v_syms == NULL) != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":2149 + * cdef fst.SymbolTable *syms = self._mfst.get().MutableInputSymbols() + * if syms == NULL: + * return # <<<<<<<<<<<<<< + * return _init_MutableFstSymbolTable(syms, self._mfst) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pywrapfst.pyx":2148 + * """ + * cdef fst.SymbolTable *syms = self._mfst.get().MutableInputSymbols() + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_MutableFstSymbolTable(syms, self._mfst) + */ + } + + /* "pywrapfst.pyx":2150 + * if syms == NULL: + * return + * return _init_MutableFstSymbolTable(syms, self._mfst) # <<<<<<<<<<<<<< + * + * def mutable_output_symbols(self): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2150, __pyx_L1_error) + } + __pyx_t_2 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFstSymbolTable(__pyx_v_syms, __pyx_v_self->_mfst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2141 + * return MutableArcIterator(self, state) + * + * def mutable_input_symbols(self): # <<<<<<<<<<<<<< + * """ + * mutable_input_symbols(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._MutableFst.mutable_input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2152 + * return _init_MutableFstSymbolTable(syms, self._mfst) + * + * def mutable_output_symbols(self): # <<<<<<<<<<<<<< + * """ + * mutable_output_symbols(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_29mutable_output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_28mutable_output_symbols[] = "\n mutable_output_symbols(self)\n\n Returns the FST's (mutable) output symbol table, or None if none is present.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_29mutable_output_symbols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mutable_output_symbols (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_28mutable_output_symbols(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_28mutable_output_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + fst::SymbolTable *__pyx_v_syms; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("mutable_output_symbols", 0); + + /* "pywrapfst.pyx":2158 + * Returns the FST's (mutable) output symbol table, or None if none is present. + * """ + * cdef fst.SymbolTable *syms = self._mfst.get().MutableOutputSymbols() # <<<<<<<<<<<<<< + * if syms == NULL: + * return + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2158, __pyx_L1_error) + } + __pyx_v_syms = __pyx_v_self->_mfst.get()->MutableOutputSymbols(); + + /* "pywrapfst.pyx":2159 + * """ + * cdef fst.SymbolTable *syms = self._mfst.get().MutableOutputSymbols() + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_MutableFstSymbolTable(syms, self._mfst) + */ + __pyx_t_1 = ((__pyx_v_syms == NULL) != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":2160 + * cdef fst.SymbolTable *syms = self._mfst.get().MutableOutputSymbols() + * if syms == NULL: + * return # <<<<<<<<<<<<<< + * return _init_MutableFstSymbolTable(syms, self._mfst) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pywrapfst.pyx":2159 + * """ + * cdef fst.SymbolTable *syms = self._mfst.get().MutableOutputSymbols() + * if syms == NULL: # <<<<<<<<<<<<<< + * return + * return _init_MutableFstSymbolTable(syms, self._mfst) + */ + } + + /* "pywrapfst.pyx":2161 + * if syms == NULL: + * return + * return _init_MutableFstSymbolTable(syms, self._mfst) # <<<<<<<<<<<<<< + * + * cpdef int64 num_states(self): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2161, __pyx_L1_error) + } + __pyx_t_2 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFstSymbolTable(__pyx_v_syms, __pyx_v_self->_mfst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2152 + * return _init_MutableFstSymbolTable(syms, self._mfst) + * + * def mutable_output_symbols(self): # <<<<<<<<<<<<<< + * """ + * mutable_output_symbols(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._MutableFst.mutable_output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2163 + * return _init_MutableFstSymbolTable(syms, self._mfst) + * + * cpdef int64 num_states(self): # <<<<<<<<<<<<<< + * """ + * num_states(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_31num_states(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_11_MutableFst_num_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_5; + __Pyx_RefNannySetupContext("num_states", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_states); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11_MutableFst_31num_states)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2163, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":2169 + * Returns the number of states. + * """ + * return self._mfst.get().NumStates() # <<<<<<<<<<<<<< + * + * cdef void _project(self, bool project_output=False) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2169, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_mfst.get()->NumStates(); + goto __pyx_L0; + + /* "pywrapfst.pyx":2163 + * return _init_MutableFstSymbolTable(syms, self._mfst) + * + * cpdef int64 num_states(self): # <<<<<<<<<<<<<< + * """ + * num_states(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst._MutableFst.num_states", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_31num_states(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_30num_states[] = "\n num_states(self)\n\n Returns the number of states.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_31num_states(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_states (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_30num_states(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_30num_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("num_states", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_f_9pywrapfst_11_MutableFst_num_states(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._MutableFst.num_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2171 + * return self._mfst.get().NumStates() + * + * cdef void _project(self, bool project_output=False) except *: # <<<<<<<<<<<<<< + * fst.Project(self._mfst.get(), fst.GetProjectType(project_output)) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__project(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__project *__pyx_optional_args) { + bool __pyx_v_project_output = ((bool)0); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_project", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_project_output = __pyx_optional_args->project_output; + } + } + + /* "pywrapfst.pyx":2172 + * + * cdef void _project(self, bool project_output=False) except *: + * fst.Project(self._mfst.get(), fst.GetProjectType(project_output)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2172, __pyx_L1_error) + } + fst::script::Project(__pyx_v_self->_mfst.get(), fst::script::GetProjectType(__pyx_v_project_output)); + + /* "pywrapfst.pyx":2173 + * cdef void _project(self, bool project_output=False) except *: + * fst.Project(self._mfst.get(), fst.GetProjectType(project_output)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def project(self, bool project_output=False): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2173, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2173, __pyx_L1_error) + + /* "pywrapfst.pyx":2171 + * return self._mfst.get().NumStates() + * + * cdef void _project(self, bool project_output=False) except *: # <<<<<<<<<<<<<< + * fst.Project(self._mfst.get(), fst.GetProjectType(project_output)) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._project", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2175 + * self._check_mutating_imethod() + * + * def project(self, bool project_output=False): # <<<<<<<<<<<<<< + * """ + * project(self, project_output=False) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_33project(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_32project[] = "\n project(self, project_output=False)\n\n Converts the FST to an acceptor using input or output labels.\n\n This operation destructively projects an FST onto its domain or range by\n either copying each arc's input label to its output label (the default) or\n vice versa.\n\n Args:\n project_output: Should the output labels be projected?\n\n Returns:\n self.\n\n See also: `decode`, `encode`, `relabel_pairs`, `relabel_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_33project(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + bool __pyx_v_project_output; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("project (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_project_output,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_project_output); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "project") < 0)) __PYX_ERR(0, 2175, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_project_output = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_project_output == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2175, __pyx_L3_error) + } else { + __pyx_v_project_output = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("project", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2175, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.project", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_32project(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_project_output); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_32project(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, bool __pyx_v_project_output) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__project __pyx_t_1; + __Pyx_RefNannySetupContext("project", 0); + + /* "pywrapfst.pyx":2193 + * See also: `decode`, `encode`, `relabel_pairs`, `relabel_symbols`. + * """ + * self._project(project_output) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_project"); + __PYX_ERR(0, 2193, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.project_output = __pyx_v_project_output; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_project(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2193, __pyx_L1_error) + + /* "pywrapfst.pyx":2194 + * """ + * self._project(project_output) + * return self # <<<<<<<<<<<<<< + * + * cdef void _prune(self, float delta=fst.kDelta, int64 nstate=fst.kNoStateId, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2175 + * self._check_mutating_imethod() + * + * def project(self, bool project_output=False): # <<<<<<<<<<<<<< + * """ + * project(self, project_output=False) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.project", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2196 + * return self + * + * cdef void _prune(self, float delta=fst.kDelta, int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * weight=None) except *: + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__prune(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__prune *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__13; + __pyx_t_10basictypes_int64 __pyx_v_nstate = __pyx_k__14; + + /* "pywrapfst.pyx":2197 + * + * cdef void _prune(self, float delta=fst.kDelta, int64 nstate=fst.kNoStateId, + * weight=None) except *: # <<<<<<<<<<<<<< + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + fst::script::WeightClass __pyx_v_wc; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + __Pyx_RefNannySetupContext("_prune", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_nstate = __pyx_optional_args->nstate; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_weight = __pyx_optional_args->weight; + } + } + } + } + + /* "pywrapfst.pyx":2199 + * weight=None) except *: + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), # <<<<<<<<<<<<<< + * weight) + * fst.Prune(self._mfst.get(), wc, nstate, delta) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 2199, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2200 + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + * weight) # <<<<<<<<<<<<<< + * fst.Prune(self._mfst.get(), wc, nstate, delta) + * self._check_mutating_imethod() + */ + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_Zero(((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.weight_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2199, __pyx_L1_error) + __pyx_v_wc = __pyx_t_1; + + /* "pywrapfst.pyx":2201 + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + * weight) + * fst.Prune(self._mfst.get(), wc, nstate, delta) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2201, __pyx_L1_error) + } + fst::script::Prune(__pyx_v_self->_mfst.get(), __pyx_v_wc, __pyx_v_nstate, __pyx_v_delta); + + /* "pywrapfst.pyx":2202 + * weight) + * fst.Prune(self._mfst.get(), wc, nstate, delta) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def prune(self, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2202, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2202, __pyx_L1_error) + + /* "pywrapfst.pyx":2196 + * return self + * + * cdef void _prune(self, float delta=fst.kDelta, int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * weight=None) except *: + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2204 + * self._check_mutating_imethod() + * + * def prune(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_35prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_34prune[] = "\n prune(self, delta=0.0009765625, nstate=NO_STATE_ID, weight=None)\n\n Removes paths with weights below a certain threshold.\n\n This operation deletes states and arcs in the input FST that do not belong\n to a successful path whose weight is no more (w.r.t the natural semiring\n order) than the threshold t \\otimes-times the weight of the shortest path in\n the input FST. Weights must be commutative and have the path property.\n\n Args:\n delta: Comparison/quantization delta.\n nstate: State number threshold.\n weight: A Weight or weight string indicating the desired weight threshold\n below which paths are pruned; if omitted, no paths are pruned.\n\n Returns:\n self.\n\n See also: The constructive variant.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_35prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_delta; + __pyx_t_10basictypes_int64 __pyx_v_nstate; + PyObject *__pyx_v_weight = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("prune (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_delta,&__pyx_n_s_nstate,&__pyx_n_s_weight,0}; + PyObject* values[3] = {0,0,0}; + + /* "pywrapfst.pyx":2207 + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + * weight=None): # <<<<<<<<<<<<<< + * """ + * prune(self, delta=0.0009765625, nstate=NO_STATE_ID, weight=None) + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nstate); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prune") < 0)) __PYX_ERR(0, 2204, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 2205, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__15; + } + if (values[1]) { + __pyx_v_nstate = __Pyx_PyInt_As_int64_t(values[1]); if (unlikely((__pyx_v_nstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2206, __pyx_L3_error) + } else { + __pyx_v_nstate = __pyx_k__16; + } + __pyx_v_weight = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2204, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_34prune(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_delta, __pyx_v_nstate, __pyx_v_weight); + + /* "pywrapfst.pyx":2204 + * self._check_mutating_imethod() + * + * def prune(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_34prune(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_weight) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__prune __pyx_t_1; + __Pyx_RefNannySetupContext("prune", 0); + + /* "pywrapfst.pyx":2229 + * See also: The constructive variant. + * """ + * self._prune(delta, nstate, weight) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_prune"); + __PYX_ERR(0, 2229, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 3; + __pyx_t_1.delta = __pyx_v_delta; + __pyx_t_1.nstate = __pyx_v_nstate; + __pyx_t_1.weight = __pyx_v_weight; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_prune(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2229, __pyx_L1_error) + + /* "pywrapfst.pyx":2230 + * """ + * self._prune(delta, nstate, weight) + * return self # <<<<<<<<<<<<<< + * + * cdef void _push(self, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2204 + * self._check_mutating_imethod() + * + * def prune(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2232 + * return self + * + * cdef void _push(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool remove_total_weight=False, + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__push(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__push *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__17; + + /* "pywrapfst.pyx":2234 + * cdef void _push(self, + * float delta=fst.kDelta, + * bool remove_total_weight=False, # <<<<<<<<<<<<<< + * bool to_final=False) except *: + * fst.Push(self._mfst.get(), fst.GetReweightType(to_final), delta, + */ + bool __pyx_v_remove_total_weight = ((bool)0); + + /* "pywrapfst.pyx":2235 + * float delta=fst.kDelta, + * bool remove_total_weight=False, + * bool to_final=False) except *: # <<<<<<<<<<<<<< + * fst.Push(self._mfst.get(), fst.GetReweightType(to_final), delta, + * remove_total_weight) + */ + bool __pyx_v_to_final = ((bool)0); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_push", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_remove_total_weight = __pyx_optional_args->remove_total_weight; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_to_final = __pyx_optional_args->to_final; + } + } + } + } + + /* "pywrapfst.pyx":2236 + * bool remove_total_weight=False, + * bool to_final=False) except *: + * fst.Push(self._mfst.get(), fst.GetReweightType(to_final), delta, # <<<<<<<<<<<<<< + * remove_total_weight) + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2236, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2237 + * bool to_final=False) except *: + * fst.Push(self._mfst.get(), fst.GetReweightType(to_final), delta, + * remove_total_weight) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + fst::script::Push(__pyx_v_self->_mfst.get(), fst::script::GetReweightType(__pyx_v_to_final), __pyx_v_delta, __pyx_v_remove_total_weight); + + /* "pywrapfst.pyx":2238 + * fst.Push(self._mfst.get(), fst.GetReweightType(to_final), delta, + * remove_total_weight) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def push(self, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2238, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2238, __pyx_L1_error) + + /* "pywrapfst.pyx":2232 + * return self + * + * cdef void _push(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool remove_total_weight=False, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._push", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2240 + * self._check_mutating_imethod() + * + * def push(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool remove_total_weight=False, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_37push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_36push[] = "\n push(self, delta=0.0009765625, remove_total_weight=False, to_final=False)\n\n Pushes weights towards the initial or final states.\n\n This operation destructively produces an equivalent transducer by pushing\n the weights towards the initial state or toward the final states. When\n pushing weights towards the initial state, the sum of the weight of the\n outgoing transitions and final weight at any non-initial state is equal to\n one in the resulting machine. When pushing weights towards the final states,\n the sum of the weight of the incoming transitions at any state is equal to\n one. Weights need to be left distributive when pushing towards the initial\n state and right distributive when pushing towards the final states.\n\n Args:\n delta: Comparison/quantization delta.\n remove_total_weight: If pushing weights, should the total weight be\n removed?\n to_final: Push towards final states?\n\n Returns:\n self.\n\n See also: The constructive variant, which also supports label pushing.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_37push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_delta; + bool __pyx_v_remove_total_weight; + bool __pyx_v_to_final; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("push (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_delta,&__pyx_n_s_remove_total_weight,&__pyx_n_s_to_final,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_remove_total_weight); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_to_final); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) __PYX_ERR(0, 2240, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 2241, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__18; + } + if (values[1]) { + __pyx_v_remove_total_weight = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_remove_total_weight == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2242, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":2242 + * def push(self, + * float delta=fst.kDelta, + * bool remove_total_weight=False, # <<<<<<<<<<<<<< + * bool to_final=False): + * """ + */ + __pyx_v_remove_total_weight = ((bool)0); + } + if (values[2]) { + __pyx_v_to_final = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_to_final == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2243, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":2243 + * float delta=fst.kDelta, + * bool remove_total_weight=False, + * bool to_final=False): # <<<<<<<<<<<<<< + * """ + * push(self, delta=0.0009765625, remove_total_weight=False, to_final=False) + */ + __pyx_v_to_final = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("push", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2240, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.push", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_36push(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_delta, __pyx_v_remove_total_weight, __pyx_v_to_final); + + /* "pywrapfst.pyx":2240 + * self._check_mutating_imethod() + * + * def push(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool remove_total_weight=False, + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_36push(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, float __pyx_v_delta, bool __pyx_v_remove_total_weight, bool __pyx_v_to_final) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__push __pyx_t_1; + __Pyx_RefNannySetupContext("push", 0); + + /* "pywrapfst.pyx":2269 + * See also: The constructive variant, which also supports label pushing. + * """ + * self._push(delta, remove_total_weight, to_final) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_push"); + __PYX_ERR(0, 2269, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 3; + __pyx_t_1.delta = __pyx_v_delta; + __pyx_t_1.remove_total_weight = __pyx_v_remove_total_weight; + __pyx_t_1.to_final = __pyx_v_to_final; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_push(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2269, __pyx_L1_error) + + /* "pywrapfst.pyx":2270 + * """ + * self._push(delta, remove_total_weight, to_final) + * return self # <<<<<<<<<<<<<< + * + * cdef void _relabel_pairs(self, ipairs=None, opairs=None) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2240 + * self._check_mutating_imethod() + * + * def push(self, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool remove_total_weight=False, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.push", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2272 + * return self + * + * cdef void _relabel_pairs(self, ipairs=None, opairs=None) except *: # <<<<<<<<<<<<<< + * cdef unique_ptr[vector[fst.LabelPair]] _ipairs + * _ipairs.reset(new vector[fst.LabelPair]()) + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__relabel_pairs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_pairs *__pyx_optional_args) { + PyObject *__pyx_v_ipairs = ((PyObject *)Py_None); + PyObject *__pyx_v_opairs = ((PyObject *)Py_None); + std::unique_ptr > __pyx_v__ipairs; + std::unique_ptr > __pyx_v__opairs; + __pyx_t_10basictypes_int64 __pyx_v_before; + __pyx_t_10basictypes_int64 __pyx_v_after; + __Pyx_RefNannyDeclarations + std::vector<__pyx_t_3fst_LabelPair> *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *(*__pyx_t_10)(PyObject *); + __pyx_t_10basictypes_int64 __pyx_t_11; + __pyx_t_10basictypes_int64 __pyx_t_12; + __pyx_t_3fst_LabelPair __pyx_t_13; + int __pyx_t_14; + __Pyx_RefNannySetupContext("_relabel_pairs", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_ipairs = __pyx_optional_args->ipairs; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_opairs = __pyx_optional_args->opairs; + } + } + } + + /* "pywrapfst.pyx":2274 + * cdef void _relabel_pairs(self, ipairs=None, opairs=None) except *: + * cdef unique_ptr[vector[fst.LabelPair]] _ipairs + * _ipairs.reset(new vector[fst.LabelPair]()) # <<<<<<<<<<<<<< + * cdef unique_ptr[vector[fst.LabelPair]] _opairs + * _opairs.reset(new vector[fst.LabelPair]()) + */ + try { + __pyx_t_1 = new std::vector<__pyx_t_3fst_LabelPair> (); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2274, __pyx_L1_error) + } + __pyx_v__ipairs.reset(__pyx_t_1); + + /* "pywrapfst.pyx":2276 + * _ipairs.reset(new vector[fst.LabelPair]()) + * cdef unique_ptr[vector[fst.LabelPair]] _opairs + * _opairs.reset(new vector[fst.LabelPair]()) # <<<<<<<<<<<<<< + * cdef int64 before + * cdef int64 after + */ + try { + __pyx_t_1 = new std::vector<__pyx_t_3fst_LabelPair> (); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2276, __pyx_L1_error) + } + __pyx_v__opairs.reset(__pyx_t_1); + + /* "pywrapfst.pyx":2279 + * cdef int64 before + * cdef int64 after + * if ipairs: # <<<<<<<<<<<<<< + * for (before, after) in ipairs: + * _ipairs.get().push_back(fst.LabelPair(before, after)) + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ipairs); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2279, __pyx_L1_error) + if (__pyx_t_2) { + + /* "pywrapfst.pyx":2280 + * cdef int64 after + * if ipairs: + * for (before, after) in ipairs: # <<<<<<<<<<<<<< + * _ipairs.get().push_back(fst.LabelPair(before, after)) + * if opairs: + */ + if (likely(PyList_CheckExact(__pyx_v_ipairs)) || PyTuple_CheckExact(__pyx_v_ipairs)) { + __pyx_t_3 = __pyx_v_ipairs; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_ipairs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2280, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2280, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2280, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 2280, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 2280, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_7 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + #else + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; + index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 2280, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 2280, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __pyx_t_11 = __Pyx_PyInt_As_int64_t(__pyx_t_7); if (unlikely((__pyx_t_11 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_12 = __Pyx_PyInt_As_int64_t(__pyx_t_8); if (unlikely((__pyx_t_12 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2280, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_before = __pyx_t_11; + __pyx_v_after = __pyx_t_12; + + /* "pywrapfst.pyx":2281 + * if ipairs: + * for (before, after) in ipairs: + * _ipairs.get().push_back(fst.LabelPair(before, after)) # <<<<<<<<<<<<<< + * if opairs: + * for (before, after) in opairs: + */ + try { + __pyx_t_13 = __pyx_t_3fst_LabelPair(__pyx_v_before, __pyx_v_after); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2281, __pyx_L1_error) + } + try { + __pyx_v__ipairs.get()->push_back(__pyx_t_13); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2281, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2280 + * cdef int64 after + * if ipairs: + * for (before, after) in ipairs: # <<<<<<<<<<<<<< + * _ipairs.get().push_back(fst.LabelPair(before, after)) + * if opairs: + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pywrapfst.pyx":2279 + * cdef int64 before + * cdef int64 after + * if ipairs: # <<<<<<<<<<<<<< + * for (before, after) in ipairs: + * _ipairs.get().push_back(fst.LabelPair(before, after)) + */ + } + + /* "pywrapfst.pyx":2282 + * for (before, after) in ipairs: + * _ipairs.get().push_back(fst.LabelPair(before, after)) + * if opairs: # <<<<<<<<<<<<<< + * for (before, after) in opairs: + * _opairs.get().push_back(fst.LabelPair(before, after)) + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_opairs); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2282, __pyx_L1_error) + if (__pyx_t_2) { + + /* "pywrapfst.pyx":2283 + * _ipairs.get().push_back(fst.LabelPair(before, after)) + * if opairs: + * for (before, after) in opairs: # <<<<<<<<<<<<<< + * _opairs.get().push_back(fst.LabelPair(before, after)) + * if _ipairs.get().empty() and _opairs.get().empty(): + */ + if (likely(PyList_CheckExact(__pyx_v_opairs)) || PyTuple_CheckExact(__pyx_v_opairs)) { + __pyx_t_3 = __pyx_v_opairs; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_opairs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2283, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2283, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2283, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 2283, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 2283, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + __pyx_t_7 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; + index = 0; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 2283, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_unpacking_done; + __pyx_L11_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 2283, __pyx_L1_error) + __pyx_L12_unpacking_done:; + } + __pyx_t_12 = __Pyx_PyInt_As_int64_t(__pyx_t_8); if (unlikely((__pyx_t_12 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_11 = __Pyx_PyInt_As_int64_t(__pyx_t_7); if (unlikely((__pyx_t_11 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2283, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_before = __pyx_t_12; + __pyx_v_after = __pyx_t_11; + + /* "pywrapfst.pyx":2284 + * if opairs: + * for (before, after) in opairs: + * _opairs.get().push_back(fst.LabelPair(before, after)) # <<<<<<<<<<<<<< + * if _ipairs.get().empty() and _opairs.get().empty(): + * raise FstArgError("No relabeling pairs specified.") + */ + try { + __pyx_t_13 = __pyx_t_3fst_LabelPair(__pyx_v_before, __pyx_v_after); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2284, __pyx_L1_error) + } + try { + __pyx_v__opairs.get()->push_back(__pyx_t_13); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2284, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2283 + * _ipairs.get().push_back(fst.LabelPair(before, after)) + * if opairs: + * for (before, after) in opairs: # <<<<<<<<<<<<<< + * _opairs.get().push_back(fst.LabelPair(before, after)) + * if _ipairs.get().empty() and _opairs.get().empty(): + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pywrapfst.pyx":2282 + * for (before, after) in ipairs: + * _ipairs.get().push_back(fst.LabelPair(before, after)) + * if opairs: # <<<<<<<<<<<<<< + * for (before, after) in opairs: + * _opairs.get().push_back(fst.LabelPair(before, after)) + */ + } + + /* "pywrapfst.pyx":2285 + * for (before, after) in opairs: + * _opairs.get().push_back(fst.LabelPair(before, after)) + * if _ipairs.get().empty() and _opairs.get().empty(): # <<<<<<<<<<<<<< + * raise FstArgError("No relabeling pairs specified.") + * fst.Relabel(self._mfst.get(), deref(_ipairs), deref(_opairs)) + */ + __pyx_t_14 = (__pyx_v__ipairs.get()->empty() != 0); + if (__pyx_t_14) { + } else { + __pyx_t_2 = __pyx_t_14; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_14 = (__pyx_v__opairs.get()->empty() != 0); + __pyx_t_2 = __pyx_t_14; + __pyx_L14_bool_binop_done:; + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":2286 + * _opairs.get().push_back(fst.LabelPair(before, after)) + * if _ipairs.get().empty() and _opairs.get().empty(): + * raise FstArgError("No relabeling pairs specified.") # <<<<<<<<<<<<<< + * fst.Relabel(self._mfst.get(), deref(_ipairs), deref(_opairs)) + * self._check_mutating_imethod() + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_kp_u_No_relabeling_pairs_specified) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_No_relabeling_pairs_specified); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2286, __pyx_L1_error) + + /* "pywrapfst.pyx":2285 + * for (before, after) in opairs: + * _opairs.get().push_back(fst.LabelPair(before, after)) + * if _ipairs.get().empty() and _opairs.get().empty(): # <<<<<<<<<<<<<< + * raise FstArgError("No relabeling pairs specified.") + * fst.Relabel(self._mfst.get(), deref(_ipairs), deref(_opairs)) + */ + } + + /* "pywrapfst.pyx":2287 + * if _ipairs.get().empty() and _opairs.get().empty(): + * raise FstArgError("No relabeling pairs specified.") + * fst.Relabel(self._mfst.get(), deref(_ipairs), deref(_opairs)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2287, __pyx_L1_error) + } + fst::script::Relabel(__pyx_v_self->_mfst.get(), (*__pyx_v__ipairs), (*__pyx_v__opairs)); + + /* "pywrapfst.pyx":2288 + * raise FstArgError("No relabeling pairs specified.") + * fst.Relabel(self._mfst.get(), deref(_ipairs), deref(_opairs)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def relabel_pairs(self, ipairs=None, opairs=None): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2288, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2288, __pyx_L1_error) + + /* "pywrapfst.pyx":2272 + * return self + * + * cdef void _relabel_pairs(self, ipairs=None, opairs=None) except *: # <<<<<<<<<<<<<< + * cdef unique_ptr[vector[fst.LabelPair]] _ipairs + * _ipairs.reset(new vector[fst.LabelPair]()) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("pywrapfst._MutableFst._relabel_pairs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2290 + * self._check_mutating_imethod() + * + * def relabel_pairs(self, ipairs=None, opairs=None): # <<<<<<<<<<<<<< + * """ + * relabel_pairs(self, ipairs=None, opairs=None) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_39relabel_pairs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_38relabel_pairs[] = "\n relabel_pairs(self, ipairs=None, opairs=None)\n\n Replaces input and/or output labels using pairs of labels.\n\n This operation destructively relabels the input and/or output labels of the\n FST using pairs of the form (old_ID, new_ID); omitted indices are\n identity-mapped.\n\n Args:\n ipairs: An iterable containing (older index, newer index) integer pairs.\n opairs: An iterable containing (older index, newer index) integer pairs.\n\n Returns:\n self.\n\n Raises:\n FstArgError: No relabeling pairs specified.\n\n See also: `decode`, `encode`, `project`, `relabel_tables`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_39relabel_pairs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ipairs = 0; + PyObject *__pyx_v_opairs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("relabel_pairs (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ipairs,&__pyx_n_s_opairs,0}; + PyObject* values[2] = {0,0}; + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ipairs); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opairs); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "relabel_pairs") < 0)) __PYX_ERR(0, 2290, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ipairs = values[0]; + __pyx_v_opairs = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("relabel_pairs", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2290, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.relabel_pairs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_38relabel_pairs(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_ipairs, __pyx_v_opairs); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_38relabel_pairs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_ipairs, PyObject *__pyx_v_opairs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_pairs __pyx_t_1; + __Pyx_RefNannySetupContext("relabel_pairs", 0); + + /* "pywrapfst.pyx":2312 + * See also: `decode`, `encode`, `project`, `relabel_tables`. + * """ + * self._relabel_pairs(ipairs, opairs) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_relabel_pairs"); + __PYX_ERR(0, 2312, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 2; + __pyx_t_1.ipairs = __pyx_v_ipairs; + __pyx_t_1.opairs = __pyx_v_opairs; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_relabel_pairs(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2312, __pyx_L1_error) + + /* "pywrapfst.pyx":2313 + * """ + * self._relabel_pairs(ipairs, opairs) + * return self # <<<<<<<<<<<<<< + * + * cdef void _relabel_tables(self, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2290 + * self._check_mutating_imethod() + * + * def relabel_pairs(self, ipairs=None, opairs=None): # <<<<<<<<<<<<<< + * """ + * relabel_pairs(self, ipairs=None, opairs=None) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.relabel_pairs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2315 + * return self + * + * cdef void _relabel_tables(self, # <<<<<<<<<<<<<< + * _SymbolTable old_isymbols=None, + * _SymbolTable new_isymbols=None, + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__relabel_tables(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_tables *__pyx_optional_args) { + + /* "pywrapfst.pyx":2316 + * + * cdef void _relabel_tables(self, + * _SymbolTable old_isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable new_isymbols=None, + * unknown_isymbol=b"", + */ + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":2317 + * cdef void _relabel_tables(self, + * _SymbolTable old_isymbols=None, + * _SymbolTable new_isymbols=None, # <<<<<<<<<<<<<< + * unknown_isymbol=b"", + * bool attach_new_isymbols=True, + */ + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + PyObject *__pyx_v_unknown_isymbol = ((PyObject *)__pyx_kp_b__10); + + /* "pywrapfst.pyx":2319 + * _SymbolTable new_isymbols=None, + * unknown_isymbol=b"", + * bool attach_new_isymbols=True, # <<<<<<<<<<<<<< + * _SymbolTable old_osymbols=None, + * _SymbolTable new_osymbols=None, + */ + bool __pyx_v_attach_new_isymbols = ((bool)1); + + /* "pywrapfst.pyx":2320 + * unknown_isymbol=b"", + * bool attach_new_isymbols=True, + * _SymbolTable old_osymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable new_osymbols=None, + * unknown_osymbol=b"", + */ + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":2321 + * bool attach_new_isymbols=True, + * _SymbolTable old_osymbols=None, + * _SymbolTable new_osymbols=None, # <<<<<<<<<<<<<< + * unknown_osymbol=b"", + * bool attach_new_osymbols=True) except *: + */ + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + PyObject *__pyx_v_unknown_osymbol = ((PyObject *)__pyx_kp_b__10); + + /* "pywrapfst.pyx":2323 + * _SymbolTable new_osymbols=None, + * unknown_osymbol=b"", + * bool attach_new_osymbols=True) except *: # <<<<<<<<<<<<<< + * if new_isymbols is None and new_osymbols is None: + * raise FstArgError("No new SymbolTables specified") + */ + bool __pyx_v_attach_new_osymbols = ((bool)1); + fst::SymbolTable *__pyx_v_new_isymbols_ptr; + fst::SymbolTable *__pyx_v_new_osymbols_ptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + fst::SymbolTable *__pyx_t_7; + fst::SymbolTable const *__pyx_t_8; + std::string __pyx_t_9; + fst::SymbolTable const *__pyx_t_10; + std::string __pyx_t_11; + __Pyx_RefNannySetupContext("_relabel_tables", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_old_isymbols = __pyx_optional_args->old_isymbols; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_new_isymbols = __pyx_optional_args->new_isymbols; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_unknown_isymbol = __pyx_optional_args->unknown_isymbol; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_attach_new_isymbols = __pyx_optional_args->attach_new_isymbols; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_old_osymbols = __pyx_optional_args->old_osymbols; + if (__pyx_optional_args->__pyx_n > 5) { + __pyx_v_new_osymbols = __pyx_optional_args->new_osymbols; + if (__pyx_optional_args->__pyx_n > 6) { + __pyx_v_unknown_osymbol = __pyx_optional_args->unknown_osymbol; + if (__pyx_optional_args->__pyx_n > 7) { + __pyx_v_attach_new_osymbols = __pyx_optional_args->attach_new_osymbols; + } + } + } + } + } + } + } + } + } + + /* "pywrapfst.pyx":2324 + * unknown_osymbol=b"", + * bool attach_new_osymbols=True) except *: + * if new_isymbols is None and new_osymbols is None: # <<<<<<<<<<<<<< + * raise FstArgError("No new SymbolTables specified") + * cdef fst.SymbolTable *new_isymbols_ptr = NULL + */ + __pyx_t_2 = (((PyObject *)__pyx_v_new_isymbols) == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = (((PyObject *)__pyx_v_new_osymbols) == Py_None); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2325 + * bool attach_new_osymbols=True) except *: + * if new_isymbols is None and new_osymbols is None: + * raise FstArgError("No new SymbolTables specified") # <<<<<<<<<<<<<< + * cdef fst.SymbolTable *new_isymbols_ptr = NULL + * if new_isymbols is not None: + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_u_No_new_SymbolTables_specified) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_No_new_SymbolTables_specified); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 2325, __pyx_L1_error) + + /* "pywrapfst.pyx":2324 + * unknown_osymbol=b"", + * bool attach_new_osymbols=True) except *: + * if new_isymbols is None and new_osymbols is None: # <<<<<<<<<<<<<< + * raise FstArgError("No new SymbolTables specified") + * cdef fst.SymbolTable *new_isymbols_ptr = NULL + */ + } + + /* "pywrapfst.pyx":2326 + * if new_isymbols is None and new_osymbols is None: + * raise FstArgError("No new SymbolTables specified") + * cdef fst.SymbolTable *new_isymbols_ptr = NULL # <<<<<<<<<<<<<< + * if new_isymbols is not None: + * new_isymbols_ptr = new_isymbols._table + */ + __pyx_v_new_isymbols_ptr = NULL; + + /* "pywrapfst.pyx":2327 + * raise FstArgError("No new SymbolTables specified") + * cdef fst.SymbolTable *new_isymbols_ptr = NULL + * if new_isymbols is not None: # <<<<<<<<<<<<<< + * new_isymbols_ptr = new_isymbols._table + * cdef fst.SymbolTable *new_osymbols_ptr = NULL + */ + __pyx_t_1 = (((PyObject *)__pyx_v_new_isymbols) != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":2328 + * cdef fst.SymbolTable *new_isymbols_ptr = NULL + * if new_isymbols is not None: + * new_isymbols_ptr = new_isymbols._table # <<<<<<<<<<<<<< + * cdef fst.SymbolTable *new_osymbols_ptr = NULL + * if new_osymbols is not None: + */ + if (unlikely(((PyObject *)__pyx_v_new_isymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 2328, __pyx_L1_error) + } + __pyx_t_7 = __pyx_v_new_isymbols->_table; + __pyx_v_new_isymbols_ptr = __pyx_t_7; + + /* "pywrapfst.pyx":2327 + * raise FstArgError("No new SymbolTables specified") + * cdef fst.SymbolTable *new_isymbols_ptr = NULL + * if new_isymbols is not None: # <<<<<<<<<<<<<< + * new_isymbols_ptr = new_isymbols._table + * cdef fst.SymbolTable *new_osymbols_ptr = NULL + */ + } + + /* "pywrapfst.pyx":2329 + * if new_isymbols is not None: + * new_isymbols_ptr = new_isymbols._table + * cdef fst.SymbolTable *new_osymbols_ptr = NULL # <<<<<<<<<<<<<< + * if new_osymbols is not None: + * new_osymbols_ptr = new_osymbols._table + */ + __pyx_v_new_osymbols_ptr = NULL; + + /* "pywrapfst.pyx":2330 + * new_isymbols_ptr = new_isymbols._table + * cdef fst.SymbolTable *new_osymbols_ptr = NULL + * if new_osymbols is not None: # <<<<<<<<<<<<<< + * new_osymbols_ptr = new_osymbols._table + * fst.Relabel(self._mfst.get(), + */ + __pyx_t_2 = (((PyObject *)__pyx_v_new_osymbols) != Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":2331 + * cdef fst.SymbolTable *new_osymbols_ptr = NULL + * if new_osymbols is not None: + * new_osymbols_ptr = new_osymbols._table # <<<<<<<<<<<<<< + * fst.Relabel(self._mfst.get(), + * self._fst.get().InputSymbols() if old_isymbols is None else + */ + if (unlikely(((PyObject *)__pyx_v_new_osymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 2331, __pyx_L1_error) + } + __pyx_t_7 = __pyx_v_new_osymbols->_table; + __pyx_v_new_osymbols_ptr = __pyx_t_7; + + /* "pywrapfst.pyx":2330 + * new_isymbols_ptr = new_isymbols._table + * cdef fst.SymbolTable *new_osymbols_ptr = NULL + * if new_osymbols is not None: # <<<<<<<<<<<<<< + * new_osymbols_ptr = new_osymbols._table + * fst.Relabel(self._mfst.get(), + */ + } + + /* "pywrapfst.pyx":2332 + * if new_osymbols is not None: + * new_osymbols_ptr = new_osymbols._table + * fst.Relabel(self._mfst.get(), # <<<<<<<<<<<<<< + * self._fst.get().InputSymbols() if old_isymbols is None else + * old_isymbols._table, new_isymbols_ptr, tostring(unknown_isymbol), + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2332, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2333 + * new_osymbols_ptr = new_osymbols._table + * fst.Relabel(self._mfst.get(), + * self._fst.get().InputSymbols() if old_isymbols is None else # <<<<<<<<<<<<<< + * old_isymbols._table, new_isymbols_ptr, tostring(unknown_isymbol), + * attach_new_isymbols, + */ + __pyx_t_1 = (((PyObject *)__pyx_v_old_isymbols) == Py_None); + if ((__pyx_t_1 != 0)) { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 2333, __pyx_L1_error) + } + __pyx_t_8 = __pyx_v_self->__pyx_base._fst.get()->InputSymbols(); + } else { + + /* "pywrapfst.pyx":2334 + * fst.Relabel(self._mfst.get(), + * self._fst.get().InputSymbols() if old_isymbols is None else + * old_isymbols._table, new_isymbols_ptr, tostring(unknown_isymbol), # <<<<<<<<<<<<<< + * attach_new_isymbols, + * self._fst.get().OutputSymbols() if old_osymbols is None else + */ + if (unlikely(((PyObject *)__pyx_v_old_isymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 2334, __pyx_L1_error) + } + __pyx_t_8 = __pyx_v_old_isymbols->_table; + } + __pyx_t_9 = __pyx_f_9pywrapfst_tostring(__pyx_v_unknown_isymbol); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2334, __pyx_L1_error) + + /* "pywrapfst.pyx":2336 + * old_isymbols._table, new_isymbols_ptr, tostring(unknown_isymbol), + * attach_new_isymbols, + * self._fst.get().OutputSymbols() if old_osymbols is None else # <<<<<<<<<<<<<< + * old_osymbols._table, new_osymbols_ptr, tostring(unknown_osymbol), + * attach_new_osymbols) + */ + __pyx_t_1 = (((PyObject *)__pyx_v_old_osymbols) == Py_None); + if ((__pyx_t_1 != 0)) { + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 2336, __pyx_L1_error) + } + __pyx_t_10 = __pyx_v_self->__pyx_base._fst.get()->OutputSymbols(); + } else { + + /* "pywrapfst.pyx":2337 + * attach_new_isymbols, + * self._fst.get().OutputSymbols() if old_osymbols is None else + * old_osymbols._table, new_osymbols_ptr, tostring(unknown_osymbol), # <<<<<<<<<<<<<< + * attach_new_osymbols) + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_old_osymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 2337, __pyx_L1_error) + } + __pyx_t_10 = __pyx_v_old_osymbols->_table; + } + __pyx_t_11 = __pyx_f_9pywrapfst_tostring(__pyx_v_unknown_osymbol); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2337, __pyx_L1_error) + + /* "pywrapfst.pyx":2332 + * if new_osymbols is not None: + * new_osymbols_ptr = new_osymbols._table + * fst.Relabel(self._mfst.get(), # <<<<<<<<<<<<<< + * self._fst.get().InputSymbols() if old_isymbols is None else + * old_isymbols._table, new_isymbols_ptr, tostring(unknown_isymbol), + */ + fst::script::Relabel(__pyx_v_self->_mfst.get(), __pyx_t_8, __pyx_v_new_isymbols_ptr, __pyx_t_9, __pyx_v_attach_new_isymbols, __pyx_t_10, __pyx_v_new_osymbols_ptr, __pyx_t_11, __pyx_v_attach_new_osymbols); + + /* "pywrapfst.pyx":2339 + * old_osymbols._table, new_osymbols_ptr, tostring(unknown_osymbol), + * attach_new_osymbols) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def relabel_tables(self, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2339, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2339, __pyx_L1_error) + + /* "pywrapfst.pyx":2315 + * return self + * + * cdef void _relabel_tables(self, # <<<<<<<<<<<<<< + * _SymbolTable old_isymbols=None, + * _SymbolTable new_isymbols=None, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pywrapfst._MutableFst._relabel_tables", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2341 + * self._check_mutating_imethod() + * + * def relabel_tables(self, # <<<<<<<<<<<<<< + * _SymbolTable old_isymbols=None, + * _SymbolTable new_isymbols=None, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_41relabel_tables(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_40relabel_tables[] = "\n relabel_tables(self, old_isymbols=None, new_isymbols=None,\n unknown_isymbol=\"\", attach_new_isymbols=True,\n old_osymbols=None, new_osymbols=None,\n unknown_osymbol=\"\", attach_new_osymbols=True)\n\n Replaces input and/or output labels using SymbolTables.\n\n This operation destructively relabels the input and/or output labels of the\n FST using user-specified symbol tables; omitted symbols are identity-mapped.\n\n Args:\n old_isymbols: The old SymbolTable for input labels, defaulting to the\n FST's input symbol table.\n new_isymbols: A SymbolTable used to relabel the input labels\n unknown_isymbol: Input symbol to use to relabel OOVs (if empty,\n OOVs raise an exception)\n attach_new_isymbols: Should new_isymbols be made the FST's input symbol\n table?\n old_osymbols: The old SymbolTable for output labels, defaulting to the\n FST's output symbol table.\n new_osymbols: A SymbolTable used to relabel the output labels.\n unknown_osymbol: Outnput symbol to use to relabel OOVs (if empty,\n OOVs raise an exception)\n attach_new_isymbols: Should new_osymbols be made the FST's output symbol\n table?\n\n Returns:\n self.\n\n Raises:\n FstArgError: No SymbolTable specified.\n\n See also: `decode`, `encode`, `project`, `relabel_pairs`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_41relabel_tables(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_isymbols = 0; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_isymbols = 0; + PyObject *__pyx_v_unknown_isymbol = 0; + bool __pyx_v_attach_new_isymbols; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_osymbols = 0; + struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_osymbols = 0; + PyObject *__pyx_v_unknown_osymbol = 0; + bool __pyx_v_attach_new_osymbols; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("relabel_tables (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_old_isymbols,&__pyx_n_s_new_isymbols,&__pyx_n_s_unknown_isymbol,&__pyx_n_s_attach_new_isymbols,&__pyx_n_s_old_osymbols,&__pyx_n_s_new_osymbols,&__pyx_n_s_unknown_osymbol,&__pyx_n_s_attach_new_osymbols,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + + /* "pywrapfst.pyx":2342 + * + * def relabel_tables(self, + * _SymbolTable old_isymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable new_isymbols=None, + * unknown_isymbol=b"", + */ + values[0] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":2343 + * def relabel_tables(self, + * _SymbolTable old_isymbols=None, + * _SymbolTable new_isymbols=None, # <<<<<<<<<<<<<< + * unknown_isymbol=b"", + * bool attach_new_isymbols=True, + */ + values[1] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + values[2] = ((PyObject *)__pyx_kp_b__10); + + /* "pywrapfst.pyx":2346 + * unknown_isymbol=b"", + * bool attach_new_isymbols=True, + * _SymbolTable old_osymbols=None, # <<<<<<<<<<<<<< + * _SymbolTable new_osymbols=None, + * unknown_osymbol=b"", + */ + values[4] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + + /* "pywrapfst.pyx":2347 + * bool attach_new_isymbols=True, + * _SymbolTable old_osymbols=None, + * _SymbolTable new_osymbols=None, # <<<<<<<<<<<<<< + * unknown_osymbol=b"", + * bool attach_new_osymbols=True): + */ + values[5] = (PyObject *)((struct __pyx_obj_9pywrapfst__SymbolTable *)Py_None); + values[6] = ((PyObject *)__pyx_kp_b__10); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_old_isymbols); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new_isymbols); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unknown_isymbol); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attach_new_isymbols); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_old_osymbols); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new_osymbols); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unknown_osymbol); + if (value) { values[6] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attach_new_osymbols); + if (value) { values[7] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "relabel_tables") < 0)) __PYX_ERR(0, 2341, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_old_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[0]); + __pyx_v_new_isymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[1]); + __pyx_v_unknown_isymbol = values[2]; + if (values[3]) { + __pyx_v_attach_new_isymbols = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_attach_new_isymbols == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2345, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":2345 + * _SymbolTable new_isymbols=None, + * unknown_isymbol=b"", + * bool attach_new_isymbols=True, # <<<<<<<<<<<<<< + * _SymbolTable old_osymbols=None, + * _SymbolTable new_osymbols=None, + */ + __pyx_v_attach_new_isymbols = ((bool)1); + } + __pyx_v_old_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[4]); + __pyx_v_new_osymbols = ((struct __pyx_obj_9pywrapfst__SymbolTable *)values[5]); + __pyx_v_unknown_osymbol = values[6]; + if (values[7]) { + __pyx_v_attach_new_osymbols = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_attach_new_osymbols == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2349, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":2349 + * _SymbolTable new_osymbols=None, + * unknown_osymbol=b"", + * bool attach_new_osymbols=True): # <<<<<<<<<<<<<< + * """ + * relabel_tables(self, old_isymbols=None, new_isymbols=None, + */ + __pyx_v_attach_new_osymbols = ((bool)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("relabel_tables", 0, 0, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2341, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.relabel_tables", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_isymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "old_isymbols", 0))) __PYX_ERR(0, 2342, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new_isymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "new_isymbols", 0))) __PYX_ERR(0, 2343, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_osymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "old_osymbols", 0))) __PYX_ERR(0, 2346, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new_osymbols), __pyx_ptype_9pywrapfst__SymbolTable, 1, "new_osymbols", 0))) __PYX_ERR(0, 2347, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_40relabel_tables(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_old_isymbols, __pyx_v_new_isymbols, __pyx_v_unknown_isymbol, __pyx_v_attach_new_isymbols, __pyx_v_old_osymbols, __pyx_v_new_osymbols, __pyx_v_unknown_osymbol, __pyx_v_attach_new_osymbols); + + /* "pywrapfst.pyx":2341 + * self._check_mutating_imethod() + * + * def relabel_tables(self, # <<<<<<<<<<<<<< + * _SymbolTable old_isymbols=None, + * _SymbolTable new_isymbols=None, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_40relabel_tables(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_isymbols, PyObject *__pyx_v_unknown_isymbol, bool __pyx_v_attach_new_isymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_old_osymbols, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_new_osymbols, PyObject *__pyx_v_unknown_osymbol, bool __pyx_v_attach_new_osymbols) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_tables __pyx_t_1; + __Pyx_RefNannySetupContext("relabel_tables", 0); + + /* "pywrapfst.pyx":2385 + * See also: `decode`, `encode`, `project`, `relabel_pairs`. + * """ + * self._relabel_tables(old_isymbols, new_isymbols, # <<<<<<<<<<<<<< + * unknown_isymbol, attach_new_isymbols, + * old_osymbols, new_osymbols, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_relabel_tables"); + __PYX_ERR(0, 2385, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2388 + * unknown_isymbol, attach_new_isymbols, + * old_osymbols, new_osymbols, + * unknown_osymbol, attach_new_osymbols) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1.__pyx_n = 8; + __pyx_t_1.old_isymbols = __pyx_v_old_isymbols; + __pyx_t_1.new_isymbols = __pyx_v_new_isymbols; + __pyx_t_1.unknown_isymbol = __pyx_v_unknown_isymbol; + __pyx_t_1.attach_new_isymbols = __pyx_v_attach_new_isymbols; + __pyx_t_1.old_osymbols = __pyx_v_old_osymbols; + __pyx_t_1.new_osymbols = __pyx_v_new_osymbols; + __pyx_t_1.unknown_osymbol = __pyx_v_unknown_osymbol; + __pyx_t_1.attach_new_osymbols = __pyx_v_attach_new_osymbols; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_relabel_tables(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2385, __pyx_L1_error) + + /* "pywrapfst.pyx":2389 + * old_osymbols, new_osymbols, + * unknown_osymbol, attach_new_osymbols) + * return self # <<<<<<<<<<<<<< + * + * cdef void _reserve_arcs(self, int64 state, size_t n) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2341 + * self._check_mutating_imethod() + * + * def relabel_tables(self, # <<<<<<<<<<<<<< + * _SymbolTable old_isymbols=None, + * _SymbolTable new_isymbols=None, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.relabel_tables", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2391 + * return self + * + * cdef void _reserve_arcs(self, int64 state, size_t n) except *: # <<<<<<<<<<<<<< + * if not self._mfst.get().ReserveArcs(state, n): + * raise FstIndexError("State index out of range") + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__reserve_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, size_t __pyx_v_n) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_reserve_arcs", 0); + + /* "pywrapfst.pyx":2392 + * + * cdef void _reserve_arcs(self, int64 state, size_t n) except *: + * if not self._mfst.get().ReserveArcs(state, n): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2392, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_self->_mfst.get()->ReserveArcs(__pyx_v_state, __pyx_v_n) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2393 + * cdef void _reserve_arcs(self, int64 state, size_t n) except *: + * if not self._mfst.get().ReserveArcs(state, n): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2393, __pyx_L1_error) + + /* "pywrapfst.pyx":2392 + * + * cdef void _reserve_arcs(self, int64 state, size_t n) except *: + * if not self._mfst.get().ReserveArcs(state, n): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() + */ + } + + /* "pywrapfst.pyx":2394 + * if not self._mfst.get().ReserveArcs(state, n): + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def reserve_arcs(self, int64 state, size_t n): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2394, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2394, __pyx_L1_error) + + /* "pywrapfst.pyx":2391 + * return self + * + * cdef void _reserve_arcs(self, int64 state, size_t n) except *: # <<<<<<<<<<<<<< + * if not self._mfst.get().ReserveArcs(state, n): + * raise FstIndexError("State index out of range") + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableFst._reserve_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2396 + * self._check_mutating_imethod() + * + * def reserve_arcs(self, int64 state, size_t n): # <<<<<<<<<<<<<< + * """ + * reserve_arcs(self, state, n) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_43reserve_arcs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_42reserve_arcs[] = "\n reserve_arcs(self, state, n)\n\n Reserve n arcs at a particular state (best effort).\n\n Args:\n state: The integer index of a state.\n n: The number of arcs to reserve.\n\n Returns:\n self.\n\n Raises:\n FstIndexError: State index out of range.\n\n See also: `reserve_states`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_43reserve_arcs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_int64 __pyx_v_state; + size_t __pyx_v_n; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reserve_arcs (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_n,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("reserve_arcs", 1, 2, 2, 1); __PYX_ERR(0, 2396, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reserve_arcs") < 0)) __PYX_ERR(0, 2396, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_state = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2396, __pyx_L3_error) + __pyx_v_n = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_n == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2396, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("reserve_arcs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2396, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.reserve_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_42reserve_arcs(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_state, __pyx_v_n); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_42reserve_arcs(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, size_t __pyx_v_n) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reserve_arcs", 0); + + /* "pywrapfst.pyx":2414 + * See also: `reserve_states`. + * """ + * self._reserve_arcs(state, n) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reserve_arcs"); + __PYX_ERR(0, 2414, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_reserve_arcs(__pyx_v_self, __pyx_v_state, __pyx_v_n); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2414, __pyx_L1_error) + + /* "pywrapfst.pyx":2415 + * """ + * self._reserve_arcs(state, n) + * return self # <<<<<<<<<<<<<< + * + * cdef void _reserve_states(self, int64 n) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2396 + * self._check_mutating_imethod() + * + * def reserve_arcs(self, int64 state, size_t n): # <<<<<<<<<<<<<< + * """ + * reserve_arcs(self, state, n) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.reserve_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2417 + * return self + * + * cdef void _reserve_states(self, int64 n) except *: # <<<<<<<<<<<<<< + * self._mfst.get().ReserveStates(n) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__reserve_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_n) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_reserve_states", 0); + + /* "pywrapfst.pyx":2418 + * + * cdef void _reserve_states(self, int64 n) except *: + * self._mfst.get().ReserveStates(n) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2418, __pyx_L1_error) + } + __pyx_v_self->_mfst.get()->ReserveStates(__pyx_v_n); + + /* "pywrapfst.pyx":2419 + * cdef void _reserve_states(self, int64 n) except *: + * self._mfst.get().ReserveStates(n) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def reserve_states(self, int64 n): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2419, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2419, __pyx_L1_error) + + /* "pywrapfst.pyx":2417 + * return self + * + * cdef void _reserve_states(self, int64 n) except *: # <<<<<<<<<<<<<< + * self._mfst.get().ReserveStates(n) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._reserve_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2421 + * self._check_mutating_imethod() + * + * def reserve_states(self, int64 n): # <<<<<<<<<<<<<< + * """ + * reserve_states(self, n) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_45reserve_states(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_44reserve_states[] = "\n reserve_states(self, n)\n\n Reserve n states (best effort).\n\n Args:\n n: The number of states to reserve.\n\n Returns:\n self.\n\n See also: `reserve_arcs`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_45reserve_states(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) { + __pyx_t_10basictypes_int64 __pyx_v_n; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reserve_states (wrapper)", 0); + assert(__pyx_arg_n); { + __pyx_v_n = __Pyx_PyInt_As_int64_t(__pyx_arg_n); if (unlikely((__pyx_v_n == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2421, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.reserve_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_44reserve_states(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_n)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_44reserve_states(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_n) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reserve_states", 0); + + /* "pywrapfst.pyx":2435 + * See also: `reserve_arcs`. + * """ + * self._reserve_states(n) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reserve_states"); + __PYX_ERR(0, 2435, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_reserve_states(__pyx_v_self, __pyx_v_n); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2435, __pyx_L1_error) + + /* "pywrapfst.pyx":2436 + * """ + * self._reserve_states(n) + * return self # <<<<<<<<<<<<<< + * + * cdef void _reweight(self, potentials, bool to_final=False) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2421 + * self._check_mutating_imethod() + * + * def reserve_states(self, int64 n): # <<<<<<<<<<<<<< + * """ + * reserve_states(self, n) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.reserve_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2438 + * return self + * + * cdef void _reweight(self, potentials, bool to_final=False) except *: # <<<<<<<<<<<<<< + * cdef unique_ptr[vector[fst.WeightClass]] _potentials + * _potentials.reset(new vector[fst.WeightClass]()) + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__reweight(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_potentials, struct __pyx_opt_args_9pywrapfst_11_MutableFst__reweight *__pyx_optional_args) { + bool __pyx_v_to_final = ((bool)0); + std::unique_ptr > __pyx_v__potentials; + CYTHON_UNUSED std::string __pyx_v_weight_type; + PyObject *__pyx_v_weight = NULL; + __Pyx_RefNannyDeclarations + std::vector *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + fst::script::WeightClass __pyx_t_6; + __Pyx_RefNannySetupContext("_reweight", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_to_final = __pyx_optional_args->to_final; + } + } + + /* "pywrapfst.pyx":2440 + * cdef void _reweight(self, potentials, bool to_final=False) except *: + * cdef unique_ptr[vector[fst.WeightClass]] _potentials + * _potentials.reset(new vector[fst.WeightClass]()) # <<<<<<<<<<<<<< + * cdef string weight_type = self.weight_type() + * for weight in potentials: + */ + try { + __pyx_t_1 = new std::vector (); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2440, __pyx_L1_error) + } + __pyx_v__potentials.reset(__pyx_t_1); + + /* "pywrapfst.pyx":2441 + * cdef unique_ptr[vector[fst.WeightClass]] _potentials + * _potentials.reset(new vector[fst.WeightClass]()) + * cdef string weight_type = self.weight_type() # <<<<<<<<<<<<<< + * for weight in potentials: + * _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 2441, __pyx_L1_error) + } + __pyx_v_weight_type = ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.weight_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), 0); + + /* "pywrapfst.pyx":2442 + * _potentials.reset(new vector[fst.WeightClass]()) + * cdef string weight_type = self.weight_type() + * for weight in potentials: # <<<<<<<<<<<<<< + * _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), + * weight)) + */ + if (likely(PyList_CheckExact(__pyx_v_potentials)) || PyTuple_CheckExact(__pyx_v_potentials)) { + __pyx_t_2 = __pyx_v_potentials; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_potentials); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2442, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2442, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2442, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 2442, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_v_weight, __pyx_t_5); + __pyx_t_5 = 0; + + /* "pywrapfst.pyx":2443 + * cdef string weight_type = self.weight_type() + * for weight in potentials: + * _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), # <<<<<<<<<<<<<< + * weight)) + * fst.Reweight(self._mfst.get(), deref(_potentials), + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 2443, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2444 + * for weight in potentials: + * _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), + * weight)) # <<<<<<<<<<<<<< + * fst.Reweight(self._mfst.get(), deref(_potentials), + * fst.GetReweightType(to_final)) + */ + __pyx_t_6 = __pyx_f_9pywrapfst__get_WeightClass_or_One(((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.weight_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2443, __pyx_L1_error) + + /* "pywrapfst.pyx":2443 + * cdef string weight_type = self.weight_type() + * for weight in potentials: + * _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), # <<<<<<<<<<<<<< + * weight)) + * fst.Reweight(self._mfst.get(), deref(_potentials), + */ + try { + __pyx_v__potentials.get()->push_back(__pyx_t_6); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 2443, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2442 + * _potentials.reset(new vector[fst.WeightClass]()) + * cdef string weight_type = self.weight_type() + * for weight in potentials: # <<<<<<<<<<<<<< + * _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), + * weight)) + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":2445 + * _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), + * weight)) + * fst.Reweight(self._mfst.get(), deref(_potentials), # <<<<<<<<<<<<<< + * fst.GetReweightType(to_final)) + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2445, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2446 + * weight)) + * fst.Reweight(self._mfst.get(), deref(_potentials), + * fst.GetReweightType(to_final)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + fst::script::Reweight(__pyx_v_self->_mfst.get(), (*__pyx_v__potentials), fst::script::GetReweightType(__pyx_v_to_final)); + + /* "pywrapfst.pyx":2447 + * fst.Reweight(self._mfst.get(), deref(_potentials), + * fst.GetReweightType(to_final)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def reweight(self, potentials, bool to_final=False): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2447, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2447, __pyx_L1_error) + + /* "pywrapfst.pyx":2438 + * return self + * + * cdef void _reweight(self, potentials, bool to_final=False) except *: # <<<<<<<<<<<<<< + * cdef unique_ptr[vector[fst.WeightClass]] _potentials + * _potentials.reset(new vector[fst.WeightClass]()) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._MutableFst._reweight", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_weight); + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2449 + * self._check_mutating_imethod() + * + * def reweight(self, potentials, bool to_final=False): # <<<<<<<<<<<<<< + * """ + * reweight(self, potentials, to_final=False) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_47reweight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_46reweight[] = "\n reweight(self, potentials, to_final=False)\n\n Reweights an FST using an iterable of potentials.\n\n This operation destructively reweights an FST according to the potentials\n and in the direction specified by the user. An arc of weight w, with an\n origin state of potential p and destination state of potential q, is\n reweighted by p^{-1} \\otimes (w \\otimes q) when reweighting towards the\n initial state, and by (p \\otimes w) \\otimes q^{-1} when reweighting towards\n the final states. The weights must be left distributive when reweighting\n towards the initial state and right distributive when reweighting towards\n the final states (e.g., TropicalWeight and LogWeight).\n\n Args:\n potentials: An iterable of Weight or weight strings.\n to_final: Push towards final states?\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_47reweight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_potentials = 0; + bool __pyx_v_to_final; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reweight (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_potentials,&__pyx_n_s_to_final,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_potentials)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_to_final); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reweight") < 0)) __PYX_ERR(0, 2449, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_potentials = values[0]; + if (values[1]) { + __pyx_v_to_final = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_to_final == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2449, __pyx_L3_error) + } else { + __pyx_v_to_final = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("reweight", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2449, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.reweight", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_46reweight(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_potentials, __pyx_v_to_final); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_46reweight(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_potentials, bool __pyx_v_to_final) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__reweight __pyx_t_1; + __Pyx_RefNannySetupContext("reweight", 0); + + /* "pywrapfst.pyx":2471 + * self. + * """ + * self._reweight(potentials, to_final) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reweight"); + __PYX_ERR(0, 2471, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.to_final = __pyx_v_to_final; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_reweight(__pyx_v_self, __pyx_v_potentials, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2471, __pyx_L1_error) + + /* "pywrapfst.pyx":2472 + * """ + * self._reweight(potentials, to_final) + * return self # <<<<<<<<<<<<<< + * + * cdef void _rmepsilon(self, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2449 + * self._check_mutating_imethod() + * + * def reweight(self, potentials, bool to_final=False): # <<<<<<<<<<<<<< + * """ + * reweight(self, potentials, to_final=False) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.reweight", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2474 + * return self + * + * cdef void _rmepsilon(self, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool connect=True, + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__rmepsilon(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_opt_args_9pywrapfst_11_MutableFst__rmepsilon *__pyx_optional_args) { + PyObject *__pyx_v_queue_type = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":2476 + * cdef void _rmepsilon(self, + * queue_type=b"auto", + * bool connect=True, # <<<<<<<<<<<<<< + * weight=None, + * int64 nstate=fst.kNoStateId, + */ + bool __pyx_v_connect = ((bool)1); + + /* "pywrapfst.pyx":2477 + * queue_type=b"auto", + * bool connect=True, + * weight=None, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * float delta=fst.kShortestDelta) except *: + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + __pyx_t_10basictypes_int64 __pyx_v_nstate = __pyx_k__19; + float __pyx_v_delta = __pyx_k__20; + fst::script::WeightClass __pyx_v_wc; + std::unique_ptr __pyx_v_opts; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + std::string __pyx_t_2; + enum fst::QueueType __pyx_t_3; + __Pyx_RefNannySetupContext("_rmepsilon", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_queue_type = __pyx_optional_args->queue_type; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_connect = __pyx_optional_args->connect; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_weight = __pyx_optional_args->weight; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_nstate = __pyx_optional_args->nstate; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_delta = __pyx_optional_args->delta; + } + } + } + } + } + } + + /* "pywrapfst.pyx":2480 + * int64 nstate=fst.kNoStateId, + * float delta=fst.kShortestDelta) except *: + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), # <<<<<<<<<<<<<< + * weight) + * cdef unique_ptr[fst.RmEpsilonOptions] opts + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 2480, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2481 + * float delta=fst.kShortestDelta) except *: + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + * weight) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.RmEpsilonOptions] opts + * opts.reset(new fst.RmEpsilonOptions(_get_queue_type(tostring(queue_type)), + */ + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_Zero(((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.weight_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L1_error) + __pyx_v_wc = __pyx_t_1; + + /* "pywrapfst.pyx":2483 + * weight) + * cdef unique_ptr[fst.RmEpsilonOptions] opts + * opts.reset(new fst.RmEpsilonOptions(_get_queue_type(tostring(queue_type)), # <<<<<<<<<<<<<< + * connect, wc, nstate, delta)) + * fst.RmEpsilon(self._mfst.get(), deref(opts)) + */ + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_v_queue_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2483, __pyx_L1_error) + __pyx_t_3 = __pyx_f_9pywrapfst__get_queue_type(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2483, __pyx_L1_error) + + /* "pywrapfst.pyx":2484 + * cdef unique_ptr[fst.RmEpsilonOptions] opts + * opts.reset(new fst.RmEpsilonOptions(_get_queue_type(tostring(queue_type)), + * connect, wc, nstate, delta)) # <<<<<<<<<<<<<< + * fst.RmEpsilon(self._mfst.get(), deref(opts)) + * self._check_mutating_imethod() + */ + __pyx_v_opts.reset(new fst::script::RmEpsilonOptions(__pyx_t_3, __pyx_v_connect, __pyx_v_wc, __pyx_v_nstate, __pyx_v_delta)); + + /* "pywrapfst.pyx":2485 + * opts.reset(new fst.RmEpsilonOptions(_get_queue_type(tostring(queue_type)), + * connect, wc, nstate, delta)) + * fst.RmEpsilon(self._mfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2485, __pyx_L1_error) + } + fst::script::RmEpsilon(__pyx_v_self->_mfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":2486 + * connect, wc, nstate, delta)) + * fst.RmEpsilon(self._mfst.get(), deref(opts)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def rmepsilon(self, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2486, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2486, __pyx_L1_error) + + /* "pywrapfst.pyx":2474 + * return self + * + * cdef void _rmepsilon(self, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool connect=True, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._rmepsilon", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2488 + * self._check_mutating_imethod() + * + * def rmepsilon(self, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool connect=True, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_49rmepsilon(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_48rmepsilon[] = "\n rmepsilon(self, queue_type=\"auto\", connect=True, weight=None,\n nstate=NO_STATE_ID, delta=1e-6):\n\n Removes epsilon transitions.\n\n This operation destructively removes epsilon transitions, i.e., those where\n both input and output labels are epsilon) from an FST.\n\n Args:\n queue_type: A string matching a known queue type; one of: \"auto\", \"fifo\",\n \"lifo\", \"shortest\", \"state\", \"top\".\n connect: Should output be trimmed?\n weight: A Weight or weight string indicating the desired weight threshold\n below which paths are pruned; if omitted, no paths are pruned.\n nstate: State number threshold.\n delta: Comparison/quantization delta.\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_49rmepsilon(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_queue_type = 0; + bool __pyx_v_connect; + PyObject *__pyx_v_weight = 0; + __pyx_t_10basictypes_int64 __pyx_v_nstate; + float __pyx_v_delta; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rmepsilon (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_queue_type,&__pyx_n_s_connect,&__pyx_n_s_weight,&__pyx_n_s_nstate,&__pyx_n_s_delta,0}; + PyObject* values[5] = {0,0,0,0,0}; + values[0] = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":2491 + * queue_type=b"auto", + * bool connect=True, + * weight=None, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * float delta=fst.kShortestDelta): + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_type); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connect); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nstate); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rmepsilon") < 0)) __PYX_ERR(0, 2488, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_queue_type = values[0]; + if (values[1]) { + __pyx_v_connect = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_connect == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2490, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":2490 + * def rmepsilon(self, + * queue_type=b"auto", + * bool connect=True, # <<<<<<<<<<<<<< + * weight=None, + * int64 nstate=fst.kNoStateId, + */ + __pyx_v_connect = ((bool)1); + } + __pyx_v_weight = values[2]; + if (values[3]) { + __pyx_v_nstate = __Pyx_PyInt_As_int64_t(values[3]); if (unlikely((__pyx_v_nstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2492, __pyx_L3_error) + } else { + __pyx_v_nstate = __pyx_k__21; + } + if (values[4]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 2493, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__22; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rmepsilon", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2488, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.rmepsilon", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_48rmepsilon(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_queue_type, __pyx_v_connect, __pyx_v_weight, __pyx_v_nstate, __pyx_v_delta); + + /* "pywrapfst.pyx":2488 + * self._check_mutating_imethod() + * + * def rmepsilon(self, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool connect=True, + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_48rmepsilon(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, PyObject *__pyx_v_queue_type, bool __pyx_v_connect, PyObject *__pyx_v_weight, __pyx_t_10basictypes_int64 __pyx_v_nstate, float __pyx_v_delta) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__rmepsilon __pyx_t_1; + __Pyx_RefNannySetupContext("rmepsilon", 0); + + /* "pywrapfst.pyx":2515 + * self. + * """ + * self._rmepsilon(queue_type, connect, weight, nstate, delta) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_rmepsilon"); + __PYX_ERR(0, 2515, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 5; + __pyx_t_1.queue_type = __pyx_v_queue_type; + __pyx_t_1.connect = __pyx_v_connect; + __pyx_t_1.weight = __pyx_v_weight; + __pyx_t_1.nstate = __pyx_v_nstate; + __pyx_t_1.delta = __pyx_v_delta; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_rmepsilon(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2515, __pyx_L1_error) + + /* "pywrapfst.pyx":2516 + * """ + * self._rmepsilon(queue_type, connect, weight, nstate, delta) + * return self # <<<<<<<<<<<<<< + * + * cdef void _set_final(self, int64 state, weight=None) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2488 + * self._check_mutating_imethod() + * + * def rmepsilon(self, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool connect=True, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.rmepsilon", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2518 + * return self + * + * cdef void _set_final(self, int64 state, weight=None) except *: # <<<<<<<<<<<<<< + * if not self._mfst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__set_final(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, struct __pyx_opt_args_9pywrapfst_11_MutableFst__set_final *__pyx_optional_args) { + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + fst::script::WeightClass __pyx_v_wc; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + fst::script::WeightClass __pyx_t_5; + __Pyx_RefNannySetupContext("_set_final", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_weight = __pyx_optional_args->weight; + } + } + + /* "pywrapfst.pyx":2519 + * + * cdef void _set_final(self, int64 state, weight=None) except *: + * if not self._mfst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2519, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_self->_mfst.get()->ValidStateId(__pyx_v_state) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2520 + * cdef void _set_final(self, int64 state, weight=None) except *: + * if not self._mfst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), + * weight) + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2520, __pyx_L1_error) + + /* "pywrapfst.pyx":2519 + * + * cdef void _set_final(self, int64 state, weight=None) except *: + * if not self._mfst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), + */ + } + + /* "pywrapfst.pyx":2521 + * if not self._mfst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + * cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), # <<<<<<<<<<<<<< + * weight) + * if not self._mfst.get().SetFinal(state, wc): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 2521, __pyx_L1_error) + } + + /* "pywrapfst.pyx":2522 + * raise FstIndexError("State index out of range") + * cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), + * weight) # <<<<<<<<<<<<<< + * if not self._mfst.get().SetFinal(state, wc): + * raise FstOpError("Incompatible or invalid weight") + */ + __pyx_t_5 = __pyx_f_9pywrapfst__get_WeightClass_or_One(((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.weight_type(((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_self), 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2521, __pyx_L1_error) + __pyx_v_wc = __pyx_t_5; + + /* "pywrapfst.pyx":2523 + * cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), + * weight) + * if not self._mfst.get().SetFinal(state, wc): # <<<<<<<<<<<<<< + * raise FstOpError("Incompatible or invalid weight") + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2523, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_self->_mfst.get()->SetFinal(__pyx_v_state, __pyx_v_wc) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2524 + * weight) + * if not self._mfst.get().SetFinal(state, wc): + * raise FstOpError("Incompatible or invalid weight") # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_Incompatible_or_invalid_weight) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Incompatible_or_invalid_weight); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2524, __pyx_L1_error) + + /* "pywrapfst.pyx":2523 + * cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), + * weight) + * if not self._mfst.get().SetFinal(state, wc): # <<<<<<<<<<<<<< + * raise FstOpError("Incompatible or invalid weight") + * self._check_mutating_imethod() + */ + } + + /* "pywrapfst.pyx":2525 + * if not self._mfst.get().SetFinal(state, wc): + * raise FstOpError("Incompatible or invalid weight") + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def set_final(self, int64 state, weight=None): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2525, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2525, __pyx_L1_error) + + /* "pywrapfst.pyx":2518 + * return self + * + * cdef void _set_final(self, int64 state, weight=None) except *: # <<<<<<<<<<<<<< + * if not self._mfst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableFst._set_final", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2527 + * self._check_mutating_imethod() + * + * def set_final(self, int64 state, weight=None): # <<<<<<<<<<<<<< + * """ + * set_final(self, state, weight) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_51set_final(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_50set_final[] = "\n set_final(self, state, weight)\n\n Sets the final weight for a state.\n\n Args:\n state: The integer index of a state.\n weight: A Weight or weight string indicating the desired final weight; if\n omitted, it is set to semiring One.\n\n Returns:\n self.\n\n Raises:\n FstIndexError: State index out of range.\n FstOpError: Incompatible or invalid weight.\n\n See also: `set_start`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_51set_final(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_v_weight = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_final (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_weight,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_final") < 0)) __PYX_ERR(0, 2527, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_state = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2527, __pyx_L3_error) + __pyx_v_weight = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_final", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2527, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_final", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_50set_final(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_state, __pyx_v_weight); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_50set_final(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state, PyObject *__pyx_v_weight) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_9pywrapfst_11_MutableFst__set_final __pyx_t_1; + __Pyx_RefNannySetupContext("set_final", 0); + + /* "pywrapfst.pyx":2547 + * See also: `set_start`. + * """ + * self._set_final(state, weight) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_set_final"); + __PYX_ERR(0, 2547, __pyx_L1_error) + } + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.weight = __pyx_v_weight; + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_final(__pyx_v_self, __pyx_v_state, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2547, __pyx_L1_error) + + /* "pywrapfst.pyx":2548 + * """ + * self._set_final(state, weight) + * return self # <<<<<<<<<<<<<< + * + * cdef void _set_input_symbols(self, _SymbolTable syms) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2527 + * self._check_mutating_imethod() + * + * def set_final(self, int64 state, weight=None): # <<<<<<<<<<<<<< + * """ + * set_final(self, state, weight) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_final", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2550 + * return self + * + * cdef void _set_input_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * if syms is None: + * self._mfst.get().SetInputSymbols(NULL) + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__set_input_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("_set_input_symbols", 0); + + /* "pywrapfst.pyx":2551 + * + * cdef void _set_input_symbols(self, _SymbolTable syms) except *: + * if syms is None: # <<<<<<<<<<<<<< + * self._mfst.get().SetInputSymbols(NULL) + * return + */ + __pyx_t_1 = (((PyObject *)__pyx_v_syms) == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":2552 + * cdef void _set_input_symbols(self, _SymbolTable syms) except *: + * if syms is None: + * self._mfst.get().SetInputSymbols(NULL) # <<<<<<<<<<<<<< + * return + * self._mfst.get().SetInputSymbols(syms._table) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2552, __pyx_L1_error) + } + __pyx_v_self->_mfst.get()->SetInputSymbols(NULL); + + /* "pywrapfst.pyx":2553 + * if syms is None: + * self._mfst.get().SetInputSymbols(NULL) + * return # <<<<<<<<<<<<<< + * self._mfst.get().SetInputSymbols(syms._table) + * self._check_mutating_imethod() + */ + goto __pyx_L0; + + /* "pywrapfst.pyx":2551 + * + * cdef void _set_input_symbols(self, _SymbolTable syms) except *: + * if syms is None: # <<<<<<<<<<<<<< + * self._mfst.get().SetInputSymbols(NULL) + * return + */ + } + + /* "pywrapfst.pyx":2554 + * self._mfst.get().SetInputSymbols(NULL) + * return + * self._mfst.get().SetInputSymbols(syms._table) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2554, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_syms) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 2554, __pyx_L1_error) + } + __pyx_v_self->_mfst.get()->SetInputSymbols(__pyx_v_syms->_table); + + /* "pywrapfst.pyx":2555 + * return + * self._mfst.get().SetInputSymbols(syms._table) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def set_input_symbols(self, _SymbolTable syms): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2555, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2555, __pyx_L1_error) + + /* "pywrapfst.pyx":2550 + * return self + * + * cdef void _set_input_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * if syms is None: + * self._mfst.get().SetInputSymbols(NULL) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._set_input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2557 + * self._check_mutating_imethod() + * + * def set_input_symbols(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * set_input_symbols(self, syms) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_53set_input_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_52set_input_symbols[] = "\n set_input_symbols(self, syms)\n\n Sets the input symbol table.\n\n Passing None as a value will delete the input symbol table.\n\n Args:\n syms: A SymbolTable.\n\n Returns:\n self.\n\n See also: `set_output_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_53set_input_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_input_symbols (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_syms), __pyx_ptype_9pywrapfst__SymbolTable, 1, "syms", 0))) __PYX_ERR(0, 2557, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_52set_input_symbols(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_syms)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_52set_input_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_input_symbols", 0); + + /* "pywrapfst.pyx":2573 + * See also: `set_output_symbols`. + * """ + * self._set_input_symbols(syms) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_set_input_symbols"); + __PYX_ERR(0, 2573, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_input_symbols(__pyx_v_self, __pyx_v_syms); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2573, __pyx_L1_error) + + /* "pywrapfst.pyx":2574 + * """ + * self._set_input_symbols(syms) + * return self # <<<<<<<<<<<<<< + * + * cdef void _set_output_symbols(self, _SymbolTable syms) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2557 + * self._check_mutating_imethod() + * + * def set_input_symbols(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * set_input_symbols(self, syms) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_input_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2576 + * return self + * + * cdef void _set_output_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * if syms is None: + * self._mfst.get().SetOutputSymbols(NULL) + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__set_output_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("_set_output_symbols", 0); + + /* "pywrapfst.pyx":2577 + * + * cdef void _set_output_symbols(self, _SymbolTable syms) except *: + * if syms is None: # <<<<<<<<<<<<<< + * self._mfst.get().SetOutputSymbols(NULL) + * return + */ + __pyx_t_1 = (((PyObject *)__pyx_v_syms) == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":2578 + * cdef void _set_output_symbols(self, _SymbolTable syms) except *: + * if syms is None: + * self._mfst.get().SetOutputSymbols(NULL) # <<<<<<<<<<<<<< + * return + * self._mfst.get().SetOutputSymbols(syms._table) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2578, __pyx_L1_error) + } + __pyx_v_self->_mfst.get()->SetOutputSymbols(NULL); + + /* "pywrapfst.pyx":2579 + * if syms is None: + * self._mfst.get().SetOutputSymbols(NULL) + * return # <<<<<<<<<<<<<< + * self._mfst.get().SetOutputSymbols(syms._table) + * self._check_mutating_imethod() + */ + goto __pyx_L0; + + /* "pywrapfst.pyx":2577 + * + * cdef void _set_output_symbols(self, _SymbolTable syms) except *: + * if syms is None: # <<<<<<<<<<<<<< + * self._mfst.get().SetOutputSymbols(NULL) + * return + */ + } + + /* "pywrapfst.pyx":2580 + * self._mfst.get().SetOutputSymbols(NULL) + * return + * self._mfst.get().SetOutputSymbols(syms._table) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2580, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_syms) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 2580, __pyx_L1_error) + } + __pyx_v_self->_mfst.get()->SetOutputSymbols(__pyx_v_syms->_table); + + /* "pywrapfst.pyx":2581 + * return + * self._mfst.get().SetOutputSymbols(syms._table) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def set_output_symbols(self, _SymbolTable syms): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2581, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2581, __pyx_L1_error) + + /* "pywrapfst.pyx":2576 + * return self + * + * cdef void _set_output_symbols(self, _SymbolTable syms) except *: # <<<<<<<<<<<<<< + * if syms is None: + * self._mfst.get().SetOutputSymbols(NULL) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._set_output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2583 + * self._check_mutating_imethod() + * + * def set_output_symbols(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * set_output_symbols(self, syms) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_55set_output_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_54set_output_symbols[] = "\n set_output_symbols(self, syms)\n\n Sets the output symbol table.\n\n Passing None as a value will delete the output symbol table.\n\n Args:\n syms: A SymbolTable.\n\n Returns:\n self.\n\n See also: `set_input_symbols`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_55set_output_symbols(PyObject *__pyx_v_self, PyObject *__pyx_v_syms) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_output_symbols (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_syms), __pyx_ptype_9pywrapfst__SymbolTable, 1, "syms", 0))) __PYX_ERR(0, 2583, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_54set_output_symbols(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst__SymbolTable *)__pyx_v_syms)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_54set_output_symbols(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__SymbolTable *__pyx_v_syms) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_output_symbols", 0); + + /* "pywrapfst.pyx":2599 + * See also: `set_input_symbols`. + * """ + * self._set_output_symbols(syms) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_set_output_symbols"); + __PYX_ERR(0, 2599, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_output_symbols(__pyx_v_self, __pyx_v_syms); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2599, __pyx_L1_error) + + /* "pywrapfst.pyx":2600 + * """ + * self._set_output_symbols(syms) + * return self # <<<<<<<<<<<<<< + * + * cdef void _set_properties(self, uint64 props, uint64 mask): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2583 + * self._check_mutating_imethod() + * + * def set_output_symbols(self, _SymbolTable syms): # <<<<<<<<<<<<<< + * """ + * set_output_symbols(self, syms) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_output_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2602 + * return self + * + * cdef void _set_properties(self, uint64 props, uint64 mask): # <<<<<<<<<<<<<< + * self._mfst.get().SetProperties(props, mask) + * + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__set_properties(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_props, __pyx_t_10basictypes_uint64 __pyx_v_mask) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_set_properties", 0); + + /* "pywrapfst.pyx":2603 + * + * cdef void _set_properties(self, uint64 props, uint64 mask): + * self._mfst.get().SetProperties(props, mask) # <<<<<<<<<<<<<< + * + * def set_properties(self, uint64 props, uint64 mask): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2603, __pyx_L1_error) + } + __pyx_v_self->_mfst.get()->SetProperties(__pyx_v_props, __pyx_v_mask); + + /* "pywrapfst.pyx":2602 + * return self + * + * cdef void _set_properties(self, uint64 props, uint64 mask): # <<<<<<<<<<<<<< + * self._mfst.get().SetProperties(props, mask) + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("pywrapfst._MutableFst._set_properties", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2605 + * self._mfst.get().SetProperties(props, mask) + * + * def set_properties(self, uint64 props, uint64 mask): # <<<<<<<<<<<<<< + * """ + * set_properties(self, props, mask) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_57set_properties(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_56set_properties[] = "\n set_properties(self, props, mask)\n\n Sets the properties bits.\n\n Args:\n props: The properties to be set.\n mask: A mask to be applied to the `props` argument before setting the\n FST's properties.\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_57set_properties(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_uint64 __pyx_v_props; + __pyx_t_10basictypes_uint64 __pyx_v_mask; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_properties (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_props,&__pyx_n_s_mask,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_props)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_properties", 1, 2, 2, 1); __PYX_ERR(0, 2605, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_properties") < 0)) __PYX_ERR(0, 2605, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_props = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_props == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2605, __pyx_L3_error) + __pyx_v_mask = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_mask == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2605, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_properties", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2605, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_properties", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_56set_properties(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), __pyx_v_props, __pyx_v_mask); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_56set_properties(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_uint64 __pyx_v_props, __pyx_t_10basictypes_uint64 __pyx_v_mask) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_properties", 0); + + /* "pywrapfst.pyx":2619 + * self. + * """ + * self._set_properties(props, mask) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_set_properties"); + __PYX_ERR(0, 2619, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_properties(__pyx_v_self, __pyx_v_props, __pyx_v_mask); + + /* "pywrapfst.pyx":2620 + * """ + * self._set_properties(props, mask) + * return self # <<<<<<<<<<<<<< + * + * cdef void _set_start(self, int64 state) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2605 + * self._mfst.get().SetProperties(props, mask) + * + * def set_properties(self, uint64 props, uint64 mask): # <<<<<<<<<<<<<< + * """ + * set_properties(self, props, mask) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_properties", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2622 + * return self + * + * cdef void _set_start(self, int64 state) except *: # <<<<<<<<<<<<<< + * if not self._mfst.get().SetStart(state): + * raise FstIndexError("State index out of range") + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__set_start(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_set_start", 0); + + /* "pywrapfst.pyx":2623 + * + * cdef void _set_start(self, int64 state) except *: + * if not self._mfst.get().SetStart(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2623, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_self->_mfst.get()->SetStart(__pyx_v_state) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2624 + * cdef void _set_start(self, int64 state) except *: + * if not self._mfst.get().SetStart(state): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2624, __pyx_L1_error) + + /* "pywrapfst.pyx":2623 + * + * cdef void _set_start(self, int64 state) except *: + * if not self._mfst.get().SetStart(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() + */ + } + + /* "pywrapfst.pyx":2625 + * if not self._mfst.get().SetStart(state): + * raise FstIndexError("State index out of range") + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def set_start(self, int64 state): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2625, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2625, __pyx_L1_error) + + /* "pywrapfst.pyx":2622 + * return self + * + * cdef void _set_start(self, int64 state) except *: # <<<<<<<<<<<<<< + * if not self._mfst.get().SetStart(state): + * raise FstIndexError("State index out of range") + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableFst._set_start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2627 + * self._check_mutating_imethod() + * + * def set_start(self, int64 state): # <<<<<<<<<<<<<< + * """ + * set_start(self, state) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_59set_start(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_58set_start[] = "\n set_start(self, state)\n\n Sets a state to be the initial state state.\n\n Args:\n state: The integer index of a state.\n\n Returns:\n self.\n\n Raises:\n FstIndexError: State index out of range.\n\n See also: `set_final`.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_59set_start(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) { + __pyx_t_10basictypes_int64 __pyx_v_state; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_start (wrapper)", 0); + assert(__pyx_arg_state); { + __pyx_v_state = __Pyx_PyInt_As_int64_t(__pyx_arg_state); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2627, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_58set_start(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_58set_start(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_start", 0); + + /* "pywrapfst.pyx":2644 + * See also: `set_final`. + * """ + * self._set_start(state) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_set_start"); + __PYX_ERR(0, 2644, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_start(__pyx_v_self, __pyx_v_state); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2644, __pyx_L1_error) + + /* "pywrapfst.pyx":2645 + * """ + * self._set_start(state) + * return self # <<<<<<<<<<<<<< + * + * cdef void _topsort(self) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2627 + * self._check_mutating_imethod() + * + * def set_start(self, int64 state): # <<<<<<<<<<<<<< + * """ + * set_start(self, state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.set_start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2647 + * return self + * + * cdef void _topsort(self) except *: # <<<<<<<<<<<<<< + * # TopSort returns False if the FST is cyclic, and thus can't be TopSorted. + * if not fst.TopSort(self._mfst.get()): + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__topsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_topsort", 0); + + /* "pywrapfst.pyx":2649 + * cdef void _topsort(self) except *: + * # TopSort returns False if the FST is cyclic, and thus can't be TopSorted. + * if not fst.TopSort(self._mfst.get()): # <<<<<<<<<<<<<< + * logging.warning("Cannot topsort cyclic FST") + * self._check_mutating_imethod() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2649, __pyx_L1_error) + } + __pyx_t_1 = ((!(fst::script::TopSort(__pyx_v_self->_mfst.get()) != 0)) != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":2650 + * # TopSort returns False if the FST is cyclic, and thus can't be TopSorted. + * if not fst.TopSort(self._mfst.get()): + * logging.warning("Cannot topsort cyclic FST") # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_u_Cannot_topsort_cyclic_FST) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Cannot_topsort_cyclic_FST); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":2649 + * cdef void _topsort(self) except *: + * # TopSort returns False if the FST is cyclic, and thus can't be TopSorted. + * if not fst.TopSort(self._mfst.get()): # <<<<<<<<<<<<<< + * logging.warning("Cannot topsort cyclic FST") + * self._check_mutating_imethod() + */ + } + + /* "pywrapfst.pyx":2651 + * if not fst.TopSort(self._mfst.get()): + * logging.warning("Cannot topsort cyclic FST") + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def topsort(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2651, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2651, __pyx_L1_error) + + /* "pywrapfst.pyx":2647 + * return self + * + * cdef void _topsort(self) except *: # <<<<<<<<<<<<<< + * # TopSort returns False if the FST is cyclic, and thus can't be TopSorted. + * if not fst.TopSort(self._mfst.get()): + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._MutableFst._topsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2653 + * self._check_mutating_imethod() + * + * def topsort(self): # <<<<<<<<<<<<<< + * """ + * topsort(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_61topsort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_60topsort[] = "\n topsort(self)\n\n Sorts transitions by state IDs.\n\n This operation destructively topologically sorts the FST, if it is acyclic;\n otherwise it remains unchanged. Once sorted, all transitions are from lower\n state IDs to higher state IDs\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_61topsort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("topsort (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_60topsort(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_60topsort(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("topsort", 0); + + /* "pywrapfst.pyx":2666 + * self. + * """ + * self._topsort() # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_topsort"); + __PYX_ERR(0, 2666, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_topsort(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2666, __pyx_L1_error) + + /* "pywrapfst.pyx":2667 + * """ + * self._topsort() + * return self # <<<<<<<<<<<<<< + * + * cdef void _union(self, _Fst ifst) except *: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2653 + * self._check_mutating_imethod() + * + * def topsort(self): # <<<<<<<<<<<<<< + * """ + * topsort(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.topsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2669 + * return self + * + * cdef void _union(self, _Fst ifst) except *: # <<<<<<<<<<<<<< + * fst.Union(self._mfst.get(), deref(ifst._fst)) + * self._check_mutating_imethod() + */ + +static void __pyx_f_9pywrapfst_11_MutableFst__union(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_union", 0); + + /* "pywrapfst.pyx":2670 + * + * cdef void _union(self, _Fst ifst) except *: + * fst.Union(self._mfst.get(), deref(ifst._fst)) # <<<<<<<<<<<<<< + * self._check_mutating_imethod() + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2670, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 2670, __pyx_L1_error) + } + fst::script::Union(__pyx_v_self->_mfst.get(), (*__pyx_v_ifst->_fst)); + + /* "pywrapfst.pyx":2671 + * cdef void _union(self, _Fst ifst) except *: + * fst.Union(self._mfst.get(), deref(ifst._fst)) + * self._check_mutating_imethod() # <<<<<<<<<<<<<< + * + * def union(self, _Fst ifst): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod"); + __PYX_ERR(0, 2671, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_check_mutating_imethod(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2671, __pyx_L1_error) + + /* "pywrapfst.pyx":2669 + * return self + * + * cdef void _union(self, _Fst ifst) except *: # <<<<<<<<<<<<<< + * fst.Union(self._mfst.get(), deref(ifst._fst)) + * self._check_mutating_imethod() + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst._union", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":2673 + * self._check_mutating_imethod() + * + * def union(self, _Fst ifst): # <<<<<<<<<<<<<< + * """ + * union(self, ifst) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_63union(PyObject *__pyx_v_self, PyObject *__pyx_v_ifst); /*proto*/ +static char __pyx_doc_9pywrapfst_11_MutableFst_62union[] = "\n union(self, ifst)\n\n Computes the union (sum) of two FSTs.\n\n This operation computes the union (sum) of two FSTs. If A transduces string\n x to y with weight a and B transduces string w to v with weight b, then\n their union transduces x to y with weight a and w to v with weight b.\n\n Args:\n ifst: The second input FST.\n\n Returns:\n self.\n "; +static PyObject *__pyx_pw_9pywrapfst_11_MutableFst_63union(PyObject *__pyx_v_self, PyObject *__pyx_v_ifst) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("union (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 2673, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11_MutableFst_62union(((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_ifst)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11_MutableFst_62union(struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("union", 0); + + /* "pywrapfst.pyx":2689 + * self. + * """ + * self._union(ifst) # <<<<<<<<<<<<<< + * return self + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_union"); + __PYX_ERR(0, 2689, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst__MutableFst *)__pyx_v_self->__pyx_base.__pyx_vtab)->_union(__pyx_v_self, __pyx_v_ifst); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2689, __pyx_L1_error) + + /* "pywrapfst.pyx":2690 + * """ + * self._union(ifst) + * return self # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":2673 + * self._check_mutating_imethod() + * + * def union(self, _Fst ifst): # <<<<<<<<<<<<<< + * """ + * union(self, ifst) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._MutableFst.union", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2715 + * + * + * cdef _Fst _init_Fst(FstClass_ptr tfst): # <<<<<<<<<<<<<< + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") + */ + +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__init_Fst(__pyx_t_9pywrapfst_FstClass_ptr __pyx_v_tfst) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ofst = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_init_Fst", 0); + + /* "pywrapfst.pyx":2716 + * + * cdef _Fst _init_Fst(FstClass_ptr tfst): + * if tfst.Properties(fst.kError, True) == fst.kError: # <<<<<<<<<<<<<< + * raise FstOpError("Operation failed") + * cdef _Fst ofst = _Fst.__new__(_Fst) + */ + __pyx_t_1 = ((__pyx_v_tfst->Properties(fst::kError, 1) == fst::kError) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2717 + * cdef _Fst _init_Fst(FstClass_ptr tfst): + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") # <<<<<<<<<<<<<< + * cdef _Fst ofst = _Fst.__new__(_Fst) + * ofst._fst.reset(tfst) + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_Operation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Operation_failed); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2717, __pyx_L1_error) + + /* "pywrapfst.pyx":2716 + * + * cdef _Fst _init_Fst(FstClass_ptr tfst): + * if tfst.Properties(fst.kError, True) == fst.kError: # <<<<<<<<<<<<<< + * raise FstOpError("Operation failed") + * cdef _Fst ofst = _Fst.__new__(_Fst) + */ + } + + /* "pywrapfst.pyx":2718 + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") + * cdef _Fst ofst = _Fst.__new__(_Fst) # <<<<<<<<<<<<<< + * ofst._fst.reset(tfst) + * return ofst + */ + __pyx_t_2 = ((PyObject *)__pyx_tp_new_9pywrapfst__Fst(((PyTypeObject *)__pyx_ptype_9pywrapfst__Fst), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2718, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_v_ofst = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "pywrapfst.pyx":2719 + * raise FstOpError("Operation failed") + * cdef _Fst ofst = _Fst.__new__(_Fst) + * ofst._fst.reset(tfst) # <<<<<<<<<<<<<< + * return ofst + * + */ + if (unlikely(((PyObject *)__pyx_v_ofst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 2719, __pyx_L1_error) + } + __pyx_v_ofst->_fst.reset(__pyx_v_tfst); + + /* "pywrapfst.pyx":2720 + * cdef _Fst ofst = _Fst.__new__(_Fst) + * ofst._fst.reset(tfst) + * return ofst # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_ofst)); + __pyx_r = __pyx_v_ofst; + goto __pyx_L0; + + /* "pywrapfst.pyx":2715 + * + * + * cdef _Fst _init_Fst(FstClass_ptr tfst): # <<<<<<<<<<<<<< + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._init_Fst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ofst); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2723 + * + * + * cdef _MutableFst _init_MutableFst(MutableFstClass_ptr tfst): # <<<<<<<<<<<<<< + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") + */ + +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst__init_MutableFst(__pyx_t_9pywrapfst_MutableFstClass_ptr __pyx_v_tfst) { + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_ofst = 0; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_init_MutableFst", 0); + + /* "pywrapfst.pyx":2724 + * + * cdef _MutableFst _init_MutableFst(MutableFstClass_ptr tfst): + * if tfst.Properties(fst.kError, True) == fst.kError: # <<<<<<<<<<<<<< + * raise FstOpError("Operation failed") + * cdef _MutableFst ofst = _MutableFst.__new__(_MutableFst) + */ + __pyx_t_1 = ((__pyx_v_tfst->Properties(fst::kError, 1) == fst::kError) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":2725 + * cdef _MutableFst _init_MutableFst(MutableFstClass_ptr tfst): + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") # <<<<<<<<<<<<<< + * cdef _MutableFst ofst = _MutableFst.__new__(_MutableFst) + * ofst._fst.reset(tfst) + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_Operation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Operation_failed); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2725, __pyx_L1_error) + + /* "pywrapfst.pyx":2724 + * + * cdef _MutableFst _init_MutableFst(MutableFstClass_ptr tfst): + * if tfst.Properties(fst.kError, True) == fst.kError: # <<<<<<<<<<<<<< + * raise FstOpError("Operation failed") + * cdef _MutableFst ofst = _MutableFst.__new__(_MutableFst) + */ + } + + /* "pywrapfst.pyx":2726 + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") + * cdef _MutableFst ofst = _MutableFst.__new__(_MutableFst) # <<<<<<<<<<<<<< + * ofst._fst.reset(tfst) + * # Makes a copy of it as the derived type! Cool. + */ + __pyx_t_2 = ((PyObject *)__pyx_tp_new_9pywrapfst__MutableFst(((PyTypeObject *)__pyx_ptype_9pywrapfst__MutableFst), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2726, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_v_ofst = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "pywrapfst.pyx":2727 + * raise FstOpError("Operation failed") + * cdef _MutableFst ofst = _MutableFst.__new__(_MutableFst) + * ofst._fst.reset(tfst) # <<<<<<<<<<<<<< + * # Makes a copy of it as the derived type! Cool. + * ofst._mfst = static_pointer_cast[fst.MutableFstClass, fst.FstClass](ofst._fst) + */ + if (unlikely(((PyObject *)__pyx_v_ofst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 2727, __pyx_L1_error) + } + __pyx_v_ofst->__pyx_base._fst.reset(__pyx_v_tfst); + + /* "pywrapfst.pyx":2729 + * ofst._fst.reset(tfst) + * # Makes a copy of it as the derived type! Cool. + * ofst._mfst = static_pointer_cast[fst.MutableFstClass, fst.FstClass](ofst._fst) # <<<<<<<<<<<<<< + * return ofst + * + */ + if (unlikely(((PyObject *)__pyx_v_ofst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 2729, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ofst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 2729, __pyx_L1_error) + } + __pyx_v_ofst->_mfst = std::static_pointer_cast(__pyx_v_ofst->__pyx_base._fst); + + /* "pywrapfst.pyx":2730 + * # Makes a copy of it as the derived type! Cool. + * ofst._mfst = static_pointer_cast[fst.MutableFstClass, fst.FstClass](ofst._fst) + * return ofst # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_ofst)); + __pyx_r = __pyx_v_ofst; + goto __pyx_L0; + + /* "pywrapfst.pyx":2723 + * + * + * cdef _MutableFst _init_MutableFst(MutableFstClass_ptr tfst): # <<<<<<<<<<<<<< + * if tfst.Properties(fst.kError, True) == fst.kError: + * raise FstOpError("Operation failed") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._init_MutableFst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ofst); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2733 + * + * + * cdef _Fst _init_XFst(FstClass_ptr tfst): # <<<<<<<<<<<<<< + * if tfst.Properties(fst.kMutable, True) == fst.kMutable: + * return _init_MutableFst(static_cast[MutableFstClass_ptr](tfst)) + */ + +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__init_XFst(__pyx_t_9pywrapfst_FstClass_ptr __pyx_v_tfst) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("_init_XFst", 0); + + /* "pywrapfst.pyx":2734 + * + * cdef _Fst _init_XFst(FstClass_ptr tfst): + * if tfst.Properties(fst.kMutable, True) == fst.kMutable: # <<<<<<<<<<<<<< + * return _init_MutableFst(static_cast[MutableFstClass_ptr](tfst)) + * else: + */ + __pyx_t_1 = ((__pyx_v_tfst->Properties(fst::kMutable, 1) == fst::kMutable) != 0); + if (__pyx_t_1) { + + /* "pywrapfst.pyx":2735 + * cdef _Fst _init_XFst(FstClass_ptr tfst): + * if tfst.Properties(fst.kMutable, True) == fst.kMutable: + * return _init_MutableFst(static_cast[MutableFstClass_ptr](tfst)) # <<<<<<<<<<<<<< + * else: + * return _init_Fst(tfst) + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(static_cast<__pyx_t_9pywrapfst_MutableFstClass_ptr>(__pyx_v_tfst))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2734 + * + * cdef _Fst _init_XFst(FstClass_ptr tfst): + * if tfst.Properties(fst.kMutable, True) == fst.kMutable: # <<<<<<<<<<<<<< + * return _init_MutableFst(static_cast[MutableFstClass_ptr](tfst)) + * else: + */ + } + + /* "pywrapfst.pyx":2737 + * return _init_MutableFst(static_cast[MutableFstClass_ptr](tfst)) + * else: + * return _init_Fst(tfst) # <<<<<<<<<<<<<< + * + * + */ + /*else*/ { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = ((PyObject *)__pyx_f_9pywrapfst__init_Fst(__pyx_v_tfst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2737, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "pywrapfst.pyx":2733 + * + * + * cdef _Fst _init_XFst(FstClass_ptr tfst): # <<<<<<<<<<<<<< + * if tfst.Properties(fst.kMutable, True) == fst.kMutable: + * return _init_MutableFst(static_cast[MutableFstClass_ptr](tfst)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst._init_XFst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2740 + * + * + * cdef _MutableFst _create_Fst(arc_type=b"standard"): # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(tostring(arc_type))) + */ + +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst__create_Fst(struct __pyx_opt_args_9pywrapfst__create_Fst *__pyx_optional_args) { + PyObject *__pyx_v_arc_type = ((PyObject *)__pyx_n_b_standard); + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_create_Fst", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_arc_type = __pyx_optional_args->arc_type; + } + } + + /* "pywrapfst.pyx":2742 + * cdef _MutableFst _create_Fst(arc_type=b"standard"): + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(tostring(arc_type))) # <<<<<<<<<<<<<< + * if tfst.get() == NULL: + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_arc_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2742, __pyx_L1_error) + __pyx_v_tfst.reset(new fst::script::VectorFstClass(__pyx_t_1)); + + /* "pywrapfst.pyx":2743 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(tostring(arc_type))) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + * return _init_MutableFst(tfst.release()) + */ + __pyx_t_2 = ((__pyx_v_tfst.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":2744 + * tfst.reset(new fst.VectorFstClass(tostring(arc_type))) + * if tfst.get() == NULL: + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_arc_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_arc_type) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_arc_type); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2744, __pyx_L1_error) + + /* "pywrapfst.pyx":2743 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(tostring(arc_type))) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + * return _init_MutableFst(tfst.release()) + */ + } + + /* "pywrapfst.pyx":2745 + * if tfst.get() == NULL: + * raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2740 + * + * + * cdef _MutableFst _create_Fst(arc_type=b"standard"): # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(tostring(arc_type))) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._create_Fst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2748 + * + * + * cpdef _Fst _read(filename): # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.Read(tostring(filename))) + */ + +static PyObject *__pyx_pw_9pywrapfst_15_read(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__read(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch) { + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("_read", 0); + + /* "pywrapfst.pyx":2750 + * cpdef _Fst _read(filename): + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.Read(tostring(filename))) # <<<<<<<<<<<<<< + * if tfst.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2750, __pyx_L1_error) + __pyx_v_tfst.reset(fst::script::FstClass::Read(__pyx_t_1)); + + /* "pywrapfst.pyx":2751 + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.Read(tostring(filename))) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_XFst(tfst.release()) + */ + __pyx_t_2 = ((__pyx_v_tfst.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":2752 + * tfst.reset(fst.FstClass.Read(tostring(filename))) + * if tfst.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * return _init_XFst(tfst.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Read_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2752, __pyx_L1_error) + + /* "pywrapfst.pyx":2751 + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.Read(tostring(filename))) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_XFst(tfst.release()) + */ + } + + /* "pywrapfst.pyx":2753 + * if tfst.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filename)) + * return _init_XFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_XFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2748 + * + * + * cpdef _Fst _read(filename): # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.Read(tostring(filename))) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_15_read(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_15_read(PyObject *__pyx_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_read (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_14_read(__pyx_self, ((PyObject *)__pyx_v_filename)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_14_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_read", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__read(__pyx_v_filename, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2756 + * + * + * cpdef _Fst _read_Fst_from_string(state): # <<<<<<<<<<<<<< + * cdef stringstream sstrm + * sstrm << tostring(state) + */ + +static PyObject *__pyx_pw_9pywrapfst_17_read_Fst_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__read_Fst_from_string(PyObject *__pyx_v_state, CYTHON_UNUSED int __pyx_skip_dispatch) { + std::stringstream __pyx_v_sstrm; + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("_read_Fst_from_string", 0); + + /* "pywrapfst.pyx":2758 + * cpdef _Fst _read_Fst_from_string(state): + * cdef stringstream sstrm + * sstrm << tostring(state) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.ReadStream(sstrm, b"")) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_state); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2758, __pyx_L1_error) + (void)((__pyx_v_sstrm << __pyx_t_1)); + + /* "pywrapfst.pyx":2760 + * sstrm << tostring(state) + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.ReadStream(sstrm, b"")) # <<<<<<<<<<<<<< + * if tfst.get() == NULL: + * raise FstIOError("Read failed") + */ + __pyx_v_tfst.reset(fst::script::FstClass::Read(__pyx_v_sstrm, __pyx_k_pywrapfst)); + + /* "pywrapfst.pyx":2761 + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.ReadStream(sstrm, b"")) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed") + * return _init_XFst(tfst.release()) + */ + __pyx_t_2 = ((__pyx_v_tfst.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":2762 + * tfst.reset(fst.FstClass.ReadStream(sstrm, b"")) + * if tfst.get() == NULL: + * raise FstIOError("Read failed") # <<<<<<<<<<<<<< + * return _init_XFst(tfst.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_Read_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Read_failed); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2762, __pyx_L1_error) + + /* "pywrapfst.pyx":2761 + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.FstClass.ReadStream(sstrm, b"")) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed") + * return _init_XFst(tfst.release()) + */ + } + + /* "pywrapfst.pyx":2763 + * if tfst.get() == NULL: + * raise FstIOError("Read failed") + * return _init_XFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_XFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2756 + * + * + * cpdef _Fst _read_Fst_from_string(state): # <<<<<<<<<<<<<< + * cdef stringstream sstrm + * sstrm << tostring(state) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst._read_Fst_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_17_read_Fst_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_17_read_Fst_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_read_Fst_from_string (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_16_read_Fst_from_string(__pyx_self, ((PyObject *)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_16_read_Fst_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_read_Fst_from_string", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__read_Fst_from_string(__pyx_v_state, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst._read_Fst_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2783 + * """ + * + * def __new__(cls, arc_type=b"standard"): # <<<<<<<<<<<<<< + * return _create_Fst(arc_type) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Fst_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9pywrapfst_3Fst_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_3Fst_1__new__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9pywrapfst_3Fst_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_cls = 0; + PyObject *__pyx_v_arc_type = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__new__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_arc_type,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)((PyObject*)__pyx_n_b_standard)); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arc_type); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2783, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_cls = values[0]; + __pyx_v_arc_type = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__new__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2783, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.Fst.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_3Fst___new__(__pyx_self, __pyx_v_cls, __pyx_v_arc_type); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Fst___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, PyObject *__pyx_v_arc_type) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst__create_Fst __pyx_t_2; + __Pyx_RefNannySetupContext("__new__", 0); + + /* "pywrapfst.pyx":2784 + * + * def __new__(cls, arc_type=b"standard"): + * return _create_Fst(arc_type) # <<<<<<<<<<<<<< + * + * @staticmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.arc_type = __pyx_v_arc_type; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__create_Fst(&__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2783 + * """ + * + * def __new__(cls, arc_type=b"standard"): # <<<<<<<<<<<<<< + * return _create_Fst(arc_type) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Fst.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2787 + * + * @staticmethod + * def read(filename): # <<<<<<<<<<<<<< + * """ + * read(filename): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Fst_3read(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/ +static char __pyx_doc_9pywrapfst_3Fst_2read[] = "\n read(filename):\n\n Reads an FST from a file.\n\n Args:\n filename: The string location of the input file.\n\n Returns:\n An FST object.\n\n Raises:\n FstIOError: Read failed.\n "; +static PyMethodDef __pyx_mdef_9pywrapfst_3Fst_3read = {"read", (PyCFunction)__pyx_pw_9pywrapfst_3Fst_3read, METH_O, __pyx_doc_9pywrapfst_3Fst_2read}; +static PyObject *__pyx_pw_9pywrapfst_3Fst_3read(PyObject *__pyx_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Fst_2read(__pyx_self, ((PyObject *)__pyx_v_filename)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Fst_2read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("read", 0); + + /* "pywrapfst.pyx":2802 + * FstIOError: Read failed. + * """ + * return _read(filename) # <<<<<<<<<<<<<< + * + * @staticmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__read(__pyx_v_filename, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2787 + * + * @staticmethod + * def read(filename): # <<<<<<<<<<<<<< + * """ + * read(filename): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Fst.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2805 + * + * @staticmethod + * def read_from_string(state): # <<<<<<<<<<<<<< + * """ + * read_from_string(string, fst_type=None) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Fst_5read_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ +static char __pyx_doc_9pywrapfst_3Fst_4read_from_string[] = "\n read_from_string(string, fst_type=None)\n\n Reads an FST from a serialized string.\n\n Args:\n state: A string containing the serialized FST.\n\n Returns:\n An FST object.\n\n Raises:\n FstIOError: Read failed.\n FstOpError: Read-time conversion failed.\n\n See also: `write_to_string`.\n "; +static PyMethodDef __pyx_mdef_9pywrapfst_3Fst_5read_from_string = {"read_from_string", (PyCFunction)__pyx_pw_9pywrapfst_3Fst_5read_from_string, METH_O, __pyx_doc_9pywrapfst_3Fst_4read_from_string}; +static PyObject *__pyx_pw_9pywrapfst_3Fst_5read_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_from_string (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Fst_4read_from_string(__pyx_self, ((PyObject *)__pyx_v_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Fst_4read_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("read_from_string", 0); + + /* "pywrapfst.pyx":2823 + * See also: `write_to_string`. + * """ + * return _read_Fst_from_string(state) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__read_Fst_from_string(__pyx_v_state, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2805 + * + * @staticmethod + * def read_from_string(state): # <<<<<<<<<<<<<< + * """ + * read_from_string(string, fst_type=None) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Fst.read_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2936 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc___repr__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc___repr__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":2937 + * + * def __repr__(self): + * return "".format(id(self)) # <<<<<<<<<<<<<< + * + * def __init__(self, int64 ilabel, int64 olabel, weight, int64 nextstate): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Arc_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2937, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2937, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2937, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2936 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.Arc.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2939 + * return "".format(id(self)) + * + * def __init__(self, int64 ilabel, int64 olabel, weight, int64 nextstate): # <<<<<<<<<<<<<< + * cdef fst.WeightClass wc = _get_WeightClass_or_One(b"tropical", weight) + * self._arc.reset(new fst.ArcClass(ilabel, olabel, wc, nextstate)) + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_3Arc_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_3Arc_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_int64 __pyx_v_ilabel; + __pyx_t_10basictypes_int64 __pyx_v_olabel; + PyObject *__pyx_v_weight = 0; + __pyx_t_10basictypes_int64 __pyx_v_nextstate; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ilabel,&__pyx_n_s_olabel,&__pyx_n_s_weight,&__pyx_n_s_nextstate,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ilabel)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_olabel)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 2939, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 2939, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nextstate)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 2939, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2939, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_ilabel = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_ilabel == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2939, __pyx_L3_error) + __pyx_v_olabel = __Pyx_PyInt_As_int64_t(values[1]); if (unlikely((__pyx_v_olabel == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2939, __pyx_L3_error) + __pyx_v_weight = values[2]; + __pyx_v_nextstate = __Pyx_PyInt_As_int64_t(values[3]); if (unlikely((__pyx_v_nextstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2939, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2939, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.Arc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_3Arc_2__init__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self), __pyx_v_ilabel, __pyx_v_olabel, __pyx_v_weight, __pyx_v_nextstate); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_3Arc_2__init__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_ilabel, __pyx_t_10basictypes_int64 __pyx_v_olabel, PyObject *__pyx_v_weight, __pyx_t_10basictypes_int64 __pyx_v_nextstate) { + fst::script::WeightClass __pyx_v_wc; + int __pyx_r; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":2940 + * + * def __init__(self, int64 ilabel, int64 olabel, weight, int64 nextstate): + * cdef fst.WeightClass wc = _get_WeightClass_or_One(b"tropical", weight) # <<<<<<<<<<<<<< + * self._arc.reset(new fst.ArcClass(ilabel, olabel, wc, nextstate)) + * + */ + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_One(__pyx_k_tropical, __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2940, __pyx_L1_error) + __pyx_v_wc = __pyx_t_1; + + /* "pywrapfst.pyx":2941 + * def __init__(self, int64 ilabel, int64 olabel, weight, int64 nextstate): + * cdef fst.WeightClass wc = _get_WeightClass_or_One(b"tropical", weight) + * self._arc.reset(new fst.ArcClass(ilabel, olabel, wc, nextstate)) # <<<<<<<<<<<<<< + * + * cpdef Arc copy(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2941, __pyx_L1_error) + } + __pyx_v_self->_arc.reset(new fst::script::ArcClass(__pyx_v_ilabel, __pyx_v_olabel, __pyx_v_wc, __pyx_v_nextstate)); + + /* "pywrapfst.pyx":2939 + * return "".format(id(self)) + * + * def __init__(self, int64 ilabel, int64 olabel, weight, int64 nextstate): # <<<<<<<<<<<<<< + * cdef fst.WeightClass wc = _get_WeightClass_or_One(b"tropical", weight) + * self._arc.reset(new fst.ArcClass(ilabel, olabel, wc, nextstate)) + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.Arc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2943 + * self._arc.reset(new fst.ArcClass(ilabel, olabel, wc, nextstate)) + * + * cpdef Arc copy(self): # <<<<<<<<<<<<<< + * return Arc(self.ilabel, self.olabel, self.weight, self.nextstate) + * + */ + +static PyObject *__pyx_pw_9pywrapfst_3Arc_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst_Arc *__pyx_f_9pywrapfst_3Arc_copy(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst_Arc *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2943, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_3Arc_5copy)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2943, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst_Arc))))) __PYX_ERR(0, 2943, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst_Arc *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":2944 + * + * cpdef Arc copy(self): + * return Arc(self.ilabel, self.olabel, self.weight, self.nextstate) # <<<<<<<<<<<<<< + * + * property ilabel: + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ilabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_olabel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_weight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nextstate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9pywrapfst_Arc), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = ((struct __pyx_obj_9pywrapfst_Arc *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2943 + * self._arc.reset(new fst.ArcClass(ilabel, olabel, wc, nextstate)) + * + * cpdef Arc copy(self): # <<<<<<<<<<<<<< + * return Arc(self.ilabel, self.olabel, self.weight, self.nextstate) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pywrapfst.Arc.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_4copy(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc_4copy(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_3Arc_copy(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2943, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Arc.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2948 + * property ilabel: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return deref(self._arc).ilabel + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_6ilabel_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_6ilabel_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_6ilabel___get__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc_6ilabel___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "pywrapfst.pyx":2949 + * + * def __get__(self): + * return deref(self._arc).ilabel # <<<<<<<<<<<<<< + * + * def __set__(self, int64 value): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2949, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_int64_t((*__pyx_v_self->_arc).ilabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2949, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2948 + * property ilabel: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return deref(self._arc).ilabel + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Arc.ilabel.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2951 + * return deref(self._arc).ilabel + * + * def __set__(self, int64 value): # <<<<<<<<<<<<<< + * deref(self._arc).ilabel = value + * + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_3Arc_6ilabel_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static int __pyx_pw_9pywrapfst_3Arc_6ilabel_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + __pyx_t_10basictypes_int64 __pyx_v_value; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyInt_As_int64_t(__pyx_arg_value); if (unlikely((__pyx_v_value == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2951, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.Arc.ilabel.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_3Arc_6ilabel_2__set__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_3Arc_6ilabel_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + + /* "pywrapfst.pyx":2952 + * + * def __set__(self, int64 value): + * deref(self._arc).ilabel = value # <<<<<<<<<<<<<< + * + * property olabel: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2952, __pyx_L1_error) + } + (*__pyx_v_self->_arc).ilabel = __pyx_v_value; + + /* "pywrapfst.pyx":2951 + * return deref(self._arc).ilabel + * + * def __set__(self, int64 value): # <<<<<<<<<<<<<< + * deref(self._arc).ilabel = value + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.Arc.ilabel.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2956 + * property olabel: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return deref(self._arc).olabel + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_6olabel_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_6olabel_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_6olabel___get__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc_6olabel___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "pywrapfst.pyx":2957 + * + * def __get__(self): + * return deref(self._arc).olabel # <<<<<<<<<<<<<< + * + * def __set__(self, int64 value): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2957, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_int64_t((*__pyx_v_self->_arc).olabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2957, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2956 + * property olabel: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return deref(self._arc).olabel + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Arc.olabel.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2959 + * return deref(self._arc).olabel + * + * def __set__(self, int64 value): # <<<<<<<<<<<<<< + * deref(self._arc).olabel = value + * + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_3Arc_6olabel_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static int __pyx_pw_9pywrapfst_3Arc_6olabel_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + __pyx_t_10basictypes_int64 __pyx_v_value; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyInt_As_int64_t(__pyx_arg_value); if (unlikely((__pyx_v_value == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2959, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.Arc.olabel.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_3Arc_6olabel_2__set__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_3Arc_6olabel_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + + /* "pywrapfst.pyx":2960 + * + * def __set__(self, int64 value): + * deref(self._arc).olabel = value # <<<<<<<<<<<<<< + * + * property weight: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2960, __pyx_L1_error) + } + (*__pyx_v_self->_arc).olabel = __pyx_v_value; + + /* "pywrapfst.pyx":2959 + * return deref(self._arc).olabel + * + * def __set__(self, int64 value): # <<<<<<<<<<<<<< + * deref(self._arc).olabel = value + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.Arc.olabel.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2964 + * property weight: + * + * def __get__(self): # <<<<<<<<<<<<<< + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(deref(self._arc).weight)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_6weight_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_6weight_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_6weight___get__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc_6weight___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_weight = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "pywrapfst.pyx":2965 + * + * def __get__(self): + * cdef Weight weight = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * weight._weight.reset(new fst.WeightClass(deref(self._arc).weight)) + * return weight + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2965, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_weight = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2966 + * def __get__(self): + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(deref(self._arc).weight)) # <<<<<<<<<<<<<< + * return weight + * + */ + if (unlikely(((PyObject *)__pyx_v_weight) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 2966, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2966, __pyx_L1_error) + } + __pyx_v_weight->_weight.reset(new fst::script::WeightClass((*__pyx_v_self->_arc).weight)); + + /* "pywrapfst.pyx":2967 + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(deref(self._arc).weight)) + * return weight # <<<<<<<<<<<<<< + * + * def __set__(self, weight): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_weight)); + __pyx_r = ((PyObject *)__pyx_v_weight); + goto __pyx_L0; + + /* "pywrapfst.pyx":2964 + * property weight: + * + * def __get__(self): # <<<<<<<<<<<<<< + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(deref(self._arc).weight)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Arc.weight.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_weight); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2969 + * return weight + * + * def __set__(self, weight): # <<<<<<<<<<<<<< + * deref(self._arc).weight = _get_WeightClass_or_One(b"tropical", weight) + * + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_3Arc_6weight_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weight); /*proto*/ +static int __pyx_pw_9pywrapfst_3Arc_6weight_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weight) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_6weight_2__set__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self), ((PyObject *)__pyx_v_weight)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_3Arc_6weight_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, PyObject *__pyx_v_weight) { + int __pyx_r; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "pywrapfst.pyx":2970 + * + * def __set__(self, weight): + * deref(self._arc).weight = _get_WeightClass_or_One(b"tropical", weight) # <<<<<<<<<<<<<< + * + * property nextstate: + */ + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_One(__pyx_k_tropical, __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2970, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2970, __pyx_L1_error) + } + (*__pyx_v_self->_arc).weight = __pyx_t_1; + + /* "pywrapfst.pyx":2969 + * return weight + * + * def __set__(self, weight): # <<<<<<<<<<<<<< + * deref(self._arc).weight = _get_WeightClass_or_One(b"tropical", weight) + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.Arc.weight.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2974 + * property nextstate: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return deref(self._arc).nextstate + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_9nextstate_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_9nextstate_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_9nextstate___get__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc_9nextstate___get__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "pywrapfst.pyx":2975 + * + * def __get__(self): + * return deref(self._arc).nextstate # <<<<<<<<<<<<<< + * + * def __set__(self, int64 value): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2975, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_int64_t((*__pyx_v_self->_arc).nextstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2975, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2974 + * property nextstate: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return deref(self._arc).nextstate + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Arc.nextstate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2977 + * return deref(self._arc).nextstate + * + * def __set__(self, int64 value): # <<<<<<<<<<<<<< + * deref(self._arc).nextstate = value + * + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_3Arc_9nextstate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static int __pyx_pw_9pywrapfst_3Arc_9nextstate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + __pyx_t_10basictypes_int64 __pyx_v_value; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyInt_As_int64_t(__pyx_arg_value); if (unlikely((__pyx_v_value == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2977, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.Arc.nextstate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_3Arc_9nextstate_2__set__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self), ((__pyx_t_10basictypes_int64)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_3Arc_9nextstate_2__set__(struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, __pyx_t_10basictypes_int64 __pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + + /* "pywrapfst.pyx":2978 + * + * def __set__(self, int64 value): + * deref(self._arc).nextstate = value # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 2978, __pyx_L1_error) + } + (*__pyx_v_self->_arc).nextstate = __pyx_v_value; + + /* "pywrapfst.pyx":2977 + * return deref(self._arc).nextstate + * + * def __set__(self, int64 value): # <<<<<<<<<<<<<< + * deref(self._arc).nextstate = value + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.Arc.nextstate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_6__reduce_cython__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Arc.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_3Arc_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_3Arc_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_3Arc_8__setstate_cython__(((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_3Arc_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Arc *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Arc.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2981 + * + * + * cdef Arc _init_Arc(const fst.ArcClass &arc): # <<<<<<<<<<<<<< + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(arc.weight)) + */ + +static struct __pyx_obj_9pywrapfst_Arc *__pyx_f_9pywrapfst__init_Arc(fst::script::ArcClass const &__pyx_v_arc) { + struct __pyx_obj_9pywrapfst_Weight *__pyx_v_weight = 0; + struct __pyx_obj_9pywrapfst_Arc *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_init_Arc", 0); + + /* "pywrapfst.pyx":2982 + * + * cdef Arc _init_Arc(const fst.ArcClass &arc): + * cdef Weight weight = Weight.__new__(Weight) # <<<<<<<<<<<<<< + * weight._weight.reset(new fst.WeightClass(arc.weight)) + * return Arc(arc.ilabel, arc.olabel, weight, arc.nextstate) + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_Weight(((PyTypeObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2982, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_weight = ((struct __pyx_obj_9pywrapfst_Weight *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2983 + * cdef Arc _init_Arc(const fst.ArcClass &arc): + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(arc.weight)) # <<<<<<<<<<<<<< + * return Arc(arc.ilabel, arc.olabel, weight, arc.nextstate) + * + */ + if (unlikely(((PyObject *)__pyx_v_weight) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight"); + __PYX_ERR(0, 2983, __pyx_L1_error) + } + __pyx_v_weight->_weight.reset(new fst::script::WeightClass(__pyx_v_arc.weight)); + + /* "pywrapfst.pyx":2984 + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(arc.weight)) + * return Arc(arc.ilabel, arc.olabel, weight, arc.nextstate) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_arc.ilabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_arc.olabel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_arc.nextstate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weight)); + PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_weight)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9pywrapfst_Arc), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = ((struct __pyx_obj_9pywrapfst_Arc *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2981 + * + * + * cdef Arc _init_Arc(const fst.ArcClass &arc): # <<<<<<<<<<<<<< + * cdef Weight weight = Weight.__new__(Weight) + * weight._weight.reset(new fst.WeightClass(arc.weight)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst._init_Arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_weight); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2995 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator___repr__(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator___repr__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":2996 + * + * def __repr__(self): + * return "".format(id(self)) # <<<<<<<<<<<<<< + * + * def __init__(self, _Fst ifst, int64 state): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_ArcIterator_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":2995 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.ArcIterator.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":2998 + * return "".format(id(self)) + * + * def __init__(self, _Fst ifst, int64 state): # <<<<<<<<<<<<<< + * if not ifst._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_11ArcIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_11ArcIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + __pyx_t_10basictypes_int64 __pyx_v_state; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_state,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 2998, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2998, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_state = __Pyx_PyInt_As_int64_t(values[1]); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2998, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2998, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.ArcIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 2998, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_2__init__(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self), __pyx_v_ifst, __pyx_v_state); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_11ArcIterator_2__init__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, __pyx_t_10basictypes_int64 __pyx_v_state) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::shared_ptr __pyx_t_5; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":2999 + * + * def __init__(self, _Fst ifst, int64 state): + * if not ifst._fst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 2999, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_ifst->_fst.get()->ValidStateId(__pyx_v_state) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":3000 + * def __init__(self, _Fst ifst, int64 state): + * if not ifst._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._fst = ifst._fst + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 3000, __pyx_L1_error) + + /* "pywrapfst.pyx":2999 + * + * def __init__(self, _Fst ifst, int64 state): + * if not ifst._fst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + */ + } + + /* "pywrapfst.pyx":3002 + * raise FstIndexError("State index out of range") + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._fst = ifst._fst # <<<<<<<<<<<<<< + * self._aiter.reset(new fst.ArcIteratorClass(deref(self._fst), state)) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3002, __pyx_L1_error) + } + __pyx_t_5 = __pyx_v_ifst->_fst; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3002, __pyx_L1_error) + } + __pyx_v_self->_fst = __pyx_t_5; + + /* "pywrapfst.pyx":3003 + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._fst = ifst._fst + * self._aiter.reset(new fst.ArcIteratorClass(deref(self._fst), state)) # <<<<<<<<<<<<<< + * + * # This just registers this class as a possible iterator. + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3003, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3003, __pyx_L1_error) + } + __pyx_v_self->_aiter.reset(new fst::script::ArcIteratorClass((*__pyx_v_self->_fst), __pyx_v_state)); + + /* "pywrapfst.pyx":2998 + * return "".format(id(self)) + * + * def __init__(self, _Fst ifst, int64 state): # <<<<<<<<<<<<<< + * if not ifst._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.ArcIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3006 + * + * # This just registers this class as a possible iterator. + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_4__iter__(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_4__iter__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "pywrapfst.pyx":3007 + * # This just registers this class as a possible iterator. + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * # Magic method used to get a Pythonic API out of the C++ API. + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":3006 + * + * # This just registers this class as a possible iterator. + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3010 + * + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done(): + * raise StopIteration + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_7__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_7__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_6__next__(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_6__next__(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "pywrapfst.pyx":3011 + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): + * if self.done(): # <<<<<<<<<<<<<< + * raise StopIteration + * result = self.value() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "done"); + __PYX_ERR(0, 3011, __pyx_L1_error) + } + __pyx_t_1 = (((struct __pyx_vtabstruct_9pywrapfst_ArcIterator *)__pyx_v_self->__pyx_vtab)->done(__pyx_v_self, 0) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":3012 + * def __next__(self): + * if self.done(): + * raise StopIteration # <<<<<<<<<<<<<< + * result = self.value() + * self.next() + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); + __PYX_ERR(0, 3012, __pyx_L1_error) + + /* "pywrapfst.pyx":3011 + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): + * if self.done(): # <<<<<<<<<<<<<< + * raise StopIteration + * result = self.value() + */ + } + + /* "pywrapfst.pyx":3013 + * if self.done(): + * raise StopIteration + * result = self.value() # <<<<<<<<<<<<<< + * self.next() + * return result + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "value"); + __PYX_ERR(0, 3013, __pyx_L1_error) + } + __pyx_t_2 = ((struct __pyx_vtabstruct_9pywrapfst_ArcIterator *)__pyx_v_self->__pyx_vtab)->value(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "pywrapfst.pyx":3014 + * raise StopIteration + * result = self.value() + * self.next() # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "next"); + __PYX_ERR(0, 3014, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_ArcIterator *)__pyx_v_self->__pyx_vtab)->next(__pyx_v_self, 0); + + /* "pywrapfst.pyx":3015 + * result = self.value() + * self.next() + * return result # <<<<<<<<<<<<<< + * + * cpdef bool done(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "pywrapfst.pyx":3010 + * + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done(): + * raise StopIteration + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst.ArcIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3017 + * return result + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_11ArcIterator_done(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("done", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3017, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_9done)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3017, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3017, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3026 + * True if the iterator is exhausted, False otherwise. + * """ + * return self._aiter.get().Done() # <<<<<<<<<<<<<< + * + * cpdef uint32 flags(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3026, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_aiter.get()->Done(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3017 + * return result + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.ArcIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_8done[] = "\n done(self)\n\n Indicates whether the iterator is exhausted or not.\n\n Returns:\n True if the iterator is exhausted, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("done (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_8done(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_8done(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("done", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_11ArcIterator_done(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3017, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3028 + * return self._aiter.get().Done() + * + * cpdef uint32 flags(self): # <<<<<<<<<<<<<< + * """ + * flags(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_11flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_uint32 __pyx_f_9pywrapfst_11ArcIterator_flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_uint32 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_uint32 __pyx_t_5; + __Pyx_RefNannySetupContext("flags", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3028, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_11flags)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3028, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3028, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3037 + * The current iterator behavioral flags as an integer. + * """ + * return self._aiter.get().Flags() # <<<<<<<<<<<<<< + * + * cpdef void next(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3037, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_aiter.get()->Flags(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3028 + * return self._aiter.get().Done() + * + * cpdef uint32 flags(self): # <<<<<<<<<<<<<< + * """ + * flags(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.ArcIterator.flags", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_11flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_10flags[] = "\n flags(self)\n\n Returns the current iterator behavioral flags.\n\n Returns:\n The current iterator behavioral flags as an integer.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_11flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("flags (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_10flags(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_10flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("flags", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_f_9pywrapfst_11ArcIterator_flags(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3028, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3039 + * return self._aiter.get().Flags() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_13next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_next(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("next", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3039, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_13next)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3039, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3045 + * Advances the iterator. + * """ + * self._aiter.get().Next() # <<<<<<<<<<<<<< + * + * cpdef size_t position(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3045, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->Next(); + + /* "pywrapfst.pyx":3039 + * return self._aiter.get().Flags() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.ArcIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_13next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_12next[] = "\n next(self)\n\n Advances the iterator.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_13next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("next (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_12next(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_12next(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("next", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_11ArcIterator_next(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3039, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3047 + * self._aiter.get().Next() + * + * cpdef size_t position(self): # <<<<<<<<<<<<<< + * """ + * position(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_15position(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static size_t __pyx_f_9pywrapfst_11ArcIterator_position(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + size_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + __Pyx_RefNannySetupContext("position", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_15position)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3056 + * The iterator's position, expressed as an integer. + * """ + * return self._aiter.get().Position() # <<<<<<<<<<<<<< + * + * cpdef void reset(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3056, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_aiter.get()->Position(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3047 + * self._aiter.get().Next() + * + * cpdef size_t position(self): # <<<<<<<<<<<<<< + * """ + * position(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.ArcIterator.position", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_15position(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_14position[] = "\n position(self)\n\n Returns the position of the iterator.\n\n Returns:\n The iterator's position, expressed as an integer.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_15position(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("position (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_14position(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_14position(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("position", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_9pywrapfst_11ArcIterator_position(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.position", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3058 + * return self._aiter.get().Position() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_17reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_reset(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3058, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_17reset)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3058, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3064 + * Resets the iterator to the initial position. + * """ + * self._aiter.get().Reset() # <<<<<<<<<<<<<< + * + * cpdef void seek(self, size_t a): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3064, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->Reset(); + + /* "pywrapfst.pyx":3058 + * return self._aiter.get().Position() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.ArcIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_17reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_16reset[] = "\n reset(self)\n\n Resets the iterator to the initial position.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_17reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_16reset(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_16reset(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_11ArcIterator_reset(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3058, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3066 + * self._aiter.get().Reset() + * + * cpdef void seek(self, size_t a): # <<<<<<<<<<<<<< + * """ + * seek(self, a) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_19seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_a); /*proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_seek(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, size_t __pyx_v_a, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("seek", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_19seek)) { + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3075 + * a: The position to seek to. + * """ + * self._aiter.get().Seek(a) # <<<<<<<<<<<<<< + * + * cpdef void set_flags(self, uint32 flags, uint32 mask): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3075, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->Seek(__pyx_v_a); + + /* "pywrapfst.pyx":3066 + * self._aiter.get().Reset() + * + * cpdef void seek(self, size_t a): # <<<<<<<<<<<<<< + * """ + * seek(self, a) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("pywrapfst.ArcIterator.seek", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_19seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_a); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_18seek[] = "\n seek(self, a)\n\n Advance the iterator to a new position.\n\n Args:\n a: The position to seek to.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_19seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_a) { + size_t __pyx_v_a; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("seek (wrapper)", 0); + assert(__pyx_arg_a); { + __pyx_v_a = __Pyx_PyInt_As_size_t(__pyx_arg_a); if (unlikely((__pyx_v_a == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3066, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.ArcIterator.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_18seek(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self), ((size_t)__pyx_v_a)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_18seek(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, size_t __pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("seek", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_11ArcIterator_seek(__pyx_v_self, __pyx_v_a, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3077 + * self._aiter.get().Seek(a) + * + * cpdef void set_flags(self, uint32 flags, uint32 mask): # <<<<<<<<<<<<<< + * """ + * set_flags(self, flags, mask) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_21set_flags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_9pywrapfst_11ArcIterator_set_flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("set_flags", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_21set_flags)) { + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_mask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3087 + * mask: A mask to be applied to the `flags` argument before setting them. + * """ + * self._aiter.get().SetFlags(flags, mask) # <<<<<<<<<<<<<< + * + * cpdef object value(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3087, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->SetFlags(__pyx_v_flags, __pyx_v_mask); + + /* "pywrapfst.pyx":3077 + * self._aiter.get().Seek(a) + * + * cpdef void set_flags(self, uint32 flags, uint32 mask): # <<<<<<<<<<<<<< + * """ + * set_flags(self, flags, mask) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("pywrapfst.ArcIterator.set_flags", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_21set_flags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_20set_flags[] = "\n set_flags(self, flags, mask)\n\n Sets the current iterator behavioral flags.\n\n Args:\n flags: The properties to be set.\n mask: A mask to be applied to the `flags` argument before setting them.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_21set_flags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_uint32 __pyx_v_flags; + __pyx_t_10basictypes_uint32 __pyx_v_mask; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_flags (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flags,&__pyx_n_s_mask,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_flags", 1, 2, 2, 1); __PYX_ERR(0, 3077, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_flags") < 0)) __PYX_ERR(0, 3077, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_flags = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_flags == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3077, __pyx_L3_error) + __pyx_v_mask = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_mask == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3077, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_flags", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3077, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.ArcIterator.set_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_20set_flags(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self), __pyx_v_flags, __pyx_v_mask); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_20set_flags(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("set_flags", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_11ArcIterator_set_flags(__pyx_v_self, __pyx_v_flags, __pyx_v_mask, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3077, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.set_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3089 + * self._aiter.get().SetFlags(flags, mask) + * + * cpdef object value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_23value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_9pywrapfst_11ArcIterator_value(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("value", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3089, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_11ArcIterator_23value)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3089, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3095 + * Returns the current arc. + * """ + * return _init_Arc(self._aiter.get().Value()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3095, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_Arc(__pyx_v_self->_aiter.get()->Value())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3095, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3089 + * self._aiter.get().SetFlags(flags, mask) + * + * cpdef object value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.ArcIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_23value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_11ArcIterator_22value[] = "\n value(self)\n\n Returns the current arc.\n "; +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_23value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("value (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_22value(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_22value(struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("value", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_11ArcIterator_value(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3089, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_25__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_25__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_24__reduce_cython__(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_27__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_11ArcIterator_27__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_11ArcIterator_26__setstate_cython__(((struct __pyx_obj_9pywrapfst_ArcIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_11ArcIterator_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_ArcIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.ArcIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3107 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator___repr__(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator___repr__(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":3108 + * + * def __repr__(self): + * return "".format(id(self)) # <<<<<<<<<<<<<< + * + * def __init__(self, _MutableFst ifst, int64 state): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_MutableArcIterator_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3107 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3110 + * return "".format(id(self)) + * + * def __init__(self, _MutableFst ifst, int64 state): # <<<<<<<<<<<<<< + * if not ifst._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_18MutableArcIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_18MutableArcIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_ifst = 0; + __pyx_t_10basictypes_int64 __pyx_v_state; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_state,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 3110, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 3110, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__MutableFst *)values[0]); + __pyx_v_state = __Pyx_PyInt_As_int64_t(values[1]); if (unlikely((__pyx_v_state == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3110, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3110, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__MutableFst, 1, "ifst", 0))) __PYX_ERR(0, 3110, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_2__init__(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self), __pyx_v_ifst, __pyx_v_state); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_18MutableArcIterator_2__init__(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__MutableFst *__pyx_v_ifst, __pyx_t_10basictypes_int64 __pyx_v_state) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::shared_ptr __pyx_t_5; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":3111 + * + * def __init__(self, _MutableFst ifst, int64 state): + * if not ifst._fst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3111, __pyx_L1_error) + } + __pyx_t_1 = ((!(__pyx_v_ifst->__pyx_base._fst.get()->ValidStateId(__pyx_v_state) != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":3112 + * def __init__(self, _MutableFst ifst, int64 state): + * if not ifst._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") # <<<<<<<<<<<<<< + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._mfst = ifst._mfst + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_State_index_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_State_index_out_of_range); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 3112, __pyx_L1_error) + + /* "pywrapfst.pyx":3111 + * + * def __init__(self, _MutableFst ifst, int64 state): + * if not ifst._fst.get().ValidStateId(state): # <<<<<<<<<<<<<< + * raise FstIndexError("State index out of range") + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + */ + } + + /* "pywrapfst.pyx":3114 + * raise FstIndexError("State index out of range") + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._mfst = ifst._mfst # <<<<<<<<<<<<<< + * self._aiter.reset(new fst.MutableArcIteratorClass(ifst._mfst.get(), state)) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 3114, __pyx_L1_error) + } + __pyx_t_5 = __pyx_v_ifst->_mfst; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 3114, __pyx_L1_error) + } + __pyx_v_self->_mfst = __pyx_t_5; + + /* "pywrapfst.pyx":3115 + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._mfst = ifst._mfst + * self._aiter.reset(new fst.MutableArcIteratorClass(ifst._mfst.get(), state)) # <<<<<<<<<<<<<< + * + * # Magic method used to get a Pythonic Iterator API out of the C++ API + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3115, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst"); + __PYX_ERR(0, 3115, __pyx_L1_error) + } + __pyx_v_self->_aiter.reset(new fst::script::MutableArcIteratorClass(__pyx_v_ifst->_mfst.get(), __pyx_v_state)); + + /* "pywrapfst.pyx":3110 + * return "".format(id(self)) + * + * def __init__(self, _MutableFst ifst, int64 state): # <<<<<<<<<<<<<< + * if not ifst._fst.get().ValidStateId(state): + * raise FstIndexError("State index out of range") + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_9pywrapfst_18MutableArcIterator_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "pywrapfst.pyx":3118 + * + * # Magic method used to get a Pythonic Iterator API out of the C++ API + * def __iter__(self): # <<<<<<<<<<<<<< + * while not self.done(): + * yield self.value() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_4__iter__(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_4__iter__(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *)__pyx_tp_new_9pywrapfst___pyx_scope_struct____iter__(__pyx_ptype_9pywrapfst___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 3118, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9pywrapfst_18MutableArcIterator_6generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_MutableArcIterator___iter, __pyx_n_s_pywrapfst_2); if (unlikely(!gen)) __PYX_ERR(0, 3118, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_9pywrapfst_18MutableArcIterator_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3118, __pyx_L1_error) + + /* "pywrapfst.pyx":3119 + * # Magic method used to get a Pythonic Iterator API out of the C++ API + * def __iter__(self): + * while not self.done(): # <<<<<<<<<<<<<< + * yield self.value() + * self.next() + */ + while (1) { + if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "done"); + __PYX_ERR(0, 3119, __pyx_L1_error) + } + __pyx_t_1 = ((!(((struct __pyx_vtabstruct_9pywrapfst_MutableArcIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->done(__pyx_cur_scope->__pyx_v_self, 0) != 0)) != 0); + if (!__pyx_t_1) break; + + /* "pywrapfst.pyx":3120 + * def __iter__(self): + * while not self.done(): + * yield self.value() # <<<<<<<<<<<<<< + * self.next() + * + */ + if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "value"); + __PYX_ERR(0, 3120, __pyx_L1_error) + } + __pyx_t_2 = ((struct __pyx_vtabstruct_9pywrapfst_MutableArcIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->value(__pyx_cur_scope->__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3120, __pyx_L1_error) + + /* "pywrapfst.pyx":3121 + * while not self.done(): + * yield self.value() + * self.next() # <<<<<<<<<<<<<< + * + * cpdef bool done(self): + */ + if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "next"); + __PYX_ERR(0, 3121, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_MutableArcIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->next(__pyx_cur_scope->__pyx_v_self, 0); + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "pywrapfst.pyx":3118 + * + * # Magic method used to get a Pythonic Iterator API out of the C++ API + * def __iter__(self): # <<<<<<<<<<<<<< + * while not self.done(): + * yield self.value() + */ + + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3123 + * self.next() + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_8done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_18MutableArcIterator_done(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("done", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_8done)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3132 + * True if the iterator is exhausted, False otherwise. + * """ + * return self._aiter.get().Done() # <<<<<<<<<<<<<< + * + * cpdef uint32 flags(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3132, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_aiter.get()->Done(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3123 + * self.next() + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_8done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_7done[] = "\n done(self)\n\n Indicates whether the iterator is exhausted or not.\n\n Returns:\n True if the iterator is exhausted, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_8done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("done (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_7done(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_7done(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("done", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_18MutableArcIterator_done(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3134 + * return self._aiter.get().Done() + * + * cpdef uint32 flags(self): # <<<<<<<<<<<<<< + * """ + * flags(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_10flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_uint32 __pyx_f_9pywrapfst_18MutableArcIterator_flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_uint32 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_uint32 __pyx_t_5; + __Pyx_RefNannySetupContext("flags", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_10flags)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3143 + * The current iterator behavioral flags as an integer. + * """ + * return self._aiter.get().Flags() # <<<<<<<<<<<<<< + * + * cpdef void next(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3143, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_aiter.get()->Flags(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3134 + * return self._aiter.get().Done() + * + * cpdef uint32 flags(self): # <<<<<<<<<<<<<< + * """ + * flags(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.flags", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_10flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_9flags[] = "\n flags(self)\n\n Returns the current iterator behavioral flags.\n\n Returns:\n The current iterator behavioral flags as an integer.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_10flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("flags (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_9flags(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_9flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("flags", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_f_9pywrapfst_18MutableArcIterator_flags(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3145 + * return self._aiter.get().Flags() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_12next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_next(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("next", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_12next)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3151 + * Advances the iterator. + * """ + * self._aiter.get().Next() # <<<<<<<<<<<<<< + * + * cpdef size_t position(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3151, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->Next(); + + /* "pywrapfst.pyx":3145 + * return self._aiter.get().Flags() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_12next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_11next[] = "\n next(self)\n\n Advances the iterator.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_12next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("next (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_11next(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_11next(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("next", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_18MutableArcIterator_next(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3153 + * self._aiter.get().Next() + * + * cpdef size_t position(self): # <<<<<<<<<<<<<< + * """ + * position(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_14position(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static size_t __pyx_f_9pywrapfst_18MutableArcIterator_position(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + size_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + __Pyx_RefNannySetupContext("position", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_14position)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3162 + * The iterator's position, expressed as an integer. + * """ + * return self._aiter.get().Position() # <<<<<<<<<<<<<< + * + * cpdef void reset(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3162, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_aiter.get()->Position(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3153 + * self._aiter.get().Next() + * + * cpdef size_t position(self): # <<<<<<<<<<<<<< + * """ + * position(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.position", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_14position(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_13position[] = "\n position(self)\n\n Returns the position of the iterator.\n\n Returns:\n The iterator's position, expressed as an integer.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_14position(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("position (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_13position(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_13position(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("position", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_9pywrapfst_18MutableArcIterator_position(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.position", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3164 + * return self._aiter.get().Position() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_16reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_reset(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_16reset)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3170 + * Resets the iterator to the initial position. + * """ + * self._aiter.get().Reset() # <<<<<<<<<<<<<< + * + * cpdef void seek(self, size_t a): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3170, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->Reset(); + + /* "pywrapfst.pyx":3164 + * return self._aiter.get().Position() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_16reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_15reset[] = "\n reset(self)\n\n Resets the iterator to the initial position.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_16reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_15reset(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_15reset(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_18MutableArcIterator_reset(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3172 + * self._aiter.get().Reset() + * + * cpdef void seek(self, size_t a): # <<<<<<<<<<<<<< + * """ + * seek(self, a) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_18seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_a); /*proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_seek(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, size_t __pyx_v_a, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("seek", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_18seek)) { + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3181 + * a: The position to seek to. + * """ + * self._aiter.get().Seek(a) # <<<<<<<<<<<<<< + * + * cpdef void set_flags(self, uint32 flags, uint32 mask): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3181, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->Seek(__pyx_v_a); + + /* "pywrapfst.pyx":3172 + * self._aiter.get().Reset() + * + * cpdef void seek(self, size_t a): # <<<<<<<<<<<<<< + * """ + * seek(self, a) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.seek", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_18seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_a); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_17seek[] = "\n seek(self, a)\n\n Advance the iterator to a new position.\n\n Args:\n a: The position to seek to.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_18seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_a) { + size_t __pyx_v_a; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("seek (wrapper)", 0); + assert(__pyx_arg_a); { + __pyx_v_a = __Pyx_PyInt_As_size_t(__pyx_arg_a); if (unlikely((__pyx_v_a == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3172, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_17seek(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self), ((size_t)__pyx_v_a)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_17seek(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, size_t __pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("seek", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_18MutableArcIterator_seek(__pyx_v_self, __pyx_v_a, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3183 + * self._aiter.get().Seek(a) + * + * cpdef void set_flags(self, uint32 flags, uint32 mask): # <<<<<<<<<<<<<< + * """ + * set_flags(self, flags, mask) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_20set_flags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_set_flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("set_flags", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_20set_flags)) { + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_mask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3193 + * mask: A mask to be applied to the `flags` argument before setting them. + * """ + * self._aiter.get().SetFlags(flags, mask) # <<<<<<<<<<<<<< + * + * cpdef void set_value(self, Arc arc): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3193, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->SetFlags(__pyx_v_flags, __pyx_v_mask); + + /* "pywrapfst.pyx":3183 + * self._aiter.get().Seek(a) + * + * cpdef void set_flags(self, uint32 flags, uint32 mask): # <<<<<<<<<<<<<< + * """ + * set_flags(self, flags, mask) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.set_flags", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_20set_flags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_19set_flags[] = "\n set_flags(self, flags, mask)\n\n Sets the current iterator behavioral flags.\n\n Args:\n flags: The properties to be set.\n mask: A mask to be applied to the `flags` argument before setting them.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_20set_flags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_10basictypes_uint32 __pyx_v_flags; + __pyx_t_10basictypes_uint32 __pyx_v_mask; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_flags (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flags,&__pyx_n_s_mask,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_flags", 1, 2, 2, 1); __PYX_ERR(0, 3183, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_flags") < 0)) __PYX_ERR(0, 3183, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_flags = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_flags == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3183, __pyx_L3_error) + __pyx_v_mask = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_mask == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3183, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_flags", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3183, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.set_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_19set_flags(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self), __pyx_v_flags, __pyx_v_mask); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_19set_flags(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, __pyx_t_10basictypes_uint32 __pyx_v_flags, __pyx_t_10basictypes_uint32 __pyx_v_mask) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("set_flags", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_18MutableArcIterator_set_flags(__pyx_v_self, __pyx_v_flags, __pyx_v_mask, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.set_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3195 + * self._aiter.get().SetFlags(flags, mask) + * + * cpdef void set_value(self, Arc arc): # <<<<<<<<<<<<<< + * """ + * set_value(self, arc) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_22set_value(PyObject *__pyx_v_self, PyObject *__pyx_v_arc); /*proto*/ +static void __pyx_f_9pywrapfst_18MutableArcIterator_set_value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("set_value", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_22set_value)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_arc)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_arc)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3204 + * arc: The arc to replace the current arc with. + * """ + * self._aiter.get().SetValue(deref(arc._arc)) # <<<<<<<<<<<<<< + * + * cpdef object value(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3204, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_arc) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc"); + __PYX_ERR(0, 3204, __pyx_L1_error) + } + __pyx_v_self->_aiter.get()->SetValue((*__pyx_v_arc->_arc)); + + /* "pywrapfst.pyx":3195 + * self._aiter.get().SetFlags(flags, mask) + * + * cpdef void set_value(self, Arc arc): # <<<<<<<<<<<<<< + * """ + * set_value(self, arc) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.MutableArcIterator.set_value", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_22set_value(PyObject *__pyx_v_self, PyObject *__pyx_v_arc); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_21set_value[] = "\n set_value(self, arc)\n\n Replace the current arc with a new arc.\n\n Args:\n arc: The arc to replace the current arc with.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_22set_value(PyObject *__pyx_v_self, PyObject *__pyx_v_arc) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_value (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arc), __pyx_ptype_9pywrapfst_Arc, 1, "arc", 0))) __PYX_ERR(0, 3195, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_21set_value(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self), ((struct __pyx_obj_9pywrapfst_Arc *)__pyx_v_arc)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_21set_value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst_Arc *__pyx_v_arc) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("set_value", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_18MutableArcIterator_set_value(__pyx_v_self, __pyx_v_arc, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.set_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3206 + * self._aiter.get().SetValue(deref(arc._arc)) + * + * cpdef object value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_24value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_9pywrapfst_18MutableArcIterator_value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("value", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_18MutableArcIterator_24value)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3212 + * Returns the current arc. + * """ + * return _init_Arc(self._aiter.get().Value()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_aiter"); + __PYX_ERR(0, 3212, __pyx_L1_error) + } + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_Arc(__pyx_v_self->_aiter.get()->Value())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3206 + * self._aiter.get().SetValue(deref(arc._arc)) + * + * cpdef object value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_24value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_18MutableArcIterator_23value[] = "\n value(self)\n\n Returns the current arc.\n "; +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_24value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("value (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_23value(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_23value(struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("value", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_18MutableArcIterator_value(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_26__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_26__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_25__reduce_cython__(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_25__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_28__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_18MutableArcIterator_28__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_18MutableArcIterator_27__setstate_cython__(((struct __pyx_obj_9pywrapfst_MutableArcIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18MutableArcIterator_27__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_MutableArcIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.MutableArcIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3226 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator___repr__(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator___repr__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":3227 + * + * def __repr__(self): + * return "".format(id(self)) # <<<<<<<<<<<<<< + * + * def __init__(self, _Fst ifst): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_StateIterator_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3226 + * """ + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "".format(id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.StateIterator.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3229 + * return "".format(id(self)) + * + * def __init__(self, _Fst ifst): # <<<<<<<<<<<<<< + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._fst = ifst._fst + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_13StateIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_13StateIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 3229, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3229, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.StateIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3229, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_2__init__(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self), __pyx_v_ifst); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_13StateIterator_2__init__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst) { + int __pyx_r; + __Pyx_RefNannyDeclarations + std::shared_ptr __pyx_t_1; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":3231 + * def __init__(self, _Fst ifst): + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._fst = ifst._fst # <<<<<<<<<<<<<< + * self._siter.reset(new fst.StateIteratorClass(deref(self._fst))) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3231, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_ifst->_fst; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3231, __pyx_L1_error) + } + __pyx_v_self->_fst = __pyx_t_1; + + /* "pywrapfst.pyx":3232 + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._fst = ifst._fst + * self._siter.reset(new fst.StateIteratorClass(deref(self._fst))) # <<<<<<<<<<<<<< + * + * # This just registers this class as a possible iterator. + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 3232, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3232, __pyx_L1_error) + } + __pyx_v_self->_siter.reset(new fst::script::StateIteratorClass((*__pyx_v_self->_fst))); + + /* "pywrapfst.pyx":3229 + * return "".format(id(self)) + * + * def __init__(self, _Fst ifst): # <<<<<<<<<<<<<< + * # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + * self._fst = ifst._fst + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.StateIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3235 + * + * # This just registers this class as a possible iterator. + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_4__iter__(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_4__iter__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "pywrapfst.pyx":3236 + * # This just registers this class as a possible iterator. + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * # Magic method used to get a Pythonic API out of the C++ API. + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pywrapfst.pyx":3235 + * + * # This just registers this class as a possible iterator. + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3239 + * + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done(): + * raise StopIteration + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_7__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_7__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_6__next__(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_6__next__(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + __pyx_t_10basictypes_int64 __pyx_v_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "pywrapfst.pyx":3240 + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): + * if self.done(): # <<<<<<<<<<<<<< + * raise StopIteration + * cdef int64 result = self.value() + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "done"); + __PYX_ERR(0, 3240, __pyx_L1_error) + } + __pyx_t_1 = (((struct __pyx_vtabstruct_9pywrapfst_StateIterator *)__pyx_v_self->__pyx_vtab)->done(__pyx_v_self, 0) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pywrapfst.pyx":3241 + * def __next__(self): + * if self.done(): + * raise StopIteration # <<<<<<<<<<<<<< + * cdef int64 result = self.value() + * self.next() + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); + __PYX_ERR(0, 3241, __pyx_L1_error) + + /* "pywrapfst.pyx":3240 + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): + * if self.done(): # <<<<<<<<<<<<<< + * raise StopIteration + * cdef int64 result = self.value() + */ + } + + /* "pywrapfst.pyx":3242 + * if self.done(): + * raise StopIteration + * cdef int64 result = self.value() # <<<<<<<<<<<<<< + * self.next() + * return result + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "value"); + __PYX_ERR(0, 3242, __pyx_L1_error) + } + __pyx_v_result = ((struct __pyx_vtabstruct_9pywrapfst_StateIterator *)__pyx_v_self->__pyx_vtab)->value(__pyx_v_self, 0); + + /* "pywrapfst.pyx":3243 + * raise StopIteration + * cdef int64 result = self.value() + * self.next() # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "next"); + __PYX_ERR(0, 3243, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_StateIterator *)__pyx_v_self->__pyx_vtab)->next(__pyx_v_self, 0); + + /* "pywrapfst.pyx":3244 + * cdef int64 result = self.value() + * self.next() + * return result # <<<<<<<<<<<<<< + * + * cpdef bool done(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3239 + * + * # Magic method used to get a Pythonic API out of the C++ API. + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done(): + * raise StopIteration + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst.StateIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3246 + * return result + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_13StateIterator_done(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("done", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_13StateIterator_9done)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3246, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3255 + * True if the iterator is exhausted, False otherwise. + * """ + * return self._siter.get().Done() # <<<<<<<<<<<<<< + * + * cpdef void next(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 3255, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_siter.get()->Done(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3246 + * return result + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.StateIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_13StateIterator_8done[] = "\n done(self)\n\n Indicates whether the iterator is exhausted or not.\n\n Returns:\n True if the iterator is exhausted, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("done (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_8done(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_8done(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("done", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_13StateIterator_done(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.StateIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3257 + * return self._siter.get().Done() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_11next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_13StateIterator_next(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("next", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_13StateIterator_11next)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3263 + * Advances the iterator. + * """ + * self._siter.get().Next() # <<<<<<<<<<<<<< + * + * cpdef void reset(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 3263, __pyx_L1_error) + } + __pyx_v_self->_siter.get()->Next(); + + /* "pywrapfst.pyx":3257 + * return self._siter.get().Done() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.StateIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_11next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_13StateIterator_10next[] = "\n next(self)\n\n Advances the iterator.\n "; +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_11next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("next (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_10next(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_10next(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("next", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_13StateIterator_next(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.StateIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3265 + * self._siter.get().Next() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_13StateIterator_reset(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_13StateIterator_13reset)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3271 + * Resets the iterator to the initial position. + * """ + * self._siter.get().Reset() # <<<<<<<<<<<<<< + * + * cpdef int64 value(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 3271, __pyx_L1_error) + } + __pyx_v_self->_siter.get()->Reset(); + + /* "pywrapfst.pyx":3265 + * self._siter.get().Next() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.StateIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_13StateIterator_12reset[] = "\n reset(self)\n\n Resets the iterator to the initial position.\n "; +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_12reset(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_12reset(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_13StateIterator_reset(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.StateIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3273 + * self._siter.get().Reset() + * + * cpdef int64 value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_15value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_10basictypes_int64 __pyx_f_9pywrapfst_13StateIterator_value(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_10basictypes_int64 __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_5; + __Pyx_RefNannySetupContext("value", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_13StateIterator_15value)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3273, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":3279 + * Returns the current state index. + * """ + * return self._siter.get().Value() # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_siter"); + __PYX_ERR(0, 3279, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_siter.get()->Value(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3273 + * self._siter.get().Reset() + * + * cpdef int64 value(self): # <<<<<<<<<<<<<< + * """ + * value(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.StateIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_15value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_13StateIterator_14value[] = "\n value(self)\n\n Returns the current state index.\n "; +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_15value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("value (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_14value(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_14value(struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("value", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_f_9pywrapfst_13StateIterator_value(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.StateIterator.value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_16__reduce_cython__(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.StateIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_13StateIterator_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_13StateIterator_18__setstate_cython__(((struct __pyx_obj_9pywrapfst_StateIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_13StateIterator_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_StateIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.StateIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3285 + * + * + * cdef _Fst _map(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * map_type=b"identity", + */ + +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst__map(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, struct __pyx_opt_args_9pywrapfst__map *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__31; + PyObject *__pyx_v_map_type = ((PyObject *)__pyx_n_b_identity); + double __pyx_v_power = ((double)1.); + + /* "pywrapfst.pyx":3289 + * map_type=b"identity", + * double power=1., + * weight=None): # <<<<<<<<<<<<<< + * cdef fst.MapType map_type_enum + * if not fst.GetMapType(tostring(map_type), addr(map_type_enum)): + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + enum fst::script::MapType __pyx_v_map_type_enum; + fst::script::WeightClass __pyx_v_wc; + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + fst::script::WeightClass __pyx_t_8; + fst::script::WeightClass __pyx_t_9; + __Pyx_RefNannySetupContext("_map", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_map_type = __pyx_optional_args->map_type; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_power = __pyx_optional_args->power; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_weight = __pyx_optional_args->weight; + } + } + } + } + } + + /* "pywrapfst.pyx":3291 + * weight=None): + * cdef fst.MapType map_type_enum + * if not fst.GetMapType(tostring(map_type), addr(map_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown map type: {!r}".format(map_type)) + * cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_map_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3291, __pyx_L1_error) + __pyx_t_2 = ((!(fst::script::GetMapType(__pyx_t_1, (&__pyx_v_map_type_enum)) != 0)) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":3292 + * cdef fst.MapType map_type_enum + * if not fst.GetMapType(tostring(map_type), addr(map_type_enum)): + * raise FstArgError("Unknown map type: {!r}".format(map_type)) # <<<<<<<<<<<<<< + * cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), + * weight) if map_type_enum == fst.TIMES_MAPPER else + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_map_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_map_type) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_map_type); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 3292, __pyx_L1_error) + + /* "pywrapfst.pyx":3291 + * weight=None): + * cdef fst.MapType map_type_enum + * if not fst.GetMapType(tostring(map_type), addr(map_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown map type: {!r}".format(map_type)) + * cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), + */ + } + + /* "pywrapfst.pyx":3294 + * raise FstArgError("Unknown map type: {!r}".format(map_type)) + * cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), + * weight) if map_type_enum == fst.TIMES_MAPPER else # <<<<<<<<<<<<<< + * _get_WeightClass_or_Zero(ifst.weight_type(), weight)) + * return _init_XFst(fst.Map(deref(ifst._fst), map_type_enum, delta, power, wc)) + */ + if (((__pyx_v_map_type_enum == fst::script::TIMES_MAPPER) != 0)) { + + /* "pywrapfst.pyx":3293 + * if not fst.GetMapType(tostring(map_type), addr(map_type_enum)): + * raise FstArgError("Unknown map type: {!r}".format(map_type)) + * cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), # <<<<<<<<<<<<<< + * weight) if map_type_enum == fst.TIMES_MAPPER else + * _get_WeightClass_or_Zero(ifst.weight_type(), weight)) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 3293, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3294 + * raise FstArgError("Unknown map type: {!r}".format(map_type)) + * cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), + * weight) if map_type_enum == fst.TIMES_MAPPER else # <<<<<<<<<<<<<< + * _get_WeightClass_or_Zero(ifst.weight_type(), weight)) + * return _init_XFst(fst.Map(deref(ifst._fst), map_type_enum, delta, power, wc)) + */ + __pyx_t_9 = __pyx_f_9pywrapfst__get_WeightClass_or_One(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->weight_type(__pyx_v_ifst, 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3293, __pyx_L1_error) + __pyx_t_8 = __pyx_t_9; + } else { + + /* "pywrapfst.pyx":3295 + * cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), + * weight) if map_type_enum == fst.TIMES_MAPPER else + * _get_WeightClass_or_Zero(ifst.weight_type(), weight)) # <<<<<<<<<<<<<< + * return _init_XFst(fst.Map(deref(ifst._fst), map_type_enum, delta, power, wc)) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 3295, __pyx_L1_error) + } + __pyx_t_9 = __pyx_f_9pywrapfst__get_WeightClass_or_Zero(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->weight_type(__pyx_v_ifst, 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3295, __pyx_L1_error) + __pyx_t_8 = __pyx_t_9; + } + __pyx_v_wc = __pyx_t_8; + + /* "pywrapfst.pyx":3296 + * weight) if map_type_enum == fst.TIMES_MAPPER else + * _get_WeightClass_or_Zero(ifst.weight_type(), weight)) + * return _init_XFst(fst.Map(deref(ifst._fst), map_type_enum, delta, power, wc)) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3296, __pyx_L1_error) + } + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_XFst(fst::script::Map((*__pyx_v_ifst->_fst), __pyx_v_map_type_enum, __pyx_v_delta, __pyx_v_power, __pyx_v_wc))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3285 + * + * + * cdef _Fst _map(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * map_type=b"identity", + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst._map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3299 + * + * + * cpdef _Fst arcmap(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * map_type=b"identity", + */ + +static PyObject *__pyx_pw_9pywrapfst_19arcmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_arcmap(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_arcmap *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__32; + PyObject *__pyx_v_map_type = ((PyObject *)__pyx_n_b_identity); + double __pyx_v_power = ((double)1.); + + /* "pywrapfst.pyx":3303 + * map_type=b"identity", + * double power=1., + * weight=None): # <<<<<<<<<<<<<< + * """ + * arcmap(ifst, delta=0.0009765625, map_type="identity", power=1., weight=None) + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst__map __pyx_t_2; + __Pyx_RefNannySetupContext("arcmap", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_map_type = __pyx_optional_args->map_type; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_power = __pyx_optional_args->power; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_weight = __pyx_optional_args->weight; + } + } + } + } + } + + /* "pywrapfst.pyx":3346 + * See also: `statemap`. + * """ + * return _map(ifst, delta, map_type, power, weight) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2.__pyx_n = 4; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.map_type = __pyx_v_map_type; + __pyx_t_2.power = __pyx_v_power; + __pyx_t_2.weight = __pyx_v_weight; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__map(__pyx_v_ifst, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3299 + * + * + * cpdef _Fst arcmap(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * map_type=b"identity", + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.arcmap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_19arcmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_18arcmap[] = "\n arcmap(ifst, delta=0.0009765625, map_type=\"identity\", power=1., weight=None)\n\n Constructively applies a transform to all arcs and final states.\n\n This operation transforms each arc and final state in the input FST using\n one of the following:\n\n * identity: maps to self.\n * input_epsilon: replaces all input labels with epsilon.\n * invert: reciprocates all non-Zero weights.\n * float_power: raises all weights to a floating-point power.\n * output_epsilon: replaces all output labels with epsilon.\n * quantize: quantizes weights.\n * plus: adds a constant to all weights.\n * power: raises all weights to an integral power.\n * rmweight: replaces all non-Zero weights with 1.\n * superfinal: redirects final states to a new superfinal state.\n * times: right-multiplies a constant by all weights.\n * to_log: converts weights to the log semiring.\n * to_log64: converts weights to the log64 semiring.\n * to_standard: converts weights to the tropical (\"standard\") semiring.\n\n Args:\n ifst: The input FST.\n delta: Comparison/quantization delta (ignored unless `map_type` is\n `quantize`).\n map_type: A string matching a known mapping operation (see above).\n power: A positive scalar or integer power; ignored unless `map_type` is\n `float_power` or `power` (in which case it defaults to 1).\n weight: A Weight or weight string passed to the arc-mapper; ignored unless\n `map_type` is `plus` (in which case it defaults to semiring Zero) or\n `times` (in which case it defaults to semiring One).\n\n Returns:\n An FST with arcs and final states remapped.\n\n Raises:\n FstArgError: Unknown map type.\n\n See also: `statemap`.\n "; +static PyObject *__pyx_pw_9pywrapfst_19arcmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + float __pyx_v_delta; + PyObject *__pyx_v_map_type = 0; + double __pyx_v_power; + PyObject *__pyx_v_weight = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arcmap (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_delta,&__pyx_n_s_map_type,&__pyx_n_s_power,&__pyx_n_s_weight,0}; + PyObject* values[5] = {0,0,0,0,0}; + values[2] = ((PyObject *)__pyx_n_b_identity); + + /* "pywrapfst.pyx":3303 + * map_type=b"identity", + * double power=1., + * weight=None): # <<<<<<<<<<<<<< + * """ + * arcmap(ifst, delta=0.0009765625, map_type="identity", power=1., weight=None) + */ + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_map_type); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_power); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arcmap") < 0)) __PYX_ERR(0, 3299, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3300, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__32; + } + __pyx_v_map_type = values[2]; + if (values[3]) { + __pyx_v_power = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_power == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3302, __pyx_L3_error) + } else { + __pyx_v_power = ((double)1.); + } + __pyx_v_weight = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("arcmap", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3299, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.arcmap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3299, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_18arcmap(__pyx_self, __pyx_v_ifst, __pyx_v_delta, __pyx_v_map_type, __pyx_v_power, __pyx_v_weight); + + /* "pywrapfst.pyx":3299 + * + * + * cpdef _Fst arcmap(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * map_type=b"identity", + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_18arcmap(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, PyObject *__pyx_v_map_type, double __pyx_v_power, PyObject *__pyx_v_weight) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_arcmap __pyx_t_2; + __Pyx_RefNannySetupContext("arcmap", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 4; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.map_type = __pyx_v_map_type; + __pyx_t_2.power = __pyx_v_power; + __pyx_t_2.weight = __pyx_v_weight; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_arcmap(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.arcmap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3349 + * + * + * cpdef _MutableFst compose(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + +static PyObject *__pyx_pw_9pywrapfst_21compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_compose(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_compose *__pyx_optional_args) { + PyObject *__pyx_v_compose_filter = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":3352 + * _Fst ifst2, + * compose_filter=b"auto", + * bool connect=True): # <<<<<<<<<<<<<< + * """ + * compose(ifst1, ifst2, compose_filter="auto", connect=True) + */ + bool __pyx_v_connect = ((bool)1); + std::unique_ptr __pyx_v_tfst; + std::unique_ptr __pyx_v_opts; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + enum fst::ComposeFilter __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("compose", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_compose_filter = __pyx_optional_args->compose_filter; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_connect = __pyx_optional_args->connect; + } + } + } + + /* "pywrapfst.pyx":3378 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3378, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst1->__pyx_vtab)->arc_type(__pyx_v_ifst1, 0))); + + /* "pywrapfst.pyx":3381 + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, + * _get_compose_filter(tostring(compose_filter)))) # <<<<<<<<<<<<<< + * fst.Compose(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_compose_filter); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3381, __pyx_L1_error) + __pyx_t_2 = __pyx_f_9pywrapfst__get_compose_filter(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3381, __pyx_L1_error) + + /* "pywrapfst.pyx":3380 + * tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, # <<<<<<<<<<<<<< + * _get_compose_filter(tostring(compose_filter)))) + * fst.Compose(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + */ + __pyx_v_opts.reset(new fst::ComposeOptions(__pyx_v_connect, __pyx_t_2)); + + /* "pywrapfst.pyx":3382 + * opts.reset(new fst.ComposeOptions(connect, + * _get_compose_filter(tostring(compose_filter)))) + * fst.Compose(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3382, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3382, __pyx_L1_error) + } + fst::script::Compose((*__pyx_v_ifst1->_fst), (*__pyx_v_ifst2->_fst), __pyx_v_tfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":3383 + * _get_compose_filter(tostring(compose_filter)))) + * fst.Compose(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3349 + * + * + * cpdef _MutableFst compose(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.compose", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_21compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_20compose[] = "\n compose(ifst1, ifst2, compose_filter=\"auto\", connect=True)\n\n Constructively composes two FSTs.\n\n This operation computes the composition of two FSTs. If A transduces string\n x to y with weight a and B transduces y to z with weight b, then their\n composition transduces string x to z with weight a \\otimes b. The output\n labels of the first transducer or the input labels of the second transducer\n must be sorted (or otherwise support appropriate matchers).\n\n Args:\n ifst1: The first input FST.\n ifst2: The second input FST.\n compose_filter: A string matching a known composition filter; one of:\n \"alt_sequence\", \"auto\", \"match\", \"no_match\", \"null\", \"sequence\",\n \"trivial\".\n connect: Should output be trimmed?\n\n Returns:\n An FST.\n\n See also: `arcsort`.\n "; +static PyObject *__pyx_pw_9pywrapfst_21compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1 = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2 = 0; + PyObject *__pyx_v_compose_filter = 0; + bool __pyx_v_connect; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("compose (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst1,&__pyx_n_s_ifst2,&__pyx_n_s_compose_filter,&__pyx_n_s_connect,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = ((PyObject *)__pyx_n_b_auto); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("compose", 0, 2, 4, 1); __PYX_ERR(0, 3349, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compose_filter); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connect); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compose") < 0)) __PYX_ERR(0, 3349, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst1 = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_ifst2 = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + __pyx_v_compose_filter = values[2]; + if (values[3]) { + __pyx_v_connect = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_connect == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3352, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3352 + * _Fst ifst2, + * compose_filter=b"auto", + * bool connect=True): # <<<<<<<<<<<<<< + * """ + * compose(ifst1, ifst2, compose_filter="auto", connect=True) + */ + __pyx_v_connect = ((bool)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("compose", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3349, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.compose", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst1), __pyx_ptype_9pywrapfst__Fst, 1, "ifst1", 0))) __PYX_ERR(0, 3349, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst2), __pyx_ptype_9pywrapfst__Fst, 1, "ifst2", 0))) __PYX_ERR(0, 3350, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_20compose(__pyx_self, __pyx_v_ifst1, __pyx_v_ifst2, __pyx_v_compose_filter, __pyx_v_connect); + + /* "pywrapfst.pyx":3349 + * + * + * cpdef _MutableFst compose(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_20compose(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_compose __pyx_t_2; + __Pyx_RefNannySetupContext("compose", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.compose_filter = __pyx_v_compose_filter; + __pyx_t_2.connect = __pyx_v_connect; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_compose(__pyx_v_ifst1, __pyx_v_ifst2, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3349, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.compose", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3386 + * + * + * cpdef _Fst convert(_Fst ifst, fst_type=b""): # <<<<<<<<<<<<<< + * """ + * convert(ifst, fst_type="") + */ + +static PyObject *__pyx_pw_9pywrapfst_23convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_convert(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_convert *__pyx_optional_args) { + PyObject *__pyx_v_fst_type = ((PyObject *)__pyx_kp_b__10); + std::string __pyx_v_fst_type_string; + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("convert", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_fst_type = __pyx_optional_args->fst_type; + } + } + + /* "pywrapfst.pyx":3403 + * FstOpError: Conversion failed. + * """ + * cdef string fst_type_string = tostring(fst_type) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.Convert(deref(ifst._fst), fst_type_string)) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_fst_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3403, __pyx_L1_error) + __pyx_v_fst_type_string = __pyx_t_1; + + /* "pywrapfst.pyx":3405 + * cdef string fst_type_string = tostring(fst_type) + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.Convert(deref(ifst._fst), fst_type_string)) # <<<<<<<<<<<<<< + * # Script-land Convert returns a null pointer to signal failure. + * if tfst.get() == NULL: + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3405, __pyx_L1_error) + } + __pyx_v_tfst.reset(fst::script::Convert((*__pyx_v_ifst->_fst), __pyx_v_fst_type_string)); + + /* "pywrapfst.pyx":3407 + * tfst.reset(fst.Convert(deref(ifst._fst), fst_type_string)) + * # Script-land Convert returns a null pointer to signal failure. + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstOpError("Conversion to {!r} failed".format(fst_type)) + * return _init_XFst(tfst.release()) + */ + __pyx_t_2 = ((__pyx_v_tfst.get() == NULL) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pywrapfst.pyx":3408 + * # Script-land Convert returns a null pointer to signal failure. + * if tfst.get() == NULL: + * raise FstOpError("Conversion to {!r} failed".format(fst_type)) # <<<<<<<<<<<<<< + * return _init_XFst(tfst.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Conversion_to_r_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_fst_type) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_fst_type); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 3408, __pyx_L1_error) + + /* "pywrapfst.pyx":3407 + * tfst.reset(fst.Convert(deref(ifst._fst), fst_type_string)) + * # Script-land Convert returns a null pointer to signal failure. + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstOpError("Conversion to {!r} failed".format(fst_type)) + * return _init_XFst(tfst.release()) + */ + } + + /* "pywrapfst.pyx":3409 + * if tfst.get() == NULL: + * raise FstOpError("Conversion to {!r} failed".format(fst_type)) + * return _init_XFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_XFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3386 + * + * + * cpdef _Fst convert(_Fst ifst, fst_type=b""): # <<<<<<<<<<<<<< + * """ + * convert(ifst, fst_type="") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.convert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_23convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_22convert[] = "\n convert(ifst, fst_type=\"\")\n\n Constructively converts an FST to a new internal representation.\n\n Args:\n ifst: The input FST.\n fst_type: A string indicating the FST type to convert to, or an empty string\n if no conversion is desired.\n\n Returns:\n The input FST converted to the desired FST type.\n\n Raises:\n FstOpError: Conversion failed.\n "; +static PyObject *__pyx_pw_9pywrapfst_23convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + PyObject *__pyx_v_fst_type = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("convert (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_fst_type,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)__pyx_kp_b__10); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fst_type); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convert") < 0)) __PYX_ERR(0, 3386, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_fst_type = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("convert", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3386, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.convert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3386, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_22convert(__pyx_self, __pyx_v_ifst, __pyx_v_fst_type); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_22convert(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, PyObject *__pyx_v_fst_type) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_convert __pyx_t_2; + __Pyx_RefNannySetupContext("convert", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.fst_type = __pyx_v_fst_type; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_convert(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.convert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3412 + * + * + * cpdef _MutableFst determinize(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * det_type=b"functional", + */ + +static PyObject *__pyx_pw_9pywrapfst_25determinize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_determinize(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_determinize *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__33; + PyObject *__pyx_v_det_type = ((PyObject *)__pyx_n_b_functional); + __pyx_t_10basictypes_int64 __pyx_v_nstate = __pyx_k__34; + __pyx_t_10basictypes_int64 __pyx_v_subsequential_label = ((__pyx_t_10basictypes_int64)0); + + /* "pywrapfst.pyx":3417 + * int64 nstate=fst.kNoStateId, + * int64 subsequential_label=0, + * weight=None, # <<<<<<<<<<<<<< + * bool increment_subsequential_label=False): + * """ + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + + /* "pywrapfst.pyx":3418 + * int64 subsequential_label=0, + * weight=None, + * bool increment_subsequential_label=False): # <<<<<<<<<<<<<< + * """ + * determinize(ifst, delta=1e-6, det_type="functional", + */ + bool __pyx_v_increment_subsequential_label = ((bool)0); + std::unique_ptr __pyx_v_tfst; + fst::script::WeightClass __pyx_v_wc; + enum fst::DeterminizeType __pyx_v_determinize_type_enum; + std::unique_ptr __pyx_v_opts; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + std::string __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("determinize", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_det_type = __pyx_optional_args->det_type; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_nstate = __pyx_optional_args->nstate; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_subsequential_label = __pyx_optional_args->subsequential_label; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_weight = __pyx_optional_args->weight; + if (__pyx_optional_args->__pyx_n > 5) { + __pyx_v_increment_subsequential_label = __pyx_optional_args->increment_subsequential_label; + } + } + } + } + } + } + } + + /* "pywrapfst.pyx":3454 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * # Threshold is set to semiring Zero (no pruning) if weight unspecified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3454, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3456 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * # Threshold is set to semiring Zero (no pruning) if weight unspecified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), # <<<<<<<<<<<<<< + * weight) + * cdef fst.DeterminizeType determinize_type_enum + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 3456, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3457 + * # Threshold is set to semiring Zero (no pruning) if weight unspecified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), + * weight) # <<<<<<<<<<<<<< + * cdef fst.DeterminizeType determinize_type_enum + * if not fst.GetDeterminizeType(tostring(det_type), + */ + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_Zero(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->weight_type(__pyx_v_ifst, 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3456, __pyx_L1_error) + __pyx_v_wc = __pyx_t_1; + + /* "pywrapfst.pyx":3459 + * weight) + * cdef fst.DeterminizeType determinize_type_enum + * if not fst.GetDeterminizeType(tostring(det_type), # <<<<<<<<<<<<<< + * addr(determinize_type_enum)): + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + */ + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_v_det_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3459, __pyx_L1_error) + + /* "pywrapfst.pyx":3460 + * cdef fst.DeterminizeType determinize_type_enum + * if not fst.GetDeterminizeType(tostring(det_type), + * addr(determinize_type_enum)): # <<<<<<<<<<<<<< + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + * cdef unique_ptr[fst.DeterminizeOptions] opts + */ + __pyx_t_3 = ((!(fst::script::GetDeterminizeType(__pyx_t_2, (&__pyx_v_determinize_type_enum)) != 0)) != 0); + + /* "pywrapfst.pyx":3459 + * weight) + * cdef fst.DeterminizeType determinize_type_enum + * if not fst.GetDeterminizeType(tostring(det_type), # <<<<<<<<<<<<<< + * addr(determinize_type_enum)): + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + */ + if (unlikely(__pyx_t_3)) { + + /* "pywrapfst.pyx":3461 + * if not fst.GetDeterminizeType(tostring(det_type), + * addr(determinize_type_enum)): + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.DeterminizeOptions] opts + * opts.reset(new fst.DeterminizeOptions(delta, wc, nstate, subsequential_label, + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_determinization_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_det_type) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_det_type); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 3461, __pyx_L1_error) + + /* "pywrapfst.pyx":3459 + * weight) + * cdef fst.DeterminizeType determinize_type_enum + * if not fst.GetDeterminizeType(tostring(det_type), # <<<<<<<<<<<<<< + * addr(determinize_type_enum)): + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + */ + } + + /* "pywrapfst.pyx":3463 + * raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + * cdef unique_ptr[fst.DeterminizeOptions] opts + * opts.reset(new fst.DeterminizeOptions(delta, wc, nstate, subsequential_label, # <<<<<<<<<<<<<< + * determinize_type_enum, + * increment_subsequential_label)) + */ + __pyx_v_opts.reset(new fst::script::DeterminizeOptions(__pyx_v_delta, __pyx_v_wc, __pyx_v_nstate, __pyx_v_subsequential_label, __pyx_v_determinize_type_enum, __pyx_v_increment_subsequential_label)); + + /* "pywrapfst.pyx":3466 + * determinize_type_enum, + * increment_subsequential_label)) + * fst.Determinize(deref(ifst._fst), tfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3466, __pyx_L1_error) + } + fst::script::Determinize((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":3467 + * increment_subsequential_label)) + * fst.Determinize(deref(ifst._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_4 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3412 + * + * + * cpdef _MutableFst determinize(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * det_type=b"functional", + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst.determinize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_25determinize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_24determinize[] = "\n determinize(ifst, delta=1e-6, det_type=\"functional\",\n nstate=NO_STATE_ID, subsequential_label=0, weight=None,\n incremental_subsequential_label=False)\n\n Constructively determinizes a weighted FST.\n\n This operations creates an equivalent FST that has the property that no\n state has two transitions with the same input label. For this algorithm,\n epsilon transitions are treated as regular symbols (cf. `rmepsilon`).\n\n Args:\n ifst: The input FST.\n delta: Comparison/quantization delta.\n det_type: Type of determinization; one of: \"functional\" (input transducer is\n functional), \"nonfunctional\" (input transducer is not functional) and\n disambiguate\" (input transducer is not functional but only keep the min\n of ambiguous outputs).\n nstate: State number threshold.\n subsequential_label: Input label of arc corresponding to residual final\n output when producing a subsequential transducer.\n weight: A Weight or weight string indicating the desired weight threshold\n below which paths are pruned; if omitted, no paths are pruned.\n increment_subsequential_label: Increment subsequential when creating\n several arcs for the residual final output at a given state.\n\n Returns:\n An equivalent deterministic FST.\n\n Raises:\n FstArgError: Unknown determinization type.\n\n See also: `disambiguate`, `rmepsilon`.\n "; +static PyObject *__pyx_pw_9pywrapfst_25determinize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + float __pyx_v_delta; + PyObject *__pyx_v_det_type = 0; + __pyx_t_10basictypes_int64 __pyx_v_nstate; + __pyx_t_10basictypes_int64 __pyx_v_subsequential_label; + PyObject *__pyx_v_weight = 0; + bool __pyx_v_increment_subsequential_label; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("determinize (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_delta,&__pyx_n_s_det_type,&__pyx_n_s_nstate,&__pyx_n_s_subsequential_label,&__pyx_n_s_weight,&__pyx_n_s_increment_subsequential_label,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[2] = ((PyObject *)__pyx_n_b_functional); + + /* "pywrapfst.pyx":3417 + * int64 nstate=fst.kNoStateId, + * int64 subsequential_label=0, + * weight=None, # <<<<<<<<<<<<<< + * bool increment_subsequential_label=False): + * """ + */ + values[5] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_type); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nstate); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subsequential_label); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_increment_subsequential_label); + if (value) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "determinize") < 0)) __PYX_ERR(0, 3412, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3413, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__33; + } + __pyx_v_det_type = values[2]; + if (values[3]) { + __pyx_v_nstate = __Pyx_PyInt_As_int64_t(values[3]); if (unlikely((__pyx_v_nstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3415, __pyx_L3_error) + } else { + __pyx_v_nstate = __pyx_k__34; + } + if (values[4]) { + __pyx_v_subsequential_label = __Pyx_PyInt_As_int64_t(values[4]); if (unlikely((__pyx_v_subsequential_label == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3416, __pyx_L3_error) + } else { + __pyx_v_subsequential_label = ((__pyx_t_10basictypes_int64)0); + } + __pyx_v_weight = values[5]; + if (values[6]) { + __pyx_v_increment_subsequential_label = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_increment_subsequential_label == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3418, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3418 + * int64 subsequential_label=0, + * weight=None, + * bool increment_subsequential_label=False): # <<<<<<<<<<<<<< + * """ + * determinize(ifst, delta=1e-6, det_type="functional", + */ + __pyx_v_increment_subsequential_label = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("determinize", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3412, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.determinize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3412, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_24determinize(__pyx_self, __pyx_v_ifst, __pyx_v_delta, __pyx_v_det_type, __pyx_v_nstate, __pyx_v_subsequential_label, __pyx_v_weight, __pyx_v_increment_subsequential_label); + + /* "pywrapfst.pyx":3412 + * + * + * cpdef _MutableFst determinize(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * det_type=b"functional", + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_24determinize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, PyObject *__pyx_v_det_type, __pyx_t_10basictypes_int64 __pyx_v_nstate, __pyx_t_10basictypes_int64 __pyx_v_subsequential_label, PyObject *__pyx_v_weight, bool __pyx_v_increment_subsequential_label) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_determinize __pyx_t_2; + __Pyx_RefNannySetupContext("determinize", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 6; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.det_type = __pyx_v_det_type; + __pyx_t_2.nstate = __pyx_v_nstate; + __pyx_t_2.subsequential_label = __pyx_v_subsequential_label; + __pyx_t_2.weight = __pyx_v_weight; + __pyx_t_2.increment_subsequential_label = __pyx_v_increment_subsequential_label; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_determinize(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.determinize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3470 + * + * + * cpdef _MutableFst difference(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + +static PyObject *__pyx_pw_9pywrapfst_27difference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_difference(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_difference *__pyx_optional_args) { + PyObject *__pyx_v_compose_filter = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":3473 + * _Fst ifst2, + * compose_filter=b"auto", + * bool connect=True): # <<<<<<<<<<<<<< + * """ + * difference(ifst1, ifst2, compose_filter="auto", connect=True) + */ + bool __pyx_v_connect = ((bool)1); + std::unique_ptr __pyx_v_tfst; + std::unique_ptr __pyx_v_opts; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + enum fst::ComposeFilter __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("difference", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_compose_filter = __pyx_optional_args->compose_filter; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_connect = __pyx_optional_args->connect; + } + } + } + + /* "pywrapfst.pyx":3498 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, _get_compose_filter( + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3498, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst1->__pyx_vtab)->arc_type(__pyx_v_ifst1, 0))); + + /* "pywrapfst.pyx":3501 + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, _get_compose_filter( + * tostring(compose_filter)))) # <<<<<<<<<<<<<< + * fst.Difference(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_compose_filter); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3501, __pyx_L1_error) + + /* "pywrapfst.pyx":3500 + * tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, _get_compose_filter( # <<<<<<<<<<<<<< + * tostring(compose_filter)))) + * fst.Difference(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + */ + __pyx_t_2 = __pyx_f_9pywrapfst__get_compose_filter(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3500, __pyx_L1_error) + __pyx_v_opts.reset(new fst::ComposeOptions(__pyx_v_connect, __pyx_t_2)); + + /* "pywrapfst.pyx":3502 + * opts.reset(new fst.ComposeOptions(connect, _get_compose_filter( + * tostring(compose_filter)))) + * fst.Difference(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3502, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3502, __pyx_L1_error) + } + fst::script::Difference((*__pyx_v_ifst1->_fst), (*__pyx_v_ifst2->_fst), __pyx_v_tfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":3503 + * tostring(compose_filter)))) + * fst.Difference(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3470 + * + * + * cpdef _MutableFst difference(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.difference", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_27difference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_26difference[] = "\n difference(ifst1, ifst2, compose_filter=\"auto\", connect=True)\n\n Constructively computes the difference of two FSTs.\n\n This operation computes the difference between two FSAs. Only strings that are\n in the first automaton but not in second are retained in the result. The first\n argument must be an acceptor; the second argument must be an unweighted,\n epsilon-free, deterministic acceptor. The output labels of the first\n transducer or the input labels of the second transducer must be sorted (or\n otherwise support appropriate matchers).\n\n Args:\n ifst1: The first input FST.\n ifst2: The second input FST.\n compose_filter: A string matching a known composition filter; one of:\n \"alt_sequence\", \"auto\", \"match\", \"no_match\", \"null\", \"sequence\",\n \"trivial\".\n connect: Should the output FST be trimmed?\n\n Returns:\n An FST representing the difference of the FSTs.\n "; +static PyObject *__pyx_pw_9pywrapfst_27difference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1 = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2 = 0; + PyObject *__pyx_v_compose_filter = 0; + bool __pyx_v_connect; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("difference (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst1,&__pyx_n_s_ifst2,&__pyx_n_s_compose_filter,&__pyx_n_s_connect,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = ((PyObject *)__pyx_n_b_auto); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("difference", 0, 2, 4, 1); __PYX_ERR(0, 3470, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compose_filter); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connect); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "difference") < 0)) __PYX_ERR(0, 3470, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst1 = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_ifst2 = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + __pyx_v_compose_filter = values[2]; + if (values[3]) { + __pyx_v_connect = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_connect == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3473, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3473 + * _Fst ifst2, + * compose_filter=b"auto", + * bool connect=True): # <<<<<<<<<<<<<< + * """ + * difference(ifst1, ifst2, compose_filter="auto", connect=True) + */ + __pyx_v_connect = ((bool)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("difference", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3470, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.difference", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst1), __pyx_ptype_9pywrapfst__Fst, 1, "ifst1", 0))) __PYX_ERR(0, 3470, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst2), __pyx_ptype_9pywrapfst__Fst, 1, "ifst2", 0))) __PYX_ERR(0, 3471, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_26difference(__pyx_self, __pyx_v_ifst1, __pyx_v_ifst2, __pyx_v_compose_filter, __pyx_v_connect); + + /* "pywrapfst.pyx":3470 + * + * + * cpdef _MutableFst difference(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_26difference(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_difference __pyx_t_2; + __Pyx_RefNannySetupContext("difference", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.compose_filter = __pyx_v_compose_filter; + __pyx_t_2.connect = __pyx_v_connect; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_difference(__pyx_v_ifst1, __pyx_v_ifst2, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.difference", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3506 + * + * + * cpdef _MutableFst disambiguate(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + +static PyObject *__pyx_pw_9pywrapfst_29disambiguate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_disambiguate(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_disambiguate *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__35; + __pyx_t_10basictypes_int64 __pyx_v_nstate = __pyx_k__36; + __pyx_t_10basictypes_int64 __pyx_v_subsequential_label = ((__pyx_t_10basictypes_int64)0); + + /* "pywrapfst.pyx":3510 + * int64 nstate=fst.kNoStateId, + * int64 subsequential_label=0, + * weight=None): # <<<<<<<<<<<<<< + * """ + * disambiguate(ifst, delta=0.0009765625, nstate=NO_STATE_ID, + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + std::unique_ptr __pyx_v_tfst; + fst::script::WeightClass __pyx_v_wc; + std::unique_ptr __pyx_v_opts; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("disambiguate", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_nstate = __pyx_optional_args->nstate; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_subsequential_label = __pyx_optional_args->subsequential_label; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_weight = __pyx_optional_args->weight; + } + } + } + } + } + + /* "pywrapfst.pyx":3537 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3537, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3539 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), # <<<<<<<<<<<<<< + * weight) + * cdef unique_ptr[fst.DisambiguateOptions] opts + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 3539, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3540 + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), + * weight) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.DisambiguateOptions] opts + * opts.reset(new fst.DisambiguateOptions(delta, wc, nstate, + */ + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_Zero(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->weight_type(__pyx_v_ifst, 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3539, __pyx_L1_error) + __pyx_v_wc = __pyx_t_1; + + /* "pywrapfst.pyx":3542 + * weight) + * cdef unique_ptr[fst.DisambiguateOptions] opts + * opts.reset(new fst.DisambiguateOptions(delta, wc, nstate, # <<<<<<<<<<<<<< + * subsequential_label)) + * fst.Disambiguate(deref(ifst._fst), tfst.get(), deref(opts)) + */ + __pyx_v_opts.reset(new fst::script::DisambiguateOptions(__pyx_v_delta, __pyx_v_wc, __pyx_v_nstate, __pyx_v_subsequential_label)); + + /* "pywrapfst.pyx":3544 + * opts.reset(new fst.DisambiguateOptions(delta, wc, nstate, + * subsequential_label)) + * fst.Disambiguate(deref(ifst._fst), tfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3544, __pyx_L1_error) + } + fst::script::Disambiguate((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":3545 + * subsequential_label)) + * fst.Disambiguate(deref(ifst._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3506 + * + * + * cpdef _MutableFst disambiguate(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst.disambiguate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_29disambiguate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_28disambiguate[] = "\n disambiguate(ifst, delta=0.0009765625, nstate=NO_STATE_ID,\n subsequential_label=0, weight=None):\n\n Constructively disambiguates a weighted transducer.\n\n This operation disambiguates a weighted transducer. The result will be an\n equivalent FST that has the property that no two successful paths have the\n same input labeling. For this algorithm, epsilon transitions are treated as\n regular symbols (cf. `rmepsilon`).\n\n Args:\n ifst: The input FST.\n delta: Comparison/quantization delta.\n nstate: State number threshold.\n subsequential_label: Input label of arc corresponding to residual final\n output when producing a subsequential transducer.\n weight: A Weight or weight string indicating the desired weight threshold\n below which paths are pruned; if omitted, no paths are pruned.\n\n Returns:\n An equivalent disambiguated FST.\n\n See also: `determinize`, `rmepsilon`.\n "; +static PyObject *__pyx_pw_9pywrapfst_29disambiguate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + float __pyx_v_delta; + __pyx_t_10basictypes_int64 __pyx_v_nstate; + __pyx_t_10basictypes_int64 __pyx_v_subsequential_label; + PyObject *__pyx_v_weight = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("disambiguate (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_delta,&__pyx_n_s_nstate,&__pyx_n_s_subsequential_label,&__pyx_n_s_weight,0}; + PyObject* values[5] = {0,0,0,0,0}; + + /* "pywrapfst.pyx":3510 + * int64 nstate=fst.kNoStateId, + * int64 subsequential_label=0, + * weight=None): # <<<<<<<<<<<<<< + * """ + * disambiguate(ifst, delta=0.0009765625, nstate=NO_STATE_ID, + */ + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nstate); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subsequential_label); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "disambiguate") < 0)) __PYX_ERR(0, 3506, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3507, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__35; + } + if (values[2]) { + __pyx_v_nstate = __Pyx_PyInt_As_int64_t(values[2]); if (unlikely((__pyx_v_nstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3508, __pyx_L3_error) + } else { + __pyx_v_nstate = __pyx_k__36; + } + if (values[3]) { + __pyx_v_subsequential_label = __Pyx_PyInt_As_int64_t(values[3]); if (unlikely((__pyx_v_subsequential_label == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3509, __pyx_L3_error) + } else { + __pyx_v_subsequential_label = ((__pyx_t_10basictypes_int64)0); + } + __pyx_v_weight = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("disambiguate", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3506, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.disambiguate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3506, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_28disambiguate(__pyx_self, __pyx_v_ifst, __pyx_v_delta, __pyx_v_nstate, __pyx_v_subsequential_label, __pyx_v_weight); + + /* "pywrapfst.pyx":3506 + * + * + * cpdef _MutableFst disambiguate(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_28disambiguate(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, __pyx_t_10basictypes_int64 __pyx_v_subsequential_label, PyObject *__pyx_v_weight) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_disambiguate __pyx_t_2; + __Pyx_RefNannySetupContext("disambiguate", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 4; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.nstate = __pyx_v_nstate; + __pyx_t_2.subsequential_label = __pyx_v_subsequential_label; + __pyx_t_2.weight = __pyx_v_weight; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_disambiguate(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.disambiguate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3548 + * + * + * cpdef _MutableFst epsnormalize(_Fst ifst, bool eps_norm_output=False): # <<<<<<<<<<<<<< + * """ + * epsnormalize(ifst, eps_norm_output=False) + */ + +static PyObject *__pyx_pw_9pywrapfst_31epsnormalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_epsnormalize(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_epsnormalize *__pyx_optional_args) { + bool __pyx_v_eps_norm_output = ((bool)0); + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + enum fst::EpsNormalizeType __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("epsnormalize", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_eps_norm_output = __pyx_optional_args->eps_norm_output; + } + } + + /* "pywrapfst.pyx":3571 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * fst.EpsNormalize(deref(ifst._fst), tfst.get(), fst.EPS_NORM_OUTPUT if + * eps_norm_output else + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3571, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3572 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.EpsNormalize(deref(ifst._fst), tfst.get(), fst.EPS_NORM_OUTPUT if # <<<<<<<<<<<<<< + * eps_norm_output else + * fst.EPS_NORM_INPUT) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3572, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3573 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.EpsNormalize(deref(ifst._fst), tfst.get(), fst.EPS_NORM_OUTPUT if + * eps_norm_output else # <<<<<<<<<<<<<< + * fst.EPS_NORM_INPUT) + * return _init_MutableFst(tfst.release()) + */ + if ((__pyx_v_eps_norm_output != 0)) { + + /* "pywrapfst.pyx":3572 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.EpsNormalize(deref(ifst._fst), tfst.get(), fst.EPS_NORM_OUTPUT if # <<<<<<<<<<<<<< + * eps_norm_output else + * fst.EPS_NORM_INPUT) + */ + __pyx_t_1 = fst::EPS_NORM_OUTPUT; + } else { + + /* "pywrapfst.pyx":3574 + * fst.EpsNormalize(deref(ifst._fst), tfst.get(), fst.EPS_NORM_OUTPUT if + * eps_norm_output else + * fst.EPS_NORM_INPUT) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + __pyx_t_1 = fst::EPS_NORM_INPUT; + } + + /* "pywrapfst.pyx":3572 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.EpsNormalize(deref(ifst._fst), tfst.get(), fst.EPS_NORM_OUTPUT if # <<<<<<<<<<<<<< + * eps_norm_output else + * fst.EPS_NORM_INPUT) + */ + fst::script::EpsNormalize((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), __pyx_t_1); + + /* "pywrapfst.pyx":3575 + * eps_norm_output else + * fst.EPS_NORM_INPUT) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3548 + * + * + * cpdef _MutableFst epsnormalize(_Fst ifst, bool eps_norm_output=False): # <<<<<<<<<<<<<< + * """ + * epsnormalize(ifst, eps_norm_output=False) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst.epsnormalize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_31epsnormalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_30epsnormalize[] = "\n epsnormalize(ifst, eps_norm_output=False)\n\n Constructively epsilon-normalizes an FST.\n\n This operation creates an equivalent FST that is epsilon-normalized. An\n acceptor is epsilon-normalized if it it is epsilon-removed (cf. `rmepsilon`).\n A transducer is input epsilon-normalized if, in addition, along any path, all\n arcs with epsilon input labels follow all arcs with non-epsilon input labels.\n Output epsilon-normalized is defined similarly. The input FST must be\n functional.\n\n Args:\n ifst: The input FST.\n eps_norm_output: Should the FST be output epsilon-normalized?\n\n Returns:\n An equivalent epsilon-normalized FST.\n\n See also: `rmepsilon`.\n "; +static PyObject *__pyx_pw_9pywrapfst_31epsnormalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + bool __pyx_v_eps_norm_output; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("epsnormalize (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_eps_norm_output,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps_norm_output); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "epsnormalize") < 0)) __PYX_ERR(0, 3548, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_eps_norm_output = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_eps_norm_output == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3548, __pyx_L3_error) + } else { + __pyx_v_eps_norm_output = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("epsnormalize", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3548, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.epsnormalize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3548, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_30epsnormalize(__pyx_self, __pyx_v_ifst, __pyx_v_eps_norm_output); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_30epsnormalize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, bool __pyx_v_eps_norm_output) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_epsnormalize __pyx_t_2; + __Pyx_RefNannySetupContext("epsnormalize", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.eps_norm_output = __pyx_v_eps_norm_output; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_epsnormalize(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.epsnormalize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3578 + * + * + * cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): # <<<<<<<<<<<<<< + * """ + * equal(ifst1, ifst2, delta=0.0009765625) + */ + +static PyObject *__pyx_pw_9pywrapfst_33equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static bool __pyx_f_9pywrapfst_equal(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_equal *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__37; + bool __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("equal", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + } + } + + /* "pywrapfst.pyx":3598 + * See also: `equivalent`, `isomorphic`, `randequivalent`. + * """ + * return fst.Equal(deref(ifst1._fst), deref(ifst2._fst), delta) # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3598, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3598, __pyx_L1_error) + } + __pyx_r = fst::script::Equal((*__pyx_v_ifst1->_fst), (*__pyx_v_ifst2->_fst), __pyx_v_delta); + goto __pyx_L0; + + /* "pywrapfst.pyx":3578 + * + * + * cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): # <<<<<<<<<<<<<< + * """ + * equal(ifst1, ifst2, delta=0.0009765625) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_WriteUnraisable("pywrapfst.equal", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_33equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_32equal[] = "\n equal(ifst1, ifst2, delta=0.0009765625)\n\n Are two FSTs equal?\n\n This function tests whether two FSTs have the same states with the same\n numbering and the same transitions with the same labels and weights in the\n same order.\n\n Args:\n ifst1: The first input FST.\n ifst2: The second input FST.\n delta: Comparison/quantization delta.\n\n Returns:\n True if the FSTs satisfy the above condition, else False.\n\n See also: `equivalent`, `isomorphic`, `randequivalent`.\n "; +static PyObject *__pyx_pw_9pywrapfst_33equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1 = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2 = 0; + float __pyx_v_delta; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("equal (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst1,&__pyx_n_s_ifst2,&__pyx_n_s_delta,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("equal", 0, 2, 3, 1); __PYX_ERR(0, 3578, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "equal") < 0)) __PYX_ERR(0, 3578, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst1 = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_ifst2 = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + if (values[2]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3578, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__37; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("equal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3578, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.equal", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst1), __pyx_ptype_9pywrapfst__Fst, 1, "ifst1", 0))) __PYX_ERR(0, 3578, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst2), __pyx_ptype_9pywrapfst__Fst, 1, "ifst2", 0))) __PYX_ERR(0, 3578, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_32equal(__pyx_self, __pyx_v_ifst1, __pyx_v_ifst2, __pyx_v_delta); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_32equal(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, float __pyx_v_delta) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + bool __pyx_t_1; + struct __pyx_opt_args_9pywrapfst_equal __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("equal", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_1 = __pyx_f_9pywrapfst_equal(__pyx_v_ifst1, __pyx_v_ifst2, 0, &__pyx_t_2); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.equal", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3601 + * + * + * cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta) except *: # <<<<<<<<<<<<<< + * """ + * equivalent(ifst1, ifst2, delta=0.0009765625) + */ + +static PyObject *__pyx_pw_9pywrapfst_35equivalent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static bool __pyx_f_9pywrapfst_equivalent(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_equivalent *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__38; + bool __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("equivalent", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + } + } + + /* "pywrapfst.pyx":3621 + * See also: `equal`, `isomorphic`, `randequivalent`. + * """ + * return fst.Equivalent(deref(ifst1._fst), deref(ifst2._fst), delta) # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3621, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3621, __pyx_L1_error) + } + __pyx_r = fst::script::Equivalent((*__pyx_v_ifst1->_fst), (*__pyx_v_ifst2->_fst), __pyx_v_delta); + goto __pyx_L0; + + /* "pywrapfst.pyx":3601 + * + * + * cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta) except *: # <<<<<<<<<<<<<< + * """ + * equivalent(ifst1, ifst2, delta=0.0009765625) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.equivalent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_35equivalent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_34equivalent[] = "\n equivalent(ifst1, ifst2, delta=0.0009765625)\n\n Are the two acceptors equivalent?\n\n This operation tests whether two epsilon-free deterministic weighted\n acceptors are equivalent, that is if they accept the same strings with the\n same weights.\n\n Args:\n ifst1: The first input FST.\n ifst2: The second input FST.\n delta: Comparison/quantization delta.\n\n Returns:\n True if the FSTs satisfy the above condition, else False.\n\n See also: `equal`, `isomorphic`, `randequivalent`.\n "; +static PyObject *__pyx_pw_9pywrapfst_35equivalent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1 = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2 = 0; + float __pyx_v_delta; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("equivalent (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst1,&__pyx_n_s_ifst2,&__pyx_n_s_delta,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("equivalent", 0, 2, 3, 1); __PYX_ERR(0, 3601, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "equivalent") < 0)) __PYX_ERR(0, 3601, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst1 = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_ifst2 = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + if (values[2]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3601, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__38; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("equivalent", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3601, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.equivalent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst1), __pyx_ptype_9pywrapfst__Fst, 1, "ifst1", 0))) __PYX_ERR(0, 3601, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst2), __pyx_ptype_9pywrapfst__Fst, 1, "ifst2", 0))) __PYX_ERR(0, 3601, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_34equivalent(__pyx_self, __pyx_v_ifst1, __pyx_v_ifst2, __pyx_v_delta); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_34equivalent(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, float __pyx_v_delta) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + bool __pyx_t_1; + struct __pyx_opt_args_9pywrapfst_equivalent __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("equivalent", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_1 = __pyx_f_9pywrapfst_equivalent(__pyx_v_ifst1, __pyx_v_ifst2, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((bool)-1) && PyErr_Occurred())) __PYX_ERR(0, 3601, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.equivalent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3624 + * + * + * cpdef _MutableFst intersect(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + +static PyObject *__pyx_pw_9pywrapfst_37intersect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_intersect(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_intersect *__pyx_optional_args) { + PyObject *__pyx_v_compose_filter = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":3627 + * _Fst ifst2, + * compose_filter=b"auto", + * bool connect=True): # <<<<<<<<<<<<<< + * """ + * intersect(ifst1, ifst2, compose_filter="auto", connect=True) + */ + bool __pyx_v_connect = ((bool)1); + std::unique_ptr __pyx_v_tfst; + std::unique_ptr __pyx_v_opts; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + enum fst::ComposeFilter __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("intersect", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_compose_filter = __pyx_optional_args->compose_filter; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_connect = __pyx_optional_args->connect; + } + } + } + + /* "pywrapfst.pyx":3650 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3650, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst1->__pyx_vtab)->arc_type(__pyx_v_ifst1, 0))); + + /* "pywrapfst.pyx":3653 + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, + * _get_compose_filter(tostring(compose_filter)))) # <<<<<<<<<<<<<< + * fst.Intersect(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_compose_filter); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3653, __pyx_L1_error) + __pyx_t_2 = __pyx_f_9pywrapfst__get_compose_filter(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3653, __pyx_L1_error) + + /* "pywrapfst.pyx":3652 + * tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) + * cdef unique_ptr[fst.ComposeOptions] opts + * opts.reset(new fst.ComposeOptions(connect, # <<<<<<<<<<<<<< + * _get_compose_filter(tostring(compose_filter)))) + * fst.Intersect(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + */ + __pyx_v_opts.reset(new fst::ComposeOptions(__pyx_v_connect, __pyx_t_2)); + + /* "pywrapfst.pyx":3654 + * opts.reset(new fst.ComposeOptions(connect, + * _get_compose_filter(tostring(compose_filter)))) + * fst.Intersect(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3654, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3654, __pyx_L1_error) + } + fst::script::Intersect((*__pyx_v_ifst1->_fst), (*__pyx_v_ifst2->_fst), __pyx_v_tfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":3655 + * _get_compose_filter(tostring(compose_filter)))) + * fst.Intersect(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3624 + * + * + * cpdef _MutableFst intersect(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_37intersect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_36intersect[] = "\n intersect(ifst1, ifst2, compose_filter=\"auto\", connect=True)\n\n Constructively intersects two FSTs.\n\n This operation computes the intersection (Hadamard product) of two FSTs.\n Only strings that are in both automata are retained in the result. The two\n arguments must be acceptors. One of the arguments must be label-sorted (or\n otherwise support appropriate matchers).\n\n Args:\n ifst1: The first input FST.\n ifst2: The second input FST.\n compose_filter: A string matching a known composition filter; one of:\n \"alt_sequence\", \"auto\", \"match\", \"no_match\", \"null\", \"sequence\",\n \"trivial\".\n connect: Should output be trimmed?\n\n Returns:\n An intersected FST.\n "; +static PyObject *__pyx_pw_9pywrapfst_37intersect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1 = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2 = 0; + PyObject *__pyx_v_compose_filter = 0; + bool __pyx_v_connect; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("intersect (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst1,&__pyx_n_s_ifst2,&__pyx_n_s_compose_filter,&__pyx_n_s_connect,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = ((PyObject *)__pyx_n_b_auto); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("intersect", 0, 2, 4, 1); __PYX_ERR(0, 3624, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compose_filter); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connect); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "intersect") < 0)) __PYX_ERR(0, 3624, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst1 = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_ifst2 = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + __pyx_v_compose_filter = values[2]; + if (values[3]) { + __pyx_v_connect = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_connect == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3627, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3627 + * _Fst ifst2, + * compose_filter=b"auto", + * bool connect=True): # <<<<<<<<<<<<<< + * """ + * intersect(ifst1, ifst2, compose_filter="auto", connect=True) + */ + __pyx_v_connect = ((bool)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("intersect", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3624, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst1), __pyx_ptype_9pywrapfst__Fst, 1, "ifst1", 0))) __PYX_ERR(0, 3624, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst2), __pyx_ptype_9pywrapfst__Fst, 1, "ifst2", 0))) __PYX_ERR(0, 3625, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_36intersect(__pyx_self, __pyx_v_ifst1, __pyx_v_ifst2, __pyx_v_compose_filter, __pyx_v_connect); + + /* "pywrapfst.pyx":3624 + * + * + * cpdef _MutableFst intersect(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * compose_filter=b"auto", + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_36intersect(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_intersect __pyx_t_2; + __Pyx_RefNannySetupContext("intersect", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.compose_filter = __pyx_v_compose_filter; + __pyx_t_2.connect = __pyx_v_connect; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_intersect(__pyx_v_ifst1, __pyx_v_ifst2, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3658 + * + * + * cpdef bool isomorphic(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): # <<<<<<<<<<<<<< + * """ + * isomorphic(ifst1, ifst2, delta=0.0009765625) + */ + +static PyObject *__pyx_pw_9pywrapfst_39isomorphic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static bool __pyx_f_9pywrapfst_isomorphic(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_isomorphic *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__39; + bool __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("isomorphic", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + } + } + + /* "pywrapfst.pyx":3681 + * See also: `equal`, `equivalent`, `randequivalent`. + * """ + * return fst.Isomorphic(deref(ifst1._fst), deref(ifst2._fst), delta) # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3681, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3681, __pyx_L1_error) + } + __pyx_r = fst::script::Isomorphic((*__pyx_v_ifst1->_fst), (*__pyx_v_ifst2->_fst), __pyx_v_delta); + goto __pyx_L0; + + /* "pywrapfst.pyx":3658 + * + * + * cpdef bool isomorphic(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): # <<<<<<<<<<<<<< + * """ + * isomorphic(ifst1, ifst2, delta=0.0009765625) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_WriteUnraisable("pywrapfst.isomorphic", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_39isomorphic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_38isomorphic[] = "\n isomorphic(ifst1, ifst2, delta=0.0009765625)\n\n Are the two acceptors isomorphic?\n\n This operation determines if two transducers with a certain required\n determinism have the same states, irrespective of numbering, and the same\n transitions with the same labels and weights, irrespective of ordering. In\n other words, FSTs A, B are isomorphic if and only if the states of A can be\n renumbered and the transitions leaving each state reordered so the two are\n equal (according to the definition given in `equal`).\n\n Args:\n ifst1: The first input FST.\n ifst2: The second input FST.\n delta: Comparison/quantization delta.\n\n Returns:\n True if the two transducers satisfy the above condition, else False.\n\n See also: `equal`, `equivalent`, `randequivalent`.\n "; +static PyObject *__pyx_pw_9pywrapfst_39isomorphic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1 = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2 = 0; + float __pyx_v_delta; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("isomorphic (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst1,&__pyx_n_s_ifst2,&__pyx_n_s_delta,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("isomorphic", 0, 2, 3, 1); __PYX_ERR(0, 3658, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isomorphic") < 0)) __PYX_ERR(0, 3658, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst1 = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_ifst2 = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + if (values[2]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3658, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__39; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("isomorphic", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3658, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.isomorphic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst1), __pyx_ptype_9pywrapfst__Fst, 1, "ifst1", 0))) __PYX_ERR(0, 3658, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst2), __pyx_ptype_9pywrapfst__Fst, 1, "ifst2", 0))) __PYX_ERR(0, 3658, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_38isomorphic(__pyx_self, __pyx_v_ifst1, __pyx_v_ifst2, __pyx_v_delta); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_38isomorphic(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, float __pyx_v_delta) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + bool __pyx_t_1; + struct __pyx_opt_args_9pywrapfst_isomorphic __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("isomorphic", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_1 = __pyx_f_9pywrapfst_isomorphic(__pyx_v_ifst1, __pyx_v_ifst2, 0, &__pyx_t_2); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.isomorphic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3684 + * + * + * cpdef _MutableFst prune(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + +static PyObject *__pyx_pw_9pywrapfst_41prune(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_prune(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_prune *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__40; + __pyx_t_10basictypes_int64 __pyx_v_nstate = __pyx_k__41; + + /* "pywrapfst.pyx":3687 + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + * weight=None): # <<<<<<<<<<<<<< + * """ + * prune(ifst, delta=0.0009765625, nstate=NO_STATE_ID, weight=None) + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + std::unique_ptr __pyx_v_tfst; + fst::script::WeightClass __pyx_v_wc; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("prune", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_nstate = __pyx_optional_args->nstate; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_weight = __pyx_optional_args->weight; + } + } + } + } + + /* "pywrapfst.pyx":3711 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) + * fst.Prune(deref(ifst._fst), tfst.get(), wc, nstate, delta) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3711, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3712 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) # <<<<<<<<<<<<<< + * fst.Prune(deref(ifst._fst), tfst.get(), wc, nstate, delta) + * return _init_MutableFst(tfst.release()) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 3712, __pyx_L1_error) + } + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_Zero(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->weight_type(__pyx_v_ifst, 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3712, __pyx_L1_error) + __pyx_v_wc = __pyx_t_1; + + /* "pywrapfst.pyx":3713 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) + * fst.Prune(deref(ifst._fst), tfst.get(), wc, nstate, delta) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3713, __pyx_L1_error) + } + fst::script::Prune((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), __pyx_v_wc, __pyx_v_nstate, __pyx_v_delta); + + /* "pywrapfst.pyx":3714 + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) + * fst.Prune(deref(ifst._fst), tfst.get(), wc, nstate, delta) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3714, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3684 + * + * + * cpdef _MutableFst prune(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_41prune(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_40prune[] = "\n prune(ifst, delta=0.0009765625, nstate=NO_STATE_ID, weight=None)\n\n Constructively removes paths with weights below a certain threshold.\n\n This operation deletes states and arcs in the input FST that do not belong\n to a successful path whose weight is no more (w.r.t the natural semiring\n order) than the threshold t \\otimes-times the weight of the shortest path in\n the input FST. Weights must be commutative and have the path property.\n\n Args:\n ifst: The input FST.\n delta: Comparison/quantization delta.\n nstate: State number threshold.\n weight: A Weight or weight string indicating the desired weight threshold\n below which paths are pruned; if omitted, no paths are pruned.\n\n Returns:\n A pruned FST.\n\n See also: The destructive variant.\n "; +static PyObject *__pyx_pw_9pywrapfst_41prune(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + float __pyx_v_delta; + __pyx_t_10basictypes_int64 __pyx_v_nstate; + PyObject *__pyx_v_weight = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("prune (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_delta,&__pyx_n_s_nstate,&__pyx_n_s_weight,0}; + PyObject* values[4] = {0,0,0,0}; + + /* "pywrapfst.pyx":3687 + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + * weight=None): # <<<<<<<<<<<<<< + * """ + * prune(ifst, delta=0.0009765625, nstate=NO_STATE_ID, weight=None) + */ + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nstate); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prune") < 0)) __PYX_ERR(0, 3684, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3685, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__40; + } + if (values[2]) { + __pyx_v_nstate = __Pyx_PyInt_As_int64_t(values[2]); if (unlikely((__pyx_v_nstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3686, __pyx_L3_error) + } else { + __pyx_v_nstate = __pyx_k__41; + } + __pyx_v_weight = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("prune", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3684, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3684, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_40prune(__pyx_self, __pyx_v_ifst, __pyx_v_delta, __pyx_v_nstate, __pyx_v_weight); + + /* "pywrapfst.pyx":3684 + * + * + * cpdef _MutableFst prune(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_40prune(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_weight) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_prune __pyx_t_2; + __Pyx_RefNannySetupContext("prune", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 3; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.nstate = __pyx_v_nstate; + __pyx_t_2.weight = __pyx_v_weight; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_prune(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3717 + * + * + * cpdef _MutableFst push(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool push_weights=False, + */ + +static PyObject *__pyx_pw_9pywrapfst_43push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_push(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_push *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__42; + + /* "pywrapfst.pyx":3719 + * cpdef _MutableFst push(_Fst ifst, + * float delta=fst.kDelta, + * bool push_weights=False, # <<<<<<<<<<<<<< + * bool push_labels=False, + * bool remove_common_affix=False, + */ + bool __pyx_v_push_weights = ((bool)0); + + /* "pywrapfst.pyx":3720 + * float delta=fst.kDelta, + * bool push_weights=False, + * bool push_labels=False, # <<<<<<<<<<<<<< + * bool remove_common_affix=False, + * bool remove_total_weight=False, + */ + bool __pyx_v_push_labels = ((bool)0); + + /* "pywrapfst.pyx":3721 + * bool push_weights=False, + * bool push_labels=False, + * bool remove_common_affix=False, # <<<<<<<<<<<<<< + * bool remove_total_weight=False, + * bool to_final=False): + */ + bool __pyx_v_remove_common_affix = ((bool)0); + + /* "pywrapfst.pyx":3722 + * bool push_labels=False, + * bool remove_common_affix=False, + * bool remove_total_weight=False, # <<<<<<<<<<<<<< + * bool to_final=False): + * """ + */ + bool __pyx_v_remove_total_weight = ((bool)0); + + /* "pywrapfst.pyx":3723 + * bool remove_common_affix=False, + * bool remove_total_weight=False, + * bool to_final=False): # <<<<<<<<<<<<<< + * """ + * push(ifst, delta=0.0009765625, push_weights=False, push_labels=False, + */ + bool __pyx_v_to_final = ((bool)0); + std::unique_ptr __pyx_v_tfst; + __pyx_t_10basictypes_uint32 __pyx_v_flags; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("push", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_push_weights = __pyx_optional_args->push_weights; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_push_labels = __pyx_optional_args->push_labels; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_remove_common_affix = __pyx_optional_args->remove_common_affix; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_remove_total_weight = __pyx_optional_args->remove_total_weight; + if (__pyx_optional_args->__pyx_n > 5) { + __pyx_v_to_final = __pyx_optional_args->to_final; + } + } + } + } + } + } + } + + /* "pywrapfst.pyx":3763 + * # This is copied, almost verbatim, from nlp/fst/bin/fstpush.cc. + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * cdef uint32 flags = fst.GetPushFlags(push_weights, push_labels, + * remove_common_affix, remove_total_weight) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3763, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3764 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * cdef uint32 flags = fst.GetPushFlags(push_weights, push_labels, # <<<<<<<<<<<<<< + * remove_common_affix, remove_total_weight) + * fst.Push(deref(ifst._fst), tfst.get(), flags, fst.GetReweightType(to_final), + */ + __pyx_v_flags = fst::script::GetPushFlags(__pyx_v_push_weights, __pyx_v_push_labels, __pyx_v_remove_common_affix, __pyx_v_remove_total_weight); + + /* "pywrapfst.pyx":3766 + * cdef uint32 flags = fst.GetPushFlags(push_weights, push_labels, + * remove_common_affix, remove_total_weight) + * fst.Push(deref(ifst._fst), tfst.get(), flags, fst.GetReweightType(to_final), # <<<<<<<<<<<<<< + * delta) + * return _init_MutableFst(tfst.release()) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3766, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3767 + * remove_common_affix, remove_total_weight) + * fst.Push(deref(ifst._fst), tfst.get(), flags, fst.GetReweightType(to_final), + * delta) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + fst::script::Push((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), __pyx_v_flags, fst::script::GetReweightType(__pyx_v_to_final), __pyx_v_delta); + + /* "pywrapfst.pyx":3768 + * fst.Push(deref(ifst._fst), tfst.get(), flags, fst.GetReweightType(to_final), + * delta) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3717 + * + * + * cpdef _MutableFst push(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool push_weights=False, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.push", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_43push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_42push[] = "\n push(ifst, delta=0.0009765625, push_weights=False, push_labels=False,\n remove_common_affix=False, remove_total_weight=False, to_final=False)\n\n Constructively pushes weights/labels towards initial or final states.\n\n This operation produces an equivalent transducer by pushing the weights\n and/or the labels towards the initial state or toward the final states.\n\n When pushing weights towards the initial state, the sum of the weight of the\n outgoing transitions and final weight at any non-initial state is equal to 1\n in the resulting machine. When pushing weights towards the final states, the\n sum of the weight of the incoming transitions at any state is equal to 1.\n Weights need to be left distributive when pushing towards the initial state\n and right distributive when pushing towards the final states.\n\n Pushing labels towards the initial state consists in minimizing at every\n state the length of the longest common prefix of the output labels of the\n outgoing paths. Pushing labels towards the final states consists in\n minimizing at every state the length of the longest common suffix of the\n output labels of the incoming paths.\n\n Args:\n ifst: The input FST.\n delta: Comparison/quantization delta.\n push_weights: Should weights be pushed?\n push_labels: Should labels be pushed?\n remove_common_affix: If pushing labels, should common prefix/suffix be\n removed?\n remove_total_weight: If pushing weights, should total weight be removed?\n to_final: Push towards final states?\n\n Returns:\n An equivalent pushed FST.\n\n See also: The destructive variant.\n "; +static PyObject *__pyx_pw_9pywrapfst_43push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + float __pyx_v_delta; + bool __pyx_v_push_weights; + bool __pyx_v_push_labels; + bool __pyx_v_remove_common_affix; + bool __pyx_v_remove_total_weight; + bool __pyx_v_to_final; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("push (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_delta,&__pyx_n_s_push_weights,&__pyx_n_s_push_labels,&__pyx_n_s_remove_common_affix,&__pyx_n_s_remove_total_weight,&__pyx_n_s_to_final,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_push_weights); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_push_labels); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_remove_common_affix); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_remove_total_weight); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_to_final); + if (value) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) __PYX_ERR(0, 3717, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3718, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__42; + } + if (values[2]) { + __pyx_v_push_weights = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_push_weights == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3719, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3719 + * cpdef _MutableFst push(_Fst ifst, + * float delta=fst.kDelta, + * bool push_weights=False, # <<<<<<<<<<<<<< + * bool push_labels=False, + * bool remove_common_affix=False, + */ + __pyx_v_push_weights = ((bool)0); + } + if (values[3]) { + __pyx_v_push_labels = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_push_labels == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3720, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3720 + * float delta=fst.kDelta, + * bool push_weights=False, + * bool push_labels=False, # <<<<<<<<<<<<<< + * bool remove_common_affix=False, + * bool remove_total_weight=False, + */ + __pyx_v_push_labels = ((bool)0); + } + if (values[4]) { + __pyx_v_remove_common_affix = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_remove_common_affix == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3721, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3721 + * bool push_weights=False, + * bool push_labels=False, + * bool remove_common_affix=False, # <<<<<<<<<<<<<< + * bool remove_total_weight=False, + * bool to_final=False): + */ + __pyx_v_remove_common_affix = ((bool)0); + } + if (values[5]) { + __pyx_v_remove_total_weight = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_remove_total_weight == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3722, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3722 + * bool push_labels=False, + * bool remove_common_affix=False, + * bool remove_total_weight=False, # <<<<<<<<<<<<<< + * bool to_final=False): + * """ + */ + __pyx_v_remove_total_weight = ((bool)0); + } + if (values[6]) { + __pyx_v_to_final = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_to_final == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3723, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3723 + * bool remove_common_affix=False, + * bool remove_total_weight=False, + * bool to_final=False): # <<<<<<<<<<<<<< + * """ + * push(ifst, delta=0.0009765625, push_weights=False, push_labels=False, + */ + __pyx_v_to_final = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("push", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3717, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.push", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3717, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_42push(__pyx_self, __pyx_v_ifst, __pyx_v_delta, __pyx_v_push_weights, __pyx_v_push_labels, __pyx_v_remove_common_affix, __pyx_v_remove_total_weight, __pyx_v_to_final); + + /* "pywrapfst.pyx":3717 + * + * + * cpdef _MutableFst push(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool push_weights=False, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_42push(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, bool __pyx_v_push_weights, bool __pyx_v_push_labels, bool __pyx_v_remove_common_affix, bool __pyx_v_remove_total_weight, bool __pyx_v_to_final) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_push __pyx_t_2; + __Pyx_RefNannySetupContext("push", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 6; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.push_weights = __pyx_v_push_weights; + __pyx_t_2.push_labels = __pyx_v_push_labels; + __pyx_t_2.remove_common_affix = __pyx_v_remove_common_affix; + __pyx_t_2.remove_total_weight = __pyx_v_remove_total_weight; + __pyx_t_2.to_final = __pyx_v_to_final; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_push(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.push", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3771 + * + * + * cpdef bool randequivalent(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * int32 npath=1, + */ + +static PyObject *__pyx_pw_9pywrapfst_45randequivalent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static bool __pyx_f_9pywrapfst_randequivalent(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_randequivalent *__pyx_optional_args) { + __pyx_t_10basictypes_int32 __pyx_v_npath = ((__pyx_t_10basictypes_int32)1); + float __pyx_v_delta = __pyx_k__43; + time_t __pyx_v_seed = ((time_t)0); + PyObject *__pyx_v_select = ((PyObject *)__pyx_n_b_uniform); + __pyx_t_10basictypes_int32 __pyx_v_max_length = __pyx_k__44; + enum fst::script::RandArcSelection __pyx_v_ras; + std::unique_ptr > __pyx_v_opts; + bool __pyx_r; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + enum fst::script::RandArcSelection __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("randequivalent", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_npath = __pyx_optional_args->npath; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_seed = __pyx_optional_args->seed; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_select = __pyx_optional_args->select; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_max_length = __pyx_optional_args->max_length; + } + } + } + } + } + } + + /* "pywrapfst.pyx":3806 + * See also: `equal`, `equivalent`, `isomorphic`, `randgen`. + * """ + * cdef fst.RandArcSelection ras = _get_rand_arc_selection(tostring(select)) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.RandGenOptions[fst.RandArcSelection]] opts + * # The three trailing options will be ignored by RandEquivalent. + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_select); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3806, __pyx_L1_error) + __pyx_t_2 = __pyx_f_9pywrapfst__get_rand_arc_selection(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3806, __pyx_L1_error) + __pyx_v_ras = __pyx_t_2; + + /* "pywrapfst.pyx":3809 + * cdef unique_ptr[fst.RandGenOptions[fst.RandArcSelection]] opts + * # The three trailing options will be ignored by RandEquivalent. + * opts.reset(new fst.RandGenOptions[fst.RandArcSelection](ras, max_length, # <<<<<<<<<<<<<< + * 1, False, False)) + * if seed == 0: + */ + __pyx_v_opts.reset(new fst::RandGenOptions (__pyx_v_ras, __pyx_v_max_length, 1, 0, 0)); + + /* "pywrapfst.pyx":3811 + * opts.reset(new fst.RandGenOptions[fst.RandArcSelection](ras, max_length, + * 1, False, False)) + * if seed == 0: # <<<<<<<<<<<<<< + * seed = time(NULL) + getpid() + * return fst.RandEquivalent(deref(ifst1._fst), deref(ifst2._fst), npath, delta, + */ + __pyx_t_3 = ((__pyx_v_seed == 0) != 0); + if (__pyx_t_3) { + + /* "pywrapfst.pyx":3812 + * 1, False, False)) + * if seed == 0: + * seed = time(NULL) + getpid() # <<<<<<<<<<<<<< + * return fst.RandEquivalent(deref(ifst1._fst), deref(ifst2._fst), npath, delta, + * seed, deref(opts)) + */ + __pyx_v_seed = (time(NULL) + getpid()); + + /* "pywrapfst.pyx":3811 + * opts.reset(new fst.RandGenOptions[fst.RandArcSelection](ras, max_length, + * 1, False, False)) + * if seed == 0: # <<<<<<<<<<<<<< + * seed = time(NULL) + getpid() + * return fst.RandEquivalent(deref(ifst1._fst), deref(ifst2._fst), npath, delta, + */ + } + + /* "pywrapfst.pyx":3813 + * if seed == 0: + * seed = time(NULL) + getpid() + * return fst.RandEquivalent(deref(ifst1._fst), deref(ifst2._fst), npath, delta, # <<<<<<<<<<<<<< + * seed, deref(opts)) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst1) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3813, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_ifst2) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3813, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3814 + * seed = time(NULL) + getpid() + * return fst.RandEquivalent(deref(ifst1._fst), deref(ifst2._fst), npath, delta, + * seed, deref(opts)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = fst::script::RandEquivalent((*__pyx_v_ifst1->_fst), (*__pyx_v_ifst2->_fst), __pyx_v_npath, __pyx_v_delta, __pyx_v_seed, (*__pyx_v_opts)); + goto __pyx_L0; + + /* "pywrapfst.pyx":3771 + * + * + * cpdef bool randequivalent(_Fst ifst1, # <<<<<<<<<<<<<< + * _Fst ifst2, + * int32 npath=1, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.randequivalent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_45randequivalent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_44randequivalent[] = "\n randequivalent(ifst1, ifst2, npath=1, delta=0.0009765625, seed=0,\n select=\"uniform\", max_length=2147483647)\n\n Are two acceptors stochastically equivalent?\n\n This operation tests whether two FSTs are equivalent by randomly generating\n paths alternatively in each of the two FSTs. For each randomly generated path,\n the algorithm computes for each of the two FSTs the sum of the weights of all\n the successful paths sharing the same input and output labels as the randomly\n generated path and checks that these two values are within `delta`.\n\n Args:\n ifst1: The first input FST.\n ifst2: The second input FST.\n npath: The number of random paths to generate.\n delta: Comparison/quantization delta.\n seed: An optional seed value for random path generation; if zero, the\n current time and process ID is used.\n select: A string matching a known random arc selection type; one of:\n \"uniform\", \"log_prob\", \"fast_log_prob\".\n max_length: The maximum length of each random path.\n\n Returns:\n True if the two transducers satisfy the above condition, else False.\n\n See also: `equal`, `equivalent`, `isomorphic`, `randgen`.\n "; +static PyObject *__pyx_pw_9pywrapfst_45randequivalent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1 = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2 = 0; + __pyx_t_10basictypes_int32 __pyx_v_npath; + float __pyx_v_delta; + time_t __pyx_v_seed; + PyObject *__pyx_v_select = 0; + __pyx_t_10basictypes_int32 __pyx_v_max_length; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("randequivalent (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst1,&__pyx_n_s_ifst2,&__pyx_n_s_npath,&__pyx_n_s_delta,&__pyx_n_s_seed,&__pyx_n_s_select,&__pyx_n_s_max_length,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[5] = ((PyObject *)__pyx_n_b_uniform); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("randequivalent", 0, 2, 7, 1); __PYX_ERR(0, 3771, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_npath); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_select); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_length); + if (value) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randequivalent") < 0)) __PYX_ERR(0, 3771, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst1 = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_ifst2 = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + if (values[2]) { + __pyx_v_npath = __Pyx_PyInt_As_int32_t(values[2]); if (unlikely((__pyx_v_npath == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3773, __pyx_L3_error) + } else { + __pyx_v_npath = ((__pyx_t_10basictypes_int32)1); + } + if (values[3]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3774, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__43; + } + if (values[4]) { + __pyx_v_seed = __Pyx_PyInt_As_time_t(values[4]); if (unlikely((__pyx_v_seed == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3775, __pyx_L3_error) + } else { + __pyx_v_seed = ((time_t)0); + } + __pyx_v_select = values[5]; + if (values[6]) { + __pyx_v_max_length = __Pyx_PyInt_As_int32_t(values[6]); if (unlikely((__pyx_v_max_length == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3777, __pyx_L3_error) + } else { + __pyx_v_max_length = __pyx_k__44; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("randequivalent", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3771, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.randequivalent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst1), __pyx_ptype_9pywrapfst__Fst, 1, "ifst1", 0))) __PYX_ERR(0, 3771, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst2), __pyx_ptype_9pywrapfst__Fst, 1, "ifst2", 0))) __PYX_ERR(0, 3772, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_44randequivalent(__pyx_self, __pyx_v_ifst1, __pyx_v_ifst2, __pyx_v_npath, __pyx_v_delta, __pyx_v_seed, __pyx_v_select, __pyx_v_max_length); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_44randequivalent(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst1, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst2, __pyx_t_10basictypes_int32 __pyx_v_npath, float __pyx_v_delta, time_t __pyx_v_seed, PyObject *__pyx_v_select, __pyx_t_10basictypes_int32 __pyx_v_max_length) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + bool __pyx_t_1; + struct __pyx_opt_args_9pywrapfst_randequivalent __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("randequivalent", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 5; + __pyx_t_2.npath = __pyx_v_npath; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.seed = __pyx_v_seed; + __pyx_t_2.select = __pyx_v_select; + __pyx_t_2.max_length = __pyx_v_max_length; + __pyx_t_1 = __pyx_f_9pywrapfst_randequivalent(__pyx_v_ifst1, __pyx_v_ifst2, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((bool)-1) && PyErr_Occurred())) __PYX_ERR(0, 3771, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.randequivalent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3817 + * + * + * cpdef _MutableFst randgen(_Fst ifst, # <<<<<<<<<<<<<< + * int32 npath=1, + * time_t seed=0, + */ + +static PyObject *__pyx_pw_9pywrapfst_47randgen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_randgen(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_randgen *__pyx_optional_args) { + __pyx_t_10basictypes_int32 __pyx_v_npath = ((__pyx_t_10basictypes_int32)1); + time_t __pyx_v_seed = ((time_t)0); + PyObject *__pyx_v_select = ((PyObject *)__pyx_n_b_uniform); + __pyx_t_10basictypes_int32 __pyx_v_max_length = __pyx_k__45; + + /* "pywrapfst.pyx":3822 + * select=b"uniform", + * int32 max_length=INT32_MAX, + * bool weighted=False, # <<<<<<<<<<<<<< + * bool remove_total_weight=False): + * """ + */ + bool __pyx_v_weighted = ((bool)0); + + /* "pywrapfst.pyx":3823 + * int32 max_length=INT32_MAX, + * bool weighted=False, + * bool remove_total_weight=False): # <<<<<<<<<<<<<< + * """ + * randgen(ifst, npath=1, seed=0, select="uniform", max_length=2147483647, + */ + bool __pyx_v_remove_total_weight = ((bool)0); + enum fst::script::RandArcSelection __pyx_v_ras; + std::unique_ptr > __pyx_v_opts; + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + enum fst::script::RandArcSelection __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("randgen", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_npath = __pyx_optional_args->npath; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_seed = __pyx_optional_args->seed; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_select = __pyx_optional_args->select; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_max_length = __pyx_optional_args->max_length; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_weighted = __pyx_optional_args->weighted; + if (__pyx_optional_args->__pyx_n > 5) { + __pyx_v_remove_total_weight = __pyx_optional_args->remove_total_weight; + } + } + } + } + } + } + } + + /* "pywrapfst.pyx":3855 + * See also: `randequivalent`. + * """ + * cdef fst.RandArcSelection ras = _get_rand_arc_selection(tostring(select)) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.RandGenOptions[fst.RandArcSelection]] opts + * opts.reset(new fst.RandGenOptions[fst.RandArcSelection](ras, max_length, + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_select); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3855, __pyx_L1_error) + __pyx_t_2 = __pyx_f_9pywrapfst__get_rand_arc_selection(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3855, __pyx_L1_error) + __pyx_v_ras = __pyx_t_2; + + /* "pywrapfst.pyx":3857 + * cdef fst.RandArcSelection ras = _get_rand_arc_selection(tostring(select)) + * cdef unique_ptr[fst.RandGenOptions[fst.RandArcSelection]] opts + * opts.reset(new fst.RandGenOptions[fst.RandArcSelection](ras, max_length, # <<<<<<<<<<<<<< + * npath, weighted, + * remove_total_weight)) + */ + __pyx_v_opts.reset(new fst::RandGenOptions (__pyx_v_ras, __pyx_v_max_length, __pyx_v_npath, __pyx_v_weighted, __pyx_v_remove_total_weight)); + + /* "pywrapfst.pyx":3861 + * remove_total_weight)) + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * if seed == 0: + * seed = time(NULL) + getpid() + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3861, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3862 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * if seed == 0: # <<<<<<<<<<<<<< + * seed = time(NULL) + getpid() + * fst.RandGen(deref(ifst._fst), tfst.get(), seed, deref(opts)) + */ + __pyx_t_3 = ((__pyx_v_seed == 0) != 0); + if (__pyx_t_3) { + + /* "pywrapfst.pyx":3863 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * if seed == 0: + * seed = time(NULL) + getpid() # <<<<<<<<<<<<<< + * fst.RandGen(deref(ifst._fst), tfst.get(), seed, deref(opts)) + * return _init_MutableFst(tfst.release()) + */ + __pyx_v_seed = (time(NULL) + getpid()); + + /* "pywrapfst.pyx":3862 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * if seed == 0: # <<<<<<<<<<<<<< + * seed = time(NULL) + getpid() + * fst.RandGen(deref(ifst._fst), tfst.get(), seed, deref(opts)) + */ + } + + /* "pywrapfst.pyx":3864 + * if seed == 0: + * seed = time(NULL) + getpid() + * fst.RandGen(deref(ifst._fst), tfst.get(), seed, deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3864, __pyx_L1_error) + } + fst::script::RandGen((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), __pyx_v_seed, (*__pyx_v_opts)); + + /* "pywrapfst.pyx":3865 + * seed = time(NULL) + getpid() + * fst.RandGen(deref(ifst._fst), tfst.get(), seed, deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_4 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3817 + * + * + * cpdef _MutableFst randgen(_Fst ifst, # <<<<<<<<<<<<<< + * int32 npath=1, + * time_t seed=0, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.randgen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_47randgen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_46randgen[] = "\n randgen(ifst, npath=1, seed=0, select=\"uniform\", max_length=2147483647,\n weighted=False, remove_total_weight=False)\n\n Randomly generate successful paths in an FST.\n\n This operation randomly generates a set of successful paths in the input FST.\n This relies on a mechanism for selecting arcs, specified using the `select`\n argument. The default selector, \"uniform\", randomly selects a transition\n using a uniform distribution. The \"log_prob\" selector randomly selects a\n transition w.r.t. the weights treated as negative log probabilities after\n normalizing for the total weight leaving the state. In all cases, finality is\n treated as a transition to a super-final state.\n\n Args:\n ifst: The input FST.\n npath: The number of random paths to generate.\n seed: An optional seed value for random path generation; if zero, the\n current time and process ID is used.\n select: A string matching a known random arc selection type; one of:\n \"uniform\", \"log_prob\", \"fast_log_prob\".\n max_length: The maximum length of each random path.\n weighted: Should the output be weighted by path count?\n remove_total_weight: Should the total weight be removed (ignored when\n `weighted` is False)?\n\n Returns:\n An FST containing one or more random paths.\n\n See also: `randequivalent`.\n "; +static PyObject *__pyx_pw_9pywrapfst_47randgen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + __pyx_t_10basictypes_int32 __pyx_v_npath; + time_t __pyx_v_seed; + PyObject *__pyx_v_select = 0; + __pyx_t_10basictypes_int32 __pyx_v_max_length; + bool __pyx_v_weighted; + bool __pyx_v_remove_total_weight; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("randgen (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_npath,&__pyx_n_s_seed,&__pyx_n_s_select,&__pyx_n_s_max_length,&__pyx_n_s_weighted,&__pyx_n_s_remove_total_weight,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[3] = ((PyObject *)__pyx_n_b_uniform); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_npath); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_select); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_length); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weighted); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_remove_total_weight); + if (value) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randgen") < 0)) __PYX_ERR(0, 3817, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_npath = __Pyx_PyInt_As_int32_t(values[1]); if (unlikely((__pyx_v_npath == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3818, __pyx_L3_error) + } else { + __pyx_v_npath = ((__pyx_t_10basictypes_int32)1); + } + if (values[2]) { + __pyx_v_seed = __Pyx_PyInt_As_time_t(values[2]); if (unlikely((__pyx_v_seed == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3819, __pyx_L3_error) + } else { + __pyx_v_seed = ((time_t)0); + } + __pyx_v_select = values[3]; + if (values[4]) { + __pyx_v_max_length = __Pyx_PyInt_As_int32_t(values[4]); if (unlikely((__pyx_v_max_length == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3821, __pyx_L3_error) + } else { + __pyx_v_max_length = __pyx_k__45; + } + if (values[5]) { + __pyx_v_weighted = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_weighted == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3822, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3822 + * select=b"uniform", + * int32 max_length=INT32_MAX, + * bool weighted=False, # <<<<<<<<<<<<<< + * bool remove_total_weight=False): + * """ + */ + __pyx_v_weighted = ((bool)0); + } + if (values[6]) { + __pyx_v_remove_total_weight = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_remove_total_weight == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3823, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3823 + * int32 max_length=INT32_MAX, + * bool weighted=False, + * bool remove_total_weight=False): # <<<<<<<<<<<<<< + * """ + * randgen(ifst, npath=1, seed=0, select="uniform", max_length=2147483647, + */ + __pyx_v_remove_total_weight = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("randgen", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3817, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.randgen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3817, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_46randgen(__pyx_self, __pyx_v_ifst, __pyx_v_npath, __pyx_v_seed, __pyx_v_select, __pyx_v_max_length, __pyx_v_weighted, __pyx_v_remove_total_weight); + + /* "pywrapfst.pyx":3817 + * + * + * cpdef _MutableFst randgen(_Fst ifst, # <<<<<<<<<<<<<< + * int32 npath=1, + * time_t seed=0, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_46randgen(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, __pyx_t_10basictypes_int32 __pyx_v_npath, time_t __pyx_v_seed, PyObject *__pyx_v_select, __pyx_t_10basictypes_int32 __pyx_v_max_length, bool __pyx_v_weighted, bool __pyx_v_remove_total_weight) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_randgen __pyx_t_2; + __Pyx_RefNannySetupContext("randgen", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 6; + __pyx_t_2.npath = __pyx_v_npath; + __pyx_t_2.seed = __pyx_v_seed; + __pyx_t_2.select = __pyx_v_select; + __pyx_t_2.max_length = __pyx_v_max_length; + __pyx_t_2.remove_total_weight = __pyx_v_weighted; + __pyx_t_2.weighted = __pyx_v_remove_total_weight; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_randgen(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3817, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.randgen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3868 + * + * + * cpdef _MutableFst replace(pairs, # <<<<<<<<<<<<<< + * call_arc_labeling=b"input", + * return_arc_labeling=b"neither", + */ + +static PyObject *__pyx_pw_9pywrapfst_49replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_replace(PyObject *__pyx_v_pairs, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_replace *__pyx_optional_args) { + PyObject *__pyx_v_call_arc_labeling = ((PyObject *)__pyx_n_b_input); + PyObject *__pyx_v_return_arc_labeling = ((PyObject *)__pyx_n_b_neither); + + /* "pywrapfst.pyx":3871 + * call_arc_labeling=b"input", + * return_arc_labeling=b"neither", + * bool epsilon_on_replace=False, # <<<<<<<<<<<<<< + * int64 return_label=0): + * """ + */ + bool __pyx_v_epsilon_on_replace = ((bool)0); + __pyx_t_10basictypes_int64 __pyx_v_return_label = ((__pyx_t_10basictypes_int64)0); + std::vector<__pyx_t_3fst_LabelFstClassPair> __pyx_v__pairs; + __pyx_t_10basictypes_int64 __pyx_v_root_label; + __pyx_t_10basictypes_int64 __pyx_v_label; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + PyObject *__pyx_v_it = NULL; + std::unique_ptr __pyx_v_tfst; + enum fst::ReplaceLabelType __pyx_v_cal; + enum fst::ReplaceLabelType __pyx_v_ral; + std::unique_ptr __pyx_v_opts; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *(*__pyx_t_5)(PyObject *); + __pyx_t_10basictypes_int64 __pyx_t_6; + __pyx_t_3fst_LabelFstClassPair __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + std::string __pyx_t_11; + enum fst::ReplaceLabelType __pyx_t_12; + __Pyx_RefNannySetupContext("replace", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_call_arc_labeling = __pyx_optional_args->call_arc_labeling; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_return_arc_labeling = __pyx_optional_args->return_arc_labeling; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_epsilon_on_replace = __pyx_optional_args->epsilon_on_replace; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_return_label = __pyx_optional_args->return_label; + } + } + } + } + } + + /* "pywrapfst.pyx":3913 + * cdef int64 label + * cdef _Fst ifst + * it = iter(pairs) # <<<<<<<<<<<<<< + * (root_label, ifst) = next(it) + * _pairs.push_back(fst.LabelFstClassPair(root_label, ifst._fst.get())) + */ + __pyx_t_1 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_it = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":3914 + * cdef _Fst ifst + * it = iter(pairs) + * (root_label, ifst) = next(it) # <<<<<<<<<<<<<< + * _pairs.push_back(fst.LabelFstClassPair(root_label, ifst._fst.get())) + * cdef unique_ptr[fst.VectorFstClass] tfst + */ + __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_it); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 3914, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; + index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3914, __pyx_L1_error) + __pyx_t_5 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 3914, __pyx_L1_error) + __pyx_L4_unpacking_done:; + } + __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3914, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9pywrapfst__Fst))))) __PYX_ERR(0, 3914, __pyx_L1_error) + __pyx_v_root_label = __pyx_t_6; + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "pywrapfst.pyx":3915 + * it = iter(pairs) + * (root_label, ifst) = next(it) + * _pairs.push_back(fst.LabelFstClassPair(root_label, ifst._fst.get())) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3915, __pyx_L1_error) + } + try { + __pyx_t_7 = __pyx_t_3fst_LabelFstClassPair(__pyx_v_root_label, __pyx_v_ifst->_fst.get()); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 3915, __pyx_L1_error) + } + try { + __pyx_v__pairs.push_back(__pyx_t_7); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 3915, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3917 + * _pairs.push_back(fst.LabelFstClassPair(root_label, ifst._fst.get())) + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * for (label, ifst) in it: + * _pairs.push_back(fst.LabelFstClassPair(label, ifst._fst.get())) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3917, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3918 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * for (label, ifst) in it: # <<<<<<<<<<<<<< + * _pairs.push_back(fst.LabelFstClassPair(label, ifst._fst.get())) + * cdef fst.ReplaceLabelType cal = _get_replace_label_type( + */ + if (likely(PyList_CheckExact(__pyx_v_it)) || PyTuple_CheckExact(__pyx_v_it)) { + __pyx_t_1 = __pyx_v_it; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_it); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3918, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 3918, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 3918, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 3918, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 3918, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_4 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 2) < 0) __PYX_ERR(0, 3918, __pyx_L1_error) + __pyx_t_5 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 3918, __pyx_L1_error) + __pyx_L8_unpacking_done:; + } + __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3918, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_9pywrapfst__Fst))))) __PYX_ERR(0, 3918, __pyx_L1_error) + __pyx_v_label = __pyx_t_6; + __Pyx_DECREF_SET(__pyx_v_ifst, ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "pywrapfst.pyx":3919 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * for (label, ifst) in it: + * _pairs.push_back(fst.LabelFstClassPair(label, ifst._fst.get())) # <<<<<<<<<<<<<< + * cdef fst.ReplaceLabelType cal = _get_replace_label_type( + * tostring(call_arc_labeling), epsilon_on_replace) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3919, __pyx_L1_error) + } + try { + __pyx_t_7 = __pyx_t_3fst_LabelFstClassPair(__pyx_v_label, __pyx_v_ifst->_fst.get()); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 3919, __pyx_L1_error) + } + try { + __pyx_v__pairs.push_back(__pyx_t_7); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 3919, __pyx_L1_error) + } + + /* "pywrapfst.pyx":3918 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * for (label, ifst) in it: # <<<<<<<<<<<<<< + * _pairs.push_back(fst.LabelFstClassPair(label, ifst._fst.get())) + * cdef fst.ReplaceLabelType cal = _get_replace_label_type( + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":3921 + * _pairs.push_back(fst.LabelFstClassPair(label, ifst._fst.get())) + * cdef fst.ReplaceLabelType cal = _get_replace_label_type( + * tostring(call_arc_labeling), epsilon_on_replace) # <<<<<<<<<<<<<< + * cdef fst.ReplaceLabelType ral = _get_replace_label_type( + * tostring(return_arc_labeling), epsilon_on_replace) + */ + __pyx_t_11 = __pyx_f_9pywrapfst_tostring(__pyx_v_call_arc_labeling); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3921, __pyx_L1_error) + + /* "pywrapfst.pyx":3920 + * for (label, ifst) in it: + * _pairs.push_back(fst.LabelFstClassPair(label, ifst._fst.get())) + * cdef fst.ReplaceLabelType cal = _get_replace_label_type( # <<<<<<<<<<<<<< + * tostring(call_arc_labeling), epsilon_on_replace) + * cdef fst.ReplaceLabelType ral = _get_replace_label_type( + */ + __pyx_t_12 = __pyx_f_9pywrapfst__get_replace_label_type(__pyx_t_11, __pyx_v_epsilon_on_replace); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3920, __pyx_L1_error) + __pyx_v_cal = __pyx_t_12; + + /* "pywrapfst.pyx":3923 + * tostring(call_arc_labeling), epsilon_on_replace) + * cdef fst.ReplaceLabelType ral = _get_replace_label_type( + * tostring(return_arc_labeling), epsilon_on_replace) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.ReplaceOptions] opts + * opts.reset(new fst.ReplaceOptions(root_label, cal, ral, return_label)) + */ + __pyx_t_11 = __pyx_f_9pywrapfst_tostring(__pyx_v_return_arc_labeling); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3923, __pyx_L1_error) + + /* "pywrapfst.pyx":3922 + * cdef fst.ReplaceLabelType cal = _get_replace_label_type( + * tostring(call_arc_labeling), epsilon_on_replace) + * cdef fst.ReplaceLabelType ral = _get_replace_label_type( # <<<<<<<<<<<<<< + * tostring(return_arc_labeling), epsilon_on_replace) + * cdef unique_ptr[fst.ReplaceOptions] opts + */ + __pyx_t_12 = __pyx_f_9pywrapfst__get_replace_label_type(__pyx_t_11, __pyx_v_epsilon_on_replace); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3922, __pyx_L1_error) + __pyx_v_ral = __pyx_t_12; + + /* "pywrapfst.pyx":3925 + * tostring(return_arc_labeling), epsilon_on_replace) + * cdef unique_ptr[fst.ReplaceOptions] opts + * opts.reset(new fst.ReplaceOptions(root_label, cal, ral, return_label)) # <<<<<<<<<<<<<< + * fst.Replace(_pairs, tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) + */ + __pyx_v_opts.reset(new fst::script::ReplaceOptions(__pyx_v_root_label, __pyx_v_cal, __pyx_v_ral, __pyx_v_return_label)); + + /* "pywrapfst.pyx":3926 + * cdef unique_ptr[fst.ReplaceOptions] opts + * opts.reset(new fst.ReplaceOptions(root_label, cal, ral, return_label)) + * fst.Replace(_pairs, tfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + fst::script::Replace(__pyx_v__pairs, __pyx_v_tfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":3927 + * opts.reset(new fst.ReplaceOptions(root_label, cal, ral, return_label)) + * fst.Replace(_pairs, tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3927, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3868 + * + * + * cpdef _MutableFst replace(pairs, # <<<<<<<<<<<<<< + * call_arc_labeling=b"input", + * return_arc_labeling=b"neither", + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("pywrapfst.replace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ifst); + __Pyx_XDECREF(__pyx_v_it); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_49replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_48replace[] = "\n replace(pairs, call_arc_labeling=\"input\", return_arc_labeling=\"neither\",\n epsilon_on_replace=False, return_label=0)\n\n Recursively replaces arcs in the FST with other FST(s).\n\n This operation performs the dynamic replacement of arcs in one FST with\n another FST, allowing the definition of FSTs analogous to RTNs. It takes as\n input a set of pairs of a set of pairs formed by a non-terminal label and\n its corresponding FST, and a label identifying the root FST in that set.\n The resulting FST is obtained by taking the root FST and recursively replacing\n each arc having a nonterminal as output label by its corresponding FST. More\n precisely, an arc from state s to state d with (nonterminal) output label n in\n this FST is replaced by redirecting this \"call\" arc to the initial state of a\n copy F of the FST for n, and adding \"return\" arcs from each final state of F\n to d. Optional arguments control how the call and return arcs are labeled; by\n default, the only non-epsilon label is placed on the call arc.\n\n Args:\n\n pairs: An iterable of (nonterminal label, FST) pairs, where the former is an\n unsigned integer and the latter is an Fst instance.\n call_arc_labeling: A string indicating which call arc labels should be\n non-epsilon. One of: \"input\" (default), \"output\", \"both\", \"neither\".\n This value is set to \"neither\" if epsilon_on_replace is True.\n return_arc_labeling: A string indicating which return arc labels should be\n non-epsilon. One of: \"input\", \"output\", \"both\", \"neither\" (default).\n This value is set to \"neither\" if epsilon_on_replace is True.\n epsilon_on_replace: Should call and return arcs be epsilon arcs? If True,\n this effectively overrides call_arc_labeling and return_arc_labeling,\n setting both to \"neither\".\n return_label: The integer label for return arcs.\n\n Returns:\n An FST resulting from expanding the input"" RTN.\n "; +static PyObject *__pyx_pw_9pywrapfst_49replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_pairs = 0; + PyObject *__pyx_v_call_arc_labeling = 0; + PyObject *__pyx_v_return_arc_labeling = 0; + bool __pyx_v_epsilon_on_replace; + __pyx_t_10basictypes_int64 __pyx_v_return_label; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("replace (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pairs,&__pyx_n_s_call_arc_labeling,&__pyx_n_s_return_arc_labeling,&__pyx_n_s_epsilon_on_replace,&__pyx_n_s_return_label,0}; + PyObject* values[5] = {0,0,0,0,0}; + values[1] = ((PyObject *)__pyx_n_b_input); + values[2] = ((PyObject *)__pyx_n_b_neither); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pairs)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_call_arc_labeling); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_arc_labeling); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon_on_replace); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_label); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace") < 0)) __PYX_ERR(0, 3868, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pairs = values[0]; + __pyx_v_call_arc_labeling = values[1]; + __pyx_v_return_arc_labeling = values[2]; + if (values[3]) { + __pyx_v_epsilon_on_replace = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_epsilon_on_replace == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3871, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3871 + * call_arc_labeling=b"input", + * return_arc_labeling=b"neither", + * bool epsilon_on_replace=False, # <<<<<<<<<<<<<< + * int64 return_label=0): + * """ + */ + __pyx_v_epsilon_on_replace = ((bool)0); + } + if (values[4]) { + __pyx_v_return_label = __Pyx_PyInt_As_int64_t(values[4]); if (unlikely((__pyx_v_return_label == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3872, __pyx_L3_error) + } else { + __pyx_v_return_label = ((__pyx_t_10basictypes_int64)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("replace", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3868, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.replace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_48replace(__pyx_self, __pyx_v_pairs, __pyx_v_call_arc_labeling, __pyx_v_return_arc_labeling, __pyx_v_epsilon_on_replace, __pyx_v_return_label); + + /* "pywrapfst.pyx":3868 + * + * + * cpdef _MutableFst replace(pairs, # <<<<<<<<<<<<<< + * call_arc_labeling=b"input", + * return_arc_labeling=b"neither", + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_48replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs, PyObject *__pyx_v_call_arc_labeling, PyObject *__pyx_v_return_arc_labeling, bool __pyx_v_epsilon_on_replace, __pyx_t_10basictypes_int64 __pyx_v_return_label) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_replace __pyx_t_2; + __Pyx_RefNannySetupContext("replace", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 4; + __pyx_t_2.call_arc_labeling = __pyx_v_call_arc_labeling; + __pyx_t_2.return_arc_labeling = __pyx_v_return_arc_labeling; + __pyx_t_2.epsilon_on_replace = __pyx_v_epsilon_on_replace; + __pyx_t_2.return_label = __pyx_v_return_label; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_replace(__pyx_v_pairs, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.replace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3930 + * + * + * cpdef _MutableFst reverse(_Fst ifst, bool require_superinitial=True): # <<<<<<<<<<<<<< + * """ + * reverse(ifst, require_superinitial=True) + */ + +static PyObject *__pyx_pw_9pywrapfst_51reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_reverse(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_reverse *__pyx_optional_args) { + bool __pyx_v_require_superinitial = ((bool)1); + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reverse", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_require_superinitial = __pyx_optional_args->require_superinitial; + } + } + + /* "pywrapfst.pyx":3950 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * fst.Reverse(deref(ifst._fst), tfst.get(), require_superinitial) + * return _init_MutableFst(tfst.release()) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 3950, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":3951 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.Reverse(deref(ifst._fst), tfst.get(), require_superinitial) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3951, __pyx_L1_error) + } + fst::script::Reverse((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), __pyx_v_require_superinitial); + + /* "pywrapfst.pyx":3952 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.Reverse(deref(ifst._fst), tfst.get(), require_superinitial) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3930 + * + * + * cpdef _MutableFst reverse(_Fst ifst, bool require_superinitial=True): # <<<<<<<<<<<<<< + * """ + * reverse(ifst, require_superinitial=True) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_51reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_50reverse[] = "\n reverse(ifst, require_superinitial=True)\n\n Constructively reverses an FST's transduction.\n\n This operation reverses an FST. If A transduces string x to y with weight a,\n then the reverse of A transduces the reverse of x to the reverse of y with\n weight a.Reverse(). (Typically, a = a.Reverse() and Arc = RevArc, e.g.,\n TropicalWeight and LogWeight.) In general, e.g., when the weights only form a\n left or right semiring, the output arc type must match the input arc type.\n\n Args:\n ifst: The input FST.\n require_superinitial: Should a superinitial state be created?\n\n Returns:\n A reversed FST.\n "; +static PyObject *__pyx_pw_9pywrapfst_51reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + bool __pyx_v_require_superinitial; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reverse (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_require_superinitial,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_require_superinitial); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reverse") < 0)) __PYX_ERR(0, 3930, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_require_superinitial = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_require_superinitial == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3930, __pyx_L3_error) + } else { + __pyx_v_require_superinitial = ((bool)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("reverse", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3930, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3930, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_50reverse(__pyx_self, __pyx_v_ifst, __pyx_v_require_superinitial); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_50reverse(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, bool __pyx_v_require_superinitial) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_reverse __pyx_t_2; + __Pyx_RefNannySetupContext("reverse", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.require_superinitial = __pyx_v_require_superinitial; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_reverse(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3930, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3958 + * + * + * cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, + */ + +static std::vector *__pyx_f_9pywrapfst__shortestdistance(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, struct __pyx_opt_args_9pywrapfst__shortestdistance *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__46; + __pyx_t_10basictypes_int64 __pyx_v_nstate = __pyx_k__47; + PyObject *__pyx_v_queue_type = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":3962 + * int64 nstate=fst.kNoStateId, + * queue_type=b"auto", + * bool reverse=False) except *: # <<<<<<<<<<<<<< + * cdef unique_ptr[vector[fst.WeightClass]] distance + * distance.reset(new vector[fst.WeightClass]()) + */ + bool __pyx_v_reverse = ((bool)0); + std::unique_ptr > __pyx_v_distance; + std::unique_ptr __pyx_v_opts; + std::vector *__pyx_r; + __Pyx_RefNannyDeclarations + std::vector *__pyx_t_1; + int __pyx_t_2; + std::string __pyx_t_3; + enum fst::QueueType __pyx_t_4; + __Pyx_RefNannySetupContext("_shortestdistance", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_nstate = __pyx_optional_args->nstate; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_queue_type = __pyx_optional_args->queue_type; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_reverse = __pyx_optional_args->reverse; + } + } + } + } + } + + /* "pywrapfst.pyx":3964 + * bool reverse=False) except *: + * cdef unique_ptr[vector[fst.WeightClass]] distance + * distance.reset(new vector[fst.WeightClass]()) # <<<<<<<<<<<<<< + * # For scoping reasons, these have to be declared here even though they may + * # not be used in all cases. + */ + try { + __pyx_t_1 = new std::vector (); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 3964, __pyx_L1_error) + } + __pyx_v_distance.reset(__pyx_t_1); + + /* "pywrapfst.pyx":3968 + * # not be used in all cases. + * cdef unique_ptr[fst.ShortestDistanceOptions] opts + * if reverse: # <<<<<<<<<<<<<< + * # Only the simpler signature supports shortest distance to final states; + * # `nstate` and `queue_type` arguments are ignored. + */ + __pyx_t_2 = (__pyx_v_reverse != 0); + if (__pyx_t_2) { + + /* "pywrapfst.pyx":3971 + * # Only the simpler signature supports shortest distance to final states; + * # `nstate` and `queue_type` arguments are ignored. + * fst.ShortestDistance(deref(ifst._fst), distance.get(), True, delta) # <<<<<<<<<<<<<< + * else: + * opts.reset(new fst.ShortestDistanceOptions( + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3971, __pyx_L1_error) + } + fst::script::ShortestDistance((*__pyx_v_ifst->_fst), __pyx_v_distance.get(), 1, __pyx_v_delta); + + /* "pywrapfst.pyx":3968 + * # not be used in all cases. + * cdef unique_ptr[fst.ShortestDistanceOptions] opts + * if reverse: # <<<<<<<<<<<<<< + * # Only the simpler signature supports shortest distance to final states; + * # `nstate` and `queue_type` arguments are ignored. + */ + goto __pyx_L3; + } + + /* "pywrapfst.pyx":3973 + * fst.ShortestDistance(deref(ifst._fst), distance.get(), True, delta) + * else: + * opts.reset(new fst.ShortestDistanceOptions( # <<<<<<<<<<<<<< + * _get_queue_type(tostring(queue_type)), fst.ANY_ARC_FILTER, nstate, + * delta)) + */ + /*else*/ { + + /* "pywrapfst.pyx":3974 + * else: + * opts.reset(new fst.ShortestDistanceOptions( + * _get_queue_type(tostring(queue_type)), fst.ANY_ARC_FILTER, nstate, # <<<<<<<<<<<<<< + * delta)) + * fst.ShortestDistance(deref(ifst._fst), distance.get(), deref(opts)) + */ + __pyx_t_3 = __pyx_f_9pywrapfst_tostring(__pyx_v_queue_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3974, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9pywrapfst__get_queue_type(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3974, __pyx_L1_error) + + /* "pywrapfst.pyx":3973 + * fst.ShortestDistance(deref(ifst._fst), distance.get(), True, delta) + * else: + * opts.reset(new fst.ShortestDistanceOptions( # <<<<<<<<<<<<<< + * _get_queue_type(tostring(queue_type)), fst.ANY_ARC_FILTER, nstate, + * delta)) + */ + __pyx_v_opts.reset(new fst::script::ShortestDistanceOptions(__pyx_t_4, fst::script::ANY_ARC_FILTER, __pyx_v_nstate, __pyx_v_delta)); + + /* "pywrapfst.pyx":3976 + * _get_queue_type(tostring(queue_type)), fst.ANY_ARC_FILTER, nstate, + * delta)) + * fst.ShortestDistance(deref(ifst._fst), distance.get(), deref(opts)) # <<<<<<<<<<<<<< + * return distance.release() + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 3976, __pyx_L1_error) + } + fst::script::ShortestDistance((*__pyx_v_ifst->_fst), __pyx_v_distance.get(), (*__pyx_v_opts)); + } + __pyx_L3:; + + /* "pywrapfst.pyx":3977 + * delta)) + * fst.ShortestDistance(deref(ifst._fst), distance.get(), deref(opts)) + * return distance.release() # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_distance.release(); + goto __pyx_L0; + + /* "pywrapfst.pyx":3958 + * + * + * cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst._shortestdistance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":3980 + * + * + * def shortestdistance(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_53shortestdistance(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_52shortestdistance[] = "\n shortestdistance(ifst, delta=1e-6, nstate=NO_STATE_ID,\n queue_type=\"auto\", reverse=False)\n\n Compute the shortest distance from the initial or final state.\n\n This operation computes the shortest distance from the initial state (when\n `reverse` is False) or from every state to the final state (when `reverse` is\n True). The shortest distance from p to q is the \\otimes-sum of the weights of\n all the paths between p and q. The weights must be right (if `reverse` is\n False) or left (if `reverse` is True) distributive, and k-closed (i.e., 1\n \\otimes x \\otimes x^2 \\otimes ... \\otimes x^{k + 1} = 1 \\otimes x \\otimes x^2\n \\otimes ... \\otimes x^k; e.g., TropicalWeight).\n\n Args:\n ifst: The input FST.\n delta: Comparison/quantization delta.\n nstate: State number threshold (ignored if `reverse` is True).\n queue_type: A string matching a known queue type; one of: \"auto\", \"fifo\",\n \"lifo\", \"shortest\", \"state\", \"top\" (ignored if `reverse` is True).\n reverse: Should the reverse distance (from each state to the final state)\n be computed?\n\n Returns:\n A list of Weight objects representing the shortest distance for each state.\n "; +static PyMethodDef __pyx_mdef_9pywrapfst_53shortestdistance = {"shortestdistance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_53shortestdistance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_52shortestdistance}; +static PyObject *__pyx_pw_9pywrapfst_53shortestdistance(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + float __pyx_v_delta; + __pyx_t_10basictypes_int64 __pyx_v_nstate; + PyObject *__pyx_v_queue_type = 0; + bool __pyx_v_reverse; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("shortestdistance (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_delta,&__pyx_n_s_nstate,&__pyx_n_s_queue_type,&__pyx_n_s_reverse,0}; + PyObject* values[5] = {0,0,0,0,0}; + values[3] = ((PyObject *)__pyx_n_b_auto); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nstate); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_type); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reverse); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shortestdistance") < 0)) __PYX_ERR(0, 3980, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3981, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__48; + } + if (values[2]) { + __pyx_v_nstate = __Pyx_PyInt_As_int64_t(values[2]); if (unlikely((__pyx_v_nstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3982, __pyx_L3_error) + } else { + __pyx_v_nstate = __pyx_k__49; + } + __pyx_v_queue_type = values[3]; + if (values[4]) { + __pyx_v_reverse = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_reverse == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3984, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":3984 + * int64 nstate=fst.kNoStateId, + * queue_type=b"auto", + * bool reverse=False): # <<<<<<<<<<<<<< + * """ + * shortestdistance(ifst, delta=1e-6, nstate=NO_STATE_ID, + */ + __pyx_v_reverse = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("shortestdistance", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3980, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.shortestdistance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 3980, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_52shortestdistance(__pyx_self, __pyx_v_ifst, __pyx_v_delta, __pyx_v_nstate, __pyx_v_queue_type, __pyx_v_reverse); + + /* "pywrapfst.pyx":3980 + * + * + * def shortestdistance(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_52shortestdistance(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_queue_type, bool __pyx_v_reverse) { + std::unique_ptr > __pyx_v_distance; + std::string __pyx_v_weight_type; + fst::script::WeightClass __pyx_7genexpr__pyx_v_weight; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::vector *__pyx_t_1; + struct __pyx_opt_args_9pywrapfst__shortestdistance __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + std::vector ::iterator __pyx_t_4; + fst::script::WeightClass __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("shortestdistance", 0); + + /* "pywrapfst.pyx":4012 + * """ + * cdef unique_ptr[vector[fst.WeightClass]] distance + * distance.reset(_shortestdistance(ifst, delta, nstate, queue_type, reverse)) # <<<<<<<<<<<<<< + * cdef string weight_type = ifst.weight_type() + * return [Weight(weight_type, weight.ToString()) for weight in deref(distance)] + */ + __pyx_t_2.__pyx_n = 4; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.nstate = __pyx_v_nstate; + __pyx_t_2.queue_type = __pyx_v_queue_type; + __pyx_t_2.reverse = __pyx_v_reverse; + __pyx_t_1 = __pyx_f_9pywrapfst__shortestdistance(__pyx_v_ifst, &__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4012, __pyx_L1_error) + __pyx_v_distance.reset(__pyx_t_1); + + /* "pywrapfst.pyx":4013 + * cdef unique_ptr[vector[fst.WeightClass]] distance + * distance.reset(_shortestdistance(ifst, delta, nstate, queue_type, reverse)) + * cdef string weight_type = ifst.weight_type() # <<<<<<<<<<<<<< + * return [Weight(weight_type, weight.ToString()) for weight in deref(distance)] + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 4013, __pyx_L1_error) + } + __pyx_v_weight_type = ((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->weight_type(__pyx_v_ifst, 0); + + /* "pywrapfst.pyx":4014 + * distance.reset(_shortestdistance(ifst, delta, nstate, queue_type, reverse)) + * cdef string weight_type = ifst.weight_type() + * return [Weight(weight_type, weight.ToString()) for weight in deref(distance)] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = &(*__pyx_v_distance); + __pyx_t_4 = __pyx_t_1->begin(); + for (;;) { + if (!(__pyx_t_4 != __pyx_t_1->end())) break; + __pyx_t_5 = *__pyx_t_4; + ++__pyx_t_4; + __pyx_7genexpr__pyx_v_weight = __pyx_t_5; + __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_weight_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_7genexpr__pyx_v_weight.ToString()); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9pywrapfst_Weight), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 4014, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + } /* exit inner scope */ + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":3980 + * + * + * def shortestdistance(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst.shortestdistance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4017 + * + * + * cpdef _MutableFst shortestpath(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int32 nshortest=1, + */ + +static PyObject *__pyx_pw_9pywrapfst_55shortestpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_shortestpath(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_shortestpath *__pyx_optional_args) { + float __pyx_v_delta = __pyx_k__50; + __pyx_t_10basictypes_int32 __pyx_v_nshortest = ((__pyx_t_10basictypes_int32)1); + __pyx_t_10basictypes_int64 __pyx_v_nstate = __pyx_k__51; + PyObject *__pyx_v_queue_type = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":4022 + * int64 nstate=fst.kNoStateId, + * queue_type=b"auto", + * bool unique=False, # <<<<<<<<<<<<<< + * weight=None): + * """ + */ + bool __pyx_v_unique = ((bool)0); + + /* "pywrapfst.pyx":4023 + * queue_type=b"auto", + * bool unique=False, + * weight=None): # <<<<<<<<<<<<<< + * """ + * shortestpath(ifst, delta=1e-6, nshortest=1, nstate=NO_STATE_ID, + */ + PyObject *__pyx_v_weight = ((PyObject *)Py_None); + std::unique_ptr __pyx_v_tfst; + fst::script::WeightClass __pyx_v_wc; + std::unique_ptr __pyx_v_opts; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + fst::script::WeightClass __pyx_t_1; + std::string __pyx_t_2; + enum fst::QueueType __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("shortestpath", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_delta = __pyx_optional_args->delta; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_nshortest = __pyx_optional_args->nshortest; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_nstate = __pyx_optional_args->nstate; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_queue_type = __pyx_optional_args->queue_type; + if (__pyx_optional_args->__pyx_n > 4) { + __pyx_v_unique = __pyx_optional_args->unique; + if (__pyx_optional_args->__pyx_n > 5) { + __pyx_v_weight = __pyx_optional_args->weight; + } + } + } + } + } + } + } + + /* "pywrapfst.pyx":4055 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 4055, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":4057 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.ShortestPathOptions] opts + * opts.reset(new fst.ShortestPathOptions(_get_queue_type(tostring(queue_type)), + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight_type"); + __PYX_ERR(0, 4057, __pyx_L1_error) + } + __pyx_t_1 = __pyx_f_9pywrapfst__get_WeightClass_or_Zero(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->weight_type(__pyx_v_ifst, 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4057, __pyx_L1_error) + __pyx_v_wc = __pyx_t_1; + + /* "pywrapfst.pyx":4059 + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) + * cdef unique_ptr[fst.ShortestPathOptions] opts + * opts.reset(new fst.ShortestPathOptions(_get_queue_type(tostring(queue_type)), # <<<<<<<<<<<<<< + * nshortest, unique, delta, wc, nstate)) + * fst.ShortestPath(deref(ifst._fst), tfst.get(), deref(opts)) + */ + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_v_queue_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4059, __pyx_L1_error) + __pyx_t_3 = __pyx_f_9pywrapfst__get_queue_type(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4059, __pyx_L1_error) + + /* "pywrapfst.pyx":4060 + * cdef unique_ptr[fst.ShortestPathOptions] opts + * opts.reset(new fst.ShortestPathOptions(_get_queue_type(tostring(queue_type)), + * nshortest, unique, delta, wc, nstate)) # <<<<<<<<<<<<<< + * fst.ShortestPath(deref(ifst._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) + */ + __pyx_v_opts.reset(new fst::script::ShortestPathOptions(__pyx_t_3, __pyx_v_nshortest, __pyx_v_unique, __pyx_v_delta, __pyx_v_wc, __pyx_v_nstate)); + + /* "pywrapfst.pyx":4061 + * opts.reset(new fst.ShortestPathOptions(_get_queue_type(tostring(queue_type)), + * nshortest, unique, delta, wc, nstate)) + * fst.ShortestPath(deref(ifst._fst), tfst.get(), deref(opts)) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 4061, __pyx_L1_error) + } + fst::script::ShortestPath((*__pyx_v_ifst->_fst), __pyx_v_tfst.get(), (*__pyx_v_opts)); + + /* "pywrapfst.pyx":4062 + * nshortest, unique, delta, wc, nstate)) + * fst.ShortestPath(deref(ifst._fst), tfst.get(), deref(opts)) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_4 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4017 + * + * + * cpdef _MutableFst shortestpath(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int32 nshortest=1, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.shortestpath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_55shortestpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_54shortestpath[] = "\n shortestpath(ifst, delta=1e-6, nshortest=1, nstate=NO_STATE_ID,\n queue_type=\"auto\", unique=False, weight=None)\n\n Construct an FST containing the shortest path(s) in the input FST.\n\n This operation produces an FST containing the n-shortest paths in the input\n FST. The n-shortest paths are the n-lowest weight paths w.r.t. the natural\n semiring order. The single path that can be read from the ith of at most n\n transitions leaving the initial state of the resulting FST is the ith\n shortest path. The weights need to be right distributive and have the path\n property. They also need to be left distributive as well for n-shortest with\n n > 1 (e.g., TropicalWeight).\n\n Args:\n ifst: The input FST.\n delta: Comparison/quantization delta.\n nshortest: The number of paths to return.\n nstate: State number threshold.\n queue_type: A string matching a known queue type; one of: \"auto\", \"fifo\",\n \"lifo\", \"shortest\", \"state\", \"top\".\n unique: Should the resulting FST only contain distinct paths? (Requires\n the input FST to be an acceptor; epsilons are treated as if they are\n regular symbols.)\n weight: A Weight or weight string indicating the desired weight threshold\n below which paths are pruned; if omitted, no paths are pruned.\n\n Returns:\n An FST containing the n-shortest paths.\n "; +static PyObject *__pyx_pw_9pywrapfst_55shortestpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + float __pyx_v_delta; + __pyx_t_10basictypes_int32 __pyx_v_nshortest; + __pyx_t_10basictypes_int64 __pyx_v_nstate; + PyObject *__pyx_v_queue_type = 0; + bool __pyx_v_unique; + PyObject *__pyx_v_weight = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("shortestpath (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_delta,&__pyx_n_s_nshortest,&__pyx_n_s_nstate,&__pyx_n_s_queue_type,&__pyx_n_s_unique,&__pyx_n_s_weight,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[4] = ((PyObject *)__pyx_n_b_auto); + + /* "pywrapfst.pyx":4023 + * queue_type=b"auto", + * bool unique=False, + * weight=None): # <<<<<<<<<<<<<< + * """ + * shortestpath(ifst, delta=1e-6, nshortest=1, nstate=NO_STATE_ID, + */ + values[6] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshortest); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nstate); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_type); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unique); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weight); + if (value) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shortestpath") < 0)) __PYX_ERR(0, 4017, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + if (values[1]) { + __pyx_v_delta = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_delta == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 4018, __pyx_L3_error) + } else { + __pyx_v_delta = __pyx_k__50; + } + if (values[2]) { + __pyx_v_nshortest = __Pyx_PyInt_As_int32_t(values[2]); if (unlikely((__pyx_v_nshortest == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4019, __pyx_L3_error) + } else { + __pyx_v_nshortest = ((__pyx_t_10basictypes_int32)1); + } + if (values[3]) { + __pyx_v_nstate = __Pyx_PyInt_As_int64_t(values[3]); if (unlikely((__pyx_v_nstate == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4020, __pyx_L3_error) + } else { + __pyx_v_nstate = __pyx_k__51; + } + __pyx_v_queue_type = values[4]; + if (values[5]) { + __pyx_v_unique = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_unique == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4022, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":4022 + * int64 nstate=fst.kNoStateId, + * queue_type=b"auto", + * bool unique=False, # <<<<<<<<<<<<<< + * weight=None): + * """ + */ + __pyx_v_unique = ((bool)0); + } + __pyx_v_weight = values[6]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("shortestpath", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4017, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.shortestpath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 4017, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_54shortestpath(__pyx_self, __pyx_v_ifst, __pyx_v_delta, __pyx_v_nshortest, __pyx_v_nstate, __pyx_v_queue_type, __pyx_v_unique, __pyx_v_weight); + + /* "pywrapfst.pyx":4017 + * + * + * cpdef _MutableFst shortestpath(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int32 nshortest=1, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_54shortestpath(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, float __pyx_v_delta, __pyx_t_10basictypes_int32 __pyx_v_nshortest, __pyx_t_10basictypes_int64 __pyx_v_nstate, PyObject *__pyx_v_queue_type, bool __pyx_v_unique, PyObject *__pyx_v_weight) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst_shortestpath __pyx_t_2; + __Pyx_RefNannySetupContext("shortestpath", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 6; + __pyx_t_2.delta = __pyx_v_delta; + __pyx_t_2.nshortest = __pyx_v_nshortest; + __pyx_t_2.nstate = __pyx_v_nstate; + __pyx_t_2.queue_type = __pyx_v_queue_type; + __pyx_t_2.unique = __pyx_v_unique; + __pyx_t_2.weight = __pyx_v_weight; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_shortestpath(__pyx_v_ifst, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4017, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.shortestpath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4065 + * + * + * cpdef _Fst statemap(_Fst ifst, map_type): # <<<<<<<<<<<<<< + * """ + * state_map(ifst, map_type) + */ + +static PyObject *__pyx_pw_9pywrapfst_57statemap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_statemap(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, PyObject *__pyx_v_map_type, CYTHON_UNUSED int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9pywrapfst__map __pyx_t_2; + __Pyx_RefNannySetupContext("statemap", 0); + + /* "pywrapfst.pyx":4088 + * See also: `arcmap`. + * """ + * return _map(ifst, fst.kDelta, map_type, 1., None) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2.__pyx_n = 4; + __pyx_t_2.delta = fst::kDelta; + __pyx_t_2.map_type = __pyx_v_map_type; + __pyx_t_2.power = 1.; + __pyx_t_2.weight = Py_None; + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__map(__pyx_v_ifst, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4088, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4065 + * + * + * cpdef _Fst statemap(_Fst ifst, map_type): # <<<<<<<<<<<<<< + * """ + * state_map(ifst, map_type) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.statemap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_57statemap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_56statemap[] = "\n state_map(ifst, map_type)\n\n Constructively applies a transform to all states.\n\n This operation transforms each state according to the requested map type.\n Note that currently, only one state-mapping operation is supported.\n\n Args:\n ifst: The input FST.\n map_type: A string matching a known mapping operation; one of: \"arc_sum\"\n (sum weights of identically-labeled multi-arcs), \"arc_unique\" (deletes\n non-unique identically-labeled multi-arcs).\n\n Returns:\n An FST with states remapped.\n\n Raises:\n FstArgError: Unknown map type.\n\n See also: `arcmap`.\n "; +static PyObject *__pyx_pw_9pywrapfst_57statemap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + PyObject *__pyx_v_map_type = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("statemap (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ifst,&__pyx_n_s_map_type,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_map_type)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("statemap", 1, 2, 2, 1); __PYX_ERR(0, 4065, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "statemap") < 0)) __PYX_ERR(0, 4065, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[0]); + __pyx_v_map_type = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("statemap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4065, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.statemap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 4065, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_56statemap(__pyx_self, __pyx_v_ifst, __pyx_v_map_type); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_56statemap(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, PyObject *__pyx_v_map_type) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("statemap", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_statemap(__pyx_v_ifst, __pyx_v_map_type, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.statemap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4091 + * + * + * cpdef _MutableFst synchronize(_Fst ifst): # <<<<<<<<<<<<<< + * """ + * synchronize(ifst) + */ + +static PyObject *__pyx_pw_9pywrapfst_59synchronize(PyObject *__pyx_self, PyObject *__pyx_v_ifst); /*proto*/ +static struct __pyx_obj_9pywrapfst__MutableFst *__pyx_f_9pywrapfst_synchronize(struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, CYTHON_UNUSED int __pyx_skip_dispatch) { + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__MutableFst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("synchronize", 0); + + /* "pywrapfst.pyx":4111 + * """ + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) # <<<<<<<<<<<<<< + * fst.Synchronize(deref(ifst._fst), tfst.get()) + * return _init_MutableFst(tfst.release()) + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type"); + __PYX_ERR(0, 4111, __pyx_L1_error) + } + __pyx_v_tfst.reset(new fst::script::VectorFstClass(((struct __pyx_vtabstruct_9pywrapfst__Fst *)__pyx_v_ifst->__pyx_vtab)->arc_type(__pyx_v_ifst, 0))); + + /* "pywrapfst.pyx":4112 + * cdef unique_ptr[fst.VectorFstClass] tfst + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.Synchronize(deref(ifst._fst), tfst.get()) # <<<<<<<<<<<<<< + * return _init_MutableFst(tfst.release()) + * + */ + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 4112, __pyx_L1_error) + } + fst::script::Synchronize((*__pyx_v_ifst->_fst), __pyx_v_tfst.get()); + + /* "pywrapfst.pyx":4113 + * tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + * fst.Synchronize(deref(ifst._fst), tfst.get()) + * return _init_MutableFst(tfst.release()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_MutableFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__MutableFst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4091 + * + * + * cpdef _MutableFst synchronize(_Fst ifst): # <<<<<<<<<<<<<< + * """ + * synchronize(ifst) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.synchronize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_59synchronize(PyObject *__pyx_self, PyObject *__pyx_v_ifst); /*proto*/ +static char __pyx_doc_9pywrapfst_58synchronize[] = "\n synchronize(ifst)\n\n Constructively synchronizes an FST.\n\n This operation synchronizes a transducer. The result will be an equivalent\n FST that has the property that during the traversal of a path, the delay is\n either zero or strictly increasing, where the delay is the difference between\n the number of non-epsilon output labels and input labels along the path. For\n the algorithm to terminate, the input transducer must have bounded delay,\n i.e., the delay of every cycle must be zero.\n\n Args:\n ifst: The input FST.\n\n Returns:\n An equivalent synchronized FST.\n "; +static PyObject *__pyx_pw_9pywrapfst_59synchronize(PyObject *__pyx_self, PyObject *__pyx_v_ifst) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("synchronize (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 4091, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_58synchronize(__pyx_self, ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_ifst)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_58synchronize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("synchronize", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_synchronize(__pyx_v_ifst, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4091, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.synchronize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4170 + * """ + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * string fst_type=b"vector", + * string arc_type=b"standard", + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_8Compiler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_8Compiler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + std::string __pyx_v_fst_type; + std::string __pyx_v_arc_type; + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_isymbols = 0; + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_osymbols = 0; + struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_ssymbols = 0; + bool __pyx_v_acceptor; + bool __pyx_v_keep_isymbols; + bool __pyx_v_keep_osymbols; + bool __pyx_v_keep_state_numbering; + bool __pyx_v_allow_negative_labels; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst_type,&__pyx_n_s_arc_type,&__pyx_n_s_isymbols,&__pyx_n_s_osymbols,&__pyx_n_s_ssymbols,&__pyx_n_s_acceptor,&__pyx_n_s_keep_isymbols,&__pyx_n_s_keep_osymbols,&__pyx_n_s_keep_state_numbering,&__pyx_n_s_allow_negative_labels,0}; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + + /* "pywrapfst.pyx":4173 + * string fst_type=b"vector", + * string arc_type=b"standard", + * SymbolTable isymbols=None, # <<<<<<<<<<<<<< + * SymbolTable osymbols=None, + * SymbolTable ssymbols=None, + */ + values[2] = (PyObject *)((struct __pyx_obj_9pywrapfst_SymbolTable *)Py_None); + + /* "pywrapfst.pyx":4174 + * string arc_type=b"standard", + * SymbolTable isymbols=None, + * SymbolTable osymbols=None, # <<<<<<<<<<<<<< + * SymbolTable ssymbols=None, + * bool acceptor=False, + */ + values[3] = (PyObject *)((struct __pyx_obj_9pywrapfst_SymbolTable *)Py_None); + + /* "pywrapfst.pyx":4175 + * SymbolTable isymbols=None, + * SymbolTable osymbols=None, + * SymbolTable ssymbols=None, # <<<<<<<<<<<<<< + * bool acceptor=False, + * bool keep_isymbols=False, + */ + values[4] = (PyObject *)((struct __pyx_obj_9pywrapfst_SymbolTable *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fst_type); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arc_type); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isymbols); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_osymbols); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ssymbols); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acceptor); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keep_isymbols); + if (value) { values[6] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keep_osymbols); + if (value) { values[7] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keep_state_numbering); + if (value) { values[8] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 9: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allow_negative_labels); + if (value) { values[9] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 4170, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_fst_type = __pyx_convert_string_from_py_std__in_string(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4171, __pyx_L3_error) + } else { + __pyx_v_fst_type = __pyx_k__52; + } + if (values[1]) { + __pyx_v_arc_type = __pyx_convert_string_from_py_std__in_string(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4172, __pyx_L3_error) + } else { + __pyx_v_arc_type = __pyx_k__53; + } + __pyx_v_isymbols = ((struct __pyx_obj_9pywrapfst_SymbolTable *)values[2]); + __pyx_v_osymbols = ((struct __pyx_obj_9pywrapfst_SymbolTable *)values[3]); + __pyx_v_ssymbols = ((struct __pyx_obj_9pywrapfst_SymbolTable *)values[4]); + if (values[5]) { + __pyx_v_acceptor = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_acceptor == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4176, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":4176 + * SymbolTable osymbols=None, + * SymbolTable ssymbols=None, + * bool acceptor=False, # <<<<<<<<<<<<<< + * bool keep_isymbols=False, + * bool keep_osymbols=False, + */ + __pyx_v_acceptor = ((bool)0); + } + if (values[6]) { + __pyx_v_keep_isymbols = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_keep_isymbols == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4177, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":4177 + * SymbolTable ssymbols=None, + * bool acceptor=False, + * bool keep_isymbols=False, # <<<<<<<<<<<<<< + * bool keep_osymbols=False, + * bool keep_state_numbering=False, + */ + __pyx_v_keep_isymbols = ((bool)0); + } + if (values[7]) { + __pyx_v_keep_osymbols = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_keep_osymbols == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4178, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":4178 + * bool acceptor=False, + * bool keep_isymbols=False, + * bool keep_osymbols=False, # <<<<<<<<<<<<<< + * bool keep_state_numbering=False, + * bool allow_negative_labels=False): + */ + __pyx_v_keep_osymbols = ((bool)0); + } + if (values[8]) { + __pyx_v_keep_state_numbering = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_keep_state_numbering == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4179, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":4179 + * bool keep_isymbols=False, + * bool keep_osymbols=False, + * bool keep_state_numbering=False, # <<<<<<<<<<<<<< + * bool allow_negative_labels=False): + * self._sstrm.reset(new stringstream()) + */ + __pyx_v_keep_state_numbering = ((bool)0); + } + if (values[9]) { + __pyx_v_allow_negative_labels = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_allow_negative_labels == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4180, __pyx_L3_error) + } else { + + /* "pywrapfst.pyx":4180 + * bool keep_osymbols=False, + * bool keep_state_numbering=False, + * bool allow_negative_labels=False): # <<<<<<<<<<<<<< + * self._sstrm.reset(new stringstream()) + * self._fst_type = tostring(fst_type) + */ + __pyx_v_allow_negative_labels = ((bool)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4170, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.Compiler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isymbols), __pyx_ptype_9pywrapfst_SymbolTable, 1, "isymbols", 0))) __PYX_ERR(0, 4173, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_osymbols), __pyx_ptype_9pywrapfst_SymbolTable, 1, "osymbols", 0))) __PYX_ERR(0, 4174, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ssymbols), __pyx_ptype_9pywrapfst_SymbolTable, 1, "ssymbols", 0))) __PYX_ERR(0, 4175, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_8Compiler___cinit__(((struct __pyx_obj_9pywrapfst_Compiler *)__pyx_v_self), __pyx_v_fst_type, __pyx_v_arc_type, __pyx_v_isymbols, __pyx_v_osymbols, __pyx_v_ssymbols, __pyx_v_acceptor, __pyx_v_keep_isymbols, __pyx_v_keep_osymbols, __pyx_v_keep_state_numbering, __pyx_v_allow_negative_labels); + + /* "pywrapfst.pyx":4170 + * """ + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * string fst_type=b"vector", + * string arc_type=b"standard", + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_8Compiler___cinit__(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, std::string __pyx_v_fst_type, std::string __pyx_v_arc_type, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_isymbols, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_osymbols, struct __pyx_obj_9pywrapfst_SymbolTable *__pyx_v_ssymbols, bool __pyx_v_acceptor, bool __pyx_v_keep_isymbols, bool __pyx_v_keep_osymbols, bool __pyx_v_keep_state_numbering, bool __pyx_v_allow_negative_labels) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::string __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + fst::SymbolTable *__pyx_t_5; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "pywrapfst.pyx":4181 + * bool keep_state_numbering=False, + * bool allow_negative_labels=False): + * self._sstrm.reset(new stringstream()) # <<<<<<<<<<<<<< + * self._fst_type = tostring(fst_type) + * self._arc_type = tostring(arc_type) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_sstrm"); + __PYX_ERR(0, 4181, __pyx_L1_error) + } + __pyx_v_self->_sstrm.reset(new std::stringstream()); + + /* "pywrapfst.pyx":4182 + * bool allow_negative_labels=False): + * self._sstrm.reset(new stringstream()) + * self._fst_type = tostring(fst_type) # <<<<<<<<<<<<<< + * self._arc_type = tostring(arc_type) + * self._isymbols = NULL + */ + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_fst_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4182, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst_type"); + __PYX_ERR(0, 4182, __pyx_L1_error) + } + __pyx_v_self->_fst_type = __pyx_t_2; + + /* "pywrapfst.pyx":4183 + * self._sstrm.reset(new stringstream()) + * self._fst_type = tostring(fst_type) + * self._arc_type = tostring(arc_type) # <<<<<<<<<<<<<< + * self._isymbols = NULL + * if isymbols is not None: + */ + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4183, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc_type"); + __PYX_ERR(0, 4183, __pyx_L1_error) + } + __pyx_v_self->_arc_type = __pyx_t_2; + + /* "pywrapfst.pyx":4184 + * self._fst_type = tostring(fst_type) + * self._arc_type = tostring(arc_type) + * self._isymbols = NULL # <<<<<<<<<<<<<< + * if isymbols is not None: + * self._isymbols = isymbols._table + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_isymbols"); + __PYX_ERR(0, 4184, __pyx_L1_error) + } + __pyx_v_self->_isymbols = NULL; + + /* "pywrapfst.pyx":4185 + * self._arc_type = tostring(arc_type) + * self._isymbols = NULL + * if isymbols is not None: # <<<<<<<<<<<<<< + * self._isymbols = isymbols._table + * self._osymbols = NULL + */ + __pyx_t_3 = (((PyObject *)__pyx_v_isymbols) != Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "pywrapfst.pyx":4186 + * self._isymbols = NULL + * if isymbols is not None: + * self._isymbols = isymbols._table # <<<<<<<<<<<<<< + * self._osymbols = NULL + * if osymbols is not None: + */ + if (unlikely(((PyObject *)__pyx_v_isymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 4186, __pyx_L1_error) + } + __pyx_t_5 = __pyx_v_isymbols->__pyx_base.__pyx_base._table; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_isymbols"); + __PYX_ERR(0, 4186, __pyx_L1_error) + } + __pyx_v_self->_isymbols = __pyx_t_5; + + /* "pywrapfst.pyx":4185 + * self._arc_type = tostring(arc_type) + * self._isymbols = NULL + * if isymbols is not None: # <<<<<<<<<<<<<< + * self._isymbols = isymbols._table + * self._osymbols = NULL + */ + } + + /* "pywrapfst.pyx":4187 + * if isymbols is not None: + * self._isymbols = isymbols._table + * self._osymbols = NULL # <<<<<<<<<<<<<< + * if osymbols is not None: + * self._osymbols = osymbols._table + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_osymbols"); + __PYX_ERR(0, 4187, __pyx_L1_error) + } + __pyx_v_self->_osymbols = NULL; + + /* "pywrapfst.pyx":4188 + * self._isymbols = isymbols._table + * self._osymbols = NULL + * if osymbols is not None: # <<<<<<<<<<<<<< + * self._osymbols = osymbols._table + * self._ssymbols = NULL + */ + __pyx_t_4 = (((PyObject *)__pyx_v_osymbols) != Py_None); + __pyx_t_3 = (__pyx_t_4 != 0); + if (__pyx_t_3) { + + /* "pywrapfst.pyx":4189 + * self._osymbols = NULL + * if osymbols is not None: + * self._osymbols = osymbols._table # <<<<<<<<<<<<<< + * self._ssymbols = NULL + * if ssymbols is not None: + */ + if (unlikely(((PyObject *)__pyx_v_osymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 4189, __pyx_L1_error) + } + __pyx_t_5 = __pyx_v_osymbols->__pyx_base.__pyx_base._table; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_osymbols"); + __PYX_ERR(0, 4189, __pyx_L1_error) + } + __pyx_v_self->_osymbols = __pyx_t_5; + + /* "pywrapfst.pyx":4188 + * self._isymbols = isymbols._table + * self._osymbols = NULL + * if osymbols is not None: # <<<<<<<<<<<<<< + * self._osymbols = osymbols._table + * self._ssymbols = NULL + */ + } + + /* "pywrapfst.pyx":4190 + * if osymbols is not None: + * self._osymbols = osymbols._table + * self._ssymbols = NULL # <<<<<<<<<<<<<< + * if ssymbols is not None: + * self._ssymbols = ssymbols._table + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_ssymbols"); + __PYX_ERR(0, 4190, __pyx_L1_error) + } + __pyx_v_self->_ssymbols = NULL; + + /* "pywrapfst.pyx":4191 + * self._osymbols = osymbols._table + * self._ssymbols = NULL + * if ssymbols is not None: # <<<<<<<<<<<<<< + * self._ssymbols = ssymbols._table + * self._acceptor = acceptor + */ + __pyx_t_3 = (((PyObject *)__pyx_v_ssymbols) != Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "pywrapfst.pyx":4192 + * self._ssymbols = NULL + * if ssymbols is not None: + * self._ssymbols = ssymbols._table # <<<<<<<<<<<<<< + * self._acceptor = acceptor + * self._keep_isymbols = keep_isymbols + */ + if (unlikely(((PyObject *)__pyx_v_ssymbols) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_table"); + __PYX_ERR(0, 4192, __pyx_L1_error) + } + __pyx_t_5 = __pyx_v_ssymbols->__pyx_base.__pyx_base._table; + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_ssymbols"); + __PYX_ERR(0, 4192, __pyx_L1_error) + } + __pyx_v_self->_ssymbols = __pyx_t_5; + + /* "pywrapfst.pyx":4191 + * self._osymbols = osymbols._table + * self._ssymbols = NULL + * if ssymbols is not None: # <<<<<<<<<<<<<< + * self._ssymbols = ssymbols._table + * self._acceptor = acceptor + */ + } + + /* "pywrapfst.pyx":4193 + * if ssymbols is not None: + * self._ssymbols = ssymbols._table + * self._acceptor = acceptor # <<<<<<<<<<<<<< + * self._keep_isymbols = keep_isymbols + * self._keep_osymbols = keep_osymbols + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_acceptor"); + __PYX_ERR(0, 4193, __pyx_L1_error) + } + __pyx_v_self->_acceptor = __pyx_v_acceptor; + + /* "pywrapfst.pyx":4194 + * self._ssymbols = ssymbols._table + * self._acceptor = acceptor + * self._keep_isymbols = keep_isymbols # <<<<<<<<<<<<<< + * self._keep_osymbols = keep_osymbols + * self._keep_state_numbering = keep_state_numbering + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_keep_isymbols"); + __PYX_ERR(0, 4194, __pyx_L1_error) + } + __pyx_v_self->_keep_isymbols = __pyx_v_keep_isymbols; + + /* "pywrapfst.pyx":4195 + * self._acceptor = acceptor + * self._keep_isymbols = keep_isymbols + * self._keep_osymbols = keep_osymbols # <<<<<<<<<<<<<< + * self._keep_state_numbering = keep_state_numbering + * self._allow_negative_labels = allow_negative_labels + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_keep_osymbols"); + __PYX_ERR(0, 4195, __pyx_L1_error) + } + __pyx_v_self->_keep_osymbols = __pyx_v_keep_osymbols; + + /* "pywrapfst.pyx":4196 + * self._keep_isymbols = keep_isymbols + * self._keep_osymbols = keep_osymbols + * self._keep_state_numbering = keep_state_numbering # <<<<<<<<<<<<<< + * self._allow_negative_labels = allow_negative_labels + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_keep_state_numbering"); + __PYX_ERR(0, 4196, __pyx_L1_error) + } + __pyx_v_self->_keep_state_numbering = __pyx_v_keep_state_numbering; + + /* "pywrapfst.pyx":4197 + * self._keep_osymbols = keep_osymbols + * self._keep_state_numbering = keep_state_numbering + * self._allow_negative_labels = allow_negative_labels # <<<<<<<<<<<<<< + * + * cpdef _Fst compile(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_allow_negative_labels"); + __PYX_ERR(0, 4197, __pyx_L1_error) + } + __pyx_v_self->_allow_negative_labels = __pyx_v_allow_negative_labels; + + /* "pywrapfst.pyx":4170 + * """ + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * string fst_type=b"vector", + * string arc_type=b"standard", + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Compiler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4199 + * self._allow_negative_labels = allow_negative_labels + * + * cpdef _Fst compile(self): # <<<<<<<<<<<<<< + * """ + * compile() + */ + +static PyObject *__pyx_pw_9pywrapfst_8Compiler_3compile(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_8Compiler_compile(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, int __pyx_skip_dispatch) { + std::unique_ptr __pyx_v_tfst; + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("compile", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_8Compiler_3compile)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst__Fst))))) __PYX_ERR(0, 4199, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4214 + * """ + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.CompileFstInternal(deref(self._sstrm), # <<<<<<<<<<<<<< + * b"", self._fst_type, self._arc_type, self._isymbols, + * self._osymbols, self._ssymbols, self._acceptor, self._keep_isymbols, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_sstrm"); + __PYX_ERR(0, 4214, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4215 + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.CompileFstInternal(deref(self._sstrm), + * b"", self._fst_type, self._arc_type, self._isymbols, # <<<<<<<<<<<<<< + * self._osymbols, self._ssymbols, self._acceptor, self._keep_isymbols, + * self._keep_osymbols, self._keep_state_numbering, + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst_type"); + __PYX_ERR(0, 4215, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_arc_type"); + __PYX_ERR(0, 4215, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_isymbols"); + __PYX_ERR(0, 4215, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4216 + * tfst.reset(fst.CompileFstInternal(deref(self._sstrm), + * b"", self._fst_type, self._arc_type, self._isymbols, + * self._osymbols, self._ssymbols, self._acceptor, self._keep_isymbols, # <<<<<<<<<<<<<< + * self._keep_osymbols, self._keep_state_numbering, + * self._allow_negative_labels)) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_osymbols"); + __PYX_ERR(0, 4216, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_ssymbols"); + __PYX_ERR(0, 4216, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_acceptor"); + __PYX_ERR(0, 4216, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_keep_isymbols"); + __PYX_ERR(0, 4216, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4217 + * b"", self._fst_type, self._arc_type, self._isymbols, + * self._osymbols, self._ssymbols, self._acceptor, self._keep_isymbols, + * self._keep_osymbols, self._keep_state_numbering, # <<<<<<<<<<<<<< + * self._allow_negative_labels)) + * self._sstrm.reset(new stringstream()) + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_keep_osymbols"); + __PYX_ERR(0, 4217, __pyx_L1_error) + } + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_keep_state_numbering"); + __PYX_ERR(0, 4217, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4218 + * self._osymbols, self._ssymbols, self._acceptor, self._keep_isymbols, + * self._keep_osymbols, self._keep_state_numbering, + * self._allow_negative_labels)) # <<<<<<<<<<<<<< + * self._sstrm.reset(new stringstream()) + * if tfst.get() == NULL: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_allow_negative_labels"); + __PYX_ERR(0, 4218, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4214 + * """ + * cdef unique_ptr[fst.FstClass] tfst + * tfst.reset(fst.CompileFstInternal(deref(self._sstrm), # <<<<<<<<<<<<<< + * b"", self._fst_type, self._arc_type, self._isymbols, + * self._osymbols, self._ssymbols, self._acceptor, self._keep_isymbols, + */ + __pyx_v_tfst.reset(fst::script::CompileFstInternal((*__pyx_v_self->_sstrm), __pyx_k_pywrapfst, __pyx_v_self->_fst_type, __pyx_v_self->_arc_type, __pyx_v_self->_isymbols, __pyx_v_self->_osymbols, __pyx_v_self->_ssymbols, __pyx_v_self->_acceptor, __pyx_v_self->_keep_isymbols, __pyx_v_self->_keep_osymbols, __pyx_v_self->_keep_state_numbering, __pyx_v_self->_allow_negative_labels)); + + /* "pywrapfst.pyx":4219 + * self._keep_osymbols, self._keep_state_numbering, + * self._allow_negative_labels)) + * self._sstrm.reset(new stringstream()) # <<<<<<<<<<<<<< + * if tfst.get() == NULL: + * raise FstOpError("Compilation failed") + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_sstrm"); + __PYX_ERR(0, 4219, __pyx_L1_error) + } + __pyx_v_self->_sstrm.reset(new std::stringstream()); + + /* "pywrapfst.pyx":4220 + * self._allow_negative_labels)) + * self._sstrm.reset(new stringstream()) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstOpError("Compilation failed") + * return _init_XFst(tfst.release()) + */ + __pyx_t_5 = ((__pyx_v_tfst.get() == NULL) != 0); + if (unlikely(__pyx_t_5)) { + + /* "pywrapfst.pyx":4221 + * self._sstrm.reset(new stringstream()) + * if tfst.get() == NULL: + * raise FstOpError("Compilation failed") # <<<<<<<<<<<<<< + * return _init_XFst(tfst.release()) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Compilation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Compilation_failed); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4221, __pyx_L1_error) + + /* "pywrapfst.pyx":4220 + * self._allow_negative_labels)) + * self._sstrm.reset(new stringstream()) + * if tfst.get() == NULL: # <<<<<<<<<<<<<< + * raise FstOpError("Compilation failed") + * return _init_XFst(tfst.release()) + */ + } + + /* "pywrapfst.pyx":4222 + * if tfst.get() == NULL: + * raise FstOpError("Compilation failed") + * return _init_XFst(tfst.release()) # <<<<<<<<<<<<<< + * + * cpdef void write(self, expression): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_XFst(__pyx_v_tfst.release())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4199 + * self._allow_negative_labels = allow_negative_labels + * + * cpdef _Fst compile(self): # <<<<<<<<<<<<<< + * """ + * compile() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.Compiler.compile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_8Compiler_3compile(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_8Compiler_2compile[] = "\n compile()\n\n Compiles the FST in the compiler string buffer.\n\n This method compiles the FST and returns the resulting machine.\n\n Returns:\n The FST described by the compiler string buffer.\n\n Raises:\n FstOpError: Compilation failed.\n "; +static PyObject *__pyx_pw_9pywrapfst_8Compiler_3compile(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("compile (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_8Compiler_2compile(((struct __pyx_obj_9pywrapfst_Compiler *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_8Compiler_2compile(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("compile", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_8Compiler_compile(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Compiler.compile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4224 + * return _init_XFst(tfst.release()) + * + * cpdef void write(self, expression): # <<<<<<<<<<<<<< + * """ + * write(expression) + */ + +static PyObject *__pyx_pw_9pywrapfst_8Compiler_5write(PyObject *__pyx_v_self, PyObject *__pyx_v_expression); /*proto*/ +static void __pyx_f_9pywrapfst_8Compiler_write(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, PyObject *__pyx_v_expression, int __pyx_skip_dispatch) { + std::string __pyx_v_line; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("write", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_8Compiler_5write)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_expression) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_expression); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4240 + * expression: A string expression to add to compiler string buffer. + * """ + * cdef string line = tostring(expression) # <<<<<<<<<<<<<< + * if not line.empty() and line.back() != b'\n': + * line.append(b'\n') + */ + __pyx_t_5 = __pyx_f_9pywrapfst_tostring(__pyx_v_expression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4240, __pyx_L1_error) + __pyx_v_line = __pyx_t_5; + + /* "pywrapfst.pyx":4241 + * """ + * cdef string line = tostring(expression) + * if not line.empty() and line.back() != b'\n': # <<<<<<<<<<<<<< + * line.append(b'\n') + * deref(self._sstrm) << line + */ + __pyx_t_7 = ((!(__pyx_v_line.empty() != 0)) != 0); + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = ((__pyx_v_line.back() != '\n') != 0); + __pyx_t_6 = __pyx_t_7; + __pyx_L4_bool_binop_done:; + if (__pyx_t_6) { + + /* "pywrapfst.pyx":4242 + * cdef string line = tostring(expression) + * if not line.empty() and line.back() != b'\n': + * line.append(b'\n') # <<<<<<<<<<<<<< + * deref(self._sstrm) << line + * + */ + (void)(__pyx_v_line.append(((char const *)"\n"))); + + /* "pywrapfst.pyx":4241 + * """ + * cdef string line = tostring(expression) + * if not line.empty() and line.back() != b'\n': # <<<<<<<<<<<<<< + * line.append(b'\n') + * deref(self._sstrm) << line + */ + } + + /* "pywrapfst.pyx":4243 + * if not line.empty() and line.back() != b'\n': + * line.append(b'\n') + * deref(self._sstrm) << line # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_sstrm"); + __PYX_ERR(0, 4243, __pyx_L1_error) + } + (void)(((*__pyx_v_self->_sstrm) << __pyx_v_line)); + + /* "pywrapfst.pyx":4224 + * return _init_XFst(tfst.release()) + * + * cpdef void write(self, expression): # <<<<<<<<<<<<<< + * """ + * write(expression) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.Compiler.write", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_8Compiler_5write(PyObject *__pyx_v_self, PyObject *__pyx_v_expression); /*proto*/ +static char __pyx_doc_9pywrapfst_8Compiler_4write[] = "\n write(expression)\n\n Writes a string into the compiler string buffer.\n\n This method adds a line to the compiler string buffer. It is normally\n invoked using the right shift operator, like so:\n\n compiler = fst.Compiler()\n compiler.write(\"0 0 49 49\")\n compiler.write(\"0\")\n\n Args:\n expression: A string expression to add to compiler string buffer.\n "; +static PyObject *__pyx_pw_9pywrapfst_8Compiler_5write(PyObject *__pyx_v_self, PyObject *__pyx_v_expression) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_8Compiler_4write(((struct __pyx_obj_9pywrapfst_Compiler *)__pyx_v_self), ((PyObject *)__pyx_v_expression)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_8Compiler_4write(struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, PyObject *__pyx_v_expression) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("write", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_8Compiler_write(__pyx_v_self, __pyx_v_expression, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Compiler.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_8Compiler_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_8Compiler_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_8Compiler_6__reduce_cython__(((struct __pyx_obj_9pywrapfst_Compiler *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_8Compiler_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Compiler.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_8Compiler_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_8Compiler_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_8Compiler_8__setstate_cython__(((struct __pyx_obj_9pywrapfst_Compiler *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_8Compiler_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_Compiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.Compiler.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4265 + * """ + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_9FarReader_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_9FarReader_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_9pywrapfst_9FarReader___init__(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_9FarReader___init__(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":4266 + * + * def __init__(self): + * raise FstDeletedConstructorError( # <<<<<<<<<<<<<< + * "Cannot construct {}".format(self.__class__.__name__)) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstDeletedConstructorError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":4267 + * def __init__(self): + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Cannot_construct, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4266, __pyx_L1_error) + + /* "pywrapfst.pyx":4265 + * """ + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pywrapfst.FarReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4269 + * "Cannot construct {}".format(self.__class__.__name__)) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} FarReader at 0x{:x}>".format(self.far_type(), id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_3__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_3__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_2__repr__(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_2__repr__(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":4270 + * + * def __repr__(self): + * return "<{} FarReader at 0x{:x}>".format(self.far_type(), id(self)) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FarReader_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "far_type"); + __PYX_ERR(0, 4270, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst_FarReader *)__pyx_v_self->__pyx_vtab)->far_type(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4270, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4270, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4269 + * "Cannot construct {}".format(self.__class__.__name__)) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} FarReader at 0x{:x}>".format(self.far_type(), id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.FarReader.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4273 + * + * @classmethod + * def open(cls, *filenames): # <<<<<<<<<<<<<< + * """ + * FarReader.open(*filenames) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_5open(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_4open[] = "\n FarReader.open(*filenames)\n\n Creates a FarReader object.\n\n This class method creates a FarReader given the string location of one or\n more FAR files on disk.\n\n Args:\n *filenames: The string location of one or more input FAR files.\n\n Returns:\n A new FarReader instance.\n\n Raises:\n FstIOError: Read failed.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_5open(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filenames = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("open (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "open", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_filenames = __pyx_args; + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_4open(((PyTypeObject*)__pyx_v_cls), __pyx_v_filenames); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_filenames); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_4open(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filenames) { + std::vector __pyx_v_filename_strings; + PyObject *__pyx_v_filename = NULL; + std::unique_ptr __pyx_v_tfar; + struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + std::string __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("open", 0); + + /* "pywrapfst.pyx":4292 + * """ + * cdef vector[string] filename_strings + * for filename in filenames: # <<<<<<<<<<<<<< + * filename_strings.push_back(tostring(filename)) + * cdef unique_ptr[fst.FarReaderClass] tfar + */ + __pyx_t_1 = __pyx_v_filenames; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 4292, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_filename, __pyx_t_3); + __pyx_t_3 = 0; + + /* "pywrapfst.pyx":4293 + * cdef vector[string] filename_strings + * for filename in filenames: + * filename_strings.push_back(tostring(filename)) # <<<<<<<<<<<<<< + * cdef unique_ptr[fst.FarReaderClass] tfar + * tfar.reset(fst.FarReaderClass.Open(filename_strings)) + */ + __pyx_t_4 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4293, __pyx_L1_error) + try { + __pyx_v_filename_strings.push_back(__pyx_t_4); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 4293, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4292 + * """ + * cdef vector[string] filename_strings + * for filename in filenames: # <<<<<<<<<<<<<< + * filename_strings.push_back(tostring(filename)) + * cdef unique_ptr[fst.FarReaderClass] tfar + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":4295 + * filename_strings.push_back(tostring(filename)) + * cdef unique_ptr[fst.FarReaderClass] tfar + * tfar.reset(fst.FarReaderClass.Open(filename_strings)) # <<<<<<<<<<<<<< + * if tfar.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filenames)) + */ + __pyx_v_tfar.reset(fst::script::FarReaderClass::Open(__pyx_v_filename_strings)); + + /* "pywrapfst.pyx":4296 + * cdef unique_ptr[fst.FarReaderClass] tfar + * tfar.reset(fst.FarReaderClass.Open(filename_strings)) + * if tfar.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filenames)) + * cdef FarReader result = FarReader.__new__(FarReader) + */ + __pyx_t_5 = ((__pyx_v_tfar.get() == NULL) != 0); + if (unlikely(__pyx_t_5)) { + + /* "pywrapfst.pyx":4297 + * tfar.reset(fst.FarReaderClass.Open(filename_strings)) + * if tfar.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filenames)) # <<<<<<<<<<<<<< + * cdef FarReader result = FarReader.__new__(FarReader) + * result._reader.reset(tfar.release()) + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Read_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_filenames) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_filenames); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4297, __pyx_L1_error) + + /* "pywrapfst.pyx":4296 + * cdef unique_ptr[fst.FarReaderClass] tfar + * tfar.reset(fst.FarReaderClass.Open(filename_strings)) + * if tfar.get() == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Read failed: {!r}".format(filenames)) + * cdef FarReader result = FarReader.__new__(FarReader) + */ + } + + /* "pywrapfst.pyx":4298 + * if tfar.get() == NULL: + * raise FstIOError("Read failed: {!r}".format(filenames)) + * cdef FarReader result = FarReader.__new__(FarReader) # <<<<<<<<<<<<<< + * result._reader.reset(tfar.release()) + * return result + */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_9pywrapfst_FarReader(((PyTypeObject *)__pyx_ptype_9pywrapfst_FarReader), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4298, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pywrapfst.pyx":4299 + * raise FstIOError("Read failed: {!r}".format(filenames)) + * cdef FarReader result = FarReader.__new__(FarReader) + * result._reader.reset(tfar.release()) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4299, __pyx_L1_error) + } + __pyx_v_result->_reader.reset(__pyx_v_tfar.release()); + + /* "pywrapfst.pyx":4300 + * cdef FarReader result = FarReader.__new__(FarReader) + * result._reader.reset(tfar.release()) + * return result # <<<<<<<<<<<<<< + * + * cpdef string arc_type(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "pywrapfst.pyx":4273 + * + * @classmethod + * def open(cls, *filenames): # <<<<<<<<<<<<<< + * """ + * FarReader.open(*filenames) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst.FarReader.open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_filename); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4302 + * return result + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_7arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_9FarReader_arc_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("arc_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_7arc_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4302, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4308 + * Returns a string indicating the arc type. + * """ + * return self._reader.get().ArcType() # <<<<<<<<<<<<<< + * + * cpdef bool done(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4308, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_reader.get()->ArcType(); + goto __pyx_L0; + + /* "pywrapfst.pyx":4302 + * return result + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarReader.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_7arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_6arc_type[] = "\n arc_type(self)\n\n Returns a string indicating the arc type.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_7arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arc_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_6arc_type(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_6arc_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("arc_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_9FarReader_arc_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4310 + * return self._reader.get().ArcType() + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_9FarReader_done(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("done", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_9done)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4310, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4319 + * True if the iterator is exhausted, False otherwise. + * """ + * return self._reader.get().Done() # <<<<<<<<<<<<<< + * + * cpdef bool error(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4319, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_reader.get()->Done(); + goto __pyx_L0; + + /* "pywrapfst.pyx":4310 + * return self._reader.get().ArcType() + * + * cpdef bool done(self): # <<<<<<<<<<<<<< + * """ + * done(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarReader.done", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_8done[] = "\n done(self)\n\n Indicates whether the iterator is exhausted or not.\n\n Returns:\n True if the iterator is exhausted, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_9done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("done (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_8done(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_8done(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("done", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_9FarReader_done(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.done", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4321 + * return self._reader.get().Done() + * + * cpdef bool error(self): # <<<<<<<<<<<<<< + * """ + * error(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_11error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_9FarReader_error(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("error", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_11error)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4321, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4330 + * True if the FarReader is in an errorful state, False otherwise. + * """ + * return self._reader.get().Error() # <<<<<<<<<<<<<< + * + * cpdef string far_type(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4330, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_reader.get()->Error(); + goto __pyx_L0; + + /* "pywrapfst.pyx":4321 + * return self._reader.get().Done() + * + * cpdef bool error(self): # <<<<<<<<<<<<<< + * """ + * error(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarReader.error", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_11error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_10error[] = "\n error(self)\n\n Indicates whether the FarReader has encountered an error.\n\n Returns:\n True if the FarReader is in an errorful state, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_11error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("error (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_10error(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_10error(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("error", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_9FarReader_error(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4332 + * return self._reader.get().Error() + * + * cpdef string far_type(self): # <<<<<<<<<<<<<< + * return fst.GetFarTypeString(self._reader.get().Type()) + * + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_13far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_9FarReader_far_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("far_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_far_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_13far_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4332, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4333 + * + * cpdef string far_type(self): + * return fst.GetFarTypeString(self._reader.get().Type()) # <<<<<<<<<<<<<< + * + * cpdef bool find(self, key) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4333, __pyx_L1_error) + } + __pyx_r = fst::GetFarTypeString(__pyx_v_self->_reader.get()->Type()); + goto __pyx_L0; + + /* "pywrapfst.pyx":4332 + * return self._reader.get().Error() + * + * cpdef string far_type(self): # <<<<<<<<<<<<<< + * return fst.GetFarTypeString(self._reader.get().Type()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarReader.far_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_13far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_13far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("far_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_12far_type(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_12far_type(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("far_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_9FarReader_far_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.far_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4335 + * return fst.GetFarTypeString(self._reader.get().Type()) + * + * cpdef bool find(self, key) except *: # <<<<<<<<<<<<<< + * """ + * find(self, key) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_15find(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static bool __pyx_f_9pywrapfst_9FarReader_find(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + std::string __pyx_t_6; + __Pyx_RefNannySetupContext("find", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_find); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_15find)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4335, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4348 + * True if the key was found, False otherwise. + * """ + * return self._reader.get().Find(tostring(key)) # <<<<<<<<<<<<<< + * + * cpdef _Fst get_fst(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4348, __pyx_L1_error) + } + __pyx_t_6 = __pyx_f_9pywrapfst_tostring(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4348, __pyx_L1_error) + __pyx_r = __pyx_v_self->_reader.get()->Find(__pyx_t_6); + goto __pyx_L0; + + /* "pywrapfst.pyx":4335 + * return fst.GetFarTypeString(self._reader.get().Type()) + * + * cpdef bool find(self, key) except *: # <<<<<<<<<<<<<< + * """ + * find(self, key) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.FarReader.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_15find(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_14find[] = "\n find(self, key)\n\n Sets the current position to the first entry greater than or equal to the\n key (a string) and indicates whether or not a match was found.\n\n Args:\n key: A string key.\n\n Returns:\n True if the key was found, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_15find(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_14find(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_14find(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + bool __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("find", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9pywrapfst_9FarReader_find(__pyx_v_self, __pyx_v_key, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4335, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pywrapfst.FarReader.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4350 + * return self._reader.get().Find(tostring(key)) + * + * cpdef _Fst get_fst(self): # <<<<<<<<<<<<<< + * """ + * get_fst(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_17get_fst(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_9pywrapfst__Fst *__pyx_f_9pywrapfst_9FarReader_get_fst(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_9pywrapfst__Fst *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("get_fst", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_fst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4350, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_17get_fst)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4350, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9pywrapfst__Fst))))) __PYX_ERR(0, 4350, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4359 + * A copy of the FST at the current position. + * """ + * return _init_XFst(new fst.FstClass( # <<<<<<<<<<<<<< + * deref(self._reader.get().GetFstClass()))) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + + /* "pywrapfst.pyx":4360 + * """ + * return _init_XFst(new fst.FstClass( + * deref(self._reader.get().GetFstClass()))) # <<<<<<<<<<<<<< + * + * cpdef string get_key(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4360, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4359 + * A copy of the FST at the current position. + * """ + * return _init_XFst(new fst.FstClass( # <<<<<<<<<<<<<< + * deref(self._reader.get().GetFstClass()))) + * + */ + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst__init_XFst(new fst::script::FstClass((*__pyx_v_self->_reader.get()->GetFstClass())))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4350 + * return self._reader.get().Find(tostring(key)) + * + * cpdef _Fst get_fst(self): # <<<<<<<<<<<<<< + * """ + * get_fst(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pywrapfst.FarReader.get_fst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_17get_fst(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_16get_fst[] = "\n get_fst(self)\n\n Returns the FST at the current position.\n\n Returns:\n A copy of the FST at the current position.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_17get_fst(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_fst (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_16get_fst(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_16get_fst(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_fst", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_9pywrapfst_9FarReader_get_fst(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4350, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.get_fst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4362 + * deref(self._reader.get().GetFstClass()))) + * + * cpdef string get_key(self): # <<<<<<<<<<<<<< + * """ + * get_key(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_19get_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_9FarReader_get_key(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("get_key", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_19get_key)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4362, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4371 + * The string key at the current position. + * """ + * return self._reader.get().GetKey() # <<<<<<<<<<<<<< + * + * cpdef void next(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4371, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_reader.get()->GetKey(); + goto __pyx_L0; + + /* "pywrapfst.pyx":4362 + * deref(self._reader.get().GetFstClass()))) + * + * cpdef string get_key(self): # <<<<<<<<<<<<<< + * """ + * get_key(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarReader.get_key", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_19get_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_18get_key[] = "\n get_key(self)\n\n Returns the string key at the current position.\n\n Returns:\n The string key at the current position.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_19get_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_key (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_18get_key(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_18get_key(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_key", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_9FarReader_get_key(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.get_key", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4373 + * return self._reader.get().GetKey() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_21next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_9FarReader_next(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("next", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_21next)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4379 + * Advances the iterator. + * """ + * self._reader.get().Next() # <<<<<<<<<<<<<< + * + * cpdef void reset(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4379, __pyx_L1_error) + } + __pyx_v_self->_reader.get()->Next(); + + /* "pywrapfst.pyx":4373 + * return self._reader.get().GetKey() + * + * cpdef void next(self): # <<<<<<<<<<<<<< + * """ + * next(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarReader.next", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_21next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_20next[] = "\n next(self)\n\n Advances the iterator.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_21next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("next (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_20next(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_20next(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("next", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_9FarReader_next(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.next", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4381 + * self._reader.get().Next() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarReader_23reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_9pywrapfst_9FarReader_reset(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarReader_23reset)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4387 + * Resets the iterator to the initial position. + * """ + * self._reader.get().Reset() # <<<<<<<<<<<<<< + * + * def __getitem__(self, key): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4387, __pyx_L1_error) + } + __pyx_v_self->_reader.get()->Reset(); + + /* "pywrapfst.pyx":4381 + * self._reader.get().Next() + * + * cpdef void reset(self): # <<<<<<<<<<<<<< + * """ + * reset(self) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarReader.reset", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_23reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarReader_22reset[] = "\n reset(self)\n\n Resets the iterator to the initial position.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarReader_23reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_22reset(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_22reset(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_9pywrapfst_9FarReader_reset(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4389 + * self._reader.get().Reset() + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * if self._reader.get().Find(tostring(key)): + * return self.get_fst() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_25__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_25__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_24__getitem__(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_24__getitem__(struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "pywrapfst.pyx":4390 + * + * def __getitem__(self, key): + * if self._reader.get().Find(tostring(key)): # <<<<<<<<<<<<<< + * return self.get_fst() + * else: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader"); + __PYX_ERR(0, 4390, __pyx_L1_error) + } + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4390, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_self->_reader.get()->Find(__pyx_t_1) != 0); + if (likely(__pyx_t_2)) { + + /* "pywrapfst.pyx":4391 + * def __getitem__(self, key): + * if self._reader.get().Find(tostring(key)): + * return self.get_fst() # <<<<<<<<<<<<<< + * else: + * raise KeyError(key) + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get_fst"); + __PYX_ERR(0, 4391, __pyx_L1_error) + } + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_9pywrapfst_FarReader *)__pyx_v_self->__pyx_vtab)->get_fst(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4390 + * + * def __getitem__(self, key): + * if self._reader.get().Find(tostring(key)): # <<<<<<<<<<<<<< + * return self.get_fst() + * else: + */ + } + + /* "pywrapfst.pyx":4393 + * return self.get_fst() + * else: + * raise KeyError(key) # <<<<<<<<<<<<<< + * + * + */ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 4393, __pyx_L1_error) + } + + /* "pywrapfst.pyx":4389 + * self._reader.get().Reset() + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * if self._reader.get().Find(tostring(key)): + * return self.get_fst() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pywrapfst.FarReader.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_26__reduce_cython__(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarReader_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarReader_28__setstate_cython__(((struct __pyx_obj_9pywrapfst_FarReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarReader_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4416 + * """ + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_9FarWriter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_9pywrapfst_9FarWriter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter___init__(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_9FarWriter___init__(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pywrapfst.pyx":4417 + * + * def __init__(self): + * raise FstDeletedConstructorError( # <<<<<<<<<<<<<< + * "Cannot construct {}".format(self.__class__.__name__)) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstDeletedConstructorError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":4418 + * def __init__(self): + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Cannot_construct, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4417, __pyx_L1_error) + + /* "pywrapfst.pyx":4416 + * """ + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise FstDeletedConstructorError( + * "Cannot construct {}".format(self.__class__.__name__)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pywrapfst.FarWriter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4420 + * "Cannot construct {}".format(self.__class__.__name__)) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} FarWriter at 0x{:x}>".format(self.far_type(), id(self)) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_3__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_3__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_2__repr__(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_2__repr__(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "pywrapfst.pyx":4421 + * + * def __repr__(self): + * return "<{} FarWriter at 0x{:x}>".format(self.far_type(), id(self)) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FarWriter_at_0x_x, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "far_type"); + __PYX_ERR(0, 4421, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_9pywrapfst_FarWriter *)__pyx_v_self->__pyx_vtab)->far_type(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4421, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4421, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pywrapfst.pyx":4420 + * "Cannot construct {}".format(self.__class__.__name__)) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<{} FarWriter at 0x{:x}>".format(self.far_type(), id(self)) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pywrapfst.FarWriter.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4424 + * + * @classmethod + * def create(cls, filename, arc_type=b"standard", far_type=b"default"): # <<<<<<<<<<<<<< + * """ + * FarWriter. + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_5create(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarWriter_4create[] = "\n FarWriter.\n\n Creates a FarWriter object.\n\n This class method creates a FarWriter given the desired output location,\n arc type, and FAR type.\n\n Args:\n filename: The string location for the output FAR files.\n arc_type: A string indicating the arc type.\n far_type: A string indicating the FAR type; one of: \"fst\", \"stlist\",\n \"sttable\", \"sstable\", \"default\".\n\n Returns:\n A new FarWriter instance.\n\n Raises:\n FstIOError: Read failed.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_5create(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + PyObject *__pyx_v_arc_type = 0; + PyObject *__pyx_v_far_type = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_arc_type,&__pyx_n_s_far_type,0}; + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_n_b_standard); + values[2] = ((PyObject *)__pyx_n_b_default); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arc_type); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_far_type); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(0, 4424, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_filename = values[0]; + __pyx_v_arc_type = values[1]; + __pyx_v_far_type = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("create", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4424, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.FarWriter.create", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_4create(((PyTypeObject*)__pyx_v_cls), __pyx_v_filename, __pyx_v_arc_type, __pyx_v_far_type); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_4create(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_far_type) { + enum fst::FarType __pyx_v_ft; + fst::script::FarWriterClass *__pyx_v_tfar; + struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + std::string __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("create", 0); + + /* "pywrapfst.pyx":4445 + * FstIOError: Read failed. + * """ + * cdef fst.FarType ft = fst.GetFarType(tostring(far_type)) # <<<<<<<<<<<<<< + * cdef fst.FarWriterClass *tfar = fst.FarWriterClass.Create( + * tostring(filename), tostring(arc_type), ft) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_far_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4445, __pyx_L1_error) + __pyx_v_ft = fst::script::GetFarType(__pyx_t_1); + + /* "pywrapfst.pyx":4447 + * cdef fst.FarType ft = fst.GetFarType(tostring(far_type)) + * cdef fst.FarWriterClass *tfar = fst.FarWriterClass.Create( + * tostring(filename), tostring(arc_type), ft) # <<<<<<<<<<<<<< + * if tfar == NULL: + * raise FstIOError("Open failed: {!r}".format(filename)) + */ + __pyx_t_1 = __pyx_f_9pywrapfst_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4447, __pyx_L1_error) + __pyx_t_2 = __pyx_f_9pywrapfst_tostring(__pyx_v_arc_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4447, __pyx_L1_error) + + /* "pywrapfst.pyx":4446 + * """ + * cdef fst.FarType ft = fst.GetFarType(tostring(far_type)) + * cdef fst.FarWriterClass *tfar = fst.FarWriterClass.Create( # <<<<<<<<<<<<<< + * tostring(filename), tostring(arc_type), ft) + * if tfar == NULL: + */ + __pyx_v_tfar = fst::script::FarWriterClass::Create(__pyx_t_1, __pyx_t_2, __pyx_v_ft); + + /* "pywrapfst.pyx":4448 + * cdef fst.FarWriterClass *tfar = fst.FarWriterClass.Create( + * tostring(filename), tostring(arc_type), ft) + * if tfar == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Open failed: {!r}".format(filename)) + * cdef FarWriter result = FarWriter.__new__(FarWriter) + */ + __pyx_t_3 = ((__pyx_v_tfar == NULL) != 0); + if (unlikely(__pyx_t_3)) { + + /* "pywrapfst.pyx":4449 + * tostring(filename), tostring(arc_type), ft) + * if tfar == NULL: + * raise FstIOError("Open failed: {!r}".format(filename)) # <<<<<<<<<<<<<< + * cdef FarWriter result = FarWriter.__new__(FarWriter) + * result._writer.reset(tfar) + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Open_failed_r, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_filename); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 4449, __pyx_L1_error) + + /* "pywrapfst.pyx":4448 + * cdef fst.FarWriterClass *tfar = fst.FarWriterClass.Create( + * tostring(filename), tostring(arc_type), ft) + * if tfar == NULL: # <<<<<<<<<<<<<< + * raise FstIOError("Open failed: {!r}".format(filename)) + * cdef FarWriter result = FarWriter.__new__(FarWriter) + */ + } + + /* "pywrapfst.pyx":4450 + * if tfar == NULL: + * raise FstIOError("Open failed: {!r}".format(filename)) + * cdef FarWriter result = FarWriter.__new__(FarWriter) # <<<<<<<<<<<<<< + * result._writer.reset(tfar) + * return result + */ + __pyx_t_4 = ((PyObject *)__pyx_tp_new_9pywrapfst_FarWriter(((PyTypeObject *)__pyx_ptype_9pywrapfst_FarWriter), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4450, __pyx_L1_error) + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_v_result = ((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "pywrapfst.pyx":4451 + * raise FstIOError("Open failed: {!r}".format(filename)) + * cdef FarWriter result = FarWriter.__new__(FarWriter) + * result._writer.reset(tfar) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer"); + __PYX_ERR(0, 4451, __pyx_L1_error) + } + __pyx_v_result->_writer.reset(__pyx_v_tfar); + + /* "pywrapfst.pyx":4452 + * cdef FarWriter result = FarWriter.__new__(FarWriter) + * result._writer.reset(tfar) + * return result # <<<<<<<<<<<<<< + * + * # NB: Invoking this method may be dangerous: calling any other method on the + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "pywrapfst.pyx":4424 + * + * @classmethod + * def create(cls, filename, arc_type=b"standard", far_type=b"default"): # <<<<<<<<<<<<<< + * """ + * FarWriter. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pywrapfst.FarWriter.create", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4456 + * # NB: Invoking this method may be dangerous: calling any other method on the + * # instance after this is invoked may result in a null dereference. + * cdef void close(self): # <<<<<<<<<<<<<< + * self._writer.reset() + * + */ + +static void __pyx_f_9pywrapfst_9FarWriter_close(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close", 0); + + /* "pywrapfst.pyx":4457 + * # instance after this is invoked may result in a null dereference. + * cdef void close(self): + * self._writer.reset() # <<<<<<<<<<<<<< + * + * cpdef void add(self, key, _Fst ifst) except *: + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer"); + __PYX_ERR(0, 4457, __pyx_L1_error) + } + __pyx_v_self->_writer.reset(); + + /* "pywrapfst.pyx":4456 + * # NB: Invoking this method may be dangerous: calling any other method on the + * # instance after this is invoked may result in a null dereference. + * cdef void close(self): # <<<<<<<<<<<<<< + * self._writer.reset() + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("pywrapfst.FarWriter.close", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "pywrapfst.pyx":4459 + * self._writer.reset() + * + * cpdef void add(self, key, _Fst ifst) except *: # <<<<<<<<<<<<<< + * """ + * add(self, key, ifst) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_7add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_9pywrapfst_9FarWriter_add(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst, int __pyx_skip_dispatch) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + std::string __pyx_t_7; + int __pyx_t_8; + __Pyx_RefNannySetupContext("add", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarWriter_7add)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, ((PyObject *)__pyx_v_ifst)}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4459, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, ((PyObject *)__pyx_v_ifst)}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4459, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_key); + __Pyx_INCREF(((PyObject *)__pyx_v_ifst)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ifst)); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_ifst)); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4478 + * # Failure here results from passing an FST with a different arc type than + * # used by the FAR was initialized to use. + * if not self._writer.get().Add(tostring(key), deref(ifst._fst)): # <<<<<<<<<<<<<< + * raise FstOpError("Incompatible or invalid arc type") + * # An error here usually indicates a key out of order. + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer"); + __PYX_ERR(0, 4478, __pyx_L1_error) + } + __pyx_t_7 = __pyx_f_9pywrapfst_tostring(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4478, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_ifst) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst"); + __PYX_ERR(0, 4478, __pyx_L1_error) + } + __pyx_t_8 = ((!(__pyx_v_self->_writer.get()->Add(__pyx_t_7, (*__pyx_v_ifst->_fst)) != 0)) != 0); + if (unlikely(__pyx_t_8)) { + + /* "pywrapfst.pyx":4479 + * # used by the FAR was initialized to use. + * if not self._writer.get().Add(tostring(key), deref(ifst._fst)): + * raise FstOpError("Incompatible or invalid arc type") # <<<<<<<<<<<<<< + * # An error here usually indicates a key out of order. + * if self._writer.get().Error(): + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Incompatible_or_invalid_arc_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Incompatible_or_invalid_arc_type); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4479, __pyx_L1_error) + + /* "pywrapfst.pyx":4478 + * # Failure here results from passing an FST with a different arc type than + * # used by the FAR was initialized to use. + * if not self._writer.get().Add(tostring(key), deref(ifst._fst)): # <<<<<<<<<<<<<< + * raise FstOpError("Incompatible or invalid arc type") + * # An error here usually indicates a key out of order. + */ + } + + /* "pywrapfst.pyx":4481 + * raise FstOpError("Incompatible or invalid arc type") + * # An error here usually indicates a key out of order. + * if self._writer.get().Error(): # <<<<<<<<<<<<<< + * raise FstArgError("Key out of order") + * + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer"); + __PYX_ERR(0, 4481, __pyx_L1_error) + } + __pyx_t_8 = (__pyx_v_self->_writer.get()->Error() != 0); + if (unlikely(__pyx_t_8)) { + + /* "pywrapfst.pyx":4482 + * # An error here usually indicates a key out of order. + * if self._writer.get().Error(): + * raise FstArgError("Key out of order") # <<<<<<<<<<<<<< + * + * cpdef string arc_type(self): + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Key_out_of_order) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Key_out_of_order); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4482, __pyx_L1_error) + + /* "pywrapfst.pyx":4481 + * raise FstOpError("Incompatible or invalid arc type") + * # An error here usually indicates a key out of order. + * if self._writer.get().Error(): # <<<<<<<<<<<<<< + * raise FstArgError("Key out of order") + * + */ + } + + /* "pywrapfst.pyx":4459 + * self._writer.reset() + * + * cpdef void add(self, key, _Fst ifst) except *: # <<<<<<<<<<<<<< + * """ + * add(self, key, ifst) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pywrapfst.FarWriter.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_7add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarWriter_6add[] = "\n add(self, key, ifst)\n\n Adds an FST to the FAR.\n\n This method adds an FST to the FAR which can be retrieved with the\n specified string key.\n\n Args:\n key: The string used to key the input FST.\n ifst: The FST to write to the FAR.\n\n Raises:\n FstArgError: Key out of order.\n FstOpError: Incompatible or invalid arc type.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_7add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_key = 0; + struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_ifst,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ifst)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, 1); __PYX_ERR(0, 4459, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(0, 4459, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_key = values[0]; + __pyx_v_ifst = ((struct __pyx_obj_9pywrapfst__Fst *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4459, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pywrapfst.FarWriter.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ifst), __pyx_ptype_9pywrapfst__Fst, 1, "ifst", 0))) __PYX_ERR(0, 4459, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_6add(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self), __pyx_v_key, __pyx_v_ifst); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_6add(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_ifst) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("add", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_9pywrapfst_9FarWriter_add(__pyx_v_self, __pyx_v_key, __pyx_v_ifst, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4459, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarWriter.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4484 + * raise FstArgError("Key out of order") + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_9arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_9FarWriter_arc_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("arc_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarWriter_9arc_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4484, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4490 + * Returns a string indicating the arc type. + * """ + * return self._writer.get().ArcType() # <<<<<<<<<<<<<< + * + * cpdef bool error(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer"); + __PYX_ERR(0, 4490, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_writer.get()->ArcType(); + goto __pyx_L0; + + /* "pywrapfst.pyx":4484 + * raise FstArgError("Key out of order") + * + * cpdef string arc_type(self): # <<<<<<<<<<<<<< + * """ + * arc_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarWriter.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_9arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarWriter_8arc_type[] = "\n arc_type(self)\n\n Returns a string indicating the arc type.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_9arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arc_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_8arc_type(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_8arc_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("arc_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_9FarWriter_arc_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarWriter.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4492 + * return self._writer.get().ArcType() + * + * cpdef bool error(self): # <<<<<<<<<<<<<< + * """ + * error(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_11error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static bool __pyx_f_9pywrapfst_9FarWriter_error(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, int __pyx_skip_dispatch) { + bool __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + bool __pyx_t_5; + __Pyx_RefNannySetupContext("error", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarWriter_11error)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4492, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4501 + * True if the FarWriter is in an errorful state, False otherwise. + * """ + * return self._writer.get().Error() # <<<<<<<<<<<<<< + * + * cpdef string far_type(self): + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer"); + __PYX_ERR(0, 4501, __pyx_L1_error) + } + __pyx_r = __pyx_v_self->_writer.get()->Error(); + goto __pyx_L0; + + /* "pywrapfst.pyx":4492 + * return self._writer.get().ArcType() + * + * cpdef bool error(self): # <<<<<<<<<<<<<< + * """ + * error(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarWriter.error", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_11error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarWriter_10error[] = "\n error(self)\n\n Indicates whether the FarWriter has encountered an error.\n\n Returns:\n True if the FarWriter is in an errorful state, False otherwise.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_11error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("error (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_10error(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_10error(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("error", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_9pywrapfst_9FarWriter_error(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarWriter.error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4503 + * return self._writer.get().Error() + * + * cpdef string far_type(self): # <<<<<<<<<<<<<< + * """ + * far_type(self) + */ + +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_13far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static std::string __pyx_f_9pywrapfst_9FarWriter_far_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, int __pyx_skip_dispatch) { + std::string __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("far_type", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_far_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9pywrapfst_9FarWriter_13far_type)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4503, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "pywrapfst.pyx":4509 + * Returns a string indicating the FAR type. + * """ + * return fst.GetFarTypeString(self._writer.get().Type()) # <<<<<<<<<<<<<< + * + * # Dictionary-like assignment. + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer"); + __PYX_ERR(0, 4509, __pyx_L1_error) + } + __pyx_r = fst::GetFarTypeString(__pyx_v_self->_writer.get()->Type()); + goto __pyx_L0; + + /* "pywrapfst.pyx":4503 + * return self._writer.get().Error() + * + * cpdef string far_type(self): # <<<<<<<<<<<<<< + * """ + * far_type(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("pywrapfst.FarWriter.far_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_13far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9pywrapfst_9FarWriter_12far_type[] = "\n far_type(self)\n\n Returns a string indicating the FAR type.\n "; +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_13far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("far_type (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_12far_type(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_12far_type(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("far_type", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_9pywrapfst_9FarWriter_far_type(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarWriter.far_type", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pywrapfst.pyx":4512 + * + * # Dictionary-like assignment. + * def __setitem__(self, key, _Fst fst): # <<<<<<<<<<<<<< + * self.add(key, fst) + * + */ + +/* Python wrapper */ +static int __pyx_pw_9pywrapfst_9FarWriter_15__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_fst); /*proto*/ +static int __pyx_pw_9pywrapfst_9FarWriter_15__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_fst) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fst), __pyx_ptype_9pywrapfst__Fst, 1, "fst", 0))) __PYX_ERR(0, 4512, __pyx_L1_error) + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_14__setitem__(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((struct __pyx_obj_9pywrapfst__Fst *)__pyx_v_fst)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_9pywrapfst_9FarWriter_14__setitem__(struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_9pywrapfst__Fst *__pyx_v_fst) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "pywrapfst.pyx":4513 + * # Dictionary-like assignment. + * def __setitem__(self, key, _Fst fst): + * self.add(key, fst) # <<<<<<<<<<<<<< + * + * # Masks fst_error_fatal in-module. + */ + if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add"); + __PYX_ERR(0, 4513, __pyx_L1_error) + } + ((struct __pyx_vtabstruct_9pywrapfst_FarWriter *)__pyx_v_self->__pyx_vtab)->add(__pyx_v_self, __pyx_v_key, __pyx_v_fst, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4513, __pyx_L1_error) + + /* "pywrapfst.pyx":4512 + * + * # Dictionary-like assignment. + * def __setitem__(self, key, _Fst fst): # <<<<<<<<<<<<<< + * self.add(key, fst) + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pywrapfst.FarWriter.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_16__reduce_cython__(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarWriter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_9pywrapfst_9FarWriter_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_9pywrapfst_9FarWriter_18__setstate_cython__(((struct __pyx_obj_9pywrapfst_FarWriter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9pywrapfst_9FarWriter_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9pywrapfst_FarWriter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pywrapfst.FarWriter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { + Py_ssize_t __pyx_v_length; + char const *__pyx_v_data; + std::string __pyx_r; + __Pyx_RefNannyDeclarations + char const *__pyx_t_1; + __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); + + /* "string.from_py":15 + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: + * cdef Py_ssize_t length + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< + * return string(data, length) + * + */ + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) + __pyx_v_data = __pyx_t_1; + + /* "string.from_py":16 + * cdef Py_ssize_t length + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = std::string(__pyx_v_data, __pyx_v_length); + goto __pyx_L0; + + /* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); + + /* "string.to_py":32 + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); + + /* "string.to_py":38 + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); + + /* "string.to_py":44 + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); + + /* "string.to_py":50 + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); + + /* "string.to_py":56 + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py___pyx_t_10basictypes_int64") + * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + +static std::vector<__pyx_t_10basictypes_int64> __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(PyObject *__pyx_v_o) { + std::vector<__pyx_t_10basictypes_int64> __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector<__pyx_t_10basictypes_int64> __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + __pyx_t_10basictypes_int64 __pyx_t_5; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py___pyx_t_10basictypes_int64", 0); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 47, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_v_item); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(((__pyx_t_10basictypes_int64)__pyx_t_5)); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py___pyx_t_10basictypes_int64") + * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py___pyx_t_10basictypes_int64", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_9pywrapfst_Weight __pyx_vtable_9pywrapfst_Weight; + +static PyObject *__pyx_tp_new_9pywrapfst_Weight(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_Weight *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_Weight *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_Weight; + new((void*)&(p->_weight)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_Weight(PyObject *o) { + struct __pyx_obj_9pywrapfst_Weight *p = (struct __pyx_obj_9pywrapfst_Weight *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_weight); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_tp_richcompare_9pywrapfst_Weight(PyObject *o1, PyObject *o2, int op) { + switch (op) { + case Py_EQ: { + return __pyx_pw_9pywrapfst_6Weight_17__eq__(o1, o2); + } + case Py_NE: { + return __pyx_pw_9pywrapfst_6Weight_19__ne__(o1, o2); + } + default: { + return __Pyx_NewRef(Py_NotImplemented); + } + } +} + +static PyMethodDef __pyx_methods_9pywrapfst_Weight[] = { + {"copy", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_9copy, METH_NOARGS, __pyx_doc_9pywrapfst_6Weight_8copy}, + {"Zero", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_11Zero, METH_O, __pyx_doc_9pywrapfst_6Weight_10Zero}, + {"One", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_13One, METH_O, __pyx_doc_9pywrapfst_6Weight_12One}, + {"NoWeight", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_15NoWeight, METH_O, __pyx_doc_9pywrapfst_6Weight_14NoWeight}, + {"to_string", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_21to_string, METH_NOARGS, 0}, + {"type", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_23type, METH_NOARGS, __pyx_doc_9pywrapfst_6Weight_22type}, + {"member", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_25member, METH_NOARGS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_27__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_6Weight_29__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Weight = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_9pywrapfst_6Weight_5__float__, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + 0, /*nb_index*/ + #if PY_VERSION_HEX >= 0x03050000 + 0, /*nb_matrix_multiply*/ + #endif + #if PY_VERSION_HEX >= 0x03050000 + 0, /*nb_inplace_matrix_multiply*/ + #endif +}; + +static PyTypeObject __pyx_type_9pywrapfst_Weight = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.Weight", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_Weight), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_Weight, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_6Weight_1__repr__, /*tp_repr*/ + &__pyx_tp_as_number_Weight, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_9pywrapfst_6Weight_3__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n Weight(weight_type, weight_string)\n\n FST weight class.\n\n This class represents an FST weight. When passed as an argument to an FST\n operation, it should have the weight type of the input FST(s) to said\n operation.\n\n Args:\n weight_type: A string indicating the weight type.\n weight_string: A string indicating the underlying weight.\n\n Raises:\n FstArgError: Weight type not found.\n FstBadWeightError: Invalid weight.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + __pyx_tp_richcompare_9pywrapfst_Weight, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_Weight, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_6Weight_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_Weight, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst__SymbolTable __pyx_vtable_9pywrapfst__SymbolTable; + +static PyObject *__pyx_tp_new_9pywrapfst__SymbolTable(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst__SymbolTable *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst__SymbolTable *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst__SymbolTable; + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst__SymbolTable(PyObject *o) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst__SymbolTable[] = { + {"__reduce__", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_5__reduce__, METH_NOARGS, 0}, + {"available_key", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_7available_key, METH_NOARGS, __pyx_doc_9pywrapfst_12_SymbolTable_6available_key}, + {"checksum", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_9checksum, METH_NOARGS, __pyx_doc_9pywrapfst_12_SymbolTable_8checksum}, + {"copy", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_11copy, METH_NOARGS, __pyx_doc_9pywrapfst_12_SymbolTable_10copy}, + {"find", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_13find, METH_O, __pyx_doc_9pywrapfst_12_SymbolTable_12find}, + {"get_nth_key", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_15get_nth_key, METH_O, __pyx_doc_9pywrapfst_12_SymbolTable_14get_nth_key}, + {"labeled_checksum", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_17labeled_checksum, METH_NOARGS, __pyx_doc_9pywrapfst_12_SymbolTable_16labeled_checksum}, + {"member", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_19member, METH_O, __pyx_doc_9pywrapfst_12_SymbolTable_18member}, + {"name", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_23name, METH_NOARGS, __pyx_doc_9pywrapfst_12_SymbolTable_22name}, + {"num_symbols", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_25num_symbols, METH_NOARGS, __pyx_doc_9pywrapfst_12_SymbolTable_24num_symbols}, + {"write", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_27write, METH_O, __pyx_doc_9pywrapfst_12_SymbolTable_26write}, + {"write_text", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_29write_text, METH_O, __pyx_doc_9pywrapfst_12_SymbolTable_28write_text}, + {"write_to_string", (PyCFunction)__pyx_pw_9pywrapfst_12_SymbolTable_31write_to_string, METH_NOARGS, __pyx_doc_9pywrapfst_12_SymbolTable_30write_to_string}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence__SymbolTable = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_9pywrapfst_12_SymbolTable_21__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyTypeObject __pyx_type_9pywrapfst__SymbolTable = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst._SymbolTable", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst__SymbolTable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst__SymbolTable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence__SymbolTable, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n Base class for the symbol table hierarchy.\n\n This class is the base class for SymbolTable. It has a \"deleted\" constructor\n and implementations for the const methods of the wrapped SymbolTable.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_9pywrapfst_12_SymbolTable_3__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst__SymbolTable, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_12_SymbolTable_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst__SymbolTable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst__EncodeMapperSymbolTable __pyx_vtable_9pywrapfst__EncodeMapperSymbolTable; + +static PyObject *__pyx_tp_new_9pywrapfst__EncodeMapperSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *p; + PyObject *o = __pyx_tp_new_9pywrapfst__SymbolTable(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9pywrapfst__SymbolTable*)__pyx_vtabptr_9pywrapfst__EncodeMapperSymbolTable; + new((void*)&(p->_encoder)) std::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst__EncodeMapperSymbolTable(PyObject *o) { + struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *p = (struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_encoder); + __pyx_tp_dealloc_9pywrapfst__SymbolTable(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst__EncodeMapperSymbolTable[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst__EncodeMapperSymbolTable = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst._EncodeMapperSymbolTable", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst__EncodeMapperSymbolTable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_24_EncodeMapperSymbolTable_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n Immutable SymbolTable class for tables stored in an EncodeMapper.\n\n This class wraps a library const SymbolTable and exposes const methods of the\n wrapped object. It is only to be returned by method, never constructed\n directly.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_3__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst__EncodeMapperSymbolTable, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst__EncodeMapperSymbolTable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst__FstSymbolTable __pyx_vtable_9pywrapfst__FstSymbolTable; + +static PyObject *__pyx_tp_new_9pywrapfst__FstSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9pywrapfst__FstSymbolTable *p; + PyObject *o = __pyx_tp_new_9pywrapfst__SymbolTable(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst__FstSymbolTable *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9pywrapfst__SymbolTable*)__pyx_vtabptr_9pywrapfst__FstSymbolTable; + new((void*)&(p->_fst)) std::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst__FstSymbolTable(PyObject *o) { + struct __pyx_obj_9pywrapfst__FstSymbolTable *p = (struct __pyx_obj_9pywrapfst__FstSymbolTable *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_fst); + __pyx_tp_dealloc_9pywrapfst__SymbolTable(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst__FstSymbolTable[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst__FstSymbolTable = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst._FstSymbolTable", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst__FstSymbolTable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst__FstSymbolTable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_15_FstSymbolTable_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n Mutable SymbolTable class for tables stored in a mutable FST.\n\n This class wraps a library SymbolTable and exposes methods of the wrapped\n object. It is only to be returned by method, never constructed directly.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_3__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst__FstSymbolTable, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst__FstSymbolTable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst__MutableSymbolTable __pyx_vtable_9pywrapfst__MutableSymbolTable; + +static PyObject *__pyx_tp_new_9pywrapfst__MutableSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9pywrapfst__MutableSymbolTable *p; + PyObject *o = __pyx_tp_new_9pywrapfst__SymbolTable(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst__MutableSymbolTable *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9pywrapfst__SymbolTable*)__pyx_vtabptr_9pywrapfst__MutableSymbolTable; + return o; +} + +static PyMethodDef __pyx_methods_9pywrapfst__MutableSymbolTable[] = { + {"add_symbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_19_MutableSymbolTable_1add_symbol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_19_MutableSymbolTable_add_symbol}, + {"add_table", (PyCFunction)__pyx_pw_9pywrapfst_19_MutableSymbolTable_3add_table, METH_O, __pyx_doc_9pywrapfst_19_MutableSymbolTable_2add_table}, + {"set_name", (PyCFunction)__pyx_pw_9pywrapfst_19_MutableSymbolTable_5set_name, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst__MutableSymbolTable = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst._MutableSymbolTable", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst__MutableSymbolTable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst__SymbolTable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n Base class for mutable symbol tables.\n\n This class is the base class for a mutable SymbolTable. It has a \"deleted\"\n constructor and implementations of all methods of the wrapped SymbolTable.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_3__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst__MutableSymbolTable, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst__MutableSymbolTable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst__MutableFstSymbolTable __pyx_vtable_9pywrapfst__MutableFstSymbolTable; + +static PyObject *__pyx_tp_new_9pywrapfst__MutableFstSymbolTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *p; + PyObject *o = __pyx_tp_new_9pywrapfst__MutableSymbolTable(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9pywrapfst__SymbolTable*)__pyx_vtabptr_9pywrapfst__MutableFstSymbolTable; + new((void*)&(p->_mfst)) std::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst__MutableFstSymbolTable(PyObject *o) { + struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *p = (struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_mfst); + __pyx_tp_dealloc_9pywrapfst__SymbolTable(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst__MutableFstSymbolTable[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst__MutableFstSymbolTable = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst._MutableFstSymbolTable", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst__MutableFstSymbolTable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst__MutableFstSymbolTable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_22_MutableFstSymbolTable_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n Mutable SymbolTable assigned to an FST.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_3__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst__MutableFstSymbolTable, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst__MutableFstSymbolTable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_SymbolTable __pyx_vtable_9pywrapfst_SymbolTable; + +static PyObject *__pyx_tp_new_9pywrapfst_SymbolTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9pywrapfst_SymbolTable *p; + PyObject *o = __pyx_tp_new_9pywrapfst__MutableSymbolTable(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_SymbolTable *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9pywrapfst__SymbolTable*)__pyx_vtabptr_9pywrapfst_SymbolTable; + new((void*)&(p->_smart_table)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_SymbolTable(PyObject *o) { + struct __pyx_obj_9pywrapfst_SymbolTable *p = (struct __pyx_obj_9pywrapfst_SymbolTable *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_smart_table); + __pyx_tp_dealloc_9pywrapfst__SymbolTable(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst_SymbolTable[] = { + {"read", (PyCFunction)__pyx_pw_9pywrapfst_11SymbolTable_5read, METH_O, __pyx_doc_9pywrapfst_11SymbolTable_4read}, + {"read_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11SymbolTable_7read_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11SymbolTable_6read_text}, + {"read_fst", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11SymbolTable_9read_fst, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11SymbolTable_8read_fst}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_SymbolTable = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.SymbolTable", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_SymbolTable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_SymbolTable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_11SymbolTable_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n SymbolTable(name=\"\")\n\n Mutable SymbolTable class.\n\n This class wraps the library SymbolTable and exposes both const (i.e.,\n access) and non-const (i.e., mutation) methods of wrapped object.\n\n Unlike other classes in the hierarchy, it has a working constructor and can be\n used to programmatically construct a SymbolTable in memory.\n\n Args:\n name: An optional string indicating the table's name.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_12_SymbolTable_3__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_SymbolTable, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_11SymbolTable_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_SymbolTable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_SymbolTableIterator __pyx_vtable_9pywrapfst_SymbolTableIterator; + +static PyObject *__pyx_tp_new_9pywrapfst_SymbolTableIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_SymbolTableIterator *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_SymbolTableIterator *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_SymbolTableIterator; + new((void*)&(p->_table)) std::shared_ptr (); + new((void*)&(p->_siter)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_SymbolTableIterator(PyObject *o) { + struct __pyx_obj_9pywrapfst_SymbolTableIterator *p = (struct __pyx_obj_9pywrapfst_SymbolTableIterator *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_table); + __Pyx_call_destructor(p->_siter); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_specialmethod___pyx_pw_9pywrapfst_19SymbolTableIterator_7__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_9pywrapfst_19SymbolTableIterator_7__next__(self);} + +static PyMethodDef __pyx_methods_9pywrapfst_SymbolTableIterator[] = { + {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_9pywrapfst_19SymbolTableIterator_7__next__, METH_NOARGS|METH_COEXIST, 0}, + {"done", (PyCFunction)__pyx_pw_9pywrapfst_19SymbolTableIterator_9done, METH_NOARGS, __pyx_doc_9pywrapfst_19SymbolTableIterator_8done}, + {"next", (PyCFunction)__pyx_pw_9pywrapfst_19SymbolTableIterator_11next, METH_NOARGS, __pyx_doc_9pywrapfst_19SymbolTableIterator_10next}, + {"reset", (PyCFunction)__pyx_pw_9pywrapfst_19SymbolTableIterator_13reset, METH_NOARGS, __pyx_doc_9pywrapfst_19SymbolTableIterator_12reset}, + {"symbol", (PyCFunction)__pyx_pw_9pywrapfst_19SymbolTableIterator_15symbol, METH_NOARGS, __pyx_doc_9pywrapfst_19SymbolTableIterator_14symbol}, + {"value", (PyCFunction)__pyx_pw_9pywrapfst_19SymbolTableIterator_17value, METH_NOARGS, __pyx_doc_9pywrapfst_19SymbolTableIterator_16value}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_19SymbolTableIterator_19__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_19SymbolTableIterator_21__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_SymbolTableIterator = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.SymbolTableIterator", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_SymbolTableIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_SymbolTableIterator, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_19SymbolTableIterator_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n SymbolTableIterator(syms)\n\n This class is used for iterating over a symbol table.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_9pywrapfst_19SymbolTableIterator_5__iter__, /*tp_iter*/ + __pyx_pw_9pywrapfst_19SymbolTableIterator_7__next__, /*tp_iternext*/ + __pyx_methods_9pywrapfst_SymbolTableIterator, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_19SymbolTableIterator_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_SymbolTableIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_EncodeMapper __pyx_vtable_9pywrapfst_EncodeMapper; + +static PyObject *__pyx_tp_new_9pywrapfst_EncodeMapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_EncodeMapper *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_EncodeMapper *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_EncodeMapper; + new((void*)&(p->_encoder)) std::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_EncodeMapper(PyObject *o) { + struct __pyx_obj_9pywrapfst_EncodeMapper *p = (struct __pyx_obj_9pywrapfst_EncodeMapper *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_encoder); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst_EncodeMapper[] = { + {"arc_type", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_5arc_type, METH_NOARGS, __pyx_doc_9pywrapfst_12EncodeMapper_4arc_type}, + {"flags", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_9flags, METH_NOARGS, __pyx_doc_9pywrapfst_12EncodeMapper_8flags}, + {"input_symbols", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_11input_symbols, METH_NOARGS, __pyx_doc_9pywrapfst_12EncodeMapper_10input_symbols}, + {"output_symbols", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_13output_symbols, METH_NOARGS, __pyx_doc_9pywrapfst_12EncodeMapper_12output_symbols}, + {"properties", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_15properties, METH_O, __pyx_doc_9pywrapfst_12EncodeMapper_14properties}, + {"set_input_symbols", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_17set_input_symbols, METH_O, __pyx_doc_9pywrapfst_12EncodeMapper_16set_input_symbols}, + {"set_output_symbols", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_19set_output_symbols, METH_O, __pyx_doc_9pywrapfst_12EncodeMapper_18set_output_symbols}, + {"weight_type", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_21weight_type, METH_NOARGS, __pyx_doc_9pywrapfst_12EncodeMapper_20weight_type}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_23__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_12EncodeMapper_25__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_EncodeMapper = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.EncodeMapper", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_EncodeMapper), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_EncodeMapper, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_12EncodeMapper_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pw_9pywrapfst_12EncodeMapper_7__call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n EncodeMapper(arc_type=\"standard\", encode_labels=False, encode_weights=False)\n\n Arc encoder class, wrapping EncodeMapperClass.\n\n This class provides an object which can be used to encode or decode FST arcs.\n This is most useful to convert an FST to an unweighted acceptor, on which\n some FST operations are more efficient, and then decoding the FST afterwards.\n\n To use an instance of this class to encode or decode a mutable FST, pass it\n as the first argument to the FST instance methods `encode` and `decode`.\n\n For implementational reasons, it is not currently possible to use an encoder\n on disk to construct this class.\n\n Args:\n arc_type: A string indicating the arc type.\n encode_labels: Should labels be encoded?\n encode_weights: Should weights be encoded?\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_EncodeMapper, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_12EncodeMapper_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_EncodeMapper, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst__Fst __pyx_vtable_9pywrapfst__Fst; + +static PyObject *__pyx_tp_new_9pywrapfst__Fst(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst__Fst *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst__Fst *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst__Fst; + new((void*)&(p->_fst)) std::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst__Fst(PyObject *o) { + struct __pyx_obj_9pywrapfst__Fst *p = (struct __pyx_obj_9pywrapfst__Fst *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_fst); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst__Fst[] = { + {"_repr_svg_", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_1_repr_svg_, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst__repr_svg_}, + {"__reduce__", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_5__reduce__, METH_NOARGS, 0}, + {"arc_type", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_11arc_type, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_10arc_type}, + {"arcs", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_13arcs, METH_O, __pyx_doc_9pywrapfst_4_Fst_12arcs}, + {"copy", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_15copy, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_14copy}, + {"draw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_4_Fst_17draw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_4_Fst_16draw}, + {"final", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_19final, METH_O, __pyx_doc_9pywrapfst_4_Fst_18final}, + {"fst_type", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_21fst_type, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_20fst_type}, + {"input_symbols", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_23input_symbols, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_22input_symbols}, + {"num_arcs", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_25num_arcs, METH_O, __pyx_doc_9pywrapfst_4_Fst_24num_arcs}, + {"num_input_epsilons", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_27num_input_epsilons, METH_O, __pyx_doc_9pywrapfst_4_Fst_26num_input_epsilons}, + {"num_output_epsilons", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_29num_output_epsilons, METH_O, __pyx_doc_9pywrapfst_4_Fst_28num_output_epsilons}, + {"output_symbols", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_31output_symbols, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_30output_symbols}, + {"properties", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_4_Fst_33properties, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_4_Fst_32properties}, + {"start", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_35start, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_34start}, + {"states", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_37states, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_36states}, + {"text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_4_Fst_39text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_4_Fst_38text}, + {"verify", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_41verify, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_40verify}, + {"weight_type", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_43weight_type, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_42weight_type}, + {"write", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_45write, METH_O, __pyx_doc_9pywrapfst_4_Fst_44write}, + {"write_to_string", (PyCFunction)__pyx_pw_9pywrapfst_4_Fst_47write_to_string, METH_NOARGS, __pyx_doc_9pywrapfst_4_Fst_46write_to_string}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst__Fst = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst._Fst", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst__Fst), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst__Fst, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_4_Fst_7__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_9pywrapfst_4_Fst_9__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n Immutable FST class, wrapping FstClass.\n\n This class is the basic user-facing FST object. It does not itself support any\n mutation operations.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst__Fst, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_4_Fst_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst__Fst, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst__MutableFst __pyx_vtable_9pywrapfst__MutableFst; + +static PyObject *__pyx_tp_new_9pywrapfst__MutableFst(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9pywrapfst__MutableFst *p; + PyObject *o = __pyx_tp_new_9pywrapfst__Fst(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst__MutableFst *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9pywrapfst__Fst*)__pyx_vtabptr_9pywrapfst__MutableFst; + new((void*)&(p->_mfst)) std::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst__MutableFst(PyObject *o) { + struct __pyx_obj_9pywrapfst__MutableFst *p = (struct __pyx_obj_9pywrapfst__MutableFst *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_mfst); + __pyx_tp_dealloc_9pywrapfst__Fst(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst__MutableFst[] = { + {"add_arc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_1add_arc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_add_arc}, + {"add_state", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_3add_state, METH_NOARGS, __pyx_doc_9pywrapfst_11_MutableFst_2add_state}, + {"arcsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_5arcsort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_4arcsort}, + {"closure", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_7closure, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_6closure}, + {"concat", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_9concat, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_8concat}, + {"connect", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_11connect, METH_NOARGS, __pyx_doc_9pywrapfst_11_MutableFst_10connect}, + {"decode", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_13decode, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_12decode}, + {"delete_arcs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_15delete_arcs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_14delete_arcs}, + {"delete_states", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_17delete_states, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_16delete_states}, + {"encode", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_19encode, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_18encode}, + {"invert", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_21invert, METH_NOARGS, __pyx_doc_9pywrapfst_11_MutableFst_20invert}, + {"minimize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_23minimize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_22minimize}, + {"mutable_arcs", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_25mutable_arcs, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_24mutable_arcs}, + {"mutable_input_symbols", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_27mutable_input_symbols, METH_NOARGS, __pyx_doc_9pywrapfst_11_MutableFst_26mutable_input_symbols}, + {"mutable_output_symbols", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_29mutable_output_symbols, METH_NOARGS, __pyx_doc_9pywrapfst_11_MutableFst_28mutable_output_symbols}, + {"num_states", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_31num_states, METH_NOARGS, __pyx_doc_9pywrapfst_11_MutableFst_30num_states}, + {"project", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_33project, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_32project}, + {"prune", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_35prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_34prune}, + {"push", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_37push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_36push}, + {"relabel_pairs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_39relabel_pairs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_38relabel_pairs}, + {"relabel_tables", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_41relabel_tables, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_40relabel_tables}, + {"reserve_arcs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_43reserve_arcs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_42reserve_arcs}, + {"reserve_states", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_45reserve_states, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_44reserve_states}, + {"reweight", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_47reweight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_46reweight}, + {"rmepsilon", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_49rmepsilon, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_48rmepsilon}, + {"set_final", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_51set_final, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_50set_final}, + {"set_input_symbols", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_53set_input_symbols, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_52set_input_symbols}, + {"set_output_symbols", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_55set_output_symbols, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_54set_output_symbols}, + {"set_properties", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11_MutableFst_57set_properties, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11_MutableFst_56set_properties}, + {"set_start", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_59set_start, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_58set_start}, + {"topsort", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_61topsort, METH_NOARGS, __pyx_doc_9pywrapfst_11_MutableFst_60topsort}, + {"union", (PyCFunction)__pyx_pw_9pywrapfst_11_MutableFst_63union, METH_O, __pyx_doc_9pywrapfst_11_MutableFst_62union}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst__MutableFst = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst._MutableFst", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst__MutableFst), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst__MutableFst, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_4_Fst_7__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_4_Fst_9__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n Mutable FST class, wrapping MutableFstClass.\n\n This class extends _Fst by adding mutation operations.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst__MutableFst, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_9pywrapfst_4_Fst_3__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst__MutableFst, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_Arc __pyx_vtable_9pywrapfst_Arc; + +static PyObject *__pyx_tp_new_9pywrapfst_Arc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_Arc *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_Arc *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_Arc; + new((void*)&(p->_arc)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_Arc(PyObject *o) { + struct __pyx_obj_9pywrapfst_Arc *p = (struct __pyx_obj_9pywrapfst_Arc *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_arc); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_9pywrapfst_3Arc_ilabel(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_9pywrapfst_3Arc_6ilabel_1__get__(o); +} + +static int __pyx_setprop_9pywrapfst_3Arc_ilabel(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_9pywrapfst_3Arc_6ilabel_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9pywrapfst_3Arc_olabel(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_9pywrapfst_3Arc_6olabel_1__get__(o); +} + +static int __pyx_setprop_9pywrapfst_3Arc_olabel(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_9pywrapfst_3Arc_6olabel_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9pywrapfst_3Arc_weight(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_9pywrapfst_3Arc_6weight_1__get__(o); +} + +static int __pyx_setprop_9pywrapfst_3Arc_weight(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_9pywrapfst_3Arc_6weight_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9pywrapfst_3Arc_nextstate(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_9pywrapfst_3Arc_9nextstate_1__get__(o); +} + +static int __pyx_setprop_9pywrapfst_3Arc_nextstate(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_9pywrapfst_3Arc_9nextstate_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_9pywrapfst_Arc[] = { + {"copy", (PyCFunction)__pyx_pw_9pywrapfst_3Arc_5copy, METH_NOARGS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_3Arc_7__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_3Arc_9__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9pywrapfst_Arc[] = { + {(char *)"ilabel", __pyx_getprop_9pywrapfst_3Arc_ilabel, __pyx_setprop_9pywrapfst_3Arc_ilabel, (char *)0, 0}, + {(char *)"olabel", __pyx_getprop_9pywrapfst_3Arc_olabel, __pyx_setprop_9pywrapfst_3Arc_olabel, (char *)0, 0}, + {(char *)"weight", __pyx_getprop_9pywrapfst_3Arc_weight, __pyx_setprop_9pywrapfst_3Arc_weight, (char *)0, 0}, + {(char *)"nextstate", __pyx_getprop_9pywrapfst_3Arc_nextstate, __pyx_setprop_9pywrapfst_3Arc_nextstate, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_Arc = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.Arc", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_Arc), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_Arc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_3Arc_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n Arc(ilabel, olabel, weight, nextstate)\n\n This class represents an arc while remaining agnostic about the underlying arc\n type. Attributes of the arc can be accessed or mutated, and the arc can be\n copied.\n\n Attributes:\n ilabel: The input label.\n olabel: The output label.\n weight: The arc weight.\n nextstate: The destination state for the arc.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_Arc, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9pywrapfst_Arc, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_3Arc_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_Arc, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_ArcIterator __pyx_vtable_9pywrapfst_ArcIterator; + +static PyObject *__pyx_tp_new_9pywrapfst_ArcIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_ArcIterator *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_ArcIterator *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_ArcIterator; + new((void*)&(p->_fst)) std::shared_ptr (); + new((void*)&(p->_aiter)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_ArcIterator(PyObject *o) { + struct __pyx_obj_9pywrapfst_ArcIterator *p = (struct __pyx_obj_9pywrapfst_ArcIterator *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_fst); + __Pyx_call_destructor(p->_aiter); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_specialmethod___pyx_pw_9pywrapfst_11ArcIterator_7__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_9pywrapfst_11ArcIterator_7__next__(self);} + +static PyMethodDef __pyx_methods_9pywrapfst_ArcIterator[] = { + {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_9pywrapfst_11ArcIterator_7__next__, METH_NOARGS|METH_COEXIST, 0}, + {"done", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_9done, METH_NOARGS, __pyx_doc_9pywrapfst_11ArcIterator_8done}, + {"flags", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_11flags, METH_NOARGS, __pyx_doc_9pywrapfst_11ArcIterator_10flags}, + {"next", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_13next, METH_NOARGS, __pyx_doc_9pywrapfst_11ArcIterator_12next}, + {"position", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_15position, METH_NOARGS, __pyx_doc_9pywrapfst_11ArcIterator_14position}, + {"reset", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_17reset, METH_NOARGS, __pyx_doc_9pywrapfst_11ArcIterator_16reset}, + {"seek", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_19seek, METH_O, __pyx_doc_9pywrapfst_11ArcIterator_18seek}, + {"set_flags", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_11ArcIterator_21set_flags, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_11ArcIterator_20set_flags}, + {"value", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_23value, METH_NOARGS, __pyx_doc_9pywrapfst_11ArcIterator_22value}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_25__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_11ArcIterator_27__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_ArcIterator = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.ArcIterator", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_ArcIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_ArcIterator, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_11ArcIterator_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n ArcIterator(ifst, state)\n\n This class is used for iterating over the arcs leaving some state of an FST.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_9pywrapfst_11ArcIterator_5__iter__, /*tp_iter*/ + __pyx_pw_9pywrapfst_11ArcIterator_7__next__, /*tp_iternext*/ + __pyx_methods_9pywrapfst_ArcIterator, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_11ArcIterator_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_ArcIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_MutableArcIterator __pyx_vtable_9pywrapfst_MutableArcIterator; + +static PyObject *__pyx_tp_new_9pywrapfst_MutableArcIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_MutableArcIterator *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_MutableArcIterator *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_MutableArcIterator; + new((void*)&(p->_mfst)) std::shared_ptr (); + new((void*)&(p->_aiter)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_MutableArcIterator(PyObject *o) { + struct __pyx_obj_9pywrapfst_MutableArcIterator *p = (struct __pyx_obj_9pywrapfst_MutableArcIterator *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_mfst); + __Pyx_call_destructor(p->_aiter); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst_MutableArcIterator[] = { + {"done", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_8done, METH_NOARGS, __pyx_doc_9pywrapfst_18MutableArcIterator_7done}, + {"flags", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_10flags, METH_NOARGS, __pyx_doc_9pywrapfst_18MutableArcIterator_9flags}, + {"next", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_12next, METH_NOARGS, __pyx_doc_9pywrapfst_18MutableArcIterator_11next}, + {"position", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_14position, METH_NOARGS, __pyx_doc_9pywrapfst_18MutableArcIterator_13position}, + {"reset", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_16reset, METH_NOARGS, __pyx_doc_9pywrapfst_18MutableArcIterator_15reset}, + {"seek", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_18seek, METH_O, __pyx_doc_9pywrapfst_18MutableArcIterator_17seek}, + {"set_flags", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_18MutableArcIterator_20set_flags, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_18MutableArcIterator_19set_flags}, + {"set_value", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_22set_value, METH_O, __pyx_doc_9pywrapfst_18MutableArcIterator_21set_value}, + {"value", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_24value, METH_NOARGS, __pyx_doc_9pywrapfst_18MutableArcIterator_23value}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_26__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_18MutableArcIterator_28__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_MutableArcIterator = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.MutableArcIterator", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_MutableArcIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_MutableArcIterator, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_18MutableArcIterator_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n MutableArcIterator(ifst, state)\n\n This class is used for iterating over the arcs leaving some state of an FST,\n also permitting mutation of the current arc.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_9pywrapfst_18MutableArcIterator_5__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_MutableArcIterator, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_18MutableArcIterator_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_MutableArcIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_StateIterator __pyx_vtable_9pywrapfst_StateIterator; + +static PyObject *__pyx_tp_new_9pywrapfst_StateIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_StateIterator *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_StateIterator *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_StateIterator; + new((void*)&(p->_fst)) std::shared_ptr (); + new((void*)&(p->_siter)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_StateIterator(PyObject *o) { + struct __pyx_obj_9pywrapfst_StateIterator *p = (struct __pyx_obj_9pywrapfst_StateIterator *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_fst); + __Pyx_call_destructor(p->_siter); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_specialmethod___pyx_pw_9pywrapfst_13StateIterator_7__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_9pywrapfst_13StateIterator_7__next__(self);} + +static PyMethodDef __pyx_methods_9pywrapfst_StateIterator[] = { + {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_9pywrapfst_13StateIterator_7__next__, METH_NOARGS|METH_COEXIST, 0}, + {"done", (PyCFunction)__pyx_pw_9pywrapfst_13StateIterator_9done, METH_NOARGS, __pyx_doc_9pywrapfst_13StateIterator_8done}, + {"next", (PyCFunction)__pyx_pw_9pywrapfst_13StateIterator_11next, METH_NOARGS, __pyx_doc_9pywrapfst_13StateIterator_10next}, + {"reset", (PyCFunction)__pyx_pw_9pywrapfst_13StateIterator_13reset, METH_NOARGS, __pyx_doc_9pywrapfst_13StateIterator_12reset}, + {"value", (PyCFunction)__pyx_pw_9pywrapfst_13StateIterator_15value, METH_NOARGS, __pyx_doc_9pywrapfst_13StateIterator_14value}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_13StateIterator_17__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_13StateIterator_19__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_StateIterator = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.StateIterator", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_StateIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_StateIterator, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_13StateIterator_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n StateIterator(ifst)\n\n This class is used for iterating over the states in an FST.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_9pywrapfst_13StateIterator_5__iter__, /*tp_iter*/ + __pyx_pw_9pywrapfst_13StateIterator_7__next__, /*tp_iternext*/ + __pyx_methods_9pywrapfst_StateIterator, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_13StateIterator_3__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_StateIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_Compiler __pyx_vtable_9pywrapfst_Compiler; + +static PyObject *__pyx_tp_new_9pywrapfst_Compiler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9pywrapfst_Compiler *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_Compiler *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_Compiler; + new((void*)&(p->_sstrm)) std::unique_ptr (); + new((void*)&(p->_fst_type)) std::string(); + new((void*)&(p->_arc_type)) std::string(); + if (unlikely(__pyx_pw_9pywrapfst_8Compiler_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_9pywrapfst_Compiler(PyObject *o) { + struct __pyx_obj_9pywrapfst_Compiler *p = (struct __pyx_obj_9pywrapfst_Compiler *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_sstrm); + __Pyx_call_destructor(p->_fst_type); + __Pyx_call_destructor(p->_arc_type); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_9pywrapfst_Compiler[] = { + {"compile", (PyCFunction)__pyx_pw_9pywrapfst_8Compiler_3compile, METH_NOARGS, __pyx_doc_9pywrapfst_8Compiler_2compile}, + {"write", (PyCFunction)__pyx_pw_9pywrapfst_8Compiler_5write, METH_O, __pyx_doc_9pywrapfst_8Compiler_4write}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_8Compiler_7__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_8Compiler_9__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_9pywrapfst_Compiler = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.Compiler", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_Compiler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_Compiler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n Compiler(fst_type=\"vector\", arc_type=\"standard\", isymbols=None,\n osymbols=None, ssymbols=None, acceptor=False, keep_isymbols=False,\n keep_osymbols=False, keep_state_numbering=False,\n allow_negative_labels=False)\n\n Class used to compile FSTs from strings.\n\n This class is used to compile FSTs specified using the AT&T FSM library\n format described here:\n\n http://web.eecs.umich.edu/~radev/NLP-fall2015/resources/fsm_archive/fsm.5.html\n\n This is the same format used by the `fstcompile` executable.\n\n Compiler options (symbol tables, etc.) are set at construction time.\n\n compiler = fst.Compiler(isymbols=ascii_syms, osymbols=ascii_syms)\n\n Once constructed, Compiler instances behave like a file handle opened for\n writing:\n\n # /ba+/\n compiler.write(\"0 1 50 50\")\n compiler.write(\"1 2 49 49\")\n compiler.write(\"2 2 49 49\")\n compiler.write(\"2\")\n\n The `compile` method returns an actual FST instance:\n\n sheep_machine = compiler.compile()\n\n Compilation flushes the internal buffer, so the compiler instance can be\n reused to compile new machines with the same symbol tables (etc.)\n\n Args:\n fst_type: A string indicating the container type for the compiled FST.\n arc_type: A string indicating the arc type for the compiled FST.\n isymbols: An optional SymbolTable used to label input symbols.\n osymbols: An optional SymbolTable used to label output symbols.\n ssymbols: An optional SymbolTable used to label states.\n acceptor: Should the FST be rendered in acceptor format if possible?\n keep_isymbols: Should the input symbol table be stored in the FST?\n keep_osymbols: Should the output symbol table be stored in the FST?\n keep_state_numbering: Should the state numbering be preserved?\n allow_negative_labels: Should negative labels be allowed? (Not\n recommended; may cause conflicts).\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_Compiler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_Compiler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_FarReader __pyx_vtable_9pywrapfst_FarReader; + +static PyObject *__pyx_tp_new_9pywrapfst_FarReader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_FarReader *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_FarReader *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_FarReader; + new((void*)&(p->_reader)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_FarReader(PyObject *o) { + struct __pyx_obj_9pywrapfst_FarReader *p = (struct __pyx_obj_9pywrapfst_FarReader *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_reader); + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_9pywrapfst_FarReader(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_9pywrapfst_FarReader[] = { + {"open", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_9FarReader_5open, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_9FarReader_4open}, + {"arc_type", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_7arc_type, METH_NOARGS, __pyx_doc_9pywrapfst_9FarReader_6arc_type}, + {"done", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_9done, METH_NOARGS, __pyx_doc_9pywrapfst_9FarReader_8done}, + {"error", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_11error, METH_NOARGS, __pyx_doc_9pywrapfst_9FarReader_10error}, + {"far_type", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_13far_type, METH_NOARGS, 0}, + {"find", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_15find, METH_O, __pyx_doc_9pywrapfst_9FarReader_14find}, + {"get_fst", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_17get_fst, METH_NOARGS, __pyx_doc_9pywrapfst_9FarReader_16get_fst}, + {"get_key", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_19get_key, METH_NOARGS, __pyx_doc_9pywrapfst_9FarReader_18get_key}, + {"next", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_21next, METH_NOARGS, __pyx_doc_9pywrapfst_9FarReader_20next}, + {"reset", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_23reset, METH_NOARGS, __pyx_doc_9pywrapfst_9FarReader_22reset}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_27__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_9FarReader_29__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_FarReader = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_9pywrapfst_FarReader, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_FarReader = { + 0, /*mp_length*/ + __pyx_pw_9pywrapfst_9FarReader_25__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_9pywrapfst_FarReader = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.FarReader", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_FarReader), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_FarReader, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_9FarReader_3__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_FarReader, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FarReader, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n FAR (\"Fst ARchive\") reader object.\n\n This class is used to read a FAR from disk. FARs contain one or more FSTs (of\n the same arc type) indexed by a unique string key. To construct a FarReader\n object, use the `open` class method.\n\n Attributes:\n arc_type: A string indicating the arc type.\n far_type: A string indicating the FAR type.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_FarReader, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_9FarReader_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_FarReader, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_9pywrapfst_FarWriter __pyx_vtable_9pywrapfst_FarWriter; + +static PyObject *__pyx_tp_new_9pywrapfst_FarWriter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_9pywrapfst_FarWriter *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_9pywrapfst_FarWriter *)o); + p->__pyx_vtab = __pyx_vtabptr_9pywrapfst_FarWriter; + new((void*)&(p->_writer)) std::unique_ptr (); + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst_FarWriter(PyObject *o) { + struct __pyx_obj_9pywrapfst_FarWriter *p = (struct __pyx_obj_9pywrapfst_FarWriter *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->_writer); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_mp_ass_subscript_9pywrapfst_FarWriter(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_9pywrapfst_9FarWriter_15__setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyMethodDef __pyx_methods_9pywrapfst_FarWriter[] = { + {"create", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_9FarWriter_5create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_9FarWriter_4create}, + {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_9FarWriter_7add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_9FarWriter_6add}, + {"arc_type", (PyCFunction)__pyx_pw_9pywrapfst_9FarWriter_9arc_type, METH_NOARGS, __pyx_doc_9pywrapfst_9FarWriter_8arc_type}, + {"error", (PyCFunction)__pyx_pw_9pywrapfst_9FarWriter_11error, METH_NOARGS, __pyx_doc_9pywrapfst_9FarWriter_10error}, + {"far_type", (PyCFunction)__pyx_pw_9pywrapfst_9FarWriter_13far_type, METH_NOARGS, __pyx_doc_9pywrapfst_9FarWriter_12far_type}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_9pywrapfst_9FarWriter_17__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_9pywrapfst_9FarWriter_19__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyMappingMethods __pyx_tp_as_mapping_FarWriter = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + __pyx_mp_ass_subscript_9pywrapfst_FarWriter, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_9pywrapfst_FarWriter = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.FarWriter", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst_FarWriter), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst_FarWriter, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_9pywrapfst_9FarWriter_3__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FarWriter, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n (No constructor.)\n\n FAR (\"Fst ARchive\") writer object.\n\n This class is used to write FSTs (of the same arc type) to a FAR on disk. To\n construct a FarWriter, use the `create` class method.\n\n Note that the data is not guaranteed to flush to disk until the FarWriter\n is garbage-collected. If a FarWriter has been assigned to only one variable,\n then calling `del` on that variable should decrement the object's reference\n count from 1 to 0, triggering a flush to disk on the next GC cycle.\n\n Attributes:\n arc_type: A string indicating the arc type.\n far_type: A string indicating the FAR type.\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9pywrapfst_FarWriter, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_9pywrapfst_9FarWriter_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst_FarWriter, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *__pyx_freelist_9pywrapfst___pyx_scope_struct____iter__[8]; +static int __pyx_freecount_9pywrapfst___pyx_scope_struct____iter__ = 0; + +static PyObject *__pyx_tp_new_9pywrapfst___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9pywrapfst___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__)))) { + o = (PyObject*)__pyx_freelist_9pywrapfst___pyx_scope_struct____iter__[--__pyx_freecount_9pywrapfst___pyx_scope_struct____iter__]; + memset(o, 0, sizeof(struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_9pywrapfst___pyx_scope_struct____iter__(PyObject *o) { + struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *p = (struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9pywrapfst___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__)))) { + __pyx_freelist_9pywrapfst___pyx_scope_struct____iter__[__pyx_freecount_9pywrapfst___pyx_scope_struct____iter__++] = ((struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_9pywrapfst___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *p = (struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static PyTypeObject __pyx_type_9pywrapfst___pyx_scope_struct____iter__ = { + PyVarObject_HEAD_INIT(0, 0) + "pywrapfst.__pyx_scope_struct____iter__", /*tp_name*/ + sizeof(struct __pyx_obj_9pywrapfst___pyx_scope_struct____iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9pywrapfst___pyx_scope_struct____iter__, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_9pywrapfst___pyx_scope_struct____iter__, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9pywrapfst___pyx_scope_struct____iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {"_read_SymbolTable_from_string", (PyCFunction)__pyx_pw_9pywrapfst_9_read_SymbolTable_from_string, METH_O, 0}, + {"compact_symbol_table", (PyCFunction)__pyx_pw_9pywrapfst_11compact_symbol_table, METH_O, __pyx_doc_9pywrapfst_10compact_symbol_table}, + {"merge_symbol_table", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_13merge_symbol_table, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_12merge_symbol_table}, + {"_read", (PyCFunction)__pyx_pw_9pywrapfst_15_read, METH_O, 0}, + {"_read_Fst_from_string", (PyCFunction)__pyx_pw_9pywrapfst_17_read_Fst_from_string, METH_O, 0}, + {"arcmap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_19arcmap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_18arcmap}, + {"compose", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_21compose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_20compose}, + {"convert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_23convert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_22convert}, + {"determinize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_25determinize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_24determinize}, + {"difference", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_27difference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_26difference}, + {"disambiguate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_29disambiguate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_28disambiguate}, + {"epsnormalize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_31epsnormalize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_30epsnormalize}, + {"equal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_33equal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_32equal}, + {"equivalent", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_35equivalent, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_34equivalent}, + {"intersect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_37intersect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_36intersect}, + {"isomorphic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_39isomorphic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_38isomorphic}, + {"prune", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_41prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_40prune}, + {"push", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_43push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_42push}, + {"randequivalent", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_45randequivalent, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_44randequivalent}, + {"randgen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_47randgen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_46randgen}, + {"replace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_49replace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_48replace}, + {"reverse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_51reverse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_50reverse}, + {"shortestpath", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_55shortestpath, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_54shortestpath}, + {"statemap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9pywrapfst_57statemap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9pywrapfst_56statemap}, + {"synchronize", (PyCFunction)__pyx_pw_9pywrapfst_59synchronize, METH_O, __pyx_doc_9pywrapfst_58synchronize}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_pywrapfst(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_pywrapfst}, + {0, NULL} +}; +#endif + +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + "pywrapfst", + __pyx_k_Python_interface_to_the_FST_scri, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_ACCEPTOR, __pyx_k_ACCEPTOR, sizeof(__pyx_k_ACCEPTOR), 0, 0, 1, 1}, + {&__pyx_n_s_ACCESSIBLE, __pyx_k_ACCESSIBLE, sizeof(__pyx_k_ACCESSIBLE), 0, 0, 1, 1}, + {&__pyx_n_s_ACYCLIC, __pyx_k_ACYCLIC, sizeof(__pyx_k_ACYCLIC), 0, 0, 1, 1}, + {&__pyx_n_s_ADD_ARC_PROPERTIES, __pyx_k_ADD_ARC_PROPERTIES, sizeof(__pyx_k_ADD_ARC_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_ADD_STATE_PROPERTIES, __pyx_k_ADD_STATE_PROPERTIES, sizeof(__pyx_k_ADD_STATE_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_ADD_SUPERFINAL_PROPERTIES, __pyx_k_ADD_SUPERFINAL_PROPERTIES, sizeof(__pyx_k_ADD_SUPERFINAL_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_FLAGS, __pyx_k_ARC_FLAGS, sizeof(__pyx_k_ARC_FLAGS), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_I_LABEL_VALUE, __pyx_k_ARC_I_LABEL_VALUE, sizeof(__pyx_k_ARC_I_LABEL_VALUE), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_NEXT_STATE_VALUE, __pyx_k_ARC_NEXT_STATE_VALUE, sizeof(__pyx_k_ARC_NEXT_STATE_VALUE), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_NO_CACHE, __pyx_k_ARC_NO_CACHE, sizeof(__pyx_k_ARC_NO_CACHE), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_O_LABEL_VALUE, __pyx_k_ARC_O_LABEL_VALUE, sizeof(__pyx_k_ARC_O_LABEL_VALUE), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_SORT_PROPERTIES, __pyx_k_ARC_SORT_PROPERTIES, sizeof(__pyx_k_ARC_SORT_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_VALUE_FLAGS, __pyx_k_ARC_VALUE_FLAGS, sizeof(__pyx_k_ARC_VALUE_FLAGS), 0, 0, 1, 1}, + {&__pyx_n_s_ARC_WEIGHT_VALUE, __pyx_k_ARC_WEIGHT_VALUE, sizeof(__pyx_k_ARC_WEIGHT_VALUE), 0, 0, 1, 1}, + {&__pyx_n_s_Arc, __pyx_k_Arc, sizeof(__pyx_k_Arc), 0, 0, 1, 1}, + {&__pyx_n_s_ArcIterator, __pyx_k_ArcIterator, sizeof(__pyx_k_ArcIterator), 0, 0, 1, 1}, + {&__pyx_kp_u_ArcIterator_at_0x_x, __pyx_k_ArcIterator_at_0x_x, sizeof(__pyx_k_ArcIterator_at_0x_x), 0, 1, 0, 0}, + {&__pyx_kp_u_Arc_at_0x_x, __pyx_k_Arc_at_0x_x, sizeof(__pyx_k_Arc_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_BINARY_PROPERTIES, __pyx_k_BINARY_PROPERTIES, sizeof(__pyx_k_BINARY_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_COACCESSIBLE, __pyx_k_COACCESSIBLE, sizeof(__pyx_k_COACCESSIBLE), 0, 0, 1, 1}, + {&__pyx_n_s_COPY_PROPERTIES, __pyx_k_COPY_PROPERTIES, sizeof(__pyx_k_COPY_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_CYCLIC, __pyx_k_CYCLIC, sizeof(__pyx_k_CYCLIC), 0, 0, 1, 1}, + {&__pyx_kp_u_Cannot_construct, __pyx_k_Cannot_construct, sizeof(__pyx_k_Cannot_construct), 0, 1, 0, 0}, + {&__pyx_kp_u_Cannot_encode_as_string_r, __pyx_k_Cannot_encode_as_string_r, sizeof(__pyx_k_Cannot_encode_as_string_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Cannot_topsort_cyclic_FST, __pyx_k_Cannot_topsort_cyclic_FST, sizeof(__pyx_k_Cannot_topsort_cyclic_FST), 0, 1, 0, 0}, + {&__pyx_kp_u_Compilation_failed, __pyx_k_Compilation_failed, sizeof(__pyx_k_Compilation_failed), 0, 1, 0, 0}, + {&__pyx_n_s_Compiler, __pyx_k_Compiler, sizeof(__pyx_k_Compiler), 0, 0, 1, 1}, + {&__pyx_kp_u_Conversion_to_r_failed, __pyx_k_Conversion_to_r_failed, sizeof(__pyx_k_Conversion_to_r_failed), 0, 1, 0, 0}, + {&__pyx_n_s_DELETE_ARC_PROPERTIES, __pyx_k_DELETE_ARC_PROPERTIES, sizeof(__pyx_k_DELETE_ARC_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_DELETE_STATE_PROPERTIES, __pyx_k_DELETE_STATE_PROPERTIES, sizeof(__pyx_k_DELETE_STATE_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_kp_u_Dot_rendering_failed_s, __pyx_k_Dot_rendering_failed_s, sizeof(__pyx_k_Dot_rendering_failed_s), 0, 1, 0, 0}, + {&__pyx_n_s_ENCODE_FLAGS, __pyx_k_ENCODE_FLAGS, sizeof(__pyx_k_ENCODE_FLAGS), 0, 0, 1, 1}, + {&__pyx_n_s_ENCODE_LABELS, __pyx_k_ENCODE_LABELS, sizeof(__pyx_k_ENCODE_LABELS), 0, 0, 1, 1}, + {&__pyx_n_s_ENCODE_WEIGHTS, __pyx_k_ENCODE_WEIGHTS, sizeof(__pyx_k_ENCODE_WEIGHTS), 0, 0, 1, 1}, + {&__pyx_n_s_EPSILONS, __pyx_k_EPSILONS, sizeof(__pyx_k_EPSILONS), 0, 0, 1, 1}, + {&__pyx_n_s_ERROR, __pyx_k_ERROR, sizeof(__pyx_k_ERROR), 0, 0, 1, 1}, + {&__pyx_n_s_EXPANDED, __pyx_k_EXPANDED, sizeof(__pyx_k_EXPANDED), 0, 0, 1, 1}, + {&__pyx_n_s_EXTRINSIC_PROPERTIES, __pyx_k_EXTRINSIC_PROPERTIES, sizeof(__pyx_k_EXTRINSIC_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_EncodeMapper, __pyx_k_EncodeMapper, sizeof(__pyx_k_EncodeMapper), 0, 0, 1, 1}, + {&__pyx_n_s_EncodeMapperSymbolTable, __pyx_k_EncodeMapperSymbolTable, sizeof(__pyx_k_EncodeMapperSymbolTable), 0, 0, 1, 1}, + {&__pyx_kp_u_EncodeMapper_at_0x_x, __pyx_k_EncodeMapper_at_0x_x, sizeof(__pyx_k_EncodeMapper_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_FST_PROPERTIES, __pyx_k_FST_PROPERTIES, sizeof(__pyx_k_FST_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_FarReader, __pyx_k_FarReader, sizeof(__pyx_k_FarReader), 0, 0, 1, 1}, + {&__pyx_kp_u_FarReader_at_0x_x, __pyx_k_FarReader_at_0x_x, sizeof(__pyx_k_FarReader_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_FarWriter, __pyx_k_FarWriter, sizeof(__pyx_k_FarWriter), 0, 0, 1, 1}, + {&__pyx_kp_u_FarWriter_at_0x_x, __pyx_k_FarWriter_at_0x_x, sizeof(__pyx_k_FarWriter_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_Fst, __pyx_k_Fst, sizeof(__pyx_k_Fst), 0, 0, 1, 1}, + {&__pyx_n_s_FstArgError, __pyx_k_FstArgError, sizeof(__pyx_k_FstArgError), 0, 0, 1, 1}, + {&__pyx_n_s_FstBadWeightError, __pyx_k_FstBadWeightError, sizeof(__pyx_k_FstBadWeightError), 0, 0, 1, 1}, + {&__pyx_n_s_FstDeletedConstructorError, __pyx_k_FstDeletedConstructorError, sizeof(__pyx_k_FstDeletedConstructorError), 0, 0, 1, 1}, + {&__pyx_n_s_FstError, __pyx_k_FstError, sizeof(__pyx_k_FstError), 0, 0, 1, 1}, + {&__pyx_n_s_FstIOError, __pyx_k_FstIOError, sizeof(__pyx_k_FstIOError), 0, 0, 1, 1}, + {&__pyx_n_s_FstIndexError, __pyx_k_FstIndexError, sizeof(__pyx_k_FstIndexError), 0, 0, 1, 1}, + {&__pyx_n_s_FstOpError, __pyx_k_FstOpError, sizeof(__pyx_k_FstOpError), 0, 0, 1, 1}, + {&__pyx_n_s_FstSymbolTable, __pyx_k_FstSymbolTable, sizeof(__pyx_k_FstSymbolTable), 0, 0, 1, 1}, + {&__pyx_n_s_Fst_2, __pyx_k_Fst_2, sizeof(__pyx_k_Fst_2), 0, 0, 1, 1}, + {&__pyx_kp_u_Fst_SymbolTable_r_at_0x_x, __pyx_k_Fst_SymbolTable_r_at_0x_x, sizeof(__pyx_k_Fst_SymbolTable_r_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_Fst___new, __pyx_k_Fst___new, sizeof(__pyx_k_Fst___new), 0, 0, 1, 1}, + {&__pyx_kp_s_Fst_arc_type_standard_Construct, __pyx_k_Fst_arc_type_standard_Construct, sizeof(__pyx_k_Fst_arc_type_standard_Construct), 0, 0, 1, 0}, + {&__pyx_kp_u_Fst_at_0x_x, __pyx_k_Fst_at_0x_x, sizeof(__pyx_k_Fst_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_Fst_read, __pyx_k_Fst_read, sizeof(__pyx_k_Fst_read), 0, 0, 1, 1}, + {&__pyx_n_s_Fst_read_from_string, __pyx_k_Fst_read_from_string, sizeof(__pyx_k_Fst_read_from_string), 0, 0, 1, 1}, + {&__pyx_n_s_INITIAL_ACYCLIC, __pyx_k_INITIAL_ACYCLIC, sizeof(__pyx_k_INITIAL_ACYCLIC), 0, 0, 1, 1}, + {&__pyx_n_s_INITIAL_CYCLIC, __pyx_k_INITIAL_CYCLIC, sizeof(__pyx_k_INITIAL_CYCLIC), 0, 0, 1, 1}, + {&__pyx_n_s_INTRINSIC_PROPERTIES, __pyx_k_INTRINSIC_PROPERTIES, sizeof(__pyx_k_INTRINSIC_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1}, + {&__pyx_n_s_I_DETERMINISTIC, __pyx_k_I_DETERMINISTIC, sizeof(__pyx_k_I_DETERMINISTIC), 0, 0, 1, 1}, + {&__pyx_n_s_I_EPSILONS, __pyx_k_I_EPSILONS, sizeof(__pyx_k_I_EPSILONS), 0, 0, 1, 1}, + {&__pyx_n_s_I_LABEL_INVARIANT_PROPERTIES, __pyx_k_I_LABEL_INVARIANT_PROPERTIES, sizeof(__pyx_k_I_LABEL_INVARIANT_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_I_LABEL_SORTED, __pyx_k_I_LABEL_SORTED, sizeof(__pyx_k_I_LABEL_SORTED), 0, 0, 1, 1}, + {&__pyx_kp_u_Incompatible_or_invalid_arc_type, __pyx_k_Incompatible_or_invalid_arc_type, sizeof(__pyx_k_Incompatible_or_invalid_arc_type), 0, 1, 0, 0}, + {&__pyx_kp_u_Incompatible_or_invalid_weight, __pyx_k_Incompatible_or_invalid_weight, sizeof(__pyx_k_Incompatible_or_invalid_weight), 0, 1, 0, 0}, + {&__pyx_kp_u_Incompatible_or_invalid_weight_t, __pyx_k_Incompatible_or_invalid_weight_t, sizeof(__pyx_k_Incompatible_or_invalid_weight_t), 0, 1, 0, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_u_Invalid_weight, __pyx_k_Invalid_weight, sizeof(__pyx_k_Invalid_weight), 0, 1, 0, 0}, + {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, + {&__pyx_kp_u_Key_out_of_order, __pyx_k_Key_out_of_order, sizeof(__pyx_k_Key_out_of_order), 0, 1, 0, 0}, + {&__pyx_n_s_MUTABLE, __pyx_k_MUTABLE, sizeof(__pyx_k_MUTABLE), 0, 0, 1, 1}, + {&__pyx_n_s_MutableArcIterator, __pyx_k_MutableArcIterator, sizeof(__pyx_k_MutableArcIterator), 0, 0, 1, 1}, + {&__pyx_n_s_MutableArcIterator___iter, __pyx_k_MutableArcIterator___iter, sizeof(__pyx_k_MutableArcIterator___iter), 0, 0, 1, 1}, + {&__pyx_kp_u_MutableArcIterator_at_0x_x, __pyx_k_MutableArcIterator_at_0x_x, sizeof(__pyx_k_MutableArcIterator_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_MutableFst, __pyx_k_MutableFst, sizeof(__pyx_k_MutableFst), 0, 0, 1, 1}, + {&__pyx_n_s_MutableFstSymbolTable, __pyx_k_MutableFstSymbolTable, sizeof(__pyx_k_MutableFstSymbolTable), 0, 0, 1, 1}, + {&__pyx_n_s_MutableSymbolTable, __pyx_k_MutableSymbolTable, sizeof(__pyx_k_MutableSymbolTable), 0, 0, 1, 1}, + {&__pyx_n_s_NEG_TRINARY_PROPERTIES, __pyx_k_NEG_TRINARY_PROPERTIES, sizeof(__pyx_k_NEG_TRINARY_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_NON_I_DETERMINISTIC, __pyx_k_NON_I_DETERMINISTIC, sizeof(__pyx_k_NON_I_DETERMINISTIC), 0, 0, 1, 1}, + {&__pyx_n_s_NON_O_DETERMINISTIC, __pyx_k_NON_O_DETERMINISTIC, sizeof(__pyx_k_NON_O_DETERMINISTIC), 0, 0, 1, 1}, + {&__pyx_n_s_NOT_ACCEPTOR, __pyx_k_NOT_ACCEPTOR, sizeof(__pyx_k_NOT_ACCEPTOR), 0, 0, 1, 1}, + {&__pyx_n_s_NOT_ACCESSIBLE, __pyx_k_NOT_ACCESSIBLE, sizeof(__pyx_k_NOT_ACCESSIBLE), 0, 0, 1, 1}, + {&__pyx_n_s_NOT_COACCESSIBLE, __pyx_k_NOT_COACCESSIBLE, sizeof(__pyx_k_NOT_COACCESSIBLE), 0, 0, 1, 1}, + {&__pyx_n_s_NOT_I_LABEL_SORTED, __pyx_k_NOT_I_LABEL_SORTED, sizeof(__pyx_k_NOT_I_LABEL_SORTED), 0, 0, 1, 1}, + {&__pyx_n_s_NOT_O_LABEL_SORTED, __pyx_k_NOT_O_LABEL_SORTED, sizeof(__pyx_k_NOT_O_LABEL_SORTED), 0, 0, 1, 1}, + {&__pyx_n_s_NOT_STRING, __pyx_k_NOT_STRING, sizeof(__pyx_k_NOT_STRING), 0, 0, 1, 1}, + {&__pyx_n_s_NOT_TOP_SORTED, __pyx_k_NOT_TOP_SORTED, sizeof(__pyx_k_NOT_TOP_SORTED), 0, 0, 1, 1}, + {&__pyx_n_s_NO_EPSILONS, __pyx_k_NO_EPSILONS, sizeof(__pyx_k_NO_EPSILONS), 0, 0, 1, 1}, + {&__pyx_n_s_NO_I_EPSILONS, __pyx_k_NO_I_EPSILONS, sizeof(__pyx_k_NO_I_EPSILONS), 0, 0, 1, 1}, + {&__pyx_n_s_NO_LABEL, __pyx_k_NO_LABEL, sizeof(__pyx_k_NO_LABEL), 0, 0, 1, 1}, + {&__pyx_n_s_NO_O_EPSILONS, __pyx_k_NO_O_EPSILONS, sizeof(__pyx_k_NO_O_EPSILONS), 0, 0, 1, 1}, + {&__pyx_n_s_NO_STATE_ID, __pyx_k_NO_STATE_ID, sizeof(__pyx_k_NO_STATE_ID), 0, 0, 1, 1}, + {&__pyx_n_s_NO_SYMBOL, __pyx_k_NO_SYMBOL, sizeof(__pyx_k_NO_SYMBOL), 0, 0, 1, 1}, + {&__pyx_n_s_NULL_PROPERTIES, __pyx_k_NULL_PROPERTIES, sizeof(__pyx_k_NULL_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_NoWeight, __pyx_k_NoWeight, sizeof(__pyx_k_NoWeight), 0, 0, 1, 1}, + {&__pyx_kp_u_No_new_SymbolTables_specified, __pyx_k_No_new_SymbolTables_specified, sizeof(__pyx_k_No_new_SymbolTables_specified), 0, 1, 0, 0}, + {&__pyx_kp_u_No_relabeling_pairs_specified, __pyx_k_No_relabeling_pairs_specified, sizeof(__pyx_k_No_relabeling_pairs_specified), 0, 1, 0, 0}, + {&__pyx_n_s_Number, __pyx_k_Number, sizeof(__pyx_k_Number), 0, 0, 1, 1}, + {&__pyx_n_s_O_DETERMINISTIC, __pyx_k_O_DETERMINISTIC, sizeof(__pyx_k_O_DETERMINISTIC), 0, 0, 1, 1}, + {&__pyx_n_s_O_EPSILONS, __pyx_k_O_EPSILONS, sizeof(__pyx_k_O_EPSILONS), 0, 0, 1, 1}, + {&__pyx_n_s_O_LABEL_INVARIANT_PROPERTIES, __pyx_k_O_LABEL_INVARIANT_PROPERTIES, sizeof(__pyx_k_O_LABEL_INVARIANT_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_O_LABEL_SORTED, __pyx_k_O_LABEL_SORTED, sizeof(__pyx_k_O_LABEL_SORTED), 0, 0, 1, 1}, + {&__pyx_n_s_One, __pyx_k_One, sizeof(__pyx_k_One), 0, 0, 1, 1}, + {&__pyx_kp_u_Open_failed_r, __pyx_k_Open_failed_r, sizeof(__pyx_k_Open_failed_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Operation_failed, __pyx_k_Operation_failed, sizeof(__pyx_k_Operation_failed), 0, 1, 0, 0}, + {&__pyx_n_s_PIPE, __pyx_k_PIPE, sizeof(__pyx_k_PIPE), 0, 0, 1, 1}, + {&__pyx_n_s_POS_TRINARY_PROPERTIES, __pyx_k_POS_TRINARY_PROPERTIES, sizeof(__pyx_k_POS_TRINARY_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_Popen, __pyx_k_Popen, sizeof(__pyx_k_Popen), 0, 0, 1, 1}, + {&__pyx_n_s_RM_SUPERFINAL_PROPERTIES, __pyx_k_RM_SUPERFINAL_PROPERTIES, sizeof(__pyx_k_RM_SUPERFINAL_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_kp_u_Read_failed, __pyx_k_Read_failed, sizeof(__pyx_k_Read_failed), 0, 1, 0, 0}, + {&__pyx_kp_u_Read_failed_r, __pyx_k_Read_failed_r, sizeof(__pyx_k_Read_failed_r), 0, 1, 0, 0}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s_SET_ARC_PROPERTIES, __pyx_k_SET_ARC_PROPERTIES, sizeof(__pyx_k_SET_ARC_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_SET_FINAL_PROPERTIES, __pyx_k_SET_FINAL_PROPERTIES, sizeof(__pyx_k_SET_FINAL_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_SET_START_PROPERTIES, __pyx_k_SET_START_PROPERTIES, sizeof(__pyx_k_SET_START_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_STATE_SORT_PROPERTIES, __pyx_k_STATE_SORT_PROPERTIES, sizeof(__pyx_k_STATE_SORT_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_STRING, __pyx_k_STRING, sizeof(__pyx_k_STRING), 0, 0, 1, 1}, + {&__pyx_n_s_StateIterator, __pyx_k_StateIterator, sizeof(__pyx_k_StateIterator), 0, 0, 1, 1}, + {&__pyx_kp_u_StateIterator_at_0x_x, __pyx_k_StateIterator_at_0x_x, sizeof(__pyx_k_StateIterator_at_0x_x), 0, 1, 0, 0}, + {&__pyx_kp_u_State_index_out_of_range, __pyx_k_State_index_out_of_range, sizeof(__pyx_k_State_index_out_of_range), 0, 1, 0, 0}, + {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s_SymbolTable, __pyx_k_SymbolTable, sizeof(__pyx_k_SymbolTable), 0, 0, 1, 1}, + {&__pyx_n_s_SymbolTableIterator, __pyx_k_SymbolTableIterator, sizeof(__pyx_k_SymbolTableIterator), 0, 0, 1, 1}, + {&__pyx_kp_u_SymbolTableIterator_at_0x_x, __pyx_k_SymbolTableIterator_at_0x_x, sizeof(__pyx_k_SymbolTableIterator_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_SymbolTable_2, __pyx_k_SymbolTable_2, sizeof(__pyx_k_SymbolTable_2), 0, 0, 1, 1}, + {&__pyx_kp_u_SymbolTable_r_at_0x_x, __pyx_k_SymbolTable_r_at_0x_x, sizeof(__pyx_k_SymbolTable_r_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_TOP_SORTED, __pyx_k_TOP_SORTED, sizeof(__pyx_k_TOP_SORTED), 0, 0, 1, 1}, + {&__pyx_n_s_TRINARY_PROPERTIES, __pyx_k_TRINARY_PROPERTIES, sizeof(__pyx_k_TRINARY_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_kp_u_Tsvg, __pyx_k_Tsvg, sizeof(__pyx_k_Tsvg), 0, 1, 0, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_n_s_UNWEIGHTED, __pyx_k_UNWEIGHTED, sizeof(__pyx_k_UNWEIGHTED), 0, 0, 1, 1}, + {&__pyx_n_s_UNWEIGHTED_CYCLES, __pyx_k_UNWEIGHTED_CYCLES, sizeof(__pyx_k_UNWEIGHTED_CYCLES), 0, 0, 1, 1}, + {&__pyx_kp_u_Unknown_arc_type_r, __pyx_k_Unknown_arc_type_r, sizeof(__pyx_k_Unknown_arc_type_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Unknown_compose_filter_type_r, __pyx_k_Unknown_compose_filter_type_r, sizeof(__pyx_k_Unknown_compose_filter_type_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Unknown_determinization_type_r, __pyx_k_Unknown_determinization_type_r, sizeof(__pyx_k_Unknown_determinization_type_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Unknown_map_type_r, __pyx_k_Unknown_map_type_r, sizeof(__pyx_k_Unknown_map_type_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Unknown_queue_type_r, __pyx_k_Unknown_queue_type_r, sizeof(__pyx_k_Unknown_queue_type_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Unknown_random_arc_selection_typ, __pyx_k_Unknown_random_arc_selection_typ, sizeof(__pyx_k_Unknown_random_arc_selection_typ), 0, 1, 0, 0}, + {&__pyx_kp_u_Unknown_replace_label_type_r, __pyx_k_Unknown_replace_label_type_r, sizeof(__pyx_k_Unknown_replace_label_type_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Unknown_sort_type_r, __pyx_k_Unknown_sort_type_r, sizeof(__pyx_k_Unknown_sort_type_r), 0, 1, 0, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_WEIGHTED, __pyx_k_WEIGHTED, sizeof(__pyx_k_WEIGHTED), 0, 0, 1, 1}, + {&__pyx_n_s_WEIGHTED_CYCLES, __pyx_k_WEIGHTED_CYCLES, sizeof(__pyx_k_WEIGHTED_CYCLES), 0, 0, 1, 1}, + {&__pyx_n_s_WEIGHT_INVARIANT_PROPERTIES, __pyx_k_WEIGHT_INVARIANT_PROPERTIES, sizeof(__pyx_k_WEIGHT_INVARIANT_PROPERTIES), 0, 0, 1, 1}, + {&__pyx_n_s_Weight, __pyx_k_Weight, sizeof(__pyx_k_Weight), 0, 0, 1, 1}, + {&__pyx_kp_u_Weight_at_0x_x, __pyx_k_Weight_at_0x_x, sizeof(__pyx_k_Weight_at_0x_x), 0, 1, 0, 0}, + {&__pyx_kp_u_Weight_type_not_found, __pyx_k_Weight_type_not_found, sizeof(__pyx_k_Weight_type_not_found), 0, 1, 0, 0}, + {&__pyx_kp_u_Write_failed_r, __pyx_k_Write_failed_r, sizeof(__pyx_k_Write_failed_r), 0, 1, 0, 0}, + {&__pyx_kp_u_Write_to_string_failed, __pyx_k_Write_to_string_failed, sizeof(__pyx_k_Write_to_string_failed), 0, 1, 0, 0}, + {&__pyx_n_s_Zero, __pyx_k_Zero, sizeof(__pyx_k_Zero), 0, 0, 1, 1}, + {&__pyx_kp_b__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 0, 0}, + {&__pyx_n_s_acceptor, __pyx_k_acceptor, sizeof(__pyx_k_acceptor), 0, 0, 1, 1}, + {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1}, + {&__pyx_n_s_add_state, __pyx_k_add_state, sizeof(__pyx_k_add_state), 0, 0, 1, 1}, + {&__pyx_n_s_add_symbol, __pyx_k_add_symbol, sizeof(__pyx_k_add_symbol), 0, 0, 1, 1}, + {&__pyx_n_s_add_table, __pyx_k_add_table, sizeof(__pyx_k_add_table), 0, 0, 1, 1}, + {&__pyx_n_s_allow_negative_labels, __pyx_k_allow_negative_labels, sizeof(__pyx_k_allow_negative_labels), 0, 0, 1, 1}, + {&__pyx_n_s_allow_nondet, __pyx_k_allow_nondet, sizeof(__pyx_k_allow_nondet), 0, 0, 1, 1}, + {&__pyx_n_s_arc, __pyx_k_arc, sizeof(__pyx_k_arc), 0, 0, 1, 1}, + {&__pyx_n_s_arc_type, __pyx_k_arc_type, sizeof(__pyx_k_arc_type), 0, 0, 1, 1}, + {&__pyx_n_s_arcs, __pyx_k_arcs, sizeof(__pyx_k_arcs), 0, 0, 1, 1}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_attach_new_isymbols, __pyx_k_attach_new_isymbols, sizeof(__pyx_k_attach_new_isymbols), 0, 0, 1, 1}, + {&__pyx_n_s_attach_new_osymbols, __pyx_k_attach_new_osymbols, sizeof(__pyx_k_attach_new_osymbols), 0, 0, 1, 1}, + {&__pyx_n_b_auto, __pyx_k_auto, sizeof(__pyx_k_auto), 0, 0, 0, 1}, + {&__pyx_n_s_available_key, __pyx_k_available_key, sizeof(__pyx_k_available_key), 0, 0, 1, 1}, + {&__pyx_n_s_call_arc_labeling, __pyx_k_call_arc_labeling, sizeof(__pyx_k_call_arc_labeling), 0, 0, 1, 1}, + {&__pyx_n_s_checksum, __pyx_k_checksum, sizeof(__pyx_k_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, + {&__pyx_n_s_closure_plus, __pyx_k_closure_plus, sizeof(__pyx_k_closure_plus), 0, 0, 1, 1}, + {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, + {&__pyx_n_s_communicate, __pyx_k_communicate, sizeof(__pyx_k_communicate), 0, 0, 1, 1}, + {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1}, + {&__pyx_n_s_compose_filter, __pyx_k_compose_filter, sizeof(__pyx_k_compose_filter), 0, 0, 1, 1}, + {&__pyx_n_s_connect, __pyx_k_connect, sizeof(__pyx_k_connect), 0, 0, 1, 1}, + {&__pyx_kp_u_const_EncodeMapper_SymbolTable, __pyx_k_const_EncodeMapper_SymbolTable, sizeof(__pyx_k_const_EncodeMapper_SymbolTable), 0, 1, 0, 0}, + {&__pyx_kp_u_const_Fst_SymbolTable_r_at_0x_x, __pyx_k_const_Fst_SymbolTable_r_at_0x_x, sizeof(__pyx_k_const_Fst_SymbolTable_r_at_0x_x), 0, 1, 0, 0}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_create, __pyx_k_create, sizeof(__pyx_k_create), 0, 0, 1, 1}, + {&__pyx_n_b_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 0, 1}, + {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1}, + {&__pyx_n_s_det_type, __pyx_k_det_type, sizeof(__pyx_k_det_type), 0, 0, 1, 1}, + {&__pyx_n_s_distance, __pyx_k_distance, sizeof(__pyx_k_distance), 0, 0, 1, 1}, + {&__pyx_n_s_divide, __pyx_k_divide, sizeof(__pyx_k_divide), 0, 0, 1, 1}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_done, __pyx_k_done, sizeof(__pyx_k_done), 0, 0, 1, 1}, + {&__pyx_n_u_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 1, 0, 1}, + {&__pyx_n_s_draw, __pyx_k_draw, sizeof(__pyx_k_draw), 0, 0, 1, 1}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_encode_labels, __pyx_k_encode_labels, sizeof(__pyx_k_encode_labels), 0, 0, 1, 1}, + {&__pyx_n_s_encode_weights, __pyx_k_encode_weights, sizeof(__pyx_k_encode_weights), 0, 0, 1, 1}, + {&__pyx_n_s_eps_norm_output, __pyx_k_eps_norm_output, sizeof(__pyx_k_eps_norm_output), 0, 0, 1, 1}, + {&__pyx_n_s_epsilon_on_replace, __pyx_k_epsilon_on_replace, sizeof(__pyx_k_epsilon_on_replace), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_far_type, __pyx_k_far_type, sizeof(__pyx_k_far_type), 0, 0, 1, 1}, + {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1}, + {&__pyx_n_s_final, __pyx_k_final, sizeof(__pyx_k_final), 0, 0, 1, 1}, + {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float_format, __pyx_k_float_format, sizeof(__pyx_k_float_format), 0, 0, 1, 1}, + {&__pyx_n_s_fontsize, __pyx_k_fontsize, sizeof(__pyx_k_fontsize), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fst_type, __pyx_k_fst_type, sizeof(__pyx_k_fst_type), 0, 0, 1, 1}, + {&__pyx_n_b_functional, __pyx_k_functional, sizeof(__pyx_k_functional), 0, 0, 0, 1}, + {&__pyx_n_b_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 0, 1}, + {&__pyx_n_s_get_fst, __pyx_k_get_fst, sizeof(__pyx_k_get_fst), 0, 0, 1, 1}, + {&__pyx_n_s_get_key, __pyx_k_get_key, sizeof(__pyx_k_get_key), 0, 0, 1, 1}, + {&__pyx_n_s_get_nth_key, __pyx_k_get_nth_key, sizeof(__pyx_k_get_nth_key), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_b_identity, __pyx_k_identity, sizeof(__pyx_k_identity), 0, 0, 0, 1}, + {&__pyx_n_s_ifst, __pyx_k_ifst, sizeof(__pyx_k_ifst), 0, 0, 1, 1}, + {&__pyx_n_s_ifst1, __pyx_k_ifst1, sizeof(__pyx_k_ifst1), 0, 0, 1, 1}, + {&__pyx_n_s_ifst2, __pyx_k_ifst2, sizeof(__pyx_k_ifst2), 0, 0, 1, 1}, + {&__pyx_n_b_ilabel, __pyx_k_ilabel, sizeof(__pyx_k_ilabel), 0, 0, 0, 1}, + {&__pyx_n_s_ilabel, __pyx_k_ilabel, sizeof(__pyx_k_ilabel), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_increment_subsequential_label, __pyx_k_increment_subsequential_label, sizeof(__pyx_k_increment_subsequential_label), 0, 0, 1, 1}, + {&__pyx_n_b_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 0, 1}, + {&__pyx_n_s_input_symbols, __pyx_k_input_symbols, sizeof(__pyx_k_input_symbols), 0, 0, 1, 1}, + {&__pyx_n_s_input_table, __pyx_k_input_table, sizeof(__pyx_k_input_table), 0, 0, 1, 1}, + {&__pyx_n_s_ipairs, __pyx_k_ipairs, sizeof(__pyx_k_ipairs), 0, 0, 1, 1}, + {&__pyx_n_s_isymbols, __pyx_k_isymbols, sizeof(__pyx_k_isymbols), 0, 0, 1, 1}, + {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1}, + {&__pyx_n_s_keep_isymbols, __pyx_k_keep_isymbols, sizeof(__pyx_k_keep_isymbols), 0, 0, 1, 1}, + {&__pyx_n_s_keep_osymbols, __pyx_k_keep_osymbols, sizeof(__pyx_k_keep_osymbols), 0, 0, 1, 1}, + {&__pyx_n_s_keep_state_numbering, __pyx_k_keep_state_numbering, sizeof(__pyx_k_keep_state_numbering), 0, 0, 1, 1}, + {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, + {&__pyx_n_s_labeled_checksum, __pyx_k_labeled_checksum, sizeof(__pyx_k_labeled_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_lhs, __pyx_k_lhs, sizeof(__pyx_k_lhs), 0, 0, 1, 1}, + {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_map_type, __pyx_k_map_type, sizeof(__pyx_k_map_type), 0, 0, 1, 1}, + {&__pyx_n_s_mask, __pyx_k_mask, sizeof(__pyx_k_mask), 0, 0, 1, 1}, + {&__pyx_n_s_max_length, __pyx_k_max_length, sizeof(__pyx_k_max_length), 0, 0, 1, 1}, + {&__pyx_n_s_member, __pyx_k_member, sizeof(__pyx_k_member), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_missing_sym, __pyx_k_missing_sym, sizeof(__pyx_k_missing_sym), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_mutable_arcs, __pyx_k_mutable_arcs, sizeof(__pyx_k_mutable_arcs), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_b_neither, __pyx_k_neither, sizeof(__pyx_k_neither), 0, 0, 0, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_new_isymbols, __pyx_k_new_isymbols, sizeof(__pyx_k_new_isymbols), 0, 0, 1, 1}, + {&__pyx_n_s_new_osymbols, __pyx_k_new_osymbols, sizeof(__pyx_k_new_osymbols), 0, 0, 1, 1}, + {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1}, + {&__pyx_n_s_nextstate, __pyx_k_nextstate, sizeof(__pyx_k_nextstate), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_nodesep, __pyx_k_nodesep, sizeof(__pyx_k_nodesep), 0, 0, 1, 1}, + {&__pyx_n_s_npath, __pyx_k_npath, sizeof(__pyx_k_npath), 0, 0, 1, 1}, + {&__pyx_n_s_nshortest, __pyx_k_nshortest, sizeof(__pyx_k_nshortest), 0, 0, 1, 1}, + {&__pyx_n_s_nstate, __pyx_k_nstate, sizeof(__pyx_k_nstate), 0, 0, 1, 1}, + {&__pyx_n_s_num_arcs, __pyx_k_num_arcs, sizeof(__pyx_k_num_arcs), 0, 0, 1, 1}, + {&__pyx_n_s_num_input_epsilons, __pyx_k_num_input_epsilons, sizeof(__pyx_k_num_input_epsilons), 0, 0, 1, 1}, + {&__pyx_n_s_num_output_epsilons, __pyx_k_num_output_epsilons, sizeof(__pyx_k_num_output_epsilons), 0, 0, 1, 1}, + {&__pyx_n_s_num_states, __pyx_k_num_states, sizeof(__pyx_k_num_states), 0, 0, 1, 1}, + {&__pyx_n_s_num_symbols, __pyx_k_num_symbols, sizeof(__pyx_k_num_symbols), 0, 0, 1, 1}, + {&__pyx_n_s_numbers, __pyx_k_numbers, sizeof(__pyx_k_numbers), 0, 0, 1, 1}, + {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, + {&__pyx_n_s_olabel, __pyx_k_olabel, sizeof(__pyx_k_olabel), 0, 0, 1, 1}, + {&__pyx_n_s_old_isymbols, __pyx_k_old_isymbols, sizeof(__pyx_k_old_isymbols), 0, 0, 1, 1}, + {&__pyx_n_s_old_osymbols, __pyx_k_old_osymbols, sizeof(__pyx_k_old_osymbols), 0, 0, 1, 1}, + {&__pyx_n_s_opairs, __pyx_k_opairs, sizeof(__pyx_k_opairs), 0, 0, 1, 1}, + {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, + {&__pyx_n_s_osymbols, __pyx_k_osymbols, sizeof(__pyx_k_osymbols), 0, 0, 1, 1}, + {&__pyx_n_s_output_symbols, __pyx_k_output_symbols, sizeof(__pyx_k_output_symbols), 0, 0, 1, 1}, + {&__pyx_n_s_pairs, __pyx_k_pairs, sizeof(__pyx_k_pairs), 0, 0, 1, 1}, + {&__pyx_n_s_plus, __pyx_k_plus, sizeof(__pyx_k_plus), 0, 0, 1, 1}, + {&__pyx_n_s_portrait, __pyx_k_portrait, sizeof(__pyx_k_portrait), 0, 0, 1, 1}, + {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1}, + {&__pyx_n_s_potentials, __pyx_k_potentials, sizeof(__pyx_k_potentials), 0, 0, 1, 1}, + {&__pyx_n_s_power, __pyx_k_power, sizeof(__pyx_k_power), 0, 0, 1, 1}, + {&__pyx_n_s_precision, __pyx_k_precision, sizeof(__pyx_k_precision), 0, 0, 1, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_project_output, __pyx_k_project_output, sizeof(__pyx_k_project_output), 0, 0, 1, 1}, + {&__pyx_n_s_properties, __pyx_k_properties, sizeof(__pyx_k_properties), 0, 0, 1, 1}, + {&__pyx_n_s_props, __pyx_k_props, sizeof(__pyx_k_props), 0, 0, 1, 1}, + {&__pyx_n_s_push_labels, __pyx_k_push_labels, sizeof(__pyx_k_push_labels), 0, 0, 1, 1}, + {&__pyx_n_s_push_weights, __pyx_k_push_weights, sizeof(__pyx_k_push_weights), 0, 0, 1, 1}, + {&__pyx_n_s_pywrapfst_2, __pyx_k_pywrapfst_2, sizeof(__pyx_k_pywrapfst_2), 0, 0, 1, 1}, + {&__pyx_kp_s_pywrapfst_pyx, __pyx_k_pywrapfst_pyx, sizeof(__pyx_k_pywrapfst_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, + {&__pyx_n_s_queue_type, __pyx_k_queue_type, sizeof(__pyx_k_queue_type), 0, 0, 1, 1}, + {&__pyx_n_s_ranksep, __pyx_k_ranksep, sizeof(__pyx_k_ranksep), 0, 0, 1, 1}, + {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1}, + {&__pyx_n_s_read_Fst_from_string, __pyx_k_read_Fst_from_string, sizeof(__pyx_k_read_Fst_from_string), 0, 0, 1, 1}, + {&__pyx_n_s_read_SymbolTable_from_string, __pyx_k_read_SymbolTable_from_string, sizeof(__pyx_k_read_SymbolTable_from_string), 0, 0, 1, 1}, + {&__pyx_n_s_read_from_string, __pyx_k_read_from_string, sizeof(__pyx_k_read_from_string), 0, 0, 1, 1}, + {&__pyx_n_s_read_fst, __pyx_k_read_fst, sizeof(__pyx_k_read_fst), 0, 0, 1, 1}, + {&__pyx_n_s_read_text, __pyx_k_read_text, sizeof(__pyx_k_read_text), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_remove_common_affix, __pyx_k_remove_common_affix, sizeof(__pyx_k_remove_common_affix), 0, 0, 1, 1}, + {&__pyx_n_s_remove_total_weight, __pyx_k_remove_total_weight, sizeof(__pyx_k_remove_total_weight), 0, 0, 1, 1}, + {&__pyx_n_s_require_superinitial, __pyx_k_require_superinitial, sizeof(__pyx_k_require_superinitial), 0, 0, 1, 1}, + {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, + {&__pyx_n_s_return_arc_labeling, __pyx_k_return_arc_labeling, sizeof(__pyx_k_return_arc_labeling), 0, 0, 1, 1}, + {&__pyx_n_s_return_label, __pyx_k_return_label, sizeof(__pyx_k_return_label), 0, 0, 1, 1}, + {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1}, + {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1}, + {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1}, + {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1}, + {&__pyx_n_s_select, __pyx_k_select, sizeof(__pyx_k_select), 0, 0, 1, 1}, + {&__pyx_kp_s_self__aiter_self__fst_cannot_be, __pyx_k_self__aiter_self__fst_cannot_be, sizeof(__pyx_k_self__aiter_self__fst_cannot_be), 0, 0, 1, 0}, + {&__pyx_kp_s_self__aiter_self__mfst_cannot_be, __pyx_k_self__aiter_self__mfst_cannot_be, sizeof(__pyx_k_self__aiter_self__mfst_cannot_be), 0, 0, 1, 0}, + {&__pyx_kp_s_self__arc_cannot_be_converted_to, __pyx_k_self__arc_cannot_be_converted_to, sizeof(__pyx_k_self__arc_cannot_be_converted_to), 0, 0, 1, 0}, + {&__pyx_kp_s_self__encoder_cannot_be_converte, __pyx_k_self__encoder_cannot_be_converte, sizeof(__pyx_k_self__encoder_cannot_be_converte), 0, 0, 1, 0}, + {&__pyx_kp_s_self__fst_self__siter_cannot_be, __pyx_k_self__fst_self__siter_cannot_be, sizeof(__pyx_k_self__fst_self__siter_cannot_be), 0, 0, 1, 0}, + {&__pyx_kp_s_self__reader_cannot_be_converted, __pyx_k_self__reader_cannot_be_converted, sizeof(__pyx_k_self__reader_cannot_be_converted), 0, 0, 1, 0}, + {&__pyx_kp_s_self__siter_self__table_cannot_b, __pyx_k_self__siter_self__table_cannot_b, sizeof(__pyx_k_self__siter_self__table_cannot_b), 0, 0, 1, 0}, + {&__pyx_kp_s_self__weight_cannot_be_converted, __pyx_k_self__weight_cannot_be_converted, sizeof(__pyx_k_self__weight_cannot_be_converted), 0, 0, 1, 0}, + {&__pyx_kp_s_self__writer_cannot_be_converted, __pyx_k_self__writer_cannot_be_converted, sizeof(__pyx_k_self__writer_cannot_be_converted), 0, 0, 1, 0}, + {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, + {&__pyx_n_s_set_flags, __pyx_k_set_flags, sizeof(__pyx_k_set_flags), 0, 0, 1, 1}, + {&__pyx_n_s_set_input_symbols, __pyx_k_set_input_symbols, sizeof(__pyx_k_set_input_symbols), 0, 0, 1, 1}, + {&__pyx_n_s_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1}, + {&__pyx_n_s_set_output_symbols, __pyx_k_set_output_symbols, sizeof(__pyx_k_set_output_symbols), 0, 0, 1, 1}, + {&__pyx_n_s_set_value, __pyx_k_set_value, sizeof(__pyx_k_set_value), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shortestdistance, __pyx_k_shortestdistance, sizeof(__pyx_k_shortestdistance), 0, 0, 1, 1}, + {&__pyx_n_s_show_weight_one, __pyx_k_show_weight_one, sizeof(__pyx_k_show_weight_one), 0, 0, 1, 1}, + {&__pyx_n_s_sort_type, __pyx_k_sort_type, sizeof(__pyx_k_sort_type), 0, 0, 1, 1}, + {&__pyx_n_s_ssymbols, __pyx_k_ssymbols, sizeof(__pyx_k_ssymbols), 0, 0, 1, 1}, + {&__pyx_n_b_standard, __pyx_k_standard, sizeof(__pyx_k_standard), 0, 0, 0, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, + {&__pyx_n_s_states, __pyx_k_states, sizeof(__pyx_k_states), 0, 0, 1, 1}, + {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, + {&__pyx_n_s_stdin, __pyx_k_stdin, sizeof(__pyx_k_stdin), 0, 0, 1, 1}, + {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1}, + {&__pyx_n_s_subprocess, __pyx_k_subprocess, sizeof(__pyx_k_subprocess), 0, 0, 1, 1}, + {&__pyx_n_s_subsequential_label, __pyx_k_subsequential_label, sizeof(__pyx_k_subsequential_label), 0, 0, 1, 1}, + {&__pyx_n_s_symbol, __pyx_k_symbol, sizeof(__pyx_k_symbol), 0, 0, 1, 1}, + {&__pyx_n_s_syms, __pyx_k_syms, sizeof(__pyx_k_syms), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1}, + {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1}, + {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, + {&__pyx_n_s_times, __pyx_k_times, sizeof(__pyx_k_times), 0, 0, 1, 1}, + {&__pyx_n_s_title, __pyx_k_title, sizeof(__pyx_k_title), 0, 0, 1, 1}, + {&__pyx_n_s_to_final, __pyx_k_to_final, sizeof(__pyx_k_to_final), 0, 0, 1, 1}, + {&__pyx_n_s_to_string, __pyx_k_to_string, sizeof(__pyx_k_to_string), 0, 0, 1, 1}, + {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, + {&__pyx_n_b_uniform, __pyx_k_uniform, sizeof(__pyx_k_uniform), 0, 0, 0, 1}, + {&__pyx_n_s_unique, __pyx_k_unique, sizeof(__pyx_k_unique), 0, 0, 1, 1}, + {&__pyx_n_s_unknown_isymbol, __pyx_k_unknown_isymbol, sizeof(__pyx_k_unknown_isymbol), 0, 0, 1, 1}, + {&__pyx_n_s_unknown_osymbol, __pyx_k_unknown_osymbol, sizeof(__pyx_k_unknown_osymbol), 0, 0, 1, 1}, + {&__pyx_kp_u_unspecified, __pyx_k_unspecified, sizeof(__pyx_k_unspecified), 0, 1, 0, 0}, + {&__pyx_n_u_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 1, 0, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_b_vector, __pyx_k_vector, sizeof(__pyx_k_vector), 0, 0, 0, 1}, + {&__pyx_n_s_verify, __pyx_k_verify, sizeof(__pyx_k_verify), 0, 0, 1, 1}, + {&__pyx_n_s_vertical, __pyx_k_vertical, sizeof(__pyx_k_vertical), 0, 0, 1, 1}, + {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, + {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1}, + {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1}, + {&__pyx_n_s_weight_type, __pyx_k_weight_type, sizeof(__pyx_k_weight_type), 0, 0, 1, 1}, + {&__pyx_n_s_weighted, __pyx_k_weighted, sizeof(__pyx_k_weighted), 0, 0, 1, 1}, + {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1}, + {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, + {&__pyx_n_s_write_text, __pyx_k_write_text, sizeof(__pyx_k_write_text), 0, 0, 1, 1}, + {&__pyx_n_s_write_to_string, __pyx_k_write_to_string, sizeof(__pyx_k_write_to_string), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 2766, __pyx_L1_error) + __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 2786, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 1170, __pyx_L1_error) + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 4393, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_self__weight_cannot_be_converted); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "(tree fragment)":4 + * raise TypeError("self._weight cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._weight cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_self__weight_cannot_be_converted); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + */ + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self__siter_self__table_cannot_b); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "(tree fragment)":4 + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._siter,self._table cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self__siter_self__table_cannot_b); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + */ + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_self__encoder_cannot_be_converte); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + + /* "(tree fragment)":4 + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._encoder cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_self__encoder_cannot_be_converte); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "pywrapfst.pyx":1402 + * @staticmethod + * cdef string _local_render_svg(const string &dot): + * proc = subprocess.Popen(("dot", "-Tsvg"), # <<<<<<<<<<<<<< + * stdin=subprocess.PIPE, + * stdout=subprocess.PIPE) + */ + __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_u_dot, __pyx_kp_u_Tsvg); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_tuple__8); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 1402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_self__arc_cannot_be_converted_to); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + + /* "(tree fragment)":4 + * raise TypeError("self._arc cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._arc cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_self__arc_cannot_be_converted_to); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + */ + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_self__aiter_self__fst_cannot_be); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + + /* "(tree fragment)":4 + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._fst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_self__aiter_self__fst_cannot_be); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + */ + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_self__aiter_self__mfst_cannot_be); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + + /* "(tree fragment)":4 + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._aiter,self._mfst cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_self__aiter_self__mfst_cannot_be); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + */ + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_self__fst_self__siter_cannot_be); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + + /* "(tree fragment)":4 + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._fst,self._siter cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_self__fst_self__siter_cannot_be); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + */ + __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_self__reader_cannot_be_converted); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + + /* "(tree fragment)":4 + * raise TypeError("self._reader cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._reader cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_self__reader_cannot_be_converted); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + */ + __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_self__writer_cannot_be_converted); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); + + /* "(tree fragment)":4 + * raise TypeError("self._writer cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._writer cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_self__writer_cannot_be_converted); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + + /* "pywrapfst.pyx":445 + * + * + * def plus(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * plus(lhs, rhs) + */ + __pyx_tuple__60 = PyTuple_Pack(3, __pyx_n_s_lhs, __pyx_n_s_rhs, __pyx_n_s_result); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__60); + __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_plus, 445, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 445, __pyx_L1_error) + + /* "pywrapfst.pyx":477 + * + * + * def times(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * times(lhs, rhs) + */ + __pyx_tuple__62 = PyTuple_Pack(3, __pyx_n_s_lhs, __pyx_n_s_rhs, __pyx_n_s_result); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__62); + __Pyx_GIVEREF(__pyx_tuple__62); + __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_times, 477, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 477, __pyx_L1_error) + + /* "pywrapfst.pyx":509 + * + * + * def divide(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * divide(lhs, rhs) + */ + __pyx_tuple__64 = PyTuple_Pack(3, __pyx_n_s_lhs, __pyx_n_s_rhs, __pyx_n_s_result); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__64); + __Pyx_GIVEREF(__pyx_tuple__64); + __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_divide, 509, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 509, __pyx_L1_error) + + /* "pywrapfst.pyx":542 + * + * + * def power(Weight w, size_t n): # <<<<<<<<<<<<<< + * """ + * power(lhs, rhs) + */ + __pyx_tuple__66 = PyTuple_Pack(3, __pyx_n_s_w, __pyx_n_s_n, __pyx_n_s_result); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__66); + __Pyx_GIVEREF(__pyx_tuple__66); + __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_power, 542, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 542, __pyx_L1_error) + + /* "pywrapfst.pyx":2766 + * + * + * class Fst(object): # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_tuple__68 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 2766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__68); + __Pyx_GIVEREF(__pyx_tuple__68); + + /* "pywrapfst.pyx":2783 + * """ + * + * def __new__(cls, arc_type=b"standard"): # <<<<<<<<<<<<<< + * return _create_Fst(arc_type) + * + */ + __pyx_tuple__69 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_arc_type); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 2783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__69); + __Pyx_GIVEREF(__pyx_tuple__69); + __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_new, 2783, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 2783, __pyx_L1_error) + __pyx_tuple__71 = PyTuple_Pack(1, ((PyObject*)__pyx_n_b_standard)); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 2783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__71); + __Pyx_GIVEREF(__pyx_tuple__71); + + /* "pywrapfst.pyx":2787 + * + * @staticmethod + * def read(filename): # <<<<<<<<<<<<<< + * """ + * read(filename): + */ + __pyx_tuple__72 = PyTuple_Pack(1, __pyx_n_s_filename); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 2787, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__72); + __Pyx_GIVEREF(__pyx_tuple__72); + __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_read, 2787, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 2787, __pyx_L1_error) + + /* "pywrapfst.pyx":2805 + * + * @staticmethod + * def read_from_string(state): # <<<<<<<<<<<<<< + * """ + * read_from_string(string, fst_type=None) + */ + __pyx_tuple__74 = PyTuple_Pack(1, __pyx_n_s_state); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 2805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__74); + __Pyx_GIVEREF(__pyx_tuple__74); + __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_read_from_string, 2805, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 2805, __pyx_L1_error) + + /* "pywrapfst.pyx":3980 + * + * + * def shortestdistance(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, + */ + __pyx_tuple__76 = PyTuple_Pack(8, __pyx_n_s_ifst, __pyx_n_s_delta, __pyx_n_s_nstate, __pyx_n_s_queue_type, __pyx_n_s_reverse, __pyx_n_s_distance, __pyx_n_s_weight_type, __pyx_n_s_weight); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 3980, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__76); + __Pyx_GIVEREF(__pyx_tuple__76); + __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pywrapfst_pyx, __pyx_n_s_shortestdistance, 3980, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 3980, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + return 0; + __pyx_L1_error:; + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("tostring", (void (*)(void))__pyx_f_9pywrapfst_tostring, "std::string (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("weight_tostring", (void (*)(void))__pyx_f_9pywrapfst_weight_tostring, "std::string (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_get_compose_filter", (void (*)(void))__pyx_f_9pywrapfst__get_compose_filter, "enum fst::ComposeFilter (std::string const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_get_determinize_type", (void (*)(void))__pyx_f_9pywrapfst__get_determinize_type, "enum fst::DeterminizeType (std::string const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_get_queue_type", (void (*)(void))__pyx_f_9pywrapfst__get_queue_type, "enum fst::QueueType (std::string const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_get_rand_arc_selection", (void (*)(void))__pyx_f_9pywrapfst__get_rand_arc_selection, "enum fst::script::RandArcSelection (std::string const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_get_replace_label_type", (void (*)(void))__pyx_f_9pywrapfst__get_replace_label_type, "enum fst::ReplaceLabelType (std::string const &, bool)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_get_WeightClass_or_One", (void (*)(void))__pyx_f_9pywrapfst__get_WeightClass_or_One, "fst::script::WeightClass (std::string const &, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_get_WeightClass_or_Zero", (void (*)(void))__pyx_f_9pywrapfst__get_WeightClass_or_Zero, "fst::script::WeightClass (std::string const &, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_Zero", (void (*)(void))__pyx_f_9pywrapfst__Zero, "struct __pyx_obj_9pywrapfst_Weight *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_One", (void (*)(void))__pyx_f_9pywrapfst__One, "struct __pyx_obj_9pywrapfst_Weight *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_NoWeight", (void (*)(void))__pyx_f_9pywrapfst__NoWeight, "struct __pyx_obj_9pywrapfst_Weight *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_plus", (void (*)(void))__pyx_f_9pywrapfst__plus, "struct __pyx_obj_9pywrapfst_Weight *(struct __pyx_obj_9pywrapfst_Weight *, struct __pyx_obj_9pywrapfst_Weight *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_times", (void (*)(void))__pyx_f_9pywrapfst__times, "struct __pyx_obj_9pywrapfst_Weight *(struct __pyx_obj_9pywrapfst_Weight *, struct __pyx_obj_9pywrapfst_Weight *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_divide", (void (*)(void))__pyx_f_9pywrapfst__divide, "struct __pyx_obj_9pywrapfst_Weight *(struct __pyx_obj_9pywrapfst_Weight *, struct __pyx_obj_9pywrapfst_Weight *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_power", (void (*)(void))__pyx_f_9pywrapfst__power, "struct __pyx_obj_9pywrapfst_Weight *(struct __pyx_obj_9pywrapfst_Weight *, size_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_EncodeMapperSymbolTable", (void (*)(void))__pyx_f_9pywrapfst__init_EncodeMapperSymbolTable, "struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *(fst::SymbolTable *, std::shared_ptr )") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_FstSymbolTable", (void (*)(void))__pyx_f_9pywrapfst__init_FstSymbolTable, "struct __pyx_obj_9pywrapfst__FstSymbolTable *(fst::SymbolTable *, std::shared_ptr )") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_MutableFstSymbolTable", (void (*)(void))__pyx_f_9pywrapfst__init_MutableFstSymbolTable, "struct __pyx_obj_9pywrapfst__MutableFstSymbolTable *(fst::SymbolTable *, std::shared_ptr )") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_SymbolTable", (void (*)(void))__pyx_f_9pywrapfst__init_SymbolTable, "struct __pyx_obj_9pywrapfst_SymbolTable *(fst::SymbolTable *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_read_SymbolTable_from_string", (void (*)(void))__pyx_f_9pywrapfst__read_SymbolTable_from_string, "struct __pyx_obj_9pywrapfst_SymbolTable *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_Fst", (void (*)(void))__pyx_f_9pywrapfst__init_Fst, "struct __pyx_obj_9pywrapfst__Fst *(__pyx_t_9pywrapfst_FstClass_ptr)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_MutableFst", (void (*)(void))__pyx_f_9pywrapfst__init_MutableFst, "struct __pyx_obj_9pywrapfst__MutableFst *(__pyx_t_9pywrapfst_MutableFstClass_ptr)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_XFst", (void (*)(void))__pyx_f_9pywrapfst__init_XFst, "struct __pyx_obj_9pywrapfst__Fst *(__pyx_t_9pywrapfst_FstClass_ptr)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_create_Fst", (void (*)(void))__pyx_f_9pywrapfst__create_Fst, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_opt_args_9pywrapfst__create_Fst *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_read", (void (*)(void))__pyx_f_9pywrapfst__read, "struct __pyx_obj_9pywrapfst__Fst *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_read_Fst_from_string", (void (*)(void))__pyx_f_9pywrapfst__read_Fst_from_string, "struct __pyx_obj_9pywrapfst__Fst *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_init_Arc", (void (*)(void))__pyx_f_9pywrapfst__init_Arc, "struct __pyx_obj_9pywrapfst_Arc *(fst::script::ArcClass const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_map", (void (*)(void))__pyx_f_9pywrapfst__map, "struct __pyx_obj_9pywrapfst__Fst *(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_opt_args_9pywrapfst__map *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("arcmap", (void (*)(void))__pyx_f_9pywrapfst_arcmap, "struct __pyx_obj_9pywrapfst__Fst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_arcmap *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("compose", (void (*)(void))__pyx_f_9pywrapfst_compose, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_compose *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("convert", (void (*)(void))__pyx_f_9pywrapfst_convert, "struct __pyx_obj_9pywrapfst__Fst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_convert *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("determinize", (void (*)(void))__pyx_f_9pywrapfst_determinize, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_determinize *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("difference", (void (*)(void))__pyx_f_9pywrapfst_difference, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_difference *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("disambiguate", (void (*)(void))__pyx_f_9pywrapfst_disambiguate, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_disambiguate *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("epsnormalize", (void (*)(void))__pyx_f_9pywrapfst_epsnormalize, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_epsnormalize *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("equal", (void (*)(void))__pyx_f_9pywrapfst_equal, "bool (struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_equal *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("equivalent", (void (*)(void))__pyx_f_9pywrapfst_equivalent, "bool (struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_equivalent *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("intersect", (void (*)(void))__pyx_f_9pywrapfst_intersect, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_intersect *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("isomorphic", (void (*)(void))__pyx_f_9pywrapfst_isomorphic, "bool (struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_isomorphic *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("prune", (void (*)(void))__pyx_f_9pywrapfst_prune, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_prune *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("push", (void (*)(void))__pyx_f_9pywrapfst_push, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_push *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("randequivalent", (void (*)(void))__pyx_f_9pywrapfst_randequivalent, "bool (struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_randequivalent *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("randgen", (void (*)(void))__pyx_f_9pywrapfst_randgen, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_randgen *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("replace", (void (*)(void))__pyx_f_9pywrapfst_replace, "struct __pyx_obj_9pywrapfst__MutableFst *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_replace *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("reverse", (void (*)(void))__pyx_f_9pywrapfst_reverse, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_reverse *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("_shortestdistance", (void (*)(void))__pyx_f_9pywrapfst__shortestdistance, "std::vector *(struct __pyx_obj_9pywrapfst__Fst *, struct __pyx_opt_args_9pywrapfst__shortestdistance *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("shortestpath", (void (*)(void))__pyx_f_9pywrapfst_shortestpath, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_shortestpath *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("statemap", (void (*)(void))__pyx_f_9pywrapfst_statemap, "struct __pyx_obj_9pywrapfst__Fst *(struct __pyx_obj_9pywrapfst__Fst *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("synchronize", (void (*)(void))__pyx_f_9pywrapfst_synchronize, "struct __pyx_obj_9pywrapfst__MutableFst *(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_9pywrapfst_Weight = &__pyx_vtable_9pywrapfst_Weight; + __pyx_vtable_9pywrapfst_Weight._check_weight = (void (*)(struct __pyx_obj_9pywrapfst_Weight *))__pyx_f_9pywrapfst_6Weight__check_weight; + __pyx_vtable_9pywrapfst_Weight.copy = (struct __pyx_obj_9pywrapfst_Weight *(*)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_6Weight_copy; + __pyx_vtable_9pywrapfst_Weight.to_string = (std::string (*)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_6Weight_to_string; + __pyx_vtable_9pywrapfst_Weight.type = (std::string (*)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_6Weight_type; + __pyx_vtable_9pywrapfst_Weight.member = (bool (*)(struct __pyx_obj_9pywrapfst_Weight *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_6Weight_member; + if (PyType_Ready(&__pyx_type_9pywrapfst_Weight) < 0) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_type_9pywrapfst_Weight.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_Weight.tp_dictoffset && __pyx_type_9pywrapfst_Weight.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_Weight.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_Weight.tp_dict, __pyx_vtabptr_9pywrapfst_Weight) < 0) __PYX_ERR(0, 334, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Weight, (PyObject *)&__pyx_type_9pywrapfst_Weight) < 0) __PYX_ERR(0, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_Weight) < 0) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_ptype_9pywrapfst_Weight = &__pyx_type_9pywrapfst_Weight; + __pyx_vtabptr_9pywrapfst__SymbolTable = &__pyx_vtable_9pywrapfst__SymbolTable; + __pyx_vtable_9pywrapfst__SymbolTable.available_key = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_available_key; + __pyx_vtable_9pywrapfst__SymbolTable.checksum = (PyObject *(*)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_checksum; + __pyx_vtable_9pywrapfst__SymbolTable.copy = (struct __pyx_obj_9pywrapfst_SymbolTable *(*)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_copy; + __pyx_vtable_9pywrapfst__SymbolTable.get_nth_key = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst__SymbolTable *, Py_ssize_t, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_get_nth_key; + __pyx_vtable_9pywrapfst__SymbolTable.labeled_checksum = (PyObject *(*)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_labeled_checksum; + __pyx_vtable_9pywrapfst__SymbolTable.member = (bool (*)(struct __pyx_obj_9pywrapfst__SymbolTable *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_member; + __pyx_vtable_9pywrapfst__SymbolTable.name = (std::string (*)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_name; + __pyx_vtable_9pywrapfst__SymbolTable.num_symbols = (size_t (*)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_num_symbols; + __pyx_vtable_9pywrapfst__SymbolTable.write = (void (*)(struct __pyx_obj_9pywrapfst__SymbolTable *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_write; + __pyx_vtable_9pywrapfst__SymbolTable.write_text = (void (*)(struct __pyx_obj_9pywrapfst__SymbolTable *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_write_text; + __pyx_vtable_9pywrapfst__SymbolTable.write_to_string = (PyObject *(*)(struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12_SymbolTable_write_to_string; + if (PyType_Ready(&__pyx_type_9pywrapfst__SymbolTable) < 0) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_type_9pywrapfst__SymbolTable.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst__SymbolTable.tp_dictoffset && __pyx_type_9pywrapfst__SymbolTable.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst__SymbolTable.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst__SymbolTable.tp_dict, __pyx_vtabptr_9pywrapfst__SymbolTable) < 0) __PYX_ERR(0, 664, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SymbolTable, (PyObject *)&__pyx_type_9pywrapfst__SymbolTable) < 0) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_ptype_9pywrapfst__SymbolTable = &__pyx_type_9pywrapfst__SymbolTable; + __pyx_vtabptr_9pywrapfst__EncodeMapperSymbolTable = &__pyx_vtable_9pywrapfst__EncodeMapperSymbolTable; + __pyx_vtable_9pywrapfst__EncodeMapperSymbolTable.__pyx_base = *__pyx_vtabptr_9pywrapfst__SymbolTable; + __pyx_type_9pywrapfst__EncodeMapperSymbolTable.tp_base = __pyx_ptype_9pywrapfst__SymbolTable; + if (PyType_Ready(&__pyx_type_9pywrapfst__EncodeMapperSymbolTable) < 0) __PYX_ERR(0, 852, __pyx_L1_error) + __pyx_type_9pywrapfst__EncodeMapperSymbolTable.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst__EncodeMapperSymbolTable.tp_dictoffset && __pyx_type_9pywrapfst__EncodeMapperSymbolTable.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst__EncodeMapperSymbolTable.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst__EncodeMapperSymbolTable.tp_dict, __pyx_vtabptr_9pywrapfst__EncodeMapperSymbolTable) < 0) __PYX_ERR(0, 852, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_EncodeMapperSymbolTable, (PyObject *)&__pyx_type_9pywrapfst__EncodeMapperSymbolTable) < 0) __PYX_ERR(0, 852, __pyx_L1_error) + __pyx_ptype_9pywrapfst__EncodeMapperSymbolTable = &__pyx_type_9pywrapfst__EncodeMapperSymbolTable; + __pyx_vtabptr_9pywrapfst__FstSymbolTable = &__pyx_vtable_9pywrapfst__FstSymbolTable; + __pyx_vtable_9pywrapfst__FstSymbolTable.__pyx_base = *__pyx_vtabptr_9pywrapfst__SymbolTable; + __pyx_type_9pywrapfst__FstSymbolTable.tp_base = __pyx_ptype_9pywrapfst__SymbolTable; + if (PyType_Ready(&__pyx_type_9pywrapfst__FstSymbolTable) < 0) __PYX_ERR(0, 872, __pyx_L1_error) + __pyx_type_9pywrapfst__FstSymbolTable.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst__FstSymbolTable.tp_dictoffset && __pyx_type_9pywrapfst__FstSymbolTable.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst__FstSymbolTable.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst__FstSymbolTable.tp_dict, __pyx_vtabptr_9pywrapfst__FstSymbolTable) < 0) __PYX_ERR(0, 872, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FstSymbolTable, (PyObject *)&__pyx_type_9pywrapfst__FstSymbolTable) < 0) __PYX_ERR(0, 872, __pyx_L1_error) + __pyx_ptype_9pywrapfst__FstSymbolTable = &__pyx_type_9pywrapfst__FstSymbolTable; + __pyx_vtabptr_9pywrapfst__MutableSymbolTable = &__pyx_vtable_9pywrapfst__MutableSymbolTable; + __pyx_vtable_9pywrapfst__MutableSymbolTable.__pyx_base = *__pyx_vtabptr_9pywrapfst__SymbolTable; + __pyx_vtable_9pywrapfst__MutableSymbolTable.add_symbol = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst__MutableSymbolTable *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_19_MutableSymbolTable_add_symbol *__pyx_optional_args))__pyx_f_9pywrapfst_19_MutableSymbolTable_add_symbol; + __pyx_vtable_9pywrapfst__MutableSymbolTable.add_table = (void (*)(struct __pyx_obj_9pywrapfst__MutableSymbolTable *, struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_19_MutableSymbolTable_add_table; + __pyx_vtable_9pywrapfst__MutableSymbolTable.set_name = (void (*)(struct __pyx_obj_9pywrapfst__MutableSymbolTable *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_19_MutableSymbolTable_set_name; + __pyx_type_9pywrapfst__MutableSymbolTable.tp_base = __pyx_ptype_9pywrapfst__SymbolTable; + if (PyType_Ready(&__pyx_type_9pywrapfst__MutableSymbolTable) < 0) __PYX_ERR(0, 891, __pyx_L1_error) + __pyx_type_9pywrapfst__MutableSymbolTable.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst__MutableSymbolTable.tp_dictoffset && __pyx_type_9pywrapfst__MutableSymbolTable.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst__MutableSymbolTable.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst__MutableSymbolTable.tp_dict, __pyx_vtabptr_9pywrapfst__MutableSymbolTable) < 0) __PYX_ERR(0, 891, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MutableSymbolTable, (PyObject *)&__pyx_type_9pywrapfst__MutableSymbolTable) < 0) __PYX_ERR(0, 891, __pyx_L1_error) + __pyx_ptype_9pywrapfst__MutableSymbolTable = &__pyx_type_9pywrapfst__MutableSymbolTable; + __pyx_vtabptr_9pywrapfst__MutableFstSymbolTable = &__pyx_vtable_9pywrapfst__MutableFstSymbolTable; + __pyx_vtable_9pywrapfst__MutableFstSymbolTable.__pyx_base = *__pyx_vtabptr_9pywrapfst__MutableSymbolTable; + __pyx_type_9pywrapfst__MutableFstSymbolTable.tp_base = __pyx_ptype_9pywrapfst__MutableSymbolTable; + if (PyType_Ready(&__pyx_type_9pywrapfst__MutableFstSymbolTable) < 0) __PYX_ERR(0, 943, __pyx_L1_error) + __pyx_type_9pywrapfst__MutableFstSymbolTable.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst__MutableFstSymbolTable.tp_dictoffset && __pyx_type_9pywrapfst__MutableFstSymbolTable.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst__MutableFstSymbolTable.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst__MutableFstSymbolTable.tp_dict, __pyx_vtabptr_9pywrapfst__MutableFstSymbolTable) < 0) __PYX_ERR(0, 943, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MutableFstSymbolTable, (PyObject *)&__pyx_type_9pywrapfst__MutableFstSymbolTable) < 0) __PYX_ERR(0, 943, __pyx_L1_error) + __pyx_ptype_9pywrapfst__MutableFstSymbolTable = &__pyx_type_9pywrapfst__MutableFstSymbolTable; + __pyx_vtabptr_9pywrapfst_SymbolTable = &__pyx_vtable_9pywrapfst_SymbolTable; + __pyx_vtable_9pywrapfst_SymbolTable.__pyx_base = *__pyx_vtabptr_9pywrapfst__MutableSymbolTable; + __pyx_type_9pywrapfst_SymbolTable.tp_base = __pyx_ptype_9pywrapfst__MutableSymbolTable; + if (PyType_Ready(&__pyx_type_9pywrapfst_SymbolTable) < 0) __PYX_ERR(0, 954, __pyx_L1_error) + __pyx_type_9pywrapfst_SymbolTable.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_SymbolTable.tp_dictoffset && __pyx_type_9pywrapfst_SymbolTable.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_SymbolTable.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_SymbolTable.tp_dict, __pyx_vtabptr_9pywrapfst_SymbolTable) < 0) __PYX_ERR(0, 954, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SymbolTable_2, (PyObject *)&__pyx_type_9pywrapfst_SymbolTable) < 0) __PYX_ERR(0, 954, __pyx_L1_error) + __pyx_ptype_9pywrapfst_SymbolTable = &__pyx_type_9pywrapfst_SymbolTable; + __pyx_vtabptr_9pywrapfst_SymbolTableIterator = &__pyx_vtable_9pywrapfst_SymbolTableIterator; + __pyx_vtable_9pywrapfst_SymbolTableIterator.done = (bool (*)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_19SymbolTableIterator_done; + __pyx_vtable_9pywrapfst_SymbolTableIterator.next = (void (*)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_19SymbolTableIterator_next; + __pyx_vtable_9pywrapfst_SymbolTableIterator.reset = (void (*)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_19SymbolTableIterator_reset; + __pyx_vtable_9pywrapfst_SymbolTableIterator.symbol = (std::string (*)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_19SymbolTableIterator_symbol; + __pyx_vtable_9pywrapfst_SymbolTableIterator.value = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst_SymbolTableIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_19SymbolTableIterator_value; + if (PyType_Ready(&__pyx_type_9pywrapfst_SymbolTableIterator) < 0) __PYX_ERR(0, 1149, __pyx_L1_error) + __pyx_type_9pywrapfst_SymbolTableIterator.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_SymbolTableIterator.tp_dictoffset && __pyx_type_9pywrapfst_SymbolTableIterator.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_SymbolTableIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_SymbolTableIterator.tp_dict, __pyx_vtabptr_9pywrapfst_SymbolTableIterator) < 0) __PYX_ERR(0, 1149, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SymbolTableIterator, (PyObject *)&__pyx_type_9pywrapfst_SymbolTableIterator) < 0) __PYX_ERR(0, 1149, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_SymbolTableIterator) < 0) __PYX_ERR(0, 1149, __pyx_L1_error) + __pyx_ptype_9pywrapfst_SymbolTableIterator = &__pyx_type_9pywrapfst_SymbolTableIterator; + __pyx_vtabptr_9pywrapfst_EncodeMapper = &__pyx_vtable_9pywrapfst_EncodeMapper; + __pyx_vtable_9pywrapfst_EncodeMapper.arc_type = (std::string (*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_arc_type; + __pyx_vtable_9pywrapfst_EncodeMapper.flags = (__pyx_t_10basictypes_uint32 (*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_flags; + __pyx_vtable_9pywrapfst_EncodeMapper.input_symbols = (struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *(*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_input_symbols; + __pyx_vtable_9pywrapfst_EncodeMapper.output_symbols = (struct __pyx_obj_9pywrapfst__EncodeMapperSymbolTable *(*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_output_symbols; + __pyx_vtable_9pywrapfst_EncodeMapper.properties = (__pyx_t_10basictypes_uint64 (*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, __pyx_t_10basictypes_uint64, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_properties; + __pyx_vtable_9pywrapfst_EncodeMapper.set_input_symbols = (void (*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_set_input_symbols; + __pyx_vtable_9pywrapfst_EncodeMapper.set_output_symbols = (void (*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, struct __pyx_obj_9pywrapfst__SymbolTable *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_set_output_symbols; + __pyx_vtable_9pywrapfst_EncodeMapper.weight_type = (std::string (*)(struct __pyx_obj_9pywrapfst_EncodeMapper *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_12EncodeMapper_weight_type; + if (PyType_Ready(&__pyx_type_9pywrapfst_EncodeMapper) < 0) __PYX_ERR(0, 1231, __pyx_L1_error) + __pyx_type_9pywrapfst_EncodeMapper.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_EncodeMapper.tp_dictoffset && __pyx_type_9pywrapfst_EncodeMapper.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_EncodeMapper.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_9pywrapfst_EncodeMapper, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1231, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9pywrapfst_12EncodeMapper_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9pywrapfst_12EncodeMapper_6__call__.doc = __pyx_doc_9pywrapfst_12EncodeMapper_6__call__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9pywrapfst_12EncodeMapper_6__call__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_EncodeMapper.tp_dict, __pyx_vtabptr_9pywrapfst_EncodeMapper) < 0) __PYX_ERR(0, 1231, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_EncodeMapper, (PyObject *)&__pyx_type_9pywrapfst_EncodeMapper) < 0) __PYX_ERR(0, 1231, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_EncodeMapper) < 0) __PYX_ERR(0, 1231, __pyx_L1_error) + __pyx_ptype_9pywrapfst_EncodeMapper = &__pyx_type_9pywrapfst_EncodeMapper; + __pyx_vtabptr_9pywrapfst__Fst = &__pyx_vtable_9pywrapfst__Fst; + __pyx_vtable_9pywrapfst__Fst._local_render_svg = (std::string (*)(std::string const &))__pyx_f_9pywrapfst_4_Fst__local_render_svg; + __pyx_vtable_9pywrapfst__Fst.arc_type = (std::string (*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_arc_type; + __pyx_vtable_9pywrapfst__Fst.arcs = (struct __pyx_obj_9pywrapfst_ArcIterator *(*)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_arcs; + __pyx_vtable_9pywrapfst__Fst.copy = (struct __pyx_obj_9pywrapfst__Fst *(*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_copy; + __pyx_vtable_9pywrapfst__Fst.draw = (void (*)(struct __pyx_obj_9pywrapfst__Fst *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_draw *__pyx_optional_args))__pyx_f_9pywrapfst_4_Fst_draw; + __pyx_vtable_9pywrapfst__Fst.final = (struct __pyx_obj_9pywrapfst_Weight *(*)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_final; + __pyx_vtable_9pywrapfst__Fst.fst_type = (std::string (*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_fst_type; + __pyx_vtable_9pywrapfst__Fst.input_symbols = (struct __pyx_obj_9pywrapfst__FstSymbolTable *(*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_input_symbols; + __pyx_vtable_9pywrapfst__Fst.num_arcs = (size_t (*)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_num_arcs; + __pyx_vtable_9pywrapfst__Fst.num_input_epsilons = (size_t (*)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_num_input_epsilons; + __pyx_vtable_9pywrapfst__Fst.num_output_epsilons = (size_t (*)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_num_output_epsilons; + __pyx_vtable_9pywrapfst__Fst.output_symbols = (struct __pyx_obj_9pywrapfst__FstSymbolTable *(*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_output_symbols; + __pyx_vtable_9pywrapfst__Fst.properties = (__pyx_t_10basictypes_uint64 (*)(struct __pyx_obj_9pywrapfst__Fst *, __pyx_t_10basictypes_uint64, bool, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_properties; + __pyx_vtable_9pywrapfst__Fst.start = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_start; + __pyx_vtable_9pywrapfst__Fst.states = (struct __pyx_obj_9pywrapfst_StateIterator *(*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_states; + __pyx_vtable_9pywrapfst__Fst.text = (std::string (*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_9pywrapfst_4_Fst_text *__pyx_optional_args))__pyx_f_9pywrapfst_4_Fst_text; + __pyx_vtable_9pywrapfst__Fst.verify = (bool (*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_verify; + __pyx_vtable_9pywrapfst__Fst.weight_type = (std::string (*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_weight_type; + __pyx_vtable_9pywrapfst__Fst.write = (void (*)(struct __pyx_obj_9pywrapfst__Fst *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_write; + __pyx_vtable_9pywrapfst__Fst.write_to_string = (PyObject *(*)(struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_4_Fst_write_to_string; + if (PyType_Ready(&__pyx_type_9pywrapfst__Fst) < 0) __PYX_ERR(0, 1387, __pyx_L1_error) + __pyx_type_9pywrapfst__Fst.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst__Fst.tp_dictoffset && __pyx_type_9pywrapfst__Fst.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst__Fst.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst__Fst.tp_dict, __pyx_vtabptr_9pywrapfst__Fst) < 0) __PYX_ERR(0, 1387, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Fst, (PyObject *)&__pyx_type_9pywrapfst__Fst) < 0) __PYX_ERR(0, 1387, __pyx_L1_error) + __pyx_ptype_9pywrapfst__Fst = &__pyx_type_9pywrapfst__Fst; + __pyx_vtabptr_9pywrapfst__MutableFst = &__pyx_vtable_9pywrapfst__MutableFst; + __pyx_vtable_9pywrapfst__MutableFst.__pyx_base = *__pyx_vtabptr_9pywrapfst__Fst; + __pyx_vtable_9pywrapfst__MutableFst._check_mutating_imethod = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *))__pyx_f_9pywrapfst_11_MutableFst__check_mutating_imethod; + __pyx_vtable_9pywrapfst__MutableFst._add_arc = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, struct __pyx_obj_9pywrapfst_Arc *))__pyx_f_9pywrapfst_11_MutableFst__add_arc; + __pyx_vtable_9pywrapfst__MutableFst.add_state = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst__MutableFst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11_MutableFst_add_state; + __pyx_vtable_9pywrapfst__MutableFst._arcsort = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__arcsort *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__arcsort; + __pyx_vtable_9pywrapfst__MutableFst._closure = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__closure *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__closure; + __pyx_vtable_9pywrapfst__MutableFst._concat = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__Fst *))__pyx_f_9pywrapfst_11_MutableFst__concat; + __pyx_vtable_9pywrapfst__MutableFst._connect = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *))__pyx_f_9pywrapfst_11_MutableFst__connect; + __pyx_vtable_9pywrapfst__MutableFst._decode = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst_EncodeMapper *))__pyx_f_9pywrapfst_11_MutableFst__decode; + __pyx_vtable_9pywrapfst__MutableFst._delete_arcs = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_arcs *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__delete_arcs; + __pyx_vtable_9pywrapfst__MutableFst._delete_states = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__delete_states *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__delete_states; + __pyx_vtable_9pywrapfst__MutableFst._encode = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst_EncodeMapper *))__pyx_f_9pywrapfst_11_MutableFst__encode; + __pyx_vtable_9pywrapfst__MutableFst._invert = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *))__pyx_f_9pywrapfst_11_MutableFst__invert; + __pyx_vtable_9pywrapfst__MutableFst._minimize = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__minimize *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__minimize; + __pyx_vtable_9pywrapfst__MutableFst.mutable_arcs = (struct __pyx_obj_9pywrapfst_MutableArcIterator *(*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11_MutableFst_mutable_arcs; + __pyx_vtable_9pywrapfst__MutableFst.num_states = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst__MutableFst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11_MutableFst_num_states; + __pyx_vtable_9pywrapfst__MutableFst._project = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__project *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__project; + __pyx_vtable_9pywrapfst__MutableFst._prune = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__prune *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__prune; + __pyx_vtable_9pywrapfst__MutableFst._push = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__push *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__push; + __pyx_vtable_9pywrapfst__MutableFst._relabel_pairs = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_pairs *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__relabel_pairs; + __pyx_vtable_9pywrapfst__MutableFst._relabel_tables = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__relabel_tables *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__relabel_tables; + __pyx_vtable_9pywrapfst__MutableFst._reserve_arcs = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, size_t))__pyx_f_9pywrapfst_11_MutableFst__reserve_arcs; + __pyx_vtable_9pywrapfst__MutableFst._reserve_states = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64))__pyx_f_9pywrapfst_11_MutableFst__reserve_states; + __pyx_vtable_9pywrapfst__MutableFst._reweight = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, PyObject *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__reweight *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__reweight; + __pyx_vtable_9pywrapfst__MutableFst._rmepsilon = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_opt_args_9pywrapfst_11_MutableFst__rmepsilon *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__rmepsilon; + __pyx_vtable_9pywrapfst__MutableFst._set_final = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64, struct __pyx_opt_args_9pywrapfst_11_MutableFst__set_final *__pyx_optional_args))__pyx_f_9pywrapfst_11_MutableFst__set_final; + __pyx_vtable_9pywrapfst__MutableFst._set_properties = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_uint64, __pyx_t_10basictypes_uint64))__pyx_f_9pywrapfst_11_MutableFst__set_properties; + __pyx_vtable_9pywrapfst__MutableFst._set_start = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, __pyx_t_10basictypes_int64))__pyx_f_9pywrapfst_11_MutableFst__set_start; + __pyx_vtable_9pywrapfst__MutableFst._set_input_symbols = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__SymbolTable *))__pyx_f_9pywrapfst_11_MutableFst__set_input_symbols; + __pyx_vtable_9pywrapfst__MutableFst._set_output_symbols = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__SymbolTable *))__pyx_f_9pywrapfst_11_MutableFst__set_output_symbols; + __pyx_vtable_9pywrapfst__MutableFst._topsort = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *))__pyx_f_9pywrapfst_11_MutableFst__topsort; + __pyx_vtable_9pywrapfst__MutableFst._union = (void (*)(struct __pyx_obj_9pywrapfst__MutableFst *, struct __pyx_obj_9pywrapfst__Fst *))__pyx_f_9pywrapfst_11_MutableFst__union; + __pyx_type_9pywrapfst__MutableFst.tp_base = __pyx_ptype_9pywrapfst__Fst; + if (PyType_Ready(&__pyx_type_9pywrapfst__MutableFst) < 0) __PYX_ERR(0, 1802, __pyx_L1_error) + __pyx_type_9pywrapfst__MutableFst.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst__MutableFst.tp_dictoffset && __pyx_type_9pywrapfst__MutableFst.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst__MutableFst.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst__MutableFst.tp_dict, __pyx_vtabptr_9pywrapfst__MutableFst) < 0) __PYX_ERR(0, 1802, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MutableFst, (PyObject *)&__pyx_type_9pywrapfst__MutableFst) < 0) __PYX_ERR(0, 1802, __pyx_L1_error) + __pyx_ptype_9pywrapfst__MutableFst = &__pyx_type_9pywrapfst__MutableFst; + __pyx_vtabptr_9pywrapfst_Arc = &__pyx_vtable_9pywrapfst_Arc; + __pyx_vtable_9pywrapfst_Arc.copy = (struct __pyx_obj_9pywrapfst_Arc *(*)(struct __pyx_obj_9pywrapfst_Arc *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_3Arc_copy; + if (PyType_Ready(&__pyx_type_9pywrapfst_Arc) < 0) __PYX_ERR(0, 2920, __pyx_L1_error) + __pyx_type_9pywrapfst_Arc.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_Arc.tp_dictoffset && __pyx_type_9pywrapfst_Arc.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_Arc.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_Arc.tp_dict, __pyx_vtabptr_9pywrapfst_Arc) < 0) __PYX_ERR(0, 2920, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Arc, (PyObject *)&__pyx_type_9pywrapfst_Arc) < 0) __PYX_ERR(0, 2920, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_Arc) < 0) __PYX_ERR(0, 2920, __pyx_L1_error) + __pyx_ptype_9pywrapfst_Arc = &__pyx_type_9pywrapfst_Arc; + __pyx_vtabptr_9pywrapfst_ArcIterator = &__pyx_vtable_9pywrapfst_ArcIterator; + __pyx_vtable_9pywrapfst_ArcIterator.done = (bool (*)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_done; + __pyx_vtable_9pywrapfst_ArcIterator.flags = (__pyx_t_10basictypes_uint32 (*)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_flags; + __pyx_vtable_9pywrapfst_ArcIterator.next = (void (*)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_next; + __pyx_vtable_9pywrapfst_ArcIterator.position = (size_t (*)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_position; + __pyx_vtable_9pywrapfst_ArcIterator.reset = (void (*)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_reset; + __pyx_vtable_9pywrapfst_ArcIterator.seek = (void (*)(struct __pyx_obj_9pywrapfst_ArcIterator *, size_t, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_seek; + __pyx_vtable_9pywrapfst_ArcIterator.set_flags = (void (*)(struct __pyx_obj_9pywrapfst_ArcIterator *, __pyx_t_10basictypes_uint32, __pyx_t_10basictypes_uint32, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_set_flags; + __pyx_vtable_9pywrapfst_ArcIterator.value = (PyObject *(*)(struct __pyx_obj_9pywrapfst_ArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_11ArcIterator_value; + if (PyType_Ready(&__pyx_type_9pywrapfst_ArcIterator) < 0) __PYX_ERR(0, 2987, __pyx_L1_error) + __pyx_type_9pywrapfst_ArcIterator.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_ArcIterator.tp_dictoffset && __pyx_type_9pywrapfst_ArcIterator.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_ArcIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_ArcIterator.tp_dict, __pyx_vtabptr_9pywrapfst_ArcIterator) < 0) __PYX_ERR(0, 2987, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ArcIterator, (PyObject *)&__pyx_type_9pywrapfst_ArcIterator) < 0) __PYX_ERR(0, 2987, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_ArcIterator) < 0) __PYX_ERR(0, 2987, __pyx_L1_error) + __pyx_ptype_9pywrapfst_ArcIterator = &__pyx_type_9pywrapfst_ArcIterator; + __pyx_vtabptr_9pywrapfst_MutableArcIterator = &__pyx_vtable_9pywrapfst_MutableArcIterator; + __pyx_vtable_9pywrapfst_MutableArcIterator.done = (bool (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_done; + __pyx_vtable_9pywrapfst_MutableArcIterator.flags = (__pyx_t_10basictypes_uint32 (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_flags; + __pyx_vtable_9pywrapfst_MutableArcIterator.next = (void (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_next; + __pyx_vtable_9pywrapfst_MutableArcIterator.position = (size_t (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_position; + __pyx_vtable_9pywrapfst_MutableArcIterator.reset = (void (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_reset; + __pyx_vtable_9pywrapfst_MutableArcIterator.seek = (void (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, size_t, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_seek; + __pyx_vtable_9pywrapfst_MutableArcIterator.set_flags = (void (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, __pyx_t_10basictypes_uint32, __pyx_t_10basictypes_uint32, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_set_flags; + __pyx_vtable_9pywrapfst_MutableArcIterator.set_value = (void (*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, struct __pyx_obj_9pywrapfst_Arc *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_set_value; + __pyx_vtable_9pywrapfst_MutableArcIterator.value = (PyObject *(*)(struct __pyx_obj_9pywrapfst_MutableArcIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_18MutableArcIterator_value; + if (PyType_Ready(&__pyx_type_9pywrapfst_MutableArcIterator) < 0) __PYX_ERR(0, 3098, __pyx_L1_error) + __pyx_type_9pywrapfst_MutableArcIterator.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_MutableArcIterator.tp_dictoffset && __pyx_type_9pywrapfst_MutableArcIterator.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_MutableArcIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_MutableArcIterator.tp_dict, __pyx_vtabptr_9pywrapfst_MutableArcIterator) < 0) __PYX_ERR(0, 3098, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MutableArcIterator, (PyObject *)&__pyx_type_9pywrapfst_MutableArcIterator) < 0) __PYX_ERR(0, 3098, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_MutableArcIterator) < 0) __PYX_ERR(0, 3098, __pyx_L1_error) + __pyx_ptype_9pywrapfst_MutableArcIterator = &__pyx_type_9pywrapfst_MutableArcIterator; + __pyx_vtabptr_9pywrapfst_StateIterator = &__pyx_vtable_9pywrapfst_StateIterator; + __pyx_vtable_9pywrapfst_StateIterator.done = (bool (*)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_13StateIterator_done; + __pyx_vtable_9pywrapfst_StateIterator.next = (void (*)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_13StateIterator_next; + __pyx_vtable_9pywrapfst_StateIterator.reset = (void (*)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_13StateIterator_reset; + __pyx_vtable_9pywrapfst_StateIterator.value = (__pyx_t_10basictypes_int64 (*)(struct __pyx_obj_9pywrapfst_StateIterator *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_13StateIterator_value; + if (PyType_Ready(&__pyx_type_9pywrapfst_StateIterator) < 0) __PYX_ERR(0, 3218, __pyx_L1_error) + __pyx_type_9pywrapfst_StateIterator.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_StateIterator.tp_dictoffset && __pyx_type_9pywrapfst_StateIterator.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_StateIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_StateIterator.tp_dict, __pyx_vtabptr_9pywrapfst_StateIterator) < 0) __PYX_ERR(0, 3218, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_StateIterator, (PyObject *)&__pyx_type_9pywrapfst_StateIterator) < 0) __PYX_ERR(0, 3218, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_StateIterator) < 0) __PYX_ERR(0, 3218, __pyx_L1_error) + __pyx_ptype_9pywrapfst_StateIterator = &__pyx_type_9pywrapfst_StateIterator; + __pyx_vtabptr_9pywrapfst_Compiler = &__pyx_vtable_9pywrapfst_Compiler; + __pyx_vtable_9pywrapfst_Compiler.compile = (struct __pyx_obj_9pywrapfst__Fst *(*)(struct __pyx_obj_9pywrapfst_Compiler *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_8Compiler_compile; + __pyx_vtable_9pywrapfst_Compiler.write = (void (*)(struct __pyx_obj_9pywrapfst_Compiler *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_8Compiler_write; + if (PyType_Ready(&__pyx_type_9pywrapfst_Compiler) < 0) __PYX_ERR(0, 4119, __pyx_L1_error) + __pyx_type_9pywrapfst_Compiler.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_Compiler.tp_dictoffset && __pyx_type_9pywrapfst_Compiler.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_Compiler.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_Compiler.tp_dict, __pyx_vtabptr_9pywrapfst_Compiler) < 0) __PYX_ERR(0, 4119, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Compiler, (PyObject *)&__pyx_type_9pywrapfst_Compiler) < 0) __PYX_ERR(0, 4119, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_Compiler) < 0) __PYX_ERR(0, 4119, __pyx_L1_error) + __pyx_ptype_9pywrapfst_Compiler = &__pyx_type_9pywrapfst_Compiler; + __pyx_vtabptr_9pywrapfst_FarReader = &__pyx_vtable_9pywrapfst_FarReader; + __pyx_vtable_9pywrapfst_FarReader.arc_type = (std::string (*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_arc_type; + __pyx_vtable_9pywrapfst_FarReader.done = (bool (*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_done; + __pyx_vtable_9pywrapfst_FarReader.error = (bool (*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_error; + __pyx_vtable_9pywrapfst_FarReader.far_type = (std::string (*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_far_type; + __pyx_vtable_9pywrapfst_FarReader.find = (bool (*)(struct __pyx_obj_9pywrapfst_FarReader *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_find; + __pyx_vtable_9pywrapfst_FarReader.get_fst = (struct __pyx_obj_9pywrapfst__Fst *(*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_get_fst; + __pyx_vtable_9pywrapfst_FarReader.get_key = (std::string (*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_get_key; + __pyx_vtable_9pywrapfst_FarReader.next = (void (*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_next; + __pyx_vtable_9pywrapfst_FarReader.reset = (void (*)(struct __pyx_obj_9pywrapfst_FarReader *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarReader_reset; + if (PyType_Ready(&__pyx_type_9pywrapfst_FarReader) < 0) __PYX_ERR(0, 4249, __pyx_L1_error) + __pyx_type_9pywrapfst_FarReader.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_FarReader.tp_dictoffset && __pyx_type_9pywrapfst_FarReader.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_FarReader.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_FarReader.tp_dict, __pyx_vtabptr_9pywrapfst_FarReader) < 0) __PYX_ERR(0, 4249, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FarReader, (PyObject *)&__pyx_type_9pywrapfst_FarReader) < 0) __PYX_ERR(0, 4249, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_FarReader) < 0) __PYX_ERR(0, 4249, __pyx_L1_error) + __pyx_ptype_9pywrapfst_FarReader = &__pyx_type_9pywrapfst_FarReader; + __pyx_vtabptr_9pywrapfst_FarWriter = &__pyx_vtable_9pywrapfst_FarWriter; + __pyx_vtable_9pywrapfst_FarWriter.arc_type = (std::string (*)(struct __pyx_obj_9pywrapfst_FarWriter *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarWriter_arc_type; + __pyx_vtable_9pywrapfst_FarWriter.close = (void (*)(struct __pyx_obj_9pywrapfst_FarWriter *))__pyx_f_9pywrapfst_9FarWriter_close; + __pyx_vtable_9pywrapfst_FarWriter.add = (void (*)(struct __pyx_obj_9pywrapfst_FarWriter *, PyObject *, struct __pyx_obj_9pywrapfst__Fst *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarWriter_add; + __pyx_vtable_9pywrapfst_FarWriter.error = (bool (*)(struct __pyx_obj_9pywrapfst_FarWriter *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarWriter_error; + __pyx_vtable_9pywrapfst_FarWriter.far_type = (std::string (*)(struct __pyx_obj_9pywrapfst_FarWriter *, int __pyx_skip_dispatch))__pyx_f_9pywrapfst_9FarWriter_far_type; + if (PyType_Ready(&__pyx_type_9pywrapfst_FarWriter) < 0) __PYX_ERR(0, 4396, __pyx_L1_error) + __pyx_type_9pywrapfst_FarWriter.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst_FarWriter.tp_dictoffset && __pyx_type_9pywrapfst_FarWriter.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst_FarWriter.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_9pywrapfst_FarWriter.tp_dict, __pyx_vtabptr_9pywrapfst_FarWriter) < 0) __PYX_ERR(0, 4396, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FarWriter, (PyObject *)&__pyx_type_9pywrapfst_FarWriter) < 0) __PYX_ERR(0, 4396, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9pywrapfst_FarWriter) < 0) __PYX_ERR(0, 4396, __pyx_L1_error) + __pyx_ptype_9pywrapfst_FarWriter = &__pyx_type_9pywrapfst_FarWriter; + if (PyType_Ready(&__pyx_type_9pywrapfst___pyx_scope_struct____iter__) < 0) __PYX_ERR(0, 3118, __pyx_L1_error) + __pyx_type_9pywrapfst___pyx_scope_struct____iter__.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9pywrapfst___pyx_scope_struct____iter__.tp_dictoffset && __pyx_type_9pywrapfst___pyx_scope_struct____iter__.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_9pywrapfst___pyx_scope_struct____iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_9pywrapfst___pyx_scope_struct____iter__ = &__pyx_type_9pywrapfst___pyx_scope_struct____iter__; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION < 3 +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC void +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#else +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initpywrapfst(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initpywrapfst(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_pywrapfst(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_pywrapfst(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_pywrapfst(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'pywrapfst' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pywrapfst(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("pywrapfst", __pyx_methods, __pyx_k_Python_interface_to_the_FST_scri, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_pywrapfst) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "pywrapfst")) { + if (unlikely(PyDict_SetItemString(modules, "pywrapfst", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error; + if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "pywrapfst.pyx":98 + * + * # Python imports. + * import numbers # <<<<<<<<<<<<<< + * import subprocess + * + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numbers, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_numbers, __pyx_t_1) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":99 + * # Python imports. + * import numbers + * import subprocess # <<<<<<<<<<<<<< + * + * import logging + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_subprocess, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_subprocess, __pyx_t_1) < 0) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":101 + * import subprocess + * + * import logging # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":107 + * + * + * class FstError(Exception): # <<<<<<<<<<<<<< + * + * pass + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_FstError, __pyx_n_s_FstError, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_FstError, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstError, __pyx_t_4) < 0) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":112 + * + * + * class FstArgError(FstError, ValueError): # <<<<<<<<<<<<<< + * + * pass + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FstError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_INCREF(__pyx_builtin_ValueError); + __Pyx_GIVEREF(__pyx_builtin_ValueError); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_ValueError); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_FstArgError, __pyx_n_s_FstArgError, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FstArgError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstArgError, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":117 + * + * + * class FstBadWeightError(FstError, ValueError): # <<<<<<<<<<<<<< + * + * pass + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_builtin_ValueError); + __Pyx_GIVEREF(__pyx_builtin_ValueError); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_ValueError); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_FstBadWeightError, __pyx_n_s_FstBadWeightError, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_FstBadWeightError, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstBadWeightError, __pyx_t_4) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":122 + * + * + * class FstDeletedConstructorError(FstError, RuntimeError): # <<<<<<<<<<<<<< + * + * pass + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FstError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_INCREF(__pyx_builtin_RuntimeError); + __Pyx_GIVEREF(__pyx_builtin_RuntimeError); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_RuntimeError); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_FstDeletedConstructorError, __pyx_n_s_FstDeletedConstructorError, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FstDeletedConstructorError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstDeletedConstructorError, __pyx_t_4) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":127 + * + * + * class FstIndexError(FstError, IndexError): # <<<<<<<<<<<<<< + * + * pass + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_builtin_IndexError); + __Pyx_GIVEREF(__pyx_builtin_IndexError); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_IndexError); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_FstIndexError, __pyx_n_s_FstIndexError, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_FstIndexError, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstIndexError, __pyx_t_4) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":132 + * + * + * class FstIOError(FstError, IOError): # <<<<<<<<<<<<<< + * + * pass + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FstError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_INCREF(__pyx_builtin_IOError); + __Pyx_GIVEREF(__pyx_builtin_IOError); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_IOError); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_FstIOError, __pyx_n_s_FstIOError, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FstIOError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstIOError, __pyx_t_4) < 0) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":137 + * + * + * class FstOpError(FstError, RuntimeError): # <<<<<<<<<<<<<< + * + * pass + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_builtin_RuntimeError); + __Pyx_GIVEREF(__pyx_builtin_RuntimeError); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_RuntimeError); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_FstOpError, __pyx_n_s_FstOpError, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_FstOpError, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstOpError, __pyx_t_4) < 0) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":392 + * + * @classmethod + * def Zero(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.Zero(weight_type) + */ + __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_9pywrapfst_Weight, __pyx_n_s_Zero); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "pywrapfst.pyx":391 + * # C++ part out-of-class and then call it from within. + * + * @classmethod # <<<<<<<<<<<<<< + * def Zero(cls, weight_type): + * """ + */ + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_Weight->tp_dict, __pyx_n_s_Zero, __pyx_t_2) < 0) __PYX_ERR(0, 392, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_Weight); + + /* "pywrapfst.pyx":401 + * + * @classmethod + * def One(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.One(weight_type) + */ + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_9pywrapfst_Weight, __pyx_n_s_One); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":400 + * return _Zero(weight_type) + * + * @classmethod # <<<<<<<<<<<<<< + * def One(cls, weight_type): + * """ + */ + __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_Weight->tp_dict, __pyx_n_s_One, __pyx_t_1) < 0) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_Weight); + + /* "pywrapfst.pyx":410 + * + * @classmethod + * def NoWeight(cls, weight_type): # <<<<<<<<<<<<<< + * """ + * Weight.NoWeight(weight_type) + */ + __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_9pywrapfst_Weight, __pyx_n_s_NoWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "pywrapfst.pyx":409 + * return _One(weight_type) + * + * @classmethod # <<<<<<<<<<<<<< + * def NoWeight(cls, weight_type): + * """ + */ + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_Weight->tp_dict, __pyx_n_s_NoWeight, __pyx_t_2) < 0) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_Weight); + + /* "pywrapfst.pyx":445 + * + * + * def plus(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * plus(lhs, rhs) + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9pywrapfst_1plus, NULL, __pyx_n_s_pywrapfst_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_plus, __pyx_t_2) < 0) __PYX_ERR(0, 445, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":477 + * + * + * def times(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * times(lhs, rhs) + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9pywrapfst_3times, NULL, __pyx_n_s_pywrapfst_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_times, __pyx_t_2) < 0) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":509 + * + * + * def divide(Weight lhs, Weight rhs): # <<<<<<<<<<<<<< + * """ + * divide(lhs, rhs) + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9pywrapfst_5divide, NULL, __pyx_n_s_pywrapfst_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_divide, __pyx_t_2) < 0) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":542 + * + * + * def power(Weight w, size_t n): # <<<<<<<<<<<<<< + * """ + * power(lhs, rhs) + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9pywrapfst_7power, NULL, __pyx_n_s_pywrapfst_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_power, __pyx_t_2) < 0) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pywrapfst.pyx":902 + * """ + * + * cpdef int64 add_symbol(self, symbol, int64 key=fst.kNoSymbol): # <<<<<<<<<<<<<< + * """ + * add_symbol(self, symbol, key=NO_SYMBOL) + */ + __pyx_k__3 = fst::kNoSymbol; + __pyx_k__3 = fst::kNoSymbol; + + /* "pywrapfst.pyx":979 + * + * @classmethod + * def read(cls, filename): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read(filename) + */ + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_9pywrapfst_SymbolTable, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":978 + * self._smart_table.reset(self._table) + * + * @classmethod # <<<<<<<<<<<<<< + * def read(cls, filename): + * """ + */ + __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_SymbolTable->tp_dict, __pyx_n_s_read, __pyx_t_1) < 0) __PYX_ERR(0, 979, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_SymbolTable); + + /* "pywrapfst.pyx":1002 + * + * @classmethod + * def read_text(cls, filename, bool allow_negative_labels=False): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read_text(filename) + */ + __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_9pywrapfst_SymbolTable, __pyx_n_s_read_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "pywrapfst.pyx":1001 + * return _init_SymbolTable(syms.release()) + * + * @classmethod # <<<<<<<<<<<<<< + * def read_text(cls, filename, bool allow_negative_labels=False): + * """ + */ + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1001, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_SymbolTable->tp_dict, __pyx_n_s_read_text, __pyx_t_2) < 0) __PYX_ERR(0, 1002, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_SymbolTable); + + /* "pywrapfst.pyx":1029 + * + * @classmethod + * def read_fst(cls, filename, bool input_table): # <<<<<<<<<<<<<< + * """ + * SymbolTable.read_fst(filename, input_table) + */ + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_9pywrapfst_SymbolTable, __pyx_n_s_read_fst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":1028 + * return _init_SymbolTable(syms.release()) + * + * @classmethod # <<<<<<<<<<<<<< + * def read_fst(cls, filename, bool input_table): + * """ + */ + __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_SymbolTable->tp_dict, __pyx_n_s_read_fst, __pyx_t_1) < 0) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_SymbolTable); + + /* "pywrapfst.pyx":2090 + * return self + * + * cdef void _minimize(self, float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * bool allow_nondet=False) except *: + * # This runs in-place when the second argument is null. + */ + __pyx_k__11 = fst::kShortestDelta; + + /* "pywrapfst.pyx":2096 + * self._check_mutating_imethod() + * + * def minimize(self, float delta=fst.kShortestDelta, bool allow_nondet=False): # <<<<<<<<<<<<<< + * """ + * minimize(self, delta=1e-6, allow_nondet=False) + */ + __pyx_k__12 = fst::kShortestDelta; + + /* "pywrapfst.pyx":2196 + * return self + * + * cdef void _prune(self, float delta=fst.kDelta, int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * weight=None) except *: + * # Threshold is set to semiring Zero (no pruning) if no weight is specified. + */ + __pyx_k__13 = fst::kDelta; + __pyx_k__14 = fst::kNoStateId; + + /* "pywrapfst.pyx":2205 + * + * def prune(self, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * weight=None): + */ + __pyx_k__15 = fst::kDelta; + + /* "pywrapfst.pyx":2206 + * def prune(self, + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * weight=None): + * """ + */ + __pyx_k__16 = fst::kNoStateId; + + /* "pywrapfst.pyx":2233 + * + * cdef void _push(self, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * bool remove_total_weight=False, + * bool to_final=False) except *: + */ + __pyx_k__17 = fst::kDelta; + + /* "pywrapfst.pyx":2241 + * + * def push(self, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * bool remove_total_weight=False, + * bool to_final=False): + */ + __pyx_k__18 = fst::kDelta; + + /* "pywrapfst.pyx":2478 + * bool connect=True, + * weight=None, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta) except *: + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + */ + __pyx_k__19 = fst::kNoStateId; + + /* "pywrapfst.pyx":2479 + * weight=None, + * int64 nstate=fst.kNoStateId, + * float delta=fst.kShortestDelta) except *: # <<<<<<<<<<<<<< + * cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + * weight) + */ + __pyx_k__20 = fst::kShortestDelta; + + /* "pywrapfst.pyx":2492 + * bool connect=True, + * weight=None, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta): + * """ + */ + __pyx_k__21 = fst::kNoStateId; + + /* "pywrapfst.pyx":2493 + * weight=None, + * int64 nstate=fst.kNoStateId, + * float delta=fst.kShortestDelta): # <<<<<<<<<<<<<< + * """ + * rmepsilon(self, queue_type="auto", connect=True, weight=None, + */ + __pyx_k__22 = fst::kShortestDelta; + + /* "pywrapfst.pyx":2766 + * + * + * class Fst(object): # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__68); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__68, __pyx_n_s_Fst_2, __pyx_n_s_Fst_2, (PyObject *) NULL, __pyx_n_s_pywrapfst_2, __pyx_kp_s_Fst_arc_type_standard_Construct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":2783 + * """ + * + * def __new__(cls, arc_type=b"standard"): # <<<<<<<<<<<<<< + * return _create_Fst(arc_type) + * + */ + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9pywrapfst_3Fst_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Fst___new, NULL, __pyx_n_s_pywrapfst_2, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__71); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_new, __pyx_t_3) < 0) __PYX_ERR(0, 2783, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pywrapfst.pyx":2787 + * + * @staticmethod + * def read(filename): # <<<<<<<<<<<<<< + * """ + * read(filename): + */ + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9pywrapfst_3Fst_3read, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Fst_read, NULL, __pyx_n_s_pywrapfst_2, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2787, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "pywrapfst.pyx":2786 + * return _create_Fst(arc_type) + * + * @staticmethod # <<<<<<<<<<<<<< + * def read(filename): + * """ + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read, __pyx_t_4) < 0) __PYX_ERR(0, 2787, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pywrapfst.pyx":2805 + * + * @staticmethod + * def read_from_string(state): # <<<<<<<<<<<<<< + * """ + * read_from_string(string, fst_type=None) + */ + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9pywrapfst_3Fst_5read_from_string, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Fst_read_from_string, NULL, __pyx_n_s_pywrapfst_2, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "pywrapfst.pyx":2804 + * return _read(filename) + * + * @staticmethod # <<<<<<<<<<<<<< + * def read_from_string(state): + * """ + */ + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_from_string, __pyx_t_3) < 0) __PYX_ERR(0, 2805, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pywrapfst.pyx":2766 + * + * + * class Fst(object): # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Fst_2, __pyx_tuple__68, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Fst_2, __pyx_t_3) < 0) __PYX_ERR(0, 2766, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2829 + * + * + * NO_LABEL = fst.kNoLabel # <<<<<<<<<<<<<< + * NO_STATE_ID = fst.kNoStateId + * NO_SYMBOL = fst.kNoSymbol + */ + __pyx_t_1 = __Pyx_PyInt_From_int(fst::kNoLabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_LABEL, __pyx_t_1) < 0) __PYX_ERR(0, 2829, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2830 + * + * NO_LABEL = fst.kNoLabel + * NO_STATE_ID = fst.kNoStateId # <<<<<<<<<<<<<< + * NO_SYMBOL = fst.kNoSymbol + * + */ + __pyx_t_1 = __Pyx_PyInt_From_int(fst::kNoStateId); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_STATE_ID, __pyx_t_1) < 0) __PYX_ERR(0, 2830, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2831 + * NO_LABEL = fst.kNoLabel + * NO_STATE_ID = fst.kNoStateId + * NO_SYMBOL = fst.kNoSymbol # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyInt_From_int64_t(fst::kNoSymbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2831, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_SYMBOL, __pyx_t_1) < 0) __PYX_ERR(0, 2831, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2837 + * + * + * EXPANDED = fst.kExpanded # <<<<<<<<<<<<<< + * MUTABLE = fst.kMutable + * ERROR = fst.kError + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kExpanded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EXPANDED, __pyx_t_1) < 0) __PYX_ERR(0, 2837, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2838 + * + * EXPANDED = fst.kExpanded + * MUTABLE = fst.kMutable # <<<<<<<<<<<<<< + * ERROR = fst.kError + * ACCEPTOR = fst.kAcceptor + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kMutable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MUTABLE, __pyx_t_1) < 0) __PYX_ERR(0, 2838, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2839 + * EXPANDED = fst.kExpanded + * MUTABLE = fst.kMutable + * ERROR = fst.kError # <<<<<<<<<<<<<< + * ACCEPTOR = fst.kAcceptor + * NOT_ACCEPTOR = fst.kNotAcceptor + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ERROR, __pyx_t_1) < 0) __PYX_ERR(0, 2839, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2840 + * MUTABLE = fst.kMutable + * ERROR = fst.kError + * ACCEPTOR = fst.kAcceptor # <<<<<<<<<<<<<< + * NOT_ACCEPTOR = fst.kNotAcceptor + * I_DETERMINISTIC = fst.kIDeterministic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kAcceptor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ACCEPTOR, __pyx_t_1) < 0) __PYX_ERR(0, 2840, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2841 + * ERROR = fst.kError + * ACCEPTOR = fst.kAcceptor + * NOT_ACCEPTOR = fst.kNotAcceptor # <<<<<<<<<<<<<< + * I_DETERMINISTIC = fst.kIDeterministic + * NON_I_DETERMINISTIC = fst.kNonIDeterministic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNotAcceptor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_ACCEPTOR, __pyx_t_1) < 0) __PYX_ERR(0, 2841, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2842 + * ACCEPTOR = fst.kAcceptor + * NOT_ACCEPTOR = fst.kNotAcceptor + * I_DETERMINISTIC = fst.kIDeterministic # <<<<<<<<<<<<<< + * NON_I_DETERMINISTIC = fst.kNonIDeterministic + * O_DETERMINISTIC = fst.kODeterministic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kIDeterministic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_DETERMINISTIC, __pyx_t_1) < 0) __PYX_ERR(0, 2842, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2843 + * NOT_ACCEPTOR = fst.kNotAcceptor + * I_DETERMINISTIC = fst.kIDeterministic + * NON_I_DETERMINISTIC = fst.kNonIDeterministic # <<<<<<<<<<<<<< + * O_DETERMINISTIC = fst.kODeterministic + * NON_O_DETERMINISTIC = fst.kNonODeterministic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNonIDeterministic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NON_I_DETERMINISTIC, __pyx_t_1) < 0) __PYX_ERR(0, 2843, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2844 + * I_DETERMINISTIC = fst.kIDeterministic + * NON_I_DETERMINISTIC = fst.kNonIDeterministic + * O_DETERMINISTIC = fst.kODeterministic # <<<<<<<<<<<<<< + * NON_O_DETERMINISTIC = fst.kNonODeterministic + * EPSILONS = fst.kEpsilons + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kODeterministic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2844, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_DETERMINISTIC, __pyx_t_1) < 0) __PYX_ERR(0, 2844, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2845 + * NON_I_DETERMINISTIC = fst.kNonIDeterministic + * O_DETERMINISTIC = fst.kODeterministic + * NON_O_DETERMINISTIC = fst.kNonODeterministic # <<<<<<<<<<<<<< + * EPSILONS = fst.kEpsilons + * NO_EPSILONS = fst.kNoEpsilons + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNonODeterministic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NON_O_DETERMINISTIC, __pyx_t_1) < 0) __PYX_ERR(0, 2845, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2846 + * O_DETERMINISTIC = fst.kODeterministic + * NON_O_DETERMINISTIC = fst.kNonODeterministic + * EPSILONS = fst.kEpsilons # <<<<<<<<<<<<<< + * NO_EPSILONS = fst.kNoEpsilons + * I_EPSILONS = fst.kIEpsilons + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kEpsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2846, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2846, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2847 + * NON_O_DETERMINISTIC = fst.kNonODeterministic + * EPSILONS = fst.kEpsilons + * NO_EPSILONS = fst.kNoEpsilons # <<<<<<<<<<<<<< + * I_EPSILONS = fst.kIEpsilons + * NO_I_EPSILONS = fst.kNoIEpsilons + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNoEpsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2847, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2848 + * EPSILONS = fst.kEpsilons + * NO_EPSILONS = fst.kNoEpsilons + * I_EPSILONS = fst.kIEpsilons # <<<<<<<<<<<<<< + * NO_I_EPSILONS = fst.kNoIEpsilons + * O_EPSILONS = fst.kOEpsilons + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kIEpsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2848, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2849 + * NO_EPSILONS = fst.kNoEpsilons + * I_EPSILONS = fst.kIEpsilons + * NO_I_EPSILONS = fst.kNoIEpsilons # <<<<<<<<<<<<<< + * O_EPSILONS = fst.kOEpsilons + * NO_O_EPSILONS = fst.kNoOEpsilons + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNoIEpsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_I_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2849, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2850 + * I_EPSILONS = fst.kIEpsilons + * NO_I_EPSILONS = fst.kNoIEpsilons + * O_EPSILONS = fst.kOEpsilons # <<<<<<<<<<<<<< + * NO_O_EPSILONS = fst.kNoOEpsilons + * I_LABEL_SORTED = fst.kILabelSorted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kOEpsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2850, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2850, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2851 + * NO_I_EPSILONS = fst.kNoIEpsilons + * O_EPSILONS = fst.kOEpsilons + * NO_O_EPSILONS = fst.kNoOEpsilons # <<<<<<<<<<<<<< + * I_LABEL_SORTED = fst.kILabelSorted + * NOT_I_LABEL_SORTED = fst.kNotILabelSorted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNoOEpsilons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2851, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_O_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2851, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2852 + * O_EPSILONS = fst.kOEpsilons + * NO_O_EPSILONS = fst.kNoOEpsilons + * I_LABEL_SORTED = fst.kILabelSorted # <<<<<<<<<<<<<< + * NOT_I_LABEL_SORTED = fst.kNotILabelSorted + * O_LABEL_SORTED = fst.kOLabelSorted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kILabelSorted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_LABEL_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2852, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2853 + * NO_O_EPSILONS = fst.kNoOEpsilons + * I_LABEL_SORTED = fst.kILabelSorted + * NOT_I_LABEL_SORTED = fst.kNotILabelSorted # <<<<<<<<<<<<<< + * O_LABEL_SORTED = fst.kOLabelSorted + * NOT_O_LABEL_SORTED = fst.kNotOLabelSorted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNotILabelSorted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2853, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_I_LABEL_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2853, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2854 + * I_LABEL_SORTED = fst.kILabelSorted + * NOT_I_LABEL_SORTED = fst.kNotILabelSorted + * O_LABEL_SORTED = fst.kOLabelSorted # <<<<<<<<<<<<<< + * NOT_O_LABEL_SORTED = fst.kNotOLabelSorted + * WEIGHTED = fst.kWeighted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kOLabelSorted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2854, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_LABEL_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2854, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2855 + * NOT_I_LABEL_SORTED = fst.kNotILabelSorted + * O_LABEL_SORTED = fst.kOLabelSorted + * NOT_O_LABEL_SORTED = fst.kNotOLabelSorted # <<<<<<<<<<<<<< + * WEIGHTED = fst.kWeighted + * UNWEIGHTED = fst.kUnweighted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNotOLabelSorted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2855, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_O_LABEL_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2855, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2856 + * O_LABEL_SORTED = fst.kOLabelSorted + * NOT_O_LABEL_SORTED = fst.kNotOLabelSorted + * WEIGHTED = fst.kWeighted # <<<<<<<<<<<<<< + * UNWEIGHTED = fst.kUnweighted + * CYCLIC = fst.kCyclic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kWeighted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_WEIGHTED, __pyx_t_1) < 0) __PYX_ERR(0, 2856, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2857 + * NOT_O_LABEL_SORTED = fst.kNotOLabelSorted + * WEIGHTED = fst.kWeighted + * UNWEIGHTED = fst.kUnweighted # <<<<<<<<<<<<<< + * CYCLIC = fst.kCyclic + * ACYCLIC = fst.kAcyclic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kUnweighted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2857, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_UNWEIGHTED, __pyx_t_1) < 0) __PYX_ERR(0, 2857, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2858 + * WEIGHTED = fst.kWeighted + * UNWEIGHTED = fst.kUnweighted + * CYCLIC = fst.kCyclic # <<<<<<<<<<<<<< + * ACYCLIC = fst.kAcyclic + * INITIAL_CYCLIC = fst.kInitialCyclic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kCyclic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2858, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_CYCLIC, __pyx_t_1) < 0) __PYX_ERR(0, 2858, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2859 + * UNWEIGHTED = fst.kUnweighted + * CYCLIC = fst.kCyclic + * ACYCLIC = fst.kAcyclic # <<<<<<<<<<<<<< + * INITIAL_CYCLIC = fst.kInitialCyclic + * INITIAL_ACYCLIC = fst.kInitialAcyclic + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kAcyclic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ACYCLIC, __pyx_t_1) < 0) __PYX_ERR(0, 2859, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2860 + * CYCLIC = fst.kCyclic + * ACYCLIC = fst.kAcyclic + * INITIAL_CYCLIC = fst.kInitialCyclic # <<<<<<<<<<<<<< + * INITIAL_ACYCLIC = fst.kInitialAcyclic + * TOP_SORTED = fst.kTopSorted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kInitialCyclic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2860, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_INITIAL_CYCLIC, __pyx_t_1) < 0) __PYX_ERR(0, 2860, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2861 + * ACYCLIC = fst.kAcyclic + * INITIAL_CYCLIC = fst.kInitialCyclic + * INITIAL_ACYCLIC = fst.kInitialAcyclic # <<<<<<<<<<<<<< + * TOP_SORTED = fst.kTopSorted + * NOT_TOP_SORTED = fst.kNotTopSorted + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kInitialAcyclic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2861, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_INITIAL_ACYCLIC, __pyx_t_1) < 0) __PYX_ERR(0, 2861, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2862 + * INITIAL_CYCLIC = fst.kInitialCyclic + * INITIAL_ACYCLIC = fst.kInitialAcyclic + * TOP_SORTED = fst.kTopSorted # <<<<<<<<<<<<<< + * NOT_TOP_SORTED = fst.kNotTopSorted + * ACCESSIBLE = fst.kAccessible + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kTopSorted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TOP_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2862, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2863 + * INITIAL_ACYCLIC = fst.kInitialAcyclic + * TOP_SORTED = fst.kTopSorted + * NOT_TOP_SORTED = fst.kNotTopSorted # <<<<<<<<<<<<<< + * ACCESSIBLE = fst.kAccessible + * NOT_ACCESSIBLE = fst.kNotAccessible + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNotTopSorted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2863, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_TOP_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2863, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2864 + * TOP_SORTED = fst.kTopSorted + * NOT_TOP_SORTED = fst.kNotTopSorted + * ACCESSIBLE = fst.kAccessible # <<<<<<<<<<<<<< + * NOT_ACCESSIBLE = fst.kNotAccessible + * COACCESSIBLE = fst.kCoAccessible + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kAccessible); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2864, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ACCESSIBLE, __pyx_t_1) < 0) __PYX_ERR(0, 2864, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2865 + * NOT_TOP_SORTED = fst.kNotTopSorted + * ACCESSIBLE = fst.kAccessible + * NOT_ACCESSIBLE = fst.kNotAccessible # <<<<<<<<<<<<<< + * COACCESSIBLE = fst.kCoAccessible + * NOT_COACCESSIBLE = fst.kNotCoAccessible + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNotAccessible); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_ACCESSIBLE, __pyx_t_1) < 0) __PYX_ERR(0, 2865, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2866 + * ACCESSIBLE = fst.kAccessible + * NOT_ACCESSIBLE = fst.kNotAccessible + * COACCESSIBLE = fst.kCoAccessible # <<<<<<<<<<<<<< + * NOT_COACCESSIBLE = fst.kNotCoAccessible + * STRING = fst.kString + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kCoAccessible); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2866, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_COACCESSIBLE, __pyx_t_1) < 0) __PYX_ERR(0, 2866, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2867 + * NOT_ACCESSIBLE = fst.kNotAccessible + * COACCESSIBLE = fst.kCoAccessible + * NOT_COACCESSIBLE = fst.kNotCoAccessible # <<<<<<<<<<<<<< + * STRING = fst.kString + * NOT_STRING = fst.kNotString + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNotCoAccessible); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_COACCESSIBLE, __pyx_t_1) < 0) __PYX_ERR(0, 2867, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2868 + * COACCESSIBLE = fst.kCoAccessible + * NOT_COACCESSIBLE = fst.kNotCoAccessible + * STRING = fst.kString # <<<<<<<<<<<<<< + * NOT_STRING = fst.kNotString + * WEIGHTED_CYCLES = fst.kWeightedCycles + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kString); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_STRING, __pyx_t_1) < 0) __PYX_ERR(0, 2868, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2869 + * NOT_COACCESSIBLE = fst.kNotCoAccessible + * STRING = fst.kString + * NOT_STRING = fst.kNotString # <<<<<<<<<<<<<< + * WEIGHTED_CYCLES = fst.kWeightedCycles + * UNWEIGHTED_CYCLES = fst.kUnweightedCycles + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNotString); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2869, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_STRING, __pyx_t_1) < 0) __PYX_ERR(0, 2869, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2870 + * STRING = fst.kString + * NOT_STRING = fst.kNotString + * WEIGHTED_CYCLES = fst.kWeightedCycles # <<<<<<<<<<<<<< + * UNWEIGHTED_CYCLES = fst.kUnweightedCycles + * NULL_PROPERTIES = fst.kNullProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kWeightedCycles); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2870, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_WEIGHTED_CYCLES, __pyx_t_1) < 0) __PYX_ERR(0, 2870, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2871 + * NOT_STRING = fst.kNotString + * WEIGHTED_CYCLES = fst.kWeightedCycles + * UNWEIGHTED_CYCLES = fst.kUnweightedCycles # <<<<<<<<<<<<<< + * NULL_PROPERTIES = fst.kNullProperties + * COPY_PROPERTIES = fst.kCopyProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kUnweightedCycles); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_UNWEIGHTED_CYCLES, __pyx_t_1) < 0) __PYX_ERR(0, 2871, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2872 + * WEIGHTED_CYCLES = fst.kWeightedCycles + * UNWEIGHTED_CYCLES = fst.kUnweightedCycles + * NULL_PROPERTIES = fst.kNullProperties # <<<<<<<<<<<<<< + * COPY_PROPERTIES = fst.kCopyProperties + * INTRINSIC_PROPERTIES = fst.kIntrinsicProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNullProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2872, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NULL_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2872, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2873 + * UNWEIGHTED_CYCLES = fst.kUnweightedCycles + * NULL_PROPERTIES = fst.kNullProperties + * COPY_PROPERTIES = fst.kCopyProperties # <<<<<<<<<<<<<< + * INTRINSIC_PROPERTIES = fst.kIntrinsicProperties + * EXTRINSIC_PROPERTIES = fst.kExtrinsicProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kCopyProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2873, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_COPY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2873, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2874 + * NULL_PROPERTIES = fst.kNullProperties + * COPY_PROPERTIES = fst.kCopyProperties + * INTRINSIC_PROPERTIES = fst.kIntrinsicProperties # <<<<<<<<<<<<<< + * EXTRINSIC_PROPERTIES = fst.kExtrinsicProperties + * SET_START_PROPERTIES = fst.kSetStartProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kIntrinsicProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2874, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_INTRINSIC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2874, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2875 + * COPY_PROPERTIES = fst.kCopyProperties + * INTRINSIC_PROPERTIES = fst.kIntrinsicProperties + * EXTRINSIC_PROPERTIES = fst.kExtrinsicProperties # <<<<<<<<<<<<<< + * SET_START_PROPERTIES = fst.kSetStartProperties + * SET_FINAL_PROPERTIES = fst.kSetFinalProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kExtrinsicProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EXTRINSIC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2875, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2876 + * INTRINSIC_PROPERTIES = fst.kIntrinsicProperties + * EXTRINSIC_PROPERTIES = fst.kExtrinsicProperties + * SET_START_PROPERTIES = fst.kSetStartProperties # <<<<<<<<<<<<<< + * SET_FINAL_PROPERTIES = fst.kSetFinalProperties + * ADD_STATE_PROPERTIES = fst.kAddStateProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kSetStartProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SET_START_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2876, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2877 + * EXTRINSIC_PROPERTIES = fst.kExtrinsicProperties + * SET_START_PROPERTIES = fst.kSetStartProperties + * SET_FINAL_PROPERTIES = fst.kSetFinalProperties # <<<<<<<<<<<<<< + * ADD_STATE_PROPERTIES = fst.kAddStateProperties + * ADD_ARC_PROPERTIES = fst.kAddArcProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kSetFinalProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SET_FINAL_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2877, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2878 + * SET_START_PROPERTIES = fst.kSetStartProperties + * SET_FINAL_PROPERTIES = fst.kSetFinalProperties + * ADD_STATE_PROPERTIES = fst.kAddStateProperties # <<<<<<<<<<<<<< + * ADD_ARC_PROPERTIES = fst.kAddArcProperties + * SET_ARC_PROPERTIES = fst.kSetArcProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kAddStateProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2878, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADD_STATE_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2878, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2879 + * SET_FINAL_PROPERTIES = fst.kSetFinalProperties + * ADD_STATE_PROPERTIES = fst.kAddStateProperties + * ADD_ARC_PROPERTIES = fst.kAddArcProperties # <<<<<<<<<<<<<< + * SET_ARC_PROPERTIES = fst.kSetArcProperties + * DELETE_STATE_PROPERTIES = fst.kDeleteStatesProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kAddArcProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADD_ARC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2879, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2880 + * ADD_STATE_PROPERTIES = fst.kAddStateProperties + * ADD_ARC_PROPERTIES = fst.kAddArcProperties + * SET_ARC_PROPERTIES = fst.kSetArcProperties # <<<<<<<<<<<<<< + * DELETE_STATE_PROPERTIES = fst.kDeleteStatesProperties + * DELETE_ARC_PROPERTIES = fst.kDeleteArcsProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kSetArcProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SET_ARC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2880, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2881 + * ADD_ARC_PROPERTIES = fst.kAddArcProperties + * SET_ARC_PROPERTIES = fst.kSetArcProperties + * DELETE_STATE_PROPERTIES = fst.kDeleteStatesProperties # <<<<<<<<<<<<<< + * DELETE_ARC_PROPERTIES = fst.kDeleteArcsProperties + * STATE_SORT_PROPERTIES = fst.kStateSortProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kDeleteStatesProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DELETE_STATE_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2881, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2882 + * SET_ARC_PROPERTIES = fst.kSetArcProperties + * DELETE_STATE_PROPERTIES = fst.kDeleteStatesProperties + * DELETE_ARC_PROPERTIES = fst.kDeleteArcsProperties # <<<<<<<<<<<<<< + * STATE_SORT_PROPERTIES = fst.kStateSortProperties + * ARC_SORT_PROPERTIES = fst.kArcSortProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kDeleteArcsProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DELETE_ARC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2882, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2883 + * DELETE_STATE_PROPERTIES = fst.kDeleteStatesProperties + * DELETE_ARC_PROPERTIES = fst.kDeleteArcsProperties + * STATE_SORT_PROPERTIES = fst.kStateSortProperties # <<<<<<<<<<<<<< + * ARC_SORT_PROPERTIES = fst.kArcSortProperties + * I_LABEL_INVARIANT_PROPERTIES = fst.kILabelInvariantProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kStateSortProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2883, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATE_SORT_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2883, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2884 + * DELETE_ARC_PROPERTIES = fst.kDeleteArcsProperties + * STATE_SORT_PROPERTIES = fst.kStateSortProperties + * ARC_SORT_PROPERTIES = fst.kArcSortProperties # <<<<<<<<<<<<<< + * I_LABEL_INVARIANT_PROPERTIES = fst.kILabelInvariantProperties + * O_LABEL_INVARIANT_PROPERTIES = fst.kOLabelInvariantProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kArcSortProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2884, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_SORT_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2884, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2885 + * STATE_SORT_PROPERTIES = fst.kStateSortProperties + * ARC_SORT_PROPERTIES = fst.kArcSortProperties + * I_LABEL_INVARIANT_PROPERTIES = fst.kILabelInvariantProperties # <<<<<<<<<<<<<< + * O_LABEL_INVARIANT_PROPERTIES = fst.kOLabelInvariantProperties + * WEIGHT_INVARIANT_PROPERTIES = fst.kWeightInvariantProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kILabelInvariantProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_LABEL_INVARIANT_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2885, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2886 + * ARC_SORT_PROPERTIES = fst.kArcSortProperties + * I_LABEL_INVARIANT_PROPERTIES = fst.kILabelInvariantProperties + * O_LABEL_INVARIANT_PROPERTIES = fst.kOLabelInvariantProperties # <<<<<<<<<<<<<< + * WEIGHT_INVARIANT_PROPERTIES = fst.kWeightInvariantProperties + * ADD_SUPERFINAL_PROPERTIES = fst.kAddSuperFinalProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kOLabelInvariantProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_LABEL_INVARIANT_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2886, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2887 + * I_LABEL_INVARIANT_PROPERTIES = fst.kILabelInvariantProperties + * O_LABEL_INVARIANT_PROPERTIES = fst.kOLabelInvariantProperties + * WEIGHT_INVARIANT_PROPERTIES = fst.kWeightInvariantProperties # <<<<<<<<<<<<<< + * ADD_SUPERFINAL_PROPERTIES = fst.kAddSuperFinalProperties + * RM_SUPERFINAL_PROPERTIES = fst.kRmSuperFinalProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kWeightInvariantProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_WEIGHT_INVARIANT_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2887, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2888 + * O_LABEL_INVARIANT_PROPERTIES = fst.kOLabelInvariantProperties + * WEIGHT_INVARIANT_PROPERTIES = fst.kWeightInvariantProperties + * ADD_SUPERFINAL_PROPERTIES = fst.kAddSuperFinalProperties # <<<<<<<<<<<<<< + * RM_SUPERFINAL_PROPERTIES = fst.kRmSuperFinalProperties + * BINARY_PROPERTIES = fst.kBinaryProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kAddSuperFinalProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2888, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADD_SUPERFINAL_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2888, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2889 + * WEIGHT_INVARIANT_PROPERTIES = fst.kWeightInvariantProperties + * ADD_SUPERFINAL_PROPERTIES = fst.kAddSuperFinalProperties + * RM_SUPERFINAL_PROPERTIES = fst.kRmSuperFinalProperties # <<<<<<<<<<<<<< + * BINARY_PROPERTIES = fst.kBinaryProperties + * TRINARY_PROPERTIES = fst.kTrinaryProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kRmSuperFinalProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_RM_SUPERFINAL_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2889, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2890 + * ADD_SUPERFINAL_PROPERTIES = fst.kAddSuperFinalProperties + * RM_SUPERFINAL_PROPERTIES = fst.kRmSuperFinalProperties + * BINARY_PROPERTIES = fst.kBinaryProperties # <<<<<<<<<<<<<< + * TRINARY_PROPERTIES = fst.kTrinaryProperties + * POS_TRINARY_PROPERTIES = fst.kPosTrinaryProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kBinaryProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2890, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2891 + * RM_SUPERFINAL_PROPERTIES = fst.kRmSuperFinalProperties + * BINARY_PROPERTIES = fst.kBinaryProperties + * TRINARY_PROPERTIES = fst.kTrinaryProperties # <<<<<<<<<<<<<< + * POS_TRINARY_PROPERTIES = fst.kPosTrinaryProperties + * NEG_TRINARY_PROPERTIES = fst.kNegTrinaryProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kTrinaryProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TRINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2891, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2892 + * BINARY_PROPERTIES = fst.kBinaryProperties + * TRINARY_PROPERTIES = fst.kTrinaryProperties + * POS_TRINARY_PROPERTIES = fst.kPosTrinaryProperties # <<<<<<<<<<<<<< + * NEG_TRINARY_PROPERTIES = fst.kNegTrinaryProperties + * FST_PROPERTIES = fst.kFstProperties + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kPosTrinaryProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2892, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_POS_TRINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2892, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2893 + * TRINARY_PROPERTIES = fst.kTrinaryProperties + * POS_TRINARY_PROPERTIES = fst.kPosTrinaryProperties + * NEG_TRINARY_PROPERTIES = fst.kNegTrinaryProperties # <<<<<<<<<<<<<< + * FST_PROPERTIES = fst.kFstProperties + * + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kNegTrinaryProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NEG_TRINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2893, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2894 + * POS_TRINARY_PROPERTIES = fst.kPosTrinaryProperties + * NEG_TRINARY_PROPERTIES = fst.kNegTrinaryProperties + * FST_PROPERTIES = fst.kFstProperties # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(fst::kFstProperties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2894, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FST_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2894, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2900 + * + * + * ARC_I_LABEL_VALUE = fst.kArcILabelValue # <<<<<<<<<<<<<< + * ARC_O_LABEL_VALUE = fst.kArcOLabelValue + * ARC_WEIGHT_VALUE = fst.kArcWeightValue + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kArcILabelValue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_I_LABEL_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 2900, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2901 + * + * ARC_I_LABEL_VALUE = fst.kArcILabelValue + * ARC_O_LABEL_VALUE = fst.kArcOLabelValue # <<<<<<<<<<<<<< + * ARC_WEIGHT_VALUE = fst.kArcWeightValue + * ARC_NEXT_STATE_VALUE = fst.kArcNextStateValue + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kArcOLabelValue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2901, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_O_LABEL_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 2901, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2902 + * ARC_I_LABEL_VALUE = fst.kArcILabelValue + * ARC_O_LABEL_VALUE = fst.kArcOLabelValue + * ARC_WEIGHT_VALUE = fst.kArcWeightValue # <<<<<<<<<<<<<< + * ARC_NEXT_STATE_VALUE = fst.kArcNextStateValue + * ARC_NO_CACHE = fst.kArcNoCache + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kArcWeightValue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_WEIGHT_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 2902, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2903 + * ARC_O_LABEL_VALUE = fst.kArcOLabelValue + * ARC_WEIGHT_VALUE = fst.kArcWeightValue + * ARC_NEXT_STATE_VALUE = fst.kArcNextStateValue # <<<<<<<<<<<<<< + * ARC_NO_CACHE = fst.kArcNoCache + * ARC_VALUE_FLAGS = fst.kArcValueFlags + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kArcNextStateValue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_NEXT_STATE_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 2903, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2904 + * ARC_WEIGHT_VALUE = fst.kArcWeightValue + * ARC_NEXT_STATE_VALUE = fst.kArcNextStateValue + * ARC_NO_CACHE = fst.kArcNoCache # <<<<<<<<<<<<<< + * ARC_VALUE_FLAGS = fst.kArcValueFlags + * ARC_FLAGS = fst.kArcFlags + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kArcNoCache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_NO_CACHE, __pyx_t_1) < 0) __PYX_ERR(0, 2904, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2905 + * ARC_NEXT_STATE_VALUE = fst.kArcNextStateValue + * ARC_NO_CACHE = fst.kArcNoCache + * ARC_VALUE_FLAGS = fst.kArcValueFlags # <<<<<<<<<<<<<< + * ARC_FLAGS = fst.kArcFlags + * + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kArcValueFlags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2905, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_VALUE_FLAGS, __pyx_t_1) < 0) __PYX_ERR(0, 2905, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2906 + * ARC_NO_CACHE = fst.kArcNoCache + * ARC_VALUE_FLAGS = fst.kArcValueFlags + * ARC_FLAGS = fst.kArcFlags # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kArcFlags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2906, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_FLAGS, __pyx_t_1) < 0) __PYX_ERR(0, 2906, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2912 + * + * + * ENCODE_LABELS = fst.kEncodeLabels # <<<<<<<<<<<<<< + * ENCODE_WEIGHTS = fst.kEncodeWeights + * ENCODE_FLAGS = fst.kEncodeFlags + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kEncodeLabels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2912, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODE_LABELS, __pyx_t_1) < 0) __PYX_ERR(0, 2912, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2913 + * + * ENCODE_LABELS = fst.kEncodeLabels + * ENCODE_WEIGHTS = fst.kEncodeWeights # <<<<<<<<<<<<<< + * ENCODE_FLAGS = fst.kEncodeFlags + * + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kEncodeWeights); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODE_WEIGHTS, __pyx_t_1) < 0) __PYX_ERR(0, 2913, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":2914 + * ENCODE_LABELS = fst.kEncodeLabels + * ENCODE_WEIGHTS = fst.kEncodeWeights + * ENCODE_FLAGS = fst.kEncodeFlags # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(fst::kEncodeFlags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODE_FLAGS, __pyx_t_1) < 0) __PYX_ERR(0, 2914, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":3286 + * + * cdef _Fst _map(_Fst ifst, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * map_type=b"identity", + * double power=1., + */ + __pyx_k__31 = fst::kDelta; + + /* "pywrapfst.pyx":3300 + * + * cpdef _Fst arcmap(_Fst ifst, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * map_type=b"identity", + * double power=1., + */ + __pyx_k__32 = fst::kDelta; + + /* "pywrapfst.pyx":3299 + * + * + * cpdef _Fst arcmap(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * map_type=b"identity", + */ + __pyx_k__32 = fst::kDelta; + + /* "pywrapfst.pyx":3413 + * + * cpdef _MutableFst determinize(_Fst ifst, + * float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * det_type=b"functional", + * int64 nstate=fst.kNoStateId, + */ + __pyx_k__33 = fst::kShortestDelta; + + /* "pywrapfst.pyx":3415 + * float delta=fst.kShortestDelta, + * det_type=b"functional", + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * int64 subsequential_label=0, + * weight=None, + */ + __pyx_k__34 = fst::kNoStateId; + + /* "pywrapfst.pyx":3413 + * + * cpdef _MutableFst determinize(_Fst ifst, + * float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * det_type=b"functional", + * int64 nstate=fst.kNoStateId, + */ + __pyx_k__33 = fst::kShortestDelta; + + /* "pywrapfst.pyx":3415 + * float delta=fst.kShortestDelta, + * det_type=b"functional", + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * int64 subsequential_label=0, + * weight=None, + */ + __pyx_k__34 = fst::kNoStateId; + + /* "pywrapfst.pyx":3507 + * + * cpdef _MutableFst disambiguate(_Fst ifst, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * int64 subsequential_label=0, + */ + __pyx_k__35 = fst::kDelta; + + /* "pywrapfst.pyx":3508 + * cpdef _MutableFst disambiguate(_Fst ifst, + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * int64 subsequential_label=0, + * weight=None): + */ + __pyx_k__36 = fst::kNoStateId; + + /* "pywrapfst.pyx":3507 + * + * cpdef _MutableFst disambiguate(_Fst ifst, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * int64 subsequential_label=0, + */ + __pyx_k__35 = fst::kDelta; + + /* "pywrapfst.pyx":3508 + * cpdef _MutableFst disambiguate(_Fst ifst, + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * int64 subsequential_label=0, + * weight=None): + */ + __pyx_k__36 = fst::kNoStateId; + + /* "pywrapfst.pyx":3578 + * + * + * cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): # <<<<<<<<<<<<<< + * """ + * equal(ifst1, ifst2, delta=0.0009765625) + */ + __pyx_k__37 = fst::kDelta; + __pyx_k__37 = fst::kDelta; + + /* "pywrapfst.pyx":3601 + * + * + * cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta) except *: # <<<<<<<<<<<<<< + * """ + * equivalent(ifst1, ifst2, delta=0.0009765625) + */ + __pyx_k__38 = fst::kDelta; + __pyx_k__38 = fst::kDelta; + + /* "pywrapfst.pyx":3658 + * + * + * cpdef bool isomorphic(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): # <<<<<<<<<<<<<< + * """ + * isomorphic(ifst1, ifst2, delta=0.0009765625) + */ + __pyx_k__39 = fst::kDelta; + __pyx_k__39 = fst::kDelta; + + /* "pywrapfst.pyx":3685 + * + * cpdef _MutableFst prune(_Fst ifst, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * weight=None): + */ + __pyx_k__40 = fst::kDelta; + + /* "pywrapfst.pyx":3686 + * cpdef _MutableFst prune(_Fst ifst, + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * weight=None): + * """ + */ + __pyx_k__41 = fst::kNoStateId; + + /* "pywrapfst.pyx":3685 + * + * cpdef _MutableFst prune(_Fst ifst, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * weight=None): + */ + __pyx_k__40 = fst::kDelta; + + /* "pywrapfst.pyx":3686 + * cpdef _MutableFst prune(_Fst ifst, + * float delta=fst.kDelta, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * weight=None): + * """ + */ + __pyx_k__41 = fst::kNoStateId; + + /* "pywrapfst.pyx":3718 + * + * cpdef _MutableFst push(_Fst ifst, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * bool push_weights=False, + * bool push_labels=False, + */ + __pyx_k__42 = fst::kDelta; + + /* "pywrapfst.pyx":3717 + * + * + * cpdef _MutableFst push(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kDelta, + * bool push_weights=False, + */ + __pyx_k__42 = fst::kDelta; + + /* "pywrapfst.pyx":3774 + * _Fst ifst2, + * int32 npath=1, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * time_t seed=0, + * select=b"uniform", + */ + __pyx_k__43 = fst::kDelta; + + /* "pywrapfst.pyx":3777 + * time_t seed=0, + * select=b"uniform", + * int32 max_length=INT32_MAX) except *: # <<<<<<<<<<<<<< + * """ + * randequivalent(ifst1, ifst2, npath=1, delta=0.0009765625, seed=0, + */ + __pyx_k__44 = INT32_MAX; + + /* "pywrapfst.pyx":3774 + * _Fst ifst2, + * int32 npath=1, + * float delta=fst.kDelta, # <<<<<<<<<<<<<< + * time_t seed=0, + * select=b"uniform", + */ + __pyx_k__43 = fst::kDelta; + + /* "pywrapfst.pyx":3777 + * time_t seed=0, + * select=b"uniform", + * int32 max_length=INT32_MAX) except *: # <<<<<<<<<<<<<< + * """ + * randequivalent(ifst1, ifst2, npath=1, delta=0.0009765625, seed=0, + */ + __pyx_k__44 = INT32_MAX; + + /* "pywrapfst.pyx":3821 + * time_t seed=0, + * select=b"uniform", + * int32 max_length=INT32_MAX, # <<<<<<<<<<<<<< + * bool weighted=False, + * bool remove_total_weight=False): + */ + __pyx_k__45 = INT32_MAX; + + /* "pywrapfst.pyx":3817 + * + * + * cpdef _MutableFst randgen(_Fst ifst, # <<<<<<<<<<<<<< + * int32 npath=1, + * time_t seed=0, + */ + __pyx_k__45 = INT32_MAX; + + /* "pywrapfst.pyx":3959 + * + * cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, + * float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * queue_type=b"auto", + */ + __pyx_k__46 = fst::kShortestDelta; + + /* "pywrapfst.pyx":3960 + * cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool reverse=False) except *: + */ + __pyx_k__47 = fst::kNoStateId; + + /* "pywrapfst.pyx":3981 + * + * def shortestdistance(_Fst ifst, + * float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * int64 nstate=fst.kNoStateId, + * queue_type=b"auto", + */ + __pyx_k__48 = fst::kShortestDelta; + + /* "pywrapfst.pyx":3982 + * def shortestdistance(_Fst ifst, + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool reverse=False): + */ + __pyx_k__49 = fst::kNoStateId; + + /* "pywrapfst.pyx":3980 + * + * + * def shortestdistance(_Fst ifst, # <<<<<<<<<<<<<< + * float delta=fst.kShortestDelta, + * int64 nstate=fst.kNoStateId, + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9pywrapfst_53shortestdistance, NULL, __pyx_n_s_pywrapfst_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3980, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shortestdistance, __pyx_t_1) < 0) __PYX_ERR(0, 3980, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pywrapfst.pyx":4018 + * + * cpdef _MutableFst shortestpath(_Fst ifst, + * float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * int32 nshortest=1, + * int64 nstate=fst.kNoStateId, + */ + __pyx_k__50 = fst::kShortestDelta; + + /* "pywrapfst.pyx":4020 + * float delta=fst.kShortestDelta, + * int32 nshortest=1, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool unique=False, + */ + __pyx_k__51 = fst::kNoStateId; + + /* "pywrapfst.pyx":4018 + * + * cpdef _MutableFst shortestpath(_Fst ifst, + * float delta=fst.kShortestDelta, # <<<<<<<<<<<<<< + * int32 nshortest=1, + * int64 nstate=fst.kNoStateId, + */ + __pyx_k__50 = fst::kShortestDelta; + + /* "pywrapfst.pyx":4020 + * float delta=fst.kShortestDelta, + * int32 nshortest=1, + * int64 nstate=fst.kNoStateId, # <<<<<<<<<<<<<< + * queue_type=b"auto", + * bool unique=False, + */ + __pyx_k__51 = fst::kNoStateId; + + /* "pywrapfst.pyx":4171 + * + * def __cinit__(self, + * string fst_type=b"vector", # <<<<<<<<<<<<<< + * string arc_type=b"standard", + * SymbolTable isymbols=None, + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_vector); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4171, __pyx_L1_error) + __pyx_k__52 = __pyx_t_5; + + /* "pywrapfst.pyx":4172 + * def __cinit__(self, + * string fst_type=b"vector", + * string arc_type=b"standard", # <<<<<<<<<<<<<< + * SymbolTable isymbols=None, + * SymbolTable osymbols=None, + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_standard); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4172, __pyx_L1_error) + __pyx_k__53 = __pyx_t_5; + + /* "pywrapfst.pyx":4273 + * + * @classmethod + * def open(cls, *filenames): # <<<<<<<<<<<<<< + * """ + * FarReader.open(*filenames) + */ + __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_9pywrapfst_FarReader, __pyx_n_s_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "pywrapfst.pyx":4272 + * return "<{} FarReader at 0x{:x}>".format(self.far_type(), id(self)) + * + * @classmethod # <<<<<<<<<<<<<< + * def open(cls, *filenames): + * """ + */ + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_FarReader->tp_dict, __pyx_n_s_open, __pyx_t_2) < 0) __PYX_ERR(0, 4273, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_FarReader); + + /* "pywrapfst.pyx":4424 + * + * @classmethod + * def create(cls, filename, arc_type=b"standard", far_type=b"default"): # <<<<<<<<<<<<<< + * """ + * FarWriter. + */ + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_9pywrapfst_FarWriter, __pyx_n_s_create); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pywrapfst.pyx":4423 + * return "<{} FarWriter at 0x{:x}>".format(self.far_type(), id(self)) + * + * @classmethod # <<<<<<<<<<<<<< + * def create(cls, filename, arc_type=b"standard", far_type=b"default"): + * """ + */ + __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4423, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_9pywrapfst_FarWriter->tp_dict, __pyx_n_s_create, __pyx_t_1) < 0) __PYX_ERR(0, 4424, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_9pywrapfst_FarWriter); + + /* "pywrapfst.pyx":4516 + * + * # Masks fst_error_fatal in-module. + * fst.FLAGS_fst_error_fatal = False # <<<<<<<<<<<<<< + * + */ + FLAGS_fst_error_fatal = 0; + + /* "pywrapfst.pyx":1 + * #cython: nonecheck=True, c_string_type=unicode, c_string_encoding=utf8 # <<<<<<<<<<<<<< + * # Licensed under the Apache License, Version 2.0 (the "License"); + * # you may not use this file except in compliance with the License. + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py___pyx_t_10basictypes_int64") + * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_10basictypes_int64(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + if (__pyx_m) { + if (__pyx_d) { + __Pyx_AddTraceback("init pywrapfst", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + Py_CLEAR(__pyx_m); + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init pywrapfst"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + } +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif +#endif + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + __Pyx_PyThreadState_declare + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +/* PyObjectCallNoArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) +#else + if (likely(PyCFunction_Check(func))) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +/* WriteUnraisableException */ +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback, CYTHON_UNUSED int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; +#endif +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + #endif + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +#endif + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = a->tp_base; + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; + if (!res) { + res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } + return res; +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; icurexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; icurexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; + if (unlikely(PyTuple_Check(err))) + return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); +} +#endif + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +/* IterNext */ +static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_Occurred(); + if (unlikely(exc_type)) { + if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(defval); + return defval; + } + if (defval) { + Py_INCREF(defval); + return defval; + } + __Pyx_PyErr_SetNone(PyExc_StopIteration); + return NULL; +} +static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) { + PyErr_Format(PyExc_TypeError, + "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name); +} +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { + PyObject* next; + iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; + if (likely(iternext)) { +#if CYTHON_USE_TYPE_SLOTS + next = iternext(iterator); + if (likely(next)) + return next; + #if PY_VERSION_HEX >= 0x02070000 + if (unlikely(iternext == &_PyObject_NextNotImplemented)) + return NULL; + #endif +#else + next = PyIter_Next(iterator); + if (likely(next)) + return next; +#endif + } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) { + __Pyx_PyIter_Next_ErrorNoIterator(iterator); + return NULL; + } +#if !CYTHON_USE_TYPE_SLOTS + else { + next = PyIter_Next(iterator); + if (likely(next)) + return next; + } +#endif + return __Pyx_PyIter_Next2Default(defval); +} + +/* PyObject_GenericGetAttrNoDict */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, attr_name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(attr_name)); +#endif + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } + } + return descr; +} +#endif + +/* PyObject_GenericGetAttr */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); + } + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); +} +#endif + +/* SetVTable */ +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* SetupReduce */ +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD; +#else + if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD; +#endif +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD; + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD; + setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD; + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD; + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto GOOD; +BAD: + if (!PyErr_Occurred()) + PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + ret = -1; +GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +/* CalculateMetaclass */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); + for (i=0; i < nbases; i++) { + PyTypeObject *tmptype; + PyObject *tmp = PyTuple_GET_ITEM(bases, i); + tmptype = Py_TYPE(tmp); +#if PY_MAJOR_VERSION < 3 + if (tmptype == &PyClass_Type) + continue; +#endif + if (!metaclass) { + metaclass = tmptype; + continue; + } + if (PyType_IsSubtype(metaclass, tmptype)) + continue; + if (PyType_IsSubtype(tmptype, metaclass)) { + metaclass = tmptype; + continue; + } + PyErr_SetString(PyExc_TypeError, + "metaclass conflict: " + "the metaclass of a derived class " + "must be a (non-strict) subclass " + "of the metaclasses of all its bases"); + return NULL; + } + if (!metaclass) { +#if PY_MAJOR_VERSION < 3 + metaclass = &PyClass_Type; +#else + metaclass = &PyType_Type; +#endif + } + Py_INCREF((PyObject*) metaclass); + return (PyObject*) metaclass; +} + +/* Py3ClassCreate */ +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { + PyObject *ns; + if (metaclass) { + PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); + if (prep) { + PyObject *pargs = PyTuple_Pack(2, name, bases); + if (unlikely(!pargs)) { + Py_DECREF(prep); + return NULL; + } + ns = PyObject_Call(prep, pargs, mkw); + Py_DECREF(prep); + Py_DECREF(pargs); + } else { + if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + PyErr_Clear(); + ns = PyDict_New(); + } + } else { + ns = PyDict_New(); + } + if (unlikely(!ns)) + return NULL; + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; + if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; + return ns; +bad: + Py_DECREF(ns); + return NULL; +} +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, + PyObject *dict, PyObject *mkw, + int calculate_metaclass, int allow_py2_metaclass) { + PyObject *result, *margs; + PyObject *owned_metaclass = NULL; + if (allow_py2_metaclass) { + owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); + if (owned_metaclass) { + metaclass = owned_metaclass; + } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { + PyErr_Clear(); + } else { + return NULL; + } + } + if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { + metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); + Py_XDECREF(owned_metaclass); + if (unlikely(!metaclass)) + return NULL; + owned_metaclass = metaclass; + } + margs = PyTuple_Pack(3, name, bases, dict); + if (unlikely(!margs)) { + result = NULL; + } else { + result = PyObject_Call(metaclass, margs, mkw); + Py_DECREF(margs); + } + Py_XDECREF(owned_metaclass); + return result; +} + +/* ClassMethod */ +static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { +#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000 + if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { + return PyClassMethod_New(method); + } +#else +#if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY + if (PyMethodDescr_Check(method)) +#else + static PyTypeObject *methoddescr_type = NULL; + if (methoddescr_type == NULL) { + PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append"); + if (!meth) return NULL; + methoddescr_type = Py_TYPE(meth); + Py_DECREF(meth); + } + if (__Pyx_TypeCheck(method, methoddescr_type)) +#endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject *)method; + #if PY_VERSION_HEX < 0x03020000 + PyTypeObject *d_type = descr->d_type; + #else + PyTypeObject *d_type = descr->d_common.d_type; + #endif + return PyDescr_NewClassMethod(d_type, descr->d_method); + } +#endif + else if (PyMethod_Check(method)) { + return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); + } + else if (PyCFunction_Check(method)) { + return PyClassMethod_New(method); + } +#ifdef __Pyx_CyFunction_USED + else if (__Pyx_CyFunction_Check(method)) { + return PyClassMethod_New(method); + } +#endif + PyErr_SetString(PyExc_TypeError, + "Class-level classmethod() can only be called on " + "a method_descriptor or instance method."); + return NULL; +} + +/* GetNameInClass */ +static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) { + PyObject *result; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); + return result; +} +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + result = __Pyx_PyObject_GetAttrStr(nmspace, name); + if (!result) { + result = __Pyx_GetGlobalNameAfterAttributeLookup(name); + } + return result; +} + +/* FetchCommonType */ +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* fake_module; + PyTypeObject* cached_type = NULL; + fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); + if (!fake_module) return NULL; + Py_INCREF(fake_module); + cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + if (cached_type) { + if (!PyType_Check((PyObject*)cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", + type->tp_name); + goto bad; + } + if (cached_type->tp_basicsize != type->tp_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + type->tp_name); + goto bad; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; + } +done: + Py_DECREF(fake_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CythonFunction */ +#include +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return __Pyx_PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + Py_ssize_t size; + switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 0)) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; + argc = PyTuple_GET_SIZE(args); + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, + 0, + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_CyFunction_descr_get, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +}; +static int __pyx_CyFunction_init(void) { + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CLineInTraceback */ +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) { + const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int64_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int64_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int64_t), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) { + const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { + const uint32_t neg_one = (uint32_t) ((uint32_t) 0 - (uint32_t) 1), const_zero = (uint32_t) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint32_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint32_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) { + const int32_t neg_one = (int32_t) ((int32_t) 0 - (int32_t) 1), const_zero = (int32_t) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int32_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int32_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int32_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int32_t), + little, !is_unsigned); + } +} + +/* CIntFromPy */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { + const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(size_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (size_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(size_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) + case -2: + if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(size_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + size_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (size_t) -1; + } + } else { + size_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyInt_As_size_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) { + const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int64_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int64_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int64_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0]) + case 2: + if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) { + return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) { + return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) { + return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int64_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int64_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int64_t, digit, +digits[0]) + case -2: + if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) { + return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) { + return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) { + return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) { + return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) { + return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) { + return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int64_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int64_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int64_t) -1; + } + } else { + int64_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int64_t) -1; + val = __Pyx_PyInt_As_int64_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int64_t"); + return (int64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int64_t"); + return (int64_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { + const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(uint64_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (uint64_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (uint64_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0]) + case 2: + if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(uint64_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (uint64_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0]) + case -2: + if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(uint64_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + uint64_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (uint64_t) -1; + } + } else { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyInt_As_uint64_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { + const int32_t neg_one = (int32_t) ((int32_t) 0 - (int32_t) 1), const_zero = (int32_t) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int32_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int32_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int32_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0]) + case 2: + if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) { + return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) { + return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) >= 4 * PyLong_SHIFT) { + return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int32_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int32_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, +digits[0]) + case -2: + if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { + return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { + return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { + return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { + return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) { + return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) { + return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int32_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int32_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int32_t) -1; + } + } else { + int32_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int32_t) -1; + val = __Pyx_PyInt_As_int32_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int32_t"); + return (int32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int32_t"); + return (int32_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { + const uint32_t neg_one = (uint32_t) ((uint32_t) 0 - (uint32_t) 1), const_zero = (uint32_t) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(uint32_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (uint32_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (uint32_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(uint32_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (uint32_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) + case -2: + if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(uint32_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + uint32_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (uint32_t) -1; + } + } else { + uint32_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyInt_As_uint32_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint32_t"); + return (uint32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint32_t"); + return (uint32_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE time_t __Pyx_PyInt_As_time_t(PyObject *x) { + const time_t neg_one = (time_t) ((time_t) 0 - (time_t) 1), const_zero = (time_t) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(time_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(time_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (time_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (time_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(time_t, digit, digits[0]) + case 2: + if (8 * sizeof(time_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) >= 2 * PyLong_SHIFT) { + return (time_t) (((((time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(time_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) >= 3 * PyLong_SHIFT) { + return (time_t) (((((((time_t)digits[2]) << PyLong_SHIFT) | (time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(time_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) >= 4 * PyLong_SHIFT) { + return (time_t) (((((((((time_t)digits[3]) << PyLong_SHIFT) | (time_t)digits[2]) << PyLong_SHIFT) | (time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (time_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(time_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(time_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(time_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(time_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (time_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(time_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(time_t, digit, +digits[0]) + case -2: + if (8 * sizeof(time_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) - 1 > 2 * PyLong_SHIFT) { + return (time_t) (((time_t)-1)*(((((time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(time_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) - 1 > 2 * PyLong_SHIFT) { + return (time_t) ((((((time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(time_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) - 1 > 3 * PyLong_SHIFT) { + return (time_t) (((time_t)-1)*(((((((time_t)digits[2]) << PyLong_SHIFT) | (time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(time_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) - 1 > 3 * PyLong_SHIFT) { + return (time_t) ((((((((time_t)digits[2]) << PyLong_SHIFT) | (time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(time_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) - 1 > 4 * PyLong_SHIFT) { + return (time_t) (((time_t)-1)*(((((((((time_t)digits[3]) << PyLong_SHIFT) | (time_t)digits[2]) << PyLong_SHIFT) | (time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(time_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(time_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(time_t) - 1 > 4 * PyLong_SHIFT) { + return (time_t) ((((((((((time_t)digits[3]) << PyLong_SHIFT) | (time_t)digits[2]) << PyLong_SHIFT) | (time_t)digits[1]) << PyLong_SHIFT) | (time_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(time_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(time_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(time_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(time_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + time_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (time_t) -1; + } + } else { + time_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (time_t) -1; + val = __Pyx_PyInt_As_time_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to time_t"); + return (time_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to time_t"); + return (time_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) + case -2: + if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } +#endif + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (long) -1; + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (descr != NULL) { + *method = descr; + return 0; + } + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(name)); +#endif + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} + +/* PyObjectCallMethod1 */ +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +} + +/* CoroutineBase */ +#include +#include +#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } +#if PY_VERSION_HEX >= 0x030300A0 + else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); + } +#endif + else if (unlikely(PyTuple_Check(ev))) { + if (PyTuple_GET_SIZE(ev) >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#else + value = PySequence_ITEM(ev, 0); +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else + { + PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); + Py_DECREF(ev); + if (likely(args)) { + value = PySequence_GetItem(args, 0); + Py_DECREF(args); + } + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; + } + } +#endif + *pvalue = value; + return 0; +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) { + const char *msg; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +#define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) { + const char *msg; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(gen)) { + msg = "can't send non-None value to a just-started coroutine"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(gen)) { + msg = "can't send non-None value to a just-started async generator"; + #endif + } else { + msg = "can't send non-None value to a just-started generator"; + } + PyErr_SetString(PyExc_TypeError, msg); +} +#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) { + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { + return __Pyx_Coroutine_NotStartedError((PyObject*)self); + } + } + if (unlikely(self->resume_label == -1)) { + return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_type) { + #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON + #else + if (exc_state->exc_traceback) { + PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_XINCREF(tstate->frame); + assert(f->f_back == NULL); + f->f_back = tstate->frame; + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + self->is_running = 1; + retval = self->body((PyObject *) self, tstate, value); + self->is_running = 0; +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + return retval; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { + PyObject *exc_tb = exc_state->exc_traceback; + if (likely(exc_tb)) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON +#else + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); +#endif + } +} +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) { + if (unlikely(!retval)) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (!__Pyx_PyErr_Occurred()) { + PyObject *exc = PyExc_StopIteration; + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + exc = __Pyx_PyExc_StopAsyncIteration; + #endif + __Pyx_PyErr_SetNone(exc); + } + } + return retval; +} +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + ret = __Pyx_Coroutine_SendEx(gen, val, 0); + Py_XDECREF(val); + return ret; +} +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyCoro_CheckExact(yf)) { + ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + { + if (value == Py_None) + ret = Py_TYPE(yf)->tp_iternext(yf); + else + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + retval = __Pyx_Coroutine_FinishDelegation(gen); + } else { + retval = __Pyx_Coroutine_SendEx(gen, value, 0); + } + return __Pyx_Coroutine_MethodReturn(self, retval); +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + } else + #endif + { + PyObject *meth; + gen->is_running = 1; + meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); + if (unlikely(!meth)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_WriteUnraisable(yf); + } + PyErr_Clear(); + } else { + retval = PyObject_CallFunction(meth, NULL); + Py_DECREF(meth); + if (!retval) + err = -1; + } + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = _PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + ret = Py_TYPE(yf)->tp_iternext(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_SendEx(gen, Py_None, 0); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __Pyx_Coroutine_Close(self); +} +static PyObject *__Pyx_Coroutine_Close(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + retval = __Pyx_Coroutine_SendEx(gen, NULL, 1); + if (unlikely(retval)) { + const char *msg; + Py_DECREF(retval); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { +#if PY_VERSION_HEX < 0x03060000 + msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)"; +#else + msg = "async generator ignored GeneratorExit"; +#endif + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + return NULL; + } + raised_exception = PyErr_Occurred(); + if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) { + if (raised_exception) PyErr_Clear(); + Py_INCREF(Py_None); + return Py_None; + } + return NULL; +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); + goto throw_here; + } + gen->is_running = 1; + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + gen->is_running = 0; + return NULL; + } + PyErr_Clear(); + __Pyx_Coroutine_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + if (likely(args)) { + ret = PyObject_CallObject(meth, args); + } else { + ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL); + } + Py_DECREF(meth); + } + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_MethodReturn(self, ret); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE + if (PyObject_CallFinalizerFromDealloc(self)) +#else + Py_TYPE(gen)->tp_del(self); + if (self->ob_refcnt > 0) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + PyObject_GC_Del(gen); +} +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } +#if !CYTHON_USE_TP_FINALIZE + assert(self->ob_refcnt == 0); + self->ob_refcnt = 1; +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); +#if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat) + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); +#else + {PyObject *msg; + char *cmsg; + #if CYTHON_COMPILING_IN_PYPY + msg = NULL; + cmsg = (char*) "coroutine was never awaited"; + #else + char *cname; + PyObject *qualname; + qualname = gen->gi_qualname; + cname = PyString_AS_STRING(qualname); + msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname); + if (unlikely(!msg)) { + PyErr_Clear(); + cmsg = (char*) "coroutine was never awaited"; + } else { + cmsg = PyString_AS_STRING(msg); + } + #endif + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) + PyErr_WriteUnraisable(self); + Py_XDECREF(msg);} +#endif + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *res = __Pyx_Coroutine_Close(self); + if (unlikely(!res)) { + if (PyErr_Occurred()) + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +#if !CYTHON_USE_TP_FINALIZE + assert(self->ob_refcnt > 0); + if (--self->ob_refcnt == 0) { + return; + } + { + Py_ssize_t refcnt = self->ob_refcnt; + _Py_NewReference(self); + self->ob_refcnt = refcnt; + } +#if CYTHON_COMPILING_IN_CPYTHON + assert(PyType_IS_GC(self->ob_type) && + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); + _Py_DEC_REFTOTAL; +#endif +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif +#endif +} +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +{ + PyObject *name = self->gi_name; + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = self->gi_name; + Py_INCREF(value); + self->gi_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +{ + PyObject *name = self->gi_qualname; + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = self->gi_qualname; + Py_INCREF(value); + self->gi_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif + gen->gi_weakreflist = NULL; + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + PyObject_GC_Track(gen); + return gen; +} + +/* PatchModuleWithCoroutine */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + int result; + PyObject *globals, *result_obj; + globals = PyDict_New(); if (unlikely(!globals)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_coroutine_type", + #ifdef __Pyx_Coroutine_USED + (PyObject*)__pyx_CoroutineType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_generator_type", + #ifdef __Pyx_Generator_USED + (PyObject*)__pyx_GeneratorType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; + result_obj = PyRun_String(py_code, Py_file_input, globals, globals); + if (unlikely(!result_obj)) goto ignore; + Py_DECREF(result_obj); + Py_DECREF(globals); + return module; +ignore: + Py_XDECREF(globals); + PyErr_WriteUnraisable(module); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { + Py_DECREF(module); + module = NULL; + } +#else + py_code++; +#endif + return module; +} + +/* PatchGeneratorABC */ +#ifndef CYTHON_REGISTER_ABCS +#define CYTHON_REGISTER_ABCS 1 +#endif +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) +static PyObject* __Pyx_patch_abc_module(PyObject *module); +static PyObject* __Pyx_patch_abc_module(PyObject *module) { + module = __Pyx_Coroutine_patch_module( + module, "" +"if _cython_generator_type is not None:\n" +" try: Generator = _module.Generator\n" +" except AttributeError: pass\n" +" else: Generator.register(_cython_generator_type)\n" +"if _cython_coroutine_type is not None:\n" +" try: Coroutine = _module.Coroutine\n" +" except AttributeError: pass\n" +" else: Coroutine.register(_cython_coroutine_type)\n" + ); + return module; +} +#endif +static int __Pyx_patch_abc(void) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + static int abc_patched = 0; + if (CYTHON_REGISTER_ABCS && !abc_patched) { + PyObject *module; + module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); + if (!module) { + PyErr_WriteUnraisable(NULL); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, + ((PY_MAJOR_VERSION >= 3) ? + "Cython module failed to register with collections.abc module" : + "Cython module failed to register with collections module"), 1) < 0)) { + return -1; + } + } else { + module = __Pyx_patch_abc_module(module); + abc_patched = 1; + if (unlikely(!module)) + return -1; + Py_DECREF(module); + } + module = PyImport_ImportModule("backports_abc"); + if (module) { + module = __Pyx_patch_abc_module(module); + Py_XDECREF(module); + } + if (!module) { + PyErr_Clear(); + } + } +#else + if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL); +#endif + return 0; +} + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, + {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, + {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + (char*) PyDoc_STR("name of the generator"), 0}, + {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + (char*) PyDoc_STR("qualified name of the generator"), 0}, + {0, 0, 0, 0, 0} +}; +static PyTypeObject __pyx_GeneratorType_type = { + PyVarObject_HEAD_INIT(0, 0) + "generator", + sizeof(__pyx_CoroutineObject), + 0, + (destructor) __Pyx_Coroutine_dealloc, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, + 0, + (traverseproc) __Pyx_Coroutine_traverse, + 0, + 0, + offsetof(__pyx_CoroutineObject, gi_weakreflist), + 0, + (iternextfunc) __Pyx_Generator_Next, + __pyx_Generator_methods, + __pyx_Generator_memberlist, + __pyx_Generator_getsets, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if CYTHON_USE_TP_FINALIZE + 0, +#else + __Pyx_Coroutine_del, +#endif + 0, +#if CYTHON_USE_TP_FINALIZE + __Pyx_Coroutine_del, +#elif PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +}; +static int __pyx_Generator_init(void) { + __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; + __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); + if (unlikely(!__pyx_GeneratorType)) { + return -1; + } + return 0; +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + return PyErr_WarnEx(NULL, message, 1); + } + return 0; +} + +/* FunctionExport */ +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); + if (!d) { + PyErr_Clear(); + d = PyDict_New(); + if (!d) + goto bad; + Py_INCREF(d); + if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) + goto bad; + } + tmp.fp = f; +#if PY_VERSION_HEX >= 0x02070000 + cobj = PyCapsule_New(tmp.p, sig, 0); +#else + cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); +#endif + if (!cobj) + goto bad; + if (PyDict_SetItemString(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + return -1; +} + +/* InitStrings */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} +#else +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +} +#endif +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif +#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { +#if PY_MAJOR_VERSION >= 3 + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type %.200s). " + "The ability to return an instance of a strict subclass of int " + "is deprecated, and may be removed in a future version of Python.", + Py_TYPE(result)->tp_name)) { + Py_DECREF(result); + return NULL; + } + return result; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + type_name, type_name, Py_TYPE(result)->tp_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x) || PyLong_Check(x))) +#else + if (likely(PyLong_Check(x))) +#endif + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + #if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = m->nb_int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = m->nb_long(x); + } + #else + if (likely(m && m->nb_int)) { + name = "int"; + res = m->nb_int(x); + } + #endif +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); + } +#endif + if (likely(res)) { +#if PY_MAJOR_VERSION < 3 + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { +#else + if (unlikely(!PyLong_CheckExact(res))) { +#endif + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(b); + } +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)b)->ob_digit; + const Py_ssize_t size = Py_SIZE(b); + if (likely(__Pyx_sst_abs(size) <= 1)) { + ival = likely(size) ? digits[0] : 0; + if (size == -1) ival = -ival; + return ival; + } else { + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +#endif /* Py_PYTHON_H */ diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.pxd b/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.pxd new file mode 100644 index 0000000..9cce412 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.pxd @@ -0,0 +1,563 @@ +# See www.openfst.org for extensive documentation on this weighted +# finite-state transducer library. + + +from libc.time cimport time +from libc.time cimport time_t + +from libcpp cimport bool +from libcpp.memory cimport shared_ptr +from libcpp.memory cimport unique_ptr +from libcpp.utility cimport pair +from libcpp.vector cimport vector + +from libcpp.string cimport string +from basictypes cimport int32 +from basictypes cimport int64 +from basictypes cimport uint32 +from basictypes cimport uint64 +cimport fst as fst +from ios cimport stringstream + + +# Exportable helper functions. + + +cdef string tostring(data) except * + +cdef string weight_tostring(data) except * + +cdef fst.ComposeFilter _get_compose_filter( + const string &compose_filter) except * + +cdef fst.DeterminizeType _get_determinize_type(const string &det_type) except * + +cdef fst.QueueType _get_queue_type(const string &queue_type) except * + +cdef fst.RandArcSelection _get_rand_arc_selection( + const string &replace_label_type) except * + +cdef fst.ReplaceLabelType _get_replace_label_type( + const string &replace_label_type, bool epsilon_on_replace) except * + + +# Weight. + + +cdef fst.WeightClass _get_WeightClass_or_One(const string &weight_type, + weight_string) except * + +cdef fst.WeightClass _get_WeightClass_or_Zero(const string &weight_type, + weight_string) except * + + +cdef class Weight(object): + + cdef unique_ptr[fst.WeightClass] _weight + + cdef void _check_weight(self) except * + + cpdef Weight copy(self) + + cpdef string to_string(self) + + cpdef string type(self) + + cpdef bool member(self) + + +cdef Weight _Zero(weight_type) + +cdef Weight _One(weight_type) + +cdef Weight _NoWeight(weight_type) + +cdef Weight _plus(Weight lhs, Weight rhs) + +cdef Weight _times(Weight lhs, Weight rhs) + +cdef Weight _divide(Weight lhs, Weight rhs) + +cdef Weight _power(Weight lhs, size_t n) + + +# SymbolTable. + +ctypedef fst.SymbolTable * SymbolTable_ptr + + +cdef class _SymbolTable(object): + + cdef fst.SymbolTable *_table + + cpdef int64 available_key(self) + + cpdef bytes checksum(self) + + cpdef SymbolTable copy(self) + + cpdef int64 get_nth_key(self, ssize_t pos) except * + + cpdef bytes labeled_checksum(self) + + cpdef bool member(self, key) + + cpdef string name(self) + + cpdef size_t num_symbols(self) + + cpdef void write(self, filename) except * + + cpdef void write_text(self, filename) except * + + cpdef bytes write_to_string(self) + + +cdef class _EncodeMapperSymbolTable(_SymbolTable): + + cdef shared_ptr[fst.EncodeMapperClass] _encoder + + +cdef class _FstSymbolTable(_SymbolTable): + + cdef shared_ptr[fst.FstClass] _fst + + +cdef class _MutableSymbolTable(_SymbolTable): + + cpdef int64 add_symbol(self, symbol, int64 key=?) + + cpdef void add_table(self, _SymbolTable syms) + + cpdef void set_name(self, new_name) except * + + +cdef class _MutableFstSymbolTable(_MutableSymbolTable): + + cdef shared_ptr[fst.MutableFstClass] _mfst + + +cdef class SymbolTable(_MutableSymbolTable): + + cdef unique_ptr[fst.SymbolTable] _smart_table + + +cdef _EncodeMapperSymbolTable _init_EncodeMapperSymbolTable( + fst.SymbolTable *table, shared_ptr[fst.EncodeMapperClass] encoder) + + +cdef _FstSymbolTable _init_FstSymbolTable(fst.SymbolTable *table, + shared_ptr[fst.FstClass] ifst) + + +cdef _MutableFstSymbolTable _init_MutableFstSymbolTable(fst.SymbolTable *table, + shared_ptr[fst.MutableFstClass] ifst) + + +cdef SymbolTable _init_SymbolTable(fst.SymbolTable *table) + + +cpdef _SymbolTable _read_SymbolTable_from_string(state) + + +cdef class SymbolTableIterator(object): + + cdef shared_ptr[fst.SymbolTable] _table + cdef unique_ptr[fst.SymbolTableIterator] _siter + + cpdef bool done(self) + + cpdef void next(self) + + cpdef void reset(self) + + cpdef string symbol(self) + + cpdef int64 value(self) + + +# EncodeMapper. + + +cdef class EncodeMapper(object): + + cdef shared_ptr[fst.EncodeMapperClass] _encoder + + cpdef string arc_type(self) + + cpdef uint32 flags(self) + + cpdef _EncodeMapperSymbolTable input_symbols(self) + + cpdef _EncodeMapperSymbolTable output_symbols(self) + + cpdef uint64 properties(self, uint64 mask) + + cpdef void set_input_symbols(self, _SymbolTable syms) except * + + cpdef void set_output_symbols(self, _SymbolTable syms) except * + + cpdef string weight_type(self) + + +# Fst. + + +ctypedef fst.FstClass * FstClass_ptr +ctypedef fst.MutableFstClass * MutableFstClass_ptr +ctypedef fst.VectorFstClass * VectorFstClass_ptr + + +cdef class _Fst(object): + + cdef shared_ptr[fst.FstClass] _fst + + # Google-only... + @staticmethod + cdef string _server_render_svg(const string &) + # ...Google-only. + + @staticmethod + cdef string _local_render_svg(const string &) + + cpdef string arc_type(self) + + cpdef ArcIterator arcs(self, int64 state) + + cpdef _Fst copy(self) + + cpdef void draw(self, filename, _SymbolTable isymbols=?, + _SymbolTable osymbols=?, SymbolTable ssymbols=?, + bool acceptor=?, title=?, double width=?, + double height=?, bool portrait=?, bool vertical=?, + double ranksep=?, double nodesep=?, int32 fontsize=?, + int32 precision=?, float_format=?, + bool show_weight_one=?) + + cpdef Weight final(self, int64 state) + + cpdef string fst_type(self) + + cpdef _FstSymbolTable input_symbols(self) + + cpdef size_t num_arcs(self, int64 state) except * + + cpdef size_t num_input_epsilons(self, int64 state) except * + + cpdef size_t num_output_epsilons(self, int64 state) except * + + cpdef _FstSymbolTable output_symbols(self) + + cpdef uint64 properties(self, uint64 mask, bool test) + + cpdef int64 start(self) + + cpdef StateIterator states(self) + + cpdef string text(self, _SymbolTable isymbols=?, _SymbolTable osymbols=?, + _SymbolTable ssymbols=?, bool acceptor=?, + bool show_weight_one=?, missing_sym=?) + + cpdef bool verify(self) + + cpdef string weight_type(self) + + cpdef void write(self, filename) except * + + cpdef bytes write_to_string(self) + + +cdef class _MutableFst(_Fst): + + cdef shared_ptr[fst.MutableFstClass] _mfst + + cdef void _check_mutating_imethod(self) except * + + cdef void _add_arc(self, int64 state, Arc arc) except * + + cpdef int64 add_state(self) except * + + cdef void _arcsort(self, sort_type=?) except * + + cdef void _closure(self, bool closure_plus=?) except * + + cdef void _concat(self, _Fst ifst) except * + + cdef void _connect(self) except * + + cdef void _decode(self, EncodeMapper) except * + + cdef void _delete_arcs(self, int64 state, size_t n=?) except * + + cdef void _delete_states(self, states=?) except * + + cdef void _encode(self, EncodeMapper) except * + + cdef void _invert(self) except * + + cdef void _minimize(self, float delta=?, bool allow_nondet=?) except * + + cpdef MutableArcIterator mutable_arcs(self, int64 state) + + cpdef int64 num_states(self) + + cdef void _project(self, bool project_output=?) except * + + cdef void _prune(self, float delta=?, int64 nstate=?, weight=?) except * + + cdef void _push(self, float delta=?, bool remove_total_weight=?, + bool to_final=?) except * + + cdef void _relabel_pairs(self, ipairs=?, opairs=?) except * + + cdef void _relabel_tables(self, _SymbolTable old_isymbols=?, + _SymbolTable new_isymbols=?, unknown_isymbol=?, + bool attach_new_isymbols=?, + _SymbolTable old_osymbols=?, _SymbolTable new_osymbols=?, + unknown_osymbol=?, bool attach_new_osymbols=?) except * + + cdef void _reserve_arcs(self, int64 state, size_t n) except * + + cdef void _reserve_states(self, int64 n) except * + + cdef void _reweight(self, potentials, bool to_final=?) except * + + cdef void _rmepsilon(self, queue_type=?, bool connect=?, weight=?, + int64 nstate=?, float delta=?) except * + + cdef void _set_final(self, int64 state, weight=?) except * + + cdef void _set_properties(self, uint64 props, uint64 mask) + + cdef void _set_start(self, int64 state) except * + + cdef void _set_input_symbols(self, _SymbolTable syms) except * + + cdef void _set_output_symbols(self, _SymbolTable syms) except * + + cdef void _topsort(self) except * + + cdef void _union(self, _Fst ifst) except * + + +# Construction helpers. + + +cdef _Fst _init_Fst(FstClass_ptr tfst) + +cdef _MutableFst _init_MutableFst(MutableFstClass_ptr tfst) + +cdef _Fst _init_XFst(FstClass_ptr tfst) + +cdef _MutableFst _create_Fst(arc_type=?) + +cpdef _Fst _read(filename) + +cpdef _Fst _read_Fst_from_string(state) + + +# Iterators. + + +cdef class Arc(object): + + cdef unique_ptr[fst.ArcClass] _arc + + cpdef Arc copy(self) + + +cdef Arc _init_Arc(const fst.ArcClass &arc) + + +cdef class ArcIterator(object): + + cdef shared_ptr[fst.FstClass] _fst + cdef unique_ptr[fst.ArcIteratorClass] _aiter + + cpdef bool done(self) + + cpdef uint32 flags(self) + + cpdef void next(self) + + cpdef size_t position(self) + + cpdef void reset(self) + + cpdef void seek(self, size_t a) + + cpdef void set_flags(self, uint32 flags, uint32 mask) + + cpdef object value(self) + + +cdef class MutableArcIterator(object): + + cdef shared_ptr[fst.MutableFstClass] _mfst + cdef unique_ptr[fst.MutableArcIteratorClass] _aiter + + cpdef bool done(self) + + cpdef uint32 flags(self) + + cpdef void next(self) + + cpdef size_t position(self) + + cpdef void reset(self) + + cpdef void seek(self, size_t a) + + cpdef void set_flags(self, uint32 flags, uint32 mask) + + cpdef void set_value(self, Arc arc) + + cpdef object value(self) + + +cdef class StateIterator(object): + + cdef shared_ptr[fst.FstClass] _fst + cdef unique_ptr[fst.StateIteratorClass] _siter + + cpdef bool done(self) + + cpdef void next(self) + + cpdef void reset(self) + + cpdef int64 value(self) + + +# Constructive operations on Fst. + + +cdef _Fst _map(_Fst ifst, float delta=?, map_type=?, double power=?, weight=?) + +cpdef _Fst arcmap(_Fst ifst, float delta=?, map_type=?, double power=?, + weight=?) + +cpdef _MutableFst compose(_Fst ifst1, _Fst ifst2, compose_filter=?, + bool connect=?) + +cpdef _Fst convert(_Fst ifst, fst_type=?) + +cpdef _MutableFst determinize(_Fst ifst, float delta=?, det_type=?, + int64 nstate=?, int64 subsequential_label=?, + weight=?, bool increment_subsequential_label=?) + +cpdef _MutableFst difference(_Fst ifst1, _Fst ifst2, compose_filter=?, + bool connect=?) + +cpdef _MutableFst disambiguate(_Fst ifst, float delta=?, int64 nstate=?, + int64 subsequential_label=?, weight=?) + +cpdef _MutableFst epsnormalize(_Fst ifst, bool eps_norm_output=?) + +cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=?) + +cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=?) except * + +cpdef _MutableFst intersect(_Fst ifst1, _Fst ifst2, compose_filter=?, + bool connect=?) + +cpdef bool isomorphic(_Fst ifst1, _Fst ifst2, float delta=?) + +cpdef _MutableFst prune(_Fst ifst, float delta=?, int64 nstate=?, + weight=?) + +cpdef _MutableFst push(_Fst ifst, float delta=?, bool push_weights=?, + bool push_labels=?, bool remove_common_affix=?, + bool remove_total_weight=?, bool to_final=?) + +cpdef bool randequivalent(_Fst ifst1, _Fst ifst2, int32 npath=?, + float delta=?, time_t seed=?, select=?, + int32 max_length=?) except * + +cpdef _MutableFst randgen(_Fst ifst, int32 npath=?, time_t seed=?, + select=?, int32 max_length=?, + bool remove_total_weight=?, bool weighted=?) + +cdef fst.ReplaceLabelType _get_replace_label_type(string rlt, + bool epsilon_on_replace) except * + +cpdef _MutableFst replace(pairs, call_arc_labeling=?, return_arc_labeling=?, + bool epsilon_on_replace=?, int64 return_label=?) + +cpdef _MutableFst reverse(_Fst ifst, bool require_superinitial=?) + +cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, float delta=?, + int64 nstate=?, queue_type=?, + bool reverse=?) except * + +cpdef _MutableFst shortestpath(_Fst ifst, float delta=?, int32 nshortest=?, + int64 nstate=?, queue_type=?, bool unique=?, + weight=?) + +cpdef _Fst statemap(_Fst ifst, map_type) + +cpdef _MutableFst synchronize(_Fst ifst) + + +# Compiler. + + +cdef class Compiler(object): + + cdef unique_ptr[stringstream] _sstrm + cdef string _fst_type + cdef string _arc_type + cdef const fst.SymbolTable *_isymbols + cdef const fst.SymbolTable *_osymbols + cdef const fst.SymbolTable *_ssymbols + cdef bool _acceptor + cdef bool _keep_isymbols + cdef bool _keep_osymbols + cdef bool _keep_state_numbering + cdef bool _allow_negative_labels + + cpdef _Fst compile(self) + + cpdef void write(self, expression) + + +# FarReader. + +cdef class FarReader(object): + + cdef unique_ptr[fst.FarReaderClass] _reader + + cpdef string arc_type(self) + + cpdef bool done(self) + + cpdef bool error(self) + + cpdef string far_type(self) + + cpdef bool find(self, key) except * + + cpdef _Fst get_fst(self) + + cpdef string get_key(self) + + cpdef void next(self) + + cpdef void reset(self) + + +# FarWriter. + +cdef class FarWriter(object): + + cdef unique_ptr[fst.FarWriterClass] _writer + + cpdef string arc_type(self) + + cdef void close(self) + + cpdef void add(self, key, _Fst ifst) except * + + cpdef bool error(self) + + cpdef string far_type(self) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.pyx b/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.pyx new file mode 100644 index 0000000..3d76714 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/python/pywrapfst.pyx @@ -0,0 +1,4533 @@ +#cython: nonecheck=True, c_string_type=unicode, c_string_encoding=utf8 +# See www.openfst.org for extensive documentation on this weighted +# finite-state transducer library. + + +"""Python interface to the FST scripting API. + +Operations which construct new FSTs are implemented as traditional functions, as +are two-argument boolean functions like `equal` and `equivalent`. Destructive +operations---those that mutate an FST, in place---are instance methods, as is +`write`. Operator overloading is not used. The following example, based on +Mohri et al. 2002, shows the construction of an ASR system given a pronunciation +lexicon L, grammar G, a transducer from context-dependent phones to +context-independent phones C, and an HMM set H: + + L = fst.Fst.read("L.fst") + G = fst.Fst.read("G.fst") + C = fst.Fst.read("C.fst") + H = fst.Fst.read("H.fst") + LG = fst.determinize(fst.compose(L, G)) + CLG = fst.determinize(fst.compose(C, LG)) + HCLG = fst.determinize(fst.compose(H, CLG)) + HCLG.minimize() # NB: works in-place. + +Python variables here use snake_case and constants are in all caps, minus the +normal `k` prefix. +""" + +# Overview of the file: +# +# * Imports +# * Custom exceptions +# * General helpers +# * Weight and helpers +# * _SymbolTable, _EncodeMapperSymbolTable, _FstSymbolTable, +# _MutableFstSymbolTable, SymbolTable, and helpers +# * SymbolTableIterator +# * EncodeMapper +# * _Fst, _MutableFst, Fst, and helpers +# * FST properties +# * Arc, ArcIterator, and MutableArcIterator +# * StateIterator +# * FST operations +# * Compiler +# * FarReader and FarWriter +# * Cleanup operations for module entrance and exit. +# +# TODO(kbg): Try breaking this apart into smaller pieces. +# +# A few of the more idiosyncratic choices made here are due to "impedance +# mismatches" between C++ and Python, as follows. +# +# Due to differences in C++ and Python scope rules, most C++ class instances +# have to be heap-allocated. Since all are packed into Python class instances, +# Python destructors are used to semi-automatically free C++ instances. +# +# Cython's type annotations (e.g., `string`) are used when the variables will +# be sent as arguments to C++ functions, but are not used for variables used +# within the module. + + +## Imports. + +# C imports. +from libc.stdint cimport INT32_MAX +from libc.stdint cimport SIZE_MAX +from posix.unistd cimport getpid + +# C++ imports. +from libcpp cimport bool +from libcpp.cast cimport const_cast +from libcpp.cast cimport static_cast + +# Our C++ imports. +from ios cimport ofstream +from memory cimport static_pointer_cast + +# Cython operator workarounds. +from cython.operator cimport address as addr # &foo +from cython.operator cimport dereference as deref # *foo +from cython.operator cimport preincrement as inc # ++foo + +# Python imports. +import numbers +import subprocess + +import logging + +# Google-only... +# This only works, and is only needed, inside of Colab. +try: + from colabtools import frontend + from colabtools import stubby + from google3.visualization.graphviz_server.proto import graphviz_server_pb2 +except ImportError: + pass +# ...Google-only. + + +## Custom exceptions. + + +class FstError(Exception): + + pass + + +class FstArgError(FstError, ValueError): + + pass + + +class FstBadWeightError(FstError, ValueError): + + pass + + +class FstDeletedConstructorError(FstError, RuntimeError): + + pass + + +class FstIndexError(FstError, IndexError): + + pass + + +class FstIOError(FstError, IOError): + + pass + + +class FstOpError(FstError, RuntimeError): + + pass + + +## General helpers. + + +cdef string tostring(data) except *: + """Converts strings to bytestrings. + + This function converts Python bytestrings and Unicode strings to bytestrings + encoded in UTF-8. It is used to process most Python string arguments before + passing them to the lower-level library. + + Args: + data: A Unicode string or bytestring. + + Returns: + A bytestring. + + Raises: + FstArgError: Cannot encode string. + UnicodeEncodeError. + + This function is not visible to Python users. + """ + # A Python bytestring can be implicitly cast to a C++ string. + if isinstance(data, bytes): + return data + elif isinstance(data, unicode): + return data.encode("utf8") + raise FstArgError("Cannot encode as string: {!r}".format(data)) + + +cdef string weight_tostring(data) except *: + """Converts strings or numerics to bytestrings. + + This function converts Python bytestrings, Unicode strings, and numerics + which can be cast to floats to bytestrings encoded in UTF-8. It is used to + process Python string arguments so they can be used to construct Weight + objects. In most cases, weights are underlyingly floating-point, but since + not all weights are, they can only be constructed using a string. + + Args: + data: A Unicode string, bytestring, or type which can be converted to a + Python float. + + Returns: + A bytestring. + + Raise: + FstArgError: Cannot encode string. + ValueError: Invalid literal for float. + UnicodeEncodeError. + + This function is not visible to Python users. + """ + # A Python bytestring can be implicitly cast to a C++ string. + if isinstance(data, bytes): + return data + elif isinstance(data, unicode): + return data.encode("utf8") + elif isinstance(data, numbers.Number): + return str(data).encode("utf8") + raise FstArgError("Cannot encode as string: {!r}".format(data)) + + +cdef fst.ComposeFilter _get_compose_filter( + const string &compose_filter) except *: + """Matches string with the appropriate ComposeFilter enum value. + + This function takes a string argument and returns the matching ComposeFilter + enum value used to initialize ComposeOptions instances. ComposeOptions is used + by difference and intersection in addition to composition. + + Args: + compose_filter: A string matching a known composition filter; one of: + "alt_sequence", "auto", "match", "no_match", "null", "sequence", + "trivial". + + Returns: + A ComposeFilter enum value. + + Raises: + FstArgError: Unknown compose filter type. + + This function is not visible to Python users. + """ + cdef fst.ComposeFilter compose_filter_enum + if not fst.GetComposeFilter(compose_filter, addr(compose_filter_enum)): + raise FstArgError("Unknown compose filter type: {!r}".format( + compose_filter)) + return compose_filter_enum + + +cdef fst.DeterminizeType _get_determinize_type(const string &det_type) except *: + """Matches string with the appropriate DeterminizeType enum value. + + Args: + det_type: A string matching a known determinization type; one of: + "functional", "nonfunctional", "disambiguate". + + Returns: + A DeterminizeType enum value. + + Raises: + FstArgError: Unknown determinization type. + + This function is not visible to Python users. + """ + cdef fst.DeterminizeType det_type_enum + if not fst.GetDeterminizeType(det_type, addr(det_type_enum)): + raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + return det_type_enum + + +cdef fst.QueueType _get_queue_type(const string &queue_type) except *: + """Matches string with the appropriate QueueType enum value. + + This function takes a string argument and returns the matching QueueType enum + value passed to the RmEpsilonOptions constructor. + + Args: + queue_type: A string matching a known queue type; one of: "auto", "fifo", + "lifo", "shortest", "state", "top". + + Returns: + A QueueType enum value. + + Raises: + FstArgError: Unknown queue type. + + This function is not visible to Python users. + """ + cdef fst.QueueType queue_type_enum + if not fst.GetQueueType(queue_type, addr(queue_type_enum)): + raise FstArgError("Unknown queue type: {!r}".format(queue_type)) + return queue_type_enum + + +cdef fst.RandArcSelection _get_rand_arc_selection( + const string &select) except *: + """Matches string with the appropriate RandArcSelection enum value. + + This function takes a string argument and returns the matching + RandArcSelection enum value passed to the RandGenOptions constructor. + + Args: + select: A string matching a known random arc selection type; one of: + "uniform", "log_prob", "fast_log_prob". + + Returns: + A RandArcSelection enum value. + + Raises: + FstArgError: Unknown random arc selection type. + + This function is not visible to Python users. + """ + cdef fst.RandArcSelection select_enum + if not fst.GetRandArcSelection(select, addr(select_enum)): + raise FstArgError("Unknown random arc selection type: {!r}".format(select)) + return select_enum + + +cdef fst.ReplaceLabelType _get_replace_label_type( + const string &replace_label_type, bool epsilon_on_replace) except *: + """Matches string with the appropriate ReplaceLabelType enum value. + + This function takes a string argument and returns the matching + ReplaceLabelType enum value passed to the ReplaceOptions constructor. + + Args: + replace_label_type: A string matching a known replace label type; one of: + "neither", "input", "output", "both". + epsilon_on_replace: Should call/return arcs be epsilon arcs? + + Returns: + A ReplaceLabelType enum value. + + Raises: + FstArgError: Unknown replace label type. + + This function is not visible to Python users. + """ + cdef fst.ReplaceLabelType replace_label_type_enum + if not fst.GetReplaceLabelType(replace_label_type, epsilon_on_replace, + addr(replace_label_type_enum)): + raise FstArgError("Unknown replace label type: {!r}".format( + replace_label_type)) + return replace_label_type_enum + + +## Weight and helpers. + + +cdef class Weight(object): + + """ + Weight(weight_type, weight_string) + + FST weight class. + + This class represents an FST weight. When passed as an argument to an FST + operation, it should have the weight type of the input FST(s) to said + operation. + + Args: + weight_type: A string indicating the weight type. + weight_string: A string indicating the underlying weight. + + Raises: + FstArgError: Weight type not found. + FstBadWeightError: Invalid weight. + """ + + def __repr__(self): + return "<{} Weight {} at 0x{:x}>".format(self.type(), self.to_string(), + id(self)) + + def __str__(self): + return self.to_string() + + # This attempts to convert the string form into a float, raising + # ValueError when that is not appropriate. + + def __float__(self): + return float(self.to_string()) + + def __init__(self, weight_type, weight): + self._weight.reset(new fst.WeightClass(tostring(weight_type), + weight_tostring(weight))) + self._check_weight() + + cdef void _check_weight(self) except *: + if self.type() == b"none": + raise FstArgError("Weight type not found") + if not self.member(): + raise FstBadWeightError("Invalid weight") + + cpdef Weight copy(self): + """ + copy(self) + + Returns a copy of the Weight. + """ + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass(deref(self._weight))) + return result + + # To get around the inability to declare cdef class methods, we define the + # C++ part out-of-class and then call it from within. + + @classmethod + def Zero(cls, weight_type): + """ + Weight.Zero(weight_type) + + Constructs semiring zero. + """ + return _Zero(weight_type) + + @classmethod + def One(cls, weight_type): + """ + Weight.One(weight_type) + + Constructs semiring One. + """ + return _One(weight_type) + + @classmethod + def NoWeight(cls, weight_type): + """ + Weight.NoWeight(weight_type) + + Constructs a non-member weight in the semiring. + """ + return _NoWeight(weight_type) + + def __eq__(Weight w1, Weight w2): + return fst.Eq(deref(w1._weight), deref(w2._weight)) + + def __ne__(Weight w1, Weight w2): + return not w1 == w2 + + cpdef string to_string(self): + return self._weight.get().ToString() + + cpdef string type(self): + """type(self) + + Returns a string indicating the weight type. + """ + return self._weight.get().Type() + + cpdef bool member(self): + return self._weight.get().Member() + + +cdef Weight _plus(Weight lhs, Weight rhs): + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass(fst.Plus(deref(lhs._weight), + deref(rhs._weight)))) + return result + + +def plus(Weight lhs, Weight rhs): + """ + plus(lhs, rhs) + + Computes the sum of two Weights in the same semiring. + + This function computes lhs \oplus rhs, raising an exception if lhs and rhs + are not in the same semiring. + + Args: + lhs: Left-hand side Weight. + rhs: Right-hand side Weight. + + Returns: + A Weight object. + + Raises: + FstArgError: Weight type not found (or not in same semiring). + FstBadWeightError: invalid weight. + """ + cdef Weight result = _plus(lhs, rhs) + result._check_weight() + return result + + +cdef Weight _times(Weight lhs, Weight rhs): + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass(fst.Times(deref(lhs._weight), + deref(rhs._weight)))) + return result + + +def times(Weight lhs, Weight rhs): + """ + times(lhs, rhs) + + Computes the product of two Weights in the same semiring. + + This function computes lhs \otimes rhs, raising an exception if lhs and rhs + are not in the same semiring. + + Args: + lhs: Left-hand side Weight. + rhs: Right-hand side Weight. + + Returns: + A Weight object. + + Raises: + FstArgError: Weight type not found (or not in same semiring). + FstBadWeightError: Invalid weight. + """ + cdef Weight result = _times(lhs, rhs) + result._check_weight() + return result + + +cdef Weight _divide(Weight lhs, Weight rhs): + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass(fst.Divide(deref(lhs._weight), + deref(rhs._weight)))) + return result + + +def divide(Weight lhs, Weight rhs): + """ + divide(lhs, rhs) + + Computes the quotient of two Weights in the same semiring. + + This function computes lhs \oslash rhs, raising an exception if lhs and rhs + are not in the same semiring. As there is no way to specify whether to use + left vs. right division, this assumes a commutative semiring in which these + are equivalent operations. + + Args: + lhs: Left-hand side Weight. + rhs: Right-hand side Weight. + + Returns: + A Weight object. + + Raises: + FstArgError: Weight type not found (or not in same semiring). + FstBadWeightError: Invalid weight. + """ + cdef Weight result = _divide(lhs, rhs) + result._check_weight() + return result + + +cdef Weight _power(Weight w, size_t n): + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass(fst.Power(deref(w._weight), n))) + return result + + +def power(Weight w, size_t n): + """ + power(lhs, rhs) + + Computes the iterated product of a weight. + + Args: + w: The weight. + n: The power. + + Returns: + A Weight object. + + Raises: + FstArgError: Weight type not found (or not in same semiring). + FstBadWeightError: Invalid weight. + """ + cdef Weight result = _power(w, n) + result._check_weight() + return result + + +cdef fst.WeightClass _get_WeightClass_or_Zero(const string &weight_type, + weight) except *: + """Converts weight string to a WeightClass. + + This function constructs a WeightClass instance of the desired weight type. + If the first argument is null, the weight is set to semiring Zero. + + Args: + weight_type: A string denoting the desired weight type. + weight: A object indicating the desired weight; if omitted, the weight is + set to semiring Zero. + + Returns: + A WeightClass object. + + This function is not visible to Python users. + """ + cdef fst.WeightClass result + if weight is None: + result = fst.WeightClass.Zero(weight_type) + elif isinstance(weight, Weight): + result = deref( ( weight)._weight.get()) + else: + result = fst.WeightClass(weight_type, weight_tostring(weight)) + if not result.Member(): + raise FstBadWeightError(weight_tostring(weight)) + return result + + +cdef fst.WeightClass _get_WeightClass_or_One(const string &weight_type, + weight) except *: + """Converts weight string to a WeightClass. + + This function constructs a WeightClass instance of the desired weight type. + If the first argument is null, the weight is set to semiring One. + + Args: + weight_type: A string denoting the desired weight type. + weight: A object indicating the desired weight; if omitted, the weight is + set to semiring One. + + Returns: + A WeightClass object. + + This function is not visible to Python users. + """ + cdef fst.WeightClass result + if weight is None: + result = fst.WeightClass.One(weight_type) + elif isinstance(weight, Weight): + result = deref( ( weight)._weight.get()) + else: + result = fst.WeightClass(weight_type, weight_tostring(weight)) + if not result.Member(): + raise FstBadWeightError(weight_tostring(weight)) + return result + + +cdef Weight _Zero(weight_type): + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass(fst.WeightClass.Zero( + tostring(weight_type)))) + if result._weight.get().Type() == b"none": + raise FstArgError("Weight type not found") + return result + + +cdef Weight _One(weight_type): + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass( + fst.WeightClass.One(tostring(weight_type)))) + if result._weight.get().Type() == b"none": + raise FstArgError("Weight type not found") + return result + + +cdef Weight _NoWeight(weight_type): + cdef Weight result = Weight.__new__(Weight) + result._weight.reset(new fst.WeightClass( + fst.WeightClass.NoWeight(tostring(weight_type)))) + return result + + +## _SymbolTable, _MutableSymbolTable, _EncodeMapperSymbolTable, _FstSymbolTable, +## _MutableFstSymbolTable, SymbolTable, and helpers. +# +# SymbolTable hierarchy: +# +# _SymbolTable: abstract base class; has-a SymbolTable* +# _EncodeMapperSymbolTable(_SymbolTable): constant symbol table returned by +# EncodeMapper.input_symbols/output_symbols +# _FstSymbolTable(_SymbolTable): constant symbol table returned by +# _Fst.input_symbols/output_symbols +# +# _MutableSymbolTable(_SymbolTable): abstract base class adding mutation methods +# _MutableFstSymbolTable(_MutableSymbolTable): mutable symbol table returned by +# _MutableFst.mutable_input_symbols/mutable_output_symbols +# SymbolTable(_MutableSymbolTable): adds constructor + + +cdef class _SymbolTable(object): + + """ + (No constructor.) + + Base class for the symbol table hierarchy. + + This class is the base class for SymbolTable. It has a "deleted" constructor + and implementations for the const methods of the wrapped SymbolTable. + """ + + # NB: Do not expose any non-const methods of the wrapped SymbolTable here. + # Doing so will allow undefined behavior. + + def __init__(self): + raise FstDeletedConstructorError( + "Cannot construct {}".format(self.__class__.__name__)) + + def __iter__(self): + return SymbolTableIterator(self) + + # Registers the class for pickling. + + def __reduce__(self): + return (_read_SymbolTable_from_string, (self.write_to_string(),)) + + cpdef int64 available_key(self): + """ + available_key(self) + + Returns an integer indicating the next available key index in the table. + """ + return self._table.AvailableKey() + + cpdef bytes checksum(self): + """ + checksum(self) + + Returns a bytestring indicating the label-independent MD5 checksum. + """ + return self._table.CheckSum() + + cpdef SymbolTable copy(self): + """ + copy(self) + + Returns a mutable copy of the SymbolTable. + """ + return _init_SymbolTable(self._table.Copy()) + + def find(self, key): + """ + find(self, key) + + Given a symbol or index, finds the other one. + + This method returns the index associated with a symbol key, or the symbol + associated with a index key. + + Args: + key: Either a string or an index. + + Returns: + If the key is a string, the associated index or NO_LABEL if not found; if + the key is an integer, the associated symbol or an empty string if + not found. + """ + try: + return self._table.FindIndex(tostring(key)) + except FstArgError: + return self._table.FindSymbol(key) + + cpdef int64 get_nth_key(self, ssize_t pos) except *: + """ + get_nth_key(self, pos) + + Retrieves the integer index of the n-th key in the table. + + Args: + pos: The n-th key to retrieve. + + Returns: + The integer index of the n-th key, or NO_LABEL if not found. + """ + return self._table.GetNthKey(pos) + + cpdef bytes labeled_checksum(self): + """ + labeled_checksum(self) + + Returns a bytestring indicating the label-dependent MD5 checksum. + """ + return self._table.LabeledCheckSum() + + cpdef bool member(self, key): + """ + member(self, key) + + Given a symbol or index, returns whether it is found in the table. + + This method returns a boolean indicating whether the given symbol or index + is present in the table. If one intends to perform subsequent lookup, it is + better to simply call the find method, catching the KeyError. + + Args: + key: Either a string or an index. + + Returns: + Whether or not the key is present (as a string or a index) in the table. + """ + try: + return self._table.MemberSymbol(tostring(key)) + except FstArgError: + return self._table.MemberIndex(key) + + def __contains__(self, key): + return self.member(key) + + cpdef string name(self): + """ + name(self) + + Returns the symbol table's name. + """ + return self._table.Name() + + cpdef size_t num_symbols(self): + """ + num_symbols(self) + + Returns the number of symbols in the symbol table. + """ + return self._table.NumSymbols() + + cpdef void write(self, filename) except *: + """ + write(self, filename) + + Serializes symbol table to a file. + + This methods writes the SymbolTable to a file in binary format. + + Args: + filename: The string location of the output file. + + Raises: + FstIOError: Write failed. + """ + if not self._table.Write(tostring(filename)): + raise FstIOError("Write failed: {!r}".format(filename)) + + cpdef void write_text(self, filename) except *: + """ + write_text(self, filename) + + Writes symbol table to text file. + + This method writes the SymbolTable to a file in human-readable format. + + Args: + filename: The string location of the output file. + + Raises: + FstIOError: Write failed. + """ + if not self._table.WriteText(tostring(filename)): + raise FstIOError("Write failed: {!r}".format(filename)) + + cpdef bytes write_to_string(self): + """ + write_to_string(self) + + Serializes SymbolTable to a string. + + Returns: + A bytestring. + + Raises: + FstIOError: Write to string failed. + + See also: `read_from_string`. + """ + cdef stringstream sstrm + if not self._table.Write(sstrm): + raise FstIOError("Write to string failed") + return sstrm.str() + + +cdef class _EncodeMapperSymbolTable(_SymbolTable): + + """ + (No constructor.) + + Immutable SymbolTable class for tables stored in an EncodeMapper. + + This class wraps a library const SymbolTable and exposes const methods of the + wrapped object. It is only to be returned by method, never constructed + directly. + """ + + # NB: Do not expose any non-const methods of the wrapped SymbolTable here. + # Doing so will allow undefined behavior. + + def __repr__(self): + return "".format(self.name(), + id(self)) + + +cdef class _FstSymbolTable(_SymbolTable): + + """ + (No constructor.) + + Mutable SymbolTable class for tables stored in a mutable FST. + + This class wraps a library SymbolTable and exposes methods of the wrapped + object. It is only to be returned by method, never constructed directly. + """ + + # NB: Do not expose any non-const methods of the wrapped SymbolTable here. + # Doing so will allow undefined behavior. + + def __repr__(self): + return "".format(self.name(), + id(self)) + + +cdef class _MutableSymbolTable(_SymbolTable): + + """ + (No constructor.) + + Base class for mutable symbol tables. + + This class is the base class for a mutable SymbolTable. It has a "deleted" + constructor and implementations of all methods of the wrapped SymbolTable. + """ + + cpdef int64 add_symbol(self, symbol, int64 key=fst.kNoSymbol): + """ + add_symbol(self, symbol, key=NO_SYMBOL) + + Adds a symbol to the table and returns the index. + + This method adds a symbol to the table. The caller can optionally + specify a non-negative integer index for the key. + + Args: + symbol: A symbol string. + key: An index for the symbol; if not specified, the next index will be + used. + + Returns: + The integer key of the new symbol. + """ + cdef string symbol_string = tostring(symbol) + if key != fst.kNoSymbol: + return self._table.AddSymbol(symbol_string, key) + else: + return self._table.AddSymbol(symbol_string) + + cpdef void add_table(self, _SymbolTable syms): + """ + add_table(self, syms) + + Adds another SymbolTable to this table. + + This method merges another symbol table into the current table. All key + values will be offset by the current available key. + + Args: + syms: A SymbolTable to be merged with the current table. + """ + self._table.AddTable(deref(syms._table)) + + cpdef void set_name(self, new_name) except *: + self._table.SetName(tostring(new_name)) + + +cdef class _MutableFstSymbolTable(_MutableSymbolTable): + """ + (No constructor.) + + Mutable SymbolTable assigned to an FST. + """ + + def __repr__(self): + return "".format(self.name(), id(self)) + + +cdef class SymbolTable(_MutableSymbolTable): + + """ + SymbolTable(name="") + + Mutable SymbolTable class. + + This class wraps the library SymbolTable and exposes both const (i.e., + access) and non-const (i.e., mutation) methods of wrapped object. + + Unlike other classes in the hierarchy, it has a working constructor and can be + used to programmatically construct a SymbolTable in memory. + + Args: + name: An optional string indicating the table's name. + """ + + def __repr__(self): + return "".format(self.name(), id(self)) + + def __init__(self, name=""): + self._table = new fst.SymbolTable(tostring(name)) + self._smart_table.reset(self._table) + + @classmethod + def read(cls, filename): + """ + SymbolTable.read(filename) + + Reads symbol table from binary file. + + This class method creates a new SymbolTable from a symbol table binary file. + + Args: + filename: The string location of the input binary file. + + Returns: + A new SymbolTable instance. + + See also: `SymbolTable.read_fst`, `SymbolTable.read_text`. + """ + cdef unique_ptr[fst.SymbolTable] syms + syms.reset(fst.SymbolTable.Read(tostring(filename))) + if syms.get() == NULL: + raise FstIOError("Read failed: {!r}".format(filename)) + return _init_SymbolTable(syms.release()) + + @classmethod + def read_text(cls, filename, bool allow_negative_labels=False): + """ + SymbolTable.read_text(filename) + + Reads symbol table from text file. + + This class method creates a new SymbolTable from a symbol table text file. + + Args: + filename: The string location of the input text file. + allow_negative_labels: Should negative labels be allowed? (Not + recommended; may cause conflicts). + + Returns: + A new SymbolTable instance. + + See also: `SymbolTable.read`, `SymbolTable.read_fst`. + """ + cdef unique_ptr[fst.SymbolTableTextOptions] opts + opts.reset(new fst.SymbolTableTextOptions(allow_negative_labels)) + cdef unique_ptr[fst.SymbolTable] syms + syms.reset(fst.SymbolTable.ReadText(tostring(filename), deref(opts))) + if syms.get() == NULL: + raise FstIOError("Read failed: {!r}".format(filename)) + return _init_SymbolTable(syms.release()) + + @classmethod + def read_fst(cls, filename, bool input_table): + """ + SymbolTable.read_fst(filename, input_table) + + Reads symbol table from an FST file without loading the corresponding FST. + + This class method creates a new SymbolTable by reading either the input or + output symbol table from an FST file, without loading the corresponding FST. + + Args: + filename: The string location of the input FST file. + input_table: Should the input table be read (True) or the output table + (False)? + + Returns: + A new SymbolTable instance, or None if none can be read. + + Raises: + FstIOError: Read failed. + + See also: `SymbolTable.read`, `SymbolTable.read_text`. + """ + cdef unique_ptr[fst.SymbolTable] syms + syms.reset(fst.FstReadSymbols(tostring(filename), input_table)) + if syms.get() == NULL: + raise FstIOError("Read failed: {!r}".format(filename)) + return _init_SymbolTable(syms.release()) + + +cdef _EncodeMapperSymbolTable _init_EncodeMapperSymbolTable( + fst.SymbolTable *table, shared_ptr[fst.EncodeMapperClass] encoder): + cdef _EncodeMapperSymbolTable result = ( + _EncodeMapperSymbolTable.__new__(_EncodeMapperSymbolTable)) + result._table = table + result._encoder = encoder + return result + + +cdef _FstSymbolTable _init_FstSymbolTable(fst.SymbolTable *table, + shared_ptr[fst.FstClass] ifst): + cdef _FstSymbolTable result = _FstSymbolTable.__new__(_FstSymbolTable) + result._table = table + result._fst = ifst + return result + + +cdef _MutableFstSymbolTable _init_MutableFstSymbolTable(fst.SymbolTable *table, + shared_ptr[fst.MutableFstClass] ifst): + cdef _MutableFstSymbolTable result = ( + _MutableFstSymbolTable.__new__(_MutableFstSymbolTable)) + result._table = table + result._mfst = ifst + return result + + +cdef SymbolTable _init_SymbolTable(fst.SymbolTable *table): + cdef SymbolTable result = SymbolTable.__new__(SymbolTable) + result._table = table + return result + + +cpdef SymbolTable _read_SymbolTable_from_string(state): + cdef stringstream sstrm + sstrm << tostring(state) + cdef unique_ptr[fst.SymbolTable] syms + syms.reset(fst.SymbolTable.ReadStream(sstrm, b"")) + if syms.get() == NULL: + raise FstIOError("Read failed") + return _init_SymbolTable(syms.release()) + + +# Constructive SymbolTable operations. + + +cpdef SymbolTable compact_symbol_table(_SymbolTable syms): + """ + compact_symbol_table(syms) + + Constructively relabels a SymbolTable to make it a contiguous mapping. + + Args: + syms: Input SymbolTable. + + Returns: + A new compacted SymbolTable. + """ + return _init_SymbolTable(fst.CompactSymbolTable(deref(syms._table))) + + +cpdef SymbolTable merge_symbol_table(_SymbolTable lhs, _SymbolTable rhs): + """ + merge_symbol_table(lhs, rhs) + + Merges all symbols from the left table into the right. + + This function creates a new SymbolTable which is the merger of the two input + symbol Tables. Symbols in the right-hand table that conflict with those in the + left-hand table will be assigned values from the left-hand table. Thus the + returned table will never modify symbol assignments from the left-hand side, + but may do so on the right. + + If the left-hand table is associated with an FST, it may be necessary to + relabel it using the output table. + + Args: + lhs: Left-hand side SymbolTable. + rhs: Left-hand side SymbolTable. + + Returns: + A new merged SymbolTable. + + See also: `relabel_symbols`. + """ + return _init_SymbolTable(fst.MergeSymbolTable(deref(lhs._table), + deref(rhs._table), NULL)) + + +## SymbolTableIterator. + + +cdef class SymbolTableIterator(object): + + """ + SymbolTableIterator(syms) + + This class is used for iterating over a symbol table. + """ + + def __repr__(self): + return "".format(id(self)) + + def __init__(self, _SymbolTable syms): + self._siter.reset(new fst.SymbolTableIterator(deref(syms._table))) + + # This just registers this class as a possible iterator. + def __iter__(self): + return self + + # Magic method used to get a Pythonic API out of the C++ API. + def __next__(self): + if self.done(): + raise StopIteration + cdef int64 value = self.value() + cdef string symbol = self.symbol() + self.next() + return (value, symbol) + + cpdef bool done(self): + """ + done(self) + + Indicates whether the iterator is exhausted or not. + + Returns: + True if the iterator is exhausted, False otherwise. + """ + return self._siter.get().Done() + + cpdef void next(self): + """ + next(self) + + Advances the iterator. + """ + self._siter.get().Next() + + cpdef void reset(self): + """ + reset(self) + + Resets the iterator to the initial position. + """ + self._siter.get().Reset() + + cpdef string symbol(self): + """ + symbol(self) + + Returns the current symbol string. + + This method returns the current symbol string at this point in the table. + + Returns: + A symbol string. + """ + return self._siter.get().Symbol() + + cpdef int64 value(self): + """ + value(self) + + Returns the current integer index of the symbol. + + Returns: + An integer index. + """ + return self._siter.get().Value() + + +## EncodeMapper. + + +cdef class EncodeMapper(object): + + """ + EncodeMapper(arc_type="standard", encode_labels=False, encode_weights=False) + + Arc encoder class, wrapping EncodeMapperClass. + + This class provides an object which can be used to encode or decode FST arcs. + This is most useful to convert an FST to an unweighted acceptor, on which + some FST operations are more efficient, and then decoding the FST afterwards. + + To use an instance of this class to encode or decode a mutable FST, pass it + as the first argument to the FST instance methods `encode` and `decode`. + + For implementational reasons, it is not currently possible to use an encoder + on disk to construct this class. + + Args: + arc_type: A string indicating the arc type. + encode_labels: Should labels be encoded? + encode_weights: Should weights be encoded? + """ + + def __repr__(self): + return "".format(id(self)) + + def __init__(self, + arc_type=b"standard", + bool encode_labels=False, + bool encode_weights=False): + cdef uint32 flags = fst.GetEncodeFlags(encode_labels, encode_weights) + self._encoder.reset(new fst.EncodeMapperClass(tostring(arc_type), flags, + fst.ENCODE)) + if not self._encoder: + raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + + cpdef string arc_type(self): + """ + arc_type(self) + + Returns a string indicating the arc type. + """ + return self._encoder.get().ArcType() + + # Python's equivalent to operator(). + + def __call__(self, Arc arc): + """ + self(state, ilabel, olabel, weight, nextstate) + + Uses the encoder to encode an arc. + + Args: + ilabel: The integer index of the input label. + olabel: The integer index of the output label. + weight: A Weight or weight string indicating the desired final weight; if + null, it is set to semiring One. + nextstate: The integer index of the destination state. + + Raises: + FstOpError: Incompatible or invalid weight. + """ + return _init_Arc(self._encoder.get().__call__(deref(arc._arc))) + + cpdef uint32 flags(self): + """ + flags(self) + + Returns the encoder's flags. + """ + return self._encoder.get().Flags() + + cpdef _EncodeMapperSymbolTable input_symbols(self): + """ + input_symbols(self) + + Returns the encoder's input symbol table, or None if none is present. + """ + cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + self._encoder.get().InputSymbols()) + if syms == NULL: + return + return _init_EncodeMapperSymbolTable(syms, self._encoder) + + cpdef _EncodeMapperSymbolTable output_symbols(self): + """ + output_symbols(self) + + Returns the encoder's output symbol table, or None if none is present. + """ + cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + self._encoder.get().OutputSymbols()) + if syms == NULL: + return + return _init_EncodeMapperSymbolTable(syms, self._encoder) + + cpdef uint64 properties(self, uint64 mask): + """ + properties(self, mask) + + Provides property bits. + + This method provides user access to the properties of the encoder. + + Args: + mask: The property mask to be compared to the encoder's properties. + + Returns: + A 64-bit bitmask representing the requested properties. + """ + return self._encoder.get().Properties(mask) + + cpdef void set_input_symbols(self, _SymbolTable syms) except *: + """ + set_input_symbols(self, syms) + + Sets the encoder's input symbol table. + + Args: + syms: A SymbolTable. + + See also: `set_output_symbols`. + """ + self._encoder.get().SetInputSymbols(syms._table) + + cpdef void set_output_symbols(self, _SymbolTable syms) except *: + """ + set_output_symbols(self, syms) + + Sets the encoder's output symbol table. + + Args: + syms: A SymbolTable. + + See also: `set_input_symbols`. + """ + self._encoder.get().SetOutputSymbols(syms._table) + + cpdef string weight_type(self): + """ + weight_type(self) + + Returns a string indicating the weight type. + """ + return self._encoder.get().WeightType() + + +## _Fst, _MutableFst, Fst, and helpers. +# +# Fst hierarchy: +# +# _Fst: base class; has-a FstClass*. +# _MutableFst(_Fst): adds mutable methods. +# Fst(filename): pseudo-constructor. + + +cdef class _Fst(object): + + """ + (No constructor.) + + Immutable FST class, wrapping FstClass. + + This class is the basic user-facing FST object. It does not itself support any + mutation operations. + """ + + # IPython notebook magic to produce an SVG of the FST. + + # Google-only... + @staticmethod + cdef string _server_render_svg(const string &dot): + # Creates request. + request = graphviz_server_pb2.RenderRequest() + request.graph.dot = dot + request.return_bytes = True + # Makes request and returns SVG rendering. + response = stubby.Call("blade:graphviz-server", + "RenderServer.Render", + request) + return response.rendered_graph.rendered_bytes + # ...Google-only. + + @staticmethod + cdef string _local_render_svg(const string &dot): + proc = subprocess.Popen(("dot", "-Tsvg"), + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + return proc.communicate(dot.encode("utf8"))[0] + + def _repr_svg_(self): + """IPython notebook magic to produce an SVG of the FST using GraphViz. + + This method produces an SVG of the internal graph. Users wishing to create + publication-quality graphs should instead use the method `draw`, which + exposes additional parameters. + + See also: `draw`, `text`. + """ + cdef stringstream sstrm + cdef bool acceptor = (self._fst.get().Properties(fst.kAcceptor, True) == + fst.kAcceptor) + fst.DrawFst(deref(self._fst), self._fst.get().InputSymbols(), + self._fst.get().OutputSymbols(), NULL, acceptor, + b"", 8.5, 11, True, False, 0.4, 0.25, 14, 5, b"g", False, + addr(sstrm), b"") + # Google-only... + try: + return _Fst._server_render_svg(sstrm.str()) + except Exception as e: + frontend.DisplayToast("GraphViz server request failed: " + str(e)) + logging.error("Graphviz server requested failed: %s", e) + # ...Google-only. + try: + return _Fst._local_render_svg(sstrm.str()) + except Exception as e: + logging.error("Dot rendering failed: %s", e) + + def __init__(self): + raise FstDeletedConstructorError( + "Cannot construct {}".format(self.__class__.__name__)) + + # Registers the class for pickling; must be repeated in any subclass which + # can't be derived by _init_XFst. + + def __reduce__(self): + return (_read_Fst_from_string, (self.write_to_string(),)) + + def __repr__(self): + return "<{} Fst at 0x{:x}>".format(self.fst_type(), id(self)) + + def __str__(self): + return self.text() + + cpdef string arc_type(self): + """ + arc_type(self) + + Returns a string indicating the arc type. + """ + return self._fst.get().ArcType() + + cpdef ArcIterator arcs(self, int64 state): + """ + arcs(self, state) + + Returns an iterator over arcs leaving the specified state. + + Args: + state: The source state ID. + + Returns: + An ArcIterator. + + See also: `mutable_arcs`, `states`. + """ + return ArcIterator(self, state) + + cpdef _Fst copy(self): + """ + copy(self) + + Makes a copy of the FST. + """ + return _init_XFst(new fst.FstClass(deref(self._fst))) + + cpdef void draw(self, + filename, + _SymbolTable isymbols=None, + _SymbolTable osymbols=None, + SymbolTable ssymbols=None, + bool acceptor=False, + title=b"", + double width=8.5, + double height=11, + bool portrait=False, + bool vertical=False, + double ranksep=0.4, + double nodesep=0.25, + int32 fontsize=14, + int32 precision=5, + float_format=b"g", + bool show_weight_one=False): + """ + draw(self, filename, isymbols=None, osymbols=None, ssymbols=None, + acceptor=False, title="", width=8.5, height=11, portrait=False, + vertical=False, ranksep=0.4, nodesep=0.25, fontsize=14, + precision=5, float_format="g", show_weight_one=False): + + Writes out the FST in Graphviz text format. + + This method writes out the FST in the dot graph description language. The + graph can be rendered using the `dot` executable provided by Graphviz. + + Args: + filename: The string location of the output dot/Graphviz file. + isymbols: An optional symbol table used to label input symbols. + osymbols: An optional symbol table used to label output symbols. + ssymbols: An optional symbol table used to label states. + acceptor: Should the figure be rendered in acceptor format if possible? + title: An optional string indicating the figure title. + width: The figure width, in inches. + height: The figure height, in inches. + portrait: Should the figure be rendered in portrait rather than + landscape? + vertical: Should the figure be rendered bottom-to-top rather than + left-to-right? + ranksep: The minimum separation separation between ranks, in inches. + nodesep: The minimum separation between nodes, in inches. + fontsize: Font size, in points. + precision: Numeric precision for floats, in number of chars. + float_format: One of: 'e', 'f' or 'g'. + show_weight_one: Should weights equivalent to semiring One be printed? + + See also: `text`. + """ + cdef string filename_string = tostring(filename) + cdef unique_ptr[ofstream] ostrm + ostrm.reset(new ofstream(filename_string)) + cdef fst.SymbolTable *ssymbols_ptr = NULL + if ssymbols is not None: + ssymbols_ptr = ssymbols._table + fst.DrawFst(deref(self._fst), + self._fst.get().InputSymbols() if isymbols is None + else isymbols._table, + self._fst.get().OutputSymbols() if osymbols is None + else osymbols._table, + ssymbols_ptr, acceptor, tostring(title), width, height, portrait, + vertical, ranksep, nodesep, fontsize, precision, + tostring(float_format), show_weight_one, ostrm.get(), + filename_string) + + cpdef Weight final(self, int64 state): + """ + final(self, state) + + Returns the final weight of a state. + + Args: + state: The integer index of a state. + + Returns: + The final Weight of that state. + + Raises: + FstIndexError: State index out of range. + """ + cdef Weight weight = Weight.__new__(Weight) + weight._weight.reset(new fst.WeightClass(self._fst.get().Final(state))) + if not weight.member(): + raise FstIndexError("State index out of range") + return weight + + cpdef string fst_type(self): + """ + fst_type(self) + + Returns a string indicating the FST type. + """ + return self._fst.get().FstType() + + cpdef _FstSymbolTable input_symbols(self): + """ + input_symbols(self) + + Returns the FST's input symbol table, or None if none is present. + + See also: `input_symbols`. + """ + cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + self._fst.get().InputSymbols()) + if syms == NULL: + return + return _init_FstSymbolTable(syms, self._fst) + + cpdef size_t num_arcs(self, int64 state) except *: + """ + num_arcs(self, state) + + Returns the number of arcs leaving a state. + + Args: + state: The integer index of a state. + + Returns: + The number of arcs leaving that state. + + Raises: + FstIndexError: State index out of range. + + See also: `num_states`. + """ + cdef size_t result = self._fst.get().NumArcs(state) + if result == SIZE_MAX: + raise FstIndexError("State index out of range") + return result + + cpdef size_t num_input_epsilons(self, int64 state) except *: + """ + num_input_epsilons(self, state) + + Returns the number of arcs with epsilon input labels leaving a state. + + Args: + state: The integer index of a state. + + Returns: + The number of epsilon-input-labeled arcs leaving that state. + + Raises: + FstIndexError: State index out of range. + + See also: `num_output_epsilons`. + """ + cdef size_t result = self._fst.get().NumInputEpsilons(state) + if result == SIZE_MAX: + raise FstIndexError("State index out of range") + return result + + cpdef size_t num_output_epsilons(self, int64 state) except *: + """ + num_output_epsilons(self, state) + + Returns the number of arcs with epsilon output labels leaving a state. + + Args: + state: The integer index of a state. + + Returns: + The number of epsilon-output-labeled arcs leaving that state. + + Raises: + FstIndexError: State index out of range. + + See also: `num_input_epsilons`. + """ + cdef size_t result = self._fst.get().NumOutputEpsilons(state) + if result == SIZE_MAX: + raise FstIndexError("State index out of range") + return result + + cpdef _FstSymbolTable output_symbols(self): + """ + output_symbols(self) + + Returns the FST's output symbol table, or None if none is present. + + See also: `input_symbols`. + """ + cdef fst.SymbolTable *syms = const_cast[SymbolTable_ptr]( + self._fst.get().OutputSymbols()) + if syms == NULL: + return + return _init_FstSymbolTable(syms, self._fst) + + cpdef uint64 properties(self, uint64 mask, bool test): + """ + properties(self, mask, test) + + Provides property bits. + + This method provides user access to the properties attributes for the FST. + The resulting value is a long integer, but when it is cast to a boolean, + it represents whether or not the FST has the `mask` property. + + Args: + mask: The property mask to be compared to the FST's properties. + test: Should any unknown values be computed before comparing against + the mask? + + Returns: + A 64-bit bitmask representing the requested properties. + """ + return self._fst.get().Properties(mask, test) + + cpdef int64 start(self): + """ + start(self) + + Returns the start state. + """ + return self._fst.get().Start() + + cpdef StateIterator states(self): + """ + states(self) + + Returns an iterator over all states in the FST. + + Returns: + A StateIterator object for the FST. + + See also: `arcs`, `mutable_arcs`. + """ + return StateIterator(self) + + cpdef string text(self, _SymbolTable isymbols=None, + _SymbolTable osymbols=None, _SymbolTable ssymbols=None, + bool acceptor=False, bool show_weight_one=False, missing_sym=b""): + """ + text(self, isymbols=None, osymbols=None, ssymbols=None, acceptor=False, + show_weight_one=False, missing_sym="") + + Produces a human-readable string representation of the FST. + + This method generates a human-readable string representation of the FST. + The caller may optionally specify SymbolTables used to label input labels, + output labels, or state labels, respectively. + + Args: + isymbols: An optional symbol table used to label input symbols. + osymbols: An optional symbol table used to label output symbols. + ssymbols: An optional symbol table used to label states. + acceptor: Should the FST be rendered in acceptor format if possible? + show_weight_one: Should weights equivalent to semiring One be printed? + missing_symbol: The string to be printed when symbol table lookup fails. + + Returns: + A formatted string representing the machine. + """ + # Prints FST to stringstream, then returns resulting string. + cdef fst.SymbolTable *ssymbols_ptr = NULL + if ssymbols is not None: + ssymbols_ptr = ssymbols._table + cdef stringstream sstrm + fst.PrintFst(deref(self._fst), sstrm, b"", + self._fst.get().InputSymbols() if isymbols is None + else isymbols._table, + self._fst.get().OutputSymbols() if osymbols is None + else osymbols._table, + ssymbols_ptr, acceptor, show_weight_one, tostring(missing_sym)) + return sstrm.str() + + cpdef bool verify(self): + """ + verify(self) + + Verifies that an FST's contents are sane. + + Returns: + True if the contents are sane, False otherwise. + """ + return fst.Verify(deref(self._fst)) + + cpdef string weight_type(self): + """ + weight_type(self) + + Provides the FST's weight type. + + Returns: + A string representing the weight type. + """ + return self._fst.get().WeightType() + + cpdef void write(self, filename) except *: + """ + write(self, filename) + + Serializes FST to a file. + + This method writes the FST to a file in a binary format. + + Args: + filename: The string location of the output file. + + Raises: + FstIOError: Write failed. + """ + if not self._fst.get().Write(tostring(filename)): + raise FstIOError("Write failed: {!r}".format(filename)) + + cpdef bytes write_to_string(self): + """ + write_to_string(self) + + Serializes FST to a string. + + Returns: + A bytestring. + + Raises: + FstIOError: Write to string failed. + + See also: `read_from_string`. + """ + cdef stringstream sstrm + if not self._fst.get().Write(sstrm, b""): + raise FstIOError("Write to string failed") + return sstrm.str() + + +cdef class _MutableFst(_Fst): + + """ + (No constructor.) + + Mutable FST class, wrapping MutableFstClass. + + This class extends _Fst by adding mutation operations. + """ + + cdef void _check_mutating_imethod(self) except *: + """Checks whether an operation mutating the FST has produced an error. + + This function is not visible to Python users. + """ + if self._fst.get().Properties(fst.kError, True) == fst.kError: + raise FstOpError("Operation failed") + + cdef void _add_arc(self, int64 state, Arc arc) except *: + if not self._fst.get().ValidStateId(state): + raise FstIndexError("State index out of range") + if not self._mfst.get().AddArc(state, deref(arc._arc)): + raise FstOpError("Incompatible or invalid weight type") + self._check_mutating_imethod() + + def add_arc(self, int64 state, Arc arc): + """ + add_arc(self, state, arc) + + Adds a new arc to the FST and return self. + + Args: + state: The integer index of the source state. + arc: The arc to add. + + Returns: + self. + + Raises: + FstIndexError: State index out of range. + FstOpdexError: Incompatible or invalid weight type. + + See also: `add_state`. + """ + self._add_arc(state, arc) + return self + + cpdef int64 add_state(self) except *: + """ + add_state(self) + + Adds a new state to the FST and returns the state ID. + + Returns: + The integer index of the new state. + + See also: `add_arc`, `set_start`, `set_final`. + """ + cdef int64 result = self._mfst.get().AddState() + self._check_mutating_imethod() + return result + + cdef void _arcsort(self, sort_type=b"ilabel") except *: + cdef fst.ArcSortType sort_type_enum + if not fst.GetArcSortType(tostring(sort_type), addr(sort_type_enum)): + raise FstArgError("Unknown sort type {!r}".format(sort_type)) + fst.ArcSort(self._mfst.get(), sort_type_enum) + self._check_mutating_imethod() + + def arcsort(self, sort_type=b"ilabel"): + """ + arcsort(self, sort_type="ilabel") + + Sorts arcs leaving each state of the FST. + + This operation destructively sorts arcs leaving each state using either + input or output labels. + + Args: + sort_type: Either "ilabel" (sort arcs according to input labels) or + "olabel" (sort arcs according to output labels). + + Returns: + self. + + Raises: + FstArgError: Unknown sort type. + """ + self._arcsort(sort_type) + return self + + cdef void _closure(self, bool closure_plus=False) except *: + fst.Closure(self._mfst.get(), fst.GetClosureType(closure_plus)) + self._check_mutating_imethod() + + def closure(self, bool closure_plus=False): + """ + closure(self, closure_plus=False) + + Computes concatenative closure. + + This operation destructively converts the FST to its concatenative closure. + If A transduces string x to y with weight a, then the closure transduces x + to y with weight a, xx to yy with weight a \otimes a, xxx to yyy with weight + a \otimes a \otimes a, and so on. The empty string is also transduced to + itself with semiring One if `closure_plus` is False. + + Args: + closure_plus: If False, do not accept the empty string. + + Returns: + self. + """ + self._closure(closure_plus) + return self + + cdef void _concat(self, _Fst ifst) except *: + fst.Concat(self._mfst.get(), deref(ifst._fst)) + self._check_mutating_imethod() + + def concat(self, _Fst ifst): + """ + concat(self, ifst) + + Computes the concatenation (product) of two FSTs. + + This operation destructively concatenates the FST with a second FST. If A + transduces string x to y with weight a and B transduces string w to v with + weight b, then their concatenation transduces string xw to yv with weight a + \otimes b. + + Args: + ifst: The second input FST. + + Returns: + self. + """ + self._concat(ifst) + return self + + cdef void _connect(self) except *: + fst.Connect(self._mfst.get()) + self._check_mutating_imethod() + + def connect(self): + """ + connect(self) + + Removes unsuccessful paths. + + This operation destructively trims the FST, removing states and arcs that + are not part of any successful path. + + Returns: + self. + """ + self._connect() + return self + + cdef void _decode(self, EncodeMapper encoder) except *: + fst.Decode(self._mfst.get(), deref(encoder._encoder)) + self._check_mutating_imethod() + + def decode(self, EncodeMapper encoder): + """ + decode(self, encoder) + + Decodes encoded labels and/or weights. + + This operation reverses the encoding performed by `encode`. + + Args: + encoder: An EncodeMapper object used to encode the FST. + + Returns: + self. + + See also: `encode`. + """ + self._decode(encoder) + return self + + cdef void _delete_arcs(self, int64 state, size_t n=0) except *: + if not (self._mfst.get().DeleteArcs(state, n) if n else + self._mfst.get().DeleteArcs(state)): + raise FstIndexError("State index out of range") + self._check_mutating_imethod() + + def delete_arcs(self, int64 state, size_t n=0): + """ + delete_arcs(self, state, n=0) + + Deletes arcs leaving a particular state. + + Args: + state: The integer index of a state. + n: An optional argument indicating how many arcs to be deleted. If this + argument is omitted or passed as zero, all arcs from this state are + deleted. + + Returns: + self. + + Raises: + FstIndexError: State index out of range. + + See also: `delete_states`. + """ + self._delete_arcs(state, n) + return self + + cdef void _delete_states(self, states=None) except *: + # Only the former signature has a possible indexing failure. + if states: + if not self._mfst.get().DeleteStates( states): + raise FstIndexError("State index out of range") + else: + self._mfst.get().DeleteStates() + self._check_mutating_imethod() + + def delete_states(self, states=None): + """ + delete_states(self, states=None) + + Deletes states. + + Args: + states: An optional iterable of integer indices of the states to be + deleted. If this argument is omitted, all states are deleted. + + Returns: + self. + + Raises: + FstIndexError: State index out of range. + + See also: `delete_arcs`. + """ + self._delete_states(states) + return self + + cdef void _encode(self, EncodeMapper encoder) except *: + fst.Encode(self._mfst.get(), encoder._encoder.get()) + self._check_mutating_imethod() + + def encode(self, EncodeMapper encoder): + """ + encode(self, encoder) + + Encodes labels and/or weights. + + This operation allows for the representation of a weighted transducer as a + weighted acceptor, an unweighted transducer, or an unweighted acceptor by + considering the pair (input label, output label), the pair (input label, + weight), or the triple (input label, output label, weight) as a single + label. Applying this operation mutates the EncodeMapper argument, which + can then be used to decode. + + Args: + encoder: An EncodeMapper object to be used as the encoder. + + Returns: + self. + + See also: `decode`. + """ + self._encode(encoder) + return self + + cdef void _invert(self) except *: + fst.Invert(self._mfst.get()) + self._check_mutating_imethod() + + def invert(self): + """ + invert(self) + + Inverts the FST's transduction. + + This operation destructively inverts the FST's transduction by exchanging + input and output labels. + + Returns: + self. + """ + self._invert() + return self + + cdef void _minimize(self, float delta=fst.kShortestDelta, + bool allow_nondet=False) except *: + # This runs in-place when the second argument is null. + fst.Minimize(self._mfst.get(), NULL, delta, allow_nondet) + self._check_mutating_imethod() + + def minimize(self, float delta=fst.kShortestDelta, bool allow_nondet=False): + """ + minimize(self, delta=1e-6, allow_nondet=False) + + Minimizes the FST. + + This operation destructively performs the minimization of deterministic + weighted automata and transducers. If the input FST A is an acceptor, this + operation produces the minimal acceptor B equivalent to A, i.e. the + acceptor with a minimal number of states that is equivalent to A. If the + input FST A is a transducer, this operation internally builds an equivalent + transducer with a minimal number of states. However, this minimality is + obtained by allowing transition having strings of symbols as output labels, + this known in the litterature as a real-time transducer. Such transducers + are not directly supported by the library. This function will convert such + transducer by expanding each string-labeled transition into a sequence of + transitions. This will results in the creation of new states, hence losing + the minimality property. + + Args: + delta: Comparison/quantization delta. + allow_nondet: Attempt minimization of non-deterministic FST? + + Returns: + self. + """ + self._minimize(delta, allow_nondet) + return self + + cpdef MutableArcIterator mutable_arcs(self, int64 state): + """ + mutable_arcs(self, state) + + Returns a mutable iterator over arcs leaving the specified state. + + Args: + state: The source state ID. + + Returns: + A MutableArcIterator. + + See also: `arcs`, `states`. + """ + return MutableArcIterator(self, state) + + def mutable_input_symbols(self): + """ + mutable_input_symbols(self) + + Returns the FST's (mutable) input symbol table, or None if none is present. + """ + cdef fst.SymbolTable *syms = self._mfst.get().MutableInputSymbols() + if syms == NULL: + return + return _init_MutableFstSymbolTable(syms, self._mfst) + + def mutable_output_symbols(self): + """ + mutable_output_symbols(self) + + Returns the FST's (mutable) output symbol table, or None if none is present. + """ + cdef fst.SymbolTable *syms = self._mfst.get().MutableOutputSymbols() + if syms == NULL: + return + return _init_MutableFstSymbolTable(syms, self._mfst) + + cpdef int64 num_states(self): + """ + num_states(self) + + Returns the number of states. + """ + return self._mfst.get().NumStates() + + cdef void _project(self, bool project_output=False) except *: + fst.Project(self._mfst.get(), fst.GetProjectType(project_output)) + self._check_mutating_imethod() + + def project(self, bool project_output=False): + """ + project(self, project_output=False) + + Converts the FST to an acceptor using input or output labels. + + This operation destructively projects an FST onto its domain or range by + either copying each arc's input label to its output label (the default) or + vice versa. + + Args: + project_output: Should the output labels be projected? + + Returns: + self. + + See also: `decode`, `encode`, `relabel_pairs`, `relabel_symbols`. + """ + self._project(project_output) + return self + + cdef void _prune(self, float delta=fst.kDelta, int64 nstate=fst.kNoStateId, + weight=None) except *: + # Threshold is set to semiring Zero (no pruning) if no weight is specified. + cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + weight) + fst.Prune(self._mfst.get(), wc, nstate, delta) + self._check_mutating_imethod() + + def prune(self, + float delta=fst.kDelta, + int64 nstate=fst.kNoStateId, + weight=None): + """ + prune(self, delta=0.0009765625, nstate=NO_STATE_ID, weight=None) + + Removes paths with weights below a certain threshold. + + This operation deletes states and arcs in the input FST that do not belong + to a successful path whose weight is no more (w.r.t the natural semiring + order) than the threshold t \otimes-times the weight of the shortest path in + the input FST. Weights must be commutative and have the path property. + + Args: + delta: Comparison/quantization delta. + nstate: State number threshold. + weight: A Weight or weight string indicating the desired weight threshold + below which paths are pruned; if omitted, no paths are pruned. + + Returns: + self. + + See also: The constructive variant. + """ + self._prune(delta, nstate, weight) + return self + + cdef void _push(self, + float delta=fst.kDelta, + bool remove_total_weight=False, + bool to_final=False) except *: + fst.Push(self._mfst.get(), fst.GetReweightType(to_final), delta, + remove_total_weight) + self._check_mutating_imethod() + + def push(self, + float delta=fst.kDelta, + bool remove_total_weight=False, + bool to_final=False): + """ + push(self, delta=0.0009765625, remove_total_weight=False, to_final=False) + + Pushes weights towards the initial or final states. + + This operation destructively produces an equivalent transducer by pushing + the weights towards the initial state or toward the final states. When + pushing weights towards the initial state, the sum of the weight of the + outgoing transitions and final weight at any non-initial state is equal to + one in the resulting machine. When pushing weights towards the final states, + the sum of the weight of the incoming transitions at any state is equal to + one. Weights need to be left distributive when pushing towards the initial + state and right distributive when pushing towards the final states. + + Args: + delta: Comparison/quantization delta. + remove_total_weight: If pushing weights, should the total weight be + removed? + to_final: Push towards final states? + + Returns: + self. + + See also: The constructive variant, which also supports label pushing. + """ + self._push(delta, remove_total_weight, to_final) + return self + + cdef void _relabel_pairs(self, ipairs=None, opairs=None) except *: + cdef unique_ptr[vector[fst.LabelPair]] _ipairs + _ipairs.reset(new vector[fst.LabelPair]()) + cdef unique_ptr[vector[fst.LabelPair]] _opairs + _opairs.reset(new vector[fst.LabelPair]()) + cdef int64 before + cdef int64 after + if ipairs: + for (before, after) in ipairs: + _ipairs.get().push_back(fst.LabelPair(before, after)) + if opairs: + for (before, after) in opairs: + _opairs.get().push_back(fst.LabelPair(before, after)) + if _ipairs.get().empty() and _opairs.get().empty(): + raise FstArgError("No relabeling pairs specified.") + fst.Relabel(self._mfst.get(), deref(_ipairs), deref(_opairs)) + self._check_mutating_imethod() + + def relabel_pairs(self, ipairs=None, opairs=None): + """ + relabel_pairs(self, ipairs=None, opairs=None) + + Replaces input and/or output labels using pairs of labels. + + This operation destructively relabels the input and/or output labels of the + FST using pairs of the form (old_ID, new_ID); omitted indices are + identity-mapped. + + Args: + ipairs: An iterable containing (older index, newer index) integer pairs. + opairs: An iterable containing (older index, newer index) integer pairs. + + Returns: + self. + + Raises: + FstArgError: No relabeling pairs specified. + + See also: `decode`, `encode`, `project`, `relabel_tables`. + """ + self._relabel_pairs(ipairs, opairs) + return self + + cdef void _relabel_tables(self, + _SymbolTable old_isymbols=None, + _SymbolTable new_isymbols=None, + unknown_isymbol=b"", + bool attach_new_isymbols=True, + _SymbolTable old_osymbols=None, + _SymbolTable new_osymbols=None, + unknown_osymbol=b"", + bool attach_new_osymbols=True) except *: + if new_isymbols is None and new_osymbols is None: + raise FstArgError("No new SymbolTables specified") + cdef fst.SymbolTable *new_isymbols_ptr = NULL + if new_isymbols is not None: + new_isymbols_ptr = new_isymbols._table + cdef fst.SymbolTable *new_osymbols_ptr = NULL + if new_osymbols is not None: + new_osymbols_ptr = new_osymbols._table + fst.Relabel(self._mfst.get(), + self._fst.get().InputSymbols() if old_isymbols is None else + old_isymbols._table, new_isymbols_ptr, tostring(unknown_isymbol), + attach_new_isymbols, + self._fst.get().OutputSymbols() if old_osymbols is None else + old_osymbols._table, new_osymbols_ptr, tostring(unknown_osymbol), + attach_new_osymbols) + self._check_mutating_imethod() + + def relabel_tables(self, + _SymbolTable old_isymbols=None, + _SymbolTable new_isymbols=None, + unknown_isymbol=b"", + bool attach_new_isymbols=True, + _SymbolTable old_osymbols=None, + _SymbolTable new_osymbols=None, + unknown_osymbol=b"", + bool attach_new_osymbols=True): + """ + relabel_tables(self, old_isymbols=None, new_isymbols=None, + unknown_isymbol="", attach_new_isymbols=True, + old_osymbols=None, new_osymbols=None, + unknown_osymbol="", attach_new_osymbols=True) + + Replaces input and/or output labels using SymbolTables. + + This operation destructively relabels the input and/or output labels of the + FST using user-specified symbol tables; omitted symbols are identity-mapped. + + Args: + old_isymbols: The old SymbolTable for input labels, defaulting to the + FST's input symbol table. + new_isymbols: A SymbolTable used to relabel the input labels + unknown_isymbol: Input symbol to use to relabel OOVs (if empty, + OOVs raise an exception) + attach_new_isymbols: Should new_isymbols be made the FST's input symbol + table? + old_osymbols: The old SymbolTable for output labels, defaulting to the + FST's output symbol table. + new_osymbols: A SymbolTable used to relabel the output labels. + unknown_osymbol: Outnput symbol to use to relabel OOVs (if empty, + OOVs raise an exception) + attach_new_isymbols: Should new_osymbols be made the FST's output symbol + table? + + Returns: + self. + + Raises: + FstArgError: No SymbolTable specified. + + See also: `decode`, `encode`, `project`, `relabel_pairs`. + """ + self._relabel_tables(old_isymbols, new_isymbols, + unknown_isymbol, attach_new_isymbols, + old_osymbols, new_osymbols, + unknown_osymbol, attach_new_osymbols) + return self + + cdef void _reserve_arcs(self, int64 state, size_t n) except *: + if not self._mfst.get().ReserveArcs(state, n): + raise FstIndexError("State index out of range") + self._check_mutating_imethod() + + def reserve_arcs(self, int64 state, size_t n): + """ + reserve_arcs(self, state, n) + + Reserve n arcs at a particular state (best effort). + + Args: + state: The integer index of a state. + n: The number of arcs to reserve. + + Returns: + self. + + Raises: + FstIndexError: State index out of range. + + See also: `reserve_states`. + """ + self._reserve_arcs(state, n) + return self + + cdef void _reserve_states(self, int64 n) except *: + self._mfst.get().ReserveStates(n) + self._check_mutating_imethod() + + def reserve_states(self, int64 n): + """ + reserve_states(self, n) + + Reserve n states (best effort). + + Args: + n: The number of states to reserve. + + Returns: + self. + + See also: `reserve_arcs`. + """ + self._reserve_states(n) + return self + + cdef void _reweight(self, potentials, bool to_final=False) except *: + cdef unique_ptr[vector[fst.WeightClass]] _potentials + _potentials.reset(new vector[fst.WeightClass]()) + cdef string weight_type = self.weight_type() + for weight in potentials: + _potentials.get().push_back(_get_WeightClass_or_One(self.weight_type(), + weight)) + fst.Reweight(self._mfst.get(), deref(_potentials), + fst.GetReweightType(to_final)) + self._check_mutating_imethod() + + def reweight(self, potentials, bool to_final=False): + """ + reweight(self, potentials, to_final=False) + + Reweights an FST using an iterable of potentials. + + This operation destructively reweights an FST according to the potentials + and in the direction specified by the user. An arc of weight w, with an + origin state of potential p and destination state of potential q, is + reweighted by p^{-1} \otimes (w \otimes q) when reweighting towards the + initial state, and by (p \otimes w) \otimes q^{-1} when reweighting towards + the final states. The weights must be left distributive when reweighting + towards the initial state and right distributive when reweighting towards + the final states (e.g., TropicalWeight and LogWeight). + + Args: + potentials: An iterable of Weight or weight strings. + to_final: Push towards final states? + + Returns: + self. + """ + self._reweight(potentials, to_final) + return self + + cdef void _rmepsilon(self, + queue_type=b"auto", + bool connect=True, + weight=None, + int64 nstate=fst.kNoStateId, + float delta=fst.kShortestDelta) except *: + cdef fst.WeightClass wc = _get_WeightClass_or_Zero(self.weight_type(), + weight) + cdef unique_ptr[fst.RmEpsilonOptions] opts + opts.reset(new fst.RmEpsilonOptions(_get_queue_type(tostring(queue_type)), + connect, wc, nstate, delta)) + fst.RmEpsilon(self._mfst.get(), deref(opts)) + self._check_mutating_imethod() + + def rmepsilon(self, + queue_type=b"auto", + bool connect=True, + weight=None, + int64 nstate=fst.kNoStateId, + float delta=fst.kShortestDelta): + """ + rmepsilon(self, queue_type="auto", connect=True, weight=None, + nstate=NO_STATE_ID, delta=1e-6): + + Removes epsilon transitions. + + This operation destructively removes epsilon transitions, i.e., those where + both input and output labels are epsilon) from an FST. + + Args: + queue_type: A string matching a known queue type; one of: "auto", "fifo", + "lifo", "shortest", "state", "top". + connect: Should output be trimmed? + weight: A Weight or weight string indicating the desired weight threshold + below which paths are pruned; if omitted, no paths are pruned. + nstate: State number threshold. + delta: Comparison/quantization delta. + + Returns: + self. + """ + self._rmepsilon(queue_type, connect, weight, nstate, delta) + return self + + cdef void _set_final(self, int64 state, weight=None) except *: + if not self._mfst.get().ValidStateId(state): + raise FstIndexError("State index out of range") + cdef fst.WeightClass wc = _get_WeightClass_or_One(self.weight_type(), + weight) + if not self._mfst.get().SetFinal(state, wc): + raise FstOpError("Incompatible or invalid weight") + self._check_mutating_imethod() + + def set_final(self, int64 state, weight=None): + """ + set_final(self, state, weight) + + Sets the final weight for a state. + + Args: + state: The integer index of a state. + weight: A Weight or weight string indicating the desired final weight; if + omitted, it is set to semiring One. + + Returns: + self. + + Raises: + FstIndexError: State index out of range. + FstOpError: Incompatible or invalid weight. + + See also: `set_start`. + """ + self._set_final(state, weight) + return self + + cdef void _set_input_symbols(self, _SymbolTable syms) except *: + if syms is None: + self._mfst.get().SetInputSymbols(NULL) + return + self._mfst.get().SetInputSymbols(syms._table) + self._check_mutating_imethod() + + def set_input_symbols(self, _SymbolTable syms): + """ + set_input_symbols(self, syms) + + Sets the input symbol table. + + Passing None as a value will delete the input symbol table. + + Args: + syms: A SymbolTable. + + Returns: + self. + + See also: `set_output_symbols`. + """ + self._set_input_symbols(syms) + return self + + cdef void _set_output_symbols(self, _SymbolTable syms) except *: + if syms is None: + self._mfst.get().SetOutputSymbols(NULL) + return + self._mfst.get().SetOutputSymbols(syms._table) + self._check_mutating_imethod() + + def set_output_symbols(self, _SymbolTable syms): + """ + set_output_symbols(self, syms) + + Sets the output symbol table. + + Passing None as a value will delete the output symbol table. + + Args: + syms: A SymbolTable. + + Returns: + self. + + See also: `set_input_symbols`. + """ + self._set_output_symbols(syms) + return self + + cdef void _set_properties(self, uint64 props, uint64 mask): + self._mfst.get().SetProperties(props, mask) + + def set_properties(self, uint64 props, uint64 mask): + """ + set_properties(self, props, mask) + + Sets the properties bits. + + Args: + props: The properties to be set. + mask: A mask to be applied to the `props` argument before setting the + FST's properties. + + Returns: + self. + """ + self._set_properties(props, mask) + return self + + cdef void _set_start(self, int64 state) except *: + if not self._mfst.get().SetStart(state): + raise FstIndexError("State index out of range") + self._check_mutating_imethod() + + def set_start(self, int64 state): + """ + set_start(self, state) + + Sets a state to be the initial state state. + + Args: + state: The integer index of a state. + + Returns: + self. + + Raises: + FstIndexError: State index out of range. + + See also: `set_final`. + """ + self._set_start(state) + return self + + cdef void _topsort(self) except *: + # TopSort returns False if the FST is cyclic, and thus can't be TopSorted. + if not fst.TopSort(self._mfst.get()): + logging.warning("Cannot topsort cyclic FST") + self._check_mutating_imethod() + + def topsort(self): + """ + topsort(self) + + Sorts transitions by state IDs. + + This operation destructively topologically sorts the FST, if it is acyclic; + otherwise it remains unchanged. Once sorted, all transitions are from lower + state IDs to higher state IDs + + Returns: + self. + """ + self._topsort() + return self + + cdef void _union(self, _Fst ifst) except *: + fst.Union(self._mfst.get(), deref(ifst._fst)) + self._check_mutating_imethod() + + def union(self, _Fst ifst): + """ + union(self, ifst) + + Computes the union (sum) of two FSTs. + + This operation computes the union (sum) of two FSTs. If A transduces string + x to y with weight a and B transduces string w to v with weight b, then + their union transduces x to y with weight a and w to v with weight b. + + Args: + ifst: The second input FST. + + Returns: + self. + """ + self._union(ifst) + return self + + +# Pseudo-constructors for _Fst and _MutableFst. +# +# _init_Fst and _init_MutableFst use an FstClass pointer to instantiate _Fst +# and _MutableFst objects, respectively. The latter function is only safe to +# call when the FST being wrapped is known to be kMutable. The caller can +# safely use it when they have either checked this bit (e.g., by using +# _init_XFst) or have themselves constructed a mutable container for the +# FstClass pointer they're passing (e.g., most of the constructive operations, +# storing their results in a VectorFstClass, a derivative of MutableFstClass). +# +# _create_Fst constructs an empty VectorFstClass of a user-specified arc type, +# and passes this pointer to _init_MutableFst. +# +# _read_Fst reads an FST from disk, performing FST conversion if requested, and +# then passes this pointer to _init_XFst. +# +# The Python class Fst provides a wrapper for these two operations. The former +# can be accessed by calling Fst(...), which acts like a class method, and the +# latter via Fst.read(...), which acts like a static method. This is a bit +# nasty, but totally hidden from the Python user. + + +cdef _Fst _init_Fst(FstClass_ptr tfst): + if tfst.Properties(fst.kError, True) == fst.kError: + raise FstOpError("Operation failed") + cdef _Fst ofst = _Fst.__new__(_Fst) + ofst._fst.reset(tfst) + return ofst + + +cdef _MutableFst _init_MutableFst(MutableFstClass_ptr tfst): + if tfst.Properties(fst.kError, True) == fst.kError: + raise FstOpError("Operation failed") + cdef _MutableFst ofst = _MutableFst.__new__(_MutableFst) + ofst._fst.reset(tfst) + # Makes a copy of it as the derived type! Cool. + ofst._mfst = static_pointer_cast[fst.MutableFstClass, fst.FstClass](ofst._fst) + return ofst + + +cdef _Fst _init_XFst(FstClass_ptr tfst): + if tfst.Properties(fst.kMutable, True) == fst.kMutable: + return _init_MutableFst(static_cast[MutableFstClass_ptr](tfst)) + else: + return _init_Fst(tfst) + + +cdef _MutableFst _create_Fst(arc_type=b"standard"): + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(tostring(arc_type))) + if tfst.get() == NULL: + raise FstOpError("Unknown arc type: {!r}".format(arc_type)) + return _init_MutableFst(tfst.release()) + + +cpdef _Fst _read(filename): + cdef unique_ptr[fst.FstClass] tfst + tfst.reset(fst.FstClass.Read(tostring(filename))) + if tfst.get() == NULL: + raise FstIOError("Read failed: {!r}".format(filename)) + return _init_XFst(tfst.release()) + + +cpdef _Fst _read_Fst_from_string(state): + cdef stringstream sstrm + sstrm << tostring(state) + cdef unique_ptr[fst.FstClass] tfst + tfst.reset(fst.FstClass.ReadStream(sstrm, b"")) + if tfst.get() == NULL: + raise FstIOError("Read failed") + return _init_XFst(tfst.release()) + + +class Fst(object): + + """ + Fst(arc_type="standard") + + Constructs an empty FST. + + Args: + arc_type: A string indicating the arc type. + + Raises: + FstError: Unknown arc type. + + Raises: + FstOpError: operation failed. + """ + + def __new__(cls, arc_type=b"standard"): + return _create_Fst(arc_type) + + @staticmethod + def read(filename): + """ + read(filename): + + Reads an FST from a file. + + Args: + filename: The string location of the input file. + + Returns: + An FST object. + + Raises: + FstIOError: Read failed. + """ + return _read(filename) + + @staticmethod + def read_from_string(state): + """ + read_from_string(string, fst_type=None) + + Reads an FST from a serialized string. + + Args: + state: A string containing the serialized FST. + + Returns: + An FST object. + + Raises: + FstIOError: Read failed. + FstOpError: Read-time conversion failed. + + See also: `write_to_string`. + """ + return _read_Fst_from_string(state) + + +## FST constants. + + +NO_LABEL = fst.kNoLabel +NO_STATE_ID = fst.kNoStateId +NO_SYMBOL = fst.kNoSymbol + + +## FST properties. + + +EXPANDED = fst.kExpanded +MUTABLE = fst.kMutable +ERROR = fst.kError +ACCEPTOR = fst.kAcceptor +NOT_ACCEPTOR = fst.kNotAcceptor +I_DETERMINISTIC = fst.kIDeterministic +NON_I_DETERMINISTIC = fst.kNonIDeterministic +O_DETERMINISTIC = fst.kODeterministic +NON_O_DETERMINISTIC = fst.kNonODeterministic +EPSILONS = fst.kEpsilons +NO_EPSILONS = fst.kNoEpsilons +I_EPSILONS = fst.kIEpsilons +NO_I_EPSILONS = fst.kNoIEpsilons +O_EPSILONS = fst.kOEpsilons +NO_O_EPSILONS = fst.kNoOEpsilons +I_LABEL_SORTED = fst.kILabelSorted +NOT_I_LABEL_SORTED = fst.kNotILabelSorted +O_LABEL_SORTED = fst.kOLabelSorted +NOT_O_LABEL_SORTED = fst.kNotOLabelSorted +WEIGHTED = fst.kWeighted +UNWEIGHTED = fst.kUnweighted +CYCLIC = fst.kCyclic +ACYCLIC = fst.kAcyclic +INITIAL_CYCLIC = fst.kInitialCyclic +INITIAL_ACYCLIC = fst.kInitialAcyclic +TOP_SORTED = fst.kTopSorted +NOT_TOP_SORTED = fst.kNotTopSorted +ACCESSIBLE = fst.kAccessible +NOT_ACCESSIBLE = fst.kNotAccessible +COACCESSIBLE = fst.kCoAccessible +NOT_COACCESSIBLE = fst.kNotCoAccessible +STRING = fst.kString +NOT_STRING = fst.kNotString +WEIGHTED_CYCLES = fst.kWeightedCycles +UNWEIGHTED_CYCLES = fst.kUnweightedCycles +NULL_PROPERTIES = fst.kNullProperties +COPY_PROPERTIES = fst.kCopyProperties +INTRINSIC_PROPERTIES = fst.kIntrinsicProperties +EXTRINSIC_PROPERTIES = fst.kExtrinsicProperties +SET_START_PROPERTIES = fst.kSetStartProperties +SET_FINAL_PROPERTIES = fst.kSetFinalProperties +ADD_STATE_PROPERTIES = fst.kAddStateProperties +ADD_ARC_PROPERTIES = fst.kAddArcProperties +SET_ARC_PROPERTIES = fst.kSetArcProperties +DELETE_STATE_PROPERTIES = fst.kDeleteStatesProperties +DELETE_ARC_PROPERTIES = fst.kDeleteArcsProperties +STATE_SORT_PROPERTIES = fst.kStateSortProperties +ARC_SORT_PROPERTIES = fst.kArcSortProperties +I_LABEL_INVARIANT_PROPERTIES = fst.kILabelInvariantProperties +O_LABEL_INVARIANT_PROPERTIES = fst.kOLabelInvariantProperties +WEIGHT_INVARIANT_PROPERTIES = fst.kWeightInvariantProperties +ADD_SUPERFINAL_PROPERTIES = fst.kAddSuperFinalProperties +RM_SUPERFINAL_PROPERTIES = fst.kRmSuperFinalProperties +BINARY_PROPERTIES = fst.kBinaryProperties +TRINARY_PROPERTIES = fst.kTrinaryProperties +POS_TRINARY_PROPERTIES = fst.kPosTrinaryProperties +NEG_TRINARY_PROPERTIES = fst.kNegTrinaryProperties +FST_PROPERTIES = fst.kFstProperties + + +## Arc iterator properties. + + +ARC_I_LABEL_VALUE = fst.kArcILabelValue +ARC_O_LABEL_VALUE = fst.kArcOLabelValue +ARC_WEIGHT_VALUE = fst.kArcWeightValue +ARC_NEXT_STATE_VALUE = fst.kArcNextStateValue +ARC_NO_CACHE = fst.kArcNoCache +ARC_VALUE_FLAGS = fst.kArcValueFlags +ARC_FLAGS = fst.kArcFlags + + +## EncodeMapper properties. + + +ENCODE_LABELS = fst.kEncodeLabels +ENCODE_WEIGHTS = fst.kEncodeWeights +ENCODE_FLAGS = fst.kEncodeFlags + + +## Arc, ArcIterator, and MutableArcIterator. + + +cdef class Arc(object): + + """ + Arc(ilabel, olabel, weight, nextstate) + + This class represents an arc while remaining agnostic about the underlying arc + type. Attributes of the arc can be accessed or mutated, and the arc can be + copied. + + Attributes: + ilabel: The input label. + olabel: The output label. + weight: The arc weight. + nextstate: The destination state for the arc. + """ + + def __repr__(self): + return "".format(id(self)) + + def __init__(self, int64 ilabel, int64 olabel, weight, int64 nextstate): + cdef fst.WeightClass wc = _get_WeightClass_or_One(b"tropical", weight) + self._arc.reset(new fst.ArcClass(ilabel, olabel, wc, nextstate)) + + cpdef Arc copy(self): + return Arc(self.ilabel, self.olabel, self.weight, self.nextstate) + + property ilabel: + + def __get__(self): + return deref(self._arc).ilabel + + def __set__(self, int64 value): + deref(self._arc).ilabel = value + + property olabel: + + def __get__(self): + return deref(self._arc).olabel + + def __set__(self, int64 value): + deref(self._arc).olabel = value + + property weight: + + def __get__(self): + cdef Weight weight = Weight.__new__(Weight) + weight._weight.reset(new fst.WeightClass(deref(self._arc).weight)) + return weight + + def __set__(self, weight): + deref(self._arc).weight = _get_WeightClass_or_One(b"tropical", weight) + + property nextstate: + + def __get__(self): + return deref(self._arc).nextstate + + def __set__(self, int64 value): + deref(self._arc).nextstate = value + + +cdef Arc _init_Arc(const fst.ArcClass &arc): + cdef Weight weight = Weight.__new__(Weight) + weight._weight.reset(new fst.WeightClass(arc.weight)) + return Arc(arc.ilabel, arc.olabel, weight, arc.nextstate) + + +cdef class ArcIterator(object): + + """ + ArcIterator(ifst, state) + + This class is used for iterating over the arcs leaving some state of an FST. + """ + + def __repr__(self): + return "".format(id(self)) + + def __init__(self, _Fst ifst, int64 state): + if not ifst._fst.get().ValidStateId(state): + raise FstIndexError("State index out of range") + # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + self._fst = ifst._fst + self._aiter.reset(new fst.ArcIteratorClass(deref(self._fst), state)) + + # This just registers this class as a possible iterator. + def __iter__(self): + return self + + # Magic method used to get a Pythonic API out of the C++ API. + def __next__(self): + if self.done(): + raise StopIteration + result = self.value() + self.next() + return result + + cpdef bool done(self): + """ + done(self) + + Indicates whether the iterator is exhausted or not. + + Returns: + True if the iterator is exhausted, False otherwise. + """ + return self._aiter.get().Done() + + cpdef uint32 flags(self): + """ + flags(self) + + Returns the current iterator behavioral flags. + + Returns: + The current iterator behavioral flags as an integer. + """ + return self._aiter.get().Flags() + + cpdef void next(self): + """ + next(self) + + Advances the iterator. + """ + self._aiter.get().Next() + + cpdef size_t position(self): + """ + position(self) + + Returns the position of the iterator. + + Returns: + The iterator's position, expressed as an integer. + """ + return self._aiter.get().Position() + + cpdef void reset(self): + """ + reset(self) + + Resets the iterator to the initial position. + """ + self._aiter.get().Reset() + + cpdef void seek(self, size_t a): + """ + seek(self, a) + + Advance the iterator to a new position. + + Args: + a: The position to seek to. + """ + self._aiter.get().Seek(a) + + cpdef void set_flags(self, uint32 flags, uint32 mask): + """ + set_flags(self, flags, mask) + + Sets the current iterator behavioral flags. + + Args: + flags: The properties to be set. + mask: A mask to be applied to the `flags` argument before setting them. + """ + self._aiter.get().SetFlags(flags, mask) + + cpdef object value(self): + """ + value(self) + + Returns the current arc. + """ + return _init_Arc(self._aiter.get().Value()) + + +cdef class MutableArcIterator(object): + + """ + MutableArcIterator(ifst, state) + + This class is used for iterating over the arcs leaving some state of an FST, + also permitting mutation of the current arc. + """ + + def __repr__(self): + return "".format(id(self)) + + def __init__(self, _MutableFst ifst, int64 state): + if not ifst._fst.get().ValidStateId(state): + raise FstIndexError("State index out of range") + # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + self._mfst = ifst._mfst + self._aiter.reset(new fst.MutableArcIteratorClass(ifst._mfst.get(), state)) + + # Magic method used to get a Pythonic Iterator API out of the C++ API + def __iter__(self): + while not self.done(): + yield self.value() + self.next() + + cpdef bool done(self): + """ + done(self) + + Indicates whether the iterator is exhausted or not. + + Returns: + True if the iterator is exhausted, False otherwise. + """ + return self._aiter.get().Done() + + cpdef uint32 flags(self): + """ + flags(self) + + Returns the current iterator behavioral flags. + + Returns: + The current iterator behavioral flags as an integer. + """ + return self._aiter.get().Flags() + + cpdef void next(self): + """ + next(self) + + Advances the iterator. + """ + self._aiter.get().Next() + + cpdef size_t position(self): + """ + position(self) + + Returns the position of the iterator. + + Returns: + The iterator's position, expressed as an integer. + """ + return self._aiter.get().Position() + + cpdef void reset(self): + """ + reset(self) + + Resets the iterator to the initial position. + """ + self._aiter.get().Reset() + + cpdef void seek(self, size_t a): + """ + seek(self, a) + + Advance the iterator to a new position. + + Args: + a: The position to seek to. + """ + self._aiter.get().Seek(a) + + cpdef void set_flags(self, uint32 flags, uint32 mask): + """ + set_flags(self, flags, mask) + + Sets the current iterator behavioral flags. + + Args: + flags: The properties to be set. + mask: A mask to be applied to the `flags` argument before setting them. + """ + self._aiter.get().SetFlags(flags, mask) + + cpdef void set_value(self, Arc arc): + """ + set_value(self, arc) + + Replace the current arc with a new arc. + + Args: + arc: The arc to replace the current arc with. + """ + self._aiter.get().SetValue(deref(arc._arc)) + + cpdef object value(self): + """ + value(self) + + Returns the current arc. + """ + return _init_Arc(self._aiter.get().Value()) + + +## StateIterator. + + +cdef class StateIterator(object): + + """ + StateIterator(ifst) + + This class is used for iterating over the states in an FST. + """ + + def __repr__(self): + return "".format(id(self)) + + def __init__(self, _Fst ifst): + # Makes copy of the shared_ptr, potentially extending the FST's lifetime. + self._fst = ifst._fst + self._siter.reset(new fst.StateIteratorClass(deref(self._fst))) + + # This just registers this class as a possible iterator. + def __iter__(self): + return self + + # Magic method used to get a Pythonic API out of the C++ API. + def __next__(self): + if self.done(): + raise StopIteration + cdef int64 result = self.value() + self.next() + return result + + cpdef bool done(self): + """ + done(self) + + Indicates whether the iterator is exhausted or not. + + Returns: + True if the iterator is exhausted, False otherwise. + """ + return self._siter.get().Done() + + cpdef void next(self): + """ + next(self) + + Advances the iterator. + """ + self._siter.get().Next() + + cpdef void reset(self): + """ + reset(self) + + Resets the iterator to the initial position. + """ + self._siter.get().Reset() + + cpdef int64 value(self): + """ + value(self) + + Returns the current state index. + """ + return self._siter.get().Value() + + +## FST operations. + + +cdef _Fst _map(_Fst ifst, + float delta=fst.kDelta, + map_type=b"identity", + double power=1., + weight=None): + cdef fst.MapType map_type_enum + if not fst.GetMapType(tostring(map_type), addr(map_type_enum)): + raise FstArgError("Unknown map type: {!r}".format(map_type)) + cdef fst.WeightClass wc = (_get_WeightClass_or_One(ifst.weight_type(), + weight) if map_type_enum == fst.TIMES_MAPPER else + _get_WeightClass_or_Zero(ifst.weight_type(), weight)) + return _init_XFst(fst.Map(deref(ifst._fst), map_type_enum, delta, power, wc)) + + +cpdef _Fst arcmap(_Fst ifst, + float delta=fst.kDelta, + map_type=b"identity", + double power=1., + weight=None): + """ + arcmap(ifst, delta=0.0009765625, map_type="identity", power=1., weight=None) + + Constructively applies a transform to all arcs and final states. + + This operation transforms each arc and final state in the input FST using + one of the following: + + * identity: maps to self. + * input_epsilon: replaces all input labels with epsilon. + * invert: reciprocates all non-Zero weights. + * float_power: raises all weights to a floating-point power. + * output_epsilon: replaces all output labels with epsilon. + * quantize: quantizes weights. + * plus: adds a constant to all weights. + * power: raises all weights to an integral power. + * rmweight: replaces all non-Zero weights with 1. + * superfinal: redirects final states to a new superfinal state. + * times: right-multiplies a constant by all weights. + * to_log: converts weights to the log semiring. + * to_log64: converts weights to the log64 semiring. + * to_standard: converts weights to the tropical ("standard") semiring. + + Args: + ifst: The input FST. + delta: Comparison/quantization delta (ignored unless `map_type` is + `quantize`). + map_type: A string matching a known mapping operation (see above). + power: A positive scalar or integer power; ignored unless `map_type` is + `float_power` or `power` (in which case it defaults to 1). + weight: A Weight or weight string passed to the arc-mapper; ignored unless + `map_type` is `plus` (in which case it defaults to semiring Zero) or + `times` (in which case it defaults to semiring One). + + Returns: + An FST with arcs and final states remapped. + + Raises: + FstArgError: Unknown map type. + + See also: `statemap`. + """ + return _map(ifst, delta, map_type, power, weight) + + +cpdef _MutableFst compose(_Fst ifst1, + _Fst ifst2, + compose_filter=b"auto", + bool connect=True): + """ + compose(ifst1, ifst2, compose_filter="auto", connect=True) + + Constructively composes two FSTs. + + This operation computes the composition of two FSTs. If A transduces string + x to y with weight a and B transduces y to z with weight b, then their + composition transduces string x to z with weight a \otimes b. The output + labels of the first transducer or the input labels of the second transducer + must be sorted (or otherwise support appropriate matchers). + + Args: + ifst1: The first input FST. + ifst2: The second input FST. + compose_filter: A string matching a known composition filter; one of: + "alt_sequence", "auto", "match", "no_match", "null", "sequence", + "trivial". + connect: Should output be trimmed? + + Returns: + An FST. + + See also: `arcsort`. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) + cdef unique_ptr[fst.ComposeOptions] opts + opts.reset(new fst.ComposeOptions(connect, + _get_compose_filter(tostring(compose_filter)))) + fst.Compose(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef _Fst convert(_Fst ifst, fst_type=b""): + """ + convert(ifst, fst_type="") + + Constructively converts an FST to a new internal representation. + + Args: + ifst: The input FST. + fst_type: A string indicating the FST type to convert to, or an empty string + if no conversion is desired. + + Returns: + The input FST converted to the desired FST type. + + Raises: + FstOpError: Conversion failed. + """ + cdef string fst_type_string = tostring(fst_type) + cdef unique_ptr[fst.FstClass] tfst + tfst.reset(fst.Convert(deref(ifst._fst), fst_type_string)) + # Script-land Convert returns a null pointer to signal failure. + if tfst.get() == NULL: + raise FstOpError("Conversion to {!r} failed".format(fst_type)) + return _init_XFst(tfst.release()) + + +cpdef _MutableFst determinize(_Fst ifst, + float delta=fst.kShortestDelta, + det_type=b"functional", + int64 nstate=fst.kNoStateId, + int64 subsequential_label=0, + weight=None, + bool increment_subsequential_label=False): + """ + determinize(ifst, delta=1e-6, det_type="functional", + nstate=NO_STATE_ID, subsequential_label=0, weight=None, + incremental_subsequential_label=False) + + Constructively determinizes a weighted FST. + + This operations creates an equivalent FST that has the property that no + state has two transitions with the same input label. For this algorithm, + epsilon transitions are treated as regular symbols (cf. `rmepsilon`). + + Args: + ifst: The input FST. + delta: Comparison/quantization delta. + det_type: Type of determinization; one of: "functional" (input transducer is + functional), "nonfunctional" (input transducer is not functional) and + disambiguate" (input transducer is not functional but only keep the min + of ambiguous outputs). + nstate: State number threshold. + subsequential_label: Input label of arc corresponding to residual final + output when producing a subsequential transducer. + weight: A Weight or weight string indicating the desired weight threshold + below which paths are pruned; if omitted, no paths are pruned. + increment_subsequential_label: Increment subsequential when creating + several arcs for the residual final output at a given state. + + Returns: + An equivalent deterministic FST. + + Raises: + FstArgError: Unknown determinization type. + + See also: `disambiguate`, `rmepsilon`. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + # Threshold is set to semiring Zero (no pruning) if weight unspecified. + cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), + weight) + cdef fst.DeterminizeType determinize_type_enum + if not fst.GetDeterminizeType(tostring(det_type), + addr(determinize_type_enum)): + raise FstArgError("Unknown determinization type: {!r}".format(det_type)) + cdef unique_ptr[fst.DeterminizeOptions] opts + opts.reset(new fst.DeterminizeOptions(delta, wc, nstate, subsequential_label, + determinize_type_enum, + increment_subsequential_label)) + fst.Determinize(deref(ifst._fst), tfst.get(), deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef _MutableFst difference(_Fst ifst1, + _Fst ifst2, + compose_filter=b"auto", + bool connect=True): + """ + difference(ifst1, ifst2, compose_filter="auto", connect=True) + + Constructively computes the difference of two FSTs. + + This operation computes the difference between two FSAs. Only strings that are + in the first automaton but not in second are retained in the result. The first + argument must be an acceptor; the second argument must be an unweighted, + epsilon-free, deterministic acceptor. The output labels of the first + transducer or the input labels of the second transducer must be sorted (or + otherwise support appropriate matchers). + + Args: + ifst1: The first input FST. + ifst2: The second input FST. + compose_filter: A string matching a known composition filter; one of: + "alt_sequence", "auto", "match", "no_match", "null", "sequence", + "trivial". + connect: Should the output FST be trimmed? + + Returns: + An FST representing the difference of the FSTs. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) + cdef unique_ptr[fst.ComposeOptions] opts + opts.reset(new fst.ComposeOptions(connect, _get_compose_filter( + tostring(compose_filter)))) + fst.Difference(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef _MutableFst disambiguate(_Fst ifst, + float delta=fst.kDelta, + int64 nstate=fst.kNoStateId, + int64 subsequential_label=0, + weight=None): + """ + disambiguate(ifst, delta=0.0009765625, nstate=NO_STATE_ID, + subsequential_label=0, weight=None): + + Constructively disambiguates a weighted transducer. + + This operation disambiguates a weighted transducer. The result will be an + equivalent FST that has the property that no two successful paths have the + same input labeling. For this algorithm, epsilon transitions are treated as + regular symbols (cf. `rmepsilon`). + + Args: + ifst: The input FST. + delta: Comparison/quantization delta. + nstate: State number threshold. + subsequential_label: Input label of arc corresponding to residual final + output when producing a subsequential transducer. + weight: A Weight or weight string indicating the desired weight threshold + below which paths are pruned; if omitted, no paths are pruned. + + Returns: + An equivalent disambiguated FST. + + See also: `determinize`, `rmepsilon`. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + # Threshold is set to semiring Zero (no pruning) if no weight is specified. + cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), + weight) + cdef unique_ptr[fst.DisambiguateOptions] opts + opts.reset(new fst.DisambiguateOptions(delta, wc, nstate, + subsequential_label)) + fst.Disambiguate(deref(ifst._fst), tfst.get(), deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef _MutableFst epsnormalize(_Fst ifst, bool eps_norm_output=False): + """ + epsnormalize(ifst, eps_norm_output=False) + + Constructively epsilon-normalizes an FST. + + This operation creates an equivalent FST that is epsilon-normalized. An + acceptor is epsilon-normalized if it it is epsilon-removed (cf. `rmepsilon`). + A transducer is input epsilon-normalized if, in addition, along any path, all + arcs with epsilon input labels follow all arcs with non-epsilon input labels. + Output epsilon-normalized is defined similarly. The input FST must be + functional. + + Args: + ifst: The input FST. + eps_norm_output: Should the FST be output epsilon-normalized? + + Returns: + An equivalent epsilon-normalized FST. + + See also: `rmepsilon`. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + fst.EpsNormalize(deref(ifst._fst), tfst.get(), fst.EPS_NORM_OUTPUT if + eps_norm_output else + fst.EPS_NORM_INPUT) + return _init_MutableFst(tfst.release()) + + +cpdef bool equal(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): + """ + equal(ifst1, ifst2, delta=0.0009765625) + + Are two FSTs equal? + + This function tests whether two FSTs have the same states with the same + numbering and the same transitions with the same labels and weights in the + same order. + + Args: + ifst1: The first input FST. + ifst2: The second input FST. + delta: Comparison/quantization delta. + + Returns: + True if the FSTs satisfy the above condition, else False. + + See also: `equivalent`, `isomorphic`, `randequivalent`. + """ + return fst.Equal(deref(ifst1._fst), deref(ifst2._fst), delta) + + +cpdef bool equivalent(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta) except *: + """ + equivalent(ifst1, ifst2, delta=0.0009765625) + + Are the two acceptors equivalent? + + This operation tests whether two epsilon-free deterministic weighted + acceptors are equivalent, that is if they accept the same strings with the + same weights. + + Args: + ifst1: The first input FST. + ifst2: The second input FST. + delta: Comparison/quantization delta. + + Returns: + True if the FSTs satisfy the above condition, else False. + + See also: `equal`, `isomorphic`, `randequivalent`. + """ + return fst.Equivalent(deref(ifst1._fst), deref(ifst2._fst), delta) + + +cpdef _MutableFst intersect(_Fst ifst1, + _Fst ifst2, + compose_filter=b"auto", + bool connect=True): + """ + intersect(ifst1, ifst2, compose_filter="auto", connect=True) + + Constructively intersects two FSTs. + + This operation computes the intersection (Hadamard product) of two FSTs. + Only strings that are in both automata are retained in the result. The two + arguments must be acceptors. One of the arguments must be label-sorted (or + otherwise support appropriate matchers). + + Args: + ifst1: The first input FST. + ifst2: The second input FST. + compose_filter: A string matching a known composition filter; one of: + "alt_sequence", "auto", "match", "no_match", "null", "sequence", + "trivial". + connect: Should output be trimmed? + + Returns: + An intersected FST. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst1.arc_type())) + cdef unique_ptr[fst.ComposeOptions] opts + opts.reset(new fst.ComposeOptions(connect, + _get_compose_filter(tostring(compose_filter)))) + fst.Intersect(deref(ifst1._fst), deref(ifst2._fst), tfst.get(), deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef bool isomorphic(_Fst ifst1, _Fst ifst2, float delta=fst.kDelta): + """ + isomorphic(ifst1, ifst2, delta=0.0009765625) + + Are the two acceptors isomorphic? + + This operation determines if two transducers with a certain required + determinism have the same states, irrespective of numbering, and the same + transitions with the same labels and weights, irrespective of ordering. In + other words, FSTs A, B are isomorphic if and only if the states of A can be + renumbered and the transitions leaving each state reordered so the two are + equal (according to the definition given in `equal`). + + Args: + ifst1: The first input FST. + ifst2: The second input FST. + delta: Comparison/quantization delta. + + Returns: + True if the two transducers satisfy the above condition, else False. + + See also: `equal`, `equivalent`, `randequivalent`. + """ + return fst.Isomorphic(deref(ifst1._fst), deref(ifst2._fst), delta) + + +cpdef _MutableFst prune(_Fst ifst, + float delta=fst.kDelta, + int64 nstate=fst.kNoStateId, + weight=None): + """ + prune(ifst, delta=0.0009765625, nstate=NO_STATE_ID, weight=None) + + Constructively removes paths with weights below a certain threshold. + + This operation deletes states and arcs in the input FST that do not belong + to a successful path whose weight is no more (w.r.t the natural semiring + order) than the threshold t \otimes-times the weight of the shortest path in + the input FST. Weights must be commutative and have the path property. + + Args: + ifst: The input FST. + delta: Comparison/quantization delta. + nstate: State number threshold. + weight: A Weight or weight string indicating the desired weight threshold + below which paths are pruned; if omitted, no paths are pruned. + + Returns: + A pruned FST. + + See also: The destructive variant. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) + fst.Prune(deref(ifst._fst), tfst.get(), wc, nstate, delta) + return _init_MutableFst(tfst.release()) + + +cpdef _MutableFst push(_Fst ifst, + float delta=fst.kDelta, + bool push_weights=False, + bool push_labels=False, + bool remove_common_affix=False, + bool remove_total_weight=False, + bool to_final=False): + """ + push(ifst, delta=0.0009765625, push_weights=False, push_labels=False, + remove_common_affix=False, remove_total_weight=False, to_final=False) + + Constructively pushes weights/labels towards initial or final states. + + This operation produces an equivalent transducer by pushing the weights + and/or the labels towards the initial state or toward the final states. + + When pushing weights towards the initial state, the sum of the weight of the + outgoing transitions and final weight at any non-initial state is equal to 1 + in the resulting machine. When pushing weights towards the final states, the + sum of the weight of the incoming transitions at any state is equal to 1. + Weights need to be left distributive when pushing towards the initial state + and right distributive when pushing towards the final states. + + Pushing labels towards the initial state consists in minimizing at every + state the length of the longest common prefix of the output labels of the + outgoing paths. Pushing labels towards the final states consists in + minimizing at every state the length of the longest common suffix of the + output labels of the incoming paths. + + Args: + ifst: The input FST. + delta: Comparison/quantization delta. + push_weights: Should weights be pushed? + push_labels: Should labels be pushed? + remove_common_affix: If pushing labels, should common prefix/suffix be + removed? + remove_total_weight: If pushing weights, should total weight be removed? + to_final: Push towards final states? + + Returns: + An equivalent pushed FST. + + See also: The destructive variant. + """ + # This is copied, almost verbatim, from ./fstpush.cc. + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + cdef uint32 flags = fst.GetPushFlags(push_weights, push_labels, + remove_common_affix, remove_total_weight) + fst.Push(deref(ifst._fst), tfst.get(), flags, fst.GetReweightType(to_final), + delta) + return _init_MutableFst(tfst.release()) + + +cpdef bool randequivalent(_Fst ifst1, + _Fst ifst2, + int32 npath=1, + float delta=fst.kDelta, + time_t seed=0, + select=b"uniform", + int32 max_length=INT32_MAX) except *: + """ + randequivalent(ifst1, ifst2, npath=1, delta=0.0009765625, seed=0, + select="uniform", max_length=2147483647) + + Are two acceptors stochastically equivalent? + + This operation tests whether two FSTs are equivalent by randomly generating + paths alternatively in each of the two FSTs. For each randomly generated path, + the algorithm computes for each of the two FSTs the sum of the weights of all + the successful paths sharing the same input and output labels as the randomly + generated path and checks that these two values are within `delta`. + + Args: + ifst1: The first input FST. + ifst2: The second input FST. + npath: The number of random paths to generate. + delta: Comparison/quantization delta. + seed: An optional seed value for random path generation; if zero, the + current time and process ID is used. + select: A string matching a known random arc selection type; one of: + "uniform", "log_prob", "fast_log_prob". + max_length: The maximum length of each random path. + + Returns: + True if the two transducers satisfy the above condition, else False. + + See also: `equal`, `equivalent`, `isomorphic`, `randgen`. + """ + cdef fst.RandArcSelection ras = _get_rand_arc_selection(tostring(select)) + cdef unique_ptr[fst.RandGenOptions[fst.RandArcSelection]] opts + # The three trailing options will be ignored by RandEquivalent. + opts.reset(new fst.RandGenOptions[fst.RandArcSelection](ras, max_length, + 1, False, False)) + if seed == 0: + seed = time(NULL) + getpid() + return fst.RandEquivalent(deref(ifst1._fst), deref(ifst2._fst), npath, delta, + seed, deref(opts)) + + +cpdef _MutableFst randgen(_Fst ifst, + int32 npath=1, + time_t seed=0, + select=b"uniform", + int32 max_length=INT32_MAX, + bool weighted=False, + bool remove_total_weight=False): + """ + randgen(ifst, npath=1, seed=0, select="uniform", max_length=2147483647, + weighted=False, remove_total_weight=False) + + Randomly generate successful paths in an FST. + + This operation randomly generates a set of successful paths in the input FST. + This relies on a mechanism for selecting arcs, specified using the `select` + argument. The default selector, "uniform", randomly selects a transition + using a uniform distribution. The "log_prob" selector randomly selects a + transition w.r.t. the weights treated as negative log probabilities after + normalizing for the total weight leaving the state. In all cases, finality is + treated as a transition to a super-final state. + + Args: + ifst: The input FST. + npath: The number of random paths to generate. + seed: An optional seed value for random path generation; if zero, the + current time and process ID is used. + select: A string matching a known random arc selection type; one of: + "uniform", "log_prob", "fast_log_prob". + max_length: The maximum length of each random path. + weighted: Should the output be weighted by path count? + remove_total_weight: Should the total weight be removed (ignored when + `weighted` is False)? + + Returns: + An FST containing one or more random paths. + + See also: `randequivalent`. + """ + cdef fst.RandArcSelection ras = _get_rand_arc_selection(tostring(select)) + cdef unique_ptr[fst.RandGenOptions[fst.RandArcSelection]] opts + opts.reset(new fst.RandGenOptions[fst.RandArcSelection](ras, max_length, + npath, weighted, + remove_total_weight)) + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + if seed == 0: + seed = time(NULL) + getpid() + fst.RandGen(deref(ifst._fst), tfst.get(), seed, deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef _MutableFst replace(pairs, + call_arc_labeling=b"input", + return_arc_labeling=b"neither", + bool epsilon_on_replace=False, + int64 return_label=0): + """ + replace(pairs, call_arc_labeling="input", return_arc_labeling="neither", + epsilon_on_replace=False, return_label=0) + + Recursively replaces arcs in the FST with other FST(s). + + This operation performs the dynamic replacement of arcs in one FST with + another FST, allowing the definition of FSTs analogous to RTNs. It takes as + input a set of pairs of a set of pairs formed by a non-terminal label and + its corresponding FST, and a label identifying the root FST in that set. + The resulting FST is obtained by taking the root FST and recursively replacing + each arc having a nonterminal as output label by its corresponding FST. More + precisely, an arc from state s to state d with (nonterminal) output label n in + this FST is replaced by redirecting this "call" arc to the initial state of a + copy F of the FST for n, and adding "return" arcs from each final state of F + to d. Optional arguments control how the call and return arcs are labeled; by + default, the only non-epsilon label is placed on the call arc. + + Args: + + pairs: An iterable of (nonterminal label, FST) pairs, where the former is an + unsigned integer and the latter is an Fst instance. + call_arc_labeling: A string indicating which call arc labels should be + non-epsilon. One of: "input" (default), "output", "both", "neither". + This value is set to "neither" if epsilon_on_replace is True. + return_arc_labeling: A string indicating which return arc labels should be + non-epsilon. One of: "input", "output", "both", "neither" (default). + This value is set to "neither" if epsilon_on_replace is True. + epsilon_on_replace: Should call and return arcs be epsilon arcs? If True, + this effectively overrides call_arc_labeling and return_arc_labeling, + setting both to "neither". + return_label: The integer label for return arcs. + + Returns: + An FST resulting from expanding the input RTN. + """ + cdef vector[fst.LabelFstClassPair] _pairs + cdef int64 root_label + cdef int64 label + cdef _Fst ifst + it = iter(pairs) + (root_label, ifst) = next(it) + _pairs.push_back(fst.LabelFstClassPair(root_label, ifst._fst.get())) + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + for (label, ifst) in it: + _pairs.push_back(fst.LabelFstClassPair(label, ifst._fst.get())) + cdef fst.ReplaceLabelType cal = _get_replace_label_type( + tostring(call_arc_labeling), epsilon_on_replace) + cdef fst.ReplaceLabelType ral = _get_replace_label_type( + tostring(return_arc_labeling), epsilon_on_replace) + cdef unique_ptr[fst.ReplaceOptions] opts + opts.reset(new fst.ReplaceOptions(root_label, cal, ral, return_label)) + fst.Replace(_pairs, tfst.get(), deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef _MutableFst reverse(_Fst ifst, bool require_superinitial=True): + """ + reverse(ifst, require_superinitial=True) + + Constructively reverses an FST's transduction. + + This operation reverses an FST. If A transduces string x to y with weight a, + then the reverse of A transduces the reverse of x to the reverse of y with + weight a.Reverse(). (Typically, a = a.Reverse() and Arc = RevArc, e.g., + TropicalWeight and LogWeight.) In general, e.g., when the weights only form a + left or right semiring, the output arc type must match the input arc type. + + Args: + ifst: The input FST. + require_superinitial: Should a superinitial state be created? + + Returns: + A reversed FST. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + fst.Reverse(deref(ifst._fst), tfst.get(), require_superinitial) + return _init_MutableFst(tfst.release()) + + +# Pure C++ helper for shortestdistance. + + +cdef vector[fst.WeightClass] *_shortestdistance(_Fst ifst, + float delta=fst.kShortestDelta, + int64 nstate=fst.kNoStateId, + queue_type=b"auto", + bool reverse=False) except *: + cdef unique_ptr[vector[fst.WeightClass]] distance + distance.reset(new vector[fst.WeightClass]()) + # For scoping reasons, these have to be declared here even though they may + # not be used in all cases. + cdef unique_ptr[fst.ShortestDistanceOptions] opts + if reverse: + # Only the simpler signature supports shortest distance to final states; + # `nstate` and `queue_type` arguments are ignored. + fst.ShortestDistance(deref(ifst._fst), distance.get(), True, delta) + else: + opts.reset(new fst.ShortestDistanceOptions( + _get_queue_type(tostring(queue_type)), fst.ANY_ARC_FILTER, nstate, + delta)) + fst.ShortestDistance(deref(ifst._fst), distance.get(), deref(opts)) + return distance.release() + + +def shortestdistance(_Fst ifst, + float delta=fst.kShortestDelta, + int64 nstate=fst.kNoStateId, + queue_type=b"auto", + bool reverse=False): + """ + shortestdistance(ifst, delta=1e-6, nstate=NO_STATE_ID, + queue_type="auto", reverse=False) + + Compute the shortest distance from the initial or final state. + + This operation computes the shortest distance from the initial state (when + `reverse` is False) or from every state to the final state (when `reverse` is + True). The shortest distance from p to q is the \otimes-sum of the weights of + all the paths between p and q. The weights must be right (if `reverse` is + False) or left (if `reverse` is True) distributive, and k-closed (i.e., 1 + \otimes x \otimes x^2 \otimes ... \otimes x^{k + 1} = 1 \otimes x \otimes x^2 + \otimes ... \otimes x^k; e.g., TropicalWeight). + + Args: + ifst: The input FST. + delta: Comparison/quantization delta. + nstate: State number threshold (ignored if `reverse` is True). + queue_type: A string matching a known queue type; one of: "auto", "fifo", + "lifo", "shortest", "state", "top" (ignored if `reverse` is True). + reverse: Should the reverse distance (from each state to the final state) + be computed? + + Returns: + A list of Weight objects representing the shortest distance for each state. + """ + cdef unique_ptr[vector[fst.WeightClass]] distance + distance.reset(_shortestdistance(ifst, delta, nstate, queue_type, reverse)) + cdef string weight_type = ifst.weight_type() + return [Weight(weight_type, weight.ToString()) for weight in deref(distance)] + + +cpdef _MutableFst shortestpath(_Fst ifst, + float delta=fst.kShortestDelta, + int32 nshortest=1, + int64 nstate=fst.kNoStateId, + queue_type=b"auto", + bool unique=False, + weight=None): + """ + shortestpath(ifst, delta=1e-6, nshortest=1, nstate=NO_STATE_ID, + queue_type="auto", unique=False, weight=None) + + Construct an FST containing the shortest path(s) in the input FST. + + This operation produces an FST containing the n-shortest paths in the input + FST. The n-shortest paths are the n-lowest weight paths w.r.t. the natural + semiring order. The single path that can be read from the ith of at most n + transitions leaving the initial state of the resulting FST is the ith + shortest path. The weights need to be right distributive and have the path + property. They also need to be left distributive as well for n-shortest with + n > 1 (e.g., TropicalWeight). + + Args: + ifst: The input FST. + delta: Comparison/quantization delta. + nshortest: The number of paths to return. + nstate: State number threshold. + queue_type: A string matching a known queue type; one of: "auto", "fifo", + "lifo", "shortest", "state", "top". + unique: Should the resulting FST only contain distinct paths? (Requires + the input FST to be an acceptor; epsilons are treated as if they are + regular symbols.) + weight: A Weight or weight string indicating the desired weight threshold + below which paths are pruned; if omitted, no paths are pruned. + + Returns: + An FST containing the n-shortest paths. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + # Threshold is set to semiring Zero (no pruning) if no weight is specified. + cdef fst.WeightClass wc = _get_WeightClass_or_Zero(ifst.weight_type(), weight) + cdef unique_ptr[fst.ShortestPathOptions] opts + opts.reset(new fst.ShortestPathOptions(_get_queue_type(tostring(queue_type)), + nshortest, unique, delta, wc, nstate)) + fst.ShortestPath(deref(ifst._fst), tfst.get(), deref(opts)) + return _init_MutableFst(tfst.release()) + + +cpdef _Fst statemap(_Fst ifst, map_type): + """ + state_map(ifst, map_type) + + Constructively applies a transform to all states. + + This operation transforms each state according to the requested map type. + Note that currently, only one state-mapping operation is supported. + + Args: + ifst: The input FST. + map_type: A string matching a known mapping operation; one of: "arc_sum" + (sum weights of identically-labeled multi-arcs), "arc_unique" (deletes + non-unique identically-labeled multi-arcs). + + Returns: + An FST with states remapped. + + Raises: + FstArgError: Unknown map type. + + See also: `arcmap`. + """ + return _map(ifst, fst.kDelta, map_type, 1., None) + + +cpdef _MutableFst synchronize(_Fst ifst): + """ + synchronize(ifst) + + Constructively synchronizes an FST. + + This operation synchronizes a transducer. The result will be an equivalent + FST that has the property that during the traversal of a path, the delay is + either zero or strictly increasing, where the delay is the difference between + the number of non-epsilon output labels and input labels along the path. For + the algorithm to terminate, the input transducer must have bounded delay, + i.e., the delay of every cycle must be zero. + + Args: + ifst: The input FST. + + Returns: + An equivalent synchronized FST. + """ + cdef unique_ptr[fst.VectorFstClass] tfst + tfst.reset(new fst.VectorFstClass(ifst.arc_type())) + fst.Synchronize(deref(ifst._fst), tfst.get()) + return _init_MutableFst(tfst.release()) + + +## Compiler. + + +cdef class Compiler(object): + + """ + Compiler(fst_type="vector", arc_type="standard", isymbols=None, + osymbols=None, ssymbols=None, acceptor=False, keep_isymbols=False, + keep_osymbols=False, keep_state_numbering=False, + allow_negative_labels=False) + + Class used to compile FSTs from strings. + + This class is used to compile FSTs specified using the AT&T FSM library + format described here: + + http://web.eecs.umich.edu/~radev/NLP-fall2015/resources/fsm_archive/fsm.5.html + + This is the same format used by the `fstcompile` executable. + + Compiler options (symbol tables, etc.) are set at construction time. + + compiler = fst.Compiler(isymbols=ascii_syms, osymbols=ascii_syms) + + Once constructed, Compiler instances behave like a file handle opened for + writing: + + # /ba+/ + compiler.write("0 1 50 50") + compiler.write("1 2 49 49") + compiler.write("2 2 49 49") + compiler.write("2") + + The `compile` method returns an actual FST instance: + + sheep_machine = compiler.compile() + + Compilation flushes the internal buffer, so the compiler instance can be + reused to compile new machines with the same symbol tables (etc.) + + Args: + fst_type: A string indicating the container type for the compiled FST. + arc_type: A string indicating the arc type for the compiled FST. + isymbols: An optional SymbolTable used to label input symbols. + osymbols: An optional SymbolTable used to label output symbols. + ssymbols: An optional SymbolTable used to label states. + acceptor: Should the FST be rendered in acceptor format if possible? + keep_isymbols: Should the input symbol table be stored in the FST? + keep_osymbols: Should the output symbol table be stored in the FST? + keep_state_numbering: Should the state numbering be preserved? + allow_negative_labels: Should negative labels be allowed? (Not + recommended; may cause conflicts). + """ + + def __cinit__(self, + string fst_type=b"vector", + string arc_type=b"standard", + SymbolTable isymbols=None, + SymbolTable osymbols=None, + SymbolTable ssymbols=None, + bool acceptor=False, + bool keep_isymbols=False, + bool keep_osymbols=False, + bool keep_state_numbering=False, + bool allow_negative_labels=False): + self._sstrm.reset(new stringstream()) + self._fst_type = tostring(fst_type) + self._arc_type = tostring(arc_type) + self._isymbols = NULL + if isymbols is not None: + self._isymbols = isymbols._table + self._osymbols = NULL + if osymbols is not None: + self._osymbols = osymbols._table + self._ssymbols = NULL + if ssymbols is not None: + self._ssymbols = ssymbols._table + self._acceptor = acceptor + self._keep_isymbols = keep_isymbols + self._keep_osymbols = keep_osymbols + self._keep_state_numbering = keep_state_numbering + self._allow_negative_labels = allow_negative_labels + + cpdef _Fst compile(self): + """ + compile() + + Compiles the FST in the compiler string buffer. + + This method compiles the FST and returns the resulting machine. + + Returns: + The FST described by the compiler string buffer. + + Raises: + FstOpError: Compilation failed. + """ + cdef unique_ptr[fst.FstClass] tfst + tfst.reset(fst.CompileFstInternal(deref(self._sstrm), + b"", self._fst_type, self._arc_type, self._isymbols, + self._osymbols, self._ssymbols, self._acceptor, self._keep_isymbols, + self._keep_osymbols, self._keep_state_numbering, + self._allow_negative_labels)) + self._sstrm.reset(new stringstream()) + if tfst.get() == NULL: + raise FstOpError("Compilation failed") + return _init_XFst(tfst.release()) + + cpdef void write(self, expression): + """ + write(expression) + + Writes a string into the compiler string buffer. + + This method adds a line to the compiler string buffer. It is normally + invoked using the right shift operator, like so: + + compiler = fst.Compiler() + compiler.write("0 0 49 49") + compiler.write("0") + + Args: + expression: A string expression to add to compiler string buffer. + """ + cdef string line = tostring(expression) + if not line.empty() and line.back() != b'\n': + line.append(b'\n') + deref(self._sstrm) << line + + +## FarReader and FarWriter. + + +cdef class FarReader(object): + + """ + (No constructor.) + + FAR ("Fst ARchive") reader object. + + This class is used to read a FAR from disk. FARs contain one or more FSTs (of + the same arc type) indexed by a unique string key. To construct a FarReader + object, use the `open` class method. + + Attributes: + arc_type: A string indicating the arc type. + far_type: A string indicating the FAR type. + """ + + def __init__(self): + raise FstDeletedConstructorError( + "Cannot construct {}".format(self.__class__.__name__)) + + def __repr__(self): + return "<{} FarReader at 0x{:x}>".format(self.far_type(), id(self)) + + @classmethod + def open(cls, *filenames): + """ + FarReader.open(*filenames) + + Creates a FarReader object. + + This class method creates a FarReader given the string location of one or + more FAR files on disk. + + Args: + *filenames: The string location of one or more input FAR files. + + Returns: + A new FarReader instance. + + Raises: + FstIOError: Read failed. + """ + cdef vector[string] filename_strings + for filename in filenames: + filename_strings.push_back(tostring(filename)) + cdef unique_ptr[fst.FarReaderClass] tfar + tfar.reset(fst.FarReaderClass.Open(filename_strings)) + if tfar.get() == NULL: + raise FstIOError("Read failed: {!r}".format(filenames)) + cdef FarReader result = FarReader.__new__(FarReader) + result._reader.reset(tfar.release()) + return result + + cpdef string arc_type(self): + """ + arc_type(self) + + Returns a string indicating the arc type. + """ + return self._reader.get().ArcType() + + cpdef bool done(self): + """ + done(self) + + Indicates whether the iterator is exhausted or not. + + Returns: + True if the iterator is exhausted, False otherwise. + """ + return self._reader.get().Done() + + cpdef bool error(self): + """ + error(self) + + Indicates whether the FarReader has encountered an error. + + Returns: + True if the FarReader is in an errorful state, False otherwise. + """ + return self._reader.get().Error() + + cpdef string far_type(self): + return fst.GetFarTypeString(self._reader.get().Type()) + + cpdef bool find(self, key) except *: + """ + find(self, key) + + Sets the current position to the first entry greater than or equal to the + key (a string) and indicates whether or not a match was found. + + Args: + key: A string key. + + Returns: + True if the key was found, False otherwise. + """ + return self._reader.get().Find(tostring(key)) + + cpdef _Fst get_fst(self): + """ + get_fst(self) + + Returns the FST at the current position. + + Returns: + A copy of the FST at the current position. + """ + return _init_XFst(new fst.FstClass( + deref(self._reader.get().GetFstClass()))) + + cpdef string get_key(self): + """ + get_key(self) + + Returns the string key at the current position. + + Returns: + The string key at the current position. + """ + return self._reader.get().GetKey() + + cpdef void next(self): + """ + next(self) + + Advances the iterator. + """ + self._reader.get().Next() + + cpdef void reset(self): + """ + reset(self) + + Resets the iterator to the initial position. + """ + self._reader.get().Reset() + + def __getitem__(self, key): + if self._reader.get().Find(tostring(key)): + return self.get_fst() + else: + raise KeyError(key) + + +cdef class FarWriter(object): + + """ + (No constructor.) + + FAR ("Fst ARchive") writer object. + + This class is used to write FSTs (of the same arc type) to a FAR on disk. To + construct a FarWriter, use the `create` class method. + + Note that the data is not guaranteed to flush to disk until the FarWriter + is garbage-collected. If a FarWriter has been assigned to only one variable, + then calling `del` on that variable should decrement the object's reference + count from 1 to 0, triggering a flush to disk on the next GC cycle. + + Attributes: + arc_type: A string indicating the arc type. + far_type: A string indicating the FAR type. + """ + + def __init__(self): + raise FstDeletedConstructorError( + "Cannot construct {}".format(self.__class__.__name__)) + + def __repr__(self): + return "<{} FarWriter at 0x{:x}>".format(self.far_type(), id(self)) + + @classmethod + def create(cls, filename, arc_type=b"standard", far_type=b"default"): + """ + FarWriter. + + Creates a FarWriter object. + + This class method creates a FarWriter given the desired output location, + arc type, and FAR type. + + Args: + filename: The string location for the output FAR files. + arc_type: A string indicating the arc type. + far_type: A string indicating the FAR type; one of: "fst", "stlist", + "sttable", "sstable", "default". + + Returns: + A new FarWriter instance. + + Raises: + FstIOError: Read failed. + """ + cdef fst.FarType ft = fst.GetFarType(tostring(far_type)) + cdef fst.FarWriterClass *tfar = fst.FarWriterClass.Create( + tostring(filename), tostring(arc_type), ft) + if tfar == NULL: + raise FstIOError("Open failed: {!r}".format(filename)) + cdef FarWriter result = FarWriter.__new__(FarWriter) + result._writer.reset(tfar) + return result + + # NB: Invoking this method may be dangerous: calling any other method on the + # instance after this is invoked may result in a null dereference. + cdef void close(self): + self._writer.reset() + + cpdef void add(self, key, _Fst ifst) except *: + """ + add(self, key, ifst) + + Adds an FST to the FAR. + + This method adds an FST to the FAR which can be retrieved with the + specified string key. + + Args: + key: The string used to key the input FST. + ifst: The FST to write to the FAR. + + Raises: + FstArgError: Key out of order. + FstOpError: Incompatible or invalid arc type. + """ + # Failure here results from passing an FST with a different arc type than + # used by the FAR was initialized to use. + if not self._writer.get().Add(tostring(key), deref(ifst._fst)): + raise FstOpError("Incompatible or invalid arc type") + # An error here usually indicates a key out of order. + if self._writer.get().Error(): + raise FstArgError("Key out of order") + + cpdef string arc_type(self): + """ + arc_type(self) + + Returns a string indicating the arc type. + """ + return self._writer.get().ArcType() + + cpdef bool error(self): + """ + error(self) + + Indicates whether the FarWriter has encountered an error. + + Returns: + True if the FarWriter is in an errorful state, False otherwise. + """ + return self._writer.get().Error() + + cpdef string far_type(self): + """ + far_type(self) + + Returns a string indicating the FAR type. + """ + return fst.GetFarTypeString(self._writer.get().Type()) + + # Dictionary-like assignment. + def __setitem__(self, key, _Fst fst): + self.add(key, fst) + +# Masks fst_error_fatal in-module. +fst.FLAGS_fst_error_fatal = False diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/special/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/extensions/special/CMakeLists.txt new file mode 100644 index 0000000..9c71b75 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/special/CMakeLists.txt @@ -0,0 +1,67 @@ +file(GLOB HEADER_FILES ../../include/fst/extensions/special/*.h) +message(STATUS "${HEADER_FILES}") + +if(HAVE_BIN) + add_executable(fstspecial-bin + ../../bin/fstconvert.cc + ../../bin/fstconvert-main.cc + phi-fst.cc + rho-fst.cc + sigma-fst.cc + ) + + set_target_properties(fstspecial-bin PROPERTIES + FOLDER special/bin + OUTPUT_NAME fstspecial + ) + + target_link_libraries(fstspecial-bin + fstscript + fst + ${CMAKE_DL_LIBS} + ) +endif(HAVE_BIN) + + +add_library(fstspecial + phi-fst.cc + rho-fst.cc + sigma-fst.cc + ${HEADER_FILES} +) + +set_target_properties(fstspecial PROPERTIES + SOVERSION "${SOVERSION}" + FOLDER special +) +target_link_libraries(fstspecial + fst +) + +set(FST_SPECIAL_INSTALL_TARGETS fstspecial) +if(HAVE_BIN) + list(APPEND FST_SPECIAL_INSTALL_TARGETS fstspecial-bin) +endif() + +install(TARGETS ${FST_SPECIAL_INSTALL_TARGETS} + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib +) + +function (add_module _name) + add_library(${ARGV}) + if (TARGET ${_name}) + target_link_libraries(${_name} fst) + set_target_properties(${_name} + PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true + FOLDER special/modules + ) + endif() + + install(TARGETS ${_name} LIBRARY DESTINATION lib/fst) +endfunction() + +add_module(phi-fst MODULE phi-fst.cc) +add_module(rho-fst MODULE rho-fst.cc) +add_module(sigma-fst MODULE sigma-fst.cc) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/special/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/extensions/special/Makefile.am new file mode 100644 index 0000000..c5c135f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/special/Makefile.am @@ -0,0 +1,32 @@ +AM_CPPFLAGS = -I$(srcdir)/../../include -I$(srcdir)/../../bin $(ICU_CPPFLAGS) + +if HAVE_BIN +bin_PROGRAMS = fstspecial + +LDADD = ../../script/libfstscript.la \ + ../../lib/libfst.la -lm $(DL_LIBS) + +fstspecial_SOURCES = fstspecial.cc phi-fst.cc rho-fst.cc sigma-fst.cc +fstspecial_CPPFLAGS = $(AM_CPPFLAGS) +endif + +libfstdir = @libfstdir@ +libfst_LTLIBRARIES = phi-fst.la rho-fst.la sigma-fst.la + +lib_LTLIBRARIES = libfstspecial.la + +libfstspecial_la_SOURCES = phi-fst.cc rho-fst.cc sigma-fst.cc +libfstspecial_la_LDFLAGS = -version-info 16:0:0 -lm $(DL_LIBS) +libfstspecial_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) + +phi_fst_la_SOURCES = phi-fst.cc +phi_fst_la_LDFLAGS = -module +phi_fst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) + +rho_fst_la_SOURCES = rho-fst.cc +rho_fst_la_LDFLAGS = -module +rho_fst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) + +sigma_fst_la_SOURCES = sigma-fst.cc +sigma_fst_la_LDFLAGS = -module +sigma_fst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/special/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/extensions/special/Makefile.in new file mode 100644 index 0000000..dc98482 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/special/Makefile.in @@ -0,0 +1,889 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_BIN_TRUE@bin_PROGRAMS = fstspecial$(EXEEXT) +subdir = src/extensions/special +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" \ + "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(libfst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libfstspecial_la_DEPENDENCIES = ../../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am_libfstspecial_la_OBJECTS = phi-fst.lo rho-fst.lo sigma-fst.lo +libfstspecial_la_OBJECTS = $(am_libfstspecial_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstspecial_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstspecial_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +phi_fst_la_DEPENDENCIES = ../../lib/libfst.la $(am__DEPENDENCIES_1) +am_phi_fst_la_OBJECTS = phi-fst.lo +phi_fst_la_OBJECTS = $(am_phi_fst_la_OBJECTS) +phi_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(phi_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +rho_fst_la_DEPENDENCIES = ../../lib/libfst.la $(am__DEPENDENCIES_1) +am_rho_fst_la_OBJECTS = rho-fst.lo +rho_fst_la_OBJECTS = $(am_rho_fst_la_OBJECTS) +rho_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(rho_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +sigma_fst_la_DEPENDENCIES = ../../lib/libfst.la $(am__DEPENDENCIES_1) +am_sigma_fst_la_OBJECTS = sigma-fst.lo +sigma_fst_la_OBJECTS = $(am_sigma_fst_la_OBJECTS) +sigma_fst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(sigma_fst_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(bin_PROGRAMS) +am__fstspecial_SOURCES_DIST = fstspecial.cc phi-fst.cc rho-fst.cc \ + sigma-fst.cc +@HAVE_BIN_TRUE@am_fstspecial_OBJECTS = \ +@HAVE_BIN_TRUE@ fstspecial-fstspecial.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstspecial-phi-fst.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstspecial-rho-fst.$(OBJEXT) \ +@HAVE_BIN_TRUE@ fstspecial-sigma-fst.$(OBJEXT) +fstspecial_OBJECTS = $(am_fstspecial_OBJECTS) +fstspecial_LDADD = $(LDADD) +@HAVE_BIN_TRUE@fstspecial_DEPENDENCIES = ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstspecial_la_SOURCES) $(phi_fst_la_SOURCES) \ + $(rho_fst_la_SOURCES) $(sigma_fst_la_SOURCES) \ + $(fstspecial_SOURCES) +DIST_SOURCES = $(libfstspecial_la_SOURCES) $(phi_fst_la_SOURCES) \ + $(rho_fst_la_SOURCES) $(sigma_fst_la_SOURCES) \ + $(am__fstspecial_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../../include -I$(srcdir)/../../bin $(ICU_CPPFLAGS) +@HAVE_BIN_TRUE@LDADD = ../../script/libfstscript.la \ +@HAVE_BIN_TRUE@ ../../lib/libfst.la -lm $(DL_LIBS) + +@HAVE_BIN_TRUE@fstspecial_SOURCES = fstspecial.cc phi-fst.cc rho-fst.cc sigma-fst.cc +@HAVE_BIN_TRUE@fstspecial_CPPFLAGS = $(AM_CPPFLAGS) +libfst_LTLIBRARIES = phi-fst.la rho-fst.la sigma-fst.la +lib_LTLIBRARIES = libfstspecial.la +libfstspecial_la_SOURCES = phi-fst.cc rho-fst.cc sigma-fst.cc +libfstspecial_la_LDFLAGS = -version-info 16:0:0 -lm $(DL_LIBS) +libfstspecial_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +phi_fst_la_SOURCES = phi-fst.cc +phi_fst_la_LDFLAGS = -module +phi_fst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +rho_fst_la_SOURCES = rho-fst.cc +rho_fst_la_LDFLAGS = -module +rho_fst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +sigma_fst_la_SOURCES = sigma-fst.cc +sigma_fst_la_LDFLAGS = -module +sigma_fst_la_LIBADD = ../../lib/libfst.la -lm $(DL_LIBS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/extensions/special/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/extensions/special/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-libfstLTLIBRARIES: $(libfst_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libfstdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libfstdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libfstdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libfstdir)"; \ + } + +uninstall-libfstLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libfst_LTLIBRARIES)'; test -n "$(libfstdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libfstdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libfstdir)/$$f"; \ + done + +clean-libfstLTLIBRARIES: + -test -z "$(libfst_LTLIBRARIES)" || rm -f $(libfst_LTLIBRARIES) + @list='$(libfst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstspecial.la: $(libfstspecial_la_OBJECTS) $(libfstspecial_la_DEPENDENCIES) $(EXTRA_libfstspecial_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstspecial_la_LINK) -rpath $(libdir) $(libfstspecial_la_OBJECTS) $(libfstspecial_la_LIBADD) $(LIBS) + +phi-fst.la: $(phi_fst_la_OBJECTS) $(phi_fst_la_DEPENDENCIES) $(EXTRA_phi_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(phi_fst_la_LINK) -rpath $(libfstdir) $(phi_fst_la_OBJECTS) $(phi_fst_la_LIBADD) $(LIBS) + +rho-fst.la: $(rho_fst_la_OBJECTS) $(rho_fst_la_DEPENDENCIES) $(EXTRA_rho_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(rho_fst_la_LINK) -rpath $(libfstdir) $(rho_fst_la_OBJECTS) $(rho_fst_la_LIBADD) $(LIBS) + +sigma-fst.la: $(sigma_fst_la_OBJECTS) $(sigma_fst_la_DEPENDENCIES) $(EXTRA_sigma_fst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(sigma_fst_la_LINK) -rpath $(libfstdir) $(sigma_fst_la_OBJECTS) $(sigma_fst_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +fstspecial$(EXEEXT): $(fstspecial_OBJECTS) $(fstspecial_DEPENDENCIES) $(EXTRA_fstspecial_DEPENDENCIES) + @rm -f fstspecial$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fstspecial_OBJECTS) $(fstspecial_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstspecial-fstspecial.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstspecial-phi-fst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstspecial-rho-fst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstspecial-sigma-fst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phi-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rho-fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigma-fst.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +fstspecial-fstspecial.o: fstspecial.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-fstspecial.o -MD -MP -MF $(DEPDIR)/fstspecial-fstspecial.Tpo -c -o fstspecial-fstspecial.o `test -f 'fstspecial.cc' || echo '$(srcdir)/'`fstspecial.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-fstspecial.Tpo $(DEPDIR)/fstspecial-fstspecial.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='fstspecial.cc' object='fstspecial-fstspecial.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-fstspecial.o `test -f 'fstspecial.cc' || echo '$(srcdir)/'`fstspecial.cc + +fstspecial-fstspecial.obj: fstspecial.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-fstspecial.obj -MD -MP -MF $(DEPDIR)/fstspecial-fstspecial.Tpo -c -o fstspecial-fstspecial.obj `if test -f 'fstspecial.cc'; then $(CYGPATH_W) 'fstspecial.cc'; else $(CYGPATH_W) '$(srcdir)/fstspecial.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-fstspecial.Tpo $(DEPDIR)/fstspecial-fstspecial.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='fstspecial.cc' object='fstspecial-fstspecial.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-fstspecial.obj `if test -f 'fstspecial.cc'; then $(CYGPATH_W) 'fstspecial.cc'; else $(CYGPATH_W) '$(srcdir)/fstspecial.cc'; fi` + +fstspecial-phi-fst.o: phi-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-phi-fst.o -MD -MP -MF $(DEPDIR)/fstspecial-phi-fst.Tpo -c -o fstspecial-phi-fst.o `test -f 'phi-fst.cc' || echo '$(srcdir)/'`phi-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-phi-fst.Tpo $(DEPDIR)/fstspecial-phi-fst.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='phi-fst.cc' object='fstspecial-phi-fst.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-phi-fst.o `test -f 'phi-fst.cc' || echo '$(srcdir)/'`phi-fst.cc + +fstspecial-phi-fst.obj: phi-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-phi-fst.obj -MD -MP -MF $(DEPDIR)/fstspecial-phi-fst.Tpo -c -o fstspecial-phi-fst.obj `if test -f 'phi-fst.cc'; then $(CYGPATH_W) 'phi-fst.cc'; else $(CYGPATH_W) '$(srcdir)/phi-fst.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-phi-fst.Tpo $(DEPDIR)/fstspecial-phi-fst.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='phi-fst.cc' object='fstspecial-phi-fst.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-phi-fst.obj `if test -f 'phi-fst.cc'; then $(CYGPATH_W) 'phi-fst.cc'; else $(CYGPATH_W) '$(srcdir)/phi-fst.cc'; fi` + +fstspecial-rho-fst.o: rho-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-rho-fst.o -MD -MP -MF $(DEPDIR)/fstspecial-rho-fst.Tpo -c -o fstspecial-rho-fst.o `test -f 'rho-fst.cc' || echo '$(srcdir)/'`rho-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-rho-fst.Tpo $(DEPDIR)/fstspecial-rho-fst.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='rho-fst.cc' object='fstspecial-rho-fst.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-rho-fst.o `test -f 'rho-fst.cc' || echo '$(srcdir)/'`rho-fst.cc + +fstspecial-rho-fst.obj: rho-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-rho-fst.obj -MD -MP -MF $(DEPDIR)/fstspecial-rho-fst.Tpo -c -o fstspecial-rho-fst.obj `if test -f 'rho-fst.cc'; then $(CYGPATH_W) 'rho-fst.cc'; else $(CYGPATH_W) '$(srcdir)/rho-fst.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-rho-fst.Tpo $(DEPDIR)/fstspecial-rho-fst.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='rho-fst.cc' object='fstspecial-rho-fst.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-rho-fst.obj `if test -f 'rho-fst.cc'; then $(CYGPATH_W) 'rho-fst.cc'; else $(CYGPATH_W) '$(srcdir)/rho-fst.cc'; fi` + +fstspecial-sigma-fst.o: sigma-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-sigma-fst.o -MD -MP -MF $(DEPDIR)/fstspecial-sigma-fst.Tpo -c -o fstspecial-sigma-fst.o `test -f 'sigma-fst.cc' || echo '$(srcdir)/'`sigma-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-sigma-fst.Tpo $(DEPDIR)/fstspecial-sigma-fst.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='sigma-fst.cc' object='fstspecial-sigma-fst.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-sigma-fst.o `test -f 'sigma-fst.cc' || echo '$(srcdir)/'`sigma-fst.cc + +fstspecial-sigma-fst.obj: sigma-fst.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fstspecial-sigma-fst.obj -MD -MP -MF $(DEPDIR)/fstspecial-sigma-fst.Tpo -c -o fstspecial-sigma-fst.obj `if test -f 'sigma-fst.cc'; then $(CYGPATH_W) 'sigma-fst.cc'; else $(CYGPATH_W) '$(srcdir)/sigma-fst.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fstspecial-sigma-fst.Tpo $(DEPDIR)/fstspecial-sigma-fst.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='sigma-fst.cc' object='fstspecial-sigma-fst.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fstspecial_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fstspecial-sigma-fst.obj `if test -f 'sigma-fst.cc'; then $(CYGPATH_W) 'sigma-fst.cc'; else $(CYGPATH_W) '$(srcdir)/sigma-fst.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libfstdir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libfstLTLIBRARIES clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libfstLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ + uninstall-libfstLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libfstLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libfstLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-libLTLIBRARIES uninstall-libfstLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/special/fstspecial.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/special/fstspecial.cc new file mode 100644 index 0000000..8b64aa1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/special/fstspecial.cc @@ -0,0 +1,6 @@ +// Work-around to correctly build (e.g. distclean) with autotools +// using files in another directory that are also built there. +// See https://stackoverflow.com/questions/30379837. + +#include "fstconvert-main.cc" // NOLINT +#include "fstconvert.cc" // NOLINT diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/special/phi-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/special/phi-fst.cc new file mode 100644 index 0000000..97177bf --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/special/phi-fst.cc @@ -0,0 +1,34 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +DEFINE_int64(phi_fst_phi_label, 0, + "Label of transitions to be interpreted as phi ('failure') " + "transitions"); +DEFINE_bool(phi_fst_phi_loop, true, + "When true, a phi self loop consumes a symbol"); +DEFINE_string(phi_fst_rewrite_mode, "auto", + "Rewrite both sides when matching? One of:" + " \"auto\" (rewrite iff acceptor), \"always\", \"never\""); + +namespace fst { + +const char phi_fst_type[] = "phi"; +const char input_phi_fst_type[] = "input_phi"; +const char output_phi_fst_type[] = "output_phi"; + +static FstRegisterer PhiFst_StdArc_registerer; +static FstRegisterer PhiFst_LogArc_registerer; +static FstRegisterer PhiFst_Log64Arc_registerer; + +static FstRegisterer InputPhiFst_StdArc_registerer; +static FstRegisterer InputPhiFst_LogArc_registerer; +static FstRegisterer InputPhiFst_Log64Arc_registerer; + +static FstRegisterer OutputPhiFst_StdArc_registerer; +static FstRegisterer OutputPhiFst_LogArc_registerer; +static FstRegisterer OutputPhiFst_Log64Arc_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/special/rho-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/special/rho-fst.cc new file mode 100644 index 0000000..023d432 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/special/rho-fst.cc @@ -0,0 +1,33 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include + +DEFINE_int64(rho_fst_rho_label, 0, + "Label of transitions to be interpreted as rho ('rest') " + "transitions"); +DEFINE_string(rho_fst_rewrite_mode, "auto", + "Rewrite both sides when matching? One of:" + " \"auto\" (rewrite iff acceptor), \"always\", \"never\""); + +namespace fst { + +const char rho_fst_type[] = "rho"; +const char input_rho_fst_type[] = "input_rho"; +const char output_rho_fst_type[] = "output_rho"; + +static FstRegisterer RhoFst_StdArc_registerer; +static FstRegisterer RhoFst_LogArc_registerer; +static FstRegisterer RhoFst_Log64Arc_registerer; + +static FstRegisterer InputRhoFst_StdArc_registerer; +static FstRegisterer InputRhoFst_LogArc_registerer; +static FstRegisterer InputRhoFst_Log64Arc_registerer; + +static FstRegisterer OutputRhoFst_StdArc_registerer; +static FstRegisterer OutputRhoFst_LogArc_registerer; +static FstRegisterer OutputRhoFst_Log64Arc_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/extensions/special/sigma-fst.cc b/runtime/onnxruntime/third_party/openfst/src/extensions/special/sigma-fst.cc new file mode 100644 index 0000000..30cd6a8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/extensions/special/sigma-fst.cc @@ -0,0 +1,33 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include + +DEFINE_int64(sigma_fst_sigma_label, 0, + "Label of transitions to be interpreted as sigma ('any') " + "transitions"); +DEFINE_string(sigma_fst_rewrite_mode, "auto", + "Rewrite both sides when matching? One of:" + " \"auto\" (rewrite iff acceptor), \"always\", \"never\""); + +namespace fst { + +const char sigma_fst_type[] = "sigma"; +const char input_sigma_fst_type[] = "input_sigma"; +const char output_sigma_fst_type[] = "output_sigma"; + +static FstRegisterer SigmaFst_StdArc_registerer; +static FstRegisterer SigmaFst_LogArc_registerer; +static FstRegisterer SigmaFst_Log64Arc_registerer; + +static FstRegisterer InputSigmaFst_StdArc_registerer; +static FstRegisterer InputSigmaFst_LogArc_registerer; +static FstRegisterer InputSigmaFst_Log64Arc_registerer; + +static FstRegisterer OutputSigmaFst_StdArc_registerer; +static FstRegisterer OutputSigmaFst_LogArc_registerer; +static FstRegisterer OutputSigmaFst_Log64Arc_registerer; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/include/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/include/Makefile.am new file mode 100644 index 0000000..4c10d41 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/Makefile.am @@ -0,0 +1,134 @@ +if HAVE_COMPRESS +compress_include_headers = fst/extensions/compress/compress.h \ +fst/extensions/compress/compress-script.h fst/extensions/compress/gzfile.h \ +fst/extensions/compress/elias.h fst/extensions/compress/randmod.h +endif + +if HAVE_FAR +far_include_headers = fst/extensions/far/compile-strings.h \ +fst/extensions/far/create.h fst/extensions/far/equal.h \ +fst/extensions/far/extract.h fst/extensions/far/far.h \ +fst/extensions/far/far-class.h fst/extensions/far/farlib.h \ +fst/extensions/far/farscript.h fst/extensions/far/getters.h \ +fst/extensions/far/info.h fst/extensions/far/isomorphic.h \ +fst/extensions/far/print-strings.h fst/extensions/far/script-impl.h \ +fst/extensions/far/stlist.h fst/extensions/far/sttable.h +endif + +if HAVE_LINEAR +linear_include_headers = fst/extensions/linear/linear-fst-data-builder.h \ +fst/extensions/linear/linear-fst-data.h fst/extensions/linear/linear-fst.h \ +fst/extensions/linear/linearscript.h fst/extensions/linear/loglinear-apply.h \ +fst/extensions/linear/trie.h +endif + +if HAVE_MPDT +mpdt_include_headers = fst/extensions/mpdt/compose.h \ +fst/extensions/mpdt/expand.h fst/extensions/mpdt/info.h \ +fst/extensions/mpdt/mpdt.h fst/extensions/mpdt/mpdtlib.h \ +fst/extensions/mpdt/mpdtscript.h fst/extensions/mpdt/read_write_utils.h \ +fst/extensions/mpdt/reverse.h +endif + +if HAVE_NGRAM +ngram_include_headers = fst/extensions/ngram/bitmap-index.h \ +fst/extensions/ngram/ngram-fst.h fst/extensions/ngram/nthbit.h +endif + +if HAVE_PDT +pdt_include_headers = fst/extensions/pdt/collection.h \ +fst/extensions/pdt/compose.h fst/extensions/pdt/expand.h \ +fst/extensions/pdt/getters.h fst/extensions/pdt/info.h \ +fst/extensions/pdt/paren.h fst/extensions/pdt/pdt.h \ +fst/extensions/pdt/pdtlib.h fst/extensions/pdt/pdtscript.h \ +fst/extensions/pdt/replace.h fst/extensions/pdt/reverse.h \ +fst/extensions/pdt/shortest-path.h +endif + +if HAVE_SPECIAL +special_include_headers = fst/extensions/special/phi-fst.h \ +fst/extensions/special/rho-fst.h fst/extensions/special/sigma-fst.h +endif + +if HAVE_GRM +far_include_headers = fst/extensions/far/compile-strings.h \ +fst/extensions/far/create.h fst/extensions/far/equal.h \ +fst/extensions/far/extract.h fst/extensions/far/far.h \ +fst/extensions/far/far-class.h fst/extensions/far/farlib.h \ +fst/extensions/far/farscript.h fst/extensions/far/getters.h \ +fst/extensions/far/info.h fst/extensions/far/isomorphic.h \ +fst/extensions/far/print-strings.h fst/extensions/far/script-impl.h \ +fst/extensions/far/stlist.h fst/extensions/far/sttable.h +mpdt_include_headers = fst/extensions/mpdt/compose.h \ +fst/extensions/mpdt/expand.h fst/extensions/mpdt/info.h \ +fst/extensions/mpdt/mpdt.h fst/extensions/mpdt/mpdtlib.h \ +fst/extensions/mpdt/mpdtscript.h fst/extensions/mpdt/read_write_utils.h \ +fst/extensions/mpdt/reverse.h +pdt_include_headers = fst/extensions/pdt/collection.h \ +fst/extensions/pdt/compose.h fst/extensions/pdt/expand.h \ +fst/extensions/pdt/getters.h fst/extensions/pdt/info.h \ +fst/extensions/pdt/paren.h fst/extensions/pdt/pdt.h \ +fst/extensions/pdt/pdtlib.h fst/extensions/pdt/pdtscript.h \ +fst/extensions/pdt/replace.h fst/extensions/pdt/reverse.h \ +fst/extensions/pdt/shortest-path.h +endif + +script_include_headers = fst/script/arc-class.h \ +fst/script/arciterator-class.h fst/script/arcsort.h \ +fst/script/arg-packs.h fst/script/closure.h fst/script/compile-impl.h \ +fst/script/compile.h fst/script/compose.h fst/script/concat.h \ +fst/script/connect.h fst/script/convert.h fst/script/decode.h \ +fst/script/determinize.h fst/script/difference.h fst/script/disambiguate.h \ +fst/script/draw-impl.h fst/script/draw.h fst/script/encode.h \ +fst/script/encodemapper-class.h fst/script/epsnormalize.h fst/script/equal.h \ +fst/script/equivalent.h fst/script/fst-class.h fst/script/fstscript.h \ +fst/script/getters.h fst/script/info-impl.h fst/script/info.h \ +fst/script/intersect.h fst/script/invert.h fst/script/isomorphic.h \ +fst/script/map.h fst/script/minimize.h fst/script/print-impl.h \ +fst/script/print.h fst/script/project.h fst/script/prune.h \ +fst/script/push.h fst/script/randequivalent.h fst/script/randgen.h \ +fst/script/register.h fst/script/relabel.h fst/script/replace.h \ +fst/script/reverse.h fst/script/reweight.h fst/script/rmepsilon.h \ +fst/script/script-impl.h fst/script/shortest-distance.h \ +fst/script/shortest-path.h fst/script/stateiterator-class.h \ +fst/script/synchronize.h fst/script/text-io.h fst/script/topsort.h \ +fst/script/union.h fst/script/weight-class.h fst/script/fstscript-decl.h \ +fst/script/verify.h + +test_include_headers = fst/test/algo_test.h fst/test/fst_test.h \ +fst/test/rand-fst.h fst/test/weight-tester.h + +nobase_include_HEADERS = fst/accumulator.h fst/add-on.h fst/arc-arena.h \ +fst/arc-map.h fst/arc.h fst/arcfilter.h fst/arcsort.h fst/bi-table.h \ +fst/cache.h fst/closure.h fst/compact-fst.h fst/compat.h fst/complement.h \ +fst/compose-filter.h fst/compose.h fst/concat.h fst/config.h fst/connect.h \ +fst/const-fst.h fst/determinize.h fst/dfs-visit.h fst/difference.h \ +fst/disambiguate.h fst/edit-fst.h fst/encode.h fst/epsnormalize.h fst/equal.h \ +fst/equivalent.h fst/expanded-fst.h fst/expectation-weight.h \ +fst/factor-weight.h fst/filter-state.h fst/flags.h fst/float-weight.h \ +fst/fst-decl.h fst/fst.h fst/fstlib.h fst/generic-register.h fst/heap.h \ +fst/icu.h fst/intersect.h fst/interval-set.h fst/invert.h fst/isomorphic.h \ +fst/label-reachable.h fst/lexicographic-weight.h fst/lock.h fst/log.h \ +fst/lookahead-filter.h fst/lookahead-matcher.h fst/map.h fst/mapped-file.h \ +fst/matcher-fst.h fst/matcher.h fst/memory.h fst/minimize.h fst/mutable-fst.h \ +fst/pair-weight.h fst/partition.h fst/power-weight.h fst/product-weight.h \ +fst/project.h fst/properties.h fst/prune.h fst/push.h fst/queue.h \ +fst/randequivalent.h fst/randgen.h fst/rational.h fst/register.h \ +fst/relabel.h fst/replace-util.h fst/replace.h fst/reverse.h fst/reweight.h \ +fst/rmepsilon.h fst/rmfinalepsilon.h fst/set-weight.h fst/shortest-distance.h \ +fst/shortest-path.h fst/signed-log-weight.h fst/sparse-power-weight.h \ +fst/sparse-tuple-weight.h fst/state-map.h fst/state-reachable.h \ +fst/state-table.h fst/statesort.h fst/string-weight.h fst/string.h \ +fst/symbol-table-ops.h fst/symbol-table.h fst/synchronize.h \ +fst/test-properties.h fst/topsort.h fst/tuple-weight.h fst/types.h \ +fst/union-find.h fst/union-weight.h fst/union.h fst/util.h fst/vector-fst.h \ +fst/verify.h fst/visit.h fst/weight.h \ +$(compress_include_headers) \ +$(far_include_headers) \ +$(linear_include_headers) \ +$(mpdt_include_headers) \ +$(ngram_include_headers) \ +$(pdt_include_headers) \ +$(script_include_headers) \ +$(special_include_headers) \ +$(test_include_headers) diff --git a/runtime/onnxruntime/third_party/openfst/src/include/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/include/Makefile.in new file mode 100644 index 0000000..f1da49b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/Makefile.in @@ -0,0 +1,798 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/include +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__nobase_include_HEADERS_DIST) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__nobase_include_HEADERS_DIST = fst/accumulator.h fst/add-on.h \ + fst/arc-arena.h fst/arc-map.h fst/arc.h fst/arcfilter.h \ + fst/arcsort.h fst/bi-table.h fst/cache.h fst/closure.h \ + fst/compact-fst.h fst/compat.h fst/complement.h \ + fst/compose-filter.h fst/compose.h fst/concat.h fst/config.h \ + fst/connect.h fst/const-fst.h fst/determinize.h \ + fst/dfs-visit.h fst/difference.h fst/disambiguate.h \ + fst/edit-fst.h fst/encode.h fst/epsnormalize.h fst/equal.h \ + fst/equivalent.h fst/expanded-fst.h fst/expectation-weight.h \ + fst/factor-weight.h fst/filter-state.h fst/flags.h \ + fst/float-weight.h fst/fst-decl.h fst/fst.h fst/fstlib.h \ + fst/generic-register.h fst/heap.h fst/icu.h fst/intersect.h \ + fst/interval-set.h fst/invert.h fst/isomorphic.h \ + fst/label-reachable.h fst/lexicographic-weight.h fst/lock.h \ + fst/log.h fst/lookahead-filter.h fst/lookahead-matcher.h \ + fst/map.h fst/mapped-file.h fst/matcher-fst.h fst/matcher.h \ + fst/memory.h fst/minimize.h fst/mutable-fst.h \ + fst/pair-weight.h fst/partition.h fst/power-weight.h \ + fst/product-weight.h fst/project.h fst/properties.h \ + fst/prune.h fst/push.h fst/queue.h fst/randequivalent.h \ + fst/randgen.h fst/rational.h fst/register.h fst/relabel.h \ + fst/replace-util.h fst/replace.h fst/reverse.h fst/reweight.h \ + fst/rmepsilon.h fst/rmfinalepsilon.h fst/set-weight.h \ + fst/shortest-distance.h fst/shortest-path.h \ + fst/signed-log-weight.h fst/sparse-power-weight.h \ + fst/sparse-tuple-weight.h fst/state-map.h \ + fst/state-reachable.h fst/state-table.h fst/statesort.h \ + fst/string-weight.h fst/string.h fst/symbol-table-ops.h \ + fst/symbol-table.h fst/synchronize.h fst/test-properties.h \ + fst/topsort.h fst/tuple-weight.h fst/types.h fst/union-find.h \ + fst/union-weight.h fst/union.h fst/util.h fst/vector-fst.h \ + fst/verify.h fst/visit.h fst/weight.h \ + fst/extensions/compress/compress.h \ + fst/extensions/compress/compress-script.h \ + fst/extensions/compress/gzfile.h \ + fst/extensions/compress/elias.h \ + fst/extensions/compress/randmod.h \ + fst/extensions/far/compile-strings.h \ + fst/extensions/far/create.h fst/extensions/far/equal.h \ + fst/extensions/far/extract.h fst/extensions/far/far.h \ + fst/extensions/far/far-class.h fst/extensions/far/farlib.h \ + fst/extensions/far/farscript.h fst/extensions/far/getters.h \ + fst/extensions/far/info.h fst/extensions/far/isomorphic.h \ + fst/extensions/far/print-strings.h \ + fst/extensions/far/script-impl.h fst/extensions/far/stlist.h \ + fst/extensions/far/sttable.h \ + fst/extensions/linear/linear-fst-data-builder.h \ + fst/extensions/linear/linear-fst-data.h \ + fst/extensions/linear/linear-fst.h \ + fst/extensions/linear/linearscript.h \ + fst/extensions/linear/loglinear-apply.h \ + fst/extensions/linear/trie.h fst/extensions/mpdt/compose.h \ + fst/extensions/mpdt/expand.h fst/extensions/mpdt/info.h \ + fst/extensions/mpdt/mpdt.h fst/extensions/mpdt/mpdtlib.h \ + fst/extensions/mpdt/mpdtscript.h \ + fst/extensions/mpdt/read_write_utils.h \ + fst/extensions/mpdt/reverse.h \ + fst/extensions/ngram/bitmap-index.h \ + fst/extensions/ngram/ngram-fst.h fst/extensions/ngram/nthbit.h \ + fst/extensions/pdt/collection.h fst/extensions/pdt/compose.h \ + fst/extensions/pdt/expand.h fst/extensions/pdt/getters.h \ + fst/extensions/pdt/info.h fst/extensions/pdt/paren.h \ + fst/extensions/pdt/pdt.h fst/extensions/pdt/pdtlib.h \ + fst/extensions/pdt/pdtscript.h fst/extensions/pdt/replace.h \ + fst/extensions/pdt/reverse.h \ + fst/extensions/pdt/shortest-path.h fst/script/arc-class.h \ + fst/script/arciterator-class.h fst/script/arcsort.h \ + fst/script/arg-packs.h fst/script/closure.h \ + fst/script/compile-impl.h fst/script/compile.h \ + fst/script/compose.h fst/script/concat.h fst/script/connect.h \ + fst/script/convert.h fst/script/decode.h \ + fst/script/determinize.h fst/script/difference.h \ + fst/script/disambiguate.h fst/script/draw-impl.h \ + fst/script/draw.h fst/script/encode.h \ + fst/script/encodemapper-class.h fst/script/epsnormalize.h \ + fst/script/equal.h fst/script/equivalent.h \ + fst/script/fst-class.h fst/script/fstscript.h \ + fst/script/getters.h fst/script/info-impl.h fst/script/info.h \ + fst/script/intersect.h fst/script/invert.h \ + fst/script/isomorphic.h fst/script/map.h fst/script/minimize.h \ + fst/script/print-impl.h fst/script/print.h \ + fst/script/project.h fst/script/prune.h fst/script/push.h \ + fst/script/randequivalent.h fst/script/randgen.h \ + fst/script/register.h fst/script/relabel.h \ + fst/script/replace.h fst/script/reverse.h \ + fst/script/reweight.h fst/script/rmepsilon.h \ + fst/script/script-impl.h fst/script/shortest-distance.h \ + fst/script/shortest-path.h fst/script/stateiterator-class.h \ + fst/script/synchronize.h fst/script/text-io.h \ + fst/script/topsort.h fst/script/union.h \ + fst/script/weight-class.h fst/script/fstscript-decl.h \ + fst/script/verify.h fst/extensions/special/phi-fst.h \ + fst/extensions/special/rho-fst.h \ + fst/extensions/special/sigma-fst.h fst/test/algo_test.h \ + fst/test/fst_test.h fst/test/rand-fst.h \ + fst/test/weight-tester.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(nobase_include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@HAVE_COMPRESS_TRUE@compress_include_headers = fst/extensions/compress/compress.h \ +@HAVE_COMPRESS_TRUE@fst/extensions/compress/compress-script.h fst/extensions/compress/gzfile.h \ +@HAVE_COMPRESS_TRUE@fst/extensions/compress/elias.h fst/extensions/compress/randmod.h + +@HAVE_FAR_TRUE@far_include_headers = fst/extensions/far/compile-strings.h \ +@HAVE_FAR_TRUE@fst/extensions/far/create.h fst/extensions/far/equal.h \ +@HAVE_FAR_TRUE@fst/extensions/far/extract.h fst/extensions/far/far.h \ +@HAVE_FAR_TRUE@fst/extensions/far/far-class.h fst/extensions/far/farlib.h \ +@HAVE_FAR_TRUE@fst/extensions/far/farscript.h fst/extensions/far/getters.h \ +@HAVE_FAR_TRUE@fst/extensions/far/info.h fst/extensions/far/isomorphic.h \ +@HAVE_FAR_TRUE@fst/extensions/far/print-strings.h fst/extensions/far/script-impl.h \ +@HAVE_FAR_TRUE@fst/extensions/far/stlist.h fst/extensions/far/sttable.h + +@HAVE_GRM_TRUE@far_include_headers = fst/extensions/far/compile-strings.h \ +@HAVE_GRM_TRUE@fst/extensions/far/create.h fst/extensions/far/equal.h \ +@HAVE_GRM_TRUE@fst/extensions/far/extract.h fst/extensions/far/far.h \ +@HAVE_GRM_TRUE@fst/extensions/far/far-class.h fst/extensions/far/farlib.h \ +@HAVE_GRM_TRUE@fst/extensions/far/farscript.h fst/extensions/far/getters.h \ +@HAVE_GRM_TRUE@fst/extensions/far/info.h fst/extensions/far/isomorphic.h \ +@HAVE_GRM_TRUE@fst/extensions/far/print-strings.h fst/extensions/far/script-impl.h \ +@HAVE_GRM_TRUE@fst/extensions/far/stlist.h fst/extensions/far/sttable.h + +@HAVE_LINEAR_TRUE@linear_include_headers = fst/extensions/linear/linear-fst-data-builder.h \ +@HAVE_LINEAR_TRUE@fst/extensions/linear/linear-fst-data.h fst/extensions/linear/linear-fst.h \ +@HAVE_LINEAR_TRUE@fst/extensions/linear/linearscript.h fst/extensions/linear/loglinear-apply.h \ +@HAVE_LINEAR_TRUE@fst/extensions/linear/trie.h + +@HAVE_GRM_TRUE@mpdt_include_headers = fst/extensions/mpdt/compose.h \ +@HAVE_GRM_TRUE@fst/extensions/mpdt/expand.h fst/extensions/mpdt/info.h \ +@HAVE_GRM_TRUE@fst/extensions/mpdt/mpdt.h fst/extensions/mpdt/mpdtlib.h \ +@HAVE_GRM_TRUE@fst/extensions/mpdt/mpdtscript.h fst/extensions/mpdt/read_write_utils.h \ +@HAVE_GRM_TRUE@fst/extensions/mpdt/reverse.h + +@HAVE_MPDT_TRUE@mpdt_include_headers = fst/extensions/mpdt/compose.h \ +@HAVE_MPDT_TRUE@fst/extensions/mpdt/expand.h fst/extensions/mpdt/info.h \ +@HAVE_MPDT_TRUE@fst/extensions/mpdt/mpdt.h fst/extensions/mpdt/mpdtlib.h \ +@HAVE_MPDT_TRUE@fst/extensions/mpdt/mpdtscript.h fst/extensions/mpdt/read_write_utils.h \ +@HAVE_MPDT_TRUE@fst/extensions/mpdt/reverse.h + +@HAVE_NGRAM_TRUE@ngram_include_headers = fst/extensions/ngram/bitmap-index.h \ +@HAVE_NGRAM_TRUE@fst/extensions/ngram/ngram-fst.h fst/extensions/ngram/nthbit.h + +@HAVE_GRM_TRUE@pdt_include_headers = fst/extensions/pdt/collection.h \ +@HAVE_GRM_TRUE@fst/extensions/pdt/compose.h fst/extensions/pdt/expand.h \ +@HAVE_GRM_TRUE@fst/extensions/pdt/getters.h fst/extensions/pdt/info.h \ +@HAVE_GRM_TRUE@fst/extensions/pdt/paren.h fst/extensions/pdt/pdt.h \ +@HAVE_GRM_TRUE@fst/extensions/pdt/pdtlib.h fst/extensions/pdt/pdtscript.h \ +@HAVE_GRM_TRUE@fst/extensions/pdt/replace.h fst/extensions/pdt/reverse.h \ +@HAVE_GRM_TRUE@fst/extensions/pdt/shortest-path.h + +@HAVE_PDT_TRUE@pdt_include_headers = fst/extensions/pdt/collection.h \ +@HAVE_PDT_TRUE@fst/extensions/pdt/compose.h fst/extensions/pdt/expand.h \ +@HAVE_PDT_TRUE@fst/extensions/pdt/getters.h fst/extensions/pdt/info.h \ +@HAVE_PDT_TRUE@fst/extensions/pdt/paren.h fst/extensions/pdt/pdt.h \ +@HAVE_PDT_TRUE@fst/extensions/pdt/pdtlib.h fst/extensions/pdt/pdtscript.h \ +@HAVE_PDT_TRUE@fst/extensions/pdt/replace.h fst/extensions/pdt/reverse.h \ +@HAVE_PDT_TRUE@fst/extensions/pdt/shortest-path.h + +@HAVE_SPECIAL_TRUE@special_include_headers = fst/extensions/special/phi-fst.h \ +@HAVE_SPECIAL_TRUE@fst/extensions/special/rho-fst.h fst/extensions/special/sigma-fst.h + +script_include_headers = fst/script/arc-class.h \ +fst/script/arciterator-class.h fst/script/arcsort.h \ +fst/script/arg-packs.h fst/script/closure.h fst/script/compile-impl.h \ +fst/script/compile.h fst/script/compose.h fst/script/concat.h \ +fst/script/connect.h fst/script/convert.h fst/script/decode.h \ +fst/script/determinize.h fst/script/difference.h fst/script/disambiguate.h \ +fst/script/draw-impl.h fst/script/draw.h fst/script/encode.h \ +fst/script/encodemapper-class.h fst/script/epsnormalize.h fst/script/equal.h \ +fst/script/equivalent.h fst/script/fst-class.h fst/script/fstscript.h \ +fst/script/getters.h fst/script/info-impl.h fst/script/info.h \ +fst/script/intersect.h fst/script/invert.h fst/script/isomorphic.h \ +fst/script/map.h fst/script/minimize.h fst/script/print-impl.h \ +fst/script/print.h fst/script/project.h fst/script/prune.h \ +fst/script/push.h fst/script/randequivalent.h fst/script/randgen.h \ +fst/script/register.h fst/script/relabel.h fst/script/replace.h \ +fst/script/reverse.h fst/script/reweight.h fst/script/rmepsilon.h \ +fst/script/script-impl.h fst/script/shortest-distance.h \ +fst/script/shortest-path.h fst/script/stateiterator-class.h \ +fst/script/synchronize.h fst/script/text-io.h fst/script/topsort.h \ +fst/script/union.h fst/script/weight-class.h fst/script/fstscript-decl.h \ +fst/script/verify.h + +test_include_headers = fst/test/algo_test.h fst/test/fst_test.h \ +fst/test/rand-fst.h fst/test/weight-tester.h + +nobase_include_HEADERS = fst/accumulator.h fst/add-on.h fst/arc-arena.h \ +fst/arc-map.h fst/arc.h fst/arcfilter.h fst/arcsort.h fst/bi-table.h \ +fst/cache.h fst/closure.h fst/compact-fst.h fst/compat.h fst/complement.h \ +fst/compose-filter.h fst/compose.h fst/concat.h fst/config.h fst/connect.h \ +fst/const-fst.h fst/determinize.h fst/dfs-visit.h fst/difference.h \ +fst/disambiguate.h fst/edit-fst.h fst/encode.h fst/epsnormalize.h fst/equal.h \ +fst/equivalent.h fst/expanded-fst.h fst/expectation-weight.h \ +fst/factor-weight.h fst/filter-state.h fst/flags.h fst/float-weight.h \ +fst/fst-decl.h fst/fst.h fst/fstlib.h fst/generic-register.h fst/heap.h \ +fst/icu.h fst/intersect.h fst/interval-set.h fst/invert.h fst/isomorphic.h \ +fst/label-reachable.h fst/lexicographic-weight.h fst/lock.h fst/log.h \ +fst/lookahead-filter.h fst/lookahead-matcher.h fst/map.h fst/mapped-file.h \ +fst/matcher-fst.h fst/matcher.h fst/memory.h fst/minimize.h fst/mutable-fst.h \ +fst/pair-weight.h fst/partition.h fst/power-weight.h fst/product-weight.h \ +fst/project.h fst/properties.h fst/prune.h fst/push.h fst/queue.h \ +fst/randequivalent.h fst/randgen.h fst/rational.h fst/register.h \ +fst/relabel.h fst/replace-util.h fst/replace.h fst/reverse.h fst/reweight.h \ +fst/rmepsilon.h fst/rmfinalepsilon.h fst/set-weight.h fst/shortest-distance.h \ +fst/shortest-path.h fst/signed-log-weight.h fst/sparse-power-weight.h \ +fst/sparse-tuple-weight.h fst/state-map.h fst/state-reachable.h \ +fst/state-table.h fst/statesort.h fst/string-weight.h fst/string.h \ +fst/symbol-table-ops.h fst/symbol-table.h fst/synchronize.h \ +fst/test-properties.h fst/topsort.h fst/tuple-weight.h fst/types.h \ +fst/union-find.h fst/union-weight.h fst/union.h fst/util.h fst/vector-fst.h \ +fst/verify.h fst/visit.h fst/weight.h \ +$(compress_include_headers) \ +$(far_include_headers) \ +$(linear_include_headers) \ +$(mpdt_include_headers) \ +$(ngram_include_headers) \ +$(pdt_include_headers) \ +$(script_include_headers) \ +$(special_include_headers) \ +$(test_include_headers) + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/include/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/include/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-nobase_includeHEADERS: $(nobase_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + $(am__nobase_list) | while read dir files; do \ + xfiles=; for file in $$files; do \ + if test -f "$$file"; then xfiles="$$xfiles $$file"; \ + else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ + test -z "$$xfiles" || { \ + test "x$$dir" = x. || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \ + echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \ + $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \ + done + +uninstall-nobase_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ + $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-nobase_includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-nobase_includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man \ + install-nobase_includeHEADERS install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-nobase_includeHEADERS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/accumulator.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/accumulator.h new file mode 100644 index 0000000..5ae1924 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/accumulator.h @@ -0,0 +1,903 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes to accumulate arc weights. Useful for weight lookahead. + +#ifndef FST_ACCUMULATOR_H_ +#define FST_ACCUMULATOR_H_ + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace fst { + +// This class accumulates arc weights using the semiring Plus(). +template +class DefaultAccumulator { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + DefaultAccumulator() {} + + DefaultAccumulator(const DefaultAccumulator &acc, bool safe = false) {} + + void Init(const Fst &fst, bool copy = false) {} + + void SetState(StateId state) {} + + Weight Sum(Weight w, Weight v) { return Plus(w, v); } + + template + Weight Sum(Weight w, ArcIter *aiter, ssize_t begin, ssize_t end) { + Adder adder(w); // maintains cumulative sum accurately + aiter->Seek(begin); + for (auto pos = begin; pos < end; aiter->Next(), ++pos) + adder.Add(aiter->Value().weight); + return adder.Sum(); + } + + constexpr bool Error() const { return false; } + + private: + DefaultAccumulator &operator=(const DefaultAccumulator &) = delete; +}; + +// This class accumulates arc weights using the log semiring Plus() assuming an +// arc weight has a WeightConvert specialization to and from log64 weights. +template +class LogAccumulator { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + LogAccumulator() {} + + LogAccumulator(const LogAccumulator &acc, bool safe = false) {} + + void Init(const Fst &fst, bool copy = false) {} + + void SetState(StateId s) {} + + Weight Sum(Weight w, Weight v) { return LogPlus(w, v); } + + template + Weight Sum(Weight w, ArcIter *aiter, ssize_t begin, ssize_t end) { + auto sum = w; + aiter->Seek(begin); + for (auto pos = begin; pos < end; aiter->Next(), ++pos) { + sum = LogPlus(sum, aiter->Value().weight); + } + return sum; + } + + constexpr bool Error() const { return false; } + + private: + Weight LogPlus(Weight w, Weight v) { + if (w == Weight::Zero()) { + return v; + } + const auto f1 = to_log_weight_(w).Value(); + const auto f2 = to_log_weight_(v).Value(); + if (f1 > f2) { + return to_weight_(Log64Weight(f2 - internal::LogPosExp(f1 - f2))); + } else { + return to_weight_(Log64Weight(f1 - internal::LogPosExp(f2 - f1))); + } + } + + const WeightConvert to_log_weight_{}; + const WeightConvert to_weight_{}; + + LogAccumulator &operator=(const LogAccumulator &) = delete; +}; + +// Interface for shareable data for fast log accumulator copies. Holds pointers +// to data only, storage is provided by derived classes. +class FastLogAccumulatorData { + public: + FastLogAccumulatorData(int arc_limit, int arc_period) + : arc_limit_(arc_limit), + arc_period_(arc_period), + weights_ptr_(nullptr), + num_weights_(0), + weight_positions_ptr_(nullptr), + num_positions_(0) {} + + virtual ~FastLogAccumulatorData() {} + + // Cummulative weight per state for all states s.t. # of arcs > arc_limit_ + // with arcs in order. The first element per state is Log64Weight::Zero(). + const double *Weights() const { return weights_ptr_; } + + int NumWeights() const { return num_weights_; } + + // Maps from state to corresponding beginning weight position in weights_. + // osition -1 means no pre-computed weights for that state. + const int *WeightPositions() const { return weight_positions_ptr_; } + + int NumPositions() const { return num_positions_; } + + int ArcLimit() const { return arc_limit_; } + + int ArcPeriod() const { return arc_period_; } + + // Returns true if the data object is mutable and supports SetData(). + virtual bool IsMutable() const = 0; + + // Does not take ownership but may invalidate the contents of weights and + // weight_positions. + virtual void SetData(std::vector *weights, + std::vector *weight_positions) = 0; + + protected: + void Init(int num_weights, const double *weights, int num_positions, + const int *weight_positions) { + weights_ptr_ = weights; + num_weights_ = num_weights; + weight_positions_ptr_ = weight_positions; + num_positions_ = num_positions; + } + + private: + const int arc_limit_; + const int arc_period_; + const double *weights_ptr_; + int num_weights_; + const int *weight_positions_ptr_; + int num_positions_; + + FastLogAccumulatorData(const FastLogAccumulatorData &) = delete; + FastLogAccumulatorData &operator=(const FastLogAccumulatorData &) = delete; +}; + +// FastLogAccumulatorData with mutable storage; filled by +// FastLogAccumulator::Init. +class MutableFastLogAccumulatorData : public FastLogAccumulatorData { + public: + MutableFastLogAccumulatorData(int arc_limit, int arc_period) + : FastLogAccumulatorData(arc_limit, arc_period) {} + + bool IsMutable() const override { return true; } + + void SetData(std::vector *weights, + std::vector *weight_positions) override { + weights_.swap(*weights); + weight_positions_.swap(*weight_positions); + Init(weights_.size(), weights_.data(), weight_positions_.size(), + weight_positions_.data()); + } + + private: + std::vector weights_; + std::vector weight_positions_; + + MutableFastLogAccumulatorData(const MutableFastLogAccumulatorData &) = delete; + MutableFastLogAccumulatorData &operator=( + const MutableFastLogAccumulatorData &) = delete; +}; + +// This class accumulates arc weights using the log semiring Plus() assuming an +// arc weight has a WeightConvert specialization to and from log64 weights. The +// member function Init(fst) has to be called to setup pre-computed weight +// information. +template +class FastLogAccumulator { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit FastLogAccumulator(ssize_t arc_limit = 20, ssize_t arc_period = 10) + : to_log_weight_(), + to_weight_(), + arc_limit_(arc_limit), + arc_period_(arc_period), + data_(std::make_shared(arc_limit, + arc_period)), + state_weights_(nullptr), + error_(false) {} + + explicit FastLogAccumulator(std::shared_ptr data) + : to_log_weight_(), + to_weight_(), + arc_limit_(data->ArcLimit()), + arc_period_(data->ArcPeriod()), + data_(data), + state_weights_(nullptr), + error_(false) {} + + FastLogAccumulator(const FastLogAccumulator &acc, bool safe = false) + : to_log_weight_(), + to_weight_(), + arc_limit_(acc.arc_limit_), + arc_period_(acc.arc_period_), + data_(acc.data_), + state_weights_(nullptr), + error_(acc.error_) {} + + void SetState(StateId s) { + const auto *weights = data_->Weights(); + const auto *weight_positions = data_->WeightPositions(); + state_weights_ = nullptr; + if (s < data_->NumPositions()) { + const auto pos = weight_positions[s]; + if (pos >= 0) state_weights_ = &(weights[pos]); + } + } + + Weight Sum(Weight w, Weight v) const { return LogPlus(w, v); } + + template + Weight Sum(Weight w, ArcIter *aiter, ssize_t begin, ssize_t end) const { + if (error_) return Weight::NoWeight(); + auto sum = w; + // Finds begin and end of pre-stored weights. + ssize_t index_begin = -1; + ssize_t index_end = -1; + ssize_t stored_begin = end; + ssize_t stored_end = end; + if (state_weights_) { + index_begin = begin > 0 ? (begin - 1) / arc_period_ + 1 : 0; + index_end = end / arc_period_; + stored_begin = index_begin * arc_period_; + stored_end = index_end * arc_period_; + } + // Computes sum before pre-stored weights. + if (begin < stored_begin) { + const auto pos_end = std::min(stored_begin, end); + aiter->Seek(begin); + for (auto pos = begin; pos < pos_end; aiter->Next(), ++pos) { + sum = LogPlus(sum, aiter->Value().weight); + } + } + // Computes sum between pre-stored weights. + if (stored_begin < stored_end) { + const auto f1 = state_weights_[index_end]; + const auto f2 = state_weights_[index_begin]; + if (f1 < f2) sum = LogPlus(sum, LogMinus(f1, f2)); + // Commented out for efficiency; adds Zero(). + /* + else { + // explicitly computes if cumulative sum lacks precision + aiter->Seek(stored_begin); + for (auto pos = stored_begin; pos < stored_end; aiter->Next(), ++pos) + sum = LogPlus(sum, aiter->Value().weight); + } + */ + } + // Computes sum after pre-stored weights. + if (stored_end < end) { + const auto pos_start = std::max(stored_begin, stored_end); + aiter->Seek(pos_start); + for (auto pos = pos_start; pos < end; aiter->Next(), ++pos) { + sum = LogPlus(sum, aiter->Value().weight); + } + } + return sum; + } + + template + void Init(const FST &fst, bool copy = false) { + if (copy || !data_->IsMutable()) return; + if (data_->NumPositions() != 0 || arc_limit_ < arc_period_) { + FSTERROR() << "FastLogAccumulator: Initialization error"; + error_ = true; + return; + } + std::vector weights; + std::vector weight_positions; + weight_positions.reserve(CountStates(fst)); + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (fst.NumArcs(s) >= arc_limit_) { + auto sum = FloatLimits::PosInfinity(); + if (weight_positions.size() <= s) weight_positions.resize(s + 1, -1); + weight_positions[s] = weights.size(); + weights.push_back(sum); + size_t narcs = 0; + ArcIterator aiter(fst, s); + aiter.SetFlags(kArcWeightValue | kArcNoCache, kArcFlags); + for (; !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + sum = LogPlus(sum, arc.weight); + // Stores cumulative weight distribution per arc_period_. + if (++narcs % arc_period_ == 0) weights.push_back(sum); + } + } + } + data_->SetData(&weights, &weight_positions); + } + + bool Error() const { return error_; } + + std::shared_ptr GetData() const { return data_; } + + private: + static double LogPosExp(double x) { + return x == FloatLimits::PosInfinity() ? 0.0 + : log(1.0F + exp(-x)); + } + + static double LogMinusExp(double x) { + return x == FloatLimits::PosInfinity() ? 0.0 + : log(1.0F - exp(-x)); + } + + Weight LogPlus(Weight w, Weight v) const { + if (w == Weight::Zero()) { + return v; + } + const auto f1 = to_log_weight_(w).Value(); + const auto f2 = to_log_weight_(v).Value(); + if (f1 > f2) { + return to_weight_(Log64Weight(f2 - LogPosExp(f1 - f2))); + } else { + return to_weight_(Log64Weight(f1 - LogPosExp(f2 - f1))); + } + } + + double LogPlus(double f1, Weight v) const { + const auto f2 = to_log_weight_(v).Value(); + if (f1 == FloatLimits::PosInfinity()) { + return f2; + } else if (f1 > f2) { + return f2 - LogPosExp(f1 - f2); + } else { + return f1 - LogPosExp(f2 - f1); + } + } + + // Assumes f1 < f2. + Weight LogMinus(double f1, double f2) const { + if (f2 == FloatLimits::PosInfinity()) { + return to_weight_(Log64Weight(f1)); + } else { + return to_weight_(Log64Weight(f1 - LogMinusExp(f2 - f1))); + } + } + + const WeightConvert to_log_weight_{}; + const WeightConvert to_weight_{}; + const ssize_t arc_limit_; // Minimum number of arcs to pre-compute state. + const ssize_t arc_period_; // Saves cumulative weights per arc_period_. + std::shared_ptr data_; + const double *state_weights_; + bool error_; + + FastLogAccumulator &operator=(const FastLogAccumulator &) = delete; +}; + +// Stores shareable data for cache log accumulator copies. All copies share the +// same cache. +template +class CacheLogAccumulatorData { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + CacheLogAccumulatorData(bool gc, size_t gc_limit) + : cache_gc_(gc), cache_limit_(gc_limit), cache_size_(0) {} + + CacheLogAccumulatorData(const CacheLogAccumulatorData &data) + : cache_gc_(data.cache_gc_), + cache_limit_(data.cache_limit_), + cache_size_(0) {} + + bool CacheDisabled() const { return cache_gc_ && cache_limit_ == 0; } + + std::vector *GetWeights(StateId s) { + auto it = cache_.find(s); + if (it != cache_.end()) { + it->second.recent = true; + return it->second.weights.get(); + } else { + return nullptr; + } + } + + void AddWeights(StateId s, std::vector *weights) { + if (cache_gc_ && cache_size_ >= cache_limit_) GC(false); + cache_.insert(std::make_pair(s, CacheState(weights, true))); + if (cache_gc_) cache_size_ += weights->capacity() * sizeof(double); + } + + private: + // Cached information for a given state. + struct CacheState { + std::unique_ptr> weights; // Accumulated weights. + bool recent; // Has this state been accessed since last GC? + + CacheState(std::vector *weights, bool recent) + : weights(weights), recent(recent) {} + }; + + // Garbage collect: Deletes from cache states that have not been accessed + // since the last GC ('free_recent = false') until 'cache_size_' is 2/3 of + // 'cache_limit_'. If it does not free enough memory, start deleting + // recently accessed states. + void GC(bool free_recent) { + auto cache_target = (2 * cache_limit_) / 3 + 1; + auto it = cache_.begin(); + while (it != cache_.end() && cache_size_ > cache_target) { + auto &cs = it->second; + if (free_recent || !cs.recent) { + cache_size_ -= cs.weights->capacity() * sizeof(double); + cache_.erase(it++); + } else { + cs.recent = false; + ++it; + } + } + if (!free_recent && cache_size_ > cache_target) GC(true); + } + + std::unordered_map cache_; // Cache. + bool cache_gc_; // Enables garbage collection. + size_t cache_limit_; // # of bytes cached. + size_t cache_size_; // # of bytes allowed before GC. + + CacheLogAccumulatorData &operator=(const CacheLogAccumulatorData &) = delete; +}; + +// This class accumulates arc weights using the log semiring Plus() has a +// WeightConvert specialization to and from log64 weights. It is similar to the +// FastLogAccumator. However here, the accumulated weights are pre-computed and +// stored only for the states that are visited. The member function Init(fst) +// has to be called to setup this accumulator. +template +class CacheLogAccumulator { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit CacheLogAccumulator(ssize_t arc_limit = 10, bool gc = false, + size_t gc_limit = 10 * 1024 * 1024) + : arc_limit_(arc_limit), + data_(std::make_shared>(gc, gc_limit)), + s_(kNoStateId), + error_(false) {} + + CacheLogAccumulator(const CacheLogAccumulator &acc, bool safe = false) + : arc_limit_(acc.arc_limit_), + fst_(acc.fst_ ? acc.fst_->Copy() : nullptr), + data_(safe ? std::make_shared>(*acc.data_) + : acc.data_), + s_(kNoStateId), + error_(acc.error_) {} + + // Argument arc_limit specifies the minimum number of arcs to pre-compute. + void Init(const Fst &fst, bool copy = false) { + if (!copy && fst_) { + FSTERROR() << "CacheLogAccumulator: Initialization error"; + error_ = true; + return; + } + fst_.reset(fst.Copy()); + } + + void SetState(StateId s, int depth = 0) { + if (s == s_) return; + s_ = s; + if (data_->CacheDisabled() || error_) { + weights_ = nullptr; + return; + } + if (!fst_) { + FSTERROR() << "CacheLogAccumulator::SetState: Incorrectly initialized"; + error_ = true; + weights_ = nullptr; + return; + } + weights_ = data_->GetWeights(s); + if ((weights_ == nullptr) && (fst_->NumArcs(s) >= arc_limit_)) { + weights_ = new std::vector; + weights_->reserve(fst_->NumArcs(s) + 1); + weights_->push_back(FloatLimits::PosInfinity()); + data_->AddWeights(s, weights_); + } + } + + Weight Sum(Weight w, Weight v) { return LogPlus(w, v); } + + template + Weight Sum(Weight w, ArcIter *aiter, ssize_t begin, ssize_t end) { + if (weights_ == nullptr) { + auto sum = w; + aiter->Seek(begin); + for (auto pos = begin; pos < end; aiter->Next(), ++pos) { + sum = LogPlus(sum, aiter->Value().weight); + } + return sum; + } else { + Extend(end, aiter); + const auto &f1 = (*weights_)[end]; + const auto &f2 = (*weights_)[begin]; + if (f1 < f2) { + return LogPlus(w, LogMinus(f1, f2)); + } else { + // Commented out for efficiency; adds Zero(). + /* + auto sum = w; + // Explicitly computes if cumulative sum lacks precision. + aiter->Seek(begin); + for (auto pos = begin; pos < end; aiter->Next(), ++pos) { + sum = LogPlus(sum, aiter->Value().weight); + } + return sum; + */ + return w; + } + } + } + + // Returns first position from aiter->Position() whose accumulated + // value is greater or equal to w (w.r.t. Zero() < One()). The + // iterator may be repositioned. + template + size_t LowerBound(Weight w, ArcIter *aiter) { + const auto f = to_log_weight_(w).Value(); + auto pos = aiter->Position(); + if (weights_) { + Extend(fst_->NumArcs(s_), aiter); + return std::lower_bound(weights_->begin() + pos + 1, weights_->end(), + f, std::greater()) - + weights_->begin() - 1; + } else { + size_t n = 0; + auto x = FloatLimits::PosInfinity(); + for (aiter->Reset(); !aiter->Done(); aiter->Next(), ++n) { + x = LogPlus(x, aiter->Value().weight); + if (n >= pos && x <= f) break; + } + return n; + } + } + + bool Error() const { return error_; } + + private: + double LogPosExp(double x) { + return x == FloatLimits::PosInfinity() ? 0.0 + : log(1.0F + exp(-x)); + } + + double LogMinusExp(double x) { + return x == FloatLimits::PosInfinity() ? 0.0 + : log(1.0F - exp(-x)); + } + + Weight LogPlus(Weight w, Weight v) { + if (w == Weight::Zero()) { + return v; + } + const auto f1 = to_log_weight_(w).Value(); + const auto f2 = to_log_weight_(v).Value(); + if (f1 > f2) { + return to_weight_(Log64Weight(f2 - LogPosExp(f1 - f2))); + } else { + return to_weight_(Log64Weight(f1 - LogPosExp(f2 - f1))); + } + } + + double LogPlus(double f1, Weight v) { + const auto f2 = to_log_weight_(v).Value(); + if (f1 == FloatLimits::PosInfinity()) { + return f2; + } else if (f1 > f2) { + return f2 - LogPosExp(f1 - f2); + } else { + return f1 - LogPosExp(f2 - f1); + } + } + + // Assumes f1 < f2. + Weight LogMinus(double f1, double f2) { + if (f2 == FloatLimits::PosInfinity()) { + return to_weight_(Log64Weight(f1)); + } else { + return to_weight_(Log64Weight(f1 - LogMinusExp(f2 - f1))); + } + } + + // Extends weights up to index 'end'. + template + void Extend(ssize_t end, ArcIter *aiter) { + if (weights_->size() <= end) { + for (aiter->Seek(weights_->size() - 1); weights_->size() <= end; + aiter->Next()) { + weights_->push_back(LogPlus(weights_->back(), aiter->Value().weight)); + } + } + } + + + const WeightConvert to_log_weight_{}; + const WeightConvert to_weight_{}; + ssize_t arc_limit_; // Minimum # of arcs to cache a state. + std::vector *weights_; // Accumulated weights for cur. state. + std::unique_ptr> fst_; // Input FST. + std::shared_ptr> data_; // Cache data. + StateId s_; // Current state. + bool error_; +}; + +// Stores shareable data for replace accumulator copies. +template +class ReplaceAccumulatorData { + public: + using Arc = typename Accumulator::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using StateTable = T; + using StateTuple = typename StateTable::StateTuple; + + ReplaceAccumulatorData() : state_table_(nullptr) {} + + explicit ReplaceAccumulatorData( + const std::vector &accumulators) + : state_table_(nullptr) { + accumulators_.reserve(accumulators.size()); + for (const auto accumulator : accumulators) { + accumulators_.emplace_back(accumulator); + } + } + + void Init(const std::vector *>> &fst_tuples, + const StateTable *state_table) { + state_table_ = state_table; + accumulators_.resize(fst_tuples.size()); + for (Label i = 0; i < accumulators_.size(); ++i) { + if (!accumulators_[i]) { + accumulators_[i].reset(new Accumulator()); + accumulators_[i]->Init(*(fst_tuples[i].second)); + } + fst_array_.emplace_back(fst_tuples[i].second->Copy()); + } + } + + const StateTuple &GetTuple(StateId s) const { return state_table_->Tuple(s); } + + Accumulator *GetAccumulator(size_t i) { return accumulators_[i].get(); } + + const Fst *GetFst(size_t i) const { return fst_array_[i].get(); } + + private: + const StateTable *state_table_; + std::vector> accumulators_; + std::vector>> fst_array_; +}; + +// This class accumulates weights in a ReplaceFst. The 'Init' method takes as +// input the argument used to build the ReplaceFst and the ReplaceFst state +// table. It uses accumulators of type 'Accumulator' in the underlying FSTs. +template > +class ReplaceAccumulator { + public: + using Arc = typename Accumulator::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using StateTable = T; + using StateTuple = typename StateTable::StateTuple; + using Weight = typename Arc::Weight; + + ReplaceAccumulator() + : init_(false), + data_(std::make_shared< + ReplaceAccumulatorData>()), + error_(false) {} + + explicit ReplaceAccumulator(const std::vector &accumulators) + : init_(false), + data_(std::make_shared>( + accumulators)), + error_(false) {} + + ReplaceAccumulator(const ReplaceAccumulator &acc, + bool safe = false) + : init_(acc.init_), data_(acc.data_), error_(acc.error_) { + if (!init_) { + FSTERROR() << "ReplaceAccumulator: Can't copy unintialized accumulator"; + } + if (safe) FSTERROR() << "ReplaceAccumulator: Safe copy not supported"; + } + + // Does not take ownership of the state table, the state table is owned by + // the ReplaceFst. + void Init(const std::vector *>> &fst_tuples, + const StateTable *state_table) { + init_ = true; + data_->Init(fst_tuples, state_table); + } + + // Method required by LookAheadMatcher. However, ReplaceAccumulator needs to + // be initialized by calling the Init method above before being passed to + // LookAheadMatcher. + // + // TODO(allauzen): Revisit this. Consider creating a method + // Init(const ReplaceFst&, bool) and using friendship to get access + // to the innards of ReplaceFst. + void Init(const Fst &fst, bool copy = false) { + if (!init_) { + FSTERROR() << "ReplaceAccumulator::Init: Accumulator needs to be" + << " initialized before being passed to LookAheadMatcher"; + error_ = true; + } + } + + void SetState(StateId s) { + if (!init_) { + FSTERROR() << "ReplaceAccumulator::SetState: Incorrectly initialized"; + error_ = true; + return; + } + auto tuple = data_->GetTuple(s); + fst_id_ = tuple.fst_id - 1; // Replace FST ID is 1-based. + data_->GetAccumulator(fst_id_)->SetState(tuple.fst_state); + if ((tuple.prefix_id != 0) && + (data_->GetFst(fst_id_)->Final(tuple.fst_state) != Weight::Zero())) { + offset_ = 1; + offset_weight_ = data_->GetFst(fst_id_)->Final(tuple.fst_state); + } else { + offset_ = 0; + offset_weight_ = Weight::Zero(); + } + aiter_.reset( + new ArcIterator>(*data_->GetFst(fst_id_), tuple.fst_state)); + } + + Weight Sum(Weight w, Weight v) { + if (error_) return Weight::NoWeight(); + return data_->GetAccumulator(fst_id_)->Sum(w, v); + } + + template + Weight Sum(Weight w, ArcIter *aiter, ssize_t begin, ssize_t end) { + if (error_) return Weight::NoWeight(); + auto sum = begin == end ? Weight::Zero() + : data_->GetAccumulator(fst_id_)->Sum( + w, aiter_.get(), begin ? begin - offset_ : 0, + end - offset_); + if (begin == 0 && end != 0 && offset_ > 0) sum = Sum(offset_weight_, sum); + return sum; + } + + bool Error() const { return error_; } + + private: + bool init_; + std::shared_ptr> data_; + Label fst_id_; + size_t offset_; + Weight offset_weight_; + std::unique_ptr>> aiter_; + bool error_; +}; + +// SafeReplaceAccumulator accumulates weights in a ReplaceFst and copies of it +// are always thread-safe copies. +template +class SafeReplaceAccumulator { + public: + using Arc = typename Accumulator::Arc; + using StateId = typename Arc::StateId; + using Label = typename Arc::Label; + using Weight = typename Arc::Weight; + using StateTable = T; + using StateTuple = typename StateTable::StateTuple; + + SafeReplaceAccumulator() {} + + SafeReplaceAccumulator(const SafeReplaceAccumulator ©, bool safe) + : SafeReplaceAccumulator(copy) {} + + explicit SafeReplaceAccumulator( + const std::vector &accumulators) { + for (const auto &accumulator : accumulators) { + accumulators_.emplace_back(accumulator, true); + } + } + + void Init(const std::vector *>> &fst_tuples, + const StateTable *state_table) { + state_table_ = state_table; + for (Label i = 0; i < fst_tuples.size(); ++i) { + if (i == accumulators_.size()) { + accumulators_.resize(accumulators_.size() + 1); + accumulators_[i].Init(*(fst_tuples[i].second)); + } + fst_array_.emplace_back(fst_tuples[i].second->Copy(true)); + } + init_ = true; + } + + void Init(const Fst &fst, bool copy = false) { + if (!init_) { + FSTERROR() << "SafeReplaceAccumulator::Init: Accumulator needs to be" + << " initialized before being passed to LookAheadMatcher"; + error_ = true; + } + } + + void SetState(StateId s) { + auto tuple = state_table_->Tuple(s); + fst_id_ = tuple.fst_id - 1; // Replace FST ID is 1-based + GetAccumulator(fst_id_)->SetState(tuple.fst_state); + offset_ = 0; + offset_weight_ = Weight::Zero(); + const auto final_weight = GetFst(fst_id_)->Final(tuple.fst_state); + if ((tuple.prefix_id != 0) && (final_weight != Weight::Zero())) { + offset_ = 1; + offset_weight_ = final_weight; + } + aiter_.Set(*GetFst(fst_id_), tuple.fst_state); + } + + Weight Sum(Weight w, Weight v) { + if (error_) return Weight::NoWeight(); + return GetAccumulator(fst_id_)->Sum(w, v); + } + + template + Weight Sum(Weight w, ArcIter *aiter, ssize_t begin, ssize_t end) { + if (error_) return Weight::NoWeight(); + if (begin == end) return Weight::Zero(); + auto sum = GetAccumulator(fst_id_)->Sum( + w, aiter_.get(), begin ? begin - offset_ : 0, end - offset_); + if (begin == 0 && end != 0 && offset_ > 0) { + sum = Sum(offset_weight_, sum); + } + return sum; + } + + bool Error() const { return error_; } + + private: + class ArcIteratorPtr { + public: + ArcIteratorPtr() {} + + ArcIteratorPtr(const ArcIteratorPtr ©) {} + + void Set(const Fst &fst, StateId state_id) { + ptr_.reset(new ArcIterator>(fst, state_id)); + } + + ArcIterator> *get() { return ptr_.get(); } + + private: + std::unique_ptr>> ptr_; + }; + + Accumulator *GetAccumulator(size_t i) { return &accumulators_[i]; } + + const Fst *GetFst(size_t i) const { return fst_array_[i].get(); } + + const StateTable *state_table_; + std::vector accumulators_; + std::vector>> fst_array_; + ArcIteratorPtr aiter_; + bool init_ = false; + bool error_ = false; + Label fst_id_; + size_t offset_; + Weight offset_weight_; +}; + +} // namespace fst + +#endif // FST_ACCUMULATOR_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/add-on.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/add-on.h new file mode 100644 index 0000000..4a95111 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/add-on.h @@ -0,0 +1,248 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST implementation class to attach an arbitrary object with a read/write +// method to an FST and its file representation. The FST is given a new type +// name. + +#ifndef FST_ADD_ON_H_ +#define FST_ADD_ON_H_ + +#include +#include +#include +#include + +#include + +#include + + +namespace fst { + +// Identifies stream data as an add-on FST. +static constexpr int32 kAddOnMagicNumber = 446681434; + +// Nothing to save. +class NullAddOn { + public: + NullAddOn() {} + + static NullAddOn *Read(std::istream &strm, const FstReadOptions &opts) { + return new NullAddOn(); + } + + bool Write(std::ostream &ostrm, const FstWriteOptions &opts) const { + return true; + } +}; + +// Create a new add-on from a pair of add-ons. +template +class AddOnPair { + public: + // Argument reference count incremented. + AddOnPair(std::shared_ptr a1, std::shared_ptr a2) + : a1_(std::move(a1)), a2_(std::move(a2)) {} + + const A1 *First() const { return a1_.get(); } + + const A2 *Second() const { return a2_.get(); } + + std::shared_ptr SharedFirst() const { return a1_; } + + std::shared_ptr SharedSecond() const { return a2_; } + + static AddOnPair *Read(std::istream &istrm, + const FstReadOptions &opts) { + A1 *a1 = nullptr; + bool have_addon1 = false; + ReadType(istrm, &have_addon1); + if (have_addon1) a1 = A1::Read(istrm, opts); + + A2 *a2 = nullptr; + bool have_addon2 = false; + ReadType(istrm, &have_addon2); + if (have_addon2) a2 = A2::Read(istrm, opts); + + return new AddOnPair(std::shared_ptr(a1), + std::shared_ptr(a2)); + } + + bool Write(std::ostream &ostrm, const FstWriteOptions &opts) const { + bool have_addon1 = a1_ != nullptr; + WriteType(ostrm, have_addon1); + if (have_addon1) a1_->Write(ostrm, opts); + bool have_addon2 = a2_ != nullptr; + WriteType(ostrm, have_addon2); + if (have_addon2) a2_->Write(ostrm, opts); + return true; + } + + private: + std::shared_ptr a1_; + std::shared_ptr a2_; +}; + +namespace internal { + +// Adds an object of type T to an FST. T must support: +// +// T* Read(std::istream &); +// bool Write(std::ostream &); +// +// The resulting type is a new FST implementation. +template +class AddOnImpl : public FstImpl { + public: + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetType; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::SetProperties; + using FstImpl::WriteHeader; + + // We make a thread-safe copy of the FST by default since an FST + // implementation is expected to not share mutable data between objects. + AddOnImpl(const FST &fst, const string &type, + std::shared_ptr t = std::shared_ptr()) + : fst_(fst, true), t_(std::move(t)) { + SetType(type); + SetProperties(fst_.Properties(kFstProperties, false)); + SetInputSymbols(fst_.InputSymbols()); + SetOutputSymbols(fst_.OutputSymbols()); + } + + // Conversion from const Fst & to F always copies the underlying + // implementation. + AddOnImpl(const Fst &fst, const string &type, + std::shared_ptr t = std::shared_ptr()) + : fst_(fst), t_(std::move(t)) { + SetType(type); + SetProperties(fst_.Properties(kFstProperties, false)); + SetInputSymbols(fst_.InputSymbols()); + SetOutputSymbols(fst_.OutputSymbols()); + } + + // We make a thread-safe copy of the FST by default since an FST + // implementation is expected to not share mutable data between objects. + AddOnImpl(const AddOnImpl &impl) + : fst_(impl.fst_, true), t_(impl.t_) { + SetType(impl.Type()); + SetProperties(fst_.Properties(kCopyProperties, false)); + SetInputSymbols(fst_.InputSymbols()); + SetOutputSymbols(fst_.OutputSymbols()); + } + + StateId Start() const { return fst_.Start(); } + + Weight Final(StateId s) const { return fst_.Final(s); } + + size_t NumArcs(StateId s) const { return fst_.NumArcs(s); } + + size_t NumInputEpsilons(StateId s) const { return fst_.NumInputEpsilons(s); } + + size_t NumOutputEpsilons(StateId s) const { + return fst_.NumOutputEpsilons(s); + } + + size_t NumStates() const { return fst_.NumStates(); } + + static AddOnImpl *Read(std::istream &strm, + const FstReadOptions &opts) { + FstReadOptions nopts(opts); + FstHeader hdr; + if (!nopts.header) { + hdr.Read(strm, nopts.source); + nopts.header = &hdr; + } + std::unique_ptr> impl( + new AddOnImpl(nopts.header->FstType())); + if (!impl->ReadHeader(strm, nopts, kMinFileVersion, &hdr)) return nullptr; + impl.reset(); + int32 magic_number = 0; + ReadType(strm, &magic_number); // Ensures this is an add-on FST. + if (magic_number != kAddOnMagicNumber) { + LOG(ERROR) << "AddOnImpl::Read: Bad add-on header: " << nopts.source; + return nullptr; + } + FstReadOptions fopts(opts); + fopts.header = nullptr; // Contained header was written out. + std::unique_ptr fst(FST::Read(strm, fopts)); + if (!fst) return nullptr; + std::shared_ptr t; + bool have_addon = false; + ReadType(strm, &have_addon); + if (have_addon) { // Reads add-on object if present. + t = std::shared_ptr(T::Read(strm, fopts)); + if (!t) return nullptr; + } + return new AddOnImpl(*fst, nopts.header->FstType(), t); + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const { + FstHeader hdr; + FstWriteOptions nopts(opts); + nopts.write_isymbols = false; // Allows contained FST to hold any symbols. + nopts.write_osymbols = false; + WriteHeader(strm, nopts, kFileVersion, &hdr); + WriteType(strm, kAddOnMagicNumber); // Ensures this is an add-on FST. + FstWriteOptions fopts(opts); + fopts.write_header = true; // Forces writing contained header. + if (!fst_.Write(strm, fopts)) return false; + bool have_addon = !!t_; + WriteType(strm, have_addon); + // Writes add-on object if present. + if (have_addon) t_->Write(strm, opts); + return true; + } + + void InitStateIterator(StateIteratorData *data) const { + fst_.InitStateIterator(data); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) const { + fst_.InitArcIterator(s, data); + } + + FST &GetFst() { return fst_; } + + const FST &GetFst() const { return fst_; } + + const T *GetAddOn() const { return t_.get(); } + + std::shared_ptr GetSharedAddOn() const { return t_; } + + void SetAddOn(std::shared_ptr t) { t_ = t; } + + private: + explicit AddOnImpl(const string &type) : t_() { + SetType(type); + SetProperties(kExpanded); + } + + // Current file format version. + static constexpr int kFileVersion = 1; + // Minimum file format version supported. + static constexpr int kMinFileVersion = 1; + + FST fst_; + std::shared_ptr t_; + + AddOnImpl &operator=(const AddOnImpl &) = delete; +}; + +template +constexpr int AddOnImpl::kFileVersion; + +template +constexpr int AddOnImpl::kMinFileVersion; + +} // namespace internal +} // namespace fst + +#endif // FST_ADD_ON_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/arc-arena.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/arc-arena.h new file mode 100644 index 0000000..13fe918 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/arc-arena.h @@ -0,0 +1,232 @@ +#ifndef FST_ARC_ARENA_H_ +#define FST_ARC_ARENA_H_ + +#include +#include +#include +#include +#include +#include + +namespace fst { + +// ArcArena is used for fast allocation of contiguous arrays of arcs. +// +// To create an arc array: +// for each state: +// for each arc: +// arena.PushArc(); +// // Commits these arcs and returns pointer to them. +// Arc *arcs = arena.GetArcs(); +// +// OR +// +// arena.DropArcs(); // Throws away current arcs, reuse the space. +// +// The arcs returned are guaranteed to be contiguous and the pointer returned +// will never be invalidated until the arena is cleared for reuse. +// +// The contents of the arena can be released with a call to arena.Clear() after +// which the arena will restart with an initial allocation capable of holding at +// least all of the arcs requested in the last usage before Clear() making +// subsequent uses of the Arena more efficient. +// +// The max_retained_size option can limit the amount of arc space requested on +// Clear() to avoid excess growth from intermittent high usage. +template +class ArcArena { + public: + explicit ArcArena(size_t block_size = 256, + size_t max_retained_size = 1e6) + : block_size_(block_size), + max_retained_size_(max_retained_size) { + blocks_.emplace_back(MakeSharedBlock(block_size_)); + first_block_size_ = block_size_; + total_size_ = block_size_; + arcs_ = blocks_.back().get(); + end_ = arcs_ + block_size_; + next_ = arcs_; + } + + ArcArena(const ArcArena& copy) + : arcs_(copy.arcs_), next_(copy.next_), end_(copy.end_), + block_size_(copy.block_size_), + first_block_size_(copy.first_block_size_), + total_size_(copy.total_size_), + max_retained_size_(copy.max_retained_size_), + blocks_(copy.blocks_) { + NewBlock(block_size_); + } + + void ReserveArcs(size_t n) { + if (next_ + n < end_) return; + NewBlock(n); + } + + void PushArc(const Arc& arc) { + if (next_ == end_) { + size_t length = next_ - arcs_; + NewBlock(length * 2); + } + *next_ = arc; + ++next_; + } + + const Arc* GetArcs() { + const auto *arcs = arcs_; + arcs_ = next_; + return arcs; + } + + void DropArcs() { next_ = arcs_; } + + size_t Size() { return total_size_; } + + void Clear() { + blocks_.resize(1); + if (total_size_ > first_block_size_) { + first_block_size_ = std::min(max_retained_size_, total_size_); + blocks_.back() = MakeSharedBlock(first_block_size_); + } + total_size_ = first_block_size_; + arcs_ = blocks_.back().get(); + end_ = arcs_ + first_block_size_; + next_ = arcs_; + } + + private: + // Allocates a new block with capacity of at least n or block_size, + // copying incomplete arc sequence from old block to new block. + void NewBlock(size_t n) { + const auto length = next_ - arcs_; + const auto new_block_size = std::max(n, block_size_); + total_size_ += new_block_size; + blocks_.emplace_back(MakeSharedBlock(new_block_size)); + std::copy(arcs_, next_, blocks_.back().get()); + arcs_ = blocks_.back().get(); + next_ = arcs_ + length; + end_ = arcs_ + new_block_size; + } + + std::shared_ptr MakeSharedBlock(size_t size) { + return std::shared_ptr(new Arc[size], std::default_delete()); + } + + Arc *arcs_; + Arc *next_; + const Arc *end_; + size_t block_size_; + size_t first_block_size_; + size_t total_size_; + size_t max_retained_size_; + std::list> blocks_; +}; + +// ArcArenaStateStore uses a resusable ArcArena to store arc arrays and does not +// require that the Expander call ReserveArcs first. +// +// TODO(tombagby): Make cache type configurable. +// TODO(tombagby): Provide ThreadLocal/Concurrent configuration. +template +class ArcArenaStateStore { + public: + using Arc = A; + using Weight = typename Arc::Weight; + using StateId = typename Arc::StateId; + + ArcArenaStateStore() : arena_(64 * 1024) { + } + + class State { + public: + Weight Final() const { return final_; } + + size_t NumInputEpsilons() const { return niepsilons_; } + + size_t NumOutputEpsilons() const { return noepsilons_; } + + size_t NumArcs() const { return narcs_; } + + const Arc &GetArc(size_t n) const { return arcs_[n]; } + + const Arc *Arcs() const { return arcs_; } + + int* MutableRefCount() const { return nullptr; } + + private: + State(Weight weight, int32 niepsilons, int32 noepsilons, int32 narcs, + const Arc *arcs) + : final_(std::move(weight)), + niepsilons_(niepsilons), + noepsilons_(noepsilons), + narcs_(narcs), + arcs_(arcs) {} + + Weight final_; + size_t niepsilons_; + size_t noepsilons_; + size_t narcs_; + const Arc *arcs_; + + friend class ArcArenaStateStore; + }; + + template + State *FindOrExpand(Expander &expander, StateId state_id) { // NOLINT + auto it = cache_.insert(std::pair(state_id, nullptr)); + if (!it.second) return it.first->second; + // Needs a new state. + StateBuilder builder(&arena_); + expander.Expand(state_id, &builder); + const auto arcs = arena_.GetArcs(); + size_t narcs = builder.narcs_; + size_t niepsilons = 0; + size_t noepsilons = 0; + for (size_t i = 0; i < narcs; ++i) { + if (arcs[i].ilabel == 0) ++niepsilons; + if (arcs[i].olabel == 0) ++noepsilons; + } + states_.emplace_back( + State(builder.final_, niepsilons, noepsilons, narcs, arcs)); + // Places it in the cache. + auto state = &states_.back(); + it.first->second = state; + return state; + } + + State *Find(StateId state_id) const { + auto it = cache_.find(state_id); + return (it == cache_.end()) ? nullptr : it->second; + } + + private: + class StateBuilder { + public: + explicit StateBuilder(ArcArena* arena) + : arena_(arena), final_(Weight::Zero()), narcs_(0) {} + + void SetFinal(Weight weight) { final_ = std::move(weight); } + + void ReserveArcs(size_t n) { arena_->ReserveArcs(n); } + + void AddArc(const Arc &arc) { + ++narcs_; + arena_->PushArc(arc); + } + + private: + friend class ArcArenaStateStore; + + ArcArena *arena_; + Weight final_; + size_t narcs_; + }; + + std::unordered_map cache_; + std::deque states_; + ArcArena arena_; +}; + +} // namespace fst + +#endif // FST_ARC_ARENA_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/arc-map.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/arc-map.h new file mode 100644 index 0000000..24db491 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/arc-map.h @@ -0,0 +1,1285 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to map over/transform arcs e.g., change semirings or +// implement project/invert. Consider using when operation does +// not change the number of arcs (except possibly superfinal arcs). + +#ifndef FST_ARC_MAP_H_ +#define FST_ARC_MAP_H_ + +#include +#include +#include + +#include + +#include +#include + + +namespace fst { + +// Determines how final weights are mapped. +enum MapFinalAction { + // A final weight is mapped into a final weight. An error is raised if this + // is not possible. + MAP_NO_SUPERFINAL, + // A final weight is mapped to an arc to the superfinal state when the result + // cannot be represented as a final weight. The superfinal state will be + // added only if it is needed. + MAP_ALLOW_SUPERFINAL, + // A final weight is mapped to an arc to the superfinal state unless the + // result can be represented as a final weight of weight Zero(). The + // superfinal state is always added (if the input is not the empty FST). + MAP_REQUIRE_SUPERFINAL +}; + +// Determines how symbol tables are mapped. +enum MapSymbolsAction { + // Symbols should be cleared in the result by the map. + MAP_CLEAR_SYMBOLS, + // Symbols should be copied from the input FST by the map. + MAP_COPY_SYMBOLS, + // Symbols should not be modified in the result by the map itself. + // (They may set by the mapper). + MAP_NOOP_SYMBOLS +}; + +// The ArcMapper interfaces defines how arcs and final weights are mapped. +// This is useful for implementing operations that do not change the number of +// arcs (except possibly superfinal arcs). +// +// template +// class ArcMapper { +// public: +// using FromArc = A; +// using ToArc = B; +// +// // Maps an arc type FromArc to arc type ToArc. +// ToArc operator()(const FromArc &arc); +// +// // Specifies final action the mapper requires (see above). +// // The mapper will be passed final weights as arcs of the form +// // Arc(0, 0, weight, kNoStateId). +// MapFinalAction FinalAction() const; +// +// // Specifies input symbol table action the mapper requires (see above). +// MapSymbolsAction InputSymbolsAction() const; +// +// // Specifies output symbol table action the mapper requires (see above). +// MapSymbolsAction OutputSymbolsAction() const; +// +// // This specifies the known properties of an FST mapped by this mapper. It +// takes as argument the input FSTs's known properties. +// uint64 Properties(uint64 props) const; +// }; +// +// The ArcMap functions and classes below will use the FinalAction() +// method of the mapper to determine how to treat final weights, e.g., whether +// to add a superfinal state. They will use the Properties() method to set the +// result FST properties. +// +// We include a various map versions below. One dimension of variation is +// whether the mapping mutates its input, writes to a new result FST, or is an +// on-the-fly FST. Another dimension is how we pass the mapper. We allow passing +// the mapper by pointer for cases that we need to change the state of the +// user's mapper. This is the case with the EncodeMapper, which is reused +// during decoding. We also include map versions that pass the mapper by value +// or const reference when this suffices. + +// Maps an arc type A using a mapper function object C, passed +// by pointer. This version modifies its Fst input. +template +void ArcMap(MutableFst *fst, C *mapper) { + using FromArc = A; + using ToArc = A; + using Weight = typename FromArc::Weight; + if (mapper->InputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + fst->SetInputSymbols(nullptr); + } + if (mapper->OutputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + fst->SetOutputSymbols(nullptr); + } + if (fst->Start() == kNoStateId) return; + const auto props = fst->Properties(kFstProperties, false); + const auto final_action = mapper->FinalAction(); + auto superfinal = kNoStateId; + if (final_action == MAP_REQUIRE_SUPERFINAL) { + superfinal = fst->AddState(); + fst->SetFinal(superfinal, Weight::One()); + } + for (StateIterator> siter(*fst); !siter.Done(); + siter.Next()) { + const auto state = siter.Value(); + for (MutableArcIterator> aiter(fst, state); + !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + aiter.SetValue((*mapper)(arc)); + } + switch (final_action) { + case MAP_NO_SUPERFINAL: + default: { + const FromArc arc(0, 0, fst->Final(state), kNoStateId); + const auto final_arc = (*mapper)(arc); + if (final_arc.ilabel != 0 || final_arc.olabel != 0) { + FSTERROR() << "ArcMap: Non-zero arc labels for superfinal arc"; + fst->SetProperties(kError, kError); + } + fst->SetFinal(state, final_arc.weight); + break; + } + case MAP_ALLOW_SUPERFINAL: { + if (state != superfinal) { + const FromArc arc(0, 0, fst->Final(state), kNoStateId); + auto final_arc = (*mapper)(arc); + if (final_arc.ilabel != 0 || final_arc.olabel != 0) { + // Add a superfinal state if not already done. + if (superfinal == kNoStateId) { + superfinal = fst->AddState(); + fst->SetFinal(superfinal, Weight::One()); + } + final_arc.nextstate = superfinal; + fst->AddArc(state, std::move(final_arc)); + fst->SetFinal(state, Weight::Zero()); + } else { + fst->SetFinal(state, final_arc.weight); + } + } + break; + } + case MAP_REQUIRE_SUPERFINAL: { + if (state != superfinal) { + const FromArc arc(0, 0, fst->Final(state), kNoStateId); + const auto final_arc = (*mapper)(arc); + if (final_arc.ilabel != 0 || final_arc.olabel != 0 || + final_arc.weight != Weight::Zero()) { + fst->AddArc(state, ToArc(final_arc.ilabel, final_arc.olabel, + final_arc.weight, superfinal)); + } + fst->SetFinal(state, Weight::Zero()); + } + break; + } + } + } + fst->SetProperties(mapper->Properties(props), kFstProperties); +} + +// Maps an arc type A using a mapper function object C, passed by value. This +// version modifies its FST input. +template +void ArcMap(MutableFst *fst, C mapper) { + ArcMap(fst, &mapper); +} + +// Maps an arc type A to an arc type B using mapper function object C, +// passed by pointer. This version writes the mapped input FST to an +// output MutableFst. +template +void ArcMap(const Fst &ifst, MutableFst *ofst, C *mapper) { + using FromArc = A; + using StateId = typename FromArc::StateId; + ofst->DeleteStates(); + if (mapper->InputSymbolsAction() == MAP_COPY_SYMBOLS) { + ofst->SetInputSymbols(ifst.InputSymbols()); + } else if (mapper->InputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + ofst->SetInputSymbols(nullptr); + } + if (mapper->OutputSymbolsAction() == MAP_COPY_SYMBOLS) { + ofst->SetOutputSymbols(ifst.OutputSymbols()); + } else if (mapper->OutputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + ofst->SetOutputSymbols(nullptr); + } + const auto iprops = ifst.Properties(kCopyProperties, false); + if (ifst.Start() == kNoStateId) { + if (iprops & kError) ofst->SetProperties(kError, kError); + return; + } + const auto final_action = mapper->FinalAction(); + if (ifst.Properties(kExpanded, false)) { + ofst->ReserveStates( + CountStates(ifst) + (final_action == MAP_NO_SUPERFINAL ? 0 : 1)); + } + // Adds all states. + for (StateIterator> siter(ifst); !siter.Done(); siter.Next()) { + ofst->AddState(); + } + StateId superfinal = kNoStateId; + if (final_action == MAP_REQUIRE_SUPERFINAL) { + superfinal = ofst->AddState(); + ofst->SetFinal(superfinal, B::Weight::One()); + } + for (StateIterator> siter(ifst); !siter.Done(); siter.Next()) { + StateId s = siter.Value(); + if (s == ifst.Start()) ofst->SetStart(s); + ofst->ReserveArcs( + s, ifst.NumArcs(s) + (final_action != MAP_NO_SUPERFINAL ? 1 : 0)); + for (ArcIterator> aiter(ifst, s); !aiter.Done(); aiter.Next()) { + ofst->AddArc(s, (*mapper)(aiter.Value())); + } + switch (final_action) { + case MAP_NO_SUPERFINAL: + default: { + B final_arc = (*mapper)(A(0, 0, ifst.Final(s), kNoStateId)); + if (final_arc.ilabel != 0 || final_arc.olabel != 0) { + FSTERROR() << "ArcMap: Non-zero arc labels for superfinal arc"; + ofst->SetProperties(kError, kError); + } + ofst->SetFinal(s, final_arc.weight); + break; + } + case MAP_ALLOW_SUPERFINAL: { + B final_arc = (*mapper)(A(0, 0, ifst.Final(s), kNoStateId)); + if (final_arc.ilabel != 0 || final_arc.olabel != 0) { + // Add a superfinal state if not already done. + if (superfinal == kNoStateId) { + superfinal = ofst->AddState(); + ofst->SetFinal(superfinal, B::Weight::One()); + } + final_arc.nextstate = superfinal; + ofst->AddArc(s, std::move(final_arc)); + ofst->SetFinal(s, B::Weight::Zero()); + } else { + ofst->SetFinal(s, final_arc.weight); + } + break; + } + case MAP_REQUIRE_SUPERFINAL: { + B final_arc = (*mapper)(A(0, 0, ifst.Final(s), kNoStateId)); + if (final_arc.ilabel != 0 || final_arc.olabel != 0 || + final_arc.weight != B::Weight::Zero()) { + ofst->AddArc(s, B(final_arc.ilabel, final_arc.olabel, + final_arc.weight, superfinal)); + } + ofst->SetFinal(s, B::Weight::Zero()); + break; + } + } + } + const auto oprops = ofst->Properties(kFstProperties, false); + ofst->SetProperties(mapper->Properties(iprops) | oprops, kFstProperties); +} + +// Maps an arc type A to an arc type B using mapper function +// object C, passed by value. This version writes the mapped input +// Fst to an output MutableFst. +template +void ArcMap(const Fst &ifst, MutableFst *ofst, C mapper) { + ArcMap(ifst, ofst, &mapper); +} + +struct ArcMapFstOptions : public CacheOptions { + // ArcMapFst default caching behaviour is to do no caching. Most mappers are + // cheap and therefore we save memory by not doing caching. + ArcMapFstOptions() : CacheOptions(true, 0) {} + + explicit ArcMapFstOptions(const CacheOptions &opts) : CacheOptions(opts) {} +}; + +template +class ArcMapFst; + +namespace internal { + +// Implementation of delayed ArcMapFst. +template +class ArcMapFstImpl : public CacheImpl { + public: + using Arc = B; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheImpl::EmplaceArc; + using CacheImpl::HasArcs; + using CacheImpl::HasFinal; + using CacheImpl::HasStart; + using CacheImpl::PushArc; + using CacheImpl::SetArcs; + using CacheImpl::SetFinal; + using CacheImpl::SetStart; + + friend class StateIterator>; + + ArcMapFstImpl(const Fst &fst, const C &mapper, + const ArcMapFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + mapper_(new C(mapper)), + own_mapper_(true), + superfinal_(kNoStateId), + nstates_(0) { + Init(); + } + + ArcMapFstImpl(const Fst &fst, C *mapper, const ArcMapFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + mapper_(mapper), + own_mapper_(false), + superfinal_(kNoStateId), + nstates_(0) { + Init(); + } + + ArcMapFstImpl(const ArcMapFstImpl &impl) + : CacheImpl(impl), + fst_(impl.fst_->Copy(true)), + mapper_(new C(*impl.mapper_)), + own_mapper_(true), + superfinal_(kNoStateId), + nstates_(0) { + Init(); + } + + ~ArcMapFstImpl() override { + if (own_mapper_) delete mapper_; + } + + StateId Start() { + if (!HasStart()) SetStart(FindOState(fst_->Start())); + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) { + switch (final_action_) { + case MAP_NO_SUPERFINAL: + default: { + const auto final_arc = + (*mapper_)(A(0, 0, fst_->Final(FindIState(s)), kNoStateId)); + if (final_arc.ilabel != 0 || final_arc.olabel != 0) { + FSTERROR() << "ArcMapFst: Non-zero arc labels for superfinal arc"; + SetProperties(kError, kError); + } + SetFinal(s, final_arc.weight); + break; + } + case MAP_ALLOW_SUPERFINAL: { + if (s == superfinal_) { + SetFinal(s, Weight::One()); + } else { + const auto final_arc = + (*mapper_)(A(0, 0, fst_->Final(FindIState(s)), kNoStateId)); + if (final_arc.ilabel == 0 && final_arc.olabel == 0) { + SetFinal(s, final_arc.weight); + } else { + SetFinal(s, Weight::Zero()); + } + } + break; + } + case MAP_REQUIRE_SUPERFINAL: { + SetFinal(s, s == superfinal_ ? Weight::One() : Weight::Zero()); + break; + } + } + } + return CacheImpl::Final(s); + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && (fst_->Properties(kError, false) || + (mapper_->Properties(0) & kError))) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + void Expand(StateId s) { + // Add exiting arcs. + if (s == superfinal_) { + SetArcs(s); + return; + } + for (ArcIterator> aiter(*fst_, FindIState(s)); !aiter.Done(); + aiter.Next()) { + auto aarc = aiter.Value(); + aarc.nextstate = FindOState(aarc.nextstate); + PushArc(s, (*mapper_)(aarc)); + } + + // Check for superfinal arcs. + if (!HasFinal(s) || Final(s) == Weight::Zero()) { + switch (final_action_) { + case MAP_NO_SUPERFINAL: + default: + break; + case MAP_ALLOW_SUPERFINAL: { + auto final_arc = + (*mapper_)(A(0, 0, fst_->Final(FindIState(s)), kNoStateId)); + if (final_arc.ilabel != 0 || final_arc.olabel != 0) { + if (superfinal_ == kNoStateId) superfinal_ = nstates_++; + final_arc.nextstate = superfinal_; + PushArc(s, std::move(final_arc)); + } + break; + } + case MAP_REQUIRE_SUPERFINAL: { + const auto final_arc = + (*mapper_)(A(0, 0, fst_->Final(FindIState(s)), kNoStateId)); + if (final_arc.ilabel != 0 || final_arc.olabel != 0 || + final_arc.weight != B::Weight::Zero()) { + EmplaceArc(s, final_arc.ilabel, final_arc.olabel, final_arc.weight, + superfinal_); + } + break; + } + } + } + SetArcs(s); + } + + private: + void Init() { + SetType("map"); + if (mapper_->InputSymbolsAction() == MAP_COPY_SYMBOLS) { + SetInputSymbols(fst_->InputSymbols()); + } else if (mapper_->InputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + SetInputSymbols(nullptr); + } + if (mapper_->OutputSymbolsAction() == MAP_COPY_SYMBOLS) { + SetOutputSymbols(fst_->OutputSymbols()); + } else if (mapper_->OutputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + SetOutputSymbols(nullptr); + } + if (fst_->Start() == kNoStateId) { + final_action_ = MAP_NO_SUPERFINAL; + SetProperties(kNullProperties); + } else { + final_action_ = mapper_->FinalAction(); + uint64 props = fst_->Properties(kCopyProperties, false); + SetProperties(mapper_->Properties(props)); + if (final_action_ == MAP_REQUIRE_SUPERFINAL) superfinal_ = 0; + } + } + + // Maps from output state to input state. + StateId FindIState(StateId s) { + if (superfinal_ == kNoStateId || s < superfinal_) { + return s; + } else { + return s - 1; + } + } + + // Maps from input state to output state. + StateId FindOState(StateId is) { + auto os = is; + if (!(superfinal_ == kNoStateId || is < superfinal_)) ++os; + if (os >= nstates_) nstates_ = os + 1; + return os; + } + + std::unique_ptr> fst_; + C *mapper_; + const bool own_mapper_; + MapFinalAction final_action_; + StateId superfinal_; + StateId nstates_; +}; + +} // namespace internal + +// Maps an arc type A to an arc type B using Mapper function object +// C. This version is a delayed FST. +template +class ArcMapFst : public ImplToFst> { + public: + using Arc = B; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = DefaultCacheStore; + using State = typename Store::State; + using Impl = internal::ArcMapFstImpl; + + friend class ArcIterator>; + friend class StateIterator>; + + ArcMapFst(const Fst &fst, const C &mapper, const ArcMapFstOptions &opts) + : ImplToFst(std::make_shared(fst, mapper, opts)) {} + + ArcMapFst(const Fst &fst, C *mapper, const ArcMapFstOptions &opts) + : ImplToFst(std::make_shared(fst, mapper, opts)) {} + + ArcMapFst(const Fst &fst, const C &mapper) + : ImplToFst( + std::make_shared(fst, mapper, ArcMapFstOptions())) {} + + ArcMapFst(const Fst &fst, C *mapper) + : ImplToFst( + std::make_shared(fst, mapper, ArcMapFstOptions())) {} + + // See Fst<>::Copy() for doc. + ArcMapFst(const ArcMapFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Get a copy of this ArcMapFst. See Fst<>::Copy() for further doc. + ArcMapFst *Copy(bool safe = false) const override { + return new ArcMapFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + protected: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + private: + ArcMapFst &operator=(const ArcMapFst &) = delete; +}; + +// Specialization for ArcMapFst. +// +// This may be derived from. +template +class StateIterator> : public StateIteratorBase { + public: + using StateId = typename B::StateId; + + explicit StateIterator(const ArcMapFst &fst) + : impl_(fst.GetImpl()), + siter_(*impl_->fst_), + s_(0), + superfinal_(impl_->final_action_ == MAP_REQUIRE_SUPERFINAL) { + CheckSuperfinal(); + } + + bool Done() const final { return siter_.Done() && !superfinal_; } + + StateId Value() const final { return s_; } + + void Next() final { + ++s_; + if (!siter_.Done()) { + siter_.Next(); + CheckSuperfinal(); + } else if (superfinal_) { + superfinal_ = false; + } + } + + void Reset() final { + s_ = 0; + siter_.Reset(); + superfinal_ = impl_->final_action_ == MAP_REQUIRE_SUPERFINAL; + CheckSuperfinal(); + } + + private: + void CheckSuperfinal() { + if (impl_->final_action_ != MAP_ALLOW_SUPERFINAL || superfinal_) return; + if (!siter_.Done()) { + const auto final_arc = + (*impl_->mapper_)(A(0, 0, impl_->fst_->Final(s_), kNoStateId)); + if (final_arc.ilabel != 0 || final_arc.olabel != 0) superfinal_ = true; + } + } + + const internal::ArcMapFstImpl *impl_; + StateIterator> siter_; + StateId s_; + bool superfinal_; // True if there is a superfinal state and not done. +}; + +// Specialization for ArcMapFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename A::StateId; + + ArcIterator(const ArcMapFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void ArcMapFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Utility Mappers. + +// Mapper that returns its input. +template +class IdentityArcMapper { + public: + using FromArc = A; + using ToArc = A; + + constexpr ToArc operator()(const FromArc &arc) const { return arc; } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { return props; } +}; + +// Mapper that converts all input symbols to epsilon. +template +class InputEpsilonMapper { + public: + using FromArc = A; + using ToArc = A; + + constexpr ToArc operator()(const FromArc &arc) const { + return ToArc(0, arc.olabel, arc.weight, arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return (props & kSetArcProperties) | kIEpsilons | kILabelSorted; + } +}; + +// Mapper that converts all output symbols to epsilon. +template +class OutputEpsilonMapper { + public: + using FromArc = A; + using ToArc = A; + + constexpr ToArc operator()(const FromArc &arc) const { + return ToArc(arc.ilabel, 0, arc.weight, arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return (props & kSetArcProperties) | kOEpsilons | kOLabelSorted; + } +}; + +// Mapper that returns its input with final states redirected to a single +// super-final state. +template +class SuperFinalMapper { + public: + using FromArc = A; + using ToArc = A; + using Label = typename FromArc::Label; + using Weight = typename FromArc::Weight;; + + // Arg allows setting super-final label. + explicit SuperFinalMapper(Label final_label = 0) + : final_label_(final_label) {} + + ToArc operator()(const FromArc &arc) const { + // Super-final arc. + if (arc.nextstate == kNoStateId && arc.weight != Weight::Zero()) { + return ToArc(final_label_, final_label_, arc.weight, kNoStateId); + } else { + return arc; + } + } + + constexpr MapFinalAction FinalAction() const { + return MAP_REQUIRE_SUPERFINAL; + } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + uint64 Properties(uint64 props) const { + if (final_label_ == 0) { + return props & kAddSuperFinalProperties; + } else { + return props & kAddSuperFinalProperties & + kILabelInvariantProperties & kOLabelInvariantProperties; + } + } + + private: + Label final_label_; +}; + +// Mapper that leaves labels and nextstate unchanged and constructs a new weight +// from the underlying value of the arc weight. If no weight converter is +// explictly specified, requires that there is a WeightConvert class +// specialization that converts the weights. +template > +class WeightConvertMapper { + public: + using FromArc = A; + using ToArc = B; + using Converter = C; + using FromWeight = typename FromArc::Weight; + using ToWeight = typename ToArc::Weight; + + constexpr explicit WeightConvertMapper(const Converter &c = Converter()) + : convert_weight_(c) {} + + constexpr ToArc operator()(const FromArc &arc) const { + return ToArc(arc.ilabel, arc.olabel, convert_weight_(arc.weight), + arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { return props; } + + private: + const Converter convert_weight_; +}; + +// Non-precision-changing weight conversions; consider using more efficient +// Cast method instead. + +using StdToLogMapper = WeightConvertMapper; + +using LogToStdMapper = WeightConvertMapper; + +// Precision-changing weight conversions. + +using StdToLog64Mapper = WeightConvertMapper; + +using LogToLog64Mapper = WeightConvertMapper; + +using Log64ToStdMapper = WeightConvertMapper; + +using Log64ToLogMapper = WeightConvertMapper; + +// Mapper from A to GallicArc. +template +class ToGallicMapper { + public: + using FromArc = A; + using ToArc = GallicArc; + + using SW = StringWeight; + using AW = typename FromArc::Weight; + using GW = typename ToArc::Weight; + + ToArc operator()(const FromArc &arc) const { + // Super-final arc. + if (arc.nextstate == kNoStateId && arc.weight != AW::Zero()) { + return ToArc(0, 0, GW(SW::One(), arc.weight), kNoStateId); + // Super-non-final arc. + } else if (arc.nextstate == kNoStateId) { + return ToArc(0, 0, GW::Zero(), kNoStateId); + // Epsilon label. + } else if (arc.olabel == 0) { + return ToArc(arc.ilabel, arc.ilabel, GW(SW::One(), arc.weight), + arc.nextstate); + // Regular label. + } else { + return ToArc(arc.ilabel, arc.ilabel, GW(SW(arc.olabel), arc.weight), + arc.nextstate); + } + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + uint64 Properties(uint64 props) const { + return ProjectProperties(props, true) & kWeightInvariantProperties; + } +}; + +// Mapper from GallicArc to A. +template +class FromGallicMapper { + public: + using FromArc = GallicArc; + using ToArc = A; + + using Label = typename ToArc::Label; + using AW = typename ToArc::Weight; + using GW = typename FromArc::Weight; + + explicit FromGallicMapper(Label superfinal_label = 0) + : superfinal_label_(superfinal_label), error_(false) {} + + ToArc operator()(const FromArc &arc) const { + // 'Super-non-final' arc. + if (arc.nextstate == kNoStateId && arc.weight == GW::Zero()) { + return A(arc.ilabel, 0, AW::Zero(), kNoStateId); + } + Label l = kNoLabel; + AW weight; + if (!Extract(arc.weight, &weight, &l) || arc.ilabel != arc.olabel) { + FSTERROR() << "FromGallicMapper: Unrepresentable weight: " << arc.weight + << " for arc with ilabel = " << arc.ilabel + << ", olabel = " << arc.olabel + << ", nextstate = " << arc.nextstate; + error_ = true; + } + if (arc.ilabel == 0 && l != 0 && arc.nextstate == kNoStateId) { + return ToArc(superfinal_label_, l, weight, arc.nextstate); + } else { + return ToArc(arc.ilabel, l, weight, arc.nextstate); + } + } + + constexpr MapFinalAction FinalAction() const { return MAP_ALLOW_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + uint64 Properties(uint64 inprops) const { + uint64 outprops = inprops & kOLabelInvariantProperties & + kWeightInvariantProperties & kAddSuperFinalProperties; + if (error_) outprops |= kError; + return outprops; + } + + private: + template + static bool Extract(const GallicWeight &gallic_weight, + typename A::Weight *weight, typename A::Label *label) { + using GWT = StringWeight; + const GWT &w1 = gallic_weight.Value1(); + const AW &w2 = gallic_weight.Value2(); + typename GWT::Iterator iter1(w1); + const Label l = w1.Size() == 1 ? iter1.Value() : 0; + if (l == kStringInfinity || l == kStringBad || w1.Size() > 1) return false; + *label = l; + *weight = w2; + return true; + } + + static bool Extract(const GallicWeight &gallic_weight, + typename A::Weight *weight, typename A::Label *label) { + if (gallic_weight.Size() > 1) return false; + if (gallic_weight.Size() == 0) { + *label = 0; + *weight = A::Weight::Zero(); + return true; + } + return Extract(gallic_weight.Back(), weight, label); + } + + const Label superfinal_label_; + mutable bool error_; +}; + +// Mapper from GallicArc to A. +template +class GallicToNewSymbolsMapper { + public: + using FromArc = GallicArc; + using ToArc = A; + + using Label = typename ToArc::Label; + using StateId = typename ToArc::StateId; + using AW = typename ToArc::Weight; + using GW = typename FromArc::Weight; + using SW = StringWeight; + + explicit GallicToNewSymbolsMapper(MutableFst *fst) + : fst_(fst), + lmax_(0), + osymbols_(fst->OutputSymbols()), + isymbols_(nullptr), + error_(false) { + fst_->DeleteStates(); + state_ = fst_->AddState(); + fst_->SetStart(state_); + fst_->SetFinal(state_, AW::One()); + if (osymbols_) { + string name = osymbols_->Name() + "_from_gallic"; + fst_->SetInputSymbols(new SymbolTable(name)); + isymbols_ = fst_->MutableInputSymbols(); + const int64 zero = 0; + isymbols_->AddSymbol(osymbols_->Find(zero), 0); + } else { + fst_->SetInputSymbols(nullptr); + } + } + + ToArc operator()(const FromArc &arc) { + // Super-non-final arc. + if (arc.nextstate == kNoStateId && arc.weight == GW::Zero()) { + return ToArc(arc.ilabel, 0, AW::Zero(), kNoStateId); + } + SW w1 = arc.weight.Value1(); + AW w2 = arc.weight.Value2(); + Label l; + if (w1.Size() == 0) { + l = 0; + } else { + auto insert_result = map_.insert(std::make_pair(w1, kNoLabel)); + if (!insert_result.second) { + l = insert_result.first->second; + } else { + l = ++lmax_; + insert_result.first->second = l; + StringWeightIterator iter1(w1); + StateId n; + string s; + for (size_t i = 0, p = state_; i < w1.Size(); + ++i, iter1.Next(), p = n) { + n = i == w1.Size() - 1 ? state_ : fst_->AddState(); + fst_->AddArc(p, ToArc(i ? 0 : l, iter1.Value(), AW::One(), n)); + if (isymbols_) { + if (i) s = s + "_"; + s = s + osymbols_->Find(iter1.Value()); + } + } + if (isymbols_) isymbols_->AddSymbol(s, l); + } + } + if (l == kStringInfinity || l == kStringBad || arc.ilabel != arc.olabel) { + FSTERROR() << "GallicToNewSymbolMapper: Unrepresentable weight: " << l; + error_ = true; + } + return ToArc(arc.ilabel, l, w2, arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_ALLOW_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + uint64 Properties(uint64 inprops) const { + uint64 outprops = inprops & kOLabelInvariantProperties & + kWeightInvariantProperties & kAddSuperFinalProperties; + if (error_) outprops |= kError; + return outprops; + } + + private: + class StringKey { + public: + size_t operator()(const SW &x) const { return x.Hash(); } + }; + + using Map = std::unordered_map; + + MutableFst *fst_; + Map map_; + Label lmax_; + StateId state_; + const SymbolTable *osymbols_; + SymbolTable *isymbols_; + mutable bool error_; +}; + +// TODO(kbg): Add common base class for those mappers which do nothing except +// mutate their weights. + +// Mapper to add a constant to all weights. +template +class PlusMapper { + public: + using FromArc = A; + using ToArc = A; + using Weight = typename FromArc::Weight; + + constexpr explicit PlusMapper(Weight weight) : weight_(std::move(weight)) {} + + ToArc operator()(const FromArc &arc) const { + if (arc.weight == Weight::Zero()) return arc; + return ToArc(arc.ilabel, arc.olabel, Plus(arc.weight, weight_), + arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return props & kWeightInvariantProperties; + } + + private: + const Weight weight_; +}; + +// Mapper to (right) multiply a constant to all weights. +template +class TimesMapper { + public: + using FromArc = A; + using ToArc = A; + using Weight = typename FromArc::Weight; + + constexpr explicit TimesMapper(Weight weight) : weight_(std::move(weight)) {} + + ToArc operator()(const FromArc &arc) const { + if (arc.weight == Weight::Zero()) return arc; + return ToArc(arc.ilabel, arc.olabel, Times(arc.weight, weight_), + arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return props & kWeightInvariantProperties; + } + + private: + const Weight weight_; +}; + +// Mapper to take all weights to a constant power. The power argument is stored +// as a double, so if there is a floating-point power implementation for this +// weight type, it will take precedence. Otherwise, the power argument's 53 bits +// of integer precision will be implicitly converted to a size_t and the default +// power implementation (iterated multiplication) will be used instead. +template +class PowerMapper { + public: + using FromArc = A; + using ToArc = A; + using Weight = typename FromArc::Weight; + + explicit PowerMapper(double power) : power_(power) {} + + ToArc operator()(const FromArc &arc) const { + return ToArc(arc.ilabel, arc.olabel, Power(arc.weight, power_), + arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return props & kWeightInvariantProperties; + } + + private: + const double power_; +}; + +// Mapper to reciprocate all non-Zero() weights. +template +class InvertWeightMapper { + public: + using FromArc = A; + using ToArc = A; + using Weight = typename FromArc::Weight; + + ToArc operator()(const FromArc &arc) const { + if (arc.weight == Weight::Zero()) return arc; + return ToArc(arc.ilabel, arc.olabel, Divide(Weight::One(), arc.weight), + arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return props & kWeightInvariantProperties; + } +}; + +// Mapper to map all non-Zero() weights to One(). +template +class RmWeightMapper { + public: + using FromArc = A; + using ToArc = B; + using FromWeight = typename FromArc::Weight; + using ToWeight = typename ToArc::Weight; + + ToArc operator()(const FromArc &arc) const { + return ToArc(arc.ilabel, arc.olabel, + arc.weight != FromWeight::Zero() ? + ToWeight::One() : ToWeight::Zero(), + arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return (props & kWeightInvariantProperties) | kUnweighted; + } +}; + +// Mapper to quantize all weights. +template +class QuantizeMapper { + public: + using FromArc = A; + using ToArc = B; + using FromWeight = typename FromArc::Weight; + using ToWeight = typename ToArc::Weight; + + QuantizeMapper() : delta_(kDelta) {} + + explicit QuantizeMapper(float d) : delta_(d) {} + + ToArc operator()(const FromArc &arc) const { + return ToArc(arc.ilabel, arc.olabel, arc.weight.Quantize(delta_), + arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return props & kWeightInvariantProperties; + } + + private: + const float delta_; +}; + +// Mapper from A to B under the assumption: +// +// B::Weight = A::Weight::ReverseWeight +// B::Label == A::Label +// B::StateId == A::StateId +// +// The weight is reversed, while the label and nextstate are preserved. +template +class ReverseWeightMapper { + public: + using FromArc = A; + using ToArc = B; + + constexpr ToArc operator()(const FromArc &arc) const { + return ToArc(arc.ilabel, arc.olabel, arc.weight.Reverse(), arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { return props; } +}; + +} // namespace fst + +#endif // FST_ARC_MAP_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/arc.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/arc.h new file mode 100644 index 0000000..651b11d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/arc.h @@ -0,0 +1,317 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Commonly used FST arc types. + +#ifndef FST_ARC_H_ +#define FST_ARC_H_ + +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace fst { + +template +struct ArcTpl { + public: + using Weight = W; + using Label = int; + using StateId = int; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + ArcTpl() noexcept(std::is_nothrow_default_constructible::value) {} + + template + ArcTpl(Label ilabel, Label olabel, T &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const auto *const type = + new string(Weight::Type() == "tropical" ? "standard" : Weight::Type()); + return *type; + } +}; + +using StdArc = ArcTpl; +using LogArc = ArcTpl; +using Log64Arc = ArcTpl; +using SignedLogArc = ArcTpl; +using SignedLog64Arc = ArcTpl; +using MinMaxArc = ArcTpl; + +// Arc with integer labels and state IDs and string weights. +template +struct StringArc { + public: + using Label = int; + using Weight = StringWeight; + using StateId = int; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + StringArc() = default; + + template + StringArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const auto *const type = new string( + S == STRING_LEFT ? "left_standard_string" + : (S == STRING_RIGHT ? "right_standard_string" + : "restricted_standard_string")); + return *type; + } +}; + +// Arc with label and state Id type the same as template arg and with +// weights over the Gallic semiring w.r.t the output labels and weights of A. +template +struct GallicArc { + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = GallicWeight; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + GallicArc() = default; + + template + GallicArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + explicit GallicArc(const Arc &arc) + : ilabel(arc.ilabel), olabel(arc.ilabel), weight(arc.olabel, arc.weight), + nextstate(arc.nextstate) {} + + static const string &Type() { + static const auto *const type = new string( + (G == GALLIC_LEFT + ? "left_gallic_" + : (G == GALLIC_RIGHT + ? "right_gallic_" + : (G == GALLIC_RESTRICT + ? "restricted_gallic_" + : (G == GALLIC_MIN ? "min_gallic_" : "gallic_")))) + + Arc::Type()); + return *type; + } +}; + +// Arc with the reverse of the weight found in its template arg. +template +struct ReverseArc { + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using AWeight = typename Arc::Weight; + using Weight = typename AWeight::ReverseWeight; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + ReverseArc() = default; + + template + ReverseArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const auto *const type = new string("reverse_" + Arc::Type()); + return *type; + } +}; + +// Arc with integer labels and state IDs and lexicographic weights. +template +struct LexicographicArc { + using Label = int; + using StateId = int; + using Weight = LexicographicWeight; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + LexicographicArc() = default; + + template + LexicographicArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const string *const type = new string(Weight::Type()); + return *type; + } +}; + +// Arc with integer labels and state IDs and product weights. +template +struct ProductArc { + using Label = int; + using StateId = int; + using Weight = ProductWeight; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + ProductArc() = default; + + template + ProductArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const auto *const type = new string(Weight::Type()); + return *type; + } +}; + +// Arc with label and state ID type the same as first template argument and with +// weights over the n-th Cartesian power of the weight type of the template +// argument. +template +struct PowerArc { + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = PowerWeight; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + PowerArc() = default; + + template + PowerArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const auto *const type = + new string(Arc::Type() + "_^" + std::to_string(n)); + return *type; + } +}; + +// Arc with label and state ID type the same as first template argument and with +// weights over the arbitrary Cartesian power of the weight type. +template +struct SparsePowerArc { + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::Label; + using Weight = SparsePowerWeight; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + SparsePowerArc() = default; + + template + SparsePowerArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const string *const type = [] { + string type = Arc::Type() + "_^n"; + if (sizeof(K) != sizeof(uint32)) { + type += "_" + std::to_string(CHAR_BIT * sizeof(K)); + } + return new string(type); + }(); + return *type; + } +}; + +// Arc with label and state ID type the same as first template argument and with +// expectation weight over the first template argument's weight type and the +// second template argument. +template +struct ExpectationArc { + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using X1 = typename Arc::Weight; + using Weight = ExpectationWeight; + + Label ilabel; + Label olabel; + Weight weight; + StateId nextstate; + + ExpectationArc() = default; + + template + ExpectationArc(Label ilabel, Label olabel, W &&weight, StateId nextstate) + : ilabel(ilabel), + olabel(olabel), + weight(std::forward(weight)), + nextstate(nextstate) {} + + static const string &Type() { + static const auto *const type = + new string("expectation_" + Arc::Type() + "_" + X2::Type()); + return *type; + } +}; + +} // namespace fst + +#endif // FST_ARC_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/arcfilter.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/arcfilter.h new file mode 100644 index 0000000..598e543 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/arcfilter.h @@ -0,0 +1,93 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function objects to restrict which arcs are traversed in an FST. + +#ifndef FST_ARCFILTER_H_ +#define FST_ARCFILTER_H_ + + +#include +#include + + +namespace fst { + +// True for all arcs. +template +class AnyArcFilter { + public: + bool operator()(const Arc &arc) const { return true; } +}; + +// True for (input/output) epsilon arcs. +template +class EpsilonArcFilter { + public: + bool operator()(const Arc &arc) const { + return arc.ilabel == 0 && arc.olabel == 0; + } +}; + +// True for input epsilon arcs. +template +class InputEpsilonArcFilter { + public: + bool operator()(const Arc &arc) const { return arc.ilabel == 0; } +}; + +// True for output epsilon arcs. +template +class OutputEpsilonArcFilter { + public: + bool operator()(const Arc &arc) const { return arc.olabel == 0; } +}; + +// True if specified label matches (doesn't match) when keep_match is +// true (false). +template +class LabelArcFilter { + public: + using Label = typename Arc::Label; + + explicit LabelArcFilter(Label label, bool match_input = true, + bool keep_match = true) + : label_(label), match_input_(match_input), keep_match_(keep_match) {} + + bool operator()(const Arc &arc) const { + const bool match = (match_input_ ? arc.ilabel : arc.olabel) == label_; + return keep_match_ ? match : !match; + } + + private: + const Label label_; + const bool match_input_; + const bool keep_match_; +}; + +// True if specified labels match (don't match) when keep_match is true (false). +template +class MultiLabelArcFilter { + public: + using Label = typename Arc::Label; + + explicit MultiLabelArcFilter(bool match_input = true, bool keep_match = true) + : match_input_(match_input), keep_match_(keep_match) {} + + bool operator()(const Arc &arc) const { + const Label label = match_input_ ? arc.ilabel : arc.olabel; + const bool match = labels_.Find(label) != labels_.End(); + return keep_match_ ? match : !match; + } + + void AddLabel(Label label) { labels_.Insert(label); } + + private: + CompactSet labels_; + const bool match_input_; + const bool keep_match_; +}; + +} // namespace fst + +#endif // FST_ARCFILTER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/arcsort.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/arcsort.h new file mode 100644 index 0000000..b5ab50e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/arcsort.h @@ -0,0 +1,211 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to sort arcs in an FST. + +#ifndef FST_ARCSORT_H_ +#define FST_ARCSORT_H_ + +#include +#include +#include + +#include +#include +#include + + +namespace fst { + +template +class ArcSortMapper { + public: + using FromArc = Arc; + using ToArc = Arc; + + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + constexpr ArcSortMapper(const Fst &fst, const Compare &comp) + : fst_(fst), comp_(comp), i_(0) {} + + // Allows updating Fst argument; pass only if changed. + ArcSortMapper(const ArcSortMapper &mapper, + const Fst *fst = nullptr) + : fst_(fst ? *fst : mapper.fst_), comp_(mapper.comp_), i_(0) {} + + StateId Start() { return fst_.Start(); } + + Weight Final(StateId s) const { return fst_.Final(s); } + + void SetState(StateId s) { + i_ = 0; + arcs_.clear(); + arcs_.reserve(fst_.NumArcs(s)); + for (ArcIterator> aiter(fst_, s); !aiter.Done(); aiter.Next()) { + arcs_.push_back(aiter.Value()); + } + std::sort(arcs_.begin(), arcs_.end(), comp_); + } + + bool Done() const { return i_ >= arcs_.size(); } + + const Arc &Value() const { return arcs_[i_]; } + + void Next() { ++i_; } + + MapSymbolsAction InputSymbolsAction() const { return MAP_COPY_SYMBOLS; } + + MapSymbolsAction OutputSymbolsAction() const { return MAP_COPY_SYMBOLS; } + + uint64 Properties(uint64 props) const { return comp_.Properties(props); } + + private: + const Fst &fst_; + const Compare &comp_; + std::vector arcs_; + ssize_t i_; // current arc position + + ArcSortMapper &operator=(const ArcSortMapper &) = delete; +}; + +// Sorts the arcs in an FST according to function object 'comp' of type Compare. +// This version modifies its input. Comparison function objects ILabelCompare +// and OLabelCompare are provided by the library. In general, Compare must meet +// the requirements for a comparison function object (e.g., similar to those +// used by std::sort). It must also have a member Properties(uint64) that +// specifies the known properties of the sorted FST; it takes as argument the +// input FST's known properties before the sort. +// +// Complexity: +// +// - Time: O(v d log d) +// - Space: O(d) +// +// where v = # of states and d = maximum out-degree. +template +void ArcSort(MutableFst *fst, Compare comp) { + ArcSortMapper mapper(*fst, comp); + StateMap(fst, mapper); +} + +using ArcSortFstOptions = CacheOptions; + +// Sorts the arcs in an FST according to function object 'comp' of type Compare. +// This version is a delayed FST. Comparsion function objects ILabelCompare and +// OLabelCompare are provided by the library. In general, Compare must meet the +// requirements for a comparision function object (e.g., similar to those +// used by std::sort). It must also have a member Properties(uint64) that +// specifies the known properties of the sorted FST; it takes as argument the +// input FST's known properties. +// +// Complexity: +// +// - Time: O(v d log d) +// - Space: O(d) +// +// where v = # of states visited, d = maximum out-degree of states visited. +// Constant time and space to visit an input state is assumed and exclusive of +// caching. +template +class ArcSortFst : public StateMapFst> { + using StateMapFst>::GetImpl; + + public: + using StateId = typename Arc::StateId; + using Mapper = ArcSortMapper; + + ArcSortFst(const Fst &fst, const Compare &comp) + : StateMapFst(fst, + ArcSortMapper(fst, comp)) {} + + ArcSortFst(const Fst &fst, const Compare &comp, + const ArcSortFstOptions &opts) + : StateMapFst(fst, Mapper(fst, comp), opts) {} + + // See Fst<>::Copy() for doc. + ArcSortFst(const ArcSortFst &fst, bool safe = false) + : StateMapFst(fst, safe) {} + + // Gets a copy of this ArcSortFst. See Fst<>::Copy() for further doc. + ArcSortFst *Copy(bool safe = false) const override { + return new ArcSortFst(*this, safe); + } + + size_t NumArcs(StateId s) const override { + return GetImpl()->GetFst()->NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) const override { + return GetImpl()->GetFst()->NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) const override { + return GetImpl()->GetFst()->NumOutputEpsilons(s); + } +}; + +// Specialization for ArcSortFst. +template +class StateIterator> + : public StateIterator>> { + public: + explicit StateIterator(const ArcSortFst &fst) + : StateIterator>>(fst) { + } +}; + +// Specialization for ArcSortFst. +template +class ArcIterator> + : public ArcIterator>> { + public: + ArcIterator(const ArcSortFst &fst, typename Arc::StateId s) + : ArcIterator>>(fst, + s) {} +}; + +// Compare class for comparing input labels of arcs. +template +class ILabelCompare { + public: + constexpr ILabelCompare() {} + + constexpr bool operator()(const Arc &arc1, const Arc &arc2) const { + return arc1.ilabel < arc2.ilabel; + } + + constexpr uint64 Properties(uint64 props) const { + return (props & kArcSortProperties) | kILabelSorted | + (props & kAcceptor ? kOLabelSorted : 0); + } +}; + +// Compare class for comparing output labels of arcs. +template +class OLabelCompare { + public: + constexpr OLabelCompare() {} + + constexpr bool operator()(const Arc &arc1, const Arc &arc2) const { + return arc1.olabel < arc2.olabel; + } + + constexpr uint64 Properties(uint64 props) const { + return (props & kArcSortProperties) | kOLabelSorted | + (props & kAcceptor ? kILabelSorted : 0); + } +}; + +// Useful aliases when using StdArc. + +template +using StdArcSortFst = ArcSortFst; + +using StdILabelCompare = ILabelCompare; + +using StdOLabelCompare = OLabelCompare; + +} // namespace fst + +#endif // FST_ARCSORT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/bi-table.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/bi-table.h new file mode 100644 index 0000000..9651cfe --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/bi-table.h @@ -0,0 +1,480 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes for representing a bijective mapping between an arbitrary entry +// of type T and a signed integral ID. + +#ifndef FST_BI_TABLE_H_ +#define FST_BI_TABLE_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace fst { + +// Bitables model bijective mappings between entries of an arbitrary type T and +// an signed integral ID of type I. The IDs are allocated starting from 0 in +// order. +// +// template +// class BiTable { +// public: +// +// // Required constructors. +// BiTable(); +// +// // Looks up integer ID from entry. If it doesn't exist and insert +// / is true, adds it; otherwise, returns -1. +// I FindId(const T &entry, bool insert = true); +// +// // Looks up entry from integer ID. +// const T &FindEntry(I) const; +// +// // Returns number of stored entries. +// I Size() const; +// }; + +// An implementation using a hash map for the entry to ID mapping. H is the +// hash function and E is the equality function. If passed to the constructor, +// ownership is given to this class. +template > +class HashBiTable { + public: + // Reserves space for table_size elements. If passing H and E to the + // constructor, this class owns them. + explicit HashBiTable(size_t table_size = 0, H *h = nullptr, E *e = nullptr) : + hash_func_(h ? h : new H()), hash_equal_(e ? e : new E()), + entry2id_(table_size, *hash_func_, *hash_equal_) { + if (table_size) id2entry_.reserve(table_size); + } + + HashBiTable(const HashBiTable &table) + : hash_func_(new H(*table.hash_func_)), + hash_equal_(new E(*table.hash_equal_)), + entry2id_(table.entry2id_.begin(), table.entry2id_.end(), + table.entry2id_.size(), *hash_func_, *hash_equal_), + id2entry_(table.id2entry_) {} + + I FindId(const T &entry, bool insert = true) { + if (!insert) { + const auto it = entry2id_.find(entry); + return it == entry2id_.end() ? -1 : it->second - 1; + } + I &id_ref = entry2id_[entry]; + if (id_ref == 0) { // T not found; stores and assigns a new ID. + id2entry_.push_back(entry); + id_ref = id2entry_.size(); + } + return id_ref - 1; // NB: id_ref = ID + 1. + } + + const T &FindEntry(I s) const { return id2entry_[s]; } + + I Size() const { return id2entry_.size(); } + + // TODO(riley): Add fancy clear-to-size, as in CompactHashBiTable. + void Clear() { + entry2id_.clear(); + id2entry_.clear(); + } + + private: + std::unique_ptr hash_func_; + std::unique_ptr hash_equal_; + std::unordered_map entry2id_; + std::vector id2entry_; +}; + +// Enables alternative hash set representations below. +enum HSType { HS_STL = 0, HS_DENSE = 1, HS_SPARSE = 2, HS_FLAT = 3 }; + +// Default hash set is STL hash_set. +template +struct HashSet : public std::unordered_set> { + explicit HashSet(size_t n = 0, const H &h = H(), const E &e = E()) + : std::unordered_set>(n, h, e) {} + + void rehash(size_t n) {} +}; + +// An implementation using a hash set for the entry to ID mapping. The hash set +// holds keys which are either the ID or kCurrentKey. These keys can be mapped +// to entries either by looking up in the entry vector or, if kCurrentKey, in +// current_entry_. The hash and key equality functions map to entries first. H +// is the hash function and E is the equality function. If passed to the +// constructor, ownership is given to this class. +// TODO(rybach): remove support for (deprecated and unused) HS_DENSE, HS_SPARSE. +template , + HSType HS = HS_FLAT> +class CompactHashBiTable { + public: + friend class HashFunc; + friend class HashEqual; + + // Reserves space for table_size elements. If passing H and E to the + // constructor, this class owns them. + explicit CompactHashBiTable(size_t table_size = 0, H *h = nullptr, + E *e = nullptr) : + hash_func_(h ? h : new H()), hash_equal_(e ? e : new E()), + compact_hash_func_(*this), compact_hash_equal_(*this), + keys_(table_size, compact_hash_func_, compact_hash_equal_) { + if (table_size) id2entry_.reserve(table_size); + } + + CompactHashBiTable(const CompactHashBiTable &table) + : hash_func_(new H(*table.hash_func_)), + hash_equal_(new E(*table.hash_equal_)), + compact_hash_func_(*this), compact_hash_equal_(*this), + keys_(table.keys_.size(), compact_hash_func_, compact_hash_equal_), + id2entry_(table.id2entry_) { + keys_.insert(table.keys_.begin(), table.keys_.end()); + } + + I FindId(const T &entry, bool insert = true) { + current_entry_ = &entry; + if (insert) { + auto result = keys_.insert(kCurrentKey); + if (!result.second) return *result.first; // Already exists. + // Overwrites kCurrentKey with a new key value; this is safe because it + // doesn't affect hashing or equality testing. + I key = id2entry_.size(); + const_cast(*result.first) = key; + id2entry_.push_back(entry); + return key; + } + const auto it = keys_.find(kCurrentKey); + return it == keys_.end() ? -1 : *it; + } + + const T &FindEntry(I s) const { return id2entry_[s]; } + + I Size() const { return id2entry_.size(); } + + // Clears content; with argument, erases last n IDs. + void Clear(ssize_t n = -1) { + if (n < 0 || n >= id2entry_.size()) { // Clears completely. + keys_.clear(); + id2entry_.clear(); + } else if (n == id2entry_.size() - 1) { // Leaves only key 0. + const T entry = FindEntry(0); + keys_.clear(); + id2entry_.clear(); + FindId(entry, true); + } else { + while (n-- > 0) { + I key = id2entry_.size() - 1; + keys_.erase(key); + id2entry_.pop_back(); + } + keys_.rehash(0); + } + } + + private: + static_assert(std::is_signed::value, "I must be a signed type"); + // ... otherwise >= kCurrentKey comparisons as used below don't work. + // TODO(rybach): (1) remove kEmptyKey, kDeletedKey, (2) don't use >= for key + // comparison, (3) allow unsigned key types. + static constexpr I kCurrentKey = -1; + static constexpr I kEmptyKey = -2; + static constexpr I kDeletedKey = -3; + + class HashFunc { + public: + explicit HashFunc(const CompactHashBiTable &ht) : ht_(&ht) {} + + size_t operator()(I k) const { + if (k >= kCurrentKey) { + return (*ht_->hash_func_)(ht_->Key2Entry(k)); + } else { + return 0; + } + } + + private: + const CompactHashBiTable *ht_; + }; + + class HashEqual { + public: + explicit HashEqual(const CompactHashBiTable &ht) : ht_(&ht) {} + + bool operator()(I k1, I k2) const { + if (k1 == k2) { + return true; + } else if (k1 >= kCurrentKey && k2 >= kCurrentKey) { + return (*ht_->hash_equal_)(ht_->Key2Entry(k1), ht_->Key2Entry(k2)); + } else { + return false; + } + } + + private: + const CompactHashBiTable *ht_; + }; + + using KeyHashSet = HashSet; + + const T &Key2Entry(I k) const { + if (k == kCurrentKey) { + return *current_entry_; + } else { + return id2entry_[k]; + } + } + + std::unique_ptr hash_func_; + std::unique_ptr hash_equal_; + HashFunc compact_hash_func_; + HashEqual compact_hash_equal_; + KeyHashSet keys_; + std::vector id2entry_; + const T *current_entry_; +}; + +template +constexpr I CompactHashBiTable::kCurrentKey; + +template +constexpr I CompactHashBiTable::kEmptyKey; + +template +constexpr I CompactHashBiTable::kDeletedKey; + +// An implementation using a vector for the entry to ID mapping. It is passed a +// function object FP that should fingerprint entries uniquely to an integer +// that can used as a vector index. Normally, VectorBiTable constructs the FP +// object. The user can instead pass in this object; in that case, VectorBiTable +// takes its ownership. +template +class VectorBiTable { + public: + // Reserves table_size cells of space. If passing FP argument to the + // constructor, this class owns it. + explicit VectorBiTable(FP *fp = nullptr, size_t table_size = 0) : + fp_(fp ? fp : new FP()) { + if (table_size) id2entry_.reserve(table_size); + } + + VectorBiTable(const VectorBiTable &table) + : fp_(new FP(*table.fp_)), fp2id_(table.fp2id_), + id2entry_(table.id2entry_) {} + + I FindId(const T &entry, bool insert = true) { + ssize_t fp = (*fp_)(entry); + if (fp >= fp2id_.size()) fp2id_.resize(fp + 1); + I &id_ref = fp2id_[fp]; + if (id_ref == 0) { // T not found. + if (insert) { // Stores and assigns a new ID. + id2entry_.push_back(entry); + id_ref = id2entry_.size(); + } else { + return -1; + } + } + return id_ref - 1; // NB: id_ref = ID + 1. + } + + const T &FindEntry(I s) const { return id2entry_[s]; } + + I Size() const { return id2entry_.size(); } + + const FP &Fingerprint() const { return *fp_; } + + private: + std::unique_ptr fp_; + std::vector fp2id_; + std::vector id2entry_; +}; + +// An implementation using a vector and a compact hash table. The selecting +// functor S returns true for entries to be hashed in the vector. The +// fingerprinting functor FP returns a unique fingerprint for each entry to be +// hashed in the vector (these need to be suitable for indexing in a vector). +// The hash functor H is used when hashing entry into the compact hash table. +// If passed to the constructor, ownership is given to this class. +template +class VectorHashBiTable { + public: + friend class HashFunc; + friend class HashEqual; + + explicit VectorHashBiTable(S *s, FP *fp, H *h, size_t vector_size = 0, + size_t entry_size = 0) + : selector_(s), fp_(fp), h_(h), hash_func_(*this), hash_equal_(*this), + keys_(0, hash_func_, hash_equal_) { + if (vector_size) fp2id_.reserve(vector_size); + if (entry_size) id2entry_.reserve(entry_size); + } + + VectorHashBiTable(const VectorHashBiTable &table) + : selector_(new S(table.s_)), fp_(new FP(*table.fp_)), + h_(new H(*table.h_)), id2entry_(table.id2entry_), + fp2id_(table.fp2id_), hash_func_(*this), hash_equal_(*this), + keys_(table.keys_.size(), hash_func_, hash_equal_) { + keys_.insert(table.keys_.begin(), table.keys_.end()); + } + + I FindId(const T &entry, bool insert = true) { + if ((*selector_)(entry)) { // Uses the vector if selector_(entry) == true. + uint64 fp = (*fp_)(entry); + if (fp2id_.size() <= fp) fp2id_.resize(fp + 1, 0); + if (fp2id_[fp] == 0) { // T not found. + if (insert) { // Stores and assigns a new ID. + id2entry_.push_back(entry); + fp2id_[fp] = id2entry_.size(); + } else { + return -1; + } + } + return fp2id_[fp] - 1; // NB: assoc_value = ID + 1. + } else { // Uses the hash table otherwise. + current_entry_ = &entry; + const auto it = keys_.find(kCurrentKey); + if (it == keys_.end()) { + if (insert) { + I key = id2entry_.size(); + id2entry_.push_back(entry); + keys_.insert(key); + return key; + } else { + return -1; + } + } else { + return *it; + } + } + } + + const T &FindEntry(I s) const { return id2entry_[s]; } + + I Size() const { return id2entry_.size(); } + + const S &Selector() const { return *selector_; } + + const FP &Fingerprint() const { return *fp_; } + + const H &Hash() const { return *h_; } + + private: + static constexpr I kCurrentKey = -1; + static constexpr I kEmptyKey = -2; + + class HashFunc { + public: + explicit HashFunc(const VectorHashBiTable &ht) : ht_(&ht) {} + + size_t operator()(I k) const { + if (k >= kCurrentKey) { + return (*(ht_->h_))(ht_->Key2Entry(k)); + } else { + return 0; + } + } + + private: + const VectorHashBiTable *ht_; + }; + + class HashEqual { + public: + explicit HashEqual(const VectorHashBiTable &ht) : ht_(&ht) {} + + bool operator()(I k1, I k2) const { + if (k1 >= kCurrentKey && k2 >= kCurrentKey) { + return ht_->Key2Entry(k1) == ht_->Key2Entry(k2); + } else { + return k1 == k2; + } + } + + private: + const VectorHashBiTable *ht_; + }; + + using KeyHashSet = HashSet; + + const T &Key2Entry(I k) const { + if (k == kCurrentKey) { + return *current_entry_; + } else { + return id2entry_[k]; + } + } + + std::unique_ptr selector_; // True if entry hashed into vector. + std::unique_ptr fp_; // Fingerprint used for hashing into vector. + std::unique_ptr h_; // Hash funcion used for hashing into hash_set. + + std::vector id2entry_; // Maps state IDs to entry. + std::vector fp2id_; // Maps entry fingerprints to IDs. + + // Compact implementation of the hash table mapping entries to state IDs + // using the hash function h_. + HashFunc hash_func_; + HashEqual hash_equal_; + KeyHashSet keys_; + const T *current_entry_; +}; + +template +constexpr I VectorHashBiTable::kCurrentKey; + +template +constexpr I VectorHashBiTable::kEmptyKey; + +// An implementation using a hash map for the entry to ID mapping. This version +// permits erasing of arbitrary states. The entry T must have == defined and +// its default constructor must produce a entry that will never be seen. F is +// the hash function. +template +class ErasableBiTable { + public: + ErasableBiTable() : first_(0) {} + + I FindId(const T &entry, bool insert = true) { + I &id_ref = entry2id_[entry]; + if (id_ref == 0) { // T not found. + if (insert) { // Stores and assigns a new ID. + id2entry_.push_back(entry); + id_ref = id2entry_.size() + first_; + } else { + return -1; + } + } + return id_ref - 1; // NB: id_ref = ID + 1. + } + + const T &FindEntry(I s) const { return id2entry_[s - first_]; } + + I Size() const { return id2entry_.size(); } + + void Erase(I s) { + auto &ref = id2entry_[s - first_]; + entry2id_.erase(ref); + ref = empty_entry_; + while (!id2entry_.empty() && id2entry_.front() == empty_entry_) { + id2entry_.pop_front(); + ++first_; + } + } + + private: + std::unordered_map entry2id_; + std::deque id2entry_; + const T empty_entry_; + I first_; // I of first element in the deque. +}; + +} // namespace fst + +#endif // FST_BI_TABLE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/cache.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/cache.h new file mode 100644 index 0000000..13b7cf8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/cache.h @@ -0,0 +1,1327 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// An FST implementation that caches FST elements of a delayed computation. + +#ifndef FST_CACHE_H_ +#define FST_CACHE_H_ + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +DECLARE_bool(fst_default_cache_gc); +DECLARE_int64(fst_default_cache_gc_limit); + +namespace fst { + +// Options for controlling caching behavior; higher level than CacheImplOptions. +struct CacheOptions { + bool gc; // Enables GC. + size_t gc_limit; // Number of bytes allowed before GC. + + explicit CacheOptions(bool gc = FLAGS_fst_default_cache_gc, + size_t gc_limit = FLAGS_fst_default_cache_gc_limit) + : gc(gc), gc_limit(gc_limit) {} +}; + +// Options for controlling caching behavior, at a lower level than +// CacheOptions; templated on the cache store and allows passing the store. +template +struct CacheImplOptions { + bool gc; // Enables GC. + size_t gc_limit; // Number of bytes allowed before GC. + CacheStore *store; // Cache store. + bool own_store; // Should CacheImpl takes ownership of the store? + + explicit CacheImplOptions(bool gc = FLAGS_fst_default_cache_gc, + size_t gc_limit = FLAGS_fst_default_cache_gc_limit, + CacheStore *store = nullptr) + : gc(gc), gc_limit(gc_limit), store(store), own_store(true) {} + + explicit CacheImplOptions(const CacheOptions &opts) + : gc(opts.gc), gc_limit(opts.gc_limit), store(nullptr), own_store(true) {} +}; + +// Cache flags. +constexpr uint32 kCacheFinal = 0x0001; // Final weight has been cached. +constexpr uint32 kCacheArcs = 0x0002; // Arcs have been cached. +constexpr uint32 kCacheInit = 0x0004; // Initialized by GC. +constexpr uint32 kCacheRecent = 0x0008; // Visited since GC. +constexpr uint32 kCacheFlags = + kCacheFinal | kCacheArcs | kCacheInit | kCacheRecent; + +// Cache state, with arcs stored in a per-state std::vector. +template > +class CacheState { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using ArcAllocator = M; + using StateAllocator = + typename ArcAllocator::template rebind>::other; + + // Provides STL allocator for arcs. + explicit CacheState(const ArcAllocator &alloc) + : final_(Weight::Zero()), + niepsilons_(0), + noepsilons_(0), + arcs_(alloc), + flags_(0), + ref_count_(0) {} + + CacheState(const CacheState &state, const ArcAllocator &alloc) + : final_(state.Final()), + niepsilons_(state.NumInputEpsilons()), + noepsilons_(state.NumOutputEpsilons()), + arcs_(state.arcs_.begin(), state.arcs_.end(), alloc), + flags_(state.Flags()), + ref_count_(0) {} + + void Reset() { + final_ = Weight::Zero(); + niepsilons_ = 0; + noepsilons_ = 0; + ref_count_ = 0; + flags_ = 0; + arcs_.clear(); + } + + Weight Final() const { return final_; } + + size_t NumInputEpsilons() const { return niepsilons_; } + + size_t NumOutputEpsilons() const { return noepsilons_; } + + size_t NumArcs() const { return arcs_.size(); } + + const Arc &GetArc(size_t n) const { return arcs_[n]; } + + // Used by the ArcIterator> efficient implementation. + const Arc *Arcs() const { return !arcs_.empty() ? &arcs_[0] : nullptr; } + + // Accesses flags; used by the caller. + uint32 Flags() const { return flags_; } + + // Accesses ref count; used by the caller. + int RefCount() const { return ref_count_; } + + void SetFinal(Weight weight) { final_ = std::move(weight); } + + void ReserveArcs(size_t n) { arcs_.reserve(n); } + + // Adds one arc at a time with all needed book-keeping; use PushArc and + // SetArcs for a more efficient alternative. + void AddArc(const Arc &arc) { + IncrementNumEpsilons(arc); + arcs_.push_back(arc); + } + + void AddArc(Arc &&arc) { + IncrementNumEpsilons(arc); + arcs_.push_back(std::move(arc)); + } + + // Adds one arc at a time with delayed book-keeping; finalize with SetArcs(). + void PushArc(const Arc &arc) { arcs_.push_back(arc); } + + void PushArc(Arc &&arc) { arcs_.push_back(std::move(arc)); } + + // Adds one arc at a time with delayed book-keeping; finalize with SetArcs(). + template + void EmplaceArc(T &&... ctor_args) { + arcs_.emplace_back(std::forward(ctor_args)...); + } + + // Finalizes arcs book-keeping; call only once. + void SetArcs() { + for (const auto &arc : arcs_) { + IncrementNumEpsilons(arc); + } + } + + // Modifies nth arc. + void SetArc(const Arc &arc, size_t n) { + if (arcs_[n].ilabel == 0) --niepsilons_; + if (arcs_[n].olabel == 0) --noepsilons_; + IncrementNumEpsilons(arc); + arcs_[n] = arc; + } + + // Deletes all arcs. + void DeleteArcs() { + niepsilons_ = 0; + noepsilons_ = 0; + arcs_.clear(); + } + + void DeleteArcs(size_t n) { + for (size_t i = 0; i < n; ++i) { + if (arcs_.back().ilabel == 0) --niepsilons_; + if (arcs_.back().olabel == 0) --noepsilons_; + arcs_.pop_back(); + } + } + + // Sets status flags; used by the caller. + void SetFlags(uint32 flags, uint32 mask) const { + flags_ &= ~mask; + flags_ |= flags; + } + + // Mutates reference counts; used by the caller. + + int IncrRefCount() const { return ++ref_count_; } + + int DecrRefCount() const { return --ref_count_; } + + // Used by the ArcIterator> efficient implementation. + int *MutableRefCount() const { return &ref_count_; } + + // Used for state class allocation. + void *operator new(size_t size, StateAllocator *alloc) { + return alloc->allocate(1); + } + + // For state destruction and memory freeing. + static void Destroy(CacheState *state, StateAllocator *alloc) { + if (state) { + state->~CacheState(); + alloc->deallocate(state, 1); + } + } + + private: + // Update the number of epsilons as a result of having added an arc. + void IncrementNumEpsilons(const Arc &arc) { + if (arc.ilabel == 0) ++niepsilons_; + if (arc.olabel == 0) ++noepsilons_; + } + + Weight final_; // Final weight. + size_t niepsilons_; // # of input epsilons. + size_t noepsilons_; // # of output epsilons. + std::vector arcs_; // Arcs representation. + mutable uint32 flags_; + mutable int ref_count_; // If 0, available for GC. +}; + +// Cache store, allocating and storing states, providing a mapping from state +// IDs to cached states, and an iterator over these states. The state template +// argument must implement the CacheState interface. The state for a StateId s +// is constructed when requested by GetMutableState(s) if it is not yet stored. +// Initially, a state has a reference count of zero, but the user may increment +// or decrement this to control the time of destruction. In particular, a state +// is destroyed when: +// +// 1. This instance is destroyed, or +// 2. Clear() or Delete() is called, or +// 3. Possibly (implementation-dependently) when: +// - Garbage collection is enabled (as defined by opts.gc), +// - The cache store size exceeds the limits (as defined by opts.gc_limits), +// - The state's reference count is zero, and +// - The state is not the most recently requested state. +// +// template +// class CacheStore { +// public: +// using State = S; +// using Arc = typename State::Arc; +// using StateId = typename Arc::StateId; +// +// // Required constructors/assignment operators. +// explicit CacheStore(const CacheOptions &opts); +// +// // Returns nullptr if state is not stored. +// const State *GetState(StateId s); +// +// // Creates state if state is not stored. +// State *GetMutableState(StateId s); +// +// // Similar to State::AddArc() but updates cache store book-keeping. +// void AddArc(State *state, const Arc &arc); +// +// // Similar to State::SetArcs() but updates cache store book-keeping; call +// // only once. +// void SetArcs(State *state); +// +// // Similar to State::DeleteArcs() but updates cache store book-keeping. +// +// void DeleteArcs(State *state); +// +// void DeleteArcs(State *state, size_t n); +// +// // Deletes all cached states. +// void Clear(); +// +// // Number of cached states. +// StateId CountStates(); +// +// // Iterates over cached states (in an arbitrary order); only needed if +// // opts.gc is true. +// bool Done() const; // End of iteration. +// StateId Value() const; // Current state. +// void Next(); // Advances to next state (when !Done). +// void Reset(); // Returns to initial condition. +// void Delete(); // Deletes current state and advances to next. +// }; + +// Container cache stores. + +// This class uses a vector of pointers to states to store cached states. +template +class VectorCacheStore { + public: + using State = S; + using Arc = typename State::Arc; + using StateId = typename Arc::StateId; + using StateList = std::list>; + + // Required constructors/assignment operators. + explicit VectorCacheStore(const CacheOptions &opts) : cache_gc_(opts.gc) { + Clear(); + Reset(); + } + + VectorCacheStore(const VectorCacheStore &store) + : cache_gc_(store.cache_gc_) { + CopyStates(store); + Reset(); + } + + ~VectorCacheStore() { Clear(); } + + VectorCacheStore &operator=(const VectorCacheStore &store) { + if (this != &store) { + CopyStates(store); + Reset(); + } + return *this; + } + + bool InBounds(StateId s) const { + return s < static_cast(state_vec_.size()); + } + + // Returns nullptr if state is not stored. + const State *GetState(StateId s) const { + return InBounds(s) ? state_vec_[s] : nullptr; + } + + // Creates state if state is not stored. + State *GetMutableState(StateId s) { + State *state = nullptr; + if (InBounds(s)) { + state = state_vec_[s]; + } else { + state_vec_.resize(s + 1, nullptr); + } + if (!state) { + state = new (&state_alloc_) State(arc_alloc_); + state_vec_[s] = state; + if (cache_gc_) state_list_.push_back(s); + } + return state; + } + + // Similar to State::AddArc() but updates cache store book-keeping + void AddArc(State *state, const Arc &arc) { state->AddArc(arc); } + + // Similar to State::SetArcs() but updates cache store book-keeping; call + // only once. + void SetArcs(State *state) { state->SetArcs(); } + + // Deletes all arcs. + void DeleteArcs(State *state) { state->DeleteArcs(); } + + // Deletes some arcs. + void DeleteArcs(State *state, size_t n) { state->DeleteArcs(n); } + + // Deletes all cached states. + void Clear() { + for (State *s : state_vec_) { + State::Destroy(s, &state_alloc_); + } + state_vec_.clear(); + state_list_.clear(); + } + + StateId CountStates() const { + return std::count_if(state_vec_.begin(), state_vec_.end(), + [](const State *s) { return s != nullptr; }); + } + + // Iterates over cached states (in an arbitrary order); only works if GC is + // enabled (o.w. avoiding state_list_ overhead). + bool Done() const { return iter_ == state_list_.end(); } + + StateId Value() const { return *iter_; } + + void Next() { ++iter_; } + + void Reset() { iter_ = state_list_.begin(); } + + // Deletes current state and advances to next. + void Delete() { + State::Destroy(state_vec_[*iter_], &state_alloc_); + state_vec_[*iter_] = nullptr; + state_list_.erase(iter_++); + } + + private: + void CopyStates(const VectorCacheStore &store) { + Clear(); + state_vec_.reserve(store.state_vec_.size()); + for (size_t s = 0; s < store.state_vec_.size(); ++s) { + State *state = nullptr; + const auto *store_state = store.state_vec_[s]; + if (store_state) { + state = new (&state_alloc_) State(*store_state, arc_alloc_); + if (cache_gc_) state_list_.push_back(s); + } + state_vec_.push_back(state); + } + } + + bool cache_gc_; // Supports iteration when true. + std::vector state_vec_; // Vector of states (or null). + StateList state_list_; // List of states. + typename StateList::iterator iter_; // State list iterator. + typename State::StateAllocator state_alloc_; // For state allocation. + typename State::ArcAllocator arc_alloc_; // For arc allocation. +}; + +// This class uses a hash map from state IDs to pointers to cached states. +template +class HashCacheStore { + public: + using State = S; + using Arc = typename State::Arc; + using StateId = typename Arc::StateId; + + using StateMap = + std::unordered_map, + std::equal_to, + PoolAllocator>>; + + // Required constructors/assignment operators. + explicit HashCacheStore(const CacheOptions &opts) { + Clear(); + Reset(); + } + + HashCacheStore(const HashCacheStore &store) { + CopyStates(store); + Reset(); + } + + ~HashCacheStore() { Clear(); } + + HashCacheStore &operator=(const HashCacheStore &store) { + if (this != &store) { + CopyStates(store); + Reset(); + } + return *this; + } + + // Returns nullptr if state is not stored. + const State *GetState(StateId s) const { + const auto it = state_map_.find(s); + return it != state_map_.end() ? it->second : nullptr; + } + + // Creates state if state is not stored. + State *GetMutableState(StateId s) { + auto *&state = state_map_[s]; + if (!state) state = new (&state_alloc_) State(arc_alloc_); + return state; + } + + // Similar to State::AddArc() but updates cache store book-keeping. + void AddArc(State *state, const Arc &arc) { state->AddArc(arc); } + + // Similar to State::SetArcs() but updates internal cache size; call only + // once. + void SetArcs(State *state) { state->SetArcs(); } + + // Deletes all arcs. + void DeleteArcs(State *state) { state->DeleteArcs(); } + + // Deletes some arcs. + void DeleteArcs(State *state, size_t n) { state->DeleteArcs(n); } + + // Deletes all cached states. + void Clear() { + for (auto it = state_map_.begin(); it != state_map_.end(); ++it) { + State::Destroy(it->second, &state_alloc_); + } + state_map_.clear(); + } + + StateId CountStates() const { return state_map_.size(); } + + // Iterates over cached states (in an arbitrary order). + bool Done() const { return iter_ == state_map_.end(); } + + StateId Value() const { return iter_->first; } + + void Next() { ++iter_; } + + void Reset() { iter_ = state_map_.begin(); } + + // Deletes current state and advances to next. + void Delete() { + State::Destroy(iter_->second, &state_alloc_); + state_map_.erase(iter_++); + } + + private: + void CopyStates(const HashCacheStore &store) { + Clear(); + for (auto it = store.state_map_.begin(); it != store.state_map_.end(); + ++it) { + state_map_[it->first] = + new (&state_alloc_) State(*it->second, arc_alloc_); + } + } + + StateMap state_map_; // Map from state ID to state. + typename StateMap::iterator iter_; // State map iterator. + typename State::StateAllocator state_alloc_; // For state allocation. + typename State::ArcAllocator arc_alloc_; // For arc allocation. +}; + +// Garbage-colllection cache stores. + +// This class implements a simple garbage collection scheme when +// 'opts.gc_limit = 0'. In particular, the first cached state is reused for each +// new state so long as the reference count is zero on the to-be-reused state. +// Otherwise, the full underlying store is used. The caller can increment the +// reference count to inhibit the GC of in-use states (e.g., in an ArcIterator). +// +// The typical use case for this optimization is when a single pass over a +// cached +// FST is performed with only one-state expanded at a time. +template +class FirstCacheStore { + public: + using State = typename CacheStore::State; + using Arc = typename State::Arc; + using StateId = typename Arc::StateId; + + // Required constructors/assignment operators. + explicit FirstCacheStore(const CacheOptions &opts) + : store_(opts), + cache_gc_(opts.gc_limit == 0), // opts.gc ignored historically. + cache_first_state_id_(kNoStateId), + cache_first_state_(nullptr) {} + + FirstCacheStore(const FirstCacheStore &store) + : store_(store.store_), + cache_gc_(store.cache_gc_), + cache_first_state_id_(store.cache_first_state_id_), + cache_first_state_(store.cache_first_state_id_ != kNoStateId + ? store_.GetMutableState(0) + : nullptr) {} + + FirstCacheStore &operator=( + const FirstCacheStore &store) { + if (this != &store) { + store_ = store.store_; + cache_gc_ = store.cache_gc_; + cache_first_state_id_ = store.cache_first_state_id_; + cache_first_state_ = store.cache_first_state_id_ != kNoStateId + ? store_.GetMutableState(0) + : nullptr; + } + return *this; + } + + // Returns nullptr if state is not stored. + const State *GetState(StateId s) const { + // store_ state 0 may hold first cached state; the rest are shifted by 1. + return s == cache_first_state_id_ ? cache_first_state_ + : store_.GetState(s + 1); + } + + // Creates state if state is not stored. + State *GetMutableState(StateId s) { + // store_ state 0 used to hold first cached state; the rest are shifted by + // 1. + if (cache_first_state_id_ == s) { + return cache_first_state_; // Request for first cached state. + } + if (cache_gc_) { + if (cache_first_state_id_ == kNoStateId) { + cache_first_state_id_ = s; // Sets first cached state. + cache_first_state_ = store_.GetMutableState(0); + cache_first_state_->SetFlags(kCacheInit, kCacheInit); + cache_first_state_->ReserveArcs(2 * kAllocSize); + return cache_first_state_; + } else if (cache_first_state_->RefCount() == 0) { + cache_first_state_id_ = s; // Updates first cached state. + cache_first_state_->Reset(); + cache_first_state_->SetFlags(kCacheInit, kCacheInit); + return cache_first_state_; + } else { // Keeps first cached state. + cache_first_state_->SetFlags(0, kCacheInit); // Clears initialized bit. + cache_gc_ = false; // Disables GC. + } + } + auto *state = store_.GetMutableState(s + 1); + return state; + } + + // Similar to State::AddArc() but updates cache store book-keeping. + void AddArc(State *state, const Arc &arc) { store_.AddArc(state, arc); } + + // Similar to State::SetArcs() but updates internal cache size; call only + // once. + void SetArcs(State *state) { store_.SetArcs(state); } + + // Deletes all arcs + void DeleteArcs(State *state) { store_.DeleteArcs(state); } + + // Deletes some arcs + void DeleteArcs(State *state, size_t n) { store_.DeleteArcs(state, n); } + + // Deletes all cached states + void Clear() { + store_.Clear(); + cache_first_state_id_ = kNoStateId; + cache_first_state_ = nullptr; + } + + StateId CountStates() const { return store_.CountStates(); } + + // Iterates over cached states (in an arbitrary order). Only needed if GC is + // enabled. + bool Done() const { return store_.Done(); } + + StateId Value() const { + // store_ state 0 may hold first cached state; rest shifted + 1. + const auto s = store_.Value(); + return s ? s - 1 : cache_first_state_id_; + } + + void Next() { store_.Next(); } + + void Reset() { store_.Reset(); } + + // Deletes current state and advances to next. + void Delete() { + if (Value() == cache_first_state_id_) { + cache_first_state_id_ = kNoStateId; + cache_first_state_ = nullptr; + } + store_.Delete(); + } + + private: + CacheStore store_; // Underlying store. + bool cache_gc_; // GC enabled. + StateId cache_first_state_id_; // First cached state ID. + State *cache_first_state_; // First cached state. +}; + +// This class implements mark-sweep garbage collection on an underlying cache +// store. If GC is enabled, garbage collection of states is performed in a +// rough approximation of LRU order once when 'gc_limit' bytes is reached. The +// caller can increment the reference count to inhibit the GC of in-use state +// (e.g., in an ArcIterator). With GC enabled, the 'gc_limit' parameter allows +// the caller to trade-off time vs. space. +template +class GCCacheStore { + public: + using State = typename CacheStore::State; + using Arc = typename State::Arc; + using StateId = typename Arc::StateId; + + // Required constructors/assignment operators. + explicit GCCacheStore(const CacheOptions &opts) + : store_(opts), + cache_gc_request_(opts.gc), + cache_limit_(opts.gc_limit > kMinCacheLimit ? opts.gc_limit + : kMinCacheLimit), + cache_gc_(false), + cache_size_(0) {} + + // Returns 0 if state is not stored. + const State *GetState(StateId s) const { return store_.GetState(s); } + + // Creates state if state is not stored + State *GetMutableState(StateId s) { + auto *state = store_.GetMutableState(s); + if (cache_gc_request_ && !(state->Flags() & kCacheInit)) { + state->SetFlags(kCacheInit, kCacheInit); + cache_size_ += sizeof(State) + state->NumArcs() * sizeof(Arc); + // GC is enabled once an uninited state (from underlying store) is seen. + cache_gc_ = true; + if (cache_size_ > cache_limit_) GC(state, false); + } + return state; + } + + // Similar to State::AddArc() but updates cache store book-keeping. + void AddArc(State *state, const Arc &arc) { + store_.AddArc(state, arc); + if (cache_gc_ && (state->Flags() & kCacheInit)) { + cache_size_ += sizeof(Arc); + if (cache_size_ > cache_limit_) GC(state, false); + } + } + + // Similar to State::SetArcs() but updates internal cache size; call only + // once. + void SetArcs(State *state) { + store_.SetArcs(state); + if (cache_gc_ && (state->Flags() & kCacheInit)) { + cache_size_ += state->NumArcs() * sizeof(Arc); + if (cache_size_ > cache_limit_) GC(state, false); + } + } + + // Deletes all arcs. + void DeleteArcs(State *state) { + if (cache_gc_ && (state->Flags() & kCacheInit)) { + cache_size_ -= state->NumArcs() * sizeof(Arc); + } + store_.DeleteArcs(state); + } + + // Deletes some arcs. + void DeleteArcs(State *state, size_t n) { + if (cache_gc_ && (state->Flags() & kCacheInit)) { + cache_size_ -= n * sizeof(Arc); + } + store_.DeleteArcs(state, n); + } + + // Deletes all cached states. + void Clear() { + store_.Clear(); + cache_size_ = 0; + } + + StateId CountStates() const { return store_.CountStates(); } + + // Iterates over cached states (in an arbitrary order); only needed if GC is + // enabled. + bool Done() const { return store_.Done(); } + + StateId Value() const { return store_.Value(); } + + void Next() { store_.Next(); } + + void Reset() { store_.Reset(); } + + // Deletes current state and advances to next. + void Delete() { + if (cache_gc_) { + const auto *state = store_.GetState(Value()); + if (state->Flags() & kCacheInit) { + cache_size_ -= sizeof(State) + state->NumArcs() * sizeof(Arc); + } + } + store_.Delete(); + } + + // Removes from the cache store (not referenced-counted and not the current) + // states that have not been accessed since the last GC until at most + // cache_fraction * cache_limit_ bytes are cached. If that fails to free + // enough, attempts to uncaching recently visited states as well. If still + // unable to free enough memory, then widens cache_limit_. + void GC(const State *current, bool free_recent, float cache_fraction = 0.666); + + // Returns the current cache size in bytes or 0 if GC is disabled. + size_t CacheSize() const { return cache_size_; } + + // Returns the cache limit in bytes. + size_t CacheLimit() const { return cache_limit_; } + + private: + static constexpr size_t kMinCacheLimit = 8096; // Minimum cache limit. + + CacheStore store_; // Underlying store. + bool cache_gc_request_; // GC requested but possibly not yet enabled. + size_t cache_limit_; // Number of bytes allowed before GC. + bool cache_gc_; // GC enabled + size_t cache_size_; // Number of bytes cached. +}; + +template +void GCCacheStore::GC(const State *current, bool free_recent, + float cache_fraction) { + if (!cache_gc_) return; + VLOG(2) << "GCCacheStore: Enter GC: object = " + << "(" << this << "), free recently cached = " << free_recent + << ", cache size = " << cache_size_ + << ", cache frac = " << cache_fraction + << ", cache limit = " << cache_limit_ << "\n"; + size_t cache_target = cache_fraction * cache_limit_; + store_.Reset(); + while (!store_.Done()) { + auto *state = store_.GetMutableState(store_.Value()); + if (cache_size_ > cache_target && state->RefCount() == 0 && + (free_recent || !(state->Flags() & kCacheRecent)) && state != current) { + if (state->Flags() & kCacheInit) { + size_t size = sizeof(State) + state->NumArcs() * sizeof(Arc); + if (size < cache_size_) { + cache_size_ -= size; + } + } + store_.Delete(); + } else { + state->SetFlags(0, kCacheRecent); + store_.Next(); + } + } + if (!free_recent && cache_size_ > cache_target) { // Recurses on recent. + GC(current, true, cache_fraction); + } else if (cache_target > 0) { // Widens cache limit. + while (cache_size_ > cache_target) { + cache_limit_ *= 2; + cache_target *= 2; + } + } else if (cache_size_ > 0) { + FSTERROR() << "GCCacheStore:GC: Unable to free all cached states"; + } + VLOG(2) << "GCCacheStore: Exit GC: object = " + << "(" << this << "), free recently cached = " << free_recent + << ", cache size = " << cache_size_ + << ", cache frac = " << cache_fraction + << ", cache limit = " << cache_limit_ << "\n"; +} + +template +constexpr size_t GCCacheStore::kMinCacheLimit; + +// This class is the default cache state and store used by CacheBaseImpl. +// It uses VectorCacheStore for storage decorated by FirstCacheStore +// and GCCacheStore to do (optional) garbage collection. +template +class DefaultCacheStore + : public GCCacheStore>>> { + public: + explicit DefaultCacheStore(const CacheOptions &opts) + : GCCacheStore>>>(opts) { + } +}; + +namespace internal { + +// This class is used to cache FST elements stored in states of type State +// (see CacheState) with the flags used to indicate what has been cached. Use +// HasStart(), HasFinal(), and HasArcs() to determine if cached and SetStart(), +// SetFinal(), AddArc(), (or PushArc() and SetArcs()) to cache. Note that you +// must set the final weight even if the state is non-final to mark it as +// cached. The state storage method and any garbage collection policy are +// determined by the cache store. If the store is passed in with the options, +// CacheBaseImpl takes ownership. +template > +class CacheBaseImpl : public FstImpl { + public: + using Arc = typename State::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = CacheStore; + + using FstImpl::Type; + using FstImpl::Properties; + + explicit CacheBaseImpl(const CacheOptions &opts = CacheOptions()) + : has_start_(false), + cache_start_(kNoStateId), + nknown_states_(0), + min_unexpanded_state_id_(0), + max_expanded_state_id_(-1), + cache_gc_(opts.gc), + cache_limit_(opts.gc_limit), + cache_store_(new CacheStore(opts)), + new_cache_store_(true), + own_cache_store_(true) {} + + explicit CacheBaseImpl(const CacheImplOptions &opts) + : has_start_(false), + cache_start_(kNoStateId), + nknown_states_(0), + min_unexpanded_state_id_(0), + max_expanded_state_id_(-1), + cache_gc_(opts.gc), + cache_limit_(opts.gc_limit), + cache_store_(opts.store ? opts.store : new CacheStore(CacheOptions( + opts.gc, opts.gc_limit))), + new_cache_store_(!opts.store), + own_cache_store_(opts.store ? opts.own_store : true) {} + + // Preserve gc parameters. If preserve_cache is true, also preserves + // cache data. + CacheBaseImpl(const CacheBaseImpl &impl, + bool preserve_cache = false) + : FstImpl(), + has_start_(false), + cache_start_(kNoStateId), + nknown_states_(0), + min_unexpanded_state_id_(0), + max_expanded_state_id_(-1), + cache_gc_(impl.cache_gc_), + cache_limit_(impl.cache_limit_), + cache_store_(new CacheStore(CacheOptions(cache_gc_, cache_limit_))), + new_cache_store_(impl.new_cache_store_ || !preserve_cache), + own_cache_store_(true) { + if (preserve_cache) { + *cache_store_ = *impl.cache_store_; + has_start_ = impl.has_start_; + cache_start_ = impl.cache_start_; + nknown_states_ = impl.nknown_states_; + expanded_states_ = impl.expanded_states_; + min_unexpanded_state_id_ = impl.min_unexpanded_state_id_; + max_expanded_state_id_ = impl.max_expanded_state_id_; + } + } + + ~CacheBaseImpl() override { if (own_cache_store_) delete cache_store_; } + + void SetStart(StateId s) { + cache_start_ = s; + has_start_ = true; + if (s >= nknown_states_) nknown_states_ = s + 1; + } + + void SetFinal(StateId s, Weight weight) { + auto *state = cache_store_->GetMutableState(s); + state->SetFinal(std::move(weight)); + static constexpr auto flags = kCacheFinal | kCacheRecent; + state->SetFlags(flags, flags); + } + +// Disabled to ensure PushArc not AddArc is used in existing code +// TODO(sorenj): re-enable for backing store +#if 0 + // AddArc adds a single arc to a state and does incremental cache + // book-keeping. For efficiency, prefer PushArc and SetArcs below + // when possible. + void AddArc(StateId s, const Arc &arc) { + auto *state = cache_store_->GetMutableState(s); + cache_store_->AddArc(state, arc); + if (arc.nextstate >= nknown_states_) + nknown_states_ = arc.nextstate + 1; + SetExpandedState(s); + static constexpr auto flags = kCacheArcs | kCacheRecent; + state->SetFlags(flags, flags); + } +#endif + + // Adds a single arc to a state but delays cache book-keeping. SetArcs must + // be called when all PushArc and EmplaceArc calls at a state are complete. + // Do not mix with calls to AddArc. + void PushArc(StateId s, const Arc &arc) { + auto *state = cache_store_->GetMutableState(s); + state->PushArc(arc); + } + + void PushArc(StateId s, Arc &&arc) { + auto *state = cache_store_->GetMutableState(s); + state->PushArc(std::move(arc)); + } + + // Adds a single arc to a state but delays cache book-keeping. SetArcs must + // be called when all PushArc and EmplaceArc calls at a state are complete. + // Do not mix with calls to AddArc. + template + void EmplaceArc(StateId s, T &&... ctor_args) { + auto *state = cache_store_->GetMutableState(s); + state->EmplaceArc(std::forward(ctor_args)...); + } + + // Marks arcs of a state as cached and does cache book-keeping after all + // calls to PushArc have been completed. Do not mix with calls to AddArc. + void SetArcs(StateId s) { + auto *state = cache_store_->GetMutableState(s); + cache_store_->SetArcs(state); + const auto narcs = state->NumArcs(); + for (size_t a = 0; a < narcs; ++a) { + const auto &arc = state->GetArc(a); + if (arc.nextstate >= nknown_states_) nknown_states_ = arc.nextstate + 1; + } + SetExpandedState(s); + static constexpr auto flags = kCacheArcs | kCacheRecent; + state->SetFlags(flags, flags); + } + + void ReserveArcs(StateId s, size_t n) { + auto *state = cache_store_->GetMutableState(s); + state->ReserveArcs(n); + } + + void DeleteArcs(StateId s) { + auto *state = cache_store_->GetMutableState(s); + cache_store_->DeleteArcs(state); + } + + void DeleteArcs(StateId s, size_t n) { + auto *state = cache_store_->GetMutableState(s); + cache_store_->DeleteArcs(state, n); + } + + void Clear() { + nknown_states_ = 0; + min_unexpanded_state_id_ = 0; + max_expanded_state_id_ = -1; + has_start_ = false; + cache_start_ = kNoStateId; + cache_store_->Clear(); + } + + // Is the start state cached? + bool HasStart() const { + if (!has_start_ && Properties(kError)) has_start_ = true; + return has_start_; + } + + // Is the final weight of the state cached? + bool HasFinal(StateId s) const { + const auto *state = cache_store_->GetState(s); + if (state && state->Flags() & kCacheFinal) { + state->SetFlags(kCacheRecent, kCacheRecent); + return true; + } else { + return false; + } + } + + // Are arcs of the state cached? + bool HasArcs(StateId s) const { + const auto *state = cache_store_->GetState(s); + if (state && state->Flags() & kCacheArcs) { + state->SetFlags(kCacheRecent, kCacheRecent); + return true; + } else { + return false; + } + } + + StateId Start() const { return cache_start_; } + + Weight Final(StateId s) const { + const auto *state = cache_store_->GetState(s); + return state->Final(); + } + + size_t NumArcs(StateId s) const { + const auto *state = cache_store_->GetState(s); + return state->NumArcs(); + } + + size_t NumInputEpsilons(StateId s) const { + const auto *state = cache_store_->GetState(s); + return state->NumInputEpsilons(); + } + + size_t NumOutputEpsilons(StateId s) const { + const auto *state = cache_store_->GetState(s); + return state->NumOutputEpsilons(); + } + + // Provides information needed for generic arc iterator. + void InitArcIterator(StateId s, ArcIteratorData *data) const { + const auto *state = cache_store_->GetState(s); + data->base = nullptr; + data->narcs = state->NumArcs(); + data->arcs = state->Arcs(); + data->ref_count = state->MutableRefCount(); + state->IncrRefCount(); + } + + // Number of known states. + StateId NumKnownStates() const { return nknown_states_; } + + // Updates number of known states, taking into account the passed state ID. + void UpdateNumKnownStates(StateId s) { + if (s >= nknown_states_) nknown_states_ = s + 1; + } + + // Finds the mininum never-expanded state ID. + StateId MinUnexpandedState() const { + while (min_unexpanded_state_id_ <= max_expanded_state_id_ && + ExpandedState(min_unexpanded_state_id_)) { + ++min_unexpanded_state_id_; + } + return min_unexpanded_state_id_; + } + + // Returns maximum ever-expanded state ID. + StateId MaxExpandedState() const { return max_expanded_state_id_; } + + void SetExpandedState(StateId s) { + if (s > max_expanded_state_id_) max_expanded_state_id_ = s; + if (s < min_unexpanded_state_id_) return; + if (s == min_unexpanded_state_id_) ++min_unexpanded_state_id_; + if (cache_gc_ || cache_limit_ == 0) { + if (expanded_states_.size() <= static_cast(s)) + expanded_states_.resize(s + 1, false); + expanded_states_[s] = true; + } + } + + bool ExpandedState(StateId s) const { + if (cache_gc_ || cache_limit_ == 0) { + return expanded_states_[s]; + } else if (new_cache_store_) { + return cache_store_->GetState(s) != nullptr; + } else { + // If the cache was not created by this class, then the cached state needs + // to be inspected to update nknown_states_. + return false; + } + } + + const CacheStore *GetCacheStore() const { return cache_store_; } + + CacheStore *GetCacheStore() { return cache_store_; } + + // Caching on/off switch, limit and size accessors. + + bool GetCacheGc() const { return cache_gc_; } + + size_t GetCacheLimit() const { return cache_limit_; } + + private: + mutable bool has_start_; // Is the start state cached? + StateId cache_start_; // ID of start state. + StateId nknown_states_; // Number of known states. + std::vector expanded_states_; // States that have been expanded. + mutable StateId min_unexpanded_state_id_; // Minimum never-expanded state ID + mutable StateId max_expanded_state_id_; // Maximum ever-expanded state ID + bool cache_gc_; // GC enabled. + size_t cache_limit_; // Number of bytes allowed before GC. + CacheStore *cache_store_; // The store of cached states. + bool new_cache_store_; // Was the store was created by class? + bool own_cache_store_; // Is the store owned by class? + + CacheBaseImpl &operator=(const CacheBaseImpl &impl) = delete; +}; + +// A CacheBaseImpl with the default cache state type. +template +class CacheImpl : public CacheBaseImpl> { + public: + using State = CacheState; + + CacheImpl() {} + + explicit CacheImpl(const CacheOptions &opts) + : CacheBaseImpl>(opts) {} + + CacheImpl(const CacheImpl &impl, bool preserve_cache = false) + : CacheBaseImpl(impl, preserve_cache) {} + + private: + CacheImpl &operator=(const CacheImpl &impl) = delete; +}; + +} // namespace internal + +// Use this to make a state iterator for a CacheBaseImpl-derived FST, which must +// have Arc and Store types defined. Note this iterator only returns those +// states reachable from the initial state, so consider implementing a +// class-specific one. +// +// This class may be derived from. +template +class CacheStateIterator : public StateIteratorBase { + public: + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = typename FST::Store; + using State = typename Store::State; + using Impl = internal::CacheBaseImpl; + + CacheStateIterator(const FST &fst, Impl *impl) + : fst_(fst), impl_(impl), s_(0) { + fst_.Start(); // Forces start state. + } + + bool Done() const final { + if (s_ < impl_->NumKnownStates()) return false; + for (StateId u = impl_->MinUnexpandedState(); u < impl_->NumKnownStates(); + u = impl_->MinUnexpandedState()) { + // Forces state expansion. + ArcIterator aiter(fst_, u); + aiter.SetFlags(kArcValueFlags, kArcValueFlags | kArcNoCache); + for (; !aiter.Done(); aiter.Next()) { + impl_->UpdateNumKnownStates(aiter.Value().nextstate); + } + impl_->SetExpandedState(u); + if (s_ < impl_->NumKnownStates()) return false; + } + return true; + } + + StateId Value() const final { return s_; } + + void Next() final { ++s_; } + + void Reset() final { s_ = 0; } + + private: + const FST &fst_; + Impl *impl_; + StateId s_; +}; + +// Used to make an arc iterator for a CacheBaseImpl-derived FST, which must +// have Arc and State types defined. +template +class CacheArcIterator { + public: + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = typename FST::Store; + using State = typename Store::State; + using Impl = internal::CacheBaseImpl; + + CacheArcIterator(Impl *impl, StateId s) : i_(0) { + state_ = impl->GetCacheStore()->GetMutableState(s); + state_->IncrRefCount(); + } + + ~CacheArcIterator() { state_->DecrRefCount(); } + + bool Done() const { return i_ >= state_->NumArcs(); } + + const Arc &Value() const { return state_->GetArc(i_); } + + void Next() { ++i_; } + + size_t Position() const { return i_; } + + void Reset() { i_ = 0; } + + void Seek(size_t a) { i_ = a; } + + constexpr uint32 Flags() const { return kArcValueFlags; } + + void SetFlags(uint32 flags, uint32 mask) {} + + private: + const State *state_; + size_t i_; + + CacheArcIterator(const CacheArcIterator &) = delete; + CacheArcIterator &operator=(const CacheArcIterator &) = delete; +}; + +// Use this to make a mutable arc iterator for a CacheBaseImpl-derived FST, +// which must have types Arc and Store defined. +template +class CacheMutableArcIterator + : public MutableArcIteratorBase { + public: + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = typename FST::Store; + using State = typename Store::State; + using Impl = internal::CacheBaseImpl; + + // User must call MutateCheck() in the constructor. + CacheMutableArcIterator(Impl *impl, StateId s) : i_(0), s_(s), impl_(impl) { + state_ = impl_->GetCacheStore()->GetMutableState(s_); + state_->IncrRefCount(); + } + + ~CacheMutableArcIterator() override { state_->DecrRefCount(); } + + bool Done() const final { return i_ >= state_->NumArcs(); } + + const Arc &Value() const final { return state_->GetArc(i_); } + + void Next() final { ++i_; } + + size_t Position() const final { return i_; } + + void Reset() final { i_ = 0; } + + void Seek(size_t a) final { i_ = a; } + + void SetValue(const Arc &arc) final { state_->SetArc(arc, i_); } + + uint32 Flags() const final { return kArcValueFlags; } + + void SetFlags(uint32, uint32) final {} + + private: + size_t i_; + StateId s_; + Impl *impl_; + State *state_; + + CacheMutableArcIterator(const CacheMutableArcIterator &) = delete; + CacheMutableArcIterator &operator=(const CacheMutableArcIterator &) = delete; +}; + +// Wrap existing CacheStore implementation to use with ExpanderFst. +template +class ExpanderCacheStore { + public: + using State = typename CacheStore::State; + using Arc = typename CacheStore::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit ExpanderCacheStore(const CacheOptions &opts = CacheOptions()) + : store_(opts) {} + + template + State *FindOrExpand(Expander &expander, StateId s) { // NOLINT + auto *state = store_.GetMutableState(s); + if (state->Flags()) { + state->SetFlags(kCacheRecent, kCacheRecent); + } else { + StateBuilder builder(state); + expander.Expand(s, &builder); + state->SetFlags(kCacheFlags, kCacheFlags); + store_.SetArcs(state); + } + return state; + } + + private: + CacheStore store_; + + struct StateBuilder { + State *state; + + explicit StateBuilder(State *state_) : state(state_) {} + + void AddArc(const Arc &arc) { state->PushArc(arc); } + + void AddArc(Arc &&arc) { state->PushArc(std::move(arc)); } + + void SetFinal(Weight weight) { state->SetFinal(std::move(weight)); } + }; +}; + +} // namespace fst + +#endif // FST_CACHE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/closure.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/closure.h new file mode 100644 index 0000000..13beea9 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/closure.h @@ -0,0 +1,134 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to compute the concatenative closure of an FST. + +#ifndef FST_CLOSURE_H_ +#define FST_CLOSURE_H_ + +#include +#include + +#include +#include + + +namespace fst { + +// Computes the concatenative closure. This version modifies its +// MutableFst input. If an FST transduces string x to y with weight a, +// then its closure transduces x to y with weight a, xx to yy with +// weight Times(a, a), xxx to yyy with with Times(Times(a, a), a), +// etc. If closure_type == CLOSURE_STAR, then the empty string is +// transduced to itself with weight Weight::One() as well. +// +// Complexity: +// +// Time: O(V) +// Space: O(V) +// +// where V is the number of states. +template +void Closure(MutableFst *fst, ClosureType closure_type) { + using Weight = typename Arc::Weight; + const auto props = fst->Properties(kFstProperties, false); + const auto start = fst->Start(); + for (StateIterator> siter(*fst); !siter.Done(); + siter.Next()) { + const auto s = siter.Value(); + const auto weight = fst->Final(s); + if (weight != Weight::Zero()) fst->AddArc(s, Arc(0, 0, weight, start)); + } + if (closure_type == CLOSURE_STAR) { + fst->ReserveStates(fst->NumStates() + 1); + const auto nstart = fst->AddState(); + fst->SetStart(nstart); + fst->SetFinal(nstart, Weight::One()); + if (start != kNoLabel) fst->AddArc(nstart, Arc(0, 0, Weight::One(), start)); + } + fst->SetProperties(ClosureProperties(props, closure_type == CLOSURE_STAR), + kFstProperties); +} + +// Computes the concatenative closure. This version modifies its +// RationalFst input. +template +void Closure(RationalFst *fst, ClosureType closure_type) { + fst->GetMutableImpl()->AddClosure(closure_type); +} + +struct ClosureFstOptions : RationalFstOptions { + ClosureType type; + + ClosureFstOptions(const RationalFstOptions &opts, + ClosureType type = CLOSURE_STAR) + : RationalFstOptions(opts), type(type) {} + + explicit ClosureFstOptions(ClosureType type = CLOSURE_STAR) : type(type) {} +}; + +// Computes the concatenative closure. This version is a delayed FST. If an FST +// transduces string x to y with weight a, then its closure transduces x to y +// with weight a, xx to yy with weight Times(a, a), xxx to yyy with weight +// Times(Times(a, a), a), etc. If closure_type == CLOSURE_STAR, then the empty +// string is transduced to itself with weight Weight::One() as well. +// +// Complexity: +// +// Time: O(v) +// Space: O(v) +// +// where v is the number of states visited. Constant time and space to visit an +// input state or arc is assumed and exclusive of caching. +template +class ClosureFst : public RationalFst { + public: + using Arc = A; + + ClosureFst(const Fst &fst, ClosureType closure_type) { + GetMutableImpl()->InitClosure(fst, closure_type); + } + + ClosureFst(const Fst &fst, const ClosureFstOptions &opts) + : RationalFst(opts) { + GetMutableImpl()->InitClosure(fst, opts.type); + } + + // See Fst<>::Copy() for doc. + ClosureFst(const ClosureFst &fst, bool safe = false) + : RationalFst(fst, safe) {} + + // Gets a copy of this ClosureFst. See Fst<>::Copy() for further doc. + ClosureFst *Copy(bool safe = false) const override { + return new ClosureFst(*this, safe); + } + + private: + using ImplToFst>::GetImpl; + using ImplToFst>::GetMutableImpl; +}; + +// Specialization for ClosureFst. +template +class StateIterator> : public StateIterator> { + public: + explicit StateIterator(const ClosureFst &fst) + : StateIterator>(fst) {} +}; + +// Specialization for ClosureFst. +template +class ArcIterator> : public ArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const ClosureFst &fst, StateId s) + : ArcIterator>(fst, s) {} +}; + +// Useful alias when using StdArc. +using StdClosureFst = ClosureFst; + +} // namespace fst + +#endif // FST_CLOSURE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/compact-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/compact-fst.h new file mode 100644 index 0000000..402c87b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/compact-fst.h @@ -0,0 +1,1564 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST Class for memory-efficient representation of common types of +// FSTs: linear automata, acceptors, unweighted FSTs, ... + +#ifndef FST_COMPACT_FST_H_ +#define FST_COMPACT_FST_H_ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include // For optional argument declarations +#include +#include +#include +#include + + +namespace fst { + +struct CompactFstOptions : public CacheOptions { + // The default caching behaviour is to do no caching. Most compactors are + // cheap and therefore we save memory by not doing caching. + CompactFstOptions() : CacheOptions(true, 0) {} + + explicit CompactFstOptions(const CacheOptions &opts) : CacheOptions(opts) {} +}; + +// New upcoming (Fst) Compactor interface - currently used internally +// by CompactFstImpl. +// +// class Compactor { +// public: +// // Constructor from the Fst to be compacted. +// Compactor(const Fst &fst, ...); +// // Copy constructor +// Compactor(const Compactor &compactor, bool safe = false) +// // Default constructor (optional, see comment below). +// Compactor(); +// +// // Returns the start state, number of states, and total number of arcs +// // of the compacted Fst +// StateId Start() const; +// StateId NumStates() const; +// size_t NumArcs() const; +// +// // Accessor class for state attributes. +// class State { +// public: +// State(); // Required, corresponds to kNoStateId. +// State(const Compactor *c, StateId); // Accessor for StateId 's'. +// StateId GetStateId() const; +// Weight Final() const; +// size_t NumArcs() const; +// Arc GetArc(size_t i, uint32 f) const; +// }; +// +// // Modifies 'state' accessor to provide access to state id 's'. +// void SetState(StateId s, State *state); +// // Tests whether 'fst' can be compacted by this compactor. +// bool IsCompatible(const Fst &fst) const; +// // Return the properties that are always true for an fst +// // compacted using this compactor +// uint64 Properties() const; +// // Return a string identifying the type of compactor. +// static const string &Type(); +// // Return true if an error has occured. +// bool Error() const; +// // Writes a compactor to a file. +// bool Write(std::ostream &strm, const FstWriteOptions &opts) const; +// // Reads a compactor from a file. +// static Compactor*Read(std::istream &strm, const FstReadOptions &opts, +// const FstHeader &hdr); +// }; +// + +// Old (Arc) Compactor Interface: +// +// The ArcCompactor class determines how arcs and final weights are compacted +// and expanded. +// +// Final weights are treated as transitions to the superfinal state, i.e., +// ilabel = olabel = kNoLabel and nextstate = kNoStateId. +// +// There are two types of compactors: +// +// * Fixed out-degree compactors: 'compactor.Size()' returns a positive integer +// 's'. An FST can be compacted by this compactor only if each state has +// exactly 's' outgoing transitions (counting a non-Zero() final weight as a +// transition). A typical example is a compactor for string FSTs, i.e., +// 's == 1'. +// +// * Variable out-degree compactors: 'compactor.Size() == -1'. There are no +// out-degree restrictions for these compactors. +// +// Interface: +// +// class ArcCompactor { +// public: +// // Element is the type of the compacted transitions. +// using Element = ... +// +// // Returns the compacted representation of a transition 'arc' +// // at a state 's'. +// Element Compact(StateId s, const Arc &arc); +// +// // Returns the transition at state 's' represented by the compacted +// // transition 'e'. +// Arc Expand(StateId s, const Element &e) const; +// +// // Returns -1 for variable out-degree compactors, and the mandatory +// // out-degree otherwise. +// ssize_t Size() const; +// +// // Tests whether an FST can be compacted by this compactor. +// bool Compatible(const Fst &fst) const; +// +// // Returns the properties that are always true for an FST compacted using +// // this compactor +// uint64 Properties() const; +// +// // Returns a string identifying the type of compactor. +// static const string &Type(); +// +// // Writes a compactor to a file. +// bool Write(std::ostream &strm) const; +// +// // Reads a compactor from a file. +// static ArcCompactor *Read(std::istream &strm); +// +// // Default constructor (optional, see comment below). +// ArcCompactor(); +// }; +// +// The default constructor is only required for FST_REGISTER to work (i.e., +// enabling Convert() and the command-line utilities to work with this new +// compactor). However, a default constructor always needs to be specified for +// this code to compile, but one can have it simply raise an error when called, +// like so: +// +// Compactor::Compactor() { +// FSTERROR() << "Compactor: No default constructor"; +// } + +// Default implementation data for CompactFst, which can shared between +// otherwise independent copies. +// +// The implementation contains two arrays: 'states_' and 'compacts_'. +// +// For fixed out-degree compactors, the 'states_' array is unallocated. The +// 'compacts_' contains the compacted transitions. Its size is 'ncompacts_'. +// The outgoing transitions at a given state are stored consecutively. For a +// given state 's', its 'compactor.Size()' outgoing transitions (including +// superfinal transition when 's' is final), are stored in position +// ['s*compactor.Size()', '(s+1)*compactor.Size()'). +// +// For variable out-degree compactors, the states_ array has size +// 'nstates_ + 1' and contains pointers to positions into 'compacts_'. For a +// given state 's', the compacted transitions of 's' are stored in positions +// ['states_[s]', 'states_[s + 1]') in 'compacts_'. By convention, +// 'states_[nstates_] == ncompacts_'. +// +// In both cases, the superfinal transitions (when 's' is final, i.e., +// 'Final(s) != Weight::Zero()') are stored first. +// +// The unsigned type U is used to represent indices into the compacts_ array. +template +class DefaultCompactStore { + public: + DefaultCompactStore() + : states_(nullptr), + compacts_(nullptr), + nstates_(0), + ncompacts_(0), + narcs_(0), + start_(kNoStateId), + error_(false) {} + + template + DefaultCompactStore(const Fst &fst, const Compactor &compactor); + + template + DefaultCompactStore(const Iterator &begin, const Iterator &end, + const Compactor &compactor); + + ~DefaultCompactStore() { + if (!states_region_) delete[] states_; + if (!compacts_region_) delete[] compacts_; + } + + template + static DefaultCompactStore *Read( + std::istream &strm, const FstReadOptions &opts, const FstHeader &hdr, + const Compactor &compactor); + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const; + + Unsigned States(ssize_t i) const { return states_[i]; } + + const Element &Compacts(size_t i) const { return compacts_[i]; } + + size_t NumStates() const { return nstates_; } + + size_t NumCompacts() const { return ncompacts_; } + + size_t NumArcs() const { return narcs_; } + + ssize_t Start() const { return start_; } + + bool Error() const { return error_; } + + // Returns a string identifying the type of data storage container. + static const string &Type(); + + private: + std::unique_ptr states_region_; + std::unique_ptr compacts_region_; + Unsigned *states_; + Element *compacts_; + size_t nstates_; + size_t ncompacts_; + size_t narcs_; + ssize_t start_; + bool error_; +}; + +template +template +DefaultCompactStore::DefaultCompactStore( + const Fst &fst, const Compactor &compactor) + : states_(nullptr), + compacts_(nullptr), + nstates_(0), + ncompacts_(0), + narcs_(0), + start_(kNoStateId), + error_(false) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + start_ = fst.Start(); + // Counts # of states and arcs. + StateId nfinals = 0; + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + ++nstates_; + const auto s = siter.Value(); + narcs_ += fst.NumArcs(s); + if (fst.Final(s) != Weight::Zero()) ++nfinals; + } + if (compactor.Size() == -1) { + states_ = new Unsigned[nstates_ + 1]; + ncompacts_ = narcs_ + nfinals; + compacts_ = new Element[ncompacts_]; + states_[nstates_] = ncompacts_; + } else { + states_ = nullptr; + ncompacts_ = nstates_ * compactor.Size(); + if ((narcs_ + nfinals) != ncompacts_) { + FSTERROR() << "DefaultCompactStore: Compactor incompatible with FST"; + error_ = true; + return; + } + compacts_ = new Element[ncompacts_]; + } + size_t pos = 0; + size_t fpos = 0; + for (size_t s = 0; s < nstates_; ++s) { + fpos = pos; + if (compactor.Size() == -1) states_[s] = pos; + if (fst.Final(s) != Weight::Zero()) { + compacts_[pos++] = compactor.Compact( + s, Arc(kNoLabel, kNoLabel, fst.Final(s), kNoStateId)); + } + for (ArcIterator> aiter(fst, s); !aiter.Done(); aiter.Next()) { + compacts_[pos++] = compactor.Compact(s, aiter.Value()); + } + if ((compactor.Size() != -1) && (pos != fpos + compactor.Size())) { + FSTERROR() << "DefaultCompactStore: Compactor incompatible with FST"; + error_ = true; + return; + } + } + if (pos != ncompacts_) { + FSTERROR() << "DefaultCompactStore: Compactor incompatible with FST"; + error_ = true; + return; + } +} + +template +template +DefaultCompactStore::DefaultCompactStore( + const Iterator &begin, const Iterator &end, const Compactor &compactor) + : states_(nullptr), + compacts_(nullptr), + nstates_(0), + ncompacts_(0), + narcs_(0), + start_(kNoStateId), + error_(false) { + using Arc = typename Compactor::Arc; + using Weight = typename Arc::Weight; + if (compactor.Size() != -1) { + ncompacts_ = std::distance(begin, end); + if (compactor.Size() == 1) { + // For strings, allows implicit final weight. Empty input is the empty + // string. + if (ncompacts_ == 0) { + ++ncompacts_; + } else { + const auto arc = + compactor.Expand(ncompacts_ - 1, *(begin + (ncompacts_ - 1))); + if (arc.ilabel != kNoLabel) ++ncompacts_; + } + } + if (ncompacts_ % compactor.Size()) { + FSTERROR() << "DefaultCompactStore: Size of input container incompatible" + << " with compactor"; + error_ = true; + return; + } + if (ncompacts_ == 0) return; + start_ = 0; + nstates_ = ncompacts_ / compactor.Size(); + compacts_ = new Element[ncompacts_]; + size_t i = 0; + Iterator it = begin; + for (; it != end; ++it, ++i) { + compacts_[i] = *it; + if (compactor.Expand(i, *it).ilabel != kNoLabel) ++narcs_; + } + if (i < ncompacts_) { + compacts_[i] = compactor.Compact( + i, Arc(kNoLabel, kNoLabel, Weight::One(), kNoStateId)); + } + } else { + if (std::distance(begin, end) == 0) return; + // Count # of states, arcs and compacts. + auto it = begin; + for (size_t i = 0; it != end; ++it, ++i) { + const auto arc = compactor.Expand(i, *it); + if (arc.ilabel != kNoLabel) { + ++narcs_; + ++ncompacts_; + } else { + ++nstates_; + if (arc.weight != Weight::Zero()) ++ncompacts_; + } + } + start_ = 0; + compacts_ = new Element[ncompacts_]; + states_ = new Unsigned[nstates_ + 1]; + states_[nstates_] = ncompacts_; + size_t i = 0; + size_t s = 0; + for (it = begin; it != end; ++it) { + const auto arc = compactor.Expand(i, *it); + if (arc.ilabel != kNoLabel) { + compacts_[i++] = *it; + } else { + states_[s++] = i; + if (arc.weight != Weight::Zero()) compacts_[i++] = *it; + } + } + if ((s != nstates_) || (i != ncompacts_)) { + FSTERROR() << "DefaultCompactStore: Ill-formed input container"; + error_ = true; + return; + } + } +} + +template +template +DefaultCompactStore + *DefaultCompactStore::Read(std::istream &strm, + const FstReadOptions &opts, + const FstHeader &hdr, + const Compactor &compactor) { + std::unique_ptr> data( + new DefaultCompactStore()); + data->start_ = hdr.Start(); + data->nstates_ = hdr.NumStates(); + data->narcs_ = hdr.NumArcs(); + if (compactor.Size() == -1) { + if ((hdr.GetFlags() & FstHeader::IS_ALIGNED) && !AlignInput(strm)) { + LOG(ERROR) << "DefaultCompactStore::Read: Alignment failed: " + << opts.source; + return nullptr; + } + auto b = (data->nstates_ + 1) * sizeof(Unsigned); + data->states_region_.reset(MappedFile::Map( + &strm, opts.mode == FstReadOptions::MAP, opts.source, b)); + if (!strm || !data->states_region_) { + LOG(ERROR) << "DefaultCompactStore::Read: Read failed: " << opts.source; + return nullptr; + } + data->states_ = + static_cast(data->states_region_->mutable_data()); + } else { + data->states_ = nullptr; + } + data->ncompacts_ = compactor.Size() == -1 ? data->states_[data->nstates_] + : data->nstates_ * compactor.Size(); + if ((hdr.GetFlags() & FstHeader::IS_ALIGNED) && !AlignInput(strm)) { + LOG(ERROR) << "DefaultCompactStore::Read: Alignment failed: " + << opts.source; + return nullptr; + } + size_t b = data->ncompacts_ * sizeof(Element); + data->compacts_region_.reset( + MappedFile::Map(&strm, opts.mode == FstReadOptions::MAP, opts.source, b)); + if (!strm || !data->compacts_region_) { + LOG(ERROR) << "DefaultCompactStore::Read: Read failed: " << opts.source; + return nullptr; + } + data->compacts_ = + static_cast(data->compacts_region_->mutable_data()); + return data.release(); +} + +template +bool DefaultCompactStore::Write( + std::ostream &strm, const FstWriteOptions &opts) const { + if (states_) { + if (opts.align && !AlignOutput(strm)) { + LOG(ERROR) << "DefaultCompactStore::Write: Alignment failed: " + << opts.source; + return false; + } + strm.write(reinterpret_cast(states_), + (nstates_ + 1) * sizeof(Unsigned)); + } + if (opts.align && !AlignOutput(strm)) { + LOG(ERROR) << "DefaultCompactStore::Write: Alignment failed: " + << opts.source; + return false; + } + strm.write(reinterpret_cast(compacts_), ncompacts_ * sizeof(Element)); + strm.flush(); + if (!strm) { + LOG(ERROR) << "DefaultCompactStore::Write: Write failed: " << opts.source; + return false; + } + return true; +} + +template +const string &DefaultCompactStore::Type() { + static const string *const type = new string("compact"); + return *type; +} + +template class DefaultCompactState; + +// Wraps an arc compactor and a compact store as a new Fst compactor. +template > +class DefaultCompactor { + public: + using ArcCompactor = C; + using Unsigned = U; + using CompactStore = S; + using Element = typename C::Element; + using Arc = typename C::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using State = DefaultCompactState; + friend State; + + DefaultCompactor() + : arc_compactor_(nullptr), compact_store_(nullptr) {} + + // Constructs from Fst. + DefaultCompactor(const Fst &fst, + std::shared_ptr arc_compactor) + : arc_compactor_(std::move(arc_compactor)), + compact_store_(std::make_shared(fst, *arc_compactor_)) {} + + DefaultCompactor(const Fst &fst, + std::shared_ptr> compactor) + : arc_compactor_(compactor->arc_compactor_), + compact_store_(compactor->compact_store_ == nullptr ? + std::make_shared(fst, *arc_compactor_) : + compactor->compact_store_) {} + + // Constructs from CompactStore. + DefaultCompactor(std::shared_ptr arc_compactor, + std::shared_ptr compact_store) + : arc_compactor_(std::move(arc_compactor)), + compact_store_(std::move(compact_store)) {} + + // Constructs from set of compact elements (when arc_compactor.Size() != -1). + template + DefaultCompactor(const Iterator &b, const Iterator &e, + std::shared_ptr arc_compactor) + : arc_compactor_(std::move(arc_compactor)), + compact_store_(std::make_shared(b, e, *arc_compactor_)) {} + + // Copy constructor. + DefaultCompactor(const DefaultCompactor &compactor) + : arc_compactor_(std::make_shared(*compactor.GetArcCompactor())), + compact_store_(compactor.SharedCompactStore()) {} + + template + explicit DefaultCompactor(const DefaultCompactor &compactor) + : arc_compactor_(std::make_shared(*compactor.GetArcCompactor())), + compact_store_(compactor.SharedCompactStore()) {} + + StateId Start() const { return compact_store_->Start(); } + StateId NumStates() const { return compact_store_->NumStates(); } + size_t NumArcs() const { return compact_store_->NumArcs(); } + + void SetState(StateId s, State *state) const { + if (state->GetStateId() != s) state->Set(this, s); + } + + static DefaultCompactor *Read(std::istream &strm, + const FstReadOptions &opts, + const FstHeader &hdr) { + std::shared_ptr arc_compactor(C::Read(strm)); + if (arc_compactor == nullptr) return nullptr; + std::shared_ptr compact_store(S::Read(strm, opts, hdr, *arc_compactor)); + if (compact_store == nullptr) return nullptr; + return new DefaultCompactor(arc_compactor, compact_store); + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const { + return arc_compactor_->Write(strm) && compact_store_->Write(strm, opts); + } + + uint64 Properties() const { return arc_compactor_->Properties(); } + + bool IsCompatible(const Fst &fst) const { + return arc_compactor_->Compatible(fst); + } + + bool Error() const { return compact_store_->Error(); } + + bool HasFixedOutdegree() const { return arc_compactor_->Size() != -1; } + + static const string &Type() { + static const string *const type = [] { + string type = "compact"; + if (sizeof(U) != sizeof(uint32)) type += std::to_string(8 * sizeof(U)); + type += "_"; + type += C::Type(); + if (CompactStore::Type() != "compact") { + type += "_"; + type += CompactStore::Type(); + } + return new string(type); + }(); + return *type; + } + + const ArcCompactor *GetArcCompactor() const { return arc_compactor_.get(); } + CompactStore *GetCompactStore() const { return compact_store_.get(); } + + std::shared_ptr SharedArcCompactor() const { + return arc_compactor_; + } + + std::shared_ptr SharedCompactStore() const { + return compact_store_; + } + + // TODO(allauzen): remove dependencies on this method and make private. + Arc ComputeArc(StateId s, Unsigned i, uint32 f) const { + return arc_compactor_->Expand(s, compact_store_->Compacts(i), f); + } + + private: + std::pair CompactsRange(StateId s) const { + std::pair range; + if (HasFixedOutdegree()) { + range.first = s * arc_compactor_->Size(); + range.second = arc_compactor_->Size(); + } else { + range.first = compact_store_->States(s); + range.second = compact_store_->States(s + 1) - range.first; + } + return range; + } + + private: + std::shared_ptr arc_compactor_; + std::shared_ptr compact_store_; +}; + +// Default implementation of state attributes accessor class for +// DefaultCompactor. Use of efficient specialization strongly encouraged. +template +class DefaultCompactState { + public: + using Arc = typename C::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + DefaultCompactState() = default; + + DefaultCompactState(const DefaultCompactor *compactor, StateId s) + : compactor_(compactor), + s_(s), + range_(compactor->CompactsRange(s)), + has_final_( + range_.second != 0 && + compactor->ComputeArc(s, range_.first, + kArcILabelValue).ilabel == kNoLabel) { + if (has_final_) { + ++range_.first; + --range_.second; + } + } + + void Set(const DefaultCompactor *compactor, StateId s) { + compactor_ = compactor; + s_ = s; + range_ = compactor->CompactsRange(s); + if (range_.second != 0 && + compactor->ComputeArc(s, range_.first, kArcILabelValue).ilabel + == kNoLabel) { + has_final_ = true; + ++range_.first; + --range_.second; + } else { + has_final_ = false; + } + } + + StateId GetStateId() const { return s_; } + + Weight Final() const { + if (!has_final_) return Weight::Zero(); + return compactor_->ComputeArc(s_, range_.first - 1, kArcWeightValue).weight; + } + + size_t NumArcs() const { return range_.second; } + + Arc GetArc(size_t i, uint32 f) const { + return compactor_->ComputeArc(s_, range_.first + i, f); + } + + private: + const DefaultCompactor *compactor_ = nullptr; // borrowed ref. + StateId s_ = kNoStateId; + std::pair range_ = {0, 0}; + bool has_final_ = false; +}; + +// Specialization for DefaultCompactStore. +template +class DefaultCompactState> { + public: + using Arc = typename C::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using CompactStore = DefaultCompactStore; + + DefaultCompactState() = default; + + DefaultCompactState( + const DefaultCompactor *compactor, StateId s) + : arc_compactor_(compactor->GetArcCompactor()), s_(s) { + Init(compactor); + } + + void Set(const DefaultCompactor *compactor, StateId s) { + arc_compactor_ = compactor->GetArcCompactor(); + s_ = s; + has_final_ = false; + Init(compactor); + } + + StateId GetStateId() const { return s_; } + + Weight Final() const { + if (!has_final_) return Weight::Zero(); + return arc_compactor_->Expand(s_, *(compacts_ - 1), kArcWeightValue).weight; + } + + size_t NumArcs() const { return num_arcs_; } + + Arc GetArc(size_t i, uint32 f) const { + return arc_compactor_->Expand(s_, compacts_[i], f); + } + + private: + void Init(const DefaultCompactor *compactor) { + const auto *store = compactor->GetCompactStore(); + U offset; + if (!compactor->HasFixedOutdegree()) { // Variable out-degree compactor. + offset = store->States(s_); + num_arcs_ = store->States(s_ + 1) - offset; + } else { // Fixed out-degree compactor. + offset = s_ * arc_compactor_->Size(); + num_arcs_ = arc_compactor_->Size(); + } + if (num_arcs_ > 0) { + compacts_ = &(store->Compacts(offset)); + if (arc_compactor_->Expand(s_, *compacts_, kArcILabelValue).ilabel + == kNoStateId) { + ++compacts_; + --num_arcs_; + has_final_ = true; + } + } + } + + private: + const C *arc_compactor_ = nullptr; // Borrowed reference. + const typename C::Element *compacts_ = nullptr; // Borrowed reference. + StateId s_ = kNoStateId; + U num_arcs_ = 0; + bool has_final_ = false; +}; + +template +class CompactFst; + +template +void Cast(const F &, G *); + +namespace internal { + +// Implementation class for CompactFst, which contains parametrizeable +// Fst data storage (DefaultCompactStore by default) and Fst cache. +template > +class CompactFstImpl + : public CacheBaseImpl { + public: + using Weight = typename Arc::Weight; + using StateId = typename Arc::StateId; + using Compactor = C; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::Properties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::WriteHeader; + + using ImplBase = CacheBaseImpl; + using ImplBase::PushArc; + using ImplBase::HasArcs; + using ImplBase::HasFinal; + using ImplBase::HasStart; + using ImplBase::SetArcs; + using ImplBase::SetFinal; + using ImplBase::SetStart; + + CompactFstImpl() + : ImplBase(CompactFstOptions()), + compactor_() { + SetType(Compactor::Type()); + SetProperties(kNullProperties | kStaticProperties); + } + + CompactFstImpl(const Fst &fst, std::shared_ptr compactor, + const CompactFstOptions &opts) + : ImplBase(opts), + compactor_(std::make_shared(fst, compactor)) { + SetType(Compactor::Type()); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + if (compactor_->Error()) SetProperties(kError, kError); + uint64 copy_properties = fst.Properties(kMutable, false) ? + fst.Properties(kCopyProperties, true): + CheckProperties(fst, + kCopyProperties & ~kWeightedCycles & ~kUnweightedCycles, + kCopyProperties); + if ((copy_properties & kError) || !compactor_->IsCompatible(fst)) { + FSTERROR() << "CompactFstImpl: Input Fst incompatible with compactor"; + SetProperties(kError, kError); + return; + } + SetProperties(copy_properties | kStaticProperties); + } + + CompactFstImpl(std::shared_ptr compactor, + const CompactFstOptions &opts) + : ImplBase(opts), + compactor_(compactor) { + SetType(Compactor::Type()); + SetProperties(kStaticProperties | compactor_->Properties()); + if (compactor_->Error()) SetProperties(kError, kError); + } + + CompactFstImpl(const CompactFstImpl &impl) + : ImplBase(impl), + compactor_(impl.compactor_ == nullptr ? + std::make_shared() : + std::make_shared(*impl.compactor_)) { + SetType(impl.Type()); + SetProperties(impl.Properties()); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + // Allows to change the cache store from OtherI to I. + template + CompactFstImpl(const CompactFstImpl &impl) + : ImplBase(CacheOptions(impl.GetCacheGc(), impl.GetCacheLimit())), + compactor_(impl.compactor_ == nullptr ? + std::make_shared() : + std::make_shared(*impl.compactor_)) { + SetType(impl.Type()); + SetProperties(impl.Properties()); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + StateId Start() { + if (!HasStart()) SetStart(compactor_->Start()); + return ImplBase::Start(); + } + + Weight Final(StateId s) { + if (HasFinal(s)) return ImplBase::Final(s); + compactor_->SetState(s, &state_); + return state_.Final(); + } + + StateId NumStates() const { + if (Properties(kError)) return 0; + return compactor_->NumStates(); + } + + size_t NumArcs(StateId s) { + if (HasArcs(s)) return ImplBase::NumArcs(s); + compactor_->SetState(s, &state_); + return state_.NumArcs(); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s) && !Properties(kILabelSorted)) Expand(s); + if (HasArcs(s)) return ImplBase::NumInputEpsilons(s); + return CountEpsilons(s, false); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s) && !Properties(kOLabelSorted)) Expand(s); + if (HasArcs(s)) return ImplBase::NumOutputEpsilons(s); + return CountEpsilons(s, true); + } + + size_t CountEpsilons(StateId s, bool output_epsilons) { + compactor_->SetState(s, &state_); + const uint32 f = output_epsilons ? kArcOLabelValue : kArcILabelValue; + size_t num_eps = 0; + for (size_t i = 0; i < state_.NumArcs(); ++i) { + const auto& arc = state_.GetArc(i, f); + const auto label = output_epsilons ? arc.olabel : arc.ilabel; + if (label == 0) + ++num_eps; + else if (label > 0) + break; + } + return num_eps; + } + + static CompactFstImpl *Read( + std::istream &strm, const FstReadOptions &opts) { + std::unique_ptr> impl( + new CompactFstImpl()); + FstHeader hdr; + if (!impl->ReadHeader(strm, opts, kMinFileVersion, &hdr)) { + return nullptr; + } + // Ensures compatibility. + if (hdr.Version() == kAlignedFileVersion) { + hdr.SetFlags(hdr.GetFlags() | FstHeader::IS_ALIGNED); + } + impl->compactor_ = std::shared_ptr( + Compactor::Read(strm, opts, hdr)); + if (!impl->compactor_) { + return nullptr; + } + return impl.release(); + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const { + FstHeader hdr; + hdr.SetStart(compactor_->Start()); + hdr.SetNumStates(compactor_->NumStates()); + hdr.SetNumArcs(compactor_->NumArcs()); + // Ensures compatibility. + const auto file_version = opts.align ? kAlignedFileVersion : kFileVersion; + WriteHeader(strm, opts, file_version, &hdr); + return compactor_->Write(strm, opts); + } + + // Provides information needed for generic state iterator. + void InitStateIterator(StateIteratorData *data) const { + data->base = nullptr; + data->nstates = compactor_->NumStates(); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + ImplBase::InitArcIterator(s, data); + } + + void Expand(StateId s) { + compactor_->SetState(s, &state_); + for (size_t i = 0; i < state_.NumArcs(); ++i) + PushArc(s, state_.GetArc(i, kArcValueFlags)); + SetArcs(s); + if (!HasFinal(s)) SetFinal(s, state_.Final()); + } + + const Compactor *GetCompactor() const { return compactor_.get(); } + std::shared_ptr SharedCompactor() const { return compactor_; } + void SetCompactor(std::shared_ptr compactor) { + // TODO(allauzen): is this correct? is this needed? + // TODO(allauzen): consider removing and forcing this through direct calls + // to compactor. + compactor_ = compactor; + } + + // Properties always true of this FST class. + static constexpr uint64 kStaticProperties = kExpanded; + + protected: + template + explicit CompactFstImpl( + const CompactFstImpl &impl) + : compactor_(std::make_shared(*impl.GetCompactor())) { + SetType(impl.Type()); + SetProperties(impl.Properties()); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + private: + // Allows access during write. + template + friend class ::fst::CompactFst; // allow access during write. + + // Current unaligned file format version. + static constexpr int kFileVersion = 2; + // Current aligned file format version. + static constexpr int kAlignedFileVersion = 1; + // Minimum file format version supported. + static constexpr int kMinFileVersion = 1; + + std::shared_ptr compactor_; + typename Compactor::State state_; +}; + +template +constexpr uint64 CompactFstImpl::kStaticProperties; + +template +constexpr int CompactFstImpl::kFileVersion; + +template +constexpr int CompactFstImpl::kAlignedFileVersion; + +template +constexpr int CompactFstImpl::kMinFileVersion; + +} // namespace internal + +// This class attaches interface to implementation and handles reference +// counting, delegating most methods to ImplToExpandedFst. The Unsigned type +// is used to represent indices into the compact arc array. (Template +// argument defaults are declared in fst-decl.h.) +template +class CompactFst + : public ImplToExpandedFst, + CacheStore>> { + public: + template + void friend Cast(const F &, G *); + + using Arc = A; + using StateId = typename A::StateId; + using Compactor = DefaultCompactor; + using Impl = internal::CompactFstImpl; + using Store = CacheStore; // for CacheArcIterator + + friend class StateIterator< + CompactFst>; + friend class ArcIterator< + CompactFst>; + + CompactFst() : ImplToExpandedFst(std::make_shared()) {} + + // If data is not nullptr, it is assumed to be already initialized. + explicit CompactFst( + const Fst &fst, + const ArcCompactor &compactor = ArcCompactor(), + const CompactFstOptions &opts = CompactFstOptions(), + std::shared_ptr data = std::shared_ptr()) + : ImplToExpandedFst( + std::make_shared( + fst, + std::make_shared( + std::make_shared(compactor), data), + opts)) {} + + // If data is not nullptr, it is assumed to be already initialized. + CompactFst( + const Fst &fst, + std::shared_ptr compactor, + const CompactFstOptions &opts = CompactFstOptions(), + std::shared_ptr data = std::shared_ptr()) + : ImplToExpandedFst( + std::make_shared(fst, + std::make_shared(compactor, data), + opts)) {} + + // The following 2 constructors take as input two iterators delimiting a set + // of (already) compacted transitions, starting with the transitions out of + // the initial state. The format of the input differs for fixed out-degree + // and variable out-degree compactors. + // + // - For fixed out-degree compactors, the final weight (encoded as a + // compacted transition) needs to be given only for final states. All strings + // (compactor of size 1) will be assume to be terminated by a final state + // even when the final state is not implicitely given. + // + // - For variable out-degree compactors, the final weight (encoded as a + // compacted transition) needs to be given for all states and must appeared + // first in the list (for state s, final weight of s, followed by outgoing + // transitons in s). + // + // These 2 constructors allows the direct construction of a CompactFst + // without first creating a more memory-hungry regular FST. This is useful + // when memory usage is severely constrained. + template + explicit CompactFst(const Iterator &begin, const Iterator &end, + const ArcCompactor &compactor = ArcCompactor(), + const CompactFstOptions &opts = CompactFstOptions()) + : ImplToExpandedFst( + std::make_shared( + std::make_shared( + begin, end, std::make_shared(compactor)), + opts)) {} + + template + CompactFst(const Iterator &begin, const Iterator &end, + std::shared_ptr compactor, + const CompactFstOptions &opts = CompactFstOptions()) + : ImplToExpandedFst( + std::make_shared( + std::make_shared(begin, end, compactor), opts)) {} + + // See Fst<>::Copy() for doc. + CompactFst( + const CompactFst + &fst, + bool safe = false) + : ImplToExpandedFst(fst, safe) {} + + // Get a copy of this CompactFst. See Fst<>::Copy() for further doc. + CompactFst *Copy( + bool safe = false) const override { + return new CompactFst( + *this, safe); + } + + // Read a CompactFst from an input stream; return nullptr on error + static CompactFst *Read( + std::istream &strm, const FstReadOptions &opts) { + auto *impl = Impl::Read(strm, opts); + return impl ? new CompactFst(std::shared_ptr(impl)) + : nullptr; + } + + // Read a CompactFst from a file; return nullptr on error + // Empty filename reads from standard input + static CompactFst *Read( + const string &filename) { + auto *impl = ImplToExpandedFst::Read(filename); + return impl ? new CompactFst(std::shared_ptr(impl)) + : nullptr; + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return GetImpl()->Write(strm, opts); + } + + bool Write(const string &filename) const override { + return Fst::WriteFile(filename); + } + + template + static bool WriteFst(const FST &fst, const ArcCompactor &compactor, + std::ostream &strm, const FstWriteOptions &opts); + + void InitStateIterator(StateIteratorData *data) const override { + GetImpl()->InitStateIterator(data); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + MatcherBase *InitMatcher(MatchType match_type) const override { + return new SortedMatcher< + CompactFst>( + *this, match_type); + } + + template + void SetCompactElements(const Iterator &b, const Iterator &e) { + GetMutableImpl()->SetCompactor(std::make_shared( + b, e, std::make_shared())); + } + + private: + using ImplToFst>::GetImpl; + using ImplToFst>::GetMutableImpl; + + explicit CompactFst(std::shared_ptr impl) + : ImplToExpandedFst(impl) {} + + // Use overloading to extract the type of the argument. + static Impl *GetImplIfCompactFst( + const CompactFst + &compact_fst) { + return compact_fst.GetImpl(); + } + + // This does not give privileged treatment to subclasses of CompactFst. + template + static Impl *GetImplIfCompactFst(const NonCompactFst &fst) { + return nullptr; + } + + CompactFst &operator=(const CompactFst &fst) = delete; +}; + +// Writes FST in Compact format, with a possible pass over the machine before +// writing to compute the number of states and arcs. +template +template +bool CompactFst::WriteFst( + const FST &fst, const ArcCompactor &compactor, std::ostream &strm, + const FstWriteOptions &opts) { + using Arc = A; + using Weight = typename A::Weight; + using Element = typename ArcCompactor::Element; + const auto file_version = + opts.align ? Impl::kAlignedFileVersion : Impl::kFileVersion; + size_t num_arcs = -1; + size_t num_states = -1; + auto first_pass_compactor = compactor; + if (auto *impl = GetImplIfCompactFst(fst)) { + num_arcs = impl->GetCompactor()->GetCompactStore()->NumArcs(); + num_states = impl->GetCompactor()->GetCompactStore()->NumStates(); + first_pass_compactor = *impl->GetCompactor()->GetArcCompactor(); + } else { + // A first pass is needed to compute the state of the compactor, which + // is saved ahead of the rest of the data structures. This unfortunately + // means forcing a complete double compaction when writing in this format. + // TODO(allauzen): eliminate mutable state from compactors. + num_arcs = 0; + num_states = 0; + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + ++num_states; + if (fst.Final(s) != Weight::Zero()) { + first_pass_compactor.Compact( + s, Arc(kNoLabel, kNoLabel, fst.Final(s), kNoStateId)); + } + for (ArcIterator aiter(fst, s); !aiter.Done(); aiter.Next()) { + ++num_arcs; + first_pass_compactor.Compact(s, aiter.Value()); + } + } + } + FstHeader hdr; + hdr.SetStart(fst.Start()); + hdr.SetNumStates(num_states); + hdr.SetNumArcs(num_arcs); + string type = "compact"; + if (sizeof(Unsigned) != sizeof(uint32)) { + type += std::to_string(CHAR_BIT * sizeof(Unsigned)); + } + type += "_"; + type += ArcCompactor::Type(); + if (CompactStore::Type() != "compact") { + type += "_"; + type += CompactStore::Type(); + } + const auto copy_properties = fst.Properties(kCopyProperties, true); + if ((copy_properties & kError) || !compactor.Compatible(fst)) { + FSTERROR() << "Fst incompatible with compactor"; + return false; + } + uint64 properties = copy_properties | Impl::kStaticProperties; + internal::FstImpl::WriteFstHeader(fst, strm, opts, file_version, type, + properties, &hdr); + first_pass_compactor.Write(strm); + if (first_pass_compactor.Size() == -1) { + if (opts.align && !AlignOutput(strm)) { + LOG(ERROR) << "CompactFst::Write: Alignment failed: " << opts.source; + return false; + } + Unsigned compacts = 0; + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + strm.write(reinterpret_cast(&compacts), sizeof(compacts)); + if (fst.Final(s) != Weight::Zero()) { + ++compacts; + } + compacts += fst.NumArcs(s); + } + strm.write(reinterpret_cast(&compacts), sizeof(compacts)); + } + if (opts.align && !AlignOutput(strm)) { + LOG(ERROR) << "Could not align file during write after writing states"; + } + const auto &second_pass_compactor = compactor; + Element element; + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (fst.Final(s) != Weight::Zero()) { + element = second_pass_compactor.Compact( + s, A(kNoLabel, kNoLabel, fst.Final(s), kNoStateId)); + strm.write(reinterpret_cast(&element), sizeof(element)); + } + for (ArcIterator aiter(fst, s); !aiter.Done(); aiter.Next()) { + element = second_pass_compactor.Compact(s, aiter.Value()); + strm.write(reinterpret_cast(&element), sizeof(element)); + } + } + strm.flush(); + if (!strm) { + LOG(ERROR) << "CompactFst write failed: " << opts.source; + return false; + } + return true; +} + +// Specialization for CompactFst; see generic version in fst.h for sample +// usage (but use the CompactFst type!). This version should inline. +template +class StateIterator< + CompactFst> { + public: + using StateId = typename Arc::StateId; + + explicit StateIterator( + const CompactFst &fst) + : nstates_(fst.GetImpl()->NumStates()), s_(0) {} + + bool Done() const { return s_ >= nstates_; } + + StateId Value() const { return s_; } + + void Next() { ++s_; } + + void Reset() { s_ = 0; } + + private: + StateId nstates_; + StateId s_; +}; + +// Specialization for CompactFst. Never caches, +// always iterates over the underlying compact elements. +template +class ArcIterator> { + public: + using StateId = typename Arc::StateId; + using Element = typename ArcCompactor::Element; + using Compactor = DefaultCompactor; + using State = typename Compactor::State; + + ArcIterator(const CompactFst &fst, + StateId s) + : state_(fst.GetImpl()->GetCompactor(), s), + pos_(0), + flags_(kArcValueFlags) {} + + bool Done() const { return pos_ >= state_.NumArcs(); } + + const Arc &Value() const { + arc_ = state_.GetArc(pos_, flags_); + return arc_; + } + + void Next() { ++pos_; } + + size_t Position() const { return pos_; } + + void Reset() { pos_ = 0; } + + void Seek(size_t pos) { pos_ = pos; } + + uint32 Flags() const { return flags_; } + + void SetFlags(uint32 f, uint32 m) { + flags_ &= ~m; + flags_ |= (f & kArcValueFlags); + } + + private: + State state_; + size_t pos_; + mutable Arc arc_; + uint32 flags_; +}; + +// ArcCompactor for unweighted string FSTs. +template +class StringCompactor { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Element = Label; + + Element Compact(StateId s, const Arc &arc) const { return arc.ilabel; } + + Arc Expand(StateId s, const Element &p, uint32 f = kArcValueFlags) const { + return Arc(p, p, Weight::One(), p != kNoLabel ? s + 1 : kNoStateId); + } + + constexpr ssize_t Size() const { return 1; } + + constexpr uint64 Properties() const { + return kString | kAcceptor | kUnweighted; + } + + bool Compatible(const Fst &fst) const { + const auto props = Properties(); + return fst.Properties(props, true) == props; + } + + static const string &Type() { + static const string *const type = new string("string"); + return *type; + } + + bool Write(std::ostream &strm) const { return true; } + + static StringCompactor *Read(std::istream &strm) { + return new StringCompactor; + } +}; + +// ArcCompactor for weighted string FSTs. +template +class WeightedStringCompactor { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Element = std::pair; + + Element Compact(StateId s, const Arc &arc) const { + return std::make_pair(arc.ilabel, arc.weight); + } + + Arc Expand(StateId s, const Element &p, uint32 f = kArcValueFlags) const { + return Arc(p.first, p.first, p.second, + p.first != kNoLabel ? s + 1 : kNoStateId); + } + + constexpr ssize_t Size() const { return 1; } + + constexpr uint64 Properties() const { return kString | kAcceptor; } + + bool Compatible(const Fst &fst) const { + const auto props = Properties(); + return fst.Properties(props, true) == props; + } + + static const string &Type() { + static const string *const type = new string("weighted_string"); + return *type; + } + + bool Write(std::ostream &strm) const { return true; } + + static WeightedStringCompactor *Read(std::istream &strm) { + return new WeightedStringCompactor; + } +}; + +// ArcCompactor for unweighted acceptor FSTs. +template +class UnweightedAcceptorCompactor { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Element = std::pair; + + Element Compact(StateId s, const Arc &arc) const { + return std::make_pair(arc.ilabel, arc.nextstate); + } + + Arc Expand(StateId s, const Element &p, uint32 f = kArcValueFlags) const { + return Arc(p.first, p.first, Weight::One(), p.second); + } + + constexpr ssize_t Size() const { return -1; } + + constexpr uint64 Properties() const { return kAcceptor | kUnweighted; } + + bool Compatible(const Fst &fst) const { + const auto props = Properties(); + return fst.Properties(props, true) == props; + } + + static const string &Type() { + static const string *const type = new string("unweighted_acceptor"); + return *type; + } + + bool Write(std::ostream &strm) const { return true; } + + static UnweightedAcceptorCompactor *Read(std::istream &istrm) { + return new UnweightedAcceptorCompactor; + } +}; + +// ArcCompactor for weighted acceptor FSTs. +template +class AcceptorCompactor { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Element = std::pair, StateId>; + + Element Compact(StateId s, const Arc &arc) const { + return std::make_pair(std::make_pair(arc.ilabel, arc.weight), + arc.nextstate); + } + + Arc Expand(StateId s, const Element &p, uint32 f = kArcValueFlags) const { + return Arc(p.first.first, p.first.first, p.first.second, p.second); + } + + constexpr ssize_t Size() const { return -1; } + + constexpr uint64 Properties() const { return kAcceptor; } + + bool Compatible(const Fst &fst) const { + const auto props = Properties(); + return fst.Properties(props, true) == props; + } + + static const string &Type() { + static const string *const type = new string("acceptor"); + return *type; + } + + bool Write(std::ostream &strm) const { return true; } + + static AcceptorCompactor *Read(std::istream &strm) { + return new AcceptorCompactor; + } +}; + +// ArcCompactor for unweighted FSTs. +template +class UnweightedCompactor { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Element = std::pair, StateId>; + + Element Compact(StateId s, const Arc &arc) const { + return std::make_pair(std::make_pair(arc.ilabel, arc.olabel), + arc.nextstate); + } + + Arc Expand(StateId s, const Element &p, uint32 f = kArcValueFlags) const { + return Arc(p.first.first, p.first.second, Weight::One(), p.second); + } + + constexpr ssize_t Size() const { return -1; } + + constexpr uint64 Properties() const { return kUnweighted; } + + bool Compatible(const Fst &fst) const { + const auto props = Properties(); + return fst.Properties(props, true) == props; + } + + static const string &Type() { + static const string *const type = new string("unweighted"); + return *type; + } + + bool Write(std::ostream &strm) const { return true; } + + static UnweightedCompactor *Read(std::istream &strm) { + return new UnweightedCompactor; + } +}; + +template +using CompactStringFst = CompactFst, Unsigned>; + +template +using CompactWeightedStringFst = + CompactFst, Unsigned>; + +template +using CompactAcceptorFst = CompactFst, Unsigned>; + +template +using CompactUnweightedFst = + CompactFst, Unsigned>; + +template +using CompactUnweightedAcceptorFst = + CompactFst, Unsigned>; + +using StdCompactStringFst = CompactStringFst; + +using StdCompactWeightedStringFst = CompactWeightedStringFst; + +using StdCompactAcceptorFst = CompactAcceptorFst; + +using StdCompactUnweightedFst = CompactUnweightedFst; + +using StdCompactUnweightedAcceptorFst = + CompactUnweightedAcceptorFst; + +} // namespace fst + +#endif // FST_COMPACT_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/compat.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/compat.h new file mode 100644 index 0000000..73ed573 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/compat.h @@ -0,0 +1,130 @@ +// 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 applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_LIB_COMPAT_H_ +#define FST_LIB_COMPAT_H_ + +#include +#include +#include +#include +#include +#include + +// Makes copy constructor and operator= private +// Deprecated: now just use =delete. +#define DISALLOW_COPY_AND_ASSIGN(type) \ + type(const type&); \ + void operator=(const type&) + +#if defined(__GNUC__) || defined(__clang__) +#define OPENFST_DEPRECATED(message) __attribute__((deprecated(message))) +#elif defined(_MSC_VER) +#define OPENFST_DEPRECATED(message) __declspec(deprecated(message)) +#else +#define OPENFST_DEPRECATED(message) +#endif + +#include +#include +#include +#include +#include +#include + +using std::string; + +void FailedNewHandler(); + +#ifdef _MSC_VER +#include +const char* basename(const char* path); +#define __builtin_popcount __popcnt + +#ifdef _M_X64 +// Using 64-bit MSVC intrinsics. +#define __builtin_popcountll __popcnt64 +inline unsigned int __builtin_ctzll(std::uint64_t w) { + unsigned long v; + return _BitScanForward64(&v, std::uint32_t(w)) ? v : 0; +} +#else +// Using 32-bit MSVC intrinsics. +inline unsigned int __builtin_popcountll(std::uint64_t w) { + return __popcnt(std::uint32_t(w)) + __popcnt(std::uint32_t(w >> 32)); +} +inline unsigned int __builtin_ctzll(std::uint64_t w) { + unsigned long v; + return (_BitScanForward(&v, std::uint32_t(w)) ? v : + _BitScanForward(&v, std::uint32_t(w >> 32)) ? v + 32 : 0); +} +#endif // _M_X64 +#endif // _MSC_VER + +namespace fst { + +// Downcasting. +template +inline To down_cast(From* f) { return static_cast(f); } + +// Bitcasting. +template +inline Dest bit_cast(const Source &source) { + static_assert(sizeof(Dest) == sizeof(Source), + "Bitcasting unsafe for specified types"); + Dest dest; + memcpy(&dest, &source, sizeof(dest)); + return dest; +} + +// Check sums +class CheckSummer { + public: + CheckSummer() : count_(0) { + check_sum_.resize(kCheckSumLength, '\0'); + } + + void Reset() { + count_ = 0; + for (int i = 0; i < kCheckSumLength; ++i) check_sum_[i] = '\0'; + } + + void Update(void const *data, int size) { + const char *p = reinterpret_cast(data); + for (int i = 0; i < size; ++i) { + check_sum_[(count_++) % kCheckSumLength] ^= p[i]; + } + } + + void Update(string const &data) { + for (int i = 0; i < data.size(); ++i) { + check_sum_[(count_++) % kCheckSumLength] ^= data[i]; + } + } + + string Digest() { return check_sum_; } + + private: + static const int kCheckSumLength = 32; + int count_; + string check_sum_; + + CheckSummer(const CheckSummer &) = delete; + CheckSummer &operator=(const CheckSummer &) = delete; +}; + +} // namespace fst + +#endif // FST_LIB_COMPAT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/complement.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/complement.h new file mode 100644 index 0000000..64eebc0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/complement.h @@ -0,0 +1,277 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to complement an FST. + +#ifndef FST_COMPLEMENT_H_ +#define FST_COMPLEMENT_H_ + +#include +#include +#include +#include + +#include +#include + + +namespace fst { + +template +class ComplementFst; + +namespace internal { + +// Implementation of delayed ComplementFst. The algorithm used completes the +// (deterministic) FSA and then exchanges final and non-final states. +// Completion, i.e. ensuring that all labels can be read from every state, is +// accomplished by using ρ-labels, which match all labels that are otherwise +// not found leaving a state. The first state in the output is reserved to be a +// new state that is the destination of all ρ-labels. Each remaining output +// state s corresponds to input state s - 1. The first arc in the output at +// these states is the ρ-label, the remaining arcs correspond to the input +// arcs. +template +class ComplementFstImpl : public FstImpl { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + friend class StateIterator>; + friend class ArcIterator>; + + explicit ComplementFstImpl(const Fst &fst) : fst_(fst.Copy()) { + SetType("complement"); + uint64 props = fst.Properties(kILabelSorted, false); + SetProperties(ComplementProperties(props), kCopyProperties); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + } + + ComplementFstImpl(const ComplementFstImpl &impl) + : fst_(impl.fst_->Copy()) { + SetType("complement"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + StateId Start() const { + if (Properties(kError)) return kNoStateId; + auto start = fst_->Start(); + return start != kNoStateId ? start + 1 : 0; + } + + // Exchange final and non-final states; makes ρ-destination state final. + Weight Final(StateId s) const { + if (s == 0 || fst_->Final(s - 1) == Weight::Zero()) { + return Weight::One(); + } else { + return Weight::Zero(); + } + } + + size_t NumArcs(StateId s) const { + return s == 0 ? 1 : fst_->NumArcs(s - 1) + 1; + } + + size_t NumInputEpsilons(StateId s) const { + return s == 0 ? 0 : fst_->NumInputEpsilons(s - 1); + } + + size_t NumOutputEpsilons(StateId s) const { + return s == 0 ? 0 : fst_->NumOutputEpsilons(s - 1); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && fst_->Properties(kError, false)) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + private: + std::unique_ptr> fst_; +}; + +} // namespace internal + +// Complements an automaton. This is a library-internal operation that +// introduces a (negative) ρ-label; use Difference/DifferenceFst in user code, +// which will not see this label. This version is a delayed FST. +// +// This class attaches interface to implementation and handles +// reference counting, delegating most methods to ImplToFst. +template +class ComplementFst : public ImplToFst> { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Impl = internal::ComplementFstImpl; + + friend class StateIterator>; + friend class ArcIterator>; + + explicit ComplementFst(const Fst &fst) + : ImplToFst(std::make_shared(fst)) { + static constexpr auto props = + kUnweighted | kNoEpsilons | kIDeterministic | kAcceptor; + if (fst.Properties(props, true) != props) { + FSTERROR() << "ComplementFst: Argument not an unweighted " + << "epsilon-free deterministic acceptor"; + GetImpl()->SetProperties(kError, kError); + } + } + + // See Fst<>::Copy() for doc. + ComplementFst(const ComplementFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Gets a copy of this FST. See Fst<>::Copy() for further doc. + ComplementFst *Copy(bool safe = false) const override { + return new ComplementFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + inline void InitArcIterator(StateId s, + ArcIteratorData *data) const override; + + // Label that represents the ρ-transition; we use a negative value private to + // the library and which will preserve FST label sort order. + static const Label kRhoLabel = -2; + + private: + using ImplToFst::GetImpl; + + ComplementFst &operator=(const ComplementFst &) = delete; +}; + +template +const typename Arc::Label ComplementFst::kRhoLabel; + +// Specialization for ComplementFst. +template +class StateIterator> : public StateIteratorBase { + public: + using StateId = typename Arc::StateId; + + explicit StateIterator(const ComplementFst &fst) + : siter_(*fst.GetImpl()->fst_), s_(0) {} + + bool Done() const final { return s_ > 0 && siter_.Done(); } + + StateId Value() const final { return s_; } + + void Next() final { + if (s_ != 0) siter_.Next(); + ++s_; + } + + void Reset() final { + siter_.Reset(); + s_ = 0; + } + + private: + StateIterator> siter_; + StateId s_; +}; + +// Specialization for ComplementFst. +template +class ArcIterator> : public ArcIteratorBase { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + ArcIterator(const ComplementFst &fst, StateId s) : s_(s), pos_(0) { + if (s_ != 0) { + aiter_.reset(new ArcIterator>(*fst.GetImpl()->fst_, s - 1)); + } + } + + bool Done() const final { + if (s_ != 0) { + return pos_ > 0 && aiter_->Done(); + } else { + return pos_ > 0; + } + } + + // Adds the ρ-label to the ρ destination state. + const Arc &Value() const final { + if (pos_ == 0) { + arc_.ilabel = arc_.olabel = ComplementFst::kRhoLabel; + arc_.weight = Weight::One(); + arc_.nextstate = 0; + } else { + arc_ = aiter_->Value(); + ++arc_.nextstate; + } + return arc_; + } + + void Next() final { + if (s_ != 0 && pos_ > 0) aiter_->Next(); + ++pos_; + } + + size_t Position() const final { return pos_; } + + void Reset() final { + if (s_ != 0) aiter_->Reset(); + pos_ = 0; + } + + void Seek(size_t a) final { + if (s_ != 0) { + if (a == 0) { + aiter_->Reset(); + } else { + aiter_->Seek(a - 1); + } + } + pos_ = a; + } + + uint32 Flags() const final { return kArcValueFlags; } + + void SetFlags(uint32, uint32) final {} + + private: + std::unique_ptr>> aiter_; + StateId s_; + size_t pos_; + mutable Arc arc_; +}; + +template +inline void ComplementFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +template +inline void ComplementFst::InitArcIterator(StateId s, + ArcIteratorData *data) const { + data->base = new ArcIterator>(*this, s); +} + +// Useful alias when using StdArc. +using StdComplementFst = ComplementFst; + +} // namespace fst + +#endif // FST_COMPLEMENT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/compose-filter.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/compose-filter.h new file mode 100644 index 0000000..7251e27 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/compose-filter.h @@ -0,0 +1,571 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes for filtering the composition matches, e.g. for correct epsilon +// handling. + +#ifndef FST_COMPOSE_FILTER_H_ +#define FST_COMPOSE_FILTER_H_ + +#include +#include // For optional argument declarations +#include +#include + + +namespace fst { + +// Composition filters determine which matches are allowed to proceed. The +// filter's state is represeted by the type ComposeFilter::FilterState. +// The basic filters handle correct epsilon matching. Their interface is: +// +// template +// class ComposeFilter { +// public: +// using Matcher1 = ...; +// using Matcher2 = ...; +// using FST1 = typename M1::FST; +// using FST2 = typename M2::FST; +// using FilterState = ...; +// +// using Arc = typename FST1::Arc; +// using StateId = typename Arc::StateId; +// using Weight = typename Arc::Weight; +// +// // Required constructor. +// ComposeFilter(const FST1 &fst1, const FST2 &fst2, +// M1 *matcher1 = nullptr, M2 *matcher2 = nullptr); +// +// // If safe=true, the copy is thread-safe. See Fst<>::Copy() +// // for further doc. +// ComposeFilter(const ComposeFilter &filter, +// bool safe = false); +// +// // Return start state of filter. +// FilterState Start() const; +// +// // Specifies current composition state. +// void SetState(StateId s1, StateId s2, const FilterState &fs); +// +// // Apply filter at current composition state to these transitions. If an +// // arc label to be matched is kNolabel, then that side does not consume a +// // symbol. Returns the new filter state or, if disallowed, +// // FilterState::NoState(). The filter is permitted to modify its inputs +// // (e.g. for optimization reasons). +// FilterState FilterArc(Arc *arc1, Arc *arc2) const; + +// // Apply filter at current composition state to these final weights +// // (cf. superfinal transitions). The filter may modify its inputs +// // (e.g. for optimization reasons). +// void FilterFinal(Weight *w1, Weight *w2) const; +// +// // Return the respective matchers. Ownership stays with filter. These +// // methods allow the filter to access and possibly modify the compositio +// // matchers (useful, e.g., with lookahead). +// +// Matcher1 *GetMatcher1(); +// +// Matcher2 *GetMatcher2(); +// +// // This specifies how the filter affects the composition result properties. +// It takes as argument the properties that would apply with a trivial +// // composition filter. +// uint64 Properties(uint64 props) const; +// }; +// +// This filter allows only exact matching of symbols from FST1 with on FST2; +// e.g., no special interpretation of epsilons. +template +class NullComposeFilter { + public: + using Matcher1 = M1; + using Matcher2 = M2; + using FST1 = typename M1::FST; + using FST2 = typename M2::FST; + using FilterState = TrivialFilterState; + + using Arc = typename FST1::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + NullComposeFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, Matcher2 *matcher2 = nullptr) + : matcher1_(matcher1 ? matcher1 : new Matcher1(fst1, MATCH_OUTPUT)), + matcher2_(matcher2 ? matcher2 : new Matcher2(fst2, MATCH_INPUT)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()) {} + + NullComposeFilter(const NullComposeFilter &filter, bool safe = false) + : matcher1_(filter.matcher1_->Copy(safe)), + matcher2_(filter.matcher2_->Copy(safe)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()) {} + + FilterState Start() const { return FilterState(true); } + + void SetState(StateId, StateId, const FilterState &) {} + + FilterState FilterArc(Arc *arc1, Arc *arc2) const { + return (arc1->olabel == kNoLabel || arc2->ilabel == kNoLabel) + ? FilterState::NoState() + : FilterState(true); + } + + void FilterFinal(Weight *, Weight *) const {} + + Matcher1 *GetMatcher1() { return matcher1_.get(); } + + Matcher2 *GetMatcher2() { return matcher2_.get(); } + + uint64 Properties(uint64 props) const { return props; } + + private: + std::unique_ptr matcher1_; + std::unique_ptr matcher2_; + const FST1 &fst1_; + const FST2 &fst2_; +}; + +// This filter allows all epsilon matches, potentially resulting in redundant +// epsilon paths. The use of this filter gives correct results iff one of the +// following conditions hold: +// +// (1) The semiring is idempotent, +// (2) the first FST is output-epsilon free, or +// (3) the second FST is input-epsilon free. +// +// For (1), redundant epsilon paths may be created but won't hurt correctness. +// For (2) and (3), no redundant paths are created. +template +class TrivialComposeFilter { + public: + using Matcher1 = M1; + using Matcher2 = M2; + using FST1 = typename M1::FST; + using FST2 = typename M2::FST; + using FilterState = TrivialFilterState; + + using Arc = typename FST1::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + TrivialComposeFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, + Matcher2 *matcher2 = nullptr) + : matcher1_(matcher1 ? matcher1 : new Matcher1(fst1, MATCH_OUTPUT)), + matcher2_(matcher2 ? matcher2 : new Matcher2(fst2, MATCH_INPUT)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()) {} + + TrivialComposeFilter(const TrivialComposeFilter &filter, + bool safe = false) + : matcher1_(filter.matcher1_->Copy(safe)), + matcher2_(filter.matcher2_->Copy(safe)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()) {} + + FilterState Start() const { return FilterState(true); } + + void SetState(StateId, StateId, const FilterState &) {} + + FilterState FilterArc(Arc *, Arc *) const { return FilterState(true); } + + void FilterFinal(Weight *, Weight *) const {} + + Matcher1 *GetMatcher1() { return matcher1_.get(); } + + Matcher2 *GetMatcher2() { return matcher2_.get(); } + + uint64 Properties(uint64 props) const { return props; } + + private: + std::unique_ptr matcher1_; + std::unique_ptr matcher2_; + const FST1 &fst1_; + const FST2 &fst2_; +}; + +// This filter requires epsilons on FST1 to be read before epsilons on FST2. +template +class SequenceComposeFilter { + public: + using Matcher1 = M1; + using Matcher2 = M2; + using FST1 = typename M1::FST; + using FST2 = typename M2::FST; + using FilterState = CharFilterState; + + using Arc = typename FST1::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + SequenceComposeFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, + Matcher2 *matcher2 = nullptr) + : matcher1_(matcher1 ? matcher1 : new Matcher1(fst1, MATCH_OUTPUT)), + matcher2_(matcher2 ? matcher2 : new Matcher2(fst2, MATCH_INPUT)), + fst1_(matcher1_->GetFst()), + s1_(kNoStateId), + s2_(kNoStateId), + fs_(kNoStateId) {} + + SequenceComposeFilter(const SequenceComposeFilter &filter, + bool safe = false) + : matcher1_(filter.matcher1_->Copy(safe)), + matcher2_(filter.matcher2_->Copy(safe)), + fst1_(matcher1_->GetFst()), + s1_(kNoStateId), + s2_(kNoStateId), + fs_(kNoStateId) {} + + FilterState Start() const { return FilterState(0); } + + void SetState(StateId s1, StateId s2, const FilterState &fs) { + if (s1_ == s1 && s2_ == s2 && fs == fs_) return; + s1_ = s1; + s2_ = s2; + fs_ = fs; + const auto na1 = internal::NumArcs(fst1_, s1); + const auto ne1 = internal::NumOutputEpsilons(fst1_, s1); + const bool fin1 = internal::Final(fst1_, s1) != Weight::Zero(); + alleps1_ = na1 == ne1 && !fin1; + noeps1_ = ne1 == 0; + } + + FilterState FilterArc(Arc *arc1, Arc *arc2) const { + if (arc1->olabel == kNoLabel) { + return alleps1_ ? FilterState::NoState() : noeps1_ ? FilterState(0) + : FilterState(1); + } else if (arc2->ilabel == kNoLabel) { + return fs_ != FilterState(0) ? FilterState::NoState() : FilterState(0); + } else { + return arc1->olabel == 0 ? FilterState::NoState() : FilterState(0); + } + } + + void FilterFinal(Weight *, Weight *) const {} + + Matcher1 *GetMatcher1() { return matcher1_.get(); } + + Matcher2 *GetMatcher2() { return matcher2_.get(); } + + uint64 Properties(uint64 props) const { return props; } + + private: + std::unique_ptr matcher1_; + std::unique_ptr matcher2_; + const FST1 &fst1_; + StateId s1_; // Current fst1_ state. + StateId s2_; // Current fst2_ state. + FilterState fs_; // Current filter state. + bool alleps1_; // Only epsilons (and non-final) leaving s1_? + bool noeps1_; // No epsilons leaving s1_? +}; + +// This filter requires epsilons on FST2 to be read before epsilons on FST1. +template +class AltSequenceComposeFilter { + public: + using Matcher1 = M1; + using Matcher2 = M2; + using FST1 = typename M1::FST; + using FST2 = typename M2::FST; + using FilterState = CharFilterState; + + using Arc = typename FST1::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + AltSequenceComposeFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, + Matcher2 *matcher2 = nullptr) + : matcher1_(matcher1 ? matcher1 : new Matcher1(fst1, MATCH_OUTPUT)), + matcher2_(matcher2 ? matcher2 : new Matcher2(fst2, MATCH_INPUT)), + fst2_(matcher2_->GetFst()), + s1_(kNoStateId), + s2_(kNoStateId), + fs_(kNoStateId) {} + + AltSequenceComposeFilter( + const AltSequenceComposeFilter &filter, + bool safe = false) + : matcher1_(filter.matcher1_->Copy(safe)), + matcher2_(filter.matcher2_->Copy(safe)), + fst2_(matcher2_->GetFst()), + s1_(kNoStateId), + s2_(kNoStateId), + fs_(kNoStateId) {} + + FilterState Start() const { return FilterState(0); } + + void SetState(StateId s1, StateId s2, const FilterState &fs) { + if (s1_ == s1 && s2_ == s2 && fs == fs_) return; + s1_ = s1; + s2_ = s2; + fs_ = fs; + const auto na2 = internal::NumArcs(fst2_, s2); + const auto ne2 = internal::NumInputEpsilons(fst2_, s2); + const bool fin2 = internal::Final(fst2_, s2) != Weight::Zero(); + alleps2_ = na2 == ne2 && !fin2; + noeps2_ = ne2 == 0; + } + + FilterState FilterArc(Arc *arc1, Arc *arc2) const { + if (arc2->ilabel == kNoLabel) { + return alleps2_ ? FilterState::NoState() : noeps2_ ? FilterState(0) + : FilterState(1); + } else if (arc1->olabel == kNoLabel) { + return fs_ == FilterState(1) ? FilterState::NoState() : FilterState(0); + } else { + return arc1->olabel == 0 ? FilterState::NoState() : FilterState(0); + } + } + + void FilterFinal(Weight *, Weight *) const {} + + Matcher1 *GetMatcher1() { return matcher1_.get(); } + + Matcher2 *GetMatcher2() { return matcher2_.get(); } + + uint64 Properties(uint64 props) const { return props; } + + private: + std::unique_ptr matcher1_; + std::unique_ptr matcher2_; + const FST2 &fst2_; + StateId s1_; // Current fst1_ state. + StateId s2_; // Current fst2_ state. + FilterState fs_; // Current filter state. + bool alleps2_; // Only epsilons (and non-final) leaving s2_? + bool noeps2_; // No epsilons leaving s2_? +}; + +// This filter requires epsilons on FST1 to be matched with epsilons on FST2 +// whenever possible. (Template arg default declared in fst-decl.h.) +template +class MatchComposeFilter { + public: + using Matcher1 = M1; + using Matcher2 = M2; + using FST1 = typename M1::FST; + using FST2 = typename M2::FST; + using FilterState = CharFilterState; + + using Arc = typename FST1::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + MatchComposeFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, Matcher2 *matcher2 = nullptr) + : matcher1_(matcher1 ? matcher1 : new Matcher1(fst1, MATCH_OUTPUT)), + matcher2_(matcher2 ? matcher2 : new Matcher2(fst2, MATCH_INPUT)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()), + s1_(kNoStateId), + s2_(kNoStateId), + fs_(kNoStateId) {} + + MatchComposeFilter(const MatchComposeFilter &filter, + bool safe = false) + : matcher1_(filter.matcher1_->Copy(safe)), + matcher2_(filter.matcher2_->Copy(safe)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()), + s1_(kNoStateId), + s2_(kNoStateId), + fs_(kNoStateId) {} + + FilterState Start() const { return FilterState(0); } + + void SetState(StateId s1, StateId s2, const FilterState &fs) { + if (s1_ == s1 && s2_ == s2 && fs == fs_) return; + s1_ = s1; + s2_ = s2; + fs_ = fs; + size_t na1 = internal::NumArcs(fst1_, s1); + size_t ne1 = internal::NumOutputEpsilons(fst1_, s1); + bool f1 = internal::Final(fst1_, s1) != Weight::Zero(); + alleps1_ = na1 == ne1 && !f1; + noeps1_ = ne1 == 0; + size_t na2 = internal::NumArcs(fst2_, s2); + size_t ne2 = internal::NumInputEpsilons(fst2_, s2); + bool f2 = internal::Final(fst2_, s2) != Weight::Zero(); + alleps2_ = na2 == ne2 && !f2; + noeps2_ = ne2 == 0; + } + + FilterState FilterArc(Arc *arc1, Arc *arc2) const { + if (arc2->ilabel == kNoLabel) { // Epsilon in FST1. + return fs_ == FilterState(0) + ? (noeps2_ + ? FilterState(0) + : (alleps2_ ? FilterState::NoState() : FilterState(1))) + : (fs_ == FilterState(1) ? FilterState(1) + : FilterState::NoState()); + } else if (arc1->olabel == kNoLabel) { // Epsilon in FST2. + return fs_ == FilterState(0) + ? (noeps1_ + ? FilterState(0) + : (alleps1_ ? FilterState::NoState() : FilterState(2))) + : (fs_ == FilterState(2) ? FilterState(2) + : FilterState::NoState()); + } else if (arc1->olabel == 0) { // Epsilon in both. + return fs_ == FilterState(0) ? FilterState(0) : FilterState::NoState(); + } else { // Both are non-epsilons. + return FilterState(0); + } + } + + void FilterFinal(Weight *, Weight *) const {} + + Matcher1 *GetMatcher1() { return matcher1_.get(); } + + Matcher2 *GetMatcher2() { return matcher2_.get(); } + + uint64 Properties(uint64 props) const { return props; } + + private: + std::unique_ptr matcher1_; + std::unique_ptr matcher2_; + const FST1 &fst1_; + const FST2 &fst2_; + StateId s1_; // Current fst1_ state. + StateId s2_; // Current fst2_ state. + FilterState fs_; // Current filter state ID. + bool alleps1_; // Only epsilson (and non-final) leaving s1? + bool alleps2_; // Only epsilons (and non-final) leaving s2? + bool noeps1_; // No epsilons leaving s1? + bool noeps2_; // No epsilons leaving s2? +}; + +// This filter disallows matching epsilons on FST1 with epsilons on FST2, +// but allows all other matches, potentially resulting in redundant +// epsilon paths. The use of this filter gives correct results iff one of the +// following conditions hold: +// +// (1) The semiring is idempotent, +// (2) the first FST is output-epsilon free, or +// (3) the second FST is input-epsilon free. +// +// For (1), redundant epsilon paths may be created but won't hurt correctness. +// For (2) and (3), no redundant paths are created. +template +class NoMatchComposeFilter { + public: + using Matcher1 = M1; + using Matcher2 = M2; + using FST1 = typename M1::FST; + using FST2 = typename M2::FST; + using FilterState = TrivialFilterState; + + using Arc = typename FST1::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + NoMatchComposeFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, + Matcher2 *matcher2 = nullptr) + : matcher1_(matcher1 ? matcher1 : new Matcher1(fst1, MATCH_OUTPUT)), + matcher2_(matcher2 ? matcher2 : new Matcher2(fst2, MATCH_INPUT)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()) {} + + NoMatchComposeFilter(const NoMatchComposeFilter &filter, + bool safe = false) + : matcher1_(filter.matcher1_->Copy(safe)), + matcher2_(filter.matcher2_->Copy(safe)), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()) {} + + FilterState Start() const { return FilterState(true); } + + void SetState(StateId, StateId, const FilterState &) {} + + FilterState FilterArc(Arc *arc1, Arc *arc2) const { + return FilterState(arc1->olabel != 0 || arc2->ilabel != 0); + } + + void FilterFinal(Weight *, Weight *) const {} + + Matcher1 *GetMatcher1() { return matcher1_.get(); } + + Matcher2 *GetMatcher2() { return matcher2_.get(); } + + uint64 Properties(uint64 props) const { return props; } + + private: + std::unique_ptr matcher1_; + std::unique_ptr matcher2_; + const FST1 &fst1_; + const FST2 &fst2_; +}; + +// This filter works with the MultiEpsMatcher to determine if multi-epsilons are +// preserved in the composition output (rather than rewritten as 0) and +// ensures correct properties. +template +class MultiEpsFilter { + public: + using Matcher1 = typename Filter::Matcher1; + using Matcher2 = typename Filter::Matcher2; + using FST1 = typename Filter::FST1; + using FST2 = typename Filter::FST2; + using FilterState = typename Filter::FilterState; + + using Arc = typename Filter::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + MultiEpsFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, Matcher2 *matcher2 = nullptr, + bool keep_multi_eps = false) + : filter_(fst1, fst2, matcher1, matcher2), + keep_multi_eps_(keep_multi_eps) {} + + MultiEpsFilter(const MultiEpsFilter &filter, bool safe = false) + : filter_(filter.filter_, safe), + keep_multi_eps_(filter.keep_multi_eps_) {} + + FilterState Start() const { return filter_.Start(); } + + void SetState(StateId s1, StateId s2, const FilterState &fs) { + return filter_.SetState(s1, s2, fs); + } + + FilterState FilterArc(Arc *arc1, Arc *arc2) const { + const auto fs = filter_.FilterArc(arc1, arc2); + if (keep_multi_eps_) { + if (arc1->olabel == kNoLabel) arc1->ilabel = arc2->ilabel; + if (arc2->ilabel == kNoLabel) arc2->olabel = arc1->olabel; + } + return fs; + } + + void FilterFinal(Weight *w1, Weight *w2) const { + return filter_.FilterFinal(w1, w2); + } + + Matcher1 *GetMatcher1() { return filter_.GetMatcher1(); } + + Matcher2 *GetMatcher2() { return filter_.GetMatcher2(); } + + uint64 Properties(uint64 iprops) const { + const auto oprops = filter_.Properties(iprops); + return oprops & kILabelInvariantProperties & kOLabelInvariantProperties; + } + + private: + Filter filter_; + bool keep_multi_eps_; +}; + +} // namespace fst + +#endif // FST_COMPOSE_FILTER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/compose.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/compose.h new file mode 100644 index 0000000..1066d09 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/compose.h @@ -0,0 +1,1035 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to compute the composition of two FSTs. + +#ifndef FST_COMPOSE_H_ +#define FST_COMPOSE_H_ + +#include +#include +#include + +#include + +#include +#include +#include // For optional argument declarations +#include +#include +#include +#include + + +namespace fst { + +// Delayed composition options templated on the arc type, the matcher, +// the composition filter, and the composition state table. By +// default, the matchers, filter, and state table are constructed by +// composition. If set below, the user can instead pass in these +// objects; in that case, ComposeFst takes their ownership. This +// version controls composition implemented between generic Fst +// types and a shared matcher type M for Fst. This should be +// adequate for most applications, giving a reasonable tradeoff +// between efficiency and code sharing (but see ComposeFstImplOptions). +template >, + class Filter = SequenceComposeFilter, + class StateTable = + GenericComposeStateTable> +struct ComposeFstOptions : public CacheOptions { + M *matcher1; // FST1 matcher. + M *matcher2; // FST2 matcher. + Filter *filter; // Composition filter. + StateTable *state_table; // Composition state table. + + explicit ComposeFstOptions(const CacheOptions &opts = CacheOptions(), + M *matcher1 = nullptr, M *matcher2 = nullptr, + Filter *filter = nullptr, + StateTable *state_table = nullptr) + : CacheOptions(opts), + matcher1(matcher1), + matcher2(matcher2), + filter(filter), + state_table(state_table) {} +}; + +// Forward declaration of ComposeFstMatcher. +template +class ComposeFstMatcher; + +// Delayed composition options templated on the two matcher types, the +// composition filter, the composition state table and the cache store. By +// default, the matchers, filter, state table and cache store are constructed +// by composition. If set below, the user can instead pass in these objects; in +// that case, ComposeFst takes their ownership. This version controls +// composition implemented using arbitrary matchers (of the same arc type but +// otherwise arbitrary FST type). The user must ensure the matchers are +// compatible. These options permit the most efficient use, but shares the +// least code. This is for advanced use only in the most demanding or +// specialized applications that can benefit from it; otherwise, prefer +// ComposeFstOptions). +template , + class StateTable = GenericComposeStateTable< + typename M1::Arc, typename Filter::FilterState>, + class CacheStore = DefaultCacheStore> +struct ComposeFstImplOptions : public CacheImplOptions { + M1 *matcher1; // FST1 matcher (see matcher.h).... + M2 *matcher2; // FST2 matcher. + Filter *filter; // Composition filter (see compose-filter.h). + StateTable + *state_table; // Composition state table (see compose-state-table.h). + bool own_state_table; // ComposeFstImpl takes ownership of 'state_table'? + bool allow_noncommute; // Allow non-commutative weights + + explicit ComposeFstImplOptions(const CacheOptions &opts, + M1 *matcher1 = nullptr, M2 *matcher2 = nullptr, + Filter *filter = nullptr, + StateTable *state_table = nullptr) + : CacheImplOptions(opts), + matcher1(matcher1), + matcher2(matcher2), + filter(filter), + state_table(state_table), + own_state_table(true), + allow_noncommute(false) {} + + explicit ComposeFstImplOptions(const CacheImplOptions &opts, + M1 *matcher1 = nullptr, M2 *matcher2 = nullptr, + Filter *filter = nullptr, + StateTable *state_table = nullptr) + : CacheImplOptions(opts), + matcher1(matcher1), + matcher2(matcher2), + filter(filter), + state_table(state_table), + own_state_table(true), + allow_noncommute(false) {} + + ComposeFstImplOptions() + : matcher1(nullptr), + matcher2(nullptr), + filter(nullptr), + state_table(nullptr), + own_state_table(true), + allow_noncommute(false) {} +}; + +namespace internal { + +// Implementation of delayed composition. This base class is common to the +// variants with different matchers, composition filters and state tables. +template , + class F = ComposeFst> +class ComposeFstImplBase + : public CacheBaseImpl { + public: + using FST = F; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using State = typename CacheStore::State; + using CacheImpl = CacheBaseImpl; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::Properties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheImpl::HasStart; + using CacheImpl::HasFinal; + using CacheImpl::HasArcs; + using CacheImpl::SetFinal; + using CacheImpl::SetStart; + + ComposeFstImplBase(const CacheImplOptions &opts) + : CacheImpl(opts) {} + + ComposeFstImplBase(const CacheOptions &opts) : CacheImpl(opts) {} + + ComposeFstImplBase(const ComposeFstImplBase &impl) : CacheImpl(impl, true) { + SetType(impl.Type()); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + virtual ComposeFstImplBase *Copy() const = 0; + + ~ComposeFstImplBase() override {} + + StateId Start() { + if (!HasStart()) { + const auto start = ComputeStart(); + if (start != kNoStateId) SetStart(start); + } + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) SetFinal(s, ComputeFinal(s)); + return CacheImpl::Final(s); + } + + virtual void Expand(StateId s) = 0; + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + virtual MatcherBase *InitMatcher(const F &fst, + MatchType match_type) const { + // Use the default matcher if no override is provided. + return nullptr; + } + + protected: + virtual StateId ComputeStart() = 0; + virtual Weight ComputeFinal(StateId s) = 0; +}; + +// Implementation of delayed composition templated on the matchers (see +// matcher.h), composition filter (see compose-filter.h) and the composition +// state table (see compose-state-table.h). +template +class ComposeFstImpl + : public ComposeFstImplBase { + public: + using Matcher1 = typename Filter::Matcher1; + using Matcher2 = typename Filter::Matcher2; + + using FST1 = typename Matcher1::FST; + using FST2 = typename Matcher2::FST; + + using Arc = typename CacheStore::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FilterState = typename Filter::FilterState; + using State = typename CacheStore::State; + + using CacheImpl = CacheBaseImpl; + + using StateTuple = typename StateTable::StateTuple; + + friend class ComposeFstMatcher; + + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::SetType; + using FstImpl::SetProperties; + + template + ComposeFstImpl(const FST1 &fst1, const FST2 &fst2, + const ComposeFstImplOptions &opts); + + ComposeFstImpl(const ComposeFstImpl &impl) + : ComposeFstImplBase(impl), + filter_(new Filter(*impl.filter_, true)), + matcher1_(filter_->GetMatcher1()), + matcher2_(filter_->GetMatcher2()), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()), + state_table_(new StateTable(*impl.state_table_)), + own_state_table_(true), + match_type_(impl.match_type_) {} + + ~ComposeFstImpl() override { + if (own_state_table_) delete state_table_; + } + + ComposeFstImpl *Copy() const override { return new ComposeFstImpl(*this); } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && + (fst1_.Properties(kError, false) || fst2_.Properties(kError, false) || + (matcher1_->Properties(0) & kError) || + (matcher2_->Properties(0) & kError) | + (filter_->Properties(0) & kError) || + state_table_->Error())) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + // Arranges it so that the first arg to OrderedExpand is the Fst + // that will be matched on. + void Expand(StateId s) override { + const auto &tuple = state_table_->Tuple(s); + const auto s1 = tuple.StateId1(); + const auto s2 = tuple.StateId2(); + filter_->SetState(s1, s2, tuple.GetFilterState()); + if (MatchInput(s1, s2)) { + OrderedExpand(s, fst2_, s2, fst1_, s1, matcher2_, true); + } else { + OrderedExpand(s, fst1_, s1, fst2_, s2, matcher1_, false); + } + } + + const FST1 &GetFst1() const { return fst1_; } + + const FST2 &GetFst2() const { return fst2_; } + + const Matcher1 *GetMatcher1() const { return matcher1_; } + + Matcher1 *GetMatcher1() { return matcher1_; } + + const Matcher2 *GetMatcher2() const { return matcher2_; } + + Matcher2 *GetMatcher2() { return matcher2_; } + + const Filter *GetFilter() const { return filter_.get(); } + + Filter *GetFilter() { return filter_.get(); } + + const StateTable *GetStateTable() const { return state_table_; } + + StateTable *GetStateTable() { return state_table_; } + + MatcherBase *InitMatcher(const ComposeFst &fst, + MatchType match_type) const override { + const auto test_props = match_type == MATCH_INPUT + ? kFstProperties & ~kILabelInvariantProperties + : kFstProperties & ~kOLabelInvariantProperties; + // If both matchers support 'match_type' and we have a guarantee that a + // call to 'filter_->FilterArc(arc1, arc2)' will not modify the ilabel of + // arc1 when MATCH_INPUT or the olabel or arc2 when MATCH_OUTPUT, then + // ComposeFstMatcher can be used. + if ((matcher1_->Type(false) == match_type) && + (matcher2_->Type(false) == match_type) && + (filter_->Properties(test_props) == test_props)) { + return new ComposeFstMatcher< + CacheStore, Filter, StateTable>(&fst, match_type); + } + return nullptr; + } + + private: + // This does that actual matching of labels in the composition. The + // arguments are ordered so matching is called on state 'sa' of + // 'fsta' for each arc leaving state 'sb' of 'fstb'. The 'match_input' arg + // determines whether the input or output label of arcs at 'sb' is + // the one to match on. + template + void OrderedExpand(StateId s, const Fst &, StateId sa, const FST &fstb, + StateId sb, Matcher *matchera, bool match_input) { + matchera->SetState(sa); + // First processes non-consuming symbols (e.g., epsilons) on FSTA. + const Arc loop(match_input ? 0 : kNoLabel, match_input ? kNoLabel : 0, + Weight::One(), sb); + MatchArc(s, matchera, loop, match_input); + // Then processes matches on FSTB. + for (ArcIterator iterb(fstb, sb); !iterb.Done(); iterb.Next()) { + MatchArc(s, matchera, iterb.Value(), match_input); + } + CacheImpl::SetArcs(s); + } + + // Matches a single transition from 'fstb' against 'fata' at 's'. + template + void MatchArc(StateId s, Matcher *matchera, const Arc &arc, + bool match_input) { + if (matchera->Find(match_input ? arc.olabel : arc.ilabel)) { + for (; !matchera->Done(); matchera->Next()) { + auto arca = matchera->Value(); + auto arcb = arc; + if (match_input) { + const auto &fs = filter_->FilterArc(&arcb, &arca); + if (fs != FilterState::NoState()) AddArc(s, arcb, arca, fs); + } else { + const auto &fs = filter_->FilterArc(&arca, &arcb); + if (fs != FilterState::NoState()) AddArc(s, arca, arcb, fs); + } + } + } + } + + // Add a matching transition at 's'. + void AddArc(StateId s, const Arc &arc1, const Arc &arc2, + const FilterState &f) { + const StateTuple tuple(arc1.nextstate, arc2.nextstate, f); + CacheImpl::EmplaceArc( + s, arc1.ilabel, arc2.olabel, Times(arc1.weight, arc2.weight), + state_table_->FindState(tuple)); + } + + StateId ComputeStart() override { + const auto s1 = fst1_.Start(); + if (s1 == kNoStateId) return kNoStateId; + const auto s2 = fst2_.Start(); + if (s2 == kNoStateId) return kNoStateId; + const auto &fs = filter_->Start(); + const StateTuple tuple(s1, s2, fs); + return state_table_->FindState(tuple); + } + + Weight ComputeFinal(StateId s) override { + const auto &tuple = state_table_->Tuple(s); + const auto s1 = tuple.StateId1(); + auto final1 = matcher1_->Final(s1); + if (final1 == Weight::Zero()) return final1; + const auto s2 = tuple.StateId2(); + auto final2 = matcher2_->Final(s2); + if (final2 == Weight::Zero()) return final2; + filter_->SetState(s1, s2, tuple.GetFilterState()); + filter_->FilterFinal(&final1, &final2); + return Times(final1, final2); + } + + // Determines which side to match on per composition state. + bool MatchInput(StateId s1, StateId s2) { + switch (match_type_) { + case MATCH_INPUT: + return true; + case MATCH_OUTPUT: + return false; + default: // MATCH_BOTH + const auto priority1 = matcher1_->Priority(s1); + const auto priority2 = matcher2_->Priority(s2); + if (priority1 == kRequirePriority && priority2 == kRequirePriority) { + FSTERROR() << "ComposeFst: Both sides can't require match"; + SetProperties(kError, kError); + return true; + } + if (priority1 == kRequirePriority) return false; + if (priority2 == kRequirePriority) { + return true; + } + return priority1 <= priority2; + } + } + + // Identifies and verifies the capabilities of the matcher to be used for + // composition. + void SetMatchType(); + + std::unique_ptr filter_; + Matcher1 *matcher1_; // Borrowed reference. + Matcher2 *matcher2_; // Borrowed reference. + const FST1 &fst1_; + const FST2 &fst2_; + StateTable *state_table_; + bool own_state_table_; + + MatchType match_type_; +}; + +template +template +ComposeFstImpl::ComposeFstImpl( + const FST1 &fst1, const FST2 &fst2, + const ComposeFstImplOptions &opts) + : ComposeFstImplBase(opts), + filter_(opts.filter + ? opts.filter + : new Filter(fst1, fst2, opts.matcher1, opts.matcher2)), + matcher1_(filter_->GetMatcher1()), + matcher2_(filter_->GetMatcher2()), + fst1_(matcher1_->GetFst()), + fst2_(matcher2_->GetFst()), + state_table_(opts.state_table ? opts.state_table + : new StateTable(fst1_, fst2_)), + own_state_table_(opts.state_table ? opts.own_state_table : true) { + SetType("compose"); + if (!CompatSymbols(fst2.InputSymbols(), fst1.OutputSymbols())) { + FSTERROR() << "ComposeFst: Output symbol table of 1st argument " + << "does not match input symbol table of 2nd argument"; + SetProperties(kError, kError); + } + SetInputSymbols(fst1_.InputSymbols()); + SetOutputSymbols(fst2_.OutputSymbols()); + SetMatchType(); + VLOG(2) << "ComposeFstImpl: Match type: " << match_type_; + if (match_type_ == MATCH_NONE) SetProperties(kError, kError); + const auto fprops1 = fst1.Properties(kFstProperties, false); + const auto fprops2 = fst2.Properties(kFstProperties, false); + const auto mprops1 = matcher1_->Properties(fprops1); + const auto mprops2 = matcher2_->Properties(fprops2); + const auto cprops = ComposeProperties(mprops1, mprops2); + SetProperties(filter_->Properties(cprops), kCopyProperties); + if (state_table_->Error()) SetProperties(kError, kError); +} + +template +void ComposeFstImpl::SetMatchType() { + // Ensures any required matching is possible and known. + if ((matcher1_->Flags() & kRequireMatch) && + matcher1_->Type(true) != MATCH_OUTPUT) { + FSTERROR() << "ComposeFst: 1st argument cannot perform required matching " + << "(sort?)."; + match_type_ = MATCH_NONE; + return; + } + if ((matcher2_->Flags() & kRequireMatch) && + matcher2_->Type(true) != MATCH_INPUT) { + FSTERROR() << "ComposeFst: 2nd argument cannot perform required matching " + << "(sort?)."; + match_type_ = MATCH_NONE; + return; + } + // Finds which sides to match on (favoring minimal testing of capabilities). + const auto type1 = matcher1_->Type(false); + const auto type2 = matcher2_->Type(false); + if (type1 == MATCH_OUTPUT && type2 == MATCH_INPUT) { + match_type_ = MATCH_BOTH; + } else if (type1 == MATCH_OUTPUT) { + match_type_ = MATCH_OUTPUT; + } else if (type2 == MATCH_INPUT) { + match_type_ = MATCH_INPUT; + } else if (matcher1_->Type(true) == MATCH_OUTPUT) { + match_type_ = MATCH_OUTPUT; + } else if (matcher2_->Type(true) == MATCH_INPUT) { + match_type_ = MATCH_INPUT; + } else { + FSTERROR() << "ComposeFst: 1st argument cannot match on output labels " + << "and 2nd argument cannot match on input labels (sort?)."; + match_type_ = MATCH_NONE; + } +} + +} // namespace internal + +// Computes the composition of two transducers. This version is a delayed FST. +// If FST1 transduces string x to y with weight a and FST2 transduces y to z +// with weight b, then their composition transduces string x to z with weight +// Times(x, z). +// +// The output labels of the first transducer or the input labels of the second +// transducer must be sorted (with the default matcher). The weights need to +// form a commutative semiring (valid for TropicalWeight and LogWeight). +// +// Complexity: +// +// Assuming the first FST is unsorted and the second is sorted, +// +// Time: O(v1 v2 d1 (log d2 + m2)), +// Space: O(v1 v2) +// +// where vi = # of states visited, di = maximum out-degree, and mi the +// maximum multiplicity of the states visited, for the ith FST. Constant time +// and space to visit an input state or arc is assumed and exclusive of caching. +// +// Caveats: +// - ComposeFst does not trim its output (since it is a delayed operation). +// - The efficiency of composition can be strongly affected by several factors: +// - the choice of which transducer is sorted - prefer sorting the FST +// that has the greater average out-degree. +// - the amount of non-determinism +// - the presence and location of epsilon transitions - avoid epsilon +// transitions on the output side of the first transducer or +// the input side of the second transducer or prefer placing +// them later in a path since they delay matching and can +// introduce non-coaccessible states and transitions. +// +// This class attaches interface to implementation and handles reference +// counting, delegating most methods to ImplToFst. The CacheStore specifies the +// cache store (default declared in fst-decl.h). +template */> +class ComposeFst + : public ImplToFst> { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = CacheStore; + using State = typename CacheStore::State; + + using Impl = internal::ComposeFstImplBase; + + friend class ArcIterator>; + friend class StateIterator>; + template friend class ComposeFstMatcher; + + // Compose specifying only caching options. + ComposeFst(const Fst &fst1, const Fst &fst2, + const CacheOptions &opts = CacheOptions()) + : ImplToFst(CreateBase(fst1, fst2, opts)) {} + + // Compose specifying one shared matcher type M. Requires that the input FSTs + // and matcher FST types be Fst. Recommended for best code-sharing and + // matcher compatiblity. + template + ComposeFst(const Fst &fst1, const Fst &fst2, + const ComposeFstOptions &opts) + : ImplToFst(CreateBase1(fst1, fst2, opts)) {} + + // Compose specifying two matcher types Matcher1 and Matcher2. Requires input + // FST (of the same Arc type, but o.w. arbitrary) match the corresponding + // matcher FST types). Recommended only for advanced use in demanding or + // specialized applications due to potential code bloat and matcher + // incompatibilities. + template + ComposeFst(const typename Matcher1::FST &fst1, + const typename Matcher2::FST &fst2, + const ComposeFstImplOptions &opts) + : ImplToFst(CreateBase2(fst1, fst2, opts)) {} + + // See Fst<>::Copy() for doc. + ComposeFst(const ComposeFst &fst, bool safe = false) + : ImplToFst(safe ? std::shared_ptr(fst.GetImpl()->Copy()) + : fst.GetSharedImpl()) {} + + // Get a copy of this ComposeFst. See Fst<>::Copy() for further doc. + ComposeFst *Copy(bool safe = false) const override { + return new ComposeFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + MatcherBase *InitMatcher(MatchType match_type) const override { + return GetImpl()->InitMatcher(*this, match_type); + } + + protected: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + explicit ComposeFst(std::shared_ptr impl) : ImplToFst(impl) {} + + // Create compose implementation specifying two matcher types. + template + static std::shared_ptr CreateBase2( + const typename Matcher1::FST &fst1, const typename Matcher2::FST &fst2, + const ComposeFstImplOptions &opts) { + auto impl = std::make_shared< + internal::ComposeFstImpl>(fst1, fst2, + opts); + if (!(Weight::Properties() & kCommutative) && !opts.allow_noncommute) { + const auto props1 = fst1.Properties(kUnweighted, true); + const auto props2 = fst2.Properties(kUnweighted, true); + if (!(props1 & kUnweighted) && !(props2 & kUnweighted)) { + FSTERROR() << "ComposeFst: Weights must be a commutative semiring: " + << Weight::Type(); + impl->SetProperties(kError, kError); + } + } + return impl; + } + + // Create compose implementation specifying one matcher type; requires that + // input and matcher FST types be Fst. + template + static std::shared_ptr CreateBase1( + const Fst &fst1, const Fst &fst2, + const ComposeFstOptions &opts) { + ComposeFstImplOptions + nopts(opts, opts.matcher1, opts.matcher2, opts.filter, + opts.state_table); + return CreateBase2(fst1, fst2, nopts); + } + + // Create compose implementation specifying no matcher type. + static std::shared_ptr CreateBase(const Fst &fst1, + const Fst &fst2, + const CacheOptions &opts) { + switch (LookAheadMatchType(fst1, fst2)) { // Check for lookahead matchers + default: + case MATCH_NONE: { // Default composition (no look-ahead). + ComposeFstOptions nopts(opts); + return CreateBase1(fst1, fst2, nopts); + } + case MATCH_OUTPUT: { // Lookahead on fst1. + using M = typename DefaultLookAhead::FstMatcher; + using F = typename DefaultLookAhead::ComposeFilter; + ComposeFstOptions nopts(opts); + return CreateBase1(fst1, fst2, nopts); + } + case MATCH_INPUT: { // Lookahead on fst2 + using M = typename DefaultLookAhead::FstMatcher; + using F = typename DefaultLookAhead::ComposeFilter; + ComposeFstOptions nopts(opts); + return CreateBase1(fst1, fst2, nopts); + } + } + } + + private: + ComposeFst &operator=(const ComposeFst &fst) = delete; +}; + +// Specialization for ComposeFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const ComposeFst &fst) + : CacheStateIterator>(fst, + fst.GetMutableImpl()) {} +}; + +// Specialization for ComposeFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const ComposeFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void ComposeFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Specialized matcher for ComposeFst. Supports MATCH_INPUT or MATCH_OUTPUT, +// iff the underlying matchers for the two FSTS being composed support +// MATCH_INPUT or MATCH_OUTPUT, respectively. +template +class ComposeFstMatcher : public MatcherBase { + public: + using Arc = typename CacheStore::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Matcher1 = typename Filter::Matcher1; + using Matcher2 = typename Filter::Matcher2; + using FilterState = typename Filter::FilterState; + + using StateTuple = typename StateTable::StateTuple; + using Impl = internal::ComposeFstImpl; + + // The compose FST arg must match the filter and state table types. + // This makes a copy of the FST. + ComposeFstMatcher(const ComposeFst &fst, + MatchType match_type) + : owned_fst_(fst.Copy()), + fst_(*owned_fst_), + impl_(static_cast(fst_.GetImpl())), + s_(kNoStateId), + match_type_(match_type), + matcher1_(impl_->matcher1_->Copy()), + matcher2_(impl_->matcher2_->Copy()), + current_loop_(false), + loop_(kNoLabel, 0, Weight::One(), kNoStateId) { + if (match_type_ == MATCH_OUTPUT) std::swap(loop_.ilabel, loop_.olabel); + } + + // The compose FST arg must match the filter and state table types. + // This doesn't copy the FST (although it may copy components). + ComposeFstMatcher(const ComposeFst *fst, + MatchType match_type) + : fst_(*fst), + impl_(static_cast(fst_.GetImpl())), + s_(kNoStateId), + match_type_(match_type), + matcher1_(impl_->matcher1_->Copy()), + matcher2_(impl_->matcher2_->Copy()), + current_loop_(false), + loop_(kNoLabel, 0, Weight::One(), kNoStateId) { + if (match_type_ == MATCH_OUTPUT) std::swap(loop_.ilabel, loop_.olabel); + } + + // This makes a copy of the FST. + ComposeFstMatcher( + const ComposeFstMatcher &matcher, + bool safe = false) + : owned_fst_(matcher.fst_.Copy(safe)), + fst_(*owned_fst_), + impl_(static_cast(fst_.GetImpl())), + s_(kNoStateId), + match_type_(matcher.match_type_), + matcher1_(matcher.matcher1_->Copy(safe)), + matcher2_(matcher.matcher2_->Copy(safe)), + current_loop_(false), + loop_(kNoLabel, 0, Weight::One(), kNoStateId) { + if (match_type_ == MATCH_OUTPUT) std::swap(loop_.ilabel, loop_.olabel); + } + + ComposeFstMatcher *Copy( + bool safe = false) const override { + return new ComposeFstMatcher(*this, safe); + } + + MatchType Type(bool test) const override { + if ((matcher1_->Type(test) == MATCH_NONE) || + (matcher2_->Type(test) == MATCH_NONE)) { + return MATCH_NONE; + } + if (((matcher1_->Type(test) == MATCH_UNKNOWN) && + (matcher2_->Type(test) == MATCH_UNKNOWN)) || + ((matcher1_->Type(test) == MATCH_UNKNOWN) && + (matcher2_->Type(test) == match_type_)) || + ((matcher1_->Type(test) == match_type_) && + (matcher2_->Type(test) == MATCH_UNKNOWN))) { + return MATCH_UNKNOWN; + } + if ((matcher1_->Type(test) == match_type_) && + (matcher2_->Type(test) == match_type_)) { + return match_type_; + } + return MATCH_NONE; + } + + const Fst &GetFst() const override { return fst_; } + + uint64 Properties(uint64 inprops) const override { + return inprops; + } + + void SetState(StateId s) final { + if (s_ == s) return; + s_ = s; + const auto &tuple = impl_->state_table_->Tuple(s); + matcher1_->SetState(tuple.StateId1()); + matcher2_->SetState(tuple.StateId2()); + loop_.nextstate = s_; + } + + bool Find(Label label) final { + bool found = false; + current_loop_ = false; + if (label == 0) { + current_loop_ = true; + found = true; + } + if (match_type_ == MATCH_INPUT) { + found = found || FindLabel(label, matcher1_.get(), matcher2_.get()); + } else { // match_type_ == MATCH_OUTPUT + found = found || FindLabel(label, matcher2_.get(), matcher1_.get()); + } + return found; + } + + bool Done() const final { + return !current_loop_ && matcher1_->Done() && matcher2_->Done(); + } + + const Arc &Value() const final { return current_loop_ ? loop_ : arc_; } + + void Next() final { + if (current_loop_) { + current_loop_ = false; + } else if (match_type_ == MATCH_INPUT) { + FindNext(matcher1_.get(), matcher2_.get()); + } else { // match_type_ == MATCH_OUTPUT + FindNext(matcher2_.get(), matcher1_.get()); + } + } + + ssize_t Priority(StateId s) final { return fst_.NumArcs(s); } + + private: + // Processes a match with the filter and creates resulting arc. + bool MatchArc(StateId s, Arc arc1, + Arc arc2) { // FIXME(kbg): copy but not assignment. + const auto &fs = impl_->filter_->FilterArc(&arc1, &arc2); + if (fs == FilterState::NoState()) return false; + const StateTuple tuple(arc1.nextstate, arc2.nextstate, fs); + arc_.ilabel = arc1.ilabel; + arc_.olabel = arc2.olabel; + arc_.weight = Times(arc1.weight, arc2.weight); + arc_.nextstate = impl_->state_table_->FindState(tuple); + return true; + } + + // Finds the first match allowed by the filter. + template + bool FindLabel(Label label, MatcherA *matchera, MatcherB *matcherb) { + if (matchera->Find(label)) { + matcherb->Find(match_type_ == MATCH_INPUT ? matchera->Value().olabel + : matchera->Value().ilabel); + return FindNext(matchera, matcherb); + } + return false; + } + + // Finds the next match allowed by the filter, returning true iff such a + // match is found. + template + bool FindNext(MatcherA *matchera, MatcherB *matcherb) { + // State when entering this function: + // 'matchera' is pointed to a match x, y for label x, and a match for y was + // requested on 'matcherb'. + while (!matchera->Done() || !matcherb->Done()) { + if (matcherb->Done()) { + // If no more matches for y on 'matcherb', moves forward on 'matchera' + // until a match x, y' is found such that there is a match for y' on + // 'matcherb'. + matchera->Next(); + while (!matchera->Done() && + !matcherb->Find(match_type_ == MATCH_INPUT + ? matchera->Value().olabel + : matchera->Value().ilabel)) { + matchera->Next(); + } + } + while (!matcherb->Done()) { + // 'matchera' is pointing to a match x, y' ('arca') and 'matcherb' is + // pointing to a match y', z' ('arcb'). If combining these two arcs is + // allowed by the filter (hence resulting in an arc x, z') return true. + // Position 'matcherb' on the next potential match for y' before + // returning. + const auto &arca = matchera->Value(); + const auto &arcb = matcherb->Value(); + // Position 'matcherb' on the next potential match for y'. + matcherb->Next(); + // Returns true If combining these two arcs is allowed by the filter + // (hence resulting in an arc x, z'); otherwise consider next match + // for y' on 'matcherb'. + if (MatchArc(s_, match_type_ == MATCH_INPUT ? arca : arcb, + match_type_ == MATCH_INPUT ? arcb : arca)) { + return true; + } + } + } + // Both 'matchera' and 'matcherb' are done, no more match to analyse. + return false; + } + + std::unique_ptr> owned_fst_; + const ComposeFst &fst_; + const Impl *impl_; + StateId s_; + MatchType match_type_; + std::unique_ptr matcher1_; + std::unique_ptr matcher2_; + bool current_loop_; + Arc loop_; + Arc arc_; +}; + +// Useful alias when using StdArc. +using StdComposeFst = ComposeFst; + +enum ComposeFilter { + AUTO_FILTER, + NULL_FILTER, + TRIVIAL_FILTER, + SEQUENCE_FILTER, + ALT_SEQUENCE_FILTER, + MATCH_FILTER, + NO_MATCH_FILTER +}; + +struct ComposeOptions { + bool connect; // Connect output? + ComposeFilter filter_type; // Pre-defined filter to use. + + explicit ComposeOptions(bool connect = true, + ComposeFilter filter_type = AUTO_FILTER) + : connect(connect), filter_type(filter_type) {} +}; + +// Computes the composition of two transducers. This version writes +// the composed FST into a MutableFst. If FST1 transduces string x to +// y with weight a and FST2 transduces y to z with weight b, then +// their composition transduces string x to z with weight +// Times(x, z). +// +// The output labels of the first transducer or the input labels of +// the second transducer must be sorted. The weights need to form a +// commutative semiring (valid for TropicalWeight and LogWeight). +// +// Complexity: +// +// Assuming the first FST is unsorted and the second is sorted: +// +// Time: O(V1 V2 D1 (log D2 + M2)), +// Space: O(V1 V2 D1 M2) +// +// where Vi = # of states, Di = maximum out-degree, and Mi is the maximum +// multiplicity, for the ith FST. +// +// Caveats: +// +// - Compose trims its output. +// - The efficiency of composition can be strongly affected by several factors: +// - the choice of which transducer is sorted - prefer sorting the FST +// that has the greater average out-degree. +// - the amount of non-determinism +// - the presence and location of epsilon transitions - avoid epsilon +// transitions on the output side of the first transducer or +// the input side of the second transducer or prefer placing +// them later in a path since they delay matching and can +// introduce non-coaccessible states and transitions. +template +void Compose(const Fst &ifst1, const Fst &ifst2, + MutableFst *ofst, + const ComposeOptions &opts = ComposeOptions()) { + using M = Matcher>; + // In each case, we cache only the last state for fastest copy. + switch (opts.filter_type) { + case AUTO_FILTER: { + CacheOptions nopts; + nopts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, nopts); + break; + } + case NULL_FILTER: { + ComposeFstOptions> copts; + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + break; + } + case SEQUENCE_FILTER: { + ComposeFstOptions> copts; + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + break; + } + case ALT_SEQUENCE_FILTER: { + ComposeFstOptions> copts; + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + break; + } + case MATCH_FILTER: { + ComposeFstOptions> copts; + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + break; + } + case NO_MATCH_FILTER: { + ComposeFstOptions> copts; + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + break; + } + case TRIVIAL_FILTER: { + ComposeFstOptions> copts; + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + break; + } + } + if (opts.connect) Connect(ofst); +} + +} // namespace fst + +#endif // FST_COMPOSE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/concat.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/concat.h new file mode 100644 index 0000000..74d22c2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/concat.h @@ -0,0 +1,220 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to compute the concatenation of two FSTs. + +#ifndef FST_CONCAT_H_ +#define FST_CONCAT_H_ + +#include +#include + +#include +#include + + +namespace fst { + +// Computes the concatenation (product) of two FSTs. If FST1 transduces string +// x to y with weight a and FST2 transduces string w to v with weight b, then +// their concatenation transduces string xw to yv with weight Times(a, b). +// +// This version modifies its MutableFst argument (in first position). +// +// Complexity: +// +// Time: O(V1 + V2 + E2) +// Space: O(V1 + V2 + E2) +// +// where Vi is the number of states, and Ei is the number of arcs, of the ith +// FST. +template +void Concat(MutableFst *fst1, const Fst &fst2) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + // Checks that the symbol table are compatible. + if (!CompatSymbols(fst1->InputSymbols(), fst2.InputSymbols()) || + !CompatSymbols(fst1->OutputSymbols(), fst2.OutputSymbols())) { + FSTERROR() << "Concat: Input/output symbol tables of 1st argument " + << "does not match input/output symbol tables of 2nd argument"; + fst1->SetProperties(kError, kError); + return; + } + const auto props1 = fst1->Properties(kFstProperties, false); + const auto props2 = fst2.Properties(kFstProperties, false); + const auto start1 = fst1->Start(); + if (start1 == kNoStateId) { + if (props2 & kError) fst1->SetProperties(kError, kError); + return; + } + const auto numstates1 = fst1->NumStates(); + if (fst2.Properties(kExpanded, false)) { + fst1->ReserveStates(numstates1 + CountStates(fst2)); + } + for (StateIterator> siter2(fst2); !siter2.Done(); siter2.Next()) { + const auto s1 = fst1->AddState(); + const auto s2 = siter2.Value(); + fst1->SetFinal(s1, fst2.Final(s2)); + fst1->ReserveArcs(s1, fst2.NumArcs(s2)); + for (ArcIterator> aiter(fst2, s2); !aiter.Done(); aiter.Next()) { + auto arc = aiter.Value(); + arc.nextstate += numstates1; + fst1->AddArc(s1, arc); + } + } + const auto start2 = fst2.Start(); + for (StateId s1 = 0; s1 < numstates1; ++s1) { + const auto weight = fst1->Final(s1); + if (weight != Weight::Zero()) { + fst1->SetFinal(s1, Weight::Zero()); + if (start2 != kNoStateId) { + fst1->AddArc(s1, Arc(0, 0, weight, start2 + numstates1)); + } + } + } + if (start2 != kNoStateId) { + fst1->SetProperties(ConcatProperties(props1, props2), kFstProperties); + } +} + +// Computes the concatentation of two FSTs. This version modifies its +// MutableFst argument (in second position). +// +// Complexity: +// +// Time: O(V1 + E1) +// Space: O(V1 + E1) +// +// where Vi is the number of states, and Ei is the number of arcs, of the ith +// FST. +template +void Concat(const Fst &fst1, MutableFst *fst2) { + using Weight = typename Arc::Weight; + // Checks that the symbol table are compatible. + if (!CompatSymbols(fst1.InputSymbols(), fst2->InputSymbols()) || + !CompatSymbols(fst1.OutputSymbols(), fst2->OutputSymbols())) { + FSTERROR() << "Concat: Input/output symbol tables of 1st argument " + << "does not match input/output symbol tables of 2nd argument"; + fst2->SetProperties(kError, kError); + return; + } + const auto props1 = fst1.Properties(kFstProperties, false); + const auto props2 = fst2->Properties(kFstProperties, false); + const auto start2 = fst2->Start(); + if (start2 == kNoStateId) { + if (props1 & kError) fst2->SetProperties(kError, kError); + return; + } + const auto numstates2 = fst2->NumStates(); + if (fst1.Properties(kExpanded, false)) { + fst2->ReserveStates(numstates2 + CountStates(fst1)); + } + for (StateIterator> siter(fst1); !siter.Done(); siter.Next()) { + const auto s1 = siter.Value(); + const auto s2 = fst2->AddState(); + const auto weight = fst1.Final(s1); + if (weight != Weight::Zero()) { + fst2->ReserveArcs(s2, fst1.NumArcs(s1) + 1); + fst2->AddArc(s2, Arc(0, 0, weight, start2)); + } else { + fst2->ReserveArcs(s2, fst1.NumArcs(s1)); + } + for (ArcIterator> aiter(fst1, s1); !aiter.Done(); aiter.Next()) { + auto arc = aiter.Value(); + arc.nextstate += numstates2; + fst2->AddArc(s2, arc); + } + } + const auto start1 = fst1.Start(); + if (start1 != kNoStateId) { + fst2->SetStart(start1 + numstates2); + fst2->SetProperties(ConcatProperties(props1, props2), kFstProperties); + } else { + fst2->SetStart(fst2->AddState()); + } +} + +// Computes the concatentation of two FSTs. This version modifies its +// RationalFst input (in first position). +template +void Concat(RationalFst *fst1, const Fst &fst2) { + fst1->GetMutableImpl()->AddConcat(fst2, true); +} + +// Computes the concatentation of two FSTs. This version modifies its +// RationalFst input (in second position). +template +void Concat(const Fst &fst1, RationalFst *fst2) { + fst2->GetMutableImpl()->AddConcat(fst1, false); +} + +using ConcatFstOptions = RationalFstOptions; + +// Computes the concatenation (product) of two FSTs; this version is a delayed +// FST. If FST1 transduces string x to y with weight a and FST2 transduces +// string w to v with weight b, then their concatenation transduces string xw +// to yv with Times(a, b). +// +// Complexity: +// +// Time: O(v1 + e1 + v2 + e2), +// Space: O(v1 + v2) +// +// where vi is the number of states visited, and ei is the number of arcs +// visited, of the ith FST. Constant time and space to visit an input state or +// arc is assumed and exclusive of caching. +template +class ConcatFst : public RationalFst { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + ConcatFst(const Fst &fst1, const Fst &fst2) { + GetMutableImpl()->InitConcat(fst1, fst2); + } + + ConcatFst(const Fst &fst1, const Fst &fst2, + const ConcatFstOptions &opts) + : RationalFst(opts) { + GetMutableImpl()->InitConcat(fst1, fst2); + } + + // See Fst<>::Copy() for doc. + ConcatFst(const ConcatFst &fst, bool safe = false) + : RationalFst(fst, safe) {} + + // Get a copy of this ConcatFst. See Fst<>::Copy() for further doc. + ConcatFst *Copy(bool safe = false) const override { + return new ConcatFst(*this, safe); + } + + private: + using ImplToFst>::GetImpl; + using ImplToFst>::GetMutableImpl; +}; + +// Specialization for ConcatFst. +template +class StateIterator> : public StateIterator> { + public: + explicit StateIterator(const ConcatFst &fst) + : StateIterator>(fst) {} +}; + +// Specialization for ConcatFst. +template +class ArcIterator> : public ArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const ConcatFst &fst, StateId s) + : ArcIterator>(fst, s) {} +}; + +// Useful alias when using StdArc. +using StdConcatFst = ConcatFst; + +} // namespace fst + +#endif // FST_CONCAT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/config.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/config.h new file mode 100644 index 0000000..32f2a65 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/config.h @@ -0,0 +1,3 @@ +// Windows-specific OpenFst config file +// No dynamic registration. +#define FST_NO_DYNAMIC_LINKING 1 diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/config.h.in b/runtime/onnxruntime/third_party/openfst/src/include/fst/config.h.in new file mode 100644 index 0000000..7815dfc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/config.h.in @@ -0,0 +1,11 @@ +// OpenFst config file + +/* Define to 1 if you have the ICU library. */ +#undef HAVE_ICU + +/* Define to 1 if the system has the type `std::tr1::hash'. */ +#define HAVE_STD__TR1__HASH_LONG_LONG_UNSIGNED_ 1 + +/* Define to 1 if the system has the type `__gnu_cxx::slist'. */ +#define HAVE___GNU_CXX__SLIST_INT_ 1 diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/connect.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/connect.h new file mode 100644 index 0000000..4c98929 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/connect.h @@ -0,0 +1,323 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes and functions to remove unsuccessful paths from an FST. + +#ifndef FST_CONNECT_H_ +#define FST_CONNECT_H_ + +#include +#include +#include + +#include +#include +#include + + +namespace fst { + +// Finds and returns connected components. Use with Visit(). +template +class CcVisitor { + public: + using Weight = typename Arc::Weight; + using StateId = typename Arc::StateId; + + // cc[i]: connected component number for state i. + explicit CcVisitor(std::vector *cc) + : comps_(new UnionFind(0, kNoStateId)), cc_(cc), nstates_(0) {} + + // comps: connected components equiv classes. + explicit CcVisitor(UnionFind *comps) + : comps_(comps), cc_(nullptr), nstates_(0) {} + + ~CcVisitor() { + if (cc_) delete comps_; + } + + void InitVisit(const Fst &fst) {} + + bool InitState(StateId s, StateId root) { + ++nstates_; + if (comps_->FindSet(s) == kNoStateId) comps_->MakeSet(s); + return true; + } + + bool WhiteArc(StateId s, const Arc &arc) { + comps_->MakeSet(arc.nextstate); + comps_->Union(s, arc.nextstate); + return true; + } + + bool GreyArc(StateId s, const Arc &arc) { + comps_->Union(s, arc.nextstate); + return true; + } + + bool BlackArc(StateId s, const Arc &arc) { + comps_->Union(s, arc.nextstate); + return true; + } + + void FinishState(StateId s) {} + + void FinishVisit() { + if (cc_) GetCcVector(cc_); + } + + // Returns number of components. + // cc[i]: connected component number for state i. + int GetCcVector(std::vector *cc) { + cc->clear(); + cc->resize(nstates_, kNoStateId); + StateId ncomp = 0; + for (StateId s = 0; s < nstates_; ++s) { + const auto rep = comps_->FindSet(s); + auto &comp = (*cc)[rep]; + if (comp == kNoStateId) { + comp = ncomp; + ++ncomp; + } + (*cc)[s] = comp; + } + return ncomp; + } + + private: + UnionFind *comps_; // Components. + std::vector *cc_; // State's cc number. + StateId nstates_; // State count. +}; + +// Finds and returns strongly-connected components, accessible and +// coaccessible states and related properties. Uses Tarjan's single +// DFS SCC algorithm (see Aho, et al, "Design and Analysis of Computer +// Algorithms", 189pp). Use with DfsVisit(); +template +class SccVisitor { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // scc[i]: strongly-connected component number for state i. + // SCC numbers will be in topological order for acyclic input. + // access[i]: accessibility of state i. + // coaccess[i]: coaccessibility of state i. + // Any of above can be NULL. + // props: related property bits (cyclicity, initial cyclicity, + // accessibility, coaccessibility) set/cleared (o.w. unchanged). + SccVisitor(std::vector *scc, std::vector *access, + std::vector *coaccess, uint64 *props) + : scc_(scc), access_(access), coaccess_(coaccess), props_(props) {} + explicit SccVisitor(uint64 *props) + : scc_(nullptr), access_(nullptr), coaccess_(nullptr), props_(props) {} + + void InitVisit(const Fst &fst); + + bool InitState(StateId s, StateId root); + + bool TreeArc(StateId s, const Arc &arc) { return true; } + + bool BackArc(StateId s, const Arc &arc) { + const auto t = arc.nextstate; + if ((*dfnumber_)[t] < (*lowlink_)[s]) (*lowlink_)[s] = (*dfnumber_)[t]; + if ((*coaccess_)[t]) (*coaccess_)[s] = true; + *props_ |= kCyclic; + *props_ &= ~kAcyclic; + if (t == start_) { + *props_ |= kInitialCyclic; + *props_ &= ~kInitialAcyclic; + } + return true; + } + + bool ForwardOrCrossArc(StateId s, const Arc &arc) { + const auto t = arc.nextstate; + if ((*dfnumber_)[t] < (*dfnumber_)[s] /* cross edge */ && (*onstack_)[t] && + (*dfnumber_)[t] < (*lowlink_)[s]) { + (*lowlink_)[s] = (*dfnumber_)[t]; + } + if ((*coaccess_)[t]) (*coaccess_)[s] = true; + return true; + } + + // Last argument always ignored, but required by the interface. + void FinishState(StateId state, StateId p, const Arc *); + + void FinishVisit() { + // Numbers SCCs in topological order when acyclic. + if (scc_) { + for (size_t s = 0; s < scc_->size(); ++s) { + (*scc_)[s] = nscc_ - 1 - (*scc_)[s]; + } + } + if (coaccess_internal_) delete coaccess_; + dfnumber_.reset(); + lowlink_.reset(); + onstack_.reset(); + scc_stack_.reset(); + } + + private: + std::vector *scc_; // State's scc number. + std::vector *access_; // State's accessibility. + std::vector *coaccess_; // State's coaccessibility. + uint64 *props_; + const Fst *fst_; + StateId start_; + StateId nstates_; // State count. + StateId nscc_; // SCC count. + bool coaccess_internal_; + std::unique_ptr> dfnumber_; // State discovery times. + std::unique_ptr> + lowlink_; // lowlink[state] == dfnumber[state] => SCC root + std::unique_ptr> onstack_; // Is a state on the SCC stack? + std::unique_ptr> + scc_stack_; // SCC stack, with random access. +}; + +template +inline void SccVisitor::InitVisit(const Fst &fst) { + if (scc_) scc_->clear(); + if (access_) access_->clear(); + if (coaccess_) { + coaccess_->clear(); + coaccess_internal_ = false; + } else { + coaccess_ = new std::vector; + coaccess_internal_ = true; + } + *props_ |= kAcyclic | kInitialAcyclic | kAccessible | kCoAccessible; + *props_ &= ~(kCyclic | kInitialCyclic | kNotAccessible | kNotCoAccessible); + fst_ = &fst; + start_ = fst.Start(); + nstates_ = 0; + nscc_ = 0; + dfnumber_.reset(new std::vector()); + lowlink_.reset(new std::vector()); + onstack_.reset(new std::vector()); + scc_stack_.reset(new std::vector()); +} + +template +inline bool SccVisitor::InitState(StateId s, StateId root) { + scc_stack_->push_back(s); + if (static_cast(dfnumber_->size()) <= s) { + if (scc_) scc_->resize(s + 1, -1); + if (access_) access_->resize(s + 1, false); + coaccess_->resize(s + 1, false); + dfnumber_->resize(s + 1, -1); + lowlink_->resize(s + 1, -1); + onstack_->resize(s + 1, false); + } + (*dfnumber_)[s] = nstates_; + (*lowlink_)[s] = nstates_; + (*onstack_)[s] = true; + if (root == start_) { + if (access_) (*access_)[s] = true; + } else { + if (access_) (*access_)[s] = false; + *props_ |= kNotAccessible; + *props_ &= ~kAccessible; + } + ++nstates_; + return true; +} + +template +inline void SccVisitor::FinishState(StateId s, StateId p, const Arc *) { + if (fst_->Final(s) != Weight::Zero()) (*coaccess_)[s] = true; + if ((*dfnumber_)[s] == (*lowlink_)[s]) { // Root of new SCC. + bool scc_coaccess = false; + auto i = scc_stack_->size(); + StateId t; + do { + t = (*scc_stack_)[--i]; + if ((*coaccess_)[t]) scc_coaccess = true; + } while (s != t); + do { + t = scc_stack_->back(); + if (scc_) (*scc_)[t] = nscc_; + if (scc_coaccess) (*coaccess_)[t] = true; + (*onstack_)[t] = false; + scc_stack_->pop_back(); + } while (s != t); + if (!scc_coaccess) { + *props_ |= kNotCoAccessible; + *props_ &= ~kCoAccessible; + } + ++nscc_; + } + if (p != kNoStateId) { + if ((*coaccess_)[s]) (*coaccess_)[p] = true; + if ((*lowlink_)[s] < (*lowlink_)[p]) (*lowlink_)[p] = (*lowlink_)[s]; + } +} + +// Trims an FST, removing states and arcs that are not on successful paths. +// This version modifies its input. +// +// Complexity: +// +// Time: O(V + E) +// Space: O(V + E) +// +// where V = # of states and E = # of arcs. +template +void Connect(MutableFst *fst) { + using StateId = typename Arc::StateId; + std::vector access; + std::vector coaccess; + uint64 props = 0; + SccVisitor scc_visitor(nullptr, &access, &coaccess, &props); + DfsVisit(*fst, &scc_visitor); + std::vector dstates; + dstates.reserve(access.size()); + for (StateId s = 0; s < access.size(); ++s) { + if (!access[s] || !coaccess[s]) dstates.push_back(s); + } + fst->DeleteStates(dstates); + fst->SetProperties(kAccessible | kCoAccessible, kAccessible | kCoAccessible); +} + +// Returns an acyclic FST where each SCC in the input FST has been condensed to +// a single state with transitions between SCCs retained and within SCCs +// dropped. Also populates 'scc' with a mapping from input to output states. +template +void Condense(const Fst &ifst, MutableFst *ofst, + std::vector *scc) { + using StateId = typename Arc::StateId; + ofst->DeleteStates(); + uint64 props = 0; + SccVisitor scc_visitor(scc, nullptr, nullptr, &props); + DfsVisit(ifst, &scc_visitor); + const auto iter = std::max_element(scc->cbegin(), scc->cend()); + if (iter == scc->cend()) return; + const StateId num_condensed_states = 1 + *iter; + ofst->ReserveStates(num_condensed_states); + for (StateId c = 0; c < num_condensed_states; ++c) { + ofst->AddState(); + } + for (StateId s = 0; s < scc->size(); ++s) { + const auto c = (*scc)[s]; + if (s == ifst.Start()) ofst->SetStart(c); + const auto weight = ifst.Final(s); + if (weight != Arc::Weight::Zero()) + ofst->SetFinal(c, Plus(ofst->Final(c), weight)); + for (ArcIterator> aiter(ifst, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + const auto nextc = (*scc)[arc.nextstate]; + if (nextc != c) { + Arc condensed_arc = arc; + condensed_arc.nextstate = nextc; + ofst->AddArc(c, std::move(condensed_arc)); + } + } + } + ofst->SetProperties(kAcyclic | kInitialAcyclic, kAcyclic | kInitialAcyclic); +} + +} // namespace fst + +#endif // FST_CONNECT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/const-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/const-fst.h new file mode 100644 index 0000000..09c81c7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/const-fst.h @@ -0,0 +1,485 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Simple concrete immutable FST whose states and arcs are each stored in +// single arrays. + +#ifndef FST_CONST_FST_H_ +#define FST_CONST_FST_H_ + +#include +#include +#include + +// Google-only... +// ...Google-only +#include + +#include +#include +#include +#include +#include + + +namespace fst { + +template +class ConstFst; + +template +void Cast(const F &, G *); + +namespace internal { + +// States and arcs each implemented by single arrays, templated on the +// Arc definition. Unsigned is used to represent indices into the arc array. +template +class ConstFstImpl : public FstImpl { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::Properties; + + ConstFstImpl() + : states_(nullptr), + arcs_(nullptr), + narcs_(0), + nstates_(0), + start_(kNoStateId) { + string type = "const"; + if (sizeof(Unsigned) != sizeof(uint32)) { + type += std::to_string(CHAR_BIT * sizeof(Unsigned)); + } + SetType(type); + SetProperties(kNullProperties | kStaticProperties); + } + + explicit ConstFstImpl(const Fst &fst); + + StateId Start() const { return start_; } + + Weight Final(StateId s) const { return states_[s].weight; } + + StateId NumStates() const { return nstates_; } + + size_t NumArcs(StateId s) const { return states_[s].narcs; } + + size_t NumInputEpsilons(StateId s) const { return states_[s].niepsilons; } + + size_t NumOutputEpsilons(StateId s) const { return states_[s].noepsilons; } + + static ConstFstImpl *Read(std::istream &strm, + const FstReadOptions &opts); + + const Arc *Arcs(StateId s) const { return arcs_ + states_[s].pos; } + + // Provide information needed for generic state iterator. + void InitStateIterator(StateIteratorData *data) const { + data->base = nullptr; + data->nstates = nstates_; + } + + // Provide information needed for the generic arc iterator. + void InitArcIterator(StateId s, ArcIteratorData *data) const { + data->base = nullptr; + data->arcs = arcs_ + states_[s].pos; + data->narcs = states_[s].narcs; + data->ref_count = nullptr; + } + + private: + // Used to find narcs_ and nstates_ in Write. + friend class ConstFst; + + // States implemented by array *states_ below, arcs by (single) *arcs_. + struct ConstState { + Weight weight; // Final weight. + Unsigned pos; // Start of state's arcs in *arcs_. + Unsigned narcs; // Number of arcs (per state). + Unsigned niepsilons; // Number of input epsilons. + Unsigned noepsilons; // Number of output epsilons. + + ConstState() : weight(Weight::Zero()) {} + }; + + // Properties always true of this FST class. + static constexpr uint64 kStaticProperties = kExpanded; + // Current unaligned file format version. The unaligned version was added and + // made the default since the aligned version does not work on pipes. + static constexpr int kFileVersion = 2; + // Current aligned file format version. + static constexpr int kAlignedFileVersion = 1; + // Minimum file format version supported. + static constexpr int kMinFileVersion = 1; + + std::unique_ptr states_region_; // Mapped file for states. + std::unique_ptr arcs_region_; // Mapped file for arcs. + ConstState *states_; // States representation. + Arc *arcs_; // Arcs representation. + size_t narcs_; // Number of arcs. + StateId nstates_; // Number of states. + StateId start_; // Initial state. + + ConstFstImpl(const ConstFstImpl &) = delete; + ConstFstImpl &operator=(const ConstFstImpl &) = delete; +}; + +template +constexpr uint64 ConstFstImpl::kStaticProperties; + +template +constexpr int ConstFstImpl::kFileVersion; + +template +constexpr int ConstFstImpl::kAlignedFileVersion; + +template +constexpr int ConstFstImpl::kMinFileVersion; + +template +ConstFstImpl::ConstFstImpl(const Fst &fst) + : narcs_(0), nstates_(0) { + string type = "const"; + if (sizeof(Unsigned) != sizeof(uint32)) { + type += std::to_string(CHAR_BIT * sizeof(Unsigned)); + } + SetType(type); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + start_ = fst.Start(); + // Counts states and arcs. + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + ++nstates_; + narcs_ += fst.NumArcs(siter.Value()); + } + states_region_.reset(MappedFile::Allocate(nstates_ * sizeof(*states_))); + arcs_region_.reset(MappedFile::Allocate(narcs_ * sizeof(*arcs_))); + states_ = reinterpret_cast(states_region_->mutable_data()); + arcs_ = reinterpret_cast(arcs_region_->mutable_data()); + size_t pos = 0; + for (StateId s = 0; s < nstates_; ++s) { + states_[s].weight = fst.Final(s); + states_[s].pos = pos; + states_[s].narcs = 0; + states_[s].niepsilons = 0; + states_[s].noepsilons = 0; + for (ArcIterator> aiter(fst, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + ++states_[s].narcs; + if (arc.ilabel == 0) ++states_[s].niepsilons; + if (arc.olabel == 0) ++states_[s].noepsilons; + arcs_[pos] = arc; + ++pos; + } + } + const auto props = + fst.Properties(kMutable, false) + ? fst.Properties(kCopyProperties, true) + : CheckProperties( + fst, kCopyProperties & ~kWeightedCycles & ~kUnweightedCycles, + kCopyProperties); + SetProperties(props | kStaticProperties); +} + +template +ConstFstImpl *ConstFstImpl::Read( + std::istream &strm, const FstReadOptions &opts) { + using ConstState = typename ConstFstImpl::ConstState; + std::unique_ptr> impl( + new ConstFstImpl()); + FstHeader hdr; + if (!impl->ReadHeader(strm, opts, kMinFileVersion, &hdr)) return nullptr; + impl->start_ = hdr.Start(); + impl->nstates_ = hdr.NumStates(); + impl->narcs_ = hdr.NumArcs(); + // Ensures compatibility. + if (hdr.Version() == kAlignedFileVersion) { + hdr.SetFlags(hdr.GetFlags() | FstHeader::IS_ALIGNED); + } + if ((hdr.GetFlags() & FstHeader::IS_ALIGNED) && !AlignInput(strm)) { + LOG(ERROR) << "ConstFst::Read: Alignment failed: " << opts.source; + return nullptr; + } + size_t b = impl->nstates_ * sizeof(ConstState); + impl->states_region_.reset( + MappedFile::Map(&strm, opts.mode == FstReadOptions::MAP, opts.source, b)); + if (!strm || !impl->states_region_) { + LOG(ERROR) << "ConstFst::Read: Read failed: " << opts.source; + return nullptr; + } + impl->states_ = + reinterpret_cast(impl->states_region_->mutable_data()); + if ((hdr.GetFlags() & FstHeader::IS_ALIGNED) && !AlignInput(strm)) { + LOG(ERROR) << "ConstFst::Read: Alignment failed: " << opts.source; + return nullptr; + } + b = impl->narcs_ * sizeof(Arc); + impl->arcs_region_.reset( + MappedFile::Map(&strm, opts.mode == FstReadOptions::MAP, opts.source, b)); + if (!strm || !impl->arcs_region_) { + LOG(ERROR) << "ConstFst::Read: Read failed: " << opts.source; + return nullptr; + } + impl->arcs_ = reinterpret_cast(impl->arcs_region_->mutable_data()); + return impl.release(); +} + +} // namespace internal + +// Simple concrete immutable FST. This class attaches interface to +// implementation and handles reference counting, delegating most methods to +// ImplToExpandedFst. The unsigned type U is used to represent indices into the +// arc array (default declared in fst-decl.h). +template +class ConstFst : public ImplToExpandedFst> { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + using Impl = internal::ConstFstImpl; + using ConstState = typename Impl::ConstState; + + friend class StateIterator>; + friend class ArcIterator>; + + template + void friend Cast(const F &, G *); + + ConstFst() : ImplToExpandedFst(std::make_shared()) {} + + explicit ConstFst(const Fst &fst) + : ImplToExpandedFst(std::make_shared(fst)) {} + + ConstFst(const ConstFst &fst, bool safe = false) + : ImplToExpandedFst(fst) {} + + // Gets a copy of this ConstFst. See Fst<>::Copy() for further doc. + ConstFst *Copy(bool safe = false) const override { + return new ConstFst(*this, safe); + } + + // Reads a ConstFst from an input stream, returning nullptr on error. + static ConstFst *Read(std::istream &strm, + const FstReadOptions &opts) { + auto *impl = Impl::Read(strm, opts); + return impl ? new ConstFst(std::shared_ptr(impl)) + : nullptr; + } + + // Read a ConstFst from a file; return nullptr on error; empty filename reads + // from standard input. + static ConstFst *Read(const string &filename) { + auto *impl = ImplToExpandedFst::Read(filename); + return impl ? new ConstFst(std::shared_ptr(impl)) + : nullptr; + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return WriteFst(*this, strm, opts); + } + + bool Write(const string &filename) const override { + return Fst::WriteFile(filename); + } + + template + static bool WriteFst(const FST &fst, std::ostream &strm, + const FstWriteOptions &opts); + + void InitStateIterator(StateIteratorData *data) const override { + GetImpl()->InitStateIterator(data); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetImpl()->InitArcIterator(s, data); + } + + private: + explicit ConstFst(std::shared_ptr impl) + : ImplToExpandedFst(impl) {} + + using ImplToFst>::GetImpl; + + // Uses overloading to extract the type of the argument. + static const Impl *GetImplIfConstFst(const ConstFst &const_fst) { + return const_fst.GetImpl(); + } + + // NB: this does not give privileged treatment to subtypes of ConstFst. + template + static Impl *GetImplIfConstFst(const FST &fst) { + return nullptr; + } + + ConstFst &operator=(const ConstFst &) = delete; +}; + +// Writes FST in Const format, potentially with a pass over the machine before +// writing to compute number of states and arcs. +template +template +bool ConstFst::WriteFst(const FST &fst, std::ostream &strm, + const FstWriteOptions &opts) { + const auto file_version = + opts.align ? internal::ConstFstImpl::kAlignedFileVersion + : internal::ConstFstImpl::kFileVersion; + size_t num_arcs = 0; // To silence -Wsometimes-uninitialized warnings. + size_t num_states = 0; // Ditto. + std::streamoff start_offset = 0; + bool update_header = true; + if (const auto *impl = GetImplIfConstFst(fst)) { + num_arcs = impl->narcs_; + num_states = impl->nstates_; + update_header = false; + } else if (opts.stream_write || (start_offset = strm.tellp()) == -1) { + // precompute values needed for header when we cannot seek to rewrite it. + num_arcs = 0; + num_states = 0; + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + num_arcs += fst.NumArcs(siter.Value()); + ++num_states; + } + update_header = false; + } + FstHeader hdr; + hdr.SetStart(fst.Start()); + hdr.SetNumStates(num_states); + hdr.SetNumArcs(num_arcs); + string type = "const"; + if (sizeof(Unsigned) != sizeof(uint32)) { + type += std::to_string(CHAR_BIT * sizeof(Unsigned)); + } + const auto properties = + fst.Properties(kCopyProperties, true) | + internal::ConstFstImpl::kStaticProperties; + internal::FstImpl::WriteFstHeader(fst, strm, opts, file_version, type, + properties, &hdr); + if (opts.align && !AlignOutput(strm)) { + LOG(ERROR) << "Could not align file during write after header"; + return false; + } + size_t pos = 0; + size_t states = 0; + typename ConstFst::ConstState state; + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + state.weight = fst.Final(s); + state.pos = pos; + state.narcs = fst.NumArcs(s); + state.niepsilons = fst.NumInputEpsilons(s); + state.noepsilons = fst.NumOutputEpsilons(s); + strm.write(reinterpret_cast(&state), sizeof(state)); + pos += state.narcs; + ++states; + } + hdr.SetNumStates(states); + hdr.SetNumArcs(pos); + if (opts.align && !AlignOutput(strm)) { + LOG(ERROR) << "Could not align file during write after writing states"; + } + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + for (ArcIterator aiter(fst, siter.Value()); !aiter.Done(); + aiter.Next()) { + const auto &arc = aiter.Value(); +// Google-only... +#ifdef MEMORY_SANITIZER + // arc may contain padding which has unspecified contents. Tell MSAN to + // not complain about it when writing it to a file. + ANNOTATE_MEMORY_IS_INITIALIZED(reinterpret_cast(&arc), + sizeof(arc)); +#endif + // ...Google-only + strm.write(reinterpret_cast(&arc), sizeof(arc)); + } + } + strm.flush(); + if (!strm) { + LOG(ERROR) << "ConstFst::WriteFst: write failed: " << opts.source; + return false; + } + if (update_header) { + return internal::FstImpl::UpdateFstHeader( + fst, strm, opts, file_version, type, properties, &hdr, start_offset); + } else { + if (hdr.NumStates() != num_states) { + LOG(ERROR) << "Inconsistent number of states observed during write"; + return false; + } + if (hdr.NumArcs() != num_arcs) { + LOG(ERROR) << "Inconsistent number of arcs observed during write"; + return false; + } + } + return true; +} + +// Specialization for ConstFst; see generic version in fst.h for sample usage +// (but use the ConstFst type instead). This version should inline. +template +class StateIterator> { + public: + using StateId = typename Arc::StateId; + + explicit StateIterator(const ConstFst &fst) + : nstates_(fst.GetImpl()->NumStates()), s_(0) {} + + bool Done() const { return s_ >= nstates_; } + + StateId Value() const { return s_; } + + void Next() { ++s_; } + + void Reset() { s_ = 0; } + + private: + const StateId nstates_; + StateId s_; +}; + +// Specialization for ConstFst; see generic version in fst.h for sample usage +// (but use the ConstFst type instead). This version should inline. +template +class ArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const ConstFst &fst, StateId s) + : arcs_(fst.GetImpl()->Arcs(s)), + narcs_(fst.GetImpl()->NumArcs(s)), + i_(0) {} + + bool Done() const { return i_ >= narcs_; } + + const Arc &Value() const { return arcs_[i_]; } + + void Next() { ++i_; } + + size_t Position() const { return i_; } + + void Reset() { i_ = 0; } + + void Seek(size_t a) { i_ = a; } + + constexpr uint32 Flags() const { return kArcValueFlags; } + + void SetFlags(uint32, uint32) {} + + private: + const Arc *arcs_; + size_t narcs_; + size_t i_; +}; + +// A useful alias when using StdArc. +using StdConstFst = ConstFst; + +} // namespace fst + +#endif // FST_CONST_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/determinize.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/determinize.h new file mode 100644 index 0000000..736a140 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/determinize.h @@ -0,0 +1,1093 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to determinize an FST. + +#ifndef FST_DETERMINIZE_H_ +#define FST_DETERMINIZE_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + + +namespace fst { + +// Common divisors are used in determinization to compute transition weights. +// In the simplest case, it is the same as semiring Plus, but other choices +// permit more efficient determinization when the output contains strings. + +// The default common divisor uses the semiring Plus. +template +struct DefaultCommonDivisor { + public: + using Weight = W; + + Weight operator()(const Weight &w1, const Weight &w2) const { + return Plus(w1, w2); + } +}; + +// The label common divisor for a (left) string semiring selects a single +// letter common prefix or the empty string. This is used in the +// determinization of output strings so that at most a single letter will +// appear in the output of a transtion. +template +struct LabelCommonDivisor { + public: + using Weight = StringWeight; + + Weight operator()(const Weight &w1, const Weight &w2) const { + typename Weight::Iterator iter1(w1); + typename Weight::Iterator iter2(w2); + if (!(StringWeight::Properties() & kLeftSemiring)) { + FSTERROR() << "LabelCommonDivisor: Weight needs to be left semiring"; + return Weight::NoWeight(); + } else if (w1.Size() == 0 || w2.Size() == 0) { + return Weight::One(); + } else if (w1 == Weight::Zero()) { + return Weight(iter2.Value()); + } else if (w2 == Weight::Zero()) { + return Weight(iter1.Value()); + } else if (iter1.Value() == iter2.Value()) { + return Weight(iter1.Value()); + } else { + return Weight::One(); + } + } +}; + +// The gallic common divisor uses the label common divisor on the string +// component and the common divisor on the weight component, which defaults to +// the default common divisor. +template > +class GallicCommonDivisor { + public: + using Weight = GallicWeight; + + Weight operator()(const Weight &w1, const Weight &w2) const { + return Weight(label_common_divisor_(w1.Value1(), w2.Value1()), + weight_common_divisor_(w1.Value2(), w2.Value2())); + } + + private: + LabelCommonDivisor label_common_divisor_; + CommonDivisor weight_common_divisor_; +}; + +// Specialization for general GALLIC weight. +template +class GallicCommonDivisor { + public: + using Weight = GallicWeight; + using GRWeight = GallicWeight; + using Iterator = + UnionWeightIterator>; + + Weight operator()(const Weight &w1, const Weight &w2) const { + auto weight = GRWeight::Zero(); + for (Iterator iter(w1); !iter.Done(); iter.Next()) { + weight = common_divisor_(weight, iter.Value()); + } + for (Iterator iter(w2); !iter.Done(); iter.Next()) { + weight = common_divisor_(weight, iter.Value()); + } + return weight == GRWeight::Zero() ? Weight::Zero() : Weight(weight); + } + + private: + GallicCommonDivisor common_divisor_; +}; + +namespace internal { + +// Represents an element in a subset +template +struct DeterminizeElement { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + DeterminizeElement(StateId s, Weight weight) + : state_id(s), weight(std::move(weight)) {} + + inline bool operator==(const DeterminizeElement &element) const { + return state_id == element.state_id && weight == element.weight; + } + + inline bool operator!=(const DeterminizeElement &element) const { + return !(*this == element); + } + + inline bool operator<(const DeterminizeElement &element) const { + return state_id < element.state_id; + } + + StateId state_id; // Input state ID. + Weight weight; // Residual weight. +}; + +// Represents a weighted subset and determinization filter state +template +struct DeterminizeStateTuple { + using Arc = A; + using Element = DeterminizeElement; + using Subset = std::forward_list; + + DeterminizeStateTuple() : filter_state(FilterState::NoState()) {} + + inline bool operator==( + const DeterminizeStateTuple &tuple) const { + return (tuple.filter_state == filter_state) && (tuple.subset == subset); + } + + inline bool operator!=( + const DeterminizeStateTuple &tuple) const { + return (tuple.filter_state != filter_state) || (tuple.subset != subset); + } + + Subset subset; + FilterState filter_state; +}; + +// Proto-transition for determinization. +template +struct DeterminizeArc { + using Arc = typename StateTuple::Arc; + using Label = typename Arc::Label; + using Weight = typename Arc::Weight; + + DeterminizeArc() + : label(kNoLabel), weight(Weight::Zero()), dest_tuple(nullptr) {} + + explicit DeterminizeArc(const Arc &arc) + : label(arc.ilabel), weight(Weight::Zero()), dest_tuple(new StateTuple) {} + + Label label; // Arc label. + Weight weight; // Arc weight. + StateTuple *dest_tuple; // Destination subset and filter state. +}; + +} // namespace internal + +// Determinization filters are used to compute destination state tuples based +// on the source tuple, transition, and destination element or on similar +// super-final transition information. The filter operates on a map between a +// label and the corresponding destination state tuples. It must define the map +// type LabelMap. The default filter is used for weighted determinization. +// A determinize filter for implementing weighted determinization. +template +class DefaultDeterminizeFilter { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FilterState = CharFilterState; + using Element = internal::DeterminizeElement; + using StateTuple = internal::DeterminizeStateTuple; + using LabelMap = std::map>; + + // This is needed e.g. to go into the gallic domain for transducers. + template + struct rebind { + using Other = DefaultDeterminizeFilter; + }; + + explicit DefaultDeterminizeFilter(const Fst &fst) : fst_(fst.Copy()) {} + + // This is needed (e.g.) to go into the gallic domain for transducers. + // Ownership of the templated filter argument is given to this class. + template + DefaultDeterminizeFilter(const Fst &fst, Filter *filter) + : fst_(fst.Copy()) { + delete filter; + } + + // Copy constructor; the FST can be passed if it has been deep-copied. + DefaultDeterminizeFilter(const DefaultDeterminizeFilter &filter, + const Fst *fst = nullptr) + : fst_(fst ? fst->Copy() : filter.fst_->Copy()) {} + + FilterState Start() const { return FilterState(0); } + + // Does no work. + void SetState(StateId s, const StateTuple &tuple) {} + + // Filters transition, possibly modifying label map. Returns true if arc is + // added to the label map. + bool FilterArc(const Arc &arc, const Element &src_element, + Element &&dest_element, LabelMap *label_map) const { + // Adds element to unique state tuple for arc label. + auto &det_arc = (*label_map)[arc.ilabel]; + if (det_arc.label == kNoLabel) { + det_arc = internal::DeterminizeArc(arc); + det_arc.dest_tuple->filter_state = FilterState(0); + } + det_arc.dest_tuple->subset.push_front(std::move(dest_element)); + return true; + } + + // Filters super-final transition, returning new final weight. + Weight FilterFinal(Weight weight, const Element &element) { return weight; } + + static uint64 Properties(uint64 props) { return props; } + + private: + std::unique_ptr> fst_; +}; + +// Determinization state table interface: +// +// template +// class DeterminizeStateTable { +// public: +// using StateId = typename Arc::StateId; +// using StateTuple = internal::DeterminizeStateTuple; +// +// // Required sub-class. This is needed (e.g.) to go into the gallic domain. +// template +// struct rebind { +// using Other = DeterminizeStateTable; +// } +// +// // Required constuctor. +// DeterminizeStateTable(); +// +// // Required copy constructor that does not copy state. +// DeterminizeStateTable(const DeterminizeStateTable +// &table); +// +// // Looks up state ID by state tuple; if it doesn't exist, then adds it. +// // FindState takes ownership of the state tuple argument so that it +// // doesn't have to copy it if it creates a new state. +// StateId FindState(StateTuple *tuple); +// +// // Looks up state tuple by ID. +// const StateTuple *Tuple(StateId id) const; +// }; + +// The default determinization state table based on the compact hash bi-table. +template +class DefaultDeterminizeStateTable { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using StateTuple = internal::DeterminizeStateTuple; + using Element = typename StateTuple::Element; + using Subset = typename StateTuple::Subset; + + template + struct rebind { + using Other = DefaultDeterminizeStateTable; + }; + + explicit DefaultDeterminizeStateTable(size_t table_size = 0) + : table_size_(table_size), tuples_(table_size_) {} + + DefaultDeterminizeStateTable( + const DefaultDeterminizeStateTable &table) + : table_size_(table.table_size_), tuples_(table_size_) {} + + ~DefaultDeterminizeStateTable() { + for (StateId s = 0; s < tuples_.Size(); ++s) delete tuples_.FindEntry(s); + } + + // Finds the state corresponding to a state tuple. Only creates a new state if + // the tuple is not found. FindState takes ownership of the tuple argument so + // that it doesn't have to copy it if it creates a new state. + StateId FindState(StateTuple *tuple) { + const StateId ns = tuples_.Size(); + const auto s = tuples_.FindId(tuple); + if (s != ns) delete tuple; // Tuple found. + return s; + } + + const StateTuple *Tuple(StateId s) { return tuples_.FindEntry(s); } + + private: + // Comparison object for StateTuples. + class StateTupleEqual { + public: + bool operator()(const StateTuple *tuple1, const StateTuple *tuple2) const { + return *tuple1 == *tuple2; + } + }; + + // Hash function for StateTuples. + class StateTupleKey { + public: + size_t operator()(const StateTuple *tuple) const { + size_t h = tuple->filter_state.Hash(); + for (auto it = tuple->subset.begin(); it != tuple->subset.end(); ++it) { + const size_t h1 = it->state_id; + static constexpr auto lshift = 5; + static constexpr auto rshift = CHAR_BIT * sizeof(size_t) - 5; + h ^= h << 1 ^ h1 << lshift ^ h1 >> rshift ^ it->weight.Hash(); + } + return h; + } + }; + + size_t table_size_; + CompactHashBiTable + tuples_; + + DefaultDeterminizeStateTable &operator=( + const DefaultDeterminizeStateTable &) = delete; +}; + +// Determinization type. +enum DeterminizeType { + // Input transducer is known to be functional (or error). + DETERMINIZE_FUNCTIONAL, // Input transducer is functional (error if not). + // Input transducer is not known to be functional. + DETERMINIZE_NONFUNCTIONAL, + // Input transducer is not known to be functional but only keep the min of + // of ambiguous outputs. + DETERMINIZE_DISAMBIGUATE +}; + +// Options for finite-state transducer determinization templated on the arc +// type, common divisor, the determinization filter and the state table. +// DeterminizeFst takes ownership of the determinization filter and state table, +// if provided. +template , + class Filter = DefaultDeterminizeFilter, + class StateTable = + DefaultDeterminizeStateTable> +struct DeterminizeFstOptions : public CacheOptions { + using Label = typename Arc::Label; + + float delta; // Quantization delta for subset weights. + Label subsequential_label; // Label used for residual final output + // when producing subsequential transducers. + DeterminizeType type; // Determinization type. + bool increment_subsequential_label; // When creating several subsequential + // arcs at a given state, make their + // label distinct by incrementing. + Filter *filter; // Determinization filter; + // DeterminizeFst takes ownership. + StateTable *state_table; // Determinization state table; + // DeterminizeFst takes ownership. + + explicit DeterminizeFstOptions(const CacheOptions &opts, float delta = kDelta, + Label subsequential_label = 0, + DeterminizeType type = DETERMINIZE_FUNCTIONAL, + bool increment_subsequential_label = false, + Filter *filter = nullptr, + StateTable *state_table = nullptr) + : CacheOptions(opts), + delta(delta), + subsequential_label(subsequential_label), + type(type), + increment_subsequential_label(increment_subsequential_label), + filter(filter), + state_table(state_table) {} + + explicit DeterminizeFstOptions(float delta = kDelta, + Label subsequential_label = 0, + DeterminizeType type = DETERMINIZE_FUNCTIONAL, + bool increment_subsequential_label = false, + Filter *filter = nullptr, + StateTable *state_table = nullptr) + : delta(delta), + subsequential_label(subsequential_label), + type(type), + increment_subsequential_label(increment_subsequential_label), + filter(filter), + state_table(state_table) {} +}; + +namespace internal { + +// Implementation of delayed DeterminizeFst. This base class is +// common to the variants that implement acceptor and transducer +// determinization. +template +class DeterminizeFstImplBase : public CacheImpl { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = DefaultCacheStore; + using State = typename Store::State; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::Properties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheBaseImpl>::HasStart; + using CacheBaseImpl>::HasFinal; + using CacheBaseImpl>::HasArcs; + using CacheBaseImpl>::SetFinal; + using CacheBaseImpl>::SetStart; + + template + DeterminizeFstImplBase( + const Fst &fst, + const DeterminizeFstOptions &opts) + : CacheImpl(opts), fst_(fst.Copy()) { + SetType("determinize"); + const auto iprops = fst.Properties(kFstProperties, false); + const auto dprops = + DeterminizeProperties(iprops, opts.subsequential_label != 0, + opts.type == DETERMINIZE_NONFUNCTIONAL + ? opts.increment_subsequential_label + : true); + SetProperties(Filter::Properties(dprops), kCopyProperties); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + } + + DeterminizeFstImplBase(const DeterminizeFstImplBase &impl) + : CacheImpl(impl), fst_(impl.fst_->Copy(true)) { + SetType("determinize"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + virtual DeterminizeFstImplBase *Copy() const = 0; + + StateId Start() { + if (!HasStart()) { + const auto start = ComputeStart(); + if (start != kNoStateId) SetStart(start); + } + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) SetFinal(s, ComputeFinal(s)); + return CacheImpl::Final(s); + } + + virtual void Expand(StateId s) = 0; + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + virtual StateId ComputeStart() = 0; + + virtual Weight ComputeFinal(StateId s) = 0; + + const Fst &GetFst() const { return *fst_; } + + private: + std::unique_ptr> fst_; // Input FST. +}; + +// Implementation of delayed determinization for weighted acceptors. +template +class DeterminizeFsaImpl : public DeterminizeFstImplBase { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FilterState = typename Filter::FilterState; + using StateTuple = internal::DeterminizeStateTuple; + using Element = typename StateTuple::Element; + using Subset = typename StateTuple::Subset; + using LabelMap = typename Filter::LabelMap; + + using FstImpl::SetProperties; + using DeterminizeFstImplBase::GetFst; + using DeterminizeFstImplBase::SetArcs; + + DeterminizeFsaImpl( + const Fst &fst, const std::vector *in_dist, + std::vector *out_dist, + const DeterminizeFstOptions &opts) + : DeterminizeFstImplBase(fst, opts), + delta_(opts.delta), + in_dist_(in_dist), + out_dist_(out_dist), + filter_(opts.filter ? opts.filter : new Filter(fst)), + state_table_(opts.state_table ? opts.state_table : new StateTable()) { + if (!fst.Properties(kAcceptor, true)) { + FSTERROR() << "DeterminizeFst: Argument not an acceptor"; + SetProperties(kError, kError); + } + if (!(Weight::Properties() & kLeftSemiring)) { + FSTERROR() << "DeterminizeFst: Weight must be left distributive: " + << Weight::Type(); + SetProperties(kError, kError); + } + if (out_dist_) out_dist_->clear(); + } + + DeterminizeFsaImpl( + const DeterminizeFsaImpl &impl) + : DeterminizeFstImplBase(impl), + delta_(impl.delta_), + in_dist_(nullptr), + out_dist_(nullptr), + filter_(new Filter(*impl.filter_, &GetFst())), + state_table_(new StateTable(*impl.state_table_)) { + if (impl.out_dist_) { + FSTERROR() << "DeterminizeFsaImpl: Cannot copy with out_dist vector"; + SetProperties(kError, kError); + } + } + + DeterminizeFsaImpl *Copy() + const override { + return new DeterminizeFsaImpl( + *this); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && (GetFst().Properties(kError, false))) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + StateId ComputeStart() override { + const auto s = GetFst().Start(); + if (s == kNoStateId) return kNoStateId; + auto *tuple = new StateTuple; + tuple->subset.emplace_front(s, Weight::One()); + tuple->filter_state = filter_->Start(); + return FindState(tuple); + } + + Weight ComputeFinal(StateId s) override { + const auto *tuple = state_table_->Tuple(s); + filter_->SetState(s, *tuple); + auto final_weight = Weight::Zero(); + for (auto it = tuple->subset.begin(); it != tuple->subset.end(); ++it) { + const auto &element = *it; + final_weight = + Plus(final_weight, + Times(element.weight, GetFst().Final(element.state_id))); + final_weight = filter_->FilterFinal(final_weight, element); + if (!final_weight.Member()) SetProperties(kError, kError); + } + return final_weight; + } + + StateId FindState(StateTuple *tuple) { + const auto s = state_table_->FindState(tuple); + if (in_dist_ && out_dist_->size() <= s) { + out_dist_->push_back(ComputeDistance(tuple->subset)); + } + return s; + } + + // Computes distance from a state to the final states in the DFA given the + // distances in the NFA. + Weight ComputeDistance(const Subset &subset) { + auto outd = Weight::Zero(); + for (auto it = subset.begin(); it != subset.end(); ++it) { + const auto &element = *it; + const auto ind = + (element.state_id < in_dist_->size() ? (*in_dist_)[element.state_id] + : Weight::Zero()); + outd = Plus(outd, Times(element.weight, ind)); + } + return outd; + } + + // Computes the outgoing transitions from a state, creating new destination + // states as needed. + void Expand(StateId s) override { + LabelMap label_map; + GetLabelMap(s, &label_map); + for (auto it = label_map.begin(); it != label_map.end(); ++it) { + AddArc(s, std::move(it->second)); + } + SetArcs(s); + } + + private: + using DetArc = internal::DeterminizeArc; + + // Constructs proto-determinization transition, including destination subset, + // per label. + void GetLabelMap(StateId s, LabelMap *label_map) { + const auto *src_tuple = state_table_->Tuple(s); + filter_->SetState(s, *src_tuple); + for (auto it = src_tuple->subset.begin(); it != src_tuple->subset.end(); + ++it) { + const auto &src_element = *it; + for (ArcIterator> aiter(GetFst(), src_element.state_id); + !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + Element dest_element(arc.nextstate, + Times(src_element.weight, arc.weight)); + filter_->FilterArc(arc, src_element, std::move(dest_element), + label_map); + } + } + for (auto it = label_map->begin(); it != label_map->end(); ++it) { + NormArc(&it->second); + } + } + + // Sorts subsets and removes duplicate elements, normalizing transition and + // subset weights. + void NormArc(DetArc *det_arc) { + auto *dest_tuple = det_arc->dest_tuple; + dest_tuple->subset.sort(); + auto piter = dest_tuple->subset.begin(); + for (auto diter = dest_tuple->subset.begin(); + diter != dest_tuple->subset.end();) { + auto &dest_element = *diter; + auto &prev_element = *piter; + // Computes arc weight. + det_arc->weight = common_divisor_(det_arc->weight, dest_element.weight); + if (piter != diter && dest_element.state_id == prev_element.state_id) { + // Found duplicate state: sums state weight and deletes duplicate. + prev_element.weight = Plus(prev_element.weight, dest_element.weight); + if (!prev_element.weight.Member()) SetProperties(kError, kError); + ++diter; + dest_tuple->subset.erase_after(piter); + } else { + piter = diter; + ++diter; + } + } + // Divides out label weight from destination subset elements, quantizing to + // ensure comparisons are effective. + for (auto diter = dest_tuple->subset.begin(); + diter != dest_tuple->subset.end(); ++diter) { + auto &dest_element = *diter; + dest_element.weight = + Divide(dest_element.weight, det_arc->weight, DIVIDE_LEFT); + dest_element.weight = dest_element.weight.Quantize(delta_); + } + } + + // Adds an arc from state S to the destination state associated with state + // tuple in det_arc as created by GetLabelMap. + void AddArc(StateId s, DetArc &&det_arc) { + CacheImpl::EmplaceArc( + s, det_arc.label, det_arc.label, std::move(det_arc.weight), + FindState(det_arc.dest_tuple)); + } + + float delta_; // Quantization delta for weights. + const std::vector *in_dist_; // Distance to final NFA states. + std::vector *out_dist_; // Distance to final DFA states. + + // FIXME(kbg): Ought to be static const? + CommonDivisor common_divisor_; + std::unique_ptr filter_; + std::unique_ptr state_table_; +}; + +// Implementation of delayed determinization for transducers. Transducer +// determinization is implemented by mapping the input to the Gallic semiring as +// an acceptor whose weights contain the output strings and using acceptor +// determinization above to determinize that acceptor. +template +class DeterminizeFstImpl : public DeterminizeFstImplBase { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using ToMapper = ToGallicMapper; + using ToArc = typename ToMapper::ToArc; + using ToFst = ArcMapFst; + using FromMapper = FromGallicMapper; + using FromFst = ArcMapFst; + + using ToCommonDivisor = GallicCommonDivisor; + using ToFilter = typename Filter::template rebind::Other; + using ToFilterState = typename ToFilter::FilterState; + using ToStateTable = + typename StateTable::template rebind::Other; + using FactorIterator = GallicFactor; + + using FstImpl::SetProperties; + using DeterminizeFstImplBase::GetFst; + using CacheBaseImpl>::GetCacheGc; + using CacheBaseImpl>::GetCacheLimit; + + DeterminizeFstImpl( + const Fst &fst, + const DeterminizeFstOptions &opts) + : DeterminizeFstImplBase(fst, opts), + delta_(opts.delta), + subsequential_label_(opts.subsequential_label), + increment_subsequential_label_(opts.increment_subsequential_label) { + if (opts.state_table) { + FSTERROR() << "DeterminizeFst: " + << "A state table can not be passed with transducer input"; + SetProperties(kError, kError); + return; + } + Init(GetFst(), opts.filter); + } + + DeterminizeFstImpl( + const DeterminizeFstImpl &impl) + : DeterminizeFstImplBase(impl), + delta_(impl.delta_), + subsequential_label_(impl.subsequential_label_), + increment_subsequential_label_(impl.increment_subsequential_label_) { + Init(GetFst(), nullptr); + } + + DeterminizeFstImpl *Copy() + const override { + return new DeterminizeFstImpl( + *this); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && (GetFst().Properties(kError, false) || + from_fst_->Properties(kError, false))) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + StateId ComputeStart() override { return from_fst_->Start(); } + + Weight ComputeFinal(StateId s) override { return from_fst_->Final(s); } + + void Expand(StateId s) override { + for (ArcIterator aiter(*from_fst_, s); !aiter.Done(); + aiter.Next()) { + CacheImpl::PushArc(s, aiter.Value()); + } + CacheImpl::SetArcs(s); + } + + private: + // Initialization of transducer determinization implementation, which is + // defined after DeterminizeFst since it calls it. + void Init(const Fst &fst, Filter *filter); + + float delta_; + Label subsequential_label_; + bool increment_subsequential_label_; + std::unique_ptr from_fst_; +}; + +} // namespace internal + +// Determinizes a weighted transducer. This version is a delayed +// FST. The result will be an equivalent FST that has the property +// that no state has two transitions with the same input label. +// For this algorithm, epsilon transitions are treated as regular +// symbols (cf. RmEpsilon). +// +// The transducer must be functional. The weights must be (weakly) left +// divisible (valid for TropicalWeight and LogWeight for instance) and be +// zero-sum-free if for all a, b: (Plus(a, b) == 0) => a = b = 0. +// +// Complexity: +// +// Determinizable: exponential (polynomial in the size of the output). +// Non-determinizable: does not terminate. +// +// The determinizable automata include all unweighted and all acyclic input. +// +// For more information, see: +// +// Mohri, M. 1997. Finite-state transducers in language and speech processing. +// Computational Linguistics 23(2): 269-311. +// +// This class attaches interface to implementation and handles reference +// counting, delegating most methods to ImplToFst. +template +class DeterminizeFst : public ImplToFst> { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = DefaultCacheStore; + using State = typename Store::State; + using Impl = internal::DeterminizeFstImplBase; + + friend class ArcIterator>; + friend class StateIterator>; + + template + friend class DeterminizeFstImpl; + + explicit DeterminizeFst(const Fst &fst) + : ImplToFst(CreateImpl(fst)) {} + + template + DeterminizeFst( + const Fst &fst, + const DeterminizeFstOptions + &opts = + DeterminizeFstOptions()) + : ImplToFst(CreateImpl(fst, opts)) {} + + // This acceptor-only version additionally computes the distance to final + // states in the output if provided with those distances for the input; this + // is useful for e.g., computing the k-shortest unique paths. + template + DeterminizeFst( + const Fst &fst, const std::vector *in_dist, + std::vector *out_dist, + const DeterminizeFstOptions + &opts = + DeterminizeFstOptions()) + : ImplToFst( + std::make_shared>( + fst, in_dist, out_dist, opts)) { + if (!fst.Properties(kAcceptor, true)) { + FSTERROR() << "DeterminizeFst: " + << "Distance to final states computed for acceptors only"; + GetMutableImpl()->SetProperties(kError, kError); + } + } + + // See Fst<>::Copy() for doc. + DeterminizeFst(const DeterminizeFst &fst, bool safe = false) + : ImplToFst(safe ? std::shared_ptr(fst.GetImpl()->Copy()) + : fst.GetSharedImpl()) {} + + // Get a copy of this DeterminizeFst. See Fst<>::Copy() for further doc. + DeterminizeFst *Copy(bool safe = false) const override { + return new DeterminizeFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + static std::shared_ptr CreateImpl(const Fst &fst) { + using D = DefaultCommonDivisor; + using F = DefaultDeterminizeFilter; + using T = DefaultDeterminizeStateTable; + const DeterminizeFstOptions opts; + return CreateImpl(fst, opts); + } + + template + static std::shared_ptr CreateImpl( + const Fst &fst, + const DeterminizeFstOptions + &opts) { + if (fst.Properties(kAcceptor, true)) { + // Calls implementation for acceptors. + return std::make_shared< + internal::DeterminizeFsaImpl>( + fst, nullptr, nullptr, opts); + } else if (opts.type == DETERMINIZE_DISAMBIGUATE) { + auto rv = std::make_shared>(fst, opts); + if (!(Weight::Properties() & kPath)) { + FSTERROR() << "DeterminizeFst: Weight needs to have the " + << "path property to disambiguate output: " + << Weight::Type(); + rv->SetProperties(kError, kError); + } + // Calls disambiguating implementation for non-functional transducers. + return rv; + } else if (opts.type == DETERMINIZE_FUNCTIONAL) { + // Calls implementation for functional transducers. + return std::make_shared>(fst, opts); + } else { // opts.type == DETERMINIZE_NONFUNCTIONAL + // Calls implementation for non functional transducers; + return std::make_shared>(fst, opts); + } + } + + DeterminizeFst &operator=(const DeterminizeFst &) = delete; +}; + +namespace internal { + +// Initialization of transducer determinization implementation, which is defined +// after DeterminizeFst since it calls it. +template +void DeterminizeFstImpl::Init(const Fst &fst, Filter *filter) { + // Mapper to an acceptor. + const ToFst to_fst(fst, ToMapper()); + auto *to_filter = filter ? new ToFilter(to_fst, filter) : nullptr; + // This recursive call terminates since it is to a (non-recursive) + // different constructor. + const CacheOptions copts(GetCacheGc(), GetCacheLimit()); + const DeterminizeFstOptions + dopts(copts, delta_, 0, DETERMINIZE_FUNCTIONAL, false, to_filter); + // Uses acceptor-only constructor to avoid template recursion. + const DeterminizeFst det_fsa(to_fst, nullptr, nullptr, dopts); + // Mapper back to transducer. + const FactorWeightOptions fopts( + CacheOptions(true, 0), delta_, kFactorFinalWeights, subsequential_label_, + subsequential_label_, increment_subsequential_label_, + increment_subsequential_label_); + const FactorWeightFst factored_fst(det_fsa, fopts); + from_fst_.reset(new FromFst(factored_fst, FromMapper(subsequential_label_))); +} + +} // namespace internal + +// Specialization for DeterminizeFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const DeterminizeFst &fst) + : CacheStateIterator>(fst, fst.GetMutableImpl()) {} +}; + +// Specialization for DeterminizeFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const DeterminizeFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void DeterminizeFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Useful aliases when using StdArc. +using StdDeterminizeFst = DeterminizeFst; + +template +struct DeterminizeOptions { + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + float delta; // Quantization delta for subset weights. + Weight weight_threshold; // Pruning weight threshold. + StateId state_threshold; // Pruning state threshold. + Label subsequential_label; // Label used for residual final output. + DeterminizeType type; + bool increment_subsequential_label; // When creating several subsequential + // arcs at a given state, make their + // label distinct by incrementation? + + explicit DeterminizeOptions(float delta = kDelta, + Weight weight_threshold = Weight::Zero(), + StateId state_threshold = kNoStateId, + Label subsequential_label = 0, + DeterminizeType type = DETERMINIZE_FUNCTIONAL, + bool increment_subsequential_label = false) + : delta(delta), + weight_threshold(std::move(weight_threshold)), + state_threshold(state_threshold), + subsequential_label(subsequential_label), + type(type), + increment_subsequential_label(increment_subsequential_label) {} +}; + +// Determinizes a weighted transducer. This version writes the +// determinized Fst to an output MutableFst. The result will be an +// equivalent FST that has the property that no state has two +// transitions with the same input label. For this algorithm, epsilon +// transitions are treated as regular symbols (cf. RmEpsilon). +// +// The transducer must be functional. The weights must be (weakly) +// left divisible (valid for TropicalWeight and LogWeight). +// +// Complexity: +// +// Determinizable: exponential (polynomial in the size of the output) +// Non-determinizable: does not terminate +// +// The determinizable automata include all unweighted and all acyclic input. +template +void Determinize( + const Fst &ifst, MutableFst *ofst, + const DeterminizeOptions &opts = DeterminizeOptions()) { + using Weight = typename Arc::Weight; + DeterminizeFstOptions nopts; + nopts.delta = opts.delta; + nopts.subsequential_label = opts.subsequential_label; + nopts.type = opts.type; + nopts.increment_subsequential_label = opts.increment_subsequential_label; + nopts.gc_limit = 0; // Caches only the last state for fastest copy. + if (opts.weight_threshold != Weight::Zero() || + opts.state_threshold != kNoStateId) { + if (ifst.Properties(kAcceptor, false)) { + std::vector idistance; + std::vector odistance; + ShortestDistance(ifst, &idistance, true); + DeterminizeFst dfst(ifst, &idistance, &odistance, nopts); + PruneOptions> popts( + opts.weight_threshold, opts.state_threshold, AnyArcFilter(), + &odistance); + Prune(dfst, ofst, popts); + } else { + *ofst = DeterminizeFst(ifst, nopts); + Prune(ofst, opts.weight_threshold, opts.state_threshold); + } + } else { + *ofst = DeterminizeFst(ifst, nopts); + } +} + +} // namespace fst + +#endif // FST_DETERMINIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/dfs-visit.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/dfs-visit.h new file mode 100644 index 0000000..a7b18a6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/dfs-visit.h @@ -0,0 +1,202 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Depth-first search visitation. See visit.h for more general search queue +// disciplines. + +#ifndef FST_DFS_VISIT_H_ +#define FST_DFS_VISIT_H_ + +#include +#include + +#include +#include + + +namespace fst { + +// Visitor Interface: class determining actions taken during a depth-first +// search-style visit. If any of the boolean member functions return false, the +// DFS is aborted by first calling FinishState() on all currently grey states +// and then calling FinishVisit(). +// +// This is similar to the more general visitor interface in visit.h, except +// that FinishState returns additional information appropriate only for a DFS +// and some methods names here are better suited to a DFS. +// +// template +// class Visitor { +// public: +// using StateId = typename Arc::StateId; +// +// Visitor(T *return_data); +// +// // Invoked before DFS visit. +// void InitVisit(const Fst &fst); +// +// // Invoked when state discovered (2nd arg is DFS tree root). +// bool InitState(StateId s, StateId root); +// +// // Invoked when tree arc to white/undiscovered state examined. +// bool TreeArc(StateId s, const Arc &arc); +// +// // Invoked when back arc to grey/unfinished state examined. +// bool BackArc(StateId s, const Arc &arc); +// +// // Invoked when forward or cross arc to black/finished state examined. +// bool ForwardOrCrossArc(StateId s, const Arc &arc); +// +// // Invoked when state finished ('s' is tree root, 'parent' is kNoStateId, +// // and 'arc' is nullptr). +// void FinishState(StateId s, StateId parent, const Arc *arc); +// +// // Invoked after DFS visit. +// void FinishVisit(); +// }; + +namespace internal { + +// An FST state's DFS stack state. +template +struct DfsState { + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + + DfsState(const FST &fst, StateId s) : state_id(s), arc_iter(fst, s) {} + + void *operator new(size_t size, MemoryPool> *pool) { + return pool->Allocate(); + } + + static void Destroy(DfsState *dfs_state, + MemoryPool> *pool) { + if (dfs_state) { + dfs_state->~DfsState(); + pool->Free(dfs_state); + } + } + + StateId state_id; // FST state. + ArcIterator arc_iter; // The corresponding arcs. +}; + +} // namespace internal + +// Performs depth-first visitation. Visitor class argument determines actions +// and contains any return data. ArcFilter determines arcs that are considered. +// If 'access_only' is true, performs visitation only to states accessible from +// the initial state. +// +// Note this is similar to Visit() in visit.h called with a LIFO queue, except +// this version has a Visitor class specialized and augmented for a DFS. +template +void DfsVisit(const FST &fst, Visitor *visitor, ArcFilter filter, + bool access_only = false) { + visitor->InitVisit(fst); + const auto start = fst.Start(); + if (start == kNoStateId) { + visitor->FinishVisit(); + return; + } + // An FST state's DFS status + static constexpr uint8 kDfsWhite = 0; // Undiscovered. + static constexpr uint8 kDfsGrey = 1; // Discovered but unfinished. + static constexpr uint8 kDfsBlack = 2; // Finished. + std::vector state_color; + std::stack *> state_stack; // DFS execution stack. + MemoryPool> state_pool; // Pool for DFSStates. + auto nstates = start + 1; // Number of known states in general case. + bool expanded = false; + if (fst.Properties(kExpanded, false)) { // Tests if expanded case, then + nstates = CountStates(fst); // uses ExpandedFst::NumStates(). + expanded = true; + } + state_color.resize(nstates, kDfsWhite); + StateIterator siter(fst); + // Continue DFS while true. + bool dfs = true; + // Iterate over trees in DFS forest. + for (auto root = start; dfs && root < nstates;) { + state_color[root] = kDfsGrey; + state_stack.push(new (&state_pool) internal::DfsState(fst, root)); + dfs = visitor->InitState(root, root); + while (!state_stack.empty()) { + auto *dfs_state = state_stack.top(); + const auto s = dfs_state->state_id; + if (s >= static_cast(state_color.size())) { + nstates = s + 1; + state_color.resize(nstates, kDfsWhite); + } + ArcIterator &aiter = dfs_state->arc_iter; + if (!dfs || aiter.Done()) { + state_color[s] = kDfsBlack; + internal::DfsState::Destroy(dfs_state, &state_pool); + state_stack.pop(); + if (!state_stack.empty()) { + auto *parent_state = state_stack.top(); + auto &piter = parent_state->arc_iter; + visitor->FinishState(s, parent_state->state_id, &piter.Value()); + piter.Next(); + } else { + visitor->FinishState(s, kNoStateId, nullptr); + } + continue; + } + const auto &arc = aiter.Value(); + if (arc.nextstate >= state_color.size()) { + nstates = arc.nextstate + 1; + state_color.resize(nstates, kDfsWhite); + } + if (!filter(arc)) { + aiter.Next(); + continue; + } + const auto next_color = state_color[arc.nextstate]; + switch (next_color) { + default: + case kDfsWhite: + dfs = visitor->TreeArc(s, arc); + if (!dfs) break; + state_color[arc.nextstate] = kDfsGrey; + state_stack.push(new (&state_pool) + internal::DfsState(fst, arc.nextstate)); + dfs = visitor->InitState(arc.nextstate, root); + break; + case kDfsGrey: + dfs = visitor->BackArc(s, arc); + aiter.Next(); + break; + case kDfsBlack: + dfs = visitor->ForwardOrCrossArc(s, arc); + aiter.Next(); + break; + } + } + if (access_only) break; + // Finds next tree root. + for (root = root == start ? 0 : root + 1; + root < nstates && state_color[root] != kDfsWhite; ++root) { + } + // Checks for a state beyond the largest known state. + if (!expanded && root == nstates) { + for (; !siter.Done(); siter.Next()) { + if (siter.Value() == nstates) { + ++nstates; + state_color.push_back(kDfsWhite); + break; + } + } + } + } + visitor->FinishVisit(); +} + +template +void DfsVisit(const Fst &fst, Visitor *visitor) { + DfsVisit(fst, visitor, AnyArcFilter()); +} + +} // namespace fst + +#endif // FST_DFS_VISIT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/difference.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/difference.h new file mode 100644 index 0000000..f073b0e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/difference.h @@ -0,0 +1,205 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to compute the difference between two FSAs. + +#ifndef FST_DIFFERENCE_H_ +#define FST_DIFFERENCE_H_ + +#include + + +#include +#include +#include + + +namespace fst { + +template >, + class Filter = SequenceComposeFilter, + class StateTable = + GenericComposeStateTable> +struct DifferenceFstOptions + : public ComposeFstOptions { + explicit DifferenceFstOptions(const CacheOptions &opts = CacheOptions(), + M *matcher1 = nullptr, M *matcher2 = nullptr, + Filter *filter = nullptr, + StateTable *state_table = nullptr) + : ComposeFstOptions(opts, matcher1, matcher2, + filter, state_table) {} +}; + +// Computes the difference between two FSAs. This version is a delayed FST. +// Only strings that are in the first automaton but not in second are retained +// in the result. +// +// The first argument must be an acceptor; the second argument must be an +// unweighted, epsilon-free, deterministic acceptor. One of the arguments must +// be label-sorted. +// +// Complexity: same as ComposeFst. +// +// Caveats: same as ComposeFst. +template +class DifferenceFst : public ComposeFst { + public: + using Arc = A; + using Weight = typename Arc::Weight; + using StateId = typename Arc::StateId; + + using ComposeFst::CreateBase1; + + // A - B = A ^ B'. + DifferenceFst(const Fst &fst1, const Fst &fst2, + const CacheOptions &opts = CacheOptions()) + : ComposeFst(CreateDifferenceImplWithCacheOpts(fst1, fst2, opts)) { + if (!fst1.Properties(kAcceptor, true)) { + FSTERROR() << "DifferenceFst: 1st argument not an acceptor"; + GetImpl()->SetProperties(kError, kError); + } + } + + template + DifferenceFst( + const Fst &fst1, const Fst &fst2, + const DifferenceFstOptions &opts) + : ComposeFst( + CreateDifferenceImplWithDifferenceOpts(fst1, fst2, opts)) { + if (!fst1.Properties(kAcceptor, true)) { + FSTERROR() << "DifferenceFst: 1st argument not an acceptor"; + GetImpl()->SetProperties(kError, kError); + } + } + + // See Fst<>::Copy() for doc. + DifferenceFst(const DifferenceFst &fst, bool safe = false) + : ComposeFst(fst, safe) {} + + // Get a copy of this DifferenceFst. See Fst<>::Copy() for further doc. + DifferenceFst *Copy(bool safe = false) const override { + return new DifferenceFst(*this, safe); + } + + private: + using Impl = internal::ComposeFstImplBase; + using ImplToFst::GetImpl; + + static std::shared_ptr CreateDifferenceImplWithCacheOpts( + const Fst &fst1, const Fst &fst2, const CacheOptions &opts) { + using RM = RhoMatcher>>; + ComplementFst cfst(fst2); + ComposeFstOptions copts( + CacheOptions(), new RM(fst1, MATCH_NONE), + new RM(cfst, MATCH_INPUT, ComplementFst::kRhoLabel)); + return CreateBase1(fst1, cfst, copts); + } + + template + static std::shared_ptr CreateDifferenceImplWithDifferenceOpts( + const Fst &fst1, const Fst &fst2, + const DifferenceFstOptions &opts) { + using RM = RhoMatcher; + ComplementFst cfst(fst2); + ComposeFstOptions copts(opts); + copts.matcher1 = new RM(fst1, MATCH_NONE, kNoLabel, MATCHER_REWRITE_ALWAYS, + opts.matcher1); + copts.matcher2 = new RM(cfst, MATCH_INPUT, ComplementFst::kRhoLabel, + MATCHER_REWRITE_ALWAYS, opts.matcher2); + return CreateBase1(fst1, cfst, copts); + } +}; + +// Specialization for DifferenceFst. +template +class StateIterator> + : public StateIterator> { + public: + explicit StateIterator(const DifferenceFst &fst) + : StateIterator>(fst) {} +}; + +// Specialization for DifferenceFst. +template +class ArcIterator> : public ArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const DifferenceFst &fst, StateId s) + : ArcIterator>(fst, s) {} +}; + +using DifferenceOptions = ComposeOptions; + +// Useful alias when using StdArc. +using StdDifferenceFst = DifferenceFst; + +using DifferenceOptions = ComposeOptions; + +// Computes the difference between two FSAs. This version writes the difference +// to an output MutableFst. Only strings that are in the first automaton but not +// in the second are retained in the result. +// +// The first argument must be an acceptor; the second argument must be an +// unweighted, epsilon-free, deterministic acceptor. One of the arguments must +// be label-sorted. +// +// Complexity: same as Compose. +// +// Caveats: same as Compose. +template +void Difference(const Fst &ifst1, const Fst &ifst2, + MutableFst *ofst, + const DifferenceOptions &opts = DifferenceOptions()) { + using M = Matcher>; + // In each case, we cache only the last state for fastest copy. + switch (opts.filter_type) { + case AUTO_FILTER: { + CacheOptions nopts; + nopts.gc_limit = 0; + *ofst = DifferenceFst(ifst1, ifst2, nopts); + break; + } + case SEQUENCE_FILTER: { + DifferenceFstOptions dopts; + dopts.gc_limit = 0; + *ofst = DifferenceFst(ifst1, ifst2, dopts); + break; + } + case ALT_SEQUENCE_FILTER: { + DifferenceFstOptions> dopts; + dopts.gc_limit = 0; + *ofst = DifferenceFst(ifst1, ifst2, dopts); + break; + } + case MATCH_FILTER: { + DifferenceFstOptions> dopts; + dopts.gc_limit = 0; + *ofst = DifferenceFst(ifst1, ifst2, dopts); + break; + } + case NO_MATCH_FILTER: { + DifferenceFstOptions> dopts; + dopts.gc_limit = 0; + *ofst = DifferenceFst(ifst1, ifst2, dopts); + break; + } + case NULL_FILTER: { + DifferenceFstOptions> dopts; + dopts.gc_limit = 0; + *ofst = DifferenceFst(ifst1, ifst2, dopts); + break; + } + case TRIVIAL_FILTER: { + DifferenceFstOptions> dopts; + dopts.gc_limit = 0; + *ofst = DifferenceFst(ifst1, ifst2, dopts); + break; + } + } + if (opts.connect) Connect(ofst); +} + +} // namespace fst + +#endif // FST_DIFFERENCE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/disambiguate.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/disambiguate.h new file mode 100644 index 0000000..7e3ba37 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/disambiguate.h @@ -0,0 +1,564 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to disambiguate an FST. + +#ifndef FST_DISAMBIGUATE_H_ +#define FST_DISAMBIGUATE_H_ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace fst { + +template +struct DisambiguateOptions : public DeterminizeOptions { + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit DisambiguateOptions(float delta = kDelta, + Weight weight = Weight::Zero(), + StateId n = kNoStateId, Label label = 0) + : DeterminizeOptions(delta, std::move(weight), n, label, + DETERMINIZE_FUNCTIONAL) {} +}; + +namespace internal { + +// A determinization filter based on a subset element relation. The relation is +// assumed to be reflexive and symmetric. +template +class RelationDeterminizeFilter { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FilterState = IntegerFilterState; + using StateTuple = DeterminizeStateTuple; + using Subset = typename StateTuple::Subset; + using Element = typename StateTuple::Element; + using LabelMap = std::multimap>; + + // This is needed (e.g.) to go into the gallic domain for transducers; there + // is no need to rebind the relation since its use here only depends on the + // state IDs. + template + struct rebind { + using Other = RelationDeterminizeFilter; + }; + + explicit RelationDeterminizeFilter(const Fst &fst) + : fst_(fst.Copy()), r_(new Relation()), s_(kNoStateId), head_(nullptr) {} + + // Ownership of the relation is given to this class. + RelationDeterminizeFilter(const Fst &fst, Relation *r) + : fst_(fst.Copy()), r_(r), s_(kNoStateId), head_(0) {} + + // Ownership of the relation is given to this class. + RelationDeterminizeFilter(const Fst &fst, Relation *r, + std::vector *head) + : fst_(fst.Copy()), r_(r), s_(kNoStateId), head_(head) {} + + // This is needed, e.g., to go into the gallic domain for transducers. + // Ownership of the templated filter argument is given to this class. + template + RelationDeterminizeFilter(const Fst &fst, Filter *filter) + : fst_(fst.Copy()), + r_(new Relation(filter->GetRelation())), + s_(kNoStateId), + head_(filter->GetHeadStates()) { + delete filter; + } + + // Copy constructor; the FST can be passed if it has been deep-copied. + RelationDeterminizeFilter(const RelationDeterminizeFilter &filter, + const Fst *fst = nullptr) + : fst_(fst ? fst->Copy() : filter.fst_->Copy()), + r_(new Relation(*filter.r_)), + s_(kNoStateId), + head_() {} + + FilterState Start() const { return FilterState(fst_->Start()); } + + void SetState(StateId s, const StateTuple &tuple) { + if (s_ != s) { + s_ = s; + tuple_ = &tuple; + const auto head = tuple.filter_state.GetState(); + is_final_ = fst_->Final(head) != Weight::Zero(); + if (head_) { + if (head_->size() <= s) head_->resize(s + 1, kNoStateId); + (*head_)[s] = head; + } + } + } + + // Filters transition, possibly modifying label map. Returns true if arc is + // added to label map. + bool FilterArc(const Arc &arc, const Element &src_element, + const Element &dest_element, LabelMap *label_map) const; + + // Filters super-final transition, returning new final weight. + Weight FilterFinal(const Weight final_weight, const Element &element) const { + return is_final_ ? final_weight : Weight::Zero(); + } + + static uint64 Properties(uint64 props) { + return props & ~(kIDeterministic | kODeterministic); + } + + const Relation &GetRelation() { return *r_; } + + std::vector *GetHeadStates() { return head_; } + + private: + // Pairs arc labels with state tuples with possible heads and empty subsets. + void InitLabelMap(LabelMap *label_map) const; + + std::unique_ptr> fst_; // Input FST. + std::unique_ptr r_; // Relation compatible with inv. trans. fnc. + StateId s_; // Current state. + const StateTuple *tuple_; // Current tuple. + bool is_final_; // Is the current head state final? + std::vector *head_; // Head state for a given state, + // owned by the Disambiguator. +}; + +template +bool RelationDeterminizeFilter::FilterArc( + const Arc &arc, const Element &src_element, const Element &dest_element, + LabelMap *label_map) const { + bool added = false; + if (label_map->empty()) InitLabelMap(label_map); + // Adds element to state tuple if element state is related to tuple head. + for (auto liter = label_map->lower_bound(arc.ilabel); + liter != label_map->end() && liter->first == arc.ilabel; ++liter) { + auto *dest_tuple = liter->second.dest_tuple; + const auto dest_head = dest_tuple->filter_state.GetState(); + if ((*r_)(dest_element.state_id, dest_head)) { + dest_tuple->subset.push_front(dest_element); + added = true; + } + } + return added; +} + +template +void RelationDeterminizeFilter::InitLabelMap( + LabelMap *label_map) const { + const auto src_head = tuple_->filter_state.GetState(); + Label label = kNoLabel; + StateId nextstate = kNoStateId; + for (ArcIterator> aiter(*fst_, src_head); !aiter.Done(); + aiter.Next()) { + const auto &arc = aiter.Value(); + // Continues if multiarc. + if (arc.ilabel == label && arc.nextstate == nextstate) continue; + DeterminizeArc det_arc(arc); + det_arc.dest_tuple->filter_state = FilterState(arc.nextstate); + label_map->insert(std::make_pair(arc.ilabel, det_arc)); + label = arc.ilabel; + nextstate = arc.nextstate; + } +} + +// Helper class to disambiguate an FST via Disambiguate(). +template +class Disambiguator { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // IDs arcs with state ID and arc position. Arc position -1 indicates final + // (super-final transition). + using ArcId = std::pair; + + Disambiguator() : error_(false) {} + + void Disambiguate( + const Fst &ifst, MutableFst *ofst, + const DisambiguateOptions &opts = DisambiguateOptions()) { + VectorFst sfst(ifst); + Connect(&sfst); + ArcSort(&sfst, ArcCompare()); + PreDisambiguate(sfst, ofst, opts); + ArcSort(ofst, ArcCompare()); + FindAmbiguities(*ofst); + RemoveSplits(ofst); + MarkAmbiguities(); + RemoveAmbiguities(ofst); + if (error_) ofst->SetProperties(kError, kError); + } + + private: + // Comparison functor for comparing input labels and next states of arcs. This + // sort order facilitates the predisambiguation. + class ArcCompare { + public: + bool operator()(const Arc &arc1, const Arc &arc2) const { + return arc1.ilabel < arc2.ilabel || + (arc1.ilabel == arc2.ilabel && arc1.nextstate < arc2.nextstate); + } + + uint64 Properties(uint64 props) const { + return (props & kArcSortProperties) | kILabelSorted | + (props & kAcceptor ? kOLabelSorted : 0); + } + }; + + // Comparison functor for comparing transitions represented by their arc ID. + // This sort order facilitates ambiguity detection. + class ArcIdCompare { + public: + explicit ArcIdCompare(const std::vector &head) : head_(head) {} + + bool operator()(const ArcId &a1, const ArcId &a2) const { + // Sort first by source head state... + const auto src1 = a1.first; + const auto src2 = a2.first; + const auto head1 = head_[src1]; + const auto head2 = head_[src2]; + if (head1 < head2) return true; + if (head2 < head1) return false; + // ...then by source state... + if (src1 < src2) return true; + if (src2 < src1) return false; + // ...then by position. + return a1.second < a2.second; + } + + private: + const std::vector &head_; + }; + + // A relation that determines if two states share a common future. + class CommonFuture { + public: + using StateTable = GenericComposeStateTable; + using StateTuple = typename StateTable::StateTuple; + + // Needed for compilation with DeterminizeRelationFilter. + CommonFuture() { + FSTERROR() << "Disambiguate::CommonFuture: FST not provided"; + } + + explicit CommonFuture(const Fst &ifst) { + using M = Matcher>; + ComposeFstOptions> opts; + // Ensures composition is between acceptors. + const bool trans = ifst.Properties(kNotAcceptor, true); + const auto *fsa = + trans ? new ProjectFst(ifst, PROJECT_INPUT) : &ifst; + opts.state_table = new StateTable(*fsa, *fsa); + const ComposeFst cfst(*fsa, *fsa, opts); + std::vector coaccess; + uint64 props = 0; + SccVisitor scc_visitor(nullptr, nullptr, &coaccess, &props); + DfsVisit(cfst, &scc_visitor); + for (StateId s = 0; s < coaccess.size(); ++s) { + if (coaccess[s]) { + related_.insert(opts.state_table->Tuple(s).StatePair()); + } + } + if (trans) delete fsa; + } + + bool operator()(const StateId s1, StateId s2) const { + return related_.count(std::make_pair(s1, s2)) > 0; + } + + private: + // States s1 and s2 resp. are in this relation iff they there is a + // path from s1 to a final state that has the same label as some + // path from s2 to a final state. + std::set> related_; + }; + + using ArcIdMap = std::multimap; + + // Inserts candidate into the arc ID map. + inline void InsertCandidate(StateId s1, StateId s2, const ArcId &a1, + const ArcId &a2) { + candidates_->insert(head_[s1] > head_[s2] ? std::make_pair(a1, a2) + : std::make_pair(a2, a1)); + } + + // Returns the arc corresponding to ArcId a. + static Arc GetArc(const Fst &fst, ArcId aid) { + if (aid.second == -1) { // Returns super-final transition. + return Arc(kNoLabel, kNoLabel, fst.Final(aid.first), kNoStateId); + } else { + ArcIterator> aiter(fst, aid.first); + aiter.Seek(aid.second); + return aiter.Value(); + } + } + + // Outputs an equivalent FST whose states are subsets of states that have a + // future path in common. + void PreDisambiguate(const ExpandedFst &ifst, MutableFst *ofst, + const DisambiguateOptions &opts); + + // Finds transitions that are ambiguous candidates in the result of + // PreDisambiguate. + void FindAmbiguities(const ExpandedFst &fst); + + // Finds transition pairs that are ambiguous candidates from two specified + // source states. + void FindAmbiguousPairs(const ExpandedFst &fst, StateId s1, StateId s2); + + // Marks ambiguous transitions to be removed. + void MarkAmbiguities(); + + // Deletes spurious ambiguous transitions (due to quantization). + void RemoveSplits(MutableFst *ofst); + + // Deletes actual ambiguous transitions. + void RemoveAmbiguities(MutableFst *ofst); + + // States s1 and s2 are in this relation iff there is a path from the initial + // state to s1 that has the same label as some path from the initial state to + // s2. We store only state pairs s1, s2 such that s1 <= s2. + std::set> coreachable_; + + // Queue of disambiguation-related states to be processed. We store only + // state pairs s1, s2 such that s1 <= s2. + std::list> queue_; + + // Head state in the pre-disambiguation for a given state. + std::vector head_; + + // Maps from a candidate ambiguous arc A to each ambiguous candidate arc B + // with the same label and destination state as A, whose source state s' is + // coreachable with the source state s of A, and for which head(s') < head(s). + std::unique_ptr candidates_; + + // Set of ambiguous transitions to be removed. + std::set ambiguous_; + + // States to merge due to quantization issues. + std::unique_ptr> merge_; + // Marks error condition. + bool error_; + + Disambiguator(const Disambiguator &) = delete; + Disambiguator &operator=(const Disambiguator &) = delete; +}; + +template +void Disambiguator::PreDisambiguate(const ExpandedFst &ifst, + MutableFst *ofst, + const DisambiguateOptions &opts) { + using CommonDivisor = DefaultCommonDivisor; + using Filter = RelationDeterminizeFilter; + // Subset elements with states s1 and s2 (resp.) are in this relation iff they + // there is a path from s1 to a final state that has the same label as some + // path from s2 to a final state. + auto *common_future = new CommonFuture(ifst); + DeterminizeFstOptions nopts; + nopts.delta = opts.delta; + nopts.subsequential_label = opts.subsequential_label; + nopts.filter = new Filter(ifst, common_future, &head_); + // The filter takes ownership of 'common_future', and determinization takes + // ownership of the filter itself. + nopts.gc_limit = 0; // Cache only the last state for fastest copy. + if (opts.weight_threshold != Weight::Zero() || + opts.state_threshold != kNoStateId) { + /* TODO(riley): fails regression test; understand why + if (ifst.Properties(kAcceptor, true)) { + std::vector idistance, odistance; + ShortestDistance(ifst, &idistance, true); + DeterminizeFst dfst(ifst, &idistance, &odistance, nopts); + PruneOptions< Arc, AnyArcFilter> popts(opts.weight_threshold, + opts.state_threshold, + AnyArcFilter(), + &odistance); + Prune(dfst, ofst, popts); + } else */ { + *ofst = DeterminizeFst(ifst, nopts); + Prune(ofst, opts.weight_threshold, opts.state_threshold); + } + } else { + *ofst = DeterminizeFst(ifst, nopts); + } + head_.resize(ofst->NumStates(), kNoStateId); +} + +template +void Disambiguator::FindAmbiguities(const ExpandedFst &fst) { + if (fst.Start() == kNoStateId) return; + candidates_.reset(new ArcIdMap(ArcIdCompare(head_))); + const auto start_pr = std::make_pair(fst.Start(), fst.Start()); + coreachable_.insert(start_pr); + queue_.push_back(start_pr); + while (!queue_.empty()) { + const auto &pr = queue_.front(); + const auto s1 = pr.first; + const auto s2 = pr.second; + queue_.pop_front(); + FindAmbiguousPairs(fst, s1, s2); + } +} + +template +void Disambiguator::FindAmbiguousPairs(const ExpandedFst &fst, + StateId s1, StateId s2) { + if (fst.NumArcs(s2) > fst.NumArcs(s1)) FindAmbiguousPairs(fst, s2, s1); + SortedMatcher> matcher(fst, MATCH_INPUT); + matcher.SetState(s2); + for (ArcIterator> aiter(fst, s1); !aiter.Done(); aiter.Next()) { + const auto &arc1 = aiter.Value(); + const ArcId a1(s1, aiter.Position()); + if (matcher.Find(arc1.ilabel)) { + for (; !matcher.Done(); matcher.Next()) { + const auto &arc2 = matcher.Value(); + // Continues on implicit epsilon match. + if (arc2.ilabel == kNoLabel) continue; + const ArcId a2(s2, matcher.Position()); + // Actual transition is ambiguous. + if (s1 != s2 && arc1.nextstate == arc2.nextstate) { + InsertCandidate(s1, s2, a1, a2); + } + const auto spr = arc1.nextstate <= arc2.nextstate + ? std::make_pair(arc1.nextstate, arc2.nextstate) + : std::make_pair(arc2.nextstate, arc1.nextstate); + // Not already marked as coreachable? + if (coreachable_.insert(spr).second) { + // Only possible if state split by quantization issues. + if (spr.first != spr.second && + head_[spr.first] == head_[spr.second]) { + if (!merge_) { + merge_.reset(new UnionFind(fst.NumStates(), kNoStateId)); + merge_->MakeAllSet(fst.NumStates()); + } + merge_->Union(spr.first, spr.second); + } else { + queue_.push_back(spr); + } + } + } + } + } + // Super-final transition is ambiguous. + if (s1 != s2 && fst.Final(s1) != Weight::Zero() && + fst.Final(s2) != Weight::Zero()) { + const ArcId a1(s1, -1); + const ArcId a2(s2, -1); + InsertCandidate(s1, s2, a1, a2); + } +} + +template +void Disambiguator::MarkAmbiguities() { + if (!candidates_) return; + for (auto it = candidates_->begin(); it != candidates_->end(); ++it) { + const auto a = it->first; + const auto b = it->second; + // If b is not to be removed, then a is. + if (ambiguous_.count(b) == 0) ambiguous_.insert(a); + } + coreachable_.clear(); + candidates_.reset(); +} + +template +void Disambiguator::RemoveSplits(MutableFst *ofst) { + if (!merge_) return; + // Merges split states to remove spurious ambiguities. + for (StateIterator> siter(*ofst); !siter.Done(); + siter.Next()) { + for (MutableArcIterator> aiter(ofst, siter.Value()); + !aiter.Done(); aiter.Next()) { + auto arc = aiter.Value(); + const auto nextstate = merge_->FindSet(arc.nextstate); + if (nextstate != arc.nextstate) { + arc.nextstate = nextstate; + aiter.SetValue(arc); + } + } + } + // Repeats search for actual ambiguities on modified FST. + coreachable_.clear(); + merge_.reset(); + candidates_.reset(); + FindAmbiguities(*ofst); + if (merge_) { // Shouldn't get here; sanity test. + FSTERROR() << "Disambiguate: Unable to remove spurious ambiguities"; + error_ = true; + return; + } +} + +template +void Disambiguator::RemoveAmbiguities(MutableFst *ofst) { + if (ambiguous_.empty()) return; + // Adds dead state to redirect ambiguous transitions to be removed. + const auto dead = ofst->AddState(); + for (auto it = ambiguous_.begin(); it != ambiguous_.end(); ++it) { + const auto pos = it->second; + if (pos >= 0) { // Actual transition. + MutableArcIterator> aiter(ofst, it->first); + aiter.Seek(pos); + auto arc = aiter.Value(); + arc.nextstate = dead; + aiter.SetValue(arc); + } else { // Super-final transition. + ofst->SetFinal(it->first, Weight::Zero()); + } + } + Connect(ofst); + ambiguous_.clear(); +} + +} // namespace internal + +// Disambiguates a weighted FST. This version writes the disambiguated FST to an +// output MutableFst. The result will be an equivalent FST that has the +// property that there are not two distinct paths from the initial state to a +// final state with the same input labeling. +// +// The weights must be (weakly) left divisible (valid for Tropical and +// LogWeight). +// +// Complexity: +// +// Disambiguable: exponential (polynomial in the size of the output). +// Non-disambiguable: does not terminate. +// +// The disambiguable transducers include all automata and functional transducers +// that are unweighted or that are acyclic or that are unambiguous. +// +// For more information, see: +// +// Mohri, M. and Riley, M. 2015. On the disambiguation of weighted automata. +// In CIAA, pages 263-278. +template +void Disambiguate( + const Fst &ifst, MutableFst *ofst, + const DisambiguateOptions &opts = DisambiguateOptions()) { + internal::Disambiguator disambiguator; + disambiguator.Disambiguate(ifst, ofst, opts); +} + +} // namespace fst + +#endif // FST_DISAMBIGUATE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/edit-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/edit-fst.h new file mode 100644 index 0000000..e7bdfd6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/edit-fst.h @@ -0,0 +1,702 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// An FST implementation that allows non-destructive edit operations on an +// existing FST. +// +// The EditFst class enables non-destructive edit operations on a wrapped +// ExpandedFst. The implementation uses copy-on-write semantics at the node +// level: if a user has an underlying fst on which he or she wants to perform a +// relatively small number of edits (read: mutations), then this implementation +// will copy the edited node to an internal MutableFst and perform any edits in +// situ on that copied node. This class supports all the methods of MutableFst +// except for DeleteStates(const std::vector &); thus, new nodes may +// also be +// added, and one may add transitions from existing nodes of the wrapped fst to +// new nodes. +// +// N.B.: The documentation for Fst::Copy(true) says that its behavior is +// undefined if invoked on an fst that has already been accessed. This class +// requires that the Fst implementation it wraps provides consistent, reliable +// behavior when its Copy(true) method is invoked, where consistent means +// the graph structure, graph properties and state numbering and do not change. +// VectorFst and CompactFst, for example, are both well-behaved in this regard. + +#ifndef FST_EDIT_FST_H_ +#define FST_EDIT_FST_H_ + +#include +#include +#include + +#include + +#include + + +namespace fst { +namespace internal { + +// The EditFstData class is a container for all mutable data for EditFstImpl; +// also, this class provides most of the actual implementation of what EditFst +// does (that is, most of EditFstImpl's methods delegate to methods in this, the +// EditFstData class). Instances of this class are reference-counted and can be +// shared between otherwise independent EditFstImpl instances. This scheme +// allows EditFstImpl to implement the thread-safe, copy-on-write semantics +// required by Fst::Copy(true). +// +// template parameters: +// A the type of arc to use +// WrappedFstT the type of fst wrapped by the EditFst instance that +// this EditFstData instance is backing +// MutableFstT the type of mutable fst to use internally for edited states; +// crucially, MutableFstT::Copy(false) *must* yield an fst that is +// thread-safe for reading (VectorFst, for example, has this property) +template , + typename MutableFstT = VectorFst> +class EditFstData { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + EditFstData() : num_new_states_(0) {} + + EditFstData(const EditFstData &other) + : edits_(other.edits_), + external_to_internal_ids_(other.external_to_internal_ids_), + edited_final_weights_(other.edited_final_weights_), + num_new_states_(other.num_new_states_) {} + + ~EditFstData() {} + + static EditFstData *Read( + std::istream &strm, const FstReadOptions &opts); + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const { + // Serialize all private data members of this class. + FstWriteOptions edits_opts(opts); + edits_opts.write_header = true; // Force writing contained header. + edits_.Write(strm, edits_opts); + WriteType(strm, external_to_internal_ids_); + WriteType(strm, edited_final_weights_); + WriteType(strm, num_new_states_); + if (!strm) { + LOG(ERROR) << "EditFstData::Write: Write failed: " << opts.source; + return false; + } + return true; + } + + StateId NumNewStates() const { return num_new_states_; } + + // accessor methods for the fst holding edited states + StateId EditedStart() const { return edits_.Start(); } + + Weight Final(StateId s, const WrappedFstT *wrapped) const { + auto final_weight_it = GetFinalWeightIterator(s); + if (final_weight_it == NotInFinalWeightMap()) { + auto it = GetEditedIdMapIterator(s); + return it == NotInEditedMap() ? wrapped->Final(s) + : edits_.Final(it->second); + } else { + return final_weight_it->second; + } + } + + size_t NumArcs(StateId s, const WrappedFstT *wrapped) const { + auto it = GetEditedIdMapIterator(s); + return it == NotInEditedMap() ? wrapped->NumArcs(s) + : edits_.NumArcs(it->second); + } + + size_t NumInputEpsilons(StateId s, const WrappedFstT *wrapped) const { + auto it = GetEditedIdMapIterator(s); + return it == NotInEditedMap() ? wrapped->NumInputEpsilons(s) + : edits_.NumInputEpsilons(it->second); + } + + size_t NumOutputEpsilons(StateId s, const WrappedFstT *wrapped) const { + auto it = GetEditedIdMapIterator(s); + return it == NotInEditedMap() ? wrapped->NumOutputEpsilons(s) + : edits_.NumOutputEpsilons(it->second); + } + + void SetEditedProperties(uint64 props, uint64 mask) { + edits_.SetProperties(props, mask); + } + + // Non-const MutableFst operations. + + // Sets the start state for this FST. + void SetStart(StateId s) { edits_.SetStart(s); } + + // Sets the final state for this FST. + Weight SetFinal(StateId s, Weight w, const WrappedFstT *wrapped) { + Weight old_weight = Final(s, wrapped); + auto it = GetEditedIdMapIterator(s); + // If we haven't already edited state s, don't add it to edited_ (which can + // be expensive if s has many transitions); just use the + // edited_final_weights_ map. + if (it == NotInEditedMap()) { + edited_final_weights_[s] = w; + } else { + edits_.SetFinal(GetEditableInternalId(s, wrapped), w); + } + return old_weight; + } + + // Adds a new state to this FST, initially with no arcs. + StateId AddState(StateId curr_num_states) { + StateId internal_state_id = edits_.AddState(); + StateId external_state_id = curr_num_states; + external_to_internal_ids_[external_state_id] = internal_state_id; + num_new_states_++; + return external_state_id; + } + + // Adds the specified arc to the specified state of this FST. + const Arc *AddArc(StateId s, const Arc &arc, const WrappedFstT *wrapped) { + const auto internal_id = GetEditableInternalId(s, wrapped); + const auto num_arcs = edits_.NumArcs(internal_id); + ArcIterator arc_it(edits_, internal_id); + const Arc *prev_arc = nullptr; + if (num_arcs > 0) { + // grab the final arc associated with this state in edits_ + arc_it.Seek(num_arcs - 1); + prev_arc = &(arc_it.Value()); + } + edits_.AddArc(internal_id, arc); + return prev_arc; + } + + void DeleteStates() { + edits_.DeleteStates(); + num_new_states_ = 0; + external_to_internal_ids_.clear(); + edited_final_weights_.clear(); + } + + // Removes all but the first n outgoing arcs of the specified state. + void DeleteArcs(StateId s, size_t n, const WrappedFstT *wrapped) { + edits_.DeleteArcs(GetEditableInternalId(s, wrapped), n); + } + + // Removes all outgoing arcs from the specified state. + void DeleteArcs(StateId s, const WrappedFstT *wrapped) { + edits_.DeleteArcs(GetEditableInternalId(s, wrapped)); + } + + // End methods for non-const MutableFst operations. + + // Provides information for the generic arc iterator. + void InitArcIterator(StateId s, ArcIteratorData *data, + const WrappedFstT *wrapped) const { + auto id_map_it = GetEditedIdMapIterator(s); + if (id_map_it == NotInEditedMap()) { + VLOG(3) << "EditFstData::InitArcIterator: iterating on state " << s + << " of original fst"; + wrapped->InitArcIterator(s, data); + } else { + VLOG(2) << "EditFstData::InitArcIterator: iterating on edited state " << s + << " (internal state id: " << id_map_it->second << ")"; + edits_.InitArcIterator(id_map_it->second, data); + } + } + + // Provides information for the generic mutable arc iterator. + void InitMutableArcIterator(StateId s, MutableArcIteratorData *data, + const WrappedFstT *wrapped) { + data->base = new MutableArcIterator( + &edits_, GetEditableInternalId(s, wrapped)); + } + + // Prints out the map from external to internal state id's (for debugging + // purposes). + void PrintMap() { + for (auto map_it = external_to_internal_ids_.begin(); + map_it != NotInEditedMap(); ++map_it) { + LOG(INFO) << "(external,internal)=(" << map_it->first << "," + << map_it->second << ")"; + } + } + + private: + // Returns the iterator of the map from external to internal state id's + // of edits_ for the specified external state id. + typename std::unordered_map::const_iterator + GetEditedIdMapIterator(StateId s) const { + return external_to_internal_ids_.find(s); + } + + typename std::unordered_map::const_iterator + NotInEditedMap() const { + return external_to_internal_ids_.end(); + } + + typename std::unordered_map::const_iterator + GetFinalWeightIterator(StateId s) const { + return edited_final_weights_.find(s); + } + + typename std::unordered_map::const_iterator + NotInFinalWeightMap() const { + return edited_final_weights_.end(); + } + + // Returns the internal state ID of the specified external ID if the state has + // already been made editable, or else copies the state from wrapped_ to + // edits_ and returns the state id of the newly editable state in edits_. + StateId GetEditableInternalId(StateId s, const WrappedFstT *wrapped) { + auto id_map_it = GetEditedIdMapIterator(s); + if (id_map_it == NotInEditedMap()) { + StateId new_internal_id = edits_.AddState(); + VLOG(2) << "EditFstData::GetEditableInternalId: editing state " << s + << " of original fst; new internal state id:" << new_internal_id; + external_to_internal_ids_[s] = new_internal_id; + for (ArcIterator> arc_iterator(*wrapped, s); + !arc_iterator.Done(); arc_iterator.Next()) { + edits_.AddArc(new_internal_id, arc_iterator.Value()); + } + // Copies the final weight. + auto final_weight_it = GetFinalWeightIterator(s); + if (final_weight_it == NotInFinalWeightMap()) { + edits_.SetFinal(new_internal_id, wrapped->Final(s)); + } else { + edits_.SetFinal(new_internal_id, final_weight_it->second); + edited_final_weights_.erase(s); + } + return new_internal_id; + } else { + return id_map_it->second; + } + } + + // A mutable FST (by default, a VectorFst) to contain new states, and/or + // copies of states from a wrapped ExpandedFst that have been modified in + // some way. + MutableFstT edits_; + // A mapping from external state IDs to the internal IDs of states that + // appear in edits_. + std::unordered_map external_to_internal_ids_; + // A mapping from external state IDs to final state weights assigned to + // those states. The states in this map are *only* those whose final weight + // has been modified; if any other part of the state has been modified, + // the entire state is copied to edits_, and all modifications reside there. + std::unordered_map edited_final_weights_; + // The number of new states added to this mutable fst impl, which is <= the + // number of states in edits_ (since edits_ contains both edited *and* new + // states). + StateId num_new_states_; +}; + +// EditFstData method implementations: just the Read method. +template +EditFstData * +EditFstData::Read(std::istream &strm, + const FstReadOptions &opts) { + auto *data = new EditFstData(); + // next read in MutabelFstT machine that stores edits + FstReadOptions edits_opts(opts); + // Contained header was written out, so read it in. + edits_opts.header = nullptr; + + // Because our internal representation of edited states is a solid object + // of type MutableFstT (defaults to VectorFst) and not a pointer, + // and because the static Read method allocates a new object on the heap, + // we need to call Read, check if there was a failure, use + // MutableFstT::operator= to assign the object (not the pointer) to the + // edits_ data member (which will increase the ref count by 1 on the impl) + // and, finally, delete the heap-allocated object. + std::unique_ptr edits(MutableFstT::Read(strm, edits_opts)); + if (!edits) return nullptr; + data->edits_ = *edits; + edits.reset(); + // Finally, reads in rest of private data members. + ReadType(strm, &data->external_to_internal_ids_); + ReadType(strm, &data->edited_final_weights_); + ReadType(strm, &data->num_new_states_); + if (!strm) { + LOG(ERROR) << "EditFst::Read: read failed: " << opts.source; + return nullptr; + } + return data; +} + +// This class enables non-destructive edit operations on a wrapped ExpandedFst. +// The implementation uses copy-on-write semantics at the node level: if a user +// has an underlying fst on which he or she wants to perform a relatively small +// number of edits (read: mutations), then this implementation will copy the +// edited node to an internal MutableFst and perform any edits in situ on that +// copied node. This class supports all the methods of MutableFst except for +// DeleteStates(const std::vector &); thus, new nodes may also be +// added, and +// one may add transitions from existing nodes of the wrapped fst to new nodes. +// +// template parameters: +// A the type of arc to use +// WrappedFstT the type of fst wrapped by the EditFst instance that +// this EditFstImpl instance is backing +// MutableFstT the type of mutable fst to use internally for edited states; +// crucially, MutableFstT::Copy(false) *must* yield an fst that is +// thread-safe for reading (VectorFst, for example, has this property) +template , + typename MutableFstT = VectorFst> +class EditFstImpl : public FstImpl { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::WriteHeader; + + // Constructs an editable FST implementation with no states. Effectively, this + // initially-empty fst will in every way mimic the behavior of a + // VectorFst---more precisely, a VectorFstImpl instance---but with slightly + // slower performance (by a constant factor), due to the fact that + // this class maintains a mapping between external state id's and + // their internal equivalents. + EditFstImpl() : wrapped_(new MutableFstT()) { + FstImpl::SetType("edit"); + InheritPropertiesFromWrapped(); + data_ = std::make_shared>(); + } + + // Wraps the specified ExpandedFst. This constructor requires that the + // specified Fst is an ExpandedFst instance. This requirement is only enforced + // at runtime. (See below for the reason.) + // + // This library uses the pointer-to-implementation or "PIMPL" design pattern. + // In particular, to make it convenient to bind an implementation class to its + // interface, there are a pair of template "binder" classes, one for immutable + // and one for mutable fst's (ImplToFst and ImplToMutableFst, respectively). + // As it happens, the API for the ImplToMutableFst class requires that + // the implementation class--the template parameter "I"--have a constructor + // taking a const Fst reference. Accordingly, the constructor here must + // perform a static_cast to the WrappedFstT type required by EditFst and + // therefore EditFstImpl. + explicit EditFstImpl(const Fst &wrapped) + : wrapped_(static_cast(wrapped.Copy())) { + FstImpl::SetType("edit"); + data_ = std::make_shared>(); + // have edits_ inherit all properties from wrapped_ + data_->SetEditedProperties(wrapped_->Properties(kFstProperties, false), + kFstProperties); + InheritPropertiesFromWrapped(); + } + + // A copy constructor for this implementation class, used to implement + // the Copy() method of the Fst interface. + EditFstImpl(const EditFstImpl &impl) + : FstImpl(), + wrapped_(static_cast(impl.wrapped_->Copy(true))), + data_(impl.data_) { + SetProperties(impl.Properties()); + } + + // const Fst/ExpandedFst operations, declared in the Fst and ExpandedFst + // interfaces + StateId Start() const { + const auto edited_start = data_->EditedStart(); + return edited_start == kNoStateId ? wrapped_->Start() : edited_start; + } + + Weight Final(StateId s) const { return data_->Final(s, wrapped_.get()); } + + size_t NumArcs(StateId s) const { return data_->NumArcs(s, wrapped_.get()); } + + size_t NumInputEpsilons(StateId s) const { + return data_->NumInputEpsilons(s, wrapped_.get()); + } + + size_t NumOutputEpsilons(StateId s) const { + return data_->NumOutputEpsilons(s, wrapped_.get()); + } + + StateId NumStates() const { + return wrapped_->NumStates() + data_->NumNewStates(); + } + + static EditFstImpl *Read( + std::istream &strm, const FstReadOptions &opts); + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const { + FstHeader hdr; + hdr.SetStart(Start()); + hdr.SetNumStates(NumStates()); + FstWriteOptions header_opts(opts); + // Allows the contained FST to hold any symbols. + header_opts.write_isymbols = false; + header_opts.write_osymbols = false; + WriteHeader(strm, header_opts, kFileVersion, &hdr); + // First, serializes the wrapped FST to stream. + FstWriteOptions wrapped_opts(opts); + // Forcse writing the contained header. + wrapped_opts.write_header = true; + wrapped_->Write(strm, wrapped_opts); + data_->Write(strm, opts); + strm.flush(); + if (!strm) { + LOG(ERROR) << "EditFst::Write: Write failed: " << opts.source; + return false; + } + return true; + } + + // Sets the start state for this FST. + void SetStart(StateId s) { + MutateCheck(); + data_->SetStart(s); + SetProperties(SetStartProperties(FstImpl::Properties())); + } + + // Sets the final state for this fst. + void SetFinal(StateId s, Weight weight) { + MutateCheck(); + Weight old_weight = data_->SetFinal(s, weight, wrapped_.get()); + SetProperties( + SetFinalProperties(FstImpl::Properties(), old_weight, weight)); + } + + // Adds a new state to this fst, initially with no arcs. + StateId AddState() { + MutateCheck(); + SetProperties(AddStateProperties(FstImpl::Properties())); + return data_->AddState(NumStates()); + } + + // Adds the specified arc to the specified state of this fst. + void AddArc(StateId s, const Arc &arc) { + MutateCheck(); + const auto *prev_arc = data_->AddArc(s, arc, wrapped_.get()); + SetProperties( + AddArcProperties(FstImpl::Properties(), s, arc, prev_arc)); + } + + void DeleteStates(const std::vector &dstates) { + FSTERROR() << ": EditFstImpl::DeleteStates(const std::vector&): " + << " not implemented"; + SetProperties(kError, kError); + } + + // Deletes all states in this fst. + void DeleteStates(); + + // Removes all but the first n outgoing arcs of the specified state. + void DeleteArcs(StateId s, size_t n) { + MutateCheck(); + data_->DeleteArcs(s, n, wrapped_.get()); + SetProperties(DeleteArcsProperties(FstImpl::Properties())); + } + + // Removes all outgoing arcs from the specified state. + void DeleteArcs(StateId s) { + MutateCheck(); + data_->DeleteArcs(s, wrapped_.get()); + SetProperties(DeleteArcsProperties(FstImpl::Properties())); + } + + void ReserveStates(StateId s) {} + + void ReserveArcs(StateId s, size_t n) {} + + // Ends non-const MutableFst operations. + + // Provides information for the generic state iterator. + void InitStateIterator(StateIteratorData *data) const { + data->base = nullptr; + data->nstates = NumStates(); + } + + // Provides information for the generic arc iterator. + void InitArcIterator(StateId s, ArcIteratorData *data) const { + data_->InitArcIterator(s, data, wrapped_.get()); + } + + // Provides information for the generic mutable arc iterator. + void InitMutableArcIterator(StateId s, MutableArcIteratorData *data) { + MutateCheck(); + data_->InitMutableArcIterator(s, data, wrapped_.get()); + } + + private: + // Properties always true of this FST class. + static constexpr uint64 kStaticProperties = kExpanded | kMutable; + // Current file format version. + static constexpr int kFileVersion = 2; + // Minimum file format version supported + static constexpr int kMinFileVersion = 2; + + // Causes this FST to inherit all the properties from its wrapped FST, except + // for the two properties that always apply to EditFst instances: kExpanded + // and kMutable. + void InheritPropertiesFromWrapped() { + SetProperties(wrapped_->Properties(kCopyProperties, false) | + kStaticProperties); + SetInputSymbols(wrapped_->InputSymbols()); + SetOutputSymbols(wrapped_->OutputSymbols()); + } + + // This method ensures that any operations that alter the mutable data + // portion of this EditFstImpl cause the data_ member to be copied when its + // reference count is greater than 1. Note that this method is distinct from + // MutableFst::Mutate, which gets invoked whenever one of the basic mutation + // methods defined in MutableFst is invoked, such as SetInputSymbols. + // The MutateCheck here in EditFstImpl is invoked whenever one of the + // mutating methods specifically related to the types of edits provided + // by EditFst is performed, such as changing an arc of an existing state + // of the wrapped fst via a MutableArcIterator, or adding a new state via + // AddState(). + void MutateCheck() { + if (!data_.unique()) { + data_ = + std::make_shared>(*data_); + } + } + + // The FST that this FST wraps. The purpose of this class is to enable + // non-destructive edits on this wrapped FST. + std::unique_ptr wrapped_; + // The mutable data for this EditFst instance, with delegates for all the + // methods that can mutate data. + std::shared_ptr> data_; +}; + +template +constexpr uint64 EditFstImpl::kStaticProperties; + +template +constexpr int EditFstImpl::kFileVersion; + +template +constexpr int EditFstImpl::kMinFileVersion; + +template +inline void EditFstImpl::DeleteStates() { + data_->DeleteStates(); + // we are deleting all states, so just forget about pointer to wrapped_ + // and do what default constructor does: set wrapped_ to a new VectorFst + wrapped_.reset(new MutableFstT()); + const auto new_props = + DeleteAllStatesProperties(FstImpl::Properties(), kStaticProperties); + FstImpl::SetProperties(new_props); +} + +template +EditFstImpl * +EditFstImpl::Read(std::istream &strm, + const FstReadOptions &opts) { + auto *impl = new EditFstImpl(); + FstHeader hdr; + if (!impl->ReadHeader(strm, opts, kMinFileVersion, &hdr)) return nullptr; + impl->SetStart(hdr.Start()); + // Reads in wrapped FST. + FstReadOptions wrapped_opts(opts); + // Contained header was written out, so reads it in too. + wrapped_opts.header = nullptr; + std::unique_ptr> wrapped_fst(Fst::Read(strm, wrapped_opts)); + if (!wrapped_fst) return nullptr; + impl->wrapped_.reset(static_cast(wrapped_fst.release())); + impl->data_ = std::shared_ptr>( + EditFstData::Read(strm, opts)); + if (!impl->data_) return nullptr; + return impl; +} + +} // namespace internal + +// Concrete, editable FST. This class attaches interface to implementation. +template , + typename MutableFstT = VectorFst> +class EditFst : public ImplToMutableFst< + internal::EditFstImpl> { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + using Impl = internal::EditFstImpl; + + friend class MutableArcIterator>; + + EditFst() : ImplToMutableFst(std::make_shared()) {} + + explicit EditFst(const Fst &fst) + : ImplToMutableFst(std::make_shared(fst)) {} + + explicit EditFst(const WrappedFstT &fst) + : ImplToMutableFst(std::make_shared(fst)) {} + + // See Fst<>::Copy() for doc. + EditFst(const EditFst &fst, bool safe = false) + : ImplToMutableFst(fst, safe) {} + + ~EditFst() override {} + + // Gets a copy of this EditFst. See Fst<>::Copy() for further doc. + EditFst *Copy( + bool safe = false) const override { + return new EditFst(*this, safe); + } + + EditFst &operator=( + const EditFst &fst) { + SetImpl(fst.GetSharedImpl()); + return *this; + } + + EditFst &operator=( + const Fst &fst) override { + SetImpl(std::make_shared(fst)); + return *this; + } + + // Reads an EditFst from an input stream, returning nullptr on error. + static EditFst *Read( + std::istream &strm, const FstReadOptions &opts) { + auto *impl = Impl::Read(strm, opts); + return impl ? new EditFst(std::shared_ptr(impl)) : nullptr; + } + + // Reads an EditFst from a file, returning nullptr on error. If the filename + // argument is an empty string, it reads from standard input. + static EditFst *Read(const string &filename) { + auto *impl = ImplToExpandedFst>::Read(filename); + return impl ? new EditFst( + std::shared_ptr(impl)) + : nullptr; + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return GetImpl()->Write(strm, opts); + } + + bool Write(const string &filename) const override { + return Fst::WriteFile(filename); + } + + void InitStateIterator(StateIteratorData *data) const override { + GetImpl()->InitStateIterator(data); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetImpl()->InitArcIterator(s, data); + } + + void InitMutableArcIterator(StateId s, + MutableArcIteratorData *data) override { + GetMutableImpl()->InitMutableArcIterator(s, data); + } + + private: + explicit EditFst(std::shared_ptr impl) : ImplToMutableFst(impl) {} + + using ImplToFst>::GetImpl; + using ImplToFst>::GetMutableImpl; + using ImplToFst>::SetImpl; +}; + +} // namespace fst + +#endif // FST_EDIT_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/encode.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/encode.h new file mode 100644 index 0000000..f251bbf --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/encode.h @@ -0,0 +1,556 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to encode and decode an FST. + +#ifndef FST_ENCODE_H_ +#define FST_ENCODE_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + + +namespace fst { + +enum EncodeType { ENCODE = 1, DECODE = 2 }; + +static constexpr uint32 kEncodeLabels = 0x0001; +static constexpr uint32 kEncodeWeights = 0x0002; +static constexpr uint32 kEncodeFlags = 0x0003; + +namespace internal { + +static constexpr uint32 kEncodeHasISymbols = 0x0004; +static constexpr uint32 kEncodeHasOSymbols = 0x0008; + +// Identifies stream data as an encode table (and its endianity) +static const int32 kEncodeMagicNumber = 2129983209; + +// The following class encapsulates implementation details for the encoding and +// decoding of label/weight tuples used for encoding and decoding of FSTs. The +// EncodeTable is bidirectional. I.e, it stores both the Tuple of encode labels +// and weights to a unique label, and the reverse. +template +class EncodeTable { + public: + using Label = typename Arc::Label; + using Weight = typename Arc::Weight; + + // Encoded data consists of arc input/output labels and arc weight. + struct Tuple { + Tuple() {} + + Tuple(Label ilabel_, Label olabel_, Weight weight_) + : ilabel(ilabel_), olabel(olabel_), weight(std::move(weight_)) {} + + Tuple(const Tuple &tuple) + : ilabel(tuple.ilabel), + olabel(tuple.olabel), + weight(std::move(tuple.weight)) {} + + Label ilabel; + Label olabel; + Weight weight; + }; + + // Comparison object for hashing EncodeTable Tuple(s). + class TupleEqual { + public: + bool operator()(const Tuple *x, const Tuple *y) const { + return (x->ilabel == y->ilabel && x->olabel == y->olabel && + x->weight == y->weight); + } + }; + + // Hash function for EncodeTabe Tuples. Based on the encode flags + // we either hash the labels, weights or combination of them. + class TupleKey { + public: + TupleKey() : encode_flags_(kEncodeLabels | kEncodeWeights) {} + + TupleKey(const TupleKey &key) : encode_flags_(key.encode_flags_) {} + + explicit TupleKey(uint32 encode_flags) : encode_flags_(encode_flags) {} + + size_t operator()(const Tuple *x) const { + size_t hash = x->ilabel; + static constexpr int lshift = 5; + static constexpr int rshift = CHAR_BIT * sizeof(size_t) - 5; + if (encode_flags_ & kEncodeLabels) { + hash = hash << lshift ^ hash >> rshift ^ x->olabel; + } + if (encode_flags_ & kEncodeWeights) { + hash = hash << lshift ^ hash >> rshift ^ x->weight.Hash(); + } + return hash; + } + + private: + int32 encode_flags_; + }; + + explicit EncodeTable(uint32 encode_flags) + : flags_(encode_flags), encode_hash_(1024, TupleKey(encode_flags)) {} + + using EncodeHash = std::unordered_map; + + // Given an arc, encodes either input/output labels or input/costs or both. + Label Encode(const Arc &arc) { + std::unique_ptr tuple( + new Tuple(arc.ilabel, flags_ & kEncodeLabels ? arc.olabel : 0, + flags_ & kEncodeWeights ? arc.weight : Weight::One())); + auto insert_result = encode_hash_.insert( + std::make_pair(tuple.get(), encode_tuples_.size() + 1)); + if (insert_result.second) encode_tuples_.push_back(std::move(tuple)); + return insert_result.first->second; + } + + // Given an arc, looks up its encoded label or returns kNoLabel if not found. + Label GetLabel(const Arc &arc) const { + const Tuple tuple(arc.ilabel, flags_ & kEncodeLabels ? arc.olabel : 0, + flags_ & kEncodeWeights ? arc.weight : Weight::One()); + auto it = encode_hash_.find(&tuple); + return (it == encode_hash_.end()) ? kNoLabel : it->second; + } + + // Given an encoded arc label, decodes back to input/output labels and costs. + const Tuple *Decode(Label key) const { + if (key < 1 || key > encode_tuples_.size()) { + LOG(ERROR) << "EncodeTable::Decode: Unknown decode key: " << key; + return nullptr; + } + return encode_tuples_[key - 1].get(); + } + + size_t Size() const { return encode_tuples_.size(); } + + bool Write(std::ostream &strm, const string &source) const; + + static EncodeTable *Read(std::istream &strm, const string &source); + + uint32 Flags() const { return flags_ & kEncodeFlags; } + + const SymbolTable *InputSymbols() const { return isymbols_.get(); } + + const SymbolTable *OutputSymbols() const { return osymbols_.get(); } + + void SetInputSymbols(const SymbolTable *syms) { + if (syms) { + isymbols_.reset(syms->Copy()); + flags_ |= kEncodeHasISymbols; + } else { + isymbols_.reset(); + flags_ &= ~kEncodeHasISymbols; + } + } + + void SetOutputSymbols(const SymbolTable *syms) { + if (syms) { + osymbols_.reset(syms->Copy()); + flags_ |= kEncodeHasOSymbols; + } else { + osymbols_.reset(); + flags_ &= ~kEncodeHasOSymbols; + } + } + + private: + uint32 flags_; + std::vector> encode_tuples_; + EncodeHash encode_hash_; + std::unique_ptr isymbols_; // Pre-encoded input symbol table. + std::unique_ptr osymbols_; // Pre-encoded output symbol table. + + EncodeTable(const EncodeTable &) = delete; + EncodeTable &operator=(const EncodeTable &) = delete; +}; + +template +bool EncodeTable::Write(std::ostream &strm, + const string &source) const { + WriteType(strm, kEncodeMagicNumber); + WriteType(strm, flags_); + const int64 size = encode_tuples_.size(); + WriteType(strm, size); + for (const auto &tuple : encode_tuples_) { + WriteType(strm, tuple->ilabel); + WriteType(strm, tuple->olabel); + tuple->weight.Write(strm); + } + if (flags_ & kEncodeHasISymbols) isymbols_->Write(strm); + if (flags_ & kEncodeHasOSymbols) osymbols_->Write(strm); + strm.flush(); + if (!strm) { + LOG(ERROR) << "EncodeTable::Write: Write failed: " << source; + return false; + } + return true; +} + +template +EncodeTable *EncodeTable::Read(std::istream &strm, + const string &source) { + int32 magic_number = 0; + ReadType(strm, &magic_number); + if (magic_number != kEncodeMagicNumber) { + LOG(ERROR) << "EncodeTable::Read: Bad encode table header: " << source; + return nullptr; + } + uint32 flags; + ReadType(strm, &flags); + int64 size; + ReadType(strm, &size); + if (!strm) { + LOG(ERROR) << "EncodeTable::Read: Read failed: " << source; + return nullptr; + } + std::unique_ptr> table(new EncodeTable(flags)); + for (int64 i = 0; i < size; ++i) { + std::unique_ptr tuple(new Tuple()); + ReadType(strm, &tuple->ilabel); + ReadType(strm, &tuple->olabel); + tuple->weight.Read(strm); + if (!strm) { + LOG(ERROR) << "EncodeTable::Read: Read failed: " << source; + return nullptr; + } + table->encode_tuples_.push_back(std::move(tuple)); + table->encode_hash_[table->encode_tuples_.back().get()] = + table->encode_tuples_.size(); + } + if (flags & kEncodeHasISymbols) { + table->isymbols_.reset(SymbolTable::Read(strm, source)); + } + if (flags & kEncodeHasOSymbols) { + table->osymbols_.reset(SymbolTable::Read(strm, source)); + } + return table.release(); +} + +} // namespace internal + +// A mapper to encode/decode weighted transducers. Encoding of an FST is used +// for performing classical determinization or minimization on a weighted +// transducer viewing it as an unweighted acceptor over encoded labels. +// +// The mapper stores the encoding in a local hash table (EncodeTable). This +// table is shared (and reference-counted) between the encoder and decoder. +// A decoder has read-only access to the EncodeTable. +// +// The EncodeMapper allows on the fly encoding of the machine. As the +// EncodeTable is generated the same table may by used to decode the machine +// on the fly. For example in the following sequence of operations +// +// Encode -> Determinize -> Decode +// +// we will use the encoding table generated during the encode step in the +// decode, even though the encoding is not complete. +template +class EncodeMapper { + using Label = typename Arc::Label; + using Weight = typename Arc::Weight; + + public: + EncodeMapper(uint32 flags, EncodeType type) + : flags_(flags), + type_(type), + table_(std::make_shared>(flags)), + error_(false) {} + + EncodeMapper(const EncodeMapper &mapper) + : flags_(mapper.flags_), + type_(mapper.type_), + table_(mapper.table_), + error_(false) {} + + // Copy constructor but setting the type, typically to DECODE. + EncodeMapper(const EncodeMapper &mapper, EncodeType type) + : flags_(mapper.flags_), + type_(type), + table_(mapper.table_), + error_(mapper.error_) {} + + Arc operator()(const Arc &arc); + + MapFinalAction FinalAction() const { + return (type_ == ENCODE && (flags_ & kEncodeWeights)) + ? MAP_REQUIRE_SUPERFINAL + : MAP_NO_SUPERFINAL; + } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + uint64 Properties(uint64 inprops) { + uint64 outprops = inprops; + if (error_) outprops |= kError; + uint64 mask = kFstProperties; + if (flags_ & kEncodeLabels) { + mask &= kILabelInvariantProperties & kOLabelInvariantProperties; + } + if (flags_ & kEncodeWeights) { + mask &= kILabelInvariantProperties & kWeightInvariantProperties & + (type_ == ENCODE ? kAddSuperFinalProperties + : kRmSuperFinalProperties); + } + return outprops & mask; + } + + uint32 Flags() const { return flags_; } + + EncodeType Type() const { return type_; } + + bool Write(std::ostream &strm, const string &source) const { + return table_->Write(strm, source); + } + + bool Write(const string &filename) const { + std::ofstream strm(filename, + std::ios_base::out | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "EncodeMap: Can't open file: " << filename; + return false; + } + return Write(strm, filename); + } + + static EncodeMapper *Read(std::istream &strm, const string &source, + EncodeType type = ENCODE) { + auto *table = internal::EncodeTable::Read(strm, source); + return table ? new EncodeMapper(table->Flags(), type, table) : nullptr; + } + + static EncodeMapper *Read(const string &filename, + EncodeType type = ENCODE) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "EncodeMap: Can't open file: " << filename; + return nullptr; + } + return Read(strm, filename, type); + } + + const SymbolTable *InputSymbols() const { return table_->InputSymbols(); } + + const SymbolTable *OutputSymbols() const { return table_->OutputSymbols(); } + + void SetInputSymbols(const SymbolTable *syms) { + table_->SetInputSymbols(syms); + } + + void SetOutputSymbols(const SymbolTable *syms) { + table_->SetOutputSymbols(syms); + } + + private: + uint32 flags_; + EncodeType type_; + std::shared_ptr> table_; + bool error_; + + explicit EncodeMapper(uint32 flags, EncodeType type, + internal::EncodeTable *table) + : flags_(flags), type_(type), table_(table), error_(false) {} + + EncodeMapper &operator=(const EncodeMapper &) = delete; +}; + +template +Arc EncodeMapper::operator()(const Arc &arc) { + if (type_ == ENCODE) { + if ((arc.nextstate == kNoStateId && !(flags_ & kEncodeWeights)) || + (arc.nextstate == kNoStateId && (flags_ & kEncodeWeights) && + arc.weight == Weight::Zero())) { + return arc; + } else { + const auto label = table_->Encode(arc); + return Arc(label, flags_ & kEncodeLabels ? label : arc.olabel, + flags_ & kEncodeWeights ? Weight::One() : arc.weight, + arc.nextstate); + } + } else { // type_ == DECODE + if (arc.nextstate == kNoStateId) { + return arc; + } else { + if (arc.ilabel == 0) return arc; + if (flags_ & kEncodeLabels && arc.ilabel != arc.olabel) { + FSTERROR() << "EncodeMapper: Label-encoded arc has different " + "input and output labels"; + error_ = true; + } + if (flags_ & kEncodeWeights && arc.weight != Weight::One()) { + FSTERROR() << "EncodeMapper: Weight-encoded arc has non-trivial weight"; + error_ = true; + } + const auto tuple = table_->Decode(arc.ilabel); + if (!tuple) { + FSTERROR() << "EncodeMapper: Decode failed"; + error_ = true; + return Arc(kNoLabel, kNoLabel, Weight::NoWeight(), arc.nextstate); + } else { + return Arc(tuple->ilabel, + flags_ & kEncodeLabels ? tuple->olabel : arc.olabel, + flags_ & kEncodeWeights ? tuple->weight : arc.weight, + arc.nextstate); + } + } + } +} + +// Complexity: O(E + V). +template +inline void Encode(MutableFst *fst, EncodeMapper *mapper) { + mapper->SetInputSymbols(fst->InputSymbols()); + mapper->SetOutputSymbols(fst->OutputSymbols()); + ArcMap(fst, mapper); +} + +template +inline void Decode(MutableFst *fst, const EncodeMapper &mapper) { + ArcMap(fst, EncodeMapper(mapper, DECODE)); + RmFinalEpsilon(fst); + fst->SetInputSymbols(mapper.InputSymbols()); + fst->SetOutputSymbols(mapper.OutputSymbols()); +} + +// On-the-fly encoding of an input FST. +// +// Complexity: +// +// Construction: O(1) +// Traversal: O(e + v) +// +// where e is the number of arcs visited and v is the number of states visited. +// Constant time and space to visit an input state or arc is assumed and +// exclusive of caching. +template +class EncodeFst : public ArcMapFst> { + public: + using Mapper = EncodeMapper; + using Impl = internal::ArcMapFstImpl; + + EncodeFst(const Fst &fst, Mapper *encoder) + : ArcMapFst(fst, encoder, ArcMapFstOptions()) { + encoder->SetInputSymbols(fst.InputSymbols()); + encoder->SetOutputSymbols(fst.OutputSymbols()); + } + + EncodeFst(const Fst &fst, const Mapper &encoder) + : ArcMapFst(fst, encoder, ArcMapFstOptions()) {} + + // See Fst<>::Copy() for doc. + EncodeFst(const EncodeFst &fst, bool copy = false) + : ArcMapFst(fst, copy) {} + + // Makes a copy of this EncodeFst. See Fst<>::Copy() for further doc. + EncodeFst *Copy(bool safe = false) const override { + if (safe) { + FSTERROR() << "EncodeFst::Copy(true): Not allowed"; + GetImpl()->SetProperties(kError, kError); + } + return new EncodeFst(*this); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; +}; + +// On-the-fly decoding of an input FST. +// +// Complexity: +// +// Construction: O(1). +// Traversal: O(e + v) +// +// Constant time and space to visit an input state or arc is assumed and +// exclusive of caching. +template +class DecodeFst : public ArcMapFst> { + public: + using Mapper = EncodeMapper; + using Impl = internal::ArcMapFstImpl; + using ImplToFst::GetImpl; + + DecodeFst(const Fst &fst, const Mapper &encoder) + : ArcMapFst(fst, Mapper(encoder, DECODE), + ArcMapFstOptions()) { + GetMutableImpl()->SetInputSymbols(encoder.InputSymbols()); + GetMutableImpl()->SetOutputSymbols(encoder.OutputSymbols()); + } + + // See Fst<>::Copy() for doc. + DecodeFst(const DecodeFst &fst, bool safe = false) + : ArcMapFst(fst, safe) {} + + // Makes a copy of this DecodeFst. See Fst<>::Copy() for further doc. + DecodeFst *Copy(bool safe = false) const override { + return new DecodeFst(*this, safe); + } + + private: + using ImplToFst::GetMutableImpl; +}; + +// Specialization for EncodeFst. +template +class StateIterator> + : public StateIterator>> { + public: + explicit StateIterator(const EncodeFst &fst) + : StateIterator>>(fst) {} +}; + +// Specialization for EncodeFst. +template +class ArcIterator> + : public ArcIterator>> { + public: + ArcIterator(const EncodeFst &fst, typename Arc::StateId s) + : ArcIterator>>(fst, s) {} +}; + +// Specialization for DecodeFst. +template +class StateIterator> + : public StateIterator>> { + public: + explicit StateIterator(const DecodeFst &fst) + : StateIterator>>(fst) {} +}; + +// Specialization for DecodeFst. +template +class ArcIterator> + : public ArcIterator>> { + public: + ArcIterator(const DecodeFst &fst, typename Arc::StateId s) + : ArcIterator>>(fst, s) {} +}; + +// Useful aliases when using StdArc. + +using StdEncodeFst = EncodeFst; + +using StdDecodeFst = DecodeFst; + +} // namespace fst + +#endif // FST_ENCODE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/epsnormalize.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/epsnormalize.h new file mode 100644 index 0000000..18105fb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/epsnormalize.h @@ -0,0 +1,61 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function that implements epsilon-normalization. + +#ifndef FST_EPSNORMALIZE_H_ +#define FST_EPSNORMALIZE_H_ + + +#include +#include +#include +#include + + +namespace fst { + +enum EpsNormalizeType { EPS_NORM_INPUT, EPS_NORM_OUTPUT }; + +// Returns an equivalent FST that is epsilon-normalized. An acceptor is +// epsilon-normalized if it is epsilon-removed. A transducer is input +// epsilon-normalized if additionally if on each path any epsilon input +// label follows all non-epsilon input labels. Output epsilon-normalized +// is defined similarly. +// +// For more information, see: +// +// Mohri, M. 2002. Generic epsilon-removal and input epsilon-normalization +// algorithms for weighted transducers. International Journal of Computer +// Science, 13(1): 129-143, 2002. +template +void EpsNormalize(const Fst &ifst, MutableFst *ofst, + EpsNormalizeType type = EPS_NORM_INPUT) { + EpsNormalize(ifst, ofst, type); +} + +// Same as above, except allows specifying explicitly the gallic weight type. +template +void EpsNormalize(const Fst &ifst, MutableFst *ofst, + EpsNormalizeType type) { + VectorFst> gfst; + std::unique_ptr symbols; + if (type == EPS_NORM_INPUT) { + ArcMap(ifst, &gfst, ToGallicMapper()); + if (ifst.OutputSymbols()) symbols.reset(ifst.OutputSymbols()->Copy()); + } else { // type == EPS_NORM_OUTPUT + ArcMap(InvertFst(ifst), &gfst, ToGallicMapper()); + if (ifst.InputSymbols()) symbols.reset(ifst.InputSymbols()->Copy()); + } + RmEpsilon(&gfst); + FactorWeightFst, + GallicFactor> + fwfst(gfst); + ArcMap(fwfst, ofst, FromGallicMapper()); + ofst->SetOutputSymbols(symbols.get()); + if (type == EPS_NORM_OUTPUT) Invert(ofst); +} + +} // namespace fst + +#endif // FST_EPSNORMALIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/equal.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/equal.h new file mode 100644 index 0000000..ed89c6c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/equal.h @@ -0,0 +1,169 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function to test equality of two FSTs. + +#ifndef FST_EQUAL_H_ +#define FST_EQUAL_H_ + +#include + +#include +#include + + +namespace fst { + +constexpr uint32 kEqualFsts = 0x0001; +constexpr uint32 kEqualFstTypes = 0x0002; +constexpr uint32 kEqualCompatProperties = 0x0004; +constexpr uint32 kEqualCompatSymbols = 0x0008; +constexpr uint32 kEqualAll = + kEqualFsts | kEqualFstTypes | kEqualCompatProperties | kEqualCompatSymbols; + +class WeightApproxEqual { + public: + explicit WeightApproxEqual(float delta) : delta_(delta) {} + + template + bool operator()(const Weight &w1, const Weight &w2) const { + return ApproxEqual(w1, w2, delta_); + } + + private: + float delta_; +}; + +// Tests if two Fsts have the same states and arcs in the same order (when +// etype & kEqualFst). +// Also optional checks equality of Fst types (etype & kEqualFstTypes) and +// compatibility of stored properties (etype & kEqualCompatProperties) and +// of symbol tables (etype & kEqualCompatSymbols). +template +bool Equal(const Fst &fst1, const Fst &fst2, + WeightEqual weight_equal, uint32 etype = kEqualFsts) { + if ((etype & kEqualFstTypes) && (fst1.Type() != fst2.Type())) { + VLOG(1) << "Equal: Mismatched FST types (" << fst1.Type() << " != " + << fst2.Type() << ")"; + return false; + } + if ((etype & kEqualCompatProperties) && + !CompatProperties(fst1.Properties(kCopyProperties, false), + fst2.Properties(kCopyProperties, false))) { + VLOG(1) << "Equal: Properties not compatible"; + return false; + } + if (etype & kEqualCompatSymbols) { + if (!CompatSymbols(fst1.InputSymbols(), fst2.InputSymbols(), false)) { + VLOG(1) << "Equal: Input symbols not compatible"; + return false; + } + if (!CompatSymbols(fst1.OutputSymbols(), fst2.OutputSymbols(), false)) { + VLOG(1) << "Equal: Output symbols not compatible"; + return false; + } + } + if (!(etype & kEqualFsts)) return true; + if (fst1.Start() != fst2.Start()) { + VLOG(1) << "Equal: Mismatched start states (" << fst1.Start() << " != " + << fst2.Start() << ")"; + return false; + } + StateIterator> siter1(fst1); + StateIterator> siter2(fst2); + while (!siter1.Done() || !siter2.Done()) { + if (siter1.Done() || siter2.Done()) { + VLOG(1) << "Equal: Mismatched number of states"; + return false; + } + const auto s1 = siter1.Value(); + const auto s2 = siter2.Value(); + if (s1 != s2) { + VLOG(1) << "Equal: Mismatched states (" << s1 << "!= " + << s2 << ")"; + return false; + } + const auto &final1 = fst1.Final(s1); + const auto &final2 = fst2.Final(s2); + if (!weight_equal(final1, final2)) { + VLOG(1) << "Equal: Mismatched final weights at state " << s1 + << " (" << final1 << " != " << final2 << ")"; + return false; + } + ArcIterator> aiter1(fst1, s1); + ArcIterator> aiter2(fst2, s2); + for (auto a = 0; !aiter1.Done() || !aiter2.Done(); ++a) { + if (aiter1.Done() || aiter2.Done()) { + VLOG(1) << "Equal: Mismatched number of arcs at state " << s1; + return false; + } + const auto &arc1 = aiter1.Value(); + const auto &arc2 = aiter2.Value(); + if (arc1.ilabel != arc2.ilabel) { + VLOG(1) << "Equal: Mismatched arc input labels at state " << s1 + << ", arc " << a << " (" << arc1.ilabel << " != " + << arc2.ilabel << ")"; + return false; + } else if (arc1.olabel != arc2.olabel) { + VLOG(1) << "Equal: Mismatched arc output labels at state " << s1 + << ", arc " << a << " (" << arc1.olabel << " != " + << arc2.olabel << ")"; + return false; + } else if (!weight_equal(arc1.weight, arc2.weight)) { + VLOG(1) << "Equal: Mismatched arc weights at state " << s1 + << ", arc " << a << " (" << arc1.weight << " != " + << arc2.weight << ")"; + return false; + } else if (arc1.nextstate != arc2.nextstate) { + VLOG(1) << "Equal: Mismatched next state at state " << s1 + << ", arc " << a << " (" << arc1.nextstate << " != " + << arc2.nextstate << ")"; + return false; + } + aiter1.Next(); + aiter2.Next(); + } + // Sanity checks: should never fail. + if (fst1.NumArcs(s1) != fst2.NumArcs(s2)) { + FSTERROR() << "Equal: Inconsistent arc counts at state " << s1 + << " (" << fst1.NumArcs(s1) << " != " + << fst2.NumArcs(s2) << ")"; + return false; + } + if (fst1.NumInputEpsilons(s1) != fst2.NumInputEpsilons(s2)) { + FSTERROR() << "Equal: Inconsistent input epsilon counts at state " << s1 + << " (" << fst1.NumInputEpsilons(s1) << " != " + << fst2.NumInputEpsilons(s2) << ")"; + return false; + } + if (fst1.NumOutputEpsilons(s1) != fst2.NumOutputEpsilons(s2)) { + FSTERROR() << "Equal: Inconsistent output epsilon counts at state " << s1 + << " (" << fst1.NumOutputEpsilons(s1) << " != " + << fst2.NumOutputEpsilons(s2) << ")"; + } + siter1.Next(); + siter2.Next(); + } + return true; +} + +template +bool Equal(const Fst &fst1, const Fst &fst2, + float delta = kDelta, uint32 etype = kEqualFsts) { + return Equal(fst1, fst2, WeightApproxEqual(delta), etype); +} + +// Support double deltas without forcing all clients to cast to float. +// Without this overload, Equal will be chosen, +// since it is a better match than double -> float narrowing, but +// the instantiation will fail. +template +bool Equal(const Fst &fst1, const Fst &fst2, + double delta, uint32 etype = kEqualFsts) { + return Equal(fst1, fst2, WeightApproxEqual(static_cast(delta)), etype); +} + + +} // namespace fst + +#endif // FST_EQUAL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/equivalent.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/equivalent.h new file mode 100644 index 0000000..cf3fdb6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/equivalent.h @@ -0,0 +1,230 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to determine the equivalence of two FSTs. + +#ifndef FST_EQUIVALENT_H_ +#define FST_EQUIVALENT_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +namespace fst { +namespace internal { + +// Traits-like struct holding utility functions/typedefs/constants for +// the equivalence algorithm. +// +// Encoding device: in order to make the statesets of the two acceptors +// disjoint, we map Arc::StateId on the type MappedId. The states of +// the first acceptor are mapped on odd numbers (s -> 2s + 1), and +// those of the second one on even numbers (s -> 2s + 2). The number 0 +// is reserved for an implicit (non-final) dead state (required for +// the correct treatment of non-coaccessible states; kNoStateId is mapped to +// kDeadState for both acceptors). The union-find algorithm operates on the +// mapped IDs. +template +struct EquivalenceUtil { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using MappedId = StateId; // ID for an equivalence class. + + // MappedId for an implicit dead state. + static constexpr MappedId kDeadState = 0; + + // MappedId for lookup failure. + static constexpr MappedId kInvalidId = -1; + + // Maps state ID to the representative of the corresponding + // equivalence class. The parameter 'which_fst' takes the values 1 + // and 2, identifying the input FST. + static MappedId MapState(StateId s, int32 which_fst) { + return (kNoStateId == s) ? kDeadState + : (static_cast(s) << 1) + which_fst; + } + + // Maps set ID to State ID. + static StateId UnMapState(MappedId id) { + return static_cast((--id) >> 1); + } + + // Convenience function: checks if state with MappedId s is final in + // acceptor fa. + static bool IsFinal(const Fst &fa, MappedId s) { + return (kDeadState == s) ? false + : (fa.Final(UnMapState(s)) != Weight::Zero()); + } + // Convenience function: returns the representative of ID in sets, + // creating a new set if needed. + static MappedId FindSet(UnionFind *sets, MappedId id) { + const auto repr = sets->FindSet(id); + if (repr != kInvalidId) { + return repr; + } else { + sets->MakeSet(id); + return id; + } + } +}; + +template +constexpr + typename EquivalenceUtil::MappedId EquivalenceUtil::kDeadState; + +template +constexpr + typename EquivalenceUtil::MappedId EquivalenceUtil::kInvalidId; + +} // namespace internal + +// Equivalence checking algorithm: determines if the two FSTs fst1 and fst2 +// are equivalent. The input FSTs must be deterministic input-side epsilon-free +// acceptors, unweighted or with weights over a left semiring. Two acceptors are +// considered equivalent if they accept exactly the same set of strings (with +// the same weights). +// +// The algorithm (cf. Aho, Hopcroft and Ullman, "The Design and Analysis of +// Computer Programs") successively constructs sets of states that can be +// reached by the same prefixes, starting with a set containing the start states +// of both acceptors. A disjoint tree forest (the union-find algorithm) is used +// to represent the sets of states. The algorithm returns false if one of the +// constructed sets contains both final and non-final states. Returns an +// optional error value (useful when FLAGS_error_fatal = false). +// +// Complexity: +// +// Quasi-linear, i.e., O(n G(n)), where +// +// n = |S1| + |S2| is the number of states in both acceptors +// +// G(n) is a very slowly growing function that can be approximated +// by 4 by all practical purposes. +template +bool Equivalent(const Fst &fst1, const Fst &fst2, + float delta = kDelta, bool *error = nullptr) { + using Weight = typename Arc::Weight; + if (error) *error = false; + // Check that the symbol table are compatible. + if (!CompatSymbols(fst1.InputSymbols(), fst2.InputSymbols()) || + !CompatSymbols(fst1.OutputSymbols(), fst2.OutputSymbols())) { + FSTERROR() << "Equivalent: Input/output symbol tables of 1st argument " + << "do not match input/output symbol tables of 2nd argument"; + if (error) *error = true; + return false; + } + // Check properties first. + static constexpr auto props = kNoEpsilons | kIDeterministic | kAcceptor; + if (fst1.Properties(props, true) != props) { + FSTERROR() << "Equivalent: 1st argument not an" + << " epsilon-free deterministic acceptor"; + if (error) *error = true; + return false; + } + if (fst2.Properties(props, true) != props) { + FSTERROR() << "Equivalent: 2nd argument not an" + << " epsilon-free deterministic acceptor"; + if (error) *error = true; + return false; + } + if ((fst1.Properties(kUnweighted, true) != kUnweighted) || + (fst2.Properties(kUnweighted, true) != kUnweighted)) { + VectorFst efst1(fst1); + VectorFst efst2(fst2); + Push(&efst1, REWEIGHT_TO_INITIAL, delta); + Push(&efst2, REWEIGHT_TO_INITIAL, delta); + ArcMap(&efst1, QuantizeMapper(delta)); + ArcMap(&efst2, QuantizeMapper(delta)); + EncodeMapper mapper(kEncodeWeights | kEncodeLabels, ENCODE); + ArcMap(&efst1, &mapper); + ArcMap(&efst2, &mapper); + return Equivalent(efst1, efst2); + } + using Util = internal::EquivalenceUtil; + using MappedId = typename Util::MappedId; + enum { FST1 = 1, FST2 = 2 }; // Required by Util::MapState(...) + auto s1 = Util::MapState(fst1.Start(), FST1); + auto s2 = Util::MapState(fst2.Start(), FST2); + // The union-find structure. + UnionFind eq_classes(1000, Util::kInvalidId); + // Initializes the union-find structure. + eq_classes.MakeSet(s1); + eq_classes.MakeSet(s2); + // Data structure for the (partial) acceptor transition function of fst1 and + // fst2: input labels mapped to pairs of MappedIds representing destination + // states of the corresponding arcs in fst1 and fst2, respectively. + using Label2StatePairMap = + std::unordered_map>; + Label2StatePairMap arc_pairs; + // Pairs of MappedId's to be processed, organized in a queue. + std::deque> q; + bool ret = true; + // Returns early if the start states differ w.r.t. finality. + if (Util::IsFinal(fst1, s1) != Util::IsFinal(fst2, s2)) ret = false; + // Main loop: explores the two acceptors in a breadth-first manner, updating + // the equivalence relation on the statesets. Loop invariant: each block of + // the states contains either final states only or non-final states only. + for (q.push_back(std::make_pair(s1, s2)); ret && !q.empty(); q.pop_front()) { + s1 = q.front().first; + s2 = q.front().second; + // Representatives of the equivalence classes of s1/s2. + const auto rep1 = Util::FindSet(&eq_classes, s1); + const auto rep2 = Util::FindSet(&eq_classes, s2); + if (rep1 != rep2) { + eq_classes.Union(rep1, rep2); + arc_pairs.clear(); + // Copies outgoing arcs starting at s1 into the hash-table. + if (Util::kDeadState != s1) { + ArcIterator> arc_iter(fst1, Util::UnMapState(s1)); + for (; !arc_iter.Done(); arc_iter.Next()) { + const auto &arc = arc_iter.Value(); + // Zero-weight arcs are treated as if they did not exist. + if (arc.weight != Weight::Zero()) { + arc_pairs[arc.ilabel].first = Util::MapState(arc.nextstate, FST1); + } + } + } + // Copies outgoing arcs starting at s2 into the hashtable. + if (Util::kDeadState != s2) { + ArcIterator> arc_iter(fst2, Util::UnMapState(s2)); + for (; !arc_iter.Done(); arc_iter.Next()) { + const auto &arc = arc_iter.Value(); + // Zero-weight arcs are treated as if they did not exist. + if (arc.weight != Weight::Zero()) { + arc_pairs[arc.ilabel].second = Util::MapState(arc.nextstate, FST2); + } + } + } + // Iterates through the hashtable and process pairs of target states. + for (const auto &arc_iter : arc_pairs) { + const auto &pair = arc_iter.second; + if (Util::IsFinal(fst1, pair.first) != + Util::IsFinal(fst2, pair.second)) { + // Detected inconsistency: return false. + ret = false; + break; + } + q.push_back(pair); + } + } + } + if (fst1.Properties(kError, false) || fst2.Properties(kError, false)) { + if (error) *error = true; + return false; + } + return ret; +} + +} // namespace fst + +#endif // FST_EQUIVALENT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/expanded-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/expanded-fst.h new file mode 100644 index 0000000..2c7d514 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/expanded-fst.h @@ -0,0 +1,179 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Generic FST augmented with state count-interface class definition. + +#ifndef FST_EXPANDED_FST_H_ +#define FST_EXPANDED_FST_H_ + +#include +#include +#include +#include + +#include +#include + +#include + + +namespace fst { + +// A generic FST plus state count. +template +class ExpandedFst : public Fst { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + virtual StateId NumStates() const = 0; // State count + + // Get a copy of this ExpandedFst. See Fst<>::Copy() for further doc. + ExpandedFst *Copy(bool safe = false) const override = 0; + + // Read an ExpandedFst from an input stream; return NULL on error. + static ExpandedFst *Read(std::istream &strm, + const FstReadOptions &opts) { + FstReadOptions ropts(opts); + FstHeader hdr; + if (ropts.header) { + hdr = *opts.header; + } else { + if (!hdr.Read(strm, opts.source)) return nullptr; + ropts.header = &hdr; + } + if (!(hdr.Properties() & kExpanded)) { + LOG(ERROR) << "ExpandedFst::Read: Not an ExpandedFst: " << ropts.source; + return nullptr; + } + const auto reader = + FstRegister::GetRegister()->GetReader(hdr.FstType()); + if (!reader) { + LOG(ERROR) << "ExpandedFst::Read: Unknown FST type \"" << hdr.FstType() + << "\" (arc type = \"" << A::Type() << "\"): " << ropts.source; + return nullptr; + } + auto *fst = reader(strm, ropts); + if (!fst) return nullptr; + return static_cast *>(fst); + } + + // Read an ExpandedFst from a file; return NULL on error. + // Empty filename reads from standard input. + static ExpandedFst *Read(const string &filename) { + if (!filename.empty()) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "ExpandedFst::Read: Can't open file: " << filename; + return nullptr; + } + return Read(strm, FstReadOptions(filename)); + } else { + return Read(std::cin, FstReadOptions("standard input")); + } + } +}; + +namespace internal { + +// ExpandedFst case - abstract methods. +template +inline typename Arc::Weight Final(const ExpandedFst &fst, + typename Arc::StateId s) { + return fst.Final(s); +} + +template +inline ssize_t NumArcs(const ExpandedFst &fst, typename Arc::StateId s) { + return fst.NumArcs(s); +} + +template +inline ssize_t NumInputEpsilons(const ExpandedFst &fst, + typename Arc::StateId s) { + return fst.NumInputEpsilons(s); +} + +template +inline ssize_t NumOutputEpsilons(const ExpandedFst &fst, + typename Arc::StateId s) { + return fst.NumOutputEpsilons(s); +} + +} // namespace internal + +// A useful alias when using StdArc. +using StdExpandedFst = ExpandedFst; + +// This is a helper class template useful for attaching an ExpandedFst +// interface to its implementation, handling reference counting. It +// delegates to ImplToFst the handling of the Fst interface methods. +template > +class ImplToExpandedFst : public ImplToFst { + public: + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + StateId NumStates() const override { return GetImpl()->NumStates(); } + + protected: + using ImplToFst::GetImpl; + + explicit ImplToExpandedFst(std::shared_ptr impl) + : ImplToFst(impl) {} + + ImplToExpandedFst(const ImplToExpandedFst &fst, bool safe) + : ImplToFst(fst, safe) {} + + static Impl *Read(std::istream &strm, const FstReadOptions &opts) { + return Impl::Read(strm, opts); + } + + // Read FST implementation from a file; return NULL on error. + // Empty filename reads from standard input. + static Impl *Read(const string &filename) { + if (!filename.empty()) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "ExpandedFst::Read: Can't open file: " << filename; + return nullptr; + } + return Impl::Read(strm, FstReadOptions(filename)); + } else { + return Impl::Read(std::cin, FstReadOptions("standard input")); + } + } +}; + +// Function to return the number of states in an FST, counting them +// if necessary. +template +typename Arc::StateId CountStates(const Fst &fst) { + if (fst.Properties(kExpanded, false)) { + const auto *efst = static_cast *>(&fst); + return efst->NumStates(); + } else { + typename Arc::StateId nstates = 0; + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + ++nstates; + } + return nstates; + } +} + +// Function to return the number of arcs in an FST. +template +typename Arc::StateId CountArcs(const Fst &fst) { + size_t narcs = 0; + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + narcs += fst.NumArcs(siter.Value()); + } + return narcs; +} + +} // namespace fst + +#endif // FST_EXPANDED_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/expectation-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/expectation-weight.h new file mode 100644 index 0000000..f996cbc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/expectation-weight.h @@ -0,0 +1,134 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Expectation semiring as described by Jason Eisner: +// See: doi=10.1.1.22.9398 +// Multiplex semiring operations and identities: +// One: +// Zero: +// Plus: + = < (a1 + a2) , (b1 + b2) > +// Times: * = < (a1 * a2) , [(a1 * b2) + (a2 * b1)] > +// Division: Undefined (currently) +// +// Usually used to store the pair so that +// ShortestDistance[Fst>>] +// == < PosteriorProbability, Expected_Value[V] > + +#ifndef FST_EXPECTATION_WEIGHT_H_ +#define FST_EXPECTATION_WEIGHT_H_ + +#include + +#include + +#include +#include + + +namespace fst { + +// X1 is usually a probability weight like LogWeight. +// X2 is usually a random variable or vector (see SignedLogWeight or +// SparsePowerWeight). +// +// If X1 is distinct from X2, it is required that there is an external product +// between X1 and X2 and if both semriring are commutative, or left or right +// semirings, then result must have those properties. +template +class ExpectationWeight : public PairWeight { + public: + using PairWeight::Value1; + using PairWeight::Value2; + + using PairWeight::Reverse; + using PairWeight::Quantize; + using PairWeight::Member; + + using ReverseWeight = + ExpectationWeight; + + ExpectationWeight() : PairWeight(Zero()) {} + + explicit ExpectationWeight(const PairWeight &weight) + : PairWeight(weight) {} + + ExpectationWeight(const X1 &x1, const X2 &x2) : PairWeight(x1, x2) {} + + static const ExpectationWeight &Zero() { + static const ExpectationWeight zero(X1::Zero(), X2::Zero()); + return zero; + } + + static const ExpectationWeight &One() { + static const ExpectationWeight one(X1::One(), X2::Zero()); + return one; + } + + static const ExpectationWeight &NoWeight() { + static const ExpectationWeight no_weight(X1::NoWeight(), X2::NoWeight()); + return no_weight; + } + + static const string &Type() { + static const string *const type = + new string("expectation_" + X1::Type() + "_" + X2::Type()); + return *type; + } + + PairWeight Quantize(float delta = kDelta) const { + return ExpectationWeight(PairWeight::Quantize()); + } + + ReverseWeight Reverse() const { + return ReverseWeight(PairWeight::Reverse()); + } + + bool Member() const { return PairWeight::Member(); } + + static constexpr uint64 Properties() { + return X1::Properties() & X2::Properties() & + (kLeftSemiring | kRightSemiring | kCommutative | kIdempotent); + } +}; + +template +inline ExpectationWeight Plus(const ExpectationWeight &w1, + const ExpectationWeight &w2) { + return ExpectationWeight(Plus(w1.Value1(), w2.Value1()), + Plus(w1.Value2(), w2.Value2())); +} + +template +inline ExpectationWeight Times(const ExpectationWeight &w1, + const ExpectationWeight &w2) { + return ExpectationWeight( + Times(w1.Value1(), w2.Value1()), + Plus(Times(w1.Value1(), w2.Value2()), Times(w1.Value2(), w2.Value1()))); +} + +template +inline ExpectationWeight Divide(const ExpectationWeight &w1, + const ExpectationWeight &w2, + DivideType typ = DIVIDE_ANY) { + FSTERROR() << "ExpectationWeight::Divide: Not implemented"; + return ExpectationWeight::NoWeight(); +} + +// This function object generates weights by calling the underlying generators +// for the template weight types, like all other pair weight types. This is +// intended primarily for testing. +template +class WeightGenerate> + : public WeightGenerate> { + public: + using Weight = ExpectationWeight; + using Generate = WeightGenerate>; + + explicit WeightGenerate(bool allow_zero = true) : Generate(allow_zero) {} + + Weight operator()() const { return Weight(Generate::operator()()); } +}; + +} // namespace fst + +#endif // FST_EXPECTATION_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/compress/compress-script.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/compress/compress-script.h new file mode 100644 index 0000000..bad238a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/compress/compress-script.h @@ -0,0 +1,53 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Declarations of 'scriptable' versions of compression operations, that is, +// those that can be called with FstClass-type arguments. + +#ifndef FST_EXTENSIONS_COMPRESS_COMPRESS_SCRIPT_H_ +#define FST_EXTENSIONS_COMPRESS_COMPRESS_SCRIPT_H_ + +#include +#include + +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +typedef std::tuple CompressArgs; + +template +void Compress(CompressArgs *args) { + const Fst &fst = *(std::get<0>(*args).GetFst()); + const string &filename = std::get<1>(*args); + const bool gzip = std::get<2>(*args); + + if (!fst::Compress(fst, filename, gzip)) FSTERROR() << "Compress: failed"; +} + +void Compress(const FstClass &fst, const string &filename, const bool gzip); + +typedef std::tuple + DecompressArgs; + +template +void Decompress(DecompressArgs *args) { + const string &filename = std::get<0>(*args); + MutableFst *fst = std::get<1>(*args)->GetMutableFst(); + const bool gzip = std::get<2>(*args); + + if (!fst::Decompress(filename, fst, gzip)) + FSTERROR() << "Decompress: failed"; +} + +void Decompress(const string &filename, MutableFstClass *fst, const bool gzip); + +} // namespace script +} // namespace fst + +#endif // FST_EXTENSIONS_COMPRESS_COMPRESS_SCRIPT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/compress/compress.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/compress/compress.h new file mode 100644 index 0000000..aa94848 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/compress/compress.h @@ -0,0 +1,906 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Compresses and decompresses unweighted FSTs. + +#ifndef FST_EXTENSIONS_COMPRESS_COMPRESS_H_ +#define FST_EXTENSIONS_COMPRESS_COMPRESS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fst { + +// Identifies stream data as a vanilla compressed FST. +static const int32 kCompressMagicNumber = 1858869554; +// Identifies stream data as (probably) a Gzip file accidentally read from +// a vanilla stream, without gzip support. +static const int32 kGzipMagicNumber = 0x8b1f; +// Selects the two most significant bytes. +constexpr uint32 kGzipMask = 0xffffffff >> 16; + +namespace internal { + +// Expands a Lempel Ziv code and returns the set of code words. expanded_code[i] +// is the i^th Lempel Ziv codeword. +template +bool ExpandLZCode(const std::vector> &code, + std::vector> *expanded_code) { + expanded_code->resize(code.size()); + for (int i = 0; i < code.size(); ++i) { + if (code[i].first > i) { + LOG(ERROR) << "ExpandLZCode: Not a valid code"; + return false; + } + if (code[i].first == 0) { + (*expanded_code)[i].resize(1, code[i].second); + } else { + (*expanded_code)[i].resize((*expanded_code)[code[i].first - 1].size() + + 1); + std::copy((*expanded_code)[code[i].first - 1].begin(), + (*expanded_code)[code[i].first - 1].end(), + (*expanded_code)[i].begin()); + (*expanded_code)[i][(*expanded_code)[code[i].first - 1].size()] = + code[i].second; + } + } + return true; +} + +} // namespace internal + +// Lempel Ziv on data structure Edge, with a less than operator +// EdgeLessThan and an equals operator EdgeEquals. +// Edge has a value defaultedge which it never takes and +// Edge is defined, it is initialized to defaultedge +template +class LempelZiv { + public: + LempelZiv() : dict_number_(0), default_edge_() { + root_.current_number = dict_number_++; + root_.current_edge = default_edge_; + decode_vector_.push_back(std::make_pair(0, default_edge_)); + } + // Encodes a vector input into output + void BatchEncode(const std::vector &input, + std::vector> *output); + + // Decodes codedvector to output. Returns false if + // the index exceeds the size. + bool BatchDecode(const std::vector> &input, + std::vector *output); + + // Decodes a single dictionary element. Returns false + // if the index exceeds the size. + bool SingleDecode(const Var &index, Edge *output) { + if (index >= decode_vector_.size()) { + LOG(ERROR) << "LempelZiv::SingleDecode: " + << "Index exceeded the dictionary size"; + return false; + } else { + *output = decode_vector_[index].second; + return true; + } + } + + ~LempelZiv() { + for (auto it = (root_.next_number).begin(); it != (root_.next_number).end(); + ++it) { + CleanUp(it->second); + } + } + // Adds a single dictionary element while decoding + // void AddDictElement(const std::pair &newdict) { + // EdgeEquals InstEdgeEquals; + // if (InstEdgeEquals(newdict.second, default_edge_) != 1) + // decode_vector_.push_back(newdict); + // } + + private: + // Node datastructure is used for encoding + + struct Node { + Var current_number; + Edge current_edge; + std::map next_number; + }; + + void CleanUp(Node *temp) { + for (auto it = (temp->next_number).begin(); it != (temp->next_number).end(); + ++it) { + CleanUp(it->second); + } + delete temp; + } + Node root_; + Var dict_number_; + // decode_vector_ is used for decoding + std::vector> decode_vector_; + Edge default_edge_; +}; + +template +void LempelZiv::BatchEncode( + const std::vector &input, std::vector> *output) { + for (typename std::vector::const_iterator it = input.begin(); + it != input.end(); ++it) { + Node *temp_node = &root_; + while (it != input.end()) { + auto next = (temp_node->next_number).find(*it); + if (next != (temp_node->next_number).end()) { + temp_node = next->second; + ++it; + } else { + break; + } + } + if (it == input.end() && temp_node->current_number != 0) { + output->push_back( + std::make_pair(temp_node->current_number, default_edge_)); + } else if (it != input.end()) { + output->push_back(std::make_pair(temp_node->current_number, *it)); + Node *new_node = new (Node); + new_node->current_number = dict_number_++; + new_node->current_edge = *it; + (temp_node->next_number)[*it] = new_node; + } + if (it == input.end()) break; + } +} + +template +bool LempelZiv::BatchDecode( + const std::vector> &input, std::vector *output) { + for (typename std::vector>::const_iterator it = + input.begin(); + it != input.end(); ++it) { + std::vector temp_output; + EdgeEquals InstEdgeEquals; + if (InstEdgeEquals(it->second, default_edge_) != 1) { + decode_vector_.push_back(*it); + temp_output.push_back(it->second); + } + Var temp_integer = it->first; + if (temp_integer >= decode_vector_.size()) { + LOG(ERROR) << "LempelZiv::BatchDecode: " + << "Index exceeded the dictionary size"; + return false; + } else { + while (temp_integer != 0) { + temp_output.push_back(decode_vector_[temp_integer].second); + temp_integer = decode_vector_[temp_integer].first; + } + std::reverse(temp_output.begin(), temp_output.end()); + output->insert(output->end(), temp_output.begin(), temp_output.end()); + } + } + return true; +} + +// The main Compressor class +template +class Compressor { + public: + typedef typename Arc::StateId StateId; + typedef typename Arc::Label Label; + typedef typename Arc::Weight Weight; + + Compressor() {} + + // Compresses fst into a boolean vector code. Returns true on sucesss. + bool Compress(const Fst &fst, std::ostream &strm); + + // Decompresses the boolean vector into Fst. Returns true on sucesss. + bool Decompress(std::istream &strm, const string &source, + MutableFst *fst); + + // Finds the BFS order of a fst + void BfsOrder(const ExpandedFst &fst, std::vector *order); + + // Preprocessing step to convert fst to a isomorphic fst + // Returns a preproccess fst and a dictionary + void Preprocess(const Fst &fst, MutableFst *preprocessedfst, + EncodeMapper *encoder); + + // Performs Lempel Ziv and outputs a stream of integers + // and sends it to a stream + void EncodeProcessedFst(const ExpandedFst &fst, std::ostream &strm); + + // Decodes fst from the stream + void DecodeProcessedFst(const std::vector &input, + MutableFst *fst, bool unweighted); + + // Converts buffer_code_ to uint8 and writes to a stream. + + // Writes the boolean file to the stream + void WriteToStream(std::ostream &strm); + + // Writes the weights to the stream + void WriteWeight(const std::vector &input, std::ostream &strm); + + void ReadWeight(std::istream &strm, std::vector *output); + + // Same as fst::Decode without the line RmFinalEpsilon(fst) + void DecodeForCompress(MutableFst *fst, const EncodeMapper &mapper); + + // Updates the buffer_code_ + template + void WriteToBuffer(CVar input) { + std::vector current_code; + Elias::DeltaEncode(input, ¤t_code); + if (!buffer_code_.empty()) { + buffer_code_.insert(buffer_code_.end(), current_code.begin(), + current_code.end()); + } else { + buffer_code_.assign(current_code.begin(), current_code.end()); + } + } + + private: + struct LZLabel { + LZLabel() : label(0) {} + Label label; + }; + + struct LabelLessThan { + bool operator()(const LZLabel &labelone, const LZLabel &labeltwo) const { + return labelone.label < labeltwo.label; + } + }; + + struct LabelEquals { + bool operator()(const LZLabel &labelone, const LZLabel &labeltwo) const { + return labelone.label == labeltwo.label; + } + }; + + struct Transition { + Transition() : nextstate(0), label(0), weight(Weight::Zero()) {} + + StateId nextstate; + Label label; + Weight weight; + }; + + struct TransitionLessThan { + bool operator()(const Transition &transition_one, + const Transition &transition_two) const { + if (transition_one.nextstate == transition_two.nextstate) + return transition_one.label < transition_two.label; + else + return transition_one.nextstate < transition_two.nextstate; + } + } transition_less_than; + + struct TransitionEquals { + bool operator()(const Transition &transition_one, + const Transition &transition_two) const { + return transition_one.nextstate == transition_two.nextstate && + transition_one.label == transition_two.label; + } + } transition_equals; + + struct OldDictCompare { + bool operator()(const std::pair &pair_one, + const std::pair &pair_two) const { + if ((pair_one.second).nextstate == (pair_two.second).nextstate) + return (pair_one.second).label < (pair_two.second).label; + else + return (pair_one.second).nextstate < (pair_two.second).nextstate; + } + } old_dict_compare; + + std::vector buffer_code_; + std::vector arc_weight_; + std::vector final_weight_; +}; + +template +inline void Compressor::DecodeForCompress( + MutableFst *fst, const EncodeMapper &mapper) { + ArcMap(fst, EncodeMapper(mapper, DECODE)); + fst->SetInputSymbols(mapper.InputSymbols()); + fst->SetOutputSymbols(mapper.OutputSymbols()); +} + +// Compressor::BfsOrder +template +void Compressor::BfsOrder(const ExpandedFst &fst, + std::vector *order) { + Arc arc; + StateId bfs_visit_number = 0; + std::queue states_queue; + order->assign(fst.NumStates(), kNoStateId); + states_queue.push(fst.Start()); + (*order)[fst.Start()] = bfs_visit_number++; + while (!states_queue.empty()) { + for (ArcIterator> aiter(fst, states_queue.front()); !aiter.Done(); + aiter.Next()) { + arc = aiter.Value(); + StateId nextstate = arc.nextstate; + if ((*order)[nextstate] == kNoStateId) { + (*order)[nextstate] = bfs_visit_number++; + states_queue.push(nextstate); + } + } + states_queue.pop(); + } + + // If the FST is unconnected, then the following + // code finds them + while (bfs_visit_number < fst.NumStates()) { + int unseen_state = 0; + for (unseen_state = 0; unseen_state < fst.NumStates(); ++unseen_state) { + if ((*order)[unseen_state] == kNoStateId) break; + } + states_queue.push(unseen_state); + (*order)[unseen_state] = bfs_visit_number++; + while (!states_queue.empty()) { + for (ArcIterator> aiter(fst, states_queue.front()); + !aiter.Done(); aiter.Next()) { + arc = aiter.Value(); + StateId nextstate = arc.nextstate; + if ((*order)[nextstate] == kNoStateId) { + (*order)[nextstate] = bfs_visit_number++; + states_queue.push(nextstate); + } + } + states_queue.pop(); + } + } +} + +template +void Compressor::Preprocess(const Fst &fst, + MutableFst *preprocessedfst, + EncodeMapper *encoder) { + *preprocessedfst = fst; + if (!preprocessedfst->NumStates()) { + return; + } + // Relabels the edges and develops a dictionary + Encode(preprocessedfst, encoder); + std::vector order; + // Finds the BFS sorting order of the fst + BfsOrder(*preprocessedfst, &order); + // Reorders the states according to the BFS order + StateSort(preprocessedfst, order); +} + +template +void Compressor::EncodeProcessedFst(const ExpandedFst &fst, + std::ostream &strm) { + std::vector output; + LempelZiv dict_new; + LempelZiv dict_old; + std::vector current_new_input; + std::vector current_old_input; + std::vector> current_new_output; + std::vector> current_old_output; + std::vector final_states; + + StateId number_of_states = fst.NumStates(); + + StateId seen_states = 0; + // Adding the number of states + WriteToBuffer(number_of_states); + + for (StateId state = 0; state < number_of_states; ++state) { + current_new_input.clear(); + current_old_input.clear(); + current_new_output.clear(); + current_old_output.clear(); + if (state > seen_states) ++seen_states; + + // Collecting the final states + if (fst.Final(state) != Weight::Zero()) { + final_states.push_back(state); + final_weight_.push_back(fst.Final(state)); + } + + // Reading the states + for (ArcIterator> aiter(fst, state); !aiter.Done(); aiter.Next()) { + Arc arc = aiter.Value(); + if (arc.nextstate > seen_states) { // RILEY: > or >= ? + ++seen_states; + LZLabel temp_label; + temp_label.label = arc.ilabel; + arc_weight_.push_back(arc.weight); + current_new_input.push_back(temp_label); + } else { + Transition temp_transition; + temp_transition.nextstate = arc.nextstate; + temp_transition.label = arc.ilabel; + temp_transition.weight = arc.weight; + current_old_input.push_back(temp_transition); + } + } + // Adding new states + dict_new.BatchEncode(current_new_input, ¤t_new_output); + WriteToBuffer(current_new_output.size()); + + for (auto it = current_new_output.begin(); it != current_new_output.end(); + ++it) { + WriteToBuffer(it->first); + WriteToBuffer. +// See the FarReader interface in far.h for the exact semantics. +class FarReaderImplBase { + public: + virtual const string &ArcType() const = 0; + virtual bool Done() const = 0; + virtual bool Error() const = 0; + virtual const string &GetKey() const = 0; + virtual const FstClass *GetFstClass() const = 0; + virtual bool Find(const string &key) = 0; + virtual void Next() = 0; + virtual void Reset() = 0; + virtual FarType Type() const = 0; + virtual ~FarReaderImplBase() {} +}; + +// Templated implementation. +template +class FarReaderClassImpl : public FarReaderImplBase { + public: + explicit FarReaderClassImpl(const string &filename) + : impl_(FarReader::Open(filename)) {} + + explicit FarReaderClassImpl(const std::vector &filenames) + : impl_(FarReader::Open(filenames)) {} + + const string &ArcType() const final { return Arc::Type(); } + + bool Done() const final { return impl_->Done(); } + + bool Error() const final { return impl_->Error(); } + + bool Find(const string &key) final { return impl_->Find(key); } + + const FstClass *GetFstClass() const final { + fstc_.reset(new FstClass(*impl_->GetFst())); + return fstc_.get(); + } + + const string &GetKey() const final { return impl_->GetKey(); } + + void Next() final { return impl_->Next(); } + + void Reset() final { impl_->Reset(); } + + FarType Type() const final { return impl_->Type(); } + + const FarReader *GetImpl() const { return impl_.get(); } + + FarReader *GetImpl() { return impl_.get(); } + + private: + std::unique_ptr> impl_; + mutable std::unique_ptr fstc_; +}; + + +class FarReaderClass; + +using OpenFarReaderClassArgs = + WithReturnValue &>; + +// Untemplated user-facing class holding a templated pimpl. +class FarReaderClass { + public: + const string &ArcType() const { return impl_->ArcType(); } + + bool Done() const { return impl_->Done(); } + + // Returns True if the impl is null (i.e., due to read failure). + // Attempting to call any other function will result in null dereference. + bool Error() const { return (impl_) ? impl_->Error() : true; } + + bool Find(const string &key) { return impl_->Find(key); } + + const FstClass *GetFstClass() const { return impl_->GetFstClass(); } + + const string &GetKey() const { return impl_->GetKey(); } + + void Next() { impl_->Next(); } + + void Reset() { impl_->Reset(); } + + FarType Type() const { return impl_->Type(); } + + template + const FarReader *GetFarReader() const { + if (Arc::Type() != ArcType()) return nullptr; + const FarReaderClassImpl *typed_impl = + static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + + template + FarReader *GetFarReader() { + if (Arc::Type() != ArcType()) return nullptr; + FarReaderClassImpl *typed_impl = + static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + + template + friend void OpenFarReaderClass(OpenFarReaderClassArgs *args); + + // Defined in the CC. + + static FarReaderClass *Open(const string &filename); + + static FarReaderClass *Open(const std::vector &filenames); + + private: + template + explicit FarReaderClass(FarReaderClassImpl *impl) : impl_(impl) {} + + std::unique_ptr impl_; +}; + +// These exist solely for registration purposes; users should call the +// static method FarReaderClass::Open instead. + +template +void OpenFarReaderClass(OpenFarReaderClassArgs *args) { + args->retval = new FarReaderClass(new FarReaderClassImpl(args->args)); +} + +// FarWriter API. + +// Virtual interface implemented by each concrete FarWriterImpl. +class FarWriterImplBase { + public: + // Unlike the lower-level library, this returns a boolean to signal failure + // due to non-conformant arc types. + virtual bool Add(const string &key, const FstClass &fst) = 0; + virtual const string &ArcType() const = 0; + virtual bool Error() const = 0; + virtual FarType Type() const = 0; + virtual ~FarWriterImplBase() {} +}; + + +// Templated implementation. +template +class FarWriterClassImpl : public FarWriterImplBase { + public: + explicit FarWriterClassImpl(const string &filename, + FarType type = FAR_DEFAULT) + : impl_(FarWriter::Create(filename, type)) {} + + bool Add(const string &key, const FstClass &fst) final { + if (ArcType() != fst.ArcType()) { + FSTERROR() << "Cannot write FST with " << fst.ArcType() << " arcs to " + << "FAR with " << ArcType() << " arcs"; + return false; + } + impl_->Add(key, *(fst.GetFst())); + return true; + } + + const string &ArcType() const final { return Arc::Type(); } + + bool Error() const final { return impl_->Error(); } + + FarType Type() const final { return impl_->Type(); } + + const FarWriter *GetImpl() const { return impl_.get(); } + + FarWriter *GetImpl() { return impl_.get(); } + + private: + std::unique_ptr> impl_; +}; + + +class FarWriterClass; + +using CreateFarWriterClassInnerArgs = std::pair; + +using CreateFarWriterClassArgs = + WithReturnValue; + +// Untemplated user-facing class holding a templated pimpl. +class FarWriterClass { + public: + static FarWriterClass *Create(const string &filename, const string &arc_type, + FarType type = FAR_DEFAULT); + + bool Add(const string &key, const FstClass &fst) { + return impl_->Add(key, fst); + } + + // Returns True if the impl is null (i.e., due to construction failure). + // Attempting to call any other function will result in null dereference. + bool Error() const { return (impl_) ? impl_->Error() : true; } + + const string &ArcType() const { return impl_->ArcType(); } + + FarType Type() const { return impl_->Type(); } + + template + const FarWriter *GetFarWriter() const { + if (Arc::Type() != ArcType()) return nullptr; + const FarWriterClassImpl *typed_impl = + static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + + template + FarWriter *GetFarWriter() { + if (Arc::Type() != ArcType()) return nullptr; + FarWriterClassImpl *typed_impl = + static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + + template + friend void CreateFarWriterClass(CreateFarWriterClassArgs *args); + + private: + template + explicit FarWriterClass(FarWriterClassImpl *impl) : impl_(impl) {} + + std::unique_ptr impl_; +}; + +// This exists solely for registration purposes; users should call the +// static method FarWriterClass::Create instead. +template +void CreateFarWriterClass(CreateFarWriterClassArgs *args) { + args->retval = new FarWriterClass(new FarWriterClassImpl( + std::get<0>(args->args), std::get<1>(args->args))); +} + +} // namespace script +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_FAR_CLASS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/far.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/far.h new file mode 100644 index 0000000..c24c7da --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/far.h @@ -0,0 +1,481 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Finite-State Transducer (FST) archive classes. + +#ifndef FST_EXTENSIONS_FAR_FAR_H_ +#define FST_EXTENSIONS_FAR_FAR_H_ + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace fst { + +enum FarEntryType { FET_LINE, FET_FILE }; + +enum FarTokenType { FTT_SYMBOL, FTT_BYTE, FTT_UTF8 }; + +inline bool IsFst(const string &filename) { + std::ifstream strm(filename, std::ios_base::in | std::ios_base::binary); + if (!strm) return false; + return IsFstHeader(strm, filename); +} + +// FST archive header class +class FarHeader { + public: + const string &ArcType() const { return arctype_; } + + const string &FarType() const { return fartype_; } + + bool Read(const string &filename) { + FstHeader fsthdr; + if (filename.empty()) { + // Header reading unsupported on stdin. Assumes STList and StdArc. + fartype_ = "stlist"; + arctype_ = "standard"; + return true; + } else if (IsSTTable(filename)) { // Checks if STTable. + ReadSTTableHeader(filename, &fsthdr); + fartype_ = "sttable"; + arctype_ = fsthdr.ArcType().empty() ? "unknown" : fsthdr.ArcType(); + return true; + } else if (IsSTList(filename)) { // Checks if STList. + ReadSTListHeader(filename, &fsthdr); + fartype_ = "stlist"; + arctype_ = fsthdr.ArcType().empty() ? "unknown" : fsthdr.ArcType(); + return true; + } else if (IsFst(filename)) { // Checks if FST. + std::ifstream istrm(filename, + std::ios_base::in | std::ios_base::binary); + fsthdr.Read(istrm, filename); + fartype_ = "fst"; + arctype_ = fsthdr.ArcType().empty() ? "unknown" : fsthdr.ArcType(); + return true; + } + return false; + } + + private: + string fartype_; + string arctype_; +}; + +enum FarType { + FAR_DEFAULT = 0, + FAR_STTABLE = 1, + FAR_STLIST = 2, + FAR_FST = 3, +}; + +// This class creates an archive of FSTs. +template +class FarWriter { + public: + using Arc = A; + + // Creates a new (empty) FST archive; returns null on error. + static FarWriter *Create(const string &filename, FarType type = FAR_DEFAULT); + + // Adds an FST to the end of an archive. Keys must be non-empty and + // in lexicographic order. FSTs must have a suitable write method. + virtual void Add(const string &key, const Fst &fst) = 0; + + virtual FarType Type() const = 0; + + virtual bool Error() const = 0; + + virtual ~FarWriter() {} + + protected: + FarWriter() {} +}; + +// This class iterates through an existing archive of FSTs. +template +class FarReader { + public: + using Arc = A; + + // Opens an existing FST archive in a single file; returns null on error. + // Sets current position to the beginning of the achive. + static FarReader *Open(const string &filename); + + // Opens an existing FST archive in multiple files; returns null on error. + // Sets current position to the beginning of the achive. + static FarReader *Open(const std::vector &filenames); + + // Resets current position to beginning of archive. + virtual void Reset() = 0; + + // Sets current position to first entry >= key. Returns true if a match. + virtual bool Find(const string &key) = 0; + + // Current position at end of archive? + virtual bool Done() const = 0; + + // Move current position to next FST. + virtual void Next() = 0; + + // Returns key at the current position. This reference is invalidated if + // the current position in the archive is changed. + virtual const string &GetKey() const = 0; + + // Returns pointer to FST at the current position. This is invalidated if + // the current position in the archive is changed. + virtual const Fst *GetFst() const = 0; + + virtual FarType Type() const = 0; + + virtual bool Error() const = 0; + + virtual ~FarReader() {} + + protected: + FarReader() {} +}; + +template +class FstWriter { + public: + void operator()(std::ostream &strm, const Fst &fst) const { + fst.Write(strm, FstWriteOptions()); + } +}; + +template +class STTableFarWriter : public FarWriter { + public: + using Arc = A; + + static STTableFarWriter *Create(const string &filename) { + auto *writer = STTableWriter, FstWriter>::Create(filename); + return new STTableFarWriter(writer); + } + + void Add(const string &key, const Fst &fst) final { + writer_->Add(key, fst); + } + + FarType Type() const final { return FAR_STTABLE; } + + bool Error() const final { return writer_->Error(); } + + private: + explicit STTableFarWriter(STTableWriter, FstWriter> *writer) + : writer_(writer) {} + + std::unique_ptr, FstWriter>> writer_; +}; + +template +class STListFarWriter : public FarWriter { + public: + using Arc = A; + + static STListFarWriter *Create(const string &filename) { + auto *writer = STListWriter, FstWriter>::Create(filename); + return new STListFarWriter(writer); + } + + void Add(const string &key, const Fst &fst) final { + writer_->Add(key, fst); + } + + constexpr FarType Type() const final { return FAR_STLIST; } + + bool Error() const final { return writer_->Error(); } + + private: + explicit STListFarWriter(STListWriter, FstWriter> *writer) + : writer_(writer) {} + + std::unique_ptr, FstWriter>> writer_; +}; + +template +class FstFarWriter : public FarWriter { + public: + using Arc = A; + + explicit FstFarWriter(const string &filename) + : filename_(filename), error_(false), written_(false) {} + + static FstFarWriter *Create(const string &filename) { + return new FstFarWriter(filename); + } + + void Add(const string &key, const Fst &fst) final { + if (written_) { + LOG(WARNING) << "FstFarWriter::Add: only one FST supported," + << " subsequent entries discarded."; + } else { + error_ = !fst.Write(filename_); + written_ = true; + } + } + + constexpr FarType Type() const final { return FAR_FST; } + + bool Error() const final { return error_; } + + ~FstFarWriter() final {} + + private: + string filename_; + bool error_; + bool written_; +}; + +template +FarWriter *FarWriter::Create(const string &filename, FarType type) { + switch (type) { + case FAR_DEFAULT: + if (filename.empty()) return STListFarWriter::Create(filename); + case FAR_STTABLE: + return STTableFarWriter::Create(filename); + case FAR_STLIST: + return STListFarWriter::Create(filename); + case FAR_FST: + return FstFarWriter::Create(filename); + default: + LOG(ERROR) << "FarWriter::Create: Unknown FAR type"; + return nullptr; + } +} + +template +class FstReader { + public: + Fst *operator()(std::istream &strm) const { + return Fst::Read(strm, FstReadOptions()); + } +}; + +template +class STTableFarReader : public FarReader { + public: + using Arc = A; + + static STTableFarReader *Open(const string &filename) { + auto *reader = STTableReader, FstReader>::Open(filename); + if (!reader || reader->Error()) return nullptr; + return new STTableFarReader(reader); + } + + static STTableFarReader *Open(const std::vector &filenames) { + auto *reader = STTableReader, FstReader>::Open(filenames); + if (!reader || reader->Error()) return nullptr; + return new STTableFarReader(reader); + } + + void Reset() final { reader_->Reset(); } + + bool Find(const string &key) final { return reader_->Find(key); } + + bool Done() const final { return reader_->Done(); } + + void Next() final { return reader_->Next(); } + + const string &GetKey() const final { return reader_->GetKey(); } + + const Fst *GetFst() const final { return reader_->GetEntry(); } + + constexpr FarType Type() const final { return FAR_STTABLE; } + + bool Error() const final { return reader_->Error(); } + + private: + explicit STTableFarReader(STTableReader, FstReader> *reader) + : reader_(reader) {} + + std::unique_ptr, FstReader>> reader_; +}; + +template +class STListFarReader : public FarReader { + public: + using Arc = A; + + static STListFarReader *Open(const string &filename) { + auto *reader = STListReader, FstReader>::Open(filename); + if (!reader || reader->Error()) return nullptr; + return new STListFarReader(reader); + } + + static STListFarReader *Open(const std::vector &filenames) { + auto *reader = STListReader, FstReader>::Open(filenames); + if (!reader || reader->Error()) return nullptr; + return new STListFarReader(reader); + } + + void Reset() final { reader_->Reset(); } + + bool Find(const string &key) final { return reader_->Find(key); } + + bool Done() const final { return reader_->Done(); } + + void Next() final { return reader_->Next(); } + + const string &GetKey() const final { return reader_->GetKey(); } + + const Fst *GetFst() const final { return reader_->GetEntry(); } + + constexpr FarType Type() const final { return FAR_STLIST; } + + bool Error() const final { return reader_->Error(); } + + private: + explicit STListFarReader(STListReader, FstReader> *reader) + : reader_(reader) {} + + std::unique_ptr, FstReader>> reader_; +}; + +template +class FstFarReader : public FarReader { + public: + using Arc = A; + + static FstFarReader *Open(const string &filename) { + std::vector filenames; + filenames.push_back(filename); + return new FstFarReader(filenames); + } + + static FstFarReader *Open(const std::vector &filenames) { + return new FstFarReader(filenames); + } + + explicit FstFarReader(const std::vector &filenames) + : keys_(filenames), has_stdin_(false), pos_(0), error_(false) { + std::sort(keys_.begin(), keys_.end()); + streams_.resize(keys_.size(), 0); + for (size_t i = 0; i < keys_.size(); ++i) { + if (keys_[i].empty()) { + if (!has_stdin_) { + streams_[i] = &std::cin; + has_stdin_ = true; + } else { + FSTERROR() << "FstFarReader::FstFarReader: standard input should " + "only appear once in the input file list"; + error_ = true; + return; + } + } else { + streams_[i] = new std::ifstream( + keys_[i], std::ios_base::in | std::ios_base::binary); + if (streams_[i]->fail()) { + FSTERROR() << "FstFarReader::FstFarReader: Error reading file: " + << filenames[i]; + error_ = true; + return; + } + } + } + if (pos_ >= keys_.size()) return; + ReadFst(); + } + + void Reset() final { + if (has_stdin_) { + FSTERROR() + << "FstFarReader::Reset: Operation not supported on standard input"; + error_ = true; + return; + } + pos_ = 0; + ReadFst(); + } + + bool Find(const string &key) final { + if (has_stdin_) { + FSTERROR() + << "FstFarReader::Find: Operation not supported on standard input"; + error_ = true; + return false; + } + pos_ = 0; // TODO + ReadFst(); + return true; + } + + bool Done() const final { return error_ || pos_ >= keys_.size(); } + + void Next() final { + ++pos_; + ReadFst(); + } + + const string &GetKey() const final { return keys_[pos_]; } + + const Fst *GetFst() const final { return fst_.get(); } + + constexpr FarType Type() const final { return FAR_FST; } + + bool Error() const final { return error_; } + + ~FstFarReader() final { + for (size_t i = 0; i < keys_.size(); ++i) { + if (streams_[i] != &std::cin) { + delete streams_[i]; + } + } + } + + private: + void ReadFst() { + fst_.reset(); + if (pos_ >= keys_.size()) return; + streams_[pos_]->seekg(0); + fst_.reset(Fst::Read(*streams_[pos_], FstReadOptions())); + if (!fst_) { + FSTERROR() << "FstFarReader: Error reading Fst from: " << keys_[pos_]; + error_ = true; + } + } + + std::vector keys_; + std::vector streams_; + bool has_stdin_; + size_t pos_; + mutable std::unique_ptr> fst_; + mutable bool error_; +}; + +template +FarReader *FarReader::Open(const string &filename) { + if (filename.empty()) + return STListFarReader::Open(filename); + else if (IsSTTable(filename)) + return STTableFarReader::Open(filename); + else if (IsSTList(filename)) + return STListFarReader::Open(filename); + else if (IsFst(filename)) + return FstFarReader::Open(filename); + return nullptr; +} + +template +FarReader *FarReader::Open(const std::vector &filenames) { + if (!filenames.empty() && filenames[0].empty()) + return STListFarReader::Open(filenames); + else if (!filenames.empty() && IsSTTable(filenames[0])) + return STTableFarReader::Open(filenames); + else if (!filenames.empty() && IsSTList(filenames[0])) + return STListFarReader::Open(filenames); + else if (!filenames.empty() && IsFst(filenames[0])) + return FstFarReader::Open(filenames); + return nullptr; +} + +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_FAR_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/farlib.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/farlib.h new file mode 100644 index 0000000..c9bb171 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/farlib.h @@ -0,0 +1,19 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// A finite-state archive (FAR) is used to store an indexable collection of +// FSTs in a single file. Utilities are provided to create FARs from FSTs, +// to iterate over FARs, and to extract specific FSTs from FARs. + +#ifndef FST_EXTENSIONS_FAR_FARLIB_H_ +#define FST_EXTENSIONS_FAR_FARLIB_H_ + +#include +#include +#include +#include +#include +#include +#include + +#endif // FST_EXTENSIONS_FAR_FARLIB_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/farscript.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/farscript.h new file mode 100644 index 0000000..4bd11a9 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/farscript.h @@ -0,0 +1,269 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Convenience file for including all of the FAR operations, or registering +// them for new arc types. + +#ifndef FST_EXTENSIONS_FAR_FARSCRIPT_H_ +#define FST_EXTENSIONS_FAR_FARSCRIPT_H_ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +// Note: it is safe to pass these strings as references because this struct is +// only used to pass them deeper in the call graph. Be sure you understand why +// this is so before using this struct for anything else! +struct FarCompileStringsArgs { + const std::vector &in_fnames; + const string &out_fname; + const string &fst_type; + const FarType &far_type; + const int32 generate_keys; + const FarEntryType fet; + const FarTokenType tt; + const string &symbols_fname; + const string &unknown_symbol; + const bool keep_symbols; + const bool initial_symbols; + const bool allow_negative_labels; + const string &key_prefix; + const string &key_suffix; + + FarCompileStringsArgs(const std::vector &in_fnames, + const string &out_fname, const string &fst_type, + const FarType &far_type, int32 generate_keys, + FarEntryType fet, FarTokenType tt, + const string &symbols_fname, + const string &unknown_symbol, bool keep_symbols, + bool initial_symbols, bool allow_negative_labels, + const string &key_prefix, const string &key_suffix) + : in_fnames(in_fnames), + out_fname(out_fname), + fst_type(fst_type), + far_type(far_type), + generate_keys(generate_keys), + fet(fet), + tt(tt), + symbols_fname(symbols_fname), + unknown_symbol(unknown_symbol), + keep_symbols(keep_symbols), + initial_symbols(initial_symbols), + allow_negative_labels(allow_negative_labels), + key_prefix(key_prefix), + key_suffix(key_suffix) {} +}; + +template +void FarCompileStrings(FarCompileStringsArgs *args) { + FarCompileStrings( + args->in_fnames, args->out_fname, args->fst_type, args->far_type, + args->generate_keys, args->fet, args->tt, args->symbols_fname, + args->unknown_symbol, args->keep_symbols, args->initial_symbols, + args->allow_negative_labels, args->key_prefix, args->key_suffix); +} + +void FarCompileStrings(const std::vector &in_fnames, + const string &out_fname, const string &arc_type, + const string &fst_type, const FarType &far_type, + int32 generate_keys, FarEntryType fet, FarTokenType tt, + const string &symbols_fname, + const string &unknown_symbol, bool keep_symbols, + bool initial_symbols, bool allow_negative_labels, + const string &key_prefix, const string &key_suffix); + +// Note: it is safe to pass these strings as references because this struct is +// only used to pass them deeper in the call graph. Be sure you understand why +// this is so before using this struct for anything else! +struct FarCreateArgs { + const std::vector &in_fnames; + const string &out_fname; + const int32 generate_keys; + const FarType &far_type; + const string &key_prefix; + const string &key_suffix; + + FarCreateArgs(const std::vector &in_fnames, const string &out_fname, + const int32 generate_keys, const FarType &far_type, + const string &key_prefix, const string &key_suffix) + : in_fnames(in_fnames), + out_fname(out_fname), + generate_keys(generate_keys), + far_type(far_type), + key_prefix(key_prefix), + key_suffix(key_suffix) {} +}; + +template +void FarCreate(FarCreateArgs *args) { + FarCreate(args->in_fnames, args->out_fname, args->generate_keys, + args->far_type, args->key_prefix, args->key_suffix); +} + +void FarCreate(const std::vector &in_fnames, const string &out_fname, + const string &arc_type, const int32 generate_keys, + const FarType &far_type, const string &key_prefix, + const string &key_suffix); + +using FarEqualInnerArgs = std::tuple; + +using FarEqualArgs = WithReturnValue; + +template +void FarEqual(FarEqualArgs *args) { + args->retval = fst::FarEqual( + std::get<0>(args->args), std::get<1>(args->args), std::get<2>(args->args), + std::get<3>(args->args), std::get<4>(args->args)); +} + +bool FarEqual(const string &filename1, const string &filename2, + const string &arc_type, float delta = kDelta, + const string &begin_key = string(), + const string &end_key = string()); + +using FarExtractArgs = + std::tuple &, int32, const string &, + const string &, const string &, const string &, const string &>; + +template +void FarExtract(FarExtractArgs *args) { + fst::FarExtract(std::get<0>(*args), std::get<1>(*args), + std::get<2>(*args), std::get<3>(*args), + std::get<4>(*args), std::get<5>(*args), + std::get<6>(*args)); +} + +void FarExtract(const std::vector &ifilenames, const string &arc_type, + int32 generate_filenames, const string &keys, + const string &key_separator, const string &range_delimiter, + const string &filename_prefix, const string &filename_suffix); + +using FarInfoArgs = std::tuple &, const string &, + const string &, const bool>; + +template +void FarInfo(FarInfoArgs *args) { + fst::FarInfo(std::get<0>(*args), std::get<1>(*args), + std::get<2>(*args), std::get<3>(*args)); +} + +void FarInfo(const std::vector &filenames, const string &arc_type, + const string &begin_key, const string &end_key, + const bool list_fsts); + +using GetFarInfoArgs = std::tuple &, const string &, + const string &, const bool, FarInfoData *>; + +template +void GetFarInfo(GetFarInfoArgs *args) { + fst::GetFarInfo(std::get<0>(*args), std::get<1>(*args), + std::get<2>(*args), std::get<3>(*args), + std::get<4>(*args)); +} + +void GetFarInfo(const std::vector &filenames, const string &arc_type, + const string &begin_key, const string &end_key, + const bool list_fsts, FarInfoData *); + +using FarIsomorphicInnerArgs = std::tuple; + +using FarIsomorphicArgs = WithReturnValue; + +template +void FarIsomorphic(FarIsomorphicArgs *args) { + args->retval = fst::FarIsomorphic( + std::get<0>(args->args), std::get<1>(args->args), std::get<2>(args->args), + std::get<3>(args->args), std::get<4>(args->args)); +} + +bool FarIsomorphic(const string &filename1, const string &filename2, + const string &arc_type, float delta = kDelta, + const string &begin_key = string(), + const string &end_key = string()); + +struct FarPrintStringsArgs { + const std::vector &ifilenames; + const FarEntryType entry_type; + const FarTokenType token_type; + const string &begin_key; + const string &end_key; + const bool print_key; + const bool print_weight; + const string &symbols_fname; + const bool initial_symbols; + const int32 generate_filenames; + const string &filename_prefix; + const string &filename_suffix; + + FarPrintStringsArgs(const std::vector &ifilenames, + const FarEntryType entry_type, + const FarTokenType token_type, const string &begin_key, + const string &end_key, const bool print_key, + const bool print_weight, const string &symbols_fname, + const bool initial_symbols, + const int32 generate_filenames, + const string &filename_prefix, + const string &filename_suffix) + : ifilenames(ifilenames), + entry_type(entry_type), + token_type(token_type), + begin_key(begin_key), + end_key(end_key), + print_key(print_key), + print_weight(print_weight), + symbols_fname(symbols_fname), + initial_symbols(initial_symbols), + generate_filenames(generate_filenames), + filename_prefix(filename_prefix), + filename_suffix(filename_suffix) {} +}; + +template +void FarPrintStrings(FarPrintStringsArgs *args) { + fst::FarPrintStrings( + args->ifilenames, args->entry_type, args->token_type, args->begin_key, + args->end_key, args->print_key, args->print_weight, args->symbols_fname, + args->initial_symbols, args->generate_filenames, args->filename_prefix, + args->filename_suffix); +} + +void FarPrintStrings(const std::vector &ifilenames, + const string &arc_type, const FarEntryType entry_type, + const FarTokenType token_type, const string &begin_key, + const string &end_key, const bool print_key, + const bool print_weight, const string &symbols_fname, + const bool initial_symbols, const int32 generate_filenames, + const string &filename_prefix, + const string &filename_suffix); + +} // namespace script +} // namespace fst + +#define REGISTER_FST_FAR_OPERATIONS(ArcType) \ + REGISTER_FST_OPERATION(FarCompileStrings, ArcType, FarCompileStringsArgs); \ + REGISTER_FST_OPERATION(FarCreate, ArcType, FarCreateArgs); \ + REGISTER_FST_OPERATION(FarEqual, ArcType, FarEqualArgs); \ + REGISTER_FST_OPERATION(FarExtract, ArcType, FarExtractArgs); \ + REGISTER_FST_OPERATION(FarInfo, ArcType, FarInfoArgs); \ + REGISTER_FST_OPERATION(FarIsomorphic, ArcType, FarIsomorphicArgs); \ + REGISTER_FST_OPERATION(FarPrintStrings, ArcType, FarPrintStringsArgs); \ + REGISTER_FST_OPERATION(GetFarInfo, ArcType, GetFarInfoArgs) + +#endif // FST_EXTENSIONS_FAR_FARSCRIPT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/getters.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/getters.h new file mode 100644 index 0000000..3dde419 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/getters.h @@ -0,0 +1,30 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes and functions for registering and invoking FAR main +// functions that support multiple and extensible arc types. + +#ifndef FST_EXTENSIONS_FAR_GETTERS_H_ +#define FST_EXTENSIONS_FAR_GETTERS_H_ + +#include +#include + +namespace fst { +namespace script { + +FarType GetFarType(const string &str); + +bool GetFarEntryType(const string &str, FarEntryType *entry_type); + +bool GetFarTokenType(const string &str, FarTokenType *token_type); + +void ExpandArgs(int argc, char **argv, int *argcp, char ***argvp); + +} // namespace script + +string GetFarTypeString(FarType type); + +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_GETTERS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/info.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/info.h new file mode 100644 index 0000000..0391c1f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/info.h @@ -0,0 +1,147 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_FAR_INFO_H_ +#define FST_EXTENSIONS_FAR_INFO_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace fst { + +template +void AccumulateStatesAndArcs(const Fst &fst, size_t *nstate, size_t *narc, + size_t *nfinal) { + for (StateIterator> siter(fst); !siter.Done(); + siter.Next(), ++(*nstate)) { + ArcIterator> aiter(fst, siter.Value()); + for (; !aiter.Done(); aiter.Next(), ++(*narc)) { + } + if (fst.Final(siter.Value()) != Arc::Weight::Zero()) ++(*nfinal); + } +} + +struct KeyInfo { + string key; + string type; + size_t nstate = 0; + size_t narc = 0; + size_t nfinal = 0; +}; + +struct FarInfoData { + std::vector key_infos; + string far_type; + string arc_type; + size_t nfst = 0; + size_t nstate = 0; + size_t narc = 0; + size_t nfinal = 0; + std::set fst_types; +}; + +template +void GetFarInfo(const std::vector &filenames, const string &begin_key, + const string &end_key, const bool list_fsts, + FarInfoData *far_info) { + *far_info = FarInfoData(); + std::unique_ptr> reader(FarReader::Open(filenames)); + if (!reader) { + LOG(ERROR) << "GetFarInfo: failed to create far reader."; + return; + } + if (!begin_key.empty()) reader->Find(begin_key); + + for (; !reader->Done(); reader->Next()) { + const auto &key = reader->GetKey(); + if (!end_key.empty() && end_key < key) break; + ++far_info->nfst; + const auto *fst = reader->GetFst(); + far_info->fst_types.insert(fst->Type()); + if (list_fsts) { + KeyInfo info; + info.key = key; + info.type = fst->Type(); + AccumulateStatesAndArcs(*fst, &info.nstate, &info.narc, &info.nfinal); + far_info->nstate += info.nstate; + far_info->narc += info.narc; + far_info->nfinal += info.nfinal; + far_info->key_infos.push_back(info); + } else { + AccumulateStatesAndArcs(*fst, &far_info->nstate, &far_info->narc, + &far_info->nfinal); + } + } + far_info->far_type = GetFarTypeString(reader->Type()); + far_info->arc_type = Arc::Type(); +} + +template +void FarInfo(const std::vector &filenames, const string &begin_key, + const string &end_key, const bool list_fsts) { + FarInfoData info; + GetFarInfo(filenames, begin_key, end_key, list_fsts, &info); + if (!list_fsts) { + std::cout << std::left << std::setw(50) << "far type" << info.far_type + << std::endl; + std::cout << std::left << std::setw(50) << "arc type" << Arc::Type() + << std::endl; + std::cout << std::left << std::setw(50) << "fst type"; + for (auto iter = info.fst_types.begin(); iter != info.fst_types.end(); + ++iter) { + if (iter != info.fst_types.begin()) std::cout << ","; + std::cout << *iter; + } + std::cout << std::endl; + std::cout << std::left << std::setw(50) << "# of FSTs" << info.nfst + << std::endl; + std::cout << std::left << std::setw(50) << "total # of states" + << info.nstate << std::endl; + std::cout << std::left << std::setw(50) << "total # of arcs" << info.narc + << std::endl; + std::cout << std::left << std::setw(50) << "total # of final states" + << info.nfinal << std::endl; + } else { + // FIXME(kbg): Grok, then document this. + int wkey = 10; + int wtype = 10; + int wnstate = 14; + int wnarc = 12; + int wnfinal = 20; + for (const auto &key_info : info.key_infos) { + if (key_info.key.size() + 2 > wkey) wkey = key_info.key.size() + 2; + if (key_info.type.size() + 2 > wtype) wtype = key_info.type.size() + 2; + if (ceil(log10(key_info.nstate)) + 2 > wnstate) { + wnstate = ceil(log10(key_info.nstate)) + 2; + } + if (ceil(log10(key_info.narc)) + 2 > wnarc) { + wnarc = ceil(log10(key_info.narc)) + 2; + } + if (ceil(log10(key_info.nfinal)) + 2 > wnfinal) { + wnfinal = ceil(log10(key_info.nfinal)) + 2; + } + } + std::cout << std::left << std::setw(wkey) << "key" << std::setw(wtype) + << "type" << std::right << std::setw(wnstate) << "# of states" + << std::setw(wnarc) << "# of arcs" << std::setw(wnfinal) + << "# of final states" << std::endl; + for (const auto &key_info : info.key_infos) { + std::cout << std::left << std::setw(wkey) << key_info.key + << std::setw(wtype) << key_info.type << std::right + << std::setw(wnstate) << key_info.nstate << std::setw(wnarc) + << key_info.narc << std::setw(wnfinal) << key_info.nfinal + << std::endl; + } + } +} + +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_INFO_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/isomorphic.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/isomorphic.h new file mode 100644 index 0000000..1e6e9cb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/isomorphic.h @@ -0,0 +1,69 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_FAR_ISOMORPHIC_H_ +#define FST_EXTENSIONS_FAR_ISOMORPHIC_H_ + +#include +#include + +#include +#include + +namespace fst { + +template +bool FarIsomorphic(const string &filename1, const string &filename2, + float delta = kDelta, const string &begin_key = string(), + const string &end_key = string()) { + std::unique_ptr> reader1(FarReader::Open(filename1)); + if (!reader1) { + LOG(ERROR) << "FarIsomorphic: Cannot open FAR file " << filename1; + return false; + } + std::unique_ptr> reader2(FarReader::Open(filename2)); + if (!reader2) { + LOG(ERROR) << "FarIsomorphic: Cannot open FAR file " << filename2; + return false; + } + if (!begin_key.empty()) { + bool find_begin1 = reader1->Find(begin_key); + bool find_begin2 = reader2->Find(begin_key); + if (!find_begin1 || !find_begin2) { + bool ret = !find_begin1 && !find_begin2; + if (!ret) { + VLOG(1) << "FarIsomorphic: Key " << begin_key << " missing from " + << (find_begin1 ? "second" : "first") << " archive."; + } + return ret; + } + } + for (; !reader1->Done() && !reader2->Done(); + reader1->Next(), reader2->Next()) { + const auto &key1 = reader1->GetKey(); + const auto &key2 = reader2->GetKey(); + if (!end_key.empty() && end_key < key1 && end_key < key2) return true; + if (key1 != key2) { + LOG(ERROR) << "FarIsomorphic: Mismatched keys " << key1 << " and " + << key2; + return false; + } + if (!Isomorphic(*(reader1->GetFst()), *(reader2->GetFst()), delta)) { + LOG(ERROR) << "FarIsomorphic: FSTs for key " << key1 + << " are not isomorphic"; + return false; + } + } + if (!reader1->Done() || !reader2->Done()) { + LOG(ERROR) << "FarIsomorphic: Key " + << (reader1->Done() ? reader2->GetKey() : reader1->GetKey()) + << " missing form " << (reader2->Done() ? "first" : "second") + << " archive"; + return false; + } + return true; +} + +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_ISOMORPHIC_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/print-strings.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/print-strings.h new file mode 100644 index 0000000..dc42840 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/print-strings.h @@ -0,0 +1,105 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Outputs as strings the string FSTs in a finite-state archive. + +#ifndef FST_EXTENSIONS_FAR_PRINT_STRINGS_H_ +#define FST_EXTENSIONS_FAR_PRINT_STRINGS_H_ + +#include +#include +#include + +#include +#include +#include +#include +#include + +DECLARE_string(far_field_separator); + +namespace fst { + +template +void FarPrintStrings(const std::vector &ifilenames, + FarEntryType entry_type, FarTokenType far_token_type, + const string &begin_key, const string &end_key, + bool print_key, bool print_weight, + const string &symbols_fname, bool initial_symbols, + int32 generate_filenames, const string &filename_prefix, + const string &filename_suffix) { + StringTokenType token_type; + if (far_token_type == FTT_SYMBOL) { + token_type = StringTokenType::SYMBOL; + } else if (far_token_type == FTT_BYTE) { + token_type = StringTokenType::BYTE; + } else if (far_token_type == FTT_UTF8) { + token_type = StringTokenType::UTF8; + } else { + FSTERROR() << "FarPrintStrings: Unknown token type"; + return; + } + std::unique_ptr syms; + if (!symbols_fname.empty()) { + // TODO(kbg): Allow negative flag? + const SymbolTableTextOptions opts(true); + syms.reset(SymbolTable::ReadText(symbols_fname, opts)); + if (!syms) { + LOG(ERROR) << "FarPrintStrings: Error reading symbol table " + << symbols_fname; + return; + } + } + std::unique_ptr> far_reader(FarReader::Open(ifilenames)); + if (!far_reader) return; + if (!begin_key.empty()) far_reader->Find(begin_key); + string okey; + int nrep = 0; + for (int i = 1; !far_reader->Done(); far_reader->Next(), ++i) { + const auto &key = far_reader->GetKey(); + if (!end_key.empty() && end_key < key) break; + if (okey == key) { + ++nrep; + } else { + nrep = 0; + } + okey = key; + const auto *fst = far_reader->GetFst(); + if (i == 1 && initial_symbols && !syms && fst->InputSymbols()) + syms.reset(fst->InputSymbols()->Copy()); + string str; + VLOG(2) << "Handling key: " << key; + StringPrinter string_printer(token_type, + syms ? syms.get() : fst->InputSymbols()); + string_printer(*fst, &str); + if (entry_type == FET_LINE) { + if (print_key) std::cout << key << FLAGS_far_field_separator[0]; + std::cout << str; + if (print_weight) + std::cout << FLAGS_far_field_separator[0] << ShortestDistance(*fst); + std::cout << std::endl; + } else if (entry_type == FET_FILE) { + std::stringstream sstrm; + if (generate_filenames) { + sstrm.fill('0'); + sstrm << std::right << std::setw(generate_filenames) << i; + } else { + sstrm << key; + if (nrep > 0) sstrm << "." << nrep; + } + string filename; + filename = filename_prefix + sstrm.str() + filename_suffix; + std::ofstream ostrm(filename); + if (!ostrm) { + LOG(ERROR) << "FarPrintStrings: Can't open file: " << filename; + return; + } + ostrm << str; + if (token_type == StringTokenType::SYMBOL) ostrm << "\n"; + } + } +} + +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_PRINT_STRINGS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/script-impl.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/script-impl.h new file mode 100644 index 0000000..a0586cc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/script-impl.h @@ -0,0 +1,23 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes and functions for registering and invoking Far main +// functions that support multiple and extensible arc types. + +#ifndef FST_EXTENSIONS_FAR_SCRIPT_IMPL_H_ +#define FST_EXTENSIONS_FAR_SCRIPT_IMPL_H_ + +#include + +#include +namespace fst { +namespace script { + +string LoadArcTypeFromFar(const string &far_fname); + +string LoadArcTypeFromFst(const string &fst_fname); + +} // namespace script +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_SCRIPT_IMPL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/stlist.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/stlist.h new file mode 100644 index 0000000..b155e17 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/stlist.h @@ -0,0 +1,273 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// A generic (string,type) list file format. +// +// This is a stripped-down version of STTable that does not support the Find() +// operation but that does support reading/writting from standard in/out. + +#ifndef FST_EXTENSIONS_FAR_STLIST_H_ +#define FST_EXTENSIONS_FAR_STLIST_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace fst { + +static constexpr int32 kSTListMagicNumber = 5656924; +static constexpr int32 kSTListFileVersion = 1; + +// String-type list writing class for object of type T using a functor Writer. +// The Writer functor must provide at least the following interface: +// +// struct Writer { +// void operator()(std::ostream &, const T &) const; +// }; +template +class STListWriter { + public: + explicit STListWriter(const string &filename) + : stream_(filename.empty() ? &std::cout : new std::ofstream( + filename, + std::ios_base::out | + std::ios_base::binary)), + error_(false) { + WriteType(*stream_, kSTListMagicNumber); + WriteType(*stream_, kSTListFileVersion); + if (!stream_) { + FSTERROR() << "STListWriter::STListWriter: Error writing to file: " + << filename; + error_ = true; + } + } + + static STListWriter *Create(const string &filename) { + return new STListWriter(filename); + } + + void Add(const string &key, const T &t) { + if (key == "") { + FSTERROR() << "STListWriter::Add: Key empty: " << key; + error_ = true; + } else if (key < last_key_) { + FSTERROR() << "STListWriter::Add: Key out of order: " << key; + error_ = true; + } + if (error_) return; + last_key_ = key; + WriteType(*stream_, key); + entry_writer_(*stream_, t); + } + + bool Error() const { return error_; } + + ~STListWriter() { + WriteType(*stream_, string()); + if (stream_ != &std::cout) delete stream_; + } + + private: + Writer entry_writer_; + std::ostream *stream_; // Output stream. + string last_key_; // Last key. + bool error_; + + STListWriter(const STListWriter &) = delete; + STListWriter &operator=(const STListWriter &) = delete; +}; + +// String-type list reading class for object of type T using a functor Reader. +// Reader must provide at least the following interface: +// +// struct Reader { +// T *operator()(std::istream &) const; +// }; +template +class STListReader { + public: + explicit STListReader(const std::vector &filenames) + : sources_(filenames), error_(false) { + streams_.resize(filenames.size(), 0); + bool has_stdin = false; + for (size_t i = 0; i < filenames.size(); ++i) { + if (filenames[i].empty()) { + if (!has_stdin) { + streams_[i] = &std::cin; + sources_[i] = "stdin"; + has_stdin = true; + } else { + FSTERROR() << "STListReader::STListReader: Cannot read multiple " + << "inputs from standard input"; + error_ = true; + return; + } + } else { + streams_[i] = new std::ifstream( + filenames[i], std::ios_base::in | std::ios_base::binary); + if (streams_[i]->fail()) { + FSTERROR() << "STListReader::STListReader: Error reading file: " + << filenames[i]; + error_ = true; + return; + } + } + int32 magic_number = 0; + ReadType(*streams_[i], &magic_number); + int32 file_version = 0; + ReadType(*streams_[i], &file_version); + if (magic_number != kSTListMagicNumber) { + FSTERROR() << "STListReader::STListReader: Wrong file type: " + << filenames[i]; + error_ = true; + return; + } + if (file_version != kSTListFileVersion) { + FSTERROR() << "STListReader::STListReader: Wrong file version: " + << filenames[i]; + error_ = true; + return; + } + string key; + ReadType(*streams_[i], &key); + if (!key.empty()) heap_.push(std::make_pair(key, i)); + if (!*streams_[i]) { + FSTERROR() << "STListReader: Error reading file: " << sources_[i]; + error_ = true; + return; + } + } + if (heap_.empty()) return; + const auto current = heap_.top().second; + entry_.reset(entry_reader_(*streams_[current])); + if (!entry_ || !*streams_[current]) { + FSTERROR() << "STListReader: Error reading entry for key " + << heap_.top().first << ", file " << sources_[current]; + error_ = true; + } + } + + ~STListReader() { + for (auto &stream : streams_) { + if (stream != &std::cin) delete stream; + } + } + + static STListReader *Open(const string &filename) { + std::vector filenames; + filenames.push_back(filename); + return new STListReader(filenames); + } + + static STListReader *Open(const std::vector &filenames) { + return new STListReader(filenames); + } + + void Reset() { + FSTERROR() << "STListReader::Reset: Operation not supported"; + error_ = true; + } + + bool Find(const string &key) { + FSTERROR() << "STListReader::Find: Operation not supported"; + error_ = true; + return false; + } + + bool Done() const { return error_ || heap_.empty(); } + + void Next() { + if (error_) return; + auto current = heap_.top().second; + string key; + heap_.pop(); + ReadType(*(streams_[current]), &key); + if (!*streams_[current]) { + FSTERROR() << "STListReader: Error reading file: " << sources_[current]; + error_ = true; + return; + } + if (!key.empty()) heap_.push(std::make_pair(key, current)); + if (!heap_.empty()) { + current = heap_.top().second; + entry_.reset(entry_reader_(*streams_[current])); + if (!entry_ || !*streams_[current]) { + FSTERROR() << "STListReader: Error reading entry for key: " + << heap_.top().first << ", file: " << sources_[current]; + error_ = true; + } + } + } + + const string &GetKey() const { return heap_.top().first; } + + const T *GetEntry() const { return entry_.get(); } + + bool Error() const { return error_; } + + private: + Reader entry_reader_; // Read functor. + std::vector streams_; // Input streams. + std::vector sources_; // Corresponding filenames. + std::priority_queue< + std::pair, std::vector>, + std::greater>> heap_; // (Key, stream id) heap + mutable std::unique_ptr entry_; // The currently read entry. + bool error_; + + STListReader(const STListReader &) = delete; + STListReader &operator=(const STListReader &) = delete; +}; + +// String-type list header reading function, templated on the entry header type. +// The Header type must provide at least the following interface: +// +// struct Header { +// void Read(std::istream &strm, const string &filename); +// }; +template +bool ReadSTListHeader(const string &filename, Header *header) { + if (filename.empty()) { + LOG(ERROR) << "ReadSTListHeader: Can't read header from standard input"; + return false; + } + std::ifstream strm(filename, std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "ReadSTListHeader: Could not open file: " << filename; + return false; + } + int32 magic_number = 0; + ReadType(strm, &magic_number); + int32 file_version = 0; + ReadType(strm, &file_version); + if (magic_number != kSTListMagicNumber) { + LOG(ERROR) << "ReadSTListHeader: Wrong file type: " << filename; + return false; + } + if (file_version != kSTListFileVersion) { + LOG(ERROR) << "ReadSTListHeader: Wrong file version: " << filename; + return false; + } + string key; + ReadType(strm, &key); + header->Read(strm, filename + ":" + key); + if (!strm) { + LOG(ERROR) << "ReadSTListHeader: Error reading file: " << filename; + return false; + } + return true; +} + +bool IsSTList(const string &filename); + +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_STLIST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/sttable.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/sttable.h new file mode 100644 index 0000000..2a01bb1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/far/sttable.h @@ -0,0 +1,353 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// A generic string-to-type table file format. +// +// This is not meant as a generalization of SSTable. This is more of a simple +// replacement for SSTable in order to provide an open-source implementation +// of the FAR format for the external version of the FST library. + +#ifndef FST_EXTENSIONS_FAR_STTABLE_H_ +#define FST_EXTENSIONS_FAR_STTABLE_H_ + +#include +#include +#include + +#include +#include + +namespace fst { + +static constexpr int32 kSTTableMagicNumber = 2125656924; +static constexpr int32 kSTTableFileVersion = 1; + +// String-type table writing class for an object of type T using a functor +// Writer. The Writer functor must provide at least the following interface: +// +// struct Writer { +// void operator()(std::ostream &, const T &) const; +// }; +template +class STTableWriter { + public: + explicit STTableWriter(const string &filename) + : stream_(filename, std::ios_base::out | std::ios_base::binary), + error_(false) { + WriteType(stream_, kSTTableMagicNumber); + WriteType(stream_, kSTTableFileVersion); + if (stream_.fail()) { + FSTERROR() << "STTableWriter::STTableWriter: Error writing to file: " + << filename; + error_ = true; + } + } + + static STTableWriter *Create(const string &filename) { + if (filename.empty()) { + LOG(ERROR) << "STTableWriter: Writing to standard out unsupported."; + return nullptr; + } + return new STTableWriter(filename); + } + + void Add(const string &key, const T &t) { + if (key == "") { + FSTERROR() << "STTableWriter::Add: Key empty: " << key; + error_ = true; + } else if (key < last_key_) { + FSTERROR() << "STTableWriter::Add: Key out of order: " << key; + error_ = true; + } + if (error_) return; + last_key_ = key; + positions_.push_back(stream_.tellp()); + WriteType(stream_, key); + entry_writer_(stream_, t); + } + + bool Error() const { return error_; } + + ~STTableWriter() { + WriteType(stream_, positions_); + WriteType(stream_, static_cast(positions_.size())); + } + + private: + Writer entry_writer_; + std::ofstream stream_; + std::vector positions_; // Position in file of each key-entry pair. + string last_key_; // Last key. + bool error_; + + STTableWriter(const STTableWriter &) = delete; + STTableWriter &operator=(const STTableWriter &) = delete; +}; + +// String-type table reading class for object of type T using a functor Reader. +// Reader must provide at least the following interface: +// +// struct Reader { +// T *operator()(std::istream &) const; +// }; +// +template +class STTableReader { + public: + explicit STTableReader(const std::vector &filenames) + : sources_(filenames), error_(false) { + compare_.reset(new Compare(&keys_)); + keys_.resize(filenames.size()); + streams_.resize(filenames.size(), 0); + positions_.resize(filenames.size()); + for (size_t i = 0; i < filenames.size(); ++i) { + streams_[i] = new std::ifstream( + filenames[i], std::ios_base::in | std::ios_base::binary); + if (streams_[i]->fail()) { + FSTERROR() << "STTableReader::STTableReader: Error reading file: " + << filenames[i]; + error_ = true; + return; + } + int32 magic_number = 0; + ReadType(*streams_[i], &magic_number); + int32 file_version = 0; + ReadType(*streams_[i], &file_version); + if (magic_number != kSTTableMagicNumber) { + FSTERROR() << "STTableReader::STTableReader: Wrong file type: " + << filenames[i]; + error_ = true; + return; + } + if (file_version != kSTTableFileVersion) { + FSTERROR() << "STTableReader::STTableReader: Wrong file version: " + << filenames[i]; + error_ = true; + return; + } + int64 num_entries; + streams_[i]->seekg(-static_cast(sizeof(int64)), std::ios_base::end); + ReadType(*streams_[i], &num_entries); + if (num_entries > 0) { + streams_[i]->seekg(-static_cast(sizeof(int64)) * (num_entries + 1), + std::ios_base::end); + positions_[i].resize(num_entries); + for (size_t j = 0; (j < num_entries) && (!streams_[i]->fail()); ++j) { + ReadType(*streams_[i], &(positions_[i][j])); + } + streams_[i]->seekg(positions_[i][0]); + if (streams_[i]->fail()) { + FSTERROR() << "STTableReader::STTableReader: Error reading file: " + << filenames[i]; + error_ = true; + return; + } + } + } + MakeHeap(); + } + + ~STTableReader() { + for (auto &stream : streams_) delete stream; + } + + static STTableReader *Open(const string &filename) { + if (filename.empty()) { + LOG(ERROR) << "STTableReader: Operation not supported on standard input"; + return nullptr; + } + std::vector filenames; + filenames.push_back(filename); + return new STTableReader(filenames); + } + + static STTableReader *Open(const std::vector &filenames) { + return new STTableReader(filenames); + } + + void Reset() { + if (error_) return; + for (size_t i = 0; i < streams_.size(); ++i) + streams_[i]->seekg(positions_[i].front()); + MakeHeap(); + } + + bool Find(const string &key) { + if (error_) return false; + for (size_t i = 0; i < streams_.size(); ++i) LowerBound(i, key); + MakeHeap(); + if (heap_.empty()) return false; + return keys_[current_] == key; + } + + bool Done() const { return error_ || heap_.empty(); } + + void Next() { + if (error_) return; + if (streams_[current_]->tellg() <= positions_[current_].back()) { + ReadType(*(streams_[current_]), &(keys_[current_])); + if (streams_[current_]->fail()) { + FSTERROR() << "STTableReader: Error reading file: " + << sources_[current_]; + error_ = true; + return; + } + std::push_heap(heap_.begin(), heap_.end(), *compare_); + } else { + heap_.pop_back(); + } + if (!heap_.empty()) PopHeap(); + } + + const string &GetKey() const { return keys_[current_]; } + + const T *GetEntry() const { return entry_.get(); } + + bool Error() const { return error_; } + + private: + // Comparison functor used to compare stream IDs in the heap. + struct Compare { + explicit Compare(const std::vector *keys) : keys(keys) {} + + bool operator()(size_t i, size_t j) const { + return (*keys)[i] > (*keys)[j]; + }; + + private: + const std::vector *keys; + }; + + // Positions the stream at the position corresponding to the lower bound for + // the specified key. + void LowerBound(size_t id, const string &find_key) { + auto *strm = streams_[id]; + const auto &positions = positions_[id]; + if (positions.empty()) return; + size_t low = 0; + size_t high = positions.size() - 1; + while (low < high) { + size_t mid = (low + high) / 2; + strm->seekg(positions[mid]); + string key; + ReadType(*strm, &key); + if (key > find_key) { + high = mid; + } else if (key < find_key) { + low = mid + 1; + } else { + for (size_t i = mid; i > low; --i) { + strm->seekg(positions[i - 1]); + ReadType(*strm, &key); + if (key != find_key) { + strm->seekg(positions[i]); + return; + } + } + strm->seekg(positions[low]); + return; + } + } + strm->seekg(positions[low]); + } + + // Adds all streams to the heap. + void MakeHeap() { + heap_.clear(); + for (size_t i = 0; i < streams_.size(); ++i) { + if (positions_[i].empty()) continue; + ReadType(*streams_[i], &(keys_[i])); + if (streams_[i]->fail()) { + FSTERROR() << "STTableReader: Error reading file: " << sources_[i]; + error_ = true; + return; + } + heap_.push_back(i); + } + if (heap_.empty()) return; + std::make_heap(heap_.begin(), heap_.end(), *compare_); + PopHeap(); + } + + // Positions the stream with the lowest key at the top of the heap, sets + // current_ to the ID of that stream, and reads the current entry from that + // stream. + void PopHeap() { + std::pop_heap(heap_.begin(), heap_.end(), *compare_); + current_ = heap_.back(); + entry_.reset(entry_reader_(*streams_[current_])); + if (!entry_) error_ = true; + if (streams_[current_]->fail()) { + FSTERROR() << "STTableReader: Error reading entry for key: " + << keys_[current_] << ", file: " << sources_[current_]; + error_ = true; + } + } + + Reader entry_reader_; + std::vector streams_; // Input streams. + std::vector sources_; // Corresponding file names. + std::vector> positions_; // Index of positions. + std::vector keys_; // Lowest unread key for each stream. + std::vector heap_; // Heap containing ID of streams with unread keys. + int64 current_; // ID of current stream to be read. + std::unique_ptr compare_; // Functor comparing stream IDs. + mutable std::unique_ptr entry_; // The currently read entry. + bool error_; +}; + +// String-type table header reading function template on the entry header type. +// The Header type must provide at least the following interface: +// +// struct Header { +// void Read(std::istream &istrm, const string &filename); +// }; +template +bool ReadSTTableHeader(const string &filename, Header *header) { + if (filename.empty()) { + LOG(ERROR) << "ReadSTTable: Can't read header from standard input"; + return false; + } + std::ifstream strm(filename, std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "ReadSTTableHeader: Could not open file: " << filename; + return false; + } + int32 magic_number = 0; + ReadType(strm, &magic_number); + int32 file_version = 0; + ReadType(strm, &file_version); + if (magic_number != kSTTableMagicNumber) { + LOG(ERROR) << "ReadSTTableHeader: Wrong file type: " << filename; + return false; + } + if (file_version != kSTTableFileVersion) { + LOG(ERROR) << "ReadSTTableHeader: Wrong file version: " << filename; + return false; + } + int64 i = -1; + strm.seekg(-static_cast(sizeof(int64)), std::ios_base::end); + ReadType(strm, &i); // Reads number of entries + if (strm.fail()) { + LOG(ERROR) << "ReadSTTableHeader: Error reading file: " << filename; + return false; + } + if (i == 0) return true; // No entry header to read. + strm.seekg(-2 * static_cast(sizeof(int64)), std::ios_base::end); + ReadType(strm, &i); // Reads position for last entry in file. + strm.seekg(i); + string key; + ReadType(strm, &key); + header->Read(strm, filename + ":" + key); + if (strm.fail()) { + LOG(ERROR) << "ReadSTTableHeader: Error reading file: " << filename; + return false; + } + return true; +} + +bool IsSTTable(const string &filename); + +} // namespace fst + +#endif // FST_EXTENSIONS_FAR_STTABLE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linear-fst-data-builder.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linear-fst-data-builder.h new file mode 100644 index 0000000..a6ac727 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linear-fst-data-builder.h @@ -0,0 +1,1074 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_LINEAR_LINEAR_FST_DATA_BUILDER_H_ +#define FST_EXTENSIONS_LINEAR_LINEAR_FST_DATA_BUILDER_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +namespace fst { + +// Forward declaration +template +class FeatureGroupBuilder; + +// For logging purposes +inline string TranslateLabel(int64 label, const SymbolTable *syms); +template +string JoinLabels(Iterator begin, Iterator end, const SymbolTable *syms); +template +string JoinLabels(const std::vector *Dump(); + + private: + bool error_; + CompactSet all_output_labels_; + std::map> word_output_map_, word_feat_map_; + std::map> feat_groups_; + std::vector>> groups_; + size_t max_future_size_; + Label max_input_label_; + const SymbolTable *isyms_, *fsyms_, *osyms_; + + LinearFstDataBuilder(const LinearFstDataBuilder &) = delete; + LinearFstDataBuilder &operator=(const LinearFstDataBuilder &) = delete; +}; + +// Builds a LinearFstData tailored for a LinearClassifierFst. The +// major difference between an ordinary LinearFstData that works on +// taggers and a LinearFstData that works on classifiers is that +// feature groups are divided into sections by the prediction class +// label. For a prediction label `pred` and a logical group id +// `group`, the actual group id is `group * num_classes + pred - +// 1`. +// +// This layout saves us from recording output labels in each single +// FeatureGroup. Because there is no need for any delaying, stripping +// the output allows features with different shapes but using the same +// set of feature label mapping to reside in a single FeatureGroup. +template +class LinearClassifierFstDataBuilder { + public: + typedef typename A::Label Label; + typedef typename A::Weight Weight; + + // Constructs a builder for a `num_classes`-class classifier, + // optinally with associated symbol tables for diagnostic + // output. The output labels (i.e. prediction) must be in the range + // of [1, num_classes]. + explicit LinearClassifierFstDataBuilder(size_t num_classes, + const SymbolTable *isyms = nullptr, + const SymbolTable *fsyms = nullptr, + const SymbolTable *osyms = nullptr) + : error_(false), + num_classes_(num_classes), + num_groups_(0), + builder_(isyms, fsyms, osyms) {} + + // Tests whether the builder has encountered any error. Similar to + // LinearFstDataBuilder<>::Error(). + bool Error() const { return error_; } + + // Same as LinearFstDataBuilder<>::AddWord(). + bool AddWord(Label word, const std::vector *Dump(); + + private: + std::vector builder_; +}; + +// Builds a single feature group. Usually used in +// `LinearFstDataBuilder::AddWeight()`. See that method for the +// constraints on grouping features. +template +class FeatureGroupBuilder { + public: + typedef typename A::Label Label; + typedef typename A::Weight Weight; + + // Constructs a builder with the given future size. All features + // added to the group will have look-ahead windows of this size. + FeatureGroupBuilder(size_t future_size, const SymbolTable *fsyms, + const SymbolTable *osyms) + : error_(false), future_size_(future_size), fsyms_(fsyms), osyms_(osyms) { + // This edge is special; see doc of class `FeatureGroup` on the + // details. + start_ = trie_.Insert(trie_.Root(), InputOutputLabel(kNoLabel, kNoLabel)); + } + + // Tests whether the builder has encountered any error. No operation + // is valid if the builder is already at error state. All other + // public methods should check this before any actual operations. + bool Error() const { return error_; } + + // Adds a feature weight with the given context. Returns true iff + // the weight is added. A weight is not added if it has ill-formed + // context involving start-, end-of-sentence marks. + // + // Note: `input` is the sequence of input + // features, instead of input labels themselves. `input` must be at + // least as long as `future_size`; `output` may be empty, but + // usually should be non-empty because an empty output context is + // useless in discriminative modelling. All labels in both `input` + // and `output` must be > 0 (this is checked in + // `LinearFstDataBuilder::AddWeight()`). See + // LinearFstDataBuilder<>::AddWeight for more details. + // + // This may fail if the input is smaller than the look-ahead window. + bool AddWeight(const std::vector *Dump(size_t max_future_size); + + private: + typedef typename FeatureGroup::InputOutputLabel InputOutputLabel; + typedef typename FeatureGroup::InputOutputLabelHash InputOutputLabelHash; + typedef typename FeatureGroup::WeightBackLink WeightBackLink; + // Nested trie topology uses more memory but we can traverse a + // node's children easily, which is required in `BuildBackLinks()`. + typedef NestedTrieTopology Topology; + typedef MutableTrie Trie; + + // Finds the first node with an arc with `label` following the + // back-off chain of `parent`. Returns the node index or + // `kNoTrieNodeId` when not found. The number of hops is stored in + // `hop` when it is not `nullptr`. + // + // This does not fail. + int FindFirstMatch(InputOutputLabel label, int parent, int *hop) const; + + // Links each node to its immediate back-off. root is linked to -1. + // + // This may fail when the unique immediate back-off constraint is + // violated. + void BuildBackLinks(); + + // Traces back on the back-chain for each node to multiply the + // weights from back-offs to the node itself. + // + // This does not fail. + void PreAccumulateWeights(); + + // Reconstruct the path from trie root to given node for logging. + bool TrieDfs(const Topology &topology, int cur, int target, + std::vector *path) const; + string TriePath(int node, const Topology &topology) const; + + bool error_; + size_t future_size_; + Trie trie_; + int start_; + const SymbolTable *fsyms_, *osyms_; + + FeatureGroupBuilder(const FeatureGroupBuilder &) = delete; + FeatureGroupBuilder &operator=(const FeatureGroupBuilder &) = delete; +}; + +// +// Implementation of methods in `LinearFstDataBuilder` +// +template +bool LinearFstDataBuilder::AddWord(Label word, + const std::vector::kStartOfSentence || + word == LinearFstData::kEndOfSentence) { + LOG(WARNING) << "Ignored: adding boundary label: " + << TranslateLabel(word, isyms_) + << "(start-of-sentence=" << LinearFstData::kStartOfSentence + << ", end-of-sentence=" << LinearFstData::kEndOfSentence + << ")"; + return false; + } + if (word <= 0) { + error_ = true; + FSTERROR() << "Word label must be > 0; got " << word; + return false; + } + if (word > max_input_label_) max_input_label_ = word; + // Make sure the word hasn't been added before + if (word_feat_map_.find(word) != word_feat_map_.end()) { + error_ = true; + FSTERROR() << "Input word " << TranslateLabel(word, isyms_) + << " is added twice"; + return false; + } + // Store features + std::set::AddWord( + Label word, const std::vector::kStartOfSentence || + output == LinearFstData::kEndOfSentence) { + LOG(WARNING) << "Ignored: word = " << TranslateLabel(word, isyms_) + << ": adding boundary label as possible output: " << output + << "(start-of-sentence=" + << LinearFstData::kStartOfSentence + << ", end-of-sentence=" << LinearFstData::kEndOfSentence + << ")"; + continue; + } + if (output <= 0) { + error_ = true; + FSTERROR() << "Output label must be > 0; got " << output; + return false; + } + outputs->insert(output); + all_output_labels_.Insert(output); + } + return true; +} + +template +inline int LinearFstDataBuilder::AddGroup(size_t future_size) { + if (error_) { + FSTERROR() << "Calling LinearFstDataBuilder<>::AddGroup() at error state"; + return -1; + } + size_t ret = groups_.size(); + groups_.emplace_back(new FeatureGroupBuilder(future_size, fsyms_, osyms_)); + if (future_size > max_future_size_) max_future_size_ = future_size; + return ret; +} + +template +bool LinearFstDataBuilder::AddWeight(size_t group, + const std::vector::kStartOfSentence && + input[i - 1] != LinearFstData::kStartOfSentence) + start_in_middle = true; + if (input[i - 1] == LinearFstData::kEndOfSentence && + input[i] != LinearFstData::kEndOfSentence) + end_in_middle = true; + } + if (start_in_middle) { + LOG(WARNING) << "Ignored: start-of-sentence in the middle of the input!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + if (end_in_middle) { + LOG(WARNING) << "Ignored: end-of-sentence in the middle of the input!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + } + // Check well-formedness of boundary marks on the output. + { + bool non_first_start = false, non_last_end = false; + for (int i = 1; i < output.size(); ++i) { + if (output[i] == LinearFstData::kStartOfSentence) + non_first_start = true; + if (output[i - 1] == LinearFstData::kEndOfSentence) + non_last_end = true; + } + if (non_first_start) { + LOG(WARNING) << "Ignored: start-of-sentence not appearing " + << "as the first label in the output!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + if (non_last_end) { + LOG(WARNING) << "Ignored: end-of-sentence not appearing " + << "as the last label in the output!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + } + + for (size_t i = 0; i < input.size(); ++i) { + Label feat = input[i]; + if (feat != LinearFstData::kStartOfSentence && + feat != LinearFstData::kEndOfSentence && feat <= 0) { + error_ = true; + FSTERROR() << "Feature label must be > 0; got " << feat; + return false; + } + feat_groups_[feat].insert(group); + } + for (size_t i = 0; i < output.size(); ++i) { + Label label = output[i]; + if (label != LinearFstData::kStartOfSentence && + label != LinearFstData::kEndOfSentence && label <= 0) { + error_ = true; + FSTERROR() << "Output label must be > 0; got " << label; + return false; + } + if (label != LinearFstData::kStartOfSentence && + label != LinearFstData::kEndOfSentence) + all_output_labels_.Insert(label); + } + + // Everything looks good at this point (more checks on the way in + // the feature group). Add this feature weight. + bool added = groups_[group]->AddWeight(input, output, weight); + if (groups_[group]->Error()) { + error_ = true; + FSTERROR() << "FeatureGroupBuilder<>::AddWeight() failed"; + return false; + } + return added; +} + +template +LinearFstData *LinearFstDataBuilder::Dump() { + if (error_) { + FSTERROR() << "Calling LinearFstDataBuilder<>::Dump() at error state"; + return nullptr; + } + + std::unique_ptr> data(new LinearFstData()); + data->max_future_size_ = max_future_size_; + data->max_input_label_ = max_input_label_; + + // Feature groups; free builders after it's dumped. + data->groups_.resize(groups_.size()); + for (int group = 0; group != groups_.size(); ++group) { + FeatureGroup *new_group = groups_[group]->Dump(max_future_size_); + if (new_group == nullptr) { + error_ = true; + FSTERROR() << "Error in dumping group " << group; + return nullptr; + } + data->groups_[group].reset(new_group); + groups_[group].reset(); + VLOG(1) << "Group " << group << ": " << new_group->Stats(); + } + + // Per-group feature mapping + data->group_feat_map_.Init(data->NumGroups(), max_input_label_ + 1); + for (Label word = 1; word <= max_input_label_; ++word) { + typename std::map>::const_iterator it = + word_feat_map_.find(word); + if (it == word_feat_map_.end()) continue; + for (typename std::set::AddWord( + Label word, const std::vector::AddGroup() { + if (error_) { + FSTERROR() << "Calling LinearClassifierFstDataBuilder<>::AddGroup() at " + "error state"; + return -1; + } + for (int i = 0; i < num_classes_; ++i) builder_.AddGroup(0); + if (builder_.Error()) { + error_ = true; + return -1; + } + return num_groups_++; +} + +template +inline bool LinearClassifierFstDataBuilder::AddWeight( + size_t group, const std::vector *LinearClassifierFstDataBuilder::Dump() { + if (error_) { + FSTERROR() + << "Calling LinearClassifierFstDataBuilder<>::Dump() at error state"; + return nullptr; + } + LinearFstData *data = builder_.Dump(); + error_ = true; + return data; +} + +// +// Implementation of methods in `FeatureGroupBuilder` +// +template +bool FeatureGroupBuilder::AddWeight(const std::vector::kStartOfSentence) + ++num_input_start; + int num_output_start = 0; + while (num_output_start < output.size() && + output[num_output_start] == LinearFstData::kStartOfSentence) + ++num_output_start; + int num_input_end = 0; + for (int i = input.size() - 1; + i >= 0 && input[i] == LinearFstData::kEndOfSentence; --i) + ++num_input_end; + int num_output_end = 0; + for (int i = output.size() - 1; + i >= 0 && output[i] == LinearFstData::kEndOfSentence; --i) + ++num_output_end; + + DCHECK_LE(num_output_end, 1); + + if (input.size() - num_input_start < future_size_) { + LOG(WARNING) << "Ignored: start-of-sentence in the future!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, fsyms_); + return false; + } + if (num_input_start > 0 && + input.size() - future_size_ - num_input_start < + output.size() - num_output_start) { + LOG(WARNING) << "Ignored: matching start-of-sentence with actual output!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + if (num_output_start > 0 && + input.size() - future_size_ - num_input_start > + output.size() - num_output_start) { + LOG(WARNING) << "Ignored: matching start-of-sentence with actual input!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + // The following two require `num_output_end` <= 1. + if (num_input_end > future_size_ && num_input_end - future_size_ != 1) { + LOG(WARNING) << "Ignored: matching end-of-sentence with actual output!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + if (num_output_end > 0 && + ((input.size() == future_size_ && future_size_ != num_input_end) || + (input.size() > future_size_ && + num_input_end != future_size_ + num_output_end))) { + LOG(WARNING) << "Ignored: matching end-of-sentence with actual input!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + // Check if the context has no other labels than boundary marks + // (such features are useless). + if (num_input_start + num_input_end == input.size() && + num_output_start + num_output_end == output.size()) { + LOG(WARNING) + << "Ignored: feature context consisting of only boundary marks!"; + LOG(WARNING) << "\tInput: " << JoinLabels(input, fsyms_); + LOG(WARNING) << "\tOutput: " << JoinLabels(output, osyms_); + return false; + } + + // Start point for insertion in the trie. Insert at `start_` iff the + // beginning of the context is non-consumed start-of-sentence. + int cur = (num_input_start == 0 && num_output_start <= future_size_) + ? trie_.Root() + : start_; + // Skip all input start-of-sentence marks + size_t ipos = num_input_start; + // Skip to keep at most `future_size_` start-of-sentence marks + size_t opos = + num_output_start <= future_size_ ? 0 : num_output_start - future_size_; + // Skip `num_output_end` end-of-sentence marks on both input and output + size_t iend = !input.empty() ? input.size() - num_output_end : 0, + oend = output.size() - num_output_end; + // Further, when output is empty, keep at most `future_size_` + // end-of-sentence marks on input. + if (output.empty() && num_input_end > future_size_) + iend = input.size() - num_input_end + future_size_; + + // Actual feature context is (input[ipos:iend], output[opos:oend]). + + // Pad `kNoLabel` as don't cares on the shorter of actual `input` + // and `output`. + const size_t effective_input_size = iend - ipos, + effective_output_size = oend - opos; + if (effective_input_size > effective_output_size) { + for (size_t pad = effective_input_size - effective_output_size; pad != 0; + --pad, ++ipos) + cur = trie_.Insert(cur, InputOutputLabel(input[ipos], kNoLabel)); + } else if (effective_input_size < effective_output_size) { + for (size_t pad = effective_output_size - effective_input_size; pad != 0; + --pad, ++opos) + cur = trie_.Insert(cur, InputOutputLabel(kNoLabel, output[opos])); + } + CHECK_EQ(iend - ipos, oend - opos); + for (; ipos != iend; ++ipos, ++opos) + cur = trie_.Insert(cur, InputOutputLabel(input[ipos], output[opos])); + // We only need to attach final weight when there is an output + // end-of-sentence. When there is only end-of-sentence on the input, + // they are all consumed as the end-of-sentence paddings from + // `LinearFstImpl<>::ShiftBuffer()`. `LinearFstImpl<>::Expand()` + // and `LinearFstImpl<>::MatchInput()` ensures no other + // transition takes place after consuming the padding. + if (num_output_end > 0 || (output.empty() && num_input_end > future_size_)) + trie_[cur].final_weight = Times(trie_[cur].final_weight, weight); + else + trie_[cur].weight = Times(trie_[cur].weight, weight); + + return true; +} + +template +FeatureGroup *FeatureGroupBuilder::Dump(size_t max_future_size) { + if (error_) { + FSTERROR() << "Calling FeatureGroupBuilder<>::PreAccumulateWeights() " + << "at error state"; + return nullptr; + } + + if (max_future_size < future_size_) { + error_ = true; + FSTERROR() << "max_future_size (= " << max_future_size + << ") is smaller the builder's future_size (= " << future_size_ + << ")"; + return nullptr; + } + + BuildBackLinks(); + if (error_) return nullptr; + PreAccumulateWeights(); // does not fail + + FeatureGroup *ret = + new FeatureGroup(max_future_size - future_size_, start_); + + // Walk around the trie to compute next states + ret->next_state_.resize(trie_.NumNodes()); + const Topology &topology = trie_.TrieTopology(); + for (int i = 0; i < topology.NumNodes(); ++i) { + int next = i; + while (next != topology.Root() && topology.ChildrenOf(next).empty() && + trie_[next].final_weight == + trie_[trie_[next].back_link].final_weight) + next = trie_[next].back_link; + ret->next_state_[i] = next; + } + + // Copy the trie + typename FeatureGroup::Trie store_trie(trie_); + ret->trie_.swap(store_trie); + + // Put the builder at error state to prevent repeated call of `Dump()`. + error_ = true; + return ret; +} + +template +int FeatureGroupBuilder::FindFirstMatch(InputOutputLabel label, int parent, + int *hop) const { + int hop_count = 0; + int ret = kNoTrieNodeId; + for (; parent >= 0; parent = trie_[parent].back_link, ++hop_count) { + int next = trie_.Find(parent, label); + if (next != kNoTrieNodeId) { + ret = next; + break; + } + } + if (hop != nullptr) *hop = hop_count; + return ret; +} + +template +void FeatureGroupBuilder::BuildBackLinks() { + // Breadth first search from the root. In the case where we only + // have the input label, the immedate back-off is simply the longest + // suffix of the current node that is also in the trie. For a node + // reached from its parent with label L, we can simply walk through + // the parent's back-off chain to find the first state with an arc + // of the same label L. The uniqueness is always + // guanranteed. However, in the case with both input and output + // labels, it is possible to back off by removing first labels from + // either side, which in general causes non-uniqueness. + + const Topology &topology = trie_.TrieTopology(); + std::queue q; // all enqueued or visited nodes have known links + + // Note: nodes have back link initialized to -1 in their + // constructor. + q.push(trie_.Root()); + while (!error_ && !q.empty()) { + int parent = q.front(); + q.pop(); + // Find links for every child + const typename Topology::NextMap &children = topology.ChildrenOf(parent); + for (typename Topology::NextMap::const_iterator eit = children.begin(); + eit != children.end(); ++eit) { + const std::pair &edge = *eit; + InputOutputLabel label = edge.first; + int child = edge.second; + if (label.input == kNoLabel || label.output == kNoLabel) { + // Label pairs from root to here all have one and only one + // `kNoLabel` on the same side; equivalent to the + // "longest-suffix" case. + trie_[child].back_link = + FindFirstMatch(label, trie_[parent].back_link, nullptr); + } else { + // Neither side is `kNoLabel` at this point, there are + // three possible ways to back-off: if the parent backs + // off to some context with only one side non-empty, the + // empty side may remain empty; or else an exact match of + // both sides is needed. Try to find all three possible + // backs and look for the closest one (in terms of hops + // along the parent's back-off chain). + int only_input_hop, only_output_hop, full_hop; + int only_input_link = + FindFirstMatch(InputOutputLabel(label.input, kNoLabel), parent, + &only_input_hop), + only_output_link = + FindFirstMatch(InputOutputLabel(kNoLabel, label.output), parent, + &only_output_hop), + full_link = + FindFirstMatch(label, trie_[parent].back_link, &full_hop); + if (only_input_link != -1 && only_output_link != -1) { + error_ = true; + FSTERROR() << "Branching back-off chain:\n" + << "\tnode " << child << ": " << TriePath(child, topology) + << "\n" + << "\tcan back-off to node " << only_input_link << ": " + << TriePath(only_input_link, topology) << "\n" + << "\tcan back-off to node " << only_output_link << ": " + << TriePath(only_output_link, topology); + return; + } else if (full_link != -1) { + ++full_hop; + if (full_hop <= only_input_hop && full_hop <= only_output_hop) { + trie_[child].back_link = full_link; + } else { + error_ = true; + int problem_link = only_input_link != kNoTrieNodeId + ? only_input_link + : only_output_link; + CHECK_NE(problem_link, kNoTrieNodeId); + FSTERROR() << "Branching back-off chain:\n" + << "\tnode " << child << ": " + << TriePath(child, topology) << "\n" + << "\tcan back-off to node " << full_link << ": " + << TriePath(full_link, topology) << "\n" + << "tcan back-off to node " << problem_link << ": " + << TriePath(problem_link, topology); + return; + } + } else { + trie_[child].back_link = + only_input_link != -1 ? only_input_link : only_output_link; + } + } + if (error_) break; + // Point to empty context (root) when no back-off can be found + if (trie_[child].back_link == -1) trie_[child].back_link = 0; + q.push(child); + } + } +} + +template +void FeatureGroupBuilder::PreAccumulateWeights() { + std::vector visited(trie_.NumNodes(), false); + visited[trie_.Root()] = true; + + for (size_t i = 0; i != trie_.NumNodes(); ++i) { + std::stack back_offs; + for (int j = i; !visited[j]; j = trie_[j].back_link) back_offs.push(j); + while (!back_offs.empty()) { + int j = back_offs.top(); + back_offs.pop(); + WeightBackLink &node = trie_[j]; + node.weight = Times(node.weight, trie_[node.back_link].weight); + node.final_weight = + Times(node.final_weight, trie_[node.back_link].final_weight); + visited[j] = true; + } + } +} + +template +bool FeatureGroupBuilder::TrieDfs( + const Topology &topology, int cur, int target, + std::vector *path) const { + if (cur == target) return true; + const typename Topology::NextMap &children = topology.ChildrenOf(cur); + for (typename Topology::NextMap::const_iterator eit = children.begin(); + eit != children.end(); ++eit) { + const std::pair &edge = *eit; + path->push_back(edge.first); + if (TrieDfs(topology, edge.second, target, path)) return true; + path->pop_back(); + } + return false; +} + +template +string FeatureGroupBuilder::TriePath(int node, + const Topology &topology) const { + std::vector labels; + TrieDfs(topology, topology.Root(), node, &labels); + bool first = true; + std::ostringstream strm; + for (typename std::vector::const_iterator it = + labels.begin(); + it != labels.end(); ++it) { + InputOutputLabel i = *it; + if (first) + first = false; + else + strm << ", "; + strm << "(" << TranslateLabel(i.input, fsyms_) << ", " + << TranslateLabel(i.output, osyms_) << ")"; + } + return strm.str(); +} + +inline string TranslateLabel(int64 label, const SymbolTable *syms) { + string ret; + if (syms != nullptr) ret += syms->Find(label); + if (ret.empty()) { + std::ostringstream strm; + strm << '<' << label << '>'; + ret = strm.str(); + } + return ret; +} + +template +string JoinLabels(Iterator begin, Iterator end, const SymbolTable *syms) { + if (begin == end) return ""; + std::ostringstream strm; + bool first = true; + for (Iterator it = begin; it != end; ++it) { + if (first) + first = false; + else + strm << '|'; + strm << TranslateLabel(*it, syms); + } + return strm.str(); +} + +template +string JoinLabels(const std::vector::kStartOfSentence; + } else if (left && !right) { + // Can only be end + (*sequence)[i] = LinearFstData::kEndOfSentence; + } else if (!left && right) { + // Can only be start + (*sequence)[i] = LinearFstData::kStartOfSentence; + } else { + // !left && !right; can't really tell + ++unresolved; + } + } + return unresolved; +} + +} // namespace fst + +#endif // FST_EXTENSIONS_LINEAR_LINEAR_FST_DATA_BUILDER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linear-fst-data.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linear-fst-data.h new file mode 100644 index 0000000..3b39c29 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linear-fst-data.h @@ -0,0 +1,526 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Data structures for storing and looking up the actual feature weights. + +#ifndef FST_EXTENSIONS_LINEAR_LINEAR_FST_DATA_H_ +#define FST_EXTENSIONS_LINEAR_LINEAR_FST_DATA_H_ + +#include +#include +#include +#include +#include + +#include +#include + +#include + +namespace fst { + +// Forward declarations +template +class LinearFstDataBuilder; +template +class FeatureGroup; + +// Immutable data storage of the feature weights in a linear +// model. Produces state tuples that represent internal states of a +// LinearTaggerFst. Object of this class can only be constructed via +// either `LinearFstDataBuilder::Dump()` or `LinearFstData::Read()` +// and usually used as refcount'd object shared across mutiple +// `LinearTaggerFst` copies. +// +// TODO(wuke): more efficient trie implementation +template +class LinearFstData { + public: + friend class LinearFstDataBuilder; // For builder access + + typedef typename A::Label Label; + typedef typename A::Weight Weight; + + // Sentence boundary labels. Both of them are negative labels other + // than `kNoLabel`. + static const Label kStartOfSentence; + static const Label kEndOfSentence; + + // Constructs empty data; for non-trivial ways of construction see + // `Read()` and `LinearFstDataBuilder`. + LinearFstData() + : max_future_size_(0), max_input_label_(1), input_attribs_(1) {} + + // Appends the state tuple of the start state to `output`, where + // each tuple holds the node ids of a trie for each feature group. + void EncodeStartState(std::vector *Read(std::istream &strm); // NOLINT + std::ostream &Write(std::ostream &strm) const; // NOLINT + + private: + // Offsets in `output_pool_` + struct InputAttribute { + size_t output_begin, output_length; + + std::istream &Read(std::istream &strm); // NOLINT + std::ostream &Write(std::ostream &strm) const; // NOLINT + }; + + // Mapping from input label to per-group feature label + class GroupFeatureMap; + + // Translates the input label into input feature label of group + // `group`; returns `kNoLabel` when there is no feature for that + // group. + Label FindFeature(size_t group, Label word) const; + + size_t max_future_size_; + Label max_input_label_; + std::vector>> groups_; + std::vector input_attribs_; + std::vector::kStartOfSentence = -3; +template +const typename A::Label LinearFstData::kEndOfSentence = -2; + +template +template +void LinearFstData::TakeTransition(Iterator buffer_end, + Iterator trie_state_begin, + Iterator trie_state_end, Label ilabel, + Label olabel, std::vector::GroupTransition(int group_id, + int trie_state, + Label ilabel, Label olabel, + Weight *weight) const { + Label group_ilabel = FindFeature(group_id, ilabel); + return groups_[group_id]->Walk(trie_state, group_ilabel, olabel, weight); +} + +template +template +inline typename A::Weight LinearFstData::FinalWeight( + Iterator trie_state_begin, Iterator trie_state_end) const { + DCHECK_EQ(trie_state_end - trie_state_begin, groups_.size()); + size_t group_id = 0; + Weight accum = Weight::One(); + for (Iterator it = trie_state_begin; it != trie_state_end; ++it, ++group_id) + accum = Times(accum, GroupFinalWeight(group_id, *it)); + return accum; +} + +template +inline std::pair::const_iterator, + typename std::vector::const_iterator> +LinearFstData::PossibleOutputLabels(Label word) const { + const InputAttribute &attrib = input_attribs_[word]; + if (attrib.output_length == 0) + return std::make_pair(output_set_.begin(), output_set_.end()); + else + return std::make_pair( + output_pool_.begin() + attrib.output_begin, + output_pool_.begin() + attrib.output_begin + attrib.output_length); +} + +template +inline LinearFstData *LinearFstData::Read(std::istream &strm) { // NOLINT + std::unique_ptr> data(new LinearFstData()); + ReadType(strm, &(data->max_future_size_)); + ReadType(strm, &(data->max_input_label_)); + // Feature groups + size_t num_groups = 0; + ReadType(strm, &num_groups); + data->groups_.resize(num_groups); + for (size_t i = 0; i < num_groups; ++i) + data->groups_[i].reset(FeatureGroup::Read(strm)); + // Other data + ReadType(strm, &(data->input_attribs_)); + ReadType(strm, &(data->output_pool_)); + ReadType(strm, &(data->output_set_)); + ReadType(strm, &(data->group_feat_map_)); + if (strm) { + return data.release(); + } else { + return nullptr; + } +} + +template +inline std::ostream &LinearFstData::Write( + std::ostream &strm) const { // NOLINT + WriteType(strm, max_future_size_); + WriteType(strm, max_input_label_); + // Feature groups + WriteType(strm, groups_.size()); + for (size_t i = 0; i < groups_.size(); ++i) { + groups_[i]->Write(strm); + } + // Other data + WriteType(strm, input_attribs_); + WriteType(strm, output_pool_); + WriteType(strm, output_set_); + WriteType(strm, group_feat_map_); + return strm; +} + +template +typename A::Label LinearFstData::FindFeature(size_t group, + Label word) const { + DCHECK(word > 0 || word == kStartOfSentence || word == kEndOfSentence); + if (word == kStartOfSentence || word == kEndOfSentence) + return word; + else + return group_feat_map_.Find(group, word); +} + +template +inline std::istream &LinearFstData::InputAttribute::Read( + std::istream &strm) { // NOLINT + ReadType(strm, &output_begin); + ReadType(strm, &output_length); + return strm; +} + +template +inline std::ostream &LinearFstData::InputAttribute::Write( + std::ostream &strm) const { // NOLINT + WriteType(strm, output_begin); + WriteType(strm, output_length); + return strm; +} + +// Forward declaration +template +class FeatureGroupBuilder; + +// An immutable grouping of features with similar context shape. Like +// `LinearFstData`, this can only be constructed via `Read()` or +// via its builder. +// +// Internally it uses a trie to store all feature n-grams and their +// weights. The label of a trie edge is a pair (feat, olabel) of +// labels. They can be either positive (ordinary label), `kNoLabel`, +// `kStartOfSentence`, or `kEndOfSentence`. `kNoLabel` usually means +// matching anything, with one exception: from the root of the trie, +// there is a special (kNoLabel, kNoLabel) that leads to the implicit +// start-of-sentence state. This edge is never actually matched +// (`FindFirstMatch()` ensures this). +template +class FeatureGroup { + public: + friend class FeatureGroupBuilder; // for builder access + + typedef typename A::Label Label; + typedef typename A::Weight Weight; + + int Start() const { return start_; } + + // Finds destination node from `cur` by consuming `ilabel` and + // `olabel`. The transition weight is multiplied onto `weight`. + int Walk(int cur, Label ilabel, Label olabel, Weight *weight) const; + + // Returns the final weight of the current trie state. Only valid if + // the state is already known to be part of a final state (see + // `LinearFstData<>::CanBeFinal()`). + Weight FinalWeight(int trie_state) const { + return trie_[trie_state].final_weight; + } + + static FeatureGroup *Read(std::istream &strm) { // NOLINT + size_t delay; + ReadType(strm, &delay); + int start; + ReadType(strm, &start); + Trie trie; + ReadType(strm, &trie); + std::unique_ptr> ret(new FeatureGroup(delay, start)); + ret->trie_.swap(trie); + ReadType(strm, &ret->next_state_); + if (strm) { + return ret.release(); + } else { + return nullptr; + } + } + + std::ostream &Write(std::ostream &strm) const { // NOLINT + WriteType(strm, delay_); + WriteType(strm, start_); + WriteType(strm, trie_); + WriteType(strm, next_state_); + return strm; + } + + size_t Delay() const { return delay_; } + + string Stats() const; + + private: + // Label along the arcs on the trie. `kNoLabel` means anything + // (non-negative label) can match; both sides holding `kNoLabel` + // is not allow; otherwise the label is > 0 (enforced by + // `LinearFstDataBuilder::AddWeight()`). + struct InputOutputLabel; + struct InputOutputLabelHash; + + // Data to be stored on the trie + struct WeightBackLink { + int back_link; + Weight weight, final_weight; + + WeightBackLink() + : back_link(kNoTrieNodeId), + weight(Weight::One()), + final_weight(Weight::One()) {} + + std::istream &Read(std::istream &strm) { // NOLINT + ReadType(strm, &back_link); + ReadType(strm, &weight); + ReadType(strm, &final_weight); + return strm; + } + + std::ostream &Write(std::ostream &strm) const { // NOLINT + WriteType(strm, back_link); + WriteType(strm, weight); + WriteType(strm, final_weight); + return strm; + } + }; + + typedef FlatTrieTopology Topology; + typedef MutableTrie Trie; + + explicit FeatureGroup(size_t delay, int start) + : delay_(delay), start_(start) {} + + // Finds the first node with an arc with `label` following the + // back-off chain of `parent`. Returns the node index or + // `kNoTrieNodeId` when not found. + int FindFirstMatch(InputOutputLabel label, int parent) const; + + size_t delay_; + int start_; + Trie trie_; + // Where to go after hitting this state. When we reach a state with + // no child and with no additional final weight (i.e. its final + // weight is the same as its back-off), we can immediately go to its + // back-off state. + std::vector next_state_; + + FeatureGroup(const FeatureGroup &) = delete; + FeatureGroup &operator=(const FeatureGroup &) = delete; +}; + +template +struct FeatureGroup::InputOutputLabel { + Label input, output; + + InputOutputLabel(Label i = kNoLabel, Label o = kNoLabel) + : input(i), output(o) {} + + bool operator==(InputOutputLabel that) const { + return input == that.input && output == that.output; + } + + std::istream &Read(std::istream &strm) { // NOLINT + ReadType(strm, &input); + ReadType(strm, &output); + return strm; + } + + std::ostream &Write(std::ostream &strm) const { // NOLINT + WriteType(strm, input); + WriteType(strm, output); + return strm; + } +}; + +template +struct FeatureGroup::InputOutputLabelHash { + size_t operator()(InputOutputLabel label) const { + return static_cast(label.input * 7853 + label.output); + } +}; + +template +int FeatureGroup::Walk(int cur, Label ilabel, Label olabel, + Weight *weight) const { + // Note: user of this method need to ensure `ilabel` and `olabel` + // are valid (e.g. see DCHECKs in + // `LinearFstData<>::TakeTransition()` and + // `LinearFstData<>::FindFeature()`). + int next; + if (ilabel == LinearFstData::kStartOfSentence) { + // An observed start-of-sentence only occurs in the beginning of + // the input, when this feature group is delayed (i.e. there is + // another feature group with a larger future size). The actual + // input hasn't arrived so stay at the start state. + DCHECK_EQ(cur, start_); + next = start_; + } else { + // First, try exact match + next = FindFirstMatch(InputOutputLabel(ilabel, olabel), cur); + // Then try with don't cares + if (next == kNoTrieNodeId) + next = FindFirstMatch(InputOutputLabel(ilabel, kNoLabel), cur); + if (next == kNoTrieNodeId) + next = FindFirstMatch(InputOutputLabel(kNoLabel, olabel), cur); + // All failed, go to empty context + if (next == kNoTrieNodeId) next = trie_.Root(); + *weight = Times(*weight, trie_[next].weight); + next = next_state_[next]; + } + return next; +} + +template +inline int FeatureGroup::FindFirstMatch(InputOutputLabel label, + int parent) const { + if (label.input == kNoLabel && label.output == kNoLabel) + return kNoTrieNodeId; // very important; see class doc. + for (; parent != kNoTrieNodeId; parent = trie_[parent].back_link) { + int next = trie_.Find(parent, label); + if (next != kNoTrieNodeId) return next; + } + return kNoTrieNodeId; +} + +template +inline string FeatureGroup::Stats() const { + std::ostringstream strm; + int num_states = 2; + for (int i = 2; i < next_state_.size(); ++i) + num_states += i == next_state_[i]; + strm << trie_.NumNodes() << " node(s); " << num_states << " state(s)"; + return strm.str(); +} + +template +class LinearFstData::GroupFeatureMap { + public: + GroupFeatureMap() {} + + void Init(size_t num_groups, size_t num_words) { + num_groups_ = num_groups; + pool_.clear(); + pool_.resize(num_groups * num_words, kNoLabel); + } + + Label Find(size_t group_id, Label ilabel) const { + return pool_[IndexOf(group_id, ilabel)]; + } + + bool Set(size_t group_id, Label ilabel, Label feat) { + size_t i = IndexOf(group_id, ilabel); + if (pool_[i] != kNoLabel && pool_[i] != feat) { + FSTERROR() << "Feature group " << group_id + << " already has feature for word " << ilabel; + return false; + } + pool_[i] = feat; + return true; + } + + std::istream &Read(std::istream &strm) { // NOLINT + ReadType(strm, &num_groups_); + ReadType(strm, &pool_); + return strm; + } + + std::ostream &Write(std::ostream &strm) const { // NOLINT + WriteType(strm, num_groups_); + WriteType(strm, pool_); + return strm; + } + + private: + size_t IndexOf(size_t group_id, Label ilabel) const { + return ilabel * num_groups_ + group_id; + } + + size_t num_groups_; + // `pool_[ilabel * num_groups_ + group_id]` is the feature active + // for group `group_id` with input `ilabel` + std::vector { + public: + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::WriteHeader; + + using CacheBaseImpl>::PushArc; + using CacheBaseImpl>::HasArcs; + using CacheBaseImpl>::HasFinal; + using CacheBaseImpl>::HasStart; + using CacheBaseImpl>::SetArcs; + using CacheBaseImpl>::SetFinal; + using CacheBaseImpl>::SetStart; + + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::Weight Weight; + typedef typename A::StateId StateId; + typedef typename Collection::SetIterator NGramIterator; + + // Constructs an empty FST by default. + LinearTaggerFstImpl() + : CacheImpl(CacheOptions()), + data_(std::make_shared>()), + delay_(0) { + SetType("linear-tagger"); + } + + // Constructs the FST with given data storage and symbol + // tables. + // + // TODO(wuke): when there is no constraint on output we can delay + // less than `data->MaxFutureSize` positions. + LinearTaggerFstImpl(const LinearFstData *data, const SymbolTable *isyms, + const SymbolTable *osyms, CacheOptions opts) + : CacheImpl(opts), data_(data), delay_(data->MaxFutureSize()) { + SetType("linear-tagger"); + SetProperties(kILabelSorted, kFstProperties); + SetInputSymbols(isyms); + SetOutputSymbols(osyms); + ReserveStubSpace(); + } + + // Copy by sharing the underlying data storage. + LinearTaggerFstImpl(const LinearTaggerFstImpl &impl) + : CacheImpl(impl), data_(impl.data_), delay_(impl.delay_) { + SetType("linear-tagger"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + ReserveStubSpace(); + } + + StateId Start() { + if (!HasStart()) { + StateId start = FindStartState(); + SetStart(start); + } + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) { + state_stub_.clear(); + FillState(s, &state_stub_); + if (CanBeFinal(state_stub_)) + SetFinal(s, data_->FinalWeight(InternalBegin(state_stub_), + InternalEnd(state_stub_))); + else + SetFinal(s, Weight::Zero()); + } + return CacheImpl::Final(s); + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + // Computes the outgoing transitions from a state, creating new + // destination states as needed. + void Expand(StateId s); + + // Appends to `arcs` all out-going arcs from state `s` that matches `label` as + // the input label. + void MatchInput(StateId s, Label ilabel, std::vector *arcs); + + static LinearTaggerFstImpl *Read(std::istream &strm, + const FstReadOptions &opts); + + bool Write(std::ostream &strm, // NOLINT + const FstWriteOptions &opts) const { + FstHeader header; + header.SetStart(kNoStateId); + WriteHeader(strm, opts, kFileVersion, &header); + data_->Write(strm); + if (!strm) { + LOG(ERROR) << "LinearTaggerFst::Write: Write failed: " << opts.source; + return false; + } + return true; + } + + private: + static const int kMinFileVersion; + static const int kFileVersion; + + // A collection of functions to access parts of the state tuple. A + // state tuple is a vector of `Label`s with two parts: + // [buffer] [internal]. + // + // - [buffer] is a buffer of observed input labels with length + // `delay_`. `LinearFstData::kStartOfSentence` + // (resp. `LinearFstData::kEndOfSentence`) are used as + // paddings when the buffer has fewer than `delay_` elements, which + // can only appear as the prefix (resp. suffix) of the buffer. + // + // - [internal] is the internal state tuple for `LinearFstData` + typename std::vector::kStartOfSentence); + // Append internal states + data_->EncodeStartState(&state_stub_); + return FindState(state_stub_); + } + + // Tests whether the buffer in `(begin, end)` is empty. + bool IsEmptyBuffer(typename std::vector::kEndOfSentence => + // buffer[i+x] == LinearFstData::kEndOfSentence + // - buffer[i] == LinearFstData::kStartOfSentence => + // buffer[i-x] == LinearFstData::kStartOfSentence + return delay_ == 0 || *(end - 1) == LinearFstData::kStartOfSentence || + *begin == LinearFstData::kEndOfSentence; + } + + // Tests whether the given state tuple can be a final state. A state + // is final iff there is no observed input in the buffer. + bool CanBeFinal(const std::vector::kMinFileVersion = 1; + +template +const int LinearTaggerFstImpl::kFileVersion = 1; + +template +inline typename A::Label LinearTaggerFstImpl::ShiftBuffer( + const std::vector::kEndOfSentence); + if (delay_ == 0) { + DCHECK_GT(ilabel, 0); + return ilabel; + } else { + (*next_stub_)[BufferEnd(*next_stub_) - next_stub_->begin() - 1] = ilabel; + return *BufferBegin(state); + } +} + +template +inline A LinearTaggerFstImpl::MakeArc(const std::vector::kEndOfSentence); + DCHECK(olabel > 0 || olabel == LinearFstData::kStartOfSentence); + Weight weight(Weight::One()); + data_->TakeTransition(BufferEnd(state), InternalBegin(state), + InternalEnd(state), ilabel, olabel, next_stub_, + &weight); + StateId nextstate = FindState(*next_stub_); + // Restore `next_stub_` to its size before the call + next_stub_->resize(delay_); + // In the actual arc, we use epsilons instead of boundaries. + return A(ilabel == LinearFstData::kEndOfSentence ? 0 : ilabel, + olabel == LinearFstData::kStartOfSentence ? 0 : olabel, weight, + nextstate); +} + +template +inline void LinearTaggerFstImpl::ExpandArcs(StateId s, + const std::vector::kStartOfSentence) { + // This happens when input is shorter than `delay_`. + PushArc(s, MakeArc(state, ilabel, LinearFstData::kStartOfSentence, + next_stub_)); + } else { + std::pair::const_iterator, + typename std::vector::const_iterator> range = + data_->PossibleOutputLabels(obs_ilabel); + for (typename std::vector::const_iterator it = + range.first; + it != range.second; ++it) + PushArc(s, MakeArc(state, ilabel, *it, next_stub_)); + } +} + +// TODO(wuke): this has much in duplicate with `ExpandArcs()` +template +inline void LinearTaggerFstImpl::AppendArcs(StateId /*s*/, + const std::vector::kStartOfSentence) { + // This happens when input is shorter than `delay_`. + arcs->push_back( + MakeArc(state, ilabel, LinearFstData::kStartOfSentence, next_stub_)); + } else { + std::pair::const_iterator, + typename std::vector::const_iterator> range = + data_->PossibleOutputLabels(obs_ilabel); + for (typename std::vector::const_iterator it = + range.first; + it != range.second; ++it) + arcs->push_back(MakeArc(state, ilabel, *it, next_stub_)); + } +} + +template +void LinearTaggerFstImpl::Expand(StateId s) { + VLOG(3) << "Expand " << s; + state_stub_.clear(); + FillState(s, &state_stub_); + + // Precompute the first `delay_ - 1` elements in the buffer of + // next states, which are identical for different input/output. + next_stub_.clear(); + next_stub_.resize(delay_); + if (delay_ > 0) + std::copy(BufferBegin(state_stub_) + 1, BufferEnd(state_stub_), + next_stub_.begin()); + + // Epsilon transition for flushing out the next observed input + if (!IsEmptyBuffer(BufferBegin(state_stub_), BufferEnd(state_stub_))) + ExpandArcs(s, state_stub_, LinearFstData::kEndOfSentence, &next_stub_); + + // Non-epsilon input when we haven't flushed + if (delay_ == 0 || + *(BufferEnd(state_stub_) - 1) != LinearFstData::kEndOfSentence) + for (Label ilabel = data_->MinInputLabel(); + ilabel <= data_->MaxInputLabel(); ++ilabel) + ExpandArcs(s, state_stub_, ilabel, &next_stub_); + + SetArcs(s); +} + +template +void LinearTaggerFstImpl::MatchInput(StateId s, Label ilabel, + std::vector *arcs) { + state_stub_.clear(); + FillState(s, &state_stub_); + + // Precompute the first `delay_ - 1` elements in the buffer of + // next states, which are identical for different input/output. + next_stub_.clear(); + next_stub_.resize(delay_); + if (delay_ > 0) + std::copy(BufferBegin(state_stub_) + 1, BufferEnd(state_stub_), + next_stub_.begin()); + + if (ilabel == 0) { + // Epsilon transition for flushing out the next observed input + if (!IsEmptyBuffer(BufferBegin(state_stub_), BufferEnd(state_stub_))) + AppendArcs(s, state_stub_, LinearFstData::kEndOfSentence, &next_stub_, + arcs); + } else { + // Non-epsilon input when we haven't flushed + if (delay_ == 0 || + *(BufferEnd(state_stub_) - 1) != LinearFstData::kEndOfSentence) + AppendArcs(s, state_stub_, ilabel, &next_stub_, arcs); + } +} + +template +inline LinearTaggerFstImpl *LinearTaggerFstImpl::Read( + std::istream &strm, const FstReadOptions &opts) { // NOLINT + std::unique_ptr> impl(new LinearTaggerFstImpl()); + FstHeader header; + if (!impl->ReadHeader(strm, opts, kMinFileVersion, &header)) { + return nullptr; + } + impl->data_ = std::shared_ptr>(LinearFstData::Read(strm)); + if (!impl->data_) { + return nullptr; + } + impl->delay_ = impl->data_->MaxFutureSize(); + impl->ReserveStubSpace(); + return impl.release(); +} + +} // namespace internal + +// This class attaches interface to implementation and handles +// reference counting, delegating most methods to ImplToFst. +template +class LinearTaggerFst : public ImplToFst> { + public: + friend class ArcIterator>; + friend class StateIterator>; + friend class LinearFstMatcherTpl>; + + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::Weight Weight; + typedef typename A::StateId StateId; + typedef DefaultCacheStore Store; + typedef typename Store::State State; + using Impl = internal::LinearTaggerFstImpl; + + LinearTaggerFst() : ImplToFst(std::make_shared()) {} + + explicit LinearTaggerFst(LinearFstData *data, + const SymbolTable *isyms = nullptr, + const SymbolTable *osyms = nullptr, + CacheOptions opts = CacheOptions()) + : ImplToFst(std::make_shared(data, isyms, osyms, opts)) {} + + explicit LinearTaggerFst(const Fst &fst) + : ImplToFst(std::make_shared()) { + LOG(FATAL) << "LinearTaggerFst: no constructor from arbitrary FST."; + } + + // See Fst<>::Copy() for doc. + LinearTaggerFst(const LinearTaggerFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Get a copy of this LinearTaggerFst. See Fst<>::Copy() for further doc. + LinearTaggerFst *Copy(bool safe = false) const override { + return new LinearTaggerFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + MatcherBase *InitMatcher(MatchType match_type) const override { + return new LinearFstMatcherTpl>(this, match_type); + } + + static LinearTaggerFst *Read(const string &filename) { + if (!filename.empty()) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "LinearTaggerFst::Read: Can't open file: " << filename; + return nullptr; + } + return Read(strm, FstReadOptions(filename)); + } else { + return Read(std::cin, FstReadOptions("standard input")); + } + } + + static LinearTaggerFst *Read(std::istream &in, // NOLINT + const FstReadOptions &opts) { + auto *impl = Impl::Read(in, opts); + return impl ? new LinearTaggerFst(std::shared_ptr(impl)) : nullptr; + } + + bool Write(const string &filename) const override { + if (!filename.empty()) { + std::ofstream strm(filename, + std::ios_base::out | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "LinearTaggerFst::Write: Can't open file: " << filename; + return false; + } + return Write(strm, FstWriteOptions(filename)); + } else { + return Write(std::cout, FstWriteOptions("standard output")); + } + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return GetImpl()->Write(strm, opts); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + explicit LinearTaggerFst(std::shared_ptr impl) + : ImplToFst(impl) {} + + void operator=(const LinearTaggerFst &fst) = delete; +}; + +// Specialization for LinearTaggerFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const LinearTaggerFst &fst) + : CacheStateIterator>(fst, fst.GetMutableImpl()) {} +}; + +// Specialization for LinearTaggerFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const LinearTaggerFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void LinearTaggerFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +namespace internal { + +// Implementation class for on-the-fly generated LinearClassifierFst with +// special optimization in matching. +template +class LinearClassifierFstImpl : public CacheImpl { + public: + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::WriteHeader; + + using CacheBaseImpl>::PushArc; + using CacheBaseImpl>::HasArcs; + using CacheBaseImpl>::HasFinal; + using CacheBaseImpl>::HasStart; + using CacheBaseImpl>::SetArcs; + using CacheBaseImpl>::SetFinal; + using CacheBaseImpl>::SetStart; + + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::Weight Weight; + typedef typename A::StateId StateId; + typedef typename Collection::SetIterator NGramIterator; + + // Constructs an empty FST by default. + LinearClassifierFstImpl() + : CacheImpl(CacheOptions()), + data_(std::make_shared>()) { + SetType("linear-classifier"); + num_classes_ = 0; + num_groups_ = 0; + } + + // Constructs the FST with given data storage, number of classes and + // symbol tables. + LinearClassifierFstImpl(const LinearFstData *data, size_t num_classes, + const SymbolTable *isyms, const SymbolTable *osyms, + CacheOptions opts) + : CacheImpl(opts), + data_(data), + num_classes_(num_classes), + num_groups_(data_->NumGroups() / num_classes_) { + SetType("linear-classifier"); + SetProperties(kILabelSorted, kFstProperties); + SetInputSymbols(isyms); + SetOutputSymbols(osyms); + ReserveStubSpace(); + } + + // Copy by sharing the underlying data storage. + LinearClassifierFstImpl(const LinearClassifierFstImpl &impl) + : CacheImpl(impl), + data_(impl.data_), + num_classes_(impl.num_classes_), + num_groups_(impl.num_groups_) { + SetType("linear-classifier"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + ReserveStubSpace(); + } + + StateId Start() { + if (!HasStart()) { + StateId start = FindStartState(); + SetStart(start); + } + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) { + state_stub_.clear(); + FillState(s, &state_stub_); + SetFinal(s, FinalWeight(state_stub_)); + } + return CacheImpl::Final(s); + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + // Computes the outgoing transitions from a state, creating new + // destination states as needed. + void Expand(StateId s); + + // Appends to `arcs` all out-going arcs from state `s` that matches + // `label` as the input label. + void MatchInput(StateId s, Label ilabel, std::vector *arcs); + + static LinearClassifierFstImpl *Read(std::istream &strm, + const FstReadOptions &opts); + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const { + FstHeader header; + header.SetStart(kNoStateId); + WriteHeader(strm, opts, kFileVersion, &header); + data_->Write(strm); + WriteType(strm, num_classes_); + if (!strm) { + LOG(ERROR) << "LinearClassifierFst::Write: Write failed: " << opts.source; + return false; + } + return true; + } + + private: + static const int kMinFileVersion; + static const int kFileVersion; + + // A collection of functions to access parts of the state tuple. A + // state tuple is a vector of `Label`s with two parts: + // [prediction] [internal]. + // + // - [prediction] is a single label of the predicted class. A state + // must have a positive class label, unless it is the start state. + // + // - [internal] is the internal state tuple for `LinearFstData` of + // the given class; or kNoTrieNodeId's if in start state. + Label &Prediction(std::vector &) = delete; +}; + +template +const int LinearClassifierFstImpl::kMinFileVersion = 0; + +template +const int LinearClassifierFstImpl::kFileVersion = 0; + +template +void LinearClassifierFstImpl::Expand(StateId s) { + VLOG(3) << "Expand " << s; + state_stub_.clear(); + FillState(s, &state_stub_); + next_stub_.clear(); + next_stub_.resize(1 + num_groups_); + + if (IsStartState(state_stub_)) { + // Make prediction + for (Label pred = 1; pred <= num_classes_; ++pred) { + Prediction(next_stub_) = pred; + for (int i = 0; i < num_groups_; ++i) + InternalAt(next_stub_, i) = data_->GroupStartState(GroupId(pred, i)); + PushArc(s, A(0, pred, Weight::One(), FindState(next_stub_))); + } + } else { + Label pred = Prediction(state_stub_); + DCHECK_GT(pred, 0); + DCHECK_LE(pred, num_classes_); + for (Label ilabel = data_->MinInputLabel(); + ilabel <= data_->MaxInputLabel(); ++ilabel) { + Prediction(next_stub_) = pred; + Weight weight = Weight::One(); + for (int i = 0; i < num_groups_; ++i) + InternalAt(next_stub_, i) = + data_->GroupTransition(GroupId(pred, i), InternalAt(state_stub_, i), + ilabel, pred, &weight); + PushArc(s, A(ilabel, 0, weight, FindState(next_stub_))); + } + } + + SetArcs(s); +} + +template +void LinearClassifierFstImpl::MatchInput(StateId s, Label ilabel, + std::vector *arcs) { + state_stub_.clear(); + FillState(s, &state_stub_); + next_stub_.clear(); + next_stub_.resize(1 + num_groups_); + + if (IsStartState(state_stub_)) { + // Make prediction if `ilabel` is epsilon. + if (ilabel == 0) { + for (Label pred = 1; pred <= num_classes_; ++pred) { + Prediction(next_stub_) = pred; + for (int i = 0; i < num_groups_; ++i) + InternalAt(next_stub_, i) = data_->GroupStartState(GroupId(pred, i)); + arcs->push_back(A(0, pred, Weight::One(), FindState(next_stub_))); + } + } + } else if (ilabel != 0) { + Label pred = Prediction(state_stub_); + Weight weight = Weight::One(); + Prediction(next_stub_) = pred; + for (int i = 0; i < num_groups_; ++i) + InternalAt(next_stub_, i) = data_->GroupTransition( + GroupId(pred, i), InternalAt(state_stub_, i), ilabel, pred, &weight); + arcs->push_back(A(ilabel, 0, weight, FindState(next_stub_))); + } +} + +template +inline LinearClassifierFstImpl *LinearClassifierFstImpl::Read( + std::istream &strm, const FstReadOptions &opts) { + std::unique_ptr> impl( + new LinearClassifierFstImpl()); + FstHeader header; + if (!impl->ReadHeader(strm, opts, kMinFileVersion, &header)) { + return nullptr; + } + impl->data_ = std::shared_ptr>(LinearFstData::Read(strm)); + if (!impl->data_) { + return nullptr; + } + ReadType(strm, &impl->num_classes_); + if (!strm) { + return nullptr; + } + impl->num_groups_ = impl->data_->NumGroups() / impl->num_classes_; + if (impl->num_groups_ * impl->num_classes_ != impl->data_->NumGroups()) { + FSTERROR() << "Total number of feature groups is not a multiple of the " + "number of classes: num groups = " + << impl->data_->NumGroups() + << ", num classes = " << impl->num_classes_; + return nullptr; + } + impl->ReserveStubSpace(); + return impl.release(); +} + +} // namespace internal + +// This class attaches interface to implementation and handles +// reference counting, delegating most methods to ImplToFst. +template +class LinearClassifierFst + : public ImplToFst> { + public: + friend class ArcIterator>; + friend class StateIterator>; + friend class LinearFstMatcherTpl>; + + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::Weight Weight; + typedef typename A::StateId StateId; + typedef DefaultCacheStore Store; + typedef typename Store::State State; + using Impl = internal::LinearClassifierFstImpl; + + LinearClassifierFst() : ImplToFst(std::make_shared()) {} + + explicit LinearClassifierFst(LinearFstData *data, size_t num_classes, + const SymbolTable *isyms = nullptr, + const SymbolTable *osyms = nullptr, + CacheOptions opts = CacheOptions()) + : ImplToFst( + std::make_shared(data, num_classes, isyms, osyms, opts)) {} + + explicit LinearClassifierFst(const Fst &fst) + : ImplToFst(std::make_shared()) { + LOG(FATAL) << "LinearClassifierFst: no constructor from arbitrary FST."; + } + + // See Fst<>::Copy() for doc. + LinearClassifierFst(const LinearClassifierFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Get a copy of this LinearClassifierFst. See Fst<>::Copy() for further doc. + LinearClassifierFst *Copy(bool safe = false) const override { + return new LinearClassifierFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + MatcherBase *InitMatcher(MatchType match_type) const override { + return new LinearFstMatcherTpl>(this, match_type); + } + + static LinearClassifierFst *Read(const string &filename) { + if (!filename.empty()) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "LinearClassifierFst::Read: Can't open file: " + << filename; + return nullptr; + } + return Read(strm, FstReadOptions(filename)); + } else { + return Read(std::cin, FstReadOptions("standard input")); + } + } + + static LinearClassifierFst *Read(std::istream &in, + const FstReadOptions &opts) { + auto *impl = Impl::Read(in, opts); + return impl ? new LinearClassifierFst(std::shared_ptr(impl)) + : nullptr; + } + + bool Write(const string &filename) const override { + if (!filename.empty()) { + std::ofstream strm(filename, + std::ios_base::out | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "ProdLmFst::Write: Can't open file: " << filename; + return false; + } + return Write(strm, FstWriteOptions(filename)); + } else { + return Write(std::cout, FstWriteOptions("standard output")); + } + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return GetImpl()->Write(strm, opts); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + explicit LinearClassifierFst(std::shared_ptr impl) + : ImplToFst(impl) {} + + void operator=(const LinearClassifierFst &fst) = delete; +}; + +// Specialization for LinearClassifierFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const LinearClassifierFst &fst) + : CacheStateIterator>(fst, + fst.GetMutableImpl()) {} +}; + +// Specialization for LinearClassifierFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const LinearClassifierFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void LinearClassifierFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Specialized Matcher for LinearFsts. This matcher only supports +// matching from the input side. This is intentional because comparing +// the scores of different input sequences with the same output +// sequence is meaningless in a discriminative model. +template +class LinearFstMatcherTpl : public MatcherBase { + public: + typedef typename F::Arc Arc; + typedef typename Arc::Label Label; + typedef typename Arc::Weight Weight; + typedef typename Arc::StateId StateId; + typedef F FST; + + // This makes a copy of the FST. + LinearFstMatcherTpl(const FST &fst, MatchType match_type) + : owned_fst_(fst.Copy()), + fst_(*owned_fst_), + match_type_(match_type), + s_(kNoStateId), + current_loop_(false), + loop_(kNoLabel, 0, Weight::One(), kNoStateId), + cur_arc_(0), + error_(false) { + switch (match_type_) { + case MATCH_INPUT: + case MATCH_OUTPUT: + case MATCH_NONE: + break; + default: + FSTERROR() << "LinearFstMatcherTpl: Bad match type"; + match_type_ = MATCH_NONE; + error_ = true; + } + } + + // This doesn't copy the FST. + LinearFstMatcherTpl(const FST *fst, MatchType match_type) + : fst_(*fst), + match_type_(match_type), + s_(kNoStateId), + current_loop_(false), + loop_(kNoLabel, 0, Weight::One(), kNoStateId), + cur_arc_(0), + error_(false) { + switch (match_type_) { + case MATCH_INPUT: + case MATCH_OUTPUT: + case MATCH_NONE: + break; + default: + FSTERROR() << "LinearFstMatcherTpl: Bad match type"; + match_type_ = MATCH_NONE; + error_ = true; + } + } + + // This makes a copy of the FST. + LinearFstMatcherTpl(const LinearFstMatcherTpl &matcher, bool safe = false) + : owned_fst_(matcher.fst_.Copy(safe)), + fst_(*owned_fst_), + match_type_(matcher.match_type_), + s_(kNoStateId), + current_loop_(false), + loop_(matcher.loop_), + cur_arc_(0), + error_(matcher.error_) {} + + LinearFstMatcherTpl *Copy(bool safe = false) const override { + return new LinearFstMatcherTpl(*this, safe); + } + + MatchType Type(bool /*test*/) const override { + // `MATCH_INPUT` is the only valid type + return match_type_ == MATCH_INPUT ? match_type_ : MATCH_NONE; + } + + void SetState(StateId s) final { + if (s_ == s) return; + s_ = s; + // `MATCH_INPUT` is the only valid type + if (match_type_ != MATCH_INPUT) { + FSTERROR() << "LinearFstMatcherTpl: Bad match type"; + error_ = true; + } + loop_.nextstate = s; + } + + bool Find(Label label) final { + if (error_) { + current_loop_ = false; + return false; + } + current_loop_ = label == 0; + if (label == kNoLabel) label = 0; + arcs_.clear(); + cur_arc_ = 0; + fst_.GetMutableImpl()->MatchInput(s_, label, &arcs_); + return current_loop_ || !arcs_.empty(); + } + + bool Done() const final { + return !(current_loop_ || cur_arc_ < arcs_.size()); + } + + const Arc &Value() const final { + return current_loop_ ? loop_ : arcs_[cur_arc_]; + } + + void Next() final { + if (current_loop_) + current_loop_ = false; + else + ++cur_arc_; + } + + ssize_t Priority(StateId s) final { return kRequirePriority; } + + const FST &GetFst() const override { return fst_; } + + uint64 Properties(uint64 props) const override { + if (error_) props |= kError; + return props; + } + + uint32 Flags() const override { return kRequireMatch; } + + private: + std::unique_ptr owned_fst_; + const FST &fst_; + MatchType match_type_; // Type of match to perform. + StateId s_; // Current state. + bool current_loop_; // Current arc is the implicit loop. + Arc loop_; // For non-consuming symbols. + // All out-going arcs matching the label in last Find() call. + std::vector arcs_; + size_t cur_arc_; // Index to the arc that `Value()` should return. + bool error_; // Error encountered. +}; + +} // namespace fst + +#endif // FST_EXTENSIONS_LINEAR_LINEAR_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linearscript.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linearscript.h new file mode 100644 index 0000000..54106d2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/linearscript.h @@ -0,0 +1,391 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_LINEAR_LINEARSCRIPT_H_ +#define FST_EXTENSIONS_LINEAR_LINEARSCRIPT_H_ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_string(delimiter); +DECLARE_string(empty_symbol); +DECLARE_string(start_symbol); +DECLARE_string(end_symbol); +DECLARE_bool(classifier); + +namespace fst { +namespace script { +typedef std::tuple + LinearCompileArgs; + +bool ValidateDelimiter(); +bool ValidateEmptySymbol(); + +// Returns the proper label given the symbol. For symbols other than +// `FLAGS_start_symbol` or `FLAGS_end_symbol`, looks up the symbol +// table to decide the label. Depending on whether +// `FLAGS_start_symbol` and `FLAGS_end_symbol` are identical, it +// either returns `kNoLabel` for later processing or decides the label +// right away. +template +inline typename Arc::Label LookUp(const string &str, SymbolTable *syms) { + if (str == FLAGS_start_symbol) + return str == FLAGS_end_symbol ? kNoLabel + : LinearFstData::kStartOfSentence; + else if (str == FLAGS_end_symbol) + return LinearFstData::kEndOfSentence; + else + return syms->AddSymbol(str); +} + +// Splits `str` with `delim` as the delimiter and stores the labels in +// `output`. +template +void SplitAndPush(const string &str, const char delim, SymbolTable *syms, + std::vector *output) { + if (str == FLAGS_empty_symbol) return; + std::istringstream strm(str); + string buf; + while (std::getline(strm, buf, delim)) + output->push_back(LookUp(buf, syms)); +} + +// Like `std::replace_copy` but returns the number of modifications +template +size_t ReplaceCopy(InputIterator first, InputIterator last, + OutputIterator result, const T &old_value, + const T &new_value) { + size_t changes = 0; + while (first != last) { + if (*first == old_value) { + *result = new_value; + ++changes; + } else { + *result = *first; + } + ++first; + ++result; + } + return changes; +} + +template +bool GetVocabRecord(const string &vocab, std::istream &strm, // NOLINT + SymbolTable *isyms, SymbolTable *fsyms, SymbolTable *osyms, + typename Arc::Label *word, + std::vector *feature_labels, + std::vector *possible_labels, + size_t *num_line); + +template +bool GetModelRecord(const string &model, std::istream &strm, // NOLINT + SymbolTable *fsyms, SymbolTable *osyms, + std::vector *input_labels, + std::vector *output_labels, + typename Arc::Weight *weight, size_t *num_line); + +// Reads in vocabulary file. Each line is in the following format +// +// word features [ possible output ] +// +// where features and possible output are `FLAGS_delimiter`-delimited lists of +// tokens +template +void AddVocab(const string &vocab, SymbolTable *isyms, SymbolTable *fsyms, + SymbolTable *osyms, LinearFstDataBuilder *builder) { + std::ifstream in(vocab); + if (!in) LOG(FATAL) << "Can't open file: " << vocab; + size_t num_line = 0, num_added = 0; + std::vector fields; + std::vector feature_labels, possible_labels; + typename Arc::Label word; + while (GetVocabRecord(vocab, in, isyms, fsyms, osyms, &word, + &feature_labels, &possible_labels, &num_line)) { + if (word == kNoLabel) { + LOG(WARNING) << "Ignored: boundary word: " << fields[0]; + continue; + } + if (possible_labels.empty()) + num_added += builder->AddWord(word, feature_labels); + else + num_added += builder->AddWord(word, feature_labels, possible_labels); + } + VLOG(1) << "Read " << num_added << " words in " << num_line << " lines from " + << vocab; +} + +template +void AddVocab(const string &vocab, SymbolTable *isyms, SymbolTable *fsyms, + SymbolTable *osyms, + LinearClassifierFstDataBuilder *builder) { + std::ifstream in(vocab); + if (!in) LOG(FATAL) << "Can't open file: " << vocab; + size_t num_line = 0, num_added = 0; + std::vector fields; + std::vector feature_labels, possible_labels; + typename Arc::Label word; + while (GetVocabRecord(vocab, in, isyms, fsyms, osyms, &word, + &feature_labels, &possible_labels, &num_line)) { + if (!possible_labels.empty()) + LOG(FATAL) + << "Classifier vocabulary should not have possible output constraint"; + if (word == kNoLabel) { + LOG(WARNING) << "Ignored: boundary word: " << fields[0]; + continue; + } + num_added += builder->AddWord(word, feature_labels); + } + VLOG(1) << "Read " << num_added << " words in " << num_line << " lines from " + << vocab; +} + +// Reads in model file. The first line is an integer designating the +// size of future window in the input sequences. After this, each line +// is in the following format +// +// input sequence output sequence weight +// +// input sequence is a `FLAGS_delimiter`-delimited sequence of feature +// labels (see `AddVocab()`) . output sequence is a +// `FLAGS_delimiter`-delimited sequence of output labels where the +// last label is the output of the feature position before the history +// boundary. +template +void AddModel(const string &model, SymbolTable *fsyms, SymbolTable *osyms, + LinearFstDataBuilder *builder) { + std::ifstream in(model); + if (!in) LOG(FATAL) << "Can't open file: " << model; + string line; + std::getline(in, line); + if (!in) LOG(FATAL) << "Empty file: " << model; + size_t future_size; + { + std::istringstream strm(line); + strm >> future_size; + if (!strm) LOG(FATAL) << "Can't read future size: " << model; + } + size_t num_line = 1, num_added = 0; + const int group = builder->AddGroup(future_size); + VLOG(1) << "Group " << group << ": from " << model << "; future size is " + << future_size << "."; + // Add the rest of lines as a single feature group + std::vector fields; + std::vector input_labels, output_labels; + typename Arc::Weight weight; + while (GetModelRecord(model, in, fsyms, osyms, &input_labels, + &output_labels, &weight, &num_line)) { + if (output_labels.empty()) + LOG(FATAL) << "Empty output sequence in source " << model << ", line " + << num_line; + + const typename Arc::Label marks[] = {LinearFstData::kStartOfSentence, + LinearFstData::kEndOfSentence}; + + std::vector copy_input(input_labels.size()), + copy_output(output_labels.size()); + for (int i = 0; i < 2; ++i) { + for (int j = 0; j < 2; ++j) { + size_t num_input_changes = + ReplaceCopy(input_labels.begin(), input_labels.end(), + copy_input.begin(), kNoLabel, marks[i]); + size_t num_output_changes = + ReplaceCopy(output_labels.begin(), output_labels.end(), + copy_output.begin(), kNoLabel, marks[j]); + if ((num_input_changes > 0 || i == 0) && + (num_output_changes > 0 || j == 0)) + num_added += + builder->AddWeight(group, copy_input, copy_output, weight); + } + } + } + VLOG(1) << "Group " << group << ": read " << num_added << " weight(s) in " + << num_line << " lines."; +} + +template +void AddModel(const string &model, SymbolTable *fsyms, SymbolTable *osyms, + LinearClassifierFstDataBuilder *builder) { + std::ifstream in(model); + if (!in) LOG(FATAL) << "Can't open file: " << model; + string line; + std::getline(in, line); + if (!in) LOG(FATAL) << "Empty file: " << model; + size_t future_size; + { + std::istringstream strm(line); + strm >> future_size; + if (!strm) LOG(FATAL) << "Can't read future size: " << model; + } + if (future_size != 0) + LOG(FATAL) << "Classifier model must have future size = 0; got " + << future_size << " from " << model; + size_t num_line = 1, num_added = 0; + const int group = builder->AddGroup(); + VLOG(1) << "Group " << group << ": from " << model << "; future size is " + << future_size << "."; + // Add the rest of lines as a single feature group + std::vector fields; + std::vector input_labels, output_labels; + typename Arc::Weight weight; + while (GetModelRecord(model, in, fsyms, osyms, &input_labels, + &output_labels, &weight, &num_line)) { + if (output_labels.size() != 1) + LOG(FATAL) << "Output not a single label in source " << model << ", line " + << num_line; + + const typename Arc::Label marks[] = {LinearFstData::kStartOfSentence, + LinearFstData::kEndOfSentence}; + + typename Arc::Label pred = output_labels[0]; + + std::vector copy_input(input_labels.size()); + for (int i = 0; i < 2; ++i) { + size_t num_input_changes = + ReplaceCopy(input_labels.begin(), input_labels.end(), + copy_input.begin(), kNoLabel, marks[i]); + if (num_input_changes > 0 || i == 0) + num_added += builder->AddWeight(group, copy_input, pred, weight); + } + } + VLOG(1) << "Group " << group << ": read " << num_added << " weight(s) in " + << num_line << " lines."; +} + +void SplitByWhitespace(const string &str, std::vector *out); +int ScanNumClasses(char **models, int models_length); + +template +void LinearCompileTpl(LinearCompileArgs *args) { + const string &epsilon_symbol = std::get<0>(*args); + const string &unknown_symbol = std::get<1>(*args); + const string &vocab = std::get<2>(*args); + char **models = std::get<3>(*args); + const int models_length = std::get<4>(*args); + const string &out = std::get<5>(*args); + const string &save_isymbols = std::get<6>(*args); + const string &save_fsymbols = std::get<7>(*args); + const string &save_osymbols = std::get<8>(*args); + + SymbolTable isyms, // input (e.g. word tokens) + osyms, // output (e.g. tags) + fsyms; // feature (e.g. word identity, suffix, etc.) + isyms.AddSymbol(epsilon_symbol); + osyms.AddSymbol(epsilon_symbol); + fsyms.AddSymbol(epsilon_symbol); + isyms.AddSymbol(unknown_symbol); + + VLOG(1) << "start-of-sentence label is " + << LinearFstData::kStartOfSentence; + VLOG(1) << "end-of-sentence label is " << LinearFstData::kEndOfSentence; + + if (FLAGS_classifier) { + int num_classes = ScanNumClasses(models, models_length); + LinearClassifierFstDataBuilder builder(num_classes, &isyms, &fsyms, + &osyms); + + AddVocab(vocab, &isyms, &fsyms, &osyms, &builder); + for (int i = 0; i < models_length; ++i) + AddModel(models[i], &fsyms, &osyms, &builder); + + LinearClassifierFst fst(builder.Dump(), num_classes, &isyms, &osyms); + fst.Write(out); + } else { + LinearFstDataBuilder builder(&isyms, &fsyms, &osyms); + + AddVocab(vocab, &isyms, &fsyms, &osyms, &builder); + for (int i = 0; i < models_length; ++i) + AddModel(models[i], &fsyms, &osyms, &builder); + + LinearTaggerFst fst(builder.Dump(), &isyms, &osyms); + fst.Write(out); + } + + if (!save_isymbols.empty()) isyms.WriteText(save_isymbols); + if (!save_fsymbols.empty()) fsyms.WriteText(save_fsymbols); + if (!save_osymbols.empty()) osyms.WriteText(save_osymbols); +} + +void LinearCompile(const string &arc_type, const string &epsilon_symbol, + const string &unknown_symbol, const string &vocab, + char **models, int models_len, const string &out, + const string &save_isymbols, const string &save_fsymbols, + const string &save_osymbols); + +template +bool GetVocabRecord(const string &vocab, std::istream &strm, // NOLINT + SymbolTable *isyms, SymbolTable *fsyms, SymbolTable *osyms, + typename Arc::Label *word, + std::vector *feature_labels, + std::vector *possible_labels, + size_t *num_line) { + string line; + if (!std::getline(strm, line)) return false; + ++(*num_line); + + std::vector fields; + SplitByWhitespace(line, &fields); + if (fields.size() != 3) + LOG(FATAL) << "Wrong number of fields in source " << vocab << ", line " + << num_line; + + feature_labels->clear(); + possible_labels->clear(); + + *word = LookUp(fields[0], isyms); + + const char delim = FLAGS_delimiter[0]; + SplitAndPush(fields[1], delim, fsyms, feature_labels); + SplitAndPush(fields[2], delim, osyms, possible_labels); + + return true; +} + +template +bool GetModelRecord(const string &model, std::istream &strm, // NOLINT + SymbolTable *fsyms, SymbolTable *osyms, + std::vector *input_labels, + std::vector *output_labels, + typename Arc::Weight *weight, size_t *num_line) { + string line; + if (!std::getline(strm, line)) return false; + ++(*num_line); + + std::vector fields; + SplitByWhitespace(line, &fields); + if (fields.size() != 3) + LOG(FATAL) << "Wrong number of fields in source " << model << ", line " + << num_line; + + input_labels->clear(); + output_labels->clear(); + + const char delim = FLAGS_delimiter[0]; + SplitAndPush(fields[0], delim, fsyms, input_labels); + SplitAndPush(fields[1], delim, osyms, output_labels); + + *weight = StrToWeight(fields[2], model, *num_line); + + GuessStartOrEnd(input_labels, kNoLabel); + GuessStartOrEnd(output_labels, kNoLabel); + + return true; +} +} // namespace script +} // namespace fst + +#define REGISTER_FST_LINEAR_OPERATIONS(Arc) \ + REGISTER_FST_OPERATION(LinearCompileTpl, Arc, LinearCompileArgs); + +#endif // FST_EXTENSIONS_LINEAR_LINEARSCRIPT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/loglinear-apply.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/loglinear-apply.h new file mode 100644 index 0000000..1b5d2ea --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/loglinear-apply.h @@ -0,0 +1,77 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_LINEAR_LOGLINEAR_APPLY_H_ +#define FST_EXTENSIONS_LINEAR_LOGLINEAR_APPLY_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fst { + +// Applies a FST model as a discriminative model to weighted input +// `ifst`. `A` is an arc type with tropical weight of all the +// input/output FSTs. +// +// In general, consider `ifst` an unnormalized probability +// distribution between its input X and output Y, P(X, Y); and `lfst` +// a group of unnormalized probability distributions of all its output +// Z for every input Y, Q(Z|Y). `normalize` controls whether Q is +// normalized for every Y before chaining with P(X, Y). I.e., for a +// path (X, Y, Z) in `ofst` (where Y is hidden), +// +// - When `normalize` is true, its weight is P(X, Y) Q(Z|Y) / sum_z Q(z|Y); +// - When `normalize` is false, its weight is P(X, Y) Q(Z|Y). +template +void LogLinearApply(const Fst &ifst, const Fst &lfst, MutableFst *ofst, + bool normalize = true) { + LogLinearApply(ifst, lfst, ofst, normalize); +} + +// This version gives finer control over the arc type (`B`) to be used +// in normalization. `B` is an arc type with log weight (e.g. `LogArc` +// or `Log64Arc`). +template +void LogLinearApply(const Fst &ifst, const Fst &lfst, MutableFst *ofst, + bool normalize = true) { + if (normalize) { + VectorFst unnormalized_ofst, rescored_ifsa; + Compose(ifst, lfst, &unnormalized_ofst); + { + VectorFst tropical_ifsa(unnormalized_ofst); + Project(&tropical_ifsa, PROJECT_INPUT); + { + VectorFst minimal_log_ifsa; + { + VectorFst log_ifsa; + ArcMap(tropical_ifsa, &log_ifsa, WeightConvertMapper()); + RmEpsilon(&log_ifsa); + Determinize(log_ifsa, &minimal_log_ifsa); + } + Minimize(&minimal_log_ifsa); + ArcMap(&minimal_log_ifsa, InvertWeightMapper()); + ArcMap(minimal_log_ifsa, &tropical_ifsa, WeightConvertMapper()); + } + ArcSort(&tropical_ifsa, OLabelCompare()); + Compose(tropical_ifsa, ifst, &rescored_ifsa); + } + ArcSort(&rescored_ifsa, OLabelCompare()); + Compose(rescored_ifsa, unnormalized_ofst, ofst); + } else { + Compose(ifst, lfst, ofst); + } +} + +} // namespace fst + +#endif // FST_EXTENSIONS_LINEAR_LOGLINEAR_APPLY_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/trie.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/trie.h new file mode 100644 index 0000000..b5ddb3a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/linear/trie.h @@ -0,0 +1,444 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_LINEAR_TRIE_H_ +#define FST_EXTENSIONS_LINEAR_TRIE_H_ + +#include +#include +#include + +#include +#include + +namespace fst { + +const int kNoTrieNodeId = -1; + +// Forward declarations of all available trie topologies. +template +class NestedTrieTopology; +template +class FlatTrieTopology; + +// A pair of parent node id and label, part of a trie edge +template +struct ParentLabel { + int parent; + L label; + + ParentLabel() {} + ParentLabel(int p, L l) : parent(p), label(l) {} + + bool operator==(const ParentLabel &that) const { + return parent == that.parent && label == that.label; + } + + std::istream &Read(std::istream &strm) { // NOLINT + ReadType(strm, &parent); + ReadType(strm, &label); + return strm; + } + + std::ostream &Write(std::ostream &strm) const { // NOLINT + WriteType(strm, parent); + WriteType(strm, label); + return strm; + } +}; + +template +struct ParentLabelHash { + size_t operator()(const ParentLabel &pl) const { + return static_cast(pl.parent * 7853 + H()(pl.label)); + } +}; + +// The trie topology in a nested tree of hash maps; allows efficient +// iteration over children of a specific node. +template +class NestedTrieTopology { + public: + typedef L Label; + typedef H Hash; + typedef std::unordered_map NextMap; + + class const_iterator { + public: + typedef std::forward_iterator_tag iterator_category; + typedef std::pair, int> value_type; + typedef std::ptrdiff_t difference_type; + typedef const value_type *pointer; + typedef const value_type &reference; + + friend class NestedTrieTopology; + + const_iterator() : ptr_(nullptr), cur_node_(kNoTrieNodeId), cur_edge_() {} + + reference operator*() { + UpdateStub(); + return stub_; + } + pointer operator->() { + UpdateStub(); + return &stub_; + } + + const_iterator &operator++(); + const_iterator &operator++(int); // NOLINT + + bool operator==(const const_iterator &that) const { + return ptr_ == that.ptr_ && cur_node_ == that.cur_node_ && + cur_edge_ == that.cur_edge_; + } + bool operator!=(const const_iterator &that) const { + return !(*this == that); + } + + private: + const_iterator(const NestedTrieTopology *ptr, int cur_node) + : ptr_(ptr), cur_node_(cur_node) { + SetProperCurEdge(); + } + + void SetProperCurEdge() { + if (cur_node_ < ptr_->NumNodes()) + cur_edge_ = ptr_->nodes_[cur_node_]->begin(); + else + cur_edge_ = ptr_->nodes_[0]->begin(); + } + + void UpdateStub() { + stub_.first = ParentLabel(cur_node_, cur_edge_->first); + stub_.second = cur_edge_->second; + } + + const NestedTrieTopology *ptr_; + int cur_node_; + typename NextMap::const_iterator cur_edge_; + value_type stub_; + }; + + NestedTrieTopology(); + NestedTrieTopology(const NestedTrieTopology &that); + ~NestedTrieTopology(); + void swap(NestedTrieTopology &that); + NestedTrieTopology &operator=(const NestedTrieTopology &that); + bool operator==(const NestedTrieTopology &that) const; + bool operator!=(const NestedTrieTopology &that) const; + + int Root() const { return 0; } + size_t NumNodes() const { return nodes_.size(); } + int Insert(int parent, const L &label); + int Find(int parent, const L &label) const; + const NextMap &ChildrenOf(int parent) const { return *nodes_[parent]; } + + std::istream &Read(std::istream &strm); // NOLINT + std::ostream &Write(std::ostream &strm) const; // NOLINT + + const_iterator begin() const { return const_iterator(this, 0); } + const_iterator end() const { return const_iterator(this, NumNodes()); } + + private: + std::vector + nodes_; // Use pointers to avoid copying the maps when the + // vector grows +}; + +template +NestedTrieTopology::NestedTrieTopology() { + nodes_.push_back(new NextMap); +} + +template +NestedTrieTopology::NestedTrieTopology(const NestedTrieTopology &that) { + nodes_.reserve(that.nodes_.size()); + for (size_t i = 0; i < that.nodes_.size(); ++i) { + NextMap *node = that.nodes_[i]; + nodes_.push_back(new NextMap(*node)); + } +} + +template +NestedTrieTopology::~NestedTrieTopology() { + for (size_t i = 0; i < nodes_.size(); ++i) { + NextMap *node = nodes_[i]; + delete node; + } +} + +// TODO(wuke): std::swap compatibility +template +inline void NestedTrieTopology::swap(NestedTrieTopology &that) { + nodes_.swap(that.nodes_); +} + +template +inline NestedTrieTopology &NestedTrieTopology::operator=( + const NestedTrieTopology &that) { + NestedTrieTopology copy(that); + swap(copy); + return *this; +} + +template +inline bool NestedTrieTopology::operator==( + const NestedTrieTopology &that) const { + if (NumNodes() != that.NumNodes()) return false; + for (int i = 0; i < NumNodes(); ++i) + if (ChildrenOf(i) != that.ChildrenOf(i)) return false; + return true; +} + +template +inline bool NestedTrieTopology::operator!=( + const NestedTrieTopology &that) const { + return !(*this == that); +} + +template +inline int NestedTrieTopology::Insert(int parent, const L &label) { + int ret = Find(parent, label); + if (ret == kNoTrieNodeId) { + ret = NumNodes(); + (*nodes_[parent])[label] = ret; + nodes_.push_back(new NextMap); + } + return ret; +} + +template +inline int NestedTrieTopology::Find(int parent, const L &label) const { + typename NextMap::const_iterator it = nodes_[parent]->find(label); + return it == nodes_[parent]->end() ? kNoTrieNodeId : it->second; +} + +template +inline std::istream &NestedTrieTopology::Read( + std::istream &strm) { // NOLINT + NestedTrieTopology new_trie; + size_t num_nodes; + if (!ReadType(strm, &num_nodes)) return strm; + for (size_t i = 1; i < num_nodes; ++i) new_trie.nodes_.push_back(new NextMap); + for (size_t i = 0; i < num_nodes; ++i) ReadType(strm, new_trie.nodes_[i]); + if (strm) swap(new_trie); + return strm; +} + +template +inline std::ostream &NestedTrieTopology::Write( + std::ostream &strm) const { // NOLINT + WriteType(strm, NumNodes()); + for (size_t i = 0; i < NumNodes(); ++i) WriteType(strm, *nodes_[i]); + return strm; +} + +template +inline typename NestedTrieTopology::const_iterator + &NestedTrieTopology::const_iterator::operator++() { + ++cur_edge_; + if (cur_edge_ == ptr_->nodes_[cur_node_]->end()) { + ++cur_node_; + while (cur_node_ < ptr_->NumNodes() && ptr_->nodes_[cur_node_]->empty()) + ++cur_node_; + SetProperCurEdge(); + } + return *this; +} + +template +inline typename NestedTrieTopology::const_iterator + &NestedTrieTopology::const_iterator::operator++(int) { // NOLINT + const_iterator save(*this); + ++(*this); + return save; +} + +// The trie topology in a single hash map; only allows iteration over +// all the edges in arbitrary order. +template +class FlatTrieTopology { + private: + typedef std::unordered_map, int, ParentLabelHash> + NextMap; + + public: + // Iterator over edges as std::pair, int> + typedef typename NextMap::const_iterator const_iterator; + typedef L Label; + typedef H Hash; + + FlatTrieTopology() {} + FlatTrieTopology(const FlatTrieTopology &that) : next_(that.next_) {} + template + explicit FlatTrieTopology(const T &that); + + // TODO(wuke): std::swap compatibility + void swap(FlatTrieTopology &that) { next_.swap(that.next_); } + + bool operator==(const FlatTrieTopology &that) const { + return next_ == that.next_; + } + bool operator!=(const FlatTrieTopology &that) const { + return !(*this == that); + } + + int Root() const { return 0; } + size_t NumNodes() const { return next_.size() + 1; } + int Insert(int parent, const L &label); + int Find(int parent, const L &label) const; + + std::istream &Read(std::istream &strm) { // NOLINT + return ReadType(strm, &next_); + } + std::ostream &Write(std::ostream &strm) const { // NOLINT + return WriteType(strm, next_); + } + + const_iterator begin() const { return next_.begin(); } + const_iterator end() const { return next_.end(); } + + private: + NextMap next_; +}; + +template +template +FlatTrieTopology::FlatTrieTopology(const T &that) + : next_(that.begin(), that.end()) {} + +template +inline int FlatTrieTopology::Insert(int parent, const L &label) { + int ret = Find(parent, label); + if (ret == kNoTrieNodeId) { + ret = NumNodes(); + next_[ParentLabel(parent, label)] = ret; + } + return ret; +} + +template +inline int FlatTrieTopology::Find(int parent, const L &label) const { + typename NextMap::const_iterator it = + next_.find(ParentLabel(parent, label)); + return it == next_.end() ? kNoTrieNodeId : it->second; +} + +// A collection of implementations of the trie data structure. The key +// is a sequence of type `L` which must be hashable. The value is of +// `V` which must be default constructible and copyable. In addition, +// a value object is stored for each node in the trie therefore +// copying `V` should be cheap. +// +// One can access the store values with an integer node id, using the +// [] operator. A valid node id can be obtained by the following ways: +// +// 1. Using the `Root()` method to get the node id of the root. +// +// 2. Iterating through 0 to `NumNodes() - 1`. The node ids are dense +// so every integer in this range is a valid node id. +// +// 3. Using the node id returned from a successful `Insert()` or +// `Find()` call. +// +// 4. Iterating over the trie edges with an `EdgeIterator` and using +// the node ids returned from its `Parent()` and `Child()` methods. +// +// Below is an example of inserting keys into the trie: +// +// const string words[] = {"hello", "health", "jello"}; +// Trie dict; +// for (auto word : words) { +// int cur = dict.Root(); +// for (char c : word) { +// cur = dict.Insert(cur, c); +// } +// dict[cur] = true; +// } +// +// And the following is an example of looking up the longest prefix of +// a string using the trie constructed above: +// +// string query = "healed"; +// size_t prefix_length = 0; +// int cur = dict.Find(dict.Root(), query[prefix_length]); +// while (prefix_length < query.size() && +// cur != Trie::kNoNodeId) { +// ++prefix_length; +// cur = dict.Find(cur, query[prefix_length]); +// } +template +class MutableTrie { + public: + template + friend class MutableTrie; + + typedef L Label; + typedef V Value; + typedef T Topology; + + // Constructs a trie with only the root node. + MutableTrie() {} + + // Conversion from another trie of a possiblly different + // topology. The underlying topology must supported conversion. + template + explicit MutableTrie(const MutableTrie &that) + : topology_(that.topology_), values_(that.values_) {} + + // TODO(wuke): std::swap compatibility + void swap(MutableTrie &that) { + topology_.swap(that.topology_); + values_.swap(that.values_); + } + + int Root() const { return topology_.Root(); } + size_t NumNodes() const { return topology_.NumNodes(); } + + // Inserts an edge with given `label` at node `parent`. Returns the + // child node id. If the node already exists, returns the node id + // right away. + int Insert(int parent, const L &label) { + int ret = topology_.Insert(parent, label); + values_.resize(NumNodes()); + return ret; + } + + // Finds the node id of the node from `parent` via `label`. Returns + // `kNoTrieNodeId` when such a node does not exist. + int Find(int parent, const L &label) const { + return topology_.Find(parent, label); + } + + const T &TrieTopology() const { return topology_; } + + // Accesses the value stored for the given node. + V &operator[](int node_id) { return values_[node_id]; } + const V &operator[](int node_id) const { return values_[node_id]; } + + // Comparison by content + bool operator==(const MutableTrie &that) const { + return topology_ == that.topology_ && values_ == that.values_; + } + + bool operator!=(const MutableTrie &that) const { return !(*this == that); } + + std::istream &Read(std::istream &strm) { // NOLINT + ReadType(strm, &topology_); + ReadType(strm, &values_); + return strm; + } + std::ostream &Write(std::ostream &strm) const { // NOLINT + WriteType(strm, topology_); + WriteType(strm, values_); + return strm; + } + + private: + T topology_; + std::vector values_; +}; + +} // namespace fst + +#endif // FST_EXTENSIONS_LINEAR_TRIE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/mpdt/compose.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/mpdt/compose.h new file mode 100644 index 0000000..47714e3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/mpdt/compose.h @@ -0,0 +1,267 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Compose an MPDT and an FST. + +#ifndef FST_EXTENSIONS_MPDT_COMPOSE_H_ +#define FST_EXTENSIONS_MPDT_COMPOSE_H_ + +#include + +#include +#include +#include + +namespace fst { + +template +class MPdtParenFilter { + public: + using FST1 = typename Filter::FST1; + using FST2 = typename Filter::FST2; + using Arc = typename Filter::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Matcher1 = typename Filter::Matcher1; + using Matcher2 = typename Filter::Matcher2; + + using StackId = StateId; + using ParenStack = internal::MPdtStack; + using FilterState1 = typename Filter::FilterState; + using FilterState2 = IntegerFilterState; + using FilterState = PairFilterState; + + MPdtParenFilter(const FST1 &fst1, const FST2 &fst2, + Matcher1 *matcher1 = nullptr, Matcher2 *matcher2 = nullptr, + const std::vector> *parens = nullptr, + const std::vector(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + const ParenStack &GetStack() const { return GetImpl()->GetStack(); } + + const PdtStateTable &GetStateTable() const { + return GetImpl()->GetStateTable(); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + void operator=(const MPdtExpandFst &) = delete; +}; + +// Specialization for MPdtExpandFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const MPdtExpandFst &fst) + : CacheStateIterator>(fst, fst.GetMutableImpl()) {} +}; + +// Specialization for MPdtExpandFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const MPdtExpandFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->ExpandState(s); + } +}; + +template +inline void MPdtExpandFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +struct MPdtExpandOptions { + bool connect; + bool keep_parentheses; + + explicit MPdtExpandOptions(bool connect = true, bool keep_parentheses = false) + : connect(connect), keep_parentheses(keep_parentheses) {} +}; + +// Expands a multi-pushdown transducer (MPDT) encoded as an FST into an FST. +// This version writes the expanded PDT to a mutable FST. In the MPDT, some +// transitions are labeled with open or close parentheses. To be interpreted as +// an MPDT, the parens for each stack must balance on a path. The open-close +// parenthesis label pair sets are passed using the parens argument, and the +// assignment of those pairs to stacks is passed using the assignments argument. +// The expansion enforces the parenthesis constraints. The MPDT must be +// expandable as an FST. +template +void Expand(const Fst &ifst, + const std::vector< + std::pair> &parens, + const std::vector &assignments, + MutableFst *ofst, const MPdtExpandOptions &opts) { + MPdtExpandFstOptions eopts; + eopts.gc_limit = 0; + eopts.keep_parentheses = opts.keep_parentheses; + *ofst = MPdtExpandFst(ifst, parens, assignments, eopts); + if (opts.connect) Connect(ofst); +} + +// Expands a multi-pushdown transducer (MPDT) encoded as an FST into an FST. +// This version writes the expanded PDT to a mutable FST. In the MPDT, some +// transitions are labeled with open or close parentheses. To be interpreted as +// an MPDT, the parens for each stack must balance on a path. The open-close +// parenthesis label pair sets are passed using the parens argument, and the +// assignment of those pairs to stacks is passed using the assignments argument. +// The expansion enforces the parenthesis constraints. The MPDT must be +// expandable as an FST. +template +void Expand(const Fst &ifst, + const std::vector> &parens, + const std::vector &assignments, + MutableFst *ofst, bool connect = true, + bool keep_parentheses = false) { + const MPdtExpandOptions opts(connect, keep_parentheses); + Expand(ifst, parens, assignments, ofst, opts); +} + +} // namespace fst + +#endif // FST_EXTENSIONS_MPDT_EXPAND_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/mpdt/info.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/mpdt/info.h new file mode 100644 index 0000000..512fcfa --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/mpdt/info.h @@ -0,0 +1,190 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prints information about an MPDT. + +#ifndef FST_EXTENSIONS_MPDT_INFO_H_ +#define FST_EXTENSIONS_MPDT_INFO_H_ + +#include +#include + +#include +#include + +namespace fst { + +// Compute various information about MPDTs, helper class for mpdtinfo.cc. +template +class MPdtInfo { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + MPdtInfo(const Fst &fst, + const std::vector> &parens, + const std::vector { + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::SetType; + using FstImpl::WriteHeader; + + friend class ArcIterator>; + friend class NGramFstMatcher; + + public: + using FstImpl::InputSymbols; + using FstImpl::SetProperties; + using FstImpl::Properties; + + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::StateId StateId; + typedef typename A::Weight Weight; + + NGramFstImpl() { + SetType("ngram"); + SetInputSymbols(nullptr); + SetOutputSymbols(nullptr); + SetProperties(kStaticProperties); + } + + NGramFstImpl(const Fst &fst, std::vector *order_out); + + explicit NGramFstImpl(const Fst &fst) : NGramFstImpl(fst, nullptr) {} + + NGramFstImpl(const NGramFstImpl &other) { + FSTERROR() << "Copying NGramFst Impls is not supported, use safe = false."; + SetProperties(kError, kError); + } + + ~NGramFstImpl() override { + if (owned_) { + delete[] data_; + } + } + + static NGramFstImpl *Read(std::istream &strm, // NOLINT + const FstReadOptions &opts) { + NGramFstImpl *impl = new NGramFstImpl(); + FstHeader hdr; + if (!impl->ReadHeader(strm, opts, kMinFileVersion, &hdr)) return 0; + uint64 num_states, num_futures, num_final; + const size_t offset = + sizeof(num_states) + sizeof(num_futures) + sizeof(num_final); + // Peek at num_states and num_futures to see how much more needs to be read. + strm.read(reinterpret_cast(&num_states), sizeof(num_states)); + strm.read(reinterpret_cast(&num_futures), sizeof(num_futures)); + strm.read(reinterpret_cast(&num_final), sizeof(num_final)); + size_t size = Storage(num_states, num_futures, num_final); + MappedFile *data_region = MappedFile::Allocate(size); + char *data = reinterpret_cast(data_region->mutable_data()); + // Copy num_states, num_futures and num_final back into data. + memcpy(data, reinterpret_cast(&num_states), sizeof(num_states)); + memcpy(data + sizeof(num_states), reinterpret_cast(&num_futures), + sizeof(num_futures)); + memcpy(data + sizeof(num_states) + sizeof(num_futures), + reinterpret_cast(&num_final), sizeof(num_final)); + strm.read(data + offset, size - offset); + if (strm.fail()) { + delete impl; + return nullptr; + } + impl->Init(data, false, data_region); + return impl; + } + + bool Write(std::ostream &strm, // NOLINT + const FstWriteOptions &opts) const { + FstHeader hdr; + hdr.SetStart(Start()); + hdr.SetNumStates(num_states_); + WriteHeader(strm, opts, kFileVersion, &hdr); + strm.write(data_, StorageSize()); + return !strm.fail(); + } + + StateId Start() const { return start_; } + + Weight Final(StateId state) const { + if (final_index_.Get(state)) { + return final_probs_[final_index_.Rank1(state)]; + } else { + return Weight::Zero(); + } + } + + size_t NumArcs(StateId state, NGramFstInst *inst = nullptr) const { + if (inst == nullptr) { + const std::pair zeros = + (state == 0) ? select_root_ : future_index_.Select0s(state); + return zeros.second - zeros.first - 1; + } + SetInstFuture(state, inst); + return inst->num_futures_ + ((state == 0) ? 0 : 1); + } + + size_t NumInputEpsilons(StateId state) const { + // State 0 has no parent, thus no backoff. + if (state == 0) return 0; + return 1; + } + + size_t NumOutputEpsilons(StateId state) const { + return NumInputEpsilons(state); + } + + StateId NumStates() const { return num_states_; } + + void InitStateIterator(StateIteratorData *data) const { + data->base = 0; + data->nstates = num_states_; + } + + static size_t Storage(uint64 num_states, uint64 num_futures, + uint64 num_final) { + uint64 b64; + Weight weight; + Label label; + size_t offset = + sizeof(num_states) + sizeof(num_futures) + sizeof(num_final); + offset += + sizeof(b64) * (BitmapIndex::StorageSize(num_states * 2 + 1) + + BitmapIndex::StorageSize(num_futures + num_states + 1) + + BitmapIndex::StorageSize(num_states)); + offset += (num_states + 1) * sizeof(label) + num_futures * sizeof(label); + // Pad for alignemnt, see + // http://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding + offset = (offset + sizeof(weight) - 1) & ~(sizeof(weight) - 1); + offset += (num_states + 1) * sizeof(weight) + num_final * sizeof(weight) + + (num_futures + 1) * sizeof(weight); + return offset; + } + + void SetInstFuture(StateId state, NGramFstInst *inst) const { + if (inst->state_ != state) { + inst->state_ = state; + const std::pair zeros = future_index_.Select0s(state); + inst->num_futures_ = zeros.second - zeros.first - 1; + inst->offset_ = future_index_.Rank1(zeros.first + 1); + } + } + + void SetInstNode(NGramFstInst *inst) const { + if (inst->node_state_ != inst->state_) { + inst->node_state_ = inst->state_; + inst->node_ = context_index_.Select1(inst->state_); + } + } + + void SetInstContext(NGramFstInst *inst) const { + SetInstNode(inst); + if (inst->context_state_ != inst->state_) { + inst->context_state_ = inst->state_; + inst->context_.clear(); + size_t node = inst->node_; + while (node != 0) { + inst->context_.push_back(context_words_[context_index_.Rank1(node)]); + node = context_index_.Select1(context_index_.Rank0(node) - 1); + } + } + } + + // Access to the underlying representation + const char *GetData(size_t *data_size) const { + *data_size = StorageSize(); + return data_; + } + + void Init(const char *data, bool owned, MappedFile *file = nullptr); + + const std::vector *inst) const { + SetInstFuture(s, inst); + SetInstContext(inst); + return inst->context_; + } + + size_t StorageSize() const { + return Storage(num_states_, num_futures_, num_final_); + } + + void GetStates(const std::vector::GetStates( + const std::vector; + + public: + typedef A Arc; + typedef typename A::StateId StateId; + typedef typename A::Label Label; + typedef typename A::Weight Weight; + typedef internal::NGramFstImpl Impl; + + explicit NGramFst(const Fst &dst) + : ImplToExpandedFst(std::make_shared(dst, nullptr)) {} + + NGramFst(const Fst &fst, std::vector *order_out) + : ImplToExpandedFst(std::make_shared(fst, order_out)) {} + + // Because the NGramFstImpl is a const stateless data structure, there + // is never a need to do anything beside copy the reference. + NGramFst(const NGramFst &fst, bool safe = false) + : ImplToExpandedFst(fst, false) {} + + NGramFst() : ImplToExpandedFst(std::make_shared()) {} + + // Non-standard constructor to initialize NGramFst directly from data. + NGramFst(const char *data, bool owned) + : ImplToExpandedFst(std::make_shared()) { + GetMutableImpl()->Init(data, owned, nullptr); + } + + // Get method that gets the data associated with Init(). + const char *GetData(size_t *data_size) const { + return GetImpl()->GetData(data_size); + } + + const std::vector *Copy(bool safe = false) const override { + return new NGramFst(*this, safe); + } + + static NGramFst *Read(std::istream &strm, const FstReadOptions &opts) { + Impl *impl = Impl::Read(strm, opts); + return impl ? new NGramFst(std::shared_ptr(impl)) : nullptr; + } + + static NGramFst *Read(const string &filename) { + if (!filename.empty()) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm.good()) { + LOG(ERROR) << "NGramFst::Read: Can't open file: " << filename; + return nullptr; + } + return Read(strm, FstReadOptions(filename)); + } else { + return Read(std::cin, FstReadOptions("standard input")); + } + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return GetImpl()->Write(strm, opts); + } + + bool Write(const string &filename) const override { + return Fst::WriteFile(filename); + } + + inline void InitStateIterator(StateIteratorData *data) const override { + GetImpl()->InitStateIterator(data); + } + + inline void InitArcIterator(StateId s, + ArcIteratorData *data) const override; + + MatcherBase *InitMatcher(MatchType match_type) const override { + return new NGramFstMatcher(this, match_type); + } + + size_t StorageSize() const { return GetImpl()->StorageSize(); } + + static bool HasRequiredProps(const Fst &fst) { + static const auto props = + kAcceptor | kIDeterministic | kILabelSorted | kIEpsilons | kAccessible; + return fst.Properties(props, true) == props; + } + + static bool HasRequiredStructure(const Fst &fst) { + if (!HasRequiredProps(fst)) { + return false; + } + typename A::StateId unigram = fst.Start(); + while (true) { // Follows epsilon arc chain to find unigram state. + if (unigram == fst::kNoStateId) return false; // No unigram state. + typename fst::ArcIterator> aiter(fst, unigram); + if (aiter.Done() || aiter.Value().ilabel != 0) break; + unigram = aiter.Value().nextstate; + aiter.Next(); + } + // Other requirement: all states other than unigram an epsilon arc. + for (fst::StateIterator> siter(fst); !siter.Done(); + siter.Next()) { + const typename A::StateId &state = siter.Value(); + fst::ArcIterator> aiter(fst, state); + if (state != unigram) { + if (aiter.Done()) return false; + if (aiter.Value().ilabel != 0) return false; + aiter.Next(); + if (!aiter.Done() && aiter.Value().ilabel == 0) return false; + } + } + return true; + } + + private: + using ImplToExpandedFst>::GetImpl; + using ImplToExpandedFst>::GetMutableImpl; + + explicit NGramFst(std::shared_ptr impl) + : ImplToExpandedFst(impl) {} + + mutable NGramFstInst inst_; +}; + +template +inline void NGramFst::InitArcIterator(StateId s, + ArcIteratorData *data) const { + GetImpl()->SetInstFuture(s, &inst_); + GetImpl()->SetInstNode(&inst_); + data->base = new ArcIterator>(*this, s); +} + +namespace internal { + +template +NGramFstImpl::NGramFstImpl(const Fst &fst, + std::vector *order_out) { + typedef A Arc; + typedef typename Arc::Label Label; + typedef typename Arc::Weight Weight; + typedef typename Arc::StateId StateId; + SetType("ngram"); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + SetProperties(kStaticProperties); + + // Check basic requirements for an OpenGrm language model Fst. + if (!NGramFst::HasRequiredProps(fst)) { + FSTERROR() << "NGramFst only accepts OpenGrm language models as input"; + SetProperties(kError, kError); + return; + } + + int64 num_states = CountStates(fst); + Label *context = new Label[num_states]; + + // Find the unigram state by starting from the start state, following + // epsilons. + StateId unigram = fst.Start(); + while (1) { + if (unigram == kNoStateId) { + FSTERROR() << "Could not identify unigram state"; + SetProperties(kError, kError); + return; + } + ArcIterator> aiter(fst, unigram); + if (aiter.Done()) { + LOG(WARNING) << "Unigram state " << unigram << " has no arcs."; + break; + } + if (aiter.Value().ilabel != 0) break; + unigram = aiter.Value().nextstate; + } + + // Each state's context is determined by the subtree it is under from the + // unigram state. + std::queue> label_queue; + std::vector visited(num_states); + // Force an epsilon link to the start state. + label_queue.push(std::make_pair(fst.Start(), 0)); + for (ArcIterator> aiter(fst, unigram); !aiter.Done(); aiter.Next()) { + label_queue.push( + std::make_pair(aiter.Value().nextstate, aiter.Value().ilabel)); + } + // investigate states in breadth first fashion to assign context words. + while (!label_queue.empty()) { + std::pair &now = label_queue.front(); + if (!visited[now.first]) { + context[now.first] = now.second; + visited[now.first] = true; + for (ArcIterator> aiter(fst, now.first); !aiter.Done(); + aiter.Next()) { + const Arc &arc = aiter.Value(); + if (arc.ilabel != 0) { + label_queue.push(std::make_pair(arc.nextstate, now.second)); + } + } + } + label_queue.pop(); + } + visited.clear(); + + // The arc from the start state should be assigned an epsilon to put it + // in front of the all other labels (which makes Start state 1 after + // unigram which is state 0). + context[fst.Start()] = 0; + + // Build the tree of contexts fst by reversing the epsilon arcs from fst. + VectorFst context_fst; + uint64 num_final = 0; + for (int i = 0; i < num_states; ++i) { + if (fst.Final(i) != Weight::Zero()) { + ++num_final; + } + context_fst.SetFinal(context_fst.AddState(), fst.Final(i)); + } + context_fst.SetStart(unigram); + context_fst.SetInputSymbols(fst.InputSymbols()); + context_fst.SetOutputSymbols(fst.OutputSymbols()); + int64 num_context_arcs = 0; + int64 num_futures = 0; + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + const StateId &state = siter.Value(); + num_futures += fst.NumArcs(state) - fst.NumInputEpsilons(state); + ArcIterator> aiter(fst, state); + if (!aiter.Done()) { + const Arc &arc = aiter.Value(); + // this arc goes from state to arc.nextstate, so create an arc from + // arc.nextstate to state to reverse it. + if (arc.ilabel == 0) { + context_fst.AddArc(arc.nextstate, Arc(context[state], context[state], + arc.weight, state)); + num_context_arcs++; + } + } + } + if (num_context_arcs != context_fst.NumStates() - 1) { + FSTERROR() << "Number of contexts arcs != number of states - 1"; + SetProperties(kError, kError); + return; + } + if (context_fst.NumStates() != num_states) { + FSTERROR() << "Number of contexts != number of states"; + SetProperties(kError, kError); + return; + } + int64 context_props = + context_fst.Properties(kIDeterministic | kILabelSorted, true); + if (!(context_props & kIDeterministic)) { + FSTERROR() << "Input Fst is not structured properly"; + SetProperties(kError, kError); + return; + } + if (!(context_props & kILabelSorted)) { + ArcSort(&context_fst, ILabelCompare()); + } + + delete[] context; + + uint64 b64; + Weight weight; + Label label = kNoLabel; + const size_t storage = Storage(num_states, num_futures, num_final); + MappedFile *data_region = MappedFile::Allocate(storage); + char *data = reinterpret_cast(data_region->mutable_data()); + memset(data, 0, storage); + size_t offset = 0; + memcpy(data + offset, reinterpret_cast(&num_states), + sizeof(num_states)); + offset += sizeof(num_states); + memcpy(data + offset, reinterpret_cast(&num_futures), + sizeof(num_futures)); + offset += sizeof(num_futures); + memcpy(data + offset, reinterpret_cast(&num_final), + sizeof(num_final)); + offset += sizeof(num_final); + uint64 *context_bits = reinterpret_cast(data + offset); + offset += BitmapIndex::StorageSize(num_states * 2 + 1) * sizeof(b64); + uint64 *future_bits = reinterpret_cast(data + offset); + offset += + BitmapIndex::StorageSize(num_futures + num_states + 1) * sizeof(b64); + uint64 *final_bits = reinterpret_cast(data + offset); + offset += BitmapIndex::StorageSize(num_states) * sizeof(b64); + Label *context_words = reinterpret_cast::Init(const char *data, bool owned, + MappedFile *data_region) { + if (owned_) { + delete[] data_; + } + data_region_.reset(data_region); + owned_ = owned; + data_ = data; + size_t offset = 0; + num_states_ = *(reinterpret_cast(data_ + offset)); + offset += sizeof(num_states_); + num_futures_ = *(reinterpret_cast(data_ + offset)); + offset += sizeof(num_futures_); + num_final_ = *(reinterpret_cast(data_ + offset)); + offset += sizeof(num_final_); + uint64 bits; + size_t context_bits = num_states_ * 2 + 1; + size_t future_bits = num_futures_ + num_states_ + 1; + context_ = reinterpret_cast(data_ + offset); + offset += BitmapIndex::StorageSize(context_bits) * sizeof(bits); + future_ = reinterpret_cast(data_ + offset); + offset += BitmapIndex::StorageSize(future_bits) * sizeof(bits); + final_ = reinterpret_cast(data_ + offset); + offset += BitmapIndex::StorageSize(num_states_) * sizeof(bits); + context_words_ = reinterpret_cast(data_ + offset); + offset += (num_states_ + 1) * sizeof(*context_words_); + future_words_ = reinterpret_cast(data_ + offset); + offset += num_futures_ * sizeof(*future_words_); + offset = (offset + sizeof(*backoff_) - 1) & ~(sizeof(*backoff_) - 1); + backoff_ = reinterpret_cast(data_ + offset); + offset += (num_states_ + 1) * sizeof(*backoff_); + final_probs_ = reinterpret_cast(data_ + offset); + offset += num_final_ * sizeof(*final_probs_); + future_probs_ = reinterpret_cast(data_ + offset); + + context_index_.BuildIndex(context_, context_bits); + future_index_.BuildIndex(future_, future_bits); + final_index_.BuildIndex(final_, num_states_); + + select_root_ = context_index_.Select0s(0); + if (context_index_.Rank1(0) != 0 || select_root_.first != 1 || + context_index_.Get(2) == false) { + FSTERROR() << "Malformed file"; + SetProperties(kError, kError); + return; + } + root_children_ = context_words_ + context_index_.Rank1(2); + start_ = 1; +} + +template +inline typename A::StateId NGramFstImpl::Transition( + const std::vector { + public: + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::StateId StateId; + typedef typename A::Weight Weight; + + // This makes a copy of the FST. + NGramFstMatcher(const NGramFst &fst, MatchType match_type) + : owned_fst_(fst.Copy()), + fst_(*owned_fst_), + inst_(fst_.inst_), + match_type_(match_type), + current_loop_(false), + loop_(kNoLabel, 0, A::Weight::One(), kNoStateId) { + if (match_type_ == MATCH_OUTPUT) { + std::swap(loop_.ilabel, loop_.olabel); + } + } + + // This doesn't copy the FST. + NGramFstMatcher(const NGramFst *fst, MatchType match_type) + : fst_(*fst), + inst_(fst_.inst_), + match_type_(match_type), + current_loop_(false), + loop_(kNoLabel, 0, A::Weight::One(), kNoStateId) { + if (match_type_ == MATCH_OUTPUT) { + std::swap(loop_.ilabel, loop_.olabel); + } + } + + // This makes a copy of the FST. + NGramFstMatcher(const NGramFstMatcher &matcher, bool safe = false) + : owned_fst_(matcher.fst_.Copy(safe)), + fst_(*owned_fst_), + inst_(matcher.inst_), + match_type_(matcher.match_type_), + current_loop_(false), + loop_(kNoLabel, 0, A::Weight::One(), kNoStateId) { + if (match_type_ == MATCH_OUTPUT) { + std::swap(loop_.ilabel, loop_.olabel); + } + } + + NGramFstMatcher *Copy(bool safe = false) const override { + return new NGramFstMatcher(*this, safe); + } + + MatchType Type(bool test) const override { return match_type_; } + + const Fst &GetFst() const override { return fst_; } + + uint64 Properties(uint64 props) const override { return props; } + + void SetState(StateId s) final { + fst_.GetImpl()->SetInstFuture(s, &inst_); + current_loop_ = false; + } + + bool Find(Label label) final { + const Label nolabel = kNoLabel; + done_ = true; + if (label == 0 || label == nolabel) { + if (label == 0) { + current_loop_ = true; + loop_.nextstate = inst_.state_; + } + // The unigram state has no epsilon arc. + if (inst_.state_ != 0) { + arc_.ilabel = arc_.olabel = 0; + fst_.GetImpl()->SetInstNode(&inst_); + arc_.nextstate = fst_.GetImpl()->context_index_.Rank1( + fst_.GetImpl()->context_index_.Select1( + fst_.GetImpl()->context_index_.Rank0(inst_.node_) - 1)); + arc_.weight = fst_.GetImpl()->backoff_[inst_.state_]; + done_ = false; + } + } else { + current_loop_ = false; + const Label *start = fst_.GetImpl()->future_words_ + inst_.offset_; + const Label *end = start + inst_.num_futures_; + const Label *search = std::lower_bound(start, end, label); + if (search != end && *search == label) { + size_t state = search - start; + arc_.ilabel = arc_.olabel = label; + arc_.weight = fst_.GetImpl()->future_probs_[inst_.offset_ + state]; + fst_.GetImpl()->SetInstContext(&inst_); + arc_.nextstate = fst_.GetImpl()->Transition(inst_.context_, label); + done_ = false; + } + } + return !Done(); + } + + bool Done() const final { return !current_loop_ && done_; } + + const Arc &Value() const final { return (current_loop_) ? loop_ : arc_; } + + void Next() final { + if (current_loop_) { + current_loop_ = false; + } else { + done_ = true; + } + } + + ssize_t Priority(StateId s) final { return fst_.NumArcs(s); } + + private: + std::unique_ptr> owned_fst_; + const NGramFst &fst_; + NGramFstInst inst_; + MatchType match_type_; // Supplied by caller + bool done_; + Arc arc_; + bool current_loop_; // Current arc is the implicit loop + Arc loop_; +}; + +/*****************************************************************************/ +// Specialization for NGramFst; see generic version in fst.h +// for sample usage (but use the ProdLmFst type!). This version +// should inline. +template +class StateIterator> : public StateIteratorBase { + public: + typedef typename A::StateId StateId; + + explicit StateIterator(const NGramFst &fst) + : s_(0), num_states_(fst.NumStates()) {} + + bool Done() const final { return s_ >= num_states_; } + + StateId Value() const final { return s_; } + + void Next() final { ++s_; } + + void Reset() final { s_ = 0; } + + private: + StateId s_; + StateId num_states_; +}; + +/*****************************************************************************/ +template +class ArcIterator> : public ArcIteratorBase { + public: + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::StateId StateId; + typedef typename A::Weight Weight; + + ArcIterator(const NGramFst &fst, StateId state) + : lazy_(~0), impl_(fst.GetImpl()), i_(0), flags_(kArcValueFlags) { + inst_ = fst.inst_; + impl_->SetInstFuture(state, &inst_); + impl_->SetInstNode(&inst_); + } + + bool Done() const final { + return i_ >= + ((inst_.node_ == 0) ? inst_.num_futures_ : inst_.num_futures_ + 1); + } + + const Arc &Value() const final { + bool eps = (inst_.node_ != 0 && i_ == 0); + StateId state = (inst_.node_ == 0) ? i_ : i_ - 1; + if (flags_ & lazy_ & (kArcILabelValue | kArcOLabelValue)) { + arc_.ilabel = arc_.olabel = + eps ? 0 : impl_->future_words_[inst_.offset_ + state]; + lazy_ &= ~(kArcILabelValue | kArcOLabelValue); + } + if (flags_ & lazy_ & kArcNextStateValue) { + if (eps) { + arc_.nextstate = + impl_->context_index_.Rank1(impl_->context_index_.Select1( + impl_->context_index_.Rank0(inst_.node_) - 1)); + } else { + if (lazy_ & kArcNextStateValue) { + impl_->SetInstContext(&inst_); // first time only. + } + arc_.nextstate = impl_->Transition( + inst_.context_, impl_->future_words_[inst_.offset_ + state]); + } + lazy_ &= ~kArcNextStateValue; + } + if (flags_ & lazy_ & kArcWeightValue) { + arc_.weight = eps ? impl_->backoff_[inst_.state_] + : impl_->future_probs_[inst_.offset_ + state]; + lazy_ &= ~kArcWeightValue; + } + return arc_; + } + + void Next() final { + ++i_; + lazy_ = ~0; + } + + size_t Position() const final { return i_; } + + void Reset() final { + i_ = 0; + lazy_ = ~0; + } + + void Seek(size_t a) final { + if (i_ != a) { + i_ = a; + lazy_ = ~0; + } + } + + uint32 Flags() const final { return flags_; } + + void SetFlags(uint32 flags, uint32 mask) final { + flags_ &= ~mask; + flags_ |= (flags & kArcValueFlags); + } + + private: + mutable Arc arc_; + mutable uint32 lazy_; + const internal::NGramFstImpl *impl_; // Borrowed reference. + mutable NGramFstInst inst_; + + size_t i_; + uint32 flags_; +}; + +} // namespace fst +#endif // FST_EXTENSIONS_NGRAM_NGRAM_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/ngram/nthbit.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/ngram/nthbit.h new file mode 100644 index 0000000..1e6ec63 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/ngram/nthbit.h @@ -0,0 +1,49 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_NGRAM_NTHBIT_H_ +#define FST_EXTENSIONS_NGRAM_NTHBIT_H_ + +#include +#include + +#ifdef __BMI2__ +// PDEP requires BMI2. + +// Returns the position (0-63) of the r-th 1 bit in v. +// 1 <= r <= CountOnes(v) <= 64. Therefore, v must not be 0. +inline uint32 nth_bit(uint64 v, uint32 r) { + // PDEP example from https://stackoverflow.com/a/27453505 + return __builtin_ctzll(_pdep_u64(uint64{1} << (r - 1), v)); +} + +#else // !defined(__BMI2__) + +extern const uint32 nth_bit_bit_offset[]; + +// Returns the position (0-63) of the r-th 1 bit in v. +// 1 <= r <= CountOnes(v) <= 64. Therefore, v must not be 0. +inline uint32 nth_bit(uint64 v, uint32 r) { + uint32 shift = 0; + uint32 c = __builtin_popcount(v & 0xffffffff); + uint32 mask = -(r > c); + r -= c & mask; + shift += (32 & mask); + + c = __builtin_popcount((v >> shift) & 0xffff); + mask = -(r > c); + r -= c & mask; + shift += (16 & mask); + + c = __builtin_popcount((v >> shift) & 0xff); + mask = -(r > c); + r -= c & mask; + shift += (8 & mask); + + return shift + + ((nth_bit_bit_offset[(v >> shift) & 0xff] >> ((r - 1) << 2)) & 0xf); +} + +#endif // !defined(__BMI2__) + +#endif // FST_EXTENSIONS_NGRAM_NTHBIT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/collection.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/collection.h new file mode 100644 index 0000000..ae34aba --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/collection.h @@ -0,0 +1,107 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to store a collection of ordered (multi-)sets with elements of type T. + +#ifndef FST_EXTENSIONS_PDT_COLLECTION_H_ +#define FST_EXTENSIONS_PDT_COLLECTION_H_ + +#include +#include + +#include +#include + +namespace fst { + +// Stores a collection of non-empty, ordered (multi-)sets with elements of type +// T. A default constructor, operator==, and an STL-style hash functor must be +// defined on the elements. Provides signed integer ID (of type I) for each +// unique set. The IDs are allocated starting from 0 in order. +template +class Collection { + public: + struct Node { // Trie node. + I node_id; // Root is kNoNodeId; + T element; + + Node() : node_id(kNoNodeId), element(T()) {} + + Node(I i, const T &t) : node_id(i), element(t) {} + + bool operator==(const Node &n) const { + return n.node_id == node_id && n.element == element; + } + }; + + struct NodeHash { + size_t operator()(const Node &n) const { + static constexpr auto kPrime = 7853; + return n.node_id + hash_(n.element) * kPrime; + } + }; + + using NodeTable = CompactHashBiTable; + + class SetIterator { + public: + SetIterator(I id, Node node, NodeTable *node_table) + : id_(id), node_(node), node_table_(node_table) {} + + bool Done() const { return id_ == kNoNodeId; } + + const T &Element() const { return node_.element; } + + void Next() { + id_ = node_.node_id; + if (id_ != kNoNodeId) node_ = node_table_->FindEntry(id_); + } + + private: + I id_; // Iterator set node ID. + Node node_; // Iterator set node. + NodeTable *node_table_; + }; + + Collection() {} + + // Looks up integer ID from ordered multi-se, and if it doesn't exist and + // insert is true, then adds it. Otherwise returns -1. + I FindId(const std::vector &set, bool insert = true) { + I node_id = kNoNodeId; + for (ssize_t i = set.size() - 1; i >= 0; --i) { + Node node(node_id, set[i]); + node_id = node_table_.FindId(node, insert); + if (node_id == -1) break; + } + return node_id; + } + + // Finds ordered (multi-)set given integer ID. Returns set iterator to + // traverse result. + SetIterator FindSet(I id) { + if (id < 0 || id >= node_table_.Size()) { + return SetIterator(kNoNodeId, Node(kNoNodeId, T()), &node_table_); + } else { + return SetIterator(id, node_table_.FindEntry(id), &node_table_); + } + } + + I Size() const { return node_table_.Size(); } + + private: + static constexpr I kNoNodeId = -1; + static const std::hash hash_; + + NodeTable node_table_; +}; + +template +constexpr I Collection::kNoNodeId; + +template +const std::hash Collection::hash_ = {}; + +} // namespace fst + +#endif // FST_EXTENSIONS_PDT_COLLECTION_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/compose.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/compose.h new file mode 100644 index 0000000..525d613 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/compose.h @@ -0,0 +1,493 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Composes a PDT and an FST. + +#ifndef FST_EXTENSIONS_PDT_COMPOSE_H_ +#define FST_EXTENSIONS_PDT_COMPOSE_H_ + +#include + +#include +#include + +namespace fst { + +// Returns paren arcs for Find(kNoLabel). +constexpr uint32 kParenList = 0x00000001; + +// Returns a kNolabel loop for Find(paren). +constexpr uint32 kParenLoop = 0x00000002; + +// This class is a matcher that treats parens as multi-epsilon labels. +// It is most efficient if the parens are in a range non-overlapping with +// the non-paren labels. +template +class ParenMatcher { + public: + using FST = F; + using M = SortedMatcher; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // This makes a copy of the FST. + ParenMatcher(const FST &fst, MatchType match_type, + uint32 flags = (kParenLoop | kParenList)) + : matcher_(fst, match_type), match_type_(match_type), flags_(flags) { + if (match_type == MATCH_INPUT) { + loop_.ilabel = kNoLabel; + loop_.olabel = 0; + } else { + loop_.ilabel = 0; + loop_.olabel = kNoLabel; + } + loop_.weight = Weight::One(); + loop_.nextstate = kNoStateId; + } + + // This doesn't copy the FST. + ParenMatcher(const FST *fst, MatchType match_type, + uint32 flags = (kParenLoop | kParenList)) + : matcher_(fst, match_type), match_type_(match_type), flags_(flags) { + if (match_type == MATCH_INPUT) { + loop_.ilabel = kNoLabel; + loop_.olabel = 0; + } else { + loop_.ilabel = 0; + loop_.olabel = kNoLabel; + } + loop_.weight = Weight::One(); + loop_.nextstate = kNoStateId; + } + + // This makes a copy of the FST. + ParenMatcher(const ParenMatcher &matcher, bool safe = false) + : matcher_(matcher.matcher_, safe), + match_type_(matcher.match_type_), + flags_(matcher.flags_), + open_parens_(matcher.open_parens_), + close_parens_(matcher.close_parens_), + loop_(matcher.loop_) { + loop_.nextstate = kNoStateId; + } + + ParenMatcher *Copy(bool safe = false) const { + return new ParenMatcher(*this, safe); + } + + MatchType Type(bool test) const { return matcher_.Type(test); } + + void SetState(StateId s) { + matcher_.SetState(s); + loop_.nextstate = s; + } + + bool Find(Label match_label); + + bool Done() const { return done_; } + + const Arc &Value() const { return paren_loop_ ? loop_ : matcher_.Value(); } + + void Next(); + + Weight Final(StateId s) { return matcher_.Final(s); } + + ssize_t Priority(StateId s) { return matcher_.Priority(s); } + + const FST &GetFst() const { return matcher_.GetFst(); } + + uint64 Properties(uint64 props) const { return matcher_.Properties(props); } + + uint32 Flags() const { return matcher_.Flags(); } + + void AddOpenParen(Label label) { + if (label == 0) { + FSTERROR() << "ParenMatcher: Bad open paren label: 0"; + } else { + open_parens_.Insert(label); + } + } + + void AddCloseParen(Label label) { + if (label == 0) { + FSTERROR() << "ParenMatcher: Bad close paren label: 0"; + } else { + close_parens_.Insert(label); + } + } + + void RemoveOpenParen(Label label) { + if (label == 0) { + FSTERROR() << "ParenMatcher: Bad open paren label: 0"; + } else { + open_parens_.Erase(label); + } + } + + void RemoveCloseParen(Label label) { + if (label == 0) { + FSTERROR() << "ParenMatcher: Bad close paren label: 0"; + } else { + close_parens_.Erase(label); + } + } + + void ClearOpenParens() { open_parens_.Clear(); } + + void ClearCloseParens() { close_parens_.Clear(); } + + bool IsOpenParen(Label label) const { return open_parens_.Member(label); } + + bool IsCloseParen(Label label) const { return close_parens_.Member(label); } + + private: + // Advances matcher to next open paren, returning true if it exists. + bool NextOpenParen(); + + // Advances matcher to next close paren, returning true if it exists. + bool NextCloseParen(); + + M matcher_; + MatchType match_type_; // Type of match to perform. + uint32 flags_; + // Open paren label set. + CompactSet open_parens_; + // Close paren label set. + CompactSet close_parens_; + bool open_paren_list_; // Matching open paren list? + bool close_paren_list_; // Matching close paren list? + bool paren_loop_; // Current arc is the implicit paren loop? + mutable Arc loop_; // For non-consuming symbols. + bool done_; // Matching done? + + ParenMatcher &operator=(const ParenMatcher &) = delete; +}; + +template +inline bool ParenMatcher::Find(Label match_label) { + open_paren_list_ = false; + close_paren_list_ = false; + paren_loop_ = false; + done_ = false; + // Returns all parenthesis arcs. + if (match_label == kNoLabel && (flags_ & kParenList)) { + if (open_parens_.LowerBound() != kNoLabel) { + matcher_.LowerBound(open_parens_.LowerBound()); + open_paren_list_ = NextOpenParen(); + if (open_paren_list_) return true; + } + if (close_parens_.LowerBound() != kNoLabel) { + matcher_.LowerBound(close_parens_.LowerBound()); + close_paren_list_ = NextCloseParen(); + if (close_paren_list_) return true; + } + } + // Returns the implicit paren loop. + if (match_label > 0 && (flags_ & kParenLoop) && + (IsOpenParen(match_label) || IsCloseParen(match_label))) { + paren_loop_ = true; + return true; + } + // Returns all other labels. + if (matcher_.Find(match_label)) return true; + done_ = true; + return false; +} + +template +inline void ParenMatcher::Next() { + if (paren_loop_) { + paren_loop_ = false; + done_ = true; + } else if (open_paren_list_) { + matcher_.Next(); + open_paren_list_ = NextOpenParen(); + if (open_paren_list_) return; + if (close_parens_.LowerBound() != kNoLabel) { + matcher_.LowerBound(close_parens_.LowerBound()); + close_paren_list_ = NextCloseParen(); + if (close_paren_list_) return; + } + done_ = !matcher_.Find(kNoLabel); + } else if (close_paren_list_) { + matcher_.Next(); + close_paren_list_ = NextCloseParen(); + if (close_paren_list_) return; + done_ = !matcher_.Find(kNoLabel); + } else { + matcher_.Next(); + done_ = matcher_.Done(); + } +} + +// Advances matcher to next open paren, returning true if it exists. +template +inline bool ParenMatcher::NextOpenParen() { + for (; !matcher_.Done(); matcher_.Next()) { + Label label = match_type_ == MATCH_INPUT ? matcher_.Value().ilabel + : matcher_.Value().olabel; + if (label > open_parens_.UpperBound()) return false; + if (IsOpenParen(label)) return true; + } + return false; +} + +// Advances matcher to next close paren, returning true if it exists. +template +inline bool ParenMatcher::NextCloseParen() { + for (; !matcher_.Done(); matcher_.Next()) { + Label label = match_type_ == MATCH_INPUT ? matcher_.Value().ilabel + : matcher_.Value().olabel; + if (label > close_parens_.UpperBound()) return false; + if (IsCloseParen(label)) return true; + } + return false; +} + +template +class ParenFilter { + public: + using FST1 = typename Filter::FST1; + using FST2 = typename Filter::FST2; + using Arc = typename Filter::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Matcher1 = typename Filter::Matcher1; + using Matcher2 = typename Filter::Matcher2; + + using StackId = StateId; + using ParenStack = PdtStack; + using FilterState1 = typename Filter::FilterState; + using FilterState2 = IntegerFilterState; + using FilterState = PairFilterState; + + ParenFilter(const FST1 &fst1, const FST2 &fst2, Matcher1 *matcher1 = nullptr, + Matcher2 *matcher2 = nullptr, + const std::vector> *parens = nullptr, + bool expand = false, bool keep_parens = true) + : filter_(fst1, fst2, matcher1, matcher2), + parens_(parens ? *parens : std::vector>()), + expand_(expand), + keep_parens_(keep_parens), + fs_(FilterState::NoState()), + stack_(parens_), + paren_id_(-1) { + if (parens) { + for (const auto &pair : *parens) { + parens_.push_back(pair); + GetMatcher1()->AddOpenParen(pair.first); + GetMatcher2()->AddOpenParen(pair.first); + if (!expand_) { + GetMatcher1()->AddCloseParen(pair.second); + GetMatcher2()->AddCloseParen(pair.second); + } + } + } + } + + ParenFilter(const ParenFilter &filter, bool safe = false) + : filter_(filter.filter_, safe), + parens_(filter.parens_), + expand_(filter.expand_), + keep_parens_(filter.keep_parens_), + fs_(FilterState::NoState()), + stack_(filter.parens_), + paren_id_(-1) {} + + FilterState Start() const { + return FilterState(filter_.Start(), FilterState2(0)); + } + + void SetState(StateId s1, StateId s2, const FilterState &fs) { + fs_ = fs; + filter_.SetState(s1, s2, fs_.GetState1()); + if (!expand_) return; + ssize_t paren_id = stack_.Top(fs.GetState2().GetState()); + if (paren_id != paren_id_) { + if (paren_id_ != -1) { + GetMatcher1()->RemoveCloseParen(parens_[paren_id_].second); + GetMatcher2()->RemoveCloseParen(parens_[paren_id_].second); + } + paren_id_ = paren_id; + if (paren_id_ != -1) { + GetMatcher1()->AddCloseParen(parens_[paren_id_].second); + GetMatcher2()->AddCloseParen(parens_[paren_id_].second); + } + } + } + + FilterState FilterArc(Arc *arc1, Arc *arc2) const { + const auto fs1 = filter_.FilterArc(arc1, arc2); + const auto &fs2 = fs_.GetState2(); + if (fs1 == FilterState1::NoState()) return FilterState::NoState(); + if (arc1->olabel == kNoLabel && arc2->ilabel) { // arc2 parentheses. + if (keep_parens_) { + arc1->ilabel = arc2->ilabel; + } else if (arc2->ilabel) { + arc2->olabel = arc1->ilabel; + } + return FilterParen(arc2->ilabel, fs1, fs2); + } else if (arc2->ilabel == kNoLabel && arc1->olabel) { // arc1 parentheses. + if (keep_parens_) { + arc2->olabel = arc1->olabel; + } else { + arc1->ilabel = arc2->olabel; + } + return FilterParen(arc1->olabel, fs1, fs2); + } else { + return FilterState(fs1, fs2); + } + } + + void FilterFinal(Weight *w1, Weight *w2) const { + if (fs_.GetState2().GetState() != 0) *w1 = Weight::Zero(); + filter_.FilterFinal(w1, w2); + } + + // Returns respective matchers; ownership stays with filter. + + Matcher1 *GetMatcher1() { return filter_.GetMatcher1(); } + + Matcher2 *GetMatcher2() { return filter_.GetMatcher2(); } + + uint64 Properties(uint64 iprops) const { + return filter_.Properties(iprops) & kILabelInvariantProperties & + kOLabelInvariantProperties; + } + + private: + const FilterState FilterParen(Label label, const FilterState1 &fs1, + const FilterState2 &fs2) const { + if (!expand_) return FilterState(fs1, fs2); + const auto stack_id = stack_.Find(fs2.GetState(), label); + if (stack_id < 0) { + return FilterState::NoState(); + } else { + return FilterState(fs1, FilterState2(stack_id)); + } + } + + Filter filter_; + std::vector> parens_; + bool expand_; // Expands to FST? + bool keep_parens_; // Retains parentheses in output? + FilterState fs_; // Current filter state. + mutable ParenStack stack_; + ssize_t paren_id_; +}; + +// Class to setup composition options for PDT composition. Default is to take +// the PDT as the first composition argument. +template +class PdtComposeFstOptions + : public ComposeFstOptions< + Arc, ParenMatcher>, + ParenFilter>>>> { + public: + using Label = typename Arc::Label; + using PdtMatcher = ParenMatcher>; + using PdtFilter = ParenFilter>; + + using ComposeFstOptions::matcher1; + using ComposeFstOptions::matcher2; + using ComposeFstOptions::filter; + + PdtComposeFstOptions(const Fst &ifst1, + const std::vector> &parens, + const Fst &ifst2, bool expand = false, + bool keep_parens = true) { + matcher1 = new PdtMatcher(ifst1, MATCH_OUTPUT, kParenList); + matcher2 = new PdtMatcher(ifst2, MATCH_INPUT, kParenLoop); + filter = new PdtFilter(ifst1, ifst2, matcher1, matcher2, &parens, expand, + keep_parens); + } +}; + +// Class to setup composition options for PDT with FST composition. +// Specialization is for the FST as the first composition argument. +template +class PdtComposeFstOptions + : public ComposeFstOptions< + Arc, ParenMatcher>, + ParenFilter>>>> { + public: + using Label = typename Arc::Label; + using PdtMatcher = ParenMatcher>; + using PdtFilter = ParenFilter>; + + using ComposeFstOptions::matcher1; + using ComposeFstOptions::matcher2; + using ComposeFstOptions::filter; + + PdtComposeFstOptions(const Fst &ifst1, const Fst &ifst2, + const std::vector> &parens, + bool expand = false, bool keep_parens = true) { + matcher1 = new PdtMatcher(ifst1, MATCH_OUTPUT, kParenLoop); + matcher2 = new PdtMatcher(ifst2, MATCH_INPUT, kParenList); + filter = new PdtFilter(ifst1, ifst2, matcher1, matcher2, &parens, expand, + keep_parens); + } +}; + +enum PdtComposeFilter { + PAREN_FILTER, // Bar-Hillel construction; keeps parentheses. + EXPAND_FILTER, // Bar-Hillel + expansion; removes parentheses. + EXPAND_PAREN_FILTER, // Bar-Hillel + expansion; keeps parentheses. +}; + +struct PdtComposeOptions { + bool connect; // Connect output? + PdtComposeFilter filter_type; // Pre-defined filter to use. + + explicit PdtComposeOptions(bool connect = true, + PdtComposeFilter filter_type = PAREN_FILTER) + : connect(connect), filter_type(filter_type) {} +}; + +// Composes pushdown transducer (PDT) encoded as an FST (1st arg) and an FST +// (2nd arg) with the result also a PDT encoded as an FST (3rd arg). In the +// PDTs, some transitions are labeled with open or close parentheses. To be +// interpreted as a PDT, the parens must balance on a path (see PdtExpand()). +// The open-close parenthesis label pairs are passed using the parens argument. +template +void Compose(const Fst &ifst1, + const std::vector< + std::pair> &parens, + const Fst &ifst2, MutableFst *ofst, + const PdtComposeOptions &opts = PdtComposeOptions()) { + bool expand = opts.filter_type != PAREN_FILTER; + bool keep_parens = opts.filter_type != EXPAND_FILTER; + PdtComposeFstOptions copts(ifst1, parens, ifst2, expand, + keep_parens); + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + if (opts.connect) Connect(ofst); +} + +// Composes an FST (1st arg) and pushdown transducer (PDT) encoded as an FST +// (2nd arg) with the result also a PDT encoded as an FST (3rd arg). In the +// PDTs, some transitions are labeled with open or close parentheses. To be +// interpreted as a PDT, the parens must balance on a path (see ExpandFst()). +// The open-close parenthesis label pairs are passed using the parens argument. +template +void Compose(const Fst &ifst1, const Fst &ifst2, + const std::vector< + std::pair> &parens, + MutableFst *ofst, + const PdtComposeOptions &opts = PdtComposeOptions()) { + bool expand = opts.filter_type != PAREN_FILTER; + bool keep_parens = opts.filter_type != EXPAND_FILTER; + PdtComposeFstOptions copts(ifst1, ifst2, parens, expand, + keep_parens); + copts.gc_limit = 0; + *ofst = ComposeFst(ifst1, ifst2, copts); + if (opts.connect) Connect(ofst); +} + +} // namespace fst + +#endif // FST_EXTENSIONS_PDT_COMPOSE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/expand.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/expand.h new file mode 100644 index 0000000..eeee781 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/expand.h @@ -0,0 +1,933 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Expands a PDT to an FST. + +#ifndef FST_EXTENSIONS_PDT_EXPAND_H_ +#define FST_EXTENSIONS_PDT_EXPAND_H_ + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fst { + +template +struct PdtExpandFstOptions : public CacheOptions { + bool keep_parentheses; + PdtStack *stack; + PdtStateTable *state_table; + + explicit PdtExpandFstOptions( + const CacheOptions &opts = CacheOptions(), bool keep_parentheses = false, + PdtStack *stack = nullptr, + PdtStateTable *state_table = + nullptr) + : CacheOptions(opts), + keep_parentheses(keep_parentheses), + stack(stack), + state_table(state_table) {} +}; + +namespace internal { + +// Implementation class for PdtExpandFst. +template +class PdtExpandFstImpl : public CacheImpl { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using StackId = StateId; + using StateTuple = PdtStateTuple; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::Properties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheBaseImpl>::PushArc; + using CacheBaseImpl>::HasArcs; + using CacheBaseImpl>::HasFinal; + using CacheBaseImpl>::HasStart; + using CacheBaseImpl>::SetArcs; + using CacheBaseImpl>::SetFinal; + using CacheBaseImpl>::SetStart; + + PdtExpandFstImpl(const Fst &fst, + const std::vector> &parens, + const PdtExpandFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + stack_(opts.stack ? opts.stack : new PdtStack(parens)), + state_table_(opts.state_table ? opts.state_table + : new PdtStateTable()), + own_stack_(opts.stack == 0), + own_state_table_(opts.state_table == 0), + keep_parentheses_(opts.keep_parentheses) { + SetType("expand"); + const auto props = fst.Properties(kFstProperties, false); + SetProperties(PdtExpandProperties(props), kCopyProperties); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + } + + PdtExpandFstImpl(const PdtExpandFstImpl &impl) + : CacheImpl(impl), + fst_(impl.fst_->Copy(true)), + stack_(new PdtStack(*impl.stack_)), + state_table_(new PdtStateTable()), + own_stack_(true), + own_state_table_(true), + keep_parentheses_(impl.keep_parentheses_) { + SetType("expand"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + ~PdtExpandFstImpl() override { + if (own_stack_) delete stack_; + if (own_state_table_) delete state_table_; + } + + StateId Start() { + if (!HasStart()) { + const auto s = fst_->Start(); + if (s == kNoStateId) return kNoStateId; + StateTuple tuple(s, 0); + const auto start = state_table_->FindState(tuple); + SetStart(start); + } + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) { + const auto &tuple = state_table_->Tuple(s); + const auto weight = fst_->Final(tuple.state_id); + if (weight != Weight::Zero() && tuple.stack_id == 0) + SetFinal(s, weight); + else + SetFinal(s, Weight::Zero()); + } + return CacheImpl::Final(s); + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) ExpandState(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) ExpandState(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) ExpandState(s); + return CacheImpl::NumOutputEpsilons(s); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) ExpandState(s); + CacheImpl::InitArcIterator(s, data); + } + + // Computes the outgoing transitions from a state, creating new destination + // states as needed. + void ExpandState(StateId s) { + StateTuple tuple = state_table_->Tuple(s); + for (ArcIterator> aiter(*fst_, tuple.state_id); !aiter.Done(); + aiter.Next()) { + auto arc = aiter.Value(); + const auto stack_id = stack_->Find(tuple.stack_id, arc.ilabel); + if (stack_id == -1) { // Non-matching close parenthesis. + continue; + } else if ((stack_id != tuple.stack_id) && !keep_parentheses_) { + // Stack push/pop. + arc.ilabel = 0; + arc.olabel = 0; + } + StateTuple ntuple(arc.nextstate, stack_id); + arc.nextstate = state_table_->FindState(ntuple); + PushArc(s, arc); + } + SetArcs(s); + } + + const PdtStack &GetStack() const { return *stack_; } + + const PdtStateTable &GetStateTable() const { + return *state_table_; + } + + private: + // Properties for an expanded PDT. + inline uint64 PdtExpandProperties(uint64 inprops) { + return inprops & (kAcceptor | kAcyclic | kInitialAcyclic | kUnweighted); + } + + std::unique_ptr> fst_; + PdtStack *stack_; + PdtStateTable *state_table_; + bool own_stack_; + bool own_state_table_; + bool keep_parentheses_; +}; + +} // namespace internal + +// Expands a pushdown transducer (PDT) encoded as an FST into an FST. This +// version is a delayed FST. In the PDT, some transitions are labeled with open +// or close parentheses. To be interpreted as a PDT, the parens must balance on +// a path. The open-close parenthesis label pairs are passed using the parens +// argument. The expansion enforces the parenthesis constraints. The PDT must be +// expandable as an FST. +// +// This class attaches interface to implementation and handles reference +// counting, delegating most methods to ImplToFst. +template +class PdtExpandFst : public ImplToFst> { + public: + using Arc = A; + + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using StackId = StateId; + using Store = DefaultCacheStore; + using State = typename Store::State; + using Impl = internal::PdtExpandFstImpl; + + friend class ArcIterator>; + friend class StateIterator>; + + PdtExpandFst(const Fst &fst, + const std::vector> &parens) + : ImplToFst( + std::make_shared(fst, parens, PdtExpandFstOptions())) {} + + PdtExpandFst(const Fst &fst, + const std::vector> &parens, + const PdtExpandFstOptions &opts) + : ImplToFst(std::make_shared(fst, parens, opts)) {} + + // See Fst<>::Copy() for doc. + PdtExpandFst(const PdtExpandFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Gets a copy of this ExpandFst. See Fst<>::Copy() for further doc. + PdtExpandFst *Copy(bool safe = false) const override { + return new PdtExpandFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + const PdtStack &GetStack() const { + return GetImpl()->GetStack(); + } + + const PdtStateTable &GetStateTable() const { + return GetImpl()->GetStateTable(); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + void operator=(const PdtExpandFst &) = delete; +}; + +// Specialization for PdtExpandFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const PdtExpandFst &fst) + : CacheStateIterator>(fst, fst.GetMutableImpl()) {} +}; + +// Specialization for PdtExpandFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const PdtExpandFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->ExpandState(s); + } +}; + +template +inline void PdtExpandFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// PrunedExpand prunes the delayed expansion of a pushdown transducer (PDT) +// encoded as an FST into an FST. In the PDT, some transitions are labeled with +// open or close parentheses. To be interpreted as a PDT, the parens must +// balance on a path. The open-close parenthesis label pairs are passed +// using the parens argument. The expansion enforces the parenthesis +// constraints. +// +// The algorithm works by visiting the delayed ExpandFst using a shortest-stack +// first queue discipline and relies on the shortest-distance information +// computed using a reverse shortest-path call to perform the pruning. +// +// The algorithm maintains the same state ordering between the ExpandFst being +// visited (efst_) and the result of pruning written into the MutableFst (ofst_) +// to improve readability. +template +class PdtPrunedExpand { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using StackId = StateId; + using Stack = PdtStack; + using StateTable = PdtStateTable; + using SetIterator = typename internal::PdtBalanceData::SetIterator; + + // Constructor taking as input a PDT specified by by an input FST and a vector + // of parentheses. The keep_parentheses argument specifies whether parentheses + // are replaced by epsilons or not during the expansion. The cache options are + // passed to the underlying ExpandFst. + PdtPrunedExpand(const Fst &ifst, + const std::vector> &parens, + bool keep_parentheses = false, + const CacheOptions &opts = CacheOptions()) + : ifst_(ifst.Copy()), + keep_parentheses_(keep_parentheses), + stack_(parens), + efst_(ifst, parens, + PdtExpandFstOptions(opts, true, &stack_, &state_table_)), + queue_(state_table_, stack_, stack_length_, distance_, fdistance_), + error_(false) { + Reverse(*ifst_, parens, &rfst_); + VectorFst path; + reverse_shortest_path_.reset(new PdtShortestPath>( + rfst_, parens, + PdtShortestPathOptions>(true, false))); + reverse_shortest_path_->ShortestPath(&path); + error_ = (path.Properties(kError, true) == kError); + balance_data_.reset(reverse_shortest_path_->GetBalanceData()->Reverse( + rfst_.NumStates(), 10, -1)); + InitCloseParenMultimap(parens); + } + + bool Error() const { return error_; } + + // Expands and prunes the input PDT according to the provided weight + // threshold, wirting the result into an output mutable FST. + void Expand(MutableFst *ofst, const Weight &threshold); + + private: + static constexpr uint8 kEnqueued = 0x01; + static constexpr uint8 kExpanded = 0x02; + static constexpr uint8 kSourceState = 0x04; + + // Comparison functor used by the queue: + // + // 1. States corresponding to shortest stack first, and + // 2. for stacks of matching length, reverse lexicographic order is used, and + // 3. for states with the same stack, shortest-first order is used. + class StackCompare { + public: + StackCompare(const StateTable &state_table, const Stack &stack, + const std::vector &stack_length, + const std::vector &distance, + const std::vector &fdistance) + : state_table_(state_table), + stack_(stack), + stack_length_(stack_length), + distance_(distance), + fdistance_(fdistance) {} + + bool operator()(StateId s1, StateId s2) const { + auto si1 = state_table_.Tuple(s1).stack_id; + auto si2 = state_table_.Tuple(s2).stack_id; + if (stack_length_[si1] < stack_length_[si2]) return true; + if (stack_length_[si1] > stack_length_[si2]) return false; + // If stack IDs are equal, use A*. + if (si1 == si2) { + return less_(Distance(s1), Distance(s2)); + } + // If lengths are equal, uses reverse lexicographic order. + for (; si1 != si2; si1 = stack_.Pop(si1), si2 = stack_.Pop(si2)) { + if (stack_.Top(si1) < stack_.Top(si2)) return true; + if (stack_.Top(si1) > stack_.Top(si2)) return false; + } + return false; + } + + private: + Weight Distance(StateId s) const { + return (s < distance_.size()) && (s < fdistance_.size()) + ? Times(distance_[s], fdistance_[s]) + : Weight::Zero(); + } + + const StateTable &state_table_; + const Stack &stack_; + const std::vector &stack_length_; + const std::vector &distance_; + const std::vector &fdistance_; + const NaturalLess less_; + }; + + class ShortestStackFirstQueue + : public ShortestFirstQueue { + public: + ShortestStackFirstQueue(const PdtStateTable &state_table, + const Stack &stack, + const std::vector &stack_length, + const std::vector &distance, + const std::vector &fdistance) + : ShortestFirstQueue(StackCompare( + state_table, stack, stack_length, distance, fdistance)) {} + }; + + void InitCloseParenMultimap( + const std::vector> &parens); + + Weight DistanceToDest(StateId source, StateId dest) const; + + uint8 Flags(StateId s) const; + + void SetFlags(StateId s, uint8 flags, uint8 mask); + + Weight Distance(StateId s) const; + + void SetDistance(StateId s, Weight weight); + + Weight FinalDistance(StateId s) const; + + void SetFinalDistance(StateId s, Weight weight); + + StateId SourceState(StateId s) const; + + void SetSourceState(StateId s, StateId p); + + void AddStateAndEnqueue(StateId s); + + void Relax(StateId s, const Arc &arc, Weight weight); + + bool PruneArc(StateId s, const Arc &arc); + + void ProcStart(); + + void ProcFinal(StateId s); + + bool ProcNonParen(StateId s, const Arc &arc, bool add_arc); + + bool ProcOpenParen(StateId s, const Arc &arc, StackId si, StackId nsi); + + bool ProcCloseParen(StateId s, const Arc &arc); + + void ProcDestStates(StateId s, StackId si); + + // Input PDT. + std::unique_ptr> ifst_; + // Reversed PDT. + VectorFst rfst_; + // Keep parentheses in ofst? + const bool keep_parentheses_; + // State table for efst_. + StateTable state_table_; + // Stack trie. + Stack stack_; + // Expanded PDT. + PdtExpandFst efst_; + // Length of stack for given stack ID. + std::vector stack_length_; + // Distance from initial state in efst_/ofst. + std::vector distance_; + // Distance to final states in efst_/ofst. + std::vector fdistance_; + // Queue used to visit efst_. + ShortestStackFirstQueue queue_; + // Construction time failure? + bool error_; + // Status flags for states in efst_/ofst. + std::vector flags_; + // PDT source state for each expanded state. + std::vector sources_; + // Shortest path for rfst_. + std::unique_ptr>> + reverse_shortest_path_; + std::unique_ptr> balance_data_; + // Maps open paren arcs to balancing close paren arcs. + typename PdtShortestPath>::CloseParenMultimap + close_paren_multimap_; + MutableFst *ofst_; // Output FST. + Weight limit_; // Weight limit. + + // Maps a state s in ifst (i.e., the source of a closed paranthesis matching + // the top of current_stack_id_ to final states in efst_. + std::unordered_map dest_map_; + // Stack ID of the states currently at the top of the queue, i.e., the states + // currently being popped and processed. + StackId current_stack_id_; + ssize_t current_paren_id_; // Paren ID at top of current stack. + ssize_t cached_stack_id_; + StateId cached_source_; + // The set of pairs of destination states and weights to final states for the + // source state cached_source_ and the paren ID cached_paren_id_; i.e., the + // set of source states of a closed parenthesis with paren ID cached_paren_id + // balancing an incoming open parenthesis with paren ID cached_paren_id_ in + // state cached_source_. + std::forward_list> cached_dest_list_; + NaturalLess less_; +}; + +// Initializes close paren multimap, mapping pairs (s, paren_id) to all the arcs +// out of s labeled with close parenthese for paren_id. +template +void PdtPrunedExpand::InitCloseParenMultimap( + const std::vector> &parens) { + std::unordered_map paren_map; + for (size_t i = 0; i < parens.size(); ++i) { + const auto &pair = parens[i]; + paren_map[pair.first] = i; + paren_map[pair.second] = i; + } + for (StateIterator> siter(*ifst_); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + for (ArcIterator> aiter(*ifst_, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + const auto it = paren_map.find(arc.ilabel); + if (it == paren_map.end()) continue; + if (arc.ilabel == parens[it->second].second) { // Close paren. + const internal::ParenState key(it->second, s); + close_paren_multimap_.emplace(key, arc); + } + } + } +} + +// Returns the weight of the shortest balanced path from source to dest +// in ifst_; dest must be the source state of a close paren arc. +template +typename Arc::Weight PdtPrunedExpand::DistanceToDest(StateId source, + StateId dest) const { + using SearchState = + typename PdtShortestPath>::SearchState; + const SearchState ss(source + 1, dest + 1); + const auto distance = + reverse_shortest_path_->GetShortestPathData().Distance(ss); + VLOG(2) << "D(" << source << ", " << dest << ") =" << distance; + return distance; +} + +// Returns the flags for state s in ofst_. +template +uint8 PdtPrunedExpand::Flags(StateId s) const { + return s < flags_.size() ? flags_[s] : 0; +} + +// Modifies the flags for state s in ofst_. +template +void PdtPrunedExpand::SetFlags(StateId s, uint8 flags, uint8 mask) { + while (flags_.size() <= s) flags_.push_back(0); + flags_[s] &= ~mask; + flags_[s] |= flags & mask; +} + +// Returns the shortest distance from the initial state to s in ofst_. +template +typename Arc::Weight PdtPrunedExpand::Distance(StateId s) const { + return s < distance_.size() ? distance_[s] : Weight::Zero(); +} + +// Sets the shortest distance from the initial state to s in ofst_. +template +void PdtPrunedExpand::SetDistance(StateId s, Weight weight) { + while (distance_.size() <= s) distance_.push_back(Weight::Zero()); + distance_[s] = std::move(weight); +} + +// Returns the shortest distance from s to the final states in ofst_. +template +typename Arc::Weight PdtPrunedExpand::FinalDistance(StateId s) const { + return s < fdistance_.size() ? fdistance_[s] : Weight::Zero(); +} + +// Sets the shortest distance from s to the final states in ofst_. +template +void PdtPrunedExpand::SetFinalDistance(StateId s, Weight weight) { + while (fdistance_.size() <= s) fdistance_.push_back(Weight::Zero()); + fdistance_[s] = std::move(weight); +} + +// Returns the PDT source state of state s in ofst_. +template +typename Arc::StateId PdtPrunedExpand::SourceState(StateId s) const { + return s < sources_.size() ? sources_[s] : kNoStateId; +} + +// Sets the PDT source state of state s in ofst_ to state p'in ifst_. +template +void PdtPrunedExpand::SetSourceState(StateId s, StateId p) { + while (sources_.size() <= s) sources_.push_back(kNoStateId); + sources_[s] = p; +} + +// Adds state s of efst_ to ofst_ and inserts it in the queue, modifying the +// flags for s accordingly. +template +void PdtPrunedExpand::AddStateAndEnqueue(StateId s) { + if (!(Flags(s) & (kEnqueued | kExpanded))) { + while (ofst_->NumStates() <= s) ofst_->AddState(); + queue_.Enqueue(s); + SetFlags(s, kEnqueued, kEnqueued); + } else if (Flags(s) & kEnqueued) { + queue_.Update(s); + } + // TODO(allauzen): Check everything is fine when kExpanded? +} + +// Relaxes arc out of state s in ofst_ as follows: +// +// 1. If the distance to s times the weight of arc is smaller than +// the currently stored distance for arc.nextstate, updates +// Distance(arc.nextstate) with a new estimate +// 2. If fd is less than the currently stored distance from arc.nextstate to the +// final state, updates with new estimate. +template +void PdtPrunedExpand::Relax(StateId s, const Arc &arc, Weight fd) { + const auto nd = Times(Distance(s), arc.weight); + if (less_(nd, Distance(arc.nextstate))) { + SetDistance(arc.nextstate, nd); + SetSourceState(arc.nextstate, SourceState(s)); + } + if (less_(fd, FinalDistance(arc.nextstate))) { + SetFinalDistance(arc.nextstate, fd); + } + VLOG(2) << "Relax: " << s << ", d[s] = " << Distance(s) << ", to " + << arc.nextstate << ", d[ns] = " << Distance(arc.nextstate) + << ", nd = " << nd; +} + +// Returns whether the arc out of state s in efst needs pruned. +template +bool PdtPrunedExpand::PruneArc(StateId s, const Arc &arc) { + VLOG(2) << "Prune ?"; + auto fd = Weight::Zero(); + if ((cached_source_ != SourceState(s)) || + (cached_stack_id_ != current_stack_id_)) { + cached_source_ = SourceState(s); + cached_stack_id_ = current_stack_id_; + cached_dest_list_.clear(); + if (cached_source_ != ifst_->Start()) { + for (auto set_iter = + balance_data_->Find(current_paren_id_, cached_source_); + !set_iter.Done(); set_iter.Next()) { + auto dest = set_iter.Element(); + const auto it = dest_map_.find(dest); + cached_dest_list_.push_front(*it); + } + } else { + // TODO(allauzen): queue discipline should prevent this from ever + // happening. + // Replace by a check. + cached_dest_list_.push_front( + std::make_pair(rfst_.Start() - 1, Weight::One())); + } + } + for (auto it = cached_dest_list_.begin(); it != cached_dest_list_.end(); + ++it) { + const auto d = + DistanceToDest(state_table_.Tuple(arc.nextstate).state_id, it->first); + fd = Plus(fd, Times(d, it->second)); + } + Relax(s, arc, fd); + return less_(limit_, Times(Distance(s), Times(arc.weight, fd))); +} + +// Adds start state of efst_ to ofst_, enqueues it, and initializes the distance +// data structures. +template +void PdtPrunedExpand::ProcStart() { + const auto s = efst_.Start(); + AddStateAndEnqueue(s); + ofst_->SetStart(s); + SetSourceState(s, ifst_->Start()); + current_stack_id_ = 0; + current_paren_id_ = -1; + stack_length_.push_back(0); + const auto r = rfst_.Start() - 1; + cached_source_ = ifst_->Start(); + cached_stack_id_ = 0; + cached_dest_list_.push_front(std::make_pair(r, Weight::One())); + const PdtStateTuple tuple(r, 0); + SetFinalDistance(state_table_.FindState(tuple), Weight::One()); + SetDistance(s, Weight::One()); + const auto d = DistanceToDest(ifst_->Start(), r); + SetFinalDistance(s, d); + VLOG(2) << d; +} + +// Makes s final in ofst_ if shortest accepting path ending in s is below +// threshold. +template +void PdtPrunedExpand::ProcFinal(StateId s) { + const auto weight = efst_.Final(s); + if (weight == Weight::Zero()) return; + if (less_(limit_, Times(Distance(s), weight))) return; + ofst_->SetFinal(s, weight); +} + +// Returns true when an arc (or meta-arc) leaving state s in efst_ is below the +// threshold. When add_arc is true, arc is added to ofst_. +template +bool PdtPrunedExpand::ProcNonParen(StateId s, const Arc &arc, + bool add_arc) { + VLOG(2) << "ProcNonParen: " << s << " to " << arc.nextstate << ", " + << arc.ilabel << ":" << arc.olabel << " / " << arc.weight + << ", add_arc = " << (add_arc ? "true" : "false"); + if (PruneArc(s, arc)) return false; + if (add_arc) ofst_->AddArc(s, arc); + AddStateAndEnqueue(arc.nextstate); + return true; +} + +// Processes an open paren arc leaving state s in ofst_. When the arc is labeled +// with an open paren, +// +// 1. Considers each (shortest) balanced path starting in s by taking the arc +// and ending by a close paren balancing the open paren of as a meta-arc, +// processing and pruning each meta-arc as a non-paren arc, inserting its +// destination to the queue; +// 2. if at least one of these meta-arcs has not been pruned, adds the +// destination of arc to ofst_ as a new source state for the stack ID nsi, and +// inserts it in the queue. +template +bool PdtPrunedExpand::ProcOpenParen(StateId s, const Arc &arc, StackId si, + StackId nsi) { + // Updates the stack length when needed. + while (stack_length_.size() <= nsi) stack_length_.push_back(-1); + if (stack_length_[nsi] == -1) stack_length_[nsi] = stack_length_[si] + 1; + const auto ns = arc.nextstate; + VLOG(2) << "Open paren: " << s << "(" << state_table_.Tuple(s).state_id + << ") to " << ns << "(" << state_table_.Tuple(ns).state_id << ")"; + bool proc_arc = false; + auto fd = Weight::Zero(); + const auto paren_id = stack_.ParenId(arc.ilabel); + std::forward_list sources; + for (auto set_iter = + balance_data_->Find(paren_id, state_table_.Tuple(ns).state_id); + !set_iter.Done(); set_iter.Next()) { + sources.push_front(set_iter.Element()); + } + for (const auto source : sources) { + VLOG(2) << "Close paren source: " << source; + const internal::ParenState paren_state(paren_id, source); + for (auto it = close_paren_multimap_.find(paren_state); + it != close_paren_multimap_.end() && paren_state == it->first; ++it) { + auto meta_arc = it->second; + const PdtStateTuple tuple(meta_arc.nextstate, si); + meta_arc.nextstate = state_table_.FindState(tuple); + const auto state_id = state_table_.Tuple(ns).state_id; + const auto d = DistanceToDest(state_id, source); + VLOG(2) << state_id << ", " << source; + VLOG(2) << "Meta arc weight = " << arc.weight << " Times " << d + << " Times " << meta_arc.weight; + meta_arc.weight = Times(arc.weight, Times(d, meta_arc.weight)); + proc_arc |= ProcNonParen(s, meta_arc, false); + fd = Plus( + fd, + Times(Times(DistanceToDest(state_table_.Tuple(ns).state_id, source), + it->second.weight), + FinalDistance(meta_arc.nextstate))); + } + } + if (proc_arc) { + VLOG(2) << "Proc open paren " << s << " to " << arc.nextstate; + ofst_->AddArc( + s, keep_parentheses_ ? arc : Arc(0, 0, arc.weight, arc.nextstate)); + AddStateAndEnqueue(arc.nextstate); + const auto nd = Times(Distance(s), arc.weight); + if (less_(nd, Distance(arc.nextstate))) SetDistance(arc.nextstate, nd); + // FinalDistance not necessary for source state since pruning decided using + // meta-arcs above. But this is a problem with A*, hence the following. + if (less_(fd, FinalDistance(arc.nextstate))) + SetFinalDistance(arc.nextstate, fd); + SetFlags(arc.nextstate, kSourceState, kSourceState); + } + return proc_arc; +} + +// Checks that shortest path through close paren arc in efst_ is below +// threshold, and if so, adds it to ofst_. +template +bool PdtPrunedExpand::ProcCloseParen(StateId s, const Arc &arc) { + const auto weight = + Times(Distance(s), Times(arc.weight, FinalDistance(arc.nextstate))); + if (less_(limit_, weight)) return false; + ofst_->AddArc(s, + keep_parentheses_ ? arc : Arc(0, 0, arc.weight, arc.nextstate)); + return true; +} + +// When state s in ofst_ is a source state for stack ID si, identifies all the +// corresponding possible destination states, that is, all the states in ifst_ +// that have an outgoing close paren arc balancing the incoming open paren taken +// to get to s. For each such state t, computes the shortest distance from (t, +// si) to the final states in ofst_. Stores this information in dest_map_. +template +void PdtPrunedExpand::ProcDestStates(StateId s, StackId si) { + if (!(Flags(s) & kSourceState)) return; + if (si != current_stack_id_) { + dest_map_.clear(); + current_stack_id_ = si; + current_paren_id_ = stack_.Top(current_stack_id_); + VLOG(2) << "StackID " << si << " dequeued for first time"; + } + // TODO(allauzen): clean up source state business; rename current function to + // ProcSourceState. + SetSourceState(s, state_table_.Tuple(s).state_id); + const auto paren_id = stack_.Top(si); + for (auto set_iter = + balance_data_->Find(paren_id, state_table_.Tuple(s).state_id); + !set_iter.Done(); set_iter.Next()) { + const auto dest_state = set_iter.Element(); + if (dest_map_.find(dest_state) != dest_map_.end()) continue; + auto dest_weight = Weight::Zero(); + internal::ParenState paren_state(paren_id, dest_state); + for (auto it = close_paren_multimap_.find(paren_state); + it != close_paren_multimap_.end() && paren_state == it->first; ++it) { + const auto &arc = it->second; + const PdtStateTuple tuple(arc.nextstate, + stack_.Pop(si)); + dest_weight = + Plus(dest_weight, + Times(arc.weight, FinalDistance(state_table_.FindState(tuple)))); + } + dest_map_[dest_state] = dest_weight; + VLOG(2) << "State " << dest_state << " is a dest state for stack ID " << si + << " with weight " << dest_weight; + } +} + +// Expands and prunes the input PDT, writing the result in ofst. +template +void PdtPrunedExpand::Expand(MutableFst *ofst, + const typename Arc::Weight &threshold) { + ofst_ = ofst; + if (error_) { + ofst_->SetProperties(kError, kError); + return; + } + ofst_->DeleteStates(); + ofst_->SetInputSymbols(ifst_->InputSymbols()); + ofst_->SetOutputSymbols(ifst_->OutputSymbols()); + limit_ = Times(DistanceToDest(ifst_->Start(), rfst_.Start() - 1), threshold); + flags_.clear(); + ProcStart(); + while (!queue_.Empty()) { + const auto s = queue_.Head(); + queue_.Dequeue(); + SetFlags(s, kExpanded, kExpanded | kEnqueued); + VLOG(2) << s << " dequeued!"; + ProcFinal(s); + StackId stack_id = state_table_.Tuple(s).stack_id; + ProcDestStates(s, stack_id); + for (ArcIterator> aiter(efst_, s); !aiter.Done(); + aiter.Next()) { + const auto &arc = aiter.Value(); + const auto nextstack_id = state_table_.Tuple(arc.nextstate).stack_id; + if (stack_id == nextstack_id) { + ProcNonParen(s, arc, true); + } else if (stack_id == stack_.Pop(nextstack_id)) { + ProcOpenParen(s, arc, stack_id, nextstack_id); + } else { + ProcCloseParen(s, arc); + } + } + VLOG(2) << "d[" << s << "] = " << Distance(s) << ", fd[" << s + << "] = " << FinalDistance(s); + } +} + +// Expand functions. + +template +struct PdtExpandOptions { + using Weight = typename Arc::Weight; + + bool connect; + bool keep_parentheses; + Weight weight_threshold; + + PdtExpandOptions(bool connect = true, bool keep_parentheses = false, + Weight weight_threshold = Weight::Zero()) + : connect(connect), + keep_parentheses(keep_parentheses), + weight_threshold(std::move(weight_threshold)) {} +}; + +// Expands a pushdown transducer (PDT) encoded as an FST into an FST. This +// version writes the expanded PDT to a mutable FST. In the PDT, some +// transitions are labeled with open or close parentheses. To be interpreted as +// a PDT, the parens must balance on a path. The open-close parenthesis label +// pairs are passed using the parens argument. Expansion enforces the +// parenthesis constraints. The PDT must be expandable as an FST. +template +void Expand( + const Fst &ifst, + const std::vector> + &parens, + MutableFst *ofst, const PdtExpandOptions &opts) { + PdtExpandFstOptions eopts; + eopts.gc_limit = 0; + if (opts.weight_threshold == Arc::Weight::Zero()) { + eopts.keep_parentheses = opts.keep_parentheses; + *ofst = PdtExpandFst(ifst, parens, eopts); + } else { + PdtPrunedExpand pruned_expand(ifst, parens, opts.keep_parentheses); + pruned_expand.Expand(ofst, opts.weight_threshold); + } + if (opts.connect) Connect(ofst); +} + +// Expands a pushdown transducer (PDT) encoded as an FST into an FST. This +// version writes the expanded PDT result to a mutable FST. In the PDT, some +// transitions are labeled with open or close parentheses. To be interpreted as +// a PDT, the parens must balance on a path. The open-close parenthesis label +// pairs are passed using the parents argument. Expansion enforces the +// parenthesis constraints. The PDT must be expandable as an FST. +template +void Expand(const Fst &ifst, + const std::vector> + &parens, MutableFst *ofst, bool connect = true, + bool keep_parentheses = false) { + const PdtExpandOptions opts(connect, keep_parentheses); + Expand(ifst, parens, ofst, opts); +} + +} // namespace fst + +#endif // FST_EXTENSIONS_PDT_EXPAND_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/getters.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/getters.h new file mode 100644 index 0000000..69dd150 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/getters.h @@ -0,0 +1,22 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_EXTENSIONS_PDT_GETTERS_H_ +#define FST_EXTENSIONS_PDT_GETTERS_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +bool GetPdtComposeFilter(const string &str, PdtComposeFilter *cf); + +bool GetPdtParserType(const string &str, PdtParserType *pt); + +} // namespace script +} // namespace fst + +#endif // FST_EXTENSIONS_PDT_GETTERS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/info.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/info.h new file mode 100644 index 0000000..3de5477 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/extensions/pdt/info.h @@ -0,0 +1,152 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Prints information about a PDT. + +#ifndef FST_EXTENSIONS_PDT_INFO_H_ +#define FST_EXTENSIONS_PDT_INFO_H_ + +#include +#include +#include + +#include +#include + +namespace fst { + +// Compute various information about PDTs. +template +class PdtInfo { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + PdtInfo(const Fst &fst, + const std::vector> &parents); + + const string &FstType() const { return fst_type_; } + + const string &ArcType() const { return Arc::Type(); } + + int64 NumStates() const { return nstates_; } + + int64 NumArcs() const { return narcs_; } + + int64 NumOpenParens() const { return nopen_parens_; } + + int64 NumCloseParens() const { return nclose_parens_; } + + int64 NumUniqueOpenParens() const { return nuniq_open_parens_; } + + int64 NumUniqueCloseParens() const { return nuniq_close_parens_; } + + int64 NumOpenParenStates() const { return nopen_paren_states_; } + + int64 NumCloseParenStates() const { return nclose_paren_states_; } + + private: + string fst_type_; + int64 nstates_; + int64 narcs_; + int64 nopen_parens_; + int64 nclose_parens_; + int64 nuniq_open_parens_; + int64 nuniq_close_parens_; + int64 nopen_paren_states_; + int64 nclose_paren_states_; +}; + +template +PdtInfo::PdtInfo( + const Fst &fst, + const std::vector> + &parens) + : fst_type_(fst.Type()), + nstates_(0), + narcs_(0), + nopen_parens_(0), + nclose_parens_(0), + nuniq_open_parens_(0), + nuniq_close_parens_(0), + nopen_paren_states_(0), + nclose_paren_states_(0) { + std::unordered_map paren_map; + std::unordered_set> +class CompactFst; + +template +class ConstFst; + +template +class EditFst; + +template +class ExpandedFst; + +template +class Fst; + +template +class MutableFst; + +template > +class VectorState; + +template > +class VectorFst; + +template +class DefaultReplaceStateTable; + +// On-the-fly operations. + +template +class ArcSortFst; + +template +class ClosureFst; + +template > +class ComposeFst; + +template +class ConcatFst; + +template +class DeterminizeFst; + +template +class DifferenceFst; + +template +class IntersectFst; + +template +class InvertFst; + +template +class ArcMapFst; + +template +class ProjectFst; + +template +class RandGenFst; + +template +class RelabelFst; + +template , + class Store = DefaultCacheStore> +class ReplaceFst; + +template +class RmEpsilonFst; + +template +class UnionFst; + +// Heap. + +template +class Heap; + +// Compactors. + +template +class AcceptorCompactor; + +template +class StringCompactor; + +template +class UnweightedAcceptorCompactor; + +template +class UnweightedCompactor; + +template +class WeightedStringCompactor; + +// Compact FSTs. + +template +using CompactStringFst = CompactFst, U>; + +template +using CompactWeightedStringFst = + CompactFst, U>; + +template +using CompactAcceptorFst = CompactFst, U>; + +template +using CompactUnweightedFst = CompactFst, U>; + +template +using CompactUnweightedAcceptorFst = + CompactFst, U>; + +// StdArc aliases for FSTs. + +using StdConstFst = ConstFst; +using StdExpandedFst = ExpandedFst; +using StdFst = Fst; +using StdMutableFst = MutableFst; +using StdVectorFst = VectorFst; + +// StdArc aliases for on-the-fly operations. + +template +using StdArcSortFst = ArcSortFst; + +using StdClosureFst = ClosureFst; + +using StdComposeFst = ComposeFst; + +using StdConcatFst = ConcatFst; + +using StdDeterminizeFst = DeterminizeFst; + +using StdDifferenceFst = DifferenceFst; + +using StdIntersectFst = IntersectFst; + +using StdInvertFst = InvertFst; + +using StdProjectFst = ProjectFst; + +using StdRelabelFst = RelabelFst; + +using StdReplaceFst = ReplaceFst; + +using StdRmEpsilonFst = RmEpsilonFst; + +using StdUnionFst = UnionFst; + +// Filter states. + +template +class IntegerFilterState; + +using CharFilterState = IntegerFilterState; + +using ShortFilterState = IntegerFilterState; // NOLINT + +using IntFilterState = IntegerFilterState; + +// Matchers and filters. + +template +class Matcher; + +template +class NullComposeFilter; + +template +class TrivialComposeFilter; + +template +class SequenceComposeFilter; + +template +class AltSequenceComposeFilter; + +template +class MatchComposeFilter; + +template +class NoMatchComposeFilter; + +} // namespace fst + +#endif // FST_FST_DECL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/fst.h new file mode 100644 index 0000000..20e6bb3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/fst.h @@ -0,0 +1,1007 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST abstract base class definition, state and arc iterator interface, and +// suggested base implementation. + +#ifndef FST_FST_H_ +#define FST_FST_H_ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +DECLARE_bool(fst_align); + +namespace fst { + +bool IsFstHeader(std::istream &, const string &); + +class FstHeader; + +template +struct StateIteratorData; + +template +struct ArcIteratorData; + +template +class MatcherBase; + +struct FstReadOptions { + // FileReadMode(s) are advisory, there are many conditions than prevent a + // file from being mapped, READ mode will be selected in these cases with + // a warning indicating why it was chosen. + enum FileReadMode { READ, MAP }; + + string source; // Where you're reading from. + const FstHeader *header; // Pointer to FST header; if non-zero, use + // this info (don't read a stream header). + const SymbolTable *isymbols; // Pointer to input symbols; if non-zero, use + // this info (read and skip stream isymbols) + const SymbolTable *osymbols; // Pointer to output symbols; if non-zero, use + // this info (read and skip stream osymbols) + FileReadMode mode; // Read or map files (advisory, if possible) + bool read_isymbols; // Read isymbols, if any (default: true). + bool read_osymbols; // Read osymbols, if any (default: true). + + explicit FstReadOptions(const string &source = "", + const FstHeader *header = nullptr, + const SymbolTable *isymbols = nullptr, + const SymbolTable *osymbols = nullptr); + + explicit FstReadOptions(const string &source, const SymbolTable *isymbols, + const SymbolTable *osymbols = nullptr); + + // Helper function to convert strings FileReadModes into their enum value. + static FileReadMode ReadMode(const string &mode); + + // Outputs a debug string for the FstReadOptions object. + string DebugString() const; +}; + +struct FstWriteOptions { + string source; // Where you're writing to. + bool write_header; // Write the header? + bool write_isymbols; // Write input symbols? + bool write_osymbols; // Write output symbols? + bool align; // Write data aligned (may fail on pipes)? + bool stream_write; // Avoid seek operations in writing. + + explicit FstWriteOptions(const string &source = "", + bool write_header = true, bool write_isymbols = true, + bool write_osymbols = true, + bool align = FLAGS_fst_align, + bool stream_write = false) + : source(source), + write_header(write_header), + write_isymbols(write_isymbols), + write_osymbols(write_osymbols), + align(align), + stream_write(stream_write) {} +}; + +// Header class. +// +// This is the recommended file header representation. + +class FstHeader { + public: + enum { + HAS_ISYMBOLS = 0x1, // Has input symbol table. + HAS_OSYMBOLS = 0x2, // Has output symbol table. + IS_ALIGNED = 0x4, // Memory-aligned (where appropriate). + } Flags; + + FstHeader() : version_(0), flags_(0), properties_(0), start_(-1), + numstates_(0), numarcs_(0) {} + + const string &FstType() const { return fsttype_; } + + const string &ArcType() const { return arctype_; } + + int32 Version() const { return version_; } + + int32 GetFlags() const { return flags_; } + + uint64 Properties() const { return properties_; } + + int64 Start() const { return start_; } + + int64 NumStates() const { return numstates_; } + + int64 NumArcs() const { return numarcs_; } + + void SetFstType(const string &type) { fsttype_ = type; } + + void SetArcType(const string &type) { arctype_ = type; } + + void SetVersion(int32 version) { version_ = version; } + + void SetFlags(int32 flags) { flags_ = flags; } + + void SetProperties(uint64 properties) { properties_ = properties; } + + void SetStart(int64 start) { start_ = start; } + + void SetNumStates(int64 numstates) { numstates_ = numstates; } + + void SetNumArcs(int64 numarcs) { numarcs_ = numarcs; } + + bool Read(std::istream &strm, const string &source, + bool rewind = false); + + bool Write(std::ostream &strm, const string &source) const; + + // Outputs a debug string for the FstHeader object. + string DebugString() const; + + private: + string fsttype_; // E.g. "vector". + string arctype_; // E.g. "standard". + int32 version_; // Type version number. + int32 flags_; // File format bits. + uint64 properties_; // FST property bits. + int64 start_; // Start state. + int64 numstates_; // # of states. + int64 numarcs_; // # of arcs. +}; + +// Specifies matcher action. +enum MatchType { + MATCH_INPUT = 1, // Match input label. + MATCH_OUTPUT = 2, // Match output label. + MATCH_BOTH = 3, // Match input or output label. + MATCH_NONE = 4, // Match nothing. + MATCH_UNKNOWN = 5 +}; // Otherwise, match type unknown. + +constexpr int kNoLabel = -1; // Not a valid label. +constexpr int kNoStateId = -1; // Not a valid state ID. + +// A generic FST, templated on the arc definition, with common-demoninator +// methods (use StateIterator and ArcIterator to iterate over its states and +// arcs). +template +class Fst { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + virtual ~Fst() {} + + // Initial state. + virtual StateId Start() const = 0; + + // State's final weight. + virtual Weight Final(StateId) const = 0; + + // State's arc count. + virtual size_t NumArcs(StateId) const = 0; + + // State's input epsilon count. + virtual size_t NumInputEpsilons(StateId) const = 0; + + // State's output epsilon count. + virtual size_t NumOutputEpsilons(StateId) const = 0; + + // Property bits. If test = false, return stored properties bits for mask + // (some possibly unknown); if test = true, return property bits for mask + // (computing o.w. unknown). + virtual uint64 Properties(uint64 mask, bool test) const = 0; + + // FST type name. + virtual const string &Type() const = 0; + + // Gets a copy of this Fst. The copying behaves as follows: + // + // (1) The copying is constant time if safe = false or if safe = true + // and is on an otherwise unaccessed FST. + // + // (2) If safe = true, the copy is thread-safe in that the original + // and copy can be safely accessed (but not necessarily mutated) by + // separate threads. For some FST types, 'Copy(true)' should only be + // called on an FST that has not otherwise been accessed. Behavior is + // otherwise undefined. + // + // (3) If a MutableFst is copied and then mutated, then the original is + // unmodified and vice versa (often by a copy-on-write on the initial + // mutation, which may not be constant time). + virtual Fst *Copy(bool safe = false) const = 0; + + // Reads an FST from an input stream; returns nullptr on error. + static Fst *Read(std::istream &strm, const FstReadOptions &opts) { + FstReadOptions ropts(opts); + FstHeader hdr; + if (ropts.header) { + hdr = *opts.header; + } else { + if (!hdr.Read(strm, opts.source)) return nullptr; + ropts.header = &hdr; + } + const auto &fst_type = hdr.FstType(); + const auto reader = FstRegister::GetRegister()->GetReader(fst_type); + if (!reader) { + LOG(ERROR) << "Fst::Read: Unknown FST type " << fst_type + << " (arc type = " << Arc::Type() << "): " << ropts.source; + return nullptr; + } + return reader(strm, ropts); + } + + // Reads an FST from a file; returns nullptr on error. An empty filename + // results in reading from standard input. + static Fst *Read(const string &filename) { + if (!filename.empty()) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "Fst::Read: Can't open file: " << filename; + return nullptr; + } + return Read(strm, FstReadOptions(filename)); + } else { + return Read(std::cin, FstReadOptions("standard input")); + } + } + + // Writes an FST to an output stream; returns false on error. + virtual bool Write(std::ostream &strm, const FstWriteOptions &opts) const { + LOG(ERROR) << "Fst::Write: No write stream method for " << Type() + << " FST type"; + return false; + } + + // Writes an FST to a file; returns false on error; an empty filename + // results in writing to standard output. + virtual bool Write(const string &filename) const { + LOG(ERROR) << "Fst::Write: No write filename method for " << Type() + << " FST type"; + return false; + } + + // Returns input label symbol table; return nullptr if not specified. + virtual const SymbolTable *InputSymbols() const = 0; + + // Return output label symbol table; return nullptr if not specified. + virtual const SymbolTable *OutputSymbols() const = 0; + + // For generic state iterator construction (not normally called directly by + // users). Does not copy the FST. + virtual void InitStateIterator(StateIteratorData *data) const = 0; + + // For generic arc iterator construction (not normally called directly by + // users). Does not copy the FST. + virtual void InitArcIterator(StateId s, ArcIteratorData *data) const = 0; + + // For generic matcher construction (not normally called directly by users). + // Does not copy the FST. + virtual MatcherBase *InitMatcher(MatchType match_type) const; + + protected: + bool WriteFile(const string &filename) const { + if (!filename.empty()) { + std::ofstream strm(filename, + std::ios_base::out | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "Fst::Write: Can't open file: " << filename; + return false; + } + bool val = Write(strm, FstWriteOptions(filename)); + if (!val) LOG(ERROR) << "Fst::Write failed: " << filename; + return val; + } else { + return Write(std::cout, FstWriteOptions("standard output")); + } + } +}; + +// A useful alias when using StdArc. +using StdFst = Fst; + +// State and arc iterator definitions. +// +// State iterator interface templated on the Arc definition; used for +// StateIterator specializations returned by the InitStateIterator FST method. +template +class StateIteratorBase { + public: + using StateId = typename Arc::StateId; + + virtual ~StateIteratorBase() {} + + // End of iterator? + virtual bool Done() const = 0; + // Returns current state (when !Done()). + virtual StateId Value() const = 0; + // Advances to next state (when !Done()). + virtual void Next() = 0; + // Resets to initial condition. + virtual void Reset() = 0; +}; + +// StateIterator initialization data. + +template +struct StateIteratorData { + using StateId = typename Arc::StateId; + + // Specialized iterator if non-zero. + StateIteratorBase *base; + // Otherwise, the total number of states. + StateId nstates; + + StateIteratorData() : base(nullptr), nstates(0) {} + + StateIteratorData(const StateIteratorData &) = delete; + StateIteratorData &operator=(const StateIteratorData &) = delete; +}; + +// Generic state iterator, templated on the FST definition (a wrapper +// around a pointer to a specific one). Here is a typical use: +// +// for (StateIterator siter(fst); +// !siter.Done(); +// siter.Next()) { +// StateId s = siter.Value(); +// ... +// } +// There is no copying of the FST. +template +class StateIterator { + public: + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + + explicit StateIterator(const FST &fst) : s_(0) { + fst.InitStateIterator(&data_); + } + + ~StateIterator() { delete data_.base; } + + bool Done() const { + return data_.base ? data_.base->Done() : s_ >= data_.nstates; + } + + StateId Value() const { return data_.base ? data_.base->Value() : s_; } + + void Next() { + if (data_.base) { + data_.base->Next(); + } else { + ++s_; + } + } + + void Reset() { + if (data_.base) { + data_.base->Reset(); + } else { + s_ = 0; + } + } + + private: + StateIteratorData data_; + StateId s_; +}; + +// Flags to control the behavior on an arc iterator. +static constexpr uint32 kArcILabelValue = + 0x0001; // Value() gives valid ilabel. +static constexpr uint32 kArcOLabelValue = 0x0002; // " " " olabel. +static constexpr uint32 kArcWeightValue = 0x0004; // " " " weight. +static constexpr uint32 kArcNextStateValue = + 0x0008; // " " " nextstate. +static constexpr uint32 kArcNoCache = 0x0010; // No need to cache arcs. + +static constexpr uint32 kArcValueFlags = + kArcILabelValue | kArcOLabelValue | kArcWeightValue | kArcNextStateValue; + +static constexpr uint32 kArcFlags = kArcValueFlags | kArcNoCache; + +// Arc iterator interface, templated on the arc definition; used for arc +// iterator specializations that are returned by the InitArcIterator FST method. +template +class ArcIteratorBase { + public: + using StateId = typename Arc::StateId; + + virtual ~ArcIteratorBase() {} + + // End of iterator? + virtual bool Done() const = 0; + // Returns current arc (when !Done()). + virtual const Arc &Value() const = 0; + // Advances to next arc (when !Done()). + virtual void Next() = 0; + // Returns current position. + virtual size_t Position() const = 0; + // Returns to initial condition. + virtual void Reset() = 0; + // Advances to arbitrary arc by position. + virtual void Seek(size_t) = 0; + // Returns current behavorial flags + virtual uint32 Flags() const = 0; + // Sets behavorial flags. + virtual void SetFlags(uint32, uint32) = 0; +}; + +// ArcIterator initialization data. +template +struct ArcIteratorData { + ArcIteratorData() + : base(nullptr), arcs(nullptr), narcs(0), ref_count(nullptr) {} + + ArcIteratorData(const ArcIteratorData &) = delete; + + ArcIteratorData &operator=(const ArcIteratorData &) = delete; + + ArcIteratorBase *base; // Specialized iterator if non-zero. + const Arc *arcs; // O.w. arcs pointer + size_t narcs; // ... and arc count. + int *ref_count; // ... and reference count if non-zero. +}; + +// Generic arc iterator, templated on the FST definition (a wrapper around a +// pointer to a specific one). Here is a typical use: +// +// for (ArcIterator aiter(fst, s); +// !aiter.Done(); +// aiter.Next()) { +// StdArc &arc = aiter.Value(); +// ... +// } +// There is no copying of the FST. +template +class ArcIterator { + public: + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + + ArcIterator(const FST &fst, StateId s) : i_(0) { + fst.InitArcIterator(s, &data_); + } + + explicit ArcIterator(const ArcIteratorData &data) : data_(data), i_(0) { + if (data_.ref_count) ++(*data_.ref_count); + } + + ~ArcIterator() { + if (data_.base) { + delete data_.base; + } else if (data_.ref_count) { + --(*data_.ref_count); + } + } + + bool Done() const { + return data_.base ? data_.base->Done() : i_ >= data_.narcs; + } + + const Arc &Value() const { + return data_.base ? data_.base->Value() : data_.arcs[i_]; + } + + void Next() { + if (data_.base) { + data_.base->Next(); + } else { + ++i_; + } + } + + void Reset() { + if (data_.base) { + data_.base->Reset(); + } else { + i_ = 0; + } + } + + void Seek(size_t a) { + if (data_.base) { + data_.base->Seek(a); + } else { + i_ = a; + } + } + + size_t Position() const { return data_.base ? data_.base->Position() : i_; } + + uint32 Flags() const { + if (data_.base) { + return data_.base->Flags(); + } else { + return kArcValueFlags; + } + } + + void SetFlags(uint32 flags, uint32 mask) { + if (data_.base) data_.base->SetFlags(flags, mask); + } + + private: + ArcIteratorData data_; + size_t i_; +}; + +} // namespace fst + +// ArcIterator placement operator new and destroy function; new needs to be in +// the global namespace. + +template +void *operator new(size_t size, + fst::MemoryPool> *pool) { + return pool->Allocate(); +} + +namespace fst { + +template +void Destroy(ArcIterator *aiter, MemoryPool> *pool) { + if (aiter) { + aiter->~ArcIterator(); + pool->Free(aiter); + } +} + +// Matcher definitions. + +template +MatcherBase *Fst::InitMatcher(MatchType match_type) const { + return nullptr; // One should just use the default matcher. +} + +// FST accessors, useful in high-performance applications. + +namespace internal { + +// General case, requires non-abstract, 'final' methods. Use for inlining. + +template +inline typename F::Arc::Weight Final(const F &fst, typename F::Arc::StateId s) { + return fst.F::Final(s); +} + +template +inline ssize_t NumArcs(const F &fst, typename F::Arc::StateId s) { + return fst.F::NumArcs(s); +} + +template +inline ssize_t NumInputEpsilons(const F &fst, typename F::Arc::StateId s) { + return fst.F::NumInputEpsilons(s); +} + +template +inline ssize_t NumOutputEpsilons(const F &fst, typename F::Arc::StateId s) { + return fst.F::NumOutputEpsilons(s); +} + +// Fst case, abstract methods. + +template +inline typename Arc::Weight Final(const Fst &fst, + typename Arc::StateId s) { + return fst.Final(s); +} + +template +inline size_t NumArcs(const Fst &fst, typename Arc::StateId s) { + return fst.NumArcs(s); +} + +template +inline size_t NumInputEpsilons(const Fst &fst, typename Arc::StateId s) { + return fst.NumInputEpsilons(s); +} + +template +inline size_t NumOutputEpsilons(const Fst &fst, typename Arc::StateId s) { + return fst.NumOutputEpsilons(s); +} + +// FST implementation base. +// +// This is the recommended FST implementation base class. It will handle +// reference counts, property bits, type information and symbols. +// +// Users are discouraged, but not prohibited, from subclassing this outside the +// FST library. +template +class FstImpl { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + FstImpl() : properties_(0), type_("null") {} + + FstImpl(const FstImpl &impl) + : properties_(impl.properties_), + type_(impl.type_), + isymbols_(impl.isymbols_ ? impl.isymbols_->Copy() : nullptr), + osymbols_(impl.osymbols_ ? impl.osymbols_->Copy() : nullptr) {} + + FstImpl(FstImpl &&impl) noexcept; + + virtual ~FstImpl() {} + + FstImpl &operator=(const FstImpl &impl) { + properties_ = impl.properties_; + type_ = impl.type_; + isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr; + osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr; + return *this; + } + + FstImpl &operator=(FstImpl &&impl) noexcept; + + const string &Type() const { return type_; } + + void SetType(const string &type) { type_ = type; } + + virtual uint64 Properties() const { return properties_; } + + virtual uint64 Properties(uint64 mask) const { return properties_ & mask; } + + void SetProperties(uint64 props) { + properties_ &= kError; // kError can't be cleared. + properties_ |= props; + } + + void SetProperties(uint64 props, uint64 mask) { + properties_ &= ~mask | kError; // kError can't be cleared. + properties_ |= props & mask; + } + + // Allows (only) setting error bit on const FST implementations. + void SetProperties(uint64 props, uint64 mask) const { + if (mask != kError) { + FSTERROR() << "FstImpl::SetProperties() const: Can only set kError"; + } + properties_ |= kError; + } + + const SymbolTable *InputSymbols() const { return isymbols_.get(); } + + const SymbolTable *OutputSymbols() const { return osymbols_.get(); } + + SymbolTable *InputSymbols() { return isymbols_.get(); } + + SymbolTable *OutputSymbols() { return osymbols_.get(); } + + void SetInputSymbols(const SymbolTable *isyms) { + isymbols_.reset(isyms ? isyms->Copy() : nullptr); + } + + void SetOutputSymbols(const SymbolTable *osyms) { + osymbols_.reset(osyms ? osyms->Copy() : nullptr); + } + + // Reads header and symbols from input stream, initializes FST, and returns + // the header. If opts.header is non-null, skips reading and uses the option + // value instead. If opts.[io]symbols is non-null, reads in (if present), but + // uses the option value. + bool ReadHeader(std::istream &strm, const FstReadOptions &opts, + int min_version, FstHeader *hdr); + + // Writes header and symbols to output stream. If opts.header is false, skips + // writing header. If opts.[io]symbols is false, skips writing those symbols. + // This method is needed for implementations that implement Write methods. + void WriteHeader(std::ostream &strm, const FstWriteOptions &opts, + int version, FstHeader *hdr) const { + if (opts.write_header) { + hdr->SetFstType(type_); + hdr->SetArcType(Arc::Type()); + hdr->SetVersion(version); + hdr->SetProperties(properties_); + int32 file_flags = 0; + if (isymbols_ && opts.write_isymbols) { + file_flags |= FstHeader::HAS_ISYMBOLS; + } + if (osymbols_ && opts.write_osymbols) { + file_flags |= FstHeader::HAS_OSYMBOLS; + } + if (opts.align) file_flags |= FstHeader::IS_ALIGNED; + hdr->SetFlags(file_flags); + hdr->Write(strm, opts.source); + } + if (isymbols_ && opts.write_isymbols) isymbols_->Write(strm); + if (osymbols_ && opts.write_osymbols) osymbols_->Write(strm); + } + + // Writes out header and symbols to output stream. If opts.header is false, + // skips writing header. If opts.[io]symbols is false, skips writing those + // symbols. `type` is the FST type being written. This method is used in the + // cross-type serialization methods Fst::WriteFst. + static void WriteFstHeader(const Fst &fst, std::ostream &strm, + const FstWriteOptions &opts, int version, + const string &type, uint64 properties, + FstHeader *hdr) { + if (opts.write_header) { + hdr->SetFstType(type); + hdr->SetArcType(Arc::Type()); + hdr->SetVersion(version); + hdr->SetProperties(properties); + int32 file_flags = 0; + if (fst.InputSymbols() && opts.write_isymbols) { + file_flags |= FstHeader::HAS_ISYMBOLS; + } + if (fst.OutputSymbols() && opts.write_osymbols) { + file_flags |= FstHeader::HAS_OSYMBOLS; + } + if (opts.align) file_flags |= FstHeader::IS_ALIGNED; + hdr->SetFlags(file_flags); + hdr->Write(strm, opts.source); + } + if (fst.InputSymbols() && opts.write_isymbols) { + fst.InputSymbols()->Write(strm); + } + if (fst.OutputSymbols() && opts.write_osymbols) { + fst.OutputSymbols()->Write(strm); + } + } + + // In serialization routines where the header cannot be written until after + // the machine has been serialized, this routine can be called to seek to the + // beginning of the file an rewrite the header with updated fields. It + // repositions the file pointer back at the end of the file. Returns true on + // success, false on failure. + static bool UpdateFstHeader(const Fst &fst, std::ostream &strm, + const FstWriteOptions &opts, int version, + const string &type, uint64 properties, + FstHeader *hdr, size_t header_offset) { + strm.seekp(header_offset); + if (!strm) { + LOG(ERROR) << "Fst::UpdateFstHeader: Write failed: " << opts.source; + return false; + } + WriteFstHeader(fst, strm, opts, version, type, properties, hdr); + if (!strm) { + LOG(ERROR) << "Fst::UpdateFstHeader: Write failed: " << opts.source; + return false; + } + strm.seekp(0, std::ios_base::end); + if (!strm) { + LOG(ERROR) << "Fst::UpdateFstHeader: Write failed: " << opts.source; + return false; + } + return true; + } + + protected: + mutable uint64 properties_; // Property bits. + + private: + string type_; // Unique name of FST class. + std::unique_ptr isymbols_; + std::unique_ptr osymbols_; +}; + +template +inline FstImpl::FstImpl(FstImpl &&) noexcept = default; + +template +inline FstImpl &FstImpl::operator=( + FstImpl &&) noexcept = default; + +template +bool FstImpl::ReadHeader(std::istream &strm, const FstReadOptions &opts, + int min_version, FstHeader *hdr) { + if (opts.header) { + *hdr = *opts.header; + } else if (!hdr->Read(strm, opts.source)) { + return false; + } + if (FLAGS_v >= 2) { + LOG(INFO) << "FstImpl::ReadHeader: source: " << opts.source + << ", fst_type: " << hdr->FstType() + << ", arc_type: " << Arc::Type() + << ", version: " << hdr->Version() + << ", flags: " << hdr->GetFlags(); + } + if (hdr->FstType() != type_) { + LOG(ERROR) << "FstImpl::ReadHeader: FST not of type " << type_ + << ": " << opts.source; + return false; + } + if (hdr->ArcType() != Arc::Type()) { + LOG(ERROR) << "FstImpl::ReadHeader: Arc not of type " << Arc::Type() + << ": " << opts.source; + return false; + } + if (hdr->Version() < min_version) { + LOG(ERROR) << "FstImpl::ReadHeader: Obsolete " << type_ + << " FST version: " << opts.source; + return false; + } + properties_ = hdr->Properties(); + if (hdr->GetFlags() & FstHeader::HAS_ISYMBOLS) { + isymbols_.reset(SymbolTable::Read(strm, opts.source)); + } + // Deletes input symbol table. + if (!opts.read_isymbols) SetInputSymbols(nullptr); + if (hdr->GetFlags() & FstHeader::HAS_OSYMBOLS) { + osymbols_.reset(SymbolTable::Read(strm, opts.source)); + } + // Deletes output symbol table. + if (!opts.read_osymbols) SetOutputSymbols(nullptr); + if (opts.isymbols) { + isymbols_.reset(opts.isymbols->Copy()); + } + if (opts.osymbols) { + osymbols_.reset(opts.osymbols->Copy()); + } + return true; +} + +} // namespace internal + +template +uint64 TestProperties(const Fst &fst, uint64 mask, uint64 *known); + +// This is a helper class template useful for attaching an FST interface to +// its implementation, handling reference counting. +template > +class ImplToFst : public FST { + public: + using Arc = typename Impl::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + StateId Start() const override { return impl_->Start(); } + + Weight Final(StateId s) const override { return impl_->Final(s); } + + size_t NumArcs(StateId s) const override { return impl_->NumArcs(s); } + + size_t NumInputEpsilons(StateId s) const override { + return impl_->NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) const override { + return impl_->NumOutputEpsilons(s); + } + + uint64 Properties(uint64 mask, bool test) const override { + if (test) { + uint64 knownprops, testprops = TestProperties(*this, mask, &knownprops); + impl_->SetProperties(testprops, knownprops); + return testprops & mask; + } else { + return impl_->Properties(mask); + } + } + + const string &Type() const override { return impl_->Type(); } + + const SymbolTable *InputSymbols() const override { + return impl_->InputSymbols(); + } + + const SymbolTable *OutputSymbols() const override { + return impl_->OutputSymbols(); + } + + protected: + explicit ImplToFst(std::shared_ptr impl) : impl_(std::move(impl)) {} + + // This constructor presumes there is a copy constructor for the + // implementation. + ImplToFst(const ImplToFst &fst, bool safe) { + if (safe) { + impl_ = std::make_shared(*(fst.impl_)); + } else { + impl_ = fst.impl_; + } + } + + ImplToFst() = delete; + + ImplToFst(const ImplToFst &fst) : impl_(fst.impl_) {} + + ImplToFst(ImplToFst &&fst) noexcept + : impl_(std::move(fst.impl_)) { + fst.impl_ = std::make_shared(); + } + + ImplToFst &operator=(const ImplToFst &fst) { + impl_ = fst.impl_; + return *this; + } + + ImplToFst &operator=(ImplToFst &&fst) noexcept { + if (this != &fst) { + impl_ = std::move(fst.impl_); + fst.impl_ = std::make_shared(); + } + return *this; + } + + // Returns raw pointers to the shared object. + const Impl *GetImpl() const { return impl_.get(); } + + Impl *GetMutableImpl() const { return impl_.get(); } + + // Returns a ref-counted smart poiner to the implementation. + std::shared_ptr GetSharedImpl() const { return impl_; } + + bool Unique() const { return impl_.unique(); } + + void SetImpl(std::shared_ptr impl) { impl_ = std::move(impl); } + + private: + template + friend void Cast(const IFST &ifst, OFST *ofst); + + std::shared_ptr impl_; +}; + +// Converts FSTs by casting their implementations, where this makes sense +// (which excludes implementations with weight-dependent virtual methods). +// Must be a friend of the FST classes involved (currently the concrete FSTs: +// ConstFst, CompactFst, and VectorFst). This can only be safely used for arc +// types that have identical storage characteristics. As with an FST +// copy constructor and Copy() method, this is a constant time operation +// (but subject to copy-on-write if it is a MutableFst and modified). +template +void Cast(const IFST &ifst, OFST *ofst) { + using OImpl = typename OFST::Impl; + ofst->impl_ = std::shared_ptr(ifst.impl_, + reinterpret_cast(ifst.impl_.get())); +} + +// FST serialization. + +template +string FstToString(const Fst &fst, + const FstWriteOptions &options = + FstWriteOptions("FstToString")) { + std::ostringstream ostrm; + fst.Write(ostrm, options); + return ostrm.str(); +} + +template +void FstToString(const Fst &fst, string *result) { + *result = FstToString(fst); +} + +template +void FstToString(const Fst &fst, string *result, + const FstWriteOptions &options) { + *result = FstToString(fst, options); +} + +template +Fst *StringToFst(const string &s) { + std::istringstream istrm(s); + return Fst::Read(istrm, FstReadOptions("StringToFst")); +} + +} // namespace fst + +#endif // FST_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/fstlib.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/fstlib.h new file mode 100644 index 0000000..e8b1c3a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/fstlib.h @@ -0,0 +1,130 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// This is a library for constructing, combining, optimizing, and searching +// "weighted finite-state transducers" (FSTs). Weighted finite-state transducers +// are automata where each transition has an input label, an output label, and a +// weight. The more familiar finite-state acceptor is represented as a +// transducer with each transition's input and output the same. Finite-state +// acceptors are used to represent sets of strings (specifically, "regular" or +// "rational sets"); finite-state transducers are used to represent binary +// relations between pairs of strings (specifically, "rational transductions"). +// The weights can be used to represent the cost of taking a particular +// transition. +// +// In this library, transducers are templated on the Arc (transition) +// definition, which allows changing the label, weight, and state ID sets. +// Labels and state IDs are restricted to signed integral types but the weight +// can be an arbitrary type whose members satisfy certain algebraic ("semiring") +// properties. +// +// This convenience file includes all other FST header files. + +#ifndef FST_FSTLIB_H_ +#define FST_FSTLIB_H_ + + +// Abstract FST classes. +#include +#include +#include + +// Concrete FST classes. +#include +#include +#include +#include + +// FST algorithms and delayed FST classes. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Weights. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Auxiliary classes for composition. +#include +#include +#include +#include +#include +#include + +// Data structures. +#include +#include +#include +#include + +// Miscellaneous. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // FST_FSTLIB_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/generic-register.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/generic-register.h new file mode 100644 index 0000000..ea6b8fe --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/generic-register.h @@ -0,0 +1,126 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_GENERIC_REGISTER_H_ +#define FST_GENERIC_REGISTER_H_ + +#include +#ifndef FST_NO_DYNAMIC_LINKING +#include +#endif +#include +#include + +#include +#include + +// Generic class representing a globally-stored correspondence between +// objects of KeyType and EntryType. +// +// KeyType must: +// +// * be such as can be stored as a key in a std::map<>. +// * be concatenable with a const char* with the + operator +// (or you must subclass and redefine LoadEntryFromSharedObject) +// +// EntryType must be default constructible. +// +// The third template parameter should be the type of a subclass of this class +// (think CRTP). This is to allow GetRegister() to instantiate and return an +// object of the appropriate type. + +namespace fst { + +template +class GenericRegister { + public: + using Key = KeyType; + using Entry = EntryType; + + static RegisterType *GetRegister() { + static auto reg = new RegisterType; + return reg; + } + + void SetEntry(const KeyType &key, const EntryType &entry) { + MutexLock l(®ister_lock_); + register_table_.insert(std::make_pair(key, entry)); + } + + EntryType GetEntry(const KeyType &key) const { + const auto *entry = LookupEntry(key); + if (entry) { + return *entry; + } else { + return LoadEntryFromSharedObject(key); + } + } + + virtual ~GenericRegister() {} + + protected: + // Override this if you want to be able to load missing definitions from + // shared object files. + virtual EntryType LoadEntryFromSharedObject(const KeyType &key) const { +#ifdef FST_NO_DYNAMIC_LINKING + return EntryType(); +#else + const auto so_filename = ConvertKeyToSoFilename(key); + void *handle = dlopen(so_filename.c_str(), RTLD_LAZY); + if (handle == nullptr) { + LOG(ERROR) << "GenericRegister::GetEntry: " << dlerror(); + return EntryType(); + } +#ifdef RUN_MODULE_INITIALIZERS + RUN_MODULE_INITIALIZERS(); +#endif + // We assume that the DSO constructs a static object in its global scope + // that does the registration. Thus we need only load it, not call any + // methods. + const auto *entry = this->LookupEntry(key); + if (entry == nullptr) { + LOG(ERROR) << "GenericRegister::GetEntry: " + << "lookup failed in shared object: " << so_filename; + return EntryType(); + } + return *entry; +#endif // FST_NO_DYNAMIC_LINKING + } + + // Override this to define how to turn a key into an SO filename. + virtual string ConvertKeyToSoFilename(const KeyType &key) const = 0; + + virtual const EntryType *LookupEntry(const KeyType &key) const { + MutexLock l(®ister_lock_); + const auto it = register_table_.find(key); + if (it != register_table_.end()) { + return &it->second; + } else { + return nullptr; + } + } + + private: + mutable Mutex register_lock_; + std::map register_table_; +}; + +// Generic register-er class capable of creating new register entries in the +// given RegisterType template parameter. This type must define types Key and +// Entry, and have appropriate static GetRegister() and instance SetEntry() +// functions. An easy way to accomplish this is to have RegisterType be the +// type of a subclass of GenericRegister. +template +class GenericRegisterer { + public: + using Key = typename RegisterType::Key; + using Entry = typename RegisterType::Entry; + + GenericRegisterer(Key key, Entry entry) { + RegisterType::GetRegister()->SetEntry(key, entry); + } +}; + +} // namespace fst + +#endif // FST_GENERIC_REGISTER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/heap.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/heap.h new file mode 100644 index 0000000..041a4bb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/heap.h @@ -0,0 +1,168 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Implementation of a heap as in STL, but allows tracking positions in heap +// using a key. The key can be used to do an in-place update of values in the +// heap. + +#ifndef FST_HEAP_H_ +#define FST_HEAP_H_ + +#include +#include + +#include +namespace fst { + +// A templated heap implementation that supports in-place update of values. +// +// The templated heap implementation is a little different from the STL +// priority_queue and the *_heap operations in STL. This heap supports +// indexing of values in the heap via an associated key. +// +// Each value is internally associated with a key which is returned to the +// calling functions on heap insert. This key can be used to later update +// the specific value in the heap. +// +// T: the element type of the hash. It can be POD, Data or a pointer to Data. +// Compare: comparison functor for determining min-heapness. +template +class Heap { + public: + using Value = T; + + static constexpr int kNoKey = -1; + + // Initializes with a specific comparator. + explicit Heap(Compare comp = Compare()) : comp_(comp), size_(0) {} + + // Inserts a value into the heap. + int Insert(const Value &value) { + if (size_ < values_.size()) { + values_[size_] = value; + pos_[key_[size_]] = size_; + } else { + values_.push_back(value); + pos_.push_back(size_); + key_.push_back(size_); + } + ++size_; + return Insert(value, size_ - 1); + } + + // Updates a value at position given by the key. The pos_ array is first + // indexed by the key. The position gives the position in the heap array. + // Once we have the position we can then use the standard heap operations + // to calculate the parent and child positions. + void Update(int key, const Value &value) { + const auto i = pos_[key]; + const bool is_better = comp_(value, values_[Parent(i)]); + values_[i] = value; + if (is_better) { + Insert(value, i); + } else { + Heapify(i); + } + } + + // Returns the least value. + Value Pop() { + Value top = values_.front(); + Swap(0, size_-1); + size_--; + Heapify(0); + return top; + } + + // Returns the least value w.r.t. the comparison function from the + // heap. + const Value &Top() const { return values_.front(); } + + // Returns the element for the given key. + const Value &Get(int key) const { return values_[pos_[key]]; } + + // Checks if the heap is empty. + bool Empty() const { return size_ == 0; } + + void Clear() { size_ = 0; } + + int Size() const { return size_; } + + void Reserve(int size) { + values_.reserve(size); + pos_.reserve(size); + key_.reserve(size); + } + + const Compare &GetCompare() const { return comp_; } + + private: + // The following private routines are used in a supportive role + // for managing the heap and keeping the heap properties. + + // Computes left child of parent. + static int Left(int i) { + return 2 * (i + 1) - 1; // 0 -> 1, 1 -> 3 + } + + // Computes right child of parent. + static int Right(int i) { + return 2 * (i + 1); // 0 -> 2, 1 -> 4 + } + + // Given a child computes parent. + static int Parent(int i) { + return (i - 1) / 2; // 0 -> 0, 1 -> 0, 2 -> 0, 3 -> 1, 4 -> 1, ... + } + + // Swaps a child and parent. Use to move element up/down tree. Note the use of + // a little trick here. When we swap we need to swap: + // + // - the value + // - the associated keys + // - the position of the value in the heap + void Swap(int j, int k) { + const auto tkey = key_[j]; + pos_[key_[j] = key_[k]] = j; + pos_[key_[k] = tkey] = k; + using std::swap; + swap(values_[j], values_[k]); + } + + // Heapifies the subtree rooted at index i. + void Heapify(int i) { + const auto l = Left(i); + const auto r = Right(i); + auto largest = (l < size_ && comp_(values_[l], values_[i])) ? l : i; + if (r < size_ && comp_(values_[r], values_[largest])) largest = r; + if (largest != i) { + Swap(i, largest); + Heapify(largest); + } + } + + // Inserts (updates) element at subtree rooted at index i. + int Insert(const Value &value, int i) { + int p; + while (i > 0 && !comp_(values_[p = Parent(i)], value)) { + Swap(i, p); + i = p; + } + return key_[i]; + } + + private: + const Compare comp_; + + std::vector pos_; + std::vector key_; + std::vector values_; + int size_; +}; + +template +constexpr int Heap::kNoKey; + +} // namespace fst + +#endif // FST_HEAP_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/icu.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/icu.h new file mode 100644 index 0000000..5459da2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/icu.h @@ -0,0 +1,129 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// This library implements an unrestricted Thompson/Pike UTF-8 parser and +// serializer. UTF-8 is a restricted subset of this byte stream encoding. For +// a description of the encoding details, see: +// +// http://en.wikipedia.org/wiki/UTF-8 + +#ifndef FST_ICU_H_ +#define FST_ICU_H_ + +#include +#include + +#include + +namespace fst { + +// Trivial function to copy bytestrings into vectors of labels, truncating +// if necessary. It is possible to use this sensibly with as little as 8 bits +// of Label precision. This returns `true` deterministically for compatibility. +template +bool ByteStringToLabels(const string &str, std::vector { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using ComposeFst::CreateBase; + using ComposeFst::CreateBase1; + using ComposeFst::Properties; + + IntersectFst(const Fst &fst1, const Fst &fst2, + const CacheOptions &opts = CacheOptions()) + : ComposeFst(CreateBase(fst1, fst2, opts)) { + const bool acceptors = + fst1.Properties(kAcceptor, true) && fst2.Properties(kAcceptor, true); + if (!acceptors) { + FSTERROR() << "IntersectFst: Input FSTs are not acceptors"; + GetMutableImpl()->SetProperties(kError); + } + } + + template + IntersectFst(const Fst &fst1, const Fst &fst2, + const IntersectFstOptions &opts) + : ComposeFst(CreateBase1(fst1, fst2, opts)) { + const bool acceptors = + fst1.Properties(kAcceptor, true) && fst2.Properties(kAcceptor, true); + if (!acceptors) { + FSTERROR() << "IntersectFst: input FSTs are not acceptors"; + GetMutableImpl()->SetProperties(kError); + } + } + + // See Fst<>::Copy() for doc. + IntersectFst(const IntersectFst &fst, bool safe = false) + : ComposeFst(fst, safe) {} + + // Get a copy of this IntersectFst. See Fst<>::Copy() for further doc. + IntersectFst *Copy(bool safe = false) const override { + return new IntersectFst(*this, safe); + } + + private: + using ImplToFst>::GetImpl; + using ImplToFst>::GetMutableImpl; +}; + +// Specialization for IntersectFst. +template +class StateIterator> : public StateIterator> { + public: + explicit StateIterator(const IntersectFst &fst) + : StateIterator>(fst) {} +}; + +// Specialization for IntersectFst. +template +class ArcIterator> : public ArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const IntersectFst &fst, StateId s) + : ArcIterator>(fst, s) {} +}; + +// Useful alias when using StdArc. +using StdIntersectFst = IntersectFst; + +// Computes the intersection (Hadamard product) of two FSAs. This version +// writes the intersection to an output MurableFst. Only strings that are in +// both automata are retained in the result. +// +// The two arguments must be acceptors. One of the arguments must be +// label-sorted. +// +// Complexity: same as Compose. +// +// Caveats: same as Compose. +template +void Intersect(const Fst &ifst1, const Fst &ifst2, + MutableFst *ofst, + const IntersectOptions &opts = IntersectOptions()) { + using M = Matcher>; + // In each case, we cache only the last state for fastest copy. + switch (opts.filter_type) { + case AUTO_FILTER: { + CacheOptions nopts; + nopts.gc_limit = 0; + *ofst = IntersectFst(ifst1, ifst2, nopts); + break; + } + case SEQUENCE_FILTER: { + IntersectFstOptions iopts; + iopts.gc_limit = 0; + *ofst = IntersectFst(ifst1, ifst2, iopts); + break; + } + case ALT_SEQUENCE_FILTER: { + IntersectFstOptions> iopts; + iopts.gc_limit = 0; + *ofst = IntersectFst(ifst1, ifst2, iopts); + break; + } + case MATCH_FILTER: { + IntersectFstOptions> iopts; + iopts.gc_limit = 0; + *ofst = IntersectFst(ifst1, ifst2, iopts); + break; + } + case NO_MATCH_FILTER: { + IntersectFstOptions> iopts; + iopts.gc_limit = 0; + *ofst = IntersectFst(ifst1, ifst2, iopts); + break; + } + case NULL_FILTER: { + IntersectFstOptions> iopts; + iopts.gc_limit = 0; + *ofst = IntersectFst(ifst1, ifst2, iopts); + break; + } + case TRIVIAL_FILTER: { + IntersectFstOptions> iopts; + iopts.gc_limit = 0; + *ofst = IntersectFst(ifst1, ifst2, iopts); + break; + } + } + if (opts.connect) Connect(ofst); +} + +} // namespace fst + +#endif // FST_INTERSECT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/interval-set.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/interval-set.h new file mode 100644 index 0000000..0942ea0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/interval-set.h @@ -0,0 +1,398 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to represent and operate on sets of intervals. + +#ifndef FST_INTERVAL_SET_H_ +#define FST_INTERVAL_SET_H_ + +#include +#include +#include + + +#include + + +namespace fst { + +// Half-open integral interval [a, b) of signed integers of type T. +template +struct IntInterval { + T begin; + T end; + + IntInterval() : begin(-1), end(-1) {} + + IntInterval(T begin, T end) : begin(begin), end(end) {} + + bool operator<(const IntInterval &i) const { + return begin < i.begin || (begin == i.begin && end > i.end); + } + + bool operator==(const IntInterval &i) const { + return begin == i.begin && end == i.end; + } + + bool operator!=(const IntInterval &i) const { + return begin != i.begin || end != i.end; + } + + std::istream &Read(std::istream &strm) { + T n; + ReadType(strm, &n); + begin = n; + ReadType(strm, &n); + end = n; + return strm; + } + + std::ostream &Write(std::ostream &strm) const { + T n = begin; + WriteType(strm, n); + n = end; + WriteType(strm, n); + return strm; + } +}; + +// Stores IntIntervals in a vector. In addition, keeps the count of points in +// all intervals. +template +class VectorIntervalStore { + public: + using Interval = IntInterval; + using Iterator = typename std::vector::const_iterator; + + VectorIntervalStore() : count_(-1) {} + + std::vector *MutableIntervals() { return &intervals_; } + + const Interval *Intervals() const { return intervals_.data(); } + + T Size() const { return intervals_.size(); } + + T Count() const { return count_; } + + void SetCount(T count) { count_ = count; } + + void Clear() { + intervals_.clear(); + count_ = 0; + } + + Iterator begin() const { return intervals_.begin(); } + + Iterator end() const { return intervals_.end(); } + + std::istream &Read(std::istream &strm) { + ReadType(strm, &intervals_); + return ReadType(strm, &count_); + } + + std::ostream &Write(std::ostream &strm) const { + WriteType(strm, intervals_); + return WriteType(strm, count_); + } + + private: + std::vector intervals_; + T count_; +}; + +// Stores and operates on a set of half-open integral intervals [a, b) +// of signed integers of type T. +template > +class IntervalSet { + public: + using Interval = IntInterval; + + template + explicit IntervalSet(A... args) : intervals_(args...) {} + + // Returns the interval set as a vector. + std::vector *MutableIntervals() { + return intervals_.MutableIntervals(); + } + + // Returns a pointer to an array of Size() elements. + const Interval *Intervals() const { return intervals_.Intervals(); } + + bool Empty() const { return Size() == 0; } + + T Size() const { return intervals_.Size(); } + + // Number of points in the intervals (undefined if not normalized). + T Count() const { return intervals_.Count(); } + + void Clear() { intervals_.Clear(); } + + // Adds an interval set to the set. The result may not be normalized. + void Union(const IntervalSet &iset) { + intervals_.MutableIntervals()->insert(intervals_.MutableIntervals()->end(), + iset.intervals_.begin(), + iset.intervals_.end()); + } + + // Requires intervals be normalized. + bool Member(T value) const { + const Interval interval(value, value); + auto lb = std::lower_bound(intervals_.begin(), intervals_.end(), interval); + if (lb == intervals_.begin()) return false; + return (--lb)->end > value; + } + + // Requires intervals be normalized. + bool operator==(const IntervalSet &iset) const { + return Size() == iset.Size() && + std::equal(intervals_.begin(), intervals_.end(), + iset.intervals_.begin()); + } + + // Requires intervals be normalized. + bool operator!=(const IntervalSet &iset) const { + return Size() != iset.Size() || + !std::equal(intervals_.begin(), intervals_.end(), + iset.intervals_.begin()); + } + + bool Singleton() const { + return Size() == 1 && + intervals_.begin()->begin + 1 == intervals_.begin()->end; + } + + // Sorts, collapses overlapping and adjacent interals, and sets count. + void Normalize(); + + // Intersects an interval set with the set. Requires intervals be normalized. + // The result is normalized. + void Intersect(const IntervalSet &iset, + IntervalSet *oset) const; + + // Complements the set w.r.t [0, maxval). Requires intervals be normalized. + // The result is normalized. + void Complement(T maxval, IntervalSet *oset) const; + + // Subtract an interval set from the set. Requires intervals be normalized. + // The result is normalized. + void Difference(const IntervalSet &iset, + IntervalSet *oset) const; + + // Determines if an interval set overlaps with the set. Requires intervals be + // normalized. + bool Overlaps(const IntervalSet &iset) const; + + // Determines if an interval set overlaps with the set but neither is + // contained in the other. Requires intervals be normalized. + bool StrictlyOverlaps(const IntervalSet &iset) const; + + // Determines if an interval set is contained within the set. Requires + // intervals be normalized. + bool Contains(const IntervalSet &iset) const; + + std::istream &Read(std::istream &strm) { return intervals_.Read(strm); } + + std::ostream &Write(std::ostream &strm) const { + return intervals_.Write(strm); + } + + typename Store::Iterator begin() const { return intervals_.begin(); } + + typename Store::Iterator end() const { return intervals_.end(); } + + private: + Store intervals_; +}; + +// Sorts, collapses overlapping and adjacent intervals, and sets count. +template +void IntervalSet::Normalize() { + auto &intervals = *intervals_.MutableIntervals(); + std::sort(intervals.begin(), intervals.end()); + T count = 0; + T size = 0; + for (T i = 0; i < intervals.size(); ++i) { + auto &inti = intervals[i]; + if (inti.begin == inti.end) continue; + for (T j = i + 1; j < intervals.size(); ++j) { + auto &intj = intervals[j]; + if (intj.begin > inti.end) break; + if (intj.end > inti.end) inti.end = intj.end; + ++i; + } + count += inti.end - inti.begin; + intervals[size++] = inti; + } + intervals.resize(size); + intervals_.SetCount(count); +} + +// Intersects an interval set with the set. Requires intervals be normalized. +// The result is normalized. +template +void IntervalSet::Intersect(const IntervalSet &iset, + IntervalSet *oset) const { + auto *ointervals = oset->MutableIntervals(); + auto it1 = intervals_.begin(); + auto it2 = iset.intervals_.begin(); + ointervals->clear(); + T count = 0; + while (it1 != intervals_.end() && it2 != iset.intervals_.end()) { + if (it1->end <= it2->begin) { + ++it1; + } else if (it2->end <= it1->begin) { + ++it2; + } else { + ointervals->emplace_back(std::max(it1->begin, it2->begin), + std::min(it1->end, it2->end)); + count += ointervals->back().end - ointervals->back().begin; + if (it1->end < it2->end) { + ++it1; + } else { + ++it2; + } + } + } + oset->intervals_.SetCount(count); +} + +// Complements the set w.r.t [0, maxval). Requires intervals be normalized. +// The result is normalized. +template +void IntervalSet::Complement(T maxval, + IntervalSet *oset) const { + auto *ointervals = oset->MutableIntervals(); + ointervals->clear(); + T count = 0; + Interval interval; + interval.begin = 0; + for (auto it = intervals_.begin(); it != intervals_.end(); ++it) { + interval.end = std::min(it->begin, maxval); + if ((interval.begin) < (interval.end)) { + ointervals->push_back(interval); + count += interval.end - interval.begin; + } + interval.begin = it->end; + } + interval.end = maxval; + if ((interval.begin) < (interval.end)) { + ointervals->push_back(interval); + count += interval.end - interval.begin; + } + oset->intervals_.SetCount(count); +} + +// Subtract an interval set from the set. Requires intervals be normalized. +// The result is normalized. +template +void IntervalSet::Difference(const IntervalSet &iset, + IntervalSet *oset) const { + if (Empty()) { + oset->MutableIntervals()->clear(); + oset->intervals_.SetCount(0); + } else { + IntervalSet cset; + iset.Complement(intervals_.Intervals()[intervals_.Size() - 1].end, &cset); + Intersect(cset, oset); + } +} + +// Determines if an interval set overlaps with the set. Requires intervals be +// normalized. +template +bool IntervalSet::Overlaps(const IntervalSet &iset) const { + auto it1 = intervals_.begin(); + auto it2 = iset.intervals_.begin(); + while (it1 != intervals_.end() && it2 != iset.intervals_.end()) { + if (it1->end <= it2->begin) { + ++it1; + } else if (it2->end <= it1->begin) { + ++it2; + } else { + return true; + } + } + return false; +} + +// Determines if an interval set overlaps with the set but neither is contained +// in the other. Requires intervals be normalized. +template +bool IntervalSet::StrictlyOverlaps( + const IntervalSet &iset) const { + auto it1 = intervals_.begin(); + auto it2 = iset.intervals_.begin(); + bool only1 = false; // Point in intervals_ but not intervals. + bool only2 = false; // Point in intervals but not intervals_. + bool overlap = false; // Point in both intervals_ and intervals. + while (it1 != intervals_.end() && it2 != iset.intervals_.end()) { + if (it1->end <= it2->begin) { // no overlap - it1 first + only1 = true; + ++it1; + } else if (it2->end <= it1->begin) { // no overlap - it2 first + only2 = true; + ++it2; + } else if (it2->begin == it1->begin && it2->end == it1->end) { // equals + overlap = true; + ++it1; + ++it2; + } else if (it2->begin <= it1->begin && it2->end >= it1->end) { // 1 c 2 + only2 = true; + overlap = true; + ++it1; + } else if (it1->begin <= it2->begin && it1->end >= it2->end) { // 2 c 1 + only1 = true; + overlap = true; + ++it2; + } else { // Strict overlap. + only1 = true; + only2 = true; + overlap = true; + } + if (only1 == true && only2 == true && overlap == true) return true; + } + if (it1 != intervals_.end()) only1 = true; + if (it2 != iset.intervals_.end()) only2 = true; + return only1 == true && only2 == true && overlap == true; +} + +// Determines if an interval set is contained within the set. Requires intervals +// be normalized. +template +bool IntervalSet::Contains(const IntervalSet &iset) const { + if (iset.Count() > Count()) return false; + auto it1 = intervals_.begin(); + auto it2 = iset.intervals_.begin(); + while (it1 != intervals_.end() && it2 != iset.intervals_.end()) { + if ((it1->end) <= (it2->begin)) { // No overlap; it1 first. + ++it1; + } else if ((it2->begin) < (it1->begin) || + (it2->end) > (it1->end)) { // No C. + return false; + } else if (it2->end == it1->end) { + ++it1; + ++it2; + } else { + ++it2; + } + } + return it2 == iset.intervals_.end(); +} + +template +std::ostream &operator<<(std::ostream &strm, const IntervalSet &s) { + strm << "{"; + for (T i = 0; i < s.Size(); ++i) { + if (i > 0) { + strm << ","; + } + const auto &interval = s.Intervals()[i]; + strm << "[" << interval.begin << "," << interval.end << ")"; + } + strm << "}"; + return strm; +} + +} // namespace fst + +#endif // FST_INTERVAL_SET_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/invert.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/invert.h new file mode 100644 index 0000000..bd243c6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/invert.h @@ -0,0 +1,139 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to invert an FST. + +#ifndef FST_INVERT_H_ +#define FST_INVERT_H_ + +#include +#include + + +namespace fst { + +// Mapper to implement inversion of an arc. +template +struct InvertMapper { + using FromArc = A; + using ToArc = A; + + InvertMapper() {} + + ToArc operator()(const FromArc &arc) const { + return ToArc(arc.olabel, arc.ilabel, arc.weight, arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { + return MAP_NO_SUPERFINAL; + } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_CLEAR_SYMBOLS; + } + + uint64 Properties(uint64 props) const { + return InvertProperties(props); + } +}; + +// Inverts the transduction corresponding to an FST by exchanging the +// FST's input and output labels. +// +// Complexity: +// +// Time: O(V + E) +// Space: O(1) +// +// where V is the number of states and E is the number of arcs. +template +inline void Invert(const Fst &ifst, MutableFst *ofst) { + std::unique_ptr input( + ifst.InputSymbols() ? ifst.InputSymbols()->Copy() : nullptr); + std::unique_ptr output( + ifst.OutputSymbols() ? ifst.OutputSymbols()->Copy() : nullptr); + ArcMap(ifst, ofst, InvertMapper()); + ofst->SetInputSymbols(output.get()); + ofst->SetOutputSymbols(input.get()); +} + +// Destructive variant of the above. +template +inline void Invert(MutableFst *fst) { + std::unique_ptr input( + fst->InputSymbols() ? fst->InputSymbols()->Copy() : nullptr); + std::unique_ptr output( + fst->OutputSymbols() ? fst->OutputSymbols()->Copy() : nullptr); + ArcMap(fst, InvertMapper()); + fst->SetInputSymbols(output.get()); + fst->SetOutputSymbols(input.get()); +} + +// Inverts the transduction corresponding to an FST by exchanging the +// FST's input and output labels. This version is a delayed FST. +// +// Complexity: +// +// Time: O(v + e) +// Space: O(1) +// +// where v is the number of states visited and e is the number of arcs visited. +// Constant time and to visit an input state or arc is assumed and exclusive of +// caching. +template +class InvertFst : public ArcMapFst> { + public: + using Arc = A; + + using Mapper = InvertMapper; + using Impl = internal::ArcMapFstImpl>; + + explicit InvertFst(const Fst &fst) + : ArcMapFst(fst, Mapper()) { + GetMutableImpl()->SetOutputSymbols(fst.InputSymbols()); + GetMutableImpl()->SetInputSymbols(fst.OutputSymbols()); + } + + // See Fst<>::Copy() for doc. + InvertFst(const InvertFst &fst, bool safe = false) + : ArcMapFst(fst, safe) {} + + // Get a copy of this InvertFst. See Fst<>::Copy() for further doc. + InvertFst *Copy(bool safe = false) const override { + return new InvertFst(*this, safe); + } + + private: + using ImplToFst::GetMutableImpl; +}; + +// Specialization for InvertFst. +template +class StateIterator> + : public StateIterator>> { + public: + explicit StateIterator(const InvertFst &fst) + : StateIterator>>(fst) {} +}; + +// Specialization for InvertFst. +template +class ArcIterator> + : public ArcIterator>> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const InvertFst &fst, StateId s) + : ArcIterator>>(fst, s) {} +}; + +// Useful alias when using StdArc. +using StdInvertFst = InvertFst; + +} // namespace fst + +#endif // FST_INVERT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/isomorphic.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/isomorphic.h new file mode 100644 index 0000000..b100b0a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/isomorphic.h @@ -0,0 +1,183 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function to test two FSTs are isomorphic, i.e., they are equal up to a state +// and arc re-ordering. FSTs should be deterministic when viewed as +// unweighted automata. + +#ifndef FST_ISOMORPHIC_H_ +#define FST_ISOMORPHIC_H_ + +#include +#include +#include +#include + +#include + +#include + + +namespace fst { +namespace internal { + +// Orders weights for equality checking. +template ::value>::type * = nullptr> +bool WeightCompare(const Weight &w1, const Weight &w2, float delta, + bool *error) { + return NaturalLess()(w1, w2); +} + +template ::value>::type * = nullptr> +bool WeightCompare(const Weight &w1, const Weight &w2, float delta, + bool *error) { + // No natural order; use hash. + const auto q1 = w1.Quantize(delta); + const auto q2 = w2.Quantize(delta); + auto n1 = q1.Hash(); + auto n2 = q2.Hash(); + // Hash not unique; very unlikely to happen. + if (n1 == n2 && q1 != q2) { + VLOG(1) << "Isomorphic: Weight hash collision"; + *error = true; + } + return n1 < n2; +} + +template +class Isomorphism { + using StateId = typename Arc::StateId; + + public: + Isomorphism(const Fst &fst1, const Fst &fst2, float delta) + : fst1_(fst1.Copy()), + fst2_(fst2.Copy()), + delta_(delta), + error_(false), + comp_(delta, &error_) {} + + // Checks if input FSTs are isomorphic. + bool IsIsomorphic() { + if (fst1_->Start() == kNoStateId && fst2_->Start() == kNoStateId) { + return true; + } + if (fst1_->Start() == kNoStateId || fst2_->Start() == kNoStateId) { + return false; + } + PairState(fst1_->Start(), fst2_->Start()); + while (!queue_.empty()) { + const auto &pr = queue_.front(); + if (!IsIsomorphicState(pr.first, pr.second)) return false; + queue_.pop_front(); + } + return true; + } + + bool Error() const { return error_; } + + private: + // Orders arcs for equality checking. + class ArcCompare { + public: + ArcCompare(float delta, bool *error) : delta_(delta), error_(error) {} + + bool operator()(const Arc &arc1, const Arc &arc2) const { + if (arc1.ilabel < arc2.ilabel) return true; + if (arc1.ilabel > arc2.ilabel) return false; + if (arc1.olabel < arc2.olabel) return true; + if (arc1.olabel > arc2.olabel) return false; + return WeightCompare(arc1.weight, arc2.weight, delta_, error_); + } + + private: + float delta_; + bool *error_; + }; + + // Maintains state correspondences and queue. + bool PairState(StateId s1, StateId s2) { + if (state_pairs_.size() <= s1) state_pairs_.resize(s1 + 1, kNoStateId); + if (state_pairs_[s1] == s2) { + return true; // already seen this pair + } else if (state_pairs_[s1] != kNoStateId) { + return false; // s1 already paired with another s2 + } + state_pairs_[s1] = s2; + queue_.push_back(std::make_pair(s1, s2)); + return true; + } + + // Checks if state pair is isomorphic + bool IsIsomorphicState(StateId s1, StateId s2); + + std::unique_ptr> fst1_; + std::unique_ptr> fst2_; + float delta_; // Weight equality delta. + std::vector arcs1_; // For sorting arcs on FST1. + std::vector arcs2_; // For sorting arcs on FST2. + std::vector state_pairs_; // Maintains state correspondences. + std::list> queue_; // Queue of state pairs. + bool error_; // Error flag. + ArcCompare comp_; +}; + +template +bool Isomorphism::IsIsomorphicState(StateId s1, StateId s2) { + if (!ApproxEqual(fst1_->Final(s1), fst2_->Final(s2), delta_)) return false; + auto narcs1 = fst1_->NumArcs(s1); + auto narcs2 = fst2_->NumArcs(s2); + if (narcs1 != narcs2) return false; + ArcIterator> aiter1(*fst1_, s1); + ArcIterator> aiter2(*fst2_, s2); + arcs1_.clear(); + arcs1_.reserve(narcs1); + arcs2_.clear(); + arcs2_.reserve(narcs2); + for (; !aiter1.Done(); aiter1.Next(), aiter2.Next()) { + arcs1_.push_back(aiter1.Value()); + arcs2_.push_back(aiter2.Value()); + } + std::sort(arcs1_.begin(), arcs1_.end(), comp_); + std::sort(arcs2_.begin(), arcs2_.end(), comp_); + for (size_t i = 0; i < arcs1_.size(); ++i) { + const auto &arc1 = arcs1_[i]; + const auto &arc2 = arcs2_[i]; + if (arc1.ilabel != arc2.ilabel) return false; + if (arc1.olabel != arc2.olabel) return false; + if (!ApproxEqual(arc1.weight, arc2.weight, delta_)) return false; + if (!PairState(arc1.nextstate, arc2.nextstate)) return false; + if (i > 0) { // Checks for non-determinism. + const auto &arc0 = arcs1_[i - 1]; + if (arc1.ilabel == arc0.ilabel && arc1.olabel == arc0.olabel && + ApproxEqual(arc1.weight, arc0.weight, delta_)) { + VLOG(1) << "Isomorphic: Non-determinism as an unweighted automaton"; + error_ = true; + return false; + } + } + } + return true; +} + +} // namespace internal + +// Tests if two FSTs have the same states and arcs up to a reordering. +// Inputs should be non-deterministic when viewed as unweighted automata. +template +bool Isomorphic(const Fst &fst1, const Fst &fst2, + float delta = kDelta) { + internal::Isomorphism iso(fst1, fst2, delta); + bool result = iso.IsIsomorphic(); + if (iso.Error()) { + FSTERROR() << "Isomorphic: Cannot determine if inputs are isomorphic"; + return false; + } else { + return result; + } +} + +} // namespace fst + +#endif // FST_ISOMORPHIC_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/label-reachable.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/label-reachable.h new file mode 100644 index 0000000..f3d7f2b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/label-reachable.h @@ -0,0 +1,511 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to determine if a non-epsilon label can be read as the first +// non-epsilon symbol along some path from a given state. + +#ifndef FST_LABEL_REACHABLE_H_ +#define FST_LABEL_REACHABLE_H_ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + + +namespace fst { + +// Stores shareable data for label reachable class copies. +template +class LabelReachableData { + public: + using LabelIntervalSet = IntervalSet *fst, C *mapper) { + ArcMap(fst, mapper); +} + +template +void Map(MutableFst *fst, C mapper) { + ArcMap(fst, mapper); +} + +template +void Map(const Fst &ifst, MutableFst *ofst, C *mapper) { + ArcMap(ifst, ofst, mapper); +} + +template +void Map(const Fst &ifst, MutableFst *ofst, C mapper) { + ArcMap(ifst, ofst, mapper); +} + +using MapFstOptions = ArcMapFstOptions; + +template +class MapFst : public ArcMapFst { + public: + using FromArc = A; + using ToArc = B; + + using StateId = typename ToArc::StateId; + using Weight = typename ToArc::Weight; + + using State = CacheState; + + MapFst(const Fst &fst, const C &mapper, const MapFstOptions &opts) + : ArcMapFst(fst, mapper, opts) {} + + MapFst(const Fst &fst, C *mapper, const MapFstOptions &opts) + : ArcMapFst(fst, mapper, opts) {} + + MapFst(const Fst &fst, const C &mapper) + : ArcMapFst(fst, mapper) {} + + MapFst(const Fst &fst, C *mapper) : ArcMapFst(fst, mapper) {} + + // See Fst<>::Copy() for doc. + MapFst(const MapFst &fst, bool safe = false) + : ArcMapFst(fst, safe) {} + + // Get a copy of this MapFst. See Fst<>::Copy() for further doc. + MapFst *Copy(bool safe = false) const override { + return new MapFst(*this, safe); + } +}; + +// Specialization for MapFst. +template +class StateIterator> + : public StateIterator> { + public: + explicit StateIterator(const ArcMapFst &fst) + : StateIterator>(fst) {} +}; + +// Specialization for MapFst. +template +class ArcIterator> : public ArcIterator> { + public: + ArcIterator(const ArcMapFst &fst, typename A::StateId s) + : ArcIterator>(fst, s) {} +}; + +// For backwards compatibility only; use IdentityArcMapper otherwise. +template +struct IdentityMapper { + using FromArc = A; + using ToArc = A; + + ToArc operator()(const FromArc &arc) const { return arc; } + + constexpr MapFinalAction FinalAction() const { return MAP_NO_SUPERFINAL; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + uint64 Properties(uint64 props) const { return props; } +}; + +} // namespace fst + +#endif // FST_MAP_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/mapped-file.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/mapped-file.h new file mode 100644 index 0000000..adb33c2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/mapped-file.h @@ -0,0 +1,81 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_MAPPED_FILE_H_ +#define FST_MAPPED_FILE_H_ + +#include +#include +#include + +#include +#include + +namespace fst { + +// A memory region is a simple abstraction for allocated memory or data from +// memory-mapped files. If mmap is null, then data represents an owned region +// of size bytes. Otherwise, mmap and size refer to the mapping and data is a +// casted pointer to a region contained within [mmap, mmap + size). If size is +// 0, then mmap and data refer to a block of memory managed externally by some +// other allocator. The offset is used when allocating memory to providing +// padding for alignment. +struct MemoryRegion { + void *data; + void *mmap; + size_t size; + int offset; +}; + +class MappedFile { + public: + ~MappedFile(); + + void *mutable_data() const { return region_.data; } + + const void *data() const { return region_.data; } + + // Returns a MappedFile object that contains the contents of the input stream + // strm starting from the current file position with size bytes. The memorymap + // bool is advisory, and Map will default to allocating and reading. The + // source argument needs to contain the filename that was used to open the + // input stream. + static MappedFile *Map(std::istream *istrm, bool memorymap, + const string &source, size_t size); + + // Returns a MappedFile object that contains the contents of the file referred + // to by the file descriptor starting from pos with size bytes. If the + // memory mapping fails, nullptr is returned. In contrast to Map(), this + // factory function does not backoff to allocating and reading. + static MappedFile *MapFromFileDescriptor(int fd, int pos, size_t size); + + // Creates a MappedFile object with a new[]'ed block of memory of size. The + // align argument can be used to specify a desired block alignment. + // This is RECOMMENDED FOR INTERNAL USE ONLY as it may change in future + // releases. + static MappedFile *Allocate(size_t size, int align = kArchAlignment); + + // Creates a MappedFile object pointing to a borrowed reference to data. This + // block of memory is not owned by the MappedFile object and will not be + // freed. This is RECOMMENDED FOR INTERNAL USE ONLY, may change in future + // releases. + static MappedFile *Borrow(void *data); + + // Alignment required for mapping structures in bytes. Regions of memory that + // are not aligned upon a 128-bit boundary are read from the file instead. + // This is consistent with the alignment boundary set in ConstFst and + // CompactFst. + static constexpr int kArchAlignment = 16; + + static constexpr size_t kMaxReadChunk = 256 * 1024 * 1024; // 256 MB. + + private: + explicit MappedFile(const MemoryRegion ®ion); + + MemoryRegion region_; + MappedFile(const MappedFile &) = delete; + MappedFile &operator=(const MappedFile &) = delete; +}; +} // namespace fst + +#endif // FST_MAPPED_FILE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/matcher-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/matcher-fst.h new file mode 100644 index 0000000..61e9582 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/matcher-fst.h @@ -0,0 +1,347 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to add a matcher to an FST. + +#ifndef FST_MATCHER_FST_H_ +#define FST_MATCHER_FST_H_ + +#include +#include + +#include +#include +#include + + +namespace fst { + +// Writeable matchers have the same interface as Matchers (as defined in +// matcher.h) along with the following additional methods: +// +// template +// class Matcher { +// public: +// using FST = F; +// ... +// using MatcherData = ...; // Initialization data. +// +// // Constructor with additional argument for external initialization data; +// // matcher increments its reference count on construction and decrements +// // the reference count, and deletes once the reference count has reached +// // zero. +// Matcher(const FST &fst, MatchType type, MatcherData *data); +// +// // Returns pointer to initialization data that can be passed to a Matcher +// // constructor. +// MatcherData *GetData() const; +// }; + +// The matcher initialization data class must also provide the following +// interface: +// +// class MatcherData { +// public: +// // Required copy constructor. +// MatcherData(const MatcherData &); +// +// // Required I/O methods. +// static MatcherData *Read(std::istream &istrm, const FstReadOptions &opts); +// bool Write(std::ostream &ostrm, const FstWriteOptions &opts) const; +// }; + +// Trivial (no-op) MatcherFst initializer functor. +template +class NullMatcherFstInit { + public: + using MatcherData = typename M::MatcherData; + using Data = AddOnPair; + using Impl = internal::AddOnImpl; + + explicit NullMatcherFstInit(std::shared_ptr *) {} +}; + +// Class adding a matcher to an FST type. Creates a new FST whose name is given +// by N. An optional functor Init can be used to initialize the FST. The Data +// template parameter allows the user to select the type of the add-on. +template < + class F, class M, const char *Name, class Init = NullMatcherFstInit, + class Data = AddOnPair> +class MatcherFst : public ImplToExpandedFst> { + public: + using FST = F; + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + + using FstMatcher = M; + using MatcherData = typename FstMatcher::MatcherData; + + using Impl = internal::AddOnImpl; + using D = Data; + + friend class StateIterator>; + friend class ArcIterator>; + + MatcherFst() : ImplToExpandedFst(std::make_shared(FST(), Name)) {} + + explicit MatcherFst(const FST &fst, std::shared_ptr data = nullptr) + : ImplToExpandedFst(data ? CreateImpl(fst, Name, data) + : CreateDataAndImpl(fst, Name)) {} + + explicit MatcherFst(const Fst &fst) + : ImplToExpandedFst(CreateDataAndImpl(fst, Name)) {} + + // See Fst<>::Copy() for doc. + MatcherFst(const MatcherFst &fst, + bool safe = false) + : ImplToExpandedFst(fst, safe) {} + + // Get a copy of this MatcherFst. See Fst<>::Copy() for further doc. + MatcherFst *Copy( + bool safe = false) const override { + return new MatcherFst(*this, safe); + } + + // Read a MatcherFst from an input stream; return nullptr on error + static MatcherFst *Read( + std::istream &strm, const FstReadOptions &opts) { + auto *impl = Impl::Read(strm, opts); + return impl ? new MatcherFst( + std::shared_ptr(impl)) + : nullptr; + } + + // Read a MatcherFst from a file; return nullptr on error + // Empty filename reads from standard input + static MatcherFst *Read( + const string &filename) { + auto *impl = ImplToExpandedFst::Read(filename); + return impl ? new MatcherFst( + std::shared_ptr(impl)) + : nullptr; + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return GetImpl()->Write(strm, opts); + } + + bool Write(const string &filename) const override { + return Fst::WriteFile(filename); + } + + void InitStateIterator(StateIteratorData *data) const override { + return GetImpl()->InitStateIterator(data); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + return GetImpl()->InitArcIterator(s, data); + } + + FstMatcher *InitMatcher(MatchType match_type) const override { + return new FstMatcher(&GetFst(), match_type, GetSharedData(match_type)); + } + + const FST &GetFst() const { return GetImpl()->GetFst(); } + + const Data *GetAddOn() const { return GetImpl()->GetAddOn(); } + + std::shared_ptr GetSharedAddOn() const { + return GetImpl()->GetSharedAddOn(); + } + + const MatcherData *GetData(MatchType match_type) const { + const auto *data = GetAddOn(); + return match_type == MATCH_INPUT ? data->First() : data->Second(); + } + + std::shared_ptr GetSharedData(MatchType match_type) const { + const auto *data = GetAddOn(); + return match_type == MATCH_INPUT ? data->SharedFirst() + : data->SharedSecond(); + } + + protected: + using ImplToFst>::GetImpl; + + static std::shared_ptr CreateDataAndImpl(const FST &fst, + const string &name) { + FstMatcher imatcher(fst, MATCH_INPUT); + FstMatcher omatcher(fst, MATCH_OUTPUT); + return CreateImpl(fst, name, + std::make_shared(imatcher.GetSharedData(), + omatcher.GetSharedData())); + } + + static std::shared_ptr CreateDataAndImpl(const Fst &fst, + const string &name) { + FST result(fst); + return CreateDataAndImpl(result, name); + } + + static std::shared_ptr CreateImpl(const FST &fst, const string &name, + std::shared_ptr data) { + auto impl = std::make_shared(fst, name); + impl->SetAddOn(data); + Init init(&impl); + return impl; + } + + explicit MatcherFst(std::shared_ptr impl) + : ImplToExpandedFst(impl) {} + + private: + MatcherFst &operator=(const MatcherFst &) = delete; +}; + +// Specialization for MatcherFst. +template +class StateIterator> + : public StateIterator { + public: + explicit StateIterator(const MatcherFst &fst) + : StateIterator(fst.GetImpl()->GetFst()) {} +}; + +// Specialization for MatcherFst. +template +class ArcIterator> : public ArcIterator { + public: + using StateId = typename FST::Arc::StateId; + + ArcIterator(const MatcherFst &fst, + typename FST::Arc::StateId s) + : ArcIterator(fst.GetImpl()->GetFst(), s) {} +}; + +// Specialization for MatcherFst. +template +class Matcher> { + public: + using FST = MatcherFst; + using Arc = typename F::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + + Matcher(const FST &fst, MatchType match_type) + : matcher_(fst.InitMatcher(match_type)) {} + + Matcher(const Matcher &matcher) : matcher_(matcher.matcher_->Copy()) {} + + Matcher *Copy() const { return new Matcher(*this); } + + MatchType Type(bool test) const { return matcher_->Type(test); } + + void SetState(StateId s) { matcher_->SetState(s); } + + bool Find(Label label) { return matcher_->Find(label); } + + bool Done() const { return matcher_->Done(); } + + const Arc &Value() const { return matcher_->Value(); } + + void Next() { matcher_->Next(); } + + uint64 Properties(uint64 props) const { return matcher_->Properties(props); } + + uint32 Flags() const { return matcher_->Flags(); } + + private: + std::unique_ptr matcher_; +}; + +// Specialization for MatcherFst. +template +class LookAheadMatcher> { + public: + using FST = MatcherFst; + using Arc = typename F::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + LookAheadMatcher(const FST &fst, MatchType match_type) + : matcher_(fst.InitMatcher(match_type)) {} + + LookAheadMatcher(const LookAheadMatcher &matcher, bool safe = false) + : matcher_(matcher.matcher_->Copy(safe)) {} + + // General matcher methods. + LookAheadMatcher *Copy(bool safe = false) const { + return new LookAheadMatcher(*this, safe); + } + + MatchType Type(bool test) const { return matcher_->Type(test); } + + void SetState(StateId s) { matcher_->SetState(s); } + + bool Find(Label label) { return matcher_->Find(label); } + + bool Done() const { return matcher_->Done(); } + + const Arc &Value() const { return matcher_->Value(); } + + void Next() { matcher_->Next(); } + + const FST &GetFst() const { return matcher_->GetFst(); } + + uint64 Properties(uint64 props) const { return matcher_->Properties(props); } + + uint32 Flags() const { return matcher_->Flags(); } + + bool LookAheadLabel(Label label) const { + return matcher_->LookAheadLabel(label); + } + + bool LookAheadFst(const Fst &fst, StateId s) { + return matcher_->LookAheadFst(fst, s); + } + + Weight LookAheadWeight() const { return matcher_->LookAheadWeight(); } + + bool LookAheadPrefix(Arc *arc) const { + return matcher_->LookAheadPrefix(arc); + } + + void InitLookAheadFst(const Fst &fst, bool copy = false) { + matcher_->InitLookAheadFst(fst, copy); + } + + private: + std::unique_ptr matcher_; +}; + +// Useful aliases when using StdArc. + +extern const char arc_lookahead_fst_type[]; + +using StdArcLookAheadFst = + MatcherFst, + ArcLookAheadMatcher>>, + arc_lookahead_fst_type>; + +extern const char ilabel_lookahead_fst_type[]; +extern const char olabel_lookahead_fst_type[]; + +constexpr auto ilabel_lookahead_flags = + kInputLookAheadMatcher | kLookAheadWeight | kLookAheadPrefix | + kLookAheadEpsilons | kLookAheadNonEpsilonPrefix; + +constexpr auto olabel_lookahead_flags = + kOutputLookAheadMatcher | kLookAheadWeight | kLookAheadPrefix | + kLookAheadEpsilons | kLookAheadNonEpsilonPrefix; + +using StdILabelLookAheadFst = MatcherFst< + ConstFst, + LabelLookAheadMatcher>, + ilabel_lookahead_flags, FastLogAccumulator>, + ilabel_lookahead_fst_type, LabelLookAheadRelabeler>; + +using StdOLabelLookAheadFst = MatcherFst< + ConstFst, + LabelLookAheadMatcher>, + olabel_lookahead_flags, FastLogAccumulator>, + olabel_lookahead_fst_type, LabelLookAheadRelabeler>; + +} // namespace fst + +#endif // FST_MATCHER_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/matcher.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/matcher.h new file mode 100644 index 0000000..d9528d6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/matcher.h @@ -0,0 +1,1575 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes to allow matching labels leaving FST states. + +#ifndef FST_MATCHER_H_ +#define FST_MATCHER_H_ + +#include +#include +#include +#include + +#include + +#include // for all internal FST accessors. + + +namespace fst { + +// Matchers find and iterate through requested labels at FST states. In the +// simplest form, these are just some associative map or search keyed on labels. +// More generally, they may implement matching special labels that represent +// sets of labels such as sigma (all), rho (rest), or phi (fail). The Matcher +// interface is: +// +// template +// class Matcher { +// public: +// using FST = F; +// using Arc = typename FST::Arc; +// using Label = typename Arc::Label; +// using StateId = typename Arc::StateId; +// using Weight = typename Arc::Weight; +// +// // Required constructors. Note: +// // -- the constructors that copy the FST arg are useful for +// // letting the matcher manage the FST through copies +// // (esp with 'safe' copies); e.g. ComposeFst depends on this. +// // -- the constructor that does not copy is useful when the +// // the FST is mutated during the lifetime of the matcher +// // (o.w. the matcher would have its own unmutated deep copy). +// +// // This makes a copy of the FST. +// Matcher(const FST &fst, MatchType type); +// // This doesn't copy the FST. +// Matcher(const FST *fst, MatchType type); +// // This makes a copy of the FST. +// // See Copy() below. +// Matcher(const Matcher &matcher, bool safe = false); +// +// // If safe = true, the copy is thread-safe. See Fst<>::Copy() for +// // further doc. +// Matcher *Copy(bool safe = false) const override; +// +// // Returns the match type that can be provided (depending on compatibility +// of the input FST). It is either the requested match type, MATCH_NONE, or +// MATCH_UNKNOWN. If test is false, a costly testing is avoided, but +// MATCH_UNKNOWN may be returned. If test is true, a definite answer is +// returned, but may involve more costly computation (e.g., visiting the FST). +// MatchType Type(bool test) const override; +// +// // Specifies the current state. +// void SetState(StateId s) final; +// +// // Finds matches to a label at the current state, returning true if a match +// // found. kNoLabel matches any non-consuming transitions, e.g., epsilon +// // transitions, which do not require a matching symbol. +// bool Find(Label label) final; +// +// // Iterator methods. Note that initially and after SetState() these have +// undefined behavior until Find() is called. +// +// bool Done() const final; +// +// const Arc &Value() const final; +// +// void Next() final; +// +// // Returns final weight of a state. +// Weight Final(StateId) const final; +// +// // Indicates preference for being the side used for matching in +// // composition. If the value is kRequirePriority, then it is +// // mandatory that it be used. Calling this method without passing the +// // current state of the matcher invalidates the state of the matcher. +// ssize_t Priority(StateId s) final; +// +// // This specifies the known FST properties as viewed from this matcher. It +// // takes as argument the input FST's known properties. +// uint64 Properties(uint64 props) const override; +// +// // Returns matcher flags. +// uint32 Flags() const override; +// +// // Returns matcher FST. +// const FST &GetFst() const override; +// }; + +// Basic matcher flags. + +// Matcher needs to be used as the matching side in composition for +// at least one state (has kRequirePriority). +constexpr uint32 kRequireMatch = 0x00000001; + +// Flags used for basic matchers (see also lookahead.h). +constexpr uint32 kMatcherFlags = kRequireMatch; + +// Matcher priority that is mandatory. +constexpr ssize_t kRequirePriority = -1; + +// Matcher interface, templated on the Arc definition; used for matcher +// specializations that are returned by the InitMatcher FST method. +template +class MatcherBase { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + virtual ~MatcherBase() {} + + // Virtual interface. + + virtual MatcherBase *Copy(bool safe = false) const = 0; + virtual MatchType Type(bool) const = 0; + virtual void SetState(StateId) = 0; + virtual bool Find(Label) = 0; + virtual bool Done() const = 0; + virtual const Arc &Value() const = 0; + virtual void Next() = 0; + virtual const Fst &GetFst() const = 0; + virtual uint64 Properties(uint64) const = 0; + + // Trivial implementations that can be used by derived classes. Full + // devirtualization is expected for any derived class marked final. + virtual uint32 Flags() const { return 0; } + + virtual Weight Final(StateId s) const { return internal::Final(GetFst(), s); } + + virtual ssize_t Priority(StateId s) { return internal::NumArcs(GetFst(), s); } +}; + +// A matcher that expects sorted labels on the side to be matched. +// If match_type == MATCH_INPUT, epsilons match the implicit self-loop +// Arc(kNoLabel, 0, Weight::One(), current_state) as well as any +// actual epsilon transitions. If match_type == MATCH_OUTPUT, then +// Arc(0, kNoLabel, Weight::One(), current_state) is instead matched. +template +class SortedMatcher : public MatcherBase { + public: + using FST = F; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using MatcherBase::Flags; + using MatcherBase::Properties; + + // Labels >= binary_label will be searched for by binary search; + // o.w. linear search is used. + // This makes a copy of the FST. + SortedMatcher(const FST &fst, MatchType match_type, Label binary_label = 1) + : SortedMatcher(fst.Copy(), match_type, binary_label) { + owned_fst_.reset(&fst_); + } + + // Labels >= binary_label will be searched for by binary search; + // o.w. linear search is used. + // This doesn't copy the FST. + SortedMatcher(const FST *fst, MatchType match_type, Label binary_label = 1) + : fst_(*fst), + state_(kNoStateId), + aiter_(nullptr), + match_type_(match_type), + binary_label_(binary_label), + match_label_(kNoLabel), + narcs_(0), + loop_(kNoLabel, 0, Weight::One(), kNoStateId), + error_(false), + aiter_pool_(1) { + switch (match_type_) { + case MATCH_INPUT: + case MATCH_NONE: + break; + case MATCH_OUTPUT: + std::swap(loop_.ilabel, loop_.olabel); + break; + default: + FSTERROR() << "SortedMatcher: Bad match type"; + match_type_ = MATCH_NONE; + error_ = true; + } + } + + // This makes a copy of the FST. + SortedMatcher(const SortedMatcher &matcher, bool safe = false) + : owned_fst_(matcher.fst_.Copy(safe)), + fst_(*owned_fst_), + state_(kNoStateId), + aiter_(nullptr), + match_type_(matcher.match_type_), + binary_label_(matcher.binary_label_), + match_label_(kNoLabel), + narcs_(0), + loop_(matcher.loop_), + error_(matcher.error_), + aiter_pool_(1) {} + + ~SortedMatcher() override { Destroy(aiter_, &aiter_pool_); } + + SortedMatcher *Copy(bool safe = false) const override { + return new SortedMatcher(*this, safe); + } + + MatchType Type(bool test) const override { + if (match_type_ == MATCH_NONE) return match_type_; + const auto true_prop = + match_type_ == MATCH_INPUT ? kILabelSorted : kOLabelSorted; + const auto false_prop = + match_type_ == MATCH_INPUT ? kNotILabelSorted : kNotOLabelSorted; + const auto props = fst_.Properties(true_prop | false_prop, test); + if (props & true_prop) { + return match_type_; + } else if (props & false_prop) { + return MATCH_NONE; + } else { + return MATCH_UNKNOWN; + } + } + + void SetState(StateId s) final { + if (state_ == s) return; + state_ = s; + if (match_type_ == MATCH_NONE) { + FSTERROR() << "SortedMatcher: Bad match type"; + error_ = true; + } + Destroy(aiter_, &aiter_pool_); + aiter_ = new (&aiter_pool_) ArcIterator(fst_, s); + aiter_->SetFlags(kArcNoCache, kArcNoCache); + narcs_ = internal::NumArcs(fst_, s); + loop_.nextstate = s; + } + + bool Find(Label match_label) final { + exact_match_ = true; + if (error_) { + current_loop_ = false; + match_label_ = kNoLabel; + return false; + } + current_loop_ = match_label == 0; + match_label_ = match_label == kNoLabel ? 0 : match_label; + if (Search()) { + return true; + } else { + return current_loop_; + } + } + + // Positions matcher to the first position where inserting match_label would + // maintain the sort order. + void LowerBound(Label label) { + exact_match_ = false; + current_loop_ = false; + if (error_) { + match_label_ = kNoLabel; + return; + } + match_label_ = label; + Search(); + } + + // After Find(), returns false if no more exact matches. + // After LowerBound(), returns false if no more arcs. + bool Done() const final { + if (current_loop_) return false; + if (aiter_->Done()) return true; + if (!exact_match_) return false; + aiter_->SetFlags(match_type_ == MATCH_INPUT ? + kArcILabelValue : kArcOLabelValue, + kArcValueFlags); + return GetLabel() != match_label_; + } + + const Arc &Value() const final { + if (current_loop_) return loop_; + aiter_->SetFlags(kArcValueFlags, kArcValueFlags); + return aiter_->Value(); + } + + void Next() final { + if (current_loop_) { + current_loop_ = false; + } else { + aiter_->Next(); + } + } + + Weight Final(StateId s) const final { + return MatcherBase::Final(s); + } + + ssize_t Priority(StateId s) final { + return MatcherBase::Priority(s); + } + + const FST &GetFst() const override { return fst_; } + + uint64 Properties(uint64 inprops) const override { + return inprops | (error_ ? kError : 0); + } + + size_t Position() const { return aiter_ ? aiter_->Position() : 0; } + + private: + Label GetLabel() const { + const auto &arc = aiter_->Value(); + return match_type_ == MATCH_INPUT ? arc.ilabel : arc.olabel; + } + + bool BinarySearch(); + bool LinearSearch(); + bool Search(); + + std::unique_ptr owned_fst_; // FST ptr if owned. + const FST &fst_; // FST for matching. + StateId state_; // Matcher state. + ArcIterator *aiter_; // Iterator for current state. + MatchType match_type_; // Type of match to perform. + Label binary_label_; // Least label for binary search. + Label match_label_; // Current label to be matched. + size_t narcs_; // Current state arc count. + Arc loop_; // For non-consuming symbols. + bool current_loop_; // Current arc is the implicit loop. + bool exact_match_; // Exact match or lower bound? + bool error_; // Error encountered? + MemoryPool> aiter_pool_; // Pool of arc iterators. +}; + +// Returns true iff match to match_label_. The arc iterator is positioned at the +// lower bound, that is, the first element greater than or equal to +// match_label_, or the end if all elements are less than match_label_. +// If multiple elements are equal to the `match_label_`, returns the rightmost +// one. +template +inline bool SortedMatcher::BinarySearch() { + size_t size = narcs_; + if (size == 0) { + return false; + } + size_t high = size - 1; + while (size > 1) { + const size_t half = size / 2; + const size_t mid = high - half; + aiter_->Seek(mid); + if (GetLabel() >= match_label_) { + high = mid; + } + size -= half; + } + aiter_->Seek(high); + const auto label = GetLabel(); + if (label == match_label_) { + return true; + } + if (label < match_label_) { + aiter_->Next(); + } + return false; +} + +// Returns true iff match to match_label_, positioning arc iterator at lower +// bound. +template +inline bool SortedMatcher::LinearSearch() { + for (aiter_->Reset(); !aiter_->Done(); aiter_->Next()) { + const auto label = GetLabel(); + if (label == match_label_) return true; + if (label > match_label_) break; + } + return false; +} + +// Returns true iff match to match_label_, positioning arc iterator at lower +// bound. +template +inline bool SortedMatcher::Search() { + aiter_->SetFlags(match_type_ == MATCH_INPUT ? + kArcILabelValue : kArcOLabelValue, + kArcValueFlags); + if (match_label_ >= binary_label_) { + return BinarySearch(); + } else { + return LinearSearch(); + } +} + +// A matcher that stores labels in a per-state hash table populated upon the +// first visit to that state. Sorting is not required. Treatment of +// epsilons are the same as with SortedMatcher. +template +class HashMatcher : public MatcherBase { + public: + using FST = F; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using MatcherBase::Flags; + using MatcherBase::Final; + using MatcherBase::Priority; + + // This makes a copy of the FST. + HashMatcher(const FST &fst, MatchType match_type) + : HashMatcher(fst.Copy(), match_type) { + owned_fst_.reset(&fst_); + } + + // This doesn't copy the FST. + HashMatcher(const FST *fst, MatchType match_type) + : fst_(*fst), + state_(kNoStateId), + match_type_(match_type), + loop_(kNoLabel, 0, Weight::One(), kNoStateId), + error_(false), + state_table_(std::make_shared()) { + switch (match_type_) { + case MATCH_INPUT: + case MATCH_NONE: + break; + case MATCH_OUTPUT: + std::swap(loop_.ilabel, loop_.olabel); + break; + default: + FSTERROR() << "HashMatcher: Bad match type"; + match_type_ = MATCH_NONE; + error_ = true; + } + } + + // This makes a copy of the FST. + HashMatcher(const HashMatcher &matcher, bool safe = false) + : owned_fst_(matcher.fst_.Copy(safe)), + fst_(*owned_fst_), + state_(kNoStateId), + match_type_(matcher.match_type_), + loop_(matcher.loop_), + error_(matcher.error_), + state_table_( + safe ? std::make_shared() : matcher.state_table_) {} + + HashMatcher *Copy(bool safe = false) const override { + return new HashMatcher(*this, safe); + } + + // The argument is ignored as there are no relevant properties to test. + MatchType Type(bool test) const override { return match_type_; } + + void SetState(StateId s) final; + + bool Find(Label label) final { + current_loop_ = label == 0; + if (label == 0) { + Search(label); + return true; + } + if (label == kNoLabel) label = 0; + return Search(label); + } + + bool Done() const final { + if (current_loop_) return false; + return label_it_ == label_end_; + } + + const Arc &Value() const final { + if (current_loop_) return loop_; + aiter_->Seek(label_it_->second); + return aiter_->Value(); + } + + void Next() final { + if (current_loop_) { + current_loop_ = false; + } else { + ++label_it_; + } + } + + const FST &GetFst() const override { return fst_; } + + uint64 Properties(uint64 inprops) const override { + return inprops | (error_ ? kError : 0); + } + + private: + Label GetLabel() const { + const auto &arc = aiter_->Value(); + return match_type_ == MATCH_INPUT ? arc.ilabel : arc.olabel; + } + + bool Search(Label match_label); + + using LabelTable = std::unordered_multimap; + using StateTable = std::unordered_map>; + + std::unique_ptr owned_fst_; // ptr to FST if owned. + const FST &fst_; // FST for matching. + StateId state_; // Matcher state. + MatchType match_type_; + Arc loop_; // The implicit loop itself. + bool current_loop_; // Is the current arc the implicit loop? + bool error_; // Error encountered? + std::unique_ptr> aiter_; + std::shared_ptr state_table_; // Table from state to label table. + LabelTable *label_table_; // Pointer to current state's label table. + typename LabelTable::iterator label_it_; // Position for label. + typename LabelTable::iterator label_end_; // Position for last label + 1. +}; + +template +void HashMatcher::SetState(typename FST::Arc::StateId s) { + if (state_ == s) return; + // Resets everything for the state. + state_ = s; + loop_.nextstate = state_; + aiter_.reset(new ArcIterator(fst_, state_)); + if (match_type_ == MATCH_NONE) { + FSTERROR() << "HashMatcher: Bad match type"; + error_ = true; + } + // Attempts to insert a new label table. + auto it_and_success = state_table_->emplace( + state_, std::unique_ptr(new LabelTable())); + // Sets instance's pointer to the label table for this state. + label_table_ = it_and_success.first->second.get(); + // If it already exists, no additional work is done and we simply return. + if (!it_and_success.second) return; + // Otherwise, populate this new table. + // Populates the label table. + label_table_->reserve(internal::NumArcs(fst_, state_)); + const auto aiter_flags = + (match_type_ == MATCH_INPUT ? kArcILabelValue : kArcOLabelValue) | + kArcNoCache; + aiter_->SetFlags(aiter_flags, kArcFlags); + for (; !aiter_->Done(); aiter_->Next()) { + label_table_->emplace(GetLabel(), aiter_->Position()); + } + aiter_->SetFlags(kArcValueFlags, kArcValueFlags); +} + +template +inline bool HashMatcher::Search(typename FST::Arc::Label match_label) { + auto range = label_table_->equal_range(match_label); + label_it_ = range.first; + label_end_ = range.second; + if (label_it_ == label_end_) return false; + aiter_->Seek(label_it_->second); + return true; +} + +// Specifies whether we rewrite both the input and output sides during matching. +enum MatcherRewriteMode { + MATCHER_REWRITE_AUTO = 0, // Rewrites both sides iff acceptor. + MATCHER_REWRITE_ALWAYS, + MATCHER_REWRITE_NEVER +}; + +// For any requested label that doesn't match at a state, this matcher +// considers the *unique* transition that matches the label 'phi_label' +// (phi = 'fail'), and recursively looks for a match at its +// destination. When 'phi_loop' is true, if no match is found but a +// phi self-loop is found, then the phi transition found is returned +// with the phi_label rewritten as the requested label (both sides if +// an acceptor, or if 'rewrite_both' is true and both input and output +// labels of the found transition are 'phi_label'). If 'phi_label' is +// kNoLabel, this special matching is not done. PhiMatcher is +// templated itself on a matcher, which is used to perform the +// underlying matching. By default, the underlying matcher is +// constructed by PhiMatcher. The user can instead pass in this +// object; in that case, PhiMatcher takes its ownership. +// Phi non-determinism not supported. No non-consuming symbols other +// than epsilon supported with the underlying template argument matcher. +template +class PhiMatcher : public MatcherBase { + public: + using FST = typename M::FST; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // This makes a copy of the FST (w/o 'matcher' arg). + PhiMatcher(const FST &fst, MatchType match_type, Label phi_label = kNoLabel, + bool phi_loop = true, + MatcherRewriteMode rewrite_mode = MATCHER_REWRITE_AUTO, + M *matcher = nullptr) + : matcher_(matcher ? matcher : new M(fst, match_type)), + match_type_(match_type), + phi_label_(phi_label), + state_(kNoStateId), + phi_loop_(phi_loop), + error_(false) { + if (match_type == MATCH_BOTH) { + FSTERROR() << "PhiMatcher: Bad match type"; + match_type_ = MATCH_NONE; + error_ = true; + } + if (rewrite_mode == MATCHER_REWRITE_AUTO) { + rewrite_both_ = fst.Properties(kAcceptor, true); + } else if (rewrite_mode == MATCHER_REWRITE_ALWAYS) { + rewrite_both_ = true; + } else { + rewrite_both_ = false; + } + } + + // This doesn't copy the FST. + PhiMatcher(const FST *fst, MatchType match_type, Label phi_label = kNoLabel, + bool phi_loop = true, + MatcherRewriteMode rewrite_mode = MATCHER_REWRITE_AUTO, + M *matcher = nullptr) + : PhiMatcher(*fst, match_type, phi_label, phi_loop, rewrite_mode, + matcher ? matcher : new M(fst, match_type)) { } + + + // This makes a copy of the FST. + PhiMatcher(const PhiMatcher &matcher, bool safe = false) + : matcher_(new M(*matcher.matcher_, safe)), + match_type_(matcher.match_type_), + phi_label_(matcher.phi_label_), + rewrite_both_(matcher.rewrite_both_), + state_(kNoStateId), + phi_loop_(matcher.phi_loop_), + error_(matcher.error_) {} + + PhiMatcher *Copy(bool safe = false) const override { + return new PhiMatcher(*this, safe); + } + + MatchType Type(bool test) const override { return matcher_->Type(test); } + + void SetState(StateId s) final { + if (state_ == s) return; + matcher_->SetState(s); + state_ = s; + has_phi_ = phi_label_ != kNoLabel; + } + + bool Find(Label match_label) final; + + bool Done() const final { return matcher_->Done(); } + + const Arc &Value() const final { + if ((phi_match_ == kNoLabel) && (phi_weight_ == Weight::One())) { + return matcher_->Value(); + } else if (phi_match_ == 0) { // Virtual epsilon loop. + phi_arc_ = Arc(kNoLabel, 0, Weight::One(), state_); + if (match_type_ == MATCH_OUTPUT) { + std::swap(phi_arc_.ilabel, phi_arc_.olabel); + } + return phi_arc_; + } else { + phi_arc_ = matcher_->Value(); + phi_arc_.weight = Times(phi_weight_, phi_arc_.weight); + if (phi_match_ != kNoLabel) { // Phi loop match. + if (rewrite_both_) { + if (phi_arc_.ilabel == phi_label_) phi_arc_.ilabel = phi_match_; + if (phi_arc_.olabel == phi_label_) phi_arc_.olabel = phi_match_; + } else if (match_type_ == MATCH_INPUT) { + phi_arc_.ilabel = phi_match_; + } else { + phi_arc_.olabel = phi_match_; + } + } + return phi_arc_; + } + } + + void Next() final { matcher_->Next(); } + + Weight Final(StateId s) const final { + auto weight = matcher_->Final(s); + if (phi_label_ == kNoLabel || weight != Weight::Zero()) { + return weight; + } + weight = Weight::One(); + matcher_->SetState(s); + while (matcher_->Final(s) == Weight::Zero()) { + if (!matcher_->Find(phi_label_ == 0 ? -1 : phi_label_)) break; + weight = Times(weight, matcher_->Value().weight); + if (s == matcher_->Value().nextstate) { + return Weight::Zero(); // Does not follow phi self-loops. + } + s = matcher_->Value().nextstate; + matcher_->SetState(s); + } + weight = Times(weight, matcher_->Final(s)); + return weight; + } + + ssize_t Priority(StateId s) final { + if (phi_label_ != kNoLabel) { + matcher_->SetState(s); + const bool has_phi = matcher_->Find(phi_label_ == 0 ? -1 : phi_label_); + return has_phi ? kRequirePriority : matcher_->Priority(s); + } else { + return matcher_->Priority(s); + } + } + + const FST &GetFst() const override { return matcher_->GetFst(); } + + uint64 Properties(uint64 props) const override; + + uint32 Flags() const override { + if (phi_label_ == kNoLabel || match_type_ == MATCH_NONE) { + return matcher_->Flags(); + } + return matcher_->Flags() | kRequireMatch; + } + + Label PhiLabel() const { return phi_label_; } + + private: + mutable std::unique_ptr matcher_; + MatchType match_type_; // Type of match requested. + Label phi_label_; // Label that represents the phi transition. + bool rewrite_both_; // Rewrite both sides when both are phi_label_? + bool has_phi_; // Are there possibly phis at the current state? + Label phi_match_; // Current label that matches phi loop. + mutable Arc phi_arc_; // Arc to return. + StateId state_; // Matcher state. + Weight phi_weight_; // Product of the weights of phi transitions taken. + bool phi_loop_; // When true, phi self-loop are allowed and treated + // as rho (required for Aho-Corasick). + bool error_; // Error encountered? + + PhiMatcher &operator=(const PhiMatcher &) = delete; +}; + +template +inline bool PhiMatcher::Find(Label label) { + if (label == phi_label_ && phi_label_ != kNoLabel && phi_label_ != 0) { + FSTERROR() << "PhiMatcher::Find: bad label (phi): " << phi_label_; + error_ = true; + return false; + } + matcher_->SetState(state_); + phi_match_ = kNoLabel; + phi_weight_ = Weight::One(); + // If phi_label_ == 0, there are no more true epsilon arcs. + if (phi_label_ == 0) { + if (label == kNoLabel) { + return false; + } + if (label == 0) { // but a virtual epsilon loop needs to be returned. + if (!matcher_->Find(kNoLabel)) { + return matcher_->Find(0); + } else { + phi_match_ = 0; + return true; + } + } + } + if (!has_phi_ || label == 0 || label == kNoLabel) { + return matcher_->Find(label); + } + auto s = state_; + while (!matcher_->Find(label)) { + // Look for phi transition (if phi_label_ == 0, we need to look + // for -1 to avoid getting the virtual self-loop) + if (!matcher_->Find(phi_label_ == 0 ? -1 : phi_label_)) return false; + if (phi_loop_ && matcher_->Value().nextstate == s) { + phi_match_ = label; + return true; + } + phi_weight_ = Times(phi_weight_, matcher_->Value().weight); + s = matcher_->Value().nextstate; + matcher_->Next(); + if (!matcher_->Done()) { + FSTERROR() << "PhiMatcher: Phi non-determinism not supported"; + error_ = true; + } + matcher_->SetState(s); + } + return true; +} + +template +inline uint64 PhiMatcher::Properties(uint64 inprops) const { + auto outprops = matcher_->Properties(inprops); + if (error_) outprops |= kError; + if (match_type_ == MATCH_NONE) { + return outprops; + } else if (match_type_ == MATCH_INPUT) { + if (phi_label_ == 0) { + outprops &= ~kEpsilons | ~kIEpsilons | ~kOEpsilons; + outprops |= kNoEpsilons | kNoIEpsilons; + } + if (rewrite_both_) { + return outprops & + ~(kODeterministic | kNonODeterministic | kString | kILabelSorted | + kNotILabelSorted | kOLabelSorted | kNotOLabelSorted); + } else { + return outprops & + ~(kODeterministic | kAcceptor | kString | kILabelSorted | + kNotILabelSorted | kOLabelSorted | kNotOLabelSorted); + } + } else if (match_type_ == MATCH_OUTPUT) { + if (phi_label_ == 0) { + outprops &= ~kEpsilons | ~kIEpsilons | ~kOEpsilons; + outprops |= kNoEpsilons | kNoOEpsilons; + } + if (rewrite_both_) { + return outprops & + ~(kIDeterministic | kNonIDeterministic | kString | kILabelSorted | + kNotILabelSorted | kOLabelSorted | kNotOLabelSorted); + } else { + return outprops & + ~(kIDeterministic | kAcceptor | kString | kILabelSorted | + kNotILabelSorted | kOLabelSorted | kNotOLabelSorted); + } + } else { + // Shouldn't ever get here. + FSTERROR() << "PhiMatcher: Bad match type: " << match_type_; + return 0; + } +} + +// For any requested label that doesn't match at a state, this matcher +// considers all transitions that match the label 'rho_label' (rho = +// 'rest'). Each such rho transition found is returned with the +// rho_label rewritten as the requested label (both sides if an +// acceptor, or if 'rewrite_both' is true and both input and output +// labels of the found transition are 'rho_label'). If 'rho_label' is +// kNoLabel, this special matching is not done. RhoMatcher is +// templated itself on a matcher, which is used to perform the +// underlying matching. By default, the underlying matcher is +// constructed by RhoMatcher. The user can instead pass in this +// object; in that case, RhoMatcher takes its ownership. +// No non-consuming symbols other than epsilon supported with +// the underlying template argument matcher. +template +class RhoMatcher : public MatcherBase { + public: + using FST = typename M::FST; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // This makes a copy of the FST (w/o 'matcher' arg). + RhoMatcher(const FST &fst, MatchType match_type, Label rho_label = kNoLabel, + MatcherRewriteMode rewrite_mode = MATCHER_REWRITE_AUTO, + M *matcher = nullptr) + : matcher_(matcher ? matcher : new M(fst, match_type)), + match_type_(match_type), + rho_label_(rho_label), + error_(false), + state_(kNoStateId), + has_rho_(false) { + if (match_type == MATCH_BOTH) { + FSTERROR() << "RhoMatcher: Bad match type"; + match_type_ = MATCH_NONE; + error_ = true; + } + if (rho_label == 0) { + FSTERROR() << "RhoMatcher: 0 cannot be used as rho_label"; + rho_label_ = kNoLabel; + error_ = true; + } + if (rewrite_mode == MATCHER_REWRITE_AUTO) { + rewrite_both_ = fst.Properties(kAcceptor, true); + } else if (rewrite_mode == MATCHER_REWRITE_ALWAYS) { + rewrite_both_ = true; + } else { + rewrite_both_ = false; + } + } + + // This doesn't copy the FST. + RhoMatcher(const FST *fst, MatchType match_type, Label rho_label = kNoLabel, + MatcherRewriteMode rewrite_mode = MATCHER_REWRITE_AUTO, + M *matcher = nullptr) + : RhoMatcher(*fst, match_type, rho_label, rewrite_mode, + matcher ? matcher : new M(fst, match_type)) { } + + // This makes a copy of the FST. + RhoMatcher(const RhoMatcher &matcher, bool safe = false) + : matcher_(new M(*matcher.matcher_, safe)), + match_type_(matcher.match_type_), + rho_label_(matcher.rho_label_), + rewrite_both_(matcher.rewrite_both_), + error_(matcher.error_), + state_(kNoStateId), + has_rho_(false) {} + + RhoMatcher *Copy(bool safe = false) const override { + return new RhoMatcher(*this, safe); + } + + MatchType Type(bool test) const override { return matcher_->Type(test); } + + void SetState(StateId s) final { + if (state_ == s) return; + state_ = s; + matcher_->SetState(s); + has_rho_ = rho_label_ != kNoLabel; + } + + bool Find(Label label) final { + if (label == rho_label_ && rho_label_ != kNoLabel) { + FSTERROR() << "RhoMatcher::Find: bad label (rho)"; + error_ = true; + return false; + } + if (matcher_->Find(label)) { + rho_match_ = kNoLabel; + return true; + } else if (has_rho_ && label != 0 && label != kNoLabel && + (has_rho_ = matcher_->Find(rho_label_))) { + rho_match_ = label; + return true; + } else { + return false; + } + } + + bool Done() const final { return matcher_->Done(); } + + const Arc &Value() const final { + if (rho_match_ == kNoLabel) { + return matcher_->Value(); + } else { + rho_arc_ = matcher_->Value(); + if (rewrite_both_) { + if (rho_arc_.ilabel == rho_label_) rho_arc_.ilabel = rho_match_; + if (rho_arc_.olabel == rho_label_) rho_arc_.olabel = rho_match_; + } else if (match_type_ == MATCH_INPUT) { + rho_arc_.ilabel = rho_match_; + } else { + rho_arc_.olabel = rho_match_; + } + return rho_arc_; + } + } + + void Next() final { matcher_->Next(); } + + Weight Final(StateId s) const final { return matcher_->Final(s); } + + ssize_t Priority(StateId s) final { + state_ = s; + matcher_->SetState(s); + has_rho_ = matcher_->Find(rho_label_); + if (has_rho_) { + return kRequirePriority; + } else { + return matcher_->Priority(s); + } + } + + const FST &GetFst() const override { return matcher_->GetFst(); } + + uint64 Properties(uint64 props) const override; + + uint32 Flags() const override { + if (rho_label_ == kNoLabel || match_type_ == MATCH_NONE) { + return matcher_->Flags(); + } + return matcher_->Flags() | kRequireMatch; + } + + Label RhoLabel() const { return rho_label_; } + + private: + std::unique_ptr matcher_; + MatchType match_type_; // Type of match requested. + Label rho_label_; // Label that represents the rho transition + bool rewrite_both_; // Rewrite both sides when both are rho_label_? + Label rho_match_; // Current label that matches rho transition. + mutable Arc rho_arc_; // Arc to return when rho match. + bool error_; // Error encountered? + StateId state_; // Matcher state. + bool has_rho_; // Are there possibly rhos at the current state? +}; + +template +inline uint64 RhoMatcher::Properties(uint64 inprops) const { + auto outprops = matcher_->Properties(inprops); + if (error_) outprops |= kError; + if (match_type_ == MATCH_NONE) { + return outprops; + } else if (match_type_ == MATCH_INPUT) { + if (rewrite_both_) { + return outprops & + ~(kODeterministic | kNonODeterministic | kString | kILabelSorted | + kNotILabelSorted | kOLabelSorted | kNotOLabelSorted); + } else { + return outprops & + ~(kODeterministic | kAcceptor | kString | kILabelSorted | + kNotILabelSorted); + } + } else if (match_type_ == MATCH_OUTPUT) { + if (rewrite_both_) { + return outprops & + ~(kIDeterministic | kNonIDeterministic | kString | kILabelSorted | + kNotILabelSorted | kOLabelSorted | kNotOLabelSorted); + } else { + return outprops & + ~(kIDeterministic | kAcceptor | kString | kOLabelSorted | + kNotOLabelSorted); + } + } else { + // Shouldn't ever get here. + FSTERROR() << "RhoMatcher: Bad match type: " << match_type_; + return 0; + } +} + +// For any requested label, this matcher considers all transitions +// that match the label 'sigma_label' (sigma = "any"), and this in +// additions to transitions with the requested label. Each such sigma +// transition found is returned with the sigma_label rewritten as the +// requested label (both sides if an acceptor, or if 'rewrite_both' is +// true and both input and output labels of the found transition are +// 'sigma_label'). If 'sigma_label' is kNoLabel, this special +// matching is not done. SigmaMatcher is templated itself on a +// matcher, which is used to perform the underlying matching. By +// default, the underlying matcher is constructed by SigmaMatcher. +// The user can instead pass in this object; in that case, +// SigmaMatcher takes its ownership. No non-consuming symbols other +// than epsilon supported with the underlying template argument matcher. +template +class SigmaMatcher : public MatcherBase { + public: + using FST = typename M::FST; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // This makes a copy of the FST (w/o 'matcher' arg). + SigmaMatcher(const FST &fst, MatchType match_type, + Label sigma_label = kNoLabel, + MatcherRewriteMode rewrite_mode = MATCHER_REWRITE_AUTO, + M *matcher = nullptr) + : matcher_(matcher ? matcher : new M(fst, match_type)), + match_type_(match_type), + sigma_label_(sigma_label), + error_(false), + state_(kNoStateId) { + if (match_type == MATCH_BOTH) { + FSTERROR() << "SigmaMatcher: Bad match type"; + match_type_ = MATCH_NONE; + error_ = true; + } + if (sigma_label == 0) { + FSTERROR() << "SigmaMatcher: 0 cannot be used as sigma_label"; + sigma_label_ = kNoLabel; + error_ = true; + } + if (rewrite_mode == MATCHER_REWRITE_AUTO) { + rewrite_both_ = fst.Properties(kAcceptor, true); + } else if (rewrite_mode == MATCHER_REWRITE_ALWAYS) { + rewrite_both_ = true; + } else { + rewrite_both_ = false; + } + } + + // This doesn't copy the FST. + SigmaMatcher(const FST *fst, MatchType match_type, + Label sigma_label = kNoLabel, + MatcherRewriteMode rewrite_mode = MATCHER_REWRITE_AUTO, + M *matcher = nullptr) + : SigmaMatcher(*fst, match_type, sigma_label, rewrite_mode, + matcher ? matcher : new M(fst, match_type)) { } + + // This makes a copy of the FST. + SigmaMatcher(const SigmaMatcher &matcher, bool safe = false) + : matcher_(new M(*matcher.matcher_, safe)), + match_type_(matcher.match_type_), + sigma_label_(matcher.sigma_label_), + rewrite_both_(matcher.rewrite_both_), + error_(matcher.error_), + state_(kNoStateId) {} + + SigmaMatcher *Copy(bool safe = false) const override { + return new SigmaMatcher(*this, safe); + } + + MatchType Type(bool test) const override { return matcher_->Type(test); } + + void SetState(StateId s) final { + if (state_ == s) return; + state_ = s; + matcher_->SetState(s); + has_sigma_ = + (sigma_label_ != kNoLabel) ? matcher_->Find(sigma_label_) : false; + } + + bool Find(Label match_label) final { + match_label_ = match_label; + if (match_label == sigma_label_ && sigma_label_ != kNoLabel) { + FSTERROR() << "SigmaMatcher::Find: bad label (sigma)"; + error_ = true; + return false; + } + if (matcher_->Find(match_label)) { + sigma_match_ = kNoLabel; + return true; + } else if (has_sigma_ && match_label != 0 && match_label != kNoLabel && + matcher_->Find(sigma_label_)) { + sigma_match_ = match_label; + return true; + } else { + return false; + } + } + + bool Done() const final { return matcher_->Done(); } + + const Arc &Value() const final { + if (sigma_match_ == kNoLabel) { + return matcher_->Value(); + } else { + sigma_arc_ = matcher_->Value(); + if (rewrite_both_) { + if (sigma_arc_.ilabel == sigma_label_) sigma_arc_.ilabel = sigma_match_; + if (sigma_arc_.olabel == sigma_label_) sigma_arc_.olabel = sigma_match_; + } else if (match_type_ == MATCH_INPUT) { + sigma_arc_.ilabel = sigma_match_; + } else { + sigma_arc_.olabel = sigma_match_; + } + return sigma_arc_; + } + } + + void Next() final { + matcher_->Next(); + if (matcher_->Done() && has_sigma_ && (sigma_match_ == kNoLabel) && + (match_label_ > 0)) { + matcher_->Find(sigma_label_); + sigma_match_ = match_label_; + } + } + + Weight Final(StateId s) const final { return matcher_->Final(s); } + + ssize_t Priority(StateId s) final { + if (sigma_label_ != kNoLabel) { + SetState(s); + return has_sigma_ ? kRequirePriority : matcher_->Priority(s); + } else { + return matcher_->Priority(s); + } + } + + const FST &GetFst() const override { return matcher_->GetFst(); } + + uint64 Properties(uint64 props) const override; + + uint32 Flags() const override { + if (sigma_label_ == kNoLabel || match_type_ == MATCH_NONE) { + return matcher_->Flags(); + } + return matcher_->Flags() | kRequireMatch; + } + + Label SigmaLabel() const { return sigma_label_; } + + private: + std::unique_ptr matcher_; + MatchType match_type_; // Type of match requested. + Label sigma_label_; // Label that represents the sigma transition. + bool rewrite_both_; // Rewrite both sides when both are sigma_label_? + bool has_sigma_; // Are there sigmas at the current state? + Label sigma_match_; // Current label that matches sigma transition. + mutable Arc sigma_arc_; // Arc to return when sigma match. + Label match_label_; // Label being matched. + bool error_; // Error encountered? + StateId state_; // Matcher state. +}; + +template +inline uint64 SigmaMatcher::Properties(uint64 inprops) const { + auto outprops = matcher_->Properties(inprops); + if (error_) outprops |= kError; + if (match_type_ == MATCH_NONE) { + return outprops; + } else if (rewrite_both_) { + return outprops & + ~(kIDeterministic | kNonIDeterministic | kODeterministic | + kNonODeterministic | kILabelSorted | kNotILabelSorted | + kOLabelSorted | kNotOLabelSorted | kString); + } else if (match_type_ == MATCH_INPUT) { + return outprops & + ~(kIDeterministic | kNonIDeterministic | kODeterministic | + kNonODeterministic | kILabelSorted | kNotILabelSorted | kString | + kAcceptor); + } else if (match_type_ == MATCH_OUTPUT) { + return outprops & + ~(kIDeterministic | kNonIDeterministic | kODeterministic | + kNonODeterministic | kOLabelSorted | kNotOLabelSorted | kString | + kAcceptor); + } else { + // Shouldn't ever get here. + FSTERROR() << "SigmaMatcher: Bad match type: " << match_type_; + return 0; + } +} + +// Flags for MultiEpsMatcher. + +// Return multi-epsilon arcs for Find(kNoLabel). +const uint32 kMultiEpsList = 0x00000001; + +// Return a kNolabel loop for Find(multi_eps). +const uint32 kMultiEpsLoop = 0x00000002; + +// MultiEpsMatcher: allows treating multiple non-0 labels as +// non-consuming labels in addition to 0 that is always +// non-consuming. Precise behavior controlled by 'flags' argument. By +// default, the underlying matcher is constructed by +// MultiEpsMatcher. The user can instead pass in this object; in that +// case, MultiEpsMatcher takes its ownership iff 'own_matcher' is +// true. +template +class MultiEpsMatcher { + public: + using FST = typename M::FST; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // This makes a copy of the FST (w/o 'matcher' arg). + MultiEpsMatcher(const FST &fst, MatchType match_type, + uint32 flags = (kMultiEpsLoop | kMultiEpsList), + M *matcher = nullptr, bool own_matcher = true) + : matcher_(matcher ? matcher : new M(fst, match_type)), + flags_(flags), + own_matcher_(matcher ? own_matcher : true) { + Init(match_type); + } + + // This doesn't copy the FST. + MultiEpsMatcher(const FST *fst, MatchType match_type, + uint32 flags = (kMultiEpsLoop | kMultiEpsList), + M *matcher = nullptr, bool own_matcher = true) + : matcher_(matcher ? matcher : new M(fst, match_type)), + flags_(flags), + own_matcher_(matcher ? own_matcher : true) { + Init(match_type); + } + + // This makes a copy of the FST. + MultiEpsMatcher(const MultiEpsMatcher &matcher, bool safe = false) + : matcher_(new M(*matcher.matcher_, safe)), + flags_(matcher.flags_), + own_matcher_(true), + multi_eps_labels_(matcher.multi_eps_labels_), + loop_(matcher.loop_) { + loop_.nextstate = kNoStateId; + } + + ~MultiEpsMatcher() { + if (own_matcher_) delete matcher_; + } + + MultiEpsMatcher *Copy(bool safe = false) const { + return new MultiEpsMatcher(*this, safe); + } + + MatchType Type(bool test) const { return matcher_->Type(test); } + + void SetState(StateId state) { + matcher_->SetState(state); + loop_.nextstate = state; + } + + bool Find(Label label); + + bool Done() const { return done_; } + + const Arc &Value() const { return current_loop_ ? loop_ : matcher_->Value(); } + + void Next() { + if (!current_loop_) { + matcher_->Next(); + done_ = matcher_->Done(); + if (done_ && multi_eps_iter_ != multi_eps_labels_.End()) { + ++multi_eps_iter_; + while ((multi_eps_iter_ != multi_eps_labels_.End()) && + !matcher_->Find(*multi_eps_iter_)) { + ++multi_eps_iter_; + } + if (multi_eps_iter_ != multi_eps_labels_.End()) { + done_ = false; + } else { + done_ = !matcher_->Find(kNoLabel); + } + } + } else { + done_ = true; + } + } + + const FST &GetFst() const { return matcher_->GetFst(); } + + uint64 Properties(uint64 props) const { return matcher_->Properties(props); } + + const M *GetMatcher() const { return matcher_; } + + Weight Final(StateId s) const { return matcher_->Final(s); } + + uint32 Flags() const { return matcher_->Flags(); } + + ssize_t Priority(StateId s) { return matcher_->Priority(s); } + + void AddMultiEpsLabel(Label label) { + if (label == 0) { + FSTERROR() << "MultiEpsMatcher: Bad multi-eps label: 0"; + } else { + multi_eps_labels_.Insert(label); + } + } + + void RemoveMultiEpsLabel(Label label) { + if (label == 0) { + FSTERROR() << "MultiEpsMatcher: Bad multi-eps label: 0"; + } else { + multi_eps_labels_.Erase(label); + } + } + + void ClearMultiEpsLabels() { multi_eps_labels_.Clear(); } + + private: + void Init(MatchType match_type) { + if (match_type == MATCH_INPUT) { + loop_.ilabel = kNoLabel; + loop_.olabel = 0; + } else { + loop_.ilabel = 0; + loop_.olabel = kNoLabel; + } + loop_.weight = Weight::One(); + loop_.nextstate = kNoStateId; + } + + M *matcher_; + uint32 flags_; + bool own_matcher_; // Does this class delete the matcher? + + // Multi-eps label set. + CompactSet multi_eps_labels_; + typename CompactSet::const_iterator multi_eps_iter_; + + bool current_loop_; // Current arc is the implicit loop? + mutable Arc loop_; // For non-consuming symbols. + bool done_; // Matching done? + + MultiEpsMatcher &operator=(const MultiEpsMatcher &) = delete; +}; + +template +inline bool MultiEpsMatcher::Find(Label label) { + multi_eps_iter_ = multi_eps_labels_.End(); + current_loop_ = false; + bool ret; + if (label == 0) { + ret = matcher_->Find(0); + } else if (label == kNoLabel) { + if (flags_ & kMultiEpsList) { + // Returns all non-consuming arcs (including epsilon). + multi_eps_iter_ = multi_eps_labels_.Begin(); + while ((multi_eps_iter_ != multi_eps_labels_.End()) && + !matcher_->Find(*multi_eps_iter_)) { + ++multi_eps_iter_; + } + if (multi_eps_iter_ != multi_eps_labels_.End()) { + ret = true; + } else { + ret = matcher_->Find(kNoLabel); + } + } else { + // Returns all epsilon arcs. + ret = matcher_->Find(kNoLabel); + } + } else if ((flags_ & kMultiEpsLoop) && + multi_eps_labels_.Find(label) != multi_eps_labels_.End()) { + // Returns implicit loop. + current_loop_ = true; + ret = true; + } else { + ret = matcher_->Find(label); + } + done_ = !ret; + return ret; +} + +// This class discards any implicit matches (e.g., the implicit epsilon +// self-loops in the SortedMatcher). Matchers are most often used in +// composition/intersection where the implicit matches are needed +// e.g. for epsilon processing. However, if a matcher is simply being +// used to look-up explicit label matches, this class saves the user +// from having to check for and discard the unwanted implicit matches +// themselves. +template +class ExplicitMatcher : public MatcherBase { + public: + using FST = typename M::FST; + using Arc = typename FST::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // This makes a copy of the FST. + ExplicitMatcher(const FST &fst, MatchType match_type, M *matcher = nullptr) + : matcher_(matcher ? matcher : new M(fst, match_type)), + match_type_(match_type), + error_(false) {} + + // This doesn't copy the FST. + ExplicitMatcher(const FST *fst, MatchType match_type, M *matcher = nullptr) + : matcher_(matcher ? matcher : new M(fst, match_type)), + match_type_(match_type), + error_(false) {} + + // This makes a copy of the FST. + ExplicitMatcher(const ExplicitMatcher &matcher, bool safe = false) + : matcher_(new M(*matcher.matcher_, safe)), + match_type_(matcher.match_type_), + error_(matcher.error_) {} + + ExplicitMatcher *Copy(bool safe = false) const override { + return new ExplicitMatcher(*this, safe); + } + + MatchType Type(bool test) const override { return matcher_->Type(test); } + + void SetState(StateId s) final { matcher_->SetState(s); } + + bool Find(Label label) final { + matcher_->Find(label); + CheckArc(); + return !Done(); + } + + bool Done() const final { return matcher_->Done(); } + + const Arc &Value() const final { return matcher_->Value(); } + + void Next() final { + matcher_->Next(); + CheckArc(); + } + + Weight Final(StateId s) const final { return matcher_->Final(s); } + + ssize_t Priority(StateId s) final { return matcher_->Priority(s); } + + const FST &GetFst() const final { return matcher_->GetFst(); } + + uint64 Properties(uint64 inprops) const override { + return matcher_->Properties(inprops); + } + + const M *GetMatcher() const { return matcher_.get(); } + + uint32 Flags() const override { return matcher_->Flags(); } + + private: + // Checks current arc if available and explicit. If not available, stops. If + // not explicit, checks next ones. + void CheckArc() { + for (; !matcher_->Done(); matcher_->Next()) { + const auto label = match_type_ == MATCH_INPUT ? matcher_->Value().ilabel + : matcher_->Value().olabel; + if (label != kNoLabel) return; + } + } + + std::unique_ptr matcher_; + MatchType match_type_; // Type of match requested. + bool error_; // Error encountered? +}; + +// Generic matcher, templated on the FST definition. +// +// Here is a typical use: +// +// Matcher matcher(fst, MATCH_INPUT); +// matcher.SetState(state); +// if (matcher.Find(label)) +// for (; !matcher.Done(); matcher.Next()) { +// auto &arc = matcher.Value(); +// ... +// } +template +class Matcher { + public: + using FST = F; + using Arc = typename F::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // This makes a copy of the FST. + Matcher(const FST &fst, MatchType match_type) + : owned_fst_(fst.Copy()), + base_(owned_fst_->InitMatcher(match_type)) { + if (!base_) base_.reset(new SortedMatcher(owned_fst_.get(), + match_type)); + } + + // This doesn't copy the FST. + Matcher(const FST *fst, MatchType match_type) + : base_(fst->InitMatcher(match_type)) { + if (!base_) base_.reset(new SortedMatcher(fst, match_type)); + } + + // This makes a copy of the FST. + Matcher(const Matcher &matcher, bool safe = false) + : base_(matcher.base_->Copy(safe)) { } + + // Takes ownership of the provided matcher. + explicit Matcher(MatcherBase *base_matcher) + : base_(base_matcher) { } + + Matcher *Copy(bool safe = false) const { + return new Matcher(*this, safe); + } + + MatchType Type(bool test) const { return base_->Type(test); } + + void SetState(StateId s) { base_->SetState(s); } + + bool Find(Label label) { return base_->Find(label); } + + bool Done() const { return base_->Done(); } + + const Arc &Value() const { return base_->Value(); } + + void Next() { base_->Next(); } + + const FST &GetFst() const { + return static_cast(base_->GetFst()); + } + + uint64 Properties(uint64 props) const { return base_->Properties(props); } + + Weight Final(StateId s) const { return base_->Final(s); } + + uint32 Flags() const { return base_->Flags() & kMatcherFlags; } + + ssize_t Priority(StateId s) { return base_->Priority(s); } + + private: + std::unique_ptr owned_fst_; + std::unique_ptr> base_; +}; + +} // namespace fst + +#endif // FST_MATCHER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/memory.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/memory.h new file mode 100644 index 0000000..c1f0bdd --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/memory.h @@ -0,0 +1,443 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST memory utilities. + +#ifndef FST_MEMORY_H_ +#define FST_MEMORY_H_ + +#include +#include +#include +#include + +#include +#include +#include + +namespace fst { + +// Default block allocation size. +constexpr int kAllocSize = 64; + +// Minimum number of allocations per block. +constexpr int kAllocFit = 4; + +// Base class for MemoryArena that allows (e.g.) MemoryArenaCollection to +// easily manipulate collections of variously sized arenas. +class MemoryArenaBase { + public: + virtual ~MemoryArenaBase() {} + virtual size_t Size() const = 0; +}; + +namespace internal { + +// Allocates 'size' unintialized memory chunks of size object_size from +// underlying blocks of (at least) size 'block_size * object_size'. +// All blocks are freed when this class is deleted. Result of allocate() will +// be aligned to object_size. +template +class MemoryArenaImpl : public MemoryArenaBase { + public: + enum { kObjectSize = object_size }; + + explicit MemoryArenaImpl(size_t block_size = kAllocSize) + : block_size_(block_size * kObjectSize), block_pos_(0) { + blocks_.emplace_front(new char[block_size_]); + } + + void *Allocate(size_t size) { + const auto byte_size = size * kObjectSize; + if (byte_size * kAllocFit > block_size_) { + // Large block; adds new large block. + auto *ptr = new char[byte_size]; + blocks_.emplace_back(ptr); + return ptr; + } + if (block_pos_ + byte_size > block_size_) { + // Doesn't fit; adds new standard block. + auto *ptr = new char[block_size_]; + block_pos_ = 0; + blocks_.emplace_front(ptr); + } + // Fits; uses current block. + auto *ptr = blocks_.front().get() + block_pos_; + block_pos_ += byte_size; + return ptr; + } + + size_t Size() const override { return kObjectSize; } + + private: + const size_t block_size_; // Default block size in bytes. + size_t block_pos_; // Current position in block in bytes. + std::list> blocks_; // List of allocated blocks. +}; + +} // namespace internal + +template +using MemoryArena = internal::MemoryArenaImpl; + +// Base class for MemoryPool that allows (e.g.) MemoryPoolCollection to easily +// manipulate collections of variously sized pools. +class MemoryPoolBase { + public: + virtual ~MemoryPoolBase() {} + virtual size_t Size() const = 0; +}; + +namespace internal { + +// Allocates and frees initially uninitialized memory chunks of size +// object_size. Keeps an internal list of freed chunks that are reused (as is) +// on the next allocation if available. Chunks are constructed in blocks of size +// 'pool_size'. +template +class MemoryPoolImpl : public MemoryPoolBase { + public: + enum { kObjectSize = object_size }; + + struct Link { + char buf[kObjectSize]; + Link *next; + }; + + explicit MemoryPoolImpl(size_t pool_size) + : mem_arena_(pool_size), free_list_(nullptr) {} + + void *Allocate() { + if (free_list_ == nullptr) { + auto *link = static_cast(mem_arena_.Allocate(1)); + link->next = nullptr; + return link; + } else { + auto *link = free_list_; + free_list_ = link->next; + return link; + } + } + + void Free(void *ptr) { + if (ptr) { + auto *link = static_cast(ptr); + link->next = free_list_; + free_list_ = link; + } + } + + size_t Size() const override { return kObjectSize; } + + private: + MemoryArena mem_arena_; + Link *free_list_; + + MemoryPoolImpl(const MemoryPoolImpl &) = delete; + MemoryPoolImpl &operator=(const MemoryPoolImpl &) = delete; +}; + +} // namespace internal + +// Allocates and frees initially uninitialized memory chunks of size sizeof(T). +// All memory is freed when the class is deleted. The result of Allocate() will +// be suitably memory-aligned. Combined with placement operator new and destroy +// functions for the T class, this can be used to improve allocation efficiency. +// See nlp/fst/lib/visit.h (global new) and nlp/fst/lib/dfs-visit.h (class new) +// for examples. +template +class MemoryPool : public internal::MemoryPoolImpl { + public: + // 'pool_size' specifies the size of the initial pool and how it is extended. + MemoryPool(size_t pool_size = kAllocSize) + : internal::MemoryPoolImpl(pool_size) {} +}; + +// Stores a collection of memory arenas. +class MemoryArenaCollection { + public: + // 'block_size' specifies the block size of the arenas. + explicit MemoryArenaCollection(size_t block_size = kAllocSize) + : block_size_(block_size), ref_count_(1) {} + + template + MemoryArena *Arena() { + if (sizeof(T) >= arenas_.size()) arenas_.resize(sizeof(T) + 1); + MemoryArenaBase *arena = arenas_[sizeof(T)].get(); + if (arena == nullptr) { + arena = new MemoryArena(block_size_); + arenas_[sizeof(T)].reset(arena); + } + return static_cast *>(arena); + } + + size_t BlockSize() const { return block_size_; } + + size_t RefCount() const { return ref_count_; } + + size_t IncrRefCount() { return ++ref_count_; } + + size_t DecrRefCount() { return --ref_count_; } + + private: + size_t block_size_; + size_t ref_count_; + std::vector> arenas_; +}; + +// Stores a collection of memory pools +class MemoryPoolCollection { + public: + // 'pool_size' specifies the size of initial pool and how it is extended. + explicit MemoryPoolCollection(size_t pool_size = kAllocSize) + : pool_size_(pool_size), ref_count_(1) {} + + template + MemoryPool *Pool() { + if (sizeof(T) >= pools_.size()) pools_.resize(sizeof(T) + 1); + MemoryPoolBase *pool = pools_[sizeof(T)].get(); + if (pool == nullptr) { + pool = new MemoryPool(pool_size_); + pools_[sizeof(T)].reset(pool); + } + return static_cast *>(pool); + } + + size_t PoolSize() const { return pool_size_; } + + size_t RefCount() const { return ref_count_; } + + size_t IncrRefCount() { return ++ref_count_; } + + size_t DecrRefCount() { return --ref_count_; } + + private: + size_t pool_size_; + size_t ref_count_; + std::vector> pools_; +}; + +// STL allocator using memory arenas. Memory is allocated from underlying +// blocks of size 'block_size * sizeof(T)'. Memory is freed only when all +// objects using this allocator are destroyed and there is otherwise no reuse +// (unlike PoolAllocator). +// +// This allocator has object-local state so it should not be used with splicing +// or swapping operations between objects created with different allocators nor +// should it be used if copies must be thread-safe. The result of allocate() +// will be suitably memory-aligned. +template +class BlockAllocator { + public: + using Allocator = std::allocator; + using size_type = typename Allocator::size_type; + using difference_type = typename Allocator::difference_type; + using pointer = typename Allocator::pointer; + using const_pointer = typename Allocator::const_pointer; + using reference = typename Allocator::reference; + using const_reference = typename Allocator::const_reference; + using value_type = typename Allocator::value_type; + + template + struct rebind { + using other = BlockAllocator; + }; + + explicit BlockAllocator(size_t block_size = kAllocSize) + : arenas_(new MemoryArenaCollection(block_size)) {} + + BlockAllocator(const BlockAllocator &arena_alloc) + : arenas_(arena_alloc.Arenas()) { + Arenas()->IncrRefCount(); + } + + template + explicit BlockAllocator(const BlockAllocator &arena_alloc) + : arenas_(arena_alloc.Arenas()) { + Arenas()->IncrRefCount(); + } + + ~BlockAllocator() { + if (Arenas()->DecrRefCount() == 0) delete Arenas(); + } + + pointer address(reference ref) const { return Allocator().address(ref); } + + const_pointer address(const_reference ref) const { + return Allocator().address(ref); + } + + size_type max_size() const { return Allocator().max_size(); } + + template + void construct(U *p, Args &&... args) { + Allocator().construct(p, std::forward(args)...); + } + + void destroy(pointer p) { Allocator().destroy(p); } + + pointer allocate(size_type n, const void *hint = nullptr) { + if (n * kAllocFit <= kAllocSize) { + return static_cast(Arena()->Allocate(n)); + } else { + return Allocator().allocate(n, hint); + } + } + + void deallocate(pointer p, size_type n) { + if (n * kAllocFit > kAllocSize) Allocator().deallocate(p, n); + } + + MemoryArenaCollection *Arenas() const { return arenas_; } + + private: + MemoryArena *Arena() { return arenas_->Arena(); } + + MemoryArenaCollection *arenas_; + + BlockAllocator operator=(const BlockAllocator &); +}; + +template +bool operator==(const BlockAllocator &alloc1, + const BlockAllocator &alloc2) { + return false; +} + +template +bool operator!=(const BlockAllocator &alloc1, + const BlockAllocator &alloc2) { + return true; +} + +// STL allocator using memory pools. Memory is allocated from underlying +// blocks of size 'block_size * sizeof(T)'. Keeps an internal list of freed +// chunks thare are reused on the next allocation. +// +// This allocator has object-local state so it should not be used with splicing +// or swapping operations between objects created with different allocators nor +// should it be used if copies must be thread-safe. The result of allocate() +// will be suitably memory-aligned. +template +class PoolAllocator { + public: + using Allocator = std::allocator; + using size_type = typename Allocator::size_type; + using difference_type = typename Allocator::difference_type; + using pointer = typename Allocator::pointer; + using const_pointer = typename Allocator::const_pointer; + using reference = typename Allocator::reference; + using const_reference = typename Allocator::const_reference; + using value_type = typename Allocator::value_type; + + template + struct rebind { + using other = PoolAllocator; + }; + + explicit PoolAllocator(size_t pool_size = kAllocSize) + : pools_(new MemoryPoolCollection(pool_size)) {} + + PoolAllocator(const PoolAllocator &pool_alloc) + : pools_(pool_alloc.Pools()) { + Pools()->IncrRefCount(); + } + + template + explicit PoolAllocator(const PoolAllocator &pool_alloc) + : pools_(pool_alloc.Pools()) { + Pools()->IncrRefCount(); + } + + ~PoolAllocator() { + if (Pools()->DecrRefCount() == 0) delete Pools(); + } + + pointer address(reference ref) const { return Allocator().address(ref); } + + const_pointer address(const_reference ref) const { + return Allocator().address(ref); + } + + size_type max_size() const { return Allocator().max_size(); } + + template + void construct(U *p, Args &&... args) { + Allocator().construct(p, std::forward(args)...); + } + + void destroy(pointer p) { Allocator().destroy(p); } + + pointer allocate(size_type n, const void *hint = nullptr) { + if (n == 1) { + return static_cast(Pool<1>()->Allocate()); + } else if (n == 2) { + return static_cast(Pool<2>()->Allocate()); + } else if (n <= 4) { + return static_cast(Pool<4>()->Allocate()); + } else if (n <= 8) { + return static_cast(Pool<8>()->Allocate()); + } else if (n <= 16) { + return static_cast(Pool<16>()->Allocate()); + } else if (n <= 32) { + return static_cast(Pool<32>()->Allocate()); + } else if (n <= 64) { + return static_cast(Pool<64>()->Allocate()); + } else { + return Allocator().allocate(n, hint); + } + } + + void deallocate(pointer p, size_type n) { + if (n == 1) { + Pool<1>()->Free(p); + } else if (n == 2) { + Pool<2>()->Free(p); + } else if (n <= 4) { + Pool<4>()->Free(p); + } else if (n <= 8) { + Pool<8>()->Free(p); + } else if (n <= 16) { + Pool<16>()->Free(p); + } else if (n <= 32) { + Pool<32>()->Free(p); + } else if (n <= 64) { + Pool<64>()->Free(p); + } else { + Allocator().deallocate(p, n); + } + } + + MemoryPoolCollection *Pools() const { return pools_; } + + private: + template + struct TN { + T buf[n]; + }; + + template + MemoryPool> *Pool() { + return pools_->Pool>(); + } + + MemoryPoolCollection *pools_; + + PoolAllocator operator=(const PoolAllocator &); +}; + +template +bool operator==(const PoolAllocator &alloc1, + const PoolAllocator &alloc2) { + return false; +} + +template +bool operator!=(const PoolAllocator &alloc1, + const PoolAllocator &alloc2) { + return true; +} + +} // namespace fst + +#endif // FST_MEMORY_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/minimize.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/minimize.h new file mode 100644 index 0000000..9f17a22 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/minimize.h @@ -0,0 +1,568 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to minimize an FST. + +#ifndef FST_MINIMIZE_H_ +#define FST_MINIMIZE_H_ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace fst { +namespace internal { + +// Comparator for creating partition. +template +class StateComparator { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + StateComparator(const Fst &fst, const Partition &partition) + : fst_(fst), partition_(partition) {} + + // Compares state x with state y based on sort criteria. + bool operator()(const StateId x, const StateId y) const { + // Checks for final state equivalence. + const auto xfinal = fst_.Final(x).Hash(); + const auto yfinal = fst_.Final(y).Hash(); + if (xfinal < yfinal) { + return true; + } else if (xfinal > yfinal) { + return false; + } + // Checks for number of arcs. + if (fst_.NumArcs(x) < fst_.NumArcs(y)) return true; + if (fst_.NumArcs(x) > fst_.NumArcs(y)) return false; + // If the number of arcs are equal, checks for arc match. + for (ArcIterator> aiter1(fst_, x), aiter2(fst_, y); + !aiter1.Done() && !aiter2.Done(); aiter1.Next(), aiter2.Next()) { + const auto &arc1 = aiter1.Value(); + const auto &arc2 = aiter2.Value(); + if (arc1.ilabel < arc2.ilabel) return true; + if (arc1.ilabel > arc2.ilabel) return false; + if (partition_.ClassId(arc1.nextstate) < + partition_.ClassId(arc2.nextstate)) + return true; + if (partition_.ClassId(arc1.nextstate) > + partition_.ClassId(arc2.nextstate)) + return false; + } + return false; + } + + private: + const Fst &fst_; + const Partition &partition_; +}; + +// Computes equivalence classes for cyclic unweighted acceptors. For cyclic +// minimization we use the classic Hopcroft minimization algorithm, which has +// complexity O(E log V) where E is the number of arcs and V is the number of +// states. +// +// For more information, see: +// +// Hopcroft, J. 1971. An n Log n algorithm for minimizing states in a finite +// automaton. Ms, Stanford University. +// +// Note: the original presentation of the paper was for a finite automaton (== +// deterministic, unweighted acceptor), but we also apply it to the +// nondeterministic case, where it is also applicable as long as the semiring is +// idempotent (if the semiring is not idempotent, there are some complexities +// in keeping track of the weight when there are multiple arcs to states that +// will be merged, and we don't deal with this). +template +class CyclicMinimizer { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using ClassId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using RevArc = ReverseArc; + + explicit CyclicMinimizer(const ExpandedFst &fst) { + Initialize(fst); + Compute(fst); + } + + const Partition &GetPartition() const { return P_; } + + private: + // StateILabelHasher is a hashing object that computes a hash-function + // of an FST state that depends only on the set of ilabels on arcs leaving + // the state [note: it assumes that the arcs are ilabel-sorted]. + // In order to work correctly for non-deterministic automata, multiple + // instances of the same ilabel count the same as a single instance. + class StateILabelHasher { + public: + explicit StateILabelHasher(const Fst &fst) : fst_(fst) {} + + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + + size_t operator()(const StateId s) { + const size_t p1 = 7603; + const size_t p2 = 433024223; + size_t result = p2; + size_t current_ilabel = kNoLabel; + for (ArcIterator> aiter(fst_, s); !aiter.Done(); aiter.Next()) { + Label this_ilabel = aiter.Value().ilabel; + if (this_ilabel != current_ilabel) { // Ignores repeats. + result = p1 * result + this_ilabel; + current_ilabel = this_ilabel; + } + } + return result; + } + + private: + const Fst &fst_; + }; + + class ArcIterCompare { + public: + explicit ArcIterCompare(const Partition &partition) + : partition_(partition) {} + + ArcIterCompare(const ArcIterCompare &comp) : partition_(comp.partition_) {} + + // Compares two iterators based on their input labels. + bool operator()(const ArcIterator> *x, + const ArcIterator> *y) const { + const auto &xarc = x->Value(); + const auto &yarc = y->Value(); + return xarc.ilabel > yarc.ilabel; + } + + private: + const Partition &partition_; + }; + + using ArcIterQueue = + std::priority_queue> *, + std::vector> *>, + ArcIterCompare>; + + private: + // Prepartitions the space into equivalence classes. We ensure that final and + // non-final states always go into different equivalence classes, and we use + // class StateILabelHasher to make sure that most of the time, states with + // different sets of ilabels on arcs leaving them, go to different partitions. + // Note: for the O(n) guarantees we don't rely on the goodness of this + // hashing function---it just provides a bonus speedup. + void PrePartition(const ExpandedFst &fst) { + VLOG(5) << "PrePartition"; + StateId next_class = 0; + auto num_states = fst.NumStates(); + // Allocates a temporary vector to store the initial class mappings, so that + // we can allocate the classes all at once. + std::vector state_to_initial_class(num_states); + { + // We maintain two maps from hash-value to class---one for final states + // (final-prob == One()) and one for non-final states + // (final-prob == Zero()). We are processing unweighted acceptors, so the + // are the only two possible values. + using HashToClassMap = std::unordered_map; + HashToClassMap hash_to_class_nonfinal; + HashToClassMap hash_to_class_final; + StateILabelHasher hasher(fst); + for (StateId s = 0; s < num_states; ++s) { + size_t hash = hasher(s); + HashToClassMap &this_map = + (fst.Final(s) != Weight::Zero() ? hash_to_class_final + : hash_to_class_nonfinal); + // Avoids two map lookups by using 'insert' instead of 'find'. + auto p = this_map.insert(std::make_pair(hash, next_class)); + state_to_initial_class[s] = p.second ? next_class++ : p.first->second; + } + // Lets the unordered_maps go out of scope before we allocate the classes, + // to reduce the maximum amount of memory used. + } + P_.AllocateClasses(next_class); + for (StateId s = 0; s < num_states; ++s) { + P_.Add(s, state_to_initial_class[s]); + } + for (StateId c = 0; c < next_class; ++c) L_.Enqueue(c); + VLOG(5) << "Initial Partition: " << P_.NumClasses(); + } + + // Creates inverse transition Tr_ = rev(fst), loops over states in FST and + // splits on final, creating two blocks in the partition corresponding to + // final, non-final. + void Initialize(const ExpandedFst &fst) { + // Constructs Tr. + Reverse(fst, &Tr_); + ILabelCompare ilabel_comp; + ArcSort(&Tr_, ilabel_comp); + // Tells the partition how many elements to allocate. The first state in + // Tr_ is super-final state. + P_.Initialize(Tr_.NumStates() - 1); + // Prepares initial partition. + PrePartition(fst); + // Allocates arc iterator queue. + ArcIterCompare comp(P_); + aiter_queue_.reset(new ArcIterQueue(comp)); + } + // Partitions all classes with destination C. + void Split(ClassId C) { + // Prepares priority queue: opens arc iterator for each state in C, and + // inserts into priority queue. + for (PartitionIterator siter(P_, C); !siter.Done(); siter.Next()) { + StateId s = siter.Value(); + if (Tr_.NumArcs(s + 1)) { + aiter_queue_->push(new ArcIterator>(Tr_, s + 1)); + } + } + // Now pops arc iterator from queue, splits entering equivalence class, and + // re-inserts updated iterator into queue. + Label prev_label = -1; + while (!aiter_queue_->empty()) { + std::unique_ptr>> aiter(aiter_queue_->top()); + aiter_queue_->pop(); + if (aiter->Done()) continue; + const auto &arc = aiter->Value(); + auto from_state = aiter->Value().nextstate - 1; + auto from_label = arc.ilabel; + if (prev_label != from_label) P_.FinalizeSplit(&L_); + auto from_class = P_.ClassId(from_state); + if (P_.ClassSize(from_class) > 1) P_.SplitOn(from_state); + prev_label = from_label; + aiter->Next(); + if (!aiter->Done()) aiter_queue_->push(aiter.release()); + } + P_.FinalizeSplit(&L_); + } + + // Main loop for Hopcroft minimization. + void Compute(const Fst &fst) { + // Processes active classes (FIFO, or FILO). + while (!L_.Empty()) { + const auto C = L_.Head(); + L_.Dequeue(); + Split(C); // Splits on C, all labels in C. + } + } + + private: + // Partioning of states into equivalence classes. + Partition P_; + // Set of active classes to be processed in partition P. + Queue L_; + // Reverses transition function. + VectorFst Tr_; + // Priority queue of open arc iterators for all states in the splitter + // equivalence class. + std::unique_ptr aiter_queue_; +}; + +// Computes equivalence classes for acyclic FST. +// +// Complexity: +// +// O(E) +// +// where E is the number of arcs. +// +// For more information, see: +// +// Revuz, D. 1992. Minimization of acyclic deterministic automata in linear +// time. Theoretical Computer Science 92(1): 181-189. +template +class AcyclicMinimizer { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using ClassId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit AcyclicMinimizer(const ExpandedFst &fst) { + Initialize(fst); + Refine(fst); + } + + const Partition &GetPartition() { return partition_; } + + private: + // DFS visitor to compute the height (distance) to final state. + class HeightVisitor { + public: + HeightVisitor() : max_height_(0), num_states_(0) {} + + // Invoked before DFS visit. + void InitVisit(const Fst &fst) {} + + // Invoked when state is discovered (2nd arg is DFS tree root). + bool InitState(StateId s, StateId root) { + // Extends height array and initialize height (distance) to 0. + for (StateId i = height_.size(); i <= s; ++i) height_.push_back(-1); + if (s >= num_states_) num_states_ = s + 1; + return true; + } + + // Invoked when tree arc examined (to undiscovered state). + bool TreeArc(StateId s, const Arc &arc) { return true; } + + // Invoked when back arc examined (to unfinished state). + bool BackArc(StateId s, const Arc &arc) { return true; } + + // Invoked when forward or cross arc examined (to finished state). + bool ForwardOrCrossArc(StateId s, const Arc &arc) { + if (height_[arc.nextstate] + 1 > height_[s]) { + height_[s] = height_[arc.nextstate] + 1; + } + return true; + } + + // Invoked when state finished (parent is kNoStateId for tree root). + void FinishState(StateId s, StateId parent, const Arc *parent_arc) { + if (height_[s] == -1) height_[s] = 0; + const auto h = height_[s] + 1; + if (parent >= 0) { + if (h > height_[parent]) height_[parent] = h; + if (h > max_height_) max_height_ = h; + } + } + + // Invoked after DFS visit. + void FinishVisit() {} + + size_t max_height() const { return max_height_; } + + const std::vector &height() const { return height_; } + + size_t num_states() const { return num_states_; } + + private: + std::vector height_; + size_t max_height_; + size_t num_states_; + }; + + private: + // Cluster states according to height (distance to final state) + void Initialize(const Fst &fst) { + // Computes height (distance to final state). + HeightVisitor hvisitor; + DfsVisit(fst, &hvisitor); + // Creates initial partition based on height. + partition_.Initialize(hvisitor.num_states()); + partition_.AllocateClasses(hvisitor.max_height() + 1); + const auto &hstates = hvisitor.height(); + for (StateId s = 0; s < hstates.size(); ++s) partition_.Add(s, hstates[s]); + } + + // Refines states based on arc sort (out degree, arc equivalence). + void Refine(const Fst &fst) { + using EquivalenceMap = std::map>; + StateComparator comp(fst, partition_); + // Starts with tail (height = 0). + auto height = partition_.NumClasses(); + for (StateId h = 0; h < height; ++h) { + EquivalenceMap equiv_classes(comp); + // Sorts states within equivalence class. + PartitionIterator siter(partition_, h); + equiv_classes[siter.Value()] = h; + for (siter.Next(); !siter.Done(); siter.Next()) { + auto insert_result = + equiv_classes.insert(std::make_pair(siter.Value(), kNoStateId)); + if (insert_result.second) { + insert_result.first->second = partition_.AddClass(); + } + } + // Creates refined partition. + for (siter.Reset(); !siter.Done();) { + const auto s = siter.Value(); + const auto old_class = partition_.ClassId(s); + const auto new_class = equiv_classes[s]; + // A move operation can invalidate the iterator, so we first update + // the iterator to the next element before we move the current element + // out of the list. + siter.Next(); + if (old_class != new_class) partition_.Move(s, new_class); + } + } + } + + private: + Partition partition_; +}; + +// Given a partition and a Mutable FST, merges states of Fst in place (i.e., +// destructively). Merging works by taking the first state in a class of the +// partition to be the representative state for the class. Each arc is then +// reconnected to this state. All states in the class are merged by adding +// their arcs to the representative state. +template +void MergeStates(const Partition &partition, + MutableFst *fst) { + using StateId = typename Arc::StateId; + std::vector state_map(partition.NumClasses()); + for (StateId i = 0; i < partition.NumClasses(); ++i) { + PartitionIterator siter(partition, i); + state_map[i] = siter.Value(); // First state in partition. + } + // Relabels destination states. + for (StateId c = 0; c < partition.NumClasses(); ++c) { + for (PartitionIterator siter(partition, c); !siter.Done(); + siter.Next()) { + const auto s = siter.Value(); + for (MutableArcIterator> aiter(fst, s); !aiter.Done(); + aiter.Next()) { + auto arc = aiter.Value(); + arc.nextstate = state_map[partition.ClassId(arc.nextstate)]; + if (s == state_map[c]) { // For the first state, just sets destination. + aiter.SetValue(arc); + } else { + fst->AddArc(state_map[c], std::move(arc)); + } + } + } + } + fst->SetStart(state_map[partition.ClassId(fst->Start())]); + Connect(fst); +} + +template +void AcceptorMinimize(MutableFst *fst, + bool allow_acyclic_minimization = true) { + if (!(fst->Properties(kAcceptor | kUnweighted, true) == + (kAcceptor | kUnweighted))) { + FSTERROR() << "FST is not an unweighted acceptor"; + fst->SetProperties(kError, kError); + return; + } + // Connects FST before minimization, handles disconnected states. + Connect(fst); + if (fst->NumStates() == 0) return; + if (allow_acyclic_minimization && fst->Properties(kAcyclic, true)) { + // Acyclic minimization (Revuz). + VLOG(2) << "Acyclic minimization"; + ArcSort(fst, ILabelCompare()); + AcyclicMinimizer minimizer(*fst); + MergeStates(minimizer.GetPartition(), fst); + } else { + // Either the FST has cycles, or it's generated from non-deterministic input + // (which the Revuz algorithm can't handle), so use the cyclic minimization + // algorithm of Hopcroft. + VLOG(2) << "Cyclic minimization"; + CyclicMinimizer> minimizer(*fst); + MergeStates(minimizer.GetPartition(), fst); + } + // Merges in appropriate semiring + ArcUniqueMapper mapper(*fst); + StateMap(fst, mapper); +} + +} // namespace internal + +// In place minimization of deterministic weighted automata and transducers, +// and also non-deterministic ones if they use an idempotent semiring. +// For transducers, if the 'sfst' argument is not null, the algorithm +// produces a compact factorization of the minimal transducer. +// +// In the acyclic deterministic case, we use an algorithm from Revuz that is +// linear in the number of arcs (edges) in the machine. +// +// In the cyclic or non-deterministic case, we use the classical Hopcroft +// minimization (which was presented for the deterministic case but which +// also works for non-deterministic FSTs); this has complexity O(e log v). +// +template +void Minimize(MutableFst *fst, MutableFst *sfst = nullptr, + float delta = kShortestDelta, bool allow_nondet = false) { + using Weight = typename Arc::Weight; + const auto props = fst->Properties( + kAcceptor | kIDeterministic | kWeighted | kUnweighted, true); + bool allow_acyclic_minimization; + if (props & kIDeterministic) { + allow_acyclic_minimization = true; + } else { + // Our approach to minimization of non-deterministic FSTs will only work in + // idempotent semirings---for non-deterministic inputs, a state could have + // multiple transitions to states that will get merged, and we'd have to + // sum their weights. The algorithm doesn't handle that. + if (!(Weight::Properties() & kIdempotent)) { + fst->SetProperties(kError, kError); + FSTERROR() << "Cannot minimize a non-deterministic FST over a " + "non-idempotent semiring"; + return; + } else if (!allow_nondet) { + fst->SetProperties(kError, kError); + FSTERROR() << "Refusing to minimize a non-deterministic FST with " + << "allow_nondet = false"; + return; + } + // The Revuz algorithm won't work for nondeterministic inputs, so if the + // input is nondeterministic, we'll have to pass a bool saying not to use + // that algorithm. We check at this level rather than in AcceptorMinimize(), + // because it's possible that the FST at this level could be deterministic, + // but a harmless type of non-determinism could be introduced by Encode() + // (thanks to kEncodeWeights, if the FST has epsilons and has a final + // weight with weights equal to some epsilon arc.) + allow_acyclic_minimization = false; + } + if (!(props & kAcceptor)) { // Weighted transducer. + VectorFst> gfst; + ArcMap(*fst, &gfst, ToGallicMapper()); + fst->DeleteStates(); + gfst.SetProperties(kAcceptor, kAcceptor); + Push(&gfst, REWEIGHT_TO_INITIAL, delta); + ArcMap(&gfst, QuantizeMapper>(delta)); + EncodeMapper> encoder( + kEncodeLabels | kEncodeWeights, ENCODE); + Encode(&gfst, &encoder); + internal::AcceptorMinimize(&gfst, allow_acyclic_minimization); + Decode(&gfst, encoder); + if (!sfst) { + FactorWeightFst, + GallicFactor> + fwfst(gfst); + std::unique_ptr osyms( + fst->OutputSymbols() ? fst->OutputSymbols()->Copy() : nullptr); + ArcMap(fwfst, fst, FromGallicMapper()); + fst->SetOutputSymbols(osyms.get()); + } else { + sfst->SetOutputSymbols(fst->OutputSymbols()); + GallicToNewSymbolsMapper mapper(sfst); + ArcMap(gfst, fst, &mapper); + fst->SetOutputSymbols(sfst->InputSymbols()); + } + } else if (props & kWeighted) { // Weighted acceptor. + Push(fst, REWEIGHT_TO_INITIAL, delta); + ArcMap(fst, QuantizeMapper(delta)); + EncodeMapper encoder(kEncodeLabels | kEncodeWeights, ENCODE); + Encode(fst, &encoder); + internal::AcceptorMinimize(fst, allow_acyclic_minimization); + Decode(fst, encoder); + } else { // Unweighted acceptor. + internal::AcceptorMinimize(fst, allow_acyclic_minimization); + } +} + +} // namespace fst + +#endif // FST_MINIMIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/mutable-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/mutable-fst.h new file mode 100644 index 0000000..9031770 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/mutable-fst.h @@ -0,0 +1,398 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Expanded FST augmented with mutators; interface class definition and +// mutable arc iterator interface. + +#ifndef FST_MUTABLE_FST_H_ +#define FST_MUTABLE_FST_H_ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + + +namespace fst { + +template +struct MutableArcIteratorData; + +// Abstract interface for an expanded FST which also supports mutation +// operations. To modify arcs, use MutableArcIterator. +template +class MutableFst : public ExpandedFst { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + virtual MutableFst &operator=(const Fst &fst) = 0; + + MutableFst &operator=(const MutableFst &fst) { + return operator=(static_cast &>(fst)); + } + + // Sets the initial state. + virtual void SetStart(StateId) = 0; + + // Sets a state's final weight. + virtual void SetFinal(StateId, Weight) = 0; + + // Sets property bits w.r.t. mask. + virtual void SetProperties(uint64 props, uint64 mask) = 0; + + // Adds a state and returns its ID. + virtual StateId AddState() = 0; + + // Adds an arc to state. + virtual void AddArc(StateId, const Arc &arc) = 0; + + // Adds an arc (passed by rvalue reference) to state. Allows subclasses + // to optionally implement move semantics. Defaults to lvalue overload. + virtual void AddArc(StateId state, Arc &&arc) { AddArc(state, arc); } + + // Deletes some states, preserving original StateId ordering. + virtual void DeleteStates(const std::vector &) = 0; + + // Delete all states. + virtual void DeleteStates() = 0; + + // Delete some arcs at a given state. + virtual void DeleteArcs(StateId, size_t n) = 0; + + // Delete all arcs at a given state. + virtual void DeleteArcs(StateId) = 0; + + // Optional, best effort only. + virtual void ReserveStates(StateId n) {} + + // Optional, best effort only. + virtual void ReserveArcs(StateId s, size_t n) {} + + // Returns input label symbol table or nullptr if not specified. + const SymbolTable *InputSymbols() const override = 0; + + // Returns output label symbol table or nullptr if not specified. + const SymbolTable *OutputSymbols() const override = 0; + + // Returns input label symbol table or nullptr if not specified. + virtual SymbolTable *MutableInputSymbols() = 0; + + // Returns output label symbol table or nullptr if not specified. + virtual SymbolTable *MutableOutputSymbols() = 0; + + // Sets input label symbol table; pass nullptr to delete table. + virtual void SetInputSymbols(const SymbolTable *isyms) = 0; + + // Sets output label symbol table; pass nullptr to delete table. + virtual void SetOutputSymbols(const SymbolTable *osyms) = 0; + + // Gets a copy of this MutableFst. See Fst<>::Copy() for further doc. + MutableFst *Copy(bool safe = false) const override = 0; + + // Reads a MutableFst from an input stream, returning nullptr on error. + static MutableFst *Read(std::istream &strm, const FstReadOptions &opts) { + FstReadOptions ropts(opts); + FstHeader hdr; + if (ropts.header) { + hdr = *opts.header; + } else { + if (!hdr.Read(strm, opts.source)) return nullptr; + ropts.header = &hdr; + } + if (!(hdr.Properties() & kMutable)) { + LOG(ERROR) << "MutableFst::Read: Not a MutableFst: " << ropts.source; + return nullptr; + } + const auto &fst_type = hdr.FstType(); + const auto reader = FstRegister::GetRegister()->GetReader(fst_type); + if (!reader) { + LOG(ERROR) << "MutableFst::Read: Unknown FST type \"" << fst_type + << "\" (arc type = \"" << A::Type() << "\"): " << ropts.source; + return nullptr; + } + auto *fst = reader(strm, ropts); + if (!fst) return nullptr; + return static_cast *>(fst); + } + + // Reads a MutableFst from a file; returns nullptr on error. An empty + // filename results in reading from standard input. If convert is true, + // convert to a mutable FST subclass (given by convert_type) in the case + // that the input FST is non-mutable. + static MutableFst *Read(const string &filename, bool convert = false, + const string &convert_type = "vector") { + if (convert == false) { + if (!filename.empty()) { + std::ifstream strm(filename, + std::ios_base::in | std::ios_base::binary); + if (!strm) { + LOG(ERROR) << "MutableFst::Read: Can't open file: " << filename; + return nullptr; + } + return Read(strm, FstReadOptions(filename)); + } else { + return Read(std::cin, FstReadOptions("standard input")); + } + } else { // Converts to 'convert_type' if not mutable. + std::unique_ptr> ifst(Fst::Read(filename)); + if (!ifst) return nullptr; + if (ifst->Properties(kMutable, false)) { + return static_cast *>(ifst.release()); + } else { + std::unique_ptr> ofst(Convert(*ifst, convert_type)); + ifst.reset(); + if (!ofst) return nullptr; + if (!ofst->Properties(kMutable, false)) { + LOG(ERROR) << "MutableFst: Bad convert type: " << convert_type; + } + return static_cast *>(ofst.release()); + } + } + } + + // For generic mutuble arc iterator construction; not normally called + // directly by users. + virtual void InitMutableArcIterator(StateId s, + MutableArcIteratorData *data) = 0; +}; + +// Mutable arc iterator interface, templated on the Arc definition. This is +// used by mutable arc iterator specializations that are returned by the +// InitMutableArcIterator MutableFst method. +template +class MutableArcIteratorBase : public ArcIteratorBase { + public: + // Sets current arc. + virtual void SetValue(const Arc &) = 0; +}; + +template +struct MutableArcIteratorData { + MutableArcIteratorBase *base; // Specific iterator. +}; + +// Generic mutable arc iterator, templated on the FST definition; a wrapper +// around a pointer to a more specific one. +// +// Here is a typical use: +// +// for (MutableArcIterator aiter(&fst, s); +// !aiter.Done(); +// aiter.Next()) { +// StdArc arc = aiter.Value(); +// arc.ilabel = 7; +// aiter.SetValue(arc); +// ... +// } +// +// This version requires function calls. +template +class MutableArcIterator { + public: + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + + MutableArcIterator(FST *fst, StateId s) { + fst->InitMutableArcIterator(s, &data_); + } + + ~MutableArcIterator() { delete data_.base; } + + bool Done() const { return data_.base->Done(); } + + const Arc &Value() const { return data_.base->Value(); } + + void Next() { data_.base->Next(); } + + size_t Position() const { return data_.base->Position(); } + + void Reset() { data_.base->Reset(); } + + void Seek(size_t a) { data_.base->Seek(a); } + + void SetValue(const Arc &arc) { data_.base->SetValue(arc); } + + uint32 Flags() const { return data_.base->Flags(); } + + void SetFlags(uint32 flags, uint32 mask) { + return data_.base->SetFlags(flags, mask); + } + + private: + MutableArcIteratorData data_; + + MutableArcIterator(const MutableArcIterator &) = delete; + MutableArcIterator &operator=(const MutableArcIterator &) = delete; +}; + +namespace internal { + +// MutableFst case: abstract methods. +template +inline typename Arc::Weight Final(const MutableFst &fst, + typename Arc::StateId s) { + return fst.Final(s); +} + +template +inline ssize_t NumArcs(const MutableFst &fst, typename Arc::StateId s) { + return fst.NumArcs(s); +} + +template +inline ssize_t NumInputEpsilons(const MutableFst &fst, + typename Arc::StateId s) { + return fst.NumInputEpsilons(s); +} + +template +inline ssize_t NumOutputEpsilons(const MutableFst &fst, + typename Arc::StateId s) { + return fst.NumOutputEpsilons(s); +} + +} // namespace internal + +// A useful alias when using StdArc. +using StdMutableFst = MutableFst; + +// This is a helper class template useful for attaching a MutableFst interface +// to its implementation, handling reference counting and COW semantics. +template > +class ImplToMutableFst : public ImplToExpandedFst { + public: + using Arc = typename Impl::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using ImplToExpandedFst::operator=; + + void SetStart(StateId s) override { + MutateCheck(); + GetMutableImpl()->SetStart(s); + } + + void SetFinal(StateId s, Weight weight) override { + MutateCheck(); + GetMutableImpl()->SetFinal(s, std::move(weight)); + } + + void SetProperties(uint64 props, uint64 mask) override { + // Can skip mutate check if extrinsic properties don't change, + // since it is then safe to update all (shallow) copies + const auto exprops = kExtrinsicProperties & mask; + if (GetImpl()->Properties(exprops) != (props & exprops)) MutateCheck(); + GetMutableImpl()->SetProperties(props, mask); + } + + StateId AddState() override { + MutateCheck(); + return GetMutableImpl()->AddState(); + } + + void AddArc(StateId s, const Arc &arc) override { + MutateCheck(); + GetMutableImpl()->AddArc(s, arc); + } + + void AddArc(StateId s, Arc &&arc) override { + MutateCheck(); + GetMutableImpl()->AddArc(s, std::move(arc)); + } + + void DeleteStates(const std::vector &dstates) override { + MutateCheck(); + GetMutableImpl()->DeleteStates(dstates); + } + + void DeleteStates() override { + if (!Unique()) { + const auto *isymbols = GetImpl()->InputSymbols(); + const auto *osymbols = GetImpl()->OutputSymbols(); + SetImpl(std::make_shared()); + GetMutableImpl()->SetInputSymbols(isymbols); + GetMutableImpl()->SetOutputSymbols(osymbols); + } else { + GetMutableImpl()->DeleteStates(); + } + } + + void DeleteArcs(StateId s, size_t n) override { + MutateCheck(); + GetMutableImpl()->DeleteArcs(s, n); + } + + void DeleteArcs(StateId s) override { + MutateCheck(); + GetMutableImpl()->DeleteArcs(s); + } + + void ReserveStates(StateId s) override { + MutateCheck(); + GetMutableImpl()->ReserveStates(s); + } + + void ReserveArcs(StateId s, size_t n) override { + MutateCheck(); + GetMutableImpl()->ReserveArcs(s, n); + } + + const SymbolTable *InputSymbols() const override { + return GetImpl()->InputSymbols(); + } + + const SymbolTable *OutputSymbols() const override { + return GetImpl()->OutputSymbols(); + } + + SymbolTable *MutableInputSymbols() override { + MutateCheck(); + return GetMutableImpl()->InputSymbols(); + } + + SymbolTable *MutableOutputSymbols() override { + MutateCheck(); + return GetMutableImpl()->OutputSymbols(); + } + + void SetInputSymbols(const SymbolTable *isyms) override { + MutateCheck(); + GetMutableImpl()->SetInputSymbols(isyms); + } + + void SetOutputSymbols(const SymbolTable *osyms) override { + MutateCheck(); + GetMutableImpl()->SetOutputSymbols(osyms); + } + + protected: + using ImplToExpandedFst::GetImpl; + using ImplToExpandedFst::GetMutableImpl; + using ImplToExpandedFst::Unique; + using ImplToExpandedFst::SetImpl; + using ImplToExpandedFst::InputSymbols; + + explicit ImplToMutableFst(std::shared_ptr impl) + : ImplToExpandedFst(impl) {} + + ImplToMutableFst(const ImplToMutableFst &fst, bool safe) + : ImplToExpandedFst(fst, safe) {} + + void MutateCheck() { + if (!Unique()) SetImpl(std::make_shared(*this)); + } +}; + +} // namespace fst + +#endif // FST_MUTABLE_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/pair-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/pair-weight.h new file mode 100644 index 0000000..1f2e963 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/pair-weight.h @@ -0,0 +1,155 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Pair weight templated base class for weight classes that contain two weights +// (e.g. Product, Lexicographic). + +#ifndef FST_PAIR_WEIGHT_H_ +#define FST_PAIR_WEIGHT_H_ + +#include +#include +#include +#include + +#include +#include + +#include + + +namespace fst { + +template +class PairWeight { + public: + using ReverseWeight = + PairWeight; + + PairWeight() {} + + PairWeight(W1 w1, W2 w2) : value1_(std::move(w1)), value2_(std::move(w2)) {} + + static const PairWeight &Zero() { + static const PairWeight zero(W1::Zero(), W2::Zero()); + return zero; + } + + static const PairWeight &One() { + static const PairWeight one(W1::One(), W2::One()); + return one; + } + + static const PairWeight &NoWeight() { + static const PairWeight no_weight(W1::NoWeight(), W2::NoWeight()); + return no_weight; + } + + std::istream &Read(std::istream &strm) { + value1_.Read(strm); + return value2_.Read(strm); + } + + std::ostream &Write(std::ostream &strm) const { + value1_.Write(strm); + return value2_.Write(strm); + } + + bool Member() const { return value1_.Member() && value2_.Member(); } + + size_t Hash() const { + const auto h1 = value1_.Hash(); + const auto h2 = value2_.Hash(); + static constexpr int lshift = 5; + static constexpr int rshift = CHAR_BIT * sizeof(size_t) - 5; + return h1 << lshift ^ h1 >> rshift ^ h2; + } + + PairWeight Quantize(float delta = kDelta) const { + return PairWeight(value1_.Quantize(delta), value2_.Quantize(delta)); + } + + ReverseWeight Reverse() const { + return ReverseWeight(value1_.Reverse(), value2_.Reverse()); + } + + const W1 &Value1() const { return value1_; } + + const W2 &Value2() const { return value2_; } + + void SetValue1(const W1 &weight) { value1_ = weight; } + + void SetValue2(const W2 &weight) { value2_ = weight; } + + private: + W1 value1_; + W2 value2_; +}; + +template +inline bool operator==(const PairWeight &w1, + const PairWeight &w2) { + return w1.Value1() == w2.Value1() && w1.Value2() == w2.Value2(); +} + +template +inline bool operator!=(const PairWeight &w1, + const PairWeight &w2) { + return w1.Value1() != w2.Value1() || w1.Value2() != w2.Value2(); +} + +template +inline bool ApproxEqual(const PairWeight &w1, + const PairWeight &w2, float delta = kDelta) { + return ApproxEqual(w1.Value1(), w2.Value1(), delta) && + ApproxEqual(w1.Value2(), w2.Value2(), delta); +} + +template +inline std::ostream &operator<<(std::ostream &strm, + const PairWeight &weight) { + CompositeWeightWriter writer(strm); + writer.WriteBegin(); + writer.WriteElement(weight.Value1()); + writer.WriteElement(weight.Value2()); + writer.WriteEnd(); + return strm; +} + +template +inline std::istream &operator>>(std::istream &strm, + PairWeight &weight) { + CompositeWeightReader reader(strm); + reader.ReadBegin(); + W1 w1; + reader.ReadElement(&w1); + weight.SetValue1(w1); + W2 w2; + reader.ReadElement(&w2, true); + weight.SetValue2(w2); + reader.ReadEnd(); + return strm; +} + +// This function object returns weights by calling the underlying generators +// and forming a pair. This is intended primarily for testing. +template +class WeightGenerate> { + public: + using Weight = PairWeight; + using Generate1 = WeightGenerate; + using Generate2 = WeightGenerate; + + explicit WeightGenerate(bool allow_zero = true) + : generate1_(allow_zero), generate2_(allow_zero) {} + + Weight operator()() const { return Weight(generate1_(), generate2_()); } + + private: + Generate1 generate1_; + Generate2 generate2_; +}; + +} // namespace fst + +#endif // FST_PAIR_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/partition.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/partition.h new file mode 100644 index 0000000..5dbbe46 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/partition.h @@ -0,0 +1,305 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to create a partition of states. + +#ifndef FST_PARTITION_H_ +#define FST_PARTITION_H_ + +#include +#include + + +#include + + +namespace fst { +namespace internal { + +template +class PartitionIterator; + +// Defines a partitioning of elements, used to represent equivalence classes +// for FST operations like minimization. T must be a signed integer type. +// +// The elements are numbered from 0 to num_elements - 1. +// Initialize(num_elements) sets up the class for a given number of elements. +// We maintain a partition of these elements into classes. The classes are also +// numbered from zero; you can add a class with AddClass(), or add them in bulk +// with AllocateClasses(num_classes). Initially the elements are not assigned +// to any class; you set up the initial mapping from elements to classes by +// calling Add(element_id, class_id). You can also move an element to a +// different class by calling Move(element_id, class_id). +// +// We also support a rather specialized interface that allows you to efficiently +// split classes in the Hopcroft minimization algorithm. This maintains a +// binary partition of each class. Let's call these, rather arbitrarily, the +// 'yes' subset and the 'no' subset of each class, and assume that by default, +// each element of a class is in its 'no' subset. When one calls +// SplitOn(element_id), element_id is moved to the 'yes' subset of its class. +// (If it was already in the 'yes' set, it just stays there). The aim is to +// enable (later) splitting the class in two in time no greater than the time +// already spent calling SplitOn() for that class. We keep a list of the classes +// which have nonempty 'yes' sets, as visited_classes_. When one calls +// FinalizeSplit(Queue *l), for each class in visited_classes_ whose 'yes' +// and 'no' sets are both nonempty, it will create a new class consisting of +// the smaller of the two subsets (and this class will be added to the queue), +// and the old class will now be the larger of the two subsets. This call also +// resets all the yes/no partitions so that everything is in the 'no' subsets. +// +// One cannot use the Move() function if SplitOn() has been called without +// a subsequent call to FinalizeSplit() +template +class Partition { + public: + Partition() {} + + explicit Partition(T num_elements) { Initialize(num_elements); } + + // Creates an empty partition for num_elements. This means that the elements + // are not assigned to a class (i.e class_index = -1); you should set up the + // number of classes using AllocateClasses() or AddClass(), and allocate each + // element to a class by calling Add(element, class_id). + void Initialize(size_t num_elements) { + elements_.resize(num_elements); + classes_.reserve(num_elements); + classes_.clear(); + yes_counter_ = 1; + } + + // Adds a class; returns new number of classes. + T AddClass() { + auto num_classes = classes_.size(); + classes_.resize(num_classes + 1); + return num_classes; + } + + // Adds 'num_classes' new (empty) classes. + void AllocateClasses(T num_classes) { + classes_.resize(classes_.size() + num_classes); + } + + // Adds element_id to class_id. element_id should already have been allocated + // by calling Initialize(num_elements)---or the constructor taking + // num_elements---with num_elements > element_id. element_id must not + // currently be a member of any class; once elements have been added to a + // class, use the Move() method to move them from one class to another. + void Add(T element_id, T class_id) { + auto &this_element = elements_[element_id]; + auto &this_class = classes_[class_id]; + ++this_class.size; + // Adds the element to the 'no' subset of the class. + auto no_head = this_class.no_head; + if (no_head >= 0) elements_[no_head].prev_element = element_id; + this_class.no_head = element_id; + this_element.class_id = class_id; + // Adds to the 'no' subset of the class. + this_element.yes = 0; + this_element.next_element = no_head; + this_element.prev_element = -1; + } + + // Moves element_id from 'no' subset of its current class to 'no' subset of + // class class_id. This may not work correctly if you have called SplitOn() + // [for any element] and haven't subsequently called FinalizeSplit(). + void Move(T element_id, T class_id) { + auto elements = &(elements_[0]); + auto &element = elements[element_id]; + auto &old_class = classes_[element.class_id]; + --old_class.size; + // Excises the element from the 'no' list of its old class, where it is + // assumed to be. + if (element.prev_element >= 0) { + elements[element.prev_element].next_element = element.next_element; + } else { + old_class.no_head = element.next_element; + } + if (element.next_element >= 0) { + elements[element.next_element].prev_element = element.prev_element; + } + // Adds to new class. + Add(element_id, class_id); + } + + // Moves element_id to the 'yes' subset of its class if it was in the 'no' + // subset, and marks the class as having been visited. + void SplitOn(T element_id) { + auto elements = &(elements_[0]); + auto &element = elements[element_id]; + if (element.yes == yes_counter_) { + return; // Already in the 'yes' set; nothing to do. + } + auto class_id = element.class_id; + auto &this_class = classes_[class_id]; + // Excises the element from the 'no' list of its class. + if (element.prev_element >= 0) { + elements[element.prev_element].next_element = element.next_element; + } else { + this_class.no_head = element.next_element; + } + if (element.next_element >= 0) { + elements[element.next_element].prev_element = element.prev_element; + } + // Adds the element to the 'yes' list. + if (this_class.yes_head >= 0) { + elements[this_class.yes_head].prev_element = element_id; + } else { + visited_classes_.push_back(class_id); + } + element.yes = yes_counter_; + element.next_element = this_class.yes_head; + element.prev_element = -1; + this_class.yes_head = element_id; + this_class.yes_size++; + } + + // This should be called after one has possibly called SplitOn for one or more + // elements, thus moving those elements to the 'yes' subset for their class. + // For each class that has a nontrivial split (i.e., it's not the case that + // all members are in the 'yes' or 'no' subset), this function creates a new + // class containing the smaller of the two subsets of elements, leaving the + // larger group of elements in the old class. The identifier of the new class + // will be added to the queue provided as the pointer L. This method then + // moves all elements to the 'no' subset of their class. + template + void FinalizeSplit(Queue *queue) { + for (const auto &visited_class : visited_classes_) { + const auto new_class = SplitRefine(visited_class); + if (new_class != -1 && queue) queue->Enqueue(new_class); + } + visited_classes_.clear(); + // Incrementation sets all the 'yes' members of the elements to false. + ++yes_counter_; + } + + const T ClassId(T element_id) const { return elements_[element_id].class_id; } + + const size_t ClassSize(T class_id) const { return classes_[class_id].size; } + + const T NumClasses() const { return classes_.size(); } + + private: + friend class PartitionIterator; + + // Information about a given element. + struct Element { + T class_id; // Class ID of this element. + T yes; // This is to be interpreted as a bool, true if it's in the + // 'yes' set of this class. The interpretation as bool is + // (yes == yes_counter_ ? true : false). + T next_element; // Next element in the 'no' list or 'yes' list of this + // class, whichever of the two we belong to (think of + // this as the 'next' in a doubly-linked list, although + // it is an index into the elements array). Negative + // values corresponds to null. + T prev_element; // Previous element in the 'no' or 'yes' doubly linked + // list. Negative values corresponds to null. + }; + + // Information about a given class. + struct Class { + Class() : size(0), yes_size(0), no_head(-1), yes_head(-1) {} + T size; // Total number of elements in this class ('no' plus 'yes' + // subsets). + T yes_size; // Total number of elements of 'yes' subset of this class. + T no_head; // Index of head element of doubly-linked list in 'no' subset. + // Everything is in the 'no' subset until you call SplitOn(). + // -1 means no element. + T yes_head; // Index of head element of doubly-linked list in 'yes' subset. + // -1 means no element. + }; + + // This method, called from FinalizeSplit(), checks whether a class has to + // be split (a class will be split only if its 'yes' and 'no' subsets are + // both nonempty, but one can assume that since this function was called, the + // 'yes' subset is nonempty). It splits by taking the smaller subset and + // making it a new class, and leaving the larger subset of elements in the + // 'no' subset of the old class. It returns the new class if created, or -1 + // if none was created. + T SplitRefine(T class_id) { + auto yes_size = classes_[class_id].yes_size; + auto size = classes_[class_id].size; + auto no_size = size - yes_size; + if (no_size == 0) { + // All members are in the 'yes' subset, so we don't have to create a new + // class, just move them all to the 'no' subset. + classes_[class_id].no_head = classes_[class_id].yes_head; + classes_[class_id].yes_head = -1; + classes_[class_id].yes_size = 0; + return -1; + } else { + auto new_class_id = classes_.size(); + classes_.resize(classes_.size() + 1); + auto &old_class = classes_[class_id]; + auto &new_class = classes_[new_class_id]; + // The new_class will have the values from the constructor. + if (no_size < yes_size) { + // Moves the 'no' subset to new class ('no' subset). + new_class.no_head = old_class.no_head; + new_class.size = no_size; + // And makes the 'yes' subset of the old class ('no' subset). + old_class.no_head = old_class.yes_head; + old_class.yes_head = -1; + old_class.size = yes_size; + old_class.yes_size = 0; + } else { + // Moves the 'yes' subset to the new class (to the 'no' subset) + new_class.size = yes_size; + new_class.no_head = old_class.yes_head; + // Retains only the 'no' subset in the old class. + old_class.size = no_size; + old_class.yes_size = 0; + old_class.yes_head = -1; + } + auto elements = &(elements_[0]); + // Updates the 'class_id' of all the elements we moved. + for (auto e = new_class.no_head; e >= 0; e = elements[e].next_element) { + elements[e].class_id = new_class_id; + } + return new_class_id; + } + } + + // elements_[i] contains all info about the i'th element. + std::vector elements_; + // classes_[i] contains all info about the i'th class. + std::vector classes_; + // Set of visited classes to be used in split refine. + std::vector visited_classes_; + // yes_counter_ is used in interpreting the 'yes' members of class Element. + // If element.yes == yes_counter_, we interpret that element as being in the + // 'yes' subset of its class. This allows us to, in effect, set all those + // bools to false at a stroke by incrementing yes_counter_. + T yes_counter_; +}; + +// Iterates over members of the 'no' subset of a class in a partition. (When +// this is used, everything is in the 'no' subset). +template +class PartitionIterator { + public: + using Element = typename Partition::Element; + + PartitionIterator(const Partition &partition, T class_id) + : partition_(partition), + element_id_(partition_.classes_[class_id].no_head), + class_id_(class_id) {} + + bool Done() { return element_id_ < 0; } + + const T Value() { return element_id_; } + + void Next() { element_id_ = partition_.elements_[element_id_].next_element; } + + void Reset() { element_id_ = partition_.classes_[class_id_].no_head; } + + private: + const Partition &partition_; + T element_id_; + T class_id_; +}; + +} // namespace internal +} // namespace fst + +#endif // FST_PARTITION_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/power-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/power-weight.h new file mode 100644 index 0000000..f2f3cbd --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/power-weight.h @@ -0,0 +1,168 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Cartesian power weight semiring operation definitions. + +#ifndef FST_POWER_WEIGHT_H_ +#define FST_POWER_WEIGHT_H_ + +#include + +#include +#include + + +namespace fst { + +// Cartesian power semiring: W ^ n +// +// Forms: +// - a left semimodule when W is a left semiring, +// - a right semimodule when W is a right semiring, +// - a bisemimodule when W is a semiring, +// the free semimodule of rank n over W +// The Times operation is overloaded to provide the left and right scalar +// products. +template +class PowerWeight : public TupleWeight { + public: + using ReverseWeight = PowerWeight; + + PowerWeight() {} + + explicit PowerWeight(const TupleWeight &weight) + : TupleWeight(weight) {} + + template + PowerWeight(Iterator begin, Iterator end) : TupleWeight(begin, end) {} + + // Initialize component `index` to `weight`; initialize all other components + // to `default_weight` + PowerWeight(size_t index, const W &weight, + const W &default_weight = W::Zero()) + : TupleWeight(index, weight, default_weight) {} + + static const PowerWeight &Zero() { + static const PowerWeight zero(TupleWeight::Zero()); + return zero; + } + + static const PowerWeight &One() { + static const PowerWeight one(TupleWeight::One()); + return one; + } + + static const PowerWeight &NoWeight() { + static const PowerWeight no_weight(TupleWeight::NoWeight()); + return no_weight; + } + + static const string &Type() { + static const string *const type = + new string(W::Type() + "_^" + std::to_string(n)); + return *type; + } + + static constexpr uint64 Properties() { + return W::Properties() & + (kLeftSemiring | kRightSemiring | kCommutative | kIdempotent); + } + + PowerWeight Quantize(float delta = kDelta) const { + return PowerWeight(TupleWeight::Quantize(delta)); + } + + ReverseWeight Reverse() const { + return ReverseWeight(TupleWeight::Reverse()); + } +}; + +// Semiring plus operation. +template +inline PowerWeight Plus(const PowerWeight &w1, + const PowerWeight &w2) { + PowerWeight result; + for (size_t i = 0; i < n; ++i) { + result.SetValue(i, Plus(w1.Value(i), w2.Value(i))); + } + return result; +} + +// Semiring times operation. +template +inline PowerWeight Times(const PowerWeight &w1, + const PowerWeight &w2) { + PowerWeight result; + for (size_t i = 0; i < n; ++i) { + result.SetValue(i, Times(w1.Value(i), w2.Value(i))); + } + return result; +} + +// Semiring divide operation. +template +inline PowerWeight Divide(const PowerWeight &w1, + const PowerWeight &w2, + DivideType type = DIVIDE_ANY) { + PowerWeight result; + for (size_t i = 0; i < n; ++i) { + result.SetValue(i, Divide(w1.Value(i), w2.Value(i), type)); + } + return result; +} + +// Semimodule left scalar product. +template +inline PowerWeight Times(const W &scalar, + const PowerWeight &weight) { + PowerWeight result; + for (size_t i = 0; i < n; ++i) { + result.SetValue(i, Times(scalar, weight.Value(i))); + } + return result; +} + +// Semimodule right scalar product. +template +inline PowerWeight Times(const PowerWeight &weight, + const W &scalar) { + PowerWeight result; + for (size_t i = 0; i < n; ++i) { + result.SetValue(i, Times(weight.Value(i), scalar)); + } + return result; +} + +// Semimodule dot product. +template +inline W DotProduct(const PowerWeight &w1, const PowerWeight &w2) { + W result(W::Zero()); + for (size_t i = 0; i < n; ++i) { + result = Plus(result, Times(w1.Value(i), w2.Value(i))); + } + return result; +} + +// This function object generates weights over the Cartesian power of rank +// n over the underlying weight. This is intended primarily for testing. +template +class WeightGenerate> { + public: + using Weight = PowerWeight; + using Generate = WeightGenerate; + + explicit WeightGenerate(bool allow_zero = true) : generate_(allow_zero) {} + + Weight operator()() const { + Weight result; + for (size_t i = 0; i < n; ++i) result.SetValue(i, generate_()); + return result; + } + + private: + Generate generate_; +}; + +} // namespace fst + +#endif // FST_POWER_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/product-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/product-weight.h new file mode 100644 index 0000000..56a18be --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/product-weight.h @@ -0,0 +1,107 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Product weight set and associated semiring operation definitions. + +#ifndef FST_PRODUCT_WEIGHT_H_ +#define FST_PRODUCT_WEIGHT_H_ + +#include +#include + +#include +#include + + +namespace fst { + +// Product semiring: W1 * W2. +template +class ProductWeight : public PairWeight { + public: + using ReverseWeight = + ProductWeight; + + ProductWeight() {} + + explicit ProductWeight(const PairWeight &weight) + : PairWeight(weight) {} + + ProductWeight(W1 w1, W2 w2) + : PairWeight(std::move(w1), std::move(w2)) {} + + static const ProductWeight &Zero() { + static const ProductWeight zero(PairWeight::Zero()); + return zero; + } + + static const ProductWeight &One() { + static const ProductWeight one(PairWeight::One()); + return one; + } + + static const ProductWeight &NoWeight() { + static const ProductWeight no_weight(PairWeight::NoWeight()); + return no_weight; + } + + static const string &Type() { + static const string *const type = + new string(W1::Type() + "_X_" + W2::Type()); + return *type; + } + + static constexpr uint64 Properties() { + return W1::Properties() & W2::Properties() & + (kLeftSemiring | kRightSemiring | kCommutative | kIdempotent); + } + + ProductWeight Quantize(float delta = kDelta) const { + return ProductWeight(PairWeight::Quantize(delta)); + } + + ReverseWeight Reverse() const { + return ReverseWeight(PairWeight::Reverse()); + } +}; + +template +inline ProductWeight Plus(const ProductWeight &w1, + const ProductWeight &w2) { + return ProductWeight(Plus(w1.Value1(), w2.Value1()), + Plus(w1.Value2(), w2.Value2())); +} + +template +inline ProductWeight Times(const ProductWeight &w1, + const ProductWeight &w2) { + return ProductWeight(Times(w1.Value1(), w2.Value1()), + Times(w1.Value2(), w2.Value2())); +} + +template +inline ProductWeight Divide(const ProductWeight &w1, + const ProductWeight &w2, + DivideType typ = DIVIDE_ANY) { + return ProductWeight(Divide(w1.Value1(), w2.Value1(), typ), + Divide(w1.Value2(), w2.Value2(), typ)); +} + +// This function object generates weights by calling the underlying generators +// for the template weight types, like all other pair weight types. This is +// intended primarily for testing. +template +class WeightGenerate> : + public WeightGenerate> { + public: + using Weight = ProductWeight; + using Generate = WeightGenerate>; + + explicit WeightGenerate(bool allow_zero = true) : Generate(allow_zero) {} + + Weight operator()() const { return Weight(Generate::operator()()); } +}; + +} // namespace fst + +#endif // FST_PRODUCT_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/project.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/project.h new file mode 100644 index 0000000..5a82cf1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/project.h @@ -0,0 +1,159 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to project an FST on to its domain or range. + +#ifndef FST_PROJECT_H_ +#define FST_PROJECT_H_ + +#include +#include + + +namespace fst { + +// This specifies whether to project on input or output. +enum ProjectType { PROJECT_INPUT = 1, PROJECT_OUTPUT = 2 }; + +// Mapper to implement projection per arc. +template +class ProjectMapper { + public: + using FromArc = A; + using ToArc = A; + + constexpr explicit ProjectMapper(ProjectType project_type) + : project_type_(project_type) {} + + ToArc operator()(const FromArc &arc) const { + const auto label = project_type_ == PROJECT_INPUT ? arc.ilabel : arc.olabel; + return ToArc(label, label, arc.weight, arc.nextstate); + } + + constexpr MapFinalAction FinalAction() const { + return MAP_NO_SUPERFINAL; + } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return project_type_ == PROJECT_INPUT ? MAP_COPY_SYMBOLS + : MAP_CLEAR_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return project_type_ == PROJECT_OUTPUT ? MAP_COPY_SYMBOLS + : MAP_CLEAR_SYMBOLS; + } + + constexpr uint64 Properties(uint64 props) const { + return ProjectProperties(props, project_type_ == PROJECT_INPUT); + } + + private: + const ProjectType project_type_; +}; + +// Projects an FST onto its domain or range by either copying each arcs' input +// label to the output label or vice versa. +// +// Complexity: +// +// Time: O(V + E) +// Space: O(1) +// +// where V is the number of states and E is the number of arcs. +template +inline void Project(const Fst &ifst, MutableFst *ofst, + ProjectType project_type) { + ArcMap(ifst, ofst, ProjectMapper(project_type)); + switch (project_type) { + case PROJECT_INPUT: + ofst->SetOutputSymbols(ifst.InputSymbols()); + return; + case PROJECT_OUTPUT: + ofst->SetInputSymbols(ifst.OutputSymbols()); + return; + } +} + +// Destructive variant of the above. +template +inline void Project(MutableFst *fst, ProjectType project_type) { + ArcMap(fst, ProjectMapper(project_type)); + switch (project_type) { + case PROJECT_INPUT: + fst->SetOutputSymbols(fst->InputSymbols()); + return; + case PROJECT_OUTPUT: + fst->SetInputSymbols(fst->OutputSymbols()); + return; + } +} + +// Projects an FST onto its domain or range by either copying each arc's input +// label to the output label or vice versa. This version is a delayed FST. +// +// Complexity: +// +// Time: O(v + e) +// Space: O(1) +// +// where v is the number of states visited and e is the number of arcs visited. +// Constant time and to visit an input state or arc is assumed and exclusive of +// caching. +template +class ProjectFst : public ArcMapFst> { + public: + using FromArc = A; + using ToArc = A; + + using Impl = internal::ArcMapFstImpl>; + + ProjectFst(const Fst &fst, ProjectType project_type) + : ArcMapFst>(fst, ProjectMapper(project_type)) { + if (project_type == PROJECT_INPUT) { + GetMutableImpl()->SetOutputSymbols(fst.InputSymbols()); + } + if (project_type == PROJECT_OUTPUT) { + GetMutableImpl()->SetInputSymbols(fst.OutputSymbols()); + } + } + + // See Fst<>::Copy() for doc. + ProjectFst(const ProjectFst &fst, bool safe = false) + : ArcMapFst>(fst, safe) {} + + // Gets a copy of this ProjectFst. See Fst<>::Copy() for further doc. + ProjectFst *Copy(bool safe = false) const override { + return new ProjectFst(*this, safe); + } + + private: + using ImplToFst::GetMutableImpl; +}; + +// Specialization for ProjectFst. +template +class StateIterator> + : public StateIterator>> { + public: + explicit StateIterator(const ProjectFst &fst) + : StateIterator>>(fst) {} +}; + +// Specialization for ProjectFst. +template +class ArcIterator> + : public ArcIterator>> { + public: + using StateId = typename A::StateId; + + ArcIterator(const ProjectFst &fst, StateId s) + : ArcIterator>>(fst, s) {} +}; + +// Useful alias when using StdArc. +using StdProjectFst = ProjectFst; + +} // namespace fst + +#endif // FST_PROJECT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/properties.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/properties.h new file mode 100644 index 0000000..157247a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/properties.h @@ -0,0 +1,468 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST property bits. + +#ifndef FST_PROPERTIES_H_ +#define FST_PROPERTIES_H_ + +#include +#include + +#include + +namespace fst { + +// The property bits here assert facts about an FST. If individual bits are +// added, then the composite properties below, the property functions and +// property names in properties.cc, and TestProperties() in test-properties.h +// should be updated. + +// BINARY PROPERTIES +// +// For each property below, there is a single bit. If it is set, the property is +// true. If it is not set, the property is false. + +// The Fst is an ExpandedFst. +constexpr uint64 kExpanded = 0x0000000000000001ULL; + +// The Fst is a MutableFst. +constexpr uint64 kMutable = 0x0000000000000002ULL; + +// An error was detected while constructing/using the FST. +constexpr uint64 kError = 0x0000000000000004ULL; + +// TRINARY PROPERTIES +// +// For each of these properties below there is a pair of property bits, one +// positive and one negative. If the positive bit is set, the property is true. +// If the negative bit is set, the property is false. If neither is set, the +// property has unknown value. Both should never be simultaneously set. The +// individual positive and negative bit pairs should be adjacent with the +// positive bit at an odd and lower position. + +// ilabel == olabel for each arc. +constexpr uint64 kAcceptor = 0x0000000000010000ULL; +// ilabel != olabel for some arc. +constexpr uint64 kNotAcceptor = 0x0000000000020000ULL; + +// ilabels unique leaving each state. +constexpr uint64 kIDeterministic = 0x0000000000040000ULL; +// ilabels not unique leaving some state. +constexpr uint64 kNonIDeterministic = 0x0000000000080000ULL; + +// olabels unique leaving each state. +constexpr uint64 kODeterministic = 0x0000000000100000ULL; +// olabels not unique leaving some state. +constexpr uint64 kNonODeterministic = 0x0000000000200000ULL; + +// FST has input/output epsilons. +constexpr uint64 kEpsilons = 0x0000000000400000ULL; +// FST has no input/output epsilons. +constexpr uint64 kNoEpsilons = 0x0000000000800000ULL; + +// FST has input epsilons. +constexpr uint64 kIEpsilons = 0x0000000001000000ULL; +// FST has no input epsilons. +constexpr uint64 kNoIEpsilons = 0x0000000002000000ULL; + +// FST has output epsilons. +constexpr uint64 kOEpsilons = 0x0000000004000000ULL; +// FST has no output epsilons. +constexpr uint64 kNoOEpsilons = 0x0000000008000000ULL; + +// ilabels sorted wrt < for each state. +constexpr uint64 kILabelSorted = 0x0000000010000000ULL; +// ilabels not sorted wrt < for some state. +constexpr uint64 kNotILabelSorted = 0x0000000020000000ULL; + +// olabels sorted wrt < for each state. +constexpr uint64 kOLabelSorted = 0x0000000040000000ULL; +// olabels not sorted wrt < for some state. +constexpr uint64 kNotOLabelSorted = 0x0000000080000000ULL; + +// Non-trivial arc or final weights. +constexpr uint64 kWeighted = 0x0000000100000000ULL; +// Only trivial arc and final weights. +constexpr uint64 kUnweighted = 0x0000000200000000ULL; + +// FST has cycles. +constexpr uint64 kCyclic = 0x0000000400000000ULL; +// FST has no cycles. +constexpr uint64 kAcyclic = 0x0000000800000000ULL; + +// FST has cycles containing the initial state. +constexpr uint64 kInitialCyclic = 0x0000001000000000ULL; +// FST has no cycles containing the initial state. +constexpr uint64 kInitialAcyclic = 0x0000002000000000ULL; + +// FST is topologically sorted. +constexpr uint64 kTopSorted = 0x0000004000000000ULL; +// FST is not topologically sorted. +constexpr uint64 kNotTopSorted = 0x0000008000000000ULL; + +// All states reachable from the initial state. +constexpr uint64 kAccessible = 0x0000010000000000ULL; +// Not all states reachable from the initial state. +constexpr uint64 kNotAccessible = 0x0000020000000000ULL; + +// All states can reach a final state. +constexpr uint64 kCoAccessible = 0x0000040000000000ULL; +// Not all states can reach a final state. +constexpr uint64 kNotCoAccessible = 0x0000080000000000ULL; + +// If NumStates() > 0, then state 0 is initial, state NumStates() - 1 is final, +// there is a transition from each non-final state i to state i + 1, and there +// are no other transitions. +constexpr uint64 kString = 0x0000100000000000ULL; + +// Not a string FST. +constexpr uint64 kNotString = 0x0000200000000000ULL; + +// FST has least one weighted cycle. +constexpr uint64 kWeightedCycles = 0x0000400000000000ULL; + +// Only unweighted cycles. +constexpr uint64 kUnweightedCycles = 0x0000800000000000ULL; + +// COMPOSITE PROPERTIES + +// Properties of an empty machine. +constexpr uint64 kNullProperties = + kAcceptor | kIDeterministic | kODeterministic | kNoEpsilons | kNoIEpsilons | + kNoOEpsilons | kILabelSorted | kOLabelSorted | kUnweighted | kAcyclic | + kInitialAcyclic | kTopSorted | kAccessible | kCoAccessible | kString | + kUnweightedCycles; + +// Properties that are preserved when an FST is copied. +constexpr uint64 kCopyProperties = + kError | kAcceptor | kNotAcceptor | kIDeterministic | kNonIDeterministic | + kODeterministic | kNonODeterministic | kEpsilons | kNoEpsilons | + kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | kILabelSorted | + kNotILabelSorted | kOLabelSorted | kNotOLabelSorted | kWeighted | + kUnweighted | kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | + kTopSorted | kNotTopSorted | kAccessible | kNotAccessible | kCoAccessible | + kNotCoAccessible | kString | kNotString | kWeightedCycles | + kUnweightedCycles; + +// Properties that are intrinsic to the FST. +constexpr uint64 kIntrinsicProperties = + kExpanded | kMutable | kAcceptor | kNotAcceptor | kIDeterministic | + kNonIDeterministic | kODeterministic | kNonODeterministic | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | + kILabelSorted | kNotILabelSorted | kOLabelSorted | kNotOLabelSorted | + kWeighted | kUnweighted | kCyclic | kAcyclic | kInitialCyclic | + kInitialAcyclic | kTopSorted | kNotTopSorted | kAccessible | + kNotAccessible | kCoAccessible | kNotCoAccessible | kString | kNotString | + kWeightedCycles | kUnweightedCycles; + +// Properties that are (potentially) extrinsic to the FST. +constexpr uint64 kExtrinsicProperties = kError; + +// Properties that are preserved when an FST start state is set. +constexpr uint64 kSetStartProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | kIDeterministic | + kNonIDeterministic | kODeterministic | kNonODeterministic | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | + kILabelSorted | kNotILabelSorted | kOLabelSorted | kNotOLabelSorted | + kWeighted | kUnweighted | kCyclic | kAcyclic | kTopSorted | kNotTopSorted | + kCoAccessible | kNotCoAccessible | kWeightedCycles | kUnweightedCycles; + +// Properties that are preserved when an FST final weight is set. +constexpr uint64 kSetFinalProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | kIDeterministic | + kNonIDeterministic | kODeterministic | kNonODeterministic | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | + kILabelSorted | kNotILabelSorted | kOLabelSorted | kNotOLabelSorted | + kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | kTopSorted | + kNotTopSorted | kAccessible | kNotAccessible | kWeightedCycles | + kUnweightedCycles; + +// Properties that are preserved when an FST state is added. +constexpr uint64 kAddStateProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | kIDeterministic | + kNonIDeterministic | kODeterministic | kNonODeterministic | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | + kILabelSorted | kNotILabelSorted | kOLabelSorted | kNotOLabelSorted | + kWeighted | kUnweighted | kCyclic | kAcyclic | kInitialCyclic | + kInitialAcyclic | kTopSorted | kNotTopSorted | kNotAccessible | + kNotCoAccessible | kNotString | kWeightedCycles | kUnweightedCycles; + +// Properties that are preserved when an FST arc is added. +constexpr uint64 kAddArcProperties = + kExpanded | kMutable | kError | kNotAcceptor | kNonIDeterministic | + kNonODeterministic | kEpsilons | kIEpsilons | kOEpsilons | + kNotILabelSorted | kNotOLabelSorted | kWeighted | kCyclic | kInitialCyclic | + kNotTopSorted | kAccessible | kCoAccessible | kWeightedCycles; + +// Properties that are preserved when an FST arc is set. +constexpr uint64 kSetArcProperties = kExpanded | kMutable | kError; + +// Properties that are preserved when FST states are deleted. +constexpr uint64 kDeleteStatesProperties = + kExpanded | kMutable | kError | kAcceptor | kIDeterministic | + kODeterministic | kNoEpsilons | kNoIEpsilons | kNoOEpsilons | + kILabelSorted | kOLabelSorted | kUnweighted | kAcyclic | kInitialAcyclic | + kTopSorted | kUnweightedCycles; + +// Properties that are preserved when FST arcs are deleted. +constexpr uint64 kDeleteArcsProperties = + kExpanded | kMutable | kError | kAcceptor | kIDeterministic | + kODeterministic | kNoEpsilons | kNoIEpsilons | kNoOEpsilons | + kILabelSorted | kOLabelSorted | kUnweighted | kAcyclic | kInitialAcyclic | + kTopSorted | kNotAccessible | kNotCoAccessible | kUnweightedCycles; + +// Properties that are preserved when an FST's states are reordered. +constexpr uint64 kStateSortProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | kIDeterministic | + kNonIDeterministic | kODeterministic | kNonODeterministic | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | + kILabelSorted | kNotILabelSorted | kOLabelSorted | kNotOLabelSorted | + kWeighted | kUnweighted | kCyclic | kAcyclic | kInitialCyclic | + kInitialAcyclic | kAccessible | kNotAccessible | kCoAccessible | + kNotCoAccessible | kWeightedCycles | kUnweightedCycles; + +// Properties that are preserved when an FST's arcs are reordered. +constexpr uint64 kArcSortProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | kIDeterministic | + kNonIDeterministic | kODeterministic | kNonODeterministic | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | + kWeighted | kUnweighted | kCyclic | kAcyclic | kInitialCyclic | + kInitialAcyclic | kTopSorted | kNotTopSorted | kAccessible | + kNotAccessible | kCoAccessible | kNotCoAccessible | kString | kNotString | + kWeightedCycles | kUnweightedCycles; + +// Properties that are preserved when an FST's input labels are changed. +constexpr uint64 kILabelInvariantProperties = + kExpanded | kMutable | kError | kODeterministic | kNonODeterministic | + kOEpsilons | kNoOEpsilons | kOLabelSorted | kNotOLabelSorted | kWeighted | + kUnweighted | kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | + kTopSorted | kNotTopSorted | kAccessible | kNotAccessible | kCoAccessible | + kNotCoAccessible | kString | kNotString | kWeightedCycles | + kUnweightedCycles; + +// Properties that are preserved when an FST's output labels are changed. +constexpr uint64 kOLabelInvariantProperties = + kExpanded | kMutable | kError | kIDeterministic | kNonIDeterministic | + kIEpsilons | kNoIEpsilons | kILabelSorted | kNotILabelSorted | kWeighted | + kUnweighted | kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | + kTopSorted | kNotTopSorted | kAccessible | kNotAccessible | kCoAccessible | + kNotCoAccessible | kString | kNotString | kWeightedCycles | + kUnweightedCycles; + +// Properties that are preserved when an FST's weights are changed. This +// assumes that the set of states that are non-final is not changed. +constexpr uint64 kWeightInvariantProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | kIDeterministic | + kNonIDeterministic | kODeterministic | kNonODeterministic | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | kNoOEpsilons | + kILabelSorted | kNotILabelSorted | kOLabelSorted | kNotOLabelSorted | + kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | kTopSorted | + kNotTopSorted | kAccessible | kNotAccessible | kCoAccessible | + kNotCoAccessible | kString | kNotString; + +// Properties that are preserved when a superfinal state is added and an FST's +// final weights are directed to it via new transitions. +constexpr uint64 kAddSuperFinalProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | + kNonIDeterministic | kNonODeterministic | kEpsilons | kIEpsilons | + kOEpsilons | kNotILabelSorted | kNotOLabelSorted | kWeighted | kUnweighted | + kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | kNotTopSorted | + kNotAccessible | kCoAccessible | kNotCoAccessible | kNotString | + kWeightedCycles | kUnweightedCycles; + +// Properties that are preserved when a superfinal state is removed and the +// epsilon transitions directed to it are made final weights. +constexpr uint64 kRmSuperFinalProperties = + kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | kIDeterministic | + kODeterministic | kNoEpsilons | kNoIEpsilons | kNoOEpsilons | + kILabelSorted | kOLabelSorted | kWeighted | kUnweighted | kCyclic | + kAcyclic | kInitialCyclic | kInitialAcyclic | kTopSorted | kAccessible | + kCoAccessible | kNotCoAccessible | kString | kWeightedCycles | + kUnweightedCycles; + +// All binary properties. +constexpr uint64 kBinaryProperties = 0x0000000000000007ULL; + +// All trinary properties. +constexpr uint64 kTrinaryProperties = 0x0000ffffffff0000ULL; + +// COMPUTED PROPERTIES + +// 1st bit of trinary properties. +constexpr uint64 kPosTrinaryProperties = kTrinaryProperties & + 0x5555555555555555ULL; + +// 2nd bit of trinary properties. +constexpr uint64 kNegTrinaryProperties = kTrinaryProperties & + 0xaaaaaaaaaaaaaaaaULL; + +// All properties. +constexpr uint64 kFstProperties = kBinaryProperties | kTrinaryProperties; + +// PROPERTY FUNCTIONS and STRING NAMES (defined in properties.cc). + +// Below are functions for getting property bit vectors when executing +// mutation operations. +inline uint64 SetStartProperties(uint64 inprops); + +template +uint64 SetFinalProperties(uint64 inprops, const Weight &old_weight, + const Weight &new_weight); + +inline uint64 AddStateProperties(uint64 inprops); + +template +uint64 AddArcProperties(uint64 inprops, typename A::StateId s, const A &arc, + const A *prev_arc); + +inline uint64 DeleteStatesProperties(uint64 inprops); + +inline uint64 DeleteAllStatesProperties(uint64 inprops, uint64 staticProps); + +inline uint64 DeleteArcsProperties(uint64 inprops); + +uint64 ClosureProperties(uint64 inprops, bool star, bool delayed = false); + +uint64 ComplementProperties(uint64 inprops); + +uint64 ComposeProperties(uint64 inprops1, uint64 inprops2); + +uint64 ConcatProperties(uint64 inprops1, uint64 inprops2, bool delayed = false); + +uint64 DeterminizeProperties(uint64 inprops, bool has_subsequential_label, + bool distinct_psubsequential_labels); + +uint64 FactorWeightProperties(uint64 inprops); + +uint64 InvertProperties(uint64 inprops); + +uint64 ProjectProperties(uint64 inprops, bool project_input); + +uint64 RandGenProperties(uint64 inprops, bool weighted); + +uint64 RelabelProperties(uint64 inprops); + +uint64 ReplaceProperties(const std::vector &inprops, size_t root, + bool epsilon_on_call, bool epsilon_on_return, + bool out_epsilon_on_call, bool out_epsilon_on_return, + bool replace_transducer, bool no_empty_fst, + bool all_ilabel_sorted, bool all_olabel_sorted, + bool all_negative_or_dense); + +uint64 ReverseProperties(uint64 inprops, bool has_superinitial); + +uint64 ReweightProperties(uint64 inprops); + +uint64 RmEpsilonProperties(uint64 inprops, bool delayed = false); + +uint64 ShortestPathProperties(uint64 props, bool tree = false); + +uint64 SynchronizeProperties(uint64 inprops); + +uint64 UnionProperties(uint64 inprops1, uint64 inprops2, bool delayed = false); + +// Definitions of inlined functions. + +uint64 SetStartProperties(uint64 inprops) { + auto outprops = inprops & kSetStartProperties; + if (inprops & kAcyclic) { + outprops |= kInitialAcyclic; + } + return outprops; +} + +uint64 AddStateProperties(uint64 inprops) { + return inprops & kAddStateProperties; +} + +uint64 DeleteStatesProperties(uint64 inprops) { + return inprops & kDeleteStatesProperties; +} + +uint64 DeleteAllStatesProperties(uint64 inprops, uint64 staticprops) { + const auto outprops = inprops & kError; + return outprops | kNullProperties | staticprops; +} + +uint64 DeleteArcsProperties(uint64 inprops) { + return inprops & kDeleteArcsProperties; +} + +// Definitions of template functions. + +template +uint64 SetFinalProperties(uint64 inprops, const Weight &old_weight, + const Weight &new_weight) { + auto outprops = inprops; + if (old_weight != Weight::Zero() && old_weight != Weight::One()) { + outprops &= ~kWeighted; + } + if (new_weight != Weight::Zero() && new_weight != Weight::One()) { + outprops |= kWeighted; + outprops &= ~kUnweighted; + } + outprops &= kSetFinalProperties | kWeighted | kUnweighted; + return outprops; +} + +/// Gets the properties for the MutableFst::AddArc method. +/// +/// \param inprops the current properties of the FST +/// \param s the ID of the state to which an arc is being added. +/// \param arc the arc being added to the state with the specified ID +/// \param prev_arc the previously-added (or "last") arc of state s, or nullptr +// if s currently has no arcs. +template +uint64 AddArcProperties(uint64 inprops, typename Arc::StateId s, + const Arc &arc, const Arc *prev_arc) { + using Weight = typename Arc::Weight; + auto outprops = inprops; + if (arc.ilabel != arc.olabel) { + outprops |= kNotAcceptor; + outprops &= ~kAcceptor; + } + if (arc.ilabel == 0) { + outprops |= kIEpsilons; + outprops &= ~kNoIEpsilons; + if (arc.olabel == 0) { + outprops |= kEpsilons; + outprops &= ~kNoEpsilons; + } + } + if (arc.olabel == 0) { + outprops |= kOEpsilons; + outprops &= ~kNoOEpsilons; + } + if (prev_arc) { + if (prev_arc->ilabel > arc.ilabel) { + outprops |= kNotILabelSorted; + outprops &= ~kILabelSorted; + } + if (prev_arc->olabel > arc.olabel) { + outprops |= kNotOLabelSorted; + outprops &= ~kOLabelSorted; + } + } + if (arc.weight != Weight::Zero() && arc.weight != Weight::One()) { + outprops |= kWeighted; + outprops &= ~kUnweighted; + } + if (arc.nextstate <= s) { + outprops |= kNotTopSorted; + outprops &= ~kTopSorted; + } + outprops &= kAddArcProperties | kAcceptor | kNoEpsilons | kNoIEpsilons | + kNoOEpsilons | kILabelSorted | kOLabelSorted | kUnweighted | + kTopSorted; + if (outprops & kTopSorted) { + outprops |= kAcyclic | kInitialAcyclic; + } + return outprops; +} + +extern const char *PropertyNames[]; + +} // namespace fst + +#endif // FST_PROPERTIES_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/prune.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/prune.h new file mode 100644 index 0000000..9e7c04b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/prune.h @@ -0,0 +1,341 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions implementing pruning. + +#ifndef FST_PRUNE_H_ +#define FST_PRUNE_H_ + +#include +#include +#include + +#include + +#include +#include +#include + + +namespace fst { +namespace internal { + +template +class PruneCompare { + public: + PruneCompare(const std::vector &idistance, + const std::vector &fdistance) + : idistance_(idistance), fdistance_(fdistance) {} + + bool operator()(const StateId x, const StateId y) const { + const auto wx = Times(IDistance(x), FDistance(x)); + const auto wy = Times(IDistance(y), FDistance(y)); + return less_(wx, wy); + } + + private: + Weight IDistance(const StateId s) const { + return s < idistance_.size() ? idistance_[s] : Weight::Zero(); + } + + Weight FDistance(const StateId s) const { + return s < fdistance_.size() ? fdistance_[s] : Weight::Zero(); + } + + const std::vector &idistance_; + const std::vector &fdistance_; + NaturalLess less_; +}; + +} // namespace internal + +template +struct PruneOptions { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit PruneOptions(const Weight &weight_threshold = Weight::Zero(), + StateId state_threshold = kNoStateId, + ArcFilter filter = ArcFilter(), + std::vector *distance = nullptr, + float delta = kDelta, bool threshold_initial = false) + : weight_threshold(std::move(weight_threshold)), + state_threshold(state_threshold), + filter(std::move(filter)), + distance(distance), + delta(delta), + threshold_initial(threshold_initial) {} + + // Pruning weight threshold. + Weight weight_threshold; + // Pruning state threshold. + StateId state_threshold; + // Arc filter. + ArcFilter filter; + // If non-zero, passes in pre-computed shortest distance to final states. + const std::vector *distance; + // Determines the degree of convergence required when computing shortest + // distances. + float delta; + // Determines if the shortest path weight is left (true) or right + // (false) multiplied by the threshold to get the limit for + // keeping a state or arc (matters if the semiring is not + // commutative). + bool threshold_initial; +}; + +// Pruning algorithm: this version modifies its input and it takes an options +// class as an argument. After pruning the FST contains states and arcs that +// belong to a successful path in the FST whose weight is no more than the +// weight of the shortest path Times() the provided weight threshold. When the +// state threshold is not kNoStateId, the output FST is further restricted to +// have no more than the number of states in opts.state_threshold. Weights must +// have the path property. The weight of any cycle needs to be bounded; i.e., +// +// Plus(weight, Weight::One()) == Weight::One() +template ::value>::type * = + nullptr> +void Prune(MutableFst *fst, const PruneOptions &opts = + PruneOptions()) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using StateHeap = Heap>; + auto ns = fst->NumStates(); + if (ns < 1) return; + std::vector idistance(ns, Weight::Zero()); + std::vector tmp; + if (!opts.distance) { + tmp.reserve(ns); + ShortestDistance(*fst, &tmp, true, opts.delta); + } + const auto *fdistance = opts.distance ? opts.distance : &tmp; + if ((opts.state_threshold == 0) || (fdistance->size() <= fst->Start()) || + ((*fdistance)[fst->Start()] == Weight::Zero())) { + fst->DeleteStates(); + return; + } + internal::PruneCompare compare(idistance, *fdistance); + StateHeap heap(compare); + std::vector visited(ns, false); + std::vector enqueued(ns, StateHeap::kNoKey); + std::vector dead; + dead.push_back(fst->AddState()); + NaturalLess less; + auto s = fst->Start(); + const auto limit = opts.threshold_initial ? + Times(opts.weight_threshold, (*fdistance)[s]) : + Times((*fdistance)[s], opts.weight_threshold); + StateId num_visited = 0; + + if (!less(limit, (*fdistance)[s])) { + idistance[s] = Weight::One(); + enqueued[s] = heap.Insert(s); + ++num_visited; + } + while (!heap.Empty()) { + s = heap.Top(); + heap.Pop(); + enqueued[s] = StateHeap::kNoKey; + visited[s] = true; + if (less(limit, Times(idistance[s], fst->Final(s)))) { + fst->SetFinal(s, Weight::Zero()); + } + for (MutableArcIterator> aiter(fst, s); !aiter.Done(); + aiter.Next()) { + auto arc = aiter.Value(); // Copy intended. + if (!opts.filter(arc)) continue; + const auto weight = Times(Times(idistance[s], arc.weight), + arc.nextstate < fdistance->size() ? + (*fdistance)[arc.nextstate] : Weight::Zero()); + if (less(limit, weight)) { + arc.nextstate = dead[0]; + aiter.SetValue(arc); + continue; + } + if (less(Times(idistance[s], arc.weight), idistance[arc.nextstate])) { + idistance[arc.nextstate] = Times(idistance[s], arc.weight); + } + if (visited[arc.nextstate]) continue; + if ((opts.state_threshold != kNoStateId) && + (num_visited >= opts.state_threshold)) { + continue; + } + if (enqueued[arc.nextstate] == StateHeap::kNoKey) { + enqueued[arc.nextstate] = heap.Insert(arc.nextstate); + ++num_visited; + } else { + heap.Update(enqueued[arc.nextstate], arc.nextstate); + } + } + } + for (StateId i = 0; i < visited.size(); ++i) { + if (!visited[i]) dead.push_back(i); + } + fst->DeleteStates(dead); +} + +template ::value>::type + * = nullptr> +void Prune(MutableFst *fst, const PruneOptions &opts = + PruneOptions()) { + FSTERROR() << "Prune: Weight needs to have the path property: " + << Arc::Weight::Type(); + fst->SetProperties(kError, kError); +} + +// Pruning algorithm: this version modifies its input and takes the +// pruning threshold as an argument. It deletes states and arcs in the +// FST that do not belong to a successful path whose weight is more +// than the weight of the shortest path Times() the provided weight +// threshold. When the state threshold is not kNoStateId, the output +// FST is further restricted to have no more than the number of states +// in opts.state_threshold. Weights must have the path property. The +// weight of any cycle needs to be bounded; i.e., +// +// Plus(weight, Weight::One()) == Weight::One() +template +void Prune(MutableFst *fst, typename Arc::Weight weight_threshold, + typename Arc::StateId state_threshold = kNoStateId, + float delta = kDelta) { + const PruneOptions> opts( + weight_threshold, state_threshold, AnyArcFilter(), nullptr, delta); + Prune(fst, opts); +} + +// Pruning algorithm: this version writes the pruned input FST to an +// output MutableFst and it takes an options class as an argument. The +// output FST contains states and arcs that belong to a successful +// path in the input FST whose weight is more than the weight of the +// shortest path Times() the provided weight threshold. When the state +// threshold is not kNoStateId, the output FST is further restricted +// to have no more than the number of states in +// opts.state_threshold. Weights have the path property. The weight +// of any cycle needs to be bounded; i.e., +// +// Plus(weight, Weight::One()) == Weight::One() +template ::value>::type * = + nullptr> +void Prune( + const Fst &ifst, MutableFst *ofst, + const PruneOptions &opts = PruneOptions()) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using StateHeap = Heap>; + ofst->DeleteStates(); + ofst->SetInputSymbols(ifst.InputSymbols()); + ofst->SetOutputSymbols(ifst.OutputSymbols()); + if (ifst.Start() == kNoStateId) return; + NaturalLess less; + if (less(opts.weight_threshold, Weight::One()) || + (opts.state_threshold == 0)) { + return; + } + std::vector idistance; + std::vector tmp; + if (!opts.distance) ShortestDistance(ifst, &tmp, true, opts.delta); + const auto *fdistance = opts.distance ? opts.distance : &tmp; + if ((fdistance->size() <= ifst.Start()) || + ((*fdistance)[ifst.Start()] == Weight::Zero())) { + return; + } + internal::PruneCompare compare(idistance, *fdistance); + StateHeap heap(compare); + std::vector copy; + std::vector enqueued; + std::vector visited; + auto s = ifst.Start(); + const auto limit = opts.threshold_initial ? + Times(opts.weight_threshold, (*fdistance)[s]) : + Times((*fdistance)[s], opts.weight_threshold); + while (copy.size() <= s) copy.push_back(kNoStateId); + copy[s] = ofst->AddState(); + ofst->SetStart(copy[s]); + while (idistance.size() <= s) idistance.push_back(Weight::Zero()); + idistance[s] = Weight::One(); + while (enqueued.size() <= s) { + enqueued.push_back(StateHeap::kNoKey); + visited.push_back(false); + } + enqueued[s] = heap.Insert(s); + while (!heap.Empty()) { + s = heap.Top(); + heap.Pop(); + enqueued[s] = StateHeap::kNoKey; + visited[s] = true; + if (!less(limit, Times(idistance[s], ifst.Final(s)))) { + ofst->SetFinal(copy[s], ifst.Final(s)); + } + for (ArcIterator> aiter(ifst, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + if (!opts.filter(arc)) continue; + const auto weight = Times(Times(idistance[s], arc.weight), + arc.nextstate < fdistance->size() ? + (*fdistance)[arc.nextstate] : Weight::Zero()); + if (less(limit, weight)) continue; + if ((opts.state_threshold != kNoStateId) && + (ofst->NumStates() >= opts.state_threshold)) { + continue; + } + while (idistance.size() <= arc.nextstate) { + idistance.push_back(Weight::Zero()); + } + if (less(Times(idistance[s], arc.weight), idistance[arc.nextstate])) { + idistance[arc.nextstate] = Times(idistance[s], arc.weight); + } + while (copy.size() <= arc.nextstate) copy.push_back(kNoStateId); + if (copy[arc.nextstate] == kNoStateId) { + copy[arc.nextstate] = ofst->AddState(); + } + ofst->AddArc(copy[s], Arc(arc.ilabel, arc.olabel, arc.weight, + copy[arc.nextstate])); + while (enqueued.size() <= arc.nextstate) { + enqueued.push_back(StateHeap::kNoKey); + visited.push_back(false); + } + if (visited[arc.nextstate]) continue; + if (enqueued[arc.nextstate] == StateHeap::kNoKey) { + enqueued[arc.nextstate] = heap.Insert(arc.nextstate); + } else { + heap.Update(enqueued[arc.nextstate], arc.nextstate); + } + } + } +} + +template ::value>::type + * = nullptr> +void Prune(const Fst &, MutableFst *ofst, + const PruneOptions &) { + FSTERROR() << "Prune: Weight needs to have the path property: " + << Arc::Weight::Type(); + ofst->SetProperties(kError, kError); +} + +// Pruning algorithm: this version writes the pruned input FST to an +// output MutableFst and simply takes the pruning threshold as an +// argument. The output FST contains states and arcs that belong to a +// successful path in the input FST whose weight is no more than the +// weight of the shortest path Times() the provided weight +// threshold. When the state threshold is not kNoStateId, the output +// FST is further restricted to have no more than the number of states +// in opts.state_threshold. Weights must have the path property. The +// weight of any cycle needs to be bounded; i.e., +// +// Plus(weight, Weight::One()) = Weight::One(); +template +void Prune(const Fst &ifst, MutableFst *ofst, + typename Arc::Weight weight_threshold, + typename Arc::StateId state_threshold = kNoStateId, + float delta = kDelta) { + const PruneOptions> opts( + weight_threshold, state_threshold, AnyArcFilter(), nullptr, delta); + Prune(ifst, ofst, opts); +} + +} // namespace fst + +#endif // FST_PRUNE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/push.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/push.h new file mode 100644 index 0000000..1f77273 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/push.h @@ -0,0 +1,155 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to reweight/push an FST, and utility functions to weigh and reweight +// an FST. + +#ifndef FST_PUSH_H_ +#define FST_PUSH_H_ + +#include + +#include + +#include +#include +#include +#include +#include + + +namespace fst { + +// Computes the total weight (sum of the weights of all accepting paths) from +// the output of ShortestDistance, using the shortest distance from the final +// state when reverse is true and from the initial state otherwise. +template +typename Arc::Weight ComputeTotalWeight( + const Fst &fst, const std::vector &distance, + bool reverse) { + if (reverse) { + return fst.Start() < distance.size() ? distance[fst.Start()] + : Arc::Weight::Zero(); + } + auto sum = Arc::Weight::Zero(); + for (typename Arc::StateId s = 0; s < distance.size(); ++s) { + sum = Plus(sum, Times(distance[s], fst.Final(s))); + } + return sum; +} + +// Divides the weight of every accepting path by a fixed weight. This weight +// is also divided at the final state if at_final is true and at the initial +// state otherwise. +template +void RemoveWeight(MutableFst *fst, const typename Arc::Weight &weight, + bool at_final) { + using Weight = typename Arc::Weight; + if ((weight == Weight::One()) || (weight == Weight::Zero())) return; + if (at_final) { + for (StateIterator> siter(*fst); !siter.Done(); + siter.Next()) { + fst->SetFinal(siter.Value(), + Divide(fst->Final(siter.Value()), weight, DIVIDE_RIGHT)); + } + } else { + const auto start = fst->Start(); + for (MutableArcIterator> aiter(fst, start); !aiter.Done(); + aiter.Next()) { + auto arc = aiter.Value(); + arc.weight = Divide(arc.weight, weight, DIVIDE_LEFT); + aiter.SetValue(arc); + } + fst->SetFinal(start, Divide(fst->Final(start), weight, DIVIDE_LEFT)); + } +} + +// Pushes the weights in FST in the direction defined by TYPE. If +// pushing towards the initial state, the sum of the weight of the +// outgoing transitions and final weight at a non-initial state is +// equal to One() in the resulting machine. If pushing towards the +// final state, the same property holds on the reverse machine. +// +// Weight needs to be left distributive when pushing towards the +// initial state and right distributive when pushing towards the final +// states. +template +void Push(MutableFst *fst, ReweightType type, float delta = kDelta, + bool remove_total_weight = false) { + using Weight = typename Arc::Weight; + std::vector distance; + ShortestDistance(*fst, &distance, type == REWEIGHT_TO_INITIAL, delta); + auto total_weight = Weight::One(); + if (remove_total_weight) { + total_weight = + ComputeTotalWeight(*fst, distance, type == REWEIGHT_TO_INITIAL); + } + Reweight(fst, distance, type); + if (remove_total_weight) { + RemoveWeight(fst, total_weight, type == REWEIGHT_TO_FINAL); + } +} + +constexpr uint32 kPushWeights = 0x0001; +constexpr uint32 kPushLabels = 0x0002; +constexpr uint32 kPushRemoveTotalWeight = 0x0004; +constexpr uint32 kPushRemoveCommonAffix = 0x0008; + +// Pushes the weights and/or labels of the input FST into the output +// mutable FST by pushing weights and/or labels (as determined by the +// ptype argument) towards the initial state or final states (as +// determined by the rtype template parameter). The weight type must +// be left distributive when pushing weights towards the initial state, and +// right distribution when pushing weights towards the final states. +template +void Push(const Fst &ifst, MutableFst *ofst, uint32 ptype, + float delta = kDelta) { + using Label = typename Arc::Label; + using Weight = typename Arc::Weight; + if ((ptype & (kPushWeights | kPushLabels)) == kPushWeights) { + *ofst = ifst; + Push(ofst, rtype, delta, ptype & kPushRemoveTotalWeight); + } else if (ptype & kPushLabels) { + const auto gtype = + rtype == REWEIGHT_TO_INITIAL ? GALLIC_LEFT : GALLIC_RIGHT; + using GallicWeight = typename GallicArc::Weight; + std::vector gdistance; + VectorFst> gfst; + ArcMap(ifst, &gfst, ToGallicMapper()); + if (ptype & kPushWeights) { + ShortestDistance(gfst, &gdistance, rtype == REWEIGHT_TO_INITIAL, delta); + } else { + ArcMapFst> uwfst(ifst, + RmWeightMapper()); + ArcMapFst, ToGallicMapper> guwfst( + uwfst, ToGallicMapper()); + ShortestDistance(guwfst, &gdistance, rtype == REWEIGHT_TO_INITIAL, delta); + } + auto total_weight = GallicWeight::One(); + if (ptype & (kPushRemoveTotalWeight | kPushRemoveCommonAffix)) { + total_weight = + ComputeTotalWeight(gfst, gdistance, rtype == REWEIGHT_TO_INITIAL); + total_weight = GallicWeight( + ptype & kPushRemoveCommonAffix + ? total_weight.Value1() + : StringWeight::One(), + ptype & kPushRemoveTotalWeight ? total_weight.Value2() + : Weight::One()); + } + Reweight(&gfst, gdistance, rtype); + if (ptype & (kPushRemoveTotalWeight | kPushRemoveCommonAffix)) { + RemoveWeight(&gfst, total_weight, rtype == REWEIGHT_TO_FINAL); + } + FactorWeightFst, GallicFactor> + fwfst(gfst); + ArcMap(fwfst, ofst, FromGallicMapper()); + ofst->SetOutputSymbols(ifst.OutputSymbols()); + } else { + LOG(WARNING) << "Push: pushing type is set to 0, so not pushing"; + *ofst = ifst; + } +} + +} // namespace fst + +#endif // FST_PUSH_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/queue.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/queue.h new file mode 100644 index 0000000..f57d176 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/queue.h @@ -0,0 +1,948 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes for various FST state queues with a unified interface. + +#ifndef FST_QUEUE_H_ +#define FST_QUEUE_H_ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + + +namespace fst { + +// The Queue interface is: +// +// template +// class Queue { +// public: +// using StateId = S; +// +// // Constructor: may need args (e.g., FST, comparator) for some queues. +// Queue(...) override; +// +// // Returns the head of the queue. +// StateId Head() const override; +// +// // Inserts a state. +// void Enqueue(StateId s) override; +// +// // Removes the head of the queue. +// void Dequeue() override; +// +// // Updates ordering of state s when weight changes, if necessary. +// void Update(StateId s) override; +// +// // Is the queue empty? +// bool Empty() const override; +// +// // Removes all states from the queue. +// void Clear() override; +// }; + +// State queue types. +enum QueueType { + TRIVIAL_QUEUE = 0, // Single state queue. + FIFO_QUEUE = 1, // First-in, first-out queue. + LIFO_QUEUE = 2, // Last-in, first-out queue. + SHORTEST_FIRST_QUEUE = 3, // Shortest-first queue. + TOP_ORDER_QUEUE = 4, // Topologically-ordered queue. + STATE_ORDER_QUEUE = 5, // State ID-ordered queue. + SCC_QUEUE = 6, // Component graph top-ordered meta-queue. + AUTO_QUEUE = 7, // Auto-selected queue. + OTHER_QUEUE = 8 +}; + +// QueueBase, templated on the StateId, is a virtual base class shared by all +// queues considered by AutoQueue. +template +class QueueBase { + public: + using StateId = S; + + virtual ~QueueBase() {} + + // Concrete implementation. + + explicit QueueBase(QueueType type) : queue_type_(type), error_(false) {} + + void SetError(bool error) { error_ = error; } + + bool Error() const { return error_; } + + QueueType Type() const { return queue_type_; } + + // Virtual interface. + + virtual StateId Head() const = 0; + virtual void Enqueue(StateId) = 0; + virtual void Dequeue() = 0; + virtual void Update(StateId) = 0; + virtual bool Empty() const = 0; + virtual void Clear() = 0; + + private: + QueueType queue_type_; + bool error_; +}; + +// Trivial queue discipline; one may enqueue at most one state at a time. It +// can be used for strongly connected components with only one state and no +// self-loops. +template +class TrivialQueue : public QueueBase { + public: + using StateId = S; + + TrivialQueue() : QueueBase(TRIVIAL_QUEUE), front_(kNoStateId) {} + + virtual ~TrivialQueue() = default; + + StateId Head() const final { return front_; } + + void Enqueue(StateId s) final { front_ = s; } + + void Dequeue() final { front_ = kNoStateId; } + + void Update(StateId) final {} + + bool Empty() const final { return front_ == kNoStateId; } + + void Clear() final { front_ = kNoStateId; } + + private: + StateId front_; +}; + +// First-in, first-out queue discipline. +// +// This is not a final class. +template +class FifoQueue : public QueueBase { + public: + using StateId = S; + + FifoQueue() : QueueBase(FIFO_QUEUE) {} + + virtual ~FifoQueue() = default; + + StateId Head() const override { return queue_.back(); } + + void Enqueue(StateId s) override { queue_.push_front(s); } + + void Dequeue() override { queue_.pop_back(); } + + void Update(StateId) override {} + + bool Empty() const override { return queue_.empty(); } + + void Clear() override { queue_.clear(); } + + private: + std::deque queue_; +}; + +// Last-in, first-out queue discipline. +template +class LifoQueue : public QueueBase { + public: + using StateId = S; + + LifoQueue() : QueueBase(LIFO_QUEUE) {} + + virtual ~LifoQueue() = default; + + StateId Head() const final { return queue_.front(); } + + void Enqueue(StateId s) final { queue_.push_front(s); } + + void Dequeue() final { queue_.pop_front(); } + + void Update(StateId) final {} + + bool Empty() const final { return queue_.empty(); } + + void Clear() final { queue_.clear(); } + + private: + std::deque queue_; +}; + +// Shortest-first queue discipline, templated on the StateId and as well as a +// comparison functor used to compare two StateIds. If a (single) state's order +// changes, it can be reordered in the queue with a call to Update(). If update +// is false, call to Update() does not reorder the queue. +// +// This is not a final class. +template +class ShortestFirstQueue : public QueueBase { + public: + using StateId = S; + + explicit ShortestFirstQueue(Compare comp) + : QueueBase(SHORTEST_FIRST_QUEUE), heap_(comp) {} + + virtual ~ShortestFirstQueue() = default; + + StateId Head() const override { return heap_.Top(); } + + void Enqueue(StateId s) override { + if (update) { + for (StateId i = key_.size(); i <= s; ++i) key_.push_back(kNoStateId); + key_[s] = heap_.Insert(s); + } else { + heap_.Insert(s); + } + } + + void Dequeue() override { + if (update) { + key_[heap_.Pop()] = kNoStateId; + } else { + heap_.Pop(); + } + } + + void Update(StateId s) override { + if (!update) return; + if (s >= key_.size() || key_[s] == kNoStateId) { + Enqueue(s); + } else { + heap_.Update(key_[s], s); + } + } + + bool Empty() const override { return heap_.Empty(); } + + void Clear() override { + heap_.Clear(); + if (update) key_.clear(); + } + + const Compare &GetCompare() const { return heap_.GetCompare(); } + + private: + Heap heap_; + std::vector key_; +}; + +namespace internal { + +// Given a vector that maps from states to weights, and a comparison functor +// for weights, this class defines a comparison function object between states. +template +class StateWeightCompare { + public: + using Weight = typename Less::Weight; + + StateWeightCompare(const std::vector &weights, const Less &less) + : weights_(weights), less_(less) {} + + bool operator()(const StateId s1, const StateId s2) const { + return less_(weights_[s1], weights_[s2]); + } + + private: + // Borrowed references. + const std::vector &weights_; + const Less &less_; +}; + +} // namespace internal + +// Shortest-first queue discipline, templated on the StateId and Weight, is +// specialized to use the weight's natural order for the comparison function. +template +class NaturalShortestFirstQueue + : public ShortestFirstQueue< + S, internal::StateWeightCompare>> { + public: + using StateId = S; + using Compare = internal::StateWeightCompare>; + + explicit NaturalShortestFirstQueue(const std::vector &distance) + : ShortestFirstQueue(Compare(distance, less_)) {} + + virtual ~NaturalShortestFirstQueue() = default; + + private: + // This is non-static because the constructor for non-idempotent weights will + // result in an error. + const NaturalLess less_{}; +}; + +// In a shortest path computation on a lattice-like FST, we may keep many old +// nonviable paths as a part of the search. Since the search process always +// expands the lowest cost path next, that lowest cost path may be a very old +// nonviable path instead of one we expect to lead to a shortest path. +// +// For instance, suppose that the current best path in an alignment has +// traversed 500 arcs with a cost of 10. We may also have a bad path in +// the queue that has traversed only 40 arcs but also has a cost of 10. +// This path is very unlikely to lead to a reasonable alignment, so this queue +// can prune it from the search space. +// +// This queue relies on the caller using a shortest-first exploration order +// like this: +// while (true) { +// StateId head = queue.Head(); +// queue.Dequeue(); +// for (const auto& arc : GetArcs(fst, head)) { +// queue.Enqueue(arc.nextstate); +// } +// } +// We use this assumption to guess that there is an arc between Head and the +// Enqueued state; this is how the number of path steps is measured. +template +class PruneNaturalShortestFirstQueue + : public NaturalShortestFirstQueue { + public: + using StateId = S; + using Base = NaturalShortestFirstQueue; + + explicit PruneNaturalShortestFirstQueue(const std::vector &distance, + int threshold) + : Base(distance), + threshold_(threshold), + head_steps_(0), + max_head_steps_(0) {} + + ~PruneNaturalShortestFirstQueue() override = default; + + StateId Head() const override { + const auto head = Base::Head(); + // Stores the number of steps from the start of the graph to this state + // along the shortest-weight path. + if (head < steps_.size()) { + max_head_steps_ = std::max(steps_[head], max_head_steps_); + head_steps_ = steps_[head]; + } + return head; + } + + void Enqueue(StateId s) override { + // We assume that there is an arc between the Head() state and this + // Enqueued state. + const ssize_t state_steps = head_steps_ + 1; + if (s >= steps_.size()) { + steps_.resize(s + 1, state_steps); + } + // This is the number of arcs in the minimum cost path from Start to s. + steps_[s] = state_steps; + if (state_steps > (max_head_steps_ - threshold_) || threshold_ < 0) { + Base::Enqueue(s); + } + } + + private: + // A dense map from StateId to the number of arcs in the minimum weight + // path from Start to this state. + std::vector steps_; + // We only keep paths that are within this number of arcs (not weight!) + // of the longest path. + const ssize_t threshold_; + + // The following are mutable because Head() is const. + // The number of arcs traversed in the minimum cost path from the start + // state to the current Head() state. + mutable ssize_t head_steps_; + // The maximum number of arcs traversed by any low-cost path so far. + mutable ssize_t max_head_steps_; +}; + +// Topological-order queue discipline, templated on the StateId. States are +// ordered in the queue topologically. The FST must be acyclic. +template +class TopOrderQueue : public QueueBase { + public: + using StateId = S; + + // This constructor computes the topological order. It accepts an arc filter + // to limit the transitions considered in that computation (e.g., only the + // epsilon graph). + template + TopOrderQueue(const Fst &fst, ArcFilter filter) + : QueueBase(TOP_ORDER_QUEUE), + front_(0), + back_(kNoStateId), + order_(0), + state_(0) { + bool acyclic; + TopOrderVisitor top_order_visitor(&order_, &acyclic); + DfsVisit(fst, &top_order_visitor, filter); + if (!acyclic) { + FSTERROR() << "TopOrderQueue: FST is not acyclic"; + QueueBase::SetError(true); + } + state_.resize(order_.size(), kNoStateId); + } + + // This constructor is passed the pre-computed topological order. + explicit TopOrderQueue(const std::vector &order) + : QueueBase(TOP_ORDER_QUEUE), + front_(0), + back_(kNoStateId), + order_(order), + state_(order.size(), kNoStateId) {} + + virtual ~TopOrderQueue() = default; + + StateId Head() const final { return state_[front_]; } + + void Enqueue(StateId s) final { + if (front_ > back_) { + front_ = back_ = order_[s]; + } else if (order_[s] > back_) { + back_ = order_[s]; + } else if (order_[s] < front_) { + front_ = order_[s]; + } + state_[order_[s]] = s; + } + + void Dequeue() final { + state_[front_] = kNoStateId; + while ((front_ <= back_) && (state_[front_] == kNoStateId)) ++front_; + } + + void Update(StateId) final {} + + bool Empty() const final { return front_ > back_; } + + void Clear() final { + for (StateId s = front_; s <= back_; ++s) state_[s] = kNoStateId; + back_ = kNoStateId; + front_ = 0; + } + + private: + StateId front_; + StateId back_; + std::vector order_; + std::vector state_; +}; + +// State order queue discipline, templated on the StateId. States are ordered in +// the queue by state ID. +template +class StateOrderQueue : public QueueBase { + public: + using StateId = S; + + StateOrderQueue() + : QueueBase(STATE_ORDER_QUEUE), front_(0), back_(kNoStateId) {} + + virtual ~StateOrderQueue() = default; + + StateId Head() const final { return front_; } + + void Enqueue(StateId s) final { + if (front_ > back_) { + front_ = back_ = s; + } else if (s > back_) { + back_ = s; + } else if (s < front_) { + front_ = s; + } + while (enqueued_.size() <= s) enqueued_.push_back(false); + enqueued_[s] = true; + } + + void Dequeue() final { + enqueued_[front_] = false; + while ((front_ <= back_) && (enqueued_[front_] == false)) ++front_; + } + + void Update(StateId) final {} + + bool Empty() const final { return front_ > back_; } + + void Clear() final { + for (StateId i = front_; i <= back_; ++i) enqueued_[i] = false; + front_ = 0; + back_ = kNoStateId; + } + + private: + StateId front_; + StateId back_; + std::vector enqueued_; +}; + +// SCC topological-order meta-queue discipline, templated on the StateId and a +// queue used inside each SCC. It visits the SCCs of an FST in topological +// order. Its constructor is passed the queues to to use within an SCC. +template +class SccQueue : public QueueBase { + public: + using StateId = S; + + // Constructor takes a vector specifying the SCC number per state and a + // vector giving the queue to use per SCC number. + SccQueue(const std::vector &scc, + std::vector> *queue) + : QueueBase(SCC_QUEUE), + queue_(queue), + scc_(scc), + front_(0), + back_(kNoStateId) {} + + virtual ~SccQueue() = default; + + StateId Head() const final { + while ((front_ <= back_) && + (((*queue_)[front_] && (*queue_)[front_]->Empty()) || + (((*queue_)[front_] == nullptr) && + ((front_ >= trivial_queue_.size()) || + (trivial_queue_[front_] == kNoStateId))))) { + ++front_; + } + if ((*queue_)[front_]) { + return (*queue_)[front_]->Head(); + } else { + return trivial_queue_[front_]; + } + } + + void Enqueue(StateId s) final { + if (front_ > back_) { + front_ = back_ = scc_[s]; + } else if (scc_[s] > back_) { + back_ = scc_[s]; + } else if (scc_[s] < front_) { + front_ = scc_[s]; + } + if ((*queue_)[scc_[s]]) { + (*queue_)[scc_[s]]->Enqueue(s); + } else { + while (trivial_queue_.size() <= scc_[s]) { + trivial_queue_.push_back(kNoStateId); + } + trivial_queue_[scc_[s]] = s; + } + } + + void Dequeue() final { + if ((*queue_)[front_]) { + (*queue_)[front_]->Dequeue(); + } else if (front_ < trivial_queue_.size()) { + trivial_queue_[front_] = kNoStateId; + } + } + + void Update(StateId s) final { + if ((*queue_)[scc_[s]]) (*queue_)[scc_[s]]->Update(s); + } + + bool Empty() const final { + // Queues SCC number back_ is not empty unless back_ == front_. + if (front_ < back_) { + return false; + } else if (front_ > back_) { + return true; + } else if ((*queue_)[front_]) { + return (*queue_)[front_]->Empty(); + } else { + return (front_ >= trivial_queue_.size()) || + (trivial_queue_[front_] == kNoStateId); + } + } + + void Clear() final { + for (StateId i = front_; i <= back_; ++i) { + if ((*queue_)[i]) { + (*queue_)[i]->Clear(); + } else if (i < trivial_queue_.size()) { + trivial_queue_[i] = kNoStateId; + } + } + front_ = 0; + back_ = kNoStateId; + } + + private: + std::vector> *queue_; + const std::vector &scc_; + mutable StateId front_; + StateId back_; + std::vector trivial_queue_; +}; + +// Automatic queue discipline. It selects a queue discipline for a given FST +// based on its properties. +template +class AutoQueue : public QueueBase { + public: + using StateId = S; + + // This constructor takes a state distance vector that, if non-null and if + // the Weight type has the path property, will entertain the shortest-first + // queue using the natural order w.r.t to the distance. + template + AutoQueue(const Fst &fst, + const std::vector *distance, ArcFilter filter) + : QueueBase(AUTO_QUEUE) { + using Weight = typename Arc::Weight; + using Less = NaturalLess; + using Compare = internal::StateWeightCompare; + // First checks if the FST is known to have these properties. + const auto props = + fst.Properties(kAcyclic | kCyclic | kTopSorted | kUnweighted, false); + if ((props & kTopSorted) || fst.Start() == kNoStateId) { + queue_.reset(new StateOrderQueue()); + VLOG(2) << "AutoQueue: using state-order discipline"; + } else if (props & kAcyclic) { + queue_.reset(new TopOrderQueue(fst, filter)); + VLOG(2) << "AutoQueue: using top-order discipline"; + } else if ((props & kUnweighted) && (Weight::Properties() & kIdempotent)) { + queue_.reset(new LifoQueue()); + VLOG(2) << "AutoQueue: using LIFO discipline"; + } else { + uint64 properties; + // Decomposes into strongly-connected components. + SccVisitor scc_visitor(&scc_, nullptr, nullptr, &properties); + DfsVisit(fst, &scc_visitor, filter); + auto nscc = *std::max_element(scc_.begin(), scc_.end()) + 1; + std::vector queue_types(nscc); + std::unique_ptr less; + std::unique_ptr comp; + if (distance && (Weight::Properties() & kPath) == kPath) { + less.reset(new Less); + comp.reset(new Compare(*distance, *less)); + } + // Finds the queue type to use per SCC. + bool unweighted; + bool all_trivial; + SccQueueType(fst, scc_, &queue_types, filter, less.get(), &all_trivial, + &unweighted); + // If unweighted and semiring is idempotent, uses LIFO queue. + if (unweighted) { + queue_.reset(new LifoQueue()); + VLOG(2) << "AutoQueue: using LIFO discipline"; + return; + } + // If all the SCC are trivial, the FST is acyclic and the scc number gives + // the topological order. + if (all_trivial) { + queue_.reset(new TopOrderQueue(scc_)); + VLOG(2) << "AutoQueue: using top-order discipline"; + return; + } + VLOG(2) << "AutoQueue: using SCC meta-discipline"; + queues_.resize(nscc); + for (StateId i = 0; i < nscc; ++i) { + switch (queue_types[i]) { + case TRIVIAL_QUEUE: + queues_[i].reset(); + VLOG(3) << "AutoQueue: SCC #" << i << ": using trivial discipline"; + break; + case SHORTEST_FIRST_QUEUE: + queues_[i].reset( + new ShortestFirstQueue(*comp)); + VLOG(3) << "AutoQueue: SCC #" << i + << ": using shortest-first discipline"; + break; + case LIFO_QUEUE: + queues_[i].reset(new LifoQueue()); + VLOG(3) << "AutoQueue: SCC #" << i << ": using LIFO discipline"; + break; + case FIFO_QUEUE: + default: + queues_[i].reset(new FifoQueue()); + VLOG(3) << "AutoQueue: SCC #" << i << ": using FIFO discipine"; + break; + } + } + queue_.reset(new SccQueue>(scc_, &queues_)); + } + } + + virtual ~AutoQueue() = default; + + StateId Head() const final { return queue_->Head(); } + + void Enqueue(StateId s) final { queue_->Enqueue(s); } + + void Dequeue() final { queue_->Dequeue(); } + + void Update(StateId s) final { queue_->Update(s); } + + bool Empty() const final { return queue_->Empty(); } + + void Clear() final { queue_->Clear(); } + + private: + template + static void SccQueueType(const Fst &fst, const std::vector &scc, + std::vector *queue_types, + ArcFilter filter, Less *less, bool *all_trivial, + bool *unweighted); + + std::unique_ptr> queue_; + std::vector>> queues_; + std::vector scc_; +}; + +// Examines the states in an FST's strongly connected components and determines +// which type of queue to use per SCC. Stores result as a vector of QueueTypes +// which is assumed to have length equal to the number of SCCs. An arc filter +// is used to limit the transitions considered (e.g., only the epsilon graph). +// The argument all_trivial is set to true if every queue is the trivial queue. +// The argument unweighted is set to true if the semiring is idempotent and all +// the arc weights are equal to Zero() or One(). +template +template +void AutoQueue::SccQueueType(const Fst &fst, + const std::vector &scc, + std::vector *queue_type, + ArcFilter filter, Less *less, + bool *all_trivial, bool *unweighted) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + *all_trivial = true; + *unweighted = true; + for (StateId i = 0; i < queue_type->size(); ++i) { + (*queue_type)[i] = TRIVIAL_QUEUE; + } + for (StateIterator> sit(fst); !sit.Done(); sit.Next()) { + const auto state = sit.Value(); + for (ArcIterator> ait(fst, state); !ait.Done(); ait.Next()) { + const auto &arc = ait.Value(); + if (!filter(arc)) continue; + if (scc[state] == scc[arc.nextstate]) { + auto &type = (*queue_type)[scc[state]]; + if (!less || ((*less)(arc.weight, Weight::One()))) { + type = FIFO_QUEUE; + } else if ((type == TRIVIAL_QUEUE) || (type == LIFO_QUEUE)) { + if (!(Weight::Properties() & kIdempotent) || + (arc.weight != Weight::Zero() && arc.weight != Weight::One())) { + type = SHORTEST_FIRST_QUEUE; + } else { + type = LIFO_QUEUE; + } + } + if (type != TRIVIAL_QUEUE) *all_trivial = false; + } + if (!(Weight::Properties() & kIdempotent) || + (arc.weight != Weight::Zero() && arc.weight != Weight::One())) { + *unweighted = false; + } + } + } +} + +// An A* estimate is a function object that maps from a state ID to an +// estimate of the shortest distance to the final states. + +// A trivial A* estimate, yielding a queue which behaves the same in Dijkstra's +// algorithm. +template +struct TrivialAStarEstimate { + constexpr Weight operator()(StateId) const { return Weight::One(); } +}; + +// A non-trivial A* estimate using a vector of the estimated future costs. +template +class NaturalAStarEstimate { + public: + NaturalAStarEstimate(const std::vector &beta) : beta_(beta) {} + + const Weight &operator()(StateId s) const { + return (s < beta_.size()) ? beta_[s] : kZero; + } + + private: + static constexpr Weight kZero = Weight::Zero(); + + const std::vector &beta_; +}; + +template +constexpr Weight NaturalAStarEstimate::kZero; + +// Given a vector that maps from states to weights representing the shortest +// distance from the initial state, a comparison function object between +// weights, and an estimate of the shortest distance to the final states, this +// class defines a comparison function object between states. +template +class AStarWeightCompare { + public: + using StateId = S; + using Weight = typename Less::Weight; + + AStarWeightCompare(const std::vector &weights, const Less &less, + const Estimate &estimate) + : weights_(weights), less_(less), estimate_(estimate) {} + + bool operator()(StateId s1, StateId s2) const { + const auto w1 = Times(weights_[s1], estimate_(s1)); + const auto w2 = Times(weights_[s2], estimate_(s2)); + return less_(w1, w2); + } + + const Estimate &GetEstimate() const { return estimate_; } + + private: + const std::vector &weights_; + const Less &less_; + const Estimate &estimate_; +}; + +// A* queue discipline templated on StateId, Weight, and Estimate. +template +class NaturalAStarQueue : public ShortestFirstQueue< + S, AStarWeightCompare, Estimate>> { + public: + using StateId = S; + using Compare = AStarWeightCompare, Estimate>; + + NaturalAStarQueue(const std::vector &distance, + const Estimate &estimate) + : ShortestFirstQueue( + Compare(distance, less_, estimate)) {} + + ~NaturalAStarQueue() = default; + + private: + // This is non-static because the constructor for non-idempotent weights will + // result in an error. + const NaturalLess less_{}; +}; + +// A state equivalence class is a function object that maps from a state ID to +// an equivalence class (state) ID. The trivial equivalence class maps a state +// ID to itself. +template +struct TrivialStateEquivClass { + StateId operator()(StateId s) const { return s; } +}; + +// Distance-based pruning queue discipline: Enqueues a state only when its +// shortest distance (so far), as specified by distance, is less than (as +// specified by comp) the shortest distance Times() the threshold to any state +// in the same equivalence class, as specified by the functor class_func. The +// underlying queue discipline is specified by queue. The ownership of queue is +// given to this class. +// +// This is not a final class. +template +class PruneQueue : public QueueBase { + public: + using StateId = typename Queue::StateId; + using Weight = typename Less::Weight; + + PruneQueue(const std::vector &distance, Queue *queue, + const Less &less, const ClassFnc &class_fnc, Weight threshold) + : QueueBase(OTHER_QUEUE), + distance_(distance), + queue_(queue), + less_(less), + class_fnc_(class_fnc), + threshold_(std::move(threshold)) {} + + virtual ~PruneQueue() = default; + + StateId Head() const override { return queue_->Head(); } + + void Enqueue(StateId s) override { + const auto c = class_fnc_(s); + if (c >= class_distance_.size()) { + class_distance_.resize(c + 1, Weight::Zero()); + } + if (less_(distance_[s], class_distance_[c])) { + class_distance_[c] = distance_[s]; + } + // Enqueues only if below threshold limit. + const auto limit = Times(class_distance_[c], threshold_); + if (less_(distance_[s], limit)) queue_->Enqueue(s); + } + + void Dequeue() override { queue_->Dequeue(); } + + void Update(StateId s) override { + const auto c = class_fnc_(s); + if (less_(distance_[s], class_distance_[c])) { + class_distance_[c] = distance_[s]; + } + queue_->Update(s); + } + + bool Empty() const override { return queue_->Empty(); } + + void Clear() override { queue_->Clear(); } + + private: + const std::vector &distance_; // Shortest distance to state. + std::unique_ptr queue_; + const Less &less_; // Borrowed reference. + const ClassFnc &class_fnc_; // Equivalence class functor. + Weight threshold_; // Pruning weight threshold. + std::vector class_distance_; // Shortest distance to class. +}; + +// Pruning queue discipline (see above) using the weight's natural order for the +// comparison function. The ownership of the queue argument is given to this +// class. +template +class NaturalPruneQueue final + : public PruneQueue, ClassFnc> { + public: + using StateId = typename Queue::StateId; + + NaturalPruneQueue(const std::vector &distance, Queue *queue, + const ClassFnc &class_fnc, Weight threshold) + : PruneQueue, ClassFnc>( + distance, queue, NaturalLess(), class_fnc, threshold) {} + + virtual ~NaturalPruneQueue() = default; +}; + +// Filter-based pruning queue discipline: enqueues a state only if allowed by +// the filter, specified by the state filter functor argument. The underlying +// queue discipline is specified by the queue argument. The ownership of the +// queue is given to this class. +template +class FilterQueue : public QueueBase { + public: + using StateId = typename Queue::StateId; + + FilterQueue(Queue *queue, const Filter &filter) + : QueueBase(OTHER_QUEUE), queue_(queue), filter_(filter) {} + + virtual ~FilterQueue() = default; + + StateId Head() const final { return queue_->Head(); } + + // Enqueues only if allowed by state filter. + void Enqueue(StateId s) final { + if (filter_(s)) queue_->Enqueue(s); + } + + void Dequeue() final { queue_->Dequeue(); } + + void Update(StateId s) final {} + + bool Empty() const final { return queue_->Empty(); } + + void Clear() final { queue_->Clear(); } + + private: + std::unique_ptr queue_; + const Filter &filter_; +}; + +} // namespace fst + +#endif // FST_QUEUE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/randequivalent.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/randequivalent.h new file mode 100644 index 0000000..73108b4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/randequivalent.h @@ -0,0 +1,114 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Tests if two FSTS are equivalent by checking if random strings from one FST +// are transduced the same by both FSTs. + +#ifndef FST_RANDEQUIVALENT_H_ +#define FST_RANDEQUIVALENT_H_ + +#include + +#include +#include +#include +#include +#include +#include + + +namespace fst { + +// Test if two FSTs are stochastically equivalent by randomly generating +// random paths through the FSTs. +// +// For each randomly generated path, the algorithm computes for each +// of the two FSTs the sum of the weights of all the successful paths +// sharing the same input and output labels as the considered randomly +// generated path and checks that these two values are within a user-specified +// delta. Returns optional error value (when FLAGS_error_fatal = false). +template +bool RandEquivalent(const Fst &fst1, const Fst &fst2, + int32 num_paths, float delta, + const RandGenOptions &opts, + bool *error = nullptr) { + using Weight = typename Arc::Weight; + if (error) *error = false; + // Checks that the symbol table are compatible. + if (!CompatSymbols(fst1.InputSymbols(), fst2.InputSymbols()) || + !CompatSymbols(fst1.OutputSymbols(), fst2.OutputSymbols())) { + FSTERROR() << "RandEquivalent: Input/output symbol tables of 1st " + << "argument do not match input/output symbol tables of 2nd " + << "argument"; + if (error) *error = true; + return false; + } + static const ILabelCompare icomp; + static const OLabelCompare ocomp; + VectorFst sfst1(fst1); + VectorFst sfst2(fst2); + Connect(&sfst1); + Connect(&sfst2); + ArcSort(&sfst1, icomp); + ArcSort(&sfst2, icomp); + bool result = true; + for (int32 n = 0; n < num_paths; ++n) { + VectorFst path; + const auto &fst = rand() % 2 ? sfst1 : sfst2; // NOLINT + RandGen(fst, &path, opts); + VectorFst ipath(path); + VectorFst opath(path); + Project(&ipath, PROJECT_INPUT); + Project(&opath, PROJECT_OUTPUT); + VectorFst cfst1, pfst1; + Compose(ipath, sfst1, &cfst1); + ArcSort(&cfst1, ocomp); + Compose(cfst1, opath, &pfst1); + // Gives up if there are epsilon cycles in a non-idempotent semiring. + if (!(Weight::Properties() & kIdempotent) && + pfst1.Properties(kCyclic, true)) { + continue; + } + const auto sum1 = ShortestDistance(pfst1); + VectorFst cfst2; + Compose(ipath, sfst2, &cfst2); + ArcSort(&cfst2, ocomp); + VectorFst pfst2; + Compose(cfst2, opath, &pfst2); + // Gives up if there are epsilon cycles in a non-idempotent semiring. + if (!(Weight::Properties() & kIdempotent) && + pfst2.Properties(kCyclic, true)) { + continue; + } + const auto sum2 = ShortestDistance(pfst2); + if (!ApproxEqual(sum1, sum2, delta)) { + VLOG(1) << "Sum1 = " << sum1; + VLOG(1) << "Sum2 = " << sum2; + result = false; + break; + } + } + if (fst1.Properties(kError, false) || fst2.Properties(kError, false)) { + if (error) *error = true; + return false; + } + return result; +} + +// Tests if two FSTs are equivalent by randomly generating a nnum_paths paths +// (no longer than the path_length) using a user-specified seed, optionally +// indicating an error setting an optional error argument to true. +template +bool RandEquivalent(const Fst &fst1, const Fst &fst2, int32 num_paths, + float delta = kDelta, time_t seed = time(nullptr), + int32 max_length = std::numeric_limits::max(), + bool *error = nullptr) { + const UniformArcSelector uniform_selector(seed); + const RandGenOptions> opts(uniform_selector, + max_length); + return RandEquivalent(fst1, fst2, num_paths, delta, opts, error); +} + +} // namespace fst + +#endif // FST_RANDEQUIVALENT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/randgen.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/randgen.h new file mode 100644 index 0000000..5bcd9fd --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/randgen.h @@ -0,0 +1,756 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes and functions to generate random paths through an FST. + +#ifndef FST_RANDGEN_H_ +#define FST_RANDGEN_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fst { + +// The RandGenFst class is roughly similar to ArcMapFst in that it takes two +// template parameters denoting the input and output arc types. However, it also +// takes an additional template parameter which specifies a sampler object which +// samples (with replacement) arcs from an FST state. The sampler in turn takes +// a template parameter for a selector object which actually chooses the arc. +// +// Arc selector functors are used to select a random transition given an FST +// state s, returning a number N such that 0 <= N <= NumArcs(s). If N is +// NumArcs(s), then the final weight is selected; otherwise the N-th arc is +// selected. It is assumed these are not applied to any state which is neither +// final nor has any arcs leaving it. + +// Randomly selects a transition using the uniform distribution. This class is +// not thread-safe. +template +class UniformArcSelector { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // Constructs a selector with a non-deterministic seed. + UniformArcSelector() : rand_(std::random_device()()) {} + // Constructs a selector with a given seed. + explicit UniformArcSelector(uint64 seed) : rand_(seed) {} + + size_t operator()(const Fst &fst, StateId s) const { + const auto n = fst.NumArcs(s) + (fst.Final(s) != Weight::Zero()); + return static_cast( + std::uniform_int_distribution<>(0, n - 1)(rand_)); + } + + private: + mutable std::mt19937_64 rand_; +}; + +// Randomly selects a transition w.r.t. the weights treated as negative log +// probabilities after normalizing for the total weight leaving the state. Zero +// transitions are disregarded. It assumed that Arc::Weight::Value() accesses +// the floating point representation of the weight. This class is not +// thread-safe. +template +class LogProbArcSelector { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // Constructs a selector with a non-deterministic seed. + LogProbArcSelector() : seed_(std::random_device()()), rand_(seed_) {} + // Constructs a selector with a given seed. + explicit LogProbArcSelector(uint64 seed) : seed_(seed), rand_(seed) {} + + size_t operator()(const Fst &fst, StateId s) const { + // Finds total weight leaving state. + auto sum = Log64Weight::Zero(); + ArcIterator> aiter(fst, s); + for (; !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + sum = Plus(sum, to_log_weight_(arc.weight)); + } + sum = Plus(sum, to_log_weight_(fst.Final(s))); + const double threshold = + std::uniform_real_distribution<>(0, exp(-sum.Value()))(rand_); + auto p = Log64Weight::Zero(); + size_t n = 0; + for (aiter.Reset(); !aiter.Done(); aiter.Next(), ++n) { + p = Plus(p, to_log_weight_(aiter.Value().weight)); + if (exp(-p.Value()) > threshold) return n; + } + return n; + } + + uint64 Seed() const { return seed_; } + + protected: + Log64Weight ToLogWeight(const Weight &weight) const { + return to_log_weight_(weight); + } + + std::mt19937_64 &MutableRand() const { return rand_; } + + private: + const uint64 seed_; + mutable std::mt19937_64 rand_; + const WeightConvert to_log_weight_{}; +}; + +// Useful alias when using StdArc. +using StdArcSelector = LogProbArcSelector; + +// Same as LogProbArcSelector but use CacheLogAccumulator to cache the weight +// accumulation computations. This class is not thread-safe. +template +class FastLogProbArcSelector : public LogProbArcSelector { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using LogProbArcSelector::MutableRand; + using LogProbArcSelector::ToLogWeight; + using LogProbArcSelector::operator(); + + // Constructs a selector with a non-deterministic seed. + FastLogProbArcSelector() : LogProbArcSelector() {} + // Constructs a selector with a given seed. + explicit FastLogProbArcSelector(uint64 seed) : LogProbArcSelector( + seed) {} + + size_t operator()(const Fst &fst, StateId s, + CacheLogAccumulator *accumulator) const { + accumulator->SetState(s); + ArcIterator> aiter(fst, s); + // Finds total weight leaving state. + const double sum = + ToLogWeight(accumulator->Sum(fst.Final(s), &aiter, 0, fst.NumArcs(s))) + .Value(); + const double r = -log(std::uniform_real_distribution<>(0, 1)( + MutableRand())); + Weight w = from_log_weight_(r + sum); + aiter.Reset(); + return accumulator->LowerBound(w, &aiter); + } + + private: + const WeightConvert from_log_weight_{}; +}; + +// Random path state info maintained by RandGenFst and passed to samplers. +template +struct RandState { + using StateId = typename Arc::StateId; + + StateId state_id; // Current input FST state. + size_t nsamples; // Number of samples to be sampled at this state. + size_t length; // Length of path to this random state. + size_t select; // Previous sample arc selection. + const RandState *parent; // Previous random state on this path. + + explicit RandState(StateId state_id, size_t nsamples = 0, size_t length = 0, + size_t select = 0, const RandState *parent = nullptr) + : state_id(state_id), + nsamples(nsamples), + length(length), + select(select), + parent(parent) {} + + RandState() : RandState(kNoStateId) {} +}; + +// This class, given an arc selector, samples, with replacement, multiple random +// transitions from an FST's state. This is a generic version with a +// straightforward use of the arc selector. Specializations may be defined for +// arc selectors for greater efficiency or special behavior. +template +class ArcSampler { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // The max_length argument may be interpreted (or ignored) by a selector as + // it chooses. This generic version interprets this literally. + ArcSampler(const Fst &fst, const Selector &selector, + int32 max_length = std::numeric_limits::max()) + : fst_(fst), selector_(selector), max_length_(max_length) {} + + // Allow updating FST argument; pass only if changed. + ArcSampler(const ArcSampler &sampler, + const Fst *fst = nullptr) + : fst_(fst ? *fst : sampler.fst_), + selector_(sampler.selector_), + max_length_(sampler.max_length_) { + Reset(); + } + + // Samples a fixed number of samples from the given state. The length argument + // specifies the length of the path to the state. Returns true if the samples + // were collected. No samples may be collected if either there are no + // transitions leaving the state and the state is non-final, or if the path + // length has been exceeded. Iterator members are provided to read the samples + // in the order in which they were collected. + bool Sample(const RandState &rstate) { + sample_map_.clear(); + if ((fst_.NumArcs(rstate.state_id) == 0 && + fst_.Final(rstate.state_id) == Weight::Zero()) || + rstate.length == max_length_) { + Reset(); + return false; + } + for (size_t i = 0; i < rstate.nsamples; ++i) { + ++sample_map_[selector_(fst_, rstate.state_id)]; + } + Reset(); + return true; + } + + // More samples? + bool Done() const { return sample_iter_ == sample_map_.end(); } + + // Gets the next sample. + void Next() { ++sample_iter_; } + + std::pair Value() const { return *sample_iter_; } + + void Reset() { sample_iter_ = sample_map_.begin(); } + + bool Error() const { return false; } + + private: + const Fst &fst_; + const Selector &selector_; + const int32 max_length_; + + // Stores (N, K) as described for Value(). + std::map sample_map_; + std::map::const_iterator sample_iter_; + + ArcSampler &operator=(const ArcSampler &) = delete; +}; + +// Samples one sample of num_to_sample dimensions from a multinomial +// distribution parameterized by a vector of probabilities. The result +// container should be pre-initialized (e.g., an empty map or a zeroed vector +// sized the same as the vector of probabilities. +// probs.size()). +template +void OneMultinomialSample(const std::vector &probs, + size_t num_to_sample, Result *result, RNG *rng) { + // Left-over probability mass. + double norm = 0; + for (double p : probs) norm += p; + // Left-over number of samples needed. + for (size_t i = 0; i < probs.size(); ++i) { + size_t num_sampled = 0; + if (probs[i] > 0) { + std::binomial_distribution<> d(num_to_sample, probs[i] / norm); + num_sampled = d(*rng); + } + if (num_sampled != 0) (*result)[i] = num_sampled; + norm -= probs[i]; + num_to_sample -= num_sampled; + } +} + +// Specialization for FastLogProbArcSelector. +template +class ArcSampler> { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Accumulator = CacheLogAccumulator; + using Selector = FastLogProbArcSelector; + + ArcSampler(const Fst &fst, const Selector &selector, + int32 max_length = std::numeric_limits::max()) + : fst_(fst), + selector_(selector), + max_length_(max_length), + accumulator_(new Accumulator()) { + accumulator_->Init(fst); + rng_.seed(selector_.Seed()); + } + + ArcSampler(const ArcSampler &sampler, + const Fst *fst = nullptr) + : fst_(fst ? *fst : sampler.fst_), + selector_(sampler.selector_), + max_length_(sampler.max_length_) { + if (fst) { + accumulator_.reset(new Accumulator()); + accumulator_->Init(*fst); + } else { // Shallow copy. + accumulator_.reset(new Accumulator(*sampler.accumulator_)); + } + } + + bool Sample(const RandState &rstate) { + sample_map_.clear(); + if ((fst_.NumArcs(rstate.state_id) == 0 && + fst_.Final(rstate.state_id) == Weight::Zero()) || + rstate.length == max_length_) { + Reset(); + return false; + } + if (fst_.NumArcs(rstate.state_id) + 1 < rstate.nsamples) { + MultinomialSample(rstate); + Reset(); + return true; + } + for (size_t i = 0; i < rstate.nsamples; ++i) { + ++sample_map_[selector_(fst_, rstate.state_id, accumulator_.get())]; + } + Reset(); + return true; + } + + bool Done() const { return sample_iter_ == sample_map_.end(); } + + void Next() { ++sample_iter_; } + + std::pair Value() const { return *sample_iter_; } + + void Reset() { sample_iter_ = sample_map_.begin(); } + + bool Error() const { return accumulator_->Error(); } + + private: + using RNG = std::mt19937; + + // Sample according to the multinomial distribution of rstate.nsamples draws + // from p_. + void MultinomialSample(const RandState &rstate) { + p_.clear(); + for (ArcIterator> aiter(fst_, rstate.state_id); !aiter.Done(); + aiter.Next()) { + p_.push_back(exp(-to_log_weight_(aiter.Value().weight).Value())); + } + if (fst_.Final(rstate.state_id) != Weight::Zero()) { + p_.push_back(exp(-to_log_weight_(fst_.Final(rstate.state_id)).Value())); + } + if (rstate.nsamples < std::numeric_limits::max()) { + OneMultinomialSample(p_, rstate.nsamples, &sample_map_, &rng_); + } else { + for (size_t i = 0; i < p_.size(); ++i) { + sample_map_[i] = ceil(p_[i] * rstate.nsamples); + } + } + } + + const Fst &fst_; + const Selector &selector_; + const int32 max_length_; + + // Stores (N, K) for Value(). + std::map sample_map_; + std::map::const_iterator sample_iter_; + + std::unique_ptr accumulator_; + RNG rng_; // Random number generator. + std::vector p_; // Multinomial parameters. + const WeightConvert to_log_weight_{}; +}; + +// Options for random path generation with RandGenFst. The template argument is +// a sampler, typically the class ArcSampler. Ownership of the sampler is taken +// by RandGenFst. +template +struct RandGenFstOptions : public CacheOptions { + Sampler *sampler; // How to sample transitions at a state. + int32 npath; // Number of paths to generate. + bool weighted; // Is the output tree weighted by path count, or + // is it just an unweighted DAG? + bool remove_total_weight; // Remove total weight when output is weighted. + + RandGenFstOptions(const CacheOptions &opts, Sampler *sampler, int32 npath = 1, + bool weighted = true, bool remove_total_weight = false) + : CacheOptions(opts), + sampler(sampler), + npath(npath), + weighted(weighted), + remove_total_weight(remove_total_weight) {} +}; + +namespace internal { + +// Implementation of RandGenFst. +template +class RandGenFstImpl : public CacheImpl { + public: + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheBaseImpl>::EmplaceArc; + using CacheBaseImpl>::HasArcs; + using CacheBaseImpl>::HasFinal; + using CacheBaseImpl>::HasStart; + using CacheBaseImpl>::SetArcs; + using CacheBaseImpl>::SetFinal; + using CacheBaseImpl>::SetStart; + + using Label = typename FromArc::Label; + using StateId = typename FromArc::StateId; + using FromWeight = typename FromArc::Weight; + + using ToWeight = typename ToArc::Weight; + + RandGenFstImpl(const Fst &fst, + const RandGenFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + sampler_(opts.sampler), + npath_(opts.npath), + weighted_(opts.weighted), + remove_total_weight_(opts.remove_total_weight), + superfinal_(kNoLabel) { + SetType("randgen"); + SetProperties( + RandGenProperties(fst.Properties(kFstProperties, false), weighted_), + kCopyProperties); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + } + + RandGenFstImpl(const RandGenFstImpl &impl) + : CacheImpl(impl), + fst_(impl.fst_->Copy(true)), + sampler_(new Sampler(*impl.sampler_, fst_.get())), + npath_(impl.npath_), + weighted_(impl.weighted_), + superfinal_(kNoLabel) { + SetType("randgen"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + StateId Start() { + if (!HasStart()) { + const auto s = fst_->Start(); + if (s == kNoStateId) return kNoStateId; + SetStart(state_table_.size()); + state_table_.emplace_back( + new RandState(s, npath_, 0, 0, nullptr)); + } + return CacheImpl::Start(); + } + + ToWeight Final(StateId s) { + if (!HasFinal(s)) Expand(s); + return CacheImpl::Final(s); + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && + (fst_->Properties(kError, false) || sampler_->Error())) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + // Computes the outgoing transitions from a state, creating new destination + // states as needed. + void Expand(StateId s) { + if (s == superfinal_) { + SetFinal(s, ToWeight::One()); + SetArcs(s); + return; + } + SetFinal(s, ToWeight::Zero()); + const auto &rstate = *state_table_[s]; + sampler_->Sample(rstate); + ArcIterator> aiter(*fst_, rstate.state_id); + const auto narcs = fst_->NumArcs(rstate.state_id); + for (; !sampler_->Done(); sampler_->Next()) { + const auto &sample_pair = sampler_->Value(); + const auto pos = sample_pair.first; + const auto count = sample_pair.second; + double prob = static_cast(count) / rstate.nsamples; + if (pos < narcs) { // Regular transition. + aiter.Seek(sample_pair.first); + const auto &aarc = aiter.Value(); + auto weight = + weighted_ ? to_weight_(Log64Weight(-log(prob))) : ToWeight::One(); + EmplaceArc(s, aarc.ilabel, aarc.olabel, std::move(weight), + state_table_.size()); + auto *nrstate = new RandState(aarc.nextstate, count, + rstate.length + 1, pos, &rstate); + state_table_.emplace_back(nrstate); + } else { // Super-final transition. + if (weighted_) { + const auto weight = + remove_total_weight_ + ? to_weight_(Log64Weight(-log(prob))) + : to_weight_(Log64Weight(-log(prob * npath_))); + SetFinal(s, weight); + } else { + if (superfinal_ == kNoLabel) { + superfinal_ = state_table_.size(); + state_table_.emplace_back( + new RandState(kNoStateId, 0, 0, 0, nullptr)); + } + for (size_t n = 0; n < count; ++n) { + EmplaceArc(s, 0, 0, ToWeight::One(), superfinal_); + } + } + } + } + SetArcs(s); + } + + private: + const std::unique_ptr> fst_; + std::unique_ptr sampler_; + const int32 npath_; + std::vector>> state_table_; + const bool weighted_; + bool remove_total_weight_; + StateId superfinal_; + const WeightConvert to_weight_{}; +}; + +} // namespace internal + +// FST class to randomly generate paths through an FST, with details controlled +// by RandGenOptionsFst. Output format is a tree weighted by the path count. +template +class RandGenFst + : public ImplToFst> { + public: + using Label = typename FromArc::Label; + using StateId = typename FromArc::StateId; + using Weight = typename FromArc::Weight; + + using Store = DefaultCacheStore; + using State = typename Store::State; + + using Impl = internal::RandGenFstImpl; + + friend class ArcIterator>; + friend class StateIterator>; + + RandGenFst(const Fst &fst, const RandGenFstOptions &opts) + : ImplToFst(std::make_shared(fst, opts)) {} + + // See Fst<>::Copy() for doc. + RandGenFst(const RandGenFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Get a copy of this RandGenFst. See Fst<>::Copy() for further doc. + RandGenFst *Copy(bool safe = false) const override { + return new RandGenFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + RandGenFst &operator=(const RandGenFst &) = delete; +}; + +// Specialization for RandGenFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const RandGenFst &fst) + : CacheStateIterator>( + fst, fst.GetMutableImpl()) {} +}; + +// Specialization for RandGenFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename FromArc::StateId; + + ArcIterator(const RandGenFst &fst, StateId s) + : CacheArcIterator>( + fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void RandGenFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Options for random path generation. +template +struct RandGenOptions { + const Selector &selector; // How an arc is selected at a state. + int32 max_length; // Maximum path length. + int32 npath; // Number of paths to generate. + bool weighted; // Is the output tree weighted by path count, or + // is it just an unweighted DAG? + bool remove_total_weight; // Remove total weight when output is weighted? + + explicit RandGenOptions(const Selector &selector, + int32 max_length = std::numeric_limits::max(), + int32 npath = 1, bool weighted = false, + bool remove_total_weight = false) + : selector(selector), + max_length(max_length), + npath(npath), + weighted(weighted), + remove_total_weight(remove_total_weight) {} +}; + +namespace internal { + +template +class RandGenVisitor { + public: + using StateId = typename FromArc::StateId; + using Weight = typename FromArc::Weight; + + explicit RandGenVisitor(MutableFst *ofst) : ofst_(ofst) {} + + void InitVisit(const Fst &ifst) { + ifst_ = &ifst; + ofst_->DeleteStates(); + ofst_->SetInputSymbols(ifst.InputSymbols()); + ofst_->SetOutputSymbols(ifst.OutputSymbols()); + if (ifst.Properties(kError, false)) ofst_->SetProperties(kError, kError); + path_.clear(); + } + + constexpr bool InitState(StateId, StateId) const { return true; } + + bool TreeArc(StateId, const ToArc &arc) { + if (ifst_->Final(arc.nextstate) == Weight::Zero()) { + path_.push_back(arc); + } else { + OutputPath(); + } + return true; + } + + bool BackArc(StateId, const FromArc &) { + FSTERROR() << "RandGenVisitor: cyclic input"; + ofst_->SetProperties(kError, kError); + return false; + } + + bool ForwardOrCrossArc(StateId, const FromArc &) { + OutputPath(); + return true; + } + + void FinishState(StateId s, StateId p, const FromArc *) { + if (p != kNoStateId && ifst_->Final(s) == Weight::Zero()) path_.pop_back(); + } + + void FinishVisit() {} + + private: + void OutputPath() { + if (ofst_->Start() == kNoStateId) { + const auto start = ofst_->AddState(); + ofst_->SetStart(start); + } + auto src = ofst_->Start(); + for (size_t i = 0; i < path_.size(); ++i) { + const auto dest = ofst_->AddState(); + const ToArc arc(path_[i].ilabel, path_[i].olabel, Weight::One(), dest); + ofst_->AddArc(src, arc); + src = dest; + } + ofst_->SetFinal(src, Weight::One()); + } + + const Fst *ifst_; + MutableFst *ofst_; + std::vector path_; + + RandGenVisitor(const RandGenVisitor &) = delete; + RandGenVisitor &operator=(const RandGenVisitor &) = delete; +}; + +} // namespace internal + +// Randomly generate paths through an FST; details controlled by +// RandGenOptions. +template +void RandGen(const Fst &ifst, MutableFst *ofst, + const RandGenOptions &opts) { + using Sampler = ArcSampler; + auto *sampler = new Sampler(ifst, opts.selector, opts.max_length); + RandGenFstOptions fopts(CacheOptions(true, 0), sampler, opts.npath, + opts.weighted, opts.remove_total_weight); + RandGenFst rfst(ifst, fopts); + if (opts.weighted) { + *ofst = rfst; + } else { + internal::RandGenVisitor rand_visitor(ofst); + DfsVisit(rfst, &rand_visitor); + } +} + +// Randomly generate a path through an FST with the uniform distribution +// over the transitions. +template +void RandGen(const Fst &ifst, MutableFst *ofst) { + const UniformArcSelector uniform_selector; + RandGenOptions> opts(uniform_selector); + RandGen(ifst, ofst, opts); +} + +} // namespace fst + +#endif // FST_RANDGEN_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/rational.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/rational.h new file mode 100644 index 0000000..184ebf3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/rational.h @@ -0,0 +1,307 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// An FST implementation and base interface for delayed unions, concatenations, +// and closures. + +#ifndef FST_RATIONAL_H_ +#define FST_RATIONAL_H_ + +#include +#include +#include + +#include +#include +#include + + +namespace fst { + +using RationalFstOptions = CacheOptions; + +// This specifies whether to add the empty string. +enum ClosureType { + CLOSURE_STAR = 0, // Add the empty string. + CLOSURE_PLUS = 1 // Don't add the empty string. +}; + +template +class RationalFst; + +template +void Union(RationalFst *fst1, const Fst &fst2); + +template +void Concat(RationalFst *fst1, const Fst &fst2); + +template +void Concat(const Fst &fst1, RationalFst *fst2); + +template +void Closure(RationalFst *fst, ClosureType closure_type); + +namespace internal { + +// Implementation class for delayed unions, concatenations and closures. +template +class RationalFstImpl : public FstImpl { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::WriteHeader; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + explicit RationalFstImpl(const RationalFstOptions &opts) + : nonterminals_(0), replace_options_(opts, 0) { + SetType("rational"); + fst_tuples_.emplace_back(0, nullptr); + } + + RationalFstImpl(const RationalFstImpl &impl) + : rfst_(impl.rfst_), + nonterminals_(impl.nonterminals_), + replace_(impl.replace_ ? impl.replace_->Copy(true) : nullptr), + replace_options_(impl.replace_options_) { + SetType("rational"); + fst_tuples_.reserve(impl.fst_tuples_.size()); + for (const auto &pair : impl.fst_tuples_) { + fst_tuples_.emplace_back(pair.first, + pair.second ? pair.second->Copy(true) : nullptr); + } + } + + ~RationalFstImpl() override { + for (auto &tuple : fst_tuples_) delete tuple.second; + } + + StateId Start() { return Replace()->Start(); } + + Weight Final(StateId s) { return Replace()->Final(s); } + + size_t NumArcs(StateId s) { return Replace()->NumArcs(s); } + + size_t NumInputEpsilons(StateId s) { return Replace()->NumInputEpsilons(s); } + + size_t NumOutputEpsilons(StateId s) { + return Replace()->NumOutputEpsilons(s); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && Replace()->Properties(kError, false)) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + // Implementation of UnionFst(fst1, fst2). + void InitUnion(const Fst &fst1, const Fst &fst2) { + replace_.reset(); + const auto props1 = fst1.Properties(kFstProperties, false); + const auto props2 = fst2.Properties(kFstProperties, false); + SetInputSymbols(fst1.InputSymbols()); + SetOutputSymbols(fst1.OutputSymbols()); + rfst_.AddState(); + rfst_.AddState(); + rfst_.SetStart(0); + rfst_.SetFinal(1, Weight::One()); + rfst_.SetInputSymbols(fst1.InputSymbols()); + rfst_.SetOutputSymbols(fst1.OutputSymbols()); + nonterminals_ = 2; + rfst_.EmplaceArc(0, 0, -1, Weight::One(), 1); + rfst_.EmplaceArc(0, 0, -2, Weight::One(), 1); + fst_tuples_.emplace_back(-1, fst1.Copy()); + fst_tuples_.emplace_back(-2, fst2.Copy()); + SetProperties(UnionProperties(props1, props2, true), kCopyProperties); + } + + // Implementation of ConcatFst(fst1, fst2). + void InitConcat(const Fst &fst1, const Fst &fst2) { + replace_.reset(); + const auto props1 = fst1.Properties(kFstProperties, false); + const auto props2 = fst2.Properties(kFstProperties, false); + SetInputSymbols(fst1.InputSymbols()); + SetOutputSymbols(fst1.OutputSymbols()); + rfst_.AddState(); + rfst_.AddState(); + rfst_.AddState(); + rfst_.SetStart(0); + rfst_.SetFinal(2, Weight::One()); + rfst_.SetInputSymbols(fst1.InputSymbols()); + rfst_.SetOutputSymbols(fst1.OutputSymbols()); + nonterminals_ = 2; + rfst_.EmplaceArc(0, 0, -1, Weight::One(), 1); + rfst_.EmplaceArc(1, 0, -2, Weight::One(), 2); + fst_tuples_.emplace_back(-1, fst1.Copy()); + fst_tuples_.emplace_back(-2, fst2.Copy()); + SetProperties(ConcatProperties(props1, props2, true), kCopyProperties); + } + + // Implementation of ClosureFst(fst, closure_type). + void InitClosure(const Fst &fst, ClosureType closure_type) { + replace_.reset(); + const auto props = fst.Properties(kFstProperties, false); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + if (closure_type == CLOSURE_STAR) { + rfst_.AddState(); + rfst_.SetStart(0); + rfst_.SetFinal(0, Weight::One()); + rfst_.EmplaceArc(0, 0, -1, Weight::One(), 0); + } else { + rfst_.AddState(); + rfst_.AddState(); + rfst_.SetStart(0); + rfst_.SetFinal(1, Weight::One()); + rfst_.EmplaceArc(0, 0, -1, Weight::One(), 1); + rfst_.EmplaceArc(1, 0, 0, Weight::One(), 0); + } + rfst_.SetInputSymbols(fst.InputSymbols()); + rfst_.SetOutputSymbols(fst.OutputSymbols()); + fst_tuples_.emplace_back(-1, fst.Copy()); + nonterminals_ = 1; + SetProperties(ClosureProperties(props, closure_type == CLOSURE_STAR, true), + kCopyProperties); + } + + // Implementation of Union(Fst &, RationalFst *). + void AddUnion(const Fst &fst) { + replace_.reset(); + const auto props1 = FstImpl::Properties(); + const auto props2 = fst.Properties(kFstProperties, false); + VectorFst afst; + afst.AddState(); + afst.AddState(); + afst.SetStart(0); + afst.SetFinal(1, Weight::One()); + ++nonterminals_; + afst.EmplaceArc(0, 0, -nonterminals_, Weight::One(), 1); + Union(&rfst_, afst); + fst_tuples_.emplace_back(-nonterminals_, fst.Copy()); + SetProperties(UnionProperties(props1, props2, true), kCopyProperties); + } + + // Implementation of Concat(Fst &, RationalFst *). + void AddConcat(const Fst &fst, bool append) { + replace_.reset(); + const auto props1 = FstImpl::Properties(); + const auto props2 = fst.Properties(kFstProperties, false); + VectorFst afst; + afst.AddState(); + afst.AddState(); + afst.SetStart(0); + afst.SetFinal(1, Weight::One()); + ++nonterminals_; + afst.EmplaceArc(0, 0, -nonterminals_, Weight::One(), 1); + if (append) { + Concat(&rfst_, afst); + } else { + Concat(afst, &rfst_); + } + fst_tuples_.emplace_back(-nonterminals_, fst.Copy()); + SetProperties(ConcatProperties(props1, props2, true), kCopyProperties); + } + + // Implementation of Closure(RationalFst *, closure_type). + void AddClosure(ClosureType closure_type) { + replace_.reset(); + const auto props = FstImpl::Properties(); + Closure(&rfst_, closure_type); + SetProperties(ClosureProperties(props, closure_type == CLOSURE_STAR, true), + kCopyProperties); + } + + // Returns the underlying ReplaceFst, preserving ownership of the underlying + // object. + ReplaceFst *Replace() const { + if (!replace_) { + fst_tuples_[0].second = rfst_.Copy(); + replace_.reset(new ReplaceFst(fst_tuples_, replace_options_)); + } + return replace_.get(); + } + + private: + // Rational topology machine, using negative non-terminals. + VectorFst rfst_; + // Number of nonterminals used. + Label nonterminals_; + // Contains the nonterminals and their corresponding FSTs. + mutable std::vector *>> fst_tuples_; + // Underlying ReplaceFst. + mutable std::unique_ptr> replace_; + const ReplaceFstOptions replace_options_; +}; + +} // namespace internal + +// Parent class for the delayed rational operations (union, concatenation, and +// closure). This class attaches interface to implementation and handles +// reference counting, delegating most methods to ImplToFst. +template +class RationalFst : public ImplToFst> { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + using Impl = internal::RationalFstImpl; + + friend class StateIterator>; + friend class ArcIterator>; + friend void Union<>(RationalFst *fst1, const Fst &fst2); + friend void Concat<>(RationalFst *fst1, const Fst &fst2); + friend void Concat<>(const Fst &fst1, RationalFst *fst2); + friend void Closure<>(RationalFst *fst, ClosureType closure_type); + + void InitStateIterator(StateIteratorData *data) const override { + GetImpl()->Replace()->InitStateIterator(data); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetImpl()->Replace()->InitArcIterator(s, data); + } + + protected: + using ImplToFst::GetImpl; + + explicit RationalFst(const RationalFstOptions &opts = RationalFstOptions()) + : ImplToFst(std::make_shared(opts)) {} + + // See Fst<>::Copy() for doc. + RationalFst(const RationalFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + private: + RationalFst &operator=(const RationalFst &) = delete; +}; + +// Specialization for RationalFst. +template +class StateIterator> : public StateIterator> { + public: + explicit StateIterator(const RationalFst &fst) + : StateIterator>(*(fst.GetImpl()->Replace())) {} +}; + +// Specialization for RationalFst. +template +class ArcIterator> : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const RationalFst &fst, StateId s) + : ArcIterator>(*(fst.GetImpl()->Replace()), s) {} +}; + +} // namespace fst + +#endif // FST_RATIONAL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/register.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/register.h new file mode 100644 index 0000000..2d1a6ea --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/register.h @@ -0,0 +1,115 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes for registering derived FST for generic reading. + +#ifndef FST_REGISTER_H_ +#define FST_REGISTER_H_ + +#include +#include + + +#include +#include +#include + + +#include +#include + +namespace fst { + +template +class Fst; + +struct FstReadOptions; + +// This class represents a single entry in a FstRegister +template +struct FstRegisterEntry { + using Reader = Fst *(*)(std::istream &istrm, const FstReadOptions &opts); + using Converter = Fst *(*)(const Fst &fst); + + Reader reader; + Converter converter; + + explicit FstRegisterEntry(Reader reader = nullptr, + Converter converter = nullptr) + : reader(reader), converter(converter) {} +}; + +// This class maintains the correspondence between a string describing +// an FST type, and its reader and converter. +template +class FstRegister + : public GenericRegister, FstRegister> { + public: + using Reader = typename FstRegisterEntry::Reader; + using Converter = typename FstRegisterEntry::Converter; + + const Reader GetReader(const string &type) const { + return this->GetEntry(type).reader; + } + + const Converter GetConverter(const string &type) const { + return this->GetEntry(type).converter; + } + + protected: + string ConvertKeyToSoFilename(const string &key) const override { + string legal_type(key); + ConvertToLegalCSymbol(&legal_type); + return legal_type + "-fst.so"; + } +}; + +// This class registers an FST type for generic reading and creating. +// The type must have a default constructor and a copy constructor from +// Fst. +template +class FstRegisterer : public GenericRegisterer> { + public: + using Arc = typename FST::Arc; + using Entry = typename FstRegister::Entry; + using Reader = typename FstRegister::Reader; + + FstRegisterer() + : GenericRegisterer>(FST().Type(), + BuildEntry()) {} + + private: + static Fst *ReadGeneric( + std::istream &strm, const FstReadOptions &opts) { + static_assert(std::is_base_of, FST>::value, + "FST class does not inherit from Fst"); + return FST::Read(strm, opts); + } + + static Entry BuildEntry() { + return Entry(&ReadGeneric, &FstRegisterer::Convert); + } + + static Fst *Convert(const Fst &fst) { return new FST(fst); } +}; + +// Convenience macro to generate static FstRegisterer instance. +#define REGISTER_FST(FST, Arc) \ + static fst::FstRegisterer> FST##_##Arc##_registerer + +// Converts an FST to the specified type. +template +Fst *Convert(const Fst &fst, const string &fst_type) { + auto *reg = FstRegister::GetRegister(); + const auto converter = reg->GetConverter(fst_type); + if (!converter) { + FSTERROR() << "Fst::Convert: Unknown FST type " << fst_type << " (arc type " + << Arc::Type() << ")"; + return nullptr; + } + return converter(fst); +} + +} // namespace fst + +#endif // FST_REGISTER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/relabel.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/relabel.h new file mode 100644 index 0000000..0979b07 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/relabel.h @@ -0,0 +1,472 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to relabel an FST (either on input or output). + +#ifndef FST_RELABEL_H_ +#define FST_RELABEL_H_ + +#include +#include +#include +#include + +#include + +#include +#include + + +#include + +namespace fst { + +// Relabels either the input labels or output labels. The old to +// new labels are specified using a vector of std::pair. +// Any label associations not specified are assumed to be identity +// mapping. The destination labels must be valid labels (e.g., not kNoLabel). +template +void Relabel( + MutableFst *fst, + const std::vector> + &ipairs, + const std::vector> + &opairs) { + using Label = typename Arc::Label; + const auto props = fst->Properties(kFstProperties, false); + // Constructs label-to-label maps. + const std::unordered_map input_map( + ipairs.begin(), ipairs.end()); + const std::unordered_map output_map( + opairs.begin(), opairs.end()); + for (StateIterator> siter(*fst); !siter.Done(); + siter.Next()) { + for (MutableArcIterator> aiter(fst, siter.Value()); + !aiter.Done(); aiter.Next()) { + auto arc = aiter.Value(); + // Relabels input. + auto it = input_map.find(arc.ilabel); + if (it != input_map.end()) { + if (it->second == kNoLabel) { + FSTERROR() << "Input symbol ID " << arc.ilabel + << " missing from target vocabulary"; + fst->SetProperties(kError, kError); + return; + } + arc.ilabel = it->second; + } + // Relabels output. + it = output_map.find(arc.olabel); + if (it != output_map.end()) { + if (it->second == kNoLabel) { + FSTERROR() << "Output symbol id " << arc.olabel + << " missing from target vocabulary"; + fst->SetProperties(kError, kError); + return; + } + arc.olabel = it->second; + } + aiter.SetValue(arc); + } + } + fst->SetProperties(RelabelProperties(props), kFstProperties); +} + +// Relabels either the input labels or output labels. The old to +// new labels are specified using pairs of old and new symbol tables. +// The tables must contain (at least) all labels on the appropriate side of the +// FST. If the 'unknown_i(o)symbol' is non-empty, it is used to label any +// missing symbol in new_i(o)symbols table. +template +void Relabel(MutableFst *fst, + const SymbolTable *old_isymbols, const SymbolTable *new_isymbols, + const string &unknown_isymbol, bool attach_new_isymbols, + const SymbolTable *old_osymbols, const SymbolTable *new_osymbols, + const string &unknown_osymbol, bool attach_new_osymbols) { + using Label = typename Arc::Label; + // Constructs vectors of input-side label pairs. + std::vector> ipairs; + if (old_isymbols && new_isymbols) { + size_t num_missing_syms = 0; + Label unknown_ilabel = kNoLabel; + if (!unknown_isymbol.empty()) { + unknown_ilabel = new_isymbols->Find(unknown_isymbol); + if (unknown_ilabel == kNoLabel) { + VLOG(1) << "Input symbol '" << unknown_isymbol + << "' missing from target symbol table"; + ++num_missing_syms; + } + } + + for (SymbolTableIterator siter(*old_isymbols); !siter.Done(); + siter.Next()) { + const auto old_index = siter.Value(); + const auto symbol = siter.Symbol(); + auto new_index = new_isymbols->Find(siter.Symbol()); + if (new_index == kNoLabel) { + if (unknown_ilabel != kNoLabel) { + new_index = unknown_ilabel; + } else { + VLOG(1) << "Input symbol ID " << old_index << " symbol '" << symbol + << "' missing from target symbol table"; + ++num_missing_syms; + } + } + ipairs.push_back(std::make_pair(old_index, new_index)); + } + if (num_missing_syms > 0) { + LOG(WARNING) << "Target symbol table missing: " << num_missing_syms + << " input symbols"; + } + if (attach_new_isymbols) fst->SetInputSymbols(new_isymbols); + } + // Constructs vectors of output-side label pairs. + std::vector> opairs; + if (old_osymbols && new_osymbols) { + size_t num_missing_syms = 0; + Label unknown_olabel = kNoLabel; + if (!unknown_osymbol.empty()) { + unknown_olabel = new_osymbols->Find(unknown_osymbol); + if (unknown_olabel == kNoLabel) { + VLOG(1) << "Output symbol '" << unknown_osymbol + << "' missing from target symbol table"; + ++num_missing_syms; + } + } + + for (SymbolTableIterator siter(*old_osymbols); !siter.Done(); + siter.Next()) { + const auto old_index = siter.Value(); + const auto symbol = siter.Symbol(); + auto new_index = new_osymbols->Find(siter.Symbol()); + if (new_index == kNoLabel) { + if (unknown_olabel != kNoLabel) { + new_index = unknown_olabel; + } else { + VLOG(1) << "Output symbol ID " << old_index << " symbol '" << symbol + << "' missing from target symbol table"; + ++num_missing_syms; + } + } + opairs.push_back(std::make_pair(old_index, new_index)); + } + if (num_missing_syms > 0) { + LOG(WARNING) << "Target symbol table missing: " << num_missing_syms + << " output symbols"; + } + if (attach_new_osymbols) fst->SetOutputSymbols(new_osymbols); + } + // Calls relabel using vector of relabel pairs. + Relabel(fst, ipairs, opairs); +} + +// Same as previous but no special allowance for unknown symbols. Kept +// for backward compat. +template +void Relabel(MutableFst *fst, const SymbolTable *old_isymbols, + const SymbolTable *new_isymbols, bool attach_new_isymbols, + const SymbolTable *old_osymbols, const SymbolTable *new_osymbols, + bool attach_new_osymbols) { + Relabel(fst, + old_isymbols, new_isymbols, "" /* no unknown isymbol */, + attach_new_isymbols, + old_osymbols, new_osymbols, "" /* no unknown ioymbol */, + attach_new_osymbols); +} + + +// Relabels either the input labels or output labels. The old to +// new labels are specified using symbol tables. Any label associations not +// specified are assumed to be identity mapping. +template +void Relabel(MutableFst *fst, const SymbolTable *new_isymbols, + const SymbolTable *new_osymbols) { + Relabel(fst, fst->InputSymbols(), new_isymbols, true, fst->OutputSymbols(), + new_osymbols, true); +} + +using RelabelFstOptions = CacheOptions; + +template +class RelabelFst; + +namespace internal { + +// Relabels an FST from one symbol set to another. Relabeling can either be on +// input or output space. RelabelFst implements a delayed version of the +// relabel. Arcs are relabeled on the fly and not cached; i.e., each request is +// recomputed. +template +class RelabelFstImpl : public CacheImpl { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = DefaultCacheStore; + using State = typename Store::State; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::WriteHeader; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheImpl::PushArc; + using CacheImpl::HasArcs; + using CacheImpl::HasFinal; + using CacheImpl::HasStart; + using CacheImpl::SetArcs; + using CacheImpl::SetFinal; + using CacheImpl::SetStart; + + friend class StateIterator>; + + RelabelFstImpl(const Fst &fst, + const std::vector> &ipairs, + const std::vector> &opairs, + const RelabelFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + input_map_(ipairs.begin(), ipairs.end()), + output_map_(opairs.begin(), opairs.end()), + relabel_input_(!ipairs.empty()), + relabel_output_(!opairs.empty()) { + SetProperties(RelabelProperties(fst.Properties(kCopyProperties, false))); + SetType("relabel"); + } + + RelabelFstImpl(const Fst &fst, + const SymbolTable *old_isymbols, + const SymbolTable *new_isymbols, + const SymbolTable *old_osymbols, + const SymbolTable *new_osymbols, + const RelabelFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + relabel_input_(false), + relabel_output_(false) { + SetType("relabel"); + SetProperties(RelabelProperties(fst.Properties(kCopyProperties, false))); + SetInputSymbols(old_isymbols); + SetOutputSymbols(old_osymbols); + if (old_isymbols && new_isymbols && + old_isymbols->LabeledCheckSum() != new_isymbols->LabeledCheckSum()) { + for (SymbolTableIterator siter(*old_isymbols); !siter.Done(); + siter.Next()) { + input_map_[siter.Value()] = new_isymbols->Find(siter.Symbol()); + } + SetInputSymbols(new_isymbols); + relabel_input_ = true; + } + if (old_osymbols && new_osymbols && + old_osymbols->LabeledCheckSum() != new_osymbols->LabeledCheckSum()) { + for (SymbolTableIterator siter(*old_osymbols); !siter.Done(); + siter.Next()) { + output_map_[siter.Value()] = new_osymbols->Find(siter.Symbol()); + } + SetOutputSymbols(new_osymbols); + relabel_output_ = true; + } + } + + RelabelFstImpl(const RelabelFstImpl &impl) + : CacheImpl(impl), + fst_(impl.fst_->Copy(true)), + input_map_(impl.input_map_), + output_map_(impl.output_map_), + relabel_input_(impl.relabel_input_), + relabel_output_(impl.relabel_output_) { + SetType("relabel"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + StateId Start() { + if (!HasStart()) SetStart(fst_->Start()); + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) SetFinal(s, fst_->Final(s)); + return CacheImpl::Final(s); + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found, and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && fst_->Properties(kError, false)) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + void Expand(StateId s) { + for (ArcIterator> aiter(*fst_, s); !aiter.Done(); aiter.Next()) { + auto arc = aiter.Value(); + if (relabel_input_) { + auto it = input_map_.find(arc.ilabel); + if (it != input_map_.end()) arc.ilabel = it->second; + } + if (relabel_output_) { + auto it = output_map_.find(arc.olabel); + if (it != output_map_.end()) { + arc.olabel = it->second; + } + } + PushArc(s, std::move(arc)); + } + SetArcs(s); + } + + private: + std::unique_ptr> fst_; + + std::unordered_map input_map_; + std::unordered_map output_map_; + bool relabel_input_; + bool relabel_output_; +}; + +} // namespace internal + +// This class attaches interface to implementation and handles +// reference counting, delegating most methods to ImplToFst. +template +class RelabelFst : public ImplToFst> { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = DefaultCacheStore; + using State = typename Store::State; + using Impl = internal::RelabelFstImpl; + + friend class ArcIterator>; + friend class StateIterator>; + + RelabelFst(const Fst &fst, + const std::vector> &ipairs, + const std::vector> &opairs, + const RelabelFstOptions &opts = RelabelFstOptions()) + : ImplToFst(std::make_shared(fst, ipairs, opairs, opts)) {} + + RelabelFst(const Fst &fst, const SymbolTable *new_isymbols, + const SymbolTable *new_osymbols, + const RelabelFstOptions &opts = RelabelFstOptions()) + : ImplToFst( + std::make_shared(fst, fst.InputSymbols(), new_isymbols, + fst.OutputSymbols(), new_osymbols, opts)) {} + + RelabelFst(const Fst &fst, const SymbolTable *old_isymbols, + const SymbolTable *new_isymbols, const SymbolTable *old_osymbols, + const SymbolTable *new_osymbols, + const RelabelFstOptions &opts = RelabelFstOptions()) + : ImplToFst(std::make_shared(fst, old_isymbols, new_isymbols, + old_osymbols, new_osymbols, + opts)) {} + + // See Fst<>::Copy() for doc. + RelabelFst(const RelabelFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Gets a copy of this RelabelFst. See Fst<>::Copy() for further doc. + RelabelFst *Copy(bool safe = false) const override { + return new RelabelFst(*this, safe); + } + + void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + return GetMutableImpl()->InitArcIterator(s, data); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + RelabelFst &operator=(const RelabelFst &) = delete; +}; + +// Specialization for RelabelFst. +template +class StateIterator> : public StateIteratorBase { + public: + using StateId = typename Arc::StateId; + + explicit StateIterator(const RelabelFst &fst) + : impl_(fst.GetImpl()), siter_(*impl_->fst_), s_(0) {} + + bool Done() const final { return siter_.Done(); } + + StateId Value() const final { return s_; } + + void Next() final { + if (!siter_.Done()) { + ++s_; + siter_.Next(); + } + } + + void Reset() final { + s_ = 0; + siter_.Reset(); + } + + private: + const internal::RelabelFstImpl* impl_; + StateIterator> siter_; + StateId s_; + + StateIterator(const StateIterator &) = delete; + StateIterator &operator=(const StateIterator &) = delete; +}; + +// Specialization for RelabelFst. +template +class ArcIterator> : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const RelabelFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void RelabelFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Useful alias when using StdArc. +using StdRelabelFst = RelabelFst; + +} // namespace fst + +#endif // FST_RELABEL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/replace-util.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/replace-util.h new file mode 100644 index 0000000..42c6982 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/replace-util.h @@ -0,0 +1,629 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Utility classes for the recursive replacement of FSTs (RTNs). + +#ifndef FST_REPLACE_UTIL_H_ +#define FST_REPLACE_UTIL_H_ + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + + +namespace fst { + +// This specifies what labels to output on the call or return arc. Note that +// REPLACE_LABEL_INPUT and REPLACE_LABEL_OUTPUT will produce transducers when +// applied to acceptors. +enum ReplaceLabelType { + // Epsilon labels on both input and output. + REPLACE_LABEL_NEITHER = 1, + // Non-epsilon labels on input and epsilon on output. + REPLACE_LABEL_INPUT = 2, + // Epsilon on input and non-epsilon on output. + REPLACE_LABEL_OUTPUT = 3, + // Non-epsilon labels on both input and output. + REPLACE_LABEL_BOTH = 4 +}; + +// By default ReplaceUtil will copy the input label of the replace arc. +// The call_label_type and return_label_type options specify how to manage +// the labels of the call arc and the return arc of the replace FST +struct ReplaceUtilOptions { + int64 root; // Root rule for expansion. + ReplaceLabelType call_label_type; // How to label call arc. + ReplaceLabelType return_label_type; // How to label return arc. + int64 return_label; // Label to put on return arc. + + explicit ReplaceUtilOptions( + int64 root = kNoLabel, + ReplaceLabelType call_label_type = REPLACE_LABEL_INPUT, + ReplaceLabelType return_label_type = REPLACE_LABEL_NEITHER, + int64 return_label = 0) + : root(root), + call_label_type(call_label_type), + return_label_type(return_label_type), + return_label(return_label) {} + + // For backwards compatibility. + ReplaceUtilOptions(int64 root, bool epsilon_replace_arc) + : ReplaceUtilOptions(root, + epsilon_replace_arc ? REPLACE_LABEL_NEITHER + : REPLACE_LABEL_INPUT) {} +}; + +// Every non-terminal on a path appears as the first label on that path in every +// FST associated with a given SCC of the replace dependency graph. This would +// be true if the SCC were formed from left-linear grammar rules. +constexpr uint8 kReplaceSCCLeftLinear = 0x01; +// Every non-terminal on a path appears as the final label on that path in every +// FST associated with a given SCC of the replace dependency graph. This would +// be true if the SCC were formed from right-linear grammar rules. +constexpr uint8 kReplaceSCCRightLinear = 0x02; +// The SCC in the replace dependency graph has more than one state or a +// self-loop. +constexpr uint8 kReplaceSCCNonTrivial = 0x04; + +// Defined in replace.h. +template +void Replace( + const std::vector *>> &, + MutableFst *, const ReplaceUtilOptions &); + +// Utility class for the recursive replacement of FSTs (RTNs). The user provides +// a set of label/FST pairs at construction. These are used by methods for +// testing cyclic dependencies and connectedness and doing RTN connection and +// specific FST replacement by label or for various optimization properties. The +// modified results can be obtained with the GetFstPairs() or +// GetMutableFstPairs() methods. +template +class ReplaceUtil { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstPair = std::pair *>; + using MutableFstPair = std::pair *>; + using NonTerminalHash = std::unordered_map; + + // Constructs from mutable FSTs; FST ownership is given to ReplaceUtil. + ReplaceUtil(const std::vector &fst_pairs, + const ReplaceUtilOptions &opts); + + // Constructs from FSTs; FST ownership is retained by caller. + ReplaceUtil(const std::vector &fst_pairs, + const ReplaceUtilOptions &opts); + + // Constructs from ReplaceFst internals; FST ownership is retained by caller. + ReplaceUtil(const std::vector>> &fst_array, + const NonTerminalHash &nonterminal_hash, + const ReplaceUtilOptions &opts); + + ~ReplaceUtil() { + for (Label i = 0; i < fst_array_.size(); ++i) delete fst_array_[i]; + } + + // True if the non-terminal dependencies are cyclic. Cyclic dependencies will + // result in an unexpandable FST. + bool CyclicDependencies() const { + GetDependencies(false); + return depprops_ & kCyclic; + } + + // Returns the strongly-connected component ID in the dependency graph of the + // replace FSTS. + StateId SCC(Label label) const { + GetDependencies(false); + const auto it = nonterminal_hash_.find(label); + if (it == nonterminal_hash_.end()) return kNoStateId; + return depscc_[it->second]; + } + + // Returns properties for the strongly-connected component in the dependency + // graph of the replace FSTs. If the SCC is kReplaceSCCLeftLinear or + // kReplaceSCCRightLinear, that SCC can be represented as finite-state despite + // any cyclic dependencies, but not by the usual replacement operation (see + // fst/extensions/pdt/replace.h). + uint8 SCCProperties(StateId scc_id) { + GetSCCProperties(); + return depsccprops_[scc_id]; + } + + // Returns true if no useless FSTs, states or transitions are present in the + // RTN. + bool Connected() const { + GetDependencies(false); + uint64 props = kAccessible | kCoAccessible; + for (Label i = 0; i < fst_array_.size(); ++i) { + if (!fst_array_[i]) continue; + if (fst_array_[i]->Properties(props, true) != props || !depaccess_[i]) { + return false; + } + } + return true; + } + + // Removes useless FSTs, states and transitions from the RTN. + void Connect(); + + // Replaces FSTs specified by labels, unless there are cyclic dependencies. + void ReplaceLabels(const std::vector */> +class ReplaceFst + : public ImplToFst> { + public: + using Arc = A; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using StateTable = T; + using Store = CacheStore; + using State = typename CacheStore::State; + using Impl = internal::ReplaceFstImpl; + using CacheImpl = internal::CacheBaseImpl; + + using ImplToFst::Properties; + + friend class ArcIterator>; + friend class StateIterator>; + friend class ReplaceFstMatcher; + + ReplaceFst(const std::vector *>> &fst_array, + Label root) + : ImplToFst(std::make_shared( + fst_array, ReplaceFstOptions(root))) {} + + ReplaceFst(const std::vector *>> &fst_array, + const ReplaceFstOptions &opts) + : ImplToFst(std::make_shared(fst_array, opts)) {} + + // See Fst<>::Copy() for doc. + ReplaceFst(const ReplaceFst &fst, + bool safe = false) + : ImplToFst(fst, safe) {} + + // Get a copy of this ReplaceFst. See Fst<>::Copy() for further doc. + ReplaceFst *Copy( + bool safe = false) const override { + return new ReplaceFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + MatcherBase *InitMatcher(MatchType match_type) const override { + if ((GetImpl()->ArcIteratorFlags() & kArcNoCache) && + ((match_type == MATCH_INPUT && Properties(kILabelSorted, false)) || + (match_type == MATCH_OUTPUT && Properties(kOLabelSorted, false)))) { + return new ReplaceFstMatcher + (this, match_type); + } else { + VLOG(2) << "Not using replace matcher"; + return nullptr; + } + } + + bool CyclicDependencies() const { return GetImpl()->CyclicDependencies(); } + + const StateTable &GetStateTable() const { + return *GetImpl()->GetStateTable(); + } + + const Fst &GetFst(Label nonterminal) const { + return *GetImpl()->GetFst(GetImpl()->GetFstId(nonterminal)); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + ReplaceFst &operator=(const ReplaceFst &) = delete; +}; + +// Specialization for ReplaceFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const ReplaceFst &fst) + : CacheStateIterator>( + fst, fst.GetMutableImpl()) {} +}; + +// Specialization for ReplaceFst, implementing optional caching. It is be used +// as follows: +// +// ReplaceFst replace; +// ArcIterator> aiter(replace, s); +// // Note: ArcIterator< Fst> is always a caching arc iterator. +// aiter.SetFlags(kArcNoCache, kArcNoCache); +// // Uses the arc iterator, no arc will be cached, no state will be expanded. +// // Arc flags can be used to decide which component of the arc need to be +// computed. +// aiter.SetFlags(kArcILabelValue, kArcValueFlags); +// // Wants the ilabel for this arc. +// aiter.Value(); // Does not compute the destination state. +// aiter.Next(); +// aiter.SetFlags(kArcNextStateValue, kArcNextStateValue); +// // Wants the ilabel and next state for this arc. +// aiter.Value(); // Does compute the destination state and inserts it +// // in the replace state table. +// // No additional arcs have been cached at this point. +template +class ArcIterator> { + public: + using StateId = typename Arc::StateId; + + using StateTuple = typename StateTable::StateTuple; + + ArcIterator(const ReplaceFst &fst, StateId s) + : fst_(fst), + s_(s), + pos_(0), + offset_(0), + flags_(kArcValueFlags), + arcs_(nullptr), + data_flags_(0), + final_flags_(0) { + cache_data_.ref_count = nullptr; + local_data_.ref_count = nullptr; + // If FST does not support optional caching, forces caching. + if (!(fst_.GetImpl()->ArcIteratorFlags() & kArcNoCache) && + !(fst_.GetImpl()->HasArcs(s_))) { + fst_.GetMutableImpl()->Expand(s_); + } + // If state is already cached, use cached arcs array. + if (fst_.GetImpl()->HasArcs(s_)) { + (fst_.GetImpl()) + ->internal::template CacheBaseImpl< + typename CacheStore::State, + CacheStore>::InitArcIterator(s_, &cache_data_); + num_arcs_ = cache_data_.narcs; + arcs_ = cache_data_.arcs; // arcs_ is a pointer to the cached arcs. + data_flags_ = kArcValueFlags; // All the arc member values are valid. + } else { // Otherwise delay decision until Value() is called. + tuple_ = fst_.GetImpl()->GetStateTable()->Tuple(s_); + if (tuple_.fst_state == kNoStateId) { + num_arcs_ = 0; + } else { + // The decision to cache or not to cache has been defered until Value() + // or + // SetFlags() is called. However, the arc iterator is set up now to be + // ready for non-caching in order to keep the Value() method simple and + // efficient. + const auto *rfst = fst_.GetImpl()->GetFst(tuple_.fst_id); + rfst->InitArcIterator(tuple_.fst_state, &local_data_); + // arcs_ is a pointer to the arcs in the underlying machine. + arcs_ = local_data_.arcs; + // Computes the final arc (but not its destination state) if a final arc + // is required. + bool has_final_arc = fst_.GetMutableImpl()->ComputeFinalArc( + tuple_, &final_arc_, kArcValueFlags & ~kArcNextStateValue); + // Sets the arc value flags that hold for final_arc_. + final_flags_ = kArcValueFlags & ~kArcNextStateValue; + // Computes the number of arcs. + num_arcs_ = local_data_.narcs; + if (has_final_arc) ++num_arcs_; + // Sets the offset between the underlying arc positions and the + // positions + // in the arc iterator. + offset_ = num_arcs_ - local_data_.narcs; + // Defers the decision to cache or not until Value() or SetFlags() is + // called. + data_flags_ = 0; + } + } + } + + ~ArcIterator() { + if (cache_data_.ref_count) --(*cache_data_.ref_count); + if (local_data_.ref_count) --(*local_data_.ref_count); + } + + void ExpandAndCache() const { + // TODO(allauzen): revisit this. + // fst_.GetImpl()->Expand(s_, tuple_, local_data_); + // (fst_.GetImpl())->CacheImpl*>::InitArcIterator(s_, + // &cache_data_); + // + fst_.InitArcIterator(s_, &cache_data_); // Expand and cache state. + arcs_ = cache_data_.arcs; // arcs_ is a pointer to the cached arcs. + data_flags_ = kArcValueFlags; // All the arc member values are valid. + offset_ = 0; // No offset. + } + + void Init() { + if (flags_ & kArcNoCache) { // If caching is disabled + // arcs_ is a pointer to the arcs in the underlying machine. + arcs_ = local_data_.arcs; + // Sets the arcs value flags that hold for arcs_. + data_flags_ = kArcWeightValue; + if (!fst_.GetMutableImpl()->EpsilonOnCallInput()) { + data_flags_ |= kArcILabelValue; + } + // Sets the offset between the underlying arc positions and the positions + // in the arc iterator. + offset_ = num_arcs_ - local_data_.narcs; + } else { + ExpandAndCache(); + } + } + + bool Done() const { return pos_ >= num_arcs_; } + + const Arc &Value() const { + // If data_flags_ is 0, non-caching was not requested. + if (!data_flags_) { + // TODO(allauzen): Revisit this. + if (flags_ & kArcNoCache) { + // Should never happen. + FSTERROR() << "ReplaceFst: Inconsistent arc iterator flags"; + } + ExpandAndCache(); + } + if (pos_ - offset_ >= 0) { // The requested arc is not the final arc. + const auto &arc = arcs_[pos_ - offset_]; + if ((data_flags_ & flags_) == (flags_ & kArcValueFlags)) { + // If the value flags match the recquired value flags then returns the + // arc. + return arc; + } else { + // Otherwise, compute the corresponding arc on-the-fly. + fst_.GetMutableImpl()->ComputeArc(tuple_, arc, &arc_, + flags_ & kArcValueFlags); + return arc_; + } + } else { // The requested arc is the final arc. + if ((final_flags_ & flags_) != (flags_ & kArcValueFlags)) { + // If the arc value flags that hold for the final arc do not match the + // requested value flags, then + // final_arc_ needs to be updated. + fst_.GetMutableImpl()->ComputeFinalArc(tuple_, &final_arc_, + flags_ & kArcValueFlags); + final_flags_ = flags_ & kArcValueFlags; + } + return final_arc_; + } + } + + void Next() { ++pos_; } + + size_t Position() const { return pos_; } + + void Reset() { pos_ = 0; } + + void Seek(size_t pos) { pos_ = pos; } + + uint32 Flags() const { return flags_; } + + void SetFlags(uint32 flags, uint32 mask) { + // Updates the flags taking into account what flags are supported + // by the FST. + flags_ &= ~mask; + flags_ |= (flags & fst_.GetImpl()->ArcIteratorFlags()); + // If non-caching is not requested (and caching has not already been + // performed), then flush data_flags_ to request caching during the next + // call to Value(). + if (!(flags_ & kArcNoCache) && data_flags_ != kArcValueFlags) { + if (!fst_.GetImpl()->HasArcs(s_)) data_flags_ = 0; + } + // If data_flags_ has been flushed but non-caching is requested before + // calling Value(), then set up the iterator for non-caching. + if ((flags & kArcNoCache) && (!data_flags_)) Init(); + } + + private: + const ReplaceFst &fst_; // Reference to the FST. + StateId s_; // State in the FST. + mutable StateTuple tuple_; // Tuple corresponding to state_. + + ssize_t pos_; // Current position. + mutable ssize_t offset_; // Offset between position in iterator and in arcs_. + ssize_t num_arcs_; // Number of arcs at state_. + uint32 flags_; // Behavorial flags for the arc iterator + mutable Arc arc_; // Memory to temporarily store computed arcs. + + mutable ArcIteratorData cache_data_; // Arc iterator data in cache. + mutable ArcIteratorData local_data_; // Arc iterator data in local FST. + + mutable const Arc *arcs_; // Array of arcs. + mutable uint32 data_flags_; // Arc value flags valid for data in arcs_. + mutable Arc final_arc_; // Final arc (when required). + mutable uint32 final_flags_; // Arc value flags valid for final_arc_. + + ArcIterator(const ArcIterator &) = delete; + ArcIterator &operator=(const ArcIterator &) = delete; +}; + +template +class ReplaceFstMatcher : public MatcherBase { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FST = ReplaceFst; + using LocalMatcher = MultiEpsMatcher>>; + + using StateTuple = typename StateTable::StateTuple; + + // This makes a copy of the FST. + ReplaceFstMatcher(const ReplaceFst &fst, + MatchType match_type) + : owned_fst_(fst.Copy()), + fst_(*owned_fst_), + impl_(fst_.GetMutableImpl()), + s_(fst::kNoStateId), + match_type_(match_type), + current_loop_(false), + final_arc_(false), + loop_(kNoLabel, 0, Weight::One(), kNoStateId) { + if (match_type_ == fst::MATCH_OUTPUT) { + std::swap(loop_.ilabel, loop_.olabel); + } + InitMatchers(); + } + + // This doesn't copy the FST. + ReplaceFstMatcher(const ReplaceFst *fst, + MatchType match_type) + : fst_(*fst), + impl_(fst_.GetMutableImpl()), + s_(fst::kNoStateId), + match_type_(match_type), + current_loop_(false), + final_arc_(false), + loop_(kNoLabel, 0, Weight::One(), kNoStateId) { + if (match_type_ == fst::MATCH_OUTPUT) { + std::swap(loop_.ilabel, loop_.olabel); + } + InitMatchers(); + } + + // This makes a copy of the FST. + ReplaceFstMatcher( + const ReplaceFstMatcher &matcher, + bool safe = false) + : owned_fst_(matcher.fst_.Copy(safe)), + fst_(*owned_fst_), + impl_(fst_.GetMutableImpl()), + s_(fst::kNoStateId), + match_type_(matcher.match_type_), + current_loop_(false), + final_arc_(false), + loop_(fst::kNoLabel, 0, Weight::One(), fst::kNoStateId) { + if (match_type_ == fst::MATCH_OUTPUT) { + std::swap(loop_.ilabel, loop_.olabel); + } + InitMatchers(); + } + + // Creates a local matcher for each component FST in the RTN. LocalMatcher is + // a multi-epsilon wrapper matcher. MultiEpsilonMatcher is used to match each + // non-terminal arc, since these non-terminal + // turn into epsilons on recursion. + void InitMatchers() { + const auto &fst_array = impl_->fst_array_; + matcher_.resize(fst_array.size()); + for (Label i = 0; i < fst_array.size(); ++i) { + if (fst_array[i]) { + matcher_[i].reset( + new LocalMatcher(*fst_array[i], match_type_, kMultiEpsList)); + auto it = impl_->nonterminal_set_.begin(); + for (; it != impl_->nonterminal_set_.end(); ++it) { + matcher_[i]->AddMultiEpsLabel(*it); + } + } + } + } + + ReplaceFstMatcher *Copy( + bool safe = false) const override { + return new ReplaceFstMatcher(*this, safe); + } + + MatchType Type(bool test) const override { + if (match_type_ == MATCH_NONE) return match_type_; + const auto true_prop = + match_type_ == MATCH_INPUT ? kILabelSorted : kOLabelSorted; + const auto false_prop = + match_type_ == MATCH_INPUT ? kNotILabelSorted : kNotOLabelSorted; + const auto props = fst_.Properties(true_prop | false_prop, test); + if (props & true_prop) { + return match_type_; + } else if (props & false_prop) { + return MATCH_NONE; + } else { + return MATCH_UNKNOWN; + } + } + + const Fst &GetFst() const override { return fst_; } + + uint64 Properties(uint64 props) const override { return props; } + + // Sets the state from which our matching happens. + void SetState(StateId s) final { + if (s_ == s) return; + s_ = s; + tuple_ = impl_->GetStateTable()->Tuple(s_); + if (tuple_.fst_state == kNoStateId) { + done_ = true; + return; + } + // Gets current matcher, used for non-epsilon matching. + current_matcher_ = matcher_[tuple_.fst_id].get(); + current_matcher_->SetState(tuple_.fst_state); + loop_.nextstate = s_; + final_arc_ = false; + } + + // Searches for label from previous set state. If label == 0, first + // hallucinate an epsilon loop; otherwise use the underlying matcher to + // search for the label or epsilons. Note since the ReplaceFst recursion + // on non-terminal arcs causes epsilon transitions to be created we use + // MultiEpsilonMatcher to search for possible matches of non-terminals. If the + // component FST + // reaches a final state we also need to add the exiting final arc. + bool Find(Label label) final { + bool found = false; + label_ = label; + if (label_ == 0 || label_ == kNoLabel) { + // Computes loop directly, avoiding Replace::ComputeArc. + if (label_ == 0) { + current_loop_ = true; + found = true; + } + // Searches for matching multi-epsilons. + final_arc_ = impl_->ComputeFinalArc(tuple_, nullptr); + found = current_matcher_->Find(kNoLabel) || final_arc_ || found; + } else { + // Searches on a sub machine directly using sub machine matcher. + found = current_matcher_->Find(label_); + } + return found; + } + + bool Done() const final { + return !current_loop_ && !final_arc_ && current_matcher_->Done(); + } + + const Arc &Value() const final { + if (current_loop_) return loop_; + if (final_arc_) { + impl_->ComputeFinalArc(tuple_, &arc_); + return arc_; + } + const auto &component_arc = current_matcher_->Value(); + impl_->ComputeArc(tuple_, component_arc, &arc_); + return arc_; + } + + void Next() final { + if (current_loop_) { + current_loop_ = false; + return; + } + if (final_arc_) { + final_arc_ = false; + return; + } + current_matcher_->Next(); + } + + ssize_t Priority(StateId s) final { return fst_.NumArcs(s); } + + private: + std::unique_ptr> owned_fst_; + const ReplaceFst &fst_; + internal::ReplaceFstImpl *impl_; + LocalMatcher *current_matcher_; + std::vector> matcher_; + StateId s_; // Current state. + Label label_; // Current label. + MatchType match_type_; // Supplied by caller. + mutable bool done_; + mutable bool current_loop_; // Current arc is the implicit loop. + mutable bool final_arc_; // Current arc for exiting recursion. + mutable StateTuple tuple_; // Tuple corresponding to state_. + mutable Arc arc_; + Arc loop_; + + ReplaceFstMatcher &operator=(const ReplaceFstMatcher &) = delete; +}; + +template +inline void ReplaceFst::InitStateIterator( + StateIteratorData *data) const { + data->base = + new StateIterator>(*this); +} + +using StdReplaceFst = ReplaceFst; + +// Recursively replaces arcs in the root FSTs with other FSTs. +// This version writes the result of replacement to an output MutableFst. +// +// Replace supports replacement of arcs in one Fst with another FST. This +// replacement is recursive. Replace takes an array of FST(s). One FST +// represents the root (or topology) machine. The root FST refers to other FSTs +// by recursively replacing arcs labeled as non-terminals with the matching +// non-terminal FST. Currently Replace uses the output symbols of the arcs to +// determine whether the arc is a non-terminal arc or not. A non-terminal can be +// any label that is not a non-zero terminal label in the output alphabet. +// +// Note that input argument is a vector of pairs. These correspond to the tuple +// of non-terminal Label and corresponding FST. +template +void Replace(const std::vector *>> + &ifst_array, + MutableFst *ofst, + ReplaceFstOptions opts = ReplaceFstOptions()) { + opts.gc = true; + opts.gc_limit = 0; // Caches only the last state for fastest copy. + *ofst = ReplaceFst(ifst_array, opts); +} + +template +void Replace(const std::vector *>> + &ifst_array, + MutableFst *ofst, const ReplaceUtilOptions &opts) { + Replace(ifst_array, ofst, ReplaceFstOptions(opts)); +} + +// For backwards compatibility. +template +void Replace(const std::vector *>> + &ifst_array, + MutableFst *ofst, typename Arc::Label root, + bool epsilon_on_replace) { + Replace(ifst_array, ofst, ReplaceFstOptions(root, epsilon_on_replace)); +} + +template +void Replace(const std::vector *>> + &ifst_array, + MutableFst *ofst, typename Arc::Label root) { + Replace(ifst_array, ofst, ReplaceFstOptions(root)); +} + +} // namespace fst + +#endif // FST_REPLACE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/reverse.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/reverse.h new file mode 100644 index 0000000..7c7c89d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/reverse.h @@ -0,0 +1,116 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to sort arcs in an FST. + +#ifndef FST_REVERSE_H_ +#define FST_REVERSE_H_ + +#include +#include + +#include + + +namespace fst { + +// Reverses an FST. The reversed result is written to an output mutable FST. +// If A transduces string x to y with weight a, then the reverse of A +// transduces the reverse of x to the reverse of y with weight a.Reverse(). +// +// Typically, a = a.Reverse() and an arc is its own reverse (e.g., for +// TropicalWeight or LogWeight). In general, e.g., when the weights only form a +// left or right semiring, the output arc type must match the input arc type +// except having the reversed Weight type. +// +// When require_superinitial is false, a superinitial state is not created in +// the reversed FST iff the input FST has exactly one final state (which becomes +// the initial state of the reversed FST) with a final weight of semiring One, +// or if it does not belong to any cycle. When require_superinitial is true, a +// superinitial state is always created. +template +void Reverse(const Fst &ifst, MutableFst *ofst, + bool require_superinitial = true) { + using StateId = typename FromArc::StateId; + using FromWeight = typename FromArc::Weight; + using ToWeight = typename ToArc::Weight; + ofst->DeleteStates(); + ofst->SetInputSymbols(ifst.InputSymbols()); + ofst->SetOutputSymbols(ifst.OutputSymbols()); + if (ifst.Properties(kExpanded, false)) { + ofst->ReserveStates(CountStates(ifst) + 1); + } + StateId istart = ifst.Start(); + StateId ostart = kNoStateId; + StateId offset = 0; + uint64 dfs_iprops = 0; + uint64 dfs_oprops = 0; + if (!require_superinitial) { + for (StateIterator> siter(ifst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (ifst.Final(s) == FromWeight::Zero()) continue; + if (ostart != kNoStateId) { + ostart = kNoStateId; + break; + } else { + ostart = s; + } + } + if (ostart != kNoStateId && ifst.Final(ostart) != FromWeight::One()) { + std::vector scc; + SccVisitor scc_visitor(&scc, nullptr, nullptr, &dfs_iprops); + DfsVisit(ifst, &scc_visitor); + if (count(scc.begin(), scc.end(), scc[ostart]) > 1) { + ostart = kNoStateId; + } else { + for (ArcIterator> aiter(ifst, ostart); !aiter.Done(); + aiter.Next()) { + if (aiter.Value().nextstate == ostart) { + ostart = kNoStateId; + break; + } + } + } + if (ostart != kNoStateId) dfs_oprops = kInitialAcyclic; + } + } + if (ostart == kNoStateId) { // Super-initial requested or needed. + ostart = ofst->AddState(); + offset = 1; + } + for (StateIterator> siter(ifst); !siter.Done(); siter.Next()) { + const auto is = siter.Value(); + const auto os = is + offset; + while (ofst->NumStates() <= os) ofst->AddState(); + if (is == istart) ofst->SetFinal(os, ToWeight::One()); + const auto weight = ifst.Final(is); + if ((weight != FromWeight::Zero()) && (offset == 1)) { + const ToArc oarc(0, 0, weight.Reverse(), os); + ofst->AddArc(0, oarc); + } + for (ArcIterator> aiter(ifst, is); !aiter.Done(); + aiter.Next()) { + const auto &iarc = aiter.Value(); + const auto nos = iarc.nextstate + offset; + auto weight = iarc.weight.Reverse(); + if (!offset && (nos == ostart)) { + weight = Times(ifst.Final(ostart).Reverse(), weight); + } + const ToArc oarc(iarc.ilabel, iarc.olabel, weight, os); + while (ofst->NumStates() <= nos) ofst->AddState(); + ofst->AddArc(nos, oarc); + } + } + ofst->SetStart(ostart); + if (offset == 0 && ostart == istart) { + ofst->SetFinal(ostart, ifst.Final(ostart).Reverse()); + } + const auto iprops = ifst.Properties(kCopyProperties, false) | dfs_iprops; + const auto oprops = ofst->Properties(kFstProperties, false) | dfs_oprops; + ofst->SetProperties(ReverseProperties(iprops, offset == 1) | oprops, + kFstProperties); +} + +} // namespace fst + +#endif // FST_REVERSE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/reweight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/reweight.h new file mode 100644 index 0000000..64e68cb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/reweight.h @@ -0,0 +1,127 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function to reweight an FST. + +#ifndef FST_REWEIGHT_H_ +#define FST_REWEIGHT_H_ + +#include +#include + +#include + + +namespace fst { + +enum ReweightType { REWEIGHT_TO_INITIAL, REWEIGHT_TO_FINAL }; + +// Reweights an FST according to a vector of potentials in a given direction. +// The weight must be left distributive when reweighting towards the initial +// state and right distributive when reweighting towards the final states. +// +// An arc of weight w, with an origin state of potential p and destination state +// of potential q, is reweighted by p^-1 \otimes (w \otimes q) when reweighting +// torwards the initial state, and by (p \otimes w) \otimes q^-1 when +// reweighting towards the final states. +template +void Reweight(MutableFst *fst, + const std::vector &potential, + ReweightType type) { + using Weight = typename Arc::Weight; + if (fst->NumStates() == 0) return; + // TODO(kbg): Make this a compile-time static_assert once we have a pleasant + // way to "deregister" this operation for non-distributive semirings so an + // informative error message is produced. + if (type == REWEIGHT_TO_FINAL && !(Weight::Properties() & kRightSemiring)) { + FSTERROR() << "Reweight: Reweighting to the final states requires " + << "Weight to be right distributive: " << Weight::Type(); + fst->SetProperties(kError, kError); + return; + } + // TODO(kbg): Make this a compile-time static_assert once we have a pleasant + // way to "deregister" this operation for non-distributive semirings so an + // informative error message is produced. + if (type == REWEIGHT_TO_INITIAL && !(Weight::Properties() & kLeftSemiring)) { + FSTERROR() << "Reweight: Reweighting to the initial state requires " + << "Weight to be left distributive: " << Weight::Type(); + fst->SetProperties(kError, kError); + return; + } + StateIterator> siter(*fst); + for (; !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (s == potential.size()) break; + const auto &weight = potential[s]; + if (weight != Weight::Zero()) { + for (MutableArcIterator> aiter(fst, s); !aiter.Done(); + aiter.Next()) { + auto arc = aiter.Value(); + if (arc.nextstate >= potential.size()) continue; + const auto &nextweight = potential[arc.nextstate]; + if (nextweight == Weight::Zero()) continue; + if (type == REWEIGHT_TO_INITIAL) { + arc.weight = + Divide(Times(arc.weight, nextweight), weight, DIVIDE_LEFT); + } + if (type == REWEIGHT_TO_FINAL) { + arc.weight = + Divide(Times(weight, arc.weight), nextweight, DIVIDE_RIGHT); + } + aiter.SetValue(arc); + } + if (type == REWEIGHT_TO_INITIAL) { + fst->SetFinal(s, Divide(fst->Final(s), weight, DIVIDE_LEFT)); + } + } + if (type == REWEIGHT_TO_FINAL) { + fst->SetFinal(s, Times(weight, fst->Final(s))); + } + } + // This handles elements past the end of the potentials array. + for (; !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (type == REWEIGHT_TO_FINAL) { + fst->SetFinal(s, Times(Weight::Zero(), fst->Final(s))); + } + } + const auto startweight = fst->Start() < potential.size() + ? potential[fst->Start()] + : Weight::Zero(); + if ((startweight != Weight::One()) && (startweight != Weight::Zero())) { + if (fst->Properties(kInitialAcyclic, true) & kInitialAcyclic) { + const auto s = fst->Start(); + for (MutableArcIterator> aiter(fst, s); !aiter.Done(); + aiter.Next()) { + auto arc = aiter.Value(); + if (type == REWEIGHT_TO_INITIAL) { + arc.weight = Times(startweight, arc.weight); + } else { + arc.weight = Times(Divide(Weight::One(), startweight, DIVIDE_RIGHT), + arc.weight); + } + aiter.SetValue(arc); + } + if (type == REWEIGHT_TO_INITIAL) { + fst->SetFinal(s, Times(startweight, fst->Final(s))); + } else { + fst->SetFinal(s, Times(Divide(Weight::One(), startweight, DIVIDE_RIGHT), + fst->Final(s))); + } + } else { + const auto s = fst->AddState(); + const auto weight = + (type == REWEIGHT_TO_INITIAL) + ? startweight + : Divide(Weight::One(), startweight, DIVIDE_RIGHT); + fst->AddArc(s, Arc(0, 0, weight, fst->Start())); + fst->SetStart(s); + } + } + fst->SetProperties(ReweightProperties(fst->Properties(kFstProperties, false)), + kFstProperties); +} + +} // namespace fst + +#endif // FST_REWEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/rmepsilon.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/rmepsilon.h new file mode 100644 index 0000000..5135bf2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/rmepsilon.h @@ -0,0 +1,548 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes that implemement epsilon-removal. + +#ifndef FST_RMEPSILON_H_ +#define FST_RMEPSILON_H_ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace fst { + +template +class RmEpsilonOptions + : public ShortestDistanceOptions> { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + bool connect; // Connect output + Weight weight_threshold; // Pruning weight threshold. + StateId state_threshold; // Pruning state threshold. + + explicit RmEpsilonOptions(Queue *queue, float delta = kShortestDelta, + bool connect = true, + Weight weight_threshold = Weight::Zero(), + StateId state_threshold = kNoStateId) + : ShortestDistanceOptions>( + queue, EpsilonArcFilter(), kNoStateId, delta), + connect(connect), + weight_threshold(std::move(weight_threshold)), + state_threshold(state_threshold) {} +}; + +namespace internal { + +// Computation state of the epsilon-removal algorithm. +template +class RmEpsilonState { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + RmEpsilonState(const Fst &fst, std::vector *distance, + const RmEpsilonOptions &opts) + : fst_(fst), + distance_(distance), + sd_state_(fst_, distance, opts, true), + expand_id_(0) {} + + void Expand(StateId s); + + std::vector &Arcs() { return arcs_; } + + const Weight &Final() const { return final_; } + + bool Error() const { return sd_state_.Error(); } + + private: + struct Element { + Label ilabel; + Label olabel; + StateId nextstate; + + Element() {} + + Element(Label ilabel, Label olabel, StateId nexstate) + : ilabel(ilabel), olabel(olabel), nextstate(nexstate) {} + }; + + struct ElementHash { + public: + size_t operator()(const Element &element) const { + static constexpr size_t prime0 = 7853; + static constexpr size_t prime1 = 7867; + return static_cast(element.nextstate) + + static_cast(element.ilabel) * prime0 + + static_cast(element.olabel) * prime1; + } + }; + + class ElementEqual { + public: + bool operator()(const Element &e1, const Element &e2) const { + return (e1.ilabel == e2.ilabel) && (e1.olabel == e2.olabel) && + (e1.nextstate == e2.nextstate); + } + }; + + using ElementMap = std::unordered_map, + ElementHash, ElementEqual>; + + const Fst &fst_; + // Distance from state being expanded in epsilon-closure. + std::vector *distance_; + // Shortest distance algorithm computation state. + internal::ShortestDistanceState> sd_state_; + // Maps an element to a pair corresponding to a position in the arcs vector + // of the state being expanded. The element corresopnds to the position in + // the arcs_ vector if p.first is equal to the state being expanded. + ElementMap element_map_; + EpsilonArcFilter eps_filter_; + std::stack eps_queue_; // Queue used to visit the epsilon-closure. + std::vector visited_; // True if the state has been visited. + std::forward_list visited_states_; // List of visited states. + std::vector arcs_; // Arcs of state being expanded. + Weight final_; // Final weight of state being expanded. + StateId expand_id_; // Unique ID for each call to Expand + + RmEpsilonState(const RmEpsilonState &) = delete; + RmEpsilonState &operator=(const RmEpsilonState &) = delete; +}; + +template +void RmEpsilonState::Expand(typename Arc::StateId source) { + final_ = Weight::Zero(); + arcs_.clear(); + sd_state_.ShortestDistance(source); + if (sd_state_.Error()) return; + eps_queue_.push(source); + while (!eps_queue_.empty()) { + const auto state = eps_queue_.top(); + eps_queue_.pop(); + while (visited_.size() <= state) visited_.push_back(false); + if (visited_[state]) continue; + visited_[state] = true; + visited_states_.push_front(state); + for (ArcIterator> aiter(fst_, state); !aiter.Done(); + aiter.Next()) { + auto arc = aiter.Value(); + arc.weight = Times((*distance_)[state], arc.weight); + if (eps_filter_(arc)) { + while (visited_.size() <= arc.nextstate) visited_.push_back(false); + if (!visited_[arc.nextstate]) eps_queue_.push(arc.nextstate); + } else { + const Element element(arc.ilabel, arc.olabel, arc.nextstate); + auto insert_result = element_map_.insert( + std::make_pair(element, std::make_pair(expand_id_, arcs_.size()))); + if (insert_result.second) { + arcs_.push_back(std::move(arc)); + } else { + if (insert_result.first->second.first == expand_id_) { + auto &weight = arcs_[insert_result.first->second.second].weight; + weight = Plus(weight, arc.weight); + } else { + insert_result.first->second.first = expand_id_; + insert_result.first->second.second = arcs_.size(); + arcs_.push_back(std::move(arc)); + } + } + } + } + final_ = Plus(final_, Times((*distance_)[state], fst_.Final(state))); + } + while (!visited_states_.empty()) { + visited_[visited_states_.front()] = false; + visited_states_.pop_front(); + } + ++expand_id_; +} + +} // namespace internal + +// Removes epsilon-transitions (when both the input and output label are an +// epsilon) from a transducer. The result will be an equivalent FST that has no +// such epsilon transitions. This version modifies its input. It allows fine +// control via the options argument; see below for a simpler interface. +// +// The distance vector will be used to hold the shortest distances during the +// epsilon-closure computation. The state queue discipline and convergence delta +// are taken in the options argument. +template +void RmEpsilon(MutableFst *fst, + std::vector *distance, + const RmEpsilonOptions &opts) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + if (fst->Start() == kNoStateId) return; + // noneps_in[s] will be set to true iff s admits a non-epsilon incoming + // transition or is the start state. + std::vector noneps_in(fst->NumStates(), false); + noneps_in[fst->Start()] = true; + for (size_t i = 0; i < fst->NumStates(); ++i) { + for (ArcIterator> aiter(*fst, i); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + if (arc.ilabel != 0 || arc.olabel != 0) { + noneps_in[arc.nextstate] = true; + } + } + } + // States sorted in topological order when (acyclic) or generic topological + // order (cyclic). + std::vector states; + states.reserve(fst->NumStates()); + if (fst->Properties(kTopSorted, false) & kTopSorted) { + for (size_t i = 0; i < fst->NumStates(); i++) states.push_back(i); + } else if (fst->Properties(kAcyclic, false) & kAcyclic) { + std::vector order; + bool acyclic; + TopOrderVisitor top_order_visitor(&order, &acyclic); + DfsVisit(*fst, &top_order_visitor, EpsilonArcFilter()); + // Sanity check: should be acyclic if property bit is set. + if (!acyclic) { + FSTERROR() << "RmEpsilon: Inconsistent acyclic property bit"; + fst->SetProperties(kError, kError); + return; + } + states.resize(order.size()); + for (StateId i = 0; i < order.size(); i++) states[order[i]] = i; + } else { + uint64 props; + std::vector scc; + SccVisitor scc_visitor(&scc, nullptr, nullptr, &props); + DfsVisit(*fst, &scc_visitor, EpsilonArcFilter()); + std::vector first(scc.size(), kNoStateId); + std::vector next(scc.size(), kNoStateId); + for (StateId i = 0; i < scc.size(); i++) { + if (first[scc[i]] != kNoStateId) next[i] = first[scc[i]]; + first[scc[i]] = i; + } + for (StateId i = 0; i < first.size(); i++) { + for (auto j = first[i]; j != kNoStateId; j = next[j]) { + states.push_back(j); + } + } + } + internal::RmEpsilonState rmeps_state(*fst, distance, opts); + while (!states.empty()) { + const auto state = states.back(); + states.pop_back(); + if (!noneps_in[state] && + (opts.connect || opts.weight_threshold != Weight::Zero() || + opts.state_threshold != kNoStateId)) { + continue; + } + rmeps_state.Expand(state); + fst->SetFinal(state, rmeps_state.Final()); + fst->DeleteArcs(state); + auto &arcs = rmeps_state.Arcs(); + fst->ReserveArcs(state, arcs.size()); + while (!arcs.empty()) { + fst->AddArc(state, arcs.back()); + arcs.pop_back(); + } + } + if (opts.connect || opts.weight_threshold != Weight::Zero() || + opts.state_threshold != kNoStateId) { + for (size_t s = 0; s < fst->NumStates(); ++s) { + if (!noneps_in[s]) fst->DeleteArcs(s); + } + } + if (rmeps_state.Error()) fst->SetProperties(kError, kError); + fst->SetProperties( + RmEpsilonProperties(fst->Properties(kFstProperties, false)), + kFstProperties); + if (opts.weight_threshold != Weight::Zero() || + opts.state_threshold != kNoStateId) { + Prune(fst, opts.weight_threshold, opts.state_threshold); + } + if (opts.connect && opts.weight_threshold == Weight::Zero() && + opts.state_threshold == kNoStateId) { + Connect(fst); + } +} + +// Removes epsilon-transitions (when both the input and output label +// are an epsilon) from a transducer. The result will be an equivalent +// FST that has no such epsilon transitions. This version modifies its +// input. It has a simplified interface; see above for a version that +// allows finer control. +// +// Complexity: +// +// - Time: +// +// Unweighted: O(v^2 + ve). +// Acyclic: O(v^2 + V e). +// Tropical semiring: O(v^2 log V + ve). +// General: exponential. +// +// - Space: O(vE) +// +// where v is the number of states visited and e is the number of arcs visited. +// +// For more information, see: +// +// Mohri, M. 2002. Generic epsilon-removal and input epsilon-normalization +// algorithms for weighted transducers. International Journal of Computer +// Science 13(1): 129-143. +template +void RmEpsilon(MutableFst *fst, bool connect = true, + typename Arc::Weight weight_threshold = Arc::Weight::Zero(), + typename Arc::StateId state_threshold = kNoStateId, + float delta = kShortestDelta) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + std::vector distance; + AutoQueue state_queue(*fst, &distance, EpsilonArcFilter()); + RmEpsilonOptions> opts( + &state_queue, delta, connect, weight_threshold, state_threshold); + RmEpsilon(fst, &distance, opts); +} + +struct RmEpsilonFstOptions : CacheOptions { + float delta; + + explicit RmEpsilonFstOptions(const CacheOptions &opts, + float delta = kShortestDelta) + : CacheOptions(opts), delta(delta) {} + + explicit RmEpsilonFstOptions(float delta = kShortestDelta) : delta(delta) {} +}; + +namespace internal { + +// Implementation of delayed RmEpsilonFst. +template +class RmEpsilonFstImpl : public CacheImpl { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Store = DefaultCacheStore; + using State = typename Store::State; + + using FstImpl::Properties; + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheBaseImpl>::HasArcs; + using CacheBaseImpl>::HasFinal; + using CacheBaseImpl>::HasStart; + using CacheBaseImpl>::PushArc; + using CacheBaseImpl>::SetArcs; + using CacheBaseImpl>::SetFinal; + using CacheBaseImpl>::SetStart; + + RmEpsilonFstImpl(const Fst &fst, const RmEpsilonFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + delta_(opts.delta), + rmeps_state_( + *fst_, &distance_, + RmEpsilonOptions>(&queue_, delta_, false)) { + SetType("rmepsilon"); + SetProperties( + RmEpsilonProperties(fst.Properties(kFstProperties, false), true), + kCopyProperties); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + } + + RmEpsilonFstImpl(const RmEpsilonFstImpl &impl) + : CacheImpl(impl), + fst_(impl.fst_->Copy(true)), + delta_(impl.delta_), + rmeps_state_( + *fst_, &distance_, + RmEpsilonOptions>(&queue_, delta_, false)) { + SetType("rmepsilon"); + SetProperties(impl.Properties(), kCopyProperties); + SetInputSymbols(impl.InputSymbols()); + SetOutputSymbols(impl.OutputSymbols()); + } + + StateId Start() { + if (!HasStart()) SetStart(fst_->Start()); + return CacheImpl::Start(); + } + + Weight Final(StateId s) { + if (!HasFinal(s)) Expand(s); + return CacheImpl::Final(s); + } + + size_t NumArcs(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumArcs(s); + } + + size_t NumInputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(StateId s) { + if (!HasArcs(s)) Expand(s); + return CacheImpl::NumOutputEpsilons(s); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + // Sets error if found and returns other FST impl properties. + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && + (fst_->Properties(kError, false) || rmeps_state_.Error())) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) { + if (!HasArcs(s)) Expand(s); + CacheImpl::InitArcIterator(s, data); + } + + void Expand(StateId s) { + rmeps_state_.Expand(s); + SetFinal(s, rmeps_state_.Final()); + auto &arcs = rmeps_state_.Arcs(); + while (!arcs.empty()) { + PushArc(s, std::move(arcs.back())); + arcs.pop_back(); + } + SetArcs(s); + } + + private: + std::unique_ptr> fst_; + float delta_; + std::vector distance_; + FifoQueue queue_; + internal::RmEpsilonState> rmeps_state_; +}; + +} // namespace internal + +// Removes epsilon-transitions (when both the input and output label are an +// epsilon) from a transducer. The result will be an equivalent FST that has no +// such epsilon transitions. This version is a +// delayed FST. +// +// Complexity: +// +// - Time: +// Unweighted: O(v^2 + ve). +// General: exponential. +// +// - Space: O(vE) +// +// where v is the number of states visited and e is the number of arcs visited. +// Constant time to visit an input state or arc is assumed and exclusive of +// caching. +// +// For more information, see: +// +// Mohri, M. 2002. Generic epsilon-removal and input epsilon-normalization +// algorithms for weighted transducers. International Journal of Computer +// Science 13(1): 129-143. +// +// This class attaches interface to implementation and handles +// reference counting, delegating most methods to ImplToFst. +template +class RmEpsilonFst : public ImplToFst> { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + using Store = DefaultCacheStore; + using State = typename Store::State; + using Impl = internal::RmEpsilonFstImpl; + + friend class ArcIterator>; + friend class StateIterator>; + + explicit RmEpsilonFst(const Fst &fst) + : ImplToFst(std::make_shared(fst, RmEpsilonFstOptions())) {} + + RmEpsilonFst(const Fst &fst, const RmEpsilonFstOptions &opts) + : ImplToFst(std::make_shared(fst, opts)) {} + + // See Fst<>::Copy() for doc. + RmEpsilonFst(const RmEpsilonFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Get a copy of this RmEpsilonFst. See Fst<>::Copy() for further doc. + RmEpsilonFst *Copy(bool safe = false) const override { + return new RmEpsilonFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + RmEpsilonFst &operator=(const RmEpsilonFst &) = delete; +}; + +// Specialization for RmEpsilonFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const RmEpsilonFst &fst) + : CacheStateIterator>(fst, fst.GetMutableImpl()) {} +}; + +// Specialization for RmEpsilonFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const RmEpsilonFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void RmEpsilonFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Useful alias when using StdArc. +using StdRmEpsilonFst = RmEpsilonFst; + +} // namespace fst + +#endif // FST_RMEPSILON_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/rmfinalepsilon.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/rmfinalepsilon.h new file mode 100644 index 0000000..87e3a71 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/rmfinalepsilon.h @@ -0,0 +1,80 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function to remove of final states that have epsilon-only input arcs. + +#ifndef FST_RMFINALEPSILON_H_ +#define FST_RMFINALEPSILON_H_ + +#include +#include + +#include +#include + + +namespace fst { + +// Removes final states that have epsilon-only input arcs. +template +void RmFinalEpsilon(MutableFst *fst) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + // Determines the coaccesibility of states. + std::vector access; + std::vector coaccess; + uint64 props = 0; + SccVisitor scc_visitor(nullptr, &access, &coaccess, &props); + DfsVisit(*fst, &scc_visitor); + // Finds potential list of removable final states. These are final states that + // have no outgoing transitions or final states that have a non-coaccessible + // future. + std::unordered_set finals; + for (StateIterator> siter(*fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (fst->Final(s) != Weight::Zero()) { + bool future_coaccess = false; + for (ArcIterator> aiter(*fst, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + if (coaccess[arc.nextstate]) { + future_coaccess = true; + break; + } + } + if (!future_coaccess) finals.insert(s); + } + } + // Moves the final weight. + std::vector arcs; + for (StateIterator> siter(*fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + auto weight = fst->Final(s); + arcs.clear(); + for (ArcIterator> aiter(*fst, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + // Next state is in the list of finals. + if (finals.find(arc.nextstate) != finals.end()) { + // Sums up all epsilon arcs. + if (arc.ilabel == 0 && arc.olabel == 0) { + weight = Plus(Times(fst->Final(arc.nextstate), arc.weight), weight); + } else { + arcs.push_back(arc); + } + } else { + arcs.push_back(arc); + } + } + // If some arcs (epsilon arcs) were deleted, delete all arcs and add back + // only the non-epsilon arcs. + if (arcs.size() < fst->NumArcs(s)) { + fst->DeleteArcs(s); + fst->SetFinal(s, weight); + for (const auto &arc : arcs) fst->AddArc(s, arc); + } + } + Connect(fst); +} + +} // namespace fst + +#endif // FST_RMFINALEPSILON_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arc-class.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arc-class.h new file mode 100644 index 0000000..551266d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arc-class.h @@ -0,0 +1,40 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_ARC_CLASS_H_ +#define FST_SCRIPT_ARC_CLASS_H_ + +#include + +namespace fst { +namespace script { + +// A struct representing an arc while ignoring arc type. It is passed as an +// argument to AddArc. + +struct ArcClass { + template + explicit ArcClass(const Arc &arc) + : ilabel(arc.ilabel), olabel(arc.olabel), weight(arc.weight), + nextstate(arc.nextstate) {} + + ArcClass(int64 ilabel, int64 olabel, const WeightClass &weight, + int64 nextstate) + : ilabel(ilabel), olabel(olabel), weight(weight), nextstate(nextstate) {} + + template + Arc GetArc() const { + return Arc(ilabel, olabel, *(weight.GetWeight()), + nextstate); + } + + int64 ilabel; + int64 olabel; + WeightClass weight; + int64 nextstate; +}; + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_ARC_CLASS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arciterator-class.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arciterator-class.h new file mode 100644 index 0000000..8e4ca4f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arciterator-class.h @@ -0,0 +1,212 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_ARCITERATOR_CLASS_H_ +#define FST_SCRIPT_ARCITERATOR_CLASS_H_ + +#include +#include + +#include +#include + +// Scripting API support for ArcIterator. +// +// A call to Value() causes the underlying arc to be used to construct the +// associated ArcClass. + +namespace fst { +namespace script { + +// Non-mutable arc iterators. + +// Virtual interface implemented by each concrete ArcIteratorImpl. +class ArcIteratorImplBase { + public: + virtual bool Done() const = 0; + virtual uint32 Flags() const = 0; + virtual void Next() = 0; + virtual size_t Position() const = 0; + virtual void Reset() = 0; + virtual void Seek(size_t a) = 0; + virtual void SetFlags(uint32 flags, uint32 mask) = 0; + virtual ArcClass Value() const = 0; + virtual ~ArcIteratorImplBase() {} +}; + +// Templated implementation. +template +class ArcIteratorClassImpl : public ArcIteratorImplBase { + public: + explicit ArcIteratorClassImpl(const Fst &fst, int64 s) + : aiter_(fst, s) {} + + bool Done() const final { return aiter_.Done(); } + + uint32 Flags() const final { return aiter_.Flags(); } + + void Next() final { aiter_.Next(); } + + size_t Position() const final { return aiter_.Position(); } + + void Reset() final { aiter_.Reset(); } + + void Seek(size_t a) final { aiter_.Seek(a); } + + void SetFlags(uint32 flags, uint32 mask) final { + aiter_.SetFlags(flags, mask); + } + + // This is returned by value because it has not yet been constructed, and + // is likely to participate in return-value optimization. + ArcClass Value() const final { return ArcClass(aiter_.Value()); } + + ~ArcIteratorClassImpl() final {} + + private: + ArcIterator> aiter_; +}; + +class ArcIteratorClass; + +using InitArcIteratorClassArgs = + std::tuple; + +// Untemplated user-facing class holding a templated pimpl. +class ArcIteratorClass { + public: + ArcIteratorClass(const FstClass &fst, int64 s); + + template + ArcIteratorClass(const Fst &fst, int64 s) + : impl_(new ArcIteratorClassImpl(fst, s)) {} + + bool Done() const { return impl_->Done(); } + + uint32 Flags() const { return impl_->Flags(); } + + void Next() { impl_->Next(); } + + size_t Position() const { return impl_->Position(); } + + void Reset() { impl_->Reset(); } + + void Seek(size_t a) { impl_->Seek(a); } + + void SetFlags(uint32 flags, uint32 mask) { impl_->SetFlags(flags, mask); } + + ArcClass Value() const { return impl_->Value(); } + + template + friend void InitArcIteratorClass(InitArcIteratorClassArgs *args); + + private: + std::unique_ptr impl_; +}; + +template +void InitArcIteratorClass(InitArcIteratorClassArgs *args) { + const Fst &fst = *(std::get<0>(*args).GetFst()); + std::get<2>(*args)->impl_.reset( + new ArcIteratorClassImpl(fst, std::get<1>(*args))); +} + +// Mutable arc iterators. + +// Virtual interface implemented by each concrete MutableArcIteratorImpl. +class MutableArcIteratorImplBase : public ArcIteratorImplBase { + public: + virtual void SetValue(const ArcClass &) = 0; + + ~MutableArcIteratorImplBase() override {} +}; + +// Templated implementation. +template +class MutableArcIteratorClassImpl + : public MutableArcIteratorImplBase { + public: + explicit MutableArcIteratorClassImpl(MutableFst *fst, int64 s) + : aiter_(fst, s) {} + + bool Done() const final { return aiter_.Done(); } + + uint32 Flags() const final { return aiter_.Flags(); } + + void Next() final { aiter_.Next(); } + + size_t Position() const final { return aiter_.Position(); } + + void Reset() final { aiter_.Reset(); } + + void Seek(size_t a) final { aiter_.Seek(a); } + + void SetFlags(uint32 flags, uint32 mask) final { + aiter_.SetFlags(flags, mask); + } + + void SetValue(const Arc &arc) { aiter_.SetValue(arc); } + + void SetValue(const ArcClass &ac) final { aiter_.SetValue(ac.GetArc()); } + + // This is returned by value because it has not yet been constructed, and + // is likely to participate in return-value optimization. + ArcClass Value() const final { return ArcClass(aiter_.Value()); } + + ~MutableArcIteratorClassImpl() override {} + + private: + MutableArcIterator> aiter_; +}; + +class MutableArcIteratorClass; + +using InitMutableArcIteratorClassArgs = + std::tuple; + +// Untemplated user-facing class holding a templated pimpl. +class MutableArcIteratorClass { + public: + MutableArcIteratorClass(MutableFstClass *fst, int64 s); + + template + MutableArcIteratorClass(MutableFst *fst, int64 s) + : impl_(new MutableArcIteratorClassImpl(fst, s)) {} + + bool Done() const { return impl_->Done(); } + + uint32 Flags() const { return impl_->Flags(); } + + void Next() { impl_->Next(); } + + size_t Position() const { return impl_->Position(); } + + void Reset() { impl_->Reset(); } + + void Seek(size_t a) { impl_->Seek(a); } + + void SetFlags(uint32 flags, uint32 mask) { impl_->SetFlags(flags, mask); } + + void SetValue(const ArcClass &ac) { impl_->SetValue(ac); } + + ArcClass Value() const { return impl_->Value(); } + + template + friend void InitMutableArcIteratorClass( + InitMutableArcIteratorClassArgs *args); + + private: + std::unique_ptr impl_; +}; + +template +void InitMutableArcIteratorClass(InitMutableArcIteratorClassArgs *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + std::get<2>(*args)->impl_.reset( + new MutableArcIteratorClassImpl(fst, std::get<1>(*args))); +} + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_ARCITERATOR_CLASS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arcsort.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arcsort.h new file mode 100644 index 0000000..3e56fe5 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arcsort.h @@ -0,0 +1,44 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_ARCSORT_H_ +#define FST_SCRIPT_ARCSORT_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +enum ArcSortType { + ILABEL_SORT, + OLABEL_SORT +}; + +using ArcSortArgs = std::pair; + +template +void ArcSort(ArcSortArgs *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + switch (std::get<1>(*args)) { + case ILABEL_SORT: { + const ILabelCompare icomp; + ArcSort(fst, icomp); + return; + } + case OLABEL_SORT: { + const OLabelCompare ocomp; + ArcSort(fst, ocomp); + return; + } + } +} + +void ArcSort(MutableFstClass *ofst, ArcSortType); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_ARCSORT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arg-packs.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arg-packs.h new file mode 100644 index 0000000..93cd4a0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/arg-packs.h @@ -0,0 +1,37 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// std::pair and std::tuple are used for the arguments of FstClass operations. +// +// If a function with a return value is required, use the WithReturnValue +// template as follows: +// +// WithReturnValue> + +#ifndef FST_SCRIPT_ARG_PACKS_H_ +#define FST_SCRIPT_ARG_PACKS_H_ + +#include + +namespace fst { +namespace script { + +// Tack this on to an existing type to add a return value. The syntax for +// accessing the args is then slightly more stilted, as you must do an extra +// member access (since the args are stored as a member of this class). + +template +struct WithReturnValue { + // Avoid reference-to-reference if ArgTuple is a reference. + using Args = typename std::remove_reference::type; + + Retval retval; + const Args &args; + + explicit WithReturnValue(const Args &args) : args(args) {} +}; + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_ARG_PACKS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/closure.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/closure.h new file mode 100644 index 0000000..7c68604 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/closure.h @@ -0,0 +1,28 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_CLOSURE_H_ +#define FST_SCRIPT_CLOSURE_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using ClosureArgs = std::pair; + +template +void Closure(ClosureArgs *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + Closure(fst, std::get<1>(*args)); +} + +void Closure(MutableFstClass *ofst, ClosureType closure_type); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_CLOSURE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compile-impl.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compile-impl.h new file mode 100644 index 0000000..943a0b7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compile-impl.h @@ -0,0 +1,217 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to to compile a binary FST from textual input. + +#ifndef FST_SCRIPT_COMPILE_IMPL_H_ +#define FST_SCRIPT_COMPILE_IMPL_H_ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +DECLARE_string(fst_field_separator); + +namespace fst { + +// Compile a binary Fst from textual input, helper class for fstcompile.cc +// WARNING: Stand-alone use of this class not recommended, most code should +// read/write using the binary format which is much more efficient. +template +class FstCompiler { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // WARNING: use of negative labels not recommended as it may cause conflicts. + // If add_symbols_ is true, then the symbols will be dynamically added to the + // symbol tables. This is only useful if you set the (i/o)keep flag to attach + // the final symbol table, or use the accessors. (The input symbol tables are + // const and therefore not changed.) + FstCompiler(std::istream &istrm, const string &source, // NOLINT + const SymbolTable *isyms, const SymbolTable *osyms, + const SymbolTable *ssyms, bool accep, bool ikeep, + bool okeep, bool nkeep, bool allow_negative_labels = false) { + std::unique_ptr misyms(isyms ? isyms->Copy() : nullptr); + std::unique_ptr mosyms(osyms ? osyms->Copy() : nullptr); + std::unique_ptr mssyms(ssyms ? ssyms->Copy() : nullptr); + Init(istrm, source, misyms.get(), mosyms.get(), mssyms.get(), accep, + ikeep, okeep, nkeep, allow_negative_labels, false); + } + + FstCompiler(std::istream &istrm, const string &source, // NOLINT + SymbolTable *isyms, SymbolTable *osyms, SymbolTable *ssyms, + bool accep, bool ikeep, bool okeep, bool nkeep, + bool allow_negative_labels, bool add_symbols) { + Init(istrm, source, isyms, osyms, ssyms, accep, ikeep, okeep, nkeep, + allow_negative_labels, add_symbols); + } + + void Init(std::istream &istrm, const string &source, // NOLINT + SymbolTable *isyms, SymbolTable *osyms, SymbolTable *ssyms, + bool accep, bool ikeep, bool okeep, bool nkeep, + bool allow_negative_labels, bool add_symbols) { + nline_ = 0; + source_ = source; + isyms_ = isyms; + osyms_ = osyms; + ssyms_ = ssyms; + nstates_ = 0; + keep_state_numbering_ = nkeep; + allow_negative_labels_ = allow_negative_labels; + add_symbols_ = add_symbols; + bool start_state_populated = false; + char line[kLineLen]; + const string separator = FLAGS_fst_field_separator + "\n"; + while (istrm.getline(line, kLineLen)) { + ++nline_; + std::vector col; + SplitString(line, separator.c_str(), &col, true); + if (col.empty() || col[0][0] == '\0') + continue; + if (col.size() > 5 || (col.size() > 4 && accep) || + (col.size() == 3 && !accep)) { + FSTERROR() << "FstCompiler: Bad number of columns, source = " << source_ + << ", line = " << nline_; + fst_.SetProperties(kError, kError); + return; + } + StateId s = StrToStateId(col[0]); + while (s >= fst_.NumStates()) fst_.AddState(); + if (!start_state_populated) { + fst_.SetStart(s); + start_state_populated = true; + } + + Arc arc; + StateId d = s; + switch (col.size()) { + case 1: + fst_.SetFinal(s, Weight::One()); + break; + case 2: + fst_.SetFinal(s, StrToWeight(col[1], true)); + break; + case 3: + arc.nextstate = d = StrToStateId(col[1]); + arc.ilabel = StrToILabel(col[2]); + arc.olabel = arc.ilabel; + arc.weight = Weight::One(); + fst_.AddArc(s, arc); + break; + case 4: + arc.nextstate = d = StrToStateId(col[1]); + arc.ilabel = StrToILabel(col[2]); + if (accep) { + arc.olabel = arc.ilabel; + arc.weight = StrToWeight(col[3], true); + } else { + arc.olabel = StrToOLabel(col[3]); + arc.weight = Weight::One(); + } + fst_.AddArc(s, arc); + break; + case 5: + arc.nextstate = d = StrToStateId(col[1]); + arc.ilabel = StrToILabel(col[2]); + arc.olabel = StrToOLabel(col[3]); + arc.weight = StrToWeight(col[4], true); + fst_.AddArc(s, arc); + } + while (d >= fst_.NumStates()) fst_.AddState(); + } + if (ikeep) fst_.SetInputSymbols(isyms); + if (okeep) fst_.SetOutputSymbols(osyms); + } + + const VectorFst &Fst() const { return fst_; } + + private: + // Maximum line length in text file. + static constexpr int kLineLen = 8096; + + StateId StrToId(const char *s, SymbolTable *syms, const char *name, + bool allow_negative = false) const { + StateId n = 0; + if (syms) { + n = (add_symbols_) ? syms->AddSymbol(s) : syms->Find(s); + if (n == -1 || (!allow_negative && n < 0)) { + FSTERROR() << "FstCompiler: Symbol \"" << s + << "\" is not mapped to any integer " << name + << ", symbol table = " << syms->Name() + << ", source = " << source_ << ", line = " << nline_; + fst_.SetProperties(kError, kError); + } + } else { + char *p; + n = strtoll(s, &p, 10); + if (p < s + strlen(s) || (!allow_negative && n < 0)) { + FSTERROR() << "FstCompiler: Bad " << name << " integer = \"" << s + << "\", source = " << source_ << ", line = " << nline_; + fst_.SetProperties(kError, kError); + } + } + return n; + } + + StateId StrToStateId(const char *s) { + StateId n = StrToId(s, ssyms_, "state ID"); + if (keep_state_numbering_) return n; + // Remaps state IDs to make dense set. + const auto it = states_.find(n); + if (it == states_.end()) { + states_[n] = nstates_; + return nstates_++; + } else { + return it->second; + } + } + + StateId StrToILabel(const char *s) const { + return StrToId(s, isyms_, "arc ilabel", allow_negative_labels_); + } + + StateId StrToOLabel(const char *s) const { + return StrToId(s, osyms_, "arc olabel", allow_negative_labels_); + } + + Weight StrToWeight(const char *s, bool allow_zero) const { + Weight w; + std::istringstream strm(s); + strm >> w; + if (!strm || (!allow_zero && w == Weight::Zero())) { + FSTERROR() << "FstCompiler: Bad weight = \"" << s + << "\", source = " << source_ << ", line = " << nline_; + fst_.SetProperties(kError, kError); + w = Weight::NoWeight(); + } + return w; + } + + mutable VectorFst fst_; + size_t nline_; + string source_; // Text FST source name. + SymbolTable *isyms_; // ilabel symbol table (not owned). + SymbolTable *osyms_; // olabel symbol table (not owned). + SymbolTable *ssyms_; // slabel symbol table (not owned). + std::unordered_map states_; // State ID map. + StateId nstates_; // Number of seen states. + bool keep_state_numbering_; + bool allow_negative_labels_; // Not recommended; may cause conflicts. + bool add_symbols_; // Add to symbol tables on-the fly. + + FstCompiler(const FstCompiler &) = delete; + FstCompiler &operator=(const FstCompiler &) = delete; +}; + +} // namespace fst + +#endif // FST_SCRIPT_COMPILE_IMPL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compile.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compile.h new file mode 100644 index 0000000..c82ed47 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compile.h @@ -0,0 +1,98 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_COMPILE_H_ +#define FST_SCRIPT_COMPILE_H_ + +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +// This operation exists in two forms. 1 is a void operation which writes the +// compiled machine to disk; 2 returns an FstClass. I/O should normally be done +// using the binary format for efficiency, so users are STRONGLY ENCOURAGED to +// use 1 or to construct FSTs using the C++ FST mutation operations. + +// Note: it is safe to pass these strings as references because +// this struct is only used to pass them deeper in the call graph. +// Be sure you understand why this is so before using this struct +// for anything else! +struct CompileFstInnerArgs { + std::istream &istrm; + const string &source; + const string &fst_type; + const fst::SymbolTable *isyms; + const fst::SymbolTable *osyms; + const fst::SymbolTable *ssyms; + const bool accep; + const bool ikeep; + const bool okeep; + const bool nkeep; + const bool allow_negative_labels; + + CompileFstInnerArgs(std::istream &istrm, const string &source, + const string &fst_type, const fst::SymbolTable *isyms, + const fst::SymbolTable *osyms, + const fst::SymbolTable *ssyms, bool accep, bool ikeep, + bool okeep, bool nkeep, + bool allow_negative_labels = false) + : istrm(istrm), + source(source), + fst_type(fst_type), + isyms(isyms), + osyms(osyms), + ssyms(ssyms), + accep(accep), + ikeep(ikeep), + okeep(okeep), + nkeep(nkeep), + allow_negative_labels(allow_negative_labels) {} +}; + +using CompileFstArgs = WithReturnValue; + +template +void CompileFstInternal(CompileFstArgs *args) { + using fst::Convert; + using fst::Fst; + using fst::FstCompiler; + FstCompiler fstcompiler( + args->args.istrm, args->args.source, args->args.isyms, args->args.osyms, + args->args.ssyms, args->args.accep, args->args.ikeep, args->args.okeep, + args->args.nkeep, args->args.allow_negative_labels); + const Fst *fst = &fstcompiler.Fst(); + std::unique_ptr> owned_fst; + if (args->args.fst_type != "vector") { + owned_fst.reset(Convert(*fst, args->args.fst_type)); + if (!owned_fst) { + FSTERROR() << "Failed to convert FST to desired type: " + << args->args.fst_type; + } + fst = owned_fst.get(); + } + args->retval = fst ? new FstClass(*fst) : nullptr; +} + +void CompileFst(std::istream &istrm, const string &source, const string &dest, + const string &fst_type, const string &arc_type, + const SymbolTable *isyms, const SymbolTable *osyms, + const SymbolTable *ssyms, bool accep, bool ikeep, bool okeep, + bool nkeep, bool allow_negative_labels); + +FstClass *CompileFstInternal(std::istream &istrm, const string &source, + const string &fst_type, const string &arc_type, + const SymbolTable *isyms, const SymbolTable *osyms, + const SymbolTable *ssyms, bool accep, bool ikeep, + bool okeep, bool nkeep, + bool allow_negative_labels); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_COMPILE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compose.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compose.h new file mode 100644 index 0000000..a173580 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/compose.h @@ -0,0 +1,34 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_COMPOSE_H_ +#define FST_SCRIPT_COMPOSE_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using ComposeArgs = std::tuple; + +template +void Compose(ComposeArgs *args) { + const Fst &ifst1 = *(std::get<0>(*args).GetFst()); + const Fst &ifst2 = *(std::get<1>(*args).GetFst()); + MutableFst *ofst = std::get<2>(*args)->GetMutableFst(); + const auto &opts = std::get<3>(*args); + Compose(ifst1, ifst2, ofst, opts); +} + +void Compose(const FstClass &ifst1, const FstClass &ifst2, + MutableFstClass *ofst, + const ComposeOptions &opts = ComposeOptions()); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_COMPOSE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/concat.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/concat.h new file mode 100644 index 0000000..4bf8dc6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/concat.h @@ -0,0 +1,40 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_CONCAT_H_ +#define FST_SCRIPT_CONCAT_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using ConcatArgs1 = std::pair; + +template +void Concat(ConcatArgs1 *args) { + MutableFst *ofst = std::get<0>(*args)->GetMutableFst(); + const Fst &ifst = *(std::get<1>(*args).GetFst()); + Concat(ofst, ifst); +} + +using ConcatArgs2 = std::pair; + +template +void Concat(ConcatArgs2 *args) { + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + Concat(ifst, ofst); +} + +void Concat(MutableFstClass *ofst, const FstClass &ifst); + +void Concat(const FstClass &ifst, MutableFstClass *ofst); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_CONCAT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/connect.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/connect.h new file mode 100644 index 0000000..030102a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/connect.h @@ -0,0 +1,23 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_CONNECT_H_ +#define FST_SCRIPT_CONNECT_H_ + +#include +#include + +namespace fst { +namespace script { + +template +void Connect(MutableFstClass *fst) { + Connect(fst->GetMutableFst()); +} + +void Connect(MutableFstClass *fst); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_CONNECT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/convert.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/convert.h new file mode 100644 index 0000000..1a6eeaa --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/convert.h @@ -0,0 +1,35 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_CONVERT_H_ +#define FST_SCRIPT_CONVERT_H_ + +#include +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using ConvertInnerArgs = std::pair; + +using ConvertArgs = WithReturnValue; + +template +void Convert(ConvertArgs *args) { + const Fst &fst = *(std::get<0>(args->args).GetFst()); + const string &new_type = std::get<1>(args->args); + std::unique_ptr> result(Convert(fst, new_type)); + args->retval = result ? new FstClass(*result) : nullptr; +} + +FstClass *Convert(const FstClass &fst, const string &new_type); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_CONVERT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/decode.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/decode.h new file mode 100644 index 0000000..09f2539 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/decode.h @@ -0,0 +1,49 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_DECODE_H_ +#define FST_SCRIPT_DECODE_H_ + +#include +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using DecodeArgs1 = std::pair; + +template +void Decode(DecodeArgs1 *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + std::unique_ptr> decoder( + EncodeMapper::Read(std::get<1>(*args), DECODE)); + if (!decoder) { + fst->SetProperties(kError, kError); + return; + } + Decode(fst, *decoder); +} + +using DecodeArgs2 = std::pair; + +template +void Decode(DecodeArgs2 *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + const EncodeMapper &encoder = + *(std::get<1>(*args).GetEncodeMapper()); + Decode(fst, encoder); +} + +void Decode(MutableFstClass *fst, const string &coder_fname); + +void Decode(MutableFstClass *fst, const EncodeMapperClass &encoder); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_DECODE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/determinize.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/determinize.h new file mode 100644 index 0000000..383a8fe --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/determinize.h @@ -0,0 +1,59 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_DETERMINIZE_H_ +#define FST_SCRIPT_DETERMINIZE_H_ + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +struct DeterminizeOptions { + const float delta; + const WeightClass &weight_threshold; + const int64 state_threshold; + const int64 subsequential_label; + const DeterminizeType det_type; + const bool increment_subsequential_label; + + DeterminizeOptions(float delta, const WeightClass &weight_threshold, + int64 state_threshold = kNoStateId, + int64 subsequential_label = 0, + DeterminizeType det_type = DETERMINIZE_FUNCTIONAL, + bool increment_subsequential_label = false) + : delta(delta), + weight_threshold(weight_threshold), + state_threshold(state_threshold), + subsequential_label(subsequential_label), + det_type(det_type), + increment_subsequential_label(increment_subsequential_label) {} +}; + +using DeterminizeArgs = std::tuple; + +template +void Determinize(DeterminizeArgs *args) { + using Weight = typename Arc::Weight; + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + const auto &opts = std::get<2>(*args); + const auto weight_threshold = *(opts.weight_threshold.GetWeight()); + const fst::DeterminizeOptions detargs(opts.delta, weight_threshold, + opts.state_threshold, opts.subsequential_label, opts.det_type, + opts.increment_subsequential_label); + Determinize(ifst, ofst, detargs); +} + +void Determinize(const FstClass &ifst, MutableFstClass *ofst, + const DeterminizeOptions &opts); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_DETERMINIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/difference.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/difference.h new file mode 100644 index 0000000..7af6200 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/difference.h @@ -0,0 +1,35 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_DIFFERENCE_H_ +#define FST_SCRIPT_DIFFERENCE_H_ + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using DifferenceArgs = std::tuple; + +template +void Difference(DifferenceArgs *args) { + const Fst &ifst1 = *(std::get<0>(*args).GetFst()); + const Fst &ifst2 = *(std::get<1>(*args).GetFst()); + MutableFst *ofst = std::get<2>(*args)->GetMutableFst(); + const auto &opts = std::get<3>(*args); + Difference(ifst1, ifst2, ofst, opts); +} + +void Difference(const FstClass &ifst1, const FstClass &ifst2, + MutableFstClass *ofst, + const ComposeOptions &opts = ComposeOptions()); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_DIFFERENCE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/disambiguate.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/disambiguate.h new file mode 100644 index 0000000..acc1fba --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/disambiguate.h @@ -0,0 +1,54 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_DISAMBIGUATE_H_ +#define FST_SCRIPT_DISAMBIGUATE_H_ + +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +struct DisambiguateOptions { + const float delta; + const WeightClass &weight_threshold; + const int64 state_threshold; + const int64 subsequential_label; + + DisambiguateOptions(float delta, const WeightClass &weight_threshold, + int64 state_threshold = kNoStateId, + int64 subsequential_label = 0) + : delta(delta), + weight_threshold(weight_threshold), + state_threshold(state_threshold), + subsequential_label(subsequential_label) {} +}; + +using DisambiguateArgs = std::tuple; + +template +void Disambiguate(DisambiguateArgs *args) { + using Weight = typename Arc::Weight; + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + const auto &opts = std::get<2>(*args); + const auto weight_threshold = *(opts.weight_threshold.GetWeight()); + const fst::DisambiguateOptions disargs(opts.delta, weight_threshold, + opts.state_threshold, + opts.subsequential_label); + Disambiguate(ifst, ofst, disargs); +} + +void Disambiguate(const FstClass &ifst, MutableFstClass *ofst, + const DisambiguateOptions &opts); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_DISAMBIGUATE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/draw-impl.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/draw-impl.h new file mode 100644 index 0000000..f204b2e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/draw-impl.h @@ -0,0 +1,227 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to draw a binary FST by producing a text file in dot format, a helper +// class to fstdraw.cc. + +#ifndef FST_SCRIPT_DRAW_IMPL_H_ +#define FST_SCRIPT_DRAW_IMPL_H_ + +#include +#include +#include + +#include +#include +#include + +namespace fst { + +// Print a binary FST in GraphViz textual format (helper class for fstdraw.cc). +// WARNING: Stand-alone use not recommend. +template +class FstDrawer { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + FstDrawer(const Fst &fst, const SymbolTable *isyms, + const SymbolTable *osyms, const SymbolTable *ssyms, bool accep, + const string &title, float width, float height, bool portrait, + bool vertical, float ranksep, float nodesep, int fontsize, + int precision, const string &float_format, bool show_weight_one) + : fst_(fst), + isyms_(isyms), + osyms_(osyms), + ssyms_(ssyms), + accep_(accep && fst.Properties(kAcceptor, true)), + ostrm_(nullptr), + title_(title), + width_(width), + height_(height), + portrait_(portrait), + vertical_(vertical), + ranksep_(ranksep), + nodesep_(nodesep), + fontsize_(fontsize), + precision_(precision), + float_format_(float_format), + show_weight_one_(show_weight_one) {} + + // Draws FST to an output buffer. + void Draw(std::ostream *strm, const string &dest) { + ostrm_ = strm; + SetStreamState(ostrm_); + dest_ = dest; + StateId start = fst_.Start(); + if (start == kNoStateId) return; + PrintString("digraph FST {\n"); + if (vertical_) { + PrintString("rankdir = BT;\n"); + } else { + PrintString("rankdir = LR;\n"); + } + PrintString("size = \""); + Print(width_); + PrintString(","); + Print(height_); + PrintString("\";\n"); + if (!dest_.empty()) PrintString("label = \"" + title_ + "\";\n"); + PrintString("center = 1;\n"); + if (portrait_) { + PrintString("orientation = Portrait;\n"); + } else { + PrintString("orientation = Landscape;\n"); + } + PrintString("ranksep = \""); + Print(ranksep_); + PrintString("\";\n"); + PrintString("nodesep = \""); + Print(nodesep_); + PrintString("\";\n"); + // Initial state first. + DrawState(start); + for (StateIterator> siter(fst_); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (s != start) DrawState(s); + } + PrintString("}\n"); + } + + private: + void SetStreamState(std::ostream* strm) const { + strm->precision(precision_); + if (float_format_ == "e") + strm->setf(std::ios_base::scientific, std::ios_base::floatfield); + if (float_format_ == "f") + strm->setf(std::ios_base::fixed, std::ios_base::floatfield); + // O.w. defaults to "g" per standard lib. + } + + void PrintString(const string &str) const { *ostrm_ << str; } + + // Escapes backslash and double quote if these occur in the string. Dot will + // not deal gracefully with these if they are not escaped. + static string Escape(const string &str) { + string ns; + for (char c : str) { + if (c == '\\' || c == '"') ns.push_back('\\'); + ns.push_back(c); + } + return ns; + } + + void PrintId(StateId id, const SymbolTable *syms, const char *name) const { + if (syms) { + auto symbol = syms->Find(id); + if (symbol.empty()) { + FSTERROR() << "FstDrawer: Integer " << id + << " is not mapped to any textual symbol" + << ", symbol table = " << syms->Name() + << ", destination = " << dest_; + symbol = "?"; + } + PrintString(Escape(symbol)); + } else { + PrintString(std::to_string(id)); + } + } + + void PrintStateId(StateId s) const { PrintId(s, ssyms_, "state ID"); } + + void PrintILabel(Label label) const { + PrintId(label, isyms_, "arc input label"); + } + + void PrintOLabel(Label label) const { + PrintId(label, osyms_, "arc output label"); + } + + void PrintWeight(Weight w) const { + // Weight may have double quote characters in it, so escape it. + PrintString(Escape(ToString(w))); + } + + template + void Print(T t) const { *ostrm_ << t; } + + template + string ToString(T t) const { + std::stringstream ss; + SetStreamState(&ss); + ss << t; + return ss.str(); + } + + void DrawState(StateId s) const { + Print(s); + PrintString(" [label = \""); + PrintStateId(s); + const auto weight = fst_.Final(s); + if (weight != Weight::Zero()) { + if (show_weight_one_ || (weight != Weight::One())) { + PrintString("/"); + PrintWeight(weight); + } + PrintString("\", shape = doublecircle,"); + } else { + PrintString("\", shape = circle,"); + } + if (s == fst_.Start()) { + PrintString(" style = bold,"); + } else { + PrintString(" style = solid,"); + } + PrintString(" fontsize = "); + Print(fontsize_); + PrintString("]\n"); + for (ArcIterator> aiter(fst_, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + PrintString("\t"); + Print(s); + PrintString(" -> "); + Print(arc.nextstate); + PrintString(" [label = \""); + PrintILabel(arc.ilabel); + if (!accep_) { + PrintString(":"); + PrintOLabel(arc.olabel); + } + if (show_weight_one_ || (arc.weight != Weight::One())) { + PrintString("/"); + PrintWeight(arc.weight); + } + PrintString("\", fontsize = "); + Print(fontsize_); + PrintString("];\n"); + } + } + + const Fst &fst_; + const SymbolTable *isyms_; // ilabel symbol table. + const SymbolTable *osyms_; // olabel symbol table. + const SymbolTable *ssyms_; // slabel symbol table. + bool accep_; // Print as acceptor when possible. + std::ostream *ostrm_; // Drawn FST destination. + string dest_; // Drawn FST destination name. + + string title_; + float width_; + float height_; + bool portrait_; + bool vertical_; + float ranksep_; + float nodesep_; + int fontsize_; + int precision_; + string float_format_; + bool show_weight_one_; + + FstDrawer(const FstDrawer &) = delete; + FstDrawer &operator=(const FstDrawer &) = delete; +}; + +} // namespace fst + +#endif // FST_SCRIPT_DRAW_IMPL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/draw.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/draw.h new file mode 100644 index 0000000..cb37df1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/draw.h @@ -0,0 +1,85 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_DRAW_H_ +#define FST_SCRIPT_DRAW_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +// Note: it is safe to pass these strings as references because +// this struct is only used to pass them deeper in the call graph. +// Be sure you understand why this is so before using this struct +// for anything else! +struct FstDrawerArgs { + const FstClass &fst; + const SymbolTable *isyms; + const SymbolTable *osyms; + const SymbolTable *ssyms; + const bool accep; + const string &title; + const float width; + const float height; + const bool portrait; + const bool vertical; + const float ranksep; + const float nodesep; + const int fontsize; + const int precision; + const string &float_format; // NOLINT + const bool show_weight_one; + std::ostream *ostrm; + const string &dest; + + FstDrawerArgs(const FstClass &fst, const SymbolTable *isyms, + const SymbolTable *osyms, const SymbolTable *ssyms, bool accep, + const string &title, float width, float height, bool portrait, + bool vertical, float ranksep, float nodesep, int fontsize, + int precision, const string &float_format, + bool show_weight_one, std::ostream *ostrm, const string &dest) + : fst(fst), + isyms(isyms), + osyms(osyms), + ssyms(ssyms), + accep(accep), + title(title), + width(width), + height(height), + portrait(portrait), + vertical(vertical), + ranksep(ranksep), + nodesep(nodesep), + fontsize(fontsize), + precision(precision), + float_format(float_format), + show_weight_one(show_weight_one), + ostrm(ostrm), + dest(dest) {} +}; + +template +void DrawFst(FstDrawerArgs *args) { + const Fst &fst = *(args->fst.GetFst()); + FstDrawer fstdrawer(fst, args->isyms, args->osyms, args->ssyms, + args->accep, args->title, args->width, args->height, args->portrait, + args->vertical, args->ranksep, args->nodesep, args->fontsize, + args->precision, args->float_format, args->show_weight_one); + fstdrawer.Draw(args->ostrm, args->dest); +} + +void DrawFst(const FstClass &fst, const SymbolTable *isyms, + const SymbolTable *osyms, const SymbolTable *ssyms, bool accep, + const string &title, float width, float height, bool portrait, + bool vertical, float ranksep, float nodesep, int fontsize, + int precision, const string &float_format, bool show_weight_one, + std::ostream *ostrm, const string &dest); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_DRAW_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/encode.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/encode.h new file mode 100644 index 0000000..6a86968 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/encode.h @@ -0,0 +1,51 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_ENCODE_H_ +#define FST_SCRIPT_ENCODE_H_ + +#include +#include +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using EncodeArgs1 = std::tuple; + +template +void Encode(EncodeArgs1 *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + const string &coder_fname = std::get<3>(*args); + // If true, reuse encode from disk. If false, make a new encoder and just use + // the filename argument as the destination state. + std::unique_ptr> encoder( + std::get<2>(*args) ? EncodeMapper::Read(coder_fname, ENCODE) + : new EncodeMapper(std::get<1>(*args), ENCODE)); + Encode(fst, encoder.get()); + if (!std::get<2>(*args)) encoder->Write(coder_fname); +} + +using EncodeArgs2 = std::pair; + +template +void Encode(EncodeArgs2 *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + EncodeMapper *encoder = std::get<1>(*args)->GetEncodeMapper(); + Encode(fst, encoder); +} + +void Encode(MutableFstClass *fst, uint32 flags, bool reuse_encoder, + const string &coder_fname); + +void Encode(MutableFstClass *fst, EncodeMapperClass *encoder); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_ENCODE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/encodemapper-class.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/encodemapper-class.h new file mode 100644 index 0000000..b62824f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/encodemapper-class.h @@ -0,0 +1,169 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_ENCODEMAPPER_CLASS_H_ +#define FST_SCRIPT_ENCODEMAPPER_CLASS_H_ + +#include +#include +#include + +#include +#include +#include + +// Scripting API support for EncodeMapper. + +namespace fst { +namespace script { + +// Virtual interface implemented by each concrete EncodeMapperClassImpl. +class EncodeMapperImplBase { + public: + // Returns an encoded ArcClass. + virtual ArcClass operator()(const ArcClass &a) = 0; + virtual const string &ArcType() const = 0; + virtual uint32 Flags() const = 0; + virtual uint64 Properties(uint64 inprops) = 0; + virtual EncodeType Type() const = 0; + virtual const SymbolTable *InputSymbols() const = 0; + virtual const SymbolTable *OutputSymbols() const = 0; + virtual void SetInputSymbols(const SymbolTable *syms) = 0; + virtual void SetOutputSymbols(const SymbolTable *syms) = 0; + virtual const string &WeightType() const = 0; + virtual ~EncodeMapperImplBase() {} +}; + +// Templated implementation. +template +class EncodeMapperClassImpl : public EncodeMapperImplBase { + public: + EncodeMapperClassImpl(uint32 flags, EncodeType type) + : encoder_(flags, type) {} + + ArcClass operator()(const ArcClass &a) final; + + const string &ArcType() const final { return Arc::Type(); } + + uint32 Flags() const final { return encoder_.Flags(); } + + uint64 Properties(uint64 inprops) final { + return encoder_.Properties(inprops); + } + + EncodeType Type() const final { return encoder_.Type(); } + + const SymbolTable *InputSymbols() const final { + return encoder_.InputSymbols(); + } + + const SymbolTable *OutputSymbols() const final { + return encoder_.OutputSymbols(); + } + + void SetInputSymbols(const SymbolTable *syms) final { + encoder_.SetInputSymbols(syms); + } + + void SetOutputSymbols(const SymbolTable *syms) final { + encoder_.SetOutputSymbols(syms); + } + + const string &WeightType() const final { return Arc::Weight::Type(); } + + ~EncodeMapperClassImpl() override {} + + EncodeMapper *GetImpl() const { return &encoder_; } + + EncodeMapper *GetImpl() { return &encoder_; } + + private: + EncodeMapper encoder_; +}; + +// This is returned by value because it is very likely to undergo return-value +// optimization. +template +inline ArcClass EncodeMapperClassImpl::operator()(const ArcClass &a) { + Arc arc(a.ilabel, a.olabel, *(a.weight.GetWeight()), + a.nextstate); + return ArcClass(encoder_(arc)); +} + +class EncodeMapperClass; + +using InitEncodeMapperClassArgs = + std::tuple; + +class EncodeMapperClass { + public: + EncodeMapperClass(const string &arc_type, uint32 flags, EncodeType type); + + template + EncodeMapperClass(uint32 flags, EncodeType type) + : impl_(new EncodeMapperClassImpl(flags, type)) {} + + ArcClass operator()(const ArcClass &arc) { return (*impl_)(arc); } + + const string &ArcType() const { return impl_->ArcType(); } + + uint32 Flags() const { return impl_->Flags(); } + + uint64 Properties(uint64 inprops) { return impl_->Properties(inprops); } + + EncodeType Type() const { return impl_->Type(); } + + const SymbolTable *InputSymbols() const { return impl_->InputSymbols(); } + + const SymbolTable *OutputSymbols() const { return impl_->OutputSymbols(); } + + void SetInputSymbols(const SymbolTable *syms) { + impl_->SetInputSymbols(syms); + } + + void SetOutputSymbols(const SymbolTable *syms) { + impl_->SetOutputSymbols(syms); + } + + const string &WeightType() const { return impl_->WeightType(); } + + template + friend void InitEncodeMapperClass(InitEncodeMapperClassArgs *args); + + // Naturally, this exists in non-const and const forms. Encoding arcs or FSTs + // mutates the underlying encoder; decoding them does not. + + template + EncodeMapper *GetEncodeMapper() { + if (Arc::Type() != ArcType()) { + return nullptr; + } else { + auto *typed_impl = static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + } + + template + const EncodeMapper *GetEncodeMapper() const { + if (Arc::Type() != ArcType()) { + return nullptr; + } else { + auto *typed_impl = static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + } + + private: + std::unique_ptr impl_; +}; + +template +void InitEncodeMapperClass(InitEncodeMapperClassArgs *args) { + std::get<2>(*args)->impl_.reset( + new EncodeMapperClassImpl(std::get<0>(*args), std::get<1>(*args))); +} + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_ENCODEMAPPER_CLASS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/epsnormalize.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/epsnormalize.h new file mode 100644 index 0000000..b55fefa --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/epsnormalize.h @@ -0,0 +1,31 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_EPSNORMALIZE_H_ +#define FST_SCRIPT_EPSNORMALIZE_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using EpsNormalizeArgs = std::tuple; + +template +void EpsNormalize(EpsNormalizeArgs *args) { + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + EpsNormalize(ifst, ofst, std::get<2>(*args)); +} + +void EpsNormalize(const FstClass &ifst, MutableFstClass *ofst, + EpsNormalizeType norm_type = EPS_NORM_INPUT); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_EPSNORMALIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/equal.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/equal.h new file mode 100644 index 0000000..79ea9aa --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/equal.h @@ -0,0 +1,32 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_EQUAL_H_ +#define FST_SCRIPT_EQUAL_H_ + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using EqualInnerArgs = std::tuple; + +using EqualArgs = WithReturnValue; + +template +void Equal(EqualArgs *args) { + const Fst &fst1 = *(std::get<0>(args->args).GetFst()); + const Fst &fst2 = *(std::get<1>(args->args).GetFst()); + args->retval = Equal(fst1, fst2, std::get<2>(args->args)); +} + +bool Equal(const FstClass &fst1, const FstClass &fst2, float delta = kDelta); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_EQUAL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/equivalent.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/equivalent.h new file mode 100644 index 0000000..7cdff45 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/equivalent.h @@ -0,0 +1,34 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_EQUIVALENT_H_ +#define FST_SCRIPT_EQUIVALENT_H_ + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using EquivalentInnerArgs = std::tuple; + +using EquivalentArgs = WithReturnValue; + +template +void Equivalent(EquivalentArgs *args) { + const Fst &fst1 = *(std::get<0>(args->args).GetFst()); + const Fst &fst2 = *(std::get<1>(args->args).GetFst()); + args->retval = Equivalent(fst1, fst2, std::get<2>(args->args)); +} + +bool Equivalent(const FstClass &fst1, const FstClass &fst2, + float delta = kDelta); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_EQUIVALENT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fst-class.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fst-class.h new file mode 100644 index 0000000..07319fc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fst-class.h @@ -0,0 +1,530 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_FST_CLASS_H_ +#define FST_SCRIPT_FST_CLASS_H_ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// Classes to support "boxing" all existing types of FST arcs in a single +// FstClass which hides the arc types. This allows clients to load +// and work with FSTs without knowing the arc type. These classes are only +// recommended for use in high-level scripting applications. Most users should +// use the lower-level templated versions corresponding to these classes. + +namespace fst { +namespace script { + +// Abstract base class defining the set of functionalities implemented in all +// impls and passed through by all bases. Below FstClassBase the class +// hierarchy bifurcates; FstClassImplBase serves as the base class for all +// implementations (of which FstClassImpl is currently the only one) and +// FstClass serves as the base class for all interfaces. + +class FstClassBase { + public: + virtual const string &ArcType() const = 0; + virtual WeightClass Final(int64) const = 0; + virtual const string &FstType() const = 0; + virtual const SymbolTable *InputSymbols() const = 0; + virtual size_t NumArcs(int64) const = 0; + virtual size_t NumInputEpsilons(int64) const = 0; + virtual size_t NumOutputEpsilons(int64) const = 0; + virtual const SymbolTable *OutputSymbols() const = 0; + virtual uint64 Properties(uint64, bool) const = 0; + virtual int64 Start() const = 0; + virtual const string &WeightType() const = 0; + virtual bool ValidStateId(int64) const = 0; + virtual bool Write(const string &) const = 0; + virtual bool Write(std::ostream &, const string &) const = 0; + virtual ~FstClassBase() {} +}; + +// Adds all the MutableFst methods. +class FstClassImplBase : public FstClassBase { + public: + virtual bool AddArc(int64, const ArcClass &) = 0; + virtual int64 AddState() = 0; + virtual FstClassImplBase *Copy() = 0; + virtual bool DeleteArcs(int64, size_t) = 0; + virtual bool DeleteArcs(int64) = 0; + virtual bool DeleteStates(const std::vector &) = 0; + virtual void DeleteStates() = 0; + virtual SymbolTable *MutableInputSymbols() = 0; + virtual SymbolTable *MutableOutputSymbols() = 0; + virtual int64 NumStates() const = 0; + virtual bool ReserveArcs(int64, size_t) = 0; + virtual void ReserveStates(int64) = 0; + virtual void SetInputSymbols(SymbolTable *) = 0; + virtual bool SetFinal(int64, const WeightClass &) = 0; + virtual void SetOutputSymbols(SymbolTable *) = 0; + virtual void SetProperties(uint64, uint64) = 0; + virtual bool SetStart(int64) = 0; + ~FstClassImplBase() override {} +}; + +// Containiner class wrapping an Fst, hiding its arc type. Whether this +// Fst pointer refers to a special kind of FST (e.g. a MutableFst) is +// known by the type of interface class that owns the pointer to this +// container. + +template +class FstClassImpl : public FstClassImplBase { + public: + explicit FstClassImpl(Fst *impl, bool should_own = false) + : impl_(should_own ? impl : impl->Copy()) {} + + explicit FstClassImpl(const Fst &impl) : impl_(impl.Copy()) {} + + // Warning: calling this method casts the FST to a mutable FST. + bool AddArc(int64 s, const ArcClass &ac) final { + if (!ValidStateId(s)) return false; + // Note that we do not check that the destination state is valid, so users + // can add arcs before they add the corresponding states. Verify can be + // used to determine whether any arc has a nonexisting destination. + Arc arc(ac.ilabel, ac.olabel, *ac.weight.GetWeight(), + ac.nextstate); + static_cast *>(impl_.get())->AddArc(s, arc); + return true; + } + + // Warning: calling this method casts the FST to a mutable FST. + int64 AddState() final { + return static_cast *>(impl_.get())->AddState(); + } + + const string &ArcType() const final { return Arc::Type(); } + + FstClassImpl *Copy() final { return new FstClassImpl(impl_.get()); } + + // Warning: calling this method casts the FST to a mutable FST. + bool DeleteArcs(int64 s, size_t n) final { + if (!ValidStateId(s)) return false; + static_cast *>(impl_.get())->DeleteArcs(s, n); + return true; + } + + // Warning: calling this method casts the FST to a mutable FST. + bool DeleteArcs(int64 s) final { + if (!ValidStateId(s)) return false; + static_cast *>(impl_.get())->DeleteArcs(s); + return true; + } + + // Warning: calling this method casts the FST to a mutable FST. + bool DeleteStates(const std::vector &dstates) final { + for (const auto &state : dstates) + if (!ValidStateId(state)) return false; + // Warning: calling this method with any integers beyond the precision of + // the underlying FST will result in truncation. + std::vector typed_dstates(dstates.size()); + std::copy(dstates.begin(), dstates.end(), typed_dstates.begin()); + static_cast *>(impl_.get())->DeleteStates(typed_dstates); + return true; + } + + // Warning: calling this method casts the FST to a mutable FST. + void DeleteStates() final { + static_cast *>(impl_.get())->DeleteStates(); + } + + WeightClass Final(int64 s) const final { + if (!ValidStateId(s)) return WeightClass::NoWeight(WeightType()); + WeightClass w(impl_->Final(s)); + return w; + } + + const string &FstType() const final { return impl_->Type(); } + + const SymbolTable *InputSymbols() const final { + return impl_->InputSymbols(); + } + + // Warning: calling this method casts the FST to a mutable FST. + SymbolTable *MutableInputSymbols() final { + return static_cast *>(impl_.get())->MutableInputSymbols(); + } + + // Warning: calling this method casts the FST to a mutable FST. + SymbolTable *MutableOutputSymbols() final { + return static_cast *>(impl_.get())->MutableOutputSymbols(); + } + + // Signals failure by returning size_t max. + size_t NumArcs(int64 s) const final { + return ValidStateId(s) ? impl_->NumArcs(s) + : std::numeric_limits::max(); + } + + // Signals failure by returning size_t max. + size_t NumInputEpsilons(int64 s) const final { + return ValidStateId(s) ? impl_->NumInputEpsilons(s) + : std::numeric_limits::max(); + } + + // Signals failure by returning size_t max. + size_t NumOutputEpsilons(int64 s) const final { + return ValidStateId(s) ? impl_->NumOutputEpsilons(s) + : std::numeric_limits::max(); + } + + // Warning: calling this method casts the FST to a mutable FST. + int64 NumStates() const final { + return static_cast *>(impl_.get())->NumStates(); + } + + uint64 Properties(uint64 mask, bool test) const final { + return impl_->Properties(mask, test); + } + + // Warning: calling this method casts the FST to a mutable FST. + bool ReserveArcs(int64 s, size_t n) final { + if (!ValidStateId(s)) return false; + static_cast *>(impl_.get())->ReserveArcs(s, n); + return true; + } + + // Warning: calling this method casts the FST to a mutable FST. + void ReserveStates(int64 s) final { + static_cast *>(impl_.get())->ReserveStates(s); + } + + const SymbolTable *OutputSymbols() const final { + return impl_->OutputSymbols(); + } + + // Warning: calling this method casts the FST to a mutable FST. + void SetInputSymbols(SymbolTable *isyms) final { + static_cast *>(impl_.get())->SetInputSymbols(isyms); + } + + // Warning: calling this method casts the FST to a mutable FST. + bool SetFinal(int64 s, const WeightClass &weight) final { + if (!ValidStateId(s)) return false; + static_cast *>(impl_.get()) + ->SetFinal(s, *weight.GetWeight()); + return true; + } + + // Warning: calling this method casts the FST to a mutable FST. + void SetOutputSymbols(SymbolTable *osyms) final { + static_cast *>(impl_.get())->SetOutputSymbols(osyms); + } + + // Warning: calling this method casts the FST to a mutable FST. + void SetProperties(uint64 props, uint64 mask) final { + static_cast *>(impl_.get())->SetProperties(props, mask); + } + + // Warning: calling this method casts the FST to a mutable FST. + bool SetStart(int64 s) final { + if (!ValidStateId(s)) return false; + static_cast *>(impl_.get())->SetStart(s); + return true; + } + + int64 Start() const final { return impl_->Start(); } + + bool ValidStateId(int64 s) const final { + // This cowardly refuses to count states if the FST is not yet expanded. + if (!Properties(kExpanded, true)) { + FSTERROR() << "Cannot get number of states for unexpanded FST"; + return false; + } + // If the FST is already expanded, CountStates calls NumStates. + if (s < 0 || s >= CountStates(*impl_)) { + FSTERROR() << "State ID " << s << " not valid"; + return false; + } + return true; + } + + const string &WeightType() const final { return Arc::Weight::Type(); } + + bool Write(const string &fname) const final { return impl_->Write(fname); } + + bool Write(std::ostream &ostr, const string &fname) const final { + const FstWriteOptions opts(fname); + return impl_->Write(ostr, opts); + } + + ~FstClassImpl() override {} + + Fst *GetImpl() const { return impl_.get(); } + + private: + std::unique_ptr> impl_; +}; + +// BASE CLASS DEFINITIONS + +class MutableFstClass; + +class FstClass : public FstClassBase { + public: + FstClass() : impl_(nullptr) {} + + template + explicit FstClass(const Fst &fst) : impl_(new FstClassImpl(fst)) {} + + FstClass(const FstClass &other) + : impl_(other.impl_ == nullptr ? nullptr : other.impl_->Copy()) {} + + FstClass &operator=(const FstClass &other) { + impl_.reset(other.impl_ == nullptr ? nullptr : other.impl_->Copy()); + return *this; + } + + WeightClass Final(int64 s) const final { return impl_->Final(s); } + + const string &ArcType() const final { return impl_->ArcType(); } + + const string &FstType() const final { return impl_->FstType(); } + + const SymbolTable *InputSymbols() const final { + return impl_->InputSymbols(); + } + + size_t NumArcs(int64 s) const final { return impl_->NumArcs(s); } + + size_t NumInputEpsilons(int64 s) const final { + return impl_->NumInputEpsilons(s); + } + + size_t NumOutputEpsilons(int64 s) const final { + return impl_->NumOutputEpsilons(s); + } + + const SymbolTable *OutputSymbols() const final { + return impl_->OutputSymbols(); + } + + uint64 Properties(uint64 mask, bool test) const final { + // Special handling for FSTs with a null impl. + if (!impl_) return kError & mask; + return impl_->Properties(mask, test); + } + + static FstClass *Read(const string &fname); + + static FstClass *Read(std::istream &istrm, const string &source); + + int64 Start() const final { return impl_->Start(); } + + bool ValidStateId(int64 s) const final { return impl_->ValidStateId(s); } + + const string &WeightType() const final { return impl_->WeightType(); } + + // Helper that logs an ERROR if the weight type of an FST and a WeightClass + // don't match. + + bool WeightTypesMatch(const WeightClass &weight, const string &op_name) const; + + bool Write(const string &fname) const final { return impl_->Write(fname); } + + bool Write(std::ostream &ostr, const string &fname) const final { + return impl_->Write(ostr, fname); + } + + ~FstClass() override {} + + // These methods are required by IO registration. + + template + static FstClassImplBase *Convert(const FstClass &other) { + FSTERROR() << "Doesn't make sense to convert any class to type FstClass"; + return nullptr; + } + + template + static FstClassImplBase *Create() { + FSTERROR() << "Doesn't make sense to create an FstClass with a " + << "particular arc type"; + return nullptr; + } + + template + const Fst *GetFst() const { + if (Arc::Type() != ArcType()) { + return nullptr; + } else { + FstClassImpl *typed_impl = + static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + } + + template + static FstClass *Read(std::istream &stream, const FstReadOptions &opts) { + if (!opts.header) { + LOG(ERROR) << "FstClass::Read: Options header not specified"; + return nullptr; + } + const FstHeader &hdr = *opts.header; + if (hdr.Properties() & kMutable) { + return ReadTypedFst>(stream, opts); + } else { + return ReadTypedFst>(stream, opts); + } + } + + protected: + explicit FstClass(FstClassImplBase *impl) : impl_(impl) {} + + const FstClassImplBase *GetImpl() const { return impl_.get(); } + + FstClassImplBase *GetImpl() { return impl_.get(); } + + // Generic template method for reading an arc-templated FST of type + // UnderlyingT, and returning it wrapped as FstClassT, with appropriat + // error checking. Called from arc-templated Read() static methods. + template + static FstClassT *ReadTypedFst(std::istream &stream, + const FstReadOptions &opts) { + std::unique_ptr u(UnderlyingT::Read(stream, opts)); + return u ? new FstClassT(*u) : nullptr; + } + + private: + std::unique_ptr impl_; +}; + +// Specific types of FstClass with special properties + +class MutableFstClass : public FstClass { + public: + bool AddArc(int64 s, const ArcClass &ac) { + if (!WeightTypesMatch(ac.weight, "AddArc")) return false; + return GetImpl()->AddArc(s, ac); + } + + int64 AddState() { return GetImpl()->AddState(); } + + bool DeleteArcs(int64 s, size_t n) { return GetImpl()->DeleteArcs(s, n); } + + bool DeleteArcs(int64 s) { return GetImpl()->DeleteArcs(s); } + + bool DeleteStates(const std::vector &dstates) { + return GetImpl()->DeleteStates(dstates); + } + + void DeleteStates() { GetImpl()->DeleteStates(); } + + SymbolTable *MutableInputSymbols() { + return GetImpl()->MutableInputSymbols(); + } + + SymbolTable *MutableOutputSymbols() { + return GetImpl()->MutableOutputSymbols(); + } + + int64 NumStates() const { return GetImpl()->NumStates(); } + + bool ReserveArcs(int64 s, size_t n) { return GetImpl()->ReserveArcs(s, n); } + + void ReserveStates(int64 s) { GetImpl()->ReserveStates(s); } + + static MutableFstClass *Read(const string &fname, bool convert = false); + + void SetInputSymbols(SymbolTable *isyms) { + GetImpl()->SetInputSymbols(isyms); + } + + bool SetFinal(int64 s, const WeightClass &weight) { + if (!WeightTypesMatch(weight, "SetFinal")) return false; + return GetImpl()->SetFinal(s, weight); + } + + void SetOutputSymbols(SymbolTable *osyms) { + GetImpl()->SetOutputSymbols(osyms); + } + + void SetProperties(uint64 props, uint64 mask) { + GetImpl()->SetProperties(props, mask); + } + + bool SetStart(int64 s) { return GetImpl()->SetStart(s); } + + template + explicit MutableFstClass(const MutableFst &fst) : FstClass(fst) {} + + // These methods are required by IO registration. + + template + static FstClassImplBase *Convert(const FstClass &other) { + FSTERROR() << "Doesn't make sense to convert any class to type " + << "MutableFstClass"; + return nullptr; + } + + template + static FstClassImplBase *Create() { + FSTERROR() << "Doesn't make sense to create a MutableFstClass with a " + << "particular arc type"; + return nullptr; + } + + template + MutableFst *GetMutableFst() { + Fst *fst = const_cast *>(this->GetFst()); + MutableFst *mfst = static_cast *>(fst); + return mfst; + } + + template + static MutableFstClass *Read(std::istream &stream, + const FstReadOptions &opts) { + std::unique_ptr> mfst(MutableFst::Read(stream, opts)); + return mfst ? new MutableFstClass(*mfst) : nullptr; + } + + protected: + explicit MutableFstClass(FstClassImplBase *impl) : FstClass(impl) {} +}; + +class VectorFstClass : public MutableFstClass { + public: + explicit VectorFstClass(FstClassImplBase *impl) : MutableFstClass(impl) {} + + explicit VectorFstClass(const FstClass &other); + + explicit VectorFstClass(const string &arc_type); + + static VectorFstClass *Read(const string &fname); + + template + static VectorFstClass *Read(std::istream &stream, + const FstReadOptions &opts) { + std::unique_ptr> mfst(VectorFst::Read(stream, opts)); + return mfst ? new VectorFstClass(*mfst) : nullptr; + } + + template + explicit VectorFstClass(const VectorFst &fst) : MutableFstClass(fst) {} + + template + static FstClassImplBase *Convert(const FstClass &other) { + return new FstClassImpl(new VectorFst(*other.GetFst()), + true); + } + + template + static FstClassImplBase *Create() { + return new FstClassImpl(new VectorFst(), true); + } +}; + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_FST_CLASS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fstscript-decl.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fstscript-decl.h new file mode 100644 index 0000000..294d015 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fstscript-decl.h @@ -0,0 +1,32 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Forward declarations for the FST and FST script classes. + +#ifndef FST_SCRIPT_FSTSCRIPT_DECL_H_ +#define FST_SCRIPT_FSTSCRIPT_DECL_H_ + +#include + +namespace fst { +namespace script { + +class ArcClass; + +class ArcIteratorClass; +class MutableArcIteratorClass; + +class EncodeMapperClass; + +class FstClass; +class MutableFstClass; +class VectorFstClass; + +class StateIteratorClass; + +class WeightClass; + +} // namespace script +} // namespace fst; + +#endif // FST_SCRIPT_FSTSCRIPT_DECL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fstscript.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fstscript.h new file mode 100644 index 0000000..45f1617 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/fstscript.h @@ -0,0 +1,155 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// The FST script interface permits users to interact with FSTs without knowing +// their arc type. It does this by mapping compile-time polymorphism (in the +// form of a arc-templated FST types) onto a shared virtual interface. It also +// supports arc extension via a DSO interface. Due to the overhead of virtual +// dispatch and registered function lookups, the script API is somewhat slower +// then library API provided by types like StdVectorFst, but has the advantage +// that it is designed not to crash (and to provide useful debugging +// information) upon common user errors like passing invalid indices or +// attempting comparison of incompatible FSTs. It is used both by the FST +// binaries and the Python extension. +// +// This header includes all of the FST script functionality. + +#ifndef FST_SCRIPT_FSTSCRIPT_H_ +#define FST_SCRIPT_FSTSCRIPT_H_ + +// Major classes +#include +#include +#include +#include +#include +#include + +// Flag-to-enum parsers. +#include +// Templates like Operation<> and Apply<>. +#include + +// Operations. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// This class is necessary because registering each of the operations +// separately overfills the stack, as there's so many of them. +namespace fst { +namespace script { + +template +class AllFstOperationsRegisterer { + public: + AllFstOperationsRegisterer() { + RegisterBatch1(); + RegisterBatch2(); + } + + private: + void RegisterBatch1() { + REGISTER_FST_OPERATION(ArcSort, Arc, ArcSortArgs); + REGISTER_FST_OPERATION(Closure, Arc, ClosureArgs); + REGISTER_FST_OPERATION(CompileFstInternal, Arc, CompileFstArgs); + REGISTER_FST_OPERATION(Compose, Arc, ComposeArgs); + REGISTER_FST_OPERATION(Concat, Arc, ConcatArgs1); + REGISTER_FST_OPERATION(Concat, Arc, ConcatArgs2); + REGISTER_FST_OPERATION(Connect, Arc, MutableFstClass); + REGISTER_FST_OPERATION(Convert, Arc, ConvertArgs); + REGISTER_FST_OPERATION(Decode, Arc, DecodeArgs1); + REGISTER_FST_OPERATION(Decode, Arc, DecodeArgs2); + REGISTER_FST_OPERATION(Determinize, Arc, DeterminizeArgs); + REGISTER_FST_OPERATION(Difference, Arc, DifferenceArgs); + REGISTER_FST_OPERATION(Disambiguate, Arc, DisambiguateArgs); + REGISTER_FST_OPERATION(DrawFst, Arc, FstDrawerArgs); + REGISTER_FST_OPERATION(Encode, Arc, EncodeArgs1); + REGISTER_FST_OPERATION(Encode, Arc, EncodeArgs2); + REGISTER_FST_OPERATION(EpsNormalize, Arc, EpsNormalizeArgs); + REGISTER_FST_OPERATION(Equal, Arc, EqualArgs); + REGISTER_FST_OPERATION(Equivalent, Arc, EquivalentArgs); + REGISTER_FST_OPERATION(PrintFstInfo, Arc, InfoArgs); + REGISTER_FST_OPERATION(GetFstInfo, Arc, GetInfoArgs); + REGISTER_FST_OPERATION(InitArcIteratorClass, Arc, + InitArcIteratorClassArgs); + REGISTER_FST_OPERATION(InitEncodeMapperClass, Arc, + InitEncodeMapperClassArgs); + REGISTER_FST_OPERATION(InitMutableArcIteratorClass, Arc, + InitMutableArcIteratorClassArgs); + REGISTER_FST_OPERATION(InitStateIteratorClass, Arc, + InitStateIteratorClassArgs); + } + + void RegisterBatch2() { + REGISTER_FST_OPERATION(Intersect, Arc, IntersectArgs); + REGISTER_FST_OPERATION(Invert, Arc, MutableFstClass); + REGISTER_FST_OPERATION(Map, Arc, MapArgs); + REGISTER_FST_OPERATION(Minimize, Arc, MinimizeArgs); + REGISTER_FST_OPERATION(PrintFst, Arc, FstPrinterArgs); + REGISTER_FST_OPERATION(Project, Arc, ProjectArgs); + REGISTER_FST_OPERATION(Prune, Arc, PruneArgs1); + REGISTER_FST_OPERATION(Prune, Arc, PruneArgs2); + REGISTER_FST_OPERATION(Push, Arc, PushArgs1); + REGISTER_FST_OPERATION(Push, Arc, PushArgs2); + REGISTER_FST_OPERATION(RandEquivalent, Arc, RandEquivalentArgs); + REGISTER_FST_OPERATION(RandGen, Arc, RandGenArgs); + REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs1); + REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs2); + REGISTER_FST_OPERATION(Replace, Arc, ReplaceArgs); + REGISTER_FST_OPERATION(Reverse, Arc, ReverseArgs); + REGISTER_FST_OPERATION(Reweight, Arc, ReweightArgs); + REGISTER_FST_OPERATION(RmEpsilon, Arc, RmEpsilonArgs); + REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs1); + REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs2); + REGISTER_FST_OPERATION(ShortestPath, Arc, ShortestPathArgs); + REGISTER_FST_OPERATION(Synchronize, Arc, SynchronizeArgs); + REGISTER_FST_OPERATION(TopSort, Arc, TopSortArgs); + REGISTER_FST_OPERATION(Union, Arc, UnionArgs); + REGISTER_FST_OPERATION(Verify, Arc, VerifyArgs); + } +}; + +} // namespace script +} // namespace fst + +#define REGISTER_FST_OPERATIONS(Arc) \ + AllFstOperationsRegisterer register_all_fst_operations##Arc; + +#endif // FST_SCRIPT_FSTSCRIPT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/getters.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/getters.h new file mode 100644 index 0000000..5cd727e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/getters.h @@ -0,0 +1,76 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Getters for converting command-line arguments into the appropriate enums +// or bitmasks, with the simplest ones defined as inline. + +#ifndef FST_SCRIPT_GETTERS_H_ +#define FST_SCRIPT_GETTERS_H_ + +#include + +#include // For ComposeFilter. +#include // For DeterminizeType. +#include // For kEncodeLabels (etc.). +#include // For EpsNormalizeType. +#include // For ProjectType. +#include // For kPushWeights (etc.). +#include // For QueueType. +#include // For ClosureType. +#include // For ArcSortType. +#include // For MapType. +#include // For RandArcSelection. + +#include + +namespace fst { +namespace script { + +bool GetArcSortType(const string &str, ArcSortType *sort_type); + +inline ClosureType GetClosureType(bool closure_plus) { + return closure_plus ? CLOSURE_PLUS : CLOSURE_STAR; +} + +bool GetComposeFilter(const string &str, ComposeFilter *compose_filter); + +bool GetDeterminizeType(const string &str, DeterminizeType *det_type); + +inline uint32 GetEncodeFlags(bool encode_labels, bool encode_weights) { + return (encode_labels ? kEncodeLabels : 0) | + (encode_weights ? kEncodeWeights : 0); +} + +inline EpsNormalizeType GetEpsNormalizeType(bool eps_norm_output) { + return eps_norm_output ? EPS_NORM_OUTPUT : EPS_NORM_INPUT; +} + +bool GetMapType(const string &str, MapType *map_type); + +inline ProjectType GetProjectType(bool project_output) { + return project_output ? PROJECT_OUTPUT : PROJECT_INPUT; +} + +inline uint32 GetPushFlags(bool push_weights, bool push_labels, + bool remove_total_weight, bool remove_common_affix) { + return ((push_weights ? kPushWeights : 0) | + (push_labels ? kPushLabels : 0) | + (remove_total_weight ? kPushRemoveTotalWeight : 0) | + (remove_common_affix ? kPushRemoveCommonAffix : 0)); +} + +bool GetQueueType(const string &str, QueueType *queue_type); + +bool GetRandArcSelection(const string &str, RandArcSelection *ras); + +bool GetReplaceLabelType(const string &str, bool epsilon_on_replace, + ReplaceLabelType *rlt); + +inline ReweightType GetReweightType(bool to_final) { + return to_final ? REWEIGHT_TO_FINAL : REWEIGHT_TO_INITIAL; +} + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_GETTERS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/info-impl.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/info-impl.h new file mode 100644 index 0000000..e895649 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/info-impl.h @@ -0,0 +1,314 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to compute various information about FSTs, a helper class for +// fstinfo.cc. + +#ifndef FST_SCRIPT_INFO_IMPL_H_ +#define FST_SCRIPT_INFO_IMPL_H_ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fst { + +// Compute various information about FSTs, helper class for fstinfo.cc. +// WARNING: Stand-alone use of this class is not recommended, most code +// should call directly the relevant library functions: Fst::NumStates, +// Fst::NumArcs, TestProperties, etc. +class FstInfo { + public: + FstInfo() {} + + // When info_type is "short" (or "auto" and not an ExpandedFst) then only + // minimal info is computed and can be requested. + template + FstInfo(const Fst &fst, bool test_properties, + const string &arc_filter_type = "any", + const string &info_type = "auto", bool verify = true) + : fst_type_(fst.Type()), + input_symbols_(fst.InputSymbols() ? fst.InputSymbols()->Name() + : "none"), + output_symbols_(fst.OutputSymbols() ? fst.OutputSymbols()->Name() + : "none"), + nstates_(0), + narcs_(0), + start_(kNoStateId), + nfinal_(0), + nepsilons_(0), + niepsilons_(0), + noepsilons_(0), + ilabel_mult_(0.0), + olabel_mult_(0.0), + naccess_(0), + ncoaccess_(0), + nconnect_(0), + ncc_(0), + nscc_(0), + input_match_type_(MATCH_NONE), + output_match_type_(MATCH_NONE), + input_lookahead_(false), + output_lookahead_(false), + properties_(0), + arc_filter_type_(arc_filter_type), + long_info_(true), + arc_type_(Arc::Type()) { + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + if (info_type == "long") { + long_info_ = true; + } else if (info_type == "short") { + long_info_ = false; + } else if (info_type == "auto") { + long_info_ = fst.Properties(kExpanded, false); + } else { + FSTERROR() << "Bad info type: " << info_type; + return; + } + if (!long_info_) return; + // If the FST is not sane, we return. + if (verify && !Verify(fst)) { + FSTERROR() << "FstInfo: Verify: FST not well-formed"; + return; + } + start_ = fst.Start(); + properties_ = fst.Properties(kFstProperties, test_properties); + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + ++nstates_; + const auto s = siter.Value(); + if (fst.Final(s) != Weight::Zero()) ++nfinal_; + std::map ilabel_count; + std::map olabel_count; + for (ArcIterator> aiter(fst, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + ++narcs_; + if (arc.ilabel == 0 && arc.olabel == 0) ++nepsilons_; + if (arc.ilabel == 0) ++niepsilons_; + if (arc.olabel == 0) ++noepsilons_; + ++ilabel_count[arc.ilabel]; + ++olabel_count[arc.olabel]; + } + for (auto it = ilabel_count.begin(); it != ilabel_count.end(); ++it) { + ilabel_mult_ += it->second * it->second; + } + for (auto it = olabel_count.begin(); it != olabel_count.end(); ++it) { + olabel_mult_ += it->second * it->second; + } + } + if (narcs_ > 0) { + ilabel_mult_ /= narcs_; + olabel_mult_ /= narcs_; + } + { + std::vector cc; + CcVisitor cc_visitor(&cc); + FifoQueue fifo_queue; + if (arc_filter_type == "any") { + Visit(fst, &cc_visitor, &fifo_queue); + } else if (arc_filter_type == "epsilon") { + Visit(fst, &cc_visitor, &fifo_queue, EpsilonArcFilter()); + } else if (arc_filter_type == "iepsilon") { + Visit(fst, &cc_visitor, &fifo_queue, InputEpsilonArcFilter()); + } else if (arc_filter_type == "oepsilon") { + Visit(fst, &cc_visitor, &fifo_queue, OutputEpsilonArcFilter()); + } else { + FSTERROR() << "Bad arc filter type: " << arc_filter_type; + return; + } + for (StateId s = 0; s < cc.size(); ++s) { + if (cc[s] >= ncc_) ncc_ = cc[s] + 1; + } + } + { + std::vector scc; + std::vector access, coaccess; + uint64 props = 0; + SccVisitor scc_visitor(&scc, &access, &coaccess, &props); + if (arc_filter_type == "any") { + DfsVisit(fst, &scc_visitor); + } else if (arc_filter_type == "epsilon") { + DfsVisit(fst, &scc_visitor, EpsilonArcFilter()); + } else if (arc_filter_type == "iepsilon") { + DfsVisit(fst, &scc_visitor, InputEpsilonArcFilter()); + } else if (arc_filter_type == "oepsilon") { + DfsVisit(fst, &scc_visitor, OutputEpsilonArcFilter()); + } else { + FSTERROR() << "Bad arc filter type: " << arc_filter_type; + return; + } + for (StateId s = 0; s < scc.size(); ++s) { + if (access[s]) ++naccess_; + if (coaccess[s]) ++ncoaccess_; + if (access[s] && coaccess[s]) ++nconnect_; + if (scc[s] >= nscc_) nscc_ = scc[s] + 1; + } + } + LookAheadMatcher> imatcher(fst, MATCH_INPUT); + input_match_type_ = imatcher.Type(test_properties); + input_lookahead_ = imatcher.Flags() & kInputLookAheadMatcher; + LookAheadMatcher> omatcher(fst, MATCH_OUTPUT); + output_match_type_ = omatcher.Type(test_properties); + output_lookahead_ = omatcher.Flags() & kOutputLookAheadMatcher; + } + + // Short info. + + const string &FstType() const { return fst_type_; } + + const string &ArcType() const { return arc_type_; } + + const string &InputSymbols() const { return input_symbols_; } + + const string &OutputSymbols() const { return output_symbols_; } + + bool LongInfo() const { return long_info_; } + + const string &ArcFilterType() const { return arc_filter_type_; } + + // Long info. + + MatchType InputMatchType() const { + CheckLong(); + return input_match_type_; + } + + MatchType OutputMatchType() const { + CheckLong(); + return output_match_type_; + } + + bool InputLookAhead() const { + CheckLong(); + return input_lookahead_; + } + + bool OutputLookAhead() const { + CheckLong(); + return output_lookahead_; + } + + int64 NumStates() const { + CheckLong(); + return nstates_; + } + + size_t NumArcs() const { + CheckLong(); + return narcs_; + } + + int64 Start() const { + CheckLong(); + return start_; + } + + size_t NumFinal() const { + CheckLong(); + return nfinal_; + } + + size_t NumEpsilons() const { + CheckLong(); + return nepsilons_; + } + + size_t NumInputEpsilons() const { + CheckLong(); + return niepsilons_; + } + + size_t NumOutputEpsilons() const { + CheckLong(); + return noepsilons_; + } + + double InputLabelMultiplicity() const { + CheckLong(); + return ilabel_mult_; + } + + double OutputLabelMultiplicity() const { + CheckLong(); + return olabel_mult_; + } + + size_t NumAccessible() const { + CheckLong(); + return naccess_; + } + + size_t NumCoAccessible() const { + CheckLong(); + return ncoaccess_; + } + + size_t NumConnected() const { + CheckLong(); + return nconnect_; + } + + size_t NumCc() const { + CheckLong(); + return ncc_; + } + + size_t NumScc() const { + CheckLong(); + return nscc_; + } + + uint64 Properties() const { + CheckLong(); + return properties_; + } + + private: + void CheckLong() const { + if (!long_info_) + FSTERROR() << "FstInfo: Method only available with long info signature"; + } + + string fst_type_; + string input_symbols_; + string output_symbols_; + int64 nstates_; + size_t narcs_; + int64 start_; + size_t nfinal_; + size_t nepsilons_; + size_t niepsilons_; + size_t noepsilons_; + double ilabel_mult_; + double olabel_mult_; + size_t naccess_; + size_t ncoaccess_; + size_t nconnect_; + size_t ncc_; + size_t nscc_; + MatchType input_match_type_; + MatchType output_match_type_; + bool input_lookahead_; + bool output_lookahead_; + uint64 properties_; + string arc_filter_type_; + bool long_info_; + string arc_type_; +}; + +void PrintFstInfoImpl(const FstInfo &fstinfo, bool pipe = false); + +} // namespace fst + +#endif // FST_SCRIPT_INFO_IMPL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/info.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/info.h new file mode 100644 index 0000000..039d06d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/info.h @@ -0,0 +1,50 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_INFO_H_ +#define FST_SCRIPT_INFO_H_ + +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using InfoArgs = std::tuple; + +template +void PrintFstInfo(InfoArgs *args) { + const Fst &fst = *(std::get<0>(*args).GetFst()); + const FstInfo fstinfo(fst, std::get<1>(*args), std::get<2>(*args), + std::get<3>(*args), std::get<4>(*args)); + PrintFstInfoImpl(fstinfo, std::get<5>(*args)); + if (std::get<5>(*args)) fst.Write(""); +} + +void PrintFstInfo(const FstClass &f, bool test_properties, + const string &arc_filter, const string &info_type, bool pipe, + bool verify); + +using GetInfoArgs = std::tuple; + +template +void GetFstInfo(GetInfoArgs *args) { + const Fst &fst = *(std::get<0>(*args).GetFst()); + *(std::get<5>(*args)) = FstInfo(fst, std::get<1>(*args), std::get<2>(*args), + std::get<3>(*args), std::get<4>(*args)); +} + +void GetFstInfo(const FstClass &fst, bool test_properties, + const string &arc_filter, const string &info_type, bool verify, + FstInfo *info); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_INFO_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/intersect.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/intersect.h new file mode 100644 index 0000000..229bd56 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/intersect.h @@ -0,0 +1,35 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_INTERSECT_H_ +#define FST_SCRIPT_INTERSECT_H_ + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using IntersectArgs = std::tuple; + +template +void Intersect(IntersectArgs *args) { + const Fst &ifst1 = *(std::get<0>(*args).GetFst()); + const Fst &ifst2 = *(std::get<1>(*args).GetFst()); + MutableFst *ofst = std::get<2>(*args)->GetMutableFst(); + const auto &opts = std::get<3>(*args); + Intersect(ifst1, ifst2, ofst, opts); +} + +void Intersect(const FstClass &ifst, const FstClass &ifst2, + MutableFstClass *ofst, + const ComposeOptions &opts = ComposeOptions()); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_INTERSECT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/invert.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/invert.h new file mode 100644 index 0000000..5bc3131 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/invert.h @@ -0,0 +1,23 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_INVERT_H_ +#define FST_SCRIPT_INVERT_H_ + +#include +#include + +namespace fst { +namespace script { + +template +void Invert(MutableFstClass *fst) { + Invert(fst->GetMutableFst()); +} + +void Invert(MutableFstClass *fst); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_INVERT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/isomorphic.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/isomorphic.h new file mode 100644 index 0000000..94ea77f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/isomorphic.h @@ -0,0 +1,34 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_ISOMORPHIC_H_ +#define FST_SCRIPT_ISOMORPHIC_H_ + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using IsomorphicInnerArgs = std::tuple; + +using IsomorphicArgs = WithReturnValue; + +template +void Isomorphic(IsomorphicArgs *args) { + const Fst &fst1 = *(std::get<0>(args->args).GetFst()); + const Fst &fst2 = *(std::get<1>(args->args).GetFst()); + args->retval = Isomorphic(fst1, fst2, std::get<2>(args->args)); +} + +bool Isomorphic(const FstClass &fst1, const FstClass &fst2, + float delta = kDelta); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_ISOMORPHIC_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/map.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/map.h new file mode 100644 index 0000000..158d98a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/map.h @@ -0,0 +1,158 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_MAP_H_ +#define FST_SCRIPT_MAP_H_ + +#include +#include + +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +template +Fst *ArcMap(const Fst &fst, + const M &mapper) { + using ToArc = typename M::ToArc; + auto *ofst = new VectorFst; + ArcMap(fst, ofst, mapper); + return ofst; +} + +template +Fst *StateMap(const Fst &fst, + const M &mapper) { + using ToArc = typename M::ToArc; + auto *ofst = new VectorFst; + StateMap(fst, ofst, mapper); + return ofst; +} + +enum MapType { + ARC_SUM_MAPPER, + ARC_UNIQUE_MAPPER, + IDENTITY_MAPPER, + INPUT_EPSILON_MAPPER, + INVERT_MAPPER, + OUTPUT_EPSILON_MAPPER, + PLUS_MAPPER, + POWER_MAPPER, + QUANTIZE_MAPPER, + RMWEIGHT_MAPPER, + SUPERFINAL_MAPPER, + TIMES_MAPPER, + TO_LOG_MAPPER, + TO_LOG64_MAPPER, + TO_STD_MAPPER +}; + +using MapInnerArgs = + std::tuple; + +using MapArgs = WithReturnValue; + +template +void Map(MapArgs *args) { + using Weight = typename Arc::Weight; + const Fst &ifst = *(std::get<0>(args->args).GetFst()); + const auto map_type = std::get<1>(args->args); + switch (map_type) { + case ARC_SUM_MAPPER: { + std::unique_ptr> ofst(StateMap(ifst, ArcSumMapper(ifst))); + args->retval = new FstClass(*ofst); + return; + } + case ARC_UNIQUE_MAPPER: { + std::unique_ptr> ofst( + StateMap(ifst, ArcUniqueMapper(ifst))); + args->retval = new FstClass(*ofst); + return; + } + case IDENTITY_MAPPER: { + std::unique_ptr> ofst(ArcMap(ifst, IdentityArcMapper())); + args->retval = new FstClass(*ofst); + return; + } + case INPUT_EPSILON_MAPPER: { + std::unique_ptr> ofst(ArcMap(ifst, InputEpsilonMapper())); + args->retval = new FstClass(*ofst); + return; + } + case INVERT_MAPPER: { + std::unique_ptr> ofst(ArcMap(ifst, InvertWeightMapper())); + args->retval = new FstClass(*ofst); + return; + } + case OUTPUT_EPSILON_MAPPER: { + std::unique_ptr> ofst(ArcMap(ifst, OutputEpsilonMapper())); + args->retval = new FstClass(*ofst); + return; + } + case PLUS_MAPPER: { + const auto weight = *(std::get<4>(args->args).GetWeight()); + std::unique_ptr> ofst(ArcMap(ifst, PlusMapper(weight))); + args->retval = new FstClass(*ofst); + return; + } + case POWER_MAPPER: { + const auto power = std::get<3>(args->args); + std::unique_ptr> ofst(ArcMap(ifst, PowerMapper(power))); + args->retval = new FstClass(*ofst); + return; + } + case QUANTIZE_MAPPER: { + const auto delta = std::get<2>(args->args); + std::unique_ptr> ofst(ArcMap(ifst, QuantizeMapper(delta))); + args->retval = new FstClass(*ofst); + return; + } + case RMWEIGHT_MAPPER: { + std::unique_ptr> ofst(ArcMap(ifst, RmWeightMapper())); + args->retval = new FstClass(*ofst); + return; + } + case SUPERFINAL_MAPPER: { + std::unique_ptr> ofst(ArcMap(ifst, SuperFinalMapper())); + args->retval = new FstClass(*ofst); + return; + } + case TIMES_MAPPER: { + const auto weight = *(std::get<4>(args->args).GetWeight()); + std::unique_ptr> ofst(ArcMap(ifst, TimesMapper(weight))); + args->retval = new FstClass(*ofst); + return; + } + case TO_LOG_MAPPER: { + std::unique_ptr> ofst( + ArcMap(ifst, WeightConvertMapper())); + args->retval = new FstClass(*ofst); + return; + } + case TO_LOG64_MAPPER: { + std::unique_ptr> ofst( + ArcMap(ifst, WeightConvertMapper())); + args->retval = new FstClass(*ofst); + return; + } + case TO_STD_MAPPER: { + std::unique_ptr> ofst( + ArcMap(ifst, WeightConvertMapper())); + args->retval = new FstClass(*ofst); + return; + } + } +} + +FstClass *Map(const FstClass &ifst, MapType map_type, float delta, double power, + const WeightClass &weight); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_MAP_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/minimize.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/minimize.h new file mode 100644 index 0000000..773e8ef --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/minimize.h @@ -0,0 +1,33 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_MINIMIZE_H_ +#define FST_SCRIPT_MINIMIZE_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using MinimizeArgs = std::tuple; + +template +void Minimize(MinimizeArgs *args) { + MutableFst *ofst1 = std::get<0>(*args)->GetMutableFst(); + MutableFst *ofst2 = (std::get<1>(*args) ? + std::get<1>(*args)->GetMutableFst() : + nullptr); + Minimize(ofst1, ofst2, std::get<2>(*args), std::get<3>(*args)); +} + +void Minimize(MutableFstClass *ofst1, MutableFstClass *ofst2 = nullptr, + float delta = kShortestDelta, bool allow_nondet = false); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_MINIMIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/print-impl.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/print-impl.h new file mode 100644 index 0000000..539c6d8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/print-impl.h @@ -0,0 +1,132 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Stand-alone class to print out binary FSTs in the AT&T format, a helper +// class for fstprint.cc. + +#ifndef FST_SCRIPT_PRINT_IMPL_H_ +#define FST_SCRIPT_PRINT_IMPL_H_ + +#include +#include +#include + +#include +#include + +DECLARE_string(fst_field_separator); + +namespace fst { + +// Print a binary FST in textual format (helper class for fstprint.cc). +// WARNING: Stand-alone use of this class not recommended, most code should +// read/write using the binary format which is much more efficient. +template +class FstPrinter { + public: + using StateId = typename Arc::StateId; + using Label = typename Arc::Label; + using Weight = typename Arc::Weight; + + FstPrinter(const Fst &fst, const SymbolTable *isyms, + const SymbolTable *osyms, const SymbolTable *ssyms, bool accep, + bool show_weight_one, const string &field_separator, + const string &missing_symbol = "") + : fst_(fst), + isyms_(isyms), + osyms_(osyms), + ssyms_(ssyms), + accep_(accep && fst.Properties(kAcceptor, true)), + ostrm_(nullptr), + show_weight_one_(show_weight_one), + sep_(field_separator), + missing_symbol_(missing_symbol) {} + + // Prints FST to an output stream. + void Print(std::ostream *ostrm, const string &dest) { + ostrm_ = ostrm; + dest_ = dest; + const auto start = fst_.Start(); + if (start == kNoStateId) return; + // Initial state first. + PrintState(start); + for (StateIterator> siter(fst_); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + if (s != start) PrintState(s); + } + } + + private: + void PrintId(StateId id, const SymbolTable *syms, const char *name) const { + if (syms) { + string symbol = syms->Find(id); + if (symbol.empty()) { + if (missing_symbol_.empty()) { + FSTERROR() << "FstPrinter: Integer " << id + << " is not mapped to any textual symbol" + << ", symbol table = " << syms->Name() + << ", destination = " << dest_; + symbol = "?"; + } else { + symbol = missing_symbol_; + } + } + *ostrm_ << symbol; + } else { + *ostrm_ << id; + } + } + + void PrintStateId(StateId s) const { PrintId(s, ssyms_, "state ID"); } + + void PrintILabel(Label l) const { PrintId(l, isyms_, "arc input label"); } + + void PrintOLabel(Label l) const { PrintId(l, osyms_, "arc output label"); } + + void PrintState(StateId s) const { + bool output = false; + for (ArcIterator> aiter(fst_, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + PrintStateId(s); + *ostrm_ << sep_; + PrintStateId(arc.nextstate); + *ostrm_ << sep_; + PrintILabel(arc.ilabel); + if (!accep_) { + *ostrm_ << sep_; + PrintOLabel(arc.olabel); + } + if (show_weight_one_ || arc.weight != Weight::One()) + *ostrm_ << sep_ << arc.weight; + *ostrm_ << "\n"; + output = true; + } + const auto weight = fst_.Final(s); + if (weight != Weight::Zero() || !output) { + PrintStateId(s); + if (show_weight_one_ || weight != Weight::One()) { + *ostrm_ << sep_ << weight; + } + *ostrm_ << "\n"; + } + } + + const Fst &fst_; + const SymbolTable *isyms_; // ilabel symbol table. + const SymbolTable *osyms_; // olabel symbol table. + const SymbolTable *ssyms_; // slabel symbol table. + bool accep_; // Print as acceptor when possible? + std::ostream *ostrm_; // Text FST destination. + string dest_; // Text FST destination name. + bool show_weight_one_; // Print weights equal to Weight::One()? + string sep_; // Separator character between fields. + string missing_symbol_; // Symbol to print when lookup fails (default + // "" means raise error). + // + FstPrinter(const FstPrinter &) = delete; + FstPrinter &operator=(const FstPrinter &) = delete; +}; + +} // namespace fst + +#endif // FST_SCRIPT_PRINT_IMPL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/print.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/print.h new file mode 100644 index 0000000..687606b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/print.h @@ -0,0 +1,79 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_PRINT_H_ +#define FST_SCRIPT_PRINT_H_ + +#include + +#include +#include +#include + +DECLARE_string(fst_field_separator); + +namespace fst { +namespace script { + +// Note: it is safe to pass these strings as references because +// this struct is only used to pass them deeper in the call graph. +// Be sure you understand why this is so before using this struct +// for anything else! +struct FstPrinterArgs { + const FstClass &fst; + const SymbolTable *isyms; + const SymbolTable *osyms; + const SymbolTable *ssyms; + const bool accept; + const bool show_weight_one; + std::ostream *ostrm; + const string &dest; + const string &sep; // NOLINT + const string &missing_symbol; + + FstPrinterArgs(const FstClass &fst, const SymbolTable *isyms, + const SymbolTable *osyms, const SymbolTable *ssyms, + bool accept, bool show_weight_one, std::ostream *ostrm, + const string &dest, const string &sep, + const string &missing_sym = "") + : fst(fst), + isyms(isyms), + osyms(osyms), + ssyms(ssyms), + accept(accept), + show_weight_one(show_weight_one), + ostrm(ostrm), + dest(dest), + sep(sep), + missing_symbol(missing_sym) {} +}; + +template +void PrintFst(FstPrinterArgs *args) { + const Fst &fst = *(args->fst.GetFst()); + FstPrinter fstprinter(fst, args->isyms, args->osyms, args->ssyms, + args->accept, args->show_weight_one, args->sep, + args->missing_symbol); + fstprinter.Print(args->ostrm, args->dest); +} + +void PrintFst(const FstClass &fst, std::ostream &ostrm, const string &dest, + const SymbolTable *isyms, const SymbolTable *osyms, + const SymbolTable *ssyms, bool accept, bool show_weight_one, + const string &missing_sym = ""); + +// The same, but with more sensible defaults. +template +void PrintFst(const Fst &fst, std::ostream &ostrm, const string &dest = "", + const SymbolTable *isyms = nullptr, + const SymbolTable *osyms = nullptr, + const SymbolTable *ssyms = nullptr) { + const string sep = FLAGS_fst_field_separator.substr(0, 1); + FstPrinter fstprinter(fst, isyms, osyms, ssyms, true, true, sep); + fstprinter.Print(&ostrm, dest); +} + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_PRINT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/project.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/project.h new file mode 100644 index 0000000..13edeb1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/project.h @@ -0,0 +1,28 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_PROJECT_H_ +#define FST_SCRIPT_PROJECT_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using ProjectArgs = std::pair; + +template +void Project(ProjectArgs *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + Project(fst, std::get<1>(*args)); +} + +void Project(MutableFstClass *fst, ProjectType project_type); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_PROJECT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/prune.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/prune.h new file mode 100644 index 0000000..ed10b54 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/prune.h @@ -0,0 +1,51 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_PRUNE_H_ +#define FST_SCRIPT_PRUNE_H_ + +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using PruneArgs1 = std::tuple; + +template +void Prune(PruneArgs1 *args) { + using Weight = typename Arc::Weight; + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + const auto weight_threshold = *(std::get<2>(*args).GetWeight()); + Prune(ifst, ofst, weight_threshold, std::get<3>(*args), std::get<4>(*args)); +} + +using PruneArgs2 = std::tuple; + +template +void Prune(PruneArgs2 *args) { + using Weight = typename Arc::Weight; + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + const auto weight_threshold = *(std::get<1>(*args).GetWeight()); + Prune(fst, weight_threshold, std::get<2>(*args), std::get<3>(*args)); +} + +void Prune(const FstClass &ifst, MutableFstClass *ofst, + const WeightClass &weight_threshold, + int64 state_threshold = kNoStateId, + float delta = kDelta); + +void Prune(MutableFstClass *fst, const WeightClass &weight_threshold, + int64 state_threshold = kNoStateId, float delta = kDelta); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_PRUNE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/push.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/push.h new file mode 100644 index 0000000..018cd8f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/push.h @@ -0,0 +1,53 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_PUSH_H_ +#define FST_SCRIPT_PUSH_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using PushArgs1 = std::tuple; + +template +void Push(PushArgs1 *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + Push(fst, std::get<1>(*args), std::get<2>(*args), std::get<3>(*args)); +} + +using PushArgs2 = std::tuple; + +template +void Push(PushArgs2 *args) { + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + switch (std::get<3>(*args)) { + case REWEIGHT_TO_FINAL: { + Push(ifst, ofst, std::get<2>(*args), + std::get<4>(*args)); + return; + } + case REWEIGHT_TO_INITIAL: { + Push(ifst, ofst, std::get<2>(*args), + std::get<4>(*args)); + return; + } + } +} + +void Push(MutableFstClass *fst, ReweightType rew_type, float delta = kDelta, + bool remove_total_weight = false); + +void Push(const FstClass &ifst, MutableFstClass *ofst, uint32 flags, + ReweightType rew_type, float delta = kDelta); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_PUSH_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/randequivalent.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/randequivalent.h new file mode 100644 index 0000000..945f8a0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/randequivalent.h @@ -0,0 +1,67 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_RANDEQUIVALENT_H_ +#define FST_SCRIPT_RANDEQUIVALENT_H_ + +#include +#include + +#include + +#include +#include +#include +#include + +namespace fst { +namespace script { + +using RandEquivalentInnerArgs = std::tuple &>; + +using RandEquivalentArgs = WithReturnValue; + +template +void RandEquivalent(RandEquivalentArgs *args) { + const Fst &fst1 = *(std::get<0>(args->args).GetFst()); + const Fst &fst2 = *(std::get<1>(args->args).GetFst()); + const auto seed = std::get<4>(args->args); + const auto &opts = std::get<5>(args->args); + switch (opts.selector) { + case UNIFORM_ARC_SELECTOR: { + const UniformArcSelector selector(seed); + const RandGenOptions> ropts(selector, + opts.max_length); + args->retval = RandEquivalent(fst1, fst2, std::get<2>(args->args), + std::get<3>(args->args), ropts); + return; + } + case FAST_LOG_PROB_ARC_SELECTOR: { + const FastLogProbArcSelector selector(seed); + const RandGenOptions> ropts(selector, + opts.max_length); + args->retval = RandEquivalent(fst1, fst2, std::get<2>(args->args), + std::get<3>(args->args), ropts); + return; + } + case LOG_PROB_ARC_SELECTOR: { + const LogProbArcSelector selector(seed); + const RandGenOptions> ropts(selector, + opts.max_length); + args->retval = RandEquivalent(fst1, fst2, std::get<2>(args->args), + std::get<3>(args->args), ropts); + return; + } + } +} + +bool RandEquivalent(const FstClass &fst1, const FstClass &fst2, int32 npath = 1, + float delta = kDelta, time_t seed = time(nullptr), + const RandGenOptions &opts = + RandGenOptions(UNIFORM_ARC_SELECTOR)); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_RANDEQUIVALENT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/randgen.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/randgen.h new file mode 100644 index 0000000..5ce79d0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/randgen.h @@ -0,0 +1,63 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_RANDGEN_H_ +#define FST_SCRIPT_RANDGEN_H_ + +#include + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +using RandGenArgs = std::tuple &>; + +template +void RandGen(RandGenArgs *args) { + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + const time_t seed = std::get<2>(*args); + const auto &opts = std::get<3>(*args); + switch (opts.selector) { + case UNIFORM_ARC_SELECTOR: { + const UniformArcSelector selector(seed); + const RandGenOptions> ropts( + selector, opts.max_length, opts.npath, opts.weighted, + opts.remove_total_weight); + RandGen(ifst, ofst, ropts); + return; + } + case FAST_LOG_PROB_ARC_SELECTOR: { + const FastLogProbArcSelector selector(seed); + const RandGenOptions> ropts( + selector, opts.max_length, opts.npath, opts.weighted, + opts.remove_total_weight); + RandGen(ifst, ofst, ropts); + return; + } + case LOG_PROB_ARC_SELECTOR: { + const LogProbArcSelector selector(seed); + const RandGenOptions> ropts( + selector, opts.max_length, opts.npath, opts.weighted, + opts.remove_total_weight); + RandGen(ifst, ofst, ropts); + return; + } + } +} + +void RandGen(const FstClass &ifst, MutableFstClass *ofst, + time_t seed = time(nullptr), + const RandGenOptions &opts = + RandGenOptions(UNIFORM_ARC_SELECTOR)); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_RANDGEN_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/register.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/register.h new file mode 100644 index 0000000..d66e7ad --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/register.h @@ -0,0 +1,99 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_REGISTER_H_ +#define FST_SCRIPT_REGISTER_H_ + +#include +#include + +#include +#include +#include + +// Holds methods and classes responsible for maintaining +// the register for FstClass arc types. + +namespace fst { +namespace script { + +// Registers for reading and converting various kinds of FST classes. + +// This class definition is to avoid a nested class definition inside the +// IORegistration struct. + +template +struct FstClassRegEntry { + Reader reader; + Creator creator; + Converter converter; + + FstClassRegEntry(Reader r, Creator cr, Converter co) + : reader(r), creator(cr), converter(co) {} + + FstClassRegEntry() + : reader(nullptr), creator(nullptr), converter(nullptr) {} +}; + +template +class FstClassIORegister + : public GenericRegister, + FstClassIORegister> { + public: + Reader GetReader(const string &arc_type) const { + return this->GetEntry(arc_type).reader; + } + + Creator GetCreator(const string &arc_type) const { + return this->GetEntry(arc_type).creator; + } + + Converter GetConverter(const string &arc_type) const { + return this->GetEntry(arc_type).converter; + } + + protected: + string ConvertKeyToSoFilename(const string &key) const final { + string legal_type(key); + ConvertToLegalCSymbol(&legal_type); + return legal_type + "-arc.so"; + } +}; + +// Struct containing everything needed to register a particular type +// of FST class (e.g., a plain FstClass, or a MutableFstClass, etc.). +template +struct IORegistration { + using Reader = FstClassType *(*)(std::istream &stream, + const FstReadOptions &opts); + + using Creator = FstClassImplBase *(*)(); + + using Converter = FstClassImplBase *(*)(const FstClass &other); + + using Entry = FstClassRegEntry; + + // FST class Register. + using Register = FstClassIORegister; + + // FST class Register-er. + using Registerer = + GenericRegisterer>; +}; + +#define REGISTER_FST_CLASS(Class, Arc) \ + static IORegistration::Registerer Class##_##Arc##_registerer( \ + Arc::Type(), \ + IORegistration::Entry(Class::Read, Class::Create, \ + Class::Convert)) + +#define REGISTER_FST_CLASSES(Arc) \ + REGISTER_FST_CLASS(FstClass, Arc); \ + REGISTER_FST_CLASS(MutableFstClass, Arc); \ + REGISTER_FST_CLASS(VectorFstClass, Arc); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_REGISTER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/relabel.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/relabel.h new file mode 100644 index 0000000..7444349 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/relabel.h @@ -0,0 +1,64 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_RELABEL_H_ +#define FST_SCRIPT_RELABEL_H_ + +#include +#include +#include +#include + +#include +#include + +namespace fst { +namespace script { + +using RelabelArgs1 = std::tuple; + +template +void Relabel(RelabelArgs1 *args) { + MutableFst *ofst = std::get<0>(*args)->GetMutableFst(); + Relabel(ofst, std::get<1>(*args), std::get<2>(*args), std::get<3>(*args), + std::get<4>(*args), std::get<5>(*args), std::get<6>(*args), + std::get<7>(*args), std::get<8>(*args)); +} + +using LabelPair = std::pair; + +using RelabelArgs2 = std::tuple &, + const std::vector &>; + +template +void Relabel(RelabelArgs2 *args) { + MutableFst *ofst = std::get<0>(*args)->GetMutableFst(); + using LabelPair = std::pair; + // In case the MutableFstClass::Label is not the same as Arc::Label, + // make a copy. + std::vector typed_ipairs(std::get<1>(*args).size()); + std::copy(std::get<1>(*args).begin(), std::get<1>(*args).end(), + typed_ipairs.begin()); + std::vector typed_opairs(std::get<2>(*args).size()); + std::copy(std::get<2>(*args).begin(), std::get<2>(*args).end(), + typed_opairs.begin()); + Relabel(ofst, typed_ipairs, typed_opairs); +} + +void Relabel(MutableFstClass *ofst, + const SymbolTable *old_isymbols, const SymbolTable *new_isymbols, + const string &unknown_isymbol, bool attach_new_isymbols, + const SymbolTable *old_osymbols, const SymbolTable *new_osymbols, + const string &unknown_osymbol, bool attach_new_osymbols); + +void Relabel(MutableFstClass *ofst, const std::vector &ipairs, + const std::vector &opairs); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_RELABEL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/replace.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/replace.h new file mode 100644 index 0000000..926ece2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/replace.h @@ -0,0 +1,72 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_REPLACE_H_ +#define FST_SCRIPT_REPLACE_H_ + +#include +#include +#include + +#include +#include + +namespace fst { +namespace script { + +struct ReplaceOptions { + const int64 root; // Root rule for expansion. + const ReplaceLabelType call_label_type; // How to label call arc. + const ReplaceLabelType return_label_type; // How to label return arc. + const int64 return_label; // Specifies return arc label. + + explicit ReplaceOptions(int64 root, + ReplaceLabelType call_label_type = REPLACE_LABEL_INPUT, + ReplaceLabelType return_label_type = REPLACE_LABEL_NEITHER, + int64 return_label = 0) + : root(root), + call_label_type(call_label_type), + return_label_type(return_label_type), + return_label(return_label) {} +}; + +using LabelFstClassPair = std::pair; + +using ReplaceArgs = std::tuple &, + MutableFstClass *, const ReplaceOptions &>; + +template +void Replace(ReplaceArgs *args) { + using LabelFstPair = std::pair *>; + // Now that we know the arc type, we construct a vector of + // std::pair that the real Replace will use. + const auto &untyped_pairs = std::get<0>(*args); + std::vector typed_pairs; + typed_pairs.reserve(untyped_pairs.size()); + for (const auto &untyped_pair : untyped_pairs) { + typed_pairs.emplace_back(untyped_pair.first, // Converts label. + untyped_pair.second->GetFst()); + } + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + const auto &opts = std::get<2>(*args); + ReplaceFstOptions typed_opts(opts.root, opts.call_label_type, + opts.return_label_type, opts.return_label); + ReplaceFst rfst(typed_pairs, typed_opts); + // Checks for cyclic dependencies before attempting expansion. + if (rfst.CyclicDependencies()) { + FSTERROR() << "Replace: Cyclic dependencies detected; cannot expand"; + ofst->SetProperties(kError, kError); + return; + } + typed_opts.gc = true; // Caching options to speed up batch copy. + typed_opts.gc_limit = 0; + *ofst = rfst; +} + +void Replace(const std::vector &pairs, + MutableFstClass *ofst, const ReplaceOptions &opts); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_REPLACE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/reverse.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/reverse.h new file mode 100644 index 0000000..badd96b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/reverse.h @@ -0,0 +1,30 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_REVERSE_H_ +#define FST_SCRIPT_REVERSE_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using ReverseArgs = std::tuple; + +template +void Reverse(ReverseArgs *args) { + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + Reverse(ifst, ofst, std::get<2>(*args)); +} + +void Reverse(const FstClass &ifst, MutableFstClass *ofst, + bool require_superinitial = true); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_REVERSE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/reweight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/reweight.h new file mode 100644 index 0000000..3893ad8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/reweight.h @@ -0,0 +1,37 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_REWEIGHT_H_ +#define FST_SCRIPT_REWEIGHT_H_ + +#include +#include + +#include +#include +#include +#include + +namespace fst { +namespace script { + +using ReweightArgs = std::tuple &, ReweightType>; + +template +void Reweight(ReweightArgs *args) { + using Weight = typename Arc::Weight; + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + const std::vector &potentials = std::get<1>(*args); + std::vector typed_potentials; + internal::CopyWeights(potentials, &typed_potentials); + Reweight(fst, typed_potentials, std::get<2>(*args)); +} + +void Reweight(MutableFstClass *fst, const std::vector &potentials, + ReweightType reweight_type); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_REWEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/rmepsilon.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/rmepsilon.h new file mode 100644 index 0000000..42986c8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/rmepsilon.h @@ -0,0 +1,109 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_RMEPSILON_H_ +#define FST_SCRIPT_RMEPSILON_H_ + +#include +#include + +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +struct RmEpsilonOptions : public ShortestDistanceOptions { + const bool connect; + const WeightClass &weight_threshold; + const int64 state_threshold; + + RmEpsilonOptions(QueueType queue_type, bool connect, + const WeightClass &weight_threshold, + int64 state_threshold = kNoStateId, float delta = kDelta) + : ShortestDistanceOptions(queue_type, EPSILON_ARC_FILTER, kNoStateId, + delta), + connect(connect), + weight_threshold(weight_threshold), + state_threshold(state_threshold) {} +}; + +namespace internal { + +// Code to implement switching on queue types. + +template +void RmEpsilon(MutableFst *fst, + std::vector *distance, + const RmEpsilonOptions &opts, Queue *queue) { + using Weight = typename Arc::Weight; + const fst::RmEpsilonOptions ropts( + queue, opts.delta, opts.connect, + *opts.weight_threshold.GetWeight(), opts.state_threshold); + RmEpsilon(fst, distance, ropts); +} + +template +void RmEpsilon(MutableFst *fst, const RmEpsilonOptions &opts) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + std::vector distance; + switch (opts.queue_type) { + case AUTO_QUEUE: { + AutoQueue queue(*fst, &distance, EpsilonArcFilter()); + RmEpsilon(fst, &distance, opts, &queue); + return; + } + case FIFO_QUEUE: { + FifoQueue queue; + RmEpsilon(fst, &distance, opts, &queue); + return; + } + case LIFO_QUEUE: { + LifoQueue queue; + RmEpsilon(fst, &distance, opts, &queue); + return; + } + case SHORTEST_FIRST_QUEUE: { + NaturalShortestFirstQueue queue(distance); + RmEpsilon(fst, &distance, opts, &queue); + return; + } + case STATE_ORDER_QUEUE: { + StateOrderQueue queue; + RmEpsilon(fst, &distance, opts, &queue); + return; + } + case TOP_ORDER_QUEUE: { + TopOrderQueue queue(*fst, EpsilonArcFilter()); + internal::RmEpsilon(fst, &distance, opts, &queue); + return; + } + default: { + FSTERROR() << "RmEpsilon: Unknown queue type: " << opts.queue_type; + fst->SetProperties(kError, kError); + return; + } + } +} + +} // namespace internal + +using RmEpsilonArgs = std::pair; + +template +void RmEpsilon(RmEpsilonArgs *args) { + MutableFst *fst = std::get<0>(*args)->GetMutableFst(); + const auto &opts = std::get<1>(*args); + internal::RmEpsilon(fst, opts); +} + +void RmEpsilon(MutableFstClass *fst, const RmEpsilonOptions &opts); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_RMEPSILON_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/script-impl.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/script-impl.h new file mode 100644 index 0000000..33c2853 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/script-impl.h @@ -0,0 +1,211 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// This file defines the registration mechanism for new operations. +// These operations are designed to enable scripts to work with FST classes +// at a high level. +// +// If you have a new arc type and want these operations to work with FSTs +// with that arc type, see below for the registration steps +// you must take. +// +// These methods are only recommended for use in high-level scripting +// applications. Most users should use the lower-level templated versions +// corresponding to these. +// +// If you have a new arc type you'd like these operations to work with, +// use the REGISTER_FST_OPERATIONS macro defined in fstscript.h. +// +// If you have a custom operation you'd like to define, you need four +// components. In the following, assume you want to create a new operation +// with the signature +// +// void Foo(const FstClass &ifst, MutableFstClass *ofst); +// +// You need: +// +// 1) A way to bundle the args that your new Foo operation will take, as +// a single struct. The template structs in arg-packs.h provide a handy +// way to do this. In Foo's case, that might look like this: +// +// using FooArgs = std::pair; +// +// Note: this package of args is going to be passed by non-const pointer. +// +// 2) A function template that is able to perform Foo, given the args and +// arc type. Yours might look like this: +// +// template +// void Foo(FooArgs *args) { +// // Pulls out the actual, arc-templated FSTs. +// const Fst &ifst = std::get<0>(*args).GetFst(); +// MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); +// // Actually perform Foo on ifst and ofst. +// } +// +// 3) a client-facing function for your operation. This would look like +// the following: +// +// void Foo(const FstClass &ifst, MutableFstClass *ofst) { +// // Check that the arc types of the FSTs match +// if (!ArcTypesMatch(ifst, *ofst, "Foo")) return; +// // package the args +// FooArgs args(ifst, ofst); +// // Finally, call the operation +// Apply>("Foo", ifst->ArcType(), &args); +// } +// +// The Apply<> function template takes care of the link between 2 and 3, +// provided you also have: +// +// 4) A registration for your new operation, on the arc types you care about. +// This can be provided easily by the REGISTER_FST_OPERATION macro in +// operations.h: +// +// REGISTER_FST_OPERATION(Foo, StdArc, FooArgs); +// REGISTER_FST_OPERATION(Foo, MyArc, FooArgs); +// // .. etc +// +// +// That's it! Now when you call Foo(const FstClass &, MutableFstClass *), +// it dispatches (in #3) via the Apply<> function to the correct +// instantiation of the template function in #2. +// + +#ifndef FST_SCRIPT_SCRIPT_IMPL_H_ +#define FST_SCRIPT_SCRIPT_IMPL_H_ + +// This file contains general-purpose templates which are used in the +// implementation of the operations. + +#include +#include + +#include +#include + +#include + +namespace fst { +namespace script { + +enum RandArcSelection { + UNIFORM_ARC_SELECTOR, + LOG_PROB_ARC_SELECTOR, + FAST_LOG_PROB_ARC_SELECTOR +}; + +// A generic register for operations with various kinds of signatures. +// Needed since every function signature requires a new registration class. +// The std::pair is understood to be the operation name and arc +// type; subclasses (or typedefs) need only provide the operation signature. + +template +class GenericOperationRegister + : public GenericRegister, OperationSignature, + GenericOperationRegister> { + public: + void RegisterOperation(const string &operation_name, const string &arc_type, + OperationSignature op) { + this->SetEntry(std::make_pair(operation_name, arc_type), op); + } + + OperationSignature GetOperation(const string &operation_name, + const string &arc_type) { + return this->GetEntry(std::make_pair(operation_name, arc_type)); + } + + protected: + string ConvertKeyToSoFilename( + const std::pair &key) const final { + // Uses the old-style FST for now. + string legal_type(key.second); // The arc type. + ConvertToLegalCSymbol(&legal_type); + return legal_type + "-arc.so"; + } +}; + +// Operation package: everything you need to register a new type of operation. +// The ArgPack should be the type that's passed into each wrapped function; +// for instance, it might be a struct containing all the args. It's always +// passed by pointer, so const members should be used to enforce constness where +// it's needed. Return values should be implemented as a member of ArgPack as +// well. + +template +struct Operation { + using ArgPack = Args; + + using OpType = void (*)(ArgPack *args); + + // The register (hash) type. + using Register = GenericOperationRegister; + + // The register-er type + using Registerer = GenericRegisterer; +}; + +// Macro for registering new types of operations. + +#define REGISTER_FST_OPERATION(Op, Arc, ArgPack) \ + static fst::script::Operation::Registerer \ + arc_dispatched_operation_##ArgPack##Op##Arc##_registerer \ + (std::make_pair(#Op, Arc::Type()), Op) + +// Template function to apply an operation by name. + +template +void Apply(const string &op_name, const string &arc_type, + typename OpReg::ArgPack *args) { + const auto op = OpReg::Register::GetRegister()->GetOperation(op_name, + arc_type); + if (!op) { + FSTERROR() << "No operation found for " << op_name << " on " + << "arc type " << arc_type; + return; + } + op(args); +} + +namespace internal { + +// Helper that logs to ERROR if the arc types of m and n don't match, +// assuming that both m and n implement .ArcType(). The op_name argument is +// used to construct the error message. +template +bool ArcTypesMatch(const M &m, const N &n, const string &op_name) { + if (m.ArcType() != n.ArcType()) { + FSTERROR() << "Arguments with non-matching arc types passed to " + << op_name << ":\t" << m.ArcType() << " and " << n.ArcType(); + return false; + } + return true; +} + +// From untyped to typed weights. +template +void CopyWeights(const std::vector &weights, + std::vector *typed_weights) { + typed_weights->clear(); + typed_weights->reserve(weights.size()); + for (const auto &weight : weights) { + typed_weights->push_back(*weight.GetWeight()); + } +} + +// From typed to untyped weights. +template +void CopyWeights(const std::vector &typed_weights, + std::vector *weights) { + weights->clear(); + weights->reserve(typed_weights.size()); + for (const auto &typed_weight : typed_weights) { + weights->emplace_back(typed_weight); + } +} + +} // namespace internal +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_SCRIPT_IMPL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/shortest-distance.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/shortest-distance.h new file mode 100644 index 0000000..a44a6c9 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/shortest-distance.h @@ -0,0 +1,214 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_SHORTEST_DISTANCE_H_ +#define FST_SCRIPT_SHORTEST_DISTANCE_H_ + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +enum ArcFilterType { + ANY_ARC_FILTER, + EPSILON_ARC_FILTER, + INPUT_EPSILON_ARC_FILTER, + OUTPUT_EPSILON_ARC_FILTER +}; + +struct ShortestDistanceOptions { + const QueueType queue_type; + const ArcFilterType arc_filter_type; + const int64 source; + const float delta; + + ShortestDistanceOptions(QueueType queue_type, ArcFilterType arc_filter_type, + int64 source, float delta) + : queue_type(queue_type), + arc_filter_type(arc_filter_type), + source(source), + delta(delta) {} +}; + +namespace internal { + +// Code to implement switching on queue and arc filter types. + +template +struct QueueConstructor { + using Weight = typename Arc::Weight; + + static Queue *Construct(const Fst &, const std::vector *) { + return new Queue(); + } +}; + +// Specializations to support queues with different constructors. + +template +struct QueueConstructor, ArcFilter> { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + // template + static AutoQueue *Construct(const Fst &fst, + const std::vector *distance) { + return new AutoQueue(fst, distance, ArcFilter()); + } +}; + +template +struct QueueConstructor< + Arc, NaturalShortestFirstQueue, + ArcFilter> { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + static NaturalShortestFirstQueue *Construct( + const Fst &, const std::vector *distance) { + return new NaturalShortestFirstQueue(*distance); + } +}; + +template +struct QueueConstructor, ArcFilter> { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + static TopOrderQueue *Construct(const Fst &fst, + const std::vector *) { + return new TopOrderQueue(fst, ArcFilter()); + } +}; + +template +void ShortestDistance(const Fst &fst, + std::vector *distance, + const ShortestDistanceOptions &opts) { + std::unique_ptr queue( + QueueConstructor::Construct(fst, distance)); + const fst::ShortestDistanceOptions sopts( + queue.get(), ArcFilter(), opts.source, opts.delta); + ShortestDistance(fst, distance, sopts); +} + +template +void ShortestDistance(const Fst &fst, + std::vector *distance, + const ShortestDistanceOptions &opts) { + switch (opts.arc_filter_type) { + case ANY_ARC_FILTER: { + ShortestDistance>(fst, distance, opts); + return; + } + case EPSILON_ARC_FILTER: { + ShortestDistance>(fst, distance, opts); + return; + } + case INPUT_EPSILON_ARC_FILTER: { + ShortestDistance>(fst, distance, + opts); + return; + } + case OUTPUT_EPSILON_ARC_FILTER: { + ShortestDistance>(fst, distance, + opts); + return; + } + default: { + FSTERROR() << "ShortestDistance: Unknown arc filter type: " + << opts.arc_filter_type; + distance->clear(); + distance->resize(1, Arc::Weight::NoWeight()); + return; + } + } +} + +} // namespace internal + +using ShortestDistanceArgs1 = + std::tuple *, + const ShortestDistanceOptions &>; + +template +void ShortestDistance(ShortestDistanceArgs1 *args) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + const Fst &fst = *(std::get<0>(*args).GetFst()); + const auto &opts = std::get<2>(*args); + std::vector typed_distance; + switch (opts.queue_type) { + case AUTO_QUEUE: { + internal::ShortestDistance>(fst, &typed_distance, + opts); + break; + } + case FIFO_QUEUE: { + internal::ShortestDistance>(fst, &typed_distance, + opts); + break; + } + case LIFO_QUEUE: { + internal::ShortestDistance>(fst, &typed_distance, + opts); + break; + } + case SHORTEST_FIRST_QUEUE: { + internal::ShortestDistance>( + fst, &typed_distance, opts); + break; + } + case STATE_ORDER_QUEUE: { + internal::ShortestDistance>( + fst, &typed_distance, opts); + break; + } + case TOP_ORDER_QUEUE: { + internal::ShortestDistance>( + fst, &typed_distance, opts); + break; + } + default: { + FSTERROR() << "ShortestDistance: Unknown queue type: " << opts.queue_type; + typed_distance.clear(); + typed_distance.resize(1, Arc::Weight::NoWeight()); + break; + } + } + internal::CopyWeights(typed_distance, std::get<1>(*args)); +} + +using ShortestDistanceArgs2 = + std::tuple *, bool, double>; + +template +void ShortestDistance(ShortestDistanceArgs2 *args) { + using Weight = typename Arc::Weight; + const Fst &fst = *(std::get<0>(*args).GetFst()); + std::vector typed_distance; + ShortestDistance(fst, &typed_distance, std::get<2>(*args), + std::get<3>(*args)); + internal::CopyWeights(typed_distance, std::get<1>(*args)); +} + +void ShortestDistance(const FstClass &fst, std::vector *distance, + const ShortestDistanceOptions &opts); + +void ShortestDistance(const FstClass &ifst, std::vector *distance, + bool reverse = false, + double delta = fst::kShortestDelta); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_SHORTEST_DISTANCE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/shortest-path.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/shortest-path.h new file mode 100644 index 0000000..86bc88d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/shortest-path.h @@ -0,0 +1,116 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_SHORTEST_PATH_H_ +#define FST_SCRIPT_SHORTEST_PATH_H_ + +#include +#include + +#include +#include +#include +#include + +namespace fst { +namespace script { + +// Slightly simplified interface: `has_distance` and `first_path` are disabled. + +struct ShortestPathOptions : public ShortestDistanceOptions { + const int32 nshortest; + const bool unique; + const WeightClass &weight_threshold; + const int64 state_threshold; + + ShortestPathOptions(QueueType queue_type, int32 nshortest, bool unique, + float delta, const WeightClass &weight_threshold, + int64 state_threshold = kNoStateId) + : ShortestDistanceOptions(queue_type, ANY_ARC_FILTER, kNoStateId, delta), + nshortest(nshortest), + unique(unique), + weight_threshold(weight_threshold), + state_threshold(state_threshold) {} +}; + +namespace internal { + +// Code to implement switching on queue types. + +template +void ShortestPath(const Fst &ifst, MutableFst *ofst, + std::vector *distance, + const ShortestPathOptions &opts) { + using ArcFilter = AnyArcFilter; + using Weight = typename Arc::Weight; + const std::unique_ptr queue( + QueueConstructor::Construct(ifst, distance)); + const fst::ShortestPathOptions sopts( + queue.get(), ArcFilter(), opts.nshortest, opts.unique, + /* has_distance=*/false, opts.delta, /* first_path=*/false, + *opts.weight_threshold.GetWeight(), opts.state_threshold); + ShortestPath(ifst, ofst, distance, sopts); +} + +template +void ShortestPath(const Fst &ifst, MutableFst *ofst, + const ShortestPathOptions &opts) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + std::vector distance; + switch (opts.queue_type) { + case AUTO_QUEUE: { + ShortestPath>(ifst, ofst, &distance, opts); + return; + } + case FIFO_QUEUE: { + ShortestPath>(ifst, ofst, &distance, opts); + return; + } + case LIFO_QUEUE: { + ShortestPath>(ifst, ofst, &distance, opts); + return; + } + case SHORTEST_FIRST_QUEUE: { + ShortestPath>(ifst, ofst, + &distance, + opts); + return; + } + case STATE_ORDER_QUEUE: { + ShortestPath>(ifst, ofst, &distance, opts); + return; + } + case TOP_ORDER_QUEUE: { + ShortestPath>(ifst, ofst, &distance, opts); + return; + } + default: { + FSTERROR() << "ShortestPath: Unknown queue type: " + << opts.queue_type; + ofst->SetProperties(kError, kError); + return; + } + } +} + +} // namespace internal + +using ShortestPathArgs = std::tuple; + +template +void ShortestPath(ShortestPathArgs *args) { + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + const ShortestPathOptions &opts = std::get<2>(*args); + internal::ShortestPath(ifst, ofst, opts); +} + +void ShortestPath(const FstClass &ifst, MutableFstClass *ofst, + const ShortestPathOptions &opts); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_SHORTEST_PATH_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/stateiterator-class.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/stateiterator-class.h new file mode 100644 index 0000000..f6fddfe --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/stateiterator-class.h @@ -0,0 +1,85 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_STATEITERATOR_CLASS_H_ +#define FST_SCRIPT_STATEITERATOR_CLASS_H_ + +#include + +#include +#include + +// Scripting API support for StateIterator. + +namespace fst { +namespace script { + +// Virtual interface implemented by each concrete StateIteratorImpl. +class StateIteratorImplBase { + public: + virtual bool Done() const = 0; + virtual int64 Value() const = 0; + virtual void Next() = 0; + virtual void Reset() = 0; + virtual ~StateIteratorImplBase() {} +}; + +// Templated implementation. +template +class StateIteratorClassImpl : public StateIteratorImplBase { + public: + explicit StateIteratorClassImpl(const Fst &fst) : siter_(fst) {} + + bool Done() const final { return siter_.Done(); } + + int64 Value() const final { return siter_.Value(); } + + void Next() final { siter_.Next(); } + + void Reset() final { siter_.Reset(); } + + ~StateIteratorClassImpl() override {} + + private: + StateIterator> siter_; +}; + +class StateIteratorClass; + +using InitStateIteratorClassArgs = + std::pair; + +// Untemplated user-facing class holding a templated pimpl. +class StateIteratorClass { + public: + explicit StateIteratorClass(const FstClass &fst); + + template + explicit StateIteratorClass(const Fst &fst) + : impl_(new StateIteratorClassImpl(fst)) {} + + bool Done() const { return impl_->Done(); } + + int64 Value() const { return impl_->Value(); } + + void Next() { impl_->Next(); } + + void Reset() { impl_->Reset(); } + + template + friend void InitStateIteratorClass(InitStateIteratorClassArgs *args); + + private: + std::unique_ptr impl_; +}; + +template +void InitStateIteratorClass(InitStateIteratorClassArgs *args) { + const Fst &fst = *(std::get<0>(*args).GetFst()); + std::get<1>(*args)->impl_.reset(new StateIteratorClassImpl(fst)); +} + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_STATEITERATOR_CLASS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/synchronize.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/synchronize.h new file mode 100644 index 0000000..01df151 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/synchronize.h @@ -0,0 +1,29 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_SYNCHRONIZE_H_ +#define FST_SCRIPT_SYNCHRONIZE_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using SynchronizeArgs = std::pair; + +template +void Synchronize(SynchronizeArgs *args) { + const Fst &ifst = *(std::get<0>(*args).GetFst()); + MutableFst *ofst = std::get<1>(*args)->GetMutableFst(); + Synchronize(ifst, ofst); +} + +void Synchronize(const FstClass &ifst, MutableFstClass *ofst); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_SYNCHRONIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/text-io.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/text-io.h new file mode 100644 index 0000000..464bf88 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/text-io.h @@ -0,0 +1,28 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Utilities for reading and writing textual strings representing states, +// labels, and weights and files specifying label-label pairs and potentials +// (state-weight pairs). + +#ifndef FST_SCRIPT_TEXT_IO_H__ +#define FST_SCRIPT_TEXT_IO_H__ + +#include +#include + +#include + +namespace fst { +namespace script { + +bool ReadPotentials(const string &weight_type, const string &filename, + std::vector *potentials); + +bool WritePotentials(const string &filename, + const std::vector &potentials); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_TEXT_IO_H__ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/topsort.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/topsort.h new file mode 100644 index 0000000..fb6738d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/topsort.h @@ -0,0 +1,26 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_TOPSORT_H_ +#define FST_SCRIPT_TOPSORT_H_ + +#include +#include +#include + +namespace fst { +namespace script { + +using TopSortArgs = WithReturnValue; + +template +void TopSort(TopSortArgs *args) { + args->retval = TopSort(args->args->GetMutableFst()); +} + +bool TopSort(MutableFstClass *fst); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_TOPSORT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/union.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/union.h new file mode 100644 index 0000000..9493e2b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/union.h @@ -0,0 +1,29 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_UNION_H_ +#define FST_SCRIPT_UNION_H_ + +#include + +#include +#include + +namespace fst { +namespace script { + +using UnionArgs = std::pair; + +template +void Union(UnionArgs *args) { + MutableFst *fst1 = std::get<0>(*args)->GetMutableFst(); + const Fst &fst2 = *(std::get<1>(*args).GetFst()); + Union(fst1, fst2); +} + +void Union(MutableFstClass *fst1, const FstClass &fst2); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_UNION_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/verify.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/verify.h new file mode 100644 index 0000000..52f5864 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/verify.h @@ -0,0 +1,27 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#ifndef FST_SCRIPT_VERIFY_H_ +#define FST_SCRIPT_VERIFY_H_ + +#include +#include +#include + +namespace fst { +namespace script { + +using VerifyArgs = WithReturnValue; + +template +void Verify(VerifyArgs *args) { + const Fst &fst = *(args->args.GetFst()); + args->retval = Verify(fst); +} + +bool Verify(const FstClass &fst); + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_VERIFY_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/script/weight-class.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/weight-class.h new file mode 100644 index 0000000..6dadf92 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/script/weight-class.h @@ -0,0 +1,235 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Represents a generic weight in an FST; that is, represents a specific type +// of weight underneath while hiding that type from a client. + +#ifndef FST_SCRIPT_WEIGHT_CLASS_H_ +#define FST_SCRIPT_WEIGHT_CLASS_H_ + +#include +#include +#include + +#include +#include +#include +#include + +namespace fst { +namespace script { + +class WeightImplBase { + public: + virtual WeightImplBase *Copy() const = 0; + virtual void Print(std::ostream *o) const = 0; + virtual const string &Type() const = 0; + virtual string ToString() const = 0; + virtual bool Member() const = 0; + virtual bool operator==(const WeightImplBase &other) const = 0; + virtual bool operator!=(const WeightImplBase &other) const = 0; + virtual WeightImplBase &PlusEq(const WeightImplBase &other) = 0; + virtual WeightImplBase &TimesEq(const WeightImplBase &other) = 0; + virtual WeightImplBase &DivideEq(const WeightImplBase &other) = 0; + virtual WeightImplBase &PowerEq(size_t n) = 0; + virtual ~WeightImplBase() {} +}; + +template +class WeightClassImpl : public WeightImplBase { + public: + explicit WeightClassImpl(const W &weight) : weight_(weight) {} + + WeightClassImpl *Copy() const final { + return new WeightClassImpl(weight_); + } + + const string &Type() const final { return W::Type(); } + + void Print(std::ostream *ostrm) const final { *ostrm << weight_; } + + string ToString() const final { + string str; + WeightToStr(weight_, &str); + return str; + } + + bool Member() const final { return weight_.Member(); } + + bool operator==(const WeightImplBase &other) const final { + const auto *typed_other = static_cast *>(&other); + return weight_ == typed_other->weight_; + } + + bool operator!=(const WeightImplBase &other) const final { + return !(*this == other); + } + + WeightClassImpl &PlusEq(const WeightImplBase &other) final { + const auto *typed_other = static_cast *>(&other); + weight_ = Plus(weight_, typed_other->weight_); + return *this; + } + + WeightClassImpl &TimesEq(const WeightImplBase &other) final { + const auto *typed_other = static_cast *>(&other); + weight_ = Times(weight_, typed_other->weight_); + return *this; + } + + WeightClassImpl &DivideEq(const WeightImplBase &other) final { + const auto *typed_other = static_cast *>(&other); + weight_ = Divide(weight_, typed_other->weight_); + return *this; + } + + WeightClassImpl &PowerEq(size_t n) final { + weight_ = Power(weight_, n); + return *this; + } + + W *GetImpl() { return &weight_; } + + private: + W weight_; +}; + + +class WeightClass { + public: + WeightClass() = default; + + template + explicit WeightClass(const W &weight) + : impl_(new WeightClassImpl(weight)) {} + + template + explicit WeightClass(const WeightClassImpl &impl) + : impl_(new WeightClassImpl(impl)) {} + + WeightClass(const string &weight_type, const string &weight_str); + + WeightClass(const WeightClass &other) + : impl_(other.impl_ ? other.impl_->Copy() : nullptr) {} + + WeightClass &operator=(const WeightClass &other) { + impl_.reset(other.impl_ ? other.impl_->Copy() : nullptr); + return *this; + } + + static constexpr const char *__ZERO__ = "__ZERO__"; // NOLINT + + static WeightClass Zero(const string &weight_type); + + static constexpr const char *__ONE__ = "__ONE__"; // NOLINT + + static WeightClass One(const string &weight_type); + + static constexpr const char *__NOWEIGHT__ = "__NOWEIGHT__"; // NOLINT + + static WeightClass NoWeight(const string &weight_type); + + template + const W *GetWeight() const { + if (W::Type() != impl_->Type()) { + return nullptr; + } else { + auto *typed_impl = static_cast *>(impl_.get()); + return typed_impl->GetImpl(); + } + } + + string ToString() const { return (impl_) ? impl_->ToString() : "none"; } + + const string &Type() const { + if (impl_) return impl_->Type(); + static const string *const no_type = new string("none"); + return *no_type; + } + + bool Member() const { return impl_ && impl_->Member(); } + + bool WeightTypesMatch(const WeightClass &other, const string &op_name) const; + + friend bool operator==(const WeightClass &lhs, const WeightClass &rhs); + + friend WeightClass Plus(const WeightClass &lhs, const WeightClass &rhs); + + friend WeightClass Times(const WeightClass &lhs, const WeightClass &rhs); + + friend WeightClass Divide(const WeightClass &lhs, const WeightClass &rhs); + + friend WeightClass Power(const WeightClass &w, size_t n); + + private: + const WeightImplBase *GetImpl() const { return impl_.get(); } + + WeightImplBase *GetImpl() { return impl_.get(); } + + std::unique_ptr impl_; + + friend std::ostream &operator<<(std::ostream &o, const WeightClass &c); +}; + +bool operator==(const WeightClass &lhs, const WeightClass &rhs); + +bool operator!=(const WeightClass &lhs, const WeightClass &rhs); + +WeightClass Plus(const WeightClass &lhs, const WeightClass &rhs); + +WeightClass Times(const WeightClass &lhs, const WeightClass &rhs); + +WeightClass Divide(const WeightClass &lhs, const WeightClass &rhs); + +WeightClass Power(const WeightClass &w, size_t n); + +std::ostream &operator<<(std::ostream &o, const WeightClass &c); + +// Registration for generic weight types. + +using StrToWeightImplBaseT = WeightImplBase *(*)(const string &str, + const string &src, + size_t nline); + +template +WeightImplBase *StrToWeightImplBase(const string &str, const string &src, + size_t nline) { + if (str == WeightClass::__ZERO__) + return new WeightClassImpl(W::Zero()); + else if (str == WeightClass::__ONE__) + return new WeightClassImpl(W::One()); + else if (str == WeightClass::__NOWEIGHT__) + return new WeightClassImpl(W::NoWeight()); + return new WeightClassImpl(StrToWeight(str, src, nline)); +} + +class WeightClassRegister : public GenericRegister { + protected: + string ConvertKeyToSoFilename(const string &key) const final { + string legal_type(key); + ConvertToLegalCSymbol(&legal_type); + return legal_type + ".so"; + } +}; + +using WeightClassRegisterer = GenericRegisterer; + +// Internal version; needs to be called by wrapper in order for macro args to +// expand. +#define REGISTER_FST_WEIGHT__(Weight, line) \ + static WeightClassRegisterer weight_registerer##_##line( \ + Weight::Type(), StrToWeightImplBase) + +// This layer is where __FILE__ and __LINE__ are expanded. +#define REGISTER_FST_WEIGHT_EXPANDER(Weight, line) \ + REGISTER_FST_WEIGHT__(Weight, line) + +// Macro for registering new weight types; clients call this. +#define REGISTER_FST_WEIGHT(Weight) \ + REGISTER_FST_WEIGHT_EXPANDER(Weight, __LINE__) + +} // namespace script +} // namespace fst + +#endif // FST_SCRIPT_WEIGHT_CLASS_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/set-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/set-weight.h new file mode 100644 index 0000000..dd665f0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/set-weight.h @@ -0,0 +1,618 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Weights consisting of sets (of integral Labels) and +// associated semiring operation definitions using intersect +// and union. + +#ifndef FST_SET_WEIGHT_H_ +#define FST_SET_WEIGHT_H_ + +#include + +#include +#include +#include +#include + +#include +#include + + +namespace fst { + +constexpr int kSetEmpty = 0; // Label for the empty set. +constexpr int kSetUniv = -1; // Label for the universal set. +constexpr int kSetBad = -2; // Label for a non-set. +constexpr char kSetSeparator = '_'; // Label separator in sets. + +// Determines whether to use (intersect, union) or (union, intersect) +// as (+, *) for the semiring. SET_INTERSECT_UNION_RESTRICTED is a +// restricted version of (intersect, union) that requires summed +// arguments to be equal (or an error is signalled), useful for +// algorithms that require a unique labelled path weight. SET_BOOLEAN +// treats all non-Zero() elements as equivalent (with Zero() == +// UnivSet()), useful for algorithms that don't really depend on the +// detailed sets. +enum SetType { SET_INTERSECT_UNION = 0, + SET_UNION_INTERSECT = 1, + SET_INTERSECT_UNION_RESTRICT = 2, + SET_BOOLEAN = 3 }; + +template +class SetWeightIterator; + +// Set semiring of integral labels. +template +class SetWeight { + public: + using Label = Label_; + using ReverseWeight = SetWeight; + using Iterator = SetWeightIterator; + friend class SetWeightIterator; + // Allow type-converting copy and move constructors private access. + template + friend class SetWeight; + + SetWeight() {} + + // Input should be positive, sorted and unique. + template + SetWeight(const Iterator &begin, const Iterator &end) { + for (auto iter = begin; iter != end; ++iter) PushBack(*iter); + } + + // Input should be positive. (Non-positive value has + // special internal meaning w.r.t. integral constants above.) + explicit SetWeight(Label label) { PushBack(label); } + + template + explicit SetWeight(const SetWeight &w) + : first_(w.first_), rest_(w.rest_) {} + + template + explicit SetWeight(SetWeight &&w) + : first_(w.first_), rest_(std::move(w.rest_)) { w.Clear(); } + + template + SetWeight &operator=(const SetWeight &w) { + first_ = w.first_; + rest_ = w.rest_; + return *this; + } + + template + SetWeight &operator=(SetWeight &&w) { + first_ = w.first_; + rest_ = std::move(w.rest_); + w.Clear(); + return *this; + } + + static const SetWeight &Zero() { + return S == SET_UNION_INTERSECT ? EmptySet() : UnivSet(); + } + + static const SetWeight &One() { + return S == SET_UNION_INTERSECT ? UnivSet() : EmptySet(); + } + + static const SetWeight &NoWeight() { + static const auto *const no_weight = new SetWeight(Label(kSetBad)); + return *no_weight; + } + + static const string &Type() { + static const string *const type = new string( + S == SET_UNION_INTERSECT + ? "union_intersect_set" + : (S == SET_INTERSECT_UNION + ? "intersect_union_set" + : (S == SET_INTERSECT_UNION_RESTRICT + ? "restricted_set_intersect_union" + : "boolean_set"))); + return *type; + } + + bool Member() const; + + std::istream &Read(std::istream &strm); + + std::ostream &Write(std::ostream &strm) const; + + size_t Hash() const; + + SetWeight Quantize(float delta = kDelta) const { return *this; } + + ReverseWeight Reverse() const; + + static constexpr uint64 Properties() { + return kIdempotent | kLeftSemiring | kRightSemiring | kCommutative; + } + + // These operations combined with the SetWeightIterator + // provide the access and mutation of the set internal elements. + + // The empty set. + static const SetWeight &EmptySet() { + static const auto *const empty = new SetWeight(Label(kSetEmpty)); + return *empty; + } + + // The univeral set. + static const SetWeight &UnivSet() { + static const auto *const univ = new SetWeight(Label(kSetUniv)); + return *univ; + } + + // Clear existing SetWeight. + void Clear() { + first_ = kSetEmpty; + rest_.clear(); + } + + size_t Size() const { return first_ == kSetEmpty ? 0 : rest_.size() + 1; } + + Label Back() { + if (rest_.empty()) { + return first_; + } else { + return rest_.back(); + } + } + + // Caller must add in sort order and be unique (or error signalled). + // Input should also be positive. Non-positive value (for the first + // push) has special internal meaning w.r.t. integral constants above. + void PushBack(Label label) { + if (first_ == kSetEmpty) { + first_ = label; + } else { + if (label <= Back() || label <= 0) { + FSTERROR() << "SetWeight: labels must be positive, added" + << " in sort order and be unique."; + rest_.push_back(Label(kSetBad)); + } + rest_.push_back(label); + } + } + + private: + Label first_ = kSetEmpty; // First label in set (kSetEmpty if empty). + std::list &fst); +// +// // Required copy constructor that allows updating FST argument; +// // pass only if relevant and changed. +// StateMapper(const StateMapper &mapper, const Fst *fst = 0); +// +// // Specifies initial state of result. +// B::StateId Start() const; +// // Specifies state's final weight in result. +// B::Weight Final(B::StateId state) const; +// +// // These methods iterate through a state's arcs in result. +// +// // Specifies state to iterate over. +// void SetState(B::StateId state); +// +// // End of arcs? +// bool Done() const; +// +// // Current arc. +// const B &Value() const; +// +// // Advances to next arc (when !Done) +// void Next(); +// +// // Specifies input symbol table action the mapper requires (see above). +// MapSymbolsAction InputSymbolsAction() const; +// +// // Specifies output symbol table action the mapper requires (see above). +// MapSymbolsAction OutputSymbolsAction() const; +// +// // This specifies the known properties of an FST mapped by this +// // mapper. It takes as argument the input FST's known properties. +// uint64 Properties(uint64 props) const; +// }; +// +// We include a various state map versions below. One dimension of variation is +// whether the mapping mutates its input, writes to a new result FST, or is an +// on-the-fly Fst. Another dimension is how we pass the mapper. We allow passing +// the mapper by pointer for cases that we need to change the state of the +// user's mapper. We also include map versions that pass the mapper by value or +// const reference when this suffices. + +// Maps an arc type A using a mapper function object C, passed by pointer. This +// version modifies the input FST. +template +void StateMap(MutableFst *fst, C *mapper) { + if (mapper->InputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + fst->SetInputSymbols(nullptr); + } + if (mapper->OutputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + fst->SetOutputSymbols(nullptr); + } + if (fst->Start() == kNoStateId) return; + const auto props = fst->Properties(kFstProperties, false); + fst->SetStart(mapper->Start()); + for (StateIterator> siter(*fst); !siter.Done(); siter.Next()) { + const auto state = siter.Value(); + mapper->SetState(state); + fst->DeleteArcs(state); + for (; !mapper->Done(); mapper->Next()) { + fst->AddArc(state, mapper->Value()); + } + fst->SetFinal(state, mapper->Final(state)); + } + fst->SetProperties(mapper->Properties(props), kFstProperties); +} + +// Maps an arc type A using a mapper function object C, passed by value. +// This version modifies the input FST. +template +void StateMap(MutableFst *fst, C mapper) { + StateMap(fst, &mapper); +} + +// Maps an arc type A to an arc type B using mapper functor C, passed by +// pointer. This version writes to an output FST. +template +void StateMap(const Fst &ifst, MutableFst *ofst, C *mapper) { + ofst->DeleteStates(); + if (mapper->InputSymbolsAction() == MAP_COPY_SYMBOLS) { + ofst->SetInputSymbols(ifst.InputSymbols()); + } else if (mapper->InputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + ofst->SetInputSymbols(nullptr); + } + if (mapper->OutputSymbolsAction() == MAP_COPY_SYMBOLS) { + ofst->SetOutputSymbols(ifst.OutputSymbols()); + } else if (mapper->OutputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + ofst->SetOutputSymbols(nullptr); + } + const auto iprops = ifst.Properties(kCopyProperties, false); + if (ifst.Start() == kNoStateId) { + if (iprops & kError) ofst->SetProperties(kError, kError); + return; + } + // Adds all states. + if (ifst.Properties(kExpanded, false)) ofst->ReserveStates(CountStates(ifst)); + for (StateIterator> siter(ifst); !siter.Done(); siter.Next()) { + ofst->AddState(); + } + ofst->SetStart(mapper->Start()); + for (StateIterator> siter(ifst); !siter.Done(); siter.Next()) { + const auto state = siter.Value(); + mapper->SetState(state); + for (; !mapper->Done(); mapper->Next()) { + ofst->AddArc(state, mapper->Value()); + } + ofst->SetFinal(state, mapper->Final(state)); + } + const auto oprops = ofst->Properties(kFstProperties, false); + ofst->SetProperties(mapper->Properties(iprops) | oprops, kFstProperties); +} + +// Maps an arc type A to an arc type B using mapper functor object C, passed by +// value. This version writes to an output FST. +template +void StateMap(const Fst &ifst, MutableFst *ofst, C mapper) { + StateMap(ifst, ofst, &mapper); +} + +using StateMapFstOptions = CacheOptions; + +template +class StateMapFst; + +// Facade around StateIteratorBase inheriting from StateIteratorBase. +template +class StateMapStateIteratorBase : public StateIteratorBase { + public: + using Arc = B; + using StateId = typename Arc::StateId; + + explicit StateMapStateIteratorBase(StateIteratorBase *base) + : base_(base) {} + + bool Done() const final { return base_->Done(); } + + StateId Value() const final { return base_->Value(); } + + void Next() final { base_->Next(); } + + void Reset() final { base_->Reset(); } + + private: + std::unique_ptr> base_; + + StateMapStateIteratorBase() = delete; +}; + +namespace internal { + +// Implementation of delayed StateMapFst. +template +class StateMapFstImpl : public CacheImpl { + public: + using Arc = B; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + + using CacheImpl::PushArc; + using CacheImpl::HasArcs; + using CacheImpl::HasFinal; + using CacheImpl::HasStart; + using CacheImpl::SetArcs; + using CacheImpl::SetFinal; + using CacheImpl::SetStart; + + friend class StateIterator>; + + StateMapFstImpl(const Fst &fst, const C &mapper, + const StateMapFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + mapper_(new C(mapper, fst_.get())), + own_mapper_(true) { + Init(); + } + + StateMapFstImpl(const Fst &fst, C *mapper, const StateMapFstOptions &opts) + : CacheImpl(opts), + fst_(fst.Copy()), + mapper_(mapper), + own_mapper_(false) { + Init(); + } + + StateMapFstImpl(const StateMapFstImpl &impl) + : CacheImpl(impl), + fst_(impl.fst_->Copy(true)), + mapper_(new C(*impl.mapper_, fst_.get())), + own_mapper_(true) { + Init(); + } + + ~StateMapFstImpl() override { + if (own_mapper_) delete mapper_; + } + + StateId Start() { + if (!HasStart()) SetStart(mapper_->Start()); + return CacheImpl::Start(); + } + + Weight Final(StateId state) { + if (!HasFinal(state)) SetFinal(state, mapper_->Final(state)); + return CacheImpl::Final(state); + } + + size_t NumArcs(StateId state) { + if (!HasArcs(state)) Expand(state); + return CacheImpl::NumArcs(state); + } + + size_t NumInputEpsilons(StateId state) { + if (!HasArcs(state)) Expand(state); + return CacheImpl::NumInputEpsilons(state); + } + + size_t NumOutputEpsilons(StateId state) { + if (!HasArcs(state)) Expand(state); + return CacheImpl::NumOutputEpsilons(state); + } + + void InitStateIterator(StateIteratorData *datb) const { + StateIteratorData data; + fst_->InitStateIterator(&data); + datb->base = data.base ? new StateMapStateIteratorBase(data.base) + : nullptr; + datb->nstates = data.nstates; + } + + void InitArcIterator(StateId state, ArcIteratorData *data) { + if (!HasArcs(state)) Expand(state); + CacheImpl::InitArcIterator(state, data); + } + + uint64 Properties() const override { return Properties(kFstProperties); } + + uint64 Properties(uint64 mask) const override { + if ((mask & kError) && (fst_->Properties(kError, false) || + (mapper_->Properties(0) & kError))) { + SetProperties(kError, kError); + } + return FstImpl::Properties(mask); + } + + void Expand(StateId state) { + // Adds exiting arcs. + for (mapper_->SetState(state); !mapper_->Done(); mapper_->Next()) { + PushArc(state, mapper_->Value()); + } + SetArcs(state); + } + + const Fst *GetFst() const { return fst_.get(); } + + private: + void Init() { + SetType("statemap"); + if (mapper_->InputSymbolsAction() == MAP_COPY_SYMBOLS) { + SetInputSymbols(fst_->InputSymbols()); + } else if (mapper_->InputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + SetInputSymbols(nullptr); + } + if (mapper_->OutputSymbolsAction() == MAP_COPY_SYMBOLS) { + SetOutputSymbols(fst_->OutputSymbols()); + } else if (mapper_->OutputSymbolsAction() == MAP_CLEAR_SYMBOLS) { + SetOutputSymbols(nullptr); + } + const auto props = fst_->Properties(kCopyProperties, false); + SetProperties(mapper_->Properties(props)); + } + + std::unique_ptr> fst_; + C *mapper_; + bool own_mapper_; +}; + +} // namespace internal + +// Maps an arc type A to an arc type B using Mapper function object +// C. This version is a delayed FST. +template +class StateMapFst : public ImplToFst> { + public: + friend class ArcIterator>; + + using Arc = B; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using Store = DefaultCacheStore; + using State = typename Store::State; + using Impl = internal::StateMapFstImpl; + + StateMapFst(const Fst &fst, const C &mapper, + const StateMapFstOptions &opts) + : ImplToFst(std::make_shared(fst, mapper, opts)) {} + + StateMapFst(const Fst &fst, C *mapper, const StateMapFstOptions &opts) + : ImplToFst(std::make_shared(fst, mapper, opts)) {} + + StateMapFst(const Fst &fst, const C &mapper) + : ImplToFst( + std::make_shared(fst, mapper, StateMapFstOptions())) {} + + StateMapFst(const Fst &fst, C *mapper) + : ImplToFst( + std::make_shared(fst, mapper, StateMapFstOptions())) {} + + // See Fst<>::Copy() for doc. + StateMapFst(const StateMapFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Get a copy of this StateMapFst. See Fst<>::Copy() for further doc. + StateMapFst *Copy(bool safe = false) const override { + return new StateMapFst(*this, safe); + } + + void InitStateIterator(StateIteratorData *data) const override { + GetImpl()->InitStateIterator(data); + } + + void InitArcIterator(StateId state, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(state, data); + } + + protected: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + private: + StateMapFst &operator=(const StateMapFst &) = delete; +}; + +// Specialization for StateMapFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename A::StateId; + + ArcIterator(const StateMapFst &fst, StateId state) + : CacheArcIterator>(fst.GetMutableImpl(), state) { + if (!fst.GetImpl()->HasArcs(state)) fst.GetMutableImpl()->Expand(state); + } +}; + +// Utility mappers. + +// Mapper that returns its input. +template +class IdentityStateMapper { + public: + using FromArc = Arc; + using ToArc = Arc; + + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit IdentityStateMapper(const Fst &fst) : fst_(fst) {} + + // Allows updating FST argument; pass only if changed. + IdentityStateMapper(const IdentityStateMapper &mapper, + const Fst *fst = nullptr) + : fst_(fst ? *fst : mapper.fst_) {} + + StateId Start() const { return fst_.Start(); } + + Weight Final(StateId state) const { return fst_.Final(state); } + + void SetState(StateId state) { + aiter_.reset(new ArcIterator>(fst_, state)); + } + + bool Done() const { return aiter_->Done(); } + + const Arc &Value() const { return aiter_->Value(); } + + void Next() { aiter_->Next(); } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + uint64 Properties(uint64 props) const { return props; } + + private: + const Fst &fst_; + std::unique_ptr>> aiter_; +}; + +template +class ArcSumMapper { + public: + using FromArc = Arc; + using ToArc = Arc; + + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit ArcSumMapper(const Fst &fst) : fst_(fst), i_(0) {} + + // Allows updating FST argument; pass only if changed. + ArcSumMapper(const ArcSumMapper &mapper, const Fst *fst = nullptr) + : fst_(fst ? *fst : mapper.fst_), i_(0) {} + + StateId Start() const { return fst_.Start(); } + + Weight Final(StateId state) const { return fst_.Final(state); } + + void SetState(StateId state) { + i_ = 0; + arcs_.clear(); + arcs_.reserve(fst_.NumArcs(state)); + for (ArcIterator> aiter(fst_, state); !aiter.Done(); + aiter.Next()) { + arcs_.push_back(aiter.Value()); + } + // First sorts the exiting arcs by input label, output label and destination + // state and then sums weights of arcs with the same input label, output + // label, and destination state. + std::sort(arcs_.begin(), arcs_.end(), comp_); + size_t narcs = 0; + for (const auto &arc : arcs_) { + if (narcs > 0 && equal_(arc, arcs_[narcs - 1])) { + arcs_[narcs - 1].weight = Plus(arcs_[narcs - 1].weight, arc.weight); + } else { + arcs_[narcs] = arc; + ++narcs; + } + } + arcs_.resize(narcs); + } + + bool Done() const { return i_ >= arcs_.size(); } + + const Arc &Value() const { return arcs_[i_]; } + + void Next() { ++i_; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + uint64 Properties(uint64 props) const { + return props & kArcSortProperties & kDeleteArcsProperties & + kWeightInvariantProperties; + } + + private: + struct Compare { + bool operator()(const Arc &x, const Arc &y) const { + if (x.ilabel < y.ilabel) return true; + if (x.ilabel > y.ilabel) return false; + if (x.olabel < y.olabel) return true; + if (x.olabel > y.olabel) return false; + if (x.nextstate < y.nextstate) return true; + if (x.nextstate > y.nextstate) return false; + return false; + } + }; + + struct Equal { + bool operator()(const Arc &x, const Arc &y) const { + return (x.ilabel == y.ilabel && x.olabel == y.olabel && + x.nextstate == y.nextstate); + } + }; + + const Fst &fst_; + Compare comp_; + Equal equal_; + std::vector arcs_; + ssize_t i_; // Current arc position. + + ArcSumMapper &operator=(const ArcSumMapper &) = delete; +}; + +template +class ArcUniqueMapper { + public: + using FromArc = Arc; + using ToArc = Arc; + + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + explicit ArcUniqueMapper(const Fst &fst) : fst_(fst), i_(0) {} + + // Allows updating FST argument; pass only if changed. + ArcUniqueMapper(const ArcUniqueMapper &mapper, + const Fst *fst = nullptr) + : fst_(fst ? *fst : mapper.fst_), i_(0) {} + + StateId Start() const { return fst_.Start(); } + + Weight Final(StateId state) const { return fst_.Final(state); } + + void SetState(StateId state) { + i_ = 0; + arcs_.clear(); + arcs_.reserve(fst_.NumArcs(state)); + for (ArcIterator> aiter(fst_, state); !aiter.Done(); + aiter.Next()) { + arcs_.push_back(aiter.Value()); + } + // First sorts the exiting arcs by input label, output label and destination + // state and then uniques identical arcs. + std::sort(arcs_.begin(), arcs_.end(), comp_); + arcs_.erase(std::unique(arcs_.begin(), arcs_.end(), equal_), arcs_.end()); + } + + bool Done() const { return i_ >= arcs_.size(); } + + const Arc &Value() const { return arcs_[i_]; } + + void Next() { ++i_; } + + constexpr MapSymbolsAction InputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + constexpr MapSymbolsAction OutputSymbolsAction() const { + return MAP_COPY_SYMBOLS; + } + + uint64 Properties(uint64 props) const { + return props & kArcSortProperties & kDeleteArcsProperties; + } + + private: + struct Compare { + bool operator()(const Arc &x, const Arc &y) const { + if (x.ilabel < y.ilabel) return true; + if (x.ilabel > y.ilabel) return false; + if (x.olabel < y.olabel) return true; + if (x.olabel > y.olabel) return false; + if (x.nextstate < y.nextstate) return true; + if (x.nextstate > y.nextstate) return false; + return false; + } + }; + + struct Equal { + bool operator()(const Arc &x, const Arc &y) const { + return (x.ilabel == y.ilabel && x.olabel == y.olabel && + x.nextstate == y.nextstate && x.weight == y.weight); + } + }; + + const Fst &fst_; + Compare comp_; + Equal equal_; + std::vector arcs_; + size_t i_; // Current arc position. + + ArcUniqueMapper &operator=(const ArcUniqueMapper &) = delete; +}; + +// Useful aliases when using StdArc. + +using StdArcSumMapper = ArcSumMapper; + +using StdArcUniqueMapper = ArcUniqueMapper; + +} // namespace fst + +#endif // FST_STATE_MAP_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/state-reachable.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/state-reachable.h new file mode 100644 index 0000000..36b5559 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/state-reachable.h @@ -0,0 +1,224 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Class to determine whether a given (final) state can be reached from some +// other given state. + +#ifndef FST_STATE_REACHABLE_H_ +#define FST_STATE_REACHABLE_H_ + +#include + +#include + +#include +#include +#include +#include +#include + + +namespace fst { + +// Computes the (final) states reachable from a given state in an FST. After +// this visitor has been called, a final state f can be reached from a state +// s iff (*isets)[s].Member(state2index[f]) is true, where (*isets[s]) is a +// set of half-open inteval of final state indices and state2index[f] maps from +// a final state to its index. If state2index is empty, it is filled-in with +// suitable indices. If it is non-empty, those indices are used; in this case, +// the final states must have out-degree 0. +template > +class IntervalReachVisitor { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Index = I; + using ISet = S; + using Interval = typename ISet::Interval; + + IntervalReachVisitor(const Fst &fst, std::vector *isets, + std::vector *state2index) + : fst_(fst), + isets_(isets), + state2index_(state2index), + index_(state2index->empty() ? 1 : -1), + error_(false) { + isets_->clear(); + } + + void InitVisit(const Fst &) { error_ = false; } + + bool InitState(StateId s, StateId r) { + while (isets_->size() <= s) isets_->push_back(S()); + while (state2index_->size() <= s) state2index_->push_back(-1); + if (fst_.Final(s) != Weight::Zero()) { + // Create tree interval. + auto *intervals = (*isets_)[s].MutableIntervals(); + if (index_ < 0) { // Uses state2index_ map to set index. + if (fst_.NumArcs(s) > 0) { + FSTERROR() << "IntervalReachVisitor: state2index map must be empty " + << "for this FST"; + error_ = true; + return false; + } + const auto index = (*state2index_)[s]; + if (index < 0) { + FSTERROR() << "IntervalReachVisitor: state2index map incomplete"; + error_ = true; + return false; + } + intervals->push_back(Interval(index, index + 1)); + } else { // Use pre-order index. + intervals->push_back(Interval(index_, index_ + 1)); + (*state2index_)[s] = index_++; + } + } + return true; + } + + constexpr bool TreeArc(StateId, const Arc &) const { return true; } + + bool BackArc(StateId s, const Arc &arc) { + FSTERROR() << "IntervalReachVisitor: Cyclic input"; + error_ = true; + return false; + } + + bool ForwardOrCrossArc(StateId s, const Arc &arc) { + // Non-tree interval. + (*isets_)[s].Union((*isets_)[arc.nextstate]); + return true; + } + + void FinishState(StateId s, StateId p, const Arc *) { + if (index_ >= 0 && fst_.Final(s) != Weight::Zero()) { + auto *intervals = (*isets_)[s].MutableIntervals(); + (*intervals)[0].end = index_; // Updates tree interval end. + } + (*isets_)[s].Normalize(); + if (p != kNoStateId) { + (*isets_)[p].Union((*isets_)[s]); // Propagates intervals to parent. + } + } + + void FinishVisit() {} + + bool Error() const { return error_; } + + private: + const Fst &fst_; + std::vector *isets_; + std::vector *state2index_; + Index index_; + bool error_; +}; + +// Tests reachability of final states from a given state. To test for +// reachability from a state s, first do SetState(s). Then a final state f can +// be reached from state s of FST iff Reach(f) is true. The input can be cyclic, +// but no cycle may contain a final state. +template > +class StateReachable { + public: + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using Index = I; + using ISet = S; + using Interval = typename ISet::Interval; + + explicit StateReachable(const Fst &fst) : error_(false) { + if (fst.Properties(kAcyclic, true)) { + AcyclicStateReachable(fst); + } else { + CyclicStateReachable(fst); + } + } + + explicit StateReachable(const StateReachable &reachable) { + FSTERROR() << "Copy constructor for state reachable class " + << "not implemented."; + error_ = true; + } + + // Sets current state. + void SetState(StateId s) { s_ = s; } + + // Can reach this final state from current state? + bool Reach(StateId s) { + if (s >= state2index_.size()) return false; + const auto i = state2index_[s]; + if (i < 0) { + FSTERROR() << "StateReachable: State non-final: " << s; + error_ = true; + return false; + } + return isets_[s_].Member(i); + } + + // Access to the state-to-index mapping. Unassigned states have index -1. + std::vector &State2Index() { return state2index_; } + + // Access to the interval sets. These specify the reachability to the final + // states as intervals of the final state indices. + const std::vector &IntervalSets() { return isets_; } + + bool Error() const { return error_; } + + private: + void AcyclicStateReachable(const Fst &fst) { + IntervalReachVisitor reach_visitor(fst, &isets_, + &state2index_); + DfsVisit(fst, &reach_visitor); + if (reach_visitor.Error()) error_ = true; + } + + void CyclicStateReachable(const Fst &fst) { + // Finds state reachability on the acyclic condensation FST. + VectorFst cfst; + std::vector scc; + Condense(fst, &cfst, &scc); + StateReachable reachable(cfst); + if (reachable.Error()) { + error_ = true; + return; + } + // Gets the number of states per SCC. + std::vector nscc; + for (StateId s = 0; s < scc.size(); ++s) { + const auto c = scc[s]; + while (c >= nscc.size()) nscc.push_back(0); + ++nscc[c]; + } + // Constructs the interval sets and state index mapping for the original + // FST from the condensation FST. + state2index_.resize(scc.size(), -1); + isets_.resize(scc.size()); + for (StateId s = 0; s < scc.size(); ++s) { + const auto c = scc[s]; + isets_[s] = reachable.IntervalSets()[c]; + state2index_[s] = reachable.State2Index()[c]; + // Checks that each final state in an input FST is not contained in a + // cycle (i.e., not in a non-trivial SCC). + if (cfst.Final(c) != Weight::Zero() && nscc[c] > 1) { + FSTERROR() << "StateReachable: Final state contained in a cycle"; + error_ = true; + return; + } + } + } + + StateId s_; // Current state. + std::vector isets_; // Interval sets per state. + std::vector state2index_; // Finds index for a final state. + bool error_; + + StateReachable &operator=(const StateReachable &) = delete; +}; + +} // namespace fst + +#endif // FST_STATE_REACHABLE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/state-table.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/state-table.h new file mode 100644 index 0000000..a506759 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/state-table.h @@ -0,0 +1,494 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes for representing the mapping between state tuples and state IDs. + +#ifndef FST_STATE_TABLE_H_ +#define FST_STATE_TABLE_H_ + +#include +#include +#include + +#include + +#include +#include +#include + + +namespace fst { + +// State tables determine the bijective mapping between state tuples (e.g., in +// composition, triples of two FST states and a composition filter state) and +// their corresponding state IDs. They are classes, templated on state tuples, +// with the following interface: +// +// template +// class StateTable { +// public: +// using StateTuple = T; +// +// // Required constructors. +// StateTable(); +// +// StateTable(const StateTable &); +// +// // Looks up state ID by tuple. If it doesn't exist, then add it. +// StateId FindState(const StateTuple &tuple); +// +// // Looks up state tuple by state ID. +// const StateTuple &Tuple(StateId s) const; +// +// // # of stored tuples. +// StateId Size() const; +// }; +// +// A state tuple has the form: +// +// template +// struct StateTuple { +// using StateId = S; +// +// // Required constructors. +// +// StateTuple(); +// +// StateTuple(const StateTuple &tuple); +// }; + +// An implementation using a hash map for the tuple to state ID mapping. The +// state tuple T must support operator==. +template +class HashStateTable : public HashBiTable { + public: + using StateTuple = T; + using StateId = typename StateTuple::StateId; + + using HashBiTable::FindId; + using HashBiTable::FindEntry; + using HashBiTable::Size; + + HashStateTable() : HashBiTable() {} + + explicit HashStateTable(size_t table_size) + : HashBiTable(table_size) {} + + StateId FindState(const StateTuple &tuple) { return FindId(tuple); } + + const StateTuple &Tuple(StateId s) const { return FindEntry(s); } +}; + +// An implementation using a hash map for the tuple to state ID mapping. The +// state tuple T must support operator==. +template +class CompactHashStateTable + : public CompactHashBiTable { + public: + using StateTuple = T; + using StateId = typename StateTuple::StateId; + + using CompactHashBiTable::FindId; + using CompactHashBiTable::FindEntry; + using CompactHashBiTable::Size; + + CompactHashStateTable() : CompactHashBiTable() {} + + explicit CompactHashStateTable(size_t table_size) + : CompactHashBiTable(table_size) {} + + StateId FindState(const StateTuple &tuple) { return FindId(tuple); } + + const StateTuple &Tuple(StateId s) const { return FindEntry(s); } +}; + +// An implementation using a vector for the tuple to state mapping. It is +// passed a fingerprint functor that should fingerprint tuples uniquely to an +// integer that can used as a vector index. Normally, VectorStateTable +// constructs the fingerprint functor. Alternately, the user can pass this +// object, in which case the table takes ownership. +template +class VectorStateTable : public VectorBiTable { + public: + using StateTuple = T; + using StateId = typename StateTuple::StateId; + + using VectorBiTable::FindId; + using VectorBiTable::FindEntry; + using VectorBiTable::Size; + using VectorBiTable::Fingerprint; + + explicit VectorStateTable(FP *fingerprint = nullptr, size_t table_size = 0) + : VectorBiTable(fingerprint, table_size) {} + + StateId FindState(const StateTuple &tuple) { return FindId(tuple); } + + const StateTuple &Tuple(StateId s) const { return FindEntry(s); } +}; + +// An implementation using a vector and a compact hash table. The selection +// functor returns true for tuples to be hashed in the vector. The fingerprint +// functor should fingerprint tuples uniquely to an integer that can be used as +// a vector index. A hash functor is used when hashing tuples into the compact +// hash table. +template +class VectorHashStateTable + : public VectorHashBiTable { + public: + using StateTuple = T; + using StateId = typename StateTuple::StateId; + + using VectorHashBiTable::FindId; + using VectorHashBiTable::FindEntry; + using VectorHashBiTable::Size; + using VectorHashBiTable::Selector; + using VectorHashBiTable::Fingerprint; + using VectorHashBiTable::Hash; + + VectorHashStateTable(Select *select, FP *fingerprint, H *hash, + size_t vector_size = 0, size_t tuple_size = 0) + : VectorHashBiTable( + select, fingerprint, hash, vector_size, tuple_size) {} + + StateId FindState(const StateTuple &tuple) { return FindId(tuple); } + + const StateTuple &Tuple(StateId s) const { return FindEntry(s); } +}; + +// An implementation using a hash map to map from tuples to state IDs. This +// version permits erasing of states. The state tuple's default constructor +// must produce a tuple that will never be seen and the table must suppor +// operator==. +template +class ErasableStateTable : public ErasableBiTable { + public: + using StateTuple = T; + using StateId = typename StateTuple::StateId; + + using ErasableBiTable::FindId; + using ErasableBiTable::FindEntry; + using ErasableBiTable::Size; + using ErasableBiTable::Erase; + + ErasableStateTable() : ErasableBiTable() {} + + StateId FindState(const StateTuple &tuple) { return FindId(tuple); } + + const StateTuple &Tuple(StateId s) const { return FindEntry(s); } +}; + +// The composition state table has the form: +// +// template +// class ComposeStateTable { +// public: +// using StateId = typename Arc::StateId; +// +// // Required constructors. +// +// ComposeStateTable(const Fst &fst1, const Fst &fst2); +// ComposeStateTable(const ComposeStateTable &table); +// +// // Looks up a state ID by tuple, adding it if doesn't exist. +// StateId FindState(const StateTuple &tuple); +// +// // Looks up a tuple by state ID. +// const ComposeStateTuple &Tuple(StateId s) const; +// +// // The number of of stored tuples. +// StateId Size() const; +// +// // Return true if error was encountered. +// bool Error() const; +// }; +// +// The following interface is used to represent the composition state. +// +// template +// class CompositionStateTuple { +// public: +// using StateId = typename StateId; +// using FS = FilterState; +// +// // Required constructors. +// StateTuple(); +// StateTuple(StateId s1, StateId s2, const FilterState &fs); +// +// StateId StateId1() const; +// StateId StateId2() const; +// +// FilterState GetFilterState() const; +// +// std::pair StatePair() const; +// +// size_t Hash() const; +// +// friend bool operator==(const StateTuple& x, const StateTuple &y); +// } +// +template +class DefaultComposeStateTuple { + public: + using StateId = S; + using FilterState = FS; + + DefaultComposeStateTuple() + : state_pair_(kNoStateId, kNoStateId), fs_(FilterState::NoState()) {} + + DefaultComposeStateTuple(StateId s1, StateId s2, const FilterState &fs) + : state_pair_(s1, s2), fs_(fs) {} + + StateId StateId1() const { return state_pair_.first; } + + StateId StateId2() const { return state_pair_.second; } + + FilterState GetFilterState() const { return fs_; } + + const std::pair &StatePair() const { return state_pair_; } + + friend bool operator==(const DefaultComposeStateTuple &x, + const DefaultComposeStateTuple &y) { + return (&x == &y) || (x.state_pair_ == y.state_pair_ && x.fs_ == y.fs_); + } + + size_t Hash() const { + return static_cast(StateId1()) + + static_cast(StateId2()) * 7853u + + GetFilterState().Hash() * 7867u; + } + + private: + std::pair state_pair_; + FilterState fs_; // State of composition filter. +}; + +// Specialization for TrivialFilterState that does not explicitely store the +// filter state since it is always the unique non-blocking state. +template +class DefaultComposeStateTuple { + public: + using StateId = S; + using FilterState = TrivialFilterState; + + DefaultComposeStateTuple() + : state_pair_(kNoStateId, kNoStateId) {} + + DefaultComposeStateTuple(StateId s1, StateId s2, const FilterState &) + : state_pair_(s1, s2) {} + + StateId StateId1() const { return state_pair_.first; } + + StateId StateId2() const { return state_pair_.second; } + + FilterState GetFilterState() const { return FilterState(true); } + + const std::pair &StatePair() const { return state_pair_; } + + friend bool operator==(const DefaultComposeStateTuple &x, + const DefaultComposeStateTuple &y) { + return (&x == &y) || (x.state_pair_ == y.state_pair_); + } + + size_t Hash() const { return StateId1() + StateId2() * 7853; } + + private: + std::pair state_pair_; +}; + +// Hashing of composition state tuples. +template +class ComposeHash { + public: + size_t operator()(const T &t) const { return t.Hash(); } +}; + +// A HashStateTable over composition tuples. +template , + typename StateTable = + CompactHashStateTable>> +class GenericComposeStateTable : public StateTable { + public: + using StateId = typename Arc::StateId; + + GenericComposeStateTable(const Fst &fst1, const Fst &fst2) {} + + GenericComposeStateTable(const Fst &fst1, const Fst &fst2, + size_t table_size) + : StateTable(table_size) {} + + constexpr bool Error() const { return false; } + + private: + GenericComposeStateTable &operator=(const GenericComposeStateTable &table) = + delete; +}; + +// Fingerprint for general composition tuples. +template +class ComposeFingerprint { + public: + using StateId = typename StateTuple::StateId; + + // Required but suboptimal constructor. + ComposeFingerprint() : mult1_(8192), mult2_(8192) { + LOG(WARNING) << "TupleFingerprint: # of FST states should be provided."; + } + + // Constructor is provided the sizes of the input FSTs. + ComposeFingerprint(StateId nstates1, StateId nstates2) + : mult1_(nstates1), mult2_(nstates1 * nstates2) {} + + size_t operator()(const StateTuple &tuple) { + return tuple.StateId1() + tuple.StateId2() * mult1_ + + tuple.GetFilterState().Hash() * mult2_; + } + + private: + const ssize_t mult1_; + const ssize_t mult2_; +}; + +// Useful when the first composition state determines the tuple. +template +class ComposeState1Fingerprint { + public: + size_t operator()(const StateTuple &tuple) { return tuple.StateId1(); } +}; + +// Useful when the second composition state determines the tuple. +template +class ComposeState2Fingerprint { + public: + size_t operator()(const StateTuple &tuple) { return tuple.StateId2(); } +}; + +// A VectorStateTable over composition tuples. This can be used when the +// product of number of states in FST1 and FST2 (and the composition filter +// state hash) is manageable. If the FSTs are not expanded FSTs, they will +// first have their states counted. +template +class ProductComposeStateTable + : public VectorStateTable> { + public: + using StateId = typename Arc::StateId; + using StateTable = + VectorStateTable>; + + ProductComposeStateTable(const Fst &fst1, const Fst &fst2, + size_t table_size = 0) + : StateTable(new ComposeFingerprint(CountStates(fst1), + CountStates(fst2)), + table_size) {} + + ProductComposeStateTable( + const ProductComposeStateTable &table) + : StateTable(new ComposeFingerprint(table.Fingerprint())) {} + + constexpr bool Error() const { return false; } + + private: + ProductComposeStateTable &operator=(const ProductComposeStateTable &table) = + delete; +}; + +// A vector-backed table over composition tuples which can be used when the +// first FST is a string (i.e., satisfies kString property) and the second is +// deterministic and epsilon-free. It should be used with a composition filter +// that creates at most one filter state per tuple under these conditions (e.g., +// SequenceComposeFilter or MatchComposeFilter). +template +class StringDetComposeStateTable + : public VectorStateTable> { + public: + using StateId = typename Arc::StateId; + using StateTable = + VectorStateTable>; + + StringDetComposeStateTable(const Fst &fst1, const Fst &fst2) + : error_(false) { + static constexpr auto props2 = kIDeterministic | kNoIEpsilons; + if (fst1.Properties(kString, true) != kString) { + FSTERROR() << "StringDetComposeStateTable: 1st FST is not a string"; + error_ = true; + } else if (fst2.Properties(props2, true) != props2) { + FSTERROR() << "StringDetComposeStateTable: 2nd FST is not deterministic " + "and epsilon-free"; + error_ = true; + } + } + + StringDetComposeStateTable( + const StringDetComposeStateTable &table) + : StateTable(table), error_(table.error_) {} + + bool Error() const { return error_; } + + private: + bool error_; + + StringDetComposeStateTable &operator=(const StringDetComposeStateTable &) = + delete; +}; + +// A vector-backed table over composition tuples which can be used when the +// first FST is deterministic and epsilon-free and the second is a string (i.e., +// satisfies kString). It should be used with a composition filter that creates +// at most one filter state per tuple under these conditions (e.g., +// SequenceComposeFilter or MatchComposeFilter). +template +class DetStringComposeStateTable + : public VectorStateTable> { + public: + using StateId = typename Arc::StateId; + using StateTable = + VectorStateTable>; + + DetStringComposeStateTable(const Fst &fst1, const Fst &fst2) + : error_(false) { + static constexpr auto props = kODeterministic | kNoOEpsilons; + if (fst1.Properties(props, true) != props) { + FSTERROR() << "StringDetComposeStateTable: 1st FST is not " + << "input-deterministic and epsilon-free"; + error_ = true; + } else if (fst2.Properties(kString, true) != kString) { + FSTERROR() << "DetStringComposeStateTable: 2nd FST is not a string"; + error_ = true; + } + } + + DetStringComposeStateTable( + const DetStringComposeStateTable &table) + : StateTable(table), error_(table.error_) {} + + bool Error() const { return error_; } + + private: + bool error_; + + DetStringComposeStateTable &operator=(const DetStringComposeStateTable &) = + delete; +}; + +// An erasable table over composition tuples. The Erase(StateId) method can be +// called if the user either is sure that composition will never return to that +// tuple or doesn't care that if it does, it is assigned a new state ID. +template +class ErasableComposeStateTable + : public ErasableStateTable> { + public: + ErasableComposeStateTable(const Fst &fst1, const Fst &fst2) {} + + constexpr bool Error() const { return false; } + + private: + ErasableComposeStateTable &operator=(const ErasableComposeStateTable &table) = + delete; +}; + +} // namespace fst + +#endif // FST_STATE_TABLE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/statesort.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/statesort.h new file mode 100644 index 0000000..346c7d3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/statesort.h @@ -0,0 +1,74 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function to sort states of an FST. + +#ifndef FST_STATESORT_H_ +#define FST_STATESORT_H_ + +#include +#include + +#include + +#include + + +namespace fst { + +// Sorts the input states of an FST. order[i] gives the the state ID after +// sorting that corresponds to the state ID i before sorting; it must +// therefore be a permutation of the input FST's states ID sequence. +template +void StateSort(MutableFst *fst, + const std::vector &order) { + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + if (order.size() != fst->NumStates()) { + FSTERROR() << "StateSort: Bad order vector size: " << order.size(); + fst->SetProperties(kError, kError); + return; + } + if (fst->Start() == kNoStateId) return; + const auto props = fst->Properties(kStateSortProperties, false); + std::vector done(order.size(), false); + std::vector arcsa; + std::vector arcsb; + fst->SetStart(order[fst->Start()]); + for (StateIterator> siter(*fst); !siter.Done(); + siter.Next()) { + auto s1 = siter.Value(); + StateId s2; + if (done[s1]) continue; + auto final1 = fst->Final(s1); + auto final2 = Weight::Zero(); + arcsa.clear(); + for (ArcIterator> aiter(*fst, s1); !aiter.Done(); + aiter.Next()) { + arcsa.push_back(aiter.Value()); + } + for (; !done[s1]; s1 = s2, final1 = final2, std::swap(arcsa, arcsb)) { + s2 = order[s1]; + if (!done[s2]) { + final2 = fst->Final(s2); + arcsb.clear(); + for (ArcIterator> aiter(*fst, s2); !aiter.Done(); + aiter.Next()) { + arcsb.push_back(aiter.Value()); + } + } + fst->SetFinal(s2, final1); + fst->DeleteArcs(s2); + for (auto arc : arcsa) { // Copy intended. + arc.nextstate = order[arc.nextstate]; + fst->AddArc(s2, arc); + } + done[s1] = true; + } + } + fst->SetProperties(props, kFstProperties); +} + +} // namespace fst + +#endif // FST_STATESORT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/string-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/string-weight.h new file mode 100644 index 0000000..fb3e70f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/string-weight.h @@ -0,0 +1,807 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// String weight set and associated semiring operation definitions. + +#ifndef FST_STRING_WEIGHT_H_ +#define FST_STRING_WEIGHT_H_ + +#include + +#include +#include +#include + +#include +#include +#include + + +namespace fst { + +constexpr int kStringInfinity = -1; // Label for the infinite string. +constexpr int kStringBad = -2; // Label for a non-string. +constexpr char kStringSeparator = '_'; // Label separator in strings. + +// Determines whether to use left or right string semiring. Includes a +// 'restricted' version that signals an error if proper prefixes/suffixes +// would otherwise be returned by Plus, useful with various +// algorithms that require functional transducer input with the +// string semirings. +enum StringType { STRING_LEFT = 0, STRING_RIGHT = 1, STRING_RESTRICT = 2 }; + +constexpr StringType ReverseStringType(StringType s) { + return s == STRING_LEFT ? STRING_RIGHT + : (s == STRING_RIGHT ? STRING_LEFT : STRING_RESTRICT); +} + +template +class StringWeightIterator; +template +class StringWeightReverseIterator; + +// String semiring: (longest_common_prefix/suffix, ., Infinity, Epsilon) +template +class StringWeight { + public: + using Label = Label_; + using ReverseWeight = StringWeight; + using Iterator = StringWeightIterator; + using ReverseIterator = StringWeightReverseIterator; + + friend class StringWeightIterator; + friend class StringWeightReverseIterator; + + StringWeight() {} + + template + StringWeight(const Iterator &begin, const Iterator &end) { + for (auto iter = begin; iter != end; ++iter) PushBack(*iter); + } + + explicit StringWeight(Label label) { PushBack(label); } + + static const StringWeight &Zero() { + static const auto *const zero = new StringWeight(Label(kStringInfinity)); + return *zero; + } + + static const StringWeight &One() { + static const auto *const one = new StringWeight(); + return *one; + } + + static const StringWeight &NoWeight() { + static const auto *const no_weight = new StringWeight(Label(kStringBad)); + return *no_weight; + } + + static const string &Type() { + static const string *const type = new string( + S == STRING_LEFT + ? "left_string" + : (S == STRING_RIGHT ? "right_string" : "restricted_string")); + return *type; + } + + bool Member() const; + + std::istream &Read(std::istream &strm); + + std::ostream &Write(std::ostream &strm) const; + + size_t Hash() const; + + StringWeight Quantize(float delta = kDelta) const { return *this; } + + ReverseWeight Reverse() const; + + static constexpr uint64 Properties() { + return kIdempotent | + (S == STRING_LEFT ? kLeftSemiring + : (S == STRING_RIGHT + ? kRightSemiring + : /* S == STRING_RESTRICT */ kLeftSemiring | + kRightSemiring)); + } + + // These operations combined with the StringWeightIterator and + // StringWeightReverseIterator provide the access and mutation of the string + // internal elements. + + // Clear existing StringWeight. + void Clear() { + first_ = 0; + rest_.clear(); + } + + size_t Size() const { return first_ ? rest_.size() + 1 : 0; } + + void PushFront(Label label) { + if (first_) rest_.push_front(first_); + first_ = label; + } + + void PushBack(Label label) { + if (!first_) { + first_ = label; + } else { + rest_.push_back(label); + } + } + + private: + Label first_ = 0; // First label in string (0 if empty). + std::list; + + friend class ArcIterator>; + friend class StateIterator>; + + explicit SynchronizeFst( + const Fst &fst, + const SynchronizeFstOptions &opts = SynchronizeFstOptions()) + : ImplToFst(std::make_shared(fst, opts)) {} + + // See Fst<>::Copy() for doc. + SynchronizeFst(const SynchronizeFst &fst, bool safe = false) + : ImplToFst(fst, safe) {} + + // Gets a copy of this SynchronizeFst. See Fst<>::Copy() for further doc. + SynchronizeFst *Copy(bool safe = false) const override { + return new SynchronizeFst(*this, safe); + } + + inline void InitStateIterator(StateIteratorData *data) const override; + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetMutableImpl()->InitArcIterator(s, data); + } + + private: + using ImplToFst::GetImpl; + using ImplToFst::GetMutableImpl; + + SynchronizeFst &operator=(const SynchronizeFst &) = delete; +}; + +// Specialization for SynchronizeFst. +template +class StateIterator> + : public CacheStateIterator> { + public: + explicit StateIterator(const SynchronizeFst &fst) + : CacheStateIterator>(fst, fst.GetMutableImpl()) {} +}; + +// Specialization for SynchronizeFst. +template +class ArcIterator> + : public CacheArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const SynchronizeFst &fst, StateId s) + : CacheArcIterator>(fst.GetMutableImpl(), s) { + if (!fst.GetImpl()->HasArcs(s)) fst.GetMutableImpl()->Expand(s); + } +}; + +template +inline void SynchronizeFst::InitStateIterator( + StateIteratorData *data) const { + data->base = new StateIterator>(*this); +} + +// Synchronizes a transducer. This version writes the synchronized result to a +// MutableFst. The result will be an equivalent FST that has the property that +// during the traversal of a path, the delay is either zero or strictly +// increasing, where the delay is the difference between the number of +// non-epsilon output labels and input labels along the path. +// +// For the algorithm to terminate, the input transducer must have bounded +// delay, i.e., the delay of every cycle must be zero. +// +// Complexity: +// +// - A has bounded delay: exponential. +// - A does not have bounded delay: does not terminate. +// +// For more information, see: +// +// Mohri, M. 2003. Edit-distance of weighted automata: General definitions and +// algorithms. International Journal of Computer Science 14(6): 957-982. +template +void Synchronize(const Fst &ifst, MutableFst *ofst) { + // Caches only the last state for fastest copy. + const SynchronizeFstOptions opts(FLAGS_fst_default_cache_gc, 0); + *ofst = SynchronizeFst(ifst, opts); +} + +} // namespace fst + +#endif // FST_SYNCHRONIZE_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/test-properties.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/test-properties.h new file mode 100644 index 0000000..677ed01 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/test-properties.h @@ -0,0 +1,246 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions to manipulate and test property bits. + +#ifndef FST_TEST_PROPERTIES_H_ +#define FST_TEST_PROPERTIES_H_ + +#include + +#include +#include + +#include +#include + + +DECLARE_bool(fst_verify_properties); + +namespace fst { +// namespace internal { + +// For a binary property, the bit is always returned set. For a trinary (i.e., +// two-bit) property, both bits are returned set iff either corresponding input +// bit is set. +inline uint64 KnownProperties(uint64 props) { + return kBinaryProperties | (props & kTrinaryProperties) | + ((props & kPosTrinaryProperties) << 1) | + ((props & kNegTrinaryProperties) >> 1); +} + +// Tests compatibility between two sets of properties. +inline bool CompatProperties(uint64 props1, uint64 props2) { + const auto known_props1 = KnownProperties(props1); + const auto known_props2 = KnownProperties(props2); + const auto known_props = known_props1 & known_props2; + const auto incompat_props = (props1 & known_props) ^ (props2 & known_props); + if (incompat_props) { + uint64 prop = 1; + for (int i = 0; i < 64; ++i, prop <<= 1) { + if (prop & incompat_props) { + LOG(ERROR) << "CompatProperties: Mismatch: " << PropertyNames[i] + << ": props1 = " << (props1 & prop ? "true" : "false") + << ", props2 = " << (props2 & prop ? "true" : "false"); + } + } + return false; + } else { + return true; + } +} + +// Computes FST property values defined in properties.h. The value of each +// property indicated in the mask will be determined and returned (these will +// never be unknown here). In the course of determining the properties +// specifically requested in the mask, certain other properties may be +// determined (those with little additional expense) and their values will be +// returned as well. The complete set of known properties (whether true or +// false) determined by this operation will be assigned to the the value pointed +// to by KNOWN. If 'use_stored' is true, pre-computed FST properties may be used +// when possible. 'mask & required_mask' is used to determine whether the stored +// propertoes can be used. This routine is seldom called directly; instead it is +// used to implement fst.Properties(mask, true). +template +uint64 ComputeProperties(const Fst &fst, uint64 mask, uint64 *known, + bool use_stored) { + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + const auto fst_props = fst.Properties(kFstProperties, false); // FST-stored. + // Check stored FST properties first if allowed. + if (use_stored) { + const auto known_props = KnownProperties(fst_props); + // If FST contains required info, return it. + if ((known_props & mask) == mask) { + if (known) *known = known_props; + return fst_props; + } + } + // Computes (trinary) properties explicitly. + // Initialize with binary properties (already known). + uint64 comp_props = fst_props & kBinaryProperties; + // Computes these trinary properties with a DFS. We compute only those that + // need a DFS here, since we otherwise would like to avoid a DFS since its + // stack could grow large. + uint64 dfs_props = kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | + kAccessible | kNotAccessible | kCoAccessible | + kNotCoAccessible; + std::vector scc; + if (mask & (dfs_props | kWeightedCycles | kUnweightedCycles)) { + SccVisitor scc_visitor(&scc, nullptr, nullptr, &comp_props); + DfsVisit(fst, &scc_visitor); + } + // Computes any remaining trinary properties via a state and arcs iterations + if (mask & ~(kBinaryProperties | dfs_props)) { + comp_props |= kAcceptor | kNoEpsilons | kNoIEpsilons | kNoOEpsilons | + kILabelSorted | kOLabelSorted | kUnweighted | kTopSorted | + kString; + if (mask & (kIDeterministic | kNonIDeterministic)) { + comp_props |= kIDeterministic; + } + if (mask & (kODeterministic | kNonODeterministic)) { + comp_props |= kODeterministic; + } + if (mask & (dfs_props | kWeightedCycles | kUnweightedCycles)) { + comp_props |= kUnweightedCycles; + } + std::unique_ptr> ilabels; + std::unique_ptr> olabels; + StateId nfinal = 0; + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + StateId s = siter.Value(); + Arc prev_arc; + // Creates these only if we need to. + if (mask & (kIDeterministic | kNonIDeterministic)) { + ilabels.reset(new std::unordered_set &fst1, const Fst &fst2) { + VLOG(1) << "Check FSTs for sanity (including property bits)."; + CHECK(Verify(fst1)); + CHECK(Verify(fst2)); + + // Ensures seed used once per instantiation. + static UniformArcSelector uniform_selector(seed_); + RandGenOptions> opts(uniform_selector, + kRandomPathLength); + return RandEquivalent(fst1, fst2, kNumRandomPaths, kTestDelta, opts); + } + + // Tests FSA is unambiguous + bool Unambiguous(const Fst &fst) { + VectorFst sfst, dfst; + VectorFst lfst1, lfst2; + Map(fst, &sfst, RmWeightMapper()); + Determinize(sfst, &dfst); + Map(fst, &lfst1, RmWeightMapper()); + Map(dfst, &lfst2, RmWeightMapper()); + return Equiv(lfst1, lfst2); + } + + // Ensures input-epsilon free transducers fst1 and fst2 have the + // same domain and that for each string pair '(is, os)' in fst1, + // '(is, os)' is the minimum weight match to 'is' in fst2. + template + bool MinRelated(const Fst &fst1, const Fst &fst2) { + // Same domain + VectorFst P1(fst1), P2(fst2); + Project(&P1, PROJECT_INPUT); + Project(&P2, PROJECT_INPUT); + if (!Equiv(P1, P2)) { + LOG(ERROR) << "Inputs not equivalent"; + return false; + } + + // Ensures seed used once per instantiation. + static UniformArcSelector uniform_selector(seed_); + RandGenOptions> opts(uniform_selector, + kRandomPathLength); + + VectorFst path, paths1, paths2; + for (ssize_t n = 0; n < kNumRandomPaths; ++n) { + RandGen(fst1, &path, opts); + Invert(&path); + Map(&path, RmWeightMapper()); + Compose(path, fst2, &paths1); + Weight sum1 = ShortestDistance(paths1); + Compose(paths1, path, &paths2); + Weight sum2 = ShortestDistance(paths2); + if (!ApproxEqual(Plus(sum1, sum2), sum2, kTestDelta)) { + LOG(ERROR) << "Sums not equivalent: " << sum1 << " " << sum2; + return false; + } + } + return true; + } + + // Tests ShortestDistance(A - P) >= + // ShortestDistance(A) times Threshold. + template + bool PruneEquiv(const Fst &fst, const Fst &pfst, Weight threshold) { + VLOG(1) << "Check FSTs for sanity (including property bits)."; + CHECK(Verify(fst)); + CHECK(Verify(pfst)); + + DifferenceFst D(fst, DeterminizeFst(RmEpsilonFst( + ArcMapFst>( + pfst, RmWeightMapper())))); + Weight sum1 = Times(ShortestDistance(fst), threshold); + Weight sum2 = ShortestDistance(D); + return ApproxEqual(Plus(sum1, sum2), sum1, kTestDelta); + } + + // Random seed. + int seed_; + // FST with no states + VectorFst zero_fst_; + // FST with one state that accepts epsilon. + VectorFst one_fst_; + // FST with one state that accepts all strings. + VectorFst univ_fst_; + // Generates weights used in testing. + WeightGenerator *weight_generator_; + // Maximum random path length. + static const int kRandomPathLength; + // Number of random paths to explore. + static const int kNumRandomPaths; + // Maximum number of nshortest paths. + static const int kNumRandomShortestPaths; + // Maximum number of nshortest states. + static const int kNumShortestStates; + // Delta for equivalence tests. + static const float kTestDelta; + + WeightedTester(const WeightedTester &) = delete; + WeightedTester &operator=(const WeightedTester &) = delete; +}; + +template +const int WeightedTester::kRandomPathLength = 25; + +template +const int WeightedTester::kNumRandomPaths = 100; + +template +const int WeightedTester::kNumRandomShortestPaths = 100; + +template +const int WeightedTester::kNumShortestStates = 10000; + +template +const float WeightedTester::kTestDelta = .05; + +// This class tests a variety of identities and properties that must +// hold for various algorithms on unweighted FSAs and that are not tested +// by WeightedTester. Only the specialization does anything interesting. +template +class UnweightedTester { + public: + UnweightedTester(const Fst &zero_fsa, const Fst &one_fsa, + const Fst &univ_fsa) {} + + void Test(const Fst &A1, const Fst &A2, const Fst &A3) {} +}; + +// Specialization for StdArc. This should work for any commutative, +// idempotent semiring when restricted to the unweighted case +// (being isomorphic to the boolean semiring). +template <> +class UnweightedTester { + public: + typedef StdArc Arc; + typedef Arc::Label Label; + typedef Arc::StateId StateId; + typedef Arc::Weight Weight; + + UnweightedTester(const Fst &zero_fsa, const Fst &one_fsa, + const Fst &univ_fsa) + : zero_fsa_(zero_fsa), one_fsa_(one_fsa), univ_fsa_(univ_fsa) {} + + void Test(const Fst &A1, const Fst &A2, const Fst &A3) { + TestRational(A1, A2, A3); + TestIntersect(A1, A2, A3); + TestOptimize(A1); + } + + private: + // Tests rational operations with identities + void TestRational(const Fst &A1, const Fst &A2, + const Fst &A3) { + { + VLOG(1) << "Check the union contains its arguments (destructive)."; + VectorFst U(A1); + Union(&U, A2); + + CHECK(Subset(A1, U)); + CHECK(Subset(A2, U)); + } + + { + VLOG(1) << "Check the union contains its arguments (delayed)."; + UnionFst U(A1, A2); + + CHECK(Subset(A1, U)); + CHECK(Subset(A2, U)); + } + + { + VLOG(1) << "Check if A^n c A* (destructive)."; + VectorFst C(one_fsa_); + int n = rand() % 5; + for (int i = 0; i < n; ++i) Concat(&C, A1); + + VectorFst S(A1); + Closure(&S, CLOSURE_STAR); + CHECK(Subset(C, S)); + } + + { + VLOG(1) << "Check if A^n c A* (delayed)."; + int n = rand() % 5; + Fst *C = new VectorFst(one_fsa_); + for (int i = 0; i < n; ++i) { + ConcatFst *F = new ConcatFst(*C, A1); + delete C; + C = F; + } + ClosureFst S(A1, CLOSURE_STAR); + CHECK(Subset(*C, S)); + delete C; + } + } + + // Tests intersect-based operations. + void TestIntersect(const Fst &A1, const Fst &A2, + const Fst &A3) { + VectorFst S1(A1); + VectorFst S2(A2); + VectorFst S3(A3); + + ILabelCompare comp; + + ArcSort(&S1, comp); + ArcSort(&S2, comp); + ArcSort(&S3, comp); + + { + VLOG(1) << "Check the intersection is contained in its arguments."; + IntersectFst I1(S1, S2); + CHECK(Subset(I1, S1)); + CHECK(Subset(I1, S2)); + } + + { + VLOG(1) << "Check union distributes over intersection."; + IntersectFst I1(S1, S2); + UnionFst U1(I1, S3); + + UnionFst U2(S1, S3); + UnionFst U3(S2, S3); + ArcSortFst> S4(U3, comp); + IntersectFst I2(U2, S4); + + CHECK(Equiv(U1, I2)); + } + + VectorFst C1; + VectorFst C2; + Complement(S1, &C1); + Complement(S2, &C2); + ArcSort(&C1, comp); + ArcSort(&C2, comp); + + { + VLOG(1) << "Check S U S' = Sigma*"; + UnionFst U(S1, C1); + CHECK(Equiv(U, univ_fsa_)); + } + + { + VLOG(1) << "Check S n S' = {}"; + IntersectFst I(S1, C1); + CHECK(Equiv(I, zero_fsa_)); + } + + { + VLOG(1) << "Check (S1' U S2') == (S1 n S2)'"; + UnionFst U(C1, C2); + + IntersectFst I(S1, S2); + VectorFst C3; + Complement(I, &C3); + CHECK(Equiv(U, C3)); + } + + { + VLOG(1) << "Check (S1' n S2') == (S1 U S2)'"; + IntersectFst I(C1, C2); + + UnionFst U(S1, S2); + VectorFst C3; + Complement(U, &C3); + CHECK(Equiv(I, C3)); + } + } + + // Tests optimization operations + void TestOptimize(const Fst &A) { + { + VLOG(1) << "Check determinized FSA is equivalent to its input."; + DeterminizeFst D(A); + CHECK(Equiv(A, D)); + } + + { + VLOG(1) << "Check disambiguated FSA is equivalent to its input."; + VectorFst R(A), D; + RmEpsilon(&R); + + Disambiguate(R, &D); + CHECK(Equiv(R, D)); + } + + { + VLOG(1) << "Check minimized FSA is equivalent to its input."; + int n; + { + RmEpsilonFst R(A); + DeterminizeFst D(R); + VectorFst M(D); + Minimize(&M, static_cast *>(nullptr), kDelta); + CHECK(Equiv(A, M)); + n = M.NumStates(); + } + + if (n) { // Skip test if A is the empty machine + VLOG(1) << "Check that Hopcroft's and Revuz's algorithms lead to the" + << " same number of states as Brozozowski's algorithm"; + VectorFst R; + Reverse(A, &R); + RmEpsilon(&R); + DeterminizeFst DR(R); + VectorFst RD; + Reverse(DR, &RD); + DeterminizeFst DRD(RD); + VectorFst M(DRD); + CHECK_EQ(n + 1, M.NumStates()); // Accounts for the epsilon transition + // to the initial state + } + } + } + + // Tests if two FSAS are equivalent. + bool Equiv(const Fst &fsa1, const Fst &fsa2) { + VLOG(1) << "Check FSAs for sanity (including property bits)."; + CHECK(Verify(fsa1)); + CHECK(Verify(fsa2)); + + VectorFst vfsa1(fsa1); + VectorFst vfsa2(fsa2); + RmEpsilon(&vfsa1); + RmEpsilon(&vfsa2); + DeterminizeFst dfa1(vfsa1); + DeterminizeFst dfa2(vfsa2); + + // Test equivalence using union-find algorithm + bool equiv1 = Equivalent(dfa1, dfa2); + + // Test equivalence by checking if (S1 - S2) U (S2 - S1) is empty + ILabelCompare comp; + VectorFst sdfa1(dfa1); + ArcSort(&sdfa1, comp); + VectorFst sdfa2(dfa2); + ArcSort(&sdfa2, comp); + + DifferenceFst dfsa1(sdfa1, sdfa2); + DifferenceFst dfsa2(sdfa2, sdfa1); + + VectorFst ufsa(dfsa1); + Union(&ufsa, dfsa2); + Connect(&ufsa); + bool equiv2 = ufsa.NumStates() == 0; + + // Check two equivalence tests match + CHECK((equiv1 && equiv2) || (!equiv1 && !equiv2)); + + return equiv1; + } + + // Tests if FSA1 is a subset of FSA2 (disregarding weights). + bool Subset(const Fst &fsa1, const Fst &fsa2) { + VLOG(1) << "Check FSAs (incl. property bits) for sanity"; + CHECK(Verify(fsa1)); + CHECK(Verify(fsa2)); + + VectorFst vfsa1; + VectorFst vfsa2; + RmEpsilon(&vfsa1); + RmEpsilon(&vfsa2); + ILabelCompare comp; + ArcSort(&vfsa1, comp); + ArcSort(&vfsa2, comp); + IntersectFst ifsa(vfsa1, vfsa2); + DeterminizeFst dfa1(vfsa1); + DeterminizeFst dfa2(ifsa); + return Equivalent(dfa1, dfa2); + } + + // Returns complement Fsa + void Complement(const Fst &ifsa, MutableFst *ofsa) { + RmEpsilonFst rfsa(ifsa); + DeterminizeFst dfa(rfsa); + DifferenceFst cfsa(univ_fsa_, dfa); + *ofsa = cfsa; + } + + // FSA with no states + VectorFst zero_fsa_; + + // FSA with one state that accepts epsilon. + VectorFst one_fsa_; + + // FSA with one state that accepts all strings. + VectorFst univ_fsa_; +}; + +// This class tests a variety of identities and properties that must +// hold for various FST algorithms. It randomly generates FSTs, using +// function object 'weight_generator' to select weights. 'WeightTester' +// and 'UnweightedTester' are then called. +template +class AlgoTester { + public: + typedef typename Arc::Label Label; + typedef typename Arc::StateId StateId; + typedef typename Arc::Weight Weight; + + AlgoTester(WeightGenerator generator, int seed) + : weight_generator_(generator) { + one_fst_.AddState(); + one_fst_.SetStart(0); + one_fst_.SetFinal(0, Weight::One()); + + univ_fst_.AddState(); + univ_fst_.SetStart(0); + univ_fst_.SetFinal(0, Weight::One()); + for (int i = 0; i < kNumRandomLabels; ++i) + univ_fst_.AddArc(0, Arc(i, i, Weight::One(), 0)); + + weighted_tester_ = new WeightedTester( + seed, zero_fst_, one_fst_, univ_fst_, &weight_generator_); + + unweighted_tester_ = + new UnweightedTester(zero_fst_, one_fst_, univ_fst_); + } + + ~AlgoTester() { + delete weighted_tester_; + delete unweighted_tester_; + } + + void MakeRandFst(MutableFst *fst) { + RandFst(kNumRandomStates, kNumRandomArcs, + kNumRandomLabels, kAcyclicProb, + &weight_generator_, fst); + } + + void Test() { + VLOG(1) << "weight type = " << Weight::Type(); + + for (int i = 0; i < FLAGS_repeat; ++i) { + // Random transducers + VectorFst T1; + VectorFst T2; + VectorFst T3; + MakeRandFst(&T1); + MakeRandFst(&T2); + MakeRandFst(&T3); + weighted_tester_->Test(T1, T2, T3); + + VectorFst A1(T1); + VectorFst A2(T2); + VectorFst A3(T3); + Project(&A1, PROJECT_OUTPUT); + Project(&A2, PROJECT_INPUT); + Project(&A3, PROJECT_INPUT); + ArcMap(&A1, rm_weight_mapper_); + ArcMap(&A2, rm_weight_mapper_); + ArcMap(&A3, rm_weight_mapper_); + unweighted_tester_->Test(A1, A2, A3); + } + } + + private: + // Generates weights used in testing. + WeightGenerator weight_generator_; + + // FST with no states + VectorFst zero_fst_; + + // FST with one state that accepts epsilon. + VectorFst one_fst_; + + // FST with one state that accepts all strings. + VectorFst univ_fst_; + + // Tests weighted FSTs + WeightedTester *weighted_tester_; + + // Tests unweighted FSTs + UnweightedTester *unweighted_tester_; + + // Mapper to remove weights from an Fst + RmWeightMapper rm_weight_mapper_; + + // Maximum number of states in random test Fst. + static const int kNumRandomStates; + + // Maximum number of arcs in random test Fst. + static const int kNumRandomArcs; + + // Number of alternative random labels. + static const int kNumRandomLabels; + + // Probability to force an acyclic Fst + static const float kAcyclicProb; + + // Maximum random path length. + static const int kRandomPathLength; + + // Number of random paths to explore. + static const int kNumRandomPaths; + + AlgoTester(const AlgoTester &) = delete; + AlgoTester &operator=(const AlgoTester &) = delete; +}; + +template +const int AlgoTester::kNumRandomStates = 10; + +template +const int AlgoTester::kNumRandomArcs = 25; + +template +const int AlgoTester::kNumRandomLabels = 5; + +template +const float AlgoTester::kAcyclicProb = .25; + +template +const int AlgoTester::kRandomPathLength = 25; + +template +const int AlgoTester::kNumRandomPaths = 100; + +} // namespace fst + +#endif // FST_TEST_ALGO_TEST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/test/fst_test.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/test/fst_test.h new file mode 100644 index 0000000..7d536d9 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/test/fst_test.h @@ -0,0 +1,318 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Regression test for FST classes. + +#ifndef FST_TEST_FST_TEST_H_ +#define FST_TEST_FST_TEST_H_ + +#include +#include +#include +#include +#include + +DECLARE_string(tmpdir); + +namespace fst { + +// This tests an Fst F that is assumed to have a copy method from an +// arbitrary Fst. Some test functions make further assumptions mostly +// obvious from their name. These tests are written as member temple +// functions that take a test fst as its argument so that different +// Fsts in the interface hierarchy can be tested separately and so +// that we can instantiate only those tests that make sense for a +// particular Fst. +template +class FstTester { + public: + typedef typename F::Arc Arc; + typedef typename Arc::StateId StateId; + typedef typename Arc::Weight Weight; + typedef typename Arc::Label Label; + + FstTester() { + VectorFst vfst; + InitFst(&vfst, 128); + testfst_ = new F(vfst); + } + + explicit FstTester(F *testfst) : testfst_(testfst) {} + + ~FstTester() { delete testfst_; } + + // This verifies the contents described in InitFst() using + // methods defined in a generic Fst. + template + void TestBase(const G &fst) const { + CHECK(Verify(fst)); + CHECK_EQ(fst.Start(), 0); + StateId ns = 0; + StateIterator siter(fst); + Matcher matcher(fst, MATCH_INPUT); + MatchType match_type = matcher.Type(true); + for (; !siter.Done(); siter.Next()) { + } + for (siter.Reset(); !siter.Done(); siter.Next()) { + StateId s = siter.Value(); + matcher.SetState(s); + CHECK_EQ(fst.Final(s), NthWeight(s)); + size_t na = 0; + ArcIterator aiter(fst, s); + for (; !aiter.Done(); aiter.Next()) { + } + for (aiter.Reset(); !aiter.Done(); aiter.Next()) { + ++na; + const Arc &arc = aiter.Value(); + CHECK_EQ(arc.ilabel, na); + CHECK_EQ(arc.olabel, 0); + CHECK_EQ(arc.weight, NthWeight(na)); + CHECK_EQ(arc.nextstate, s); + if (match_type == MATCH_INPUT) { + CHECK(matcher.Find(arc.ilabel)); + CHECK_EQ(matcher.Value().ilabel, arc.ilabel); + } + } + CHECK_EQ(na, s); + CHECK_EQ(na, aiter.Position()); + CHECK_EQ(fst.NumArcs(s), s); + CHECK_EQ(fst.NumInputEpsilons(s), 0); + CHECK_EQ(fst.NumOutputEpsilons(s), s); + CHECK(!matcher.Find(s + 1)); // out-of-range + CHECK(!matcher.Find(kNoLabel)); // no explicit epsilons + CHECK(matcher.Find(0)); + CHECK_EQ(matcher.Value().ilabel, kNoLabel); // implicit epsilon loop + ++ns; + } + CHECK(fst.Properties(kNotAcceptor, true)); + CHECK(fst.Properties(kOEpsilons, true)); + } + + void TestBase() const { TestBase(*testfst_); } + + // This verifies methods specfic to an ExpandedFst. + template + void TestExpanded(const G &fst) const { + StateId ns = 0; + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + ++ns; + } + CHECK_EQ(fst.NumStates(), ns); + CHECK(fst.Properties(kExpanded, false)); + } + + void TestExpanded() const { TestExpanded(*testfst_); } + + // This verifies methods specific to a MutableFst. + template + void TestMutable(G *fst) const { + for (StateIterator siter(*fst); !siter.Done(); siter.Next()) { + StateId s = siter.Value(); + size_t na = 0; + size_t ni = fst->NumInputEpsilons(s); + MutableArcIterator aiter(fst, s); + for (; !aiter.Done(); aiter.Next()) { + } + for (aiter.Reset(); !aiter.Done(); aiter.Next()) { + ++na; + Arc arc = aiter.Value(); + arc.ilabel = 0; + aiter.SetValue(arc); + arc = aiter.Value(); + CHECK_EQ(arc.ilabel, 0); + CHECK_EQ(fst->NumInputEpsilons(s), ni + 1); + arc.ilabel = na; + aiter.SetValue(arc); + CHECK_EQ(fst->NumInputEpsilons(s), ni); + } + } + + G *cfst1 = fst->Copy(); + cfst1->DeleteStates(); + CHECK_EQ(cfst1->NumStates(), 0); + delete cfst1; + + G *cfst2 = fst->Copy(); + for (StateIterator siter(*cfst2); !siter.Done(); siter.Next()) { + StateId s = siter.Value(); + cfst2->DeleteArcs(s); + CHECK_EQ(cfst2->NumArcs(s), 0); + CHECK_EQ(cfst2->NumInputEpsilons(s), 0); + CHECK_EQ(cfst2->NumOutputEpsilons(s), 0); + } + delete cfst2; + } + + void TestMutable() { TestMutable(testfst_); } + + // This verifies the copy methods. + template + void TestAssign(G *fst) const { + // Assignment from G + G afst1; + afst1 = *fst; + CHECK(Equal(*fst, afst1)); + + // Assignment from Fst + G afst2; + afst2 = *static_cast *>(fst); + CHECK(Equal(*fst, afst2)); + + // Assignment from self + afst2.operator=(afst2); + CHECK(Equal(*fst, afst2)); + } + + void TestAssign() { TestAssign(testfst_); } + + // This verifies the copy methods. + template + void TestCopy(const G &fst) const { + // Copy from G + G c1fst(fst); + TestBase(c1fst); + + // Copy from Fst + const G c2fst(static_cast &>(fst)); + TestBase(c2fst); + + // Copy from self + const G *c3fst = fst.Copy(); + TestBase(*c3fst); + delete c3fst; + } + + void TestCopy() const { TestCopy(*testfst_); } + + // This verifies the read/write methods. + template + void TestIO(const G &fst) const { + const string filename = FLAGS_tmpdir + "/test.fst"; + const string aligned = FLAGS_tmpdir + "/aligned.fst"; + { + // write/read + CHECK(fst.Write(filename)); + G *ffst = G::Read(filename); + CHECK(ffst); + TestBase(*ffst); + delete ffst; + } + + { + // generic read/cast/test + Fst *gfst = Fst::Read(filename); + CHECK(gfst); + G *dfst = static_cast(gfst); + TestBase(*dfst); + + // generic write/read/test + CHECK(gfst->Write(filename)); + Fst *hfst = Fst::Read(filename); + CHECK(hfst); + TestBase(*hfst); + delete gfst; + delete hfst; + } + + { + // check mmaping by first writing the file with the aligned attribute set + { + std::ofstream ostr(aligned); + FstWriteOptions opts; + opts.source = aligned; + opts.align = true; + CHECK(fst.Write(ostr, opts)); + } + std::ifstream istr(aligned); + FstReadOptions opts; + opts.mode = FstReadOptions::ReadMode("map"); + opts.source = aligned; + G *gfst = G::Read(istr, opts); + CHECK(gfst); + TestBase(*gfst); + delete gfst; + } + + // check mmaping of unaligned files to make sure it does not fail. + { + { + std::ofstream ostr(aligned); + FstWriteOptions opts; + opts.source = aligned; + opts.align = false; + CHECK(fst.Write(ostr, opts)); + } + std::ifstream istr(aligned); + FstReadOptions opts; + opts.mode = FstReadOptions::ReadMode("map"); + opts.source = aligned; + G *gfst = G::Read(istr, opts); + CHECK(gfst); + TestBase(*gfst); + delete gfst; + } + + // expanded write/read/test + if (fst.Properties(kExpanded, false)) { + ExpandedFst *efst = ExpandedFst::Read(filename); + CHECK(efst); + TestBase(*efst); + TestExpanded(*efst); + delete efst; + } + + // mutable write/read/test + if (fst.Properties(kMutable, false)) { + MutableFst *mfst = MutableFst::Read(filename); + CHECK(mfst); + TestBase(*mfst); + TestExpanded(*mfst); + TestMutable(mfst); + delete mfst; + } + } + + void TestIO() const { TestIO(*testfst_); } + + private: + // This constructs test FSTs. Given a mutable FST, will leave + // the FST as follows: + // (I) NumStates() = nstates + // (II) Start() = 0 + // (III) Final(s) = NthWeight(s) + // (IV) For state s: + // (a) NumArcs(s) == s + // (b) For ith arc of s: + // (1) ilabel = i + // (2) olabel = 0 + // (3) weight = NthWeight(i) + // (4) nextstate = s + void InitFst(MutableFst *fst, size_t nstates) const { + fst->DeleteStates(); + CHECK_GT(nstates, 0); + + for (StateId s = 0; s < nstates; ++s) { + fst->AddState(); + fst->SetFinal(s, NthWeight(s)); + for (size_t i = 1; i <= s; ++i) { + Arc arc(i, 0, NthWeight(i), s); + fst->AddArc(s, arc); + } + } + + fst->SetStart(0); + } + + // Generates One() + ... + One() (n times) + Weight NthWeight(int n) const { + Weight w = Weight::Zero(); + for (int i = 0; i < n; ++i) w = Plus(w, Weight::One()); + return w; + } + + F *testfst_; // what we're testing +}; + +} // namespace fst + +#endif // FST_TEST_FST_TEST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/test/rand-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/test/rand-fst.h new file mode 100644 index 0000000..f2f34c6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/test/rand-fst.h @@ -0,0 +1,90 @@ +#ifndef FST_TEST_RAND_FST_H_ +#define FST_TEST_RAND_FST_H_ + +#include +#include +#include + +namespace fst { + +// Generates a random FST. +template +void RandFst(const int num_random_states, const int num_random_arcs, + const int num_random_labels, const float acyclic_prob, + WeightGenerator *weight_generator, MutableFst *fst) { + typedef typename Arc::Label Label; + typedef typename Arc::StateId StateId; + typedef typename Arc::Weight Weight; + + // Determines direction of the arcs wrt state numbering. This way we + // can force acyclicity when desired. + enum ArcDirection { + ANY_DIRECTION = 0, + FORWARD_DIRECTION = 1, + REVERSE_DIRECTION = 2, + NUM_DIRECTIONS = 3 + }; + + ArcDirection arc_direction = ANY_DIRECTION; + if (rand() / (RAND_MAX + 1.0) < acyclic_prob) + arc_direction = rand() % 2 ? FORWARD_DIRECTION : REVERSE_DIRECTION; + + fst->DeleteStates(); + StateId ns = rand() % num_random_states; + + if (ns == 0) return; + for (StateId s = 0; s < ns; ++s) fst->AddState(); + + StateId start = rand() % ns; + fst->SetStart(start); + + size_t na = rand() % num_random_arcs; + for (size_t n = 0; n < na; ++n) { + StateId s = rand() % ns; + Arc arc; + arc.ilabel = rand() % num_random_labels; + arc.olabel = rand() % num_random_labels; + arc.weight = (*weight_generator)(); + arc.nextstate = rand() % ns; + + if ((arc_direction == FORWARD_DIRECTION || + arc_direction == REVERSE_DIRECTION) && + s == arc.nextstate) { + continue; // skips self-loops + } + + if ((arc_direction == FORWARD_DIRECTION && s > arc.nextstate) || + (arc_direction == REVERSE_DIRECTION && s < arc.nextstate)) { + StateId t = s; // reverses arcs + s = arc.nextstate; + arc.nextstate = t; + } + + fst->AddArc(s, arc); + } + + StateId nf = rand() % (ns + 1); + for (StateId n = 0; n < nf; ++n) { + StateId s = rand() % ns; + Weight final = (*weight_generator)(); + fst->SetFinal(s, final); + } + VLOG(1) << "Check FST for sanity (including property bits)."; + CHECK(Verify(*fst)); + + // Get/compute all properties. + uint64 props = fst->Properties(kFstProperties, true); + + // Select random set of properties to be unknown. + uint64 mask = 0; + for (int n = 0; n < 8; ++n) { + mask |= rand() & 0xff; + mask <<= 8; + } + mask &= ~kTrinaryProperties; + fst->SetProperties(props & ~mask, mask); +} + +} // namespace fst + +#endif // FST_TEST_RAND_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/test/weight-tester.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/test/weight-tester.h new file mode 100644 index 0000000..b7de665 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/test/weight-tester.h @@ -0,0 +1,207 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Utility class for regression testing of FST weights. + +#ifndef FST_TEST_WEIGHT_TESTER_H_ +#define FST_TEST_WEIGHT_TESTER_H_ + +#include +#include + +#include + +#include +#include + +namespace fst { + +// This class tests a variety of identities and properties that must +// hold for the Weight class to be well-defined. It calls function object +// WEIGHT_GENERATOR to select weights that are used in the tests. +template +class WeightTester { + public: + WeightTester(WeightGenerator generator) + : weight_generator_(std::move(generator)) {} + + void Test(int iterations, bool test_division = true) { + for (int i = 0; i < iterations; ++i) { + // Selects the test weights. + const Weight w1(weight_generator_()); + const Weight w2(weight_generator_()); + const Weight w3(weight_generator_()); + + VLOG(1) << "weight type = " << Weight::Type(); + VLOG(1) << "w1 = " << w1; + VLOG(1) << "w2 = " << w2; + VLOG(1) << "w3 = " << w3; + + TestSemiring(w1, w2, w3); + if (test_division) TestDivision(w1, w2); + TestReverse(w1, w2); + TestEquality(w1, w2, w3); + TestIO(w1); + TestCopy(w1); + } + } + + private: + // Note in the tests below we use ApproxEqual rather than == and add + // kDelta to inequalities where the weights might be inexact. + + // Tests (Plus, Times, Zero, One) defines a commutative semiring. + void TestSemiring(Weight w1, Weight w2, Weight w3) { + // Checks that the operations are closed. + CHECK(Plus(w1, w2).Member()); + CHECK(Times(w1, w2).Member()); + + // Checks that the operations are associative. + CHECK(ApproxEqual(Plus(w1, Plus(w2, w3)), Plus(Plus(w1, w2), w3))); + CHECK(ApproxEqual(Times(w1, Times(w2, w3)), Times(Times(w1, w2), w3))); + + // Checks the identity elements. + CHECK(Plus(w1, Weight::Zero()) == w1); + CHECK(Plus(Weight::Zero(), w1) == w1); + CHECK(Times(w1, Weight::One()) == w1); + CHECK(Times(Weight::One(), w1) == w1); + + // Check the no weight element. + CHECK(!Weight::NoWeight().Member()); + CHECK(!Plus(w1, Weight::NoWeight()).Member()); + CHECK(!Plus(Weight::NoWeight(), w1).Member()); + CHECK(!Times(w1, Weight::NoWeight()).Member()); + CHECK(!Times(Weight::NoWeight(), w1).Member()); + + // Checks that the operations commute. + CHECK(ApproxEqual(Plus(w1, w2), Plus(w2, w1))); + + if (Weight::Properties() & kCommutative) + CHECK(ApproxEqual(Times(w1, w2), Times(w2, w1))); + + // Checks Zero() is the annihilator. + CHECK(Times(w1, Weight::Zero()) == Weight::Zero()); + CHECK(Times(Weight::Zero(), w1) == Weight::Zero()); + + // Check Power(w, 0) is Weight::One() + CHECK(Power(w1, 0) == Weight::One()); + + // Check Power(w, 1) is w + CHECK(Power(w1, 1) == w1); + + // Check Power(w, 3) is Times(w, Times(w, w)) + CHECK(Power(w1, 3) == Times(w1, Times(w1, w1))); + + // Checks distributivity. + if (Weight::Properties() & kLeftSemiring) { + CHECK(ApproxEqual(Times(w1, Plus(w2, w3)), + Plus(Times(w1, w2), Times(w1, w3)))); + } + if (Weight::Properties() & kRightSemiring) + CHECK(ApproxEqual(Times(Plus(w1, w2), w3), + Plus(Times(w1, w3), Times(w2, w3)))); + + if (Weight::Properties() & kIdempotent) CHECK(Plus(w1, w1) == w1); + + if (Weight::Properties() & kPath) + CHECK(Plus(w1, w2) == w1 || Plus(w1, w2) == w2); + + // Ensure weights form a left or right semiring. + CHECK(Weight::Properties() & (kLeftSemiring | kRightSemiring)); + + // Check when Times() is commutative that it is marked as a semiring. + if (Weight::Properties() & kCommutative) + CHECK(Weight::Properties() & kSemiring); + } + + // Tests division operation. + void TestDivision(Weight w1, Weight w2) { + Weight p = Times(w1, w2); + + if (Weight::Properties() & kLeftSemiring) { + Weight d = Divide(p, w1, DIVIDE_LEFT); + if (d.Member()) CHECK(ApproxEqual(p, Times(w1, d))); + CHECK(!Divide(w1, Weight::NoWeight(), DIVIDE_LEFT).Member()); + CHECK(!Divide(Weight::NoWeight(), w1, DIVIDE_LEFT).Member()); + } + + if (Weight::Properties() & kRightSemiring) { + Weight d = Divide(p, w2, DIVIDE_RIGHT); + if (d.Member()) CHECK(ApproxEqual(p, Times(d, w2))); + CHECK(!Divide(w1, Weight::NoWeight(), DIVIDE_RIGHT).Member()); + CHECK(!Divide(Weight::NoWeight(), w1, DIVIDE_RIGHT).Member()); + } + + if (Weight::Properties() & kCommutative) { + Weight d = Divide(p, w1, DIVIDE_RIGHT); + if (d.Member()) CHECK(ApproxEqual(p, Times(d, w1))); + } + } + + // Tests reverse operation. + void TestReverse(Weight w1, Weight w2) { + typedef typename Weight::ReverseWeight ReverseWeight; + + ReverseWeight rw1 = w1.Reverse(); + ReverseWeight rw2 = w2.Reverse(); + + CHECK(rw1.Reverse() == w1); + CHECK(Plus(w1, w2).Reverse() == Plus(rw1, rw2)); + CHECK(Times(w1, w2).Reverse() == Times(rw2, rw1)); + } + + // Tests == is an equivalence relation. + void TestEquality(Weight w1, Weight w2, Weight w3) { + // Checks reflexivity. + CHECK(w1 == w1); + + // Checks symmetry. + CHECK((w1 == w2) == (w2 == w1)); + + // Checks transitivity. + if (w1 == w2 && w2 == w3) CHECK(w1 == w3); + } + + // Tests binary serialization and textual I/O. + void TestIO(Weight w) { + // Tests binary I/O + { + std::ostringstream os; + w.Write(os); + os.flush(); + std::istringstream is(os.str()); + Weight v; + v.Read(is); + CHECK_EQ(w, v); + } + + // Tests textual I/O. + { + std::ostringstream os; + os << w; + std::istringstream is(os.str()); + Weight v(Weight::One()); + is >> v; + CHECK(ApproxEqual(w, v)); + } + } + + // Tests copy constructor and assignment operator + void TestCopy(Weight w) { + Weight x = w; + CHECK(w == x); + + x = Weight(w); + CHECK(w == x); + + x.operator=(x); + CHECK(w == x); + } + + // Generates weights used in testing. + WeightGenerator weight_generator_; +}; + +} // namespace fst + +#endif // FST_TEST_WEIGHT_TESTER_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/topsort.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/topsort.h new file mode 100644 index 0000000..cae3e15 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/topsort.h @@ -0,0 +1,95 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Topological sort of FSTs. + +#ifndef FST_TOPSORT_H_ +#define FST_TOPSORT_H_ + +#include +#include + + +#include +#include +#include + + +namespace fst { + +// DFS visitor class to return topological ordering. +template +class TopOrderVisitor { + public: + using StateId = typename Arc::StateId; + + // If acyclic, order[i] gives the topological position of StateId i; + // otherwise it is unchanged. acyclic_ will be true iff the FST has no + // cycles. The caller retains ownership of the state order vector. + TopOrderVisitor(std::vector *order, bool *acyclic) + : order_(order), acyclic_(acyclic) {} + + void InitVisit(const Fst &fst) { + finish_.reset(new std::vector()); + *acyclic_ = true; + } + + constexpr bool InitState(StateId, StateId) const { return true; } + + constexpr bool TreeArc(StateId, const Arc &) const { return true; } + + bool BackArc(StateId, const Arc &) { return (*acyclic_ = false); } + + constexpr bool ForwardOrCrossArc(StateId, const Arc &) const { return true; } + + void FinishState(StateId s, StateId, const Arc *) { finish_->push_back(s); } + + void FinishVisit() { + if (*acyclic_) { + order_->clear(); + for (StateId s = 0; s < finish_->size(); ++s) { + order_->push_back(kNoStateId); + } + for (StateId s = 0; s < finish_->size(); ++s) { + (*order_)[(*finish_)[finish_->size() - s - 1]] = s; + } + } + finish_.reset(); + } + + private: + std::vector *order_; + bool *acyclic_; + // States in finish-time order. + std::unique_ptr> finish_; +}; + +// Topologically sorts its input if acyclic, modifying it. Otherwise, the input +// is unchanged. When sorted, all transitions are from lower to higher state +// IDs. +// +// Complexity: +// +// Time: O(V + E) +// Space: O(V + E) +// +// where V is the number of states and E is the number of arcs. +template +bool TopSort(MutableFst *fst) { + std::vector order; + bool acyclic; + TopOrderVisitor top_order_visitor(&order, &acyclic); + DfsVisit(*fst, &top_order_visitor); + if (acyclic) { + StateSort(fst, order); + fst->SetProperties(kAcyclic | kInitialAcyclic | kTopSorted, + kAcyclic | kInitialAcyclic | kTopSorted); + } else { + fst->SetProperties(kCyclic | kNotTopSorted, kCyclic | kNotTopSorted); + } + return acyclic; +} + +} // namespace fst + +#endif // FST_TOPSORT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/tuple-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/tuple-weight.h new file mode 100644 index 0000000..c8ecab7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/tuple-weight.h @@ -0,0 +1,163 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Tuple weight set operation definitions. + +#ifndef FST_TUPLE_WEIGHT_H_ +#define FST_TUPLE_WEIGHT_H_ + +#include +#include +#include +#include +#include + +#include +#include + +#include + + +namespace fst { + +// n-tuple weight, element of the n-th Cartesian power of W. +template +class TupleWeight { + public: + using ReverseWeight = TupleWeight; + + using Weight = W; + using Index = size_t; + + template + TupleWeight(Iterator begin, Iterator end) { + std::copy(begin, end, values_.begin()); + } + + explicit TupleWeight(const W &weight = W::Zero()) { values_.fill(weight); } + + // Initialize component `index` to `weight`; initialize all other components + // to `default_weight` + TupleWeight(Index index, const W &weight, const W &default_weight) + : TupleWeight(default_weight) { + values_[index] = weight; + } + + static const TupleWeight &Zero() { + static const TupleWeight zero(W::Zero()); + return zero; + } + + static const TupleWeight &One() { + static const TupleWeight one(W::One()); + return one; + } + + static const TupleWeight &NoWeight() { + static const TupleWeight no_weight(W::NoWeight()); + return no_weight; + } + + constexpr static size_t Length() { return n; } + + std::istream &Read(std::istream &istrm) { + for (size_t i = 0; i < n; ++i) values_[i].Read(istrm); + return istrm; + } + + std::ostream &Write(std::ostream &ostrm) const { + for (size_t i = 0; i < n; ++i) values_[i].Write(ostrm); + return ostrm; + } + + bool Member() const { + return std::all_of(values_.begin(), values_.end(), + std::mem_fn(&W::Member)); + } + + size_t Hash() const { + uint64 hash = 0; + for (size_t i = 0; i < n; ++i) hash = 5 * hash + values_[i].Hash(); + return size_t(hash); + } + + TupleWeight Quantize(float delta = kDelta) const { + TupleWeight weight; + for (size_t i = 0; i < n; ++i) { + weight.values_[i] = values_[i].Quantize(delta); + } + return weight; + } + + ReverseWeight Reverse() const { + TupleWeight w; + for (size_t i = 0; i < n; ++i) w.values_[i] = values_[i].Reverse(); + return w; + } + + const W &Value(size_t i) const { return values_[i]; } + + void SetValue(size_t i, const W &w) { values_[i] = w; } + + private: + std::array values_; +}; + +template +inline bool operator==(const TupleWeight &w1, + const TupleWeight &w2) { + for (size_t i = 0; i < n; ++i) { + if (w1.Value(i) != w2.Value(i)) return false; + } + return true; +} + +template +inline bool operator!=(const TupleWeight &w1, + const TupleWeight &w2) { + for (size_t i = 0; i < n; ++i) { + if (w1.Value(i) != w2.Value(i)) return true; + } + return false; +} + +template +inline bool ApproxEqual(const TupleWeight &w1, + const TupleWeight &w2, float delta = kDelta) { + for (size_t i = 0; i < n; ++i) { + if (!ApproxEqual(w1.Value(i), w2.Value(i), delta)) return false; + } + return true; +} + +template +inline std::ostream &operator<<(std::ostream &strm, + const TupleWeight &w) { + CompositeWeightWriter writer(strm); + writer.WriteBegin(); + for (size_t i = 0; i < n; ++i) writer.WriteElement(w.Value(i)); + writer.WriteEnd(); + return strm; +} + +template +inline std::istream &operator>>(std::istream &strm, TupleWeight &w) { + CompositeWeightReader reader(strm); + reader.ReadBegin(); + W v; + // Reads first n-1 elements. + static_assert(n > 0, "Size must be positive."); + for (size_t i = 0; i < n - 1; ++i) { + reader.ReadElement(&v); + w.SetValue(i, v); + } + // Reads n-th element. + reader.ReadElement(&v, true); + w.SetValue(n - 1, v); + reader.ReadEnd(); + return strm; +} + +} // namespace fst + +#endif // FST_TUPLE_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/types.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/types.h new file mode 100644 index 0000000..9c0b799 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/types.h @@ -0,0 +1,41 @@ +// 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 applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Various type definitions (mostly for Google compatibility). + +#include // For std::ptrdiff_t. +#include // for ssize_t. +#include // for ?int*_t. + +#ifndef FST_LIB_TYPES_H_ +#define FST_LIB_TYPES_H_ + +using int8 = int8_t; +using int16 = int16_t; +using int32 = int32_t; +using int64 = int64_t; + +using uint8 = uint8_t; +using uint16 = uint16_t; +using uint32 = uint32_t; +using uint64 = uint64_t; + +#ifdef _MSC_VER +// Not really Windows-specific: they should have used ptrdiff_t in the first +// place. But on Windows there has never been ssize_t. +using ssize_t = std::ptrdiff_t; +#endif // _MSC_VER + +#endif // FST_LIB_TYPES_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/union-find.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/union-find.h new file mode 100644 index 0000000..b5c7f10 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/union-find.h @@ -0,0 +1,84 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Union-find algorithm for dense sets of non-negative integers, implemented +// using disjoint tree forests with rank heuristics and path compression. + +#ifndef FST_UNION_FIND_H_ +#define FST_UNION_FIND_H_ + +#include +#include + +namespace fst { + +// Union-Find algorithm for dense sets of non-negative integers. +template +class UnionFind { + public: + // Creates a disjoint set forest for the range [0; max); 'fail' is a value + // indicating that an element hasn't been initialized using MakeSet(...). + // The upper bound of the range can be reset (increased) using MakeSet(...). + UnionFind(T max, T fail) : parent_(max, fail), rank_(max), fail_(fail) {} + + // Finds the representative of the set 'item' belongs to, performing path + // compression if necessary. + T FindSet(T item) { + if (item >= parent_.size() || item == fail_ || parent_[item] == fail_) { + return fail_; + } + auto *p = &parent_[item]; + for (; *p != item; item = *p, p = &parent_[item]) exec_stack_.push(p); + for (; !exec_stack_.empty(); exec_stack_.pop()) *exec_stack_.top() = *p; + return *p; + } + + // Creates the (destructive) union of the sets x and y belong to. + void Union(T x, T y) { Link(FindSet(x), FindSet(y)); } + + // Initialization of an element: creates a singleton set containing 'item'. + // The range [0; max) is reset if item >= max. + T MakeSet(T item) { + if (item >= parent_.size()) { + // New value in parent_ should be initialized to fail_. + const auto nitem = item > 0 ? 2 * item : 2; + parent_.resize(nitem, fail_); + rank_.resize(nitem); + } + parent_[item] = item; + return item; + } + + // Initialization of all elements starting from 0 to max - 1 to distinct sets. + void MakeAllSet(T max) { + parent_.resize(max); + for (T item = 0; item < max; ++item) parent_[item] = item; + } + + private: + // Links trees rooted in 'x' and 'y'. + void Link(T x, T y) { + if (x == y) return; + if (rank_[x] > rank_[y]) { + parent_[y] = x; + } else { + parent_[x] = y; + if (rank_[x] == rank_[y]) { + ++rank_[y]; + } + } + } + + UnionFind(const UnionFind &) = delete; + + UnionFind &operator=(const UnionFind &) = delete; + + std::vector parent_; // Parent nodes. + std::vector rank_; // Rank of an element = min. depth in tree. + T fail_; // Value indicating lookup failure. + std::stack exec_stack_; // Used for path compression. +}; + +} // namespace fst + +#endif // FST_UNION_FIND_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/union-weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/union-weight.h new file mode 100644 index 0000000..bb2dea9 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/union-weight.h @@ -0,0 +1,505 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Union weight set and associated semiring operation definitions. +// +// TODO(riley): add in normalizer functor + +#ifndef FST_UNION_WEIGHT_H_ +#define FST_UNION_WEIGHT_H_ + +#include + +#include +#include +#include +#include +#include + +#include + + +namespace fst { + +// Example UnionWeightOptions for UnionWeight template below. The Merge +// operation is used to collapse elements of the set and the Compare function +// to efficiently implement the merge. In the simplest case, merge would just +// apply with equality of set elements so the result is a set (and not a +// multiset). More generally, this can be used to maintain the multiplicity or +// other such weight associated with the set elements (cf. Gallic weights). + +// template +// struct UnionWeightOptions { +// // Comparison function C is a total order on W that is monotonic w.r.t. to +// // Times: for all a, b,c != Zero(): C(a, b) => C(ca, cb) and is +// // anti-monotonic w.r.rt to Divide: C(a, b) => C(c/b, c/a). +// // +// // For all a, b: only one of C(a, b), C(b, a) or a ~ b must true where +// // ~ is an equivalence relation on W. Also we require a ~ b iff +// // a.Reverse() ~ b.Reverse(). +// using Compare = NaturalLess; +// +// // How to combine two weights if a ~ b as above. For all a, b: a ~ b => +// // merge(a, b) ~ a, Merge must define a semiring endomorphism from the +// // unmerged weight sets to the merged weight sets. +// struct Merge { +// W operator()(const W &w1, const W &w2) const { return w1; } +// }; +// +// // For ReverseWeight. +// using ReverseOptions = UnionWeightOptions; +// }; + +template +class UnionWeight; + +template +class UnionWeightIterator; + +template +class UnionWeightReverseIterator; + +template +bool operator==(const UnionWeight &, const UnionWeight &); + +// Semiring that uses Times() and One() from W and union and the empty set +// for Plus() and Zero(), respectively. Template argument O specifies the union +// weight options as above. +template +class UnionWeight { + public: + using Weight = W; + using Compare = typename O::Compare; + using Merge = typename O::Merge; + + using ReverseWeight = + UnionWeight; + + friend class UnionWeightIterator; + friend class UnionWeightReverseIterator; + friend bool operator== + <>(const UnionWeight &, const UnionWeight &); + + // Sets represented as first_ weight + rest_ weights. Uses first_ as + // NoWeight() to indicate the union weight Zero() ask the empty set. Uses + // rest_ containing NoWeight() to indicate the union weight NoWeight(). + UnionWeight() : first_(W::NoWeight()) {} + + explicit UnionWeight(W weight) : first_(weight) { + if (weight == W::NoWeight()) rest_.push_back(weight); + } + + static const UnionWeight &Zero() { + static const UnionWeight zero(W::NoWeight()); + return zero; + } + + static const UnionWeight &One() { + static const UnionWeight one(W::One()); + return one; + } + + static const UnionWeight &NoWeight() { + static const UnionWeight no_weight(W::Zero(), W::NoWeight()); + return no_weight; + } + + static const string &Type() { + static const string *const type = new string(W::Type() + "_union"); + return *type; + } + + static constexpr uint64 Properties() { + return W::Properties() & + (kLeftSemiring | kRightSemiring | kCommutative | kIdempotent); + } + + bool Member() const; + + std::istream &Read(std::istream &strm); + + std::ostream &Write(std::ostream &strm) const; + + size_t Hash() const; + + UnionWeight Quantize(float delta = kDelta) const; + + ReverseWeight Reverse() const; + + // These operations combined with the UnionWeightIterator and + // UnionWeightReverseIterator provide the access and mutation of the union + // weight internal elements. + + // Common initializer among constructors; clears existing UnionWeight. + void Clear() { + first_ = W::NoWeight(); + rest_.clear(); + } + + size_t Size() const { return first_.Member() ? rest_.size() + 1 : 0; } + + const W &Back() const { return rest_.empty() ? first_ : rest_.back(); } + + // When srt is true, assumes elements added sorted w.r.t Compare and merging + // of weights performed as needed. Otherwise, just ensures first_ is the + // least element wrt Compare. + void PushBack(W weight, bool srt); + + // Sorts the elements of the set. Assumes that first_, if present, is the + // least element. + void Sort() { rest_.sort(comp_); } + + private: + W &Back() { + if (rest_.empty()) { + return first_; + } else { + return rest_.back(); + } + } + + UnionWeight(W w1, W w2) : first_(std::move(w1)), rest_(1, std::move(w2)) {} + + W first_; // First weight in set. + std::list rest_; // Remaining weights in set. + Compare comp_; + Merge merge_; +}; + +template +void UnionWeight::PushBack(W weight, bool srt) { + if (!weight.Member()) { + rest_.push_back(std::move(weight)); + } else if (!first_.Member()) { + first_ = std::move(weight); + } else if (srt) { + auto &back = Back(); + if (comp_(back, weight)) { + rest_.push_back(std::move(weight)); + } else { + back = merge_(back, std::move(weight)); + } + } else { + if (comp_(first_, weight)) { + rest_.push_back(std::move(weight)); + } else { + rest_.push_back(first_); + first_ = std::move(weight); + } + } +} + +// Traverses union weight in the forward direction. +template +class UnionWeightIterator { + public: + explicit UnionWeightIterator(const UnionWeight &weight) + : first_(weight.first_), + rest_(weight.rest_), + init_(true), + it_(rest_.begin()) {} + + bool Done() const { return init_ ? !first_.Member() : it_ == rest_.end(); } + + const W &Value() const { return init_ ? first_ : *it_; } + + void Next() { + if (init_) { + init_ = false; + } else { + ++it_; + } + } + + void Reset() { + init_ = true; + it_ = rest_.begin(); + } + + private: + const W &first_; + const std::list &rest_; + bool init_; // in the initialized state? + typename std::list::const_iterator it_; +}; + +// Traverses union weight in backward direction. +template +class UnionWeightReverseIterator { + public: + explicit UnionWeightReverseIterator(const UnionWeight &weight) + : first_(weight.first_), + rest_(weight.rest_), + fin_(!first_.Member()), + it_(rest_.rbegin()) {} + + bool Done() const { return fin_; } + + const L &Value() const { return it_ == rest_.rend() ? first_ : *it_; } + + void Next() { + if (it_ == rest_.rend()) { + fin_ = true; + } else { + ++it_; + } + } + + void Reset() { + fin_ = !first_.Member(); + it_ = rest_.rbegin(); + } + + private: + const L &first_; + const std::list &rest_; + bool fin_; // in the final state? + typename std::list::const_reverse_iterator it_; +}; + +// UnionWeight member functions follow that require UnionWeightIterator. +template +inline std::istream &UnionWeight::Read(std::istream &istrm) { + Clear(); + int32 size; + ReadType(istrm, &size); + for (int i = 0; i < size; ++i) { + W weight; + ReadType(istrm, &weight); + PushBack(weight, true); + } + return istrm; +} + +template +inline std::ostream &UnionWeight::Write(std::ostream &ostrm) const { + const int32 size = Size(); + WriteType(ostrm, size); + for (UnionWeightIterator it(*this); !it.Done(); it.Next()) { + WriteType(ostrm, it.Value()); + } + return ostrm; +} + +template +inline bool UnionWeight::Member() const { + if (Size() <= 1) return true; + for (UnionWeightIterator it(*this); !it.Done(); it.Next()) { + if (!it.Value().Member()) return false; + } + return true; +} + +template +inline UnionWeight UnionWeight::Quantize(float delta) const { + UnionWeight weight; + for (UnionWeightIterator it(*this); !it.Done(); it.Next()) { + weight.PushBack(it.Value().Quantize(delta), true); + } + return weight; +} + +template +inline typename UnionWeight::ReverseWeight UnionWeight::Reverse() + const { + ReverseWeight weight; + for (UnionWeightIterator it(*this); !it.Done(); it.Next()) { + weight.PushBack(it.Value().Reverse(), false); + } + weight.Sort(); + return weight; +} + +template +inline size_t UnionWeight::Hash() const { + size_t h = 0; + static constexpr int lshift = 5; + static constexpr int rshift = CHAR_BIT * sizeof(size_t) - lshift; + for (UnionWeightIterator it(*this); !it.Done(); it.Next()) { + h = h << lshift ^ h >> rshift ^ it.Value().Hash(); + } + return h; +} + +// Requires union weight has been canonicalized. +template +inline bool operator==(const UnionWeight &w1, + const UnionWeight &w2) { + if (w1.Size() != w2.Size()) return false; + UnionWeightIterator it1(w1); + UnionWeightIterator it2(w2); + for (; !it1.Done(); it1.Next(), it2.Next()) { + if (it1.Value() != it2.Value()) return false; + } + return true; +} + +// Requires union weight has been canonicalized. +template +inline bool operator!=(const UnionWeight &w1, + const UnionWeight &w2) { + return !(w1 == w2); +} + +// Requires union weight has been canonicalized. +template +inline bool ApproxEqual(const UnionWeight &w1, + const UnionWeight &w2, float delta = kDelta) { + if (w1.Size() != w2.Size()) return false; + UnionWeightIterator it1(w1); + UnionWeightIterator it2(w2); + for (; !it1.Done(); it1.Next(), it2.Next()) { + if (!ApproxEqual(it1.Value(), it2.Value(), delta)) return false; + } + return true; +} + +template +inline std::ostream &operator<<(std::ostream &ostrm, + const UnionWeight &weight) { + UnionWeightIterator it(weight); + if (it.Done()) { + return ostrm << "EmptySet"; + } else if (!weight.Member()) { + return ostrm << "BadSet"; + } else { + CompositeWeightWriter writer(ostrm); + writer.WriteBegin(); + for (; !it.Done(); it.Next()) writer.WriteElement(it.Value()); + writer.WriteEnd(); + } + return ostrm; +} + +template +inline std::istream &operator>>(std::istream &istrm, + UnionWeight &weight) { + string s; + istrm >> s; + if (s == "EmptySet") { + weight = UnionWeight::Zero(); + } else if (s == "BadSet") { + weight = UnionWeight::NoWeight(); + } else { + weight = UnionWeight::Zero(); + std::istringstream sstrm(s); + CompositeWeightReader reader(sstrm); + reader.ReadBegin(); + bool more = true; + while (more) { + W v; + more = reader.ReadElement(&v); + weight.PushBack(v, true); + } + reader.ReadEnd(); + } + return istrm; +} + +template +inline UnionWeight Plus(const UnionWeight &w1, + const UnionWeight &w2) { + if (!w1.Member() || !w2.Member()) return UnionWeight::NoWeight(); + if (w1 == UnionWeight::Zero()) return w2; + if (w2 == UnionWeight::Zero()) return w1; + UnionWeightIterator it1(w1); + UnionWeightIterator it2(w2); + UnionWeight sum; + typename O::Compare comp; + while (!it1.Done() && !it2.Done()) { + const auto v1 = it1.Value(); + const auto v2 = it2.Value(); + if (comp(v1, v2)) { + sum.PushBack(v1, true); + it1.Next(); + } else { + sum.PushBack(v2, true); + it2.Next(); + } + } + for (; !it1.Done(); it1.Next()) sum.PushBack(it1.Value(), true); + for (; !it2.Done(); it2.Next()) sum.PushBack(it2.Value(), true); + return sum; +} + +template +inline UnionWeight Times(const UnionWeight &w1, + const UnionWeight &w2) { + if (!w1.Member() || !w2.Member()) return UnionWeight::NoWeight(); + if (w1 == UnionWeight::Zero() || w2 == UnionWeight::Zero()) { + return UnionWeight::Zero(); + } + UnionWeightIterator it1(w1); + UnionWeightIterator it2(w2); + UnionWeight prod1; + for (; !it1.Done(); it1.Next()) { + UnionWeight prod2; + for (; !it2.Done(); it2.Next()) { + prod2.PushBack(Times(it1.Value(), it2.Value()), true); + } + prod1 = Plus(prod1, prod2); + it2.Reset(); + } + return prod1; +} + +template +inline UnionWeight Divide(const UnionWeight &w1, + const UnionWeight &w2, DivideType typ) { + if (!w1.Member() || !w2.Member()) return UnionWeight::NoWeight(); + if (w1 == UnionWeight::Zero() || w2 == UnionWeight::Zero()) { + return UnionWeight::Zero(); + } + UnionWeightIterator it1(w1); + UnionWeightReverseIterator it2(w2); + UnionWeight quot; + if (w1.Size() == 1) { + for (; !it2.Done(); it2.Next()) { + quot.PushBack(Divide(it1.Value(), it2.Value(), typ), true); + } + } else if (w2.Size() == 1) { + for (; !it1.Done(); it1.Next()) { + quot.PushBack(Divide(it1.Value(), it2.Value(), typ), true); + } + } else { + quot = UnionWeight::NoWeight(); + } + return quot; +} + +// This function object generates weights over the union of weights for the +// underlying generators for the template weight types. This is intended +// primarily for testing. +template +class WeightGenerate> { + public: + using Weight = UnionWeight; + using Generate = WeightGenerate; + + explicit WeightGenerate(bool allow_zero = true, + size_t num_random_weights = kNumRandomWeights) + : generate_(false), allow_zero_(allow_zero), + num_random_weights_(num_random_weights) {} + + Weight operator()() const { + const int n = rand() % (num_random_weights_ + 1); // NOLINT + if (allow_zero_ && n == num_random_weights_) { + return Weight::Zero(); + } else if (n % 2 == 0) { + return Weight(generate_()); + } else { + return Plus(Weight(generate_()), Weight(generate_())); + } + } + + private: + Generate generate_; + // Permits Zero() and zero divisors. + bool allow_zero_; + // The number of alternative random weights. + const size_t num_random_weights_; +}; + +} // namespace fst + +#endif // FST_UNION_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/union.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/union.h new file mode 100644 index 0000000..257099b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/union.h @@ -0,0 +1,157 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions and classes to compute the union of two FSTs. + +#ifndef FST_UNION_H_ +#define FST_UNION_H_ + +#include +#include +#include + +#include +#include + + +namespace fst { + +// Computes the union (sum) of two FSTs. This version writes the union to an +// output MutableFst. If A transduces string x to y with weight a and B +// transduces string w to v with weight b, then their union transduces x to y +// with weight a and w to v with weight b. +// +// Complexity: +// +// Time: (V_2 + E_2) +// Space: O(V_2 + E_2) +// +// where Vi is the number of states, and Ei is the number of arcs, in the ith +// FST. +template +void Union(MutableFst *fst1, const Fst &fst2) { + using Weight = typename Arc::Weight; + // Checks for symbol table compatibility. + if (!CompatSymbols(fst1->InputSymbols(), fst2.InputSymbols()) || + !CompatSymbols(fst1->OutputSymbols(), fst2.OutputSymbols())) { + FSTERROR() << "Union: Input/output symbol tables of 1st argument " + << "do not match input/output symbol tables of 2nd argument"; + fst1->SetProperties(kError, kError); + return; + } + const auto numstates1 = fst1->NumStates(); + const bool initial_acyclic1 = fst1->Properties(kInitialAcyclic, true); + const auto props1 = fst1->Properties(kFstProperties, false); + const auto props2 = fst2.Properties(kFstProperties, false); + const auto start2 = fst2.Start(); + if (start2 == kNoStateId) { + if (props2 & kError) fst1->SetProperties(kError, kError); + return; + } + if (fst2.Properties(kExpanded, false)) { + fst1->ReserveStates(numstates1 + CountStates(fst2) + + (initial_acyclic1 ? 0 : 1)); + } + for (StateIterator> siter(fst2); !siter.Done(); siter.Next()) { + const auto s1 = fst1->AddState(); + const auto s2 = siter.Value(); + fst1->SetFinal(s1, fst2.Final(s2)); + fst1->ReserveArcs(s1, fst2.NumArcs(s2)); + for (ArcIterator> aiter(fst2, s2); !aiter.Done(); aiter.Next()) { + auto arc = aiter.Value(); // Copy intended. + arc.nextstate += numstates1; + fst1->AddArc(s1, std::move(arc)); + } + } + const auto start1 = fst1->Start(); + if (start1 == kNoStateId) { + fst1->SetStart(start2); + fst1->SetProperties(props2, kCopyProperties); + return; + } + if (initial_acyclic1) { + fst1->AddArc(start1, Arc(0, 0, Weight::One(), start2 + numstates1)); + } else { + const auto nstart1 = fst1->AddState(); + fst1->SetStart(nstart1); + fst1->AddArc(nstart1, Arc(0, 0, Weight::One(), start1)); + fst1->AddArc(nstart1, Arc(0, 0, Weight::One(), start2 + numstates1)); + } + fst1->SetProperties(UnionProperties(props1, props2), kFstProperties); +} + +// Computes the union of two FSTs, modifying the RationalFst argument. +template +void Union(RationalFst *fst1, const Fst &fst2) { + fst1->GetMutableImpl()->AddUnion(fst2); +} + +using UnionFstOptions = RationalFstOptions; + +// Computes the union (sum) of two FSTs. This version is a delayed FST. If A +// transduces string x to y with weight a and B transduces string w to v with +// weight b, then their union transduces x to y with weight a and w to v with +// weight b. +// +// Complexity: +// +// Time: O(v_1 + e_1 + v_2 + e_2) +// Space: O(v_1 + v_2) +// +// where vi is the number of states visited, and ei is the number of arcs +// visited, in the ith FST. Constant time and space to visit an input state or +// arc is assumed and exclusive of caching. +template +class UnionFst : public RationalFst { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + UnionFst(const Fst &fst1, const Fst &fst2) { + GetMutableImpl()->InitUnion(fst1, fst2); + } + + UnionFst(const Fst &fst1, const Fst &fst2, + const UnionFstOptions &opts) + : RationalFst(opts) { + GetMutableImpl()->InitUnion(fst1, fst2); + } + + // See Fst<>::Copy() for doc. + UnionFst(const UnionFst &fst, bool safe = false) + : RationalFst(fst, safe) {} + + // Gets a copy of this UnionFst. See Fst<>::Copy() for further doc. + UnionFst *Copy(bool safe = false) const override { + return new UnionFst(*this, safe); + } + + private: + using ImplToFst>::GetImpl; + using ImplToFst>::GetMutableImpl; +}; + +// Specialization for UnionFst. +template +class StateIterator> : public StateIterator> { + public: + explicit StateIterator(const UnionFst &fst) + : StateIterator>(fst) {} +}; + +// Specialization for UnionFst. +template +class ArcIterator> : public ArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const UnionFst &fst, StateId s) + : ArcIterator>(fst, s) {} +}; + +using StdUnionFst = UnionFst; + +} // namespace fst + +#endif // FST_UNION_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/util.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/util.h new file mode 100644 index 0000000..c752021 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/util.h @@ -0,0 +1,400 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST utility inline definitions. + +#ifndef FST_UTIL_H_ +#define FST_UTIL_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + + +// Utility for error handling. + +DECLARE_bool(fst_error_fatal); + +#define FSTERROR() \ + (FLAGS_fst_error_fatal ? LOG(FATAL) : LOG(ERROR)) + +namespace fst { + +// Utility for type I/O. + +// Reads types from an input stream. + +// Generic case. +template ::value, T>::type* = nullptr> +inline std::istream &ReadType(std::istream &strm, T *t) { + return t->Read(strm); +} + +// Numeric (boolean, integral, floating-point) case. +template ::value, T>::type* = nullptr> +inline std::istream &ReadType(std::istream &strm, T *t) { + return strm.read(reinterpret_cast(t), sizeof(T)); \ +} + +// String case. +inline std::istream &ReadType(std::istream &strm, string *s) { // NOLINT + s->clear(); + int32 ns = 0; + strm.read(reinterpret_cast(&ns), sizeof(ns)); + for (int32 i = 0; i < ns; ++i) { + char c; + strm.read(&c, 1); + *s += c; + } + return strm; +} + +// Pair case. +template +inline std::istream &ReadType(std::istream &strm, std::pair *p) { + ReadType(strm, &p->first); + ReadType(strm, &p->second); + return strm; +} + +template +inline std::istream &ReadType(std::istream &strm, std::pair *p) { + ReadType(strm, const_cast(&p->first)); + ReadType(strm, &p->second); + return strm; +} + +namespace internal { +template +std::istream &ReadContainerType(std::istream &strm, C *c, ReserveFn reserve) { + c->clear(); + int64 n = 0; + ReadType(strm, &n); + reserve(c, n); + auto insert = std::inserter(*c, c->begin()); + for (int64 i = 0; i < n; ++i) { + typename C::value_type value; + ReadType(strm, &value); + *insert = value; + } + return strm; +} +} // namespace internal + +template +std::istream &ReadType(std::istream &strm, std::vector *c) { + return internal::ReadContainerType( + strm, c, [](decltype(c) v, int n) { v->reserve(n); }); +} + +template +std::istream &ReadType(std::istream &strm, std::list *c) { + return internal::ReadContainerType(strm, c, [](decltype(c) v, int n) {}); +} + +template +std::istream &ReadType(std::istream &strm, std::set *c) { + return internal::ReadContainerType(strm, c, [](decltype(c) v, int n) {}); +} + +template +std::istream &ReadType(std::istream &strm, std::map *c) { + return internal::ReadContainerType(strm, c, [](decltype(c) v, int n) {}); +} + +template +std::istream &ReadType(std::istream &strm, std::unordered_set *c) { + return internal::ReadContainerType( + strm, c, [](decltype(c) v, int n) { v->reserve(n); }); +} + +template +std::istream &ReadType(std::istream &strm, std::unordered_map *c) { + return internal::ReadContainerType( + strm, c, [](decltype(c) v, int n) { v->reserve(n); }); +} + +// Writes types to an output stream. + +// Generic case. +template ::value, T>::type* = nullptr> +inline std::ostream &WriteType(std::ostream &strm, const T t) { + t.Write(strm); + return strm; +} + +// Numeric (boolean, integral, floating-point) case. +template ::value, T>::type* = nullptr> +inline std::ostream &WriteType(std::ostream &strm, const T t) { + return strm.write(reinterpret_cast(&t), sizeof(T)); +} + +// String case. +inline std::ostream &WriteType(std::ostream &strm, const string &s) { // NOLINT + int32 ns = s.size(); + strm.write(reinterpret_cast(&ns), sizeof(ns)); + return strm.write(s.data(), ns); +} + +// Pair case. +template +inline std::ostream &WriteType(std::ostream &strm, + const std::pair &p) { // NOLINT + WriteType(strm, p.first); + WriteType(strm, p.second); + return strm; +} + +namespace internal { +template +std::ostream &WriteContainer(std::ostream &strm, const C &c) { + const int64 n = c.size(); + WriteType(strm, n); + for (const auto &e : c) { + WriteType(strm, e); + } + return strm; +} +} // namespace internal + +template +std::ostream &WriteType(std::ostream &strm, const std::vector &c) { + return internal::WriteContainer(strm, c); +} + +template +std::ostream &WriteType(std::ostream &strm, const std::list &c) { + return internal::WriteContainer(strm, c); +} + +template +std::ostream &WriteType(std::ostream &strm, const std::set &c) { + return internal::WriteContainer(strm, c); +} + +template +std::ostream &WriteType(std::ostream &strm, const std::map &c) { + return internal::WriteContainer(strm, c); +} + +template +std::ostream &WriteType(std::ostream &strm, const std::unordered_set &c) { + return internal::WriteContainer(strm, c); +} + +template +std::ostream &WriteType(std::ostream &strm, const std::unordered_map &c) { + return internal::WriteContainer(strm, c); +} + +// Utilities for converting between int64 or Weight and string. + +int64 StrToInt64(const string &s, const string &src, size_t nline, + bool allow_negative, bool *error = nullptr); + +template +Weight StrToWeight(const string &s, const string &src, size_t nline) { + Weight w; + std::istringstream strm(s); + strm >> w; + if (!strm) { + FSTERROR() << "StrToWeight: Bad weight = \"" << s << "\", source = " << src + << ", line = " << nline; + return Weight::NoWeight(); + } + return w; +} + +template +void WeightToStr(Weight w, string *s) { + std::ostringstream strm; + strm.precision(9); + strm << w; + s->append(strm.str().data(), strm.str().size()); +} + +// Utilities for reading/writing integer pairs (typically labels) + +// Modifies line using a vector of pointers to a buffer beginning with line. +void SplitString(char *line, const char *delim, std::vector *vec, + bool omit_empty_strings); + +template +bool ReadIntPairs(const string &filename, std::vector> *pairs, + bool allow_negative = false) { + std::ifstream strm(filename, std::ios_base::in); + if (!strm) { + LOG(ERROR) << "ReadIntPairs: Can't open file: " << filename; + return false; + } + const int kLineLen = 8096; + char line[kLineLen]; + size_t nline = 0; + pairs->clear(); + while (strm.getline(line, kLineLen)) { + ++nline; + std::vector col; + SplitString(line, "\n\t ", &col, true); + // empty line or comment? + if (col.empty() || col[0][0] == '\0' || col[0][0] == '#') continue; + if (col.size() != 2) { + LOG(ERROR) << "ReadIntPairs: Bad number of columns, " + << "file = " << filename << ", line = " << nline; + return false; + } + bool err; + I i1 = StrToInt64(col[0], filename, nline, allow_negative, &err); + if (err) return false; + I i2 = StrToInt64(col[1], filename, nline, allow_negative, &err); + if (err) return false; + pairs->push_back(std::make_pair(i1, i2)); + } + return true; +} + +template +bool WriteIntPairs(const string &filename, + const std::vector> &pairs) { + std::ostream *strm = &std::cout; + if (!filename.empty()) { + strm = new std::ofstream(filename); + if (!*strm) { + LOG(ERROR) << "WriteIntPairs: Can't open file: " << filename; + return false; + } + } + for (ssize_t n = 0; n < pairs.size(); ++n) { + *strm << pairs[n].first << "\t" << pairs[n].second << "\n"; + } + if (!*strm) { + LOG(ERROR) << "WriteIntPairs: Write failed: " + << (filename.empty() ? "standard output" : filename); + return false; + } + if (strm != &std::cout) delete strm; + return true; +} + +// Utilities for reading/writing label pairs. + +template +bool ReadLabelPairs(const string &filename, + std::vector> *pairs, + bool allow_negative = false) { + return ReadIntPairs(filename, pairs, allow_negative); +} + +template +bool WriteLabelPairs(const string &filename, + const std::vector> &pairs) { + return WriteIntPairs(filename, pairs); +} + +// Utilities for converting a type name to a legal C symbol. + +void ConvertToLegalCSymbol(string *s); + +// Utilities for stream I/O. + +bool AlignInput(std::istream &strm); +bool AlignOutput(std::ostream &strm); + +// An associative container for which testing membership is faster than an STL +// set if members are restricted to an interval that excludes most non-members. +// A Key must have ==, !=, and < operators defined. Element NoKey should be a +// key that marks an uninitialized key and is otherwise unused. Find() returns +// an STL const_iterator to the match found, otherwise it equals End(). +template +class CompactSet { + public: + using const_iterator = typename std::set::const_iterator; + + CompactSet() : min_key_(NoKey), max_key_(NoKey) {} + + CompactSet(const CompactSet &compact_set) + : set_(compact_set.set_), + min_key_(compact_set.min_key_), + max_key_(compact_set.max_key_) {} + + void Insert(Key key) { + set_.insert(key); + if (min_key_ == NoKey || key < min_key_) min_key_ = key; + if (max_key_ == NoKey || max_key_ < key) max_key_ = key; + } + + void Erase(Key key) { + set_.erase(key); + if (set_.empty()) { + min_key_ = max_key_ = NoKey; + } else if (key == min_key_) { + ++min_key_; + } else if (key == max_key_) { + --max_key_; + } + } + + void Clear() { + set_.clear(); + min_key_ = max_key_ = NoKey; + } + + const_iterator Find(Key key) const { + if (min_key_ == NoKey || key < min_key_ || max_key_ < key) { + return set_.end(); + } else { + return set_.find(key); + } + } + + bool Member(Key key) const { + if (min_key_ == NoKey || key < min_key_ || max_key_ < key) { + return false; // out of range + } else if (min_key_ != NoKey && max_key_ + 1 == min_key_ + set_.size()) { + return true; // dense range + } else { + return set_.count(key); + } + } + + const_iterator Begin() const { return set_.begin(); } + + const_iterator End() const { return set_.end(); } + + // All stored keys are greater than or equal to this value. + Key LowerBound() const { return min_key_; } + + // All stored keys are less than or equal to this value. + Key UpperBound() const { return max_key_; } + + private: + std::set set_; + Key min_key_; + Key max_key_; + + void operator=(const CompactSet &) = delete; +}; + +} // namespace fst + +#endif // FST_UTIL_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/vector-fst.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/vector-fst.h new file mode 100644 index 0000000..7514bc5 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/vector-fst.h @@ -0,0 +1,796 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Simple concrete, mutable FST whose states and arcs are stored in STL vectors. + +#ifndef FST_VECTOR_FST_H_ +#define FST_VECTOR_FST_H_ + +#include +#include +#include + +#include + +#include // For optional argument declarations +#include +#include + + +namespace fst { + +template +class VectorFst; + +template +void Cast(const F &, G *); + +// Arcs (of type A) implemented by an STL vector per state. M specifies Arc +// allocator (default declared in fst-decl.h). +template */> +class VectorState { + public: + using Arc = A; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + using ArcAllocator = M; + using StateAllocator = + typename ArcAllocator::template rebind>::other; + + // Provide STL allocator for arcs. + explicit VectorState(const ArcAllocator &alloc) + : final_(Weight::Zero()), niepsilons_(0), noepsilons_(0), arcs_(alloc) {} + + VectorState(const VectorState &state, const ArcAllocator &alloc) + : final_(state.Final()), + niepsilons_(state.NumInputEpsilons()), + noepsilons_(state.NumOutputEpsilons()), + arcs_(state.arcs_.begin(), state.arcs_.end(), alloc) {} + + void Reset() { + final_ = Weight::Zero(); + niepsilons_ = 0; + noepsilons_ = 0; + arcs_.clear(); + } + + Weight Final() const { return final_; } + + size_t NumInputEpsilons() const { return niepsilons_; } + + size_t NumOutputEpsilons() const { return noepsilons_; } + + size_t NumArcs() const { return arcs_.size(); } + + const Arc &GetArc(size_t n) const { return arcs_[n]; } + + const Arc *Arcs() const { return !arcs_.empty() ? &arcs_[0] : nullptr; } + + Arc *MutableArcs() { return !arcs_.empty() ? &arcs_[0] : nullptr; } + + void ReserveArcs(size_t n) { arcs_.reserve(n); } + + void SetFinal(Weight weight) { final_ = std::move(weight); } + + void SetNumInputEpsilons(size_t n) { niepsilons_ = n; } + + void SetNumOutputEpsilons(size_t n) { noepsilons_ = n; } + + void AddArc(const Arc &arc) { + IncrementNumEpsilons(arc); + arcs_.push_back(arc); + } + + void AddArc(Arc &&arc) { + IncrementNumEpsilons(arc); + arcs_.push_back(std::move(arc)); + } + + template + void EmplaceArc(T&&... ctor_args) { + arcs_.emplace_back(std::forward(ctor_args)...); + IncrementNumEpsilons(arcs_.back()); + } + + void SetArc(const Arc &arc, size_t n) { + if (arcs_[n].ilabel == 0) --niepsilons_; + if (arcs_[n].olabel == 0) --noepsilons_; + IncrementNumEpsilons(arc); + arcs_[n] = arc; + } + + void DeleteArcs() { + niepsilons_ = 0; + noepsilons_ = 0; + arcs_.clear(); + } + + void DeleteArcs(size_t n) { + for (size_t i = 0; i < n; ++i) { + if (arcs_.back().ilabel == 0) --niepsilons_; + if (arcs_.back().olabel == 0) --noepsilons_; + arcs_.pop_back(); + } + } + + // For state class allocation. + void *operator new(size_t size, StateAllocator *alloc) { + return alloc->allocate(1); + } + + // For state destruction and memory freeing. + static void Destroy(VectorState *state, StateAllocator *alloc) { + if (state) { + state->~VectorState(); + alloc->deallocate(state, 1); + } + } + + private: + // Update the number of epsilons as a result of having added an arc. + void IncrementNumEpsilons(const Arc &arc) { + if (arc.ilabel == 0) ++niepsilons_; + if (arc.olabel == 0) ++noepsilons_; + } + + Weight final_; // Final weight. + size_t niepsilons_; // # of input epsilons + size_t noepsilons_; // # of output epsilons + std::vector arcs_; // Arc container. +}; + +namespace internal { + +// States are implemented by STL vectors, templated on the +// State definition. This does not manage the Fst properties. +template +class VectorFstBaseImpl : public FstImpl { + public: + using State = S; + using Arc = typename State::Arc; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + VectorFstBaseImpl() : start_(kNoStateId) {} + + ~VectorFstBaseImpl() override { + for (size_t s = 0; s < states_.size(); ++s) { + State::Destroy(states_[s], &state_alloc_); + } + } + + // Copying is not permitted. + VectorFstBaseImpl(const VectorFstBaseImpl &) = delete; + VectorFstBaseImpl &operator=(const VectorFstBaseImpl &) = delete; + + // Moving is permitted. + VectorFstBaseImpl(VectorFstBaseImpl &&impl) noexcept + : FstImpl(), + states_(std::move(impl.states_)), + start_(impl.start_) { + impl.states_.clear(); + impl.start_ = kNoStateId; + } + + VectorFstBaseImpl &operator=(VectorFstBaseImpl &&impl) noexcept { + states_ = std::move(impl.states_); + start_ = impl.start_; + impl.states_.clear(); + impl.start_ = kNoStateId; + return *this; + } + + StateId Start() const { return start_; } + + Weight Final(StateId state) const { return states_[state]->Final(); } + + StateId NumStates() const { return states_.size(); } + + size_t NumArcs(StateId state) const { return states_[state]->NumArcs(); } + + size_t NumInputEpsilons(StateId state) const { + return GetState(state)->NumInputEpsilons(); + } + + size_t NumOutputEpsilons(StateId state) const { + return GetState(state)->NumOutputEpsilons(); + } + + void SetStart(StateId state) { start_ = state; } + + void SetFinal(StateId state, Weight weight) { + states_[state]->SetFinal(std::move(weight)); + } + + StateId AddState() { + states_.push_back(new (&state_alloc_) State(arc_alloc_)); + return states_.size() - 1; + } + + StateId AddState(State *state) { + states_.push_back(state); + return states_.size() - 1; + } + + void AddArc(StateId state, const Arc &arc) { states_[state]->AddArc(arc); } + + void AddArc(StateId state, Arc &&arc) { + states_[state]->AddArc(std::move(arc)); + } + + template + void EmplaceArc(StateId state, T&&... ctor_args) { + states_[state]->EmplaceArc(std::forward(ctor_args)...); + } + + void DeleteStates(const std::vector &dstates) { + std::vector newid(states_.size(), 0); + for (size_t i = 0; i < dstates.size(); ++i) newid[dstates[i]] = kNoStateId; + StateId nstates = 0; + for (StateId state = 0; state < states_.size(); ++state) { + if (newid[state] != kNoStateId) { + newid[state] = nstates; + if (state != nstates) states_[nstates] = states_[state]; + ++nstates; + } else { + State::Destroy(states_[state], &state_alloc_); + } + } + states_.resize(nstates); + for (StateId state = 0; state < states_.size(); ++state) { + auto *arcs = states_[state]->MutableArcs(); + size_t narcs = 0; + auto nieps = states_[state]->NumInputEpsilons(); + auto noeps = states_[state]->NumOutputEpsilons(); + for (size_t i = 0; i < states_[state]->NumArcs(); ++i) { + const auto t = newid[arcs[i].nextstate]; + if (t != kNoStateId) { + arcs[i].nextstate = t; + if (i != narcs) arcs[narcs] = arcs[i]; + ++narcs; + } else { + if (arcs[i].ilabel == 0) --nieps; + if (arcs[i].olabel == 0) --noeps; + } + } + states_[state]->DeleteArcs(states_[state]->NumArcs() - narcs); + states_[state]->SetNumInputEpsilons(nieps); + states_[state]->SetNumOutputEpsilons(noeps); + } + if (Start() != kNoStateId) SetStart(newid[Start()]); + } + + void DeleteStates() { + for (size_t state = 0; state < states_.size(); ++state) { + State::Destroy(states_[state], &state_alloc_); + } + states_.clear(); + SetStart(kNoStateId); + } + + void DeleteArcs(StateId state, size_t n) { states_[state]->DeleteArcs(n); } + + void DeleteArcs(StateId state) { states_[state]->DeleteArcs(); } + + State *GetState(StateId state) { return states_[state]; } + + const State *GetState(StateId state) const { return states_[state]; } + + void SetState(StateId state, State *vstate) { states_[state] = vstate; } + + void ReserveStates(StateId n) { states_.reserve(n); } + + void ReserveArcs(StateId state, size_t n) { states_[state]->ReserveArcs(n); } + + // Provide information needed for generic state iterator. + void InitStateIterator(StateIteratorData *data) const { + data->base = nullptr; + data->nstates = states_.size(); + } + + // Provide information needed for generic arc iterator. + void InitArcIterator(StateId state, ArcIteratorData *data) const { + data->base = nullptr; + data->narcs = states_[state]->NumArcs(); + data->arcs = states_[state]->Arcs(); + data->ref_count = nullptr; + } + + private: + std::vector states_; // States represenation. + StateId start_; // Initial state. + typename State::StateAllocator state_alloc_; // For state allocation. + typename State::ArcAllocator arc_alloc_; // For arc allocation. +}; + +// This is a VectorFstBaseImpl container that holds VectorStates and manages FST +// properties. +template +class VectorFstImpl : public VectorFstBaseImpl { + public: + using State = S; + using Arc = typename State::Arc; + using Label = typename Arc::Label; + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + using FstImpl::SetInputSymbols; + using FstImpl::SetOutputSymbols; + using FstImpl::SetType; + using FstImpl::SetProperties; + using FstImpl::Properties; + + using VectorFstBaseImpl::Start; + using VectorFstBaseImpl::NumStates; + using VectorFstBaseImpl::GetState; + using VectorFstBaseImpl::ReserveArcs; + + friend class MutableArcIterator>; + + using BaseImpl = VectorFstBaseImpl; + + VectorFstImpl() { + SetType("vector"); + SetProperties(kNullProperties | kStaticProperties); + } + + explicit VectorFstImpl(const Fst &fst); + + static VectorFstImpl *Read(std::istream &strm, const FstReadOptions &opts); + + void SetStart(StateId state) { + BaseImpl::SetStart(state); + SetProperties(SetStartProperties(Properties())); + } + + void SetFinal(StateId state, Weight weight) { + const auto old_weight = BaseImpl::Final(state); + const auto properties = + SetFinalProperties(Properties(), old_weight, weight); + BaseImpl::SetFinal(state, std::move(weight)); + SetProperties(properties); + } + + StateId AddState() { + const auto state = BaseImpl::AddState(); + SetProperties(AddStateProperties(Properties())); + return state; + } + + void AddArc(StateId state, const Arc &arc) { + BaseImpl::AddArc(state, arc); + UpdatePropertiesAfterAddArc(state); + } + + void AddArc(StateId state, Arc &&arc) { + BaseImpl::AddArc(state, std::move(arc)); + UpdatePropertiesAfterAddArc(state); + } + + template + void EmplaceArc(StateId state, T&&... ctor_args) { + BaseImpl::EmplaceArc(state, std::forward(ctor_args)...); + UpdatePropertiesAfterAddArc(state); + } + + void DeleteStates(const std::vector &dstates) { + BaseImpl::DeleteStates(dstates); + SetProperties(DeleteStatesProperties(Properties())); + } + + void DeleteStates() { + BaseImpl::DeleteStates(); + SetProperties(DeleteAllStatesProperties(Properties(), kStaticProperties)); + } + + void DeleteArcs(StateId state, size_t n) { + BaseImpl::DeleteArcs(state, n); + SetProperties(DeleteArcsProperties(Properties())); + } + + void DeleteArcs(StateId state) { + BaseImpl::DeleteArcs(state); + SetProperties(DeleteArcsProperties(Properties())); + } + + // Properties always true of this FST class + static constexpr uint64 kStaticProperties = kExpanded | kMutable; + + private: + void UpdatePropertiesAfterAddArc(StateId state) { + auto *vstate = GetState(state); + const size_t num_arcs{vstate->NumArcs()}; + if (num_arcs) { + const auto &arc = vstate->GetArc(num_arcs - 1); + const auto *parc = (num_arcs < 2) + ? nullptr + : &(vstate->GetArc(num_arcs - 2)); + SetProperties(AddArcProperties(Properties(), state, arc, parc)); + } + } + + // Minimum file format version supported. + static constexpr int kMinFileVersion = 2; +}; + +template +constexpr uint64 VectorFstImpl::kStaticProperties; + +template +constexpr int VectorFstImpl::kMinFileVersion; + +template +VectorFstImpl::VectorFstImpl(const Fst &fst) { + SetType("vector"); + SetInputSymbols(fst.InputSymbols()); + SetOutputSymbols(fst.OutputSymbols()); + BaseImpl::SetStart(fst.Start()); + if (fst.Properties(kExpanded, false)) { + BaseImpl::ReserveStates(CountStates(fst)); + } + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + const auto state = siter.Value(); + BaseImpl::AddState(); + BaseImpl::SetFinal(state, fst.Final(state)); + ReserveArcs(state, fst.NumArcs(state)); + for (ArcIterator> aiter(fst, state); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + BaseImpl::AddArc(state, arc); + } + } + SetProperties(fst.Properties(kCopyProperties, false) | kStaticProperties); +} + +template +VectorFstImpl *VectorFstImpl::Read(std::istream &strm, + const FstReadOptions &opts) { + std::unique_ptr> impl(new VectorFstImpl()); + FstHeader hdr; + if (!impl->ReadHeader(strm, opts, kMinFileVersion, &hdr)) return nullptr; + impl->BaseImpl::SetStart(hdr.Start()); + if (hdr.NumStates() != kNoStateId) impl->ReserveStates(hdr.NumStates()); + StateId state = 0; + for (; hdr.NumStates() == kNoStateId || state < hdr.NumStates(); ++state) { + Weight weight; + if (!weight.Read(strm)) break; + impl->BaseImpl::AddState(); + auto *vstate = impl->GetState(state); + vstate->SetFinal(weight); + int64 narcs; + ReadType(strm, &narcs); + if (!strm) { + LOG(ERROR) << "VectorFst::Read: Read failed: " << opts.source; + return nullptr; + } + impl->ReserveArcs(state, narcs); + for (int64 i = 0; i < narcs; ++i) { + Arc arc; + ReadType(strm, &arc.ilabel); + ReadType(strm, &arc.olabel); + arc.weight.Read(strm); + ReadType(strm, &arc.nextstate); + if (!strm) { + LOG(ERROR) << "VectorFst::Read: Read failed: " << opts.source; + return nullptr; + } + impl->BaseImpl::AddArc(state, std::move(arc)); + } + } + if (hdr.NumStates() != kNoStateId && state != hdr.NumStates()) { + LOG(ERROR) << "VectorFst::Read: Unexpected end of file: " << opts.source; + return nullptr; + } + return impl.release(); +} + +} // namespace internal + +// Simple concrete, mutable FST. This class attaches interface to implementation +// and handles reference counting, delegating most methods to ImplToMutableFst. +// Also supports ReserveStates and ReserveArcs methods (cf. STL vector methods). +// The second optional template argument gives the State definition. +template */> +class VectorFst : public ImplToMutableFst> { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + using State = S; + using Impl = internal::VectorFstImpl; + + friend class StateIterator>; + friend class ArcIterator>; + friend class MutableArcIterator>; + + template + friend void Cast(const F &, G *); + + VectorFst() : ImplToMutableFst(std::make_shared()) {} + + explicit VectorFst(const Fst &fst) + : ImplToMutableFst(std::make_shared(fst)) {} + + VectorFst(const VectorFst &fst, bool safe = false) + : ImplToMutableFst(fst) {} + + VectorFst(VectorFst &&) noexcept; + + // Get a copy of this VectorFst. See Fst<>::Copy() for further doc. + VectorFst *Copy(bool safe = false) const override { + return new VectorFst(*this, safe); + } + + VectorFst &operator=(const VectorFst &) = default; + + VectorFst &operator=(VectorFst &&) noexcept; + + VectorFst &operator=(const Fst &fst) override { + if (this != &fst) SetImpl(std::make_shared(fst)); + return *this; + } + + template + void EmplaceArc(StateId state, T&&... ctor_args) { + MutateCheck(); + GetMutableImpl()->EmplaceArc(state, std::forward(ctor_args)...); + } + + // Reads a VectorFst from an input stream, returning nullptr on error. + static VectorFst *Read(std::istream &strm, + const FstReadOptions &opts) { + auto *impl = Impl::Read(strm, opts); + return impl ? new VectorFst(std::shared_ptr(impl)) + : nullptr; + } + + // Read a VectorFst from a file, returning nullptr on error; empty filename + // reads from standard input. + static VectorFst *Read(const string &filename) { + auto *impl = ImplToExpandedFst>::Read(filename); + return impl ? new VectorFst(std::shared_ptr(impl)) + : nullptr; + } + + bool Write(std::ostream &strm, const FstWriteOptions &opts) const override { + return WriteFst(*this, strm, opts); + } + + bool Write(const string &filename) const override { + return Fst::WriteFile(filename); + } + + template + static bool WriteFst(const FST &fst, std::ostream &strm, + const FstWriteOptions &opts); + + void InitStateIterator(StateIteratorData *data) const override { + GetImpl()->InitStateIterator(data); + } + + void InitArcIterator(StateId s, ArcIteratorData *data) const override { + GetImpl()->InitArcIterator(s, data); + } + + inline void InitMutableArcIterator(StateId s, + MutableArcIteratorData *) override; + + using ImplToMutableFst>::ReserveArcs; + using ImplToMutableFst>::ReserveStates; + + private: + using ImplToMutableFst>::GetImpl; + using ImplToMutableFst>::GetMutableImpl; + using ImplToMutableFst>::MutateCheck; + using ImplToMutableFst>::SetImpl; + + explicit VectorFst(std::shared_ptr impl) + : ImplToMutableFst(impl) {} +}; + +template +inline VectorFst::VectorFst( + VectorFst &&fst) noexcept = default; + +template +inline VectorFst &VectorFst::operator=( + VectorFst &&fst) noexcept = default; + +// Writes FST to file in Vector format, potentially with a pass over the machine +// before writing to compute number of states. +template +template +bool VectorFst::WriteFst(const FST &fst, std::ostream &strm, + const FstWriteOptions &opts) { + static constexpr int file_version = 2; + bool update_header = true; + FstHeader hdr; + hdr.SetStart(fst.Start()); + hdr.SetNumStates(kNoStateId); + std::streampos start_offset = 0; + if (fst.Properties(kExpanded, false) || opts.stream_write || + (start_offset = strm.tellp()) != -1) { + hdr.SetNumStates(CountStates(fst)); + update_header = false; + } + const auto properties = + fst.Properties(kCopyProperties, false) | Impl::kStaticProperties; + internal::FstImpl::WriteFstHeader(fst, strm, opts, file_version, + "vector", properties, &hdr); + StateId num_states = 0; + for (StateIterator siter(fst); !siter.Done(); siter.Next()) { + const auto s = siter.Value(); + fst.Final(s).Write(strm); + const int64 narcs = fst.NumArcs(s); + WriteType(strm, narcs); + for (ArcIterator aiter(fst, s); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + WriteType(strm, arc.ilabel); + WriteType(strm, arc.olabel); + arc.weight.Write(strm); + WriteType(strm, arc.nextstate); + } + ++num_states; + } + strm.flush(); + if (!strm) { + LOG(ERROR) << "VectorFst::Write: Write failed: " << opts.source; + return false; + } + if (update_header) { + hdr.SetNumStates(num_states); + return internal::FstImpl::UpdateFstHeader( + fst, strm, opts, file_version, "vector", properties, &hdr, + start_offset); + } else { + if (num_states != hdr.NumStates()) { + LOG(ERROR) << "Inconsistent number of states observed during write"; + return false; + } + } + return true; +} + +// Specialization for VectorFst; see generic version in fst.h for sample usage +// (but use the VectorFst type instead). This version should inline. +template +class StateIterator> { + public: + using StateId = typename Arc::StateId; + + explicit StateIterator(const VectorFst &fst) + : nstates_(fst.GetImpl()->NumStates()), s_(0) {} + + bool Done() const { return s_ >= nstates_; } + + StateId Value() const { return s_; } + + void Next() { ++s_; } + + void Reset() { s_ = 0; } + + private: + const StateId nstates_; + StateId s_; +}; + +// Specialization for VectorFst; see generic version in fst.h for sample usage +// (but use the VectorFst type instead). This version should inline. +template +class ArcIterator> { + public: + using StateId = typename Arc::StateId; + + ArcIterator(const VectorFst &fst, StateId s) + : arcs_(fst.GetImpl()->GetState(s)->Arcs()), + narcs_(fst.GetImpl()->GetState(s)->NumArcs()), + i_(0) {} + + bool Done() const { return i_ >= narcs_; } + + const Arc &Value() const { return arcs_[i_]; } + + void Next() { ++i_; } + + void Reset() { i_ = 0; } + + void Seek(size_t a) { i_ = a; } + + size_t Position() const { return i_; } + + constexpr uint32 Flags() const { return kArcValueFlags; } + + void SetFlags(uint32, uint32) {} + + private: + const Arc *arcs_; + size_t narcs_; + size_t i_; +}; + +// Specialization for VectorFst; see generic version in mutable-fst.h for sample +// usage (but use the VectorFst type instead). This version should inline. +template +class MutableArcIterator> + : public MutableArcIteratorBase { + public: + using StateId = typename Arc::StateId; + using Weight = typename Arc::Weight; + + MutableArcIterator(VectorFst *fst, StateId s) : i_(0) { + fst->MutateCheck(); + state_ = fst->GetMutableImpl()->GetState(s); + properties_ = &fst->GetImpl()->properties_; + } + + bool Done() const final { return i_ >= state_->NumArcs(); } + + const Arc &Value() const final { return state_->GetArc(i_); } + + void Next() final { ++i_; } + + size_t Position() const final { return i_; } + + void Reset() final { i_ = 0; } + + void Seek(size_t a) final { i_ = a; } + + void SetValue(const Arc &arc) final { + const auto &oarc = state_->GetArc(i_); + if (oarc.ilabel != oarc.olabel) *properties_ &= ~kNotAcceptor; + if (oarc.ilabel == 0) { + *properties_ &= ~kIEpsilons; + if (oarc.olabel == 0) *properties_ &= ~kEpsilons; + } + if (oarc.olabel == 0) *properties_ &= ~kOEpsilons; + if (oarc.weight != Weight::Zero() && oarc.weight != Weight::One()) { + *properties_ &= ~kWeighted; + } + state_->SetArc(arc, i_); + if (arc.ilabel != arc.olabel) { + *properties_ |= kNotAcceptor; + *properties_ &= ~kAcceptor; + } + if (arc.ilabel == 0) { + *properties_ |= kIEpsilons; + *properties_ &= ~kNoIEpsilons; + if (arc.olabel == 0) { + *properties_ |= kEpsilons; + *properties_ &= ~kNoEpsilons; + } + } + if (arc.olabel == 0) { + *properties_ |= kOEpsilons; + *properties_ &= ~kNoOEpsilons; + } + if (arc.weight != Weight::Zero() && arc.weight != Weight::One()) { + *properties_ |= kWeighted; + *properties_ &= ~kUnweighted; + } + *properties_ &= kSetArcProperties | kAcceptor | kNotAcceptor | kEpsilons | + kNoEpsilons | kIEpsilons | kNoIEpsilons | kOEpsilons | + kNoOEpsilons | kWeighted | kUnweighted; + } + + uint32 Flags() const final { return kArcValueFlags; } + + void SetFlags(uint32, uint32) final {} + + private: + State *state_; + uint64 *properties_; + size_t i_; +}; + +// Provides information needed for the generic mutable arc iterator. +template +inline void VectorFst::InitMutableArcIterator( + StateId s, MutableArcIteratorData *data) { + data->base = new MutableArcIterator>(this, s); +} + +// A useful alias when using StdArc. +using StdVectorFst = VectorFst; + +} // namespace fst + +#endif // FST_VECTOR_FST_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/verify.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/verify.h new file mode 100644 index 0000000..2ea8a64 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/verify.h @@ -0,0 +1,100 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Function to verify an FST's contents. + +#ifndef FST_VERIFY_H_ +#define FST_VERIFY_H_ + +#include + +#include +#include + + +namespace fst { + +// Verifies that an Fst's contents are sane. +template +bool Verify(const Fst &fst, bool allow_negative_labels = false) { + using StateId = typename Arc::StateId; + const auto start = fst.Start(); + const auto *isyms = fst.InputSymbols(); + const auto *osyms = fst.OutputSymbols(); + // Count states + StateId ns = 0; + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) ++ns; + if (start == kNoStateId && ns > 0) { + LOG(ERROR) << "Verify: FST start state ID not set"; + return false; + } else if (start >= ns) { + LOG(ERROR) << "Verify: FST start state ID exceeds number of states"; + return false; + } + for (StateIterator> siter(fst); !siter.Done(); siter.Next()) { + auto state = siter.Value(); + size_t na = 0; + for (ArcIterator> aiter(fst, state); !aiter.Done(); aiter.Next()) { + const auto &arc = aiter.Value(); + if (!allow_negative_labels && arc.ilabel < 0) { + LOG(ERROR) << "Verify: FST input label ID of arc at position " << na + << " of state " << state << " is negative"; + return false; + } else if (isyms && isyms->Find(arc.ilabel).empty()) { + LOG(ERROR) << "Verify: FST input label ID " << arc.ilabel + << " of arc at position " << na << " of state " << state + << " is missing from input symbol table \"" << isyms->Name() + << "\""; + return false; + } else if (!allow_negative_labels && arc.olabel < 0) { + LOG(ERROR) << "Verify: FST output label ID of arc at position " << na + << " of state " << state << " is negative"; + return false; + } else if (osyms && osyms->Find(arc.olabel).empty()) { + LOG(ERROR) << "Verify: FST output label ID " << arc.olabel + << " of arc at position " << na << " of state " << state + << " is missing from output symbol table \"" << osyms->Name() + << "\""; + return false; + } else if (!arc.weight.Member()) { + LOG(ERROR) << "Verify: FST weight of arc at position " << na + << " of state " << state << " is invalid"; + return false; + } else if (arc.nextstate < 0) { + LOG(ERROR) << "Verify: FST destination state ID of arc at position " + << na << " of state " << state << " is negative"; + return false; + } else if (arc.nextstate >= ns) { + LOG(ERROR) << "Verify: FST destination state ID of arc at position " + << na << " of state " << state + << " exceeds number of states"; + return false; + } + ++na; + } + if (!fst.Final(state).Member()) { + LOG(ERROR) << "Verify: FST final weight of state " << state + << " is invalid"; + return false; + } + } + const auto fst_props = fst.Properties(kFstProperties, false); + if (fst_props & kError) { + LOG(ERROR) << "Verify: FST error property is set"; + return false; + } + uint64 known_props; + uint64 test_props = + ComputeProperties(fst, kFstProperties, &known_props, false); + if (!CompatProperties(fst_props, test_props)) { + LOG(ERROR) << "Verify: Stored FST properties incorrect " + << "(props1 = stored props, props2 = tested)"; + return false; + } else { + return true; + } +} + +} // namespace fst + +#endif // FST_VERIFY_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/visit.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/visit.h new file mode 100644 index 0000000..c665804 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/visit.h @@ -0,0 +1,321 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Queue-dependent visitation of finite-state transducers. See also dfs-visit.h. + +#ifndef FST_VISIT_H_ +#define FST_VISIT_H_ + + +#include +#include + + +namespace fst { + +// Visitor Interface: class determining actions taken during a visit. If any of +// the boolean member functions return false, the visit is aborted by first +// calling FinishState() on all unfinished (grey) states and then calling +// FinishVisit(). +// +// Note this is more general than the visitor interface in dfs-visit.h but lacks +// some DFS-specific behavior. +// +// template +// class Visitor { +// public: +// using StateId = typename Arc::StateId; +// +// Visitor(T *return_data); +// +// // Invoked before visit. +// void InitVisit(const Fst &fst); +// +// // Invoked when state discovered (2nd arg is visitation root). +// bool InitState(StateId s, StateId root); +// +// // Invoked when arc to white/undiscovered state examined. +// bool WhiteArc(StateId s, const Arc &arc); +// +// // Invoked when arc to grey/unfinished state examined. +// bool GreyArc(StateId s, const Arc &arc); +// +// // Invoked when arc to black/finished state examined. +// bool BlackArc(StateId s, const Arc &arc); +// +// // Invoked when state finished. +// void FinishState(StateId s); +// +// // Invoked after visit. +// void FinishVisit(); +// }; + +// Performs queue-dependent visitation. Visitor class argument determines +// actions and contains any return data. ArcFilter determines arcs that are +// considered. If 'access_only' is true, performs visitation only to states +// accessible from the initial state. +template +void Visit(const FST &fst, Visitor *visitor, Queue *queue, ArcFilter filter, + bool access_only = false) { + using Arc = typename FST::Arc; + using StateId = typename Arc::StateId; + visitor->InitVisit(fst); + const auto start = fst.Start(); + if (start == kNoStateId) { + visitor->FinishVisit(); + return; + } + // An FST's state's visit color. + static constexpr uint8 kWhiteState = 0x01; // Undiscovered. + static constexpr uint8 kGreyState = 0x02; // Discovered & unfinished. + static constexpr uint8 kBlackState = 0x04; // Finished. + // We destroy an iterator as soon as possible and mark it so. + static constexpr uint8 kArcIterDone = 0x08; + std::vector state_status; + std::vector *> arc_iterator; + MemoryPool> aiter_pool; + StateId nstates = start + 1; // Number of known states in general case. + bool expanded = false; + if (fst.Properties(kExpanded, false)) { // Tests if expanded, then uses + nstates = CountStates(fst); // ExpandedFst::NumStates(). + expanded = true; + } + state_status.resize(nstates, kWhiteState); + arc_iterator.resize(nstates); + StateIterator> siter(fst); + // Continues visit while true. + bool visit = true; + // Iterates over trees in visit forest. + for (auto root = start; visit && root < nstates;) { + visit = visitor->InitState(root, root); + state_status[root] = kGreyState; + queue->Enqueue(root); + while (!queue->Empty()) { + auto state = queue->Head(); + if (state >= state_status.size()) { + nstates = state + 1; + state_status.resize(nstates, kWhiteState); + arc_iterator.resize(nstates); + } + // Creates arc iterator if needed. + if (!arc_iterator[state] && !(state_status[state] & kArcIterDone) && + visit) { + arc_iterator[state] = new (&aiter_pool) ArcIterator(fst, state); + } + // Deletes arc iterator if done. + auto *aiter = arc_iterator[state]; + if ((aiter && aiter->Done()) || !visit) { + Destroy(aiter, &aiter_pool); + arc_iterator[state] = nullptr; + state_status[state] |= kArcIterDone; + } + // Dequeues state and marks black if done. + if (state_status[state] & kArcIterDone) { + queue->Dequeue(); + visitor->FinishState(state); + state_status[state] = kBlackState; + continue; + } + const auto &arc = aiter->Value(); + if (arc.nextstate >= state_status.size()) { + nstates = arc.nextstate + 1; + state_status.resize(nstates, kWhiteState); + arc_iterator.resize(nstates); + } + // Visits respective arc types. + if (filter(arc)) { + // Enqueues destination state and marks grey if white. + if (state_status[arc.nextstate] == kWhiteState) { + visit = visitor->WhiteArc(state, arc); + if (!visit) continue; + visit = visitor->InitState(arc.nextstate, root); + state_status[arc.nextstate] = kGreyState; + queue->Enqueue(arc.nextstate); + } else if (state_status[arc.nextstate] == kBlackState) { + visit = visitor->BlackArc(state, arc); + } else { + visit = visitor->GreyArc(state, arc); + } + } + aiter->Next(); + // Destroys an iterator ASAP for efficiency. + if (aiter->Done()) { + Destroy(aiter, &aiter_pool); + arc_iterator[state] = nullptr; + state_status[state] |= kArcIterDone; + } + } + if (access_only) break; + // Finds next tree root. + for (root = (root == start) ? 0 : root + 1; + root < nstates && state_status[root] != kWhiteState; ++root) { + } + // Check for a state beyond the largest known state. + if (!expanded && root == nstates) { + for (; !siter.Done(); siter.Next()) { + if (siter.Value() == nstates) { + ++nstates; + state_status.push_back(kWhiteState); + arc_iterator.push_back(nullptr); + break; + } + } + } + } + visitor->FinishVisit(); +} + +template +inline void Visit(const Fst &fst, Visitor *visitor, Queue *queue) { + Visit(fst, visitor, queue, AnyArcFilter()); +} + +// Copies input FST to mutable FST following queue order. +template +class CopyVisitor { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + explicit CopyVisitor(MutableFst *ofst) : ifst_(nullptr), ofst_(ofst) {} + + void InitVisit(const Fst &ifst) { + ifst_ = &ifst; + ofst_->DeleteStates(); + ofst_->SetStart(ifst_->Start()); + } + + bool InitState(StateId state, StateId) { + while (ofst_->NumStates() <= state) ofst_->AddState(); + return true; + } + + bool WhiteArc(StateId state, const Arc &arc) { + ofst_->AddArc(state, arc); + return true; + } + + bool GreyArc(StateId state, const Arc &arc) { + ofst_->AddArc(state, arc); + return true; + } + + bool BlackArc(StateId state, const Arc &arc) { + ofst_->AddArc(state, arc); + return true; + } + + void FinishState(StateId state) { + ofst_->SetFinal(state, ifst_->Final(state)); + } + + void FinishVisit() {} + + private: + const Fst *ifst_; + MutableFst *ofst_; +}; + +// Visits input FST up to a state limit following queue order. +template +class PartialVisitor { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + explicit PartialVisitor(StateId maxvisit) + : fst_(nullptr), maxvisit_(maxvisit) {} + + void InitVisit(const Fst &ifst) { + fst_ = &ifst; + ninit_ = 0; + nfinish_ = 0; + } + + bool InitState(StateId state, StateId root) { + ++ninit_; + return ninit_ <= maxvisit_; + } + + bool WhiteArc(StateId state, const Arc &arc) { return true; } + + bool GreyArc(StateId state, const Arc &arc) { return true; } + + bool BlackArc(StateId state, const Arc &arc) { return true; } + + void FinishState(StateId state) { + fst_->Final(state); // Visits super-final arc. + ++nfinish_; + } + + void FinishVisit() {} + + StateId NumInitialized() { return ninit_; } + + StateId NumFinished() { return nfinish_; } + + private: + const Fst *fst_; + StateId maxvisit_; + StateId ninit_; + StateId nfinish_; +}; + +// Copies input FST to mutable FST up to a state limit following queue order. +template +class PartialCopyVisitor : public CopyVisitor { + public: + using Arc = A; + using StateId = typename Arc::StateId; + + using CopyVisitor::WhiteArc; + + PartialCopyVisitor(MutableFst *ofst, StateId maxvisit, + bool copy_grey = true, bool copy_black = true) + : CopyVisitor(ofst), maxvisit_(maxvisit), + copy_grey_(copy_grey), copy_black_(copy_black) {} + + void InitVisit(const Fst &ifst) { + CopyVisitor::InitVisit(ifst); + ninit_ = 0; + nfinish_ = 0; + } + + bool InitState(StateId state, StateId root) { + CopyVisitor::InitState(state, root); + ++ninit_; + return ninit_ <= maxvisit_; + } + + bool GreyArc(StateId state, const Arc &arc) { + if (copy_grey_) return CopyVisitor::GreyArc(state, arc); + return true; + } + + bool BlackArc(StateId state, const Arc &arc) { + if (copy_black_) return CopyVisitor::BlackArc(state, arc); + return true; + } + + void FinishState(StateId state) { + CopyVisitor::FinishState(state); + ++nfinish_; + } + + void FinishVisit() {} + + StateId NumInitialized() { return ninit_; } + + StateId NumFinished() { return nfinish_; } + + private: + StateId maxvisit_; + StateId ninit_; + StateId nfinish_; + const bool copy_grey_; + const bool copy_black_; +}; + +} // namespace fst + +#endif // FST_VISIT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/include/fst/weight.h b/runtime/onnxruntime/third_party/openfst/src/include/fst/weight.h new file mode 100644 index 0000000..ea012ec --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/include/fst/weight.h @@ -0,0 +1,389 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// General weight set and associated semiring operation definitions. + +#ifndef FST_WEIGHT_H_ +#define FST_WEIGHT_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +DECLARE_string(fst_weight_parentheses); +DECLARE_string(fst_weight_separator); + +namespace fst { + +// A semiring is specified by two binary operations Plus and Times and two +// designated elements Zero and One with the following properties: +// +// Plus: associative, commutative, and has Zero as its identity. +// +// Times: associative and has identity One, distributes w.r.t. Plus, and +// has Zero as an annihilator: +// Times(Zero(), a) == Times(a, Zero()) = Zero(). +// +// A left semiring distributes on the left; a right semiring is similarly +// defined. +// +// A Weight class must have binary functions Plus and Times and static member +// functions Zero() and One() and these must form (at least) a left or right +// semiring. +// +// In addition, the following should be defined for a Weight: +// +// Member: predicate on set membership. +// +// NoWeight: static member function that returns an element that is +// not a set member; used to signal an error. +// +// >>: reads textual representation of a weight. +// +// <<: prints textual representation of a weight. +// +// Read(istream &istrm): reads binary representation of a weight. +// +// Write(ostream &ostrm): writes binary representation of a weight. +// +// Hash: maps weight to size_t. +// +// ApproxEqual: approximate equality (for inexact weights) +// +// Quantize: quantizes w.r.t delta (for inexact weights) +// +// Divide: +// - In a left semiring, for all a, b, b', c: +// if Times(a, b) = c, Divide(c, a, DIVIDE_LEFT) = b' and b'.Member(), +// then Times(a, b') = c. +// - In a right semiring, for all a, a', b, c: +// if Times(a, b) = c, Divide(c, b, DIVIDE_RIGHT) = a' and a'.Member(), +// then Times(a', b) = c. +// - In a commutative semiring, +// * for all a, c: +// Divide(c, a, DIVIDE_ANY) = Divide(c, a, DIVIDE_LEFT) +// = Divide(c, a, DIVIDE_RIGHT) +// * for all a, b, b', c: +// if Times(a, b), Divide(c, a, DIVIDE_ANY) = b' and b'.Member(), +// then Times(a, b') = c +// - In the case where there exist no b such that c = Times(a, b), the +// return value of Divide(c, a, DIVIDE_LEFT) is unspecified. Returning +// Weight::NoWeight() is recommemded but not required in order to +// allow the most efficient implementation. +// - All algorithms in this library only call Divide(c, a) when it is +// guaranteed that there exists a b such that c = Times(a, b). +// +// ReverseWeight: the type of the corresponding reverse weight. +// +// Typically the same type as Weight for a (both left and right) semiring. +// For the left string semiring, it is the right string semiring. +// +// Reverse: a mapping from Weight to ReverseWeight s.t. +// +// --> Reverse(Reverse(a)) = a +// --> Reverse(Plus(a, b)) = Plus(Reverse(a), Reverse(b)) +// --> Reverse(Times(a, b)) = Times(Reverse(b), Reverse(a)) +// Typically the identity mapping in a (both left and right) semiring. +// In the left string semiring, it maps to the reverse string in the right +// string semiring. +// +// Properties: specifies additional properties that hold: +// LeftSemiring: indicates weights form a left semiring. +// RightSemiring: indicates weights form a right semiring. +// Commutative: for all a,b: Times(a,b) == Times(b,a) +// Idempotent: for all a: Plus(a, a) == a. +// Path: for all a, b: Plus(a, b) == a or Plus(a, b) == b. + +// CONSTANT DEFINITIONS + +// A representable float near .001. +constexpr float kDelta = 1.0F / 1024.0F; + +// For all a, b, c: Times(c, Plus(a, b)) = Plus(Times(c, a), Times(c, b)). +constexpr uint64 kLeftSemiring = 0x0000000000000001ULL; + +// For all a, b, c: Times(Plus(a, b), c) = Plus(Times(a, c), Times(b, c)). +constexpr uint64 kRightSemiring = 0x0000000000000002ULL; + +constexpr uint64 kSemiring = kLeftSemiring | kRightSemiring; + +// For all a, b: Times(a, b) = Times(b, a). +constexpr uint64 kCommutative = 0x0000000000000004ULL; + +// For all a: Plus(a, a) = a. +constexpr uint64 kIdempotent = 0x0000000000000008ULL; + +// For all a, b: Plus(a, b) = a or Plus(a, b) = b. +constexpr uint64 kPath = 0x0000000000000010ULL; + +// For random weight generation: default number of distinct weights. +// This is also used for a few other weight generation defaults. +constexpr size_t kNumRandomWeights = 5; + +// Weight property boolean constants needed for SFINAE. + +// MSVC compiler bug workaround: an expression containing W::Properties() cannot +// be directly used as a value argument to std::enable_if or integral_constant. +// WeightPropertiesThunk::Properties works instead, however. +namespace bug { +template +struct WeightPropertiesThunk { + WeightPropertiesThunk() = delete; + constexpr static const uint64 Properties = W::Properties(); +}; + +template +using TestWeightProperties = std::integral_constant::Properties & props) == props>; +} // namespace bug + +template +using IsIdempotent = bug::TestWeightProperties; + +template +using IsPath = bug::TestWeightProperties; + + +// Determines direction of division. +enum DivideType { + DIVIDE_LEFT, // left division + DIVIDE_RIGHT, // right division + DIVIDE_ANY +}; // division in a commutative semiring + +// NATURAL ORDER +// +// By definition: +// +// a <= b iff a + b = a +// +// The natural order is a negative partial order iff the semiring is +// idempotent. It is trivially monotonic for plus. It is left +// (resp. right) monotonic for times iff the semiring is left +// (resp. right) distributive. It is a total order iff the semiring +// has the path property. +// +// For more information, see: +// +// Mohri, M. 2002. Semiring framework and algorithms for shortest-distance +// problems, Journal of Automata, Languages and +// Combinatorics 7(3): 321-350, 2002. +// +// We define the strict version of this order below. + +template +class NaturalLess { +public: + using Weight = W; + + NaturalLess() { + if (!(W::Properties() & kIdempotent)) { + FSTERROR() << "NaturalLess: Weight type is not idempotent: " << W::Type(); + } + } + + bool operator()(const W &w1, const W &w2) const { + return (Plus(w1, w2) == w1) && w1 != w2; + } +}; + +// Power is the iterated product for arbitrary semirings such that Power(w, 0) +// is One() for the semiring, and Power(w, n) = Times(Power(w, n - 1), w). +template +Weight Power(const Weight &weight, size_t n) { + auto result = Weight::One(); + for (size_t i = 0; i < n; ++i) result = Times(result, weight); + return result; +} + +// Simple default adder class. Specializations might be more complex. +template +class Adder { + public: + explicit Adder(Weight w = Weight::Zero()) : sum_(w) { } + + Weight Add(const Weight &w) { + sum_ = Plus(sum_, w); + return sum_; + } + + Weight Sum() { return sum_; } + + void Reset(Weight w = Weight::Zero()) { sum_ = w; } + + private: + Weight sum_; +}; + +// General weight converter: raises error. +template +struct WeightConvert { + W2 operator()(W1 w1) const { + FSTERROR() << "WeightConvert: Can't convert weight from \"" << W1::Type() + << "\" to \"" << W2::Type(); + return W2::NoWeight(); + } +}; + +// Specialized weight converter to self. +template +struct WeightConvert { + W operator()(W weight) const { return weight; } +}; + +// General random weight generator: raises error. +template +struct WeightGenerate { + W operator()() const { + FSTERROR() << "WeightGenerate: No random generator for " << W::Type(); + return W::NoWeight(); + } +}; + +namespace internal { + +class CompositeWeightIO { + public: + CompositeWeightIO(); + CompositeWeightIO(char separator, std::pair parentheses); + + std::pair parentheses() const { + return {open_paren_, close_paren_}; + } + char separator() const { return separator_; } + + bool error() const { return error_; } + + protected: + const char separator_; + const char open_paren_; + const char close_paren_; + + private: + bool error_; +}; + +} // namespace internal + +// Helper class for writing textual composite weights. +class CompositeWeightWriter : public internal::CompositeWeightIO { + public: + // Uses configuration from flags (FLAGS_fst_weight_separator, + // FLAGS_fst_weight_parentheses). + explicit CompositeWeightWriter(std::ostream &ostrm); + + // parentheses defines the opening and closing parenthesis characters. + // Set parentheses = {0, 0} to disable writing parenthesis. + CompositeWeightWriter(std::ostream &ostrm, char separator, + std::pair parentheses); + + CompositeWeightWriter(const CompositeWeightWriter &) = delete; + CompositeWeightWriter &operator=(const CompositeWeightWriter &) = delete; + + // Writes open parenthesis to a stream if option selected. + void WriteBegin(); + + // Writes element to a stream. + template + void WriteElement(const T &comp) { + if (i_++ > 0) ostrm_ << separator_; + ostrm_ << comp; + } + + // Writes close parenthesis to a stream if option selected. + void WriteEnd(); + + private: + std::ostream &ostrm_; + int i_ = 0; // Element position. +}; + +// Helper class for reading textual composite weights. Elements are separated by +// a separator character. There must be at least one element per textual +// representation. Parentheses characters should be set if the composite +// weights themselves contain composite weights to ensure proper parsing. +class CompositeWeightReader : public internal::CompositeWeightIO { + public: + // Uses configuration from flags (FLAGS_fst_weight_separator, + // FLAGS_fst_weight_parentheses). + explicit CompositeWeightReader(std::istream &istrm); + + // parentheses defines the opening and closing parenthesis characters. + // Set parentheses = {0, 0} to disable reading parenthesis. + CompositeWeightReader(std::istream &istrm, char separator, + std::pair parentheses); + + CompositeWeightReader(const CompositeWeightReader &) = delete; + CompositeWeightReader &operator=(const CompositeWeightReader &) = delete; + + // Reads open parenthesis from a stream if option selected. + void ReadBegin(); + + // Reads element from a stream. The second argument, when true, indicates that + // this will be the last element (allowing more forgiving formatting of the + // last element). Returns false when last element is read. + template + bool ReadElement(T *comp, bool last = false); + + // Finalizes reading. + void ReadEnd(); + + private: + std::istream &istrm_; // Input stream. + int c_ = 0; // Last character read, or EOF. + int depth_ = 0; // Weight parentheses depth. +}; + +template +inline bool CompositeWeightReader::ReadElement(T *comp, bool last) { + string s; + const bool has_parens = open_paren_ != 0; + while ((c_ != std::istream::traits_type::eof()) && !std::isspace(c_) && + (c_ != separator_ || depth_ > 1 || last) && + (c_ != close_paren_ || depth_ != 1)) { + s += c_; + // If parentheses encountered before separator, they must be matched. + if (has_parens && c_ == open_paren_) { + ++depth_; + } else if (has_parens && c_ == close_paren_) { + // Failure on unmatched parentheses. + if (depth_ == 0) { + FSTERROR() << "CompositeWeightReader: Unmatched close paren: " + << "Is the fst_weight_parentheses flag set correctly?"; + istrm_.clear(std::ios::badbit); + return false; + } + --depth_; + } + c_ = istrm_.get(); + } + if (s.empty()) { + FSTERROR() << "CompositeWeightReader: Empty element: " + << "Is the fst_weight_parentheses flag set correctly?"; + istrm_.clear(std::ios::badbit); + return false; + } + std::istringstream istrm(s); + istrm >> *comp; + // Skips separator/close parenthesis. + if (c_ != std::istream::traits_type::eof() && !std::isspace(c_)) { + c_ = istrm_.get(); + } + const bool is_eof = c_ == std::istream::traits_type::eof(); + // Clears fail bit if just EOF. + if (is_eof && !istrm_.bad()) istrm_.clear(std::ios::eofbit); + return !is_eof && !std::isspace(c_); +} + +} // namespace fst + +#endif // FST_WEIGHT_H_ diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt new file mode 100644 index 0000000..9097bd8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt @@ -0,0 +1,50 @@ +FILE(GLOB HEADER_FILES ../include/fst/*.h) + +if(WIN32) +add_library(fst STATIC + compat.cc + flags.cc + fst-types.cc + fst.cc + mapped-file.cc + properties.cc + symbol-table.cc + symbol-table-ops.cc + util.cc + weight.cc + ${HEADER_FILES} +) +else() +add_library(fst + compat.cc + flags.cc + fst-types.cc + fst.cc + mapped-file.cc + properties.cc + symbol-table.cc + symbol-table-ops.cc + util.cc + weight.cc + ${HEADER_FILES} +) +endif() + +set_target_properties(fst PROPERTIES + SOVERSION "${SOVERSION}" +) + +include_directories(${CMAKE_SOURCE_DIR}/build/third_party/glog) +include_directories(${CMAKE_SOURCE_DIR}/third_party/glog/src) +link_directories(${CMAKE_SOURCE_DIR}/build/third_party/glog) + +include_directories(${CMAKE_SOURCE_DIR}/third_party/gflags/src/include) +link_directories(${CMAKE_SOURCE_DIR}/build/third_party/gflags) + +target_link_libraries(fst PUBLIC glog gflags) +add_dependencies(fst glog gflags) + +install(TARGETS fst + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib) diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/lib/Makefile.am new file mode 100644 index 0000000..5849178 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/Makefile.am @@ -0,0 +1,8 @@ +AM_CPPFLAGS = -I$(srcdir)/../include $(ICU_CPPFLAGS) + +lib_LTLIBRARIES = libfst.la +libfst_la_SOURCES = compat.cc flags.cc fst.cc fst-types.cc mapped-file.cc \ + properties.cc symbol-table.cc symbol-table-ops.cc \ + weight.cc util.cc +libfst_la_LDFLAGS = -version-info 16:0:0 +libfst_la_LIBADD = $(DL_LIBS) diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/lib/Makefile.in new file mode 100644 index 0000000..d7e5545 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/Makefile.in @@ -0,0 +1,684 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libfst_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libfst_la_OBJECTS = compat.lo flags.lo fst.lo fst-types.lo \ + mapped-file.lo properties.lo symbol-table.lo \ + symbol-table-ops.lo weight.lo util.lo +libfst_la_OBJECTS = $(am_libfst_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(libfst_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfst_la_SOURCES) +DIST_SOURCES = $(libfst_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../include $(ICU_CPPFLAGS) +lib_LTLIBRARIES = libfst.la +libfst_la_SOURCES = compat.cc flags.cc fst.cc fst-types.cc mapped-file.cc \ + properties.cc symbol-table.cc symbol-table-ops.cc \ + weight.cc util.cc + +libfst_la_LDFLAGS = -version-info 16:0:0 +libfst_la_LIBADD = $(DL_LIBS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/lib/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfst.la: $(libfst_la_OBJECTS) $(libfst_la_DEPENDENCIES) $(EXTRA_libfst_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfst_la_LINK) -rpath $(libdir) $(libfst_la_OBJECTS) $(libfst_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flags.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fst-types.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapped-file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/properties.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbol-table-ops.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbol-table.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weight.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/compat.cc b/runtime/onnxruntime/third_party/openfst/src/lib/compat.cc new file mode 100644 index 0000000..1b2ef46 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/compat.cc @@ -0,0 +1,45 @@ +// compat.cc +// +// 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 applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Author: riley@google.com (Michael Riley) +// +// \file +// Google compatibility definitions. + +#include +#include + +using namespace std; + +void FailedNewHandler() { + cerr << "Memory allocation failed\n"; + exit(1); +} + +#ifdef _MSC_VER + +const char *basename(const char *path) { + //the man page for the original basename states the function + //can return a pointer to an internal static structure + //so this might be ugly but still within the scope of acceptable behavior + char basename[_MAX_FNAME]; + char ext[_MAX_EXT]; + static char full_path[_MAX_EXT + _MAX_FNAME]; + + _splitpath(path, NULL, NULL, basename, ext); + _makepath(full_path, NULL, NULL, basename, ext); + return full_path; +} + +#endif // _MSC_VER diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/flags.cc b/runtime/onnxruntime/third_party/openfst/src/lib/flags.cc new file mode 100644 index 0000000..95f7e2e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/flags.cc @@ -0,0 +1,166 @@ +// 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 applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Google-style flag handling definitions. + +#include + +#if _MSC_VER +#include +#include +#endif + +#include +#include + +static const char *private_tmpdir = getenv("TMPDIR"); + +// DEFINE_int32(v, 0, "verbosity level"); +// DEFINE_bool(help, false, "show usage information"); +// DEFINE_bool(helpshort, false, "show brief usage information"); +#ifndef _MSC_VER +DEFINE_string(tmpdir, private_tmpdir ? private_tmpdir : "/tmp", + "temporary directory"); +#else +DEFINE_string(tmpdir, private_tmpdir ? private_tmpdir : getenv("TEMP"), + "temporary directory"); +#endif // !_MSC_VER + +using namespace std; + +static string flag_usage; +static string prog_src; + +// Sets prog_src to src. +static void SetProgSrc(const char *src) { + prog_src = src; +#if _MSC_VER + // This common code is invoked by all FST binaries, and only by them. Switch + // stdin and stdout into "binary" mode, so that 0x0A won't be translated into + // a 0x0D 0x0A byte pair in a pipe or a shell redirect. Other streams are + // already using ios::binary where binary files are read or written. + // Kudos to @daanzu for the suggested fix. + // https://github.com/kkm000/openfst/issues/20 + // https://github.com/kkm000/openfst/pull/23 + // https://github.com/kkm000/openfst/pull/32 + _setmode(_fileno(stdin), O_BINARY); + _setmode(_fileno(stdout), O_BINARY); +#endif + // Remove "-main" in src filename. Flags are defined in fstx.cc but SetFlags() + // is called in fstx-main.cc, which results in a filename mismatch in + // ShowUsageRestrict() below. + static constexpr char kMainSuffix[] = "-main.cc"; + const int prefix_length = prog_src.size() - strlen(kMainSuffix); + if (prefix_length > 0 && prog_src.substr(prefix_length) == kMainSuffix) { + prog_src.erase(prefix_length, strlen("-main")); + } +} + +void SetFlags(const char *usage, int *argc, char ***argv, + bool remove_flags, const char *src) { + flag_usage = usage; + SetProgSrc(src); + + int index = 1; + for (; index < *argc; ++index) { + string argval = (*argv)[index]; + if (argval[0] != '-' || argval == "-") break; + while (argval[0] == '-') argval = argval.substr(1); // Removes initial '-'. + string arg = argval; + string val = ""; + // Splits argval (arg=val) into arg and val. + auto pos = argval.find("="); + if (pos != string::npos) { + arg = argval.substr(0, pos); + val = argval.substr(pos + 1); + } + auto bool_register = FlagRegister::GetRegister(); + if (bool_register->SetFlag(arg, val)) + continue; + auto string_register = FlagRegister::GetRegister(); + if (string_register->SetFlag(arg, val)) + continue; + auto int32_register = FlagRegister::GetRegister(); + if (int32_register->SetFlag(arg, val)) + continue; + auto int64_register = FlagRegister::GetRegister(); + if (int64_register->SetFlag(arg, val)) + continue; + auto double_register = FlagRegister::GetRegister(); + if (double_register->SetFlag(arg, val)) + continue; + LOG(FATAL) << "SetFlags: Bad option: " << (*argv)[index]; + } + if (remove_flags) { + for (auto i = 0; i < *argc - index; ++i) { + (*argv)[i + 1] = (*argv)[i + index]; + } + *argc -= index - 1; + } + // if (FLAGS_help) { + // ShowUsage(true); + // exit(1); + // } + // if (FLAGS_helpshort) { + // ShowUsage(false); + // exit(1); + // } +} + +// If flag is defined in file 'src' and 'in_src' true or is not +// defined in file 'src' and 'in_src' is false, then print usage. +static void +ShowUsageRestrict(const std::set> &usage_set, + const string &src, bool in_src, bool show_file) { + string old_file; + bool file_out = false; + bool usage_out = false; + for (const auto &pair : usage_set) { + const auto &file = pair.first; + const auto &usage = pair.second; + bool match = file == src; + if ((match && !in_src) || (!match && in_src)) continue; + if (file != old_file) { + if (show_file) { + if (file_out) cout << "\n"; + cout << "Flags from: " << file << "\n"; + file_out = true; + } + old_file = file; + } + cout << usage << "\n"; + usage_out = true; + } + if (usage_out) cout << "\n"; +} + +void ShowUsage(bool long_usage) { + std::set> usage_set; + cout << flag_usage << "\n"; + auto bool_register = FlagRegister::GetRegister(); + bool_register->GetUsage(&usage_set); + auto string_register = FlagRegister::GetRegister(); + string_register->GetUsage(&usage_set); + auto int32_register = FlagRegister::GetRegister(); + int32_register->GetUsage(&usage_set); + auto int64_register = FlagRegister::GetRegister(); + int64_register->GetUsage(&usage_set); + auto double_register = FlagRegister::GetRegister(); + double_register->GetUsage(&usage_set); + if (!prog_src.empty()) { + cout << "PROGRAM FLAGS:\n\n"; + ShowUsageRestrict(usage_set, prog_src, true, false); + } + if (!long_usage) return; + if (!prog_src.empty()) cout << "LIBRARY FLAGS:\n\n"; + ShowUsageRestrict(usage_set, prog_src, false, true); +} diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/fst-types.cc b/runtime/onnxruntime/third_party/openfst/src/lib/fst-types.cc new file mode 100644 index 0000000..eb853a6 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/fst-types.cc @@ -0,0 +1,44 @@ +// Registration of common FST and arc types. + +#include +#include +#include +#include +#include +#include + +namespace fst { + +REGISTER_FST(VectorFst, StdArc); +REGISTER_FST(VectorFst, LogArc); +REGISTER_FST(VectorFst, Log64Arc); + +REGISTER_FST(ConstFst, StdArc); +REGISTER_FST(ConstFst, LogArc); +REGISTER_FST(ConstFst, Log64Arc); + +REGISTER_FST(EditFst, StdArc); +REGISTER_FST(EditFst, LogArc); +REGISTER_FST(EditFst, Log64Arc); + +REGISTER_FST(CompactStringFst, StdArc); +REGISTER_FST(CompactStringFst, LogArc); +REGISTER_FST(CompactStringFst, Log64Arc); + +REGISTER_FST(CompactWeightedStringFst, StdArc); +REGISTER_FST(CompactWeightedStringFst, LogArc); +REGISTER_FST(CompactWeightedStringFst, Log64Arc); + +REGISTER_FST(CompactAcceptorFst, StdArc); +REGISTER_FST(CompactAcceptorFst, LogArc); +REGISTER_FST(CompactAcceptorFst, Log64Arc); + +REGISTER_FST(CompactUnweightedFst, StdArc); +REGISTER_FST(CompactUnweightedFst, LogArc); +REGISTER_FST(CompactUnweightedFst, Log64Arc); + +REGISTER_FST(CompactUnweightedAcceptorFst, StdArc); +REGISTER_FST(CompactUnweightedAcceptorFst, LogArc); +REGISTER_FST(CompactUnweightedAcceptorFst, Log64Arc); + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/fst.cc b/runtime/onnxruntime/third_party/openfst/src/lib/fst.cc new file mode 100644 index 0000000..569cfe5 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/fst.cc @@ -0,0 +1,151 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST definitions. + +#include + +#include + +#include +#include +#include // declarations of *_lookahead_fst_type + +// FST flag definitions. + +DEFINE_bool(fst_verify_properties, false, + "Verify FST properties queried by TestProperties"); + +DEFINE_bool(fst_default_cache_gc, true, "Enable garbage collection of cache"); + +DEFINE_int64(fst_default_cache_gc_limit, 1 << 20LL, + "Cache byte size that triggers garbage collection"); + +DEFINE_bool(fst_align, false, "Write FST data aligned where appropriate"); + +DEFINE_string(save_relabel_ipairs, "", "Save input relabel pairs to file"); +DEFINE_string(save_relabel_opairs, "", "Save output relabel pairs to file"); + +DEFINE_string(fst_read_mode, "read", + "Default file reading mode for mappable files"); + +namespace fst { + +// FST type definitions for lookahead FSTs. +const char arc_lookahead_fst_type[] = "arc_lookahead"; +const char ilabel_lookahead_fst_type[] = "ilabel_lookahead"; +const char olabel_lookahead_fst_type[] = "olabel_lookahead"; + +// Identifies stream data as an FST (and its endianity). +constexpr int32 kFstMagicNumber = 2125659606; + +// Checks for FST magic number in stream, to indicate caller function that the +// stream content is an FST header. +bool IsFstHeader(std::istream &strm, const string &) { + int64 pos = strm.tellg(); + bool match = true; + int32 magic_number = 0; + ReadType(strm, &magic_number); + if (magic_number != kFstMagicNumber) { + match = false; + } + strm.seekg(pos); + return match; +} + +// Checks FST magic number and reads in the header; if rewind = true, +// the stream is repositioned before call if possible. +bool FstHeader::Read(std::istream &strm, const string &source, bool rewind) { + int64 pos = 0; + if (rewind) pos = strm.tellg(); + int32 magic_number = 0; + ReadType(strm, &magic_number); + if (magic_number != kFstMagicNumber) { + LOG(ERROR) << "FstHeader::Read: Bad FST header: " << source; + if (rewind) strm.seekg(pos); + return false; + } + ReadType(strm, &fsttype_); + ReadType(strm, &arctype_); + ReadType(strm, &version_); + ReadType(strm, &flags_); + ReadType(strm, &properties_); + ReadType(strm, &start_); + ReadType(strm, &numstates_); + ReadType(strm, &numarcs_); + if (!strm) { + LOG(ERROR) << "FstHeader::Read: Read failed: " << source; + return false; + } + if (rewind) strm.seekg(pos); + return true; +} + +// Writes FST magic number and FST header. +bool FstHeader::Write(std::ostream &strm, const string &) const { + WriteType(strm, kFstMagicNumber); + WriteType(strm, fsttype_); + WriteType(strm, arctype_); + WriteType(strm, version_); + WriteType(strm, flags_); + WriteType(strm, properties_); + WriteType(strm, start_); + WriteType(strm, numstates_); + WriteType(strm, numarcs_); + return true; +} + +string FstHeader::DebugString() const { + std::ostringstream ostrm; + ostrm << "fsttype: \"" << fsttype_ << "\" arctype: \"" << arctype_ + << "\" version: \"" << version_ << "\" flags: \"" << flags_ + << "\" properties: \"" << properties_ << "\" start: \"" << start_ + << "\" numstates: \"" << numstates_ << "\" numarcs: \"" << numarcs_ + << "\""; + return ostrm.str(); +} + +FstReadOptions::FstReadOptions(const string &source, const FstHeader *header, + const SymbolTable *isymbols, + const SymbolTable *osymbols) + : source(source), + header(header), + isymbols(isymbols), + osymbols(osymbols), + read_isymbols(true), + read_osymbols(true) { + mode = ReadMode(FLAGS_fst_read_mode); +} + +FstReadOptions::FstReadOptions(const string &source, + const SymbolTable *isymbols, + const SymbolTable *osymbols) + : source(source), + header(nullptr), + isymbols(isymbols), + osymbols(osymbols), + read_isymbols(true), + read_osymbols(true) { + mode = ReadMode(FLAGS_fst_read_mode); +} + +FstReadOptions::FileReadMode FstReadOptions::ReadMode(const string &mode) { + if (mode == "read") return READ; + if (mode == "map") return MAP; + LOG(ERROR) << "Unknown file read mode " << mode; + return READ; +} + +string FstReadOptions::DebugString() const { + std::ostringstream ostrm; + ostrm << "source: \"" << source << "\" mode: \"" + << (mode == READ ? "READ" : "MAP") << "\" read_isymbols: \"" + << (read_isymbols ? "true" : "false") << "\" read_osymbols: \"" + << (read_osymbols ? "true" : "false") << "\" header: \"" + << (header ? "set" : "null") << "\" isymbols: \"" + << (isymbols ? "set" : "null") << "\" osymbols: \"" + << (osymbols ? "set" : "null") << "\""; + return ostrm.str(); +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/libfst.vcxproj b/runtime/onnxruntime/third_party/openfst/src/lib/libfst.vcxproj new file mode 100644 index 0000000..6fcb74f --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/libfst.vcxproj @@ -0,0 +1,134 @@ + + + + + {DE80EFEC-9ED9-4631-BD96-8568C31ED26D} + StaticLibrary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/libfst.vcxproj.filters b/runtime/onnxruntime/third_party/openfst/src/lib/libfst.vcxproj.filters new file mode 100644 index 0000000..2c15c32 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/libfst.vcxproj.filters @@ -0,0 +1,359 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/mapped-file.cc b/runtime/onnxruntime/third_party/openfst/src/lib/mapped-file.cc new file mode 100644 index 0000000..caaf54b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/mapped-file.cc @@ -0,0 +1,147 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// + +#include + +#include +#include +#ifdef HAVE_SYS_MMAN +#include +#endif // HAVE_SYS_MMAN +#ifndef _MSC_VER +#include +#include +#endif // _MSC_VER + +#include +#include +#include + +#include + +namespace fst { + +MappedFile::MappedFile(const MemoryRegion ®ion) : region_(region) {} + +MappedFile::~MappedFile() { + if (region_.size != 0) { +#ifdef HAVE_SYS_MMAN + if (region_.mmap) { + VLOG(2) << "munmap'ed " << region_.size << " bytes at " << region_.mmap; + if (munmap(region_.mmap, region_.size) != 0) { + LOG(ERROR) << "Failed to unmap region: " << strerror(errno); + } + } else +#endif // HAVE_SYS_MMAN + { + if (region_.data) { + operator delete(static_cast(region_.data) - region_.offset); + } + } + } +} + +MappedFile *MappedFile::Map(std::istream *istrm, bool memorymap, + const string &source, size_t size) { + (void)memorymap; + const auto spos = istrm->tellg(); +#ifdef HAVE_SYS_MMAN + VLOG(2) << "memorymap: " << (memorymap ? "true" : "false") << " source: \"" + << source << "\"" + << " size: " << size << " offset: " << spos; + if (memorymap && spos >= 0 && spos % kArchAlignment == 0) { + const size_t pos = spos; + const int fd = open(source.c_str(), O_RDONLY); + if (fd != -1) { + std::unique_ptr mmf(MapFromFileDescriptor(fd, pos, size)); + if (close(fd) == 0 && mmf != nullptr) { + istrm->seekg(pos + size, std::ios::beg); + if (istrm) { + VLOG(2) << "mmap'ed region of " << size << " at offset " << pos + << " from " << source << " to addr " << mmf->region_.mmap; + return mmf.release(); + } + } else { + LOG(INFO) << "Mapping of file failed: " << strerror(errno); + } + } + } + + // If all else fails, reads from the file into the allocated buffer. + if (memorymap) { + LOG(WARNING) << "File mapping at offset " << spos << " of file " << source + << " could not be honored, reading instead"; + } +#endif // HAVE_SYS_MMAN + + // Reads the file into the buffer in chunks not larger than kMaxReadChunk. + std::unique_ptr mf(Allocate(size)); + auto *buffer = reinterpret_cast(mf->mutable_data()); + while (size > 0) { + const auto next_size = std::min(size, kMaxReadChunk); + const auto current_pos = istrm->tellg(); + if (!istrm->read(buffer, next_size)) { + LOG(ERROR) << "Failed to read " << next_size << " bytes at offset " + << current_pos << "from \"" << source << "\""; + return nullptr; + } + size -= next_size; + buffer += next_size; + VLOG(2) << "Read " << next_size << " bytes. " << size << " remaining"; + } + return mf.release(); +} + +MappedFile *MappedFile::MapFromFileDescriptor(int fd, int pos, size_t size) { +#ifdef HAVE_SYS_MMAN + const int pagesize = sysconf(_SC_PAGESIZE); + const off_t offset = pos % pagesize; + const off_t upsize = size + offset; + void *map = mmap(nullptr, upsize, PROT_READ, MAP_SHARED, fd, pos - offset); + if (map == MAP_FAILED) { + LOG(ERROR) << "mmap failed for fd=" << fd << " size=" << upsize + << " offset=" << (pos - offset); + return nullptr; + } + MemoryRegion region; + region.mmap = map; + region.size = upsize; + region.data = + reinterpret_cast(reinterpret_cast(map) + offset); + region.offset = offset; + return new MappedFile(region); +#else + return nullptr; +#endif // HAVE_SYS_MMAN +} + +MappedFile *MappedFile::Allocate(size_t size, int align) { + MemoryRegion region; + region.data = nullptr; + region.offset = 0; + if (size > 0) { + char *buffer = static_cast(operator new(size + align)); + size_t address = reinterpret_cast(buffer); + region.offset = kArchAlignment - (address % align); + region.data = buffer + region.offset; + } + region.mmap = nullptr; + region.size = size; + return new MappedFile(region); +} + +MappedFile *MappedFile::Borrow(void *data) { + MemoryRegion region; + region.data = data; + region.mmap = data; + region.size = 0; + region.offset = 0; + return new MappedFile(region); +} + +constexpr int MappedFile::kArchAlignment; + +constexpr size_t MappedFile::kMaxReadChunk; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/properties.cc b/runtime/onnxruntime/third_party/openfst/src/lib/properties.cc new file mode 100644 index 0000000..3cd276e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/properties.cc @@ -0,0 +1,421 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Functions for updating property bits for various FST operations and +// string names of the properties. + +#include + +#include +#include + +namespace fst { + +// These functions determine the properties associated with the FST result of +// various finite-state operations. The property arguments correspond to the +// operation's FST arguments. The properties returned assume the operation +// modifies its first argument. Bitwise-and this result with kCopyProperties for +// the case when a new (possibly delayed) FST is instead constructed. + +// Properties for a concatenatively-closed FST. +uint64 ClosureProperties(uint64 inprops, bool, bool delayed) { + auto outprops = (kError | kAcceptor | kUnweighted | kAccessible) & inprops; + if (inprops & kUnweighted) outprops |= kUnweightedCycles; + if (!delayed) { + outprops |= + (kExpanded | kMutable | kCoAccessible | kNotTopSorted | kNotString) & + inprops; + } + if (!delayed || inprops & kAccessible) { + outprops |= (kNotAcceptor | kNonIDeterministic | kNonODeterministic | + kNotILabelSorted | kNotOLabelSorted | kWeighted | + kWeightedCycles | kNotAccessible | kNotCoAccessible) & inprops; + if ((inprops & kWeighted) && (inprops & kAccessible) && + (inprops & kCoAccessible)) { + outprops |= kWeightedCycles; + } + } + return outprops; +} + +// Properties for a complemented FST. +uint64 ComplementProperties(uint64 inprops) { + auto outprops = kAcceptor | kUnweighted | kUnweightedCycles | kNoEpsilons | + kNoIEpsilons | kNoOEpsilons | kIDeterministic | + kODeterministic | kAccessible; + outprops |= + (kError | kILabelSorted | kOLabelSorted | kInitialCyclic) & inprops; + if (inprops & kAccessible) { + outprops |= kNotILabelSorted | kNotOLabelSorted | kCyclic; + } + return outprops; +} + +// Properties for a composed FST. +uint64 ComposeProperties(uint64 inprops1, uint64 inprops2) { + auto outprops = kError & (inprops1 | inprops2); + if (inprops1 & kAcceptor && inprops2 & kAcceptor) { + outprops |= kAcceptor | kAccessible; + outprops |= (kNoEpsilons | kNoIEpsilons | kNoOEpsilons | kAcyclic | + kInitialAcyclic) & + inprops1 & inprops2; + if (kNoIEpsilons & inprops1 & inprops2) { + outprops |= (kIDeterministic | kODeterministic) & inprops1 & inprops2; + } + } else { + outprops |= kAccessible; + outprops |= (kAcceptor | kNoIEpsilons | kAcyclic | kInitialAcyclic) & + inprops1 & inprops2; + if (kNoIEpsilons & inprops1 & inprops2) { + outprops |= kIDeterministic & inprops1 & inprops2; + } + } + return outprops; +} + +// Properties for a concatenated FST. +uint64 ConcatProperties(uint64 inprops1, uint64 inprops2, bool delayed) { + auto outprops = (kAcceptor | kUnweighted | kUnweightedCycles | kAcyclic) & + inprops1 & inprops2; + outprops |= kError & (inprops1 | inprops2); + const bool empty1 = delayed; // Can the first FST be the empty machine? + const bool empty2 = delayed; // Can the second FST be the empty machine? + if (!delayed) { + outprops |= (kExpanded | kMutable | kNotTopSorted | kNotString) & inprops1; + outprops |= (kNotTopSorted | kNotString) & inprops2; + } + if (!empty1) outprops |= (kInitialAcyclic | kInitialCyclic) & inprops1; + if (!delayed || inprops1 & kAccessible) { + outprops |= (kNotAcceptor | kNonIDeterministic | kNonODeterministic | + kEpsilons | kIEpsilons | kOEpsilons | kNotILabelSorted | + kNotOLabelSorted | kWeighted | kWeightedCycles | kCyclic | + kNotAccessible | kNotCoAccessible) & + inprops1; + } + if ((inprops1 & (kAccessible | kCoAccessible)) == + (kAccessible | kCoAccessible) && + !empty1) { + outprops |= kAccessible & inprops2; + if (!empty2) outprops |= kCoAccessible & inprops2; + if (!delayed || inprops2 & kAccessible) { + outprops |= (kNotAcceptor | kNonIDeterministic | kNonODeterministic | + kEpsilons | kIEpsilons | kOEpsilons | kNotILabelSorted | + kNotOLabelSorted | kWeighted | kWeightedCycles | kCyclic | + kNotAccessible | kNotCoAccessible) & + inprops2; + } + } + return outprops; +} + +// Properties for a determinized FST. +uint64 DeterminizeProperties(uint64 inprops, bool has_subsequential_label, + bool distinct_psubsequential_labels) { + auto outprops = kAccessible; + if ((kAcceptor & inprops) || + ((kNoIEpsilons & inprops) && distinct_psubsequential_labels) || + (has_subsequential_label && distinct_psubsequential_labels)) { + outprops |= kIDeterministic; + } + outprops |= (kError | kAcceptor | kAcyclic | kInitialAcyclic | kCoAccessible | + kString) & + inprops; + if ((inprops & kNoIEpsilons) && distinct_psubsequential_labels) { + outprops |= kNoEpsilons & inprops; + } + if (inprops & kAccessible) { + outprops |= (kIEpsilons | kOEpsilons | kCyclic) & inprops; + } + if (inprops & kAcceptor) outprops |= (kNoIEpsilons | kNoOEpsilons) & inprops; + if ((inprops & kNoIEpsilons) && has_subsequential_label) { + outprops |= kNoIEpsilons; + } + return outprops; +} + +// Properties for factored weight FST. +uint64 FactorWeightProperties(uint64 inprops) { + auto outprops = (kExpanded | kMutable | kError | kAcceptor | kAcyclic | + kAccessible | kCoAccessible) & + inprops; + if (inprops & kAccessible) { + outprops |= (kNotAcceptor | kNonIDeterministic | kNonODeterministic | + kEpsilons | kIEpsilons | kOEpsilons | kCyclic | + kNotILabelSorted | kNotOLabelSorted) & + inprops; + } + return outprops; +} + +// Properties for an inverted FST. +uint64 InvertProperties(uint64 inprops) { + auto outprops = (kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | + kEpsilons | kNoEpsilons | kWeighted | kUnweighted | + kWeightedCycles | kUnweightedCycles | kCyclic | kAcyclic | + kInitialCyclic | kInitialAcyclic | kTopSorted | + kNotTopSorted | kAccessible | kNotAccessible | + kCoAccessible | kNotCoAccessible | kString | kNotString) & + inprops; + if (kIDeterministic & inprops) outprops |= kODeterministic; + if (kNonIDeterministic & inprops) outprops |= kNonODeterministic; + if (kODeterministic & inprops) outprops |= kIDeterministic; + if (kNonODeterministic & inprops) outprops |= kNonIDeterministic; + + if (kIEpsilons & inprops) outprops |= kOEpsilons; + if (kNoIEpsilons & inprops) outprops |= kNoOEpsilons; + if (kOEpsilons & inprops) outprops |= kIEpsilons; + if (kNoOEpsilons & inprops) outprops |= kNoIEpsilons; + + if (kILabelSorted & inprops) outprops |= kOLabelSorted; + if (kNotILabelSorted & inprops) outprops |= kNotOLabelSorted; + if (kOLabelSorted & inprops) outprops |= kILabelSorted; + if (kNotOLabelSorted & inprops) outprops |= kNotILabelSorted; + return outprops; +} + +// Properties for a projected FST. +uint64 ProjectProperties(uint64 inprops, bool project_input) { + auto outprops = kAcceptor; + outprops |= (kExpanded | kMutable | kError | kWeighted | kUnweighted | + kWeightedCycles | kUnweightedCycles | + kCyclic | kAcyclic | kInitialCyclic | kInitialAcyclic | + kTopSorted | kNotTopSorted | kAccessible | kNotAccessible | + kCoAccessible | kNotCoAccessible | kString | kNotString) & + inprops; + if (project_input) { + outprops |= (kIDeterministic | kNonIDeterministic | kIEpsilons | + kNoIEpsilons | kILabelSorted | kNotILabelSorted) & + inprops; + + if (kIDeterministic & inprops) outprops |= kODeterministic; + if (kNonIDeterministic & inprops) outprops |= kNonODeterministic; + + if (kIEpsilons & inprops) outprops |= kOEpsilons | kEpsilons; + if (kNoIEpsilons & inprops) outprops |= kNoOEpsilons | kNoEpsilons; + + if (kILabelSorted & inprops) outprops |= kOLabelSorted; + if (kNotILabelSorted & inprops) outprops |= kNotOLabelSorted; + } else { + outprops |= (kODeterministic | kNonODeterministic | kOEpsilons | + kNoOEpsilons | kOLabelSorted | kNotOLabelSorted) & + inprops; + + if (kODeterministic & inprops) outprops |= kIDeterministic; + if (kNonODeterministic & inprops) outprops |= kNonIDeterministic; + + if (kOEpsilons & inprops) outprops |= kIEpsilons | kEpsilons; + if (kNoOEpsilons & inprops) outprops |= kNoIEpsilons | kNoEpsilons; + + if (kOLabelSorted & inprops) outprops |= kILabelSorted; + if (kNotOLabelSorted & inprops) outprops |= kNotILabelSorted; + } + return outprops; +} + +// Properties for a randgen FST. +uint64 RandGenProperties(uint64 inprops, bool weighted) { + auto outprops = kAcyclic | kInitialAcyclic | kAccessible | kUnweightedCycles; + outprops |= inprops & kError; + if (weighted) { + outprops |= kTopSorted; + outprops |= + (kAcceptor | kNoEpsilons | kNoIEpsilons | kNoOEpsilons | + kIDeterministic | kODeterministic | kILabelSorted | kOLabelSorted) & + inprops; + } else { + outprops |= kUnweighted; + outprops |= (kAcceptor | kILabelSorted | kOLabelSorted) & inprops; + } + return outprops; +} + +// Properties for a replace FST. +uint64 ReplaceProperties(const std::vector& inprops, size_t root, + bool epsilon_on_call, bool epsilon_on_return, + bool out_epsilon_on_call, bool out_epsilon_on_return, + bool replace_transducer, bool no_empty_fsts, + bool all_ilabel_sorted, bool all_olabel_sorted, + bool all_negative_or_dense) { + if (inprops.empty()) return kNullProperties; + uint64 outprops = 0; + for (auto inprop : inprops) outprops |= kError & inprop; + uint64 access_props = no_empty_fsts ? kAccessible | kCoAccessible : 0; + for (auto inprop : inprops) { + access_props &= (inprop & (kAccessible | kCoAccessible)); + } + if (access_props == (kAccessible | kCoAccessible)) { + outprops |= access_props; + if (inprops[root] & kInitialCyclic) outprops |= kInitialCyclic; + uint64 props = 0; + bool string = true; + for (auto inprop : inprops) { + if (replace_transducer) props |= kNotAcceptor & inprop; + props |= (kNonIDeterministic | kNonODeterministic | kEpsilons | + kIEpsilons | kOEpsilons | kWeighted | kWeightedCycles | + kCyclic | kNotTopSorted | kNotString) & inprop; + if (!(inprop & kString)) string = false; + } + outprops |= props; + if (string) outprops |= kString; + } + bool acceptor = !replace_transducer; + bool ideterministic = !epsilon_on_call && epsilon_on_return; + bool no_iepsilons = !epsilon_on_call && !epsilon_on_return; + bool acyclic = true; + bool unweighted = true; + for (size_t i = 0; i < inprops.size(); ++i) { + if (!(inprops[i] & kAcceptor)) acceptor = false; + if (!(inprops[i] & kIDeterministic)) ideterministic = false; + if (!(inprops[i] & kNoIEpsilons)) no_iepsilons = false; + if (!(inprops[i] & kAcyclic)) acyclic = false; + if (!(inprops[i] & kUnweighted)) unweighted = false; + if (i != root && !(inprops[i] & kNoIEpsilons)) ideterministic = false; + } + if (acceptor) outprops |= kAcceptor; + if (ideterministic) outprops |= kIDeterministic; + if (no_iepsilons) outprops |= kNoIEpsilons; + if (acyclic) outprops |= kAcyclic; + if (unweighted) outprops |= kUnweighted; + if (inprops[root] & kInitialAcyclic) outprops |= kInitialAcyclic; + // We assume that all terminals are positive. The resulting ReplaceFst is + // known to be kILabelSorted when: (1) all sub-FSTs are kILabelSorted, (2) the + // input label of the return arc is epsilon, and (3) one of the 3 following + // conditions is satisfied: + // + // 1. the input label of the call arc is not epsilon + // 2. all non-terminals are negative, or + // 3. all non-terninals are positive and form a dense range containing 1. + if (all_ilabel_sorted && epsilon_on_return && + (!epsilon_on_call || all_negative_or_dense)) { + outprops |= kILabelSorted; + } + // Similarly, the resulting ReplaceFst is known to be kOLabelSorted when: (1) + // all sub-FSTs are kOLabelSorted, (2) the output label of the return arc is + // epsilon, and (3) one of the 3 following conditions is satisfied: + // + // 1. the output label of the call arc is not epsilon + // 2. all non-terminals are negative, or + // 3. all non-terninals are positive and form a dense range containing 1. + if (all_olabel_sorted && out_epsilon_on_return && + (!out_epsilon_on_call || all_negative_or_dense)) { + outprops |= kOLabelSorted; + } + return outprops; +} + +// Properties for a relabeled FST. +uint64 RelabelProperties(uint64 inprops) { + static constexpr auto outprops = + kExpanded | kMutable | kError | kWeighted | kUnweighted | + kWeightedCycles | kUnweightedCycles | kCyclic | kAcyclic | + kInitialCyclic | kInitialAcyclic | kTopSorted | kNotTopSorted | + kAccessible | kNotAccessible | kCoAccessible | kNotCoAccessible | + kString | kNotString; + return outprops & inprops; +} + +// Properties for a reversed FST (the superinitial state limits this set). +uint64 ReverseProperties(uint64 inprops, bool has_superinitial) { + auto outprops = (kExpanded | kMutable | kError | kAcceptor | kNotAcceptor | + kEpsilons | kIEpsilons | kOEpsilons | kUnweighted | kCyclic | + kAcyclic | kWeightedCycles | kUnweightedCycles) & + inprops; + if (has_superinitial) outprops |= kWeighted & inprops; + return outprops; +} + +// Properties for re-weighted FST. +uint64 ReweightProperties(uint64 inprops) { + auto outprops = inprops & kWeightInvariantProperties; + outprops = outprops & ~kCoAccessible; + return outprops; +} + +// Properties for an epsilon-removed FST. +uint64 RmEpsilonProperties(uint64 inprops, bool delayed) { + auto outprops = kNoEpsilons; + outprops |= (kError | kAcceptor | kAcyclic | kInitialAcyclic) & inprops; + if (inprops & kAcceptor) outprops |= kNoIEpsilons | kNoOEpsilons; + if (!delayed) { + outprops |= kExpanded | kMutable; + outprops |= kTopSorted & inprops; + } + if (!delayed || inprops & kAccessible) outprops |= kNotAcceptor & inprops; + return outprops; +} + +// Properties for shortest path. This function computes how the properties of +// the output of shortest path need to be updated, given that 'props' is already +// known. +uint64 ShortestPathProperties(uint64 props, bool tree) { + auto outprops = + props | kAcyclic | kInitialAcyclic | kAccessible | kUnweightedCycles; + if (!tree) outprops |= kCoAccessible; + return outprops; +} + +// Properties for a synchronized FST. +uint64 SynchronizeProperties(uint64 inprops) { + auto outprops = (kError | kAcceptor | kAcyclic | kAccessible | kCoAccessible | + kUnweighted | kUnweightedCycles) & + inprops; + if (inprops & kAccessible) { + outprops |= (kCyclic | kNotCoAccessible | kWeighted | kWeightedCycles) & + inprops; + } + return outprops; +} + +// Properties for a unioned FST. +uint64 UnionProperties(uint64 inprops1, uint64 inprops2, bool delayed) { + auto outprops = + (kAcceptor | kUnweighted | kUnweightedCycles | kAcyclic | kAccessible) & + inprops1 & inprops2; + outprops |= kError & (inprops1 | inprops2); + outprops |= kInitialAcyclic; + bool empty1 = delayed; // Can the first FST be the empty machine? + bool empty2 = delayed; // Can the second FST be the empty machine? + if (!delayed) { + outprops |= (kExpanded | kMutable | kNotTopSorted) & inprops1; + outprops |= kNotTopSorted & inprops2; + } + if (!empty1 && !empty2) { + outprops |= kEpsilons | kIEpsilons | kOEpsilons; + outprops |= kCoAccessible & inprops1 & inprops2; + } + // Note kNotCoAccessible does not hold because of kInitialAcyclic option. + if (!delayed || inprops1 & kAccessible) { + outprops |= + (kNotAcceptor | kNonIDeterministic | kNonODeterministic | kEpsilons | + kIEpsilons | kOEpsilons | kNotILabelSorted | kNotOLabelSorted | + kWeighted | kWeightedCycles | kCyclic | kNotAccessible) & + inprops1; + } + if (!delayed || inprops2 & kAccessible) { + outprops |= (kNotAcceptor | kNonIDeterministic | kNonODeterministic | + kEpsilons | kIEpsilons | kOEpsilons | kNotILabelSorted | + kNotOLabelSorted | kWeighted | kWeightedCycles | kCyclic | + kNotAccessible | kNotCoAccessible) & + inprops2; + } + return outprops; +} + +// Property string names (indexed by bit position). +const char* PropertyNames[] = { + // Binary. + "expanded", "mutable", "error", "", "", "", "", "", "", "", "", "", "", "", + "", "", + // Ternary. + "acceptor", "not acceptor", "input deterministic", + "non input deterministic", "output deterministic", + "non output deterministic", "input/output epsilons", + "no input/output epsilons", "input epsilons", "no input epsilons", + "output epsilons", "no output epsilons", "input label sorted", + "not input label sorted", "output label sorted", "not output label sorted", + "weighted", "unweighted", "cyclic", "acyclic", "cyclic at initial state", + "acyclic at initial state", "top sorted", "not top sorted", "accessible", + "not accessible", "coaccessible", "not coaccessible", "string", + "not string", "weighted cycles", "unweighted cycles"}; + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/symbol-table-ops.cc b/runtime/onnxruntime/third_party/openfst/src/lib/symbol-table-ops.cc new file mode 100644 index 0000000..75a06ef --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/symbol-table-ops.cc @@ -0,0 +1,121 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// + +#include + +#include + +namespace fst { + +SymbolTable *MergeSymbolTable(const SymbolTable &left, const SymbolTable &right, + bool *right_relabel_output) { + // MergeSymbolTable detects several special cases. It will return a reference + // copied version of SymbolTable of left or right if either symbol table is + // a superset of the other. + std::unique_ptr merged( + new SymbolTable("merge_" + left.Name() + "_" + right.Name())); + // Copies everything from the left symbol table. + bool left_has_all = true; + bool right_has_all = true; + bool relabel = false; + for (SymbolTableIterator liter(left); !liter.Done(); liter.Next()) { + merged->AddSymbol(liter.Symbol(), liter.Value()); + if (right_has_all) { + int64 key = right.Find(liter.Symbol()); + if (key == -1) { + right_has_all = false; + } else if (!relabel && key != liter.Value()) { + relabel = true; + } + } + } + if (right_has_all) { + if (right_relabel_output) *right_relabel_output = relabel; + return right.Copy(); + } + // add all symbols we can from right symbol table + std::vector conflicts; + for (SymbolTableIterator riter(right); !riter.Done(); riter.Next()) { + int64 key = merged->Find(riter.Symbol()); + if (key != -1) { + // Symbol already exists, maybe with different value + if (key != riter.Value()) relabel = true; + continue; + } + // Symbol doesn't exist from left + left_has_all = false; + if (!merged->Find(riter.Value()).empty()) { + // we can't add this where we want to, add it later, in order + conflicts.push_back(riter.Symbol()); + continue; + } + // there is a hole and we can add this symbol with its id + merged->AddSymbol(riter.Symbol(), riter.Value()); + } + if (right_relabel_output) *right_relabel_output = relabel; + if (left_has_all) return left.Copy(); + // Add all symbols that conflicted, in order + for (const auto &conflict : conflicts) merged->AddSymbol(conflict); + return merged.release(); +} + +SymbolTable *CompactSymbolTable(const SymbolTable &syms) { + std::map sorted; + SymbolTableIterator stiter(syms); + for (; !stiter.Done(); stiter.Next()) { + sorted[stiter.Value()] = stiter.Symbol(); + } + auto *compact = new SymbolTable(syms.Name() + "_compact"); + int64 newkey = 0; + for (const auto &kv : sorted) compact->AddSymbol(kv.second, newkey++); + return compact; +} + +SymbolTable *FstReadSymbols(const string &filename, bool input_symbols) { + std::ifstream in(filename, std::ios_base::in | std::ios_base::binary); + if (!in) { + LOG(ERROR) << "FstReadSymbols: Can't open file " << filename; + return nullptr; + } + FstHeader hdr; + if (!hdr.Read(in, filename)) { + LOG(ERROR) << "FstReadSymbols: Couldn't read header from " << filename; + return nullptr; + } + if (hdr.GetFlags() & FstHeader::HAS_ISYMBOLS) { + std::unique_ptr isymbols(SymbolTable::Read(in, filename)); + if (isymbols == nullptr) { + LOG(ERROR) << "FstReadSymbols: Couldn't read input symbols from " + << filename; + return nullptr; + } + if (input_symbols) return isymbols.release(); + } + if (hdr.GetFlags() & FstHeader::HAS_OSYMBOLS) { + std::unique_ptr osymbols(SymbolTable::Read(in, filename)); + if (osymbols == nullptr) { + LOG(ERROR) << "FstReadSymbols: Couldn't read output symbols from " + << filename; + return nullptr; + } + if (!input_symbols) return osymbols.release(); + } + LOG(ERROR) << "FstReadSymbols: The file " << filename + << " doesn't contain the requested symbols"; + return nullptr; +} + +bool AddAuxiliarySymbols(const string &prefix, int64 start_label, + int64 nlabels, SymbolTable *syms) { + for (int64 i = 0; i < nlabels; ++i) { + auto index = i + start_label; + if (index != syms->AddSymbol(prefix + std::to_string(i), index)) { + FSTERROR() << "AddAuxiliarySymbols: Symbol table clash"; + return false; + } + } + return true; +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/symbol-table.cc b/runtime/onnxruntime/third_party/openfst/src/lib/symbol-table.cc new file mode 100644 index 0000000..aaef368 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/symbol-table.cc @@ -0,0 +1,337 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Classes to provide symbol-to-integer and integer-to-symbol mappings. + +#include + +#include +#include + +#include +#include + +DEFINE_bool(fst_compat_symbols, true, + "Require symbol tables to match when appropriate"); +DEFINE_string(fst_field_separator, "\t ", + "Set of characters used as a separator between printed fields"); + +namespace fst { + +SymbolTableTextOptions::SymbolTableTextOptions(bool allow_negative_labels) + : allow_negative_labels(allow_negative_labels), + fst_field_separator(FLAGS_fst_field_separator) {} + +namespace internal { + +// Maximum line length in textual symbols file. +const int kLineLen = 8096; + +// Identifies stream data as a symbol table (and its endianity). +static constexpr int32 kSymbolTableMagicNumber = 2125658996; + + +DenseSymbolMap::DenseSymbolMap() + : empty_(-1), buckets_(1 << 4), hash_mask_(buckets_.size() - 1) { + std::uninitialized_fill(buckets_.begin(), buckets_.end(), empty_); +} + +DenseSymbolMap::DenseSymbolMap(const DenseSymbolMap &other) + : empty_(-1), + symbols_(other.symbols_), + buckets_(other.buckets_), + hash_mask_(other.hash_mask_) {} + +std::pair DenseSymbolMap::InsertOrFind(const string &key) { + static constexpr float kMaxOccupancyRatio = 0.75; // Grows when 75% full. + if (Size() >= kMaxOccupancyRatio * buckets_.size()) { + Rehash(buckets_.size() * 2); + } + size_t idx = str_hash_(key) & hash_mask_; + while (buckets_[idx] != empty_) { + const auto stored_value = buckets_[idx]; + if (symbols_[stored_value] == key) return {stored_value, false}; + idx = (idx + 1) & hash_mask_; + } + const auto next = Size(); + buckets_[idx] = next; + symbols_.emplace_back(key); + return {next, true}; +} + +int64 DenseSymbolMap::Find(const string &key) const { + size_t idx = str_hash_(key) & hash_mask_; + while (buckets_[idx] != empty_) { + const auto stored_value = buckets_[idx]; + if (symbols_[stored_value] == key) return stored_value; + idx = (idx + 1) & hash_mask_; + } + return buckets_[idx]; +} + +void DenseSymbolMap::Rehash(size_t num_buckets) { + buckets_.resize(num_buckets); + hash_mask_ = buckets_.size() - 1; + std::uninitialized_fill(buckets_.begin(), buckets_.end(), empty_); + for (size_t i = 0; i < Size(); ++i) { + size_t idx = str_hash_(string(symbols_[i])) & hash_mask_; + while (buckets_[idx] != empty_) { + idx = (idx + 1) & hash_mask_; + } + buckets_[idx] = i; + } +} + +void DenseSymbolMap::RemoveSymbol(size_t idx) { + symbols_.erase(symbols_.begin() + idx); + Rehash(buckets_.size()); +} + +SymbolTableImpl *SymbolTableImpl::ReadText(std::istream &strm, + const string &filename, + const SymbolTableTextOptions &opts) { + std::unique_ptr impl(new SymbolTableImpl(filename)); + int64 nline = 0; + char line[kLineLen]; + while (!strm.getline(line, kLineLen).fail()) { + ++nline; + std::vector col; + const auto separator = opts.fst_field_separator + "\n"; + SplitString(line, separator.c_str(), &col, true); + if (col.empty()) continue; // Empty line. + if (col.size() != 2) { + LOG(ERROR) << "SymbolTable::ReadText: Bad number of columns (" + << col.size() << "), " + << "file = " << filename << ", line = " << nline << ":<" + << line << ">"; + return nullptr; + } + const char *symbol = col[0]; + const char *value = col[1]; + char *p; + const auto key = strtoll(value, &p, 10); + if (p < value + strlen(value) || (!opts.allow_negative_labels && key < 0) || + key == kNoSymbol) { + LOG(ERROR) << "SymbolTable::ReadText: Bad non-negative integer \"" + << value << "\", " + << "file = " << filename << ", line = " << nline; + return nullptr; + } + impl->AddSymbol(symbol, key); + } + return impl.release(); +} + +void SymbolTableImpl::MaybeRecomputeCheckSum() const { + { + ReaderMutexLock check_sum_lock(&check_sum_mutex_); + if (check_sum_finalized_) return; + } + // We'll acquire an exclusive lock to recompute the checksums. + MutexLock check_sum_lock(&check_sum_mutex_); + if (check_sum_finalized_) { // Another thread (coming in around the same time + return; // might have done it already). So we recheck. + } + // Calculates the original label-agnostic checksum. + CheckSummer check_sum; + for (size_t i = 0; i < symbols_.Size(); ++i) { + const auto &symbol = symbols_.GetSymbol(i); + check_sum.Update(symbol.data(), symbol.size()); + check_sum.Update("", 1); + } + check_sum_string_ = check_sum.Digest(); + // Calculates the safer, label-dependent checksum. + CheckSummer labeled_check_sum; + for (int64 i = 0; i < dense_key_limit_; ++i) { + std::ostringstream line; + line << symbols_.GetSymbol(i) << '\t' << i; + labeled_check_sum.Update(line.str().data(), line.str().size()); + } + using citer = std::map::const_iterator; + for (citer it = key_map_.begin(); it != key_map_.end(); ++it) { + // TODO(tombagby, 2013-11-22) This line maintains a bug that ignores + // negative labels in the checksum that too many tests rely on. + if (it->first < dense_key_limit_) continue; + std::ostringstream line; + line << symbols_.GetSymbol(it->second) << '\t' << it->first; + labeled_check_sum.Update(line.str().data(), line.str().size()); + } + labeled_check_sum_string_ = labeled_check_sum.Digest(); + check_sum_finalized_ = true; +} + +int64 SymbolTableImpl::AddSymbol(const string &symbol, int64 key) { + if (key == kNoSymbol) return key; + const auto insert_key = symbols_.InsertOrFind(symbol); + if (!insert_key.second) { + const auto key_already = GetNthKey(insert_key.first); + if (key_already == key) return key; + VLOG(1) << "SymbolTable::AddSymbol: symbol = " << symbol + << " already in symbol_map_ with key = " << key_already + << " but supplied new key = " << key << " (ignoring new key)"; + return key_already; + } + if (key + 1 == static_cast(symbols_.Size()) && + key == dense_key_limit_) { + ++dense_key_limit_; + } else { + idx_key_.push_back(key); + key_map_[key] = symbols_.Size() - 1; + } + if (key >= available_key_) available_key_ = key + 1; + check_sum_finalized_ = false; + return key; +} + +// TODO(rybach): Consider a more efficient implementation which re-uses holes in +// the dense-key range or re-arranges the dense-key range from time to time. +void SymbolTableImpl::RemoveSymbol(const int64 key) { + auto idx = key; + if (key < 0 || key >= dense_key_limit_) { + auto iter = key_map_.find(key); + if (iter == key_map_.end()) return; + idx = iter->second; + key_map_.erase(iter); + } + if (idx < 0 || idx >= static_cast(symbols_.Size())) return; + symbols_.RemoveSymbol(idx); + // Removed one symbol, all indexes > idx are shifted by -1. + for (auto &k : key_map_) { + if (k.second > idx) --k.second; + } + if (key >= 0 && key < dense_key_limit_) { + // Removal puts a hole in the dense key range. Adjusts range to [0, key). + const auto new_dense_key_limit = key; + for (int64 i = key + 1; i < dense_key_limit_; ++i) { + key_map_[i] = i - 1; + } + // Moves existing values in idx_key to new place. + idx_key_.resize(symbols_.Size() - new_dense_key_limit); + for (int64 i = symbols_.Size(); i >= dense_key_limit_; --i) { + idx_key_[i - new_dense_key_limit - 1] = idx_key_[i - dense_key_limit_]; + } + // Adds indexes for previously dense keys. + for (int64 i = new_dense_key_limit; i < dense_key_limit_ - 1; ++i) { + idx_key_[i - new_dense_key_limit] = i + 1; + } + dense_key_limit_ = new_dense_key_limit; + } else { + // Remove entry for removed index in idx_key. + for (size_t i = idx - dense_key_limit_; i + 1 < idx_key_.size(); ++i) { + idx_key_[i] = idx_key_[i + 1]; + } + idx_key_.pop_back(); + } + if (key == available_key_ - 1) available_key_ = key; +} + +SymbolTableImpl *SymbolTableImpl::Read( + std::istream &strm, const SymbolTableReadOptions &) { + int32 magic_number = 0; + ReadType(strm, &magic_number); + if (strm.fail()) { + LOG(ERROR) << "SymbolTable::Read: Read failed"; + return nullptr; + } + string name; + ReadType(strm, &name); + std::unique_ptr impl(new SymbolTableImpl(name)); + ReadType(strm, &impl->available_key_); + int64 size; + ReadType(strm, &size); + if (strm.fail()) { + LOG(ERROR) << "SymbolTable::Read: Read failed"; + return nullptr; + } + string symbol; + int64 key; + impl->check_sum_finalized_ = false; + for (int64 i = 0; i < size; ++i) { + ReadType(strm, &symbol); + ReadType(strm, &key); + if (strm.fail()) { + LOG(ERROR) << "SymbolTable::Read: Read failed"; + return nullptr; + } + impl->AddSymbol(symbol, key); + } + return impl.release(); +} + +bool SymbolTableImpl::Write(std::ostream &strm) const { + WriteType(strm, kSymbolTableMagicNumber); + WriteType(strm, name_); + WriteType(strm, available_key_); + const int64 size = symbols_.Size(); + WriteType(strm, size); + for (int64 i = 0; i < size; ++i) { + auto key = (i < dense_key_limit_) ? i : idx_key_[i - dense_key_limit_]; + WriteType(strm, symbols_.GetSymbol(i)); + WriteType(strm, key); + } + strm.flush(); + if (strm.fail()) { + LOG(ERROR) << "SymbolTable::Write: Write failed"; + return false; + } + return true; +} + +} // namespace internal + +void SymbolTable::AddTable(const SymbolTable &table) { + MutateCheck(); + for (SymbolTableIterator iter(table); !iter.Done(); iter.Next()) { + impl_->AddSymbol(iter.Symbol()); + } +} + +bool SymbolTable::WriteText(std::ostream &strm, + const SymbolTableTextOptions &opts) const { + if (opts.fst_field_separator.empty()) { + LOG(ERROR) << "Missing required field separator"; + return false; + } + bool once_only = false; + for (SymbolTableIterator iter(*this); !iter.Done(); iter.Next()) { + std::ostringstream line; + if (iter.Value() < 0 && !opts.allow_negative_labels && !once_only) { + LOG(WARNING) << "Negative symbol table entry when not allowed"; + once_only = true; + } + line << iter.Symbol() << opts.fst_field_separator[0] << iter.Value() + << '\n'; + strm.write(line.str().data(), line.str().length()); + } + return true; +} + +bool CompatSymbols(const SymbolTable *syms1, const SymbolTable *syms2, + bool warning) { + // Flag can explicitly override this check. + if (!FLAGS_fst_compat_symbols) return true; + if (syms1 && syms2 && + (syms1->LabeledCheckSum() != syms2->LabeledCheckSum())) { + if (warning) { + LOG(WARNING) << "CompatSymbols: Symbol table checksums do not match. " + << "Table sizes are " << syms1->NumSymbols() << " and " + << syms2->NumSymbols(); + } + return false; + } else { + return true; + } +} + +void SymbolTableToString(const SymbolTable *table, string *result) { + std::ostringstream ostrm; + table->Write(ostrm); + *result = ostrm.str(); +} + +SymbolTable *StringToSymbolTable(const string &str) { + std::istringstream istrm(str); + return SymbolTable::Read(istrm, SymbolTableReadOptions()); +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/util.cc b/runtime/onnxruntime/third_party/openfst/src/lib/util.cc new file mode 100644 index 0000000..9691d3b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/util.cc @@ -0,0 +1,101 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// FST utility definitions. + +#include +#include +#include +#include +#include +#include +#include + +// Utility flag definitions + +DEFINE_bool(fst_error_fatal, true, + "FST errors are fatal; o.w. return objects flagged as bad: " + "e.g., FSTs: kError property set, FST weights: not a Member()"); + +namespace fst { + +void SplitString(char *full, const char *delim, std::vector *vec, + bool omit_empty_strings) { + char *p = full; + while (p) { + if ((p = strpbrk(full, delim))) { + p[0] = '\0'; + } + if (!omit_empty_strings || full[0] != '\0') vec->push_back(full); + if (p) full = p + 1; + } +} + +int64 StrToInt64(const string &s, const string &src, size_t nline, + bool allow_negative, bool *error) { + int64 n; + const char *cs = s.c_str(); + char *p; + if (error) *error = false; + n = strtoll(cs, &p, 10); + if (p < cs + s.size() || (!allow_negative && n < 0)) { + FSTERROR() << "StrToInt64: Bad integer = " << s << "\", source = " << src + << ", line = " << nline; + if (error) *error = true; + return 0; + } + return n; +} + +void ConvertToLegalCSymbol(string *s) { + for (auto it = s->begin(); it != s->end(); ++it) { + if (!isalnum(*it)) { + *it = '_'; + } + } +} + +// Skips over input characters to align to 'align' bytes. Returns false if can't +// align. +bool AlignInput(std::istream &strm) { + char c; + for (int i = 0; i < MappedFile::kArchAlignment; ++i) { + int64 pos = strm.tellg(); + if (pos < 0) { + LOG(ERROR) << "AlignInput: Can't determine stream position"; + return false; + } + if (pos % MappedFile::kArchAlignment == 0) break; + strm.read(&c, 1); + } + return true; +} + +// Write null output characters to align to 'align' bytes. Returns false if +// can't align. +bool AlignOutput(std::ostream &strm) { + for (int i = 0; i < MappedFile::kArchAlignment; ++i) { + int64 pos = strm.tellp(); + if (pos < 0) { + LOG(ERROR) << "AlignOutput: Can't determine stream position"; + return false; + } + if (pos % MappedFile::kArchAlignment == 0) break; + strm.write("", 1); + } + return true; +} + +int AlignBufferWithOutputStream(std::ostream &strm, + std::ostringstream &buffer) { + const auto strm_pos = strm.tellp(); + if (strm_pos == std::ostream::pos_type(-1)) { + LOG(ERROR) << "Cannot determine stream position"; + return -1; + } + const int stream_offset = strm_pos % MappedFile::kArchAlignment; + for (int i = 0; i < stream_offset; ++i) buffer.write("", 1); + return stream_offset; +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/weight.cc b/runtime/onnxruntime/third_party/openfst/src/lib/weight.cc new file mode 100644 index 0000000..b34dd0a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/lib/weight.cc @@ -0,0 +1,117 @@ +#include + +DEFINE_string(fst_weight_separator, ",", + "Character separator between printed composite weights; " + "must be a single character"); + +DEFINE_string(fst_weight_parentheses, "", + "Characters enclosing the first weight of a printed composite " + "weight (e.g., pair weight, tuple weight and derived classes) to " + "ensure proper I/O of nested composite weights; " + "must have size 0 (none) or 2 (open and close parenthesis)"); + +namespace fst { + +namespace internal { + +CompositeWeightIO::CompositeWeightIO(char separator, + std::pair parentheses) + : separator_(separator), + open_paren_(parentheses.first), + close_paren_(parentheses.second), + error_(false) { + if ((open_paren_ == 0 || close_paren_ == 0) && open_paren_ != close_paren_) { + FSTERROR() << "Invalid configuration of weight parentheses: " + << static_cast(open_paren_) << " " + << static_cast(close_paren_); + error_ = true; + } +} + +CompositeWeightIO::CompositeWeightIO() + : CompositeWeightIO(FLAGS_fst_weight_separator.empty() + ? 0 + : FLAGS_fst_weight_separator.front(), + {FLAGS_fst_weight_parentheses.empty() + ? 0 + : FLAGS_fst_weight_parentheses[0], + FLAGS_fst_weight_parentheses.size() < 2 + ? 0 + : FLAGS_fst_weight_parentheses[1]}) { + if (FLAGS_fst_weight_separator.size() != 1) { + FSTERROR() << "CompositeWeight: " + << "FLAGS_fst_weight_separator.size() is not equal to 1"; + error_ = true; + } + if (!FLAGS_fst_weight_parentheses.empty() && + FLAGS_fst_weight_parentheses.size() != 2) { + FSTERROR() << "CompositeWeight: " + << "FLAGS_fst_weight_parentheses.size() is not equal to 2"; + error_ = true; + } +} + +} // namespace internal + +CompositeWeightWriter::CompositeWeightWriter(std::ostream &ostrm) + : ostrm_(ostrm) { + if (error()) ostrm.clear(std::ios::badbit); +} + +CompositeWeightWriter::CompositeWeightWriter(std::ostream &ostrm, + char separator, + std::pair parentheses) + : internal::CompositeWeightIO(separator, parentheses), ostrm_(ostrm) { + if (error()) ostrm_.clear(std::ios::badbit); +} + +void CompositeWeightWriter::WriteBegin() { + if (open_paren_ != 0) { + ostrm_ << open_paren_; + } +} + +void CompositeWeightWriter::WriteEnd() { + if (close_paren_ != 0) { + ostrm_ << close_paren_; + } +} + +CompositeWeightReader::CompositeWeightReader(std::istream &istrm) + : istrm_(istrm) { + if (error()) istrm_.clear(std::ios::badbit); +} + +CompositeWeightReader::CompositeWeightReader(std::istream &istrm, + char separator, + std::pair parentheses) + : internal::CompositeWeightIO(separator, parentheses), istrm_(istrm) { + if (error()) istrm_.clear(std::ios::badbit); +} + +void CompositeWeightReader::ReadBegin() { + do { // Skips whitespace. + c_ = istrm_.get(); + } while (std::isspace(c_)); + if (open_paren_ != 0) { + if (c_ != open_paren_) { + FSTERROR() << "CompositeWeightReader: Open paren missing: " + << "fst_weight_parentheses flag set correcty?"; + istrm_.clear(std::ios::badbit); + return; + } + ++depth_; + c_ = istrm_.get(); + } +} + +void CompositeWeightReader::ReadEnd() { + if (c_ != EOF && !std::isspace(c_)) { + FSTERROR() << "CompositeWeightReader: excess character: '" + << static_cast(c_) + << "': fst_weight_parentheses flag set correcty?"; + istrm_.clear(std::ios::badbit); + } +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/openfst-multibin.targets b/runtime/onnxruntime/third_party/openfst/src/openfst-multibin.targets new file mode 100644 index 0000000..48db1d3 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/openfst-multibin.targets @@ -0,0 +1,39 @@ + + + + + + + + + <_ProjectName>@(ClCompile->'%(Filename)/'->Replace('-main/','')->TrimEnd('/')) + + + + ProjectName=%(ClCompile._ProjectName);OnlySources=@(ClCompile) + + + + + + + + + + + + + + + + + + + + diff --git a/runtime/onnxruntime/third_party/openfst/src/openfst.props b/runtime/onnxruntime/third_party/openfst/src/openfst.props new file mode 100644 index 0000000..9836683 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/openfst.props @@ -0,0 +1,124 @@ + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + <_SolutionDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), openfst.sln)) + <_SolutionDir Condition=" '$(_SolutionDir)' == '' ">$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)..")) + $(_SolutionDir)\ + + + + Win32Proj + v141 + NoUpgrade + + + + + + true + true + + + + + <_TargetSubdir Condition=" '$(ConfigurationType)' == 'StaticLibrary' ">lib + <_TargetSubdir Condition=" '$(ConfigurationType)' != 'StaticLibrary' ">bin + $(SolutionDir)build_output\$(PlatformTarget)\$(Configuration)\$(_TargetSubdir)\ + obj\$(PlatformTarget)\$(Configuration)\ + + + + + + + + <_Win10SDKVer>$(WindowsSDKVersion) + <_Win10SDKVer>$(_Win10SDKVer.TrimEnd('\')) + $(_Win10SDKVer) + + + + <_Win10SDKVer Condition=" '$(_Win10SDKVer)' == '' ">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) + <_Win10SDKVer Condition=" '$(_Win10SDKVer)' == '' ">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) + <_Win10SDKVer Condition=" $(_Win10SDKVer.Split('.').Length) == 3">$(_Win10SDKVer).0 + $(_Win10SDKVer) + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + NDEBUG;%(PreprocessorDefinitions) + + + /bigobj %(AdditionalOptions) + $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories) + false + OldStyle + 4018;4099;4244;4267;4291;4305;4396;%(DisableSpecificWarnings) + $(EnableEnhancedInstructionSet) + true + true + false + true + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + $(IntDir)$(ProjectName).pdb + true + Level3 + + + + /WHOLEARCHIVE:libfst %(AdditionalOptions) + Console + + + true + true + + UseLinkTimeCodeGeneration + + + + diff --git a/runtime/onnxruntime/third_party/openfst/src/openfst.targets b/runtime/onnxruntime/third_party/openfst/src/openfst.targets new file mode 100644 index 0000000..fc4e594 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/openfst.targets @@ -0,0 +1,35 @@ + + + + + $(IntDir)$(ProjectName).tlog\ + + true + + + + + + + + ProjectName;OnlySources + + + + + + + <_OnlySources Include="$(OnlySources)" /> + + + + + + + + \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/openfst/src/openfst.user.props b/runtime/onnxruntime/third_party/openfst/src/openfst.user.props new file mode 100644 index 0000000..1b4711b --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/openfst.user.props @@ -0,0 +1,78 @@ + + + + + + + v140 + + v141 + + + + + + 10.0.17134.0 + + 10.0.16299.0 + + 10.0.15063.0 + + 10.0.14393.0 + + 10.0.10586.0 + + 10.0.10240.0 + 10.0.26624.0 + + + + + + AdvancedVectorExtensions + + + AdvancedVectorExtensions2 + + + diff --git a/runtime/onnxruntime/third_party/openfst/src/script/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/script/CMakeLists.txt new file mode 100644 index 0000000..c473fc0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/CMakeLists.txt @@ -0,0 +1,63 @@ +file(GLOB HEADER_FILES ../include/fst/script/*.h) +message(STATUS "${HEADER_FILES}") + +add_library(fstscript + arciterator-class.cc + arcsort.cc + closure.cc + compile.cc + compose.cc + concat.cc + connect.cc + convert.cc + decode.cc + determinize.cc + difference.cc + disambiguate.cc + draw.cc + encode.cc + encodemapper-class.cc + epsnormalize.cc + equal.cc + equivalent.cc + fst-class.cc + getters.cc + info.cc + info-impl.cc + intersect.cc + invert.cc + isomorphic.cc + map.cc + minimize.cc + print.cc + project.cc + prune.cc + push.cc + randequivalent.cc + randgen.cc + relabel.cc + replace.cc + reverse.cc + reweight.cc + rmepsilon.cc + shortest-distance.cc + shortest-path.cc + stateiterator-class.cc + synchronize.cc + text-io.cc + topsort.cc + union.cc + weight-class.cc + verify.cc + ${HEADER_FILES} +) +target_link_libraries(fstscript PRIVATE fst) + +set_target_properties(fstscript PROPERTIES + SOVERSION "${SOVERSION}" +) +install(TARGETS fstscript + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib) + diff --git a/runtime/onnxruntime/third_party/openfst/src/script/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/script/Makefile.am new file mode 100644 index 0000000..9b00b12 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/Makefile.am @@ -0,0 +1,17 @@ +AM_CPPFLAGS = -I$(srcdir)/../include $(ICU_CPPFLAGS) + +if HAVE_SCRIPT +lib_LTLIBRARIES = libfstscript.la +libfstscript_la_SOURCES = arciterator-class.cc arcsort.cc closure.cc \ +compile.cc compose.cc concat.cc connect.cc convert.cc decode.cc \ +determinize.cc difference.cc disambiguate.cc draw.cc encode.cc \ +encodemapper-class.cc epsnormalize.cc equal.cc equivalent.cc fst-class.cc \ +getters.cc info-impl.cc info.cc intersect.cc invert.cc isomorphic.cc map.cc \ +minimize.cc print.cc project.cc prune.cc push.cc randequivalent.cc \ +randgen.cc relabel.cc replace.cc reverse.cc reweight.cc rmepsilon.cc \ +shortest-distance.cc shortest-path.cc stateiterator-class.cc synchronize.cc \ +text-io.cc topsort.cc union.cc weight-class.cc verify.cc + +libfstscript_la_LIBADD = ../lib/libfst.la -lm $(DL_LIBS) +libfstscript_la_LDFLAGS = -version-info 16:0:0 +endif diff --git a/runtime/onnxruntime/third_party/openfst/src/script/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/script/Makefile.in new file mode 100644 index 0000000..dfa9733 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/Makefile.in @@ -0,0 +1,753 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/script +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +@HAVE_SCRIPT_TRUE@libfstscript_la_DEPENDENCIES = ../lib/libfst.la \ +@HAVE_SCRIPT_TRUE@ $(am__DEPENDENCIES_1) +am__libfstscript_la_SOURCES_DIST = arciterator-class.cc arcsort.cc \ + closure.cc compile.cc compose.cc concat.cc connect.cc \ + convert.cc decode.cc determinize.cc difference.cc \ + disambiguate.cc draw.cc encode.cc encodemapper-class.cc \ + epsnormalize.cc equal.cc equivalent.cc fst-class.cc getters.cc \ + info-impl.cc info.cc intersect.cc invert.cc isomorphic.cc \ + map.cc minimize.cc print.cc project.cc prune.cc push.cc \ + randequivalent.cc randgen.cc relabel.cc replace.cc reverse.cc \ + reweight.cc rmepsilon.cc shortest-distance.cc shortest-path.cc \ + stateiterator-class.cc synchronize.cc text-io.cc topsort.cc \ + union.cc weight-class.cc verify.cc +@HAVE_SCRIPT_TRUE@am_libfstscript_la_OBJECTS = arciterator-class.lo \ +@HAVE_SCRIPT_TRUE@ arcsort.lo closure.lo compile.lo compose.lo \ +@HAVE_SCRIPT_TRUE@ concat.lo connect.lo convert.lo decode.lo \ +@HAVE_SCRIPT_TRUE@ determinize.lo difference.lo disambiguate.lo \ +@HAVE_SCRIPT_TRUE@ draw.lo encode.lo encodemapper-class.lo \ +@HAVE_SCRIPT_TRUE@ epsnormalize.lo equal.lo equivalent.lo \ +@HAVE_SCRIPT_TRUE@ fst-class.lo getters.lo info-impl.lo info.lo \ +@HAVE_SCRIPT_TRUE@ intersect.lo invert.lo isomorphic.lo map.lo \ +@HAVE_SCRIPT_TRUE@ minimize.lo print.lo project.lo prune.lo \ +@HAVE_SCRIPT_TRUE@ push.lo randequivalent.lo randgen.lo \ +@HAVE_SCRIPT_TRUE@ relabel.lo replace.lo reverse.lo reweight.lo \ +@HAVE_SCRIPT_TRUE@ rmepsilon.lo shortest-distance.lo \ +@HAVE_SCRIPT_TRUE@ shortest-path.lo stateiterator-class.lo \ +@HAVE_SCRIPT_TRUE@ synchronize.lo text-io.lo topsort.lo \ +@HAVE_SCRIPT_TRUE@ union.lo weight-class.lo verify.lo +libfstscript_la_OBJECTS = $(am_libfstscript_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libfstscript_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libfstscript_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@HAVE_SCRIPT_TRUE@am_libfstscript_la_rpath = -rpath $(libdir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libfstscript_la_SOURCES) +DIST_SOURCES = $(am__libfstscript_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../include $(ICU_CPPFLAGS) +@HAVE_SCRIPT_TRUE@lib_LTLIBRARIES = libfstscript.la +@HAVE_SCRIPT_TRUE@libfstscript_la_SOURCES = arciterator-class.cc arcsort.cc closure.cc \ +@HAVE_SCRIPT_TRUE@compile.cc compose.cc concat.cc connect.cc convert.cc decode.cc \ +@HAVE_SCRIPT_TRUE@determinize.cc difference.cc disambiguate.cc draw.cc encode.cc \ +@HAVE_SCRIPT_TRUE@encodemapper-class.cc epsnormalize.cc equal.cc equivalent.cc fst-class.cc \ +@HAVE_SCRIPT_TRUE@getters.cc info-impl.cc info.cc intersect.cc invert.cc isomorphic.cc map.cc \ +@HAVE_SCRIPT_TRUE@minimize.cc print.cc project.cc prune.cc push.cc randequivalent.cc \ +@HAVE_SCRIPT_TRUE@randgen.cc relabel.cc replace.cc reverse.cc reweight.cc rmepsilon.cc \ +@HAVE_SCRIPT_TRUE@shortest-distance.cc shortest-path.cc stateiterator-class.cc synchronize.cc \ +@HAVE_SCRIPT_TRUE@text-io.cc topsort.cc union.cc weight-class.cc verify.cc + +@HAVE_SCRIPT_TRUE@libfstscript_la_LIBADD = ../lib/libfst.la -lm $(DL_LIBS) +@HAVE_SCRIPT_TRUE@libfstscript_la_LDFLAGS = -version-info 16:0:0 +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/script/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/script/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libfstscript.la: $(libfstscript_la_OBJECTS) $(libfstscript_la_DEPENDENCIES) $(EXTRA_libfstscript_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libfstscript_la_LINK) $(am_libfstscript_la_rpath) $(libfstscript_la_OBJECTS) $(libfstscript_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arciterator-class.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arcsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closure.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compose.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/concat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/determinize.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/difference.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disambiguate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/draw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encodemapper-class.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epsnormalize.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equivalent.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fst-class.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getters.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info-impl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intersect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/invert.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isomorphic.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minimize.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/project.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prune.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/push.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randequivalent.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randgen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relabel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replace.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reverse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reweight.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmepsilon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shortest-distance.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shortest-path.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stateiterator-class.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synchronize.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-io.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/union.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verify.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weight-class.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/script/arciterator-class.cc b/runtime/onnxruntime/third_party/openfst/src/script/arciterator-class.cc new file mode 100644 index 0000000..005b413 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/arciterator-class.cc @@ -0,0 +1,37 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { +namespace script { + +ArcIteratorClass::ArcIteratorClass(const FstClass &fst, int64 s) + : impl_(nullptr) { + InitArcIteratorClassArgs args(fst, s, this); + Apply>("InitArcIteratorClass", + fst.ArcType(), &args); +} + +MutableArcIteratorClass::MutableArcIteratorClass(MutableFstClass *fst, + int64 s) : impl_(nullptr) { + InitMutableArcIteratorClassArgs args(fst, s, this); + Apply>( + "InitMutableArcIteratorClass", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(InitArcIteratorClass, StdArc, InitArcIteratorClassArgs); +REGISTER_FST_OPERATION(InitArcIteratorClass, LogArc, InitArcIteratorClassArgs); +REGISTER_FST_OPERATION(InitArcIteratorClass, Log64Arc, + InitArcIteratorClassArgs); + +REGISTER_FST_OPERATION(InitMutableArcIteratorClass, StdArc, + InitMutableArcIteratorClassArgs); +REGISTER_FST_OPERATION(InitMutableArcIteratorClass, LogArc, + InitMutableArcIteratorClassArgs); +REGISTER_FST_OPERATION(InitMutableArcIteratorClass, Log64Arc, + InitMutableArcIteratorClassArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/arcsort.cc b/runtime/onnxruntime/third_party/openfst/src/script/arcsort.cc new file mode 100644 index 0000000..e7fbeb5 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/arcsort.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void ArcSort(MutableFstClass *fst, ArcSortType sort_type) { + ArcSortArgs args(fst, sort_type); + Apply>("ArcSort", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(ArcSort, StdArc, ArcSortArgs); +REGISTER_FST_OPERATION(ArcSort, LogArc, ArcSortArgs); +REGISTER_FST_OPERATION(ArcSort, Log64Arc, ArcSortArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/closure.cc b/runtime/onnxruntime/third_party/openfst/src/script/closure.cc new file mode 100644 index 0000000..d8a6788 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/closure.cc @@ -0,0 +1,21 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Closure(MutableFstClass *fst, ClosureType closure_type) { + ClosureArgs args(fst, closure_type); + Apply>("Closure", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Closure, StdArc, ClosureArgs); +REGISTER_FST_OPERATION(Closure, LogArc, ClosureArgs); +REGISTER_FST_OPERATION(Closure, Log64Arc, ClosureArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/compile.cc b/runtime/onnxruntime/third_party/openfst/src/script/compile.cc new file mode 100644 index 0000000..0a3c9a5 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/compile.cc @@ -0,0 +1,44 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +void CompileFst(std::istream &istrm, const string &source, const string &dest, + const string &fst_type, const string &arc_type, + const SymbolTable *isyms, const SymbolTable *osyms, + const SymbolTable *ssyms, bool accep, bool ikeep, bool okeep, + bool nkeep, bool allow_negative_labels) { + std::unique_ptr fst( + CompileFstInternal(istrm, source, fst_type, arc_type, isyms, osyms, ssyms, + accep, ikeep, okeep, nkeep, allow_negative_labels)); + fst->Write(dest); +} + +FstClass *CompileFstInternal(std::istream &istrm, const string &source, + const string &fst_type, const string &arc_type, + const SymbolTable *isyms, const SymbolTable *osyms, + const SymbolTable *ssyms, bool accep, bool ikeep, + bool okeep, bool nkeep, + bool allow_negative_labels) { + CompileFstInnerArgs iargs(istrm, source, fst_type, isyms, osyms, ssyms, accep, + ikeep, okeep, nkeep, allow_negative_labels); + CompileFstArgs args(iargs); + Apply>("CompileFstInternal", arc_type, &args); + return args.retval; +} + +// This registers 2; 1 does not require registration. +REGISTER_FST_OPERATION(CompileFstInternal, StdArc, CompileFstArgs); +REGISTER_FST_OPERATION(CompileFstInternal, LogArc, CompileFstArgs); +REGISTER_FST_OPERATION(CompileFstInternal, Log64Arc, CompileFstArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/compose.cc b/runtime/onnxruntime/third_party/openfst/src/script/compose.cc new file mode 100644 index 0000000..fcc4028 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/compose.cc @@ -0,0 +1,27 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Compose(const FstClass &ifst1, const FstClass &ifst2, + MutableFstClass *ofst, const ComposeOptions &opts) { + if (!internal::ArcTypesMatch(ifst1, ifst2, "Compose") || + !internal::ArcTypesMatch(*ofst, ifst1, "Compose")) { + ofst->SetProperties(kError, kError); + return; + } + ComposeArgs args(ifst1, ifst2, ofst, opts); + Apply>("Compose", ifst1.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Compose, StdArc, ComposeArgs); +REGISTER_FST_OPERATION(Compose, LogArc, ComposeArgs); +REGISTER_FST_OPERATION(Compose, Log64Arc, ComposeArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/concat.cc b/runtime/onnxruntime/third_party/openfst/src/script/concat.cc new file mode 100644 index 0000000..bdeba83 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/concat.cc @@ -0,0 +1,40 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +// 1 +void Concat(MutableFstClass *ofst, const FstClass &ifst) { + if (!internal::ArcTypesMatch(*ofst, ifst, "Concat")) { + ofst->SetProperties(kError, kError); + return; + } + ConcatArgs1 args(ofst, ifst); + Apply>("Concat", ofst->ArcType(), &args); +} + +// 2 +void Concat(const FstClass &ifst, MutableFstClass *ofst) { + if (!internal::ArcTypesMatch(ifst, *ofst, "Concat")) { + ofst->SetProperties(kError, kError); + return; + } + ConcatArgs2 args(ifst, ofst); + Apply>("Concat", ofst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Concat, StdArc, ConcatArgs1); +REGISTER_FST_OPERATION(Concat, LogArc, ConcatArgs1); +REGISTER_FST_OPERATION(Concat, Log64Arc, ConcatArgs1); + +REGISTER_FST_OPERATION(Concat, StdArc, ConcatArgs2); +REGISTER_FST_OPERATION(Concat, LogArc, ConcatArgs2); +REGISTER_FST_OPERATION(Concat, Log64Arc, ConcatArgs2); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/connect.cc b/runtime/onnxruntime/third_party/openfst/src/script/connect.cc new file mode 100644 index 0000000..6f1ccc2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/connect.cc @@ -0,0 +1,20 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Connect(MutableFstClass *fst) { + Apply>("Connect", fst->ArcType(), fst); +} + +REGISTER_FST_OPERATION(Connect, StdArc, MutableFstClass); +REGISTER_FST_OPERATION(Connect, LogArc, MutableFstClass); +REGISTER_FST_OPERATION(Connect, Log64Arc, MutableFstClass); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/convert.cc b/runtime/onnxruntime/third_party/openfst/src/script/convert.cc new file mode 100644 index 0000000..a0d1779 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/convert.cc @@ -0,0 +1,23 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +FstClass *Convert(const FstClass &ifst, const string &new_type) { + ConvertInnerArgs iargs(ifst, new_type); + ConvertArgs args(iargs); + Apply>("Convert", ifst.ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(Convert, StdArc, ConvertArgs); +REGISTER_FST_OPERATION(Convert, LogArc, ConvertArgs); +REGISTER_FST_OPERATION(Convert, Log64Arc, ConvertArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/decode.cc b/runtime/onnxruntime/third_party/openfst/src/script/decode.cc new file mode 100644 index 0000000..6ffbf3e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/decode.cc @@ -0,0 +1,35 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include +#include + +namespace fst { +namespace script { + +void Decode(MutableFstClass *fst, const string &coder_fname) { + DecodeArgs1 args(fst, coder_fname); + Apply>("Decode", fst->ArcType(), &args); +} + +void Decode(MutableFstClass *fst, const EncodeMapperClass &encoder) { + if (!internal::ArcTypesMatch(*fst, encoder, "Decode")) { + fst->SetProperties(kError, kError); + return; + } + DecodeArgs2 args(fst, encoder); + Apply>("Decode", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Decode, StdArc, DecodeArgs1); +REGISTER_FST_OPERATION(Decode, LogArc, DecodeArgs1); +REGISTER_FST_OPERATION(Decode, Log64Arc, DecodeArgs1); + +REGISTER_FST_OPERATION(Decode, StdArc, DecodeArgs2); +REGISTER_FST_OPERATION(Decode, LogArc, DecodeArgs2); +REGISTER_FST_OPERATION(Decode, Log64Arc, DecodeArgs2); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/determinize.cc b/runtime/onnxruntime/third_party/openfst/src/script/determinize.cc new file mode 100644 index 0000000..52bf19a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/determinize.cc @@ -0,0 +1,27 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Determinize(const FstClass &ifst, MutableFstClass *ofst, + const DeterminizeOptions &opts) { + if (!internal::ArcTypesMatch(ifst, *ofst, "Determinize") || + !ofst->WeightTypesMatch(opts.weight_threshold, "Determinize")) { + ofst->SetProperties(kError, kError); + return; + } + DeterminizeArgs args(ifst, ofst, opts); + Apply>("Determinize", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Determinize, StdArc, DeterminizeArgs); +REGISTER_FST_OPERATION(Determinize, LogArc, DeterminizeArgs); +REGISTER_FST_OPERATION(Determinize, Log64Arc, DeterminizeArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/difference.cc b/runtime/onnxruntime/third_party/openfst/src/script/difference.cc new file mode 100644 index 0000000..8161698 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/difference.cc @@ -0,0 +1,27 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Difference(const FstClass &ifst1, const FstClass &ifst2, + MutableFstClass *ofst, const ComposeOptions &opts) { + if (!internal::ArcTypesMatch(ifst1, ifst2, "Difference") || + !internal::ArcTypesMatch(*ofst, ifst1, "Difference")) { + ofst->SetProperties(kError, kError); + return; + } + DifferenceArgs args(ifst1, ifst2, ofst, opts); + Apply>("Difference", ifst1.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Difference, StdArc, DifferenceArgs); +REGISTER_FST_OPERATION(Difference, LogArc, DifferenceArgs); +REGISTER_FST_OPERATION(Difference, Log64Arc, DifferenceArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/disambiguate.cc b/runtime/onnxruntime/third_party/openfst/src/script/disambiguate.cc new file mode 100644 index 0000000..30e0d75 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/disambiguate.cc @@ -0,0 +1,27 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Disambiguate(const FstClass &ifst, MutableFstClass *ofst, + const DisambiguateOptions &opts) { + if (!internal::ArcTypesMatch(ifst, *ofst, "Disambiguate") || + !ofst->WeightTypesMatch(opts.weight_threshold, "Disambiguate")) { + ofst->SetProperties(kError, kError); + return; + } + DisambiguateArgs args(ifst, ofst, opts); + Apply>("Disambiguate", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Disambiguate, StdArc, DisambiguateArgs); +REGISTER_FST_OPERATION(Disambiguate, LogArc, DisambiguateArgs); +REGISTER_FST_OPERATION(Disambiguate, Log64Arc, DisambiguateArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/draw.cc b/runtime/onnxruntime/third_party/openfst/src/script/draw.cc new file mode 100644 index 0000000..536c9df --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/draw.cc @@ -0,0 +1,31 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +void DrawFst(const FstClass &fst, const SymbolTable *isyms, + const SymbolTable *osyms, const SymbolTable *ssyms, bool accep, + const string &title, float width, float height, bool portrait, + bool vertical, float ranksep, float nodesep, int fontsize, + int precision, const string &float_format, bool show_weight_one, + std::ostream *ostrm, const string &dest) { + FstDrawerArgs args(fst, isyms, osyms, ssyms, accep, title, width, height, + portrait, vertical, ranksep, nodesep, fontsize, precision, + float_format, show_weight_one, ostrm, dest); + Apply>("DrawFst", fst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(DrawFst, StdArc, FstDrawerArgs); +REGISTER_FST_OPERATION(DrawFst, LogArc, FstDrawerArgs); +REGISTER_FST_OPERATION(DrawFst, Log64Arc, FstDrawerArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/encode.cc b/runtime/onnxruntime/third_party/openfst/src/script/encode.cc new file mode 100644 index 0000000..4f05450 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/encode.cc @@ -0,0 +1,36 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include +#include + +namespace fst { +namespace script { + +void Encode(MutableFstClass *fst, uint32 flags, bool reuse_encoder, + const string &coder_fname) { + EncodeArgs1 args(fst, flags, reuse_encoder, coder_fname); + Apply>("Encode", fst->ArcType(), &args); +} + +void Encode(MutableFstClass *fst, EncodeMapperClass *encoder) { + if (!internal::ArcTypesMatch(*fst, *encoder, "Encode")) { + fst->SetProperties(kError, kError); + return; + } + EncodeArgs2 args(fst, encoder); + Apply>("Encode", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Encode, StdArc, EncodeArgs1); +REGISTER_FST_OPERATION(Encode, LogArc, EncodeArgs1); +REGISTER_FST_OPERATION(Encode, Log64Arc, EncodeArgs1); + +REGISTER_FST_OPERATION(Encode, StdArc, EncodeArgs2); +REGISTER_FST_OPERATION(Encode, LogArc, EncodeArgs2); +REGISTER_FST_OPERATION(Encode, Log64Arc, EncodeArgs2); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/encodemapper-class.cc b/runtime/onnxruntime/third_party/openfst/src/script/encodemapper-class.cc new file mode 100644 index 0000000..f93a468 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/encodemapper-class.cc @@ -0,0 +1,25 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { +namespace script { + +EncodeMapperClass::EncodeMapperClass(const string &arc_type, uint32 flags, + EncodeType type) : impl_(nullptr) { + InitEncodeMapperClassArgs args(flags, type, this); + Apply>("InitEncodeMapperClass", + arc_type, &args); +} + +REGISTER_FST_OPERATION(InitEncodeMapperClass, StdArc, + InitEncodeMapperClassArgs); +REGISTER_FST_OPERATION(InitEncodeMapperClass, LogArc, + InitEncodeMapperClassArgs); +REGISTER_FST_OPERATION(InitEncodeMapperClass, Log64Arc, + InitEncodeMapperClassArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/epsnormalize.cc b/runtime/onnxruntime/third_party/openfst/src/script/epsnormalize.cc new file mode 100644 index 0000000..df799db --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/epsnormalize.cc @@ -0,0 +1,26 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void EpsNormalize(const FstClass &ifst, MutableFstClass *ofst, + EpsNormalizeType norm_type) { + if (!internal::ArcTypesMatch(ifst, *ofst, "EpsNormalize")) { + ofst->SetProperties(kError, kError); + return; + } + EpsNormalizeArgs args(ifst, ofst, norm_type); + Apply>("EpsNormalize", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(EpsNormalize, StdArc, EpsNormalizeArgs); +REGISTER_FST_OPERATION(EpsNormalize, LogArc, EpsNormalizeArgs); +REGISTER_FST_OPERATION(EpsNormalize, Log64Arc, EpsNormalizeArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/equal.cc b/runtime/onnxruntime/third_party/openfst/src/script/equal.cc new file mode 100644 index 0000000..7d56777 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/equal.cc @@ -0,0 +1,24 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +bool Equal(const FstClass &fst1, const FstClass &fst2, float delta) { + if (!internal::ArcTypesMatch(fst1, fst2, "Equal")) return false; + EqualInnerArgs iargs(fst1, fst2, delta); + EqualArgs args(iargs); + Apply>("Equal", fst1.ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(Equal, StdArc, EqualArgs); +REGISTER_FST_OPERATION(Equal, LogArc, EqualArgs); +REGISTER_FST_OPERATION(Equal, Log64Arc, EqualArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/equivalent.cc b/runtime/onnxruntime/third_party/openfst/src/script/equivalent.cc new file mode 100644 index 0000000..10bc1e7 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/equivalent.cc @@ -0,0 +1,24 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +bool Equivalent(const FstClass &fst1, const FstClass &fst2, float delta) { + if (!internal::ArcTypesMatch(fst1, fst2, "Equivalent")) return false; + EquivalentInnerArgs iargs(fst1, fst2, delta); + EquivalentArgs args(iargs); + Apply>("Equivalent", fst1.ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(Equivalent, StdArc, EquivalentArgs); +REGISTER_FST_OPERATION(Equivalent, LogArc, EquivalentArgs); +REGISTER_FST_OPERATION(Equivalent, Log64Arc, EquivalentArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/fst-class.cc b/runtime/onnxruntime/third_party/openfst/src/script/fst-class.cc new file mode 100644 index 0000000..6e01fda --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/fst-class.cc @@ -0,0 +1,143 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// These classes are only recommended for use in high-level scripting +// applications. Most users should use the lower-level templated versions +// corresponding to these classes. + +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace fst { +namespace script { + +// Registration. + +REGISTER_FST_CLASSES(StdArc); +REGISTER_FST_CLASSES(LogArc); +REGISTER_FST_CLASSES(Log64Arc); + +// Helper functions. + +namespace { + +template +F *ReadFstClass(std::istream &istrm, const string &fname) { + if (!istrm) { + LOG(ERROR) << "ReadFstClass: Can't open file: " << fname; + return nullptr; + } + FstHeader hdr; + if (!hdr.Read(istrm, fname)) return nullptr; + const FstReadOptions read_options(fname, &hdr); + const auto &arc_type = hdr.ArcType(); + static const auto *io_register = IORegistration::Register::GetRegister(); + const auto reader = io_register->GetReader(arc_type); + if (!reader) { + LOG(ERROR) << "ReadFstClass: Unknown arc type: " << arc_type; + return nullptr; + } + return reader(istrm, read_options); +} + +template +FstClassImplBase *CreateFstClass(const string &arc_type) { + static const auto *io_register = + IORegistration::Register::GetRegister(); + auto creator = io_register->GetCreator(arc_type); + if (!creator) { + FSTERROR() << "CreateFstClass: Unknown arc type: " << arc_type; + return nullptr; + } + return creator(); +} + +template +FstClassImplBase *ConvertFstClass(const FstClass &other) { + static const auto *io_register = + IORegistration::Register::GetRegister(); + auto converter = io_register->GetConverter(other.ArcType()); + if (!converter) { + FSTERROR() << "ConvertFstClass: Unknown arc type: " << other.ArcType(); + return nullptr; + } + return converter(other); +} + +} // namespace + + +// FstClass methods. + +FstClass *FstClass::Read(const string &fname) { + if (!fname.empty()) { + std::ifstream istrm(fname, std::ios_base::in | std::ios_base::binary); + return ReadFstClass(istrm, fname); + } else { + return ReadFstClass(std::cin, "standard input"); + } +} + +FstClass *FstClass::Read(std::istream &istrm, const string &source) { + return ReadFstClass(istrm, source); +} + +bool FstClass::WeightTypesMatch(const WeightClass &weight, + const string &op_name) const { + if (WeightType() != weight.Type()) { + FSTERROR() << "FST and weight with non-matching weight types passed to " + << op_name << ": " << WeightType() << " and " << weight.Type(); + return false; + } + return true; +} + +// MutableFstClass methods. + +MutableFstClass *MutableFstClass::Read(const string &fname, bool convert) { + if (convert == false) { + if (!fname.empty()) { + std::ifstream in(fname, std::ios_base::in | std::ios_base::binary); + return ReadFstClass(in, fname); + } else { + return ReadFstClass(std::cin, "standard input"); + } + } else { // Converts to VectorFstClass if not mutable. + std::unique_ptr ifst(FstClass::Read(fname)); + if (!ifst) return nullptr; + if (ifst->Properties(kMutable, false) == kMutable) { + return static_cast(ifst.release()); + } else { + return new VectorFstClass(*ifst.release()); + } + } +} + +// VectorFstClass methods. + +VectorFstClass *VectorFstClass::Read(const string &fname) { + if (!fname.empty()) { + std::ifstream in(fname, std::ios_base::in | std::ios_base::binary); + return ReadFstClass(in, fname); + } else { + return ReadFstClass(std::cin, "standard input"); + } +} + +VectorFstClass::VectorFstClass(const string &arc_type) + : MutableFstClass(CreateFstClass(arc_type)) {} + + +VectorFstClass::VectorFstClass(const FstClass &other) + : MutableFstClass(ConvertFstClass(other)) {} + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/getters.cc b/runtime/onnxruntime/third_party/openfst/src/script/getters.cc new file mode 100644 index 0000000..e231506 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/getters.cc @@ -0,0 +1,137 @@ +#include + +namespace fst { +namespace script { + +bool GetArcSortType(const string &str, ArcSortType *sort_type) { + if (str == "ilabel") { + *sort_type = ILABEL_SORT; + } else if (str == "olabel") { + *sort_type = OLABEL_SORT; + } else { + return false; + } + return true; +} + +bool GetComposeFilter(const string &str, ComposeFilter *compose_filter) { + if (str == "alt_sequence") { + *compose_filter = ALT_SEQUENCE_FILTER; + } else if (str == "auto") { + *compose_filter = AUTO_FILTER; + } else if (str == "match") { + *compose_filter = MATCH_FILTER; + } else if (str == "no_match") { + *compose_filter = NO_MATCH_FILTER; + } else if (str == "null") { + *compose_filter = NULL_FILTER; + } else if (str == "sequence") { + *compose_filter = SEQUENCE_FILTER; + } else if (str == "trivial") { + *compose_filter = TRIVIAL_FILTER; + } else { + return false; + } + return true; +} + +bool GetDeterminizeType(const string &str, DeterminizeType *det_type) { + if (str == "functional") { + *det_type = DETERMINIZE_FUNCTIONAL; + } else if (str == "nonfunctional") { + *det_type = DETERMINIZE_NONFUNCTIONAL; + } else if (str == "disambiguate") { + *det_type = DETERMINIZE_DISAMBIGUATE; + } else { + return false; + } + return true; +} + +bool GetMapType(const string &str, MapType *map_type) { + if (str == "arc_sum") { + *map_type = ARC_SUM_MAPPER; + } else if (str == "arc_unique") { + *map_type = ARC_UNIQUE_MAPPER; + } else if (str == "identity") { + *map_type = IDENTITY_MAPPER; + } else if (str == "input_epsilon") { + *map_type = INPUT_EPSILON_MAPPER; + } else if (str == "invert") { + *map_type = INVERT_MAPPER; + } else if (str == "output_epsilon") { + *map_type = OUTPUT_EPSILON_MAPPER; + } else if (str == "plus") { + *map_type = PLUS_MAPPER; + } else if (str == "power") { + *map_type = POWER_MAPPER; + } else if (str == "quantize") { + *map_type = QUANTIZE_MAPPER; + } else if (str == "rmweight") { + *map_type = RMWEIGHT_MAPPER; + } else if (str == "superfinal") { + *map_type = SUPERFINAL_MAPPER; + } else if (str == "times") { + *map_type = TIMES_MAPPER; + } else if (str == "to_log") { + *map_type = TO_LOG_MAPPER; + } else if (str == "to_log64") { + *map_type = TO_LOG64_MAPPER; + } else if (str == "to_std" || str == "to_standard") { + *map_type = TO_STD_MAPPER; + } else { + return false; + } + return true; +} + +bool GetRandArcSelection(const string &str, RandArcSelection *ras) { + if (str == "uniform") { + *ras = UNIFORM_ARC_SELECTOR; + } else if (str == "log_prob") { + *ras = LOG_PROB_ARC_SELECTOR; + } else if (str == "fast_log_prob") { + *ras = FAST_LOG_PROB_ARC_SELECTOR; + } else { + return false; + } + return true; +} + +bool GetQueueType(const string &str, QueueType *queue_type) { + if (str == "auto") { + *queue_type = AUTO_QUEUE; + } else if (str == "fifo") { + *queue_type = FIFO_QUEUE; + } else if (str == "lifo") { + *queue_type = LIFO_QUEUE; + } else if (str == "shortest") { + *queue_type = SHORTEST_FIRST_QUEUE; + } else if (str == "state") { + *queue_type = STATE_ORDER_QUEUE; + } else if (str == "top") { + *queue_type = TOP_ORDER_QUEUE; + } else { + return false; + } + return true; +} + +bool GetReplaceLabelType(const string &str, bool epsilon_on_replace, + ReplaceLabelType *rlt) { + if (epsilon_on_replace || str == "neither") { + *rlt = REPLACE_LABEL_NEITHER; + } else if (str == "input") { + *rlt = REPLACE_LABEL_INPUT; + } else if (str == "output") { + *rlt = REPLACE_LABEL_OUTPUT; + } else if (str == "both") { + *rlt = REPLACE_LABEL_BOTH; + } else { + return false; + } + return true; +} + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/info-impl.cc b/runtime/onnxruntime/third_party/openfst/src/script/info-impl.cc new file mode 100644 index 0000000..1d7c9bb --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/info-impl.cc @@ -0,0 +1,101 @@ +#include + +namespace fst { + +void PrintFstInfoImpl(const FstInfo &fstinfo, bool pipe) { + std::ostream &ostrm = pipe ? std::cerr : std::cout; + const auto old = ostrm.setf(std::ios::left); + ostrm.width(50); + ostrm << "fst type" << fstinfo.FstType() << std::endl; + ostrm.width(50); + ostrm << "arc type" << fstinfo.ArcType() << std::endl; + ostrm.width(50); + ostrm << "input symbol table" << fstinfo.InputSymbols() << std::endl; + ostrm.width(50); + ostrm << "output symbol table" << fstinfo.OutputSymbols() << std::endl; + if (!fstinfo.LongInfo()) { + ostrm.setf(old); + return; + } + ostrm.width(50); + ostrm << "# of states" << fstinfo.NumStates() << std::endl; + ostrm.width(50); + ostrm << "# of arcs" << fstinfo.NumArcs() << std::endl; + ostrm.width(50); + ostrm << "initial state" << fstinfo.Start() << std::endl; + ostrm.width(50); + ostrm << "# of final states" << fstinfo.NumFinal() << std::endl; + ostrm.width(50); + ostrm << "# of input/output epsilons" << fstinfo.NumEpsilons() << std::endl; + ostrm.width(50); + ostrm << "# of input epsilons" << fstinfo.NumInputEpsilons() << std::endl; + ostrm.width(50); + ostrm << "# of output epsilons" << fstinfo.NumOutputEpsilons() << std::endl; + ostrm.width(50); + ostrm << "input label multiplicity" << fstinfo.InputLabelMultiplicity() + << std::endl; + ostrm.width(50); + ostrm << "output label multiplicity" << fstinfo.OutputLabelMultiplicity() + << std::endl; + ostrm.width(50); + string arc_type = ""; + if (fstinfo.ArcFilterType() == "epsilon") + arc_type = "epsilon "; + else if (fstinfo.ArcFilterType() == "iepsilon") + arc_type = "input-epsilon "; + else if (fstinfo.ArcFilterType() == "oepsilon") + arc_type = "output-epsilon "; + const auto accessible_label = "# of " + arc_type + "accessible states"; + ostrm.width(50); + ostrm << accessible_label << fstinfo.NumAccessible() << std::endl; + const auto coaccessible_label = "# of " + arc_type + "coaccessible states"; + ostrm.width(50); + ostrm << coaccessible_label << fstinfo.NumCoAccessible() << std::endl; + const auto connected_label = "# of " + arc_type + "connected states"; + ostrm.width(50); + ostrm << connected_label << fstinfo.NumConnected() << std::endl; + const auto numcc_label = "# of " + arc_type + "connected components"; + ostrm.width(50); + ostrm << numcc_label << fstinfo.NumCc() << std::endl; + const auto numscc_label = "# of " + arc_type + "strongly conn components"; + ostrm.width(50); + ostrm << numscc_label << fstinfo.NumScc() << std::endl; + ostrm.width(50); + ostrm << "input matcher" + << (fstinfo.InputMatchType() == MATCH_INPUT + ? 'y' + : fstinfo.InputMatchType() == MATCH_NONE ? 'n' : '?') + << std::endl; + ostrm.width(50); + ostrm << "output matcher" + << (fstinfo.OutputMatchType() == MATCH_OUTPUT + ? 'y' + : fstinfo.OutputMatchType() == MATCH_NONE ? 'n' : '?') + << std::endl; + ostrm.width(50); + ostrm << "input lookahead" << (fstinfo.InputLookAhead() ? 'y' : 'n') + << std::endl; + ostrm.width(50); + ostrm << "output lookahead" << (fstinfo.OutputLookAhead() ? 'y' : 'n') + << std::endl; + uint64 prop = 1; + for (auto i = 0; i < 64; ++i, prop <<= 1) { + if (prop & kBinaryProperties) { + char value = 'n'; + if (fstinfo.Properties() & prop) value = 'y'; + ostrm.width(50); + ostrm << PropertyNames[i] << value << std::endl; + } else if (prop & kPosTrinaryProperties) { + char value = '?'; + if (fstinfo.Properties() & prop) + value = 'y'; + else if (fstinfo.Properties() & prop << 1) + value = 'n'; + ostrm.width(50); + ostrm << PropertyNames[i] << value << std::endl; + } + } + ostrm.setf(old); +} + +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/info.cc b/runtime/onnxruntime/third_party/openfst/src/script/info.cc new file mode 100644 index 0000000..4af5117 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/info.cc @@ -0,0 +1,36 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include +#include +#include + +namespace fst { +namespace script { + +void PrintFstInfo(const FstClass &fst, bool test_properties, + const string &arc_filter, const string &info_type, bool pipe, + bool verify) { + InfoArgs args(fst, test_properties, arc_filter, info_type, pipe, verify); + Apply>("PrintFstInfo", fst.ArcType(), &args); +} + +void GetFstInfo(const FstClass &fst, bool test_properties, + const string &arc_filter, const string &info_type, bool verify, + FstInfo *result) { + GetInfoArgs args(fst, test_properties, arc_filter, info_type, verify, result); + Apply>("GetFstInfo", fst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(PrintFstInfo, StdArc, InfoArgs); +REGISTER_FST_OPERATION(PrintFstInfo, LogArc, InfoArgs); +REGISTER_FST_OPERATION(PrintFstInfo, Log64Arc, InfoArgs); + +REGISTER_FST_OPERATION(GetFstInfo, StdArc, GetInfoArgs); +REGISTER_FST_OPERATION(GetFstInfo, LogArc, GetInfoArgs); +REGISTER_FST_OPERATION(GetFstInfo, Log64Arc, GetInfoArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/intersect.cc b/runtime/onnxruntime/third_party/openfst/src/script/intersect.cc new file mode 100644 index 0000000..123b019 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/intersect.cc @@ -0,0 +1,27 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Intersect(const FstClass &ifst1, const FstClass &ifst2, + MutableFstClass *ofst, const ComposeOptions &opts) { + if (!internal::ArcTypesMatch(ifst1, ifst2, "Intersect") || + !internal::ArcTypesMatch(*ofst, ifst1, "Intersect")) { + ofst->SetProperties(kError, kError); + return; + } + IntersectArgs args(ifst1, ifst2, ofst, opts); + Apply>("Intersect", ifst1.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Intersect, StdArc, IntersectArgs); +REGISTER_FST_OPERATION(Intersect, LogArc, IntersectArgs); +REGISTER_FST_OPERATION(Intersect, Log64Arc, IntersectArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/invert.cc b/runtime/onnxruntime/third_party/openfst/src/script/invert.cc new file mode 100644 index 0000000..1dcc68c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/invert.cc @@ -0,0 +1,20 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Invert(MutableFstClass *fst) { + Apply>("Invert", fst->ArcType(), fst); +} + +REGISTER_FST_OPERATION(Invert, StdArc, MutableFstClass); +REGISTER_FST_OPERATION(Invert, LogArc, MutableFstClass); +REGISTER_FST_OPERATION(Invert, Log64Arc, MutableFstClass); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/isomorphic.cc b/runtime/onnxruntime/third_party/openfst/src/script/isomorphic.cc new file mode 100644 index 0000000..4d89df4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/isomorphic.cc @@ -0,0 +1,24 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +bool Isomorphic(const FstClass &fst1, const FstClass &fst2, float delta) { + if (!internal::ArcTypesMatch(fst1, fst2, "Isomorphic")) return false; + IsomorphicInnerArgs iargs(fst1, fst2, delta); + IsomorphicArgs args(iargs); + Apply>("Isomorphic", fst1.ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(Isomorphic, StdArc, IsomorphicArgs); +REGISTER_FST_OPERATION(Isomorphic, LogArc, IsomorphicArgs); +REGISTER_FST_OPERATION(Isomorphic, Log64Arc, IsomorphicArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/libfstscript.vcxproj b/runtime/onnxruntime/third_party/openfst/src/script/libfstscript.vcxproj new file mode 100644 index 0000000..23d51b4 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/libfstscript.vcxproj @@ -0,0 +1,20 @@ + + + + + {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6} + StaticLibrary + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/openfst/src/script/libfstscript.vcxproj.filters b/runtime/onnxruntime/third_party/openfst/src/script/libfstscript.vcxproj.filters new file mode 100644 index 0000000..8a753bd --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/libfstscript.vcxproj.filters @@ -0,0 +1,13 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + \ No newline at end of file diff --git a/runtime/onnxruntime/third_party/openfst/src/script/map.cc b/runtime/onnxruntime/third_party/openfst/src/script/map.cc new file mode 100644 index 0000000..45ef380 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/map.cc @@ -0,0 +1,25 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +FstClass *Map(const FstClass &ifst, MapType map_type, float delta, double power, + const WeightClass &weight) { + if (!ifst.WeightTypesMatch(weight, "Map")) return nullptr; + MapInnerArgs iargs(ifst, map_type, delta, power, weight); + MapArgs args(iargs); + Apply>("Map", ifst.ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(Map, StdArc, MapArgs); +REGISTER_FST_OPERATION(Map, LogArc, MapArgs); +REGISTER_FST_OPERATION(Map, Log64Arc, MapArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/minimize.cc b/runtime/onnxruntime/third_party/openfst/src/script/minimize.cc new file mode 100644 index 0000000..9c4e59c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/minimize.cc @@ -0,0 +1,27 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Minimize(MutableFstClass *ofst1, MutableFstClass *ofst2, float delta, + bool allow_nondet) { + if (ofst2 && !internal::ArcTypesMatch(*ofst1, *ofst2, "Minimize")) { + ofst1->SetProperties(kError, kError); + ofst2->SetProperties(kError, kError); + return; + } + MinimizeArgs args(ofst1, ofst2, delta, allow_nondet); + Apply>("Minimize", ofst1->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Minimize, StdArc, MinimizeArgs); +REGISTER_FST_OPERATION(Minimize, LogArc, MinimizeArgs); +REGISTER_FST_OPERATION(Minimize, Log64Arc, MinimizeArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/print.cc b/runtime/onnxruntime/third_party/openfst/src/script/print.cc new file mode 100644 index 0000000..df28dac --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/print.cc @@ -0,0 +1,29 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +void PrintFst(const FstClass &fst, std::ostream &ostrm, const string &dest, + const SymbolTable *isyms, const SymbolTable *osyms, + const SymbolTable *ssyms, bool accept, bool show_weight_one, + const string &missing_sym) { + const auto sep = FLAGS_fst_field_separator.substr(0, 1); + FstPrinterArgs args(fst, isyms, osyms, ssyms, accept, show_weight_one, &ostrm, + dest, sep, missing_sym); + Apply>("PrintFst", fst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(PrintFst, StdArc, FstPrinterArgs); +REGISTER_FST_OPERATION(PrintFst, LogArc, FstPrinterArgs); +REGISTER_FST_OPERATION(PrintFst, Log64Arc, FstPrinterArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/project.cc b/runtime/onnxruntime/third_party/openfst/src/script/project.cc new file mode 100644 index 0000000..32678a0 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/project.cc @@ -0,0 +1,22 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + + +void Project(MutableFstClass *ofst, ProjectType project_type) { + ProjectArgs args(ofst, project_type); + Apply>("Project", ofst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Project, StdArc, ProjectArgs); +REGISTER_FST_OPERATION(Project, LogArc, ProjectArgs); +REGISTER_FST_OPERATION(Project, Log64Arc, ProjectArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/prune.cc b/runtime/onnxruntime/third_party/openfst/src/script/prune.cc new file mode 100644 index 0000000..37862e2 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/prune.cc @@ -0,0 +1,42 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Prune(const FstClass &ifst, MutableFstClass *ofst, + const WeightClass &weight_threshold, + int64 state_threshold, float delta) { + if (!internal::ArcTypesMatch(ifst, *ofst, "Prune") || + !ofst->WeightTypesMatch(weight_threshold, "Prune")) { + ofst->SetProperties(kError, kError); + return; + } + PruneArgs1 args(ifst, ofst, weight_threshold, state_threshold, delta); + Apply>("Prune", ifst.ArcType(), &args); +} + +void Prune(MutableFstClass *fst, const WeightClass &weight_threshold, + int64 state_threshold, float delta) { + if (!fst->WeightTypesMatch(weight_threshold, "Prune")) { + fst->SetProperties(kError, kError); + return; + } + PruneArgs2 args(fst, weight_threshold, state_threshold, delta); + Apply>("Prune", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Prune, StdArc, PruneArgs1); +REGISTER_FST_OPERATION(Prune, LogArc, PruneArgs1); +REGISTER_FST_OPERATION(Prune, Log64Arc, PruneArgs1); + +REGISTER_FST_OPERATION(Prune, StdArc, PruneArgs2); +REGISTER_FST_OPERATION(Prune, LogArc, PruneArgs2); +REGISTER_FST_OPERATION(Prune, Log64Arc, PruneArgs2); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/push.cc b/runtime/onnxruntime/third_party/openfst/src/script/push.cc new file mode 100644 index 0000000..5b9dbea --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/push.cc @@ -0,0 +1,36 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Push(MutableFstClass *fst, ReweightType rew_type, float delta, + bool remove_total_weight) { + PushArgs1 args(fst, rew_type, delta, remove_total_weight); + Apply>("Push", fst->ArcType(), &args); +} + +void Push(const FstClass &ifst, MutableFstClass *ofst, uint32 flags, + ReweightType rew_type, float delta) { + if (!internal::ArcTypesMatch(ifst, *ofst, "Push")) { + ofst->SetProperties(kError, kError); + return; + } + PushArgs2 args(ifst, ofst, flags, rew_type, delta); + Apply>("Push", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Push, StdArc, PushArgs1); +REGISTER_FST_OPERATION(Push, LogArc, PushArgs1); +REGISTER_FST_OPERATION(Push, Log64Arc, PushArgs1); + +REGISTER_FST_OPERATION(Push, StdArc, PushArgs2); +REGISTER_FST_OPERATION(Push, LogArc, PushArgs2); +REGISTER_FST_OPERATION(Push, Log64Arc, PushArgs2); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/randequivalent.cc b/runtime/onnxruntime/third_party/openfst/src/script/randequivalent.cc new file mode 100644 index 0000000..3fa518e --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/randequivalent.cc @@ -0,0 +1,26 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +bool RandEquivalent(const FstClass &fst1, const FstClass &fst2, int32 npath, + float delta, time_t seed, + const RandGenOptions &opts) { + if (!internal::ArcTypesMatch(fst1, fst2, "RandEquivalent")) return false; + RandEquivalentInnerArgs iargs(fst1, fst2, npath, delta, seed, opts); + RandEquivalentArgs args(iargs); + Apply>("RandEquivalent", fst1.ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(RandEquivalent, StdArc, RandEquivalentArgs); +REGISTER_FST_OPERATION(RandEquivalent, LogArc, RandEquivalentArgs); +REGISTER_FST_OPERATION(RandEquivalent, Log64Arc, RandEquivalentArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/randgen.cc b/runtime/onnxruntime/third_party/openfst/src/script/randgen.cc new file mode 100644 index 0000000..4da59ae --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/randgen.cc @@ -0,0 +1,26 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void RandGen(const FstClass &ifst, MutableFstClass *ofst, time_t seed, + const RandGenOptions &opts) { + if (!internal::ArcTypesMatch(ifst, *ofst, "RandGen")) { + ofst->SetProperties(kError, kError); + return; + } + RandGenArgs args(ifst, ofst, seed, opts); + Apply>("RandGen", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(RandGen, StdArc, RandGenArgs); +REGISTER_FST_OPERATION(RandGen, LogArc, RandGenArgs); +REGISTER_FST_OPERATION(RandGen, Log64Arc, RandGenArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/relabel.cc b/runtime/onnxruntime/third_party/openfst/src/script/relabel.cc new file mode 100644 index 0000000..a2be47c --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/relabel.cc @@ -0,0 +1,37 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Relabel(MutableFstClass *ofst, + const SymbolTable *old_isyms, const SymbolTable *relabel_isyms, + const string &unknown_isymbol, bool attach_new_isyms, + const SymbolTable *old_osyms, const SymbolTable *relabel_osyms, + const string &unknown_osymbol, bool attach_new_osyms) { + RelabelArgs1 args(ofst, old_isyms, relabel_isyms, unknown_isymbol, + attach_new_isyms, old_osyms, relabel_osyms, + unknown_osymbol, attach_new_osyms); + Apply>("Relabel", ofst->ArcType(), &args); +} + +void Relabel(MutableFstClass *ofst, const std::vector &ipairs, + const std::vector &opairs) { + RelabelArgs2 args(ofst, ipairs, opairs); + Apply>("Relabel", ofst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Relabel, StdArc, RelabelArgs1); +REGISTER_FST_OPERATION(Relabel, LogArc, RelabelArgs1); +REGISTER_FST_OPERATION(Relabel, Log64Arc, RelabelArgs1); + +REGISTER_FST_OPERATION(Relabel, StdArc, RelabelArgs2); +REGISTER_FST_OPERATION(Relabel, LogArc, RelabelArgs2); +REGISTER_FST_OPERATION(Relabel, Log64Arc, RelabelArgs2); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/replace.cc b/runtime/onnxruntime/third_party/openfst/src/script/replace.cc new file mode 100644 index 0000000..3a92120 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/replace.cc @@ -0,0 +1,34 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Replace(const std::vector &pairs, MutableFstClass *ofst, + const ReplaceOptions &opts) { + if (!pairs.empty()) { + for (auto it = pairs.begin(); it != pairs.end() - 1; ++it) { + if (!internal::ArcTypesMatch(*it->second, *(it + 1)->second, "Replace")) { + ofst->SetProperties(kError, kError); + return; + } + } + if (!internal::ArcTypesMatch(*pairs[0].second, *ofst, "Replace")) { + ofst->SetProperties(kError, kError); + return; + } + } + ReplaceArgs args(pairs, ofst, opts); + Apply>("Replace", ofst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Replace, StdArc, ReplaceArgs); +REGISTER_FST_OPERATION(Replace, LogArc, ReplaceArgs); +REGISTER_FST_OPERATION(Replace, Log64Arc, ReplaceArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/reverse.cc b/runtime/onnxruntime/third_party/openfst/src/script/reverse.cc new file mode 100644 index 0000000..e403b79 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/reverse.cc @@ -0,0 +1,26 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Reverse(const FstClass &ifst, MutableFstClass *ofst, + bool require_superinitial) { + if (!internal::ArcTypesMatch(ifst, *ofst, "Reverse")) { + ofst->SetProperties(kError, kError); + return; + } + ReverseArgs args(ifst, ofst, require_superinitial); + Apply>("Reverse", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Reverse, StdArc, ReverseArgs); +REGISTER_FST_OPERATION(Reverse, LogArc, ReverseArgs); +REGISTER_FST_OPERATION(Reverse, Log64Arc, ReverseArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/reweight.cc b/runtime/onnxruntime/third_party/openfst/src/script/reweight.cc new file mode 100644 index 0000000..c2306a1 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/reweight.cc @@ -0,0 +1,22 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Reweight(MutableFstClass *fst, const std::vector &potential, + ReweightType reweight_type) { + ReweightArgs args(fst, potential, reweight_type); + Apply>("Reweight", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Reweight, StdArc, ReweightArgs); +REGISTER_FST_OPERATION(Reweight, LogArc, ReweightArgs); +REGISTER_FST_OPERATION(Reweight, Log64Arc, ReweightArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/rmepsilon.cc b/runtime/onnxruntime/third_party/openfst/src/script/rmepsilon.cc new file mode 100644 index 0000000..6808990 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/rmepsilon.cc @@ -0,0 +1,25 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void RmEpsilon(MutableFstClass *fst, const RmEpsilonOptions &opts) { + if (!fst->WeightTypesMatch(opts.weight_threshold, "RmEpsilon")) { + fst->SetProperties(kError, kError); + return; + } + RmEpsilonArgs args(fst, opts); + Apply>("RmEpsilon", fst->ArcType(), &args); +} + +REGISTER_FST_OPERATION(RmEpsilon, StdArc, RmEpsilonArgs); +REGISTER_FST_OPERATION(RmEpsilon, LogArc, RmEpsilonArgs); +REGISTER_FST_OPERATION(RmEpsilon, Log64Arc, RmEpsilonArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/shortest-distance.cc b/runtime/onnxruntime/third_party/openfst/src/script/shortest-distance.cc new file mode 100644 index 0000000..080e29d --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/shortest-distance.cc @@ -0,0 +1,34 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void ShortestDistance(const FstClass &fst, std::vector *distance, + const ShortestDistanceOptions &opts) { + ShortestDistanceArgs1 args(fst, distance, opts); + Apply>("ShortestDistance", fst.ArcType(), + &args); +} + +void ShortestDistance(const FstClass &ifst, std::vector *distance, + bool reverse, double delta) { + ShortestDistanceArgs2 args(ifst, distance, reverse, delta); + Apply>("ShortestDistance", ifst.ArcType(), + &args); +} + +REGISTER_FST_OPERATION(ShortestDistance, StdArc, ShortestDistanceArgs1); +REGISTER_FST_OPERATION(ShortestDistance, LogArc, ShortestDistanceArgs1); +REGISTER_FST_OPERATION(ShortestDistance, Log64Arc, ShortestDistanceArgs1); + +REGISTER_FST_OPERATION(ShortestDistance, StdArc, ShortestDistanceArgs2); +REGISTER_FST_OPERATION(ShortestDistance, LogArc, ShortestDistanceArgs2); +REGISTER_FST_OPERATION(ShortestDistance, Log64Arc, ShortestDistanceArgs2); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/shortest-path.cc b/runtime/onnxruntime/third_party/openfst/src/script/shortest-path.cc new file mode 100644 index 0000000..cbbda63 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/shortest-path.cc @@ -0,0 +1,26 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void ShortestPath(const FstClass &ifst, MutableFstClass *ofst, + const ShortestPathOptions &opts) { + if (!internal::ArcTypesMatch(ifst, *ofst, "ShortestPath")) { + ofst->SetProperties(kError, kError); + return; + } + ShortestPathArgs args(ifst, ofst, opts); + Apply>("ShortestPath", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(ShortestPath, StdArc, ShortestPathArgs); +REGISTER_FST_OPERATION(ShortestPath, LogArc, ShortestPathArgs); +REGISTER_FST_OPERATION(ShortestPath, Log64Arc, ShortestPathArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/stateiterator-class.cc b/runtime/onnxruntime/third_party/openfst/src/script/stateiterator-class.cc new file mode 100644 index 0000000..7bacd92 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/stateiterator-class.cc @@ -0,0 +1,24 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include + +namespace fst { +namespace script { + +StateIteratorClass::StateIteratorClass(const FstClass &fst) : impl_(nullptr) { + InitStateIteratorClassArgs args(fst, this); + Apply>("InitStateIteratorClass", + fst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(InitStateIteratorClass, StdArc, + InitStateIteratorClassArgs); +REGISTER_FST_OPERATION(InitStateIteratorClass, LogArc, + InitStateIteratorClassArgs); +REGISTER_FST_OPERATION(InitStateIteratorClass, Log64Arc, + InitStateIteratorClassArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/synchronize.cc b/runtime/onnxruntime/third_party/openfst/src/script/synchronize.cc new file mode 100644 index 0000000..9599a3a --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/synchronize.cc @@ -0,0 +1,25 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Synchronize(const FstClass &ifst, MutableFstClass *ofst) { + if (!internal::ArcTypesMatch(ifst, *ofst, "Synchronize")) { + ofst->SetProperties(kError, kError); + return; + } + SynchronizeArgs args(ifst, ofst); + Apply>("Synchronize", ifst.ArcType(), &args); +} + +REGISTER_FST_OPERATION(Synchronize, StdArc, SynchronizeArgs); +REGISTER_FST_OPERATION(Synchronize, LogArc, SynchronizeArgs); +REGISTER_FST_OPERATION(Synchronize, Log64Arc, SynchronizeArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/text-io.cc b/runtime/onnxruntime/third_party/openfst/src/script/text-io.cc new file mode 100644 index 0000000..a7be721 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/text-io.cc @@ -0,0 +1,76 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace fst { +namespace script { + +// Reads vector of weights; returns true on success. +bool ReadPotentials(const string &weight_type, const string &filename, + std::vector *potentials) { + std::ifstream istrm(filename); + if (!istrm.good()) { + LOG(ERROR) << "ReadPotentials: Can't open file: " << filename; + return false; + } + static constexpr int kLineLen = 8096; + char line[kLineLen]; + size_t nline = 0; + potentials->clear(); + while (!istrm.getline(line, kLineLen).fail()) { + ++nline; + std::vector col; + SplitString(line, "\n\t ", &col, true); + if (col.empty() || col[0][0] == '\0') continue; + if (col.size() != 2) { + FSTERROR() << "ReadPotentials: Bad number of columns, " + << "file = " << filename << ", line = " << nline; + return false; + } + const ssize_t s = StrToInt64(col[0], filename, nline, false); + const WeightClass weight(weight_type, col[1]); + while (potentials->size() <= s) { + potentials->push_back(WeightClass::Zero(weight_type)); + } + potentials->back() = weight; + } + return true; +} + +// Writes vector of weights; returns true on success. +bool WritePotentials(const string &filename, + const std::vector &potentials) { + std::ofstream ostrm; + if (!filename.empty()) { + ostrm.open(filename); + if (!ostrm.good()) { + LOG(ERROR) << "WritePotentials: Can't open file: " << filename; + return false; + } + } + std::ostream &strm = ostrm.is_open() ? ostrm : std::cout; + strm.precision(9); + for (size_t s = 0; s < potentials.size(); ++s) { + strm << s << "\t" << potentials[s] << "\n"; + } + if (strm.fail()) { + LOG(ERROR) << "WritePotentials: Write failed: " + << (filename.empty() ? "standard output" : filename); + return false; + } + return true; +} + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/topsort.cc b/runtime/onnxruntime/third_party/openfst/src/script/topsort.cc new file mode 100644 index 0000000..8acd3d8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/topsort.cc @@ -0,0 +1,22 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +bool TopSort(MutableFstClass *fst) { + TopSortArgs args(fst); + Apply>("TopSort", fst->ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(TopSort, StdArc, TopSortArgs); +REGISTER_FST_OPERATION(TopSort, LogArc, TopSortArgs); +REGISTER_FST_OPERATION(TopSort, Log64Arc, TopSortArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/union.cc b/runtime/onnxruntime/third_party/openfst/src/script/union.cc new file mode 100644 index 0000000..c5e8720 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/union.cc @@ -0,0 +1,25 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +void Union(MutableFstClass *fst1, const FstClass &fst2) { + if (!internal::ArcTypesMatch(*fst1, fst2, "Union")) { + fst1->SetProperties(kError, kError); + return; + } + UnionArgs args(fst1, fst2); + Apply>("Union", fst1->ArcType(), &args); +} + +REGISTER_FST_OPERATION(Union, StdArc, UnionArgs); +REGISTER_FST_OPERATION(Union, LogArc, UnionArgs); +REGISTER_FST_OPERATION(Union, Log64Arc, UnionArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/verify.cc b/runtime/onnxruntime/third_party/openfst/src/script/verify.cc new file mode 100644 index 0000000..b6e74be --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/verify.cc @@ -0,0 +1,22 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include +#include +#include + +namespace fst { +namespace script { + +bool Verify(const FstClass &fst) { + VerifyArgs args(fst); + Apply>("Verify", fst.ArcType(), &args); + return args.retval; +} + +REGISTER_FST_OPERATION(Verify, StdArc, VerifyArgs); +REGISTER_FST_OPERATION(Verify, LogArc, VerifyArgs); +REGISTER_FST_OPERATION(Verify, Log64Arc, VerifyArgs); + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/script/weight-class.cc b/runtime/onnxruntime/third_party/openfst/src/script/weight-class.cc new file mode 100644 index 0000000..49db6bc --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/script/weight-class.cc @@ -0,0 +1,102 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. + +#include + +namespace fst { +namespace script { + +REGISTER_FST_WEIGHT(StdArc::Weight); +REGISTER_FST_WEIGHT(LogArc::Weight); +REGISTER_FST_WEIGHT(Log64Arc::Weight); + +WeightClass::WeightClass(const string &weight_type, const string &weight_str) { + WeightClassRegister *reg = WeightClassRegister::GetRegister(); + StrToWeightImplBaseT stw = reg->GetEntry(weight_type); + if (!stw) { + FSTERROR() << "Unknown weight type: " << weight_type; + impl_.reset(); + return; + } + impl_.reset(stw(weight_str, "WeightClass", 0)); +} + +WeightClass WeightClass::Zero(const string &weight_type) { + return WeightClass(weight_type, __ZERO__); +} + +WeightClass WeightClass::One(const string &weight_type) { + return WeightClass(weight_type, __ONE__); +} + +WeightClass WeightClass::NoWeight(const string &weight_type) { + return WeightClass(weight_type, __NOWEIGHT__); +} + +bool WeightClass::WeightTypesMatch(const WeightClass &other, + const string &op_name) const { + if (Type() != other.Type()) { + FSTERROR() << "Weights with non-matching types passed to " << op_name + << ": " << Type() << " and " << other.Type(); + return false; + } + return true; +} + +bool operator==(const WeightClass &lhs, const WeightClass &rhs) { + const auto *lhs_impl = lhs.GetImpl(); + const auto *rhs_impl = rhs.GetImpl(); + if (!(lhs_impl && rhs_impl && lhs.WeightTypesMatch(rhs, "operator=="))) { + return false; + } + return *lhs_impl == *rhs_impl; +} + +bool operator!=(const WeightClass &lhs, const WeightClass &rhs) { + return !(lhs == rhs); +} + +WeightClass Plus(const WeightClass &lhs, const WeightClass &rhs) { + const auto *rhs_impl = rhs.GetImpl(); + if (!(lhs.GetImpl() && rhs_impl && lhs.WeightTypesMatch(rhs, "Plus"))) { + return WeightClass(); + } + WeightClass result(lhs); + result.GetImpl()->PlusEq(*rhs_impl); + return result; +} + +WeightClass Times(const WeightClass &lhs, const WeightClass &rhs) { + const auto *rhs_impl = rhs.GetImpl(); + if (!(lhs.GetImpl() && rhs_impl && lhs.WeightTypesMatch(rhs, "Plus"))) { + return WeightClass(); + } + WeightClass result(lhs); + result.GetImpl()->TimesEq(*rhs_impl); + return result; +} + +WeightClass Divide(const WeightClass &lhs, const WeightClass &rhs) { + const auto *rhs_impl = rhs.GetImpl(); + if (!(lhs.GetImpl() && rhs_impl && lhs.WeightTypesMatch(rhs, "Divide"))) { + return WeightClass(); + } + WeightClass result(lhs); + result.GetImpl()->DivideEq(*rhs_impl); + return result; +} + +WeightClass Power(const WeightClass &weight, size_t n) { + if (!weight.GetImpl()) return WeightClass(); + WeightClass result(weight); + result.GetImpl()->PowerEq(n); + return result; +} + +std::ostream &operator<<(std::ostream &ostrm, const WeightClass &weight) { + weight.impl_->Print(&ostrm); + return ostrm; +} + +} // namespace script +} // namespace fst diff --git a/runtime/onnxruntime/third_party/openfst/src/test/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/test/CMakeLists.txt new file mode 100644 index 0000000..d30e218 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/test/CMakeLists.txt @@ -0,0 +1,55 @@ +add_executable(fst_test + fst_test.cc + ../include/fst/test/fst_test.h + ) +target_link_libraries(fst_test fst ${CMAKE_DL_LIBS}) +set_target_properties(fst_test PROPERTIES FOLDER test) +add_test(NAME fst_test-test COMMAND fst_test) + +add_executable(weight_test + weight_test.cc + ../include/fst/test/weight-tester.h + ) +target_link_libraries(weight_test fst ${CMAKE_DL_LIBS}) +set_target_properties(weight_test PROPERTIES FOLDER test) +add_test(NAME weight_test-test COMMAND weight_test) + +add_executable(algo_test_log algo_test.cc ../include/fst/test/algo_test.h ../include/fst/test/rand-fst.h) +target_link_libraries(algo_test_log fst ${CMAKE_DL_LIBS}) +target_compile_definitions(algo_test_log + PRIVATE TEST_LOG=1) +set_target_properties(algo_test_log PROPERTIES FOLDER test) +add_test(NAME algo_test_log-test COMMAND algo_test_log) + + +add_executable(algo_test_tropical algo_test.cc ../include/fst/test/algo_test.h ../include/fst/test/rand-fst.h) +target_link_libraries(algo_test_tropical fst ${CMAKE_DL_LIBS}) +target_compile_definitions(algo_test_tropical + PRIVATE TEST_TROPICAL=1) +set_target_properties(algo_test_tropical PROPERTIES FOLDER test) +add_test(NAME algo_test_tropical-test COMMAND algo_test_tropical) + + +add_executable(algo_test_minmax algo_test.cc ../include/fst/test/algo_test.h ../include/fst/test/rand-fst.h) +target_link_libraries(algo_test_minmax fst ${CMAKE_DL_LIBS}) +target_compile_definitions(algo_test_minmax + PRIVATE TEST_MINMAX=1) +set_target_properties(algo_test_minmax PROPERTIES FOLDER test) +add_test(NAME algo_test_minmax-test COMMAND algo_test_minmax) + + +add_executable(algo_test_lexicographic algo_test.cc ../include/fst/test/algo_test.h ../include/fst/test/rand-fst.h) +target_link_libraries(algo_test_lexicographic fst ${CMAKE_DL_LIBS}) +target_compile_definitions(algo_test_lexicographic + PRIVATE TEST_LEXICOGRAPHIC=1) +set_target_properties(algo_test_lexicographic PROPERTIES FOLDER test) +add_test(NAME algo_test_lexicographic-test COMMAND algo_test_lexicographic) + + +add_executable(algo_test_power algo_test.cc ../include/fst/test/algo_test.h ../include/fst/test/rand-fst.h) +target_link_libraries(algo_test_power fst ${CMAKE_DL_LIBS}) +target_compile_definitions(algo_test_power + PRIVATE TEST_POWER=1) +set_target_properties(algo_test_power PROPERTIES FOLDER test) +add_test(NAME algo_test_power-test COMMAND algo_test_power) + diff --git a/runtime/onnxruntime/third_party/openfst/src/test/Makefile.am b/runtime/onnxruntime/third_party/openfst/src/test/Makefile.am new file mode 100644 index 0000000..a2754e5 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/test/Makefile.am @@ -0,0 +1,32 @@ +AM_CPPFLAGS = -I$(srcdir)/../include $(ICU_CPPFLAGS) +LDADD = ../lib/libfst.la -lm $(DL_LIBS) + +check_PROGRAMS = fst_test weight_test + +fst_test_SOURCES = fst_test.cc + +weight_test_SOURCES = weight_test.cc + +algo_test_SOURCES = algo_test.cc + +check_PROGRAMS += algo_test_log +algo_test_log_SOURCES = $(algo_test_SOURCES) +algo_test_log_CPPFLAGS = -DTEST_LOG $(AM_CPPFLAGS) + +check_PROGRAMS += algo_test_tropical +algo_test_tropical_SOURCES = $(algo_test_SOURCES) +algo_test_tropical_CPPFLAGS = -DTEST_TROPICAL $(AM_CPPFLAGS) + +check_PROGRAMS += algo_test_minmax +algo_test_minmax_SOURCES = $(algo_test_SOURCES) +algo_test_minmax_CPPFLAGS = -DTEST_MINMAX $(AM_CPPFLAGS) + +check_PROGRAMS += algo_test_lexicographic +algo_test_lexicographic_SOURCES = $(algo_test_SOURCES) +algo_test_lexicographic_CPPFLAGS = -DTEST_LEXICOGRAPHIC $(AM_CPPFLAGS) + +check_PROGRAMS += algo_test_power +algo_test_power_SOURCES = $(algo_test_SOURCES) +algo_test_power_CPPFLAGS = -DTEST_POWER $(AM_CPPFLAGS) + +TESTS = $(check_PROGRAMS) diff --git a/runtime/onnxruntime/third_party/openfst/src/test/Makefile.in b/runtime/onnxruntime/third_party/openfst/src/test/Makefile.in new file mode 100644 index 0000000..333adad --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/test/Makefile.in @@ -0,0 +1,1178 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = fst_test$(EXEEXT) weight_test$(EXEEXT) \ + algo_test_log$(EXEEXT) algo_test_tropical$(EXEEXT) \ + algo_test_minmax$(EXEEXT) algo_test_lexicographic$(EXEEXT) \ + algo_test_power$(EXEEXT) +subdir = src/test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/include/fst/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__objects_1 = algo_test_lexicographic-algo_test.$(OBJEXT) +am_algo_test_lexicographic_OBJECTS = $(am__objects_1) +algo_test_lexicographic_OBJECTS = \ + $(am_algo_test_lexicographic_OBJECTS) +algo_test_lexicographic_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +algo_test_lexicographic_DEPENDENCIES = ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am__objects_2 = algo_test_log-algo_test.$(OBJEXT) +am_algo_test_log_OBJECTS = $(am__objects_2) +algo_test_log_OBJECTS = $(am_algo_test_log_OBJECTS) +algo_test_log_LDADD = $(LDADD) +algo_test_log_DEPENDENCIES = ../lib/libfst.la $(am__DEPENDENCIES_1) +am__objects_3 = algo_test_minmax-algo_test.$(OBJEXT) +am_algo_test_minmax_OBJECTS = $(am__objects_3) +algo_test_minmax_OBJECTS = $(am_algo_test_minmax_OBJECTS) +algo_test_minmax_LDADD = $(LDADD) +algo_test_minmax_DEPENDENCIES = ../lib/libfst.la $(am__DEPENDENCIES_1) +am__objects_4 = algo_test_power-algo_test.$(OBJEXT) +am_algo_test_power_OBJECTS = $(am__objects_4) +algo_test_power_OBJECTS = $(am_algo_test_power_OBJECTS) +algo_test_power_LDADD = $(LDADD) +algo_test_power_DEPENDENCIES = ../lib/libfst.la $(am__DEPENDENCIES_1) +am__objects_5 = algo_test_tropical-algo_test.$(OBJEXT) +am_algo_test_tropical_OBJECTS = $(am__objects_5) +algo_test_tropical_OBJECTS = $(am_algo_test_tropical_OBJECTS) +algo_test_tropical_LDADD = $(LDADD) +algo_test_tropical_DEPENDENCIES = ../lib/libfst.la \ + $(am__DEPENDENCIES_1) +am_fst_test_OBJECTS = fst_test.$(OBJEXT) +fst_test_OBJECTS = $(am_fst_test_OBJECTS) +fst_test_LDADD = $(LDADD) +fst_test_DEPENDENCIES = ../lib/libfst.la $(am__DEPENDENCIES_1) +am_weight_test_OBJECTS = weight_test.$(OBJEXT) +weight_test_OBJECTS = $(am_weight_test_OBJECTS) +weight_test_LDADD = $(LDADD) +weight_test_DEPENDENCIES = ../lib/libfst.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(algo_test_lexicographic_SOURCES) $(algo_test_log_SOURCES) \ + $(algo_test_minmax_SOURCES) $(algo_test_power_SOURCES) \ + $(algo_test_tropical_SOURCES) $(fst_test_SOURCES) \ + $(weight_test_SOURCES) +DIST_SOURCES = $(algo_test_lexicographic_SOURCES) \ + $(algo_test_log_SOURCES) $(algo_test_minmax_SOURCES) \ + $(algo_test_power_SOURCES) $(algo_test_tropical_SOURCES) \ + $(fst_test_SOURCES) $(weight_test_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libfstdir = @libfstdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(srcdir)/../include $(ICU_CPPFLAGS) +LDADD = ../lib/libfst.la -lm $(DL_LIBS) +fst_test_SOURCES = fst_test.cc +weight_test_SOURCES = weight_test.cc +algo_test_SOURCES = algo_test.cc +algo_test_log_SOURCES = $(algo_test_SOURCES) +algo_test_log_CPPFLAGS = -DTEST_LOG $(AM_CPPFLAGS) +algo_test_tropical_SOURCES = $(algo_test_SOURCES) +algo_test_tropical_CPPFLAGS = -DTEST_TROPICAL $(AM_CPPFLAGS) +algo_test_minmax_SOURCES = $(algo_test_SOURCES) +algo_test_minmax_CPPFLAGS = -DTEST_MINMAX $(AM_CPPFLAGS) +algo_test_lexicographic_SOURCES = $(algo_test_SOURCES) +algo_test_lexicographic_CPPFLAGS = -DTEST_LEXICOGRAPHIC $(AM_CPPFLAGS) +algo_test_power_SOURCES = $(algo_test_SOURCES) +algo_test_power_CPPFLAGS = -DTEST_POWER $(AM_CPPFLAGS) +TESTS = $(check_PROGRAMS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +algo_test_lexicographic$(EXEEXT): $(algo_test_lexicographic_OBJECTS) $(algo_test_lexicographic_DEPENDENCIES) $(EXTRA_algo_test_lexicographic_DEPENDENCIES) + @rm -f algo_test_lexicographic$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(algo_test_lexicographic_OBJECTS) $(algo_test_lexicographic_LDADD) $(LIBS) + +algo_test_log$(EXEEXT): $(algo_test_log_OBJECTS) $(algo_test_log_DEPENDENCIES) $(EXTRA_algo_test_log_DEPENDENCIES) + @rm -f algo_test_log$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(algo_test_log_OBJECTS) $(algo_test_log_LDADD) $(LIBS) + +algo_test_minmax$(EXEEXT): $(algo_test_minmax_OBJECTS) $(algo_test_minmax_DEPENDENCIES) $(EXTRA_algo_test_minmax_DEPENDENCIES) + @rm -f algo_test_minmax$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(algo_test_minmax_OBJECTS) $(algo_test_minmax_LDADD) $(LIBS) + +algo_test_power$(EXEEXT): $(algo_test_power_OBJECTS) $(algo_test_power_DEPENDENCIES) $(EXTRA_algo_test_power_DEPENDENCIES) + @rm -f algo_test_power$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(algo_test_power_OBJECTS) $(algo_test_power_LDADD) $(LIBS) + +algo_test_tropical$(EXEEXT): $(algo_test_tropical_OBJECTS) $(algo_test_tropical_DEPENDENCIES) $(EXTRA_algo_test_tropical_DEPENDENCIES) + @rm -f algo_test_tropical$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(algo_test_tropical_OBJECTS) $(algo_test_tropical_LDADD) $(LIBS) + +fst_test$(EXEEXT): $(fst_test_OBJECTS) $(fst_test_DEPENDENCIES) $(EXTRA_fst_test_DEPENDENCIES) + @rm -f fst_test$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fst_test_OBJECTS) $(fst_test_LDADD) $(LIBS) + +weight_test$(EXEEXT): $(weight_test_OBJECTS) $(weight_test_DEPENDENCIES) $(EXTRA_weight_test_DEPENDENCIES) + @rm -f weight_test$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(weight_test_OBJECTS) $(weight_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/algo_test_lexicographic-algo_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/algo_test_log-algo_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/algo_test_minmax-algo_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/algo_test_power-algo_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/algo_test_tropical-algo_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fst_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weight_test.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +algo_test_lexicographic-algo_test.o: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_lexicographic_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_lexicographic-algo_test.o -MD -MP -MF $(DEPDIR)/algo_test_lexicographic-algo_test.Tpo -c -o algo_test_lexicographic-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_lexicographic-algo_test.Tpo $(DEPDIR)/algo_test_lexicographic-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_lexicographic-algo_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_lexicographic_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_lexicographic-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc + +algo_test_lexicographic-algo_test.obj: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_lexicographic_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_lexicographic-algo_test.obj -MD -MP -MF $(DEPDIR)/algo_test_lexicographic-algo_test.Tpo -c -o algo_test_lexicographic-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_lexicographic-algo_test.Tpo $(DEPDIR)/algo_test_lexicographic-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_lexicographic-algo_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_lexicographic_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_lexicographic-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` + +algo_test_log-algo_test.o: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_log_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_log-algo_test.o -MD -MP -MF $(DEPDIR)/algo_test_log-algo_test.Tpo -c -o algo_test_log-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_log-algo_test.Tpo $(DEPDIR)/algo_test_log-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_log-algo_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_log_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_log-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc + +algo_test_log-algo_test.obj: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_log_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_log-algo_test.obj -MD -MP -MF $(DEPDIR)/algo_test_log-algo_test.Tpo -c -o algo_test_log-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_log-algo_test.Tpo $(DEPDIR)/algo_test_log-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_log-algo_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_log_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_log-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` + +algo_test_minmax-algo_test.o: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_minmax_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_minmax-algo_test.o -MD -MP -MF $(DEPDIR)/algo_test_minmax-algo_test.Tpo -c -o algo_test_minmax-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_minmax-algo_test.Tpo $(DEPDIR)/algo_test_minmax-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_minmax-algo_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_minmax_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_minmax-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc + +algo_test_minmax-algo_test.obj: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_minmax_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_minmax-algo_test.obj -MD -MP -MF $(DEPDIR)/algo_test_minmax-algo_test.Tpo -c -o algo_test_minmax-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_minmax-algo_test.Tpo $(DEPDIR)/algo_test_minmax-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_minmax-algo_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_minmax_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_minmax-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` + +algo_test_power-algo_test.o: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_power_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_power-algo_test.o -MD -MP -MF $(DEPDIR)/algo_test_power-algo_test.Tpo -c -o algo_test_power-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_power-algo_test.Tpo $(DEPDIR)/algo_test_power-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_power-algo_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_power_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_power-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc + +algo_test_power-algo_test.obj: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_power_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_power-algo_test.obj -MD -MP -MF $(DEPDIR)/algo_test_power-algo_test.Tpo -c -o algo_test_power-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_power-algo_test.Tpo $(DEPDIR)/algo_test_power-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_power-algo_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_power_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_power-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` + +algo_test_tropical-algo_test.o: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_tropical_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_tropical-algo_test.o -MD -MP -MF $(DEPDIR)/algo_test_tropical-algo_test.Tpo -c -o algo_test_tropical-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_tropical-algo_test.Tpo $(DEPDIR)/algo_test_tropical-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_tropical-algo_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_tropical_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_tropical-algo_test.o `test -f 'algo_test.cc' || echo '$(srcdir)/'`algo_test.cc + +algo_test_tropical-algo_test.obj: algo_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_tropical_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT algo_test_tropical-algo_test.obj -MD -MP -MF $(DEPDIR)/algo_test_tropical-algo_test.Tpo -c -o algo_test_tropical-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/algo_test_tropical-algo_test.Tpo $(DEPDIR)/algo_test_tropical-algo_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='algo_test.cc' object='algo_test_tropical-algo_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(algo_test_tropical_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o algo_test_tropical-algo_test.obj `if test -f 'algo_test.cc'; then $(CYGPATH_W) 'algo_test.cc'; else $(CYGPATH_W) '$(srcdir)/algo_test.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +fst_test.log: fst_test$(EXEEXT) + @p='fst_test$(EXEEXT)'; \ + b='fst_test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +weight_test.log: weight_test$(EXEEXT) + @p='weight_test$(EXEEXT)'; \ + b='weight_test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +algo_test_log.log: algo_test_log$(EXEEXT) + @p='algo_test_log$(EXEEXT)'; \ + b='algo_test_log'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +algo_test_tropical.log: algo_test_tropical$(EXEEXT) + @p='algo_test_tropical$(EXEEXT)'; \ + b='algo_test_tropical'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +algo_test_minmax.log: algo_test_minmax$(EXEEXT) + @p='algo_test_minmax$(EXEEXT)'; \ + b='algo_test_minmax'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +algo_test_lexicographic.log: algo_test_lexicographic$(EXEEXT) + @p='algo_test_lexicographic$(EXEEXT)'; \ + b='algo_test_lexicographic'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +algo_test_power.log: algo_test_power$(EXEEXT) + @p='algo_test_power$(EXEEXT)'; \ + b='algo_test_power'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime/onnxruntime/third_party/openfst/src/test/algo_test.cc b/runtime/onnxruntime/third_party/openfst/src/test/algo_test.cc new file mode 100644 index 0000000..63404b8 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/test/algo_test.cc @@ -0,0 +1,128 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Regression test for various FST algorithms. + +#include + +#include + +#include + +#include + +// DEFINEs determine which semirings are tested; these are controlled by +// the `defines` attributes of the associated build rules. + +DEFINE_int32(seed, -1, "random seed"); +DEFINE_int32(repeat, 25, "number of test repetitions"); + +using fst::AlgoTester; +using fst::ArcTpl; +using fst::GallicArc; +using fst::GallicWeight; +using fst::LexicographicArc; +using fst::LexicographicWeight; +using fst::LogArc; +using fst::LogWeight; +using fst::MinMaxArc; +using fst::MinMaxWeight; +using fst::PowerWeight; +using fst::STRING_LEFT; +using fst::STRING_RIGHT; +using fst::StdArc; +using fst::StringArc; +using fst::StringWeight; +using fst::TropicalWeight; +using fst::WeightGenerate; + +int main(int argc, char **argv) { + FLAGS_fst_verify_properties = true; + std::set_new_handler(FailedNewHandler); + SET_FLAGS(argv[0], &argc, &argv, true); + + static const int kCacheGcLimit = 20; + + srand(FLAGS_seed); + LOG(INFO) << "Seed = " << FLAGS_seed; + + FLAGS_fst_default_cache_gc = rand() % 2; + FLAGS_fst_default_cache_gc_limit = rand() % kCacheGcLimit; + VLOG(1) << "default_cache_gc:" << FLAGS_fst_default_cache_gc; + VLOG(1) << "default_cache_gc_limit:" << FLAGS_fst_default_cache_gc_limit; + +#ifdef TEST_TROPICAL + using TropicalWeightGenerate = WeightGenerate; + TropicalWeightGenerate tropical_generator(false); + AlgoTester tropical_tester( + tropical_generator, FLAGS_seed); + tropical_tester.Test(); +#endif // TEST_TROPICAL + +#ifdef TEST_LOG + using LogWeightGenerate = WeightGenerate; + LogWeightGenerate log_generator(false); + AlgoTester log_tester(log_generator, FLAGS_seed); + log_tester.Test(); +#endif // TEST_LOG + +#ifdef TEST_MINMAX + using MinMaxWeightGenerate = WeightGenerate; + MinMaxWeightGenerate minmax_generator(false); + AlgoTester minmax_tester(minmax_generator, + FLAGS_seed); + minmax_tester.Test(); +#endif + +#ifdef TEST_LEFT_STRING + using StringWeightGenerate = WeightGenerate>; + StringWeightGenerate left_string_generator(false); + AlgoTester, StringWeightGenerate> left_string_tester( + left_string_generator, FLAGS_seed); + left_string_tester.Test(); +#endif // TEST_LEFT_STRING + +#ifdef TEST_RIGHT_STRING + using StringWeightGenerate = + WeightGenerate>; + StringWeightGenerate right_string_generator(false); + AlgoTester, StringWeightGenerate> + right_string_tester(right_string_generator, FLAGS_seed); + right_string_tester.Test(); +#endif // TEST_RIGHT_STRING + +#ifdef TEST_GALLIC + using StdGallicArc = GallicArc; + using TropicalGallicWeightGenerate = + WeightGenerate>; + TropicalGallicWeightGenerate tropical_gallic_generator(false); + AlgoTester gallic_tester( + tropical_gallic_generator, FLAGS_seed); + gallic_tester.Test(); +#endif // TEST_GALLIC + +#ifdef TEST_LEXICOGRAPHIC + using TropicalLexicographicArc = + LexicographicArc; + using TropicalLexicographicWeightGenerate = + WeightGenerate>; + TropicalLexicographicWeightGenerate lexicographic_generator(false); + AlgoTester + lexicographic_tester(lexicographic_generator, FLAGS_seed); + lexicographic_tester.Test(); +#endif // TEST_LEXICOGRAPHIC + +#ifdef TEST_POWER + using TropicalCubeWeight = PowerWeight; + using TropicalCubeArc = ArcTpl; + using TropicalCubeWeightGenerate = WeightGenerate; + TropicalCubeWeightGenerate tropical_cube_generator(false); + AlgoTester tropical_cube_tester( + tropical_cube_generator, FLAGS_seed); + tropical_cube_tester.Test(); +#endif // TEST_POWER + + std::cout << "PASS" << std::endl; + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/test/fst_test.cc b/runtime/onnxruntime/third_party/openfst/src/test/fst_test.cc new file mode 100644 index 0000000..c0af858 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/test/fst_test.cc @@ -0,0 +1,209 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Regression test for FST classes. + +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace fst { +namespace { + +// A user-defined arc type. +struct CustomArc { + typedef int16 Label; + typedef ProductWeight Weight; + typedef int64 StateId; + + CustomArc(Label i, Label o, Weight w, StateId s) + : ilabel(i), olabel(o), weight(std::move(w)), nextstate(s) {} + CustomArc() {} + + static const string &Type() { // Arc type name + static const string *const type = new string("my"); + return *type; + } + + Label ilabel; // Transition input label + Label olabel; // Transition output label + Weight weight; // Transition weight + StateId nextstate; // Transition destination state +}; + +// A user-defined compactor for test FST. +template +class CustomCompactor { + public: + typedef A Arc; + typedef typename A::Label Label; + typedef typename A::StateId StateId; + typedef typename A::Weight Weight; + typedef std::pair Element; + + Element Compact(StateId s, const A &arc) const { + return std::make_pair(arc.ilabel, arc.weight); + } + + Arc Expand(StateId s, const Element &p, uint32 f = kArcValueFlags) const { + return p.first == kNoLabel ? Arc(kNoLabel, kNoLabel, p.second, kNoStateId) + : Arc(p.first, 0, p.second, s); + } + + ssize_t Size() const { return -1; } + + uint64 Properties() const { return 0ULL; } + + bool Compatible(const Fst &fst) const { return true; } + + static const string &Type() { + static const string *const type = new string("my"); + return *type; + } + + bool Write(std::ostream &strm) const { return true; } + + static CustomCompactor *Read(std::istream &strm) { + return new CustomCompactor; + } +}; + +REGISTER_FST(VectorFst, CustomArc); +REGISTER_FST(ConstFst, CustomArc); +static fst::FstRegisterer>> + CompactFst_StdArc_CustomCompactor_registerer; +static fst::FstRegisterer>> + CompactFst_CustomArc_CustomCompactor_registerer; +static fst::FstRegisterer> + ConstFst_StdArc_uint16_registerer; +static fst::FstRegisterer< + CompactFst, uint16>> + CompactFst_StdArc_CustomCompactor_uint16_registerer; + +} // namespace +} // namespace fst + +using fst::FstTester; +using fst::VectorFst; +using fst::ConstFst; +using fst::MatcherFst; +using fst::CompactFst; +using fst::Fst; +using fst::StdArc; +using fst::CustomArc; +using fst::CustomCompactor; +using fst::StdArcLookAheadFst; +using fst::EditFst; + +int main(int argc, char **argv) { + FLAGS_fst_verify_properties = true; + std::set_new_handler(FailedNewHandler); + SET_FLAGS(argv[0], &argc, &argv, true); + + // VectorFst tests + { + FstTester> std_vector_tester; + std_vector_tester.TestBase(); + std_vector_tester.TestExpanded(); + std_vector_tester.TestAssign(); + std_vector_tester.TestCopy(); + std_vector_tester.TestIO(); + std_vector_tester.TestMutable(); + } + + // ConstFst tests + { + FstTester> std_const_tester; + std_const_tester.TestBase(); + std_const_tester.TestExpanded(); + std_const_tester.TestCopy(); + std_const_tester.TestIO(); + } + + // CompactFst> + { + FstTester>> std_compact_tester; + std_compact_tester.TestBase(); + std_compact_tester.TestExpanded(); + std_compact_tester.TestCopy(); + std_compact_tester.TestIO(); + } + + // VectorFst tests + { + FstTester> std_vector_tester; + std_vector_tester.TestBase(); + std_vector_tester.TestExpanded(); + std_vector_tester.TestAssign(); + std_vector_tester.TestCopy(); + std_vector_tester.TestIO(); + std_vector_tester.TestMutable(); + } + + // ConstFst tests + { + FstTester> std_const_tester; + std_const_tester.TestBase(); + std_const_tester.TestExpanded(); + std_const_tester.TestCopy(); + std_const_tester.TestIO(); + } + + // CompactFst> + { + FstTester>> + std_compact_tester; + std_compact_tester.TestBase(); + std_compact_tester.TestExpanded(); + std_compact_tester.TestCopy(); + std_compact_tester.TestIO(); + } + + // ConstFst tests + { + FstTester> std_const_tester; + std_const_tester.TestBase(); + std_const_tester.TestExpanded(); + std_const_tester.TestCopy(); + std_const_tester.TestIO(); + } + + // CompactFst, uint16> + { + FstTester, uint16>> + std_compact_tester; + std_compact_tester.TestBase(); + std_compact_tester.TestExpanded(); + std_compact_tester.TestCopy(); + std_compact_tester.TestIO(); + } + + // FstTester + { + FstTester std_matcher_tester; + std_matcher_tester.TestBase(); + std_matcher_tester.TestExpanded(); + std_matcher_tester.TestCopy(); + } + + // EditFst tests + { + FstTester> std_edit_tester; + std_edit_tester.TestBase(); + std_edit_tester.TestExpanded(); + std_edit_tester.TestAssign(); + std_edit_tester.TestCopy(); + std_edit_tester.TestMutable(); + } + + std::cout << "PASS" << std::endl; + + return 0; +} diff --git a/runtime/onnxruntime/third_party/openfst/src/test/weight_test.cc b/runtime/onnxruntime/third_party/openfst/src/test/weight_test.cc new file mode 100644 index 0000000..dee81c9 --- /dev/null +++ b/runtime/onnxruntime/third_party/openfst/src/test/weight_test.cc @@ -0,0 +1,524 @@ +// See www.openfst.org for extensive documentation on this weighted +// finite-state transducer library. +// +// Regression test for FST weights. + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DEFINE_int32(seed, -1, "random seed"); +DEFINE_int32(repeat, 10000, "number of test repetitions"); + +namespace { + +using fst::Adder; +using fst::ExpectationWeight; +using fst::GALLIC; +using fst::GallicWeight; +using fst::LexicographicWeight; +using fst::LogWeight; +using fst::LogWeightTpl; +using fst::MinMaxWeight; +using fst::MinMaxWeightTpl; +using fst::NaturalLess; +using fst::PowerWeight; +using fst::ProductWeight; +using fst::SetWeight; +using fst::SET_INTERSECT_UNION; +using fst::SET_UNION_INTERSECT; +using fst::SET_BOOLEAN; +using fst::SignedLogWeight; +using fst::SignedLogWeightTpl; +using fst::SparsePowerWeight; +using fst::StringWeight; +using fst::STRING_LEFT; +using fst::STRING_RIGHT; +using fst::TropicalWeight; +using fst::TropicalWeightTpl; +using fst::UnionWeight; +using fst::WeightConvert; +using fst::WeightGenerate; +using fst::WeightTester; + +template +void TestTemplatedWeights(int repeat) { + using TropicalWeightGenerate = WeightGenerate>; + TropicalWeightGenerate tropical_generate; + WeightTester, TropicalWeightGenerate> tropical_tester( + tropical_generate); + tropical_tester.Test(repeat); + + using LogWeightGenerate = WeightGenerate>; + LogWeightGenerate log_generate; + WeightTester, LogWeightGenerate> log_tester(log_generate); + log_tester.Test(repeat); + + using MinMaxWeightGenerate = WeightGenerate>; + MinMaxWeightGenerate minmax_generate(true); + WeightTester, MinMaxWeightGenerate> minmax_tester( + minmax_generate); + minmax_tester.Test(repeat); + + using SignedLogWeightGenerate = WeightGenerate>; + SignedLogWeightGenerate signedlog_generate; + WeightTester, SignedLogWeightGenerate> + signedlog_tester(signedlog_generate); + signedlog_tester.Test(repeat); +} + +template +void TestAdder(int n) { + Weight sum = Weight::Zero(); + Adder adder; + for (int i = 0; i < n; ++i) { + sum = Plus(sum, Weight::One()); + adder.Add(Weight::One()); + } + CHECK(ApproxEqual(sum, adder.Sum())); +} + +template +void TestSignedAdder(int n) { + Weight sum = Weight::Zero(); + Adder adder; + const Weight minus_one = Minus(Weight::Zero(), Weight::One()); + for (int i = 0; i < n; ++i) { + if (i < n/4 || i > 3*n/4) { + sum = Plus(sum, Weight::One()); + adder.Add(Weight::One()); + } else { + sum = Minus(sum, Weight::One()); + adder.Add(minus_one); + } + } + CHECK(ApproxEqual(sum, adder.Sum())); +} + +template +void TestWeightConversion(Weight1 w1) { + // Tests round-trp conversion. + const WeightConvert to_w1_; + const WeightConvert to_w2_; + Weight2 w2 = to_w2_(w1); + Weight1 nw1 = to_w1_(w2); + CHECK_EQ(w1, nw1); +} + +template +void TestWeightCopy(FromWeight w) { + // Test copy constructor. + const ToWeight to_copied(w); + const FromWeight roundtrip_copied(to_copied); + CHECK_EQ(w, roundtrip_copied); + + // Test copy assign. + ToWeight to_copy_assigned; + to_copy_assigned = w; + CHECK_EQ(to_copied, to_copy_assigned); + + FromWeight roundtrip_copy_assigned; + roundtrip_copy_assigned = to_copy_assigned; + CHECK_EQ(w, roundtrip_copy_assigned); +} + +template +void TestWeightMove(FromWeight w) { + // Assume FromWeight -> FromWeight copy works. + const FromWeight orig(w); + ToWeight to_moved(std::move(w)); + const FromWeight roundtrip_moved(std::move(to_moved)); + CHECK_EQ(orig, roundtrip_moved); + + // Test move assign. + w = orig; + ToWeight to_move_assigned; + to_move_assigned = std::move(w); + FromWeight roundtrip_move_assigned; + roundtrip_move_assigned = std::move(to_move_assigned); + CHECK_EQ(orig, roundtrip_move_assigned); +} + +template +void TestImplicitConversion() { + // Only test a few of the operations; assumes they are implemented with the + // same pattern. + CHECK(Weight(2.0f) == 2.0f); + CHECK(Weight(2.0) == 2.0); + CHECK(2.0f == Weight(2.0f)); + CHECK(2.0 == Weight(2.0)); + + CHECK_EQ(Weight::Zero(), Times(Weight::Zero(), 3.0f)); + CHECK_EQ(Weight::Zero(), Times(Weight::Zero(), 3.0)); + CHECK_EQ(Weight::Zero(), Times(3.0, Weight::Zero())); + + CHECK_EQ(Weight(3.0), Plus(Weight::Zero(), 3.0f)); + CHECK_EQ(Weight(3.0), Plus(Weight::Zero(), 3.0)); + CHECK_EQ(Weight(3.0), Plus(3.0, Weight::Zero())); +} + +void TestPowerWeightGetSetValue() { + PowerWeight w; + // LogWeight has unspecified initial value, so don't check it. + w.SetValue(0, LogWeight(2)); + w.SetValue(1, LogWeight(3)); + CHECK_EQ(LogWeight(2), w.Value(0)); + CHECK_EQ(LogWeight(3), w.Value(1)); +} + +void TestSparsePowerWeightGetSetValue() { + const LogWeight default_value(17); + SparsePowerWeight w; + w.SetDefaultValue(default_value); + + // All gets should be the default. + CHECK_EQ(default_value, w.Value(0)); + CHECK_EQ(default_value, w.Value(100)); + + // First set should fill first_. + w.SetValue(10, LogWeight(10)); + CHECK_EQ(LogWeight(10), w.Value(10)); + w.SetValue(10, LogWeight(20)); + CHECK_EQ(LogWeight(20), w.Value(10)); + + // Add a smaller index. + w.SetValue(5, LogWeight(5)); + CHECK_EQ(LogWeight(5), w.Value(5)); + CHECK_EQ(LogWeight(20), w.Value(10)); + + // Add some larger indices. + w.SetValue(30, LogWeight(30)); + CHECK_EQ(LogWeight(5), w.Value(5)); + CHECK_EQ(LogWeight(20), w.Value(10)); + CHECK_EQ(LogWeight(30), w.Value(30)); + + w.SetValue(29, LogWeight(29)); + CHECK_EQ(LogWeight(5), w.Value(5)); + CHECK_EQ(LogWeight(20), w.Value(10)); + CHECK_EQ(LogWeight(29), w.Value(29)); + CHECK_EQ(LogWeight(30), w.Value(30)); + + w.SetValue(31, LogWeight(31)); + CHECK_EQ(LogWeight(5), w.Value(5)); + CHECK_EQ(LogWeight(20), w.Value(10)); + CHECK_EQ(LogWeight(29), w.Value(29)); + CHECK_EQ(LogWeight(30), w.Value(30)); + CHECK_EQ(LogWeight(31), w.Value(31)); + + // Replace a value. + w.SetValue(30, LogWeight(60)); + CHECK_EQ(LogWeight(60), w.Value(30)); + + // Replace a value with the default. + CHECK_EQ(5, w.Size()); + w.SetValue(30, default_value); + CHECK_EQ(default_value, w.Value(30)); + CHECK_EQ(4, w.Size()); + + // Replace lowest index by the default value. + w.SetValue(5, default_value); + CHECK_EQ(default_value, w.Value(5)); + CHECK_EQ(3, w.Size()); + + // Clear out everything. + w.SetValue(31, default_value); + w.SetValue(29, default_value); + w.SetValue(10, default_value); + CHECK_EQ(0, w.Size()); + + CHECK_EQ(default_value, w.Value(5)); + CHECK_EQ(default_value, w.Value(10)); + CHECK_EQ(default_value, w.Value(29)); + CHECK_EQ(default_value, w.Value(30)); + CHECK_EQ(default_value, w.Value(31)); +} + +// If this test fails, it is possible that x == x will not +// hold for FloatWeight, breaking NaturalLess and probably more. +// To trigger these failures, use g++ -O -m32 -mno-sse. +// Google-only... +// This will never fail in google3, as those options aren't used. +// ...Google-only +template +bool FloatEqualityIsReflexive(T m) { + // The idea here is that x is spilled to memory, but + // y remains in an 80-bit register with extra precision, + // causing it to compare unequal to x. + volatile T x = 1.111; + x *= m; + + T y = 1.111; + y *= m; + + return x == y; +} + +void TestFloatEqualityIsReflexive() { + // Use a volatile test_value to avoid excessive inlining / optimization + // breaking what we're trying to test. + volatile double test_value = 1.1; + CHECK(FloatEqualityIsReflexive(static_cast(test_value))); + CHECK(FloatEqualityIsReflexive(test_value)); +} + +} // namespace + +int main(int argc, char **argv) { + std::set_new_handler(FailedNewHandler); + SET_FLAGS(argv[0], &argc, &argv, true); + + LOG(INFO) << "Seed = " << FLAGS_seed; + srand(FLAGS_seed); + + TestTemplatedWeights(FLAGS_repeat); + TestTemplatedWeights(FLAGS_repeat); + FLAGS_fst_weight_parentheses = "()"; + TestTemplatedWeights(FLAGS_repeat); + TestTemplatedWeights(FLAGS_repeat); + FLAGS_fst_weight_parentheses = ""; + + // Makes sure type names for templated weights are consistent. + CHECK(TropicalWeight::Type() == "tropical"); + CHECK(TropicalWeightTpl::Type() != TropicalWeightTpl::Type()); + CHECK(LogWeight::Type() == "log"); + CHECK(LogWeightTpl::Type() != LogWeightTpl::Type()); + TropicalWeightTpl w(2.0); + TropicalWeight tw(2.0); + CHECK_EQ(w.Value(), tw.Value()); + + TestAdder(1000); + TestAdder(1000); + TestSignedAdder(1000); + + TestImplicitConversion(); + TestImplicitConversion(); + TestImplicitConversion(); + + TestWeightConversion(2.0); + + using LeftStringWeight = StringWeight; + using LeftStringWeightGenerate = WeightGenerate; + LeftStringWeightGenerate left_string_generate; + WeightTester left_string_tester( + left_string_generate); + left_string_tester.Test(FLAGS_repeat); + + using RightStringWeight = StringWeight; + using RightStringWeightGenerate = WeightGenerate; + RightStringWeightGenerate right_string_generate; + WeightTester + right_string_tester(right_string_generate); + right_string_tester.Test(FLAGS_repeat); + + // STRING_RESTRICT not tested since it requires equal strings, + // so would fail. + + using IUSetWeight = SetWeight; + using IUSetWeightGenerate = WeightGenerate; + IUSetWeightGenerate iu_set_generate; + WeightTester + iu_set_tester(iu_set_generate); + iu_set_tester.Test(FLAGS_repeat); + + using UISetWeight = SetWeight; + using UISetWeightGenerate = WeightGenerate; + UISetWeightGenerate ui_set_generate; + WeightTester + ui_set_tester(ui_set_generate); + ui_set_tester.Test(FLAGS_repeat); + + // SET_INTERSECT_UNION_RESTRICT not tested since it requires equal sets, + // so would fail. + + using BoolSetWeight = SetWeight; + using BoolSetWeightGenerate = WeightGenerate; + BoolSetWeightGenerate bool_set_generate; + WeightTester + bool_set_tester(bool_set_generate); + bool_set_tester.Test(FLAGS_repeat); + + TestWeightConversion(iu_set_generate()); + + TestWeightCopy(iu_set_generate()); + TestWeightCopy(iu_set_generate()); + TestWeightCopy(ui_set_generate()); + TestWeightCopy(ui_set_generate()); + TestWeightCopy(bool_set_generate()); + TestWeightCopy(bool_set_generate()); + + TestWeightMove(iu_set_generate()); + TestWeightMove(iu_set_generate()); + TestWeightMove(ui_set_generate()); + TestWeightMove(ui_set_generate()); + TestWeightMove(bool_set_generate()); + TestWeightMove(bool_set_generate()); + + // COMPOSITE WEIGHTS AND TESTERS - DEFINITIONS + + using TropicalGallicWeight = GallicWeight; + using TropicalGallicWeightGenerate = WeightGenerate; + TropicalGallicWeightGenerate tropical_gallic_generate(true); + WeightTester + tropical_gallic_tester(tropical_gallic_generate); + + using TropicalGenGallicWeight = GallicWeight; + using TropicalGenGallicWeightGenerate = + WeightGenerate; + TropicalGenGallicWeightGenerate tropical_gen_gallic_generate(false); + WeightTester + tropical_gen_gallic_tester(tropical_gen_gallic_generate); + + using TropicalProductWeight = ProductWeight; + using TropicalProductWeightGenerate = WeightGenerate; + TropicalProductWeightGenerate tropical_product_generate; + WeightTester + tropical_product_tester(tropical_product_generate); + + using TropicalLexicographicWeight = + LexicographicWeight; + using TropicalLexicographicWeightGenerate = + WeightGenerate; + TropicalLexicographicWeightGenerate tropical_lexicographic_generate; + WeightTester + tropical_lexicographic_tester(tropical_lexicographic_generate); + + using TropicalCubeWeight = PowerWeight; + using TropicalCubeWeightGenerate = WeightGenerate; + TropicalCubeWeightGenerate tropical_cube_generate; + WeightTester + tropical_cube_tester(tropical_cube_generate); + + using FirstNestedProductWeight = + ProductWeight; + using FirstNestedProductWeightGenerate = + WeightGenerate; + FirstNestedProductWeightGenerate first_nested_product_generate; + WeightTester + first_nested_product_tester(first_nested_product_generate); + + using SecondNestedProductWeight = + ProductWeight; + using SecondNestedProductWeightGenerate = + WeightGenerate; + SecondNestedProductWeightGenerate second_nested_product_generate; + WeightTester + second_nested_product_tester(second_nested_product_generate); + + using NestedProductCubeWeight = PowerWeight; + using NestedProductCubeWeightGenerate = + WeightGenerate; + NestedProductCubeWeightGenerate nested_product_cube_generate; + WeightTester + nested_product_cube_tester(nested_product_cube_generate); + + using SparseNestedProductCubeWeight = + SparsePowerWeight; + using SparseNestedProductCubeWeightGenerate = + WeightGenerate; + SparseNestedProductCubeWeightGenerate sparse_nested_product_cube_generate; + WeightTester + sparse_nested_product_cube_tester(sparse_nested_product_cube_generate); + + using LogSparsePowerWeight = SparsePowerWeight; + using LogSparsePowerWeightGenerate = WeightGenerate; + LogSparsePowerWeightGenerate log_sparse_power_generate; + WeightTester + log_sparse_power_tester(log_sparse_power_generate); + + using LogLogExpectationWeight = ExpectationWeight; + using LogLogExpectationWeightGenerate = + WeightGenerate; + LogLogExpectationWeightGenerate log_log_expectation_generate; + WeightTester + log_log_expectation_tester(log_log_expectation_generate); + + using LogLogSparseExpectationWeight = + ExpectationWeight; + using LogLogSparseExpectationWeightGenerate = + WeightGenerate; + LogLogSparseExpectationWeightGenerate log_log_sparse_expectation_generate; + WeightTester + log_log_sparse_expectation_tester(log_log_sparse_expectation_generate); + + struct UnionWeightOptions { + using Compare = NaturalLess; + + struct Merge { + TropicalWeight operator()(const TropicalWeight &w1, + const TropicalWeight &w2) const { + return w1; + } + }; + + using ReverseOptions = UnionWeightOptions; + }; + + using TropicalUnionWeight = UnionWeight; + using TropicalUnionWeightGenerate = WeightGenerate; + TropicalUnionWeightGenerate tropical_union_generate; + WeightTester + tropical_union_tester(tropical_union_generate); + + // COMPOSITE WEIGHTS AND TESTERS - TESTING + + // Tests composite weight I/O with parentheses. + FLAGS_fst_weight_parentheses = "()"; + + // Unnested composite. + tropical_gallic_tester.Test(FLAGS_repeat); + tropical_gen_gallic_tester.Test(FLAGS_repeat); + tropical_product_tester.Test(FLAGS_repeat); + tropical_lexicographic_tester.Test(FLAGS_repeat); + tropical_cube_tester.Test(FLAGS_repeat); + log_sparse_power_tester.Test(FLAGS_repeat); + log_log_expectation_tester.Test(FLAGS_repeat, false); + tropical_union_tester.Test(FLAGS_repeat, false); + + // Nested composite. + first_nested_product_tester.Test(FLAGS_repeat); + second_nested_product_tester.Test(5); + nested_product_cube_tester.Test(FLAGS_repeat); + sparse_nested_product_cube_tester.Test(FLAGS_repeat); + log_log_sparse_expectation_tester.Test(FLAGS_repeat, false); + + // ... and tests composite weight I/O without parentheses. + FLAGS_fst_weight_parentheses = ""; + + // Unnested composite. + tropical_gallic_tester.Test(FLAGS_repeat); + tropical_product_tester.Test(FLAGS_repeat); + tropical_lexicographic_tester.Test(FLAGS_repeat); + tropical_cube_tester.Test(FLAGS_repeat); + log_sparse_power_tester.Test(FLAGS_repeat); + log_log_expectation_tester.Test(FLAGS_repeat, false); + tropical_union_tester.Test(FLAGS_repeat, false); + + // Nested composite. + second_nested_product_tester.Test(FLAGS_repeat); + log_log_sparse_expectation_tester.Test(FLAGS_repeat, false); + + TestPowerWeightGetSetValue(); + TestSparsePowerWeightGetSetValue(); + + TestFloatEqualityIsReflexive(); + + std::cout << "PASS" << std::endl; + + return 0; +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/CMakeLists.txt b/runtime/onnxruntime/third_party/yaml-cpp/CMakeLists.txt new file mode 100644 index 0000000..491f41a --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/CMakeLists.txt @@ -0,0 +1,365 @@ +### +### CMake settings +### +## Due to Mac OSX we need to keep compatibility with CMake 2.6 +# see http://www.cmake.org/Wiki/CMake_Policies +cmake_minimum_required(VERSION 2.6) +# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012 +if(POLICY CMP0012) + cmake_policy(SET CMP0012 OLD) +endif() +# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0015 +if(POLICY CMP0015) + cmake_policy(SET CMP0015 OLD) +endif() +# see https://cmake.org/cmake/help/latest/policy/CMP0042.html +if(POLICY CMP0042) + # Enable MACOSX_RPATH by default. + cmake_policy(SET CMP0042 NEW) +endif() + +include(CheckCXXCompilerFlag) + + +### +### Project settings +### +project(YAML_CPP) + +set(YAML_CPP_VERSION_MAJOR "0") +set(YAML_CPP_VERSION_MINOR "6") +set(YAML_CPP_VERSION_PATCH "0") +set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}") + +enable_testing() + + +### +### Project options +### +## Project stuff +option(YAML_CPP_BUILD_TESTS "Enable testing" OFF) +option(YAML_CPP_BUILD_TOOLS "Enable parse tools" OFF) +option(YAML_CPP_BUILD_CONTRIB "Enable contrib stuff in library" OFF) + +## Build options +# --> General +# see http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:BUILD_SHARED_LIBS +# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library +option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) + +# --> Apple +option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF) + +# --> Microsoft Visual C++ +# see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx +# http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx +option(MSVC_SHARED_RT "MSVC: Build with shared runtime libs (/MD)" ON) +option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF) + +### +### Sources, headers, directories and libs +### + +# From http://www.cmake.org/pipermail/cmake/2010-March/035992.html: +# function to collect all the sources from sub-directories +# into a single list +function(add_sources) + get_property(is_defined GLOBAL PROPERTY SRCS_LIST DEFINED) + if(NOT is_defined) + define_property(GLOBAL PROPERTY SRCS_LIST + BRIEF_DOCS "List of source files" + FULL_DOCS "List of all source files in the entire project") + endif() + # make absolute paths + set(SRCS) + foreach(s IN LISTS ARGN) + if(NOT IS_ABSOLUTE "${s}") + get_filename_component(s "${s}" ABSOLUTE) + endif() + list(APPEND SRCS "${s}") + endforeach() + # append to global list + set_property(GLOBAL APPEND PROPERTY SRCS_LIST "${SRCS}") +endfunction(add_sources) + +set(header_directory "include/yaml-cpp/") + +file(GLOB sources "src/[a-zA-Z]*.cpp") +file(GLOB_RECURSE public_headers "include/yaml-cpp/[a-zA-Z]*.h") +file(GLOB private_headers "src/[a-zA-Z]*.h") + +if(YAML_CPP_BUILD_CONTRIB) + file(GLOB contrib_sources "src/contrib/[a-zA-Z]*.cpp") + file(GLOB contrib_public_headers "include/yaml-cpp/contrib/[a-zA-Z]*.h") + file(GLOB contrib_private_headers "src/contrib/[a-zA-Z]*.h") +else() + add_definitions(-DYAML_CPP_NO_CONTRIB) +endif() + +set(library_sources + ${sources} + ${public_headers} + ${private_headers} + ${contrib_sources} + ${contrib_public_headers} + ${contrib_private_headers} +) +add_sources(${library_sources}) + +if(VERBOSE) + message(STATUS "sources: ${sources}") + message(STATUS "public_headers: ${public_headers}") + message(STATUS "private_headers: ${private_headers}") + message(STATUS "contrib_sources: ${contrib_sources}") + message(STATUS "contrib_public_headers: ${contrib_public_headers}") + message(STATUS "contrib_private_headers: ${contrib_private_headers}") +endif() + +include_directories(${YAML_CPP_SOURCE_DIR}/src) +include_directories(${YAML_CPP_SOURCE_DIR}/include) + + + +### +### General compilation settings +### +set(yaml_c_flags ${CMAKE_C_FLAGS}) +set(yaml_cxx_flags ${CMAKE_CXX_FLAGS}) + +if(BUILD_SHARED_LIBS) + set(LABEL_SUFFIX "shared") +else() + set(LABEL_SUFFIX "static") +endif() + +if(APPLE) + if(APPLE_UNIVERSAL_BIN) + set(CMAKE_OSX_ARCHITECTURES ppc;i386) + endif() +endif() + +if(IPHONE) + set(CMAKE_OSX_SYSROOT "iphoneos4.2") + set(CMAKE_OSX_ARCHITECTURES "armv6;armv7") +endif() + +if(WIN32) + if(BUILD_SHARED_LIBS) + add_definitions(-D${PROJECT_NAME}_DLL) # use or build Windows DLL + endif() + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "C:/") + endif() +endif() + +# GCC or Clang or Intel Compiler specialities +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR + CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR + CMAKE_CXX_COMPILER_ID MATCHES "Intel") + + ### General stuff + if(WIN32) + set(CMAKE_SHARED_LIBRARY_PREFIX "") # DLLs do not have a "lib" prefix + set(CMAKE_IMPORT_LIBRARY_PREFIX "") # same for DLL import libs + set(CMAKE_LINK_DEF_FILE_FLAG "") # CMake workaround (2.8.3) + endif() + + ### Project stuff + if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) + endif() + # + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_DEBUG "-g") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os") + # + set(GCC_EXTRA_OPTIONS "") + # + if(BUILD_SHARED_LIBS) + set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} -fPIC") + endif() + # + set(FLAG_TESTED "-Wextra") + check_cxx_compiler_flag(${FLAG_TESTED} FLAG_WEXTRA) + if(FLAG_WEXTRA) + set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} ${FLAG_TESTED}") + endif() + # + set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long -std=c++11 ${yaml_cxx_flags}") + + ### Make specific + if(${CMAKE_BUILD_TOOL} MATCHES make OR ${CMAKE_BUILD_TOOL} MATCHES gmake) + add_custom_target(debuggable $(MAKE) clean + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMENT "Adjusting settings for debug compilation" + VERBATIM) + add_custom_target(releasable $(MAKE) clean + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + COMMENT "Adjusting settings for release compilation" + VERBATIM) + endif() +endif() + +# Microsoft VisualC++ specialities +if(MSVC) + ### General stuff + # a) Change MSVC runtime library settings (/MD[d], /MT[d], /ML[d] (single-threaded until VS 2003)) + # plus set lib suffix for later use and project label accordingly + # see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx + # http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx + set(LIB_RT_SUFFIX "md") # CMake defaults to /MD for MSVC + set(LIB_RT_OPTION "/MD") + # + if(NOT MSVC_SHARED_RT) # User wants to have static runtime libraries (/MT, /ML) + if(MSVC_STHREADED_RT) # User wants to have old single-threaded static runtime libraries + set(LIB_RT_SUFFIX "ml") + set(LIB_RT_OPTION "/ML") + if(NOT ${MSVC_VERSION} LESS 1400) + message(FATAL_ERROR "Single-threaded static runtime libraries (/ML) only available until VS .NET 2003 (7.1).") + endif() + else() + set(LIB_RT_SUFFIX "mt") + set(LIB_RT_OPTION "/MT") + endif() + + # correct linker options + foreach(flag_var CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + foreach(config_name "" DEBUG RELEASE MINSIZEREL RELWITHDEBINFO) + set(var_name "${flag_var}") + if(NOT "${config_name}" STREQUAL "") + set(var_name "${var_name}_${config_name}") + endif() + string(REPLACE "/MD" "${LIB_RT_OPTION}" ${var_name} "${${var_name}}") + set(${var_name} "${${var_name}}" CACHE STRING "" FORCE) + endforeach() + endforeach() + endif() + # + set(LABEL_SUFFIX "${LABEL_SUFFIX} ${LIB_RT_SUFFIX}") + + # b) Change prefix for static libraries + set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # to distinguish static libraries from DLL import libs + + # c) Correct suffixes for static libraries + if(NOT BUILD_SHARED_LIBS) + ### General stuff + set(LIB_TARGET_SUFFIX "${LIB_SUFFIX}${LIB_RT_SUFFIX}") + endif() + + ### Project stuff + # /W3 = set warning level; see http://msdn.microsoft.com/en-us/library/thxezb7y.aspx + # /wd4127 = disable warning C4127 "conditional expression is constant"; see http://msdn.microsoft.com/en-us/library/6t66728h.aspx + # /wd4355 = disable warning C4355 "'this' : used in base member initializer list"; http://msdn.microsoft.com/en-us/library/3c594ae3.aspx + set(yaml_cxx_flags "/W3 /wd4127 /wd4355 ${yaml_cxx_flags}") +endif() + + +### +### General install settings +### +set(INCLUDE_INSTALL_ROOT_DIR include) + +set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_ROOT_DIR}/yaml-cpp) +set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}") + +set(_INSTALL_DESTINATIONS + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} +) + + +### +### Library +### +add_library(yaml-cpp ${library_sources}) +set_target_properties(yaml-cpp PROPERTIES + COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}" +) + +set_target_properties(yaml-cpp PROPERTIES + VERSION "${YAML_CPP_VERSION}" + SOVERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}" + PROJECT_LABEL "yaml-cpp ${LABEL_SUFFIX}" +) + +if(IPHONE) + set_target_properties(yaml-cpp PROPERTIES + XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "3.0" + ) +endif() + +if(MSVC) + if(NOT BUILD_SHARED_LIBS) + # correct library names + set_target_properties(yaml-cpp PROPERTIES + DEBUG_POSTFIX "${LIB_TARGET_SUFFIX}d" + RELEASE_POSTFIX "${LIB_TARGET_SUFFIX}" + MINSIZEREL_POSTFIX "${LIB_TARGET_SUFFIX}" + RELWITHDEBINFO_POSTFIX "${LIB_TARGET_SUFFIX}" + ) + endif() +endif() + +install(TARGETS yaml-cpp EXPORT yaml-cpp-targets ${_INSTALL_DESTINATIONS}) +install( + DIRECTORY ${header_directory} + DESTINATION ${INCLUDE_INSTALL_DIR} + FILES_MATCHING PATTERN "*.h" +) + +export( + TARGETS yaml-cpp + FILE "${PROJECT_BINARY_DIR}/yaml-cpp-targets.cmake") +export(PACKAGE yaml-cpp) +set(EXPORT_TARGETS yaml-cpp CACHE INTERNAL "export targets") + +set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in + "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" @ONLY) + +if(WIN32 AND NOT CYGWIN) + set(INSTALL_CMAKE_DIR CMake) +else() + set(INSTALL_CMAKE_DIR ${LIB_INSTALL_DIR}/cmake/yaml-cpp) +endif() + +file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_ROOT_DIR}") +set(CONFIG_INCLUDE_DIRS "\${YAML_CPP_CMAKE_DIR}/${REL_INCLUDE_DIR}") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" @ONLY) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in + "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" @ONLY) + +install(FILES + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" + "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" + DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev) +install(EXPORT yaml-cpp-targets DESTINATION ${INSTALL_CMAKE_DIR}) + +if(UNIX) + set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc) + configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY) + install(FILES ${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +endif() + + +### +### Extras +### +if(YAML_CPP_BUILD_TESTS) + add_subdirectory(test) +endif() +if(YAML_CPP_BUILD_TOOLS) + add_subdirectory(util) +endif() + +### Formatting +get_property(all_sources GLOBAL PROPERTY SRCS_LIST) +add_custom_target(format + COMMAND clang-format --style=file -i ${all_sources} + COMMENT "Running clang-format" + VERBATIM) diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/anchor.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/anchor.h new file mode 100644 index 0000000..06759c7 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/anchor.h @@ -0,0 +1,17 @@ +#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +namespace YAML { +typedef std::size_t anchor_t; +const anchor_t NullAnchor = 0; +} + +#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/binary.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/binary.h new file mode 100644 index 0000000..29d5dbd --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/binary.h @@ -0,0 +1,67 @@ +#ifndef BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +YAML_CPP_API std::string EncodeBase64(const unsigned char *data, + std::size_t size); +YAML_CPP_API std::vector DecodeBase64(const std::string &input); + +class YAML_CPP_API Binary { + public: + Binary() : m_unownedData(0), m_unownedSize(0) {} + Binary(const unsigned char *data_, std::size_t size_) + : m_unownedData(data_), m_unownedSize(size_) {} + + bool owned() const { return !m_unownedData; } + std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; } + const unsigned char *data() const { + return owned() ? &m_data[0] : m_unownedData; + } + + void swap(std::vector &rhs) { + if (m_unownedData) { + m_data.swap(rhs); + rhs.clear(); + rhs.resize(m_unownedSize); + std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin()); + m_unownedData = 0; + m_unownedSize = 0; + } else { + m_data.swap(rhs); + } + } + + bool operator==(const Binary &rhs) const { + const std::size_t s = size(); + if (s != rhs.size()) + return false; + const unsigned char *d1 = data(); + const unsigned char *d2 = rhs.data(); + for (std::size_t i = 0; i < s; i++) { + if (*d1++ != *d2++) + return false; + } + return true; + } + + bool operator!=(const Binary &rhs) const { return !(*this == rhs); } + + private: + std::vector m_data; + const unsigned char *m_unownedData; + std::size_t m_unownedSize; +}; +} + +#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/contrib/anchordict.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/contrib/anchordict.h new file mode 100644 index 0000000..78db9ec --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/contrib/anchordict.h @@ -0,0 +1,39 @@ +#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "../anchor.h" + +namespace YAML { +/** + * An object that stores and retrieves values correlating to {@link anchor_t} + * values. + * + *

Efficient implementation that can make assumptions about how + * {@code anchor_t} values are assigned by the {@link Parser} class. + */ +template +class AnchorDict { + public: + void Register(anchor_t anchor, T value) { + if (anchor > m_data.size()) { + m_data.resize(anchor); + } + m_data[anchor - 1] = value; + } + + T Get(anchor_t anchor) const { return m_data[anchor - 1]; } + + private: + std::vector m_data; +}; +} + +#endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h new file mode 100644 index 0000000..f0a38f2 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h @@ -0,0 +1,149 @@ +#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/mark.h" +#include + +namespace YAML { +class Parser; + +// GraphBuilderInterface +// . Abstraction of node creation +// . pParentNode is always NULL or the return value of one of the NewXXX() +// functions. +class GraphBuilderInterface { + public: + virtual ~GraphBuilderInterface() = 0; + + // Create and return a new node with a null value. + virtual void *NewNull(const Mark &mark, void *pParentNode) = 0; + + // Create and return a new node with the given tag and value. + virtual void *NewScalar(const Mark &mark, const std::string &tag, + void *pParentNode, const std::string &value) = 0; + + // Create and return a new sequence node + virtual void *NewSequence(const Mark &mark, const std::string &tag, + void *pParentNode) = 0; + + // Add pNode to pSequence. pNode was created with one of the NewXxx() + // functions and pSequence with NewSequence(). + virtual void AppendToSequence(void *pSequence, void *pNode) = 0; + + // Note that no moew entries will be added to pSequence + virtual void SequenceComplete(void *pSequence) { (void)pSequence; } + + // Create and return a new map node + virtual void *NewMap(const Mark &mark, const std::string &tag, + void *pParentNode) = 0; + + // Add the pKeyNode => pValueNode mapping to pMap. pKeyNode and pValueNode + // were created with one of the NewXxx() methods and pMap with NewMap(). + virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) = 0; + + // Note that no more assignments will be made in pMap + virtual void MapComplete(void *pMap) { (void)pMap; } + + // Return the node that should be used in place of an alias referencing + // pNode (pNode by default) + virtual void *AnchorReference(const Mark &mark, void *pNode) { + (void)mark; + return pNode; + } +}; + +// Typesafe wrapper for GraphBuilderInterface. Assumes that Impl defines +// Node, Sequence, and Map types. Sequence and Map must derive from Node +// (unless Node is defined as void). Impl must also implement function with +// all of the same names as the virtual functions in GraphBuilderInterface +// -- including the ones with default implementations -- but with the +// prototypes changed to accept an explicit Node*, Sequence*, or Map* where +// appropriate. +template +class GraphBuilder : public GraphBuilderInterface { + public: + typedef typename Impl::Node Node; + typedef typename Impl::Sequence Sequence; + typedef typename Impl::Map Map; + + GraphBuilder(Impl &impl) : m_impl(impl) { + Map *pMap = NULL; + Sequence *pSeq = NULL; + Node *pNode = NULL; + + // Type consistency checks + pNode = pMap; + pNode = pSeq; + } + + GraphBuilderInterface &AsBuilderInterface() { return *this; } + + virtual void *NewNull(const Mark &mark, void *pParentNode) { + return CheckType(m_impl.NewNull(mark, AsNode(pParentNode))); + } + + virtual void *NewScalar(const Mark &mark, const std::string &tag, + void *pParentNode, const std::string &value) { + return CheckType( + m_impl.NewScalar(mark, tag, AsNode(pParentNode), value)); + } + + virtual void *NewSequence(const Mark &mark, const std::string &tag, + void *pParentNode) { + return CheckType( + m_impl.NewSequence(mark, tag, AsNode(pParentNode))); + } + virtual void AppendToSequence(void *pSequence, void *pNode) { + m_impl.AppendToSequence(AsSequence(pSequence), AsNode(pNode)); + } + virtual void SequenceComplete(void *pSequence) { + m_impl.SequenceComplete(AsSequence(pSequence)); + } + + virtual void *NewMap(const Mark &mark, const std::string &tag, + void *pParentNode) { + return CheckType(m_impl.NewMap(mark, tag, AsNode(pParentNode))); + } + virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) { + m_impl.AssignInMap(AsMap(pMap), AsNode(pKeyNode), AsNode(pValueNode)); + } + virtual void MapComplete(void *pMap) { m_impl.MapComplete(AsMap(pMap)); } + + virtual void *AnchorReference(const Mark &mark, void *pNode) { + return CheckType(m_impl.AnchorReference(mark, AsNode(pNode))); + } + + private: + Impl &m_impl; + + // Static check for pointer to T + template + static T *CheckType(U *p) { + return p; + } + + static Node *AsNode(void *pNode) { return static_cast(pNode); } + static Sequence *AsSequence(void *pSeq) { + return static_cast(pSeq); + } + static Map *AsMap(void *pMap) { return static_cast(pMap); } +}; + +void *BuildGraphOfNextDocument(Parser &parser, + GraphBuilderInterface &graphBuilder); + +template +typename Impl::Node *BuildGraphOfNextDocument(Parser &parser, Impl &impl) { + GraphBuilder graphBuilder(impl); + return static_cast( + BuildGraphOfNextDocument(parser, graphBuilder)); +} +} + +#endif // GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/dll.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/dll.h new file mode 100644 index 0000000..a32c06b --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/dll.h @@ -0,0 +1,33 @@ +#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +// The following ifdef block is the standard way of creating macros which make +// exporting from a DLL simpler. All files within this DLL are compiled with the +// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not +// be defined on any project that uses this DLL. This way any other project +// whose source files include this file see YAML_CPP_API functions as being +// imported from a DLL, whereas this DLL sees symbols defined with this macro as +// being exported. +#undef YAML_CPP_API + +#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined + // manually) +#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake + // or defined manually) +// #pragma message( "Defining YAML_CPP_API for DLL export" ) +#define YAML_CPP_API __declspec(dllexport) +#else // yaml_cpp_EXPORTS +// #pragma message( "Defining YAML_CPP_API for DLL import" ) +#define YAML_CPP_API __declspec(dllimport) +#endif // yaml_cpp_EXPORTS +#else // YAML_CPP_DLL +#define YAML_CPP_API +#endif // YAML_CPP_DLL + +#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitfromevents.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitfromevents.h new file mode 100644 index 0000000..f14b051 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitfromevents.h @@ -0,0 +1,57 @@ +#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/eventhandler.h" + +namespace YAML { +struct Mark; +} // namespace YAML + +namespace YAML { +class Emitter; + +class EmitFromEvents : public EventHandler { + public: + EmitFromEvents(Emitter& emitter); + + virtual void OnDocumentStart(const Mark& mark); + virtual void OnDocumentEnd(); + + virtual void OnNull(const Mark& mark, anchor_t anchor); + virtual void OnAlias(const Mark& mark, anchor_t anchor); + virtual void OnScalar(const Mark& mark, const std::string& tag, + anchor_t anchor, const std::string& value); + + virtual void OnSequenceStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style); + virtual void OnSequenceEnd(); + + virtual void OnMapStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style); + virtual void OnMapEnd(); + + private: + void BeginNode(); + void EmitProps(const std::string& tag, anchor_t anchor); + + private: + Emitter& m_emitter; + + struct State { + enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue }; + }; + std::stack m_stateStack; +}; +} + +#endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitter.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitter.h new file mode 100644 index 0000000..ef92cc4 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitter.h @@ -0,0 +1,254 @@ +#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include +#include + +#include "yaml-cpp/binary.h" +#include "yaml-cpp/dll.h" +#include "yaml-cpp/emitterdef.h" +#include "yaml-cpp/emittermanip.h" +#include "yaml-cpp/noncopyable.h" +#include "yaml-cpp/null.h" +#include "yaml-cpp/ostream_wrapper.h" + +namespace YAML { +class Binary; +struct _Null; +} // namespace YAML + +namespace YAML { +class EmitterState; + +class YAML_CPP_API Emitter : private noncopyable { + public: + Emitter(); + explicit Emitter(std::ostream& stream); + ~Emitter(); + + // output + const char* c_str() const; + std::size_t size() const; + + // state checking + bool good() const; + const std::string GetLastError() const; + + // global setters + bool SetOutputCharset(EMITTER_MANIP value); + bool SetStringFormat(EMITTER_MANIP value); + bool SetBoolFormat(EMITTER_MANIP value); + bool SetIntBase(EMITTER_MANIP value); + bool SetSeqFormat(EMITTER_MANIP value); + bool SetMapFormat(EMITTER_MANIP value); + bool SetIndent(std::size_t n); + bool SetPreCommentIndent(std::size_t n); + bool SetPostCommentIndent(std::size_t n); + bool SetFloatPrecision(std::size_t n); + bool SetDoublePrecision(std::size_t n); + + // local setters + Emitter& SetLocalValue(EMITTER_MANIP value); + Emitter& SetLocalIndent(const _Indent& indent); + Emitter& SetLocalPrecision(const _Precision& precision); + + // overloads of write + Emitter& Write(const std::string& str); + Emitter& Write(bool b); + Emitter& Write(char ch); + Emitter& Write(const _Alias& alias); + Emitter& Write(const _Anchor& anchor); + Emitter& Write(const _Tag& tag); + Emitter& Write(const _Comment& comment); + Emitter& Write(const _Null& n); + Emitter& Write(const Binary& binary); + + template + Emitter& WriteIntegralType(T value); + + template + Emitter& WriteStreamable(T value); + + private: + template + void SetStreamablePrecision(std::stringstream&) {} + std::size_t GetFloatPrecision() const; + std::size_t GetDoublePrecision() const; + + void PrepareIntegralStream(std::stringstream& stream) const; + void StartedScalar(); + + private: + void EmitBeginDoc(); + void EmitEndDoc(); + void EmitBeginSeq(); + void EmitEndSeq(); + void EmitBeginMap(); + void EmitEndMap(); + void EmitNewline(); + void EmitKindTag(); + void EmitTag(bool verbatim, const _Tag& tag); + + void PrepareNode(EmitterNodeType::value child); + void PrepareTopNode(EmitterNodeType::value child); + void FlowSeqPrepareNode(EmitterNodeType::value child); + void BlockSeqPrepareNode(EmitterNodeType::value child); + + void FlowMapPrepareNode(EmitterNodeType::value child); + + void FlowMapPrepareLongKey(EmitterNodeType::value child); + void FlowMapPrepareLongKeyValue(EmitterNodeType::value child); + void FlowMapPrepareSimpleKey(EmitterNodeType::value child); + void FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child); + + void BlockMapPrepareNode(EmitterNodeType::value child); + + void BlockMapPrepareLongKey(EmitterNodeType::value child); + void BlockMapPrepareLongKeyValue(EmitterNodeType::value child); + void BlockMapPrepareSimpleKey(EmitterNodeType::value child); + void BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child); + + void SpaceOrIndentTo(bool requireSpace, std::size_t indent); + + const char* ComputeFullBoolName(bool b) const; + bool CanEmitNewline() const; + + private: + std::unique_ptr m_pState; + ostream_wrapper m_stream; +}; + +template +inline Emitter& Emitter::WriteIntegralType(T value) { + if (!good()) + return *this; + + PrepareNode(EmitterNodeType::Scalar); + + std::stringstream stream; + PrepareIntegralStream(stream); + stream << value; + m_stream << stream.str(); + + StartedScalar(); + + return *this; +} + +template +inline Emitter& Emitter::WriteStreamable(T value) { + if (!good()) + return *this; + + PrepareNode(EmitterNodeType::Scalar); + + std::stringstream stream; + SetStreamablePrecision(stream); + stream << value; + m_stream << stream.str(); + + StartedScalar(); + + return *this; +} + +template <> +inline void Emitter::SetStreamablePrecision(std::stringstream& stream) { + stream.precision(static_cast(GetFloatPrecision())); +} + +template <> +inline void Emitter::SetStreamablePrecision(std::stringstream& stream) { + stream.precision(static_cast(GetDoublePrecision())); +} + +// overloads of insertion +inline Emitter& operator<<(Emitter& emitter, const std::string& v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, bool v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, char v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, unsigned char v) { + return emitter.Write(static_cast(v)); +} +inline Emitter& operator<<(Emitter& emitter, const _Alias& v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, const _Anchor& v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, const _Tag& v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, const _Comment& v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, const _Null& v) { + return emitter.Write(v); +} +inline Emitter& operator<<(Emitter& emitter, const Binary& b) { + return emitter.Write(b); +} + +inline Emitter& operator<<(Emitter& emitter, const char* v) { + return emitter.Write(std::string(v)); +} + +inline Emitter& operator<<(Emitter& emitter, int v) { + return emitter.WriteIntegralType(v); +} +inline Emitter& operator<<(Emitter& emitter, unsigned int v) { + return emitter.WriteIntegralType(v); +} +inline Emitter& operator<<(Emitter& emitter, short v) { + return emitter.WriteIntegralType(v); +} +inline Emitter& operator<<(Emitter& emitter, unsigned short v) { + return emitter.WriteIntegralType(v); +} +inline Emitter& operator<<(Emitter& emitter, long v) { + return emitter.WriteIntegralType(v); +} +inline Emitter& operator<<(Emitter& emitter, unsigned long v) { + return emitter.WriteIntegralType(v); +} +inline Emitter& operator<<(Emitter& emitter, long long v) { + return emitter.WriteIntegralType(v); +} +inline Emitter& operator<<(Emitter& emitter, unsigned long long v) { + return emitter.WriteIntegralType(v); +} + +inline Emitter& operator<<(Emitter& emitter, float v) { + return emitter.WriteStreamable(v); +} +inline Emitter& operator<<(Emitter& emitter, double v) { + return emitter.WriteStreamable(v); +} + +inline Emitter& operator<<(Emitter& emitter, EMITTER_MANIP value) { + return emitter.SetLocalValue(value); +} + +inline Emitter& operator<<(Emitter& emitter, _Indent indent) { + return emitter.SetLocalIndent(indent); +} + +inline Emitter& operator<<(Emitter& emitter, _Precision precision) { + return emitter.SetLocalPrecision(precision); +} +} + +#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitterdef.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitterdef.h new file mode 100644 index 0000000..0b42695 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitterdef.h @@ -0,0 +1,16 @@ +#ifndef EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +namespace YAML { +struct EmitterNodeType { + enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap }; +}; +} + +#endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emittermanip.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emittermanip.h new file mode 100644 index 0000000..89f7256 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emittermanip.h @@ -0,0 +1,137 @@ +#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +namespace YAML { +enum EMITTER_MANIP { + // general manipulators + Auto, + TagByKind, + Newline, + + // output character set + EmitNonAscii, + EscapeNonAscii, + + // string manipulators + // Auto, // duplicate + SingleQuoted, + DoubleQuoted, + Literal, + + // bool manipulators + YesNoBool, // yes, no + TrueFalseBool, // true, false + OnOffBool, // on, off + UpperCase, // TRUE, N + LowerCase, // f, yes + CamelCase, // No, Off + LongBool, // yes, On + ShortBool, // y, t + + // int manipulators + Dec, + Hex, + Oct, + + // document manipulators + BeginDoc, + EndDoc, + + // sequence manipulators + BeginSeq, + EndSeq, + Flow, + Block, + + // map manipulators + BeginMap, + EndMap, + Key, + Value, + // Flow, // duplicate + // Block, // duplicate + // Auto, // duplicate + LongKey +}; + +struct _Indent { + _Indent(int value_) : value(value_) {} + int value; +}; + +inline _Indent Indent(int value) { return _Indent(value); } + +struct _Alias { + _Alias(const std::string& content_) : content(content_) {} + std::string content; +}; + +inline _Alias Alias(const std::string content) { return _Alias(content); } + +struct _Anchor { + _Anchor(const std::string& content_) : content(content_) {} + std::string content; +}; + +inline _Anchor Anchor(const std::string content) { return _Anchor(content); } + +struct _Tag { + struct Type { + enum value { Verbatim, PrimaryHandle, NamedHandle }; + }; + + explicit _Tag(const std::string& prefix_, const std::string& content_, + Type::value type_) + : prefix(prefix_), content(content_), type(type_) {} + std::string prefix; + std::string content; + Type::value type; +}; + +inline _Tag VerbatimTag(const std::string content) { + return _Tag("", content, _Tag::Type::Verbatim); +} + +inline _Tag LocalTag(const std::string content) { + return _Tag("", content, _Tag::Type::PrimaryHandle); +} + +inline _Tag LocalTag(const std::string& prefix, const std::string content) { + return _Tag(prefix, content, _Tag::Type::NamedHandle); +} + +inline _Tag SecondaryTag(const std::string content) { + return _Tag("", content, _Tag::Type::NamedHandle); +} + +struct _Comment { + _Comment(const std::string& content_) : content(content_) {} + std::string content; +}; + +inline _Comment Comment(const std::string content) { return _Comment(content); } + +struct _Precision { + _Precision(int floatPrecision_, int doublePrecision_) + : floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {} + + int floatPrecision; + int doublePrecision; +}; + +inline _Precision FloatPrecision(int n) { return _Precision(n, -1); } + +inline _Precision DoublePrecision(int n) { return _Precision(-1, n); } + +inline _Precision Precision(int n) { return _Precision(n, n); } +} + +#endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitterstyle.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitterstyle.h new file mode 100644 index 0000000..67bb398 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/emitterstyle.h @@ -0,0 +1,16 @@ +#ifndef EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +namespace YAML { +struct EmitterStyle { + enum value { Default, Block, Flow }; +}; +} + +#endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/eventhandler.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/eventhandler.h new file mode 100644 index 0000000..efe381c --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/eventhandler.h @@ -0,0 +1,40 @@ +#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/emitterstyle.h" + +namespace YAML { +struct Mark; + +class EventHandler { + public: + virtual ~EventHandler() {} + + virtual void OnDocumentStart(const Mark& mark) = 0; + virtual void OnDocumentEnd() = 0; + + virtual void OnNull(const Mark& mark, anchor_t anchor) = 0; + virtual void OnAlias(const Mark& mark, anchor_t anchor) = 0; + virtual void OnScalar(const Mark& mark, const std::string& tag, + anchor_t anchor, const std::string& value) = 0; + + virtual void OnSequenceStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) = 0; + virtual void OnSequenceEnd() = 0; + + virtual void OnMapStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) = 0; + virtual void OnMapEnd() = 0; +}; +} + +#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/exceptions.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/exceptions.h new file mode 100644 index 0000000..72bff04 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/exceptions.h @@ -0,0 +1,267 @@ +#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/mark.h" +#include "yaml-cpp/traits.h" +#include +#include +#include + +// This is here for compatibility with older versions of Visual Studio +// which don't support noexcept +#ifdef _MSC_VER + #define YAML_CPP_NOEXCEPT noexcept +#else + #define YAML_CPP_NOEXCEPT noexcept +#endif + +namespace YAML { +// error messages +namespace ErrorMsg { +const char* const YAML_DIRECTIVE_ARGS = + "YAML directives must have exactly one argument"; +const char* const YAML_VERSION = "bad YAML version: "; +const char* const YAML_MAJOR_VERSION = "YAML major version too large"; +const char* const REPEATED_YAML_DIRECTIVE = "repeated YAML directive"; +const char* const TAG_DIRECTIVE_ARGS = + "TAG directives must have exactly two arguments"; +const char* const REPEATED_TAG_DIRECTIVE = "repeated TAG directive"; +const char* const CHAR_IN_TAG_HANDLE = + "illegal character found while scanning tag handle"; +const char* const TAG_WITH_NO_SUFFIX = "tag handle with no suffix"; +const char* const END_OF_VERBATIM_TAG = "end of verbatim tag not found"; +const char* const END_OF_MAP = "end of map not found"; +const char* const END_OF_MAP_FLOW = "end of map flow not found"; +const char* const END_OF_SEQ = "end of sequence not found"; +const char* const END_OF_SEQ_FLOW = "end of sequence flow not found"; +const char* const MULTIPLE_TAGS = + "cannot assign multiple tags to the same node"; +const char* const MULTIPLE_ANCHORS = + "cannot assign multiple anchors to the same node"; +const char* const MULTIPLE_ALIASES = + "cannot assign multiple aliases to the same node"; +const char* const ALIAS_CONTENT = + "aliases can't have any content, *including* tags"; +const char* const INVALID_HEX = "bad character found while scanning hex number"; +const char* const INVALID_UNICODE = "invalid unicode: "; +const char* const INVALID_ESCAPE = "unknown escape character: "; +const char* const UNKNOWN_TOKEN = "unknown token"; +const char* const DOC_IN_SCALAR = "illegal document indicator in scalar"; +const char* const EOF_IN_SCALAR = "illegal EOF in scalar"; +const char* const CHAR_IN_SCALAR = "illegal character in scalar"; +const char* const TAB_IN_INDENTATION = + "illegal tab when looking for indentation"; +const char* const FLOW_END = "illegal flow end"; +const char* const BLOCK_ENTRY = "illegal block entry"; +const char* const MAP_KEY = "illegal map key"; +const char* const MAP_VALUE = "illegal map value"; +const char* const ALIAS_NOT_FOUND = "alias not found after *"; +const char* const ANCHOR_NOT_FOUND = "anchor not found after &"; +const char* const CHAR_IN_ALIAS = + "illegal character found while scanning alias"; +const char* const CHAR_IN_ANCHOR = + "illegal character found while scanning anchor"; +const char* const ZERO_INDENT_IN_BLOCK = + "cannot set zero indentation for a block scalar"; +const char* const CHAR_IN_BLOCK = "unexpected character in block scalar"; +const char* const AMBIGUOUS_ANCHOR = + "cannot assign the same alias to multiple nodes"; +const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined"; + +const char* const INVALID_NODE = + "invalid node; this may result from using a map iterator as a sequence " + "iterator, or vice-versa"; +const char* const INVALID_SCALAR = "invalid scalar"; +const char* const KEY_NOT_FOUND = "key not found"; +const char* const BAD_CONVERSION = "bad conversion"; +const char* const BAD_DEREFERENCE = "bad dereference"; +const char* const BAD_SUBSCRIPT = "operator[] call on a scalar"; +const char* const BAD_PUSHBACK = "appending to a non-sequence"; +const char* const BAD_INSERT = "inserting in a non-convertible-to-map"; + +const char* const UNMATCHED_GROUP_TAG = "unmatched group tag"; +const char* const UNEXPECTED_END_SEQ = "unexpected end sequence token"; +const char* const UNEXPECTED_END_MAP = "unexpected end map token"; +const char* const SINGLE_QUOTED_CHAR = + "invalid character in single-quoted string"; +const char* const INVALID_ANCHOR = "invalid anchor"; +const char* const INVALID_ALIAS = "invalid alias"; +const char* const INVALID_TAG = "invalid tag"; +const char* const BAD_FILE = "bad file"; + +template +inline const std::string KEY_NOT_FOUND_WITH_KEY( + const T&, typename disable_if>::type* = 0) { + return KEY_NOT_FOUND; +} + +inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) { + std::stringstream stream; + stream << KEY_NOT_FOUND << ": " << key; + return stream.str(); +} + +template +inline const std::string KEY_NOT_FOUND_WITH_KEY( + const T& key, typename enable_if>::type* = 0) { + std::stringstream stream; + stream << KEY_NOT_FOUND << ": " << key; + return stream.str(); +} +} + +class YAML_CPP_API Exception : public std::runtime_error { + public: + Exception(const Mark& mark_, const std::string& msg_) + : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {} + virtual ~Exception() YAML_CPP_NOEXCEPT; + + Exception(const Exception&) = default; + + Mark mark; + std::string msg; + + private: + static const std::string build_what(const Mark& mark, + const std::string& msg) { + if (mark.is_null()) { + return msg.c_str(); + } + + std::stringstream output; + output << "yaml-cpp: error at line " << mark.line + 1 << ", column " + << mark.column + 1 << ": " << msg; + return output.str(); + } +}; + +class YAML_CPP_API ParserException : public Exception { + public: + ParserException(const Mark& mark_, const std::string& msg_) + : Exception(mark_, msg_) {} + ParserException(const ParserException&) = default; + virtual ~ParserException() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API RepresentationException : public Exception { + public: + RepresentationException(const Mark& mark_, const std::string& msg_) + : Exception(mark_, msg_) {} + RepresentationException(const RepresentationException&) = default; + virtual ~RepresentationException() YAML_CPP_NOEXCEPT; +}; + +// representation exceptions +class YAML_CPP_API InvalidScalar : public RepresentationException { + public: + InvalidScalar(const Mark& mark_) + : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {} + InvalidScalar(const InvalidScalar&) = default; + virtual ~InvalidScalar() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API KeyNotFound : public RepresentationException { + public: + template + KeyNotFound(const Mark& mark_, const T& key_) + : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) { + } + KeyNotFound(const KeyNotFound&) = default; + virtual ~KeyNotFound() YAML_CPP_NOEXCEPT; +}; + +template +class YAML_CPP_API TypedKeyNotFound : public KeyNotFound { + public: + TypedKeyNotFound(const Mark& mark_, const T& key_) + : KeyNotFound(mark_, key_), key(key_) {} + virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {} + + T key; +}; + +template +inline TypedKeyNotFound MakeTypedKeyNotFound(const Mark& mark, + const T& key) { + return TypedKeyNotFound(mark, key); +} + +class YAML_CPP_API InvalidNode : public RepresentationException { + public: + InvalidNode() + : RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {} + InvalidNode(const InvalidNode&) = default; + virtual ~InvalidNode() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API BadConversion : public RepresentationException { + public: + explicit BadConversion(const Mark& mark_) + : RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {} + BadConversion(const BadConversion&) = default; + virtual ~BadConversion() YAML_CPP_NOEXCEPT; +}; + +template +class TypedBadConversion : public BadConversion { + public: + explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {} +}; + +class YAML_CPP_API BadDereference : public RepresentationException { + public: + BadDereference() + : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {} + BadDereference(const BadDereference&) = default; + virtual ~BadDereference() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API BadSubscript : public RepresentationException { + public: + BadSubscript() + : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {} + BadSubscript(const BadSubscript&) = default; + virtual ~BadSubscript() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API BadPushback : public RepresentationException { + public: + BadPushback() + : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {} + BadPushback(const BadPushback&) = default; + virtual ~BadPushback() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API BadInsert : public RepresentationException { + public: + BadInsert() + : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {} + BadInsert(const BadInsert&) = default; + virtual ~BadInsert() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API EmitterException : public Exception { + public: + EmitterException(const std::string& msg_) + : Exception(Mark::null_mark(), msg_) {} + EmitterException(const EmitterException&) = default; + virtual ~EmitterException() YAML_CPP_NOEXCEPT; +}; + +class YAML_CPP_API BadFile : public Exception { + public: + BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {} + BadFile(const BadFile&) = default; + virtual ~BadFile() YAML_CPP_NOEXCEPT; +}; +} + +#undef YAML_CPP_NOEXCEPT + +#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/mark.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/mark.h new file mode 100644 index 0000000..bf94b4f --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/mark.h @@ -0,0 +1,29 @@ +#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" + +namespace YAML { +struct YAML_CPP_API Mark { + Mark() : pos(0), line(0), column(0) {} + + static const Mark null_mark() { return Mark(-1, -1, -1); } + + bool is_null() const { return pos == -1 && line == -1 && column == -1; } + + int pos; + int line, column; + + private: + Mark(int pos_, int line_, int column_) + : pos(pos_), line(line_), column(column_) {} +}; +} + +#endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/convert.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/convert.h new file mode 100644 index 0000000..45a878a --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/convert.h @@ -0,0 +1,331 @@ +#ifndef NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include +#include +#include +#include + +#include "yaml-cpp/binary.h" +#include "yaml-cpp/node/impl.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/type.h" +#include "yaml-cpp/null.h" + +namespace YAML { +class Binary; +struct _Null; +template +struct convert; +} // namespace YAML + +namespace YAML { +namespace conversion { +inline bool IsInfinity(const std::string& input) { + return input == ".inf" || input == ".Inf" || input == ".INF" || + input == "+.inf" || input == "+.Inf" || input == "+.INF"; +} + +inline bool IsNegativeInfinity(const std::string& input) { + return input == "-.inf" || input == "-.Inf" || input == "-.INF"; +} + +inline bool IsNaN(const std::string& input) { + return input == ".nan" || input == ".NaN" || input == ".NAN"; +} +} + +// Node +template <> +struct convert { + static Node encode(const Node& rhs) { return rhs; } + + static bool decode(const Node& node, Node& rhs) { + rhs.reset(node); + return true; + } +}; + +// std::string +template <> +struct convert { + static Node encode(const std::string& rhs) { return Node(rhs); } + + static bool decode(const Node& node, std::string& rhs) { + if (!node.IsScalar()) + return false; + rhs = node.Scalar(); + return true; + } +}; + +// C-strings can only be encoded +template <> +struct convert { + static Node encode(const char*& rhs) { return Node(rhs); } +}; + +template +struct convert { + static Node encode(const char(&rhs)[N]) { return Node(rhs); } +}; + +template <> +struct convert<_Null> { + static Node encode(const _Null& /* rhs */) { return Node(); } + + static bool decode(const Node& node, _Null& /* rhs */) { + return node.IsNull(); + } +}; + +#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \ + template <> \ + struct convert { \ + static Node encode(const type& rhs) { \ + std::stringstream stream; \ + stream.precision(std::numeric_limits::digits10 + 1); \ + stream << rhs; \ + return Node(stream.str()); \ + } \ + \ + static bool decode(const Node& node, type& rhs) { \ + if (node.Type() != NodeType::Scalar) \ + return false; \ + const std::string& input = node.Scalar(); \ + std::stringstream stream(input); \ + stream.unsetf(std::ios::dec); \ + if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) \ + return true; \ + if (std::numeric_limits::has_infinity) { \ + if (conversion::IsInfinity(input)) { \ + rhs = std::numeric_limits::infinity(); \ + return true; \ + } else if (conversion::IsNegativeInfinity(input)) { \ + rhs = negative_op std::numeric_limits::infinity(); \ + return true; \ + } \ + } \ + \ + if (std::numeric_limits::has_quiet_NaN && \ + conversion::IsNaN(input)) { \ + rhs = std::numeric_limits::quiet_NaN(); \ + return true; \ + } \ + \ + return false; \ + } \ + } + +#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \ + YAML_DEFINE_CONVERT_STREAMABLE(type, -) + +#define YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(type) \ + YAML_DEFINE_CONVERT_STREAMABLE(type, +) + +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(int); +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(short); +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long); +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long long); +YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned); +YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned short); +YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long); +YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long long); + +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(char); +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(signed char); +YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned char); + +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(float); +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(double); +YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long double); + +#undef YAML_DEFINE_CONVERT_STREAMABLE_SIGNED +#undef YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED +#undef YAML_DEFINE_CONVERT_STREAMABLE + +// bool +template <> +struct convert { + static Node encode(bool rhs) { return rhs ? Node("true") : Node("false"); } + + YAML_CPP_API static bool decode(const Node& node, bool& rhs); +}; + +// std::map +template +struct convert> { + static Node encode(const std::map& rhs) { + Node node(NodeType::Map); + for (typename std::map::const_iterator it = rhs.begin(); + it != rhs.end(); ++it) + node.force_insert(it->first, it->second); + return node; + } + + static bool decode(const Node& node, std::map& rhs) { + if (!node.IsMap()) + return false; + + rhs.clear(); + for (const_iterator it = node.begin(); it != node.end(); ++it) +#if defined(__GNUC__) && __GNUC__ < 4 + // workaround for GCC 3: + rhs[it->first.template as()] = it->second.template as(); +#else + rhs[it->first.as()] = it->second.as(); +#endif + return true; + } +}; + +// std::vector +template +struct convert> { + static Node encode(const std::vector& rhs) { + Node node(NodeType::Sequence); + for (typename std::vector::const_iterator it = rhs.begin(); + it != rhs.end(); ++it) + node.push_back(*it); + return node; + } + + static bool decode(const Node& node, std::vector& rhs) { + if (!node.IsSequence()) + return false; + + rhs.clear(); + for (const_iterator it = node.begin(); it != node.end(); ++it) +#if defined(__GNUC__) && __GNUC__ < 4 + // workaround for GCC 3: + rhs.push_back(it->template as()); +#else + rhs.push_back(it->as()); +#endif + return true; + } +}; + +// std::list +template +struct convert> { + static Node encode(const std::list& rhs) { + Node node(NodeType::Sequence); + for (typename std::list::const_iterator it = rhs.begin(); + it != rhs.end(); ++it) + node.push_back(*it); + return node; + } + + static bool decode(const Node& node, std::list& rhs) { + if (!node.IsSequence()) + return false; + + rhs.clear(); + for (const_iterator it = node.begin(); it != node.end(); ++it) +#if defined(__GNUC__) && __GNUC__ < 4 + // workaround for GCC 3: + rhs.push_back(it->template as()); +#else + rhs.push_back(it->as()); +#endif + return true; + } +}; + +// std::array +template +struct convert> { + static Node encode(const std::array& rhs) { + Node node(NodeType::Sequence); + for (const auto& element : rhs) { + node.push_back(element); + } + return node; + } + + static bool decode(const Node& node, std::array& rhs) { + if (!isNodeValid(node)) { + return false; + } + + for (auto i = 0u; i < node.size(); ++i) { +#if defined(__GNUC__) && __GNUC__ < 4 + // workaround for GCC 3: + rhs[i] = node[i].template as(); +#else + rhs[i] = node[i].as(); +#endif + } + return true; + } + + private: + static bool isNodeValid(const Node& node) { + return node.IsSequence() && node.size() == N; + } +}; + +// std::pair +template +struct convert> { + static Node encode(const std::pair& rhs) { + Node node(NodeType::Sequence); + node.push_back(rhs.first); + node.push_back(rhs.second); + return node; + } + + static bool decode(const Node& node, std::pair& rhs) { + if (!node.IsSequence()) + return false; + if (node.size() != 2) + return false; + +#if defined(__GNUC__) && __GNUC__ < 4 + // workaround for GCC 3: + rhs.first = node[0].template as(); +#else + rhs.first = node[0].as(); +#endif +#if defined(__GNUC__) && __GNUC__ < 4 + // workaround for GCC 3: + rhs.second = node[1].template as(); +#else + rhs.second = node[1].as(); +#endif + return true; + } +}; + +// binary +template <> +struct convert { + static Node encode(const Binary& rhs) { + return Node(EncodeBase64(rhs.data(), rhs.size())); + } + + static bool decode(const Node& node, Binary& rhs) { + if (!node.IsScalar()) + return false; + + std::vector data = DecodeBase64(node.Scalar()); + if (data.empty() && !node.Scalar().empty()) + return false; + + rhs.swap(data); + return true; + } +}; +} + +#endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h new file mode 100644 index 0000000..2c80705 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h @@ -0,0 +1,26 @@ +#ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +namespace YAML { +namespace detail { +struct unspecified_bool { + struct NOT_ALLOWED; + static void true_value(NOT_ALLOWED*) {} +}; +typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*); +} +} + +#define YAML_CPP_OPERATOR_BOOL() \ + operator YAML::detail::unspecified_bool_type() const { \ + return this->operator!() ? 0 \ + : &YAML::detail::unspecified_bool::true_value; \ + } + +#endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/impl.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/impl.h new file mode 100644 index 0000000..09e55f8 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/impl.h @@ -0,0 +1,185 @@ +#ifndef NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/node/detail/node_data.h" +#include + +namespace YAML { +namespace detail { +template +struct get_idx { + static node* get(const std::vector& /* sequence */, + const Key& /* key */, shared_memory_holder /* pMemory */) { + return 0; + } +}; + +template +struct get_idx::value && + !std::is_same::value>::type> { + static node* get(const std::vector& sequence, const Key& key, + shared_memory_holder /* pMemory */) { + return key < sequence.size() ? sequence[key] : 0; + } + + static node* get(std::vector& sequence, const Key& key, + shared_memory_holder pMemory) { + if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined())) + return 0; + if (key == sequence.size()) + sequence.push_back(&pMemory->create_node()); + return sequence[key]; + } +}; + +template +struct get_idx::value>::type> { + static node* get(const std::vector& sequence, const Key& key, + shared_memory_holder pMemory) { + return key >= 0 ? get_idx::get( + sequence, static_cast(key), pMemory) + : 0; + } + static node* get(std::vector& sequence, const Key& key, + shared_memory_holder pMemory) { + return key >= 0 ? get_idx::get( + sequence, static_cast(key), pMemory) + : 0; + } +}; + +template +inline bool node::equals(const T& rhs, shared_memory_holder pMemory) { + T lhs; + if (convert::decode(Node(*this, pMemory), lhs)) { + return lhs == rhs; + } + return false; +} + +inline bool node::equals(const char* rhs, shared_memory_holder pMemory) { + return equals(rhs, pMemory); +} + +// indexing +template +inline node* node_data::get(const Key& key, + shared_memory_holder pMemory) const { + switch (m_type) { + case NodeType::Map: + break; + case NodeType::Undefined: + case NodeType::Null: + return NULL; + case NodeType::Sequence: + if (node* pNode = get_idx::get(m_sequence, key, pMemory)) + return pNode; + return NULL; + case NodeType::Scalar: + throw BadSubscript(); + } + + for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) { + if (it->first->equals(key, pMemory)) { + return it->second; + } + } + + return NULL; +} + +template +inline node& node_data::get(const Key& key, shared_memory_holder pMemory) { + switch (m_type) { + case NodeType::Map: + break; + case NodeType::Undefined: + case NodeType::Null: + case NodeType::Sequence: + if (node* pNode = get_idx::get(m_sequence, key, pMemory)) { + m_type = NodeType::Sequence; + return *pNode; + } + + convert_to_map(pMemory); + break; + case NodeType::Scalar: + throw BadSubscript(); + } + + for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) { + if (it->first->equals(key, pMemory)) { + return *it->second; + } + } + + node& k = convert_to_node(key, pMemory); + node& v = pMemory->create_node(); + insert_map_pair(k, v); + return v; +} + +template +inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) { + if (m_type != NodeType::Map) + return false; + + for (kv_pairs::iterator it = m_undefinedPairs.begin(); + it != m_undefinedPairs.end();) { + kv_pairs::iterator jt = std::next(it); + if (it->first->equals(key, pMemory)) + m_undefinedPairs.erase(it); + it = jt; + } + + for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) { + if (it->first->equals(key, pMemory)) { + m_map.erase(it); + return true; + } + } + + return false; +} + +// map +template +inline void node_data::force_insert(const Key& key, const Value& value, + shared_memory_holder pMemory) { + switch (m_type) { + case NodeType::Map: + break; + case NodeType::Undefined: + case NodeType::Null: + case NodeType::Sequence: + convert_to_map(pMemory); + break; + case NodeType::Scalar: + throw BadInsert(); + } + + node& k = convert_to_node(key, pMemory); + node& v = convert_to_node(value, pMemory); + insert_map_pair(k, v); +} + +template +inline node& node_data::convert_to_node(const T& rhs, + shared_memory_holder pMemory) { + Node value = convert::encode(rhs); + value.EnsureNodeExists(); + pMemory->merge(*value.m_pMemory); + return *value.m_pNode; +} +} +} + +#endif // NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/iterator.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/iterator.h new file mode 100644 index 0000000..deec8fb --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/iterator.h @@ -0,0 +1,92 @@ +#ifndef VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include +#include + +namespace YAML { +namespace detail { +struct iterator_value; + +template +class iterator_base : public std::iterator { + + private: + template + friend class iterator_base; + struct enabler {}; + typedef node_iterator base_type; + + struct proxy { + explicit proxy(const V& x) : m_ref(x) {} + V* operator->() { return std::addressof(m_ref); } + operator V*() { return std::addressof(m_ref); } + + V m_ref; + }; + + public: + typedef typename iterator_base::value_type value_type; + + public: + iterator_base() : m_iterator(), m_pMemory() {} + explicit iterator_base(base_type rhs, shared_memory_holder pMemory) + : m_iterator(rhs), m_pMemory(pMemory) {} + + template + iterator_base(const iterator_base& rhs, + typename std::enable_if::value, + enabler>::type = enabler()) + : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {} + + iterator_base& operator++() { + ++m_iterator; + return *this; + } + + iterator_base operator++(int) { + iterator_base iterator_pre(*this); + ++(*this); + return iterator_pre; + } + + template + bool operator==(const iterator_base& rhs) const { + return m_iterator == rhs.m_iterator; + } + + template + bool operator!=(const iterator_base& rhs) const { + return m_iterator != rhs.m_iterator; + } + + value_type operator*() const { + const typename base_type::value_type& v = *m_iterator; + if (v.pNode) + return value_type(Node(*v, m_pMemory)); + if (v.first && v.second) + return value_type(Node(*v.first, m_pMemory), Node(*v.second, m_pMemory)); + return value_type(); + } + + proxy operator->() const { return proxy(**this); } + + private: + base_type m_iterator; + shared_memory_holder m_pMemory; +}; +} +} + +#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h new file mode 100644 index 0000000..5f1ffe7 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h @@ -0,0 +1,27 @@ +#ifndef VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" +#include +#include +#include + +namespace YAML { + +namespace detail { +struct iterator_value; +template +class iterator_base; +} + +typedef detail::iterator_base iterator; +typedef detail::iterator_base const_iterator; +} + +#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/memory.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/memory.h new file mode 100644 index 0000000..8f2bc26 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/memory.h @@ -0,0 +1,46 @@ +#ifndef VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/ptr.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +} // namespace YAML + +namespace YAML { +namespace detail { +class YAML_CPP_API memory { + public: + node& create_node(); + void merge(const memory& rhs); + + private: + typedef std::set Nodes; + Nodes m_nodes; +}; + +class YAML_CPP_API memory_holder { + public: + memory_holder() : m_pMemory(new memory) {} + + node& create_node() { return m_pMemory->create_node(); } + void merge(memory_holder& rhs); + + private: + shared_memory m_pMemory; +}; +} +} + +#endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node.h new file mode 100644 index 0000000..8a776f6 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node.h @@ -0,0 +1,169 @@ +#ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/type.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/detail/node_ref.h" +#include + +namespace YAML { +namespace detail { +class node { + public: + node() : m_pRef(new node_ref) {} + node(const node&) = delete; + node& operator=(const node&) = delete; + + bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; } + const node_ref* ref() const { return m_pRef.get(); } + + bool is_defined() const { return m_pRef->is_defined(); } + const Mark& mark() const { return m_pRef->mark(); } + NodeType::value type() const { return m_pRef->type(); } + + const std::string& scalar() const { return m_pRef->scalar(); } + const std::string& tag() const { return m_pRef->tag(); } + EmitterStyle::value style() const { return m_pRef->style(); } + + template + bool equals(const T& rhs, shared_memory_holder pMemory); + bool equals(const char* rhs, shared_memory_holder pMemory); + + void mark_defined() { + if (is_defined()) + return; + + m_pRef->mark_defined(); + for (nodes::iterator it = m_dependencies.begin(); + it != m_dependencies.end(); ++it) + (*it)->mark_defined(); + m_dependencies.clear(); + } + + void add_dependency(node& rhs) { + if (is_defined()) + rhs.mark_defined(); + else + m_dependencies.insert(&rhs); + } + + void set_ref(const node& rhs) { + if (rhs.is_defined()) + mark_defined(); + m_pRef = rhs.m_pRef; + } + void set_data(const node& rhs) { + if (rhs.is_defined()) + mark_defined(); + m_pRef->set_data(*rhs.m_pRef); + } + + void set_mark(const Mark& mark) { m_pRef->set_mark(mark); } + + void set_type(NodeType::value type) { + if (type != NodeType::Undefined) + mark_defined(); + m_pRef->set_type(type); + } + void set_null() { + mark_defined(); + m_pRef->set_null(); + } + void set_scalar(const std::string& scalar) { + mark_defined(); + m_pRef->set_scalar(scalar); + } + void set_tag(const std::string& tag) { + mark_defined(); + m_pRef->set_tag(tag); + } + + // style + void set_style(EmitterStyle::value style) { + mark_defined(); + m_pRef->set_style(style); + } + + // size/iterator + std::size_t size() const { return m_pRef->size(); } + + const_node_iterator begin() const { + return static_cast(*m_pRef).begin(); + } + node_iterator begin() { return m_pRef->begin(); } + + const_node_iterator end() const { + return static_cast(*m_pRef).end(); + } + node_iterator end() { return m_pRef->end(); } + + // sequence + void push_back(node& input, shared_memory_holder pMemory) { + m_pRef->push_back(input, pMemory); + input.add_dependency(*this); + } + void insert(node& key, node& value, shared_memory_holder pMemory) { + m_pRef->insert(key, value, pMemory); + key.add_dependency(*this); + value.add_dependency(*this); + } + + // indexing + template + node* get(const Key& key, shared_memory_holder pMemory) const { + // NOTE: this returns a non-const node so that the top-level Node can wrap + // it, and returns a pointer so that it can be NULL (if there is no such + // key). + return static_cast(*m_pRef).get(key, pMemory); + } + template + node& get(const Key& key, shared_memory_holder pMemory) { + node& value = m_pRef->get(key, pMemory); + value.add_dependency(*this); + return value; + } + template + bool remove(const Key& key, shared_memory_holder pMemory) { + return m_pRef->remove(key, pMemory); + } + + node* get(node& key, shared_memory_holder pMemory) const { + // NOTE: this returns a non-const node so that the top-level Node can wrap + // it, and returns a pointer so that it can be NULL (if there is no such + // key). + return static_cast(*m_pRef).get(key, pMemory); + } + node& get(node& key, shared_memory_holder pMemory) { + node& value = m_pRef->get(key, pMemory); + key.add_dependency(*this); + value.add_dependency(*this); + return value; + } + bool remove(node& key, shared_memory_holder pMemory) { + return m_pRef->remove(key, pMemory); + } + + // map + template + void force_insert(const Key& key, const Value& value, + shared_memory_holder pMemory) { + m_pRef->force_insert(key, value, pMemory); + } + + private: + shared_node_ref m_pRef; + typedef std::set nodes; + nodes m_dependencies; +}; +} +} + +#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_data.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_data.h new file mode 100644 index 0000000..50bcd74 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_data.h @@ -0,0 +1,127 @@ +#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include +#include +#include + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +} // namespace YAML + +namespace YAML { +namespace detail { +class YAML_CPP_API node_data { + public: + node_data(); + node_data(const node_data&) = delete; + node_data& operator=(const node_data&) = delete; + + void mark_defined(); + void set_mark(const Mark& mark); + void set_type(NodeType::value type); + void set_tag(const std::string& tag); + void set_null(); + void set_scalar(const std::string& scalar); + void set_style(EmitterStyle::value style); + + bool is_defined() const { return m_isDefined; } + const Mark& mark() const { return m_mark; } + NodeType::value type() const { + return m_isDefined ? m_type : NodeType::Undefined; + } + const std::string& scalar() const { return m_scalar; } + const std::string& tag() const { return m_tag; } + EmitterStyle::value style() const { return m_style; } + + // size/iterator + std::size_t size() const; + + const_node_iterator begin() const; + node_iterator begin(); + + const_node_iterator end() const; + node_iterator end(); + + // sequence + void push_back(node& node, shared_memory_holder pMemory); + void insert(node& key, node& value, shared_memory_holder pMemory); + + // indexing + template + node* get(const Key& key, shared_memory_holder pMemory) const; + template + node& get(const Key& key, shared_memory_holder pMemory); + template + bool remove(const Key& key, shared_memory_holder pMemory); + + node* get(node& key, shared_memory_holder pMemory) const; + node& get(node& key, shared_memory_holder pMemory); + bool remove(node& key, shared_memory_holder pMemory); + + // map + template + void force_insert(const Key& key, const Value& value, + shared_memory_holder pMemory); + + public: + static std::string empty_scalar; + + private: + void compute_seq_size() const; + void compute_map_size() const; + + void reset_sequence(); + void reset_map(); + + void insert_map_pair(node& key, node& value); + void convert_to_map(shared_memory_holder pMemory); + void convert_sequence_to_map(shared_memory_holder pMemory); + + template + static node& convert_to_node(const T& rhs, shared_memory_holder pMemory); + + private: + bool m_isDefined; + Mark m_mark; + NodeType::value m_type; + std::string m_tag; + EmitterStyle::value m_style; + + // scalar + std::string m_scalar; + + // sequence + typedef std::vector node_seq; + node_seq m_sequence; + + mutable std::size_t m_seqSize; + + // map + typedef std::vector> node_map; + node_map m_map; + + typedef std::pair kv_pair; + typedef std::list kv_pairs; + mutable kv_pairs m_undefinedPairs; +}; +} +} + +#endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h new file mode 100644 index 0000000..088090f --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h @@ -0,0 +1,180 @@ +#ifndef VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/ptr.h" +#include +#include +#include +#include +#include +#include + +namespace YAML { +namespace detail { +struct iterator_type { + enum value { NoneType, Sequence, Map }; +}; + +template +struct node_iterator_value : public std::pair { + typedef std::pair kv; + + node_iterator_value() : kv(), pNode(0) {} + explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {} + explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {} + + V& operator*() const { return *pNode; } + V& operator->() const { return *pNode; } + + V* pNode; +}; + +typedef std::vector node_seq; +typedef std::vector> node_map; + +template +struct node_iterator_type { + typedef node_seq::iterator seq; + typedef node_map::iterator map; +}; + +template +struct node_iterator_type { + typedef node_seq::const_iterator seq; + typedef node_map::const_iterator map; +}; + +template +class node_iterator_base + : public std::iterator, + std::ptrdiff_t, node_iterator_value*, + node_iterator_value> { + private: + struct enabler {}; + + struct proxy { + explicit proxy(const node_iterator_value& x) : m_ref(x) {} + node_iterator_value* operator->() { return std::addressof(m_ref); } + operator node_iterator_value*() { return std::addressof(m_ref); } + + node_iterator_value m_ref; + }; + + public: + typedef typename node_iterator_type::seq SeqIter; + typedef typename node_iterator_type::map MapIter; + typedef node_iterator_value value_type; + + node_iterator_base() + : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {} + explicit node_iterator_base(SeqIter seqIt) + : m_type(iterator_type::Sequence), + m_seqIt(seqIt), + m_mapIt(), + m_mapEnd() {} + explicit node_iterator_base(MapIter mapIt, MapIter mapEnd) + : m_type(iterator_type::Map), + m_seqIt(), + m_mapIt(mapIt), + m_mapEnd(mapEnd) { + m_mapIt = increment_until_defined(m_mapIt); + } + + template + node_iterator_base(const node_iterator_base& rhs, + typename std::enable_if::value, + enabler>::type = enabler()) + : m_type(rhs.m_type), + m_seqIt(rhs.m_seqIt), + m_mapIt(rhs.m_mapIt), + m_mapEnd(rhs.m_mapEnd) {} + + template + friend class node_iterator_base; + + template + bool operator==(const node_iterator_base& rhs) const { + if (m_type != rhs.m_type) + return false; + + switch (m_type) { + case iterator_type::NoneType: + return true; + case iterator_type::Sequence: + return m_seqIt == rhs.m_seqIt; + case iterator_type::Map: + return m_mapIt == rhs.m_mapIt; + } + return true; + } + + template + bool operator!=(const node_iterator_base& rhs) const { + return !(*this == rhs); + } + + node_iterator_base& operator++() { + switch (m_type) { + case iterator_type::NoneType: + break; + case iterator_type::Sequence: + ++m_seqIt; + break; + case iterator_type::Map: + ++m_mapIt; + m_mapIt = increment_until_defined(m_mapIt); + break; + } + return *this; + } + + node_iterator_base operator++(int) { + node_iterator_base iterator_pre(*this); + ++(*this); + return iterator_pre; + } + + value_type operator*() const { + switch (m_type) { + case iterator_type::NoneType: + return value_type(); + case iterator_type::Sequence: + return value_type(**m_seqIt); + case iterator_type::Map: + return value_type(*m_mapIt->first, *m_mapIt->second); + } + return value_type(); + } + + proxy operator->() const { return proxy(**this); } + + MapIter increment_until_defined(MapIter it) { + while (it != m_mapEnd && !is_defined(it)) + ++it; + return it; + } + + bool is_defined(MapIter it) const { + return it->first->is_defined() && it->second->is_defined(); + } + + private: + typename iterator_type::value m_type; + + SeqIter m_seqIt; + MapIter m_mapIt, m_mapEnd; +}; + +typedef node_iterator_base node_iterator; +typedef node_iterator_base const_node_iterator; +} +} + +#endif // VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h new file mode 100644 index 0000000..d8a94f8 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h @@ -0,0 +1,98 @@ +#ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/type.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/detail/node_data.h" + +namespace YAML { +namespace detail { +class node_ref { + public: + node_ref() : m_pData(new node_data) {} + node_ref(const node_ref&) = delete; + node_ref& operator=(const node_ref&) = delete; + + bool is_defined() const { return m_pData->is_defined(); } + const Mark& mark() const { return m_pData->mark(); } + NodeType::value type() const { return m_pData->type(); } + const std::string& scalar() const { return m_pData->scalar(); } + const std::string& tag() const { return m_pData->tag(); } + EmitterStyle::value style() const { return m_pData->style(); } + + void mark_defined() { m_pData->mark_defined(); } + void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; } + + void set_mark(const Mark& mark) { m_pData->set_mark(mark); } + void set_type(NodeType::value type) { m_pData->set_type(type); } + void set_tag(const std::string& tag) { m_pData->set_tag(tag); } + void set_null() { m_pData->set_null(); } + void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); } + void set_style(EmitterStyle::value style) { m_pData->set_style(style); } + + // size/iterator + std::size_t size() const { return m_pData->size(); } + + const_node_iterator begin() const { + return static_cast(*m_pData).begin(); + } + node_iterator begin() { return m_pData->begin(); } + + const_node_iterator end() const { + return static_cast(*m_pData).end(); + } + node_iterator end() { return m_pData->end(); } + + // sequence + void push_back(node& node, shared_memory_holder pMemory) { + m_pData->push_back(node, pMemory); + } + void insert(node& key, node& value, shared_memory_holder pMemory) { + m_pData->insert(key, value, pMemory); + } + + // indexing + template + node* get(const Key& key, shared_memory_holder pMemory) const { + return static_cast(*m_pData).get(key, pMemory); + } + template + node& get(const Key& key, shared_memory_holder pMemory) { + return m_pData->get(key, pMemory); + } + template + bool remove(const Key& key, shared_memory_holder pMemory) { + return m_pData->remove(key, pMemory); + } + + node* get(node& key, shared_memory_holder pMemory) const { + return static_cast(*m_pData).get(key, pMemory); + } + node& get(node& key, shared_memory_holder pMemory) { + return m_pData->get(key, pMemory); + } + bool remove(node& key, shared_memory_holder pMemory) { + return m_pData->remove(key, pMemory); + } + + // map + template + void force_insert(const Key& key, const Value& value, + shared_memory_holder pMemory) { + m_pData->force_insert(key, value, pMemory); + } + + private: + shared_node_data m_pData; +}; +} +} + +#endif // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/emit.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/emit.h new file mode 100644 index 0000000..032268c --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/emit.h @@ -0,0 +1,32 @@ +#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +class Emitter; +class Node; + +/** + * Emits the node to the given {@link Emitter}. If there is an error in writing, + * {@link Emitter#good} will return false. + */ +YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node); + +/** Emits the node to the given output stream. */ +YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node); + +/** Converts the node to a YAML string. */ +YAML_CPP_API std::string Dump(const Node& node); +} // namespace YAML + +#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/impl.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/impl.h new file mode 100644 index 0000000..20c487a --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/impl.h @@ -0,0 +1,448 @@ +#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/detail/memory.h" +#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/exceptions.h" +#include + +namespace YAML { +inline Node::Node() : m_isValid(true), m_pNode(NULL) {} + +inline Node::Node(NodeType::value type) + : m_isValid(true), + m_pMemory(new detail::memory_holder), + m_pNode(&m_pMemory->create_node()) { + m_pNode->set_type(type); +} + +template +inline Node::Node(const T& rhs) + : m_isValid(true), + m_pMemory(new detail::memory_holder), + m_pNode(&m_pMemory->create_node()) { + Assign(rhs); +} + +inline Node::Node(const detail::iterator_value& rhs) + : m_isValid(rhs.m_isValid), + m_pMemory(rhs.m_pMemory), + m_pNode(rhs.m_pNode) {} + +inline Node::Node(const Node& rhs) + : m_isValid(rhs.m_isValid), + m_pMemory(rhs.m_pMemory), + m_pNode(rhs.m_pNode) {} + +inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {} + +inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory) + : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {} + +inline Node::~Node() {} + +inline void Node::EnsureNodeExists() const { + if (!m_isValid) + throw InvalidNode(); + if (!m_pNode) { + m_pMemory.reset(new detail::memory_holder); + m_pNode = &m_pMemory->create_node(); + m_pNode->set_null(); + } +} + +inline bool Node::IsDefined() const { + if (!m_isValid) { + return false; + } + return m_pNode ? m_pNode->is_defined() : true; +} + +inline Mark Node::Mark() const { + if (!m_isValid) { + throw InvalidNode(); + } + return m_pNode ? m_pNode->mark() : Mark::null_mark(); +} + +inline NodeType::value Node::Type() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->type() : NodeType::Null; +} + +// access + +// template helpers +template +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + T operator()(const S& fallback) const { + if (!node.m_pNode) + return fallback; + + T t; + if (convert::decode(node, t)) + return t; + return fallback; + } +}; + +template +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + std::string operator()(const S& fallback) const { + if (node.Type() != NodeType::Scalar) + return fallback; + return node.Scalar(); + } +}; + +template +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + T operator()() const { + if (!node.m_pNode) + throw TypedBadConversion(node.Mark()); + + T t; + if (convert::decode(node, t)) + return t; + throw TypedBadConversion(node.Mark()); + } +}; + +template <> +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + std::string operator()() const { + if (node.Type() != NodeType::Scalar) + throw TypedBadConversion(node.Mark()); + return node.Scalar(); + } +}; + +// access functions +template +inline T Node::as() const { + if (!m_isValid) + throw InvalidNode(); + return as_if(*this)(); +} + +template +inline T Node::as(const S& fallback) const { + if (!m_isValid) + return fallback; + return as_if(*this)(fallback); +} + +inline const std::string& Node::Scalar() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar; +} + +inline const std::string& Node::Tag() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar; +} + +inline void Node::SetTag(const std::string& tag) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_tag(tag); +} + +inline EmitterStyle::value Node::Style() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->style() : EmitterStyle::Default; +} + +inline void Node::SetStyle(EmitterStyle::value style) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_style(style); +} + +// assignment +inline bool Node::is(const Node& rhs) const { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + if (!m_pNode || !rhs.m_pNode) + return false; + return m_pNode->is(*rhs.m_pNode); +} + +template +inline Node& Node::operator=(const T& rhs) { + if (!m_isValid) + throw InvalidNode(); + Assign(rhs); + return *this; +} + +inline void Node::reset(const YAML::Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + m_pMemory = rhs.m_pMemory; + m_pNode = rhs.m_pNode; +} + +template +inline void Node::Assign(const T& rhs) { + if (!m_isValid) + throw InvalidNode(); + AssignData(convert::encode(rhs)); +} + +template <> +inline void Node::Assign(const std::string& rhs) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_scalar(rhs); +} + +inline void Node::Assign(const char* rhs) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_scalar(rhs); +} + +inline void Node::Assign(char* rhs) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_scalar(rhs); +} + +inline Node& Node::operator=(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + if (is(rhs)) + return *this; + AssignNode(rhs); + return *this; +} + +inline void Node::AssignData(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + rhs.EnsureNodeExists(); + + m_pNode->set_data(*rhs.m_pNode); + m_pMemory->merge(*rhs.m_pMemory); +} + +inline void Node::AssignNode(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + rhs.EnsureNodeExists(); + + if (!m_pNode) { + m_pNode = rhs.m_pNode; + m_pMemory = rhs.m_pMemory; + return; + } + + m_pNode->set_ref(*rhs.m_pNode); + m_pMemory->merge(*rhs.m_pMemory); + m_pNode = rhs.m_pNode; +} + +// size/iterator +inline std::size_t Node::size() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->size() : 0; +} + +inline const_iterator Node::begin() const { + if (!m_isValid) + return const_iterator(); + return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory) + : const_iterator(); +} + +inline iterator Node::begin() { + if (!m_isValid) + return iterator(); + return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator(); +} + +inline const_iterator Node::end() const { + if (!m_isValid) + return const_iterator(); + return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator(); +} + +inline iterator Node::end() { + if (!m_isValid) + return iterator(); + return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator(); +} + +// sequence +template +inline void Node::push_back(const T& rhs) { + if (!m_isValid) + throw InvalidNode(); + push_back(Node(rhs)); +} + +inline void Node::push_back(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + rhs.EnsureNodeExists(); + + m_pNode->push_back(*rhs.m_pNode, m_pMemory); + m_pMemory->merge(*rhs.m_pMemory); +} + +// helpers for indexing +namespace detail { +template +struct to_value_t { + explicit to_value_t(const T& t_) : t(t_) {} + const T& t; + typedef const T& return_type; + + const T& operator()() const { return t; } +}; + +template <> +struct to_value_t { + explicit to_value_t(const char* t_) : t(t_) {} + const char* t; + typedef std::string return_type; + + const std::string operator()() const { return t; } +}; + +template <> +struct to_value_t { + explicit to_value_t(char* t_) : t(t_) {} + const char* t; + typedef std::string return_type; + + const std::string operator()() const { return t; } +}; + +template +struct to_value_t { + explicit to_value_t(const char* t_) : t(t_) {} + const char* t; + typedef std::string return_type; + + const std::string operator()() const { return t; } +}; + +// converts C-strings to std::strings so they can be copied +template +inline typename to_value_t::return_type to_value(const T& t) { + return to_value_t(t)(); +} +} + +// indexing +template +inline const Node Node::operator[](const Key& key) const { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + detail::node* value = static_cast(*m_pNode) + .get(detail::to_value(key), m_pMemory); + if (!value) { + return Node(ZombieNode); + } + return Node(*value, m_pMemory); +} + +template +inline Node Node::operator[](const Key& key) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory); + return Node(value, m_pMemory); +} + +template +inline bool Node::remove(const Key& key) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + return m_pNode->remove(detail::to_value(key), m_pMemory); +} + +inline const Node Node::operator[](const Node& key) const { + if (!m_isValid || !key.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + key.EnsureNodeExists(); + m_pMemory->merge(*key.m_pMemory); + detail::node* value = + static_cast(*m_pNode).get(*key.m_pNode, m_pMemory); + if (!value) { + return Node(ZombieNode); + } + return Node(*value, m_pMemory); +} + +inline Node Node::operator[](const Node& key) { + if (!m_isValid || !key.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + key.EnsureNodeExists(); + m_pMemory->merge(*key.m_pMemory); + detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory); + return Node(value, m_pMemory); +} + +inline bool Node::remove(const Node& key) { + if (!m_isValid || !key.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + key.EnsureNodeExists(); + return m_pNode->remove(*key.m_pNode, m_pMemory); +} + +// map +template +inline void Node::force_insert(const Key& key, const Value& value) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->force_insert(detail::to_value(key), detail::to_value(value), + m_pMemory); +} + +// free functions +inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); } +} + +#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/iterator.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/iterator.h new file mode 100644 index 0000000..366a9c8 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/iterator.h @@ -0,0 +1,31 @@ +#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/detail/iterator_fwd.h" +#include "yaml-cpp/node/detail/iterator.h" +#include +#include +#include + +namespace YAML { +namespace detail { +struct iterator_value : public Node, std::pair { + iterator_value() {} + explicit iterator_value(const Node& rhs) + : Node(rhs), + std::pair(Node(Node::ZombieNode), Node(Node::ZombieNode)) {} + explicit iterator_value(const Node& key, const Node& value) + : Node(Node::ZombieNode), std::pair(key, value) {} +}; +} +} + +#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/node.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/node.h new file mode 100644 index 0000000..1ded7d2 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/node.h @@ -0,0 +1,145 @@ +#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/mark.h" +#include "yaml-cpp/node/detail/bool_type.h" +#include "yaml-cpp/node/detail/iterator_fwd.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +namespace detail { +class node; +class node_data; +struct iterator_value; +} // namespace detail +} // namespace YAML + +namespace YAML { +class YAML_CPP_API Node { + public: + friend class NodeBuilder; + friend class NodeEvents; + friend struct detail::iterator_value; + friend class detail::node; + friend class detail::node_data; + template + friend class detail::iterator_base; + template + friend struct as_if; + + typedef YAML::iterator iterator; + typedef YAML::const_iterator const_iterator; + + Node(); + explicit Node(NodeType::value type); + template + explicit Node(const T& rhs); + explicit Node(const detail::iterator_value& rhs); + Node(const Node& rhs); + ~Node(); + + YAML::Mark Mark() const; + NodeType::value Type() const; + bool IsDefined() const; + bool IsNull() const { return Type() == NodeType::Null; } + bool IsScalar() const { return Type() == NodeType::Scalar; } + bool IsSequence() const { return Type() == NodeType::Sequence; } + bool IsMap() const { return Type() == NodeType::Map; } + + // bool conversions + YAML_CPP_OPERATOR_BOOL() + bool operator!() const { return !IsDefined(); } + + // access + template + T as() const; + template + T as(const S& fallback) const; + const std::string& Scalar() const; + + const std::string& Tag() const; + void SetTag(const std::string& tag); + + // style + // WARNING: This API might change in future releases. + EmitterStyle::value Style() const; + void SetStyle(EmitterStyle::value style); + + // assignment + bool is(const Node& rhs) const; + template + Node& operator=(const T& rhs); + Node& operator=(const Node& rhs); + void reset(const Node& rhs = Node()); + + // size/iterator + std::size_t size() const; + + const_iterator begin() const; + iterator begin(); + + const_iterator end() const; + iterator end(); + + // sequence + template + void push_back(const T& rhs); + void push_back(const Node& rhs); + + // indexing + template + const Node operator[](const Key& key) const; + template + Node operator[](const Key& key); + template + bool remove(const Key& key); + + const Node operator[](const Node& key) const; + Node operator[](const Node& key); + bool remove(const Node& key); + + // map + template + void force_insert(const Key& key, const Value& value); + + private: + enum Zombie { ZombieNode }; + explicit Node(Zombie); + explicit Node(detail::node& node, detail::shared_memory_holder pMemory); + + void EnsureNodeExists() const; + + template + void Assign(const T& rhs); + void Assign(const char* rhs); + void Assign(char* rhs); + + void AssignData(const Node& rhs); + void AssignNode(const Node& rhs); + + private: + bool m_isValid; + mutable detail::shared_memory_holder m_pMemory; + mutable detail::node* m_pNode; +}; + +YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs); + +YAML_CPP_API Node Clone(const Node& node); + +template +struct convert; +} + +#endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/parse.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/parse.h new file mode 100644 index 0000000..7745fd7 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/parse.h @@ -0,0 +1,78 @@ +#ifndef VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +class Node; + +/** + * Loads the input string as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API Node Load(const std::string& input); + +/** + * Loads the input string as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API Node Load(const char* input); + +/** + * Loads the input stream as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API Node Load(std::istream& input); + +/** + * Loads the input file as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + * @throws {@link BadFile} if the file cannot be loaded. + */ +YAML_CPP_API Node LoadFile(const std::string& filename); + +/** + * Loads the input string as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API std::vector LoadAll(const std::string& input); + +/** + * Loads the input string as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API std::vector LoadAll(const char* input); + +/** + * Loads the input stream as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API std::vector LoadAll(std::istream& input); + +/** + * Loads the input file as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + * @throws {@link BadFile} if the file cannot be loaded. + */ +YAML_CPP_API std::vector LoadAllFromFile(const std::string& filename); +} // namespace YAML + +#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/ptr.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/ptr.h new file mode 100644 index 0000000..ce085dd --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/ptr.h @@ -0,0 +1,29 @@ +#ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" +#include + +namespace YAML { +namespace detail { +class node; +class node_ref; +class node_data; +class memory; +class memory_holder; + +typedef std::shared_ptr shared_node; +typedef std::shared_ptr shared_node_ref; +typedef std::shared_ptr shared_node_data; +typedef std::shared_ptr shared_memory_holder; +typedef std::shared_ptr shared_memory; +} +} + +#endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/type.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/type.h new file mode 100644 index 0000000..9d55ca9 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/node/type.h @@ -0,0 +1,16 @@ +#ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +namespace YAML { +struct NodeType { + enum value { Undefined, Null, Scalar, Sequence, Map }; +}; +} + +#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/noncopyable.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/noncopyable.h new file mode 100644 index 0000000..a261040 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/noncopyable.h @@ -0,0 +1,25 @@ +#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" + +namespace YAML { +// this is basically boost::noncopyable +class YAML_CPP_API noncopyable { + protected: + noncopyable() {} + ~noncopyable() {} + + private: + noncopyable(const noncopyable&); + const noncopyable& operator=(const noncopyable&); +}; +} + +#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/null.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/null.h new file mode 100644 index 0000000..b9521d4 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/null.h @@ -0,0 +1,26 @@ +#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/dll.h" +#include + +namespace YAML { +class Node; + +struct YAML_CPP_API _Null {}; +inline bool operator==(const _Null&, const _Null&) { return true; } +inline bool operator!=(const _Null&, const _Null&) { return false; } + +YAML_CPP_API bool IsNull(const Node& node); // old API only +YAML_CPP_API bool IsNullString(const std::string& str); + +extern YAML_CPP_API _Null Null; +} + +#endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/ostream_wrapper.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/ostream_wrapper.h new file mode 100644 index 0000000..09d45f3 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/ostream_wrapper.h @@ -0,0 +1,72 @@ +#ifndef OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +class YAML_CPP_API ostream_wrapper { + public: + ostream_wrapper(); + explicit ostream_wrapper(std::ostream& stream); + ~ostream_wrapper(); + + void write(const std::string& str); + void write(const char* str, std::size_t size); + + void set_comment() { m_comment = true; } + + const char* str() const { + if (m_pStream) { + return 0; + } else { + m_buffer[m_pos] = '\0'; + return &m_buffer[0]; + } + } + + std::size_t row() const { return m_row; } + std::size_t col() const { return m_col; } + std::size_t pos() const { return m_pos; } + bool comment() const { return m_comment; } + + private: + void update_pos(char ch); + + private: + mutable std::vector m_buffer; + std::ostream* const m_pStream; + + std::size_t m_pos; + std::size_t m_row, m_col; + bool m_comment; +}; + +template +inline ostream_wrapper& operator<<(ostream_wrapper& stream, + const char(&str)[N]) { + stream.write(str, N - 1); + return stream; +} + +inline ostream_wrapper& operator<<(ostream_wrapper& stream, + const std::string& str) { + stream.write(str); + return stream; +} + +inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) { + stream.write(&ch, 1); + return stream; +} +} + +#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/parser.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/parser.h new file mode 100644 index 0000000..ceac22d --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/parser.h @@ -0,0 +1,86 @@ +#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/noncopyable.h" + +namespace YAML { +class EventHandler; +class Node; +class Scanner; +struct Directives; +struct Token; + +/** + * A parser turns a stream of bytes into one stream of "events" per YAML + * document in the input stream. + */ +class YAML_CPP_API Parser : private noncopyable { + public: + /** Constructs an empty parser (with no input. */ + Parser(); + + /** + * Constructs a parser from the given input stream. The input stream must + * live as long as the parser. + */ + explicit Parser(std::istream& in); + + ~Parser(); + + /** Evaluates to true if the parser has some valid input to be read. */ + explicit operator bool() const; + + /** + * Resets the parser with the given input stream. Any existing state is + * erased. + */ + void Load(std::istream& in); + + /** + * Handles the next document by calling events on the {@code eventHandler}. + * + * @throw a ParserException on error. + * @return false if there are no more documents + */ + bool HandleNextDocument(EventHandler& eventHandler); + + void PrintTokens(std::ostream& out); + + private: + /** + * Reads any directives that are next in the queue, setting the internal + * {@code m_pDirectives} state. + */ + void ParseDirectives(); + + void HandleDirective(const Token& token); + + /** + * Handles a "YAML" directive, which should be of the form 'major.minor' (like + * a version number). + */ + void HandleYamlDirective(const Token& token); + + /** + * Handles a "TAG" directive, which should be of the form 'handle prefix', + * where 'handle' is converted to 'prefix' in the file. + */ + void HandleTagDirective(const Token& token); + + private: + std::unique_ptr m_pScanner; + std::unique_ptr m_pDirectives; +}; +} + +#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/stlemitter.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/stlemitter.h new file mode 100644 index 0000000..06780c8 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/stlemitter.h @@ -0,0 +1,51 @@ +#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include +#include + +namespace YAML { +template +inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) { + emitter << BeginSeq; + for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it) + emitter << *it; + emitter << EndSeq; + return emitter; +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::vector& v) { + return EmitSeq(emitter, v); +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::list& v) { + return EmitSeq(emitter, v); +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::set& v) { + return EmitSeq(emitter, v); +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::map& m) { + typedef typename std::map map; + emitter << BeginMap; + for (typename map::const_iterator it = m.begin(); it != m.end(); ++it) + emitter << Key << it->first << Value << it->second; + emitter << EndMap; + return emitter; +} +} + +#endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/traits.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/traits.h new file mode 100644 index 0000000..f33d0e1 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/traits.h @@ -0,0 +1,103 @@ +#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +namespace YAML { +template +struct is_numeric { + enum { value = false }; +}; + +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +#if defined(_MSC_VER) && (_MSC_VER < 1310) +template <> +struct is_numeric<__int64> { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +#else +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +#endif +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; + +template +struct enable_if_c { + typedef T type; +}; + +template +struct enable_if_c {}; + +template +struct enable_if : public enable_if_c {}; + +template +struct disable_if_c { + typedef T type; +}; + +template +struct disable_if_c {}; + +template +struct disable_if : public disable_if_c {}; +} + +#endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/yaml.h b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/yaml.h new file mode 100644 index 0000000..7f515ef --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/include/yaml-cpp/yaml.h @@ -0,0 +1,24 @@ +#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/parser.h" +#include "yaml-cpp/emitter.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/stlemitter.h" +#include "yaml-cpp/exceptions.h" + +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/impl.h" +#include "yaml-cpp/node/convert.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/detail/impl.h" +#include "yaml-cpp/node/parse.h" +#include "yaml-cpp/node/emit.h" + +#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/install.txt b/runtime/onnxruntime/third_party/yaml-cpp/install.txt new file mode 100644 index 0000000..9392362 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/install.txt @@ -0,0 +1,24 @@ +*** With CMake *** + +yaml-cpp uses CMake to support cross-platform building. In a UNIX-like system, the basic steps to build are: + +1. Download and install CMake (if you don't have root privileges, just install to a local directory, like ~/bin) + +2. From the source directory, run: + +mkdir build +cd build +cmake .. + +and then the usual + +make +make install + +3. To clean up, just remove the 'build' directory. + +*** Without CMake *** + +If you don't want to use CMake, just add all .cpp files to a makefile. yaml-cpp does not need any special build settings, so no 'configure' file is necessary. + +(Note: this is pretty tedious. It's sooo much easier to use CMake.) diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/binary.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/binary.cpp new file mode 100644 index 0000000..a7e5130 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/binary.cpp @@ -0,0 +1,93 @@ +#include "yaml-cpp/binary.h" + +namespace YAML { +static const char encoding[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +std::string EncodeBase64(const unsigned char *data, std::size_t size) { + const char PAD = '='; + + std::string ret; + ret.resize(4 * size / 3 + 3); + char *out = &ret[0]; + + std::size_t chunks = size / 3; + std::size_t remainder = size % 3; + + for (std::size_t i = 0; i < chunks; i++, data += 3) { + *out++ = encoding[data[0] >> 2]; + *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)]; + *out++ = encoding[((data[1] & 0xf) << 2) | (data[2] >> 6)]; + *out++ = encoding[data[2] & 0x3f]; + } + + switch (remainder) { + case 0: + break; + case 1: + *out++ = encoding[data[0] >> 2]; + *out++ = encoding[((data[0] & 0x3) << 4)]; + *out++ = PAD; + *out++ = PAD; + break; + case 2: + *out++ = encoding[data[0] >> 2]; + *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)]; + *out++ = encoding[((data[1] & 0xf) << 2)]; + *out++ = PAD; + break; + } + + ret.resize(out - &ret[0]); + return ret; +} + +static const unsigned char decoding[] = { + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, + 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, + 255, 0, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, +}; + +std::vector DecodeBase64(const std::string &input) { + typedef std::vector ret_type; + if (input.empty()) + return ret_type(); + + ret_type ret(3 * input.size() / 4 + 1); + unsigned char *out = &ret[0]; + + unsigned value = 0; + for (std::size_t i = 0; i < input.size(); i++) { + unsigned char d = decoding[static_cast(input[i])]; + if (d == 255) + return ret_type(); + + value = (value << 6) | d; + if (i % 4 == 3) { + *out++ = value >> 16; + if (i > 0 && input[i - 1] != '=') + *out++ = value >> 8; + if (input[i] != '=') + *out++ = value; + } + } + + ret.resize(out - &ret[0]); + return ret; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/collectionstack.h b/runtime/onnxruntime/third_party/yaml-cpp/src/collectionstack.h new file mode 100644 index 0000000..2302786 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/collectionstack.h @@ -0,0 +1,39 @@ +#ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +namespace YAML { +struct CollectionType { + enum value { NoCollection, BlockMap, BlockSeq, FlowMap, FlowSeq, CompactMap }; +}; + +class CollectionStack { + public: + CollectionType::value GetCurCollectionType() const { + if (collectionStack.empty()) + return CollectionType::NoCollection; + return collectionStack.top(); + } + + void PushCollectionType(CollectionType::value type) { + collectionStack.push(type); + } + void PopCollectionType(CollectionType::value type) { + assert(type == GetCurCollectionType()); + collectionStack.pop(); + } + + private: + std::stack collectionStack; +}; +} + +#endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilder.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilder.cpp new file mode 100644 index 0000000..416c135 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilder.cpp @@ -0,0 +1,17 @@ +#include "graphbuilderadapter.h" + +#include "yaml-cpp/parser.h" // IWYU pragma: keep + +namespace YAML { +class GraphBuilderInterface; + +void* BuildGraphOfNextDocument(Parser& parser, + GraphBuilderInterface& graphBuilder) { + GraphBuilderAdapter eventHandler(graphBuilder); + if (parser.HandleNextDocument(eventHandler)) { + return eventHandler.RootNode(); + } else { + return NULL; + } +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilderadapter.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilderadapter.cpp new file mode 100644 index 0000000..02a3d97 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilderadapter.cpp @@ -0,0 +1,94 @@ +#include "graphbuilderadapter.h" +#include "yaml-cpp/contrib/graphbuilder.h" + +namespace YAML { +struct Mark; + +int GraphBuilderAdapter::ContainerFrame::sequenceMarker; + +void GraphBuilderAdapter::OnNull(const Mark &mark, anchor_t anchor) { + void *pParent = GetCurrentParent(); + void *pNode = m_builder.NewNull(mark, pParent); + RegisterAnchor(anchor, pNode); + + DispositionNode(pNode); +} + +void GraphBuilderAdapter::OnAlias(const Mark &mark, anchor_t anchor) { + void *pReffedNode = m_anchors.Get(anchor); + DispositionNode(m_builder.AnchorReference(mark, pReffedNode)); +} + +void GraphBuilderAdapter::OnScalar(const Mark &mark, const std::string &tag, + anchor_t anchor, const std::string &value) { + void *pParent = GetCurrentParent(); + void *pNode = m_builder.NewScalar(mark, tag, pParent, value); + RegisterAnchor(anchor, pNode); + + DispositionNode(pNode); +} + +void GraphBuilderAdapter::OnSequenceStart(const Mark &mark, + const std::string &tag, + anchor_t anchor, + EmitterStyle::value /* style */) { + void *pNode = m_builder.NewSequence(mark, tag, GetCurrentParent()); + m_containers.push(ContainerFrame(pNode)); + RegisterAnchor(anchor, pNode); +} + +void GraphBuilderAdapter::OnSequenceEnd() { + void *pSequence = m_containers.top().pContainer; + m_containers.pop(); + + DispositionNode(pSequence); +} + +void GraphBuilderAdapter::OnMapStart(const Mark &mark, const std::string &tag, + anchor_t anchor, + EmitterStyle::value /* style */) { + void *pNode = m_builder.NewMap(mark, tag, GetCurrentParent()); + m_containers.push(ContainerFrame(pNode, m_pKeyNode)); + m_pKeyNode = NULL; + RegisterAnchor(anchor, pNode); +} + +void GraphBuilderAdapter::OnMapEnd() { + void *pMap = m_containers.top().pContainer; + m_pKeyNode = m_containers.top().pPrevKeyNode; + m_containers.pop(); + DispositionNode(pMap); +} + +void *GraphBuilderAdapter::GetCurrentParent() const { + if (m_containers.empty()) { + return NULL; + } + return m_containers.top().pContainer; +} + +void GraphBuilderAdapter::RegisterAnchor(anchor_t anchor, void *pNode) { + if (anchor) { + m_anchors.Register(anchor, pNode); + } +} + +void GraphBuilderAdapter::DispositionNode(void *pNode) { + if (m_containers.empty()) { + m_pRootNode = pNode; + return; + } + + void *pContainer = m_containers.top().pContainer; + if (m_containers.top().isMap()) { + if (m_pKeyNode) { + m_builder.AssignInMap(pContainer, m_pKeyNode, pNode); + m_pKeyNode = NULL; + } else { + m_pKeyNode = pNode; + } + } else { + m_builder.AppendToSequence(pContainer, pNode); + } +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilderadapter.h b/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilderadapter.h new file mode 100644 index 0000000..0d1e579 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/contrib/graphbuilderadapter.h @@ -0,0 +1,79 @@ +#ifndef GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include + +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/contrib/anchordict.h" +#include "yaml-cpp/contrib/graphbuilder.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/eventhandler.h" + +namespace YAML { +class GraphBuilderInterface; +struct Mark; +} // namespace YAML + +namespace YAML { +class GraphBuilderAdapter : public EventHandler { + public: + GraphBuilderAdapter(GraphBuilderInterface& builder) + : m_builder(builder), m_pRootNode(NULL), m_pKeyNode(NULL) {} + + virtual void OnDocumentStart(const Mark& mark) { (void)mark; } + virtual void OnDocumentEnd() {} + + virtual void OnNull(const Mark& mark, anchor_t anchor); + virtual void OnAlias(const Mark& mark, anchor_t anchor); + virtual void OnScalar(const Mark& mark, const std::string& tag, + anchor_t anchor, const std::string& value); + + virtual void OnSequenceStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style); + virtual void OnSequenceEnd(); + + virtual void OnMapStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style); + virtual void OnMapEnd(); + + void* RootNode() const { return m_pRootNode; } + + private: + struct ContainerFrame { + ContainerFrame(void* pSequence) + : pContainer(pSequence), pPrevKeyNode(&sequenceMarker) {} + ContainerFrame(void* pMap, void* pPrevKeyNode) + : pContainer(pMap), pPrevKeyNode(pPrevKeyNode) {} + + void* pContainer; + void* pPrevKeyNode; + + bool isMap() const { return pPrevKeyNode != &sequenceMarker; } + + private: + static int sequenceMarker; + }; + typedef std::stack ContainerStack; + typedef AnchorDict AnchorMap; + + GraphBuilderInterface& m_builder; + ContainerStack m_containers; + AnchorMap m_anchors; + void* m_pRootNode; + void* m_pKeyNode; + + void* GetCurrentParent() const; + void RegisterAnchor(anchor_t anchor, void* pNode); + void DispositionNode(void* pNode); +}; +} + +#endif // GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/convert.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/convert.cpp new file mode 100644 index 0000000..ec05b77 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/convert.cpp @@ -0,0 +1,75 @@ +#include + +#include "yaml-cpp/node/convert.h" + +namespace { +// we're not gonna mess with the mess that is all the isupper/etc. functions +bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; } +bool IsUpper(char ch) { return 'A' <= ch && ch <= 'Z'; } +char ToLower(char ch) { return IsUpper(ch) ? ch + 'a' - 'A' : ch; } + +std::string tolower(const std::string& str) { + std::string s(str); + std::transform(s.begin(), s.end(), s.begin(), ToLower); + return s; +} + +template +bool IsEntirely(const std::string& str, T func) { + for (std::size_t i = 0; i < str.size(); i++) + if (!func(str[i])) + return false; + + return true; +} + +// IsFlexibleCase +// . Returns true if 'str' is: +// . UPPERCASE +// . lowercase +// . Capitalized +bool IsFlexibleCase(const std::string& str) { + if (str.empty()) + return true; + + if (IsEntirely(str, IsLower)) + return true; + + bool firstcaps = IsUpper(str[0]); + std::string rest = str.substr(1); + return firstcaps && (IsEntirely(rest, IsLower) || IsEntirely(rest, IsUpper)); +} +} + +namespace YAML { +bool convert::decode(const Node& node, bool& rhs) { + if (!node.IsScalar()) + return false; + + // we can't use iostream bool extraction operators as they don't + // recognize all possible values in the table below (taken from + // http://yaml.org/type/bool.html) + static const struct { + std::string truename, falsename; + } names[] = { + {"y", "n"}, {"yes", "no"}, {"true", "false"}, {"on", "off"}, + }; + + if (!IsFlexibleCase(node.Scalar())) + return false; + + for (unsigned i = 0; i < sizeof(names) / sizeof(names[0]); i++) { + if (names[i].truename == tolower(node.Scalar())) { + rhs = true; + return true; + } + + if (names[i].falsename == tolower(node.Scalar())) { + rhs = false; + return true; + } + } + + return false; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/directives.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/directives.cpp new file mode 100644 index 0000000..963bd2c --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/directives.cpp @@ -0,0 +1,22 @@ +#include "directives.h" + +namespace YAML { +Directives::Directives() { + // version + version.isDefault = true; + version.major = 1; + version.minor = 2; +} + +const std::string Directives::TranslateTagHandle( + const std::string& handle) const { + std::map::const_iterator it = tags.find(handle); + if (it == tags.end()) { + if (handle == "!!") + return "tag:yaml.org,2002:"; + return handle; + } + + return it->second; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/directives.h b/runtime/onnxruntime/third_party/yaml-cpp/src/directives.h new file mode 100644 index 0000000..333af26 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/directives.h @@ -0,0 +1,29 @@ +#ifndef DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +namespace YAML { +struct Version { + bool isDefault; + int major, minor; +}; + +struct Directives { + Directives(); + + const std::string TranslateTagHandle(const std::string& handle) const; + + Version version; + std::map tags; +}; +} + +#endif // DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/emit.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/emit.cpp new file mode 100644 index 0000000..51bc791 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/emit.cpp @@ -0,0 +1,25 @@ +#include "yaml-cpp/node/emit.h" +#include "yaml-cpp/emitfromevents.h" +#include "yaml-cpp/emitter.h" +#include "nodeevents.h" + +namespace YAML { +Emitter& operator<<(Emitter& out, const Node& node) { + EmitFromEvents emitFromEvents(out); + NodeEvents events(node); + events.Emit(emitFromEvents); + return out; +} + +std::ostream& operator<<(std::ostream& out, const Node& node) { + Emitter emitter(out); + emitter << node; + return out; +} + +std::string Dump(const Node& node) { + Emitter emitter; + emitter << node; + return emitter.c_str(); +} +} // namespace YAML diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/emitfromevents.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/emitfromevents.cpp new file mode 100644 index 0000000..4832649 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/emitfromevents.cpp @@ -0,0 +1,119 @@ +#include +#include + +#include "yaml-cpp/emitfromevents.h" +#include "yaml-cpp/emitter.h" +#include "yaml-cpp/emittermanip.h" +#include "yaml-cpp/null.h" + +namespace YAML { +struct Mark; +} // namespace YAML + +namespace { +std::string ToString(YAML::anchor_t anchor) { + std::stringstream stream; + stream << anchor; + return stream.str(); +} +} + +namespace YAML { +EmitFromEvents::EmitFromEvents(Emitter& emitter) : m_emitter(emitter) {} + +void EmitFromEvents::OnDocumentStart(const Mark&) {} + +void EmitFromEvents::OnDocumentEnd() {} + +void EmitFromEvents::OnNull(const Mark&, anchor_t anchor) { + BeginNode(); + EmitProps("", anchor); + m_emitter << Null; +} + +void EmitFromEvents::OnAlias(const Mark&, anchor_t anchor) { + BeginNode(); + m_emitter << Alias(ToString(anchor)); +} + +void EmitFromEvents::OnScalar(const Mark&, const std::string& tag, + anchor_t anchor, const std::string& value) { + BeginNode(); + EmitProps(tag, anchor); + m_emitter << value; +} + +void EmitFromEvents::OnSequenceStart(const Mark&, const std::string& tag, + anchor_t anchor, + EmitterStyle::value style) { + BeginNode(); + EmitProps(tag, anchor); + switch (style) { + case EmitterStyle::Block: + m_emitter << Block; + break; + case EmitterStyle::Flow: + m_emitter << Flow; + break; + default: + break; + } + m_emitter << BeginSeq; + m_stateStack.push(State::WaitingForSequenceEntry); +} + +void EmitFromEvents::OnSequenceEnd() { + m_emitter << EndSeq; + assert(m_stateStack.top() == State::WaitingForSequenceEntry); + m_stateStack.pop(); +} + +void EmitFromEvents::OnMapStart(const Mark&, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) { + BeginNode(); + EmitProps(tag, anchor); + switch (style) { + case EmitterStyle::Block: + m_emitter << Block; + break; + case EmitterStyle::Flow: + m_emitter << Flow; + break; + default: + break; + } + m_emitter << BeginMap; + m_stateStack.push(State::WaitingForKey); +} + +void EmitFromEvents::OnMapEnd() { + m_emitter << EndMap; + assert(m_stateStack.top() == State::WaitingForKey); + m_stateStack.pop(); +} + +void EmitFromEvents::BeginNode() { + if (m_stateStack.empty()) + return; + + switch (m_stateStack.top()) { + case State::WaitingForKey: + m_emitter << Key; + m_stateStack.top() = State::WaitingForValue; + break; + case State::WaitingForValue: + m_emitter << Value; + m_stateStack.top() = State::WaitingForKey; + break; + default: + break; + } +} + +void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) { + if (!tag.empty() && tag != "?" && tag != "!") + m_emitter << VerbatimTag(tag); + if (anchor) + m_emitter << Anchor(ToString(anchor)); +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/emitter.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/emitter.cpp new file mode 100644 index 0000000..ebeb059 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/emitter.cpp @@ -0,0 +1,911 @@ +#include + +#include "emitterutils.h" +#include "indentation.h" // IWYU pragma: keep +#include "yaml-cpp/emitter.h" +#include "yaml-cpp/emitterdef.h" +#include "yaml-cpp/emittermanip.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep + +namespace YAML { +class Binary; +struct _Null; + +Emitter::Emitter() : m_pState(new EmitterState) {} + +Emitter::Emitter(std::ostream& stream) + : m_pState(new EmitterState), m_stream(stream) {} + +Emitter::~Emitter() {} + +const char* Emitter::c_str() const { return m_stream.str(); } + +std::size_t Emitter::size() const { return m_stream.pos(); } + +// state checking +bool Emitter::good() const { return m_pState->good(); } + +const std::string Emitter::GetLastError() const { + return m_pState->GetLastError(); +} + +// global setters +bool Emitter::SetOutputCharset(EMITTER_MANIP value) { + return m_pState->SetOutputCharset(value, FmtScope::Global); +} + +bool Emitter::SetStringFormat(EMITTER_MANIP value) { + return m_pState->SetStringFormat(value, FmtScope::Global); +} + +bool Emitter::SetBoolFormat(EMITTER_MANIP value) { + bool ok = false; + if (m_pState->SetBoolFormat(value, FmtScope::Global)) + ok = true; + if (m_pState->SetBoolCaseFormat(value, FmtScope::Global)) + ok = true; + if (m_pState->SetBoolLengthFormat(value, FmtScope::Global)) + ok = true; + return ok; +} + +bool Emitter::SetIntBase(EMITTER_MANIP value) { + return m_pState->SetIntFormat(value, FmtScope::Global); +} + +bool Emitter::SetSeqFormat(EMITTER_MANIP value) { + return m_pState->SetFlowType(GroupType::Seq, value, FmtScope::Global); +} + +bool Emitter::SetMapFormat(EMITTER_MANIP value) { + bool ok = false; + if (m_pState->SetFlowType(GroupType::Map, value, FmtScope::Global)) + ok = true; + if (m_pState->SetMapKeyFormat(value, FmtScope::Global)) + ok = true; + return ok; +} + +bool Emitter::SetIndent(std::size_t n) { + return m_pState->SetIndent(n, FmtScope::Global); +} + +bool Emitter::SetPreCommentIndent(std::size_t n) { + return m_pState->SetPreCommentIndent(n, FmtScope::Global); +} + +bool Emitter::SetPostCommentIndent(std::size_t n) { + return m_pState->SetPostCommentIndent(n, FmtScope::Global); +} + +bool Emitter::SetFloatPrecision(std::size_t n) { + return m_pState->SetFloatPrecision(n, FmtScope::Global); +} + +bool Emitter::SetDoublePrecision(std::size_t n) { + return m_pState->SetDoublePrecision(n, FmtScope::Global); +} + +// SetLocalValue +// . Either start/end a group, or set a modifier locally +Emitter& Emitter::SetLocalValue(EMITTER_MANIP value) { + if (!good()) + return *this; + + switch (value) { + case BeginDoc: + EmitBeginDoc(); + break; + case EndDoc: + EmitEndDoc(); + break; + case BeginSeq: + EmitBeginSeq(); + break; + case EndSeq: + EmitEndSeq(); + break; + case BeginMap: + EmitBeginMap(); + break; + case EndMap: + EmitEndMap(); + break; + case Key: + case Value: + // deprecated (these can be deduced by the parity of nodes in a map) + break; + case TagByKind: + EmitKindTag(); + break; + case Newline: + EmitNewline(); + break; + default: + m_pState->SetLocalValue(value); + break; + } + return *this; +} + +Emitter& Emitter::SetLocalIndent(const _Indent& indent) { + m_pState->SetIndent(indent.value, FmtScope::Local); + return *this; +} + +Emitter& Emitter::SetLocalPrecision(const _Precision& precision) { + if (precision.floatPrecision >= 0) + m_pState->SetFloatPrecision(precision.floatPrecision, FmtScope::Local); + if (precision.doublePrecision >= 0) + m_pState->SetDoublePrecision(precision.doublePrecision, FmtScope::Local); + return *this; +} + +// EmitBeginDoc +void Emitter::EmitBeginDoc() { + if (!good()) + return; + + if (m_pState->CurGroupType() != GroupType::NoType) { + m_pState->SetError("Unexpected begin document"); + return; + } + + if (m_pState->HasAnchor() || m_pState->HasTag()) { + m_pState->SetError("Unexpected begin document"); + return; + } + + if (m_stream.col() > 0) + m_stream << "\n"; + m_stream << "---\n"; + + m_pState->StartedDoc(); +} + +// EmitEndDoc +void Emitter::EmitEndDoc() { + if (!good()) + return; + + if (m_pState->CurGroupType() != GroupType::NoType) { + m_pState->SetError("Unexpected begin document"); + return; + } + + if (m_pState->HasAnchor() || m_pState->HasTag()) { + m_pState->SetError("Unexpected begin document"); + return; + } + + if (m_stream.col() > 0) + m_stream << "\n"; + m_stream << "...\n"; +} + +// EmitBeginSeq +void Emitter::EmitBeginSeq() { + if (!good()) + return; + + PrepareNode(m_pState->NextGroupType(GroupType::Seq)); + + m_pState->StartedGroup(GroupType::Seq); +} + +// EmitEndSeq +void Emitter::EmitEndSeq() { + if (!good()) + return; + + if (m_pState->CurGroupChildCount() == 0) + m_pState->ForceFlow(); + + if (m_pState->CurGroupFlowType() == FlowType::Flow) { + if (m_stream.comment()) + m_stream << "\n"; + m_stream << IndentTo(m_pState->CurIndent()); + if (m_pState->CurGroupChildCount() == 0) + m_stream << "["; + m_stream << "]"; + } + + m_pState->EndedGroup(GroupType::Seq); +} + +// EmitBeginMap +void Emitter::EmitBeginMap() { + if (!good()) + return; + + PrepareNode(m_pState->NextGroupType(GroupType::Map)); + + m_pState->StartedGroup(GroupType::Map); +} + +// EmitEndMap +void Emitter::EmitEndMap() { + if (!good()) + return; + + if (m_pState->CurGroupChildCount() == 0) + m_pState->ForceFlow(); + + if (m_pState->CurGroupFlowType() == FlowType::Flow) { + if (m_stream.comment()) + m_stream << "\n"; + m_stream << IndentTo(m_pState->CurIndent()); + if (m_pState->CurGroupChildCount() == 0) + m_stream << "{"; + m_stream << "}"; + } + + m_pState->EndedGroup(GroupType::Map); +} + +// EmitNewline +void Emitter::EmitNewline() { + if (!good()) + return; + + PrepareNode(EmitterNodeType::NoType); + m_stream << "\n"; + m_pState->SetNonContent(); +} + +bool Emitter::CanEmitNewline() const { return true; } + +// Put the stream in a state so we can simply write the next node +// E.g., if we're in a sequence, write the "- " +void Emitter::PrepareNode(EmitterNodeType::value child) { + switch (m_pState->CurGroupNodeType()) { + case EmitterNodeType::NoType: + PrepareTopNode(child); + break; + case EmitterNodeType::FlowSeq: + FlowSeqPrepareNode(child); + break; + case EmitterNodeType::BlockSeq: + BlockSeqPrepareNode(child); + break; + case EmitterNodeType::FlowMap: + FlowMapPrepareNode(child); + break; + case EmitterNodeType::BlockMap: + BlockMapPrepareNode(child); + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + assert(false); + break; + } +} + +void Emitter::PrepareTopNode(EmitterNodeType::value child) { + if (child == EmitterNodeType::NoType) + return; + + if (m_pState->CurGroupChildCount() > 0 && m_stream.col() > 0) { + if (child != EmitterNodeType::NoType) + EmitBeginDoc(); + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + // TODO: if we were writing null, and + // we wanted it blank, we wouldn't want a space + SpaceOrIndentTo(m_pState->HasBegunContent(), 0); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + if (m_pState->HasBegunNode()) + m_stream << "\n"; + break; + } +} + +void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) { + const std::size_t lastIndent = m_pState->LastIndent(); + + if (!m_pState->HasBegunNode()) { + if (m_stream.comment()) + m_stream << "\n"; + m_stream << IndentTo(lastIndent); + if (m_pState->CurGroupChildCount() == 0) + m_stream << "["; + else + m_stream << ","; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo( + m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, + lastIndent); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + assert(false); + break; + } +} + +void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) { + const std::size_t curIndent = m_pState->CurIndent(); + const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent(); + + if (child == EmitterNodeType::NoType) + return; + + if (!m_pState->HasBegunContent()) { + if (m_pState->CurGroupChildCount() > 0 || m_stream.comment()) { + m_stream << "\n"; + } + m_stream << IndentTo(curIndent); + m_stream << "-"; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo(m_pState->HasBegunContent(), nextIndent); + break; + case EmitterNodeType::BlockSeq: + m_stream << "\n"; + break; + case EmitterNodeType::BlockMap: + if (m_pState->HasBegunContent() || m_stream.comment()) + m_stream << "\n"; + break; + } +} + +void Emitter::FlowMapPrepareNode(EmitterNodeType::value child) { + if (m_pState->CurGroupChildCount() % 2 == 0) { + if (m_pState->GetMapKeyFormat() == LongKey) + m_pState->SetLongKey(); + + if (m_pState->CurGroupLongKey()) + FlowMapPrepareLongKey(child); + else + FlowMapPrepareSimpleKey(child); + } else { + if (m_pState->CurGroupLongKey()) + FlowMapPrepareLongKeyValue(child); + else + FlowMapPrepareSimpleKeyValue(child); + } +} + +void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) { + const std::size_t lastIndent = m_pState->LastIndent(); + + if (!m_pState->HasBegunNode()) { + if (m_stream.comment()) + m_stream << "\n"; + m_stream << IndentTo(lastIndent); + if (m_pState->CurGroupChildCount() == 0) + m_stream << "{ ?"; + else + m_stream << ", ?"; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo( + m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, + lastIndent); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + assert(false); + break; + } +} + +void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) { + const std::size_t lastIndent = m_pState->LastIndent(); + + if (!m_pState->HasBegunNode()) { + if (m_stream.comment()) + m_stream << "\n"; + m_stream << IndentTo(lastIndent); + m_stream << ":"; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo( + m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, + lastIndent); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + assert(false); + break; + } +} + +void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) { + const std::size_t lastIndent = m_pState->LastIndent(); + + if (!m_pState->HasBegunNode()) { + if (m_stream.comment()) + m_stream << "\n"; + m_stream << IndentTo(lastIndent); + if (m_pState->CurGroupChildCount() == 0) + m_stream << "{"; + else + m_stream << ","; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo( + m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, + lastIndent); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + assert(false); + break; + } +} + +void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child) { + const std::size_t lastIndent = m_pState->LastIndent(); + + if (!m_pState->HasBegunNode()) { + if (m_stream.comment()) + m_stream << "\n"; + m_stream << IndentTo(lastIndent); + m_stream << ":"; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo( + m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, + lastIndent); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + assert(false); + break; + } +} + +void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) { + if (m_pState->CurGroupChildCount() % 2 == 0) { + if (m_pState->GetMapKeyFormat() == LongKey) + m_pState->SetLongKey(); + if (child == EmitterNodeType::BlockSeq || + child == EmitterNodeType::BlockMap) + m_pState->SetLongKey(); + + if (m_pState->CurGroupLongKey()) + BlockMapPrepareLongKey(child); + else + BlockMapPrepareSimpleKey(child); + } else { + if (m_pState->CurGroupLongKey()) + BlockMapPrepareLongKeyValue(child); + else + BlockMapPrepareSimpleKeyValue(child); + } +} + +void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) { + const std::size_t curIndent = m_pState->CurIndent(); + const std::size_t childCount = m_pState->CurGroupChildCount(); + + if (child == EmitterNodeType::NoType) + return; + + if (!m_pState->HasBegunContent()) { + if (childCount > 0) { + m_stream << "\n"; + } + if (m_stream.comment()) { + m_stream << "\n"; + } + m_stream << IndentTo(curIndent); + m_stream << "?"; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo(true, curIndent + 1); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + break; + } +} + +void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) { + const std::size_t curIndent = m_pState->CurIndent(); + + if (child == EmitterNodeType::NoType) + return; + + if (!m_pState->HasBegunContent()) { + m_stream << "\n"; + m_stream << IndentTo(curIndent); + m_stream << ":"; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + SpaceOrIndentTo(true, curIndent + 1); + break; + } +} + +void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) { + const std::size_t curIndent = m_pState->CurIndent(); + const std::size_t childCount = m_pState->CurGroupChildCount(); + + if (child == EmitterNodeType::NoType) + return; + + if (!m_pState->HasBegunNode()) { + if (childCount > 0) { + m_stream << "\n"; + } + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo(m_pState->HasBegunContent(), curIndent); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + break; + } +} + +void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) { + const std::size_t curIndent = m_pState->CurIndent(); + const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent(); + + if (!m_pState->HasBegunNode()) { + m_stream << ":"; + } + + switch (child) { + case EmitterNodeType::NoType: + break; + case EmitterNodeType::Property: + case EmitterNodeType::Scalar: + case EmitterNodeType::FlowSeq: + case EmitterNodeType::FlowMap: + SpaceOrIndentTo(true, nextIndent); + break; + case EmitterNodeType::BlockSeq: + case EmitterNodeType::BlockMap: + m_stream << "\n"; + break; + } +} + +// SpaceOrIndentTo +// . Prepares for some more content by proper spacing +void Emitter::SpaceOrIndentTo(bool requireSpace, std::size_t indent) { + if (m_stream.comment()) + m_stream << "\n"; + if (m_stream.col() > 0 && requireSpace) + m_stream << " "; + m_stream << IndentTo(indent); +} + +void Emitter::PrepareIntegralStream(std::stringstream& stream) const { + + switch (m_pState->GetIntFormat()) { + case Dec: + stream << std::dec; + break; + case Hex: + stream << "0x"; + stream << std::hex; + break; + case Oct: + stream << "0"; + stream << std::oct; + break; + default: + assert(false); + } +} + +void Emitter::StartedScalar() { m_pState->StartedScalar(); } + +// ******************************************************************************************* +// overloads of Write + +Emitter& Emitter::Write(const std::string& str) { + if (!good()) + return *this; + + const bool escapeNonAscii = m_pState->GetOutputCharset() == EscapeNonAscii; + const StringFormat::value strFormat = + Utils::ComputeStringFormat(str, m_pState->GetStringFormat(), + m_pState->CurGroupFlowType(), escapeNonAscii); + + if (strFormat == StringFormat::Literal) + m_pState->SetMapKeyFormat(YAML::LongKey, FmtScope::Local); + + PrepareNode(EmitterNodeType::Scalar); + + switch (strFormat) { + case StringFormat::Plain: + m_stream << str; + break; + case StringFormat::SingleQuoted: + Utils::WriteSingleQuotedString(m_stream, str); + break; + case StringFormat::DoubleQuoted: + Utils::WriteDoubleQuotedString(m_stream, str, escapeNonAscii); + break; + case StringFormat::Literal: + Utils::WriteLiteralString(m_stream, str, + m_pState->CurIndent() + m_pState->GetIndent()); + break; + } + + StartedScalar(); + + return *this; +} + +std::size_t Emitter::GetFloatPrecision() const { + return m_pState->GetFloatPrecision(); +} + +std::size_t Emitter::GetDoublePrecision() const { + return m_pState->GetDoublePrecision(); +} + +const char* Emitter::ComputeFullBoolName(bool b) const { + const EMITTER_MANIP mainFmt = (m_pState->GetBoolLengthFormat() == ShortBool + ? YesNoBool + : m_pState->GetBoolFormat()); + const EMITTER_MANIP caseFmt = m_pState->GetBoolCaseFormat(); + switch (mainFmt) { + case YesNoBool: + switch (caseFmt) { + case UpperCase: + return b ? "YES" : "NO"; + case CamelCase: + return b ? "Yes" : "No"; + case LowerCase: + return b ? "yes" : "no"; + default: + break; + } + break; + case OnOffBool: + switch (caseFmt) { + case UpperCase: + return b ? "ON" : "OFF"; + case CamelCase: + return b ? "On" : "Off"; + case LowerCase: + return b ? "on" : "off"; + default: + break; + } + break; + case TrueFalseBool: + switch (caseFmt) { + case UpperCase: + return b ? "TRUE" : "FALSE"; + case CamelCase: + return b ? "True" : "False"; + case LowerCase: + return b ? "true" : "false"; + default: + break; + } + break; + default: + break; + } + return b ? "y" : "n"; // should never get here, but it can't hurt to give + // these answers +} + +Emitter& Emitter::Write(bool b) { + if (!good()) + return *this; + + PrepareNode(EmitterNodeType::Scalar); + + const char* name = ComputeFullBoolName(b); + if (m_pState->GetBoolLengthFormat() == ShortBool) + m_stream << name[0]; + else + m_stream << name; + + StartedScalar(); + + return *this; +} + +Emitter& Emitter::Write(char ch) { + if (!good()) + return *this; + + PrepareNode(EmitterNodeType::Scalar); + Utils::WriteChar(m_stream, ch); + StartedScalar(); + + return *this; +} + +Emitter& Emitter::Write(const _Alias& alias) { + if (!good()) + return *this; + + if (m_pState->HasAnchor() || m_pState->HasTag()) { + m_pState->SetError(ErrorMsg::INVALID_ALIAS); + return *this; + } + + PrepareNode(EmitterNodeType::Scalar); + + if (!Utils::WriteAlias(m_stream, alias.content)) { + m_pState->SetError(ErrorMsg::INVALID_ALIAS); + return *this; + } + + StartedScalar(); + + return *this; +} + +Emitter& Emitter::Write(const _Anchor& anchor) { + if (!good()) + return *this; + + if (m_pState->HasAnchor()) { + m_pState->SetError(ErrorMsg::INVALID_ANCHOR); + return *this; + } + + PrepareNode(EmitterNodeType::Property); + + if (!Utils::WriteAnchor(m_stream, anchor.content)) { + m_pState->SetError(ErrorMsg::INVALID_ANCHOR); + return *this; + } + + m_pState->SetAnchor(); + + return *this; +} + +Emitter& Emitter::Write(const _Tag& tag) { + if (!good()) + return *this; + + if (m_pState->HasTag()) { + m_pState->SetError(ErrorMsg::INVALID_TAG); + return *this; + } + + PrepareNode(EmitterNodeType::Property); + + bool success = false; + if (tag.type == _Tag::Type::Verbatim) + success = Utils::WriteTag(m_stream, tag.content, true); + else if (tag.type == _Tag::Type::PrimaryHandle) + success = Utils::WriteTag(m_stream, tag.content, false); + else + success = Utils::WriteTagWithPrefix(m_stream, tag.prefix, tag.content); + + if (!success) { + m_pState->SetError(ErrorMsg::INVALID_TAG); + return *this; + } + + m_pState->SetTag(); + + return *this; +} + +void Emitter::EmitKindTag() { Write(LocalTag("")); } + +Emitter& Emitter::Write(const _Comment& comment) { + if (!good()) + return *this; + + PrepareNode(EmitterNodeType::NoType); + + if (m_stream.col() > 0) + m_stream << Indentation(m_pState->GetPreCommentIndent()); + Utils::WriteComment(m_stream, comment.content, + m_pState->GetPostCommentIndent()); + + m_pState->SetNonContent(); + + return *this; +} + +Emitter& Emitter::Write(const _Null& /*null*/) { + if (!good()) + return *this; + + PrepareNode(EmitterNodeType::Scalar); + + m_stream << "~"; + + StartedScalar(); + + return *this; +} + +Emitter& Emitter::Write(const Binary& binary) { + Write(SecondaryTag("binary")); + + if (!good()) + return *this; + + PrepareNode(EmitterNodeType::Scalar); + Utils::WriteBinary(m_stream, binary); + StartedScalar(); + + return *this; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/emitterstate.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterstate.cpp new file mode 100644 index 0000000..3542aaf --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterstate.cpp @@ -0,0 +1,365 @@ +#include + +#include "emitterstate.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep + +namespace YAML { +EmitterState::EmitterState() + : m_isGood(true), + m_curIndent(0), + m_hasAnchor(false), + m_hasTag(false), + m_hasNonContent(false), + m_docCount(0) { + // set default global manipulators + m_charset.set(EmitNonAscii); + m_strFmt.set(Auto); + m_boolFmt.set(TrueFalseBool); + m_boolLengthFmt.set(LongBool); + m_boolCaseFmt.set(LowerCase); + m_intFmt.set(Dec); + m_indent.set(2); + m_preCommentIndent.set(2); + m_postCommentIndent.set(1); + m_seqFmt.set(Block); + m_mapFmt.set(Block); + m_mapKeyFmt.set(Auto); + m_floatPrecision.set(std::numeric_limits::digits10 + 1); + m_doublePrecision.set(std::numeric_limits::digits10 + 1); +} + +EmitterState::~EmitterState() {} + +// SetLocalValue +// . We blindly tries to set all possible formatters to this value +// . Only the ones that make sense will be accepted +void EmitterState::SetLocalValue(EMITTER_MANIP value) { + SetOutputCharset(value, FmtScope::Local); + SetStringFormat(value, FmtScope::Local); + SetBoolFormat(value, FmtScope::Local); + SetBoolCaseFormat(value, FmtScope::Local); + SetBoolLengthFormat(value, FmtScope::Local); + SetIntFormat(value, FmtScope::Local); + SetFlowType(GroupType::Seq, value, FmtScope::Local); + SetFlowType(GroupType::Map, value, FmtScope::Local); + SetMapKeyFormat(value, FmtScope::Local); +} + +void EmitterState::SetAnchor() { m_hasAnchor = true; } + +void EmitterState::SetTag() { m_hasTag = true; } + +void EmitterState::SetNonContent() { m_hasNonContent = true; } + +void EmitterState::SetLongKey() { + assert(!m_groups.empty()); + if (m_groups.empty()) { + return; + } + + assert(m_groups.back()->type == GroupType::Map); + m_groups.back()->longKey = true; +} + +void EmitterState::ForceFlow() { + assert(!m_groups.empty()); + if (m_groups.empty()) { + return; + } + + m_groups.back()->flowType = FlowType::Flow; +} + +void EmitterState::StartedNode() { + if (m_groups.empty()) { + m_docCount++; + } else { + m_groups.back()->childCount++; + if (m_groups.back()->childCount % 2 == 0) { + m_groups.back()->longKey = false; + } + } + + m_hasAnchor = false; + m_hasTag = false; + m_hasNonContent = false; +} + +EmitterNodeType::value EmitterState::NextGroupType( + GroupType::value type) const { + if (type == GroupType::Seq) { + if (GetFlowType(type) == Block) + return EmitterNodeType::BlockSeq; + else + return EmitterNodeType::FlowSeq; + } else { + if (GetFlowType(type) == Block) + return EmitterNodeType::BlockMap; + else + return EmitterNodeType::FlowMap; + } + + // can't happen + assert(false); + return EmitterNodeType::NoType; +} + +void EmitterState::StartedDoc() { + m_hasAnchor = false; + m_hasTag = false; + m_hasNonContent = false; +} + +void EmitterState::EndedDoc() { + m_hasAnchor = false; + m_hasTag = false; + m_hasNonContent = false; +} + +void EmitterState::StartedScalar() { + StartedNode(); + ClearModifiedSettings(); +} + +void EmitterState::StartedGroup(GroupType::value type) { + StartedNode(); + + const std::size_t lastGroupIndent = + (m_groups.empty() ? 0 : m_groups.back()->indent); + m_curIndent += lastGroupIndent; + + // TODO: Create move constructors for settings types to simplify transfer + std::unique_ptr pGroup(new Group(type)); + + // transfer settings (which last until this group is done) + // + // NB: if pGroup->modifiedSettings == m_modifiedSettings, + // m_modifiedSettings is not changed! + pGroup->modifiedSettings = std::move(m_modifiedSettings); + + // set up group + if (GetFlowType(type) == Block) { + pGroup->flowType = FlowType::Block; + } else { + pGroup->flowType = FlowType::Flow; + } + pGroup->indent = GetIndent(); + + m_groups.push_back(std::move(pGroup)); +} + +void EmitterState::EndedGroup(GroupType::value type) { + if (m_groups.empty()) { + if (type == GroupType::Seq) { + return SetError(ErrorMsg::UNEXPECTED_END_SEQ); + } else { + return SetError(ErrorMsg::UNEXPECTED_END_MAP); + } + } + + // get rid of the current group + { + std::unique_ptr pFinishedGroup = std::move(m_groups.back()); + m_groups.pop_back(); + if (pFinishedGroup->type != type) { + return SetError(ErrorMsg::UNMATCHED_GROUP_TAG); + } + } + + // reset old settings + std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent); + assert(m_curIndent >= lastIndent); + m_curIndent -= lastIndent; + + // some global settings that we changed may have been overridden + // by a local setting we just popped, so we need to restore them + m_globalModifiedSettings.restore(); + + ClearModifiedSettings(); +} + +EmitterNodeType::value EmitterState::CurGroupNodeType() const { + if (m_groups.empty()) { + return EmitterNodeType::NoType; + } + + return m_groups.back()->NodeType(); +} + +GroupType::value EmitterState::CurGroupType() const { + return m_groups.empty() ? GroupType::NoType : m_groups.back()->type; +} + +FlowType::value EmitterState::CurGroupFlowType() const { + return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType; +} + +std::size_t EmitterState::CurGroupIndent() const { + return m_groups.empty() ? 0 : m_groups.back()->indent; +} + +std::size_t EmitterState::CurGroupChildCount() const { + return m_groups.empty() ? m_docCount : m_groups.back()->childCount; +} + +bool EmitterState::CurGroupLongKey() const { + return m_groups.empty() ? false : m_groups.back()->longKey; +} + +std::size_t EmitterState::LastIndent() const { + if (m_groups.size() <= 1) { + return 0; + } + + return m_curIndent - m_groups[m_groups.size() - 2]->indent; +} + +void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); } + +bool EmitterState::SetOutputCharset(EMITTER_MANIP value, + FmtScope::value scope) { + switch (value) { + case EmitNonAscii: + case EscapeNonAscii: + _Set(m_charset, value, scope); + return true; + default: + return false; + } +} + +bool EmitterState::SetStringFormat(EMITTER_MANIP value, FmtScope::value scope) { + switch (value) { + case Auto: + case SingleQuoted: + case DoubleQuoted: + case Literal: + _Set(m_strFmt, value, scope); + return true; + default: + return false; + } +} + +bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope) { + switch (value) { + case OnOffBool: + case TrueFalseBool: + case YesNoBool: + _Set(m_boolFmt, value, scope); + return true; + default: + return false; + } +} + +bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value, + FmtScope::value scope) { + switch (value) { + case LongBool: + case ShortBool: + _Set(m_boolLengthFmt, value, scope); + return true; + default: + return false; + } +} + +bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value, + FmtScope::value scope) { + switch (value) { + case UpperCase: + case LowerCase: + case CamelCase: + _Set(m_boolCaseFmt, value, scope); + return true; + default: + return false; + } +} + +bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) { + switch (value) { + case Dec: + case Hex: + case Oct: + _Set(m_intFmt, value, scope); + return true; + default: + return false; + } +} + +bool EmitterState::SetIndent(std::size_t value, FmtScope::value scope) { + if (value <= 1) + return false; + + _Set(m_indent, value, scope); + return true; +} + +bool EmitterState::SetPreCommentIndent(std::size_t value, + FmtScope::value scope) { + if (value == 0) + return false; + + _Set(m_preCommentIndent, value, scope); + return true; +} + +bool EmitterState::SetPostCommentIndent(std::size_t value, + FmtScope::value scope) { + if (value == 0) + return false; + + _Set(m_postCommentIndent, value, scope); + return true; +} + +bool EmitterState::SetFlowType(GroupType::value groupType, EMITTER_MANIP value, + FmtScope::value scope) { + switch (value) { + case Block: + case Flow: + _Set(groupType == GroupType::Seq ? m_seqFmt : m_mapFmt, value, scope); + return true; + default: + return false; + } +} + +EMITTER_MANIP EmitterState::GetFlowType(GroupType::value groupType) const { + // force flow style if we're currently in a flow + if (CurGroupFlowType() == FlowType::Flow) + return Flow; + + // otherwise, go with what's asked of us + return (groupType == GroupType::Seq ? m_seqFmt.get() : m_mapFmt.get()); +} + +bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) { + switch (value) { + case Auto: + case LongKey: + _Set(m_mapKeyFmt, value, scope); + return true; + default: + return false; + } +} + +bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) { + if (value > std::numeric_limits::digits10 + 1) + return false; + _Set(m_floatPrecision, value, scope); + return true; +} + +bool EmitterState::SetDoublePrecision(std::size_t value, + FmtScope::value scope) { + if (value > std::numeric_limits::digits10 + 1) + return false; + _Set(m_doublePrecision, value, scope); + return true; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/emitterstate.h b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterstate.h new file mode 100644 index 0000000..0937f00 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterstate.h @@ -0,0 +1,203 @@ +#ifndef EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "setting.h" +#include "yaml-cpp/emitterdef.h" +#include "yaml-cpp/emittermanip.h" + +#include +#include +#include +#include +#include + +namespace YAML { +struct FmtScope { + enum value { Local, Global }; +}; +struct GroupType { + enum value { NoType, Seq, Map }; +}; +struct FlowType { + enum value { NoType, Flow, Block }; +}; + +class EmitterState { + public: + EmitterState(); + ~EmitterState(); + + // basic state checking + bool good() const { return m_isGood; } + const std::string GetLastError() const { return m_lastError; } + void SetError(const std::string& error) { + m_isGood = false; + m_lastError = error; + } + + // node handling + void SetAnchor(); + void SetTag(); + void SetNonContent(); + void SetLongKey(); + void ForceFlow(); + void StartedDoc(); + void EndedDoc(); + void StartedScalar(); + void StartedGroup(GroupType::value type); + void EndedGroup(GroupType::value type); + + EmitterNodeType::value NextGroupType(GroupType::value type) const; + EmitterNodeType::value CurGroupNodeType() const; + + GroupType::value CurGroupType() const; + FlowType::value CurGroupFlowType() const; + std::size_t CurGroupIndent() const; + std::size_t CurGroupChildCount() const; + bool CurGroupLongKey() const; + + std::size_t LastIndent() const; + std::size_t CurIndent() const { return m_curIndent; } + bool HasAnchor() const { return m_hasAnchor; } + bool HasTag() const { return m_hasTag; } + bool HasBegunNode() const { + return m_hasAnchor || m_hasTag || m_hasNonContent; + } + bool HasBegunContent() const { return m_hasAnchor || m_hasTag; } + + void ClearModifiedSettings(); + + // formatters + void SetLocalValue(EMITTER_MANIP value); + + bool SetOutputCharset(EMITTER_MANIP value, FmtScope::value scope); + EMITTER_MANIP GetOutputCharset() const { return m_charset.get(); } + + bool SetStringFormat(EMITTER_MANIP value, FmtScope::value scope); + EMITTER_MANIP GetStringFormat() const { return m_strFmt.get(); } + + bool SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope); + EMITTER_MANIP GetBoolFormat() const { return m_boolFmt.get(); } + + bool SetBoolLengthFormat(EMITTER_MANIP value, FmtScope::value scope); + EMITTER_MANIP GetBoolLengthFormat() const { return m_boolLengthFmt.get(); } + + bool SetBoolCaseFormat(EMITTER_MANIP value, FmtScope::value scope); + EMITTER_MANIP GetBoolCaseFormat() const { return m_boolCaseFmt.get(); } + + bool SetIntFormat(EMITTER_MANIP value, FmtScope::value scope); + EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); } + + bool SetIndent(std::size_t value, FmtScope::value scope); + std::size_t GetIndent() const { return m_indent.get(); } + + bool SetPreCommentIndent(std::size_t value, FmtScope::value scope); + std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); } + bool SetPostCommentIndent(std::size_t value, FmtScope::value scope); + std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); } + + bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value, + FmtScope::value scope); + EMITTER_MANIP GetFlowType(GroupType::value groupType) const; + + bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope); + EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); } + + bool SetFloatPrecision(std::size_t value, FmtScope::value scope); + std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); } + bool SetDoublePrecision(std::size_t value, FmtScope::value scope); + std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); } + + private: + template + void _Set(Setting& fmt, T value, FmtScope::value scope); + + void StartedNode(); + + private: + // basic state ok? + bool m_isGood; + std::string m_lastError; + + // other state + Setting m_charset; + Setting m_strFmt; + Setting m_boolFmt; + Setting m_boolLengthFmt; + Setting m_boolCaseFmt; + Setting m_intFmt; + Setting m_indent; + Setting m_preCommentIndent, m_postCommentIndent; + Setting m_seqFmt; + Setting m_mapFmt; + Setting m_mapKeyFmt; + Setting m_floatPrecision; + Setting m_doublePrecision; + + SettingChanges m_modifiedSettings; + SettingChanges m_globalModifiedSettings; + + struct Group { + explicit Group(GroupType::value type_) + : type(type_), indent(0), childCount(0), longKey(false) {} + + GroupType::value type; + FlowType::value flowType; + std::size_t indent; + std::size_t childCount; + bool longKey; + + SettingChanges modifiedSettings; + + EmitterNodeType::value NodeType() const { + if (type == GroupType::Seq) { + if (flowType == FlowType::Flow) + return EmitterNodeType::FlowSeq; + else + return EmitterNodeType::BlockSeq; + } else { + if (flowType == FlowType::Flow) + return EmitterNodeType::FlowMap; + else + return EmitterNodeType::BlockMap; + } + + // can't get here + assert(false); + return EmitterNodeType::NoType; + } + }; + + std::vector> m_groups; + std::size_t m_curIndent; + bool m_hasAnchor; + bool m_hasTag; + bool m_hasNonContent; + std::size_t m_docCount; +}; + +template +void EmitterState::_Set(Setting& fmt, T value, FmtScope::value scope) { + switch (scope) { + case FmtScope::Local: + m_modifiedSettings.push(fmt.set(value)); + break; + case FmtScope::Global: + fmt.set(value); + m_globalModifiedSettings.push( + fmt.set(value)); // this pushes an identity set, so when we restore, + // it restores to the value here, and not the previous one + break; + default: + assert(false); + } +} +} + +#endif // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/emitterutils.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterutils.cpp new file mode 100644 index 0000000..147738a --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterutils.cpp @@ -0,0 +1,483 @@ +#include +#include + +#include "emitterutils.h" +#include "exp.h" +#include "indentation.h" +#include "regex_yaml.h" +#include "regeximpl.h" +#include "stringsource.h" +#include "yaml-cpp/binary.h" // IWYU pragma: keep +#include "yaml-cpp/ostream_wrapper.h" +#include "yaml-cpp/null.h" + +namespace YAML { +namespace Utils { +namespace { +enum { REPLACEMENT_CHARACTER = 0xFFFD }; + +bool IsAnchorChar(int ch) { // test for ns-anchor-char + switch (ch) { + case ',': + case '[': + case ']': + case '{': + case '}': // c-flow-indicator + case ' ': + case '\t': // s-white + case 0xFEFF: // c-byte-order-mark + case 0xA: + case 0xD: // b-char + return false; + case 0x85: + return true; + } + + if (ch < 0x20) { + return false; + } + + if (ch < 0x7E) { + return true; + } + + if (ch < 0xA0) { + return false; + } + if (ch >= 0xD800 && ch <= 0xDFFF) { + return false; + } + if ((ch & 0xFFFE) == 0xFFFE) { + return false; + } + if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) { + return false; + } + if (ch > 0x10FFFF) { + return false; + } + + return true; +} + +int Utf8BytesIndicated(char ch) { + int byteVal = static_cast(ch); + switch (byteVal >> 4) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return 1; + case 12: + case 13: + return 2; + case 14: + return 3; + case 15: + return 4; + default: + return -1; + } +} + +bool IsTrailingByte(char ch) { return (ch & 0xC0) == 0x80; } + +bool GetNextCodePointAndAdvance(int& codePoint, + std::string::const_iterator& first, + std::string::const_iterator last) { + if (first == last) + return false; + + int nBytes = Utf8BytesIndicated(*first); + if (nBytes < 1) { + // Bad lead byte + ++first; + codePoint = REPLACEMENT_CHARACTER; + return true; + } + + if (nBytes == 1) { + codePoint = *first++; + return true; + } + + // Gather bits from trailing bytes + codePoint = static_cast(*first) & ~(0xFF << (7 - nBytes)); + ++first; + --nBytes; + for (; nBytes > 0; ++first, --nBytes) { + if ((first == last) || !IsTrailingByte(*first)) { + codePoint = REPLACEMENT_CHARACTER; + break; + } + codePoint <<= 6; + codePoint |= *first & 0x3F; + } + + // Check for illegal code points + if (codePoint > 0x10FFFF) + codePoint = REPLACEMENT_CHARACTER; + else if (codePoint >= 0xD800 && codePoint <= 0xDFFF) + codePoint = REPLACEMENT_CHARACTER; + else if ((codePoint & 0xFFFE) == 0xFFFE) + codePoint = REPLACEMENT_CHARACTER; + else if (codePoint >= 0xFDD0 && codePoint <= 0xFDEF) + codePoint = REPLACEMENT_CHARACTER; + return true; +} + +void WriteCodePoint(ostream_wrapper& out, int codePoint) { + if (codePoint < 0 || codePoint > 0x10FFFF) { + codePoint = REPLACEMENT_CHARACTER; + } + if (codePoint < 0x7F) { + out << static_cast(codePoint); + } else if (codePoint < 0x7FF) { + out << static_cast(0xC0 | (codePoint >> 6)) + << static_cast(0x80 | (codePoint & 0x3F)); + } else if (codePoint < 0xFFFF) { + out << static_cast(0xE0 | (codePoint >> 12)) + << static_cast(0x80 | ((codePoint >> 6) & 0x3F)) + << static_cast(0x80 | (codePoint & 0x3F)); + } else { + out << static_cast(0xF0 | (codePoint >> 18)) + << static_cast(0x80 | ((codePoint >> 12) & 0x3F)) + << static_cast(0x80 | ((codePoint >> 6) & 0x3F)) + << static_cast(0x80 | (codePoint & 0x3F)); + } +} + +bool IsValidPlainScalar(const std::string& str, FlowType::value flowType, + bool allowOnlyAscii) { + // check against null + if (IsNullString(str)) { + return false; + } + + // check the start + const RegEx& start = (flowType == FlowType::Flow ? Exp::PlainScalarInFlow() + : Exp::PlainScalar()); + if (!start.Matches(str)) { + return false; + } + + // and check the end for plain whitespace (which can't be faithfully kept in a + // plain scalar) + if (!str.empty() && *str.rbegin() == ' ') { + return false; + } + + // then check until something is disallowed + static const RegEx& disallowed_flow = + Exp::EndScalarInFlow() || (Exp::BlankOrBreak() + Exp::Comment()) || + Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() || + Exp::Tab(); + static const RegEx& disallowed_block = + Exp::EndScalar() || (Exp::BlankOrBreak() + Exp::Comment()) || + Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() || + Exp::Tab(); + const RegEx& disallowed = + flowType == FlowType::Flow ? disallowed_flow : disallowed_block; + + StringCharSource buffer(str.c_str(), str.size()); + while (buffer) { + if (disallowed.Matches(buffer)) { + return false; + } + if (allowOnlyAscii && (0x80 <= static_cast(buffer[0]))) { + return false; + } + ++buffer; + } + + return true; +} + +bool IsValidSingleQuotedScalar(const std::string& str, bool escapeNonAscii) { + // TODO: check for non-printable characters? + for (std::size_t i = 0; i < str.size(); i++) { + if (escapeNonAscii && (0x80 <= static_cast(str[i]))) { + return false; + } + if (str[i] == '\n') { + return false; + } + } + return true; +} + +bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType, + bool escapeNonAscii) { + if (flowType == FlowType::Flow) { + return false; + } + + // TODO: check for non-printable characters? + for (std::size_t i = 0; i < str.size(); i++) { + if (escapeNonAscii && (0x80 <= static_cast(str[i]))) { + return false; + } + } + return true; +} + +void WriteDoubleQuoteEscapeSequence(ostream_wrapper& out, int codePoint) { + static const char hexDigits[] = "0123456789abcdef"; + + out << "\\"; + int digits = 8; + if (codePoint < 0xFF) { + out << "x"; + digits = 2; + } else if (codePoint < 0xFFFF) { + out << "u"; + digits = 4; + } else { + out << "U"; + digits = 8; + } + + // Write digits into the escape sequence + for (; digits > 0; --digits) + out << hexDigits[(codePoint >> (4 * (digits - 1))) & 0xF]; +} + +bool WriteAliasName(ostream_wrapper& out, const std::string& str) { + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (!IsAnchorChar(codePoint)) { + return false; + } + + WriteCodePoint(out, codePoint); + } + return true; +} +} + +StringFormat::value ComputeStringFormat(const std::string& str, + EMITTER_MANIP strFormat, + FlowType::value flowType, + bool escapeNonAscii) { + switch (strFormat) { + case Auto: + if (IsValidPlainScalar(str, flowType, escapeNonAscii)) { + return StringFormat::Plain; + } + return StringFormat::DoubleQuoted; + case SingleQuoted: + if (IsValidSingleQuotedScalar(str, escapeNonAscii)) { + return StringFormat::SingleQuoted; + } + return StringFormat::DoubleQuoted; + case DoubleQuoted: + return StringFormat::DoubleQuoted; + case Literal: + if (IsValidLiteralScalar(str, flowType, escapeNonAscii)) { + return StringFormat::Literal; + } + return StringFormat::DoubleQuoted; + default: + break; + } + + return StringFormat::DoubleQuoted; +} + +bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str) { + out << "'"; + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (codePoint == '\n') { + return false; // We can't handle a new line and the attendant indentation + // yet + } + + if (codePoint == '\'') { + out << "''"; + } else { + WriteCodePoint(out, codePoint); + } + } + out << "'"; + return true; +} + +bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str, + bool escapeNonAscii) { + out << "\""; + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + switch (codePoint) { + case '\"': + out << "\\\""; + break; + case '\\': + out << "\\\\"; + break; + case '\n': + out << "\\n"; + break; + case '\t': + out << "\\t"; + break; + case '\r': + out << "\\r"; + break; + case '\b': + out << "\\b"; + break; + default: + if (codePoint < 0x20 || + (codePoint >= 0x80 && + codePoint <= 0xA0)) { // Control characters and non-breaking space + WriteDoubleQuoteEscapeSequence(out, codePoint); + } else if (codePoint == 0xFEFF) { // Byte order marks (ZWNS) should be + // escaped (YAML 1.2, sec. 5.2) + WriteDoubleQuoteEscapeSequence(out, codePoint); + } else if (escapeNonAscii && codePoint > 0x7E) { + WriteDoubleQuoteEscapeSequence(out, codePoint); + } else { + WriteCodePoint(out, codePoint); + } + } + } + out << "\""; + return true; +} + +bool WriteLiteralString(ostream_wrapper& out, const std::string& str, + std::size_t indent) { + out << "|\n"; + out << IndentTo(indent); + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (codePoint == '\n') { + out << "\n" << IndentTo(indent); + } else { + WriteCodePoint(out, codePoint); + } + } + return true; +} + +bool WriteChar(ostream_wrapper& out, char ch) { + if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) { + out << ch; + } else if (ch == '\"') { + out << "\"\\\"\""; + } else if (ch == '\t') { + out << "\"\\t\""; + } else if (ch == '\n') { + out << "\"\\n\""; + } else if (ch == '\b') { + out << "\"\\b\""; + } else if (ch == '\\') { + out << "\"\\\\\""; + } else if ((0x20 <= ch && ch <= 0x7e) || ch == ' ') { + out << "\"" << ch << "\""; + } else { + out << "\""; + WriteDoubleQuoteEscapeSequence(out, ch); + out << "\""; + } + return true; +} + +bool WriteComment(ostream_wrapper& out, const std::string& str, + std::size_t postCommentIndent) { + const std::size_t curIndent = out.col(); + out << "#" << Indentation(postCommentIndent); + out.set_comment(); + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (codePoint == '\n') { + out << "\n" << IndentTo(curIndent) << "#" + << Indentation(postCommentIndent); + out.set_comment(); + } else { + WriteCodePoint(out, codePoint); + } + } + return true; +} + +bool WriteAlias(ostream_wrapper& out, const std::string& str) { + out << "*"; + return WriteAliasName(out, str); +} + +bool WriteAnchor(ostream_wrapper& out, const std::string& str) { + out << "&"; + return WriteAliasName(out, str); +} + +bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim) { + out << (verbatim ? "!<" : "!"); + StringCharSource buffer(str.c_str(), str.size()); + const RegEx& reValid = verbatim ? Exp::URI() : Exp::Tag(); + while (buffer) { + int n = reValid.Match(buffer); + if (n <= 0) { + return false; + } + + while (--n >= 0) { + out << buffer[0]; + ++buffer; + } + } + if (verbatim) { + out << ">"; + } + return true; +} + +bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix, + const std::string& tag) { + out << "!"; + StringCharSource prefixBuffer(prefix.c_str(), prefix.size()); + while (prefixBuffer) { + int n = Exp::URI().Match(prefixBuffer); + if (n <= 0) { + return false; + } + + while (--n >= 0) { + out << prefixBuffer[0]; + ++prefixBuffer; + } + } + + out << "!"; + StringCharSource tagBuffer(tag.c_str(), tag.size()); + while (tagBuffer) { + int n = Exp::Tag().Match(tagBuffer); + if (n <= 0) { + return false; + } + + while (--n >= 0) { + out << tagBuffer[0]; + ++tagBuffer; + } + } + return true; +} + +bool WriteBinary(ostream_wrapper& out, const Binary& binary) { + WriteDoubleQuotedString(out, EncodeBase64(binary.data(), binary.size()), + false); + return true; +} +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/emitterutils.h b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterutils.h new file mode 100644 index 0000000..6cc7319 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/emitterutils.h @@ -0,0 +1,50 @@ +#ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "emitterstate.h" +#include "yaml-cpp/emittermanip.h" +#include "yaml-cpp/ostream_wrapper.h" + +namespace YAML { +class ostream_wrapper; +} // namespace YAML + +namespace YAML { +class Binary; + +struct StringFormat { + enum value { Plain, SingleQuoted, DoubleQuoted, Literal }; +}; + +namespace Utils { +StringFormat::value ComputeStringFormat(const std::string& str, + EMITTER_MANIP strFormat, + FlowType::value flowType, + bool escapeNonAscii); + +bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str); +bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str, + bool escapeNonAscii); +bool WriteLiteralString(ostream_wrapper& out, const std::string& str, + std::size_t indent); +bool WriteChar(ostream_wrapper& out, char ch); +bool WriteComment(ostream_wrapper& out, const std::string& str, + std::size_t postCommentIndent); +bool WriteAlias(ostream_wrapper& out, const std::string& str); +bool WriteAnchor(ostream_wrapper& out, const std::string& str); +bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim); +bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix, + const std::string& tag); +bool WriteBinary(ostream_wrapper& out, const Binary& binary); +} +} + +#endif // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/exceptions.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/exceptions.cpp new file mode 100644 index 0000000..79ea77d --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/exceptions.cpp @@ -0,0 +1,31 @@ +#include "yaml-cpp/exceptions.h" + +// This is here for compatibility with older versions of Visual Studio +// which don't support noexcept +#ifdef _MSC_VER + #define YAML_CPP_NOEXCEPT noexcept +#else + #define YAML_CPP_NOEXCEPT noexcept +#endif + +namespace YAML { + +// These destructors are defined out-of-line so the vtable is only emitted once. +Exception::~Exception() YAML_CPP_NOEXCEPT {} +ParserException::~ParserException() YAML_CPP_NOEXCEPT {} +RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {} +InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {} +KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {} +InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {} +BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {} +BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {} +BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {} +BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {} +BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {} +EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {} +BadFile::~BadFile() YAML_CPP_NOEXCEPT {} +} + +#undef YAML_CPP_NOEXCEPT + + diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/exp.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/exp.cpp new file mode 100644 index 0000000..695440a --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/exp.cpp @@ -0,0 +1,136 @@ +#include + +#include "exp.h" +#include "stream.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep + +namespace YAML { +struct Mark; +} // namespace YAML + +namespace YAML { +namespace Exp { +unsigned ParseHex(const std::string& str, const Mark& mark) { + unsigned value = 0; + for (std::size_t i = 0; i < str.size(); i++) { + char ch = str[i]; + int digit = 0; + if ('a' <= ch && ch <= 'f') + digit = ch - 'a' + 10; + else if ('A' <= ch && ch <= 'F') + digit = ch - 'A' + 10; + else if ('0' <= ch && ch <= '9') + digit = ch - '0'; + else + throw ParserException(mark, ErrorMsg::INVALID_HEX); + + value = (value << 4) + digit; + } + + return value; +} + +std::string Str(unsigned ch) { return std::string(1, static_cast(ch)); } + +// Escape +// . Translates the next 'codeLength' characters into a hex number and returns +// the result. +// . Throws if it's not actually hex. +std::string Escape(Stream& in, int codeLength) { + // grab string + std::string str; + for (int i = 0; i < codeLength; i++) + str += in.get(); + + // get the value + unsigned value = ParseHex(str, in.mark()); + + // legal unicode? + if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) { + std::stringstream msg; + msg << ErrorMsg::INVALID_UNICODE << value; + throw ParserException(in.mark(), msg.str()); + } + + // now break it up into chars + if (value <= 0x7F) + return Str(value); + else if (value <= 0x7FF) + return Str(0xC0 + (value >> 6)) + Str(0x80 + (value & 0x3F)); + else if (value <= 0xFFFF) + return Str(0xE0 + (value >> 12)) + Str(0x80 + ((value >> 6) & 0x3F)) + + Str(0x80 + (value & 0x3F)); + else + return Str(0xF0 + (value >> 18)) + Str(0x80 + ((value >> 12) & 0x3F)) + + Str(0x80 + ((value >> 6) & 0x3F)) + Str(0x80 + (value & 0x3F)); +} + +// Escape +// . Escapes the sequence starting 'in' (it must begin with a '\' or single +// quote) +// and returns the result. +// . Throws if it's an unknown escape character. +std::string Escape(Stream& in) { + // eat slash + char escape = in.get(); + + // switch on escape character + char ch = in.get(); + + // first do single quote, since it's easier + if (escape == '\'' && ch == '\'') + return "\'"; + + // now do the slash (we're not gonna check if it's a slash - you better pass + // one!) + switch (ch) { + case '0': + return std::string(1, '\x00'); + case 'a': + return "\x07"; + case 'b': + return "\x08"; + case 't': + case '\t': + return "\x09"; + case 'n': + return "\x0A"; + case 'v': + return "\x0B"; + case 'f': + return "\x0C"; + case 'r': + return "\x0D"; + case 'e': + return "\x1B"; + case ' ': + return "\x20"; + case '\"': + return "\""; + case '\'': + return "\'"; + case '\\': + return "\\"; + case '/': + return "/"; + case 'N': + return "\x85"; + case '_': + return "\xA0"; + case 'L': + return "\xE2\x80\xA8"; // LS (#x2028) + case 'P': + return "\xE2\x80\xA9"; // PS (#x2029) + case 'x': + return Escape(in, 2); + case 'u': + return Escape(in, 4); + case 'U': + return Escape(in, 8); + } + + std::stringstream msg; + throw ParserException(in.mark(), std::string(ErrorMsg::INVALID_ESCAPE) + ch); +} +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/exp.h b/runtime/onnxruntime/third_party/yaml-cpp/src/exp.h new file mode 100644 index 0000000..7c02cf6 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/exp.h @@ -0,0 +1,222 @@ +#ifndef EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "regex_yaml.h" +#include "stream.h" + +namespace YAML { +//////////////////////////////////////////////////////////////////////////////// +// Here we store a bunch of expressions for matching different parts of the +// file. + +namespace Exp { +// misc +inline const RegEx& Empty() { + static const RegEx e; + return e; +} +inline const RegEx& Space() { + static const RegEx e = RegEx(' '); + return e; +} +inline const RegEx& Tab() { + static const RegEx e = RegEx('\t'); + return e; +} +inline const RegEx& Blank() { + static const RegEx e = Space() || Tab(); + return e; +} +inline const RegEx& Break() { + static const RegEx e = RegEx('\n') || RegEx("\r\n"); + return e; +} +inline const RegEx& BlankOrBreak() { + static const RegEx e = Blank() || Break(); + return e; +} +inline const RegEx& Digit() { + static const RegEx e = RegEx('0', '9'); + return e; +} +inline const RegEx& Alpha() { + static const RegEx e = RegEx('a', 'z') || RegEx('A', 'Z'); + return e; +} +inline const RegEx& AlphaNumeric() { + static const RegEx e = Alpha() || Digit(); + return e; +} +inline const RegEx& Word() { + static const RegEx e = AlphaNumeric() || RegEx('-'); + return e; +} +inline const RegEx& Hex() { + static const RegEx e = Digit() || RegEx('A', 'F') || RegEx('a', 'f'); + return e; +} +// Valid Unicode code points that are not part of c-printable (YAML 1.2, sec. +// 5.1) +inline const RegEx& NotPrintable() { + static const RegEx e = + RegEx(0) || + RegEx("\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x7F", REGEX_OR) || + RegEx(0x0E, 0x1F) || + (RegEx('\xC2') + (RegEx('\x80', '\x84') || RegEx('\x86', '\x9F'))); + return e; +} +inline const RegEx& Utf8_ByteOrderMark() { + static const RegEx e = RegEx("\xEF\xBB\xBF"); + return e; +} + +// actual tags + +inline const RegEx& DocStart() { + static const RegEx e = RegEx("---") + (BlankOrBreak() || RegEx()); + return e; +} +inline const RegEx& DocEnd() { + static const RegEx e = RegEx("...") + (BlankOrBreak() || RegEx()); + return e; +} +inline const RegEx& DocIndicator() { + static const RegEx e = DocStart() || DocEnd(); + return e; +} +inline const RegEx& BlockEntry() { + static const RegEx e = RegEx('-') + (BlankOrBreak() || RegEx()); + return e; +} +inline const RegEx& Key() { + static const RegEx e = RegEx('?') + BlankOrBreak(); + return e; +} +inline const RegEx& KeyInFlow() { + static const RegEx e = RegEx('?') + BlankOrBreak(); + return e; +} +inline const RegEx& Value() { + static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx()); + return e; +} +inline const RegEx& ValueInFlow() { + static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx(",}", REGEX_OR)); + return e; +} +inline const RegEx& ValueInJSONFlow() { + static const RegEx e = RegEx(':'); + return e; +} +inline const RegEx Comment() { + static const RegEx e = RegEx('#'); + return e; +} +inline const RegEx& Anchor() { + static const RegEx e = !(RegEx("[]{},", REGEX_OR) || BlankOrBreak()); + return e; +} +inline const RegEx& AnchorEnd() { + static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) || BlankOrBreak(); + return e; +} +inline const RegEx& URI() { + static const RegEx e = Word() || RegEx("#;/?:@&=+$,_.!~*'()[]", REGEX_OR) || + (RegEx('%') + Hex() + Hex()); + return e; +} +inline const RegEx& Tag() { + static const RegEx e = Word() || RegEx("#;/?:@&=+$_.~*'()", REGEX_OR) || + (RegEx('%') + Hex() + Hex()); + return e; +} + +// Plain scalar rules: +// . Cannot start with a blank. +// . Can never start with any of , [ ] { } # & * ! | > \' \" % @ ` +// . In the block context - ? : must be not be followed with a space. +// . In the flow context ? is illegal and : and - must not be followed with a +// space. +inline const RegEx& PlainScalar() { + static const RegEx e = + !(BlankOrBreak() || RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) || + (RegEx("-?:", REGEX_OR) + (BlankOrBreak() || RegEx()))); + return e; +} +inline const RegEx& PlainScalarInFlow() { + static const RegEx e = + !(BlankOrBreak() || RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) || + (RegEx("-:", REGEX_OR) + Blank())); + return e; +} +inline const RegEx& EndScalar() { + static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx()); + return e; +} +inline const RegEx& EndScalarInFlow() { + static const RegEx e = + (RegEx(':') + (BlankOrBreak() || RegEx() || RegEx(",]}", REGEX_OR))) || + RegEx(",?[]{}", REGEX_OR); + return e; +} + +inline const RegEx& ScanScalarEndInFlow() { + static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment())); + return e; +} + +inline const RegEx& ScanScalarEnd() { + static const RegEx e = EndScalar() || (BlankOrBreak() + Comment()); + return e; +} +inline const RegEx& EscSingleQuote() { + static const RegEx e = RegEx("\'\'"); + return e; +} +inline const RegEx& EscBreak() { + static const RegEx e = RegEx('\\') + Break(); + return e; +} + +inline const RegEx& ChompIndicator() { + static const RegEx e = RegEx("+-", REGEX_OR); + return e; +} +inline const RegEx& Chomp() { + static const RegEx e = (ChompIndicator() + Digit()) || + (Digit() + ChompIndicator()) || ChompIndicator() || + Digit(); + return e; +} + +// and some functions +std::string Escape(Stream& in); +} // namespace Exp + +namespace Keys { +const char Directive = '%'; +const char FlowSeqStart = '['; +const char FlowSeqEnd = ']'; +const char FlowMapStart = '{'; +const char FlowMapEnd = '}'; +const char FlowEntry = ','; +const char Alias = '*'; +const char Anchor = '&'; +const char Tag = '!'; +const char LiteralScalar = '|'; +const char FoldedScalar = '>'; +const char VerbatimTagStart = '<'; +const char VerbatimTagEnd = '>'; +} // namespace Keys +} // namespace YAML + +#endif // EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/indentation.h b/runtime/onnxruntime/third_party/yaml-cpp/src/indentation.h new file mode 100644 index 0000000..1a2ccae --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/indentation.h @@ -0,0 +1,41 @@ +#ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "yaml-cpp/ostream_wrapper.h" + +namespace YAML { +struct Indentation { + Indentation(std::size_t n_) : n(n_) {} + std::size_t n; +}; + +inline ostream_wrapper& operator<<(ostream_wrapper& out, + const Indentation& indent) { + for (std::size_t i = 0; i < indent.n; i++) + out << ' '; + return out; +} + +struct IndentTo { + IndentTo(std::size_t n_) : n(n_) {} + std::size_t n; +}; + +inline ostream_wrapper& operator<<(ostream_wrapper& out, + const IndentTo& indent) { + while (out.col() < indent.n) + out << ' '; + return out; +} +} + +#endif // INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/memory.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/memory.cpp new file mode 100644 index 0000000..e5f8a9d --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/memory.cpp @@ -0,0 +1,26 @@ +#include "yaml-cpp/node/detail/memory.h" +#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep +#include "yaml-cpp/node/ptr.h" + +namespace YAML { +namespace detail { + +void memory_holder::merge(memory_holder& rhs) { + if (m_pMemory == rhs.m_pMemory) + return; + + m_pMemory->merge(*rhs.m_pMemory); + rhs.m_pMemory = m_pMemory; +} + +node& memory::create_node() { + shared_node pNode(new node); + m_nodes.insert(pNode); + return *pNode; +} + +void memory::merge(const memory& rhs) { + m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end()); +} +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/node.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/node.cpp new file mode 100644 index 0000000..2088e13 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/node.cpp @@ -0,0 +1,12 @@ +#include "yaml-cpp/node/node.h" +#include "nodebuilder.h" +#include "nodeevents.h" + +namespace YAML { +Node Clone(const Node& node) { + NodeEvents events(node); + NodeBuilder builder; + events.Emit(builder); + return builder.Root(); +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/node_data.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/node_data.cpp new file mode 100644 index 0000000..77cd465 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/node_data.cpp @@ -0,0 +1,300 @@ +#include +#include +#include + +#include "yaml-cpp/exceptions.h" +#include "yaml-cpp/node/detail/memory.h" +#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep +#include "yaml-cpp/node/detail/node_data.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +namespace detail { + +std::string node_data::empty_scalar; + +node_data::node_data() + : m_isDefined(false), + m_mark(Mark::null_mark()), + m_type(NodeType::Null), + m_style(EmitterStyle::Default), + m_seqSize(0) {} + +void node_data::mark_defined() { + if (m_type == NodeType::Undefined) + m_type = NodeType::Null; + m_isDefined = true; +} + +void node_data::set_mark(const Mark& mark) { m_mark = mark; } + +void node_data::set_type(NodeType::value type) { + if (type == NodeType::Undefined) { + m_type = type; + m_isDefined = false; + return; + } + + m_isDefined = true; + if (type == m_type) + return; + + m_type = type; + + switch (m_type) { + case NodeType::Null: + break; + case NodeType::Scalar: + m_scalar.clear(); + break; + case NodeType::Sequence: + reset_sequence(); + break; + case NodeType::Map: + reset_map(); + break; + case NodeType::Undefined: + assert(false); + break; + } +} + +void node_data::set_tag(const std::string& tag) { m_tag = tag; } + +void node_data::set_style(EmitterStyle::value style) { m_style = style; } + +void node_data::set_null() { + m_isDefined = true; + m_type = NodeType::Null; +} + +void node_data::set_scalar(const std::string& scalar) { + m_isDefined = true; + m_type = NodeType::Scalar; + m_scalar = scalar; +} + +// size/iterator +std::size_t node_data::size() const { + if (!m_isDefined) + return 0; + + switch (m_type) { + case NodeType::Sequence: + compute_seq_size(); + return m_seqSize; + case NodeType::Map: + compute_map_size(); + return m_map.size() - m_undefinedPairs.size(); + default: + return 0; + } + return 0; +} + +void node_data::compute_seq_size() const { + while (m_seqSize < m_sequence.size() && m_sequence[m_seqSize]->is_defined()) + m_seqSize++; +} + +void node_data::compute_map_size() const { + kv_pairs::iterator it = m_undefinedPairs.begin(); + while (it != m_undefinedPairs.end()) { + kv_pairs::iterator jt = std::next(it); + if (it->first->is_defined() && it->second->is_defined()) + m_undefinedPairs.erase(it); + it = jt; + } +} + +const_node_iterator node_data::begin() const { + if (!m_isDefined) + return const_node_iterator(); + + switch (m_type) { + case NodeType::Sequence: + return const_node_iterator(m_sequence.begin()); + case NodeType::Map: + return const_node_iterator(m_map.begin(), m_map.end()); + default: + return const_node_iterator(); + } +} + +node_iterator node_data::begin() { + if (!m_isDefined) + return node_iterator(); + + switch (m_type) { + case NodeType::Sequence: + return node_iterator(m_sequence.begin()); + case NodeType::Map: + return node_iterator(m_map.begin(), m_map.end()); + default: + return node_iterator(); + } +} + +const_node_iterator node_data::end() const { + if (!m_isDefined) + return const_node_iterator(); + + switch (m_type) { + case NodeType::Sequence: + return const_node_iterator(m_sequence.end()); + case NodeType::Map: + return const_node_iterator(m_map.end(), m_map.end()); + default: + return const_node_iterator(); + } +} + +node_iterator node_data::end() { + if (!m_isDefined) + return node_iterator(); + + switch (m_type) { + case NodeType::Sequence: + return node_iterator(m_sequence.end()); + case NodeType::Map: + return node_iterator(m_map.end(), m_map.end()); + default: + return node_iterator(); + } +} + +// sequence +void node_data::push_back(node& node, shared_memory_holder /* pMemory */) { + if (m_type == NodeType::Undefined || m_type == NodeType::Null) { + m_type = NodeType::Sequence; + reset_sequence(); + } + + if (m_type != NodeType::Sequence) + throw BadPushback(); + + m_sequence.push_back(&node); +} + +void node_data::insert(node& key, node& value, shared_memory_holder pMemory) { + switch (m_type) { + case NodeType::Map: + break; + case NodeType::Undefined: + case NodeType::Null: + case NodeType::Sequence: + convert_to_map(pMemory); + break; + case NodeType::Scalar: + throw BadSubscript(); + } + + insert_map_pair(key, value); +} + +// indexing +node* node_data::get(node& key, shared_memory_holder /* pMemory */) const { + if (m_type != NodeType::Map) { + return NULL; + } + + for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) { + if (it->first->is(key)) + return it->second; + } + + return NULL; +} + +node& node_data::get(node& key, shared_memory_holder pMemory) { + switch (m_type) { + case NodeType::Map: + break; + case NodeType::Undefined: + case NodeType::Null: + case NodeType::Sequence: + convert_to_map(pMemory); + break; + case NodeType::Scalar: + throw BadSubscript(); + } + + for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) { + if (it->first->is(key)) + return *it->second; + } + + node& value = pMemory->create_node(); + insert_map_pair(key, value); + return value; +} + +bool node_data::remove(node& key, shared_memory_holder /* pMemory */) { + if (m_type != NodeType::Map) + return false; + + for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) { + if (it->first->is(key)) { + m_map.erase(it); + return true; + } + } + + return false; +} + +void node_data::reset_sequence() { + m_sequence.clear(); + m_seqSize = 0; +} + +void node_data::reset_map() { + m_map.clear(); + m_undefinedPairs.clear(); +} + +void node_data::insert_map_pair(node& key, node& value) { + m_map.emplace_back(&key, &value); + + if (!key.is_defined() || !value.is_defined()) + m_undefinedPairs.emplace_back(&key, &value); +} + +void node_data::convert_to_map(shared_memory_holder pMemory) { + switch (m_type) { + case NodeType::Undefined: + case NodeType::Null: + reset_map(); + m_type = NodeType::Map; + break; + case NodeType::Sequence: + convert_sequence_to_map(pMemory); + break; + case NodeType::Map: + break; + case NodeType::Scalar: + assert(false); + break; + } +} + +void node_data::convert_sequence_to_map(shared_memory_holder pMemory) { + assert(m_type == NodeType::Sequence); + + reset_map(); + for (std::size_t i = 0; i < m_sequence.size(); i++) { + std::stringstream stream; + stream << i; + + node& key = pMemory->create_node(); + key.set_scalar(stream.str()); + insert_map_pair(key, *m_sequence[i]); + } + + reset_sequence(); + m_type = NodeType::Map; +} +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/nodebuilder.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/nodebuilder.cpp new file mode 100644 index 0000000..093d2ef --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/nodebuilder.cpp @@ -0,0 +1,130 @@ +#include +#include + +#include "nodebuilder.h" +#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/node/impl.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +struct Mark; + +NodeBuilder::NodeBuilder() + : m_pMemory(new detail::memory_holder), m_pRoot(0), m_mapDepth(0) { + m_anchors.push_back(0); // since the anchors start at 1 +} + +NodeBuilder::~NodeBuilder() {} + +Node NodeBuilder::Root() { + if (!m_pRoot) + return Node(); + + return Node(*m_pRoot, m_pMemory); +} + +void NodeBuilder::OnDocumentStart(const Mark&) {} + +void NodeBuilder::OnDocumentEnd() {} + +void NodeBuilder::OnNull(const Mark& mark, anchor_t anchor) { + detail::node& node = Push(mark, anchor); + node.set_null(); + Pop(); +} + +void NodeBuilder::OnAlias(const Mark& /* mark */, anchor_t anchor) { + detail::node& node = *m_anchors[anchor]; + Push(node); + Pop(); +} + +void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag, + anchor_t anchor, const std::string& value) { + detail::node& node = Push(mark, anchor); + node.set_scalar(value); + node.set_tag(tag); + Pop(); +} + +void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) { + detail::node& node = Push(mark, anchor); + node.set_tag(tag); + node.set_type(NodeType::Sequence); + node.set_style(style); +} + +void NodeBuilder::OnSequenceEnd() { Pop(); } + +void NodeBuilder::OnMapStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) { + detail::node& node = Push(mark, anchor); + node.set_type(NodeType::Map); + node.set_tag(tag); + node.set_style(style); + m_mapDepth++; +} + +void NodeBuilder::OnMapEnd() { + assert(m_mapDepth > 0); + m_mapDepth--; + Pop(); +} + +detail::node& NodeBuilder::Push(const Mark& mark, anchor_t anchor) { + detail::node& node = m_pMemory->create_node(); + node.set_mark(mark); + RegisterAnchor(anchor, node); + Push(node); + return node; +} + +void NodeBuilder::Push(detail::node& node) { + const bool needsKey = + (!m_stack.empty() && m_stack.back()->type() == NodeType::Map && + m_keys.size() < m_mapDepth); + + m_stack.push_back(&node); + if (needsKey) + m_keys.push_back(PushedKey(&node, false)); +} + +void NodeBuilder::Pop() { + assert(!m_stack.empty()); + if (m_stack.size() == 1) { + m_pRoot = m_stack[0]; + m_stack.pop_back(); + return; + } + + detail::node& node = *m_stack.back(); + m_stack.pop_back(); + + detail::node& collection = *m_stack.back(); + + if (collection.type() == NodeType::Sequence) { + collection.push_back(node, m_pMemory); + } else if (collection.type() == NodeType::Map) { + assert(!m_keys.empty()); + PushedKey& key = m_keys.back(); + if (key.second) { + collection.insert(*key.first, node, m_pMemory); + m_keys.pop_back(); + } else { + key.second = true; + } + } else { + assert(false); + m_stack.clear(); + } +} + +void NodeBuilder::RegisterAnchor(anchor_t anchor, detail::node& node) { + if (anchor) { + assert(anchor == m_anchors.size()); + m_anchors.push_back(&node); + } +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/nodebuilder.h b/runtime/onnxruntime/third_party/yaml-cpp/src/nodebuilder.h new file mode 100644 index 0000000..a6a47f0 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/nodebuilder.h @@ -0,0 +1,70 @@ +#ifndef NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/eventhandler.h" +#include "yaml-cpp/node/ptr.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +struct Mark; +} // namespace YAML + +namespace YAML { +class Node; + +class NodeBuilder : public EventHandler { + public: + NodeBuilder(); + virtual ~NodeBuilder(); + + Node Root(); + + virtual void OnDocumentStart(const Mark& mark); + virtual void OnDocumentEnd(); + + virtual void OnNull(const Mark& mark, anchor_t anchor); + virtual void OnAlias(const Mark& mark, anchor_t anchor); + virtual void OnScalar(const Mark& mark, const std::string& tag, + anchor_t anchor, const std::string& value); + + virtual void OnSequenceStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style); + virtual void OnSequenceEnd(); + + virtual void OnMapStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style); + virtual void OnMapEnd(); + + private: + detail::node& Push(const Mark& mark, anchor_t anchor); + void Push(detail::node& node); + void Pop(); + void RegisterAnchor(anchor_t anchor, detail::node& node); + + private: + detail::shared_memory_holder m_pMemory; + detail::node* m_pRoot; + + typedef std::vector Nodes; + Nodes m_stack; + Nodes m_anchors; + + typedef std::pair PushedKey; + std::vector m_keys; + std::size_t m_mapDepth; +}; +} + +#endif // NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/nodeevents.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/nodeevents.cpp new file mode 100644 index 0000000..82261fe --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/nodeevents.cpp @@ -0,0 +1,101 @@ +#include "nodeevents.h" +#include "yaml-cpp/eventhandler.h" +#include "yaml-cpp/mark.h" +#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +void NodeEvents::AliasManager::RegisterReference(const detail::node& node) { + m_anchorByIdentity.insert(std::make_pair(node.ref(), _CreateNewAnchor())); +} + +anchor_t NodeEvents::AliasManager::LookupAnchor( + const detail::node& node) const { + AnchorByIdentity::const_iterator it = m_anchorByIdentity.find(node.ref()); + if (it == m_anchorByIdentity.end()) + return 0; + return it->second; +} + +NodeEvents::NodeEvents(const Node& node) + : m_pMemory(node.m_pMemory), m_root(node.m_pNode) { + if (m_root) + Setup(*m_root); +} + +void NodeEvents::Setup(const detail::node& node) { + int& refCount = m_refCount[node.ref()]; + refCount++; + if (refCount > 1) + return; + + if (node.type() == NodeType::Sequence) { + for (detail::const_node_iterator it = node.begin(); it != node.end(); ++it) + Setup(**it); + } else if (node.type() == NodeType::Map) { + for (detail::const_node_iterator it = node.begin(); it != node.end(); + ++it) { + Setup(*it->first); + Setup(*it->second); + } + } +} + +void NodeEvents::Emit(EventHandler& handler) { + AliasManager am; + + handler.OnDocumentStart(Mark()); + if (m_root) + Emit(*m_root, handler, am); + handler.OnDocumentEnd(); +} + +void NodeEvents::Emit(const detail::node& node, EventHandler& handler, + AliasManager& am) const { + anchor_t anchor = NullAnchor; + if (IsAliased(node)) { + anchor = am.LookupAnchor(node); + if (anchor) { + handler.OnAlias(Mark(), anchor); + return; + } + + am.RegisterReference(node); + anchor = am.LookupAnchor(node); + } + + switch (node.type()) { + case NodeType::Undefined: + break; + case NodeType::Null: + handler.OnNull(Mark(), anchor); + break; + case NodeType::Scalar: + handler.OnScalar(Mark(), node.tag(), anchor, node.scalar()); + break; + case NodeType::Sequence: + handler.OnSequenceStart(Mark(), node.tag(), anchor, node.style()); + for (detail::const_node_iterator it = node.begin(); it != node.end(); + ++it) + Emit(**it, handler, am); + handler.OnSequenceEnd(); + break; + case NodeType::Map: + handler.OnMapStart(Mark(), node.tag(), anchor, node.style()); + for (detail::const_node_iterator it = node.begin(); it != node.end(); + ++it) { + Emit(*it->first, handler, am); + Emit(*it->second, handler, am); + } + handler.OnMapEnd(); + break; + } +} + +bool NodeEvents::IsAliased(const detail::node& node) const { + RefCount::const_iterator it = m_refCount.find(node.ref()); + return it != m_refCount.end() && it->second > 1; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/nodeevents.h b/runtime/onnxruntime/third_party/yaml-cpp/src/nodeevents.h new file mode 100644 index 0000000..49c18eb --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/nodeevents.h @@ -0,0 +1,64 @@ +#ifndef NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/node/ptr.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +} // namespace YAML + +namespace YAML { +class EventHandler; +class Node; + +class NodeEvents { + public: + explicit NodeEvents(const Node& node); + + void Emit(EventHandler& handler); + + private: + class AliasManager { + public: + AliasManager() : m_curAnchor(0) {} + + void RegisterReference(const detail::node& node); + anchor_t LookupAnchor(const detail::node& node) const; + + private: + anchor_t _CreateNewAnchor() { return ++m_curAnchor; } + + private: + typedef std::map AnchorByIdentity; + AnchorByIdentity m_anchorByIdentity; + + anchor_t m_curAnchor; + }; + + void Setup(const detail::node& node); + void Emit(const detail::node& node, EventHandler& handler, + AliasManager& am) const; + bool IsAliased(const detail::node& node) const; + + private: + detail::shared_memory_holder m_pMemory; + detail::node* m_root; + + typedef std::map RefCount; + RefCount m_refCount; +}; +} + +#endif // NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/null.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/null.cpp new file mode 100644 index 0000000..d12dd08 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/null.cpp @@ -0,0 +1,10 @@ +#include "yaml-cpp/null.h" + +namespace YAML { +_Null Null; + +bool IsNullString(const std::string& str) { + return str.empty() || str == "~" || str == "null" || str == "Null" || + str == "NULL"; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/ostream_wrapper.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/ostream_wrapper.cpp new file mode 100644 index 0000000..357fc00 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/ostream_wrapper.cpp @@ -0,0 +1,57 @@ +#include "yaml-cpp/ostream_wrapper.h" + +#include +#include +#include + +namespace YAML { +ostream_wrapper::ostream_wrapper() + : m_buffer(1, '\0'), + m_pStream(0), + m_pos(0), + m_row(0), + m_col(0), + m_comment(false) {} + +ostream_wrapper::ostream_wrapper(std::ostream& stream) + : m_pStream(&stream), m_pos(0), m_row(0), m_col(0), m_comment(false) {} + +ostream_wrapper::~ostream_wrapper() {} + +void ostream_wrapper::write(const std::string& str) { + if (m_pStream) { + m_pStream->write(str.c_str(), str.size()); + } else { + m_buffer.resize(std::max(m_buffer.size(), m_pos + str.size() + 1)); + std::copy(str.begin(), str.end(), m_buffer.begin() + m_pos); + } + + for (std::size_t i = 0; i < str.size(); i++) { + update_pos(str[i]); + } +} + +void ostream_wrapper::write(const char* str, std::size_t size) { + if (m_pStream) { + m_pStream->write(str, size); + } else { + m_buffer.resize(std::max(m_buffer.size(), m_pos + size + 1)); + std::copy(str, str + size, m_buffer.begin() + m_pos); + } + + for (std::size_t i = 0; i < size; i++) { + update_pos(str[i]); + } +} + +void ostream_wrapper::update_pos(char ch) { + m_pos++; + m_col++; + + if (ch == '\n') { + m_row++; + m_col = 0; + m_comment = false; + } +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/parse.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/parse.cpp new file mode 100644 index 0000000..0b2ae4a --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/parse.cpp @@ -0,0 +1,72 @@ +#include "yaml-cpp/node/parse.h" + +#include +#include + +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/impl.h" +#include "yaml-cpp/parser.h" +#include "nodebuilder.h" + +namespace YAML { +Node Load(const std::string& input) { + std::stringstream stream(input); + return Load(stream); +} + +Node Load(const char* input) { + std::stringstream stream(input); + return Load(stream); +} + +Node Load(std::istream& input) { + Parser parser(input); + NodeBuilder builder; + if (!parser.HandleNextDocument(builder)) { + return Node(); + } + + return builder.Root(); +} + +Node LoadFile(const std::string& filename) { + std::ifstream fin(filename.c_str()); + if (!fin) { + throw BadFile(); + } + return Load(fin); +} + +std::vector LoadAll(const std::string& input) { + std::stringstream stream(input); + return LoadAll(stream); +} + +std::vector LoadAll(const char* input) { + std::stringstream stream(input); + return LoadAll(stream); +} + +std::vector LoadAll(std::istream& input) { + std::vector docs; + + Parser parser(input); + while (1) { + NodeBuilder builder; + if (!parser.HandleNextDocument(builder)) { + break; + } + docs.push_back(builder.Root()); + } + + return docs; +} + +std::vector LoadAllFromFile(const std::string& filename) { + std::ifstream fin(filename.c_str()); + if (!fin) { + throw BadFile(); + } + return LoadAll(fin); +} +} // namespace YAML diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/parser.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/parser.cpp new file mode 100644 index 0000000..cd69f39 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/parser.cpp @@ -0,0 +1,129 @@ +#include +#include + +#include "directives.h" // IWYU pragma: keep +#include "scanner.h" // IWYU pragma: keep +#include "singledocparser.h" +#include "token.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep +#include "yaml-cpp/parser.h" + +namespace YAML { +class EventHandler; + +Parser::Parser() {} + +Parser::Parser(std::istream& in) { Load(in); } + +Parser::~Parser() {} + +Parser::operator bool() const { + return m_pScanner.get() && !m_pScanner->empty(); +} + +void Parser::Load(std::istream& in) { + m_pScanner.reset(new Scanner(in)); + m_pDirectives.reset(new Directives); +} + +bool Parser::HandleNextDocument(EventHandler& eventHandler) { + if (!m_pScanner.get()) + return false; + + ParseDirectives(); + if (m_pScanner->empty()) { + return false; + } + + SingleDocParser sdp(*m_pScanner, *m_pDirectives); + sdp.HandleDocument(eventHandler); + return true; +} + +void Parser::ParseDirectives() { + bool readDirective = false; + + while (1) { + if (m_pScanner->empty()) { + break; + } + + Token& token = m_pScanner->peek(); + if (token.type != Token::DIRECTIVE) { + break; + } + + // we keep the directives from the last document if none are specified; + // but if any directives are specific, then we reset them + if (!readDirective) { + m_pDirectives.reset(new Directives); + } + + readDirective = true; + HandleDirective(token); + m_pScanner->pop(); + } +} + +void Parser::HandleDirective(const Token& token) { + if (token.value == "YAML") { + HandleYamlDirective(token); + } else if (token.value == "TAG") { + HandleTagDirective(token); + } +} + +void Parser::HandleYamlDirective(const Token& token) { + if (token.params.size() != 1) { + throw ParserException(token.mark, ErrorMsg::YAML_DIRECTIVE_ARGS); + } + + if (!m_pDirectives->version.isDefault) { + throw ParserException(token.mark, ErrorMsg::REPEATED_YAML_DIRECTIVE); + } + + std::stringstream str(token.params[0]); + str >> m_pDirectives->version.major; + str.get(); + str >> m_pDirectives->version.minor; + if (!str || str.peek() != EOF) { + throw ParserException( + token.mark, std::string(ErrorMsg::YAML_VERSION) + token.params[0]); + } + + if (m_pDirectives->version.major > 1) { + throw ParserException(token.mark, ErrorMsg::YAML_MAJOR_VERSION); + } + + m_pDirectives->version.isDefault = false; + // TODO: warning on major == 1, minor > 2? +} + +void Parser::HandleTagDirective(const Token& token) { + if (token.params.size() != 2) + throw ParserException(token.mark, ErrorMsg::TAG_DIRECTIVE_ARGS); + + const std::string& handle = token.params[0]; + const std::string& prefix = token.params[1]; + if (m_pDirectives->tags.find(handle) != m_pDirectives->tags.end()) { + throw ParserException(token.mark, ErrorMsg::REPEATED_TAG_DIRECTIVE); + } + + m_pDirectives->tags[handle] = prefix; +} + +void Parser::PrintTokens(std::ostream& out) { + if (!m_pScanner.get()) { + return; + } + + while (1) { + if (m_pScanner->empty()) { + break; + } + + out << m_pScanner->peek() << "\n"; + m_pScanner->pop(); + } +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/ptr_vector.h b/runtime/onnxruntime/third_party/yaml-cpp/src/ptr_vector.h new file mode 100644 index 0000000..955aebd --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/ptr_vector.h @@ -0,0 +1,43 @@ +#ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include +#include + +#include "yaml-cpp/noncopyable.h" + +namespace YAML { + +// TODO: This class is no longer needed +template +class ptr_vector : private YAML::noncopyable { + public: + ptr_vector() {} + + void clear() { m_data.clear(); } + + std::size_t size() const { return m_data.size(); } + bool empty() const { return m_data.empty(); } + + void push_back(std::unique_ptr&& t) { m_data.push_back(std::move(t)); } + T& operator[](std::size_t i) { return *m_data[i]; } + const T& operator[](std::size_t i) const { return *m_data[i]; } + + T& back() { return *(m_data.back().get()); } + + const T& back() const { return *(m_data.back().get()); } + + private: + std::vector> m_data; +}; +} + +#endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/regex_yaml.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/regex_yaml.cpp new file mode 100644 index 0000000..20b7720 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/regex_yaml.cpp @@ -0,0 +1,45 @@ +#include "regex_yaml.h" + +namespace YAML { +// constructors +RegEx::RegEx() : m_op(REGEX_EMPTY) {} + +RegEx::RegEx(REGEX_OP op) : m_op(op) {} + +RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch) {} + +RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z) {} + +RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op) { + for (std::size_t i = 0; i < str.size(); i++) + m_params.push_back(RegEx(str[i])); +} + +// combination constructors +RegEx operator!(const RegEx& ex) { + RegEx ret(REGEX_NOT); + ret.m_params.push_back(ex); + return ret; +} + +RegEx operator||(const RegEx& ex1, const RegEx& ex2) { + RegEx ret(REGEX_OR); + ret.m_params.push_back(ex1); + ret.m_params.push_back(ex2); + return ret; +} + +RegEx operator&&(const RegEx& ex1, const RegEx& ex2) { + RegEx ret(REGEX_AND); + ret.m_params.push_back(ex1); + ret.m_params.push_back(ex2); + return ret; +} + +RegEx operator+(const RegEx& ex1, const RegEx& ex2) { + RegEx ret(REGEX_SEQ); + ret.m_params.push_back(ex1); + ret.m_params.push_back(ex2); + return ret; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/regex_yaml.h b/runtime/onnxruntime/third_party/yaml-cpp/src/regex_yaml.h new file mode 100644 index 0000000..8f28b85 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/regex_yaml.h @@ -0,0 +1,87 @@ +#ifndef REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +class Stream; + +enum REGEX_OP { + REGEX_EMPTY, + REGEX_MATCH, + REGEX_RANGE, + REGEX_OR, + REGEX_AND, + REGEX_NOT, + REGEX_SEQ +}; + +// simplified regular expressions +// . Only straightforward matches (no repeated characters) +// . Only matches from start of string +class YAML_CPP_API RegEx { + public: + RegEx(); + RegEx(char ch); + RegEx(char a, char z); + RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ); + ~RegEx() {} + + friend YAML_CPP_API RegEx operator!(const RegEx& ex); + friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2); + friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2); + friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2); + + bool Matches(char ch) const; + bool Matches(const std::string& str) const; + bool Matches(const Stream& in) const; + template + bool Matches(const Source& source) const; + + int Match(const std::string& str) const; + int Match(const Stream& in) const; + template + int Match(const Source& source) const; + + private: + RegEx(REGEX_OP op); + + template + bool IsValidSource(const Source& source) const; + template + int MatchUnchecked(const Source& source) const; + + template + int MatchOpEmpty(const Source& source) const; + template + int MatchOpMatch(const Source& source) const; + template + int MatchOpRange(const Source& source) const; + template + int MatchOpOr(const Source& source) const; + template + int MatchOpAnd(const Source& source) const; + template + int MatchOpNot(const Source& source) const; + template + int MatchOpSeq(const Source& source) const; + + private: + REGEX_OP m_op; + char m_a, m_z; + std::vector m_params; +}; +} + +#include "regeximpl.h" + +#endif // REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/regeximpl.h b/runtime/onnxruntime/third_party/yaml-cpp/src/regeximpl.h new file mode 100644 index 0000000..709124f --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/regeximpl.h @@ -0,0 +1,186 @@ +#ifndef REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "stream.h" +#include "stringsource.h" +#include "streamcharsource.h" + +namespace YAML { +// query matches +inline bool RegEx::Matches(char ch) const { + std::string str; + str += ch; + return Matches(str); +} + +inline bool RegEx::Matches(const std::string& str) const { + return Match(str) >= 0; +} + +inline bool RegEx::Matches(const Stream& in) const { return Match(in) >= 0; } + +template +inline bool RegEx::Matches(const Source& source) const { + return Match(source) >= 0; +} + +// Match +// . Matches the given string against this regular expression. +// . Returns the number of characters matched. +// . Returns -1 if no characters were matched (the reason for +// not returning zero is that we may have an empty regex +// which is ALWAYS successful at matching zero characters). +// . REMEMBER that we only match from the start of the buffer! +inline int RegEx::Match(const std::string& str) const { + StringCharSource source(str.c_str(), str.size()); + return Match(source); +} + +inline int RegEx::Match(const Stream& in) const { + StreamCharSource source(in); + return Match(source); +} + +template +inline bool RegEx::IsValidSource(const Source& source) const { + return source; +} + +template <> +inline bool RegEx::IsValidSource( + const StringCharSource& source) const { + switch (m_op) { + case REGEX_MATCH: + case REGEX_RANGE: + return source; + default: + return true; + } +} + +template +inline int RegEx::Match(const Source& source) const { + return IsValidSource(source) ? MatchUnchecked(source) : -1; +} + +template +inline int RegEx::MatchUnchecked(const Source& source) const { + switch (m_op) { + case REGEX_EMPTY: + return MatchOpEmpty(source); + case REGEX_MATCH: + return MatchOpMatch(source); + case REGEX_RANGE: + return MatchOpRange(source); + case REGEX_OR: + return MatchOpOr(source); + case REGEX_AND: + return MatchOpAnd(source); + case REGEX_NOT: + return MatchOpNot(source); + case REGEX_SEQ: + return MatchOpSeq(source); + } + + return -1; +} + +////////////////////////////////////////////////////////////////////////////// +// Operators +// Note: the convention MatchOp* is that we can assume +// IsSourceValid(source). +// So we do all our checks *before* we call these functions + +// EmptyOperator +template +inline int RegEx::MatchOpEmpty(const Source& source) const { + return source[0] == Stream::eof() ? 0 : -1; +} + +template <> +inline int RegEx::MatchOpEmpty( + const StringCharSource& source) const { + return !source + ? 0 + : -1; // the empty regex only is successful on the empty string +} + +// MatchOperator +template +inline int RegEx::MatchOpMatch(const Source& source) const { + if (source[0] != m_a) + return -1; + return 1; +} + +// RangeOperator +template +inline int RegEx::MatchOpRange(const Source& source) const { + if (m_a > source[0] || m_z < source[0]) + return -1; + return 1; +} + +// OrOperator +template +inline int RegEx::MatchOpOr(const Source& source) const { + for (std::size_t i = 0; i < m_params.size(); i++) { + int n = m_params[i].MatchUnchecked(source); + if (n >= 0) + return n; + } + return -1; +} + +// AndOperator +// Note: 'AND' is a little funny, since we may be required to match things +// of different lengths. If we find a match, we return the length of +// the FIRST entry on the list. +template +inline int RegEx::MatchOpAnd(const Source& source) const { + int first = -1; + for (std::size_t i = 0; i < m_params.size(); i++) { + int n = m_params[i].MatchUnchecked(source); + if (n == -1) + return -1; + if (i == 0) + first = n; + } + return first; +} + +// NotOperator +template +inline int RegEx::MatchOpNot(const Source& source) const { + if (m_params.empty()) + return -1; + if (m_params[0].MatchUnchecked(source) >= 0) + return -1; + return 1; +} + +// SeqOperator +template +inline int RegEx::MatchOpSeq(const Source& source) const { + int offset = 0; + for (std::size_t i = 0; i < m_params.size(); i++) { + int n = m_params[i].Match(source + offset); // note Match, not + // MatchUnchecked because we + // need to check validity after + // the offset + if (n == -1) + return -1; + offset += n; + } + + return offset; +} +} + +#endif // REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/scanner.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/scanner.cpp new file mode 100644 index 0000000..b5cfcc1 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/scanner.cpp @@ -0,0 +1,386 @@ +#include +#include + +#include "exp.h" +#include "scanner.h" +#include "token.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep + +namespace YAML { +Scanner::Scanner(std::istream& in) + : INPUT(in), + m_startedStream(false), + m_endedStream(false), + m_simpleKeyAllowed(false), + m_canBeJSONFlow(false) {} + +Scanner::~Scanner() {} + +bool Scanner::empty() { + EnsureTokensInQueue(); + return m_tokens.empty(); +} + +void Scanner::pop() { + EnsureTokensInQueue(); + if (!m_tokens.empty()) + m_tokens.pop(); +} + +Token& Scanner::peek() { + EnsureTokensInQueue(); + assert(!m_tokens.empty()); // should we be asserting here? I mean, we really + // just be checking + // if it's empty before peeking. + +#if 0 + static Token *pLast = 0; + if(pLast != &m_tokens.front()) + std::cerr << "peek: " << m_tokens.front() << "\n"; + pLast = &m_tokens.front(); +#endif + + return m_tokens.front(); +} + +Mark Scanner::mark() const { return INPUT.mark(); } + +void Scanner::EnsureTokensInQueue() { + while (1) { + if (!m_tokens.empty()) { + Token& token = m_tokens.front(); + + // if this guy's valid, then we're done + if (token.status == Token::VALID) { + return; + } + + // here's where we clean up the impossible tokens + if (token.status == Token::INVALID) { + m_tokens.pop(); + continue; + } + + // note: what's left are the unverified tokens + } + + // no token? maybe we've actually finished + if (m_endedStream) { + return; + } + + // no? then scan... + ScanNextToken(); + } +} + +void Scanner::ScanNextToken() { + if (m_endedStream) { + return; + } + + if (!m_startedStream) { + return StartStream(); + } + + // get rid of whitespace, etc. (in between tokens it should be irrelevent) + ScanToNextToken(); + + // maybe need to end some blocks + PopIndentToHere(); + + // ***** + // And now branch based on the next few characters! + // ***** + + // end of stream + if (!INPUT) { + return EndStream(); + } + + if (INPUT.column() == 0 && INPUT.peek() == Keys::Directive) { + return ScanDirective(); + } + + // document token + if (INPUT.column() == 0 && Exp::DocStart().Matches(INPUT)) { + return ScanDocStart(); + } + + if (INPUT.column() == 0 && Exp::DocEnd().Matches(INPUT)) { + return ScanDocEnd(); + } + + // flow start/end/entry + if (INPUT.peek() == Keys::FlowSeqStart || + INPUT.peek() == Keys::FlowMapStart) { + return ScanFlowStart(); + } + + if (INPUT.peek() == Keys::FlowSeqEnd || INPUT.peek() == Keys::FlowMapEnd) { + return ScanFlowEnd(); + } + + if (INPUT.peek() == Keys::FlowEntry) { + return ScanFlowEntry(); + } + + // block/map stuff + if (Exp::BlockEntry().Matches(INPUT)) { + return ScanBlockEntry(); + } + + if ((InBlockContext() ? Exp::Key() : Exp::KeyInFlow()).Matches(INPUT)) { + return ScanKey(); + } + + if (GetValueRegex().Matches(INPUT)) { + return ScanValue(); + } + + // alias/anchor + if (INPUT.peek() == Keys::Alias || INPUT.peek() == Keys::Anchor) { + return ScanAnchorOrAlias(); + } + + // tag + if (INPUT.peek() == Keys::Tag) { + return ScanTag(); + } + + // special scalars + if (InBlockContext() && (INPUT.peek() == Keys::LiteralScalar || + INPUT.peek() == Keys::FoldedScalar)) { + return ScanBlockScalar(); + } + + if (INPUT.peek() == '\'' || INPUT.peek() == '\"') { + return ScanQuotedScalar(); + } + + // plain scalars + if ((InBlockContext() ? Exp::PlainScalar() : Exp::PlainScalarInFlow()) + .Matches(INPUT)) { + return ScanPlainScalar(); + } + + // don't know what it is! + throw ParserException(INPUT.mark(), ErrorMsg::UNKNOWN_TOKEN); +} + +void Scanner::ScanToNextToken() { + while (1) { + // first eat whitespace + while (INPUT && IsWhitespaceToBeEaten(INPUT.peek())) { + if (InBlockContext() && Exp::Tab().Matches(INPUT)) { + m_simpleKeyAllowed = false; + } + INPUT.eat(1); + } + + // then eat a comment + if (Exp::Comment().Matches(INPUT)) { + // eat until line break + while (INPUT && !Exp::Break().Matches(INPUT)) { + INPUT.eat(1); + } + } + + // if it's NOT a line break, then we're done! + if (!Exp::Break().Matches(INPUT)) { + break; + } + + // otherwise, let's eat the line break and keep going + int n = Exp::Break().Match(INPUT); + INPUT.eat(n); + + // oh yeah, and let's get rid of that simple key + InvalidateSimpleKey(); + + // new line - we may be able to accept a simple key now + if (InBlockContext()) { + m_simpleKeyAllowed = true; + } + } +} + +/////////////////////////////////////////////////////////////////////// +// Misc. helpers + +// IsWhitespaceToBeEaten +// . We can eat whitespace if it's a space or tab +// . Note: originally tabs in block context couldn't be eaten +// "where a simple key could be allowed +// (i.e., not at the beginning of a line, or following '-', '?', or +// ':')" +// I think this is wrong, since tabs can be non-content whitespace; it's just +// that they can't contribute to indentation, so once you've seen a tab in a +// line, you can't start a simple key +bool Scanner::IsWhitespaceToBeEaten(char ch) { + if (ch == ' ') { + return true; + } + + if (ch == '\t') { + return true; + } + + return false; +} + +const RegEx& Scanner::GetValueRegex() const { + if (InBlockContext()) { + return Exp::Value(); + } + + return m_canBeJSONFlow ? Exp::ValueInJSONFlow() : Exp::ValueInFlow(); +} + +void Scanner::StartStream() { + m_startedStream = true; + m_simpleKeyAllowed = true; + std::unique_ptr pIndent( + new IndentMarker(-1, IndentMarker::NONE)); + m_indentRefs.push_back(std::move(pIndent)); + m_indents.push(&m_indentRefs.back()); +} + +void Scanner::EndStream() { + // force newline + if (INPUT.column() > 0) { + INPUT.ResetColumn(); + } + + PopAllIndents(); + PopAllSimpleKeys(); + + m_simpleKeyAllowed = false; + m_endedStream = true; +} + +Token* Scanner::PushToken(Token::TYPE type) { + m_tokens.push(Token(type, INPUT.mark())); + return &m_tokens.back(); +} + +Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) const { + switch (type) { + case IndentMarker::SEQ: + return Token::BLOCK_SEQ_START; + case IndentMarker::MAP: + return Token::BLOCK_MAP_START; + case IndentMarker::NONE: + assert(false); + break; + } + assert(false); + throw std::runtime_error("yaml-cpp: internal error, invalid indent type"); +} + +Scanner::IndentMarker* Scanner::PushIndentTo(int column, + IndentMarker::INDENT_TYPE type) { + // are we in flow? + if (InFlowContext()) { + return 0; + } + + std::unique_ptr pIndent(new IndentMarker(column, type)); + IndentMarker& indent = *pIndent; + const IndentMarker& lastIndent = *m_indents.top(); + + // is this actually an indentation? + if (indent.column < lastIndent.column) { + return 0; + } + if (indent.column == lastIndent.column && + !(indent.type == IndentMarker::SEQ && + lastIndent.type == IndentMarker::MAP)) { + return 0; + } + + // push a start token + indent.pStartToken = PushToken(GetStartTokenFor(type)); + + // and then the indent + m_indents.push(&indent); + m_indentRefs.push_back(std::move(pIndent)); + return &m_indentRefs.back(); +} + +void Scanner::PopIndentToHere() { + // are we in flow? + if (InFlowContext()) { + return; + } + + // now pop away + while (!m_indents.empty()) { + const IndentMarker& indent = *m_indents.top(); + if (indent.column < INPUT.column()) { + break; + } + if (indent.column == INPUT.column() && + !(indent.type == IndentMarker::SEQ && + !Exp::BlockEntry().Matches(INPUT))) { + break; + } + + PopIndent(); + } + + while (!m_indents.empty() && + m_indents.top()->status == IndentMarker::INVALID) { + PopIndent(); + } +} + +void Scanner::PopAllIndents() { + // are we in flow? + if (InFlowContext()) { + return; + } + + // now pop away + while (!m_indents.empty()) { + const IndentMarker& indent = *m_indents.top(); + if (indent.type == IndentMarker::NONE) { + break; + } + + PopIndent(); + } +} + +void Scanner::PopIndent() { + const IndentMarker& indent = *m_indents.top(); + m_indents.pop(); + + if (indent.status != IndentMarker::VALID) { + InvalidateSimpleKey(); + return; + } + + if (indent.type == IndentMarker::SEQ) { + m_tokens.push(Token(Token::BLOCK_SEQ_END, INPUT.mark())); + } else if (indent.type == IndentMarker::MAP) { + m_tokens.push(Token(Token::BLOCK_MAP_END, INPUT.mark())); + } +} + +int Scanner::GetTopIndent() const { + if (m_indents.empty()) { + return 0; + } + return m_indents.top()->column; +} + +void Scanner::ThrowParserException(const std::string& msg) const { + Mark mark = Mark::null_mark(); + if (!m_tokens.empty()) { + const Token& token = m_tokens.front(); + mark = token.mark; + } + throw ParserException(mark, msg); +} +} // namespace YAML diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/scanner.h b/runtime/onnxruntime/third_party/yaml-cpp/src/scanner.h new file mode 100644 index 0000000..7bb2ccc --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/scanner.h @@ -0,0 +1,190 @@ +#ifndef SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "ptr_vector.h" +#include "stream.h" +#include "token.h" +#include "yaml-cpp/mark.h" + +namespace YAML { +class Node; +class RegEx; + +/** + * A scanner transforms a stream of characters into a stream of tokens. + */ +class Scanner { + public: + explicit Scanner(std::istream &in); + ~Scanner(); + + /** Returns true if there are no more tokens to be read. */ + bool empty(); + + /** Removes the next token in the queue. */ + void pop(); + + /** Returns, but does not remove, the next token in the queue. */ + Token &peek(); + + /** Returns the current mark in the input stream. */ + Mark mark() const; + + private: + struct IndentMarker { + enum INDENT_TYPE { MAP, SEQ, NONE }; + enum STATUS { VALID, INVALID, UNKNOWN }; + IndentMarker(int column_, INDENT_TYPE type_) + : column(column_), type(type_), status(VALID), pStartToken(0) {} + + int column; + INDENT_TYPE type; + STATUS status; + Token *pStartToken; + }; + + enum FLOW_MARKER { FLOW_MAP, FLOW_SEQ }; + + private: + // scanning + + /** + * Scans until there's a valid token at the front of the queue, or the queue + * is empty. The state can be checked by {@link #empty}, and the next token + * retrieved by {@link #peek}. + */ + void EnsureTokensInQueue(); + + /** + * The main scanning function; this method branches out to scan whatever the + * next token should be. + */ + void ScanNextToken(); + + /** Eats the input stream until it reaches the next token-like thing. */ + void ScanToNextToken(); + + /** Sets the initial conditions for starting a stream. */ + void StartStream(); + + /** Closes out the stream, finish up, etc. */ + void EndStream(); + + Token *PushToken(Token::TYPE type); + + bool InFlowContext() const { return !m_flows.empty(); } + bool InBlockContext() const { return m_flows.empty(); } + std::size_t GetFlowLevel() const { return m_flows.size(); } + + Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const; + + /** + * Pushes an indentation onto the stack, and enqueues the proper token + * (sequence start or mapping start). + * + * @return the indent marker it generates (if any). + */ + IndentMarker *PushIndentTo(int column, IndentMarker::INDENT_TYPE type); + + /** + * Pops indentations off the stack until it reaches the current indentation + * level, and enqueues the proper token each time. Then pops all invalid + * indentations off. + */ + void PopIndentToHere(); + + /** + * Pops all indentations (except for the base empty one) off the stack, and + * enqueues the proper token each time. + */ + void PopAllIndents(); + + /** Pops a single indent, pushing the proper token. */ + void PopIndent(); + int GetTopIndent() const; + + // checking input + bool CanInsertPotentialSimpleKey() const; + bool ExistsActiveSimpleKey() const; + void InsertPotentialSimpleKey(); + void InvalidateSimpleKey(); + bool VerifySimpleKey(); + void PopAllSimpleKeys(); + + /** + * Throws a ParserException with the current token location (if available), + * and does not parse any more tokens. + */ + void ThrowParserException(const std::string &msg) const; + + bool IsWhitespaceToBeEaten(char ch); + + /** + * Returns the appropriate regex to check if the next token is a value token. + */ + const RegEx &GetValueRegex() const; + + struct SimpleKey { + SimpleKey(const Mark &mark_, std::size_t flowLevel_); + + void Validate(); + void Invalidate(); + + Mark mark; + std::size_t flowLevel; + IndentMarker *pIndent; + Token *pMapStart, *pKey; + }; + + // and the tokens + void ScanDirective(); + void ScanDocStart(); + void ScanDocEnd(); + void ScanBlockSeqStart(); + void ScanBlockMapSTart(); + void ScanBlockEnd(); + void ScanBlockEntry(); + void ScanFlowStart(); + void ScanFlowEnd(); + void ScanFlowEntry(); + void ScanKey(); + void ScanValue(); + void ScanAnchorOrAlias(); + void ScanTag(); + void ScanPlainScalar(); + void ScanQuotedScalar(); + void ScanBlockScalar(); + + private: + // the stream + Stream INPUT; + + // the output (tokens) + std::queue m_tokens; + + // state info + bool m_startedStream, m_endedStream; + bool m_simpleKeyAllowed; + bool m_canBeJSONFlow; + std::stack m_simpleKeys; + std::stack m_indents; + ptr_vector m_indentRefs; // for "garbage collection" + std::stack m_flows; +}; +} + +#endif // SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/scanscalar.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/scanscalar.cpp new file mode 100644 index 0000000..10e359d --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/scanscalar.cpp @@ -0,0 +1,250 @@ +#include "scanscalar.h" + +#include + +#include "exp.h" +#include "regeximpl.h" +#include "stream.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep + +namespace YAML { +// ScanScalar +// . This is where the scalar magic happens. +// +// . We do the scanning in three phases: +// 1. Scan until newline +// 2. Eat newline +// 3. Scan leading blanks. +// +// . Depending on the parameters given, we store or stop +// and different places in the above flow. +std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) { + bool foundNonEmptyLine = false; + bool pastOpeningBreak = (params.fold == FOLD_FLOW); + bool emptyLine = false, moreIndented = false; + int foldedNewlineCount = 0; + bool foldedNewlineStartedMoreIndented = false; + std::size_t lastEscapedChar = std::string::npos; + std::string scalar; + params.leadingSpaces = false; + + if (!params.end) { + params.end = &Exp::Empty(); + } + + while (INPUT) { + // ******************************** + // Phase #1: scan until line ending + + std::size_t lastNonWhitespaceChar = scalar.size(); + bool escapedNewline = false; + while (!params.end->Matches(INPUT) && !Exp::Break().Matches(INPUT)) { + if (!INPUT) { + break; + } + + // document indicator? + if (INPUT.column() == 0 && Exp::DocIndicator().Matches(INPUT)) { + if (params.onDocIndicator == BREAK) { + break; + } else if (params.onDocIndicator == THROW) { + throw ParserException(INPUT.mark(), ErrorMsg::DOC_IN_SCALAR); + } + } + + foundNonEmptyLine = true; + pastOpeningBreak = true; + + // escaped newline? (only if we're escaping on slash) + if (params.escape == '\\' && Exp::EscBreak().Matches(INPUT)) { + // eat escape character and get out (but preserve trailing whitespace!) + INPUT.get(); + lastNonWhitespaceChar = scalar.size(); + lastEscapedChar = scalar.size(); + escapedNewline = true; + break; + } + + // escape this? + if (INPUT.peek() == params.escape) { + scalar += Exp::Escape(INPUT); + lastNonWhitespaceChar = scalar.size(); + lastEscapedChar = scalar.size(); + continue; + } + + // otherwise, just add the damn character + char ch = INPUT.get(); + scalar += ch; + if (ch != ' ' && ch != '\t') { + lastNonWhitespaceChar = scalar.size(); + } + } + + // eof? if we're looking to eat something, then we throw + if (!INPUT) { + if (params.eatEnd) { + throw ParserException(INPUT.mark(), ErrorMsg::EOF_IN_SCALAR); + } + break; + } + + // doc indicator? + if (params.onDocIndicator == BREAK && INPUT.column() == 0 && + Exp::DocIndicator().Matches(INPUT)) { + break; + } + + // are we done via character match? + int n = params.end->Match(INPUT); + if (n >= 0) { + if (params.eatEnd) { + INPUT.eat(n); + } + break; + } + + // do we remove trailing whitespace? + if (params.fold == FOLD_FLOW) + scalar.erase(lastNonWhitespaceChar); + + // ******************************** + // Phase #2: eat line ending + n = Exp::Break().Match(INPUT); + INPUT.eat(n); + + // ******************************** + // Phase #3: scan initial spaces + + // first the required indentation + while (INPUT.peek() == ' ' && + (INPUT.column() < params.indent || + (params.detectIndent && !foundNonEmptyLine)) && + !params.end->Matches(INPUT)) { + INPUT.eat(1); + } + + // update indent if we're auto-detecting + if (params.detectIndent && !foundNonEmptyLine) { + params.indent = std::max(params.indent, INPUT.column()); + } + + // and then the rest of the whitespace + while (Exp::Blank().Matches(INPUT)) { + // we check for tabs that masquerade as indentation + if (INPUT.peek() == '\t' && INPUT.column() < params.indent && + params.onTabInIndentation == THROW) { + throw ParserException(INPUT.mark(), ErrorMsg::TAB_IN_INDENTATION); + } + + if (!params.eatLeadingWhitespace) { + break; + } + + if (params.end->Matches(INPUT)) { + break; + } + + INPUT.eat(1); + } + + // was this an empty line? + bool nextEmptyLine = Exp::Break().Matches(INPUT); + bool nextMoreIndented = Exp::Blank().Matches(INPUT); + if (params.fold == FOLD_BLOCK && foldedNewlineCount == 0 && nextEmptyLine) + foldedNewlineStartedMoreIndented = moreIndented; + + // for block scalars, we always start with a newline, so we should ignore it + // (not fold or keep) + if (pastOpeningBreak) { + switch (params.fold) { + case DONT_FOLD: + scalar += "\n"; + break; + case FOLD_BLOCK: + if (!emptyLine && !nextEmptyLine && !moreIndented && + !nextMoreIndented && INPUT.column() >= params.indent) { + scalar += " "; + } else if (nextEmptyLine) { + foldedNewlineCount++; + } else { + scalar += "\n"; + } + + if (!nextEmptyLine && foldedNewlineCount > 0) { + scalar += std::string(foldedNewlineCount - 1, '\n'); + if (foldedNewlineStartedMoreIndented || + nextMoreIndented | !foundNonEmptyLine) { + scalar += "\n"; + } + foldedNewlineCount = 0; + } + break; + case FOLD_FLOW: + if (nextEmptyLine) { + scalar += "\n"; + } else if (!emptyLine && !nextEmptyLine && !escapedNewline) { + scalar += " "; + } + break; + } + } + + emptyLine = nextEmptyLine; + moreIndented = nextMoreIndented; + pastOpeningBreak = true; + + // are we done via indentation? + if (!emptyLine && INPUT.column() < params.indent) { + params.leadingSpaces = true; + break; + } + } + + // post-processing + if (params.trimTrailingSpaces) { + std::size_t pos = scalar.find_last_not_of(' '); + if (lastEscapedChar != std::string::npos) { + if (pos < lastEscapedChar || pos == std::string::npos) { + pos = lastEscapedChar; + } + } + if (pos < scalar.size()) { + scalar.erase(pos + 1); + } + } + + switch (params.chomp) { + case CLIP: { + std::size_t pos = scalar.find_last_not_of('\n'); + if (lastEscapedChar != std::string::npos) { + if (pos < lastEscapedChar || pos == std::string::npos) { + pos = lastEscapedChar; + } + } + if (pos == std::string::npos) { + scalar.erase(); + } else if (pos + 1 < scalar.size()) { + scalar.erase(pos + 2); + } + } break; + case STRIP: { + std::size_t pos = scalar.find_last_not_of('\n'); + if (lastEscapedChar != std::string::npos) { + if (pos < lastEscapedChar || pos == std::string::npos) { + pos = lastEscapedChar; + } + } + if (pos == std::string::npos) { + scalar.erase(); + } else if (pos < scalar.size()) { + scalar.erase(pos + 1); + } + } break; + default: + break; + } + + return scalar; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/scanscalar.h b/runtime/onnxruntime/third_party/yaml-cpp/src/scanscalar.h new file mode 100644 index 0000000..c3a574a --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/scanscalar.h @@ -0,0 +1,63 @@ +#ifndef SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +#include "regex_yaml.h" +#include "stream.h" + +namespace YAML { +enum CHOMP { STRIP = -1, CLIP, KEEP }; +enum ACTION { NONE, BREAK, THROW }; +enum FOLD { DONT_FOLD, FOLD_BLOCK, FOLD_FLOW }; + +struct ScanScalarParams { + ScanScalarParams() + : end(nullptr), + eatEnd(false), + indent(0), + detectIndent(false), + eatLeadingWhitespace(0), + escape(0), + fold(DONT_FOLD), + trimTrailingSpaces(0), + chomp(CLIP), + onDocIndicator(NONE), + onTabInIndentation(NONE), + leadingSpaces(false) {} + + // input: + const RegEx* end; // what condition ends this scalar? + // unowned. + bool eatEnd; // should we eat that condition when we see it? + int indent; // what level of indentation should be eaten and ignored? + bool detectIndent; // should we try to autodetect the indent? + bool eatLeadingWhitespace; // should we continue eating this delicious + // indentation after 'indent' spaces? + char escape; // what character do we escape on (i.e., slash or single quote) + // (0 for none) + FOLD fold; // how do we fold line ends? + bool trimTrailingSpaces; // do we remove all trailing spaces (at the very + // end) + CHOMP chomp; // do we strip, clip, or keep trailing newlines (at the very + // end) + // Note: strip means kill all, clip means keep at most one, keep means keep + // all + ACTION onDocIndicator; // what do we do if we see a document indicator? + ACTION onTabInIndentation; // what do we do if we see a tab where we should + // be seeing indentation spaces + + // output: + bool leadingSpaces; +}; + +std::string ScanScalar(Stream& INPUT, ScanScalarParams& info); +} + +#endif // SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/scantag.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/scantag.cpp new file mode 100644 index 0000000..c5b3965 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/scantag.cpp @@ -0,0 +1,81 @@ +#include "exp.h" +#include "regex_yaml.h" +#include "regeximpl.h" +#include "stream.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep +#include "yaml-cpp/mark.h" + +namespace YAML { +const std::string ScanVerbatimTag(Stream& INPUT) { + std::string tag; + + // eat the start character + INPUT.get(); + + while (INPUT) { + if (INPUT.peek() == Keys::VerbatimTagEnd) { + // eat the end character + INPUT.get(); + return tag; + } + + int n = Exp::URI().Match(INPUT); + if (n <= 0) + break; + + tag += INPUT.get(n); + } + + throw ParserException(INPUT.mark(), ErrorMsg::END_OF_VERBATIM_TAG); +} + +const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle) { + std::string tag; + canBeHandle = true; + Mark firstNonWordChar; + + while (INPUT) { + if (INPUT.peek() == Keys::Tag) { + if (!canBeHandle) + throw ParserException(firstNonWordChar, ErrorMsg::CHAR_IN_TAG_HANDLE); + break; + } + + int n = 0; + if (canBeHandle) { + n = Exp::Word().Match(INPUT); + if (n <= 0) { + canBeHandle = false; + firstNonWordChar = INPUT.mark(); + } + } + + if (!canBeHandle) + n = Exp::Tag().Match(INPUT); + + if (n <= 0) + break; + + tag += INPUT.get(n); + } + + return tag; +} + +const std::string ScanTagSuffix(Stream& INPUT) { + std::string tag; + + while (INPUT) { + int n = Exp::Tag().Match(INPUT); + if (n <= 0) + break; + + tag += INPUT.get(n); + } + + if (tag.empty()) + throw ParserException(INPUT.mark(), ErrorMsg::TAG_WITH_NO_SUFFIX); + + return tag; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/scantag.h b/runtime/onnxruntime/third_party/yaml-cpp/src/scantag.h new file mode 100644 index 0000000..522ba54 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/scantag.h @@ -0,0 +1,19 @@ +#ifndef SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include "stream.h" + +namespace YAML { +const std::string ScanVerbatimTag(Stream& INPUT); +const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle); +const std::string ScanTagSuffix(Stream& INPUT); +} + +#endif // SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/scantoken.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/scantoken.cpp new file mode 100644 index 0000000..fd8758d --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/scantoken.cpp @@ -0,0 +1,437 @@ +#include + +#include "exp.h" +#include "regex_yaml.h" +#include "regeximpl.h" +#include "scanner.h" +#include "scanscalar.h" +#include "scantag.h" // IWYU pragma: keep +#include "tag.h" // IWYU pragma: keep +#include "token.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep +#include "yaml-cpp/mark.h" + +namespace YAML { +/////////////////////////////////////////////////////////////////////// +// Specialization for scanning specific tokens + +// Directive +// . Note: no semantic checking is done here (that's for the parser to do) +void Scanner::ScanDirective() { + std::string name; + std::vector params; + + // pop indents and simple keys + PopAllIndents(); + PopAllSimpleKeys(); + + m_simpleKeyAllowed = false; + m_canBeJSONFlow = false; + + // store pos and eat indicator + Token token(Token::DIRECTIVE, INPUT.mark()); + INPUT.eat(1); + + // read name + while (INPUT && !Exp::BlankOrBreak().Matches(INPUT)) + token.value += INPUT.get(); + + // read parameters + while (1) { + // first get rid of whitespace + while (Exp::Blank().Matches(INPUT)) + INPUT.eat(1); + + // break on newline or comment + if (!INPUT || Exp::Break().Matches(INPUT) || Exp::Comment().Matches(INPUT)) + break; + + // now read parameter + std::string param; + while (INPUT && !Exp::BlankOrBreak().Matches(INPUT)) + param += INPUT.get(); + + token.params.push_back(param); + } + + m_tokens.push(token); +} + +// DocStart +void Scanner::ScanDocStart() { + PopAllIndents(); + PopAllSimpleKeys(); + m_simpleKeyAllowed = false; + m_canBeJSONFlow = false; + + // eat + Mark mark = INPUT.mark(); + INPUT.eat(3); + m_tokens.push(Token(Token::DOC_START, mark)); +} + +// DocEnd +void Scanner::ScanDocEnd() { + PopAllIndents(); + PopAllSimpleKeys(); + m_simpleKeyAllowed = false; + m_canBeJSONFlow = false; + + // eat + Mark mark = INPUT.mark(); + INPUT.eat(3); + m_tokens.push(Token(Token::DOC_END, mark)); +} + +// FlowStart +void Scanner::ScanFlowStart() { + // flows can be simple keys + InsertPotentialSimpleKey(); + m_simpleKeyAllowed = true; + m_canBeJSONFlow = false; + + // eat + Mark mark = INPUT.mark(); + char ch = INPUT.get(); + FLOW_MARKER flowType = (ch == Keys::FlowSeqStart ? FLOW_SEQ : FLOW_MAP); + m_flows.push(flowType); + Token::TYPE type = + (flowType == FLOW_SEQ ? Token::FLOW_SEQ_START : Token::FLOW_MAP_START); + m_tokens.push(Token(type, mark)); +} + +// FlowEnd +void Scanner::ScanFlowEnd() { + if (InBlockContext()) + throw ParserException(INPUT.mark(), ErrorMsg::FLOW_END); + + // we might have a solo entry in the flow context + if (InFlowContext()) { + if (m_flows.top() == FLOW_MAP && VerifySimpleKey()) + m_tokens.push(Token(Token::VALUE, INPUT.mark())); + else if (m_flows.top() == FLOW_SEQ) + InvalidateSimpleKey(); + } + + m_simpleKeyAllowed = false; + m_canBeJSONFlow = true; + + // eat + Mark mark = INPUT.mark(); + char ch = INPUT.get(); + + // check that it matches the start + FLOW_MARKER flowType = (ch == Keys::FlowSeqEnd ? FLOW_SEQ : FLOW_MAP); + if (m_flows.top() != flowType) + throw ParserException(mark, ErrorMsg::FLOW_END); + m_flows.pop(); + + Token::TYPE type = (flowType ? Token::FLOW_SEQ_END : Token::FLOW_MAP_END); + m_tokens.push(Token(type, mark)); +} + +// FlowEntry +void Scanner::ScanFlowEntry() { + // we might have a solo entry in the flow context + if (InFlowContext()) { + if (m_flows.top() == FLOW_MAP && VerifySimpleKey()) + m_tokens.push(Token(Token::VALUE, INPUT.mark())); + else if (m_flows.top() == FLOW_SEQ) + InvalidateSimpleKey(); + } + + m_simpleKeyAllowed = true; + m_canBeJSONFlow = false; + + // eat + Mark mark = INPUT.mark(); + INPUT.eat(1); + m_tokens.push(Token(Token::FLOW_ENTRY, mark)); +} + +// BlockEntry +void Scanner::ScanBlockEntry() { + // we better be in the block context! + if (InFlowContext()) + throw ParserException(INPUT.mark(), ErrorMsg::BLOCK_ENTRY); + + // can we put it here? + if (!m_simpleKeyAllowed) + throw ParserException(INPUT.mark(), ErrorMsg::BLOCK_ENTRY); + + PushIndentTo(INPUT.column(), IndentMarker::SEQ); + m_simpleKeyAllowed = true; + m_canBeJSONFlow = false; + + // eat + Mark mark = INPUT.mark(); + INPUT.eat(1); + m_tokens.push(Token(Token::BLOCK_ENTRY, mark)); +} + +// Key +void Scanner::ScanKey() { + // handle keys diffently in the block context (and manage indents) + if (InBlockContext()) { + if (!m_simpleKeyAllowed) + throw ParserException(INPUT.mark(), ErrorMsg::MAP_KEY); + + PushIndentTo(INPUT.column(), IndentMarker::MAP); + } + + // can only put a simple key here if we're in block context + m_simpleKeyAllowed = InBlockContext(); + + // eat + Mark mark = INPUT.mark(); + INPUT.eat(1); + m_tokens.push(Token(Token::KEY, mark)); +} + +// Value +void Scanner::ScanValue() { + // and check that simple key + bool isSimpleKey = VerifySimpleKey(); + m_canBeJSONFlow = false; + + if (isSimpleKey) { + // can't follow a simple key with another simple key (dunno why, though - it + // seems fine) + m_simpleKeyAllowed = false; + } else { + // handle values diffently in the block context (and manage indents) + if (InBlockContext()) { + if (!m_simpleKeyAllowed) + throw ParserException(INPUT.mark(), ErrorMsg::MAP_VALUE); + + PushIndentTo(INPUT.column(), IndentMarker::MAP); + } + + // can only put a simple key here if we're in block context + m_simpleKeyAllowed = InBlockContext(); + } + + // eat + Mark mark = INPUT.mark(); + INPUT.eat(1); + m_tokens.push(Token(Token::VALUE, mark)); +} + +// AnchorOrAlias +void Scanner::ScanAnchorOrAlias() { + bool alias; + std::string name; + + // insert a potential simple key + InsertPotentialSimpleKey(); + m_simpleKeyAllowed = false; + m_canBeJSONFlow = false; + + // eat the indicator + Mark mark = INPUT.mark(); + char indicator = INPUT.get(); + alias = (indicator == Keys::Alias); + + // now eat the content + while (INPUT && Exp::Anchor().Matches(INPUT)) + name += INPUT.get(); + + // we need to have read SOMETHING! + if (name.empty()) + throw ParserException(INPUT.mark(), alias ? ErrorMsg::ALIAS_NOT_FOUND + : ErrorMsg::ANCHOR_NOT_FOUND); + + // and needs to end correctly + if (INPUT && !Exp::AnchorEnd().Matches(INPUT)) + throw ParserException(INPUT.mark(), alias ? ErrorMsg::CHAR_IN_ALIAS + : ErrorMsg::CHAR_IN_ANCHOR); + + // and we're done + Token token(alias ? Token::ALIAS : Token::ANCHOR, mark); + token.value = name; + m_tokens.push(token); +} + +// Tag +void Scanner::ScanTag() { + // insert a potential simple key + InsertPotentialSimpleKey(); + m_simpleKeyAllowed = false; + m_canBeJSONFlow = false; + + Token token(Token::TAG, INPUT.mark()); + + // eat the indicator + INPUT.get(); + + if (INPUT && INPUT.peek() == Keys::VerbatimTagStart) { + std::string tag = ScanVerbatimTag(INPUT); + + token.value = tag; + token.data = Tag::VERBATIM; + } else { + bool canBeHandle; + token.value = ScanTagHandle(INPUT, canBeHandle); + if (!canBeHandle && token.value.empty()) + token.data = Tag::NON_SPECIFIC; + else if (token.value.empty()) + token.data = Tag::SECONDARY_HANDLE; + else + token.data = Tag::PRIMARY_HANDLE; + + // is there a suffix? + if (canBeHandle && INPUT.peek() == Keys::Tag) { + // eat the indicator + INPUT.get(); + token.params.push_back(ScanTagSuffix(INPUT)); + token.data = Tag::NAMED_HANDLE; + } + } + + m_tokens.push(token); +} + +// PlainScalar +void Scanner::ScanPlainScalar() { + std::string scalar; + + // set up the scanning parameters + ScanScalarParams params; + params.end = + (InFlowContext() ? &Exp::ScanScalarEndInFlow() : &Exp::ScanScalarEnd()); + params.eatEnd = false; + params.indent = (InFlowContext() ? 0 : GetTopIndent() + 1); + params.fold = FOLD_FLOW; + params.eatLeadingWhitespace = true; + params.trimTrailingSpaces = true; + params.chomp = STRIP; + params.onDocIndicator = BREAK; + params.onTabInIndentation = THROW; + + // insert a potential simple key + InsertPotentialSimpleKey(); + + Mark mark = INPUT.mark(); + scalar = ScanScalar(INPUT, params); + + // can have a simple key only if we ended the scalar by starting a new line + m_simpleKeyAllowed = params.leadingSpaces; + m_canBeJSONFlow = false; + + // finally, check and see if we ended on an illegal character + // if(Exp::IllegalCharInScalar.Matches(INPUT)) + // throw ParserException(INPUT.mark(), ErrorMsg::CHAR_IN_SCALAR); + + Token token(Token::PLAIN_SCALAR, mark); + token.value = scalar; + m_tokens.push(token); +} + +// QuotedScalar +void Scanner::ScanQuotedScalar() { + std::string scalar; + + // peek at single or double quote (don't eat because we need to preserve (for + // the time being) the input position) + char quote = INPUT.peek(); + bool single = (quote == '\''); + + // setup the scanning parameters + ScanScalarParams params; + RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote)); + params.end = &end; + params.eatEnd = true; + params.escape = (single ? '\'' : '\\'); + params.indent = 0; + params.fold = FOLD_FLOW; + params.eatLeadingWhitespace = true; + params.trimTrailingSpaces = false; + params.chomp = CLIP; + params.onDocIndicator = THROW; + + // insert a potential simple key + InsertPotentialSimpleKey(); + + Mark mark = INPUT.mark(); + + // now eat that opening quote + INPUT.get(); + + // and scan + scalar = ScanScalar(INPUT, params); + m_simpleKeyAllowed = false; + m_canBeJSONFlow = true; + + Token token(Token::NON_PLAIN_SCALAR, mark); + token.value = scalar; + m_tokens.push(token); +} + +// BlockScalarToken +// . These need a little extra processing beforehand. +// . We need to scan the line where the indicator is (this doesn't count as part +// of the scalar), +// and then we need to figure out what level of indentation we'll be using. +void Scanner::ScanBlockScalar() { + std::string scalar; + + ScanScalarParams params; + params.indent = 1; + params.detectIndent = true; + + // eat block indicator ('|' or '>') + Mark mark = INPUT.mark(); + char indicator = INPUT.get(); + params.fold = (indicator == Keys::FoldedScalar ? FOLD_BLOCK : DONT_FOLD); + + // eat chomping/indentation indicators + params.chomp = CLIP; + int n = Exp::Chomp().Match(INPUT); + for (int i = 0; i < n; i++) { + char ch = INPUT.get(); + if (ch == '+') + params.chomp = KEEP; + else if (ch == '-') + params.chomp = STRIP; + else if (Exp::Digit().Matches(ch)) { + if (ch == '0') + throw ParserException(INPUT.mark(), ErrorMsg::ZERO_INDENT_IN_BLOCK); + + params.indent = ch - '0'; + params.detectIndent = false; + } + } + + // now eat whitespace + while (Exp::Blank().Matches(INPUT)) + INPUT.eat(1); + + // and comments to the end of the line + if (Exp::Comment().Matches(INPUT)) + while (INPUT && !Exp::Break().Matches(INPUT)) + INPUT.eat(1); + + // if it's not a line break, then we ran into a bad character inline + if (INPUT && !Exp::Break().Matches(INPUT)) + throw ParserException(INPUT.mark(), ErrorMsg::CHAR_IN_BLOCK); + + // set the initial indentation + if (GetTopIndent() >= 0) + params.indent += GetTopIndent(); + + params.eatLeadingWhitespace = false; + params.trimTrailingSpaces = false; + params.onTabInIndentation = THROW; + + scalar = ScanScalar(INPUT, params); + + // simple keys always ok after block scalars (since we're gonna start a new + // line anyways) + m_simpleKeyAllowed = true; + m_canBeJSONFlow = false; + + Token token(Token::NON_PLAIN_SCALAR, mark); + token.value = scalar; + m_tokens.push(token); +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/setting.h b/runtime/onnxruntime/third_party/yaml-cpp/src/setting.h new file mode 100644 index 0000000..b78d40e --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/setting.h @@ -0,0 +1,95 @@ +#ifndef SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include "yaml-cpp/noncopyable.h" + +namespace YAML { +class SettingChangeBase; + +template +class Setting { + public: + Setting() : m_value() {} + + const T get() const { return m_value; } + std::unique_ptr set(const T& value); + void restore(const Setting& oldSetting) { m_value = oldSetting.get(); } + + private: + T m_value; +}; + +class SettingChangeBase { + public: + virtual ~SettingChangeBase() {} + virtual void pop() = 0; +}; + +template +class SettingChange : public SettingChangeBase { + public: + SettingChange(Setting* pSetting) : m_pCurSetting(pSetting) { + // copy old setting to save its state + m_oldSetting = *pSetting; + } + + virtual void pop() { m_pCurSetting->restore(m_oldSetting); } + + private: + Setting* m_pCurSetting; + Setting m_oldSetting; +}; + +template +inline std::unique_ptr Setting::set(const T& value) { + std::unique_ptr pChange(new SettingChange(this)); + m_value = value; + return pChange; +} + +class SettingChanges : private noncopyable { + public: + SettingChanges() {} + ~SettingChanges() { clear(); } + + void clear() { + restore(); + m_settingChanges.clear(); + } + + void restore() { + for (setting_changes::const_iterator it = m_settingChanges.begin(); + it != m_settingChanges.end(); ++it) + (*it)->pop(); + } + + void push(std::unique_ptr pSettingChange) { + m_settingChanges.push_back(std::move(pSettingChange)); + } + + // like std::unique_ptr - assignment is transfer of ownership + SettingChanges& operator=(SettingChanges&& rhs) { + if (this == &rhs) + return *this; + + clear(); + std::swap(m_settingChanges, rhs.m_settingChanges); + + return *this; + } + + private: + typedef std::vector> setting_changes; + setting_changes m_settingChanges; +}; +} + +#endif // SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/simplekey.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/simplekey.cpp new file mode 100644 index 0000000..70f56b6 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/simplekey.cpp @@ -0,0 +1,128 @@ +#include "scanner.h" +#include "token.h" + +namespace YAML { +struct Mark; + +Scanner::SimpleKey::SimpleKey(const Mark& mark_, std::size_t flowLevel_) + : mark(mark_), flowLevel(flowLevel_), pIndent(0), pMapStart(0), pKey(0) {} + +void Scanner::SimpleKey::Validate() { + // Note: pIndent will *not* be garbage here; + // we "garbage collect" them so we can + // always refer to them + if (pIndent) + pIndent->status = IndentMarker::VALID; + if (pMapStart) + pMapStart->status = Token::VALID; + if (pKey) + pKey->status = Token::VALID; +} + +void Scanner::SimpleKey::Invalidate() { + if (pIndent) + pIndent->status = IndentMarker::INVALID; + if (pMapStart) + pMapStart->status = Token::INVALID; + if (pKey) + pKey->status = Token::INVALID; +} + +// CanInsertPotentialSimpleKey +bool Scanner::CanInsertPotentialSimpleKey() const { + if (!m_simpleKeyAllowed) + return false; + + return !ExistsActiveSimpleKey(); +} + +// ExistsActiveSimpleKey +// . Returns true if there's a potential simple key at our flow level +// (there's allowed at most one per flow level, i.e., at the start of the flow +// start token) +bool Scanner::ExistsActiveSimpleKey() const { + if (m_simpleKeys.empty()) + return false; + + const SimpleKey& key = m_simpleKeys.top(); + return key.flowLevel == GetFlowLevel(); +} + +// InsertPotentialSimpleKey +// . If we can, add a potential simple key to the queue, +// and save it on a stack. +void Scanner::InsertPotentialSimpleKey() { + if (!CanInsertPotentialSimpleKey()) + return; + + SimpleKey key(INPUT.mark(), GetFlowLevel()); + + // first add a map start, if necessary + if (InBlockContext()) { + key.pIndent = PushIndentTo(INPUT.column(), IndentMarker::MAP); + if (key.pIndent) { + key.pIndent->status = IndentMarker::UNKNOWN; + key.pMapStart = key.pIndent->pStartToken; + key.pMapStart->status = Token::UNVERIFIED; + } + } + + // then add the (now unverified) key + m_tokens.push(Token(Token::KEY, INPUT.mark())); + key.pKey = &m_tokens.back(); + key.pKey->status = Token::UNVERIFIED; + + m_simpleKeys.push(key); +} + +// InvalidateSimpleKey +// . Automatically invalidate the simple key in our flow level +void Scanner::InvalidateSimpleKey() { + if (m_simpleKeys.empty()) + return; + + // grab top key + SimpleKey& key = m_simpleKeys.top(); + if (key.flowLevel != GetFlowLevel()) + return; + + key.Invalidate(); + m_simpleKeys.pop(); +} + +// VerifySimpleKey +// . Determines whether the latest simple key to be added is valid, +// and if so, makes it valid. +bool Scanner::VerifySimpleKey() { + if (m_simpleKeys.empty()) + return false; + + // grab top key + SimpleKey key = m_simpleKeys.top(); + + // only validate if we're in the correct flow level + if (key.flowLevel != GetFlowLevel()) + return false; + + m_simpleKeys.pop(); + + bool isValid = true; + + // needs to be less than 1024 characters and inline + if (INPUT.line() != key.mark.line || INPUT.pos() - key.mark.pos > 1024) + isValid = false; + + // invalidate key + if (isValid) + key.Validate(); + else + key.Invalidate(); + + return isValid; +} + +void Scanner::PopAllSimpleKeys() { + while (!m_simpleKeys.empty()) + m_simpleKeys.pop(); +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/singledocparser.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/singledocparser.cpp new file mode 100644 index 0000000..a27c1c3 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/singledocparser.cpp @@ -0,0 +1,414 @@ +#include +#include +#include + +#include "collectionstack.h" // IWYU pragma: keep +#include "scanner.h" +#include "singledocparser.h" +#include "tag.h" +#include "token.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/eventhandler.h" +#include "yaml-cpp/exceptions.h" // IWYU pragma: keep +#include "yaml-cpp/mark.h" +#include "yaml-cpp/null.h" + +namespace YAML { +SingleDocParser::SingleDocParser(Scanner& scanner, const Directives& directives) + : m_scanner(scanner), + m_directives(directives), + m_pCollectionStack(new CollectionStack), + m_curAnchor(0) {} + +SingleDocParser::~SingleDocParser() {} + +// HandleDocument +// . Handles the next document +// . Throws a ParserException on error. +void SingleDocParser::HandleDocument(EventHandler& eventHandler) { + assert(!m_scanner.empty()); // guaranteed that there are tokens + assert(!m_curAnchor); + + eventHandler.OnDocumentStart(m_scanner.peek().mark); + + // eat doc start + if (m_scanner.peek().type == Token::DOC_START) + m_scanner.pop(); + + // recurse! + HandleNode(eventHandler); + + eventHandler.OnDocumentEnd(); + + // and finally eat any doc ends we see + while (!m_scanner.empty() && m_scanner.peek().type == Token::DOC_END) + m_scanner.pop(); +} + +void SingleDocParser::HandleNode(EventHandler& eventHandler) { + // an empty node *is* a possibility + if (m_scanner.empty()) { + eventHandler.OnNull(m_scanner.mark(), NullAnchor); + return; + } + + // save location + Mark mark = m_scanner.peek().mark; + + // special case: a value node by itself must be a map, with no header + if (m_scanner.peek().type == Token::VALUE) { + eventHandler.OnMapStart(mark, "?", NullAnchor, EmitterStyle::Default); + HandleMap(eventHandler); + eventHandler.OnMapEnd(); + return; + } + + // special case: an alias node + if (m_scanner.peek().type == Token::ALIAS) { + eventHandler.OnAlias(mark, LookupAnchor(mark, m_scanner.peek().value)); + m_scanner.pop(); + return; + } + + std::string tag; + anchor_t anchor; + ParseProperties(tag, anchor); + + const Token& token = m_scanner.peek(); + + if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) { + eventHandler.OnNull(mark, anchor); + m_scanner.pop(); + return; + } + + // add non-specific tags + if (tag.empty()) + tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?"); + + // now split based on what kind of node we should be + switch (token.type) { + case Token::PLAIN_SCALAR: + case Token::NON_PLAIN_SCALAR: + eventHandler.OnScalar(mark, tag, anchor, token.value); + m_scanner.pop(); + return; + case Token::FLOW_SEQ_START: + eventHandler.OnSequenceStart(mark, tag, anchor, EmitterStyle::Flow); + HandleSequence(eventHandler); + eventHandler.OnSequenceEnd(); + return; + case Token::BLOCK_SEQ_START: + eventHandler.OnSequenceStart(mark, tag, anchor, EmitterStyle::Block); + HandleSequence(eventHandler); + eventHandler.OnSequenceEnd(); + return; + case Token::FLOW_MAP_START: + eventHandler.OnMapStart(mark, tag, anchor, EmitterStyle::Flow); + HandleMap(eventHandler); + eventHandler.OnMapEnd(); + return; + case Token::BLOCK_MAP_START: + eventHandler.OnMapStart(mark, tag, anchor, EmitterStyle::Block); + HandleMap(eventHandler); + eventHandler.OnMapEnd(); + return; + case Token::KEY: + // compact maps can only go in a flow sequence + if (m_pCollectionStack->GetCurCollectionType() == + CollectionType::FlowSeq) { + eventHandler.OnMapStart(mark, tag, anchor, EmitterStyle::Flow); + HandleMap(eventHandler); + eventHandler.OnMapEnd(); + return; + } + break; + default: + break; + } + + if (tag == "?") + eventHandler.OnNull(mark, anchor); + else + eventHandler.OnScalar(mark, tag, anchor, ""); +} + +void SingleDocParser::HandleSequence(EventHandler& eventHandler) { + // split based on start token + switch (m_scanner.peek().type) { + case Token::BLOCK_SEQ_START: + HandleBlockSequence(eventHandler); + break; + case Token::FLOW_SEQ_START: + HandleFlowSequence(eventHandler); + break; + default: + break; + } +} + +void SingleDocParser::HandleBlockSequence(EventHandler& eventHandler) { + // eat start token + m_scanner.pop(); + m_pCollectionStack->PushCollectionType(CollectionType::BlockSeq); + + while (1) { + if (m_scanner.empty()) + throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_SEQ); + + Token token = m_scanner.peek(); + if (token.type != Token::BLOCK_ENTRY && token.type != Token::BLOCK_SEQ_END) + throw ParserException(token.mark, ErrorMsg::END_OF_SEQ); + + m_scanner.pop(); + if (token.type == Token::BLOCK_SEQ_END) + break; + + // check for null + if (!m_scanner.empty()) { + const Token& token = m_scanner.peek(); + if (token.type == Token::BLOCK_ENTRY || + token.type == Token::BLOCK_SEQ_END) { + eventHandler.OnNull(token.mark, NullAnchor); + continue; + } + } + + HandleNode(eventHandler); + } + + m_pCollectionStack->PopCollectionType(CollectionType::BlockSeq); +} + +void SingleDocParser::HandleFlowSequence(EventHandler& eventHandler) { + // eat start token + m_scanner.pop(); + m_pCollectionStack->PushCollectionType(CollectionType::FlowSeq); + + while (1) { + if (m_scanner.empty()) + throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_SEQ_FLOW); + + // first check for end + if (m_scanner.peek().type == Token::FLOW_SEQ_END) { + m_scanner.pop(); + break; + } + + // then read the node + HandleNode(eventHandler); + + if (m_scanner.empty()) + throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_SEQ_FLOW); + + // now eat the separator (or could be a sequence end, which we ignore - but + // if it's neither, then it's a bad node) + Token& token = m_scanner.peek(); + if (token.type == Token::FLOW_ENTRY) + m_scanner.pop(); + else if (token.type != Token::FLOW_SEQ_END) + throw ParserException(token.mark, ErrorMsg::END_OF_SEQ_FLOW); + } + + m_pCollectionStack->PopCollectionType(CollectionType::FlowSeq); +} + +void SingleDocParser::HandleMap(EventHandler& eventHandler) { + // split based on start token + switch (m_scanner.peek().type) { + case Token::BLOCK_MAP_START: + HandleBlockMap(eventHandler); + break; + case Token::FLOW_MAP_START: + HandleFlowMap(eventHandler); + break; + case Token::KEY: + HandleCompactMap(eventHandler); + break; + case Token::VALUE: + HandleCompactMapWithNoKey(eventHandler); + break; + default: + break; + } +} + +void SingleDocParser::HandleBlockMap(EventHandler& eventHandler) { + // eat start token + m_scanner.pop(); + m_pCollectionStack->PushCollectionType(CollectionType::BlockMap); + + while (1) { + if (m_scanner.empty()) + throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP); + + Token token = m_scanner.peek(); + if (token.type != Token::KEY && token.type != Token::VALUE && + token.type != Token::BLOCK_MAP_END) + throw ParserException(token.mark, ErrorMsg::END_OF_MAP); + + if (token.type == Token::BLOCK_MAP_END) { + m_scanner.pop(); + break; + } + + // grab key (if non-null) + if (token.type == Token::KEY) { + m_scanner.pop(); + HandleNode(eventHandler); + } else { + eventHandler.OnNull(token.mark, NullAnchor); + } + + // now grab value (optional) + if (!m_scanner.empty() && m_scanner.peek().type == Token::VALUE) { + m_scanner.pop(); + HandleNode(eventHandler); + } else { + eventHandler.OnNull(token.mark, NullAnchor); + } + } + + m_pCollectionStack->PopCollectionType(CollectionType::BlockMap); +} + +void SingleDocParser::HandleFlowMap(EventHandler& eventHandler) { + // eat start token + m_scanner.pop(); + m_pCollectionStack->PushCollectionType(CollectionType::FlowMap); + + while (1) { + if (m_scanner.empty()) + throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP_FLOW); + + Token& token = m_scanner.peek(); + const Mark mark = token.mark; + // first check for end + if (token.type == Token::FLOW_MAP_END) { + m_scanner.pop(); + break; + } + + // grab key (if non-null) + if (token.type == Token::KEY) { + m_scanner.pop(); + HandleNode(eventHandler); + } else { + eventHandler.OnNull(mark, NullAnchor); + } + + // now grab value (optional) + if (!m_scanner.empty() && m_scanner.peek().type == Token::VALUE) { + m_scanner.pop(); + HandleNode(eventHandler); + } else { + eventHandler.OnNull(mark, NullAnchor); + } + + if (m_scanner.empty()) + throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP_FLOW); + + // now eat the separator (or could be a map end, which we ignore - but if + // it's neither, then it's a bad node) + Token& nextToken = m_scanner.peek(); + if (nextToken.type == Token::FLOW_ENTRY) + m_scanner.pop(); + else if (nextToken.type != Token::FLOW_MAP_END) + throw ParserException(nextToken.mark, ErrorMsg::END_OF_MAP_FLOW); + } + + m_pCollectionStack->PopCollectionType(CollectionType::FlowMap); +} + +// . Single "key: value" pair in a flow sequence +void SingleDocParser::HandleCompactMap(EventHandler& eventHandler) { + m_pCollectionStack->PushCollectionType(CollectionType::CompactMap); + + // grab key + Mark mark = m_scanner.peek().mark; + m_scanner.pop(); + HandleNode(eventHandler); + + // now grab value (optional) + if (!m_scanner.empty() && m_scanner.peek().type == Token::VALUE) { + m_scanner.pop(); + HandleNode(eventHandler); + } else { + eventHandler.OnNull(mark, NullAnchor); + } + + m_pCollectionStack->PopCollectionType(CollectionType::CompactMap); +} + +// . Single ": value" pair in a flow sequence +void SingleDocParser::HandleCompactMapWithNoKey(EventHandler& eventHandler) { + m_pCollectionStack->PushCollectionType(CollectionType::CompactMap); + + // null key + eventHandler.OnNull(m_scanner.peek().mark, NullAnchor); + + // grab value + m_scanner.pop(); + HandleNode(eventHandler); + + m_pCollectionStack->PopCollectionType(CollectionType::CompactMap); +} + +// ParseProperties +// . Grabs any tag or anchor tokens and deals with them. +void SingleDocParser::ParseProperties(std::string& tag, anchor_t& anchor) { + tag.clear(); + anchor = NullAnchor; + + while (1) { + if (m_scanner.empty()) + return; + + switch (m_scanner.peek().type) { + case Token::TAG: + ParseTag(tag); + break; + case Token::ANCHOR: + ParseAnchor(anchor); + break; + default: + return; + } + } +} + +void SingleDocParser::ParseTag(std::string& tag) { + Token& token = m_scanner.peek(); + if (!tag.empty()) + throw ParserException(token.mark, ErrorMsg::MULTIPLE_TAGS); + + Tag tagInfo(token); + tag = tagInfo.Translate(m_directives); + m_scanner.pop(); +} + +void SingleDocParser::ParseAnchor(anchor_t& anchor) { + Token& token = m_scanner.peek(); + if (anchor) + throw ParserException(token.mark, ErrorMsg::MULTIPLE_ANCHORS); + + anchor = RegisterAnchor(token.value); + m_scanner.pop(); +} + +anchor_t SingleDocParser::RegisterAnchor(const std::string& name) { + if (name.empty()) + return NullAnchor; + + return m_anchors[name] = ++m_curAnchor; +} + +anchor_t SingleDocParser::LookupAnchor(const Mark& mark, + const std::string& name) const { + Anchors::const_iterator it = m_anchors.find(name); + if (it == m_anchors.end()) + throw ParserException(mark, ErrorMsg::UNKNOWN_ANCHOR); + + return it->second; +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/singledocparser.h b/runtime/onnxruntime/third_party/yaml-cpp/src/singledocparser.h new file mode 100644 index 0000000..2b92067 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/singledocparser.h @@ -0,0 +1,65 @@ +#ifndef SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include +#include +#include + +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/noncopyable.h" + +namespace YAML { +class CollectionStack; +class EventHandler; +class Node; +class Scanner; +struct Directives; +struct Mark; +struct Token; + +class SingleDocParser : private noncopyable { + public: + SingleDocParser(Scanner& scanner, const Directives& directives); + ~SingleDocParser(); + + void HandleDocument(EventHandler& eventHandler); + + private: + void HandleNode(EventHandler& eventHandler); + + void HandleSequence(EventHandler& eventHandler); + void HandleBlockSequence(EventHandler& eventHandler); + void HandleFlowSequence(EventHandler& eventHandler); + + void HandleMap(EventHandler& eventHandler); + void HandleBlockMap(EventHandler& eventHandler); + void HandleFlowMap(EventHandler& eventHandler); + void HandleCompactMap(EventHandler& eventHandler); + void HandleCompactMapWithNoKey(EventHandler& eventHandler); + + void ParseProperties(std::string& tag, anchor_t& anchor); + void ParseTag(std::string& tag); + void ParseAnchor(anchor_t& anchor); + + anchor_t RegisterAnchor(const std::string& name); + anchor_t LookupAnchor(const Mark& mark, const std::string& name) const; + + private: + Scanner& m_scanner; + const Directives& m_directives; + std::unique_ptr m_pCollectionStack; + + typedef std::map Anchors; + Anchors m_anchors; + + anchor_t m_curAnchor; +}; +} + +#endif // SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/stream.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/stream.cpp new file mode 100644 index 0000000..3b013cf --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/stream.cpp @@ -0,0 +1,448 @@ +#include + +#include "stream.h" + +#ifndef YAML_PREFETCH_SIZE +#define YAML_PREFETCH_SIZE 2048 +#endif + +#define S_ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A))) +#define S_ARRAY_END(A) ((A) + S_ARRAY_SIZE(A)) + +#define CP_REPLACEMENT_CHARACTER (0xFFFD) + +namespace YAML { +enum UtfIntroState { + uis_start, + uis_utfbe_b1, + uis_utf32be_b2, + uis_utf32be_bom3, + uis_utf32be, + uis_utf16be, + uis_utf16be_bom1, + uis_utfle_bom1, + uis_utf16le_bom2, + uis_utf32le_bom3, + uis_utf16le, + uis_utf32le, + uis_utf8_imp, + uis_utf16le_imp, + uis_utf32le_imp3, + uis_utf8_bom1, + uis_utf8_bom2, + uis_utf8, + uis_error +}; + +enum UtfIntroCharType { + uict00, + uictBB, + uictBF, + uictEF, + uictFE, + uictFF, + uictAscii, + uictOther, + uictMax +}; + +static bool s_introFinalState[] = { + false, // uis_start + false, // uis_utfbe_b1 + false, // uis_utf32be_b2 + false, // uis_utf32be_bom3 + true, // uis_utf32be + true, // uis_utf16be + false, // uis_utf16be_bom1 + false, // uis_utfle_bom1 + false, // uis_utf16le_bom2 + false, // uis_utf32le_bom3 + true, // uis_utf16le + true, // uis_utf32le + false, // uis_utf8_imp + false, // uis_utf16le_imp + false, // uis_utf32le_imp3 + false, // uis_utf8_bom1 + false, // uis_utf8_bom2 + true, // uis_utf8 + true, // uis_error +}; + +static UtfIntroState s_introTransitions[][uictMax] = { + // uict00, uictBB, uictBF, uictEF, + // uictFE, uictFF, uictAscii, uictOther + {uis_utfbe_b1, uis_utf8, uis_utf8, uis_utf8_bom1, uis_utf16be_bom1, + uis_utfle_bom1, uis_utf8_imp, uis_utf8}, + {uis_utf32be_b2, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, + uis_utf16be, uis_utf8}, + {uis_utf32be, uis_utf8, uis_utf8, uis_utf8, uis_utf32be_bom3, uis_utf8, + uis_utf8, uis_utf8}, + {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf32be, uis_utf8, + uis_utf8}, + {uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be, + uis_utf32be, uis_utf32be, uis_utf32be}, + {uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be, + uis_utf16be, uis_utf16be, uis_utf16be}, + {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf16be, uis_utf8, + uis_utf8}, + {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf16le_bom2, uis_utf8, + uis_utf8, uis_utf8}, + {uis_utf32le_bom3, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, + uis_utf16le, uis_utf16le, uis_utf16le}, + {uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, + uis_utf16le, uis_utf16le, uis_utf16le}, + {uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, + uis_utf16le, uis_utf16le, uis_utf16le}, + {uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le, + uis_utf32le, uis_utf32le, uis_utf32le}, + {uis_utf16le_imp, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, + uis_utf8, uis_utf8}, + {uis_utf32le_imp3, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, + uis_utf16le, uis_utf16le, uis_utf16le}, + {uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, + uis_utf16le, uis_utf16le, uis_utf16le}, + {uis_utf8, uis_utf8_bom2, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, + uis_utf8}, + {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, + uis_utf8}, + {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, + uis_utf8}, +}; + +static char s_introUngetCount[][uictMax] = { + // uict00, uictBB, uictBF, uictEF, uictFE, uictFF, uictAscii, uictOther + {0, 1, 1, 0, 0, 0, 0, 1}, + {0, 2, 2, 2, 2, 2, 2, 2}, + {3, 3, 3, 3, 0, 3, 3, 3}, + {4, 4, 4, 4, 4, 0, 4, 4}, + {1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1}, + {2, 2, 2, 2, 2, 0, 2, 2}, + {2, 2, 2, 2, 0, 2, 2, 2}, + {0, 1, 1, 1, 1, 1, 1, 1}, + {0, 2, 2, 2, 2, 2, 2, 2}, + {1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1}, + {0, 2, 2, 2, 2, 2, 2, 2}, + {0, 3, 3, 3, 3, 3, 3, 3}, + {4, 4, 4, 4, 4, 4, 4, 4}, + {2, 0, 2, 2, 2, 2, 2, 2}, + {3, 3, 0, 3, 3, 3, 3, 3}, + {1, 1, 1, 1, 1, 1, 1, 1}, +}; + +inline UtfIntroCharType IntroCharTypeOf(std::istream::int_type ch) { + if (std::istream::traits_type::eof() == ch) { + return uictOther; + } + + switch (ch) { + case 0: + return uict00; + case 0xBB: + return uictBB; + case 0xBF: + return uictBF; + case 0xEF: + return uictEF; + case 0xFE: + return uictFE; + case 0xFF: + return uictFF; + } + + if ((ch > 0) && (ch < 0xFF)) { + return uictAscii; + } + + return uictOther; +} + +inline char Utf8Adjust(unsigned long ch, unsigned char lead_bits, + unsigned char rshift) { + const unsigned char header = ((1 << lead_bits) - 1) << (8 - lead_bits); + const unsigned char mask = (0xFF >> (lead_bits + 1)); + return static_cast( + static_cast(header | ((ch >> rshift) & mask))); +} + +inline void QueueUnicodeCodepoint(std::deque& q, unsigned long ch) { + // We are not allowed to queue the Stream::eof() codepoint, so + // replace it with CP_REPLACEMENT_CHARACTER + if (static_cast(Stream::eof()) == ch) { + ch = CP_REPLACEMENT_CHARACTER; + } + + if (ch < 0x80) { + q.push_back(Utf8Adjust(ch, 0, 0)); + } else if (ch < 0x800) { + q.push_back(Utf8Adjust(ch, 2, 6)); + q.push_back(Utf8Adjust(ch, 1, 0)); + } else if (ch < 0x10000) { + q.push_back(Utf8Adjust(ch, 3, 12)); + q.push_back(Utf8Adjust(ch, 1, 6)); + q.push_back(Utf8Adjust(ch, 1, 0)); + } else { + q.push_back(Utf8Adjust(ch, 4, 18)); + q.push_back(Utf8Adjust(ch, 1, 12)); + q.push_back(Utf8Adjust(ch, 1, 6)); + q.push_back(Utf8Adjust(ch, 1, 0)); + } +} + +Stream::Stream(std::istream& input) + : m_input(input), + m_pPrefetched(new unsigned char[YAML_PREFETCH_SIZE]), + m_nPrefetchedAvailable(0), + m_nPrefetchedUsed(0) { + typedef std::istream::traits_type char_traits; + + if (!input) + return; + + // Determine (or guess) the character-set by reading the BOM, if any. See + // the YAML specification for the determination algorithm. + char_traits::int_type intro[4]; + int nIntroUsed = 0; + UtfIntroState state = uis_start; + for (; !s_introFinalState[state];) { + std::istream::int_type ch = input.get(); + intro[nIntroUsed++] = ch; + UtfIntroCharType charType = IntroCharTypeOf(ch); + UtfIntroState newState = s_introTransitions[state][charType]; + int nUngets = s_introUngetCount[state][charType]; + if (nUngets > 0) { + input.clear(); + for (; nUngets > 0; --nUngets) { + if (char_traits::eof() != intro[--nIntroUsed]) + input.putback(char_traits::to_char_type(intro[nIntroUsed])); + } + } + state = newState; + } + + switch (state) { + case uis_utf8: + m_charSet = utf8; + break; + case uis_utf16le: + m_charSet = utf16le; + break; + case uis_utf16be: + m_charSet = utf16be; + break; + case uis_utf32le: + m_charSet = utf32le; + break; + case uis_utf32be: + m_charSet = utf32be; + break; + default: + m_charSet = utf8; + break; + } + + ReadAheadTo(0); +} + +Stream::~Stream() { delete[] m_pPrefetched; } + +char Stream::peek() const { + if (m_readahead.empty()) { + return Stream::eof(); + } + + return m_readahead[0]; +} + +Stream::operator bool() const { + return m_input.good() || + (!m_readahead.empty() && m_readahead[0] != Stream::eof()); +} + +// get +// . Extracts a character from the stream and updates our position +char Stream::get() { + char ch = peek(); + AdvanceCurrent(); + m_mark.column++; + + if (ch == '\n') { + m_mark.column = 0; + m_mark.line++; + } + + return ch; +} + +// get +// . Extracts 'n' characters from the stream and updates our position +std::string Stream::get(int n) { + std::string ret; + ret.reserve(n); + for (int i = 0; i < n; i++) + ret += get(); + return ret; +} + +// eat +// . Eats 'n' characters and updates our position. +void Stream::eat(int n) { + for (int i = 0; i < n; i++) + get(); +} + +void Stream::AdvanceCurrent() { + if (!m_readahead.empty()) { + m_readahead.pop_front(); + m_mark.pos++; + } + + ReadAheadTo(0); +} + +bool Stream::_ReadAheadTo(size_t i) const { + while (m_input.good() && (m_readahead.size() <= i)) { + switch (m_charSet) { + case utf8: + StreamInUtf8(); + break; + case utf16le: + StreamInUtf16(); + break; + case utf16be: + StreamInUtf16(); + break; + case utf32le: + StreamInUtf32(); + break; + case utf32be: + StreamInUtf32(); + break; + } + } + + // signal end of stream + if (!m_input.good()) + m_readahead.push_back(Stream::eof()); + + return m_readahead.size() > i; +} + +void Stream::StreamInUtf8() const { + unsigned char b = GetNextByte(); + if (m_input.good()) { + m_readahead.push_back(b); + } +} + +void Stream::StreamInUtf16() const { + unsigned long ch = 0; + unsigned char bytes[2]; + int nBigEnd = (m_charSet == utf16be) ? 0 : 1; + + bytes[0] = GetNextByte(); + bytes[1] = GetNextByte(); + if (!m_input.good()) { + return; + } + ch = (static_cast(bytes[nBigEnd]) << 8) | + static_cast(bytes[1 ^ nBigEnd]); + + if (ch >= 0xDC00 && ch < 0xE000) { + // Trailing (low) surrogate...ugh, wrong order + QueueUnicodeCodepoint(m_readahead, CP_REPLACEMENT_CHARACTER); + return; + } else if (ch >= 0xD800 && ch < 0xDC00) { + // ch is a leading (high) surrogate + + // Four byte UTF-8 code point + + // Read the trailing (low) surrogate + for (;;) { + bytes[0] = GetNextByte(); + bytes[1] = GetNextByte(); + if (!m_input.good()) { + QueueUnicodeCodepoint(m_readahead, CP_REPLACEMENT_CHARACTER); + return; + } + unsigned long chLow = (static_cast(bytes[nBigEnd]) << 8) | + static_cast(bytes[1 ^ nBigEnd]); + if (chLow < 0xDC00 || chLow >= 0xE000) { + // Trouble...not a low surrogate. Dump a REPLACEMENT CHARACTER into the + // stream. + QueueUnicodeCodepoint(m_readahead, CP_REPLACEMENT_CHARACTER); + + // Deal with the next UTF-16 unit + if (chLow < 0xD800 || chLow >= 0xE000) { + // Easiest case: queue the codepoint and return + QueueUnicodeCodepoint(m_readahead, ch); + return; + } else { + // Start the loop over with the new high surrogate + ch = chLow; + continue; + } + } + + // Select the payload bits from the high surrogate + ch &= 0x3FF; + ch <<= 10; + + // Include bits from low surrogate + ch |= (chLow & 0x3FF); + + // Add the surrogacy offset + ch += 0x10000; + break; + } + } + + QueueUnicodeCodepoint(m_readahead, ch); +} + +inline char* ReadBuffer(unsigned char* pBuffer) { + return reinterpret_cast(pBuffer); +} + +unsigned char Stream::GetNextByte() const { + if (m_nPrefetchedUsed >= m_nPrefetchedAvailable) { + std::streambuf* pBuf = m_input.rdbuf(); + m_nPrefetchedAvailable = static_cast( + pBuf->sgetn(ReadBuffer(m_pPrefetched), YAML_PREFETCH_SIZE)); + m_nPrefetchedUsed = 0; + if (!m_nPrefetchedAvailable) { + m_input.setstate(std::ios_base::eofbit); + } + + if (0 == m_nPrefetchedAvailable) { + return 0; + } + } + + return m_pPrefetched[m_nPrefetchedUsed++]; +} + +void Stream::StreamInUtf32() const { + static int indexes[2][4] = {{3, 2, 1, 0}, {0, 1, 2, 3}}; + + unsigned long ch = 0; + unsigned char bytes[4]; + int* pIndexes = (m_charSet == utf32be) ? indexes[1] : indexes[0]; + + bytes[0] = GetNextByte(); + bytes[1] = GetNextByte(); + bytes[2] = GetNextByte(); + bytes[3] = GetNextByte(); + if (!m_input.good()) { + return; + } + + for (int i = 0; i < 4; ++i) { + ch <<= 8; + ch |= bytes[pIndexes[i]]; + } + + QueueUnicodeCodepoint(m_readahead, ch); +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/stream.h b/runtime/onnxruntime/third_party/yaml-cpp/src/stream.h new file mode 100644 index 0000000..42d542d --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/stream.h @@ -0,0 +1,76 @@ +#ifndef STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/noncopyable.h" +#include "yaml-cpp/mark.h" +#include +#include +#include +#include +#include +#include + +namespace YAML { +class Stream : private noncopyable { + public: + friend class StreamCharSource; + + Stream(std::istream& input); + ~Stream(); + + operator bool() const; + bool operator!() const { return !static_cast(*this); } + + char peek() const; + char get(); + std::string get(int n); + void eat(int n = 1); + + static char eof() { return 0x04; } + + const Mark mark() const { return m_mark; } + int pos() const { return m_mark.pos; } + int line() const { return m_mark.line; } + int column() const { return m_mark.column; } + void ResetColumn() { m_mark.column = 0; } + + private: + enum CharacterSet { utf8, utf16le, utf16be, utf32le, utf32be }; + + std::istream& m_input; + Mark m_mark; + + CharacterSet m_charSet; + mutable std::deque m_readahead; + unsigned char* const m_pPrefetched; + mutable size_t m_nPrefetchedAvailable; + mutable size_t m_nPrefetchedUsed; + + void AdvanceCurrent(); + char CharAt(size_t i) const; + bool ReadAheadTo(size_t i) const; + bool _ReadAheadTo(size_t i) const; + void StreamInUtf8() const; + void StreamInUtf16() const; + void StreamInUtf32() const; + unsigned char GetNextByte() const; +}; + +// CharAt +// . Unchecked access +inline char Stream::CharAt(size_t i) const { return m_readahead[i]; } + +inline bool Stream::ReadAheadTo(size_t i) const { + if (m_readahead.size() > i) + return true; + return _ReadAheadTo(i); +} +} + +#endif // STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/streamcharsource.h b/runtime/onnxruntime/third_party/yaml-cpp/src/streamcharsource.h new file mode 100644 index 0000000..624599e --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/streamcharsource.h @@ -0,0 +1,48 @@ +#ifndef STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/noncopyable.h" +#include + +namespace YAML { +class StreamCharSource { + public: + StreamCharSource(const Stream& stream) : m_offset(0), m_stream(stream) {} + StreamCharSource(const StreamCharSource& source) + : m_offset(source.m_offset), m_stream(source.m_stream) {} + ~StreamCharSource() {} + + operator bool() const; + char operator[](std::size_t i) const { return m_stream.CharAt(m_offset + i); } + bool operator!() const { return !static_cast(*this); } + + const StreamCharSource operator+(int i) const; + + private: + std::size_t m_offset; + const Stream& m_stream; + + StreamCharSource& operator=(const StreamCharSource&); // non-assignable +}; + +inline StreamCharSource::operator bool() const { + return m_stream.ReadAheadTo(m_offset); +} + +inline const StreamCharSource StreamCharSource::operator+(int i) const { + StreamCharSource source(*this); + if (static_cast(source.m_offset) + i >= 0) + source.m_offset += i; + else + source.m_offset = 0; + return source; +} +} + +#endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/stringsource.h b/runtime/onnxruntime/third_party/yaml-cpp/src/stringsource.h new file mode 100644 index 0000000..6fee44b --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/stringsource.h @@ -0,0 +1,48 @@ +#ifndef STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +namespace YAML { +class StringCharSource { + public: + StringCharSource(const char* str, std::size_t size) + : m_str(str), m_size(size), m_offset(0) {} + + operator bool() const { return m_offset < m_size; } + char operator[](std::size_t i) const { return m_str[m_offset + i]; } + bool operator!() const { return !static_cast(*this); } + + const StringCharSource operator+(int i) const { + StringCharSource source(*this); + if (static_cast(source.m_offset) + i >= 0) + source.m_offset += i; + else + source.m_offset = 0; + return source; + } + + StringCharSource& operator++() { + ++m_offset; + return *this; + } + + StringCharSource& operator+=(std::size_t offset) { + m_offset += offset; + return *this; + } + + private: + const char* m_str; + std::size_t m_size; + std::size_t m_offset; +}; +} + +#endif // STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/tag.cpp b/runtime/onnxruntime/third_party/yaml-cpp/src/tag.cpp new file mode 100644 index 0000000..5143552 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/tag.cpp @@ -0,0 +1,49 @@ +#include +#include + +#include "directives.h" // IWYU pragma: keep +#include "tag.h" +#include "token.h" + +namespace YAML { +Tag::Tag(const Token& token) : type(static_cast(token.data)) { + switch (type) { + case VERBATIM: + value = token.value; + break; + case PRIMARY_HANDLE: + value = token.value; + break; + case SECONDARY_HANDLE: + value = token.value; + break; + case NAMED_HANDLE: + handle = token.value; + value = token.params[0]; + break; + case NON_SPECIFIC: + break; + default: + assert(false); + } +} + +const std::string Tag::Translate(const Directives& directives) { + switch (type) { + case VERBATIM: + return value; + case PRIMARY_HANDLE: + return directives.TranslateTagHandle("!") + value; + case SECONDARY_HANDLE: + return directives.TranslateTagHandle("!!") + value; + case NAMED_HANDLE: + return directives.TranslateTagHandle("!" + handle + "!") + value; + case NON_SPECIFIC: + // TODO: + return "!"; + default: + assert(false); + } + throw std::runtime_error("yaml-cpp: internal error, bad tag type"); +} +} diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/tag.h b/runtime/onnxruntime/third_party/yaml-cpp/src/tag.h new file mode 100644 index 0000000..ac30673 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/tag.h @@ -0,0 +1,33 @@ +#ifndef TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include + +namespace YAML { +struct Directives; +struct Token; + +struct Tag { + enum TYPE { + VERBATIM, + PRIMARY_HANDLE, + SECONDARY_HANDLE, + NAMED_HANDLE, + NON_SPECIFIC + }; + + Tag(const Token& token); + const std::string Translate(const Directives& directives); + + TYPE type; + std::string handle, value; +}; +} + +#endif // TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/src/token.h b/runtime/onnxruntime/third_party/yaml-cpp/src/token.h new file mode 100644 index 0000000..ad0b7d0 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/src/token.h @@ -0,0 +1,69 @@ +#ifndef TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include "yaml-cpp/mark.h" +#include +#include +#include + +namespace YAML { +const std::string TokenNames[] = { + "DIRECTIVE", "DOC_START", "DOC_END", "BLOCK_SEQ_START", "BLOCK_MAP_START", + "BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY", "FLOW_SEQ_START", + "FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END", "FLOW_MAP_COMPACT", + "FLOW_ENTRY", "KEY", "VALUE", "ANCHOR", "ALIAS", "TAG", "SCALAR"}; + +struct Token { + // enums + enum STATUS { VALID, INVALID, UNVERIFIED }; + enum TYPE { + DIRECTIVE, + DOC_START, + DOC_END, + BLOCK_SEQ_START, + BLOCK_MAP_START, + BLOCK_SEQ_END, + BLOCK_MAP_END, + BLOCK_ENTRY, + FLOW_SEQ_START, + FLOW_MAP_START, + FLOW_SEQ_END, + FLOW_MAP_END, + FLOW_MAP_COMPACT, + FLOW_ENTRY, + KEY, + VALUE, + ANCHOR, + ALIAS, + TAG, + PLAIN_SCALAR, + NON_PLAIN_SCALAR + }; + + // data + Token(TYPE type_, const Mark& mark_) + : status(VALID), type(type_), mark(mark_), data(0) {} + + friend std::ostream& operator<<(std::ostream& out, const Token& token) { + out << TokenNames[token.type] << std::string(": ") << token.value; + for (std::size_t i = 0; i < token.params.size(); i++) + out << std::string(" ") << token.params[i]; + return out; + } + + STATUS status; + TYPE type; + Mark mark; + std::string value; + std::vector params; + int data; +}; +} + +#endif // TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp-config-version.cmake.in b/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp-config-version.cmake.in new file mode 100644 index 0000000..80b9c79 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp-config-version.cmake.in @@ -0,0 +1,11 @@ +set(PACKAGE_VERSION "@YAML_CPP_VERSION@") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp-config.cmake.in b/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp-config.cmake.in new file mode 100644 index 0000000..7b41e3f --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp-config.cmake.in @@ -0,0 +1,14 @@ +# - Config file for the yaml-cpp package +# It defines the following variables +# YAML_CPP_INCLUDE_DIR - include directory +# YAML_CPP_LIBRARIES - libraries to link against + +# Compute paths +get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@") + +# Our library dependencies (contains definitions for IMPORTED targets) +include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake") + +# These are IMPORTED targets created by yaml-cpp-targets.cmake +set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@") diff --git a/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp.pc.cmake b/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp.pc.cmake new file mode 100644 index 0000000..044ef78 --- /dev/null +++ b/runtime/onnxruntime/third_party/yaml-cpp/yaml-cpp.pc.cmake @@ -0,0 +1,9 @@ +libdir=@LIB_INSTALL_DIR@ +includedir=@INCLUDE_INSTALL_ROOT_DIR@ + +Name: Yaml-cpp +Description: A YAML parser and emitter for C++ +Version: @YAML_CPP_VERSION@ +Requires: +Libs: -L${libdir} -lyaml-cpp +Cflags: -I${includedir} diff --git a/runtime/python/__init__.py b/runtime/python/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/runtime/python/grpc/Readme.md b/runtime/python/grpc/Readme.md new file mode 100644 index 0000000..13723f2 --- /dev/null +++ b/runtime/python/grpc/Readme.md @@ -0,0 +1,27 @@ +# GRPC python Client for 2pass decoding +The client can send streaming or full audio data to server as you wish, and get transcribed text once the server respond (depends on mode) + +In the demo client, audio_chunk_duration is set to 1000ms, and send_interval is set to 100ms + +### 1. Install the requirements +```shell +git clone https://github.com/alibaba/FunASR.git && cd FunASR/funasr/runtime/python/grpc +pip install -r requirements.txt +``` + +### 2. Generate protobuf file +```shell +# paraformer_pb2.py and paraformer_pb2_grpc.py are already generated, +# regenerate it only when you make changes to ./proto/paraformer.proto file. +python -m grpc_tools.protoc --proto_path=./proto -I ./proto --python_out=. --grpc_python_out=./ ./proto/paraformer.proto +``` + +### 3. Start grpc client +``` +# Start client. +python grpc_main_client.py --host 127.0.0.1 --port 10100 --wav_path /path/to/your_test_wav.wav +``` + +## Acknowledge +1. This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR). +2. We acknowledge burkliu (刘柏基, liubaiji@xverse.cn) for contributing the grpc service. diff --git a/runtime/python/grpc/grpc_main_client.py b/runtime/python/grpc/grpc_main_client.py new file mode 100644 index 0000000..4606214 --- /dev/null +++ b/runtime/python/grpc/grpc_main_client.py @@ -0,0 +1,83 @@ +""" + Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + Reserved. MIT License (https://opensource.org/licenses/MIT) + 2023 by burkliu(刘柏基) liubaiji@xverse.cn +""" + +import logging +import argparse +import soundfile as sf +import time + +import grpc +import paraformer_pb2_grpc +from paraformer_pb2 import Request, WavFormat, DecodeMode + + +class GrpcClient: + def __init__(self, wav_path, uri, mode): + self.wav, self.sampling_rate = sf.read(wav_path, dtype="int16") + self.wav_format = WavFormat.pcm + self.audio_chunk_duration = 1000 # ms + self.audio_chunk_size = int(self.sampling_rate * self.audio_chunk_duration / 1000) + self.send_interval = 100 # ms + self.mode = mode + + # connect to grpc server + channel = grpc.insecure_channel(uri) + self.stub = paraformer_pb2_grpc.ASRStub(channel) + + # start request + for respond in self.stub.Recognize(self.request_iterator()): + logging.info( + "[receive] mode {}, text {}, is final {}".format( + DecodeMode.Name(respond.mode), respond.text, respond.is_final + ) + ) + + def request_iterator(self, mode=DecodeMode.two_pass): + is_first_pack = True + is_final = False + for start in range(0, len(self.wav), self.audio_chunk_size): + request = Request() + audio_chunk = self.wav[start : start + self.audio_chunk_size] + + if is_first_pack: + is_first_pack = False + request.sampling_rate = self.sampling_rate + request.mode = self.mode + request.wav_format = self.wav_format + if request.mode == DecodeMode.two_pass or request.mode == DecodeMode.online: + request.chunk_size.extend([5, 10, 5]) + + if start + self.audio_chunk_size >= len(self.wav): + is_final = True + request.is_final = is_final + request.audio_data = audio_chunk.tobytes() + logging.info( + "[request] audio_data len {}, is final {}".format( + len(request.audio_data), request.is_final + ) + ) # int16 = 2bytes + time.sleep(self.send_interval / 1000) + yield request + + +if __name__ == "__main__": + logging.basicConfig(filename="", format="%(asctime)s %(message)s", level=logging.INFO) + parser = argparse.ArgumentParser() + parser.add_argument( + "--host", type=str, default="127.0.0.1", required=False, help="grpc server host ip" + ) + parser.add_argument("--port", type=int, default=10100, required=False, help="grpc server port") + parser.add_argument("--wav_path", type=str, required=True, help="audio wav path") + args = parser.parse_args() + + for mode in [DecodeMode.offline, DecodeMode.online, DecodeMode.two_pass]: + mode_name = DecodeMode.Name(mode) + logging.info("[request] start requesting with mode {}".format(mode_name)) + + st = time.time() + uri = "{}:{}".format(args.host, args.port) + client = GrpcClient(args.wav_path, uri, mode) + logging.info("mode {}, time pass: {}".format(mode_name, time.time() - st)) diff --git a/runtime/python/grpc/proto/Readme.md b/runtime/python/grpc/proto/Readme.md new file mode 100644 index 0000000..fb9a04c --- /dev/null +++ b/runtime/python/grpc/proto/Readme.md @@ -0,0 +1,25 @@ +``` +service ASR { //grpc service + rpc Recognize (stream Request) returns (stream Response) {} //Stub +} + +message Request { //request data + bytes audio_data = 1; //audio data in bytes. + string user = 2; //user allowed. + string language = 3; //language, zh-CN for now. + bool speaking = 4; //flag for speaking. + bool isEnd = 5; //flag for end. set isEnd to true when you stop asr: + //vad:is_speech then speaking=True & isEnd = False, audio data will be appended for the specfied user. + //vad:silence then speaking=False & isEnd = False, clear audio buffer and do asr inference. +} + +message Response { //response data. + string sentence = 1; //json, includes flag for success and asr text . + string user = 2; //same to request user. + string language = 3; //same to request language. + string action = 4; //server status: + //terminate:asr stopped; + //speaking:user is speaking, audio data is appended; + //decoding: server is decoding; + //finish: get asr text, most used. +} diff --git a/runtime/python/grpc/proto/paraformer.proto b/runtime/python/grpc/proto/paraformer.proto new file mode 100644 index 0000000..85e8534 --- /dev/null +++ b/runtime/python/grpc/proto/paraformer.proto @@ -0,0 +1,39 @@ +// Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights +// Reserved. MIT License (https://opensource.org/licenses/MIT) +// +// 2023 by burkliu(刘柏基) liubaiji@xverse.cn + +syntax = "proto3"; + +option objc_class_prefix = "paraformer"; + +package paraformer; + +service ASR { + rpc Recognize (stream Request) returns (stream Response) {} +} + +enum WavFormat { + pcm = 0; +} + +enum DecodeMode { + offline = 0; + online = 1; + two_pass = 2; +} + +message Request { + DecodeMode mode = 1; + WavFormat wav_format = 2; + int32 sampling_rate = 3; + repeated int32 chunk_size = 4; + bool is_final = 5; + bytes audio_data = 6; +} + +message Response { + DecodeMode mode = 1; + string text = 2; + bool is_final = 3; +} diff --git a/runtime/python/grpc/proto/workflow.png b/runtime/python/grpc/proto/workflow.png new file mode 100644 index 0000000..a6fb254 Binary files /dev/null and b/runtime/python/grpc/proto/workflow.png differ diff --git a/runtime/python/grpc/requirements.txt b/runtime/python/grpc/requirements.txt new file mode 100644 index 0000000..ee677c6 --- /dev/null +++ b/runtime/python/grpc/requirements.txt @@ -0,0 +1,2 @@ +grpcio +grpcio-tools \ No newline at end of file diff --git a/runtime/python/http/README.md b/runtime/python/http/README.md new file mode 100644 index 0000000..1b68110 --- /dev/null +++ b/runtime/python/http/README.md @@ -0,0 +1,68 @@ +# Service with http-python + +## Server + +1. Install requirements + +```shell +cd funasr/runtime/python/http +pip install -r requirements.txt +``` + +2. Start server + +```shell +python server.py --port 8000 +``` + +More parameters: +```shell +python server.py \ +--host [host ip] \ +--port [server port] \ +--asr_model [asr model_name] \ +--vad_model [vad model_name] \ +--punc_model [punc model_name] \ +--device [cuda or cpu] \ +--ngpu [0 or 1] \ +--ncpu [1 or 4] \ +--hotword_path [path of hot word txt] \ +--certfile [path of certfile for ssl] \ +--keyfile [path of keyfile for ssl] \ +--temp_dir [upload file temp dir] +``` + +## Client + +```shell +# get test audio file +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav +python client.py --host=127.0.0.1 --port=8000 --audio_path=asr_example_zh.wav +``` + +More parameters: +```shell +python server.py \ +--host [sever ip] \ +--port [sever port] \ +--audio_path [use audio path] +``` + + +## 支持多进程 + +方法是启动多个`server.py`,然后通过Nginx的负载均衡分发请求,达到支持多用户同时连效果,处理方式如下,默认您已经安装了Nginx,没安装的请参考[官方安装教程](https://nginx.org/en/linux_packages.html#Ubuntu)。 + +配置Nginx。 +```shell +sudo cp -f asr_nginx.conf /etc/nginx/nginx.conf +sudo service nginx reload +``` + +然后使用脚本启动多个服务,每个服务的端口号不一样。 +```shell +sudo chmod +x start_server.sh +./start_server.sh +``` + +**说明:** 默认是3个进程,如果需要修改,首先修改`start_server.sh`的最后那部分,可以添加启动数量。然后修改`asr_nginx.conf`配置文件的`upstream backend`部分,增加新启动的服务,可以使其他服务器的服务。 diff --git a/runtime/python/http/asr_nginx.conf b/runtime/python/http/asr_nginx.conf new file mode 100644 index 0000000..769774f --- /dev/null +++ b/runtime/python/http/asr_nginx.conf @@ -0,0 +1,44 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + keepalive_timeout 65; + + upstream backend { + # 最少连接算法 + least_conn; + # 启动的服务地址 + server localhost:8001; + server localhost:8002; + server localhost:8003; + } + + server { + # 实际访问的端口 + listen 8000; + + location / { + proxy_pass http://backend; + } + } + + include /etc/nginx/conf.d/*.conf; +} \ No newline at end of file diff --git a/runtime/python/http/client.py b/runtime/python/http/client.py new file mode 100644 index 0000000..5024f41 --- /dev/null +++ b/runtime/python/http/client.py @@ -0,0 +1,33 @@ +import os + +import requests +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("--host", type=str, default="127.0.0.1", required=False, help="sever ip") +parser.add_argument("--port", type=int, default=8000, required=False, help="server port") +parser.add_argument( + "--audio_path", type=str, default="asr_example_zh.wav", required=False, help="use audio path" +) +args = parser.parse_args() +print("----------- Configuration Arguments -----------") +for arg, value in vars(args).items(): + print("%s: %s" % (arg, value)) +print("------------------------------------------------") + + +url = f"http://{args.host}:{args.port}/recognition" +headers = {} +files = [ + ( + "audio", + ( + os.path.basename(args.audio_path), + open(args.audio_path, "rb"), + "application/octet-stream", + ), + ) +] + +response = requests.post(url, headers=headers, files=files) +print(response.text) diff --git a/runtime/python/http/hotwords.txt b/runtime/python/http/hotwords.txt new file mode 100644 index 0000000..6179cbc --- /dev/null +++ b/runtime/python/http/hotwords.txt @@ -0,0 +1,2 @@ +阿里巴巴 +通义实验室 diff --git a/runtime/python/http/requirements.txt b/runtime/python/http/requirements.txt new file mode 100644 index 0000000..e5c3bca --- /dev/null +++ b/runtime/python/http/requirements.txt @@ -0,0 +1,6 @@ +modelscope>=1.11.1 +funasr>=1.0.5 +fastapi>=0.95.1 +aiofiles +uvicorn +requests \ No newline at end of file diff --git a/runtime/python/http/server.py b/runtime/python/http/server.py new file mode 100644 index 0000000..8bff9c9 --- /dev/null +++ b/runtime/python/http/server.py @@ -0,0 +1,133 @@ +import argparse +import logging +import os +import uuid + +import aiofiles +import ffmpeg +import uvicorn +from fastapi import FastAPI, File, UploadFile +from modelscope.utils.logger import get_logger + +from funasr import AutoModel + +logger = get_logger(log_level=logging.INFO) +logger.setLevel(logging.INFO) + +parser = argparse.ArgumentParser() +parser.add_argument( + "--host", type=str, default="0.0.0.0", required=False, help="host ip, localhost, 0.0.0.0" +) +parser.add_argument("--port", type=int, default=8000, required=False, help="server port") +parser.add_argument( + "--asr_model", + type=str, + default="paraformer-zh", + help="asr model from https://github.com/alibaba-damo-academy/FunASR?tab=readme-ov-file#model-zoo", +) +parser.add_argument("--asr_model_revision", type=str, default="v2.0.4", help="") +parser.add_argument( + "--vad_model", + type=str, + default="fsmn-vad", + help="vad model from https://github.com/alibaba-damo-academy/FunASR?tab=readme-ov-file#model-zoo", +) +parser.add_argument("--vad_model_revision", type=str, default="v2.0.4", help="") +parser.add_argument( + "--punc_model", + type=str, + default="ct-punc-c", + help="model from https://github.com/alibaba-damo-academy/FunASR?tab=readme-ov-file#model-zoo", +) +parser.add_argument("--punc_model_revision", type=str, default="v2.0.4", help="") +parser.add_argument("--ngpu", type=int, default=1, help="0 for cpu, 1 for gpu") +parser.add_argument("--device", type=str, default="cuda", help="cuda, cpu") +parser.add_argument("--ncpu", type=int, default=4, help="cpu cores") +parser.add_argument( + "--hotword_path", + type=str, + default="hotwords.txt", + help="hot word txt path, only the hot word model works", +) +parser.add_argument("--certfile", type=str, default=None, required=False, help="certfile for ssl") +parser.add_argument("--keyfile", type=str, default=None, required=False, help="keyfile for ssl") +parser.add_argument("--temp_dir", type=str, default="temp_dir/", required=False, help="temp dir") +args = parser.parse_args() +logger.info("----------- Configuration Arguments -----------") +for arg, value in vars(args).items(): + logger.info("%s: %s" % (arg, value)) +logger.info("------------------------------------------------") + +os.makedirs(args.temp_dir, exist_ok=True) + +logger.info("model loading") +# load funasr model +model = AutoModel( + model=args.asr_model, + model_revision=args.asr_model_revision, + vad_model=args.vad_model, + vad_model_revision=args.vad_model_revision, + punc_model=args.punc_model, + punc_model_revision=args.punc_model_revision, + ngpu=args.ngpu, + ncpu=args.ncpu, + device=args.device, + disable_pbar=True, + disable_log=True, +) +logger.info("loaded models!") + +app = FastAPI(title="FunASR") + +param_dict = {"sentence_timestamp": True, "batch_size_s": 300} +if args.hotword_path is not None and os.path.exists(args.hotword_path): + with open(args.hotword_path, "r", encoding="utf-8") as f: + lines = f.readlines() + lines = [line.strip() for line in lines] + hotword = " ".join(lines) + logger.info(f"热词:{hotword}") + param_dict["hotword"] = hotword + + +@app.post("/recognition") +async def api_recognition(audio: UploadFile = File(..., description="audio file")): + suffix = audio.filename.split(".")[-1] + audio_path = f"{args.temp_dir}/{str(uuid.uuid1())}.{suffix}" + async with aiofiles.open(audio_path, "wb") as out_file: + content = await audio.read() + await out_file.write(content) + try: + audio_bytes, _ = ( + ffmpeg.input(audio_path, threads=0) + .output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=16000) + .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True) + ) + except Exception as e: + logger.error(f"读取音频文件发生错误,错误信息:{e}") + return {"msg": "读取音频文件发生错误", "code": 1} + rec_results = model.generate(input=audio_bytes, is_final=True, **param_dict) + # 结果为空 + if len(rec_results) == 0: + return {"text": "", "sentences": [], "code": 0} + elif len(rec_results) == 1: + # 解析识别结果 + rec_result = rec_results[0] + text = rec_result["text"] + sentences = [] + for sentence in rec_result["sentence_info"]: + # 每句话的时间戳 + sentences.append( + {"text": sentence["text"], "start": sentence["start"], "end": sentence["end"]} + ) + ret = {"text": text, "sentences": sentences, "code": 0} + logger.info(f"识别结果:{ret}") + return ret + else: + logger.info(f"识别结果:{rec_results}") + return {"msg": "未知错误", "code": -1} + + +if __name__ == "__main__": + uvicorn.run( + app, host=args.host, port=args.port, ssl_keyfile=args.keyfile, ssl_certfile=args.certfile + ) diff --git a/runtime/python/http/start_server.sh b/runtime/python/http/start_server.sh new file mode 100644 index 0000000..7eaa682 --- /dev/null +++ b/runtime/python/http/start_server.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# 创建日志文件夹 +if [ ! -d "log/" ];then + mkdir log +fi + +# kill掉之前的进程 +server_id=`ps -ef | grep server.py | grep -v "grep" | awk '{print $2}'` +echo $server_id + +for id in $server_id +do + kill -9 $id + echo "killed $id" +done + +# 启动多个服务,可以设置使用不同的显卡 +CUDA_VISIBLE_DEVICES=0 nohup python -u server.py --host=localhost --port=8001 >> log/output1.log 2>&1 & +CUDA_VISIBLE_DEVICES=0 nohup python -u server.py --host=localhost --port=8002 >> log/output2.log 2>&1 & +CUDA_VISIBLE_DEVICES=0 nohup python -u server.py --host=localhost --port=8003 >> log/output3.log 2>&1 & diff --git a/runtime/python/libtorch/README.md b/runtime/python/libtorch/README.md new file mode 100644 index 0000000..a96846e --- /dev/null +++ b/runtime/python/libtorch/README.md @@ -0,0 +1,79 @@ +# Libtorch-python + +## Export the model + +### Install [modelscope and funasr](https://github.com/alibaba-damo-academy/FunASR#installation) + +```shell +# pip3 install torch torchaudio +pip install -U modelscope funasr +# For the users in China, you could install with the command: +# pip install -U modelscope funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple +pip install torch-quant # Optional, for torchscript quantization +pip install onnx onnxruntime # Optional, for onnx quantization +``` + +### Export [onnx model](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/export) + +```shell +python -m funasr.export.export_model --model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type torch --quantize True +``` + +## Install the `funasr_torch` + +install from pip + +```shell +pip install -U funasr_torch +# For the users in China, you could install with the command: +# pip install -U funasr_torch -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +or install from source code + +```shell +git clone https://github.com/alibaba/FunASR.git && cd FunASR +cd funasr/runtime/python/libtorch +pip install -e ./ +# For the users in China, you could install with the command: +# pip install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +## Run the demo + +- Model_dir: the model path, which contains `model.torchscripts`, `config.yaml`, `am.mvn`. +- Input: wav formt file, support formats: `str, np.ndarray, List[str]` +- Output: `List[str]`: recognition result. +- Example: + + ```python + from funasr_torch import Paraformer + + model_dir = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" + model = Paraformer(model_dir, batch_size=1) + + wav_path = ['/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'] + + result = model(wav_path) + print(result) + ``` + +## Performance benchmark + +Please ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/benchmark_libtorch.md) + +## Speed + +Environment:Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz + +Test [wav, 5.53s, 100 times avg.](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav) + +| Backend | RTF (FP32) | +|:--------:|:----------:| +| Pytorch | 0.110 | +| Libtorch | 0.048 | +| Onnx | 0.038 | + +## Acknowledge + +This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR). diff --git a/runtime/python/libtorch/__init__.py b/runtime/python/libtorch/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/runtime/python/libtorch/demo.py b/runtime/python/libtorch/demo.py new file mode 100644 index 0000000..1ef9a20 --- /dev/null +++ b/runtime/python/libtorch/demo.py @@ -0,0 +1,17 @@ +from funasr_torch import Paraformer + + +model_dir = ( + "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +) + +model = Paraformer(model_dir, batch_size=1) # cpu +# model = Paraformer(model_dir, batch_size=1, device_id=0) # gpu + +# when using paraformer-large-vad-punc model, you can set plot_timestamp_to="./xx.png" to get figure of alignment besides timestamps +# model = Paraformer(model_dir, batch_size=1, plot_timestamp_to="test.png") + +wav_path = "YourPath/xx.wav" + +result = model(wav_path) +print(result) diff --git a/runtime/python/libtorch/funasr_torch/__init__.py b/runtime/python/libtorch/funasr_torch/__init__.py new file mode 100644 index 0000000..647f9fa --- /dev/null +++ b/runtime/python/libtorch/funasr_torch/__init__.py @@ -0,0 +1,2 @@ +# -*- encoding: utf-8 -*- +from .paraformer_bin import Paraformer diff --git a/runtime/python/libtorch/funasr_torch/paraformer_bin.py b/runtime/python/libtorch/funasr_torch/paraformer_bin.py new file mode 100644 index 0000000..68886df --- /dev/null +++ b/runtime/python/libtorch/funasr_torch/paraformer_bin.py @@ -0,0 +1,205 @@ +# -*- encoding: utf-8 -*- +import os.path +from pathlib import Path +from typing import List, Union, Tuple + +import copy +import librosa +import numpy as np + +from .utils.utils import CharTokenizer, Hypothesis, TokenIDConverter, get_logger, read_yaml +from .utils.postprocess_utils import sentence_postprocess +from .utils.frontend import WavFrontend +from .utils.timestamp_utils import time_stamp_lfr6_onnx + +logging = get_logger() + +import torch + + +class Paraformer: + def __init__( + self, + model_dir: Union[str, Path] = None, + batch_size: int = 1, + device_id: Union[str, int] = "-1", + plot_timestamp_to: str = "", + quantize: bool = False, + intra_op_num_threads: int = 1, + ): + + if not Path(model_dir).exists(): + raise FileNotFoundError(f"{model_dir} does not exist.") + + model_file = os.path.join(model_dir, "model.torchscripts") + if quantize: + model_file = os.path.join(model_dir, "model_quant.torchscripts") + config_file = os.path.join(model_dir, "config.yaml") + cmvn_file = os.path.join(model_dir, "am.mvn") + config = read_yaml(config_file) + + self.converter = TokenIDConverter(config["token_list"]) + self.tokenizer = CharTokenizer() + self.frontend = WavFrontend(cmvn_file=cmvn_file, **config["frontend_conf"]) + self.ort_infer = torch.jit.load(model_file) + self.batch_size = batch_size + self.device_id = device_id + self.plot_timestamp_to = plot_timestamp_to + if "predictor_bias" in config["model_conf"].keys(): + self.pred_bias = config["model_conf"]["predictor_bias"] + else: + self.pred_bias = 0 + + def __call__(self, wav_content: Union[str, np.ndarray, List[str]], **kwargs) -> List: + waveform_list = self.load_data(wav_content, self.frontend.opts.frame_opts.samp_freq) + waveform_nums = len(waveform_list) + asr_res = [] + for beg_idx in range(0, waveform_nums, self.batch_size): + + end_idx = min(waveform_nums, beg_idx + self.batch_size) + feats, feats_len = self.extract_feat(waveform_list[beg_idx:end_idx]) + try: + with torch.no_grad(): + if int(self.device_id) == -1: + outputs = self.ort_infer(feats, feats_len) + am_scores, valid_token_lens = outputs[0], outputs[1] + else: + outputs = self.ort_infer(feats.cuda(), feats_len.cuda()) + am_scores, valid_token_lens = outputs[0].cpu(), outputs[1].cpu() + if len(outputs) == 4: + # for BiCifParaformer Inference + us_alphas, us_peaks = outputs[2], outputs[3] + else: + us_alphas, us_peaks = None, None + except: + # logging.warning(traceback.format_exc()) + logging.warning("input wav is silence or noise") + preds = [""] + else: + preds = self.decode(am_scores, valid_token_lens) + if us_peaks is None: + for pred in preds: + pred = sentence_postprocess(pred) + asr_res.append({"preds": pred}) + else: + for pred, us_peaks_ in zip(preds, us_peaks): + raw_tokens = pred + timestamp, timestamp_raw = time_stamp_lfr6_onnx( + us_peaks_, copy.copy(raw_tokens) + ) + text_proc, timestamp_proc, _ = sentence_postprocess( + raw_tokens, timestamp_raw + ) + # logging.warning(timestamp) + if len(self.plot_timestamp_to): + self.plot_wave_timestamp( + waveform_list[0], timestamp, self.plot_timestamp_to + ) + asr_res.append( + { + "preds": text_proc, + "timestamp": timestamp_proc, + "raw_tokens": raw_tokens, + } + ) + return asr_res + + def plot_wave_timestamp(self, wav, text_timestamp, dest): + # TODO: Plot the wav and timestamp results with matplotlib + import matplotlib + + matplotlib.use("Agg") + matplotlib.rc( + "font", family="Alibaba PuHuiTi" + ) # set it to a font that your system supports + import matplotlib.pyplot as plt + + fig, ax1 = plt.subplots(figsize=(11, 3.5), dpi=320) + ax2 = ax1.twinx() + ax2.set_ylim([0, 2.0]) + # plot waveform + ax1.set_ylim([-0.3, 0.3]) + time = np.arange(wav.shape[0]) / 16000 + ax1.plot(time, wav / wav.max() * 0.3, color="gray", alpha=0.4) + # plot lines and text + for char, start, end in text_timestamp: + ax1.vlines(start, -0.3, 0.3, ls="--") + ax1.vlines(end, -0.3, 0.3, ls="--") + x_adj = 0.045 if char != "" else 0.12 + ax1.text((start + end) * 0.5 - x_adj, 0, char) + # plt.legend() + plotname = "{}/timestamp.png".format(dest) + plt.savefig(plotname, bbox_inches="tight") + + def load_data(self, wav_content: Union[str, np.ndarray, List[str]], fs: int = None) -> List: + def load_wav(path: str) -> np.ndarray: + waveform, _ = librosa.load(path, sr=fs) + return waveform + + if isinstance(wav_content, np.ndarray): + return [wav_content] + + if isinstance(wav_content, str): + return [load_wav(wav_content)] + + if isinstance(wav_content, list): + return [load_wav(path) for path in wav_content] + + raise TypeError(f"The type of {wav_content} is not in [str, np.ndarray, list]") + + def extract_feat(self, waveform_list: List[np.ndarray]) -> Tuple[np.ndarray, np.ndarray]: + feats, feats_len = [], [] + for waveform in waveform_list: + speech, _ = self.frontend.fbank(waveform) + feat, feat_len = self.frontend.lfr_cmvn(speech) + feats.append(feat) + feats_len.append(feat_len) + + feats = self.pad_feats(feats, np.max(feats_len)) + feats_len = np.array(feats_len).astype(np.int32) + feats = torch.from_numpy(feats).type(torch.float32) + feats_len = torch.from_numpy(feats_len).type(torch.int32) + return feats, feats_len + + @staticmethod + def pad_feats(feats: List[np.ndarray], max_feat_len: int) -> np.ndarray: + def pad_feat(feat: np.ndarray, cur_len: int) -> np.ndarray: + pad_width = ((0, max_feat_len - cur_len), (0, 0)) + return np.pad(feat, pad_width, "constant", constant_values=0) + + feat_res = [pad_feat(feat, feat.shape[0]) for feat in feats] + feats = np.array(feat_res).astype(np.float32) + return feats + + def infer(self, feats: np.ndarray, feats_len: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + outputs = self.ort_infer([feats, feats_len]) + return outputs + + def decode(self, am_scores: np.ndarray, token_nums: int) -> List[str]: + return [ + self.decode_one(am_score, token_num) + for am_score, token_num in zip(am_scores, token_nums) + ] + + def decode_one(self, am_score: np.ndarray, valid_token_num: int) -> List[str]: + yseq = am_score.argmax(axis=-1) + score = am_score.max(axis=-1) + score = np.sum(score, axis=-1) + + # pad with mask tokens to ensure compatibility with sos/eos tokens + # asr_model.sos:1 asr_model.eos:2 + yseq = np.array([1] + yseq.tolist() + [2]) + hyp = Hypothesis(yseq=yseq, score=score) + + # remove sos/eos and get results + last_pos = -1 + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list(filter(lambda x: x not in (0, 2), token_int)) + + # Change integer-ids to tokens + token = self.converter.ids2tokens(token_int) + token = token[: valid_token_num - self.pred_bias] + # texts = sentence_postprocess(token) + return token diff --git a/runtime/python/libtorch/funasr_torch/utils/__init__.py b/runtime/python/libtorch/funasr_torch/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/runtime/python/libtorch/funasr_torch/utils/compute_wer.py b/runtime/python/libtorch/funasr_torch/utils/compute_wer.py new file mode 100644 index 0000000..46ec08e --- /dev/null +++ b/runtime/python/libtorch/funasr_torch/utils/compute_wer.py @@ -0,0 +1,193 @@ +import os +import numpy as np +import sys + + +def compute_wer(ref_file, hyp_file, cer_detail_file): + rst = { + "Wrd": 0, + "Corr": 0, + "Ins": 0, + "Del": 0, + "Sub": 0, + "Snt": 0, + "Err": 0.0, + "S.Err": 0.0, + "wrong_words": 0, + "wrong_sentences": 0, + } + + hyp_dict = {} + ref_dict = {} + with open(hyp_file, "r") as hyp_reader: + for line in hyp_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + hyp_dict[key] = value + with open(ref_file, "r") as ref_reader: + for line in ref_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + ref_dict[key] = value + + cer_detail_writer = open(cer_detail_file, "w") + for hyp_key in hyp_dict: + if hyp_key in ref_dict: + out_item = compute_wer_by_line(hyp_dict[hyp_key], ref_dict[hyp_key]) + rst["Wrd"] += out_item["nwords"] + rst["Corr"] += out_item["cor"] + rst["wrong_words"] += out_item["wrong"] + rst["Ins"] += out_item["ins"] + rst["Del"] += out_item["del"] + rst["Sub"] += out_item["sub"] + rst["Snt"] += 1 + if out_item["wrong"] > 0: + rst["wrong_sentences"] += 1 + cer_detail_writer.write(hyp_key + print_cer_detail(out_item) + "\n") + cer_detail_writer.write("ref:" + "\t" + "".join(ref_dict[hyp_key]) + "\n") + cer_detail_writer.write("hyp:" + "\t" + "".join(hyp_dict[hyp_key]) + "\n") + + if rst["Wrd"] > 0: + rst["Err"] = round(rst["wrong_words"] * 100 / rst["Wrd"], 2) + if rst["Snt"] > 0: + rst["S.Err"] = round(rst["wrong_sentences"] * 100 / rst["Snt"], 2) + + cer_detail_writer.write("\n") + cer_detail_writer.write( + "%WER " + + str(rst["Err"]) + + " [ " + + str(rst["wrong_words"]) + + " / " + + str(rst["Wrd"]) + + ", " + + str(rst["Ins"]) + + " ins, " + + str(rst["Del"]) + + " del, " + + str(rst["Sub"]) + + " sub ]" + + "\n" + ) + cer_detail_writer.write( + "%SER " + + str(rst["S.Err"]) + + " [ " + + str(rst["wrong_sentences"]) + + " / " + + str(rst["Snt"]) + + " ]" + + "\n" + ) + cer_detail_writer.write( + "Scored " + + str(len(hyp_dict)) + + " sentences, " + + str(len(hyp_dict) - rst["Snt"]) + + " not present in hyp." + + "\n" + ) + + +def compute_wer_by_line(hyp, ref): + hyp = list(map(lambda x: x.lower(), hyp)) + ref = list(map(lambda x: x.lower(), ref)) + + len_hyp = len(hyp) + len_ref = len(ref) + + cost_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int16) + + ops_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int8) + + for i in range(len_hyp + 1): + cost_matrix[i][0] = i + for j in range(len_ref + 1): + cost_matrix[0][j] = j + + for i in range(1, len_hyp + 1): + for j in range(1, len_ref + 1): + if hyp[i - 1] == ref[j - 1]: + cost_matrix[i][j] = cost_matrix[i - 1][j - 1] + else: + substitution = cost_matrix[i - 1][j - 1] + 1 + insertion = cost_matrix[i - 1][j] + 1 + deletion = cost_matrix[i][j - 1] + 1 + + compare_val = [substitution, insertion, deletion] + + min_val = min(compare_val) + operation_idx = compare_val.index(min_val) + 1 + cost_matrix[i][j] = min_val + ops_matrix[i][j] = operation_idx + + match_idx = [] + i = len_hyp + j = len_ref + rst = {"nwords": len_ref, "cor": 0, "wrong": 0, "ins": 0, "del": 0, "sub": 0} + while i >= 0 or j >= 0: + i_idx = max(0, i) + j_idx = max(0, j) + + if ops_matrix[i_idx][j_idx] == 0: # correct + if i - 1 >= 0 and j - 1 >= 0: + match_idx.append((j - 1, i - 1)) + rst["cor"] += 1 + + i -= 1 + j -= 1 + + elif ops_matrix[i_idx][j_idx] == 2: # insert + i -= 1 + rst["ins"] += 1 + + elif ops_matrix[i_idx][j_idx] == 3: # delete + j -= 1 + rst["del"] += 1 + + elif ops_matrix[i_idx][j_idx] == 1: # substitute + i -= 1 + j -= 1 + rst["sub"] += 1 + + if i < 0 and j >= 0: + rst["del"] += 1 + elif j < 0 and i >= 0: + rst["ins"] += 1 + + match_idx.reverse() + wrong_cnt = cost_matrix[len_hyp][len_ref] + rst["wrong"] = wrong_cnt + + return rst + + +def print_cer_detail(rst): + return ( + "(" + + "nwords=" + + str(rst["nwords"]) + + ",cor=" + + str(rst["cor"]) + + ",ins=" + + str(rst["ins"]) + + ",del=" + + str(rst["del"]) + + ",sub=" + + str(rst["sub"]) + + ") corr:" + + "{:.2%}".format(rst["cor"] / rst["nwords"]) + + ",cer:" + + "{:.2%}".format(rst["wrong"] / rst["nwords"]) + ) + + +if __name__ == "__main__": + if len(sys.argv) != 4: + print("usage : python compute-wer.py test.ref test.hyp test.wer") + sys.exit(0) + + ref_file = sys.argv[1] + hyp_file = sys.argv[2] + cer_detail_file = sys.argv[3] + compute_wer(ref_file, hyp_file, cer_detail_file) diff --git a/runtime/python/libtorch/funasr_torch/utils/frontend.py b/runtime/python/libtorch/funasr_torch/utils/frontend.py new file mode 100644 index 0000000..743ee5e --- /dev/null +++ b/runtime/python/libtorch/funasr_torch/utils/frontend.py @@ -0,0 +1,193 @@ +# -*- encoding: utf-8 -*- +from pathlib import Path +from typing import Any, Dict, Iterable, List, NamedTuple, Set, Tuple, Union + +import numpy as np +import kaldi_native_fbank as knf + +root_dir = Path(__file__).resolve().parent + +logger_initialized = {} + + +class WavFrontend: + """Conventional frontend structure for ASR.""" + + def __init__( + self, + cmvn_file: str = None, + fs: int = 16000, + window: str = "hamming", + n_mels: int = 80, + frame_length: int = 25, + frame_shift: int = 10, + lfr_m: int = 1, + lfr_n: int = 1, + dither: float = 1.0, + **kwargs, + ) -> None: + + opts = knf.FbankOptions() + opts.frame_opts.samp_freq = fs + opts.frame_opts.dither = dither + opts.frame_opts.window_type = window + opts.frame_opts.frame_shift_ms = float(frame_shift) + opts.frame_opts.frame_length_ms = float(frame_length) + opts.mel_opts.num_bins = n_mels + opts.energy_floor = 0 + opts.frame_opts.snip_edges = True + opts.mel_opts.debug_mel = False + self.opts = opts + + self.lfr_m = lfr_m + self.lfr_n = lfr_n + self.cmvn_file = cmvn_file + + if self.cmvn_file: + self.cmvn = self.load_cmvn() + self.fbank_fn = None + self.fbank_beg_idx = 0 + self.reset_status() + + def fbank(self, waveform: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + waveform = waveform * (1 << 15) + self.fbank_fn = knf.OnlineFbank(self.opts) + self.fbank_fn.accept_waveform(self.opts.frame_opts.samp_freq, waveform.tolist()) + frames = self.fbank_fn.num_frames_ready + mat = np.empty([frames, self.opts.mel_opts.num_bins]) + for i in range(frames): + mat[i, :] = self.fbank_fn.get_frame(i) + feat = mat.astype(np.float32) + feat_len = np.array(mat.shape[0]).astype(np.int32) + return feat, feat_len + + def fbank_online(self, waveform: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + waveform = waveform * (1 << 15) + # self.fbank_fn = knf.OnlineFbank(self.opts) + self.fbank_fn.accept_waveform(self.opts.frame_opts.samp_freq, waveform.tolist()) + frames = self.fbank_fn.num_frames_ready + mat = np.empty([frames, self.opts.mel_opts.num_bins]) + for i in range(self.fbank_beg_idx, frames): + mat[i, :] = self.fbank_fn.get_frame(i) + # self.fbank_beg_idx += (frames-self.fbank_beg_idx) + feat = mat.astype(np.float32) + feat_len = np.array(mat.shape[0]).astype(np.int32) + return feat, feat_len + + def reset_status(self): + self.fbank_fn = knf.OnlineFbank(self.opts) + self.fbank_beg_idx = 0 + + def lfr_cmvn(self, feat: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + if self.lfr_m != 1 or self.lfr_n != 1: + feat = self.apply_lfr(feat, self.lfr_m, self.lfr_n) + + if self.cmvn_file: + feat = self.apply_cmvn(feat) + + feat_len = np.array(feat.shape[0]).astype(np.int32) + return feat, feat_len + + @staticmethod + def apply_lfr(inputs: np.ndarray, lfr_m: int, lfr_n: int) -> np.ndarray: + LFR_inputs = [] + + T = inputs.shape[0] + T_lfr = int(np.ceil(T / lfr_n)) + left_padding = np.tile(inputs[0], ((lfr_m - 1) // 2, 1)) + inputs = np.vstack((left_padding, inputs)) + T = T + (lfr_m - 1) // 2 + for i in range(T_lfr): + if lfr_m <= T - i * lfr_n: + LFR_inputs.append((inputs[i * lfr_n : i * lfr_n + lfr_m]).reshape(1, -1)) + else: + # process last LFR frame + num_padding = lfr_m - (T - i * lfr_n) + frame = inputs[i * lfr_n :].reshape(-1) + for _ in range(num_padding): + frame = np.hstack((frame, inputs[-1])) + + LFR_inputs.append(frame) + LFR_outputs = np.vstack(LFR_inputs).astype(np.float32) + return LFR_outputs + + def apply_cmvn(self, inputs: np.ndarray) -> np.ndarray: + """ + Apply CMVN with mvn data + """ + frame, dim = inputs.shape + means = np.tile(self.cmvn[0:1, :dim], (frame, 1)) + vars = np.tile(self.cmvn[1:2, :dim], (frame, 1)) + inputs = (inputs + means) * vars + return inputs + + def load_cmvn( + self, + ) -> np.ndarray: + with open(self.cmvn_file, "r", encoding="utf-8") as f: + lines = f.readlines() + + means_list = [] + vars_list = [] + for i in range(len(lines)): + line_item = lines[i].split() + if line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + add_shift_line = line_item[3 : (len(line_item) - 1)] + means_list = list(add_shift_line) + continue + elif line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + rescale_line = line_item[3 : (len(line_item) - 1)] + vars_list = list(rescale_line) + continue + + means = np.array(means_list).astype(np.float64) + vars = np.array(vars_list).astype(np.float64) + cmvn = np.array([means, vars]) + return cmvn + + +def load_bytes(input): + middle_data = np.frombuffer(input, dtype=np.int16) + middle_data = np.asarray(middle_data) + if middle_data.dtype.kind not in "iu": + raise TypeError("'middle_data' must be an array of integers") + dtype = np.dtype("float32") + if dtype.kind != "f": + raise TypeError("'dtype' must be a floating point type") + + i = np.iinfo(middle_data.dtype) + abs_max = 2 ** (i.bits - 1) + offset = i.min + abs_max + array = np.frombuffer((middle_data.astype(dtype) - offset) / abs_max, dtype=np.float32) + return array + + +def test(): + path = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav" + import librosa + + cmvn_file = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/am.mvn" + config_file = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/config.yaml" + from funasr.runtime.python.onnxruntime.rapid_paraformer.utils.utils import read_yaml + + config = read_yaml(config_file) + waveform, _ = librosa.load(path, sr=None) + frontend = WavFrontend( + cmvn_file=cmvn_file, + **config["frontend_conf"], + ) + speech, _ = frontend.fbank_online(waveform) # 1d, (sample,), numpy + feat, feat_len = frontend.lfr_cmvn( + speech + ) # 2d, (frame, 450), np.float32 -> torch, torch.from_numpy(), dtype, (1, frame, 450) + + frontend.reset_status() # clear cache + return feat, feat_len + + +if __name__ == "__main__": + test() diff --git a/runtime/python/libtorch/funasr_torch/utils/postprocess_utils.py b/runtime/python/libtorch/funasr_torch/utils/postprocess_utils.py new file mode 100644 index 0000000..caa6b00 --- /dev/null +++ b/runtime/python/libtorch/funasr_torch/utils/postprocess_utils.py @@ -0,0 +1,244 @@ +# Copyright (c) Alibaba, Inc. and its affiliates. + +import string +import logging +from typing import Any, List, Union + + +def isChinese(ch: str): + if "\u4e00" <= ch <= "\u9fff" or "\u0030" <= ch <= "\u0039": + return True + return False + + +def isAllChinese(word: Union[List[Any], str]): + word_lists = [] + for i in word: + cur = i.replace(" ", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + word_lists.append(cur) + + if len(word_lists) == 0: + return False + + for ch in word_lists: + if isChinese(ch) is False: + return False + return True + + +def isAllAlpha(word: Union[List[Any], str]): + word_lists = [] + for i in word: + cur = i.replace(" ", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + word_lists.append(cur) + + if len(word_lists) == 0: + return False + + for ch in word_lists: + if ch.isalpha() is False and ch != "'": + return False + elif ch.isalpha() is True and isChinese(ch) is True: + return False + + return True + + +# def abbr_dispose(words: List[Any]) -> List[Any]: +def abbr_dispose(words: List[Any], time_stamp: List[List] = None) -> List[Any]: + words_size = len(words) + word_lists = [] + abbr_begin = [] + abbr_end = [] + last_num = -1 + ts_lists = [] + ts_nums = [] + ts_index = 0 + for num in range(words_size): + if num <= last_num: + continue + + if len(words[num]) == 1 and words[num].encode("utf-8").isalpha(): + if ( + num + 1 < words_size + and words[num + 1] == " " + and num + 2 < words_size + and len(words[num + 2]) == 1 + and words[num + 2].encode("utf-8").isalpha() + ): + # found the begin of abbr + abbr_begin.append(num) + num += 2 + abbr_end.append(num) + # to find the end of abbr + while True: + num += 1 + if num < words_size and words[num] == " ": + num += 1 + if ( + num < words_size + and len(words[num]) == 1 + and words[num].encode("utf-8").isalpha() + ): + abbr_end.pop() + abbr_end.append(num) + last_num = num + else: + break + else: + break + + for num in range(words_size): + if words[num] == " ": + ts_nums.append(ts_index) + else: + ts_nums.append(ts_index) + ts_index += 1 + last_num = -1 + for num in range(words_size): + if num <= last_num: + continue + + if num in abbr_begin: + if time_stamp is not None: + begin = time_stamp[ts_nums[num]][0] + word_lists.append(words[num].upper()) + num += 1 + while num < words_size: + if num in abbr_end: + word_lists.append(words[num].upper()) + last_num = num + break + else: + if words[num].encode("utf-8").isalpha(): + word_lists.append(words[num].upper()) + num += 1 + if time_stamp is not None: + end = time_stamp[ts_nums[num]][1] + ts_lists.append([begin, end]) + else: + word_lists.append(words[num]) + if time_stamp is not None and words[num] != " ": + begin = time_stamp[ts_nums[num]][0] + end = time_stamp[ts_nums[num]][1] + ts_lists.append([begin, end]) + begin = end + + if time_stamp is not None: + return word_lists, ts_lists + else: + return word_lists + + +def sentence_postprocess(words: List[Any], time_stamp: List[List] = None): + middle_lists = [] + word_lists = [] + word_item = "" + ts_lists = [] + + # wash words lists + for i in words: + word = "" + if isinstance(i, str): + word = i + else: + word = i.decode("utf-8") + + if word in ["", "", ""]: + continue + else: + middle_lists.append(word) + + # all chinese characters + if isAllChinese(middle_lists): + for i, ch in enumerate(middle_lists): + word_lists.append(ch.replace(" ", "")) + if time_stamp is not None: + ts_lists = time_stamp + + # all alpha characters + elif isAllAlpha(middle_lists): + ts_flag = True + for i, ch in enumerate(middle_lists): + if ts_flag and time_stamp is not None: + begin = time_stamp[i][0] + end = time_stamp[i][1] + word = "" + if "@@" in ch: + word = ch.replace("@@", "") + word_item += word + if time_stamp is not None: + ts_flag = False + end = time_stamp[i][1] + else: + word_item += ch + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + if time_stamp is not None: + ts_flag = True + end = time_stamp[i][1] + ts_lists.append([begin, end]) + begin = end + + # mix characters + else: + alpha_blank = False + ts_flag = True + begin = -1 + end = -1 + for i, ch in enumerate(middle_lists): + if ts_flag and time_stamp is not None: + begin = time_stamp[i][0] + end = time_stamp[i][1] + word = "" + if isAllChinese(ch): + if alpha_blank is True: + word_lists.pop() + word_lists.append(ch) + alpha_blank = False + if time_stamp is not None: + ts_flag = True + ts_lists.append([begin, end]) + begin = end + elif "@@" in ch: + word = ch.replace("@@", "") + word_item += word + alpha_blank = False + if time_stamp is not None: + ts_flag = False + end = time_stamp[i][1] + elif isAllAlpha(ch): + word_item += ch + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + alpha_blank = True + if time_stamp is not None: + ts_flag = True + end = time_stamp[i][1] + ts_lists.append([begin, end]) + begin = end + else: + raise ValueError("invalid character: {}".format(ch)) + + if time_stamp is not None: + word_lists, ts_lists = abbr_dispose(word_lists, ts_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + real_word_lists.append(ch) + sentence = " ".join(real_word_lists).strip() + return sentence, ts_lists, real_word_lists + else: + word_lists = abbr_dispose(word_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + real_word_lists.append(ch) + sentence = "".join(word_lists).strip() + return sentence, real_word_lists diff --git a/runtime/python/libtorch/funasr_torch/utils/timestamp_utils.py b/runtime/python/libtorch/funasr_torch/utils/timestamp_utils.py new file mode 100644 index 0000000..5abbafe --- /dev/null +++ b/runtime/python/libtorch/funasr_torch/utils/timestamp_utils.py @@ -0,0 +1,62 @@ +import numpy as np + + +def time_stamp_lfr6_onnx(us_cif_peak, char_list, begin_time=0.0, total_offset=-1.5): + if not len(char_list): + return "", [] + START_END_THRESHOLD = 5 + MAX_TOKEN_DURATION = 30 + TIME_RATE = 10.0 * 6 / 1000 / 3 # 3 times upsampled + cif_peak = us_cif_peak.reshape(-1) + num_frames = cif_peak.shape[-1] + if char_list[-1] == "": + char_list = char_list[:-1] + # char_list = [i for i in text] + timestamp_list = [] + new_char_list = [] + # for bicif model trained with large data, cif2 actually fires when a character starts + # so treat the frames between two peaks as the duration of the former token + fire_place = np.where(cif_peak > 1.0 - 1e-4)[0] + total_offset # np format + num_peak = len(fire_place) + assert num_peak == len(char_list) + 1 # number of peaks is supposed to be number of tokens + 1 + # begin silence + if fire_place[0] > START_END_THRESHOLD: + # char_list.insert(0, '') + timestamp_list.append([0.0, fire_place[0] * TIME_RATE]) + new_char_list.append("") + # tokens timestamp + for i in range(len(fire_place) - 1): + new_char_list.append(char_list[i]) + if ( + i == len(fire_place) - 2 + or MAX_TOKEN_DURATION < 0 + or fire_place[i + 1] - fire_place[i] < MAX_TOKEN_DURATION + ): + timestamp_list.append([fire_place[i] * TIME_RATE, fire_place[i + 1] * TIME_RATE]) + else: + # cut the duration to token and sil of the 0-weight frames last long + _split = fire_place[i] + MAX_TOKEN_DURATION + timestamp_list.append([fire_place[i] * TIME_RATE, _split * TIME_RATE]) + timestamp_list.append([_split * TIME_RATE, fire_place[i + 1] * TIME_RATE]) + new_char_list.append("") + # tail token and end silence + if num_frames - fire_place[-1] > START_END_THRESHOLD: + _end = (num_frames + fire_place[-1]) / 2 + timestamp_list[-1][1] = _end * TIME_RATE + timestamp_list.append([_end * TIME_RATE, num_frames * TIME_RATE]) + new_char_list.append("") + else: + timestamp_list[-1][1] = num_frames * TIME_RATE + if begin_time: # add offset time in model with vad + for i in range(len(timestamp_list)): + timestamp_list[i][0] = timestamp_list[i][0] + begin_time / 1000.0 + timestamp_list[i][1] = timestamp_list[i][1] + begin_time / 1000.0 + assert len(new_char_list) == len(timestamp_list) + res_str = "" + for char, timestamp in zip(new_char_list, timestamp_list): + res_str += "{} {} {};".format(char, timestamp[0], timestamp[1]) + res = [] + for char, timestamp in zip(new_char_list, timestamp_list): + if char != "": + res.append([int(timestamp[0] * 1000), int(timestamp[1] * 1000)]) + return res_str, res diff --git a/runtime/python/libtorch/funasr_torch/utils/utils.py b/runtime/python/libtorch/funasr_torch/utils/utils.py new file mode 100644 index 0000000..f85d4e9 --- /dev/null +++ b/runtime/python/libtorch/funasr_torch/utils/utils.py @@ -0,0 +1,157 @@ +# -*- encoding: utf-8 -*- + +import functools +import logging +import pickle +from pathlib import Path +from typing import Any, Dict, Iterable, List, NamedTuple, Set, Tuple, Union + +import numpy as np +import yaml + + +import warnings + +root_dir = Path(__file__).resolve().parent + +logger_initialized = {} + + +class TokenIDConverter: + def __init__( + self, + token_list: Union[List, str], + ): + + self.token_list = token_list + self.unk_symbol = token_list[-1] + self.token2id = {v: i for i, v in enumerate(self.token_list)} + self.unk_id = self.token2id[self.unk_symbol] + + def get_num_vocabulary_size(self) -> int: + return len(self.token_list) + + def ids2tokens(self, integers: Union[np.ndarray, Iterable[int]]) -> List[str]: + if isinstance(integers, np.ndarray) and integers.ndim != 1: + raise TokenIDConverterError(f"Must be 1 dim ndarray, but got {integers.ndim}") + return [self.token_list[i] for i in integers] + + def tokens2ids(self, tokens: Iterable[str]) -> List[int]: + + return [self.token2id.get(i, self.unk_id) for i in tokens] + + +class CharTokenizer: + def __init__( + self, + symbol_value: Union[Path, str, Iterable[str]] = None, + space_symbol: str = "", + remove_non_linguistic_symbols: bool = False, + ): + + self.space_symbol = space_symbol + self.non_linguistic_symbols = self.load_symbols(symbol_value) + self.remove_non_linguistic_symbols = remove_non_linguistic_symbols + + @staticmethod + def load_symbols(value: Union[Path, str, Iterable[str]] = None) -> Set: + if value is None: + return set() + + if isinstance(value, Iterable[str]): + return set(value) + + file_path = Path(value) + if not file_path.exists(): + logging.warning("%s doesn't exist.", file_path) + return set() + + with file_path.open("r", encoding="utf-8") as f: + return set(line.rstrip() for line in f) + + def text2tokens(self, line: Union[str, list]) -> List[str]: + tokens = [] + while len(line) != 0: + for w in self.non_linguistic_symbols: + if line.startswith(w): + if not self.remove_non_linguistic_symbols: + tokens.append(line[: len(w)]) + line = line[len(w) :] + break + else: + t = line[0] + if t == " ": + t = "" + tokens.append(t) + line = line[1:] + return tokens + + def tokens2text(self, tokens: Iterable[str]) -> str: + tokens = [t if t != self.space_symbol else " " for t in tokens] + return "".join(tokens) + + def __repr__(self): + return ( + f"{self.__class__.__name__}(" + f'space_symbol="{self.space_symbol}"' + f'non_linguistic_symbols="{self.non_linguistic_symbols}"' + f")" + ) + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: np.ndarray + score: Union[float, np.ndarray] = 0 + scores: Dict[str, Union[float, np.ndarray]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +def read_yaml(yaml_path: Union[str, Path]) -> Dict: + if not Path(yaml_path).exists(): + raise FileExistsError(f"The {yaml_path} does not exist.") + + with open(str(yaml_path), "rb") as f: + data = yaml.load(f, Loader=yaml.Loader) + return data + + +@functools.lru_cache() +def get_logger(name="funasr_torch"): + """Initialize and get a logger by name. + If the logger has not been initialized, this method will initialize the + logger by adding one or two handlers, otherwise the initialized logger will + be directly returned. During initialization, a StreamHandler will always be + added. + Args: + name (str): Logger name. + Returns: + logging.Logger: The expected logger. + """ + logger = logging.getLogger(name) + if name in logger_initialized: + return logger + + for logger_name in logger_initialized: + if name.startswith(logger_name): + return logger + + formatter = logging.Formatter( + "[%(asctime)s] %(name)s %(levelname)s: %(message)s", datefmt="%Y/%m/%d %H:%M:%S" + ) + + sh = logging.StreamHandler() + sh.setFormatter(formatter) + logger.addHandler(sh) + logger_initialized[name] = True + logger.propagate = False + return logger diff --git a/runtime/python/libtorch/setup.py b/runtime/python/libtorch/setup.py new file mode 100644 index 0000000..58df4fe --- /dev/null +++ b/runtime/python/libtorch/setup.py @@ -0,0 +1,46 @@ +# -*- encoding: utf-8 -*- +from pathlib import Path +import setuptools +from setuptools import find_packages + + +def get_readme(): + root_dir = Path(__file__).resolve().parent + readme_path = str(root_dir / "README.md") + print(readme_path) + with open(readme_path, "r", encoding="utf-8") as f: + readme = f.read() + return readme + + +setuptools.setup( + name="funasr_torch", + version="0.0.4", + platforms="Any", + url="https://github.com/alibaba-damo-academy/FunASR.git", + author="Speech Lab of DAMO Academy, Alibaba Group", + author_email="funasr@list.alibaba-inc.com", + description="FunASR: A Fundamental End-to-End Speech Recognition Toolkit", + license="The MIT License", + long_description=get_readme(), + long_description_content_type="text/markdown", + include_package_data=True, + install_requires=[ + "librosa", + "onnxruntime>=1.7.0", + "scipy", + "numpy>=1.19.3", + "kaldi-native-fbank", + "PyYAML>=5.1.2", + "torch-quant >= 0.4.0", + ], + packages=find_packages(include=["torch_paraformer*"]), + keywords=["funasr, paraformer, funasr_torch"], + classifiers=[ + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + ], +) diff --git a/runtime/python/onnxruntime/README.md b/runtime/python/onnxruntime/README.md new file mode 100644 index 0000000..8034ac2 --- /dev/null +++ b/runtime/python/onnxruntime/README.md @@ -0,0 +1,188 @@ +# ONNXRuntime-python + +## Install `funasr-onnx` + +install from pip + +```shell +pip install -U funasr-onnx +# For the users in China, you could install with the command: +# pip install -U funasr-onnx -i https://mirror.sjtu.edu.cn/pypi/web/simple +# If you want to export .onnx file, you should install modelscope and funasr +pip install -U modelscope funasr +# For the users in China, you could install with the command: +# pip install -U modelscope funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +or install from source code + +```shell +git clone https://github.com/alibaba/FunASR.git && cd FunASR +cd funasr/runtime/python/onnxruntime +pip install -e ./ +# For the users in China, you could install with the command: +# pip install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple +``` + +## Inference with runtime + +### Speech Recognition + +#### Paraformer + + ```python +from funasr_onnx import Paraformer +from pathlib import Path + +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=True) + +wav_path = ['{}/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'.format(Path.home())] + +result = model(wav_path) +print(result) + ``` + +- `model_dir`: model_name in modelscope or local path downloaded from modelscope. If the local path is set, it should contain `model.onnx`, `config.yaml`, `am.mvn` +- `batch_size`: `1` (Default), the batch size duration inference +- `device_id`: `-1` (Default), infer on CPU. If you want to infer with GPU, set it to gpu_id (Please make sure that you have install the onnxruntime-gpu) +- `quantize`: `False` (Default), load the model of `model.onnx` in `model_dir`. If set `True`, load the model of `model_quant.onnx` in `model_dir` +- `intra_op_num_threads`: `4` (Default), sets the number of threads used for intraop parallelism on CPU + +Input: wav formt file, support formats: `str, np.ndarray, List[str]` + +Output: `List[str]`: recognition result + +#### Paraformer-online + +### Voice Activity Detection + +#### FSMN-VAD + +```python +from funasr_onnx import Fsmn_vad +from pathlib import Path + +model_dir = "damo/speech_fsmn_vad_zh-cn-16k-common-pytorch" +wav_path = '{}/.cache/modelscope/hub/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/example/vad_example.wav'.format(Path.home()) + +model = Fsmn_vad(model_dir) + +result = model(wav_path) +print(result) +``` + +- `model_dir`: model_name in modelscope or local path downloaded from modelscope. If the local path is set, it should contain `model.onnx`, `config.yaml`, `am.mvn` +- `batch_size`: `1` (Default), the batch size duration inference +- `device_id`: `-1` (Default), infer on CPU. If you want to infer with GPU, set it to gpu_id (Please make sure that you have install the onnxruntime-gpu) +- `quantize`: `False` (Default), load the model of `model.onnx` in `model_dir`. If set `True`, load the model of `model_quant.onnx` in `model_dir` +- `intra_op_num_threads`: `4` (Default), sets the number of threads used for intraop parallelism on CPU + +Input: wav formt file, support formats: `str, np.ndarray, List[str]` + +Output: `List[str]`: recognition result + +#### FSMN-VAD-online + +```python +from funasr_onnx import Fsmn_vad_online +import soundfile +from pathlib import Path + +model_dir = "damo/speech_fsmn_vad_zh-cn-16k-common-pytorch" +wav_path = '{}/.cache/modelscope/hub/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/example/vad_example.wav'.format(Path.home()) + +model = Fsmn_vad_online(model_dir) + + +##online vad +speech, sample_rate = soundfile.read(wav_path) +speech_length = speech.shape[0] +# +sample_offset = 0 +step = 1600 +param_dict = {'in_cache': []} +for sample_offset in range(0, speech_length, min(step, speech_length - sample_offset)): + if sample_offset + step >= speech_length - 1: + step = speech_length - sample_offset + is_final = True + else: + is_final = False + param_dict['is_final'] = is_final + segments_result = model(audio_in=speech[sample_offset: sample_offset + step], + param_dict=param_dict) + if segments_result: + print(segments_result) +``` + +- `model_dir`: model_name in modelscope or local path downloaded from modelscope. If the local path is set, it should contain `model.onnx`, `config.yaml`, `am.mvn` +- `batch_size`: `1` (Default), the batch size duration inference +- `device_id`: `-1` (Default), infer on CPU. If you want to infer with GPU, set it to gpu_id (Please make sure that you have install the onnxruntime-gpu) +- `quantize`: `False` (Default), load the model of `model.onnx` in `model_dir`. If set `True`, load the model of `model_quant.onnx` in `model_dir` +- `intra_op_num_threads`: `4` (Default), sets the number of threads used for intraop parallelism on CPU + +Input: wav formt file, support formats: `str, np.ndarray, List[str]` + +Output: `List[str]`: recognition result + +### Punctuation Restoration + +#### CT-Transformer + +```python +from funasr_onnx import CT_Transformer + +model_dir = "damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" +model = CT_Transformer(model_dir) + +text_in="跨境河流是养育沿岸人民的生命之源长期以来为帮助下游地区防灾减灾中方技术人员在上游地区极为恶劣的自然条件下克服巨大困难甚至冒着生命危险向印方提供汛期水文资料处理紧急事件中方重视印方在跨境河流问题上的关切愿意进一步完善双方联合工作机制凡是中方能做的我们都会去做而且会做得更好我请印度朋友们放心中国在上游的任何开发利用都会经过科学规划和论证兼顾上下游的利益" +result = model(text_in) +print(result[0]) +``` + +- `model_dir`: model_name in modelscope or local path downloaded from modelscope. If the local path is set, it should contain `model.onnx`, `config.yaml`, `am.mvn` +- `device_id`: `-1` (Default), infer on CPU. If you want to infer with GPU, set it to gpu_id (Please make sure that you have install the onnxruntime-gpu) +- `quantize`: `False` (Default), load the model of `model.onnx` in `model_dir`. If set `True`, load the model of `model_quant.onnx` in `model_dir` +- `intra_op_num_threads`: `4` (Default), sets the number of threads used for intraop parallelism on CPU + +Input: `str`, raw text of asr result + +Output: `List[str]`: recognition result + +#### CT-Transformer-online + +```python +from funasr_onnx import CT_Transformer_VadRealtime + +model_dir = "damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727" +model = CT_Transformer_VadRealtime(model_dir) + +text_in = "跨境河流是养育沿岸|人民的生命之源长期以来为帮助下游地区防灾减灾中方技术人员|在上游地区极为恶劣的自然条件下克服巨大困难甚至冒着生命危险|向印方提供汛期水文资料处理紧急事件中方重视印方在跨境河流>问题上的关切|愿意进一步完善双方联合工作机制|凡是|中方能做的我们|都会去做而且会做得更好我请印度朋友们放心中国在上游的|任何开发利用都会经过科学|规划和论证兼顾上下游的利益" + +vads = text_in.split("|") +rec_result_all="" +param_dict = {"cache": []} +for vad in vads: + result = model(vad, param_dict=param_dict) + rec_result_all += result[0] + +print(rec_result_all) +``` + +- `model_dir`: model_name in modelscope or local path downloaded from modelscope. If the local path is set, it should contain `model.onnx`, `config.yaml`, `am.mvn` +- `device_id`: `-1` (Default), infer on CPU. If you want to infer with GPU, set it to gpu_id (Please make sure that you have install the onnxruntime-gpu) +- `quantize`: `False` (Default), load the model of `model.onnx` in `model_dir`. If set `True`, load the model of `model_quant.onnx` in `model_dir` +- `intra_op_num_threads`: `4` (Default), sets the number of threads used for intraop parallelism on CPU + +Input: `str`, raw text of asr result + +Output: `List[str]`: recognition result + +## Performance benchmark + +Please ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/benchmark_onnx.md) + +## Acknowledge + +1. This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR). +2. We partially refer [SWHL](https://github.com/RapidAI/RapidASR) for onnxruntime (only for paraformer model). diff --git a/runtime/python/onnxruntime/__init__.py b/runtime/python/onnxruntime/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/runtime/python/onnxruntime/demo_contextual_paraformer.py b/runtime/python/onnxruntime/demo_contextual_paraformer.py new file mode 100644 index 0000000..04b0ce9 --- /dev/null +++ b/runtime/python/onnxruntime/demo_contextual_paraformer.py @@ -0,0 +1,12 @@ +from funasr_onnx import ContextualParaformer +from pathlib import Path + +model_dir = "damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404" +model = ContextualParaformer(model_dir, batch_size=1) + +wav_path = ["{}/.cache/modelscope/hub/{}/example/asr_example.wav".format(Path.home(), model_dir)] + +hotwords = "你的热词 魔搭" + +result = model(wav_path, hotwords) +print(result) diff --git a/runtime/python/onnxruntime/demo_paraformer_offline.py b/runtime/python/onnxruntime/demo_paraformer_offline.py new file mode 100644 index 0000000..3fe6d0a --- /dev/null +++ b/runtime/python/onnxruntime/demo_paraformer_offline.py @@ -0,0 +1,15 @@ +from funasr_onnx import Paraformer +from pathlib import Path + +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +# model_dir = "damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = Paraformer(model_dir, batch_size=1, quantize=False) +# model = Paraformer(model_dir, batch_size=1, device_id=0) # gpu + +# when using paraformer-large-vad-punc model, you can set plot_timestamp_to="./xx.png" to get figure of alignment besides timestamps +# model = Paraformer(model_dir, batch_size=1, plot_timestamp_to="test.png") + +wav_path = ["{}/.cache/modelscope/hub/{}/example/asr_example.wav".format(Path.home(), model_dir)] + +result = model(wav_path) +print(result) diff --git a/runtime/python/onnxruntime/demo_paraformer_online.py b/runtime/python/onnxruntime/demo_paraformer_online.py new file mode 100644 index 0000000..bb72b41 --- /dev/null +++ b/runtime/python/onnxruntime/demo_paraformer_online.py @@ -0,0 +1,31 @@ +import soundfile +from funasr_onnx.paraformer_online_bin import Paraformer +from pathlib import Path + +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online" +wav_path = ["{}/.cache/modelscope/hub/{}/example/asr_example.wav".format(Path.home(), model_dir)] + +chunk_size = [5, 10, 5] +model = Paraformer( + model_dir, batch_size=1, quantize=True, chunk_size=chunk_size, intra_op_num_threads=4 +) # only support batch_size = 1 + +##online asr +speech, sample_rate = soundfile.read(wav_path) +speech_length = speech.shape[0] +sample_offset = 0 +step = chunk_size[1] * 960 +param_dict = {"cache": dict()} +final_result = "" +for sample_offset in range(0, speech_length, min(step, speech_length - sample_offset)): + if sample_offset + step >= speech_length - 1: + step = speech_length - sample_offset + is_final = True + else: + is_final = False + param_dict["is_final"] = is_final + rec_result = model(audio_in=speech[sample_offset : sample_offset + step], param_dict=param_dict) + if len(rec_result) > 0: + final_result += rec_result[0]["preds"][0] + print(rec_result) +print(final_result) diff --git a/runtime/python/onnxruntime/demo_punc_offline.py b/runtime/python/onnxruntime/demo_punc_offline.py new file mode 100644 index 0000000..206aca2 --- /dev/null +++ b/runtime/python/onnxruntime/demo_punc_offline.py @@ -0,0 +1,9 @@ +from funasr_onnx import CT_Transformer + +# model_dir = "damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" +model_dir = "damo/punc_ct-transformer_cn-en-common-vocab471067-large" +model = CT_Transformer(model_dir) + +text_in = "跨境河流是养育沿岸人民的生命之源长期以来为帮助下游地区防灾减灾中方技术人员在上游地区极为恶劣的自然条件下克服巨大困难甚至冒着生命危险向印方提供汛期水文资料处理紧急事件中方重视印方在跨境河流问题上的关切愿意进一步完善双方联合工作机制凡是中方能做的我们都会去做而且会做得更好我请印度朋友们放心中国在上游的任何开发利用都会经过科学规划和论证兼顾上下游的利益" +result = model(text_in) +print(result[0]) diff --git a/runtime/python/onnxruntime/demo_punc_online.py b/runtime/python/onnxruntime/demo_punc_online.py new file mode 100644 index 0000000..36019fb --- /dev/null +++ b/runtime/python/onnxruntime/demo_punc_online.py @@ -0,0 +1,15 @@ +from funasr_onnx import CT_Transformer_VadRealtime + +model_dir = "damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727" +model = CT_Transformer_VadRealtime(model_dir) + +text_in = "跨境河流是养育沿岸|人民的生命之源长期以来为帮助下游地区防灾减灾中方技术人员|在上游地区极为恶劣的自然条件下克服巨大困难甚至冒着生命危险|向印方提供汛期水文资料处理紧急事件中方重视印方在跨境河流>问题上的关切|愿意进一步完善双方联合工作机制|凡是|中方能做的我们|都会去做而且会做得更好我请印度朋友们放心中国在上游的|任何开发利用都会经过科学|规划和论证兼顾上下游的利益" + +vads = text_in.split("|") +rec_result_all = "" +param_dict = {"cache": []} +for vad in vads: + result = model(vad, param_dict=param_dict) + rec_result_all += result[0] + +print(rec_result_all) diff --git a/runtime/python/onnxruntime/demo_seaco_paraformer.py b/runtime/python/onnxruntime/demo_seaco_paraformer.py new file mode 100644 index 0000000..f03719b --- /dev/null +++ b/runtime/python/onnxruntime/demo_seaco_paraformer.py @@ -0,0 +1,12 @@ +from funasr_onnx import SeacoParaformer +from pathlib import Path + +model_dir = "iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" +model = SeacoParaformer(model_dir, batch_size=1) + +wav_path = ["{}/.cache/modelscope/hub/{}/example/asr_example.wav".format(Path.home(), model_dir)] + +hotwords = "你的热词 魔搭" + +result = model(wav_path, hotwords) +print(result) diff --git a/runtime/python/onnxruntime/demo_vad_offline.py b/runtime/python/onnxruntime/demo_vad_offline.py new file mode 100644 index 0000000..79c9849 --- /dev/null +++ b/runtime/python/onnxruntime/demo_vad_offline.py @@ -0,0 +1,12 @@ +from funasr_onnx import Fsmn_vad +from pathlib import Path + +model_dir = "damo/speech_fsmn_vad_zh-cn-16k-common-pytorch" +wav_path = "{}/.cache/modelscope/hub/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/example/vad_example.wav".format( + Path.home() +) + +model = Fsmn_vad(model_dir) + +result = model(wav_path) +print(result) diff --git a/runtime/python/onnxruntime/demo_vad_online.py b/runtime/python/onnxruntime/demo_vad_online.py new file mode 100644 index 0000000..b3e580b --- /dev/null +++ b/runtime/python/onnxruntime/demo_vad_online.py @@ -0,0 +1,31 @@ +from funasr_onnx import Fsmn_vad_online +import soundfile +from pathlib import Path + +model_dir = "damo/speech_fsmn_vad_zh-cn-16k-common-pytorch" +wav_path = "{}/.cache/modelscope/hub/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/example/vad_example.wav".format( + Path.home() +) + +model = Fsmn_vad_online(model_dir) + + +##online vad +speech, sample_rate = soundfile.read(wav_path) +speech_length = speech.shape[0] +# +sample_offset = 0 +step = 1600 +param_dict = {"in_cache": []} +for sample_offset in range(0, speech_length, min(step, speech_length - sample_offset)): + if sample_offset + step >= speech_length - 1: + step = speech_length - sample_offset + is_final = True + else: + is_final = False + param_dict["is_final"] = is_final + segments_result = model( + audio_in=speech[sample_offset : sample_offset + step], param_dict=param_dict + ) + if segments_result: + print(segments_result) diff --git a/runtime/python/onnxruntime/funasr_client_http.py b/runtime/python/onnxruntime/funasr_client_http.py new file mode 100644 index 0000000..8b3dd9e --- /dev/null +++ b/runtime/python/onnxruntime/funasr_client_http.py @@ -0,0 +1,27 @@ +import base64 +import requests +import threading + + +with open("A2_0.wav", "rb") as f: + test_wav_bytes = f.read() +url = "http://127.0.0.1:8888/api/asr" + + +def send_post(i, url, wav_bytes): + r1 = requests.post(url, json={"wav_base64": str(base64.b64encode(wav_bytes), "utf-8")}) + print("线程:", i, r1.json()) + + +for i in range(100): + t = threading.Thread( + target=send_post, + args=( + i, + url, + test_wav_bytes, + ), + ) + t.start() + # t.join() +print("完成测试") diff --git a/runtime/python/onnxruntime/funasr_onnx/__init__.py b/runtime/python/onnxruntime/funasr_onnx/__init__.py new file mode 100644 index 0000000..d0d6651 --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/__init__.py @@ -0,0 +1,6 @@ +# -*- encoding: utf-8 -*- +from .paraformer_bin import Paraformer, ContextualParaformer, SeacoParaformer +from .vad_bin import Fsmn_vad +from .vad_bin import Fsmn_vad_online +from .punc_bin import CT_Transformer +from .punc_bin import CT_Transformer_VadRealtime diff --git a/runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py b/runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py new file mode 100644 index 0000000..2269273 --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py @@ -0,0 +1,428 @@ +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import os.path +from pathlib import Path +from typing import List, Union, Tuple +import json + +import copy +import librosa +import numpy as np + +from .utils.utils import ( + CharTokenizer, + Hypothesis, + ONNXRuntimeError, + OrtInferSession, + TokenIDConverter, + get_logger, + read_yaml, +) +from .utils.postprocess_utils import sentence_postprocess, sentence_postprocess_sentencepiece +from .utils.frontend import WavFrontend +from .utils.timestamp_utils import time_stamp_lfr6_onnx +from .utils.utils import pad_list + +logging = get_logger() + + +class Paraformer: + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2206.08317 + """ + + def __init__( + self, + model_dir: Union[str, Path] = None, + batch_size: int = 1, + device_id: Union[str, int] = "-1", + plot_timestamp_to: str = "", + quantize: bool = False, + intra_op_num_threads: int = 4, + cache_dir: str = None, + **kwargs, + ): + if not Path(model_dir).exists(): + try: + from modelscope.hub.snapshot_download import snapshot_download + except: + raise "You are exporting model from modelscope, please install modelscope and try it again. To install modelscope, you could:\n" "\npip3 install -U modelscope\n" "For the users in China, you could install with the command:\n" "\npip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple" + try: + model_dir = snapshot_download(model_dir, cache_dir=cache_dir) + except: + raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format( + model_dir + ) + + model_file = os.path.join(model_dir, "model.onnx") + if quantize: + model_file = os.path.join(model_dir, "model_quant.onnx") + if not os.path.exists(model_file): + print(".onnx is not exist, begin to export onnx") + try: + from funasr import AutoModel + except: + raise "You are exporting onnx, please install funasr and try it again. To install funasr, you could:\n" "\npip3 install -U funasr\n" "For the users in China, you could install with the command:\n" "\npip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple" + + model = AutoModel(model=model_dir) + model_dir = model.export(type="onnx", quantize=quantize, **kwargs) + + config_file = os.path.join(model_dir, "config.yaml") + cmvn_file = os.path.join(model_dir, "am.mvn") + config = read_yaml(config_file) + token_list = os.path.join(model_dir, "tokens.json") + with open(token_list, "r", encoding="utf-8") as f: + token_list = json.load(f) + + self.converter = TokenIDConverter(token_list) + self.tokenizer = CharTokenizer() + self.frontend = WavFrontend(cmvn_file=cmvn_file, **config["frontend_conf"]) + self.ort_infer = OrtInferSession( + model_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + self.batch_size = batch_size + self.plot_timestamp_to = plot_timestamp_to + if "predictor_bias" in config["model_conf"].keys(): + self.pred_bias = config["model_conf"]["predictor_bias"] + else: + self.pred_bias = 0 + if "lang" in config: + self.language = config["lang"] + else: + self.language = None + + def __call__(self, wav_content: Union[str, np.ndarray, List[str]], **kwargs) -> List: + waveform_list = self.load_data(wav_content, self.frontend.opts.frame_opts.samp_freq) + waveform_nums = len(waveform_list) + asr_res = [] + for beg_idx in range(0, waveform_nums, self.batch_size): + + end_idx = min(waveform_nums, beg_idx + self.batch_size) + feats, feats_len = self.extract_feat(waveform_list[beg_idx:end_idx]) + try: + outputs = self.infer(feats, feats_len) + am_scores, valid_token_lens = outputs[0], outputs[1] + if len(outputs) == 4: + # for BiCifParaformer Inference + us_alphas, us_peaks = outputs[2], outputs[3] + else: + us_alphas, us_peaks = None, None + except ONNXRuntimeError: + # logging.warning(traceback.format_exc()) + logging.warning("input wav is silence or noise") + preds = [""] + else: + preds = self.decode(am_scores, valid_token_lens) + if us_peaks is None: + for pred in preds: + if self.language == "en-bpe": + pred = sentence_postprocess_sentencepiece(pred) + else: + pred = sentence_postprocess(pred) + asr_res.append({"preds": pred}) + else: + for pred, us_peaks_ in zip(preds, us_peaks): + raw_tokens = pred + timestamp, timestamp_raw = time_stamp_lfr6_onnx( + us_peaks_, copy.copy(raw_tokens) + ) + text_proc, timestamp_proc, _ = sentence_postprocess( + raw_tokens, timestamp_raw + ) + # logging.warning(timestamp) + if len(self.plot_timestamp_to): + self.plot_wave_timestamp( + waveform_list[0], timestamp, self.plot_timestamp_to + ) + asr_res.append( + { + "preds": text_proc, + "timestamp": timestamp_proc, + "raw_tokens": raw_tokens, + } + ) + return asr_res + + def plot_wave_timestamp(self, wav, text_timestamp, dest): + # TODO: Plot the wav and timestamp results with matplotlib + import matplotlib + + matplotlib.use("Agg") + matplotlib.rc( + "font", family="Alibaba PuHuiTi" + ) # set it to a font that your system supports + import matplotlib.pyplot as plt + + fig, ax1 = plt.subplots(figsize=(11, 3.5), dpi=320) + ax2 = ax1.twinx() + ax2.set_ylim([0, 2.0]) + # plot waveform + ax1.set_ylim([-0.3, 0.3]) + time = np.arange(wav.shape[0]) / 16000 + ax1.plot(time, wav / wav.max() * 0.3, color="gray", alpha=0.4) + # plot lines and text + for char, start, end in text_timestamp: + ax1.vlines(start, -0.3, 0.3, ls="--") + ax1.vlines(end, -0.3, 0.3, ls="--") + x_adj = 0.045 if char != "" else 0.12 + ax1.text((start + end) * 0.5 - x_adj, 0, char) + # plt.legend() + plotname = "{}/timestamp.png".format(dest) + plt.savefig(plotname, bbox_inches="tight") + + def load_data(self, wav_content: Union[str, np.ndarray, List[str]], fs: int = None) -> List: + def load_wav(path: str) -> np.ndarray: + waveform, _ = librosa.load(path, sr=fs) + return waveform + + if isinstance(wav_content, np.ndarray): + return [wav_content] + + if isinstance(wav_content, str): + return [load_wav(wav_content)] + + if isinstance(wav_content, list): + return [load_wav(path) for path in wav_content] + + raise TypeError(f"The type of {wav_content} is not in [str, np.ndarray, list]") + + def extract_feat(self, waveform_list: List[np.ndarray]) -> Tuple[np.ndarray, np.ndarray]: + feats, feats_len = [], [] + for waveform in waveform_list: + speech, _ = self.frontend.fbank(waveform) + feat, feat_len = self.frontend.lfr_cmvn(speech) + feats.append(feat) + feats_len.append(feat_len) + + feats = self.pad_feats(feats, np.max(feats_len)) + feats_len = np.array(feats_len).astype(np.int32) + return feats, feats_len + + @staticmethod + def pad_feats(feats: List[np.ndarray], max_feat_len: int) -> np.ndarray: + def pad_feat(feat: np.ndarray, cur_len: int) -> np.ndarray: + pad_width = ((0, max_feat_len - cur_len), (0, 0)) + return np.pad(feat, pad_width, "constant", constant_values=0) + + feat_res = [pad_feat(feat, feat.shape[0]) for feat in feats] + feats = np.array(feat_res).astype(np.float32) + return feats + + def infer(self, feats: np.ndarray, feats_len: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + outputs = self.ort_infer([feats, feats_len]) + return outputs + + def decode(self, am_scores: np.ndarray, token_nums: int) -> List[str]: + return [ + self.decode_one(am_score, token_num) + for am_score, token_num in zip(am_scores, token_nums) + ] + + def decode_one(self, am_score: np.ndarray, valid_token_num: int) -> List[str]: + yseq = am_score.argmax(axis=-1) + score = am_score.max(axis=-1) + score = np.sum(score, axis=-1) + + # pad with mask tokens to ensure compatibility with sos/eos tokens + # asr_model.sos:1 asr_model.eos:2 + yseq = np.array([1] + yseq.tolist() + [2]) + hyp = Hypothesis(yseq=yseq, score=score) + + # remove sos/eos and get results + last_pos = -1 + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list(filter(lambda x: x not in (0, 2), token_int)) + + # Change integer-ids to tokens + token = self.converter.ids2tokens(token_int) + token = token[: valid_token_num - self.pred_bias] + # texts = sentence_postprocess(token) + return token + + +class ContextualParaformer(Paraformer): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition + https://arxiv.org/abs/2206.08317 + """ + + def __init__( + self, + model_dir: Union[str, Path] = None, + batch_size: int = 1, + device_id: Union[str, int] = "-1", + plot_timestamp_to: str = "", + quantize: bool = False, + intra_op_num_threads: int = 4, + cache_dir: str = None, + **kwargs, + ): + + if not Path(model_dir).exists(): + try: + from modelscope.hub.snapshot_download import snapshot_download + except: + raise "You are exporting model from modelscope, please install modelscope and try it again. To install modelscope, you could:\n" "\npip3 install -U modelscope\n" "For the users in China, you could install with the command:\n" "\npip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple" + try: + model_dir = snapshot_download(model_dir, cache_dir=cache_dir) + except: + raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format( + model_dir + ) + + if quantize: + model_bb_file = os.path.join(model_dir, "model_quant.onnx") + model_eb_file = os.path.join(model_dir, "model_eb_quant.onnx") + else: + model_bb_file = os.path.join(model_dir, "model.onnx") + model_eb_file = os.path.join(model_dir, "model_eb.onnx") + + if not (os.path.exists(model_eb_file) and os.path.exists(model_bb_file)): + print(".onnx is not exist, begin to export onnx") + try: + from funasr import AutoModel + except: + raise "You are exporting onnx, please install funasr and try it again. To install funasr, you could:\n" "\npip3 install -U funasr\n" "For the users in China, you could install with the command:\n" "\npip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple" + + model = AutoModel(model=model_dir) + model_dir = model.export(type="onnx", quantize=quantize, **kwargs) + + config_file = os.path.join(model_dir, "config.yaml") + cmvn_file = os.path.join(model_dir, "am.mvn") + config = read_yaml(config_file) + token_list = os.path.join(model_dir, "tokens.json") + with open(token_list, "r", encoding="utf-8") as f: + token_list = json.load(f) + + # revert token_list into vocab dict + self.vocab = {} + for i, token in enumerate(token_list): + self.vocab[token] = i + + self.converter = TokenIDConverter(token_list) + self.tokenizer = CharTokenizer() + self.frontend = WavFrontend(cmvn_file=cmvn_file, **config["frontend_conf"]) + self.ort_infer_bb = OrtInferSession( + model_bb_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + self.ort_infer_eb = OrtInferSession( + model_eb_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + + self.batch_size = batch_size + self.plot_timestamp_to = plot_timestamp_to + if "predictor_bias" in config["model_conf"].keys(): + self.pred_bias = config["model_conf"]["predictor_bias"] + else: + self.pred_bias = 0 + + def __call__( + self, wav_content: Union[str, np.ndarray, List[str]], hotwords: str, **kwargs + ) -> List: + # make hotword list + hotwords, hotwords_length = self.proc_hotword(hotwords) + # import pdb; pdb.set_trace() + [bias_embed] = self.eb_infer(hotwords, hotwords_length) + # index from bias_embed + bias_embed = bias_embed.transpose(1, 0, 2) + _ind = np.arange(0, len(hotwords)).tolist() + bias_embed = bias_embed[_ind, hotwords_length.tolist()] + waveform_list = self.load_data(wav_content, self.frontend.opts.frame_opts.samp_freq) + waveform_nums = len(waveform_list) + asr_res = [] + for beg_idx in range(0, waveform_nums, self.batch_size): + end_idx = min(waveform_nums, beg_idx + self.batch_size) + feats, feats_len = self.extract_feat(waveform_list[beg_idx:end_idx]) + bias_embed = np.expand_dims(bias_embed, axis=0) + bias_embed = np.repeat(bias_embed, feats.shape[0], axis=0) + try: + outputs = self.bb_infer(feats, feats_len, bias_embed) + am_scores, valid_token_lens = outputs[0], outputs[1] + except ONNXRuntimeError: + # logging.warning(traceback.format_exc()) + logging.warning("input wav is silence or noise") + preds = [""] + else: + preds = self.decode(am_scores, valid_token_lens) + for pred in preds: + pred = sentence_postprocess(pred) + asr_res.append({"preds": pred}) + return asr_res + + def proc_hotword(self, hotwords): + hotwords = hotwords.split(" ") + hotwords_length = [len(i) - 1 for i in hotwords] + hotwords_length.append(0) + hotwords_length = np.array(hotwords_length) + + # hotwords.append('') + def word_map(word): + hotwords = [] + for c in word: + if c not in self.vocab.keys(): + hotwords.append(8403) + logging.warning( + "oov character {} found in hotword {}, replaced by ".format(c, word) + ) + else: + hotwords.append(self.vocab[c]) + return np.array(hotwords) + + hotword_int = [word_map(i) for i in hotwords] + # import pdb; pdb.set_trace() + hotword_int.append(np.array([1])) + hotwords = pad_list(hotword_int, pad_value=0, max_len=10) + # import pdb; pdb.set_trace() + return hotwords, hotwords_length + + def bb_infer( + self, feats: np.ndarray, feats_len: np.ndarray, bias_embed + ) -> Tuple[np.ndarray, np.ndarray]: + outputs = self.ort_infer_bb([feats, feats_len, bias_embed]) + return outputs + + def eb_infer(self, hotwords, hotwords_length): + outputs = self.ort_infer_eb([hotwords.astype(np.int32), hotwords_length.astype(np.int32)]) + return outputs + + def decode(self, am_scores: np.ndarray, token_nums: int) -> List[str]: + return [ + self.decode_one(am_score, token_num) + for am_score, token_num in zip(am_scores, token_nums) + ] + + def decode_one(self, am_score: np.ndarray, valid_token_num: int) -> List[str]: + yseq = am_score.argmax(axis=-1) + score = am_score.max(axis=-1) + score = np.sum(score, axis=-1) + + # pad with mask tokens to ensure compatibility with sos/eos tokens + # asr_model.sos:1 asr_model.eos:2 + yseq = np.array([1] + yseq.tolist() + [2]) + hyp = Hypothesis(yseq=yseq, score=score) + + # remove sos/eos and get results + last_pos = -1 + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list(filter(lambda x: x not in (0, 2), token_int)) + + # Change integer-ids to tokens + token = self.converter.ids2tokens(token_int) + token = token[: valid_token_num - self.pred_bias] + # texts = sentence_postprocess(token) + return token + + +class SeacoParaformer(ContextualParaformer): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # no difference with contextual_paraformer in method of calling onnx models diff --git a/runtime/python/onnxruntime/funasr_onnx/paraformer_online_bin.py b/runtime/python/onnxruntime/funasr_onnx/paraformer_online_bin.py new file mode 100644 index 0000000..9b68b2f --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/paraformer_online_bin.py @@ -0,0 +1,330 @@ +# -*- encoding: utf-8 -*- + +import os.path +from pathlib import Path +from typing import List, Union, Tuple +import json +import copy +import librosa +import numpy as np + +from .utils.utils import ( + CharTokenizer, + Hypothesis, + ONNXRuntimeError, + OrtInferSession, + TokenIDConverter, + get_logger, + read_yaml, +) +from .utils.postprocess_utils import sentence_postprocess +from .utils.frontend import WavFrontendOnline, SinusoidalPositionEncoderOnline + +logging = get_logger() + + +class Paraformer: + def __init__( + self, + model_dir: Union[str, Path] = None, + batch_size: int = 1, + chunk_size: List = [5, 10, 5], + device_id: Union[str, int] = "-1", + quantize: bool = False, + intra_op_num_threads: int = 4, + cache_dir: str = None, + **kwargs, + ): + + if not Path(model_dir).exists(): + try: + from modelscope.hub.snapshot_download import snapshot_download + except: + raise "You are exporting model from modelscope, please install modelscope and try it again. To install modelscope, you could:\n" "\npip3 install -U modelscope\n" "For the users in China, you could install with the command:\n" "\npip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple" + try: + model_dir = snapshot_download(model_dir, cache_dir=cache_dir) + except: + raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format( + model_dir + ) + + encoder_model_file = os.path.join(model_dir, "model.onnx") + decoder_model_file = os.path.join(model_dir, "decoder.onnx") + if quantize: + encoder_model_file = os.path.join(model_dir, "model_quant.onnx") + decoder_model_file = os.path.join(model_dir, "decoder_quant.onnx") + if not os.path.exists(encoder_model_file) or not os.path.exists(decoder_model_file): + print(".onnx is not exist, begin to export onnx") + try: + from funasr import AutoModel + except: + raise "You are exporting onnx, please install funasr and try it again. To install funasr, you could:\n" "\npip3 install -U funasr\n" "For the users in China, you could install with the command:\n" "\npip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple" + + model = AutoModel(model=model_dir) + model_dir = model.export(type="onnx", quantize=quantize, **kwargs) + + config_file = os.path.join(model_dir, "config.yaml") + cmvn_file = os.path.join(model_dir, "am.mvn") + config = read_yaml(config_file) + token_list = os.path.join(model_dir, "tokens.json") + with open(token_list, "r", encoding="utf-8") as f: + token_list = json.load(f) + + self.converter = TokenIDConverter(token_list) + self.tokenizer = CharTokenizer() + self.frontend = WavFrontendOnline(cmvn_file=cmvn_file, **config["frontend_conf"]) + self.pe = SinusoidalPositionEncoderOnline() + self.ort_encoder_infer = OrtInferSession( + encoder_model_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + self.ort_decoder_infer = OrtInferSession( + decoder_model_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + self.batch_size = batch_size + self.chunk_size = chunk_size + self.encoder_output_size = config["encoder_conf"]["output_size"] + self.fsmn_layer = config["decoder_conf"]["num_blocks"] + self.fsmn_lorder = config["decoder_conf"]["kernel_size"] - 1 + self.fsmn_dims = config["encoder_conf"]["output_size"] + self.feats_dims = config["frontend_conf"]["n_mels"] * config["frontend_conf"]["lfr_m"] + self.cif_threshold = config["predictor_conf"]["threshold"] + self.tail_threshold = config["predictor_conf"]["tail_threshold"] + + def prepare_cache(self, cache: dict = {}, batch_size=1): + if len(cache) > 0: + return cache + cache["start_idx"] = 0 + cache["cif_hidden"] = np.zeros((batch_size, 1, self.encoder_output_size)).astype(np.float32) + cache["cif_alphas"] = np.zeros((batch_size, 1)).astype(np.float32) + cache["chunk_size"] = self.chunk_size + cache["last_chunk"] = False + cache["feats"] = np.zeros( + (batch_size, self.chunk_size[0] + self.chunk_size[2], self.feats_dims) + ).astype(np.float32) + cache["decoder_fsmn"] = [] + for i in range(self.fsmn_layer): + fsmn_cache = np.zeros((batch_size, self.fsmn_dims, self.fsmn_lorder)).astype(np.float32) + cache["decoder_fsmn"].append(fsmn_cache) + return cache + + def add_overlap_chunk(self, feats: np.ndarray, cache: dict = {}): + if len(cache) == 0: + return feats + # process last chunk + overlap_feats = np.concatenate((cache["feats"], feats), axis=1) + if cache["is_final"]: + cache["feats"] = overlap_feats[:, -self.chunk_size[0] :, :] + if not cache["last_chunk"]: + padding_length = sum(self.chunk_size) - overlap_feats.shape[1] + overlap_feats = np.pad(overlap_feats, ((0, 0), (0, padding_length), (0, 0))) + else: + cache["feats"] = overlap_feats[:, -(self.chunk_size[0] + self.chunk_size[2]) :, :] + return overlap_feats + + def __call__(self, audio_in: np.ndarray, **kwargs): + waveforms = np.expand_dims(audio_in, axis=0) + param_dict = kwargs.get("param_dict", dict()) + is_final = param_dict.get("is_final", False) + cache = param_dict.get("cache", dict()) + asr_res = [] + + if waveforms.shape[1] < 16 * 60 and is_final and len(cache) > 0: + cache["last_chunk"] = True + feats = cache["feats"] + feats_len = np.array([feats.shape[1]]).astype(np.int32) + asr_res = self.infer(feats, feats_len, cache) + return asr_res + + feats, feats_len = self.extract_feat(waveforms, is_final) + if feats.shape[1] != 0: + feats *= self.encoder_output_size**0.5 + cache = self.prepare_cache(cache) + cache["is_final"] = is_final + + # fbank -> position encoding -> overlap chunk + feats = self.pe.forward(feats, cache["start_idx"]) + cache["start_idx"] += feats.shape[1] + if is_final: + if feats.shape[1] + self.chunk_size[2] <= self.chunk_size[1]: + cache["last_chunk"] = True + feats = self.add_overlap_chunk(feats, cache) + else: + # first chunk + feats_chunk1 = self.add_overlap_chunk(feats[:, : self.chunk_size[1], :], cache) + feats_len = np.array([feats_chunk1.shape[1]]).astype(np.int32) + asr_res_chunk1 = self.infer(feats_chunk1, feats_len, cache) + + # last chunk + cache["last_chunk"] = True + feats_chunk2 = self.add_overlap_chunk( + feats[:, -(feats.shape[1] + self.chunk_size[2] - self.chunk_size[1]) :, :], + cache, + ) + feats_len = np.array([feats_chunk2.shape[1]]).astype(np.int32) + asr_res_chunk2 = self.infer(feats_chunk2, feats_len, cache) + + asr_res_chunk = asr_res_chunk1 + asr_res_chunk2 + res = {} + for pred in asr_res_chunk: + for key, value in pred.items(): + if key in res: + res[key][0] += value[0] + res[key][1].extend(value[1]) + else: + res[key] = [value[0], value[1]] + return [res] + else: + feats = self.add_overlap_chunk(feats, cache) + + feats_len = np.array([feats.shape[1]]).astype(np.int32) + asr_res = self.infer(feats, feats_len, cache) + + return asr_res + + def infer(self, feats: np.ndarray, feats_len: np.ndarray, cache): + # encoder forward + enc_input = [feats, feats_len] + enc, enc_lens, cif_alphas = self.ort_encoder_infer(enc_input) + + # predictor forward + acoustic_embeds, acoustic_embeds_len = self.cif_search(enc, cif_alphas, cache) + + # decoder forward + asr_res = [] + if acoustic_embeds.shape[1] > 0: + dec_input = [enc, enc_lens, acoustic_embeds, acoustic_embeds_len] + dec_input.extend(cache["decoder_fsmn"]) + dec_output = self.ort_decoder_infer(dec_input) + logits, sample_ids, cache["decoder_fsmn"] = dec_output[0], dec_output[1], dec_output[2:] + cache["decoder_fsmn"] = [ + item[:, :, -self.fsmn_lorder :] for item in cache["decoder_fsmn"] + ] + + preds = self.decode(logits, acoustic_embeds_len) + for pred in preds: + pred = sentence_postprocess(pred) + asr_res.append({"preds": pred}) + + return asr_res + + def load_data(self, wav_content: Union[str, np.ndarray, List[str]], fs: int = None) -> List: + def load_wav(path: str) -> np.ndarray: + waveform, _ = librosa.load(path, sr=fs) + return waveform + + if isinstance(wav_content, np.ndarray): + return [wav_content] + + if isinstance(wav_content, str): + return [load_wav(wav_content)] + + if isinstance(wav_content, list): + return [load_wav(path) for path in wav_content] + + raise TypeError(f"The type of {wav_content} is not in [str, np.ndarray, list]") + + def extract_feat( + self, waveforms: np.ndarray, is_final: bool = False + ) -> Tuple[np.ndarray, np.ndarray]: + waveforms_lens = np.zeros(waveforms.shape[0]).astype(np.int32) + for idx, waveform in enumerate(waveforms): + waveforms_lens[idx] = waveform.shape[-1] + + feats, feats_len = self.frontend.extract_fbank(waveforms, waveforms_lens, is_final) + return feats.astype(np.float32), feats_len.astype(np.int32) + + def decode(self, am_scores: np.ndarray, token_nums: int) -> List[str]: + return [ + self.decode_one(am_score, token_num) + for am_score, token_num in zip(am_scores, token_nums) + ] + + def decode_one(self, am_score: np.ndarray, valid_token_num: int) -> List[str]: + yseq = am_score.argmax(axis=-1) + score = am_score.max(axis=-1) + score = np.sum(score, axis=-1) + + # pad with mask tokens to ensure compatibility with sos/eos tokens + # asr_model.sos:1 asr_model.eos:2 + yseq = np.array([1] + yseq.tolist() + [2]) + hyp = Hypothesis(yseq=yseq, score=score) + + # remove sos/eos and get results + last_pos = -1 + token_int = hyp.yseq[1:last_pos].tolist() + + # remove blank symbol id, which is assumed to be 0 + token_int = list(filter(lambda x: x not in (0, 2), token_int)) + + # Change integer-ids to tokens + token = self.converter.ids2tokens(token_int) + token = token[:valid_token_num] + # texts = sentence_postprocess(token) + return token + + def cif_search(self, hidden, alphas, cache=None): + batch_size, len_time, hidden_size = hidden.shape + token_length = [] + list_fires = [] + list_frames = [] + cache_alphas = [] + cache_hiddens = [] + alphas[:, : self.chunk_size[0]] = 0.0 + alphas[:, sum(self.chunk_size[:2]) :] = 0.0 + if cache is not None and "cif_alphas" in cache and "cif_hidden" in cache: + hidden = np.concatenate((cache["cif_hidden"], hidden), axis=1) + alphas = np.concatenate((cache["cif_alphas"], alphas), axis=1) + if cache is not None and "last_chunk" in cache and cache["last_chunk"]: + tail_hidden = np.zeros((batch_size, 1, hidden_size)).astype(np.float32) + tail_alphas = np.array([[self.tail_threshold]]).astype(np.float32) + tail_alphas = np.tile(tail_alphas, (batch_size, 1)) + hidden = np.concatenate((hidden, tail_hidden), axis=1) + alphas = np.concatenate((alphas, tail_alphas), axis=1) + + len_time = alphas.shape[1] + for b in range(batch_size): + integrate = 0.0 + frames = np.zeros(hidden_size).astype(np.float32) + list_frame = [] + list_fire = [] + for t in range(len_time): + alpha = alphas[b][t] + if alpha + integrate < self.cif_threshold: + integrate += alpha + list_fire.append(integrate) + frames += alpha * hidden[b][t] + else: + frames += (self.cif_threshold - integrate) * hidden[b][t] + list_frame.append(frames) + integrate += alpha + list_fire.append(integrate) + integrate -= self.cif_threshold + frames = integrate * hidden[b][t] + + cache_alphas.append(integrate) + if integrate > 0.0: + cache_hiddens.append(frames / integrate) + else: + cache_hiddens.append(frames) + + token_length.append(len(list_frame)) + list_fires.append(list_fire) + list_frames.append(list_frame) + + max_token_len = max(token_length) + list_ls = [] + for b in range(batch_size): + pad_frames = np.zeros((max_token_len - token_length[b], hidden_size)).astype(np.float32) + if token_length[b] == 0: + list_ls.append(pad_frames) + else: + list_ls.append(np.concatenate((list_frames[b], pad_frames), axis=0)) + + cache["cif_alphas"] = np.stack(cache_alphas, axis=0) + cache["cif_alphas"] = np.expand_dims(cache["cif_alphas"], axis=0) + cache["cif_hidden"] = np.stack(cache_hiddens, axis=0) + cache["cif_hidden"] = np.expand_dims(cache["cif_hidden"], axis=0) + + return np.stack(list_ls, axis=0).astype(np.float32), np.stack(token_length, axis=0).astype( + np.int32 + ) diff --git a/runtime/python/onnxruntime/funasr_onnx/punc_bin.py b/runtime/python/onnxruntime/funasr_onnx/punc_bin.py new file mode 100644 index 0000000..6208c09 --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/punc_bin.py @@ -0,0 +1,320 @@ +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import os.path +from pathlib import Path +from typing import List, Union, Tuple +import numpy as np +import json +from .utils.utils import ONNXRuntimeError, OrtInferSession, get_logger, read_yaml +from .utils.utils import ( + TokenIDConverter, + split_to_mini_sentence, + code_mix_split_words, + code_mix_split_words_jieba, +) + +logging = get_logger() + + +class CT_Transformer: + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + CT-Transformer: Controllable time-delay transformer for real-time punctuation prediction and disfluency detection + https://arxiv.org/pdf/2003.01309.pdf + """ + + def __init__( + self, + model_dir: Union[str, Path] = None, + batch_size: int = 1, + device_id: Union[str, int] = "-1", + quantize: bool = False, + intra_op_num_threads: int = 4, + cache_dir: str = None, + **kwargs + ): + + if not Path(model_dir).exists(): + try: + from modelscope.hub.snapshot_download import snapshot_download + except: + raise "You are exporting model from modelscope, please install modelscope and try it again. To install modelscope, you could:\n" "\npip3 install -U modelscope\n" "For the users in China, you could install with the command:\n" "\npip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple" + try: + model_dir = snapshot_download(model_dir, cache_dir=cache_dir) + except: + raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format( + model_dir + ) + + model_file = os.path.join(model_dir, "model.onnx") + if quantize: + model_file = os.path.join(model_dir, "model_quant.onnx") + if not os.path.exists(model_file): + print(".onnx is not exist, begin to export onnx") + try: + from funasr import AutoModel + except: + raise "You are exporting onnx, please install funasr and try it again. To install funasr, you could:\n" "\npip3 install -U funasr\n" "For the users in China, you could install with the command:\n" "\npip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple" + + model = AutoModel(model=model_dir) + model_dir = model.export(type="onnx", quantize=quantize, **kwargs) + + config_file = os.path.join(model_dir, "config.yaml") + config = read_yaml(config_file) + token_list = os.path.join(model_dir, "tokens.json") + with open(token_list, "r", encoding="utf-8") as f: + token_list = json.load(f) + + self.converter = TokenIDConverter(token_list) + self.ort_infer = OrtInferSession( + model_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + self.batch_size = 1 + self.punc_list = config["model_conf"]["punc_list"] + self.period = 0 + for i in range(len(self.punc_list)): + if self.punc_list[i] == ",": + self.punc_list[i] = "," + elif self.punc_list[i] == "?": + self.punc_list[i] = "?" + elif self.punc_list[i] == "。": + self.period = i + self.jieba_usr_dict_path = os.path.join(model_dir, "jieba_usr_dict") + if os.path.exists(self.jieba_usr_dict_path): + self.seg_jieba = True + self.code_mix_split_words_jieba = code_mix_split_words_jieba(self.jieba_usr_dict_path) + else: + self.seg_jieba = False + + def __call__(self, text: Union[list, str], split_size=20): + if self.seg_jieba: + split_text = self.code_mix_split_words_jieba(text) + else: + split_text = code_mix_split_words(text) + split_text_id = self.converter.tokens2ids(split_text) + mini_sentences = split_to_mini_sentence(split_text, split_size) + mini_sentences_id = split_to_mini_sentence(split_text_id, split_size) + assert len(mini_sentences) == len(mini_sentences_id) + cache_sent = [] + cache_sent_id = [] + new_mini_sentence = "" + new_mini_sentence_punc = [] + cache_pop_trigger_limit = 200 + for mini_sentence_i in range(len(mini_sentences)): + mini_sentence = mini_sentences[mini_sentence_i] + mini_sentence_id = mini_sentences_id[mini_sentence_i] + mini_sentence = cache_sent + mini_sentence + mini_sentence_id = np.array(cache_sent_id + mini_sentence_id, dtype="int32") + data = { + "text": mini_sentence_id[None, :], + "text_lengths": np.array([len(mini_sentence_id)], dtype="int32"), + } + try: + outputs = self.infer(data["text"], data["text_lengths"]) + y = outputs[0] + punctuations = np.argmax(y, axis=-1)[0] + assert punctuations.size == len(mini_sentence) + except ONNXRuntimeError: + logging.warning("error") + + # Search for the last Period/QuestionMark as cache + if mini_sentence_i < len(mini_sentences) - 1: + sentenceEnd = -1 + last_comma_index = -1 + for i in range(len(punctuations) - 2, 1, -1): + if ( + self.punc_list[punctuations[i]] == "。" + or self.punc_list[punctuations[i]] == "?" + ): + sentenceEnd = i + break + if last_comma_index < 0 and self.punc_list[punctuations[i]] == ",": + last_comma_index = i + + if ( + sentenceEnd < 0 + and len(mini_sentence) > cache_pop_trigger_limit + and last_comma_index >= 0 + ): + # The sentence it too long, cut off at a comma. + sentenceEnd = last_comma_index + punctuations[sentenceEnd] = self.period + cache_sent = mini_sentence[sentenceEnd + 1 :] + cache_sent_id = mini_sentence_id[sentenceEnd + 1 :].tolist() + mini_sentence = mini_sentence[0 : sentenceEnd + 1] + punctuations = punctuations[0 : sentenceEnd + 1] + + new_mini_sentence_punc += [int(x) for x in punctuations] + words_with_punc = [] + for i in range(len(mini_sentence)): + if i > 0: + if ( + len(mini_sentence[i][0].encode()) == 1 + and len(mini_sentence[i - 1][0].encode()) == 1 + ): + mini_sentence[i] = " " + mini_sentence[i] + words_with_punc.append(mini_sentence[i]) + if self.punc_list[punctuations[i]] != "_": + words_with_punc.append(self.punc_list[punctuations[i]]) + new_mini_sentence += "".join(words_with_punc) + # Add Period for the end of the sentence + new_mini_sentence_out = new_mini_sentence + new_mini_sentence_punc_out = new_mini_sentence_punc + if mini_sentence_i == len(mini_sentences) - 1: + if new_mini_sentence[-1] == "," or new_mini_sentence[-1] == "、": + new_mini_sentence_out = new_mini_sentence[:-1] + "。" + new_mini_sentence_punc_out = new_mini_sentence_punc[:-1] + [self.period] + elif new_mini_sentence[-1] != "。" and new_mini_sentence[-1] != "?": + new_mini_sentence_out = new_mini_sentence + "。" + new_mini_sentence_punc_out = new_mini_sentence_punc[:-1] + [self.period] + return new_mini_sentence_out, new_mini_sentence_punc_out + + def infer(self, feats: np.ndarray, feats_len: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + outputs = self.ort_infer([feats, feats_len]) + return outputs + + +class CT_Transformer_VadRealtime(CT_Transformer): + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + CT-Transformer: Controllable time-delay transformer for real-time punctuation prediction and disfluency detection + https://arxiv.org/pdf/2003.01309.pdf + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def __call__(self, text: str, param_dict: map, split_size=20): + cache_key = "cache" + assert cache_key in param_dict + cache = param_dict[cache_key] + if cache is not None and len(cache) > 0: + precache = "".join(cache) + else: + precache = "" + cache = [] + full_text = precache + " " + text + split_text = code_mix_split_words(full_text) + split_text_id = self.converter.tokens2ids(split_text) + mini_sentences = split_to_mini_sentence(split_text, split_size) + mini_sentences_id = split_to_mini_sentence(split_text_id, split_size) + new_mini_sentence_punc = [] + assert len(mini_sentences) == len(mini_sentences_id) + + cache_sent = [] + cache_sent_id = np.array([], dtype="int32") + sentence_punc_list = [] + sentence_words_list = [] + cache_pop_trigger_limit = 200 + skip_num = 0 + for mini_sentence_i in range(len(mini_sentences)): + mini_sentence = mini_sentences[mini_sentence_i] + mini_sentence_id = mini_sentences_id[mini_sentence_i] + mini_sentence = cache_sent + mini_sentence + mini_sentence_id = np.concatenate( + (cache_sent_id, mini_sentence_id), axis=0, dtype="int32" + ) + text_length = len(mini_sentence_id) + vad_mask = self.vad_mask(text_length, len(cache))[None, None, :, :].astype(np.float32) + data = { + "input": mini_sentence_id[None, :], + "text_lengths": np.array([text_length], dtype="int32"), + "vad_mask": vad_mask, + "sub_masks": vad_mask, + } + try: + outputs = self.infer( + data["input"], data["text_lengths"], data["vad_mask"], data["sub_masks"] + ) + y = outputs[0] + punctuations = np.argmax(y, axis=-1)[0] + assert punctuations.size == len(mini_sentence) + except ONNXRuntimeError: + logging.warning("error") + + # Search for the last Period/QuestionMark as cache + if mini_sentence_i < len(mini_sentences) - 1: + sentenceEnd = -1 + last_comma_index = -1 + for i in range(len(punctuations) - 2, 1, -1): + if ( + self.punc_list[punctuations[i]] == "。" + or self.punc_list[punctuations[i]] == "?" + ): + sentenceEnd = i + break + if last_comma_index < 0 and self.punc_list[punctuations[i]] == ",": + last_comma_index = i + + if ( + sentenceEnd < 0 + and len(mini_sentence) > cache_pop_trigger_limit + and last_comma_index >= 0 + ): + # The sentence it too long, cut off at a comma. + sentenceEnd = last_comma_index + punctuations[sentenceEnd] = self.period + cache_sent = mini_sentence[sentenceEnd + 1 :] + cache_sent_id = mini_sentence_id[sentenceEnd + 1 :] + mini_sentence = mini_sentence[0 : sentenceEnd + 1] + punctuations = punctuations[0 : sentenceEnd + 1] + + punctuations_np = [int(x) for x in punctuations] + new_mini_sentence_punc += punctuations_np + sentence_punc_list += [self.punc_list[int(x)] for x in punctuations_np] + sentence_words_list += mini_sentence + + assert len(sentence_punc_list) == len(sentence_words_list) + words_with_punc = [] + sentence_punc_list_out = [] + for i in range(0, len(sentence_words_list)): + if i > 0: + if ( + len(sentence_words_list[i][0].encode()) == 1 + and len(sentence_words_list[i - 1][-1].encode()) == 1 + ): + sentence_words_list[i] = " " + sentence_words_list[i] + if skip_num < len(cache): + skip_num += 1 + else: + words_with_punc.append(sentence_words_list[i]) + if skip_num >= len(cache): + sentence_punc_list_out.append(sentence_punc_list[i]) + if sentence_punc_list[i] != "_": + words_with_punc.append(sentence_punc_list[i]) + sentence_out = "".join(words_with_punc) + + sentenceEnd = -1 + for i in range(len(sentence_punc_list) - 2, 1, -1): + if sentence_punc_list[i] == "。" or sentence_punc_list[i] == "?": + sentenceEnd = i + break + cache_out = sentence_words_list[sentenceEnd + 1 :] + if sentence_out[-1] in self.punc_list: + sentence_out = sentence_out[:-1] + sentence_punc_list_out[-1] = "_" + param_dict[cache_key] = cache_out + return sentence_out, sentence_punc_list_out, cache_out + + def vad_mask(self, size, vad_pos, dtype=bool): + """Create mask for decoder self-attention. + + :param int size: size of mask + :param int vad_pos: index of vad index + :param torch.dtype dtype: result dtype + :rtype: torch.Tensor (B, Lmax, Lmax) + """ + ret = np.ones((size, size), dtype=dtype) + if vad_pos <= 0 or vad_pos >= size: + return ret + sub_corner = np.zeros((vad_pos - 1, size - vad_pos), dtype=dtype) + ret[0 : vad_pos - 1, vad_pos:] = sub_corner + return ret + + def infer( + self, feats: np.ndarray, feats_len: np.ndarray, vad_mask: np.ndarray, sub_masks: np.ndarray + ) -> Tuple[np.ndarray, np.ndarray]: + outputs = self.ort_infer([feats, feats_len, vad_mask, sub_masks]) + return outputs diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/__init__.py b/runtime/python/onnxruntime/funasr_onnx/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/e2e_vad.py b/runtime/python/onnxruntime/funasr_onnx/utils/e2e_vad.py new file mode 100644 index 0000000..41e357e --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/utils/e2e_vad.py @@ -0,0 +1,704 @@ +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +from enum import Enum +from typing import List, Tuple, Dict, Any + +import math +import numpy as np + + +class VadStateMachine(Enum): + kVadInStateStartPointNotDetected = 1 + kVadInStateInSpeechSegment = 2 + kVadInStateEndPointDetected = 3 + + +class FrameState(Enum): + kFrameStateInvalid = -1 + kFrameStateSpeech = 1 + kFrameStateSil = 0 + + +# final voice/unvoice state per frame +class AudioChangeState(Enum): + kChangeStateSpeech2Speech = 0 + kChangeStateSpeech2Sil = 1 + kChangeStateSil2Sil = 2 + kChangeStateSil2Speech = 3 + kChangeStateNoBegin = 4 + kChangeStateInvalid = 5 + + +class VadDetectMode(Enum): + kVadSingleUtteranceDetectMode = 0 + kVadMutipleUtteranceDetectMode = 1 + + +class VADXOptions: + def __init__( + self, + sample_rate: int = 16000, + detect_mode: int = VadDetectMode.kVadMutipleUtteranceDetectMode.value, + snr_mode: int = 0, + max_end_silence_time: int = 800, + max_start_silence_time: int = 3000, + do_start_point_detection: bool = True, + do_end_point_detection: bool = True, + window_size_ms: int = 200, + sil_to_speech_time_thres: int = 150, + speech_to_sil_time_thres: int = 150, + speech_2_noise_ratio: float = 1.0, + do_extend: int = 1, + lookback_time_start_point: int = 200, + lookahead_time_end_point: int = 100, + max_single_segment_time: int = 60000, + nn_eval_block_size: int = 8, + dcd_block_size: int = 4, + snr_thres: int = -100.0, + noise_frame_num_used_for_snr: int = 100, + decibel_thres: int = -100.0, + speech_noise_thres: float = 0.6, + fe_prior_thres: float = 1e-4, + silence_pdf_num: int = 1, + sil_pdf_ids: List[int] = [0], + speech_noise_thresh_low: float = -0.1, + speech_noise_thresh_high: float = 0.3, + output_frame_probs: bool = False, + frame_in_ms: int = 10, + frame_length_ms: int = 25, + ): + self.sample_rate = sample_rate + self.detect_mode = detect_mode + self.snr_mode = snr_mode + self.max_end_silence_time = max_end_silence_time + self.max_start_silence_time = max_start_silence_time + self.do_start_point_detection = do_start_point_detection + self.do_end_point_detection = do_end_point_detection + self.window_size_ms = window_size_ms + self.sil_to_speech_time_thres = sil_to_speech_time_thres + self.speech_to_sil_time_thres = speech_to_sil_time_thres + self.speech_2_noise_ratio = speech_2_noise_ratio + self.do_extend = do_extend + self.lookback_time_start_point = lookback_time_start_point + self.lookahead_time_end_point = lookahead_time_end_point + self.max_single_segment_time = max_single_segment_time + self.nn_eval_block_size = nn_eval_block_size + self.dcd_block_size = dcd_block_size + self.snr_thres = snr_thres + self.noise_frame_num_used_for_snr = noise_frame_num_used_for_snr + self.decibel_thres = decibel_thres + self.speech_noise_thres = speech_noise_thres + self.fe_prior_thres = fe_prior_thres + self.silence_pdf_num = silence_pdf_num + self.sil_pdf_ids = sil_pdf_ids + self.speech_noise_thresh_low = speech_noise_thresh_low + self.speech_noise_thresh_high = speech_noise_thresh_high + self.output_frame_probs = output_frame_probs + self.frame_in_ms = frame_in_ms + self.frame_length_ms = frame_length_ms + + +class E2EVadSpeechBufWithDoa(object): + def __init__(self): + self.start_ms = 0 + self.end_ms = 0 + self.buffer = [] + self.contain_seg_start_point = False + self.contain_seg_end_point = False + self.doa = 0 + + def Reset(self): + self.start_ms = 0 + self.end_ms = 0 + self.buffer = [] + self.contain_seg_start_point = False + self.contain_seg_end_point = False + self.doa = 0 + + +class E2EVadFrameProb(object): + def __init__(self): + self.noise_prob = 0.0 + self.speech_prob = 0.0 + self.score = 0.0 + self.frame_id = 0 + self.frm_state = 0 + + +class WindowDetector(object): + def __init__( + self, + window_size_ms: int, + sil_to_speech_time: int, + speech_to_sil_time: int, + frame_size_ms: int, + ): + self.window_size_ms = window_size_ms + self.sil_to_speech_time = sil_to_speech_time + self.speech_to_sil_time = speech_to_sil_time + self.frame_size_ms = frame_size_ms + + self.win_size_frame = int(window_size_ms / frame_size_ms) + self.win_sum = 0 + self.win_state = [0] * self.win_size_frame # 初始化窗 + + self.cur_win_pos = 0 + self.pre_frame_state = FrameState.kFrameStateSil + self.cur_frame_state = FrameState.kFrameStateSil + self.sil_to_speech_frmcnt_thres = int(sil_to_speech_time / frame_size_ms) + self.speech_to_sil_frmcnt_thres = int(speech_to_sil_time / frame_size_ms) + + self.voice_last_frame_count = 0 + self.noise_last_frame_count = 0 + self.hydre_frame_count = 0 + + def Reset(self) -> None: + self.cur_win_pos = 0 + self.win_sum = 0 + self.win_state = [0] * self.win_size_frame + self.pre_frame_state = FrameState.kFrameStateSil + self.cur_frame_state = FrameState.kFrameStateSil + self.voice_last_frame_count = 0 + self.noise_last_frame_count = 0 + self.hydre_frame_count = 0 + + def GetWinSize(self) -> int: + return int(self.win_size_frame) + + def DetectOneFrame(self, frameState: FrameState, frame_count: int) -> AudioChangeState: + cur_frame_state = FrameState.kFrameStateSil + if frameState == FrameState.kFrameStateSpeech: + cur_frame_state = 1 + elif frameState == FrameState.kFrameStateSil: + cur_frame_state = 0 + else: + return AudioChangeState.kChangeStateInvalid + self.win_sum -= self.win_state[self.cur_win_pos] + self.win_sum += cur_frame_state + self.win_state[self.cur_win_pos] = cur_frame_state + self.cur_win_pos = (self.cur_win_pos + 1) % self.win_size_frame + + if ( + self.pre_frame_state == FrameState.kFrameStateSil + and self.win_sum >= self.sil_to_speech_frmcnt_thres + ): + self.pre_frame_state = FrameState.kFrameStateSpeech + return AudioChangeState.kChangeStateSil2Speech + + if ( + self.pre_frame_state == FrameState.kFrameStateSpeech + and self.win_sum <= self.speech_to_sil_frmcnt_thres + ): + self.pre_frame_state = FrameState.kFrameStateSil + return AudioChangeState.kChangeStateSpeech2Sil + + if self.pre_frame_state == FrameState.kFrameStateSil: + return AudioChangeState.kChangeStateSil2Sil + if self.pre_frame_state == FrameState.kFrameStateSpeech: + return AudioChangeState.kChangeStateSpeech2Speech + return AudioChangeState.kChangeStateInvalid + + def FrameSizeMs(self) -> int: + return int(self.frame_size_ms) + + +class E2EVadModel: + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__(self, vad_post_args: Dict[str, Any]): + super(E2EVadModel, self).__init__() + self.vad_opts = VADXOptions(**vad_post_args) + self.windows_detector = WindowDetector( + self.vad_opts.window_size_ms, + self.vad_opts.sil_to_speech_time_thres, + self.vad_opts.speech_to_sil_time_thres, + self.vad_opts.frame_in_ms, + ) + # self.encoder = encoder + # init variables + self.is_final = False + self.data_buf_start_frame = 0 + self.frm_cnt = 0 + self.latest_confirmed_speech_frame = 0 + self.lastest_confirmed_silence_frame = -1 + self.continous_silence_frame_count = 0 + self.vad_state_machine = VadStateMachine.kVadInStateStartPointNotDetected + self.confirmed_start_frame = -1 + self.confirmed_end_frame = -1 + self.number_end_time_detected = 0 + self.sil_frame = 0 + self.sil_pdf_ids = self.vad_opts.sil_pdf_ids + self.noise_average_decibel = -100.0 + self.pre_end_silence_detected = False + self.next_seg = True + + self.output_data_buf = [] + self.output_data_buf_offset = 0 + self.frame_probs = [] + self.max_end_sil_frame_cnt_thresh = ( + self.vad_opts.max_end_silence_time - self.vad_opts.speech_to_sil_time_thres + ) + self.speech_noise_thres = self.vad_opts.speech_noise_thres + self.scores = None + self.idx_pre_chunk = 0 + self.max_time_out = False + self.decibel = [] + self.data_buf_size = 0 + self.data_buf_all_size = 0 + self.waveform = None + self.ResetDetection() + + def AllResetDetection(self): + self.is_final = False + self.data_buf_start_frame = 0 + self.frm_cnt = 0 + self.latest_confirmed_speech_frame = 0 + self.lastest_confirmed_silence_frame = -1 + self.continous_silence_frame_count = 0 + self.vad_state_machine = VadStateMachine.kVadInStateStartPointNotDetected + self.confirmed_start_frame = -1 + self.confirmed_end_frame = -1 + self.number_end_time_detected = 0 + self.sil_frame = 0 + self.sil_pdf_ids = self.vad_opts.sil_pdf_ids + self.noise_average_decibel = -100.0 + self.pre_end_silence_detected = False + self.next_seg = True + + self.output_data_buf = [] + self.output_data_buf_offset = 0 + self.frame_probs = [] + self.max_end_sil_frame_cnt_thresh = ( + self.vad_opts.max_end_silence_time - self.vad_opts.speech_to_sil_time_thres + ) + self.speech_noise_thres = self.vad_opts.speech_noise_thres + self.scores = None + self.idx_pre_chunk = 0 + self.max_time_out = False + self.decibel = [] + self.data_buf_size = 0 + self.data_buf_all_size = 0 + self.waveform = None + self.ResetDetection() + + def ResetDetection(self): + self.continous_silence_frame_count = 0 + self.latest_confirmed_speech_frame = 0 + self.lastest_confirmed_silence_frame = -1 + self.confirmed_start_frame = -1 + self.confirmed_end_frame = -1 + self.vad_state_machine = VadStateMachine.kVadInStateStartPointNotDetected + self.windows_detector.Reset() + self.sil_frame = 0 + self.frame_probs = [] + + def ComputeDecibel(self) -> None: + frame_sample_length = int(self.vad_opts.frame_length_ms * self.vad_opts.sample_rate / 1000) + frame_shift_length = int(self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000) + if self.data_buf_all_size == 0: + self.data_buf_all_size = len(self.waveform[0]) + self.data_buf_size = self.data_buf_all_size + else: + self.data_buf_all_size += len(self.waveform[0]) + for offset in range( + 0, self.waveform.shape[1] - frame_sample_length + 1, frame_shift_length + ): + self.decibel.append( + 10 + * math.log10( + np.square((self.waveform[0][offset : offset + frame_sample_length])).sum() + + 0.000001 + ) + ) + + def ComputeScores(self, scores: np.ndarray) -> None: + # scores = self.encoder(feats, in_cache) # return B * T * D + self.vad_opts.nn_eval_block_size = scores.shape[1] + self.frm_cnt += scores.shape[1] # count total frames + self.scores = scores + + def PopDataBufTillFrame(self, frame_idx: int) -> None: # need check again + while self.data_buf_start_frame < frame_idx: + if self.data_buf_size >= int( + self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000 + ): + self.data_buf_start_frame += 1 + self.data_buf_size = self.data_buf_all_size - self.data_buf_start_frame * int( + self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000 + ) + + def PopDataToOutputBuf( + self, + start_frm: int, + frm_cnt: int, + first_frm_is_start_point: bool, + last_frm_is_end_point: bool, + end_point_is_sent_end: bool, + ) -> None: + self.PopDataBufTillFrame(start_frm) + expected_sample_number = int( + frm_cnt * self.vad_opts.sample_rate * self.vad_opts.frame_in_ms / 1000 + ) + if last_frm_is_end_point: + extra_sample = max( + 0, + int( + self.vad_opts.frame_length_ms * self.vad_opts.sample_rate / 1000 + - self.vad_opts.sample_rate * self.vad_opts.frame_in_ms / 1000 + ), + ) + expected_sample_number += int(extra_sample) + if end_point_is_sent_end: + expected_sample_number = max(expected_sample_number, self.data_buf_size) + if self.data_buf_size < expected_sample_number: + print("error in calling pop data_buf\n") + + if len(self.output_data_buf) == 0 or first_frm_is_start_point: + self.output_data_buf.append(E2EVadSpeechBufWithDoa()) + self.output_data_buf[-1].Reset() + self.output_data_buf[-1].start_ms = start_frm * self.vad_opts.frame_in_ms + self.output_data_buf[-1].end_ms = self.output_data_buf[-1].start_ms + self.output_data_buf[-1].doa = 0 + cur_seg = self.output_data_buf[-1] + if cur_seg.end_ms != start_frm * self.vad_opts.frame_in_ms: + print("warning\n") + out_pos = len(cur_seg.buffer) # cur_seg.buff现在没做任何操作 + data_to_pop = 0 + if end_point_is_sent_end: + data_to_pop = expected_sample_number + else: + data_to_pop = int( + frm_cnt * self.vad_opts.frame_in_ms * self.vad_opts.sample_rate / 1000 + ) + if data_to_pop > self.data_buf_size: + print("VAD data_to_pop is bigger than self.data_buf_size!!!\n") + data_to_pop = self.data_buf_size + expected_sample_number = self.data_buf_size + + cur_seg.doa = 0 + for sample_cpy_out in range(0, data_to_pop): + # cur_seg.buffer[out_pos ++] = data_buf_.back(); + out_pos += 1 + for sample_cpy_out in range(data_to_pop, expected_sample_number): + # cur_seg.buffer[out_pos++] = data_buf_.back() + out_pos += 1 + if cur_seg.end_ms != start_frm * self.vad_opts.frame_in_ms: + print("Something wrong with the VAD algorithm\n") + self.data_buf_start_frame += frm_cnt + cur_seg.end_ms = (start_frm + frm_cnt) * self.vad_opts.frame_in_ms + if first_frm_is_start_point: + cur_seg.contain_seg_start_point = True + if last_frm_is_end_point: + cur_seg.contain_seg_end_point = True + + def OnSilenceDetected(self, valid_frame: int): + self.lastest_confirmed_silence_frame = valid_frame + if self.vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + self.PopDataBufTillFrame(valid_frame) + # silence_detected_callback_ + # pass + + def OnVoiceDetected(self, valid_frame: int) -> None: + self.latest_confirmed_speech_frame = valid_frame + self.PopDataToOutputBuf(valid_frame, 1, False, False, False) + + def OnVoiceStart(self, start_frame: int, fake_result: bool = False) -> None: + if self.vad_opts.do_start_point_detection: + pass + if self.confirmed_start_frame != -1: + print("not reset vad properly\n") + else: + self.confirmed_start_frame = start_frame + + if ( + not fake_result + and self.vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected + ): + self.PopDataToOutputBuf(self.confirmed_start_frame, 1, True, False, False) + + def OnVoiceEnd(self, end_frame: int, fake_result: bool, is_last_frame: bool) -> None: + for t in range(self.latest_confirmed_speech_frame + 1, end_frame): + self.OnVoiceDetected(t) + if self.vad_opts.do_end_point_detection: + pass + if self.confirmed_end_frame != -1: + print("not reset vad properly\n") + else: + self.confirmed_end_frame = end_frame + if not fake_result: + self.sil_frame = 0 + self.PopDataToOutputBuf(self.confirmed_end_frame, 1, False, True, is_last_frame) + self.number_end_time_detected += 1 + + def MaybeOnVoiceEndIfLastFrame(self, is_final_frame: bool, cur_frm_idx: int) -> None: + if is_final_frame: + self.OnVoiceEnd(cur_frm_idx, False, True) + self.vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + + def GetLatency(self) -> int: + return int(self.LatencyFrmNumAtStartPoint() * self.vad_opts.frame_in_ms) + + def LatencyFrmNumAtStartPoint(self) -> int: + vad_latency = self.windows_detector.GetWinSize() + if self.vad_opts.do_extend: + vad_latency += int(self.vad_opts.lookback_time_start_point / self.vad_opts.frame_in_ms) + return vad_latency + + def GetFrameState(self, t: int) -> FrameState: + frame_state = FrameState.kFrameStateInvalid + cur_decibel = self.decibel[t] + cur_snr = cur_decibel - self.noise_average_decibel + # for each frame, calc log posterior probability of each state + if cur_decibel < self.vad_opts.decibel_thres: + frame_state = FrameState.kFrameStateSil + self.DetectOneFrame(frame_state, t, False) + return frame_state + + sum_score = 0.0 + noise_prob = 0.0 + assert len(self.sil_pdf_ids) == self.vad_opts.silence_pdf_num + if len(self.sil_pdf_ids) > 0: + assert len(self.scores) == 1 # 只支持batch_size = 1的测试 + sil_pdf_scores = [ + self.scores[0][t - self.idx_pre_chunk][sil_pdf_id] + for sil_pdf_id in self.sil_pdf_ids + ] + sum_score = sum(sil_pdf_scores) + noise_prob = math.log(sum_score) * self.vad_opts.speech_2_noise_ratio + total_score = 1.0 + sum_score = total_score - sum_score + speech_prob = math.log(sum_score) + if self.vad_opts.output_frame_probs: + frame_prob = E2EVadFrameProb() + frame_prob.noise_prob = noise_prob + frame_prob.speech_prob = speech_prob + frame_prob.score = sum_score + frame_prob.frame_id = t + self.frame_probs.append(frame_prob) + if math.exp(speech_prob) >= math.exp(noise_prob) + self.speech_noise_thres: + if cur_snr >= self.vad_opts.snr_thres and cur_decibel >= self.vad_opts.decibel_thres: + frame_state = FrameState.kFrameStateSpeech + else: + frame_state = FrameState.kFrameStateSil + else: + frame_state = FrameState.kFrameStateSil + if self.noise_average_decibel < -99.9: + self.noise_average_decibel = cur_decibel + else: + self.noise_average_decibel = ( + cur_decibel + + self.noise_average_decibel * (self.vad_opts.noise_frame_num_used_for_snr - 1) + ) / self.vad_opts.noise_frame_num_used_for_snr + + return frame_state + + def __call__( + self, + score: np.ndarray, + waveform: np.ndarray, + is_final: bool = False, + max_end_sil: int = 800, + online: bool = False, + ): + self.max_end_sil_frame_cnt_thresh = max_end_sil - self.vad_opts.speech_to_sil_time_thres + self.waveform = waveform # compute decibel for each frame + self.ComputeDecibel() + self.ComputeScores(score) + if not is_final: + self.DetectCommonFrames() + else: + self.DetectLastFrames() + segments = [] + for batch_num in range(0, score.shape[0]): # only support batch_size = 1 now + segment_batch = [] + if len(self.output_data_buf) > 0: + for i in range(self.output_data_buf_offset, len(self.output_data_buf)): + if online: + if not self.output_data_buf[i].contain_seg_start_point: + continue + if not self.next_seg and not self.output_data_buf[i].contain_seg_end_point: + continue + start_ms = self.output_data_buf[i].start_ms if self.next_seg else -1 + if self.output_data_buf[i].contain_seg_end_point: + end_ms = self.output_data_buf[i].end_ms + self.next_seg = True + self.output_data_buf_offset += 1 + else: + end_ms = -1 + self.next_seg = False + else: + if not is_final and ( + not self.output_data_buf[i].contain_seg_start_point + or not self.output_data_buf[i].contain_seg_end_point + ): + continue + start_ms = self.output_data_buf[i].start_ms + end_ms = self.output_data_buf[i].end_ms + self.output_data_buf_offset += 1 + segment = [start_ms, end_ms] + segment_batch.append(segment) + + if segment_batch: + segments.append(segment_batch) + if is_final: + # reset class variables and clear the dict for the next query + self.AllResetDetection() + return segments + + def DetectCommonFrames(self) -> int: + if self.vad_state_machine == VadStateMachine.kVadInStateEndPointDetected: + return 0 + for i in range(self.vad_opts.nn_eval_block_size - 1, -1, -1): + frame_state = FrameState.kFrameStateInvalid + frame_state = self.GetFrameState(self.frm_cnt - 1 - i) + self.DetectOneFrame(frame_state, self.frm_cnt - 1 - i, False) + self.idx_pre_chunk += self.scores.shape[1] + return 0 + + def DetectLastFrames(self) -> int: + if self.vad_state_machine == VadStateMachine.kVadInStateEndPointDetected: + return 0 + for i in range(self.vad_opts.nn_eval_block_size - 1, -1, -1): + frame_state = FrameState.kFrameStateInvalid + frame_state = self.GetFrameState(self.frm_cnt - 1 - i) + if i != 0: + self.DetectOneFrame(frame_state, self.frm_cnt - 1 - i, False) + else: + self.DetectOneFrame(frame_state, self.frm_cnt - 1, True) + + return 0 + + def DetectOneFrame( + self, cur_frm_state: FrameState, cur_frm_idx: int, is_final_frame: bool + ) -> None: + tmp_cur_frm_state = FrameState.kFrameStateInvalid + if cur_frm_state == FrameState.kFrameStateSpeech: + if math.fabs(1.0) > self.vad_opts.fe_prior_thres: + tmp_cur_frm_state = FrameState.kFrameStateSpeech + else: + tmp_cur_frm_state = FrameState.kFrameStateSil + elif cur_frm_state == FrameState.kFrameStateSil: + tmp_cur_frm_state = FrameState.kFrameStateSil + state_change = self.windows_detector.DetectOneFrame(tmp_cur_frm_state, cur_frm_idx) + frm_shift_in_ms = self.vad_opts.frame_in_ms + if AudioChangeState.kChangeStateSil2Speech == state_change: + silence_frame_count = self.continous_silence_frame_count + self.continous_silence_frame_count = 0 + self.pre_end_silence_detected = False + start_frame = 0 + if self.vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + start_frame = max( + self.data_buf_start_frame, cur_frm_idx - self.LatencyFrmNumAtStartPoint() + ) + self.OnVoiceStart(start_frame) + self.vad_state_machine = VadStateMachine.kVadInStateInSpeechSegment + for t in range(start_frame + 1, cur_frm_idx + 1): + self.OnVoiceDetected(t) + elif self.vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + for t in range(self.latest_confirmed_speech_frame + 1, cur_frm_idx): + self.OnVoiceDetected(t) + if ( + cur_frm_idx - self.confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + self.OnVoiceEnd(cur_frm_idx, False, False) + self.vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif not is_final_frame: + self.OnVoiceDetected(cur_frm_idx) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx) + else: + pass + elif AudioChangeState.kChangeStateSpeech2Sil == state_change: + self.continous_silence_frame_count = 0 + if self.vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + pass + elif self.vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + if ( + cur_frm_idx - self.confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + self.OnVoiceEnd(cur_frm_idx, False, False) + self.vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif not is_final_frame: + self.OnVoiceDetected(cur_frm_idx) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx) + else: + pass + elif AudioChangeState.kChangeStateSpeech2Speech == state_change: + self.continous_silence_frame_count = 0 + if self.vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + if ( + cur_frm_idx - self.confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + self.max_time_out = True + self.OnVoiceEnd(cur_frm_idx, False, False) + self.vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif not is_final_frame: + self.OnVoiceDetected(cur_frm_idx) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx) + else: + pass + elif AudioChangeState.kChangeStateSil2Sil == state_change: + self.continous_silence_frame_count += 1 + if self.vad_state_machine == VadStateMachine.kVadInStateStartPointNotDetected: + # silence timeout, return zero length decision + if ( + (self.vad_opts.detect_mode == VadDetectMode.kVadSingleUtteranceDetectMode.value) + and ( + self.continous_silence_frame_count * frm_shift_in_ms + > self.vad_opts.max_start_silence_time + ) + ) or (is_final_frame and self.number_end_time_detected == 0): + for t in range(self.lastest_confirmed_silence_frame + 1, cur_frm_idx): + self.OnSilenceDetected(t) + self.OnVoiceStart(0, True) + self.OnVoiceEnd(0, True, False) + self.vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + else: + if cur_frm_idx >= self.LatencyFrmNumAtStartPoint(): + self.OnSilenceDetected(cur_frm_idx - self.LatencyFrmNumAtStartPoint()) + elif self.vad_state_machine == VadStateMachine.kVadInStateInSpeechSegment: + if ( + self.continous_silence_frame_count * frm_shift_in_ms + >= self.max_end_sil_frame_cnt_thresh + ): + lookback_frame = int(self.max_end_sil_frame_cnt_thresh / frm_shift_in_ms) + if self.vad_opts.do_extend: + lookback_frame -= int( + self.vad_opts.lookahead_time_end_point / frm_shift_in_ms + ) + lookback_frame -= 1 + lookback_frame = max(0, lookback_frame) + self.OnVoiceEnd(cur_frm_idx - lookback_frame, False, False) + self.vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif ( + cur_frm_idx - self.confirmed_start_frame + 1 + > self.vad_opts.max_single_segment_time / frm_shift_in_ms + ): + self.OnVoiceEnd(cur_frm_idx, False, False) + self.vad_state_machine = VadStateMachine.kVadInStateEndPointDetected + elif self.vad_opts.do_extend and not is_final_frame: + if self.continous_silence_frame_count <= int( + self.vad_opts.lookahead_time_end_point / frm_shift_in_ms + ): + self.OnVoiceDetected(cur_frm_idx) + else: + self.MaybeOnVoiceEndIfLastFrame(is_final_frame, cur_frm_idx) + else: + pass + + if ( + self.vad_state_machine == VadStateMachine.kVadInStateEndPointDetected + and self.vad_opts.detect_mode == VadDetectMode.kVadMutipleUtteranceDetectMode.value + ): + self.ResetDetection() diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py b/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py new file mode 100644 index 0000000..7b38f8b --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py @@ -0,0 +1,433 @@ +# -*- encoding: utf-8 -*- +from pathlib import Path +from typing import Any, Dict, Iterable, List, NamedTuple, Set, Tuple, Union +import copy + +import numpy as np +import kaldi_native_fbank as knf + +root_dir = Path(__file__).resolve().parent + +logger_initialized = {} + + +class WavFrontend: + """Conventional frontend structure for ASR.""" + + def __init__( + self, + cmvn_file: str = None, + fs: int = 16000, + window: str = "hamming", + n_mels: int = 80, + frame_length: int = 25, + frame_shift: int = 10, + lfr_m: int = 1, + lfr_n: int = 1, + dither: float = 1.0, + **kwargs, + ) -> None: + + opts = knf.FbankOptions() + opts.frame_opts.samp_freq = fs + opts.frame_opts.dither = dither + opts.frame_opts.window_type = window + opts.frame_opts.frame_shift_ms = float(frame_shift) + opts.frame_opts.frame_length_ms = float(frame_length) + opts.mel_opts.num_bins = n_mels + opts.energy_floor = 0 + opts.frame_opts.snip_edges = True + opts.mel_opts.debug_mel = False + self.opts = opts + + self.lfr_m = lfr_m + self.lfr_n = lfr_n + self.cmvn_file = cmvn_file + + if self.cmvn_file: + self.cmvn = self.load_cmvn() + self.fbank_fn = None + self.fbank_beg_idx = 0 + self.reset_status() + + def fbank(self, waveform: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + waveform = waveform * (1 << 15) + self.fbank_fn = knf.OnlineFbank(self.opts) + self.fbank_fn.accept_waveform(self.opts.frame_opts.samp_freq, waveform.tolist()) + frames = self.fbank_fn.num_frames_ready + mat = np.empty([frames, self.opts.mel_opts.num_bins]) + for i in range(frames): + mat[i, :] = self.fbank_fn.get_frame(i) + feat = mat.astype(np.float32) + feat_len = np.array(mat.shape[0]).astype(np.int32) + return feat, feat_len + + def fbank_online(self, waveform: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + waveform = waveform * (1 << 15) + # self.fbank_fn = knf.OnlineFbank(self.opts) + self.fbank_fn.accept_waveform(self.opts.frame_opts.samp_freq, waveform.tolist()) + frames = self.fbank_fn.num_frames_ready + mat = np.empty([frames, self.opts.mel_opts.num_bins]) + for i in range(self.fbank_beg_idx, frames): + mat[i, :] = self.fbank_fn.get_frame(i) + # self.fbank_beg_idx += (frames-self.fbank_beg_idx) + feat = mat.astype(np.float32) + feat_len = np.array(mat.shape[0]).astype(np.int32) + return feat, feat_len + + def reset_status(self): + self.fbank_fn = knf.OnlineFbank(self.opts) + self.fbank_beg_idx = 0 + + def lfr_cmvn(self, feat: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + if self.lfr_m != 1 or self.lfr_n != 1: + feat = self.apply_lfr(feat, self.lfr_m, self.lfr_n) + + if self.cmvn_file: + feat = self.apply_cmvn(feat) + + feat_len = np.array(feat.shape[0]).astype(np.int32) + return feat, feat_len + + @staticmethod + def apply_lfr(inputs: np.ndarray, lfr_m: int, lfr_n: int) -> np.ndarray: + LFR_inputs = [] + + T = inputs.shape[0] + T_lfr = int(np.ceil(T / lfr_n)) + left_padding = np.tile(inputs[0], ((lfr_m - 1) // 2, 1)) + inputs = np.vstack((left_padding, inputs)) + T = T + (lfr_m - 1) // 2 + for i in range(T_lfr): + if lfr_m <= T - i * lfr_n: + LFR_inputs.append((inputs[i * lfr_n : i * lfr_n + lfr_m]).reshape(1, -1)) + else: + # process last LFR frame + num_padding = lfr_m - (T - i * lfr_n) + frame = inputs[i * lfr_n :].reshape(-1) + for _ in range(num_padding): + frame = np.hstack((frame, inputs[-1])) + + LFR_inputs.append(frame) + LFR_outputs = np.vstack(LFR_inputs).astype(np.float32) + return LFR_outputs + + def apply_cmvn(self, inputs: np.ndarray) -> np.ndarray: + """ + Apply CMVN with mvn data + """ + frame, dim = inputs.shape + means = np.tile(self.cmvn[0:1, :dim], (frame, 1)) + vars = np.tile(self.cmvn[1:2, :dim], (frame, 1)) + inputs = (inputs + means) * vars + return inputs + + def load_cmvn( + self, + ) -> np.ndarray: + with open(self.cmvn_file, "r", encoding="utf-8") as f: + lines = f.readlines() + + means_list = [] + vars_list = [] + for i in range(len(lines)): + line_item = lines[i].split() + if line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + add_shift_line = line_item[3 : (len(line_item) - 1)] + means_list = list(add_shift_line) + continue + elif line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + rescale_line = line_item[3 : (len(line_item) - 1)] + vars_list = list(rescale_line) + continue + + means = np.array(means_list).astype(np.float64) + vars = np.array(vars_list).astype(np.float64) + cmvn = np.array([means, vars]) + return cmvn + + +class WavFrontendOnline(WavFrontend): + def __init__(self, **kwargs): + super().__init__(**kwargs) + # self.fbank_fn = knf.OnlineFbank(self.opts) + # add variables + self.frame_sample_length = int( + self.opts.frame_opts.frame_length_ms * self.opts.frame_opts.samp_freq / 1000 + ) + self.frame_shift_sample_length = int( + self.opts.frame_opts.frame_shift_ms * self.opts.frame_opts.samp_freq / 1000 + ) + self.waveform = None + self.reserve_waveforms = None + self.input_cache = None + self.lfr_splice_cache = [] + + @staticmethod + # inputs has catted the cache + def apply_lfr( + inputs: np.ndarray, lfr_m: int, lfr_n: int, is_final: bool = False + ) -> Tuple[np.ndarray, np.ndarray, int]: + """ + Apply lfr with data + """ + + LFR_inputs = [] + T = inputs.shape[0] # include the right context + T_lfr = int( + np.ceil((T - (lfr_m - 1) // 2) / lfr_n) + ) # minus the right context: (lfr_m - 1) // 2 + splice_idx = T_lfr + for i in range(T_lfr): + if lfr_m <= T - i * lfr_n: + LFR_inputs.append((inputs[i * lfr_n : i * lfr_n + lfr_m]).reshape(1, -1)) + else: # process last LFR frame + if is_final: + num_padding = lfr_m - (T - i * lfr_n) + frame = (inputs[i * lfr_n :]).reshape(-1) + for _ in range(num_padding): + frame = np.hstack((frame, inputs[-1])) + LFR_inputs.append(frame) + else: + # update splice_idx and break the circle + splice_idx = i + break + splice_idx = min(T - 1, splice_idx * lfr_n) + lfr_splice_cache = inputs[splice_idx:, :] + LFR_outputs = np.vstack(LFR_inputs) + return LFR_outputs.astype(np.float32), lfr_splice_cache, splice_idx + + @staticmethod + def compute_frame_num( + sample_length: int, frame_sample_length: int, frame_shift_sample_length: int + ) -> int: + frame_num = int((sample_length - frame_sample_length) / frame_shift_sample_length + 1) + return frame_num if frame_num >= 1 and sample_length >= frame_sample_length else 0 + + def fbank( + self, input: np.ndarray, input_lengths: np.ndarray + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + self.fbank_fn = knf.OnlineFbank(self.opts) + batch_size = input.shape[0] + if self.input_cache is None: + self.input_cache = np.empty((batch_size, 0), dtype=np.float32) + input = np.concatenate((self.input_cache, input), axis=1) + frame_num = self.compute_frame_num( + input.shape[-1], self.frame_sample_length, self.frame_shift_sample_length + ) + # update self.in_cache + self.input_cache = input[ + :, -(input.shape[-1] - frame_num * self.frame_shift_sample_length) : + ] + waveforms = np.empty(0, dtype=np.float32) + feats_pad = np.empty(0, dtype=np.float32) + feats_lens = np.empty(0, dtype=np.int32) + if frame_num: + waveforms = [] + feats = [] + feats_lens = [] + for i in range(batch_size): + waveform = input[i] + waveforms.append( + waveform[ + : ( + (frame_num - 1) * self.frame_shift_sample_length + + self.frame_sample_length + ) + ] + ) + waveform = waveform * (1 << 15) + + self.fbank_fn.accept_waveform(self.opts.frame_opts.samp_freq, waveform.tolist()) + frames = self.fbank_fn.num_frames_ready + mat = np.empty([frames, self.opts.mel_opts.num_bins]) + for i in range(frames): + mat[i, :] = self.fbank_fn.get_frame(i) + feat = mat.astype(np.float32) + feat_len = np.array(mat.shape[0]).astype(np.int32) + feats.append(feat) + feats_lens.append(feat_len) + + waveforms = np.stack(waveforms) + feats_lens = np.array(feats_lens) + feats_pad = np.array(feats) + self.fbanks = feats_pad + self.fbanks_lens = copy.deepcopy(feats_lens) + return waveforms, feats_pad, feats_lens + + def get_fbank(self) -> Tuple[np.ndarray, np.ndarray]: + return self.fbanks, self.fbanks_lens + + def lfr_cmvn( + self, input: np.ndarray, input_lengths: np.ndarray, is_final: bool = False + ) -> Tuple[np.ndarray, np.ndarray, List[int]]: + batch_size = input.shape[0] + feats = [] + feats_lens = [] + lfr_splice_frame_idxs = [] + for i in range(batch_size): + mat = input[i, : input_lengths[i], :] + lfr_splice_frame_idx = -1 + if self.lfr_m != 1 or self.lfr_n != 1: + # update self.lfr_splice_cache in self.apply_lfr + mat, self.lfr_splice_cache[i], lfr_splice_frame_idx = self.apply_lfr( + mat, self.lfr_m, self.lfr_n, is_final + ) + if self.cmvn_file is not None: + mat = self.apply_cmvn(mat) + feat_length = mat.shape[0] + feats.append(mat) + feats_lens.append(feat_length) + lfr_splice_frame_idxs.append(lfr_splice_frame_idx) + + feats_lens = np.array(feats_lens) + feats_pad = np.array(feats) + return feats_pad, feats_lens, lfr_splice_frame_idxs + + def extract_fbank( + self, input: np.ndarray, input_lengths: np.ndarray, is_final: bool = False + ) -> Tuple[np.ndarray, np.ndarray]: + batch_size = input.shape[0] + assert ( + batch_size == 1 + ), "we support to extract feature online only when the batch size is equal to 1 now" + waveforms, feats, feats_lengths = self.fbank(input, input_lengths) # input shape: B T D + if feats.shape[0]: + self.waveforms = ( + waveforms + if self.reserve_waveforms is None + else np.concatenate((self.reserve_waveforms, waveforms), axis=1) + ) + if not self.lfr_splice_cache: + for i in range(batch_size): + self.lfr_splice_cache.append( + np.expand_dims(feats[i][0, :], axis=0).repeat((self.lfr_m - 1) // 2, axis=0) + ) + + if feats_lengths[0] + self.lfr_splice_cache[0].shape[0] >= self.lfr_m: + lfr_splice_cache_np = np.stack(self.lfr_splice_cache) # B T D + feats = np.concatenate((lfr_splice_cache_np, feats), axis=1) + feats_lengths += lfr_splice_cache_np[0].shape[0] + frame_from_waveforms = int( + (self.waveforms.shape[1] - self.frame_sample_length) + / self.frame_shift_sample_length + + 1 + ) + minus_frame = (self.lfr_m - 1) // 2 if self.reserve_waveforms is None else 0 + feats, feats_lengths, lfr_splice_frame_idxs = self.lfr_cmvn( + feats, feats_lengths, is_final + ) + if self.lfr_m == 1: + self.reserve_waveforms = None + else: + reserve_frame_idx = lfr_splice_frame_idxs[0] - minus_frame + # print('reserve_frame_idx: ' + str(reserve_frame_idx)) + # print('frame_frame: ' + str(frame_from_waveforms)) + self.reserve_waveforms = self.waveforms[ + :, + reserve_frame_idx + * self.frame_shift_sample_length : frame_from_waveforms + * self.frame_shift_sample_length, + ] + sample_length = ( + frame_from_waveforms - 1 + ) * self.frame_shift_sample_length + self.frame_sample_length + self.waveforms = self.waveforms[:, :sample_length] + else: + # update self.reserve_waveforms and self.lfr_splice_cache + self.reserve_waveforms = self.waveforms[ + :, : -(self.frame_sample_length - self.frame_shift_sample_length) + ] + for i in range(batch_size): + self.lfr_splice_cache[i] = np.concatenate( + (self.lfr_splice_cache[i], feats[i]), axis=0 + ) + return np.empty(0, dtype=np.float32), feats_lengths + else: + if is_final: + self.waveforms = ( + waveforms if self.reserve_waveforms is None else self.reserve_waveforms + ) + feats = np.stack(self.lfr_splice_cache) + feats_lengths = np.zeros(batch_size, dtype=np.int32) + feats.shape[1] + feats, feats_lengths, _ = self.lfr_cmvn(feats, feats_lengths, is_final) + if is_final: + self.cache_reset() + return feats, feats_lengths + + def get_waveforms(self): + return self.waveforms + + def cache_reset(self): + self.fbank_fn = knf.OnlineFbank(self.opts) + self.reserve_waveforms = None + self.input_cache = None + self.lfr_splice_cache = [] + + +def load_bytes(input): + middle_data = np.frombuffer(input, dtype=np.int16) + middle_data = np.asarray(middle_data) + if middle_data.dtype.kind not in "iu": + raise TypeError("'middle_data' must be an array of integers") + dtype = np.dtype("float32") + if dtype.kind != "f": + raise TypeError("'dtype' must be a floating point type") + + i = np.iinfo(middle_data.dtype) + abs_max = 2 ** (i.bits - 1) + offset = i.min + abs_max + array = np.frombuffer((middle_data.astype(dtype) - offset) / abs_max, dtype=np.float32) + return array + + +class SinusoidalPositionEncoderOnline: + """Streaming Positional encoding.""" + + def encode(self, positions: np.ndarray = None, depth: int = None, dtype: np.dtype = np.float32): + batch_size = positions.shape[0] + positions = positions.astype(dtype) + log_timescale_increment = np.log(np.array([10000], dtype=dtype)) / (depth / 2 - 1) + inv_timescales = np.exp(np.arange(depth / 2).astype(dtype) * (-log_timescale_increment)) + inv_timescales = np.reshape(inv_timescales, [batch_size, -1]) + scaled_time = np.reshape(positions, [1, -1, 1]) * np.reshape(inv_timescales, [1, 1, -1]) + encoding = np.concatenate((np.sin(scaled_time), np.cos(scaled_time)), axis=2) + return encoding.astype(dtype) + + def forward(self, x, start_idx=0): + batch_size, timesteps, input_dim = x.shape + positions = np.arange(1, timesteps + 1 + start_idx)[None, :] + position_encoding = self.encode(positions, input_dim, x.dtype) + + return x + position_encoding[:, start_idx : start_idx + timesteps] + + +def test(): + path = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav" + import librosa + + cmvn_file = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/am.mvn" + config_file = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/config.yaml" + from funasr.runtime.python.onnxruntime.rapid_paraformer.utils.utils import read_yaml + + config = read_yaml(config_file) + waveform, _ = librosa.load(path, sr=None) + frontend = WavFrontend( + cmvn_file=cmvn_file, + **config["frontend_conf"], + ) + speech, _ = frontend.fbank_online(waveform) # 1d, (sample,), numpy + feat, feat_len = frontend.lfr_cmvn( + speech + ) # 2d, (frame, 450), np.float32 -> torch, torch.from_numpy(), dtype, (1, frame, 450) + + frontend.reset_status() # clear cache + return feat, feat_len + + +if __name__ == "__main__": + test() diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/postprocess_utils.py b/runtime/python/onnxruntime/funasr_onnx/utils/postprocess_utils.py new file mode 100644 index 0000000..da8065e --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/utils/postprocess_utils.py @@ -0,0 +1,298 @@ +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import string +import logging +from typing import Any, List, Union + + +def isChinese(ch: str): + if "\u4e00" <= ch <= "\u9fff" or "\u0030" <= ch <= "\u0039": + return True + return False + + +def isAllChinese(word: Union[List[Any], str]): + word_lists = [] + for i in word: + cur = i.replace(" ", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + word_lists.append(cur) + + if len(word_lists) == 0: + return False + + for ch in word_lists: + if isChinese(ch) is False: + return False + return True + + +def isAllAlpha(word: Union[List[Any], str]): + word_lists = [] + for i in word: + cur = i.replace(" ", "") + cur = cur.replace("", "") + cur = cur.replace("", "") + word_lists.append(cur) + + if len(word_lists) == 0: + return False + + for ch in word_lists: + if ch.isalpha() is False and ch != "'": + return False + elif ch.isalpha() is True and isChinese(ch) is True: + return False + + return True + + +# def abbr_dispose(words: List[Any]) -> List[Any]: +def abbr_dispose(words: List[Any], time_stamp: List[List] = None) -> List[Any]: + words_size = len(words) + word_lists = [] + abbr_begin = [] + abbr_end = [] + last_num = -1 + ts_lists = [] + ts_nums = [] + ts_index = 0 + for num in range(words_size): + if num <= last_num: + continue + + if len(words[num]) == 1 and words[num].encode("utf-8").isalpha(): + if ( + num + 1 < words_size + and words[num + 1] == " " + and num + 2 < words_size + and len(words[num + 2]) == 1 + and words[num + 2].encode("utf-8").isalpha() + ): + # found the begin of abbr + abbr_begin.append(num) + num += 2 + abbr_end.append(num) + # to find the end of abbr + while True: + num += 1 + if num < words_size and words[num] == " ": + num += 1 + if ( + num < words_size + and len(words[num]) == 1 + and words[num].encode("utf-8").isalpha() + ): + abbr_end.pop() + abbr_end.append(num) + last_num = num + else: + break + else: + break + + for num in range(words_size): + if words[num] == " ": + ts_nums.append(ts_index) + else: + ts_nums.append(ts_index) + ts_index += 1 + last_num = -1 + for num in range(words_size): + if num <= last_num: + continue + + if num in abbr_begin: + if time_stamp is not None: + begin = time_stamp[ts_nums[num]][0] + word_lists.append(words[num].upper()) + num += 1 + while num < words_size: + if num in abbr_end: + word_lists.append(words[num].upper()) + last_num = num + break + else: + if words[num].encode("utf-8").isalpha(): + word_lists.append(words[num].upper()) + num += 1 + if time_stamp is not None: + end = time_stamp[ts_nums[num]][1] + ts_lists.append([begin, end]) + else: + word_lists.append(words[num]) + if time_stamp is not None and words[num] != " ": + begin = time_stamp[ts_nums[num]][0] + end = time_stamp[ts_nums[num]][1] + ts_lists.append([begin, end]) + begin = end + + if time_stamp is not None: + return word_lists, ts_lists + else: + return word_lists + + +def sentence_postprocess(words: List[Any], time_stamp: List[List] = None): + middle_lists = [] + word_lists = [] + word_item = "" + ts_lists = [] + + # wash words lists + for i in words: + word = "" + if isinstance(i, str): + word = i + else: + word = i.decode("utf-8") + + if word in ["", "", ""]: + continue + else: + middle_lists.append(word) + + # all chinese characters + if isAllChinese(middle_lists): + for i, ch in enumerate(middle_lists): + word_lists.append(ch.replace(" ", "")) + if time_stamp is not None: + ts_lists = time_stamp + + # all alpha characters + elif isAllAlpha(middle_lists): + ts_flag = True + for i, ch in enumerate(middle_lists): + if ts_flag and time_stamp is not None: + begin = time_stamp[i][0] + end = time_stamp[i][1] + word = "" + if "@@" in ch: + word = ch.replace("@@", "") + word_item += word + if time_stamp is not None: + ts_flag = False + end = time_stamp[i][1] + else: + word_item += ch + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + if time_stamp is not None: + ts_flag = True + end = time_stamp[i][1] + ts_lists.append([begin, end]) + begin = end + + # mix characters + else: + alpha_blank = False + ts_flag = True + begin = -1 + end = -1 + for i, ch in enumerate(middle_lists): + if ts_flag and time_stamp is not None: + begin = time_stamp[i][0] + end = time_stamp[i][1] + word = "" + if isAllChinese(ch): + if alpha_blank is True: + word_lists.pop() + word_lists.append(ch) + alpha_blank = False + if time_stamp is not None: + ts_flag = True + ts_lists.append([begin, end]) + begin = end + elif "@@" in ch: + word = ch.replace("@@", "") + word_item += word + alpha_blank = False + if time_stamp is not None: + ts_flag = False + end = time_stamp[i][1] + elif isAllAlpha(ch): + word_item += ch + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + alpha_blank = True + if time_stamp is not None: + ts_flag = True + end = time_stamp[i][1] + ts_lists.append([begin, end]) + begin = end + else: + raise ValueError("invalid character: {}".format(ch)) + + if time_stamp is not None: + word_lists, ts_lists = abbr_dispose(word_lists, ts_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + real_word_lists.append(ch) + sentence = " ".join(real_word_lists).strip() + return sentence, ts_lists, real_word_lists + else: + word_lists = abbr_dispose(word_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + real_word_lists.append(ch) + sentence = "".join(word_lists).strip() + return sentence, real_word_lists + + +def sentence_postprocess_sentencepiece(words): + middle_lists = [] + word_lists = [] + word_item = "" + + # wash words lists + for i in words: + word = "" + if isinstance(i, str): + word = i + else: + word = i.decode("utf-8") + + if word in ["", "", "", ""]: + continue + else: + middle_lists.append(word) + + # all alpha characters + for i, ch in enumerate(middle_lists): + word = "" + if "\u2581" in ch and i == 0: + word_item = "" + word = ch.replace("\u2581", "") + word_item += word + elif "\u2581" in ch and i != 0: + word_lists.append(word_item) + word_lists.append(" ") + word_item = "" + word = ch.replace("\u2581", "") + word_item += word + else: + word_item += ch + if word_item is not None: + word_lists.append(word_item) + # word_lists = abbr_dispose(word_lists) + real_word_lists = [] + for ch in word_lists: + if ch != " ": + if ch == "i": + ch = ch.replace("i", "I") + elif ch == "i'm": + ch = ch.replace("i'm", "I'm") + elif ch == "i've": + ch = ch.replace("i've", "I've") + elif ch == "i'll": + ch = ch.replace("i'll", "I'll") + real_word_lists.append(ch) + sentence = "".join(word_lists) + return sentence, real_word_lists diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py b/runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py new file mode 100644 index 0000000..c8ba5a7 --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py @@ -0,0 +1,66 @@ +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import numpy as np + + +def time_stamp_lfr6_onnx(us_cif_peak, char_list, begin_time=0.0, total_offset=-1.5): + if not len(char_list): + return [] + START_END_THRESHOLD = 5 + MAX_TOKEN_DURATION = 30 + TIME_RATE = 10.0 * 6 / 1000 / 3 # 3 times upsampled + cif_peak = us_cif_peak.reshape(-1) + num_frames = cif_peak.shape[-1] + if char_list[-1] == "": + char_list = char_list[:-1] + # char_list = [i for i in text] + timestamp_list = [] + new_char_list = [] + # for bicif model trained with large data, cif2 actually fires when a character starts + # so treat the frames between two peaks as the duration of the former token + fire_place = np.where(cif_peak > 1.0 - 1e-4)[0] + total_offset # np format + num_peak = len(fire_place) + assert num_peak == len(char_list) + 1 # number of peaks is supposed to be number of tokens + 1 + # begin silence + if fire_place[0] > START_END_THRESHOLD: + # char_list.insert(0, '') + timestamp_list.append([0.0, fire_place[0] * TIME_RATE]) + new_char_list.append("") + # tokens timestamp + for i in range(len(fire_place) - 1): + new_char_list.append(char_list[i]) + if ( + i == len(fire_place) - 2 + or MAX_TOKEN_DURATION < 0 + or fire_place[i + 1] - fire_place[i] < MAX_TOKEN_DURATION + ): + timestamp_list.append([fire_place[i] * TIME_RATE, fire_place[i + 1] * TIME_RATE]) + else: + # cut the duration to token and sil of the 0-weight frames last long + _split = fire_place[i] + MAX_TOKEN_DURATION + timestamp_list.append([fire_place[i] * TIME_RATE, _split * TIME_RATE]) + timestamp_list.append([_split * TIME_RATE, fire_place[i + 1] * TIME_RATE]) + new_char_list.append("") + # tail token and end silence + if num_frames - fire_place[-1] > START_END_THRESHOLD: + _end = (num_frames + fire_place[-1]) / 2 + timestamp_list[-1][1] = _end * TIME_RATE + timestamp_list.append([_end * TIME_RATE, num_frames * TIME_RATE]) + new_char_list.append("") + else: + timestamp_list[-1][1] = num_frames * TIME_RATE + if begin_time: # add offset time in model with vad + for i in range(len(timestamp_list)): + timestamp_list[i][0] = timestamp_list[i][0] + begin_time / 1000.0 + timestamp_list[i][1] = timestamp_list[i][1] + begin_time / 1000.0 + assert len(new_char_list) == len(timestamp_list) + res_str = "" + for char, timestamp in zip(new_char_list, timestamp_list): + res_str += "{} {} {};".format(char, timestamp[0], timestamp[1]) + res = [] + for char, timestamp in zip(new_char_list, timestamp_list): + if char != "": + res.append([int(timestamp[0] * 1000), int(timestamp[1] * 1000)]) + return res_str, res diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/utils.py b/runtime/python/onnxruntime/funasr_onnx/utils/utils.py new file mode 100644 index 0000000..c39d433 --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/utils/utils.py @@ -0,0 +1,395 @@ +# -*- encoding: utf-8 -*- + +import functools +import logging +from pathlib import Path +from typing import Any, Dict, Iterable, List, NamedTuple, Set, Tuple, Union + +import re +import numpy as np +import yaml + +try: + from onnxruntime import ( + GraphOptimizationLevel, + InferenceSession, + SessionOptions, + get_available_providers, + get_device, + ) +except: + print("please pip3 install onnxruntime") +import jieba +import warnings + +root_dir = Path(__file__).resolve().parent + +logger_initialized = {} + + +def pad_list(xs, pad_value, max_len=None): + n_batch = len(xs) + if max_len is None: + max_len = max(x.size(0) for x in xs) + # pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value) + # numpy format + pad = (np.zeros((n_batch, max_len)) + pad_value).astype(np.int32) + for i in range(n_batch): + pad[i, : xs[i].shape[0]] = xs[i] + + return pad + + +""" +def make_pad_mask(lengths, xs=None, length_dim=-1, maxlen=None): + if length_dim == 0: + raise ValueError("length_dim cannot be 0: {}".format(length_dim)) + + if not isinstance(lengths, list): + lengths = lengths.tolist() + bs = int(len(lengths)) + if maxlen is None: + if xs is None: + maxlen = int(max(lengths)) + else: + maxlen = xs.size(length_dim) + else: + assert xs is None + assert maxlen >= int(max(lengths)) + + seq_range = torch.arange(0, maxlen, dtype=torch.int64) + seq_range_expand = seq_range.unsqueeze(0).expand(bs, maxlen) + seq_length_expand = seq_range_expand.new(lengths).unsqueeze(-1) + mask = seq_range_expand >= seq_length_expand + + if xs is not None: + assert xs.size(0) == bs, (xs.size(0), bs) + + if length_dim < 0: + length_dim = xs.dim() + length_dim + # ind = (:, None, ..., None, :, , None, ..., None) + ind = tuple( + slice(None) if i in (0, length_dim) else None for i in range(xs.dim()) + ) + mask = mask[ind].expand_as(xs).to(xs.device) + return mask +""" + + +class TokenIDConverter: + def __init__( + self, + token_list: Union[List, str], + ): + + self.token_list = token_list + self.unk_symbol = token_list[-1] + self.token2id = {v: i for i, v in enumerate(self.token_list)} + self.unk_id = self.token2id[self.unk_symbol] + + def get_num_vocabulary_size(self) -> int: + return len(self.token_list) + + def ids2tokens(self, integers: Union[np.ndarray, Iterable[int]]) -> List[str]: + if isinstance(integers, np.ndarray) and integers.ndim != 1: + raise TokenIDConverterError(f"Must be 1 dim ndarray, but got {integers.ndim}") + return [self.token_list[i] for i in integers] + + def tokens2ids(self, tokens: Iterable[str]) -> List[int]: + + return [self.token2id.get(i, self.unk_id) for i in tokens] + + +class CharTokenizer: + def __init__( + self, + symbol_value: Union[Path, str, Iterable[str]] = None, + space_symbol: str = "", + remove_non_linguistic_symbols: bool = False, + ): + + self.space_symbol = space_symbol + self.non_linguistic_symbols = self.load_symbols(symbol_value) + self.remove_non_linguistic_symbols = remove_non_linguistic_symbols + + @staticmethod + def load_symbols(value: Union[Path, str, Iterable[str]] = None) -> Set: + if value is None: + return set() + + if isinstance(value, Iterable[str]): + return set(value) + + file_path = Path(value) + if not file_path.exists(): + logging.warning("%s doesn't exist.", file_path) + return set() + + with file_path.open("r", encoding="utf-8") as f: + return set(line.rstrip() for line in f) + + def text2tokens(self, line: Union[str, list]) -> List[str]: + tokens = [] + while len(line) != 0: + for w in self.non_linguistic_symbols: + if line.startswith(w): + if not self.remove_non_linguistic_symbols: + tokens.append(line[: len(w)]) + line = line[len(w) :] + break + else: + t = line[0] + if t == " ": + t = "" + tokens.append(t) + line = line[1:] + return tokens + + def tokens2text(self, tokens: Iterable[str]) -> str: + tokens = [t if t != self.space_symbol else " " for t in tokens] + return "".join(tokens) + + def __repr__(self): + return ( + f"{self.__class__.__name__}(" + f'space_symbol="{self.space_symbol}"' + f'non_linguistic_symbols="{self.non_linguistic_symbols}"' + f")" + ) + + +class Hypothesis(NamedTuple): + """Hypothesis data type.""" + + yseq: np.ndarray + score: Union[float, np.ndarray] = 0 + scores: Dict[str, Union[float, np.ndarray]] = dict() + states: Dict[str, Any] = dict() + + def asdict(self) -> dict: + """Convert data to JSON-friendly dict.""" + return self._replace( + yseq=self.yseq.tolist(), + score=float(self.score), + scores={k: float(v) for k, v in self.scores.items()}, + )._asdict() + + +class TokenIDConverterError(Exception): + pass + + +class ONNXRuntimeError(Exception): + pass + + +class OrtInferSession: + def __init__(self, model_file, device_id=-1, intra_op_num_threads=4): + device_id = str(device_id) + sess_opt = SessionOptions() + sess_opt.intra_op_num_threads = intra_op_num_threads + sess_opt.log_severity_level = 4 + sess_opt.enable_cpu_mem_arena = False + sess_opt.graph_optimization_level = GraphOptimizationLevel.ORT_ENABLE_ALL + + cuda_ep = "CUDAExecutionProvider" + cuda_provider_options = { + "device_id": device_id, + "arena_extend_strategy": "kNextPowerOfTwo", + "cudnn_conv_algo_search": "EXHAUSTIVE", + "do_copy_in_default_stream": "true", + } + cpu_ep = "CPUExecutionProvider" + cpu_provider_options = { + "arena_extend_strategy": "kSameAsRequested", + } + + EP_list = [] + if device_id != "-1" and get_device() == "GPU" and cuda_ep in get_available_providers(): + EP_list = [(cuda_ep, cuda_provider_options)] + EP_list.append((cpu_ep, cpu_provider_options)) + + self._verify_model(model_file) + self.session = InferenceSession(model_file, sess_options=sess_opt, providers=EP_list) + + if device_id != "-1" and cuda_ep not in self.session.get_providers(): + warnings.warn( + f"{cuda_ep} is not avaiable for current env, the inference part is automatically shifted to be executed under {cpu_ep}.\n" + "Please ensure the installed onnxruntime-gpu version matches your cuda and cudnn version, " + "you can check their relations from the offical web site: " + "https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html", + RuntimeWarning, + ) + + def __call__(self, input_content: List[Union[np.ndarray, np.ndarray]]) -> np.ndarray: + input_dict = dict(zip(self.get_input_names(), input_content)) + try: + return self.session.run(self.get_output_names(), input_dict) + except Exception as e: + raise ONNXRuntimeError("ONNXRuntime inferece failed.") from e + + def get_input_names( + self, + ): + return [v.name for v in self.session.get_inputs()] + + def get_output_names( + self, + ): + return [v.name for v in self.session.get_outputs()] + + def get_character_list(self, key: str = "character"): + return self.meta_dict[key].splitlines() + + def have_key(self, key: str = "character") -> bool: + self.meta_dict = self.session.get_modelmeta().custom_metadata_map + if key in self.meta_dict.keys(): + return True + return False + + @staticmethod + def _verify_model(model_path): + model_path = Path(model_path) + if not model_path.exists(): + raise FileNotFoundError(f"{model_path} does not exists.") + if not model_path.is_file(): + raise FileExistsError(f"{model_path} is not a file.") + + +def split_to_mini_sentence(words: list, word_limit: int = 20): + assert word_limit > 1 + if len(words) <= word_limit: + return [words] + sentences = [] + length = len(words) + sentence_len = length // word_limit + for i in range(sentence_len): + sentences.append(words[i * word_limit : (i + 1) * word_limit]) + if length % word_limit > 0: + sentences.append(words[sentence_len * word_limit :]) + return sentences + + +def code_mix_split_words(text: str): + words = [] + segs = text.split() + for seg in segs: + # There is no space in seg. + current_word = "" + for c in seg: + if len(c.encode()) == 1: + # This is an ASCII char. + current_word += c + else: + # This is a Chinese char. + if len(current_word) > 0: + words.append(current_word) + current_word = "" + words.append(c) + if len(current_word) > 0: + words.append(current_word) + return words + + +def isEnglish(text: str): + if re.search("^[a-zA-Z']+$", text): + return True + else: + return False + + +def join_chinese_and_english(input_list): + line = "" + for token in input_list: + if isEnglish(token): + line = line + " " + token + else: + line = line + token + + line = line.strip() + return line + + +def code_mix_split_words_jieba(seg_dict_file: str): + jieba.load_userdict(seg_dict_file) + + def _fn(text: str): + input_list = text.split() + token_list_all = [] + langauge_list = [] + token_list_tmp = [] + language_flag = None + for token in input_list: + if isEnglish(token) and language_flag == "Chinese": + token_list_all.append(token_list_tmp) + langauge_list.append("Chinese") + token_list_tmp = [] + elif not isEnglish(token) and language_flag == "English": + token_list_all.append(token_list_tmp) + langauge_list.append("English") + token_list_tmp = [] + + token_list_tmp.append(token) + + if isEnglish(token): + language_flag = "English" + else: + language_flag = "Chinese" + + if token_list_tmp: + token_list_all.append(token_list_tmp) + langauge_list.append(language_flag) + + result_list = [] + for token_list_tmp, language_flag in zip(token_list_all, langauge_list): + if language_flag == "English": + result_list.extend(token_list_tmp) + else: + seg_list = jieba.cut(join_chinese_and_english(token_list_tmp), HMM=False) + result_list.extend(seg_list) + + return result_list + + return _fn + + +def read_yaml(yaml_path: Union[str, Path]) -> Dict: + if not Path(yaml_path).exists(): + raise FileExistsError(f"The {yaml_path} does not exist.") + + with open(str(yaml_path), "rb") as f: + data = yaml.load(f, Loader=yaml.Loader) + return data + + +@functools.lru_cache() +def get_logger(name="funasr_onnx"): + """Initialize and get a logger by name. + If the logger has not been initialized, this method will initialize the + logger by adding one or two handlers, otherwise the initialized logger will + be directly returned. During initialization, a StreamHandler will always be + added. + Args: + name (str): Logger name. + Returns: + logging.Logger: The expected logger. + """ + logger = logging.getLogger(name) + if name in logger_initialized: + return logger + + for logger_name in logger_initialized: + if name.startswith(logger_name): + return logger + + formatter = logging.Formatter( + "[%(asctime)s] %(name)s %(levelname)s: %(message)s", datefmt="%Y/%m/%d %H:%M:%S" + ) + + sh = logging.StreamHandler() + sh.setFormatter(formatter) + logger.addHandler(sh) + logger_initialized[name] = True + logger.propagate = False + logging.basicConfig(level=logging.ERROR) + return logger diff --git a/runtime/python/onnxruntime/funasr_onnx/vad_bin.py b/runtime/python/onnxruntime/funasr_onnx/vad_bin.py new file mode 100644 index 0000000..c195bb3 --- /dev/null +++ b/runtime/python/onnxruntime/funasr_onnx/vad_bin.py @@ -0,0 +1,330 @@ +# -*- encoding: utf-8 -*- +# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved. +# MIT License (https://opensource.org/licenses/MIT) + +import os.path +from pathlib import Path +from typing import List, Union, Tuple + +import copy +import librosa +import numpy as np + +from .utils.utils import ONNXRuntimeError, OrtInferSession, get_logger, read_yaml +from .utils.frontend import WavFrontend, WavFrontendOnline +from .utils.e2e_vad import E2EVadModel + +logging = get_logger() + + +class Fsmn_vad: + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__( + self, + model_dir: Union[str, Path] = None, + batch_size: int = 1, + device_id: Union[str, int] = "-1", + quantize: bool = False, + intra_op_num_threads: int = 4, + max_end_sil: int = None, + cache_dir: str = None, + **kwargs, + ): + + if not Path(model_dir).exists(): + try: + from modelscope.hub.snapshot_download import snapshot_download + except: + raise "You are exporting model from modelscope, please install modelscope and try it again. To install modelscope, you could:\n" "\npip3 install -U modelscope\n" "For the users in China, you could install with the command:\n" "\npip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple" + try: + model_dir = snapshot_download(model_dir, cache_dir=cache_dir) + except: + raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format( + model_dir + ) + + model_file = os.path.join(model_dir, "model.onnx") + if quantize: + model_file = os.path.join(model_dir, "model_quant.onnx") + if not os.path.exists(model_file): + print(".onnx is not exist, begin to export onnx") + try: + from funasr import AutoModel + except: + raise "You are exporting onnx, please install funasr and try it again. To install funasr, you could:\n" "\npip3 install -U funasr\n" "For the users in China, you could install with the command:\n" "\npip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple" + + model = AutoModel(model=model_dir) + model_dir = model.export(type="onnx", quantize=quantize, **kwargs) + config_file = os.path.join(model_dir, "config.yaml") + cmvn_file = os.path.join(model_dir, "am.mvn") + config = read_yaml(config_file) + + self.frontend = WavFrontend(cmvn_file=cmvn_file, **config["frontend_conf"]) + self.ort_infer = OrtInferSession( + model_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + self.batch_size = batch_size + self.vad_scorer = E2EVadModel(config["model_conf"]) + self.max_end_sil = ( + max_end_sil if max_end_sil is not None else config["model_conf"]["max_end_silence_time"] + ) + self.encoder_conf = config["encoder_conf"] + + def prepare_cache(self, in_cache: list = []): + if len(in_cache) > 0: + return in_cache + fsmn_layers = self.encoder_conf["fsmn_layers"] + proj_dim = self.encoder_conf["proj_dim"] + lorder = self.encoder_conf["lorder"] + for i in range(fsmn_layers): + cache = np.zeros((1, proj_dim, lorder - 1, 1)).astype(np.float32) + in_cache.append(cache) + return in_cache + + def __call__(self, audio_in: Union[str, np.ndarray, List[str]], **kwargs) -> List: + waveform_list = self.load_data(audio_in, self.frontend.opts.frame_opts.samp_freq) + waveform_nums = len(waveform_list) + is_final = kwargs.get("kwargs", False) + + segments = [[]] * self.batch_size + for beg_idx in range(0, waveform_nums, self.batch_size): + + end_idx = min(waveform_nums, beg_idx + self.batch_size) + waveform = waveform_list[beg_idx:end_idx] + feats, feats_len = self.extract_feat(waveform) + waveform = np.array(waveform) + param_dict = kwargs.get("param_dict", dict()) + in_cache = param_dict.get("in_cache", list()) + in_cache = self.prepare_cache(in_cache) + try: + t_offset = 0 + step = int(min(feats_len.max(), 6000)) + for t_offset in range(0, int(feats_len), min(step, feats_len - t_offset)): + if t_offset + step >= feats_len - 1: + step = feats_len - t_offset + is_final = True + else: + is_final = False + feats_package = feats[:, t_offset : int(t_offset + step), :] + waveform_package = waveform[ + :, + t_offset + * 160 : min(waveform.shape[-1], (int(t_offset + step) - 1) * 160 + 400), + ] + + inputs = [feats_package] + # inputs = [feats] + inputs.extend(in_cache) + scores, out_caches = self.infer(inputs) + in_cache = out_caches + segments_part = self.vad_scorer( + scores, + waveform_package, + is_final=is_final, + max_end_sil=self.max_end_sil, + online=False, + ) + # segments = self.vad_scorer(scores, waveform[0][None, :], is_final=is_final, max_end_sil=self.max_end_sil) + + if segments_part: + for batch_num in range(0, self.batch_size): + segments[batch_num] += segments_part[batch_num] + + except ONNXRuntimeError: + # logging.warning(traceback.format_exc()) + logging.warning("input wav is silence or noise") + segments = "" + + return segments + + def load_data(self, wav_content: Union[str, np.ndarray, List[str]], fs: int = None) -> List: + def load_wav(path: str) -> np.ndarray: + waveform, _ = librosa.load(path, sr=fs) + return waveform + + if isinstance(wav_content, np.ndarray): + return [wav_content] + + if isinstance(wav_content, str): + return [load_wav(wav_content)] + + if isinstance(wav_content, list): + return [load_wav(path) for path in wav_content] + + raise TypeError(f"The type of {wav_content} is not in [str, np.ndarray, list]") + + def extract_feat(self, waveform_list: List[np.ndarray]) -> Tuple[np.ndarray, np.ndarray]: + feats, feats_len = [], [] + for waveform in waveform_list: + speech, _ = self.frontend.fbank(waveform) + feat, feat_len = self.frontend.lfr_cmvn(speech) + feats.append(feat) + feats_len.append(feat_len) + + feats = self.pad_feats(feats, np.max(feats_len)) + feats_len = np.array(feats_len).astype(np.int32) + return feats, feats_len + + @staticmethod + def pad_feats(feats: List[np.ndarray], max_feat_len: int) -> np.ndarray: + def pad_feat(feat: np.ndarray, cur_len: int) -> np.ndarray: + pad_width = ((0, max_feat_len - cur_len), (0, 0)) + return np.pad(feat, pad_width, "constant", constant_values=0) + + feat_res = [pad_feat(feat, feat.shape[0]) for feat in feats] + feats = np.array(feat_res).astype(np.float32) + return feats + + def infer(self, feats: List) -> Tuple[np.ndarray, np.ndarray]: + + outputs = self.ort_infer(feats) + scores, out_caches = outputs[0], outputs[1:] + return scores, out_caches + + +class Fsmn_vad_online: + """ + Author: Speech Lab of DAMO Academy, Alibaba Group + Deep-FSMN for Large Vocabulary Continuous Speech Recognition + https://arxiv.org/abs/1803.05030 + """ + + def __init__( + self, + model_dir: Union[str, Path] = None, + batch_size: int = 1, + device_id: Union[str, int] = "-1", + quantize: bool = False, + intra_op_num_threads: int = 4, + max_end_sil: int = None, + cache_dir: str = None, + **kwargs, + ): + if not Path(model_dir).exists(): + try: + from modelscope.hub.snapshot_download import snapshot_download + except: + raise "You are exporting model from modelscope, please install modelscope and try it again. To install modelscope, you could:\n" "\npip3 install -U modelscope\n" "For the users in China, you could install with the command:\n" "\npip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple" + try: + model_dir = snapshot_download(model_dir, cache_dir=cache_dir) + except: + raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format( + model_dir + ) + + model_file = os.path.join(model_dir, "model.onnx") + if quantize: + model_file = os.path.join(model_dir, "model_quant.onnx") + if not os.path.exists(model_file): + print(".onnx is not exist, begin to export onnx") + try: + from funasr import AutoModel + except: + raise "You are exporting onnx, please install funasr and try it again. To install funasr, you could:\n" "\npip3 install -U funasr\n" "For the users in China, you could install with the command:\n" "\npip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple" + + model = AutoModel(model=model_dir) + model_dir = model.export(type="onnx", quantize=quantize, **kwargs) + + config_file = os.path.join(model_dir, "config.yaml") + cmvn_file = os.path.join(model_dir, "am.mvn") + config = read_yaml(config_file) + + self.frontend = WavFrontendOnline(cmvn_file=cmvn_file, **config["frontend_conf"]) + self.ort_infer = OrtInferSession( + model_file, device_id, intra_op_num_threads=intra_op_num_threads + ) + self.batch_size = batch_size + self.vad_scorer = E2EVadModel(config["model_conf"]) + self.max_end_sil = ( + max_end_sil if max_end_sil is not None else config["model_conf"]["max_end_silence_time"] + ) + self.encoder_conf = config["encoder_conf"] + + def prepare_cache(self, in_cache: list = []): + if len(in_cache) > 0: + return in_cache + fsmn_layers = self.encoder_conf["fsmn_layers"] + proj_dim = self.encoder_conf["proj_dim"] + lorder = self.encoder_conf["lorder"] + for i in range(fsmn_layers): + cache = np.zeros((1, proj_dim, lorder - 1, 1)).astype(np.float32) + in_cache.append(cache) + return in_cache + + def __call__(self, audio_in: np.ndarray, **kwargs) -> List: + waveforms = np.expand_dims(audio_in, axis=0) + + param_dict = kwargs.get("param_dict", dict()) + is_final = param_dict.get("is_final", False) + feats, feats_len = self.extract_feat(waveforms, is_final) + segments = [] + if feats.size != 0: + in_cache = param_dict.get("in_cache", list()) + in_cache = self.prepare_cache(in_cache) + try: + inputs = [feats] + inputs.extend(in_cache) + scores, out_caches = self.infer(inputs) + param_dict["in_cache"] = out_caches + waveforms = self.frontend.get_waveforms() + segments = self.vad_scorer( + scores, waveforms, is_final=is_final, max_end_sil=self.max_end_sil, online=True + ) + + except ONNXRuntimeError: + # logging.warning(traceback.format_exc()) + logging.warning("input wav is silence or noise") + segments = [] + return segments + + def load_data(self, wav_content: Union[str, np.ndarray, List[str]], fs: int = None) -> List: + def load_wav(path: str) -> np.ndarray: + waveform, _ = librosa.load(path, sr=fs) + return waveform + + if isinstance(wav_content, np.ndarray): + return [wav_content] + + if isinstance(wav_content, str): + return [load_wav(wav_content)] + + if isinstance(wav_content, list): + return [load_wav(path) for path in wav_content] + + raise TypeError(f"The type of {wav_content} is not in [str, np.ndarray, list]") + + def extract_feat( + self, waveforms: np.ndarray, is_final: bool = False + ) -> Tuple[np.ndarray, np.ndarray]: + waveforms_lens = np.zeros(waveforms.shape[0]).astype(np.int32) + for idx, waveform in enumerate(waveforms): + waveforms_lens[idx] = waveform.shape[-1] + + feats, feats_len = self.frontend.extract_fbank(waveforms, waveforms_lens, is_final) + # feats.append(feat) + # feats_len.append(feat_len) + + # feats = self.pad_feats(feats, np.max(feats_len)) + # feats_len = np.array(feats_len).astype(np.int32) + return feats.astype(np.float32), feats_len.astype(np.int32) + + @staticmethod + def pad_feats(feats: List[np.ndarray], max_feat_len: int) -> np.ndarray: + def pad_feat(feat: np.ndarray, cur_len: int) -> np.ndarray: + pad_width = ((0, max_feat_len - cur_len), (0, 0)) + return np.pad(feat, pad_width, "constant", constant_values=0) + + feat_res = [pad_feat(feat, feat.shape[0]) for feat in feats] + feats = np.array(feat_res).astype(np.float32) + return feats + + def infer(self, feats: List) -> Tuple[np.ndarray, np.ndarray]: + + outputs = self.ort_infer(feats) + scores, out_caches = outputs[0], outputs[1:] + return scores, out_caches diff --git a/runtime/python/onnxruntime/funasr_server_http.py b/runtime/python/onnxruntime/funasr_server_http.py new file mode 100644 index 0000000..b864b41 --- /dev/null +++ b/runtime/python/onnxruntime/funasr_server_http.py @@ -0,0 +1,43 @@ +import argparse +import base64 +import io +import soundfile as sf +import uvicorn +from fastapi import FastAPI, Body + +app = FastAPI() + +from funasr_onnx import Paraformer + +model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx" +model = Paraformer(model_dir, batch_size=1, quantize=True) + + +async def recognition_onnx(waveform): + result = model(waveform)[0]["preds"][0] + return result + + +@app.post("/api/asr") +async def asr(item: dict = Body(...)): + try: + audio_bytes = base64.b64decode(bytes(item["wav_base64"], "utf-8")) + waveform, _ = sf.read(io.BytesIO(audio_bytes)) + result = await recognition_onnx(waveform) + ret = {"results": result, "code": 0} + except: + print("请求出错,这里是处理出错的") + ret = {"results": "", "code": 1} + return ret + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="API Service") + parser.add_argument("--listen", default="0.0.0.0", type=str, help="the network to listen") + parser.add_argument("--port", default=8888, type=int, help="the port to listen") + args = parser.parse_args() + + print("start...") + print("server on:", args) + + uvicorn.run(app, host=args.listen, port=args.port) diff --git a/runtime/python/onnxruntime/setup.py b/runtime/python/onnxruntime/setup.py new file mode 100644 index 0000000..b2977ce --- /dev/null +++ b/runtime/python/onnxruntime/setup.py @@ -0,0 +1,48 @@ +# -*- encoding: utf-8 -*- +from pathlib import Path +import setuptools + + +def get_readme(): + root_dir = Path(__file__).resolve().parent + readme_path = str(root_dir / "README.md") + print(readme_path) + with open(readme_path, "r", encoding="utf-8") as f: + readme = f.read() + return readme + + +MODULE_NAME = "funasr_onnx" +VERSION_NUM = "0.3.1" + +setuptools.setup( + name=MODULE_NAME, + version=VERSION_NUM, + platforms="Any", + url="https://github.com/alibaba-damo-academy/FunASR.git", + author="Speech Lab of DAMO Academy, Alibaba Group", + author_email="funasr@list.alibaba-inc.com", + description="FunASR: A Fundamental End-to-End Speech Recognition Toolkit", + license="MIT", + long_description=get_readme(), + long_description_content_type="text/markdown", + include_package_data=True, + install_requires=[ + "librosa", + "onnxruntime>=1.7.0", + "scipy", + "numpy>=1.19.3", + "kaldi-native-fbank", + "PyYAML>=5.1.2", + "onnx", + ], + packages=[MODULE_NAME, f"{MODULE_NAME}.utils"], + keywords=["funasr,asr"], + classifiers=[ + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + ], +) diff --git a/runtime/python/utils/compute_wer.py b/runtime/python/utils/compute_wer.py new file mode 100644 index 0000000..46ec08e --- /dev/null +++ b/runtime/python/utils/compute_wer.py @@ -0,0 +1,193 @@ +import os +import numpy as np +import sys + + +def compute_wer(ref_file, hyp_file, cer_detail_file): + rst = { + "Wrd": 0, + "Corr": 0, + "Ins": 0, + "Del": 0, + "Sub": 0, + "Snt": 0, + "Err": 0.0, + "S.Err": 0.0, + "wrong_words": 0, + "wrong_sentences": 0, + } + + hyp_dict = {} + ref_dict = {} + with open(hyp_file, "r") as hyp_reader: + for line in hyp_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + hyp_dict[key] = value + with open(ref_file, "r") as ref_reader: + for line in ref_reader: + key = line.strip().split()[0] + value = line.strip().split()[1:] + ref_dict[key] = value + + cer_detail_writer = open(cer_detail_file, "w") + for hyp_key in hyp_dict: + if hyp_key in ref_dict: + out_item = compute_wer_by_line(hyp_dict[hyp_key], ref_dict[hyp_key]) + rst["Wrd"] += out_item["nwords"] + rst["Corr"] += out_item["cor"] + rst["wrong_words"] += out_item["wrong"] + rst["Ins"] += out_item["ins"] + rst["Del"] += out_item["del"] + rst["Sub"] += out_item["sub"] + rst["Snt"] += 1 + if out_item["wrong"] > 0: + rst["wrong_sentences"] += 1 + cer_detail_writer.write(hyp_key + print_cer_detail(out_item) + "\n") + cer_detail_writer.write("ref:" + "\t" + "".join(ref_dict[hyp_key]) + "\n") + cer_detail_writer.write("hyp:" + "\t" + "".join(hyp_dict[hyp_key]) + "\n") + + if rst["Wrd"] > 0: + rst["Err"] = round(rst["wrong_words"] * 100 / rst["Wrd"], 2) + if rst["Snt"] > 0: + rst["S.Err"] = round(rst["wrong_sentences"] * 100 / rst["Snt"], 2) + + cer_detail_writer.write("\n") + cer_detail_writer.write( + "%WER " + + str(rst["Err"]) + + " [ " + + str(rst["wrong_words"]) + + " / " + + str(rst["Wrd"]) + + ", " + + str(rst["Ins"]) + + " ins, " + + str(rst["Del"]) + + " del, " + + str(rst["Sub"]) + + " sub ]" + + "\n" + ) + cer_detail_writer.write( + "%SER " + + str(rst["S.Err"]) + + " [ " + + str(rst["wrong_sentences"]) + + " / " + + str(rst["Snt"]) + + " ]" + + "\n" + ) + cer_detail_writer.write( + "Scored " + + str(len(hyp_dict)) + + " sentences, " + + str(len(hyp_dict) - rst["Snt"]) + + " not present in hyp." + + "\n" + ) + + +def compute_wer_by_line(hyp, ref): + hyp = list(map(lambda x: x.lower(), hyp)) + ref = list(map(lambda x: x.lower(), ref)) + + len_hyp = len(hyp) + len_ref = len(ref) + + cost_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int16) + + ops_matrix = np.zeros((len_hyp + 1, len_ref + 1), dtype=np.int8) + + for i in range(len_hyp + 1): + cost_matrix[i][0] = i + for j in range(len_ref + 1): + cost_matrix[0][j] = j + + for i in range(1, len_hyp + 1): + for j in range(1, len_ref + 1): + if hyp[i - 1] == ref[j - 1]: + cost_matrix[i][j] = cost_matrix[i - 1][j - 1] + else: + substitution = cost_matrix[i - 1][j - 1] + 1 + insertion = cost_matrix[i - 1][j] + 1 + deletion = cost_matrix[i][j - 1] + 1 + + compare_val = [substitution, insertion, deletion] + + min_val = min(compare_val) + operation_idx = compare_val.index(min_val) + 1 + cost_matrix[i][j] = min_val + ops_matrix[i][j] = operation_idx + + match_idx = [] + i = len_hyp + j = len_ref + rst = {"nwords": len_ref, "cor": 0, "wrong": 0, "ins": 0, "del": 0, "sub": 0} + while i >= 0 or j >= 0: + i_idx = max(0, i) + j_idx = max(0, j) + + if ops_matrix[i_idx][j_idx] == 0: # correct + if i - 1 >= 0 and j - 1 >= 0: + match_idx.append((j - 1, i - 1)) + rst["cor"] += 1 + + i -= 1 + j -= 1 + + elif ops_matrix[i_idx][j_idx] == 2: # insert + i -= 1 + rst["ins"] += 1 + + elif ops_matrix[i_idx][j_idx] == 3: # delete + j -= 1 + rst["del"] += 1 + + elif ops_matrix[i_idx][j_idx] == 1: # substitute + i -= 1 + j -= 1 + rst["sub"] += 1 + + if i < 0 and j >= 0: + rst["del"] += 1 + elif j < 0 and i >= 0: + rst["ins"] += 1 + + match_idx.reverse() + wrong_cnt = cost_matrix[len_hyp][len_ref] + rst["wrong"] = wrong_cnt + + return rst + + +def print_cer_detail(rst): + return ( + "(" + + "nwords=" + + str(rst["nwords"]) + + ",cor=" + + str(rst["cor"]) + + ",ins=" + + str(rst["ins"]) + + ",del=" + + str(rst["del"]) + + ",sub=" + + str(rst["sub"]) + + ") corr:" + + "{:.2%}".format(rst["cor"] / rst["nwords"]) + + ",cer:" + + "{:.2%}".format(rst["wrong"] / rst["nwords"]) + ) + + +if __name__ == "__main__": + if len(sys.argv) != 4: + print("usage : python compute-wer.py test.ref test.hyp test.wer") + sys.exit(0) + + ref_file = sys.argv[1] + hyp_file = sys.argv[2] + cer_detail_file = sys.argv[3] + compute_wer(ref_file, hyp_file, cer_detail_file) diff --git a/runtime/python/utils/proce_text.py b/runtime/python/utils/proce_text.py new file mode 100644 index 0000000..d03febd --- /dev/null +++ b/runtime/python/utils/proce_text.py @@ -0,0 +1,30 @@ +import sys +import re + +in_f = sys.argv[1] +out_f = sys.argv[2] + + +with open(in_f, "r", encoding="utf-8") as f: + lines = f.readlines() + +with open(out_f, "w", encoding="utf-8") as f: + for line in lines: + outs = line.strip().split(" ", 1) + if len(outs) == 2: + idx, text = outs + text = re.sub("", "", text) + text = re.sub("", "", text) + text = re.sub("@@", "", text) + text = re.sub("@", "", text) + text = re.sub("", "", text) + text = re.sub(" ", "", text) + text = text.lower() + else: + idx = outs[0] + text = " " + + text = [x for x in text] + text = " ".join(text) + out = "{} {}\n".format(idx, text) + f.write(out) diff --git a/runtime/python/utils/requirements.txt b/runtime/python/utils/requirements.txt new file mode 100644 index 0000000..2262c55 --- /dev/null +++ b/runtime/python/utils/requirements.txt @@ -0,0 +1,5 @@ +onnx +onnxruntime +torch-quant >= 0.4.0 +funasr_torch +funasr_onnx \ No newline at end of file diff --git a/runtime/python/utils/split_scp.pl b/runtime/python/utils/split_scp.pl new file mode 100644 index 0000000..0876dcb --- /dev/null +++ b/runtime/python/utils/split_scp.pl @@ -0,0 +1,246 @@ +#!/usr/bin/env perl + +# Copyright 2010-2011 Microsoft Corporation + +# See ../../COPYING for clarification regarding multiple authors +# +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# This program splits up any kind of .scp or archive-type file. +# If there is no utt2spk option it will work on any text file and +# will split it up with an approximately equal number of lines in +# each but. +# With the --utt2spk option it will work on anything that has the +# utterance-id as the first entry on each line; the utt2spk file is +# of the form "utterance speaker" (on each line). +# It splits it into equal size chunks as far as it can. If you use the utt2spk +# option it will make sure these chunks coincide with speaker boundaries. In +# this case, if there are more chunks than speakers (and in some other +# circumstances), some of the resulting chunks will be empty and it will print +# an error message and exit with nonzero status. +# You will normally call this like: +# split_scp.pl scp scp.1 scp.2 scp.3 ... +# or +# split_scp.pl --utt2spk=utt2spk scp scp.1 scp.2 scp.3 ... +# Note that you can use this script to split the utt2spk file itself, +# e.g. split_scp.pl --utt2spk=utt2spk utt2spk utt2spk.1 utt2spk.2 ... + +# You can also call the scripts like: +# split_scp.pl -j 3 0 scp scp.0 +# [note: with this option, it assumes zero-based indexing of the split parts, +# i.e. the second number must be 0 <= n < num-jobs.] + +use warnings; + +$num_jobs = 0; +$job_id = 0; +$utt2spk_file = ""; +$one_based = 0; + +for ($x = 1; $x <= 3 && @ARGV > 0; $x++) { + if ($ARGV[0] eq "-j") { + shift @ARGV; + $num_jobs = shift @ARGV; + $job_id = shift @ARGV; + } + if ($ARGV[0] =~ /--utt2spk=(.+)/) { + $utt2spk_file=$1; + shift; + } + if ($ARGV[0] eq '--one-based') { + $one_based = 1; + shift @ARGV; + } +} + +if ($num_jobs != 0 && ($num_jobs < 0 || $job_id - $one_based < 0 || + $job_id - $one_based >= $num_jobs)) { + die "$0: Invalid job number/index values for '-j $num_jobs $job_id" . + ($one_based ? " --one-based" : "") . "'\n" +} + +$one_based + and $job_id--; + +if(($num_jobs == 0 && @ARGV < 2) || ($num_jobs > 0 && (@ARGV < 1 || @ARGV > 2))) { + die +"Usage: split_scp.pl [--utt2spk=] in.scp out1.scp out2.scp ... + or: split_scp.pl -j num-jobs job-id [--one-based] [--utt2spk=] in.scp [out.scp] + ... where 0 <= job-id < num-jobs, or 1 <= job-id <- num-jobs if --one-based.\n"; +} + +$error = 0; +$inscp = shift @ARGV; +if ($num_jobs == 0) { # without -j option + @OUTPUTS = @ARGV; +} else { + for ($j = 0; $j < $num_jobs; $j++) { + if ($j == $job_id) { + if (@ARGV > 0) { push @OUTPUTS, $ARGV[0]; } + else { push @OUTPUTS, "-"; } + } else { + push @OUTPUTS, "/dev/null"; + } + } +} + +if ($utt2spk_file ne "") { # We have the --utt2spk option... + open($u_fh, '<', $utt2spk_file) || die "$0: Error opening utt2spk file $utt2spk_file: $!\n"; + while(<$u_fh>) { + @A = split; + @A == 2 || die "$0: Bad line $_ in utt2spk file $utt2spk_file\n"; + ($u,$s) = @A; + $utt2spk{$u} = $s; + } + close $u_fh; + open($i_fh, '<', $inscp) || die "$0: Error opening input scp file $inscp: $!\n"; + @spkrs = (); + while(<$i_fh>) { + @A = split; + if(@A == 0) { die "$0: Empty or space-only line in scp file $inscp\n"; } + $u = $A[0]; + $s = $utt2spk{$u}; + defined $s || die "$0: No utterance $u in utt2spk file $utt2spk_file\n"; + if(!defined $spk_count{$s}) { + push @spkrs, $s; + $spk_count{$s} = 0; + $spk_data{$s} = []; # ref to new empty array. + } + $spk_count{$s}++; + push @{$spk_data{$s}}, $_; + } + # Now split as equally as possible .. + # First allocate spks to files by allocating an approximately + # equal number of speakers. + $numspks = @spkrs; # number of speakers. + $numscps = @OUTPUTS; # number of output files. + if ($numspks < $numscps) { + die "$0: Refusing to split data because number of speakers $numspks " . + "is less than the number of output .scp files $numscps\n"; + } + for($scpidx = 0; $scpidx < $numscps; $scpidx++) { + $scparray[$scpidx] = []; # [] is array reference. + } + for ($spkidx = 0; $spkidx < $numspks; $spkidx++) { + $scpidx = int(($spkidx*$numscps) / $numspks); + $spk = $spkrs[$spkidx]; + push @{$scparray[$scpidx]}, $spk; + $scpcount[$scpidx] += $spk_count{$spk}; + } + + # Now will try to reassign beginning + ending speakers + # to different scp's and see if it gets more balanced. + # Suppose objf we're minimizing is sum_i (num utts in scp[i] - average)^2. + # We can show that if considering changing just 2 scp's, we minimize + # this by minimizing the squared difference in sizes. This is + # equivalent to minimizing the absolute difference in sizes. This + # shows this method is bound to converge. + + $changed = 1; + while($changed) { + $changed = 0; + for($scpidx = 0; $scpidx < $numscps; $scpidx++) { + # First try to reassign ending spk of this scp. + if($scpidx < $numscps-1) { + $sz = @{$scparray[$scpidx]}; + if($sz > 0) { + $spk = $scparray[$scpidx]->[$sz-1]; + $count = $spk_count{$spk}; + $nutt1 = $scpcount[$scpidx]; + $nutt2 = $scpcount[$scpidx+1]; + if( abs( ($nutt2+$count) - ($nutt1-$count)) + < abs($nutt2 - $nutt1)) { # Would decrease + # size-diff by reassigning spk... + $scpcount[$scpidx+1] += $count; + $scpcount[$scpidx] -= $count; + pop @{$scparray[$scpidx]}; + unshift @{$scparray[$scpidx+1]}, $spk; + $changed = 1; + } + } + } + if($scpidx > 0 && @{$scparray[$scpidx]} > 0) { + $spk = $scparray[$scpidx]->[0]; + $count = $spk_count{$spk}; + $nutt1 = $scpcount[$scpidx-1]; + $nutt2 = $scpcount[$scpidx]; + if( abs( ($nutt2-$count) - ($nutt1+$count)) + < abs($nutt2 - $nutt1)) { # Would decrease + # size-diff by reassigning spk... + $scpcount[$scpidx-1] += $count; + $scpcount[$scpidx] -= $count; + shift @{$scparray[$scpidx]}; + push @{$scparray[$scpidx-1]}, $spk; + $changed = 1; + } + } + } + } + # Now print out the files... + for($scpidx = 0; $scpidx < $numscps; $scpidx++) { + $scpfile = $OUTPUTS[$scpidx]; + ($scpfile ne '-' ? open($f_fh, '>', $scpfile) + : open($f_fh, '>&', \*STDOUT)) || + die "$0: Could not open scp file $scpfile for writing: $!\n"; + $count = 0; + if(@{$scparray[$scpidx]} == 0) { + print STDERR "$0: eError: split_scp.pl producing empty .scp file " . + "$scpfile (too many splits and too few speakers?)\n"; + $error = 1; + } else { + foreach $spk ( @{$scparray[$scpidx]} ) { + print $f_fh @{$spk_data{$spk}}; + $count += $spk_count{$spk}; + } + $count == $scpcount[$scpidx] || die "Count mismatch [code error]"; + } + close($f_fh); + } +} else { + # This block is the "normal" case where there is no --utt2spk + # option and we just break into equal size chunks. + + open($i_fh, '<', $inscp) || die "$0: Error opening input scp file $inscp: $!\n"; + + $numscps = @OUTPUTS; # size of array. + @F = (); + while(<$i_fh>) { + push @F, $_; + } + $numlines = @F; + if($numlines == 0) { + print STDERR "$0: error: empty input scp file $inscp\n"; + $error = 1; + } + $linesperscp = int( $numlines / $numscps); # the "whole part".. + $linesperscp >= 1 || die "$0: You are splitting into too many pieces! [reduce \$nj ($numscps) to be smaller than the number of lines ($numlines) in $inscp]\n"; + $remainder = $numlines - ($linesperscp * $numscps); + ($remainder >= 0 && $remainder < $numlines) || die "bad remainder $remainder"; + # [just doing int() rounds down]. + $n = 0; + for($scpidx = 0; $scpidx < @OUTPUTS; $scpidx++) { + $scpfile = $OUTPUTS[$scpidx]; + ($scpfile ne '-' ? open($o_fh, '>', $scpfile) + : open($o_fh, '>&', \*STDOUT)) || + die "$0: Could not open scp file $scpfile for writing: $!\n"; + for($k = 0; $k < $linesperscp + ($scpidx < $remainder ? 1 : 0); $k++) { + print $o_fh $F[$n++]; + } + close($o_fh) || die "$0: Eror closing scp file $scpfile: $!\n"; + } + $n == $numlines || die "$n != $numlines [code error]"; +} + +exit ($error); diff --git a/runtime/python/utils/test_cer.py b/runtime/python/utils/test_cer.py new file mode 100644 index 0000000..58285c2 --- /dev/null +++ b/runtime/python/utils/test_cer.py @@ -0,0 +1,56 @@ +import os +import time +import sys +import librosa +from funasr.utils.types import str2bool + +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("--model_dir", type=str, required=True) +parser.add_argument("--backend", type=str, default="onnx", help='["onnx", "torch"]') +parser.add_argument("--wav_file", type=str, default=None, help="amp fallback number") +parser.add_argument("--quantize", type=str2bool, default=False, help="quantized model") +parser.add_argument( + "--intra_op_num_threads", type=int, default=1, help="intra_op_num_threads for onnx" +) +parser.add_argument("--output_dir", type=str, default=None, help="amp fallback number") +args = parser.parse_args() + + +from funasr.runtime.python.libtorch.funasr_torch import Paraformer + +if args.backend == "onnx": + from funasr.runtime.python.onnxruntime.funasr_onnx import Paraformer + +model = Paraformer( + args.model_dir, + batch_size=1, + quantize=args.quantize, + intra_op_num_threads=args.intra_op_num_threads, +) + +wav_file_f = open(args.wav_file, "r") +wav_files = wav_file_f.readlines() + +output_dir = args.output_dir +if not os.path.exists(output_dir): + os.makedirs(output_dir) +if os.name == "nt": # Windows + newline = "\r\n" +else: # Linux Mac + newline = "\n" +text_f = open(os.path.join(output_dir, "text"), "w", newline=newline) +token_f = open(os.path.join(output_dir, "token"), "w", newline=newline) + +for i, wav_path_i in enumerate(wav_files): + wav_name, wav_path = wav_path_i.strip().split() + result = model(wav_path) + text_i = "{} {}\n".format(wav_name, result[0]["preds"][0]) + token_i = "{} {}\n".format(wav_name, result[0]["preds"][1]) + text_f.write(text_i) + text_f.flush() + token_f.write(token_i) + token_f.flush() +text_f.close() +token_f.close() diff --git a/runtime/python/utils/test_cer.sh b/runtime/python/utils/test_cer.sh new file mode 100644 index 0000000..da4cd08 --- /dev/null +++ b/runtime/python/utils/test_cer.sh @@ -0,0 +1,74 @@ + +split_scps_tool=split_scp.pl +inference_tool=test_cer.py +proce_text_tool=proce_text.py +compute_wer_tool=compute_wer.py + +nj=32 +stage=0 +stop_stage=2 + +scp="/nfs/haoneng.lhn/funasr_data/aishell-1/data/test/wav.scp" +label_text="/nfs/haoneng.lhn/funasr_data/aishell-1/data/test/text" +export_root="/nfs/zhifu.gzf/export" + + +#:< ${output_dir}/log.$JOB.txt + }& + + done + wait + + mkdir -p ${output_dir}/1best_recog + for f in token text; do + if [ -f "${output_dir}/1/${f}" ]; then + for JOB in $(seq "${nj}"); do + cat "${output_dir}/${JOB}/${f}" + done | sort -k1 >"${output_dir}/1best_recog/${f}" + fi + done + +fi + +if [ $stage -le 2 ] && [ $stop_stage -ge 2 ];then + echo "Computing WER ..." + python ${proce_text_tool} ${output_dir}/1best_recog/text ${output_dir}/1best_recog/text.proc + python ${proce_text_tool} ${label_text} ${output_dir}/1best_recog/text.ref + python ${compute_wer_tool} ${output_dir}/1best_recog/text.ref ${output_dir}/1best_recog/text.proc ${output_dir}/1best_recog/text.cer + tail -n 3 ${output_dir}/1best_recog/text.cer +fi + diff --git a/runtime/python/utils/test_rtf.py b/runtime/python/utils/test_rtf.py new file mode 100644 index 0000000..112025d --- /dev/null +++ b/runtime/python/utils/test_rtf.py @@ -0,0 +1,79 @@ +import time +import sys +import librosa +from funasr.utils.types import str2bool + +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("--model_dir", type=str, required=True) +parser.add_argument("--backend", type=str, default="onnx", help='["onnx", "torch"]') +parser.add_argument("--wav_file", type=str, default=None, help="amp fallback number") +parser.add_argument("--quantize", type=str2bool, default=False, help="quantized model") +parser.add_argument( + "--intra_op_num_threads", type=int, default=1, help="intra_op_num_threads for onnx" +) +args = parser.parse_args() + + +from funasr.runtime.python.libtorch.funasr_torch import Paraformer + +if args.backend == "onnx": + from funasr.runtime.python.onnxruntime.funasr_onnx import Paraformer + +model = Paraformer( + args.model_dir, + batch_size=1, + quantize=args.quantize, + intra_op_num_threads=args.intra_op_num_threads, +) + +wav_file_f = open(args.wav_file, "r") +wav_files = wav_file_f.readlines() + +# warm-up +total = 0.0 +num = 30 +wav_path = ( + wav_files[0].split("\t")[1].strip() + if "\t" in wav_files[0] + else wav_files[0].split(" ")[1].strip() +) +for i in range(num): + beg_time = time.time() + result = model(wav_path) + end_time = time.time() + duration = end_time - beg_time + total += duration + print(result) + print( + "num: {}, time, {}, avg: {}, rtf: {}".format( + len(wav_path), duration, total / (i + 1), (total / (i + 1)) / 5.53 + ) + ) + +# infer time +beg_time = time.time() +for i, wav_path_i in enumerate(wav_files): + wav_path = ( + wav_path_i.split("\t")[1].strip() + if "\t" in wav_path_i + else wav_path_i.split(" ")[1].strip() + ) + result = model(wav_path) +end_time = time.time() +duration = (end_time - beg_time) * 1000 +print("total_time_comput_ms: {}".format(int(duration))) + +duration_time = 0.0 +for i, wav_path_i in enumerate(wav_files): + wav_path = ( + wav_path_i.split("\t")[1].strip() + if "\t" in wav_path_i + else wav_path_i.split(" ")[1].strip() + ) + waveform, _ = librosa.load(wav_path, sr=16000) + duration_time += len(waveform) / 16.0 +print("total_time_wav_ms: {}".format(int(duration_time))) + +print("total_rtf: {:.5}".format(duration / duration_time)) diff --git a/runtime/python/utils/test_rtf.sh b/runtime/python/utils/test_rtf.sh new file mode 100644 index 0000000..dcce6c4 --- /dev/null +++ b/runtime/python/utils/test_rtf.sh @@ -0,0 +1,71 @@ + +nj=32 +stage=0 + +scp="/nfs/haoneng.lhn/funasr_data/aishell-1/data/test/wav.scp" +export_root="/nfs/zhifu.gzf/export" +split_scps_tool=split_scp.pl +rtf_tool=test_rtf.py + +#:< ${logs_outputs_dir}/log.$JOB.txt + }& + +done +wait + + +rm -rf ${logs_outputs_dir}/total_time_comput.txt +rm -rf ${logs_outputs_dir}/total_time_wav.txt +rm -rf ${logs_outputs_dir}/total_rtf.txt +for JOB in $(seq ${nj}); do + { + cat ${logs_outputs_dir}/log.$JOB.txt | grep "total_time_comput" | awk -F ' ' '{print $2}' >> ${logs_outputs_dir}/total_time_comput.txt + cat ${logs_outputs_dir}/log.$JOB.txt | grep "total_time_wav" | awk -F ' ' '{print $2}' >> ${logs_outputs_dir}/total_time_wav.txt + cat ${logs_outputs_dir}/log.$JOB.txt | grep "total_rtf" | awk -F ' ' '{print $2}' >> ${logs_outputs_dir}/total_rtf.txt + } + +done + +total_time_comput=`cat ${logs_outputs_dir}/total_time_comput.txt | awk 'BEGIN {max = 0} {if ($1+0>max+0) max=$1 fi} END {print max}'` +total_time_wav=`cat ${logs_outputs_dir}/total_time_wav.txt | awk '{sum +=$1};END {print sum}'` +rtf=`awk 'BEGIN{printf "%.5f\n",'$total_time_comput'/'$total_time_wav'}'` +speed=`awk 'BEGIN{printf "%.2f\n",1/'$rtf'}'` + +echo "total_time_comput_ms: $total_time_comput" +echo "total_time_wav: $total_time_wav" +echo "total_rtf: $rtf, speech: $speed" + +fi \ No newline at end of file diff --git a/runtime/python/utils/test_rtf_gpu.py b/runtime/python/utils/test_rtf_gpu.py new file mode 100644 index 0000000..38d4294 --- /dev/null +++ b/runtime/python/utils/test_rtf_gpu.py @@ -0,0 +1,82 @@ +import time +import sys +import librosa +from funasr.utils.types import str2bool + +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("--model_dir", type=str, required=True) +parser.add_argument("--backend", type=str, default="onnx", help='["onnx", "torch"]') +parser.add_argument("--wav_file", type=str, default=None, help="amp fallback number") +parser.add_argument("--quantize", type=str2bool, default=False, help="quantized model") +parser.add_argument( + "--intra_op_num_threads", type=int, default=1, help="intra_op_num_threads for onnx" +) +parser.add_argument("--batch_size", type=int, default=1, help="batch_size for onnx") +args = parser.parse_args() + + +from funasr.runtime.python.libtorch.funasr_torch import Paraformer + +if args.backend == "onnx": + from funasr.runtime.python.onnxruntime.funasr_onnx import Paraformer + +model = Paraformer( + args.model_dir, + batch_size=args.batch_size, + quantize=args.quantize, + intra_op_num_threads=args.intra_op_num_threads, +) + +wav_file_f = open(args.wav_file, "r") +wav_files = wav_file_f.readlines() + +# warm-up +total = 0.0 +num = 30 +wav_path = ( + wav_files[0].split("\t")[1].strip() + if "\t" in wav_files[0] + else wav_files[0].split(" ")[1].strip() +) +for i in range(num): + beg_time = time.time() + result = model(wav_path) + end_time = time.time() + duration = end_time - beg_time + total += duration + print(result) + print( + "num: {}, time, {}, avg: {}, rtf: {}".format( + len(wav_path), duration, total / (i + 1), (total / (i + 1)) / 5.53 + ) + ) + +# infer time +wav_path = [] +beg_time = time.time() +for i, wav_path_i in enumerate(wav_files): + wav_path_i = ( + wav_path_i.split("\t")[1].strip() + if "\t" in wav_path_i + else wav_path_i.split(" ")[1].strip() + ) + wav_path += [wav_path_i] +result = model(wav_path) +end_time = time.time() +duration = (end_time - beg_time) * 1000 +print("total_time_comput_ms: {}".format(int(duration))) + +duration_time = 0.0 +for i, wav_path_i in enumerate(wav_files): + wav_path = ( + wav_path_i.split("\t")[1].strip() + if "\t" in wav_path_i + else wav_path_i.split(" ")[1].strip() + ) + waveform, _ = librosa.load(wav_path, sr=16000) + duration_time += len(waveform) / 16.0 +print("total_time_wav_ms: {}".format(int(duration_time))) + +print("total_rtf: {:.5}".format(duration / duration_time)) diff --git a/runtime/python/websocket/README.md b/runtime/python/websocket/README.md new file mode 100644 index 0000000..304008d --- /dev/null +++ b/runtime/python/websocket/README.md @@ -0,0 +1,127 @@ +# Service with websocket-python + +This is a demo using funasr pipeline with websocket python-api. It supports the offline, online, offline/online-2pass unifying speech recognition. + +## For the Server + +### Install the modelscope and funasr + +```shell +pip install -U modelscope funasr +# For the users in China, you could install with the command: +# pip install -U modelscope funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple +git clone https://github.com/alibaba/FunASR.git && cd FunASR +``` + +### Install the requirements for server + +```shell +cd runtime/python/websocket +pip install -r requirements_server.txt +``` + +### Start server + +##### API-reference +```shell +python funasr_wss_server.py \ +--port [port id] \ +--asr_model [asr model_name] \ +--asr_model_online [asr model_name] \ +--punc_model [punc model_name] \ +--ngpu [0 or 1] \ +--ncpu [1 or 4] \ +--certfile [path of certfile for ssl] \ +--keyfile [path of keyfile for ssl] +``` +##### Usage examples +```shell +python funasr_wss_server.py --port 10095 +``` + +## For the client + +Install the requirements for client +```shell +git clone https://github.com/alibaba/FunASR.git && cd FunASR +cd funasr/runtime/python/websocket +pip install -r requirements_client.txt +``` +If you want infer from videos, you should install `ffmpeg` +```shell +apt-get install -y ffmpeg #ubuntu +# yum install -y ffmpeg # centos +# brew install ffmpeg # mac +# winget install ffmpeg # wins +pip3 install websockets ffmpeg-python +``` + +### Start client +#### API-reference +```shell +python funasr_wss_client.py \ +--host [ip_address] \ +--port [port id] \ +--chunk_size ["5,10,5"=600ms, "8,8,4"=480ms] \ +--chunk_interval [duration of send chunk_size/chunk_interval] \ +--words_max_print [max number of words to print] \ +--audio_in [if set, loadding from wav.scp, else recording from mircrophone] \ +--output_dir [if set, write the results to output_dir] \ +--mode [`online` for streaming asr, `offline` for non-streaming, `2pass` for unifying streaming and non-streaming asr] \ +--thread_num [thread_num for send data] +``` + +#### Usage examples +##### ASR offline client +Recording from mircrophone +```shell +# --chunk_interval, "10": 600/10=60ms, "5"=600/5=120ms, "20": 600/12=30ms +python funasr_wss_client.py --host "0.0.0.0" --port 10095 --mode offline +``` +Loadding from wav.scp(kaldi style) +```shell +# --chunk_interval, "10": 600/10=60ms, "5"=600/5=120ms, "20": 600/12=30ms +python funasr_wss_client.py --host "0.0.0.0" --port 10095 --mode offline --audio_in "./data/wav.scp" --output_dir "./results" +``` + +##### ASR streaming client +Recording from mircrophone +```shell +# --chunk_size, "5,10,5"=600ms, "8,8,4"=480ms +python funasr_wss_client.py --host "0.0.0.0" --port 10095 --mode online --chunk_size "5,10,5" +``` +Loadding from wav.scp(kaldi style) +```shell +# --chunk_size, "5,10,5"=600ms, "8,8,4"=480ms +python funasr_wss_client.py --host "0.0.0.0" --port 10095 --mode online --chunk_size "5,10,5" --audio_in "./data/wav.scp" --output_dir "./results" +``` + +##### ASR offline/online 2pass client +Recording from mircrophone +```shell +# --chunk_size, "5,10,5"=600ms, "8,8,4"=480ms +python funasr_wss_client.py --host "0.0.0.0" --port 10095 --mode 2pass --chunk_size "8,8,4" +``` +Loadding from wav.scp(kaldi style) +```shell +# --chunk_size, "5,10,5"=600ms, "8,8,4"=480ms +python funasr_wss_client.py --host "0.0.0.0" --port 10095 --mode 2pass --chunk_size "8,8,4" --audio_in "./data/wav.scp" --output_dir "./results" +``` + +#### Websocket api +```shell +# class Funasr_websocket_recognizer example with 3 step +# 1.create an recognizer +rcg=Funasr_websocket_recognizer(host="127.0.0.1",port="30035",is_ssl=True,mode="2pass") +# 2.send pcm data to asr engine and get asr result +text=rcg.feed_chunk(data) +print("text",text) +# 3.get last result, set timeout=3 +text=rcg.close(timeout=3) +print("text",text) +``` + +## Acknowledge +1. This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR). +2. We acknowledge [zhaoming](https://github.com/zhaomingwork/FunASR/tree/fix_bug_for_python_websocket) for contributing the websocket service. +3. We acknowledge [cgisky1980](https://github.com/cgisky1980/FunASR) for contributing the websocket service of offline model. diff --git a/runtime/python/websocket/funasr_client_api.py b/runtime/python/websocket/funasr_client_api.py new file mode 100644 index 0000000..2119f44 --- /dev/null +++ b/runtime/python/websocket/funasr_client_api.py @@ -0,0 +1,160 @@ +""" + Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + Reserved. MIT License (https://opensource.org/licenses/MIT) + + 2022-2023 by zhaomingwork@qq.com +""" + +# pip install websocket-client +import ssl +from websocket import ABNF +from websocket import create_connection +from queue import Queue +import threading +import traceback +import json +import time +import numpy as np + + +# class for recognizer in websocket +class Funasr_websocket_recognizer: + """ + python asr recognizer lib + + """ + + def __init__( + self, + host="127.0.0.1", + port="30035", + is_ssl=True, + chunk_size="0, 10, 5", + chunk_interval=10, + mode="offline", + wav_name="default", + ): + """ + host: server host ip + port: server port + is_ssl: True for wss protocal, False for ws + """ + try: + if is_ssl == True: + ssl_context = ssl.SSLContext() + ssl_context.check_hostname = False + ssl_context.verify_mode = ssl.CERT_NONE + uri = "wss://{}:{}".format(host, port) + ssl_opt = {"cert_reqs": ssl.CERT_NONE} + else: + uri = "ws://{}:{}".format(host, port) + ssl_context = None + ssl_opt = None + self.host = host + self.port = port + + self.msg_queue = Queue() # used for recognized result text + + print("connect to url", uri) + self.websocket = create_connection(uri, ssl=ssl_context, sslopt=ssl_opt) + + self.thread_msg = threading.Thread( + target=Funasr_websocket_recognizer.thread_rec_msg, args=(self,) + ) + self.thread_msg.start() + chunk_size = [int(x) for x in chunk_size.split(",")] + stride = int(60 * chunk_size[1] / chunk_interval / 1000 * 16000 * 2) + chunk_num = (len(audio_bytes) - 1) // stride + 1 + + message = json.dumps( + { + "mode": mode, + "chunk_size": chunk_size, + "encoder_chunk_look_back": 4, + "decoder_chunk_look_back": 1, + "chunk_interval": chunk_interval, + "wav_name": wav_name, + "is_speaking": True, + } + ) + + self.websocket.send(message) + + print("send json", message) + + except Exception as e: + print("Exception:", e) + traceback.print_exc() + + # threads for rev msg + def thread_rec_msg(self): + try: + while True: + msg = self.websocket.recv() + if msg is None or len(msg) == 0: + continue + msg = json.loads(msg) + + self.msg_queue.put(msg) + except Exception as e: + print("client closed") + + # feed data to asr engine, wait_time means waiting for result until time out + def feed_chunk(self, chunk, wait_time=0.01): + try: + self.websocket.send(chunk, ABNF.OPCODE_BINARY) + # loop to check if there is a message, timeout in 0.01s + while True: + msg = self.msg_queue.get(timeout=wait_time) + if self.msg_queue.empty(): + break + + return msg + except: + return "" + + def close(self, timeout=1): + message = json.dumps({"is_speaking": False}) + self.websocket.send(message) + # sleep for timeout seconds to wait for result + time.sleep(timeout) + msg = "" + while not self.msg_queue.empty(): + msg = self.msg_queue.get() + + self.websocket.close() + # only resturn the last msg + return msg + + +if __name__ == "__main__": + + print("example for Funasr_websocket_recognizer") + import wave + + wav_path = "/Users/zhifu/Downloads/modelscope_models/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav" + with wave.open(wav_path, "rb") as wav_file: + params = wav_file.getparams() + frames = wav_file.readframes(wav_file.getnframes()) + audio_bytes = bytes(frames) + + stride = int(60 * 10 / 10 / 1000 * 16000 * 2) + chunk_num = (len(audio_bytes) - 1) // stride + 1 + # create an recognizer + rcg = Funasr_websocket_recognizer( + host="127.0.0.1", port="10095", is_ssl=True, mode="2pass", chunk_size="0,10,5" + ) + # loop to send chunk + for i in range(chunk_num): + + beg = i * stride + data = audio_bytes[beg : beg + stride] + + text = rcg.feed_chunk(data, wait_time=0.02) + if len(text) > 0: + print("text", text) + time.sleep(0.05) + + # get last message + text = rcg.close(timeout=3) + print("text", text) diff --git a/runtime/python/websocket/funasr_wss_client.py b/runtime/python/websocket/funasr_wss_client.py new file mode 100644 index 0000000..dfea7da --- /dev/null +++ b/runtime/python/websocket/funasr_wss_client.py @@ -0,0 +1,393 @@ +# -*- encoding: utf-8 -*- +import os +import time +import websockets, ssl +import asyncio + +# import threading +import argparse +import json +import traceback +from multiprocessing import Process + +# from funasr.fileio.datadir_writer import DatadirWriter + +import logging + +logging.basicConfig(level=logging.ERROR) + +parser = argparse.ArgumentParser() +parser.add_argument( + "--host", type=str, default="localhost", required=False, help="host ip, localhost, 0.0.0.0" +) +parser.add_argument("--port", type=int, default=10095, required=False, help="grpc server port") +parser.add_argument("--chunk_size", type=str, default="5, 10, 5", help="chunk") +parser.add_argument("--encoder_chunk_look_back", type=int, default=4, help="chunk") +parser.add_argument("--decoder_chunk_look_back", type=int, default=0, help="chunk") +parser.add_argument("--chunk_interval", type=int, default=10, help="chunk") +parser.add_argument( + "--hotword", + type=str, + default="", + help="hotword file path, one hotword perline (e.g.:阿里巴巴 20)", +) +parser.add_argument("--audio_in", type=str, default=None, help="audio_in") +parser.add_argument("--audio_fs", type=int, default=16000, help="audio_fs") +parser.add_argument( + "--send_without_sleep", + action="store_true", + default=True, + help="if audio_in is set, send_without_sleep", +) +parser.add_argument("--thread_num", type=int, default=1, help="thread_num") +parser.add_argument("--words_max_print", type=int, default=10000, help="chunk") +parser.add_argument("--output_dir", type=str, default=None, help="output_dir") +parser.add_argument("--ssl", type=int, default=1, help="1 for ssl connect, 0 for no ssl") +parser.add_argument("--use_itn", type=int, default=1, help="1 for using itn, 0 for not itn") +parser.add_argument("--mode", type=str, default="2pass", help="offline, online, 2pass") + +args = parser.parse_args() +args.chunk_size = [int(x) for x in args.chunk_size.split(",")] +print(args) +# voices = asyncio.Queue() +from queue import Queue + +voices = Queue() +offline_msg_done = False + +if args.output_dir is not None: + # if os.path.exists(args.output_dir): + # os.remove(args.output_dir) + + if not os.path.exists(args.output_dir): + os.makedirs(args.output_dir) + + +async def record_microphone(): + is_finished = False + import pyaudio + + # print("2") + global voices + FORMAT = pyaudio.paInt16 + CHANNELS = 1 + RATE = 16000 + chunk_size = 60 * args.chunk_size[1] / args.chunk_interval + CHUNK = int(RATE / 1000 * chunk_size) + + p = pyaudio.PyAudio() + + stream = p.open( + format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK + ) + # hotwords + fst_dict = {} + hotword_msg = "" + if args.hotword.strip() != "": + if os.path.exists(args.hotword): + f_scp = open(args.hotword) + hot_lines = f_scp.readlines() + for line in hot_lines: + words = line.strip().split(" ") + if len(words) < 2: + print("Please checkout format of hotwords") + continue + try: + fst_dict[" ".join(words[:-1])] = int(words[-1]) + except ValueError: + print("Please checkout format of hotwords") + hotword_msg = json.dumps(fst_dict) + else: + hotword_msg = args.hotword + + use_itn = True + if args.use_itn == 0: + use_itn = False + + message = json.dumps( + { + "mode": args.mode, + "chunk_size": args.chunk_size, + "chunk_interval": args.chunk_interval, + "encoder_chunk_look_back": args.encoder_chunk_look_back, + "decoder_chunk_look_back": args.decoder_chunk_look_back, + "wav_name": "microphone", + "is_speaking": True, + "hotwords": hotword_msg, + "itn": use_itn, + } + ) + # voices.put(message) + await websocket.send(message) + while True: + data = stream.read(CHUNK) + message = data + # voices.put(message) + await websocket.send(message) + await asyncio.sleep(0.005) + + +async def record_from_scp(chunk_begin, chunk_size): + global voices + is_finished = False + if args.audio_in.endswith(".scp"): + f_scp = open(args.audio_in) + wavs = f_scp.readlines() + else: + wavs = [args.audio_in] + + # hotwords + fst_dict = {} + hotword_msg = "" + if args.hotword.strip() != "": + if os.path.exists(args.hotword): + f_scp = open(args.hotword) + hot_lines = f_scp.readlines() + for line in hot_lines: + words = line.strip().split(" ") + if len(words) < 2: + print("Please checkout format of hotwords") + continue + try: + fst_dict[" ".join(words[:-1])] = int(words[-1]) + except ValueError: + print("Please checkout format of hotwords") + hotword_msg = json.dumps(fst_dict) + else: + hotword_msg = args.hotword + print(hotword_msg) + + sample_rate = args.audio_fs + wav_format = "pcm" + use_itn = True + if args.use_itn == 0: + use_itn = False + + if chunk_size > 0: + wavs = wavs[chunk_begin : chunk_begin + chunk_size] + for wav in wavs: + wav_splits = wav.strip().split() + + wav_name = wav_splits[0] if len(wav_splits) > 1 else "demo" + wav_path = wav_splits[1] if len(wav_splits) > 1 else wav_splits[0] + if not len(wav_path.strip()) > 0: + continue + if wav_path.endswith(".pcm"): + with open(wav_path, "rb") as f: + audio_bytes = f.read() + elif wav_path.endswith(".wav"): + import wave + + with wave.open(wav_path, "rb") as wav_file: + params = wav_file.getparams() + sample_rate = wav_file.getframerate() + frames = wav_file.readframes(wav_file.getnframes()) + audio_bytes = bytes(frames) + else: + wav_format = "others" + with open(wav_path, "rb") as f: + audio_bytes = f.read() + + stride = int(60 * args.chunk_size[1] / args.chunk_interval / 1000 * sample_rate * 2) + chunk_num = (len(audio_bytes) - 1) // stride + 1 + # print(stride) + + # send first time + message = json.dumps( + { + "mode": args.mode, + "chunk_size": args.chunk_size, + "chunk_interval": args.chunk_interval, + "encoder_chunk_look_back": args.encoder_chunk_look_back, + "decoder_chunk_look_back": args.decoder_chunk_look_back, + "audio_fs": sample_rate, + "wav_name": wav_name, + "wav_format": wav_format, + "is_speaking": True, + "hotwords": hotword_msg, + "itn": use_itn, + } + ) + + # voices.put(message) + await websocket.send(message) + is_speaking = True + for i in range(chunk_num): + + beg = i * stride + data = audio_bytes[beg : beg + stride] + message = data + # voices.put(message) + await websocket.send(message) + if i == chunk_num - 1: + is_speaking = False + message = json.dumps({"is_speaking": is_speaking}) + # voices.put(message) + await websocket.send(message) + + sleep_duration = ( + 0.001 + if args.mode == "offline" + else 60 * args.chunk_size[1] / args.chunk_interval / 1000 + ) + + await asyncio.sleep(sleep_duration) + + if not args.mode == "offline": + await asyncio.sleep(2) + # offline model need to wait for message recved + + if args.mode == "offline": + global offline_msg_done + while not offline_msg_done: + await asyncio.sleep(1) + + await websocket.close() + + +async def message(id): + global websocket, voices, offline_msg_done + text_print = "" + text_print_2pass_online = "" + text_print_2pass_offline = "" + if args.output_dir is not None: + ibest_writer = open( + os.path.join(args.output_dir, "text.{}".format(id)), "a", encoding="utf-8" + ) + else: + ibest_writer = None + try: + while True: + + meg = await websocket.recv() + meg = json.loads(meg) + wav_name = meg.get("wav_name", "demo") + text = meg["text"] + timestamp = "" + offline_msg_done = meg.get("is_final", False) + if "timestamp" in meg: + timestamp = meg["timestamp"] + + if ibest_writer is not None: + if timestamp != "": + text_write_line = "{}\t{}\t{}\n".format(wav_name, text, timestamp) + else: + text_write_line = "{}\t{}\n".format(wav_name, text) + ibest_writer.write(text_write_line) + + if "mode" not in meg: + continue + if meg["mode"] == "online": + text_print += "{}".format(text) + text_print = text_print[-args.words_max_print :] + os.system("clear") + print("\rpid" + str(id) + ": " + text_print) + elif meg["mode"] == "offline": + if timestamp != "": + text_print += "{} timestamp: {}".format(text, timestamp) + else: + text_print += "{}".format(text) + + # text_print = text_print[-args.words_max_print:] + # os.system('clear') + print("\rpid" + str(id) + ": " + wav_name + ": " + text_print) + offline_msg_done = True + else: + if meg["mode"] == "2pass-online": + text_print_2pass_online += "{}".format(text) + text_print = text_print_2pass_offline + text_print_2pass_online + else: + text_print_2pass_online = "" + text_print = text_print_2pass_offline + "{}".format(text) + text_print_2pass_offline += "{}".format(text) + text_print = text_print[-args.words_max_print :] + os.system("clear") + print("\rpid" + str(id) + ": " + text_print) + # offline_msg_done=True + + except Exception as e: + print("Exception:", e) + # traceback.print_exc() + # await websocket.close() + + +async def ws_client(id, chunk_begin, chunk_size): + if args.audio_in is None: + chunk_begin = 0 + chunk_size = 1 + global websocket, voices, offline_msg_done + + for i in range(chunk_begin, chunk_begin + chunk_size): + offline_msg_done = False + voices = Queue() + if args.ssl == 1: + ssl_context = ssl.SSLContext() + ssl_context.check_hostname = False + ssl_context.verify_mode = ssl.CERT_NONE + uri = "wss://{}:{}".format(args.host, args.port) + else: + uri = "ws://{}:{}".format(args.host, args.port) + ssl_context = None + print("connect to", uri) + async with websockets.connect( + uri, subprotocols=["binary"], ping_interval=None, ssl=ssl_context + ) as websocket: + if args.audio_in is not None: + task = asyncio.create_task(record_from_scp(i, 1)) + else: + task = asyncio.create_task(record_microphone()) + task3 = asyncio.create_task(message(str(id) + "_" + str(i))) # processid+fileid + await asyncio.gather(task, task3) + exit(0) + + +def one_thread(id, chunk_begin, chunk_size): + asyncio.get_event_loop().run_until_complete(ws_client(id, chunk_begin, chunk_size)) + asyncio.get_event_loop().run_forever() + + +if __name__ == "__main__": + # for microphone + if args.audio_in is None: + p = Process(target=one_thread, args=(0, 0, 0)) + p.start() + p.join() + print("end") + else: + # calculate the number of wavs for each preocess + if args.audio_in.endswith(".scp"): + f_scp = open(args.audio_in) + wavs = f_scp.readlines() + else: + wavs = [args.audio_in] + for wav in wavs: + wav_splits = wav.strip().split() + wav_name = wav_splits[0] if len(wav_splits) > 1 else "demo" + wav_path = wav_splits[1] if len(wav_splits) > 1 else wav_splits[0] + audio_type = os.path.splitext(wav_path)[-1].lower() + + total_len = len(wavs) + if total_len >= args.thread_num: + chunk_size = int(total_len / args.thread_num) + remain_wavs = total_len - chunk_size * args.thread_num + else: + chunk_size = 1 + remain_wavs = 0 + + process_list = [] + chunk_begin = 0 + for i in range(args.thread_num): + now_chunk_size = chunk_size + if remain_wavs > 0: + now_chunk_size = chunk_size + 1 + remain_wavs = remain_wavs - 1 + # process i handle wavs at chunk_begin and size of now_chunk_size + p = Process(target=one_thread, args=(i, chunk_begin, now_chunk_size)) + chunk_begin = chunk_begin + now_chunk_size + p.start() + process_list.append(p) + + for i in process_list: + p.join() + + print("end") diff --git a/runtime/python/websocket/funasr_wss_server.py b/runtime/python/websocket/funasr_wss_server.py new file mode 100644 index 0000000..9ee3051 --- /dev/null +++ b/runtime/python/websocket/funasr_wss_server.py @@ -0,0 +1,334 @@ +import asyncio +import json +import websockets +import time +import logging +import tracemalloc +import numpy as np +import argparse +import ssl + + +parser = argparse.ArgumentParser() +parser.add_argument( + "--host", type=str, default="0.0.0.0", required=False, help="host ip, localhost, 0.0.0.0" +) +parser.add_argument("--port", type=int, default=10095, required=False, help="grpc server port") +parser.add_argument( + "--asr_model", + type=str, + default="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + help="model from modelscope", +) +parser.add_argument("--asr_model_revision", type=str, default="v2.0.4", help="") +parser.add_argument( + "--asr_model_online", + type=str, + default="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online", + help="model from modelscope", +) +parser.add_argument("--asr_model_online_revision", type=str, default="v2.0.4", help="") +parser.add_argument( + "--vad_model", + type=str, + default="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", + help="model from modelscope", +) +parser.add_argument("--vad_model_revision", type=str, default="v2.0.4", help="") +parser.add_argument( + "--punc_model", + type=str, + default="iic/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727", + help="model from modelscope", +) +parser.add_argument("--punc_model_revision", type=str, default="v2.0.4", help="") +parser.add_argument("--ngpu", type=int, default=1, help="0 for cpu, 1 for gpu") +parser.add_argument("--device", type=str, default="cuda", help="cuda, cpu") +parser.add_argument("--ncpu", type=int, default=4, help="cpu cores") +parser.add_argument( + "--certfile", + type=str, + default="../../ssl_key/server.crt", + required=False, + help="certfile for ssl", +) + +parser.add_argument( + "--keyfile", + type=str, + default="../../ssl_key/server.key", + required=False, + help="keyfile for ssl", +) +args = parser.parse_args() + + +websocket_users = set() + +print("model loading") +from funasr import AutoModel + +# asr +model_asr = AutoModel( + model=args.asr_model, + model_revision=args.asr_model_revision, + ngpu=args.ngpu, + ncpu=args.ncpu, + device=args.device, + disable_pbar=True, + disable_log=True, +) +# asr +model_asr_streaming = AutoModel( + model=args.asr_model_online, + model_revision=args.asr_model_online_revision, + ngpu=args.ngpu, + ncpu=args.ncpu, + device=args.device, + disable_pbar=True, + disable_log=True, +) +# vad +model_vad = AutoModel( + model=args.vad_model, + model_revision=args.vad_model_revision, + ngpu=args.ngpu, + ncpu=args.ncpu, + device=args.device, + disable_pbar=True, + disable_log=True, + # chunk_size=60, +) + +if args.punc_model != "": + model_punc = AutoModel( + model=args.punc_model, + model_revision=args.punc_model_revision, + ngpu=args.ngpu, + ncpu=args.ncpu, + device=args.device, + disable_pbar=True, + disable_log=True, + ) +else: + model_punc = None + + +print("model loaded! only support one client at the same time now!!!!") + + +async def ws_reset(websocket): + print("ws reset now, total num is ", len(websocket_users)) + + websocket.status_dict_asr_online["cache"] = {} + websocket.status_dict_asr_online["is_final"] = True + websocket.status_dict_vad["cache"] = {} + websocket.status_dict_vad["is_final"] = True + websocket.status_dict_punc["cache"] = {} + + await websocket.close() + + +async def clear_websocket(): + for websocket in websocket_users: + await ws_reset(websocket) + websocket_users.clear() + + +async def ws_serve(websocket, path): + frames = [] + frames_asr = [] + frames_asr_online = [] + global websocket_users + # await clear_websocket() + websocket_users.add(websocket) + websocket.status_dict_asr = {} + websocket.status_dict_asr_online = {"cache": {}, "is_final": False} + websocket.status_dict_vad = {"cache": {}, "is_final": False} + websocket.status_dict_punc = {"cache": {}} + websocket.chunk_interval = 10 + websocket.vad_pre_idx = 0 + speech_start = False + speech_end_i = -1 + websocket.wav_name = "microphone" + websocket.mode = "2pass" + print("new user connected", flush=True) + + try: + async for message in websocket: + if isinstance(message, str): + messagejson = json.loads(message) + + if "is_speaking" in messagejson: + websocket.is_speaking = messagejson["is_speaking"] + websocket.status_dict_asr_online["is_final"] = not websocket.is_speaking + if "chunk_interval" in messagejson: + websocket.chunk_interval = messagejson["chunk_interval"] + if "wav_name" in messagejson: + websocket.wav_name = messagejson.get("wav_name") + if "chunk_size" in messagejson: + chunk_size = messagejson["chunk_size"] + if isinstance(chunk_size, str): + chunk_size = chunk_size.split(",") + websocket.status_dict_asr_online["chunk_size"] = [int(x) for x in chunk_size] + if "encoder_chunk_look_back" in messagejson: + websocket.status_dict_asr_online["encoder_chunk_look_back"] = messagejson[ + "encoder_chunk_look_back" + ] + if "decoder_chunk_look_back" in messagejson: + websocket.status_dict_asr_online["decoder_chunk_look_back"] = messagejson[ + "decoder_chunk_look_back" + ] + if "hotword" in messagejson: + websocket.status_dict_asr["hotword"] = messagejson["hotword"] + if "mode" in messagejson: + websocket.mode = messagejson["mode"] + + websocket.status_dict_vad["chunk_size"] = int( + websocket.status_dict_asr_online["chunk_size"][1] * 60 / websocket.chunk_interval + ) + if len(frames_asr_online) > 0 or len(frames_asr) > 0 or not isinstance(message, str): + if not isinstance(message, str): + frames.append(message) + duration_ms = len(message) // 32 + websocket.vad_pre_idx += duration_ms + + # asr online + frames_asr_online.append(message) + websocket.status_dict_asr_online["is_final"] = speech_end_i != -1 + if ( + len(frames_asr_online) % websocket.chunk_interval == 0 + or websocket.status_dict_asr_online["is_final"] + ): + if websocket.mode == "2pass" or websocket.mode == "online": + audio_in = b"".join(frames_asr_online) + try: + await async_asr_online(websocket, audio_in) + except: + print(f"error in asr streaming, {websocket.status_dict_asr_online}") + frames_asr_online = [] + if speech_start: + frames_asr.append(message) + # vad online + try: + speech_start_i, speech_end_i = await async_vad(websocket, message) + except: + print("error in vad") + if speech_start_i != -1: + speech_start = True + beg_bias = (websocket.vad_pre_idx - speech_start_i) // duration_ms + frames_pre = frames[-beg_bias:] + frames_asr = [] + frames_asr.extend(frames_pre) + # asr punc offline + if speech_end_i != -1 or not websocket.is_speaking: + # print("vad end point") + if websocket.mode == "2pass" or websocket.mode == "offline": + audio_in = b"".join(frames_asr) + try: + await async_asr(websocket, audio_in) + except: + print("error in asr offline") + frames_asr = [] + speech_start = False + frames_asr_online = [] + websocket.status_dict_asr_online["cache"] = {} + if not websocket.is_speaking: + websocket.vad_pre_idx = 0 + frames = [] + websocket.status_dict_vad["cache"] = {} + else: + frames = frames[-20:] + + except websockets.ConnectionClosed: + print("ConnectionClosed...", websocket_users, flush=True) + await ws_reset(websocket) + websocket_users.remove(websocket) + except websockets.InvalidState: + print("InvalidState...") + except Exception as e: + print("Exception:", e) + + +async def async_vad(websocket, audio_in): + + segments_result = model_vad.generate(input=audio_in, **websocket.status_dict_vad)[0]["value"] + # print(segments_result) + + speech_start = -1 + speech_end = -1 + + if len(segments_result) == 0 or len(segments_result) > 1: + return speech_start, speech_end + if segments_result[0][0] != -1: + speech_start = segments_result[0][0] + if segments_result[0][1] != -1: + speech_end = segments_result[0][1] + return speech_start, speech_end + + +async def async_asr(websocket, audio_in): + if len(audio_in) > 0: + # print(len(audio_in)) + rec_result = model_asr.generate(input=audio_in, **websocket.status_dict_asr)[0] + # print("offline_asr, ", rec_result) + if model_punc is not None and len(rec_result["text"]) > 0: + # print("offline, before punc", rec_result, "cache", websocket.status_dict_punc) + rec_result = model_punc.generate( + input=rec_result["text"], **websocket.status_dict_punc + )[0] + # print("offline, after punc", rec_result) + if len(rec_result["text"]) > 0: + # print("offline", rec_result) + mode = "2pass-offline" if "2pass" in websocket.mode else websocket.mode + message = json.dumps( + { + "mode": mode, + "text": rec_result["text"], + "wav_name": websocket.wav_name, + "is_final": websocket.is_speaking, + } + ) + await websocket.send(message) + + +async def async_asr_online(websocket, audio_in): + if len(audio_in) > 0: + # print(websocket.status_dict_asr_online.get("is_final", False)) + rec_result = model_asr_streaming.generate( + input=audio_in, **websocket.status_dict_asr_online + )[0] + # print("online, ", rec_result) + if websocket.mode == "2pass" and websocket.status_dict_asr_online.get("is_final", False): + return + # websocket.status_dict_asr_online["cache"] = dict() + if len(rec_result["text"]): + mode = "2pass-online" if "2pass" in websocket.mode else websocket.mode + message = json.dumps( + { + "mode": mode, + "text": rec_result["text"], + "wav_name": websocket.wav_name, + "is_final": websocket.is_speaking, + } + ) + await websocket.send(message) + + +if len(args.certfile) > 0: + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + + # Generate with Lets Encrypt, copied to this location, chown to current user and 400 permissions + ssl_cert = args.certfile + ssl_key = args.keyfile + + ssl_context.load_cert_chain(ssl_cert, keyfile=ssl_key) + start_server = websockets.serve( + ws_serve, args.host, args.port, subprotocols=["binary"], ping_interval=None, ssl=ssl_context + ) +else: + start_server = websockets.serve( + ws_serve, args.host, args.port, subprotocols=["binary"], ping_interval=None + ) +asyncio.get_event_loop().run_until_complete(start_server) +asyncio.get_event_loop().run_forever() diff --git a/runtime/python/websocket/requirements_client.txt b/runtime/python/websocket/requirements_client.txt new file mode 100644 index 0000000..2cd4242 --- /dev/null +++ b/runtime/python/websocket/requirements_client.txt @@ -0,0 +1,2 @@ +websockets +pyaudio diff --git a/runtime/python/websocket/requirements_server.txt b/runtime/python/websocket/requirements_server.txt new file mode 100644 index 0000000..14774b4 --- /dev/null +++ b/runtime/python/websocket/requirements_server.txt @@ -0,0 +1 @@ +websockets diff --git a/runtime/quick_start.md b/runtime/quick_start.md new file mode 100644 index 0000000..d0f7c0e --- /dev/null +++ b/runtime/quick_start.md @@ -0,0 +1,134 @@ +([简体中文](./quick_start_zh.md)|English) + +# Quick Start + +You can use FunASR in the following ways: + +- Service Deployment SDK +- Industrial model egs +- Academic model egs + +## Service Deployment SDK + +### Python version Example +Supports real-time streaming speech recognition, uses non-streaming models for error correction, and outputs text with punctuation. Currently, only single client is supported. For multi-concurrency, please refer to the C++ version service deployment SDK below. + +#### Server Deployment + +```shell +cd runtime/python/websocket +python funasr_wss_server.py --port 10095 +``` + +#### Client Testing + +```shell +python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass --chunk_size "5,10,5" +``` + +For more examples, please refer to [docs](../runtime/python/websocket/README.md). + +### Service Deployment Software + +Both high-precision, high-efficiency, and high-concurrency file transcription, as well as low-latency real-time speech recognition, are supported. It also supports Docker deployment and multiple concurrent requests. + +##### Docker Installation (optional) +###### If you have already installed Docker, skip this step. + +```shell +curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh; +sudo bash install_docker.sh +``` + +##### Real-time Speech Recognition Service Deployment + +###### Docker Image Download and Launch +Use the following command to pull and launch the FunASR software package Docker image([Get the latest image version](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online.md)): + +```shell +sudo docker pull \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.10 +mkdir -p ./funasr-runtime-resources/models +sudo docker run -p 10096:10095 -it --privileged=true \ + -v $PWD/funasr-runtime-resources/models:/workspace/models \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.10 +``` + +###### Server Start + +After Docker is started, start the funasr-wss-server-2pass service program: + +```shell +cd FunASR/runtime +nohup bash run_server_2pass.sh \ + --download-model-dir /workspace/models \ + --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ + --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx \ + --punc-dir damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx \ + --itn-dir thuduj12/fst_itn_zh \ + --hotword /workspace/models/hotwords.txt > log.txt 2>&1 & + +# If you want to disable SSL, add the parameter: --certfile 0 +# If you want to deploy with a timestamp or nn hotword model, please set --model-dir to the corresponding model: +# damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx (timestamp) +# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx (nn hotword) +# If you want to load hotwords on the server side, please configure the hotwords in the host file ./funasr-runtime-resources/models/hotwords.txt (docker mapping address is /workspace/models/hotwords.txt): +# One hotword per line, format (hotword weight): Alibaba 20 +``` + +###### Client Testing +Testing [samples](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz) + +```shell +python3 funasr_wss_client.py --host "127.0.0.1" --port 10096 --mode 2pass +``` +For more examples, please refer to [docs](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online.md) + + +#### File Transcription Service, Mandarin (CPU) + +###### Docker Image Download and Launch +Use the following command to pull and launch the FunASR software package Docker image([Get the latest image version](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline.md)): + +```shell +sudo docker pull \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.5 +mkdir -p ./funasr-runtime-resources/models +sudo docker run -p 10095:10095 -it --privileged=true \ + -v $PWD/funasr-runtime-resources/models:/workspace/models \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.5 +``` + +###### Server Start + +After Docker is started, start the funasr-wss-server service program: + +```shell +cd FunASR/runtime +nohup bash run_server.sh \ + --download-model-dir /workspace/models \ + --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ + --punc-dir damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx \ + --lm-dir damo/speech_ngram_lm_zh-cn-ai-wesp-fst \ + --itn-dir thuduj12/fst_itn_zh \ + --hotword /workspace/models/hotwords.txt > log.txt 2>&1 & + +# If you want to disable SSL, add the parameter: --certfile 0 +# If you want to use timestamp or nn hotword models for deployment, please set --model-dir to the corresponding model: +# damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx (timestamp) +# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx (nn hotword) +# If you want to load hotwords on the server side, please configure the hotwords in the host machine file ./funasr-runtime-resources/models/hotwords.txt (docker mapping address is /workspace/models/hotwords.txt): +# One hotword per line, format (hotword weight): Alibaba 20 +``` + +##### Client Testing + +Testing [samples](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz) +```shell +python3 funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav" +``` + +For more examples, please refer to [docs](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline.md) + diff --git a/runtime/quick_start_zh.md b/runtime/quick_start_zh.md new file mode 100644 index 0000000..5566020 --- /dev/null +++ b/runtime/quick_start_zh.md @@ -0,0 +1,132 @@ +(简体中文|[English](./quick_start.md)) + + +## 快速开始 + +您可以通过如下几种方式使用FunASR功能: + +- 服务部署社区软件包 +- 工业模型egs +- 学术模型egs + +### 服务部署社区软件包 + +#### python版本示例 + +支持实时流式语音识别,并且会用非流式模型进行纠错,输出文本带有标点。目前只支持单个client,如需多并发请参考下方c++版本服务部署SDK + +##### 服务端部署 +```shell +cd runtime/python/websocket +python funasr_wss_server.py --port 10095 +``` + +##### 客户端测试 +```shell +python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass --chunk_size "5,10,5" +#python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass --chunk_size "8,8,4" --audio_in "./data/wav.scp" +``` +更多例子可以参考([点击此处](../runtime/python/websocket/README.md)) + + +#### 服务部署软件包 + +既可以进行高精度、高效率与高并发的文件转写,也可以进行低延时的实时语音听写。支持Docker化部署,多路请求。 + +##### 准备工作:docker安装(可选) +###### 如果您已安装docker,忽略本步骤 + +```shell +curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh; +sudo bash install_docker.sh +``` + +##### 实时语音听写服务部署 + +###### docker镜像下载与启动 +通过下述命令拉取并启动FunASR软件包docker镜像([获取最新镜像版本](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online_zh.md)): + +```shell +sudo docker pull \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.10 +mkdir -p ./funasr-runtime-resources/models +sudo docker run -p 10096:10095 -it --privileged=true \ + -v $PWD/funasr-runtime-resources/models:/workspace/models \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.10 +``` + +###### 服务端启动 +docker启动之后,启动 funasr-wss-server-2pass服务程序: +```shell +cd FunASR/runtime +nohup bash run_server_2pass.sh \ + --download-model-dir /workspace/models \ + --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ + --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx \ + --punc-dir damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx \ + --itn-dir thuduj12/fst_itn_zh \ + --hotword /workspace/models/hotwords.txt > log.txt 2>&1 & + +# 如果您想关闭ssl,增加参数:--certfile 0 +# 如果您想使用时间戳或者nn热词模型进行部署,请设置--model-dir为对应模型: +# damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx(时间戳) +# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx(nn热词) +# 如果您想在服务端加载热词,请在宿主机文件./funasr-runtime-resources/models/hotwords.txt配置热词(docker映射地址为/workspace/models/hotwords.txt): +# 每行一个热词,格式(热词 权重):阿里巴巴 20 +``` + +##### 客户端测试与使用 +客户端测试([samples](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz)) + +```shell +python3 funasr_wss_client.py --host "127.0.0.1" --port 10096 --mode 2pass +``` +更多例子参考([点击此处](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online_zh.md)) + +##### 离线文件转写服务部署 + +###### 镜像启动 + +通过下述命令拉取并启动FunASR软件包docker镜像([获取最新镜像版本](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline_zh.md)): + +```shell +sudo docker pull \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.5 +mkdir -p ./funasr-runtime-resources/models +sudo docker run -p 10095:10095 -it --privileged=true \ + -v $PWD/funasr-runtime-resources/models:/workspace/models \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.5 +``` + +###### 服务端启动 + +docker启动之后,启动 funasr-wss-server服务程序: +```shell +cd FunASR/runtime +nohup bash run_server.sh \ + --download-model-dir /workspace/models \ + --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ + --punc-dir damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx \ + --lm-dir damo/speech_ngram_lm_zh-cn-ai-wesp-fst \ + --itn-dir thuduj12/fst_itn_zh \ + --hotword /workspace/models/hotwords.txt > log.txt 2>&1 & + +# 如果您想关闭ssl,增加参数:--certfile 0 +# 如果您想使用时间戳或者nn热词模型进行部署,请设置--model-dir为对应模型: +# damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx(时间戳) +# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx(nn热词) +# 如果您想在服务端加载热词,请在宿主机文件./funasr-runtime-resources/models/hotwords.txt配置热词(docker映射地址为/workspace/models/hotwords.txt): +# 每行一个热词,格式(热词 权重):阿里巴巴 20 +``` + +###### 客户端测试 +客户端测试([samples](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz)) +```shell +python3 funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav" +``` +更多例子参考([点击此处](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline_zh.md)) + + + diff --git a/runtime/readme.md b/runtime/readme.md new file mode 100644 index 0000000..28a063d --- /dev/null +++ b/runtime/readme.md @@ -0,0 +1,98 @@ +# FunASR Runtime Roadmap +中文文档([点击此处](./readme_cn.md)) + +FunASR is a speech recognition framework developed by the Speech Lab of DAMO Academy, which integrates industrial-level models in the fields of speech endpoint detection, speech recognition, punctuation segmentation, and more. +It has attracted many developers to participate in experiencing and developing. To solve the last mile of industrial landing and integrate models into business, we have developed the FunASR runtime-SDK. The SDK supports several service deployments, including: + +- File transcription service, Mandarin, CPU version, done +- The real-time transcription service, Mandarin (CPU), done +- File transcription service, English, CPU version, done +- File transcription service, Mandarin, GPU version, in progress +- and more. + +## File Transcription Service, English (CPU) + +Currently, the FunASR runtime-SDK supports the deployment of file transcription service, English (CPU version), with a complete speech recognition chain that can transcribe tens of hours of audio into punctuated text, and supports recognition for more than a hundred concurrent streams. + +To meet the needs of different users, we have prepared different tutorials with text and images for both novice and advanced developers. + +### Whats-new +- 2024/05/15: Adapting to FunASR 1.0 model structure, docker image version funasr-runtime-sdk-en-cpu-0.1.6 (84d781d07997). +- 2024/03/05: docker image supports ARM64 platform, update modelscope, docker image version funasr-runtime-sdk-en-cpu-0.1.5 (7cca2abc5901). +- 2024/01/25: Optimized the VAD (Voice Activity Detection) data processing method,significantly reducing peak memory usage,memory leak optimization, docker image version funasr-runtime-sdk-en-cpu-0.1.3 (c00f9ce7a195). +- 2024/01/03: Fixed known crash issues as well as memory leak problems, docker image version funasr-runtime-sdk-en-cpu-0.1.2 (0cdd9f4a4bb5). +- 2023/11/08: Adaptation to runtime structure changes (FunASR/funasr/runtime -> FunASR/runtime), docker image version funasr-runtime-sdk-en-cpu-0.1.1 (27017f70f72a). +- 2023/10/16: English File Transcription Service 1.0 released, docker image version funasr-runtime-sdk-en-cpu-0.1.0 (e0de03eb0163), refer to the detailed documentation([here](https://mp.weixin.qq.com/s/DZZUTj-6xwFfi-96ml--4A)) + +### Technical Principles + +The technical principles and documentation behind FunASR explain the underlying technology, recognition accuracy, computational efficiency, and core advantages of the framework, including convenience, high precision, high efficiency, and support for long audio chains. For detailed information, please refer to the documentation available by [docs](https://mp.weixin.qq.com/s/DZZUTj-6xwFfi-96ml--4A). + +### Deployment Tutorial + +The documentation mainly targets novice users who have no need for modifications or customization. It supports downloading model deployments from modelscope and also supports deploying models that users have fine-tuned. For detailed tutorials, please refer to [docs](docs/SDK_tutorial_en.md). + +### Advanced Development Guide + +The documentation mainly targets advanced developers who require modifications and customization of the service. It supports downloading model deployments from modelscope and also supports deploying models that users have fine-tuned. For detailed information, please refer to the documentation available by [docs](./docs/SDK_advanced_guide_offline_en.md) + + +## The real-time transcription service, Mandarin (CPU) + +The FunASR real-time speech-to-text service software package not only performs real-time speech-to-text conversion, but also allows high-precision transcription text correction at the end of each sentence and outputs text with punctuation, supporting high-concurrency multiple requests. +In order to meet the needs of different users for different scenarios, different tutorials are prepared: + +### Whats-new +- 2024/05/15: Real-time Transcription Service 1.10 released,adapting to FunASR 1.0 model structure, docker image version funasr-runtime-sdk-online-cpu-0.1.10 (1c2adfcff84d) +- 2024/03/05: Real-time Transcription Service 1.9 released,docker image supports ARM64 platform, update modelscope, docker image version funasr-runtime-sdk-online-cpu-0.1.9 (4a875e08c7a2) +- 2024/01/25: Real-time Transcription Service 1.7 released,optimization of the client-side, docker image version funasr-runtime-sdk-online-cpu-0.1.7 (2aa23805572e) +- 2024/01/03: Real-time Transcription Service 1.6 released,The 2pass-offline mode supports Ngram language model decoding and WFST hotwords, while also addressing known crash issues and memory leak problems, docker image version funasr-runtime-sdk-online-cpu-0.1.6 (f99925110d27) +- 2023/11/09: Real-time Transcription Service 1.5 released,fix bug: without online results, docker image version funasr-runtime-sdk-online-cpu-0.1.5 (b16584b6d38b) +- 2023/11/08: Real-time Transcription Service 1.4 released, supporting server-side loading of hotwords (updated hotword communication protocol), adaptation to runtime structure changes (FunASR/funasr/runtime -> FunASR/runtime), docker image version funasr-runtime-sdk-online-cpu-0.1.4(691974017c38). +- 2023/09/19: Real-time Transcription Service 1.2 released, supporting hotwords, timestamps, and ITN model in 2pass mode, docker image version funasr-runtime-sdk-online-cpu-0.1.2 (7222c5319bcf). +- 2023/08/11: Real-time Transcription Service 1.1 released, addressing some known bugs (including server crashes), docker image version funasr-runtime-sdk-online-cpu-0.1.1 (bdbdd0b27dee). +- 2023/08/07: Real-time Transcription Service 1.0 released, docker image version funasr-runtime-sdk-online-cpu-0.1.0(bdbdd0b27dee), refer to the detailed documentation([here](https://mp.weixin.qq.com/s/8He081-FM-9IEI4D-lxZ9w)) + +### Convenient Deployment Tutorial + +This is suitable for scenarios where there is no need to modify the service deployment SDK and the deployed model comes from ModelScope or is finetuned by the user. For detailed tutorials, please refer to [docs](./docs/SDK_tutorial_online.md) + + +### Development Guide + +This is suitable for scenarios where there is a need to modify the service deployment SDK and the deployed model comes from ModelScope or is finetuned by the user. For detailed documentation, please refer to [docs](./docs/SDK_advanced_guide_online.md) + +### Technology Principles Revealed + +The document introduces the technology principles behind the service, recognition accuracy, computing efficiency, and core advantages: convenience, high precision, high efficiency, and long audio chain. For detailed documentation, please refer to [docs](https://mp.weixin.qq.com/s/8He081-FM-9IEI4D-lxZ9w). + + +## File Transcription Service, Mandarin (CPU) + +Currently, the FunASR runtime-SDK supports the deployment of file transcription service, Mandarin (CPU version), with a complete speech recognition chain that can transcribe tens of hours of audio into punctuated text, and supports recognition for more than a hundred concurrent streams. + +To meet the needs of different users, we have prepared different tutorials with text and images for both novice and advanced developers. + +### Whats-new +- 2024/05/15: File Transcription Service 4.5 released, adapting to FunASR 1.0 model structure, docker image version funasr-runtime-sdk-cpu-0.4.5 (058b9882ae67) +- 2024/03/05: File Transcription Service 4.4 released, docker image supports ARM64 platform, update modelscope, docker image version funasr-runtime-sdk-cpu-0.4.4 (2dc87b86dc49) +- 2024/01/25: File Transcription Service 4.2 released, optimized the VAD (Voice Activity Detection) data processing method, significantly reducing peak memory usage, memory leak optimization, docker image version funasr-runtime-sdk-cpu-0.4.2 (befdc7b179ed) +- 2024/01/08: File Transcription Service 4.1 released, optimized format sentence-level timestamps, docker image version funasr-runtime-sdk-cpu-0.4.1 (0250f8ef981b) +- 2024/01/03: File Transcription Service 4.0 released, Added support for 8k models, optimized timestamp mismatch issues and added sentence-level timestamps, improved the effectiveness of English word FST hotwords, supported automated configuration of thread parameters, and fixed known crash issues as well as memory leak problems, docker image version funasr-runtime-sdk-cpu-0.4.0 (c4483ee08f04) +- 2023/11/08: File Transcription Service 3.0 released, supporting punctuation large model, Ngram model, fst hotwords (updated hotword communication protocol), server-side loading of hotwords, adaptation to runtime structure changes (FunASR/funasr/runtime -> FunASR/runtime), docker image version funasr-runtime-sdk-cpu-0.3.0 (caa64bddbb43), refer to the detailed documentation ([here]()) +- 2023/09/19: File Transcription Service 2.2 released, supporting ITN model, docker image version funasr-runtime-sdk-cpu-0.2.2 (2c5286be13e9). +- 2023/08/22: File Transcription Service 2.0 released, integrated ffmpeg to support various audio and video inputs, supporting hotword model and timestamp model, docker image version funasr-runtime-sdk-cpu-0.2.0 (1ad3d19e0707), refer to the detailed documentation ([here](https://mp.weixin.qq.com/s/oJHe0MKDqTeuIFH-F7GHMg)) +- 2023/07/03: File Transcription Service 1.0 released, docker image version funasr-runtime-sdk-cpu-0.1.0 (1ad3d19e0707), refer to the detailed documentation ([here](https://mp.weixin.qq.com/s/DHQwbgdBWcda0w_L60iUww)) + +### Technical Principles + +The technical principles and documentation behind FunASR explain the underlying technology, recognition accuracy, computational efficiency, and core advantages of the framework, including convenience, high precision, high efficiency, and support for long audio chains. For detailed information, please refer to the documentation available by [docs](https://mp.weixin.qq.com/s/DHQwbgdBWcda0w_L60iUww). + +### Deployment Tutorial + +The documentation mainly targets novice users who have no need for modifications or customization. It supports downloading model deployments from modelscope and also supports deploying models that users have fine-tuned. For detailed tutorials, please refer to [docs](docs/SDK_tutorial.md). + +### Advanced Development Guide + +The documentation mainly targets advanced developers who require modifications and customization of the service. It supports downloading model deployments from modelscope and also supports deploying models that users have fine-tuned. For detailed information, please refer to the documentation available by [docs](./docs/SDK_advanced_guide_offline.md) + diff --git a/runtime/readme_cn.md b/runtime/readme_cn.md new file mode 100644 index 0000000..9cb7b58 --- /dev/null +++ b/runtime/readme_cn.md @@ -0,0 +1,77 @@ +# FunASR软件包路线图 + +English Version([docs](./readme.md)) + +FunASR是由阿里巴巴通义实验室语音团队开源的一款语音识别基础框架,集成了语音端点检测、语音识别、标点断句等领域的工业级别模型,吸引了众多开发者参与体验和开发。为了解决工业落地的最后一公里,将模型集成到业务中去,我们开发了社区软件包。 +支持以下几种服务部署: + + + +- 中文离线文件转写服务(CPU版本),已完成 +- 中文流式语音识别服务(CPU版本),已完成 +- 英文离线文件转写服务(CPU版本),已完成 +- 中文离线文件转写服务(GPU版本),进行中 +- 更多支持中 + +## 英文离线文件转写服务(CPU版本) + +英文离线文件转写服务部署(CPU版本),拥有完整的语音识别链路,可以将几十个小时的长音频与视频识别成带标点的文字,而且支持上百路请求同时进行转写。 +为了支持不同用户的需求,针对不同场景,准备了不同的图文教程: + +### 最新动态 +- 2024/05/15: 英文离线文件转写服务 1.6 发布,适配FunASR 1.0模型结构,dokcer镜像版本funasr-runtime-sdk-en-cpu-0.1.6 (84d781d07997) +- 2024/03/05: 英文离线文件转写服务 1.5 发布,docker镜像支持arm64平台,升级modelscope版本,dokcer镜像版本funasr-runtime-sdk-en-cpu-0.1.5 (7cca2abc5901) +- 2024/01/25: 英文离线文件转写服务 1.3 发布,优化vad数据处理方式,大幅降低峰值内存占用,内存泄漏优化,dokcer镜像版本funasr-runtime-sdk-en-cpu-0.1.3 (c00f9ce7a195) +- 2024/01/03: 英文离线文件转写服务 1.2 发布,修复已知的crash问题及内存泄漏问题,dokcer镜像版本funasr-runtime-sdk-en-cpu-0.1.2 (0cdd9f4a4bb5) +- 2023/11/08: 英文离线文件转写服务 1.1 发布,runtime结构变化适配(FunASR/funasr/runtime->FunASR/runtime),dokcer镜像版本funasr-runtime-sdk-en-cpu-0.1.1 (27017f70f72a) +- 2023/10/16: 英文离线文件转写服务 1.0 发布,dokcer镜像版本funasr-runtime-sdk-en-cpu-0.1.0 (e0de03eb0163),原理介绍文档([点击此处](https://mp.weixin.qq.com/s/DZZUTj-6xwFfi-96ml--4A)) + + +### 部署与开发文档 + +部署模型来自于ModelScope,或者用户finetune,支持用户定制服务,详细文档参考([点击此处](./docs/SDK_advanced_guide_offline_en_zh.md)) + + +## 中文实时语音听写服务(CPU版本) +FunASR实时语音听写服务软件包,既可以实时地进行语音转文字,而且能够在说话句尾用高精度的转写文字修正输出,输出文字带有标点,支持高并发多路请求。 +为了支持不同用户的需求,针对不同场景,准备了不同的图文教程: + +### 最新动态 +- 2024/05/15: 中文实时语音听写服务 1.10 发布,适配FunASR 1.0模型结构,dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.10 (1c2adfcff84d) +- 2024/03/05: 中文实时语音听写服务 1.9 发布,docker镜像支持arm64平台,升级modelscope版本,dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.9 (4a875e08c7a2) +- 2024/01/25: 中文实时语音听写服务 1.7 发布,客户端优化,dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.7 (2aa23805572e) +- 2024/01/03: 中文实时语音听写服务 1.6 发布,2pass-offline模式支持Ngram语言模型解码、wfst热词,同时修复已知的crash问题及内存泄漏问题,dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.6 (f99925110d27) +- 2023/11/09: 中文实时语音听写服务 1.5 发布,修复无实时结果的问题,dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.5 (b16584b6d38b) +- 2023/11/08: 中文实时语音听写服务 1.4 发布,支持服务端加载热词(更新热词通信协议)、runtime结构变化适配(FunASR/funasr/runtime->FunASR/runtime),dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.4 (691974017c38) +- 2023/09/19: 中文实时语音听写服务 1.2 发布,2pass模式支持热词、时间戳、ITN模型,dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.2 (7222c5319bcf) +- 2023/08/11: 中文实时语音听写服务 1.1 发布,修复了部分已知的bug(包括server崩溃等),dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.1 (bdbdd0b27dee) +- 2023/08/07: 中文实时语音听写服务 1.0 发布,dokcer镜像版本funasr-runtime-sdk-online-cpu-0.1.0 (bdbdd0b27dee),原理介绍文档([点击此处](https://mp.weixin.qq.com/s/8He081-FM-9IEI4D-lxZ9w)) + + +### 部署与开发文档 + +部署模型来自于ModelScope,或者用户finetune,支持用户定制服务,详细文档参考([点击此处](./docs/SDK_advanced_guide_online_zh.md)) + + + +## 中文离线文件转写服务(CPU版本) + +中文语音离线文件服务部署(CPU版本),拥有完整的语音识别链路,可以将几十个小时的长音频与视频识别成带标点的文字,而且支持上百路请求同时进行转写。 +为了支持不同用户的需求,针对不同场景,准备了不同的图文教程: + +### 最新动态 +- 2024/05/15: 中文离线文件转写服务 4.5 发布,适配FunASR 1.0模型结构,dokcer镜像版本funasr-runtime-sdk-cpu-0.4.5 (058b9882ae67) +- 2024/03/05: 中文离线文件转写服务 4.4 发布,docker镜像支持arm64平台,升级modelscope版本,dokcer镜像版本funasr-runtime-sdk-cpu-0.4.4 (2dc87b86dc49) +- 2024/01/25: 中文离线文件转写服务 4.2 发布,优化vad数据处理方式,大幅降低峰值内存占用,内存泄漏优化,dokcer镜像版本funasr-runtime-sdk-cpu-0.4.2 (befdc7b179ed) +- 2024/01/08: 中文离线文件转写服务 4.1 发布,优化句子级时间戳json格式,dokcer镜像版本funasr-runtime-sdk-cpu-0.4.1 (0250f8ef981b) +- 2024/01/03: 中文离线文件转写服务 4.0 发布,新增支持8k模型、优化时间戳不匹配问题及增加句子级别时间戳、优化英文单词fst热词效果、支持自动化配置线程参数,同时修复已知的crash问题及内存泄漏问题,dokcer镜像版本funasr-runtime-sdk-cpu-0.4.0 (c4483ee08f04) +- 2023/11/08: 中文离线文件转写服务 3.0 发布,支持标点大模型、支持Ngram模型、支持fst热词(更新热词通信协议)、支持服务端加载热词、runtime结构变化适配(FunASR/funasr/runtime->FunASR/runtime),dokcer镜像版本funasr-runtime-sdk-cpu-0.3.0 (caa64bddbb43),原理介绍文档([点击此处](https://mp.weixin.qq.com/s/jSbnKw_m31BUUbTukPSOIw)) +- 2023/09/19: 中文离线文件转写服务 2.2 发布,支持ITN模型,dokcer镜像版本funasr-runtime-sdk-cpu-0.2.2 (2c5286be13e9) +- 2023/08/22: 中文离线文件转写服务 2.0 发布,集成ffmpeg支持多种音视频输入、支持热词模型、支持时间戳模型,dokcer镜像版本funasr-runtime-sdk-cpu-0.2.0 (1ad3d19e0707),原理介绍文档([点击此处](https://mp.weixin.qq.com/s/oJHe0MKDqTeuIFH-F7GHMg)) +- 2023/07/03: 中文离线文件转写服务 1.0 发布,dokcer镜像版本funasr-runtime-sdk-cpu-0.1.0 (1ad3d19e0707),原理介绍文档([点击此处](https://mp.weixin.qq.com/s/DHQwbgdBWcda0w_L60iUww)) + +### 部署与开发文档 + +部署模型来自于ModelScope,或者用户finetune,支持用户定制服务,详细文档参考([点击此处](./docs/SDK_advanced_guide_offline_zh.md)) + + diff --git a/runtime/run_server.sh b/runtime/run_server.sh new file mode 100644 index 0000000..22907ab --- /dev/null +++ b/runtime/run_server.sh @@ -0,0 +1,42 @@ + +download_model_dir="/workspace/models" +model_dir="damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx" +vad_dir="damo/speech_fsmn_vad_zh-cn-16k-common-onnx" +punc_dir="damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx" +itn_dir="thuduj12/fst_itn_zh" +lm_dir="damo/speech_ngram_lm_zh-cn-ai-wesp-fst" +port=10095 +certfile="$(pwd)/ssl_key/server.crt" +keyfile="$(pwd)/ssl_key/server.key" +hotword="$(pwd)/websocket/hotwords.txt" +# set decoder_thread_num +decoder_thread_num=$(cat /proc/cpuinfo | grep "processor"|wc -l) || { echo "Get cpuinfo failed. Set decoder_thread_num = 32"; decoder_thread_num=32; } +multiple_io=16 +io_thread_num=$(( (decoder_thread_num + multiple_io - 1) / multiple_io )) +model_thread_num=1 +cmd_path=/workspace/FunASR/runtime/websocket/build/bin +cmd=funasr-wss-server + +. ./tools/utils/parse_options.sh || exit 1; + +if [ -z "$certfile" ] || [ "$certfile" = "0" ]; then + certfile="" + keyfile="" +fi + +cd $cmd_path +$cmd_path/${cmd} \ + --download-model-dir "${download_model_dir}" \ + --model-dir "${model_dir}" \ + --vad-dir "${vad_dir}" \ + --punc-dir "${punc_dir}" \ + --itn-dir "${itn_dir}" \ + --lm-dir "${lm_dir}" \ + --decoder-thread-num ${decoder_thread_num} \ + --model-thread-num ${model_thread_num} \ + --io-thread-num ${io_thread_num} \ + --port ${port} \ + --certfile "${certfile}" \ + --keyfile "${keyfile}" \ + --hotword "${hotword}" & + diff --git a/runtime/run_server_2pass.sh b/runtime/run_server_2pass.sh new file mode 100644 index 0000000..bb33171 --- /dev/null +++ b/runtime/run_server_2pass.sh @@ -0,0 +1,44 @@ + +download_model_dir="/workspace/models" +model_dir="damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx" +online_model_dir="damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx" +vad_dir="damo/speech_fsmn_vad_zh-cn-16k-common-onnx" +punc_dir="damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx" +itn_dir="thuduj12/fst_itn_zh" +lm_dir="damo/speech_ngram_lm_zh-cn-ai-wesp-fst" +port=10095 +certfile="$(pwd)/ssl_key/server.crt" +keyfile="$(pwd)/ssl_key/server.key" +hotword="$(pwd)/websocket/hotwords.txt" +# set decoder_thread_num +decoder_thread_num=$(cat /proc/cpuinfo | grep "processor"|wc -l) || { echo "Get cpuinfo failed. Set decoder_thread_num = 32"; decoder_thread_num=32; } +multiple_io=16 +io_thread_num=$(( (decoder_thread_num + multiple_io - 1) / multiple_io )) +model_thread_num=1 +cmd_path=/workspace/FunASR/runtime/websocket/build/bin +cmd=funasr-wss-server-2pass + +. ./tools/utils/parse_options.sh || exit 1; + +if [ -z "$certfile" ] || [ "$certfile" = "0" ]; then + certfile="" + keyfile="" +fi + +cd $cmd_path +$cmd_path/${cmd} \ + --download-model-dir "${download_model_dir}" \ + --model-dir "${model_dir}" \ + --online-model-dir "${online_model_dir}" \ + --vad-dir "${vad_dir}" \ + --punc-dir "${punc_dir}" \ + --itn-dir "${itn_dir}" \ + --lm-dir "${lm_dir}" \ + --decoder-thread-num ${decoder_thread_num} \ + --model-thread-num ${model_thread_num} \ + --io-thread-num ${io_thread_num} \ + --port ${port} \ + --certfile "${certfile}" \ + --keyfile "${keyfile}" \ + --hotword "${hotword}" & + diff --git a/runtime/ssl_key/readme.md b/runtime/ssl_key/readme.md new file mode 100644 index 0000000..8a48dd3 --- /dev/null +++ b/runtime/ssl_key/readme.md @@ -0,0 +1,17 @@ +## certificate generation by yourself +generated certificate may not suitable for all browsers due to security concerns. you'd better buy or download an authenticated ssl certificate from authorized agency. + +```shell +### 1) Generate a private key +openssl genrsa -des3 -out server.key 2048 + +### 2) Generate a csr file +openssl req -new -key server.key -out server.csr + +### 3) Remove pass +cp server.key server.key.org +openssl rsa -in server.key.org -out server.key + +### 4) Generated a crt file, valid for 1 year +openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt +``` diff --git a/runtime/ssl_key/readme_cn.md b/runtime/ssl_key/readme_cn.md new file mode 100644 index 0000000..eeadef4 --- /dev/null +++ b/runtime/ssl_key/readme_cn.md @@ -0,0 +1,17 @@ +## 自行生成证书 +生成证书(注意这种证书并不能被所有浏览器认可,部分手动授权可以访问,最好使用其他认证的官方ssl证书) + +```shell +### 1)生成私钥,按照提示填写内容 +openssl genrsa -des3 -out server.key 1024 + +### 2)生成csr文件 ,按照提示填写内容 +openssl req -new -key server.key -out server.csr + +### 去掉pass +cp server.key server.key.org +openssl rsa -in server.key.org -out server.key + +### 生成crt文件,有效期1年(365天) +openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt +``` diff --git a/runtime/ssl_key/server.crt b/runtime/ssl_key/server.crt new file mode 100644 index 0000000..5a5079d --- /dev/null +++ b/runtime/ssl_key/server.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDhTCCAm0CFGB0Po2IZ0hESavFpcSGRNb9xrNXMA0GCSqGSIb3DQEBCwUAMH8x +CzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdiZWlqaW5nMRAwDgYDVQQHDAdiZWlqaW5n +MRAwDgYDVQQKDAdhbGliYWJhMRAwDgYDVQQLDAdhbGliYWJhMRAwDgYDVQQDDAdh +bGliYWJhMRYwFAYJKoZIhvcNAQkBFgdhbGliYWJhMB4XDTIzMDYxODA2NTcxM1oX +DTI0MDYxNzA2NTcxM1owfzELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB2JlaWppbmcx +EDAOBgNVBAcMB2JlaWppbmcxEDAOBgNVBAoMB2FsaWJhYmExEDAOBgNVBAsMB2Fs +aWJhYmExEDAOBgNVBAMMB2FsaWJhYmExFjAUBgkqhkiG9w0BCQEWB2FsaWJhYmEw +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDH9Np1oBunQKMt5M/nU2nD +qVHojXwKKwyiK9DSeGikKwArH2S9NUZNu5RDg46u0iWmT+Vz+toQhkJnfatOVskW +f2bsI54n5eOvmoWOKDXYm2MscvjkuNiYRbqzgUuP9ZSx8k3uyRs++wvmwIoU+PV1 +EYFcjk1P2jUGUvKaUlmIDsjs1wOMIbKO6I0UX20FNKlGWacqMR/Dx2ltmGKT1Kaz +Y335lor0bcfQtH542rGS7PDz6JMRNjFT1VFcmnrjRElf4STbaOiIfOjMVZ/9O8Hr +LFItyvkb01Mt7O0jhAXHuE1l/8Y0N3MCYkELG9mQA0BYCFHY0FLuJrGoU03b8KWj +AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAEjC9jB1WZe2ki2JgCS+eAMFsFegiNEz +D0klVB3kiCPK0g7DCxvfWR6kAgEynxRxVX6TN9QcLr4paZItC1Fu2gUMTteNqEuc +dcixJdu9jumuUMBlAKgL5Yyk3alSErsn9ZVF/Q8Kx5arMO/TW3Ulsd8SWQL5C/vq +Fe0SRhpKKoADPfl8MT/XMfB/MwNxVhYDSHzJ1EiN8O5ce6q2tTdi1mlGquzNxhjC +7Q0F36V1HksfzolrlRWRKYP16isnaKUdFfeAzaJsYw33o6VRbk6fo2fTQDHS0wOs +Q48Moc5UxKMLaMMCqLPpWu0TZse+kIw1nTWXk7yJtK0HK5PN3rTocEw= +-----END CERTIFICATE----- diff --git a/runtime/ssl_key/server.key b/runtime/ssl_key/server.key new file mode 100644 index 0000000..8efdcb8 --- /dev/null +++ b/runtime/ssl_key/server.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAx/TadaAbp0CjLeTP51Npw6lR6I18CisMoivQ0nhopCsAKx9k +vTVGTbuUQ4OOrtIlpk/lc/raEIZCZ32rTlbJFn9m7COeJ+Xjr5qFjig12JtjLHL4 +5LjYmEW6s4FLj/WUsfJN7skbPvsL5sCKFPj1dRGBXI5NT9o1BlLymlJZiA7I7NcD +jCGyjuiNFF9tBTSpRlmnKjEfw8dpbZhik9Sms2N9+ZaK9G3H0LR+eNqxkuzw8+iT +ETYxU9VRXJp640RJX+Ek22joiHzozFWf/TvB6yxSLcr5G9NTLeztI4QFx7hNZf/G +NDdzAmJBCxvZkANAWAhR2NBS7iaxqFNN2/ClowIDAQABAoIBAQC1/STX6eFBWJMs +MhUHdePNMU5bWmqK1qOo9jgZV33l7T06Alit3M8f8JoA2LwEYT/jHtS3upi+cXP+ +vWIs6tAaqdoDEmff6FxSd1EXEYHwo3yf+ASQJ6z66nwC5KrhW6L6Uo6bxm4F5Hfw +jU0fyXeeFVCn7Nxw0SlxmA02Z70VFsL8BK9i3kajU18y6drf4VUm55oMEtdEmOh2 +eKn4qspBcNblbw+L0QJ+5kN1iRUyJHesQ1GpS+L3yeMVFCW7ctL4Bgw8Z7LE+z7i +C0Weyhul8vuT+7nfF2T37zsSa8iixqpkTokeYh96CZ5nDqa2IDx3oNHWSlkIsV6g +6EUEl9gBAoGBAPIw/M6fIDetMj8f1wG7mIRgJsxI817IS6aBSwB5HkoCJFfrR9Ua +jMNCFIWNs/Om8xeGhq/91hbnCYDNK06V5CUa/uk4CYRs2eQZ3FKoNowtp6u/ieuU +qg8bXM/vR2VWtWVixAMdouT3+KtvlgaVmSnrPiwO4pecGrwu5NW1oJCFAoGBANNb +aE3AcwTDYsqh0N/75G56Q5s1GZ6MCDQGQSh8IkxL6Vg59KnJiIKQ7AxNKFgJZMtY +zZHaqjazeHjOGTiYiC7MMVJtCcOBEfjCouIG8btNYv7Y3dWnOXRZni2telAsRrH9 +xS5LaFdCRTjVAwSsppMGwiQtyl6sGLMyz0SXoYoHAoGAKdkFFb6xFm26zOV3hTkg +9V6X1ZyVUL9TMwYMK5zB+w+7r+VbmBrqT6LPYPRHL8adImeARlCZ+YMaRUMuRHnp +3e94NFwWaOdWDu/Y/f9KzZXl7us9rZMWf12+/77cm0oMNeSG8fLg/qdKNHUneyPG +P1QCfiJkTMYQaIvBxpuHjvECgYAKlZ9JlYOtD2PZJfVh4il0ZucP1L7ts7GNeWq1 +7lGBZKPQ6UYZYqBVeZB4pTyJ/B5yGIZi8YJoruAvnJKixPC89zjZGeDNS59sx8KE +cziT2rJEdPPXCULVUs+bFf70GOOJcl33jYsyI3139SLrjwHghwwd57UkvJWYE8lR +dA6A7QKBgEfTC+NlzqLPhbB+HPl6CvcUczcXcI9M0heVz/DNMA+4pjxPnv2aeIwh +cL2wq2xr+g1wDBWGVGkVSuZhXm5E6gDetdyVeJnbIUhVjBblnbhHV6GrudjbXGnJ +W9cBgu6DswyHU2cOsqmimu8zLmG6/dQYFHt+kUWGxN8opCzVjgWa +-----END RSA PRIVATE KEY----- diff --git a/runtime/tools/fst/add_lex_disambig.pl b/runtime/tools/fst/add_lex_disambig.pl new file mode 100644 index 0000000..803e7f6 --- /dev/null +++ b/runtime/tools/fst/add_lex_disambig.pl @@ -0,0 +1,118 @@ +#!/usr/bin/perl +# Copyright 2010-2011 Microsoft Corporation +# 2013 Johns Hopkins University (author: Daniel Povey) + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# Adds disambiguation symbols to a lexicon. +# Outputs still in the normal lexicon format. +# Disambig syms are numbered #1, #2, #3, etc. (#0 +# reserved for symbol in grammar). +# Outputs the number of disambig syms to the standard output. +# With the --pron-probs option, expects the second field +# of each lexicon line to be a pron-prob. + +$pron_probs = 0; + +if ($ARGV[0] eq "--pron-probs") { + $pron_probs = 1; + shift @ARGV; +} + +if(@ARGV != 2) { + die "Usage: add_lex_disambig.pl [--pron-probs] lexicon.txt lexicon_disambig.txt " +} + + +$lexfn = shift @ARGV; +$lexoutfn = shift @ARGV; + +open(L, "<$lexfn") || die "Error opening lexicon $lexfn"; + +# (1) Read in the lexicon. +@L = ( ); +while() { + @A = split(" ", $_); + push @L, join(" ", @A); +} + +# (2) Work out the count of each phone-sequence in the +# lexicon. + +foreach $l (@L) { + @A = split(" ", $l); + shift @A; # Remove word. + if ($pron_probs) { + $p = shift @A; + if (!($p > 0.0 && $p <= 1.0)) { die "Bad lexicon line $l (expecting pron-prob as second field)"; } + } + $count{join(" ",@A)}++; +} + +# (3) For each left sub-sequence of each phone-sequence, note down +# that exists (for identifying prefixes of longer strings). + +foreach $l (@L) { + @A = split(" ", $l); + shift @A; # Remove word. + if ($pron_probs) { shift @A; } # remove pron-prob. + while(@A > 0) { + pop @A; # Remove last phone + $issubseq{join(" ",@A)} = 1; + } +} + +# (4) For each entry in the lexicon: +# if the phone sequence is unique and is not a +# prefix of another word, no diambig symbol. +# Else output #1, or #2, #3, ... if the same phone-seq +# has already been assigned a disambig symbol. + + +open(O, ">$lexoutfn") || die "Opening lexicon file $lexoutfn for writing.\n"; + +$max_disambig = 0; +foreach $l (@L) { + @A = split(" ", $l); + $word = shift @A; + if ($pron_probs) { $pron_prob = shift @A; } + $phnseq = join(" ",@A); + if(!defined $issubseq{$phnseq} + && $count{$phnseq} == 1) { + ; # Do nothing. + } else { + if($phnseq eq "") { # need disambig symbols for the empty string + # that are not use anywhere else. + $max_disambig++; + $reserved{$max_disambig} = 1; + $phnseq = "#$max_disambig"; + } else { + $curnumber = $disambig_of{$phnseq}; + if(!defined{$curnumber}) { $curnumber = 0; } + $curnumber++; # now 1 or 2, ... + while(defined $reserved{$curnumber} ) { $curnumber++; } # skip over reserved symbols + if($curnumber > $max_disambig) { + $max_disambig = $curnumber; + } + $disambig_of{$phnseq} = $curnumber; + $phnseq = $phnseq . " #" . $curnumber; + } + } + if ($pron_probs) { print O "$word\t$pron_prob\t$phnseq\n"; } + else { print O "$word\t$phnseq\n"; } +} + +print $max_disambig . "\n"; + diff --git a/runtime/tools/fst/collect_resource_file.sh b/runtime/tools/fst/collect_resource_file.sh new file mode 100644 index 0000000..cb533bb --- /dev/null +++ b/runtime/tools/fst/collect_resource_file.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Collect TLG.fst +lm_dir=$1 +tgt_dir=$2 + +tlg=${lm_dir}/lang/TLG.fst + +[ ! -f $tlg ] && echo No TLG file $tlg && exit 1; + +rm -rf $tgt_dir +mkdir -p $tgt_dir +cp -r $tlg ${tgt_dir}/TLG.fst + +# Generate configuration file +wd_file=${lm_dir}/lang/words.txt +cfg_file=${tgt_dir}/config.yaml + +[ ! -f $wd_file ] && echo No words list $wd_file && exit 1; + +cat $wd_file | awk '{print $1}' | awk ' + BEGIN { + print "token_list:"; + } + { + printf("- \"%s\"\n", $1); + } + END { + }' > $cfg_file || exit 1; + diff --git a/runtime/tools/fst/compile_dict_token.sh b/runtime/tools/fst/compile_dict_token.sh new file mode 100644 index 0000000..6a65422 --- /dev/null +++ b/runtime/tools/fst/compile_dict_token.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# Copyright 2015 Yajie Miao (Carnegie Mellon University) + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + +# This script compiles the lexicon and CTC tokens into FSTs. FST compiling slightly differs between the +# phoneme and character-based lexicons. + +. fst/parse_options.sh + +if [ $# -ne 3 ]; then + echo "usage: utils/compile_dict_token.sh " + echo "e.g.: utils/compile_dict_token.sh data/local/dict_phn data/local/lang_phn_tmp data/lang_phn" + echo " should contain the following files:" + echo "lexicon.out units.txt" + echo "options: " + exit 1; +fi + +srcdir=$1 +tmpdir=$2 +dir=$3 +mkdir -p $tmpdir $dir + +[ -f path.sh ] && . ./path.sh + +cp $srcdir/units.txt $dir + +# Add probabilities to lexicon entries. There is in fact no point of doing this here since all the entries have 1.0. +# But utils/make_lexicon_fst.pl requires a probabilistic version, so we just leave it as it is. +perl -ape 's/(\S+\s+)(.+)/${1}1.0\t$2/;' < $srcdir/lexicon.out > $tmpdir/lexiconp.txt || exit 1; + +# Add disambiguation symbols to the lexicon. This is necessary for determinizing the composition of L.fst and G.fst. +# Without these symbols, determinization will fail. +ndisambig=`fst/add_lex_disambig.pl $tmpdir/lexiconp.txt $tmpdir/lexiconp_disambig.txt` +ndisambig=$[$ndisambig+1]; + +( for n in `seq 0 $ndisambig`; do echo '#'$n; done ) > $tmpdir/disambig.list + +# Get the full list of CTC tokens used in FST. These tokens include , the blank , the actual labels (e.g., +# phonemes), and the disambiguation symbols. +cat $srcdir/units.txt | awk '{print $1}' > $tmpdir/units.list +(echo '') | cat - $tmpdir/units.list $tmpdir/disambig.list | awk '{print $1 " " (NR-1)}' > $dir/tokens.txt + +# Compile the tokens into FST +fst/ctc_token_fst.py $dir/tokens.txt | fstcompile --isymbols=$dir/tokens.txt --osymbols=$dir/tokens.txt \ + --keep_isymbols=false --keep_osymbols=false | fstarcsort --sort_type=olabel > $dir/T.fst || exit 1; + +# Encode the words with indices. Will be used in lexicon and language model FST compiling. +cat $tmpdir/lexiconp.txt | awk '{print $1}' | sort | uniq | awk ' + BEGIN { + print " 0"; + } + { + printf("%s %d\n", $1, NR); + } + END { + printf("#0 %d\n", NR+1); + printf(" %d\n", NR+2); + printf(" %d\n", NR+3); + }' > $dir/words.txt || exit 1; + +# Now compile the lexicon FST. Depending on the size of your lexicon, it may take some time. +token_disambig_symbol=`grep \#0 $dir/tokens.txt | awk '{print $2}'` +word_disambig_symbol=`grep \#0 $dir/words.txt | awk '{print $2}'` + +fst/make_lexicon_fst.pl --pron-probs $tmpdir/lexiconp_disambig.txt 0 "sil" '#'$ndisambig | \ + fstcompile --isymbols=$dir/tokens.txt --osymbols=$dir/words.txt \ + --keep_isymbols=false --keep_osymbols=false | \ + fstaddselfloops "echo $token_disambig_symbol |" "echo $word_disambig_symbol |" | \ + fstarcsort --sort_type=olabel > $dir/L.fst || exit 1; + +echo "Dict and token FSTs compiling succeeded" diff --git a/runtime/tools/fst/ctc_token_fst.py b/runtime/tools/fst/ctc_token_fst.py new file mode 100644 index 0000000..5f06e52 --- /dev/null +++ b/runtime/tools/fst/ctc_token_fst.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Apache 2.0 + +import sys + +with open(sys.argv[1], "r") as fread: + print("0 0 ") + nodeX = 1 + for entry in fread.readlines(): + entry = entry.replace("\n", "").strip() + fields = entry.split(" ") + phone = fields[0] + if phone == "" or phone == "": + continue + if "#" in phone: + print(str(0) + " " + str(0) + " " + "" + " " + phone) + else: + print(str(0) + " " + str(nodeX) + " " + phone + " " + phone) + print(str(nodeX) + " " + str(nodeX) + " " + phone + " ") + print(str(nodeX) + " " + str(0) + " " + " ") + nodeX += 1 + print("0") diff --git a/runtime/tools/fst/eps2disambig.pl b/runtime/tools/fst/eps2disambig.pl new file mode 100644 index 0000000..fecbdc8 --- /dev/null +++ b/runtime/tools/fst/eps2disambig.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# Copyright 2010-2011 Microsoft Corporation + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + +# This script replaces epsilon with #0 on the input side only, of the G.fst +# acceptor. + +while(<>){ + s:^(\d+\s+\d+\s+)\(\s+):$1#0$2:; + print; +} diff --git a/runtime/tools/fst/generate_lexicon.py b/runtime/tools/fst/generate_lexicon.py new file mode 100644 index 0000000..f8c7443 --- /dev/null +++ b/runtime/tools/fst/generate_lexicon.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# encoding: utf-8 + +import sys + +# sys.argv[1]: lm dict +# sys.argv[2]: lexicon file +# sys.argv[3]: lexicon file for corpus.dict + +lex_dict = {} +with open(sys.argv[2], "r", encoding="utf8") as fin: + for line in fin: + words = line.strip().split("\t") + if len(words) != 2: + continue + lex_dict[words[0]] = words[1] + +with open(sys.argv[1], "r", encoding="utf8") as fin, open( + sys.argv[3], "w", encoding="utf8" +) as fout: + for line in fin: + word = line.strip() + if word == "" or word == "": + continue + word_lex = "" + if word in lex_dict: + word_lex = lex_dict[word] + else: + for i in range(len(word)): + if word[i] in lex_dict: + word_lex += " " + lex_dict[word[i]] + else: + word_lex += " " + + fout.write("{}\t{}\n".format(word, word_lex.strip())) diff --git a/runtime/tools/fst/make_decode_graph.sh b/runtime/tools/fst/make_decode_graph.sh new file mode 100644 index 0000000..c89268e --- /dev/null +++ b/runtime/tools/fst/make_decode_graph.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# + +if [ -f path.sh ]; then . path.sh; fi + +lm_dir=$1 +tgt_lang=$2 + +arpa_lm=${lm_dir}/lm.arpa +[ ! -f $arpa_lm ] && echo No such file $arpa_lm && exit 1; + +# Compose the language model to FST +cat "$arpa_lm" | \ + grep -v ' ' | \ + grep -v ' ' | \ + grep -v ' ' | \ + grep -v -i '' | \ + arpa2fst --read-symbol-table=$tgt_lang/words.txt --keep-symbols=true - | fstprint | \ + fst/eps2disambig.pl | fst/s2eps.pl | fstcompile --isymbols=$tgt_lang/words.txt \ + --osymbols=$tgt_lang/words.txt --keep_isymbols=false --keep_osymbols=false | \ + fstrmepsilon | fstarcsort --sort_type=ilabel > $tgt_lang/G.fst + + +echo "Checking how stochastic G is (the first of these numbers should be small):" +fstisstochastic $tgt_lang/G.fst + +# Compose the token, lexicon and language-model FST into the final decoding graph +fsttablecompose $tgt_lang/L.fst $tgt_lang/G.fst | fstdeterminizestar --use-log=true | \ + fstminimizeencoded | fstarcsort --sort_type=ilabel > $tgt_lang/LG.fst || exit 1; +fsttablecompose $tgt_lang/T.fst $tgt_lang/LG.fst > $tgt_lang/TLG.fst || exit 1; + +echo "Composing decoding graph TLG.fst succeeded" +rm -r $tgt_lang/LG.fst # We don't need to keep this intermediate FST + diff --git a/runtime/tools/fst/make_lexicon_fst.pl b/runtime/tools/fst/make_lexicon_fst.pl new file mode 100644 index 0000000..ee2c585 --- /dev/null +++ b/runtime/tools/fst/make_lexicon_fst.pl @@ -0,0 +1,148 @@ +#!/usr/bin/perl -w +# Copyright 2010-2011 Microsoft Corporation +# 2013 Johns Hopkins University (author: Daniel Povey) + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# makes lexicon FST, in text form, from lexicon (pronunciation probabilities optional). + +$pron_probs = 0; + +if ($ARGV[0] eq "--pron-probs") { + $pron_probs = 1; + shift @ARGV; +} + +if (@ARGV != 1 && @ARGV != 3 && @ARGV != 4) { + print STDERR + "Usage: make_lexicon_fst.pl [--pron-probs] lexicon.txt [silprob silphone [sil_disambig_sym]] >lexiconfst.txt +Creates a lexicon FST that transduces phones to words, and may allow optional silence. +Note: ordinarily, each line of lexicon.txt is: word phone1 phone2 ... phoneN; if the --pron-probs option is +used, each line is: word pronunciation-probability phone1 phone2 ... phoneN. The probability 'prob' will +typically be between zero and one, and note that it's generally helpful to normalize so the largest one +for each word is 1.0, but this is your responsibility. The silence disambiguation symbol, e.g. something +like #5, is used only when creating a lexicon with disambiguation symbols, e.g. L_disambig.fst, and was +introduced to fix a particular case of non-determinism of decoding graphs.\n"; + exit(1); +} + +$lexfn = shift @ARGV; +if (@ARGV == 0) { + $silprob = 0.0; +} elsif (@ARGV == 2) { + ($silprob,$silphone) = @ARGV; +} else { + ($silprob,$silphone,$sildisambig) = @ARGV; +} +if ($silprob != 0.0) { + $silprob < 1.0 || die "Sil prob cannot be >= 1.0"; + $silcost = -log($silprob); + $nosilcost = -log(1.0 - $silprob); +} + + +open(L, "<$lexfn") || die "Error opening lexicon $lexfn"; + + +if ( $silprob == 0.0 ) { # No optional silences: just have one (loop+final) state which is numbered zero. + $loopstate = 0; + $nextstate = 1; # next unallocated state. + while () { + @A = split(" ", $_); + @A == 0 && die "Empty lexicon line."; + $w = shift @A; + if (! $pron_probs) { + $pron_cost = 0.0; + } else { + $pron_prob = shift @A; + if (! defined $pron_prob || !($pron_prob > 0.0 && $pron_prob <= 1.0)) { + die "Bad pronunciation probability in line $_"; + } + $pron_cost = -log($pron_prob); + } + if ($pron_cost != 0.0) { $pron_cost_string = "\t$pron_cost"; } else { $pron_cost_string = ""; } + + $s = $loopstate; + $word_or_eps = $w; + while (@A > 0) { + $p = shift @A; + if (@A > 0) { + $ns = $nextstate++; + } else { + $ns = $loopstate; + } + print "$s\t$ns\t$p\t$word_or_eps$pron_cost_string\n"; + $word_or_eps = ""; + $pron_cost_string = ""; # so we only print it on the first arc of the word. + $s = $ns; + } + } + print "$loopstate\t0\n"; # final-cost. +} else { # have silence probs. + $startstate = 0; + $loopstate = 1; + $silstate = 2; # state from where we go to loopstate after emitting silence. + print "$startstate\t$loopstate\t\t\t$nosilcost\n"; # no silence. + if (!defined $sildisambig) { + print "$startstate\t$loopstate\t$silphone\t\t$silcost\n"; # silence. + print "$silstate\t$loopstate\t$silphone\t\n"; # no cost. + $nextstate = 3; + } else { + $disambigstate = 3; + $nextstate = 4; + print "$startstate\t$disambigstate\t$silphone\t\t$silcost\n"; # silence. + print "$silstate\t$disambigstate\t$silphone\t\n"; # no cost. + print "$disambigstate\t$loopstate\t$sildisambig\t\n"; # silence disambiguation symbol. + } + while () { + @A = split(" ", $_); + $w = shift @A; + if (! $pron_probs) { + $pron_cost = 0.0; + } else { + $pron_prob = shift @A; + if (! defined $pron_prob || !($pron_prob > 0.0 && $pron_prob <= 1.0)) { + die "Bad pronunciation probability in line $_"; + } + $pron_cost = -log($pron_prob); + } + if ($pron_cost != 0.0) { $pron_cost_string = "\t$pron_cost"; } else { $pron_cost_string = ""; } + $s = $loopstate; + $word_or_eps = $w; + while (@A > 0) { + $p = shift @A; + if (@A > 0) { + $ns = $nextstate++; + print "$s\t$ns\t$p\t$word_or_eps$pron_cost_string\n"; + $word_or_eps = ""; + $pron_cost_string = ""; $pron_cost = 0.0; # so we only print it the 1st time. + $s = $ns; + } else { + if (!defined($silphone) || $p ne $silphone) { + # This is non-deterministic but relatively compact, + # and avoids epsilons. + $local_nosilcost = $nosilcost + $pron_cost; + $local_silcost = $silcost + $pron_cost; + print "$s\t$loopstate\t$p\t$word_or_eps\t$local_nosilcost\n"; + print "$s\t$silstate\t$p\t$word_or_eps\t$local_silcost\n"; + } else { + # no point putting opt-sil after silence word. + print "$s\t$loopstate\t$p\t$word_or_eps$pron_cost_string\n"; + } + } + } + } + print "$loopstate\t0\n"; # final-cost. +} diff --git a/runtime/tools/fst/parse_options.sh b/runtime/tools/fst/parse_options.sh new file mode 100644 index 0000000..fdc8a36 --- /dev/null +++ b/runtime/tools/fst/parse_options.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +# Copyright 2012 Johns Hopkins University (Author: Daniel Povey); +# Arnab Ghoshal, Karel Vesely + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# Parse command-line options. +# To be sourced by another script (as in ". parse_options.sh"). +# Option format is: --option-name arg +# and shell variable "option_name" gets set to value "arg." +# The exception is --help, which takes no arguments, but prints the +# $help_message variable (if defined). + + +### +### The --config file options have lower priority to command line +### options, so we need to import them first... +### + +# Now import all the configs specified by command-line, in left-to-right order +for ((argpos=1; argpos<$#; argpos++)); do + if [ "${!argpos}" == "--config" ]; then + argpos_plus1=$((argpos+1)) + config=${!argpos_plus1} + [ ! -r $config ] && echo "$0: missing config '$config'" && exit 1 + . $config # source the config file. + fi +done + + +### +### No we process the command line options +### +while true; do + [ -z "${1:-}" ] && break; # break if there are no arguments + case "$1" in + # If the enclosing script is called with --help option, print the help + # message and exit. Scripts should put help messages in $help_message + --help|-h) if [ -z "$help_message" ]; then echo "No help found." 1>&2; + else printf "$help_message\n" 1>&2 ; fi; + exit 0 ;; + --*=*) echo "$0: options to scripts must be of the form --name value, got '$1'" + exit 1 ;; + # If the first command-line argument begins with "--" (e.g. --foo-bar), + # then work out the variable name as $name, which will equal "foo_bar". + --*) name=`echo "$1" | sed s/^--// | sed s/-/_/g`; + # Next we test whether the variable in question is undefned-- if so it's + # an invalid option and we die. Note: $0 evaluates to the name of the + # enclosing script. + # The test [ -z ${foo_bar+xxx} ] will return true if the variable foo_bar + # is undefined. We then have to wrap this test inside "eval" because + # foo_bar is itself inside a variable ($name). + eval '[ -z "${'$name'+xxx}" ]' && echo "$0: invalid option $1" 1>&2 && exit 1; + + oldval="`eval echo \\$$name`"; + # Work out whether we seem to be expecting a Boolean argument. + if [ "$oldval" == "true" ] || [ "$oldval" == "false" ]; then + was_bool=true; + else + was_bool=false; + fi + + # Set the variable to the right value-- the escaped quotes make it work if + # the option had spaces, like --cmd "queue.pl -sync y" + eval $name=\"$2\"; + + # Check that Boolean-valued arguments are really Boolean. + if $was_bool && [[ "$2" != "true" && "$2" != "false" ]]; then + echo "$0: expected \"true\" or \"false\": $1 $2" 1>&2 + exit 1; + fi + shift 2; + ;; + *) break; + esac +done + + +# Check for an empty argument to the --cmd option, which can easily occur as a +# result of scripting errors. +[ ! -z "${cmd+xxx}" ] && [ -z "$cmd" ] && echo "$0: empty argument to --cmd option" 1>&2 && exit 1; + + +true; # so this script returns exit code 0. diff --git a/runtime/tools/fst/s2eps.pl b/runtime/tools/fst/s2eps.pl new file mode 100644 index 0000000..de993db --- /dev/null +++ b/runtime/tools/fst/s2eps.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl +# Copyright 2010-2011 Microsoft Corporation + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + +# This script replaces and with (on both input and output sides), +# for the G.fst acceptor. + +while(<>){ + @A = split(" ", $_); + if ( @A >= 4 ) { + if ($A[2] eq "" || $A[2] eq "") { $A[2] = ""; } + if ($A[3] eq "" || $A[3] eq "") { $A[3] = ""; } + } + print join("\t", @A) . "\n"; +} diff --git a/runtime/tools/fst/train_lms.sh b/runtime/tools/fst/train_lms.sh new file mode 100644 index 0000000..1fdb0ef --- /dev/null +++ b/runtime/tools/fst/train_lms.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +## Make sure that srilm is installed + +dir=lm +mkdir -p $dir +[ -f path.sh ] && . ./path.sh + +# Prepare data, the format of the text should be: +# BAC009S0002W0122 而 对 楼市 成交 抑制 作用 最 大 的 限 购 +# BAC009S0002W0123 也 成为 地方 政府 的 眼中 钉 +corpus=lm/text + +# generate lm dict +cat $corpus | awk '{for(n=2;n<=NF;n++) print tolower($n); }' | \ + cat - <(echo "";echo ""; echo "") | \ + sort | uniq -c | sort -nr | awk '{print $2}' > $dir/corpus.dict || exit 1; + +# train ngram +cat $corpus | awk '{for(n=2;n<=NF;n++){ printf tolower($n); if(n $dir/train + +ngram-count -text $dir/train -order 4 -limit-vocab -vocab $dir/corpus.dict -unk \ + -kndiscount -interpolate -gt1min 1 -gt2min 1 -gt3min 2 -gt4min 2 -lm $dir/lm.arpa + + diff --git a/runtime/tools/path.sh b/runtime/tools/path.sh new file mode 100644 index 0000000..87f8220 --- /dev/null +++ b/runtime/tools/path.sh @@ -0,0 +1,3 @@ +export FUNASR_RUNTIME_ROOT=`pwd`/../ +export PATH=$FUNASR_RUNTIME_ROOT/onnxruntime/build/bin:$PWD:$PATH +export LC_ALL=C diff --git a/runtime/tools/train_compile_ngram.sh b/runtime/tools/train_compile_ngram.sh new file mode 100644 index 0000000..6b2989d --- /dev/null +++ b/runtime/tools/train_compile_ngram.sh @@ -0,0 +1,21 @@ +chmod +x fst/* +[ -f path.sh ] && . ./path.sh + +# download train corpus and lexicon +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/requirements/lm.tar.gz +tar -zxvf lm.tar.gz + +# train lm, make sure that srilm is installed +bash fst/train_lms.sh + +# generate lexicon +python3 fst/generate_lexicon.py lm/corpus.dict lm/lexicon.txt lm/lexicon.out + +# Compile the lexicon and token FSTs +fst/compile_dict_token.sh lm lm/tmp lm/lang + +# Compile the language-model FST and the final decoding graph TLG.fst +fst/make_decode_graph.sh lm lm/lang || exit 1; + +# Collect resource files required for decoding +fst/collect_resource_file.sh lm lm/resource diff --git a/runtime/tools/utils/parse_options.sh b/runtime/tools/utils/parse_options.sh new file mode 100644 index 0000000..71fb9e5 --- /dev/null +++ b/runtime/tools/utils/parse_options.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +# Copyright 2012 Johns Hopkins University (Author: Daniel Povey); +# Arnab Ghoshal, Karel Vesely + +# 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 +# +# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +# MERCHANTABLITY OR NON-INFRINGEMENT. +# See the Apache 2 License for the specific language governing permissions and +# limitations under the License. + + +# Parse command-line options. +# To be sourced by another script (as in ". parse_options.sh"). +# Option format is: --option-name arg +# and shell variable "option_name" gets set to value "arg." +# The exception is --help, which takes no arguments, but prints the +# $help_message variable (if defined). + + +### +### The --config file options have lower priority to command line +### options, so we need to import them first... +### + +# Now import all the configs specified by command-line, in left-to-right order +for ((argpos=1; argpos<$#; argpos++)); do + if [ "${!argpos}" == "--config" ]; then + argpos_plus1=$((argpos+1)) + config=${!argpos_plus1} + [ ! -r $config ] && echo "$0: missing config '$config'" && exit 1 + . $config # source the config file. + fi +done + + +### +### Now we process the command line options +### +while true; do + [ -z "${1:-}" ] && break; # break if there are no arguments + case "$1" in + # If the enclosing script is called with --help option, print the help + # message and exit. Scripts should put help messages in $help_message + --help|-h) if [ -z "$help_message" ]; then echo "No help found." 1>&2; + else printf "$help_message\n" 1>&2 ; fi; + exit 0 ;; + --*=*) echo "$0: options to scripts must be of the form --name value, got '$1'" + exit 1 ;; + # If the first command-line argument begins with "--" (e.g. --foo-bar), + # then work out the variable name as $name, which will equal "foo_bar". + --*) name=`echo "$1" | sed s/^--// | sed s/-/_/g`; + # Next we test whether the variable in question is undefned-- if so it's + # an invalid option and we die. Note: $0 evaluates to the name of the + # enclosing script. + # The test [ -z ${foo_bar+xxx} ] will return true if the variable foo_bar + # is undefined. We then have to wrap this test inside "eval" because + # foo_bar is itself inside a variable ($name). + eval '[ -z "${'$name'+xxx}" ]' && echo "$0: invalid option $1" 1>&2 && exit 1; + + oldval="`eval echo \\$$name`"; + # Work out whether we seem to be expecting a Boolean argument. + if [ "$oldval" == "true" ] || [ "$oldval" == "false" ]; then + was_bool=true; + else + was_bool=false; + fi + + # Set the variable to the right value-- the escaped quotes make it work if + # the option had spaces, like --cmd "queue.pl -sync y" + eval $name=\"$2\"; + + # Check that Boolean-valued arguments are really Boolean. + if $was_bool && [[ "$2" != "true" && "$2" != "false" ]]; then + echo "$0: expected \"true\" or \"false\": $1 $2" 1>&2 + exit 1; + fi + shift 2; + ;; + *) break; + esac +done + + +# Check for an empty argument to the --cmd option, which can easily occur as a +# result of scripting errors. +[ ! -z "${cmd+xxx}" ] && [ -z "$cmd" ] && echo "$0: empty argument to --cmd option" 1>&2 && exit 1; + + +true; # so this script returns exit code 0. diff --git a/runtime/triton_gpu/Dockerfile/Dockerfile.server b/runtime/triton_gpu/Dockerfile/Dockerfile.server new file mode 100644 index 0000000..d03610c --- /dev/null +++ b/runtime/triton_gpu/Dockerfile/Dockerfile.server @@ -0,0 +1,19 @@ +FROM nvcr.io/nvidia/tritonserver:23.01-py3 +# https://docs.nvidia.com/deeplearning/frameworks/support-matrix/index.html +# Please choose previous tritonserver:xx.xx if you encounter cuda driver mismatch issue + +LABEL maintainer="NVIDIA" +LABEL repository="tritonserver" + +RUN apt-get update && apt-get -y install \ + python3-dev \ + cmake \ + libsndfile1 + +# -i https://pypi.tuna.tsinghua.edu.cn/simple +RUN pip3 install torch torchaudio +RUN pip3 install kaldifeat pyyaml + +# Dependency for client +RUN pip3 install soundfile grpcio-tools tritonclient +WORKDIR /workspace diff --git a/runtime/triton_gpu/README.md b/runtime/triton_gpu/README.md new file mode 100644 index 0000000..48e889c --- /dev/null +++ b/runtime/triton_gpu/README.md @@ -0,0 +1,85 @@ +## Inference with Triton + +### Steps: +1. Prepare model repo files +```sh +git-lfs install +git clone https://www.modelscope.cn/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git + +pretrained_model_dir=$(pwd)/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch + +cp $pretrained_model_dir/am.mvn ./model_repo_paraformer_large_offline/feature_extractor/ +cp $pretrained_model_dir/config.yaml ./model_repo_paraformer_large_offline/feature_extractor/ + +# Refer here to get model.onnx (https://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/export/README.md) +cp /model.onnx ./model_repo_paraformer_large_offline/encoder/1/ +``` +Log of directory tree: +```sh +model_repo_paraformer_large_offline/ +|-- encoder +| |-- 1 +| | `-- model.onnx +| `-- config.pbtxt +|-- feature_extractor +| |-- 1 +| | `-- model.py +| |-- config.pbtxt +| |-- am.mvn +| `-- config.yaml +|-- infer_pipeline +| |-- 1 +| `-- config.pbtxt +`-- scoring + |-- 1 + | `-- model.py + `-- config.pbtxt + +8 directories, 9 files +``` + +2. Follow below instructions to launch triton server +```sh +# using docker image Dockerfile/Dockerfile.server +docker build . -f Dockerfile/Dockerfile.server -t triton-paraformer:23.01 +docker run -it --rm --name "paraformer_triton_server" --gpus all -v :/workspace/ --shm-size 1g --net host triton-paraformer:23.01 + +# launch the service +tritonserver --model-repository /workspace/model_repo_paraformer_large_offline \ + --pinned-memory-pool-byte-size=512000000 \ + --cuda-memory-pool-byte-size=0:1024000000 + +``` + +### Performance benchmark + +Benchmark [speech_paraformer](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) based on Aishell1 test set with a single V100, the total audio duration is 36108.919 seconds. + +```sh +# For client container: +docker run -it --rm --name "client_test" --net host --gpus all -v :/workpace/ soar97/triton-k2:22.12.1 # noqa +# For aishell manifests: +apt-get install git-lfs +git-lfs install +git clone https://huggingface.co/csukuangfj/aishell-test-dev-manifests +sudo mkdir -p /root/fangjun/open-source/icefall-aishell/egs/aishell/ASR/download/aishell +tar xf ./aishell-test-dev-manifests/data_aishell.tar.gz -C /root/fangjun/open-source/icefall-aishell/egs/aishell/ASR/download/aishell/ # noqa + +serveraddr=localhost +manifest_path=/workspace/aishell-test-dev-manifests/data/fbank/aishell_cuts_test.jsonl.gz +num_task=60 +python3 client/decode_manifest_triton.py \ + --server-addr $serveraddr \ + --compute-cer \ + --model-name infer_pipeline \ + --num-tasks $num_task \ + --manifest-filename $manifest_path +``` + +(Note: The service has been fully warm up.) +|concurrent-tasks | processing time(s) | RTF | +|----------|--------------------|------------| +| 60 (onnx fp32) | 116.0 | 0.0032| + +## Acknowledge +This part originates from NVIDIA CISI project. We also have TTS and NLP solutions deployed on triton inference server. If you are interested, please contact us. diff --git a/runtime/triton_gpu/README_ONLINE.md b/runtime/triton_gpu/README_ONLINE.md new file mode 100644 index 0000000..c3b6e83 --- /dev/null +++ b/runtime/triton_gpu/README_ONLINE.md @@ -0,0 +1,64 @@ +### Steps: +1. Prepare model repo files +* git clone https://www.modelscope.cn/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx.git +* Convert lfr_cmvn_pe.onnx model. For example: python export_lfr_cmvn_pe_onnx.py +* If you export to onnx, you should have several model files in `${MODEL_DIR}`: +``` +├── README.md +└── model_repo_paraformer_large_online + ├── cif_search + │   ├── 1 + │   │   └── model.py + │   └── config.pbtxt + ├── decoder + │   ├── 1 + │   │   └── decoder.onnx + │   └── config.pbtxt + ├── encoder + │   ├── 1 + │   │   └── model.onnx + │   └── config.pbtxt + ├── feature_extractor + │   ├── 1 + │   │   └── model.py + │   ├── config.pbtxt + │   └── config.yaml + ├── lfr_cmvn_pe + │   ├── 1 + │   │   └── lfr_cmvn_pe.onnx + │   ├── am.mvn + │   ├── config.pbtxt + │   └── export_lfr_cmvn_pe_onnx.py + └── streaming_paraformer + ├── 1 + └── config.pbtxt +``` + +2. Follow below instructions to launch triton server +```sh +# using docker image Dockerfile/Dockerfile.server +docker build . -f Dockerfile/Dockerfile.server -t triton-paraformer:23.01 +docker run -it --rm --name "paraformer_triton_server" --gpus all -v :/workspace/ --shm-size 1g --net host triton-paraformer:23.01 + +# launch the service +cd /workspace +tritonserver --model-repository model_repo_paraformer_large_online \ + --pinned-memory-pool-byte-size=512000000 \ + --cuda-memory-pool-byte-size=0:1024000000 + +``` + +### Performance benchmark with a single A10 + +* FP32, onnx, [paraformer larger online](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx/summary +),Our chunksize is 10 * 960 / 16000 = 0.6 s, so we should care about the perf of latency less than 0.6s so that it can be a realtime application. + + +| Concurrency | Throughput | Latency_p50 (ms) | Latency_p90 (ms) | Latency_p95 (ms) | Latency_p99 (ms) | +|-------------|------------|------------------|------------------|------------------|------------------| +| 20 | 309.252 | 56.913 | 76.267 | 85.598 | 138.462 | +| 40 | 391.058 | 97.911 | 145.509 | 150.545 | 185.399 | +| 60 | 426.269 | 138.244 | 185.855 | 201.016 | 236.528 | +| 80 | 431.781 | 170.991 | 227.983 | 252.453 | 412.273 | +| 100 | 473.351 | 206.205 | 262.612 | 288.964 | 463.337 | + diff --git a/runtime/triton_gpu/client/aishell_test.txt b/runtime/triton_gpu/client/aishell_test.txt new file mode 100644 index 0000000..e68f858 --- /dev/null +++ b/runtime/triton_gpu/client/aishell_test.txt @@ -0,0 +1,7176 @@ +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0174.wav", "duration": 3.553, "text": "房地产业正经历一个调整阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0166.wav", "duration": 3.239, "text": "回升势头有转弱的迹象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0369.wav", "duration": 5.222875, "text": "成为本届残运会志愿服务文化的重要部分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0139.wav", "duration": 4.578, "text": "美丽北京大型绿色公益品牌项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0220.wav", "duration": 5.2729375, "text": "研究逐步扩大良种补贴品种和范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0455.wav", "duration": 5.197, "text": "他们怀疑是有人在村里养蛇所致"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0158.wav", "duration": 4.003, "text": "一线城市土地市场成交火热"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0463.wav", "duration": 3.8979375, "text": "大家对温州话难懂这事儿略有耳闻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0350.wav", "duration": 4.306125, "text": "目前八座为已有场馆并在使用中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0177.wav", "duration": 5.412, "text": "除了做好传统门店的体验销售电商平台销售外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0195.wav", "duration": 5.739, "text": "则需要在发债时机和发债规模上进行合理的把握"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0235.wav", "duration": 5.1540625, "text": "并对政府性债务进行馀额管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0320.wav", "duration": 4.2900625, "text": "同时也卡住了自动化的投入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0133.wav", "duration": 5.572, "text": "今年北京要建设筹集各类保障房十万套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0145.wav", "duration": 4.754, "text": "目前整体的宏观经济还是比较困难的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0440.wav", "duration": 3.491, "text": "又供称是自己失手杀妻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0339.wav", "duration": 8.406, "text": "有着较为丰富志愿服务经历的九零后吴雯的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0140.wav", "duration": 2.6779375, "text": "还清首套房公积金贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0419.wav", "duration": 9.49, "text": "早前演出的舞台剧令他醒觉要出外寻找更多演出机会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0467.wav", "duration": 6.677, "text": "温州市民郑女士在农贸市场购买了三只大虾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0250.wav", "duration": 4.6539375, "text": "完善环境法律政策体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0433.wav", "duration": 4.3469375, "text": "其发现清洁工保洁不到位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0249.wav", "duration": 6.2579375, "text": "生产者应当及时采取措施消除缺陷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0217.wav", "duration": 3.3470625, "text": "地震灾后重建等领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0372.wav", "duration": 6.063, "text": "这里常年吸引着众多登山探险运动爱好者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0162.wav", "duration": 4.7569375, "text": "与目前房地产救市的市场导向相吻合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0124.wav", "duration": 9.098, "text": "已经删除了此前针对外商投资房地产的全部限制类条款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0484.wav", "duration": 3.3779375, "text": "都说下属有困难找领导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0268.wav", "duration": 2.9880625, "text": "但是病毒武器的出现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0121.wav", "duration": 3.098, "text": "作为一线城市的北京"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0225.wav", "duration": 7.0489375, "text": "对新建公共交通设施用地的地上地下空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0362.wav", "duration": 3.2739375, "text": "一系列大型赛事的承办"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0461.wav", "duration": 7.243875, "text": "有网友反映前往山东日照一海排档点海鲜时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0187.wav", "duration": 3.5510625, "text": "农业现代化水平显着提升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0264.wav", "duration": 3.379, "text": "中国人从来不缺乏创新创造的基因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0172.wav", "duration": 5.197, "text": "公积金在申请放贷流程上并未提速"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0131.wav", "duration": 4.282, "text": "住建部等三部委联合发文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0374.wav", "duration": 4.969, "text": "但训练量几乎和正常时不可同日而语"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0486.wav", "duration": 7.6010625, "text": "温州一家六口吃毒蘑菇身亡女婴拒吃面躲过死神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0352.wav", "duration": 4.952125, "text": "上一场同包尔江的比赛之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0265.wav", "duration": 4.6660625, "text": "但是过去整整一年他都在秘密工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0315.wav", "duration": 3.7369375, "text": "由于传统汽车产业步入寒冬"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0388.wav", "duration": 3.3359375, "text": "雅桑克莱的优势继续在扩大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0180.wav", "duration": 5.6259375, "text": "通州新城彩虹之门用地挂出三十日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0233.wav", "duration": 4.0129375, "text": "保障人民群众生命健康安全"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0320.wav", "duration": 3.8088125, "text": "软件开发是领导的授意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0180.wav", "duration": 2.579, "text": "但不少业内人士认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0379.wav", "duration": 3.7360625, "text": "或进入体育行政机关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0133.wav", "duration": 4.1679375, "text": "美丽北京大型绿色公益品牌项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0293.wav", "duration": 4.0, "text": "一定会有立竿见影的推广效果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0238.wav", "duration": 8.0169375, "text": "我国地方政府的累积债务相对于偿付能力来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0403.wav", "duration": 7.078125, "text": "保证国家队水平不会被其他球队相差太远的承诺下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0212.wav", "duration": 4.134, "text": "农作物秸秆综合利用率百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0387.wav", "duration": 5.6230625, "text": "如今为这次赛事服务的志愿者们更为年轻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0372.wav", "duration": 6.9560625, "text": "哈特灵今年饱受十字韧带伤势困扰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0256.wav", "duration": 6.74, "text": "如果按照每股一二七美元的股价来算"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0474.wav", "duration": 7.1579375, "text": "把云盘变成了一个淫秽色情信息的隐蔽聚散地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0236.wav", "duration": 3.182, "text": "债券发行人是优质的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0133.wav", "duration": 4.9859375, "text": "然而这家雄心勃勃的公司并未止步于此"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0222.wav", "duration": 2.912, "text": "增强农业公益性服务能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0265.wav", "duration": 3.4489375, "text": "以及给领导们的审批费用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0291.wav", "duration": 3.9809375, "text": "管理层眼光得再高一点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0360.wav", "duration": 4.483125, "text": "而在技术上年轻队员也弥补了我的不足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0467.wav", "duration": 8.24, "text": "温州一七月大女童接种疫苗抽搐省疾控专家调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0232.wav", "duration": 3.635, "text": "继续建设国家级旱作农业示范区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0369.wav", "duration": 5.8728125, "text": "对于我国冰雪运动实力的提升会有巨大的推动作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0214.wav", "duration": 3.609, "text": "但还需要进一步改进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0196.wav", "duration": 3.424, "text": "向大企业大集团集中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0223.wav", "duration": 7.0500625, "text": "将其纳入旧城改造和新城建设规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0344.wav", "duration": 5.056875, "text": "我和队友们一起团结努力克服了这些困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0472.wav", "duration": 6.6950625, "text": "机场严查匿打火机过安检放在鞋子里算藏匿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0376.wav", "duration": 5.491, "text": "与商业性冰场达成合作协议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0404.wav", "duration": 3.880125, "text": "他自己还将出任影片的男主角"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0417.wav", "duration": 4.253875, "text": "同场更有两个神秘嘉宾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0277.wav", "duration": 4.9099375, "text": "整个过程基于安全元素芯片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0393.wav", "duration": 6.734875, "text": "吕会会在走到混合区接受记者采访时止住了泪水"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0464.wav", "duration": 6.454125, "text": "该村妇因犯非法种植毒品原植物罪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0451.wav", "duration": 5.844, "text": "清华附小校长窦桂海诠释成志教育理念"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0414.wav", "duration": 3.8310625, "text": "陈妍希晒出一组攀岩照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0167.wav", "duration": 4.1800625, "text": "唯独这样才能盘活公积金资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0121.wav", "duration": 5.358, "text": "也不代表开发商资金面已经不再紧张"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0368.wav", "duration": 4.896, "text": "高桥大辅因为其比赛风格的妖娆多变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0257.wav", "duration": 3.8969375, "text": "苹果的股价有一定的波动规律"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0148.wav", "duration": 7.0019375, "text": "因此开发还要继续坚定的开工和拿地的信心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0391.wav", "duration": 3.222875, "text": "直通里约奥运会的目标也近在咫尺"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0244.wav", "duration": 7.495, "text": "建立城市公共交通运营成本和服务质量信息公开制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0407.wav", "duration": 4.719, "text": "乌鸦在没有其他公司愿意接手的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0132.wav", "duration": 3.941, "text": "导致公积金资源闲置的问题出现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0155.wav", "duration": 4.28, "text": "对于实施住房限购政策的城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0282.wav", "duration": 3.6580625, "text": "以及中国的春节做准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0136.wav", "duration": 4.677, "text": "设立住房银行的条件已基本成熟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0415.wav", "duration": 5.214125, "text": "他感叹自己在无线十五年都没有机会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0351.wav", "duration": 4.3349375, "text": "他经常在社交网站公开美食等照片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0437.wav", "duration": 4.555875, "text": "参考消息网七月二八日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0447.wav", "duration": 3.2050625, "text": "已造成六人死亡九人受伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0340.wav", "duration": 3.3100625, "text": "对这里的水质比较关心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0169.wav", "duration": 4.5, "text": "根据北京中原地产统计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0453.wav", "duration": 3.7170625, "text": "事故电梯出厂刚满一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0403.wav", "duration": 5.4250625, "text": "提升战绩为九胜一负反超至榜首位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0229.wav", "duration": 3.126, "text": "加强农业基础设施建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0249.wav", "duration": 6.646, "text": "在遴选优质管理人提升保险资金投资收益率的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0261.wav", "duration": 5.173, "text": "神雕还有一定的隐身特性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0318.wav", "duration": 4.296, "text": "项目总投资十四点五亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0216.wav", "duration": 6.262, "text": "从加快转变农业发展的方式关键环节入手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0169.wav", "duration": 6.791, "text": "因此判断随着利好政策的实施和成交量的增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0345.wav", "duration": 4.094, "text": "如果能够加强这方面的锻炼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0482.wav", "duration": 4.0908125, "text": "瑞安市市场监管局玉海所介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0384.wav", "duration": 4.4509375, "text": "当下想把注意力集中在打球上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0281.wav", "duration": 3.4, "text": "为即将到来的购物季"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0237.wav", "duration": 6.589, "text": "对海洋江河湖泊沿岸化工企业进行集中综合整治"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0427.wav", "duration": 3.661875, "text": "事后解释是生活观不同才分开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0435.wav", "duration": 3.9360625, "text": "还有待职能部门进一步调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0362.wav", "duration": 3.7529375, "text": "双方刺刀见红式的对攻中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0299.wav", "duration": 5.1760625, "text": "包括更换不同尺寸型号和不同的表带"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0131.wav", "duration": 10.8420625, "text": "中指院广州公司总经理张化学向南都记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0184.wav", "duration": 4.288, "text": "今久整合营销集团迎来了它的生日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0295.wav", "duration": 4.3049375, "text": "是否能令捧场客心满意足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0436.wav", "duration": 7.234875, "text": "村官遭判刑处罚证据涉嫌造假公检法自查迟迟无果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0434.wav", "duration": 5.77, "text": "现代快报记者从省邮政管理局了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0233.wav", "duration": 3.444125, "text": "国务院二零一一年五月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0411.wav", "duration": 5.068125, "text": "有网友则晒出当天现场情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0394.wav", "duration": 7.0, "text": "所有主办国的男子冰球成绩排位均在二十位之内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0262.wav", "duration": 6.267, "text": "前往苹果零售店的顾客将比餐厅订餐叫号还方便"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0469.wav", "duration": 8.912125, "text": "温州集资诈骗案犯汇给情人四千万小三被诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0484.wav", "duration": 6.645, "text": "村委会主任建议由垫资人担任村文书"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0276.wav", "duration": 3.714875, "text": "当出现此类价格变化时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0323.wav", "duration": 2.5899375, "text": "我们进行了极为严谨的测试"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0218.wav", "duration": 4.401, "text": "建立农业补贴政策后评估机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0492.wav", "duration": 6.6628125, "text": "村支书以在全村井水中投毒以报复村民的离奇事件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0369.wav", "duration": 3.239, "text": "中国女排将应战日本队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0212.wav", "duration": 5.7149375, "text": "以及提供服务中的变相涨价或价格欺诈行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0280.wav", "duration": 5.203, "text": "仅有三点百分之四的分析师建议卖出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0206.wav", "duration": 7.198, "text": "探索完善财政支持下的农业大灾风险分散机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0311.wav", "duration": 4.3830625, "text": "美的吸取了当年大跃进的教训"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0241.wav", "duration": 4.745, "text": "允许在普通收费公路行驶的摩托车"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0315.wav", "duration": 6.3869375, "text": "而绝大多数漏洞状态都是未联系到厂商或厂商忽略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0205.wav", "duration": 5.2619375, "text": "在有条件地区实行整乡整县场推进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0481.wav", "duration": 7.4389375, "text": "温州一女士洗澡被已婚男多次偷窥二年后才报警"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0481.wav", "duration": 6.0278125, "text": "第一个下井救人的大叔却再也没能爬上来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0342.wav", "duration": 5.5949375, "text": "鄂美蝶便毫无保留地将炮火轰向对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0233.wav", "duration": 5.333, "text": "地方投融资平台公司申请发行债券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0372.wav", "duration": 4.605, "text": "显然处于最艰难时期的两人丝毫没有放弃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0134.wav", "duration": 7.674, "text": "即使去年十一月公积金贷款利率降至百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0258.wav", "duration": 3.7880625, "text": "苹果靠什么颠复移动支付"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0206.wav", "duration": 3.611, "text": "合理布局入海排污口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0265.wav", "duration": 4.621, "text": "牛师傅总说自己的面没有添加任何防腐剂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0360.wav", "duration": 5.218, "text": "组委会在部门设置上调整了人员分工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0206.wav", "duration": 5.1, "text": "力争实现优势产区和主要品种全复盖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0269.wav", "duration": 4.22, "text": "预示着未来战争模样将完全改变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0418.wav", "duration": 5.756125, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0493.wav", "duration": 3.792, "text": "很多人都已为赏月做准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0493.wav", "duration": 6.495875, "text": "村支书醉驾撞伤孕妇刑满释放后仍当人大代表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0381.wav", "duration": 3.6540625, "text": "是全场得分最高的运动员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0445.wav", "duration": 7.6699375, "text": "温州天价窝头事件背后顾客要持持赔三条中华"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0366.wav", "duration": 4.782, "text": "也让我们看到了自身存在着的不足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0292.wav", "duration": 5.1281875, "text": "苹果股票每分钟交易量已超过六十七万股"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0470.wav", "duration": 5.3830625, "text": "当植物恢复正常生长后铁丝网将拆除"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0191.wav", "duration": 3.348, "text": "信息化水平不断提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0210.wav", "duration": 3.4240625, "text": "鼓励农民专业合作社开展信用合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0269.wav", "duration": 3.188, "text": "就手机领域的发展趋势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0353.wav", "duration": 5.115, "text": "一个强项跟弱项同样突出的拳手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0248.wav", "duration": 4.891, "text": "有的考试在不同地区收费标准差异较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0216.wav", "duration": 3.3349375, "text": "加大农业支持保护力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0431.wav", "duration": 7.5, "text": "港富豪被绑涉及两岸三地绑匪要求赎金用比特币"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0463.wav", "duration": 7.5700625, "text": "去年一二月四日在村民多次上访无果的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0142.wav", "duration": 2.347, "text": "与新政相比"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0357.wav", "duration": 3.3261875, "text": "自从哈萨克斯坦独立"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0151.wav", "duration": 3.555, "text": "这是智能家居行业的先例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0263.wav", "duration": 5.4859375, "text": "也能够给股票市场来带更多兴奋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0373.wav", "duration": 3.573, "text": "如今和小林尊出双入对"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0413.wav", "duration": 4.5659375, "text": "中新网五月六日电据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0357.wav", "duration": 4.199, "text": "表示愿意再征战一个冬奥会周期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0453.wav", "duration": 10.428, "text": "村民一零年在沙洲植树造林已成林却被指种错地方"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0164.wav", "duration": 4.587, "text": "涨幅据十大城市之首"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0464.wav", "duration": 5.2849375, "text": "双方因互殴均被行政拘留并处罚款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0318.wav", "duration": 6.37, "text": "仅处于美的集团内部管理架构调整的阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0164.wav", "duration": 3.621, "text": "可美国的月亮总是比中国的亮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0489.wav", "duration": 5.7368125, "text": "湖北一公司以员工名义贷款数十员工负债千万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0421.wav", "duration": 6.47, "text": "香港女星吴君如与导演陈可辛爱情长跑十八年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0246.wav", "duration": 6.3299375, "text": "有媒体报道了云投集团等发债企业转移核心资产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0365.wav", "duration": 6.683875, "text": "而且满足了绝大多数业馀排球爱好者的参赛需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0409.wav", "duration": 3.8779375, "text": "例如出入帮忙开门拉椅子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0158.wav", "duration": 5.5229375, "text": "因此最终仅有龙湖地产一家报价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0125.wav", "duration": 4.852, "text": "而南昌除了放松首套房界定标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0258.wav", "duration": 3.8239375, "text": "强制不断的心率测量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0259.wav", "duration": 3.135, "text": "因为在新品发布之前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0333.wav", "duration": 4.481, "text": "这些都是和消费者增添黏性互动的方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0158.wav", "duration": 3.497, "text": "有效提高家庭购房能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0343.wav", "duration": 5.123875, "text": "北京市排球协会与天津排协已经初步达成合作意向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0177.wav", "duration": 3.299, "text": "今久又一次利用资本市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0429.wav", "duration": 4.3889375, "text": "港歌神陈奕迅出道近二十年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0473.wav", "duration": 3.1028125, "text": "导致数百亩农田干旱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0487.wav", "duration": 3.2949375, "text": "酒店行为属于乱收费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0295.wav", "duration": 3.7900625, "text": "前者有长时间的沉淀"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0215.wav", "duration": 3.14, "text": "新一轮菜篮子建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0198.wav", "duration": 5.5320625, "text": "记者昨日第一时间从江苏省交通运输厅获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0144.wav", "duration": 3.3899375, "text": "降息消息传出后首日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0164.wav", "duration": 4.679, "text": "年初选择使用公积金贷款的购房者占比环比增多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0404.wav", "duration": 4.933125, "text": "这部命运多旭的电影"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0369.wav", "duration": 2.7839375, "text": "对于法国冰协的行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0184.wav", "duration": 4.2120625, "text": "更多是原本计划购房的客群享受到了政策利好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0349.wav", "duration": 3.8460625, "text": "朱婷在第四局比赛中意外崴脚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0155.wav", "duration": 4.2649375, "text": "该资金可以是委托人的自有资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0427.wav", "duration": 2.797125, "text": "他要赶进厂开工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0475.wav", "duration": 4.224125, "text": "对提供重大线索协助破案者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0485.wav", "duration": 4.6799375, "text": "高仿沉香多以化学香精等制成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0172.wav", "duration": 6.6859375, "text": "旨在帮助小型企业降低运运营成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0196.wav", "duration": 3.4, "text": "激发农业科技创新活力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0288.wav", "duration": 4.828, "text": "亦拜股份去年六月一拆七所赐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0211.wav", "duration": 11.2779375, "text": "吴显亭称将加强和证监会等相关部门的配合和协作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0382.wav", "duration": 6.6240625, "text": "将成为无数武迷接下来最大的期待之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0419.wav", "duration": 3.087875, "text": "头发随意披在脑后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0243.wav", "duration": 5.605, "text": "支持优势产区现代化鲜活农产品批发市场建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0221.wav", "duration": 3.5760625, "text": "发行规模还会稳步扩大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0415.wav", "duration": 3.579125, "text": "陈冠希在微博晒出一张自拍照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0347.wav", "duration": 6.0961875, "text": "还曾经两次拿到了四大洲锦标赛的男单冠军"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0409.wav", "duration": 4.2519375, "text": "婷婷指收到消息时正在拍摄广告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0175.wav", "duration": 2.421, "text": "今久又出高价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0488.wav", "duration": 7.235875, "text": "图片由胡先生提供本报讯记者喻莉出门旅游"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0354.wav", "duration": 3.097875, "text": "他不仅动过多次肌肉手术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0266.wav", "duration": 5.124, "text": "高空长航时战略无人机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0230.wav", "duration": 3.266, "text": "各地保障房建设的套数"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0145.wav", "duration": 4.239, "text": "无论是东部中部还是西部地区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0208.wav", "duration": 3.734, "text": "维护正常的市场价格秩序"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0193.wav", "duration": 4.698, "text": "严厉打击农产品投机炒作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0195.wav", "duration": 6.3569375, "text": "三是促进考务成本降低和考试单位合并"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0131.wav", "duration": 6.08, "text": "境外个人购房依然需要符合当地政策规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0349.wav", "duration": 5.5788125, "text": "阿拉木图方面将会使用十四个场馆作为比赛之用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0146.wav", "duration": 6.2849375, "text": "商品房房的销售面积同比数据出现好转"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0330.wav", "duration": 3.6450625, "text": "任何家用电器只要通电就会产生电磁辐射"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0346.wav", "duration": 2.3239375, "text": "通过未来几年的发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0172.wav", "duration": 4.79, "text": "北京调整首套房公积金贷款最高额度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0213.wav", "duration": 4.6070625, "text": "积极稳妥推进户籍制度改革"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0180.wav", "duration": 3.108, "text": "今久成功实现了转型"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0136.wav", "duration": 5.041, "text": "土地市场体现了房企对一二线市场的看重"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0314.wav", "duration": 5.469, "text": "相关人员表示为了方便和孩子保持联系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0333.wav", "duration": 4.573, "text": "二十二二零一五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0138.wav", "duration": 3.58, "text": "成交量环比大幅增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0482.wav", "duration": 4.1269375, "text": "老师发现后和学生一起寻找"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0283.wav", "duration": 5.078, "text": "四大天王平均回报仅一百分之二十五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0287.wav", "duration": 5.005, "text": "而苹果得以顺利跻身道指"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0459.wav", "duration": 4.104, "text": "恐影响旁边大厦的基地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0193.wav", "duration": 3.236125, "text": "以及扩大内需战略的实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0167.wav", "duration": 8.2619375, "text": "房地产被视作保值升值的投资标的被炒作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0460.wav", "duration": 4.469, "text": "附近村民闻讯纷纷赶来瞧个新鲜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0262.wav", "duration": 5.6210625, "text": "苹果对电动汽车表现出的浓厚兴趣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0439.wav", "duration": 5.3730625, "text": "伤者目前在解放军第一一八医院进行治疗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0340.wav", "duration": 4.6269375, "text": "因为导致这项数值波动的原因有很多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0462.wav", "duration": 6.806875, "text": "清洁工开宝马上班被称励志故事经查系逃犯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0392.wav", "duration": 5.297125, "text": "不过这依然是吕会会的个人最好成绩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0396.wav", "duration": 3.443125, "text": "就是要一枪一枪地投"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0236.wav", "duration": 6.271, "text": "对全国各地的政府债务进行啦严格审计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0390.wav", "duration": 3.410875, "text": "该是一件多幸福的事啊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0445.wav", "duration": 7.003875, "text": "游客在乌鲁木齐市吃自助餐浪费食物被罚二四零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0465.wav", "duration": 5.3241875, "text": "被麒麟区法院判处有期徒刑六个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0228.wav", "duration": 4.791, "text": "确保耕地保有量保持在十亿亩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0292.wav", "duration": 5.3979375, "text": "帮助设计了苹果多项产品的外观和用户体验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0271.wav", "duration": 5.2829375, "text": "美国芯片行业兴起并购热潮搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0457.wav", "duration": 8.714125, "text": "李连杰名誉维权案一审胜诉网站被判至致歉赔偿一零万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0199.wav", "duration": 12.636, "text": "也是国家淘汰落后产能加快产业升级宏观政策的体现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0210.wav", "duration": 2.303, "text": "团结就是力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0344.wav", "duration": 4.7849375, "text": "进而提升我国在冬奥会申办过程中的竞争力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0352.wav", "duration": 3.8369375, "text": "他俩组建了工作团队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0477.wav", "duration": 3.25, "text": "今后将加强水库管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0434.wav", "duration": 3.5898125, "text": "现场图温都讯今天下午四时许"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0401.wav", "duration": 3.2829375, "text": "朴泰桓和美容院都互不相让"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0425.wav", "duration": 4.042, "text": "和往日的端庄淑女形象大有不同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0405.wav", "duration": 5.1110625, "text": "另一部要视独立日二的票房而定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0459.wav", "duration": 6.584, "text": "明着是大兴区黄村镇狼垡三村的医师"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0420.wav", "duration": 3.3920625, "text": "搜狐娱乐讯据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0298.wav", "duration": 8.082, "text": "高通二零一四年所获专利也增长了百分之二十三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0366.wav", "duration": 2.9250625, "text": "跑者们随着年龄的增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0197.wav", "duration": 6.4970625, "text": "加大先进适用技术装备的引进消化和吸收力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0326.wav", "duration": 4.3559375, "text": "汽车模具以及汽车零部件表现一般"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0234.wav", "duration": 11.251, "text": "包括七座以下小客车及摩托车都被列入免费范范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0391.wav", "duration": 3.75, "text": "四号位进攻以大斜线为主"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0221.wav", "duration": 4.3399375, "text": "政府举债建设形成了大量资产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0248.wav", "duration": 6.2059375, "text": "有媒体报道了云投集团等发债企业转移核心资产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0374.wav", "duration": 3.283, "text": "但法政大学很快公开辟谣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0150.wav", "duration": 4.6159375, "text": "对各地分支机构实行垂直管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0142.wav", "duration": 4.47, "text": "今年北京除了建设保障性住房外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0444.wav", "duration": 3.9189375, "text": "我明白言论自由是一把两刃刀"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0343.wav", "duration": 3.714875, "text": "里约奥组委此前表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0148.wav", "duration": 4.316, "text": "可充分利用这些机构网点和人员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0170.wav", "duration": 2.912, "text": "同比上涨约六成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0464.wav", "duration": 3.8420625, "text": "造成一名井下工人死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0166.wav", "duration": 4.997, "text": "并不代表全年土地市场行情走低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0382.wav", "duration": 5.140875, "text": "中国女排队长坦言不仅是后面的几场比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0309.wav", "duration": 4.891, "text": "成飞集成相关人士告诉每日经济新闻记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0271.wav", "duration": 6.5400625, "text": "并建议客户减少对该股票在投资组合中的占比"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0443.wav", "duration": 6.4028125, "text": "遭到镇政府工作人员用土掩埋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0344.wav", "duration": 6.656, "text": "在他的职业生涯里曾在二零一零年拿到世锦赛金牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0226.wav", "duration": 5.4230625, "text": "也具有间接的经济效益或社会效益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0460.wav", "duration": 3.777125, "text": "该告示不能成为园方免责的理由"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0369.wav", "duration": 6.0920625, "text": "播求久负盛名的扫腿与冲膝技术开始发威"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0179.wav", "duration": 4.1159375, "text": "他认为跟后辈姻缘风险相比"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0293.wav", "duration": 4.5239375, "text": "但应刻在每个中国企业家甚至每个中国人心里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0457.wav", "duration": 4.4509375, "text": "温州苍南县看守所一宿舍起火"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0356.wav", "duration": 6.0, "text": "花样滑冰短道速滑项目在首都体育馆进行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0302.wav", "duration": 3.566875, "text": "苹果没有危害消费者利益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0446.wav", "duration": 7.567125, "text": "市二中院终审认定李家遗产共计八零零多万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0248.wav", "duration": 7.1990625, "text": "在稳定城市副食品供应保证能力的基础上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0159.wav", "duration": 4.875, "text": "东地产财经周度审计工作报告出炉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0311.wav", "duration": 3.1320625, "text": "今年还将新增二百台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0271.wav", "duration": 3.5800625, "text": "索尼黑莓以至诺基亚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0258.wav", "duration": 3.3990625, "text": "当它进入动物胃部时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0367.wav", "duration": 2.80325, "text": "但是由于国籍不统一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0165.wav", "duration": 4.183, "text": "广州二手房迎来新一轮涨价潮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0171.wav", "duration": 6.408, "text": "最低首付款比例由百分之七降低至百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0265.wav", "duration": 5.7950625, "text": "那将会是中国海空军的战力倍增器之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0375.wav", "duration": 4.4670625, "text": "韩国媒体报道称朴泰桓确实人在日本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0411.wav", "duration": 4.6809375, "text": "但就希望外界多给予他们发展空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0132.wav", "duration": 4.068, "text": "其成立需具备哪些条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0372.wav", "duration": 6.656, "text": "搜狐体育郭健九月一日发自日本冈山今天下午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0349.wav", "duration": 4.8000625, "text": "是一个在球场上有想法的球员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0259.wav", "duration": 6.23, "text": "苹果推出的每一款新产品都不免要引发大讨论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0121.wav", "duration": 3.675, "text": "真正落地的产品却非常地少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0337.wav", "duration": 3.9250625, "text": "实现营收净利双增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0385.wav", "duration": 3.1118125, "text": "半个月的报名期限未到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0435.wav", "duration": 8.4360625, "text": "杨爱明却参加了兴安县第十五届人大五次会议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0188.wav", "duration": 4.272, "text": "发展现代农业的条件更加有利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0169.wav", "duration": 4.348, "text": "今久上海分公司又悄无声息地开张了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0334.wav", "duration": 4.0970625, "text": "业物内士向记者分析说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0337.wav", "duration": 5.3249375, "text": "我们小天才电话手表就是不断创新的成果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0182.wav", "duration": 4.125, "text": "市场去库存的速度在适度提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0292.wav", "duration": 6.693125, "text": "倾销幅度从百分之十七至百分之九十九"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0248.wav", "duration": 3.886, "text": "以农兽药残留标准为重点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0150.wav", "duration": 6.5899375, "text": "各相关部门要主动服务区县服务各参建单位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0494.wav", "duration": 3.4030625, "text": "被民警用针扎破手指"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0349.wav", "duration": 7.1479375, "text": "作为队长出席新闻发布会的曾春蕾提到了凝聚力三个字"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0135.wav", "duration": 5.561, "text": "得益于一系列稳定房地产市场的措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0490.wav", "duration": 6.1330625, "text": "强化媒体根据群众举报开展调查采访和舆论监督"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0188.wav", "duration": 3.136, "text": "生产经营方式不断优化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0389.wav", "duration": 3.689, "text": "朱婷进攻相对比较简单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0481.wav", "duration": 5.1379375, "text": "华商报商洛讯记者白鹏飞近日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0244.wav", "duration": 4.139, "text": "可以向有关金融监管部门申请"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0187.wav", "duration": 3.509, "text": "发行利率也有较大幅度上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0277.wav", "duration": 5.865, "text": "拓朗的主打产品是现场可编程门阵列芯片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0387.wav", "duration": 6.4880625, "text": "感谢这三位因伤未能参赛的姐妹对球队做出的巨大贡献"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0333.wav", "duration": 3.308125, "text": "一些车企为了节约成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0135.wav", "duration": 3.8970625, "text": "房企对土地的争抢更加积极"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0149.wav", "duration": 6.821, "text": "也将在一定程度上降低刚需购房者支付负担"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0219.wav", "duration": 3.834125, "text": "中央企业要进一步深化改革"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0333.wav", "duration": 5.982875, "text": "满足政府和企业级客户云计算下的定制化需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0227.wav", "duration": 3.027125, "text": "二零一二保障房建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0283.wav", "duration": 3.72, "text": "已经有股票经纪公司预测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0454.wav", "duration": 2.9509375, "text": "目前神志已恢复清醒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0225.wav", "duration": 3.1709375, "text": "大年初一路上都没什么车"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0381.wav", "duration": 5.4460625, "text": "不少媒体追问她是否有男朋友"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0175.wav", "duration": 2.881, "text": "从申请到最后的放款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0198.wav", "duration": 5.15, "text": "结合地方政府债务管理制度的完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0448.wav", "duration": 3.803, "text": "本来一家人出国旅游挺高兴的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0123.wav", "duration": 5.78, "text": "即由商业银行向市民发放执行公积金利率的贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0287.wav", "duration": 5.087875, "text": "并减少太阳能产业相关就业岗位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0149.wav", "duration": 3.842, "text": "与房地产商的需求相去甚远"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0404.wav", "duration": 4.161125, "text": "瓦尔兹将精心演绎这个著名角色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0138.wav", "duration": 4.273, "text": "较上月环比上涨百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0318.wav", "duration": 7.6579375, "text": "资产规模将达到六十五亿八百亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0340.wav", "duration": 3.745, "text": "跑友们积极的参与剪纸活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0352.wav", "duration": 5.1950625, "text": "展示出了如同其偶像安东尼一样的全面犀利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0425.wav", "duration": 5.853, "text": "陈妍希回应现在真的很享受快乐恋爱的喜悦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0265.wav", "duration": 3.723, "text": "创新是中华民族最鲜明的禀赋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0383.wav", "duration": 2.910875, "text": "经过二十多年的努力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0215.wav", "duration": 4.1689375, "text": "央企在境外含港澳地区营收"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0430.wav", "duration": 6.751, "text": "怎料无心说话却一语成谶"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0260.wav", "duration": 3.8049375, "text": "有媒体援引知情人士消息称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0237.wav", "duration": 8.5650625, "text": "引导农产品加工业向种养业优势区域和城市郊区集中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0363.wav", "duration": 6.0399375, "text": "当被问及新老队员相互担当弥补的话题时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0485.wav", "duration": 3.4868125, "text": "这让张女士哭笑不得"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0158.wav", "duration": 5.7800625, "text": "呈现购房者积极入市的行情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0149.wav", "duration": 6.373, "text": "公积金是地方政府可以直接通过政策调整动用的资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0132.wav", "duration": 5.9490625, "text": "这一系列公积金门槛放低额度提高的调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0245.wav", "duration": 4.7730625, "text": "债券市场城投债券发行不畅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0207.wav", "duration": 5.4189375, "text": "农业面临着容易被忽视或削弱的风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0383.wav", "duration": 2.871, "text": "但是里面不是淡定的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0183.wav", "duration": 3.023, "text": "公积金短期拉动的购房需求有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0124.wav", "duration": 5.109, "text": "汇率较大概率维持双向波动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0265.wav", "duration": 5.365, "text": "这对于一家巨型企业是非常难能可贵的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0234.wav", "duration": 4.125, "text": "试点基金管理公司发展态势良好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0143.wav", "duration": 4.723, "text": "开发商仍然面临着较大的销售压力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0156.wav", "duration": 6.7070625, "text": "七月广州二手楼市交投升温的态势已相当明确"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0211.wav", "duration": 4.0229375, "text": "城投债券的发行有比较严格的条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0143.wav", "duration": 3.1839375, "text": "但综观国内同类企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0379.wav", "duration": 4.396, "text": "很多人都看到了新的奥运商机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0371.wav", "duration": 3.4409375, "text": "支持他们继续训练参加比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0298.wav", "duration": 5.187, "text": "苹果没有透露更昂贵智能手表的具体售价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0429.wav", "duration": 3.4970625, "text": "谢依霖穿着白色吊带裙"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0314.wav", "duration": 6.1169375, "text": "八月初公司通过了增加产能建设的决议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0457.wav", "duration": 4.3559375, "text": "长江商报消息本报记者张萌昨日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0445.wav", "duration": 5.137, "text": "双方发生语言冲突后进行互殴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0304.wav", "duration": 3.2580625, "text": "这台设备就不会开机运转"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0239.wav", "duration": 3.906, "text": "健全安全管理制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0408.wav", "duration": 2.762, "text": "晚上二十零下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0146.wav", "duration": 3.072, "text": "业务网点一千个"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0156.wav", "duration": 8.369, "text": "一外商投资房地产企业注册资本与投资总额比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0236.wav", "duration": 5.818, "text": "对化学品生产经营企业进行环境隐患排查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0403.wav", "duration": 3.188, "text": "比赛地水不是太干净"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0136.wav", "duration": 2.9050625, "text": "产生非常可怕的结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0306.wav", "duration": 5.5959375, "text": "同比增长十一五十六点四百分之二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0317.wav", "duration": 8.3969375, "text": "在国内四大厂商浪潮华为联想曙光中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0206.wav", "duration": 4.5560625, "text": "加快推进该区域现代农业建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0333.wav", "duration": 5.263875, "text": "每天的销量让你感受到儿童电话手表的火爆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0274.wav", "duration": 5.3149375, "text": "以告知客户相关技术人员确切的空闲时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0491.wav", "duration": 7.6371875, "text": "潘老伯二六岁的外孙还在医院重症监护室治疗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0231.wav", "duration": 3.8830625, "text": "保障房和水利建设概念股"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0355.wav", "duration": 4.6120625, "text": "能够在这个集体与可爱的队友一起拼杀"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0290.wav", "duration": 9.4310625, "text": "认定从中国进口的乘用车和轻型卡车轮胎存在倾销行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0334.wav", "duration": 6.3669375, "text": "锂电池在今年上半年成为诸多上市公司的业绩功臣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0175.wav", "duration": 3.615, "text": "房价未来可能会略微有下跌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0415.wav", "duration": 3.318125, "text": "袁两半一人歌词包办"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0252.wav", "duration": 3.8460625, "text": "淘汰报废高耗能老旧农业机械"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0458.wav", "duration": 7.03, "text": "游客武夷山就餐麝香肉结账要四八元一两"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0296.wav", "duration": 5.105125, "text": "这使得神雕在全球也成为最大的无人机之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0354.wav", "duration": 3.0029375, "text": "北京时间十月二十七日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0153.wav", "duration": 6.126, "text": "住房城乡建设部政策研究中心主任秦虹表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0436.wav", "duration": 4.4619375, "text": "这是二零一零年四月二三日以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0437.wav", "duration": 7.400875, "text": "骗取搬迁补偿金一二二万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0412.wav", "duration": 6.7270625, "text": "哈哈哈第一次见人用这种方式证明自己没怀孕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0482.wav", "duration": 4.8579375, "text": "温州网讯洗澡被偷窥却一忍再忍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0256.wav", "duration": 8.651, "text": "其中包括美国大鸦无人机今后将由印度工厂制造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0207.wav", "duration": 4.386, "text": "符合提高直接融资比重的要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0450.wav", "duration": 6.9350625, "text": "游客进店未购物被导游嘲讽官方正在立案处理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0263.wav", "duration": 3.396, "text": "粗估下来大概要七十亿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0488.wav", "duration": 2.9911875, "text": "意味着生活条件的改善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0400.wav", "duration": 4.9040625, "text": "我的泪水主要还是来自于喜悦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0165.wav", "duration": 4.311, "text": "楼市调控的行政手段宜减不宜加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0281.wav", "duration": 5.6049375, "text": "想要成功的零售商将考虑消费者的利益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0477.wav", "duration": 4.2780625, "text": "村里随处可见装潢小广告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0185.wav", "duration": 3.865, "text": "就在上周五双降公布之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0163.wav", "duration": 2.534, "text": "盘活各地公积金资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0426.wav", "duration": 3.078125, "text": "一路上都十指紧扣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0234.wav", "duration": 7.7990625, "text": "从二零零九年下半年就开始要求有关部门调研这一问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0137.wav", "duration": 3.662, "text": "中新网房产频道每每"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0235.wav", "duration": 7.053, "text": "对于引领全国现代农业加快发展具有重要意义"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0469.wav", "duration": 9.8561875, "text": "港媒关注重雾霾重回华北罕见蓝天只持续两周"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0233.wav", "duration": 6.2060625, "text": "推进农业经营体系体制创新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0335.wav", "duration": 5.2050625, "text": "如今的智能家电更多意义上是智能加上互动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0236.wav", "duration": 5.3559375, "text": "增加划设城市公共交通优先车道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0470.wav", "duration": 4.5339375, "text": "她将几只虾的图片通过微博发布"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0175.wav", "duration": 7.203, "text": "而政府放松限购按揭和内地融资政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0176.wav", "duration": 5.8370625, "text": "为进一步完善住房公积金个人住房贷款政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0396.wav", "duration": 3.681875, "text": "平昌曾经三次申办冬奥会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0491.wav", "duration": 5.7360625, "text": "以上两村民所要求的内容不符合相关规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0367.wav", "duration": 5.7780625, "text": "均已被纳入二零二二年冬奥会的规划场馆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0162.wav", "duration": 3.389, "text": "促进楼市预期向好发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0422.wav", "duration": 3.4970625, "text": "但坚信有我落脚的地方"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0293.wav", "duration": 5.8250625, "text": "今年三月美国大众科学杂志刊文称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0177.wav", "duration": 3.083, "text": "在目前的法律框架下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0372.wav", "duration": 5.473875, "text": "用他们真挚的微笑和运动员建立起心与心的连接"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0374.wav", "duration": 6.3979375, "text": "为他们搭建一个特色自由的体育室加户外体育课堂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0210.wav", "duration": 3.7359375, "text": "面临着一系列严峻挑战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0232.wav", "duration": 6.2440625, "text": "并对地方政府债务进行监控和风险防范等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0292.wav", "duration": 7.295875, "text": "二零一五年最适宜供职的公司仍在科技领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0290.wav", "duration": 7.6450625, "text": "有报道称苹果计划在二零一四年秋季推出其可穿戴设备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0237.wav", "duration": 6.807, "text": "用五个多月时间对全国七十台运行在建核电机组"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0461.wav", "duration": 6.3310625, "text": "不像她发表的那些先锋的观点一样冲击人眼球"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0402.wav", "duration": 4.802, "text": "视频中国三比一大胜俄罗斯独占女排世界杯榜首"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0365.wav", "duration": 5.5400625, "text": "专家会诊之后认为孙杨存在心肌缺血情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0339.wav", "duration": 6.4350625, "text": "中国队教练组还是做出了让朱婷继续休战的抉择"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0207.wav", "duration": 3.392, "text": "壮大农业农村人才队伍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0239.wav", "duration": 3.754, "text": "农业机械化推进工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0380.wav", "duration": 7.2470625, "text": "这些出路也是中国运动员比较常见的退役选择"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0484.wav", "duration": 4.729, "text": "超过韩国成为访日最大客源国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0181.wav", "duration": 3.06, "text": "后今久时代正式到来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0257.wav", "duration": 5.541, "text": "一旦战事结束或出于特殊需要可以实现自毁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0355.wav", "duration": 6.917, "text": "在今天的比赛中中国女排始终相互鼓励相互扶持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0377.wav", "duration": 4.3310625, "text": "被立刻送往医院接受紧急输血治疗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0268.wav", "duration": 3.0379375, "text": "蕴含着巨大商业价值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0244.wav", "duration": 4.808, "text": "各地机场高速公路是否实行免费通行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0161.wav", "duration": 5.582, "text": "继前年和去年连续两年突破四万亿元后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0383.wav", "duration": 3.5910625, "text": "由于中国女排的前期准备特别充分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0349.wav", "duration": 3.9919375, "text": "对于我的对手制造更多的麻烦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0154.wav", "duration": 3.117, "text": "上海作为一线城市代表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0413.wav", "duration": 2.993875, "text": "搜狐娱乐讯九月六日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0379.wav", "duration": 4.1699375, "text": "严重影响卡尔泽塔的实现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0163.wav", "duration": 6.563, "text": "可以购买符合实际需要的自用自住商品房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0345.wav", "duration": 4.587125, "text": "在今天的比赛中曾春蕾首发出场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0261.wav", "duration": 3.7330625, "text": "在当年社交游戏风靡的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0312.wav", "duration": 3.526125, "text": "是很多父母迫切需要的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0159.wav", "duration": 6.6730625, "text": "得益于一系列稳定房地产市场的措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0440.wav", "duration": 6.9038125, "text": "更有全球李氏宗亲大会将其列为祭祖主题曲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0420.wav", "duration": 3.3100625, "text": "今年三月底惊爆分手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0318.wav", "duration": 4.0020625, "text": "公司超百位研发人员历经半年多时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0345.wav", "duration": 5.4650625, "text": "明年春天普鲁申科将再次进行手术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0147.wav", "duration": 5.166, "text": "各区县各单位要加强协作配合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0274.wav", "duration": 3.1809375, "text": "公司的成功缺一不可"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0182.wav", "duration": 2.984, "text": "作用大并不代表每个人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0395.wav", "duration": 3.787875, "text": "只能依靠顽强的意志进行支撑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0178.wav", "duration": 3.3369375, "text": "这些税费均无法避免"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0425.wav", "duration": 4.3840625, "text": "许茹芸与韩籍男友举行了婚礼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0206.wav", "duration": 4.4299375, "text": "这决定了我国城市化动力十分强劲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0485.wav", "duration": 8.775875, "text": "渔民在南海打捞起可疑电子装置确系无人潜航器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0137.wav", "duration": 5.2569375, "text": "多数在积极剑指一线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0192.wav", "duration": 4.083, "text": "耕地占用税税率提高后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0129.wav", "duration": 5.6390625, "text": "北京公积金贷款成交量上涨百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0436.wav", "duration": 10.5, "text": "村支书骗拆迁款一二万获刑一一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0460.wav", "duration": 3.187, "text": "二零一三六二三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0430.wav", "duration": 4.3579375, "text": "陈凯琳之前说没交过男友"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0492.wav", "duration": 4.057125, "text": "仍处于深度昏迷状态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0493.wav", "duration": 4.1689375, "text": "为泄愤将开水淋到顾客头上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0196.wav", "duration": 7.8470625, "text": "引导各地鉴借示范区发展现代农业的好做法和好经验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0329.wav", "duration": 2.712, "text": "关于手机等产品的辐射问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0193.wav", "duration": 5.0190625, "text": "启动实施农业科技创新能力建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0476.wav", "duration": 9.808125, "text": "港媒曝水货客扮残疾人在轮椅中藏钻石月入八万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0246.wav", "duration": 6.7360625, "text": "也就是将债劵还本压力在债劵存续期内进行合理分摊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0179.wav", "duration": 3.7229375, "text": "虽然刚需购房者入市积极性有所提升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0213.wav", "duration": 3.119, "text": "我国地方政府性债务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0494.wav", "duration": 4.3879375, "text": "其室友在微博上所发的寻人启事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0405.wav", "duration": 2.900875, "text": "且获得奥斯卡最佳动画片大奖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0210.wav", "duration": 12.0, "text": "城市化快速发展期的重要特征就是基础设施投资需求量大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0465.wav", "duration": 3.8410625, "text": "躺进吊床的父亲还荡起吊床"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0274.wav", "duration": 7.7409375, "text": "去年高通被评为最佳实习科技公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0170.wav", "duration": 7.718, "text": "这份只有五百多字的通知印发于八月十九日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0375.wav", "duration": 3.745, "text": "当队长的一举一动都会带来情绪上影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0473.wav", "duration": 4.994875, "text": "双手背脸部等裸露部位有刺伤划伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0125.wav", "duration": 6.875, "text": "发现土地成本占比持续提升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0313.wav", "duration": 4.891, "text": "置入只有手机几分之一大小的手表表盘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0455.wav", "duration": 5.162125, "text": "随即被送到儿童医院进行抢救"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0365.wav", "duration": 6.397, "text": "崇礼县发展较成熟的万龙滑雪场和云顶滑雪场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0176.wav", "duration": 4.713, "text": "除了去库存和夯实楼市回升基础外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0260.wav", "duration": 4.865, "text": "包括电池和机器人技术领域的专家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0385.wav", "duration": 3.8469375, "text": "首先要跨过大韩体育会这一关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0199.wav", "duration": 3.4869375, "text": "科技创新孕育新突破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0459.wav", "duration": 4.1640625, "text": "湖北电梯吃人定性为责任事故"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0263.wav", "duration": 4.5969375, "text": "苹果零售店实行先到先服务的原则"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0426.wav", "duration": 3.4309375, "text": "搜狐娱乐讯据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0431.wav", "duration": 5.234875, "text": "温州鹿城区宣传部官微做出回应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0250.wav", "duration": 5.3619375, "text": "但出于对我国地方政府债务风险的不合理判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0410.wav", "duration": 2.609125, "text": "沉寂一段时间后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0325.wav", "duration": 5.7990625, "text": "近年来随着国内互联网企业的快速发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0308.wav", "duration": 5.7690625, "text": "美的家用空调事业部制造副总裁乌守保对记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0462.wav", "duration": 6.724125, "text": "贵港民警追凶未言弃嫌犯一五年后落法网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0149.wav", "duration": 3.344, "text": "一线城市签约十七万套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0444.wav", "duration": 6.98, "text": "雷某一直在河北邢台衡水等地干着游走骗婚的勾当"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0181.wav", "duration": 2.833, "text": "平均溢价率较低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0340.wav", "duration": 8.0080625, "text": "徐永昊以雷霆万钧之势缔造了一场震撼的秒杀之作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0469.wav", "duration": 4.0700625, "text": "参考消息网八月一五日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0247.wav", "duration": 4.7360625, "text": "鼓励商业银行去境外开设分支机构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0307.wav", "duration": 3.991, "text": "该公司内部相关人士回应称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0225.wav", "duration": 5.7680625, "text": "要尽快建立我国的地方政府债务管理体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0472.wav", "duration": 7.7839375, "text": "温州市域铁路将成为全国第一条城市交通铁路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0358.wav", "duration": 4.337875, "text": "两人的更改国籍禁赛期即将开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0322.wav", "duration": 8.295875, "text": "虽然投入产生问题以及机器人后期运行维护等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0191.wav", "duration": 4.374, "text": "具备条件的要积极引进战略投资者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0308.wav", "duration": 3.2680625, "text": "美的计划在二零一八年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0173.wav", "duration": 7.409, "text": "整体平均楼面价折合一万元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0264.wav", "duration": 4.8010625, "text": "就开始追寻打造真正的机器人的梦想"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0315.wav", "duration": 4.702875, "text": "从美的海尔使用机器人操作来看来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0350.wav", "duration": 3.1179375, "text": "高桥大辅丝毫不加掩饰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0484.wav", "duration": 7.639875, "text": "湖北二五岁女子从未来例假基因检查是男身"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0346.wav", "duration": 6.291, "text": "张锦麟将为自己称为鸟巢新一代志愿者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0297.wav", "duration": 3.2839375, "text": "据可靠的网络消息源称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0319.wav", "duration": 6.668125, "text": "阐述老板电器和内部创新外部国际化如何进行破题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0189.wav", "duration": 6.266, "text": "即各省在考务费标准基础上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0125.wav", "duration": 4.317, "text": "年初往往是土地供应的淡季"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0132.wav", "duration": 3.658, "text": "不得超越界限盲目扩张"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0392.wav", "duration": 6.150875, "text": "中国国家男子冰球队目前排名第三十二位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0389.wav", "duration": 3.864, "text": "我们可以说已经输给了其他强敌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0327.wav", "duration": 3.635, "text": "儿童电话手表到底有多火"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0418.wav", "duration": 3.400875, "text": "陈势安两天一夜没洗澡刷牙"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0125.wav", "duration": 6.9359375, "text": "放开外资购买房产限制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0447.wav", "duration": 4.035125, "text": "近一年来每天晚上有垃圾倒在这块闲置地上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0371.wav", "duration": 5.218, "text": "本次赛事已经开始接受团队报名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0386.wav", "duration": 4.7050625, "text": "二四个参赛名额就已经全部报满"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0316.wav", "duration": 5.879875, "text": "紫光集团还计划布局物联网网络设备芯片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0439.wav", "duration": 7.522, "text": "该歌曲今年一经在各大音乐网站上线便收获无数好评"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0222.wav", "duration": 5.338, "text": "虽然已发行的城投债券的还本付息都是正常的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0320.wav", "duration": 3.9260625, "text": "因此更有可能留下信息安全风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0174.wav", "duration": 7.3339375, "text": "一至七月份大多数城市还是会采取积极降价的策略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0460.wav", "duration": 4.9931875, "text": "地头边的一间平房也被夷为平地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0307.wav", "duration": 4.8940625, "text": "担心会直接影响孩子正常的学习"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0224.wav", "duration": 7.5539375, "text": "建设水产遗传育种中心和原良种场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0358.wav", "duration": 3.952875, "text": "伴随着双方激战的火爆升级"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0383.wav", "duration": 5.9040625, "text": "身材高挑并且不抽烟喝酒的男生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0128.wav", "duration": 5.775, "text": "随着广州住房公积金贷款政策的调整实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0162.wav", "duration": 5.1050625, "text": "随着一线城市楼市企温回升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0126.wav", "duration": 4.883, "text": "以北京提高公积金贷款最高额度为例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0337.wav", "duration": 5.667, "text": "锂电池在今年上半年成为诸多上市公司的业绩功臣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0415.wav", "duration": 2.954125, "text": "二人一直鲜少回应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0457.wav", "duration": 5.2588125, "text": "失联近两天的中传研究生周云露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0229.wav", "duration": 6.055875, "text": "加强地方政府债务管理和风险防控"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0234.wav", "duration": 3.302, "text": "开展池塘标准化改造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0451.wav", "duration": 3.4109375, "text": "由普通商店作为掩护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0123.wav", "duration": 5.9289375, "text": "缴存者还可以在租房装修离退休时提取"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0488.wav", "duration": 9.0, "text": "其在村西旁花费万元建起一名叫清明堂的家庙"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0132.wav", "duration": 9.854, "text": "三线城市库存积压又逼倒房地产商在一线城市抢地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0279.wav", "duration": 3.2989375, "text": "应用于汽车医疗等行业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0208.wav", "duration": 4.4830625, "text": "确保过往车辆分类分车道有序通行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0404.wav", "duration": 2.541, "text": "如今再遭厄运"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0303.wav", "duration": 4.635, "text": "现在市面上的电话手表功能最主要有两个通话和定位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0405.wav", "duration": 5.17825, "text": "档期遇到了不可调和的冲突"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0339.wav", "duration": 3.1119375, "text": "并且会逐渐扩大比赛规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0329.wav", "duration": 9.548125, "text": "再加上互联网企业对服务器技术性可能等要求很高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0347.wav", "duration": 4.126, "text": "张晓雅这个娃娃训练很自觉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0191.wav", "duration": 5.8039375, "text": "促使我国战略性新兴产业发展实现了良好开局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0456.wav", "duration": 5.895, "text": "蛇主刘先生表示以后将不在家里养蛇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0240.wav", "duration": 5.0820625, "text": "大力发展高效植保机器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0124.wav", "duration": 5.71, "text": "我国房地产市场过去总体偏紧部分地区过紧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0125.wav", "duration": 4.2389375, "text": "今久商品房销售额首次上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0458.wav", "duration": 8.77, "text": "村卫生室医师兼职黑b超记者暗访结束被跟踪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0189.wav", "duration": 2.825, "text": "对于这条特殊的隧道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0150.wav", "duration": 4.653, "text": "有关地方追回资金或补贴一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0436.wav", "duration": 3.417, "text": "目前该协管已经停职"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0486.wav", "duration": 6.135, "text": "温州医生夫妇贩婴被批捕女儿欲捐款替父赎罪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0195.wav", "duration": 5.249, "text": "全面准确及时发布事故处置相关信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0266.wav", "duration": 4.5389375, "text": "这一亏损已经收窄了百分之五十七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0157.wav", "duration": 6.428, "text": "上海深圳等主要城市也在公积金新政推动下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0426.wav", "duration": 3.538125, "text": "二人发生姓肢体冲突"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0414.wav", "duration": 5.2150625, "text": "乱糟糟的马尾加上宽松衣服的村姑打扮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0282.wav", "duration": 3.828, "text": "价格高于六百美元的高端手机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0449.wav", "duration": 5.791, "text": "但各楼层的自动扶梯均已关停供图新华"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0369.wav", "duration": 8.2590625, "text": "新科世界冠军宁泽涛领衔中国队出战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0423.wav", "duration": 4.826875, "text": "有不少幕后花絮片花"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0241.wav", "duration": 4.63, "text": "我国资本市场将迎来更多机构投资者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0478.wav", "duration": 5.364, "text": "蔡兴桥在妈妈的帮助下靠墙练习站立"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0394.wav", "duration": 2.99, "text": "对垒日本女排有这样一个小细节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0234.wav", "duration": 4.115, "text": "政府将制订境外投资总体战略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0127.wav", "duration": 3.885, "text": "据伟嘉安捷数据统计显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0365.wav", "duration": 4.901875, "text": "以大刀阔斧的摆肘砸肘为主"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0459.wav", "duration": 3.0849375, "text": "称就是想找个无辜的人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0242.wav", "duration": 4.491, "text": "加快规模养殖场粪污处理利用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0487.wav", "duration": 6.6179375, "text": "游客成都遇连环车祸近千人隧道里死里逃亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0440.wav", "duration": 3.485125, "text": "船上八名船员六人不幸遇难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0226.wav", "duration": 3.6010625, "text": "都要严格履行环评程序"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0442.wav", "duration": 7.0900625, "text": "惠州公安在金山河捞获一具无头无双手女尸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0365.wav", "duration": 4.0649375, "text": "指导各赛区开展志愿服务培训"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0312.wav", "duration": 6.1069375, "text": "决定由麦德公司的技术部门研发静默插件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0297.wav", "duration": 3.292, "text": "苹果就公布了合作伙伴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0375.wav", "duration": 4.249, "text": "去年在亚青赛上亮相后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0291.wav", "duration": 4.2540625, "text": "触控科技子公司涨幅居前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0243.wav", "duration": 4.9199375, "text": "坚持分类指导重点突破梯次推进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0124.wav", "duration": 4.457, "text": "公积金贷款与商业贷款之间的利息差额"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0487.wav", "duration": 3.438, "text": "明星刘晓庆又火了一把"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0319.wav", "duration": 3.6169375, "text": "我就给自己的孩子也买了一个呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0253.wav", "duration": 7.2540625, "text": "比如用户抱怨升级之后设施无法像以前那样工作了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0194.wav", "duration": 3.5239375, "text": "城投债券收益率上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0125.wav", "duration": 4.149, "text": "贷款额度上限调整为一百万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0245.wav", "duration": 5.422, "text": "加大天然草原退牧还草工程实施力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0375.wav", "duration": 5.838875, "text": "但直到一二年后的法国阿尔贝维尔冬奥会上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0337.wav", "duration": 9.074, "text": "合作范围遍及全国各直属海关及隶属海关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0230.wav", "duration": 7.365, "text": "对城市公共交通企业实行税收优惠政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0203.wav", "duration": 5.243875, "text": "徐林这几年城投债券发行数量的确有所增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0250.wav", "duration": 6.98, "text": "以园艺产品生产品水产品等为重点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0404.wav", "duration": 6.1699375, "text": "但是由于加朵要为蝙蝠侠大战超人忙碌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0378.wav", "duration": 4.2529375, "text": "想通过训练提升脚踝和小腿的能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0182.wav", "duration": 6.131, "text": "通州运河核心区一宗多功能用地挂出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0401.wav", "duration": 4.2148125, "text": "若想保住进入前两名的资格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0438.wav", "duration": 2.766125, "text": "你不可能一分钱不花"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0205.wav", "duration": 3.6790625, "text": "健全农业再保险体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0368.wav", "duration": 3.298125, "text": "速度下降的更加明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0194.wav", "duration": 4.5390625, "text": "有利于提升城投债券的资产配置价值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0229.wav", "duration": 4.4810625, "text": "作为城投债券发行监管部门"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0254.wav", "duration": 4.938, "text": "由于关于乔布斯的电话即将上演了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0449.wav", "duration": 11.1430625, "text": "五一岁的村支委猥亵一名一零岁的留守儿童隔壁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0385.wav", "duration": 4.678, "text": "和绝不会是短期行为的基调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0179.wav", "duration": 3.7690625, "text": "纠偏政策一刀切的负面影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0455.wav", "duration": 2.962125, "text": "虽然事情过去三天了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0334.wav", "duration": 6.454125, "text": "锂电池生产企业将迎来业绩持续高增长阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0494.wav", "duration": 8.3779375, "text": "华江瑶族乡十四届人大代表会第五次会议会务材料上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0241.wav", "duration": 5.4959375, "text": "提高信息化优质化和品牌化水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0354.wav", "duration": 4.6079375, "text": "这场对决的惨烈程度超出了所有人的想象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0441.wav", "duration": 5.3930625, "text": "湖北五道杠少年捐出二万元政府奖学金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0208.wav", "duration": 6.2740625, "text": "城市化快速发展期的重要特征就是基础设施投资需求大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0255.wav", "duration": 3.787, "text": "这个数据不及苹果的一个季度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0266.wav", "duration": 3.3719375, "text": "从随身听到智能电话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0395.wav", "duration": 4.0700625, "text": "此次北京联手张家口申办冬奥会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0167.wav", "duration": 3.0589375, "text": "随着市场调整的深入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0188.wav", "duration": 5.37, "text": "加快农业技术引进消化吸收再创新步伐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0222.wav", "duration": 8.234, "text": "是一种合理的基础设施投融资金建设行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0347.wav", "duration": 4.25, "text": "他在为此时刻准备着"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0373.wav", "duration": 4.093, "text": "尤其是比目鱼肌和腓肠肌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0360.wav", "duration": 6.328125, "text": "但这对老将却以追梦无悔的精神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0201.wav", "duration": 5.595, "text": "加强小麦一喷三防喷施叶面肥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0378.wav", "duration": 10.0800625, "text": "莎宾娜也凭借兼具清纯和性感气质的漂亮外形走红日本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0150.wav", "duration": 3.336, "text": "未来子女出现姻缘风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0460.wav", "duration": 2.7841875, "text": "当日的新闻发布会上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0196.wav", "duration": 4.8349375, "text": "加快农产品流通标准体系建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0179.wav", "duration": 4.179, "text": "开发商整体在手土地充足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0213.wav", "duration": 7.6910625, "text": "城投债劵作为准市政债劵仍将是有效的融资工具"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0441.wav", "duration": 8.521, "text": "参考消息网一零月八日报道国庆长假结束"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0482.wav", "duration": 4.917, "text": "访日外国游客突破千万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0352.wav", "duration": 8.3820625, "text": "一九九二年八月五日出生于云南省保山市龙陵县"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0307.wav", "duration": 4.9199375, "text": "中国企业与世界企业同在同一起跑线上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0346.wav", "duration": 6.1660625, "text": "而这些战斗也成为了圈内久聊不厌的经典谈资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0202.wav", "duration": 3.9860625, "text": "加强农牧互补牧养结合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0274.wav", "duration": 4.4700625, "text": "我们鼓励用户只从可信任的渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0457.wav", "duration": 9.713125, "text": "村民二六零棵梨树被连根推倒在地里住房被夷为平地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0340.wav", "duration": 7.317875, "text": "来自北汽女排的主攻手刘晓彤取代朱婷的位置首发出场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0437.wav", "duration": 8.6110625, "text": "港媒称马云向浙江商人发出警告永远不要行贿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0467.wav", "duration": 4.494875, "text": "夏先生带太太跟团去新马泰旅游"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0366.wav", "duration": 3.026875, "text": "当年的整个世青赛上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0271.wav", "duration": 3.5179375, "text": "然后又要去竞选纽约州长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0482.wav", "duration": 2.9099375, "text": "尽管在民警的协助下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0357.wav", "duration": 2.911875, "text": "作为主力主攻的朱婷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0415.wav", "duration": 5.3610625, "text": "网友纷纷将焦点转移到这对情侣身上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0336.wav", "duration": 3.1609375, "text": "一旦发现系统有漏洞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0401.wav", "duration": 5.713875, "text": "也成为哈萨克斯坦的宣传大使"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0238.wav", "duration": 8.5589375, "text": "以及所有民用研究堆和核燃燃料循环设施等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0468.wav", "duration": 6.2900625, "text": "回家后发现大虾体内居然被注射了不明胶状物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0194.wav", "duration": 7.213, "text": "做好外资并购大型农产品批发市场的安全审查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0299.wav", "duration": 4.4090625, "text": "两股力量基本上都有一统天下的野心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0231.wav", "duration": 8.6490625, "text": "继续加大对产粮大县生猪调出大县的奖励力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0481.wav", "duration": 5.2478125, "text": "眼睛警惕地注视着进出校门的车辆和学生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0158.wav", "duration": 4.3340625, "text": "确保完成六万户搬迁改造任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0252.wav", "duration": 4.7359375, "text": "缺乏对外投资长远规划等问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0196.wav", "duration": 3.374, "text": "起到了非常积极的作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0290.wav", "duration": 4.562, "text": "我们一直都在打造最好的产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0403.wav", "duration": 6.2170625, "text": "在英国议会关于血液兴奋剂的听证会中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0349.wav", "duration": 4.7519375, "text": "是综合格斗运动的一大特色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0412.wav", "duration": 2.5600625, "text": "据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0251.wav", "duration": 5.172, "text": "对考务费标准实行统一标准化管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0164.wav", "duration": 4.185, "text": "这才是一个大企业应该有的战略方向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0452.wav", "duration": 7.541, "text": "渣土车右转弯骑车男童被卷入车轮下不幸身亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0243.wav", "duration": 6.792, "text": "将考试费标准由各地自行制定改为实行上限管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0249.wav", "duration": 3.9040625, "text": "加快健全农业标准体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0250.wav", "duration": 3.7989375, "text": "确保境外企业和人员安全"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0346.wav", "duration": 4.0129375, "text": "链球贝蒂海德尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0396.wav", "duration": 3.7849375, "text": "在与阿拉木图的直接博弈中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0350.wav", "duration": 7.4550625, "text": "俄罗斯搏击新生代旗帜性天才高手哈亚在接受采访时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0290.wav", "duration": 5.9440625, "text": "从市场始终不愿给予苹果较高估值可见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0455.wav", "duration": 2.823, "text": "有网友称之为青春任性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0167.wav", "duration": 10.956, "text": "作为美国新型共享式办公与创新环境的运营品牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0480.wav", "duration": 4.2949375, "text": "没有发现近期有异常变化目前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0328.wav", "duration": 4.1748125, "text": "网络安全管理体系方面投资非常大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0173.wav", "duration": 3.88, "text": "但目前还未出现大面积提取行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0491.wav", "duration": 3.801, "text": "涉事两企业负责人均已被控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0232.wav", "duration": 7.021, "text": "妥善处理重金属污染历史遗留问题和突发污染事件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0402.wav", "duration": 5.8930625, "text": "由郎平挂帅的中国女排在名古屋赛区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0455.wav", "duration": 3.1699375, "text": "蚌飞市发生一起惨剧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0330.wav", "duration": 4.3159375, "text": "没有该认证的产品属于违法产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0152.wav", "duration": 3.079, "text": "美丽北京大型绿色公益品牌项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0149.wav", "duration": 4.25, "text": "在公积金松绑等作用的刺激下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0241.wav", "duration": 3.089, "text": "也降低了城投债券的风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0204.wav", "duration": 5.645, "text": "您如何看待城投债券这几年的发展和作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0443.wav", "duration": 7.1681875, "text": "其中一组中国旅游购物者全面攻陷日本的图片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0232.wav", "duration": 6.454, "text": "对城市轨道交通运营企业实行电价优惠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0151.wav", "duration": 4.135, "text": "北京针对公积金的调整次数便达到五次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0475.wav", "duration": 7.172125, "text": "首都机场公安分局航站区派出所联合驻场安检人员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0351.wav", "duration": 7.3549375, "text": "分别是位于北京市区的国家速滑馆和延庆的二个雪场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0390.wav", "duration": 6.1799375, "text": "主要是四号位的高点强攻和六号位的后排进攻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0338.wav", "duration": 5.099, "text": "只要在明天的最后一战中赢下东道主日本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0421.wav", "duration": 2.712875, "text": "没有人同我讲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0434.wav", "duration": 3.875, "text": "原本自费项目变成必须交费项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0441.wav", "duration": 2.978, "text": "该保安为附近大厦保安"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0146.wav", "duration": 5.9359375, "text": "但仍存在七万最高贷款额申请难等落地问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0482.wav", "duration": 4.855, "text": "数千围观人群高呼打死这个杂碎"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0393.wav", "duration": 4.2951875, "text": "对阵中国这样的球队是非常困难的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0190.wav", "duration": 3.086, "text": "彻底查明事故原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0369.wav", "duration": 4.0019375, "text": "这是一场没有输家的经典比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0491.wav", "duration": 5.344, "text": "网友先在微博中陈述了悲惨遭遇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0213.wav", "duration": 6.276, "text": "国务院国资委将指导中央企业之间加强境外投资合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0237.wav", "duration": 3.6800625, "text": "提高农业物质技术水装备水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0313.wav", "duration": 5.1520625, "text": "紫光集团系清华控股旗下最主要的资产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0242.wav", "duration": 5.469, "text": "重点治理农村土壤饮用水水源地污染"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0218.wav", "duration": 2.99, "text": "发展农产品电子商务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0282.wav", "duration": 2.8570625, "text": "并不像乔布斯那样激动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0314.wav", "duration": 4.2211875, "text": "消费者在听销售人员介绍小天才手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0364.wav", "duration": 6.4968125, "text": "令人防不胜防播求的肘击则更具王者霸气"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0224.wav", "duration": 5.6960625, "text": "虽然已发行的城投债券的还本付息都是正常的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0241.wav", "duration": 3.2310625, "text": "相对于目前的负债规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0379.wav", "duration": 4.8818125, "text": "二十一日抵达日本的朴泰桓目前确实在东京"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0345.wav", "duration": 4.818125, "text": "这位英气十足的九零后很有人缘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0141.wav", "duration": 5.329, "text": "兰州新建住宅价格均呈现微降的态势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0423.wav", "duration": 6.2878125, "text": "中新网六月十六日电六月十六日是容祖儿的生日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0125.wav", "duration": 5.73, "text": "今年一到七月全国房地产开发投资五万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0124.wav", "duration": 4.267, "text": "土地相关的审查成为重点之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0350.wav", "duration": 5.9279375, "text": "今天出色的数据也佐证了她身体的康复情况良好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0490.wav", "duration": 2.9350625, "text": "却是一块大大的唐僧肉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0414.wav", "duration": 4.6010625, "text": "陈奕迅坦言自己一直有情绪病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0486.wav", "duration": 5.1730625, "text": "崂山景区勒令该农家宴停止停止营业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0174.wav", "duration": 7.19, "text": "对于外商房企的注册资本金降低要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0335.wav", "duration": 3.3359375, "text": "这样很容易被黑客攻破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0296.wav", "duration": 4.2219375, "text": "早在九月九日发布会上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0212.wav", "duration": 3.499, "text": "从已发行的城投债券用途看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0139.wav", "duration": 4.55, "text": "不用花那么大的成本去解决安全的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0144.wav", "duration": 5.359, "text": "之后由该信托对宋芳指定的房产发出购买要约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0124.wav", "duration": 3.515, "text": "大部分的创业者举步艰辛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0482.wav", "duration": 4.600125, "text": "他的双手还保持着托举的姿势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0373.wav", "duration": 8.249, "text": "要将北京市业馀排球联赛打造成群众性品牌赛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0466.wav", "duration": 4.2101875, "text": "非法倾倒数百吨化工废料"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0437.wav", "duration": 5.437, "text": "对允许其亲自过问的案件提出严格限定标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0314.wav", "duration": 3.912125, "text": "二零一三年二零一四年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0335.wav", "duration": 5.7800625, "text": "二零一四年其市场规模已达七十一五亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0280.wav", "duration": 3.4139375, "text": "在融资和发展海外市场上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0202.wav", "duration": 5.7170625, "text": "这个问题涉及到一系列的制度完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0175.wav", "duration": 2.579, "text": "开始加速进入新房市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0221.wav", "duration": 3.859, "text": "建立转基因生物安全保障体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0367.wav", "duration": 5.3730625, "text": "能够亲眼见证这场火爆刺激的的精彩大战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0367.wav", "duration": 3.3210625, "text": "速度呈现出直线下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0123.wav", "duration": 6.631, "text": "公积金贷款最高额度由七万元提升至十万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0423.wav", "duration": 3.949, "text": "两人因合作神雕侠侣擦出爱火"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0394.wav", "duration": 3.818125, "text": "迈克尔斯齐莱德尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0408.wav", "duration": 2.9309375, "text": "潘玮柏以侧颜出镜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0431.wav", "duration": 4.6730625, "text": "经兴安县人大常委会许可"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0247.wav", "duration": 5.291, "text": "并及时发布产品缺陷及信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0287.wav", "duration": 4.948, "text": "大鸦无人机由美国航空环境公司研制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0171.wav", "duration": 3.4, "text": "银行房贷额度开始紧张"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0149.wav", "duration": 3.608, "text": "企业不接触客户个人资料"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0400.wav", "duration": 7.222875, "text": "从四分之一决赛开始每场比赛评选出一名优秀运动员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0371.wav", "duration": 5.118875, "text": "中国的冬季运动还处于半起步阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0189.wav", "duration": 4.14, "text": "创建国家现代农业示范区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0184.wav", "duration": 4.3970625, "text": "因此操作环节的快捷性与便捷性非常重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0128.wav", "duration": 4.784, "text": "在公积金贷款额度上调后一个月内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0248.wav", "duration": 4.094, "text": "政府将完善境外投资统计制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0129.wav", "duration": 6.2360625, "text": "对于中国楼市的影响不必过于乐观"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0273.wav", "duration": 4.5180625, "text": "从不可一世到遭对手边缘化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0412.wav", "duration": 5.767125, "text": "在凭借专辑米闪成为新一轮金曲歌王后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0130.wav", "duration": 3.201, "text": "多数二线城市和三四线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0283.wav", "duration": 5.2690625, "text": "形成高度定制化的集成产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0448.wav", "duration": 2.9260625, "text": "澎湃新闻在现场看到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0414.wav", "duration": 4.8200625, "text": "不过她出道以来身材一直是外界关注的焦点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0147.wav", "duration": 2.835, "text": "从业人员五万人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0168.wav", "duration": 4.134, "text": "从目前上海住房公积金的具体政策看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0176.wav", "duration": 3.406, "text": "一线城市由于需求面大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0222.wav", "duration": 5.1430625, "text": "部分中央企业的结构调整还存在一些困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0123.wav", "duration": 5.577, "text": "审计署审计长刘家义受国务院委托"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0495.wav", "duration": 5.7636875, "text": "村小组干部未经过小组集集体讨论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0483.wav", "duration": 5.5859375, "text": "但这也让首次来到陕西游玩的孙女士感到憋屈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0159.wav", "duration": 5.9770625, "text": "龙湖即以低价五点五亿元拿地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0194.wav", "duration": 6.864, "text": "积极推动土地出让收益用于高标准农田建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0246.wav", "duration": 7.645, "text": "在我国出现政府性债务违约的可能性是不大的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0478.wav", "duration": 3.2319375, "text": "渤海垃圾成堆变死海"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0447.wav", "duration": 7.5131875, "text": "菜单显示该饭店的荞麦窝窝头卖三八元一个"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0357.wav", "duration": 5.5690625, "text": "以一小时二十一分十一秒成绩获铜牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0454.wav", "duration": 4.7419375, "text": "索赔各项损失共计二零馀万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0326.wav", "duration": 2.423, "text": "电话手表对儿童安全吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0246.wav", "duration": 9.7580625, "text": "建立和完善农作物病虫害专业化统防统治补助政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0438.wav", "duration": 5.2380625, "text": "北京晨报记者昨天获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0386.wav", "duration": 2.9869375, "text": "但我觉得郎导是最苦的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0428.wav", "duration": 4.8520625, "text": "搜狐娱乐讯据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0335.wav", "duration": 5.0500625, "text": "紫光股份拟定增募资二百二十五亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0422.wav", "duration": 2.4819375, "text": "只有他们才知道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0491.wav", "duration": 4.8989375, "text": "一零月二三曰现身成都平乐古城"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0391.wav", "duration": 4.3559375, "text": "为他参加里约奥运扫清最后的障碍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0322.wav", "duration": 6.24875, "text": "建议家长通过正规渠道购买正规厂家生产的产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0258.wav", "duration": 5.246125, "text": "即是在新品发布前的一个多季度的时间内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0235.wav", "duration": 4.3880625, "text": "大力发展农产品加工和流通业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0438.wav", "duration": 7.7009375, "text": "东越花苑不少商铺都关门转租记者谢国林摄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0123.wav", "duration": 5.308, "text": "今久整合营销集团迎来了它的十岁生日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0169.wav", "duration": 4.895, "text": "约六成网友看涨全国的商品房价格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0483.wav", "duration": 5.6958125, "text": "村支书违规建小产权房花钱买通所有关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0215.wav", "duration": 5.413, "text": "推广防灾减灾增产关键技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0366.wav", "duration": 9.0600625, "text": "近日德郭队公布了参加此次世锦赛的六六人大名单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0311.wav", "duration": 4.1530625, "text": "尽管网络安全目前投入成本大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0490.wav", "duration": 7.827875, "text": "游客再曝日照点海鲜太少被围殴当地警方证实"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0315.wav", "duration": 4.975125, "text": "消费者在听销售人员介绍小天才手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0199.wav", "duration": 4.7320625, "text": "加快发展生物育种战略性新兴产业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0336.wav", "duration": 4.34, "text": "也就是老板电器总结的自动加互动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0224.wav", "duration": 4.4870625, "text": "也具有间接的经济效益或社会效益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0382.wav", "duration": 4.194125, "text": "特别是我们今年刚开始的时候特别艰难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0469.wav", "duration": 3.593, "text": "孰料从上月底开始平台关闭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0343.wav", "duration": 4.3469375, "text": "只要中国队需要有人挺身而出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0195.wav", "duration": 5.259, "text": "带动周边地区现代农业加快发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0355.wav", "duration": 5.291, "text": "孙杨在一千五百米自由泳上的实力不容置疑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0187.wav", "duration": 5.882, "text": "建立健全以工促农以城带乡的长效机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0479.wav", "duration": 6.714125, "text": "且逢餐必有烟酒从园区领导到村组干部"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0217.wav", "duration": 6.1120625, "text": "主要由于各各种基础设施的投资建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0415.wav", "duration": 4.0539375, "text": "婷婷就坦言靠传媒得知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0476.wav", "duration": 7.2260625, "text": "这听起来多少有些匪夷所思的违建竟然是真的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0204.wav", "duration": 5.471875, "text": "地方投融资平台公司通过发行债券进行融资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0206.wav", "duration": 4.457, "text": "在工业化城镇化快速推进时期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0268.wav", "duration": 6.0, "text": "促使这家公司获得了创记录的第四财季盈利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0390.wav", "duration": 6.0090625, "text": "另外还有两名来自加拿大和美国的外籍华侨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0321.wav", "duration": 4.5, "text": "威灵电机今后兼并美芝压缩机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0441.wav", "duration": 4.3569375, "text": "双方矛盾的焦点是一只瑞士名表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0355.wav", "duration": 5.379875, "text": "这些使得北京积累了大量的举办与运营经验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0130.wav", "duration": 6.8010625, "text": "上海易居研究院研究院严跃进认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0398.wav", "duration": 2.471875, "text": "在场上移动很好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0189.wav", "duration": 5.29, "text": "加快发展现代农业机遇遇得"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0336.wav", "duration": 2.7429375, "text": "裁员两千人是由"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0472.wav", "duration": 6.9829375, "text": "港媒关注马云回应被逼捐花钱比挣钱难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0343.wav", "duration": 3.9760625, "text": "从申办冬奥会的硬件基础上看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0175.wav", "duration": 3.611, "text": "作为楼市政策的风向标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0161.wav", "duration": 6.6860625, "text": "今年房地产市场地域分化将加剧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0330.wav", "duration": 3.9921875, "text": "一期投资额为二十五亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0454.wav", "duration": 4.1481875, "text": "今年三月份经检验为合格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0377.wav", "duration": 4.735125, "text": "判决结果成为他能否参加里约奥运的变数"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0465.wav", "duration": 4.9658125, "text": "看似犀利不再的娜姐老将气场立刻显出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0400.wav", "duration": 5.6909375, "text": "不仅在各国网络社区和比赛中表现活跃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0467.wav", "duration": 6.5749375, "text": "云盘就是一种直接把信息存在网络空间里的存储工具"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0231.wav", "duration": 3.7730625, "text": "作为城投债券发行监管部门"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0444.wav", "duration": 2.7570625, "text": "与小区只有一河之隔的东边"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0299.wav", "duration": 4.7309375, "text": "排名从第九升至第七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0275.wav", "duration": 3.626125, "text": "准备和特斯拉一较高下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0150.wav", "duration": 3.0790625, "text": "据中新网房产频道梳理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0377.wav", "duration": 4.453125, "text": "开始一项新的锻炼方式具有一定的风险性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0163.wav", "duration": 7.104, "text": "北京又一家共享创办公平台落地丰台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0444.wav", "duration": 3.4030625, "text": "抓着男生的动作为摆拍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0344.wav", "duration": 6.2058125, "text": "这一点对于京津冀一带的居民来说是才最重要的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0357.wav", "duration": 3.046, "text": "虽然知道惠若琪的心脏不太好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0128.wav", "duration": 7.755, "text": "而就昨日六部委松绑楼市限外令的情况来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0351.wav", "duration": 6.864, "text": "两人把更多的精力放到了花滑运动的推广上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0356.wav", "duration": 5.3510625, "text": "还有记者爆料说居住在纽约的日本人透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0146.wav", "duration": 4.7090625, "text": "今年是十二五规划的收官之年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0490.wav", "duration": 6.9699375, "text": "温州服务员向顾客头上泼开水继而已被批捕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0345.wav", "duration": 5.948, "text": "同詹姆斯昔年头号强敌卡梅隆安东尼如出一辙"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0127.wav", "duration": 4.7460625, "text": "比如北京和上海家庭最高贷款额度均为一百万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0479.wav", "duration": 7.078125, "text": "游客偷走雷峰塔砖块想供奉起来做药给老人喝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0458.wav", "duration": 5.465125, "text": "事发后派出所和物价局都互相踢皮球"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0297.wav", "duration": 4.913, "text": "而后者则是刚刚涌现的后起之秀"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0401.wav", "duration": 7.8559375, "text": "日本二零一五女排世界杯单循环赛战至第十轮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0476.wav", "duration": 4.0288125, "text": "但因海上风大浪急影响救援"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0245.wav", "duration": 3.913, "text": "将切实减轻考生经济负担"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0437.wav", "duration": 10.139875, "text": "游客日照海鲜店被打受伤警方称言语冲突引发互殴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0248.wav", "duration": 3.582, "text": "对于江苏的机场高速是否免费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0494.wav", "duration": 8.985125, "text": "港京航班六名乘客推撞地勤四人被判九至一一天监禁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0241.wav", "duration": 7.219, "text": "完善农业气象等方面的航空站和作业起降点基础设施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0291.wav", "duration": 6.1320625, "text": "柯振东入狱期间的囚服都能在淘宝上热卖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0191.wav", "duration": 4.8239375, "text": "导致城投债券发行产生较高的风险溢价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0240.wav", "duration": 6.274875, "text": "本报记者曹志为王婷王颖春来源中国证券报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0172.wav", "duration": 3.792, "text": "出让金合计一千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0310.wav", "duration": 3.646, "text": "包括外置天线和内置天线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0282.wav", "duration": 5.6999375, "text": "触控科技全资韩国子公司在韩国上市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0347.wav", "duration": 5.5, "text": "终止时间定格在二分二十一秒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0319.wav", "duration": 4.0, "text": "信息安全隐患也随之而来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0130.wav", "duration": 3.696, "text": "很多人受限购政策的影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0203.wav", "duration": 4.1469375, "text": "有的媒体甚至用井喷来描述"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0387.wav", "duration": 3.156, "text": "继续征战花样滑冰的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0220.wav", "duration": 5.343, "text": "城投债券作为中国债券市场的准市政债"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0240.wav", "duration": 5.058, "text": "大力推进标准化生产和集约化经营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0312.wav", "duration": 3.8659375, "text": "浪潮官方尚未给出回应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0142.wav", "duration": 7.217, "text": "虚增耕地质量不达标的分别占百分之十和百分之三十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0421.wav", "duration": 4.3899375, "text": "究竟是演戏还是积怨已深"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0408.wav", "duration": 4.402125, "text": "搞怪调皮吐舌卖萌娱乐频道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0228.wav", "duration": 6.9560625, "text": "不能简单地用寅吃卯粮来作价值判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0425.wav", "duration": 2.52975, "text": "他开心就好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0318.wav", "duration": 4.907, "text": "浪潮的特点在于定制化策略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0372.wav", "duration": 3.6791875, "text": "进一步提升了比赛品质"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0428.wav", "duration": 4.678, "text": "并自嘲的写道自幼就走性感风格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0491.wav", "duration": 5.646, "text": "四名法官系送达法律文书时被刺伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0131.wav", "duration": 5.37, "text": "为经济社会发展提供了重要基础和支持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0312.wav", "duration": 3.288125, "text": "正是由于销售模式的改变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0442.wav", "duration": 6.7590625, "text": "月亮和地球之间的平均距离仅为三五六八九六万公里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0164.wav", "duration": 2.491, "text": "环比增长百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0225.wav", "duration": 6.6740625, "text": "鼓励引导社会力量参与建设保障性住房及配套设施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0347.wav", "duration": 3.6269375, "text": "标枪克里斯丁胡宋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0464.wav", "duration": 7.9509375, "text": "港媒关注浙江暖男医生手术室播动画片哄小女孩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0400.wav", "duration": 3.2519375, "text": "在冈山的桃太郎体育馆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0203.wav", "duration": 3.5549375, "text": "是一个比较复杂的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0271.wav", "duration": 5.932875, "text": "谷歌的福利待遇他家基本都有"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0146.wav", "duration": 3.343, "text": "这一数值为二十馀万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0434.wav", "duration": 5.278125, "text": "近日又出现疯抢水果捡漏等事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0168.wav", "duration": 4.137125, "text": "一些三线城市取消限购及限贷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0443.wav", "duration": 4.303, "text": "政府出钱搬迁盖房的机会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0146.wav", "duration": 3.84, "text": "在兰州雁滩区域的一家楼盘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0328.wav", "duration": 4.788125, "text": "未来给我们的机会和空间是有限的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0426.wav", "duration": 3.712875, "text": "她表示应该是吃吃饭看电影之类的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0139.wav", "duration": 3.728, "text": "今久率先提出整合营销的概念"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0453.wav", "duration": 3.6379375, "text": "水星金星也将迎来观测良机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0269.wav", "duration": 4.8669375, "text": "支持开发者为其编写应用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0423.wav", "duration": 5.2170625, "text": "搜狐娱乐讯北京时间十月二十六日消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0257.wav", "duration": 4.043, "text": "这个机器人由高分子材料制成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0471.wav", "duration": 4.1638125, "text": "随着严重雾霾卷土重来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0445.wav", "duration": 3.2370625, "text": "摔毁无人机一事为杜撰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0419.wav", "duration": 2.2939375, "text": "现场气氛火爆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0131.wav", "duration": 4.0459375, "text": "公积金贷款上限能够复盖单套房总价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0148.wav", "duration": 7.56, "text": "可以使用公积金贷款的购房者将起码增加百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0125.wav", "duration": 3.338, "text": "盘活各地公积金资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0426.wav", "duration": 4.302, "text": "有进一步消息一定会通知大家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0318.wav", "duration": 3.885, "text": "一位商场场内部人士称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0140.wav", "duration": 4.106, "text": "正处于筑底回暖阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0197.wav", "duration": 6.2889375, "text": "则需要在发债时机和发债规模上进行合理的把握"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0390.wav", "duration": 6.1210625, "text": "女排三零阿根廷朱婷复出扣杀状态神勇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0195.wav", "duration": 3.635, "text": "提高农业利用外资水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0355.wav", "duration": 3.97, "text": "面对兵行诡道的波斯弯刀"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0341.wav", "duration": 8.26, "text": "在当天女子五二千克级自由搏击超级战中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0199.wav", "duration": 2.994, "text": "债券发行人是优质的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0154.wav", "duration": 3.867, "text": "加快公租房的配租进度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0408.wav", "duration": 4.761, "text": "搜狐娱乐据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0326.wav", "duration": 4.8308125, "text": "同比上升百分之二十三点零六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0196.wav", "duration": 4.023, "text": "依托农产品加工物流等各类农业园区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0480.wav", "duration": 4.1230625, "text": "手握电动栅栏遥控器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0354.wav", "duration": 3.579, "text": "曾春蕾介绍是在中国女排出发的前一天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0340.wav", "duration": 4.0, "text": "通过对脚踝和小腿等部位的强化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0324.wav", "duration": 4.97, "text": "有一部分研发楼办公楼是利用现成的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0270.wav", "duration": 3.9609375, "text": "他们没有必要着急回本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0343.wav", "duration": 4.843, "text": "我们还将继续加大污染防治力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0494.wav", "duration": 6.234875, "text": "一捧玛卡磨成粉景区商家要四零零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0449.wav", "duration": 6.5900625, "text": "村干部强揽工程遭拒绝雇百名老人阻挠施工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0428.wav", "duration": 2.478, "text": "论眉毛重要性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0372.wav", "duration": 4.594, "text": "以三比一胜出拿到了宝贵的三个积分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0417.wav", "duration": 5.171875, "text": "然而准备中三个字卸掉了他的纠结"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0425.wav", "duration": 6.0610625, "text": "陈凯琳的心被郑嘉颖成功俘虏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0159.wav", "duration": 4.8869375, "text": "由于家族信托的存续期通常较长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0149.wav", "duration": 9.214, "text": "正式放松外贸外资投资我国房地产相关规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0247.wav", "duration": 6.3160625, "text": "继续向农民免费提供测土配方施肥服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0448.wav", "duration": 4.2460625, "text": "垃圾刺鼻的臭味害得住户们连窗户都不敢打开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0168.wav", "duration": 8.072, "text": "六部门出台新政楼市限外政策放松"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0305.wav", "duration": 3.4179375, "text": "注定了它强烈的娱乐性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0440.wav", "duration": 9.8139375, "text": "温州二零位面包师制出二五米蛋糕或申报吉尼斯纪录"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0445.wav", "duration": 3.958, "text": "其身后的财产分割问题尘埃落定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0198.wav", "duration": 3.819, "text": "三是科技支撑将更加有力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0249.wav", "duration": 3.652, "text": "强化农业科技和人才支撑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0348.wav", "duration": 4.3740625, "text": "在比赛中展示出更多击败对手的手段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0139.wav", "duration": 4.6340625, "text": "预计不会在短期内迅速回暖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0149.wav", "duration": 4.438, "text": "破解棚户区改造征收瓶颈问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0152.wav", "duration": 4.497, "text": "房地产开发企业土地购置面积很大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0471.wav", "duration": 4.506125, "text": "参考消息网八月二五日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0272.wav", "duration": 5.5229375, "text": "高频交易也与此次闪崩事件逃脱不了干系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0486.wav", "duration": 4.045125, "text": "陆续派记者深入采访"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0261.wav", "duration": 5.0, "text": "苹果将引入这样一套顾客接待系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0466.wav", "duration": 3.8210625, "text": "并处罚金人民币一千元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0298.wav", "duration": 5.74, "text": "二零一四年春天打车软件补贴大战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0130.wav", "duration": 6.649, "text": "将使更多购房者具备买房支付能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0190.wav", "duration": 3.432, "text": "国务院国资委力挺国企"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0239.wav", "duration": 3.699, "text": "政府财力增长也相应较快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0126.wav", "duration": 6.5929375, "text": "外资只可以购买商铺写字楼等物业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0406.wav", "duration": 4.282, "text": "来源时光网美国时间本周一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0236.wav", "duration": 5.225, "text": "加快农业科技成果转化与推广应用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0486.wav", "duration": 3.3200625, "text": "近日在医院检查才发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0204.wav", "duration": 3.5650625, "text": "新增农田有效灌溉面积万亩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0402.wav", "duration": 5.6440625, "text": "泰拳黑王子播求无疑同小皇帝詹姆斯最为相似"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0484.wav", "duration": 4.0119375, "text": "称一名男子时常偷窥自己洗澡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0309.wav", "duration": 2.838, "text": "大盘股仍是毫无作为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0358.wav", "duration": 3.521, "text": "我们要做的就是相互弥补"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0377.wav", "duration": 4.7839375, "text": "以表演的方式推广花样滑冰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0461.wav", "duration": 5.249, "text": "周云露的父母在昨天上午去过朝阳刑警队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0435.wav", "duration": 3.722875, "text": "看来温州市区电梯也该大整修了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0453.wav", "duration": 3.3200625, "text": "赵女士的公公躺在病床上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0147.wav", "duration": 4.39, "text": "新京报讯记者张徐报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0347.wav", "duration": 7.8369375, "text": "而主教练郎平则在全面性方面对大家做了更多要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0286.wav", "duration": 3.6319375, "text": "他们推出的产品不仅非常鸡肋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0198.wav", "duration": 4.3570625, "text": "既是信贷投放回归常态的体现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0186.wav", "duration": 5.709, "text": "事业版图遍布全中国的集团化整合营销公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0267.wav", "duration": 8.6420625, "text": "该应用交付网络在整个榜单中位居第四"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0144.wav", "duration": 4.529, "text": "公积金贷款可少缴三十馀万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0277.wav", "duration": 4.0500625, "text": "为提高苹果零售商店的服务质量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0156.wav", "duration": 5.8139375, "text": "受土地开发政策和土地规划限制未开发建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0144.wav", "duration": 2.969, "text": "据广州日报昨天报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0218.wav", "duration": 5.362875, "text": "听取对中央企业监督检查情况的汇报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0240.wav", "duration": 3.142, "text": "加强农村环境保护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0369.wav", "duration": 5.063, "text": "多年来围绕其性取向的争论一直没有停息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0280.wav", "duration": 5.322, "text": "安吉拉要求零售店员工养精蓄锐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0384.wav", "duration": 3.801, "text": "最后顶住困难和压力拿到冠军"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0325.wav", "duration": 6.003875, "text": "包括管理人员等并不会因为新增生产线而增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0152.wav", "duration": 4.234, "text": "其中五亿元为超额拨备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0413.wav", "duration": 3.605, "text": "许玮甯最近到法国工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0478.wav", "duration": 8.5380625, "text": "村民为救坠井男童身亡被拉出时呈托举姿势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0319.wav", "duration": 5.1489375, "text": "注定是白色家电行业最惨烈的一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0336.wav", "duration": 5.4778125, "text": "浪潮高管在接受媒体采访时表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0408.wav", "duration": 2.447, "text": "据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0485.wav", "duration": 5.219, "text": "数百名乡邻自发赶来送他一程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0464.wav", "duration": 3.283, "text": "发现事情并没有这么简单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0380.wav", "duration": 5.900875, "text": "长期跑步可能是一种不需要药物来保持身材的有效方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0212.wav", "duration": 7.96, "text": "为从根本上缓解交通拥堵出行不便环境污染等矛盾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0147.wav", "duration": 5.642, "text": "中小房企要面临高达两位数利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0327.wav", "duration": 3.3969375, "text": "可以缩减很多人力成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0353.wav", "duration": 6.907, "text": "两位气质迥异的选手展示出了全然不同的擂台风格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0343.wav", "duration": 8.5890625, "text": "盘点昆仑决二零一五五大飙血之战搜狐体育"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0405.wav", "duration": 6.5, "text": "好莱坞当红明星之前曾被盛传将扮演斯诺登"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0253.wav", "duration": 2.6999375, "text": "并没有提供什么帮助"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0177.wav", "duration": 3.823, "text": "房企更加愿意扎堆一线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0122.wav", "duration": 5.346, "text": "近期广州和南京已经开始启动公转商贷款贴息模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0250.wav", "duration": 3.7459375, "text": "会议还研究了其他事项"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0468.wav", "duration": 4.4150625, "text": "此案正在进一步审理之中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0492.wav", "duration": 3.370125, "text": "他被迫交了四零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0129.wav", "duration": 4.633, "text": "全国房地产开发投资三万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0316.wav", "duration": 4.4189375, "text": "国产服务器厂商迎来利好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0342.wav", "duration": 4.443125, "text": "年少成名的他带领国家队出征冬奥会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0337.wav", "duration": 5.631, "text": "威灵电机将有可能兼并美芝压缩机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0451.wav", "duration": 3.3940625, "text": "导致崔先生腰部受伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0322.wav", "duration": 4.3669375, "text": "比如流程的缩短平台化的应用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0342.wav", "duration": 5.7250625, "text": "张晓雅的人气肯定在前三名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0422.wav", "duration": 2.827875, "text": "他表示感到伤痛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0488.wav", "duration": 4.744125, "text": "一个国家稳定的社会结构呈橄榄形"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0162.wav", "duration": 3.3720625, "text": "同比增长百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0194.wav", "duration": 6.854, "text": "在制度上对债券人的合法权益进行保护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0160.wav", "duration": 5.208, "text": "今年国有土地使用权出让收入四千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0177.wav", "duration": 3.5829375, "text": "以住房公积金制度为基础"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0165.wav", "duration": 4.58, "text": "购房者受惠于政策利好的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0287.wav", "duration": 3.678, "text": "苹果要想在中国本土化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0485.wav", "duration": 5.9758125, "text": "按照中央纪委宣传部的统一部署"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0329.wav", "duration": 5.0239375, "text": "有一家公司表示能够及时检测黑客入侵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0377.wav", "duration": 4.157, "text": "就像认识多年的朋友和兄弟姐妹一样"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0402.wav", "duration": 5.389875, "text": "以不同方式助力本次比赛胜利进行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0414.wav", "duration": 2.8198125, "text": "搜狐娱乐讯日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0126.wav", "duration": 3.6110625, "text": "目前全国该指标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0450.wav", "duration": 5.0869375, "text": "参考消息网七月二零日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0204.wav", "duration": 3.974, "text": "坚持海陆统筹河海兼顾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0227.wav", "duration": 5.26, "text": "加强渔政基地和管理信息系统建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0487.wav", "duration": 3.743875, "text": "并索偿该游客全部损失"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0327.wav", "duration": 6.8661875, "text": "上一次是金融危机期间的二零零九一季度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0216.wav", "duration": 3.5030625, "text": "城市文化和体育设施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0486.wav", "duration": 3.7419375, "text": "就花钱请领导为他撑腰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0286.wav", "duration": 8.9980625, "text": "就让业界讨论它会带给中国移动支付市场怎样的影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0432.wav", "duration": 5.534875, "text": "温州瑞安一驾考考生在科目三考试中突然晕了过去"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0140.wav", "duration": 3.104, "text": "可大家必须明白一个道理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0489.wav", "duration": 3.0908125, "text": "事故厂房系违章建筑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0424.wav", "duration": 3.5490625, "text": "昨天她出席保养品活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0131.wav", "duration": 3.078, "text": "一智能产品的安全"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0161.wav", "duration": 7.842, "text": "而且提供各项衍生的福利性服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0271.wav", "duration": 4.408125, "text": "也可能会是受到国家支持的攻击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0420.wav", "duration": 2.333, "text": "她突然就干呕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0300.wav", "duration": 6.035875, "text": "三藩市纪事报指此君曾与库克碰头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0206.wav", "duration": 6.4189375, "text": "中国证券报随着欧美等国主权债务危机陆续爆发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0488.wav", "duration": 5.472875, "text": "共造成一四人死亡三三人受伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0128.wav", "duration": 2.811, "text": "一五年一月份"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0222.wav", "duration": 5.21, "text": "加大农机化薄弱环节生产机械补贴力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0265.wav", "duration": 4.8399375, "text": "导致技术支持时间超过了预期分配时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0439.wav", "duration": 3.8139375, "text": "涉事企业老板已被警方控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0427.wav", "duration": 5.660875, "text": "曾江当时说我和谢贤相识多年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0135.wav", "duration": 4.6810625, "text": "今久必须担当起引领时代潮流的重任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0380.wav", "duration": 6.297875, "text": "杨扬拿到了五百米和一千米两项短道速的金牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0271.wav", "duration": 9.0, "text": "据新华社电美国国际贸易委员会二十一日作出终裁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0289.wav", "duration": 3.004, "text": "这对苹果是一个利好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0332.wav", "duration": 4.208, "text": "依据国家相关法律法规"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0175.wav", "duration": 3.69, "text": "除了开发商的买地行为减少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0453.wav", "duration": 5.026875, "text": "肇事车及损伤严重的自行车报料人供图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0362.wav", "duration": 5.297125, "text": "我们的奥运健儿将在此努力备战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0199.wav", "duration": 6.5920625, "text": "改革将对考试单位的费用支出形成倒逼机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0317.wav", "duration": 5.4299375, "text": "很多家长都在给孩子购置各种学习用品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0249.wav", "duration": 6.917, "text": "全面推进机械化标准化品牌化产业化发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0343.wav", "duration": 4.306875, "text": "此次播求面对的强敌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0397.wav", "duration": 5.8249375, "text": "这次赛事是昆仑决二零一五欧洲之旅的第三站"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0121.wav", "duration": 6.559, "text": "该地块即为通州新城核心地标彩虹之门用地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0312.wav", "duration": 3.344, "text": "以小天才电话手表为例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0474.wav", "duration": 3.897, "text": "村委会竟然会顶风作案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0152.wav", "duration": 4.499, "text": "一个天河区的中介人士告诉记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0251.wav", "duration": 3.557, "text": "积极发展资源节约型和环境友好型农业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0414.wav", "duration": 3.812, "text": "他调皮地将自己的眉毛抹掉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0491.wav", "duration": 5.012, "text": "海南临高籍多位渔民向中新网记者反应称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0477.wav", "duration": 3.8459375, "text": "严格搜集和固定相关证据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0405.wav", "duration": 4.995125, "text": "我们可以清晰看到皮特的结婚戒指"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0429.wav", "duration": 3.531, "text": "陈晓与陈妍希承认恋情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0278.wav", "duration": 4.453, "text": "针对中美光伏贸易纠纷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0244.wav", "duration": 7.692, "text": "价格主管部门将按统一合理的平均成本确定考试费用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0255.wav", "duration": 3.1440625, "text": "对未来的销量至关重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0183.wav", "duration": 5.1889375, "text": "我国楼市正处在急速上升通道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0329.wav", "duration": 5.235125, "text": "必须取得无线电型号的核准认证"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0343.wav", "duration": 8.5659375, "text": "高桥大辅堪称日本花样滑冰男单领域的领军人物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0129.wav", "duration": 4.247, "text": "这对于目前一线城市来说很紧要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0463.wav", "duration": 4.5749375, "text": "面积达逾三零零平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0158.wav", "duration": 3.534875, "text": "只有楼市库存真正消化了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0237.wav", "duration": 3.0140625, "text": "还本付息也是正常的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0199.wav", "duration": 5.401, "text": "做好涉农国际贸易规定制动工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0492.wav", "duration": 4.5749375, "text": "应邀参加第二届天府古镇艺术节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0374.wav", "duration": 3.494875, "text": "这才是产生跑步力量的根源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0274.wav", "duration": 6.3719375, "text": "消费者贪新忘旧虽亦可能适用于苹果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0450.wav", "duration": 5.1230625, "text": "渝蓉高速四川段因烂尾被称为最拖沓高速"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0486.wav", "duration": 5.5661875, "text": "尸体于一零月二零日在宝鸡渭河公园被发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0425.wav", "duration": 2.6450625, "text": "且沿途有说有笑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0347.wav", "duration": 4.204875, "text": "让越来越多人关注并参与到其中来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0256.wav", "duration": 5.332, "text": "最关键的两个属性莫过于安全和便捷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0376.wav", "duration": 4.0378125, "text": "他们每天手牵手肩并肩出入赛场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0354.wav", "duration": 5.291, "text": "无疑是刚刚结束的喀山世锦赛最大的遗憾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0469.wav", "duration": 6.2309375, "text": "杀害夜跑女子嫌犯不言不语拾荒者身份尚未确认"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0207.wav", "duration": 3.7989375, "text": "政府性违约可能性不大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0332.wav", "duration": 6.364, "text": "不得接入公用电信网使用和在国内销售"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0244.wav", "duration": 3.699, "text": "进一步优化农业生产力布局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0189.wav", "duration": 4.1479375, "text": "发行利率也有较大幅度上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0287.wav", "duration": 6.9149375, "text": "手腕是配戴轻便型互动设备与休闲设备的理想之处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0416.wav", "duration": 5.0488125, "text": "诸葛紫岐十日晚出席活动时表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0204.wav", "duration": 7.061, "text": "目前我国出现政府性债务违约可能性并不大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0489.wav", "duration": 5.22775, "text": "但对于部分村官及个别政府工作人员来说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0410.wav", "duration": 5.8410625, "text": "网友纷纷留言祝谢婷婷生日快乐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0191.wav", "duration": 3.682, "text": "行业协会清理整顿报告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0132.wav", "duration": 10.217, "text": "境外机构和个人在中国投资购买房地产的限制放松"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0339.wav", "duration": 3.172125, "text": "彻底解决目前存在的隐患"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0172.wav", "duration": 3.598, "text": "住宅市场交易明显升温"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0393.wav", "duration": 5.3969375, "text": "希望能够跟大家一起再次站在领奖台上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0172.wav", "duration": 5.0, "text": "由于不可能从根本上改变供求关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0145.wav", "duration": 3.8130625, "text": "可由于中心城区楼盘数量稀少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0451.wav", "duration": 6.8290625, "text": "信息时报讯记者陈子玉近日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0397.wav", "duration": 6.396, "text": "意志力惊人的白俄罗斯特种兵被没有就此放弃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0457.wav", "duration": 5.395, "text": "并责令其立即改正价格违法行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0200.wav", "duration": 4.5999375, "text": "优化生产布局和畜群结构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0238.wav", "duration": 6.0390625, "text": "就不得再通过发行城投债券新增政府性债务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0395.wav", "duration": 6.218, "text": "赛艇比赛所在湖区的水污染问题近年来得到改善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0165.wav", "duration": 6.412, "text": "纯商品房楼面价接近六万元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0262.wav", "duration": 8.1169375, "text": "加上它凭借远程雷达与对方舰队保持远距离"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0335.wav", "duration": 4.1489375, "text": "北京商报讯记者王晔君日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0419.wav", "duration": 2.8569375, "text": "小笼包身体有反应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0203.wav", "duration": 4.1259375, "text": "他就上述关注问题指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0300.wav", "duration": 6.9300625, "text": "不过更新后锻炼和运动手臂的时候不会记录心率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0208.wav", "duration": 4.844, "text": "加快先进适用耕作技术推广应用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0237.wav", "duration": 9.385, "text": "构建全国农产品质量安全监测信息预警平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0481.wav", "duration": 6.9179375, "text": "游客脚踩烈士铜像拍照四名当事人鞠躬道歉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0325.wav", "duration": 6.3889375, "text": "再次利用同样的静默安装方式继续推广软件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0248.wav", "duration": 2.723, "text": "清洁水源田园和家园"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0453.wav", "duration": 8.223875, "text": "温州网讯在温医大附属育英儿童医院的重监护室里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0333.wav", "duration": 2.557, "text": "虽然电磁辐射无处不在"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0178.wav", "duration": 5.521, "text": "公积金提取一直是目前试图突破的内容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0420.wav", "duration": 4.099125, "text": "终站是好友谢霆锋的创作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0173.wav", "duration": 4.586, "text": "用蓝色光标强大的新媒体技术和资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0452.wav", "duration": 14.6999375, "text": "白云区钟落潭竹一村民白云区钟落潭竹一村的村民跟记者报料"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0170.wav", "duration": 5.568, "text": "在总成交中占比环比增加五个百分点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0409.wav", "duration": 6.2949375, "text": "最近人在大陆举行巡回演唱会的他"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0294.wav", "duration": 4.6630625, "text": "老毕对此说甚有保留"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0321.wav", "duration": 5.8300625, "text": "不排除有一些杂牌的电话手表辐射会超标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0166.wav", "duration": 4.5859375, "text": "是房地产当前发展格局下的一个必然"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0270.wav", "duration": 3.823, "text": "我国拥有近一四亿人口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0220.wav", "duration": 6.1590625, "text": "是一种合理的基础设施投融资建设行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0155.wav", "duration": 8.3589375, "text": "许多刚性住房和改善型住房需求得到释放"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0175.wav", "duration": 5.4979375, "text": "安徽铜陵结束了当地契税补贴政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0396.wav", "duration": 6.4921875, "text": "对于隋文静韩聪彭程张昊领衔的中国双人滑军团"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0485.wav", "duration": 7.714125, "text": "唐寨子村党支部书记村委会主任已被全镇通报批评"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0323.wav", "duration": 7.2690625, "text": "现在中国的八十五后和九十后消费人群已经成为消费主体"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0132.wav", "duration": 8.822, "text": "放宽提取住房公积金支付房租条件则对楼市影响甚微"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0297.wav", "duration": 3.7120625, "text": "悄无声息又经年累月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0382.wav", "duration": 3.1448125, "text": "桎梏挣脱开了就敢于发挥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0270.wav", "duration": 3.2939375, "text": "像索尼被黑那样的事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0255.wav", "duration": 6.1320625, "text": "衍生出软件服务的又一重要举措"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0481.wav", "duration": 3.8840625, "text": "住酒店还要交二零元马桶费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0298.wav", "duration": 4.131, "text": "根据苹果官方的支持页面显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0193.wav", "duration": 4.523, "text": "降低公众假日出行成本具有重要意义"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0127.wav", "duration": 6.766, "text": "而南昌除了放松首套房界定标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0456.wav", "duration": 6.147, "text": "温州三家熟食店摊主被捕为求卖相好添加日落黄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0320.wav", "duration": 3.442875, "text": "负责车辆网络安全问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0200.wav", "duration": 3.614, "text": "海南农产品流通现状"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0435.wav", "duration": 4.8820625, "text": "已经有游客迫不及待想去张家口看看了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0246.wav", "duration": 5.5379375, "text": "加强京津风沙源区草地治理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0140.wav", "duration": 3.852, "text": "其核心在于利用数字化工具"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0209.wav", "duration": 4.9919375, "text": "加大农村劳动力培训阳光工程实施力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0190.wav", "duration": 6.4279375, "text": "实践技能操作和面试类考试科目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0395.wav", "duration": 8.764875, "text": "她的母亲在采访中表示莎宾娜为了提升自己的实力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0397.wav", "duration": 4.012, "text": "在今年世锦赛的志愿者中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0449.wav", "duration": 7.666, "text": "港商被骗牵出路边地下钱庄涉案资金四三零零亿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0312.wav", "duration": 3.1320625, "text": "机器人维护成本是挑战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0198.wav", "duration": 5.1990625, "text": "实施好转基因生物新品种培育重大专项"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0225.wav", "duration": 5.465125, "text": "是为了进一步建立健全境外国有资产管理制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0138.wav", "duration": 5.105, "text": "要求各地放宽公积金贷款条件后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0382.wav", "duration": 5.7260625, "text": "莎宾娜透露目前单身理想型是喜欢运动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0378.wav", "duration": 4.74, "text": "从四百米预赛到最后的一千五百米预赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0468.wav", "duration": 4.563, "text": "被撞废的奔驰昨日二二时左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0239.wav", "duration": 4.4139375, "text": "难以满足发行城投债券的资格和条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0190.wav", "duration": 3.4819375, "text": "调整优化农业科研布局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0308.wav", "duration": 5.266125, "text": "从本年度第一份季报来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0146.wav", "duration": 4.325, "text": "相比千亿房企的借贷利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0371.wav", "duration": 8.8461875, "text": "身为上司而且已婚有儿女的桥本被指责涉嫌性侵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0121.wav", "duration": 3.056, "text": "为了解决额度荒的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0309.wav", "duration": 3.3891875, "text": "上述网络安全人士称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0444.wav", "duration": 6.1340625, "text": "耗时一四个小时打造的二米五超长蛋糕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0157.wav", "duration": 5.312, "text": "六年土地收入十三万度审计报告中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0323.wav", "duration": 5.1760625, "text": "与技术的更新换代速度还是有相关性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0248.wav", "duration": 6.079, "text": "扩大土壤有机质提升项目实施范围和规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0158.wav", "duration": 4.758, "text": "房地产业将在明年有所洗牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0439.wav", "duration": 3.6550625, "text": "将被以普通袭击罪起诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0192.wav", "duration": 6.558, "text": "战略性新兴产业在各地呈现出集聚蓬勃发展的态势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0400.wav", "duration": 4.9030625, "text": "我是这次中俄对抗赛第一个出场的中方选手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0396.wav", "duration": 4.1520625, "text": "这样一来可以获得韩国舆论的同情和理解"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0350.wav", "duration": 4.271, "text": "因此对于北京申办冬奥会的最终结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0207.wav", "duration": 5.438, "text": "合理规划和利用现有收费车道和免费专用通道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0175.wav", "duration": 3.398, "text": "按照公司持有房产计征"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0297.wav", "duration": 5.7999375, "text": "诸位自然不会满足于前面提及的潜在回报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0253.wav", "duration": 3.9649375, "text": "毛利率也只有百分之十四"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0463.wav", "duration": 3.417, "text": "经过长达四个月的搜救"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0381.wav", "duration": 2.8889375, "text": "个别球更是像释放怒火一般"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0244.wav", "duration": 5.052, "text": "开展农业物物联网应用示范"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0159.wav", "duration": 4.719, "text": "随着我国行政干预政策的陆续退出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0185.wav", "duration": 7.0, "text": "相关部门对公积金贷款政策的第三次放松"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0485.wav", "duration": 2.984875, "text": "家住汉阳的莎莎化名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0432.wav", "duration": 4.9030625, "text": "日前因为广东省高院作出的无罪判决"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0413.wav", "duration": 3.605, "text": "她最近又被拍到崩坏实录"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0248.wav", "duration": 4.1280625, "text": "并对债券市场形成了不小的冲击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0383.wav", "duration": 4.4450625, "text": "逐步成长为中国女排的新核心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0221.wav", "duration": 4.002, "text": "提高粮食生产综合效益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0492.wav", "duration": 5.4289375, "text": "公司承诺贷款本息都由公司负责偿还"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0267.wav", "duration": 5.585125, "text": "足够使美国失去战争基础因此彻底失败"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0316.wav", "duration": 5.805875, "text": "汽车这个行业缺乏成熟的网络安全管理体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0171.wav", "duration": 4.724, "text": "规定外商投资建立房地产企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0461.wav", "duration": 4.0, "text": "一三日上午一零时许"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0265.wav", "duration": 7.3249375, "text": "谷歌不仅会以优厚薪酬招募顶尖人才"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0200.wav", "duration": 5.105, "text": "徐林这个问题涉及到一系列的制度完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0253.wav", "duration": 7.6280625, "text": "比去年同期的六十二点三十亿美元大幅增长百分之十二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0465.wav", "duration": 4.124, "text": "下海后却突然失去意识"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0358.wav", "duration": 5.8100625, "text": "是孙杨在二零一四年因治疗心脏不适"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0274.wav", "duration": 6.2369375, "text": "这些公司在海外市场上市往往除了获得融资机会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0225.wav", "duration": 3.797, "text": "境外资产监管有待加强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0164.wav", "duration": 3.0879375, "text": "促进新型城镇化发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0146.wav", "duration": 7.844, "text": "一位房企人士认为五环内项目的稀缺性难以改变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0446.wav", "duration": 8.224875, "text": "骗取搬迁补助资金用于支付搬迁安置房费用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0346.wav", "duration": 5.7009375, "text": "以宋安东为首的运动员们可以说是鲜活的冬奥名片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0212.wav", "duration": 3.3199375, "text": "办法还特别提出一些建议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0167.wav", "duration": 5.051, "text": "今年北京土地市场仍然是高温状态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0218.wav", "duration": 4.87, "text": "稳定发展粮食和棉油糖生产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0334.wav", "duration": 3.032, "text": "汽车模具毛利率下滑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0223.wav", "duration": 3.8570625, "text": "未来应该在制度上作进一步完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0235.wav", "duration": 3.6379375, "text": "审计署的审计结论表明"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0396.wav", "duration": 5.296125, "text": "五零千米竞走卡尔多赫曼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0154.wav", "duration": 5.868, "text": "我国房地产市场过去从体偏紧部分地区过紧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0400.wav", "duration": 3.8420625, "text": "北京时间八月九日一五三零"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0374.wav", "duration": 6.593, "text": "而他们熟练掌握的秘笈是一次又一次反复的训练和排练"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0433.wav", "duration": 3.442125, "text": "二零一四九二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0373.wav", "duration": 6.349125, "text": "昆仑决广州站在广州天河体育中心成功打响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0471.wav", "duration": 4.4460625, "text": "诱逼女教练陪他喝酒吃饭唱歌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0388.wav", "duration": 4.6528125, "text": "今年第二位离开法国冰协更换国籍的选手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0436.wav", "duration": 6.1789375, "text": "新京报记者从温岭市政府新闻办获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0206.wav", "duration": 3.4410625, "text": "办法五月一日起实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0391.wav", "duration": 4.7619375, "text": "佟健因此顺利通过了入学考试"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0428.wav", "duration": 2.8991875, "text": "网友纷纷力挺陈冠希"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0269.wav", "duration": 7.97, "text": "此举或与摩根士丹利下调苹果股票持股比例有关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0157.wav", "duration": 7.61, "text": "都意在有针对性地加大三四线城市楼市库存消化力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0480.wav", "duration": 4.666, "text": "机场公安加航航班未发生性侵事件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0142.wav", "duration": 4.689, "text": "尤其是库存高企的三四线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0235.wav", "duration": 3.8509375, "text": "才能申请发行城投债券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0186.wav", "duration": 3.594, "text": "不如做一款实实在在的好产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0478.wav", "duration": 6.036125, "text": "永强中学校长也是坠楼学生的语文老师"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0400.wav", "duration": 3.052, "text": "这场官司的前五次公判"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0142.wav", "duration": 5.122, "text": "一系列利好消息影响下的首个周末"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0251.wav", "duration": 5.9760625, "text": "投资者采取措施防范风险是成熟的表现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0342.wav", "duration": 3.793, "text": "能够赢得比赛真的很开心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0279.wav", "duration": 5.7359375, "text": "根据知情人士获得的安吉拉录音手稿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0174.wav", "duration": 3.5379375, "text": "这是因为宋芳购买其房产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0447.wav", "duration": 3.1259375, "text": "被餐厅罚款二四零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0401.wav", "duration": 2.802, "text": "但还是担心水质问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0384.wav", "duration": 3.75, "text": "其中扣球拿到一百三十二分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0217.wav", "duration": 3.5229375, "text": "发展多种形式的规模化专业化生产经营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0434.wav", "duration": 4.2311875, "text": "北京冬奥会刚刚申办成功"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0138.wav", "duration": 4.289, "text": "全国住房公积金七万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0142.wav", "duration": 4.621, "text": "虽然一线城市房价已出现反弹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0409.wav", "duration": 4.0551875, "text": "问到他们在法国拍戏定情的细节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0169.wav", "duration": 5.678, "text": "一线城市住宅用地平均价格为十一万元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0215.wav", "duration": 3.437, "text": "我国地方政府性债务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0121.wav", "duration": 3.9649375, "text": "房地产相关领域问题频发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0214.wav", "duration": 5.2899375, "text": "我国现代农业发展面临更多的外部不确定性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0481.wav", "duration": 5.068125, "text": "回家后发现大虾体内竟然被注射了不明胶状物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0138.wav", "duration": 8.249, "text": "第四季度二手住宅成交量将环比增幅在百分之七以内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0215.wav", "duration": 2.8979375, "text": "地震灾后重建等领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0154.wav", "duration": 6.773, "text": "对于外商投资房地产企业注册资本与投资总额比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0252.wav", "duration": 6.428, "text": "最近企业债券特别是城投债券的发行难度加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0208.wav", "duration": 3.828, "text": "各部门要主动服务三农"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0223.wav", "duration": 6.1490625, "text": "着力强化政策科技设施装备人才和体制支撑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0352.wav", "duration": 4.933125, "text": "其馀场馆改建后均可满足赛事需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0234.wav", "duration": 4.2429375, "text": "加快该区域现代农业建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0306.wav", "duration": 4.9509375, "text": "对于企业提高股价促成业务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0326.wav", "duration": 3.170875, "text": "笔者进行了深度的了解"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0362.wav", "duration": 6.531, "text": "并且全部采用有经验的工作人员参与竞赛组织工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0135.wav", "duration": 3.4079375, "text": "办公楼销售额下降了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0488.wav", "duration": 6.73, "text": "湖北一骗取群众资金数亿元的传销头目近日归国投案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0398.wav", "duration": 3.6530625, "text": "如果美容院的医疗过失罪名不成立"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0460.wav", "duration": 4.5339375, "text": "暗地里却发布小广告揽客"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0443.wav", "duration": 4.4309375, "text": "现场图一零月五日下午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0173.wav", "duration": 4.877, "text": "百分之五的网友认为房价将普遍下跌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0323.wav", "duration": 4.7119375, "text": "转型升级应该在十年前就开始了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0185.wav", "duration": 3.1650625, "text": "智能家居概念的炒作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0222.wav", "duration": 7.135, "text": "强调必须把污染治理和生态保护摆在更加重要的位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0228.wav", "duration": 4.217, "text": "一些专家学者提出了许多好的建议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0347.wav", "duration": 4.615, "text": "普鲁申科的职业生涯却堪称多灾多难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0468.wav", "duration": 4.6120625, "text": "原以为可以按照游戏规则定期分红提现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0251.wav", "duration": 7.4940625, "text": "国务院将对各类交易场所清理整顿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0234.wav", "duration": 5.207, "text": "对全国各地的政府债务进行了严格审计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0492.wav", "duration": 6.076875, "text": "参考消息网九月一三日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0398.wav", "duration": 6.259, "text": "从九月四日起迎接多米尼加俄罗斯和日本的挑战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0319.wav", "duration": 7.5, "text": "美的家用空调事业部制造副总裁乌守保对记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0341.wav", "duration": 4.262, "text": "撑杆跳丽萨莱兹奇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0230.wav", "duration": 3.4620625, "text": "公募基金管理业务有关工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0392.wav", "duration": 5.754875, "text": "佟健是同班同学里唯一运动员出身的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0380.wav", "duration": 4.9860625, "text": "这场史诗级惊天血战中没有失败者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0197.wav", "duration": 7.739, "text": "推动发展村镇银行等农村中小金融机构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0413.wav", "duration": 2.9550625, "text": "有眼尖的网友发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0352.wav", "duration": 6.9509375, "text": "作为此次赛事上唯一一场纯泰式规则的超级战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0123.wav", "duration": 6.431, "text": "预计短期央行仍可能会积极维稳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0287.wav", "duration": 7.6999375, "text": "苹果股价相较十月份低点已经上涨约百分之二十五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0255.wav", "duration": 4.671, "text": "苹果市值超过七千亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0205.wav", "duration": 3.422, "text": "政府性违约可能性不大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0195.wav", "duration": 6.444, "text": "严格执行鲜活农产品运输绿色通道政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0314.wav", "duration": 7.5, "text": "负责统一管理原电机事业部的各工厂制造系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0449.wav", "duration": 3.7519375, "text": "发现事情并没有这么简单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0320.wav", "duration": 4.551, "text": "老板电器如何看待公司的创新驱动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0184.wav", "duration": 5.5150625, "text": "市场基本面有可能会率先好转"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0214.wav", "duration": 8.03, "text": "着力改善田间基础设施良种科研繁育设施等生产条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0208.wav", "duration": 6.0350625, "text": "我委核准发行的企业债券累计为七千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0251.wav", "duration": 5.519875, "text": "徐林发债企业在债券存续期内进行资产转移"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0383.wav", "duration": 4.013875, "text": "能否在里约奥运东山再起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0460.wav", "duration": 8.423125, "text": "网络图片参考消息网八月一四日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0335.wav", "duration": 4.6319375, "text": "被合并到美的的厨房电器事业部后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0331.wav", "duration": 5.4558125, "text": "不同行业在网络安全方面投入比例不一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0350.wav", "duration": 4.4440625, "text": "裁判员代表和运动员代表进行了宣誓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0347.wav", "duration": 2.657, "text": "影响力强的全国性比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0410.wav", "duration": 3.203125, "text": "就顺着你的感觉走就好了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0430.wav", "duration": 2.6591875, "text": "尽管她努力瘦身"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0280.wav", "duration": 6.584, "text": "我们当下的股市在流动性方面也表现得支离破碎"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0160.wav", "duration": 5.929, "text": "可以有效解决商业银行顺周期操作问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0440.wav", "duration": 7.754875, "text": "市民刘先生和江西环球国际旅行社的沟通协商再次失败"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0431.wav", "duration": 5.8689375, "text": "快报讯记者赵丹丹快递实名制时代终于到来了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0388.wav", "duration": 4.1650625, "text": "他将尽全力带领队伍取得好成绩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0296.wav", "duration": 5.048, "text": "这种渗透犹如蜘蛛结网细菌繁殖病毒传播"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0137.wav", "duration": 6.036, "text": "上海市公积金管理中心公布公积金新政"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0256.wav", "duration": 3.6999375, "text": "乔布斯在最初产品开发过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0460.wav", "duration": 6.536875, "text": "新京报讯记者林斐然近日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0309.wav", "duration": 4.4511875, "text": "对数据库设有监控及记录"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0311.wav", "duration": 4.5339375, "text": "又可以让家长了解孩子的位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0386.wav", "duration": 5.4960625, "text": "马特伍兹菲兹比亚尔科"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0403.wav", "duration": 3.9909375, "text": "而且还要尽量在小分上取得优势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0407.wav", "duration": 6.6120625, "text": "二十世纪福斯影业公布一批新片的档期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0205.wav", "duration": 5.031, "text": "这几年城投债券发行数量的确有所增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0300.wav", "duration": 3.636, "text": "读者若信经济学人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0452.wav", "duration": 4.073, "text": "回国后被确诊为腰部骨折"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0351.wav", "duration": 8.053, "text": "徐永昊的地面技术无疑是其格斗体系中的一块短板"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0278.wav", "duration": 4.157, "text": "我国的经济处在爬坡过坎的重要关口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0477.wav", "duration": 6.052, "text": "游客扔硬币许愿观赏莲被砸成马蜂窝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0139.wav", "duration": 2.945, "text": "再次降低公积金贷款的门槛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0209.wav", "duration": 5.994, "text": "制定农村二三产业加快发展的鼓励政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0173.wav", "duration": 3.346, "text": "通过设立国家住房银行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0420.wav", "duration": 3.057125, "text": "自己也有一段时间没有跟他见面了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0285.wav", "duration": 3.1840625, "text": "梅姐待的已算够长了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0254.wav", "duration": 4.317, "text": "零售店就再也卖不出去一个实体钱包了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0143.wav", "duration": 7.12, "text": "在市场整体从高速增长进入中高速增长区间的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0216.wav", "duration": 3.8759375, "text": "加快选育应用优良品种"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0432.wav", "duration": 4.6999375, "text": "李嘉诚首次公开回应撤资不爱国等质疑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0388.wav", "duration": 4.3000625, "text": "其中年龄最小的年仅十四岁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0391.wav", "duration": 6.1960625, "text": "北申办此次冬奥会的价值要远远超过承办本身"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0181.wav", "duration": 6.6540625, "text": "易居研究院智库中心研究总监严跃进认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0236.wav", "duration": 3.6579375, "text": "并鼓励企业在境外上市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0378.wav", "duration": 3.6579375, "text": "现成的选择就在面前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0225.wav", "duration": 4.9290625, "text": "对促进当地经济增长和政府财力的增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0208.wav", "duration": 6.509, "text": "审议通过缺陷汽车产品召回管理条例草案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0396.wav", "duration": 5.150875, "text": "我们应该多和亚洲球队比赛来适应这样的打法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0481.wav", "duration": 7.4189375, "text": "温州惊现注胶虾续苍南再查六公斤注胶大虾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0330.wav", "duration": 6.6479375, "text": "很多服务器厂商进入做一两年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0313.wav", "duration": 4.756125, "text": "他担心自己马上就要被辞退了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0402.wav", "duration": 5.077875, "text": "与几乎不接一传的科舍列娃相比"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0478.wav", "duration": 4.1369375, "text": "京华时报讯昨天下午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0331.wav", "duration": 4.887, "text": "现在消费者的需求越来越个性化差异化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0233.wav", "duration": 4.0120625, "text": "进入世界五百强的企业增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0211.wav", "duration": 4.23, "text": "其中城投债券共发行七千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0493.wav", "duration": 4.4260625, "text": "现场李双江受到了观众的热烈欢迎"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0176.wav", "duration": 5.912, "text": "当月住宅类商品房成交套数骤跌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0370.wav", "duration": 3.5700625, "text": "意思是他们比较认同这个结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0493.wav", "duration": 6.8710625, "text": "参考消息网一一月一日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0201.wav", "duration": 5.3530625, "text": "投资者对城投债券风险表现出的恐慌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0149.wav", "duration": 3.554, "text": "由于商品房供应量充足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0474.wav", "duration": 8.860125, "text": "温州一住持被免政协委员遭准儿媳举报娶妻开路虎"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0416.wav", "duration": 5.3418125, "text": "但会给哥哥谢霆锋传短信了解情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0356.wav", "duration": 7.503875, "text": "二传丁霞和主攻刘晏含取代了沈静思和张常宁的位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0123.wav", "duration": 5.632, "text": "百分之五的网友选择了房贷利率打折优惠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0302.wav", "duration": 3.697, "text": "这行字对于我们来说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0227.wav", "duration": 3.3359375, "text": "我看了以后很受震动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0488.wav", "duration": 5.650875, "text": "消费者可以直接向物价部门和旅游部门举报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0131.wav", "duration": 5.0, "text": "开发边界将作为城市发展的刚性约定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0266.wav", "duration": 5.2429375, "text": "而土豪和穷鬼做生意的最大区别就是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0142.wav", "duration": 5.124, "text": "中海地产作为国企龙头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0338.wav", "duration": 5.5849375, "text": "拉德克利夫认为自己被暗指有问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0173.wav", "duration": 3.3899375, "text": "但增加的幅度不会太大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0203.wav", "duration": 3.802, "text": "农业生产技术较为成熟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0235.wav", "duration": 4.652, "text": "国家审计署还专门组织力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0224.wav", "duration": 4.022, "text": "着力完善现代农业产业体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0166.wav", "duration": 5.07, "text": "不予安排中长期外债额度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0127.wav", "duration": 4.626, "text": "一线城市超过三成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0239.wav", "duration": 7.9339375, "text": "重点突破棉花油菜甘蔗收获机械化瓶颈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0354.wav", "duration": 10.488, "text": "取得瑞士卢加诺竞走挑战赛男子二十公里竞走银牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0132.wav", "duration": 3.834, "text": "连接的最高代价就是安全问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0395.wav", "duration": 6.061, "text": "伤愈复出找手感一传防守遇考验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0258.wav", "duration": 2.912, "text": "我们的自主创新能力还不够强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0205.wav", "duration": 3.983875, "text": "加强入海河流综合治理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0215.wav", "duration": 4.64, "text": "加快构建以公共交通为主"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0173.wav", "duration": 4.6999375, "text": "迅速带动一线城市土地市场的整体成交"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0131.wav", "duration": 4.631, "text": "对于中国楼市有一定积极作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0213.wav", "duration": 6.4750625, "text": "在海洋环境敏感区关键区等划定生态红线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0346.wav", "duration": 3.1528125, "text": "其中五个场馆需要新建"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0410.wav", "duration": 5.9880625, "text": "日前在大陆真人秀节目秀出两条雪白大长腿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0373.wav", "duration": 6.865, "text": "二零一五年第十二届女排世界杯单循环赛战至第八轮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0356.wav", "duration": 3.8569375, "text": "激情战火必将以燎原之势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0414.wav", "duration": 6.1208125, "text": "与孙楠巫启贤共同起立鼓掌的许茹芸小腹凸起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0400.wav", "duration": 6.2678125, "text": "还要求具备大型赛会或日常从事社会志愿服务的经验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0431.wav", "duration": 3.797875, "text": "并于当日被香港警方拘捕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0196.wav", "duration": 2.943, "text": "油料总产量七万吨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0380.wav", "duration": 2.7729375, "text": "北京时间十月十日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0290.wav", "duration": 5.7860625, "text": "这种产品的设计仍需考虑文化历史和未来等因素"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0132.wav", "duration": 4.068, "text": "这些城市公积金贷款买房的比例也比较高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0134.wav", "duration": 4.57, "text": "有百分之五的网友选择了其他房企"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0438.wav", "duration": 5.6499375, "text": "本山传媒回应赵本山将有新作品没听说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0253.wav", "duration": 4.8199375, "text": "没有人提的往往才是真命天子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0391.wav", "duration": 3.318125, "text": "一切都难以用言语来表达"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0228.wav", "duration": 3.109, "text": "十二五医药发展规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0328.wav", "duration": 8.380125, "text": "因为机器人生产商派遣技术人员不可能长期驻起驻点企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0479.wav", "duration": 5.864, "text": "水货集团看中轮椅人士收入不高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0367.wav", "duration": 6.303, "text": "也为背后的关键技术提供开发支持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0167.wav", "duration": 6.43, "text": "北京市管国管住房公积金中心先后发布通知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0407.wav", "duration": 3.141125, "text": "但是出于预算考虑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0385.wav", "duration": 3.5590625, "text": "在此次申办冬奥会的过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0445.wav", "duration": 3.1010625, "text": "几位游客轮流翻越护栏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0428.wav", "duration": 5.9179375, "text": "但隔年三月却又分享一张女方坐他大腿的照片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0287.wav", "duration": 3.9490625, "text": "乔帮主在首批苹果产品的开发中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0246.wav", "duration": 4.6069375, "text": "从城投债券发行监管部门的角度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0252.wav", "duration": 6.656, "text": "加强基础性前沿性公益性重大农业科学技术研究"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0188.wav", "duration": 3.984, "text": "促进战略性新兴产业健康发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0366.wav", "duration": 6.5, "text": "在场下接受完队医高压包扎后的朱婷请命上场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0173.wav", "duration": 4.956875, "text": "相反相关环节上审批更加严格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0338.wav", "duration": 5.699, "text": "美丽的丁香湖公园成为跑步爱好者的狂欢圣地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0183.wav", "duration": 4.3840625, "text": "反映出政策层面较大的刺激力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0123.wav", "duration": 10.734, "text": "公积金政策利好首套自住住房贷款需求的消息纷至沓来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0205.wav", "duration": 10.808, "text": "下一步将进一步完善城投债卷发行制度和防范风险机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0182.wav", "duration": 3.803, "text": "为了将后辈的婚姻风险隔断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0396.wav", "duration": 9.203125, "text": "以哈萨克斯坦排协特派选手的方式加盟日本的球队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0245.wav", "duration": 9.188, "text": "部分核电厂未制定实施严重事故预防和缓解规程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0168.wav", "duration": 3.913, "text": "预计全年有望突破四千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0458.wav", "duration": 4.019, "text": "出事凉亭依然呈现事发时的状态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0407.wav", "duration": 3.881125, "text": "看上去和人物原型相当贴合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0250.wav", "duration": 6.499, "text": "加快农田基础设备和现代农业装备建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0312.wav", "duration": 4.7531875, "text": "三十一九二零一五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0289.wav", "duration": 3.2900625, "text": "也不能一直被贴上中国组装的标签"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0384.wav", "duration": 3.6269375, "text": "二零零八年北京奥运会时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0306.wav", "duration": 5.735875, "text": "白电行业将进入最惨烈的一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0402.wav", "duration": 3.416, "text": "日本排球界的人士指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0303.wav", "duration": 2.858, "text": "这是未来的必经之路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0460.wav", "duration": 8.2851875, "text": "港媒关注内地私人美术馆新富人群热衷分享藏品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0262.wav", "duration": 5.401875, "text": "也向全世界推广了一种趋之若鹜的文化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0207.wav", "duration": 3.621, "text": "城市化进程远未结束"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0494.wav", "duration": 5.746125, "text": "京华时报讯记者武红利与家人来京旅游"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0449.wav", "duration": 3.8349375, "text": "岳父母继承一零九万馀元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0369.wav", "duration": 5.6220625, "text": "小海坨山是位于延庆境内的海坨山主峰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0174.wav", "duration": 4.1499375, "text": "他预测今年剩馀的两个月中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0337.wav", "duration": 4.0810625, "text": "侵犯了公民的合法权益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0295.wav", "duration": 5.4409375, "text": "而不是迫不及待抓住一切可以上市圈钱的机会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0259.wav", "duration": 4.941875, "text": "苹果已为汽车项目招募了数百名员工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0246.wav", "duration": 9.328, "text": "加强种子饲草料等急救灾物资储备调运条件建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0166.wav", "duration": 5.555, "text": "搜房网广州二手房统计中心数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0282.wav", "duration": 4.3769375, "text": "在自己全身心的努力和坚持之下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0449.wav", "duration": 10.7270625, "text": "温州老人卖房筹四八零零万建养老院赠政府遭闲置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0285.wav", "duration": 5.068, "text": "而是统一地认为苹果开了有史以来最烂的发布会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0443.wav", "duration": 3.6340625, "text": "记者从广安消防部门获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0184.wav", "duration": 5.7039375, "text": "对绿色高效宜居的高品质住房需求快速上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0178.wav", "duration": 3.87, "text": "六部委松绑楼市限外令"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0221.wav", "duration": 6.1169375, "text": "这使得我国城投债劵的发行利率相对偏高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0168.wav", "duration": 4.205, "text": "一智能家居产品的销售渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0448.wav", "duration": 3.957, "text": "对中央坚定不移继续改革开放"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0370.wav", "duration": 7.401875, "text": "身材傲人颜值爆表的她魅力席卷整个亚洲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0183.wav", "duration": 5.873, "text": "并将受益人定为直系血亲后代非配偶继承人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0173.wav", "duration": 4.372, "text": "但对购房者预期有积极响应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0387.wav", "duration": 4.718, "text": "而是王气十足地向对手进行正面逼近"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0249.wav", "duration": 5.2889375, "text": "限制类主要是指天然化工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0353.wav", "duration": 5.832, "text": "孙杨因心脏不适退出一千五百米自由泳决赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0463.wav", "duration": 5.212875, "text": "温州企业家卖房建养老院捐给当地却被闲置三年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0237.wav", "duration": 4.495, "text": "创新鲜活农产品的流通模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0376.wav", "duration": 6.297125, "text": "高清女排金花手捧奖杯庆夺冠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0363.wav", "duration": 3.9130625, "text": "得到当地企业的强烈积极响应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0390.wav", "duration": 4.8869375, "text": "美联社公布的一项独立水质检测显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0126.wav", "duration": 3.5, "text": "因此土地储备至关重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0345.wav", "duration": 5.2160625, "text": "令拳迷记忆犹新的飙血之战不计其数"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0324.wav", "duration": 4.931125, "text": "老师是否允许孩子戴手表上学"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0304.wav", "duration": 3.721875, "text": "故依法裁定驳回上诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0170.wav", "duration": 4.1779375, "text": "而现在这类城市房价已经很高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0342.wav", "duration": 4.5800625, "text": "明年北京市业馀排球联赛将在中国排球协会备案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0192.wav", "duration": 4.6700625, "text": "加快该地区域现代农业建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0495.wav", "duration": 3.509, "text": "湖北黄石市一家商场前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0213.wav", "duration": 3.037, "text": "如果开了小车免费车道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0167.wav", "duration": 4.91, "text": "现在已经是海南本土最大的房地产推广公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0165.wav", "duration": 3.6340625, "text": "楼市持续三个季度回升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0361.wav", "duration": 7.499, "text": "在冬奥会举办之前这里将为专业队伍训练提供场地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0124.wav", "duration": 3.94, "text": "遇到毛利率低的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0211.wav", "duration": 7.1230625, "text": "统筹城乡基础设施建和公共服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0357.wav", "duration": 5.672875, "text": "张常宁则取代曾春蕾站在接应的位置上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0159.wav", "duration": 7.722, "text": "全国已有超百个城市发布了不同力度的公积金松绑政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0474.wav", "duration": 8.8561875, "text": "村支书为考公务员改小一零岁一四岁时三月内生两子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0458.wav", "duration": 3.1279375, "text": "砸到了村民的菜地里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0281.wav", "duration": 3.076875, "text": "据华尔街日报网站报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0379.wav", "duration": 5.0080625, "text": "这些常年坚持跑步的人身体质量指数偏低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0273.wav", "duration": 3.723, "text": "跨设备使用的通用应用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0246.wav", "duration": 4.192, "text": "通知扩大保险资管公司业务范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0233.wav", "duration": 5.672, "text": "新京报讯记者钟晶晶发改委昨日表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0174.wav", "duration": 4.974, "text": "预期政府将继续放松政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0408.wav", "duration": 2.738, "text": "演技也日渐精湛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0238.wav", "duration": 6.349, "text": "研究建立高耗能老旧农业机械报废回收制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0217.wav", "duration": 4.999, "text": "可以更好地体现代际公平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0369.wav", "duration": 2.968, "text": "在保障好技术稳定发挥的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0489.wav", "duration": 8.255125, "text": "温州景山花木市场发生大火火势已得到基本控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0384.wav", "duration": 3.568125, "text": "这在曾春蕾看来打俄罗斯很有底"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0299.wav", "duration": 8.9510625, "text": "据新华社电美国国际贸易委员会二十一日作出终裁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0466.wav", "duration": 6.9289375, "text": "湖北电梯吃人调查报告电梯厂商及商场负主责"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0458.wav", "duration": 3.8561875, "text": "目前八人均已脱离生命危险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0228.wav", "duration": 6.5589375, "text": "虽然报道内容并没有具体的城投债券还本付息违约案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0405.wav", "duration": 5.046125, "text": "结果创造了相当可观的票房成绩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0341.wav", "duration": 3.4930625, "text": "我们是一条心在打团结作战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0355.wav", "duration": 3.468, "text": "主教练郎平训练结束后通知她的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0367.wav", "duration": 5.27, "text": "予服用处方药以治疗心肌缺血保护心肌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0397.wav", "duration": 4.1789375, "text": "再就是四号位的进攻除了斜线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0146.wav", "duration": 6.0510625, "text": "满堂红链家市场研究部高级经理周峰透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0335.wav", "duration": 5.6630625, "text": "很多家长都在给孩子购置各种学习用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0432.wav", "duration": 5.5, "text": "警方以普通袭击罪对涉事乘客提起诉讼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0230.wav", "duration": 5.0059375, "text": "我们对城投债券发行人的审核一直是比较严格的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0228.wav", "duration": 4.202, "text": "七千万套保障房多少钢材"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0189.wav", "duration": 4.52, "text": "并严格按照合规程序进行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0423.wav", "duration": 4.0539375, "text": "再次身体力行地辟谣怀孕传闻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0352.wav", "duration": 5.567125, "text": "照片中看到普鲁申科的背部肌肉伤痕累累"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0230.wav", "duration": 3.3940625, "text": "实现营业总收入十一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0336.wav", "duration": 4.968, "text": "也就是去年和今年上半年营收总额都不高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0175.wav", "duration": 4.5, "text": "进而对稳定中国经济有正面作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0338.wav", "duration": 3.589, "text": "这一切并不是说说而已"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0338.wav", "duration": 5.1760625, "text": "一百米栏辛迪罗勒德尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0221.wav", "duration": 3.502, "text": "今年大年初一他开车去海南"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0278.wav", "duration": 5.7729375, "text": "这种芯片不会直接发送用户敏感信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0463.wav", "duration": 5.5190625, "text": "要求停止侵权公开道歉赔偿精神损失一元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0274.wav", "duration": 6.4079375, "text": "在征收反倾销或反补贴税之前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0465.wav", "duration": 6.6120625, "text": "她身着湖蓝色细纱短袖黑长裤白运动鞋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0198.wav", "duration": 5.6579375, "text": "引导金融机构发放农业中长期贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0417.wav", "duration": 3.7949375, "text": "看完片后会睡不好做恶梦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0204.wav", "duration": 5.8349375, "text": "完善农业保险保费补贴政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0473.wav", "duration": 8.167, "text": "温州一中学门口氢气罐爆炸卖气球摊贩不治身亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0362.wav", "duration": 3.76, "text": "哈亚的肘击刁钻狠辣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0377.wav", "duration": 8.8149375, "text": "我相信每个人都会付出一切来为团队力争最好的成绩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0264.wav", "duration": 6.063, "text": "这些特质让库克基本上实现了财务自由"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0362.wav", "duration": 6.7521875, "text": "机关企事业单位等社会志愿者三千一百名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0217.wav", "duration": 9.4290625, "text": "城市综合交通体系规划应明确公共交通优先发展原则"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0393.wav", "duration": 3.6259375, "text": "大韩体育会这一计划的顺利实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0242.wav", "duration": 3.277, "text": "单项投资规模日益增大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0481.wav", "duration": 4.432875, "text": "我从没想过自己竟会出版一本这样的书"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0477.wav", "duration": 10.937, "text": "村官一顿工作餐吃二六个菜挂钩蹲点领导被诫勉谈话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0457.wav", "duration": 8.295875, "text": "温州家庭误食毒蘑菇后续小女儿已确诊脑死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0229.wav", "duration": 2.567, "text": "基本农田不低于十亿亩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0471.wav", "duration": 3.3190625, "text": "孩子仍处于昏迷阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0433.wav", "duration": 5.6679375, "text": "温州沙城街道一民房发生火灾已造成四人死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0486.wav", "duration": 4.7849375, "text": "云南昆明市同样发现类似注胶虾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0326.wav", "duration": 3.616, "text": "围绕消费者消费者需要什么"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0393.wav", "duration": 3.7851875, "text": "而哈萨克斯坦则是第十六位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0348.wav", "duration": 4.23, "text": "克里斯蒂娜奥伯福尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0399.wav", "duration": 4.02, "text": "一些参赛选手也向新华社记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0366.wav", "duration": 5.136, "text": "甚至在头一场的比赛还影响到自己的技术发挥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0144.wav", "duration": 6.867, "text": "一线城市在价格较高的基础上整体回升并领涨全国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0400.wav", "duration": 4.599125, "text": "比赛结果已经无需裁判的裁定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0376.wav", "duration": 3.0, "text": "对于高年龄跑者来说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0252.wav", "duration": 5.109, "text": "提升垦区现代农业发展水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0191.wav", "duration": 7.99, "text": "需配备租赁精密仪器专业设备大型场地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0202.wav", "duration": 3.423, "text": "鼓励龙头企业采取参股合作等方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0212.wav", "duration": 4.4609375, "text": "也要看到我国与欧美国家的不同之处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0288.wav", "duration": 5.1060625, "text": "半导体行业的大公司正在寻求通过并购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0138.wav", "duration": 4.875, "text": "将在诸多方面惠及刚需购房者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0450.wav", "duration": 3.032, "text": "对中国发展充满信心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0363.wav", "duration": 6.691875, "text": "伊萨的眉弓同样被张春雨以牙还牙的肘法击破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0140.wav", "duration": 12.0, "text": "新产业发展快地用地集约求且需求大的地区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0278.wav", "duration": 4.879, "text": "可供客户为特定任务重新编程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0202.wav", "duration": 3.1479375, "text": "我个人是这么认认识的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0183.wav", "duration": 3.051, "text": "在全球大数据浪潮中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0278.wav", "duration": 4.449, "text": "一九八三至二零零五年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0479.wav", "duration": 9.609125, "text": "渔民南海捞出外国间谍潜航器搜集情报或已传回"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0359.wav", "duration": 5.509, "text": "就不会刻意选择位于纽约闹市区的这所大学"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0139.wav", "duration": 5.188, "text": "之前的公积金贷款额只有一百万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0406.wav", "duration": 4.011, "text": "外媒发布了更令人兴奋的消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0426.wav", "duration": 4.9919375, "text": "搜狐娱乐讯九月十六日二十点二十七分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0327.wav", "duration": 3.6310625, "text": "而车企相对缺乏这类人才"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0144.wav", "duration": 3.079, "text": "北京公积金贷款额度提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0416.wav", "duration": 2.4709375, "text": "今天她出席活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0284.wav", "duration": 4.1440625, "text": "华尔街才对阿里巴巴情有独钟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0321.wav", "duration": 3.478, "text": "员工数量将减至两万人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0366.wav", "duration": 5.004875, "text": "明天比赛里我们会冷静下来落实到细节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0216.wav", "duration": 8.1529375, "text": "特别是地方投投融资平台公司形成的债务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0261.wav", "duration": 4.0699375, "text": "或许是受好莱坞艳照门的影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0155.wav", "duration": 4.815, "text": "也就是每个成员综合体验的最大公约数"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0389.wav", "duration": 3.9030625, "text": "在主场为中国健儿加油"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0169.wav", "duration": 3.6260625, "text": "我又不指望设立信托来赚钱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0269.wav", "duration": 4.178, "text": "此时客户可以选择离开苹果零售店"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0458.wav", "duration": 10.2849375, "text": "游客骑着明孝陵驮碑龟趺拍照市民大煞风景"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0472.wav", "duration": 6.322, "text": "陆续有人从乐清赶往平阳法院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0130.wav", "duration": 4.075, "text": "但对于实施住房限购政策的城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0440.wav", "duration": 3.0900625, "text": "温州新力虎汽车销售公司展示台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0126.wav", "duration": 3.528, "text": "创业者成了智慧时代的贡品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0258.wav", "duration": 7.135, "text": "并且计划最早在二零二零年推出生产首款车型"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0399.wav", "duration": 4.2149375, "text": "朱婷在谈到大家关心的脚伤时说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0260.wav", "duration": 3.005, "text": "除了普通计算机以外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0275.wav", "duration": 7.463, "text": "而沃兹尼亚克似乎乐于承担驱魅的角色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0404.wav", "duration": 4.3449375, "text": "这也是该片首次亮相大荧幕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0417.wav", "duration": 2.6499375, "text": "希望出去发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0471.wav", "duration": 3.6899375, "text": "退休后不在其位不谋其政"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0274.wav", "duration": 3.156, "text": "而将他软禁十年之久"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0364.wav", "duration": 4.233125, "text": "但是因为涉及到男伴更改国籍问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0253.wav", "duration": 3.939, "text": "亦不可能跟自然规律抗衡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0477.wav", "duration": 2.3899375, "text": "让借给我钱的好心人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0443.wav", "duration": 5.1430625, "text": "日照市公安局官方发布消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0358.wav", "duration": 2.89, "text": "但是也不好过问太多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0326.wav", "duration": 4.7790625, "text": "美的家用空调事业提出精品战略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0226.wav", "duration": 3.256, "text": "建设一批大型渔政船"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0122.wav", "duration": 5.2460625, "text": "楼市地市交相升温房价会不会再度暴涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0246.wav", "duration": 3.5710625, "text": "建立健全重要农产品储备制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0396.wav", "duration": 5.086875, "text": "只有姚明和刘国梁等少数几个人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0364.wav", "duration": 5.5820625, "text": "孙杨因感冒后出现了胸闷心悸不适等症状"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0416.wav", "duration": 2.8669375, "text": "她看了不少恐怖片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0392.wav", "duration": 4.0649375, "text": "朱婷崴脚之后带伤率队取胜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0492.wav", "duration": 3.765875, "text": "成功处置深航机上纵火事件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0228.wav", "duration": 6.2220625, "text": "增长百分之三十净利润一千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0327.wav", "duration": 4.4109375, "text": "机器人应用也进一步提速"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0406.wav", "duration": 5.1030625, "text": "好莱坞当红明星之前曾被盛传将扮演斯诺登"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0184.wav", "duration": 5.261, "text": "这是自去年以来除降息外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0373.wav", "duration": 7.7048125, "text": "这场史诗级的双王血战在两大强者最后的对决中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0256.wav", "duration": 4.4860625, "text": "具有精确的目标定位和识别能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0136.wav", "duration": 4.3550625, "text": "为了确保保障房住宅的优良品质"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0476.wav", "duration": 4.557125, "text": "屡屡逼近八万人次的限流大关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0207.wav", "duration": 5.588, "text": "您如何看待政府的举债行为和债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0385.wav", "duration": 4.379875, "text": "格里格尔特拉贝尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0309.wav", "duration": 3.506125, "text": "由于近期销售模式的调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0338.wav", "duration": 3.0, "text": "她的表现也更加全面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0193.wav", "duration": 10.7259375, "text": "多方面原因造成今年上半年部分中小企业生产经营困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0417.wav", "duration": 4.711875, "text": "不到几个月的时间已爱得如此火热了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0378.wav", "duration": 4.9130625, "text": "曾春蕾一记五米线的调整攻打得非常漂亮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0234.wav", "duration": 4.4499375, "text": "相关公司股票走势国海证券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0374.wav", "duration": 3.380875, "text": "非常适合修建高山雪场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0220.wav", "duration": 5.1660625, "text": "二零一二年中央进一步加大了资金支持力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0472.wav", "duration": 3.1950625, "text": "记者接到这样的报料"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0227.wav", "duration": 3.183, "text": "扩大到四个小长假之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0140.wav", "duration": 5.788, "text": "如允许每年发行专项金融债券七万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0377.wav", "duration": 3.850125, "text": "打得对手只有招架之功"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0400.wav", "duration": 7.1550625, "text": "而十公里女子组由刘庆红以三十四分十秒夺得冠军"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0128.wav", "duration": 3.635, "text": "市场开发也呈降温态势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0444.wav", "duration": 4.514875, "text": "在甘肃敦煌大方盘城遗址"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0128.wav", "duration": 4.401, "text": "三线及以下为一成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0413.wav", "duration": 4.5, "text": "分享入行二十年的感受"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0449.wav", "duration": 6.991, "text": "港珠澳大桥又起漂移风波可能进一步影响工期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0492.wav", "duration": 7.323, "text": "据称是当事人之一在派出所通过一个亲戚的微博发的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0330.wav", "duration": 5.7431875, "text": "紫光股份将与世纪互联共同出资组建合资公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0404.wav", "duration": 6.042, "text": "影片将在二零一五年一月在慕尼黑正式开机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0348.wav", "duration": 3.4040625, "text": "朱婷就是中国女排的核心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0440.wav", "duration": 3.672875, "text": "案件正在进一步调查中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0468.wav", "duration": 5.985125, "text": "学校正在全力配合公安机关和家属进行善后处理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0212.wav", "duration": 5.2650625, "text": "逐步建立城乡统一的公共服务制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0153.wav", "duration": 5.874, "text": "但供应和库存却主要集中在七个三四线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0396.wav", "duration": 5.47775, "text": "相信有这些高水平业馀排球队的参与"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0388.wav", "duration": 6.52, "text": "吕会会在全场观众的加油助威声中爆发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0311.wav", "duration": 5.76, "text": "就更加愿意长期持有他们的股票"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0373.wav", "duration": 4.9130625, "text": "拥有高山滑雪要求的八百米落差"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0316.wav", "duration": 7.292, "text": "美的集团公关部的相关人士告诉第一财经日报记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0422.wav", "duration": 3.6369375, "text": "花了三年时间才得到这首歌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0406.wav", "duration": 6.2790625, "text": "但本月评论界就可以知道该片的真实成色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0242.wav", "duration": 4.948, "text": "加快实施保护性耕作工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0324.wav", "duration": 4.8249375, "text": "马某等人进一步完善了插件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0128.wav", "duration": 6.031, "text": "土地交易可能随着供应淡季的到来而降温"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0412.wav", "duration": 8.225125, "text": "搜狐娱乐讯北京时间八月十二日消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0180.wav", "duration": 5.8240625, "text": "今年一线城市宅地成交的溢价率不高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0387.wav", "duration": 4.0239375, "text": "在昨天比赛的第五投"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0164.wav", "duration": 6.3449375, "text": "龙湖在丰台西局撤资三十亿元拿地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0277.wav", "duration": 4.3049375, "text": "中国游戏产品和美国产品极为不同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0201.wav", "duration": 4.0130625, "text": "引领全国现代农业加快发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0427.wav", "duration": 4.8920625, "text": "她坦承当时很惊喜很感动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0306.wav", "duration": 4.5610625, "text": "于一九九一年加盟美的集团"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0459.wav", "duration": 5.0029375, "text": "一八一所院校将补录一九四九人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0136.wav", "duration": 3.646, "text": "具有实时性合理性和较强的针对性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0174.wav", "duration": 5.307, "text": "这将有利于稳定房地产市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0430.wav", "duration": 4.6159375, "text": "搜狐娱乐讯北京时间六月二十四日消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0479.wav", "duration": 3.4360625, "text": "九日晚女孩尸体被找到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0125.wav", "duration": 4.3, "text": "难以在周边城市用公积金购房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0310.wav", "duration": 3.626, "text": "题材股继续扮演黑马角色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0192.wav", "duration": 3.881, "text": "鼓励本土中介机构提供服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0393.wav", "duration": 3.1579375, "text": "十月十八日早上九点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0404.wav", "duration": 4.9030625, "text": "这部电影从二零一三年就已经开始筹备了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0205.wav", "duration": 6.1700625, "text": "为加快发展银行间债券市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0153.wav", "duration": 6.766, "text": "今年北京将继续加大集体土地建设公租房试点力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0460.wav", "duration": 4.00125, "text": "瑞安市商业街和联中路交叉口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0152.wav", "duration": 4.5, "text": "此举将有利于市场信心的培养"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0213.wav", "duration": 7.8719375, "text": "一定程度上缓解了部分中小企业的融资困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0268.wav", "duration": 3.177, "text": "这只是最乐观的估计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0353.wav", "duration": 3.6909375, "text": "这个二十三岁的云南小伙子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0213.wav", "duration": 4.0230625, "text": "提高农机装备和作业水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0201.wav", "duration": 7.3249375, "text": "下一步我国的城投债劵还需要做哪些完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0367.wav", "duration": 5.959, "text": "志愿者的那一抹绿并大家亲切地称呼为小青椒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0321.wav", "duration": 7.188, "text": "也将儿童人身安全的话题推向了妙论的风口浪尖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0196.wav", "duration": 5.1790625, "text": "强农惠农富农政策力度将进一步加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0268.wav", "duration": 3.459, "text": "与现在的接待原则不同的是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0477.wav", "duration": 5.803, "text": "故宫首次启动了起流起票限流措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0361.wav", "duration": 4.7949375, "text": "而六十岁的跑者每英里耗时十分十八秒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0226.wav", "duration": 9.1959375, "text": "使得城投公司能够发行真正意义上的长期市政债劵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0492.wav", "duration": 3.2480625, "text": "目前均暂无生命危险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0196.wav", "duration": 6.383875, "text": "稳步推进退牧还草和游牧民定居工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0203.wav", "duration": 3.463, "text": "创新农业技术推广机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0476.wav", "duration": 3.947, "text": "戏称自己年过八零当为八零后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0178.wav", "duration": 6.2599375, "text": "希望智能家居产品企业在短期的高回报率也是不现实的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0481.wav", "duration": 3.4650625, "text": "龙湾警方已对此事展开调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0199.wav", "duration": 5.707, "text": "对丰富债劵市场品种也具有积极意义"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0431.wav", "duration": 5.5180625, "text": "一四年前轰动东莞沙田的一起命案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0378.wav", "duration": 2.9150625, "text": "很开心赢得今天的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0298.wav", "duration": 3.4399375, "text": "反映了芯片行业出现整合热"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0269.wav", "duration": 6.003875, "text": "无论他做的什么都是什么都会引人注目的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0451.wav", "duration": 6.0378125, "text": "曾多次比对二零零七年命案现场匕首上的指纹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0471.wav", "duration": 3.7319375, "text": "女神机器人在火锅店内工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0284.wav", "duration": 5.61, "text": "艾维本周四晚在旧金山现代艺术馆向大众表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0358.wav", "duration": 5.1599375, "text": "并取得世锦赛参赛资格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0135.wav", "duration": 6.231, "text": "双降加上广州公积金贷款新政落地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0383.wav", "duration": 3.7150625, "text": "顺利获得了冬奥会的主办权"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0349.wav", "duration": 3.9350625, "text": "十月二十八日与三十一日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0479.wav", "duration": 5.6220625, "text": "这里存放着乙酯和工业酒精等化工品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0373.wav", "duration": 5.53, "text": "四川大学的手语志愿者要学习四千个手语动作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0198.wav", "duration": 7.1, "text": "强化多双边和区域农业磋商谈判和贸易促进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0176.wav", "duration": 4.3629375, "text": "房地产需求可能会上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0291.wav", "duration": 3.593, "text": "英特尔需要找到新的增长点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0221.wav", "duration": 4.4870625, "text": "扩大农机具购置补贴规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0229.wav", "duration": 4.7620625, "text": "本报记者蔡宗琦中国证券报记者获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0307.wav", "duration": 3.999, "text": "从而获取用户信息的案件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0443.wav", "duration": 5.6108125, "text": "凭着远比真实年龄看起来要年经许多的容貌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0289.wav", "duration": 6.509, "text": "但这些口水式的讨伐并没有影响苹果前进的脚步"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0210.wav", "duration": 6.656, "text": "徐林吸取欧美等国主权债务危机的教训"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0247.wav", "duration": 8.218, "text": "提高天然气利用率支持天然气贸易机制创新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0310.wav", "duration": 4.0020625, "text": "这种宣传方式的目的是什么"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0140.wav", "duration": 4.394, "text": "广州日报讯记者林琳上周五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0470.wav", "duration": 6.3769375, "text": "申龙电梯和安良百货公司应对事故负主要责任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0352.wav", "duration": 3.459, "text": "当队伍遇到一些困难的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0428.wav", "duration": 7.6440625, "text": "男友受访时也首度大方松口确实已经进入求婚阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0413.wav", "duration": 4.0959375, "text": "又指自己未试过受爸爸体罚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0283.wav", "duration": 2.9670625, "text": "在转型发展上下功夫"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0220.wav", "duration": 4.1889375, "text": "深入贯彻落实科学发展观"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0468.wav", "duration": 2.681875, "text": "和传统硬盘不同的是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0333.wav", "duration": 5.370875, "text": "小天才电话手表等国内几个大品牌都有"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0374.wav", "duration": 10.7780625, "text": "佟健又将国内部分优秀的单人滑和冰舞运动员集合起来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0397.wav", "duration": 4.765125, "text": "接下来中国女排将转战名古屋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0234.wav", "duration": 3.213, "text": "推行禁牧休牧和划区轮牧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0281.wav", "duration": 5.558, "text": "苹果通过发布不必要的软件升级包"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0338.wav", "duration": 4.235, "text": "北京市业馀排球联赛未来每年都将举办一届"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0314.wav", "duration": 6.5, "text": "发改委约谈各大空调企业的高管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0230.wav", "duration": 4.2729375, "text": "着力提高粮食综合生产能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0341.wav", "duration": 5.767125, "text": "如果要数一下中国女排谁最红"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0484.wav", "duration": 7.2268125, "text": "游客大铜缸刻字警察喊话故宫刻字者请自首"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0482.wav", "duration": 7.594, "text": "温州高速公路大米遭抢续五名涉案人员已落网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0452.wav", "duration": 7.3520625, "text": "清晨飘来辣眼白雾济南八名村民中毒入院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0474.wav", "duration": 6.44675, "text": "温州六旬老人辗转各地看公厕一二年还债七六万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0267.wav", "duration": 5.073, "text": "报收于每股一百一十五点四五美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0249.wav", "duration": 5.114, "text": "损害债劵持有人利益的事件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0433.wav", "duration": 8.051, "text": "温岭鞋厂倒塌事故已一四人遇难鞋厂老板被控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0398.wav", "duration": 4.746125, "text": "四季如春的俄罗斯黑海东部沿岸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0394.wav", "duration": 3.115, "text": "徐云丽最后动情地说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0415.wav", "duration": 4.545125, "text": "众星云集上海出席某商家的开业活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0259.wav", "duration": 3.938125, "text": "究竟哪个特特性更加重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0417.wav", "duration": 5.900875, "text": "陈凯琳田心妮等出席新剧开机机仪式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0417.wav", "duration": 3.0651875, "text": "更云集了罗中旭前任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0298.wav", "duration": 6.9749375, "text": "此外还将与美方联手研制一款升级版大鸦无人机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0160.wav", "duration": 4.583, "text": "据阳光家缘网站公布数据统计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0454.wav", "duration": 3.7109375, "text": "顾欣因涉嫌严重违纪违法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0196.wav", "duration": 3.6899375, "text": "明确了发展目标和重点任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0356.wav", "duration": 3.9489375, "text": "激发广大群众对排球的热情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0482.wav", "duration": 7.776125, "text": "网传该航班一名男性旅客对空姐试图性侵导致飞机返航"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0489.wav", "duration": 5.837875, "text": "半个月前因误食有毒野生菌中毒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0421.wav", "duration": 3.263875, "text": "多次想复合却无下文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0155.wav", "duration": 8.082, "text": "在三线城市库存高攀销售停滞的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0265.wav", "duration": 4.2630625, "text": "四月份或将采取更多的举动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0297.wav", "duration": 3.1440625, "text": "至于新的业务增长点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0242.wav", "duration": 4.1060625, "text": "政府总体上具有较强的偿债能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0372.wav", "duration": 3.969, "text": "受大学生的提议启发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0412.wav", "duration": 3.6320625, "text": "一袭土豪金西装简直潮爆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0475.wav", "duration": 4.49, "text": "因此我给自己规划了八个字的退休生活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0277.wav", "duration": 4.298125, "text": "苹果一口气召开了两次新品发布会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0130.wav", "duration": 5.153, "text": "设立国家住房银行条件已经基本成熟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0307.wav", "duration": 5.3290625, "text": "公司锂电池业务实现营业收入四点零一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0492.wav", "duration": 7.4721875, "text": "二十二日在文昌市清澜港边防派出所执法检查时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0491.wav", "duration": 4.4389375, "text": "发生了一起村民举报村支书贪腐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0253.wav", "duration": 3.2369375, "text": "或许到二零一六年的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0351.wav", "duration": 3.3350625, "text": "作为队里年龄最大的球员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0222.wav", "duration": 3.9810625, "text": "城投债劵的发行期限和利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0288.wav", "duration": 3.501125, "text": "我们肯定不能再沾沾自喜于世界工厂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0437.wav", "duration": 7.8989375, "text": "村书记乔俊然在家门前被一辆轿车撞倒后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0432.wav", "duration": 2.8188125, "text": "专偷摇摇车里的硬币"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0134.wav", "duration": 2.525, "text": "自二夏季开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0490.wav", "duration": 5.0068125, "text": "经十堰市中级人民法院确认"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0214.wav", "duration": 4.219, "text": "改善农业基础设备和装备条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0142.wav", "duration": 5.07, "text": "兰州楼市出现明显的区域分化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0275.wav", "duration": 3.581875, "text": "在三星第二季度财报中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0478.wav", "duration": 3.708, "text": "残疾等级为六级残疾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0134.wav", "duration": 5.057, "text": "包括此次三部委发布公积金新政"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0202.wav", "duration": 8.7139375, "text": "利用价格杠杆促进考试单位向集约化发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0142.wav", "duration": 4.322, "text": "二套执行认贷不认房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0491.wav", "duration": 7.4189375, "text": "坚决不在四风问题上犯错犯错误跌跟头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0264.wav", "duration": 4.3969375, "text": "据新华社电有病当然要吃药"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0477.wav", "duration": 4.999, "text": "餐厅返还了游客的二四零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0275.wav", "duration": 7.259, "text": "超过三百馀种不同类别股票均出现不正常股价波动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0454.wav", "duration": 4.068125, "text": "一则长达一分五七秒的视频在网络上热传"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0240.wav", "duration": 3.103, "text": "年均增速百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0310.wav", "duration": 3.8651875, "text": "除了四轴或三轴机器人外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0401.wav", "duration": 5.786875, "text": "几乎帮助了平昌拿下二零一八年冬奥会的主办权"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0329.wav", "duration": 3.9660625, "text": "毛利率为十九点六百分之六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0125.wav", "duration": 4.311, "text": "标杆房企必然调整市场战略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0177.wav", "duration": 5.817, "text": "而申请公积金贷款方面还是需要走严格的流程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0154.wav", "duration": 3.661, "text": "是每个家庭成员体验的统一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0378.wav", "duration": 3.8720625, "text": "早在申办北京冬奥会的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0354.wav", "duration": 6.3940625, "text": "更加多维度的助推跑步事业在中国的发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0278.wav", "duration": 4.9209375, "text": "就在会场的凳子和垃圾尚未收拾干净的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0230.wav", "duration": 7.109, "text": "提高中央财政对粮食油料生产大县转移支付水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0495.wav", "duration": 3.707, "text": "侵吞征地种粮补偿款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0488.wav", "duration": 2.7170625, "text": "如果这个事情反过来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0362.wav", "duration": 11.077875, "text": "欧米茄计时管理委员会成员彼得许尔泽勒介绍说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0158.wav", "duration": 3.831, "text": "房地产相关领域问题频发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0264.wav", "duration": 5.3670625, "text": "最近才开始向其他市场推广销售"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0214.wav", "duration": 3.157, "text": "发展多种形式的适度规模经营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0349.wav", "duration": 3.7939375, "text": "日本和中国同积十五分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0297.wav", "duration": 5.0739375, "text": "苹果担忧这会蚕食其市场份额"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0181.wav", "duration": 4.2420625, "text": "而且提供各项行生的福利性服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0157.wav", "duration": 5.294, "text": "上海易居研究所副院长杨红旭表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0491.wav", "duration": 3.6569375, "text": "今天九月八日下午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0455.wav", "duration": 7.928, "text": "港媒东莞工地连续两次坍塌路面似被吸入地底"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0225.wav", "duration": 5.3880625, "text": "未来应该在制度上进一步完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0214.wav", "duration": 3.543, "text": "有效防范海洋环境灾害"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0451.wav", "duration": 4.1191875, "text": "为更多的老人安度往年的心愿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0316.wav", "duration": 3.01975, "text": "就是符合国家标准的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0217.wav", "duration": 6.875, "text": "大幅度提升粮食综合生产能力和现代化生产水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0415.wav", "duration": 2.874, "text": "而且是一个爱哭鬼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0334.wav", "duration": 5.9560625, "text": "国内厂商在高端核心技术上普遍存有差距"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0474.wav", "duration": 5.6699375, "text": "通告呼吁广大群众积极检举揭发提供线索"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0397.wav", "duration": 5.0639375, "text": "中国女排昨天下午在冈山迎战古巴队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0141.wav", "duration": 3.9850625, "text": "进一步加速了消费者的入市节奏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0359.wav", "duration": 4.8369375, "text": "速滑馆建成后将设置四百米滑道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0141.wav", "duration": 5.118, "text": "二套还清十首套比例降至五成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0265.wav", "duration": 5.73, "text": "苹果股价一度每分钟跌幅已破百分之三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0489.wav", "duration": 5.5690625, "text": "继陕西富平妇产科医生张淑侠因贩卖婴儿被判刑之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0382.wav", "duration": 2.9770625, "text": "作为日本的花滑王子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0286.wav", "duration": 4.3310625, "text": "销售也总有饱和的一天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0224.wav", "duration": 3.8919375, "text": "落实节能减排各项任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0163.wav", "duration": 5.0010625, "text": "伴随着各地住房公积金新政的落地实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0272.wav", "duration": 5.6329375, "text": "未来的战争形态有可能就是计算机对抗计算机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0240.wav", "duration": 5.692, "text": "加大对农业科研和技术推广的支持力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0149.wav", "duration": 6.6839375, "text": "在丰台潘家村一宗商业用地低价成交后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0238.wav", "duration": 5.290875, "text": "加强畜禽遗传资源和农业野生植物资源保护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0302.wav", "duration": 3.938, "text": "不过这导致了很多新问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0403.wav", "duration": 3.8410625, "text": "文本报记者刘艾林"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0416.wav", "duration": 3.7629375, "text": "常常在看电影和新闻时流泪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0338.wav", "duration": 3.204125, "text": "二者虽从事项目不同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0322.wav", "duration": 6.6159375, "text": "并将从总部事业部及各区域公司共裁员二千人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0238.wav", "duration": 4.291, "text": "坚持政府支持农民主体社会参与"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0208.wav", "duration": 6.729, "text": "继续发挥该区域粮食安全基础保障作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0151.wav", "duration": 5.961, "text": "行业的玩家门槛越来越高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0193.wav", "duration": 4.7370625, "text": "由于影响成本的因素过多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0306.wav", "duration": 4.302, "text": "除了投入大这一因素之外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0139.wav", "duration": 5.307, "text": "德佑链家市场研究部总监陆骑麟表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0325.wav", "duration": 6.0490625, "text": "净利润为二十七点七五亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0175.wav", "duration": 5.0820625, "text": "未取得国有土地使用证的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0465.wav", "duration": 4.584, "text": "该地盘曾发生地陷事故"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0277.wav", "duration": 6.701875, "text": "根据美国商务部去年十二月份终裁确定的幅度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0172.wav", "duration": 4.271, "text": "郑州长春和哈尔滨三地办事处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0344.wav", "duration": 4.452875, "text": "运动员的健康是他们关注的头等大事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0414.wav", "duration": 4.9089375, "text": "仍在个人社群网站频繁更新动态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0423.wav", "duration": 6.4340625, "text": "而有鬼妹仔性格的婷婷不时以性感打扮亮相"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0386.wav", "duration": 3.458, "text": "至于其他球队的比赛结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0205.wav", "duration": 4.7620625, "text": "为确保免费政策实施后车辆有序通行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0440.wav", "duration": 4.0749375, "text": "该女子已经行骗多地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0385.wav", "duration": 2.722875, "text": "发挥也很从容和淡定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0159.wav", "duration": 3.5190625, "text": "中介机构统计数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0287.wav", "duration": 3.4510625, "text": "但是至少会给股价刺激一下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0303.wav", "duration": 4.495875, "text": "北京商报讯记者王晔君日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0234.wav", "duration": 3.8100625, "text": "稳定发展生猪和蛋禽"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0303.wav", "duration": 5.4200625, "text": "在认证授权系统中对服务器设置权限管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0346.wav", "duration": 4.901875, "text": "在奥运期间水质都可以保证运动员的健康"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0176.wav", "duration": 7.9399375, "text": "或开发项目资本金未达到项目投资总额百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0366.wav", "duration": 3.4189375, "text": "凶悍直接大开大合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0360.wav", "duration": 4.702875, "text": "二十岁的跑者平均每英里耗时八分十八秒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0136.wav", "duration": 4.281, "text": "蓝色光标以几亿人民币收购今久"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0181.wav", "duration": 3.82, "text": "好像不谈你就不属于这个时代的人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0372.wav", "duration": 5.016125, "text": "这在我国体育发展史上具有划时代的意义"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0267.wav", "duration": 4.28, "text": "全球鹰并不能独占鳌头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0326.wav", "duration": 4.0019375, "text": "经验积累不足也是一个大问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0224.wav", "duration": 3.8360625, "text": "关于印发十二五规划的通知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0258.wav", "duration": 3.526, "text": "并非仅仅针对中国公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0380.wav", "duration": 6.3010625, "text": "曾春蕾表示阿根廷是一支拥有良好防守能力的球队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0341.wav", "duration": 6.375, "text": "他们有理由相信九零后同样可以做好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0444.wav", "duration": 8.76, "text": "延庆县永宁镇偏坡峪村原党支部书记钱某"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0296.wav", "duration": 5.248, "text": "即一些财大气粗的科技公司自己不创新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0171.wav", "duration": 4.183, "text": "中原地产首席分析师张大伟认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0473.wav", "duration": 2.6899375, "text": "立即引起众多网友关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0241.wav", "duration": 3.3239375, "text": "回收再利用农膜和农药包装物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0163.wav", "duration": 4.243, "text": "国家外汇局出台过规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0156.wav", "duration": 3.2569375, "text": "公积金政策的调整从未这么频繁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0247.wav", "duration": 3.969, "text": "一些考试单位考务成本偏高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0234.wav", "duration": 6.735, "text": "必须符合一些基本的条件企业必须连续三年盈利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0142.wav", "duration": 3.473, "text": "市场基数已不可同日而语"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0237.wav", "duration": 3.28, "text": "正是有了这样一些严格的规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0123.wav", "duration": 3.5, "text": "则是希望防止外资流出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0229.wav", "duration": 3.771, "text": "二零一一年一月至七月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0231.wav", "duration": 3.9400625, "text": "坚持和完善农村基本经营制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0475.wav", "duration": 4.833, "text": "仅半年就敲诈勒索了五七二万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0462.wav", "duration": 8.3679375, "text": "该事件系游客点餐时嫌大排档太脏而引起口角纷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0444.wav", "duration": 6.3449375, "text": "肇事方为镇政府安全保卫人员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0278.wav", "duration": 5.8940625, "text": "其中手机的销售额下降了七点百分之三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0484.wav", "duration": 6.103, "text": "港媒称假沉香充斥内地多以化学香油制成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0324.wav", "duration": 5.219, "text": "中国家电企业在世界产业链地位弱小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0337.wav", "duration": 3.465125, "text": "将及时采取主动或被动措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0361.wav", "duration": 3.9721875, "text": "拳法和摔跤能力很出色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0168.wav", "duration": 6.129, "text": "五个城市新建商品住宅存销比为七个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0494.wav", "duration": 6.8920625, "text": "游客打车被找四张同号假钞官方疑遇克隆车"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0138.wav", "duration": 4.49, "text": "依托蓝色光标强大的技术和资源优势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0250.wav", "duration": 5.0599375, "text": "改革了职业资格考试收费管理方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0194.wav", "duration": 3.1369375, "text": "在加强宏观引导方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0430.wav", "duration": 3.0070625, "text": "称潘玮柏生日快乐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0274.wav", "duration": 7.2199375, "text": "苹果公司现在已将约三百万的原始订单削减了一半"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0229.wav", "duration": 3.5119375, "text": "基本满足国内棉花消费需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0442.wav", "duration": 2.959, "text": "无不发出这样的惊叹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0463.wav", "duration": 5.793, "text": "三零馀位食客吃了四五个窝窝头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0464.wav", "duration": 4.9601875, "text": "法官送达起诉书副本等应诉材料遇阻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0470.wav", "duration": 3.4089375, "text": "经过连续三天的抢救"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0306.wav", "duration": 2.6230625, "text": "以小天才电话手表为例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0355.wav", "duration": 4.543, "text": "丰富北京市业馀排球群体活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0198.wav", "duration": 5.693, "text": "新批复了七只创投基金的设立方案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0188.wav", "duration": 4.886, "text": "将发挥部际会议联席制度作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0135.wav", "duration": 5.161, "text": "此项政策对中国楼市影响有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0269.wav", "duration": 5.609, "text": "苹果正在全力以赴出售尽可能多的智能手机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0165.wav", "duration": 2.8500625, "text": "同比减小百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0201.wav", "duration": 3.283, "text": "是一个比较复杂的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0229.wav", "duration": 9.219, "text": "城市政府要将公共交通发展资金纳入公共财政体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0209.wav", "duration": 9.1180625, "text": "积极指导支持和鼓励金融机构根据中小企业的特点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0334.wav", "duration": 4.8769375, "text": "对本公司的上半年业绩带来了负面影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0484.wav", "duration": 8.608875, "text": "编者按为深入贯彻落实中央八项规定精神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0320.wav", "duration": 3.078, "text": "最后找到芬兰的高级技术团队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0315.wav", "duration": 4.875, "text": "浪潮的发展也有可圈可可点之处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0156.wav", "duration": 4.432, "text": "据中国指数研究院最新数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0472.wav", "duration": 5.521, "text": "警方回应都有过错经警方调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0483.wav", "duration": 8.568125, "text": "原因是有人愿为该村垫资四八万元费用修桥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0200.wav", "duration": 6.653, "text": "发改委将尽快建立地方政府债务管理体系到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0433.wav", "duration": 2.7680625, "text": "送到医院时已没有呼吸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0160.wav", "duration": 5.891, "text": "在上海易居房地产研究院研究员严跃进看来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0447.wav", "duration": 3.650875, "text": "海峡都市报大白天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0392.wav", "duration": 4.555875, "text": "对于北京申办冬奥会的最终结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0281.wav", "duration": 5.13, "text": "中国经营网注有国外媒体报道称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0458.wav", "duration": 3.047875, "text": "骑电动车男子当场死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0189.wav", "duration": 4.0460625, "text": "实行农产品产地安全分级管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0493.wav", "duration": 4.104, "text": "京华时报讯记者王晓飞在农村"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0167.wav", "duration": 3.7440625, "text": "土地成交价款三千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0452.wav", "duration": 4.0349375, "text": "再上到楼顶一座高约四零米的铁塔上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0494.wav", "duration": 4.3149375, "text": "党和人民不会管到我身上来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0401.wav", "duration": 4.8669375, "text": "北京和张家口要占据着相当明显的优势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0461.wav", "duration": 7.2419375, "text": "温州一四岁少年小温迷失莒溪大峡谷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0412.wav", "duration": 4.193125, "text": "好友林心如也心疼喊话我会陪她"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0355.wav", "duration": 3.0961875, "text": "比赛开始后仅仅十馀秒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0374.wav", "duration": 5.6159375, "text": "日本与美国同积十十分暂列二三两位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0494.wav", "duration": 6.5849375, "text": "中国的动画工作室越来越看重海外市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0242.wav", "duration": 3.587, "text": "责任编辑廖一宁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0234.wav", "duration": 4.9359375, "text": "改扩建检验检测实验室"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0420.wav", "duration": 2.443125, "text": "粉丝们一度失控"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0294.wav", "duration": 3.3890625, "text": "用户发现系统更新之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0323.wav", "duration": 4.318125, "text": "电话手表对儿童健康安全是否有危险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0219.wav", "duration": 4.365, "text": "以邓小平理论和三个代表重要思想为指导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0350.wav", "duration": 4.474125, "text": "年龄大跑者的步幅明显短于年轻人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0183.wav", "duration": 2.8940625, "text": "将于明年投标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0456.wav", "duration": 8.9030625, "text": "游客景区被忽悠八零零克石斛收费一二六零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0342.wav", "duration": 4.4140625, "text": "使上年纪的跑者也能保持较快的速度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0480.wav", "duration": 7.365, "text": "村主任发账号给村文书想要继续当拿四八万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0141.wav", "duration": 5.3559375, "text": "主要还是依靠中国国内企业投资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0438.wav", "duration": 3.8818125, "text": "破获电信诈骗案二三三起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0365.wav", "duration": 5.277125, "text": "与这项运动结下深厚感情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0422.wav", "duration": 3.312, "text": "自己也很期待九月中旬和男友见面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0398.wav", "duration": 4.9299375, "text": "能在北京获得一枚奖牌我很骄傲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0462.wav", "duration": 4.378875, "text": "两车损失高达数十万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0139.wav", "duration": 4.344, "text": "成立资金信托购买自家房产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0348.wav", "duration": 3.489, "text": "在球场上的思路比较清楚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0320.wav", "duration": 5.5659375, "text": "上述成飞集成人士告诉记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0469.wav", "duration": 4.668, "text": "起因也完全不是河南游客自己说的那样"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0463.wav", "duration": 3.9020625, "text": "北京南三环附近一家茶楼里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0332.wav", "duration": 4.1320625, "text": "被恶意软件或者黑客攻击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0276.wav", "duration": 3.1069375, "text": "车库没有发挥过太大作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0491.wav", "duration": 4.457, "text": "向一家金融公司贷款一千多万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0153.wav", "duration": 5.6240625, "text": "这决不是八零九零的消费习惯这么单纯的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0434.wav", "duration": 3.534875, "text": "八月一七日上午一一时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0209.wav", "duration": 4.1369375, "text": "城市化进程远未结束"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0333.wav", "duration": 3.4128125, "text": "汽车零部件总体规模不大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0453.wav", "duration": 5.9040625, "text": "说最近他们村里经常有蛇出没"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0138.wav", "duration": 3.1789375, "text": "住建部等三部委联合发文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0431.wav", "duration": 7.8881875, "text": "记者调查湖南张家界国家森林公园低价团问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0220.wav", "duration": 4.625, "text": "积极推进南方稻区单改双"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0395.wav", "duration": 3.771, "text": "来自体育圈的并不多见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0278.wav", "duration": 4.6440625, "text": "美国玩家对游戏难度创造性要求较高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0249.wav", "duration": 5.189, "text": "投资者采取措施防范风险是成熟的表现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0258.wav", "duration": 8.1320625, "text": "作为科技股领头羊的苹果股价当天下挫百分之二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0221.wav", "duration": 5.787, "text": "是如何更好地防范城投债券可能出现的风险的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0361.wav", "duration": 4.8459375, "text": "从二零零七年在伦敦创办至今"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0455.wav", "duration": 5.52975, "text": "记者李焜染摄十三日早晨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0274.wav", "duration": 4.354, "text": "美国市场刚好介于两者之间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0472.wav", "duration": 4.8689375, "text": "其中一辆奔驰轿车被撞出近一零米远"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0378.wav", "duration": 5.1850625, "text": "看他在冰场上搔首弄姿地表现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0181.wav", "duration": 7.7790625, "text": "备受刚需购房者关注的公积金政策也频繁迎来调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0165.wav", "duration": 5.146, "text": "国内许多媒体或企业都在为其背书"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0408.wav", "duration": 5.5441875, "text": "对方是二十五岁的人妻名模泰舒培"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0448.wav", "duration": 5.558125, "text": "三零馀位食客吃了四五个窝窝头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0171.wav", "duration": 3.6839375, "text": "二到五个城市的总体水平看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0227.wav", "duration": 3.0339375, "text": "继续实行最严格的耕地保护制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0430.wav", "duration": 2.5339375, "text": "对方给了她很大的帮助"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0203.wav", "duration": 4.191, "text": "与农户建立紧密型利益联联结关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0456.wav", "duration": 7.6848125, "text": "历城区港沟镇神武村飘来多股白色不明气体"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0458.wav", "duration": 4.8659375, "text": "地面在几秒内迅速塌陷成一个大坑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0229.wav", "duration": 4.999, "text": "国务院多举措力挺农产品流通"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0141.wav", "duration": 4.449, "text": "为改善中低收入家庭住房条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0318.wav", "duration": 6.1219375, "text": "也成为老板电器和它的宿敌们能否领跑下半程的关键"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0378.wav", "duration": 6.7839375, "text": "附二零一五田径世锦赛德国队名单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0209.wav", "duration": 9.163, "text": "需要向国务院国资委报送申请核准非主业投资的请示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0155.wav", "duration": 6.418, "text": "公积金贷款及组合贷咨询量明显上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0381.wav", "duration": 8.267125, "text": "但庞清和佟健并不愿意随遇而安地安排自己的后半生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0188.wav", "duration": 5.411, "text": "并在农业走出去方面发挥重要作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0480.wav", "duration": 7.421875, "text": "游客入住药店被收二零元马桶使用费消协可举报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0194.wav", "duration": 4.3559375, "text": "由各省根据实际成本制定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0386.wav", "duration": 4.5, "text": "关于中国队过于依赖朱婷的言论不少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0185.wav", "duration": 6.1950625, "text": "预计后市一二线城市拿地竞争将更加剧烈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0372.wav", "duration": 4.771, "text": "直到二零一四年四月才解禁复出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0193.wav", "duration": 8.416, "text": "需要对发行人资产重组等重大事宜加强监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0452.wav", "duration": 8.3659375, "text": "该商店老板郑晓生红衣者涉嫌暗地里兑换外汇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0422.wav", "duration": 4.135, "text": "好多传闻我都不会特别问他"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0380.wav", "duration": 3.5188125, "text": "令对手无奈放弃比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0410.wav", "duration": 6.6840625, "text": "亦未联络到爸爸了解他不是一个常打架的人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0276.wav", "duration": 3.3559375, "text": "科幻星系康斯坦丁文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0465.wav", "duration": 5.761, "text": "游客爬到峨眉山悬崖边石头上拍照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0357.wav", "duration": 5.707, "text": "常年的专业训练给身体带来了各种伤病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0389.wav", "duration": 2.9411875, "text": "最大的已经年过半百"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0320.wav", "duration": 7.244125, "text": "到二零一八年美的空调营收到达一千亿元规划时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0202.wav", "duration": 4.8779375, "text": "农产品加工业产值与农业总产值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0383.wav", "duration": 4.8818125, "text": "双方进行了最后一次也是最成功的一次洽谈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0211.wav", "duration": 7.353, "text": "我们应该建立风险可控的规范化的地方政府融资机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0461.wav", "duration": 2.755125, "text": "一五年后落网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0317.wav", "duration": 5.853, "text": "令车企烦恼的不仅是车主信息被泄露这一困扰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0342.wav", "duration": 3.0900625, "text": "不断地为中国女排得分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0215.wav", "duration": 8.093, "text": "发挥好民间借贷在服务中小企业发展中的积极作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0282.wav", "duration": 7.16, "text": "四倍于标指同期的三十百分之二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0425.wav", "duration": 5.01, "text": "还在网上分享身穿比基尼泳装照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0486.wav", "duration": 9.839125, "text": "村主任向开发商索贿五二零万村组干部几乎全参与分赃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0366.wav", "duration": 4.792, "text": "与感冒病毒感染损伤心肌有关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0183.wav", "duration": 4.2849375, "text": "相关公司股票走势鄂尔多斯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0138.wav", "duration": 3.994, "text": "该信托出资购入宋芳的房产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0381.wav", "duration": 3.8249375, "text": "这一点也值得中国女排学习"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0194.wav", "duration": 7.9489375, "text": "牢固树立生产生态有机结合生态优先的基本方针"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0215.wav", "duration": 3.8459375, "text": "保障房建设和棚户区改造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0266.wav", "duration": 2.7199375, "text": "从支付的大环境上看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0297.wav", "duration": 4.584125, "text": "印方工厂将继续完成剩馀订单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0123.wav", "duration": 3.928, "text": "消费者行为的变化及技术的进步"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0419.wav", "duration": 5.27, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0402.wav", "duration": 4.563, "text": "这样的氛围让朱婷感觉像是主场一样"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0438.wav", "duration": 3.886, "text": "死亡人数上升至一四人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0371.wav", "duration": 5.2580625, "text": "滑雪期从十一月下旬到次年三月中旬"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0251.wav", "duration": 3.886, "text": "明确了参股基金管理公司股东"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0154.wav", "duration": 4.1600625, "text": "加之降息降准等政策组合拳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0191.wav", "duration": 4.293, "text": "不仅是城投债券发行利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0429.wav", "duration": 3.334, "text": "她透露有些不懂的会问男友郑嘉颖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0442.wav", "duration": 8.646, "text": "游客踩敦煌千年古城遗址拍照反问踩了会掉吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0378.wav", "duration": 3.411875, "text": "据韩国体育首尔的最新消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0139.wav", "duration": 4.84, "text": "这也是该指数连续三个月出现上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0389.wav", "duration": 8.46925, "text": "标志性的扫腿重击力道沉猛的后手重拳纷纷呼啸而出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0480.wav", "duration": 8.9809375, "text": "浙江在线零九月二一日讯浙江日报记者季建荣近日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0246.wav", "duration": 3.079, "text": "继续实施农村沼气工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0251.wav", "duration": 10.6960625, "text": "通过投资入股产权回购回租建公建配套等方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0478.wav", "duration": 6.4350625, "text": "游客在百年老店买到发霉盐水鸭商家主动退款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0383.wav", "duration": 3.5839375, "text": "每场较量对球队都很关键"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0472.wav", "duration": 5.496125, "text": "并最新发微博表示当地警方已介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0333.wav", "duration": 3.2268125, "text": "对于国内家电企业而言"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0465.wav", "duration": 5.1289375, "text": "尽管检察管最后以事事实不清"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0327.wav", "duration": 4.0399375, "text": "我们开发什么的产品研发策略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0147.wav", "duration": 3.506, "text": "支持新产业新业态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0492.wav", "duration": 9.1049375, "text": "村官涉不雅视频被免职饭桌上摸女子胸部臀部等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0136.wav", "duration": 7.5, "text": "使用公积金制度的作用和效果没有得到有效的发挥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0299.wav", "duration": 3.4249375, "text": "也过分依赖于大中华地区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0287.wav", "duration": 4.2170625, "text": "但是需记住对风向保持敏感"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0459.wav", "duration": 5.468, "text": "游客骑在龟趺身上报料人供图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0462.wav", "duration": 9.8630625, "text": "东莞常平住宅大厦联邦花园旁边发生大面积地陷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0217.wav", "duration": 4.337, "text": "看看山东之前是怎么做的记者了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0368.wav", "duration": 3.6589375, "text": "颇似从地狱中走出的修罗帝王"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0449.wav", "duration": 3.795875, "text": "两车驾驶员一度下车大打出手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0239.wav", "duration": 5.142, "text": "远低于发生债务危机的欧美国家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0449.wav", "duration": 6.526125, "text": "遗址附近有多处警示牌写明严禁跨入保护区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0428.wav", "duration": 3.7739375, "text": "也没有发生什么冲突"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0388.wav", "duration": 7.5590625, "text": "美国队官员不排除他们的队员因食物或饮水而生病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0236.wav", "duration": 2.9979375, "text": "增加机构投资者数量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0430.wav", "duration": 8.8840625, "text": "并兼任李嘉欣经理人及处理旗下其他艺人的合约事宜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0358.wav", "duration": 4.2619375, "text": "服务时间约为五十三万小时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0287.wav", "duration": 4.0600625, "text": "这次庭审将持续九天时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0474.wav", "duration": 6.4099375, "text": "记者从首都机场公安分局航站区派出所获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0122.wav", "duration": 5.021, "text": "北京通州新城投资公司网站显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0329.wav", "duration": 4.0, "text": "高工机器人董事长张小飞表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0434.wav", "duration": 5.488, "text": "而绝代歌姬李玉刚揭面引起了广泛热议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0203.wav", "duration": 4.813, "text": "温家宝主持召开国务院常务会议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0192.wav", "duration": 3.768, "text": "推进农业产业化经营跨越式发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0137.wav", "duration": 5.071, "text": "宋芳对北京银行私人银行的财富顾问说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0310.wav", "duration": 9.422, "text": "将有助于两大部品业务的研发资源销售渠道共享"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0489.wav", "duration": 10.073, "text": "温州高速车祸九二包大米遭哄抢续带头者被拘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0365.wav", "duration": 6.053, "text": "当打到一三比一四中国队落后一分时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0326.wav", "duration": 6.5550625, "text": "而威灵电器二零一四年的营业额约九十二点七三亿港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0387.wav", "duration": 3.053, "text": "希望可以见到她本人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0279.wav", "duration": 3.691875, "text": "都是该公司的强心剂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0247.wav", "duration": 6.7320625, "text": "继续加强三江源等地区草原生态建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0445.wav", "duration": 3.6579375, "text": "并提出多种思考和提示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0386.wav", "duration": 4.1950625, "text": "一些参赛选手赛后感到胃部不适"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0358.wav", "duration": 4.214125, "text": "计划明年就将开始动工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0288.wav", "duration": 5.021, "text": "由士兵直接用手投掷起飞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0229.wav", "duration": 4.828, "text": "强化出口水产品生产基地功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0381.wav", "duration": 7.354, "text": "获得二十三分荣誉全场得分王"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0280.wav", "duration": 3.6800625, "text": "苹果设备的用户应当注意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0156.wav", "duration": 4.5, "text": "通过国家住房银行提供低息贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0411.wav", "duration": 4.8989375, "text": "还拉赞姑还是那么漂亮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0469.wav", "duration": 3.0659375, "text": "更没有扰乱社会秩序"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0349.wav", "duration": 4.168125, "text": "时隔一二年重夺世界杯冠军的中国女排"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0420.wav", "duration": 2.9701875, "text": "因此决定出外闯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0475.wav", "duration": 3.266875, "text": "导致唐山一渔船沉没"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0298.wav", "duration": 5.077875, "text": "马斯克乃商界新一代万人迷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0273.wav", "duration": 4.318125, "text": "当年泡沫破裂前也是这样的情景"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0297.wav", "duration": 4.451875, "text": "因为难以忍受股价长期被低估"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0334.wav", "duration": 4.875, "text": "往往将数据库服务器都放在公网上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0148.wav", "duration": 3.0559375, "text": "这相当于左兜掏右兜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0246.wav", "duration": 8.297, "text": "合理确定大城市郊区菜篮子产品生产用地保有数量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0495.wav", "duration": 8.6120625, "text": "港媒称内地人不穷了为何仍爱抢学者抢习惯了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0437.wav", "duration": 6.235875, "text": "澎湃新闻八月一零日从浙江温州平阳警方获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0182.wav", "duration": 5.313, "text": "明年平均售价将维持不变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0147.wav", "duration": 5.2800625, "text": "公积金政策放宽对楼市成交的短期刺激作用将难以持续"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0490.wav", "duration": 5.4550625, "text": "中产阶级在一个国家的现代化中起着稳定作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0162.wav", "duration": 4.7219375, "text": "再次降低公积金贷款首付比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0292.wav", "duration": 8.0460625, "text": "改由设在印度本加卢鲁的一家美印合资公司生产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0232.wav", "duration": 5.323, "text": "防止出现系统性的偿债风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0184.wav", "duration": 4.5129375, "text": "伟嘉安捷对中新网房产频道表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0395.wav", "duration": 4.1238125, "text": "曾春蕾在刘晓彤一传失误后直接说我来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0261.wav", "duration": 4.66, "text": "因此需求会暂时被抑制住"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0481.wav", "duration": 5.847875, "text": "新洲一名高中新生因为没去教室上晚自习"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0153.wav", "duration": 5.823, "text": "审计已向有关部门移送重大违法违纪问题三十起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0432.wav", "duration": 5.3730625, "text": "追求使命需要有强大的定力昨日上午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0133.wav", "duration": 3.065, "text": "宋芳最近却有点烦恼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0211.wav", "duration": 4.151, "text": "适宜农户沼气普及率百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0430.wav", "duration": 2.3090625, "text": "中午二十零下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0321.wav", "duration": 4.307875, "text": "很多孩子都以拥有一款电话手表为豪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0200.wav", "duration": 3.0, "text": "在加快体制改革方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0392.wav", "duration": 2.9020625, "text": "责任编辑冯浩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0471.wav", "duration": 5.7260625, "text": "迅速引起了网友以及当地监管部门的关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0227.wav", "duration": 5.472875, "text": "但却提醒了我们要更加关注城投债券可能出现的风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0359.wav", "duration": 3.5710625, "text": "突出弘扬北京排球文化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0346.wav", "duration": 5.332, "text": "张晓雅最大的优点是有想法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0151.wav", "duration": 4.205, "text": "与前年差不多这种状态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0235.wav", "duration": 5.2950625, "text": "对化学品项目布局进行梳理评估"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0422.wav", "duration": 3.0129375, "text": "自己也有带剧本去看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0192.wav", "duration": 6.8299375, "text": "我委也注意到在企业债劵存续期内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0382.wav", "duration": 5.5859375, "text": "根据国际乒联刚刚公布的最新一期世界排名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0166.wav", "duration": 6.581, "text": "备受刚需购房者关注的公积金政策也频繁迎来调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0407.wav", "duration": 7.6799375, "text": "在英格兰多塞特群的波维顿坦克博物馆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0208.wav", "duration": 10.051, "text": "中国证卷报随着欧美等国主权债务危机陆续爆发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0320.wav", "duration": 3.1899375, "text": "同时公布了重组计划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0336.wav", "duration": 4.9140625, "text": "是电话手表今年大受欢迎的主要原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0460.wav", "duration": 4.839125, "text": "荞麦窝窝头一零月二零日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0354.wav", "duration": 5.036125, "text": "像这种无形的向心力是在队伍中一直存在的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0438.wav", "duration": 6.3269375, "text": "甚至还出现了一些造成游人身伤害的悲剧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0416.wav", "duration": 6.005875, "text": "许茹芸与韩国丈夫崔栽诚迎来结婚一周年纪念日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0468.wav", "duration": 6.322, "text": "在新加坡花费三万元购买了纯天然的祖母绿吊坠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0125.wav", "duration": 3.352, "text": "刘家义在报告中指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0214.wav", "duration": 5.8310625, "text": "大力开展高产创建和科技指导服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0270.wav", "duration": 6.9079375, "text": "这家社交网络巨头对待员工也是相当慷慨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0439.wav", "duration": 3.1799375, "text": "旅游法早已明令禁止"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0467.wav", "duration": 6.249, "text": "每一次塌陷的区域前已有一个大坑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0264.wav", "duration": 5.1529375, "text": "我们所做的就是发现漏洞后立即修复"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0211.wav", "duration": 6.3879375, "text": "项目可行性研究报告尽职调查等相关文件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0239.wav", "duration": 5.0400625, "text": "此举可能将进一步推动金融混业经营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0401.wav", "duration": 3.677, "text": "一定要尽全力打一场漂亮的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0301.wav", "duration": 4.7331875, "text": "库克团队应当是花费了大量精力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0494.wav", "duration": 4.6208125, "text": "几乎家家户户都会在院子里养狗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0172.wav", "duration": 4.393, "text": "我预计市场成交量会有所增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0329.wav", "duration": 3.1899375, "text": "共同拓展国内云计算市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0441.wav", "duration": 5.657, "text": "温州一酒店窝头三八元一个三盘消费一七一零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0447.wav", "duration": 4.802, "text": "李磊的奶奶继承四三七万馀元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0280.wav", "duration": 3.144875, "text": "但松一口气的想法是没有出路的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0358.wav", "duration": 4.345, "text": "在社会主义核心价值观的指引下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0340.wav", "duration": 3.123875, "text": "筹备时间和比赛周期都将延长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0335.wav", "duration": 3.6640625, "text": "美的空调工厂的注塑车间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0300.wav", "duration": 5.9150625, "text": "从而把运输机转化为更为复杂的远程侦察机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0126.wav", "duration": 4.014, "text": "房地产投资增速仍下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0440.wav", "duration": 8.5759375, "text": "港商在台遭绑三八天获救后痛哭以为必死"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0242.wav", "duration": 3.283, "text": "合力推进现代农业发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0196.wav", "duration": 2.775, "text": "这主要有四方面原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0448.wav", "duration": 3.8979375, "text": "此后他没有隐姓埋名逃往外地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0373.wav", "duration": 5.5951875, "text": "该公众号已经举办了两期公益活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0248.wav", "duration": 3.5909375, "text": "规范和完善农产品期货市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0404.wav", "duration": 3.1238125, "text": "福斯只允许先拍一部"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0129.wav", "duration": 4.103, "text": "其他目的的占比为百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0424.wav", "duration": 6.6269375, "text": "她日前被媒体目击与陈可辛在大街上逛街血拼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0168.wav", "duration": 2.66, "text": "拥有许多优质客户"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0385.wav", "duration": 3.5869375, "text": "以及拥有陈露的女单项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0386.wav", "duration": 3.711875, "text": "曾春蕾坦言打关键分的状态很忘我"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0336.wav", "duration": 8.130125, "text": "网络安全漏洞挡道车联网阴霾笼罩搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0407.wav", "duration": 7.077875, "text": "这是后年春季档的一个黄金上映期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0354.wav", "duration": 3.335125, "text": "大家今天打得非常出色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0354.wav", "duration": 6.2851875, "text": "其搏击技能之全面精湛格斗天赋之卓越令人惊叹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0145.wav", "duration": 6.221, "text": "五环内商品住宅的成交在市场中并非主流"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0369.wav", "duration": 3.8000625, "text": "女排众将手举国旗敬夺冠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0446.wav", "duration": 3.478, "text": "剩下了一二零零克食物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0139.wav", "duration": 5.747, "text": "再次申请公积金贷款购房的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0259.wav", "duration": 3.7430625, "text": "十二月二日路透社报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0377.wav", "duration": 4.5959375, "text": "但今天能拿冠军真的是发自肺腑的想哭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0228.wav", "duration": 4.3000625, "text": "充分征求专家和社会公众意见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0266.wav", "duration": 4.719, "text": "美国政府部门当地时间周四警示称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0128.wav", "duration": 5.803, "text": "均规定贷款额度不再依据个人信用等级上浮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0471.wav", "duration": 2.954125, "text": "有待警方进一步调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0487.wav", "duration": 6.6691875, "text": "温州医生涉贩卖儿童谎称活婴是死婴骗父母放弃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0226.wav", "duration": 3.4669375, "text": "新农村十二五发展规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0208.wav", "duration": 4.5459375, "text": "支持农民专业合作社参加农产品展示展销活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0226.wav", "duration": 3.6800625, "text": "延长各类设施使用年限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0305.wav", "duration": 4.5500625, "text": "赵伟国并未透露更多内容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0446.wav", "duration": 3.600125, "text": "已依法对双方进行处罚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0316.wav", "duration": 4.6858125, "text": "消费者在听销售人员介绍小天才电话手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0454.wav", "duration": 6.0449375, "text": "浙江温州一公司安装虚拟交易系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0330.wav", "duration": 4.708, "text": "净利润为九点七亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0157.wav", "duration": 3.9020625, "text": "今年商品房销售一度低迷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0463.wav", "duration": 6.5969375, "text": "游戏平台称投千元可收百万数十民上当"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0357.wav", "duration": 6.6650625, "text": "为将其打造成具有影响力的群众性品牌赛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0371.wav", "duration": 3.0, "text": "每天忙碌十三个小时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0353.wav", "duration": 4.2631875, "text": "我们不需要教练要求就会团结在一起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0198.wav", "duration": 2.965125, "text": "还本付息也是正常的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0142.wav", "duration": 5.941, "text": "意见提出对制造业迈向中高端的企业用地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0475.wav", "duration": 5.843, "text": "复议维持了区政府的认定结论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0272.wav", "duration": 7.5, "text": "从台湾地区进口的此类产品存在切销行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0470.wav", "duration": 6.5439375, "text": "村中数百亩农田干旱村民质疑水库断了灌溉水"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0273.wav", "duration": 4.339, "text": "英特尔是世界头号芯片制造商"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0377.wav", "duration": 6.173125, "text": "刚刚在日本女排世界杯上夺冠的中国女排载誉回京"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0248.wav", "duration": 4.7259375, "text": "各城市要根据消费需求和季节变化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0466.wav", "duration": 4.818125, "text": "送医后被查出颈部脊髓损伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0428.wav", "duration": 2.864, "text": "十九点二十六分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0464.wav", "duration": 5.4260625, "text": "信息时报讯记者周伟龙天上不会掉馅饼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0473.wav", "duration": 7.614, "text": "某景点大门处多名游客与身着穿服的工作人员大打出手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0229.wav", "duration": 6.9639375, "text": "但却提醒了我们要更加关注城投债券可能出现的风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0335.wav", "duration": 4.2879375, "text": "成飞集成百二十一九十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0375.wav", "duration": 5.756125, "text": "将依托现有山体地形修建临时场地设施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0457.wav", "duration": 3.6279375, "text": "记者回访海珠湖公园发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0240.wav", "duration": 3.302, "text": "进一步减少流通环节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0153.wav", "duration": 9.5, "text": "今兰州市商品房销售面积同比上涨超过百分之三十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0442.wav", "duration": 6.911875, "text": "从金堂县城驱车一个半小时至土桥镇的大禹村"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0256.wav", "duration": 3.1839375, "text": "有人给出了解决方法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0179.wav", "duration": 3.8559375, "text": "但目前还未出现大面积提取行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0260.wav", "duration": 3.871, "text": "由于许多用户都持币待购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0264.wav", "duration": 4.993875, "text": "苹果将继续向股东返还现金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0425.wav", "duration": 2.4130625, "text": "松口仍有联络"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0308.wav", "duration": 5.1269375, "text": "儿童电话手表除了通话定位等功能外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0295.wav", "duration": 4.412, "text": "苹果股价已下挫了百分之七十九"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0453.wav", "duration": 6.765125, "text": "筹款四八零零万经六年建成养老院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0367.wav", "duration": 8.243125, "text": "上届莫斯科世锦赛上拿到了金牌的四位选手悉数出战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0475.wav", "duration": 3.501, "text": "温州网讯我不想死后给后人说闲话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0422.wav", "duration": 3.207, "text": "她的团队对她更加关心了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0283.wav", "duration": 4.4860625, "text": "科技经济社会金融全都是苹果的消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0209.wav", "duration": 4.2049375, "text": "这是我国所处的发展阶段决定的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0199.wav", "duration": 4.0, "text": "农产品产销合作社简介"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0338.wav", "duration": 6.0549375, "text": "他们在训练和比赛过程之中的速度也会逐渐慢下来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0286.wav", "duration": 5.6579375, "text": "苹果股价闪崩只是正常股票套利的表现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0486.wav", "duration": 9.5959375, "text": "港媒中国科学家研究蜈蚣毒液发现新止痛药"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0347.wav", "duration": 4.04, "text": "当在新闻发布会上被问及伤情的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0379.wav", "duration": 3.1269375, "text": "法国冰协提出最后要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0377.wav", "duration": 2.7460625, "text": "马塞洛特的母亲表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0127.wav", "duration": 3.916, "text": "国家住房银行箭在弦上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0126.wav", "duration": 5.404, "text": "为完成全念土地供应计划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0180.wav", "duration": 5.4459375, "text": "同策咨询研究部总监张宏伟认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0180.wav", "duration": 3.9600625, "text": "人民币成交额减少百分之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0123.wav", "duration": 4.701, "text": "本世纪网至本世纪经济报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0223.wav", "duration": 3.379, "text": "一些没有直接收益的项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0225.wav", "duration": 2.8510625, "text": "我看了以后很受震动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0151.wav", "duration": 4.865, "text": "链家地产市场研究部数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0262.wav", "duration": 4.4140625, "text": "比之大市亦有所不如"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0284.wav", "duration": 5.3259375, "text": "阿里巴巴当日股价下跌一点百分之四"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0271.wav", "duration": 4.875, "text": "苹果公司也在第一时间发布官方声明"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0275.wav", "duration": 5.5810625, "text": "目前这项服务已经达到了一个里程碑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0186.wav", "duration": 5.484, "text": "而申请办理组合贷款的手续则更为复杂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0218.wav", "duration": 3.2370625, "text": "涨幅远超央企整体水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0452.wav", "duration": 5.8730625, "text": "温州女婴打疫苗后口吐白沫抽搐昏迷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0150.wav", "duration": 5.451, "text": "许多企业都把取得顾客个人资料当作资本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0153.wav", "duration": 3.966, "text": "在大数据上的技术优势无可匹敌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0454.wav", "duration": 4.5851875, "text": "垫底的是印度城市孟买"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0491.wav", "duration": 4.561, "text": "涉案的其中两名嫌疑人陈某女"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0449.wav", "duration": 4.7788125, "text": "中科院紫金山天文台公布了一零月天象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0197.wav", "duration": 7.88, "text": "城投债劵对公司城市基础设施和市政的建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0311.wav", "duration": 7.837875, "text": "紫光股份千九十三八在公布拓展云计算市场后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0301.wav", "duration": 6.7889375, "text": "因此用户看到测量记录的记录要比之前少一些"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0395.wav", "duration": 5.098125, "text": "其实比赛过程中我也没有多想"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0255.wav", "duration": 5.343, "text": "不能波及和影响其他无关国家甚至本国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0211.wav", "duration": 4.843, "text": "这是我国所处的发展阶段决定的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0355.wav", "duration": 5.259, "text": "中韩之战中国队首发再次变阵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0150.wav", "duration": 6.6760625, "text": "在某一方面找到自己的企业竞争力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0397.wav", "duration": 4.6809375, "text": "比成这样我其实已经很开心了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0459.wav", "duration": 3.0500625, "text": "所内民警宿舍楼突发大火"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0387.wav", "duration": 7.3981875, "text": "因为服用禁药被停赛的选手在禁赛期满起的三年内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0305.wav", "duration": 7.3349375, "text": "这是浪潮借助政策东风来做的营销手段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0192.wav", "duration": 5.4250625, "text": "对于提高重大节假日公路通行能力和服务水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0340.wav", "duration": 5.6130625, "text": "跳高玛丽劳伦斯荣格菲利斯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0300.wav", "duration": 3.209, "text": "甚至是负增长而其中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0195.wav", "duration": 3.3349375, "text": "按照扶优扶大扶强的原则"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0268.wav", "duration": 3.834, "text": "面对以网络和数字技术为标志的信息技术发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0319.wav", "duration": 8.527125, "text": "而电话手表通话时离头部还有一百零一百一十五厘米的距离"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0380.wav", "duration": 8.0, "text": "第二场对阵日本也拿下全队第二高的十二分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0483.wav", "duration": 6.802, "text": "温州昆明出现注胶虾产地均指向广东湛江"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0337.wav", "duration": 4.552, "text": "钣金冲压已实现无人运行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0186.wav", "duration": 5.6880625, "text": "楼市政策也深刻影响着房地产行业的走向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0371.wav", "duration": 5.1270625, "text": "在接受中央电视台记者采访时朱婷表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0491.wav", "duration": 8.618875, "text": "港媒中秋赏月航班受热捧部分靠窗座位售罄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0363.wav", "duration": 6.021, "text": "让北京具备了承办冬奥会这种顶级赛事的经验和能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0188.wav", "duration": 6.13, "text": "人民银行多次提高存款准备金率和存贷款基准利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0263.wav", "duration": 5.0910625, "text": "试问又有哪位有魔法能挽回巨额亏损呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0195.wav", "duration": 5.246, "text": "粮食播种面积五亿亩棉花总产量七万吨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0270.wav", "duration": 3.3099375, "text": "而当预订时间接近时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0426.wav", "duration": 2.599125, "text": "但称自己单身"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0359.wav", "duration": 6.4550625, "text": "误服曲美他嗪导致兴奋剂检测呈阳性遭禁赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0282.wav", "duration": 5.1070625, "text": "失望中夹杂着嘲讽的情绪霸占了各模块的头条"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0388.wav", "duration": 4.8891875, "text": "托比亚斯斯切尔巴尔斯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0207.wav", "duration": 3.846, "text": "加强合作社辅导员队伍建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0448.wav", "duration": 4.099125, "text": "目前记者正赶往武胜县人民医院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0221.wav", "duration": 5.3509375, "text": "统筹协调推动重大工程的实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0156.wav", "duration": 3.8600625, "text": "以情怀代替体验是非常错误的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0404.wav", "duration": 3.743875, "text": "很可能被雪藏下去"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0471.wav", "duration": 2.709, "text": "就可以在网络环境下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0206.wav", "duration": 5.886, "text": "一旱涝保收高标准农田建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0298.wav", "duration": 3.6430625, "text": "其相应的对手不是全球鹰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0186.wav", "duration": 5.206, "text": "将保障房地块和商品房地块捆绑出让"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0173.wav", "duration": 3.7669375, "text": "而未来借助更多的互联网技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0315.wav", "duration": 6.376, "text": "回购期限为自回购股份方案之日起至今年底"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0210.wav", "duration": 3.117, "text": "这是一个比较复杂的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0468.wav", "duration": 5.1901875, "text": "金报讯记者蓝莹九月一一日上午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0298.wav", "duration": 3.0339375, "text": "那么苹果能突破一万亿大关吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0370.wav", "duration": 3.0700625, "text": "不少粉丝都表达了谴责"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0361.wav", "duration": 5.479, "text": "帮助仰泳运动员改善自己的出发技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0306.wav", "duration": 3.475, "text": "现在汽车市场也在下滑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0134.wav", "duration": 5.001, "text": "随着广州住房公积金贷款政策的调整实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0137.wav", "duration": 4.8789375, "text": "期待岁末能有更多利好出现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0366.wav", "duration": 5.7739375, "text": "始终对那块冰面恋恋不舍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0257.wav", "duration": 4.589, "text": "这估计很难让掉进钱眼儿的四大银行接受"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0345.wav", "duration": 3.728, "text": "二零二二年冬奥会在北京举行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0493.wav", "duration": 6.5600625, "text": "该歌曲二零零字的歌词用典竟达三六处之多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0210.wav", "duration": 7.3139375, "text": "鼓励和促进工业与城市资源要素向农业农村配置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0126.wav", "duration": 5.3080625, "text": "将受益人定为直系血亲后代非配偶继承人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0277.wav", "duration": 4.9139375, "text": "降至二十六点零六万亿韩元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0483.wav", "duration": 4.28, "text": "参考消息网七月二二日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0426.wav", "duration": 3.9819375, "text": "这种天气很适合搞池边派对"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0379.wav", "duration": 4.2470625, "text": "中国女排表示承受了巨大的压力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0233.wav", "duration": 6.227875, "text": "资本技术等现代化生产要素集约化程度高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0479.wav", "duration": 3.355, "text": "印象里他性格是比较开朗的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0346.wav", "duration": 6.105, "text": "最终掠队拿下了比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0196.wav", "duration": 5.3360625, "text": "加快农村金融组织产品和服务创新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0143.wav", "duration": 4.096, "text": "兰州市中心城区的一些楼盘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0197.wav", "duration": 2.9859375, "text": "肉类总产量五万吨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0210.wav", "duration": 4.9350625, "text": "新增千亿斤粮食生产能力建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0308.wav", "duration": 5.192875, "text": "辐射吸收率在国家的安全标准范围之内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0166.wav", "duration": 2.822, "text": "在海南成立了分公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0395.wav", "duration": 6.505875, "text": "二零一八年冬奥会的主办地韩国平昌是一个绝好的例子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0205.wav", "duration": 4.8310625, "text": "应当经国务院国资委核准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0485.wav", "duration": 3.1269375, "text": "范冰冰承包了娱乐头条"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0370.wav", "duration": 3.302, "text": "悬挂于场馆醒目位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0132.wav", "duration": 3.851, "text": "成为房地产最信任的营销公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0424.wav", "duration": 2.756125, "text": "因为很久了很想念他"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0297.wav", "duration": 2.734, "text": "已经有股票经纪公司预测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0351.wav", "duration": 3.491, "text": "其于六个场馆都需要新建"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0235.wav", "duration": 3.772, "text": "保障公交路权优先"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0429.wav", "duration": 4.7360625, "text": "搜狐娱乐讯男方和小三还藕断丝连"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0359.wav", "duration": 4.5559375, "text": "之后就没有举办过的大型体育赛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0294.wav", "duration": 6.76, "text": "解决小小芯片上的连线和物理问题需要大量昂贵设备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0346.wav", "duration": 3.967, "text": "一二年总决赛拿到金牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0172.wav", "duration": 5.15, "text": "百分之五的网友认为房价将普遍上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0358.wav", "duration": 4.9250625, "text": "今天赛事举行了赛前新闻发布会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0464.wav", "duration": 5.241, "text": "新京报快讯记者杨锋凌晨今日下午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0154.wav", "duration": 4.057, "text": "放宽公积金贷款二套房认定标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0219.wav", "duration": 4.3460625, "text": "一方面很多央企已制定了海外战略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0181.wav", "duration": 2.89, "text": "本世纪经济报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0357.wav", "duration": 3.9, "text": "在赛后发布会上颜妮对记者说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0154.wav", "duration": 3.745, "text": "降幅收窄三个版百分点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0395.wav", "duration": 3.6389375, "text": "共同享受奔跑带来的乐趣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0405.wav", "duration": 4.2158125, "text": "前后打磨了两年时间才得以完成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0360.wav", "duration": 2.9860625, "text": "据外媒最新的爆料显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0282.wav", "duration": 4.849125, "text": "作为全球最大的职业社交网站"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0276.wav", "duration": 4.272, "text": "并注意下载过程中的任何警告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0410.wav", "duration": 3.1340625, "text": "可见两人友谊非同一般"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0158.wav", "duration": 3.899, "text": "分析用户的消费行为和生活方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0303.wav", "duration": 7.052, "text": "很多家长都考虑给孩子配置具有定位功能的智能手机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0494.wav", "duration": 4.056875, "text": "石柱村泥石流塌方现场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0128.wav", "duration": 2.987, "text": "相关公司股票走势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0207.wav", "duration": 6.2210625, "text": "研究部署在城市优先发展公共交通"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0475.wav", "duration": 3.239, "text": "盲目捐款没有益处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0401.wav", "duration": 4.8920625, "text": "一百米莱贝卡哈塞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0469.wav", "duration": 3.249, "text": "说起自己的伴侣大侠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0394.wav", "duration": 3.079125, "text": "他们的禁赛期即将开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0234.wav", "duration": 6.319, "text": "使地方政府的债务融资规模控制在安全范围内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0187.wav", "duration": 5.139, "text": "为环境保护提供更加完备有效的法制保障"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0490.wav", "duration": 6.7680625, "text": "广大领导干部要以引以为戒守住底线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0211.wav", "duration": 6.1070625, "text": "多数城市公共交通出行比例偏低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0227.wav", "duration": 6.77, "text": "要尽快建立我国的地方政府债务管理体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0450.wav", "duration": 3.733875, "text": "日前本报记者前往实地调查了解"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0386.wav", "duration": 5.688, "text": "朴泰桓的禁期禁赛期将在明年三月期满"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0177.wav", "duration": 7.5370625, "text": "对拥有一套住房并已结清相应购房贷款的居民家庭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0270.wav", "duration": 5.8659375, "text": "病毒武器被认为是目前最具有代表性的网络武器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0469.wav", "duration": 4.683125, "text": "张绵跃当选村委会主任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0143.wav", "duration": 8.122, "text": "公积金额贷款额度升至一百万可以节省很多少利息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0319.wav", "duration": 4.509, "text": "总投资预计一百二十五亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0164.wav", "duration": 5.583, "text": "进一步发挥市场在资源配置中的决定性作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0279.wav", "duration": 3.8209375, "text": "中国产品不可能照搬到美国市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0133.wav", "duration": 5.909, "text": "主要是土地出让收入少征三千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0126.wav", "duration": 3.935, "text": "重点城市公积金贷额款度也有限制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0436.wav", "duration": 5.105, "text": "登上歌王宝座的概率是不是会要大很多倍呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0435.wav", "duration": 4.6079375, "text": "陈传钧从东莞市第二看守所出来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0211.wav", "duration": 4.4730625, "text": "深入开展粮食稳定增产行动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0236.wav", "duration": 7.022, "text": "有关部门组织核安全地震海洋等方面专家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0444.wav", "duration": 5.6650625, "text": "杀人犯受民警感召行刑前捐器官谢罪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0153.wav", "duration": 4.37, "text": "允许机构和个人在中国购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0234.wav", "duration": 9.577, "text": "吸引和鼓励社会资金参与公共交通基础设施建设和运营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0451.wav", "duration": 5.2170625, "text": "顾欣资料图片昨早九号一零时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0186.wav", "duration": 4.1530625, "text": "而随着各地公积金政策的调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0478.wav", "duration": 3.8518125, "text": "香港海关严查水货客"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0259.wav", "duration": 3.2680625, "text": "与世界先进水平相比还有明显差距"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0232.wav", "duration": 6.501, "text": "在保持农村土地承包关系稳定并长久不变的前提下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0302.wav", "duration": 5.4040625, "text": "已经占有了全球智能手表市场的百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0366.wav", "duration": 5.1020625, "text": "这是它第一次在游泳世界杯上亮相"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0371.wav", "duration": 6.498, "text": "庞清和佟健终于可以放心地考虑退役的事情了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0241.wav", "duration": 9.383875, "text": "为各地的基础建设提供有力的保障的融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0168.wav", "duration": 4.9489375, "text": "后续还款用住房公积金支付"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0357.wav", "duration": 4.491, "text": "允许布鲁诺马塞洛特代表德国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0338.wav", "duration": 4.4360625, "text": "而在昨天对阵古巴队的比赛中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0467.wav", "duration": 3.4411875, "text": "事情的真相完全不是这样的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0353.wav", "duration": 3.688, "text": "直接将威瑟里诺夫击倒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0466.wav", "duration": 7.7531875, "text": "温州市场现胶注虾业内不仅增重卖相更好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0328.wav", "duration": 5.4980625, "text": "我们内部做的盈利测算数据暂时无法公告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0337.wav", "duration": 3.217, "text": "解决信息安全的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0290.wav", "duration": 5.8720625, "text": "作为科技股领头羊的苹果股份当天下挫百分之二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0464.wav", "duration": 5.5690625, "text": "浙江温州乐清七五岁的企业家虞一杰退休之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0313.wav", "duration": 5.8149375, "text": "其中近一半的漏洞都可能造成网站用户的信息泄露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0158.wav", "duration": 5.8790625, "text": "即便是北上广深等供应偏紧的一线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0326.wav", "duration": 3.355, "text": "在手机平板电脑之外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0356.wav", "duration": 6.0839375, "text": "佟健已经完成了第一个学模块的学习"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0194.wav", "duration": 3.495, "text": "粮食综合生产能力五亿吨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0377.wav", "duration": 6.2519375, "text": "并制作了精美的秩序册发给媒体及参赛队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0490.wav", "duration": 3.312, "text": "中国再现医生涉嫌拐卖婴儿的案例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0448.wav", "duration": 3.5349375, "text": "此事昨日经网络曝光后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0355.wav", "duration": 4.0229375, "text": "真可谓是简约而不简单啊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0262.wav", "duration": 3.947, "text": "刚开始微软因谨慎起见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0250.wav", "duration": 3.958, "text": "现代农业建设取得明显进展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0210.wav", "duration": 5.8830625, "text": "我委核准发行的企业债券累计为七千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0314.wav", "duration": 5.094, "text": "不知不觉地安装上公司开发的插件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0372.wav", "duration": 4.4140625, "text": "不过两位当事人双双否认性侵的说法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0262.wav", "duration": 4.941875, "text": "可以实现在敌国网络中的长期潜伏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0290.wav", "duration": 3.641125, "text": "更是一种文化和习惯的推广者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0357.wav", "duration": 4.771, "text": "孙杨的心脏不适早就不是秘密"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0148.wav", "duration": 5.364, "text": "广州调整住房公积金个人住房贷款政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0406.wav", "duration": 3.0659375, "text": "而不得不离开这个项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0410.wav", "duration": 5.046125, "text": "原来陈善之最近已离开了百仕活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0474.wav", "duration": 3.8830625, "text": "同踹死你的街道办主任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0296.wav", "duration": 5.394875, "text": "美国航空环境公司停止生产大鸦无人机后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0152.wav", "duration": 7.718, "text": "外资在华房地产投资购房限制被松绑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0146.wav", "duration": 3.829, "text": "本轮住房公积金房贷政策调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0232.wav", "duration": 5.3010625, "text": "必须符合一些基本的条件企业必须连续三年盈利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0434.wav", "duration": 3.6699375, "text": "在其发给记者的新闻稿中说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0323.wav", "duration": 7.701875, "text": "格力电器一季报营收为二百四十五亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0141.wav", "duration": 4.88, "text": "尽管有央行降息等各方利好刺激"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0229.wav", "duration": 3.8139375, "text": "加快实施生禽良种工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0212.wav", "duration": 6.907, "text": "通过组织动员和政策引导等多种途径"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0315.wav", "duration": 6.5710625, "text": "媒体采访的电话打到各空调企业的市场负责人那里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0213.wav", "duration": 7.251, "text": "国际农产品市场投机炒作及传导影响加深"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0294.wav", "duration": 5.1159375, "text": "苹果计划于明年初开始销售其智能手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0174.wav", "duration": 6.703, "text": "这一平均楼面价较年前的九千元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0245.wav", "duration": 4.9859375, "text": "避免在最后一年累积过大的还本压力和风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0235.wav", "duration": 4.151, "text": "以加强产销衔接为重点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0437.wav", "duration": 3.3920625, "text": "导游放言此树是我栽"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0458.wav", "duration": 6.3569375, "text": "温州两女孩溺水救护车因车多路堵错过救援时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0140.wav", "duration": 4.702, "text": "有一个突破土地或城市规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0314.wav", "duration": 4.1949375, "text": "目前公司锂电池订单比较充足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0203.wav", "duration": 5.142, "text": "形成合力推进现代农业发展的新局面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0334.wav", "duration": 3.8969375, "text": "对于如此火爆的市市场需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0441.wav", "duration": 5.4201875, "text": "同时李也俘获了无数中国大妈的芳心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0187.wav", "duration": 6.7010625, "text": "着力解决一批影响现代农业发展全局的重大科技问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0157.wav", "duration": 4.458, "text": "深圳环比上上涨百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0386.wav", "duration": 5.067125, "text": "如今在家门口就可以实现这个愿望了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0210.wav", "duration": 5.869, "text": "政府通过债务融资从事基础设施建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0444.wav", "duration": 4.4050625, "text": "大客车的车头和车身损毁严重"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0478.wav", "duration": 3.660875, "text": "记者从消防部门处了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0464.wav", "duration": 8.0751875, "text": "图记者陈斌潇湘晨报长沙讯一零月一一日下午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0253.wav", "duration": 4.0, "text": "可控是病毒武器最基本的要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0200.wav", "duration": 3.409, "text": "具体执行时间由省政府定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0321.wav", "duration": 4.6999375, "text": "用户隐私遭泄露的问题日益突出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0448.wav", "duration": 6.0488125, "text": "钱某贪污一二馀万元拆迁款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0241.wav", "duration": 4.199, "text": "政府财力增长也相当较快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0294.wav", "duration": 6.0600625, "text": "苹果股价在说不准的时间内有望上升三成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0418.wav", "duration": 4.548125, "text": "许茹芸重回舞台不做苦情女娱乐频道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0273.wav", "duration": 7.783, "text": "他们通常会单独办一张银行卡来绑定移动支付系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0432.wav", "duration": 7.8059375, "text": "温州水库沉车案现男女腐尸女方事发前行为古怪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0347.wav", "duration": 8.462875, "text": "在队长惠若琪因为身体原因无缘世界杯的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0123.wav", "duration": 3.555, "text": "这些状况每日均上演发生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0294.wav", "duration": 5.642, "text": "把它升级成为一款综合性智能终端之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0296.wav", "duration": 3.4239375, "text": "苹果已然可以单点突破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0403.wav", "duration": 4.2309375, "text": "大家赢球比自己获得最佳还要高兴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0230.wav", "duration": 4.531, "text": "防止出现系统性的偿债风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0327.wav", "duration": 2.645, "text": "开扩了一个新的市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0147.wav", "duration": 8.2589375, "text": "店均电话咨询量比上一个周末增加十一百分之左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0387.wav", "duration": 6.052, "text": "而队医怀疑这或许与比赛地水污染有关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0385.wav", "duration": 5.225125, "text": "面对身高臂展明显占优的对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0381.wav", "duration": 5.1230625, "text": "许多为高桥痴迷多年的女粉丝肯定深受打击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0121.wav", "duration": 6.187, "text": "双降会令市场看贬人民币的情绪持续"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0142.wav", "duration": 4.0059375, "text": "安全问题立即会成为你的内伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0419.wav", "duration": 6.2729375, "text": "华西都市报讯闪婚欧巴一年后二零一四年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0407.wav", "duration": 4.650875, "text": "曾在二零一零年获得空前成功"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0391.wav", "duration": 5.8420625, "text": "在奥运会赛艇和铁人三项公开水域等比赛地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0220.wav", "duration": 6.364, "text": "由于目前城投债劵的发行需要符合企业债劵发行的条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0168.wav", "duration": 2.734, "text": "北京七月楼市的成交情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0189.wav", "duration": 2.3869375, "text": "稳步发展区域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0328.wav", "duration": 5.829125, "text": "现在三百六十腾讯等大公司都涉足了这一领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0172.wav", "duration": 5.9029375, "text": "需要按北京当地的要求缴纳二手房交易费用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0448.wav", "duration": 3.9250625, "text": "以便提高药品竞争力等等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0242.wav", "duration": 4.9650625, "text": "规范公共交通重大决策程序"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0318.wav", "duration": 4.469, "text": "浪潮信息的研发支出约四亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0342.wav", "duration": 7.224875, "text": "因此我请求世界反兴奋剂机构回顾前后所有的数据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0250.wav", "duration": 7.667, "text": "对大学生涉农创业按规定给予相关政策扶持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0295.wav", "duration": 4.9600625, "text": "心率测量记录没有之前那么频繁了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0325.wav", "duration": 2.8979375, "text": "电话手表应该如何选购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0394.wav", "duration": 6.219, "text": "在大赛中投出这样好的成绩我自己都没有想到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0476.wav", "duration": 6.177, "text": "四年前的一幕仍没从夏英俊的记忆中抹去"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0188.wav", "duration": 6.9390625, "text": "为现代农业建设取得明显进展提供有力保障"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0487.wav", "duration": 6.886, "text": "湖北一传销头目归国投案骗取群众资金数亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0344.wav", "duration": 3.9860625, "text": "已经确定本赛季不会参加任何的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0206.wav", "duration": 6.381, "text": "国务院总理温家宝主持召开国务院常务会议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0397.wav", "duration": 3.858875, "text": "朱婷全场夺得二十九分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0309.wav", "duration": 6.2939375, "text": "公司主要从事计算机手机的软件开发业务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0178.wav", "duration": 3.1949375, "text": "其中地上一万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0467.wav", "duration": 3.2951875, "text": "出门前我拿了两套衣服"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0190.wav", "duration": 5.486125, "text": "加大涉农贷款投放力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0356.wav", "duration": 3.103, "text": "我感到非常骄傲和自豪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0299.wav", "duration": 3.6450625, "text": "苹果公司上次发布全新产品是在五年以前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0196.wav", "duration": 3.489, "text": "着实让不少网友有些着急"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0426.wav", "duration": 4.1860625, "text": "称陈妍希目前还在剧组拍戏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0151.wav", "duration": 3.805, "text": "放松限外是必然趋势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0144.wav", "duration": 4.356, "text": "住房公积金贷款因其利率较低的优势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0454.wav", "duration": 6.0910625, "text": "捐给当地慈善部门后却遭闲置三年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0230.wav", "duration": 2.9349375, "text": "科学保护和合理利用水资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0375.wav", "duration": 3.3471875, "text": "为了备战亚运会选拔赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0268.wav", "duration": 6.1650625, "text": "拥有内部存储空间与完整的应用平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0256.wav", "duration": 5.249, "text": "掌趣科技三零零三一五一度超过二百倍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0399.wav", "duration": 5.2040625, "text": "也是最终打动国家奥运委会评审团的法宝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0154.wav", "duration": 3.379, "text": "公积金贷款新政出台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0459.wav", "duration": 5.1789375, "text": "温州两男子为争女人驾奔驰宝马街头四次对撞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0307.wav", "duration": 6.5759375, "text": "昔日巨头格力美的海尔也将沉浮于其中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0351.wav", "duration": 7.5920625, "text": "中国最帅的竞走冠军陈定将亮相苏州吴中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0419.wav", "duration": 3.6220625, "text": "猛嗑薄荷喉糖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0324.wav", "duration": 4.837875, "text": "关于儿童电话手表应该如何选购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0472.wav", "duration": 3.3940625, "text": "退休并不等于生命的终结"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0385.wav", "duration": 5.272, "text": "此次韩国男团派出了一老带二新的阵容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0406.wav", "duration": 4.182875, "text": "最终又确定为科林哈迪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0188.wav", "duration": 9.0, "text": "极可能对债劵持有人利益构成不利影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0459.wav", "duration": 7.807125, "text": "温州天价馒头续店方称顾客要狭索赔三条中华烟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0220.wav", "duration": 6.642, "text": "研究落实各项强农惠农富农政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0246.wav", "duration": 5.5, "text": "海啸问题评估和应付基础比较薄弱等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0429.wav", "duration": 4.837875, "text": "一直邀请陈善之担任经理人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0128.wav", "duration": 2.1360625, "text": "自成立以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0489.wav", "duration": 4.6010625, "text": "近千人在隧道里上演生死时速"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0137.wav", "duration": 5.735, "text": "住宅成为全国房地产销售金额唯一增长的板块"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0263.wav", "duration": 5.7209375, "text": "使其市值分秒间蒸发近四百亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0269.wav", "duration": 7.9400625, "text": "有哪家支付机构愿意心无旁续地放弃这些金子呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0241.wav", "duration": 7.025875, "text": "积极推进养殖业园艺业农产品初加工机械化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0398.wav", "duration": 6.1950625, "text": "对此莎宾娜已经做好了吃苦的心理准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0170.wav", "duration": 5.234, "text": "但下半年的销售可能会回升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0365.wav", "duration": 4.306125, "text": "得到了仰泳选手的广泛好评"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0450.wav", "duration": 4.0029375, "text": "并于二零一五年一月将其抓获"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0424.wav", "duration": 3.5810625, "text": "陈妍希晒出与容祖儿合照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0185.wav", "duration": 3.777, "text": "年底将出现翘尾行情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0282.wav", "duration": 5.9339375, "text": "满足数据中心和物联网细分市场的用户需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0372.wav", "duration": 7.0290625, "text": "到今年十二月为止将在东京的法政大学进行训练"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0253.wav", "duration": 4.511, "text": "据新华社电有病当然要吃药"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0193.wav", "duration": 4.134, "text": "新增收入全部用于农业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0141.wav", "duration": 7.103, "text": "中原地产市场研究部统计数据显示截至目前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0152.wav", "duration": 6.1180625, "text": "由于公积金贷款利率相当于市场贷款利率的七折"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0431.wav", "duration": 4.6189375, "text": "当事网友疑遭遇克隆车"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0299.wav", "duration": 3.9760625, "text": "较最初的预期减少了一半左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0377.wav", "duration": 4.47, "text": "也是孙杨整个比赛期间疲劳所致"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0412.wav", "duration": 4.125, "text": "心情低落到崩溃大哭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0218.wav", "duration": 4.735, "text": "指导思想基本原则与发展目标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0313.wav", "duration": 4.1069375, "text": "汉能直接销售人员大幅度减少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0190.wav", "duration": 5.7629375, "text": "我们立即与云投集团进行了沟通"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0379.wav", "duration": 3.188, "text": "高桥大辅应该是他的新欢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0361.wav", "duration": 5.1550625, "text": "二零一四年的冰壶世锦赛也在北京举行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0354.wav", "duration": 3.718, "text": "是很难成为真正的王者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0160.wav", "duration": 5.386, "text": "是房地产当前发局格局下的一个必然"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0208.wav", "duration": 5.855, "text": "这决定了我国城市化动力十分强劲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0279.wav", "duration": 4.4489375, "text": "标普五百指数市值冠军宝座"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0181.wav", "duration": 6.0, "text": "在经济增速放缓阶段运用货币政策工具时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0194.wav", "duration": 6.061, "text": "具体工作将由各省区市政府负责统一组织实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0370.wav", "duration": 2.8110625, "text": "搜狐体育郭健文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0226.wav", "duration": 5.5, "text": "按照市场化原则实施土地综合开发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0205.wav", "duration": 3.8680625, "text": "广泛开展示范社建设行动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0249.wav", "duration": 4.3950625, "text": "我们如何考虑防止这类事件再次发生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0475.wav", "duration": 4.0859375, "text": "参考消息网八月一二日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0137.wav", "duration": 3.611, "text": "面包价格会跟风上涨吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0197.wav", "duration": 5.0600625, "text": "要吸收民间资本参与国有企业改制重组"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0141.wav", "duration": 5.851, "text": "再加上广州公积金贷款新政终于落地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0154.wav", "duration": 8.5169375, "text": "六部委调整房地产市场外资准入和管理政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0479.wav", "duration": 5.201875, "text": "与韩国西海相连的中国渤海湾由于垃圾堆积"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0331.wav", "duration": 5.0379375, "text": "昔日巨头格力美的海尔也将沉浮于其中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0167.wav", "duration": 4.4050625, "text": "相反相关环节上审批更加严格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0377.wav", "duration": 6.4709375, "text": "取得这一突破的领军人就包括轮椅英雄叶乔波"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0371.wav", "duration": 3.953875, "text": "不得不暂停比赛进行处理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0380.wav", "duration": 5.876, "text": "同时拿到了明年里约奥运会的入场券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0265.wav", "duration": 3.1520625, "text": "不同意的地方多于同意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0304.wav", "duration": 6.626, "text": "归属于上市公司股东的净利润二十五十二万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0413.wav", "duration": 3.9240625, "text": "黄榕坦言可能他做了太多运动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0412.wav", "duration": 4.728, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0145.wav", "duration": 3.701, "text": "而额度最高一百万时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0429.wav", "duration": 5.5920625, "text": "她透露现在父母哥哥谢霆锋都各忙各的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0389.wav", "duration": 3.5, "text": "在韩国男队中排名第四"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0369.wav", "duration": 5.8198125, "text": "这让他们的退役迟迟没有提上日程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0278.wav", "duration": 3.5, "text": "苹果靠什么颠复移动支付市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0156.wav", "duration": 2.698, "text": "许多数字新产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0341.wav", "duration": 3.774125, "text": "公开自己的同性恋者身份"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0379.wav", "duration": 3.1110625, "text": "朱婷共计拿下二十四分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0182.wav", "duration": 3.4309375, "text": "部分客户甚至等两个多月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0175.wav", "duration": 4.983, "text": "市场对金九银十的预期也开始谨慎起来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0193.wav", "duration": 3.3160625, "text": "发挥示范区引领作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0340.wav", "duration": 4.522, "text": "惠若琪将在微创手术后回到南京调养"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0467.wav", "duration": 3.827125, "text": "黄色渣土车一头撞进了路边的工房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0166.wav", "duration": 3.534, "text": "还有多家机构分析认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0148.wav", "duration": 4.941, "text": "为安居工程建设提供了资金保障"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0252.wav", "duration": 4.3730625, "text": "抓紧制定和修订相关法律法规"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0296.wav", "duration": 3.723875, "text": "按说这只是一个客观表述"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0245.wav", "duration": 5.1939375, "text": "但在鼓励企业走出去方面释出多个信号"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0416.wav", "duration": 3.124, "text": "不抓紧会被撞到地上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0250.wav", "duration": 5.491, "text": "新老并重防结结合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0435.wav", "duration": 3.963125, "text": "江苏快递实名制登记动真格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0423.wav", "duration": 5.411125, "text": "被问是否感觉到谢霆锋与王菲恋爱的甜蜜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0410.wav", "duration": 5.5, "text": "新京报报道思维发散表情与肢体语言丰富"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0459.wav", "duration": 4.5690625, "text": "留下的却是被随手丢弃的垃圾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0304.wav", "duration": 7.1070625, "text": "成飞机成业绩增长主要是由于锂电需求增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0217.wav", "duration": 5.219, "text": "在政府投融资体制改革过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0225.wav", "duration": 4.4909375, "text": "加强农业有害生物监测预警和防控能力建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0424.wav", "duration": 3.006125, "text": "恋情发展备受关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0275.wav", "duration": 4.2790625, "text": "并未能给这些公司带来其他的效应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0245.wav", "duration": 4.2049375, "text": "依法开展公募性质的资产管理业务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0262.wav", "duration": 3.7470625, "text": "不应从用户身上榨取广告收入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0388.wav", "duration": 4.636, "text": "佟健报考了北大光华管理学院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0484.wav", "duration": 4.6520625, "text": "其中一道蘑菇炖鸡收费近九零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0479.wav", "duration": 7.4409375, "text": "中国正在逐步拥抱智能技术和数字至上创业精神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0285.wav", "duration": 3.9760625, "text": "打造适合当地市场的产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0163.wav", "duration": 4.693, "text": "未来还将继续深耕丰台区域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0431.wav", "duration": 9.004125, "text": "渔船凶案嫌疑借发动机声将同船同事依次杀害"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0193.wav", "duration": 3.714, "text": "现代农业发展主要指标类别"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0351.wav", "duration": 7.4299375, "text": "中国队将迎战冈山赛区的第二个对手肯尼亚队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0248.wav", "duration": 4.547, "text": "对实施召回的缺陷汽车产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0370.wav", "duration": 6.9711875, "text": "退役前高桥大辅曾与花滑女神浅田真央传出恋情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0481.wav", "duration": 7.718, "text": "以公务招待为名大肆公款吃喝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0440.wav", "duration": 5.4299375, "text": "并被店主及店员辱骂围殴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0301.wav", "duration": 5.6389375, "text": "他的预测有点毒基本上是在讨论谁会下台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0439.wav", "duration": 8.651875, "text": "温州大妈年逾半百冒充女儿成功骗婚多名小鲜肉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0331.wav", "duration": 7.1579375, "text": "除了威灵电器与美芝压缩机合并成为美的部品事业部之外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0211.wav", "duration": 4.656, "text": "要加强节日期间旅游市场价格监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0337.wav", "duration": 4.577125, "text": "对频频的骚扰电话显得无可奈何"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0214.wav", "duration": 4.2200625, "text": "从已发行的城投债券用途看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0216.wav", "duration": 4.112, "text": "省里会对此进行专门研究讨论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0165.wav", "duration": 8.281, "text": "对于提供给外籍人士的个人住房按揭贷款的外债需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0381.wav", "duration": 3.228, "text": "我觉得这冠军来之不易"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0201.wav", "duration": 4.69, "text": "提升产品研发精深加工技术水平和装备能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0339.wav", "duration": 6.4970625, "text": "但检测结果的异常并不能就证实运动员使用违禁药物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0374.wav", "duration": 3.2321875, "text": "从目前已经传出的视频来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0216.wav", "duration": 2.985125, "text": "强化农业法制保障"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0423.wav", "duration": 3.4870625, "text": "前天他在脸书晒出自拍照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0493.wav", "duration": 4.4199375, "text": "渔民缴纳罚款后在摁手印时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0218.wav", "duration": 3.2889375, "text": "落实海洋环境保护责任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0264.wav", "duration": 5.3050625, "text": "这样难免会出现某个客户的维修问题特别复杂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0388.wav", "duration": 2.824, "text": "队友彼此之间需要相互鼓励"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0272.wav", "duration": 5.261, "text": "大尺寸屏幕设备在亚洲很流行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0196.wav", "duration": 2.8929375, "text": "规划提出诸多想法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0127.wav", "duration": 4.0, "text": "二零零八年至二零一五年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0222.wav", "duration": 5.5189375, "text": "中国证券报面对市场对城投债券风险的担忧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0454.wav", "duration": 7.0290625, "text": "并称故宫博物院已就此事件向公安机关报案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0289.wav", "duration": 5.2039375, "text": "艾维表示尽管苹果智能手表拥有诸多功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0202.wav", "duration": 2.9149375, "text": "重点推进区域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0206.wav", "duration": 7.391, "text": "并尽快建立我国地方政府债务管理体系等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0387.wav", "duration": 5.5, "text": "也看到了在冰雪运动综合实力上的欠缺和不足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0214.wav", "duration": 6.1310625, "text": "农林牧渔业增长值年均增长率百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0393.wav", "duration": 2.793, "text": "是时候去努力工作了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0202.wav", "duration": 4.3840625, "text": "积极应对国际贸易摩擦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0221.wav", "duration": 4.213, "text": "仍然存在并具有发展空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0431.wav", "duration": 4.355, "text": "北京地接旅行社有限公司负责人称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0454.wav", "duration": 6.385, "text": "渣土车挂倒电动车致一死一伤肇事车主逃逸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0261.wav", "duration": 3.9340625, "text": "不仅树立了良好的品牌形象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0221.wav", "duration": 4.1800625, "text": "坚持走中国特色农业现代化道路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0410.wav", "duration": 4.6330625, "text": "陈冠希在微博晒出一段小视频"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0417.wav", "duration": 4.4809375, "text": "许茹芸特地发微博感谢婚姻带来的幸福"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0419.wav", "duration": 2.349125, "text": "帅出新高度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0298.wav", "duration": 3.9760625, "text": "中国游戏公司纷纷忙着退市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0178.wav", "duration": 3.7429375, "text": "一些库存量较大的三四线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0168.wav", "duration": 4.182, "text": "比月初增长了一百元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0196.wav", "duration": 5.259, "text": "有利于提升城投债券的资产配置价值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0365.wav", "duration": 6.5751875, "text": "他还在积极地为二零一八年韩国平昌冬奥会进行着准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0330.wav", "duration": 4.282, "text": "整体行业出货量应该不断突破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0418.wav", "duration": 3.891125, "text": "艺人谢婷婷出席活动时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0328.wav", "duration": 4.3269375, "text": "另一白电巨头青岛海尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0170.wav", "duration": 3.099, "text": "新媒体推广的业务扩张"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0285.wav", "duration": 2.49, "text": "如果说过去的这些年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0211.wav", "duration": 5.761, "text": "但在具体评估我国地方政府债务风险程度时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0424.wav", "duration": 2.8210625, "text": "据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0480.wav", "duration": 4.4289375, "text": "邳州几名村民先后下井救人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0325.wav", "duration": 4.370875, "text": "四年来机器人代替人工近半"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0336.wav", "duration": 3.1009375, "text": "比如阳光也是一种电磁辐射"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0398.wav", "duration": 7.729, "text": "三局比分是二五比一九二五比十和二五比一四"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0261.wav", "duration": 7.167, "text": "苹果表这么火爆微软也该出智能手表吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0356.wav", "duration": 6.76, "text": "徐建德统领的中国青年队八战全胜夺得冠军"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0129.wav", "duration": 5.162, "text": "取得土地出让收入十三万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0247.wav", "duration": 7.61, "text": "推广相应的生产技术和防灾减灾措施大力推进农业标准化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0355.wav", "duration": 2.9260625, "text": "服务广大跑步爱好者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0490.wav", "duration": 4.546125, "text": "阳逻一家公司以数十名员工的名义"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0202.wav", "duration": 4.594, "text": "第二批三网融合试点工作业已启动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0212.wav", "duration": 2.692, "text": "应该不会开免费车道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0367.wav", "duration": 3.222875, "text": "和澳洲鱼雷索普一样"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0362.wav", "duration": 4.3549375, "text": "记者从浙江省游泳协会了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0205.wav", "duration": 6.5, "text": "审议通过缺陷汽车产品召回管理条例草案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0349.wav", "duration": 5.4150625, "text": "朱婷再度扮演了场上头脑的角色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0293.wav", "duration": 4.8360625, "text": "自二零零七年乔布斯重新发明手机开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0170.wav", "duration": 3.0560625, "text": "相应的房价涨跌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0317.wav", "duration": 3.6960625, "text": "网络运营人员的安全素质有待提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0477.wav", "duration": 5.7319375, "text": "杀害女童凶手被抓指认现场上千民众喊打"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0152.wav", "duration": 9.333, "text": "但房价从七月至今上涨幅度仅为百分之二左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0253.wav", "duration": 3.3370625, "text": "市场占有率为百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0362.wav", "duration": 6.232875, "text": "与多米尼加的马丁内斯一起摘得最佳得分奖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0134.wav", "duration": 5.2069375, "text": "外资占国内地产投资比例有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0352.wav", "duration": 3.6440625, "text": "看起来在美国过得很开心的样子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0403.wav", "duration": 6.8249375, "text": "日本二零一五女排世界杯单循环赛战至第十轮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0339.wav", "duration": 5.969, "text": "而与经济实力相关的一些基础设施建设方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0384.wav", "duration": 4.242875, "text": "我们球员要做的就是立足于自己"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0204.wav", "duration": 5.735125, "text": "并尽快建立我国地方政府债务管理体系等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0224.wav", "duration": 6.713, "text": "使得城投公司能够发行真正意义上的长期市政债劵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0422.wav", "duration": 2.4880625, "text": "虽然没有注册结婚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0251.wav", "duration": 4.854, "text": "你们如何考虑防止这类事件再次发生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0215.wav", "duration": 3.959, "text": "努力形成多元化投入新格局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0363.wav", "duration": 7.243875, "text": "可以帮助他们在出发时增加自己距离水面的高度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0354.wav", "duration": 5.9699375, "text": "最终中国队以三比一力战韩国队全取三分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0222.wav", "duration": 8.5560625, "text": "稳步推进江淮等粳高稻生产适宜区糟改粳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0273.wav", "duration": 4.316875, "text": "美国国际贸易委员会称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0337.wav", "duration": 4.1579375, "text": "破坏和颠复是互联网时代的特征"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0493.wav", "duration": 4.502, "text": "杀中传女生嫌犯就想找个人发泄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0219.wav", "duration": 4.2310625, "text": "完善粮食仓储运输设备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0479.wav", "duration": 6.667, "text": "浙江温州鹿城区检察院通报九月六日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0181.wav", "duration": 6.446, "text": "在今年两会是否会开启新一轮楼市调控这个问题上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0163.wav", "duration": 6.875, "text": "去年已有不少城市对公积金政策进行放松调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0125.wav", "duration": 3.909, "text": "新京报讯记者张旭报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0290.wav", "duration": 4.181, "text": "如何重修与中国政府的良好关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0215.wav", "duration": 3.6900625, "text": "在依法自愿有偿和加强服务基础上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0213.wav", "duration": 3.26, "text": "保障房建设和棚户区改造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0238.wav", "duration": 3.8360625, "text": "启动实施农产品加工提升工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0183.wav", "duration": 3.4400625, "text": "基本住房需求得到满足后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0418.wav", "duration": 2.1699375, "text": "应该是月初吧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0343.wav", "duration": 2.636, "text": "北京时间九月十七日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0425.wav", "duration": 4.964875, "text": "更在日前爆出交往七个月准备闪婚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0308.wav", "duration": 5.400875, "text": "东风雪铁龙的客户数据存放在专业数据库中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0451.wav", "duration": 5.972875, "text": "渝蓉高速四川段资金断裂烂尾已修了六年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0121.wav", "duration": 4.2039375, "text": "甚至出现交易几乎停滞的情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0136.wav", "duration": 5.7560625, "text": "中国房地产学会副会长陈国强也认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0493.wav", "duration": 5.764625, "text": "这一斤玛卡其实价格只有一零零多元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0160.wav", "duration": 5.343, "text": "审计署审计长刘家义受国务院委托"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0423.wav", "duration": 2.432125, "text": "我便会到那里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0374.wav", "duration": 3.927, "text": "德国队此次以老带新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0192.wav", "duration": 4.368, "text": "维护受损各方合法权益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0436.wav", "duration": 6.6210625, "text": "渔船海上被撞翻仅一人逃生同伴求救却无能为力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0436.wav", "duration": 5.604, "text": "大兴区礼贤镇紫各庄村"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0322.wav", "duration": 8.858875, "text": "至于像整机柜这类深度定制化的细分市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0435.wav", "duration": 3.479, "text": "所谓撤资指控完全不成立"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0475.wav", "duration": 5.3361875, "text": "状元农贸市场内挂着支付宝的宣传牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0402.wav", "duration": 7.687, "text": "夺得了自己在昆仑拳坛上的第二场重要胜利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0358.wav", "duration": 4.0, "text": "中国队迅速调整阵容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0446.wav", "duration": 6.4260625, "text": "二人早前被香港警方以有违公德罪落案起诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0263.wav", "duration": 4.1020625, "text": "希望中国品牌在国际市场的知名度和影响力越来越大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0466.wav", "duration": 7.531, "text": "称他们曾在这里被人游说注册了一游戏平台的账户"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0365.wav", "duration": 5.100125, "text": "比赛在双方互不相让的对攻中落下了帷幕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0301.wav", "duration": 5.734, "text": "市场上还有诸多其他制造商也在尝试生产智能手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0483.wav", "duration": 5.0590625, "text": "凶手被抓捕归案钟欣摄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0452.wav", "duration": 4.917, "text": "和平花苑现已更名为龙和华府"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0460.wav", "duration": 6.2568125, "text": "在看守所干警及消防人员的扑救下火势很快被扑灭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0273.wav", "duration": 4.452, "text": "他们的产品在海外市场也极少被认可"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0477.wav", "duration": 10.635, "text": "渐冻男孩驾驶电动轮椅上班医生曾诊断活不过十八岁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0480.wav", "duration": 6.052, "text": "有人忧虑渤海湾的污染会直接影响到韩国西部海域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0338.wav", "duration": 5.041, "text": "折合人民币大概二千四八零亿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0195.wav", "duration": 3.614, "text": "形成了系统完整的规划体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0295.wav", "duration": 4.324, "text": "预计订单总额为三十亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0127.wav", "duration": 2.762, "text": "中新网房产频道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0365.wav", "duration": 3.136, "text": "但有起伏应该是正常的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0162.wav", "duration": 4.584, "text": "二初楼市迎来多项利好政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0469.wav", "duration": 4.9199375, "text": "随即被送到儿童医院进行救治"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0452.wav", "duration": 4.6289375, "text": "湖北吞人电梯三月份刚检测合格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0162.wav", "duration": 4.516, "text": "龙湖已经在丰台有土地储备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0178.wav", "duration": 5.566, "text": "在岸人民币兑美元收盘下跌百分之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0251.wav", "duration": 3.5739375, "text": "机场高速最大可能还是免费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0325.wav", "duration": 3.2270625, "text": "一定是为了降低制造成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0295.wav", "duration": 7.207, "text": "芯片行业的并购风体现了整个科技行业的一种趋势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0145.wav", "duration": 3.5669375, "text": "虽有助于使刚需购房者长期受益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0436.wav", "duration": 3.5600625, "text": "本报讯记者汪红日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0167.wav", "duration": 6.6840625, "text": "首先是重点城市楼市成交回落趋势明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0132.wav", "duration": 3.8000625, "text": "房价下跌压力将趋于缓解"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0239.wav", "duration": 3.981, "text": "正是有了这样一些严格的规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0155.wav", "duration": 3.586, "text": "力争配租三万户以上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0190.wav", "duration": 6.197, "text": "一是工业化城镇化的引领推动作用将更加明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0238.wav", "duration": 5.0, "text": "落实环境监管责任和安全保障措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0193.wav", "duration": 7.8840625, "text": "探索建立目标价格为核心的反周期补贴制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0337.wav", "duration": 5.9040625, "text": "浪潮将通过产品渠道服务价格的全方位发力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0418.wav", "duration": 5.5, "text": "当被问到对于被选为棉花糖女孩比较肉感的女生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0309.wav", "duration": 4.3100625, "text": "德国制造业最核心的技术就是嵌入式系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0203.wav", "duration": 4.797, "text": "支持行业协会办企业维护合法权益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0266.wav", "duration": 5.7679375, "text": "微软目前仍局限于健身手环领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0320.wav", "duration": 3.6320625, "text": "现实的残酷落到报表上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0267.wav", "duration": 3.6380625, "text": "成熟的资本市场相对公平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0473.wav", "duration": 2.947, "text": "双方均有不同程度受伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0372.wav", "duration": 5.3459375, "text": "但德维塔觉得归根到底还是小腿肌肉的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0161.wav", "duration": 4.598, "text": "龙湖地产有关人士对记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0195.wav", "duration": 4.834125, "text": "对债券投资人来说不是坏事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0392.wav", "duration": 3.724125, "text": "在参赛的二四支队伍中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0300.wav", "duration": 5.667, "text": "神雕的两个机身前后装有两对机翼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0461.wav", "duration": 5.7099375, "text": "渣土车撞进路边民房女子抱小孩幸运逃生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0481.wav", "duration": 4.219, "text": "结果被店员搓走了二零零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0181.wav", "duration": 5.4910625, "text": "所以审批加上放款的时间最快也要在五个半月左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0307.wav", "duration": 5.1490625, "text": "两个机构专用席位列于买一和卖二的位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0203.wav", "duration": 3.8520625, "text": "有效控制陆海污染源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0232.wav", "duration": 3.3160625, "text": "增长非常迅速"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0334.wav", "duration": 3.7168125, "text": "推动公司云服务战略的实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0313.wav", "duration": 7.193, "text": "旗下拥有浪潮信息浪潮软件浪潮国际三家上市公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0389.wav", "duration": 3.8000625, "text": "在九月初参加考试时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0365.wav", "duration": 3.234, "text": "刚开始无谓的心理压力很大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0413.wav", "duration": 8.546125, "text": "亮点正是与陈凯琳互相了解中郑嘉颖也有出席"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0479.wav", "duration": 6.0, "text": "依法对一名藏匿打火机过检的旅客进行了行政处罚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0263.wav", "duration": 3.087, "text": "重点强调了其安全性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0333.wav", "duration": 6.8869375, "text": "公司拟计划通过集中竞价交易方式回购公司股份"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0169.wav", "duration": 8.7950625, "text": "这来外资进入我国房地产市场最宽松的政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0286.wav", "duration": 4.0, "text": "但却损害了消费者的利益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0470.wav", "duration": 5.099125, "text": "参考消息网九月一九日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0351.wav", "duration": 6.620875, "text": "曾春蕾和刘晓彤向各参赛队赠送了签名排球"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0256.wav", "duration": 4.4830625, "text": "他表示他肯定会与苹果展开合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0246.wav", "duration": 3.942, "text": "比如南京机场高速一到节假日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0156.wav", "duration": 5.271, "text": "兰州房地产市场存在持续上涨可能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0396.wav", "duration": 4.462875, "text": "经历过北京站和上海站两次比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0416.wav", "duration": 2.615, "text": "眼见后辈爬头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0376.wav", "duration": 6.472875, "text": "他状告首尔某美容医院的官司将在十一月迎来终审"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0182.wav", "duration": 7.818, "text": "北京市管国管住房公积金中心先后发布通知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0391.wav", "duration": 3.6450625, "text": "虽然留下了巨大的遗憾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0144.wav", "duration": 6.862, "text": "七月份各线城市房价分化仍然明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0357.wav", "duration": 6.8730625, "text": "中新网成都九月十五日电付敬懿十五日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0388.wav", "duration": 3.968, "text": "在中国的这一传统优势项目上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0442.wav", "duration": 5.901875, "text": "温州一闲置地块填满垃圾臭味浓烈附近居民不敢开窗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0426.wav", "duration": 2.6889375, "text": "陈展鹏风骚到场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0428.wav", "duration": 5.5639375, "text": "中新网九月二十五日电据台湾东森新闻报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0332.wav", "duration": 5.4760625, "text": "随着国内新能源车产业的迅猛发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0293.wav", "duration": 4.0810625, "text": "智能手机仍然有增长和爆发的空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0293.wav", "duration": 3.4510625, "text": "一名印度高级官员透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0211.wav", "duration": 3.1959375, "text": "估计未来系统可能会改造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0225.wav", "duration": 3.4620625, "text": "城投债作为一个信用产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0355.wav", "duration": 3.8459375, "text": "我必须要变的更加全面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0288.wav", "duration": 4.819, "text": "给一桩近十年之久的诉讼一个定论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0151.wav", "duration": 6.375, "text": "上海深圳等主要城市也在公积金新政推动下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0226.wav", "duration": 8.944125, "text": "继续巩固棉油糖水果和蔬菜等产品供给保证地位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0141.wav", "duration": 4.0240625, "text": "今年资金规模接近七万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0130.wav", "duration": 2.873, "text": "支出十二万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0252.wav", "duration": 4.058, "text": "证监会新闻发言人邓给解释"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0398.wav", "duration": 3.546875, "text": "这会是一对绝对强大的对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0151.wav", "duration": 6.3689375, "text": "库存逆势攀升的根本原因在于供求错配"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0453.wav", "duration": 5.744125, "text": "杨柱军因涉嫌抢劫罪在市二中院受审"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0160.wav", "duration": 4.271, "text": "此前为限制外资炒房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0186.wav", "duration": 5.905, "text": "中原地产首席市场分析师张大伟告诉南都记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0348.wav", "duration": 3.5451875, "text": "本报记者宋翔王薇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0280.wav", "duration": 4.897, "text": "可有效降低信息泄漏的风险其次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0241.wav", "duration": 4.9150625, "text": "保障鲜活农产品市场供应和价格稳定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0169.wav", "duration": 5.308, "text": "伴随着各地中住房公积金新政的落地实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0483.wav", "duration": 4.0910625, "text": "他的义举感动了四里八乡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0411.wav", "duration": 6.900875, "text": "网友纷纷调侃道为了辟谣怀孕也是蛮拼的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0292.wav", "duration": 2.668, "text": "未必印在每个产品上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0183.wav", "duration": 8.1380625, "text": "如果申请公积金贷款或公积金贷款与商业贷款的组合贷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0150.wav", "duration": 2.867, "text": "据广州日报昨天报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0368.wav", "duration": 3.458, "text": "北京时间明天晚间十八点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0494.wav", "duration": 3.556125, "text": "让一些网友有如猜谜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0457.wav", "duration": 6.3039375, "text": "京华时报讯记者任珊记者从北京市教育考试院获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0471.wav", "duration": 4.3969375, "text": "连续撞了五辆小轿车最终才停了下来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0308.wav", "duration": 6.5, "text": "所以今年上半年公司在全国各地的员工人数大幅增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0439.wav", "duration": 6.522, "text": "参考消息网九月一七日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0481.wav", "duration": 6.1259375, "text": "凶手到岳池县石垭镇指认骗走孩子的现场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0300.wav", "duration": 6.306125, "text": "像苹果这样在产品上强调在本国设计的很少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0243.wav", "duration": 3.6579375, "text": "几个亿美元的项目不断出现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0396.wav", "duration": 6.1469375, "text": "雅桑克莱的组合拳将祖耶夫重重击倒然而"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0462.wav", "duration": 3.3200625, "text": "却要承载一个成年人的体重"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0486.wav", "duration": 6.157, "text": "这名一五岁的花季少年最终送医救治无效死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0319.wav", "duration": 8.231, "text": "中国机床龙头企业沈阳机床在北京举行战略发布会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0254.wav", "duration": 6.6389375, "text": "而且这也可以看作是苹果利用硬件优势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0140.wav", "duration": 4.344, "text": "在了解宋芳的资产情况与需求之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0383.wav", "duration": 5.0, "text": "朱婷以一百五十七分领先群芳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0161.wav", "duration": 3.9260625, "text": "我国出台了一系列限外令"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0358.wav", "duration": 3.385, "text": "在复盘与俄罗斯一战时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0480.wav", "duration": 5.458, "text": "虾里有明显的胶状物质图片来源网友微信日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0461.wav", "duration": 4.177, "text": "但赏月人群还是乱扔垃圾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0313.wav", "duration": 4.996, "text": "基本上是从二零一四年下半年才有明显的感觉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0459.wav", "duration": 3.232875, "text": "还把地面砸了个大坑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0162.wav", "duration": 6.0250625, "text": "以及在中国境内工作学习的境外个人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0462.wav", "duration": 3.130875, "text": "用来保存他们的藏品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0308.wav", "duration": 5.2249375, "text": "同比增长二百六十八点五百分之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0285.wav", "duration": 3.0019375, "text": "还有谁能预测得准呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0186.wav", "duration": 6.5700625, "text": "但年底出现翘尾行情并不代表楼市已经回暖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0495.wav", "duration": 4.032, "text": "让他们很担心会不会相互传染疾病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0173.wav", "duration": 5.8470625, "text": "近期人民币贬值叠加资本外流预期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0166.wav", "duration": 4.908, "text": "而对国内比它更优秀的产品却集体失声"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0160.wav", "duration": 5.758, "text": "链家地产市场研究部张旭表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0304.wav", "duration": 5.6490625, "text": "收盘价十三点六五元于七月八日发布公告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0445.wav", "duration": 5.160875, "text": "被拍下短片冠以野战之名在网上疯传"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0164.wav", "duration": 6.348, "text": "借全国大众创业万众创新活动周启动之势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0476.wav", "duration": 5.516875, "text": "坚持违法零容忍和高限处理的执法态度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0171.wav", "duration": 5.8349375, "text": "逐渐地撬开了上海这个外来公司很难生根的大都市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0329.wav", "duration": 3.8630625, "text": "以保证持续长久的黏性互动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0149.wav", "duration": 8.437, "text": "全国商品房待售面积比七月末增加了五百万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0403.wav", "duration": 4.733875, "text": "八百米克里斯蒂娜哈灵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0452.wav", "duration": 4.462125, "text": "李娜在一个商业活动中谈退役后的生活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0413.wav", "duration": 3.2680625, "text": "所以自己也很喜欢性感打扮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0424.wav", "duration": 2.691875, "text": "她去游泳解暑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0475.wav", "duration": 3.8881875, "text": "剩下了一二零零克食物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0134.wav", "duration": 6.149, "text": "房地产开发企业到位资金十万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0340.wav", "duration": 4.6169375, "text": "无论是城市交通建设还是机场运力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0164.wav", "duration": 3.666, "text": "土地市场热度可能有所下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0491.wav", "duration": 4.1591875, "text": "记者联系上胡先生才知虚惊一场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0366.wav", "duration": 4.2739375, "text": "实际上是同性恋者的传闻一直未停过"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0474.wav", "duration": 6.243875, "text": "唐山乐亭一船队在渤海与一山东渔船发生纠纷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0135.wav", "duration": 4.1499375, "text": "二初楼市迎来多项利好政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0225.wav", "duration": 3.0820625, "text": "渔政渔港建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0335.wav", "duration": 7.895, "text": "净利出现七点三百分之一的降幅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0446.wav", "duration": 6.219, "text": "一位游客在拍照中说人家几千年都没有掉下来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0426.wav", "duration": 6.012, "text": "不过要看他心情工作同家人相处同小朋友"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0486.wav", "duration": 3.9438125, "text": "温州鹿城警方发布通报称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0249.wav", "duration": 4.852875, "text": "基本原则是预防为主纵深防御"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0332.wav", "duration": 4.543, "text": "科技创新带动了电话手表行业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0155.wav", "duration": 4.79, "text": "呈现出量价齐涨的局面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0315.wav", "duration": 3.223, "text": "这是摆在行业面前最大的技术难题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0140.wav", "duration": 5.4879375, "text": "北京要筹集建设各类保障性住房一百万套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0215.wav", "duration": 8.792, "text": "城投债劵作为准市政债劵仍将是有效的融资工具"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0425.wav", "duration": 8.1318125, "text": "昨晚张保仔播映大结局故演员齐集饭局以及庆祝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0223.wav", "duration": 6.0810625, "text": "是如何更好地防范城投债券可能出现的风险的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0230.wav", "duration": 5.088, "text": "关键是要把投资规模和债务规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0350.wav", "duration": 4.012, "text": "凝聚力一直都是中国女排的传统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0228.wav", "duration": 6.079, "text": "对于如何建立规范的地方政府融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0187.wav", "duration": 6.881, "text": "并进而对城投债券进行唱空或做空"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0438.wav", "duration": 6.6020625, "text": "因在台风苏迪罗登陆期间在网络散布水库崩塌谣言"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0216.wav", "duration": 2.3399375, "text": "利润总额较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0288.wav", "duration": 4.687, "text": "纳斯达克在此期间只涨了百分之十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0196.wav", "duration": 3.0700625, "text": "我个人不赞成这一判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0488.wav", "duration": 7.115, "text": "温州永嘉县桥下镇吴山村的潘老伯一家六口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0403.wav", "duration": 6.056875, "text": "近四千名跑步爱好者和其家人朋友齐聚于此"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0208.wav", "duration": 4.817, "text": "努力保护和修复渤海生态系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0399.wav", "duration": 3.9360625, "text": "观众们的鼓励也给了我力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0437.wav", "duration": 8.2319375, "text": "山西省临汾市尧都区刘村镇刘南村一零名村干部"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0325.wav", "duration": 3.6319375, "text": "成飞集成的其他主营业务中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0154.wav", "duration": 4.0330625, "text": "今久正是在蓝色光标的技术支持下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0323.wav", "duration": 6.26, "text": "汉能曾计划今年底前将这一数字提高到三百家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0311.wav", "duration": 4.691875, "text": "公司将更多地依靠经销商进行销售"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0217.wav", "duration": 5.7740625, "text": "同比较上年同期分别增长百分之三十和百分之二十八"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0447.wav", "duration": 8.295875, "text": "歧视中国药企改进质量提高信誉改善用户体验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0338.wav", "duration": 7.1330625, "text": "意大利选手弗菜戈也说我们在来里约之前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0199.wav", "duration": 4.0739375, "text": "发挥国有大企业引领带动作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0129.wav", "duration": 3.5949375, "text": "也助推了土地市场的火爆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0404.wav", "duration": 5.646, "text": "全球范围内的创收达到十一点八亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0215.wav", "duration": 5.641, "text": "必须珍惜抓住用好难得的历史机遇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0201.wav", "duration": 7.2010625, "text": "一些规模较小的考试机构也将自动寻求合并"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0185.wav", "duration": 2.5559375, "text": "从最初的几十人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0424.wav", "duration": 2.6210625, "text": "此后便鲜有消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0470.wav", "duration": 10.8039375, "text": "村民不满行政批复诉市区政府区长庭应诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0151.wav", "duration": 6.3379375, "text": "全国住房公积金贷款风险准备金已接近一百亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0353.wav", "duration": 4.6071875, "text": "过去一直背负着日本花滑界的重压"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0384.wav", "duration": 5.8940625, "text": "挺不容易的支持他追属属于自己的真正幸福"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0311.wav", "duration": 5.2529375, "text": "虽然国家在二零一零年就颁布了新能源补贴政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0419.wav", "duration": 2.9191875, "text": "搜狐娱乐讯日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0386.wav", "duration": 3.4148125, "text": "人们首先会想到她的高度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0466.wav", "duration": 8.897, "text": "温州网八月二十七日讯记者项锐见习记者黄梦思"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0483.wav", "duration": 6.636, "text": "当事水产摊贩已退还郑女士一零零元购虾款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0447.wav", "duration": 11.214125, "text": "游客晋吉岛乘船颠骨折诉旅社索赔二零馀万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0174.wav", "duration": 3.179, "text": "刚需人群观望心理正逐步消散"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0367.wav", "duration": 7.8610625, "text": "也是中国双人滑在申雪赵宏退役后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0221.wav", "duration": 4.1020625, "text": "地方政府也要加大资金筹措力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0222.wav", "duration": 4.6700625, "text": "相当部分资产具有长期的直接收益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0471.wav", "duration": 5.79, "text": "高新区钓渭镇疙瘩沟村村民称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0150.wav", "duration": 7.9389375, "text": "公积金政策调整对于楼市成交刺激作用已初见瑞尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0359.wav", "duration": 3.146, "text": "结果等到的消息是她不能去世界杯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0308.wav", "duration": 3.927, "text": "毕竟与互联网融合时间不长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0306.wav", "duration": 3.1481875, "text": "给孩子配置智能手机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0123.wav", "duration": 5.714, "text": "对房地产市场的利好影响将是长期的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0324.wav", "duration": 4.2568125, "text": "汉能上半年业绩出现大幅下滑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0362.wav", "duration": 3.1700625, "text": "我们两家有时候比较像"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0416.wav", "duration": 2.4599375, "text": "感情一日千里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0144.wav", "duration": 3.2749375, "text": "纠正违法用地一万起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0344.wav", "duration": 5.0131875, "text": "无疑是擂台上最能引爆肾上腺素的震撼一幕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0383.wav", "duration": 3.8510625, "text": "而排名第三位的李尚洙"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0303.wav", "duration": 5.1000625, "text": "同比增长一百三十四点七百分之三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0429.wav", "duration": 4.1999375, "text": "觉得对方只是分享生日上的喜悦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0386.wav", "duration": 4.0, "text": "我们看到了自身强大的综合实力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0272.wav", "duration": 4.2850625, "text": "慈禧太后就因乔致庸创办了票号"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0143.wav", "duration": 6.6390625, "text": "同时对申请公积金贷款的缴纳时限调整为七个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0478.wav", "duration": 4.4260625, "text": "一顿工作餐竟上二六个菜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0182.wav", "duration": 2.0500625, "text": "二到二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0185.wav", "duration": 3.604, "text": "百分之五的网友认为不好说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0172.wav", "duration": 4.7989375, "text": "公积金提取一直是目前试图突破的内容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0323.wav", "duration": 4.4199375, "text": "由于美的集团本身就是威灵电机的大股东"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0483.wav", "duration": 2.958, "text": "白花花的大米洒了一地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0385.wav", "duration": 5.8710625, "text": "高昂的交通和住宿成本让很多人望而却步"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0374.wav", "duration": 5.3710625, "text": "从而将战绩提升为七胜一负积二十一分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0145.wav", "duration": 8.0790625, "text": "地铺门店咨询量与七月同期相比约有百分之七左右的增幅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0221.wav", "duration": 4.0540625, "text": "加强依法监管和制度建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0169.wav", "duration": 3.522, "text": "该存销比数值为七个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0451.wav", "duration": 4.754875, "text": "游客铜缸刻字秀恩爱故宫已报警"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0449.wav", "duration": 6.9189375, "text": "渝蓉高速四川段计划明年通车被称最拖沓高速"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0374.wav", "duration": 3.5759375, "text": "迎来了结束铃声的敲响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0152.wav", "duration": 4.399, "text": "推动全国成交面积止跌反弹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0328.wav", "duration": 6.140125, "text": "通过搭建具有领先技术水平的混合云解决方案平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0205.wav", "duration": 6.3249375, "text": "本报记者王颖春国家发改委近日发出通知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0331.wav", "duration": 3.1179375, "text": "或者跟着广告哼起歌曲来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0135.wav", "duration": 3.389, "text": "政策内容主要涉及购房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0339.wav", "duration": 4.181875, "text": "女排姑娘们在日本的最后一夜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0326.wav", "duration": 2.991, "text": "其中十六家回复发函"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0138.wav", "duration": 5.16, "text": "从今年房企的买地情况来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0186.wav", "duration": 3.2160625, "text": "这是自媒体时代的胜利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0295.wav", "duration": 6.2790625, "text": "翻译过来就是加利福尼亚苹果公司设计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0248.wav", "duration": 8.3679375, "text": "天然气用户为优先允许限制类和禁止类"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0194.wav", "duration": 5.259, "text": "通过产业拉动技术辐射和人员培训等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0340.wav", "duration": 3.2898125, "text": "七年之后宋安东二十五岁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0375.wav", "duration": 8.368875, "text": "本场比赛朱婷复出担任首发主攻并当选为当场最佳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0462.wav", "duration": 8.708, "text": "村民不满地讨说法要求楼盘开发商停工被拘留"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0380.wav", "duration": 3.2900625, "text": "因为和高手过招有种红了眼的感觉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0441.wav", "duration": 2.96, "text": "只有一名船员得以逃生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0439.wav", "duration": 8.594, "text": "延庆法院一审以贪污罪判处钱某有期徒刑一一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0349.wav", "duration": 5.037125, "text": "充分利用北京奥运后的丰富遗产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0453.wav", "duration": 6.6860625, "text": "信息时报讯记者周伟龙八月一零日下午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0458.wav", "duration": 10.313, "text": "温州少年峡谷失踪续二零万馀元赔偿款执行到位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0322.wav", "duration": 4.913125, "text": "但其并未向记者透露项目盈利水平预测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0147.wav", "duration": 4.5250625, "text": "而在兰州市新开楼盘集中的城郊区域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0495.wav", "duration": 3.312, "text": "一名路人疾步上前将男子拦开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0193.wav", "duration": 7.078, "text": "建立起政府部门企业和中介机构各司其职的组织架构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0359.wav", "duration": 7.381125, "text": "早到了退役年龄的庞清和佟健克服了伤病困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0419.wav", "duration": 4.7309375, "text": "因为新剧的厂景和外景推迟了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0232.wav", "duration": 6.489, "text": "从二零零九年下半年就开始要求有关部门调研这一问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0436.wav", "duration": 9.443125, "text": "游客摔断腿旅游社赔三成因旅游时未尽提示义务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0180.wav", "duration": 3.6960625, "text": "点击进入股友会参与讨论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0191.wav", "duration": 4.332, "text": "查清事故造成的危害及损失"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0291.wav", "duration": 3.115, "text": "这次我们同样做到了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0410.wav", "duration": 3.400875, "text": "陈凯琳也拒绝回答"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0435.wav", "duration": 5.025875, "text": "也有网友发出疑问若是李玉刚演唱李的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0288.wav", "duration": 3.8989375, "text": "但不适合那些笨重的解读设备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0355.wav", "duration": 3.298125, "text": "身材偏瘦而且比较健康"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0190.wav", "duration": 3.548, "text": "加大示范区建设力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0360.wav", "duration": 4.5460625, "text": "作为就是我上场多去贯彻教练意图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0409.wav", "duration": 4.214125, "text": "但网友的吐槽却一直没有停息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0217.wav", "duration": 8.5, "text": "坚持米袋子省长负责制和菜篮子市长负责制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0246.wav", "duration": 7.1960625, "text": "鼓励传统纺织家电汽车等一般制造业外移"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0243.wav", "duration": 5.509, "text": "按照种养规模和服务绩效安排工作经费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0365.wav", "duration": 2.983875, "text": "两人的联手十分不顺利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0179.wav", "duration": 5.759, "text": "该政策对于一线城市并不强制执行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0440.wav", "duration": 5.8569375, "text": "特别是师父赵本山也公开出面为大鹏点赞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0149.wav", "duration": 5.289, "text": "公积金贷款及组合贷咨询量明显上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0358.wav", "duration": 7.108875, "text": "张春雨被对手的一记肘击打破了右侧眉弓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0393.wav", "duration": 5.2629375, "text": "该湖区也将是明年奥运会赛艇比赛地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0425.wav", "duration": 3.2368125, "text": "老残样再度乍现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0495.wav", "duration": 4.1711875, "text": "这令被贷款的员工们寝食难安"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0265.wav", "duration": 2.858, "text": "乔布斯不是一名工程师"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0448.wav", "duration": 5.6279375, "text": "在村委会办公楼书记办公室"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0307.wav", "duration": 3.8190625, "text": "某个银行的系统采购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0275.wav", "duration": 9.354, "text": "移动支付可调用的只能是消费者的小额度的钱财"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0488.wav", "duration": 3.438, "text": "她几乎刷遍了各大媒体"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0410.wav", "duration": 4.858875, "text": "她笑称我不想说我没有信心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0268.wav", "duration": 6.036, "text": "对于造成此次异常闪崩的原因目前尚未公布"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0131.wav", "duration": 4.314, "text": "确保完成六万户搬迁改造任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0132.wav", "duration": 3.913, "text": "再次降低公积金贷款的门槛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0333.wav", "duration": 3.8969375, "text": "因此暂停或终止这些项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0495.wav", "duration": 10.274875, "text": "游客要退团张家界低价团导游称信不信你走走不了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0475.wav", "duration": 6.899875, "text": "记者和宁波市三三改一拆办工作人员前往现场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0364.wav", "duration": 4.2009375, "text": "对我们来讲最重要的就是兢兢业业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0166.wav", "duration": 2.086, "text": "去行政化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0241.wav", "duration": 4.198, "text": "引导和鼓励社会资本投入农业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0485.wav", "duration": 2.8679375, "text": "图为几天前村民拍到的河面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0184.wav", "duration": 6.9720625, "text": "公积金贷款总共可少缴利息三十馀万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0255.wav", "duration": 4.688, "text": "通过它能够实现药物的精准投送"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0361.wav", "duration": 4.3000625, "text": "并向对手发起了凶猛的反扑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0258.wav", "duration": 4.938, "text": "这个问题存在于软件捆绑方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0398.wav", "duration": 5.824, "text": "顽强的意志力博得了对手以及全场观众致意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0391.wav", "duration": 5.734875, "text": "二零一五年第十二届女排世界杯战至第八轮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0177.wav", "duration": 3.392, "text": "允许境外机构在境内设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0386.wav", "duration": 5.713875, "text": "这一单身宣言更加激发了日本粉丝对她的痴迷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0446.wav", "duration": 4.7990625, "text": "京华时报记者蒲东峰摄二零零七年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0180.wav", "duration": 6.444125, "text": "港澳台地区居民和华侨因生活需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0207.wav", "duration": 5.4349375, "text": "积极推动种业农垦等方面改革"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0444.wav", "duration": 5.4919375, "text": "听说过段时间还要上场智能秤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0336.wav", "duration": 7.1120625, "text": "已经构成了对他人计算机信息系统的侵入控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0364.wav", "duration": 3.171875, "text": "普鲁申科丝毫没有隐退的打算"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0377.wav", "duration": 4.136, "text": "主教练郎平获得最佳教练"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0431.wav", "duration": 4.9160625, "text": "施王祥被陆丰市纪委立案调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0166.wav", "duration": 4.464, "text": "中原地产市场研究部统计数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0188.wav", "duration": 4.256125, "text": "不断增强农业可持续发展能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0243.wav", "duration": 4.364, "text": "保险资产管理公司如符合有关规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0163.wav", "duration": 6.928, "text": "这是今年五月份以来库存环比增幅最小的一次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0414.wav", "duration": 4.0659375, "text": "朱祖儿操刀灰色调封面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0397.wav", "duration": 5.6230625, "text": "佟健希望自己能真的学到管理知识"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0275.wav", "duration": 3.78, "text": "具体如下方视频介绍所示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0339.wav", "duration": 3.0029375, "text": "这一状况有望发生改变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0163.wav", "duration": 3.617, "text": "相关公司股票走势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0370.wav", "duration": 3.3051875, "text": "达到保护心脏的作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0127.wav", "duration": 3.162, "text": "按公司持有房产计征"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0379.wav", "duration": 5.302, "text": "二零零二年的美国盐湖城冬奥会上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0287.wav", "duration": 5.3259375, "text": "他拿出了数据作为证据截止目前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0237.wav", "duration": 5.0, "text": "审计署的审计结论表明"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0347.wav", "duration": 3.637125, "text": "赛道两边设置了许多专业摄像头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0478.wav", "duration": 5.6159375, "text": "在馀票数量为售后现场关闭售票窗口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0391.wav", "duration": 7.420875, "text": "由此可见北京市业馀排球联赛的影响力与号召力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0258.wav", "duration": 5.9670625, "text": "市场给予它的估值却异常克制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0243.wav", "duration": 6.6289375, "text": "该政策将于二零一二年施行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0122.wav", "duration": 4.6500625, "text": "另外要处理公积金异地使用的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0291.wav", "duration": 6.7510625, "text": "人民币的贬值很可能会增加苹果设备进口的费用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0247.wav", "duration": 4.849, "text": "提高大城市菜篮子产品的自给率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0466.wav", "duration": 9.224125, "text": "游客称点海鲜太少被当地媒体老板受伤更重"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0380.wav", "duration": 5.53325, "text": "她就是因伤未能随队参加本次赛事的徐云丽"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0285.wav", "duration": 9.264875, "text": "谷歌十点五八分股价也出现一点百分之七十九的最大跌幅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0433.wav", "duration": 4.941875, "text": "从下月起全面实施快递实名制登记"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0301.wav", "duration": 3.8049375, "text": "美国外交消息人士透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0214.wav", "duration": 5.518, "text": "有大车或是货车误闯或者闯进去了就不好办了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0186.wav", "duration": 3.935, "text": "对于实施住房限购政策的城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0425.wav", "duration": 3.8000625, "text": "否认了陈妍希疑似怀孕的传闻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0429.wav", "duration": 6.298125, "text": "好友陈妍希晒与潘玮柏搞怪合影为他庆生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0479.wav", "duration": 3.666, "text": "谢女士购买的盐水鸭外包装"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0278.wav", "duration": 4.461875, "text": "也就是所说的流动性蒸发事实上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0242.wav", "duration": 5.9600625, "text": "选择部分农业科研院所予以稳定支持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0442.wav", "duration": 7.75, "text": "希望能从中国内地日益老龄化的一三亿人口中受益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0266.wav", "duration": 3.345, "text": "我们完全有理由树立创新自信"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0296.wav", "duration": 4.3299375, "text": "银行们对此已深耕多年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0389.wav", "duration": 4.797875, "text": "跳远阿莱恩卡马拉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0480.wav", "duration": 7.7099375, "text": "港媒中国成访日第一大客源国还会持续增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0226.wav", "duration": 3.5340625, "text": "不可能是完全无风险的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0354.wav", "duration": 3.364, "text": "促进北京排球事业发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0386.wav", "duration": 7.6230625, "text": "那就是姑娘们高举起惠若琪徐云丽和杨方旭的球衣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0399.wav", "duration": 3.28, "text": "经过近两个星期的漫长等待"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0326.wav", "duration": 4.093, "text": "这个项目是自有资金投入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0375.wav", "duration": 3.4179375, "text": "再度成为了比赛的得分王"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0267.wav", "duration": 5.7779375, "text": "苹果公司的市价将突破一万亿美金大关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0204.wav", "duration": 11.8679375, "text": "目前我国正在稳步开展中小企业信贷资产证券化试点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0281.wav", "duration": 2.8459375, "text": "恰恰更需要我们有所作为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0251.wav", "duration": 6.781, "text": "着力建设国家商品粮供给重点保证区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0150.wav", "duration": 6.435, "text": "北京今年的土地出让金锁定在两千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0245.wav", "duration": 7.651, "text": "加快理顺天然气价格与可代替能源的比价关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0296.wav", "duration": 2.8569375, "text": "不少报道与评论表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0170.wav", "duration": 5.743, "text": "他是家居产品依托互联网技术升级的家居耐用品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0452.wav", "duration": 5.2531875, "text": "浙江温州一老人拿出全部积蓄并卖掉两套房子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0223.wav", "duration": 5.105, "text": "农业农村信息化十二五规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0227.wav", "duration": 6.5379375, "text": "对促进当地经济增长和政府财力的增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0144.wav", "duration": 3.244, "text": "三是已有人员和机构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0279.wav", "duration": 5.1550625, "text": "美国政府部门当地时间周四警示称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0430.wav", "duration": 4.0, "text": "搜狐娱乐讯据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0414.wav", "duration": 3.0869375, "text": "父女恋纸包不住火"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0428.wav", "duration": 5.802, "text": "对许玮甯单身说语气落寞表示我没有什么看法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0257.wav", "duration": 4.02, "text": "往往就是公司陷入灾难的开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0237.wav", "duration": 6.6740625, "text": "全面落实农机具购置补贴各项管理制度和规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0452.wav", "duration": 6.5600625, "text": "参考消息网一零月二九日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0411.wav", "duration": 5.9289375, "text": "身穿白色抹胸的她大秀性感好身材"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0398.wav", "duration": 3.996125, "text": "管理知识肯定都是用的上的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0320.wav", "duration": 7.391125, "text": "而这种策略带来的结果是市场份额的快速提升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0207.wav", "duration": 4.475125, "text": "科技科技进步贡献率百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0198.wav", "duration": 5.517, "text": "奶类总产量七万吨水产品总产量七万吨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0176.wav", "duration": 3.957, "text": "公积金政策的放宽对二手房市场也产生了影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0365.wav", "duration": 8.016875, "text": "二零一五年世界田径锦标赛即将在北京拉开序幕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0227.wav", "duration": 3.827, "text": "继续加强优质棉花生产基地建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0333.wav", "duration": 4.1379375, "text": "锂电池作为新能源车的重要部件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0160.wav", "duration": 3.621, "text": "可使用起来让人啼笑皆非"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0251.wav", "duration": 5.6049375, "text": "并进而对城投债券进行唱空或做空"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0411.wav", "duration": 3.243125, "text": "更让粉丝看了鼻血直流"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0257.wav", "duration": 2.59, "text": "到底发挥了什么作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0396.wav", "duration": 3.378875, "text": "表明队长角色转换完成得还不错"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0238.wav", "duration": 4.6259375, "text": "形成一批具有国际竞争力的中国企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0123.wav", "duration": 6.2960625, "text": "在限限制外商投资产业目录中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0460.wav", "duration": 5.363, "text": "看过湖北电梯吃人视频的不少上海年轻人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0406.wav", "duration": 4.213125, "text": "皮克斯终于有了拍摄玩具总动员四的计划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0258.wav", "duration": 3.5, "text": "病毒武器的传染性超强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0190.wav", "duration": 5.5999375, "text": "我委也注意到在企业债券存续期间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0304.wav", "duration": 7.8200625, "text": "美的美的在二零一四年三月正式发布智慧家庭战略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0323.wav", "duration": 6.339125, "text": "将其列为恶意软件用户称其为流氓软件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0459.wav", "duration": 5.282, "text": "批评职能部门没有将消费者放在第一位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0433.wav", "duration": 3.0451875, "text": "二零一四三七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0274.wav", "duration": 3.660875, "text": "美国股市九点五十起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0481.wav", "duration": 5.71675, "text": "村民多次向温岭市有关部门投诉反映"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0466.wav", "duration": 5.035875, "text": "游客在新加坡买祖母绿回国发现非纯天然"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0454.wav", "duration": 3.5920625, "text": "甚至还会爬到村民家中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0391.wav", "duration": 3.051, "text": "谢谢每一个支持我们的人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0249.wav", "duration": 4.293, "text": "继续加大农业农村人才培养力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0312.wav", "duration": 5.817, "text": "中国家电企业现在正面临前所未有的挑战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0435.wav", "duration": 3.9809375, "text": "南粤清风网通报该案详情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0198.wav", "duration": 5.1909375, "text": "建立草原增加碳汇和生态补偿机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0133.wav", "duration": 3.491, "text": "此次政策调整也有较好的针对性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0398.wav", "duration": 4.375, "text": "男子冰球的战绩均在二十五名左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0324.wav", "duration": 3.6010625, "text": "确保信号与手机相当才真正投放市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0143.wav", "duration": 3.823, "text": "当地产商的效果预期不断提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0376.wav", "duration": 6.1530625, "text": "并邀请京城排球界全部媒体参加报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0208.wav", "duration": 3.9810625, "text": "发展农村服务业和乡村企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0147.wav", "duration": 4.75, "text": "再购房执行首套房贷款政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0180.wav", "duration": 3.796, "text": "允许机构和个人在中国购房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0223.wav", "duration": 7.1949375, "text": "切实解决损害公众健康影响科学发展的突发环境问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0293.wav", "duration": 4.858125, "text": "这不仅创下苹果公司自二零一四年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0267.wav", "duration": 4.3779375, "text": "移动支付又会产生非常敏感的操作信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0315.wav", "duration": 5.650125, "text": "上半年营业收入二十一点零八亿港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0369.wav", "duration": 7.962875, "text": "上届莫斯科世锦赛上拿到的金牌的四位选手悉数出战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0339.wav", "duration": 3.327875, "text": "近日日本媒体曝出惊人消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0229.wav", "duration": 6.3409375, "text": "要依法追究管理部门责任企业及有关人员的责任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0166.wav", "duration": 4.843, "text": "公积金在申请放贷流程上并未提速"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0303.wav", "duration": 4.9299375, "text": "有黑客在网络上兜售车主信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0163.wav", "duration": 3.3840625, "text": "深圳环比上涨百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0473.wav", "duration": 4.777125, "text": "门头沟区长张贵林出庭应诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0244.wav", "duration": 5.2370625, "text": "要继续深化天然气价格改革"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0315.wav", "duration": 4.702875, "text": "只要辐射值小于或等于国家标准值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0470.wav", "duration": 3.228, "text": "只需要一个账户名和密码"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0334.wav", "duration": 7.5, "text": "自动化生产线的柔性改造也是其面临的一大难题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0302.wav", "duration": 3.3679375, "text": "苹果的市值可能将突破万亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0174.wav", "duration": 4.385, "text": "搭起了全国地产推广新媒体的版图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0342.wav", "duration": 3.6120625, "text": "远远无法和北京相提并论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0234.wav", "duration": 4.853, "text": "我们还控制了投融资平台公司发债的范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0327.wav", "duration": 3.991, "text": "国产服务器即使是自主设计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0365.wav", "duration": 5.218, "text": "彭博一英里接力赛区别于其他跑步活动的是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0255.wav", "duration": 5.108, "text": "催生着移动支付技术的大跃进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0280.wav", "duration": 4.6939375, "text": "原告当地时间周二在法庭上表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0236.wav", "duration": 5.9859375, "text": "我国地方政府的累积债务相对于偿付能力来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0154.wav", "duration": 5.082, "text": "商品房销售额同比上涨超过了百分之四十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0394.wav", "duration": 6.629875, "text": "但大部分都是常年活跃在业馀排球圈里成熟队球"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0202.wav", "duration": 3.943, "text": "中国对农产品流通政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0308.wav", "duration": 5.7411875, "text": "杨某等四人一同在深圳成立了安丰公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0233.wav", "duration": 4.291, "text": "健全水产良良种体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0356.wav", "duration": 2.6790625, "text": "当时确实没有什么心理准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0368.wav", "duration": 4.4181875, "text": "孙杨的心肌损伤是在感冒后引发的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0254.wav", "duration": 5.2059375, "text": "其股票价格在十五点七六美元上下徘徊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0364.wav", "duration": 4.496, "text": "颜妮坦言自己的发挥也不是特别稳定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0148.wav", "duration": 3.607, "text": "但库存压力却难以缓减"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0139.wav", "duration": 4.3449375, "text": "相继有一百多个城市出台了公积金新政"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0141.wav", "duration": 3.813, "text": "为房地产商提供系统化的服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0237.wav", "duration": 4.2889375, "text": "远低于发生债务危机的欧美国家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0261.wav", "duration": 3.6109375, "text": "排名前十的科技公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0171.wav", "duration": 5.36, "text": "而申请公积金贷款方面还是需要走严格的流程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0355.wav", "duration": 8.5, "text": "夺得国际田联竞走世界杯男子二十公里竞走银牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0361.wav", "duration": 4.546875, "text": "在金牌搭档罗宾索尔科维退役之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0148.wav", "duration": 4.053, "text": "中国市场空间多样化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0266.wav", "duration": 2.7330625, "text": "缺乏新的业务增长点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0465.wav", "duration": 2.512, "text": "拿出了自己全部的积蓄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0200.wav", "duration": 4.215125, "text": "促进各种所有制企业共同发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0294.wav", "duration": 2.901125, "text": "也在所不惜的最后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0199.wav", "duration": 3.5240625, "text": "优化产业结构与布局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0449.wav", "duration": 6.8249375, "text": "此前温州政协委员连续两届提出要求整治垃圾污染问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0481.wav", "duration": 8.989, "text": "可实际上维护国家边海防安全保护国家利益不受侵犯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0484.wav", "duration": 6.2580625, "text": "温州化工仓库起火殃及附近河流大量死鱼漂河面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0332.wav", "duration": 7.8769375, "text": "美的最近还把洗碗机事业部合并到美的的厨房电器事业部"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0184.wav", "duration": 3.509, "text": "依托蓝色光标的强大平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0324.wav", "duration": 5.0, "text": "即使今后美芝压缩机被威灵电器兼并"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0157.wav", "duration": 3.952, "text": "很难出现去年那样的楼市暴涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0198.wav", "duration": 5.088, "text": "将切实减轻考生经济负担"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0222.wav", "duration": 6.0599375, "text": "建设国家级农作物育制种基地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0329.wav", "duration": 3.6960625, "text": "如果威灵电器兼并美芝压缩机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0226.wav", "duration": 4.0970625, "text": "坚持和完善渔用柴油补贴政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0367.wav", "duration": 3.2468125, "text": "中国队虽然如愿夺冠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0172.wav", "duration": 4.47, "text": "甚至开始进入了供过于求的局面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0370.wav", "duration": 4.0490625, "text": "拿到了明年里约奥运会的入场券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0283.wav", "duration": 3.042, "text": "我们外人是无法知道真相的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0384.wav", "duration": 3.8098125, "text": "不仅要看他的竞技状态恢复程度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0391.wav", "duration": 5.0610625, "text": "铁饼克里斯托弗哈特灵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0484.wav", "duration": 4.276125, "text": "引来周边大批村民哄抢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0260.wav", "duration": 6.207, "text": "而苹果虽有可能卖出不少手表给忠实的粉丝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0176.wav", "duration": 5.399, "text": "正式放松外资投资我国房地产相关规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0439.wav", "duration": 3.8469375, "text": "呼救报警时称有人入屋行凶"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0229.wav", "duration": 3.2430625, "text": "老龄事业十二五规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0250.wav", "duration": 2.7899375, "text": "树立绿色低碳发展理念"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0487.wav", "duration": 6.0080625, "text": "村支书遭集体举报买鼠药欲投毒报复村民"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0330.wav", "duration": 4.3449375, "text": "白电行业将进入最惨烈的一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0379.wav", "duration": 3.702125, "text": "评价自己发挥的最好一场其实就是本场比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0490.wav", "duration": 3.4150625, "text": "此前已被列入拆除范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0227.wav", "duration": 4.0330625, "text": "着力强化技术装备支撑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0198.wav", "duration": 4.7990625, "text": "如何为企业提供信息避免海外投资风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0470.wav", "duration": 5.9350625, "text": "二九岁的章某被控洗钱一二二万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0389.wav", "duration": 3.457, "text": "但更多的是落实在技术环节的细腻方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0432.wav", "duration": 4.0, "text": "按照国家邮政总局统一部署"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0172.wav", "duration": 3.798, "text": "根源是体制机制存在弊端"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0358.wav", "duration": 5.105, "text": "但就在外界期待着冰王子的卷土重来时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0205.wav", "duration": 5.213, "text": "运用符合世界贸易组织规定的相关措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0437.wav", "duration": 6.9038125, "text": "短短二零零字歌词运用诗词典故三六处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0279.wav", "duration": 4.3559375, "text": "而是将其转化成唯一的临时编码"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0468.wav", "duration": 4.556875, "text": "因为没有哪个运动员不想表现出最好的自己"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0346.wav", "duration": 5.728, "text": "此轮战罢后积分榜前四名排位没有任何变化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0443.wav", "duration": 3.1599375, "text": "月亮看起来会比往常大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0458.wav", "duration": 5.1159375, "text": "新京报快讯记者林野记者今天傍晚获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0416.wav", "duration": 5.0490625, "text": "陈冠希穿休闲短袖配宽松裤子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0132.wav", "duration": 5.685, "text": "推进上百个棚改项目全面启动实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0412.wav", "duration": 3.313, "text": "戏中的角色常常以性感打扮示人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0313.wav", "duration": 4.02, "text": "给孩子买儿童电话手表有必要吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0148.wav", "duration": 5.9820625, "text": "北京公积金贷款首付比例松绑一周后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0245.wav", "duration": 3.634875, "text": "推进订单生产和农超对接"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0209.wav", "duration": 5.283, "text": "新建旱涝保收高标准农田四亿亩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0263.wav", "duration": 5.410875, "text": "苹果早晚将步之前过气股王的后尘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0126.wav", "duration": 7.77, "text": "网友的置业目的为首套房自住的占到了百分之六十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0307.wav", "duration": 5.0610625, "text": "一定程度上影响了资源整合的效率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0461.wav", "duration": 9.459, "text": "村妇为缓解丈夫病痛种罂丽当药用被判刑六个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0311.wav", "duration": 4.0551875, "text": "有业内人士分析指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0148.wav", "duration": 6.443, "text": "看楼量对比上一周末大概增加百分之七左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0317.wav", "duration": 5.109875, "text": "儿童电话手表正好解决了这两个问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0341.wav", "duration": 4.806875, "text": "可以有效的抵消年龄所带来的速度劣势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0383.wav", "duration": 3.901875, "text": "整个队伍承受了很大的困难和考验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0204.wav", "duration": 6.2570625, "text": "逐步实现战略运营管管理全球化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0198.wav", "duration": 4.999, "text": "力争渤海近岸海域水质总体改善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0207.wav", "duration": 7.473, "text": "落实土壤改良地力培肥等措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0239.wav", "duration": 5.4539375, "text": "为各地的基础设施建设提供有制度保障的融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0204.wav", "duration": 5.269, "text": "发改委双节期间重点关注电商促销行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0421.wav", "duration": 2.974875, "text": "对于天津爆炸时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0242.wav", "duration": 3.9929375, "text": "更加有利于价值投资理念形成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0479.wav", "duration": 7.327125, "text": "梁某某被一审法院以故意伤害罪判处有期徒刑三年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0231.wav", "duration": 3.41, "text": "控制在合理的范围内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0209.wav", "duration": 2.613, "text": "建立稳定的产销关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0450.wav", "duration": 3.0920625, "text": "餐厅有没有权力罚款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0223.wav", "duration": 5.251, "text": "加大动物强制免疫补贴力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0468.wav", "duration": 2.345, "text": "那原因到底在哪里呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0283.wav", "duration": 6.0690625, "text": "在安卓出货量中的占比减少到了百分之六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0409.wav", "duration": 3.8569375, "text": "洪永城还主动跟陈展鹏碰杯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0404.wav", "duration": 2.8789375, "text": "也等待了很长时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0228.wav", "duration": 4.536, "text": "国务院批准银行系基金公司再扩容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0198.wav", "duration": 5.8399375, "text": "按照分类指导突出重点梯次推进的思路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0329.wav", "duration": 4.688, "text": "核心架构也基本照抄国外厂商"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0222.wav", "duration": 3.8780625, "text": "央企在境外投资面临的问题很多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0272.wav", "duration": 8.011, "text": "之前刚刚提出为女性员工提供冷冻卵子费用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0312.wav", "duration": 5.412125, "text": "也是顺应互联网时代管理扁平化的趋势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0487.wav", "duration": 3.1740625, "text": "她的基因竟是个纯爷们"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0122.wav", "duration": 5.931, "text": "有百分之五的网友选择了提高公积金贷款额度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0470.wav", "duration": 10.238, "text": "港媒中国出现多中心大都市郊区需要更多移民"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0493.wav", "duration": 4.022, "text": "其中一女法官尚在哺乳期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0319.wav", "duration": 6.3410625, "text": "占营业收入的比例是五点百分之四十七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0152.wav", "duration": 5.11, "text": "蓝色光标作为全球首屈一指的广告服务商"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0379.wav", "duration": 5.928, "text": "以大球套小球为设计理念"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0321.wav", "duration": 4.6390625, "text": "赵继宏老板电器做厨电已经三十多年了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0153.wav", "duration": 4.414, "text": "宋芳必须再掏出完全属于自己的资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0137.wav", "duration": 3.927, "text": "这成为今久转型的起点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0272.wav", "duration": 4.583, "text": "这些中国游戏公司大多成长于中国市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0301.wav", "duration": 3.8769375, "text": "这样的做法当然是企业行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0421.wav", "duration": 3.1010625, "text": "当时女方坦承已分居"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0369.wav", "duration": 6.5, "text": "去年六月下旬举行的中国国际精英赛北仑站"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0270.wav", "duration": 4.465125, "text": "你必须保证自己了解稳态市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0125.wav", "duration": 2.945, "text": "钱烧完了东西出不来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0125.wav", "duration": 3.669, "text": "为了将后辈的婚姻分险隔断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0434.wav", "duration": 9.0, "text": "二十七日深夜终于在云林县一家废弃空屋中救出了黄立坤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0330.wav", "duration": 4.9389375, "text": "产品创新其实也是一个双向互动的过程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0292.wav", "duration": 3.2170625, "text": "纷至沓来的报道显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0271.wav", "duration": 4.1639375, "text": "消费者对便捷性的要求可能会更高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0220.wav", "duration": 4.3819375, "text": "建立公开透明的信息发布机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0430.wav", "duration": 3.093, "text": "但几乎一个都没有实现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0390.wav", "duration": 4.2149375, "text": "拿下全场最高分的朱婷赛后表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0132.wav", "duration": 7.4049375, "text": "绿地保利万达分列性价比最高房企的二三四名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0290.wav", "duration": 6.0, "text": "且把服务范围特别局限在医疗健康领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0231.wav", "duration": 4.5759375, "text": "地方投融资平台公司申请发行债券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0255.wav", "duration": 5.491, "text": "美国将向印度转让两项军事技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0368.wav", "duration": 5.5139375, "text": "结合业馀排球特点做出细微调整制定而成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0159.wav", "duration": 8.0869375, "text": "一百万元的贷款额度能满足大部分首套刚需的贷款需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0476.wav", "duration": 3.629875, "text": "被餐厅罚款二四零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0180.wav", "duration": 3.3299375, "text": "可能引发房价泡沫风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0209.wav", "duration": 8.068, "text": "严厉打击春运期间违规上调票价价外收费等违法行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0126.wav", "duration": 3.67, "text": "鼓励购房者积极缴纳公积金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0343.wav", "duration": 5.083, "text": "三级跳克里斯丁吉尔奇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0427.wav", "duration": 5.198, "text": "恰巧昨日记者碰见阮经天出门倒垃圾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0368.wav", "duration": 4.5500625, "text": "见此情景韩国队的信心受到了打击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0348.wav", "duration": 5.0349375, "text": "高清图女排凯旋郎平受热捧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0346.wav", "duration": 5.1530625, "text": "场馆建设一简约而不简单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0219.wav", "duration": 5.057, "text": "落实农资综合补贴动态调整机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0453.wav", "duration": 4.463875, "text": "中纪委监察部网站发布消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0231.wav", "duration": 7.033, "text": "再次听取全国民用核设施综合安全检查情况汇报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0429.wav", "duration": 3.8139375, "text": "一直传他跟洪永城不和"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0304.wav", "duration": 4.4338125, "text": "智能手机特定的上网和游戏功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0365.wav", "duration": 5.7380625, "text": "还与巴西队的加比一起入选最佳主攻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0492.wav", "duration": 6.8930625, "text": "港媒称内地为国际市场修改动画片妖怪不能吃唐僧肉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0345.wav", "duration": 4.058, "text": "我觉得自己的脚伤已经完全恢复了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0467.wav", "duration": 3.488, "text": "花费几千元至上万元不等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0159.wav", "duration": 3.604, "text": "各城市库存压力正在减小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0457.wav", "duration": 8.3400625, "text": "游客三亚海滩赏月后留二九吨垃圾三百人连夜清理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0170.wav", "duration": 4.0, "text": "提升新型城镇化质量和效益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0472.wav", "duration": 6.0608125, "text": "港媒中国发布金牌月嫂标准实用性遭质疑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0450.wav", "duration": 8.806125, "text": "村内常有蛇出没疑从养蛇村民中爬出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0267.wav", "duration": 4.967875, "text": "上一次工业革命我们落在了西方发达国家后面很远"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0489.wav", "duration": 5.1240625, "text": "每天烧香敬拜办事处主任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0235.wav", "duration": 5.34, "text": "江苏省交通厅相关负责人昨日对记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0173.wav", "duration": 4.1939375, "text": "说明各城市涨价的时机还不成熟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0378.wav", "duration": 4.1799375, "text": "三场比赛朱婷均有出色表现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0449.wav", "duration": 6.756125, "text": "港媒道士下山被批引发网友广泛讨论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0429.wav", "duration": 3.036875, "text": "不好的事情发生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0187.wav", "duration": 8.312, "text": "带动和规范民间资本进入农产品流通领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0349.wav", "duration": 7.5, "text": "将这份快乐与跑对跑步的执着传递给身边的好友"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0373.wav", "duration": 4.3049375, "text": "标志着我国体育开始走向国际化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0360.wav", "duration": 6.2109375, "text": "花样滑冰大奖赛中国杯常年在北京和上海之间轮换"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0459.wav", "duration": 4.0, "text": "一旦雷雨天游客在亭内出事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0261.wav", "duration": 5.2889375, "text": "这种巨大且异乎寻常的抛售量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0230.wav", "duration": 3.4160625, "text": "加快现代养殖业发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0310.wav", "duration": 3.7060625, "text": "企业所有的目标都是空洞的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0192.wav", "duration": 5.5660625, "text": "努力打造现代农业发展的典型和样板"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0218.wav", "duration": 4.6130625, "text": "引导土地承包经营权向生产和经营能手集中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0134.wav", "duration": 3.1600625, "text": "住宅销售额也增长了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0257.wav", "duration": 4.3579375, "text": "华尔街并不认可游戏这种商业模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0425.wav", "duration": 2.723125, "text": "问及见面后两人怎样庆祝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0132.wav", "duration": 3.813, "text": "不利于继续大规模拿地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0232.wav", "duration": 5.386, "text": "设定政府性债务风险控制指标和标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0197.wav", "duration": 4.6779375, "text": "各地各部门加强组织领导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0333.wav", "duration": 5.8819375, "text": "三巨头中的格力海尔均出现不同程度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0204.wav", "duration": 5.337, "text": "研究部署在城市优先发展公共交通"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0321.wav", "duration": 3.6319375, "text": "新能源汽车市场在逐步启动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0201.wav", "duration": 3.224, "text": "今年国庆应该可以实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0223.wav", "duration": 4.0060625, "text": "到了出口车道再把通行卡收回去"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0291.wav", "duration": 3.5910625, "text": "在类似印度之类的新兴市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0451.wav", "duration": 5.491, "text": "李娜产女后首次亮相运动员掌握英语很重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0153.wav", "duration": 4.927, "text": "可转化为住房银行资本金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0216.wav", "duration": 5.923, "text": "同时改善步行自行车出行条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0426.wav", "duration": 1.859125, "text": "祝可爱的你"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0296.wav", "duration": 8.4620625, "text": "认为美国此举违反世界贸易组织规则和美国国内法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0313.wav", "duration": 4.479, "text": "截至二零一四年十二月三十一日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0131.wav", "duration": 7.693, "text": "万科以百分之五的票数获选性价比最高的房企"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0493.wav", "duration": 5.735125, "text": "温州城管协管员掌掴女清洁工被停职"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0344.wav", "duration": 5.547875, "text": "来为二零二二年的冬奥会积累经验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0240.wav", "duration": 3.8560625, "text": "使得很多投融资平台公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0160.wav", "duration": 6.4629375, "text": "兰州房地产市场销量增加明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0264.wav", "duration": 5.277, "text": "除了苹果上周公布的选定合作伙伴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0177.wav", "duration": 4.0639375, "text": "园区总建筑面积一万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0476.wav", "duration": 6.1169375, "text": "游客在济南景区水池许愿观赏莲被砸成马蜂窝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0373.wav", "duration": 3.551, "text": "其中郎平主教练最为辛苦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0345.wav", "duration": 4.7729375, "text": "北京张家口计划启用一二个竞赛场馆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0455.wav", "duration": 4.3000625, "text": "本月中下旬小行星撞地球"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0476.wav", "duration": 3.4880625, "text": "我局将给予五万元奖励"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0413.wav", "duration": 2.922125, "text": "对着镜头吐舌卖萌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0365.wav", "duration": 3.2580625, "text": "此次北京申办冬奥会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0408.wav", "duration": 2.4978125, "text": "除了去年结婚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0489.wav", "duration": 4.5, "text": "张先生购买的四零零元玛卡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0321.wav", "duration": 5.8299375, "text": "其目前的股票市值已经不能完全反映公司价值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0435.wav", "duration": 4.587875, "text": "导游还诱骗游客加钱走特殊路线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0378.wav", "duration": 6.574, "text": "女排三十一日本进军里约众将欢度欢庆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0186.wav", "duration": 3.3340625, "text": "在这一政策出台后匆忙购房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0143.wav", "duration": 8.785, "text": "生产性科技及高技术服务业发展用地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0270.wav", "duration": 4.2359375, "text": "大多数游戏产品往往病毒式地成长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0141.wav", "duration": 4.831, "text": "在鼓励盘活利用现有用地方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0454.wav", "duration": 5.8461875, "text": "杀害中传失联女主嫌犯想找个无辜的人发泄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0133.wav", "duration": 4.032, "text": "成千上万的产品通过无线连接"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0406.wav", "duration": 5.396, "text": "这部电影的失败并没有影响囧瑟夫的心情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0130.wav", "duration": 3.396, "text": "同比名义增长许多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0184.wav", "duration": 4.598, "text": "关于智能家居你必须懂的五件事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0405.wav", "duration": 4.626, "text": "只以六百四十八万美元的进账排名第八"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0303.wav", "duration": 4.0600625, "text": "为中国的智能制造产业做出贡献"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0163.wav", "duration": 5.406, "text": "目的也是为了夯实楼市回升的基础"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0431.wav", "duration": 5.511, "text": "李嘉诚回应撤资不爱国指控完全不成立"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0409.wav", "duration": 4.4660625, "text": "不仅摆脱神雕侠侣时期的小笼包名号"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0420.wav", "duration": 2.8110625, "text": "谢贤怒打曾江"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0399.wav", "duration": 5.041, "text": "志愿者除了要具备流利的英语交流能力外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0479.wav", "duration": 4.451875, "text": "一身保安制服的他准时站在校门口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0169.wav", "duration": 3.6690625, "text": "实施较大幅度的补贴政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0256.wav", "duration": 5.3469375, "text": "又如何和政府银行搞好关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0436.wav", "duration": 6.6069375, "text": "港报评上海迪尼士不意味着香港迪尼士的没落"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0221.wav", "duration": 5.9040625, "text": "会议讨论进一步加强环境保护工作的意见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0325.wav", "duration": 6.0539375, "text": "加上随身携带的便捷性和流畅的操作体验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0181.wav", "duration": 6.2790625, "text": "松绑二套房贷认定标准降低二套房贷首付比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0249.wav", "duration": 4.723, "text": "考生对考试收费问题反映较多等问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0266.wav", "duration": 5.865, "text": "乔斯维亚克就很少在公众场合露面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0167.wav", "duration": 5.717, "text": "只要了解一点核桃锁信息的人都能第一时间感受到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0299.wav", "duration": 3.4050625, "text": "这些手表将配置不同的表带"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0122.wav", "duration": 4.191, "text": "而落地后的产品与客户的期待甚远"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0184.wav", "duration": 5.745, "text": "房地产价格调整还未完全结束"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0241.wav", "duration": 5.5960625, "text": "强化流通基础设施建设和产销信息引导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0412.wav", "duration": 5.3251875, "text": "陈妍希今天五月二日下午出席公益活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0321.wav", "duration": 4.2259375, "text": "移动互联以前改变的是软的层面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0350.wav", "duration": 3.467, "text": "仅有三个场馆需要新建"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0237.wav", "duration": 7.4350625, "text": "探索实施生物农药低毒农药使用补助政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0301.wav", "duration": 7.4770625, "text": "位于后方的主翼中央挂着两具涡轮风扇发动机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0176.wav", "duration": 9.584, "text": "可以北京四环内唯一的国际化共享办公园区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0213.wav", "duration": 8.4439375, "text": "我们应该建设可控的规范化的地方政府融资机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0259.wav", "duration": 7.813, "text": "只是这种情况下心率传感器会每隔十秒进行一次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0167.wav", "duration": 5.439, "text": "我现在就是担心自己哪天突然出现个什么情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0162.wav", "duration": 3.433, "text": "拓展货币政策操作空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0246.wav", "duration": 4.642, "text": "支持主要农产品优势产区建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0471.wav", "duration": 6.214125, "text": "游客不满小孩超高补票与景区工作人员群殴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0416.wav", "duration": 7.781, "text": "使得宝宝刚出生就有了一大班星星级干爹干娘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0312.wav", "duration": 3.7470625, "text": "但是市场启动不像预期那么快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0287.wav", "duration": 3.413, "text": "市场份额做到了前十位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0415.wav", "duration": 6.492875, "text": "一向都是在圈子中人缘甚佳的谢天华"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0421.wav", "duration": 3.3459375, "text": "在当地逗留了三四天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0423.wav", "duration": 2.6760625, "text": "并推断其已怀孕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0429.wav", "duration": 3.1430625, "text": "让粉丝听了又惊又喜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0349.wav", "duration": 4.7580625, "text": "裁判员队伍和参赛代表队依次入场亮相"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0470.wav", "duration": 5.4829375, "text": "游客在日照旅游吃海鲜太少被围殴警方都有错"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0455.wav", "duration": 7.5849375, "text": "游学夏令营的无奈花豪华团价格吃喝难保"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0176.wav", "duration": 3.2840625, "text": "部分客户甚至等两个多月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0313.wav", "duration": 4.588, "text": "产能现在已经满足不了订单需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0458.wav", "duration": 5.542, "text": "湖北荆州吃人电梯盖板设计不合理供图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0200.wav", "duration": 6.9490625, "text": "着力建设重点推进率先实现和稳步发展三类区域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0328.wav", "duration": 4.631, "text": "同比下跌十三六点百分之六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0434.wav", "duration": 5.8310625, "text": "陆丰市纪委决定给予施王祥开除党籍处分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0130.wav", "duration": 5.059, "text": "在商品房性价比的选择上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0266.wav", "duration": 4.245, "text": "任何的电子行为都不免会留下痕迹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0410.wav", "duration": 2.850125, "text": "纷纷留言点赞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0398.wav", "duration": 5.878875, "text": "而二零零八年举办夏季奥运会所留下的宝贵遗产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0420.wav", "duration": 7.1161875, "text": "两人被传媒追问恋情时都要求给予空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0222.wav", "duration": 7.052, "text": "加强新增千亿斤粮食生产能力规划的田间工程建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0218.wav", "duration": 5.062, "text": "城投债券作为中国债券市场的准市政债"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0415.wav", "duration": 7.264875, "text": "陈妍希一直努力让自己的脸圆圆脸变瘦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0409.wav", "duration": 8.9150625, "text": "因参演剧集殭而与陈嘉宝及赖慰玲成为好姐妹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0432.wav", "duration": 6.7519375, "text": "渔船海上爆炸沉没四名渔民漂流三天获救"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0323.wav", "duration": 8.3669375, "text": "美的不能因自动化生产增加制造成本而让用户买单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0406.wav", "duration": 7.6120625, "text": "今天确定了上映日期二零一七年四月十七日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0127.wav", "duration": 4.059, "text": "大智慧阿思达克通讯社"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0187.wav", "duration": 3.5479375, "text": "加快老旧渔船更新改造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0197.wav", "duration": 4.3479375, "text": "政府提供的服务企业是否需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0458.wav", "duration": 7.7990625, "text": "温州城管掌掴女清洁工已被停职检查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0144.wav", "duration": 5.368, "text": "这时候更要求服务商具备思考和行动的一致性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0403.wav", "duration": 5.949, "text": "徐永昊的站立打击技术在该级别中堪称翘楚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0201.wav", "duration": 3.271, "text": "至二零一一年六月底"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0384.wav", "duration": 5.302, "text": "中国冰雪健儿终于站到了冬奥会的最高领奖台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0445.wav", "duration": 6.974125, "text": "杀人犯抢劫获刑未查出旧案警方指纹识别有遗漏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0389.wav", "duration": 4.7380625, "text": "近来有关里约水污染问题备受关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0324.wav", "duration": 6.2009375, "text": "同比去年降零点六百分之六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0418.wav", "duration": 3.431875, "text": "陈妍希穿着粉色上衣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0324.wav", "duration": 6.593, "text": "其中浪潮达到了百分之六十的市场占有率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0323.wav", "duration": 6.5400625, "text": "增持后持股比例为六十二点百分之二十三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0494.wav", "duration": 8.8820625, "text": "湖北六零后求婚九零后被指责欠款六千万因诈骗取保候审"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0386.wav", "duration": 3.343, "text": "可以在世界范围内立足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0350.wav", "duration": 4.661125, "text": "相较于其精湛凶猛的站立技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0421.wav", "duration": 3.4560625, "text": "陈妍希还去医院做了检查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0437.wav", "duration": 7.3789375, "text": "其中内地由两年前的一三零零间增至今天的二三零零间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0164.wav", "duration": 2.8419375, "text": "尽管去年新政以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0190.wav", "duration": 4.253, "text": "对重大项目和重大问题进行协调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0397.wav", "duration": 5.9028125, "text": "四乘一百米接力罗伯特哈特灵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0188.wav", "duration": 5.914, "text": "建立协调配合检打联动联防联控应急处置机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0281.wav", "duration": 4.1180625, "text": "大概十年前就有了这样的说法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0487.wav", "duration": 9.661875, "text": "港媒称内地中产人数猛增有助稳定企望渐进改革"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0332.wav", "duration": 3.7539375, "text": "搭建混合云解决方案平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0399.wav", "duration": 4.047125, "text": "至于中国花滑运动的推广"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0486.wav", "duration": 11.1328125, "text": "实习生郭杨雪通讯员耿万志现代快报记者李伟豪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0400.wav", "duration": 4.834, "text": "从经济实力和基础设施建设上看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0249.wav", "duration": 3.86, "text": "完善环境事件应急机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0462.wav", "duration": 3.146, "text": "走进了武网的新闻大厅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0364.wav", "duration": 4.493875, "text": "朱婷荣膺最有价值球员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0308.wav", "duration": 5.511, "text": "在确保系统顺利运行的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0306.wav", "duration": 4.9670625, "text": "漏洞已通知厂商但厂商忽略该漏洞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0487.wav", "duration": 4.8920625, "text": "它既能搜集我国重要海域内各类环境数据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0337.wav", "duration": 3.0390625, "text": "在电话手表出现之前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0389.wav", "duration": 5.197, "text": "这批志愿者也被称为新鸟巢一代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0248.wav", "duration": 5.1800625, "text": "徐林出于对地方政府债务风险的担忧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0403.wav", "duration": 3.886, "text": "组委会提高了前三名的含金量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0341.wav", "duration": 5.724125, "text": "这也是他一次次在擂台上打出恐怖重击的最大资本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0416.wav", "duration": 4.6699375, "text": "她近日终于在受访时松口公开正解"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0357.wav", "duration": 7.298125, "text": "对于代表中国战队略先出阵的徐永昊来讲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0358.wav", "duration": 4.451875, "text": "从而被授予最有价值球员荣誉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0376.wav", "duration": 3.8100625, "text": "瞬间成为各国媒体的焦点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0411.wav", "duration": 6.5190625, "text": "搜狐娱乐据讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0228.wav", "duration": 5.396, "text": "并采取措施切实保护债券投资人的合法权益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0339.wav", "duration": 4.475125, "text": "但是根据国外科学家最新的研究结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0351.wav", "duration": 3.9350625, "text": "同时带动当地人民的奔跑热情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0290.wav", "duration": 4.25, "text": "随着个人计算机芯片的需求放慢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0435.wav", "duration": 3.9140625, "text": "有内地学者分析背后心态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0310.wav", "duration": 3.5460625, "text": "击掌成为加好友等功能也一应俱全"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0145.wav", "duration": 5.031, "text": "确保完成今年六万户棚户区改造任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0212.wav", "duration": 2.9559375, "text": "提高生产经营和市场开拓能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0252.wav", "duration": 7.5, "text": "国务院近期将开展对各类交易场所的清理整顿工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0186.wav", "duration": 3.937, "text": "在机遇与挑战共存的互联网时代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0466.wav", "duration": 3.8459375, "text": "现场流出的短片显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0358.wav", "duration": 6.774875, "text": "二零一一年的亚冬会是其举办的第一个国际性综合赛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0467.wav", "duration": 5.282, "text": "希望媒体不要用这样的词来形容所有网球运动员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0214.wav", "duration": 4.2990625, "text": "中央走出去的步伐正趋加快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0422.wav", "duration": 4.365, "text": "但小天坚持玮甯依然是我的女人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0314.wav", "duration": 6.2270625, "text": "身处传统白色家电领域中的重要一支到厨房电器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0159.wav", "duration": 4.09, "text": "五月份多地楼市的成交量明显上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0200.wav", "duration": 4.411, "text": "支持其开展信用合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0362.wav", "duration": 4.3520625, "text": "已在新加坡香港等城市成功落地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0165.wav", "duration": 3.103, "text": "大型房企低迷期拿地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0384.wav", "duration": 4.53, "text": "中国队连续三位主力因伤缺战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0328.wav", "duration": 6.2270625, "text": "所有在中国境内销售及使用的无线电组件产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0183.wav", "duration": 4.093, "text": "这是因为土地一级开发成本提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0403.wav", "duration": 3.9340625, "text": "朱婷的任务更重效率更高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0456.wav", "duration": 4.264875, "text": "肖先生在上菜后高兴地拍下图片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0425.wav", "duration": 3.4409375, "text": "现在有点怕要见他"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0488.wav", "duration": 4.802, "text": "参考消息网九月二五日报道新报称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0191.wav", "duration": 7.079, "text": "包括北方干旱半干旱草原地区和青藏高原草原地区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0421.wav", "duration": 2.8190625, "text": "似乎已过了第三关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0134.wav", "duration": 4.187, "text": "再加上近期一二线楼市升温"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0196.wav", "duration": 4.719, "text": "继续用好国外优惠贷款和赠款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0338.wav", "duration": 6.0610625, "text": "由郎平挂帅的中国女排在名古屋赛区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0485.wav", "duration": 3.162125, "text": "北京警方已介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0177.wav", "duration": 5.7169375, "text": "而出让的住宅建筑面积总和至少为一百亿平米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0456.wav", "duration": 5.1950625, "text": "是原中国文化集团党委书记宋官林"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0489.wav", "duration": 5.916, "text": "联合国官方微博晒出一张李彬彬喂大象喝水的照片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0185.wav", "duration": 4.616125, "text": "规划建筑面积为四十万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0482.wav", "duration": 4.9860625, "text": "李晨马震就是玩笑任何情况都力挺范冰冰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0442.wav", "duration": 6.3979375, "text": "成为各国各地广场舞今年最流行的背景音乐之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0245.wav", "duration": 5.475, "text": "因地制宜地采取有选择差别化扶持政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0275.wav", "duration": 3.271, "text": "以及在店内的具体位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0191.wav", "duration": 8.6109375, "text": "预算内固定资产投资要向重大农业农村建设项目倾斜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0346.wav", "duration": 5.668, "text": "我在重点强化站立技术的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0488.wav", "duration": 4.5400625, "text": "又能探测获取我海军舰队活动动向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0488.wav", "duration": 4.626, "text": "本报一零月五日讯国庆长假"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0296.wav", "duration": 3.448, "text": "问题焦点若是太阳能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0419.wav", "duration": 3.0, "text": "穿高跟鞋快步走"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0236.wav", "duration": 3.4460625, "text": "加大水生生物资源养护力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0193.wav", "duration": 6.4029375, "text": "导致城投债券发行产生较高的风险溢价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0472.wav", "duration": 4.948, "text": "视频中正在带彩娱乐的灰衣男"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0311.wav", "duration": 5.478, "text": "得出这个结论来自于方洪波对当前形势的判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0417.wav", "duration": 2.494875, "text": "推断其已怀孕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0122.wav", "duration": 8.333, "text": "其市管国管住房公积金政策也均进行调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0421.wav", "duration": 5.8088125, "text": "名为娱乐圈八卦的自然自媒体"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0492.wav", "duration": 8.3039375, "text": "村民为阻止儿子与女友相见编造偷小孩谎言"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0412.wav", "duration": 2.733875, "text": "他一定有他的原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0460.wav", "duration": 7.162875, "text": "朱军系阅兵世家曾参与一九八四年阅兵军乐演奏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0386.wav", "duration": 2.9560625, "text": "我们的朋友将代表德国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0380.wav", "duration": 4.6681875, "text": "难怪他能接受年过半百的桥本的索吻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0148.wav", "duration": 3.65, "text": "中原地产分析师张大伟认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0418.wav", "duration": 6.0290625, "text": "谢霆锋妹妹谢婷婷在微博晒出与父亲合影"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0385.wav", "duration": 2.6440625, "text": "据美联社十日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0153.wav", "duration": 3.418, "text": "对需求拉动作用比较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0301.wav", "duration": 8.347875, "text": "最终促使苹果成为主流标准但中国市场有其特殊性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0466.wav", "duration": 7.369875, "text": "网络上热传一组暖男医生哄小萝莉的温情照片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0194.wav", "duration": 6.831, "text": "使国有资本更多地向重要行业和关键领域集中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0237.wav", "duration": 3.4509375, "text": "才能申请发行城投债券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0336.wav", "duration": 7.5, "text": "这需要通过机器人的柔性改变来对此进行处理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0202.wav", "duration": 5.704, "text": "可是通过收费站的车有大客车中型客车还有货车"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0242.wav", "duration": 4.587, "text": "提升产品的科技含量和附加值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0210.wav", "duration": 4.861, "text": "落实和完善有关税收政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0136.wav", "duration": 7.3350625, "text": "昆明市住房公积金管理中心出台三项公积金新政"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0285.wav", "duration": 8.589, "text": "美国智库学学者和太阳能行业协会也多次警告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0244.wav", "duration": 5.474, "text": "大力发展冷链体系和生鲜农产品配送"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0465.wav", "duration": 3.5949375, "text": "发现小温残缺的遗骸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0476.wav", "duration": 4.046125, "text": "省吃俭用也要把该还的钱尽力还掉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0189.wav", "duration": 4.844, "text": "农业产业体系更趋完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0340.wav", "duration": 5.6430625, "text": "只要在明天的最后一战中赢下东道主日本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0277.wav", "duration": 3.256, "text": "对投资者大有参考价值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0227.wav", "duration": 3.2209375, "text": "国家林业十二五规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0228.wav", "duration": 2.827, "text": "动植物保护工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0418.wav", "duration": 3.525125, "text": "上厕所都要把灯全部打开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0427.wav", "duration": 3.3559375, "text": "她也坦言内心感触很多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0469.wav", "duration": 6.472875, "text": "李岚清座谈戏称自己八零后退休不等于生命终结"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0319.wav", "duration": 5.3628125, "text": "没有交付信息安全公司进行评估"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0474.wav", "duration": 6.3769375, "text": "新京报讯记者黄颖自七月六日进入暑期以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0286.wav", "duration": 3.7790625, "text": "我们成为世界工厂是不可逾越的发展阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0235.wav", "duration": 5.244, "text": "决定对全国核设施进行安全检查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0469.wav", "duration": 4.374, "text": "回国后经鉴定发现不是天纯天然的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0176.wav", "duration": 3.9389375, "text": "全国房地产库存正在堆积"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0470.wav", "duration": 6.745875, "text": "村支书一周只上二小时班村民称反映会遭报复"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0233.wav", "duration": 7.312, "text": "国务院高度重视防范地方政府债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0347.wav", "duration": 5.2119375, "text": "研究者们选取了一些年龄大的跑者作为研究对象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0494.wav", "duration": 2.8679375, "text": "该段视频时长仅有六秒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0182.wav", "duration": 3.1629375, "text": "中新网十月二十日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0352.wav", "duration": 4.727875, "text": "最终拦网和扣球均得到六这些分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0181.wav", "duration": 4.5650625, "text": "月度市场成交量开始出现环比回升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0482.wav", "duration": 5.183125, "text": "温州一菜场惊现注胶虾追踪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0279.wav", "duration": 4.8050625, "text": "也不愿意花五分钟重新输一定密码"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0124.wav", "duration": 7.5, "text": "上海南昌等城市近期继续松绑了公积金贷款政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0185.wav", "duration": 4.3089375, "text": "后续要加大公积金贷款的便利性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0341.wav", "duration": 5.7409375, "text": "这与市民的期望和城市发展的愿景也是一致的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0308.wav", "duration": 8.854, "text": "买卖前五名共计净出于该股六十二点九三万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0418.wav", "duration": 3.125, "text": "有时甚至忘记吃饭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0442.wav", "duration": 3.369875, "text": "他向广东省高院申诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0294.wav", "duration": 5.3530625, "text": "眼下已有七个国家打算购买大鸦无人机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0295.wav", "duration": 4.8239375, "text": "发表的想象图与最近曝光的飞机布局很像"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0256.wav", "duration": 5.0190625, "text": "因此不能表示苹果没有新的业务增长点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0287.wav", "duration": 3.6469375, "text": "囊括了大量的优质资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0192.wav", "duration": 6.6630625, "text": "债券市场所有品种发行利率整体上都表现出向上的走向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0446.wav", "duration": 3.2109375, "text": "超级月亮碰上月全食"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0431.wav", "duration": 7.1599375, "text": "公安局的决定书说不对他做出行政处罚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0402.wav", "duration": 4.167, "text": "由于韩国冰球协会的四年规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0259.wav", "duration": 7.798125, "text": "以二零一五年度每股八点五美元的盈利预测为准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0314.wav", "duration": 6.5, "text": "下称美的内部的组织架构二零一五年加大了调整力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0423.wav", "duration": 6.235125, "text": "许茹芸突然闪婚让当时的娱乐圈也惊起了一阵小波澜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0198.wav", "duration": 3.3260625, "text": "我个人不赞成这一判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0299.wav", "duration": 4.2050625, "text": "因为难以忍受股价长期被低估"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0216.wav", "duration": 5.813, "text": "规范降价打折返券赠送等促销行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0222.wav", "duration": 5.407, "text": "加强建设资金统筹和组织实施工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0230.wav", "duration": 3.6960625, "text": "积极发展菜篮子产品生产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0184.wav", "duration": 7.364, "text": "该地块位于通州新城五河交汇处东南角"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0228.wav", "duration": 4.418125, "text": "关键是要把投资规模和债务规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0242.wav", "duration": 5.5810625, "text": "各地机场高速公路是否实行免费通行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0174.wav", "duration": 4.941, "text": "百分之五的网友认为房价走势不好判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0318.wav", "duration": 6.2949375, "text": "很多车企网站是外包给第三方公司开发的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0204.wav", "duration": 4.079, "text": "强化农民专业合作社组织带动能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0142.wav", "duration": 4.729, "text": "今年商品房销售一度低日迷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0443.wav", "duration": 6.9079375, "text": "称当时几位学生模样的人让他帮忙配合拍照用来宣传"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0317.wav", "duration": 3.9921875, "text": "今年的促销从三月份就启动了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0375.wav", "duration": 6.1579375, "text": "这也是他一年四记来第一次参加世锦赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0331.wav", "duration": 5.822, "text": "其馀九人获刑一年五个月至三年不等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0422.wav", "duration": 2.53, "text": "医生说得好恐怖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0224.wav", "duration": 4.828, "text": "由于山东免费放行的时间不在春运最高峰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0385.wav", "duration": 3.9160625, "text": "大家可能觉得我们这支队伍很苦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0227.wav", "duration": 9.12, "text": "继续实施农业种子种苗种畜种禽免税进口优惠政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0327.wav", "duration": 4.235125, "text": "在被公安机关查获后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0291.wav", "duration": 4.6069375, "text": "该产品将延迟到二零一五年发布"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0364.wav", "duration": 6.715125, "text": "邀请专家学者等三十馀人组成志愿者培训导师库"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0313.wav", "duration": 4.501, "text": "过去三十年高速发展的前提条件没有了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0367.wav", "duration": 3.218, "text": "一分分和对手拼到最后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0407.wav", "duration": 5.0, "text": "这对她来说也是一个巨大的遗憾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0144.wav", "duration": 4.203, "text": "中介机构统计数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0154.wav", "duration": 4.2549375, "text": "且待售库存单套面积较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0177.wav", "duration": 5.4919375, "text": "这将有助于开发商明年维持销量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0473.wav", "duration": 4.4201875, "text": "本来云盘的出现方便了人们的生活和工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0363.wav", "duration": 7.4079375, "text": "普鲁申科将错过整个二零一五二零一六季一六赛季的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0161.wav", "duration": 4.2049375, "text": "达到降低成本提升营销效果的目的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0304.wav", "duration": 5.3818125, "text": "雪铁龙车主信息泄露规模或超十万条"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0303.wav", "duration": 6.1940625, "text": "每日经济新闻记者杨建江南嘉捷六万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0362.wav", "duration": 4.0909375, "text": "不过和这次在世界杯当队长相比压力明显不同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0430.wav", "duration": 6.6159375, "text": "曾获美国时代杂志形容为影响香港乐坛风格的人物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0442.wav", "duration": 8.025875, "text": "新京报讯记者王巍利用村里遭受泥石流灾害后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0422.wav", "duration": 3.062, "text": "这样做反而更实际"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0404.wav", "duration": 4.3891875, "text": "将出任玩具总动员四的导演"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0399.wav", "duration": 4.119875, "text": "比赛在两名王者最后的对决中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0435.wav", "duration": 5.3510625, "text": "准备将获救的四人送上岸边医院救治"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0453.wav", "duration": 6.005125, "text": "上海已成为全亚洲奢华生活最昂贵的城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0370.wav", "duration": 5.4960625, "text": "包括前秋运动员维斯多尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0405.wav", "duration": 2.9560625, "text": "将出演影片的女主角"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0399.wav", "duration": 5.791, "text": "新一轮激战烽火即将炽烈点燃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0346.wav", "duration": 2.6289375, "text": "对弹跳没有什么影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0372.wav", "duration": 4.764875, "text": "双方均向对手发起了不遗馀力的猛攻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0373.wav", "duration": 4.3759375, "text": "尽管期间孙杨的训练并没有中断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0325.wav", "duration": 4.0799375, "text": "跟世界产业的差距不是在缩小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0173.wav", "duration": 3.529, "text": "而在信托持有这些房产后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0150.wav", "duration": 6.315, "text": "用公积金政策刺激市场是地方政府最习惯的举措"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0157.wav", "duration": 7.37, "text": "但由于房地产市场供给仍然不仍然充足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0223.wav", "duration": 12.428, "text": "资源环境面临较大压力有的企业管理水平不高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0318.wav", "duration": 3.832, "text": "家长随时和孩子保持联系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0400.wav", "duration": 3.647, "text": "广州日报社记者许胚日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0458.wav", "duration": 3.7829375, "text": "当海滩上如潮的人群散去"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0409.wav", "duration": 3.8608125, "text": "有时候人生是计划赶不上变化的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0319.wav", "duration": 6.235125, "text": "这样一个全球白电的格局短期内是难以撬动的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0423.wav", "duration": 3.818125, "text": "是真的话他自己会同我讲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0270.wav", "duration": 4.0, "text": "安全真的是移动支付的第一属性吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0178.wav", "duration": 8.98, "text": "政府放松政策对房地产销售的正面影响可能会提升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0225.wav", "duration": 9.3930625, "text": "大幅度增加农业防灾减灾稳产增产关键技术良法补助"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0451.wav", "duration": 3.1799375, "text": "成为了网民争相讨论的话题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0224.wav", "duration": 4.6850625, "text": "充分发挥地方政府融资平台作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0190.wav", "duration": 5.8769375, "text": "土地产出率劳动生产率资源利用率显着提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0431.wav", "duration": 3.001, "text": "图自网络温州网讯有网友爆料"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0476.wav", "duration": 11.1809375, "text": "村民为多拿补偿在拆迁前突击装修全用劣质建材"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0485.wav", "duration": 4.411875, "text": "双方因语言交流不畅导致纠纷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0175.wav", "duration": 5.11, "text": "也有利于部分企业的资金周转"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0209.wav", "duration": 6.1430625, "text": "这是这几年城投债券发行规模不断扩大的主要原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0168.wav", "duration": 3.8290625, "text": "促使更多购房者积极入市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0407.wav", "duration": 6.77, "text": "将在本届美国电影学会影展中进行秘密放映"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0218.wav", "duration": 6.8709375, "text": "城市公共交通规划要科学布局线线网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0203.wav", "duration": 3.2850625, "text": "扩大农村担保品范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0214.wav", "duration": 7.022125, "text": "推进省直接管理县市财政体制改革"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0277.wav", "duration": 4.3570625, "text": "有一百万张信用卡已被激活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0172.wav", "duration": 4.9239375, "text": "库存去化周期依然偏大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0395.wav", "duration": 4.137, "text": "他们最大的特点就是九零后占主角"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0124.wav", "duration": 4.667, "text": "为双拱形非中心对称建筑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0221.wav", "duration": 3.437, "text": "增加农田有效灌溉面积"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0166.wav", "duration": 8.453, "text": "房地产在不同城市之间的复苏也将存在分化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0390.wav", "duration": 3.527875, "text": "铅球达维斯多尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0176.wav", "duration": 6.15, "text": "在整体市场供大于求区域分化严重的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0213.wav", "duration": 5.0739375, "text": "必须树立公共交通优先发展理念"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0202.wav", "duration": 11.6159375, "text": "转化成由资产产生的现金流作担保可自由流通的证券"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0474.wav", "duration": 8.313, "text": "门头沟雁翅镇村民李冬梅向市政府提起了行政复议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0257.wav", "duration": 7.5229375, "text": "那么苹果市价约为七四四十亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0356.wav", "duration": 3.3110625, "text": "普鲁申科出人意料地宣布复出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0324.wav", "duration": 6.703875, "text": "盘中有二千六百八十六万元资金净流入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0364.wav", "duration": 6.816875, "text": "一方面是他们从事花样滑冰二零多年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0271.wav", "duration": 3.568, "text": "而是实实在在的金融命脉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0141.wav", "duration": 4.328, "text": "还有一个违规扩区一万公顷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0435.wav", "duration": 6.7788125, "text": "清华法学院教授司法改革应限制两长权力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0398.wav", "duration": 4.711875, "text": "尤为引人瞩目的莫过于李子成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0432.wav", "duration": 4.579125, "text": "向乘客收取的船费属于应收项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0359.wav", "duration": 6.2739375, "text": "宣告彭博一英里接力赛上海站全面启动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0150.wav", "duration": 7.103, "text": "我国对房地产的行政干预政策陆续退出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0126.wav", "duration": 7.149, "text": "上海南昌等城市近期继续松绑了公积金贷款政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0291.wav", "duration": 4.4200625, "text": "这对于苹果来说不是件容易的事儿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0228.wav", "duration": 4.735, "text": "建立完善农业生产奖补制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0191.wav", "duration": 7.3990625, "text": "需要对发行人资产重组等重大事宜加强监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0161.wav", "duration": 4.1430625, "text": "呈现出量价齐涨的局面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0288.wav", "duration": 5.401, "text": "美初裁中国产轮胎倾销"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0456.wav", "duration": 4.9189375, "text": "李娜媒体用一次性参赛是对运动员的侮辱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0187.wav", "duration": 7.812, "text": "将明确政策界限和工作机制以知以及部门分工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0363.wav", "duration": 4.777125, "text": "她所选择的新搭档就是法国猛男马塞洛特"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0227.wav", "duration": 3.7119375, "text": "确保境外国有资产保值增值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0224.wav", "duration": 2.927, "text": "不可能是完全无风险的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0187.wav", "duration": 2.701, "text": "加强农产品质量安全监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0459.wav", "duration": 5.277125, "text": "金报讯记者蓝莹还记得小温吗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0158.wav", "duration": 3.0, "text": "自二夏季开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0223.wav", "duration": 6.897125, "text": "以及蔬菜蚕卓等农产品生产的主体区域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0466.wav", "duration": 5.4980625, "text": "手腕上还戴着一块与之呼应的白色塑料腕表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0179.wav", "duration": 7.9249375, "text": "国务院发展研究中心市场经济研究所副所长邓郁松认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0245.wav", "duration": 3.468, "text": "建立秸秆禁烧和综合利用的长效机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0387.wav", "duration": 5.906, "text": "佟健的解决办法就只能努力提高自己"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0402.wav", "duration": 6.491, "text": "中国队在第二阶段的第三场比赛不仅要保全取九个积分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0311.wav", "duration": 3.875, "text": "紫光与沈阳机床可以在此布局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0382.wav", "duration": 4.7150625, "text": "也让这位一九九四年出生的河南妹子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0216.wav", "duration": 2.803, "text": "都起到了积极的作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0130.wav", "duration": 7.605, "text": "取消限外令将促进外企在华投资房地产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0333.wav", "duration": 5.1010625, "text": "美的的洗碗机业务以外销为主"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0159.wav", "duration": 4.563, "text": "今年土地收入预计近四万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0239.wav", "duration": 3.2939375, "text": "进行了综合安全检查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0231.wav", "duration": 2.957, "text": "率先实现区域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0239.wav", "duration": 4.2949375, "text": "探索企业化集团化发展模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0280.wav", "duration": 5.5450625, "text": "失望中夹杂着嘲讽的情绪霸占了各模块的头条"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0223.wav", "duration": 4.8840625, "text": "完善机耕道农田防护林等设施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0328.wav", "duration": 4.3520625, "text": "警方在麦德公司数据库中发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0238.wav", "duration": 5.2830625, "text": "乡镇农业公共服务能力建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0295.wav", "duration": 4.277, "text": "就开始潜移默化地渗透人类的生活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0235.wav", "duration": 5.521, "text": "加快农业科技自主创新和农业农村人才培养"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0397.wav", "duration": 3.9489375, "text": "湖区水污染仍旧十分严重"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0266.wav", "duration": 2.8759375, "text": "他从来没有写过代码"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0159.wav", "duration": 4.33, "text": "也有限购政策在控制需求规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0252.wav", "duration": 6.3299375, "text": "但出于对我国地方政府债务风险的不合理判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0122.wav", "duration": 4.65, "text": "作为取之于民用之于民的住房公积金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0462.wav", "duration": 9.74, "text": "曲靖一村妇竟在自家菜地内非法种植罂丽一零四二株"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0235.wav", "duration": 5.943, "text": "工商银行建设银行和交通银行为首批试点银行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0473.wav", "duration": 7.1811875, "text": "渤海一渔船沉没船上一六人落水一二人失踪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0355.wav", "duration": 3.9091875, "text": "经过将近一年时间的漫长谈判"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0283.wav", "duration": 3.032, "text": "而从二零一三年开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0482.wav", "duration": 8.6789375, "text": "湖北一九岁女护士深夜遭抢劫杀害嫌疑嫌犯已落网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0208.wav", "duration": 6.1079375, "text": "以实施现代农业人才支撑计划为抓手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0148.wav", "duration": 4.761, "text": "北京去年土地出让落下大幕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0195.wav", "duration": 4.021, "text": "加强草原生态环境保护和建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0301.wav", "duration": 3.937, "text": "价格要么下降要么维持不变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0405.wav", "duration": 4.722875, "text": "影片的正式公映要到圣诞节当天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0171.wav", "duration": 3.581, "text": "这产品的换代周期会较长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0266.wav", "duration": 8.0, "text": "从而影响接下来的客户无法在指定时间点获得服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0260.wav", "duration": 3.7370625, "text": "但亏损却达到了一点八亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0210.wav", "duration": 3.374, "text": "大力发展农业职业培养"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0434.wav", "duration": 5.8410625, "text": "湖北六岁女童被继母虐打下阴撕裂警方已介入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0133.wav", "duration": 6.877, "text": "是对过去住房公积金制度不作为方式的纠正"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0356.wav", "duration": 4.73, "text": "也证明了北京举办大型体育赛事的能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0455.wav", "duration": 7.3530625, "text": "游客青岛遭遇天价虾当地人最多几十元一斤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0375.wav", "duration": 3.833, "text": "男伴更是在最新公布的视频中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0321.wav", "duration": 2.802, "text": "大盘股仍是毫无作为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0160.wav", "duration": 3.861, "text": "然后对广告信息进行精确匹配"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0169.wav", "duration": 7.4659375, "text": "中国房地产的市场价格和销量将继续调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0465.wav", "duration": 3.8559375, "text": "中国传媒大学官网发布消息称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0282.wav", "duration": 5.094, "text": "称有些技术公司烧钱太快可能会人间蒸发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0126.wav", "duration": 4.8890625, "text": "在住房公积金贷款的申请过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0464.wav", "duration": 4.640125, "text": "最终在峡谷上游的石头夹缝下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0454.wav", "duration": 4.719, "text": "天上掉下一块重约十几斤的冰块"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0433.wav", "duration": 9.6120625, "text": "香港明报参考消息网八月二十九日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0203.wav", "duration": 4.026, "text": "我国还处于城市化快速发展期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0383.wav", "duration": 3.8628125, "text": "谁也不知道会发生什么"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0476.wav", "duration": 3.8139375, "text": "因准儿媳的举报跌下神坛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0416.wav", "duration": 3.5, "text": "处于寻找状态中的挣扎"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0428.wav", "duration": 5.6950625, "text": "对此陈凯琳没有怪责陈嘉宝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0190.wav", "duration": 3.594, "text": "省交通部门表示应该不会特殊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0310.wav", "duration": 5.224, "text": "占公司总股本约二点百分之五十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0440.wav", "duration": 4.078125, "text": "清华大学通过调取监控录线发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0257.wav", "duration": 9.2619375, "text": "印度斯坦时报对二十四日援引消息人士的话报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0349.wav", "duration": 3.865, "text": "背伤更是常年阻碍着他的发挥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0180.wav", "duration": 2.384, "text": "去年新政以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0320.wav", "duration": 4.2521875, "text": "可见电话手表的辐射比手机还小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0484.wav", "duration": 8.793, "text": "渤海湾溢油事故赔偿案宣判康菲公司被判赔一六八万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0452.wav", "duration": 6.522, "text": "游乐场大章鱼甩飞游客母亲落地时紧抱儿子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0437.wav", "duration": 4.6691875, "text": "六名内地乘客与地勤发生肢体冲突"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0347.wav", "duration": 5.5439375, "text": "其馀场馆改扩建后可以满足赛事需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0429.wav", "duration": 3.0500625, "text": "被网友调侃是小笼包"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0427.wav", "duration": 7.0771875, "text": "中新网七月二十二日电据台湾东森新闻消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0381.wav", "duration": 2.9458125, "text": "更具历史性意义的是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0306.wav", "duration": 5.786, "text": "自二零一一年事业部启动自动化升级至今的四年里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0385.wav", "duration": 3.438, "text": "争取把自身水平发挥出来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0409.wav", "duration": 2.7060625, "text": "马甲线啊马甲线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0365.wav", "duration": 5.245125, "text": "大家回去之后将马上投入到对日本的准备中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0147.wav", "duration": 3.7, "text": "软件与硬件都做了深度的对接"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0161.wav", "duration": 2.586, "text": "同比上涨五成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0434.wav", "duration": 3.782, "text": "因此与清洁工引发争执"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0243.wav", "duration": 5.1389375, "text": "鼓励流通企业跨地区兼并重组和投资合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0329.wav", "duration": 5.84275, "text": "涉及人才软件硬件服务以及管理等方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0227.wav", "duration": 2.922, "text": "上交税金一万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0197.wav", "duration": 5.421, "text": "而是改按统一合理的平均成本确定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0392.wav", "duration": 3.048125, "text": "在目前中国队的阵容中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0131.wav", "duration": 6.2209375, "text": "但专家预计短期央行仍可能会积极维稳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0293.wav", "duration": 3.329, "text": "苹果股价的这轮连续下跌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0139.wav", "duration": 3.887, "text": "住房维修资金约七亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0150.wav", "duration": 4.576, "text": "大数据营销需要的是强大的技术实力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0380.wav", "duration": 6.8630625, "text": "会投资建设一些冰雪主题乐园和冬季项目体验场所"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0242.wav", "duration": 6.5499375, "text": "为了控制地方政府本届发债下届还钱的道德风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0243.wav", "duration": 9.4390625, "text": "实行线网规划编制公示制度和运营价格听证制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0288.wav", "duration": 4.7750625, "text": "就足以让专家们恶心七七四十九天了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0182.wav", "duration": 3.438, "text": "中新网的调查结果显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0145.wav", "duration": 3.556, "text": "实现该信托对房产的控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0444.wav", "duration": 4.4858125, "text": "园中园收费超景区大门票"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0341.wav", "duration": 2.756, "text": "参赛队伍数量也会有所提升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0392.wav", "duration": 5.295875, "text": "自己此时此刻特别迫切地想要尽快恢复"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0491.wav", "duration": 6.76, "text": "李玉刚新歌点击逾一亿网友李家每人只需半次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0348.wav", "duration": 4.223125, "text": "建设三个相对集聚的场馆群"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0443.wav", "duration": 4.784875, "text": "一糕点店派出二零位面包师傅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0319.wav", "duration": 4.5710625, "text": "与互联网企业深度合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0179.wav", "duration": 5.172, "text": "标普信用分析师孔磊说道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0387.wav", "duration": 8.3469375, "text": "本赛季调进张常宁就是郎平为朱婷解压的一个表现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0204.wav", "duration": 3.462, "text": "在国务院下发的文件中提及"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0351.wav", "duration": 3.8569375, "text": "而哈亚的表现也正如其自己所言"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0485.wav", "duration": 4.885, "text": "灵璧县韦集镇韦集村原村支书石某"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0442.wav", "duration": 2.999, "text": "而且她还是已婚身份"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0331.wav", "duration": 3.553, "text": "并将成为新兴的销售热点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0443.wav", "duration": 6.3139375, "text": "广东惠州惊爆港商杀情妇碎尸凶案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0220.wav", "duration": 10.0, "text": "城投债劵作为融资平台公司最透明的直接融资工具"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0241.wav", "duration": 5.392, "text": "集中整治存在突出环境问题的村庄和集镇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0350.wav", "duration": 3.410875, "text": "二零一五年四月十二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0181.wav", "duration": 3.935, "text": "这一刺激作用并不会长时间延续"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0353.wav", "duration": 5.021, "text": "过上了比运动员复杂得多的生活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0171.wav", "duration": 6.3890625, "text": "政府出台每平方米补贴五百元的托市政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0348.wav", "duration": 6.772, "text": "总体上以节俭办赛为原则进行规划建设和改造使用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0493.wav", "duration": 5.8139375, "text": "游客北京游两天遭引导消费近二万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0438.wav", "duration": 5.7431875, "text": "清华辟谣保安迫降无人机为人为诋毁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0408.wav", "duration": 3.0600625, "text": "看来郑嘉颖是她的初恋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0164.wav", "duration": 3.332, "text": "今年楼市将走向何方"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0478.wav", "duration": 6.933125, "text": "在中国某个在线医疗平台增设一项新服务之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0203.wav", "duration": 3.051, "text": "到时候会不会乱成一锅粥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0356.wav", "duration": 3.8041875, "text": "法国花样滑冰联合会终于同意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0146.wav", "duration": 4.8709375, "text": "整合营销是利用全案思维和大数据技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0312.wav", "duration": 5.0, "text": "一位买家电的朋友晒出一张销量清单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0204.wav", "duration": 3.625, "text": "大规模开展高产创建"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0247.wav", "duration": 3.927, "text": "坚决防止污染向农村转移"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0149.wav", "duration": 4.401, "text": "一向严格收紧购房政策的北京也加入此阵营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0313.wav", "duration": 3.615, "text": "但到将来互联网时代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0254.wav", "duration": 3.688, "text": "无疑也会成为投资者的宠儿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0301.wav", "duration": 4.4250625, "text": "这意味着美国将对相关产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0415.wav", "duration": 5.589125, "text": "搜狐娱乐讯名为娱乐圈八卦的自媒体"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0494.wav", "duration": 3.292, "text": "并将其摁倒在地殴打"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0135.wav", "duration": 4.272, "text": "开工建设公租房不低于三万套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0340.wav", "duration": 4.3670625, "text": "控制在六零微克立方米左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0225.wav", "duration": 5.9759375, "text": "凡依法应当进行环评的建设规划和项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0274.wav", "duration": 7.8039375, "text": "今年股价已经累计下跌了百分之六十而三星的情况也不佳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0194.wav", "duration": 7.151, "text": "但没有出现大范围趋势性的破产倒闭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0206.wav", "duration": 4.9189375, "text": "城投债券也适应了发行人和投资人的需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0172.wav", "duration": 4.0479375, "text": "首套房贷利润优惠也开始减少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0309.wav", "duration": 7.9030625, "text": "大家可能因为国家政策扶持国产品牌的大势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0126.wav", "duration": 4.92, "text": "导致公积金资源闲置的问题出现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0390.wav", "duration": 5.4958125, "text": "这支女排的暴露性强攻基本上都是靠朱婷打"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0390.wav", "duration": 4.823, "text": "佟健做好了考不上的思想准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0494.wav", "duration": 4.767125, "text": "如果对一般登高赏月仍未满足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0176.wav", "duration": 6.044, "text": "收购了房地产互联网营销公司沈阳新维一半股份"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0423.wav", "duration": 4.265125, "text": "新专辑音乐方面还是坚持做自己"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0363.wav", "duration": 4.6269375, "text": "但是研究对象都是年轻跑者和年老跑者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0232.wav", "duration": 6.2380625, "text": "发改委将订制战略避免境外投资恶性竞争到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0244.wav", "duration": 8.464, "text": "主要指沿海地区以外的直辖市省会城市等大城市郊区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0219.wav", "duration": 7.918, "text": "相当于过去体制而言是更加市场化的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0164.wav", "duration": 3.389, "text": "房地产市场竞争加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0272.wav", "duration": 3.624, "text": "这样的规模没有任何一个国家可以比拟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0192.wav", "duration": 5.552, "text": "主要农产品优势区基本实行农业现代化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0408.wav", "duration": 3.5459375, "text": "但上台祝酒时都会交足戏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0467.wav", "duration": 3.178, "text": "二零一五七二六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0133.wav", "duration": 8.0, "text": "继续限制外资投资中国房地产已经不合时宜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0299.wav", "duration": 4.3469375, "text": "它已经失去了作为独立公司的存在意义"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0128.wav", "duration": 5.155, "text": "还降低了首套房公积金首付比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0195.wav", "duration": 6.421, "text": "城投债券对推动城市基础设施和市政设施的建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0332.wav", "duration": 3.146, "text": "所以对业绩的影响有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0185.wav", "duration": 5.6169375, "text": "面对楼市中急剧增长的投资热情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0182.wav", "duration": 4.0019375, "text": "作为取之于民用之于民的住房公积金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0308.wav", "duration": 2.4559375, "text": "做到全方位亲子沟通"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0288.wav", "duration": 4.891, "text": "高空飞航时战略无人机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0160.wav", "duration": 3.453, "text": "房价下跌压力趋于缓解"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0166.wav", "duration": 4.528, "text": "看中的是其财产保护与传承的功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0368.wav", "duration": 5.901125, "text": "朴泰桓无法加入海外先进的训练团队进行训练"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0330.wav", "duration": 4.552, "text": "互联网企业也是一步步投入不断完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0478.wav", "duration": 4.7670625, "text": "李开复被医生宣判为第四期淋巴癌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0179.wav", "duration": 4.4490625, "text": "现在公积金贷款办理需要一个月左右的时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0263.wav", "duration": 4.969, "text": "这项技术离临床应用还有一段距离"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0217.wav", "duration": 4.3780625, "text": "坚持和完善农业补贴政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0476.wav", "duration": 3.993875, "text": "用右脚踢向董某左腹部"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0309.wav", "duration": 4.043, "text": "但还是引发业内广泛关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0231.wav", "duration": 7.9959375, "text": "加强蔬菜水果肉蛋奶水产品等产品优势产区建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0138.wav", "duration": 5.237, "text": "有一套住房并已结清公积金贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0154.wav", "duration": 5.003, "text": "张大伟向南都记者分析"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0408.wav", "duration": 4.4409375, "text": "那些年女神陈妍希近来瘦身有成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0169.wav", "duration": 4.532, "text": "这直接影响到房地产的买地情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0213.wav", "duration": 4.407, "text": "城投债券的发行有比较严格的条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0130.wav", "duration": 4.224, "text": "开创了蔓延全国的青年社区概念"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0240.wav", "duration": 8.1390625, "text": "形成了新形势下我国核电发展的建议阶段研究报告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0325.wav", "duration": 6.8100625, "text": "公司为此研发并推出市场的智能产品非常贴近市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0421.wav", "duration": 3.0510625, "text": "迎来了人生崭新阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0469.wav", "duration": 4.03325, "text": "生活经验让郑女士起了疑心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0184.wav", "duration": 3.661, "text": "不是一般的企业个人玩得起的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0197.wav", "duration": 6.344, "text": "支持现代农业发展的物质基础更加牢固"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0230.wav", "duration": 5.7370625, "text": "并采取措施切实保护债券投资人的合法权益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0269.wav", "duration": 2.977875, "text": "沃兹尼亚克自己也说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0286.wav", "duration": 9.0240625, "text": "许多美国太阳太阳能制造商依赖于全球光伏供应链"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0137.wav", "duration": 4.146, "text": "有助于发挥内需在稳增长中的积极作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0418.wav", "duration": 6.396, "text": "谈及此前她曾到横店探班郑嘉颖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0325.wav", "duration": 6.991, "text": "拟在二零一五年二零一七年先行推出两期回购方案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0468.wav", "duration": 7.370125, "text": "湖北荆州市安良百货公司事发手扶电梯已被关闭检修"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0299.wav", "duration": 5.28, "text": "该技术可用于识别隐藏于伪装下的目标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0374.wav", "duration": 3.7749375, "text": "高调参加同性恋者的年度盛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0245.wav", "duration": 7.5810625, "text": "采取积极有效的措施化解部分地区和领域的债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0381.wav", "duration": 5.2900625, "text": "他们的造型由排球的五个经典动作组成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0450.wav", "duration": 6.522, "text": "李谷一曾怒揭东方歌舞团腐败事后被调离岗位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0319.wav", "duration": 7.141125, "text": "同案被捕的马某等四人是公司技术部门的员工"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0238.wav", "duration": 5.2789375, "text": "为商业银行探索跨业经营运作积累经验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0134.wav", "duration": 5.397, "text": "降准降息或再掀收益率的下降潮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0127.wav", "duration": 3.25, "text": "这不是这个时代的不公平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0442.wav", "duration": 6.9709375, "text": "渝武高速武胜段发生追尾事故已造成六死九伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0191.wav", "duration": 7.3299375, "text": "可按作价出资入股方式办理理用地手续"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0187.wav", "duration": 4.391, "text": "抓紧做好故调查处理工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0122.wav", "duration": 4.299, "text": "人民币未来贬值压力依然较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0400.wav", "duration": 2.900875, "text": "但更多的是看到了自己的不足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0275.wav", "duration": 2.6450625, "text": "我国经济发展进入新常态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0143.wav", "duration": 3.723, "text": "中小户型住房去化速度明显加快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0164.wav", "duration": 3.643, "text": "楼市进展仍需进一步观望"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0314.wav", "duration": 4.8569375, "text": "背后涉及到百万车主的信息安全"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0162.wav", "duration": 5.185, "text": "对收益率的要求差别却不至于相去甚远"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0194.wav", "duration": 4.658, "text": "启动实施农业产业化经营跨越发展行动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0189.wav", "duration": 3.707875, "text": "不仅是城投债券发行利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0206.wav", "duration": 4.479, "text": "加大合作社经营管理人员培训培养力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0131.wav", "duration": 4.596, "text": "中原地产首席分析师张大伟认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0175.wav", "duration": 5.423, "text": "北京中原地产首席分析师张大伟认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0223.wav", "duration": 6.847, "text": "完善农作物品种试验和种子检测设施条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0376.wav", "duration": 7.1049375, "text": "浑身是血的播求由于头部三处动脉破裂失血过多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0142.wav", "duration": 3.55, "text": "明年预计达到七万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0385.wav", "duration": 3.3100625, "text": "暂时不考虑恋爱的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0376.wav", "duration": 3.1740625, "text": "他们的不放弃换来了成功"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0489.wav", "duration": 4.0959375, "text": "实现近距离侦查和情报收集任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0411.wav", "duration": 2.275875, "text": "他是一个大人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0252.wav", "duration": 7.4659375, "text": "对限制类项目的核准和审核要从严把握"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0440.wav", "duration": 6.803, "text": "湖北九岁女童遇害案告破凶手强奸不成推下窗外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0382.wav", "duration": 4.9140625, "text": "观赛便利不出国门看奥运"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0457.wav", "duration": 3.828875, "text": "八位村民先后出现中毒症状"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0395.wav", "duration": 3.0920625, "text": "搜狐体育郭健文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0211.wav", "duration": 3.311, "text": "加快技能型人才培养"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0175.wav", "duration": 3.971, "text": "昨日人民币汇率小幅走弱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0209.wav", "duration": 4.5130625, "text": "采取必要措施加强政府债务管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0178.wav", "duration": 3.789, "text": "而非在三四线城市深耕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0242.wav", "duration": 3.8360625, "text": "升级改造农产品批发市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0291.wav", "duration": 6.87, "text": "又一款个性十足的双机身气动外形的大型无人机神雕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0276.wav", "duration": 4.3619375, "text": "疯狂估值局限于私有公司内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0335.wav", "duration": 5.886, "text": "非法获取用户身份认证信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0469.wav", "duration": 3.0610625, "text": "用户不需要把它带在身上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0224.wav", "duration": 3.501, "text": "健全公益性农业技术推广服务体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0431.wav", "duration": 4.994875, "text": "执法人员将王靖苏押解回温州"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0231.wav", "duration": 3.557, "text": "大力发展节水增效农业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0165.wav", "duration": 2.679, "text": "伟嘉安捷提供数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0382.wav", "duration": 6.593, "text": "这是中国奥运代表团在冬季奥运会上取得的首枚金牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0480.wav", "duration": 7.0170625, "text": "湖北一中学班长失踪坠亡教学楼四小时去向成谜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0339.wav", "duration": 5.963, "text": "高清女排力擒俄罗斯夺冠占主动众将喜极而泣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0437.wav", "duration": 5.4301875, "text": "出事的渔船被拖到韩榆石桥海边"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0399.wav", "duration": 6.1599375, "text": "他更是以三十分十七秒一举夺得奔跑中国三连冠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0415.wav", "duration": 10.0810625, "text": "相约家人到谢霆锋家中上演十二道锋味私房菜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0433.wav", "duration": 3.922875, "text": "昨天上午七点五零分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0135.wav", "duration": 4.5710625, "text": "增速比三月回落六个百分点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0432.wav", "duration": 3.4091875, "text": "二零一三一二二六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0260.wav", "duration": 2.657, "text": "特别是企业自主创新方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0133.wav", "duration": 7.5850625, "text": "兰州房地产市场回暖销量增加价格微涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0457.wav", "duration": 7.816875, "text": "七名犯罪嫌疑人因涉嫌非法经营罪被批准逮捕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0189.wav", "duration": 5.076, "text": "并重新编报海洋环境影响报告书"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0328.wav", "duration": 5.6649375, "text": "回购期限为股东大会通过后不超过十二个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0456.wav", "duration": 4.8090625, "text": "一对男女骑电动车在通过一个十字路口时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0448.wav", "duration": 4.475125, "text": "本月下旬天宇将现五星连线奇观"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0353.wav", "duration": 3.225125, "text": "北京时间七月二十八日晚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0434.wav", "duration": 6.4140625, "text": "温州沙城街道一民房今晨发生火灾已造成四人死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0392.wav", "duration": 3.5908125, "text": "也存在高危病毒危险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0461.wav", "duration": 2.901125, "text": "一辆宝马和一辆奔驰四次相撞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0306.wav", "duration": 6.3930625, "text": "公司拟计划通过集中竞价交易方式回购公司股份"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0135.wav", "duration": 5.3769375, "text": "江苏省对省级机关住房公积金政策做出了调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0478.wav", "duration": 6.448, "text": "近日在违法事实认识清楚法律法规适用明确的基础上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0171.wav", "duration": 5.859, "text": "开发商只需选择继续降价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0305.wav", "duration": 5.2049375, "text": "去年同期则是亏损二百四十二万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0287.wav", "duration": 7.1369375, "text": "因为春季的计算方式是从三月二十日到六月三十日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0206.wav", "duration": 8.3060625, "text": "对中小企业发行债务融资工具提供绿色通道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0495.wav", "duration": 3.479, "text": "警方证实周云露遇害"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0276.wav", "duration": 5.7679375, "text": "商务部裁定切销或补贴幅度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0480.wav", "duration": 9.661125, "text": "以高收入低风险和免缴税等好处利诱对方成为水货客"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0196.wav", "duration": 6.739, "text": "对考务费实行统一标准化管理后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0420.wav", "duration": 2.5190625, "text": "才有时间去探班"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0445.wav", "duration": 3.6330625, "text": "事故电梯仍处于拆解状态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0159.wav", "duration": 3.5559375, "text": "帮助广告主找出目标用户"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0283.wav", "duration": 3.8050625, "text": "据新华社电印度官员透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0424.wav", "duration": 3.7998125, "text": "想不想他再次成家立室"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0289.wav", "duration": 4.735125, "text": "如何说服四大银行一起与之愉快合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0342.wav", "duration": 5.1630625, "text": "我希望能通过这次田径世锦赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0348.wav", "duration": 5.5, "text": "主办方试图记录每一个跑友挥洒激情的每一个瞬间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0313.wav", "duration": 3.880875, "text": "使用户在刷机过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0201.wav", "duration": 5.7640625, "text": "组织了第一批七个地区城市开展三网融合试点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0153.wav", "duration": 4.998, "text": "并利好一二线城市的中高端住宅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0394.wav", "duration": 5.603, "text": "总共有二千七百六十人来为这项大赛志愿服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0328.wav", "duration": 3.057, "text": "这种说法到底有无科学依据呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0293.wav", "duration": 4.5, "text": "国内移动支付需主要有两股力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0143.wav", "duration": 4.624, "text": "整治资金被挤占挪用等一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0137.wav", "duration": 5.457, "text": "一些楼盘新房价格出现微涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0200.wav", "duration": 3.717875, "text": "对于中小企业的支持政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0489.wav", "duration": 2.859875, "text": "演员这个职业就是这样"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0267.wav", "duration": 4.5130625, "text": "也没有参与过任何产品的原始设计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0350.wav", "duration": 6.370875, "text": "四乘一百米接力亚历山大布尔格哈德特"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0421.wav", "duration": 2.624, "text": "两人都是依赖电话沟通"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0310.wav", "duration": 3.616, "text": "在体积能耗上存在一定的不足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0349.wav", "duration": 2.8679375, "text": "他们的步频大致相同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0462.wav", "duration": 6.399875, "text": "晨报记者张佳琪晨报讯昨晚九时三零分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0440.wav", "duration": 7.24, "text": "自从中国内地的第一家网上药店一零年前开张以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0375.wav", "duration": 6.114, "text": "有可靠消息称高桥很可能在近期正式宣布出柜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0192.wav", "duration": 3.0699375, "text": "城投债券收益率上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0242.wav", "duration": 3.9239375, "text": "据国家发改委网站消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0395.wav", "duration": 4.9931875, "text": "而且多次参加过业馀排球比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0219.wav", "duration": 13.927, "text": "健全农作物种质资源和畜禽遗传资源保存体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0124.wav", "duration": 3.656, "text": "国家统计局公布的数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0134.wav", "duration": 4.282, "text": "利用公积金可以减少租赁者负担"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0163.wav", "duration": 3.601, "text": "超过五月七千套的水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0460.wav", "duration": 3.880125, "text": "目前当地警方正在追查这名司机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0409.wav", "duration": 2.598125, "text": "更有一手好厨艺"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0325.wav", "duration": 2.8298125, "text": "主营信息电子和环保"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0461.wav", "duration": 6.7170625, "text": "参考消息网七月二九日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0332.wav", "duration": 8.1609375, "text": "业内对其做法的解读是先凭着低价杀入市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0195.wav", "duration": 4.7480625, "text": "建立地方政府债务管理体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0418.wav", "duration": 3.4770625, "text": "但陈妍希在出席活动时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0280.wav", "duration": 10.0030625, "text": "再次对中国光伏产品发起双反调查并试图征收高额关税"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0143.wav", "duration": 4.903, "text": "目前公积金政策已经与去年等同了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0128.wav", "duration": 4.135, "text": "广州和深圳分别为五万元和七万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0322.wav", "duration": 3.9709375, "text": "研发投入是一个刚性指标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0341.wav", "duration": 4.63, "text": "亲身感受沈阳当地浓郁的民俗文化内蕴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0219.wav", "duration": 7.645, "text": "各有关部门和地方各级人民政府要围绕规划目标任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0177.wav", "duration": 6.0, "text": "国务院总理李克强在二政府工作报告中表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0407.wav", "duration": 5.349125, "text": "将自导自演一部名为睡魔的科幻大片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0185.wav", "duration": 3.823, "text": "北京等城市在土地出让中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0277.wav", "duration": 2.657, "text": "还包括迈向中高端水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0191.wav", "duration": 6.523, "text": "引导企业围绕重点国家和地区在重点领域展开投资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0147.wav", "duration": 3.6259375, "text": "据伟嘉安捷提供的数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0129.wav", "duration": 3.1340625, "text": "在近期房价持续回升的背景下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0226.wav", "duration": 5.15, "text": "中央企业实现营业总收入十六点八亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0138.wav", "duration": 4.552, "text": "推行标准化装配式装修"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0157.wav", "duration": 2.955, "text": "广泛应用于移动端"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0238.wav", "duration": 3.3200625, "text": "提高流通组织化程度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0153.wav", "duration": 3.283, "text": "据伟嘉安捷提供的数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0422.wav", "duration": 2.469, "text": "没想竟然惨败"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0151.wav", "duration": 3.661, "text": "而非某些功能的简单嫁接"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0409.wav", "duration": 4.02, "text": "搜狐娱乐讯七月十五日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0441.wav", "duration": 4.7951875, "text": "前往温州龙湾万达广场游玩的市民"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0254.wav", "duration": 6.3830625, "text": "甚至还不如原来的一点零版本系统好用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0323.wav", "duration": 3.49, "text": "成飞集成相关人士告诉记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0452.wav", "duration": 5.5, "text": "法制晚报讯记者李洁今天傍晚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0323.wav", "duration": 4.993875, "text": "紫光股份在公告扩展云计算市场后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0420.wav", "duration": 2.464125, "text": "二人一脸笑容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0161.wav", "duration": 3.435, "text": "加解密的措施如同虚设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0303.wav", "duration": 3.4160625, "text": "云计算和大数据时代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0248.wav", "duration": 4.568, "text": "加快建设环境监测预警体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0381.wav", "duration": 7.073, "text": "他在二零一五年昆仑决诸神之战决赛圈的表现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0453.wav", "duration": 5.9148125, "text": "村庄晴天降奇冰十几斤重来历不明"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0122.wav", "duration": 3.915, "text": "明年初料迎供应淡季"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0369.wav", "duration": 5.0, "text": "很多六七十岁的跑者看到这个研究结果时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0235.wav", "duration": 4.072, "text": "避免中国企业境外恶性竞争"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0277.wav", "duration": 6.959, "text": "苹果作为消费数码产品的公司是否具备造车能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0331.wav", "duration": 5.1450625, "text": "同比增百分之十三点一一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0370.wav", "duration": 3.0788125, "text": "令对手不再敢贸然近身"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0364.wav", "duration": 4.698, "text": "可以防止运动员出发时手部滑落"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0283.wav", "duration": 8.2959375, "text": "乔斯维亚克还谈及了苹果涉足可穿戴设备市场的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0347.wav", "duration": 4.8239375, "text": "俄罗斯队十七分居榜首"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0166.wav", "duration": 3.669, "text": "积累在城镇购房首期付款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0424.wav", "duration": 4.3310625, "text": "陈妍希公司官方账号发表微博辟谣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0233.wav", "duration": 3.7940625, "text": "国家审计署还专门组织力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0330.wav", "duration": 4.5, "text": "将有利于增加威灵电器的收入和利润"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0362.wav", "duration": 4.5920625, "text": "失去了最稳定的得分手之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0331.wav", "duration": 4.212875, "text": "大到空调电视机电脑微波炉加湿器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0128.wav", "duration": 3.571, "text": "一线城市土地供应量减少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0290.wav", "duration": 8.734125, "text": "每股下滑三点八八美元报收于一点一十五点零五美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0463.wav", "duration": 6.492875, "text": "游客三亚游泳致终身残疾向旅行社索赔一九六万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0163.wav", "duration": 5.51, "text": "房企在一线城市拿地的热情还将提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0147.wav", "duration": 3.956, "text": "各级政府安排财政资金一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0351.wav", "duration": 5.068, "text": "并且介绍自己是如何通过实战调整状态而渐入佳境的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0195.wav", "duration": 6.094, "text": "充分发挥中国农业产业发展基金的引导作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0227.wav", "duration": 5.172, "text": "加强地方政府债务管理和风险防控"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0409.wav", "duration": 4.448, "text": "搜狐娱乐讯八月九日晚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0232.wav", "duration": 3.2630625, "text": "鼓励更多资金投资资本市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0388.wav", "duration": 4.9650625, "text": "加上惠若琪因伤缺席本届世界杯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0185.wav", "duration": 7.88, "text": "未来一年内中国房地产价格不太可能强劲反弹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0148.wav", "duration": 4.138, "text": "降幅比四月份收窄六个百分点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0471.wav", "duration": 5.9450625, "text": "温州鞋业总经理遭追杀凶手行凶过程中被打死"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0468.wav", "duration": 8.2158125, "text": "村委会主任因经济问题两次被免第三次当选惹争议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0386.wav", "duration": 7.224875, "text": "雅桑克莱并没有采取矮个子拳手惯用的闪击式打法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0350.wav", "duration": 5.3098125, "text": "日本以小分优势暂列第三位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0171.wav", "duration": 3.985, "text": "购房者受惠于政策利好的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0268.wav", "duration": 4.1999375, "text": "以及是否能提升他们的历史地位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0193.wav", "duration": 6.708, "text": "对于保障全国生态安全具有不可代替的战略作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0465.wav", "duration": 6.1650625, "text": "参考消息网九月二二日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0454.wav", "duration": 5.287125, "text": "六名游客在海珠湖公园凉亭内躲雨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0361.wav", "duration": 5.099875, "text": "组委会工作机构共分为四部一室"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0273.wav", "duration": 3.589125, "text": "高频交易一直饱受诟病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0432.wav", "duration": 4.8659375, "text": "杨爱明被兴安警方刑事拘留"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0122.wav", "duration": 4.902, "text": "加速今年楼市成交复苏回暖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0272.wav", "duration": 6.141, "text": "在最风光的时候看不见来自颠复者的威胁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0225.wav", "duration": 4.3049375, "text": "提高资源利用率和加工转化率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0263.wav", "duration": 5.0399375, "text": "不仅在科技公司领域排名第一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0451.wav", "duration": 4.8459375, "text": "温州三学生为庆生爬上浙江第一高楼玩自拍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0465.wav", "duration": 5.406, "text": "初步认定这是一起安全生产责任事故"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0376.wav", "duration": 6.462875, "text": "赛后主攻朱婷获最有价值球员和最受欢迎球员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0188.wav", "duration": 5.902, "text": "完善农产品流通税收政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0317.wav", "duration": 6.4299375, "text": "安丰公司的广告网页是他们推送的重要内容"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0455.wav", "duration": 5.9401875, "text": "涉事厂家生产的电梯此前曾发生多起事故"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0238.wav", "duration": 2.801, "text": "节假日最后一天结束"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0151.wav", "duration": 11.491, "text": "在兰州市北岸由广东房企开发的一个大型楼盘里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0261.wav", "duration": 3.5810625, "text": "更现实的的困难在于"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0413.wav", "duration": 3.9721875, "text": "小洋装更衬托出她的纤细身材"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0225.wav", "duration": 3.5549375, "text": "一些没有直接收益的项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0446.wav", "duration": 3.568125, "text": "新华社记者梁建强摄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0356.wav", "duration": 5.2470625, "text": "奔跑中国系列竞跑赛事将转战广州"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0382.wav", "duration": 4.3349375, "text": "五千米理查德灵格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0202.wav", "duration": 5.047, "text": "加快牲畜水产遗传改良进程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0357.wav", "duration": 3.573, "text": "冰壶项目在水立方进行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0477.wav", "duration": 8.156, "text": "龙湾永强中学一名高三男生从宿舍楼五楼楼顶坠楼身亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0406.wav", "duration": 5.8720625, "text": "这个角色拥有一只白色的波斯猫作为自己的宠物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0375.wav", "duration": 4.7470625, "text": "决赛一如期待般精彩绝伦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0494.wav", "duration": 4.365, "text": "二零零多幅珍贵油画抵达南京"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0139.wav", "duration": 5.14, "text": "在加大新供用地保障力度方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0236.wav", "duration": 9.8299375, "text": "使用地方政府的债务融资规模控制在安全范围内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0462.wav", "duration": 4.5280625, "text": "山水湾小区斜对面的一处工地旁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0441.wav", "duration": 10.874, "text": "村书记骗补助被判一一年受审辩称不了解政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0231.wav", "duration": 6.5, "text": "同比增加迅速上缴税金三亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0253.wav", "duration": 4.401, "text": "应该也是个提醒中国再也不能仅仅满足于组装了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0315.wav", "duration": 6.5851875, "text": "乌云上有不少因联网漏洞可导致车辆被控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0411.wav", "duration": 3.3779375, "text": "男友却仍然劈腿偷吃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0322.wav", "duration": 3.0610625, "text": "锂电池市场也在向好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0203.wav", "duration": 8.041, "text": "以最急需最关键最薄弱的环节和领域为重点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0394.wav", "duration": 3.97, "text": "即当自己轮转到前排二号位时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0307.wav", "duration": 3.801, "text": "往往对网络安全意识也不强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0382.wav", "duration": 3.311, "text": "但他的具体行踪成为谜团"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0345.wav", "duration": 5.2570625, "text": "通过冠军赛季后赛垫场赛等形式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0284.wav", "duration": 3.661, "text": "害得汪峰也不敢随便表白了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0332.wav", "duration": 7.4281875, "text": "预计汽车行业在网络安全方面投入往往较少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0212.wav", "duration": 3.813, "text": "防范我国政府债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0131.wav", "duration": 3.9930625, "text": "难以在周边城市用公积金购房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0399.wav", "duration": 3.711875, "text": "深知世界杯夺冠是对过去努力的肯定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0198.wav", "duration": 5.822, "text": "农产品产销对接的经验介绍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0434.wav", "duration": 9.249, "text": "村书记被村民驾车撞倒身亡肇事者已被刑拘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0281.wav", "duration": 4.3000625, "text": "合并拓朗之后将推出新的产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0183.wav", "duration": 5.5350625, "text": "缴存者还可以在租房装修离退休时提取"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0432.wav", "duration": 6.692875, "text": "我们才按照正常程序给他转为副院长一职的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0328.wav", "duration": 3.775, "text": "除了产品功能必须不错之外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0269.wav", "duration": 5.478, "text": "将会在设备发售稳定的推出与更新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0155.wav", "duration": 4.6969375, "text": "规划建筑面积约五万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0435.wav", "duration": 7.2009375, "text": "湖北七人冒充福彩工作人员兜售中奖秘籍骗取三零零万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0458.wav", "duration": 4.951875, "text": "李斯达表示自己跟周云露并没有深仇大恨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0306.wav", "duration": 3.744875, "text": "因此需要的人员大幅下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0378.wav", "duration": 3.7370625, "text": "法国冰协方面的态度有了缓和"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0250.wav", "duration": 2.9960625, "text": "但有关负责人认为我想"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0234.wav", "duration": 8.7569375, "text": "设定政府性债务风险控制指标和标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0255.wav", "duration": 5.078, "text": "苹果此举是为了节约用电量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0244.wav", "duration": 4.5, "text": "规划对十二五的投资规模未做预测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0391.wav", "duration": 4.845, "text": "在八月二十六日中国队和韩国队的比赛中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0244.wav", "duration": 5.312, "text": "政府总体上具有较强的偿债能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0461.wav", "duration": 2.6999375, "text": "温州话到底有多难懂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0208.wav", "duration": 5.6739375, "text": "徐林吸取欧美等国主权债务危机的教训"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0456.wav", "duration": 3.776125, "text": "目前黄某已被诊断为脑死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0448.wav", "duration": 5.021, "text": "村干部大闹天宫孙大圣口碑爆棚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0127.wav", "duration": 4.224, "text": "有些要与房企具体项目挂钩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0263.wav", "duration": 3.9449375, "text": "如果神雕大量服役和部署"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0197.wav", "duration": 2.881, "text": "中小企业经营困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0286.wav", "duration": 5.8570625, "text": "主要是因为社会对可穿戴智能手表的期望太高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0312.wav", "duration": 4.735, "text": "主要在于将通信和定位的模块大大缩小到方寸之间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0190.wav", "duration": 4.257, "text": "推动农产品生产加工和流通企业建立诚信制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0185.wav", "duration": 4.108, "text": "此项政策对中国楼市影响有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0125.wav", "duration": 4.098, "text": "后续要加大公积金贷款的便利性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0393.wav", "duration": 3.7829375, "text": "主教练郎平都没有派她出场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0171.wav", "duration": 4.857, "text": "且低于七十平米的小户型住房成交明显上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0401.wav", "duration": 3.9440625, "text": "但看两人比赛后的面部状况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0140.wav", "duration": 6.167, "text": "其中广州深圳甚至出现了多个日光盘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0444.wav", "duration": 4.286875, "text": "称事件系点餐过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0341.wav", "duration": 7.23, "text": "高清女排力擒俄罗斯夺冠占主动众将喜极而泣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0318.wav", "duration": 7.406, "text": "美的集团对项目在一定年限内有投入产出的规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0483.wav", "duration": 3.5649375, "text": "新京报快讯记者刘玮近日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0224.wav", "duration": 6.656, "text": "以建设区域内各类农产品优势产业带为重点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0144.wav", "duration": 5.576, "text": "在房企扎堆一二线城市时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0160.wav", "duration": 5.315, "text": "楼面价折合约一万元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0341.wav", "duration": 3.1899375, "text": "张蓉芳主持排管中心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0438.wav", "duration": 5.6499375, "text": "肇事者为紫各庄村民乔某"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0135.wav", "duration": 3.74, "text": "整个系统的安全就会出现问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0193.wav", "duration": 3.584, "text": "对债券投资人来说不是坏事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0192.wav", "duration": 5.735, "text": "在制度上对债券持有人的合法权益进行保护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0183.wav", "duration": 4.688, "text": "从一月的一线城市的土地成交看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0350.wav", "duration": 6.4250625, "text": "新队长曾春蕾揭秘了角色转变前后的幕后故事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0271.wav", "duration": 3.046, "text": "手机网民近五点六亿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0127.wav", "duration": 6.591, "text": "在丰台樊家村一宗商业用地底价成交后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0324.wav", "duration": 4.365, "text": "国内几个服务器品牌的盘子还比较小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0252.wav", "duration": 4.5759375, "text": "极有可能对债券持有人利益构成不利影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0159.wav", "duration": 4.002, "text": "未来政策层面将继续保持宽松"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0292.wav", "duration": 3.4250625, "text": "现在是不是也该长点心了吧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0384.wav", "duration": 3.991, "text": "将只参加奥运会团体赛的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0194.wav", "duration": 3.682, "text": "北京科技大学教授刘澄表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0249.wav", "duration": 4.6120625, "text": "实行全口径统计和动态监测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0213.wav", "duration": 5.6269375, "text": "鼓励各种社会力量与乡村结对帮扶"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0406.wav", "duration": 2.7309375, "text": "影片的上映日期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0235.wav", "duration": 4.75, "text": "所投项目必须经过合规性审查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0482.wav", "duration": 5.3090625, "text": "这样的斗争和考验有时就发生在我们身边"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0476.wav", "duration": 6.8100625, "text": "温州高三男生坠楼身亡事发前无异常刚从家返校"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0322.wav", "duration": 6.3140625, "text": "美芝压缩机是隶属于美的集团旗下的业务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0388.wav", "duration": 5.6340625, "text": "徐云丽透露在赛前队友曾经给自己发了一条短信"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0469.wav", "duration": 3.8769375, "text": "希望相关部门能处理此事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0240.wav", "duration": 4.072, "text": "政府还拥有较多的可变现资产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0146.wav", "duration": 4.7959375, "text": "已有一套住房并结清贷款馀额的家庭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0267.wav", "duration": 4.053, "text": "而是会更加关注产品本身"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0406.wav", "duration": 5.255125, "text": "因此不得不放弃宾虚的演出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0278.wav", "duration": 4.235, "text": "车库虽然最能够代表初期创业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0320.wav", "duration": 9.1960625, "text": "由于向为民已获任威灵电机的董事会主席"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0331.wav", "duration": 3.0129375, "text": "很可能通过联网技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0299.wav", "duration": 3.8350625, "text": "难不成真能第三期发育"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0474.wav", "duration": 6.166, "text": "河南籍游客张某某手部受伤及表皮损伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0425.wav", "duration": 4.999, "text": "下星期更进入结局周"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0306.wav", "duration": 3.782, "text": "沈阳机床董事长关锡友认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0180.wav", "duration": 2.847, "text": "来自广州日报的报道称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0419.wav", "duration": 2.642125, "text": "也有情绪问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0288.wav", "duration": 4.5189375, "text": "而梅姐则可以陪陪小孩或者去搞搞政治"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0136.wav", "duration": 4.318, "text": "商业营业用房销售额下降了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0385.wav", "duration": 4.3190625, "text": "在今年的亚锦赛夺冠后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0404.wav", "duration": 6.1589375, "text": "曾以分歧者星运里的错窜红的谢琳伍德蕾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0363.wav", "duration": 9.9201875, "text": "随后还以百分之五十三点五六的得分率拿到了最佳进攻的大奖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0335.wav", "duration": 7.6379375, "text": "下称美的内部的组织架构二点一五年加大了调整力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0158.wav", "duration": 3.3550625, "text": "公积金贷款上限调整后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0455.wav", "duration": 6.2580625, "text": "温州苍南县看守所民警宿舍楼起火无人员伤亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0455.wav", "duration": 3.0400625, "text": "昨日记者从医院了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0150.wav", "duration": 8.649, "text": "搜房网广州二手房电商集团市场部总监罗来平发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0354.wav", "duration": 4.051, "text": "每个场馆又高端大气上档次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0168.wav", "duration": 5.1639375, "text": "是国际上合作性办公品牌的代表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0465.wav", "duration": 7.6679375, "text": "温州贩卖婴儿大案女医生假称婴儿已死然后卖掉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0250.wav", "duration": 5.0, "text": "加快鲜活农产品质量安全追溯体系建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0486.wav", "duration": 5.001, "text": "据新华社电七月四日一六时许"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0275.wav", "duration": 7.0970625, "text": "将创下该公司成立四七年来最大收购交易的记录"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0488.wav", "duration": 4.833, "text": "通报一个教育一批震灭一片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0234.wav", "duration": 6.0, "text": "各地要鼓励流通企业跨地区兼并重组和投资合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0447.wav", "duration": 3.8151875, "text": "他辗转三所乡村学校"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0363.wav", "duration": 3.160875, "text": "而对于他的好友小林尊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0171.wav", "duration": 5.786, "text": "规划建筑面积合计九百万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0282.wav", "duration": 5.281, "text": "现在就下结论将原因推给高频交易"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0179.wav", "duration": 2.791, "text": "地下一万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0390.wav", "duration": 3.6340625, "text": "因为想要捧起来冠军奖杯的欲望太强烈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0397.wav", "duration": 6.011, "text": "民众自然会支持大韩体育会给他一个人修改规则"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0188.wav", "duration": 2.7460625, "text": "而是一条市内快速路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0131.wav", "duration": 3.2909375, "text": "存销比已经见顶回落"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0324.wav", "duration": 4.662, "text": "这是今年上半年锂电池业务爆发的原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0292.wav", "duration": 4.5, "text": "高德纳咨询公司分析师马克黄说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0379.wav", "duration": 5.218, "text": "这其中一位身材高挑的女孩子颇为引人关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0303.wav", "duration": 6.2629375, "text": "现阶段管理创新和组织再造比任何的创新都重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0197.wav", "duration": 3.8869375, "text": "入海污染物排放总量下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0192.wav", "duration": 3.347, "text": "推进主营业务整体上市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0316.wav", "duration": 2.735, "text": "小天才产品负责人表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0203.wav", "duration": 4.252, "text": "国资委还将支持企业走出去"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0219.wav", "duration": 6.645, "text": "要加大保障性安居工程建设资计划落实力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0175.wav", "duration": 3.412, "text": "购房的扶持力度在加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0344.wav", "duration": 3.958, "text": "恰恰在风格打法和比赛理念上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0438.wav", "duration": 5.6550625, "text": "每句歌词都蕴含一段李姓历史文化在里头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0396.wav", "duration": 4.51, "text": "但是上周公布的水质检测显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0407.wav", "duration": 5.502, "text": "雷诺兹持枪的造型和他在冥界警局里的颇为相似"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0128.wav", "duration": 5.5610625, "text": "北京今年的土地出让金锁定在两千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0389.wav", "duration": 5.22, "text": "但喜欢欧美音乐爱吃西红柿意大利面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0485.wav", "duration": 3.741, "text": "更是扭转日本旅游赤字"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0312.wav", "duration": 5.833, "text": "盘中有两千六百八十六万元资金净流入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0216.wav", "duration": 3.811, "text": "从事当地的基础设施建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0495.wav", "duration": 6.7221875, "text": "李嘉诚军师抛售马云一五亿买香港最贵单价豪宅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0285.wav", "duration": 5.567125, "text": "在美国一上线就造成大轰动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0132.wav", "duration": 4.952, "text": "土地出入收入累计结馀五千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0430.wav", "duration": 4.235125, "text": "但现在又有别的女孩坐上他的大腿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0261.wav", "duration": 4.963, "text": "随着四克网络的在中国的展开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0272.wav", "duration": 2.8770625, "text": "他是一个杰出的商人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0255.wav", "duration": 6.4810625, "text": "占总营收的二十六点百分之六十点六十七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0262.wav", "duration": 5.172, "text": "瞬间将苹果估价拉低了至少百分之六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0424.wav", "duration": 5.225125, "text": "搜狐娱乐讯北京时间七月二十八日消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0152.wav", "duration": 4.6050625, "text": "各项目标任务已分解至各区县"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0332.wav", "duration": 3.6240625, "text": "已经花费了一定的资源和成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0220.wav", "duration": 4.0299375, "text": "大力开展小型农田水利建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0266.wav", "duration": 2.957, "text": "没人知道他在干什么"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0271.wav", "duration": 5.725125, "text": "更大的野心在于深刻变革人类的支付习惯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0448.wav", "duration": 3.401125, "text": "宝马奔驰连续四次相撞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0390.wav", "duration": 4.964125, "text": "在这场亚洲国家锁定胜局的申办博弈中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0257.wav", "duration": 5.918, "text": "苹果公司一直在秘密从事电汽汽车的研发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0474.wav", "duration": 4.9250625, "text": "该镇农办一名主管水利负责人介绍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0374.wav", "duration": 4.4239375, "text": "毕竟她本人是经历过伦敦奥运会的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0342.wav", "duration": 4.937, "text": "比赛的节奏始终被中国队控制在手中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0345.wav", "duration": 3.5, "text": "伴随着专业啦啦队的加油声"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0489.wav", "duration": 3.453875, "text": "不是她的戏或是她的八卦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0243.wav", "duration": 8.069, "text": "提高大型农机具和农药化肥农膜等农资生产水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0368.wav", "duration": 2.8310625, "text": "无法参加奥运会的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0188.wav", "duration": 3.1700625, "text": "进一步完善环境政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0395.wav", "duration": 6.2580625, "text": "她几乎担当起了场上进攻加振奋士气的主力作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0356.wav", "duration": 4.0859375, "text": "在几度遇险的情况下顽强咬住"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0245.wav", "duration": 3.3940625, "text": "由各省区市人民政府决定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0428.wav", "duration": 3.6120625, "text": "照片中二人坐在沙发上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0404.wav", "duration": 5.4150625, "text": "业已正式启动斯诺登事件电影的拍摄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0419.wav", "duration": 5.243875, "text": "现场试听无条件人生马拉松等六首歌曲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0377.wav", "duration": 5.6840625, "text": "但曾春蕾赛后还是以队长身份出席了新闻发布会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0219.wav", "duration": 5.9759375, "text": "提高公众参与渤海环境保护的积极性和主动性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0427.wav", "duration": 4.2949375, "text": "甜蜜恩爱的模样彷彿热恋中的情侣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0345.wav", "duration": 5.767125, "text": "俄罗斯美国和日本三队均零封对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0211.wav", "duration": 6.7590625, "text": "调动农民参与农业农村基础设施建设的积极性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0405.wav", "duration": 4.036125, "text": "避免和新木乃伊正面较量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0422.wav", "duration": 3.0610625, "text": "感情事备受关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0406.wav", "duration": 6.193875, "text": "以一身越野军装黑框眼镜的造型出现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0472.wav", "duration": 3.8210625, "text": "其作案后身上有大量血迹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0360.wav", "duration": 5.420875, "text": "关键的第四局一开始中国队便发生了意外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0151.wav", "duration": 7.8239375, "text": "公积金贷款首付比例降低的消息令购房者喜出望外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0251.wav", "duration": 4.0389375, "text": "但目前还存在服务架构不完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0368.wav", "duration": 2.944125, "text": "朱婷却是唯一的硕果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0209.wav", "duration": 4.176, "text": "其中城投债券共发行七千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0126.wav", "duration": 4.3039375, "text": "北京去年土地出让落下大幕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0161.wav", "duration": 3.669, "text": "避免房地产市场大起大落"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0126.wav", "duration": 4.885, "text": "还降低了首套房公积金首付"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0293.wav", "duration": 3.864, "text": "应慎重考虑上市时机和地点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0390.wav", "duration": 3.531, "text": "看到这一幕我控制不住自己了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0145.wav", "duration": 3.735, "text": "全国共有管理中心一百个"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0464.wav", "duration": 4.410125, "text": "大家到施工现场的临时大门外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0278.wav", "duration": 6.344, "text": "她们宁愿可花五个小时讨论是否买一条裙子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0253.wav", "duration": 7.24, "text": "商议向印度转移更多军事技术的事宜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0228.wav", "duration": 3.543, "text": "提高现代化生产水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0192.wav", "duration": 10.139, "text": "考试过程需要消耗相关材料或需聘请专业面试考官的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0409.wav", "duration": 3.646, "text": "她表示最重要的就是诚恳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0485.wav", "duration": 3.301, "text": "看到该网友的曝光帖后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0235.wav", "duration": 6.15, "text": "全面实施和完善草原生态保护补助奖励政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0291.wav", "duration": 4.1160625, "text": "美国将不再生产大鸦无人机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0328.wav", "duration": 3.3630625, "text": "年龄或大或小的孩子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0302.wav", "duration": 5.3449375, "text": "是这类公司在美国市场估值长期受低估"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0327.wav", "duration": 5.682, "text": "同比增长百分之四净利润六点七八亿港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0226.wav", "duration": 3.532, "text": "坚持确保国家粮食安全"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0180.wav", "duration": 3.435, "text": "一大数据云计算不是你谈的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0247.wav", "duration": 3.2369375, "text": "是南京往南的重要通道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0361.wav", "duration": 5.4821875, "text": "赢得了同行媒体和观众的敬意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0252.wav", "duration": 3.625, "text": "物质装备水平明显提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0206.wav", "duration": 5.9870625, "text": "地方投融资平台公司通过发行债券进行融资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0477.wav", "duration": 3.1259375, "text": "目前仍未发现失踪船员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0277.wav", "duration": 4.291, "text": "通常只是算法交易造成的影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0205.wav", "duration": 4.7470625, "text": "耕种收综合机械化水平百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0467.wav", "duration": 5.288125, "text": "永远的紫霞仙子朱茵的亮相引起粉丝的热捧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0364.wav", "duration": 6.368875, "text": "张家口市的崇礼县从每年十一月初到第二年四月初"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0470.wav", "duration": 5.1789375, "text": "机器人服务员现身火锅店顾客直呼女神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0359.wav", "duration": 5.390125, "text": "自二零一四年十二月五日正式启动志愿者招募工作以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0231.wav", "duration": 7.5, "text": "落实对城市公共交通行业的成品油价格补贴政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0279.wav", "duration": 3.891, "text": "中国商务部已明确表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0177.wav", "duration": 4.91, "text": "美丽北京大型绿色公益品牌项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0212.wav", "duration": 5.9140625, "text": "政府通过债务融资从事基础建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0311.wav", "duration": 4.808, "text": "公司股票于二零一五年七月八日复牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0369.wav", "duration": 3.599125, "text": "营造出良好的比赛氛围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0469.wav", "duration": 6.5649375, "text": "游客下桥拍照踩死植物水杉栈道仙境拉铁丝网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0139.wav", "duration": 3.264, "text": "前年至今年期间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0384.wav", "duration": 5.6000625, "text": "这也是这项冰雪顶级盛事首次来到中国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0414.wav", "duration": 3.0329375, "text": "搜狐娱乐讯九月二日凌晨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0490.wav", "duration": 7.603, "text": "一辆货车在金丽温高速温州段发生事故"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0370.wav", "duration": 4.594, "text": "此地春秋冬三季有雪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0247.wav", "duration": 5.321875, "text": "避免在最后一年累积过大的还本压力和风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0160.wav", "duration": 4.458, "text": "加之降息降准等政策组合拳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0363.wav", "duration": 2.978, "text": "明天还剩最后一场比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0393.wav", "duration": 5.672125, "text": "我们也应该抱着更加长远和开阔的视角来看待"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0302.wav", "duration": 5.6219375, "text": "若定苹果第三期发育的立场已呼之欲出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0233.wav", "duration": 7.0560625, "text": "先后两批共八家商业银行设立或参股八家基金管理公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0239.wav", "duration": 6.817, "text": "普通公路以车辆通过收费站收费车道的时间为准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0226.wav", "duration": 4.9809375, "text": "不能简单地用寅吃卯粮来作价值判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0220.wav", "duration": 3.2900625, "text": "加快基础设施建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0363.wav", "duration": 3.4140625, "text": "为做好志愿者服务工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0386.wav", "duration": 7.0739375, "text": "对于工作中遇到的管理经验和能力欠缺问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0189.wav", "duration": 6.234, "text": "直接涉及到债劵持有人的利益保护问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0460.wav", "duration": 13.1850625, "text": "游戏主播花样作死声称天津是他炸的直播被抓游戏室老板因冲突开枪将人射伤致死"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0316.wav", "duration": 3.577, "text": "在全世界的产业格局看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0434.wav", "duration": 4.0839375, "text": "北京旅游服务热线反馈称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0400.wav", "duration": 4.4389375, "text": "而东道主日本队紧追在中国队之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0138.wav", "duration": 4.3609375, "text": "住房公积金贷款因其利率较低的优势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0443.wav", "duration": 6.1640625, "text": "就到了薛孝文任教的学校金堂县平桥学校"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0215.wav", "duration": 5.6889375, "text": "在政府投融资体制改革过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0302.wav", "duration": 4.057, "text": "但这些厂商的产品都难以进入主流"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0461.wav", "duration": 6.3989375, "text": "在经过商场自动扶梯时会选择跳过视频中的跳板"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0232.wav", "duration": 6.5239375, "text": "扩大大中城市郊区菜篮子产品生产基地规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0495.wav", "duration": 9.1489375, "text": "其在出行成都打车时被司机找了四张同号的二元零元假币"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0359.wav", "duration": 4.271, "text": "这也意味着最晚在明年的各项赛事中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0411.wav", "duration": 3.576875, "text": "搜狐娱乐讯七月十日消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0485.wav", "duration": 6.313, "text": "一场考验道德与良知的大米保卫战悄然打响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0345.wav", "duration": 6.8139375, "text": "但她在中国队遇到困难的时候坚持带伤上阵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0292.wav", "duration": 4.646, "text": "不过这些政策现在已经被废除"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0141.wav", "duration": 4.0229375, "text": "在公积金贷款额度上调后一个月内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0457.wav", "duration": 4.979, "text": "本报讯记者范跃红通讯员瓯文为了卖相好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0233.wav", "duration": 2.823, "text": "坚持基本草原保护制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0447.wav", "duration": 6.1010625, "text": "温州美女学霸将赴非洲支教教当地小学生汉语"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0201.wav", "duration": 7.821875, "text": "落实农民专业合作社和农村金融有关税收优惠政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0257.wav", "duration": 3.813, "text": "问题是他也想不出谁能干得更好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0326.wav", "duration": 4.009, "text": "二十馀万部手机遭殃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0227.wav", "duration": 10.7840625, "text": "收益用于公共交通基础设施建设和弥补运营亏损"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0363.wav", "duration": 6.9770625, "text": "而是坚持参加了今年三月的世界花滑锦标赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0411.wav", "duration": 6.187, "text": "对于疯癫陈奕迅所长的这些设定歌迷早已习惯了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0310.wav", "duration": 4.3088125, "text": "孩子带到学校既不会让孩子分心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0389.wav", "duration": 6.2209375, "text": "张常宁的幼稚嫩显然还不能立即挑起大梁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0484.wav", "duration": 4.0808125, "text": "七月一三日的葬礼上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0405.wav", "duration": 4.951875, "text": "原本计划在今年六月正式开机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0392.wav", "duration": 7.5070625, "text": "中国女排直落三周以三零取胜阿根廷拿到第七胜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0462.wav", "duration": 4.1938125, "text": "李银河写虐恋不会伤害小波"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0179.wav", "duration": 3.413, "text": "区域产品和业务三大层面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0394.wav", "duration": 6.23, "text": "斩获十五分冠全场并且拦网独得四分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0222.wav", "duration": 3.625, "text": "以转变农业发展方式为主线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0217.wav", "duration": 5.9, "text": "努力探索出一条具有中国特色的农业现代化道路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0200.wav", "duration": 5.0179375, "text": "畜牧业产值占农业总产值比重百分之"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0483.wav", "duration": 9.3320625, "text": "村官接连顶风违纪其子领证为热闹摆酒六七桌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0377.wav", "duration": 3.7569375, "text": "都要给队友们传递乐观和放松的讯号"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0141.wav", "duration": 2.5, "text": "零三年到去年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0321.wav", "duration": 3.364, "text": "一定年限内的投入产出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0424.wav", "duration": 3.5, "text": "节目推出至今收视很高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0178.wav", "duration": 5.1989375, "text": "也在于全面落实分类调控因城施策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0478.wav", "duration": 3.1010625, "text": "这是富林愚老人发自内心的一句话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0461.wav", "duration": 3.8190625, "text": "至今未找到肇事者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0358.wav", "duration": 3.048125, "text": "如果真的想学习的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0490.wav", "duration": 3.6960625, "text": "该事件引发社会关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0140.wav", "duration": 5.3780625, "text": "与之相联系的土地市场也会受到影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0243.wav", "duration": 5.4129375, "text": "推动环保基础设施和服务向农村延伸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0274.wav", "duration": 5.724, "text": "一堆不赚钱的公司赶着上市当然不是什么好事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0354.wav", "duration": 6.0019375, "text": "让朱婷最佳球员的身份和价值再度彰显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0370.wav", "duration": 8.910875, "text": "中国双人滑项目的后续发展应当有了较为清晰的前景"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0156.wav", "duration": 5.379, "text": "以北京去年纯商品房成交结构为例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0492.wav", "duration": 6.3139375, "text": "温州瑞安市发生一起违停女司机故意伤害交通协警案件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0380.wav", "duration": 5.243875, "text": "要求马塞洛特缴纳七万欧元的转国籍费用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0160.wav", "duration": 6.5909375, "text": "今年国有土地出让权收入四千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0193.wav", "duration": 6.2790625, "text": "先后出台的战略性新兴产业的政策措施主要有六项"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0159.wav", "duration": 7.6989375, "text": "有望进一步激活买家在接近年底这段时间的入市积极性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0317.wav", "duration": 3.9460625, "text": "全世界排列的二加三格局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0343.wav", "duration": 3.339, "text": "并与亲朋好友分享这份快乐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0421.wav", "duration": 5.308125, "text": "看来他们需要身边的朋友保密他们的行踪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0170.wav", "duration": 5.979, "text": "这直接利好去库存目标的实现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0250.wav", "duration": 9.3360625, "text": "各地要按照天然气利用优先顺序加强需求侧管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0217.wav", "duration": 4.889, "text": "引导建设优质农产品物流配送中心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0162.wav", "duration": 7.368, "text": "稳增长措施需更全面地考虑化解楼市风险问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0308.wav", "duration": 3.151, "text": "都必须要回答的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0294.wav", "duration": 6.5390625, "text": "就美国对中国产轮胎发起双坊调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0342.wav", "duration": 3.0488125, "text": "但湖水很脏也很浑浊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0207.wav", "duration": 8.5, "text": "国务院国资委对央企境外投资的管理法规在逐渐完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0305.wav", "duration": 6.0400625, "text": "公司上半年营业收入六点三四亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0278.wav", "duration": 4.714, "text": "其中就包括沃尔玛和百思买"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0140.wav", "duration": 3.499, "text": "参照首套房贷款政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0192.wav", "duration": 6.4040625, "text": "完善农业科技创新体系和现代农业产业技术体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0393.wav", "duration": 4.4079375, "text": "全能里科费雷姆斯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0189.wav", "duration": 3.855, "text": "制订境外投资总体战略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0218.wav", "duration": 5.9560625, "text": "大力发展粮食精深加工及仓储物流业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0207.wav", "duration": 5.5489375, "text": "这是这几年城投债券发行规模不断扩大的主要原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0165.wav", "duration": 3.022, "text": "带动了区域板块的扩张"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0147.wav", "duration": 4.1160625, "text": "商品房销售面积三亿平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0271.wav", "duration": 4.2739375, "text": "以前在高端智能手机市场领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0463.wav", "duration": 4.3620625, "text": "肇事的大卡车车头仍然卡在工房内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0297.wav", "duration": 3.8629375, "text": "起步价为三百四九美元十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0364.wav", "duration": 3.739, "text": "全面引爆现场观众的激情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0360.wav", "duration": 4.8420625, "text": "本次比赛使用最新的仰泳出发壁架"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0433.wav", "duration": 3.939, "text": "他叮嘱五千馀名毕业生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0437.wav", "duration": 5.29, "text": "早前通报的五名失联人员已全部找到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0154.wav", "duration": 5.35, "text": "邻近地铁十号线首竟贸站"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0143.wav", "duration": 7.851, "text": "可基本满足首套和改善性自住住房的低息贷款需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0331.wav", "duration": 3.9250625, "text": "上述成飞集成人士告诉记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0189.wav", "duration": 4.336, "text": "健全环境执法调协调机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0244.wav", "duration": 6.5799375, "text": "为了控制地方政府本届发债下届还钱的道德风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0300.wav", "duration": 3.1939375, "text": "以满足不同用户的需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0137.wav", "duration": 6.0479375, "text": "现阶段市场上落地的产品大多对安全的认知都存在缺陷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0211.wav", "duration": 5.913, "text": "采取必要措施加强政府债务管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0458.wav", "duration": 5.187, "text": "家居养娃的李娜又重新出现在媒体大众的面前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0441.wav", "duration": 4.6330625, "text": "大量资本已投入医药企业中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0456.wav", "duration": 7.349875, "text": "目前湖北省质监局已要求全省暂停使用涉事厂家电梯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0371.wav", "duration": 6.209, "text": "最终中国队以二五比二三拿下第四局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0164.wav", "duration": 7.978, "text": "外商投资房地产企业注册资本与投资总额比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0244.wav", "duration": 5.2729375, "text": "引导和帮助农民科学处理垃圾和污水"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0279.wav", "duration": 3.626, "text": "至二十五点五万亿韩元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0495.wav", "duration": 8.265125, "text": "火锅店服务员朱某被温州市鹿城区检察院依法批准逮捕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0155.wav", "duration": 3.415, "text": "总体偏松部分地区过剩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0199.wav", "duration": 4.393, "text": "就国家方案我省还会进行再研究"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0125.wav", "duration": 5.931, "text": "百分之五的网友希望放开一线城市的限购政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0458.wav", "duration": 9.6481875, "text": "华商报讯记者张林实习生邓泽惠一夜之间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0391.wav", "duration": 4.5, "text": "看好她成为日本排球的新女神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0361.wav", "duration": 3.417, "text": "这是我们每个人都应该做的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0407.wav", "duration": 4.4709375, "text": "在经历了无数次的导演和演员更换之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0363.wav", "duration": 4.2680625, "text": "中国队进攻火力明显减弱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0360.wav", "duration": 6.767125, "text": "当时身披八号战袍的她身高达到了一米九五公分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0475.wav", "duration": 4.7219375, "text": "政府曾多次叫停电站发电"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0226.wav", "duration": 6.006, "text": "虽然报道内容并没有具体的城投债券还本付息违约案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0482.wav", "duration": 3.201875, "text": "但问题至今没有解决"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0236.wav", "duration": 5.349, "text": "就不得再通过发行城投债券新增政府性债务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0392.wav", "duration": 2.8420625, "text": "希望得到想要的结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0170.wav", "duration": 4.388, "text": "主要目的是把后辈的婚姻风险隔断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0207.wav", "duration": 6.865, "text": "农业与非农产业之间劳动生产率的差距也很大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0219.wav", "duration": 5.036, "text": "实施全国增长千亿斤粮食生产能力规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0323.wav", "duration": 4.015125, "text": "百分之百为国产品牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0352.wav", "duration": 4.9660625, "text": "中国女排昨天下午在松本迎战韩国队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0178.wav", "duration": 4.492, "text": "支持居民自住和改善住房需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0171.wav", "duration": 5.156, "text": "如今房地产市场已经供需相对平衡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0482.wav", "duration": 3.8449375, "text": "又在船仓内发现四名船员遗体"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0389.wav", "duration": 5.9399375, "text": "全场比赛的焦点是休战三场后重新登场的名将朱婷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0300.wav", "duration": 6.453, "text": "但现在已经成为了习生活习惯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0173.wav", "duration": 5.852, "text": "但去年住宅土地成交建筑面积仅十二亿平米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0164.wav", "duration": 6.367, "text": "公积金政策调整对购房者心理层面影响较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0376.wav", "duration": 3.9040625, "text": "也有经验丰富的老队员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0289.wav", "duration": 3.6319375, "text": "全球鹰并不能独占鳌头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0273.wav", "duration": 5.623875, "text": "还没有任何一个用户真正遭受过此攻击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0246.wav", "duration": 4.0959375, "text": "引导天然气合理消费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0151.wav", "duration": 6.288, "text": "其中资金这一要素指基于信托登记的相关法规局限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0197.wav", "duration": 6.505, "text": "推动创建不同层次特色鲜明的现代农业示范区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0130.wav", "duration": 5.248, "text": "北京仅新增住宅土地供应十宗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0394.wav", "duration": 3.837875, "text": "最终判决结果将在十一月出炉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0284.wav", "duration": 4.6849375, "text": "由于苹果要打压竞争对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0359.wav", "duration": 6.51, "text": "本赛季的各项赛事参赛名单上却都没有见到他的身影"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0344.wav", "duration": 4.845, "text": "曾春蕾和张常宁均拿到十六分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0436.wav", "duration": 6.649875, "text": "游客参与不合理低价游将被罚专家怎么判断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0420.wav", "duration": 3.875, "text": "搜狐娱乐讯据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0350.wav", "duration": 4.5, "text": "这个娃娃打球时很有思想"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0123.wav", "duration": 4.408, "text": "这对于目前一线城市来说很紧要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0244.wav", "duration": 3.4509375, "text": "要大力推进产销衔接"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0483.wav", "duration": 7.355, "text": "通过网站团购了无锡江南丹青度假酒店一间套房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0390.wav", "duration": 2.698, "text": "我可以带着它回家了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0223.wav", "duration": 7.2739375, "text": "政府举债建设形成大量资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0405.wav", "duration": 4.241, "text": "亚当桑德勒成功卫冕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0396.wav", "duration": 5.9181875, "text": "这样既丰富了自己也增加了全队的进攻变化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0357.wav", "duration": 4.5019375, "text": "高桥在当地过着奢华享乐的生活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0334.wav", "duration": 5.255875, "text": "这也是选购电话手表要注意关注的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0328.wav", "duration": 5.4968125, "text": "有两家表示能够诊断或者反馈黑客入侵后的情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0359.wav", "duration": 8.098125, "text": "也是其对于自身技术全面性提高程度的一次检验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0261.wav", "duration": 5.353, "text": "这种技术很适合用来治疗胃溃疡等胃部疾病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0264.wav", "duration": 2.7060625, "text": "其中一个回答就说过"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0464.wav", "duration": 5.837875, "text": "成都男子张呈亮化名旅行时到三亚海滩游泳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0447.wav", "duration": 3.891125, "text": "延庆法院一审判决认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0452.wav", "duration": 4.5090625, "text": "东方演艺集团大门口戒备森严"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0292.wav", "duration": 3.1428125, "text": "苹果有意进军汽车产业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0152.wav", "duration": 4.152, "text": "取消一万户家庭的保障资格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0134.wav", "duration": 3.608, "text": "只要一个单品存在安全漏洞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0251.wav", "duration": 3.5, "text": "依靠科技持续改进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0250.wav", "duration": 4.834, "text": "并对债券市场形成了不小的冲击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0128.wav", "duration": 4.0640625, "text": "住建部官员发表文章指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0416.wav", "duration": 5.3840625, "text": "陈妍希回到台北代言悠游卡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0422.wav", "duration": 4.451875, "text": "不同于大家心中按部就班的乖乖女形象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0487.wav", "duration": 4.713125, "text": "国内两地出现注胶虾踪迹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0195.wav", "duration": 4.9749375, "text": "部分中小企业国内生产成本有所提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0356.wav", "duration": 3.5810625, "text": "跑者从二十多岁到五十九岁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0362.wav", "duration": 4.1159375, "text": "外界认为这是一种另有深意的暗示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0264.wav", "duration": 4.8840625, "text": "用电脑进行战争比用核武器还有效"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0463.wav", "duration": 7.489, "text": "其中一些人是近年来国际拍卖会上艺术品的最大买家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0411.wav", "duration": 3.181875, "text": "坦言刚开拍的一个月中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0229.wav", "duration": 2.884875, "text": "控制在合理的范围内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0272.wav", "duration": 2.7940625, "text": "苹果有两个竞争对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0436.wav", "duration": 7.3769375, "text": "本周内动员部署全省九零零多家快递企业按要求执行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0338.wav", "duration": 5.8769375, "text": "强劲犀利的拳法与膝法破坏力惊人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0174.wav", "duration": 4.7319375, "text": "资金面紧张对楼市的影响开始显现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0357.wav", "duration": 2.8569375, "text": "打出一道深深的血口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0396.wav", "duration": 3.667, "text": "赛后被评为当场最佳球员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0462.wav", "duration": 6.0608125, "text": "浙江省史上规模最大的户外救援行动开始了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0297.wav", "duration": 3.9448125, "text": "汽车是苹果下一个颠复目标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0489.wav", "duration": 6.188, "text": "参考消息网九月二三日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0192.wav", "duration": 3.2459375, "text": "农村劳动力大量转移"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0265.wav", "duration": 5.5460625, "text": "在谷歌与苹果相机推出智能手表后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0380.wav", "duration": 3.8979375, "text": "师姐罗雪娟也忍不住落泪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0307.wav", "duration": 4.1469375, "text": "未来的制造业方向要实现无人化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0245.wav", "duration": 5.187, "text": "我们还安排了专门的偿债均摊机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0176.wav", "duration": 4.181, "text": "二全国两会或将楼市基调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0232.wav", "duration": 5.6959375, "text": "我们对城投债券发行人的审核一直是比较严格的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0368.wav", "duration": 3.3359375, "text": "二零二二年冬奥会的举行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0313.wav", "duration": 8.449, "text": "以区域为中心建立客户经理负责制制造方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0237.wav", "duration": 5.4859375, "text": "加强海外信息监测为企业提供对外投资指导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0351.wav", "duration": 3.438, "text": "它都是女排精神的一部分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0495.wav", "duration": 3.354, "text": "可以考虑一下空中赏月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0492.wav", "duration": 7.657, "text": "村主任给狗盖房吞六万公款被判刑二年八个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0278.wav", "duration": 6.1949375, "text": "须从他们公司的安全网站上进行下载并安装"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0436.wav", "duration": 5.5588125, "text": "其集团在全球拥有一三零零零间店铺"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0230.wav", "duration": 7.484, "text": "支持生禽规模化养殖场小区开展标准化改造和建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0356.wav", "duration": 5.100125, "text": "张春雨选择了加强压迫对手的力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0277.wav", "duration": 3.6899375, "text": "除了有时候让他们觉得那里像家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0262.wav", "duration": 3.311875, "text": "与世界第二经济大国的地位还不相称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0342.wav", "duration": 4.375, "text": "二零一七年二零二二年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0181.wav", "duration": 6.0720625, "text": "可在境内限购一定面积的自住商品房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0489.wav", "duration": 6.8298125, "text": "省纪委要求新闻媒体主动参与到纠四风监督工作中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0309.wav", "duration": 5.928, "text": "老板电器的新增量创新需求追求极致搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0346.wav", "duration": 3.452125, "text": "丰富的战斗技巧是我的特色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0347.wav", "duration": 6.9360625, "text": "二零一五年九月十二日星期六十一点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0199.wav", "duration": 3.4560625, "text": "避免海外一窝蜂上项目等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0292.wav", "duration": 7.0859375, "text": "要是詹妮弗劳伦斯也能在微博上说这个应用不错"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0209.wav", "duration": 4.5560625, "text": "调动各方发展粮食生产积极性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0170.wav", "duration": 6.5750625, "text": "当地新建商品住宅的房价多在每平方米三四千元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0334.wav", "duration": 5.5229375, "text": "经过前几年自动化生产线升级改造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0238.wav", "duration": 5.5, "text": "加强公共交通优先车道的监控和管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0262.wav", "duration": 5.9389375, "text": "不管是什么时候推出软件和开发一些超前的东西"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0128.wav", "duration": 3.767, "text": "而是我们对这个时代了解的太少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0293.wav", "duration": 3.442, "text": "但亏损达到了一点七亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0294.wav", "duration": 4.290875, "text": "从今年的七月二十一日便开始了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0373.wav", "duration": 7.2570625, "text": "俄俄罗斯队以全胜战绩列积分榜首位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0135.wav", "duration": 4.927, "text": "在自身优势领域发力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0438.wav", "duration": 4.1369375, "text": "李嘉诚怎么回答与中央关系有变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0254.wav", "duration": 5.8000625, "text": "但吃下去的药能否真正作用到病灶就很难说了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0240.wav", "duration": 5.2689375, "text": "鼓励使用生物农药高效低毒低残留农药和有机肥料"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0474.wav", "duration": 7.3571875, "text": "港媒中国城市告别血汗工厂经济转型见成效"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0220.wav", "duration": 3.635, "text": "山东潍坊的一位李先生告诉记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0299.wav", "duration": 3.015, "text": "最近都在流行做预测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0308.wav", "duration": 5.86, "text": "占全球空调压缩机市场三分之一的份额"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0387.wav", "duration": 6.608875, "text": "撑杆跳拉斐尔霍尔泽德斯佩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0314.wav", "duration": 5.0700625, "text": "家电企业机器人智造也正在加速进行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0362.wav", "duration": 3.249, "text": "如果能够战而胜之的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0190.wav", "duration": 8.4200625, "text": "人民银行多次提高存款准备金率和存贷款基准利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0364.wav", "duration": 3.8100625, "text": "被认为日本体育界的相关人士称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0420.wav", "duration": 3.8320625, "text": "似乎也让传言不攻自破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0155.wav", "duration": 5.3189375, "text": "为促进房地产市场平稳健康发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0393.wav", "duration": 3.4829375, "text": "他们也是历届大赛的一个亮点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0487.wav", "duration": 3.98, "text": "城改拆迁对很多村民来说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0192.wav", "duration": 8.485, "text": "国务院已批准信贷资产证券化继续扩大试点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0181.wav", "duration": 4.1059375, "text": "从申请到最后的拨放款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0141.wav", "duration": 5.753, "text": "大部分刚需购房者都可以选择公积金贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0364.wav", "duration": 5.296125, "text": "在各城市都有至少百支队伍报名参加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0236.wav", "duration": 4.896, "text": "加强鲜活农产品流通基础设施建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0482.wav", "duration": 6.6789375, "text": "港媒盘点亚洲千禧一代十大富豪九人是中国人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0195.wav", "duration": 3.348, "text": "向具有优势的行业集中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0342.wav", "duration": 4.6418125, "text": "恐怕又要传来不少女粉丝心碎的声音了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0277.wav", "duration": 6.4649375, "text": "可现在那些公司纷纷上市后疯狂是不是就暴露了呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0124.wav", "duration": 7.4040625, "text": "而这一落地难题也会影响其对刚需市场的支持效力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0215.wav", "duration": 2.879, "text": "有关负责人告诉记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0339.wav", "duration": 4.8269375, "text": "二零一五年初在南京的笼斗中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0194.wav", "duration": 3.5699375, "text": "二是政策支持将更加强化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0270.wav", "duration": 3.1750625, "text": "还有他对日本文化的迷恋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0216.wav", "duration": 3.938, "text": "要加强对民间借贷的合理引导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0406.wav", "duration": 3.177, "text": "来源时光网昨日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0252.wav", "duration": 3.708, "text": "另一个让南京市民特别关心的是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0367.wav", "duration": 3.3189375, "text": "用实际行动来弥补不足"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0182.wav", "duration": 2.878, "text": "较去年明显下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0233.wav", "duration": 5.8159375, "text": "农产品质量安全检验检测能力建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0239.wav", "duration": 3.3979375, "text": "提高生产流通组织化程度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0297.wav", "duration": 5.1320625, "text": "不过苹果官方很快澄清了这个事情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0398.wav", "duration": 4.187, "text": "在本次赛艇测试赛期间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0301.wav", "duration": 5.9770625, "text": "巨人网络盛大游戏以及完美世界均已选择了私有化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0424.wav", "duration": 3.4028125, "text": "满脸黑斑与大眼袋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0451.wav", "duration": 5.859125, "text": "港媒上海成为亚洲奢华生活最昂贵的城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0391.wav", "duration": 5.6440625, "text": "并要为国内外运动员献上一张张北京最美的名片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0401.wav", "duration": 6.7150625, "text": "海信一汽大众等知名企业和品牌也依旧亮相赛场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0428.wav", "duration": 3.4929375, "text": "搜狐娱乐讯据香港媒体报导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0157.wav", "duration": 6.133, "text": "市政府决定今年将全面加快棚户区改造步伐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0341.wav", "duration": 5.0798125, "text": "刘晓彤替补上场打得缩手缩脚的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0300.wav", "duration": 6.8200625, "text": "从台湾地区进口的此类产品存在倾销行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0442.wav", "duration": 10.3620625, "text": "当地村民孙秋英在自家门口因是否垫路与邻居产生争执"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0463.wav", "duration": 9.183125, "text": "十四日开宝马来上班重庆晨报记者罗伟雷罗伟雷键摄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0231.wav", "duration": 4.0129375, "text": "对重点地区行业和企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0267.wav", "duration": 4.84, "text": "但它的确算不上是智能手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0174.wav", "duration": 6.6529375, "text": "远低于去年和前年平均的二十亿平米水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0433.wav", "duration": 5.746125, "text": "千面娇娃绝地反击拿下最后一席歌王头衔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0379.wav", "duration": 6.1230625, "text": "甚至有日本的大牌经纪公司希望与其签约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0172.wav", "duration": 3.369, "text": "购买的机会受时间的制约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0190.wav", "duration": 6.683, "text": "债券市场所有品种发行利率整体上都表现出向上的走向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0254.wav", "duration": 8.7530625, "text": "二零一四年三星期累计销售超过一百二十万块智能手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0207.wav", "duration": 7.4189375, "text": "事关全国农业现代化进程和国家粮食安全大局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0322.wav", "duration": 4.5439375, "text": "如果许多传统制造行业中的企业一样"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0183.wav", "duration": 4.498, "text": "第一次在公积金上提出差别对待"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0201.wav", "duration": 4.412, "text": "积极推动优势农产品出口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0167.wav", "duration": 5.811, "text": "政府对今年的土地出让金收入预期下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0495.wav", "duration": 6.9709375, "text": "该医院党委书记杨幼萍向晚报记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0178.wav", "duration": 2.8689375, "text": "约可供销售四年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0142.wav", "duration": 4.1130625, "text": "北京公积金贷款成交量上涨百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0327.wav", "duration": 3.5, "text": "在接受调查的这些公司中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0212.wav", "duration": 3.8559375, "text": "农业社会化服务体系不健全"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0163.wav", "duration": 4.271, "text": "为利率市场化改革创造条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0447.wav", "duration": 2.6440625, "text": "记者联系发微博男子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0283.wav", "duration": 4.5, "text": "也正是看中了中国消费者的消费潜力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0414.wav", "duration": 4.5129375, "text": "谢贤昨天庆祝七十九岁生日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0361.wav", "duration": 3.933, "text": "颜妮坦言今天俄罗斯表现很好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0312.wav", "duration": 3.722875, "text": "又未直接产生经济效益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0344.wav", "duration": 5.016125, "text": "北京冬奥会的硬件基础要强于阿拉木图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0212.wav", "duration": 3.4859375, "text": "逐步恢复湿地生态功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0421.wav", "duration": 11.9509375, "text": "贵州都市报十月二十九日报道据台湾媒体报道艺人陈妍希认爱小四岁的大陆小生陈晓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0307.wav", "duration": 2.8010625, "text": "除了能和手机一样接打电话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0446.wav", "duration": 4.8630625, "text": "比如就中国游客热衷日本药品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0445.wav", "duration": 3.3559375, "text": "因此一篇似是而非的文章"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0295.wav", "duration": 5.3160625, "text": "但是作为一个仍在成长没有其他对手的市场来讲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0303.wav", "duration": 5.0489375, "text": "上述公司人士对每日经济新闻记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0124.wav", "duration": 6.011, "text": "公积金政策调整方式各异对楼市影响几何"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0122.wav", "duration": 6.578, "text": "引领中国房地产广告行业走向新的黄金时代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0150.wav", "duration": 3.386, "text": "同比涨幅达到百分之四"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0182.wav", "duration": 3.7460625, "text": "转型后的今久整合营销集团"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0463.wav", "duration": 3.880125, "text": "她身上少了些以往的悍将拼劲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0279.wav", "duration": 3.4620625, "text": "全世界的报道已经蜂拥而至"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0189.wav", "duration": 3.5089375, "text": "公共娱乐场所清理整顿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0413.wav", "duration": 5.75, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0143.wav", "duration": 3.327, "text": "买家积极咨询看楼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0182.wav", "duration": 3.968, "text": "上调公积金贷款额度对市场的刺激是短期的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0206.wav", "duration": 9.657, "text": "需要为各地的城市建设提供规范的融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0493.wav", "duration": 6.4050625, "text": "温州一村主任台风夜转移群众其妻子遇难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0465.wav", "duration": 4.432125, "text": "长沙县湘龙西路一处十字路口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0182.wav", "duration": 3.7960625, "text": "以及营业税免征期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0345.wav", "duration": 3.5339375, "text": "因为每个人都需要呼吸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0169.wav", "duration": 3.258, "text": "购房的扶持力度在加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0171.wav", "duration": 4.911, "text": "广州还是在执行严厉的限购政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0343.wav", "duration": 6.6950625, "text": "我都会对站立技术进行重点强化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0161.wav", "duration": 5.1139375, "text": "羊年置业小调查的调查结果截图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0127.wav", "duration": 4.453, "text": "中原地产首席分析师张大伟说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0381.wav", "duration": 5.202875, "text": "八百米罗宾斯切姆贝拉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0474.wav", "duration": 7.3449375, "text": "温州首家支付宝菜市场启动一周很多摊主不会用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0312.wav", "duration": 3.3519375, "text": "如何重新激活内部潜能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0131.wav", "duration": 4.153, "text": "国家住房银行是否箭在弦上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0123.wav", "duration": 4.0, "text": "但因为聚集了过多公共资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0133.wav", "duration": 6.523, "text": "公积金大力度松绑相关商业银行信贷政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0205.wav", "duration": 4.597, "text": "发展现代农业的要求更加迫切"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0260.wav", "duration": 4.9289375, "text": "作为美国本土著名社交游戏开发商"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0231.wav", "duration": 4.338, "text": "积极推动基金产品审核制度改革"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0179.wav", "duration": 5.0530625, "text": "但可以肯定的他一定是最高成长的企行业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0125.wav", "duration": 3.156, "text": "由公积金中心向银行支付"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0433.wav", "duration": 7.962125, "text": "其中四名被告分别判即时监禁九至一一天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0467.wav", "duration": 4.691875, "text": "公安局仍采取了取保候审的手段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0348.wav", "duration": 3.573, "text": "表示未来会进入演艺圈发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0227.wav", "duration": 4.548, "text": "这并不意味着政府可以无节制地借债"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0233.wav", "duration": 5.038, "text": "并对政府性债务实行馀额管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0254.wav", "duration": 5.146, "text": "作风向来无耻加强势苹果也因强势出名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0186.wav", "duration": 4.3719375, "text": "公积金可贷额度受到严重冲击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0338.wav", "duration": 5.149875, "text": "据悉他正在积极进修表演准备进入演艺圈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0391.wav", "duration": 3.19675, "text": "还有三场非常重要的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0401.wav", "duration": 8.192125, "text": "英国人保拉拉德克利夫公开了自己的血液检测结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0228.wav", "duration": 3.391, "text": "更好地适应了新形势的需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0129.wav", "duration": 6.558, "text": "并对异地缴存住房公积金等政策作出调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0407.wav", "duration": 1.951875, "text": "值得一提的是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0428.wav", "duration": 5.542, "text": "陈妍希曾在新版神鵰侠侣中演小龙女"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0304.wav", "duration": 4.7279375, "text": "美的家用空调事业部总裁吴文新表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0284.wav", "duration": 3.699, "text": "苹果能否摆脱王者魔咒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0189.wav", "duration": 4.0820625, "text": "有关部门和社会各界积极响应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0151.wav", "duration": 3.696, "text": "对购房者心理影响也非常大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0412.wav", "duration": 5.067875, "text": "搜狐娱乐讯北京时间七月二十日消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0198.wav", "duration": 3.251, "text": "发展混合所有制经济"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0478.wav", "duration": 7.9311875, "text": "村支书将两女儿家七口人列为搬迁户骗领搬迁款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0302.wav", "duration": 5.277125, "text": "这将是苹果零售店采用的全新模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0390.wav", "duration": 7.868875, "text": "然而就在全场仅剩下莫利托一个人的最后一掷时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0331.wav", "duration": 3.291, "text": "未获得进网许可证的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0409.wav", "duration": 3.545875, "text": "此照片萌翻众网友"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0293.wav", "duration": 4.224125, "text": "如今则猛增到一两亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0442.wav", "duration": 7.5920625, "text": "目前该保安承认有人花二百元雇他进行拍照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0435.wav", "duration": 9.45775, "text": "京华时报讯记者迟名常鑫前天中午近一一点半"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0287.wav", "duration": 3.0349375, "text": "那么未来的五年十年二十年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0457.wav", "duration": 5.0449375, "text": "被同方向行驶的一辆渣土车挂倒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0380.wav", "duration": 4.6328125, "text": "计划在那里进行三个月的封闭训练"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0159.wav", "duration": 3.727, "text": "近来看到的许多创新型产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0176.wav", "duration": 3.477, "text": "各项费用的加总并不低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0329.wav", "duration": 3.313, "text": "但是由于直销改为经销"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0212.wav", "duration": 7.084, "text": "为各地的基础设施建设提供有制度保障的融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0160.wav", "duration": 3.0300625, "text": "在信托收益的处置上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0329.wav", "duration": 8.6689375, "text": "成飞集成与常州市金坛区政府合作的项目将分三期完成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0417.wav", "duration": 2.667, "text": "希饭快来接住我"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0487.wav", "duration": 4.3759375, "text": "李晨秀才遇到兵发布会后回应称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0450.wav", "duration": 5.26, "text": "湖北吃人电梯品牌四年被曝光五次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0406.wav", "duration": 4.281, "text": "约翰尼德普紧随其后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0133.wav", "duration": 3.67, "text": "还清首套房公积金贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0344.wav", "duration": 3.0918125, "text": "脚踝和小腿的能力变弱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0289.wav", "duration": 6.9730625, "text": "本报记者纪佳鹏北京报道北京时间八月十二日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0318.wav", "duration": 4.702875, "text": "除了传统的书包文具以及辅导书外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0248.wav", "duration": 6.5390625, "text": "从城投债券发行监管部门的角度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0388.wav", "duration": 3.0, "text": "经历过夏奥会的沉淀"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0442.wav", "duration": 7.063, "text": "媒体再次盘点长假期间的各种热点新闻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0397.wav", "duration": 4.8979375, "text": "日本的排球训练是出了名的严厉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0489.wav", "duration": 7.1860625, "text": "湖北四名被捅法官脱离危险一女法官尚在哺乳期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0219.wav", "duration": 4.3630625, "text": "仍然会存在并具有发展空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0413.wav", "duration": 3.7590625, "text": "甚至出现忧郁症状况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0212.wav", "duration": 6.494, "text": "而针对浙江广东民间借贷丰沛的特点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0359.wav", "duration": 4.0650625, "text": "这场比赛前教练给我们布置了很多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0215.wav", "duration": 5.5, "text": "重点关注大型电子商务经营者的促销行为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0456.wav", "duration": 6.1650625, "text": "区市省三级疾控部门专家已介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0133.wav", "duration": 3.6100625, "text": "年内首次出现同比增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0344.wav", "duration": 3.4350625, "text": "今后北京与天津两地可能会联合办赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0408.wav", "duration": 3.755875, "text": "柯震东去年经历吸毒风波"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0157.wav", "duration": 3.469, "text": "确保所设信托的合法性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0436.wav", "duration": 6.28, "text": "温州一网友造谣苏迪罗登陆期间水库崩塌被拘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0219.wav", "duration": 2.879, "text": "发行规模还会稳步扩大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0168.wav", "duration": 6.379, "text": "通知指出除北上广深一线城市外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0303.wav", "duration": 3.9549375, "text": "如果融入移动互联的新时代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0214.wav", "duration": 9.0090625, "text": "将在有效防范民间借贷的潜在风险的前提下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0423.wav", "duration": 4.574, "text": "这让自称游戏达人的他颇有些不好意思"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0386.wav", "duration": 4.418, "text": "顶级田径赛事再次落户鸟巢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0442.wav", "duration": 3.6179375, "text": "学校里有些同学家里条件不好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0217.wav", "duration": 6.3780625, "text": "强化地方政府和企业的主体意识法制意识"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0283.wav", "duration": 9.0, "text": "一起针对苹果的集体反垄断案两名原告的律师称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0397.wav", "duration": 5.194, "text": "这也是她在本届世界杯上第二次获得全场最佳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0384.wav", "duration": 8.8840625, "text": "昆仑决雄霸山城在重庆江南体育馆重装上阵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0285.wav", "duration": 5.647, "text": "后有消息称该款产品将于今年的情人节推出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0163.wav", "duration": 3.171, "text": "在多项政策的支持下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0277.wav", "duration": 3.667, "text": "刚开始微软因谨慎起见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0344.wav", "duration": 5.839, "text": "此外她还凭借拦网和发球分别拿到七分和一分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0234.wav", "duration": 4.1340625, "text": "坚持科教兴农和人才强农"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0229.wav", "duration": 5.803, "text": "如建立规范透明的地方政府融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0330.wav", "duration": 4.49, "text": "在中低端市场或占有相应份额"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0221.wav", "duration": 3.9260625, "text": "而社会罢工劳资纠纷也时有发生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0427.wav", "duration": 8.348875, "text": "不过二人因给陈嘉宝把生日合照在网上公开才泄露恋情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0209.wav", "duration": 4.432, "text": "为加快发展中等职业教育"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0124.wav", "duration": 3.769, "text": "很多人受限购政策的影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0457.wav", "duration": 3.5398125, "text": "当时他还不知道自己会被暗算"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0352.wav", "duration": 4.3838125, "text": "从举办大型体育赛事的经验来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0467.wav", "duration": 3.568125, "text": "但是养老院建成至今已经有三年了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0336.wav", "duration": 4.093, "text": "随着锂电池产业链迎来井喷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0334.wav", "duration": 5.369125, "text": "虽然面对赔钱赚吆喝的质疑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0376.wav", "duration": 4.0229375, "text": "虽然在比赛中没有得到出场机会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0220.wav", "duration": 4.1690625, "text": "实施一村一品强村富民工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0217.wav", "duration": 3.5269375, "text": "随着我国资本市场的进一步发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0144.wav", "duration": 5.207, "text": "各区县各单位要按照下达的任务指标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0210.wav", "duration": 5.0639375, "text": "研发推出不同的金融创新产品和服务方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0227.wav", "duration": 5.9549375, "text": "坚持立足国内实现粮食基本自给的方针"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0247.wav", "duration": 4.364, "text": "这体现出监管部门开放管理的思路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0242.wav", "duration": 5.6860625, "text": "这在相当程度上控制了城投债劵的发行规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0380.wav", "duration": 3.681875, "text": "做客日本电视台的新闻节目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0292.wav", "duration": 3.48, "text": "毕竟还有许多人的心愿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0417.wav", "duration": 4.3620625, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0273.wav", "duration": 7.1059375, "text": "屏幕良品率仅在百分之三十至百分之四十之间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0375.wav", "duration": 4.082, "text": "让他们也可以有机会参与体育运动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0444.wav", "duration": 6.420875, "text": "湖北卷人电梯设计不合理同型号已售四六四八部"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0199.wav", "duration": 4.6900625, "text": "投资者对城投债券风险表现出的恐慌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0243.wav", "duration": 3.9, "text": "相对于目前的负债规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0475.wav", "duration": 6.5590625, "text": "淅川县上集镇一名村支书被指将年龄改小一零岁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0140.wav", "duration": 2.483, "text": "而在多时间里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0130.wav", "duration": 3.144, "text": "我们的路也许会好走得多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0133.wav", "duration": 3.991, "text": "国家统计局数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0254.wav", "duration": 3.579, "text": "我们在科技创新方面的进步非常显着"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0259.wav", "duration": 3.495, "text": "它可以跨硬件平台传染"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0344.wav", "duration": 6.2160625, "text": "铅球克里斯蒂娜斯齐万兹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0318.wav", "duration": 5.8100625, "text": "随着越来越多车企踊跃加入车联网浪潮中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0139.wav", "duration": 4.4100625, "text": "今年万科拿下九宗地块"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0236.wav", "duration": 8.349, "text": "今年国庆小长假期间私家车主们就可以免费上路了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0408.wav", "duration": 3.7890625, "text": "圆圆的脸蛋非常的可爱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0348.wav", "duration": 4.3600625, "text": "不乏诸多脍炙人口的飙血之战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0283.wav", "duration": 6.582, "text": "领英在榜单上的成绩也是相当不错的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0470.wav", "duration": 4.0900625, "text": "一辆渣土车突然冲向逆向车道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0280.wav", "duration": 8.0, "text": "英特尔首席执行官布赖恩克尔扎尼奇在一份声明中说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0302.wav", "duration": 5.0600625, "text": "首先银联和苹果的合作谈判不会顺利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0360.wav", "duration": 5.833, "text": "图片中他们一行人面对镜头尽显搞怪天赋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0147.wav", "duration": 3.157, "text": "三四线城市依然冷清"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0384.wav", "duration": 6.3090625, "text": "一百一十米栏马特里亚斯布赫雷尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0357.wav", "duration": 6.0708125, "text": "无论年轻队员还是老队员都可能在比赛中出现起伏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0444.wav", "duration": 3.3789375, "text": "也就是我们常说的超级月亮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0123.wav", "duration": 3.302, "text": "经济热点导读专家认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0183.wav", "duration": 5.229, "text": "贷款最高额度由五万元升至七万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0390.wav", "duration": 4.969, "text": "而他们已经为这次田径世锦赛做好了准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0379.wav", "duration": 6.2800625, "text": "队伍凭借稳定的整体发挥获得了三零的胜利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0472.wav", "duration": 6.033, "text": "一段游客暴打景区员工的视频开始在网上发酵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0169.wav", "duration": 3.7790625, "text": "也佐证了公积金政策放宽刺激作用的显现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0465.wav", "duration": 7.943125, "text": "温州火锅先生后续涉案者父亲写公开道歉信"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0174.wav", "duration": 4.282, "text": "从目前上海住房公积金的具体政策看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0349.wav", "duration": 4.709, "text": "申奥过程本身已经推动了城际交通建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0251.wav", "duration": 4.1749375, "text": "完善农产品市场调控机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0129.wav", "duration": 5.81, "text": "如果我们懂得多一点智能家居产品市场的法则"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0121.wav", "duration": 3.601, "text": "公积金贷款额度的提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0305.wav", "duration": 5.095, "text": "公司已将原有的直销模式改为经销模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0411.wav", "duration": 4.6950625, "text": "称哈哈哈性感的不要不要的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0155.wav", "duration": 3.489, "text": "实现了大数据营销的创新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0210.wav", "duration": 5.3139375, "text": "对非主业投资项目的有关决策文件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0286.wav", "duration": 4.344, "text": "而且苹果最早一批的用户积累"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0221.wav", "duration": 5.15, "text": "扩大东北优势区粳稻种植面积"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0133.wav", "duration": 4.121, "text": "以住房公积金制度为基础"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0486.wav", "duration": 5.0869375, "text": "酒店方承诺退还二零元马桶使用费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0187.wav", "duration": 5.2960625, "text": "直接涉及到债券持有人利益的保护问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0392.wav", "duration": 4.93925, "text": "没有你们的支持我们该如何度过最挣扎的时期呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0207.wav", "duration": 5.301, "text": "积极防范和妥善应对市场价格异常波动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0393.wav", "duration": 6.5, "text": "莎宾娜已经在今年八月秘密抵达日本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0321.wav", "duration": 5.2690625, "text": "撤销旗下高端产业集团和产品开发集团"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0157.wav", "duration": 3.196, "text": "产品的核心是客户的体验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0305.wav", "duration": 4.4140625, "text": "该平台上显示的漏洞状态是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0274.wav", "duration": 4.6049375, "text": "此次以一百六十七亿美元收购拓朗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0279.wav", "duration": 4.337, "text": "苹果一口气召开了两次新品发布会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0292.wav", "duration": 3.3899375, "text": "因此从全球的角度来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0407.wav", "duration": 3.228, "text": "将双双加盟该片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0470.wav", "duration": 6.9931875, "text": "杀害女教师疑犯行凶后脸有伤警方悬赏五万缉拿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0285.wav", "duration": 5.4301875, "text": "这些资源的特点不单单是数目庞大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0439.wav", "duration": 4.953875, "text": "资料图王杰图片来源于网络"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0404.wav", "duration": 8.719, "text": "布拉德皮特新片狂怒接受了宣传媒体拍照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0379.wav", "duration": 5.4140625, "text": "一百米塞文基尼菲尔斯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0194.wav", "duration": 7.098, "text": "组建一批产业技术创新战略联盟和国家农业科技园区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0263.wav", "duration": 3.3200625, "text": "他们真得赚了很多钱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0272.wav", "duration": 3.8719375, "text": "客户回到苹果零售店后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0298.wav", "duration": 6.0, "text": "生态链中插入其他公司产品会造成问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0307.wav", "duration": 5.093, "text": "整个汽车体系都是随着汽车销量在变动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0200.wav", "duration": 3.156, "text": "支持龙头企业跨区域经营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0269.wav", "duration": 4.6790625, "text": "游戏公司往往靠一款游戏在市场上火爆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0191.wav", "duration": 3.104, "text": "长江隧道估计也顶不住"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0192.wav", "duration": 3.713, "text": "制定鲜活农产品调控办法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0445.wav", "duration": 4.0239375, "text": "近日再度拒绝女方的逼婚后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0150.wav", "duration": 5.656, "text": "五月份商品房销售的面积同比数据由负转正"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0184.wav", "duration": 4.903, "text": "一线城市住宅用地的低价不断抬升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0233.wav", "duration": 4.537, "text": "推动苹果柑橘等优势园艺产品生产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0356.wav", "duration": 6.735125, "text": "参加全国竞走大奖赛暨世锦赛选拔赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0495.wav", "duration": 4.907, "text": "于二零一四年四月一九日晚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0182.wav", "duration": 5.156, "text": "各路开发商一致看好一线城市房地产市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0329.wav", "duration": 3.1210625, "text": "工人数量超过五万以上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0438.wav", "duration": 7.462875, "text": "因决定取消刁天恩的土地承包合同移栽地上树苗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0417.wav", "duration": 3.0600625, "text": "对着镜头嘟嘴吐舌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0211.wav", "duration": 3.5340625, "text": "棉油糖生产基地建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0129.wav", "duration": 5.073, "text": "此次出台的新政虽然放宽了条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0361.wav", "duration": 5.772, "text": "高桥大辅则是噘着嘴做出索吻的动作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0305.wav", "duration": 5.4459375, "text": "对手表的大力普及也起到了至关重要的作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0201.wav", "duration": 3.4760625, "text": "提高科学饲养和经营水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0300.wav", "duration": 8.6530625, "text": "以上大多数专利都与计算软件及相关技术有关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0395.wav", "duration": 4.5349375, "text": "临时客串接应在二号位参与强攻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0191.wav", "duration": 4.335, "text": "提高农业产业化和规模化经营水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0454.wav", "duration": 7.402125, "text": "港媒关注天价虾店停业破坏青岛形象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0296.wav", "duration": 4.6020625, "text": "苹果市场价值达到七千亿美元刚刚过去几个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0152.wav", "duration": 8.0350625, "text": "丰台区域潘家村危改三号地成为今年的收官地质块"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0484.wav", "duration": 7.7009375, "text": "浙江温州市一位市民一零零元买回三只斑节虾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0232.wav", "duration": 5.3149375, "text": "免征蔬菜流通环节增值税加强金融支持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0216.wav", "duration": 4.6229375, "text": "加强园艺作物标准园建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0368.wav", "duration": 7.287125, "text": "万龙和云顶滑雪场都将根据赛事要求进行改造和扩建"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0209.wav", "duration": 4.099, "text": "记者昨日从省交通部门了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0224.wav", "duration": 9.166, "text": "推广土壤有机质提升测土配方施肥等培肥地力技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0341.wav", "duration": 6.506875, "text": "包括高原训练或身体过度消耗后立刻接受检测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0135.wav", "duration": 4.039, "text": "该政策延续了去年新政以来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0217.wav", "duration": 5.329, "text": "相对于过去的体制而言是更加市场化的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0293.wav", "duration": 4.163, "text": "基于倾销幅度的初裁结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0130.wav", "duration": 7.794, "text": "北京市公积金管理中心明确取消新建商品房评估"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0204.wav", "duration": 4.1939375, "text": "我个人是这么认识的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0173.wav", "duration": 8.458, "text": "放松对外限制利用利好一二线城市中高端物业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0408.wav", "duration": 3.6059375, "text": "私底下对歌迷亲切和善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0316.wav", "duration": 6.2580625, "text": "机器换人确实能够大大降低企业的用工数量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0490.wav", "duration": 4.1179375, "text": "而是因为她也中了天价的招"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0430.wav", "duration": 2.308125, "text": "获得粉丝祝福"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0161.wav", "duration": 6.168, "text": "广州二手住宅市场七月的网签量已达一千套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0340.wav", "duration": 4.1279375, "text": "大家才安安稳稳地睡了一觉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0349.wav", "duration": 9.733125, "text": "著名双人滑运动员庞清和董健虽未正式宣布退役"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0320.wav", "duration": 6.6860625, "text": "紫光股份云计算股收涨停搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0226.wav", "duration": 8.0019375, "text": "尽快将中央补助投资和省级配套资金分解下达到市县"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0470.wav", "duration": 4.4311875, "text": "随后众人一起到东山派出所报案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0351.wav", "duration": 3.777125, "text": "朱婷扣球拿下一百一十三分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0284.wav", "duration": 4.563, "text": "美国将向印度转让两项军事技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0216.wav", "duration": 3.2009375, "text": "完善土地承包经营权流转市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0336.wav", "duration": 3.337875, "text": "公司继续推进云服务战略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0468.wav", "duration": 3.4150625, "text": "大排档老板受伤更严重"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0416.wav", "duration": 5.313, "text": "由于谢霆锋亲为家人做大厨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0247.wav", "duration": 2.802, "text": "降低农产品流通成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0457.wav", "duration": 3.660875, "text": "滕女士在云南购买的石斛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0483.wav", "duration": 3.827125, "text": "目前仍有八名失踪人员下落不明"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0261.wav", "duration": 6.336875, "text": "莫说跟其他创意十足的科技股相提并论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0257.wav", "duration": 4.6059375, "text": "而且它们两个之间是非常对立的关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0408.wav", "duration": 4.864, "text": "陈奕迅隔空发表爱的宣言也是啊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0222.wav", "duration": 4.6490625, "text": "提高公共交通舒适性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0420.wav", "duration": 3.816875, "text": "手脚并用努力向往上爬"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0121.wav", "duration": 6.938, "text": "成本的转嫁使得商品房用地成本更高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0392.wav", "duration": 2.8461875, "text": "身为大队员就会去提醒大家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0155.wav", "duration": 4.854, "text": "中原地产市场研究部数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0126.wav", "duration": 4.91, "text": "增速比一到六月回落一个百分点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0177.wav", "duration": 4.0450625, "text": "不得办理境内境外贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0188.wav", "duration": 5.254, "text": "证监会将协同有关部门落实相关工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0366.wav", "duration": 3.318, "text": "作为老队员我要多承担"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0259.wav", "duration": 3.228, "text": "乔布斯几乎没发挥什么作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0417.wav", "duration": 2.786125, "text": "外传她可能已经怀孕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0479.wav", "duration": 5.701875, "text": "温州农贸市场现注胶虾业内人称为增加重量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0255.wav", "duration": 6.272, "text": "中国手游在退市之前的市盈率在十六十七倍左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0208.wav", "duration": 6.8940625, "text": "中央企业在境外从事非主业投资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0343.wav", "duration": 6.771, "text": "美国东卡罗莱纳大学和维克森林大学的研究者认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0436.wav", "duration": 3.3730625, "text": "面对游客质疑和退团要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0202.wav", "duration": 4.9599375, "text": "扶持农业信贷担保组织发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0170.wav", "duration": 4.256, "text": "今年的房价还会有上升空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0173.wav", "duration": 4.201, "text": "伟业我爱我家集团副总裁胡景晖分析"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0163.wav", "duration": 4.019, "text": "这是一帮精英自恋情怀的产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0349.wav", "duration": 4.542, "text": "全能詹妮弗奥赛尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0145.wav", "duration": 6.42, "text": "公积金贷款首付比例降低的消息令购房者喜出望外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0475.wav", "duration": 8.167, "text": "关于中国嵩山少林寺方丈齐永信的举报风波尚未停歇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0276.wav", "duration": 4.108, "text": "正在寻求扩大移动市场份额"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0335.wav", "duration": 4.475875, "text": "黑客可利用这些漏洞远程打开车门"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0273.wav", "duration": 4.2170625, "text": "但是在欧洲受欢迎度较低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0383.wav", "duration": 5.548125, "text": "他们对退役后的人生同样也有追求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0327.wav", "duration": 4.746, "text": "儿童电话手表的辐射对儿童的健康安全是否存在隐患呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0131.wav", "duration": 3.9469375, "text": "确立了无人撼动的行业老大地位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0310.wav", "duration": 4.1628125, "text": "由于安丰公司的业务不景气"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0353.wav", "duration": 3.6811875, "text": "北京的经验比阿拉木图丰富"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0400.wav", "duration": 6.0, "text": "雅莱克斯欧帕拉迪尼门格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0257.wav", "duration": 4.587875, "text": "证明他们真得没有手机用户信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0295.wav", "duration": 4.5979375, "text": "中国商务部曾表示强烈反对"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0453.wav", "duration": 3.6159375, "text": "替人向境外转移资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0392.wav", "duration": 3.9719375, "text": "标枪拉尔斯哈曼恩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0449.wav", "duration": 5.2060625, "text": "判处有期徒刑一一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0445.wav", "duration": 6.797875, "text": "所开拉土车辆是镇政府扣押车辆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0269.wav", "duration": 5.4920625, "text": "快速建立以苹果产品服务为核心的生态系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0229.wav", "duration": 4.272, "text": "完善主产区利益补偿机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0451.wav", "duration": 3.3730625, "text": "经保险公司初步估算"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0190.wav", "duration": 4.09, "text": "主要指草原生态经济区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0431.wav", "duration": 6.661875, "text": "湖北六小伙温州偷硬币称代表诸葛后人战刘伯温后人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0304.wav", "duration": 4.8451875, "text": "裁员二千人是由于销售模式发生改变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0233.wav", "duration": 8.1530625, "text": "由于我国还没有建立统一的地方政府债务风险管理制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0294.wav", "duration": 3.4389375, "text": "反复检视自身商业模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0224.wav", "duration": 5.123875, "text": "相当部分资产具有长期的直接收益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0186.wav", "duration": 4.4500625, "text": "美丽北京大型绿色公益品牌项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0152.wav", "duration": 8.049, "text": "主动退出和寻求并购的中小开发商增多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0352.wav", "duration": 3.1789375, "text": "研究者们选取了十九位跑者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0309.wav", "duration": 4.3139375, "text": "预计回购股份约一千万股"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0242.wav", "duration": 6.547, "text": "各地要依据城市总体规划和城市网点商业规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0216.wav", "duration": 5.8820625, "text": "当代人和后代人共同承担债务还本付息责任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0464.wav", "duration": 3.073, "text": "父亲和孩子轮流上去躺"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0481.wav", "duration": 7.005875, "text": "渤海失事河北籍渔船已致四人遇难仍有八人失踪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0479.wav", "duration": 4.672875, "text": "为了一名坠入废井的男童"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0431.wav", "duration": 6.917, "text": "校长邱勇上任后首次参加学生毕业典礼并演讲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0428.wav", "duration": 3.516875, "text": "因此开香槟后要先离场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0230.wav", "duration": 5.443, "text": "一些专家学者提出了许多好的建议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0331.wav", "duration": 5.031, "text": "工人数量已经缩减至二点六万人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0341.wav", "duration": 6.538125, "text": "迅即杀狠的站立技术令人惊叹不已"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0383.wav", "duration": 3.5241875, "text": "华西都市报记者陈甘露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0333.wav", "duration": 5.572, "text": "杨某等人在明知插件功能的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0344.wav", "duration": 5.223, "text": "而涂鸦墙上写满了跑友们的目标和愿望"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0393.wav", "duration": 4.968, "text": "对已是强弩之末的对手进行消耗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0224.wav", "duration": 5.477, "text": "加强公共交通用地综合开开发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0307.wav", "duration": 4.396, "text": "这是当前所有中国家电企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0156.wav", "duration": 5.8840625, "text": "境外个人购房应当符合当地政策规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0243.wav", "duration": 4.65, "text": "大城市郊区多功能农业区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0260.wav", "duration": 7.2009375, "text": "可用于侦察缓慢移动的地面和海面目标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0185.wav", "duration": 4.0589375, "text": "与其厌不其烦的谈论大数据云计算"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0482.wav", "duration": 6.9560625, "text": "村官借四零零多户居民三亿一携款失联"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0443.wav", "duration": 5.9230625, "text": "但是想让更多需要帮助的水高学子感受到温暖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0307.wav", "duration": 6.584, "text": "公司此次回购股份的价格不超过十五点一零七元股"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0473.wav", "duration": 6.515875, "text": "平阳法院内外已聚集了三零零多人等待开庭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0319.wav", "duration": 7.05075, "text": "这个儿童电话手表以其强大的定位通话微聊等功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0145.wav", "duration": 3.467, "text": "制定完善制度一百多项"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0318.wav", "duration": 3.612875, "text": "随着锂电池产业链迎来井喷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0133.wav", "duration": 3.237, "text": "对楼市也有较大影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0295.wav", "duration": 3.39, "text": "中国经营网注有国外媒体报道称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0364.wav", "duration": 3.484125, "text": "年龄段的复盖范围比较窄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0323.wav", "duration": 4.2049375, "text": "洛阳本部项目是一个增量投资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0292.wav", "duration": 2.968, "text": "这也是影响股价的一大因素"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0459.wav", "duration": 8.5, "text": "旅游点餐时与海鲜店主起争执互殴二人被行政拘留"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0346.wav", "duration": 3.0, "text": "他们会拥有较快的速度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0190.wav", "duration": 3.7049375, "text": "采取了一系列的政策措施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0197.wav", "duration": 2.9459375, "text": "债券发行人是优质的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0310.wav", "duration": 3.619875, "text": "而选择国产的服务器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0403.wav", "duration": 5.26, "text": "例如在竞赛部赛后控制中心的陈田希"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0435.wav", "duration": 4.3581875, "text": "获救第一句话就是我以为我活不了了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0486.wav", "duration": 3.6420625, "text": "该男子因影响航班正常秩序"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0406.wav", "duration": 3.8500625, "text": "可现在已经全部泡汤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0405.wav", "duration": 6.797125, "text": "其首脑恩斯特布鲁菲尔是邦德的最终敌人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0222.wav", "duration": 5.3320625, "text": "一路上很多省份的高速公路收费站都是免费放行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0159.wav", "duration": 5.291, "text": "优化和改进外商投资房地产管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0271.wav", "duration": 7.262, "text": "先是价格昂贵功能鸡肋的特点遭到一众业内人士吐槽"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0309.wav", "duration": 4.4099375, "text": "电话手表的辐射主要来自天线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0223.wav", "duration": 4.193, "text": "目前央企境外投资仍处在初级阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0439.wav", "duration": 7.208, "text": "快报讯通讯员李欢乐记者王晓宇八月二六日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0265.wav", "duration": 5.7950625, "text": "亏损二千六百九十万美元相比上一季度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0202.wav", "duration": 5.243875, "text": "您如何看待城投债券这几年的发展和作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0240.wav", "duration": 6.5250625, "text": "培育一批产值过百亿元的大型加工和流通企业集团"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0145.wav", "duration": 11.4049375, "text": "互联网行动计划实实施用地实行过渡期政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0468.wav", "duration": 5.6601875, "text": "将小女孩抱在腿上并播放手机中的动画片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0308.wav", "duration": 6.0190625, "text": "虽然工信部很快就删除了后半句话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0402.wav", "duration": 5.614, "text": "来自中国的赛艇选手崔帅豪说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0178.wav", "duration": 3.002, "text": "在过去六个月中处于高点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0330.wav", "duration": 3.718, "text": "同比增长四点百分之三十五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0312.wav", "duration": 3.509, "text": "每日经济新闻记者注意到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0433.wav", "duration": 3.8679375, "text": "旅行社为了盈利设置购物环节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0484.wav", "duration": 5.4760625, "text": "冲突因空姐发餐时餐车碰到了一名旅客"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0411.wav", "duration": 2.3681875, "text": "她自言最近在拍戏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0143.wav", "duration": 3.127, "text": "北京信托作为受托人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0390.wav", "duration": 4.045875, "text": "在其左扫腿无情踢击之下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0180.wav", "duration": 9.245, "text": "而是北京上海广州深圳可在国家统一政策基础上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0144.wav", "duration": 3.5950625, "text": "以深圳智能锁业代表为例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0226.wav", "duration": 3.521, "text": "提高脱毒种薯供给能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0350.wav", "duration": 6.0769375, "text": "但现在的生活已经进入了准退役状态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0345.wav", "duration": 6.2590625, "text": "到时将会成为冬奥会志愿者的主力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0237.wav", "duration": 5.046, "text": "大力发展资本技术密集型农业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0171.wav", "duration": 5.9860625, "text": "房价的一涨一跌都牵动着购房者的神经"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0441.wav", "duration": 5.6811875, "text": "黄煜坤被警方送到附近医院接受检查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0473.wav", "duration": 3.326875, "text": "如果放弃学习没有追求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0327.wav", "duration": 3.7259375, "text": "这些挑战来自于四面八方"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0138.wav", "duration": 4.3, "text": "公积金对楼市的扶持力度不断加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0160.wav", "duration": 4.146, "text": "除上述政策调整以外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0399.wav", "duration": 3.093, "text": "而第三次申办周期内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0466.wav", "duration": 4.80175, "text": "警方先后解救了一六名婴儿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0307.wav", "duration": 3.228, "text": "不存在实际健康问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0134.wav", "duration": 4.693, "text": "可以重点关注如何做强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0167.wav", "duration": 4.5, "text": "再由国家住房银行提供低息贷款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0269.wav", "duration": 5.7259375, "text": "苹果在成长为万亿美元市场的巨无霸之前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0161.wav", "duration": 9.605, "text": "此番公积金贷款政策调整将进一步提升振刚需"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0376.wav", "duration": 7.7780625, "text": "马刀抡击式的中距离组合拳法配合高位膝技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0441.wav", "duration": 10.5029375, "text": "河南省新乡市封丘县留光镇政府东五零零米左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0310.wav", "duration": 5.5440625, "text": "新能源汽车的爆发带动了锂电池供不应求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0253.wav", "duration": 6.0059375, "text": "华尔街的半兽人已经为他的离开紧锣密鼓地敲起退堂鼓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0254.wav", "duration": 5.2469375, "text": "这样可以加深苹果和消费者之间的关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0221.wav", "duration": 4.771, "text": "提升公共交通设施装备水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0161.wav", "duration": 2.8459375, "text": "这一系列公积金政策的放宽"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0243.wav", "duration": 4.2430625, "text": "我们还安排了专门的偿债均摊机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0367.wav", "duration": 5.2629375, "text": "虽然扣球落地后朱婷依然一瘸一拐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0445.wav", "duration": 6.947, "text": "将不应享受政府的两个女儿作为搬迁户上报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0375.wav", "duration": 3.7639375, "text": "组建了花滑表演团队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0273.wav", "duration": 3.9239375, "text": "他们的消费需求是拉动创新创业的巨大牵引力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0145.wav", "duration": 4.217, "text": "扬州杭州成都无锡等地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0422.wav", "duration": 2.390875, "text": "但由于风格不同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0179.wav", "duration": 4.826, "text": "双降后首日在岸人民币由弱转强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0201.wav", "duration": 3.699, "text": "有的媒体甚至用井喷来描述"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0353.wav", "duration": 4.146, "text": "回忆起当时临危受命接班队长一职的情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0434.wav", "duration": 6.428, "text": "目前正在根据海事部门的要求开往盐城大分港"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0327.wav", "duration": 4.542, "text": "就没有要求专业机构做可研报告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0460.wav", "duration": 6.1589375, "text": "清洁工开宝马上下班真实身份为在逃诈骗犯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0413.wav", "duration": 2.6950625, "text": "据香港媒体报导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0177.wav", "duration": 4.235, "text": "在经济下行压力加大的背景下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0461.wav", "duration": 5.0920625, "text": "游客在北京动物园内小树间拉吊床摇荡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0451.wav", "duration": 7.4289375, "text": "这事发生在福建省漳州市诏安县林头村"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0319.wav", "duration": 3.8159375, "text": "这对我们来说是个很大的挑战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0255.wav", "duration": 3.126125, "text": "想了解苹果最初的事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0286.wav", "duration": 5.068, "text": "根据陈昊芝在二零一四年八月提供的数据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0334.wav", "duration": 5.2740625, "text": "这个方向的创新以后还有更多的东西可以发挥作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0407.wav", "duration": 3.9128125, "text": "这部正在酝酿中的续集敲定了导演"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0187.wav", "duration": 3.5560625, "text": "科技支撑能力显着增强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0148.wav", "duration": 3.2699375, "text": "但大多是雷声大雨点小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0444.wav", "duration": 3.8249375, "text": "乡间公路也就四米宽"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0464.wav", "duration": 5.1059375, "text": "一直被认为是全中国最难学习的方言之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0484.wav", "duration": 5.597875, "text": "退房结账时却被告知扣了二零元马桶使用费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0323.wav", "duration": 5.614, "text": "都是家电企业自动化升级需要面临的挑战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0397.wav", "duration": 5.163125, "text": "本次沈阳站赛场迎来了许多熟悉的面孔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0248.wav", "duration": 4.4309375, "text": "允许各类资产管理公司同台竞技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0488.wav", "duration": 6.275125, "text": "李彬彬喂大象喝水略显老态提醒网友夏天要补水"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0185.wav", "duration": 3.083, "text": "通过改革和政策调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0392.wav", "duration": 2.718, "text": "体育首尔的报道分析"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0422.wav", "duration": 3.4309375, "text": "曝出陈妍希拍戏时突然干呕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0355.wav", "duration": 4.891875, "text": "连身上的痛觉神经都进行了更换"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0418.wav", "duration": 4.2219375, "text": "二十九日晚间举办媒体听歌会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0377.wav", "duration": 4.941875, "text": "全民冰雪季奥运健儿助力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0162.wav", "duration": 5.0269375, "text": "广州二手住宅市场网签量达一千套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0453.wav", "duration": 5.5639375, "text": "在空中以高速自转带给游客惊险刺激的体验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0146.wav", "duration": 7.401, "text": "其中刚需要买入市积极性明显提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0430.wav", "duration": 4.281, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0169.wav", "duration": 8.1859375, "text": "对拥有一套住房并已结清相应购房贷款的居民家庭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0315.wav", "duration": 4.834125, "text": "多年来保持奇高市占率的老板电器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0352.wav", "duration": 4.407, "text": "吉娜卢克肯科姆普尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0495.wav", "duration": 3.98, "text": "平时作为看家护院之用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0258.wav", "duration": 6.802, "text": "这一价格也是目前华尔街给出的最高估值"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0188.wav", "duration": 6.5589375, "text": "最近企业债券特别是城投债券的发行难度加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0375.wav", "duration": 6.3769375, "text": "哈立以争议性的点数优势宣告获胜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0241.wav", "duration": 7.5, "text": "国务院常务会议听取了综合安全检查情况汇报"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0428.wav", "duration": 5.031, "text": "谢婷婷为服装拍摄时装宣传照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0305.wav", "duration": 6.937, "text": "未来将搭建空气水营养等智能管家平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0370.wav", "duration": 2.6790625, "text": "还能够在情绪上带动队友"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0228.wav", "duration": 4.744, "text": "实行最严格的耕地保护和节约用地制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0186.wav", "duration": 6.5799375, "text": "招商银行同业金融部高级分析师刘东亮指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0380.wav", "duration": 4.6069375, "text": "二百米罗宾埃尔瓦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0492.wav", "duration": 5.4909375, "text": "李玉刚饰演的杨贵妃被指芳华绝代说到神曲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0449.wav", "duration": 3.8889375, "text": "食客该不该如此浪费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0458.wav", "duration": 5.954125, "text": "该市苍南县公安局直属县看守所突发火情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0424.wav", "duration": 2.5, "text": "据香港媒体报导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0438.wav", "duration": 7.729, "text": "港报内地医院仍控制处方药销售电商盼网售解禁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0399.wav", "duration": 5.129875, "text": "进攻成功率达到百分之五十六点七六拦网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0476.wav", "duration": 7.297125, "text": "港媒中国患者年底可在线上美国医生咨询病情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0326.wav", "duration": 4.6259375, "text": "这类专业人才往往集中在互联网企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0471.wav", "duration": 6.75, "text": "游客称在山东日照只因点海鲜少全家遭殴打恐吓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0438.wav", "duration": 7.128875, "text": "渔船被其他船撞翻六人死海事部门悬赏五万寻肇事者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0421.wav", "duration": 4.646, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0394.wav", "duration": 5.28, "text": "北京申办冬奥强大实力成获胜武器"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0375.wav", "duration": 3.751, "text": "组委会特意举办隆重的开幕式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0419.wav", "duration": 4.5, "text": "陈奕迅在香港出席品牌活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0450.wav", "duration": 7.771, "text": "孩子的奶奶正在参加村里的道路环境综合治理工作会议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0183.wav", "duration": 6.463, "text": "投金或在经济增长速度放缓形势下加速外流"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0307.wav", "duration": 5.412125, "text": "由于去年底制定的销售战略是直销模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0241.wav", "duration": 5.5, "text": "构建服务质量评价指标体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0384.wav", "duration": 4.5, "text": "能够保障他的职业生涯发展是我的荣幸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0430.wav", "duration": 4.6420625, "text": "两人在台下分枱坐欠交流"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0143.wav", "duration": 3.43, "text": "二套首付降比百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0271.wav", "duration": 3.339, "text": "而这种人通常是商业人士"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0308.wav", "duration": 3.6429375, "text": "在锂电业务爆发的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0463.wav", "duration": 4.244875, "text": "用罂丽熬汤为丈夫止痛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0359.wav", "duration": 3.8830625, "text": "经过场上护理人员的医治后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0164.wav", "duration": 3.284, "text": "回报率普遍要求并不高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0285.wav", "duration": 10.006, "text": "而苹果的另一位联合创始人沃兹尼亚克还活跃在科技圈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0189.wav", "duration": 4.0339375, "text": "建立农业投入稳定增长机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0141.wav", "duration": 3.482, "text": "中国证券报报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0427.wav", "duration": 5.787125, "text": "并感谢了各界对于陈妍希公开与陈晓恋情的祝福"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0367.wav", "duration": 2.71925, "text": "因为卷入兴奋剂丑闻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0387.wav", "duration": 3.7951875, "text": "但随着这一系列名将的退役"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0344.wav", "duration": 4.3620625, "text": "让自己的攻击变得更快更狠"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0346.wav", "duration": 5.0351875, "text": "在一连串的拳腿风暴过后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0315.wav", "duration": 5.7690625, "text": "今年初也在原来厂里新增了生产线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0401.wav", "duration": 5.27, "text": "北京青年报记者昨日在鸟巢采访了一些志愿者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0393.wav", "duration": 4.906, "text": "早前意外崴伤脚踝的朱婷强势复出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0434.wav", "duration": 7.5180625, "text": "要有清晰的目标人文情怀和做到执着坚守"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0264.wav", "duration": 3.88, "text": "苹果的股价会随着销量相反"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0139.wav", "duration": 4.066, "text": "价格要到明年初才出现上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0492.wav", "duration": 4.0449375, "text": "永嘉县人谢某女"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0314.wav", "duration": 4.699, "text": "尽管政府对国产品牌有一定扶持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0296.wav", "duration": 2.86, "text": "十年都还没赚钱的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0322.wav", "duration": 3.135, "text": "对于这种突破性的天线内置方案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0151.wav", "duration": 4.652, "text": "同比前年增长五成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0399.wav", "duration": 4.281, "text": "亚历山大克塞诺科夫"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0168.wav", "duration": 9.5610625, "text": "三四线城市可能在继续因高库存而承压"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0160.wav", "duration": 4.2009375, "text": "在公积金利率已降至历史低位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0165.wav", "duration": 3.586, "text": "房企应走差异化路线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0356.wav", "duration": 5.198, "text": "播求的头部便被对方的肘击割破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0381.wav", "duration": 5.28, "text": "在全民健身成为国家战略的大背景下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0478.wav", "duration": 4.0029375, "text": "努力处理好灌溉与发电之间的关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0399.wav", "duration": 5.926, "text": "家人和哈排协也表明了全力支持她的态度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0341.wav", "duration": 5.2009375, "text": "除了第一局在开局阶段古巴队一度领先外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0355.wav", "duration": 4.120125, "text": "九月初顺利通过了考试"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0457.wav", "duration": 3.8669375, "text": "一零月一零日临近中午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0273.wav", "duration": 3.366, "text": "跟星巴克的合作就是灾难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0145.wav", "duration": 4.921, "text": "在安全加解密认证等方面也做足了功夫"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0145.wav", "duration": 5.362, "text": "绝大部分三线城市房价仍然下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0331.wav", "duration": 6.2529375, "text": "而浪潮从二零一零坚持做到现在"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0179.wav", "duration": 3.776, "text": "国家住房银行是否箭在弦上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0475.wav", "duration": 4.639875, "text": "温州市治堵办的负责人表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0202.wav", "duration": 5.614, "text": "目前我国出现政府性债务违约可能性并不大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0129.wav", "duration": 4.971, "text": "公积金贷款首付款比例不低于百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0389.wav", "duration": 6.542, "text": "倾尽全力将标枪掷到了六十六米一三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0172.wav", "duration": 4.288, "text": "中原地产市场总监张大伟认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0445.wav", "duration": 4.4148125, "text": "用智能秤称重将自动生成二维码"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0305.wav", "duration": 4.183, "text": "传统汽车业务并没有太大起色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0156.wav", "duration": 5.01, "text": "也可以是委托人合法获得的过桥资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0248.wav", "duration": 7.682, "text": "开展草原自然保护区建设和南方草地综合治理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0376.wav", "duration": 7.76, "text": "用作雪车雪橇大项和滑雪大项中的高山滑雪比赛场地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0186.wav", "duration": 3.713, "text": "鼓励购房者积极缴纳公积金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0191.wav", "duration": 4.647125, "text": "加大示范目建设投入力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0480.wav", "duration": 9.886, "text": "温州一夫妻非法集资五亿丈夫将赃款送给情妇洗钱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0317.wav", "duration": 2.468, "text": "以小天才电话手表为例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0217.wav", "duration": 7.882, "text": "解决中小企业生产经营困难需靠多方面共同努力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0359.wav", "duration": 6.8249375, "text": "逐渐控制住了局面并连扳两局以二比一优先"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0167.wav", "duration": 5.4920625, "text": "存销比见顶的态势基本确立"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0156.wav", "duration": 4.689, "text": "今年一线城市住宅用地价格涨五成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0362.wav", "duration": 4.1660625, "text": "庞清和佟健没有马上退役"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0152.wav", "duration": 5.5349375, "text": "北京市公积金额度提升后的元旦时期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0417.wav", "duration": 3.812, "text": "一个月内暴瘦了九至十三斤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0239.wav", "duration": 3.5639375, "text": "还本付息也是正常的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0462.wav", "duration": 7.1699375, "text": "菜单显示该饭店的荞麦窝窝头卖三八元一个"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0434.wav", "duration": 4.3789375, "text": "一人被判罚款一五零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0443.wav", "duration": 6.6110625, "text": "李磊灭门案遗产纠纷终结八零零馀万三人有份"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0225.wav", "duration": 5.4649375, "text": "积极开发和选育马铃薯优质专用高产品种"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0359.wav", "duration": 3.5, "text": "按照平时训练的速度进行跑步"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0490.wav", "duration": 6.880125, "text": "华西都市报讯记者杜恩湖一零月二四日中午一二时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0270.wav", "duration": 4.2580625, "text": "但它对开发者来说限制太多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0168.wav", "duration": 3.239, "text": "但目前的形势早已改变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0202.wav", "duration": 4.8680625, "text": "中央企业控股境外上市公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0402.wav", "duration": 7.014125, "text": "借着北京将要举办二零二二年冬奥会的东风"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0169.wav", "duration": 6.481, "text": "此前外资购房主要集中在一线城市和几个热点二线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0262.wav", "duration": 4.818, "text": "乔布斯在它出现之前都不知道它的存在"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0368.wav", "duration": 7.297125, "text": "从而确保高度精准地记录竞赛成绩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0314.wav", "duration": 4.2790625, "text": "汉能发布中期财报披露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0446.wav", "duration": 5.3679375, "text": "截至九点四零分消防人员撤离时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0493.wav", "duration": 6.0549375, "text": "永嘉县人已被鹿城警方依法行政拘留"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0494.wav", "duration": 3.7511875, "text": "存在无法如期还贷的风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0304.wav", "duration": 3.8980625, "text": "我国的标准和国际差不多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0385.wav", "duration": 4.6159375, "text": "曾经在鸟巢服务的志愿者们"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0281.wav", "duration": 2.859, "text": "还希望拓展市场的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0437.wav", "duration": 9.2688125, "text": "温州多地商户拉横幅求降租导购不少店亏本经营"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0485.wav", "duration": 3.6520625, "text": "且时间已长达两年多了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0238.wav", "duration": 3.259875, "text": "保持耕地面积不减少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0369.wav", "duration": 5.650875, "text": "转投到昔日恩师卢民相任教练的游泳俱乐部训练"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0400.wav", "duration": 4.322, "text": "佟健更希望能有实实在在的发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0251.wav", "duration": 5.85, "text": "明确农业科技的公共性基础社会性地位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0124.wav", "duration": 2.2249375, "text": "并已实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0481.wav", "duration": 6.197, "text": "有走私奢侈品的人士月入高达八万港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0360.wav", "duration": 5.213125, "text": "因为本次赛事比赛周期长赛区跨度大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0428.wav", "duration": 6.5229375, "text": "许茹芸突然闪婚让当时的娱乐圈也惊起了一阵小波澜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0483.wav", "duration": 5.3471875, "text": "其中上半年中国访日游客接近翻倍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0256.wav", "duration": 3.9460625, "text": "不断刷新中国创造的精度高度深度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0393.wav", "duration": 4.8310625, "text": "霸气外露的朱婷是不可或缺的绝对核心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0336.wav", "duration": 6.282, "text": "浪潮集团与海关总署启动战略合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0465.wav", "duration": 4.492875, "text": "朱茵说紫霞仙子谁来演不是我可以决定的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0420.wav", "duration": 2.512, "text": "她回应是么"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0393.wav", "duration": 3.6069375, "text": "记者查阅相关资料发现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0250.wav", "duration": 6.0850625, "text": "徐林出于对地方政府债务风险的担忧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0431.wav", "duration": 5.3141875, "text": "为了给自己的爱犬盖狗舍及休息场所"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0259.wav", "duration": 4.229, "text": "该网站根据雇员的反馈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0309.wav", "duration": 4.48, "text": "还针对性的设置了上课禁用等功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0396.wav", "duration": 4.2519375, "text": "本报讯记者李晖经过两天转场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0187.wav", "duration": 8.4700625, "text": "分档制定了中央部门收取的考务费统一上限标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0484.wav", "duration": 5.494875, "text": "一名老师才发现学生坠楼摔落在教学楼前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0462.wav", "duration": 5.129875, "text": "王思聪将朱圣祎诉至北京朝阳法院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0327.wav", "duration": 4.938, "text": "汽车模具实现营收一点一零一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0368.wav", "duration": 8.1809375, "text": "庞清和佟健仍肩负着扛起中国双人滑大旗的重任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0253.wav", "duration": 9.187, "text": "神雕的机身四周装有分布式有源相控阵雷达天线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0304.wav", "duration": 5.0, "text": "有黑客在网络上兜售车主信"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0470.wav", "duration": 4.76975, "text": "希望警方尽快给出公平调查结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0399.wav", "duration": 4.724125, "text": "不时还施以非常巧妙的吊球"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0320.wav", "duration": 3.4499375, "text": "深受家长和儿童欢迎"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0410.wav", "duration": 2.876, "text": "可说是超完美女神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0302.wav", "duration": 4.646, "text": "肯德尔定于二月二十三日访问印度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0357.wav", "duration": 6.005125, "text": "彭博一英里接力赛将在十月十五日首次登陆上海"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0308.wav", "duration": 5.6909375, "text": "用于回购的资金总额不超过一点五一七亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0127.wav", "duration": 3.925, "text": "贷款最高额度仍为一百万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0226.wav", "duration": 4.802, "text": "对于如何建立规范的地方政府融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0237.wav", "duration": 3.614, "text": "免费时段从节假日第一天开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0279.wav", "duration": 4.9239375, "text": "我们也许不用像以前那样为了追求某个数字赶紧赶慢了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0244.wav", "duration": 5.1429375, "text": "加大动物疫病防控经费投入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0300.wav", "duration": 4.5, "text": "从这些零售商的等级来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0271.wav", "duration": 3.7109375, "text": "客户会再次收到短信提醒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0133.wav", "duration": 3.557, "text": "目前挂牌的只有几宗土地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0155.wav", "duration": 6.992, "text": "中粮集团违规投资四亿元对原培训中心进行改扩建"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0488.wav", "duration": 7.9970625, "text": "游客西安遭天价玛卡商家四零零零元一价合理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0280.wav", "duration": 5.3239375, "text": "零售商最终都会向消费者妥协"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0483.wav", "duration": 3.207, "text": "现场喊打声持续不断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0159.wav", "duration": 5.3880625, "text": "才能提振开发商拿地和开工的积极性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0469.wav", "duration": 7.162125, "text": "来自全球四七个国家和地区的二零零零多名选手参赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0137.wav", "duration": 5.133, "text": "尽管降息等利好政策出台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0122.wav", "duration": 4.115, "text": "一二线城市虽然也处于调整中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0277.wav", "duration": 9.386, "text": "消费者会在特定情况下牺牲安全性来提升支付的便捷性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0130.wav", "duration": 5.777, "text": "金融市场总体平稳鲁指冲高回落"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0446.wav", "duration": 7.457, "text": "温州二名已婚男为争美女驾豪车互撞四个回合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0261.wav", "duration": 5.2099375, "text": "苹果涉足汽车行业并不是一个好主意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0407.wav", "duration": 3.014875, "text": "他确实拿下了这个角色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0429.wav", "duration": 2.5649375, "text": "在许茹芸看来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0165.wav", "duration": 5.062, "text": "有些客户只要求收益率超过利率即可"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0257.wav", "duration": 6.7100625, "text": "本报记者纪佳鹏北京报道北京时间八月十二日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0379.wav", "duration": 5.03, "text": "二百米的高强度无氧到一千五百米的有氧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0236.wav", "duration": 4.2009375, "text": "加强渔港和渔政执法能力建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0239.wav", "duration": 3.8950625, "text": "探索实施报废更新补助"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0416.wav", "duration": 1.979, "text": "这个程度是美的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0370.wav", "duration": 4.711875, "text": "现场参赛企业誓言要打破这项记录"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0405.wav", "duration": 3.543, "text": "影片发布了第一批定装照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0476.wav", "duration": 4.947, "text": "但是干旱原因主要系降水减少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0179.wav", "duration": 3.981, "text": "这使得一线城市的土地竞争激烈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0187.wav", "duration": 7.1899375, "text": "完善玉米大豆油菜籽棉花等农产品临时收储政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0244.wav", "duration": 5.4079375, "text": "具备一定的严重事故预防和缓解能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0344.wav", "duration": 6.1540625, "text": "比赛很快便呈向一边倒的局面第二回合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0441.wav", "duration": 3.9909375, "text": "薛孝文在学生家中家访"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0170.wav", "duration": 4.266, "text": "但主要还是体现在贷款成本的降低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0493.wav", "duration": 7.802, "text": "涉嫌编造谣言非法拘禁被刑拘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0165.wav", "duration": 3.9160625, "text": "将农民工纳入住房公积金制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0279.wav", "duration": 7.1469375, "text": "目前大部分华尔街分析师们都对苹果的未来保持乐观"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0392.wav", "duration": 4.505875, "text": "美貌和实力并存的选手太稀罕了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0446.wav", "duration": 7.5859375, "text": "网络上一张永嘉桥头国际饭店的结帐单十分引人注目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0316.wav", "duration": 7.9079375, "text": "公司不仅可以向手机推送软件广告等商业性电子信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0144.wav", "duration": 6.9969375, "text": "自今年初至今上涨幅度超过了十百分之"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0425.wav", "duration": 3.0659375, "text": "据香港媒体报导"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0455.wav", "duration": 4.900875, "text": "昌平法院开庭审理了这起案件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0304.wav", "duration": 6.4350625, "text": "已获任美的部品事业部的总裁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0406.wav", "duration": 6.827125, "text": "在原定男主角卢克伊万斯退出剧组之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0131.wav", "duration": 5.287, "text": "房地产企业的整体资金状况超紧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0451.wav", "duration": 7.151875, "text": "村干部靠打架成名被抓后喊我是市人大代表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0203.wav", "duration": 6.413, "text": "制定了可再生能源电价附加补贴和配额交易方案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0139.wav", "duration": 7.683, "text": "即使限外令放开也不会出现大规模外资买房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0329.wav", "duration": 8.0639375, "text": "一季度营收为二十一八点七亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0444.wav", "duration": 7.3730625, "text": "五零岁港商疑与其工厂的同龄女主管偷情多年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0366.wav", "duration": 3.390875, "text": "充分做到公平公正公开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0133.wav", "duration": 4.5940625, "text": "相关公司股票走势招商银行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0319.wav", "duration": 5.9880625, "text": "是自二零一一年借壳上市以来首次出现亏损"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0400.wav", "duration": 7.876, "text": "视频中国三一大胜俄罗斯独占女排世界杯榜首"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0224.wav", "duration": 6.9930625, "text": "逐步完善农业生产关键技术应用与服务支持政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0218.wav", "duration": 7.203, "text": "当代人和后代人共同承担债务还本付息责任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0145.wav", "duration": 8.115, "text": "更致命的是中小房企在融资方面的短板"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0452.wav", "duration": 5.0451875, "text": "游客在公园躲雨遭雷击已脑死亡至今无人负责"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0310.wav", "duration": 4.0, "text": "实现净利营收双增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0399.wav", "duration": 3.553, "text": "将举行隆重的颁奖仪式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0382.wav", "duration": 4.119125, "text": "马塞洛特来到法国花样滑冰联合会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0449.wav", "duration": 4.8508125, "text": "公安机关并未查出其身上还背着命案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0170.wav", "duration": 4.7979375, "text": "万科获选性价比最高的房企"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0304.wav", "duration": 3.735, "text": "我们凭什么征战全世界"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0402.wav", "duration": 4.5449375, "text": "以此证明自己并没有使用过违禁药物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0180.wav", "duration": 3.9969375, "text": "关于明年的房价走势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0239.wav", "duration": 2.501, "text": "加强农业生态环境治理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0472.wav", "duration": 6.3679375, "text": "省市区三三级疾控部门专家已介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0195.wav", "duration": 4.2799375, "text": "主要是如何提供服务及做好监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0344.wav", "duration": 4.221875, "text": "网友大呼她帅过林丹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0209.wav", "duration": 3.902, "text": "但农业现代化明显滞后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0327.wav", "duration": 6.2979375, "text": "第二期股票回购方案不晚于二零一七年六月三十日推出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0462.wav", "duration": 7.5190625, "text": "杀害中传女生嫌犯曾私藏刺刀同学称其特立独行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0148.wav", "duration": 3.618, "text": "要重点加大政策支持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0485.wav", "duration": 7.3249375, "text": "在虾体内发现疑似胶状物质七月二十一日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0189.wav", "duration": 5.068, "text": "免征蔬菜流通环节增值税"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0236.wav", "duration": 4.1800625, "text": "东部沿海先导农业区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0362.wav", "duration": 3.745125, "text": "已经有过不少关于这方面的研究"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0466.wav", "duration": 3.667, "text": "但在张关押了三七天后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0319.wav", "duration": 5.651, "text": "还没体现在香港上市公司威灵电器的业务层面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0247.wav", "duration": 2.833, "text": "您如何看待这一现象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0322.wav", "duration": 3.0800625, "text": "我们必须要有衡量标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0454.wav", "duration": 4.8518125, "text": "两个村子之间的长江江面上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0464.wav", "duration": 6.0300625, "text": "清洁工被电梯咬断腿曾反映这样擦电源危险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0320.wav", "duration": 2.869125, "text": "失孤等影片的上映"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0445.wav", "duration": 3.484125, "text": "这一天还将上演月全食"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0441.wav", "duration": 5.8300625, "text": "本月二八日超级月亮和最圆中秋月喜相逢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0312.wav", "duration": 8.8930625, "text": "车企在信息安全方面的投入不足已经越来越成为其软肋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0140.wav", "duration": 3.779, "text": "而最高额度提升至一百万后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0252.wav", "duration": 3.8610625, "text": "发挥财政资金引导示范作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0469.wav", "duration": 5.0129375, "text": "温州体育局官员逼女教练陪酒当地纪委介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0327.wav", "duration": 6.8400625, "text": "机器人后期维护运行成本及技术也是一个高门槛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0273.wav", "duration": 4.063, "text": "除却土豪式的生意属性之外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0450.wav", "duration": 5.1699375, "text": "为了实现退休后能建一座养老机构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0260.wav", "duration": 5.9609375, "text": "给出了前五十名的公司排名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0350.wav", "duration": 8.318125, "text": "队员们也对于她在技术上和心理上都颇为依赖和信服"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0404.wav", "duration": 4.5749375, "text": "上周在北美电影市场上遭遇票房惨剧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0435.wav", "duration": 9.4350625, "text": "港京航班延误九小时六名内地乘客推撞地勤被捕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0289.wav", "duration": 7.3099375, "text": "据新华社电美国商务部二十一日宣布初裁结果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0246.wav", "duration": 4.6440625, "text": "针对目前职业资格考试收费项目增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0198.wav", "duration": 2.656, "text": "推进龙头企业集群发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0434.wav", "duration": 7.8989375, "text": "兴安县法院判杨爱明拘役四个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0447.wav", "duration": 4.723125, "text": "港商疑恼羞成怒将她杀害"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0391.wav", "duration": 5.495875, "text": "郎平也认为这样去打世界高水平的球队是不够的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0321.wav", "duration": 4.6689375, "text": "现在汽车与网络的联系越来越紧密"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0262.wav", "duration": 6.688, "text": "因为快速发展的业务和不断膨胀的营收受资本市场亲睐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0284.wav", "duration": 6.0129375, "text": "势必使用中美光伏贸易纠纷再度升级"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0399.wav", "duration": 4.160875, "text": "朴泰桓会面临更加严峻的舆论环境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0483.wav", "duration": 3.2880625, "text": "直至晚上一零时左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0339.wav", "duration": 5.5490625, "text": "提升战绩为九胜一负反超至榜首位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0146.wav", "duration": 3.5530625, "text": "实现三四线城市去库存"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0177.wav", "duration": 3.268, "text": "据伟业我爱我家市场研究院测算"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0288.wav", "duration": 5.5, "text": "最大难点在于如何改变国内的消费习惯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0385.wav", "duration": 4.108875, "text": "恭喜他与萨维申科走上正确的道路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0418.wav", "duration": 2.967, "text": "问及最近是否有跟男友见面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0455.wav", "duration": 6.4350625, "text": "但曾经的中国网球一姐李娜仍然没有淡出媒体的关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0136.wav", "duration": 6.479, "text": "发现无论是千亿巨头地产商"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0333.wav", "duration": 6.9658125, "text": "海信科龙一季报营收为六十四点三亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0213.wav", "duration": 6.7829375, "text": "但在具体评估我国地方政府债务风险程度时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0453.wav", "duration": 3.312, "text": "并在铁塔上借助自拍杆合影"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0272.wav", "duration": 4.8309375, "text": "微软正在向外界推广一次编写"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0439.wav", "duration": 7.521, "text": "游客赴港游买瑞士表半个月停摆旅行社久拖不管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0455.wav", "duration": 7.689, "text": "有一块面积近五零零零面积的沙洲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0427.wav", "duration": 4.9609375, "text": "各样都平衡得好处理得好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0375.wav", "duration": 4.552, "text": "小青椒用热情和真诚打动了每位运动员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0122.wav", "duration": 3.146, "text": "是当今广告行业的需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0220.wav", "duration": 3.8759375, "text": "强化企业管理和风险管控"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0170.wav", "duration": 4.327, "text": "五月份更是增加了七百万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0314.wav", "duration": 4.5979375, "text": "而体现在服务器产业上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0282.wav", "duration": 5.509, "text": "并接受消费者想要使用的支付方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0123.wav", "duration": 4.1369375, "text": "彩虹之门建筑净高三十米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0463.wav", "duration": 4.131125, "text": "一家三口在两棵树间拉起了一张吊床"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0423.wav", "duration": 3.1340625, "text": "并大呼我自己也非常期待他回来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0315.wav", "duration": 5.0660625, "text": "原压缩机事业部各工厂保持不变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0191.wav", "duration": 5.118875, "text": "加强农业科研基地和重点实验室建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0220.wav", "duration": 3.4500625, "text": "一些国家经济出现大的波动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0322.wav", "duration": 3.459, "text": "题材股继续扮演黑马角色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0149.wav", "duration": 5.4490625, "text": "还有一亿元被套取或用于弥补经费不足等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0144.wav", "duration": 3.88, "text": "国家统计局公布的数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0403.wav", "duration": 4.910875, "text": "退役之后的高桥大辅并未远离公众视线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0433.wav", "duration": 4.428, "text": "运气好时一天能偷几千枚一元硬币"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0293.wav", "duration": 4.25, "text": "该网站根据雇员的反馈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0381.wav", "duration": 3.8469375, "text": "备战明年的里约奥运"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0490.wav", "duration": 7.0551875, "text": "李玉刚张学友黄琦雯入选一零大最涨姿势歌曲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0318.wav", "duration": 3.8869375, "text": "工人数量减少近一半"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0339.wav", "duration": 3.7419375, "text": "看到了有关这里水污染的报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0127.wav", "duration": 4.014, "text": "成为圈子里首屈一指的超大企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0460.wav", "duration": 5.6110625, "text": "权义澎湃资料李银河在现实中是柔软的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0441.wav", "duration": 5.0659375, "text": "京汇佳律师事务所律师邱宝昌表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0493.wav", "duration": 5.427, "text": "事后才了解他们遭遇的只是普通连环车祸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0143.wav", "duration": 8.1709375, "text": "也在厦门拿下几宗商住用地和济南几宗居住用地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0477.wav", "duration": 4.661875, "text": "李开复经历死亡这一课学会看透和放下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0297.wav", "duration": 5.2150625, "text": "而是寻求收购规模较小更为灵活的公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0311.wav", "duration": 5.1238125, "text": "美的整合事业部精简组织架构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0312.wav", "duration": 4.2729375, "text": "上述成飞集成人士表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0290.wav", "duration": 6.6120625, "text": "继二零一一年出现独特的连翼造型的翔龙无人机以后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0252.wav", "duration": 7.41, "text": "通知按照不同考生规模考试类类别的合理平均成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0122.wav", "duration": 4.636, "text": "背后可能蕴含着开发商更多的窘境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0489.wav", "duration": 5.068125, "text": "而橄榄形结构是以中产为主的结构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0322.wav", "duration": 5.4869375, "text": "作为企业理念和产品技术必须要走在时代的前面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0199.wav", "duration": 6.3979375, "text": "下一步我国的城投债券还需要做哪些完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0415.wav", "duration": 3.375, "text": "搜狐娱乐讯九月十二日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0249.wav", "duration": 4.438, "text": "加快实施游牧民定居工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0352.wav", "duration": 3.3940625, "text": "总共贡献了一百四十一分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0218.wav", "duration": 4.947, "text": "克服当期建设资金不足的瓶颈制约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0130.wav", "duration": 6.2779375, "text": "市政府决定今年将全面加快棚户区改造步伐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0388.wav", "duration": 4.0698125, "text": "该球队在官方博客上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0486.wav", "duration": 5.996125, "text": "出席活动时笑称今后拍激情戏会征求男友李晨的意见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0289.wav", "duration": 4.6599375, "text": "选择套现或也是情理之中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0304.wav", "duration": 3.3940625, "text": "由于该项目尚处于保密期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0368.wav", "duration": 4.509, "text": "最后取全队用时最少者为胜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0367.wav", "duration": 5.150875, "text": "加之其半身浴血的黝黑健美体魄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0409.wav", "duration": 2.407, "text": "演艺事业受挫"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0348.wav", "duration": 3.1791875, "text": "并让年轻跑者作为参照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0191.wav", "duration": 3.468, "text": "现代农业建设取得突破性进展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0162.wav", "duration": 3.327, "text": "今久在大举创新的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0314.wav", "duration": 3.1010625, "text": "还要保证与手机一样的通话质量呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0308.wav", "duration": 5.208, "text": "美的已将风扇加湿器等空气类产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0284.wav", "duration": 3.767, "text": "连这些人都预测不准的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0346.wav", "duration": 5.120125, "text": "凭借十三分位列本队和扣球榜第二位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0302.wav", "duration": 4.5439375, "text": "越多人讲往往越难成事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0170.wav", "duration": 3.671, "text": "楼市进展仍需进一步观望"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0310.wav", "duration": 6.8979375, "text": "质变中的世界工厂中国正在由中国制造向中国智造蜕变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0142.wav", "duration": 4.3350625, "text": "宋芳本人为信托的发起人和委托人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0202.wav", "duration": 5.156, "text": "加强城投债监管完善制度建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0202.wav", "duration": 3.4960625, "text": "四是外部环境将更加优化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0146.wav", "duration": 6.072, "text": "审计已向有关部门移送重大违法违纪问题三百起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0447.wav", "duration": 4.876, "text": "车子被撞得破烂不堪七月四日凌晨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0448.wav", "duration": 4.712875, "text": "并肢解尸体分成多袋抛入河中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0316.wav", "duration": 4.0039375, "text": "汽车厂商纷纷转型新能源汽车"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0171.wav", "duration": 5.8009375, "text": "即使限外令放开也不会出现外资大规模买房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0218.wav", "duration": 4.854, "text": "面对上述这些问题山东是怎么免费放行的呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0397.wav", "duration": 6.3400625, "text": "五度世锦赛冠军萨维申科联手年轻新搭档马塞洛特"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0491.wav", "duration": 4.797875, "text": "被导游介绍到一家购物点后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0193.wav", "duration": 3.7440625, "text": "建立地方政府债务管理体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0183.wav", "duration": 3.803, "text": "百分之五的网友认为不会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0184.wav", "duration": 3.5, "text": "内地产投资比例有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0324.wav", "duration": 3.994125, "text": "电话手表正是瞄准了这一需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0447.wav", "duration": 7.8920625, "text": "时年二三岁的杨柱军在北京抢劫杀害了一名出租车司机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0256.wav", "duration": 4.864, "text": "他们开发出一种只有二十微米长的机器人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0232.wav", "duration": 6.447, "text": "该区域交通区位市场和人力资源优势明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0372.wav", "duration": 3.3728125, "text": "朱婷两场比赛担任首发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0176.wav", "duration": 5.8219375, "text": "一二线城市特别是京沪这样的核心城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0403.wav", "duration": 6.911125, "text": "冰雪运动在中国势必会有一次发展高潮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0260.wav", "duration": 5.703, "text": "苹果股票每分钟交易量已超过六百七十万股"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0254.wav", "duration": 4.704125, "text": "无止境地重复过去十年的惊人增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0351.wav", "duration": 4.8239375, "text": "我们应该抱着更加长远和开阔的视角来看待"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0447.wav", "duration": 5.274875, "text": "事件中的女方昨日被判一二个月感化令"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0183.wav", "duration": 3.7270625, "text": "大数据云计算是非常烧钱的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0259.wav", "duration": 3.636, "text": "它是软件集成的一种方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0177.wav", "duration": 5.422, "text": "未来住宅价格会企稳回升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0136.wav", "duration": 6.928, "text": "上周末成为潜在买家们争相咨询看楼的时机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0157.wav", "duration": 4.2069375, "text": "可以解决贷款难和贷款贵问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0270.wav", "duration": 3.3819375, "text": "政府失控的可不是什么隐私了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0347.wav", "duration": 3.7878125, "text": "在数百场真枪实弹的巅峰对决中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0416.wav", "duration": 4.3159375, "text": "曝出陈妍希拍戏时突然干呕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0471.wav", "duration": 7.635, "text": "门头沟雁翅镇村民李冬梅因不服行政批复"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0184.wav", "duration": 3.691, "text": "百分之五的网友认为会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0302.wav", "duration": 4.5290625, "text": "移动支付肯定会有井喷式的发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0432.wav", "duration": 4.4609375, "text": "称涉事男子为某街道协管员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0405.wav", "duration": 3.3198125, "text": "忙碌成本可想而知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0345.wav", "duration": 4.389875, "text": "无论帆船赛艇还是公开水域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0325.wav", "duration": 4.7209375, "text": "比如现在的汽车一般采用了哪些新技术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0408.wav", "duration": 5.988, "text": "至于有传拍台庆剧很容易获奖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0464.wav", "duration": 7.7009375, "text": "此次事故调查组组长荆州市安监局局长陈观鑫通报称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0387.wav", "duration": 2.801, "text": "打日本从来都不需要动员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0253.wav", "duration": 8.527, "text": "业界首次开始认真讨论苹果市值晋升万亿大关的潜力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0409.wav", "duration": 3.8200625, "text": "不过天下无不散之筵席"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0201.wav", "duration": 5.99, "text": "渔业产值占农业总产值比重百分之"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0487.wav", "duration": 6.24025, "text": "李克强集众智汇众力攻坚克难激发活力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0282.wav", "duration": 6.207, "text": "苹果市场价值达到七千亿美元刚刚过去几个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0217.wav", "duration": 3.9759375, "text": "完善现代农业产业体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0453.wav", "duration": 5.6630625, "text": "李娜不想大家一直记得我那说明中国网球没突破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0281.wav", "duration": 3.5340625, "text": "全世界的报道已经蜂拥而至"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0431.wav", "duration": 3.775875, "text": "数万只黄色小鸡散落路上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0284.wav", "duration": 6.28, "text": "这家公司就在挖角当地游戏公司高管建立分公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0136.wav", "duration": 7.6189375, "text": "也延续了公积金担当扶持楼市主力军的政策选择"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0187.wav", "duration": 4.2800625, "text": "无序竞争甚至恶意竞争时常发生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0195.wav", "duration": 5.0589375, "text": "随着我国综合国力和财政实力不断增强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0281.wav", "duration": 8.6809375, "text": "四大天王平均累计回报高达一千二百分之八十二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0310.wav", "duration": 3.5659375, "text": "对用户信息做足了保密工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0168.wav", "duration": 7.4179375, "text": "特别是一至四月土地出让金即破千亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0175.wav", "duration": 5.9830625, "text": "而智能家居产品的特殊属性决定了销售渠道的模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0378.wav", "duration": 3.203, "text": "面对日本队的魔鬼主场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0158.wav", "duration": 3.0299375, "text": "涨幅据十大城市之首"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0352.wav", "duration": 6.5020625, "text": "后两轮死磕俄罗斯和日本更是有红了眼的感觉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0309.wav", "duration": 6.3620625, "text": "三巨头中的格力海尔均出现不同程度下滑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0181.wav", "duration": 6.5, "text": "标普在基准情景假设下的预期是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0397.wav", "duration": 3.1791875, "text": "前两次申办的过程中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0159.wav", "duration": 4.269, "text": "点击进入股友会参与讨论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0347.wav", "duration": 7.2260625, "text": "也对地面技术和防摔技术上做了很多针对性的训练"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0205.wav", "duration": 3.9560625, "text": "符合提高直接融资比重的要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0138.wav", "duration": 4.374, "text": "建设用地方面也暴露了不少问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0274.wav", "duration": 5.1219375, "text": "但至今唯独没有提升智能手表平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0144.wav", "duration": 6.141, "text": "南京武汉市放宽第二套房公积金贷款门槛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0149.wav", "duration": 4.259, "text": "这种分化情况会更剧烈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0439.wav", "duration": 6.1020625, "text": "被法院以故意毁坏财物罪判刑或处罚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0151.wav", "duration": 3.27, "text": "清理收回住房二十套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0336.wav", "duration": 5.1230625, "text": "七月成立了美的部品事业部"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0436.wav", "duration": 4.3359375, "text": "是因为国民抢习惯了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0448.wav", "duration": 3.496125, "text": "男方则将于下月庭审"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0435.wav", "duration": 4.0229375, "text": "进一步导致肢体冲突"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0410.wav", "duration": 7.3481875, "text": "陈冠希前女友嫩模黄榕在香港书展出席写真宣传活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0271.wav", "duration": 3.4, "text": "而不仅仅是早期市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0127.wav", "duration": 7.497, "text": "改善型二套房比例比约为百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0349.wav", "duration": 5.1059375, "text": "颜值颇高的他今年四月远赴美国纽约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0222.wav", "duration": 3.7099375, "text": "其他主要农产品优势区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0313.wav", "duration": 6.3149375, "text": "便是区别行业龙头企业经营智慧高低的关键时刻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0374.wav", "duration": 4.1480625, "text": "今晚的比赛中朱婷独得二十七分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0247.wav", "duration": 3.3559375, "text": "损害债券持有人利益的事件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0178.wav", "duration": 6.542, "text": "最低首付款比例由百分之七降低至百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0465.wav", "duration": 6.881125, "text": "村庄遭人倾倒数百吨化工废料附近植物全空死"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0397.wav", "duration": 6.194125, "text": "财政能力和硬件设施的优势是我们最终取胜的关键原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0200.wav", "duration": 4.7530625, "text": "进一步强化贸易促进公共服务能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0374.wav", "duration": 5.328125, "text": "成为了国际体育运动大家庭中的一员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0339.wav", "duration": 4.0, "text": "而是要明确落实在数字上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0291.wav", "duration": 4.343, "text": "证明了其向主流妥协的姿态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0393.wav", "duration": 3.5708125, "text": "有一些临时组建的球队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0294.wav", "duration": 5.0819375, "text": "中国正在研制一种世界上尺寸最大的无人机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0289.wav", "duration": 4.376, "text": "扩大它们在新的芯片市场的份额"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0158.wav", "duration": 4.411, "text": "外资管制放松是大势所趋"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0368.wav", "duration": 4.163125, "text": "远比单纯的胜负有意义得多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0473.wav", "duration": 7.7839375, "text": "游客突破八万人限流大关故宫首次提前禁止售票"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0285.wav", "duration": 8.5340625, "text": "其中包括美国大鸦无人机今后将由印度工厂制造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0254.wav", "duration": 6.411, "text": "可以提供三六零度无死角的早期预警"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0430.wav", "duration": 5.5390625, "text": "中新网五月七日电据台湾中国时报消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0242.wav", "duration": 4.616, "text": "政府还拥有较多的可变现资产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0214.wav", "duration": 5.3579375, "text": "参与农村产业发展和公共设施建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0152.wav", "duration": 5.826, "text": "其中刚需买家入市积极性明显提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0391.wav", "duration": 8.9760625, "text": "祖耶夫的右肋很快便被踢出大片鲜红的淤血斑痕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0254.wav", "duration": 6.553, "text": "它必须尽量做到只针对敌对国家的计算机和网络"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0151.wav", "duration": 3.5, "text": "三线城市签约十六万套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0128.wav", "duration": 5.13, "text": "三套以上投资性购房占百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0375.wav", "duration": 5.099125, "text": "这两种方式的结合能够有效锻炼小腿肌肉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0475.wav", "duration": 3.9018125, "text": "清风正在吹散互联网雾霾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0317.wav", "duration": 3.5190625, "text": "每日经济新闻记者注意到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0491.wav", "duration": 4.256875, "text": "一对来自浙江温州的医生夫妇涉案被捕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0207.wav", "duration": 5.6, "text": "制定更加严格的地方水污染排放标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0235.wav", "duration": 2.646, "text": "实施草原保护重大工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0156.wav", "duration": 10.857, "text": "尤其组合贷的咨询量较上月月初一周上涨百分之五左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0432.wav", "duration": 3.3359375, "text": "经调查核实相关情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0487.wav", "duration": 5.2109375, "text": "浙江温岭市大溪镇发生鞋厂厂房倒塌事故"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0337.wav", "duration": 7.2370625, "text": "家电企业要建立数字化工厂才能真正提升生产效率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0340.wav", "duration": 3.97, "text": "擂台上的黑王子肌肉强健"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0324.wav", "duration": 3.5900625, "text": "自动化是未来唯一出路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0194.wav", "duration": 6.043, "text": "全面加强海洋环境监视监测和监督管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0480.wav", "duration": 4.8530625, "text": "在新书向死而生我修的死亡学分中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0419.wav", "duration": 3.8200625, "text": "她笑说我觉得蛮好的啊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0128.wav", "duration": 4.152, "text": "另外要处理公积金异地使用的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0386.wav", "duration": 3.3779375, "text": "然而就是这最后一掷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0163.wav", "duration": 6.5449375, "text": "开发商均面临不均衡的复苏前景"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0158.wav", "duration": 4.857, "text": "扶持刚需客群已经成为北京房地产调控的主要方向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0387.wav", "duration": 6.7729375, "text": "共有三百二十三名业馀排球爱好者报名参加比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0259.wav", "duration": 5.65, "text": "该机的雷达还具备合成孔径工作能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0378.wav", "duration": 3.9260625, "text": "也被送往医院进行抢救"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0149.wav", "duration": 6.125, "text": "房企除了像千亿地产一样做大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0384.wav", "duration": 7.0700625, "text": "来自全国各地的业馀排球爱好者纷纷前来踊跃报名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0408.wav", "duration": 2.6630625, "text": "对男友有什么条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0184.wav", "duration": 5.7300625, "text": "包括上海广州厦门南京在内的重点城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0297.wav", "duration": 5.5288125, "text": "排名从第十三位上升至第十一位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0184.wav", "duration": 4.428, "text": "溢价率楼面价均处于高位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0332.wav", "duration": 5.9980625, "text": "可以和我们的消费者有很多的互动并提供超值服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0365.wav", "duration": 4.2739375, "text": "但多年来关于他的形婚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0311.wav", "duration": 5.1169375, "text": "几乎所有锂电厂商都在满负荷生产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0367.wav", "duration": 5.2851875, "text": "每人分别完成一英里即约一点六公里的路程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0149.wav", "duration": 8.332, "text": "同时对申请公积金贷款的缴纳时限调整为五个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0170.wav", "duration": 6.121, "text": "去年北京共出让五十宗居住楼用地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0394.wav", "duration": 5.4650625, "text": "比污染严重的瓜内巴拉湾相比"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0301.wav", "duration": 3.4669375, "text": "苹果的目标股价也开始相应地上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0334.wav", "duration": 4.118875, "text": "是火在行业的科技创新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0401.wav", "duration": 2.8899375, "text": "也知道了未来需要努力的方向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0486.wav", "duration": 4.089125, "text": "可比黄金的沉香价格每年倍增"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0469.wav", "duration": 6.183125, "text": "省城政务区习友路与怀宁路交叉口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0240.wav", "duration": 5.061, "text": "考虑到我国正处在经济快速增长期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0139.wav", "duration": 5.8810625, "text": "违规以租代征改变规划条件等用地一万公顷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0144.wav", "duration": 4.523, "text": "建设创业创新平台用地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0401.wav", "duration": 5.3920625, "text": "当地华人团体组织了不少球迷为中国队加油"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0270.wav", "duration": 4.984, "text": "苹果高端市场已经确立了一个独一无二的地位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0152.wav", "duration": 3.8760625, "text": "四线城市成交量有轻微下调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0173.wav", "duration": 5.5759375, "text": "中国经济增速放缓的背景下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0357.wav", "duration": 5.3390625, "text": "步幅长度和跑步速度大约下降了百分之二十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0477.wav", "duration": 8.0979375, "text": "温州开水浇头服务员被批捕涉嫌故意伤害罪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0407.wav", "duration": 4.056875, "text": "也从原计划的二零一六年七月一日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0427.wav", "duration": 2.4260625, "text": "此视频曝光后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0136.wav", "duration": 4.153, "text": "兰州房地产市场销量增加明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0325.wav", "duration": 4.0019375, "text": "他们的硬件技术研发等力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0196.wav", "duration": 6.158, "text": "抓紧研究完善海洋环境保护的法律法规"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0228.wav", "duration": 3.4360625, "text": "改善养殖业生产条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0134.wav", "duration": 3.083, "text": "我想把房产留给儿女"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0154.wav", "duration": 5.4560625, "text": "委托人以其持有的资金设立一个单一资金信托"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0302.wav", "duration": 6.547875, "text": "该季度苹果大中华区营收为一百三十二点三亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0124.wav", "duration": 5.23, "text": "百分之五的网友倾向于房产税的开征"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0230.wav", "duration": 4.0810625, "text": "切实加强重金属污染防治"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0485.wav", "duration": 5.6130625, "text": "温岭倒塌厂房系违章建筑涉事负责人已被控制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0449.wav", "duration": 5.0239375, "text": "致力优化营商环境有信心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0282.wav", "duration": 5.2010625, "text": "美方对中国产品进行限制的做法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0398.wav", "duration": 4.1289375, "text": "为期五天的比赛全部结束后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0457.wav", "duration": 8.407, "text": "村医研发神奇止痛药网销全全国获刑三年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0432.wav", "duration": 4.3039375, "text": "村民蜂拥而至捉小鸡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0432.wav", "duration": 7.229, "text": "他指使他人虚开发票六万馀元用公款报销"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0241.wav", "duration": 3.3509375, "text": "责任编辑廖一宁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0142.wav", "duration": 5.357, "text": "中原地产首席分析师张大伟分析"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0290.wav", "duration": 5.5959375, "text": "意味着只要用户要选择高端手机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0218.wav", "duration": 5.3360625, "text": "发改委多渠道筹集保障房建设资金到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0228.wav", "duration": 2.9569375, "text": "加大政府投入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0425.wav", "duration": 2.582, "text": "并送上真挚祝福"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0163.wav", "duration": 3.328, "text": "保持原有业务的正常运作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0197.wav", "duration": 4.086, "text": "免费新规究竟啥时能享受到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0461.wav", "duration": 8.0500625, "text": "网络上一张永嘉桥头国际饭店的结帐单十分引人注目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0197.wav", "duration": 3.069, "text": "在加大要素支持方面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0233.wav", "duration": 4.0240625, "text": "所投项目必须经过合规性审查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0147.wav", "duration": 5.268, "text": "这将使更多购房者具备买房支付能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0473.wav", "duration": 5.2580625, "text": "办案民警检查作案设备金华警方供图昨天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0479.wav", "duration": 7.671125, "text": "游客美签被废因访美停留太久称从没到过欧洲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0167.wav", "duration": 6.495, "text": "广州五月二手房均价为一千元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0127.wav", "duration": 5.384, "text": "开发商投资增速处于不断下降的状态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0231.wav", "duration": 4.2430625, "text": "提出完善农产品流通税收政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0166.wav", "duration": 7.647125, "text": "五月份的供求关系是今年前五个月最均衡的一次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0269.wav", "duration": 3.49, "text": "我们迎来了赶超发达国家的难得机遇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0449.wav", "duration": 4.183125, "text": "可是我遇见这事还不够添堵的呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0239.wav", "duration": 5.89, "text": "十一五期间我国累计境外投资七千亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0415.wav", "duration": 5.816875, "text": "甚至被外界揣测是因为和阮经天分手后所刺"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0453.wav", "duration": 4.797125, "text": "将接团的两家旅行社起诉至法院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0129.wav", "duration": 4.142, "text": "房价起飞前购置了十几套房产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0351.wav", "duration": 4.033, "text": "安娜莱纳法拉塞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0387.wav", "duration": 3.087, "text": "朱婷表示其实我也想"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0438.wav", "duration": 6.0, "text": "京华时报讯记者卫张宁昨天上午"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0343.wav", "duration": 4.204125, "text": "铁定会有助于提升我国的冰球水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0149.wav", "duration": 4.0290625, "text": "通过信托实现了财产的隔离保护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0493.wav", "duration": 8.829125, "text": "村官私刻公章侵占二八万粮补派人殴打上访村民"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0168.wav", "duration": 3.763, "text": "这暗示房地产的库存大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0182.wav", "duration": 4.3719375, "text": "上周五的双降政策让市场担忧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0406.wav", "duration": 5.7009375, "text": "搜狐娱乐讯文耷子备受关注的重拍版乌鸦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0476.wav", "duration": 4.3679375, "text": "该案也被列为公安部督办大案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0233.wav", "duration": 3.0599375, "text": "拓宽投资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0139.wav", "duration": 3.2150625, "text": "一直以来广受购房者青睐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0137.wav", "duration": 5.499, "text": "北京将继续改进住宅产业化推进方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0474.wav", "duration": 4.0031875, "text": "企业应该做好的投资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0168.wav", "duration": 3.372, "text": "他们说不定又有离婚风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0161.wav", "duration": 5.258, "text": "楼市调控供的行政手段宜减不宜加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0398.wav", "duration": 2.6450625, "text": "曾春蕾保持着清醒的头脑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0203.wav", "duration": 8.334, "text": "下一步将进一步完善城投债券发行制度和防范风险机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0454.wav", "duration": 8.296875, "text": "才七个月大的女童腾腾化名已昏迷了两天时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0410.wav", "duration": 2.901125, "text": "力证自己没有怀孕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0441.wav", "duration": 5.4760625, "text": "她一直假冒的林某竟是她的女儿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0215.wav", "duration": 6.9339375, "text": "建立渤海海洋环境预警机制和突发事件应对机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0124.wav", "duration": 4.519, "text": "催生了广告领域新的变革和创新"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0157.wav", "duration": 2.846, "text": "从一系列公积金政策看来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0401.wav", "duration": 5.0539375, "text": "这同样需要有效的办法和手段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0194.wav", "duration": 3.353, "text": "加强农业科技交流合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0122.wav", "duration": 5.8660625, "text": "这个政策的出台是希望刺激房地产投资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0351.wav", "duration": 5.3820625, "text": "赛后有媒体发布了他几乎扭曲的背部肌肉的照片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0325.wav", "duration": 3.0920625, "text": "当务之急是扭转业绩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0236.wav", "duration": 4.6069375, "text": "加强主要农产品优势产区加工基地建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0367.wav", "duration": 3.7690625, "text": "其中国际级裁判员两名"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0441.wav", "duration": 3.5239375, "text": "当时游客出言不逊在先"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0193.wav", "duration": 5.39, "text": "制定扶持农业产业化龙头企业发展的综合性政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0272.wav", "duration": 6.108875, "text": "这种状态是苹果颠复现有市场格局的根基"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0410.wav", "duration": 4.864, "text": "却被曝出在机场大发飙"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0419.wav", "duration": 6.0290625, "text": "却多次被身边的人将他们的行踪暴露出来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0453.wav", "duration": 10.876, "text": "温州七人涉嫌百倍抬杠非法经营期货三二亿被批货"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0416.wav", "duration": 3.354, "text": "由潮男陈冠希打头阵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0250.wav", "duration": 2.6530625, "text": "人工种草五亿亩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0170.wav", "duration": 5.348, "text": "而且提供各项行生的福利性服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0215.wav", "duration": 4.1109375, "text": "大规模开展高标准农田建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0222.wav", "duration": 9.751, "text": "由于目前城投债劵的发行需要符合企业的债劵发行的条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0136.wav", "duration": 5.104, "text": "一些地方土地出让收支核算不够规范"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0153.wav", "duration": 6.0849375, "text": "这宗零售商业用地位于南三环外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0445.wav", "duration": 4.001, "text": "因惠民路南段从去年开通后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0331.wav", "duration": 4.451875, "text": "但是由于该项业务占比较小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0375.wav", "duration": 7.832, "text": "中国队三比二力克美国队收获分站赛九连胜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0317.wav", "duration": 4.348, "text": "新能源汽车的爆发使得锂电池供不应求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0456.wav", "duration": 2.764875, "text": "专家没有科学依据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0364.wav", "duration": 2.323, "text": "是心智上的一个考验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0276.wav", "duration": 4.1169375, "text": "一般不会给消费者带来巨大损失"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0303.wav", "duration": 7.7320625, "text": "手机辐射的比吸收率最高限值为二瓦特每千克"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0316.wav", "duration": 6.1280625, "text": "预计在三四季度会有陆续新增产能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0284.wav", "duration": 5.193125, "text": "提供免费房地产估价服务的网站"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0135.wav", "duration": 4.2939375, "text": "很多人需要支付大额首付"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0240.wav", "duration": 7.375, "text": "高速公路以车辆驶离出口收费车车道的时间为准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0151.wav", "duration": 4.2979375, "text": "市场上约有两成业主反价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0380.wav", "duration": 4.723125, "text": "为振兴三大球贡献自己的一份力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0153.wav", "duration": 6.901, "text": "全国已有超百个城市发布了不同力度的公积金松绑政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0495.wav", "duration": 8.6809375, "text": "温州一男子在医院放置假炸弹被判处有期徒刑一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0367.wav", "duration": 6.272, "text": "其中主要集中于冰雪运动本身实力上的有所欠缺"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0433.wav", "duration": 3.2988125, "text": "称一篇似是而非的文章"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0460.wav", "duration": 4.0810625, "text": "虽然海滩上设置了众多垃圾桶"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0288.wav", "duration": 11.1069375, "text": "苹果股价下跌百分之五分析师出现重大分歧搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0235.wav", "duration": 3.8770625, "text": "建设水产健康养殖示范场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0172.wav", "duration": 3.803, "text": "尤其是在三四线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0236.wav", "duration": 6.1170625, "text": "补充建设一批部级专业质检中心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0281.wav", "duration": 6.6108125, "text": "苹果领头的股价闪崩原因可能比想象中的更为复杂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0223.wav", "duration": 3.328, "text": "稳定增加玉米播种面积"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0330.wav", "duration": 8.906, "text": "每日经济新闻记者杨建江南嘉捷六万一千一百三十一三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0303.wav", "duration": 4.2310625, "text": "且达到情节特别严重程度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0169.wav", "duration": 5.412, "text": "你要懂既然不是电子产品不是易损品不是玩品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0375.wav", "duration": 8.1540625, "text": "中国和多米尼加同积九分排在第四和第五位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0265.wav", "duration": 6.801, "text": "在苹果发布靓丽的第四财季业绩报告后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0140.wav", "duration": 6.881, "text": "全国房地产开发投资增速仍然延续了增速放缓的渠势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0293.wav", "duration": 5.8200625, "text": "老毕于跟苹果押注太阳能一文问过大家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0337.wav", "duration": 5.1240625, "text": "根据国际非电离辐射防护委员会制定的标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0336.wav", "duration": 5.2539375, "text": "在无开灯照明的情况下也能正常稳定运行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0359.wav", "duration": 5.443875, "text": "今天作为队长我更多是在精神层面上提醒大家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0419.wav", "duration": 4.7900625, "text": "阮经天和许玮甯交往八年屡传婚讯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0153.wav", "duration": 4.701, "text": "调整公积金年度缴存上下限和缴存比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0472.wav", "duration": 8.673125, "text": "游戏网站频遭攻击每周交二零零零元保护费息事宁人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0308.wav", "duration": 6.0019375, "text": "中国的中高端嵌入式芯片全部从德国日本进口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0377.wav", "duration": 4.536125, "text": "日本网友也是众说纷纭一点儿也不吃惊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0468.wav", "duration": 3.521, "text": "图为其中一名被解救的孩子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0404.wav", "duration": 8.004875, "text": "去年美国队长二寒冬战士就曾在四月登陆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0361.wav", "duration": 5.215125, "text": "普鲁申科被诊断患上了一种新的脊椎疾病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0254.wav", "duration": 5.5, "text": "据新华社电印度官员透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0463.wav", "duration": 8.1648125, "text": "湖北省荆州市安监局召开安良百货电梯事故情报通报会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0270.wav", "duration": 3.2370625, "text": "乔布斯想成为重要人物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0315.wav", "duration": 4.7580625, "text": "由于中国政府的大力扶持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0280.wav", "duration": 5.5, "text": "雇员们也在很大程度上受到了鼓舞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0267.wav", "duration": 6.9460625, "text": "苹果在二零一四年营收为二百二十二亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0206.wav", "duration": 3.8089375, "text": "相关公司股票走势农产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0276.wav", "duration": 6.1689375, "text": "对于苹果公司来说这是很关键的一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0129.wav", "duration": 2.5550625, "text": "服务项目几千个"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0470.wav", "duration": 2.756875, "text": "以给编制五险一金等为借口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0306.wav", "duration": 4.011, "text": "近日的走势也强于大盘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0153.wav", "duration": 2.5190625, "text": "同比下降不少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0246.wav", "duration": 4.817, "text": "落实鲜活农产品运输绿化通道政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0134.wav", "duration": 4.857, "text": "再次申请公积金贷款购买第二套房的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0388.wav", "duration": 3.3198125, "text": "都无法代表韩国参加国际比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0419.wav", "duration": 6.511, "text": "被问到有传其胞兄谢霆锋将与王菲结婚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0466.wav", "duration": 4.938, "text": "一语回击一次性参赛这种说法是一种侮辱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0320.wav", "duration": 4.2110625, "text": "时代力量正在颠复着家电行业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0274.wav", "duration": 5.0119375, "text": "规模超大的人才群体更是创新创造无与伦比的重要资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0348.wav", "duration": 3.405, "text": "在第四轮与韩国队的比赛中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0373.wav", "duration": 3.0239375, "text": "需要不停地告诫自己要淡定下来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0197.wav", "duration": 4.8239375, "text": "对丰富债券市场品种也具有积极意义"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0455.wav", "duration": 6.619875, "text": "以一一零倍的杠杆吸引社会公众投资"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0442.wav", "duration": 6.119875, "text": "李嘉诚正式回应撤资指控不相信文革式思维复苏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0155.wav", "duration": 5.6780625, "text": "各方原因的叠加导致了房企拿地量的明显减少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0343.wav", "duration": 5.1689375, "text": "本场比赛朱婷三七次扣球得到二十一分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0414.wav", "duration": 7.447, "text": "搜狐娱乐讯陈妍希传出和陈晓的恋情之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0155.wav", "duration": 4.02, "text": "对房地产市场的心理影响比较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0318.wav", "duration": 4.844, "text": "而去年同期盈利十六点七六亿港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0201.wav", "duration": 9.324, "text": "国务院已经批准信贷资产证券化继续扩大试点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0174.wav", "duration": 3.72, "text": "会对市场造成新一轮的干扰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0389.wav", "duration": 5.563, "text": "加上近几年承办诸多国际性赛事的经验积累"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0129.wav", "duration": 3.9449375, "text": "叠加春节因素的影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0339.wav", "duration": 2.796875, "text": "对阵俄罗斯的比赛中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0462.wav", "duration": 6.5, "text": "从二八日凌晨四点半至六点半这整整二个小时里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0390.wav", "duration": 5.76975, "text": "更直观的体现是在冰雪运动的核心项目冰球上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0131.wav", "duration": 3.7049375, "text": "这些房产全由宋芳自己打理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0156.wav", "duration": 4.156, "text": "还是不再区分普通和非普通住房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0388.wav", "duration": 5.406, "text": "让我们能够来一次说走就走的冬奥之行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0268.wav", "duration": 3.3030625, "text": "它依旧要面对政府的刁难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0263.wav", "duration": 3.7430625, "text": "避免不了出现一些漏洞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0457.wav", "duration": 6.271, "text": "湖北咬人电梯厂家曾为盖板支架申请专利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0204.wav", "duration": 3.3139375, "text": "组织实施一批重大工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0233.wav", "duration": 6.175875, "text": "全面取消主产区粮食风险基金地方资金配套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0316.wav", "duration": 7.057, "text": "在成名三十馀年后仍在竭力寻求业态的新鲜化和可能性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0221.wav", "duration": 6.766, "text": "有利于加快完善基础设施和投资环境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0490.wav", "duration": 6.177, "text": "渔民投诉遭离奇执法被派出所讨价还价式罚款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0213.wav", "duration": 6.665875, "text": "鼓励外出务工农农民带技术带资金回乡创业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0332.wav", "duration": 9.056875, "text": "除了在顺德工厂建成全自动遥控器生产线外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0261.wav", "duration": 3.74, "text": "他们很快提供了修复软件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0206.wav", "duration": 5.0710625, "text": "丰富和解调解仲裁诉诉讼等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0477.wav", "duration": 6.083, "text": "参考消息网九月二五日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0192.wav", "duration": 4.114, "text": "但禁止改变用途和性质"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0412.wav", "duration": 2.469, "text": "后来突然冒出头来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0284.wav", "duration": 4.3189375, "text": "原创张驰乔布斯逝世已久"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0294.wav", "duration": 7.0698125, "text": "苹果背后那行字应该在每个中国人心里搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0276.wav", "duration": 4.668, "text": "双目标不仅包括保持中高速增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0487.wav", "duration": 8.012, "text": "村民为解决问题给领导建庙官员其诉求不合规"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0137.wav", "duration": 5.347, "text": "改进住房公积金提取使用监管机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0197.wav", "duration": 4.4260625, "text": "大力发展现代农作物种业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0326.wav", "duration": 5.4250625, "text": "宽带和服务器的采购量也水涨船高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0224.wav", "duration": 3.8010625, "text": "积极恢复和稳定大豆种植面积"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0168.wav", "duration": 6.9349375, "text": "领头羊一线城市分别下降百分之一和百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0198.wav", "duration": 3.598, "text": "起到了非常积极的作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0320.wav", "duration": 4.739, "text": "成飞集成的锂电池业务在前两年情况并不好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0480.wav", "duration": 4.5070625, "text": "在严查四风的高压态势下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0465.wav", "duration": 4.7839375, "text": "数十名市民赶到越秀区一酒家维权"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0374.wav", "duration": 6.379875, "text": "多国大神级搏击王者论剑昆仑武道之巅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0370.wav", "duration": 5.0910625, "text": "电子科大的小青椒早上六点起床"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0421.wav", "duration": 3.396, "text": "她说之前打电话给医生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0361.wav", "duration": 3.3730625, "text": "朱婷斩获了一六七分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0439.wav", "duration": 3.061, "text": "该事件引发广泛关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0388.wav", "duration": 5.36, "text": "女排三零阿根廷朱婷复出扣杀状态神勇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0354.wav", "duration": 3.9150625, "text": "还有二零一五年的田径世锦赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0310.wav", "duration": 4.116, "text": "围绕几大智能管家平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0358.wav", "duration": 4.201875, "text": "脚踝的能力损失了大约百分之四十八"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0355.wav", "duration": 3.906, "text": "他每周二三天来学校"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0429.wav", "duration": 2.650875, "text": "谢霆锋戴着帽子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0318.wav", "duration": 3.626, "text": "手机是直接贴着耳朵使用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0137.wav", "duration": 5.658, "text": "公积金贷款最高额度亦不同程度上调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0133.wav", "duration": 6.0740625, "text": "建议房企不要一味强调做大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0445.wav", "duration": 3.8139375, "text": "吸引众多市民驻足观看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0483.wav", "duration": 7.828875, "text": "游客被黑导游拉进农家宴消费蘑菇炖鸡卖九零零元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0352.wav", "duration": 6.251, "text": "北京市体育局副局长孙学才宣布比赛开幕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0430.wav", "duration": 5.5600625, "text": "因而痛斩情丝她除了拥有模特儿火辣身材"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0148.wav", "duration": 3.46, "text": "由国土资源部联合国家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0166.wav", "duration": 3.8119375, "text": "七月北京公积金贷款成交量提升了百分之五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0330.wav", "duration": 4.4309375, "text": "家电企业自动化升级改造必须进行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0243.wav", "duration": 3.557, "text": "治理和控制农业面源污染"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0305.wav", "duration": 7.392, "text": "紫光股份曾经出现一连波连续十六个一字涨停的狂飙行市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0298.wav", "duration": 3.067125, "text": "这行字值得我们深思"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0223.wav", "duration": 6.139, "text": "确保保障性安居工程年度建设任务的完成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0317.wav", "duration": 3.8359375, "text": "实现自动化升级也没那么简单"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0414.wav", "duration": 2.798125, "text": "不与无线续约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0452.wav", "duration": 3.957, "text": "两车损失高达三四十万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0366.wav", "duration": 5.375, "text": "每支报名队伍以企业为单位每队十名成员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0438.wav", "duration": 3.233875, "text": "火灾造成四人死亡一人受伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0339.wav", "duration": 6.3618125, "text": "三千米障碍吉萨费里欣塔斯卡鲁塞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0424.wav", "duration": 8.6008125, "text": "搜狐娱乐讯近日频频传出陈晓向陈妍希求婚成功的消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0393.wav", "duration": 3.2900625, "text": "将去年输球的原因作为教训反思"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0230.wav", "duration": 7.1899375, "text": "国务院总理温家宝五日主持召开国务院常务会议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0218.wav", "duration": 6.848, "text": "城投债劵作为投融资平台公司最透明的直接融资工具"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0204.wav", "duration": 4.0660625, "text": "农业生产条件具有良好基础"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0424.wav", "duration": 4.5180625, "text": "希望送上歌曲今日为受害者打气"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0187.wav", "duration": 3.6270625, "text": "示范带动周边地区发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0283.wav", "duration": 5.3510625, "text": "是对贸易救济措施的滥用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0162.wav", "duration": 3.767, "text": "没有智慧手机的成员无法开门"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0153.wav", "duration": 7.061, "text": "大开发商有机会借此提高行业集中程度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0307.wav", "duration": 6.198, "text": "美芝压缩机已是全球最大空调压缩机企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0217.wav", "duration": 3.0590625, "text": "营造良好的消费环境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0341.wav", "duration": 3.708, "text": "阿拉木图都无法和北京相比"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0176.wav", "duration": 5.77, "text": "他不能按电子产品或传统居家产品的模式去销售"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0401.wav", "duration": 3.437, "text": "为参加联赛的吸引力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0201.wav", "duration": 3.8310625, "text": "农产品流通加工标准化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0488.wav", "duration": 6.614, "text": "港媒中式教学不可复制中国学生在哪都能拿高分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0311.wav", "duration": 4.1469375, "text": "截至中国经营报记者发稿前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0267.wav", "duration": 3.3469375, "text": "苹果设备的用户应当注意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0452.wav", "duration": 5.431875, "text": "但指纹比对识别系统会出现一定概率的遗漏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0249.wav", "duration": 8.7320625, "text": "合理确定耐贮蔬菜的流通动态库存数量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0430.wav", "duration": 3.242875, "text": "一家人很难有机会团聚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0272.wav", "duration": 3.0, "text": "按照国内消费者的习惯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0287.wav", "duration": 3.5559375, "text": "苹果在高端市场击溃了对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0437.wav", "duration": 4.3220625, "text": "个人寄快递必须登记有效的身份证件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0460.wav", "duration": 5.3288125, "text": "目前李斯达被关押在朝阳区看守所"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0335.wav", "duration": 4.6679375, "text": "中国电力科学研究院高级工程师邬雄表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0220.wav", "duration": 6.196875, "text": "中国证券报面对市场对城投债券风险的担忧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0295.wav", "duration": 3.150875, "text": "而库克若真有此意"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0292.wav", "duration": 4.6599375, "text": "对于游戏这种地域属性较重的产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0335.wav", "duration": 6.594, "text": "随着国家在科技创新方面的投入和关注度的增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0425.wav", "duration": 3.609125, "text": "一怒之下把大叔身份证扔在地上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0490.wav", "duration": 4.673125, "text": "内江人张先生在这次国庆期间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0423.wav", "duration": 2.563, "text": "但不至于要吃药"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0286.wav", "duration": 5.8619375, "text": "印度斯坦时报二十四日援引消息人士的话报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0190.wav", "duration": 5.832, "text": "按照总量持续增长比例稳步提高的要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0130.wav", "duration": 4.6339375, "text": "这种情况在二月可能较明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0166.wav", "duration": 8.0, "text": "将生活社区与科技园区两种空间组织融合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0163.wav", "duration": 3.232, "text": "从我们遇到的客户来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0243.wav", "duration": 3.76, "text": "由各省区市人民政府决定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0216.wav", "duration": 4.0689375, "text": "坚持用现代物质条件装备农业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0324.wav", "duration": 4.8840625, "text": "要跟上互联网发展的步伐不太容易"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0146.wav", "duration": 6.286, "text": "房地产的投资增速目前不到五百分之"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0286.wav", "duration": 4.458, "text": "而且以喜欢点评各家公司着称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0430.wav", "duration": 2.7099375, "text": "嘟嘴作亲吻状"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0153.wav", "duration": 8.832, "text": "近郊小户型楼盘及城区部分公房社区客户咨询量上升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0157.wav", "duration": 5.751, "text": "对于实施住房限购政策的城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0171.wav", "duration": 4.4049375, "text": "在宋芳的资金信托购买其房产时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0472.wav", "duration": 4.0590625, "text": "却为了发电断了灌溉农田的水"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0289.wav", "duration": 5.7370625, "text": "却完全不足以彰显编制机构与时并进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0374.wav", "duration": 3.355, "text": "腿长足足十二厘米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0305.wav", "duration": 8.6630625, "text": "这个在美的空调的南沙工厂武汉工厂已全面试点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0258.wav", "duration": 8.012, "text": "二零一五年最适宜供职的公司仍在科技领域"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0258.wav", "duration": 4.89, "text": "安全性的提升需要牺牲一定的便携性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0452.wav", "duration": 4.0790625, "text": "让一零月的天空有点甜蜜蜜的味道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0236.wav", "duration": 8.5920625, "text": "扩大草原生态保护面源污染防控生态奖补范围和规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0301.wav", "duration": 9.1180625, "text": "但新贵移动支付具绝对能更深层次地改变用户的生活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0231.wav", "duration": 5.068, "text": "国务院高度重视防范地方政府债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0245.wav", "duration": 5.9869375, "text": "完善市场监测预警和信息发布机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0204.wav", "duration": 9.2530625, "text": "进一步完善农业产业损害监测预警机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0156.wav", "duration": 5.747, "text": "预计还有其他城市将发布同类型松绑政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0483.wav", "duration": 5.715125, "text": "南海的渔民在捕鱼的时候就曾捞出过一个奇怪的东西"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0316.wav", "duration": 3.6689375, "text": "这将会导致行车安全问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0147.wav", "duration": 4.471, "text": "市场上就出现了各类新型技术软件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0342.wav", "duration": 4.2949375, "text": "却可以演绎出撼人心魄的体育大美"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0477.wav", "duration": 5.583, "text": "董某某所受损伤程度属二重伤二级"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0223.wav", "duration": 3.365, "text": "城投债作为一个信用产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0264.wav", "duration": 4.629, "text": "最基本的逻辑就是我们不读取信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0495.wav", "duration": 3.5649375, "text": "被称为二零一五年第一神曲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0180.wav", "duration": 3.5, "text": "其成立需具备哪些条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0127.wav", "duration": 4.798, "text": "普通住宅很可能仍将限购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0415.wav", "duration": 2.4860625, "text": "称为了演好戏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0251.wav", "duration": 8.5610625, "text": "鼓励优先类支持允许类天然气利用项目发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0313.wav", "duration": 7.257125, "text": "国家信息安全的问题被推到了风口浪尖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0207.wav", "duration": 5.2900625, "text": "占非金融企业直接债务融资总额之比"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0442.wav", "duration": 5.7729375, "text": "消费者根本很难判断什么叫做不合理低价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0345.wav", "duration": 3.803, "text": "对于这场比赛的备战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0390.wav", "duration": 3.699, "text": "废除这个第五条第六项"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0373.wav", "duration": 6.488, "text": "这一项目将为神农架林区的孩子筹建开放式体育空间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0139.wav", "duration": 3.331, "text": "国家统计局的数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0158.wav", "duration": 5.8990625, "text": "境外个人购房应当符合当地政策规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0423.wav", "duration": 5.927, "text": "又透露去年曾在天津举办演唱会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0290.wav", "duration": 2.9339375, "text": "长期处在产业链的末端"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0195.wav", "duration": 4.5630625, "text": "国务院及五部门并没有明确实施时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0232.wav", "duration": 4.093, "text": "核电重启的曙光越来越近"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0284.wav", "duration": 3.298, "text": "微芯片科技公司表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0346.wav", "duration": 5.400875, "text": "作为有史以来天赋最高的花样滑冰运动员之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0121.wav", "duration": 3.174, "text": "实现数字化整合营销"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0383.wav", "duration": 5.296125, "text": "一万米阿尔恩加比乌斯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0284.wav", "duration": 3.6010625, "text": "不断提高技术创新对经济发展的贡献率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0376.wav", "duration": 5.457, "text": "我国选手才实现了冬奥奖牌零的突破"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0291.wav", "duration": 4.38, "text": "期待着越来越多中国设计的产品不断涌现并享誉国际"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0417.wav", "duration": 4.953125, "text": "背后意义竟只是不要忘记自己从哪里来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0471.wav", "duration": 8.297875, "text": "奉化江口儒江村村委会却带头盖起了违法建筑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0247.wav", "duration": 5.0959375, "text": "有关部门和企业迅速组织整改"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0268.wav", "duration": 6.0550625, "text": "这些被市场唱空的游戏公司本身业务模式遇到了困境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0412.wav", "duration": 4.594, "text": "搜狐娱乐讯十月九日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0322.wav", "duration": 4.77, "text": "以后将能够与周围环境交流"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0200.wav", "duration": 5.491, "text": "结合地方政府债务管理制度的完善"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0410.wav", "duration": 3.212125, "text": "对于姊弟恋也不排斥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0348.wav", "duration": 4.1291875, "text": "开幕式举行了庄严的入场仪式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0205.wav", "duration": 6.5809375, "text": "全面分实现代农业发展的物质基础"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0405.wav", "duration": 6.2468125, "text": "但最终却因为出品公司相对论影业申请破产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0436.wav", "duration": 4.8449375, "text": "湖北省黄冈市公安局通报称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0162.wav", "duration": 8.5, "text": "二的向境外投资方出售国内资产征税规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0214.wav", "duration": 6.4499375, "text": "将公共交通放在城市交通发展的首要位置"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0263.wav", "duration": 3.97, "text": "不过这话他在去年就说过"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0247.wav", "duration": 5.6589375, "text": "债卷市场城投债卷发行不畅"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0348.wav", "duration": 4.73, "text": "对于综合能力的严苛要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0417.wav", "duration": 5.8151875, "text": "不开心时会找太太徐濠所倾诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0342.wav", "duration": 4.208, "text": "也是我喜欢的格斗方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0188.wav", "duration": 5.257, "text": "督促责任单位彻底排查溢油风险点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0368.wav", "duration": 2.6389375, "text": "搜狐体育郭健文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0446.wav", "duration": 3.7880625, "text": "用支付宝扫一下就能付款"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0320.wav", "duration": 6.0710625, "text": "较上年同期增长八十四点百分之三十九"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0459.wav", "duration": 3.327125, "text": "带着辛吉斯逛完了黄鹤楼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0136.wav", "duration": 8.1439375, "text": "未来房企拿地投资新开工等指标可能受到影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0129.wav", "duration": 3.461, "text": "同比去年增长五成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0154.wav", "duration": 4.932, "text": "在对央企的审计也发现了不少问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0317.wav", "duration": 3.9449375, "text": "目前美芝与威灵的合并"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0131.wav", "duration": 8.223, "text": "国管住房公积金中心则表示取消担保服务费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0371.wav", "duration": 4.501, "text": "是去年备战亚运会选拔赛期间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0426.wav", "duration": 10.823, "text": "曾江谢贤四哥及胡枫修哥大谈往日情时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0427.wav", "duration": 4.7900625, "text": "不同于大家心中按部就班的乖乖女形象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0467.wav", "duration": 10.5649375, "text": "村妇将一零万元现金埋地底四年多已腐烂成碎块"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0204.wav", "duration": 5.9030625, "text": "需要为各地的城市建设提供规范的融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0356.wav", "duration": 3.7629375, "text": "而这一次击败他的不是对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0493.wav", "duration": 3.4648125, "text": "公司却遇到了资金困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0145.wav", "duration": 4.772, "text": "一直以来广受购房者青睐"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0402.wav", "duration": 3.5080625, "text": "为中国战队打响第一枪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0311.wav", "duration": 5.8408125, "text": "正规厂家生产的电话手表辐射一般符合国家标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0332.wav", "duration": 4.4670625, "text": "随着产品快速进入家长和孩童的视野"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0214.wav", "duration": 5.3609375, "text": "要继续开展商贸零售领域价格秩序整治"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0427.wav", "duration": 5.5500625, "text": "中新网五月二十一日报道据香港明报消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0305.wav", "duration": 5.751, "text": "每日经济新闻记者从美的家用空调事业部了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0359.wav", "duration": 3.3730625, "text": "播求头部的伤口进一步扩大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0482.wav", "duration": 4.3059375, "text": "四人鞠躬道歉据瓜沥人网"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0423.wav", "duration": 5.313, "text": "有网友日前目击他俩在大稻埕分食炒饭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0226.wav", "duration": 3.9450625, "text": "切实加强央企境外投资监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0250.wav", "duration": 4.4050625, "text": "增强农业科技自主创新能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0443.wav", "duration": 4.78, "text": "小区外的空置地上填满垃圾近日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0360.wav", "duration": 4.8459375, "text": "让他们能在工作之馀释放对于体育的热情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0301.wav", "duration": 5.188, "text": "根据近期公布的苹果第三财季业业绩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0214.wav", "duration": 5.2930625, "text": "特别是地方投融资平台公司形成的债务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0241.wav", "duration": 4.803, "text": "难以满足发行城投债券的资格和条件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0239.wav", "duration": 3.87, "text": "完善流通链条和市场布局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0305.wav", "duration": 4.645, "text": "在前段时间的上海家电展上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0188.wav", "duration": 5.3410625, "text": "我们立即与云投集团进行了沟通"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0468.wav", "duration": 3.620875, "text": "没有发生任何肢体冲突"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0178.wav", "duration": 6.151, "text": "稳增长措施需更全面地考虑化解楼市风险问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0332.wav", "duration": 3.8889375, "text": "除了后期技术维护能力外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0481.wav", "duration": 5.4399375, "text": "参考消息网八月二日报道外媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0415.wav", "duration": 5.229, "text": "搜狐娱乐讯据香港明晚九月十日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0445.wav", "duration": 3.267125, "text": "车辆载有数十名乘客"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0121.wav", "duration": 2.922, "text": "从房地产的角度来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0140.wav", "duration": 4.273, "text": "住建部等三部委再次联合发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0140.wav", "duration": 4.057, "text": "包括五个一二线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0381.wav", "duration": 4.4409375, "text": "在二零二二年冬季奥运会的竞选当中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0145.wav", "duration": 5.397, "text": "主要目的是通过激励改善型住房需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0289.wav", "duration": 5.457, "text": "二零零三年以来在阿富汗得到了广泛应用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0455.wav", "duration": 4.775875, "text": "视频截图新京报快讯记者杨锋昨日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0281.wav", "duration": 3.891, "text": "中方对此表示强烈不满"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0150.wav", "duration": 4.147, "text": "比去年底增加了七万平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0303.wav", "duration": 4.713125, "text": "今后所有空调产品还将实现联机运行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0154.wav", "duration": 3.625, "text": "设立住房银行好处多多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0428.wav", "duration": 4.208, "text": "结婚都只是一张纸同戒指"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0201.wav", "duration": 4.272, "text": "现代农业发展的动力更加强劲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0457.wav", "duration": 3.5, "text": "网上流传的视频可见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0372.wav", "duration": 3.3398125, "text": "目前报名仍在进行中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0161.wav", "duration": 5.6440625, "text": "为促进房地产市场平稳健康发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0264.wav", "duration": 7.725125, "text": "而且在整个榜单也位居首位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0360.wav", "duration": 6.110125, "text": "几乎全部被鲜血复盖的半边身体令人触目惊心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0387.wav", "duration": 3.55325, "text": "作为经验最为丰富的老大哥"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0439.wav", "duration": 3.732875, "text": "涉案金额三零零多万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0458.wav", "duration": 6.1760625, "text": "高招本科二批今天开始进行征集志愿录取"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0131.wav", "duration": 5.229, "text": "增速比一月份回落零点九个百分点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0480.wav", "duration": 3.926, "text": "凶手在郫县安靖镇被抓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0276.wav", "duration": 4.4930625, "text": "但相对于传统的汽车制造工业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0340.wav", "duration": 4.473125, "text": "在张常宁一度进行进攻受阻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0478.wav", "duration": 4.119125, "text": "四川广安一一岁女孩的失踪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0489.wav", "duration": 8.2890625, "text": "释放出中央执纪必严紧抓不放的强烈信号"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0319.wav", "duration": 3.108, "text": "锂电需求带动业绩增长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0238.wav", "duration": 4.946875, "text": "考虑到我国正处在经济快速增长期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0332.wav", "duration": 3.604, "text": "为使股价与公司价值匹配"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0326.wav", "duration": 5.496125, "text": "除了之前提到的关于辐射的测试报告外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0134.wav", "duration": 5.0, "text": "设立政策性住宅金融机构"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0466.wav", "duration": 3.391125, "text": "还卖了自己在杭州和乐清的房子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0411.wav", "duration": 3.093, "text": "很多演员都非常棒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0156.wav", "duration": 4.199, "text": "潘家村地块体量较小"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0486.wav", "duration": 5.640875, "text": "经国家安全部门会同有关技术权威部门鉴定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0141.wav", "duration": 4.235, "text": "美丽北京大型绿色公益品牌项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0360.wav", "duration": 4.251, "text": "正是治疗他心悸不适症状的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0468.wav", "duration": 3.26, "text": "面对第一财经日报记者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0443.wav", "duration": 3.1699375, "text": "买菜用支付宝扫码付钱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0252.wav", "duration": 5.307, "text": "必须从我国国情和农业发展实际出发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0219.wav", "duration": 8.537, "text": "加快大中型灌区排灌泵站配套改造"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0389.wav", "duration": 3.0920625, "text": "就此事征求她的意见"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0451.wav", "duration": 4.1909375, "text": "天龙座流星雨猎户座流星雨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0415.wav", "duration": 3.2219375, "text": "并称攀岩太难会晃"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0360.wav", "duration": 4.2680625, "text": "其实在二零一四年女排大奖赛的总决赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0395.wav", "duration": 6.793, "text": "二零千米竞走尼尔斯布莱姆巴号"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0239.wav", "duration": 4.708, "text": "提高化学品生产的环境准入门槛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0191.wav", "duration": 7.8720625, "text": "完善生猪棉花食糖边销茶等调控预案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0147.wav", "duration": 5.091, "text": "尽管全国商品房销售面积持续回升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0361.wav", "duration": 5.5021875, "text": "双方的肘击对轰场面接连上演"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0397.wav", "duration": 3.0349375, "text": "自言就应该去承担更多的任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0311.wav", "duration": 3.7900625, "text": "电话手表就相当于一部简化的智能手机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0304.wav", "duration": 4.0119375, "text": "儿童电话手表还推出了其他更多人性化的创新功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0235.wav", "duration": 5.6889375, "text": "建设部级水产品质量安全研究中心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0217.wav", "duration": 3.427, "text": "大规模改造中低产田"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0285.wav", "duration": 5.5910625, "text": "苹果晋身道指固属众望所归"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0323.wav", "duration": 9.5849375, "text": "车企诚待转化互联网思维以及加强互联网安全管控等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0353.wav", "duration": 3.533, "text": "全都是手术缝合的痕迹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0421.wav", "duration": 2.743875, "text": "虽然未知去向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0421.wav", "duration": 4.369875, "text": "陈冠希坦言认为陈奕迅是k歌之王"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0263.wav", "duration": 3.5, "text": "是威力巨大的定时炸弹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0287.wav", "duration": 3.078125, "text": "苹果能否第三期发育"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0156.wav", "duration": 3.643, "text": "当供给远快于需求时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0306.wav", "duration": 5.0031875, "text": "事业部制一直是美的快速成长的法宝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0219.wav", "duration": 4.3139375, "text": "随着我国资本市场的进一步发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0389.wav", "duration": 5.8269375, "text": "义不容辞地想拯救运动生涯在绝境中的朴泰桓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0158.wav", "duration": 3.904, "text": "房企促销力度也在加大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0329.wav", "duration": 4.897, "text": "获取到的通讯录近两千万条"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0147.wav", "duration": 3.7360625, "text": "进一步加速了消费者的入市节奏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0396.wav", "duration": 3.1711875, "text": "二零一五年八月十五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0187.wav", "duration": 5.04, "text": "但是却不在国家文件所指的收费公路范围内"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0165.wav", "duration": 4.5229375, "text": "房价不太可能强劲反弹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0450.wav", "duration": 5.907, "text": "深圳警方查获的一个地下钱庄窝点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0137.wav", "duration": 3.3660625, "text": "此番公积金政策调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0471.wav", "duration": 7.8610625, "text": "大众网河南游客爆料在日照旅游团因吃海鲜太少被围殴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0306.wav", "duration": 4.1689375, "text": "自动化制造是未来唯一的出路"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0146.wav", "duration": 10.78, "text": "按新用途新权利类型市场价办理用地手续"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0392.wav", "duration": 3.5, "text": "她进攻的变化逐渐多了起来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0219.wav", "duration": 8.8059375, "text": "促进城市内外交通便利衔接和城乡公共交通一体化发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0169.wav", "duration": 3.9800625, "text": "将有效缓解购房能力不足矛盾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0312.wav", "duration": 5.884, "text": "将成立压缩机开发研究院和微电机开发研究院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0384.wav", "duration": 4.3579375, "text": "冰雪爱好者不得不选择出国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0389.wav", "duration": 3.1369375, "text": "对于这个万众期待的消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0447.wav", "duration": 2.636, "text": "踩一下就掉下来了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0218.wav", "duration": 4.2729375, "text": "从事当地基础建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0202.wav", "duration": 7.272, "text": "禁止在可能造成生态严重失衡的地方进行围填海活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0212.wav", "duration": 5.266125, "text": "加强农田水利和高标准农田建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0244.wav", "duration": 3.6789375, "text": "培育门类丰富层次齐用的综合利用产业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0157.wav", "duration": 5.768, "text": "一百平均单套总价约一百万元左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0155.wav", "duration": 3.812, "text": "将公积金贷款利率下调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0280.wav", "duration": 5.2270625, "text": "就在会场的凳子和垃圾尚未收拾干净的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0260.wav", "duration": 3.557, "text": "苹果市盈率仅一五倍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0306.wav", "duration": 6.406, "text": "对生活中的电磁辐射进行了全面健康风险评估"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0185.wav", "duration": 4.827, "text": "现在公积金贷款办理需要一个月左右的时间"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0311.wav", "duration": 4.375, "text": "如何借力拥抱互联网加这一全新变量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0148.wav", "duration": 3.446, "text": "但房企调价幅度有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0322.wav", "duration": 6.4460625, "text": "而不少品牌的电话手表量销售量更是突破百万大关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0179.wav", "duration": 4.942, "text": "促成了今年北京土地市场的走高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0196.wav", "duration": 4.598, "text": "从您刚才的介绍中我们了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0359.wav", "duration": 3.1850625, "text": "仰泳选手在比赛中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0424.wav", "duration": 3.546875, "text": "搜狐娱乐讯九月五日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0147.wav", "duration": 3.529, "text": "但您和您的儿女能自由支配"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0394.wav", "duration": 7.5390625, "text": "此时的祖耶夫右眼已经肿胀得完全封闭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0483.wav", "duration": 4.1020625, "text": "但愿望总是照不进现实"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0267.wav", "duration": 5.8400625, "text": "苹果的拿手好戏是把市场上原霸主拉下马"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0309.wav", "duration": 5.26, "text": "美的将美芝压缩机威灵电机合并"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0376.wav", "duration": 5.322, "text": "在世锦赛决赛检录前突感不适"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0269.wav", "duration": 5.6030625, "text": "不要在弹出窗口点击安装打开应用时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0324.wav", "duration": 5.01, "text": "他们需要的是智能厨房智能家居与家电"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0181.wav", "duration": 4.864, "text": "预计明年全国土地市场仍难复苏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0167.wav", "duration": 4.632, "text": "十位网友参与了本次调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0346.wav", "duration": 6.7569375, "text": "跑友们在奔跑中国沈阳站的赛道上尽情的展示自己"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0179.wav", "duration": 4.453, "text": "促进房地产市场平稳健康发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0264.wav", "duration": 6.3050625, "text": "成为苹果近三个月以来股价下跌最严重的一次"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0298.wav", "duration": 5.85, "text": "避免破坏两国相关产业的贸易与合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0326.wav", "duration": 2.932125, "text": "公司昨日发布公告称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0323.wav", "duration": 4.057125, "text": "为孩子多了一份强有力的保障"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0261.wav", "duration": 3.791, "text": "而这都是我自己的努力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0417.wav", "duration": 4.6889375, "text": "网友纷纷留言越来越像潮流教父了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0490.wav", "duration": 6.0549375, "text": "宣传的重点是中国教育和英国教育之战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0409.wav", "duration": 6.2060625, "text": "谢婷婷九月七日三十三岁生日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0321.wav", "duration": 3.913, "text": "才解决电话手表的内线内置问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0344.wav", "duration": 4.3989375, "text": "朱婷在中韩之战中一度受伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0172.wav", "duration": 5.8139375, "text": "公积金首付的再次降低实际影响有限"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0420.wav", "duration": 6.6110625, "text": "现场他透露道近日忙于内地巡演"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0402.wav", "duration": 4.3249375, "text": "但总的来说还是高兴多于遗憾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0332.wav", "duration": 5.6020625, "text": "海信科龙和惠而浦则是营收增"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0447.wav", "duration": 4.224125, "text": "错过了这次就要到二零三三年了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0348.wav", "duration": 2.7480625, "text": "说到今天获胜的原因"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0138.wav", "duration": 6.564, "text": "而现在这类城市的房价已经很高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0348.wav", "duration": 3.478, "text": "美国队十六分排第二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0297.wav", "duration": 3.8720625, "text": "希望美方吸取前车之鉴"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0242.wav", "duration": 9.1479375, "text": "对进一步深入检查及落实整改措施作了部署"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0362.wav", "duration": 5.062, "text": "萨维申科宣布会再坚持一个冬奥会周期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0470.wav", "duration": 4.1000625, "text": "不知不觉我成为一个八零后的老头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0162.wav", "duration": 3.197, "text": "促使更多购房者积极入市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0475.wav", "duration": 4.503875, "text": "店主陈某头皮裂创二处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0167.wav", "duration": 6.5, "text": "一线城市或将复苏率先复苏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0252.wav", "duration": 4.48, "text": "更好地保护债券投资人的利益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0325.wav", "duration": 3.079, "text": "对于创新成果的实证和检验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0200.wav", "duration": 5.891, "text": "全球绿色经济低碳技术正在兴起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0422.wav", "duration": 3.0, "text": "如此高难度的动作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0319.wav", "duration": 3.7459375, "text": "投入巨资研究经费攻关"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0128.wav", "duration": 4.946, "text": "这些地区批准建设用地二百万公顷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0181.wav", "duration": 5.4499375, "text": "记者从北京市国土局网站看到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0436.wav", "duration": 7.1699375, "text": "沙城街道七五村永安路一二五号一民房发生火灾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0478.wav", "duration": 7.2690625, "text": "湖北一七二名教师转岗当保安其中有人曾是校长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0223.wav", "duration": 3.902, "text": "加快基层农技推广体系改革和建施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0200.wav", "duration": 7.4200625, "text": "切实改变沿海地区重化工比重过大过于集中的状况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0461.wav", "duration": 3.089125, "text": "李娜一身素色休闲装"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0298.wav", "duration": 9.0390625, "text": "包括迪斯尼耐克麦当劳梅西百货公司等巨头企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0123.wav", "duration": 3.103, "text": "抛售三线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0456.wav", "duration": 7.5, "text": "东莞常平一地盘两日两度地陷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0350.wav", "duration": 3.126, "text": "去年的索契冬奥会上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0462.wav", "duration": 5.021, "text": "专家排除了冰雹和飞机上落冰的两种可能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0237.wav", "duration": 2.8680625, "text": "强化水生生态修复和建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0161.wav", "duration": 4.9930625, "text": "上海易居房地产研究院数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0124.wav", "duration": 6.021, "text": "土地供应往往呈现前松后紧的态势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0267.wav", "duration": 4.261, "text": "新系统可根据难易程度进行排序"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0448.wav", "duration": 6.8200625, "text": "麻丽贤等一七位志愿者将远赴非洲支教"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0122.wav", "duration": 5.143, "text": "确实降低了刚需人群购房成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0353.wav", "duration": 3.5, "text": "既免去了不必要的花费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0310.wav", "duration": 4.6530625, "text": "前两年锂电池行业整体处于市场培育期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0317.wav", "duration": 7.594, "text": "同比减少约百分之四十六亏损额为五百九十三二万港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0406.wav", "duration": 6.1328125, "text": "丛林之书则将在二零一六年四月十五日登场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0238.wav", "duration": 7.321875, "text": "加快推进水稻栽插收获和玉米收获机械化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0432.wav", "duration": 3.9350625, "text": "蒙面歌王迎来初赛的收官之战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0412.wav", "duration": 4.1379375, "text": "搜狐娱乐讯据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0433.wav", "duration": 3.3669375, "text": "台港警方追查一个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0126.wav", "duration": 6.407, "text": "购买一百平方米以上非政策性住房或第二套住房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0279.wav", "duration": 5.9819375, "text": "这两家公司目前正在开发自己的移动支付系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0426.wav", "duration": 3.709, "text": "对于重回舞台夺下当日歌王"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0247.wav", "duration": 4.652, "text": "鼓励有条件地区率先实现农业现代化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0306.wav", "duration": 5.641, "text": "美的集团总裁方洪波提出了上述三个问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0406.wav", "duration": 5.4150625, "text": "与奥斯卡影帝本金斯利同时出现在海报中央"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0132.wav", "duration": 6.284, "text": "特别是在海外热钱有外流预期的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0395.wav", "duration": 5.907125, "text": "重新以首发身份登场的朱婷迅速找回比赛的感觉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0224.wav", "duration": 2.5, "text": "制定和发布办法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0206.wav", "duration": 5.173, "text": "各地区要对公路收费站现有车道进行全面调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0438.wav", "duration": 8.1179375, "text": "港媒评助学达人性侵女童案加强监管是关键"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0374.wav", "duration": 3.714875, "text": "离不开广大媒体的支持"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0392.wav", "duration": 5.7378125, "text": "在每次大型赛事中志愿者都是必不可少的一部分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0190.wav", "duration": 4.1900625, "text": "燃气经经营市场清理整顿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0417.wav", "duration": 5.4980625, "text": "中新网六月二十四日电六月二十三日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0456.wav", "duration": 6.553, "text": "八月三日上午一一时左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0456.wav", "duration": 6.0290625, "text": "杀害中传女学生犯罪嫌疑人从小家庭教育严格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0492.wav", "duration": 5.772, "text": "温岭医院助理殴打女病人五年后提拔为副院长"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0250.wav", "duration": 6.0350625, "text": "也通过机构间的竞争促进保险资管公司的转型发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0167.wav", "duration": 2.901, "text": "贷款需求将在下个月继续释放"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0231.wav", "duration": 6.1950625, "text": "由于我国还没有建立统一的地方政府债务风险管理制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0165.wav", "duration": 4.133, "text": "将加速今年楼市成交复苏回暖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0371.wav", "duration": 5.9260625, "text": "撑杆跳选手拉斐尔霍尔泽德佩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0418.wav", "duration": 3.9189375, "text": "两人不想恋情变得高调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0400.wav", "duration": 3.433125, "text": "比赛地的湖水比较浑浊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0414.wav", "duration": 3.5241875, "text": "问及男友郑嘉颖会不会介意这么性感"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0254.wav", "duration": 5.9609375, "text": "谁是苹果进军汽车市场的合作伙伴收购对象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0224.wav", "duration": 4.9560625, "text": "城投债劵的发行期限和利率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0474.wav", "duration": 4.150875, "text": "记者从金华市公安局获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0203.wav", "duration": 7.3830625, "text": "丰富和解调仲裁诉等维权内容和方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0213.wav", "duration": 5.78, "text": "扶持合作社建设农产品仓储冷藏初加工等设施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0214.wav", "duration": 3.003875, "text": "城市文化和体育设施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0450.wav", "duration": 4.672125, "text": "其人工岛被指移动六七米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0459.wav", "duration": 8.714125, "text": "村民地里二六零馀棵正在挂果的梨树被连根推倒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0332.wav", "duration": 3.735, "text": "从本年度第一份季报来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0443.wav", "duration": 4.8681875, "text": "广东高院审理后驳回了关某的申诉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0345.wav", "duration": 3.1438125, "text": "温哥华冬奥会拿到铜牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0305.wav", "duration": 5.5, "text": "而威灵电器七月九日下午也公告透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0158.wav", "duration": 8.3110625, "text": "再加上央行降息以及公积金新政等利好的叠加效应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0314.wav", "duration": 5.7790625, "text": "部分传统的车企或许还没有注意到这点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0289.wav", "duration": 3.8460625, "text": "让当地更多的人知道这家公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0137.wav", "duration": 4.559, "text": "减免或返还土地出让收入一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0191.wav", "duration": 5.4040625, "text": "并严格按照合规程序进行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0482.wav", "duration": 3.4970625, "text": "并向其发送银行账号"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0495.wav", "duration": 6.761, "text": "王女士与旅行社签订四天五晚的旅行合同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0414.wav", "duration": 3.625, "text": "并做陈凯琳背后的男人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0265.wav", "duration": 4.5810625, "text": "核武器并不能征服类似美国这样的国家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0351.wav", "duration": 2.798125, "text": "使得他们的速度变慢了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0141.wav", "duration": 3.319, "text": "设立一个单一资金信托"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0379.wav", "duration": 3.0031875, "text": "也温暖和感动着志愿者"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0450.wav", "duration": 4.2370625, "text": "起因是为了一名年轻的刘姓美女"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0378.wav", "duration": 4.6438125, "text": "湖北运动员的家长给小青椒写来致谢信"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0306.wav", "duration": 3.6689375, "text": "从而获取用户信息的案件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0195.wav", "duration": 4.156, "text": "完善农业科技评价机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0171.wav", "duration": 6.18, "text": "帮助创新创业者聚合各方面资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0224.wav", "duration": 3.8360625, "text": "非主业投资存在不少经营风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0174.wav", "duration": 3.541, "text": "从创业者真正的需求出发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0414.wav", "duration": 7.0439375, "text": "刚与阮经天传出情变不久的许玮甯近日接拍恐怖片"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0316.wav", "duration": 5.5, "text": "各公司市场部都在卖场忙活"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0480.wav", "duration": 6.1130625, "text": "在许多人眼里这都是小说和电影里才会出现的情节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0305.wav", "duration": 6.574125, "text": "这些措施在一定程度上将可防止用户数据泄露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0479.wav", "duration": 4.4711875, "text": "不期而至的阴霾让他被迫抛下工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0464.wav", "duration": 7.349125, "text": "村庄现两名村支书假支书无名有实村内掌权"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0376.wav", "duration": 4.037125, "text": "此消息一出迅速引发外界强烈关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0342.wav", "duration": 5.381, "text": "许多跑友争先恐后穿上沈阳花棉袄拍照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0485.wav", "duration": 3.5090625, "text": "今日二二日晨凌晨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0233.wav", "duration": 3.694, "text": "相关公司股票走势农产品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0420.wav", "duration": 2.937, "text": "引发众多粉丝围堵"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0449.wav", "duration": 4.412125, "text": "目前该男子已将微博内容全部删除"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0382.wav", "duration": 2.8039375, "text": "如果输了就不太好说了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0378.wav", "duration": 5.161125, "text": "在首都国际机场受到了各界人士的欢迎"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0292.wav", "duration": 3.6210625, "text": "又一次引爆坊间议论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0280.wav", "duration": 4.3929375, "text": "他还吐槽过乔布斯电影中的桥段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0137.wav", "duration": 7.058, "text": "外资购房主要集中在一线城市和几个热点二线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0332.wav", "duration": 5.2020625, "text": "小到吹风机充电器甚至接线板都会产生电磁辐射"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0239.wav", "duration": 3.4309375, "text": "加大强农惠农富农力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0211.wav", "duration": 5.2060625, "text": "科技创新和推广新应用能力不强"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0425.wav", "duration": 3.3630625, "text": "也祝福伤者早日康复"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0238.wav", "duration": 3.48, "text": "使得很多投融资平台公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0183.wav", "duration": 3.808, "text": "销售额则将维持不变"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0472.wav", "duration": 5.566875, "text": "上传读取和下载里面的信息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0309.wav", "duration": 3.7209375, "text": "如果不回答这三个课题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0240.wav", "duration": 10.52, "text": "加大对秸秆机械化还田和收集打捆机具配套的支持力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0200.wav", "duration": 3.2950625, "text": "还本付息也是正常的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0337.wav", "duration": 4.7578125, "text": "另外今年上半年个别订单的价格也比较低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0246.wav", "duration": 5.5, "text": "严格农村工矿企业环境监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0284.wav", "duration": 6.0090625, "text": "明显跑输标普五百指数的一百分之九十九"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0130.wav", "duration": 7.4750625, "text": "公积金新政加速楼市库存消化至搜狐财经"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0219.wav", "duration": 4.5500625, "text": "免费期间收费员还是按照正常放行的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0448.wav", "duration": 3.6899375, "text": "他表示我没想到弄这么大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0345.wav", "duration": 7.8100625, "text": "鄂美蝶继续将自己所学到的新搏击技能尽情展现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0450.wav", "duration": 7.1159375, "text": "温州女协管员侮辱环卫工行尸走肉已辞职"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0420.wav", "duration": 4.228, "text": "打算看医生寻求纾缓方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0307.wav", "duration": 3.087, "text": "工人数量减少近一半"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0353.wav", "duration": 5.9460625, "text": "响应北京市振兴三大球战略的号召"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0212.wav", "duration": 8.110125, "text": "加强新疆黄淮海地区长江流域棉花生产基地建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0181.wav", "duration": 2.8519375, "text": "报七千亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0220.wav", "duration": 6.1960625, "text": "引导龙头企业向优势产区集聚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0290.wav", "duration": 3.803, "text": "苹果固然不会因此而升格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0219.wav", "duration": 5.9179375, "text": "可以更好地体现代际公平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0140.wav", "duration": 5.1579375, "text": "本轮本轮住房公积金房贷政策调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0479.wav", "duration": 6.517125, "text": "村支书违法占地建加油站多部门介入处罚仍未拆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0443.wav", "duration": 7.131125, "text": "港校两名内地生酒后街头野战当事人被起底"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0231.wav", "duration": 7.4389375, "text": "加快草原围栏棚圈和牧区水利建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0201.wav", "duration": 3.9930625, "text": "严格控制新上石化项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0371.wav", "duration": 2.312, "text": "谈及当队长的责任感"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0411.wav", "duration": 5.557875, "text": "陈冠希开始一直把镜头对着帽子上的皮卡丘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0187.wav", "duration": 9.7330625, "text": "徐林发债企业在债劵存续期内进行资产转移"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0209.wav", "duration": 5.797, "text": "积极推动建立城乡要素平等交换关系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0445.wav", "duration": 3.6169375, "text": "薛孝文还在给学生上课"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0440.wav", "duration": 9.7270625, "text": "游客参与不合理低价游也将受到受处难执行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0475.wav", "duration": 6.5539375, "text": "湖北一中学教师体罚学生致重伤被判刑三年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0343.wav", "duration": 5.422125, "text": "三十三岁的大滨芳美在面对强大的火力下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0242.wav", "duration": 3.4299375, "text": "扶持农机服务组织发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0343.wav", "duration": 5.6550625, "text": "以及未来几年更多志愿经历"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0464.wav", "duration": 4.9028125, "text": "六三岁的李银河拿着钥匙袋走了进来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0134.wav", "duration": 5.562, "text": "一些地方和单位少支付补偿一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0364.wav", "duration": 4.8940625, "text": "北京申办冬奥影响远超承办本身"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0199.wav", "duration": 5.479, "text": "引导龙头企业采取兼并重组参股收购等方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0152.wav", "duration": 4.576, "text": "必须具有高度习惯融合性和耐用性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0333.wav", "duration": 3.427, "text": "其实儿童电话手表的火"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0302.wav", "duration": 5.437, "text": "乃至颠复现有的经济形态和支付格局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0187.wav", "duration": 6.0, "text": "及时发现产业发展中的倾向性苗头性问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0205.wav", "duration": 5.6609375, "text": "我国还处于城市化快速发展期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0437.wav", "duration": 6.298125, "text": "杀人犯出狱后喊冤被驳回供述与鉴定相印证"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0208.wav", "duration": 3.7650625, "text": "有力地支持了中小企业的发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0361.wav", "duration": 5.8559375, "text": "经过网络测试综合面试专业技能体能测试等环节"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0213.wav", "duration": 2.75, "text": "薛之谦的歌儿很棒"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0451.wav", "duration": 4.0029375, "text": "这个意外可能进一步影响工期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0185.wav", "duration": 4.2000625, "text": "以及前几次公积金新政的实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0361.wav", "duration": 3.4719375, "text": "也第一次被媒体关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0179.wav", "duration": 3.8929375, "text": "房价继续下行的可能性仍然比较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0167.wav", "duration": 4.3139375, "text": "取消外商投资房地产企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0414.wav", "duration": 3.885, "text": "诞下很像天华的小宝贝"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0176.wav", "duration": 2.735, "text": "人民币中间价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0353.wav", "duration": 4.3149375, "text": "反超张常宁成为中国队的得分王"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0144.wav", "duration": 4.272, "text": "此次公积金政策大力度调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0290.wav", "duration": 3.4399375, "text": "在韩国股市低迷情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0174.wav", "duration": 3.369, "text": "产品的升级速度一定加快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0158.wav", "duration": 3.179, "text": "按公司持有房产计税"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0305.wav", "duration": 5.0651875, "text": "美的摆稳棋局过冬搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0376.wav", "duration": 8.099125, "text": "今天中国队将迎战第一阶段的最后一个对手秘鲁队"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0447.wav", "duration": 7.1010625, "text": "湖北吃人同型号电梯全国四六四八部分布三一省市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0494.wav", "duration": 6.166, "text": "此关于滕灵方此后晋升为副院长一事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0450.wav", "duration": 6.5, "text": "崔先生带家人随团前往泰国晋吉岛游玩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0416.wav", "duration": 6.035875, "text": "中新网七月二十八日电据香港明报消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0136.wav", "duration": 4.721, "text": "随着广州住房公积金贷款政策的调整实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0132.wav", "duration": 5.281, "text": "汇率较大概率维持双向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0208.wav", "duration": 5.5710625, "text": "城投债券也适应了发行人和投资人的需要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0342.wav", "duration": 3.6700625, "text": "赛后主攻手朱婷对记者说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0149.wav", "duration": 4.4649375, "text": "组建国家住房银行分行和支行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0378.wav", "duration": 3.441875, "text": "便将对手的眼部击伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0412.wav", "duration": 2.2949375, "text": "只不过好景不常"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0231.wav", "duration": 7.183, "text": "建设四级农作物病虫疫情监测防控体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0245.wav", "duration": 3.8050625, "text": "提高防汛抗旱减灾能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0159.wav", "duration": 3.163, "text": "完善宏观调控机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0433.wav", "duration": 3.3779375, "text": "再次吸引了众人的目光"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0367.wav", "duration": 3.2120625, "text": "好在队友们相互弥补得非常出色"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0487.wav", "duration": 5.151125, "text": "进一步加大舆论监督力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0152.wav", "duration": 4.467, "text": "为了购买自己想要传承给子女的房产"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0220.wav", "duration": 6.9919375, "text": "克服当期建设资金不足的瓶颈制约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0295.wav", "duration": 5.822, "text": "该公司于上个月简单地宣布了智能手表相关的情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0412.wav", "duration": 4.7219375, "text": "再度经营他的粉丝团与粉丝互动六日昨晚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0467.wav", "duration": 5.161125, "text": "有六个被送往苍南福利院"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0477.wav", "duration": 8.645, "text": "位于温州苍南龙港镇水门村的一个仓库发生火灾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0322.wav", "duration": 6.547875, "text": "三百六十软件识别出了麦德公司的插件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0402.wav", "duration": 3.0400625, "text": "提升参赛队的积极性"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0160.wav", "duration": 5.367, "text": "从而有利于抑制楼市过快上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0405.wav", "duration": 9.573, "text": "搜狐娱乐赛文耷子备受关注重拍版乌鸦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0164.wav", "duration": 5.6079375, "text": "目前市场上的低价房源已基本消耗完毕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0149.wav", "duration": 5.164, "text": "不过他认为这种增幅并不算太明显"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0391.wav", "duration": 5.172125, "text": "竞争对手哈萨克斯坦在这一点上要强过我们"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0439.wav", "duration": 6.521, "text": "李嘉诚或再抛售内地地产项目拟出售上海办公楼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0237.wav", "duration": 5.714, "text": "远低于发生债务危机的欧美国家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0278.wav", "duration": 5.266, "text": "此款健康设备将延迟到明年推出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0205.wav", "duration": 5.9600625, "text": "农业与非农产业之间劳动生产率的差距也很大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0178.wav", "duration": 4.782, "text": "伟嘉安捷对中新网房产频道表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0204.wav", "duration": 6.214, "text": "广大农民的积极性创造性将得到进一步激发和释放"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0348.wav", "duration": 2.838875, "text": "他屡次受到伤病的困扰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0291.wav", "duration": 5.3980625, "text": "艾维现为苹果主管设计业务的高级副总裁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0294.wav", "duration": 4.5, "text": "这样的成绩已经比二零一三年要好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0371.wav", "duration": 6.876, "text": "当时郎平率队三战全胜名列第一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0214.wav", "duration": 5.2380625, "text": "也要看到我国与欧美国家的不同之处"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0386.wav", "duration": 7.5, "text": "此次里约奥运会也将会是其第三次征战奥运会比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0148.wav", "duration": 3.49, "text": "各地公积金政策步入频繁调整期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0141.wav", "duration": 6.121, "text": "保利地产开始进军成都珠海"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0388.wav", "duration": 3.004125, "text": "他们几乎都是九零后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0130.wav", "duration": 7.09, "text": "房地产商需要解决毛利率低的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0435.wav", "duration": 7.439, "text": "浙江台州温岭市一一零指挥中心接警称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0459.wav", "duration": 6.2849375, "text": "李银河的文学梦将出版虐恋小说三卷本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0161.wav", "duration": 5.4240625, "text": "站在金九银十即将来临的起点上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0276.wav", "duration": 7.0761875, "text": "系统会使用不同编码来转移用户凭据和支付数据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0418.wav", "duration": 3.1791875, "text": "黄宗泽绯闻女友等女星"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0441.wav", "duration": 2.7270625, "text": "据两名知情人透露"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0134.wav", "duration": 5.249, "text": "各地对公积金贷款的松绑力度更大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0439.wav", "duration": 3.204125, "text": "不仅赢得观众好口碑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0193.wav", "duration": 7.5689375, "text": "国资委接二连三对此表态或意味着国企将迎来上市高峰"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0328.wav", "duration": 3.8669375, "text": "有利于降低公司运营成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0180.wav", "duration": 4.817, "text": "而申请办理组合贷款的手续则更为复杂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0397.wav", "duration": 7.043, "text": "这一届北京市业馀排球联赛一定会精彩纷呈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0244.wav", "duration": 4.1650625, "text": "加强农业防灾减灾能力建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0383.wav", "duration": 5.099125, "text": "以往想要见识奥运级别的比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0451.wav", "duration": 9.3620625, "text": "温州女协管员发伪辱性文字环卫节一群行尸走肉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0357.wav", "duration": 5.056125, "text": "此举却导致了一次擂台意外的发生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0127.wav", "duration": 5.55, "text": "地方政府倾向于频繁推出优质地块"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0238.wav", "duration": 3.723, "text": "债劵发行人是优质的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0352.wav", "duration": 5.3288125, "text": "更要期待着中国冰雪运动真正强大起来的那一天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0343.wav", "duration": 4.3239375, "text": "中国队直落三局零封对手"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0227.wav", "duration": 3.142, "text": "环评过程要公开透明"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0401.wav", "duration": 3.3810625, "text": "作为一个主攻手非常不易"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0427.wav", "duration": 2.431875, "text": "每一天都要快乐喔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0270.wav", "duration": 3.5, "text": "还有很多阻碍要解决"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0230.wav", "duration": 6.2069375, "text": "并对地方政府债务进行监控和风险防范等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0366.wav", "duration": 4.6071875, "text": "组委会设计了具有四川特色的志愿者服装"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0165.wav", "duration": 5.059, "text": "中新网房产频道推置业小调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0313.wav", "duration": 5.297875, "text": "根据权威机构检测报告显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0257.wav", "duration": 3.1009375, "text": "成为一个个响亮的中国品牌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0135.wav", "duration": 4.208, "text": "使其缓冲过度到买房阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0150.wav", "duration": 5.858, "text": "但是整体回暖和好转态势已经确定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0321.wav", "duration": 4.6889375, "text": "公司目前看好锂电池行业的发展渠势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0362.wav", "duration": 5.859125, "text": "而在谈及此次应敌的策略时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0231.wav", "duration": 6.7879375, "text": "如建立规范透明的地方政府融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0394.wav", "duration": 3.9548125, "text": "各地跑步爱好者齐聚一堂"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0303.wav", "duration": 5.5900625, "text": "成飞集成百二十一九十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0161.wav", "duration": 5.01, "text": "不同的客户对收益再投资的需求差别较大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0335.wav", "duration": 4.238, "text": "空调产品越来越追求个性化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0286.wav", "duration": 3.608, "text": "不过目前看来不大可能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0218.wav", "duration": 3.9130625, "text": "建设旱涝保收高标准农田"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0156.wav", "duration": 10.5659375, "text": "没有雄厚的资金良好的业绩以及成熟的融资平台"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0378.wav", "duration": 2.8159375, "text": "又是十年的空白期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0121.wav", "duration": 6.354, "text": "境外个人购买应当符合当地政策规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0155.wav", "duration": 3.0739375, "text": "提高家庭购房能力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0467.wav", "duration": 8.5749375, "text": "村民生活因此发生巨变井水变味田地减产前日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0400.wav", "duration": 5.3469375, "text": "朱婷得到七分同样全队最高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0311.wav", "duration": 4.0451875, "text": "杨某等四人经过商议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0200.wav", "duration": 8.4520625, "text": "促使考试单位自觉降低成本由于形不成规模效益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0150.wav", "duration": 7.207, "text": "尤其组合贷的咨询量较上月月初一上涨百分之七左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0330.wav", "duration": 4.239, "text": "像车上的信息娱乐系统和导航系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0337.wav", "duration": 6.2790625, "text": "紫光集团和员工持股计划参与非公开增发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0305.wav", "duration": 3.5949375, "text": "为使股价与公司价值匹配"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0157.wav", "duration": 5.654, "text": "房价下跌压力缓解各地救市政策不断"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0379.wav", "duration": 4.77, "text": "夺冠的同时摘得本次世界杯的冠军"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0385.wav", "duration": 3.3059375, "text": "我为她们感到骄傲和自豪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0325.wav", "duration": 2.838125, "text": "随着互联网快速发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0402.wav", "duration": 5.3420625, "text": "吉娜卢克肯科姆普尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0480.wav", "duration": 4.5, "text": "华商报讯记者杨德合买了两个肉夹馍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0135.wav", "duration": 3.7569375, "text": "万一以后儿女的婚姻出了问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0456.wav", "duration": 7.1059375, "text": "非法经营期货金额共计人民币三二亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0488.wav", "duration": 7.8769375, "text": "湖北三亿打造亚洲玫瑰基地多个种植园杂草丛生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0189.wav", "duration": 4.8420625, "text": "健全重要农产品储备制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0448.wav", "duration": 3.531, "text": "姥姥继承二六六万馀元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0232.wav", "duration": 6.4500625, "text": "配套发展节水高效灌溉词草基地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0277.wav", "duration": 5.259, "text": "企业用户在安装定制应用程序时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0300.wav", "duration": 8.8830625, "text": "这三个优势能在短时间内颠复美国移动支付市场的格局"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0145.wav", "duration": 3.88, "text": "这样也为开发商节省了运营成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0288.wav", "duration": 7.9350625, "text": "而这对于未来苹果保持高利润和利润率至关重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0155.wav", "duration": 4.024, "text": "市场不可能那么快有反应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0479.wav", "duration": 6.8930625, "text": "村主任发环卫工一六零零元工资含一四张假钞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0180.wav", "duration": 6.962, "text": "这也从宏观层面明确了政府对于房地产市场的态度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0482.wav", "duration": 5.708, "text": "南京市民张女士化姓去无锡旅游时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0200.wav", "duration": 6.5040625, "text": "加快农业新品种新技术转化应用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0370.wav", "duration": 3.635, "text": "但遭到了韩国国内舆论的非议"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0199.wav", "duration": 4.275, "text": "转变畜牧业发展方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0209.wav", "duration": 4.511, "text": "加强用水总量控制与调度管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0121.wav", "duration": 8.434, "text": "住宅土地出让金及成交面积均大幅下降"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0179.wav", "duration": 5.287, "text": "外资在华房地产投资购房限制被松绑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0243.wav", "duration": 2.99, "text": "农业信息化建设工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0360.wav", "duration": 3.938, "text": "我们就能看到这对强大组合的身影"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0269.wav", "duration": 10.167, "text": "又一款个性十足的双机身气动外形的大型无人机神雕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0380.wav", "duration": 4.48, "text": "朱婷表示我想日本肯定也会拼我们"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0209.wav", "duration": 5.938, "text": "农业产业化组织带动农户数量亿户"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0236.wav", "duration": 5.3629375, "text": "我们还控制了投融资平台公司发债的范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0324.wav", "duration": 4.1960625, "text": "车辆可能会发生严重的交通事故"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0215.wav", "duration": 5.1220625, "text": "优先将农业大县纳入改革范围"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0121.wav", "duration": 6.297, "text": "所以审批加上放款的时间最快也要在七个半月左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0454.wav", "duration": 5.459, "text": "背部撞断了游乐场场边的三根不锈钢护栏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0221.wav", "duration": 2.8780625, "text": "大力发展农业社会化服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0189.wav", "duration": 3.526, "text": "加强农业科技领域国际合作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0379.wav", "duration": 4.6450625, "text": "对于任何一个目睹了整场比赛过程的人来讲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0164.wav", "duration": 8.719, "text": "今年中国房地产开发商仍将面临供应过剩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0274.wav", "duration": 4.087, "text": "而不是拿着主卡到处刷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0419.wav", "duration": 3.6791875, "text": "谢婷婷将头挨着父亲的头"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0173.wav", "duration": 4.7470625, "text": "类似的补贴政策常常是短效刺激"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0238.wav", "duration": 5.87, "text": "应该建立风险可控的规范化地方政府融资机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0209.wav", "duration": 6.9499375, "text": "您如何看待政府的举债行为和债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0347.wav", "duration": 3.5080625, "text": "我希望自己可以像卡梅隆一样"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0208.wav", "duration": 4.3880625, "text": "农村实用人才总量万人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0369.wav", "duration": 5.5800625, "text": "尽管也一度以二一比一七领先四分之多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0245.wav", "duration": 4.125, "text": "科学使用农药化肥和农膜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0356.wav", "duration": 5.577875, "text": "此次昆罗决中俄对抗赛上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0395.wav", "duration": 4.1061875, "text": "如果该医院罪名被判成立的话"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0229.wav", "duration": 5.513875, "text": "这并不意味着政府可以无节制地借债"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0268.wav", "duration": 10.1760625, "text": "继二零一一年出现独特的连翼造型的翔龙无人机以后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0393.wav", "duration": 3.731, "text": "首先是增加了二号位的进攻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0129.wav", "duration": 3.071, "text": "公积金贷款额度的提高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0245.wav", "duration": 5.218, "text": "完善病死动物无害化处理补贴制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0223.wav", "duration": 7.3159375, "text": "这使得我国城投债劵的发行利率相对偏高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0282.wav", "duration": 2.801, "text": "就是在创新驱动上下功夫"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0171.wav", "duration": 4.419, "text": "改进住房公积金管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0430.wav", "duration": 3.735125, "text": "穿着白背心黑色短裤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0403.wav", "duration": 5.8828125, "text": "并在各自领域中享受着各自粉丝们帝王般的顶礼膜拜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0429.wav", "duration": 3.219, "text": "一度让外界以为两人复合"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0478.wav", "duration": 4.098875, "text": "物价部门工商部门已介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0205.wav", "duration": 5.7589375, "text": "承担着主要农产品供给保证的主体功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0427.wav", "duration": 4.1159375, "text": "称这二人总是可以把自己逗笑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0372.wav", "duration": 3.396, "text": "二零一五年二月一日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0340.wav", "duration": 8.51, "text": "只是本次田径世锦志愿者这个大群体的一个缩影"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0490.wav", "duration": 7.5170625, "text": "武汉网友胡琦的一条短信微博引起众人关注"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0234.wav", "duration": 6.38, "text": "稳步提高粮食主产区县级人均财力水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0179.wav", "duration": 5.4770625, "text": "不得购买非自用非自住商品房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0363.wav", "duration": 7.420875, "text": "在制定竞赛规程方面严格遵循规范化专业化原则"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0121.wav", "duration": 4.5879375, "text": "时刻保持创新和变革意识"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0137.wav", "duration": 3.238, "text": "支持新产业新业态"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0432.wav", "duration": 6.692875, "text": "四零零元左右的低价两日游在当地非常普遍"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0489.wav", "duration": 3.4001875, "text": "现代快报记者赵书伶"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0484.wav", "duration": 5.52, "text": "由于电影王朝的女人杨贵妃中的一场激情戏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0353.wav", "duration": 6.332, "text": "主攻手朱婷不慎扭伤脚踝后依然带伤奋战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0251.wav", "duration": 4.229, "text": "新型农村人才培养工程"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0259.wav", "duration": 3.0490625, "text": "该系统包含一套算法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0473.wav", "duration": 3.243875, "text": "大喊我一脚方言"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0184.wav", "duration": 4.4090625, "text": "大量外资希望进入我国市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0363.wav", "duration": 2.598875, "text": "直肘反肘交替使用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0150.wav", "duration": 5.626, "text": "多个楼盘仍然采取的是低价走量的策略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0404.wav", "duration": 3.400875, "text": "不仅在全球收回十亿美元票房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0250.wav", "duration": 3.594, "text": "更好地保护债券投资人的利益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0177.wav", "duration": 6.0430625, "text": "如果申请公积金贷款及公积金贷款与商业贷款的组合贷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0124.wav", "duration": 5.237, "text": "为了规避三四线城市明显过剩的市场风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0440.wav", "duration": 10.156, "text": "村小老师自掏腰包八零零零元为贫困生设奖学金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0437.wav", "duration": 7.052, "text": "打掉一个以传授彩票中奖秘籍为名的特大电信诈骗团伙"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0247.wav", "duration": 4.651, "text": "完善农产品跨区调运调剂机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0408.wav", "duration": 6.838875, "text": "谈到前日爸爸谢贤在宣传活动上出手打曾江"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0466.wav", "duration": 5.2380625, "text": "一辆红色的卡车和一辆黄色的渣土车发生碰撞"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0366.wav", "duration": 3.8298125, "text": "但对于每一位观赛者来讲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0138.wav", "duration": 3.357, "text": "集中释放用地政策红利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0342.wav", "duration": 4.0329375, "text": "跳远莱纳马尔库斯"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0138.wav", "duration": 4.924, "text": "但房地产市场仍处于调整期"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0366.wav", "duration": 4.109875, "text": "这也让他们虽然可以参加小型赛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0285.wav", "duration": 4.751, "text": "两家公司是联网汽车的主要芯片供应商"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0210.wav", "duration": 3.3000625, "text": "防范我国政府债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0136.wav", "duration": 4.7259375, "text": "对楼市消化库存起到正面作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0426.wav", "duration": 4.691875, "text": "更是郑嘉颖愿意公开承认的女友"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0262.wav", "duration": 2.864, "text": "销量都会有一定的影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0407.wav", "duration": 2.765875, "text": "科林也退出了剧组"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0353.wav", "duration": 5.3449375, "text": "位列球队发球榜首位和拦网榜的第二位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0225.wav", "duration": 6.3420625, "text": "完善高标准农田建后管护支持政策和制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0125.wav", "duration": 5.492, "text": "唯有实力雄厚又颇具现代创新意识的广告企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0413.wav", "duration": 2.8400625, "text": "据香港媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0249.wav", "duration": 3.625, "text": "全面提高农业现代化水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0157.wav", "duration": 6.097, "text": "未必吸引太多擅长上规模开发的企业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0484.wav", "duration": 6.968, "text": "杀害宝鸡夜跑教师嫌犯落网是否为拾荒者尚无定论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0219.wav", "duration": 4.213, "text": "大力培育和发展种养大户家庭农牧场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0440.wav", "duration": 8.416, "text": "村支书村民被政府工作人员土埋系邻里纠纷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0182.wav", "duration": 5.783, "text": "此举对促进外企在华投资房地产有积极作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0216.wav", "duration": 7.259, "text": "按照统筹规划分工协作集中投入连片推进的思想"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0487.wav", "duration": 9.24, "text": "蜈蚣资料图参考消息网一零月二二日报道中国科学家称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0188.wav", "duration": 6.2480625, "text": "考虑到地方组织考试的成本相对比较固定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0218.wav", "duration": 3.036, "text": "都起到了积极的作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0373.wav", "duration": 3.163125, "text": "备战明年的里约奥运会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0454.wav", "duration": 2.9360625, "text": "虽然已经退役近一年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0408.wav", "duration": 4.0959375, "text": "让体重维持在四十五公斤左右"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0390.wav", "duration": 2.957, "text": "对我们来说比赛很困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0322.wav", "duration": 3.0490625, "text": "儿童电话手表的诞生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0121.wav", "duration": 5.39, "text": "在最希望国家实施的调控政策这一问题上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0299.wav", "duration": 6.0, "text": "这会危及用户体验和产品质量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0251.wav", "duration": 5.0129375, "text": "粮食等主要农产品供给得到有效保障"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0186.wav", "duration": 10.0, "text": "虽然过去一年一些获评级开发商的信用状况变差"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0412.wav", "duration": 4.3720625, "text": "除了看见陈嘉宝及赖慰玲外"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0278.wav", "duration": 6.229, "text": "而现在的股票市场也已经达到创纪录的新高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0358.wav", "duration": 4.516125, "text": "这无疑又是一次严峻的考验"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0413.wav", "duration": 2.6630625, "text": "表示决定辞职"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0382.wav", "duration": 5.672125, "text": "北京和张家口最终击败了强大的对手阿拉木图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0273.wav", "duration": 3.0799375, "text": "一个公司不能缺少两种人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0329.wav", "duration": 4.8581875, "text": "自今年六月电话手表行业兴起起来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0328.wav", "duration": 3.5749375, "text": "毛利率为十八点百分之三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0321.wav", "duration": 7.275875, "text": "研发支出主要用于服务器产品的研究开发和升级换代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0355.wav", "duration": 5.937, "text": "当搏击界的勒布朗与卡梅隆狭路相逢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0485.wav", "duration": 5.8371875, "text": "吕某于一零月一四日晚从家中外出锻炼失踪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0313.wav", "duration": 7.64725, "text": "广东东莞顺德等城市已经掀起大量机器换人计划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0199.wav", "duration": 3.3050625, "text": "吸引社会资本七亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0373.wav", "duration": 8.8659375, "text": "现年十八岁的莎宾娜身高达一百八十二厘米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0467.wav", "duration": 5.3899375, "text": "男医生为了安抚即将做手术的小女孩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0226.wav", "duration": 3.555, "text": "所以倒也没产生收费站排队的现象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0229.wav", "duration": 3.561, "text": "如何在五天内筹集到七万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0297.wav", "duration": 8.474125, "text": "对于谋求转型发展怀揣创新型国家梦想的中国来说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0193.wav", "duration": 7.499, "text": "立即部署开展海洋石油勘探开发安全生产检查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0388.wav", "duration": 3.5090625, "text": "在比赛中确实非常有利"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0363.wav", "duration": 4.902, "text": "这位北京姑娘直言在三大赛当队长的感觉很特殊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0269.wav", "duration": 3.6420625, "text": "可对于一个成年人来说算什么"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0143.wav", "duration": 4.865, "text": "公积金贷款最高额度也不同程度上调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0364.wav", "duration": 6.547875, "text": "不仅能够将业馀排球与职业排球严格地区分开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0132.wav", "duration": 6.1390625, "text": "每月光租金收入便已远大于自己和子女的总开销"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0456.wav", "duration": 6.3620625, "text": "但嵩县德亭镇大王沟村村民们仍感到好奇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0264.wav", "duration": 6.5, "text": "在战区上空形成有效韧的信息网络"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0208.wav", "duration": 3.449, "text": "我国工业化城镇化快速发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0134.wav", "duration": 5.034, "text": "一个以互联网和大数据为核心的时代已经到来"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0176.wav", "duration": 4.568, "text": "但主要还是体现在贷款成本的降低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0255.wav", "duration": 3.5910625, "text": "一项项领先世界的科技成果"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0288.wav", "duration": 4.3570625, "text": "未来上市能够放大公司的品牌效益"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0339.wav", "duration": 4.475125, "text": "也恰恰符合播求的个人风格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0249.wav", "duration": 2.9339375, "text": "大力推进农业节能减排"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0151.wav", "duration": 5.0030625, "text": "作为三四线城市最为集中的中部地区来说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0303.wav", "duration": 6.938, "text": "第一财经日报记者七月十三日从美的内部获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0142.wav", "duration": 5.2430625, "text": "随着广州住房公积金贷款政策的调整实施"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0377.wav", "duration": 8.8239375, "text": "中国女排三十一日本四夺世界杯冠军直通里约奥运"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0354.wav", "duration": 4.0769375, "text": "在前两局僵持不下的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0418.wav", "duration": 3.865, "text": "搜狐娱乐讯据台湾媒体报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0311.wav", "duration": 3.432, "text": "美的部品事业部建立后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0136.wav", "duration": 3.304, "text": "在多项政策的支持下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0480.wav", "duration": 7.712125, "text": "开水淋顾客的火锅店服务员朱某被依法批准逮捕"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0317.wav", "duration": 4.7469375, "text": "收盘价四点九九元也于七月八日公告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0185.wav", "duration": 6.8089375, "text": "是对过去住房公积金制度不作为方式的纠正"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0382.wav", "duration": 3.9199375, "text": "在分站赛总得分榜上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0387.wav", "duration": 6.0969375, "text": "其一米九五的身高三米二七的扣球高度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0201.wav", "duration": 3.5169375, "text": "他就上述关注问题指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0273.wav", "duration": 3.502, "text": "害怕其掌握国家金融命脉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0243.wav", "duration": 3.5649375, "text": "也降低了城投债劵的风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0334.wav", "duration": 4.8310625, "text": "净利润出现百分之一的下滑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0225.wav", "duration": 7.4809375, "text": "提高农业现代化水平农民生活水平和新农村建设水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0452.wav", "duration": 6.385, "text": "该村支委李某因涉嫌猥亵儿童被警方传唤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0126.wav", "duration": 5.728, "text": "共审计二十个省本级和二百个市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0398.wav", "duration": 7.376, "text": "还增加了直线直线和斜线之间的所谓二直线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0129.wav", "duration": 3.635, "text": "以住房公积金制度为基础"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0215.wav", "duration": 4.616125, "text": "增长速度按可比价格计算"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0122.wav", "duration": 4.702, "text": "开发商进驻一二线城市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0174.wav", "duration": 7.316, "text": "可以有效提高资金管理集约化专业化和精细化水平"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0127.wav", "duration": 3.127, "text": "进而选择此类方式购房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0121.wav", "duration": 7.743, "text": "将进一步提振刚需购房者入市信心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0216.wav", "duration": 3.917, "text": "修订完善相关应急预案"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0255.wav", "duration": 4.656, "text": "可参照中国移动和苹果的合作传闻中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0268.wav", "duration": 4.3570625, "text": "对于高中生来说这会有点令人尴尬罢了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0441.wav", "duration": 6.3681875, "text": "温州惊现最牛菜场温州的状元农贸市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0237.wav", "duration": 7.671, "text": "允许机场巴士校车班车使用公共交通优先车道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0381.wav", "duration": 5.624, "text": "回忆起自己从前训练时因心脏不适被抢救的事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0468.wav", "duration": 5.3740625, "text": "该村村民黎胜明向楚天快报求助"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0484.wav", "duration": 4.6889375, "text": "由此引出一起重大安全案件"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0136.wav", "duration": 4.528, "text": "他们的财产和生活不会受到太大影响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0186.wav", "duration": 4.0, "text": "据记者从多个渠道了解"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0471.wav", "duration": 6.1008125, "text": "村支书上班时间带彩娱乐神秘人曝光视频证据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0405.wav", "duration": 4.3371875, "text": "影片将在二零一七年登陆全国"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0377.wav", "duration": 3.8349375, "text": "成为宅男心目中的排球女神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0399.wav", "duration": 4.6899375, "text": "中国女排从第三轮开始便被挤出了三甲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0252.wav", "duration": 4.84, "text": "稳步提高稻谷小麦最低收购价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0426.wav", "duration": 6.931875, "text": "连男方在法国包游艇求婚的照片都被网友扒出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0330.wav", "duration": 4.24, "text": "空调业务总营收接近七百亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0411.wav", "duration": 8.0, "text": "有传他离开是因黎明不满其在挽留艺人方面没有尽力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0392.wav", "duration": 5.75, "text": "经验丰富的雅桑克莱开始刻意放缓节奏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0173.wav", "duration": 6.49, "text": "注册资本金不得低于投资总额的百分之五十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0374.wav", "duration": 2.865, "text": "而在今年的香港站上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0326.wav", "duration": 5.3320625, "text": "这是目前我们中国家电企业面临的具体挑战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0474.wav", "duration": 8.207, "text": "游客乌鲁木齐吃自助被罚二四零零元工商部门介入"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0128.wav", "duration": 3.773, "text": "该政策在七月份实施一周后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0178.wav", "duration": 2.545, "text": "实现区域扩张"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0368.wav", "duration": 5.824, "text": "曾春蕾通过自我调节而让竞技状态渐入佳境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0373.wav", "duration": 3.699, "text": "休赛期内他们参加了小型赛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0299.wav", "duration": 4.1379375, "text": "人气不逊乔布斯在世之时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0211.wav", "duration": 4.5, "text": "加强海陆过渡区生态建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0163.wav", "duration": 3.2230625, "text": "楼市调控将去向何方"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0384.wav", "duration": 6.093, "text": "佟健给自己定下了要做就做到最好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0252.wav", "duration": 3.1529375, "text": "坚持法治严格监管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0300.wav", "duration": 3.504875, "text": "中国游戏公司纷纷忙着退市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0135.wav", "duration": 5.593, "text": "编造虚假资料等套取或骗取补偿一亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0437.wav", "duration": 4.348875, "text": "一时一零分火势完全扑灭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0468.wav", "duration": 5.8390625, "text": "港媒中国人启动营养革命养生书籍热卖"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0439.wav", "duration": 3.8398125, "text": "自己和家人因点的海鲜较少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0415.wav", "duration": 5.963125, "text": "两人于异国拍外景晨夕相对"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0316.wav", "duration": 5.9909375, "text": "影响学习虽说功能手机可以阻止孩子玩游戏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0459.wav", "duration": 5.920875, "text": "但渣土车司机肇事后不仅没有下车救援"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0172.wav", "duration": 7.019875, "text": "投资总额超过一千万美元含一千万美元的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0210.wav", "duration": 3.729, "text": "自秋季学期起"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0175.wav", "duration": 4.318, "text": "大型房企实施低迷期拿地的策略"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0210.wav", "duration": 4.6789375, "text": "改善河口和近岸海域生态环境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0225.wav", "duration": 3.302, "text": "中国老龄十二五规划"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0260.wav", "duration": 4.0230625, "text": "从而推动机器人在胃部前行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0199.wav", "duration": 4.594, "text": "完善农民专业合作社管理方法"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0453.wav", "duration": 3.9389375, "text": "严厉谴责这一不文明应为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0300.wav", "duration": 2.6079375, "text": "于是他也来凑凑热闹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0355.wav", "duration": 4.3261875, "text": "尚不足十八岁的她身高为一米八六"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0329.wav", "duration": 4.947, "text": "预计可回购不少于七百九十一万股"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0148.wav", "duration": 4.9209375, "text": "把顾客个人资料全部归客户自己保管"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0486.wav", "duration": 4.1369375, "text": "目前正在进行一步工作中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0487.wav", "duration": 5.3161875, "text": "温州一家六口误食毒菌五人已死亡"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0266.wav", "duration": 7.4079375, "text": "这些力量的结合将会推动苹果的市盈率大幅上正"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0487.wav", "duration": 9.8149375, "text": "五名涉嫌参与抢米的犯罪嫌疑人先后被抓获并拘留"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0142.wav", "duration": 5.282, "text": "整合营销实现了从策略到执行的系统化服务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0162.wav", "duration": 3.753, "text": "今年土地收入再维持稳定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0465.wav", "duration": 9.099875, "text": "制图黄欣晨报记者佟继萍王亦菲实习生张诗欢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0317.wav", "duration": 5.141875, "text": "二零一五年紫光集团预计收入约四百亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0310.wav", "duration": 7.241, "text": "乌云网合伙人邬迪接受第一财经日报记者采访时称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0241.wav", "duration": 4.5820625, "text": "完善现代农业产业技术体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0401.wav", "duration": 5.339125, "text": "为观众们奉上昆仑决鏖战香江的精彩赛事"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0158.wav", "duration": 3.223, "text": "顾客体验的核心是真善美"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0429.wav", "duration": 6.3840625, "text": "温兆伦许飞欧弟等明星也通过微博表示支持力挺"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0255.wav", "duration": 5.015, "text": "它的雷达可能采用了双波段设计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0262.wav", "duration": 5.218, "text": "高效精准投送药物不仅可降低用药量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0444.wav", "duration": 7.738, "text": "多家媒体就这组图片中的场景和现象作出评论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0338.wav", "duration": 7.0, "text": "对于我而言现在已经成为了一种习惯与本能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0476.wav", "duration": 3.6799375, "text": "图为时上集镇派出所"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0470.wav", "duration": 10.2111875, "text": "村委会在农田搭起违法建筑每年收租金一四万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0296.wav", "duration": 3.9869375, "text": "其将提供三种版本的智能手表"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0275.wav", "duration": 3.9129375, "text": "何况是一个来自美帝的小苹果呢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0428.wav", "duration": 3.525125, "text": "陈妍希在微博发布跳绳视频"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0473.wav", "duration": 3.234125, "text": "本报讯记者杨柳昨天"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0270.wav", "duration": 2.792, "text": "透过不断的更新换代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0334.wav", "duration": 3.4350625, "text": "并非所有的电磁辐射都会对人体产生危害"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0298.wav", "duration": 5.2750625, "text": "我们甚至都没有来得及反抗就被完全征服了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0364.wav", "duration": 5.1689375, "text": "这次比赛我会用胜利证明自己的实力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0287.wav", "duration": 5.692, "text": "今年芯片行业并购交易额在八百亿美元以上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0382.wav", "duration": 3.129125, "text": "更大的战场还在里约"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0291.wav", "duration": 3.6059375, "text": "搜狐消息外媒消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0411.wav", "duration": 5.358125, "text": "日前在初赛收官战中返场的她加盟猜评团"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0245.wav", "duration": 5.5699375, "text": "统筹推进新一轮菜篮子工程建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0317.wav", "duration": 3.228, "text": "小天才负责人介绍说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0368.wav", "duration": 5.25125, "text": "随着赛会推进被越来越多的人所熟知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0310.wav", "duration": 4.115, "text": "即由直销模式转变为经销模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0477.wav", "duration": 5.865, "text": "警方已抓获一五名犯罪嫌疑人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0175.wav", "duration": 3.464, "text": "充分发挥住房公积金作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0153.wav", "duration": 4.6260625, "text": "市民对连续多次降息已经麻木了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0331.wav", "duration": 5.225125, "text": "公司已经暂停或终止部分关联交易项目"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0331.wav", "duration": 3.2160625, "text": "但伴随一定的投资风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0260.wav", "duration": 4.098, "text": "但却鲜有人会像苹果的服务付费"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0446.wav", "duration": 4.983875, "text": "保安得知自己被骗后表示我真的很恨他们"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0402.wav", "duration": 4.625, "text": "发现他们中间真有不少是志愿达人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0353.wav", "duration": 6.2539375, "text": "法国冰协同于放人五度世界冠军即将复出搜狐体育"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0240.wav", "duration": 4.548, "text": "这在相当程度上控制了城投债券的发行规模"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0488.wav", "duration": 5.722875, "text": "民警仍在对其馀涉事人员进行调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0446.wav", "duration": 10.259, "text": "村支委办公室猥亵女童被刑拘的孩子奶奶在隔壁开会"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0138.wav", "duration": 4.629, "text": "普遍认为现在的市场很小且还是单品"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0165.wav", "duration": 4.9100625, "text": "五月份多地楼市的成交量明显上涨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0341.wav", "duration": 3.317875, "text": "正是冰球运动员的黄金年龄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0122.wav", "duration": 6.611, "text": "外资在华房地产投资限制松绑已成大势"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0212.wav", "duration": 3.2120625, "text": "占比只有百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0372.wav", "duration": 3.3519375, "text": "全队上下面对了巨大困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0122.wav", "duration": 6.5, "text": "东地产财经周刊新一年度审计工作报告出炉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0293.wav", "duration": 3.7120625, "text": "苹果打压了市场竞争"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0162.wav", "duration": 3.782, "text": "中新网十月二十一日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0299.wav", "duration": 4.525125, "text": "众多跨国品牌在中国都有生产基地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0230.wav", "duration": 7.8209375, "text": "健全兽药质量安全监管和动物防疫技术支撑体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0325.wav", "duration": 3.8039375, "text": "也是众多家长特别想了解的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0157.wav", "duration": 4.8660625, "text": "似乎难以在一二线城市站稳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0141.wav", "duration": 4.987, "text": "当大家习惯安全的问题留以后解决的时候"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0494.wav", "duration": 8.838875, "text": "村民举报县城干部建十馀栋别墅纪检委部门介入调查"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0335.wav", "duration": 4.834, "text": "一方面是由于上半年模具的比较基数较低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0432.wav", "duration": 6.4030625, "text": "日前遭人绑架并勒索七零零零万港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0420.wav", "duration": 2.9929375, "text": "搜狐娱乐讯日前"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0315.wav", "duration": 6.630125, "text": "并一举成为中国最大全球第三大通讯芯片设计公司"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0207.wav", "duration": 3.3310625, "text": "引导社会资本投入农业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0447.wav", "duration": 6.311, "text": "中新网九月三零日电据香港文汇报报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0402.wav", "duration": 3.8288125, "text": "一度让不少粉丝心碎不已"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0203.wav", "duration": 5.667, "text": "销售给资本市场投资者的一种融资方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0338.wav", "duration": 4.1479375, "text": "十多天压抑的情感终于爆发"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0315.wav", "duration": 4.0930625, "text": "之前很多家长会给孩子买手机"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0343.wav", "duration": 4.3049375, "text": "对手给我们制造了非常多的困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0463.wav", "duration": 3.8559375, "text": "这块天降奇冰究竟是何物"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0421.wav", "duration": 5.266875, "text": "玩心大起的许绍洋与玩家一起比拼游戏"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0442.wav", "duration": 4.1630625, "text": "并未将游客脱光衣服殴打"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0164.wav", "duration": 4.318, "text": "国家发改委也发出过通知"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0492.wav", "duration": 3.645, "text": "现场有人喊有车要爆炸"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0160.wav", "duration": 4.0589375, "text": "平均价格为十万元每平方米"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0322.wav", "duration": 3.8579375, "text": "两大龙头企业格力和海尔"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0333.wav", "duration": 7.754875, "text": "美的空调还在其他地区工厂建有三条全自动生产线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0240.wav", "duration": 4.8549375, "text": "充分发挥农民的主体作用和首创精神"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0363.wav", "duration": 3.7519375, "text": "孙杨就出现过心脏问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0336.wav", "duration": 5.52, "text": "将有助于美的洗碗机开拓国内市场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0398.wav", "duration": 3.2219375, "text": "有的人还会八国语言"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0213.wav", "duration": 6.094, "text": "支持南方甘蔗和北方甜菜生产基地建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0336.wav", "duration": 4.982875, "text": "新兴行业对于创新的热情也不断增加"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0412.wav", "duration": 5.9821875, "text": "谈及前男友陈冠希近日被指外貌衰老了不少"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0137.wav", "duration": 3.076, "text": "从去年三部委发文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0200.wav", "duration": 4.224, "text": "加强城投债监管完善制度建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0285.wav", "duration": 7.391, "text": "价格高于六百美元的占比从百分之七十增加到了百分之八十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0446.wav", "duration": 5.472875, "text": "李嘉诚首次回应撤资传闻对中国发展充满信心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0423.wav", "duration": 5.5900625, "text": "搜狐娱乐讯北京时间六月三十日消息"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0353.wav", "duration": 3.493875, "text": "年龄从二十三岁到五十九岁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0388.wav", "duration": 5.9240625, "text": "中国队的快速打法给自己的球队制造了很大的麻烦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0326.wav", "duration": 3.7690625, "text": "而由直销模式改为经销模式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0129.wav", "duration": 7.9339375, "text": "北上广深四个一线城市已经全部放开公积金房贷业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0261.wav", "duration": 3.4620625, "text": "病毒武器的隐蔽性极佳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0340.wav", "duration": 7.326875, "text": "正是得益于我国女子散打名将鄂美蝶的惊艳一击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0303.wav", "duration": 4.6369375, "text": "对频频的骚扰电话显示无可奈何"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0336.wav", "duration": 5.1320625, "text": "宝马方面表示已经升级该数字系统"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0304.wav", "duration": 6.542, "text": "以及与经销商汽车垂直网站等签署保密协议等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0206.wav", "duration": 5.2109375, "text": "灵活有效调控农业产品进出口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0389.wav", "duration": 3.73, "text": "像她们这样的亚洲对手速度很快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0371.wav", "duration": 5.739, "text": "研究者们希望年龄大的跑者能够注意脚踝的锻炼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0491.wav", "duration": 6.4660625, "text": "机组成功处置深航机上纵火事件获奖二五零万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0230.wav", "duration": 3.6269375, "text": "免征蔬菜流通环节的增值税"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0343.wav", "duration": 4.0, "text": "她以最帅国手走红网络"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0334.wav", "duration": 9.0, "text": "未经用户同意将该插件预置到呃用户手机中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0157.wav", "duration": 3.591, "text": "按照这一趋势发展下去"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0361.wav", "duration": 4.975125, "text": "一脸痛苦的朱婷当即被换下场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0213.wav", "duration": 3.6330625, "text": "构建良好的旅游市场环境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0279.wav", "duration": 4.2169375, "text": "但是在那没做任何设计工作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0434.wav", "duration": 7.6010625, "text": "新京报快讯记者杨锋七月四日下午四时零八分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0396.wav", "duration": 5.249, "text": "比例超过百分之九十四的志愿者是九零后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0466.wav", "duration": 6.733125, "text": "网络时代信息的存在有了新方式"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0317.wav", "duration": 6.3041875, "text": "自二零一一年事业部启动自动化升级至今的四年里"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0240.wav", "duration": 7.8570625, "text": "应该建立风险可控的规范化地方政府融资机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0384.wav", "duration": 4.109875, "text": "这就是竞技体育的魅力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0227.wav", "duration": 6.251, "text": "确保农田综合生产能力长期持续稳定提升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0245.wav", "duration": 5.4389375, "text": "应当立即停止生产销售进口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0188.wav", "duration": 5.683, "text": "完善主要农产品吞吐和调节机制"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0248.wav", "duration": 4.4100625, "text": "目前已取得阶段性成效"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0461.wav", "duration": 2.746125, "text": "彭某下班后准备开车离开"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0461.wav", "duration": 6.7060625, "text": "朱圣祎爆王思聪女朋友被诉法官送达起诉书遇阻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0341.wav", "duration": 3.714875, "text": "这个湖虽然没有漂浮的垃圾"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0219.wav", "duration": 4.687, "text": "有利于加快完善基础设施和投资环境"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0413.wav", "duration": 7.9350625, "text": "早前有传媒更拍到陈凯琳直上嘉颖住所短聚"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0394.wav", "duration": 5.4020625, "text": "令我满意的是球队能够以一个积极的态度进行比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0383.wav", "duration": 6.6210625, "text": "颜色则是由代表着运动精神的奥运五环色组成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0263.wav", "duration": 5.6840625, "text": "孙永杰对二十一世纪报道记者表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0403.wav", "duration": 4.0, "text": "而阿拉木图仅为四百亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0455.wav", "duration": 7.822, "text": "参考消息网一零月八日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0439.wav", "duration": 5.657, "text": "温州一路虎店隐瞒新车维修史被判赔三一四万"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0317.wav", "duration": 4.693, "text": "能否找到厨电行业下一个未知的增量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0169.wav", "duration": 10.37, "text": "由此拉开了跨境共享创新生态平台化发展的新时代"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0363.wav", "duration": 4.2529375, "text": "我不会改变自己擅长的风格"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0438.wav", "duration": 3.5949375, "text": "丈夫关某身负多处刀伤"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0385.wav", "duration": 6.6169375, "text": "扣球成功率五十四点百分之十高居榜首"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0448.wav", "duration": 3.8999375, "text": "安良百货商场正常营业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0328.wav", "duration": 6.2578125, "text": "二零一一年美的空调达到五百亿元营收规模时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0408.wav", "duration": 3.147, "text": "两人合作长达二十年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0394.wav", "duration": 3.907, "text": "在队长惠若琪缺阵的情况下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0360.wav", "duration": 5.5, "text": "张春雨在全场观众的喝彩声中再次投入比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0254.wav", "duration": 6.6269375, "text": "由此可见苹果现在的业务确实比汽车行业更加赚钱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0323.wav", "duration": 4.110125, "text": "如果车辆被黑客软件侵袭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0477.wav", "duration": 3.4509375, "text": "三个月内连生两个儿子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0318.wav", "duration": 8.197, "text": "他们通过这个插件已获利广告收入二十馀万元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0369.wav", "duration": 5.182875, "text": "冠军皆由麦格理集团获得"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0268.wav", "duration": 3.8930625, "text": "在科技领域排名第二"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0178.wav", "duration": 5.5, "text": "设立国家住房银行条件已经基本成熟"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0314.wav", "duration": 6.907, "text": "小天才电话手表辐射远小于国家标准二瓦特每千克"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0125.wav", "duration": 9.732, "text": "公积金松绑接棒释压房价下跌动力趋缓至搜狐财经"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0178.wav", "duration": 3.882, "text": "加上优质地块的连续供应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0323.wav", "duration": 3.25, "text": "电话手表应如何选购"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0135.wav", "duration": 3.583, "text": "此机构即是住房银行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0358.wav", "duration": 5.1789375, "text": "二零一四年索契冬奥会上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0368.wav", "duration": 7.5, "text": "主教练对于这支以老带新的队伍也充满了自信"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0326.wav", "duration": 3.509, "text": "比如降低人工费用运作费用等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0235.wav", "duration": 4.9920625, "text": "远低于发生债务危机的欧美国家"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0210.wav", "duration": 7.3250625, "text": "以建设小麦玉米水稻大豆优势产业带为重点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0370.wav", "duration": 4.3840625, "text": "和夏季奥运会上的斩金夺银不同"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0387.wav", "duration": 3.485875, "text": "交通住宿花费大大降低"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0249.wav", "duration": 3.709, "text": "您如何看待这一现象"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0211.wav", "duration": 2.89, "text": "在自愿基础上组建联合社"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0473.wav", "duration": 4.3339375, "text": "三改一拆可以说是一条红线"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0268.wav", "duration": 3.949, "text": "乔帮主并没有他说的那么不堪"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0309.wav", "duration": 4.5659375, "text": "归到家用空调事业部旗下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0162.wav", "duration": 3.9030625, "text": "据中国指数研究院最新数据显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0466.wav", "duration": 4.495125, "text": "在朝阳区百子湾阳光嘉园小区遇害"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0371.wav", "duration": 5.3889375, "text": "增强参赛者的荣誉感与积极性的同时"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0121.wav", "duration": 3.8409375, "text": "进而选择此类方式购房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0472.wav", "duration": 4.3720625, "text": "将市区两级政府告上法庭"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0411.wav", "duration": 7.979, "text": "陈嘉宝昨天六月二十三日将大合照上传个人主页"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0288.wav", "duration": 6.9189375, "text": "甚至包括了一些明星意见领袖和政府官员"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0480.wav", "duration": 5.2729375, "text": "而被美国海关移民官遣返"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0143.wav", "duration": 4.933, "text": "一线城市土地市场成交火热"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0212.wav", "duration": 6.593, "text": "支持高校毕业生和各类优秀人才投身现代农业建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0363.wav", "duration": 4.5498125, "text": "成为市民体验冰上运动的乐园"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0283.wav", "duration": 3.832, "text": "这种做法很容易误导客服"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0471.wav", "duration": 5.583, "text": "湖北飞踢女居民车道办主任被停职"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0197.wav", "duration": 4.757, "text": "选建一批农业产业化示范基地"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0423.wav", "duration": 6.1840625, "text": "但两人关系比一般夫妻更加紧密"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0156.wav", "duration": 5.3739375, "text": "今年北京还将加大社会单位泵租力度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0395.wav", "duration": 5.214875, "text": "我们或许就将看到他们征战各类大型赛事的身影"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0467.wav", "duration": 4.673125, "text": "张先生在青羊法院提起诉讼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0351.wav", "duration": 5.0029375, "text": "一场众星闪耀的群龙赛事震撼打响"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0424.wav", "duration": 2.5300625, "text": "我叫他不要吓我"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0420.wav", "duration": 3.957, "text": "许茹芸与韩籍男朋友举行了婚礼"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0345.wav", "duration": 4.521, "text": "铁饼沙尼斯克拉夫特"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0461.wav", "duration": 4.1789375, "text": "捡拾一些冰块回家冰冻保存"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0361.wav", "duration": 4.068, "text": "曾春蕾就曾经临时客串过队长职务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0364.wav", "duration": 4.9289375, "text": "而看到了希望的韩国队也趁机拼命反击"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0166.wav", "duration": 9.28, "text": "中新网八月二十七日电据商务部官网公布的文件显示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0280.wav", "duration": 4.1070625, "text": "在安卓手机的总体交付量中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0404.wav", "duration": 5.4868125, "text": "提前一周至二零一六年六月二十四日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0316.wav", "duration": 7.1599375, "text": "每日经济新闻记者从美的家用空调事业部了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0424.wav", "duration": 4.660875, "text": "金陵晚报八月十二日报道二零一四年"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0466.wav", "duration": 5.025875, "text": "资料图片在湖南卫视上周开播的偶像来了中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0491.wav", "duration": 3.4960625, "text": "是社会稳定的主要力量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0152.wav", "duration": 5.255, "text": "呈现购房者积入市的行情"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0347.wav", "duration": 7.583, "text": "二零二二年北京冬奥会计划使用一二个比赛场馆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0426.wav", "duration": 3.161875, "text": "迎来了人生崭新阶段"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0134.wav", "duration": 6.84, "text": "各区县力争完成十五万套开工任务竣工八万套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0284.wav", "duration": 5.19825, "text": "苹果积累了海量的绑定信息卡用户"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0381.wav", "duration": 5.128875, "text": "随后冰迷们自发为其网上募集资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0186.wav", "duration": 5.3559375, "text": "对购买住房的数量也未做要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0199.wav", "duration": 6.5590625, "text": "农产品质量安全例行监测总体合格率百分之五十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0339.wav", "duration": 5.6591875, "text": "作为唯一能够入选五大飙血之战的女子比赛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0215.wav", "duration": 4.5660625, "text": "主要用于各地基础设施的投资建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0222.wav", "duration": 5.412, "text": "努力开创我国农业现代化发展新局面"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0186.wav", "duration": 4.2459375, "text": "实现我国房地产市场的平稳运行"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0232.wav", "duration": 7.822, "text": "规范粮食主产县涉农投资项目地方资金配套"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0183.wav", "duration": 6.3259375, "text": "从一线城市及存销比在七个月以下的城市来看"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0138.wav", "duration": 4.992, "text": "一系列楼市新政效果逐步显现"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0181.wav", "duration": 5.5, "text": "中房指数研究所院长陈晟表示"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0439.wav", "duration": 7.8720625, "text": "大兴警方以涉嫌交通肇事罪将肇事者刑事拘留"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0360.wav", "duration": 3.6159375, "text": "设有座位一万两千个"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0237.wav", "duration": 3.4089375, "text": "促进基金行业规范发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0229.wav", "duration": 5.886, "text": "健全六级动物疫病防控体系"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0314.wav", "duration": 3.4830625, "text": "资金来源为自有资金"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0444.wav", "duration": 6.8188125, "text": "南都讯记者王睦广发自香港今年四月初"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0429.wav", "duration": 3.7800625, "text": "并写道每天早上二十零下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0450.wav", "duration": 10.099125, "text": "清华附小昨迎百年校庆校长诠释成志教育理念"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0362.wav", "duration": 6.187, "text": "这也让他必须在明年春天进行一次小手术来加以治疗"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0264.wav", "duration": 4.4969375, "text": "这还不包括改造过程中的渠道分食"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0468.wav", "duration": 5.3520625, "text": "永远的紫霞仙子朱茵的亮相引起粉丝的热捧"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0291.wav", "duration": 5.142, "text": "美商务部当天发表声明说"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0170.wav", "duration": 4.641, "text": "申请公积金购买第二套住房"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0483.wav", "duration": 7.2419375, "text": "新京报记者从首都国际机场公安分局相关人员处获悉"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0446.wav", "duration": 3.646, "text": "对一块闲置地监管没有跟上"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0281.wav", "duration": 5.817, "text": "他从未对产品被偷发表过任何评论"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0261.wav", "duration": 3.1900625, "text": "具有重大影响的科技产品还不是很多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0394.wav", "duration": 2.671, "text": "一日晚的中阿之战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0218.wav", "duration": 8.062, "text": "全面落实耕地和基本农田保护领导干部离任审计制度"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0467.wav", "duration": 2.944125, "text": "犯罪嫌疑人已被抓获"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0259.wav", "duration": 3.8459375, "text": "锌就会与胃酸发生反应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0180.wav", "duration": 11.01, "text": "由二十二栋企业独栋和二栋二十层的五a级写字楼组成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0381.wav", "duration": 3.4559375, "text": "做了很多很多困难准备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0266.wav", "duration": 7.0849375, "text": "利用电脑病毒却可以在一秒钟内从银行盗走过亿美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0333.wav", "duration": 4.0559375, "text": "以品质和服务黏住用户"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0440.wav", "duration": 6.7260625, "text": "港媒评中国游客全球爆买旅游幼稚病"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0265.wav", "duration": 5.8209375, "text": "但吃下去的药能否真正作用到病灶就很难说了"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0321.wav", "duration": 7.4240625, "text": "是白电上市企业今年的一季报几乎全部沦陷"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0330.wav", "duration": 6.161875, "text": "汉能对自身产品的议价能力推广力都将减弱"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0444.wav", "duration": 4.8349375, "text": "大兴灭门案的凶犯李磊被执行死刑后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0335.wav", "duration": 6.2270625, "text": "来自广西的苏女士说家长对孩子安全的关心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0443.wav", "duration": 3.688, "text": "李嘉诚首次对撤资做出回应"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0252.wav", "duration": 8.879, "text": "加强国家级农业标准化整建制推进示范县场建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0246.wav", "duration": 4.283, "text": "由其生产者实施召回"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0190.wav", "duration": 4.271, "text": "发挥骨干企业稳定市场的作用"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0178.wav", "duration": 8.797, "text": "外汇管理部门不予批准该企业的外汇借款结汇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0174.wav", "duration": 3.4769375, "text": "来自广州日报的报道称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0463.wav", "duration": 3.3830625, "text": "李斯达手持尖刀的自拍照"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0455.wav", "duration": 3.0029375, "text": "集团新领导已经上任"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0220.wav", "duration": 3.3830625, "text": "建设动植物基因信息库"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0475.wav", "duration": 4.8820625, "text": "故宫博物院接待的观众量也日益攀升"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0366.wav", "duration": 5.5, "text": "加上一个仍在建的太舞四季滑雪场"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0185.wav", "duration": 3.1130625, "text": "原本短期内不考虑购房的客群"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0174.wav", "duration": 8.787, "text": "外商投资房地产企业注册资本金未全部缴付的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0464.wav", "duration": 3.327125, "text": "多了初为人母的幸福光彩"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0298.wav", "duration": 3.9500625, "text": "但是瑞士联合银行分析师估计"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0472.wav", "duration": 4.743875, "text": "网曝视频截图当街飞踢女群众"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0129.wav", "duration": 5.303, "text": "一二线城市用地紧张"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0148.wav", "duration": 4.271, "text": "根据中原地产研究中心最新数据"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0491.wav", "duration": 2.922875, "text": "想办法扑上去咬一口"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0313.wav", "duration": 7.4040625, "text": "对于小天才电话手表上课禁用功能"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0135.wav", "duration": 3.668, "text": "再结合近期限外政策全面松绑"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0232.wav", "duration": 5.6310625, "text": "完善监测防控监管等设施设备"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0270.wav", "duration": 7.1960625, "text": "同时将苹果持股比例由百分之四下调至百分之三"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0254.wav", "duration": 3.3189375, "text": "系涨幅最为明显的地区"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0385.wav", "duration": 4.269, "text": "在昨晚的女子标枪决赛中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0383.wav", "duration": 4.483875, "text": "这么多年一直要压抑自己的性取向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0422.wav", "duration": 4.407, "text": "艺人谢婷婷从小就成为媒体焦点"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0130.wav", "duration": 3.1349375, "text": "目前总估值已过亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0473.wav", "duration": 4.0, "text": "参考消息网七月八日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0325.wav", "duration": 4.313, "text": "也对美的集团的总体业绩影响不大"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0440.wav", "duration": 6.025875, "text": "中国日报网八月三日电据华尔街日报三日报道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0330.wav", "duration": 2.907, "text": "都会目不转睛的盯着"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0146.wav", "duration": 3.745, "text": "一线楼市成交量激增"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0371.wav", "duration": 5.6008125, "text": "女排三零阿根廷朱婷复出扣杀状态神勇"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0279.wav", "duration": 3.8410625, "text": "流动性从未得到足够的重视"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0327.wav", "duration": 5.8518125, "text": "专家提醒相关的产品认证也是消费者必须要关注的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0409.wav", "duration": 3.655, "text": "与陈妍希分别看向对方"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0350.wav", "duration": 9.115, "text": "下面小编将盘点本年度迄今为止昆仑决五大惨烈血战"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0272.wav", "duration": 4.1009375, "text": "反映了芯片行业出现整合热潮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0407.wav", "duration": 5.532, "text": "科林之前已经积极的支持影片拍摄"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0441.wav", "duration": 4.3310625, "text": "关某先后被判死刑死缓"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0254.wav", "duration": 4.3150625, "text": "苹果股票价格创下历史新高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0248.wav", "duration": 3.375, "text": "推动其他地区加快发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0240.wav", "duration": 5.5179375, "text": "随着对商业银行设立基金管理公司门槛放宽"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0472.wav", "duration": 3.2009375, "text": "并贴出多张聊天记录截图"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0450.wav", "duration": 4.5839375, "text": "犯罪嫌疑人刘德怀等六人被刑拘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0243.wav", "duration": 6.0970625, "text": "核安全法规标准体系与国际接轨"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0418.wav", "duration": 2.2480625, "text": "这裙子娇艳"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0331.wav", "duration": 3.9289375, "text": "但高端市场仍然难以企及"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0340.wav", "duration": 2.928, "text": "今天大家打得都挺好的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0281.wav", "duration": 6.114, "text": "价格高于六百美元的高端手机占比为百分之一"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0459.wav", "duration": 5.2260625, "text": "神秘气体成分及来源正在进一步核实"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0296.wav", "duration": 4.1319375, "text": "往往连最直接的目标都无法达成"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0226.wav", "duration": 3.012, "text": "加强农业资源和生态环境保护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0474.wav", "duration": 3.9658125, "text": "一个人的精神生命就将走向衰老"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0197.wav", "duration": 8.3309375, "text": "加强以节水灌溉饲草地为重点的牧区水利建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0348.wav", "duration": 5.6479375, "text": "其中北京市区仅需要新建一座速滑场馆"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0321.wav", "duration": 4.3618125, "text": "自己只是执行公司的工作要求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0427.wav", "duration": 5.776875, "text": "陈奕迅双手合十认真地向蛋糕许愿"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0268.wav", "duration": 3.8350625, "text": "确认消费者喜新厌旧后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0210.wav", "duration": 2.8889375, "text": "占比只有百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0411.wav", "duration": 2.822, "text": "近期他积极复出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0299.wav", "duration": 6.287, "text": "我根本无法想象每天在朋友圈上花两个小时的情景"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0360.wav", "duration": 3.827125, "text": "我这次的对手水平很高"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0168.wav", "duration": 3.25, "text": "在参与调查的网友中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0446.wav", "duration": 4.365, "text": "在年轻时也有着跳龙门的梦"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0330.wav", "duration": 3.9360625, "text": "判处有期徒刑三年六个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0185.wav", "duration": 6.0919375, "text": "助力中国房地产开发企业发掘并实现更大的价值需求"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0290.wav", "duration": 4.3249375, "text": "预计从二零一五年下半年开始"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0244.wav", "duration": 7.1020625, "text": "也就是将债券还本压力在债券存续期内进行合理分摊"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0431.wav", "duration": 5.094, "text": "李玉刚离开蒙面歌王网友遗憾没听见神曲"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0433.wav", "duration": 9.0329375, "text": "贾某被市三中院终审判处有期徒刑两年八个月"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0243.wav", "duration": 6.2889375, "text": "采取积极有效的措施化解部分地区和领域的债务风险"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0258.wav", "duration": 4.5, "text": "为提高苹果零售商店的服务质量"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0396.wav", "duration": 3.5710625, "text": "半决赛对阵俄罗斯的比赛中"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0175.wav", "duration": 8.0, "text": "石榴中心位于丰台区宋家庄交通枢纽商圈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0328.wav", "duration": 5.746125, "text": "往往在采购过程中尽量压低报价"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0437.wav", "duration": 5.391125, "text": "关于低价游旅行团因强制购物产生的纠纷事件频出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0180.wav", "duration": 3.6590625, "text": "瑞银分析师丁晓预测"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0161.wav", "duration": 3.871, "text": "唯独这样才能盘活公积金资源"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0177.wav", "duration": 3.0850625, "text": "此次公积金政策调整"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0304.wav", "duration": 7.033, "text": "加速推进中国服务器市场份额的第一目标"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0309.wav", "duration": 5.173, "text": "公司的汽车业务应该会有一些弱化"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0216.wav", "duration": 4.8609375, "text": "但是还需要进一步改进"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0418.wav", "duration": 4.7470625, "text": "他直言不想看见自己变作一潭死水"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0251.wav", "duration": 5.1900625, "text": "针对近期各种环境事件暴露出的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0471.wav", "duration": 4.058125, "text": "遇害女教师昨晚七时五七分"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0916/BAC009S0916W0253.wav", "duration": 3.0379375, "text": "中国的银行居垄断地位"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0376.wav", "duration": 2.5449375, "text": "因此一个眼神一个动作"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0324.wav", "duration": 3.499, "text": "美的空调进行自动化升级"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0395.wav", "duration": 5.380875, "text": "以前接触比较多的巴西队速度也很快"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0184.wav", "duration": 5.4390625, "text": "投资者担心这将加重人民币所面临的压力"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0492.wav", "duration": 4.661125, "text": "因火锅加水问题与顾客发生争执"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0477.wav", "duration": 5.303, "text": "参考消息网七月二九日报道港媒称"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0315.wav", "duration": 4.4079375, "text": "而手机被安装上这一插件后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0410.wav", "duration": 4.381125, "text": "众人一起为寿寿星女庆生"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0155.wav", "duration": 5.289, "text": "无论是降低二套房公积金首付比例"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0381.wav", "duration": 3.791, "text": "根据韩国乒乓球协会的相关规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0143.wav", "duration": 3.961, "text": "还加大棚户区的改造任务"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0387.wav", "duration": 4.3149375, "text": "阿根廷队队长索萨认为"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0169.wav", "duration": 5.442, "text": "而重点城市的供应也在七月份下滑了百分之七"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0426.wav", "duration": 4.3049375, "text": "搜狐娱乐讯四月三十日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0316.wav", "duration": 6.1289375, "text": "同比减少百分之三十四毛利十四点六一亿港元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0142.wav", "duration": 4.992, "text": "广州调整住房公积金个人住房贷款政策"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0154.wav", "duration": 5.021, "text": "而其房源多在一百平方米以下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0240.wav", "duration": 3.729, "text": "规范技术和产品标准"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0327.wav", "duration": 4.0590625, "text": "由于各家之间竞争激烈"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0176.wav", "duration": 3.85, "text": "住建部官员发表文章指出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0908/BAC009S0908W0182.wav", "duration": 6.7559375, "text": "此次住建部财政部和中央联合发文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0253.wav", "duration": 6.298, "text": "其在纳斯达克上市时的发行价为一六美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0456.wav", "duration": 7.993875, "text": "备受关注的青岛三八元一只大虾事件有最新发展"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0335.wav", "duration": 11.4340625, "text": "浪潮与海关总署启动战略合作助推智慧海关搜狐科技"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0143.wav", "duration": 8.189, "text": "但包括鄂尔多斯温州等地的去库存还是非常困难"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0473.wav", "duration": 5.52, "text": "被警方确认为新农村党支部书记毛家文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0121.wav", "duration": 3.0920625, "text": "一线城市出现日光盘"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0463.wav", "duration": 6.6850625, "text": "日照市公安局官方微博通报了这一事件的调查情况"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0410.wav", "duration": 2.786125, "text": "她在台湾出席活动"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0123.wav", "duration": 5.151, "text": "土地市场交易火热的局面可能降温"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0326.wav", "duration": 7.666, "text": "其中第一期回购资金上限为二零一四年净利润的百分之二十五"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0365.wav", "duration": 4.5290625, "text": "最令德维塔感到不可思议的是"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0256.wav", "duration": 4.379, "text": "企业于某个领域称王称霸的一刻"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0312.wav", "duration": 6.506875, "text": "核心技术待突破自棱镜门事件之后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0342.wav", "duration": 3.9399375, "text": "成就了中国女排五连冠伟业"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0417.wav", "duration": 2.15575, "text": "他应该也是喜欢"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0398.wav", "duration": 3.3659375, "text": "在俄罗斯队的严密拦防下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0428.wav", "duration": 3.045875, "text": "是否会请教男友拍戏上的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0154.wav", "duration": 4.7530625, "text": "北京公积金贷款首付比例松绑一周后"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0401.wav", "duration": 4.9929375, "text": "要说一点儿没有遗憾和失落是假的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0337.wav", "duration": 4.9980625, "text": "公司上半年营业收入六点三四亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0338.wav", "duration": 5.364, "text": "医生此次将对惠若琪的心脏进行微创手术"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0309.wav", "duration": 6.390125, "text": "将家用空调事业部员工工人数缩减至两万人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0370.wav", "duration": 6.444125, "text": "但朱婷与队友们合力打出了一波八比二的高潮"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0490.wav", "duration": 5.001, "text": "至七月一六日中午已有五人去世"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0372.wav", "duration": 3.9350625, "text": "曾春蕾认为中国女排的困难体现在伤病多"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0228.wav", "duration": 4.537, "text": "多油并举稳定食用植物油自给率"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0433.wav", "duration": 8.3520625, "text": "游客抢订冬奥运旅游团因遭遇订票难住房等"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0140.wav", "duration": 4.875, "text": "公积金贷款利率也数次下调"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0199.wav", "duration": 6.548, "text": "以七区二十三带农业战略格局为核心"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0433.wav", "duration": 4.355, "text": "这种低价游自称费用全包"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0133.wav", "duration": 6.245, "text": "选择恒大世茂富力的网友均不足百分之十"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0446.wav", "duration": 5.9179375, "text": "遭追讨欠款和抚养费共四零万元人民币"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0398.wav", "duration": 3.6909375, "text": "卢卡斯亚库比泽克"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0244.wav", "duration": 5.7270625, "text": "在我国出现政府性债务违约的可能性是不大的"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0382.wav", "duration": 8.322, "text": "自己和庞清曾在赛场上努力地追求优秀更优秀"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0373.wav", "duration": 7.254875, "text": "他是否接受外卡参赛要视情况而定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0249.wav", "duration": 4.2839375, "text": "省交通部门称目前未定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0165.wav", "duration": 6.77, "text": "将依照中外合资经营企业的相关暂行规定"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0450.wav", "duration": 3.8210625, "text": "现代快报记者注意到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0901/BAC009S0901W0327.wav", "duration": 6.344, "text": "各方本着互惠互利优势互补合作共赢的原则"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0177.wav", "duration": 4.5979375, "text": "投资价值更好房企看好"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0354.wav", "duration": 2.994875, "text": "终于得到了释放的样子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0340.wav", "duration": 5.114, "text": "称高桥大辅可能在一段时间里出柜"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0906/BAC009S0906W0383.wav", "duration": 2.8930625, "text": "二零一五年六月七日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0488.wav", "duration": 4.6911875, "text": "且产地均指向广东省湛江市"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0907/BAC009S0907W0286.wav", "duration": 5.5739375, "text": "乔斯维亚克还为苹果平板电脑业务做了辩护"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0399.wav", "duration": 2.7690625, "text": "搜狐体育郭健文"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0124.wav", "duration": 5.019, "text": "因此操作环节的快捷性与便捷性非常重要"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0369.wav", "duration": 4.6469375, "text": "心肌同位素扫描显示局部灌注差"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0293.wav", "duration": 5.5, "text": "电池的技术难题最终导致了它的延迟推出"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0332.wav", "duration": 4.937, "text": "一位股份制银行科技部负责人如此讲述"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0912/BAC009S0912W0234.wav", "duration": 4.6500625, "text": "严格化学品环境管理"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0456.wav", "duration": 3.902125, "text": "沙洲几乎年年被淹"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0382.wav", "duration": 5.1540625, "text": "分别是发接传垫扣"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0132.wav", "duration": 4.34, "text": "全国商品房销售额两万亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0214.wav", "duration": 10.608, "text": "为各地的基础建设设提供有制度保障的融资渠道"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0266.wav", "duration": 6.5300625, "text": "每股报价报收于一百一十一点二七美元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0331.wav", "duration": 5.6739375, "text": "收盘价十三点六五元于七月八日发布公告"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0902/BAC009S0902W0493.wav", "duration": 5.026875, "text": "法晚深度即时记者杜雯雯实习生张明明近日"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0354.wav", "duration": 4.5659375, "text": "身体质量指数平均为二十三点四"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0298.wav", "duration": 4.796, "text": "这家市值离万亿美元不远的股王"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0914/BAC009S0914W0260.wav", "duration": 3.906, "text": "才能显得像个知识分子"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0904/BAC009S0904W0247.wav", "duration": 3.802, "text": "大力推进农村清洁工程建设"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0194.wav", "duration": 5.5550625, "text": "中国证券报从您刚才的介绍中我们了解到"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0402.wav", "duration": 8.2741875, "text": "北京和张家口两地的生产总值是二万二千七百三十点八亿元"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0903/BAC009S0903W0251.wav", "duration": 5.145, "text": "推行统一的标准操作规程和技术规范"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0915/BAC009S0915W0260.wav", "duration": 7.162, "text": "这也影响着移动支付市场的总体进程和发展方向"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0770/BAC009S0770W0162.wav", "duration": 4.9929375, "text": "政策放松和高库存背景下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0913/BAC009S0913W0339.wav", "duration": 5.828, "text": "剪纸皮影戏等特色节目更是吸引了一批批观众围观"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0210.wav", "duration": 3.9279375, "text": "切实降低农产品流通成本"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0905/BAC009S0905W0125.wav", "duration": 6.2209375, "text": "这一公积金新政实际上仍然存在很多门槛"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0769/BAC009S0769W0151.wav", "duration": 4.834, "text": "对于今后棚户区改造中遇到的问题"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0766/BAC009S0766W0126.wav", "duration": 3.575, "text": "今久整合营销集团就是如此"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0767/BAC009S0767W0124.wav", "duration": 3.778, "text": "今久从最初的几十个人"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0275.wav", "duration": 10.801, "text": "美商务部与国际贸易委员会都需作出肯定性终裁"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0765/BAC009S0765W0146.wav", "duration": 3.4330625, "text": "虽然房产是在信托的名下"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0768/BAC009S0768W0412.wav", "duration": 4.1630625, "text": "自小卖得一脸好萌"} +{"audio_filepath": "aishell-test-dev-manifests/aishell/data_aishell/wav/test/S0764/BAC009S0764W0454.wav", "duration": 3.4309375, "text": "现代快报记者胡玉梅"} diff --git a/runtime/triton_gpu/client/client.py b/runtime/triton_gpu/client/client.py new file mode 100644 index 0000000..6cdbe92 --- /dev/null +++ b/runtime/triton_gpu/client/client.py @@ -0,0 +1,191 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import multiprocessing +from multiprocessing import Pool + +import argparse +import os +import tritonclient.grpc as grpcclient +from utils import cal_cer +from speech_client import * +import numpy as np + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "-v", + "--verbose", + action="store_true", + required=False, + default=False, + help="Enable verbose output", + ) + parser.add_argument( + "-u", + "--url", + type=str, + required=False, + default="localhost:10086", + help="Inference server URL. Default is " "localhost:8001.", + ) + parser.add_argument( + "--model_name", + required=False, + default="attention_rescoring", + choices=["attention_rescoring", "streaming_wenet", "infer_pipeline"], + help="the model to send request to", + ) + parser.add_argument( + "--wavscp", + type=str, + required=False, + default=None, + help="audio_id \t wav_path", + ) + parser.add_argument( + "--trans", + type=str, + required=False, + default=None, + help="audio_id \t text", + ) + parser.add_argument( + "--data_dir", + type=str, + required=False, + default=None, + help="path prefix for wav_path in wavscp/audio_file", + ) + parser.add_argument( + "--audio_file", + type=str, + required=False, + default=None, + help="single wav file path", + ) + # below arguments are for streaming + # Please check onnx_config.yaml and train.yaml + parser.add_argument("--streaming", action="store_true", required=False) + parser.add_argument( + "--sample_rate", + type=int, + required=False, + default=16000, + help="sample rate used in training", + ) + parser.add_argument( + "--frame_length_ms", + type=int, + required=False, + default=25, + help="frame length", + ) + parser.add_argument( + "--frame_shift_ms", + type=int, + required=False, + default=10, + help="frame shift length", + ) + parser.add_argument( + "--chunk_size", + type=int, + required=False, + default=16, + help="chunk size default is 16", + ) + parser.add_argument( + "--context", + type=int, + required=False, + default=7, + help="subsampling context", + ) + parser.add_argument( + "--subsampling", + type=int, + required=False, + default=4, + help="subsampling rate", + ) + + FLAGS = parser.parse_args() + print(FLAGS) + + # load data + filenames = [] + transcripts = [] + if FLAGS.audio_file is not None: + path = FLAGS.audio_file + if FLAGS.data_dir: + path = os.path.join(FLAGS.data_dir, path) + if os.path.exists(path): + filenames = [path] + elif FLAGS.wavscp is not None: + audio_data = {} + with open(FLAGS.wavscp, "r", encoding="utf-8") as f: + for line in f: + aid, path = line.strip().split("\t") + if FLAGS.data_dir: + path = os.path.join(FLAGS.data_dir, path) + audio_data[aid] = {"path": path} + with open(FLAGS.trans, "r", encoding="utf-8") as f: + for line in f: + aid, text = line.strip().split("\t") + audio_data[aid]["text"] = text + for key, value in audio_data.items(): + filenames.append(value["path"]) + transcripts.append(value["text"]) + + num_workers = multiprocessing.cpu_count() // 2 + + if FLAGS.streaming: + speech_client_cls = StreamingSpeechClient + else: + speech_client_cls = OfflineSpeechClient + + def single_job(client_files): + with grpcclient.InferenceServerClient( + url=FLAGS.url, verbose=FLAGS.verbose + ) as triton_client: + protocol_client = grpcclient + speech_client = speech_client_cls( + triton_client, FLAGS.model_name, protocol_client, FLAGS + ) + idx, audio_files = client_files + predictions = [] + for li in audio_files: + result = speech_client.recognize(li, idx) + print("Recognized {}:{}".format(li, result[0])) + predictions += result + return predictions + + # start to do inference + # Group requests in batches + predictions = [] + tasks = [] + splits = np.array_split(filenames, num_workers) + + for idx, per_split in enumerate(splits): + cur_files = per_split.tolist() + tasks.append((idx, cur_files)) + + with Pool(processes=num_workers) as pool: + predictions = pool.map(single_job, tasks) + + predictions = [item for sublist in predictions for item in sublist] + if transcripts: + cer = cal_cer(predictions, transcripts) + print("CER is: {}".format(cer)) diff --git a/runtime/triton_gpu/client/decode_manifest_triton.py b/runtime/triton_gpu/client/decode_manifest_triton.py new file mode 100644 index 0000000..482c715 --- /dev/null +++ b/runtime/triton_gpu/client/decode_manifest_triton.py @@ -0,0 +1,518 @@ +#!/usr/bin/env python3 +# Copyright 2022 Xiaomi Corp. (authors: Fangjun Kuang) +# 2023 Nvidia (authors: Yuekai Zhang) +# See LICENSE for clarification regarding multiple authors +# +# 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +This script loads a manifest in lhotse format and sends it to the server +for decoding, in parallel. + +Usage: +# For offline wenet server +./decode_manifest_triton.py \ + --server-addr localhost \ + --compute-cer \ + --model-name attention_rescoring \ + --num-tasks 300 \ + --manifest-filename ./aishell-test-dev-manifests/data/fbank/aishell_cuts_test.jsonl.gz # noqa + +# For streaming wenet server +./decode_manifest_triton.py \ + --server-addr localhost \ + --streaming \ + --compute-cer \ + --context 7 \ + --model-name streaming_wenet \ + --num-tasks 300 \ + --manifest-filename ./aishell-test-dev-manifests/data/fbank/aishell_cuts_test.jsonl.gz # noqa + +# For simulate streaming mode wenet server +./decode_manifest_triton.py \ + --server-addr localhost \ + --simulate-streaming \ + --compute-cer \ + --context 7 \ + --model-name streaming_wenet \ + --num-tasks 300 \ + --manifest-filename ./aishell-test-dev-manifests/data/fbank/aishell_cuts_test.jsonl.gz # noqa + +# For test container: +docker run -it --rm --name "wenet_client_test" --net host --gpus all soar97/triton-k2:22.12.1 # noqa + +# For aishell manifests: +apt-get install git-lfs +git-lfs install +git clone https://huggingface.co/csukuangfj/aishell-test-dev-manifests +sudo mkdir -p /root/fangjun/open-source/icefall-aishell/egs/aishell/ASR/download/aishell +tar xf ./aishell-test-dev-manifests/data_aishell.tar.gz -C /root/fangjun/open-source/icefall-aishell/egs/aishell/ASR/download/aishell/ # noqa + +""" + +import argparse +import asyncio +import math +import time +import types +from pathlib import Path +import json +import numpy as np +import tritonclient +import tritonclient.grpc.aio as grpcclient +from lhotse import CutSet, load_manifest +from tritonclient.utils import np_to_triton_dtype + +from icefall.utils import store_transcripts, write_error_stats + +DEFAULT_MANIFEST_FILENAME = "/mnt/samsung-t7/yuekai/aishell-test-dev-manifests/data/fbank/aishell_cuts_test.jsonl.gz" # noqa + + +def get_args(): + parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument( + "--server-addr", + type=str, + default="localhost", + help="Address of the server", + ) + + parser.add_argument( + "--server-port", + type=int, + default=8001, + help="Port of the server", + ) + + parser.add_argument( + "--manifest-filename", + type=str, + default=DEFAULT_MANIFEST_FILENAME, + help="Path to the manifest for decoding", + ) + + parser.add_argument( + "--model-name", + type=str, + default="transducer", + help="triton model_repo module name to request", + ) + + parser.add_argument( + "--num-tasks", + type=int, + default=50, + help="Number of tasks to use for sending", + ) + + parser.add_argument( + "--log-interval", + type=int, + default=5, + help="Controls how frequently we print the log.", + ) + + parser.add_argument( + "--compute-cer", + action="store_true", + default=False, + help="""True to compute CER, e.g., for Chinese. + False to compute WER, e.g., for English words. + """, + ) + + parser.add_argument( + "--streaming", + action="store_true", + default=False, + help="""True for streaming ASR. + """, + ) + + parser.add_argument( + "--simulate-streaming", + action="store_true", + default=False, + help="""True for strictly simulate streaming ASR. + Threads will sleep to simulate the real speaking scene. + """, + ) + + parser.add_argument( + "--chunk_size", + type=int, + required=False, + default=16, + help="chunk size default is 16", + ) + + parser.add_argument( + "--context", + type=int, + required=False, + default=-1, + help="subsampling context for wenet", + ) + + parser.add_argument( + "--encoder_right_context", + type=int, + required=False, + default=2, + help="encoder right context", + ) + + parser.add_argument( + "--subsampling", + type=int, + required=False, + default=4, + help="subsampling rate", + ) + + parser.add_argument( + "--stats_file", + type=str, + required=False, + default="./stats.json", + help="output of stats anaylasis", + ) + + return parser.parse_args() + + +async def send( + cuts: CutSet, + name: str, + triton_client: tritonclient.grpc.aio.InferenceServerClient, + protocol_client: types.ModuleType, + log_interval: int, + compute_cer: bool, + model_name: str, +): + total_duration = 0.0 + results = [] + + for i, c in enumerate(cuts): + if i % log_interval == 0: + print(f"{name}: {i}/{len(cuts)}") + + waveform = c.load_audio().reshape(-1).astype(np.float32) + sample_rate = 16000 + + # padding to nearset 10 seconds + samples = np.zeros( + ( + 1, + 10 * sample_rate * (int(len(waveform) / sample_rate // 10) + 1), + ), + dtype=np.float32, + ) + samples[0, : len(waveform)] = waveform + + lengths = np.array([[len(waveform)]], dtype=np.int32) + + inputs = [ + protocol_client.InferInput("WAV", samples.shape, np_to_triton_dtype(samples.dtype)), + protocol_client.InferInput( + "WAV_LENS", lengths.shape, np_to_triton_dtype(lengths.dtype) + ), + ] + inputs[0].set_data_from_numpy(samples) + inputs[1].set_data_from_numpy(lengths) + outputs = [protocol_client.InferRequestedOutput("TRANSCRIPTS")] + sequence_id = 10086 + i + + response = await triton_client.infer( + model_name, inputs, request_id=str(sequence_id), outputs=outputs + ) + + decoding_results = response.as_numpy("TRANSCRIPTS")[0] + if type(decoding_results) == np.ndarray: + decoding_results = b" ".join(decoding_results).decode("utf-8") + else: + # For wenet + decoding_results = decoding_results.decode("utf-8") + + total_duration += c.duration + + if compute_cer: + ref = c.supervisions[0].text.split() + hyp = decoding_results.split() + ref = list("".join(ref)) + hyp = list("".join(hyp)) + results.append((c.id, ref, hyp)) + else: + results.append( + ( + c.id, + c.supervisions[0].text.split(), + decoding_results.split(), + ) + ) # noqa + + return total_duration, results + + +async def send_streaming( + cuts: CutSet, + name: str, + triton_client: tritonclient.grpc.aio.InferenceServerClient, + protocol_client: types.ModuleType, + log_interval: int, + compute_cer: bool, + model_name: str, + first_chunk_in_secs: float, + other_chunk_in_secs: float, + task_index: int, + simulate_mode: bool = False, +): + total_duration = 0.0 + results = [] + latency_data = [] + + for i, c in enumerate(cuts): + if i % log_interval == 0: + print(f"{name}: {i}/{len(cuts)}") + + waveform = c.load_audio().reshape(-1).astype(np.float32) + sample_rate = 16000 + + wav_segs = [] + + j = 0 + while j < len(waveform): + if j == 0: + stride = int(first_chunk_in_secs * sample_rate) + wav_segs.append(waveform[j : j + stride]) + else: + stride = int(other_chunk_in_secs * sample_rate) + wav_segs.append(waveform[j : j + stride]) + j += len(wav_segs[-1]) + + sequence_id = task_index + 10086 + + for idx, seg in enumerate(wav_segs): + chunk_len = len(seg) + + if simulate_mode: + await asyncio.sleep(chunk_len / sample_rate) + + chunk_start = time.time() + if idx == 0: + chunk_samples = int(first_chunk_in_secs * sample_rate) + expect_input = np.zeros((1, chunk_samples), dtype=np.float32) + else: + chunk_samples = int(other_chunk_in_secs * sample_rate) + expect_input = np.zeros((1, chunk_samples), dtype=np.float32) + + expect_input[0][0:chunk_len] = seg + input0_data = expect_input + input1_data = np.array([[chunk_len]], dtype=np.int32) + + inputs = [ + protocol_client.InferInput( + "WAV", + input0_data.shape, + np_to_triton_dtype(input0_data.dtype), + ), + protocol_client.InferInput( + "WAV_LENS", + input1_data.shape, + np_to_triton_dtype(input1_data.dtype), + ), + ] + + inputs[0].set_data_from_numpy(input0_data) + inputs[1].set_data_from_numpy(input1_data) + + outputs = [protocol_client.InferRequestedOutput("TRANSCRIPTS")] + end = False + if idx == len(wav_segs) - 1: + end = True + + response = await triton_client.infer( + model_name, + inputs, + outputs=outputs, + sequence_id=sequence_id, + sequence_start=idx == 0, + sequence_end=end, + ) + idx += 1 + + decoding_results = response.as_numpy("TRANSCRIPTS") + if type(decoding_results) == np.ndarray: + decoding_results = b" ".join(decoding_results).decode("utf-8") + else: + # For wenet + decoding_results = response.as_numpy("TRANSCRIPTS")[0].decode("utf-8") + chunk_end = time.time() - chunk_start + latency_data.append((chunk_end, chunk_len / sample_rate)) + + total_duration += c.duration + + if compute_cer: + ref = c.supervisions[0].text.split() + hyp = decoding_results.split() + ref = list("".join(ref)) + hyp = list("".join(hyp)) + results.append((c.id, ref, hyp)) + else: + results.append( + ( + c.id, + c.supervisions[0].text.split(), + decoding_results.split(), + ) + ) # noqa + + return total_duration, results, latency_data + + +async def main(): + args = get_args() + filename = args.manifest_filename + server_addr = args.server_addr + server_port = args.server_port + url = f"{server_addr}:{server_port}" + num_tasks = args.num_tasks + log_interval = args.log_interval + compute_cer = args.compute_cer + + cuts = load_manifest(filename) + cuts_list = cuts.split(num_tasks) + tasks = [] + + triton_client = grpcclient.InferenceServerClient(url=url, verbose=False) + protocol_client = grpcclient + + if args.streaming or args.simulate_streaming: + frame_shift_ms = 10 + frame_length_ms = 25 + add_frames = math.ceil((frame_length_ms - frame_shift_ms) / frame_shift_ms) + # decode_window_length: input sequence length of streaming encoder + if args.context > 0: + # decode window length calculation for wenet + decode_window_length = (args.chunk_size - 1) * args.subsampling + args.context + else: + # decode window length calculation for icefall + decode_window_length = ( + args.chunk_size + 2 + args.encoder_right_context + ) * args.subsampling + 3 + + first_chunk_ms = (decode_window_length + add_frames) * frame_shift_ms + + start_time = time.time() + for i in range(num_tasks): + if args.streaming: + assert not args.simulate_streaming + task = asyncio.create_task( + send_streaming( + cuts=cuts_list[i], + name=f"task-{i}", + triton_client=triton_client, + protocol_client=protocol_client, + log_interval=log_interval, + compute_cer=compute_cer, + model_name=args.model_name, + first_chunk_in_secs=first_chunk_ms / 1000, + other_chunk_in_secs=args.chunk_size * args.subsampling * frame_shift_ms / 1000, + task_index=i, + ) + ) + elif args.simulate_streaming: + task = asyncio.create_task( + send_streaming( + cuts=cuts_list[i], + name=f"task-{i}", + triton_client=triton_client, + protocol_client=protocol_client, + log_interval=log_interval, + compute_cer=compute_cer, + model_name=args.model_name, + first_chunk_in_secs=first_chunk_ms / 1000, + other_chunk_in_secs=args.chunk_size * args.subsampling * frame_shift_ms / 1000, + task_index=i, + simulate_mode=True, + ) + ) + else: + task = asyncio.create_task( + send( + cuts=cuts_list[i], + name=f"task-{i}", + triton_client=triton_client, + protocol_client=protocol_client, + log_interval=log_interval, + compute_cer=compute_cer, + model_name=args.model_name, + ) + ) + tasks.append(task) + + ans_list = await asyncio.gather(*tasks) + + end_time = time.time() + elapsed = end_time - start_time + + results = [] + total_duration = 0.0 + latency_data = [] + for ans in ans_list: + total_duration += ans[0] + results += ans[1] + if args.streaming or args.simulate_streaming: + latency_data += ans[2] + + rtf = elapsed / total_duration + + s = f"RTF: {rtf:.4f}\n" + s += f"total_duration: {total_duration:.3f} seconds\n" + s += f"({total_duration/3600:.2f} hours)\n" + s += f"processing time: {elapsed:.3f} seconds " f"({elapsed/3600:.2f} hours)\n" + + if args.streaming or args.simulate_streaming: + latency_list = [chunk_end for (chunk_end, chunk_duration) in latency_data] + latency_ms = sum(latency_list) / float(len(latency_list)) * 1000.0 + latency_variance = np.var(latency_list, dtype=np.float64) * 1000.0 + s += f"latency_variance: {latency_variance:.2f}\n" + s += f"latency_50_percentile: {np.percentile(latency_list, 50) * 1000.0:.2f}\n" + s += f"latency_90_percentile: {np.percentile(latency_list, 90) * 1000.0:.2f}\n" + s += f"latency_99_percentile: {np.percentile(latency_list, 99) * 1000.0:.2f}\n" + s += f"average_latency_ms: {latency_ms:.2f}\n" + + print(s) + + with open("rtf.txt", "w") as f: + f.write(s) + + name = Path(filename).stem.split(".")[0] + results = sorted(results) + store_transcripts(filename=f"recogs-{name}.txt", texts=results) + + with open(f"errs-{name}.txt", "w") as f: + write_error_stats(f, "test-set", results, enable_log=True) + + with open(f"errs-{name}.txt", "r") as f: + print(f.readline()) # WER + print(f.readline()) # Detailed errors + + if args.stats_file: + stats = await triton_client.get_inference_statistics(model_name="", as_json=True) + with open(args.stats_file, "w") as f: + json.dump(stats, f) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/runtime/triton_gpu/client/decode_manifest_triton_wo_cuts.py b/runtime/triton_gpu/client/decode_manifest_triton_wo_cuts.py new file mode 100644 index 0000000..379b28d --- /dev/null +++ b/runtime/triton_gpu/client/decode_manifest_triton_wo_cuts.py @@ -0,0 +1,536 @@ +#!/usr/bin/env python3 +# Copyright 2022 Xiaomi Corp. (authors: Fangjun Kuang) +# 2023 Nvidia (authors: Yuekai Zhang) +# 2023 Recurrent.ai (authors: Songtao Shi) +# See LICENSE for clarification regarding multiple authors +# +# 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +This script loads a manifest in nemo format and sends it to the server +for decoding, in parallel. + +{'audio_filepath':'','text':'',duration:}\n +{'audio_filepath':'','text':'',duration:}\n + +Usage: +# For aishell manifests: +apt-get install git-lfs +git-lfs install +git clone https://huggingface.co/csukuangfj/aishell-test-dev-manifests +sudo mkdir -p ./aishell-test-dev-manifests/aishell +tar xf ./aishell-test-dev-manifests/data_aishell.tar.gz -C ./aishell-test-dev-manifests/aishell # noqa + + +# cmd run +manifest_path='./client/aishell_test.txt' +serveraddr=localhost +num_task=60 +python3 client/decode_manifest_triton_wo_cuts.py \ + --server-addr $serveraddr \ + --compute-cer \ + --model-name infer_pipeline \ + --num-tasks $num_task \ + --manifest-filename $manifest_path \ +""" + +from pydub import AudioSegment +import argparse +import asyncio +import math +import time +import types +from pathlib import Path +import json +import os +import numpy as np +import tritonclient +import tritonclient.grpc.aio as grpcclient +from tritonclient.utils import np_to_triton_dtype + +from icefall.utils import store_transcripts, write_error_stats + +DEFAULT_MANIFEST_FILENAME = "./aishell_test.txt" # noqa +DEFAULT_ROOT = "./" +DEFAULT_ROOT = "/mfs/songtao/researchcode/FunASR/data/" + + +def get_args(): + parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument( + "--server-addr", + type=str, + default="localhost", + help="Address of the server", + ) + + parser.add_argument( + "--server-port", + type=int, + default=8001, + help="Port of the server", + ) + + parser.add_argument( + "--manifest-filename", + type=str, + default=DEFAULT_MANIFEST_FILENAME, + help="Path to the manifest for decoding", + ) + + parser.add_argument( + "--model-name", + type=str, + default="transducer", + help="triton model_repo module name to request", + ) + + parser.add_argument( + "--num-tasks", + type=int, + default=50, + help="Number of tasks to use for sending", + ) + + parser.add_argument( + "--log-interval", + type=int, + default=5, + help="Controls how frequently we print the log.", + ) + + parser.add_argument( + "--compute-cer", + action="store_true", + default=False, + help="""True to compute CER, e.g., for Chinese. + False to compute WER, e.g., for English words. + """, + ) + + parser.add_argument( + "--streaming", + action="store_true", + default=False, + help="""True for streaming ASR. + """, + ) + + parser.add_argument( + "--simulate-streaming", + action="store_true", + default=False, + help="""True for strictly simulate streaming ASR. + Threads will sleep to simulate the real speaking scene. + """, + ) + + parser.add_argument( + "--chunk_size", + type=int, + required=False, + default=16, + help="chunk size default is 16", + ) + + parser.add_argument( + "--context", + type=int, + required=False, + default=-1, + help="subsampling context for wenet", + ) + + parser.add_argument( + "--encoder_right_context", + type=int, + required=False, + default=2, + help="encoder right context", + ) + + parser.add_argument( + "--subsampling", + type=int, + required=False, + default=4, + help="subsampling rate", + ) + + parser.add_argument( + "--stats_file", + type=str, + required=False, + default="./stats.json", + help="output of stats anaylasis", + ) + + return parser.parse_args() + + +def load_manifest(fp): + data = [] + with open(fp) as f: + for i, dp in enumerate(f.readlines()): + dp = eval(dp) + dp["id"] = i + data.append(dp) + return data + + +def split_dps(dps, num_tasks): + dps_splited = [] + # import pdb;pdb.set_trace() + assert len(dps) > num_tasks + + one_task_num = len(dps) // num_tasks + for i in range(0, len(dps), one_task_num): + if i + one_task_num >= len(dps): + for k, j in enumerate(range(i, len(dps))): + dps_splited[k].append(dps[j]) + else: + dps_splited.append(dps[i : i + one_task_num]) + return dps_splited + + +def load_audio(path): + audio = AudioSegment.from_wav(path).set_frame_rate(16000).set_channels(1) + audiop_np = np.array(audio.get_array_of_samples()) / 32768.0 + return audiop_np.astype(np.float32), audio.duration_seconds + + +async def send( + dps: list, + name: str, + triton_client: tritonclient.grpc.aio.InferenceServerClient, + protocol_client: types.ModuleType, + log_interval: int, + compute_cer: bool, + model_name: str, +): + total_duration = 0.0 + results = [] + + for i, dp in enumerate(dps): + if i % log_interval == 0: + print(f"{name}: {i}/{len(dps)}") + + waveform, duration = load_audio(os.path.join(DEFAULT_ROOT, dp["audio_filepath"])) + sample_rate = 16000 + + # padding to nearset 10 seconds + samples = np.zeros( + ( + 1, + 10 * sample_rate * (int(len(waveform) / sample_rate // 10) + 1), + ), + dtype=np.float32, + ) + samples[0, : len(waveform)] = waveform + + lengths = np.array([[len(waveform)]], dtype=np.int32) + + inputs = [ + protocol_client.InferInput("WAV", samples.shape, np_to_triton_dtype(samples.dtype)), + protocol_client.InferInput( + "WAV_LENS", lengths.shape, np_to_triton_dtype(lengths.dtype) + ), + ] + inputs[0].set_data_from_numpy(samples) + inputs[1].set_data_from_numpy(lengths) + outputs = [protocol_client.InferRequestedOutput("TRANSCRIPTS")] + sequence_id = 10086 + i + + response = await triton_client.infer( + model_name, inputs, request_id=str(sequence_id), outputs=outputs + ) + + decoding_results = response.as_numpy("TRANSCRIPTS")[0] + if type(decoding_results) == np.ndarray: + decoding_results = b" ".join(decoding_results).decode("utf-8") + else: + # For wenet + decoding_results = decoding_results.decode("utf-8") + + total_duration += duration + + if compute_cer: + ref = dp["text"].split() + hyp = decoding_results.split() + ref = list("".join(ref)) + hyp = list("".join(hyp)) + results.append((dp["id"], ref, hyp)) + else: + results.append( + ( + dp["id"], + dp["text"].split(), + decoding_results.split(), + ) + ) # noqa + + return total_duration, results + + +async def send_streaming( + dps: list, + name: str, + triton_client: tritonclient.grpc.aio.InferenceServerClient, + protocol_client: types.ModuleType, + log_interval: int, + compute_cer: bool, + model_name: str, + first_chunk_in_secs: float, + other_chunk_in_secs: float, + task_index: int, + simulate_mode: bool = False, +): + total_duration = 0.0 + results = [] + latency_data = [] + + for i, dp in enumerate(dps): + if i % log_interval == 0: + print(f"{name}: {i}/{len(dps)}") + + waveform, duration = load_audio(dp["audio_filepath"]) + sample_rate = 16000 + + wav_segs = [] + + j = 0 + while j < len(waveform): + if j == 0: + stride = int(first_chunk_in_secs * sample_rate) + wav_segs.append(waveform[j : j + stride]) + else: + stride = int(other_chunk_in_secs * sample_rate) + wav_segs.append(waveform[j : j + stride]) + j += len(wav_segs[-1]) + + sequence_id = task_index + 10086 + + for idx, seg in enumerate(wav_segs): + chunk_len = len(seg) + + if simulate_mode: + await asyncio.sleep(chunk_len / sample_rate) + + chunk_start = time.time() + if idx == 0: + chunk_samples = int(first_chunk_in_secs * sample_rate) + expect_input = np.zeros((1, chunk_samples), dtype=np.float32) + else: + chunk_samples = int(other_chunk_in_secs * sample_rate) + expect_input = np.zeros((1, chunk_samples), dtype=np.float32) + + expect_input[0][0:chunk_len] = seg + input0_data = expect_input + input1_data = np.array([[chunk_len]], dtype=np.int32) + + inputs = [ + protocol_client.InferInput( + "WAV", + input0_data.shape, + np_to_triton_dtype(input0_data.dtype), + ), + protocol_client.InferInput( + "WAV_LENS", + input1_data.shape, + np_to_triton_dtype(input1_data.dtype), + ), + ] + + inputs[0].set_data_from_numpy(input0_data) + inputs[1].set_data_from_numpy(input1_data) + + outputs = [protocol_client.InferRequestedOutput("TRANSCRIPTS")] + end = False + if idx == len(wav_segs) - 1: + end = True + + response = await triton_client.infer( + model_name, + inputs, + outputs=outputs, + sequence_id=sequence_id, + sequence_start=idx == 0, + sequence_end=end, + ) + idx += 1 + + decoding_results = response.as_numpy("TRANSCRIPTS") + if type(decoding_results) == np.ndarray: + decoding_results = b" ".join(decoding_results).decode("utf-8") + else: + # For wenet + decoding_results = response.as_numpy("TRANSCRIPTS")[0].decode("utf-8") + chunk_end = time.time() - chunk_start + latency_data.append((chunk_end, chunk_len / sample_rate)) + + total_duration += duration + + if compute_cer: + ref = dp["text"].split() + hyp = decoding_results.split() + ref = list("".join(ref)) + hyp = list("".join(hyp)) + results.append((dp["id"], ref, hyp)) + else: + results.append( + ( + dp["id"], + dp["text"].split(), + decoding_results.split(), + ) + ) # noqa + + return total_duration, results, latency_data + + +async def main(): + args = get_args() + filename = args.manifest_filename + server_addr = args.server_addr + server_port = args.server_port + url = f"{server_addr}:{server_port}" + num_tasks = args.num_tasks + log_interval = args.log_interval + compute_cer = args.compute_cer + + dps = load_manifest(filename) + dps_list = split_dps(dps, num_tasks) + tasks = [] + + triton_client = grpcclient.InferenceServerClient(url=url, verbose=False) + protocol_client = grpcclient + + if args.streaming or args.simulate_streaming: + frame_shift_ms = 10 + frame_length_ms = 25 + add_frames = math.ceil((frame_length_ms - frame_shift_ms) / frame_shift_ms) + # decode_window_length: input sequence length of streaming encoder + if args.context > 0: + # decode window length calculation for wenet + decode_window_length = (args.chunk_size - 1) * args.subsampling + args.context + else: + # decode window length calculation for icefall + decode_window_length = ( + args.chunk_size + 2 + args.encoder_right_context + ) * args.subsampling + 3 + + first_chunk_ms = (decode_window_length + add_frames) * frame_shift_ms + + start_time = time.time() + for i in range(num_tasks): + if args.streaming: + assert not args.simulate_streaming + task = asyncio.create_task( + send_streaming( + dps=dps_list[i], + name=f"task-{i}", + triton_client=triton_client, + protocol_client=protocol_client, + log_interval=log_interval, + compute_cer=compute_cer, + model_name=args.model_name, + first_chunk_in_secs=first_chunk_ms / 1000, + other_chunk_in_secs=args.chunk_size * args.subsampling * frame_shift_ms / 1000, + task_index=i, + ) + ) + elif args.simulate_streaming: + task = asyncio.create_task( + send_streaming( + dps=dps_list[i], + name=f"task-{i}", + triton_client=triton_client, + protocol_client=protocol_client, + log_interval=log_interval, + compute_cer=compute_cer, + model_name=args.model_name, + first_chunk_in_secs=first_chunk_ms / 1000, + other_chunk_in_secs=args.chunk_size * args.subsampling * frame_shift_ms / 1000, + task_index=i, + simulate_mode=True, + ) + ) + else: + task = asyncio.create_task( + send( + dps=dps_list[i], + name=f"task-{i}", + triton_client=triton_client, + protocol_client=protocol_client, + log_interval=log_interval, + compute_cer=compute_cer, + model_name=args.model_name, + ) + ) + tasks.append(task) + + ans_list = await asyncio.gather(*tasks) + + end_time = time.time() + elapsed = end_time - start_time + + results = [] + total_duration = 0.0 + latency_data = [] + for ans in ans_list: + total_duration += ans[0] + results += ans[1] + if args.streaming or args.simulate_streaming: + latency_data += ans[2] + + rtf = elapsed / total_duration + + s = f"RTF: {rtf:.4f}\n" + s += f"total_duration: {total_duration:.3f} seconds\n" + s += f"({total_duration/3600:.2f} hours)\n" + s += f"processing time: {elapsed:.3f} seconds " f"({elapsed/3600:.2f} hours)\n" + + if args.streaming or args.simulate_streaming: + latency_list = [chunk_end for (chunk_end, chunk_duration) in latency_data] + latency_ms = sum(latency_list) / float(len(latency_list)) * 1000.0 + latency_variance = np.var(latency_list, dtype=np.float64) * 1000.0 + s += f"latency_variance: {latency_variance:.2f}\n" + s += f"latency_50_percentile: {np.percentile(latency_list, 50) * 1000.0:.2f}\n" + s += f"latency_90_percentile: {np.percentile(latency_list, 90) * 1000.0:.2f}\n" + s += f"latency_99_percentile: {np.percentile(latency_list, 99) * 1000.0:.2f}\n" + s += f"average_latency_ms: {latency_ms:.2f}\n" + + print(s) + + with open("rtf.txt", "w") as f: + f.write(s) + + name = Path(filename).stem.split(".")[0] + results = sorted(results) + store_transcripts(filename=f"recogs-{name}.txt", texts=results) + + with open(f"errs-{name}.txt", "w") as f: + write_error_stats(f, "test-set", results, enable_log=True) + + with open(f"errs-{name}.txt", "r") as f: + print(f.readline()) # WER + print(f.readline()) # Detailed errors + + if args.stats_file: + stats = await triton_client.get_inference_statistics(model_name="", as_json=True) + with open(args.stats_file, "w") as f: + json.dump(stats, f) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/runtime/triton_gpu/client/speech_client.py b/runtime/triton_gpu/client/speech_client.py new file mode 100644 index 0000000..15482a7 --- /dev/null +++ b/runtime/triton_gpu/client/speech_client.py @@ -0,0 +1,140 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from tritonclient.utils import np_to_triton_dtype +import numpy as np +import math +import soundfile as sf + + +class OfflineSpeechClient(object): + def __init__(self, triton_client, model_name, protocol_client, args): + self.triton_client = triton_client + self.protocol_client = protocol_client + self.model_name = model_name + + def recognize(self, wav_file, idx=0): + waveform, sample_rate = sf.read(wav_file) + samples = np.array([waveform], dtype=np.float32) + lengths = np.array([[len(waveform)]], dtype=np.int32) + # better pad waveform to nearest length here + # target_seconds = math.cel(len(waveform) / sample_rate) + # target_samples = np.zeros([1, target_seconds * sample_rate]) + # target_samples[0][0: len(waveform)] = waveform + # samples = target_samples + sequence_id = 10086 + idx + result = "" + inputs = [ + self.protocol_client.InferInput( + "WAV", samples.shape, np_to_triton_dtype(samples.dtype) + ), + self.protocol_client.InferInput( + "WAV_LENS", lengths.shape, np_to_triton_dtype(lengths.dtype) + ), + ] + inputs[0].set_data_from_numpy(samples) + inputs[1].set_data_from_numpy(lengths) + outputs = [self.protocol_client.InferRequestedOutput("TRANSCRIPTS")] + response = self.triton_client.infer( + self.model_name, + inputs, + request_id=str(sequence_id), + outputs=outputs, + ) + result = response.as_numpy("TRANSCRIPTS")[0].decode("utf-8") + return [result] + + +class StreamingSpeechClient(object): + def __init__(self, triton_client, model_name, protocol_client, args): + self.triton_client = triton_client + self.protocol_client = protocol_client + self.model_name = model_name + chunk_size = args.chunk_size + subsampling = args.subsampling + context = args.context + frame_shift_ms = args.frame_shift_ms + frame_length_ms = args.frame_length_ms + # for the first chunk + # we need additional frames to generate + # the exact first chunk length frames + # since the subsampling will look ahead several frames + first_chunk_length = (chunk_size - 1) * subsampling + context + add_frames = math.ceil((frame_length_ms - frame_shift_ms) / frame_shift_ms) + first_chunk_ms = (first_chunk_length + add_frames) * frame_shift_ms + other_chunk_ms = chunk_size * subsampling * frame_shift_ms + self.first_chunk_in_secs = first_chunk_ms / 1000 + self.other_chunk_in_secs = other_chunk_ms / 1000 + + def recognize(self, wav_file, idx=0): + waveform, sample_rate = sf.read(wav_file) + wav_segs = [] + i = 0 + while i < len(waveform): + if i == 0: + stride = int(self.first_chunk_in_secs * sample_rate) + wav_segs.append(waveform[i : i + stride]) + else: + stride = int(self.other_chunk_in_secs * sample_rate) + wav_segs.append(waveform[i : i + stride]) + i += len(wav_segs[-1]) + + sequence_id = idx + 10086 + # simulate streaming + for idx, seg in enumerate(wav_segs): + chunk_len = len(seg) + if idx == 0: + chunk_samples = int(self.first_chunk_in_secs * sample_rate) + expect_input = np.zeros((1, chunk_samples), dtype=np.float32) + else: + chunk_samples = int(self.other_chunk_in_secs * sample_rate) + expect_input = np.zeros((1, chunk_samples), dtype=np.float32) + + expect_input[0][0:chunk_len] = seg + input0_data = expect_input + input1_data = np.array([[chunk_len]], dtype=np.int32) + + inputs = [ + self.protocol_client.InferInput( + "WAV", + input0_data.shape, + np_to_triton_dtype(input0_data.dtype), + ), + self.protocol_client.InferInput( + "WAV_LENS", + input1_data.shape, + np_to_triton_dtype(input1_data.dtype), + ), + ] + + inputs[0].set_data_from_numpy(input0_data) + inputs[1].set_data_from_numpy(input1_data) + + outputs = [self.protocol_client.InferRequestedOutput("TRANSCRIPTS")] + end = False + if idx == len(wav_segs) - 1: + end = True + + response = self.triton_client.infer( + self.model_name, + inputs, + outputs=outputs, + sequence_id=sequence_id, + sequence_start=idx == 0, + sequence_end=end, + ) + idx += 1 + result = response.as_numpy("TRANSCRIPTS")[0].decode("utf-8") + print("Get response from {}th chunk: {}".format(idx, result)) + return [result] diff --git a/runtime/triton_gpu/client/test_wavs/long.wav b/runtime/triton_gpu/client/test_wavs/long.wav new file mode 100644 index 0000000..d2430ca Binary files /dev/null and b/runtime/triton_gpu/client/test_wavs/long.wav differ diff --git a/runtime/triton_gpu/client/test_wavs/mid.wav b/runtime/triton_gpu/client/test_wavs/mid.wav new file mode 100644 index 0000000..45a4259 Binary files /dev/null and b/runtime/triton_gpu/client/test_wavs/mid.wav differ diff --git a/runtime/triton_gpu/client/utils.py b/runtime/triton_gpu/client/utils.py new file mode 100644 index 0000000..ec102f7 --- /dev/null +++ b/runtime/triton_gpu/client/utils.py @@ -0,0 +1,60 @@ +import numpy as np + + +def _levenshtein_distance(ref, hyp): + """Levenshtein distance is a string metric for measuring the difference + between two sequences. Informally, the levenshtein disctance is defined as + the minimum number of single-character edits (substitutions, insertions or + deletions) required to change one word into the other. We can naturally + extend the edits to word level when calculate levenshtein disctance for + two sentences. + """ + m = len(ref) + n = len(hyp) + + # special case + if ref == hyp: + return 0 + if m == 0: + return n + if n == 0: + return m + + if m < n: + ref, hyp = hyp, ref + m, n = n, m + + # use O(min(m, n)) space + distance = np.zeros((2, n + 1), dtype=np.int32) + + # initialize distance matrix + for j in range(n + 1): + distance[0][j] = j + + # calculate levenshtein distance + for i in range(1, m + 1): + prev_row_idx = (i - 1) % 2 + cur_row_idx = i % 2 + distance[cur_row_idx][0] = i + for j in range(1, n + 1): + if ref[i - 1] == hyp[j - 1]: + distance[cur_row_idx][j] = distance[prev_row_idx][j - 1] + else: + s_num = distance[prev_row_idx][j - 1] + 1 + i_num = distance[cur_row_idx][j - 1] + 1 + d_num = distance[prev_row_idx][j] + 1 + distance[cur_row_idx][j] = min(s_num, i_num, d_num) + + return distance[m % 2][n] + + +def cal_cer(references, predictions): + errors = 0 + lengths = 0 + for ref, pred in zip(references, predictions): + cur_ref = list(ref) + cur_hyp = list(pred) + cur_error = _levenshtein_distance(cur_ref, cur_hyp) + errors += cur_error + lengths += len(cur_ref) + return float(errors) / lengths diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/encoder/1/.gitkeep b/runtime/triton_gpu/model_repo_paraformer_large_offline/encoder/1/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/encoder/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_offline/encoder/config.pbtxt new file mode 100644 index 0000000..3cb657e --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_offline/encoder/config.pbtxt @@ -0,0 +1,61 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "encoder" +backend: "onnxruntime" +default_model_filename: "model.onnx" + +max_batch_size: 64 + +input [ + { + name: "speech" + data_type: TYPE_FP32 + dims: [-1, 560] + }, + { + name: "speech_lengths" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + } +] + +output [ + { + name: "logits" + data_type: TYPE_FP32 + dims: [-1, 8404] + }, + { + name: "token_num" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + } +] + +dynamic_batching { + preferred_batch_size: [ 2,4,8,16,32,64 ] + max_queue_delay_microseconds: 500 + } + + +instance_group [ + { + count: 1 + kind: KIND_GPU + } +] + diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py b/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py new file mode 100644 index 0000000..e6eb3b9 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py @@ -0,0 +1,314 @@ +#!/bin/bash +# +# Copyright (c) 2023, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import math +import triton_python_backend_utils as pb_utils +from torch.utils.dlpack import to_dlpack +import torch +import numpy as np +import kaldifeat +import _kaldifeat +from typing import List +import json +import yaml +from typing import Any, Dict, Iterable, List, NamedTuple, Set, Tuple, Union + + +class LFR(torch.nn.Module): + """Batch LFR: https://github.com/Mddct/devil-asr/blob/main/patch/lfr.py""" + + def __init__(self, m: int = 7, n: int = 6) -> None: + """ + Actually, this implements stacking frames and skipping frames. + if m = 1 and n = 1, just return the origin features. + if m = 1 and n > 1, it works like skipping. + if m > 1 and n = 1, it works like stacking but only support right frames. + if m > 1 and n > 1, it works like LFR. + """ + super().__init__() + + self.m = m + self.n = n + + self.left_padding_nums = math.ceil((self.m - 1) // 2) + + def forward( + self, input_tensor: torch.Tensor, input_lens: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + B, _, D = input_tensor.size() + n_lfr = torch.ceil(input_lens / self.n) + + prepad_nums = input_lens + self.left_padding_nums + + right_padding_nums = torch.where( + self.m >= (prepad_nums - self.n * (n_lfr - 1)), + self.m - (prepad_nums - self.n * (n_lfr - 1)), + 0, + ) + + T_all = self.left_padding_nums + input_lens + right_padding_nums + + new_len = T_all // self.n + + T_all_max = T_all.max().int() + + tail_frames_index = (input_lens - 1).view(B, 1, 1).repeat(1, 1, D) # [B,1,D] + + tail_frames = torch.gather(input_tensor, 1, tail_frames_index) + tail_frames = tail_frames.repeat(1, right_padding_nums.max().int(), 1) + head_frames = input_tensor[:, 0:1, :].repeat(1, self.left_padding_nums, 1) + + # stack + input_tensor = torch.cat([head_frames, input_tensor, tail_frames], dim=1) + + index = ( + torch.arange(T_all_max, device=input_tensor.device, dtype=input_lens.dtype) + .unsqueeze(0) + .repeat(B, 1) + ) # [B, T_all_max] + index_mask = index < (self.left_padding_nums + input_lens).unsqueeze(1) # [B, T_all_max] + + tail_index_mask = torch.logical_not(index >= (T_all.unsqueeze(1))) & index_mask + tail = torch.ones(T_all_max, dtype=input_lens.dtype, device=input_tensor.device).unsqueeze( + 0 + ).repeat(B, 1) * ( + T_all_max - 1 + ) # [B, T_all_max] + indices = torch.where(torch.logical_or(index_mask, tail_index_mask), index, tail) + input_tensor = torch.gather(input_tensor, 1, indices.unsqueeze(2).repeat(1, 1, D)) + + input_tensor = input_tensor.unfold(1, self.m, step=self.n).transpose(2, 3) + + return input_tensor.reshape(B, -1, D * self.m), new_len + + +class WavFrontend: + """Conventional frontend structure for ASR.""" + + def __init__( + self, + cmvn_file: str = None, + fs: int = 16000, + window: str = "hamming", + n_mels: int = 80, + frame_length: int = 25, + frame_shift: int = 10, + filter_length_min: int = -1, + filter_length_max: float = -1, + lfr_m: int = 7, + lfr_n: int = 6, + dither: float = 1.0, + ) -> None: + + self.fs = fs + self.window = window + self.n_mels = n_mels + self.frame_length = frame_length + self.frame_shift = frame_shift + self.filter_length_min = filter_length_min + self.filter_length_max = filter_length_max + self.lfr_m = lfr_m + self.lfr_n = lfr_n + self.lfr = LFR(lfr_m, lfr_n) + self.cmvn_file = cmvn_file + self.dither = dither + + if self.cmvn_file: + self.cmvn = self.load_cmvn() + + def apply_cmvn_batch(self, inputs: np.ndarray) -> np.ndarray: + """ + Apply CMVN with mvn data + """ + batch, frame, dim = inputs.shape + means = np.tile(self.cmvn[0:1, :dim], (frame, 1)) + vars = np.tile(self.cmvn[1:2, :dim], (frame, 1)) + + means = torch.from_numpy(means).to(inputs.device) + vars = torch.from_numpy(vars).to(inputs.device) + # print(inputs.shape, means.shape, vars.shape) + inputs = (inputs + means) * vars + return inputs + + def load_cmvn( + self, + ) -> np.ndarray: + with open(self.cmvn_file, "r", encoding="utf-8") as f: + lines = f.readlines() + + means_list = [] + vars_list = [] + for i in range(len(lines)): + line_item = lines[i].split() + if line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + add_shift_line = line_item[3 : (len(line_item) - 1)] + means_list = list(add_shift_line) + continue + elif line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + rescale_line = line_item[3 : (len(line_item) - 1)] + vars_list = list(rescale_line) + continue + + means = np.array(means_list).astype(np.float64) + vars = np.array(vars_list).astype(np.float64) + cmvn = np.array([means, vars]) + return cmvn + + +class Fbank(torch.nn.Module): + def __init__(self, opts): + super(Fbank, self).__init__() + self.fbank = kaldifeat.Fbank(opts) + + def forward(self, waves: List[torch.Tensor]): + return self.fbank(waves) + + +class TritonPythonModel: + """Your Python model must use the same class name. Every Python model + that is created must have "TritonPythonModel" as the class name. + """ + + def initialize(self, args): + """`initialize` is called only once when the model is being loaded. + Implementing `initialize` function is optional. This function allows + the model to initialize any state associated with this model. + + Parameters + ---------- + args : dict + Both keys and values are strings. The dictionary keys and values are: + * model_config: A JSON string containing the model configuration + * model_instance_kind: A string containing model instance kind + * model_instance_device_id: A string containing model instance device ID + * model_repository: Model repository path + * model_version: Model version + * model_name: Model name + """ + self.model_config = model_config = json.loads(args["model_config"]) + self.max_batch_size = max(model_config["max_batch_size"], 1) + self.device = "cuda" + + # Get OUTPUT0 configuration + output0_config = pb_utils.get_output_config_by_name(model_config, "speech") + # Convert Triton types to numpy types + output0_dtype = pb_utils.triton_string_to_numpy(output0_config["data_type"]) + + if output0_dtype == np.float32: + self.output0_dtype = torch.float32 + else: + self.output0_dtype = torch.float16 + + # Get OUTPUT1 configuration + output1_config = pb_utils.get_output_config_by_name(model_config, "speech_lengths") + # Convert Triton types to numpy types + self.output1_dtype = pb_utils.triton_string_to_numpy(output1_config["data_type"]) + + params = self.model_config["parameters"] + + for li in params.items(): + key, value = li + value = value["string_value"] + if key == "config_path": + with open(str(value), "rb") as f: + config = yaml.load(f, Loader=yaml.Loader) + if key == "cmvn_path": + cmvn_path = str(value) + + opts = kaldifeat.FbankOptions() + opts.frame_opts.dither = 1.0 # TODO: 0.0 or 1.0 + opts.frame_opts.window_type = config["frontend_conf"]["window"] + opts.mel_opts.num_bins = int(config["frontend_conf"]["n_mels"]) + opts.frame_opts.frame_shift_ms = float(config["frontend_conf"]["frame_shift"]) + opts.frame_opts.frame_length_ms = float(config["frontend_conf"]["frame_length"]) + opts.frame_opts.samp_freq = int(config["frontend_conf"]["fs"]) + opts.device = torch.device(self.device) + self.opts = opts + self.feature_extractor = Fbank(self.opts) + self.feature_size = opts.mel_opts.num_bins + + self.frontend = WavFrontend(cmvn_file=cmvn_path, **config["frontend_conf"]) + + def extract_feat(self, waveform_list: List[np.ndarray]) -> Tuple[np.ndarray, np.ndarray]: + feats, feats_len = [], [] + wavs = [] + for waveform in waveform_list: + wav = torch.from_numpy(waveform).float().squeeze().to(self.device) + wavs.append(wav) + + features = self.feature_extractor(wavs) + features_len = [feature.shape[0] for feature in features] + speech = torch.zeros( + (len(features), max(features_len), self.opts.mel_opts.num_bins), + dtype=self.output0_dtype, + device=self.device, + ) + for i, feature in enumerate(features): + speech[i, : int(features_len[i])] = feature + speech_lens = torch.tensor(features_len, dtype=torch.int64).to(self.device) + + feats, feats_len = self.frontend.lfr(speech, speech_lens) + feats_len = feats_len.type(torch.int32) + + feats = self.frontend.apply_cmvn_batch(feats) + feats = feats.type(self.output0_dtype) + + return feats, feats_len + + def execute(self, requests): + """`execute` must be implemented in every Python model. `execute` + function receives a list of pb_utils.InferenceRequest as the only + argument. This function is called when an inference is requested + for this model. + + Parameters + ---------- + requests : list + A list of pb_utils.InferenceRequest + + Returns + ------- + list + A list of pb_utils.InferenceResponse. The length of this list must + be the same as `requests` + """ + batch_count = [] + total_waves = [] + batch_len = [] + responses = [] + for request in requests: + + input0 = pb_utils.get_input_tensor_by_name(request, "wav") + input1 = pb_utils.get_input_tensor_by_name(request, "wav_lens") + + cur_b_wav = input0.as_numpy() * (1 << 15) # b x -1 + total_waves.append(cur_b_wav) + + features, feats_len = self.extract_feat(total_waves) + + for i in range(features.shape[0]): + speech = features[i : i + 1][: int(feats_len[i].cpu())] + speech_lengths = feats_len[i].unsqueeze(0).unsqueeze(0) + + speech, speech_lengths = speech.cpu(), speech_lengths.cpu() + out0 = pb_utils.Tensor.from_dlpack("speech", to_dlpack(speech)) + out1 = pb_utils.Tensor.from_dlpack("speech_lengths", to_dlpack(speech_lengths)) + inference_response = pb_utils.InferenceResponse(output_tensors=[out0, out1]) + responses.append(inference_response) + return responses diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/config.pbtxt new file mode 100644 index 0000000..44bfcd4 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/config.pbtxt @@ -0,0 +1,81 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "feature_extractor" +backend: "python" +max_batch_size: 64 + +parameters [ + { + key: "num_mel_bins", + value: { string_value: "80"} + }, + { + key: "frame_shift_in_ms" + value: { string_value: "10"} + }, + { + key: "frame_length_in_ms" + value: { string_value: "25"} + }, + { + key: "sample_rate" + value: { string_value: "16000"} + }, + { + key: "cmvn_path" + value: { string_value: "./model_repo_paraformer_large_offline/feature_extractor/am.mvn"} + }, + { + key: "config_path" + value: { string_value: "./model_repo_paraformer_large_offline/feature_extractor/config.yaml"} + } + +] + +input [ + { + name: "wav" + data_type: TYPE_FP32 + dims: [-1] + }, + { + name: "wav_lens" + data_type: TYPE_INT32 + dims: [1] + } +] + +output [ + { + name: "speech" + data_type: TYPE_FP32 + dims: [-1, 560] # 80 + }, + { + name: "speech_lengths" + data_type: TYPE_INT32 + dims: [1] + } +] + +dynamic_batching { + } + +instance_group [ + { + count: 2 + kind: KIND_GPU + } +] diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/infer_pipeline/1/.gitkeep b/runtime/triton_gpu/model_repo_paraformer_large_offline/infer_pipeline/1/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/infer_pipeline/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_offline/infer_pipeline/config.pbtxt new file mode 100644 index 0000000..1a9c266 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_offline/infer_pipeline/config.pbtxt @@ -0,0 +1,99 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "infer_pipeline" +platform: "ensemble" +max_batch_size: 64 #MAX_BATCH + +input [ + { + name: "WAV" + data_type: TYPE_FP32 + dims: [-1] + }, + { + name: "WAV_LENS" + data_type: TYPE_INT32 + dims: [1] + } +] + +output [ + { + name: "TRANSCRIPTS" + data_type: TYPE_STRING + dims: [1] + } +] + +ensemble_scheduling { + step [ + { + model_name: "feature_extractor" + model_version: -1 + input_map { + key: "wav" + value: "WAV" + } + input_map { + key: "wav_lens" + value: "WAV_LENS" + } + output_map { + key: "speech" + value: "SPEECH" + } + output_map { + key: "speech_lengths" + value: "SPEECH_LENGTHS" + } + }, + { + model_name: "encoder" + model_version: -1 + input_map { + key: "speech" + value: "SPEECH" + } + input_map { + key: "speech_lengths" + value: "SPEECH_LENGTHS" + } + output_map { + key: "logits" + value: "logits" + } + output_map { + key: "token_num" + value: "token_num" + } + }, + { + model_name: "scoring" + model_version: -1 + input_map { + key: "logits" + value: "logits" + } + input_map { + key: "token_num" + value: "token_num" + } + output_map { + key: "OUTPUT0" + value: "TRANSCRIPTS" + } + } + ] +} diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/scoring/1/model.py b/runtime/triton_gpu/model_repo_paraformer_large_offline/scoring/1/model.py new file mode 100644 index 0000000..d582e50 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_offline/scoring/1/model.py @@ -0,0 +1,157 @@ +#!/bin/bash +# +# Copyright (c) 2023, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import triton_python_backend_utils as pb_utils +import numpy as np +import torch +from torch.utils.dlpack import from_dlpack + +import json +import os +import yaml + + +class TritonPythonModel: + """Your Python model must use the same class name. Every Python model + that is created must have "TritonPythonModel" as the class name. + """ + + def initialize(self, args): + """`initialize` is called only once when the model is being loaded. + Implementing `initialize` function is optional. This function allows + the model to initialize any state associated with this model. + + Parameters + ---------- + args : dict + Both keys and values are strings. The dictionary keys and values are: + * model_config: A JSON string containing the model configuration + * model_instance_kind: A string containing model instance kind + * model_instance_device_id: A string containing model instance device ID + * model_repository: Model repository path + * model_version: Model version + * model_name: Model name + """ + self.model_config = model_config = json.loads(args["model_config"]) + self.max_batch_size = max(model_config["max_batch_size"], 1) + + # # Get OUTPUT0 configuration + output0_config = pb_utils.get_output_config_by_name(model_config, "OUTPUT0") + # # Convert Triton types to numpy types + self.out0_dtype = pb_utils.triton_string_to_numpy(output0_config["data_type"]) + + self.init_vocab(self.model_config["parameters"]) + + def init_vocab(self, parameters): + blank_id = 0 + for li in parameters.items(): + key, value = li + value = value["string_value"] + if key == "blank_id": + self.blank_id = int(value) + elif key == "lm_path": + lm_path = value + elif key == "vocabulary": + self.vocab_dict = self.load_vocab(value) + if key == "ignore_id": + ignore_id = int(value) + + def load_vocab(self, vocab_file): + """ + load lang_char.txt + """ + with open(str(vocab_file), "rb") as f: + config = yaml.load(f, Loader=yaml.Loader) + return config["token_list"] + + def execute(self, requests): + """`execute` must be implemented in every Python model. `execute` + function receives a list of pb_utils.InferenceRequest as the only + argument. This function is called when an inference is requested + for this model. + + Parameters + ---------- + requests : list + A list of pb_utils.InferenceRequest + + Returns + ------- + list + A list of pb_utils.InferenceResponse. The length of this list must + be the same as `requests` + """ + # Every Python backend must iterate through list of requests and create + # an instance of pb_utils.InferenceResponse class for each of them. You + # should avoid storing any of the input Tensors in the class attributes + # as they will be overridden in subsequent inference requests. You can + # make a copy of the underlying NumPy array and store it if it is + # required. + + total_seq, max_token_num = 0, 0 + assert len(self.vocab_dict) == 8404, len(self.vocab_dict) + logits_list, token_num_list = [], [] + + for request in requests: + # Perform inference on the request and append it to responses list... + in_0 = pb_utils.get_input_tensor_by_name(request, "logits") + in_1 = pb_utils.get_input_tensor_by_name(request, "token_num") + + logits, token_num = from_dlpack(in_0.to_dlpack()), from_dlpack(in_1.to_dlpack()).cpu() + max_token_num = max(max_token_num, token_num) + + assert logits.shape[0] == 1 + logits_list.append(logits) + token_num_list.append(token_num) + total_seq += 1 + + logits_batch = torch.zeros( + len(logits_list), + max_token_num, + len(self.vocab_dict), + dtype=torch.float32, + device=logits.device, + ) + token_num_batch = torch.zeros(len(logits_list)) + + for i, (logits, token_num) in enumerate(zip(logits_list, token_num_list)): + logits_batch[i][: int(token_num)] = logits[0][: int(token_num)] + token_num_batch[i] = token_num + + yseq_batch = logits_batch.argmax(axis=-1).tolist() + token_int_batch = [list(filter(lambda x: x not in (0, 2), yseq)) for yseq in yseq_batch] + + tokens_batch = [[self.vocab_dict[i] for i in token_int] for token_int in token_int_batch] + + hyps = [ + "".join([t if t != "" else " " for t in tokens]).encode("utf-8") + for tokens in tokens_batch + ] + responses = [] + for i in range(total_seq): + sents = np.array(hyps[i : i + 1]) + out0 = pb_utils.Tensor("OUTPUT0", sents.astype(self.out0_dtype)) + inference_response = pb_utils.InferenceResponse(output_tensors=[out0]) + responses.append(inference_response) + + return responses + + def finalize(self): + """`finalize` is called only once when the model is being unloaded. + Implementing `finalize` function is optional. This function allows + the model to perform any necessary clean ups before exit. + """ + print("Cleaning up...") diff --git a/runtime/triton_gpu/model_repo_paraformer_large_offline/scoring/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_offline/scoring/config.pbtxt new file mode 100644 index 0000000..85082f4 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_offline/scoring/config.pbtxt @@ -0,0 +1,67 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "scoring" +backend: "python" +max_batch_size: 64 + +parameters [ + { + key: "ignore_id", + value: { string_value: "-1"} + }, + { + key: "vocabulary", + value: { string_value: "./model_repo_paraformer_large_offline/feature_extractor/config.yaml"} + }, + { + key: "lm_path" + value: { string_value: "#lm_path"} + }, + { key: "FORCE_CPU_ONLY_INPUT_TENSORS" + value: {string_value:"no"} + } +] + + +input [ + { + name: "logits" + data_type: TYPE_FP32 + dims: [-1, 8404] + }, + { + name: "token_num" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + } +] + +output [ + { + name: "OUTPUT0" + data_type: TYPE_STRING + dims: [1] + } +] + +dynamic_batching { + } +instance_group [ + { + count: 2 + kind: KIND_CPU + } + ] diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/cif_search/1/model.py b/runtime/triton_gpu/model_repo_paraformer_large_online/cif_search/1/model.py new file mode 100644 index 0000000..aeecd33 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/cif_search/1/model.py @@ -0,0 +1,273 @@ +# Created on 2024-01-01 +# Author: GuAn Zhu + +import triton_python_backend_utils as pb_utils +import numpy as np +from torch.utils.dlpack import from_dlpack +import json +import yaml +import asyncio +from collections import OrderedDict + + +class LimitedDict(OrderedDict): + def __init__(self, max_length): + super().__init__() + self.max_length = max_length + + def __setitem__(self, key, value): + if len(self) >= self.max_length: + self.popitem(last=False) + super().__setitem__(key, value) + + +class CIFSearch: + """CIFSearch: https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/python/onnxruntime/funasr_onnx + /paraformer_online_bin.py""" + + def __init__(self): + self.cache = { + "cif_hidden": np.zeros((1, 1, 512)).astype(np.float32), + "cif_alphas": np.zeros((1, 1)).astype(np.float32), + "last_chunk": False, + } + self.chunk_size = [5, 10, 5] + self.tail_threshold = 0.45 + self.cif_threshold = 1.0 + + def infer(self, hidden, alphas): + batch_size, len_time, hidden_size = hidden.shape + token_length = [] + list_fires = [] + list_frames = [] + cache_alphas = [] + cache_hiddens = [] + alphas[:, : self.chunk_size[0]] = 0.0 + alphas[:, sum(self.chunk_size[:2]) :] = 0.0 + + if self.cache is not None and "cif_alphas" in self.cache and "cif_hidden" in self.cache: + hidden = np.concatenate((self.cache["cif_hidden"], hidden), axis=1) + alphas = np.concatenate((self.cache["cif_alphas"], alphas), axis=1) + if self.cache is not None and "last_chunk" in self.cache and self.cache["last_chunk"]: + tail_hidden = np.zeros((batch_size, 1, hidden_size)).astype(np.float32) + tail_alphas = np.array([[self.tail_threshold]]).astype(np.float32) + tail_alphas = np.tile(tail_alphas, (batch_size, 1)) + hidden = np.concatenate((hidden, tail_hidden), axis=1) + alphas = np.concatenate((alphas, tail_alphas), axis=1) + + len_time = alphas.shape[1] + for b in range(batch_size): + integrate = 0.0 + frames = np.zeros(hidden_size).astype(np.float32) + list_frame = [] + list_fire = [] + for t in range(len_time): + alpha = alphas[b][t] + if alpha + integrate < self.cif_threshold: + integrate += alpha + list_fire.append(integrate) + frames += alpha * hidden[b][t] + else: + frames += (self.cif_threshold - integrate) * hidden[b][t] + list_frame.append(frames) + integrate += alpha + list_fire.append(integrate) + integrate -= self.cif_threshold + frames = integrate * hidden[b][t] + + cache_alphas.append(integrate) + if integrate > 0.0: + cache_hiddens.append(frames / integrate) + else: + cache_hiddens.append(frames) + + token_length.append(len(list_frame)) + list_fires.append(list_fire) + list_frames.append(list_frame) + + max_token_len = max(token_length) + list_ls = [] + for b in range(batch_size): + pad_frames = np.zeros((max_token_len - token_length[b], hidden_size)).astype(np.float32) + if token_length[b] == 0: + list_ls.append(pad_frames) + else: + list_ls.append(np.concatenate((list_frames[b], pad_frames), axis=0)) + + self.cache["cif_alphas"] = np.stack(cache_alphas, axis=0) + self.cache["cif_alphas"] = np.expand_dims(self.cache["cif_alphas"], axis=0) + self.cache["cif_hidden"] = np.stack(cache_hiddens, axis=0) + self.cache["cif_hidden"] = np.expand_dims(self.cache["cif_hidden"], axis=0) + + return np.stack(list_ls, axis=0).astype(np.float32), np.stack(token_length, axis=0).astype( + np.int32 + ) + + +class TritonPythonModel: + """Your Python model must use the same class name. Every Python model + that is created must have "TritonPythonModel" as the class name. + """ + + def initialize(self, args): + """`initialize` is called only once when the model is being loaded. + Implementing `initialize` function is optional. This function allows + the model to initialize any state associated with this model. + + Parameters + ---------- + args : dict + Both keys and values are strings. The dictionary keys and values are: + * model_config: A JSON string containing the model configuration + * model_instance_kind: A string containing model instance kind + * model_instance_device_id: A string containing model instance device ID + * model_repository: Model repository path + * model_version: Model version + * model_name: Model name + """ + self.model_config = model_config = json.loads(args["model_config"]) + self.max_batch_size = max(model_config["max_batch_size"], 1) + + # # Get OUTPUT0 configuration + output0_config = pb_utils.get_output_config_by_name(model_config, "transcripts") + # # Convert Triton types to numpy types + self.out0_dtype = pb_utils.triton_string_to_numpy(output0_config["data_type"]) + + self.init_vocab(self.model_config["parameters"]) + + self.cif_search_cache = LimitedDict(1024) + self.start = LimitedDict(1024) + + def init_vocab(self, parameters): + for li in parameters.items(): + key, value = li + value = value["string_value"] + if key == "vocabulary": + self.vocab_dict = self.load_vocab(value) + + def load_vocab(self, vocab_file): + with open(str(vocab_file), "rb") as f: + config = yaml.load(f, Loader=yaml.Loader) + return config["token_list"] + + async def execute(self, requests): + """`execute` must be implemented in every Python model. `execute` + function receives a list of pb_utils.InferenceRequest as the only + argument. This function is called when an inference is requested + for this model. + + Parameters + ---------- + requests : list + A list of pb_utils.InferenceRequest + + Returns + ------- + list + A list of pb_utils.InferenceResponse. The length of this list must + be the same as `requests` + """ + # Every Python backend must iterate through list of requests and create + # an instance of pb_utils.InferenceResponse class for each of them. You + # should avoid storing any of the input Tensors in the class attributes + # as they will be overridden in subsequent inference requests. You can + # make a copy of the underlying NumPy array and store it if it is + # required. + + batch_end = [] + responses = [] + batch_corrid = [] + qualified_corrid = [] + batch_result = {} + inference_response_awaits = [] + + for request in requests: + hidden = pb_utils.get_input_tensor_by_name(request, "enc") + hidden = from_dlpack(hidden.to_dlpack()).cpu().numpy() + alphas = pb_utils.get_input_tensor_by_name(request, "alphas") + alphas = from_dlpack(alphas.to_dlpack()).cpu().numpy() + hidden_len = pb_utils.get_input_tensor_by_name(request, "enc_len") + hidden_len = from_dlpack(hidden_len.to_dlpack()).cpu().numpy() + + in_start = pb_utils.get_input_tensor_by_name(request, "START") + start = in_start.as_numpy()[0][0] + + in_corrid = pb_utils.get_input_tensor_by_name(request, "CORRID") + corrid = in_corrid.as_numpy()[0][0] + + in_end = pb_utils.get_input_tensor_by_name(request, "END") + end = in_end.as_numpy()[0][0] + + batch_end.append(end) + batch_corrid.append(corrid) + + if start: + self.cif_search_cache[corrid] = CIFSearch() + self.start[corrid] = 1 + if end: + self.cif_search_cache[corrid].cache["last_chunk"] = True + + acoustic, acoustic_len = self.cif_search_cache[corrid].infer(hidden, alphas) + batch_result[corrid] = "" + if acoustic.shape[1] == 0: + continue + else: + qualified_corrid.append(corrid) + input_tensor0 = pb_utils.Tensor("enc", hidden) + input_tensor1 = pb_utils.Tensor("enc_len", np.array([hidden_len], dtype=np.int32)) + input_tensor2 = pb_utils.Tensor("acoustic_embeds", acoustic) + input_tensor3 = pb_utils.Tensor( + "acoustic_embeds_len", np.array([acoustic_len], dtype=np.int32) + ) + input_tensors = [input_tensor0, input_tensor1, input_tensor2, input_tensor3] + + if self.start[corrid] and end: + flag = 3 + elif end: + flag = 2 + elif self.start[corrid]: + flag = 1 + self.start[corrid] = 0 + else: + flag = 0 + inference_request = pb_utils.InferenceRequest( + model_name="decoder", + requested_output_names=["sample_ids"], + inputs=input_tensors, + request_id="", + correlation_id=corrid, + flags=flag, + ) + inference_response_awaits.append(inference_request.async_exec()) + + inference_responses = await asyncio.gather(*inference_response_awaits) + + for index_corrid, inference_response in zip(qualified_corrid, inference_responses): + if inference_response.has_error(): + raise pb_utils.TritonModelException(inference_response.error().message()) + else: + sample_ids = pb_utils.get_output_tensor_by_name(inference_response, "sample_ids") + token_ids = from_dlpack(sample_ids.to_dlpack()).cpu().numpy()[0] + + # Change integer-ids to tokens + tokens = [self.vocab_dict[token_id] for token_id in token_ids] + batch_result[index_corrid] = "".join(tokens) + + for i, index_corrid in enumerate(batch_corrid): + sent = np.array([batch_result[index_corrid]]) + out0 = pb_utils.Tensor("transcripts", sent.astype(self.out0_dtype)) + inference_response = pb_utils.InferenceResponse(output_tensors=[out0]) + responses.append(inference_response) + + if batch_end[i]: + del self.cif_search_cache[index_corrid] + del self.start[index_corrid] + + return responses + + def finalize(self): + """`finalize` is called only once when the model is being unloaded. + Implementing `finalize` function is optional. This function allows + the model to perform any necessary clean ups before exit. + """ + print("Cleaning up...") diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/cif_search/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_online/cif_search/config.pbtxt new file mode 100644 index 0000000..bf60588 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/cif_search/config.pbtxt @@ -0,0 +1,111 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Created on 2024-01-01 +# Author: GuAn Zhu + +name: "cif_search" +backend: "python" +max_batch_size: 128 + +sequence_batching{ + max_sequence_idle_microseconds: 15000000 + oldest { + max_candidate_sequences: 1024 + preferred_batch_size: [32, 64, 128] + } + control_input [ + { + name: "START", + control [ + { + kind: CONTROL_SEQUENCE_START + fp32_false_true: [0, 1] + } + ] + }, + { + name: "READY" + control [ + { + kind: CONTROL_SEQUENCE_READY + fp32_false_true: [0, 1] + } + ] + }, + { + name: "CORRID", + control [ + { + kind: CONTROL_SEQUENCE_CORRID + data_type: TYPE_UINT64 + } + ] + }, + { + name: "END", + control [ + { + kind: CONTROL_SEQUENCE_END + fp32_false_true: [0, 1] + } + ] + } + ] +} + + +parameters [ + { + key: "vocabulary", + value: { string_value: "model_repo_paraformer_large_online/feature_extractor/config.yaml"} + }, + { key: "FORCE_CPU_ONLY_INPUT_TENSORS" + value: {string_value:"no"} + } +] + +input [ + { + name: "enc" + data_type: TYPE_FP32 + dims: [-1, 512] + }, + { + name: "enc_len" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + }, + { + name: 'alphas' + data_type: TYPE_FP32 + dims: [-1] + } +] + +output [ + { + name: "transcripts" + data_type: TYPE_STRING + dims: [1] + } +] + +instance_group [ + { + count: 6 + kind: KIND_CPU + } + ] diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/decoder/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_online/decoder/config.pbtxt new file mode 100644 index 0000000..9efc8bd --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/decoder/config.pbtxt @@ -0,0 +1,274 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Created on 2024-01-01 +# Author: GuAn Zhu + +name: "decoder" +backend: "onnxruntime" +default_model_filename: "decoder.onnx" + +max_batch_size: 128 + +sequence_batching{ + max_sequence_idle_microseconds: 15000000 + oldest { + max_candidate_sequences: 1024 + preferred_batch_size: [16, 32, 64] + } + control_input [ + ] + state [ + { + input_name: "in_cache_0" + output_name: "out_cache_0" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_1" + output_name: "out_cache_1" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_2" + output_name: "out_cache_2" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_3" + output_name: "out_cache_3" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_4" + output_name: "out_cache_4" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_5" + output_name: "out_cache_5" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_6" + output_name: "out_cache_6" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_7" + output_name: "out_cache_7" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_8" + output_name: "out_cache_8" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_9" + output_name: "out_cache_9" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_10" + output_name: "out_cache_10" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_11" + output_name: "out_cache_11" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_12" + output_name: "out_cache_12" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_13" + output_name: "out_cache_13" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_14" + output_name: "out_cache_14" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + }, + { + input_name: "in_cache_15" + output_name: "out_cache_15" + data_type: TYPE_FP32 + dims: [ 512, 10 ] + initial_state: { + data_type: TYPE_FP32 + dims: [ 512, 10] + zero_data: true + name: "initial state" + } + } + ] +} + + +input [ + { + name: "enc" + data_type: TYPE_FP32 + dims: [-1, 512] + }, + { + name: "enc_len" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + }, + { + name: "acoustic_embeds" + data_type: TYPE_FP32 + dims: [-1, 512] + }, + { + name: "acoustic_embeds_len" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + } +] + +output [ + { + name: "logits" + data_type: TYPE_FP32 + dims: [-1, 8404] + }, + { + name: "sample_ids" + data_type: TYPE_INT64 + dims: [-1] + } +] + + +instance_group [ + { + count: 1 + kind: KIND_GPU + } +] + diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/encoder/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_online/encoder/config.pbtxt new file mode 100644 index 0000000..3e54df1 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/encoder/config.pbtxt @@ -0,0 +1,77 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Created on 2024-01-01 +# Author: GuAn Zhu + +name: "encoder" +backend: "onnxruntime" +default_model_filename: "model.onnx" + +max_batch_size: 128 + + +sequence_batching{ + max_sequence_idle_microseconds: 15000000 + oldest { + max_candidate_sequences: 1024 + preferred_batch_size: [32, 64, 128] + max_queue_delay_microseconds: 300 + } + control_input [ + ] + state [ + ] +} + + +input [ + { + name: "speech" + data_type: TYPE_FP32 + dims: [-1, 560] + }, + { + name: "speech_lengths" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + } +] + +output [ + { + name: "enc" + data_type: TYPE_FP32 + dims: [-1, 512] + }, + { + name: "enc_len" + data_type: TYPE_INT32 + dims: [1] + reshape: { shape: [ ] } + }, + { + name: "alphas" + data_type: TYPE_FP32 + dims: [-1] + } +] + +instance_group [ + { + count: 1 + kind: KIND_GPU + } +] diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/1/model.py b/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/1/model.py new file mode 100644 index 0000000..716a075 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/1/model.py @@ -0,0 +1,216 @@ +# Created on 2024-01-01 +# Author: GuAn Zhu + +# Modified from NVIDIA(https://github.com/wenet-e2e/wenet/blob/main/runtime/gpu/ +# model_repo_stateful/feature_extractor/1/model.py) + +import triton_python_backend_utils as pb_utils +from torch.utils.dlpack import from_dlpack +import torch +import kaldifeat +from typing import List +import json +import numpy as np +import yaml +from collections import OrderedDict + + +class LimitedDict(OrderedDict): + def __init__(self, max_length): + super().__init__() + self.max_length = max_length + + def __setitem__(self, key, value): + if len(self) >= self.max_length: + self.popitem(last=False) + super().__setitem__(key, value) + + +class Fbank(torch.nn.Module): + def __init__(self, opts): + super(Fbank, self).__init__() + self.fbank = kaldifeat.Fbank(opts) + + def forward(self, waves: List[torch.Tensor]): + return self.fbank(waves) + + +class Feat(object): + def __init__(self, seqid, offset_ms, sample_rate, frame_stride, device="cpu"): + self.seqid = seqid + self.sample_rate = sample_rate + self.wav = torch.tensor([], device=device) + self.offset = int(offset_ms / 1000 * sample_rate) + self.frames = None + self.frame_stride = int(frame_stride) + self.device = device + self.lfr_m = 7 + + def add_wavs(self, wav: torch.tensor): + wav = wav.to(self.device) + self.wav = torch.cat((self.wav, wav), axis=0) + + def get_seg_wav(self): + seg = self.wav[:] + self.wav = self.wav[-self.offset :] + return seg + + def add_frames(self, frames: torch.tensor): + """ + frames: seq_len x feat_sz + """ + if self.frames is None: + self.frames = torch.cat((frames[0, :].repeat((self.lfr_m - 1) // 2, 1), frames), axis=0) + else: + self.frames = torch.cat([self.frames, frames], axis=0) + + def get_frames(self, num_frames: int): + seg = self.frames[0:num_frames] + self.frames = self.frames[self.frame_stride :] + return seg + + +class TritonPythonModel: + """Your Python model must use the same class name. Every Python model + that is created must have "TritonPythonModel" as the class name. + """ + + def initialize(self, args): + """`initialize` is called only once when the model is being loaded. + Implementing `initialize` function is optional. This function allows + the model to initialize any state associated with this model. + Parameters + ---------- + args : dict + Both keys and values are strings. The dictionary keys and values are: + * model_config: A JSON string containing the model configuration + * model_instance_kind: A string containing model instance kind + * model_instance_device_id: A string containing model instance device ID + * model_repository: Model repository path + * model_version: Model version + * model_name: Model name + """ + self.model_config = model_config = json.loads(args["model_config"]) + self.max_batch_size = max(model_config["max_batch_size"], 1) + + if "GPU" in model_config["instance_group"][0]["kind"]: + self.device = "cuda" + else: + self.device = "cpu" + + # Get OUTPUT0 configuration + output0_config = pb_utils.get_output_config_by_name(model_config, "speech") + # Convert Triton types to numpy types + self.output0_dtype = pb_utils.triton_string_to_numpy(output0_config["data_type"]) + + if self.output0_dtype == np.float32: + self.dtype = torch.float32 + else: + self.dtype = torch.float16 + + self.feature_size = output0_config["dims"][-1] + self.decoding_window = output0_config["dims"][-2] + + params = self.model_config["parameters"] + for li in params.items(): + key, value = li + value = value["string_value"] + if key == "config_path": + with open(str(value), "rb") as f: + config = yaml.load(f, Loader=yaml.Loader) + + opts = kaldifeat.FbankOptions() + opts.frame_opts.dither = 0.0 + opts.frame_opts.window_type = config["frontend_conf"]["window"] + opts.mel_opts.num_bins = int(config["frontend_conf"]["n_mels"]) + opts.frame_opts.frame_shift_ms = float(config["frontend_conf"]["frame_shift"]) + opts.frame_opts.frame_length_ms = float(config["frontend_conf"]["frame_length"]) + opts.frame_opts.samp_freq = int(config["frontend_conf"]["fs"]) + opts.device = torch.device(self.device) + self.opts = opts + self.feature_extractor = Fbank(self.opts) + + self.seq_feat = LimitedDict(1024) + chunk_size_s = float(params["chunk_size_s"]["string_value"]) + + sample_rate = opts.frame_opts.samp_freq + frame_shift_ms = opts.frame_opts.frame_shift_ms + frame_length_ms = opts.frame_opts.frame_length_ms + + self.chunk_size = int(chunk_size_s * sample_rate) + self.frame_stride = (chunk_size_s * 1000) // frame_shift_ms + self.offset_ms = self.get_offset(frame_length_ms, frame_shift_ms) + self.sample_rate = sample_rate + + def get_offset(self, frame_length_ms, frame_shift_ms): + offset_ms = 0 + while offset_ms + frame_shift_ms < frame_length_ms: + offset_ms += frame_shift_ms + return offset_ms + + def execute(self, requests): + """`execute` must be implemented in every Python model. `execute` + function receives a list of pb_utils.InferenceRequest as the only + argument. This function is called when an inference is requested + for this model. + Parameters + ---------- + requests : list + A list of pb_utils.InferenceRequest + Returns + ------- + list + A list of pb_utils.InferenceResponse. The length of this list must + be the same as `requests` + """ + total_waves = [] + responses = [] + batch_seqid = [] + end_seqid = {} + for request in requests: + input0 = pb_utils.get_input_tensor_by_name(request, "wav") + wav = from_dlpack(input0.to_dlpack())[0] + # input1 = pb_utils.get_input_tensor_by_name(request, "wav_lens") + # wav_len = from_dlpack(input1.to_dlpack())[0] + wav_len = len(wav) + if wav_len < self.chunk_size: + temp = torch.zeros(self.chunk_size, dtype=torch.float32, device=self.device) + temp[0:wav_len] = wav[:] + wav = temp + + in_start = pb_utils.get_input_tensor_by_name(request, "START") + start = in_start.as_numpy()[0][0] + in_ready = pb_utils.get_input_tensor_by_name(request, "READY") + ready = in_ready.as_numpy()[0][0] + in_corrid = pb_utils.get_input_tensor_by_name(request, "CORRID") + corrid = in_corrid.as_numpy()[0][0] + in_end = pb_utils.get_input_tensor_by_name(request, "END") + end = in_end.as_numpy()[0][0] + + if start: + self.seq_feat[corrid] = Feat( + corrid, self.offset_ms, self.sample_rate, self.frame_stride, self.device + ) + if ready: + self.seq_feat[corrid].add_wavs(wav) + + batch_seqid.append(corrid) + if end: + end_seqid[corrid] = 1 + + wav = self.seq_feat[corrid].get_seg_wav() * 32768 + total_waves.append(wav) + features = self.feature_extractor(total_waves) + for corrid, frames in zip(batch_seqid, features): + self.seq_feat[corrid].add_frames(frames) + speech = self.seq_feat[corrid].get_frames(self.decoding_window) + out_tensor0 = pb_utils.Tensor("speech", torch.unsqueeze(speech, 0).to("cpu").numpy()) + output_tensors = [out_tensor0] + response = pb_utils.InferenceResponse(output_tensors=output_tensors) + responses.append(response) + if corrid in end_seqid: + del self.seq_feat[corrid] + return responses + + def finalize(self): + print("Remove feature extractor!") diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/config.pbtxt new file mode 100644 index 0000000..ef322da --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/config.pbtxt @@ -0,0 +1,109 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Created on 2024-01-01 +# Author: GuAn Zhu + +name: "feature_extractor" +backend: "python" +max_batch_size: 128 + +parameters [ + { + key: "chunk_size_s", + value: { string_value: "0.6"} + }, + { + key: "config_path" + value: { string_value: "model_repo_paraformer_large_online/feature_extractor/config.yaml"} + } +] + +sequence_batching{ + max_sequence_idle_microseconds: 15000000 + oldest { + max_candidate_sequences: 1024 + preferred_batch_size: [32, 64, 128] + max_queue_delay_microseconds: 300 + } + control_input [ + { + name: "START", + control [ + { + kind: CONTROL_SEQUENCE_START + fp32_false_true: [0, 1] + } + ] + }, + { + name: "READY" + control [ + { + kind: CONTROL_SEQUENCE_READY + fp32_false_true: [0, 1] + } + ] + }, + { + name: "CORRID", + control [ + { + kind: CONTROL_SEQUENCE_CORRID + data_type: TYPE_UINT64 + } + ] + }, + { + name: "END", + control [ + { + kind: CONTROL_SEQUENCE_END + fp32_false_true: [0, 1] + } + ] + } + ] +} + + +input [ + { + name: "wav" + data_type: TYPE_FP32 + dims: [-1] + }, + { + name: "wav_lens" + data_type: TYPE_INT32 + dims: [1] + } +] + +output [ + { + name: "speech" + data_type: TYPE_FP32 + dims: [61, 80] # 80 + } +] + + +instance_group [ + { + count: 1 + kind: KIND_GPU + } +] + diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/config.yaml b/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/config.yaml new file mode 100644 index 0000000..9b2266f --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/feature_extractor/config.yaml @@ -0,0 +1,8639 @@ +config: examples/aishell_demo/paraformer_s2/conf/train_asr_paraformer_sanm_50e_16d_2048_512_lfr6.yaml +print_config: false +log_level: INFO +dry_run: false +iterator_type: sequence +output_dir: /nfs/FunASR_results/paraformer/1m-1gpu/baseline_train_asr_paraformer_sanm_50e_16d_2048_512_lfr6_fbank_zh_char_local +ngpu: 1 +seed: 0 +num_workers: 16 +num_att_plot: 3 +dist_backend: nccl +dist_init_method: file:///nfs/FunASR_results/paraformer/1m-1gpu/baseline_train_asr_paraformer_sanm_50e_16d_2048_512_lfr6_fbank_zh_char_local/ddp_init +dist_world_size: 1 +dist_rank: 0 +local_rank: 0 +dist_master_addr: null +dist_master_port: null +dist_launcher: null +multiprocessing_distributed: true +unused_parameters: true +sharded_ddp: false +cudnn_enabled: true +cudnn_benchmark: false +cudnn_deterministic: true +collect_stats: false +write_collected_feats: false +max_epoch: 20 +patience: null +val_scheduler_criterion: +- valid +- acc +early_stopping_criterion: +- valid +- loss +- min +best_model_criterion: +- - valid + - acc + - max +keep_nbest_models: 5 +nbest_averaging_interval: 0 +grad_clip: 5 +grad_clip_type: 2.0 +grad_noise: false +accum_grad: 1 +no_forward_run: false +resume: true +train_dtype: float32 +use_amp: false +log_interval: 50 +use_matplotlib: true +use_tensorboard: true +use_wandb: false +wandb_project: null +wandb_id: null +wandb_entity: null +wandb_name: null +wandb_model_log_interval: -1 +detect_anomaly: false +pretrain_path: null +init_param: +- /nfs/init_model/paraformer_9k_bigmodel.pth +ignore_init_mismatch: false +freeze_param: [] +num_iters_per_epoch: null +batch_size: 20 +valid_batch_size: null +batch_bins: 1000 +valid_batch_bins: null +train_shape_file: +- /nfs/dataset/data/asr_stats_fbank_zh_char/train/speech_shape +- /nfs/dataset/data/asr_stats_fbank_zh_char/train/text_shape.char +valid_shape_file: +- /nfs/dataset/data/asr_stats_fbank_zh_char/dev/speech_shape +- /nfs/dataset/data/asr_stats_fbank_zh_char/dev/text_shape.char +batch_type: length +valid_batch_type: null +fold_length: +- 512 +- 150 +sort_in_batch: descending +sort_batch: descending +multiple_iterator: false +chunk_length: 500 +chunk_shift_ratio: 0.5 +num_cache_chunks: 1024 +train_data_file: /nfs/dataset/data/dump/fbank/train/ark_txt.scp +valid_data_file: /nfs/dataset/data/dump/fbank/dev/ark_txt.scp +train_data_path_and_name_and_type: +- - /nfs/dataset/data/dump/fbank/train/feats.scp + - speech + - kaldi_ark +- - /nfs/dataset/data/dump/fbank/train/text + - text + - text +valid_data_path_and_name_and_type: +- - /nfs/dataset/data/dump/fbank/dev/feats.scp + - speech + - kaldi_ark +- - /nfs/dataset/data/dump/fbank/dev/text + - text + - text +allow_variable_data_keys: false +max_cache_size: 0.0 +max_cache_fd: 32 +valid_max_cache_size: null +optim: adam +optim_conf: + lr: 0.0005 +scheduler: warmuplr +scheduler_conf: + warmup_steps: 30000 +use_pai: false +num_worker_count: 1 +access_key_id: null +access_key_secret: null +endpoint: null +bucket_name: null +oss_bucket: null +token_list: +- +- +- +- and +- 筑 +- 陨 +- 眺 +- 塘 +- 檩 +- 衷 +- 氧 +- 孔 +- 阖 +- 邠 +- 坎 +- 喵 +- 曰 +- 鼠 +- 隐 +- 腊 +- 族 +- 矧 +- 敉 +- 俜 +- 似 +- 怫 +- 塔 +- price +- 春 +- 罍 +- 娅 +- 棉 +- 弃 +- 茱 +- 应 +- 汈 +- 擦 +- 贺 +- 鹇 +- these +- 迅 +- 诬 +- do +- 盍 +- 秕 +- 啃 +- 颟 +- 辑 +- 彘 +- ps +- 斜 +- 瞭 +- 铟 +- 漭 +- 蹇 +- 旆 +- 窳 +- 臊 +- 览 +- 嘿 +- 淖 +- 尴 +- 袆 +- 斧 +- 筹 +- 媵 +- 挞 +- 臧 +- 齐 +- 璨 +- 笥 +- 滂 +- 即 +- 愔 +- 思 +- gr +- 幅 +- 祛 +- 箬 +- 礁 +- 茅 +- 北 +- 澡 +- 俭 +- 蘅 +- ing +- 肺 +- 肢 +- 巢 +- 九 +- 蠓 +- 路 +- 藻 +- 沱 +- ness +- 璐 +- 积 +- 寞 +- 栳 +- 舆 +- 医 +- 眷 +- 岳 +- 勘 +- 璃 +- 黔 +- 犇 +- 哎 +- 罡 +- k +- 丝 +- de +- 跣 +- 梦 +- 需 +- 毅 +- 峡 +- 竞 +- 砦 +- 研 +- 眙 +- 滋 +- 鹳 +- 肝 +- 阼 +- per +- 忱 +- 乏 +- 废 +- 邦 +- 輶 +- 驯 +- 夫 +- 寳 +- 忪 +- 崑 +- 睾 +- 逗 +- 峰 +- 越 +- 狗 +- 蟒 +- 笆 +- 适 +- 洇 +- 缶 +- ore +- 辎 +- 粤 +- 蹴 +- 黄 +- 浞 +- comp +- 犀 +- 藏 +- 本 +- 嗖 +- 黻 +- 這 +- 绰 +- 鉏 +- 麼 +- 喆 +- 袪 +- 刚 +- 侦 +- ic +- 骧 +- 瓫 +- 柤 +- 桃 +- 鲴 +- 褙 +- 韵 +- 妓 +- 甍 +- to +- 轱 +- 塑 +- 坯 +- 貌 +- n +- 蕞 +- 疡 +- 伏 +- 酉 +- 暇 +- 霖 +- 了 +- 萸 +- 嘶 +- nu +- 挼 +- by +- 聩 +- 袓 +- 嶓 +- 桎 +- 抖 +- 攥 +- 鞬 +- 毳 +- 旗 +- 庸 +- 呋 +- 诲 +- tting +- 狭 +- 魄 +- 伎 +- 喋 +- 樱 +- 翎 +- 怯 +- 场 +- 睽 +- 盒 +- times +- 鲳 +- 爆 +- 绵 +- 皋 +- 尢 +- 嘎 +- 渝 +- 迂 +- 嘁 +- 袷 +- 始 +- 奚 +- 台 +- 禄 +- 挢 +- 座 +- 绀 +- 漱 +- 龃 +- tu +- 榫 +- 诛 +- minu +- 萼 +- 裛 +- 玠 +- 谵 +- 亳 +- 副 +- any +- 诊 +- 唑 +- 頫 +- 斿 +- 赁 +- 骇 +- 训 +- 母 +- 床 +- 微 +- 椰 +- 迢 +- 埃 +- 辏 +- 汩 +- 叟 +- 辔 +- 隙 +- 遵 +- pp +- 翕 +- 佬 +- 栖 +- 踉 +- 皕 +- 苏 +- 痂 +- 奋 +- 阄 +- 悌 +- 点 +- 碡 +- 茎 +- 睫 +- 闫 +- few +- 籁 +- 孰 +- 拥 +- for +- 曾 +- 疲 +- 辞 +- 赖 +- 姆 +- 与 +- 诰 +- 怨 +- 沙 +- with +- 睱 +- 谓 +- 晰 +- 嗌 +- id +- aga +- 実 +- 魏 +- 鲟 +- 寅 +- 滗 +- 珲 +- 腑 +- 冠 +- 夺 +- 娶 +- 宇 +- 侩 +- 筘 +- an +- 磺 +- 邛 +- 着 +- 踵 +- ite +- 狝 +- ele +- 蓼 +- 猿 +- 豆 +- 蔷 +- 沽 +- 去 +- 铥 +- 癀 +- 站 +- 甪 +- 璧 +- 范 +- 哓 +- 菏 +- 龠 +- 岷 +- 嫉 +- 拧 +- 札 +- 戒 +- 琏 +- 绪 +- 澌 +- 楠 +- 莱 +- cer +- here +- 别 +- 帻 +- 嗉 +- 假 +- 拽 +- 髭 +- 穰 +- 勋 +- 栓 +- 塬 +- ou +- 橫 +- 刻 +- 侣 +- 鎉 +- bre +- 趸 +- 稳 +- 岌 +- 拎 +- 落 +- 岙 +- 氨 +- 桴 +- 鬶 +- clu +- 蚣 +- 肌 +- 讹 +- 骼 +- 忧 +- 雹 +- 0 +- 算 +- 腔 +- 璇 +- 酣 +- 锭 +- 蟾 +- 逦 +- 椟 +- 频 +- ts +- 矫 +- 拨 +- 珅 +- 侨 +- 蚨 +- 皯 +- 翛 +- 儋 +- 恳 +- 瀍 +- 敌 +- 砬 +- 奁 +- 耵 +- 烂 +- 绿 +- 缆 +- 辣 +- time +- 蔗 +- too +- 圾 +- 骞 +- 慥 +- 啶 +- 帔 +- 楢 +- bi +- 蚤 +- 浛 +- ine +- 綦 +- old +- 肩 +- 擎 +- ling +- 瘆 +- 娲 +- prob +- 暑 +- 鲨 +- 焚 +- 剽 +- 玚 +- 乔 +- 纪 +- bo +- 熏 +- 毗 +- 鳙 +- 鞥 +- 絜 +- 糠 +- 菔 +- 廛 +- 谪 +- 冬 +- 遐 +- 衽 +- ich +- 柿 +- 峭 +- 渴 +- 亓 +- 荠 +- 蝠 +- 扆 +- 鄞 +- 诎 +- 尙 +- 摸 +- 牙 +- 薤 +- da +- w +- 呜 +- 陂 +- 磻 +- 匹 +- while +- 迁 +- 良 +- 郤 +- ct +- 蚕 +- 浥 +- 鲋 +- 腱 +- pres +- 氕 +- 颉 +- 夥 +- ter +- 左 +- 侉 +- 妍 +- 嚒 +- 殖 +- 私 +- bas +- 锱 +- 篪 +- 吻 +- 鄅 +- 鳗 +- 疳 +- cor +- 毛 +- 歼 +- 邵 +- 圪 +- inn +- 舛 +- 埗 +- 貉 +- 帐 +- 妮 +- ged +- 窒 +- put +- 诉 +- 堌 +- 气 +- 國 +- 摩 +- 沫 +- 谁 +- 转 +- 语 +- 琵 +- 羊 +- 檠 +- 慎 +- 踮 +- 啾 +- 瞻 +- 山 +- 播 +- 筌 +- 财 +- 飚 +- 苟 +- 扣 +- mis +- 桌 +- 侑 +- jo +- ke +- 冶 +- 滔 +- 蠹 +- 呓 +- 捷 +- 证 +- 崞 +- 阵 +- 掐 +- 劳 +- 皆 +- 巧 +- 肏 +- 肆 +- 葆 +- 檄 +- 画 +- 狨 +- 谧 +- 傑 +- 诱 +- 纭 +- 荥 +- 厥 +- bri +- 绁 +- 睇 +- 布 +- 江 +- 噎 +- 灞 +- 鄏 +- 煊 +- 蒹 +- 厮 +- 馓 +- 狴 +- 碍 +- 穷 +- lar +- 食 +- 迩 +- meeting +- tter +- 趣 +- 辜 +- 椁 +- 汽 +- 燠 +- ate +- 礴 +- 骈 +- will +- not +- 煽 +- 嗳 +- 秆 +- 勤 +- 陆 +- 键 +- 墎 +- 官 +- 蘧 +- 酤 +- 唐 +- 颓 +- 仝 +- iting +- 田 +- 楫 +- 瑁 +- 鄢 +- our +- 诘 +- venue +- 霜 +- 镏 +- 痫 +- 娟 +- 婢 +- 埋 +- 汕 +- 铋 +- 徭 +- 隰 +- 猊 +- 卞 +- 慑 +- said +- 裘 +- bus +- 召 +- 粱 +- 返 +- 缨 +- 纻 +- 磋 +- 炴 +- 凊 +- 曝 +- 兀 +- 洼 +- 杓 +- 榆 +- hotels +- 睹 +- 糯 +- 窘 +- 葩 +- 帮 +- 荷 +- 塌 +- 矍 +- 圯 +- er +- 蚪 +- 篼 +- 咳 +- 吸 +- 喃 +- 岩 +- 嚟 +- 谱 +- 崆 +- 蟭 +- wal +- 姗 +- 谛 +- 东 +- 菱 +- ction +- 肫 +- 祥 +- 述 +- 璋 +- 仙 +- 唇 +- 硕 +- 嘉 +- 醒 +- 兔 +- 恒 +- 银 +- 収 +- cre +- 弭 +- 曌 +- 螯 +- 苡 +- 疾 +- 鸱 +- 权 +- 搔 +- 途 +- 茂 +- 皑 +- 补 +- 肃 +- ns +- market +- 讠 +- 阈 +- 机 +- 苒 +- 髙 +- is +- 幢 +- 郐 +- 萎 +- 帛 +- 烖 +- 襟 +- 崟 +- 溶 +- 螺 +- 铲 +- 仉 +- 舌 +- 敖 +- 倍 +- 锏 +- 鸦 +- 夌 +- 埌 +- 腰 +- 雠 +- ol +- 涙 +- 翳 +- 夹 +- 疏 +- el +- 驭 +- 鹯 +- 瑜 +- 薛 +- 奇 +- 娴 +- 靳 +- 镥 +- 伍 +- 暨 +- what +- 萧 +- 皴 +- 烦 +- 敷 +- 样 +- ri +- 睆 +- 伦 +- 後 +- 祺 +- 贾 +- 汹 +- 箸 +- 掂 +- 械 +- ob +- 赜 +- 黎 +- 潵 +- 鲽 +- 牒 +- 罐 +- inter +- 冰 +- 成 +- 薳 +- if +- 堡 +- 搜 +- 漪 +- 赕 +- 症 +- 参 +- 鲫 +- 克 +- 浴 +- 薹 +- 梫 +- 调 +- 劢 +- 茹 +- 飐 +- r +- her +- 鲊 +- 妪 +- 惟 +- 榜 +- 谒 +- 梃 +- twenty +- ni +- 猥 +- 兴 +- 氓 +- 肘 +- 饕 +- 陵 +- within +- 轲 +- cted +- 単 +- 嚗 +- 唼 +- inte +- 钋 +- 抒 +- 郓 +- 牖 +- 蔻 +- 邂 +- 懦 +- 邻 +- 茸 +- 辈 +- 种 +- 黹 +- hard +- 悦 +- 综 +- ved +- oo +- used +- 溱 +- 藁 +- 士 +- 猝 +- 芹 +- char +- we +- 呒 +- ss +- 岐 +- 桖 +- 迟 +- 荞 +- 哏 +- 仵 +- 抟 +- 淇 +- il +- 电 +- 褀 +- 果 +- bir +- ges +- 暻 +- 椊 +- 吴 +- sal +- 獐 +- 煲 +- 箥 +- 爰 +- 呣 +- 邶 +- 尻 +- 水 +- sh +- fore +- mat +- 浅 +- 枘 +- 稷 +- 艨 +- 唧 +- can +- eng +- know +- 桠 +- 亵 +- tou +- 伥 +- 虏 +- 綮 +- sha +- 腌 +- 蔓 +- 莶 +- 戬 +- 鋆 +- 酥 +- 璜 +- 阐 +- 贶 +- 远 +- 验 +- dre +- 赎 +- 惭 +- 裴 +- 晌 +- 铡 +- 愆 +- 隧 +- 祐 +- 貔 +- 片 +- al +- 抾 +- 柰 +- 探 +- 喈 +- 蟮 +- 潎 +- 批 +- 胴 +- 郁 +- 蓿 +- 稿 +- 傲 +- 垒 +- 甙 +- 靼 +- chic +- 效 +- 栗 +- 齁 +- 仲 +- 担 +- har +- 仟 +- 砂 +- i +- 舰 +- 吝 +- 慆 +- 芸 +- why +- tic +- 哥 +- 佩 +- 铀 +- 妊 +- x +- 刍 +- 殄 +- 躬 +- 莙 +- 客 +- 拚 +- 葬 +- 哼 +- 婵 +- ance +- 棺 +- 没 +- 崎 +- 曛 +- 宛 +- 斌 +- 掠 +- 醇 +- 庾 +- 黥 +- 乗 +- 旉 +- 铰 +- 寨 +- 钨 +- 沥 +- gh +- 吇 +- 嬖 +- 厨 +- 箔 +- ah +- 譞 +- 鲖 +- 蒗 +- 銶 +- 角 +- 脏 +- 夬 +- who +- 毂 +- 赓 +- 嘢 +- 蹶 +- 駃 +- avenue +- 呃 +- that's +- 訾 +- 蒜 +- 就 +- 抿 +- 霫 +- que +- 牁 +- 叻 +- 绌 +- 捣 +- 埭 +- 蛩 +- 迤 +- ir +- 最 +- 不 +- 鹚 +- 钧 +- 晃 +- 钍 +- 岍 +- 烯 +- 授 +- 笨 +- 馔 +- 甸 +- 啰 +- 赌 +- 蠼 +- 荆 +- 濉 +- 摹 +- 剔 +- 浪 +- 瓦 +- 涤 +- 阬 +- eng +- 墨 +- 鲢 +- 老 +- 拮 +- 轿 +- 弈 +- 秸 +- ken +- 省 +- 穹 +- 跨 +- 芤 +- 剰 +- 湍 +- 吥 +- 喧 +- 借 +- 伯 +- 咋 +- 噢 +- 剩 +- 略 +- 图 +- 毕 +- 爻 +- 箭 +- ans +- 'no' +- 缣 +- fic +- 必 +- 礻 +- 视 +- 侔 +- 乸 +- 缎 +- 比 +- 殉 +- 禅 +- 蹈 +- 茶 +- 沔 +- 腹 +- 更 +- 倢 +- 骑 +- 俦 +- 一 +- 巉 +- 糌 +- there +- 笾 +- 泺 +- 虫 +- 随 +- 室 +- 谙 +- 淞 +- even +- 嘌 +- 掉 +- 进 +- 栈 +- 隋 +- 钳 +- 饲 +- 裾 +- 搞 +- 朽 +- 嚏 +- 垱 +- 倘 +- sy +- 蒂 +- 訚 +- 火 +- 葱 +- 踹 +- only +- den +- 胰 +- 曦 +- 汨 +- 奴 +- 院 +- 晶 +- 臇 +- 赭 +- 蚵 +- 便 +- 藜 +- 鍪 +- 穆 +- 尿 +- find +- 偾 +- 项 +- 嬅 +- 济 +- area +- 皿 +- 蹽 +- af +- 曈 +- ger +- 袭 +- 温 +- 包 +- 惎 +- 枝 +- 槁 +- 跑 +- 汇 +- 嫦 +- 崒 +- 颇 +- 丐 +- 丛 +- 哠 +- 鲲 +- 佯 +- 疱 +- 來 +- 彝 +- 件 +- 鸫 +- 张 +- 缋 +- 檎 +- 港 +- 尸 +- comm +- 瘘 +- 囍 +- 锅 +- 惫 +- 衔 +- 蔚 +- 龚 +- 酱 +- ina +- 尚 +- 孪 +- 蔵 +- 帧 +- 弯 +- 迄 +- 訇 +- 恕 +- 紡 +- 吱 +- 觐 +- 印 +- need +- 叭 +- 茫 +- 汶 +- 邢 +- 磅 +- 焜 +- 蜣 +- 米 +- 俎 +- ath +- 蛔 +- 组 +- 壹 +- 诈 +- ing +- 希 +- 茨 +- 砧 +- has +- 蝶 +- 矛 +- 拖 +- 乍 +- 浇 +- another +- 输 +- 朗 +- 殡 +- 壶 +- 灿 +- 礌 +- 钡 +- 瓤 +- 序 +- 误 +- 毖 +- 静 +- 鸾 +- 墚 +- 璟 +- 咱 +- 惘 +- 化 +- 腾 +- 苍 +- 苼 +- 七 +- 芾 +- 囝 +- 淄 +- 馆 +- 榉 +- 荸 +- 摧 +- 醋 +- 缦 +- 帘 +- 蛋 +- 曙 +- 萩 +- 莉 +- 犸 +- 拜 +- 特 +- 蕊 +- 并 +- 冼 +- 埝 +- 茴 +- 佶 +- 噶 +- ked +- port +- 柠 +- 吶 +- 竿 +- 鞧 +- 糙 +- 栻 +- 褂 +- 杉 +- 陛 +- shi +- 朋 +- 升 +- 钛 +- 拭 +- walk +- 钱 +- 岸 +- 衲 +- 若 +- 燕 +- 墩 +- 戛 +- ations +- 诳 +- 冨 +- 强 +- 掌 +- 腺 +- 淤 +- 鼍 +- 妥 +- 亥 +- 俵 +- 鹩 +- 占 +- 佤 +- 棋 +- does +- tes +- 拒 +- 劼 +- 绩 +- ren +- 货 +- g +- 深 +- 钯 +- 棬 +- 墟 +- 疼 +- 骊 +- 摅 +- 祧 +- 兊 +- 坠 +- int +- use +- 泞 +- 赦 +- 甾 +- 葺 +- 辘 +- 炆 +- 旭 +- 鸯 +- 茆 +- 融 +- 艄 +- 晖 +- 钺 +- 勉 +- 嘘 +- 龛 +- 蕙 +- 渀 +- 钞 +- 写 +- 弋 +- 颦 +- 灌 +- 埚 +- 鲷 +- 亡 +- 矩 +- 轰 +- a +- 单 +- 觚 +- 呯 +- 祏 +- rec +- 逢 +- 憧 +- 蒽 +- 內 +- 乡 +- 鸠 +- 卜 +- 庄 +- 仰 +- how +- 铓 +- 踝 +- 隆 +- 避 +- 豌 +- low +- ak +- 劣 +- 哺 +- 头 +- proble +- es +- 说 +- 哇 +- 折 +- 祝 +- 偻 +- 揆 +- 的 +- 盎 +- 初 +- 骝 +- 荻 +- 饷 +- 耽 +- 莸 +- just +- 簰 +- 现 +- pl +- 籍 +- 珉 +- 蕲 +- 臌 +- 闪 +- 崮 +- gra +- 琯 +- 圆 +- 瓴 +- 赬 +- 镧 +- 被 +- 共 +- 芯 +- 蚧 +- stu +- mee +- 沧 +- 伲 +- 觌 +- 筏 +- 庑 +- still +- 题 +- wat +- '4' +- 绱 +- 入 +- 亚 +- sho +- 珫 +- 饴 +- 點 +- than +- good +- l +- 梁 +- 忿 +- 荐 +- 躺 +- 蹡 +- 呕 +- 圩 +- 唷 +- 陌 +- ue +- 鲭 +- 碗 +- 怪 +- 飘 +- country +- 粑 +- 怹 +- 飕 +- 烨 +- 吹 +- 嵇 +- 驺 +- 纰 +- in +- 间 +- 馈 +- 榑 +- 窜 +- 泗 +- 硪 +- 躏 +- th +- 耸 +- 贞 +- wom +- 排 +- 箩 +- 绽 +- 舵 +- 焉 +- 振 +- 镶 +- thirty +- 闲 +- 摁 +- 堰 +- 牵 +- 栋 +- 堤 +- 馀 +- 盟 +- t +- 旄 +- 凇 +- 洣 +- 録 +- 韭 +- por +- 孑 +- 茄 +- 闺 +- 淀 +- 坡 +- 烟 +- 洺 +- gre +- 敦 +- 哉 +- 到 +- ding +- 遑 +- 钒 +- 壳 +- lo +- 纾 +- 砲 +- 灶 +- lee +- 玘 +- up +- 梵 +- 旖 +- 佗 +- 竽 +- 绋 +- 砩 +- 酒 +- 苯 +- 焕 +- 祚 +- 苁 +- 嗓 +- ail +- 殽 +- om +- 棨 +- 翼 +- 墼 +- 萄 +- 垭 +- 碱 +- cts +- 渲 +- 矱 +- 掇 +- best +- 锃 +- 谶 +- 喜 +- 雌 +- 辊 +- 啀 +- 嗞 +- 谢 +- 疹 +- 玎 +- 唤 +- 兆 +- 彳 +- 溧 +- 丕 +- 棒 +- 桁 +- 樓 +- 跟 +- 蝼 +- 哭 +- 啭 +- 替 +- 乩 +- 箪 +- 城 +- 朾 +- ear +- 鲌 +- ship +- 吕 +- 粉 +- 舜 +- 伛 +- 觏 +- 燮 +- 铊 +- 硝 +- 撤 +- 瘝 +- thanks +- 锵 +- 圣 +- contin +- 侬 +- 浮 +- 棵 +- 歭 +- ici +- 珞 +- 褔 +- 券 +- 演 +- 箫 +- 缵 +- 篾 +- 鲮 +- 砒 +- 含 +- 郡 +- 快 +- 栏 +- 瘟 +- 饤 +- tw +- 拃 +- 盹 +- 壕 +- 桯 +- 嗪 +- 鞨 +- 甏 +- 锫 +- 涕 +- 冕 +- 鄣 +- 淌 +- 辰 +- 唿 +- 暲 +- 蚀 +- 跋 +- 郸 +- 镀 +- ku +- 赔 +- 姺 +- 课 +- 础 +- 耷 +- 涪 +- day +- 笳 +- away +- 稞 +- 鹈 +- 珍 +- 毯 +- 酮 +- 汀 +- 梆 +- 嫫 +- 准 +- ces +- 巷 +- 晋 +- 肉 +- 莆 +- 痢 +- 缗 +- 怜 +- 鄙 +- 搠 +- fri +- 仳 +- 该 +- 宓 +- 珂 +- 圉 +- 弨 +- 悬 +- buil +- 绸 +- 太 +- 外 +- 祢 +- 蓍 +- 圹 +- 侓 +- 跸 +- 谊 +- 获 +- 髈 +- 迮 +- 鹤 +- 卦 +- 嗻 +- 佐 +- 愠 +- 媲 +- 殍 +- 齉 +- 妹 +- 残 +- 嗄 +- 钾 +- court +- 踞 +- 脯 +- 菖 +- 琼 +- 傻 +- 三 +- 虿 +- 唪 +- 逶 +- 鲤 +- 镌 +- 肇 +- 弘 +- 李 +- 履 +- 恩 +- 蒌 +- 夙 +- 环 +- 坒 +- gar +- ans +- 嘣 +- 嵯 +- 命 +- 酢 +- 屏 +- 鈇 +- 麟 +- 旨 +- 旼 +- 疮 +- with +- 解 +- 屈 +- 趴 +- 蠛 +- 密 +- 瞩 +- 屎 +- 显 +- 魁 +- 衯 +- 钇 +- 酩 +- 鳌 +- 戆 +- 芈 +- 十 +- gu +- 陪 +- 黑 +- 缌 +- ch +- 摇 +- 梨 +- 胼 +- 撷 +- 疤 +- 砟 +- el +- 唛 +- 芪 +- 速 +- ol +- 细 +- 馥 +- 犰 +- bal +- 鲇 +- 韂 +- 焰 +- 胗 +- 粹 +- 枌 +- 嵬 +- 古 +- she +- through +- 筛 +- 翀 +- 协 +- se +- 魃 +- 格 +- mes +- 晥 +- 跱 +- 掺 +- 阕 +- 智 +- 松 +- st +- 靠 +- 斟 +- 粒 +- 舞 +- 瀣 +- 棅 +- 茭 +- 韫 +- 鐎 +- 灵 +- 龢 +- 卷 +- lion +- 曹 +- 哒 +- 皝 +- 哲 +- pe +- 患 +- 逸 +- 涠 +- 蛰 +- 佣 +- 猇 +- 狈 +- nine +- 囫 +- 风 +- 态 +- 慈 +- 慜 +- 俨 +- 汲 +- 肛 +- 隶 +- 坩 +- 赍 +- 海 +- 癫 +- my +- 委 +- ill +- 胤 +- 覩 +- 臬 +- 矶 +- 炷 +- 衬 +- 前 +- 馊 +- 伽 +- 艳 +- 妗 +- 肠 +- 檗 +- soon +- 氙 +- 琅 +- 谏 +- light +- 変 +- seven +- 旸 +- 芭 +- en +- 烧 +- 诃 +- 攘 +- 陧 +- 觅 +- 铑 +- 氐 +- 余 +- night +- hou +- 鹀 +- 膜 +- 炙 +- 抨 +- 珊 +- ses +- 漩 +- both +- 桉 +- 笺 +- 鎛 +- led +- 披 +- 膛 +- 蜻 +- 菽 +- 娼 +- 団 +- 揽 +- 测 +- f +- 芎 +- 吅 +- sion +- 遹 +- 瓘 +- 慕 +- 他 +- 鄩 +- 矽 +- thou +- 沒 +- 唁 +- 匿 +- 设 +- 嵖 +- 髹 +- ine +- 恸 +- 窣 +- - +- 街 +- 膝 +- 碑 +- national +- it +- 瘢 +- ci +- 侮 +- l +- 陉 +- 照 +- 原 +- 厐 +- 悚 +- 答 +- 犷 +- 罔 +- 绘 +- 敞 +- ys +- 捆 +- 殚 +- 填 +- 挟 +- tal +- 萌 +- 卑 +- 甃 +- 吉 +- 蜮 +- 帑 +- 笖 +- new +- 昺 +- 诤 +- 襜 +- 矗 +- 藠 +- 苓 +- th +- 哝 +- its +- 蚋 +- ran +- 澳 +- eight +- 贱 +- 傕 +- 亦 +- 续 +- 槐 +- 筚 +- 追 +- 醺 +- 錾 +- 蹒 +- 玟 +- look +- 圃 +- 颗 +- 旎 +- 圮 +- 绷 +- op +- 咙 +- 槃 +- 冫 +- 乳 +- 鸣 +- 柴 +- 蚴 +- 擞 +- 锴 +- 姣 +- 惯 +- 管 +- 奎 +- ra +- 瞠 +- 侍 +- 恵 +- 岬 +- 喎 +- 摭 +- 卺 +- wee +- 羧 +- cep +- fron +- 妁 +- 很 +- 禹 +- 巯 +- 夼 +- 鄫 +- re +- 动 +- 迓 +- 狐 +- 瑕 +- 棹 +- 屹 +- 皈 +- 陔 +- 殛 +- 仿 +- 蝥 +- 缘 +- 镫 +- 品 +- ase +- row +- 缜 +- stance +- 予 +- custom +- 抬 +- 鞶 +- 蛘 +- 埏 +- 漂 +- 凝 +- 虻 +- 姒 +- 痒 +- 邝 +- ss +- 战 +- 悴 +- spe +- 羝 +- 吮 +- 锗 +- 湘 +- 端 +- 淸 +- 孢 +- '3' +- 郴 +- 卬 +- fif +- 濯 +- 射 +- 簏 +- 锌 +- 啖 +- 懑 +- 霪 +- 棻 +- 簺 +- 怅 +- g +- 毎 +- 犳 +- ffe +- 镉 +- 閦 +- 吲 +- 驹 +- are +- 埇 +- 心 +- 漴 +- 娃 +- 侯 +- 蔽 +- 值 +- 鲧 +- fr +- ful +- 嘹 +- 滥 +- 騠 +- ility +- 喹 +- 悉 +- 嗽 +- 些 +- 硁 +- mer +- 磊 +- 霆 +- 麝 +- 曲 +- 蜃 +- police +- 镩 +- 笪 +- 苾 +- 靑 +- 凼 +- 多 +- 质 +- 缇 +- 嗫 +- 沏 +- ened +- 花 +- 诹 +- 尉 +- 珥 +- 崩 +- ld +- x +- 揎 +- 纷 +- 缂 +- 轹 +- 庙 +- 渚 +- 鸪 +- 乒 +- 惧 +- peop +- 歌 +- 唾 +- 樘 +- 膺 +- fro +- 哂 +- 腼 +- 霄 +- 坞 +- 霰 +- 掎 +- 娿 +- 镬 +- 巨 +- 碇 +- 藩 +- 活 +- 荤 +- 团 +- 缪 +- 钵 +- 飞 +- 儡 +- 苤 +- 貊 +- 柄 +- 蓠 +- 防 +- 贮 +- 碾 +- 狞 +- 艏 +- 喏 +- 稚 +- 映 +- i'm +- 谤 +- 蜿 +- 车 +- 乂 +- 寕 +- 啧 +- 虔 +- ster +- 垣 +- 嗛 +- 讪 +- ves +- again +- 隗 +- 帜 +- 嗾 +- 绂 +- 公 +- 卮 +- 抱 +- 仕 +- 以 +- 栘 +- 拊 +- 萤 +- him +- 荪 +- 淬 +- '7' +- 鋹 +- 敢 +- 颖 +- ment +- 嫩 +- 棕 +- show +- 跩 +- out +- 汤 +- 迕 +- 榨 +- 暗 +- 糍 +- 晡 +- '9' +- 稂 +- 曼 +- 蒺 +- ture +- 鬄 +- 逅 +- 岚 +- 芟 +- 昶 +- 埤 +- 幺 +- 猖 +- 伙 +- pub +- 南 +- 荨 +- 趁 +- 淑 +- 嘲 +- 悔 +- 藉 +- 争 +- 渔 +- pool +- 簟 +- 谀 +- 噘 +- 窀 +- 祟 +- 阜 +- 涸 +- 掖 +- 癃 +- 疑 +- 搢 +- 漏 +- 锉 +- 钹 +- 耱 +- 踢 +- 骎 +- 稣 +- 锲 +- 繇 +- 缊 +- 劈 +- 啻 +- 蕴 +- 仔 +- 昝 +- 且 +- 滚 +- 柢 +- 镊 +- 响 +- 凰 +- 噗 +- 瑴 +- 嗔 +- 简 +- 蜇 +- 有 +- 豢 +- ap +- 啓 +- 翅 +- 愤 +- peri +- 蚶 +- 弄 +- 禨 +- 蚡 +- 坝 +- 换 +- 纨 +- 蹑 +- for +- 草 +- 荛 +- 懈 +- 奉 +- 鳊 +- 疗 +- 搂 +- 串 +- 幸 +- 岽 +- 牍 +- 蝰 +- 絶 +- 秣 +- 缴 +- at +- 网 +- 嗑 +- 岗 +- 绊 +- 圳 +- 恁 +- 反 +- 方 +- 癞 +- 煞 +- 雪 +- 尤 +- 鐧 +- 麒 +- 黡 +- 殷 +- 都 +- 则 +- 剃 +- 揄 +- 毐 +- 噱 +- fi +- 氹 +- 泠 +- 樾 +- 迳 +- 嫚 +- 齿 +- 殳 +- 墒 +- 役 +- 晟 +- 咔 +- 芃 +- 睁 +- 柽 +- 戍 +- 屺 +- 虱 +- 韦 +- 涅 +- 姚 +- 鋈 +- sure +- 既 +- 涯 +- 甯 +- 嘤 +- 硞 +- som +- 惴 +- 狻 +- 堑 +- 屉 +- 愿 +- li +- 行 +- 谲 +- 嶂 +- 峣 +- 碜 +- 暂 +- h +- 鏖 +- 瘊 +- 蜈 +- 浈 +- 萦 +- 职 +- 蚊 +- 汴 +- people +- 妱 +- 鸰 +- 易 +- 芜 +- 挪 +- 影 +- 竹 +- 洸 +- 烀 +- 鹘 +- 胜 +- 兵 +- 咧 +- 楷 +- 币 +- 妖 +- ant +- 臣 +- 桩 +- 创 +- 囹 +- na +- 鞑 +- 楂 +- 逡 +- 惆 +- 卿 +- 闱 +- 耀 +- 那 +- 童 +- 钰 +- 玮 +- 郄 +- 昏 +- 乘 +- 钩 +- 晳 +- 笼 +- 核 +- 芙 +- 小 +- 忋 +- 区 +- as +- 颢 +- our +- that +- 稻 +- 销 +- 韶 +- 刑 +- 延 +- k +- teen +- 幄 +- pic +- 叱 +- 骷 +- 棰 +- 羁 +- 垝 +- 犴 +- 媱 +- 兄 +- 尓 +- 乞 +- 鲦 +- 划 +- 壬 +- 芡 +- hotel +- 佃 +- 氯 +- 您 +- 颌 +- 汝 +- 缫 +- 幂 +- 竣 +- 喾 +- 疥 +- long +- 广 +- 镂 +- 酫 +- ings +- ood +- 柊 +- 唣 +- 辽 +- 稀 +- 襞 +- 讼 +- 篱 +- 坻 +- 袂 +- 华 +- 自 +- 歧 +- 昂 +- 摺 +- gh +- 聿 +- 犟 +- 敛 +- 牺 +- 旳 +- 锥 +- 玛 +- 低 +- 鄮 +- 漳 +- 叠 +- 川 +- 呼 +- where +- 戳 +- 嗮 +- 琦 +- 厓 +- 窠 +- cas +- 舷 +- 甦 +- 凛 +- 谖 +- 旷 +- 沌 +- 狒 +- 溉 +- 绍 +- 劲 +- 滟 +- in +- 褊 +- fam +- 楽 +- 金 +- 磕 +- see +- 斩 +- 佛 +- 壅 +- 境 +- 诂 +- around +- 羑 +- 浆 +- 矜 +- 铈 +- provi +- 藐 +- 伉 +- 阶 +- 哀 +- 潼 +- 精 +- 像 +- 凶 +- 琇 +- 秧 +- 涂 +- 豫 +- 镒 +- 蒟 +- 叹 +- 颜 +- 莫 +- 阀 +- 痕 +- 爬 +- 嬲 +- 滓 +- 牮 +- 沐 +- 璈 +- 窸 +- 湮 +- 喊 +- 徘 +- 而 +- 仞 +- 蛆 +- 吵 +- 栟 +- 郯 +- 谄 +- 膑 +- 垯 +- 恰 +- 筠 +- 淝 +- 剌 +- vie +- 估 +- first +- 渊 +- 鶗 +- 缬 +- 踺 +- 呦 +- 宄 +- 颎 +- 蔼 +- 挒 +- 亹 +- 墉 +- 倧 +- 梪 +- 猱 +- 顼 +- 泫 +- 鸳 +- 赠 +- 聋 +- 鬲 +- 隽 +- 胚 +- 驱 +- 丶 +- 邪 +- 鲚 +- 韩 +- 婆 +- sed +- it +- 审 +- 屠 +- 众 +- 翩 +- 铺 +- 磨 +- 醲 +- 瘼 +- 佑 +- 霹 +- 臀 +- 坮 +- 俯 +- 舸 +- 辍 +- 谗 +- 甥 +- 祭 +- tell +- 商 +- ace +- 宾 +- 骡 +- 浍 +- 冉 +- 肾 +- im +- win +- 甬 +- 蹚 +- 粕 +- 脖 +- 遽 +- next +- expe +- 榕 +- 蹂 +- 邹 +- stru +- 沁 +- 宸 +- 旮 +- 锁 +- 侂 +- 拢 +- 辫 +- 仁 +- be +- 洱 +- 摘 +- 律 +- 预 +- 徕 +- 鬣 +- 挠 +- 戟 +- 嘴 +- 杖 +- 骍 +- 劵 +- 哮 +- 雁 +- 擀 +- 鴐 +- 衎 +- 芮 +- 据 +- 霭 +- com +- 俗 +- 伝 +- ory +- 轭 +- 博 +- 谐 +- 孺 +- te +- 锹 +- 瞥 +- 导 +- 糜 +- 堙 +- 乾 +- 搌 +- 鏐 +- 你 +- con +- 琍 +- art +- 徇 +- 塞 +- 讽 +- 瞄 +- rence +- 溢 +- 卉 +- 逞 +- 阮 +- 阊 +- 婊 +- mil +- 专 +- 姜 +- 浉 +- 府 +- sing +- 嗵 +- 哨 +- 砺 +- 吋 +- 闹 +- 败 +- 居 +- 娓 +- ce +- 囟 +- 楼 +- 元 +- 鲥 +- 嗙 +- tely +- 帷 +- 還 +- 懋 +- 欷 +- ong +- 郝 +- 丨 +- breakfast +- 崴 +- 橼 +- 停 +- 沾 +- under +- tion +- 非 +- 堵 +- 仆 +- 铗 +- 难 +- 蛑 +- 狙 +- 找 +- 熠 +- over +- 檀 +- 鸩 +- 檐 +- 彀 +- 蟋 +- 腚 +- 槟 +- 泄 +- 舅 +- 痼 +- 秤 +- 氆 +- 罄 +- 啼 +- 啡 +- 冽 +- 疎 +- 嵨 +- 吿 +- 航 +- 采 +- mb +- 裟 +- 檿 +- 辆 +- 眍 +- 溃 +- can +- 唻 +- 媖 +- 佺 +- 狰 +- 仪 +- rent +- 沓 +- 话 +- 霾 +- 婷 +- 雨 +- eigh +- 白 +- 瞧 +- 澎 +- 洞 +- 阔 +- ta +- 侧 +- 躇 +- 莘 +- 骏 +- 宰 +- 縠 +- birth +- 萃 +- men +- 秉 +- 轮 +- 刹 +- fl +- 鸮 +- 忾 +- 胖 +- 攫 +- 磁 +- 飧 +- 鲈 +- 邙 +- 阌 +- 皂 +- 危 +- 搹 +- 靺 +- 唔 +- 撴 +- 柝 +- 垮 +- 膈 +- 辋 +- 榷 +- 邘 +- 锂 +- 戚 +- 蔹 +- 粝 +- 翊 +- 攵 +- 悯 +- 涝 +- 媞 +- 俤 +- 镲 +- 梳 +- 蓥 +- 艾 +- guest +- 顿 +- 譬 +- 兹 +- 囚 +- 倌 +- 遣 +- 朔 +- such +- 篷 +- 囷 +- 宫 +- 戊 +- 嵎 +- 娉 +- 箅 +- 檫 +- 玷 +- please +- 彰 +- 蜓 +- 怃 +- 癯 +- 怛 +- 镇 +- 还 +- 诿 +- 庞 +- 开 +- 节 +- 卒 +- 逵 +- 颔 +- 杰 +- 蘸 +- 楚 +- 颍 +- 吐 +- 堃 +- 澜 +- 弧 +- 流 +- 堍 +- 严 +- 焱 +- 'on' +- 纬 +- 巽 +- 确 +- 子 +- 紙 +- 沭 +- 戞 +- 屙 +- 胭 +- 劫 +- 珧 +- 信 +- 樵 +- 讴 +- 豺 +- 叽 +- 钎 +- 霁 +- 瀛 +- 糟 +- 噌 +- 豝 +- 湜 +- 洎 +- 菌 +- 悆 +- ree +- 凯 +- 徜 +- 郏 +- today +- 勾 +- 嬉 +- 螵 +- 戕 +- 璞 +- 忝 +- 俞 +- 言 +- 庵 +- 贼 +- 费 +- kind +- 扁 +- 骁 +- 咪 +- 凿 +- 讳 +- 掊 +- ated +- 苄 +- 鳝 +- 噍 +- 茧 +- govern +- 筼 +- 颋 +- 愛 +- 渭 +- 踟 +- 罪 +- 汔 +- 踩 +- 陽 +- 疽 +- 闵 +- 我 +- 蒡 +- 缠 +- 曺 +- 婪 +- 农 +- 露 +- 染 +- sent +- 氽 +- et +- 咷 +- 圧 +- 咀 +- site +- sti +- 梗 +- water +- 舔 +- 嚣 +- 蜉 +- 逖 +- 湄 +- 栅 +- 刳 +- 薢 +- ally +- 诸 +- 藕 +- 钔 +- 伋 +- 莜 +- 硬 +- 窟 +- sa +- 愚 +- 蟪 +- 秩 +- 雯 +- 褚 +- 鹎 +- 泃 +- ner +- ast +- 菜 +- 晦 +- 枨 +- 偲 +- 嚩 +- 遴 +- su +- 掸 +- 千 +- 馄 +- 功 +- 胺 +- rep +- 涡 +- ther +- 孩 +- 液 +- 狲 +- 业 +- 巡 +- 脍 +- 甚 +- 珜 +- 郜 +- 蔑 +- 疔 +- 庚 +- 硌 +- 裉 +- 骘 +- sequ +- 迎 +- 盖 +- 噪 +- 尺 +- 咒 +- 蜕 +- 店 +- 镐 +- 蝉 +- 宝 +- 卍 +- 弩 +- 学 +- 猁 +- 犊 +- 妄 +- 葭 +- every +- 螋 +- 馃 +- ating +- 壮 +- 熟 +- rela +- 嗬 +- 约 +- 锞 +- 呫 +- 护 +- 磒 +- 疙 +- 羞 +- 绦 +- 铳 +- 掕 +- 宗 +- 荀 +- 玢 +- ser +- 啦 +- 氪 +- 盯 +- 疸 +- 鬐 +- 绚 +- 锡 +- 鬻 +- 瓮 +- 麸 +- 旱 +- 娱 +- 敕 +- 跄 +- 烘 +- 蠕 +- te +- 诽 +- 重 +- 翠 +- 珑 +- 慰 +- 鲍 +- 勣 +- 袱 +- 瑙 +- tly +- 庆 +- government +- 荦 +- 阗 +- 烫 +- 倓 +- 俏 +- 鸹 +- 倦 +- ound +- co +- 竟 +- 腋 +- 昙 +- 濂 +- 啋 +- 揶 +- 泣 +- 郾 +- 垍 +- 轳 +- 某 +- 酎 +- 板 +- 晤 +- 廑 +- 奶 +- 醴 +- 镑 +- 讣 +- 缤 +- 龅 +- 畿 +- 脁 +- ma +- 醢 +- 嗟 +- 丗 +- 殿 +- 魅 +- 熨 +- wr +- 嚷 +- 彤 +- 栎 +- americ +- 谡 +- 泽 +- 柬 +- 髎 +- 盆 +- 诅 +- 瘁 +- 萘 +- 喁 +- 媒 +- 忸 +- 阍 +- 曡 +- 裰 +- 锦 +- something +- 犋 +- 爱 +- 煺 +- 揉 +- 苇 +- 嘈 +- 胪 +- 铁 +- 屁 +- 颂 +- 锩 +- 骅 +- 渌 +- 邱 +- 脬 +- 滏 +- 罹 +- 散 +- 鼹 +- 父 +- 摔 +- 边 +- 申 +- 苛 +- 敝 +- 冈 +- 蕈 +- 郕 +- 耨 +- 闳 +- 逄 +- 拔 +- 将 +- fe +- 鲂 +- 颙 +- '0' +- room +- 胙 +- 澍 +- 媚 +- 廪 +- 量 +- 贩 +- 镕 +- nine +- 恚 +- 鹾 +- 旃 +- 铵 +- 堺 +- 剑 +- ket +- 支 +- 墙 +- 洒 +- 俳 +- ors +- 诐 +- 黟 +- 珩 +- 跻 +- 浸 +- 孟 +- mp +- 狷 +- 踌 +- 渎 +- 逝 +- 颁 +- 务 +- 羹 +- 羖 +- 阽 +- 跪 +- 褒 +- 乜 +- 择 +- 盩 +- 鸭 +- 抗 +- 递 +- 褪 +- 怂 +- cou +- 蟠 +- cen +- 傜 +- 砍 +- 鲔 +- 蹙 +- restaurant +- 杆 +- 茵 +- 尊 +- 耻 +- 淮 +- 躜 +- 蜡 +- 嘱 +- 谩 +- 蝗 +- 堞 +- 姨 +- happ +- 铿 +- 楝 +- park +- 力 +- 殊 +- 畹 +- say +- 练 +- 纱 +- 溪 +- 虮 +- 篑 +- 蜱 +- 惜 +- 跌 +- 啁 +- 溜 +- 饼 +- 裥 +- 勇 +- 柱 +- 惨 +- 陟 +- 殪 +- 安 +- 徼 +- 纛 +- 痍 +- 谨 +- 取 +- 犒 +- 鄄 +- 粟 +- 眨 +- 坤 +- 妤 +- 剟 +- 雉 +- 傩 +- 嫄 +- 嘧 +- 咽 +- 愀 +- 簸 +- 赏 +- 箾 +- 龈 +- 放 +- 菅 +- 坚 +- 奠 +- 黢 +- 琴 +- 潞 +- 朝 +- tually +- 铞 +- 乇 +- 醪 +- 潍 +- 槊 +- 纯 +- 瀹 +- 诋 +- 慢 +- 奸 +- 嘭 +- 揠 +- 昃 +- 革 +- 司 +- ce +- 趵 +- 醮 +- 碘 +- 器 +- 澶 +- 知 +- '&' +- 厢 +- 啷 +- 晔 +- 炜 +- ook +- 斐 +- 盏 +- 妻 +- 娣 +- 燋 +- 窈 +- 法 +- also +- 菸 +- 炽 +- 选 +- 埕 +- 击 +- 滤 +- 铖 +- 觎 +- 莩 +- le +- 匏 +- 踅 +- 酸 +- 鹑 +- enjoy +- 闰 +- 毡 +- 祆 +- 身 +- 郊 +- 笄 +- 乖 +- 甩 +- like +- 否 +- 厖 +- 爹 +- 牦 +- 起 +- 僔 +- 钓 +- 浚 +- 忙 +- get +- 冯 +- 樊 +- 识 +- 蹉 +- 鑫 +- 畚 +- 滕 +- 掮 +- 尾 +- war +- 桶 +- 瓢 +- 毫 +- 膊 +- 髌 +- 钗 +- 桼 +- 碲 +- 辨 +- 唉 +- 竲 +- 痰 +- 膻 +- 锖 +- 嘡 +- 雩 +- 版 +- 昧 +- 敬 +- 蕨 +- 伴 +- 徍 +- 襀 +- 盘 +- 憷 +- 涑 +- different +- after +- 虽 +- 何 +- 煎 +- 宽 +- ori +- 攀 +- 冢 +- 零 +- 樯 +- 哌 +- 瓣 +- 馍 +- 唰 +- 炪 +- 旰 +- 厔 +- 葵 +- 痞 +- 己 +- 靓 +- 凄 +- 服 +- 烤 +- 仮 +- 恨 +- 喳 +- 贯 +- 郞 +- 饪 +- 铄 +- 滠 +- 蠢 +- 薅 +- 齑 +- 褓 +- 黼 +- 涿 +- n't +- 磬 +- 匾 +- 沂 +- 镳 +- nice +- 浯 +- 悝 +- 淫 +- 捅 +- 箨 +- 瞀 +- 勠 +- 屐 +- 蹁 +- 蹦 +- 槿 +- 类 +- 栉 +- 脘 +- 页 +- 桕 +- 脊 +- 欲 +- 蝽 +- 勃 +- 坷 +- 酶 +- 售 +- 縻 +- 欺 +- 膏 +- 词 +- 兢 +- 楸 +- 娡 +- 娩 +- 陡 +- ple +- 尧 +- 幷 +- 豉 +- 桫 +- 滁 +- 麋 +- 罘 +- 朕 +- 耗 +- 汉 +- 登 +- 较 +- 逾 +- 蔫 +- 赳 +- 秭 +- 咫 +- 斑 +- 跚 +- 舒 +- 莞 +- 闾 +- 氤 +- 骸 +- 槩 +- 瓶 +- 餐 +- 瞪 +- 沉 +- 朱 +- had +- 鲣 +- 嵪 +- nothing +- 嫡 +- 恍 +- 衢 +- 轴 +- 杈 +- 赂 +- 津 +- red +- 拤 +- 狠 +- 卣 +- 蚱 +- 疆 +- 捞 +- 婉 +- 固 +- 梶 +- 垸 +- 逋 +- 髡 +- 晓 +- 骶 +- 季 +- 炀 +- 喷 +- 垛 +- 蜂 +- sts +- 阝 +- 未 +- 熬 +- 绲 +- 坟 +- 苈 +- are +- 寮 +- 吧 +- 皖 +- 捌 +- 炤 +- b +- the +- 哈 +- 鞍 +- ir +- 掘 +- tation +- 噙 +- 酊 +- 忄 +- 硼 +- 耕 +- 偎 +- 雎 +- 磴 +- 锺 +- over +- 侃 +- 婚 +- 吗 +- 竺 +- man +- 也 +- 苣 +- 绛 +- 冤 +- 呈 +- 孱 +- 缭 +- 埼 +- 犬 +- 麦 +- 蓐 +- 技 +- 夜 +- tri +- 杭 +- 佝 +- 莨 +- di +- 毙 +- 贿 +- 猎 +- 桡 +- so +- 氖 +- 叼 +- 哚 +- 濠 +- 湾 +- 全 +- 读 +- 盐 +- 钚 +- 鬘 +- 万 +- 鲠 +- 貂 +- 鋐 +- 堼 +- 茺 +- 拟 +- 牡 +- 蝮 +- 镢 +- 嚯 +- 束 +- 喱 +- 彿 +- col +- 仃 +- 涌 +- 蚯 +- 妩 +- 箢 +- 隹 +- 亰 +- 疃 +- 嬗 +- 喇 +- 攒 +- am +- 听 +- fe +- zero +- 痛 +- 诗 +- 干 +- 疫 +- 嬴 +- 降 +- 签 +- 丈 +- sm +- 髑 +- 劬 +- 萏 +- 诀 +- 镵 +- 坭 +- 咤 +- 池 +- 榼 +- 岕 +- 崃 +- ined +- chu +- 糸 +- 祸 +- 猜 +- 婿 +- 搋 +- 咛 +- 箴 +- 辚 +- 悄 +- 荒 +- 挑 +- 托 +- drive +- 撇 +- 莒 +- 鄜 +- 冒 +- 稹 +- 户 +- ould +- 铤 +- 翃 +- try +- 圊 +- 艿 +- 桐 +- 兒 +- 揿 +- 堋 +- 档 +- ink +- email +- 犍 +- 铍 +- 招 +- 鳇 +- 敲 +- 雳 +- 奌 +- 裝 +- 戏 +- 哗 +- 栱 +- 哆 +- ds +- 浙 +- 岂 +- 挝 +- 莲 +- 腩 +- 杬 +- 促 +- 斥 +- 蛱 +- 诓 +- 炖 +- 璘 +- 怵 +- 礽 +- 咬 +- 珐 +- 韡 +- 邺 +- 祀 +- 皇 +- 渑 +- 困 +- 潜 +- 添 +- ter +- che +- 如 +- 萹 +- 熙 +- 扇 +- 亭 +- 亍 +- 瘗 +- 舍 +- 皌 +- 诌 +- 虢 +- 欣 +- 掰 +- 棘 +- 岞 +- 毽 +- 卵 +- 罴 +- 疋 +- ali +- 整 +- i +- 紫 +- mu +- 涘 +- 携 +- 奏 +- cri +- 馘 +- 翘 +- 抚 +- 筝 +- 玄 +- 霎 +- 铮 +- 澹 +- 嫰 +- 夏 +- 咿 +- 围 +- 従 +- 猾 +- pre +- 逊 +- 糖 +- 漫 +- 聍 +- 及 +- 瘵 +- 绢 +- 棱 +- 笈 +- 铯 +- 釭 +- 恼 +- 癎 +- 苢 +- 斁 +- 醣 +- 植 +- 鱼 +- 涓 +- z +- 目 +- par +- 撬 +- 戎 +- 偓 +- 已 +- 打 +- busine +- 桦 +- 庇 +- 坪 +- problem +- 舾 +- centr +- fifty +- 梧 +- 𫖯 +- restaurants +- beau +- fac +- 谈 +- 腙 +- 阉 +- 孛 +- 秘 +- 庶 +- 畴 +- 例 +- ang +- 幛 +- 下 +- 溅 +- 彗 +- 魟 +- 诏 +- 鸢 +- 邽 +- 瘪 +- ay +- 胱 +- 勒 +- 槲 +- 橹 +- 男 +- ide +- 治 +- 锒 +- 祯 +- 慌 +- 佥 +- 苔 +- 暴 +- 时 +- 撩 +- 俶 +- 屋 +- 抠 +- 嫘 +- 浔 +- 鲻 +- 暌 +- 窿 +- 炒 +- 溇 +- 髯 +- 簿 +- 嶖 +- 峒 +- si +- 觥 +- 午 +- 联 +- ty +- 猫 +- 腭 +- 晻 +- 袝 +- 戾 +- 波 +- 啐 +- 戈 +- 蒎 +- 麓 +- 汾 +- 茉 +- 埔 +- 蛳 +- 徳 +- 鸶 +- 艇 +- 顶 +- 髻 +- 徒 +- 豨 +- 碳 +- 欻 +- 薰 +- hi +- 呲 +- 舳 +- 劾 +- 形 +- '''' +- 渥 +- 羔 +- 枇 +- 模 +- 弁 +- 坏 +- 徊 +- 馗 +- 刨 +- 璀 +- 锤 +- 钤 +- 囔 +- 拦 +- 剐 +- 揸 +- 滈 +- 缚 +- ach +- 斯 +- 诒 +- 寂 +- 裒 +- 同 +- should +- 蒴 +- 窑 +- 示 +- 戗 +- 录 +- 恶 +- 培 +- 迦 +- 邮 +- 熜 +- 泊 +- 乌 +- 篌 +- center +- 癸 +- 昔 +- 牠 +- 濛 +- 噻 +- 苋 +- ang +- give +- 姥 +- 祖 +- 搬 +- 悠 +- 瓒 +- 嫱 +- wit +- 畏 +- 神 +- 湟 +- 扃 +- 桀 +- 醭 +- 谘 +- 虾 +- 玳 +- 斡 +- 寥 +- 攻 +- 忑 +- man +- 僻 +- money +- 飊 +- 国 +- 吠 +- 扦 +- j +- 幹 +- 泛 +- 摈 +- 匼 +- 廉 +- 通 +- 袍 +- 楹 +- 搦 +- 缮 +- ft +- 岱 +- scho +- 丹 +- 蜗 +- 蓓 +- 卟 +- 倥 +- 喽 +- 蛾 +- 殭 +- 绣 +- chan +- 震 +- 棍 +- 潋 +- 葫 +- 嚎 +- ed +- 漉 +- 阻 +- 俐 +- 德 +- 様 +- 酝 +- 倒 +- 橱 +- send +- 谯 +- 嗐 +- 署 +- 贴 +- 搭 +- 坦 +- 蹯 +- 緛 +- 队 +- 死 +- 閟 +- 岭 +- 倪 +- 诜 +- 偱 +- 醐 +- 痊 +- 社 +- 凡 +- 畯 +- 摒 +- 迭 +- 措 +- 挌 +- 媛 +- same +- 蚓 +- 擤 +- 澈 +- 眈 +- 剪 +- 嫣 +- 鹱 +- 娆 +- 凸 +- 厅 +- 臼 +- 枭 +- 炎 +- 烊 +- 掀 +- 洄 +- 僳 +- velo +- 觉 +- 逼 +- have +- 皎 +- 酯 +- 怦 +- 叶 +- 统 +- thir +- 从 +- 纡 +- les +- 术 +- 径 +- 征 +- come +- 躅 +- 此 +- 甜 +- 践 +- br +- 鎸 +- 讲 +- 玲 +- 衣 +- 麾 +- 枥 +- 拈 +- 腮 +- reas +- 芩 +- 鹖 +- more +- 儆 +- 愕 +- 淏 +- 躄 +- 玕 +- 届 +- 永 +- 哟 +- 虓 +- sit +- 宴 +- 夷 +- 梭 +- 紧 +- 瘰 +- recei +- 匐 +- 号 +- from +- 况 +- 畋 +- 谜 +- 莽 +- 锣 +- pas +- 驽 +- 昱 +- 喟 +- v +- 呀 +- '''re' +- 阒 +- 踬 +- 认 +- 订 +- 黝 +- 筻 +- seven +- 们 +- 舱 +- 揭 +- 妾 +- 礼 +- 高 +- 传 +- 香 +- 谬 +- 篆 +- 逮 +- 玑 +- 眄 +- 驿 +- all +- 嗅 +- 五 +- 淹 +- 裨 +- 咕 +- 焖 +- 氚 +- ari +- 崤 +- 接 +- 沈 +- 寰 +- 轻 +- 旒 +- 维 +- test +- 麴 +- 枱 +- 挚 +- 句 +- 驾 +- 筷 +- 坂 +- 须 +- 鼩 +- 炳 +- 推 +- 姿 +- 溴 +- 庠 +- 箻 +- 燹 +- 拂 +- 呱 +- 愫 +- 袤 +- 睑 +- 眩 +- 冷 +- 葸 +- but +- 睢 +- 掣 +- 唠 +- 陈 +- 喉 +- 晬 +- 溯 +- 艺 +- 苦 +- 腐 +- 蟹 +- 燃 +- 候 +- 伸 +- 萝 +- 汭 +- 6 +- 僭 +- 蘖 +- 瘫 +- 书 +- 控 +- 乪 +- 溘 +- 痦 +- lo +- 蝣 +- 啂 +- 缩 +- part +- 只 +- 施 +- 鸨 +- 鎏 +- 悕 +- 诵 +- 孬 +- 獾 +- 玩 +- 汪 +- ary +- 吁 +- 拄 +- 诟 +- 扰 +- 鼎 +- 珪 +- 橇 +- 隍 +- close +- 姑 +- ty +- 迹 +- 骆 +- 崐 +- go +- 勺 +- 倜 +- ble +- 盥 +- 剂 +- qu +- 圻 +- 荧 +- 荣 +- 疵 +- 酪 +- 稗 +- 幔 +- 井 +- 蛭 +- 泔 +- 定 +- q +- 楱 +- 刈 +- 使 +- 潟 +- 螅 +- 铒 +- 巇 +- 呖 +- 垂 +- 啉 +- 戮 +- 佉 +- 寓 +- 翚 +- 啪 +- fa +- w +- 绐 +- 抛 +- 謷 +- 忐 +- 趿 +- 位 +- 螨 +- last +- 迫 +- 爷 +- 碎 +- 廊 +- 啮 +- 柯 +- 酰 +- 烜 +- 煳 +- 粲 +- 求 +- 楞 +- 考 +- 挲 +- 触 +- 荽 +- 荫 +- 疴 +- 遨 +- 仫 +- 瑭 +- 扩 +- 恭 +- 藦 +- 羣 +- 味 +- 缀 +- 享 +- 枣 +- 宠 +- 浊 +- back +- 扪 +- 篥 +- sou +- 涉 +- son +- 翔 +- 讫 +- 理 +- 玙 +- 栩 +- 闩 +- 龄 +- 亢 +- 桄 +- sil +- 幡 +- 婀 +- 脚 +- 疠 +- 歔 +- 兰 +- 査 +- 镗 +- 涎 +- 霏 +- 待 +- 忻 +- 警 +- 科 +- 脐 +- 琚 +- 真 +- own +- 醚 +- 绡 +- ices +- 嶷 +- 胶 +- u +- 峦 +- 箜 +- 丰 +- 痨 +- 衡 +- 锋 +- 宦 +- 皦 +- 感 +- 矮 +- 爨 +- 亟 +- 装 +- 鹁 +- 房 +- 捡 +- 乐 +- 胫 +- 彧 +- kil +- 葛 +- 氏 +- 捋 +- 戢 +- 牢 +- '5' +- dis +- 园 +- 孓 +- 柃 +- 榄 +- 喺 +- 悛 +- 俢 +- c +- 缢 +- 富 +- je +- 竭 +- way +- 拙 +- 牧 +- 阋 +- 究 +- 钘 +- 濮 +- 皙 +- 问 +- 告 +- 鞅 +- 燚 +- 肴 +- 螭 +- 篁 +- 当 +- 洮 +- 渠 +- 码 +- 辗 +- 慨 +- 崇 +- 诫 +- 意 +- 姤 +- 飓 +- 噬 +- 铐 +- 寡 +- 咨 +- 伺 +- 殓 +- 容 +- 蚁 +- 柏 +- 枧 +- 瑗 +- 挛 +- 绔 +- 月 +- 绾 +- 隘 +- 僖 +- 纇 +- 握 +- 耜 +- 舐 +- tom +- 旅 +- 翮 +- products +- 缑 +- 肄 +- 闿 +- 硫 +- 砚 +- 蜚 +- bu +- 鍉 +- 晗 +- 阃 +- 衾 +- 蝴 +- 丽 +- 髅 +- 煜 +- 习 +- 窃 +- 芑 +- 櫈 +- ru +- deta +- 谌 +- 俄 +- 桨 +- 芦 +- 泵 +- 企 +- 粽 +- 揣 +- 领 +- qui +- 鄚 +- 肱 +- 尼 +- 滦 +- 椽 +- 癜 +- 甄 +- local +- fol +- 偿 +- 丸 +- 涞 +- 铜 +- du +- 噜 +- 倬 +- 珣 +- 圜 +- 墅 +- car +- 撂 +- 栀 +- 评 +- 螽 +- 蘑 +- 扬 +- 挨 +- 轵 +- 殇 +- 酺 +- high +- ach +- 鲛 +- 啥 +- think +- don't +- 表 +- cho +- 盈 +- 啊 +- 怔 +- 滉 +- 艮 +- 徽 +- 撸 +- 淯 +- 茈 +- 硚 +- 桢 +- 魍 +- 潸 +- at +- 仄 +- 鹭 +- 沅 +- 操 +- 炭 +- 砝 +- 之 +- 讷 +- 吔 +- 疰 +- 葚 +- 夭 +- 跶 +- 蘼 +- 鲩 +- 滴 +- 菘 +- 滨 +- 加 +- 倾 +- 体 +- 茕 +- 髀 +- 雅 +- ile +- 欠 +- 崧 +- 囤 +- 僦 +- 守 +- 辂 +- 棂 +- se +- 捶 +- 扛 +- 铠 +- 铩 +- 京 +- 熘 +- 洛 +- 娄 +- the +- 痿 +- 箱 +- 驮 +- 礅 +- 郃 +- 谣 +- ack +- 晴 +- res +- lot +- 纲 +- 诖 +- ways +- 谋 +- 煌 +- 绗 +- 炼 +- 卤 +- 屄 +- 界 +- 拶 +- ar +- 遠 +- 周 +- 驩 +- 肖 +- 跖 +- 莳 +- 级 +- 咣 +- hu +- 啕 +- 歀 +- 忤 +- 临 +- many +- 募 +- ned +- their +- 睿 +- 冥 +- 久 +- 巍 +- 堇 +- 洽 +- 郎 +- 董 +- this +- 毒 +- 醉 +- ton +- 诶 +- 旺 +- 蛉 +- 规 +- 琶 +- 騑 +- 捉 +- imp +- 尥 +- 拗 +- e +- 歆 +- 刀 +- 跆 +- three +- 锢 +- 侏 +- 拳 +- 扤 +- 饨 +- 剥 +- 潡 +- 俊 +- 嗤 +- 穑 +- 地 +- 情 +- 憔 +- 惹 +- 奢 +- inclu +- mo +- 铭 +- 至 +- 浐 +- 祎 +- really +- 帆 +- dri +- 楮 +- 邬 +- 弛 +- 篮 +- 兮 +- up +- 慧 +- 腆 +- 碴 +- 挂 +- 计 +- 豚 +- 滑 +- indi +- into +- 褭 +- 酞 +- t +- 符 +- 彼 +- 涔 +- body +- ins +- 漶 +- 峪 +- down +- 缓 +- 剀 +- 福 +- 叮 +- wa +- 失 +- 隅 +- 怄 +- 扳 +- great +- 泰 +- 娌 +- 孙 +- 彬 +- 毁 +- 蛲 +- 萱 +- 泻 +- 舀 +- dge +- 瞅 +- vo +- 咆 +- 祜 +- 枋 +- 憩 +- 文 +- gro +- 倮 +- 鹄 +- all +- 槎 +- 忆 +- 絯 +- 裢 +- two +- 兑 +- 明 +- 遥 +- 窍 +- 吃 +- it's +- 启 +- 妽 +- 郅 +- ies +- centre +- 吒 +- 亿 +- 雲 +- ask +- 叩 +- 媜 +- 蚰 +- 奄 +- 垡 +- 椿 +- 篡 +- 聘 +- 窖 +- 垩 +- diffe +- 购 +- 褥 +- 豸 +- 腠 +- 咦 +- 眦 +- 敏 +- 鼐 +- 昉 +- 顽 +- 琊 +- 砌 +- 僮 +- 乱 +- 瞒 +- 撑 +- 羲 +- 纳 +- 赞 +- 焐 +- 橛 +- 嵩 +- 陀 +- 楔 +- 牛 +- 鹊 +- 帽 +- may +- 偬 +- 丫 +- 兜 +- 砰 +- 濡 +- 獬 +- 好 +- 腿 +- 靶 +- 木 +- 唸 +- 纹 +- 裹 +- cl +- hund +- 优 +- 猲 +- 焯 +- 岘 +- 辱 +- 丞 +- 查 +- 秽 +- 胀 +- 鳖 +- 岈 +- 喒 +- 默 +- 见 +- forty +- 纥 +- 泚 +- 驳 +- 铃 +- 萋 +- 筱 +- 蛏 +- 琲 +- 鸵 +- 这 +- 链 +- read +- 垵 +- 踦 +- 奭 +- 別 +- 软 +- 盲 +- 黛 +- 纤 +- chil +- 扱 +- 狡 +- 贽 +- 贻 +- 鳏 +- 篓 +- der +- 滢 +- 嵌 +- 妺 +- 臭 +- 谥 +- 夯 +- 韬 +- 惺 +- 检 +- 峨 +- ms +- 胛 +- 恫 +- 构 +- 鹂 +- 刺 +- 讦 +- 唬 +- 梈 +- 捯 +- 由 +- 志 +- 达 +- 梢 +- 歉 +- al +- 淳 +- 般 +- 恐 +- 獗 +- 央 +- 喔 +- 蟀 +- 伞 +- sh +- '''s' +- 姮 +- 痈 +- ck +- 俾 +- 髫 +- 蜒 +- 愧 +- 呆 +- mer +- 桤 +- 鬏 +- 型 +- 四 +- 哖 +- 龋 +- 鳔 +- 骗 +- 砷 +- 泷 +- 猷 +- 茯 +- 茁 +- cha +- small +- 倨 +- 乎 +- 奕 +- 鹅 +- 痉 +- 奥 +- 辙 +- sting +- 冲 +- 赅 +- 泅 +- 羰 +- 悲 +- 焘 +- 瞵 +- 紊 +- 卖 +- take +- 鳐 +- 菊 +- 姸 +- 辐 +- 嘻 +- fast +- 囿 +- 凫 +- 纵 +- 咝 +- 箧 +- well +- 钬 +- he +- 辕 +- 鹜 +- unk +- 诔 +- 泐 +- 世 +- 镖 +- 骄 +- ve +- 寸 +- pay +- 鴂 +- 睐 +- 氲 +- 牟 +- 洏 +- 尔 +- quo +- 椭 +- 芨 +- 险 +- 耳 +- 柁 +- 牾 +- 蚂 +- much +- most +- now +- singapore +- 丙 +- 洋 +- 燊 +- 啵 +- 胬 +- 媾 +- 碟 +- 濆 +- 陇 +- 扥 +- 势 +- 慷 +- 笋 +- 泥 +- 鄘 +- hote +- 罕 +- 沤 +- 葡 +- 蠡 +- 产 +- 鲵 +- 凉 +- 萆 +- 籽 +- 胞 +- 哦 +- 侠 +- 晚 +- 咵 +- 杯 +- 邗 +- 甑 +- 胁 +- 历 +- 嘏 +- 喘 +- is +- 霉 +- 仇 +- 鳀 +- 鉴 +- 猛 +- 纂 +- 决 +- 阏 +- 饯 +- 宣 +- 象 +- 儿 +- 猗 +- 瀑 +- 荚 +- 满 +- 茳 +- 酷 +- 鼬 +- 旁 +- 屡 +- 榇 +- s +- 呷 +- 驻 +- 薮 +- 鹏 +- 馋 +- 鹪 +- 纠 +- thank +- 轶 +- 渺 +- 镁 +- cost +- 汐 +- 谅 +- 甫 +- publi +- 储 +- 抹 +- 杨 +- 裳 +- 歙 +- 鏊 +- 犼 +- 蹐 +- 愦 +- 断 +- able +- ind +- 狂 +- 雒 +- 妧 +- 巴 +- 嘟 +- 筵 +- 喤 +- 舫 +- 刃 +- fi +- company +- 郿 +- 瞢 +- 褰 +- 清 +- 巿 +- 苕 +- 内 +- 暾 +- 垠 +- 戌 +- 溟 +- 剋 +- 葶 +- 猡 +- 蔺 +- 岖 +- 邕 +- any +- pri +- 卸 +- 基 +- 馒 +- 出 +- 柞 +- 溍 +- 吨 +- 蜥 +- 炟 +- 徂 +- inve +- 桂 +- frien +- 铪 +- 庖 +- 廋 +- 誉 +- 嗡 +- 忘 +- i' +- 螃 +- 胯 +- un +- 铨 +- 酹 +- 鷃 +- wi +- 眚 +- 跤 +- 汁 +- 针 +- 钏 +- 雀 +- 限 +- 面 +- 蛐 +- 黃 +- 脩 +- 叛 +- 枷 +- 故 +- sk +- 编 +- 菥 +- 勐 +- 汗 +- 胃 +- 洗 +- 洹 +- ers +- 髦 +- 宏 +- 聊 +- 嵫 +- 囎 +- 淠 +- 垧 +- 欧 +- oms +- 揵 +- before +- 畈 +- 饬 +- 秦 +- 莓 +- 努 +- 炔 +- 匠 +- 际 +- 蕉 +- 蝇 +- po +- 匽 +- year +- 橥 +- pping +- 注 +- 承 +- 琨 +- 又 +- 玉 +- 彖 +- 缸 +- 怒 +- 遏 +- 坍 +- sta +- 痹 +- 埆 +- 叵 +- 氟 +- 脂 +- 昭 +- ments +- 宕 +- 盅 +- 惩 +- 馁 +- 绕 +- 遢 +- 扫 +- 蔡 +- 崾 +- 阎 +- 葳 +- 殂 +- 潢 +- 每 +- ro +- 靖 +- 主 +- tional +- 闸 +- 涖 +- 第 +- n +- 镅 +- 蜜 +- 能 +- 衄 +- 猹 +- 鹰 +- 俘 +- 豪 +- 人 +- 痱 +- 蓑 +- 骒 +- 所 +- 绨 +- 粦 +- 望 +- 减 +- 魔 +- 释 +- ars +- 逑 +- clo +- 帏 +- 遘 +- 许 +- 誓 +- 牤 +- 刷 +- 扒 +- 峻 +- 9 +- 昕 +- 轩 +- 嬷 +- them +- 窗 +- 蹄 +- 骰 +- 湓 +- 堨 +- 巂 +- 婧 +- 骖 +- 螬 +- 酋 +- ag +- 闷 +- 滞 +- 郧 +- 朴 +- supp +- 倡 +- 腴 +- 褴 +- 极 +- 漷 +- 佾 +- 煨 +- 沚 +- 肓 +- experi +- 亮 +- 堕 +- 对 +- 秋 +- every +- 铅 +- 蛴 +- 擅 +- a +- 鳃 +- 保 +- ze +- 弓 +- 趄 +- 翦 +- 涛 +- 盗 +- 道 +- 遮 +- 屿 +- 绥 +- cont +- 部 +- den +- 付 +- 诮 +- 粘 +- 镔 +- 溏 +- 啬 +- 贫 +- 轼 +- 猩 +- 薯 +- 胳 +- 抻 +- than +- king +- 燎 +- 笫 +- 鸂 +- 蓊 +- 峋 +- ent +- 搡 +- 磡 +- 昌 +- 妈 +- 玺 +- 叫 +- 済 +- 彩 +- lim +- 孀 +- 囧 +- we +- 绒 +- 驸 +- 架 +- 斛 +- 资 +- 碣 +- 濞 +- 冿 +- 吡 +- 作 +- because +- 晏 +- 餍 +- 瞾 +- 栊 +- 蹿 +- 荩 +- 尖 +- 依 +- 氍 +- 炝 +- 抡 +- 中 +- 潏 +- 潦 +- mon +- 域 +- 杩 +- 兼 +- 捎 +- 怩 +- 正 +- f +- near +- 刮 +- 搪 +- 鸿 +- 俺 +- 耪 +- 牯 +- 瞎 +- 鬼 +- 惠 +- bro +- 沛 +- 浃 +- pe +- 釜 +- vi +- jal +- 拴 +- 冇 +- 暎 +- 魉 +- 痘 +- 盔 +- 枚 +- 秾 +- 杲 +- 郛 +- 僚 +- 昞 +- 足 +- sen +- family +- 岿 +- 榖 +- 蛊 +- 绯 +- 村 +- 鹃 +- 钼 +- 拓 +- dly +- 苫 +- 锄 +- 跎 +- 碰 +- 钝 +- 淆 +- 鳟 +- 浓 +- 柇 +- 桷 +- 愬 +- 裔 +- 邃 +- 恂 +- 楙 +- 沨 +- ban +- ssi +- 鳞 +- 褛 +- 钌 +- y +- 搀 +- 骺 +- 坊 +- 娘 +- 鄯 +- 袈 +- 匡 +- 厦 +- 艘 +- 障 +- 舂 +- 蹼 +- 材 +- 胡 +- 痄 +- 凖 +- 憋 +- ll +- 睥 +- 窦 +- 砕 +- 雇 +- 個 +- 籀 +- 饥 +- 价 +- 笞 +- 鞴 +- 筊 +- 树 +- 揖 +- 派 +- 垄 +- 檬 +- 眠 +- 偌 +- 闯 +- 姘 +- 少 +- 破 +- 怿 +- 扼 +- 恽 +- 岔 +- 亲 +- 垕 +- 踱 +- 泳 +- 截 +- 轫 +- 烽 +- 够 +- 武 +- 差 +- 声 +- 可 +- 绫 +- 巅 +- 邯 +- 椎 +- 硭 +- 畀 +- 常 +- 沸 +- 榧 +- 忡 +- 妫 +- 皮 +- 讯 +- 铣 +- 轾 +- 衙 +- 蒙 +- 蕃 +- things +- 腓 +- 坐 +- 鞘 +- 榻 +- 霈 +- 垆 +- ous +- 粳 +- 枹 +- 薨 +- 胆 +- 龙 +- 绺 +- ning +- med +- 挹 +- 诨 +- 译 +- 但 +- 半 +- 辩 +- 芊 +- 变 +- 翻 +- 尹 +- 靸 +- 酬 +- 咶 +- 暧 +- 姝 +- 貘 +- 墓 +- 匙 +- been +- 墀 +- 芗 +- sc +- 妲 +- 狮 +- 岫 +- ants +- 谔 +- 鞭 +- 婶 +- one +- 踏 +- 讵 +- land +- 幼 +- 軎 +- 晕 +- wi +- 瑞 +- 供 +- 啯 +- 朵 +- 枓 +- 奘 +- 咩 +- 訢 +- 臆 +- 硗 +- 帖 +- dent +- 戽 +- 瘿 +- 段 +- 傅 +- oun +- 枞 +- 属 +- 野 +- 芫 +- 诣 +- 钐 +- 堀 +- uring +- 试 +- 衍 +- 馏 +- 龇 +- 讧 +- stre +- 妒 +- 驴 +- 著 +- 槭 +- 洧 +- side +- 氾 +- 孵 +- 狎 +- 歩 +- 囯 +- 愎 +- 过 +- pu +- right +- 赋 +- 阳 +- mber +- 谕 +- town +- 盾 +- 救 +- 饱 +- loc +- spa +- 橡 +- 剅 +- 蒲 +- 姐 +- 厕 +- 铚 +- 套 +- 弗 +- 栴 +- 鹨 +- 糨 +- 騕 +- 雷 +- 裁 +- 拌 +- 鼻 +- some +- 搐 +- 均 +- 蓣 +- ice +- 卢 +- ad +- 瘌 +- 湶 +- 氩 +- 谰 +- 缙 +- ard +- 栾 +- 迨 +- 浣 +- 秏 +- 萨 +- always +- 污 +- 踔 +- 杏 +- ded +- 髽 +- 秀 +- 湉 +- 粪 +- 展 +- 槻 +- 垓 +- 赫 +- 惮 +- lar +- 薷 +- 迈 +- p +- 塾 +- ga +- ey +- ho +- 恺 +- 晩 +- 泸 +- 茚 +- 嗰 +- 绳 +- lit +- 渍 +- 遇 +- 洑 +- 晞 +- 溽 +- ying +- 枸 +- 无 +- 逍 +- 珰 +- 纣 +- 罩 +- ons +- 嶃 +- 瑚 +- 裙 +- 搛 +- '6' +- 咾 +- 唱 +- 瑠 +- 睃 +- 於 +- din +- 伟 +- 骓 +- 函 +- 瘤 +- 僆 +- 鞣 +- 兕 +- 伄 +- 柚 +- 席 +- 峄 +- 鄱 +- 抔 +- an +- 物 +- loca +- 穸 +- 懊 +- '2' +- amer +- 稼 +- 叉 +- bra +- 拇 +- str +- res +- 沆 +- 饰 +- pen +- 厘 +- 傈 +- ality +- 廷 +- 式 +- 夔 +- 督 +- 雍 +- 晨 +- 剿 +- 赶 +- 疖 +- 砜 +- 归 +- min +- 徙 +- 阚 +- tions +- 女 +- 营 +- 邅 +- 做 +- 伊 +- er +- 筜 +- 蛎 +- business +- 顾 +- 瘸 +- 洪 +- 钕 +- 觯 +- 政 +- 劝 +- 撮 +- break +- 氛 +- 漾 +- sor +- 址 +- 帼 +- 增 +- ation +- 瞋 +- 稊 +- 慊 +- 肯 +- 躁 +- 糗 +- 美 +- 豕 +- us +- 炸 +- 饽 +- 挎 +- 挫 +- 枢 +- dr +- 铉 +- 奖 +- 槌 +- 绮 +- 擂 +- 虬 +- 钽 +- 胍 +- 凌 +- 辟 +- 虹 +- 铂 +- 杂 +- 砗 +- 赪 +- 潇 +- 合 +- 鰕 +- 吭 +- 迷 +- 滘 +- 弹 +- ff +- 痤 +- 蛄 +- 觱 +- 杳 +- 嘬 +- 偕 +- 赘 +- 烩 +- 孖 +- 钉 +- 龉 +- 钪 +- 睬 +- 撵 +- big +- 笠 +- 俅 +- 锯 +- 呛 +- 欹 +- cle +- 珈 +- 浑 +- 墕 +- hel +- 彪 +- 姊 +- 拆 +- 雄 +- hi +- 钴 +- 壑 +- 幇 +- 卧 +- 痧 +- 澴 +- 长 +- 船 +- 六 +- 继 +- 棷 +- 尞 +- 窨 +- 燥 +- 膦 +- 镝 +- 裸 +- 办 +- resta +- 廆 +- 宅 +- 蓉 +- 娑 +- 猪 +- 阁 +- 蟆 +- 恢 +- 讥 +- 蜾 +- of +- 怏 +- 笕 +- 瞽 +- 赤 +- 岁 +- 禺 +- 昀 +- 她 +- 钫 +- 慝 +- 滩 +- ack +- 跃 +- 贰 +- 巳 +- 寿 +- 铙 +- pro +- 朊 +- mor +- 箦 +- 丧 +- ready +- 止 +- 跺 +- 缉 +- 桅 +- 论 +- 摽 +- 状 +- 驷 +- 咂 +- 铢 +- 绎 +- 叨 +- 遁 +- 锨 +- 里 +- 笊 +- 缰 +- 嵊 +- 膘 +- 帕 +- 泱 +- 鳜 +- 嫒 +- 仅 +- 捕 +- 徵 +- each +- vil +- 媪 +- 袁 +- 裕 +- 佻 +- 赙 +- 末 +- 笔 +- 啲 +- 轺 +- 掞 +- 彭 +- 氢 +- got +- 缁 +- 蠊 +- 攉 +- 寻 +- 骋 +- 噤 +- ar +- 棣 +- 疣 +- 豳 +- 祠 +- 衩 +- 匀 +- 王 +- 觫 +- 庭 +- 亶 +- 篇 +- 铎 +- 咖 +- 禛 +- 艹 +- 哐 +- hope +- 系 +- 娇 +- 窄 +- 髓 +- 阱 +- 懿 +- 右 +- 离 +- 穴 +- 渣 +- 邨 +- 肸 +- 杞 +- 肚 +- 垗 +- 幕 +- ct +- 苊 +- 隼 +- wh +- 宋 +- 煤 +- 柸 +- 镋 +- 耘 +- kes +- 激 +- 痣 +- work +- 吽 +- 彟 +- 株 +- 筐 +- 贸 +- 尕 +- ere +- 潬 +- 矣 +- 縢 +- 瑄 +- 油 +- 満 +- 漆 +- rooms +- 霞 +- 咏 +- e +- 珮 +- 仡 +- 眶 +- 醛 +- 票 +- 鼓 +- 突 +- ia +- hundred +- 瓯 +- 尬 +- no +- 西 +- 潴 +- 楪 +- 傍 +- 蜘 +- 'yes' +- 蛀 +- sig +- gs +- 筮 +- 因 +- 谳 +- bur +- 跹 +- 鲑 +- 惑 +- 肋 +- dy +- 螟 +- 霓 +- 眼 +- 郇 +- 宙 +- 畲 +- 刬 +- 翟 +- 诧 +- 跫 +- or +- 颅 +- 跷 +- 淅 +- 臑 +- 楦 +- 屯 +- 走 +- 羸 +- you +- 咘 +- als +- 斤 +- 畔 +- 晧 +- 忠 +- 肥 +- 实 +- 凋 +- 褶 +- ba +- 摆 +- 熊 +- 篝 +- 乃 +- 绑 +- 沟 +- 瞿 +- 哜 +- 舶 +- 甘 +- 事 +- 瑛 +- 踧 +- 黯 +- 鲞 +- cal +- 璩 +- enty +- 剧 +- 洿 +- 孳 +- 祓 +- 天 +- 岑 +- 拾 +- nineteen +- cause +- 愇 +- 翁 +- 瞟 +- 昆 +- 弢 +- 摛 +- 义 +- 咸 +- 勮 +- 伪 +- 瑱 +- 橄 +- 丘 +- 铧 +- 怖 +- 终 +- 膨 +- 5 +- 扮 +- to +- 猕 +- 琬 +- 群 +- 叁 +- 狄 +- 眵 +- 烹 +- 蚝 +- 儒 +- 援 +- ber +- '1' +- 掾 +- 裂 +- 藓 +- r +- squ +- 鲁 +- 潺 +- 晷 +- 消 +- 鸸 +- 觊 +- 诡 +- 却 +- as +- 弼 +- 脰 +- 铷 +- 册 +- 懵 +- 啜 +- 涣 +- 扈 +- 垚 +- 森 +- 赵 +- 垫 +- 镪 +- 怼 +- 峁 +- 惚 +- 缄 +- ass +- 诼 +- tive +- never +- 昇 +- ence +- 耍 +- 异 +- 朐 +- 枕 +- 襻 +- 契 +- 祈 +- 骜 +- 羯 +- 豁 +- 瘕 +- 贲 +- 禥 +- 哔 +- 祁 +- 螫 +- 锆 +- 孕 +- st +- 忏 +- 掏 +- 昵 +- 哪 +- 鹞 +- 疍 +- 遄 +- 蠲 +- 恹 +- 狩 +- 憾 +- 悫 +- 弦 +- 脾 +- soci +- 爸 +- home +- 奔 +- 懂 +- 爿 +- 帙 +- 襦 +- 除 +- ters +- ted +- 景 +- 昚 +- eas +- ven +- 蹩 +- ac +- 歇 +- fas +- 抄 +- 牌 +- 浦 +- 榭 +- lan +- 巺 +- 刁 +- secon +- 顒 +- 个 +- 鲒 +- 嗨 +- out +- 凤 +- 褫 +- 瑮 +- 珏 +- 惦 +- 斝 +- 监 +- 土 +- did +- date +- 陋 +- 眉 +- 湴 +- 谎 +- 撖 +- 礞 +- 抑 +- 旻 +- 倩 +- 蟑 +- produ +- 忍 +- free +- 瓜 +- 康 +- 晾 +- 偏 +- 麇 +- 缱 +- 唏 +- 杪 +- 戥 +- 坳 +- 皲 +- 拘 +- 簋 +- 怆 +- 负 +- 陬 +- 埽 +- 皞 +- 素 +- 锐 +- 苘 +- 菀 +- 嚜 +- 免 +- 嫌 +- 靡 +- d +- 尪 +- 颧 +- 苷 +- de +- inc +- 策 +- 浠 +- 窾 +- 么 +- 壁 +- pi +- 荟 +- 愣 +- 砫 +- 巻 +- ke +- 旌 +- 咉 +- 矢 +- 婺 +- 绝 +- 线 +- 奂 +- 袋 +- 喻 +- 贡 +- 鍒 +- 逛 +- days +- 疟 +- 筇 +- 髃 +- 锛 +- 俱 +- 缅 +- 锊 +- 骟 +- belie +- 跏 +- 岜 +- 睚 +- 蜊 +- 铝 +- 闭 +- 麈 +- 趺 +- 锜 +- 彻 +- 缟 +- 甭 +- 苞 +- 钥 +- ph +- ef +- 灼 +- 銮 +- 塍 +- 淙 +- 鸷 +- 撼 +- 浒 +- though +- 或 +- av +- 荇 +- 要 +- road +- wn +- 纺 +- 师 +- 裇 +- 颚 +- end +- 汜 +- 驰 +- '8' +- 椹 +- 牂 +- ties +- 侪 +- 樉 +- 扎 +- 吞 +- 蕤 +- 垦 +- 茜 +- 泌 +- wor +- 艋 +- 次 +- 珙 +- 建 +- 切 +- 盱 +- 簌 +- bus +- ten +- check +- 硅 +- 概 +- 袒 +- 厚 +- 馐 +- 橐 +- 涵 +- 抢 +- 兖 +- 颠 +- 扑 +- 渐 +- 底 +- 獒 +- 瘴 +- 喝 +- 期 +- 踪 +- 镭 +- 糕 +- 翡 +- 养 +- 苺 +- gi +- 顷 +- 蚜 +- 琛 +- 县 +- 槽 +- 滹 +- 钙 +- ple +- 叙 +- 囵 +- 煮 +- 杵 +- 铛 +- 丢 +- 任 +- 咹 +- 莎 +- 请 +- 喂 +- 旬 +- 枫 +- 颊 +- 圄 +- 霍 +- 耆 +- 阅 +- 嵴 +- 鱿 +- 倭 +- me +- 咎 +- sing +- 眸 +- 羽 +- 二 +- 橦 +- 菉 +- 巩 +- 柑 +- 赧 +- 暮 +- d +- 损 +- world +- 隻 +- 鑹 +- 捧 +- 轨 +- 按 +- 啄 +- 聒 +- 炅 +- 湣 +- 詹 +- 饧 +- 柒 +- 恃 +- 掬 +- 爽 +- 料 +- 窎 +- 歹 +- 刿 +- 完 +- 餮 +- 鵀 +- 是 +- 榈 +- 透 +- 粗 +- 俛 +- 音 +- 份 +- 置 +- 砊 +- 蓬 +- 蘘 +- 缛 +- going +- 遯 +- your +- ever +- 制 +- 淼 +- 冏 +- 妆 +- 钣 +- 怡 +- vern +- z +- 弇 +- 砥 +- 蜴 +- 饸 +- 冮 +- 衫 +- 韘 +- 寖 +- 虐 +- 玹 +- 3 +- tho +- 闼 +- 旋 +- 煿 +- 嶝 +- 涟 +- 龌 +- ko +- ge +- 遛 +- 郢 +- 褡 +- 薪 +- 邓 +- 嫁 +- 叔 +- 嫤 +- 漠 +- gue +- 藿 +- 臾 +- 屣 +- ily +- 早 +- 痴 +- 埴 +- 囊 +- 俩 +- ours +- 蓦 +- 渗 +- 锟 +- 朦 +- 附 +- 赴 +- make +- 灾 +- 汛 +- 埸 +- 吾 +- 栲 +- 翰 +- 磔 +- 汰 +- 椋 +- 锸 +- 搴 +- 蒐 +- 韧 +- 撒 +- 纽 +- 笙 +- order +- 坼 +- 伷 +- val +- 烬 +- 梡 +- 瑶 +- 陷 +- go +- 绤 +- 琉 +- 湖 +- 硷 +- 熹 +- 觇 +- 侥 +- 往 +- 牲 +- 租 +- 矾 +- 祉 +- 跂 +- age +- 刘 +- 缃 +- 复 +- 阂 +- 刊 +- am +- 苻 +- 步 +- cess +- 蓖 +- he +- 喙 +- 畜 +- 鄠 +- 让 +- 雱 +- 噫 +- sel +- 钜 +- 胥 +- 蹬 +- help +- 捻 +- 芽 +- 肷 +- 掳 +- 旧 +- 謦 +- 甲 +- ort +- 搽 +- 哧 +- 骢 +- 吼 +- 口 +- 倚 +- 肽 +- 憨 +- 竦 +- product +- 棚 +- 黍 +- 砾 +- 愈 +- 昊 +- 阑 +- 魂 +- 持 +- 献 +- pa +- 凳 +- 厩 +- 佚 +- 鲱 +- 粮 +- 鹋 +- 姬 +- 抉 +- 籇 +- part +- found +- 嗍 +- 提 +- 蛇 +- 籓 +- 盼 +- 裱 +- 暄 +- 妞 +- 喑 +- 惶 +- wha +- 窥 +- ks +- 橘 +- 绞 +- 菁 +- 饭 +- ste +- 猞 +- 芘 +- 搧 +- tain +- street +- 呔 +- 懆 +- 袼 +- 肼 +- on +- 亨 +- 谑 +- 椅 +- 莹 +- 校 +- 躔 +- 颈 +- 圬 +- 匕 +- mail +- 税 +- 年 +- 脆 +- 郦 +- 拿 +- fo +- 鑱 +- 改 +- la +- 轸 +- 掩 +- 芒 +- can't +- 彺 +- 觑 +- 邴 +- 埵 +- 莴 +- 伢 +- 腕 +- 阴 +- tre +- 眇 +- 责 +- 青 +- 钠 +- point +- 僵 +- 庹 +- 具 +- 迠 +- 穗 +- 逃 +- 源 +- 咻 +- 今 +- 绻 +- 发 +- 嗝 +- 逆 +- 侈 +- 抓 +- 羌 +- 款 +- 耧 +- 锰 +- 罢 +- 跗 +- 汞 +- 赚 +- 累 +- 掷 +- 啫 +- 膳 +- 捭 +- 禀 +- 崂 +- 栝 +- 掴 +- 讶 +- y +- 瑾 +- 账 +- 挈 +- 鹬 +- 儁 +- 鳎 +- 骛 +- 釉 +- 矬 +- 潮 +- ort +- 病 +- 日 +- o +- 憍 +- 镍 +- 蜛 +- 壤 +- 葑 +- 聚 +- 灭 +- 立 +- 怙 +- m +- 诙 +- 躲 +- 泡 +- would +- 缺 +- 横 +- 违 +- 蛛 +- ls +- 鹮 +- 鲐 +- 茌 +- 罚 +- ques +- 畦 +- 厍 +- 缳 +- 劭 +- 拐 +- 萍 +- 债 +- 偈 +- 镛 +- 踽 +- 趋 +- 扭 +- 椒 +- 痔 +- 史 +- 称 +- thing +- q +- fre +- 剁 +- beach +- 舢 +- 黠 +- 执 +- 饵 +- 欤 +- 骥 +- 蓄 +- 邈 +- 疚 +- '''' +- 吓 +- 撄 +- 苌 +- 蜢 +- mar +- 桓 +- made +- 煦 +- 襁 +- 垃 +- 姓 +- 送 +- 柜 +- 埪 +- 怠 +- 蚍 +- little +- 殴 +- 炕 +- 蛙 +- 伱 +- 禁 +- 睺 +- 捍 +- 颀 +- 猬 +- 蟊 +- 岢 +- o +- 纩 +- 妨 +- 阡 +- 率 +- 蒋 +- 寐 +- 孚 +- 想 +- 洁 +- 沮 +- 铦 +- 镟 +- 潲 +- 杮 +- tal +- 镯 +- 虞 +- 鶒 +- 椐 +- 簦 +- 锈 +- 顗 +- 仑 +- 额 +- 掼 +- 耿 +- 荑 +- 撙 +- 谍 +- 沃 +- 惊 +- 碉 +- 皓 +- 峯 +- 炮 +- 厶 +- 拼 +- 得 +- 帅 +- 蜎 +- 莠 +- 近 +- 诩 +- 喓 +- sequence +- 愉 +- ure +- 枯 +- thous +- 槅 +- 移 +- 菡 +- 菪 +- ten +- 癍 +- 珀 +- 湎 +- 瓿 +- 名 +- 妇 +- 再 +- 傺 +- 蚬 +- 荡 +- 孽 +- 匜 +- 堠 +- 荜 +- 绉 +- 刽 +- des +- 1 +- 留 +- 裎 +- 赐 +- ving +- 光 +- ly +- 睟 +- 遂 +- 琮 +- 俟 +- 岛 +- 蛹 +- 蒿 +- nor +- 钦 +- 麻 +- 纫 +- coun +- 杷 +- 宿 +- 吣 +- 蝎 +- 湃 +- 惬 +- enjo +- 卯 +- 牸 +- 诠 +- 谷 +- 摞 +- 螈 +- 然 +- 盂 +- mple +- 萁 +- 灰 +- 畊 +- when +- 烈 +- 俸 +- 衿 +- 龟 +- 谭 +- 唳 +- 楀 +- 痪 +- 曳 +- 羿 +- 罂 +- 脱 +- 廿 +- sur +- 拝 +- 洵 +- 湿 +- 鸽 +- 冂 +- 跛 +- school +- 尡 +- 挡 +- 疭 +- 议 +- self +- 拍 +- 溺 +- 垅 +- 瞳 +- 笑 +- thousand +- 乓 +- 噼 +- lie +- 沿 +- 俣 +- 灏 +- 赈 +- 砭 +- 造 +- 标 +- loo +- 罅 +- 鳣 +- 翥 +- 铬 +- 诞 +- 酌 +- 佟 +- 歘 +- 瑀 +- 眬 +- 璁 +- 拣 +- u +- 颤 +- 笏 +- ur +- 蝌 +- 蛟 +- number +- 馕 +- place +- 伐 +- 热 +- ver +- 淜 +- 嚼 +- 鼢 +- 謩 +- 趟 +- 恬 +- 搅 +- 伫 +- 杌 +- 琐 +- 崽 +- 苗 +- 其 +- 熄 +- 在 +- 泾 +- 毓 +- very +- 琥 +- 孤 +- 扞 +- 恪 +- t's +- 埙 +- do +- 攮 +- 昴 +- 靥 +- feel +- 酗 +- 蕫 +- der +- 焙 +- gen +- 辛 +- 觞 +- 平 +- 椤 +- 耦 +- 黜 +- 寇 +- 醍 +- 耶 +- 撰 +- 蔌 +- 曜 +- 谂 +- 烛 +- 旦 +- kno +- 爪 +- 絺 +- 欢 +- 圈 +- 臂 +- ch +- 谆 +- 荏 +- 巫 +- 擐 +- 嵋 +- 霸 +- ames +- wel +- 叆 +- 傧 +- tra +- 隳 +- 唆 +- 澧 +- 焦 +- 窭 +- 剜 +- 菇 +- 锇 +- 锑 +- 枳 +- 娈 +- 侗 +- 橙 +- 愊 +- 泯 +- 茼 +- 荙 +- 遭 +- 蟥 +- 捱 +- 挤 +- 蹊 +- 暹 +- ity +- 珠 +- 驼 +- 嗷 +- 贪 +- 扔 +- 硒 +- 沣 +- 鸡 +- 蕖 +- 仓 +- looking +- 冦 +- 邳 +- 赝 +- 嵛 +- chi +- 典 +- 桧 +- about +- 茏 +- es +- 缒 +- 蕻 +- 闽 +- 独 +- 骨 +- 尰 +- 鲼 +- und +- 详 +- 姩 +- 脉 +- 腥 +- 拯 +- 婕 +- 杜 +- 俑 +- 经 +- they +- 距 +- 僧 +- 辅 +- 骂 +- 睛 +- 夤 +- door +- 捊 +- 靴 +- 庅 +- 劓 +- 舣 +- 饿 +- 幻 +- ry +- 悱 +- 畎 +- 先 +- 畠 +- ye +- those +- 菲 +- 榔 +- 邑 +- city +- 泖 +- 夕 +- better +- 吏 +- 酡 +- 蕾 +- 犯 +- 磲 +- 锝 +- 鹌 +- 鹫 +- you +- 耐 +- 梯 +- 鸬 +- 榛 +- 笛 +- 睡 +- 歪 +- 遍 +- 飒 +- 笃 +- 蓝 +- 于 +- 欸 +- 为 +- 琎 +- 宁 +- ki +- tle +- 直 +- 漕 +- years +- 烙 +- 捏 +- 馅 +- re +- 诺 +- tur +- deci +- 励 +- 佘 +- bl +- of +- 噩 +- 阪 +- 梿 +- 孃 +- 杻 +- 覃 +- 瞆 +- 瑷 +- 观 +- 循 +- 泪 +- six +- 集 +- cust +- 瘠 +- 尽 +- 鱀 +- 虎 +- 来 +- other +- 衮 +- 芷 +- 卓 +- 擒 +- 锶 +- 玻 +- lu +- 缝 +- 瀬 +- 缯 +- 嫖 +- 偭 +- 运 +- 厣 +- 顺 +- 璝 +- 锬 +- 悼 +- 'off' +- 苑 +- 恤 +- 囡 +- 锻 +- 舁 +- 粼 +- 丑 +- 字 +- 酽 +- 鲜 +- 豹 +- 厝 +- 琤 +- 谞 +- 簖 +- 癣 +- 蚌 +- 退 +- 戡 +- 云 +- 颞 +- cur +- 腻 +- 呗 +- 沼 +- 骤 +- 崭 +- 扯 +- 怍 +- app +- 存 +- 害 +- 色 +- 踣 +- 淘 +- 嗦 +- 獠 +- 怗 +- 砸 +- 镜 +- 毹 +- table +- '@' +- 鲀 +- 寤 +- 桥 +- 嘞 +- 髁 +- 哙 +- 织 +- 嗒 +- 麂 +- let +- 偁 +- 苎 +- 燧 +- rou +- 哃 +- 鄂 +- 翌 +- 酚 +- 咄 +- 嗥 +- 蒸 +- 虚 +- 囗 +- 条 +- 鹕 +- 挖 +- per +- 矿 +- 珦 +- 囨 +- 冻 +- 佰 +- 洲 +- 漓 +- 菹 +- 镱 +- 尝 +- low +- 苜 +- 剞 +- could +- 埒 +- 铼 +- 结 +- 侵 +- 星 +- then +- 埠 +- 峤 +- 晒 +- 睦 +- 搓 +- 時 +- 铫 +- 偃 +- might +- 氦 +- 呻 +- 淦 +- ge +- 缧 +- 脑 +- 膴 +- 英 +- pla +- 案 +- 生 +- 顔 +- 记 +- 艰 +- tic +- 砖 +- 药 +- 宪 +- 涩 +- 鞠 +- 潆 +- 郭 +- 宵 +- 砀 +- 蟛 +- 岀 +- 赃 +- 蛤 +- 粢 +- 驶 +- 膂 +- 垤 +- nee +- 逐 +- 芳 +- 螂 +- 超 +- change +- j +- 锔 +- 箓 +- 笤 +- 弱 +- 畸 +- 分 +- 攸 +- 蛸 +- 烷 +- 脒 +- 昨 +- 咴 +- 羚 +- 芍 +- 卲 +- 噔 +- 飖 +- 蜍 +- some +- 崦 +- 嬛 +- 仍 +- 柳 +- 鹗 +- 増 +- 乙 +- 嫂 +- 骚 +- 巾 +- 憬 +- 刭 +- 顸 +- 磙 +- 伃 +- 孜 +- 碌 +- 堐 +- 祗 +- 鳉 +- 汊 +- ab +- 袄 +- 诚 +- 剡 +- 锷 +- 锕 +- 益 +- 箕 +- 瘾 +- restaur +- 鹣 +- 瘩 +- 矸 +- his +- 灸 +- 勖 +- 括 +- 呢 +- 漯 +- 罟 +- 嚓 +- 焗 +- tru +- 赛 +- 伶 +- 垢 +- 擘 +- 镠 +- 惰 +- 贬 +- 惙 +- 捺 +- sto +- 犁 +- were +- 艉 +- 佞 +- 配 +- 耙 +- 猢 +- 遗 +- 豊 +- 急 +- 蓟 +- 泓 +- 屑 +- 焊 +- 筲 +- 缈 +- 柔 +- 蜀 +- 珺 +- 怕 +- 淡 +- . +- 靛 +- 载 +- 堎 +- 潥 +- 懒 +- 邸 +- 惇 +- 粥 +- 斫 +- 漼 +- re's +- 簇 +- 修 +- 梏 +- tr +- 肟 +- 葙 +- 鲸 +- 呐 +- 游 +- 廖 +- 收 +- 鳅 +- 覆 +- 琳 +- 熵 +- 翱 +- 民 +- 飨 +- 螳 +- 媳 +- 辖 +- 旯 +- 榴 +- 瑰 +- 嗯 +- 渤 +- ic +- 熔 +- 暝 +- 柘 +- 鬟 +- 斋 +- 夸 +- 晢 +- 氰 +- 炫 +- dn't +- 押 +- 撺 +- 烁 +- 偶 +- 貅 +- 冀 +- 胎 +- 糊 +- 润 +- 咭 +- 各 +- 摐 +- 錞 +- 垌 +- 插 +- 舯 +- 嶙 +- 筋 +- 住 +- 酆 +- 镰 +- 工 +- 嗲 +- 铱 +- 暖 +- off +- 茔 +- 髂 +- 挺 +- 瞑 +- 伤 +- 忌 +- 僬 +- 萜 +- 普 +- that +- 爵 +- 稍 +- 瓠 +- 崛 +- um +- 磐 +- 投 +- 畅 +- 缕 +- 楯 +- 悒 +- 判 +- 筢 +- 馇 +- 芰 +- 遒 +- 黩 +- 迪 +- 蝾 +- 腈 +- 才 +- 峙 +- 悟 +- 禩 +- 惋 +- five +- 局 +- 砘 +- ver +- 恋 +- 斓 +- 蹀 +- 犹 +- 绶 +- ep +- 喛 +- 亩 +- 嵘 +- 汆 +- 狸 +- 迸 +- 盉 +- line +- 妣 +- 躐 +- 琢 +- 赣 +- le +- 疬 +- 穿 +- 焓 +- 跳 +- 匪 +- feat +- 鹦 +- 璠 +- 蔸 +- 百 +- 愁 +- 芋 +- 吙 +- 谚 +- 熳 +- 哩 +- ad +- 轧 +- 祇 +- 泬 +- 瘳 +- 列 +- 簃 +- 谦 +- lea +- 垴 +- 啤 +- 滇 +- 饮 +- 瞰 +- 獭 +- 倏 +- 肿 +- 宜 +- 涮 +- 礓 +- 数 +- 屌 +- 濒 +- 蟜 +- 上 +- 詝 +- 褐 +- 眭 +- 菟 +- 瘅 +- 蝙 +- 眜 +- 羡 +- 硖 +- 背 +- 芣 +- 歃 +- 红 +- 血 +- 混 +- 橞 +- 樽 +- 纶 +- 圭 +- stay +- 冗 +- 竑 +- 玥 +- 它 +- 怎 +- 薜 +- 殆 +- 看 +- 剖 +- 棠 +- 瘙 +- be +- 裤 +- 篙 +- 带 +- 助 +- 骀 +- 锍 +- 廓 +- 库 +- 绅 +- 劂 +- 蝻 +- 锘 +- 濩 +- 等 +- 魑 +- 酿 +- 阆 +- 弑 +- 悖 +- 姹 +- 傀 +- which +- 股 +- 湲 +- 贝 +- 相 +- 茑 +- 荔 +- 钲 +- 致 +- 沦 +- 另 +- 桑 +- 佳 +- 班 +- 昼 +- 埂 +- 剕 +- 箐 +- 岵 +- 涨 +- 柩 +- 两 +- 勰 +- 氮 +- 稽 +- 匝 +- ting +- 瘀 +- 缔 +- 鹉 +- 雕 +- 蛮 +- 镞 +- 魈 +- 謇 +- me +- set +- 豇 +- h +- 秫 +- 荬 +- 赢 +- 沩 +- 向 +- 石 +- 踖 +- 迥 +- 受 +- 抅 +- 镘 +- 嚭 +- 双 +- 锚 +- ex +- 辉 +- 谠 +- 綉 +- ws +- 吟 +- 湔 +- ll +- 市 +- 娥 +- 堢 +- 跽 +- 处 +- 厂 +- 朓 +- 笸 +- 悭 +- 孥 +- 嘀 +- 恻 +- 皱 +- 塄 +- who +- 妙 +- 栽 +- 瓷 +- 稔 +- 碧 +- 哽 +- pol +- 徨 +- s +- 邋 +- 息 +- 樨 +- 鼾 +- 拱 +- 谟 +- 墡 +- 匆 +- speci +- ha +- 庐 +- 鹿 +- ak +- 镣 +- m +- 唯 +- 州 +- 筒 +- 性 +- 髋 +- 哄 +- 镡 +- 贇 +- and +- 菩 +- 姻 +- 聪 +- tion +- 催 +- 醌 +- 唢 +- 雾 +- 堂 +- 芝 +- 擢 +- 匈 +- 悸 +- 钢 +- gy +- 徉 +- 渡 +- 誊 +- ti +- 军 +- 铸 +- 和 +- 沄 +- 兽 +- 短 +- 育 +- 韪 +- 邀 +- 谴 +- 耋 +- 浩 +- public +- 胝 +- 猴 +- six +- 黧 +- being +- 弊 +- 捂 +- ical +- 癖 +- 堆 +- 伧 +- 割 +- 引 +- la +- 鼙 +- 逻 +- 堪 +- cap +- 首 +- 谝 +- 瘦 +- 硐 +- 郑 +- 凑 +- fu +- b +- 睨 +- 骠 +- 佼 +- 篦 +- 贵 +- 铌 +- act +- 呑 +- 竖 +- 莅 +- 陕 +- 飙 +- 黏 +- 镆 +- 屦 +- 仨 +- 敫 +- 马 +- 埜 +- 垇 +- 阇 +- 耒 +- 笩 +- 蓂 +- 妃 +- 讨 +- see +- 吊 +- 踊 +- 弥 +- 梅 +- 坑 +- 渫 +- au +- 赡 +- 坛 +- 苹 +- don +- 察 +- 俚 +- fir +- 濑 +- 块 +- 浏 +- 唵 +- 婴 +- 恙 +- 隈 +- 麽 +- ca +- 莼 +- 御 +- 鞋 +- 禧 +- 衰 +- 潩 +- 茬 +- ven +- 瞌 +- 鸥 +- 凭 +- 咯 +- 饺 +- 耄 +- uni +- 瑟 +- 煟 +- 舟 +- 尅 +- 帚 +- 鼋 +- 嫔 +- 婄 +- 赟 +- 棼 +- 沪 +- 秃 +- 粧 +- roo +- 蚳 +- 亏 +- 备 +- 压 +- 悍 +- 嚅 +- fin +- 交 +- 癔 +- 跞 +- 莪 +- 闻 +- 罾 +- 炁 +- 钻 +- 鹆 +- 友 +- 傣 +- 糁 +- service +- 邾 +- 窝 +- 扉 +- 鲡 +- 盛 +- 玖 +- 卫 +- ne +- 眛 +- 鸟 +- 党 +- 杼 +- 碓 +- 篚 +- 裆 +- 钟 +- 大 +- 介 +- 揩 +- 砻 +- 卅 +- 弟 +- 颛 +- 嫪 +- 代 +- 会 +- 悻 +- 者 +- 箍 +- 番 +- 疯 +- sp +- 聃 +- 瀚 +- 挥 +- 拷 +- 氡 +- 璎 +- 肪 +- tan +- ul +- 蠃 +- 龊 +- 家 +- 挽 +- must +- 蹭 +- 樟 +- 令 +- 饶 +- buy +- 忖 +- 娠 +- 手 +- house +- 贷 +- 嘚 +- 莺 +- 茛 +- 宥 +- 刼 +- 傥 +- rest +- 厄 +- 洙 +- 牝 +- 林 +- 铆 +- 觳 +- 嬢 +- 芥 +- 充 +- 絮 +- 陲 +- zer +- 藤 +- air +- 贤 +- 趾 +- 孝 +- 袖 +- 氇 +- 章 +- 柷 +- 恓 +- 麹 +- 胧 +- came +- 休 +- 舲 +- 籼 +- 惕 +- 泼 +- 馨 +- 町 +- wer +- 鹧 +- 咚 +- 崔 +- 嵂 +- 蝈 +- ils +- 湛 +- 报 +- 蜷 +- 削 +- 根 +- 恣 +- 呙 +- 郫 +- 把 +- 窕 +- 癌 +- xt +- 榘 +- 傫 +- 用 +- 撕 +- 蚩 +- 菰 +- 崖 +- 酐 +- 襄 +- cu +- 呤 +- 帯 +- 炊 +- 揲 +- 啸 +- 鲶 +- ve +- 艟 +- 嗜 +- ili +- 凹 +- 球 +- 鬓 +- 荼 +- 给 +- 亘 +- 醯 +- 燔 +- 鳕 +- 侄 +- 簪 +- 洳 +- 嘛 +- 稠 +- '''t' +- 氘 +- 暍 +- 指 +- 泆 +- 总 +- offer +- 糅 +- 膀 +- 毋 +- 蹲 +- 煅 +- 桔 +- 什 +- 浜 +- 八 +- 涧 +- 跬 +- 祷 +- 湫 +- 脸 +- 描 +- pr +- 狱 +- 赉 +- 砼 +- 袜 +- 馑 +- 枪 +- 碁 +- 娜 +- 辇 +- 颐 +- 捩 +- 峥 +- 聆 +- 善 +- 询 +- 疝 +- 坜 +- 碚 +- 缥 +- 鼯 +- 钮 +- 腘 +- 溥 +- 脔 +- 殁 +- 肮 +- 泮 +- 捐 +- 槛 +- 吆 +- 河 +- 溆 +- 度 +- 殒 +- 骕 +- 饹 +- cour +- 臜 +- 空 +- 2 +- 允 +- 枉 +- 蒯 +- or +- 趔 +- 菠 +- 栌 +- view +- possi +- 仗 +- 鳄 +- 摊 +- 寝 +- 躯 +- 湝 +- 后 +- 删 +- 揪 +- 徐 +- 寒 +- 坨 +- 挣 +- 举 +- 氅 +- 臻 +- 饔 +- 丁 +- 彦 +- 泉 +- 曷 +- 衅 +- ei +- 呸 +- 狍 +- 甓 +- 禽 +- 薄 +- shipping +- ght +- 慵 +- 幽 +- 匣 +- 炬 +- 访 +- four +- 秒 +- 樗 +- 陶 +- 脓 +- 枰 +- 磷 +- 哕 +- 君 +- 脲 +- 灯 +- 回 +- 索 +- 璺 +- 邡 +- 愍 +- 薏 +- 辄 +- 珽 +- 離 +- 鬃 +- 赊 +- 枲 +- 邰 +- 佷 +- 颏 +- 寺 +- 抵 +- 鲅 +- 刎 +- 給 +- 戴 +- 溲 +- 袢 +- less +- 逯 +- 封 +- food +- 匮 +- 关 +- 尘 +- 皤 +- 鳍 +- 搏 +- 幌 +- 连 +- 杠 +- 蹋 +- 彷 +- 虺 +- 怀 +- 雏 +- 钿 +- 澄 +- 扶 +- 错 +- 樋 +- 黉 +- 胄 +- 薇 +- 阿 +- 墁 +- 觜 +- 利 +- 汵 +- 羟 +- 杀 +- 淋 +- 蓁 +- 腧 +- 哞 +- was +- 钊 +- 胸 +- 艽 +- 撞 +- 虑 +- 煋 +- 飗 +- throu +- 门 +- 玦 +- 琪 +- 煸 +- 酵 +- 婌 +- serv +- 硿 +- 净 +- 夐 +- 撅 +- 頠 +- want +- 犄 +- 厉 +- p +- en +- 斗 +- 层 +- 玫 +- life +- 潘 +- 骐 +- 臃 +- 谮 +- 殃 +- 厌 +- 摄 +- 磾 +- v +- dress +- 络 +- 囱 +- 眯 +- 忽 +- 壸 +- 咐 +- 搁 +- 肤 +- 魇 +- 芬 +- 窡 +- 拉 +- 纮 +- 楣 +- 蔬 +- 寄 +- 妯 +- 教 +- 俪 +- 颡 +- 碛 +- 互 +- 奈 +- 憎 +- 炉 +- 蹰 +- 聂 +- 员 +- 呶 +- 瞬 +- il +- 恿 +- 阙 +- 卡 +- mi +- 禾 +- 椴 +- yo +- 帀 +- 醵 +- 帝 +- 隔 +- 忒 +- 哑 +- 効 +- 楗 +- 鼱 +- 塽 +- 苴 +- 蜞 +- 健 +- 醅 +- ju +- 新 +- 程 +- 茗 +- 琰 +- 几 +- 揍 +- 匍 +- 砣 +- 禳 +- 罗 +- 勿 +- 擗 +- 畛 +- 框 +- 泒 +- 析 +- 沢 +- 偷 +- 繁 +- 嗣 +- 呵 +- 念 +- so +- 溷 +- 曩 +- spon +- 狼 +- 倔 +- 威 +- 潭 +- 踯 +- 晁 +- 吩 +- 袅 +- 喀 +- 洌 +- 炯 +- 纸 +- 抽 +- 簧 +- c +- 买 +- 吖 +- 俬 +- 梓 +- 叡 +- 祼 +- 烃 +- 荃 +- 眀 +- +split_with_space: true +init: null +input_size: null +ctc_conf: + dropout_rate: 0.0 + ctc_type: builtin + reduce: true + ignore_nan_grad: true +joint_net_conf: null +use_preprocessor: true +token_type: char +bpemodel: null +non_linguistic_symbols: null +cleaner: null +g2p: null +speech_volume_normalize: null +rir_scp: null +rir_apply_prob: 1.0 +noise_scp: null +noise_apply_prob: 1.0 +noise_db_range: '13_15' +frontend: wav_frontend +frontend_conf: + fs: 16000 + window: hamming + n_mels: 80 + frame_length: 25 + frame_shift: 10 + lfr_m: 7 + lfr_n: 6 +specaug: specaug_lfr +specaug_conf: + apply_time_warp: false + time_warp_window: 5 + time_warp_mode: bicubic + apply_freq_mask: true + freq_mask_width_range: + - 0 + - 30 + lfr_rate: 6 + num_freq_mask: 1 + apply_time_mask: true + time_mask_width_range: + - 0 + - 12 + num_time_mask: 1 +normalize: null +normalize_conf: {} +model: paraformer_online +model_conf: + ctc_weight: 0.0 + lsm_weight: 0.1 + length_normalized_loss: true + predictor_weight: 1.0 + predictor_bias: 1 + sampling_ratio: 0.75 +preencoder: null +preencoder_conf: {} +encoder: sanm_chunk_opt +encoder_conf: + output_size: 512 + attention_heads: 4 + linear_units: 2048 + num_blocks: 50 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + attention_dropout_rate: 0.1 + input_layer: pe_online + pos_enc_class: SinusoidalPositionEncoder + normalize_before: true + kernel_size: 11 + sanm_shfit: 0 + selfattention_layer_type: sanm + chunk_size: + - 12 + - 15 + stride: + - 8 + - 10 + pad_left: + - 0 + - 0 + encoder_att_look_back_factor: + - 4 + - 4 + decoder_att_look_back_factor: + - 1 + - 1 +postencoder: null +postencoder_conf: {} +decoder: paraformer_decoder_sanm +decoder_conf: + attention_heads: 4 + linear_units: 2048 + num_blocks: 16 + dropout_rate: 0.1 + positional_dropout_rate: 0.1 + self_attention_dropout_rate: 0.1 + src_attention_dropout_rate: 0.1 + att_layer_num: 16 + kernel_size: 11 + sanm_shfit: 5 +predictor: cif_predictor_v2 +predictor_conf: + idim: 512 + threshold: 1.0 + l_order: 1 + r_order: 1 + tail_threshold: 0.45 +gpu_id: 1 +required: +- output_dir +- token_list +distributed: false +version: '202211' diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/am.mvn b/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/am.mvn new file mode 100644 index 0000000..681910c --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/am.mvn @@ -0,0 +1,8 @@ + + 560 560 +[ 0 ] + 560 560 + 0 [ -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 ] + 560 560 + 0 [ 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 ] + diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/config.pbtxt new file mode 100644 index 0000000..43bc83f --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/config.pbtxt @@ -0,0 +1,85 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Created on 2024-01-01 +# Author: GuAn Zhu + +name: "lfr_cmvn_pe" +backend: "onnxruntime" +default_model_filename: "lfr_cmvn_pe.onnx" + +max_batch_size: 128 + +sequence_batching{ + max_sequence_idle_microseconds: 15000000 + oldest { + max_candidate_sequences: 1024 + preferred_batch_size: [32, 64, 128] + max_queue_delay_microseconds: 300 + } + control_input [ + ] + state [ + { + input_name: "cache" + output_name: "r_cache" + data_type: TYPE_FP32 + dims: [10, 560] + initial_state: { + data_type: TYPE_FP32 + dims: [10, 560] + zero_data: true + name: "initial state" + } + }, + { + input_name: "offset" + output_name: "r_offset" + data_type: TYPE_INT32 + dims: [1] + initial_state: { + data_type: TYPE_INT32 + dims: [1] + zero_data: true + name: "initial state" + } + } + ] +} +input [ + { + name: "chunk_xs" + data_type: TYPE_FP32 + dims: [61, 80] + } +] +output [ + { + name: "chunk_xs_out" + data_type: TYPE_FP32 + dims: [-1, 560] + }, + { + name: "chunk_xs_out_len" + data_type: TYPE_INT32 + dims: [-1] + } +] +instance_group [ + { + count: 1 + kind: KIND_GPU + } +] + diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/export_lfr_cmvn_pe_onnx.py b/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/export_lfr_cmvn_pe_onnx.py new file mode 100644 index 0000000..92a76d8 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/lfr_cmvn_pe/export_lfr_cmvn_pe_onnx.py @@ -0,0 +1,142 @@ +# Created on 2024-01-01 +# Author: GuAn Zhu + +import torch +import numpy as np +import math +import torch.nn.functional as F + + +class LFR_CMVN_PE(torch.nn.Module): + def __init__( + self, + mean: torch.Tensor, + istd: torch.Tensor, + m: int = 7, + n: int = 6, + max_len: int = 5000, + encoder_input_size: int = 560, + encoder_output_size: int = 512, + ): + super().__init__() + + # LRF + self.m = m + self.n = n + self.subsample = (m - 1) // 2 + + # CMVN + assert mean.shape == istd.shape + # The buffer can be accessed from this module using self.mean + self.register_buffer("mean", mean) + self.register_buffer("istd", istd) + + # PE + self.encoder_input_size = encoder_input_size + self.encoder_output_size = encoder_output_size + self.max_len = max_len + self.pe = torch.zeros(self.max_len, self.encoder_input_size) + position = torch.arange(0, self.max_len, dtype=torch.float32).unsqueeze(1) + div_term = torch.exp( + torch.arange((self.encoder_input_size / 2), dtype=torch.float32) + * -(math.log(10000.0) / (self.encoder_input_size / 2 - 1)) + ) + self.pe[:, 0::1] = torch.cat( + (torch.sin(position * div_term), torch.cos(position * div_term)), dim=1 + ) + + def forward(self, x, cache, offset): + """ + Args: + x (torch.Tensor): (batch, max_len, feat_dim) + + Returns: + (torch.Tensor): normalized feature + """ + B, _, D = x.size() + x = x.unfold(1, self.m, step=self.n).transpose(2, 3) + x = x.view(B, -1, D * self.m) + + x = (x + self.mean) * self.istd + x = x * (self.encoder_output_size**0.5) + + index = offset + torch.arange(1, x.size(1) + 1).to(dtype=torch.int32) + pos_emb = F.embedding(index, self.pe) # B X T X d_model + r_cache = x + pos_emb + + r_x = torch.cat((cache, r_cache), dim=1) + r_offset = offset + x.size(1) + r_x_len = torch.ones((B, 1), dtype=torch.int32) * r_x.size(1) + + return r_x, r_x_len, r_cache, r_offset + + +def load_cmvn(cmvn_file): + with open(cmvn_file, "r", encoding="utf-8") as f: + lines = f.readlines() + + means_list = [] + vars_list = [] + for i in range(len(lines)): + line_item = lines[i].split() + if line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + add_shift_line = line_item[3 : (len(line_item) - 1)] + means_list = list(add_shift_line) + continue + elif line_item[0] == "": + line_item = lines[i + 1].split() + if line_item[0] == "": + rescale_line = line_item[3 : (len(line_item) - 1)] + vars_list = list(rescale_line) + continue + + means = np.array(means_list).astype(np.float32) + vars = np.array(vars_list).astype(np.float32) + means = torch.from_numpy(means) + vars = torch.from_numpy(vars) + return means, vars + + +if __name__ == "__main__": + means, vars = load_cmvn("am.mvn") + means = torch.tile(means, (10, 1)) + vars = torch.tile(vars, (10, 1)) + + model = LFR_CMVN_PE(means, vars) + model.eval() + + all_names = [ + "chunk_xs", + "cache", + "offset", + "chunk_xs_out", + "chunk_xs_out_len", + "r_cache", + "r_offset", + ] + dynamic_axes = {} + + for name in all_names: + dynamic_axes[name] = {0: "B"} + + input_data1 = torch.randn(4, 61, 80).to(torch.float32) + input_data2 = torch.randn(4, 10, 560).to(torch.float32) + input_data3 = torch.randn(4, 1).to(torch.int32) + + onnx_path = "./1/lfr_cmvn_pe.onnx" + torch.onnx.export( + model, + (input_data1, input_data2, input_data3), + onnx_path, + export_params=True, + opset_version=11, + do_constant_folding=True, + input_names=["chunk_xs", "cache", "offset"], + output_names=["chunk_xs_out", "chunk_xs_out_len", "r_cache", "r_offset"], + dynamic_axes=dynamic_axes, + verbose=False, + ) + + print("export to onnx model succeed!") diff --git a/runtime/triton_gpu/model_repo_paraformer_large_online/streaming_paraformer/config.pbtxt b/runtime/triton_gpu/model_repo_paraformer_large_online/streaming_paraformer/config.pbtxt new file mode 100644 index 0000000..d0ac745 --- /dev/null +++ b/runtime/triton_gpu/model_repo_paraformer_large_online/streaming_paraformer/config.pbtxt @@ -0,0 +1,122 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. 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 applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Created on 2024-01-01 +# Author: GuAn Zhu + +name: "streaming_paraformer" +platform: "ensemble" +max_batch_size: 128 #MAX_BATCH + +input [ + { + name: "WAV" + data_type: TYPE_FP32 + dims: [-1] + }, + { + name: "WAV_LENS" + data_type: TYPE_INT32 + dims: [1] + } +] + +output [ + { + name: "TRANSCRIPTS" + data_type: TYPE_STRING + dims: [1] + } +] + +ensemble_scheduling { + step [ + { + model_name: "feature_extractor" + model_version: -1 + input_map { + key: "wav" + value: "WAV" + } + input_map { + key: "wav_lens" + value: "WAV_LENS" + } + output_map { + key: "speech" + value: "SPEECH" + } + }, + { + model_name: "lfr_cmvn_pe" + model_version: -1 + input_map { + key: "chunk_xs" + value: "SPEECH" + } + output_map { + key: "chunk_xs_out" + value: "CHUNK_XS_OUT" + } + output_map { + key: "chunk_xs_out_len" + value: "CHUNK_XS_OUT_LEN" + } + }, + { + model_name: "encoder" + model_version: -1 + input_map { + key: "speech" + value: "CHUNK_XS_OUT" + } + input_map { + key: "speech_lengths" + value: "CHUNK_XS_OUT_LEN" + } + output_map { + key: "enc" + value: "ENC" + } + output_map { + key: "enc_len" + value: "ENC_LEN" + } + output_map { + key: "alphas" + value: "ALPHAS" + } + }, + { + model_name: "cif_search" + model_version: -1 + input_map { + key: "enc" + value: "ENC" + } + input_map { + key: "enc_len" + value: "ENC_LEN" + } + input_map { + key: "alphas" + value: "ALPHAS" + } + output_map { + key: "transcripts" + value: "TRANSCRIPTS" + } + } + ] +} diff --git a/runtime/websocket/CMakeLists.txt b/runtime/websocket/CMakeLists.txt new file mode 100644 index 0000000..ba6497a --- /dev/null +++ b/runtime/websocket/CMakeLists.txt @@ -0,0 +1,151 @@ +cmake_minimum_required(VERSION 3.16) + +project(FunASRWebscoket) + +set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ version to be used.") +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +option(ENABLE_WEBSOCKET "Whether to build websocket server" ON) +option(ENABLE_PORTAUDIO "Whether to build portaudio" ON) + +if(WIN32) + file(REMOVE ${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src/config.h + ${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src/glog/export.h + ${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src/glog/logging.h + ${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src/glog/raw_logging.h + ${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src/glog/stl_logging.h + ${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src/glog/vlog_is_on.h) +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fPIC") +endif() + + + + +option(ENABLE_GLOG "Whether to build glog" ON) +option(ENABLE_FST "Whether to build openfst" ON) # ITN need openfst compiled +option(BUILD_SHARED_LIBS "Build shared libraries" ON) + +if(ENABLE_WEBSOCKET) + # cmake_policy(SET CMP0135 NEW) + include(FetchContent) + + if(NOT EXISTS ${PROJECT_SOURCE_DIR}/third_party/websocket/websocketpp ) + FetchContent_Declare(websocketpp + GIT_REPOSITORY https://github.com/zaphoyd/websocketpp.git + GIT_TAG 0.8.2 + SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/websocket + ) + + FetchContent_MakeAvailable(websocketpp) + endif() + include_directories(${PROJECT_SOURCE_DIR}/third_party/websocket) + + if(NOT EXISTS ${PROJECT_SOURCE_DIR}/third_party/asio/asio ) + FetchContent_Declare(asio + URL https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-24-0.tar.gz + SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/asio + ) + + FetchContent_MakeAvailable(asio) + endif() + include_directories(${PROJECT_SOURCE_DIR}/third_party/asio/asio/include) + + if(NOT EXISTS ${PROJECT_SOURCE_DIR}/third_party/json/ChangeLog.md ) + FetchContent_Declare(json + URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz + SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/json + ) + + FetchContent_MakeAvailable(json) + endif() + include_directories(${PROJECT_SOURCE_DIR}/third_party/json/include) + +endif() + +if(ENABLE_PORTAUDIO) + include(FetchContent) + + set(portaudio_URL "http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz") + set(portaudio_URL2 "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/pa_stable_v190700_20210406.tgz") + set(portaudio_HASH "SHA256=47efbf42c77c19a05d22e627d42873e991ec0c1357219c0d74ce6a2948cb2def") + + FetchContent_Declare(portaudio + URL + ${portaudio_URL} + ${portaudio_URL2} + URL_HASH ${portaudio_HASH} + ) + + FetchContent_GetProperties(portaudio) + if(NOT portaudio_POPULATED) + message(STATUS "Downloading portaudio from ${portaudio_URL}") + FetchContent_Populate(portaudio) + endif() + message(STATUS "portaudio is downloaded to ${portaudio_SOURCE_DIR}") + message(STATUS "portaudio's binary dir is ${portaudio_BINARY_DIR}") + + add_subdirectory(${portaudio_SOURCE_DIR} ${portaudio_BINARY_DIR} EXCLUDE_FROM_ALL) + if(NOT WIN32) + target_compile_options(portaudio PRIVATE "-Wno-deprecated-declarations") + else() + install(TARGETS portaudio DESTINATION ..) + endif() + +endif() + +# Include generated *.pb.h files +link_directories(${ONNXRUNTIME_DIR}/lib) +link_directories(${FFMPEG_DIR}/lib) + +if(ENABLE_GLOG) + include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src) + set(BUILD_TESTING OFF) + add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog glog) + include_directories(${glog_BINARY_DIR}) + +endif() + +if(ENABLE_FST) + # fst depend on glog and gflags + include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/gflags) + add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/gflags gflags) + include_directories(${gflags_BINARY_DIR}/include) + + # the following openfst if cloned from https://github.com/kkm000/openfst.git + # with some patch to fix the make errors. + add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/openfst openfst) + include_directories(${openfst_SOURCE_DIR}/src/include) + if(WIN32) + include_directories(${openfst_SOURCE_DIR}/src/lib) + endif() +endif() + + +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/include/) +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/src) +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/yaml-cpp/include/) +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/kaldi-native-fbank) +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/jieba/include) +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/jieba/include/limonp/include) +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party) +include_directories(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/kaldi) + +add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/yaml-cpp yaml-cpp) +add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/kaldi-native-fbank/kaldi-native-fbank/csrc csrc) +add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/src src) +add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/kaldi kaldi) + +# install openssl first apt-get install libssl-dev +find_package(OpenSSL REQUIRED) + +message("CXX_FLAGS "${CMAKE_CXX_FLAGS}) +# 获取项目中所有包含文件夹的路径 +get_property(includes DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) +# 遍历并输出每个包含文件夹的路径 +foreach(include ${includes}) + message("Include directory: ${include}") +endforeach() + +add_subdirectory(bin) diff --git a/runtime/websocket/bin/CMakeLists.txt b/runtime/websocket/bin/CMakeLists.txt new file mode 100644 index 0000000..3d2a6cf --- /dev/null +++ b/runtime/websocket/bin/CMakeLists.txt @@ -0,0 +1,27 @@ + + +if(WIN32) + include_directories(${ONNXRUNTIME_DIR}/include) + include_directories(${FFMPEG_DIR}/include) + include_directories(${OPENSSL_ROOT_DIR}//include) + link_directories(${OPENSSL_ROOT_DIR}/lib) + add_definitions(-D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_) + add_definitions(-D_WEBSOCKETPP_CPP11_TYPE_TRAITS_) + add_compile_options("$<$:/bigobj>") + add_compile_options("$<$:/utf-8>") + SET(RELATION_SOURCE "../../onnxruntime/src/resample.cpp" "../../onnxruntime/src/util.cpp" "../../onnxruntime/src/alignedmem.cpp" "../../onnxruntime/src/encode_converter.cpp") +endif() + + + + + +add_executable(funasr-wss-server "funasr-wss-server.cpp" "websocket-server.cpp" ${RELATION_SOURCE}) +add_executable(funasr-wss-server-2pass "funasr-wss-server-2pass.cpp" "websocket-server-2pass.cpp" ${RELATION_SOURCE}) +add_executable(funasr-wss-client "funasr-wss-client.cpp" ${RELATION_SOURCE}) +add_executable(funasr-wss-client-2pass "funasr-wss-client-2pass.cpp" "microphone.cpp" ${RELATION_SOURCE}) + +target_link_libraries(funasr-wss-client PUBLIC funasr ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY}) +target_link_libraries(funasr-wss-client-2pass PUBLIC funasr ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY} portaudio) +target_link_libraries(funasr-wss-server PUBLIC funasr ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY}) +target_link_libraries(funasr-wss-server-2pass PUBLIC funasr ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY}) diff --git a/runtime/websocket/bin/funasr-wss-client-2pass.cpp b/runtime/websocket/bin/funasr-wss-client-2pass.cpp new file mode 100644 index 0000000..0cbd10e --- /dev/null +++ b/runtime/websocket/bin/funasr-wss-client-2pass.cpp @@ -0,0 +1,644 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +// client for websocket, support multiple threads +// ./funasr-wss-client --server-ip +// --port +// --wav-path +// [--thread-num ] +// [--is-ssl ] [--] +// [--version] [-h] +// example: +// ./funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path test.wav +// --thread-num 1 --is-ssl 1 + +#define ASIO_STANDALONE 1 +#include +#include "portaudio.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "util.h" +#include "audio.h" +#include "nlohmann/json.hpp" +#include "tclap/CmdLine.h" +#include "microphone.h" + +/** + * Define a semi-cross platform helper method that waits/sleeps for a bit. + */ +void WaitABit() { +#ifdef WIN32 + Sleep(500); +#else + usleep(500); +#endif +} +std::atomic wav_index(0); + +typedef websocketpp::config::asio_client::message_type::ptr message_ptr; +typedef websocketpp::lib::shared_ptr + context_ptr; +using websocketpp::lib::bind; +using websocketpp::lib::placeholders::_1; +using websocketpp::lib::placeholders::_2; +context_ptr OnTlsInit(websocketpp::connection_hdl) { + context_ptr ctx = websocketpp::lib::make_shared( + asio::ssl::context::sslv23); + + try { + ctx->set_options( + asio::ssl::context::default_workarounds | asio::ssl::context::no_sslv2 | + asio::ssl::context::no_sslv3 | asio::ssl::context::single_dh_use); + + } catch (std::exception& e) { + LOG(ERROR) << e.what(); + } + return ctx; +} + +// template for tls or not config +template +class WebsocketClient { + public: + // typedef websocketpp::client client; + // typedef websocketpp::client + // wss_client; + typedef websocketpp::lib::lock_guard scoped_lock; + + WebsocketClient(int is_ssl) : m_open(false), m_done(false) { + // set up access channels to only log interesting things + m_client.clear_access_channels(websocketpp::log::alevel::all); + m_client.set_access_channels(websocketpp::log::alevel::connect); + m_client.set_access_channels(websocketpp::log::alevel::disconnect); + m_client.set_access_channels(websocketpp::log::alevel::app); + + // Initialize the Asio transport policy + m_client.init_asio(); + + // Bind the handlers we are using + using websocketpp::lib::bind; + using websocketpp::lib::placeholders::_1; + m_client.set_open_handler(bind(&WebsocketClient::on_open, this, _1)); + m_client.set_close_handler(bind(&WebsocketClient::on_close, this, _1)); + + m_client.set_message_handler( + [this](websocketpp::connection_hdl hdl, message_ptr msg) { + on_message(hdl, msg); + }); + + m_client.set_fail_handler(bind(&WebsocketClient::on_fail, this, _1)); + m_client.clear_access_channels(websocketpp::log::alevel::all); + } + + void on_message(websocketpp::connection_hdl hdl, message_ptr msg) { + const std::string& payload = msg->get_payload(); + switch (msg->get_opcode()) { + case websocketpp::frame::opcode::text: + nlohmann::json jsonresult = nlohmann::json::parse(payload); + LOG(INFO) << "Thread: " << this_thread::get_id() + << ",on_message = " << payload; + + if (jsonresult["is_final"] == true) { + websocketpp::lib::error_code ec; + + m_client.close(hdl, websocketpp::close::status::going_away, "", ec); + + if (ec) { + LOG(ERROR) << "Error closing connection " << ec.message(); + } + } + } + } + + // This method will block until the connection is complete + void run(const std::string& uri, const std::vector& wav_list, + const std::vector& wav_ids, int audio_fs, std::string asr_mode, + std::vector chunk_size, const std::unordered_map& hws_map, + bool is_record=false, int use_itn=1) { + // Create a new connection to the given URI + websocketpp::lib::error_code ec; + typename websocketpp::client::connection_ptr con = + m_client.get_connection(uri, ec); + if (ec) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Get Connection Error: " + ec.message()); + return; + } + // Grab a handle for this connection so we can talk to it in a thread + // safe manor after the event loop starts. + m_hdl = con->get_handle(); + + // Queue the connection. No DNS queries or network connections will be + // made until the io_service event loop is run. + m_client.connect(con); + + // Create a thread to run the ASIO io_service event loop + websocketpp::lib::thread asio_thread(&websocketpp::client::run, + &m_client); + if(is_record){ + send_rec_data(asr_mode, chunk_size, hws_map, use_itn); + }else{ + send_wav_data(wav_list[0], wav_ids[0], audio_fs, asr_mode, chunk_size, hws_map, use_itn); + } + + WaitABit(); + + asio_thread.join(); + } + + // The open handler will signal that we are ready to start sending data + void on_open(websocketpp::connection_hdl) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Connection opened, starting data!"); + + scoped_lock guard(m_lock); + m_open = true; + } + + // The close handler will signal that we should stop sending data + void on_close(websocketpp::connection_hdl) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Connection closed, stopping data!"); + + scoped_lock guard(m_lock); + m_done = true; + } + + // The fail handler will signal that we should stop sending data + void on_fail(websocketpp::connection_hdl) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Connection failed, stopping data!"); + + scoped_lock guard(m_lock); + m_done = true; + } + // send wav to server + void send_wav_data(string wav_path, string wav_id, int audio_fs, std::string asr_mode, + std::vector chunk_vector, const std::unordered_map& hws_map, + int use_itn) { + uint64_t count = 0; + std::stringstream val; + + funasr::Audio audio(1); + int32_t sampling_rate = audio_fs; + std::string wav_format = "pcm"; + if (funasr::IsTargetFile(wav_path.c_str(), "wav")) { + if (!audio.LoadWav(wav_path.c_str(), &sampling_rate, false)) + return; + } else if (funasr::IsTargetFile(wav_path.c_str(), "pcm")) { + if (!audio.LoadPcmwav(wav_path.c_str(), &sampling_rate, false)) return; + } else { + wav_format = "others"; + if (!audio.LoadOthers2Char(wav_path.c_str())) return; + } + + float* buff; + int len; + int flag = 0; + bool wait = false; + while (1) { + { + scoped_lock guard(m_lock); + // If the connection has been closed, stop generating data + if (m_done) { + break; + } + // If the connection hasn't been opened yet wait a bit and retry + if (!m_open) { + wait = true; + } else { + break; + } + } + + if (wait) { + // LOG(INFO) << "wait.." << m_open; + WaitABit(); + continue; + } + } + websocketpp::lib::error_code ec; + + nlohmann::json jsonbegin; + nlohmann::json chunk_size = nlohmann::json::array(); + chunk_size.push_back(chunk_vector[0]); + chunk_size.push_back(chunk_vector[1]); + chunk_size.push_back(chunk_vector[2]); + jsonbegin["mode"] = asr_mode; + jsonbegin["chunk_size"] = chunk_size; + jsonbegin["wav_name"] = wav_id; + jsonbegin["wav_format"] = wav_format; + jsonbegin["audio_fs"] = sampling_rate; + jsonbegin["is_speaking"] = true; + jsonbegin["itn"] = true; + if(use_itn == 0){ + jsonbegin["itn"] = false; + } + if(!hws_map.empty()){ + LOG(INFO) << "hotwords: "; + for (const auto& pair : hws_map) { + LOG(INFO) << pair.first << " : " << pair.second; + } + nlohmann::json json_map(hws_map); + std::string json_map_str = json_map.dump(); + jsonbegin["hotwords"] = json_map_str; + } + m_client.send(m_hdl, jsonbegin.dump(), websocketpp::frame::opcode::text, + ec); + + // fetch wav data use asr engine api + if (wav_format == "pcm") { + while (audio.Fetch(buff, len, flag) > 0) { + short* iArray = new short[len]; + for (size_t i = 0; i < len; ++i) { + iArray[i] = (short)(buff[i] * 32768); + } + + // send data to server + int offset = 0; + int block_size = 102400; + while (offset < len) { + int send_block = 0; + if (offset + block_size <= len) { + send_block = block_size; + } else { + send_block = len - offset; + } + m_client.send(m_hdl, iArray + offset, send_block * sizeof(short), + websocketpp::frame::opcode::binary, ec); + offset += send_block; + } + + LOG(INFO) << "sended data len=" << len * sizeof(short); + if (ec) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Send Error: " + ec.message()); + break; + } + delete[] iArray; + } + } else { + int offset = 0; + int block_size = 204800; + len = audio.GetSpeechLen(); + char* others_buff = audio.GetSpeechChar(); + + while (offset < len) { + int send_block = 0; + if (offset + block_size <= len) { + send_block = block_size; + } else { + send_block = len - offset; + } + m_client.send(m_hdl, others_buff + offset, send_block, + websocketpp::frame::opcode::binary, ec); + offset += send_block; + } + + LOG(INFO) << "sended data len=" << len; + if (ec) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Send Error: " + ec.message()); + } + } + + nlohmann::json jsonresult; + jsonresult["is_speaking"] = false; + m_client.send(m_hdl, jsonresult.dump(), websocketpp::frame::opcode::text, + ec); + WaitABit(); + } + + static int RecordCallback(const void* inputBuffer, void* outputBuffer, + unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, + PaStreamCallbackFlags statusFlags, void* userData) + { + std::vector* buffer = static_cast*>(userData); + const float* input = static_cast(inputBuffer); + + for (unsigned int i = 0; i < framesPerBuffer; i++) + { + buffer->push_back(input[i]); + } + + return paContinue; + } + + void send_rec_data(std::string asr_mode, std::vector chunk_vector, + const std::unordered_map& hws_map, int use_itn) { + // first message + bool wait = false; + while (1) { + { + scoped_lock guard(m_lock); + // If the connection has been closed, stop generating data + if (m_done) { + break; + } + // If the connection hasn't been opened yet wait a bit and retry + if (!m_open) { + wait = true; + } else { + break; + } + } + + if (wait) { + // LOG(INFO) << "wait.." << m_open; + WaitABit(); + continue; + } + } + websocketpp::lib::error_code ec; + + float sample_rate = 16000; + nlohmann::json jsonbegin; + nlohmann::json chunk_size = nlohmann::json::array(); + chunk_size.push_back(chunk_vector[0]); + chunk_size.push_back(chunk_vector[1]); + chunk_size.push_back(chunk_vector[2]); + jsonbegin["mode"] = asr_mode; + jsonbegin["chunk_size"] = chunk_size; + jsonbegin["wav_name"] = "record"; + jsonbegin["wav_format"] = "pcm"; + jsonbegin["audio_fs"] = sample_rate; + jsonbegin["is_speaking"] = true; + jsonbegin["itn"] = true; + if(use_itn == 0){ + jsonbegin["itn"] = false; + } + if(!hws_map.empty()){ + LOG(INFO) << "hotwords: "; + for (const auto& pair : hws_map) { + LOG(INFO) << pair.first << " : " << pair.second; + } + nlohmann::json json_map(hws_map); + std::string json_map_str = json_map.dump(); + jsonbegin["hotwords"] = json_map_str; + } + m_client.send(m_hdl, jsonbegin.dump(), websocketpp::frame::opcode::text, + ec); + // mic + Microphone mic; + PaDeviceIndex num_devices = Pa_GetDeviceCount(); + LOG(INFO) << "Num devices: " << num_devices; + + PaStreamParameters param; + + param.device = Pa_GetDefaultInputDevice(); + if (param.device == paNoDevice) { + LOG(INFO) << "No default input device found"; + exit(EXIT_FAILURE); + } + LOG(INFO) << "Use default device: " << param.device; + + const PaDeviceInfo *info = Pa_GetDeviceInfo(param.device); + LOG(INFO) << " Name: " << info->name; + LOG(INFO) << " Max input channels: " << info->maxInputChannels; + + param.channelCount = 1; + param.sampleFormat = paFloat32; + + param.suggestedLatency = info->defaultLowInputLatency; + param.hostApiSpecificStreamInfo = nullptr; + + PaStream *stream; + std::vector buffer; + PaError err = + Pa_OpenStream(&stream, ¶m, nullptr, /* &outputParameters, */ + sample_rate, + 0, // frames per buffer + paClipOff, // we won't output out of range samples + // so don't bother clipping them + RecordCallback, &buffer); + if (err != paNoError) { + LOG(ERROR) << "portaudio error: " << Pa_GetErrorText(err); + exit(EXIT_FAILURE); + } + + err = Pa_StartStream(stream); + LOG(INFO) << "Started: "; + + if (err != paNoError) { + LOG(ERROR) << "portaudio error: " << Pa_GetErrorText(err); + exit(EXIT_FAILURE); + } + + while(true){ + int len = buffer.size(); + short* iArray = new short[len]; + for (size_t i = 0; i < len; ++i) { + iArray[i] = (short)(buffer[i] * 32768); + } + + m_client.send(m_hdl, iArray, len * sizeof(short), + websocketpp::frame::opcode::binary, ec); + buffer.clear(); + + if (ec) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Send Error: " + ec.message()); + } + Pa_Sleep(20); // sleep for 20ms + } + + nlohmann::json jsonresult; + jsonresult["is_speaking"] = false; + m_client.send(m_hdl, jsonresult.dump(), websocketpp::frame::opcode::text, + ec); + + err = Pa_CloseStream(stream); + if (err != paNoError) { + LOG(INFO) << "portaudio error: " << Pa_GetErrorText(err); + exit(EXIT_FAILURE); + } + } + + websocketpp::client m_client; + + private: + websocketpp::connection_hdl m_hdl; + websocketpp::lib::mutex m_lock; + bool m_open; + bool m_done; + int total_num = 0; +}; + +int main(int argc, char* argv[]) { +#ifdef _WIN32 + #include + SetConsoleOutputCP(65001); +#endif + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-wss-client-2pass", ' ', "1.0"); + TCLAP::ValueArg server_ip_("", "server-ip", "server-ip", true, + "127.0.0.1", "string"); + TCLAP::ValueArg port_("", "port", "port", true, "10095", + "string"); + TCLAP::ValueArg wav_path_( + "", "wav-path", + "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: " + "asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", + false, "", "string"); + TCLAP::ValueArg audio_fs_("", "audio-fs", "the sample rate of audio", false, 16000, "int32_t"); + TCLAP::ValueArg record_( + "", "record", + "record is 1 means use record", false, 0, + "int"); + TCLAP::ValueArg asr_mode_("", ASR_MODE, "offline, online, 2pass", + false, "2pass", "string"); + TCLAP::ValueArg chunk_size_("", "chunk-size", + "chunk_size: 5-10-5 or 5-12-5", + false, "5-10-5", "string"); + TCLAP::ValueArg thread_num_("", "thread-num", "thread-num", false, 1, + "int"); + TCLAP::ValueArg is_ssl_( + "", "is-ssl", + "is-ssl is 1 means use wss connection, or use ws connection", false, 1, + "int"); + TCLAP::ValueArg use_itn_( + "", "use-itn", + "use-itn is 1 means use itn, 0 means not use itn", false, 1, + "int"); + TCLAP::ValueArg hotword_("", HOTWORD, + "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", false, "", "string"); + + cmd.add(server_ip_); + cmd.add(port_); + cmd.add(wav_path_); + cmd.add(audio_fs_); + cmd.add(asr_mode_); + cmd.add(record_); + cmd.add(chunk_size_); + cmd.add(thread_num_); + cmd.add(is_ssl_); + cmd.add(use_itn_); + cmd.add(hotword_); + cmd.parse(argc, argv); + + std::string server_ip = server_ip_.getValue(); + std::string port = port_.getValue(); + std::string wav_path = wav_path_.getValue(); + std::string asr_mode = asr_mode_.getValue(); + std::string chunk_size_str = chunk_size_.getValue(); + int use_itn = use_itn_.getValue(); + // get chunk_size + std::vector chunk_size; + std::stringstream ss(chunk_size_str); + std::string item; + while (std::getline(ss, item, '-')) { + try { + chunk_size.push_back(stoi(item)); + } catch (const invalid_argument&) { + LOG(ERROR) << "Invalid argument: " << item; + exit(-1); + } + } + + int threads_num = thread_num_.getValue(); + int is_ssl = is_ssl_.getValue(); + int is_record = record_.getValue(); + + std::string uri = ""; + if (is_ssl == 1) { + uri = "wss://" + server_ip + ":" + port; + } else { + uri = "ws://" + server_ip + ":" + port; + } + + // hotwords + std::string hotword_path = hotword_.getValue(); + unordered_map hws_map; + if(!hotword_path.empty()){ + LOG(INFO) << "hotword path: " << hotword_path; + funasr::ExtractHws(hotword_path, hws_map); + } + + int audio_fs = audio_fs_.getValue(); + if(is_record == 1){ + std::vector tmp_wav_list; + std::vector tmp_wav_ids; + + if (is_ssl == 1) { + WebsocketClient c(is_ssl); + + c.m_client.set_tls_init_handler(bind(&OnTlsInit, ::_1)); + + c.run(uri, tmp_wav_list, tmp_wav_ids, audio_fs, asr_mode, chunk_size, hws_map, true, use_itn); + } else { + WebsocketClient c(is_ssl); + + c.run(uri, tmp_wav_list, tmp_wav_ids, audio_fs, asr_mode, chunk_size, hws_map, true, use_itn); + } + + }else{ + // read wav_path + std::vector wav_list; + std::vector wav_ids; + string default_id = "wav_default_id"; + if (funasr::IsTargetFile(wav_path, "scp")) { + ifstream in(wav_path); + if (!in.is_open()) { + printf("Failed to open scp file"); + return 0; + } + string line; + while (getline(in, line)) { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + } else { + wav_list.emplace_back(wav_path); + wav_ids.emplace_back(default_id); + } + + for (size_t wav_i = 0; wav_i < wav_list.size(); wav_i = wav_i + threads_num) { + std::vector client_threads; + for (size_t i = 0; i < threads_num; i++) { + if (wav_i + i >= wav_list.size()) { + break; + } + std::vector tmp_wav_list; + std::vector tmp_wav_ids; + + tmp_wav_list.emplace_back(wav_list[wav_i + i]); + tmp_wav_ids.emplace_back(wav_ids[wav_i + i]); + + client_threads.emplace_back( + [uri, tmp_wav_list, tmp_wav_ids, audio_fs, asr_mode, chunk_size, is_ssl, hws_map, use_itn]() { + if (is_ssl == 1) { + WebsocketClient c(is_ssl); + + c.m_client.set_tls_init_handler(bind(&OnTlsInit, ::_1)); + + c.run(uri, tmp_wav_list, tmp_wav_ids, audio_fs, asr_mode, chunk_size, hws_map, false, use_itn); + } else { + WebsocketClient c(is_ssl); + + c.run(uri, tmp_wav_list, tmp_wav_ids, audio_fs, asr_mode, chunk_size, hws_map, false, use_itn); + } + }); + } + + for (auto& t : client_threads) { + t.join(); + } + } + } +} diff --git a/runtime/websocket/bin/funasr-wss-client.cpp b/runtime/websocket/bin/funasr-wss-client.cpp new file mode 100644 index 0000000..7af3fbb --- /dev/null +++ b/runtime/websocket/bin/funasr-wss-client.cpp @@ -0,0 +1,452 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +// client for websocket, support multiple threads +// ./funasr-wss-client --server-ip +// --port +// --wav-path +// [--thread-num ] +// [--is-ssl ] [--] +// [--version] [-h] +// example: +// ./funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path test.wav --thread-num 1 --is-ssl 1 + +#define ASIO_STANDALONE 1 +#include +#include +#include +#include +#include +#include +#include +#include "util.h" +#include "audio.h" +#include "nlohmann/json.hpp" +#include "tclap/CmdLine.h" + +/** + * Define a semi-cross platform helper method that waits/sleeps for a bit. + */ +void WaitABit() { + #ifdef WIN32 + Sleep(200); + #else + usleep(200); + #endif +} +std::atomic wav_index(0); + +typedef websocketpp::config::asio_client::message_type::ptr message_ptr; +typedef websocketpp::lib::shared_ptr context_ptr; +using websocketpp::lib::bind; +using websocketpp::lib::placeholders::_1; +using websocketpp::lib::placeholders::_2; +context_ptr OnTlsInit(websocketpp::connection_hdl) { + context_ptr ctx = websocketpp::lib::make_shared( + asio::ssl::context::sslv23); + + try { + ctx->set_options( + asio::ssl::context::default_workarounds | asio::ssl::context::no_sslv2 | + asio::ssl::context::no_sslv3 | asio::ssl::context::single_dh_use); + + } catch (std::exception& e) { + LOG(ERROR) << e.what(); + } + return ctx; +} + +// template for tls or not config +template +class WebsocketClient { + public: + // typedef websocketpp::client client; + // typedef websocketpp::client + // wss_client; + typedef websocketpp::lib::lock_guard scoped_lock; + + WebsocketClient(int is_ssl) : m_open(false), m_done(false) { + // set up access channels to only log interesting things + m_client.clear_access_channels(websocketpp::log::alevel::all); + m_client.set_access_channels(websocketpp::log::alevel::connect); + m_client.set_access_channels(websocketpp::log::alevel::disconnect); + m_client.set_access_channels(websocketpp::log::alevel::app); + + // Initialize the Asio transport policy + m_client.init_asio(); + + // Bind the handlers we are using + using websocketpp::lib::bind; + using websocketpp::lib::placeholders::_1; + m_client.set_open_handler(bind(&WebsocketClient::on_open, this, _1)); + m_client.set_close_handler(bind(&WebsocketClient::on_close, this, _1)); + + m_client.set_message_handler( + [this](websocketpp::connection_hdl hdl, message_ptr msg) { + on_message(hdl, msg); + }); + + m_client.set_fail_handler(bind(&WebsocketClient::on_fail, this, _1)); + m_client.clear_access_channels(websocketpp::log::alevel::all); + } + + void on_message(websocketpp::connection_hdl hdl, message_ptr msg) { + const std::string& payload = msg->get_payload(); + switch (msg->get_opcode()) { + case websocketpp::frame::opcode::text: + total_recv=total_recv+1; + LOG(INFO)<< "Thread: " << this_thread::get_id() << ", total_recv=" << total_recv <<", on_message = " << payload; + std::unique_lock lock(msg_lock); + cv.notify_one(); + if(close_client) + { + LOG(INFO)<< "Thread: " << this_thread::get_id() << ", close client thread"; + websocketpp::lib::error_code ec; + m_client.close(m_hdl, websocketpp::close::status::going_away, "", ec); + if (ec){ + LOG(ERROR)<< "Error closing connection " << ec.message(); + } + } + } + } + + // This method will block until the connection is complete + void run(const std::string& uri, const std::vector& wav_list, const std::vector& wav_ids, + int audio_fs, const std::unordered_map& hws_map, int use_itn=1) { + // Create a new connection to the given URI + websocketpp::lib::error_code ec; + typename websocketpp::client::connection_ptr con = + m_client.get_connection(uri, ec); + if (ec) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Get Connection Error: " + ec.message()); + return; + } + // Grab a handle for this connection so we can talk to it in a thread + // safe manor after the event loop starts. + m_hdl = con->get_handle(); + + // Queue the connection. No DNS queries or network connections will be + // made until the io_service event loop is run. + m_client.connect(con); + + // Create a thread to run the ASIO io_service event loop + websocketpp::lib::thread asio_thread(&websocketpp::client::run, + &m_client); + bool send_hotword = true; + while(true){ + int i = wav_index.fetch_add(1); + if (i >= wav_list.size()) { + break; + } + if (total_send !=0){ + std::unique_lock lock(msg_lock); + cv.wait(lock); + } + total_send += 1; + send_wav_data(wav_list[i], wav_ids[i], audio_fs, hws_map, send_hotword, use_itn); + if(send_hotword){ + send_hotword = false; + } + } + close_client = true; + asio_thread.join(); + + } + + // The open handler will signal that we are ready to start sending data + void on_open(websocketpp::connection_hdl) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Connection opened, starting data!"); + + scoped_lock guard(m_lock); + m_open = true; + } + + // The close handler will signal that we should stop sending data + void on_close(websocketpp::connection_hdl) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Connection closed, stopping data!"); + + scoped_lock guard(m_lock); + m_done = true; + } + + // The fail handler will signal that we should stop sending data + void on_fail(websocketpp::connection_hdl) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Connection failed, stopping data!"); + + scoped_lock guard(m_lock); + m_done = true; + } + // send wav to server + void send_wav_data(string wav_path, string wav_id, int audio_fs, + const std::unordered_map& hws_map, + bool send_hotword, bool use_itn) { + uint64_t count = 0; + std::stringstream val; + + funasr::Audio audio(1); + int32_t sampling_rate = audio_fs; + std::string wav_format = "pcm"; + if(funasr::IsTargetFile(wav_path.c_str(), "pcm")){ + if (!audio.LoadPcmwav(wav_path.c_str(), &sampling_rate, false)) + return ; + }else{ + wav_format = "others"; + if (!audio.LoadOthers2Char(wav_path.c_str())) + return ; + } + + float* buff; + int len; + int flag = 0; + bool wait = false; + while (1) { + { + scoped_lock guard(m_lock); + // If the connection has been closed, stop generating data + if (m_done) { + break; + } + // If the connection hasn't been opened yet wait a bit and retry + if (!m_open) { + wait = true; + } else { + break; + } + } + if (wait) { + // LOG(INFO) << "wait.." << m_open; + WaitABit(); + continue; + } + } + websocketpp::lib::error_code ec; + + nlohmann::json jsonbegin; + nlohmann::json chunk_size = nlohmann::json::array(); + chunk_size.push_back(5); + chunk_size.push_back(10); + chunk_size.push_back(5); + jsonbegin["chunk_size"] = chunk_size; + jsonbegin["chunk_interval"] = 10; + jsonbegin["wav_name"] = wav_id; + jsonbegin["wav_format"] = wav_format; + jsonbegin["audio_fs"] = sampling_rate; + jsonbegin["itn"] = true; + if(use_itn == 0){ + jsonbegin["itn"] = false; + } + jsonbegin["is_speaking"] = true; + if(send_hotword){ + if(!hws_map.empty()){ + LOG(INFO) << "hotwords: "; + for (const auto& pair : hws_map) { + LOG(INFO) << pair.first << " : " << pair.second; + } + nlohmann::json json_map(hws_map); + std::string json_map_str = json_map.dump(); + jsonbegin["hotwords"] = json_map_str; + } + } + m_client.send(m_hdl, jsonbegin.dump(), websocketpp::frame::opcode::text, + ec); + + // fetch wav data use asr engine api + if(wav_format == "pcm"){ + while (audio.Fetch(buff, len, flag) > 0) { + short* iArray = new short[len]; + for (size_t i = 0; i < len; ++i) { + iArray[i] = (short)(buff[i]*32768); + } + + // send data to server + int offset = 0; + int block_size = 102400; + while(offset < len){ + int send_block = 0; + if (offset + block_size <= len){ + send_block = block_size; + }else{ + send_block = len - offset; + } + m_client.send(m_hdl, iArray+offset, send_block * sizeof(short), + websocketpp::frame::opcode::binary, ec); + offset += send_block; + } + + LOG(INFO)<< "Thread: " << this_thread::get_id() << ", sended data len=" << len * sizeof(short); + // The most likely error that we will get is that the connection is + // not in the right state. Usually this means we tried to send a + // message to a connection that was closed or in the process of + // closing. While many errors here can be easily recovered from, + // in this simple example, we'll stop the data loop. + if (ec) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Send Error: " + ec.message()); + break; + } + delete[] iArray; + // WaitABit(); + } + }else{ + int offset = 0; + int block_size = 204800; + len = audio.GetSpeechLen(); + char* others_buff = audio.GetSpeechChar(); + + while(offset < len){ + int send_block = 0; + if (offset + block_size <= len){ + send_block = block_size; + }else{ + send_block = len - offset; + } + m_client.send(m_hdl, others_buff+offset, send_block, + websocketpp::frame::opcode::binary, ec); + offset += send_block; + } + + LOG(INFO)<< "Thread: " << this_thread::get_id() << ", sended data len=" << len; + // The most likely error that we will get is that the connection is + // not in the right state. Usually this means we tried to send a + // message to a connection that was closed or in the process of + // closing. While many errors here can be easily recovered from, + // in this simple example, we'll stop the data loop. + if (ec) { + m_client.get_alog().write(websocketpp::log::alevel::app, + "Send Error: " + ec.message()); + } + } + + nlohmann::json jsonresult; + jsonresult["is_speaking"] = false; + m_client.send(m_hdl, jsonresult.dump(), websocketpp::frame::opcode::text, + ec); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); + } + websocketpp::client m_client; + + private: + websocketpp::connection_hdl m_hdl; + websocketpp::lib::mutex m_lock; + websocketpp::lib::mutex msg_lock; + websocketpp::lib::condition_variable cv; + bool m_open; + bool m_done; + bool close_client=false; + int total_send=0; + int total_recv=0; +}; + +int main(int argc, char* argv[]) { +#ifdef _WIN32 + #include + SetConsoleOutputCP(65001); +#endif + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + + TCLAP::CmdLine cmd("funasr-wss-client", ' ', "1.0"); + TCLAP::ValueArg server_ip_("", "server-ip", "server-ip", true, + "127.0.0.1", "string"); + TCLAP::ValueArg port_("", "port", "port", true, "10095", "string"); + TCLAP::ValueArg wav_path_("", "wav-path", + "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", + true, "", "string"); + TCLAP::ValueArg audio_fs_("", "audio-fs", "the sample rate of audio", false, 16000, "int32_t"); + TCLAP::ValueArg thread_num_("", "thread-num", "thread-num", + false, 1, "int"); + TCLAP::ValueArg is_ssl_( + "", "is-ssl", "is-ssl is 1 means use wss connection, or use ws connection", + false, 1, "int"); + TCLAP::ValueArg use_itn_( + "", "use-itn", + "use-itn is 1 means use itn, 0 means not use itn", false, 1, "int"); + TCLAP::ValueArg hotword_("", HOTWORD, + "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", false, "", "string"); + + cmd.add(server_ip_); + cmd.add(port_); + cmd.add(wav_path_); + cmd.add(audio_fs_); + cmd.add(thread_num_); + cmd.add(is_ssl_); + cmd.add(use_itn_); + cmd.add(hotword_); + cmd.parse(argc, argv); + + std::string server_ip = server_ip_.getValue(); + std::string port = port_.getValue(); + std::string wav_path = wav_path_.getValue(); + int threads_num = thread_num_.getValue(); + int is_ssl = is_ssl_.getValue(); + int use_itn = use_itn_.getValue(); + + std::vector client_threads; + std::string uri = ""; + if (is_ssl == 1) { + uri = "wss://" + server_ip + ":" + port; + } else { + uri = "ws://" + server_ip + ":" + port; + } + + // hotwords + std::string hotword_path = hotword_.getValue(); + unordered_map hws_map; + if(!hotword_path.empty()){ + LOG(INFO) << "hotword path: " << hotword_path; + funasr::ExtractHws(hotword_path, hws_map); + } + + // read wav_path + std::vector wav_list; + std::vector wav_ids; + string default_id = "wav_default_id"; + if(funasr::IsTargetFile(wav_path, "scp")){ + ifstream in(wav_path); + if (!in.is_open()) { + printf("Failed to open scp file"); + return 0; + } + string line; + while(getline(in, line)) + { + istringstream iss(line); + string column1, column2; + iss >> column1 >> column2; + wav_list.emplace_back(column2); + wav_ids.emplace_back(column1); + } + in.close(); + }else{ + wav_list.emplace_back(wav_path); + wav_ids.emplace_back(default_id); + } + + int audio_fs = audio_fs_.getValue(); + for (size_t i = 0; i < threads_num; i++) { + client_threads.emplace_back([uri, wav_list, wav_ids, audio_fs, is_ssl, hws_map, use_itn]() { + if (is_ssl == 1) { + WebsocketClient c(is_ssl); + + c.m_client.set_tls_init_handler(bind(&OnTlsInit, ::_1)); + + c.run(uri, wav_list, wav_ids, audio_fs, hws_map, use_itn); + } else { + WebsocketClient c(is_ssl); + + c.run(uri, wav_list, wav_ids, audio_fs, hws_map, use_itn); + } + }); + } + + for (auto& t : client_threads) { + t.join(); + } +} diff --git a/runtime/websocket/bin/funasr-wss-server-2pass.cpp b/runtime/websocket/bin/funasr-wss-server-2pass.cpp new file mode 100644 index 0000000..d42679b --- /dev/null +++ b/runtime/websocket/bin/funasr-wss-server-2pass.cpp @@ -0,0 +1,591 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +#include "websocket-server-2pass.h" +#ifdef _WIN32 +#include "win_func.h" +#else +#include +#endif +#include +#include "util.h" + +// hotwords +std::unordered_map hws_map_; +int fst_inc_wts_=20; +float global_beam_, lattice_beam_, am_scale_; + +using namespace std; +void GetValue(TCLAP::ValueArg& value_arg, string key, + std::map& model_path) { + model_path.insert({key, value_arg.getValue()}); + LOG(INFO) << key << " : " << value_arg.getValue(); +} + +int main(int argc, char* argv[]) { +#ifdef _WIN32 + #include + SetConsoleOutputCP(65001); +#endif + try { + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + std::string tpass_version = ""; +#ifdef _WIN32 + tpass_version = "0.1.0"; +#endif + TCLAP::CmdLine cmd("funasr-wss-server", ' ', tpass_version); + TCLAP::ValueArg download_model_dir( + "", "download-model-dir", + "Download model from Modelscope to download_model_dir", false, + "/workspace/models", "string"); + TCLAP::ValueArg offline_model_dir( + "", OFFLINE_MODEL_DIR, + "default: damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx, the asr model path, which " + "contains model_quant.onnx, config.yaml, am.mvn", + false, "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx", "string"); + TCLAP::ValueArg online_model_dir( + "", ONLINE_MODEL_DIR, + "default: damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx, the asr model path, which " + "contains model_quant.onnx, config.yaml, am.mvn", + false, "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx", "string"); + + TCLAP::ValueArg offline_model_revision( + "", "offline-model-revision", "ASR offline model revision", false, + "v2.0.4", "string"); + + TCLAP::ValueArg online_model_revision( + "", "online-model-revision", "ASR online model revision", false, + "v2.0.4", "string"); + + TCLAP::ValueArg quantize( + "", QUANTIZE, + "true (Default), load the model of model_quant.onnx in model_dir. If " + "set " + "false, load the model of model.onnx in model_dir", + false, "true", "string"); + TCLAP::ValueArg vad_dir( + "", VAD_DIR, + "default: damo/speech_fsmn_vad_zh-cn-16k-common-onnx, the vad model path, which contains " + "model_quant.onnx, vad.yaml, vad.mvn", + false, "damo/speech_fsmn_vad_zh-cn-16k-common-onnx", "string"); + TCLAP::ValueArg vad_revision( + "", "vad-revision", "VAD model revision", false, "v2.0.4", "string"); + TCLAP::ValueArg vad_quant( + "", VAD_QUANT, + "true (Default), load the model of model_quant.onnx in vad_dir. If set " + "false, load the model of model.onnx in vad_dir", + false, "true", "string"); + TCLAP::ValueArg punc_dir( + "", PUNC_DIR, + "default: damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx, the punc model path, which contains " + "model_quant.onnx, punc.yaml", + false, "damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx", "string"); + TCLAP::ValueArg punc_revision( + "", "punc-revision", "PUNC model revision", false, "v2.0.4", "string"); + TCLAP::ValueArg punc_quant( + "", PUNC_QUANT, + "true (Default), load the model of model_quant.onnx in punc_dir. If " + "set " + "false, load the model of model.onnx in punc_dir", + false, "true", "string"); + TCLAP::ValueArg itn_dir( + "", ITN_DIR, + "default: thuduj12/fst_itn_zh, the itn model path, which contains " + "zh_itn_tagger.fst, zh_itn_verbalizer.fst", + false, "thuduj12/fst_itn_zh", "string"); + TCLAP::ValueArg itn_revision( + "", "itn-revision", "ITN model revision", false, "v1.0.1", "string"); + + TCLAP::ValueArg listen_ip("", "listen-ip", "listen ip", false, + "0.0.0.0", "string"); + TCLAP::ValueArg port("", "port", "port", false, 10095, "int"); + TCLAP::ValueArg io_thread_num("", "io-thread-num", "io thread num", + false, 2, "int"); + TCLAP::ValueArg decoder_thread_num( + "", "decoder-thread-num", "decoder thread num", false, 8, "int"); + TCLAP::ValueArg model_thread_num("", "model-thread-num", + "model thread num", false, 2, "int"); + + TCLAP::ValueArg certfile( + "", "certfile", + "default: ../../../ssl_key/server.crt, path of certficate for WSS " + "connection. if it is empty, it will be in WS mode.", + false, "../../../ssl_key/server.crt", "string"); + TCLAP::ValueArg keyfile( + "", "keyfile", + "default: ../../../ssl_key/server.key, path of keyfile for WSS " + "connection", + false, "../../../ssl_key/server.key", "string"); + + TCLAP::ValueArg global_beam("", GLOB_BEAM, "the decoding beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg lattice_beam("", LAT_BEAM, "the lattice generation beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg am_scale("", AM_SCALE, "the acoustic scale for beam searching ", false, 10.0, "float"); + + TCLAP::ValueArg lm_dir("", LM_DIR, + "the LM model path, which contains compiled models: TLG.fst, config.yaml ", false, "damo/speech_ngram_lm_zh-cn-ai-wesp-fst", "string"); + TCLAP::ValueArg lm_revision( + "", "lm-revision", "LM model revision", false, "v1.0.2", "string"); + TCLAP::ValueArg hotword("", HOTWORD, + "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", + false, "/workspace/resources/hotwords.txt", "string"); + TCLAP::ValueArg fst_inc_wts("", FST_INC_WTS, + "the fst hotwords incremental bias", false, 20, "int32_t"); + + // add file + cmd.add(hotword); + cmd.add(fst_inc_wts); + cmd.add(global_beam); + cmd.add(lattice_beam); + cmd.add(am_scale); + + cmd.add(certfile); + cmd.add(keyfile); + + cmd.add(download_model_dir); + cmd.add(offline_model_dir); + cmd.add(online_model_dir); + cmd.add(offline_model_revision); + cmd.add(online_model_revision); + cmd.add(quantize); + cmd.add(vad_dir); + cmd.add(vad_revision); + cmd.add(vad_quant); + cmd.add(punc_dir); + cmd.add(punc_revision); + cmd.add(punc_quant); + cmd.add(itn_dir); + cmd.add(itn_revision); + cmd.add(lm_dir); + cmd.add(lm_revision); + + cmd.add(listen_ip); + cmd.add(port); + cmd.add(io_thread_num); + cmd.add(decoder_thread_num); + cmd.add(model_thread_num); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(offline_model_dir, OFFLINE_MODEL_DIR, model_path); + GetValue(online_model_dir, ONLINE_MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(vad_dir, VAD_DIR, model_path); + GetValue(vad_quant, VAD_QUANT, model_path); + GetValue(punc_dir, PUNC_DIR, model_path); + GetValue(punc_quant, PUNC_QUANT, model_path); + GetValue(itn_dir, ITN_DIR, model_path); + GetValue(lm_dir, LM_DIR, model_path); + GetValue(hotword, HOTWORD, model_path); + + GetValue(offline_model_revision, "offline-model-revision", model_path); + GetValue(online_model_revision, "online-model-revision", model_path); + GetValue(vad_revision, "vad-revision", model_path); + GetValue(punc_revision, "punc-revision", model_path); + GetValue(itn_revision, "itn-revision", model_path); + GetValue(lm_revision, "lm-revision", model_path); + + global_beam_ = global_beam.getValue(); + lattice_beam_ = lattice_beam.getValue(); + am_scale_ = am_scale.getValue(); + + // Download model form Modelscope + try { + std::string s_download_model_dir = download_model_dir.getValue(); + + std::string s_vad_path = model_path[VAD_DIR]; + std::string s_vad_quant = model_path[VAD_QUANT]; + std::string s_offline_asr_path = model_path[OFFLINE_MODEL_DIR]; + std::string s_online_asr_path = model_path[ONLINE_MODEL_DIR]; + std::string s_asr_quant = model_path[QUANTIZE]; + std::string s_punc_path = model_path[PUNC_DIR]; + std::string s_punc_quant = model_path[PUNC_QUANT]; + std::string s_itn_path = model_path[ITN_DIR]; + std::string s_lm_path = model_path[LM_DIR]; + + std::string python_cmd = + "python -m funasr.download.runtime_sdk_download_tool --type onnx --quantize True "; + + if (!s_vad_path.empty()) { + std::string python_cmd_vad; + std::string down_vad_path; + std::string down_vad_model; + + if (access(s_vad_path.c_str(), F_OK) == 0) { + // local + python_cmd_vad = python_cmd + " --model-name " + s_vad_path + + " --export-dir ./ " + " --model_revision " + + model_path["vad-revision"]; + down_vad_path = s_vad_path; + } else { + // modelscope + LOG(INFO) << "Download model: " << s_vad_path + << " from modelscope: "; + python_cmd_vad = python_cmd + " --model-name " + + s_vad_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["vad-revision"]; + down_vad_path = + s_download_model_dir + + "/" + s_vad_path; + } + + int ret = system(python_cmd_vad.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local vad model path, you can ignore the errors."; + } + down_vad_model = down_vad_path + "/model_quant.onnx"; + if (s_vad_quant == "false" || s_vad_quant == "False" || + s_vad_quant == "FALSE") { + down_vad_model = down_vad_path + "/model.onnx"; + } + + if (access(down_vad_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_vad_model << " do not exists."; + exit(-1); + } else { + model_path[VAD_DIR] = down_vad_path; + LOG(INFO) << "Set " << VAD_DIR << " : " << model_path[VAD_DIR]; + } + } + else { + LOG(INFO) << "VAD model is not set, use default."; + } + + if (!s_offline_asr_path.empty()) { + std::string python_cmd_asr; + std::string down_asr_path; + std::string down_asr_model; + + size_t found = s_offline_asr_path.find("speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404"); + if (found != std::string::npos) { + model_path["offline-model-revision"]="v2.0.4"; + } + + found = s_offline_asr_path.find("speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404"); + if (found != std::string::npos) { + model_path["offline-model-revision"]="v2.0.5"; + } + + found = s_offline_asr_path.find("speech_paraformer-large_asr_nat-en-16k-common-vocab10020"); + if (found != std::string::npos) { + model_path["model-revision"]="v2.0.4"; + s_itn_path=""; + s_lm_path=""; + } + + if (access(s_offline_asr_path.c_str(), F_OK) == 0) { + // local + python_cmd_asr = python_cmd + " --model-name " + s_offline_asr_path + + " --export-dir ./ " + " --model_revision " + + model_path["offline-model-revision"]; + down_asr_path = s_offline_asr_path; + } + else { + // modelscope + LOG(INFO) << "Download model: " << s_offline_asr_path + << " from modelscope : "; + python_cmd_asr = python_cmd + " --model-name " + + s_offline_asr_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["offline-model-revision"]; + down_asr_path + = s_download_model_dir + "/" + s_offline_asr_path; + } + + int ret = system(python_cmd_asr.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local asr model path, you can ignore the errors."; + } + down_asr_model = down_asr_path + "/model_quant.onnx"; + if (s_asr_quant == "false" || s_asr_quant == "False" || + s_asr_quant == "FALSE") { + down_asr_model = down_asr_path + "/model.onnx"; + } + + if (access(down_asr_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_asr_model << " do not exists."; + exit(-1); + } else { + model_path[OFFLINE_MODEL_DIR] = down_asr_path; + LOG(INFO) << "Set " << OFFLINE_MODEL_DIR << " : " << model_path[OFFLINE_MODEL_DIR]; + } + } else { + LOG(INFO) << "ASR Offline model is not set, use default."; + } + + if (!s_online_asr_path.empty()) { + std::string python_cmd_asr; + std::string down_asr_path; + std::string down_asr_model; + + if (access(s_online_asr_path.c_str(), F_OK) == 0) { + // local + python_cmd_asr = python_cmd + " --model-name " + s_online_asr_path + + " --export-dir ./ " + " --model_revision " + + model_path["online-model-revision"]; + down_asr_path = s_online_asr_path; + } else { + // modelscope + LOG(INFO) << "Download model: " << s_online_asr_path + << " from modelscope : "; + python_cmd_asr = python_cmd + " --model-name " + + s_online_asr_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["online-model-revision"]; + down_asr_path + = s_download_model_dir + "/" + s_online_asr_path; + } + + int ret = system(python_cmd_asr.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local asr model path, you can ignore the errors."; + } + down_asr_model = down_asr_path + "/model_quant.onnx"; + if (s_asr_quant == "false" || s_asr_quant == "False" || + s_asr_quant == "FALSE") { + down_asr_model = down_asr_path + "/model.onnx"; + } + + if (access(down_asr_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_asr_model << " do not exists."; + exit(-1); + } else { + model_path[ONLINE_MODEL_DIR] = down_asr_path; + LOG(INFO) << "Set " << ONLINE_MODEL_DIR << " : " << model_path[ONLINE_MODEL_DIR]; + } + } else { + LOG(INFO) << "ASR online model is not set, use default."; + } + + if (!s_lm_path.empty() && s_lm_path != "NONE" && s_lm_path != "none") { + std::string python_cmd_lm; + std::string down_lm_path; + std::string down_lm_model; + + if (access(s_lm_path.c_str(), F_OK) == 0) { + // local + python_cmd_lm = python_cmd + " --model-name " + s_lm_path + + " --export-dir ./ " + " --model_revision " + + model_path["lm-revision"] + " --export False "; + down_lm_path = s_lm_path; + } else { + // modelscope + LOG(INFO) << "Download model: " << s_lm_path + << " from modelscope : "; + python_cmd_lm = python_cmd + " --model-name " + + s_lm_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["lm-revision"] + + " --export False "; + down_lm_path = + s_download_model_dir + + "/" + s_lm_path; + } + + int ret = system(python_cmd_lm.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local lm model path, you can ignore the errors."; + } + down_lm_model = down_lm_path + "/TLG.fst"; + + if (access(down_lm_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_lm_model << " do not exists."; + exit(-1); + } else { + model_path[LM_DIR] = down_lm_path; + LOG(INFO) << "Set " << LM_DIR << " : " << model_path[LM_DIR]; + } + } else { + LOG(INFO) << "LM model is not set, not executed."; + model_path[LM_DIR] = ""; + } + + if (!s_punc_path.empty()) { + std::string python_cmd_punc; + std::string down_punc_path; + std::string down_punc_model; + + if (access(s_punc_path.c_str(), F_OK) == 0) { + // local + python_cmd_punc = python_cmd + " --model-name " + s_punc_path + + " --export-dir ./ " + " --model_revision " + + model_path["punc-revision"]; + down_punc_path = s_punc_path; + } else { + // modelscope + LOG(INFO) << "Download model: " << s_punc_path + << " from modelscope : "; + python_cmd_punc = python_cmd + " --model-name " + + s_punc_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["punc-revision"]; + down_punc_path = + s_download_model_dir + + "/" + s_punc_path; + } + + int ret = system(python_cmd_punc.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local punc model path, you can ignore the errors."; + } + down_punc_model = down_punc_path + "/model_quant.onnx"; + if (s_punc_quant == "false" || s_punc_quant == "False" || + s_punc_quant == "FALSE") { + down_punc_model = down_punc_path + "/model.onnx"; + } + + if (access(down_punc_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_punc_model << " do not exists."; + exit(-1); + } else { + model_path[PUNC_DIR] = down_punc_path; + LOG(INFO) << "Set " << PUNC_DIR << " : " << model_path[PUNC_DIR]; + } + } else { + LOG(INFO) << "PUNC model is not set, use default."; + } + + if (!s_itn_path.empty()) { + std::string python_cmd_itn; + std::string down_itn_path; + std::string down_itn_model; + + if (access(s_itn_path.c_str(), F_OK) == 0) { + // local + python_cmd_itn = python_cmd + " --model-name " + s_itn_path + + " --export-dir ./ " + " --model_revision " + + model_path["itn-revision"] + " --export False "; + down_itn_path = s_itn_path; + } else { + // modelscope + LOG(INFO) << "Download model: " << s_itn_path + << " from modelscope : "; + python_cmd_itn = python_cmd + " --model-name " + + s_itn_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["itn-revision"] + + " --export False "; + down_itn_path = + s_download_model_dir + + "/" + s_itn_path; + } + + int ret = system(python_cmd_itn.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local itn model path, you can ignore the errors."; + } + down_itn_model = down_itn_path + "/zh_itn_tagger.fst"; + + if (access(down_itn_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_itn_model << " do not exists."; + exit(-1); + } else { + model_path[ITN_DIR] = down_itn_path; + LOG(INFO) << "Set " << ITN_DIR << " : " << model_path[ITN_DIR]; + } + } else { + LOG(INFO) << "ITN model is not set, use default."; + } + + } catch (std::exception const& e) { + LOG(ERROR) << "Error: " << e.what(); + } + + std::string s_listen_ip = listen_ip.getValue(); + int s_port = port.getValue(); + int s_io_thread_num = io_thread_num.getValue(); + int s_decoder_thread_num = decoder_thread_num.getValue(); + + int s_model_thread_num = model_thread_num.getValue(); + + asio::io_context io_decoder; // context for decoding + asio::io_context io_server; // context for server + + std::vector decoder_threads; + + std::string s_certfile = certfile.getValue(); + std::string s_keyfile = keyfile.getValue(); + + // hotword file + std::string hotword_path; + hotword_path = model_path.at(HOTWORD); + fst_inc_wts_ = fst_inc_wts.getValue(); + LOG(INFO) << "hotword path: " << hotword_path; + funasr::ExtractHws(hotword_path, hws_map_); + + bool is_ssl = false; + if (!s_certfile.empty() && access(s_certfile.c_str(), F_OK) == 0) { + is_ssl = true; + } + + auto conn_guard = asio::make_work_guard( + io_decoder); // make sure threads can wait in the queue + auto server_guard = asio::make_work_guard( + io_server); // make sure threads can wait in the queue + // create threads pool + for (int32_t i = 0; i < s_decoder_thread_num; ++i) { + decoder_threads.emplace_back([&io_decoder]() { io_decoder.run(); }); + } + + server server_; // server for websocket + wss_server wss_server_; + server* server = nullptr; + wss_server* wss_server = nullptr; + if (is_ssl) { + LOG(INFO)<< "SSL is opened!"; + wss_server_.init_asio(&io_server); // init asio + wss_server_.set_reuse_addr( + true); // reuse address as we create multiple threads + + // list on port for accept + wss_server_.listen(asio::ip::address::from_string(s_listen_ip), s_port); + wss_server = &wss_server_; + + } else { + LOG(INFO)<< "SSL is closed!"; + server_.init_asio(&io_server); // init asio + server_.set_reuse_addr( + true); // reuse address as we create multiple threads + + // list on port for accept + server_.listen(asio::ip::address::from_string(s_listen_ip), s_port); + server = &server_; + + } + + WebSocketServer websocket_srv( + io_decoder, is_ssl, server, wss_server, s_certfile, + s_keyfile); // websocket server for asr engine + websocket_srv.initAsr(model_path, s_model_thread_num); // init asr model + + LOG(INFO) << "decoder-thread-num: " << s_decoder_thread_num; + LOG(INFO) << "io-thread-num: " << s_io_thread_num; + LOG(INFO) << "model-thread-num: " << s_model_thread_num; + LOG(INFO) << "asr model init finished. listen on port:" << s_port; + + // Start the ASIO network io_service run loop + std::vector ts; + // create threads for io network + for (size_t i = 0; i < s_io_thread_num; i++) { + ts.emplace_back([&io_server]() { io_server.run(); }); + } + // wait for theads + for (size_t i = 0; i < s_io_thread_num; i++) { + ts[i].join(); + } + + // wait for theads + for (auto& t : decoder_threads) { + t.join(); + } + + } catch (std::exception const& e) { + LOG(ERROR) << "Error: " << e.what(); + } + + return 0; +} diff --git a/runtime/websocket/bin/funasr-wss-server.cpp b/runtime/websocket/bin/funasr-wss-server.cpp new file mode 100644 index 0000000..5bb7def --- /dev/null +++ b/runtime/websocket/bin/funasr-wss-server.cpp @@ -0,0 +1,499 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +#include "websocket-server.h" +#ifdef _WIN32 +#include "win_func.h" +#else +#include +#endif +#include +#include "util.h" + +// hotwords +std::unordered_map hws_map_; +int fst_inc_wts_=20; +float global_beam_, lattice_beam_, am_scale_; + +using namespace std; +void GetValue(TCLAP::ValueArg& value_arg, string key, + std::map& model_path) { + model_path.insert({key, value_arg.getValue()}); + LOG(INFO) << key << " : " << value_arg.getValue(); +} + +int main(int argc, char* argv[]) { +#ifdef _WIN32 + #include + SetConsoleOutputCP(65001); +#endif + try { + + google::InitGoogleLogging(argv[0]); + FLAGS_logtostderr = true; + std::string offline_version = ""; +#ifdef _WIN32 + offline_version = "0.1.0"; +#endif + TCLAP::CmdLine cmd("funasr-wss-server", ' ', offline_version); + TCLAP::ValueArg download_model_dir( + "", "download-model-dir", + "Download model from Modelscope to download_model_dir", + false, "/workspace/models", "string"); + TCLAP::ValueArg model_dir( + "", MODEL_DIR, + "default: /workspace/models/asr, the asr model path, which contains model_quant.onnx, config.yaml, am.mvn", + false, "/workspace/models/asr", "string"); + TCLAP::ValueArg model_revision( + "", "model-revision", + "ASR model revision", + false, "v2.0.4", "string"); + TCLAP::ValueArg quantize( + "", QUANTIZE, + "true (Default), load the model of model_quant.onnx in model_dir. If set " + "false, load the model of model.onnx in model_dir", + false, "true", "string"); + TCLAP::ValueArg vad_dir( + "", VAD_DIR, + "default: /workspace/models/vad, the vad model path, which contains model_quant.onnx, vad.yaml, vad.mvn", + false, "/workspace/models/vad", "string"); + TCLAP::ValueArg vad_revision( + "", "vad-revision", + "VAD model revision", + false, "v2.0.4", "string"); + TCLAP::ValueArg vad_quant( + "", VAD_QUANT, + "true (Default), load the model of model_quant.onnx in vad_dir. If set " + "false, load the model of model.onnx in vad_dir", + false, "true", "string"); + TCLAP::ValueArg punc_dir( + "", PUNC_DIR, + "default: /workspace/models/punc, the punc model path, which contains model_quant.onnx, punc.yaml", + false, "/workspace/models/punc", + "string"); + TCLAP::ValueArg punc_revision( + "", "punc-revision", + "PUNC model revision", + false, "v2.0.4", "string"); + TCLAP::ValueArg punc_quant( + "", PUNC_QUANT, + "true (Default), load the model of model_quant.onnx in punc_dir. If set " + "false, load the model of model.onnx in punc_dir", + false, "true", "string"); + TCLAP::ValueArg itn_dir( + "", ITN_DIR, + "default: thuduj12/fst_itn_zh, the itn model path, which contains " + "zh_itn_tagger.fst, zh_itn_verbalizer.fst", + false, "thuduj12/fst_itn_zh", "string"); + TCLAP::ValueArg itn_revision( + "", "itn-revision", "ITN model revision", false, "v1.0.1", "string"); + + TCLAP::ValueArg listen_ip("", "listen-ip", "listen ip", false, + "0.0.0.0", "string"); + TCLAP::ValueArg port("", "port", "port", false, 10095, "int"); + TCLAP::ValueArg io_thread_num("", "io-thread-num", "io thread num", + false, 2, "int"); + TCLAP::ValueArg decoder_thread_num( + "", "decoder-thread-num", "decoder thread num", false, 8, "int"); + TCLAP::ValueArg model_thread_num("", "model-thread-num", + "model thread num", false, 1, "int"); + + TCLAP::ValueArg certfile("", "certfile", + "default: ../../../ssl_key/server.crt, path of certficate for WSS connection. if it is empty, it will be in WS mode.", + false, "../../../ssl_key/server.crt", "string"); + TCLAP::ValueArg keyfile("", "keyfile", + "default: ../../../ssl_key/server.key, path of keyfile for WSS connection", + false, "../../../ssl_key/server.key", "string"); + + TCLAP::ValueArg global_beam("", GLOB_BEAM, "the decoding beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg lattice_beam("", LAT_BEAM, "the lattice generation beam for beam searching ", false, 3.0, "float"); + TCLAP::ValueArg am_scale("", AM_SCALE, "the acoustic scale for beam searching ", false, 10.0, "float"); + + TCLAP::ValueArg lm_dir("", LM_DIR, + "the LM model path, which contains compiled models: TLG.fst, config.yaml ", false, "damo/speech_ngram_lm_zh-cn-ai-wesp-fst", "string"); + TCLAP::ValueArg lm_revision( + "", "lm-revision", "LM model revision", false, "v1.0.2", "string"); + TCLAP::ValueArg hotword("", HOTWORD, + "the hotword file, one hotword perline, Format: Hotword Weight (could be: 阿里巴巴 20)", + false, "/workspace/resources/hotwords.txt", "string"); + TCLAP::ValueArg fst_inc_wts("", FST_INC_WTS, + "the fst hotwords incremental bias", false, 20, "int32_t"); + + // add file + cmd.add(hotword); + cmd.add(fst_inc_wts); + cmd.add(global_beam); + cmd.add(lattice_beam); + cmd.add(am_scale); + + cmd.add(certfile); + cmd.add(keyfile); + cmd.add(download_model_dir); + cmd.add(model_dir); + cmd.add(model_revision); + cmd.add(quantize); + cmd.add(vad_dir); + cmd.add(vad_revision); + cmd.add(vad_quant); + cmd.add(punc_dir); + cmd.add(punc_revision); + cmd.add(punc_quant); + cmd.add(itn_dir); + cmd.add(itn_revision); + cmd.add(lm_dir); + cmd.add(lm_revision); + + cmd.add(listen_ip); + cmd.add(port); + cmd.add(io_thread_num); + cmd.add(decoder_thread_num); + cmd.add(model_thread_num); + cmd.parse(argc, argv); + + std::map model_path; + GetValue(model_dir, MODEL_DIR, model_path); + GetValue(quantize, QUANTIZE, model_path); + GetValue(vad_dir, VAD_DIR, model_path); + GetValue(vad_quant, VAD_QUANT, model_path); + GetValue(punc_dir, PUNC_DIR, model_path); + GetValue(punc_quant, PUNC_QUANT, model_path); + GetValue(itn_dir, ITN_DIR, model_path); + GetValue(lm_dir, LM_DIR, model_path); + GetValue(hotword, HOTWORD, model_path); + + GetValue(model_revision, "model-revision", model_path); + GetValue(vad_revision, "vad-revision", model_path); + GetValue(punc_revision, "punc-revision", model_path); + GetValue(itn_revision, "itn-revision", model_path); + GetValue(lm_revision, "lm-revision", model_path); + + global_beam_ = global_beam.getValue(); + lattice_beam_ = lattice_beam.getValue(); + am_scale_ = am_scale.getValue(); + + // Download model form Modelscope + try{ + std::string s_download_model_dir = download_model_dir.getValue(); + + std::string s_vad_path = model_path[VAD_DIR]; + std::string s_vad_quant = model_path[VAD_QUANT]; + std::string s_asr_path = model_path[MODEL_DIR]; + std::string s_asr_quant = model_path[QUANTIZE]; + std::string s_punc_path = model_path[PUNC_DIR]; + std::string s_punc_quant = model_path[PUNC_QUANT]; + std::string s_itn_path = model_path[ITN_DIR]; + std::string s_lm_path = model_path[LM_DIR]; + + std::string python_cmd = "python -m funasr.download.runtime_sdk_download_tool --type onnx --quantize True "; + + if(vad_dir.isSet() && !s_vad_path.empty()){ + std::string python_cmd_vad; + std::string down_vad_path; + std::string down_vad_model; + + if (access(s_vad_path.c_str(), F_OK) == 0){ + // local + python_cmd_vad = python_cmd + " --model-name " + s_vad_path + " --export-dir ./ " + " --model_revision " + model_path["vad-revision"]; + down_vad_path = s_vad_path; + }else{ + // modelscope + LOG(INFO) << "Download model: " << s_vad_path << " from modelscope: "; + python_cmd_vad = python_cmd + " --model-name " + s_vad_path + " --export-dir " + s_download_model_dir + " --model_revision " + model_path["vad-revision"]; + down_vad_path = s_download_model_dir+"/"+s_vad_path; + } + + int ret = system(python_cmd_vad.c_str()); + if(ret !=0){ + LOG(INFO) << "Failed to download model from modelscope. If you set local vad model path, you can ignore the errors."; + } + down_vad_model = down_vad_path+"/model_quant.onnx"; + if(s_vad_quant=="false" || s_vad_quant=="False" || s_vad_quant=="FALSE"){ + down_vad_model = down_vad_path+"/model.onnx"; + } + + if (access(down_vad_model.c_str(), F_OK) != 0){ + LOG(ERROR) << down_vad_model << " do not exists."; + exit(-1); + }else{ + model_path[VAD_DIR]=down_vad_path; + LOG(INFO) << "Set " << VAD_DIR << " : " << model_path[VAD_DIR]; + } + }else{ + LOG(INFO) << "VAD model is not set, use default."; + } + + if(model_dir.isSet() && !s_asr_path.empty()){ + std::string python_cmd_asr; + std::string down_asr_path; + std::string down_asr_model; + + // modify model-revision by model name + size_t found = s_asr_path.find("speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404"); + if (found != std::string::npos) { + model_path["model-revision"]="v2.0.4"; + } + + found = s_asr_path.find("speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404"); + if (found != std::string::npos) { + model_path["model-revision"]="v2.0.5"; + } + + found = s_asr_path.find("speech_paraformer-large_asr_nat-en-16k-common-vocab10020"); + if (found != std::string::npos) { + model_path["model-revision"]="v2.0.4"; + s_itn_path=""; + s_lm_path=""; + } + + if (access(s_asr_path.c_str(), F_OK) == 0){ + // local + python_cmd_asr = python_cmd + " --model-name " + s_asr_path + " --export-dir ./ " + " --model_revision " + model_path["model-revision"]; + down_asr_path = s_asr_path; + }else{ + // modelscope + LOG(INFO) << "Download model: " << s_asr_path << " from modelscope: "; + python_cmd_asr = python_cmd + " --model-name " + s_asr_path + " --export-dir " + s_download_model_dir + " --model_revision " + model_path["model-revision"]; + down_asr_path = s_download_model_dir+"/"+s_asr_path; + } + + int ret = system(python_cmd_asr.c_str()); + if(ret !=0){ + LOG(INFO) << "Failed to download model from modelscope. If you set local asr model path, you can ignore the errors."; + } + down_asr_model = down_asr_path+"/model_quant.onnx"; + if(s_asr_quant=="false" || s_asr_quant=="False" || s_asr_quant=="FALSE"){ + down_asr_model = down_asr_path+"/model.onnx"; + } + + if (access(down_asr_model.c_str(), F_OK) != 0){ + LOG(ERROR) << down_asr_model << " do not exists."; + exit(-1); + }else{ + model_path[MODEL_DIR]=down_asr_path; + LOG(INFO) << "Set " << MODEL_DIR << " : " << model_path[MODEL_DIR]; + } + }else{ + LOG(INFO) << "ASR model is not set, use default."; + } + + if (!s_itn_path.empty()) { + std::string python_cmd_itn; + std::string down_itn_path; + std::string down_itn_model; + + if (access(s_itn_path.c_str(), F_OK) == 0) { + // local + python_cmd_itn = python_cmd + " --model-name " + s_itn_path + + " --export-dir ./ " + " --model_revision " + + model_path["itn-revision"] + " --export False "; + down_itn_path = s_itn_path; + } else { + // modelscope + LOG(INFO) << "Download model: " << s_itn_path + << " from modelscope : "; + python_cmd_itn = python_cmd + " --model-name " + + s_itn_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["itn-revision"] + + " --export False "; + down_itn_path = + s_download_model_dir + + "/" + s_itn_path; + } + + int ret = system(python_cmd_itn.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local itn model path, you can ignore the errors."; + } + down_itn_model = down_itn_path + "/zh_itn_tagger.fst"; + + if (access(down_itn_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_itn_model << " do not exists."; + exit(-1); + } else { + model_path[ITN_DIR] = down_itn_path; + LOG(INFO) << "Set " << ITN_DIR << " : " << model_path[ITN_DIR]; + } + } else { + LOG(INFO) << "ITN model is not set, not executed."; + } + + if (!s_lm_path.empty() && s_lm_path != "NONE" && s_lm_path != "none") { + std::string python_cmd_lm; + std::string down_lm_path; + std::string down_lm_model; + + if (access(s_lm_path.c_str(), F_OK) == 0) { + // local + python_cmd_lm = python_cmd + " --model-name " + s_lm_path + + " --export-dir ./ " + " --model_revision " + + model_path["lm-revision"] + " --export False "; + down_lm_path = s_lm_path; + } else { + // modelscope + LOG(INFO) << "Download model: " << s_lm_path + << " from modelscope : "; + python_cmd_lm = python_cmd + " --model-name " + + s_lm_path + + " --export-dir " + s_download_model_dir + + " --model_revision " + model_path["lm-revision"] + + " --export False "; + down_lm_path = + s_download_model_dir + + "/" + s_lm_path; + } + + int ret = system(python_cmd_lm.c_str()); + if (ret != 0) { + LOG(INFO) << "Failed to download model from modelscope. If you set local lm model path, you can ignore the errors."; + } + down_lm_model = down_lm_path + "/TLG.fst"; + + if (access(down_lm_model.c_str(), F_OK) != 0) { + LOG(ERROR) << down_lm_model << " do not exists."; + exit(-1); + } else { + model_path[LM_DIR] = down_lm_path; + LOG(INFO) << "Set " << LM_DIR << " : " << model_path[LM_DIR]; + } + } else { + LOG(INFO) << "LM model is not set, not executed."; + model_path[LM_DIR] = ""; + } + + if(punc_dir.isSet() && !s_punc_path.empty()){ + std::string python_cmd_punc; + std::string down_punc_path; + std::string down_punc_model; + + if (access(s_punc_path.c_str(), F_OK) == 0){ + // local + python_cmd_punc = python_cmd + " --model-name " + s_punc_path + " --export-dir ./ " + " --model_revision " + model_path["punc-revision"]; + down_punc_path = s_punc_path; + }else{ + // modelscope + LOG(INFO) << "Download model: " << s_punc_path << " from modelscope: "; + python_cmd_punc = python_cmd + " --model-name " + s_punc_path + " --export-dir " + s_download_model_dir + " --model_revision " + model_path["punc-revision"]; + down_punc_path = s_download_model_dir+"/"+s_punc_path; + } + + int ret = system(python_cmd_punc.c_str()); + if(ret !=0){ + LOG(INFO) << "Failed to download model from modelscope. If you set local punc model path, you can ignore the errors."; + } + down_punc_model = down_punc_path+"/model_quant.onnx"; + if(s_punc_quant=="false" || s_punc_quant=="False" || s_punc_quant=="FALSE"){ + down_punc_model = down_punc_path+"/model.onnx"; + } + + if (access(down_punc_model.c_str(), F_OK) != 0){ + LOG(ERROR) << down_punc_model << " do not exists."; + exit(-1); + }else{ + model_path[PUNC_DIR]=down_punc_path; + LOG(INFO) << "Set " << PUNC_DIR << " : " << model_path[PUNC_DIR]; + } + }else{ + LOG(INFO) << "PUNC model is not set, use default."; + } + + } catch (std::exception const& e) { + LOG(ERROR) << "Error: " << e.what(); + } + + std::string s_listen_ip = listen_ip.getValue(); + int s_port = port.getValue(); + int s_io_thread_num = io_thread_num.getValue(); + int s_decoder_thread_num = decoder_thread_num.getValue(); + + int s_model_thread_num = model_thread_num.getValue(); + + asio::io_context io_decoder; // context for decoding + asio::io_context io_server; // context for server + + std::vector decoder_threads; + + std::string s_certfile = certfile.getValue(); + std::string s_keyfile = keyfile.getValue(); + + // hotword file + std::string hotword_path; + hotword_path = model_path.at(HOTWORD); + fst_inc_wts_ = fst_inc_wts.getValue(); + LOG(INFO) << "hotword path: " << hotword_path; + funasr::ExtractHws(hotword_path, hws_map_); + + bool is_ssl = false; + if (!s_certfile.empty() && access(s_certfile.c_str(), F_OK) == 0) { + is_ssl = true; + } + + auto conn_guard = asio::make_work_guard( + io_decoder); // make sure threads can wait in the queue + auto server_guard = asio::make_work_guard( + io_server); // make sure threads can wait in the queue + // create threads pool + for (int32_t i = 0; i < s_decoder_thread_num; ++i) { + decoder_threads.emplace_back([&io_decoder]() { io_decoder.run(); }); + } + + server server_; // server for websocket + wss_server wss_server_; + server* server = nullptr; + wss_server* wss_server = nullptr; + if (is_ssl) { + LOG(INFO)<< "SSL is opened!"; + wss_server_.init_asio(&io_server); // init asio + wss_server_.set_reuse_addr( + true); // reuse address as we create multiple threads + + // list on port for accept + wss_server_.listen(asio::ip::address::from_string(s_listen_ip), s_port); + wss_server = &wss_server_; + } else { + LOG(INFO)<< "SSL is closed!"; + server_.init_asio(&io_server); // init asio + server_.set_reuse_addr( + true); // reuse address as we create multiple threads + + // list on port for accept + server_.listen(asio::ip::address::from_string(s_listen_ip), s_port); + server = &server_; + } + + + WebSocketServer websocket_srv( + io_decoder, is_ssl, server, wss_server, s_certfile, + s_keyfile); // websocket server for asr engine + websocket_srv.initAsr(model_path, s_model_thread_num); // init asr model + + LOG(INFO) << "decoder-thread-num: " << s_decoder_thread_num; + LOG(INFO) << "io-thread-num: " << s_io_thread_num; + LOG(INFO) << "model-thread-num: " << s_model_thread_num; + LOG(INFO) << "asr model init finished. listen on port:" << s_port; + + // Start the ASIO network io_service run loop + std::vector ts; + // create threads for io network + for (size_t i = 0; i < s_io_thread_num; i++) { + ts.emplace_back([&io_server]() { io_server.run(); }); + } + // wait for theads + for (size_t i = 0; i < s_io_thread_num; i++) { + ts[i].join(); + } + + // wait for theads + for (auto& t : decoder_threads) { + t.join(); + } + + } catch (std::exception const& e) { + LOG(ERROR) << "Error: " << e.what(); + } + + return 0; +} diff --git a/runtime/websocket/bin/microphone.cpp b/runtime/websocket/bin/microphone.cpp new file mode 100644 index 0000000..c8b7d5f --- /dev/null +++ b/runtime/websocket/bin/microphone.cpp @@ -0,0 +1,27 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +#include "microphone.h" + +#include +#include + +#include "portaudio.h" // NOLINT + +Microphone::Microphone() { + PaError err = Pa_Initialize(); + if (err != paNoError) { + LOG(ERROR)<<"portaudio error: " << Pa_GetErrorText(err); + exit(-1); + } +} + +Microphone::~Microphone() { + PaError err = Pa_Terminate(); + if (err != paNoError) { + LOG(ERROR)<<"portaudio error: " << Pa_GetErrorText(err); + exit(-1); + } +} diff --git a/runtime/websocket/bin/microphone.h b/runtime/websocket/bin/microphone.h new file mode 100644 index 0000000..250a815 --- /dev/null +++ b/runtime/websocket/bin/microphone.h @@ -0,0 +1,16 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ + +#ifndef WEBSOCKET_MICROPHONE_H_ +#define WEBSOCKET_MICROPHONE_H_ +#include + +class Microphone { + public: + Microphone(); + ~Microphone(); +}; + +#endif // WEBSOCKET_MICROPHONE_H_ diff --git a/runtime/websocket/bin/websocket-server-2pass.cpp b/runtime/websocket/bin/websocket-server-2pass.cpp new file mode 100644 index 0000000..8c8cab4 --- /dev/null +++ b/runtime/websocket/bin/websocket-server-2pass.cpp @@ -0,0 +1,588 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +// websocket server for asr engine +// take some ideas from https://github.com/k2-fsa/sherpa-onnx +// online-websocket-server-impl.cc, thanks. The websocket server has two threads +// pools, one for handle network data and one for asr decoder. +// now only support offline engine. + +#include "websocket-server-2pass.h" + +#include +#include +#include + +extern std::unordered_map hws_map_; +extern int fst_inc_wts_; +extern float global_beam_, lattice_beam_, am_scale_; + +context_ptr WebSocketServer::on_tls_init(tls_mode mode, + websocketpp::connection_hdl hdl, + std::string& s_certfile, + std::string& s_keyfile) { + namespace asio = websocketpp::lib::asio; + + LOG(INFO) << "on_tls_init called with hdl: " << hdl.lock().get(); + LOG(INFO) << "using TLS mode: " + << (mode == MOZILLA_MODERN ? "Mozilla Modern" + : "Mozilla Intermediate"); + + context_ptr ctx = websocketpp::lib::make_shared( + asio::ssl::context::sslv23); + + try { + if (mode == MOZILLA_MODERN) { + // Modern disables TLSv1 + ctx->set_options( + asio::ssl::context::default_workarounds | + asio::ssl::context::no_sslv2 | asio::ssl::context::no_sslv3 | + asio::ssl::context::no_tlsv1 | asio::ssl::context::single_dh_use); + } else { + ctx->set_options(asio::ssl::context::default_workarounds | + asio::ssl::context::no_sslv2 | + asio::ssl::context::no_sslv3 | + asio::ssl::context::single_dh_use); + } + + ctx->use_certificate_chain_file(s_certfile); + ctx->use_private_key_file(s_keyfile, asio::ssl::context::pem); + + } catch (std::exception& e) { + LOG(INFO) << "Exception: " << e.what(); + } + return ctx; +} + +nlohmann::json handle_result(FUNASR_RESULT result) { + websocketpp::lib::error_code ec; + nlohmann::json jsonresult; + jsonresult["text"] = ""; + + std::string tmp_online_msg = FunASRGetResult(result, 0); + if (tmp_online_msg != "") { + LOG(INFO) << "online_res :" << tmp_online_msg; + jsonresult["text"] = tmp_online_msg; + jsonresult["mode"] = "2pass-online"; + } + std::string tmp_tpass_msg = FunASRGetTpassResult(result, 0); + if (tmp_tpass_msg != "") { + LOG(INFO) << "offline results : " << tmp_tpass_msg; + jsonresult["text"] = tmp_tpass_msg; + jsonresult["mode"] = "2pass-offline"; + } + + std::string tmp_stamp_msg = FunASRGetStamp(result); + if (tmp_stamp_msg != "") { + LOG(INFO) << "offline stamps : " << tmp_stamp_msg; + jsonresult["timestamp"] = tmp_stamp_msg; + } + + std::string tmp_stamp_sents = FunASRGetStampSents(result); + if (tmp_stamp_sents != "") { + try{ + nlohmann::json json_stamp = nlohmann::json::parse(tmp_stamp_sents); + LOG(INFO) << "offline stamp_sents : " << json_stamp; + jsonresult["stamp_sents"] = json_stamp; + }catch (std::exception const &e) + { + LOG(ERROR)<< tmp_stamp_sents << e.what(); + jsonresult["stamp_sents"] = ""; + } + } + + return jsonresult; +} +// feed buffer to asr engine for decoder +void WebSocketServer::do_decoder( + std::vector& buffer, + websocketpp::connection_hdl& hdl, + nlohmann::json& msg, + std::vector>& punc_cache, + std::vector> &hotwords_embedding, + websocketpp::lib::mutex& thread_lock, + bool& is_final, + std::string wav_name, + std::string modetype, + bool itn, + int audio_fs, + std::string wav_format, + FUNASR_HANDLE& tpass_online_handle, + FUNASR_DEC_HANDLE& decoder_handle) { + // lock for each connection + if(!tpass_online_handle){ + scoped_lock guard(thread_lock); + LOG(INFO) << "tpass_online_handle is free, return"; + msg["access_num"]=(int)msg["access_num"]-1; + return; + } + try { + FUNASR_RESULT Result = nullptr; + int asr_mode_ = 2; + if (modetype == "offline") { + asr_mode_ = 0; + } else if (modetype == "online") { + asr_mode_ = 1; + } else if (modetype == "2pass") { + asr_mode_ = 2; + } + + while (buffer.size() >= 800 * 2 && !msg["is_eof"]) { + std::vector subvector = {buffer.begin(), buffer.begin() + 800 * 2}; + buffer.erase(buffer.begin(), buffer.begin() + 800 * 2); + + try { + if (tpass_online_handle) { + Result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, + subvector.data(), subvector.size(), + punc_cache, false, audio_fs, + wav_format, (ASR_TYPE)asr_mode_, + hotwords_embedding, itn, decoder_handle); + + } else { + scoped_lock guard(thread_lock); + msg["access_num"]=(int)msg["access_num"]-1; + return; + } + } catch (std::exception const& e) { + scoped_lock guard(thread_lock); + LOG(ERROR) << e.what(); + msg["access_num"]=(int)msg["access_num"]-1; + return; + } + if (Result) { + websocketpp::lib::error_code ec; + nlohmann::json jsonresult = handle_result(Result); + jsonresult["wav_name"] = wav_name; + jsonresult["is_final"] = false; + if (jsonresult["text"] != "") { + if (is_ssl) { + wss_server_->send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } else { + server_->send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } + } + FunASRFreeResult(Result); + } + } + if (is_final && !msg["is_eof"]) { + try { + if (tpass_online_handle) { + Result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, + buffer.data(), buffer.size(), punc_cache, + is_final, audio_fs, + wav_format, (ASR_TYPE)asr_mode_, + hotwords_embedding, itn, decoder_handle); + } else { + scoped_lock guard(thread_lock); + msg["access_num"]=(int)msg["access_num"]-1; + return; + } + } catch (std::exception const& e) { + scoped_lock guard(thread_lock); + LOG(ERROR) << e.what(); + msg["access_num"]=(int)msg["access_num"]-1; + return; + } + if(punc_cache.size()>0){ + for (auto& vec : punc_cache) { + vec.clear(); + } + } + if (Result) { + websocketpp::lib::error_code ec; + nlohmann::json jsonresult = handle_result(Result); + jsonresult["wav_name"] = wav_name; + jsonresult["is_final"] = true; + if (is_ssl) { + wss_server_->send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } else { + server_->send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } + FunASRFreeResult(Result); + }else{ + if(wav_format != "pcm" && wav_format != "PCM"){ + websocketpp::lib::error_code ec; + nlohmann::json jsonresult; + jsonresult["text"] = "ERROR. Real-time transcription service ONLY SUPPORT PCM stream."; + jsonresult["wav_name"] = wav_name; + jsonresult["is_final"] = true; + if (is_ssl) { + wss_server_->send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } else { + server_->send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } + } + } + } + + } catch (std::exception const& e) { + std::cerr << "Error: " << e.what() << std::endl; + } + scoped_lock guard(thread_lock); + msg["access_num"]=(int)msg["access_num"]-1; + +} + +void WebSocketServer::on_open(websocketpp::connection_hdl hdl) { + scoped_lock guard(m_lock); // for threads safty + try{ + std::shared_ptr data_msg = + std::make_shared(); // put a new data vector for new + // connection + data_msg->samples = std::make_shared>(); + data_msg->thread_lock = std::make_shared(); + + data_msg->msg = nlohmann::json::parse("{}"); + data_msg->msg["wav_format"] = "pcm"; + data_msg->msg["wav_name"] = "wav-default-id"; + data_msg->msg["mode"] = "2pass"; + data_msg->msg["itn"] = true; + data_msg->msg["audio_fs"] = 16000; // default is 16k + data_msg->msg["access_num"] = 0; // the number of access for this object, when it is 0, we can free it saftly + data_msg->msg["is_eof"]=false; // if this connection is closed + FUNASR_DEC_HANDLE decoder_handle = + FunASRWfstDecoderInit(tpass_handle, ASR_TWO_PASS, global_beam_, lattice_beam_, am_scale_); + data_msg->decoder_handle = decoder_handle; + data_msg->punc_cache = + std::make_shared>>(2); + data_msg->strand_ = std::make_shared(io_decoder_); + + data_map.emplace(hdl, data_msg); + }catch (std::exception const& e) { + std::cerr << "Error: " << e.what() << std::endl; + } +} + +void remove_hdl( + websocketpp::connection_hdl hdl, + std::map, + std::owner_less>& data_map) { + + std::shared_ptr data_msg = nullptr; + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + data_msg = it_data->second; + } else { + return; + } + // scoped_lock guard_decoder(*(data_msg->thread_lock)); //wait for do_decoder + // finished and avoid access freed tpass_online_handle + unique_lock guard_decoder(*(data_msg->thread_lock)); + if (data_msg->msg["access_num"]==0 && data_msg->msg["is_eof"]==true) { + FunWfstDecoderUnloadHwsRes(data_msg->decoder_handle); + FunASRWfstDecoderUninit(data_msg->decoder_handle); + data_msg->decoder_handle = nullptr; + FunTpassOnlineUninit(data_msg->tpass_online_handle); + data_msg->tpass_online_handle = nullptr; + data_map.erase(hdl); + } + + guard_decoder.unlock(); +} + +void WebSocketServer::on_close(websocketpp::connection_hdl hdl) { + scoped_lock guard(m_lock); + std::shared_ptr data_msg = nullptr; + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + data_msg = it_data->second; + } else { + return; + } + unique_lock guard_decoder(*(data_msg->thread_lock)); + data_msg->msg["is_eof"]=true; + guard_decoder.unlock(); +} + +// remove closed connection +void WebSocketServer::check_and_clean_connection() { + while(true){ + std::this_thread::sleep_for(std::chrono::milliseconds(5000)); + std::vector to_remove; // remove list + auto iter = data_map.begin(); + while (iter != data_map.end()) { // loop to find closed connection + websocketpp::connection_hdl hdl = iter->first; + try{ + if (is_ssl) { + wss_server::connection_ptr con = wss_server_->get_con_from_hdl(hdl); + if (con->get_state() != 1) { // session::state::open ==1 + to_remove.push_back(hdl); + } + } else { + server::connection_ptr con = server_->get_con_from_hdl(hdl); + if (con->get_state() != 1) { // session::state::open ==1 + to_remove.push_back(hdl); + } + } + } + catch (std::exception const &e) + { + // if connection is close, we set is_eof = true + std::shared_ptr data_msg = nullptr; + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + data_msg = it_data->second; + } else { + continue; + } + unique_lock guard_decoder(*(data_msg->thread_lock)); + data_msg->msg["is_eof"]=true; + guard_decoder.unlock(); + to_remove.push_back(hdl); + LOG(INFO)<<"connection is closed."; + + } + iter++; + } + for (auto hdl : to_remove) { + { + unique_lock lock(m_lock); + remove_hdl(hdl, data_map); + } + } + } +} +void WebSocketServer::on_message(websocketpp::connection_hdl hdl, + message_ptr msg) { + unique_lock lock(m_lock); + // find the sample data vector according to one connection + + std::shared_ptr msg_data = nullptr; + + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + msg_data = it_data->second; + if(msg_data->msg["is_eof"]){ + lock.unlock(); + return; + } + } else { + lock.unlock(); + return; + } + + std::shared_ptr> sample_data_p = msg_data->samples; + std::shared_ptr>> punc_cache_p = + msg_data->punc_cache; + std::shared_ptr thread_lock_p = msg_data->thread_lock; + + lock.unlock(); + + if (sample_data_p == nullptr) { + LOG(INFO) << "error when fetch sample data vector"; + return; + } + + const std::string& payload = msg->get_payload(); // get msg type + unique_lock guard_decoder(*(thread_lock_p)); // mutex for one connection + switch (msg->get_opcode()) { + case websocketpp::frame::opcode::text: { + nlohmann::json jsonresult; + try{ + jsonresult = nlohmann::json::parse(payload); + }catch (std::exception const &e) + { + LOG(ERROR)<msg["is_eof"]=true; + guard_decoder.unlock(); + return; + } + + if (jsonresult.contains("wav_name")) { + msg_data->msg["wav_name"] = jsonresult["wav_name"]; + } + if (jsonresult.contains("mode")) { + msg_data->msg["mode"] = jsonresult["mode"]; + } + if (jsonresult.contains("wav_format")) { + msg_data->msg["wav_format"] = jsonresult["wav_format"]; + } + + // hotwords: fst/nn + if(msg_data->hotwords_embedding == nullptr){ + std::unordered_map merged_hws_map; + std::string nn_hotwords = ""; + + if (jsonresult["hotwords"] != nullptr) { + std::string json_string = jsonresult["hotwords"]; + if (!json_string.empty()){ + nlohmann::json json_fst_hws; + try{ + json_fst_hws = nlohmann::json::parse(json_string); + if(json_fst_hws.type() == nlohmann::json::value_t::object){ + // fst + try{ + std::unordered_map client_hws_map = json_fst_hws; + merged_hws_map.insert(client_hws_map.begin(), client_hws_map.end()); + } catch (const std::exception& e) { + LOG(INFO) << e.what(); + } + } + } catch (std::exception const &e) + { + LOG(ERROR)<decoder_handle, fst_inc_wts_, merged_hws_map); + + // nn + std::vector> new_hotwords_embedding = CompileHotwordEmbedding(tpass_handle, nn_hotwords, ASR_TWO_PASS); + msg_data->hotwords_embedding = + std::make_shared>>(new_hotwords_embedding); + } + + if (jsonresult.contains("audio_fs")) { + msg_data->msg["audio_fs"] = jsonresult["audio_fs"]; + } + if (jsonresult.contains("chunk_size")) { + if (msg_data->tpass_online_handle == nullptr) { + std::vector chunk_size_vec = + jsonresult["chunk_size"].get>(); + // check chunk_size_vec + if(chunk_size_vec.size() == 3 && chunk_size_vec[1] != 0){ + FUNASR_HANDLE tpass_online_handle = + FunTpassOnlineInit(tpass_handle, chunk_size_vec); + msg_data->tpass_online_handle = tpass_online_handle; + }else{ + LOG(ERROR) << "Wrong chunk_size!"; + break; + } + } + } + if (jsonresult.contains("itn")) { + msg_data->msg["itn"] = jsonresult["itn"]; + } + LOG(INFO) << "jsonresult=" << jsonresult + << ", msg_data->msg=" << msg_data->msg; + if ((jsonresult["is_speaking"] == false || + jsonresult["is_finished"] == true) && + msg_data->msg["is_eof"] != true && + msg_data->hotwords_embedding != nullptr) { + LOG(INFO) << "client done"; + + // if it is in final message, post the sample_data to decode + try{ + + std::vector> hotwords_embedding_(*(msg_data->hotwords_embedding)); + msg_data->strand_->post( + std::bind(&WebSocketServer::do_decoder, this, + std::move(*(sample_data_p.get())), std::move(hdl), + std::ref(msg_data->msg), std::ref(*(punc_cache_p.get())), + std::move(hotwords_embedding_), + std::ref(*thread_lock_p), std::move(true), + msg_data->msg["wav_name"], + msg_data->msg["mode"], + msg_data->msg["itn"], + msg_data->msg["audio_fs"], + msg_data->msg["wav_format"], + std::ref(msg_data->tpass_online_handle), + std::ref(msg_data->decoder_handle))); + msg_data->msg["access_num"]=(int)(msg_data->msg["access_num"])+1; + } + catch (std::exception const &e) + { + LOG(ERROR)<(payload.data()); + int32_t num_samples = payload.size(); + + if (isonline) { + sample_data_p->insert(sample_data_p->end(), pcm_data, + pcm_data + num_samples); + int setpsize = + 800 * 2; // TODO, need get from client + // if sample_data size > setpsize, we post data to decode + if (sample_data_p->size() > setpsize) { + int chunksize = floor(sample_data_p->size() / setpsize); + // make sure the subvector size is an integer multiple of setpsize + std::vector subvector = { + sample_data_p->begin(), + sample_data_p->begin() + chunksize * setpsize}; + // keep remain in sample_data + sample_data_p->erase(sample_data_p->begin(), + sample_data_p->begin() + chunksize * setpsize); + + try{ + // post to decode + if (msg_data->msg["is_eof"] != true && msg_data->hotwords_embedding != nullptr) { + std::vector> hotwords_embedding_(*(msg_data->hotwords_embedding)); + msg_data->strand_->post( + std::bind(&WebSocketServer::do_decoder, this, + std::move(subvector), std::move(hdl), + std::ref(msg_data->msg), + std::ref(*(punc_cache_p.get())), + std::move(hotwords_embedding_), + std::ref(*thread_lock_p), std::move(false), + msg_data->msg["wav_name"], + msg_data->msg["mode"], + msg_data->msg["itn"], + msg_data->msg["audio_fs"], + msg_data->msg["wav_format"], + std::ref(msg_data->tpass_online_handle), + std::ref(msg_data->decoder_handle))); + msg_data->msg["access_num"]=(int)(msg_data->msg["access_num"])+1; + } + } + catch (std::exception const &e) + { + LOG(ERROR)<insert(sample_data_p->end(), pcm_data, + pcm_data + num_samples); + } + break; + } + default: + break; + } + guard_decoder.unlock(); +} + +// init asr model +void WebSocketServer::initAsr(std::map& model_path, + int thread_num) { + try { + tpass_handle = FunTpassInit(model_path, thread_num); + if (!tpass_handle) { + LOG(ERROR) << "FunTpassInit init failed"; + exit(-1); + } + LOG(INFO) << "initAsr run check_and_clean_connection"; + std::thread clean_thread(&WebSocketServer::check_and_clean_connection,this); + clean_thread.detach(); + LOG(INFO) << "initAsr run check_and_clean_connection finished"; + + } catch (const std::exception& e) { + LOG(INFO) << e.what(); + } +} diff --git a/runtime/websocket/bin/websocket-server-2pass.h b/runtime/websocket/bin/websocket-server-2pass.h new file mode 100644 index 0000000..7938f88 --- /dev/null +++ b/runtime/websocket/bin/websocket-server-2pass.h @@ -0,0 +1,157 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +// websocket server for asr engine +// take some ideas from https://github.com/k2-fsa/sherpa-onnx +// online-websocket-server-impl.cc, thanks. The websocket server has two threads +// pools, one for handle network data and one for asr decoder. +// now only support offline engine. + +#ifndef WEBSOCKET_SERVER_H_ +#define WEBSOCKET_SERVER_H_ + +#include +#include +#include +#include +#include +#include +#define ASIO_STANDALONE 1 // not boost +#include +#include "util/text-utils.h" + +#include +#include +#include +#include +#include + +#include "asio.hpp" +#include "com-define.h" +#include "funasrruntime.h" +#include "nlohmann/json.hpp" +#include "tclap/CmdLine.h" +typedef websocketpp::server server; +typedef websocketpp::server wss_server; +typedef server::message_ptr message_ptr; +using websocketpp::lib::bind; +using websocketpp::lib::placeholders::_1; +using websocketpp::lib::placeholders::_2; + +typedef websocketpp::lib::lock_guard scoped_lock; +typedef websocketpp::lib::unique_lock unique_lock; +typedef websocketpp::lib::shared_ptr + context_ptr; + +typedef struct { + std::string msg; + float snippet_time; +} FUNASR_RECOG_RESULT; + +typedef struct { + nlohmann::json msg; + std::shared_ptr> samples; + std::shared_ptr>> punc_cache; + std::shared_ptr>> hotwords_embedding=nullptr; + std::shared_ptr thread_lock; // lock for each connection + FUNASR_HANDLE tpass_online_handle=nullptr; + std::string online_res = ""; + std::string tpass_res = ""; + std::shared_ptr strand_; // for data execute in order + FUNASR_DEC_HANDLE decoder_handle=nullptr; +} FUNASR_MESSAGE; + +// See https://wiki.mozilla.org/Security/Server_Side_TLS for more details about +// the TLS modes. The code below demonstrates how to implement both the modern +enum tls_mode { MOZILLA_INTERMEDIATE = 1, MOZILLA_MODERN = 2 }; +class WebSocketServer { + public: + WebSocketServer(asio::io_context& io_decoder, bool is_ssl, server* server, + wss_server* wss_server, std::string& s_certfile, + std::string& s_keyfile) + : io_decoder_(io_decoder), + is_ssl(is_ssl), + server_(server), + wss_server_(wss_server) { + if (is_ssl) { + std::cout << "certfile path is " << s_certfile << std::endl; + wss_server->set_tls_init_handler( + bind(&WebSocketServer::on_tls_init, this, + MOZILLA_INTERMEDIATE, ::_1, s_certfile, s_keyfile)); + wss_server_->set_message_handler( + [this](websocketpp::connection_hdl hdl, message_ptr msg) { + on_message(hdl, msg); + }); + // set open handle + wss_server_->set_open_handler( + [this](websocketpp::connection_hdl hdl) { on_open(hdl); }); + // set close handle + wss_server_->set_close_handler( + [this](websocketpp::connection_hdl hdl) { on_close(hdl); }); + // begin accept + wss_server_->start_accept(); + // not print log + wss_server_->clear_access_channels(websocketpp::log::alevel::all); + + } else { + // set message handle + server_->set_message_handler( + [this](websocketpp::connection_hdl hdl, message_ptr msg) { + on_message(hdl, msg); + }); + // set open handle + server_->set_open_handler( + [this](websocketpp::connection_hdl hdl) { on_open(hdl); }); + // set close handle + server_->set_close_handler( + [this](websocketpp::connection_hdl hdl) { on_close(hdl); }); + // begin accept + server_->start_accept(); + // not print log + server_->clear_access_channels(websocketpp::log::alevel::all); + } + } + void do_decoder(std::vector& buffer, websocketpp::connection_hdl& hdl, + nlohmann::json& msg, + std::vector>& punc_cache, + std::vector> &hotwords_embedding, + websocketpp::lib::mutex& thread_lock, bool& is_final, + std::string wav_name, + std::string modetype, + bool itn, + int audio_fs, + std::string wav_format, + FUNASR_HANDLE& tpass_online_handle, + FUNASR_DEC_HANDLE& decoder_handle); + + void initAsr(std::map& model_path, int thread_num); + void on_message(websocketpp::connection_hdl hdl, message_ptr msg); + void on_open(websocketpp::connection_hdl hdl); + void on_close(websocketpp::connection_hdl hdl); + context_ptr on_tls_init(tls_mode mode, websocketpp::connection_hdl hdl, + std::string& s_certfile, std::string& s_keyfile); + + private: + void check_and_clean_connection(); + asio::io_context& io_decoder_; // threads for asr decoder + // std::ofstream fout; + // FUNASR_HANDLE asr_handle; // asr engine handle + FUNASR_HANDLE tpass_handle=nullptr; + bool isonline = true; // online or offline engine, now only support offline + bool is_ssl = true; + server* server_; // websocket server + wss_server* wss_server_; // websocket server + + // use map to keep the received samples data from one connection in offline + // engine. if for online engline, a data struct is needed(TODO) + + std::map, + std::owner_less> + data_map; + websocketpp::lib::mutex m_lock; // mutex for sample_map +}; + +#endif // WEBSOCKET_SERVER_H_ diff --git a/runtime/websocket/bin/websocket-server.cpp b/runtime/websocket/bin/websocket-server.cpp new file mode 100644 index 0000000..ed25c95 --- /dev/null +++ b/runtime/websocket/bin/websocket-server.cpp @@ -0,0 +1,420 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +// websocket server for asr engine +// take some ideas from https://github.com/k2-fsa/sherpa-onnx +// online-websocket-server-impl.cc, thanks. The websocket server has two threads +// pools, one for handle network data and one for asr decoder. +// now only support offline engine. + +#include "websocket-server.h" + +#include +#include +#include + +extern std::unordered_map hws_map_; +extern int fst_inc_wts_; +extern float global_beam_, lattice_beam_, am_scale_; + +context_ptr WebSocketServer::on_tls_init(tls_mode mode, + websocketpp::connection_hdl hdl, + std::string& s_certfile, + std::string& s_keyfile) { + namespace asio = websocketpp::lib::asio; + + LOG(INFO) << "on_tls_init called with hdl: " << hdl.lock().get(); + LOG(INFO) << "using TLS mode: " + << (mode == MOZILLA_MODERN ? "Mozilla Modern" + : "Mozilla Intermediate"); + + context_ptr ctx = websocketpp::lib::make_shared( + asio::ssl::context::sslv23); + + try { + if (mode == MOZILLA_MODERN) { + // Modern disables TLSv1 + ctx->set_options( + asio::ssl::context::default_workarounds | + asio::ssl::context::no_sslv2 | asio::ssl::context::no_sslv3 | + asio::ssl::context::no_tlsv1 | asio::ssl::context::single_dh_use); + } else { + ctx->set_options(asio::ssl::context::default_workarounds | + asio::ssl::context::no_sslv2 | + asio::ssl::context::no_sslv3 | + asio::ssl::context::single_dh_use); + } + + ctx->use_certificate_chain_file(s_certfile); + ctx->use_private_key_file(s_keyfile, asio::ssl::context::pem); + + } catch (std::exception& e) { + LOG(INFO) << "Exception: " << e.what(); + } + return ctx; +} + +// feed buffer to asr engine for decoder +void WebSocketServer::do_decoder(const std::vector& buffer, + websocketpp::connection_hdl& hdl, + nlohmann::json& msg, + websocketpp::lib::mutex& thread_lock, + std::vector> &hotwords_embedding, + std::string wav_name, + bool itn, + int audio_fs, + std::string wav_format, + FUNASR_DEC_HANDLE& decoder_handle) { + try { + int num_samples = buffer.size(); // the size of the buf + + if (!buffer.empty() && hotwords_embedding.size() > 0) { + std::string asr_result=""; + std::string stamp_res=""; + std::string stamp_sents=""; + try{ + FUNASR_RESULT Result = FunOfflineInferBuffer( + asr_handle, buffer.data(), buffer.size(), RASR_NONE, nullptr, + hotwords_embedding, audio_fs, wav_format, itn, decoder_handle); + if (Result != nullptr){ + asr_result = FunASRGetResult(Result, 0); // get decode result + stamp_res = FunASRGetStamp(Result); + stamp_sents = FunASRGetStampSents(Result); + FunASRFreeResult(Result); + } else{ + std::this_thread::sleep_for(std::chrono::milliseconds(20)); + LOG(ERROR) << "FUNASR_RESULT is nullptr."; + } + }catch (std::exception const& e) { + LOG(ERROR) << e.what(); + } + + websocketpp::lib::error_code ec; + nlohmann::json jsonresult; // result json + jsonresult["text"] = asr_result; // put result in 'text' + jsonresult["mode"] = "offline"; + jsonresult["is_final"] = false; + if(stamp_res != ""){ + jsonresult["timestamp"] = stamp_res; + } + if(stamp_sents != ""){ + try{ + nlohmann::json json_stamp = nlohmann::json::parse(stamp_sents); + jsonresult["stamp_sents"] = json_stamp; + }catch (std::exception const &e) + { + LOG(ERROR)<send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } else { + server_->send(hdl, jsonresult.dump(), websocketpp::frame::opcode::text, + ec); + } + + LOG(INFO) << "buffer.size=" << buffer.size() << ",result json=" << jsonresult.dump(); + }else{ + LOG(INFO) << "Sent empty msg"; + websocketpp::lib::error_code ec; + nlohmann::json jsonresult; // result json + jsonresult["text"] = ""; // put result in 'text' + jsonresult["mode"] = "offline"; + jsonresult["is_final"] = false; + jsonresult["wav_name"] = wav_name; + + // send the json to client + if (is_ssl) { + wss_server_->send(hdl, jsonresult.dump(), + websocketpp::frame::opcode::text, ec); + } else { + server_->send(hdl, jsonresult.dump(), websocketpp::frame::opcode::text, + ec); + } + } + + } catch (std::exception const& e) { + std::cerr << "Error: " << e.what() << std::endl; + } + scoped_lock guard(thread_lock); + msg["access_num"]=(int)msg["access_num"]-1; +} + +void WebSocketServer::on_open(websocketpp::connection_hdl hdl) { + scoped_lock guard(m_lock); // for threads safty + std::shared_ptr data_msg = + std::make_shared(); // put a new data vector for new + // connection + data_msg->samples = std::make_shared>(); + data_msg->thread_lock = std::make_shared(); + data_msg->msg = nlohmann::json::parse("{}"); + data_msg->msg["wav_format"] = "pcm"; + data_msg->msg["wav_name"] = "wav-default-id"; + data_msg->msg["itn"] = true; + data_msg->msg["audio_fs"] = 16000; // default is 16k + data_msg->msg["access_num"] = 0; // the number of access for this object, when it is 0, we can free it saftly + data_msg->msg["is_eof"]=false; + FUNASR_DEC_HANDLE decoder_handle = + FunASRWfstDecoderInit(asr_handle, ASR_OFFLINE, global_beam_, lattice_beam_, am_scale_); + data_msg->decoder_handle = decoder_handle; + data_map.emplace(hdl, data_msg); + LOG(INFO) << "on_open, active connections: " << data_map.size(); +} + +void WebSocketServer::on_close(websocketpp::connection_hdl hdl) { + scoped_lock guard(m_lock); + + std::shared_ptr data_msg = nullptr; + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + data_msg = it_data->second; + } else { + return; + } + unique_lock guard_decoder(*(data_msg->thread_lock)); + data_msg->msg["is_eof"]=true; + guard_decoder.unlock(); + + LOG(INFO) << "on_close, active connections: " << data_map.size(); +} + +void remove_hdl( + websocketpp::connection_hdl hdl, + std::map, + std::owner_less>& data_map) { + std::shared_ptr data_msg = nullptr; + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + data_msg = it_data->second; + } else { + return; + } + unique_lock guard_decoder(*(data_msg->thread_lock)); + if (data_msg->msg["access_num"]==0 && data_msg->msg["is_eof"]==true) { + FunWfstDecoderUnloadHwsRes(data_msg->decoder_handle); + FunASRWfstDecoderUninit(data_msg->decoder_handle); + data_msg->decoder_handle = nullptr; + data_map.erase(hdl); + LOG(INFO) << "remove one connection"; + } + guard_decoder.unlock(); +} + +void WebSocketServer::check_and_clean_connection() { + while(true){ + std::this_thread::sleep_for(std::chrono::milliseconds(5000)); + std::vector to_remove; // remove list + auto iter = data_map.begin(); + while (iter != data_map.end()) { // loop to find closed connection + websocketpp::connection_hdl hdl = iter->first; + try{ + if (is_ssl) { + wss_server::connection_ptr con = wss_server_->get_con_from_hdl(hdl); + if (con->get_state() != 1) { // session::state::open ==1 + to_remove.push_back(hdl); + } + } else { + server::connection_ptr con = server_->get_con_from_hdl(hdl); + if (con->get_state() != 1) { // session::state::open ==1 + to_remove.push_back(hdl); + } + } + } + catch (std::exception const &e) + { + // if connection is close, we set is_eof = true + std::shared_ptr data_msg = nullptr; + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + data_msg = it_data->second; + } else { + continue; + } + unique_lock guard_decoder(*(data_msg->thread_lock)); + data_msg->msg["is_eof"]=true; + guard_decoder.unlock(); + to_remove.push_back(hdl); + LOG(INFO)<<"connection is closed."; + + } + iter++; + } + for (auto hdl : to_remove) { + { + unique_lock lock(m_lock); + remove_hdl(hdl, data_map); + } + } + } +} + +void WebSocketServer::on_message(websocketpp::connection_hdl hdl, + message_ptr msg) { + unique_lock lock(m_lock); + // find the sample data vector according to one connection + + std::shared_ptr msg_data = nullptr; + + auto it_data = data_map.find(hdl); + if (it_data != data_map.end()) { + msg_data = it_data->second; + if(msg_data->msg["is_eof"]){ + lock.unlock(); + return; + } + } else{ + lock.unlock(); + return; + } + + std::shared_ptr> sample_data_p = msg_data->samples; + std::shared_ptr thread_lock_p = msg_data->thread_lock; + + lock.unlock(); + if (sample_data_p == nullptr) { + LOG(INFO) << "error when fetch sample data vector"; + return; + } + + const std::string& payload = msg->get_payload(); // get msg type + unique_lock guard_decoder(*(thread_lock_p)); // mutex for one connection + switch (msg->get_opcode()) { + case websocketpp::frame::opcode::text: { + nlohmann::json jsonresult; + try{ + jsonresult = nlohmann::json::parse(payload); + }catch (std::exception const &e) + { + LOG(ERROR)<msg["is_eof"]=true; + guard_decoder.unlock(); + return; + } + + if (jsonresult["wav_name"] != nullptr) { + msg_data->msg["wav_name"] = jsonresult["wav_name"]; + } + if (jsonresult["wav_format"] != nullptr) { + msg_data->msg["wav_format"] = jsonresult["wav_format"]; + } + + // hotwords: fst/nn + if(msg_data->hotwords_embedding == nullptr){ + std::unordered_map merged_hws_map; + std::string nn_hotwords = ""; + + if (jsonresult["hotwords"] != nullptr) { + std::string json_string = jsonresult["hotwords"]; + if (!json_string.empty()){ + nlohmann::json json_fst_hws; + try{ + json_fst_hws = nlohmann::json::parse(json_string); + if(json_fst_hws.type() == nlohmann::json::value_t::object){ + // fst + try{ + std::unordered_map client_hws_map = json_fst_hws; + merged_hws_map.insert(client_hws_map.begin(), client_hws_map.end()); + } catch (const std::exception& e) { + LOG(INFO) << e.what(); + } + } + } catch (std::exception const &e) + { + LOG(ERROR)<decoder_handle, fst_inc_wts_, merged_hws_map); + + // nn + std::vector> new_hotwords_embedding= CompileHotwordEmbedding(asr_handle, nn_hotwords); + msg_data->hotwords_embedding = + std::make_shared>>(new_hotwords_embedding); + } + if (jsonresult.contains("audio_fs")) { + msg_data->msg["audio_fs"] = jsonresult["audio_fs"]; + } + if (jsonresult.contains("itn")) { + msg_data->msg["itn"] = jsonresult["itn"]; + } + if ((jsonresult["is_speaking"] == false || + jsonresult["is_finished"] == true) && + msg_data->msg["is_eof"] != true && + msg_data->hotwords_embedding != nullptr) { + LOG(INFO) << "client done"; + // for offline, send all receive data to decoder engine + std::vector> hotwords_embedding_(*(msg_data->hotwords_embedding)); + asio::post(io_decoder_, + std::bind(&WebSocketServer::do_decoder, this, + std::move(*(sample_data_p.get())), + std::move(hdl), + std::ref(msg_data->msg), + std::ref(*thread_lock_p), + std::move(hotwords_embedding_), + msg_data->msg["wav_name"], + msg_data->msg["itn"], + msg_data->msg["audio_fs"], + msg_data->msg["wav_format"], + std::ref(msg_data->decoder_handle))); + msg_data->msg["access_num"]=(int)(msg_data->msg["access_num"])+1; + } + break; + } + case websocketpp::frame::opcode::binary: { + // recived binary data + const auto* pcm_data = static_cast(payload.data()); + int32_t num_samples = payload.size(); + + if (isonline) { + // TODO + } else { + // for offline, we add receive data to end of the sample data vector + sample_data_p->insert(sample_data_p->end(), pcm_data, + pcm_data + num_samples); + } + break; + } + default: + break; + } + guard_decoder.unlock(); +} + +// init asr model +void WebSocketServer::initAsr(std::map& model_path, + int thread_num) { + try { + // init model with api + + asr_handle = FunOfflineInit(model_path, thread_num); + LOG(INFO) << "model successfully inited"; + + LOG(INFO) << "initAsr run check_and_clean_connection"; + std::thread clean_thread(&WebSocketServer::check_and_clean_connection,this); + clean_thread.detach(); + LOG(INFO) << "initAsr run check_and_clean_connection finished"; + + } catch (const std::exception& e) { + LOG(INFO) << e.what(); + } +} diff --git a/runtime/websocket/bin/websocket-server.h b/runtime/websocket/bin/websocket-server.h new file mode 100644 index 0000000..d18bcab --- /dev/null +++ b/runtime/websocket/bin/websocket-server.h @@ -0,0 +1,154 @@ +/** + * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights + * Reserved. MIT License (https://opensource.org/licenses/MIT) + */ +/* 2022-2023 by zhaomingwork */ + +// websocket server for asr engine +// take some ideas from https://github.com/k2-fsa/sherpa-onnx +// online-websocket-server-impl.cc, thanks. The websocket server has two threads +// pools, one for handle network data and one for asr decoder. +// now only support offline engine. + +#ifndef WEBSOCKET_SERVER_H_ +#define WEBSOCKET_SERVER_H_ + +#include +#include +#include +#include +#include +#include +#include +#define ASIO_STANDALONE 1 // not boost +#include +#include "util/text-utils.h" + +#include +#include +#include +#include +#include + +#include "asio.hpp" +#include "com-define.h" +#include "funasrruntime.h" +#include "nlohmann/json.hpp" +#include "tclap/CmdLine.h" +typedef websocketpp::server server; +typedef websocketpp::server wss_server; +typedef server::message_ptr message_ptr; +using websocketpp::lib::bind; +using websocketpp::lib::placeholders::_1; +using websocketpp::lib::placeholders::_2; + +typedef websocketpp::lib::lock_guard scoped_lock; +typedef websocketpp::lib::unique_lock unique_lock; +typedef websocketpp::lib::shared_ptr + context_ptr; + +typedef struct { + std::string msg=""; + std::string stamp=""; + std::string stamp_sents; + std::string tpass_msg=""; + float snippet_time=0; +} FUNASR_RECOG_RESULT; + +typedef struct { + nlohmann::json msg; + std::shared_ptr> samples; + std::shared_ptr>> hotwords_embedding=nullptr; + std::shared_ptr thread_lock; // lock for each connection + FUNASR_DEC_HANDLE decoder_handle=nullptr; +} FUNASR_MESSAGE; + +// See https://wiki.mozilla.org/Security/Server_Side_TLS for more details about +// the TLS modes. The code below demonstrates how to implement both the modern +enum tls_mode { MOZILLA_INTERMEDIATE = 1, MOZILLA_MODERN = 2 }; +class WebSocketServer { + public: + WebSocketServer(asio::io_context& io_decoder, bool is_ssl, server* server, + wss_server* wss_server, std::string& s_certfile, + std::string& s_keyfile) + : io_decoder_(io_decoder), + is_ssl(is_ssl), + server_(server), + wss_server_(wss_server){ + if (is_ssl) { + std::cout << "certfile path is " << s_certfile << std::endl; + wss_server->set_tls_init_handler( + bind(&WebSocketServer::on_tls_init, this, + MOZILLA_INTERMEDIATE, ::_1, s_certfile, s_keyfile)); + wss_server_->set_message_handler( + [this](websocketpp::connection_hdl hdl, message_ptr msg) { + on_message(hdl, msg); + }); + // set open handle + wss_server_->set_open_handler( + [this](websocketpp::connection_hdl hdl) { on_open(hdl); }); + // set close handle + wss_server_->set_close_handler( + [this](websocketpp::connection_hdl hdl) { on_close(hdl); }); + // begin accept + wss_server_->start_accept(); + // not print log + wss_server_->clear_access_channels(websocketpp::log::alevel::all); + + } else { + // set message handle + server_->set_message_handler( + [this](websocketpp::connection_hdl hdl, message_ptr msg) { + on_message(hdl, msg); + }); + // set open handle + server_->set_open_handler( + [this](websocketpp::connection_hdl hdl) { on_open(hdl); }); + // set close handle + server_->set_close_handler( + [this](websocketpp::connection_hdl hdl) { on_close(hdl); }); + // begin accept + server_->start_accept(); + // not print log + server_->clear_access_channels(websocketpp::log::alevel::all); + } + } + void do_decoder(const std::vector& buffer, + websocketpp::connection_hdl& hdl, + nlohmann::json& msg, + websocketpp::lib::mutex& thread_lock, + std::vector> &hotwords_embedding, + std::string wav_name, + bool itn, + int audio_fs, + std::string wav_format, + FUNASR_DEC_HANDLE& decoder_handle); + + void initAsr(std::map& model_path, int thread_num); + void on_message(websocketpp::connection_hdl hdl, message_ptr msg); + void on_open(websocketpp::connection_hdl hdl); + void on_close(websocketpp::connection_hdl hdl); + context_ptr on_tls_init(tls_mode mode, websocketpp::connection_hdl hdl, + std::string& s_certfile, std::string& s_keyfile); + + private: + void check_and_clean_connection(); + asio::io_context& io_decoder_; // threads for asr decoder + // std::ofstream fout; + FUNASR_HANDLE asr_handle; // asr engine handle + bool isonline = false; // online or offline engine, now only support offline + bool is_ssl = true; + server* server_; // websocket server + wss_server* wss_server_; // websocket server + + // use map to keep the received samples data from one connection in offline + // engine. if for online engline, a data struct is needed(TODO) + + std::map, + std::owner_less> + data_map; + websocketpp::lib::mutex m_lock; // mutex for sample_map +}; + +// std::unordered_map& hws_map, int fst_inc_wts, std::string& nn_hotwords +#endif // WEBSOCKET_SERVER_H_ diff --git a/runtime/websocket/hotwords.txt b/runtime/websocket/hotwords.txt new file mode 100644 index 0000000..f092a4a --- /dev/null +++ b/runtime/websocket/hotwords.txt @@ -0,0 +1,2 @@ +阿里巴巴 20 +通义实验室 30 diff --git a/runtime/websocket/readme.md b/runtime/websocket/readme.md new file mode 100644 index 0000000..7d7cbe2 --- /dev/null +++ b/runtime/websocket/readme.md @@ -0,0 +1,64 @@ +# Advanced Development Guide (File transcription service) ([click](../docs/SDK_advanced_guide_offline.md)) +# Real-time Speech Transcription Service Development Guide ([click](../docs/SDK_advanced_guide_online.md)) + + +# If you want to compile the file yourself, you can follow the steps below. +## Building for Linux/Unix +### Download onnxruntime +```shell +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-linux-x64-1.14.0.tgz +tar -zxvf onnxruntime-linux-x64-1.14.0.tgz +``` + +### Download ffmpeg +```shell +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-linux64-gpl-shared.tar.xz +tar -xvf ffmpeg-master-latest-linux64-gpl-shared.tar.xz +``` + +### Install deps +```shell +# openblas +sudo apt-get install libopenblas-dev #ubuntu +# sudo yum -y install openblas-devel #centos + +# openssl +apt-get install libssl-dev #ubuntu +# yum install openssl-devel #centos +``` + +### Build runtime +```shell +git clone https://github.com/alibaba-damo-academy/FunASR.git && cd FunASR/runtime/websocket +mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=release .. -DONNXRUNTIME_DIR=/path/to/onnxruntime-linux-x64-1.14.0 -DFFMPEG_DIR=/path/to/ffmpeg-master-latest-linux64-gpl-shared +make -j 4 +``` + + +## Building for Windows +### Download onnxruntime +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-win-x64-1.16.1.zip + +Download to d:\onnxruntime-win-x64-1.16.1 + +### Download ffmpeg +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-win64-gpl-shared.zip + +Download to d:\ffmpeg-master-latest-win64-gpl-shared + +### Download openssl +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/openssl-1.1.1w.zip + +Download to d:\openssl-1.1.1w + +### Build runtime +``` +git clone https://github.com/alibaba-damo-academy/FunASR.git +cd FunASR/runtime/websocket +mkdir build +cd build +cmake ../ -D OPENSSL_ROOT_DIR=d:/openssl-1.1.1w -D FFMPEG_DIR=d:/ffmpeg-master-latest-win64-gpl-shared -D ONNXRUNTIME_DIR=d:/onnxruntime-win-x64-1.16.1 +``` +Open FunASR/runtime/websocket/build/FunASRWebscoket.sln in Visual Studio and complete the compilation. + diff --git a/runtime/websocket/readme_zh.md b/runtime/websocket/readme_zh.md new file mode 100644 index 0000000..ebc4be0 --- /dev/null +++ b/runtime/websocket/readme_zh.md @@ -0,0 +1,67 @@ +# FunASR离线文件转写服务开发指南([点击此处](../docs/SDK_advanced_guide_offline_zh.md)) + +# FunASR实时语音听写服务开发指南([点击此处](../docs/SDK_advanced_guide_online_zh.md)) + +# 如果您想自己编译文件,可以参考下述步骤 +## Linux/Unix 平台编译 +### 下载 onnxruntime +```shell +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-linux-x64-1.14.0.tgz +tar -zxvf onnxruntime-linux-x64-1.14.0.tgz +``` + +### 下载 ffmpeg +```shell +wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-linux64-gpl-shared.tar.xz +tar -xvf ffmpeg-master-latest-linux64-gpl-shared.tar.xz +``` + +### 安装依赖 +```shell +# openblas +sudo apt-get install libopenblas-dev #ubuntu +# sudo yum -y install openblas-devel #centos + +# openssl +apt-get install libssl-dev #ubuntu +# yum install openssl-devel #centos +``` + +### 编译 runtime + +```shell +git clone https://github.com/alibaba-damo-academy/FunASR.git && cd FunASR/runtime/websocket +mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=release .. -DONNXRUNTIME_DIR=/path/to/onnxruntime-linux-x64-1.14.0 -DFFMPEG_DIR=/path/to/ffmpeg-master-latest-linux64-gpl-shared +make -j 4 +``` + + +## Windows 平台编译 +### 下载 onnxruntime +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-win-x64-1.16.1.zip + +下载并解压到 d:/onnxruntime-win-x64-1.16.1 + +### 下载 ffmpeg +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-win64-gpl-shared.zip + +下载并解压到 d:/ffmpeg-master-latest-win64-gpl-shared + +### 编译 openssl +https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/openssl-1.1.1w.zip + +下载解压到 d:/openssl-1.1.1w + +### 编译 runtime +``` +git clone https://github.com/alibaba-damo-academy/FunASR.git +cd FunASR/runtime/websocket +mkdir build +cd build +cmake ../ -D OPENSSL_ROOT_DIR=d:/openssl-1.1.1w -D FFMPEG_DIR=d:/ffmpeg-master-latest-win64-gpl-shared -D ONNXRUNTIME_DIR=d:/onnxruntime-win-x64-1.16.1 +``` +Visual Studio 打开 FunASR/runtime/websocket/build/FunASRWebscoket.sln 完成编译; +编译后的可执行文件位于:FunASR/runtime/websocket/build/bin/Debug; +从 onnxruntime-win-x64-1.16.1/lib, ffmpeg-master-latest-win64-gpl-shared/bin, openssl-1.1.1w/bin copy相关的DLL库至: FunASR/runtime/websocket/build/bin/Debug + diff --git a/runtime/websocket/requirements_install.md b/runtime/websocket/requirements_install.md new file mode 100644 index 0000000..aeb9e7f --- /dev/null +++ b/runtime/websocket/requirements_install.md @@ -0,0 +1,15 @@ +#### Download onnxruntime +```shell +bash third_party/download_onnxruntime.sh +``` + +#### Download ffmpeg +```shell +bash third_party/download_ffmpeg.sh +``` + +#### Install openblas and openssl +```shell +sudo apt-get install libopenblas-dev libssl-dev #ubuntu +# sudo yum -y install openblas-devel openssl-devel #centos +``` \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..dffe594 --- /dev/null +++ b/setup.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 + +"""FunASR setup script.""" + +import os + +from setuptools import find_packages +from setuptools import setup + + +requirements = { + "install": [ + "scipy>=1.4.1", + "librosa", + "jamo", # For kss + "PyYAML>=5.1.2", + "soundfile>=0.12.1", + "kaldiio>=2.17.0", + "torch_complex", + # "nltk>=3.4.5", + "sentencepiece", # train + "jieba", + "rotary_embedding_torch", + # "ffmpeg-python", + # "pypinyin>=0.44.0", + # "espnet_tts_frontend", + # ENH + "pytorch_wpe", + "editdistance>=0.5.2", + # "g2p", + # "nara_wpe", + # PAI + "oss2", + # "edit-distance", + # "textgrid", + # "protobuf", + "tqdm", + "umap_learn", + "jaconv", + "hydra-core>=1.3.2", + "tensorboardX", + "rotary_embedding_torch", + "openai-whisper", + ], + # train: The modules invoked when training only. + "train": [ + "editdistance", + ], + # all: The modules should be optionally installled due to some reason. + # Please consider moving them to "install" occasionally + "all": [ + # NOTE(kamo): Append modules requiring specific pytorch version or torch>1.3.0 + "torch_optimizer", + "fairscale", + "transformers", + "openai-whisper", + ], + "setup": [ + "numpy", + "pytest-runner", + ], + "test": [ + "pytest>=3.3.0", + "pytest-timeouts>=1.2.1", + "pytest-pythonpath>=0.7.3", + "pytest-cov>=2.7.1", + "hacking>=2.0.0", + "mock>=2.0.0", + "pycodestyle", + "jsondiff<2.0.0,>=1.2.0", + "flake8>=3.7.8", + "flake8-docstrings>=1.3.1", + "black", + ], + "doc": [ + "Jinja2", + "Sphinx", + "sphinx-rtd-theme>=0.2.4", + "sphinx-argparse>=0.2.5", + "commonmark", + "recommonmark>=0.4.0", + "nbsphinx>=0.4.2", + "sphinx-markdown-tables>=0.0.12", + "configargparse>=1.2.1", + ], + "llm": [ + "transformers>=4.32.0", + "accelerate", + "tiktoken", + "einops", + "transformers_stream_generator>=0.0.4", + "scipy", + "torchvision", + "pillow", + "matplotlib", + ], +} +requirements["all"].extend(requirements["train"]) +requirements["all"].extend(requirements["llm"]) +requirements["test"].extend(requirements["train"]) + +install_requires = requirements["install"] +setup_requires = requirements["setup"] +tests_require = requirements["test"] +extras_require = {k: v for k, v in requirements.items() if k not in ["install", "setup"]} + +dirname = os.path.dirname(__file__) +version_file = os.path.join(dirname, "funasr", "version.txt") +with open(version_file, "r") as f: + version = f.read().strip() +setup( + name="funasr", + version=version, + url="https://github.com/alibaba-damo-academy/FunASR.git", + author="Speech Lab of Alibaba Group", + author_email="funasr@list.alibaba-inc.com", + description="FunASR: A Fundamental End-to-End Speech Recognition Toolkit", + long_description=open(os.path.join(dirname, "README.md"), encoding="utf-8").read(), + long_description_content_type="text/markdown", + license="The MIT License", + packages=find_packages(include=["funasr*"]), + package_data={"funasr": ["version.txt"]}, + install_requires=install_requires, + setup_requires=setup_requires, + tests_require=tests_require, + extras_require=extras_require, + python_requires=">=3.7.0", + classifiers=[ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Operating System :: POSIX :: Linux", + "License :: OSI Approved :: Apache Software License", + "Topic :: Software Development :: Libraries :: Python Modules", + ], + entry_points={ + "console_scripts": [ + "funasr = funasr.bin.inference:main_hydra", + "funasr-train = funasr.bin.train:main_hydra", + "funasr-export = funasr.bin.export:main_hydra", + "scp2jsonl = funasr.datasets.audio_datasets.scp2jsonl:main_hydra", + "jsonl2scp = funasr.datasets.audio_datasets.jsonl2scp:main_hydra", + "funasr-scp2jsonl = funasr.datasets.audio_datasets.scp2jsonl:main_hydra", + "funasr-jsonl2scp = funasr.datasets.audio_datasets.jsonl2scp:main_hydra", + ] + }, +) diff --git a/tests/run_test.py b/tests/run_test.py new file mode 100644 index 0000000..9ff648b --- /dev/null +++ b/tests/run_test.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +import argparse +import os +import sys +import unittest +from fnmatch import fnmatch + + +def gather_test_cases(test_dir, pattern, list_tests): + case_list = [] + for dirpath, dirnames, filenames in os.walk(test_dir): + for file in filenames: + if fnmatch(file, pattern): + case_list.append(file) + + test_suite = unittest.TestSuite() + + for case in case_list: + test_case = unittest.defaultTestLoader.discover(start_dir=test_dir, pattern=case) + test_suite.addTest(test_case) + if hasattr(test_case, "__iter__"): + for subcase in test_case: + if list_tests: + print(subcase) + else: + if list_tests: + print(test_case) + return test_suite + + +def main(args): + runner = unittest.TextTestRunner() + test_suite = gather_test_cases(os.path.abspath(args.test_dir), args.pattern, args.list_tests) + if not args.list_tests: + result = runner.run(test_suite) + if len(result.failures) > 0: + sys.exit(len(result.failures)) + if len(result.errors) > 0: + sys.exit(len(result.errors)) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser("test runner") + parser.add_argument("--list_tests", action="store_true", help="list all tests") + parser.add_argument("--pattern", default="test_*.py", help="test file pattern") + parser.add_argument("--test_dir", default="tests", help="directory to be tested") + parser.add_argument("--disable_profile", action="store_true", help="disable profiling") + args = parser.parse_args() + print(f"working dir: {os.getcwd()}") + main(args) diff --git a/tests/test_asr_inference_pipeline.py b/tests/test_asr_inference_pipeline.py new file mode 100644 index 0000000..ba436bb --- /dev/null +++ b/tests/test_asr_inference_pipeline.py @@ -0,0 +1,610 @@ +import unittest + +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks +from modelscope.utils.logger import get_logger + +logger = get_logger() + + +class TestConformerInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_aishell1(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_conformer_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_aishell2(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_conformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + +class TestData2vecInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_transformer(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_data2vec_pretrain-zh-cn-aishell2-16k-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://modelscope.oss-cn-beijing.aliyuncs.com/test/audios/asr_example.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "每一天都要快乐喔" + + def test_paraformer(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_data2vec_pretrain-paraformer-zh-cn-aishell2-16k", + ) + rec_result = inference_pipeline( + audio_in="https://modelscope.oss-cn-beijing.aliyuncs.com/test/audios/asr_example.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "每一天都要快乐喔" + + +class TestMfccaInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_alimeeting(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="NPU-ASLP/speech_mfcca_asr-zh-cn-16k-alimeeting-vocab4950", + model_revision="v3.0.0", + ) + rec_result = inference_pipeline( + audio_in="https://pre.modelscope.cn/api/v1/models/NPU-ASLP/speech_mfcca_asr-zh-cn-16k-alimeeting-vocab4950/repo?Revision=master&FilePath=example/asr_example_mc.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + +class TestParaformerInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_paraformer_large_contextual_common(self): + param_dict = dict() + param_dict["hotword"] = ( + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/hotword.txt" + ) + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404", + param_dict=param_dict, + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_hotword.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "国务院发展研究中心市场经济研究所副所长邓郁松认为" + + def test_paraformer_large_aishell1(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-large_asr_nat-zh-cn-16k-aishell1-vocab8404-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "欢迎大家来体验达摩院推出的语音识别模型" + + def test_paraformer_large_aishell2(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-large_asr_nat-zh-cn-16k-aishell2-vocab8404-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "欢迎大家来体验达摩院推出的语音识别模型" + + def test_paraformer_large_common(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "欢迎大家来体验达摩院推出的语音识别模型" + + def test_paraformer_large_online_common(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online", + model_revision="v1.0.6", + update_model=False, + mode="paraformer_fake_streaming", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "欢迎大家来体验达摩院推出的语音识别模型" + + def test_paraformer_online_common(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online", + model_revision="v1.0.6", + update_model=False, + mode="paraformer_fake_streaming", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + assert rec_result["text"] == "欢迎大家来体验达摩院推出的语音识别模型" + + def test_paraformer_tiny_commandword(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-tiny-commandword_asr_nat-zh-cn-16k-vocab544-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh_command.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_paraformer_8k(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer_asr_nat-zh-cn-8k-common-vocab8358-tensorflow1", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_8K.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_paraformer_aishell1(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_paraformer_aishell2(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + +class TestParaformerBertInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_aishell1(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell1-vocab4234-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://modelscope.oss-cn-beijing.aliyuncs.com/test/audios/asr_example.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_aishell2(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformerbert_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://modelscope.oss-cn-beijing.aliyuncs.com/test/audios/asr_example.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + +class TestUniasrInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_uniasr_2pass_cantonese_chs_16k_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-cantonese-CHS-16k-common-vocab1468-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cantonese-CHS.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_cantonese_chs_16k_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-cantonese-CHS-16k-common-vocab1468-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_cantonese-CHS.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_cn_dialect_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-cn-dialect-16k-vocab8358-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_cn_dialect_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-cn-dialect-16k-vocab8358-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_de_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-de-16k-common-vocab3690-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_de.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_de_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-de-16k-common-vocab3690-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_de.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_en_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-en-16k-common-vocab1080-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_en_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-en-16k-common-vocab1080-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_es_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-es-16k-common-vocab3445-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_es.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_es_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-es-16k-common-vocab3445-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_es.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_fa_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-fa-16k-common-vocab1257-pytorch-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_fa.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_fa_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-fa-16k-common-vocab1257-pytorch-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_fa.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_fr_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-fr-16k-common-vocab3472-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_fr.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_fr_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-fr-16k-common-vocab3472-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_fr.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_id_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-id-16k-common-vocab1067-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_id.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_id_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-id-16k-common-vocab1067-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_id.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_ja_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-ja-16k-common-vocab93-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_ja.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_ja_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-ja-16k-common-vocab93-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_ja.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_ko_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-ko-16k-common-vocab6400-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_ko.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_ko_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-ko-16k-common-vocab6400-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_ko.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_minnan_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-minnan-16k-common-vocab3825", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_pt_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-pt-16k-common-vocab1617-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_pt.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_pt_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-pt-16k-common-vocab1617-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_pt.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_ru_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-ru-16k-common-vocab1664-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_ru.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_ru_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-ru-16k-common-vocab1664-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_ru.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_vi_common_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-vi-16k-common-vocab1001-pytorch-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_vi.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_vi_common_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-vi-16k-common-vocab1001-pytorch-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_vi.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_zhcn_8k_common_vocab3445_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-zh-cn-8k-common-vocab3445-pytorch-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_zhcn_8k_common_vocab3445_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-zh-cn-8k-common-vocab3445-pytorch-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_zhcn_8k_common_vocab8358_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-zh-cn-8k-common-vocab8358-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_zhcn_8k_common_vocab8358_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-zh-cn-8k-common-vocab8358-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_zhcn_16k_common_vocab8358_offline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-offline", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + param_dict={"decoding_model": "offline"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + def test_uniasr_2pass_zhcn_16k_common_vocab8358_online(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_UniASR_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-online", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", + param_dict={"decoding_model": "normal"}, + ) + logger.info("asr inference result: {0}".format(rec_result)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_asr_vad_punc_inference_pipeline.py b/tests/test_asr_vad_punc_inference_pipeline.py new file mode 100644 index 0000000..e876767 --- /dev/null +++ b/tests/test_asr_vad_punc_inference_pipeline.py @@ -0,0 +1,36 @@ +import unittest + +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks +from modelscope.utils.logger import get_logger + +logger = get_logger() + + +class TestParaformerInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_inference_pipeline(self): + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch", + model_revision="v1.2.1", + vad_model="damo/speech_fsmn_vad_zh-cn-16k-common-pytorch", + vad_model_revision="v1.1.8", + punc_model="damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", + punc_model_revision="v1.1.6", + ngpu=1, + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" + ) + logger.info("asr_vad_punc inference result: {0}".format(rec_result)) + assert rec_result["text"] == "欢迎大家来体验达摩院推出的语音识别模型。" + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_lm_pipeline.py b/tests/test_lm_pipeline.py new file mode 100644 index 0000000..f67c9a5 --- /dev/null +++ b/tests/test_lm_pipeline.py @@ -0,0 +1,27 @@ +import unittest + +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks +from modelscope.utils.logger import get_logger + +logger = get_logger() + + +class TestTransformerInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_inference_pipeline(self): + inference_pipeline = pipeline( + task=Tasks.language_score_prediction, + model="damo/speech_transformer_lm_zh-cn-common-vocab8404-pytorch", + ) + rec_result = inference_pipeline(text_in="hello 大 家 好 呀") + logger.info("lm inference result: {0}".format(rec_result)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_punctuation_pipeline.py b/tests/test_punctuation_pipeline.py new file mode 100644 index 0000000..8ae87d1 --- /dev/null +++ b/tests/test_punctuation_pipeline.py @@ -0,0 +1,43 @@ +import unittest + +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks +from modelscope.utils.logger import get_logger + +logger = get_logger() + + +class TestTransformerInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_inference_pipeline(self): + inference_pipeline = pipeline( + task=Tasks.punctuation, + model="damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", + model_revision="v1.1.7", + ) + inputs = "./egs_modelscope/punctuation/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/data/punc_example.txt" + rec_result = inference_pipeline(text_in=inputs) + logger.info("punctuation inference result: {0}".format(rec_result)) + + def test_vadrealtime_inference_pipeline(self): + inference_pipeline = pipeline( + task=Tasks.punctuation, + model="damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727", + ) + inputs = "跨境河流是养育沿岸|人民的生命之源长期以来为帮助下游地区防灾减灾中方技术人员|在上游地区极为恶劣的自然条件下克服巨大困难甚至冒着生命危险|向印方提供汛期水文资料处理紧急事件中方重视印方在跨境河流问题上的关切|愿意进一步完善双方联合工作机制|凡是|中方能做的我们|都会去做而且会做得更好我请印度朋友们放心中国在上游的|任何开发利用都会经过科学|规划和论证兼顾上下游的利益" + vads = inputs.split("|") + rec_result_all = "outputs:" + param_dict = {"cache": []} + for vad in vads: + rec_result = inference_pipeline(text_in=vad, param_dict=param_dict) + rec_result_all += rec_result["text"] + logger.info("punctuation inference result: {0}".format(rec_result_all)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_sv_inference_pipeline.py b/tests/test_sv_inference_pipeline.py new file mode 100644 index 0000000..76754ab --- /dev/null +++ b/tests/test_sv_inference_pipeline.py @@ -0,0 +1,48 @@ +import unittest + +import numpy as np +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks +from modelscope.utils.logger import get_logger + +logger = get_logger() + + +class TestXVectorInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_inference_pipeline(self): + inference_sv_pipline = pipeline( + task=Tasks.speaker_verification, + model="damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch", + ) + + # the same speaker + rec_result = inference_sv_pipline( + audio_in=( + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_enroll.wav", + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_same.wav", + ) + ) + assert ( + abs(rec_result["scores"][0] - 0.85) < 0.1 and abs(rec_result["scores"][1] - 0.14) < 0.1 + ) + logger.info(f"Similarity {rec_result['scores']}") + + # different speaker + rec_result = inference_sv_pipline( + audio_in=( + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_enroll.wav", + "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_different.wav", + ) + ) + assert abs(rec_result["scores"][0] - 0.0) < 0.1 and abs(rec_result["scores"][1] - 1.0) < 0.1 + logger.info(f"Similarity {rec_result['scores']}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_tp_pipeline.py b/tests/test_tp_pipeline.py new file mode 100644 index 0000000..c4853ab --- /dev/null +++ b/tests/test_tp_pipeline.py @@ -0,0 +1,58 @@ +import unittest + +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks +from modelscope.utils.logger import get_logger + +logger = get_logger() + + +class TestTimestampPredictionPipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_inference_pipeline(self): + inference_pipeline = pipeline( + task=Tasks.speech_timestamp, + model="damo/speech_timestamp_prediction-v1-16k-offline", + model_revision="v1.1.0", + ) + + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_timestamps.wav", + text_in="一 个 东 太 平 洋 国 家 为 什 么 跑 到 西 太 平 洋 来 了 呢", + ) + print(rec_result) + logger.info("punctuation inference result: {0}".format(rec_result)) + assert rec_result == { + "text": " 0.000 0.380;一 0.380 0.560;个 0.560 0.800;东 0.800 0.980;太 0.980 1.140;平 1.140 1.260;洋 1.260 1.440;国 1.440 1.680;家 1.680 1.920; 1.920 2.040;为 2.040 2.200;什 2.200 2.320;么 2.320 2.500;跑 2.500 2.680;到 2.680 2.860;西 2.860 3.040;太 3.040 3.200;平 3.200 3.380;洋 3.380 3.500;来 3.500 3.640;了 3.640 3.800;呢 3.800 4.150; 4.150 4.440;", + "timestamp": [ + [380, 560], + [560, 800], + [800, 980], + [980, 1140], + [1140, 1260], + [1260, 1440], + [1440, 1680], + [1680, 1920], + [2040, 2200], + [2200, 2320], + [2320, 2500], + [2500, 2680], + [2680, 2860], + [2860, 3040], + [3040, 3200], + [3200, 3380], + [3380, 3500], + [3500, 3640], + [3640, 3800], + [3800, 4150], + ], + } + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_vad_inference_pipeline.py b/tests/test_vad_inference_pipeline.py new file mode 100644 index 0000000..7fb0ce4 --- /dev/null +++ b/tests/test_vad_inference_pipeline.py @@ -0,0 +1,85 @@ +import unittest + +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks +from modelscope.utils.logger import get_logger + +logger = get_logger() + + +class TestFSMNInferencePipelines(unittest.TestCase): + def test_funasr_path(self): + import funasr + import os + + logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__)) + + def test_8k(self): + inference_pipeline = pipeline( + task=Tasks.voice_activity_detection, + model="damo/speech_fsmn_vad_zh-cn-8k-common", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example_8k.wav" + ) + logger.info("vad inference result: {0}".format(rec_result)) + assert rec_result["text"] == [ + [0, 1960], + [2870, 6730], + [7960, 10180], + [12140, 14830], + [15740, 19400], + [20220, 24230], + [25540, 27290], + [30070, 30970], + [32070, 34280], + [35990, 37050], + [39400, 41020], + [41810, 47320], + [48120, 52150], + [53560, 58310], + [59290, 62210], + [63110, 66420], + [67300, 68280], + [69670, 71770], + [73100, 75550], + [76850, 78500], + [79380, 83280], + [85000, 92320], + [93560, 94110], + [94990, 95620], + [96940, 97590], + [98400, 100530], + [101600, 104890], + [108780, 110900], + [112020, 113460], + [114210, 115030], + ] + + def test_16k(self): + inference_pipeline = pipeline( + task=Tasks.voice_activity_detection, + model="damo/speech_fsmn_vad_zh-cn-16k-common-pytorch", + ) + rec_result = inference_pipeline( + audio_in="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav" + ) + logger.info("vad inference result: {0}".format(rec_result)) + assert rec_result["text"] == [ + [70, 2340], + [2620, 6200], + [6480, 23670], + [23950, 26250], + [26780, 28990], + [29950, 31430], + [31750, 37600], + [38210, 46900], + [47310, 49630], + [49910, 56460], + [56740, 59540], + [59820, 70450], + ] + + +if __name__ == "__main__": + unittest.main() diff --git a/web-pages/.browserslistrc b/web-pages/.browserslistrc new file mode 100644 index 0000000..3daffd1 --- /dev/null +++ b/web-pages/.browserslistrc @@ -0,0 +1,3 @@ +> 1% +last 2 versions +not ie < 11 diff --git a/web-pages/.editorconfig b/web-pages/.editorconfig new file mode 100644 index 0000000..b7dade4 --- /dev/null +++ b/web-pages/.editorconfig @@ -0,0 +1,7 @@ +[*.{js,jsx,ts,tsx,vue}] +charset = utf-8 +indent_style = space +indent_size = 4 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/web-pages/.eslintignore b/web-pages/.eslintignore new file mode 100644 index 0000000..db60748 --- /dev/null +++ b/web-pages/.eslintignore @@ -0,0 +1,7 @@ +node_modules +dist +fonts +*.md +*.woff +*.ttf +public diff --git a/web-pages/.eslintrc.js b/web-pages/.eslintrc.js new file mode 100644 index 0000000..ff384b0 --- /dev/null +++ b/web-pages/.eslintrc.js @@ -0,0 +1,24 @@ +module.exports = { + root: true, + env: { + node: true + }, + extends: ['plugin:vue/essential', '@vue/standard'], + parserOptions: { + parser: '@babel/eslint-parser' + }, + rules: { + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'quote-props': 'off', + indent: 'off', + // "vue/script-indent": [ + // "error", + // 4, + // { + // baseIndent: 1, + // }, + // ], + 'vue/order-in-components': 'error' + } +} diff --git a/web-pages/babel.config.js b/web-pages/babel.config.js new file mode 100644 index 0000000..f39a0c0 --- /dev/null +++ b/web-pages/babel.config.js @@ -0,0 +1,13 @@ +module.exports = { + presets: ['@vue/cli-plugin-babel/preset'], + plugins: [ + [ + 'import', + { + libraryName: 'ant-design-vue', + libraryDirectory: 'es', + style: 'css' + } + ] + ] +} diff --git a/web-pages/jsconfig.json b/web-pages/jsconfig.json new file mode 100644 index 0000000..886c4c8 --- /dev/null +++ b/web-pages/jsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "esnext", + "baseUrl": "./", + "moduleResolution": "node", + "paths": { + "@/*": ["src/*"] + }, + "lib": ["esnext", "dom", "dom.iterable", "scripthost"] + } +} diff --git a/web-pages/mock/index.js b/web-pages/mock/index.js new file mode 100644 index 0000000..8aba516 --- /dev/null +++ b/web-pages/mock/index.js @@ -0,0 +1,11 @@ +import Mock from 'mockjs' + +import getUserInfo from './user/getUserInfo.js' +import getMenuList from './user/getMenuList.js' +Mock.setup({ + timeout: 500 +}) + +console.log('启动mock请求数据') +getUserInfo(Mock) +getMenuList(Mock) diff --git a/web-pages/mock/user/getMenuList.js b/web-pages/mock/user/getMenuList.js new file mode 100644 index 0000000..9f94d14 --- /dev/null +++ b/web-pages/mock/user/getMenuList.js @@ -0,0 +1 @@ +export default Mock => {} diff --git a/web-pages/mock/user/getUserInfo.js b/web-pages/mock/user/getUserInfo.js new file mode 100644 index 0000000..9f94d14 --- /dev/null +++ b/web-pages/mock/user/getUserInfo.js @@ -0,0 +1 @@ +export default Mock => {} diff --git a/web-pages/mock/util.js b/web-pages/mock/util.js new file mode 100644 index 0000000..d7ee5f2 --- /dev/null +++ b/web-pages/mock/util.js @@ -0,0 +1,3 @@ +export function randomNum (n, m) { + return Math.floor(Math.random() * (m - n + 1) + n) +} diff --git a/web-pages/package-lock.json b/web-pages/package-lock.json new file mode 100644 index 0000000..26fc79a --- /dev/null +++ b/web-pages/package-lock.json @@ -0,0 +1,9857 @@ +{ + "name": "template-vue", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@achrinza/node-ipc": { + "version": "9.2.5", + "resolved": "http://27.17.3.62:20000/@achrinza%2fnode-ipc/-/node-ipc-9.2.5.tgz", + "integrity": "sha512-kBX7Ay911iXZ3VZ1pYltj3Rfu7Ow9H7sK4H4RSfWIfWR2JKNB40K808wppoRIEzE2j2hXLU+r6TJgCAliCGhyQ==", + "dev": true, + "requires": { + "@node-ipc/js-queue": "2.0.3", + "event-pubsub": "4.3.0", + "js-message": "1.0.7" + } + }, + "@ampproject/remapping": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/@ampproject%2fremapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "dependencies": { + "@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "http://27.17.3.62:20000/@jridgewell%2fgen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } + } + }, + "@ant-design/colors": { + "version": "3.2.2", + "resolved": "http://27.17.3.62:20000/@ant-design%2fcolors/-/colors-3.2.2.tgz", + "integrity": "sha512-YKgNbG2dlzqMhA9NtI3/pbY16m3Yl/EeWBRa+lB1X1YaYxHrxNexiQYCLTWO/uDvAjLFMEDU+zR901waBtMtjQ==", + "requires": { + "tinycolor2": "^1.4.1" + } + }, + "@ant-design/icons": { + "version": "2.1.1", + "resolved": "http://27.17.3.62:20000/@ant-design%2ficons/-/icons-2.1.1.tgz", + "integrity": "sha512-jCH+k2Vjlno4YWl6g535nHR09PwCEmTBKAG6VqF+rhkrSPRLfgpU2maagwbZPLjaHuU5Jd1DFQ2KJpQuI6uG8w==" + }, + "@ant-design/icons-vue": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/@ant-design%2ficons-vue/-/icons-vue-2.0.0.tgz", + "integrity": "sha512-2c0QQE5hL4N48k5NkPG5sdpMl9YnvyNhf0U7YkdZYDlLnspoRU7vIA0UK9eHBs6OpFLcJB6o8eJrIl2ajBskPg==", + "requires": { + "@ant-design/colors": "^3.1.0", + "babel-runtime": "^6.26.0" + } + }, + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fcode-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/compat-data": { + "version": "7.18.5", + "resolved": "http://27.17.3.62:20000/@babel%2fcompat-data/-/compat-data-7.18.5.tgz", + "integrity": "sha512-BxhE40PVCBxVEJsSBhB6UWyAuqJRxGsAw8BdHMJ3AKGydcwuWW4kOO3HmqBQAdcq/OP+/DlTVxLvsCzRTnZuGg==", + "dev": true + }, + "@babel/core": { + "version": "7.17.10", + "resolved": "http://27.17.3.62:20000/@babel%2fcore/-/core-7.17.10.tgz", + "integrity": "sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-compilation-targets": "^7.17.10", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.9", + "@babel/parser": "^7.17.10", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.10", + "@babel/types": "^7.17.10", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.1", + "semver": "^6.3.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/eslint-parser": { + "version": "7.17.0", + "resolved": "http://27.17.3.62:20000/@babel%2feslint-parser/-/eslint-parser-7.17.0.tgz", + "integrity": "sha512-PUEJ7ZBXbRkbq3qqM/jZ2nIuakUBqCYc7Qf52Lj7dlZ6zERnqisdHioL0l4wwQZnmskMeasqUNzLBFKs3nylXA==", + "dev": true, + "requires": { + "eslint-scope": "^5.1.1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fgenerator/-/generator-7.18.2.tgz", + "integrity": "sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw==", + "dev": true, + "requires": { + "@babel/types": "^7.18.2", + "@jridgewell/gen-mapping": "^0.3.0", + "jsesc": "^2.5.1" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz", + "integrity": "sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.7.tgz", + "integrity": "sha512-C6FdbRaxYjwVu/geKW4ZeQ0Q31AftgRcdSnZ5/jsH6BzCJbtvXvhpfkbkThYSuutZA7nCXpPR6AD9zd1dprMkA==", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-compilation-targets/-/helper-compilation-targets-7.18.2.tgz", + "integrity": "sha512-s1jnPotJS9uQnzFtiZVBUxe67CuBa679oWFHpxYYnTpRL/1ffhyX44R9uYiXoa/pLXcY9H2moJta0iaanlk/rQ==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.17.10", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.20.2", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.0.tgz", + "integrity": "sha512-Kh8zTGR9de3J63e5nS0rQUdRs/kbtwoeQQ0sriS0lItjC96u8XXZN6lKpuyWd2coKSU13py/y+LTmThLuVX0Pg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.17.9", + "@babel/helper-member-expression-to-functions": "^7.17.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7" + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.17.12.tgz", + "integrity": "sha512-b2aZrV4zvutr9AIa6/gA3wsZKRwTKYoDxYiFKcESS3Ug2GTXzwBEvMuuFLhCQpEnRXs1zng4ISAXSUxxKBIcxw==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "regexpu-core": "^5.0.1" + } + }, + "@babel/helper-define-polyfill-provider": { + "version": "0.3.1", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.1.tgz", + "integrity": "sha512-J9hGMpJQmtWmj46B3kBHmL38UhJGhYX7eqkcq+2gsstyYt341HmPeWspihX43yVRA0mS+8GGk2Gckc7bY/HCmA==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/helper-environment-visitor": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-environment-visitor/-/helper-environment-visitor-7.18.2.tgz", + "integrity": "sha512-14GQKWkX9oJzPiQQ7/J36FTXcD4kSp8egKjO9nINlSKiHITRA9q/R74qu8S9xlc/b/yjsJItQUeeh3xnGN0voQ==", + "dev": true + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz", + "integrity": "sha512-KyUenhWMC8VrxzkGP0Jizjo4/Zx+1nNZhgocs+gLzyZyB8SHidhoq9KK/8Ato4anhwsivfkBLftky7gvzbZMtQ==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-function-name": { + "version": "7.17.9", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-function-name/-/helper-function-name-7.17.9.tgz", + "integrity": "sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==", + "dev": true, + "requires": { + "@babel/template": "^7.16.7", + "@babel/types": "^7.17.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.17.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-member-expression-to-functions/-/helper-member-expression-to-functions-7.17.7.tgz", + "integrity": "sha512-thxXgnQ8qQ11W2wVUObIqDL4p148VMxkt5T/qpN5k2fboRyzFGFmKsTGViquyM5QHKUy48OZoca8kw4ajaDPyw==", + "dev": true, + "requires": { + "@babel/types": "^7.17.0" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-transforms": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-module-transforms/-/helper-module-transforms-7.18.0.tgz", + "integrity": "sha512-kclUYSUBIjlvnzN2++K9f2qzYKFgjmnmjwL4zlmU5f8ZtzgWe8s0rUPSTGy2HmK4P8T52MQsS+HTQAgZd3dMEA==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.18.0", + "@babel/types": "^7.18.0" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz", + "integrity": "sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz", + "integrity": "sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA==", + "dev": true + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.16.8", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.8.tgz", + "integrity": "sha512-fm0gH7Flb8H51LqJHy3HJ3wnE1+qtYR2A99K06ahwrawLdOFsCEWjZOrYricXJHoPSudNKxrMBUPEIPxiIIvBw==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-wrap-function": "^7.16.8", + "@babel/types": "^7.16.8" + } + }, + "@babel/helper-replace-supers": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-replace-supers/-/helper-replace-supers-7.18.2.tgz", + "integrity": "sha512-XzAIyxx+vFnrOxiQrToSUOzUOn0e1J2Li40ntddek1Y69AXUTXoDJ40/D5RdjFu7s7qHiaeoTiempZcbuVXh2Q==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.18.2", + "@babel/helper-member-expression-to-functions": "^7.17.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/traverse": "^7.18.2", + "@babel/types": "^7.18.2" + } + }, + "@babel/helper-simple-access": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-simple-access/-/helper-simple-access-7.18.2.tgz", + "integrity": "sha512-7LIrjYzndorDY88MycupkpQLKS1AFfsVRm2k/9PtKScSy5tZq0McZTj+DiMRynboZfIqOKvo03pmhTaUgiD6fQ==", + "dev": true, + "requires": { + "@babel/types": "^7.18.2" + } + }, + "@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.16.0", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", + "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "dev": true + }, + "@babel/helper-wrap-function": { + "version": "7.16.8", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-wrap-function/-/helper-wrap-function-7.16.8.tgz", + "integrity": "sha512-8RpyRVIAW1RcDDGTA+GpPAwV22wXCfKOoM9bet6TLkGIFTkRQSkH1nMQ5Yet4MpoXe1ZwHPVtNasc2w0uZMqnw==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.8", + "@babel/types": "^7.16.8" + } + }, + "@babel/helpers": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fhelpers/-/helpers-7.18.2.tgz", + "integrity": "sha512-j+d+u5xT5utcQSzrh9p+PaJX94h++KN+ng9b9WEJq7pkUPAd61FGqhjuUEdfknb3E/uDBb7ruwEeKkIxNJPIrg==", + "dev": true, + "requires": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.18.2", + "@babel/types": "^7.18.2" + } + }, + "@babel/highlight": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fhighlight/-/highlight-7.17.12.tgz", + "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.18.5", + "resolved": "http://27.17.3.62:20000/@babel%2fparser/-/parser-7.18.5.tgz", + "integrity": "sha512-YZWVaglMiplo7v8f1oMQ5ZPQr0vn7HPeZXxXWsxXJRjGVrzUFn9OxFQl1sb5wzfootjA/yChhW84BV+383FSOw==", + "dev": true + }, + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.17.12.tgz", + "integrity": "sha512-xCJQXl4EeQ3J9C4yOmpTrtVGmzpm2iSzyxbkZHw7UCnZBftHpF/hpII80uWVyVrc40ytIClHjgWGTG1g/yB+aw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.17.12.tgz", + "integrity": "sha512-/vt0hpIw0x4b6BLKUkwlvEoiGZYYLNZ96CzyHYPbtG2jZGz6LBe7/V+drYrc/d+ovrF9NBi0pmtvmNb/FsWtRQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-proposal-optional-chaining": "^7.17.12" + } + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.17.12.tgz", + "integrity": "sha512-RWVvqD1ooLKP6IqWTA5GyFVX2isGEgC5iFxKzfYOIy/QEFdxYyCybBDtIGjipHpb9bDWHzcqGqFakf+mVmBTdQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-remap-async-to-generator": "^7.16.8", + "@babel/plugin-syntax-async-generators": "^7.8.4" + } + }, + "@babel/plugin-proposal-class-properties": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-class-properties/-/plugin-proposal-class-properties-7.17.12.tgz", + "integrity": "sha512-U0mI9q8pW5Q9EaTHFPwSVusPMV/DV9Mm8p7csqROFLtIE9rBF5piLqyrBGigftALrBcsBGu4m38JneAe7ZDLXw==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.17.12", + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-proposal-class-static-block": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.0.tgz", + "integrity": "sha512-t+8LsRMMDE74c6sV7KShIw13sqbqd58tlqNrsWoWBTIMw7SVQ0cZ905wLNS/FBCy/3PyooRHLFFlfrUNyyz5lA==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.18.0", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + } + }, + "@babel/plugin-proposal-decorators": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-decorators/-/plugin-proposal-decorators-7.18.2.tgz", + "integrity": "sha512-kbDISufFOxeczi0v4NQP3p5kIeW6izn/6klfWBrIIdGZZe4UpHR+QU03FAoWjGGd9SUXAwbw2pup1kaL4OQsJQ==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.18.0", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-replace-supers": "^7.18.2", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/plugin-syntax-decorators": "^7.17.12", + "charcodes": "^0.2.0" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz", + "integrity": "sha512-I8SW9Ho3/8DRSdmDdH3gORdyUuYnk1m4cMxUAdu5oy4n3OfN8flDEH+d60iG7dUfi0KkYwSvoalHzzdRzpWHTg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + } + }, + "@babel/plugin-proposal-export-namespace-from": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.17.12.tgz", + "integrity": "sha512-j7Ye5EWdwoXOpRmo5QmRyHPsDIe6+u70ZYZrd7uz+ebPYFKfRcLcNu3Ro0vOlJ5zuv8rU7xa+GttNiRzX56snQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-json-strings/-/plugin-proposal-json-strings-7.17.12.tgz", + "integrity": "sha512-rKJ+rKBoXwLnIn7n6o6fulViHMrOThz99ybH+hKHcOZbnN14VuMnH9fo2eHE69C8pO4uX1Q7t2HYYIDmv8VYkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/plugin-syntax-json-strings": "^7.8.3" + } + }, + "@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.17.12.tgz", + "integrity": "sha512-EqFo2s1Z5yy+JeJu7SFfbIUtToJTVlC61/C7WLKDntSw4Sz6JNAIfL7zQ74VvirxpjB5kz/kIx0gCcb+5OEo2Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.17.12.tgz", + "integrity": "sha512-ws/g3FSGVzv+VH86+QvgtuJL/kR67xaEIF2x0iPqdDfYW6ra6JF3lKVBkWynRLcNtIC1oCTfDRVxmm2mKzy+ag==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.7.tgz", + "integrity": "sha512-vQgPMknOIgiuVqbokToyXbkY/OmmjAzr/0lhSIbG/KmnzXPGwW/AdhdKpi+O4X/VkWiWjnkKOBiqJrTaC98VKw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.0.tgz", + "integrity": "sha512-nbTv371eTrFabDfHLElkn9oyf9VG+VKK6WMzhY2o4eHKaG19BToD9947zzGMO6I/Irstx9d8CwX6njPNIAR/yw==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.17.10", + "@babel/helper-compilation-targets": "^7.17.10", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.17.12" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.7.tgz", + "integrity": "sha512-eMOH/L4OvWSZAE1VkHbr1vckLG1WUcHGJSLqqQwl2GaUqG6QjddvrOaTUMNYiv77H5IKPMZ9U9P7EaHwvAShfA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.17.12.tgz", + "integrity": "sha512-7wigcOs/Z4YWlK7xxjkvaIw84vGhDv/P1dFGQap0nHkc8gFKY/r+hXc8Qzf5k1gY7CvGIcHqAnOagVKJJ1wVOQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + } + }, + "@babel/plugin-proposal-private-methods": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-private-methods/-/plugin-proposal-private-methods-7.17.12.tgz", + "integrity": "sha512-SllXoxo19HmxhDWm3luPz+cPhtoTSKLJE9PXshsfrOzBqs60QP0r8OaJItrPhAj0d7mZMnNF0Y1UUggCDgMz1A==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.17.12", + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-proposal-private-property-in-object": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.17.12.tgz", + "integrity": "sha512-/6BtVi57CJfrtDNKfK5b66ydK2J5pXUKBKSPD2G1whamMuEnZWgoOIfO8Vf9F/DoD4izBLD/Au4NMQfruzzykg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-create-class-features-plugin": "^7.17.12", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.17.12.tgz", + "integrity": "sha512-Wb9qLjXf3ZazqXA7IvI7ozqRIXIGPtSo+L5coFmEkhTQK18ao4UDDD0zdTGAarmbLj2urpRwrc6893cu5Bfh0A==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.17.12", + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-decorators": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-decorators/-/plugin-syntax-decorators-7.17.12.tgz", + "integrity": "sha512-D1Hz0qtGTza8K2xGyEdVNCYLdVHukAcbQr4K3/s6r/esadyEriZovpJimQOpu8ju4/jV8dW/1xdaE0UpDroidw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-import-assertions": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.17.12.tgz", + "integrity": "sha512-n/loy2zkq9ZEM8tEOwON9wTQSTNDTDEz6NujPtJGLU7qObzT1N4c4YZZf8E6ATB2AjNQg/Ib2AIpO03EZaCehw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-jsx/-/plugin-syntax-jsx-7.17.12.tgz", + "integrity": "sha512-spyY3E3AURfxh/RHtjx5j6hs8am5NbUBGfcZ2vB3uShSpZdQyXSf5rR5Mk76vbtlAZOelyVQ71Fg0x9SG4fsog==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.17.12.tgz", + "integrity": "sha512-PHln3CNi/49V+mza4xMwrg+WGYevSF1oaiXaC2EQfdp4HWlSjRsrDXWJiQBKpP7749u6vQ9mcry2uuFOv5CXvA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.17.12.tgz", + "integrity": "sha512-J8dbrWIOO3orDzir57NRsjg4uxucvhby0L/KZuGsWDj0g7twWK3g7JhJhOrXtuXiw8MeiSdJ3E0OW9H8LYEzLQ==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-remap-async-to-generator": "^7.16.8" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.7.tgz", + "integrity": "sha512-JUuzlzmF40Z9cXyytcbZEZKckgrQzChbQJw/5PuEHYeqzCsvebDx0K0jWnIIVcmmDOAVctCgnYs0pMcrYj2zJg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.18.4", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.4.tgz", + "integrity": "sha512-+Hq10ye+jlvLEogSOtq4mKvtk7qwcUQ1f0Mrueai866C82f844Yom2cttfJdMdqRLTxWpsbfbkIkOIfovyUQXw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.18.4", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-classes/-/plugin-transform-classes-7.18.4.tgz", + "integrity": "sha512-e42NSG2mlKWgxKUAD9EJJSkZxR67+wZqzNxLSpc51T8tRU5SLFHsPmgYR5yr7sdgX4u+iHA1C5VafJ6AyImV3A==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-environment-visitor": "^7.18.2", + "@babel/helper-function-name": "^7.17.9", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-replace-supers": "^7.18.2", + "@babel/helper-split-export-declaration": "^7.16.7", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-computed-properties/-/plugin-transform-computed-properties-7.17.12.tgz", + "integrity": "sha512-a7XINeplB5cQUWMg1E/GI1tFz3LfK021IjV1rj1ypE+R7jHm+pIHmHl25VNkZxtx9uuYp7ThGk8fur1HHG7PgQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-destructuring/-/plugin-transform-destructuring-7.18.0.tgz", + "integrity": "sha512-Mo69klS79z6KEfrLg/1WkmVnB8javh75HX4pi2btjvlIoasuxilEyjtsQW6XPrubNd7AQy0MMaNIaQE4e7+PQw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.7.tgz", + "integrity": "sha512-Lyttaao2SjZF6Pf4vk1dVKv8YypMpomAbygW+mU5cYP3S5cWTfCJjG8xV6CFdzGFlfWK81IjL9viiTvpb6G7gQ==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.17.12.tgz", + "integrity": "sha512-EA5eYFUG6xeerdabina/xIoB95jJ17mAkR8ivx6ZSu9frKShBjpOGZPn511MTDTkiCO+zXnzNczvUM69YSf3Zw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.7.tgz", + "integrity": "sha512-8UYLSlyLgRixQvlYH3J2ekXFHDFLQutdy7FfFAMm3CPZ6q9wHCwnUyiXpQCe3gVVnQlHc5nsuiEVziteRNTXEA==", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.18.1", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-for-of/-/plugin-transform-for-of-7.18.1.tgz", + "integrity": "sha512-+TTB5XwvJ5hZbO8xvl2H4XaMDOAK57zF4miuC9qQJgysPNEAZZ9Z69rdF5LJkozGdZrjBIUAIyKUWRMmebI7vg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-function-name/-/plugin-transform-function-name-7.16.7.tgz", + "integrity": "sha512-SU/C68YVwTRxqWj5kgsbKINakGag0KTgq9f2iZEXdStoAbOzLHEBRYzImmA6yFo8YZhJVflvXmIHUO7GWHmxxA==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-literals/-/plugin-transform-literals-7.17.12.tgz", + "integrity": "sha512-8iRkvaTjJciWycPIZ9k9duu663FT7VrBdNqNgxnVXEFwOIp55JWcZd23VBRySYbnS3PwQ3rGiabJBBBGj5APmQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.7.tgz", + "integrity": "sha512-mBruRMbktKQwbxaJof32LT9KLy2f3gH+27a5XSuXo6h7R3vqltl0PgZ80C8ZMKw98Bf8bqt6BEVi3svOh2PzMw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.0.tgz", + "integrity": "sha512-h8FjOlYmdZwl7Xm2Ug4iX2j7Qy63NANI+NQVWQzv6r25fqgg7k2dZl03p95kvqNclglHs4FZ+isv4p1uXMA+QA==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.18.0", + "@babel/helper-plugin-utils": "^7.17.12", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.2.tgz", + "integrity": "sha512-f5A865gFPAJAEE0K7F/+nm5CmAE3y8AWlMBG9unu5j9+tk50UQVK0QS8RNxSp7MJf0wh97uYyLWt3Zvu71zyOQ==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.18.0", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-simple-access": "^7.18.2", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.18.5", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.18.5.tgz", + "integrity": "sha512-SEewrhPpcqMF1V7DhnEbhVJLrC+nnYfe1E0piZMZXBpxi9WvZqWGwpsk7JYP7wPWeqaBh4gyKlBhHJu3uz5g4Q==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-module-transforms": "^7.18.0", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-validator-identifier": "^7.16.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-modules-umd/-/plugin-transform-modules-umd-7.18.0.tgz", + "integrity": "sha512-d/zZ8I3BWli1tmROLxXLc9A6YXvGK8egMxHp+E/rRwMh1Kip0AP77VwZae3snEJ33iiWwvNv2+UIIhfalqhzZA==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.18.0", + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.17.12.tgz", + "integrity": "sha512-vWoWFM5CKaTeHrdUJ/3SIOTRV+MBVGybOC9mhJkaprGNt5demMymDW24yC74avb915/mIRe3TgNb/d8idvnCRA==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.17.12", + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.18.5", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-new-target/-/plugin-transform-new-target-7.18.5.tgz", + "integrity": "sha512-TuRL5uGW4KXU6OsRj+mLp9BM7pO8e7SGNTEokQRRxHFkXYMFiy2jlKSZPFtI/mKORDzciH+hneskcSOp0gU8hg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-object-super/-/plugin-transform-object-super-7.16.7.tgz", + "integrity": "sha512-14J1feiQVWaGvRxj2WjyMuXS2jsBkgB3MdSN5HuC2G5nRspa5RK9COcs82Pwy5BuGcjb+fYaUj94mYcOj7rCvw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-parameters/-/plugin-transform-parameters-7.17.12.tgz", + "integrity": "sha512-6qW4rWo1cyCdq1FkYri7AHpauchbGLXpdwnYsfxFb+KtddHENfsY5JZb35xUwkK5opOLcJ3BNd2l7PhRYGlwIA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-property-literals/-/plugin-transform-property-literals-7.16.7.tgz", + "integrity": "sha512-z4FGr9NMGdoIl1RqavCqGG+ZuYjfZ/hkCIeuH6Do7tXmSm0ls11nYVSJqFEUOSJbDab5wC6lRE/w6YjVcr6Hqw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.18.0", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-regenerator/-/plugin-transform-regenerator-7.18.0.tgz", + "integrity": "sha512-C8YdRw9uzx25HSIzwA7EM7YP0FhCe5wNvJbZzjVNHHPGVcDJ3Aie+qGYYdS1oVQgn+B3eAIJbWFLrJ4Jipv7nw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "regenerator-transform": "^0.15.0" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-reserved-words/-/plugin-transform-reserved-words-7.17.12.tgz", + "integrity": "sha512-1KYqwbJV3Co03NIi14uEHW8P50Md6KqFgt0FfpHdK6oyAHQVTosgPuPSiWud1HX0oYJ1hGRRlk0fP87jFpqXZA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-runtime": { + "version": "7.18.5", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-runtime/-/plugin-transform-runtime-7.18.5.tgz", + "integrity": "sha512-Q17hHxXr2fplrE+5BSC1j1Fo5cOA8YeP8XW3/1paI8MzF/faZGh0MaH1KC4jLAvqLPamQWHB5/B7KqSLY1kuHA==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-plugin-utils": "^7.17.12", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.5.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz", + "integrity": "sha512-hah2+FEnoRoATdIb05IOXf+4GzXYTq75TVhIn1PewihbpyrNWUt2JbudKQOETWw6QpLe+AIUpJ5MVLYTQbeeUg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-spread/-/plugin-transform-spread-7.17.12.tgz", + "integrity": "sha512-9pgmuQAtFi3lpNUstvG9nGfk9DkrdmWNp9KeKPFmuZCpEnxRzYlS8JgwPjYj+1AWDOSvoGN0H30p1cBOmT/Svg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.7.tgz", + "integrity": "sha512-NJa0Bd/87QV5NZZzTuZG5BPJjLYadeSZ9fO6oOUoL4iQx+9EEuw/eEM92SrsT19Yc2jgB1u1hsjqDtH02c3Drw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-template-literals/-/plugin-transform-template-literals-7.18.2.tgz", + "integrity": "sha512-/cmuBVw9sZBGZVOMkpAEaVLwm4JmK2GZ1dFKOGGpMzEHWFmyZZ59lUU0PdRr8YNYeQdNzTDwuxP2X2gzydTc9g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.17.12", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.17.12.tgz", + "integrity": "sha512-Q8y+Jp7ZdtSPXCThB6zjQ74N3lj0f6TDh1Hnf5B+sYlzQ8i5Pjp8gW0My79iekSpT4WnI06blqP6DT0OmaXXmw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.17.12" + } + }, + "@babel/plugin-transform-unicode-escapes": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz", + "integrity": "sha512-TAV5IGahIz3yZ9/Hfv35TV2xEm+kaBDaZQCn2S/hG9/CZ0DktxJv9eKfPc7yYCvOYR4JGx1h8C+jcSOvgaaI/Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2fplugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.7.tgz", + "integrity": "sha512-oC5tYYKw56HO75KZVLQ+R/Nl3Hro9kf8iG0hXoaHP7tjAyCpvqBiSNe6vGrZni1Z6MggmUOC6A7VP7AVmw225Q==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/preset-env": { + "version": "7.18.2", + "resolved": "http://27.17.3.62:20000/@babel%2fpreset-env/-/preset-env-7.18.2.tgz", + "integrity": "sha512-PfpdxotV6afmXMU47S08F9ZKIm2bJIQ0YbAAtDfIENX7G1NUAXigLREh69CWDjtgUy7dYn7bsMzkgdtAlmS68Q==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.17.10", + "@babel/helper-compilation-targets": "^7.18.2", + "@babel/helper-plugin-utils": "^7.17.12", + "@babel/helper-validator-option": "^7.16.7", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.17.12", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.17.12", + "@babel/plugin-proposal-async-generator-functions": "^7.17.12", + "@babel/plugin-proposal-class-properties": "^7.17.12", + "@babel/plugin-proposal-class-static-block": "^7.18.0", + "@babel/plugin-proposal-dynamic-import": "^7.16.7", + "@babel/plugin-proposal-export-namespace-from": "^7.17.12", + "@babel/plugin-proposal-json-strings": "^7.17.12", + "@babel/plugin-proposal-logical-assignment-operators": "^7.17.12", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12", + "@babel/plugin-proposal-numeric-separator": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.18.0", + "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", + "@babel/plugin-proposal-optional-chaining": "^7.17.12", + "@babel/plugin-proposal-private-methods": "^7.17.12", + "@babel/plugin-proposal-private-property-in-object": "^7.17.12", + "@babel/plugin-proposal-unicode-property-regex": "^7.17.12", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-import-assertions": "^7.17.12", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.17.12", + "@babel/plugin-transform-async-to-generator": "^7.17.12", + "@babel/plugin-transform-block-scoped-functions": "^7.16.7", + "@babel/plugin-transform-block-scoping": "^7.17.12", + "@babel/plugin-transform-classes": "^7.17.12", + "@babel/plugin-transform-computed-properties": "^7.17.12", + "@babel/plugin-transform-destructuring": "^7.18.0", + "@babel/plugin-transform-dotall-regex": "^7.16.7", + "@babel/plugin-transform-duplicate-keys": "^7.17.12", + "@babel/plugin-transform-exponentiation-operator": "^7.16.7", + "@babel/plugin-transform-for-of": "^7.18.1", + "@babel/plugin-transform-function-name": "^7.16.7", + "@babel/plugin-transform-literals": "^7.17.12", + "@babel/plugin-transform-member-expression-literals": "^7.16.7", + "@babel/plugin-transform-modules-amd": "^7.18.0", + "@babel/plugin-transform-modules-commonjs": "^7.18.2", + "@babel/plugin-transform-modules-systemjs": "^7.18.0", + "@babel/plugin-transform-modules-umd": "^7.18.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.17.12", + "@babel/plugin-transform-new-target": "^7.17.12", + "@babel/plugin-transform-object-super": "^7.16.7", + "@babel/plugin-transform-parameters": "^7.17.12", + "@babel/plugin-transform-property-literals": "^7.16.7", + "@babel/plugin-transform-regenerator": "^7.18.0", + "@babel/plugin-transform-reserved-words": "^7.17.12", + "@babel/plugin-transform-shorthand-properties": "^7.16.7", + "@babel/plugin-transform-spread": "^7.17.12", + "@babel/plugin-transform-sticky-regex": "^7.16.7", + "@babel/plugin-transform-template-literals": "^7.18.2", + "@babel/plugin-transform-typeof-symbol": "^7.17.12", + "@babel/plugin-transform-unicode-escapes": "^7.16.7", + "@babel/plugin-transform-unicode-regex": "^7.16.7", + "@babel/preset-modules": "^0.1.5", + "@babel/types": "^7.18.2", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.5.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "core-js-compat": "^3.22.1", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/preset-modules": { + "version": "0.1.5", + "resolved": "http://27.17.3.62:20000/@babel%2fpreset-modules/-/preset-modules-0.1.5.tgz", + "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + } + }, + "@babel/runtime": { + "version": "7.18.3", + "resolved": "http://27.17.3.62:20000/@babel%2fruntime/-/runtime-7.18.3.tgz", + "integrity": "sha512-38Y8f7YUhce/K7RMwTp7m0uCumpv9hZkitCbBClqQIow1qSbCvGkcegKOXpEWCQLfWmevgRiWokZ1GkpfhbZug==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.16.7", + "resolved": "http://27.17.3.62:20000/@babel%2ftemplate/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/traverse": { + "version": "7.18.5", + "resolved": "http://27.17.3.62:20000/@babel%2ftraverse/-/traverse-7.18.5.tgz", + "integrity": "sha512-aKXj1KT66sBj0vVzk6rEeAO6Z9aiiQ68wfDgge3nHhA/my6xMM/7HGQUNumKZaoa2qUPQ5whJG9aAifsxUKfLA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.18.2", + "@babel/helper-environment-visitor": "^7.18.2", + "@babel/helper-function-name": "^7.17.9", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.18.5", + "@babel/types": "^7.18.4", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.18.4", + "resolved": "http://27.17.3.62:20000/@babel%2ftypes/-/types-7.18.4.tgz", + "integrity": "sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + } + }, + "@eslint/eslintrc": { + "version": "0.4.3", + "resolved": "http://27.17.3.62:20000/@eslint%2feslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "13.15.0", + "resolved": "http://27.17.3.62:20000/globals/-/globals-13.15.0.tgz", + "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "http://27.17.3.62:20000/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "http://27.17.3.62:20000/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, + "@hapi/hoek": { + "version": "9.3.0", + "resolved": "http://27.17.3.62:20000/@hapi%2fhoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "dev": true + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/@hapi%2ftopo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "http://27.17.3.62:20000/@humanwhocodes%2fconfig-array/-/config-array-0.5.0.tgz", + "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/@humanwhocodes%2fobject-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@jridgewell/gen-mapping": { + "version": "0.3.1", + "resolved": "http://27.17.3.62:20000/@jridgewell%2fgen-mapping/-/gen-mapping-0.3.1.tgz", + "integrity": "sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.0.7", + "resolved": "http://27.17.3.62:20000/@jridgewell%2fresolve-uri/-/resolve-uri-3.0.7.tgz", + "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/@jridgewell%2fset-array/-/set-array-1.1.1.tgz", + "integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==", + "dev": true + }, + "@jridgewell/source-map": { + "version": "0.3.2", + "resolved": "http://27.17.3.62:20000/@jridgewell%2fsource-map/-/source-map-0.3.2.tgz", + "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.13", + "resolved": "http://27.17.3.62:20000/@jridgewell%2fsourcemap-codec/-/sourcemap-codec-1.4.13.tgz", + "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.13", + "resolved": "http://27.17.3.62:20000/@jridgewell%2ftrace-mapping/-/trace-mapping-0.3.13.tgz", + "integrity": "sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@leichtgewicht/ip-codec": { + "version": "2.0.4", + "resolved": "http://27.17.3.62:20000/@leichtgewicht%2fip-codec/-/ip-codec-2.0.4.tgz", + "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", + "dev": true + }, + "@liveqing/liveplayer": { + "version": "2.7.10", + "resolved": "http://27.17.3.62:20000/@liveqing%2fliveplayer/-/liveplayer-2.7.10.tgz", + "integrity": "sha512-OrRzy2t0WZvO/h+hxMYL2+Ips7ON75l+PH8rjZDT7sps1zKW6dct6qPJm3EsVQuttUQ0dVGu3UXaSUm5gEM4dQ==" + }, + "@node-ipc/js-queue": { + "version": "2.0.3", + "resolved": "http://27.17.3.62:20000/@node-ipc%2fjs-queue/-/js-queue-2.0.3.tgz", + "integrity": "sha512-fL1wpr8hhD5gT2dA1qifeVaoDFlQR5es8tFuKqjHX+kdOtdNHnxkVZbtIrR2rxnMFvehkjaZRNV2H/gPXlb0hw==", + "dev": true, + "requires": { + "easy-stack": "1.0.1" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "http://27.17.3.62:20000/@nodelib%2ffs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "http://27.17.3.62:20000/@nodelib%2ffs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "http://27.17.3.62:20000/@nodelib%2ffs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@polka/url": { + "version": "1.0.0-next.21", + "resolved": "http://27.17.3.62:20000/@polka%2furl/-/url-1.0.0-next.21.tgz", + "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==", + "dev": true + }, + "@sideway/address": { + "version": "4.1.4", + "resolved": "http://27.17.3.62:20000/@sideway%2faddress/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/@sideway%2fformula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==", + "dev": true + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/@sideway%2fpinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, + "@simonwep/pickr": { + "version": "1.7.4", + "resolved": "http://27.17.3.62:20000/@simonwep%2fpickr/-/pickr-1.7.4.tgz", + "integrity": "sha512-fq7jgKJT21uWGC1mARBHvvd1JYlEf93o7SuVOB4Lr0x/2UPuNC9Oe9n/GzVeg4oVtqMDfh1wIEJpsdOJEZb+3g==", + "requires": { + "core-js": "^3.6.5", + "nanopop": "^2.1.0" + } + }, + "@soda/friendly-errors-webpack-plugin": { + "version": "1.8.1", + "resolved": "http://27.17.3.62:20000/@soda%2ffriendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.8.1.tgz", + "integrity": "sha512-h2ooWqP8XuFqTXT+NyAFbrArzfQA7R6HTezADrvD9Re8fxMLTPPniLdqVTdDaO0eIoLaAwKT+d6w+5GeTk7Vbg==", + "dev": true, + "requires": { + "chalk": "^3.0.0", + "error-stack-parser": "^2.0.6", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@soda/get-current-script": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/@soda%2fget-current-script/-/get-current-script-1.0.2.tgz", + "integrity": "sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==", + "dev": true + }, + "@trysound/sax": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/@trysound%2fsax/-/sax-0.2.0.tgz", + "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", + "dev": true + }, + "@types/body-parser": { + "version": "1.19.2", + "resolved": "http://27.17.3.62:20000/@types%2fbody-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/bonjour": { + "version": "3.5.10", + "resolved": "http://27.17.3.62:20000/@types%2fbonjour/-/bonjour-3.5.10.tgz", + "integrity": "sha512-p7ienRMiS41Nu2/igbJxxLDWrSZ0WxM8UQgCeO9KhoVF7cOVFkrKsiDr1EsJIla8vV3oEEjGcz11jc5yimhzZw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.35", + "resolved": "http://27.17.3.62:20000/@types%2fconnect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/connect-history-api-fallback": { + "version": "1.3.5", + "resolved": "http://27.17.3.62:20000/@types%2fconnect-history-api-fallback/-/connect-history-api-fallback-1.3.5.tgz", + "integrity": "sha512-h8QJa8xSb1WD4fpKBDcATDNGXghFj6/3GRWG6dhmRcu0RX1Ubasur2Uvx5aeEwlf0MwblEC2bMzzMQntxnw/Cw==", + "dev": true, + "requires": { + "@types/express-serve-static-core": "*", + "@types/node": "*" + } + }, + "@types/eslint": { + "version": "8.4.3", + "resolved": "http://27.17.3.62:20000/@types%2feslint/-/eslint-8.4.3.tgz", + "integrity": "sha512-YP1S7YJRMPs+7KZKDb9G63n8YejIwW9BALq7a5j2+H4yl6iOv9CB29edho+cuFRrvmJbbaH2yiVChKLJVysDGw==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/eslint-scope": { + "version": "3.7.3", + "resolved": "http://27.17.3.62:20000/@types%2feslint-scope/-/eslint-scope-3.7.3.tgz", + "integrity": "sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g==", + "dev": true, + "requires": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "@types/estree": { + "version": "0.0.51", + "resolved": "http://27.17.3.62:20000/@types%2festree/-/estree-0.0.51.tgz", + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", + "dev": true + }, + "@types/express": { + "version": "4.17.13", + "resolved": "http://27.17.3.62:20000/@types%2fexpress/-/express-4.17.13.tgz", + "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "dev": true, + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.29", + "resolved": "http://27.17.3.62:20000/@types%2fexpress-serve-static-core/-/express-serve-static-core-4.17.29.tgz", + "integrity": "sha512-uMd++6dMKS32EOuw1Uli3e3BPgdLIXmezcfHv7N4c1s3gkhikBplORPpMq3fuWkxncZN1reb16d5n8yhQ80x7Q==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "@types/html-minifier-terser": { + "version": "6.1.0", + "resolved": "http://27.17.3.62:20000/@types%2fhtml-minifier-terser/-/html-minifier-terser-6.1.0.tgz", + "integrity": "sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==", + "dev": true + }, + "@types/http-proxy": { + "version": "1.17.9", + "resolved": "http://27.17.3.62:20000/@types%2fhttp-proxy/-/http-proxy-1.17.9.tgz", + "integrity": "sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "http://27.17.3.62:20000/@types%2fjson-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "http://27.17.3.62:20000/@types%2fjson5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "@types/mime": { + "version": "1.3.2", + "resolved": "http://27.17.3.62:20000/@types%2fmime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", + "dev": true + }, + "@types/minimist": { + "version": "1.2.2", + "resolved": "http://27.17.3.62:20000/@types%2fminimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", + "dev": true + }, + "@types/node": { + "version": "18.0.0", + "resolved": "http://27.17.3.62:20000/@types%2fnode/-/node-18.0.0.tgz", + "integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA==", + "dev": true + }, + "@types/normalize-package-data": { + "version": "2.4.1", + "resolved": "http://27.17.3.62:20000/@types%2fnormalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/@types%2fparse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "@types/qs": { + "version": "6.9.7", + "resolved": "http://27.17.3.62:20000/@types%2fqs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "@types/range-parser": { + "version": "1.2.4", + "resolved": "http://27.17.3.62:20000/@types%2frange-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "@types/retry": { + "version": "0.12.0", + "resolved": "http://27.17.3.62:20000/@types%2fretry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", + "dev": true + }, + "@types/serve-index": { + "version": "1.9.1", + "resolved": "http://27.17.3.62:20000/@types%2fserve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha512-d/Hs3nWDxNL2xAczmOVZNj92YZCS6RGxfBPjKzuu/XirCgXdpKEb88dYNbrYGint6IVWLNP+yonwVAuRC0T2Dg==", + "dev": true, + "requires": { + "@types/express": "*" + } + }, + "@types/serve-static": { + "version": "1.13.10", + "resolved": "http://27.17.3.62:20000/@types%2fserve-static/-/serve-static-1.13.10.tgz", + "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", + "dev": true, + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/sockjs": { + "version": "0.3.33", + "resolved": "http://27.17.3.62:20000/@types%2fsockjs/-/sockjs-0.3.33.tgz", + "integrity": "sha512-f0KEEe05NvUnat+boPTZ0dgaLZ4SfSouXUgv5noUiefG2ajgKjmETo9ZJyuqsl7dfl2aHlLJUiki6B4ZYldiiw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/ws": { + "version": "8.5.3", + "resolved": "http://27.17.3.62:20000/@types%2fws/-/ws-8.5.3.tgz", + "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@vue/babel-helper-vue-jsx-merge-props": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.2.1.tgz", + "integrity": "sha512-QOi5OW45e2R20VygMSNhyQHvpdUwQZqGPc748JLGCYEy+yp8fNFNdbNIGAgZmi9e+2JHPd6i6idRuqivyicIkA==", + "dev": true + }, + "@vue/babel-helper-vue-transform-on": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.0.2.tgz", + "integrity": "sha512-hz4R8tS5jMn8lDq6iD+yWL6XNB699pGIVLk7WSJnn1dbpjaazsjZQkieJoRX6gW5zpYSCFqQ7jUquPNY65tQYA==", + "dev": true + }, + "@vue/babel-plugin-jsx": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-plugin-jsx/-/babel-plugin-jsx-1.1.1.tgz", + "integrity": "sha512-j2uVfZjnB5+zkcbc/zsOc0fSNGCMMjaEXP52wdwdIfn0qjFfEYpYZBFKFg+HHnQeJCVrjOeO0YxgaL7DMrym9w==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/plugin-syntax-jsx": "^7.0.0", + "@babel/template": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@babel/types": "^7.0.0", + "@vue/babel-helper-vue-transform-on": "^1.0.2", + "camelcase": "^6.0.0", + "html-tags": "^3.1.0", + "svg-tags": "^1.0.0" + } + }, + "@vue/babel-plugin-transform-vue-jsx": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-1.2.1.tgz", + "integrity": "sha512-HJuqwACYehQwh1fNT8f4kyzqlNMpBuUK4rSiSES5D4QsYncv5fxFsLyrxFPG2ksO7t5WP+Vgix6tt6yKClwPzA==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/plugin-syntax-jsx": "^7.2.0", + "@vue/babel-helper-vue-jsx-merge-props": "^1.2.1", + "html-tags": "^2.0.0", + "lodash.kebabcase": "^4.1.1", + "svg-tags": "^1.0.0" + }, + "dependencies": { + "html-tags": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/html-tags/-/html-tags-2.0.0.tgz", + "integrity": "sha1-ELMKOGCF9Dzt41PMj6fLDe7qZos=", + "dev": true + } + } + }, + "@vue/babel-preset-app": { + "version": "5.0.5", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-preset-app/-/babel-preset-app-5.0.5.tgz", + "integrity": "sha512-TmM4wWmNUYoW/YnCWwXxIbJCL/dXUMTfaduGTGLAyZDjV2VNI2ObWfMYM7oH31epXvxK2nKOskxWKnnNEiXDCA==", + "dev": true, + "requires": { + "@babel/core": "^7.12.16", + "@babel/helper-compilation-targets": "^7.12.16", + "@babel/helper-module-imports": "^7.12.13", + "@babel/plugin-proposal-class-properties": "^7.12.13", + "@babel/plugin-proposal-decorators": "^7.12.13", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.12.13", + "@babel/plugin-transform-runtime": "^7.12.15", + "@babel/preset-env": "^7.12.16", + "@babel/runtime": "^7.12.13", + "@vue/babel-plugin-jsx": "^1.0.3", + "@vue/babel-preset-jsx": "^1.1.2", + "babel-plugin-dynamic-import-node": "^2.3.3", + "core-js": "^3.8.3", + "core-js-compat": "^3.8.3", + "semver": "^7.3.4" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@vue/babel-preset-jsx": { + "version": "1.2.4", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-preset-jsx/-/babel-preset-jsx-1.2.4.tgz", + "integrity": "sha512-oRVnmN2a77bYDJzeGSt92AuHXbkIxbf/XXSE3klINnh9AXBmVS1DGa1f0d+dDYpLfsAKElMnqKTQfKn7obcL4w==", + "dev": true, + "requires": { + "@vue/babel-helper-vue-jsx-merge-props": "^1.2.1", + "@vue/babel-plugin-transform-vue-jsx": "^1.2.1", + "@vue/babel-sugar-composition-api-inject-h": "^1.2.1", + "@vue/babel-sugar-composition-api-render-instance": "^1.2.4", + "@vue/babel-sugar-functional-vue": "^1.2.2", + "@vue/babel-sugar-inject-h": "^1.2.2", + "@vue/babel-sugar-v-model": "^1.2.3", + "@vue/babel-sugar-v-on": "^1.2.3" + } + }, + "@vue/babel-sugar-composition-api-inject-h": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-sugar-composition-api-inject-h/-/babel-sugar-composition-api-inject-h-1.2.1.tgz", + "integrity": "sha512-4B3L5Z2G+7s+9Bwbf+zPIifkFNcKth7fQwekVbnOA3cr3Pq71q71goWr97sk4/yyzH8phfe5ODVzEjX7HU7ItQ==", + "dev": true, + "requires": { + "@babel/plugin-syntax-jsx": "^7.2.0" + } + }, + "@vue/babel-sugar-composition-api-render-instance": { + "version": "1.2.4", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-sugar-composition-api-render-instance/-/babel-sugar-composition-api-render-instance-1.2.4.tgz", + "integrity": "sha512-joha4PZznQMsxQYXtR3MnTgCASC9u3zt9KfBxIeuI5g2gscpTsSKRDzWQt4aqNIpx6cv8On7/m6zmmovlNsG7Q==", + "dev": true, + "requires": { + "@babel/plugin-syntax-jsx": "^7.2.0" + } + }, + "@vue/babel-sugar-functional-vue": { + "version": "1.2.2", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-sugar-functional-vue/-/babel-sugar-functional-vue-1.2.2.tgz", + "integrity": "sha512-JvbgGn1bjCLByIAU1VOoepHQ1vFsroSA/QkzdiSs657V79q6OwEWLCQtQnEXD/rLTA8rRit4rMOhFpbjRFm82w==", + "dev": true, + "requires": { + "@babel/plugin-syntax-jsx": "^7.2.0" + } + }, + "@vue/babel-sugar-inject-h": { + "version": "1.2.2", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-sugar-inject-h/-/babel-sugar-inject-h-1.2.2.tgz", + "integrity": "sha512-y8vTo00oRkzQTgufeotjCLPAvlhnpSkcHFEp60+LJUwygGcd5Chrpn5480AQp/thrxVm8m2ifAk0LyFel9oCnw==", + "dev": true, + "requires": { + "@babel/plugin-syntax-jsx": "^7.2.0" + } + }, + "@vue/babel-sugar-v-model": { + "version": "1.2.3", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-sugar-v-model/-/babel-sugar-v-model-1.2.3.tgz", + "integrity": "sha512-A2jxx87mySr/ulAsSSyYE8un6SIH0NWHiLaCWpodPCVOlQVODCaSpiR4+IMsmBr73haG+oeCuSvMOM+ttWUqRQ==", + "dev": true, + "requires": { + "@babel/plugin-syntax-jsx": "^7.2.0", + "@vue/babel-helper-vue-jsx-merge-props": "^1.2.1", + "@vue/babel-plugin-transform-vue-jsx": "^1.2.1", + "camelcase": "^5.0.0", + "html-tags": "^2.0.0", + "svg-tags": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "http://27.17.3.62:20000/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "html-tags": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/html-tags/-/html-tags-2.0.0.tgz", + "integrity": "sha1-ELMKOGCF9Dzt41PMj6fLDe7qZos=", + "dev": true + } + } + }, + "@vue/babel-sugar-v-on": { + "version": "1.2.3", + "resolved": "http://27.17.3.62:20000/@vue%2fbabel-sugar-v-on/-/babel-sugar-v-on-1.2.3.tgz", + "integrity": "sha512-kt12VJdz/37D3N3eglBywV8GStKNUhNrsxChXIV+o0MwVXORYuhDTHJRKPgLJRb/EY3vM2aRFQdxJBp9CLikjw==", + "dev": true, + "requires": { + "@babel/plugin-syntax-jsx": "^7.2.0", + "@vue/babel-plugin-transform-vue-jsx": "^1.2.1", + "camelcase": "^5.0.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "http://27.17.3.62:20000/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + } + } + }, + "@vue/cli-overlay": { + "version": "5.0.5", + "resolved": "http://27.17.3.62:20000/@vue%2fcli-overlay/-/cli-overlay-5.0.5.tgz", + "integrity": "sha512-+zS1MBuLyTvFhBnixby3wpG3f3W8hicVwGjOZIpTkzp8IGKiQjtMF4zIF+EqdZJMh/7V+2GQKLHFP77n/VYoRw==", + "dev": true + }, + "@vue/cli-plugin-babel": { + "version": "5.0.4", + "resolved": "http://27.17.3.62:20000/@vue%2fcli-plugin-babel/-/cli-plugin-babel-5.0.4.tgz", + "integrity": "sha512-413ZwOWLtgw5vWJoMbrv36crW3qTas4Iru8sU7cRb0IqEZbS28R9X4PVtO8Pek2NYFbrs2XKRYOB7GblB6hVqg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.16", + "@vue/babel-preset-app": "^5.0.4", + "@vue/cli-shared-utils": "^5.0.4", + "babel-loader": "^8.2.2", + "thread-loader": "^3.0.0", + "webpack": "^5.54.0" + } + }, + "@vue/cli-plugin-eslint": { + "version": "5.0.4", + "resolved": "http://27.17.3.62:20000/@vue%2fcli-plugin-eslint/-/cli-plugin-eslint-5.0.4.tgz", + "integrity": "sha512-NLBEKFTFJhYHMzQ3z+sb6xlkcNaN/RcbZ3hiCY72aJe4YOO8jEAp0XkPzlHd4xYkMW7jrmOwwLOPw+3BJ4b77Q==", + "dev": true, + "requires": { + "@vue/cli-shared-utils": "^5.0.4", + "eslint-webpack-plugin": "^3.1.0", + "globby": "^11.0.2", + "webpack": "^5.54.0", + "yorkie": "^2.0.0" + } + }, + "@vue/cli-plugin-router": { + "version": "5.0.4", + "resolved": "http://27.17.3.62:20000/@vue%2fcli-plugin-router/-/cli-plugin-router-5.0.4.tgz", + "integrity": "sha512-lylzCuH3Br0BcTz5IxxSffpyoF9dQ2k4jTdK8QlWrnRanWGw7P9C0kYMr9rohHaXpvAlu6bio392gbNIWpEepg==", + "dev": true, + "requires": { + "@vue/cli-shared-utils": "^5.0.4" + } + }, + "@vue/cli-plugin-vuex": { + "version": "5.0.4", + "resolved": "http://27.17.3.62:20000/@vue%2fcli-plugin-vuex/-/cli-plugin-vuex-5.0.4.tgz", + "integrity": "sha512-dBwiD6mT9+V2HTHcwaWE8qFNgTk5I/NUvxYVeUN3Mmmpo4y/1RxXnr7BlKGnaQsTypb2RFk3KowqIJtg7s+E3Q==", + "dev": true + }, + "@vue/cli-service": { + "version": "5.0.4", + "resolved": "http://27.17.3.62:20000/@vue%2fcli-service/-/cli-service-5.0.4.tgz", + "integrity": "sha512-xRiLNTFYmMCT9edZpyYXHijW5xot3gbZpcWDOXUOhKPHN4qs4XqWALnZlU97JYjZOr3XIr/ZvyciyEfrlUVqSA==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.12.16", + "@soda/friendly-errors-webpack-plugin": "^1.8.0", + "@soda/get-current-script": "^1.0.2", + "@types/minimist": "^1.2.0", + "@vue/cli-overlay": "^5.0.4", + "@vue/cli-plugin-router": "^5.0.4", + "@vue/cli-plugin-vuex": "^5.0.4", + "@vue/cli-shared-utils": "^5.0.4", + "@vue/component-compiler-utils": "^3.3.0", + "@vue/vue-loader-v15": "npm:vue-loader@^15.9.7", + "@vue/web-component-wrapper": "^1.3.0", + "acorn": "^8.0.5", + "acorn-walk": "^8.0.2", + "address": "^1.1.2", + "autoprefixer": "^10.2.4", + "browserslist": "^4.16.3", + "case-sensitive-paths-webpack-plugin": "^2.3.0", + "cli-highlight": "^2.1.10", + "clipboardy": "^2.3.0", + "cliui": "^7.0.4", + "copy-webpack-plugin": "^9.0.1", + "css-loader": "^6.5.0", + "css-minimizer-webpack-plugin": "^3.0.2", + "cssnano": "^5.0.0", + "debug": "^4.1.1", + "default-gateway": "^6.0.3", + "dotenv": "^10.0.0", + "dotenv-expand": "^5.1.0", + "fs-extra": "^9.1.0", + "globby": "^11.0.2", + "hash-sum": "^2.0.0", + "html-webpack-plugin": "^5.1.0", + "is-file-esm": "^1.0.0", + "launch-editor-middleware": "^2.2.1", + "lodash.defaultsdeep": "^4.6.1", + "lodash.mapvalues": "^4.6.0", + "mini-css-extract-plugin": "^2.5.3", + "minimist": "^1.2.5", + "module-alias": "^2.2.2", + "portfinder": "^1.0.26", + "postcss": "^8.2.6", + "postcss-loader": "^6.1.1", + "progress-webpack-plugin": "^1.0.12", + "ssri": "^8.0.1", + "terser-webpack-plugin": "^5.1.1", + "thread-loader": "^3.0.0", + "vue-loader": "^17.0.0", + "vue-style-loader": "^4.1.3", + "webpack": "^5.54.0", + "webpack-bundle-analyzer": "^4.4.0", + "webpack-chain": "^6.5.1", + "webpack-dev-server": "^4.7.3", + "webpack-merge": "^5.7.3", + "webpack-virtual-modules": "^0.4.2", + "whatwg-fetch": "^3.6.2" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@vue/cli-shared-utils": { + "version": "5.0.5", + "resolved": "http://27.17.3.62:20000/@vue%2fcli-shared-utils/-/cli-shared-utils-5.0.5.tgz", + "integrity": "sha512-L7cdGQUTYBeSOBA5c5ktXAdjH/3tfKaKkIJEGfu77JvWQ7ixGcHG2lJE6criCRLMfZLtaJmKQL1QIE6QA2sQQw==", + "dev": true, + "requires": { + "@achrinza/node-ipc": "^9.2.5", + "chalk": "^4.1.2", + "execa": "^1.0.0", + "joi": "^17.4.0", + "launch-editor": "^2.2.1", + "lru-cache": "^6.0.0", + "node-fetch": "^2.6.7", + "open": "^8.0.2", + "ora": "^5.3.0", + "read-pkg": "^5.1.1", + "semver": "^7.3.4", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "semver": { + "version": "7.3.7", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@vue/component-compiler-utils": { + "version": "3.3.0", + "resolved": "http://27.17.3.62:20000/@vue%2fcomponent-compiler-utils/-/component-compiler-utils-3.3.0.tgz", + "integrity": "sha512-97sfH2mYNU+2PzGrmK2haqffDpVASuib9/w2/noxiFi31Z54hW+q3izKQXXQZSNhtiUpAI36uSuYepeBe4wpHQ==", + "dev": true, + "requires": { + "consolidate": "^0.15.1", + "hash-sum": "^1.0.2", + "lru-cache": "^4.1.2", + "merge-source-map": "^1.1.0", + "postcss": "^7.0.36", + "postcss-selector-parser": "^6.0.2", + "prettier": "^1.18.2 || ^2.0.0", + "source-map": "~0.6.1", + "vue-template-es2015-compiler": "^1.9.0" + }, + "dependencies": { + "hash-sum": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/hash-sum/-/hash-sum-1.0.2.tgz", + "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", + "dev": true + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "http://27.17.3.62:20000/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "picocolors": { + "version": "0.2.1", + "resolved": "http://27.17.3.62:20000/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "dev": true + }, + "postcss": { + "version": "7.0.39", + "resolved": "http://27.17.3.62:20000/postcss/-/postcss-7.0.39.tgz", + "integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==", + "dev": true, + "requires": { + "picocolors": "^0.2.1", + "source-map": "^0.6.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + }, + "@vue/eslint-config-standard": { + "version": "6.1.0", + "resolved": "http://27.17.3.62:20000/@vue%2feslint-config-standard/-/eslint-config-standard-6.1.0.tgz", + "integrity": "sha512-9+hrEyflDzsGdlBDl9jPV5DIYUx1TOU5OSQqRDKCrNumrxRj5HRWKuk+ocXWnha6uoNRtLC24mY7d/MwqvBCNw==", + "dev": true, + "requires": { + "eslint-config-standard": "^16.0.3", + "eslint-import-resolver-node": "^0.3.4", + "eslint-import-resolver-webpack": "^0.13.1" + } + }, + "@vue/vue-loader-v15": { + "version": "npm:vue-loader@15.11.1", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.11.1.tgz", + "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==", + "dev": true, + "requires": { + "@vue/component-compiler-utils": "^3.1.0", + "hash-sum": "^1.0.2", + "loader-utils": "^1.1.0", + "vue-hot-reload-api": "^2.3.0", + "vue-style-loader": "^4.1.0" + }, + "dependencies": { + "hash-sum": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", + "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==", + "dev": true + }, + "json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", + "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "@vue/web-component-wrapper": { + "version": "1.3.0", + "resolved": "http://27.17.3.62:20000/@vue%2fweb-component-wrapper/-/web-component-wrapper-1.3.0.tgz", + "integrity": "sha512-Iu8Tbg3f+emIIMmI2ycSI8QcEuAUgPTgHwesDU1eKMLE4YC/c/sFbGc70QgMq31ijRftV0R7vCm9co6rldCeOA==", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "dev": true, + "requires": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2ffloating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fhelper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fhelper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", + "dev": true + }, + "@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fhelper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "dev": true, + "requires": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fhelper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fhelper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fleb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2futf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fwasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fwasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fwasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fwasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "http://27.17.3.62:20000/@webassemblyjs%2fwast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/@xtuc%2fieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "http://27.17.3.62:20000/@xtuc%2flong/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "accepts": { + "version": "1.3.8", + "resolved": "http://27.17.3.62:20000/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, + "acorn": { + "version": "8.7.1", + "resolved": "http://27.17.3.62:20000/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "dev": true + }, + "acorn-import-assertions": { + "version": "1.8.0", + "resolved": "http://27.17.3.62:20000/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "http://27.17.3.62:20000/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "http://27.17.3.62:20000/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "add-dom-event-listener": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/add-dom-event-listener/-/add-dom-event-listener-1.1.0.tgz", + "integrity": "sha512-WCxx1ixHT0GQU9hb0KI/mhgRQhnU+U3GvwY6ZvVjYq8rsihIGoaIOUbY0yMPBxLH5MDtr0kz3fisWGNcbWW7Jw==", + "requires": { + "object-assign": "4.x" + } + }, + "address": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/address/-/address-1.2.0.tgz", + "integrity": "sha512-tNEZYz5G/zYunxFm7sfhAxkXEuLj3K6BKwv6ZURlsF6yiUQ65z0Q2wZW9L5cPUl9ocofGvXOdFYbFHp0+6MOig==", + "dev": true + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ajv": { + "version": "6.12.6", + "resolved": "http://27.17.3.62:20000/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-formats": { + "version": "2.1.1", + "resolved": "http://27.17.3.62:20000/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "requires": { + "ajv": "^8.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "http://27.17.3.62:20000/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, + "ajv-keywords": { + "version": "3.5.2", + "resolved": "http://27.17.3.62:20000/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true + }, + "ansi-colors": { + "version": "4.1.3", + "resolved": "http://27.17.3.62:20000/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "http://27.17.3.62:20000/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "ansi-html-community": { + "version": "0.0.8", + "resolved": "http://27.17.3.62:20000/ansi-html-community/-/ansi-html-community-0.0.8.tgz", + "integrity": "sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "http://27.17.3.62:20000/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "ant-design-vue": { + "version": "1.7.5", + "resolved": "http://27.17.3.62:20000/ant-design-vue/-/ant-design-vue-1.7.5.tgz", + "integrity": "sha512-QVrirCz6eetzui+Dv/ujMqUwIr8e/2H+pKr4VC3mpc+cHkw6L9cBRJK7DhfO7GTyK4EWKkEH3lfLWlD/XjUoQQ==", + "requires": { + "@ant-design/icons": "^2.1.1", + "@ant-design/icons-vue": "^2.0.0", + "@simonwep/pickr": "~1.7.0", + "add-dom-event-listener": "^1.0.2", + "array-tree-filter": "^2.1.0", + "async-validator": "^3.0.3", + "babel-helper-vue-jsx-merge-props": "^2.0.3", + "babel-runtime": "6.x", + "classnames": "^2.2.5", + "component-classes": "^1.2.6", + "dom-align": "^1.10.4", + "dom-closest": "^0.2.0", + "dom-scroll-into-view": "^2.0.0", + "enquire.js": "^2.1.6", + "intersperse": "^1.0.0", + "is-mobile": "^2.2.1", + "is-negative-zero": "^2.0.0", + "ismobilejs": "^1.0.0", + "json2mq": "^0.2.0", + "lodash": "^4.17.5", + "moment": "^2.21.0", + "mutationobserver-shim": "^0.3.2", + "node-emoji": "^1.10.0", + "omit.js": "^1.0.0", + "raf": "^3.4.0", + "resize-observer-polyfill": "^1.5.1", + "shallow-equal": "^1.0.0", + "shallowequal": "^1.0.2", + "vue-ref": "^2.0.0", + "warning": "^4.0.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "http://27.17.3.62:20000/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=", + "dev": true + }, + "anymatch": { + "version": "3.1.2", + "resolved": "http://27.17.3.62:20000/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "arch": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/arch/-/arch-2.2.0.tgz", + "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "http://27.17.3.62:20000/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-find": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/array-find/-/array-find-1.0.0.tgz", + "integrity": "sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg=", + "dev": true + }, + "array-flatten": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/array-flatten/-/array-flatten-2.1.2.tgz", + "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", + "dev": true + }, + "array-includes": { + "version": "3.1.5", + "resolved": "http://27.17.3.62:20000/array-includes/-/array-includes-3.1.5.tgz", + "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + } + }, + "array-tree-filter": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/array-tree-filter/-/array-tree-filter-2.1.0.tgz", + "integrity": "sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw==" + }, + "array-union": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "array.prototype.flat": { + "version": "1.3.0", + "resolved": "http://27.17.3.62:20000/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", + "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.2", + "es-shim-unscopables": "^1.0.0" + } + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "async": { + "version": "2.6.4", + "resolved": "http://27.17.3.62:20000/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + }, + "async-validator": { + "version": "3.5.2", + "resolved": "http://27.17.3.62:20000/async-validator/-/async-validator-3.5.2.tgz", + "integrity": "sha512-8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3rQ==" + }, + "at-least-node": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, + "autoprefixer": { + "version": "10.4.7", + "resolved": "http://27.17.3.62:20000/autoprefixer/-/autoprefixer-10.4.7.tgz", + "integrity": "sha512-ypHju4Y2Oav95SipEcCcI5J7CGPuvz8oat7sUtYj3ClK44bldfvtvcxK6IEK++7rqB7YchDGzweZIBG+SD0ZAA==", + "dev": true, + "requires": { + "browserslist": "^4.20.3", + "caniuse-lite": "^1.0.30001335", + "fraction.js": "^4.2.0", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + } + }, + "axios": { + "version": "0.19.2", + "resolved": "http://27.17.3.62:20000/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + } + }, + "babel-helper-vue-jsx-merge-props": { + "version": "2.0.3", + "resolved": "http://27.17.3.62:20000/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz", + "integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==" + }, + "babel-loader": { + "version": "8.2.5", + "resolved": "http://27.17.3.62:20000/babel-loader/-/babel-loader-8.2.5.tgz", + "integrity": "sha512-OSiFfH89LrEMiWd4pLNqGz4CwJDtbs2ZVc+iGu2HrkRfPxId9F2anQj38IxWpmRfsUY0aBZYi1EFcd3mhtRMLQ==", + "dev": true, + "requires": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^2.0.0", + "make-dir": "^3.1.0", + "schema-utils": "^2.6.5" + } + }, + "babel-plugin-component": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/babel-plugin-component/-/babel-plugin-component-1.1.1.tgz", + "integrity": "sha512-WUw887kJf2GH80Ng/ZMctKZ511iamHNqPhd9uKo14yzisvV7Wt1EckIrb8oq/uCz3B3PpAW7Xfl7AkTLDYT6ag==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "7.0.0-beta.35" + }, + "dependencies": { + "@babel/helper-module-imports": { + "version": "7.0.0-beta.35", + "resolved": "http://27.17.3.62:20000/@babel%2fhelper-module-imports/-/helper-module-imports-7.0.0-beta.35.tgz", + "integrity": "sha512-vaC1KyIZSuyWb3Lj277fX0pxivyHwuDU4xZsofqgYAbkDxNieMg2vuhzP5AgMweMY7fCQUMTi+BgPqTLjkxXFg==", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.35", + "lodash": "^4.2.0" + } + }, + "@babel/types": { + "version": "7.0.0-beta.35", + "resolved": "http://27.17.3.62:20000/@babel%2ftypes/-/types-7.0.0-beta.35.tgz", + "integrity": "sha512-y9XT11CozHDgjWcTdxmhSj13rJVXpa5ZXwjjOiTedjaM0ba5ItqdS02t31EhPl7HtOWxsZkYCCUNrSfrOisA6w==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.2.0", + "to-fast-properties": "^2.0.0" + } + } + } + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "http://27.17.3.62:20000/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", + "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", + "dev": true, + "requires": { + "object.assign": "^4.1.0" + } + }, + "babel-plugin-import": { + "version": "1.12.2", + "resolved": "http://27.17.3.62:20000/babel-plugin-import/-/babel-plugin-import-1.12.2.tgz", + "integrity": "sha512-Vz9s+I6vAnsY8sYczU/cdtkKAHSorapa/2St6K+OzowplKizpWxul4HLi3kj1eRmHMFjhbROSMGXP+mFna2nUw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/runtime": "^7.0.0" + } + }, + "babel-plugin-polyfill-corejs2": { + "version": "0.3.1", + "resolved": "http://27.17.3.62:20000/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.1.tgz", + "integrity": "sha512-v7/T6EQcNfVLfcN2X8Lulb7DjprieyLWJK/zOWH5DUYcAgex9sP3h25Q+DLsX9TloXe3y1O8l2q2Jv9q8UVB9w==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.1", + "semver": "^6.1.1" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.5.2", + "resolved": "http://27.17.3.62:20000/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.2.tgz", + "integrity": "sha512-G3uJih0XWiID451fpeFaYGVuxHEjzKTHtc9uGFEjR6hHrvNzeS/PX+LLLcetJcytsB5m4j+K3o/EpXJNb/5IEQ==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.1", + "core-js-compat": "^3.21.0" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.3.1", + "resolved": "http://27.17.3.62:20000/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz", + "integrity": "sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.1" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "http://27.17.3.62:20000/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "core-js": { + "version": "2.6.12", + "resolved": "http://27.17.3.62:20000/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "http://27.17.3.62:20000/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "base64-js": { + "version": "1.5.1", + "resolved": "http://27.17.3.62:20000/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, + "batch": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", + "dev": true + }, + "big.js": { + "version": "5.2.2", + "resolved": "http://27.17.3.62:20000/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "bl": { + "version": "4.1.0", + "resolved": "http://27.17.3.62:20000/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "bluebird": { + "version": "3.7.2", + "resolved": "http://27.17.3.62:20000/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, + "body-parser": { + "version": "1.20.0", + "resolved": "http://27.17.3.62:20000/body-parser/-/body-parser-1.20.0.tgz", + "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "dev": true, + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.10.3", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "dependencies": { + "bytes": { + "version": "3.1.2", + "resolved": "http://27.17.3.62:20000/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "http://27.17.3.62:20000/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "bonjour-service": { + "version": "1.0.13", + "resolved": "http://27.17.3.62:20000/bonjour-service/-/bonjour-service-1.0.13.tgz", + "integrity": "sha512-LWKRU/7EqDUC9CTAQtuZl5HzBALoCYwtLhffW3et7vZMwv3bWLpJf8bRYlMD5OCcDpTfnPgNCV4yo9ZIaJGMiA==", + "dev": true, + "requires": { + "array-flatten": "^2.1.2", + "dns-equal": "^1.0.0", + "fast-deep-equal": "^3.1.3", + "multicast-dns": "^7.2.5" + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "http://27.17.3.62:20000/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "http://27.17.3.62:20000/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browserslist": { + "version": "4.20.4", + "resolved": "http://27.17.3.62:20000/browserslist/-/browserslist-4.20.4.tgz", + "integrity": "sha512-ok1d+1WpnU24XYN7oC3QWgTyMhY/avPJ/r9T00xxvUOIparA/gc+UPUMaod3i+G6s+nI2nUb9xZ5k794uIwShw==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001349", + "electron-to-chromium": "^1.4.147", + "escalade": "^3.1.1", + "node-releases": "^2.0.5", + "picocolors": "^1.0.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "http://27.17.3.62:20000/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "http://27.17.3.62:20000/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "bytes": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "cacache": { + "version": "13.0.1", + "resolved": "http://27.17.3.62:20000/cacache/-/cacache-13.0.1.tgz", + "integrity": "sha512-5ZvAxd05HDDU+y9BVvcqYu2LLXmPnQ0hW62h32g4xBTgL/MppR4/04NHfj/ycM2y6lmTnbw6HVi+1eN0Psba6w==", + "dev": true, + "requires": { + "chownr": "^1.1.2", + "figgy-pudding": "^3.5.1", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.2", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "minipass": "^3.0.0", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "p-map": "^3.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^2.7.1", + "ssri": "^7.0.0", + "unique-filename": "^1.1.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "http://27.17.3.62:20000/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "ssri": { + "version": "7.1.1", + "resolved": "http://27.17.3.62:20000/ssri/-/ssri-7.1.1.tgz", + "integrity": "sha512-w+daCzXN89PseTL99MkA+fxJEcU3wfaE/ah0i0lnOlpG1CYLJ2ZjzEry68YBKfLs4JfoTShrTEsJkAZuNZ/stw==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1", + "minipass": "^3.1.1" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, + "call-bind": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camel-case": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "dev": true, + "requires": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "caniuse-api": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "caniuse-lite": "^1.0.0", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, + "caniuse-lite": { + "version": "1.0.30001355", + "resolved": "http://27.17.3.62:20000/caniuse-lite/-/caniuse-lite-1.0.30001355.tgz", + "integrity": "sha512-Sd6pjJHF27LzCB7pT7qs+kuX2ndurzCzkpJl6Qct7LPSZ9jn0bkOA8mdgMgmqnQAWLVOOGjLpc+66V57eLtb1g==", + "dev": true + }, + "case-sensitive-paths-webpack-plugin": { + "version": "2.4.0", + "resolved": "http://27.17.3.62:20000/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.4.0.tgz", + "integrity": "sha512-roIFONhcxog0JSSWbvVAh3OocukmSgpqOH6YpMkCvav/ySIV3JKg4Dc8vYtQjYi/UxpNE36r/9v+VqTQqgkYmw==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "charcodes": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/charcodes/-/charcodes-0.2.0.tgz", + "integrity": "sha512-Y4kiDb+AM4Ecy58YkuZrrSRJBDQdQ2L+NyS1vHHFtNtUjgutcZfx3yp1dAONI/oPaPmyGfCLx5CxL+zauIMyKQ==", + "dev": true + }, + "chokidar": { + "version": "3.5.3", + "resolved": "http://27.17.3.62:20000/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "chownr": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "dev": true + }, + "ci-info": { + "version": "1.6.0", + "resolved": "http://27.17.3.62:20000/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "dev": true + }, + "classnames": { + "version": "2.3.2", + "resolved": "http://27.17.3.62:20000/classnames/-/classnames-2.3.2.tgz", + "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" + }, + "clean-css": { + "version": "5.3.1", + "resolved": "http://27.17.3.62:20000/clean-css/-/clean-css-5.3.1.tgz", + "integrity": "sha512-lCr8OHhiWCTw4v8POJovCoh4T7I9U11yVsPjMWWnnMmp9ZowCxyad1Pathle/9HjaDp+fdQKjO9fQydE6RHTZg==", + "dev": true, + "requires": { + "source-map": "~0.6.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-highlight": { + "version": "2.1.11", + "resolved": "http://27.17.3.62:20000/cli-highlight/-/cli-highlight-2.1.11.tgz", + "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "highlight.js": "^10.7.1", + "mz": "^2.4.0", + "parse5": "^5.1.1", + "parse5-htmlparser2-tree-adapter": "^6.0.0", + "yargs": "^16.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "cli-spinners": { + "version": "2.6.1", + "resolved": "http://27.17.3.62:20000/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "dev": true + }, + "clipboardy": { + "version": "2.3.0", + "resolved": "http://27.17.3.62:20000/clipboardy/-/clipboardy-2.3.0.tgz", + "integrity": "sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==", + "dev": true, + "requires": { + "arch": "^2.1.1", + "execa": "^1.0.0", + "is-wsl": "^2.1.1" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "http://27.17.3.62:20000/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "clone": { + "version": "1.0.4", + "resolved": "http://27.17.3.62:20000/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "http://27.17.3.62:20000/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colord": { + "version": "2.9.2", + "resolved": "http://27.17.3.62:20000/colord/-/colord-2.9.2.tgz", + "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "dev": true + }, + "colorette": { + "version": "2.0.19", + "resolved": "http://27.17.3.62:20000/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", + "dev": true + }, + "commander": { + "version": "9.3.0", + "resolved": "http://27.17.3.62:20000/commander/-/commander-9.3.0.tgz", + "integrity": "sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==" + }, + "commondir": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-classes": { + "version": "1.2.6", + "resolved": "http://27.17.3.62:20000/component-classes/-/component-classes-1.2.6.tgz", + "integrity": "sha1-xkI5TDYYpNiwuJGe/Mu9kw5c1pE=", + "requires": { + "component-indexof": "0.0.3" + } + }, + "component-indexof": { + "version": "0.0.3", + "resolved": "http://27.17.3.62:20000/component-indexof/-/component-indexof-0.0.3.tgz", + "integrity": "sha1-EdCRMSI5648yyPJa6csAL/6NPCQ=" + }, + "compressible": { + "version": "2.0.18", + "resolved": "http://27.17.3.62:20000/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "requires": { + "mime-db": ">= 1.43.0 < 2" + } + }, + "compression": { + "version": "1.7.4", + "resolved": "http://27.17.3.62:20000/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dev": true, + "requires": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "http://27.17.3.62:20000/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "compression-webpack-plugin": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/compression-webpack-plugin/-/compression-webpack-plugin-3.1.0.tgz", + "integrity": "sha512-iqTHj3rADN4yHwXMBrQa/xrncex/uEQy8QHlaTKxGchT/hC0SdlJlmL/5eRqffmWq2ep0/Romw6Ld39JjTR/ug==", + "dev": true, + "requires": { + "cacache": "^13.0.1", + "find-cache-dir": "^3.0.0", + "neo-async": "^2.5.0", + "schema-utils": "^2.6.1", + "serialize-javascript": "^2.1.2", + "webpack-sources": "^1.0.1" + }, + "dependencies": { + "serialize-javascript": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/serialize-javascript/-/serialize-javascript-2.1.2.tgz", + "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "webpack-sources": { + "version": "1.4.3", + "resolved": "http://27.17.3.62:20000/webpack-sources/-/webpack-sources-1.4.3.tgz", + "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "dev": true, + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + } + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "http://27.17.3.62:20000/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "http://27.17.3.62:20000/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", + "dev": true + }, + "consolidate": { + "version": "0.15.1", + "resolved": "http://27.17.3.62:20000/consolidate/-/consolidate-0.15.1.tgz", + "integrity": "sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==", + "dev": true, + "requires": { + "bluebird": "^3.1.1" + } + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "http://27.17.3.62:20000/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "requires": { + "safe-buffer": "5.2.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "http://27.17.3.62:20000/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "http://27.17.3.62:20000/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "http://27.17.3.62:20000/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cookie": { + "version": "0.5.0", + "resolved": "http://27.17.3.62:20000/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "http://27.17.3.62:20000/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "http://27.17.3.62:20000/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "http://27.17.3.62:20000/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "copy-webpack-plugin": { + "version": "9.1.0", + "resolved": "http://27.17.3.62:20000/copy-webpack-plugin/-/copy-webpack-plugin-9.1.0.tgz", + "integrity": "sha512-rxnR7PaGigJzhqETHGmAcxKnLZSR5u1Y3/bcIv/1FnqXedcL/E2ewK7ZCNrArJKCiSv8yVXhTqetJh8inDvfsA==", + "dev": true, + "requires": { + "fast-glob": "^3.2.7", + "glob-parent": "^6.0.1", + "globby": "^11.0.3", + "normalize-path": "^3.0.0", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0" + }, + "dependencies": { + "glob-parent": { + "version": "6.0.2", + "resolved": "http://27.17.3.62:20000/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + } + } + }, + "core-js": { + "version": "3.22.5", + "resolved": "http://27.17.3.62:20000/core-js/-/core-js-3.22.5.tgz", + "integrity": "sha512-VP/xYuvJ0MJWRAobcmQ8F2H6Bsn+s7zqAAjFaHGBMc5AQm7zaelhD1LGduFn2EehEcQcU+br6t+fwbpQ5d1ZWA==" + }, + "core-js-compat": { + "version": "3.23.1", + "resolved": "http://27.17.3.62:20000/core-js-compat/-/core-js-compat-3.23.1.tgz", + "integrity": "sha512-KeYrEc8t6FJsKYB2qnDwRHWaC0cJNaqlHfCpMe5q3j/W1nje3moib/txNklddLPCtGb+etcBIyJ8zuMa/LN5/A==", + "dev": true, + "requires": { + "browserslist": "^4.20.4", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true + } + } + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "cosmiconfig": { + "version": "7.0.1", + "resolved": "http://27.17.3.62:20000/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "http://27.17.3.62:20000/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "css-declaration-sorter": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/css-declaration-sorter/-/css-declaration-sorter-6.3.0.tgz", + "integrity": "sha512-OGT677UGHJTAVMRhPO+HJ4oKln3wkBTwtDFH0ojbqm+MJm6xuDMHp2nkhh/ThaBqq20IbraBQSWKfSLNHQO9Og==", + "dev": true + }, + "css-loader": { + "version": "6.7.1", + "resolved": "http://27.17.3.62:20000/css-loader/-/css-loader-6.7.1.tgz", + "integrity": "sha512-yB5CNFa14MbPJcomwNh3wLThtkZgcNyI2bNMRt8iE5Z8Vwl7f8vQXFAzn2HDOJvtDq2NTZBUGMSUNNyrv3/+cw==", + "dev": true, + "requires": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.7", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.3.5" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "css-minimizer-webpack-plugin": { + "version": "3.4.1", + "resolved": "http://27.17.3.62:20000/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-3.4.1.tgz", + "integrity": "sha512-1u6D71zeIfgngN2XNRJefc/hY7Ybsxd74Jm4qngIXyUEk7fss3VUzuHxLAq/R8NAba4QU9OUSaMZlbpRc7bM4Q==", + "dev": true, + "requires": { + "cssnano": "^5.0.6", + "jest-worker": "^27.0.2", + "postcss": "^8.3.5", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "http://27.17.3.62:20000/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "schema-utils": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "css-select": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/css-select/-/css-select-4.3.0.tgz", + "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", + "dev": true, + "requires": { + "boolbase": "^1.0.0", + "css-what": "^6.0.1", + "domhandler": "^4.3.1", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + } + }, + "css-tree": { + "version": "1.1.3", + "resolved": "http://27.17.3.62:20000/css-tree/-/css-tree-1.1.3.tgz", + "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", + "dev": true, + "requires": { + "mdn-data": "2.0.14", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "css-unicode-loader": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/css-unicode-loader/-/css-unicode-loader-1.0.3.tgz", + "integrity": "sha512-mszxqB0LCBO2ixbaz/tAH17iEAXmytUv0j/YXtPxhOi8D8Teh+mOXqmz+DZRtDil5tFx7ltbgw16dUptEw4jOg==", + "dev": true + }, + "css-what": { + "version": "6.1.0", + "resolved": "http://27.17.3.62:20000/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true + }, + "cssesc": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true + }, + "cssnano": { + "version": "5.1.11", + "resolved": "http://27.17.3.62:20000/cssnano/-/cssnano-5.1.11.tgz", + "integrity": "sha512-2nx+O6LvewPo5EBtYrKc8762mMkZRk9cMGIOP4UlkmxHm7ObxH+zvsJJ+qLwPkUc4/yumL/qJkavYi9NlodWIQ==", + "dev": true, + "requires": { + "cssnano-preset-default": "^5.2.11", + "lilconfig": "^2.0.3", + "yaml": "^1.10.2" + } + }, + "cssnano-preset-default": { + "version": "5.2.11", + "resolved": "http://27.17.3.62:20000/cssnano-preset-default/-/cssnano-preset-default-5.2.11.tgz", + "integrity": "sha512-4PadR1NtuaIK8MvLNuY7MznK4WJteldGlzCiMaaTiOUP+apeiIvUDIXykzUOoqgOOUAHrU64ncdD90NfZR3LSQ==", + "dev": true, + "requires": { + "css-declaration-sorter": "^6.2.2", + "cssnano-utils": "^3.1.0", + "postcss-calc": "^8.2.3", + "postcss-colormin": "^5.3.0", + "postcss-convert-values": "^5.1.2", + "postcss-discard-comments": "^5.1.2", + "postcss-discard-duplicates": "^5.1.0", + "postcss-discard-empty": "^5.1.1", + "postcss-discard-overridden": "^5.1.0", + "postcss-merge-longhand": "^5.1.5", + "postcss-merge-rules": "^5.1.2", + "postcss-minify-font-values": "^5.1.0", + "postcss-minify-gradients": "^5.1.1", + "postcss-minify-params": "^5.1.3", + "postcss-minify-selectors": "^5.2.1", + "postcss-normalize-charset": "^5.1.0", + "postcss-normalize-display-values": "^5.1.0", + "postcss-normalize-positions": "^5.1.0", + "postcss-normalize-repeat-style": "^5.1.0", + "postcss-normalize-string": "^5.1.0", + "postcss-normalize-timing-functions": "^5.1.0", + "postcss-normalize-unicode": "^5.1.0", + "postcss-normalize-url": "^5.1.0", + "postcss-normalize-whitespace": "^5.1.1", + "postcss-ordered-values": "^5.1.2", + "postcss-reduce-initial": "^5.1.0", + "postcss-reduce-transforms": "^5.1.0", + "postcss-svgo": "^5.1.0", + "postcss-unique-selectors": "^5.1.1" + } + }, + "cssnano-utils": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/cssnano-utils/-/cssnano-utils-3.1.0.tgz", + "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", + "dev": true + }, + "csso": { + "version": "4.2.0", + "resolved": "http://27.17.3.62:20000/csso/-/csso-4.2.0.tgz", + "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", + "dev": true, + "requires": { + "css-tree": "^1.1.2" + } + }, + "de-indent": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/de-indent/-/de-indent-1.0.2.tgz", + "integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "http://27.17.3.62:20000/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "deepmerge": { + "version": "1.5.2", + "resolved": "http://27.17.3.62:20000/deepmerge/-/deepmerge-1.5.2.tgz", + "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", + "dev": true + }, + "default-gateway": { + "version": "6.0.3", + "resolved": "http://27.17.3.62:20000/default-gateway/-/default-gateway-6.0.3.tgz", + "integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==", + "dev": true, + "requires": { + "execa": "^5.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.3", + "resolved": "http://27.17.3.62:20000/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "execa": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "http://27.17.3.62:20000/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "http://27.17.3.62:20000/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "defaults": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + } + }, + "define-lazy-prop": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true + }, + "define-properties": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "dev": true, + "requires": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "depd": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true + }, + "destroy": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true + }, + "detect-node": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "dns-equal": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/dns-equal/-/dns-equal-1.0.0.tgz", + "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=", + "dev": true + }, + "dns-packet": { + "version": "5.4.0", + "resolved": "http://27.17.3.62:20000/dns-packet/-/dns-packet-5.4.0.tgz", + "integrity": "sha512-EgqGeaBB8hLiHLZtp/IbaDQTL8pZ0+IvwzSHA6d7VyMDM+B9hgddEMa9xjK5oYnw0ci0JQ6g2XCD7/f6cafU6g==", + "dev": true, + "requires": { + "@leichtgewicht/ip-codec": "^2.0.1" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "dom-align": { + "version": "1.12.4", + "resolved": "http://27.17.3.62:20000/dom-align/-/dom-align-1.12.4.tgz", + "integrity": "sha512-R8LUSEay/68zE5c8/3BDxiTEvgb4xZTF0RKmAHfiEVN3klfIpXfi2/QCoiWPccVQ0J/ZGdz9OjzL4uJEP/MRAw==" + }, + "dom-closest": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/dom-closest/-/dom-closest-0.2.0.tgz", + "integrity": "sha1-69n5HRvyLo1vR3h2u80+yQIWwM8=", + "requires": { + "dom-matches": ">=1.0.1" + } + }, + "dom-converter": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/dom-converter/-/dom-converter-0.2.0.tgz", + "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==", + "dev": true, + "requires": { + "utila": "~0.4" + } + }, + "dom-matches": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/dom-matches/-/dom-matches-2.0.0.tgz", + "integrity": "sha1-0nKLQWqHUzmA6wibhI0lPPI6dYw=" + }, + "dom-scroll-into-view": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/dom-scroll-into-view/-/dom-scroll-into-view-2.0.1.tgz", + "integrity": "sha512-bvVTQe1lfaUr1oFzZX80ce9KLDlZ3iU+XGNE/bz9HnGdklTieqsbmsLHe+rT2XWqopvL0PckkYqN7ksmm5pe3w==" + }, + "dom-serializer": { + "version": "1.4.1", + "resolved": "http://27.17.3.62:20000/dom-serializer/-/dom-serializer-1.4.1.tgz", + "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + } + }, + "dom7": { + "version": "2.1.5", + "resolved": "http://27.17.3.62:20000/dom7/-/dom7-2.1.5.tgz", + "integrity": "sha512-xnhwVgyOh3eD++/XGtH+5qBwYTgCm0aW91GFgPJ3XG+jlsRLyJivnbP0QmUBFhI+Oaz9FV0s7cxgXHezwOEBYA==", + "requires": { + "ssr-window": "^2.0.0" + } + }, + "domelementtype": { + "version": "2.3.0", + "resolved": "http://27.17.3.62:20000/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true + }, + "domhandler": { + "version": "4.3.1", + "resolved": "http://27.17.3.62:20000/domhandler/-/domhandler-4.3.1.tgz", + "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "dev": true, + "requires": { + "domelementtype": "^2.2.0" + } + }, + "domutils": { + "version": "2.8.0", + "resolved": "http://27.17.3.62:20000/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dev": true, + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + } + }, + "dot-case": { + "version": "3.0.4", + "resolved": "http://27.17.3.62:20000/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dev": true, + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "dotenv": { + "version": "10.0.0", + "resolved": "http://27.17.3.62:20000/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "dev": true + }, + "dotenv-expand": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/dotenv-expand/-/dotenv-expand-5.1.0.tgz", + "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", + "dev": true + }, + "duplexer": { + "version": "0.1.2", + "resolved": "http://27.17.3.62:20000/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true + }, + "easy-stack": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/easy-stack/-/easy-stack-1.0.1.tgz", + "integrity": "sha512-wK2sCs4feiiJeFXn3zvY0p41mdU5VUgbgs1rNsc/y5ngFUijdWd+iIN8eoyuZHKB8xN6BL4PdWmzqFmxNg6V2w==", + "dev": true + }, + "ee-first": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.4.158", + "resolved": "http://27.17.3.62:20000/electron-to-chromium/-/electron-to-chromium-1.4.158.tgz", + "integrity": "sha512-gppO3/+Y6sP432HtvwvuU8S+YYYLH4PmAYvQwqUtt9HDOmEsBwQfLnK9T8+1NIKwAS1BEygIjTaATC4H5EzvxQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "http://27.17.3.62:20000/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "emojis-list": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "http://27.17.3.62:20000/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "enhanced-resolve": { + "version": "5.9.3", + "resolved": "http://27.17.3.62:20000/enhanced-resolve/-/enhanced-resolve-5.9.3.tgz", + "integrity": "sha512-Bq9VSor+kjvW3f9/MiiR4eE3XYgOl7/rS8lnSxbRbF3kS0B2r+Y9w5krBWxZgDxASVZbdYrn5wT4j/Wb0J9qow==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "enquire.js": { + "version": "2.1.6", + "resolved": "http://27.17.3.62:20000/enquire.js/-/enquire.js-2.1.6.tgz", + "integrity": "sha1-PoeAybi4NQhMP2DhZtvDwqPImBQ=" + }, + "enquirer": { + "version": "2.3.6", + "resolved": "http://27.17.3.62:20000/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "entities": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "http://27.17.3.62:20000/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "error-stack-parser": { + "version": "2.1.4", + "resolved": "http://27.17.3.62:20000/error-stack-parser/-/error-stack-parser-2.1.4.tgz", + "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==", + "dev": true, + "requires": { + "stackframe": "^1.3.4" + } + }, + "es-abstract": { + "version": "1.20.1", + "resolved": "http://27.17.3.62:20000/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" + } + }, + "es-module-lexer": { + "version": "0.9.3", + "resolved": "http://27.17.3.62:20000/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", + "dev": true + }, + "es-shim-unscopables": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "http://27.17.3.62:20000/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "7.32.0", + "resolved": "http://27.17.3.62:20000/eslint/-/eslint-7.32.0.tgz", + "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "http://27.17.3.62:20000/@babel%2fcode-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "http://27.17.3.62:20000/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, + "globals": { + "version": "13.15.0", + "resolved": "http://27.17.3.62:20000/globals/-/globals-13.15.0.tgz", + "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "http://27.17.3.62:20000/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "semver": { + "version": "7.3.7", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "http://27.17.3.62:20000/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "eslint-config-standard": { + "version": "16.0.3", + "resolved": "http://27.17.3.62:20000/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz", + "integrity": "sha512-x4fmJL5hGqNJKGHSjnLdgA6U6h1YW/G2dW9fA+cyVur4SK6lyue8+UgNKWlZtUDTXvgKDD/Oa3GQjmB5kjtVvg==", + "dev": true + }, + "eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "http://27.17.3.62:20000/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "http://27.17.3.62:20000/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + } + }, + "eslint-import-resolver-webpack": { + "version": "0.13.2", + "resolved": "http://27.17.3.62:20000/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.13.2.tgz", + "integrity": "sha512-XodIPyg1OgE2h5BDErz3WJoK7lawxKTJNhgPNafRST6csC/MZC+L5P6kKqsZGRInpbgc02s/WZMrb4uGJzcuRg==", + "dev": true, + "requires": { + "array-find": "^1.0.0", + "debug": "^3.2.7", + "enhanced-resolve": "^0.9.1", + "find-root": "^1.1.0", + "has": "^1.0.3", + "interpret": "^1.4.0", + "is-core-module": "^2.7.0", + "is-regex": "^1.1.4", + "lodash": "^4.17.21", + "resolve": "^1.20.0", + "semver": "^5.7.1" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "http://27.17.3.62:20000/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "enhanced-resolve": { + "version": "0.9.1", + "resolved": "http://27.17.3.62:20000/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz", + "integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.2.0", + "tapable": "^0.1.8" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "tapable": { + "version": "0.1.10", + "resolved": "http://27.17.3.62:20000/tapable/-/tapable-0.1.10.tgz", + "integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=", + "dev": true + } + } + }, + "eslint-module-utils": { + "version": "2.7.3", + "resolved": "http://27.17.3.62:20000/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "find-up": "^2.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "http://27.17.3.62:20000/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "http://27.17.3.62:20000/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "eslint-plugin-es": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + } + }, + "eslint-plugin-import": { + "version": "2.26.0", + "resolved": "http://27.17.3.62:20000/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "dev": true, + "requires": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", + "has": "^1.0.3", + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "http://27.17.3.62:20000/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + } + } + }, + "eslint-plugin-node": { + "version": "11.1.0", + "resolved": "http://27.17.3.62:20000/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "requires": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "eslint-plugin-promise": { + "version": "5.2.0", + "resolved": "http://27.17.3.62:20000/eslint-plugin-promise/-/eslint-plugin-promise-5.2.0.tgz", + "integrity": "sha512-SftLb1pUG01QYq2A/hGAWfDRXqYD82zE7j7TopDOyNdU+7SvvoXREls/+PRTY17vUXzXnZA/zfnyKgRH6x4JJw==", + "dev": true + }, + "eslint-plugin-vue": { + "version": "8.7.1", + "resolved": "http://27.17.3.62:20000/eslint-plugin-vue/-/eslint-plugin-vue-8.7.1.tgz", + "integrity": "sha512-28sbtm4l4cOzoO1LtzQPxfxhQABararUb1JtqusQqObJpWX2e/gmVyeYVfepizPFne0Q5cILkYGiBoV36L12Wg==", + "dev": true, + "requires": { + "eslint-utils": "^3.0.0", + "natural-compare": "^1.4.0", + "nth-check": "^2.0.1", + "postcss-selector-parser": "^6.0.9", + "semver": "^7.3.5", + "vue-eslint-parser": "^8.0.1" + }, + "dependencies": { + "eslint-utils": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, + "semver": { + "version": "7.3.7", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "http://27.17.3.62:20000/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + }, + "eslint-webpack-plugin": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/eslint-webpack-plugin/-/eslint-webpack-plugin-3.1.1.tgz", + "integrity": "sha512-xSucskTN9tOkfW7so4EaiFIkulWLXwCB/15H917lR6pTv0Zot6/fetFucmENRb7J5whVSFKIvwnrnsa78SG2yg==", + "dev": true, + "requires": { + "@types/eslint": "^7.28.2", + "jest-worker": "^27.3.1", + "micromatch": "^4.0.4", + "normalize-path": "^3.0.0", + "schema-utils": "^3.1.1" + }, + "dependencies": { + "@types/eslint": { + "version": "7.29.0", + "resolved": "http://27.17.3.62:20000/@types%2feslint/-/eslint-7.29.0.tgz", + "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + } + } + }, + "espree": { + "version": "7.3.1", + "resolved": "http://27.17.3.62:20000/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "acorn": { + "version": "7.4.1", + "resolved": "http://27.17.3.62:20000/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "http://27.17.3.62:20000/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "http://27.17.3.62:20000/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "http://27.17.3.62:20000/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "http://27.17.3.62:20000/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "http://27.17.3.62:20000/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "http://27.17.3.62:20000/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "event-pubsub": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/event-pubsub/-/event-pubsub-4.3.0.tgz", + "integrity": "sha512-z7IyloorXvKbFx9Bpie2+vMJKKx1fH1EN5yiTfp8CiLOTptSYy1g8H4yDpGlEdshL1PBiFtBHepF2cNsqeEeFQ==", + "dev": true + }, + "eventemitter3": { + "version": "4.0.7", + "resolved": "http://27.17.3.62:20000/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "events": { + "version": "3.3.0", + "resolved": "http://27.17.3.62:20000/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true + }, + "execa": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "express": { + "version": "4.18.1", + "resolved": "http://27.17.3.62:20000/express/-/express-4.18.1.tgz", + "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", + "dev": true, + "requires": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.0", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.10.3", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "array-flatten": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "http://27.17.3.62:20000/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "http://27.17.3.62:20000/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "http://27.17.3.62:20000/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.11", + "resolved": "http://27.17.3.62:20000/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "http://27.17.3.62:20000/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastq": { + "version": "1.13.0", + "resolved": "http://27.17.3.62:20000/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "faye-websocket": { + "version": "0.11.4", + "resolved": "http://27.17.3.62:20000/faye-websocket/-/faye-websocket-0.11.4.tgz", + "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + }, + "figgy-pudding": { + "version": "3.5.2", + "resolved": "http://27.17.3.62:20000/figgy-pudding/-/figgy-pudding-3.5.2.tgz", + "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "http://27.17.3.62:20000/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "http://27.17.3.62:20000/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "finalhandler": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "http://27.17.3.62:20000/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "find-cache-dir": { + "version": "3.3.2", + "resolved": "http://27.17.3.62:20000/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-root": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "http://27.17.3.62:20000/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "http://27.17.3.62:20000/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.5", + "resolved": "http://27.17.3.62:20000/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "http://27.17.3.62:20000/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "forwarded": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true + }, + "fraction.js": { + "version": "4.2.0", + "resolved": "http://27.17.3.62:20000/fraction.js/-/fraction.js-4.2.0.tgz", + "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "dev": true + }, + "fresh": { + "version": "0.5.2", + "resolved": "http://27.17.3.62:20000/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, + "fs-extra": { + "version": "9.1.0", + "resolved": "http://27.17.3.62:20000/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "fs-monkey": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/fs-monkey/-/fs-monkey-1.0.3.tgz", + "integrity": "sha512-cybjIfiiE+pTWicSCLFHSrXZ6EilF30oh91FDP9S2B051prEa7QWfrVTQm10/dDpswBDXZugPa1Ogu8Yh+HV0Q==", + "dev": true + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "http://27.17.3.62:20000/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "http://27.17.3.62:20000/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "http://27.17.3.62:20000/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "http://27.17.3.62:20000/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "http://27.17.3.62:20000/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "http://27.17.3.62:20000/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "http://27.17.3.62:20000/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-intrinsic": { + "version": "1.1.2", + "resolved": "http://27.17.3.62:20000/get-intrinsic/-/get-intrinsic-1.1.2.tgz", + "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "http://27.17.3.62:20000/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "glob": { + "version": "7.2.3", + "resolved": "http://27.17.3.62:20000/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "http://27.17.3.62:20000/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "http://27.17.3.62:20000/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "globals": { + "version": "11.12.0", + "resolved": "http://27.17.3.62:20000/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "globby": { + "version": "11.1.0", + "resolved": "http://27.17.3.62:20000/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "http://27.17.3.62:20000/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "gzip-size": { + "version": "6.0.0", + "resolved": "http://27.17.3.62:20000/gzip-size/-/gzip-size-6.0.0.tgz", + "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==", + "dev": true, + "requires": { + "duplexer": "^0.1.2" + } + }, + "handle-thing": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-bigints": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "hash-sum": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/hash-sum/-/hash-sum-2.0.0.tgz", + "integrity": "sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "highlight.js": { + "version": "10.7.3", + "resolved": "http://27.17.3.62:20000/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "dev": true + }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "http://27.17.3.62:20000/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "hpack.js": { + "version": "2.1.6", + "resolved": "http://27.17.3.62:20000/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "http://27.17.3.62:20000/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "html-entities": { + "version": "2.3.3", + "resolved": "http://27.17.3.62:20000/html-entities/-/html-entities-2.3.3.tgz", + "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==", + "dev": true + }, + "html-minifier-terser": { + "version": "6.1.0", + "resolved": "http://27.17.3.62:20000/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", + "integrity": "sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==", + "dev": true, + "requires": { + "camel-case": "^4.1.2", + "clean-css": "^5.2.2", + "commander": "^8.3.0", + "he": "^1.2.0", + "param-case": "^3.0.4", + "relateurl": "^0.2.7", + "terser": "^5.10.0" + }, + "dependencies": { + "commander": { + "version": "8.3.0", + "resolved": "http://27.17.3.62:20000/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true + } + } + }, + "html-tags": { + "version": "3.2.0", + "resolved": "http://27.17.3.62:20000/html-tags/-/html-tags-3.2.0.tgz", + "integrity": "sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==", + "dev": true + }, + "html-webpack-plugin": { + "version": "5.5.0", + "resolved": "http://27.17.3.62:20000/html-webpack-plugin/-/html-webpack-plugin-5.5.0.tgz", + "integrity": "sha512-sy88PC2cRTVxvETRgUHFrL4No3UxvcH8G1NepGhqaTT+GXN2kTamqasot0inS5hXeg1cMbFDt27zzo9p35lZVw==", + "dev": true, + "requires": { + "@types/html-minifier-terser": "^6.0.0", + "html-minifier-terser": "^6.0.2", + "lodash": "^4.17.21", + "pretty-error": "^4.0.0", + "tapable": "^2.0.0" + } + }, + "htmlparser2": { + "version": "6.1.0", + "resolved": "http://27.17.3.62:20000/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "http-deceiver": { + "version": "1.2.7", + "resolved": "http://27.17.3.62:20000/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", + "dev": true + }, + "http-errors": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "requires": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + } + }, + "http-parser-js": { + "version": "0.5.6", + "resolved": "http://27.17.3.62:20000/http-parser-js/-/http-parser-js-0.5.6.tgz", + "integrity": "sha512-vDlkRPDJn93swjcjqMSaGSPABbIarsr1TLAui/gLDXzV5VsJNdXNzMYDyNBLQkjWQCJ1uizu8T2oDMhmGt0PRA==", + "dev": true + }, + "http-proxy": { + "version": "1.18.1", + "resolved": "http://27.17.3.62:20000/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "requires": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "http-proxy-middleware": { + "version": "2.0.6", + "resolved": "http://27.17.3.62:20000/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", + "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "dev": true, + "requires": { + "@types/http-proxy": "^1.17.8", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.2" + } + }, + "human-signals": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "http://27.17.3.62:20000/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "icss-utils": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true + }, + "ieee754": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "http://27.17.3.62:20000/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "ignore": { + "version": "5.2.0", + "resolved": "http://27.17.3.62:20000/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, + "immutable": { + "version": "4.1.0", + "resolved": "http://27.17.3.62:20000/immutable/-/immutable-4.1.0.tgz", + "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "http://27.17.3.62:20000/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "http://27.17.3.62:20000/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "infer-owner": { + "version": "1.0.4", + "resolved": "http://27.17.3.62:20000/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "http://27.17.3.62:20000/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "http://27.17.3.62:20000/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "internal-slot": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "interpret": { + "version": "1.4.0", + "resolved": "http://27.17.3.62:20000/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true + }, + "intersperse": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/intersperse/-/intersperse-1.0.0.tgz", + "integrity": "sha1-8lYfsc/vn1J3zDNHoiiGtDUaUYE=" + }, + "ipaddr.js": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/ipaddr.js/-/ipaddr.js-2.0.1.tgz", + "integrity": "sha512-1qTgH9NG+IIJ4yfKs2e6Pp1bZg8wbDbKHT21HrLIeYBTRLgMYKnMTPAuI3Lcs61nfx5h1xlXnbJtH1kX5/d/ng==", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "http://27.17.3.62:20000/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "http://27.17.3.62:20000/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "http://27.17.3.62:20000/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.4", + "resolved": "http://27.17.3.62:20000/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true + }, + "is-ci": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-core-module": { + "version": "2.9.0", + "resolved": "http://27.17.3.62:20000/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "http://27.17.3.62:20000/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-docker": { + "version": "2.2.1", + "resolved": "http://27.17.3.62:20000/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "http://27.17.3.62:20000/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-file-esm": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/is-file-esm/-/is-file-esm-1.0.0.tgz", + "integrity": "sha512-rZlaNKb4Mr8WlRu2A9XdeoKgnO5aA53XdPHgCKVyCrQ/rWi89RET1+bq37Ru46obaQXeiX4vmFIm1vks41hoSA==", + "dev": true, + "requires": { + "read-pkg-up": "^7.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "http://27.17.3.62:20000/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-interactive": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true + }, + "is-mobile": { + "version": "2.2.2", + "resolved": "http://27.17.3.62:20000/is-mobile/-/is-mobile-2.2.2.tgz", + "integrity": "sha512-wW/SXnYJkTjs++tVK5b6kVITZpAZPtUrt9SF80vvxGiF/Oywal+COk1jlRkiVq15RFNEQKQY31TkV24/1T5cVg==" + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "http://27.17.3.62:20000/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-number-object": { + "version": "1.0.7", + "resolved": "http://27.17.3.62:20000/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-plain-obj": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "http://27.17.3.62:20000/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-regex": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-string": { + "version": "1.0.7", + "resolved": "http://27.17.3.62:20000/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "http://27.17.3.62:20000/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "http://27.17.3.62:20000/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-wsl": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "ismobilejs": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/ismobilejs/-/ismobilejs-1.1.1.tgz", + "integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==" + }, + "isobject": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "javascript-stringify": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/javascript-stringify/-/javascript-stringify-2.1.0.tgz", + "integrity": "sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==", + "dev": true + }, + "jest-worker": { + "version": "27.5.1", + "resolved": "http://27.17.3.62:20000/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "joi": { + "version": "17.6.0", + "resolved": "http://27.17.3.62:20000/joi/-/joi-17.6.0.tgz", + "integrity": "sha512-OX5dG6DTbcr/kbMFj0KGYxuew69HPcAE3K/sZpEV2nP6e/j/C0HV+HNiBPCASxdx5T7DMoa0s8UeHWMnb6n2zw==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, + "js-message": { + "version": "1.0.7", + "resolved": "http://27.17.3.62:20000/js-message/-/js-message-1.0.7.tgz", + "integrity": "sha512-efJLHhLjIyKRewNS9EGZ4UpI8NguuL6fKkhRxVuMmrGV2xN/0APGdQYwLFky5w9naebSZ0OwAGp0G6/2Cg90rA==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "http://27.17.3.62:20000/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "http://27.17.3.62:20000/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "http://27.17.3.62:20000/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "http://27.17.3.62:20000/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json2mq": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/json2mq/-/json2mq-0.2.0.tgz", + "integrity": "sha1-tje9O6nqvhIsg+lyBIOusQ0skEo=", + "requires": { + "string-convert": "^0.2.0" + } + }, + "json5": { + "version": "2.2.1", + "resolved": "http://27.17.3.62:20000/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "dev": true + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "http://27.17.3.62:20000/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "http://27.17.3.62:20000/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "klona": { + "version": "2.0.5", + "resolved": "http://27.17.3.62:20000/klona/-/klona-2.0.5.tgz", + "integrity": "sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ==", + "dev": true + }, + "launch-editor": { + "version": "2.4.0", + "resolved": "http://27.17.3.62:20000/launch-editor/-/launch-editor-2.4.0.tgz", + "integrity": "sha512-mZ0BHeSn/ohL+Ib+b+JnxC59vcNz6v5IR9d0CuM8f0x8ni8oK3IIG6G0vMkpxc0gFsmvINkztGOHiWTaX4BmAg==", + "dev": true, + "requires": { + "picocolors": "^1.0.0", + "shell-quote": "^1.6.1" + } + }, + "launch-editor-middleware": { + "version": "2.4.0", + "resolved": "http://27.17.3.62:20000/launch-editor-middleware/-/launch-editor-middleware-2.4.0.tgz", + "integrity": "sha512-/M7AX/6xktZY60KE7j71XLrj9U6H5TBoP+mJzhYB3fcdAq8rcazit/K0qWiu1jvytUPXP4lJRd1VJFwvdMQ/uw==", + "dev": true, + "requires": { + "launch-editor": "^2.4.0" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "http://27.17.3.62:20000/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lilconfig": { + "version": "2.0.5", + "resolved": "http://27.17.3.62:20000/lilconfig/-/lilconfig-2.0.5.tgz", + "integrity": "sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==", + "dev": true + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "http://27.17.3.62:20000/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "loader-runner": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true + }, + "loader-utils": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/loader-utils/-/loader-utils-2.0.2.tgz", + "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "http://27.17.3.62:20000/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "http://27.17.3.62:20000/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "http://27.17.3.62:20000/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.defaultsdeep": { + "version": "4.6.1", + "resolved": "http://27.17.3.62:20000/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz", + "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", + "dev": true + }, + "lodash.kebabcase": { + "version": "4.1.1", + "resolved": "http://27.17.3.62:20000/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", + "integrity": "sha1-hImxyw0p/4gZXM7KRI/21swpXDY=", + "dev": true + }, + "lodash.mapvalues": { + "version": "4.6.0", + "resolved": "http://27.17.3.62:20000/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz", + "integrity": "sha1-G6+lAF3p3W9PJmaMMMo3IwzJaJw=", + "dev": true + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "http://27.17.3.62:20000/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "http://27.17.3.62:20000/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", + "dev": true + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "http://27.17.3.62:20000/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", + "dev": true + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "http://27.17.3.62:20000/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "log-update": { + "version": "2.3.0", + "resolved": "http://27.17.3.62:20000/log-update/-/log-update-2.3.0.tgz", + "integrity": "sha1-iDKP19HOeTiykoN0bwsbwSayRwg=", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "cli-cursor": "^2.0.0", + "wrap-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "http://27.17.3.62:20000/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/wrap-ansi/-/wrap-ansi-3.0.1.tgz", + "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0" + } + } + } + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "http://27.17.3.62:20000/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lower-case": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dev": true, + "requires": { + "tslib": "^2.0.3" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "http://27.17.3.62:20000/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://27.17.3.62:20000/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "mdn-data": { + "version": "2.0.14", + "resolved": "http://27.17.3.62:20000/mdn-data/-/mdn-data-2.0.14.tgz", + "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", + "dev": true + }, + "media-typer": { + "version": "0.3.0", + "resolved": "http://27.17.3.62:20000/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, + "memfs": { + "version": "3.4.4", + "resolved": "http://27.17.3.62:20000/memfs/-/memfs-3.4.4.tgz", + "integrity": "sha512-W4gHNUE++1oSJVn8Y68jPXi+mkx3fXR5ITE/Ubz6EQ3xRpCN5k2CQ4AUR8094Z7211F876TyoBACGsIveqgiGA==", + "dev": true, + "requires": { + "fs-monkey": "1.0.3" + } + }, + "memory-fs": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/memory-fs/-/memory-fs-0.2.0.tgz", + "integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=", + "dev": true + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, + "merge-source-map": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/merge-source-map/-/merge-source-map-1.1.0.tgz", + "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", + "dev": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "resolved": "http://27.17.3.62:20000/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "http://27.17.3.62:20000/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "http://27.17.3.62:20000/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "http://27.17.3.62:20000/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "mime-db": { + "version": "1.52.0", + "resolved": "http://27.17.3.62:20000/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.35", + "resolved": "http://27.17.3.62:20000/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "requires": { + "mime-db": "1.52.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "mini-css-extract-plugin": { + "version": "2.6.1", + "resolved": "http://27.17.3.62:20000/mini-css-extract-plugin/-/mini-css-extract-plugin-2.6.1.tgz", + "integrity": "sha512-wd+SD57/K6DiV7jIR34P+s3uckTRuQvx0tKPcvjFlrEylk6P4mQ2KSWk1hblj1Kxaqok7LogKOieygXqBczNlg==", + "dev": true, + "requires": { + "schema-utils": "^4.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "http://27.17.3.62:20000/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "schema-utils": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + } + } + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "http://27.17.3.62:20000/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "http://27.17.3.62:20000/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "minipass": { + "version": "3.1.6", + "resolved": "http://27.17.3.62:20000/minipass/-/minipass-3.1.6.tgz", + "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minipass-collect": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-flush": { + "version": "1.0.5", + "resolved": "http://27.17.3.62:20000/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-pipeline": { + "version": "1.2.4", + "resolved": "http://27.17.3.62:20000/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "http://27.17.3.62:20000/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } + }, + "mockjs": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/mockjs/-/mockjs-1.1.0.tgz", + "integrity": "sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==", + "requires": { + "commander": "*" + } + }, + "module-alias": { + "version": "2.2.2", + "resolved": "http://27.17.3.62:20000/module-alias/-/module-alias-2.2.2.tgz", + "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==", + "dev": true + }, + "moment": { + "version": "2.29.4", + "resolved": "http://27.17.3.62:20000/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "http://27.17.3.62:20000/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "mrmime": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/mrmime/-/mrmime-1.0.1.tgz", + "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "multicast-dns": { + "version": "7.2.5", + "resolved": "http://27.17.3.62:20000/multicast-dns/-/multicast-dns-7.2.5.tgz", + "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", + "dev": true, + "requires": { + "dns-packet": "^5.2.2", + "thunky": "^1.0.2" + } + }, + "mutationobserver-shim": { + "version": "0.3.7", + "resolved": "http://27.17.3.62:20000/mutationobserver-shim/-/mutationobserver-shim-0.3.7.tgz", + "integrity": "sha512-oRIDTyZQU96nAiz2AQyngwx1e89iApl2hN5AOYwyxLUB47UYsU3Wv9lJWqH5y/QdiYkc5HQLi23ZNB3fELdHcQ==" + }, + "mz": { + "version": "2.7.0", + "resolved": "http://27.17.3.62:20000/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "requires": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "nanoid": { + "version": "3.3.4", + "resolved": "http://27.17.3.62:20000/nanoid/-/nanoid-3.3.4.tgz", + "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "dev": true + }, + "nanopop": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/nanopop/-/nanopop-2.2.0.tgz", + "integrity": "sha512-E9JaHcxh3ere8/BEZHAcnuD10RluTSPyTToBvoFWS9/7DcCx6gyKjbn7M7Bx7E1veCxCuY1iO6h4+gdAf1j73Q==" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "http://27.17.3.62:20000/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "negotiator": { + "version": "0.6.3", + "resolved": "http://27.17.3.62:20000/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true + }, + "neo-async": { + "version": "2.6.2", + "resolved": "http://27.17.3.62:20000/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "http://27.17.3.62:20000/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "no-case": { + "version": "3.0.4", + "resolved": "http://27.17.3.62:20000/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dev": true, + "requires": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node-emoji": { + "version": "1.11.0", + "resolved": "http://27.17.3.62:20000/node-emoji/-/node-emoji-1.11.0.tgz", + "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", + "requires": { + "lodash": "^4.17.21" + } + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "http://27.17.3.62:20000/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "node-forge": { + "version": "1.3.1", + "resolved": "http://27.17.3.62:20000/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "dev": true + }, + "node-releases": { + "version": "2.0.5", + "resolved": "http://27.17.3.62:20000/node-releases/-/node-releases-2.0.5.tgz", + "integrity": "sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q==", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "http://27.17.3.62:20000/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "http://27.17.3.62:20000/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, + "normalize-url": { + "version": "6.1.0", + "resolved": "http://27.17.3.62:20000/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "nth-check": { + "version": "2.1.1", + "resolved": "http://27.17.3.62:20000/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "requires": { + "boolbase": "^1.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "http://27.17.3.62:20000/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-inspect": { + "version": "1.12.2", + "resolved": "http://27.17.3.62:20000/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.values": { + "version": "1.1.5", + "resolved": "http://27.17.3.62:20000/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + } + }, + "obuf": { + "version": "1.1.2", + "resolved": "http://27.17.3.62:20000/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "omit.js": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/omit.js/-/omit.js-1.0.2.tgz", + "integrity": "sha512-/QPc6G2NS+8d4L/cQhbk6Yit1WTB6Us2g84A7A/1+w9d/eRGHyEqC5kkQtHVoHZ5NFWGG7tUGgrhVZwgZanKrQ==", + "requires": { + "babel-runtime": "^6.23.0" + } + }, + "on-finished": { + "version": "2.4.1", + "resolved": "http://27.17.3.62:20000/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "http://27.17.3.62:20000/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "http://27.17.3.62:20000/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "open": { + "version": "8.4.0", + "resolved": "http://27.17.3.62:20000/open/-/open-8.4.0.tgz", + "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", + "dev": true, + "requires": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + } + }, + "opener": { + "version": "1.5.2", + "resolved": "http://27.17.3.62:20000/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true + }, + "optionator": { + "version": "0.9.1", + "resolved": "http://27.17.3.62:20000/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "ora": { + "version": "5.4.1", + "resolved": "http://27.17.3.62:20000/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, + "requires": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.3.0", + "resolved": "http://27.17.3.62:20000/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "http://27.17.3.62:20000/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-retry": { + "version": "4.6.2", + "resolved": "http://27.17.3.62:20000/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "dev": true, + "requires": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "http://27.17.3.62:20000/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "param-case": { + "version": "3.0.4", + "resolved": "http://27.17.3.62:20000/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "dev": true, + "requires": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "http://27.17.3.62:20000/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "parse5": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/parse5/-/parse5-5.1.1.tgz", + "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", + "dev": true + }, + "parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "http://27.17.3.62:20000/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "dev": true, + "requires": { + "parse5": "^6.0.1" + }, + "dependencies": { + "parse5": { + "version": "6.0.1", + "resolved": "http://27.17.3.62:20000/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", + "dev": true + } + } + }, + "parseurl": { + "version": "1.3.3", + "resolved": "http://27.17.3.62:20000/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true + }, + "pascal-case": { + "version": "3.1.2", + "resolved": "http://27.17.3.62:20000/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dev": true, + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "http://27.17.3.62:20000/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "http://27.17.3.62:20000/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "picocolors": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "http://27.17.3.62:20000/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "http://27.17.3.62:20000/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "plugin-component-scrollbar": { + "version": "1.0.12", + "resolved": "http://27.17.3.62:20000/plugin-component-scrollbar/-/plugin-component-scrollbar-1.0.12.tgz", + "integrity": "sha512-o/1Jssd5p3v+RcCuAtRl0VATfVyMM2TECCf0goxCdTvRbn3AThNr0veNxDoeQPc9NHlQDcfuRDzAfUgQ1DWlMA==", + "requires": { + "resize-observer-polyfill": "^1.5.0" + } + }, + "portfinder": { + "version": "1.0.28", + "resolved": "http://27.17.3.62:20000/portfinder/-/portfinder-1.0.28.tgz", + "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", + "dev": true, + "requires": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "http://27.17.3.62:20000/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + } + }, + "postcss": { + "version": "8.4.14", + "resolved": "http://27.17.3.62:20000/postcss/-/postcss-8.4.14.tgz", + "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "dev": true, + "requires": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "postcss-calc": { + "version": "8.2.4", + "resolved": "http://27.17.3.62:20000/postcss-calc/-/postcss-calc-8.2.4.tgz", + "integrity": "sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.9", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-colormin": { + "version": "5.3.0", + "resolved": "http://27.17.3.62:20000/postcss-colormin/-/postcss-colormin-5.3.0.tgz", + "integrity": "sha512-WdDO4gOFG2Z8n4P8TWBpshnL3JpmNmJwdnfP2gbk2qBA8PWwOYcmjmI/t3CmMeL72a7Hkd+x/Mg9O2/0rD54Pg==", + "dev": true, + "requires": { + "browserslist": "^4.16.6", + "caniuse-api": "^3.0.0", + "colord": "^2.9.1", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-convert-values": { + "version": "5.1.2", + "resolved": "http://27.17.3.62:20000/postcss-convert-values/-/postcss-convert-values-5.1.2.tgz", + "integrity": "sha512-c6Hzc4GAv95B7suy4udszX9Zy4ETyMCgFPUDtWjdFTKH1SE9eFY/jEpHSwTH1QPuwxHpWslhckUQWbNRM4ho5g==", + "dev": true, + "requires": { + "browserslist": "^4.20.3", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-discard-comments": { + "version": "5.1.2", + "resolved": "http://27.17.3.62:20000/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", + "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", + "dev": true + }, + "postcss-discard-duplicates": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", + "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", + "dev": true + }, + "postcss-discard-empty": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", + "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", + "dev": true + }, + "postcss-discard-overridden": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", + "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", + "dev": true + }, + "postcss-loader": { + "version": "6.2.1", + "resolved": "http://27.17.3.62:20000/postcss-loader/-/postcss-loader-6.2.1.tgz", + "integrity": "sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==", + "dev": true, + "requires": { + "cosmiconfig": "^7.0.0", + "klona": "^2.0.5", + "semver": "^7.3.5" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "postcss-merge-longhand": { + "version": "5.1.5", + "resolved": "http://27.17.3.62:20000/postcss-merge-longhand/-/postcss-merge-longhand-5.1.5.tgz", + "integrity": "sha512-NOG1grw9wIO+60arKa2YYsrbgvP6tp+jqc7+ZD5/MalIw234ooH2C6KlR6FEn4yle7GqZoBxSK1mLBE9KPur6w==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0", + "stylehacks": "^5.1.0" + } + }, + "postcss-merge-rules": { + "version": "5.1.2", + "resolved": "http://27.17.3.62:20000/postcss-merge-rules/-/postcss-merge-rules-5.1.2.tgz", + "integrity": "sha512-zKMUlnw+zYCWoPN6yhPjtcEdlJaMUZ0WyVcxTAmw3lkkN/NDMRkOkiuctQEoWAOvH7twaxUUdvBWl0d4+hifRQ==", + "dev": true, + "requires": { + "browserslist": "^4.16.6", + "caniuse-api": "^3.0.0", + "cssnano-utils": "^3.1.0", + "postcss-selector-parser": "^6.0.5" + } + }, + "postcss-minify-font-values": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-minify-font-values/-/postcss-minify-font-values-5.1.0.tgz", + "integrity": "sha512-el3mYTgx13ZAPPirSVsHqFzl+BBBDrXvbySvPGFnQcTI4iNslrPaFq4muTkLZmKlGk4gyFAYUBMH30+HurREyA==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-minify-gradients": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/postcss-minify-gradients/-/postcss-minify-gradients-5.1.1.tgz", + "integrity": "sha512-VGvXMTpCEo4qHTNSa9A0a3D+dxGFZCYwR6Jokk+/3oB6flu2/PnPXAh2x7x52EkY5xlIHLm+Le8tJxe/7TNhzw==", + "dev": true, + "requires": { + "colord": "^2.9.1", + "cssnano-utils": "^3.1.0", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-minify-params": { + "version": "5.1.3", + "resolved": "http://27.17.3.62:20000/postcss-minify-params/-/postcss-minify-params-5.1.3.tgz", + "integrity": "sha512-bkzpWcjykkqIujNL+EVEPOlLYi/eZ050oImVtHU7b4lFS82jPnsCb44gvC6pxaNt38Els3jWYDHTjHKf0koTgg==", + "dev": true, + "requires": { + "browserslist": "^4.16.6", + "cssnano-utils": "^3.1.0", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-minify-selectors": { + "version": "5.2.1", + "resolved": "http://27.17.3.62:20000/postcss-minify-selectors/-/postcss-minify-selectors-5.2.1.tgz", + "integrity": "sha512-nPJu7OjZJTsVUmPdm2TcaiohIwxP+v8ha9NehQ2ye9szv4orirRU3SDdtUmKH+10nzn0bAyOXZ0UEr7OpvLehg==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.5" + } + }, + "postcss-modules-extract-imports": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", + "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "dev": true + }, + "postcss-modules-local-by-default": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", + "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "dev": true, + "requires": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.1.0" + } + }, + "postcss-modules-scope": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", + "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.4" + } + }, + "postcss-modules-values": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "requires": { + "icss-utils": "^5.0.0" + } + }, + "postcss-normalize-charset": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", + "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", + "dev": true + }, + "postcss-normalize-display-values": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-display-values/-/postcss-normalize-display-values-5.1.0.tgz", + "integrity": "sha512-WP4KIM4o2dazQXWmFaqMmcvsKmhdINFblgSeRgn8BJ6vxaMyaJkwAzpPpuvSIoG/rmX3M+IrRZEz2H0glrQNEA==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-normalize-positions": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-positions/-/postcss-normalize-positions-5.1.0.tgz", + "integrity": "sha512-8gmItgA4H5xiUxgN/3TVvXRoJxkAWLW6f/KKhdsH03atg0cB8ilXnrB5PpSshwVu/dD2ZsRFQcR1OEmSBDAgcQ==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-normalize-repeat-style": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.1.0.tgz", + "integrity": "sha512-IR3uBjc+7mcWGL6CtniKNQ4Rr5fTxwkaDHwMBDGGs1x9IVRkYIT/M4NelZWkAOBdV6v3Z9S46zqaKGlyzHSchw==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-normalize-string": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-string/-/postcss-normalize-string-5.1.0.tgz", + "integrity": "sha512-oYiIJOf4T9T1N4i+abeIc7Vgm/xPCGih4bZz5Nm0/ARVJ7K6xrDlLwvwqOydvyL3RHNf8qZk6vo3aatiw/go3w==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-normalize-timing-functions": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.1.0.tgz", + "integrity": "sha512-DOEkzJ4SAXv5xkHl0Wa9cZLF3WCBhF3o1SKVxKQAa+0pYKlueTpCgvkFAHfk+Y64ezX9+nITGrDZeVGgITJXjg==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-normalize-unicode": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.0.tgz", + "integrity": "sha512-J6M3MizAAZ2dOdSjy2caayJLQT8E8K9XjLce8AUQMwOrCvjCHv24aLC/Lps1R1ylOfol5VIDMaM/Lo9NGlk1SQ==", + "dev": true, + "requires": { + "browserslist": "^4.16.6", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-normalize-url": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-normalize-url/-/postcss-normalize-url-5.1.0.tgz", + "integrity": "sha512-5upGeDO+PVthOxSmds43ZeMeZfKH+/DKgGRD7TElkkyS46JXAUhMzIKiCa7BabPeIy3AQcTkXwVVN7DbqsiCew==", + "dev": true, + "requires": { + "normalize-url": "^6.0.1", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-normalize-whitespace": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.1.1.tgz", + "integrity": "sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-ordered-values": { + "version": "5.1.2", + "resolved": "http://27.17.3.62:20000/postcss-ordered-values/-/postcss-ordered-values-5.1.2.tgz", + "integrity": "sha512-wr2avRbW4HS2XE2ZCqpfp4N/tDC6GZKZ+SVP8UBTOVS8QWrc4TD8MYrebJrvVVlGPKszmiSCzue43NDiVtgDmg==", + "dev": true, + "requires": { + "cssnano-utils": "^3.1.0", + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-reduce-initial": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-reduce-initial/-/postcss-reduce-initial-5.1.0.tgz", + "integrity": "sha512-5OgTUviz0aeH6MtBjHfbr57tml13PuedK/Ecg8szzd4XRMbYxH4572JFG067z+FqBIf6Zp/d+0581glkvvWMFw==", + "dev": true, + "requires": { + "browserslist": "^4.16.6", + "caniuse-api": "^3.0.0" + } + }, + "postcss-reduce-transforms": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-reduce-transforms/-/postcss-reduce-transforms-5.1.0.tgz", + "integrity": "sha512-2fbdbmgir5AvpW9RLtdONx1QoYG2/EtqpNQbFASDlixBbAYuTcJ0dECwlqNqH7VbaUnEnh8SrxOe2sRIn24XyQ==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0" + } + }, + "postcss-selector-parser": { + "version": "6.0.10", + "resolved": "http://27.17.3.62:20000/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", + "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + } + }, + "postcss-svgo": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/postcss-svgo/-/postcss-svgo-5.1.0.tgz", + "integrity": "sha512-D75KsH1zm5ZrHyxPakAxJWtkyXew5qwS70v56exwvw542d9CRtTo78K0WeFxZB4G7JXKKMbEZtZayTGdIky/eA==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.2.0", + "svgo": "^2.7.0" + } + }, + "postcss-unique-selectors": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/postcss-unique-selectors/-/postcss-unique-selectors-5.1.1.tgz", + "integrity": "sha512-5JiODlELrz8L2HwxfPnhOWZYWDxVHWL83ufOv84NrcgipI7TaeRsatAhK4Tr2/ZiYldpK/wBvw5BD3qfaK96GA==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.5" + } + }, + "postcss-value-parser": { + "version": "4.2.0", + "resolved": "http://27.17.3.62:20000/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "2.7.1", + "resolved": "http://27.17.3.62:20000/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true, + "optional": true + }, + "pretty-error": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/pretty-error/-/pretty-error-4.0.0.tgz", + "integrity": "sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==", + "dev": true, + "requires": { + "lodash": "^4.17.20", + "renderkid": "^3.0.0" + } + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "http://27.17.3.62:20000/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "progress-webpack-plugin": { + "version": "1.0.16", + "resolved": "http://27.17.3.62:20000/progress-webpack-plugin/-/progress-webpack-plugin-1.0.16.tgz", + "integrity": "sha512-sdiHuuKOzELcBANHfrupYo+r99iPRyOnw15qX+rNlVUqXGfjXdH4IgxriKwG1kNJwVswKQHMdj1hYZMcb9jFaA==", + "dev": true, + "requires": { + "chalk": "^2.1.0", + "figures": "^2.0.0", + "log-update": "^2.3.0" + } + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "proxy-addr": { + "version": "2.0.7", + "resolved": "http://27.17.3.62:20000/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "requires": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "dependencies": { + "ipaddr.js": { + "version": "1.9.1", + "resolved": "http://27.17.3.62:20000/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true + } + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "http://27.17.3.62:20000/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "qs": { + "version": "6.10.3", + "resolved": "http://27.17.3.62:20000/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dev": true, + "requires": { + "side-channel": "^1.0.4" + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "http://27.17.3.62:20000/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "raf": { + "version": "3.4.1", + "resolved": "http://27.17.3.62:20000/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "requires": { + "performance-now": "^2.1.0" + } + }, + "randombytes": { + "version": "2.1.0", + "resolved": "http://27.17.3.62:20000/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true + }, + "raw-body": { + "version": "2.5.1", + "resolved": "http://27.17.3.62:20000/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dev": true, + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dependencies": { + "bytes": { + "version": "3.1.2", + "resolved": "http://27.17.3.62:20000/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true + } + } + }, + "read-pkg": { + "version": "5.2.0", + "resolved": "http://27.17.3.62:20000/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + } + }, + "read-pkg-up": { + "version": "7.0.1", + "resolved": "http://27.17.3.62:20000/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "dependencies": { + "type-fest": { + "version": "0.8.1", + "resolved": "http://27.17.3.62:20000/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "http://27.17.3.62:20000/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "http://27.17.3.62:20000/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "regenerate": { + "version": "1.4.2", + "resolved": "http://27.17.3.62:20000/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "10.0.1", + "resolved": "http://27.17.3.62:20000/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz", + "integrity": "sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw==", + "dev": true, + "requires": { + "regenerate": "^1.4.2" + } + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "http://27.17.3.62:20000/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", + "dev": true + }, + "regenerator-transform": { + "version": "0.15.0", + "resolved": "http://27.17.3.62:20000/regenerator-transform/-/regenerator-transform-0.15.0.tgz", + "integrity": "sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.8.4" + } + }, + "regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "http://27.17.3.62:20000/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "http://27.17.3.62:20000/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "regexpu-core": { + "version": "5.0.1", + "resolved": "http://27.17.3.62:20000/regexpu-core/-/regexpu-core-5.0.1.tgz", + "integrity": "sha512-CriEZlrKK9VJw/xQGJpQM5rY88BtuL8DM+AEwvcThHilbxiTAy8vq4iJnd2tqq8wLmjbGZzP7ZcKFjbGkmEFrw==", + "dev": true, + "requires": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.0.1", + "regjsgen": "^0.6.0", + "regjsparser": "^0.8.2", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" + } + }, + "regjsgen": { + "version": "0.6.0", + "resolved": "http://27.17.3.62:20000/regjsgen/-/regjsgen-0.6.0.tgz", + "integrity": "sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA==", + "dev": true + }, + "regjsparser": { + "version": "0.8.4", + "resolved": "http://27.17.3.62:20000/regjsparser/-/regjsparser-0.8.4.tgz", + "integrity": "sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "http://27.17.3.62:20000/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "relateurl": { + "version": "0.2.7", + "resolved": "http://27.17.3.62:20000/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", + "dev": true + }, + "renderkid": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/renderkid/-/renderkid-3.0.0.tgz", + "integrity": "sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==", + "dev": true, + "requires": { + "css-select": "^4.1.3", + "dom-converter": "^0.2.0", + "htmlparser2": "^6.1.0", + "lodash": "^4.17.21", + "strip-ansi": "^6.0.1" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "http://27.17.3.62:20000/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "requires-port": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "resize-observer-polyfill": { + "version": "1.5.1", + "resolved": "http://27.17.3.62:20000/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" + }, + "resolve": { + "version": "1.22.0", + "resolved": "http://27.17.3.62:20000/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "requires": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "http://27.17.3.62:20000/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "retry": { + "version": "0.13.1", + "resolved": "http://27.17.3.62:20000/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "http://27.17.3.62:20000/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "http://27.17.3.62:20000/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "run-queue": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "http://27.17.3.62:20000/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sass": { + "version": "1.51.0", + "resolved": "http://27.17.3.62:20000/sass/-/sass-1.51.0.tgz", + "integrity": "sha512-haGdpTgywJTvHC2b91GSq+clTKGbtkkZmVAb82jZQN/wTy6qs8DdFm2lhEQbEwrY0QDRgSQ3xDurqM977C3noA==", + "dev": true, + "requires": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + } + }, + "sass-loader": { + "version": "12.6.0", + "resolved": "http://27.17.3.62:20000/sass-loader/-/sass-loader-12.6.0.tgz", + "integrity": "sha512-oLTaH0YCtX4cfnJZxKSLAyglED0naiYfNG1iXfU5w1LNZ+ukoA5DtyDIN5zmKVZwYNJP4KRc5Y3hkWga+7tYfA==", + "dev": true, + "requires": { + "klona": "^2.0.4", + "neo-async": "^2.6.2" + } + }, + "schema-utils": { + "version": "2.7.1", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-2.7.1.tgz", + "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + } + }, + "select-hose": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", + "dev": true + }, + "selfsigned": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/selfsigned/-/selfsigned-2.0.1.tgz", + "integrity": "sha512-LmME957M1zOsUhG+67rAjKfiWFox3SBxE/yymatMZsAx+oMrJ0YQ8AToOnyCm7xbeg2ep37IHLxdu0o2MavQOQ==", + "dev": true, + "requires": { + "node-forge": "^1" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "http://27.17.3.62:20000/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "send": { + "version": "0.18.0", + "resolved": "http://27.17.3.62:20000/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dev": true, + "requires": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "http://27.17.3.62:20000/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "ms": { + "version": "2.1.3", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + } + }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "http://27.17.3.62:20000/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "serve-index": { + "version": "1.9.1", + "resolved": "http://27.17.3.62:20000/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "http://27.17.3.62:20000/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2", + "resolved": "http://27.17.3.62:20000/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://27.17.3.62:20000/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "http://27.17.3.62:20000/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "statuses": { + "version": "1.5.0", + "resolved": "http://27.17.3.62:20000/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true + } + } + }, + "serve-static": { + "version": "1.15.0", + "resolved": "http://27.17.3.62:20000/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dev": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "shallow-equal": { + "version": "1.2.1", + "resolved": "http://27.17.3.62:20000/shallow-equal/-/shallow-equal-1.2.1.tgz", + "integrity": "sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==" + }, + "shallowequal": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/shallowequal/-/shallowequal-1.1.0.tgz", + "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "http://27.17.3.62:20000/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shell-quote": { + "version": "1.7.3", + "resolved": "http://27.17.3.62:20000/shell-quote/-/shell-quote-1.7.3.tgz", + "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==", + "dev": true + }, + "shvl": { + "version": "2.0.3", + "resolved": "http://27.17.3.62:20000/shvl/-/shvl-2.0.3.tgz", + "integrity": "sha512-V7C6S9Hlol6SzOJPnQ7qzOVEWUQImt3BNmmzh40wObhla3XOYMe4gGiYzLrJd5TFa+cI2f9LKIRJTTKZSTbWgw==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "http://27.17.3.62:20000/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "http://27.17.3.62:20000/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "sirv": { + "version": "1.0.19", + "resolved": "http://27.17.3.62:20000/sirv/-/sirv-1.0.19.tgz", + "integrity": "sha512-JuLThK3TnZG1TAKDwNIqNq6QA2afLOCcm+iE8D1Kj3GA40pSPsxQjjJl0J8X3tsR7T+CP1GavpzLwYkgVLWrZQ==", + "dev": true, + "requires": { + "@polka/url": "^1.0.0-next.20", + "mrmime": "^1.0.0", + "totalist": "^1.0.0" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, + "sockjs": { + "version": "0.3.24", + "resolved": "http://27.17.3.62:20000/sockjs/-/sockjs-0.3.24.tgz", + "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", + "dev": true, + "requires": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" + } + }, + "source-list-map": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, + "source-map-support": { + "version": "0.5.21", + "resolved": "http://27.17.3.62:20000/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "http://27.17.3.62:20000/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "http://27.17.3.62:20000/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.11", + "resolved": "http://27.17.3.62:20000/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", + "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", + "dev": true + }, + "spdy": { + "version": "4.0.2", + "resolved": "http://27.17.3.62:20000/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "spdy-transport": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "http://27.17.3.62:20000/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "ssr-window": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/ssr-window/-/ssr-window-2.0.0.tgz", + "integrity": "sha512-NXzN+/HPObKAx191H3zKlYomE5WrVIkoCB5IaSdvKokxTpjBdWfr0RaP+1Z5KOfDT0ZVz+2tdtiBkhsEQ9p+0A==" + }, + "ssri": { + "version": "8.0.1", + "resolved": "http://27.17.3.62:20000/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "dev": true, + "requires": { + "minipass": "^3.1.1" + } + }, + "stable": { + "version": "0.1.8", + "resolved": "http://27.17.3.62:20000/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "dev": true + }, + "stackframe": { + "version": "1.3.4", + "resolved": "http://27.17.3.62:20000/stackframe/-/stackframe-1.3.4.tgz", + "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==", + "dev": true + }, + "statuses": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true + }, + "string-convert": { + "version": "0.2.1", + "resolved": "http://27.17.3.62:20000/string-convert/-/string-convert-0.2.1.tgz", + "integrity": "sha1-aYLMMEn7tM2F+LJFaLnZvznu/5c=" + }, + "string-width": { + "version": "4.2.3", + "resolved": "http://27.17.3.62:20000/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.5", + "resolved": "http://27.17.3.62:20000/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } + }, + "string.prototype.trimstart": { + "version": "1.0.5", + "resolved": "http://27.17.3.62:20000/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "http://27.17.3.62:20000/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "http://27.17.3.62:20000/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "http://27.17.3.62:20000/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "stylehacks": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/stylehacks/-/stylehacks-5.1.0.tgz", + "integrity": "sha512-SzLmvHQTrIWfSgljkQCw2++C9+Ne91d/6Sp92I8c5uHTcy/PgeHamwITIbBW9wnFTY/3ZfSXR9HIL6Ikqmcu6Q==", + "dev": true, + "requires": { + "browserslist": "^4.16.6", + "postcss-selector-parser": "^6.0.4" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "svg-tags": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/svg-tags/-/svg-tags-1.0.0.tgz", + "integrity": "sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=", + "dev": true + }, + "svgo": { + "version": "2.8.0", + "resolved": "http://27.17.3.62:20000/svgo/-/svgo-2.8.0.tgz", + "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", + "dev": true, + "requires": { + "@trysound/sax": "0.2.0", + "commander": "^7.2.0", + "css-select": "^4.1.3", + "css-tree": "^1.1.3", + "csso": "^4.2.0", + "picocolors": "^1.0.0", + "stable": "^0.1.8" + }, + "dependencies": { + "commander": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true + } + } + }, + "swiper": { + "version": "5.4.5", + "resolved": "http://27.17.3.62:20000/swiper/-/swiper-5.4.5.tgz", + "integrity": "sha512-7QjA0XpdOmiMoClfaZ2lYN6ICHcMm72LXiY+NF4fQLFidigameaofvpjEEiTQuw3xm5eksG5hzkaRsjQX57vtA==", + "requires": { + "dom7": "^2.1.5", + "ssr-window": "^2.0.0" + } + }, + "table": { + "version": "6.8.0", + "resolved": "http://27.17.3.62:20000/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "http://27.17.3.62:20000/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, + "tapable": { + "version": "2.2.1", + "resolved": "http://27.17.3.62:20000/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true + }, + "terser": { + "version": "5.14.1", + "resolved": "http://27.17.3.62:20000/terser/-/terser-5.14.1.tgz", + "integrity": "sha512-+ahUAE+iheqBTDxXhTisdA8hgvbEG1hHOQ9xmNjeUJSoi6DU/gMrKNcfZjHkyY6Alnuyc+ikYJaxxfHkT3+WuQ==", + "dev": true, + "requires": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "dependencies": { + "commander": { + "version": "2.20.3", + "resolved": "http://27.17.3.62:20000/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + } + } + }, + "terser-webpack-plugin": { + "version": "5.3.3", + "resolved": "http://27.17.3.62:20000/terser-webpack-plugin/-/terser-webpack-plugin-5.3.3.tgz", + "integrity": "sha512-Fx60G5HNYknNTNQnzQ1VePRuu89ZVYWfjRAeT5rITuCY/1b08s49e5kSQwHDirKZWuoKOBRFS98EUUoZ9kLEwQ==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.7", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0", + "terser": "^5.7.2" + }, + "dependencies": { + "schema-utils": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "http://27.17.3.62:20000/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "thenify": { + "version": "3.3.1", + "resolved": "http://27.17.3.62:20000/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "requires": { + "any-promise": "^1.0.0" + } + }, + "thenify-all": { + "version": "1.6.0", + "resolved": "http://27.17.3.62:20000/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=", + "dev": true, + "requires": { + "thenify": ">= 3.1.0 < 4" + } + }, + "thread-loader": { + "version": "3.0.4", + "resolved": "http://27.17.3.62:20000/thread-loader/-/thread-loader-3.0.4.tgz", + "integrity": "sha512-ByaL2TPb+m6yArpqQUZvP+5S1mZtXsEP7nWKKlAUTm7fCml8kB5s1uI3+eHRP2bk5mVYfRSBI7FFf+tWEyLZwA==", + "dev": true, + "requires": { + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^4.1.0", + "loader-utils": "^2.0.0", + "neo-async": "^2.6.2", + "schema-utils": "^3.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + } + } + }, + "thunky": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", + "dev": true + }, + "tinycolor2": { + "version": "1.6.0", + "resolved": "http://27.17.3.62:20000/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "http://27.17.3.62:20000/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true + }, + "totalist": { + "version": "1.1.0", + "resolved": "http://27.17.3.62:20000/totalist/-/totalist-1.1.0.tgz", + "integrity": "sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==", + "dev": true + }, + "tr46": { + "version": "0.0.3", + "resolved": "http://27.17.3.62:20000/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "tsconfig-paths": { + "version": "3.14.1", + "resolved": "http://27.17.3.62:20000/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "tslib": { + "version": "2.4.0", + "resolved": "http://27.17.3.62:20000/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "http://27.17.3.62:20000/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.6.0", + "resolved": "http://27.17.3.62:20000/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + }, + "type-is": { + "version": "1.6.18", + "resolved": "http://27.17.3.62:20000/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "unbox-primitive": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", + "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", + "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "dev": true + }, + "unique-filename": { + "version": "1.1.1", + "resolved": "http://27.17.3.62:20000/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "resolved": "http://27.17.3.62:20000/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true + }, + "unpipe": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "http://27.17.3.62:20000/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "utila": { + "version": "0.4.0", + "resolved": "http://27.17.3.62:20000/utila/-/utila-0.4.0.tgz", + "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=", + "dev": true + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, + "uuid": { + "version": "8.3.2", + "resolved": "http://27.17.3.62:20000/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "http://27.17.3.62:20000/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "http://27.17.3.62:20000/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "http://27.17.3.62:20000/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "dev": true + }, + "vue": { + "version": "2.6.14", + "resolved": "http://27.17.3.62:20000/vue/-/vue-2.6.14.tgz", + "integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==" + }, + "vue-eslint-parser": { + "version": "8.3.0", + "resolved": "http://27.17.3.62:20000/vue-eslint-parser/-/vue-eslint-parser-8.3.0.tgz", + "integrity": "sha512-dzHGG3+sYwSf6zFBa0Gi9ZDshD7+ad14DGOdTLjruRVgZXe2J+DcZ9iUhyR48z5g1PqRa20yt3Njna/veLJL/g==", + "dev": true, + "requires": { + "debug": "^4.3.2", + "eslint-scope": "^7.0.0", + "eslint-visitor-keys": "^3.1.0", + "espree": "^9.0.0", + "esquery": "^1.4.0", + "lodash": "^4.17.21", + "semver": "^7.3.5" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "http://27.17.3.62:20000/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "http://27.17.3.62:20000/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "http://27.17.3.62:20000/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + }, + "espree": { + "version": "9.3.2", + "resolved": "http://27.17.3.62:20000/espree/-/espree-9.3.2.tgz", + "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "dev": true, + "requires": { + "acorn": "^8.7.1", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "http://27.17.3.62:20000/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "7.3.7", + "resolved": "http://27.17.3.62:20000/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "vue-hot-reload-api": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", + "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", + "dev": true + }, + "vue-loader": { + "version": "17.0.0", + "resolved": "http://27.17.3.62:20000/vue-loader/-/vue-loader-17.0.0.tgz", + "integrity": "sha512-OWSXjrzIvbF2LtOUmxT3HYgwwubbfFelN8PAP9R9dwpIkj48TVioHhWWSx7W7fk+iF5cgg3CBJRxwTdtLU4Ecg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "vue-ref": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/vue-ref/-/vue-ref-2.0.0.tgz", + "integrity": "sha512-uKNKpFOVeWNqS2mrBZqnpLyXJo5Q+vnkex6JvpENvhXHFNBW/SJTP8vJywLuVT3DpxwXcF9N0dyIiZ4/NpTexQ==" + }, + "vue-router": { + "version": "3.5.3", + "resolved": "http://27.17.3.62:20000/vue-router/-/vue-router-3.5.3.tgz", + "integrity": "sha512-FUlILrW3DGitS2h+Xaw8aRNvGTwtuaxrRkNSHWTizOfLUie7wuYwezeZ50iflRn8YPV5kxmU2LQuu3nM/b3Zsg==" + }, + "vue-style-loader": { + "version": "4.1.3", + "resolved": "http://27.17.3.62:20000/vue-style-loader/-/vue-style-loader-4.1.3.tgz", + "integrity": "sha512-sFuh0xfbtpRlKfm39ss/ikqs9AbKCoXZBpHeVZ8Tx650o0k0q/YCM7FRvigtxpACezfq6af+a7JeqVTWvncqDg==", + "dev": true, + "requires": { + "hash-sum": "^1.0.2", + "loader-utils": "^1.0.2" + }, + "dependencies": { + "hash-sum": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/hash-sum/-/hash-sum-1.0.2.tgz", + "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", + "dev": true + }, + "json5": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "http://27.17.3.62:20000/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "vue-template-compiler": { + "version": "2.6.14", + "resolved": "http://27.17.3.62:20000/vue-template-compiler/-/vue-template-compiler-2.6.14.tgz", + "integrity": "sha512-ODQS1SyMbjKoO1JBJZojSw6FE4qnh9rIpUZn2EUT86FKizx9uH5z6uXiIrm4/Nb/gwxTi/o17ZDEGWAXHvtC7g==", + "dev": true, + "requires": { + "de-indent": "^1.0.2", + "he": "^1.1.0" + } + }, + "vue-template-es2015-compiler": { + "version": "1.9.1", + "resolved": "http://27.17.3.62:20000/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz", + "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", + "dev": true + }, + "vuex": { + "version": "3.6.2", + "resolved": "http://27.17.3.62:20000/vuex/-/vuex-3.6.2.tgz", + "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==" + }, + "vuex-persistedstate": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/vuex-persistedstate/-/vuex-persistedstate-3.0.1.tgz", + "integrity": "sha512-2dH77+fIecAXO8GeJEXiYnC++gx48PFGUayB5d7rWrN3fblRCOHQoVnmu/VV9DXbHHJcJth/0W/ofl8vw12j1A==", + "requires": { + "deepmerge": "^4.2.2", + "shvl": "^2.0.0" + }, + "dependencies": { + "deepmerge": { + "version": "4.3.1", + "resolved": "http://27.17.3.62:20000/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" + } + } + }, + "warning": { + "version": "4.0.3", + "resolved": "http://27.17.3.62:20000/warning/-/warning-4.0.3.tgz", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", + "requires": { + "loose-envify": "^1.0.0" + } + }, + "watchpack": { + "version": "2.4.0", + "resolved": "http://27.17.3.62:20000/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dev": true, + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "wbuf": { + "version": "1.7.3", + "resolved": "http://27.17.3.62:20000/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "http://27.17.3.62:20000/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "http://27.17.3.62:20000/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "webpack": { + "version": "5.73.0", + "resolved": "http://27.17.3.62:20000/webpack/-/webpack-5.73.0.tgz", + "integrity": "sha512-svjudQRPPa0YiOYa2lM/Gacw0r6PvxptHj4FuEKQ2kX05ZLkjbVc5MnPs6its5j7IZljnIqSVo/OsY2X0IpHGA==", + "dev": true, + "requires": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^0.0.51", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.4.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.9.3", + "es-module-lexer": "^0.9.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.3.1", + "webpack-sources": "^3.2.3" + }, + "dependencies": { + "eslint-scope": { + "version": "5.1.1", + "resolved": "http://27.17.3.62:20000/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + } + } + }, + "webpack-bundle-analyzer": { + "version": "4.5.0", + "resolved": "http://27.17.3.62:20000/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.5.0.tgz", + "integrity": "sha512-GUMZlM3SKwS8Z+CKeIFx7CVoHn3dXFcUAjT/dcZQQmfSZGvitPfMob2ipjai7ovFFqPvTqkEZ/leL4O0YOdAYQ==", + "dev": true, + "requires": { + "acorn": "^8.0.4", + "acorn-walk": "^8.0.0", + "chalk": "^4.1.0", + "commander": "^7.2.0", + "gzip-size": "^6.0.0", + "lodash": "^4.17.20", + "opener": "^1.5.2", + "sirv": "^1.0.7", + "ws": "^7.3.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "http://27.17.3.62:20000/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "commander": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://27.17.3.62:20000/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "webpack-chain": { + "version": "6.5.1", + "resolved": "http://27.17.3.62:20000/webpack-chain/-/webpack-chain-6.5.1.tgz", + "integrity": "sha512-7doO/SRtLu8q5WM0s7vPKPWX580qhi0/yBHkOxNkv50f6qB76Zy9o2wRTrrPULqYTvQlVHuvbA8v+G5ayuUDsA==", + "dev": true, + "requires": { + "deepmerge": "^1.5.2", + "javascript-stringify": "^2.0.1" + } + }, + "webpack-dev-middleware": { + "version": "5.3.3", + "resolved": "http://27.17.3.62:20000/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", + "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "dev": true, + "requires": { + "colorette": "^2.0.10", + "memfs": "^3.4.3", + "mime-types": "^2.1.31", + "range-parser": "^1.2.1", + "schema-utils": "^4.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "http://27.17.3.62:20000/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "schema-utils": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + } + } + } + }, + "webpack-dev-server": { + "version": "4.9.2", + "resolved": "http://27.17.3.62:20000/webpack-dev-server/-/webpack-dev-server-4.9.2.tgz", + "integrity": "sha512-H95Ns95dP24ZsEzO6G9iT+PNw4Q7ltll1GfJHV4fKphuHWgKFzGHWi4alTlTnpk1SPPk41X+l2RB7rLfIhnB9Q==", + "dev": true, + "requires": { + "@types/bonjour": "^3.5.9", + "@types/connect-history-api-fallback": "^1.3.5", + "@types/express": "^4.17.13", + "@types/serve-index": "^1.9.1", + "@types/serve-static": "^1.13.10", + "@types/sockjs": "^0.3.33", + "@types/ws": "^8.5.1", + "ansi-html-community": "^0.0.8", + "bonjour-service": "^1.0.11", + "chokidar": "^3.5.3", + "colorette": "^2.0.10", + "compression": "^1.7.4", + "connect-history-api-fallback": "^1.6.0", + "default-gateway": "^6.0.3", + "express": "^4.17.3", + "graceful-fs": "^4.2.6", + "html-entities": "^2.3.2", + "http-proxy-middleware": "^2.0.3", + "ipaddr.js": "^2.0.1", + "open": "^8.0.9", + "p-retry": "^4.5.0", + "rimraf": "^3.0.2", + "schema-utils": "^4.0.0", + "selfsigned": "^2.0.1", + "serve-index": "^1.9.1", + "sockjs": "^0.3.24", + "spdy": "^4.0.2", + "webpack-dev-middleware": "^5.3.1", + "ws": "^8.4.2" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "http://27.17.3.62:20000/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "schema-utils": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + } + }, + "ws": { + "version": "8.8.0", + "resolved": "http://27.17.3.62:20000/ws/-/ws-8.8.0.tgz", + "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", + "dev": true + } + } + }, + "webpack-merge": { + "version": "5.8.0", + "resolved": "http://27.17.3.62:20000/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + } + }, + "webpack-sources": { + "version": "3.2.3", + "resolved": "http://27.17.3.62:20000/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true + }, + "webpack-virtual-modules": { + "version": "0.4.3", + "resolved": "http://27.17.3.62:20000/webpack-virtual-modules/-/webpack-virtual-modules-0.4.3.tgz", + "integrity": "sha512-5NUqC2JquIL2pBAAo/VfBP6KuGkHIZQXW/lNKupLPfhViwh8wNsu0BObtl09yuKZszeEUfbXz8xhrHvSG16Nqw==", + "dev": true + }, + "websocket-driver": { + "version": "0.7.4", + "resolved": "http://27.17.3.62:20000/websocket-driver/-/websocket-driver-0.7.4.tgz", + "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "dev": true, + "requires": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.4", + "resolved": "http://27.17.3.62:20000/websocket-extensions/-/websocket-extensions-0.1.4.tgz", + "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "dev": true + }, + "whatwg-fetch": { + "version": "3.6.2", + "resolved": "http://27.17.3.62:20000/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "http://27.17.3.62:20000/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "http://27.17.3.62:20000/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "wildcard": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", + "dev": true + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "http://27.17.3.62:20000/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "http://27.17.3.62:20000/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://27.17.3.62:20000/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "http://27.17.3.62:20000/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://27.17.3.62:20000/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "http://27.17.3.62:20000/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "ws": { + "version": "7.5.8", + "resolved": "http://27.17.3.62:20000/ws/-/ws-7.5.8.tgz", + "integrity": "sha512-ri1Id1WinAX5Jqn9HejiGb8crfRio0Qgu8+MtL36rlTA6RLsMdWt1Az/19A2Qij6uSHUMphEFaTKa4WG+UNHNw==", + "dev": true + }, + "y18n": { + "version": "5.0.8", + "resolved": "http://27.17.3.62:20000/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "http://27.17.3.62:20000/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yaml": { + "version": "1.10.2", + "resolved": "http://27.17.3.62:20000/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "http://27.17.3.62:20000/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "http://27.17.3.62:20000/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true + }, + "yorkie": { + "version": "2.0.0", + "resolved": "http://27.17.3.62:20000/yorkie/-/yorkie-2.0.0.tgz", + "integrity": "sha512-jcKpkthap6x63MB4TxwCyuIGkV0oYP/YRyuQU5UO0Yz/E/ZAu+653/uov+phdmO54n6BcvFRyyt0RRrWdN2mpw==", + "dev": true, + "requires": { + "execa": "^0.8.0", + "is-ci": "^1.0.10", + "normalize-path": "^1.0.0", + "strip-indent": "^2.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "http://27.17.3.62:20000/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "0.8.0", + "resolved": "http://27.17.3.62:20000/execa/-/execa-0.8.0.tgz", + "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "http://27.17.3.62:20000/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "http://27.17.3.62:20000/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "normalize-path": { + "version": "1.0.0", + "resolved": "http://27.17.3.62:20000/normalize-path/-/normalize-path-1.0.0.tgz", + "integrity": "sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "http://27.17.3.62:20000/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + } + } +} diff --git a/web-pages/package.json b/web-pages/package.json new file mode 100644 index 0000000..70a21a1 --- /dev/null +++ b/web-pages/package.json @@ -0,0 +1,44 @@ +{ + "name": "template-vue", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "vue-cli-service serve --env VUE_APP_frontendConfigUrl=/template-vue/frontend-config-dev.json", + "devmock": "vue-cli-service serve --env VUE_APP_frontendConfigUrl=/template-vue/frontend-config-devmock.json --env VUE_APP_env=devmock", + "example": "vue-cli-service build --env VUE_APP_frontendConfigUrl=/template-vue/frontend-config-dev.json --env NODE_ENV=production" + }, + "dependencies": { + "ant-design-vue": "1.7.5", + "@liveqing/liveplayer": "2.7.10", + "axios": "0.19.2", + "core-js": "3.22.5", + "mockjs": "1.1.0", + "vue": "2.6.14", + "vue-router": "3.5.3", + "vuex": "3.6.2", + "swiper": "5.4.5", + "vuex-persistedstate": "3.0.1" + }, + "devDependencies": { + "@babel/core": "7.17.10", + "@babel/eslint-parser": "7.17.0", + "@vue/cli-plugin-babel": "5.0.4", + "@vue/cli-plugin-eslint": "5.0.4", + "@vue/cli-plugin-router": "5.0.4", + "@vue/cli-plugin-vuex": "5.0.4", + "@vue/cli-service": "5.0.4", + "@vue/eslint-config-standard": "6.1.0", + "babel-plugin-component": "1.1.1", + "babel-plugin-import": "1.12.2", + "compression-webpack-plugin": "3.1.0", + "css-unicode-loader": "1.0.3", + "eslint": "7.32.0", + "eslint-plugin-import": "2.26.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-vue": "8.7.1", + "sass": "1.51.0", + "sass-loader": "12.6.0", + "vue-template-compiler": "2.6.14" + } +} diff --git a/web-pages/public/decoder.js b/web-pages/public/decoder.js new file mode 100644 index 0000000..31d0d6e --- /dev/null +++ b/web-pages/public/decoder.js @@ -0,0 +1 @@ +!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(require("path"),require("fs"),require("crypto")):"function"==typeof define&&define.amd?define(["path","fs","crypto"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).path,e.fs,e.crypto$1)}(this,(function(e,r,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),i=n(r),a=n(t);function s(e,r){return e(r={exports:{}},r.exports),r.exports}var l=s((function(e){var r=void 0!==r?r:{},t=(r={print:function(e){console.log("Jessibuca: [worker]:",e)},printErr:function(e){console.warn("Jessibuca: [worker]:",e),postMessage({cmd:"wasmError",message:e})}},Object.assign({},r)),n="./this.program",s="object"==typeof window,l="function"==typeof importScripts,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,c=!s&&!u&&!l;if(r.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var d,f,p,m,h,g,v="";if(u){if("object"!=typeof process)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");v=l?o.default.dirname(v)+"/":__dirname+"/",g=()=>{h||(m=i.default,h=o.default)},d=function(e,r){return g(),e=h.normalize(e),m.readFileSync(e,r?void 0:"utf8")},p=e=>{var r=d(e,!0);return r.buffer||(r=new Uint8Array(r)),F(r.buffer),r},f=(e,r,t)=>{g(),e=h.normalize(e),m.readFile(e,(function(e,n){e?t(e):r(n.buffer)}))},process.argv.length>1&&(n=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),e.exports=r,process.on("uncaughtException",(function(e){if(!(e instanceof St))throw e})),process.on("unhandledRejection",(function(e){throw e})),r.inspect=function(){return"[Emscripten Module object]"}}else if(c){if("object"==typeof process||"object"==typeof window||"function"==typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");"undefined"!=typeof read&&(d=function(e){return read(e)}),p=function(e){let r;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(r=read(e,"binary"),F("object"==typeof r),r)},f=function(e,r,t){setTimeout((()=>r(p(e))),0)},"undefined"!=typeof scriptArgs&&scriptArgs,"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)}else{if(!s&&!l)throw new Error("environment detection error");if(l?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),v=0!==v.indexOf("blob:")?v.substr(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1):"","object"!=typeof window&&"function"!=typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");d=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},l&&(p=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),f=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)}}var y,E,w,b=r.print||console.log.bind(console),_=r.printErr||console.warn.bind(console);function T(e){T.shown||(T.shown={}),T.shown[e]||(T.shown[e]=1,_(e))}function k(e,t){Object.getOwnPropertyDescriptor(r,e)||Object.defineProperty(r,e,{configurable:!0,get:function(){ge("Module."+e+" has been replaced with plain "+t+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}function S(e,r){var t="'"+e+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";return r&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),t}function C(e,t){Object.getOwnPropertyDescriptor(r,e)||Object.defineProperty(r,e,{configurable:!0,get:function(){ge(S(e,t))}})}function P(e,t){Object.getOwnPropertyDescriptor(r,e)||(r[e]=()=>ge(S(e,t)))}Object.assign(r,t),t=null,y="fetchSettings",Object.getOwnPropertyDescriptor(r,y)&&ge("`Module."+y+"` was supplied but `"+y+"` not included in INCOMING_MODULE_JS_API"),r.arguments,k("arguments","arguments_"),r.thisProgram&&(n=r.thisProgram),k("thisProgram","thisProgram"),r.quit,k("quit","quit_"),F(void 0===r.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),F(void 0===r.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),F(void 0===r.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),F(void 0===r.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),F(void 0===r.read,"Module.read option was removed (modify read_ in JS)"),F(void 0===r.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),F(void 0===r.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),F(void 0===r.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),F(void 0===r.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),k("read","read_"),k("readAsync","readAsync"),k("readBinary","readBinary"),k("setWindowTitle","setWindowTitle"),F(!c,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable."),r.wasmBinary&&(E=r.wasmBinary),k("wasmBinary","wasmBinary"),r.noExitRuntime,k("noExitRuntime","noExitRuntime"),"object"!=typeof WebAssembly&&ge("no native wasm support detected");var A=!1;function F(e,r){e||ge("Assertion failed"+(r?": "+r:""))}var D="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function O(e,r,t){for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&D)return D.decode(e.subarray(r,o));for(var i="";r>10,56320|1023&u)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i}function R(e,r){return e?O(U,e,r):""}function M(e,r,t,n){if(!(n>0))return 0;for(var o=t,i=t+n-1,a=0;a=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a);if(s<=127){if(t>=i)break;r[t++]=s}else if(s<=2047){if(t+1>=i)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=i)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=i)break;s>1114111&&T("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function N(e,r,t){return F("number"==typeof t,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),M(e,U,r,t)}function I(e){for(var r=0,t=0;t=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++t)),n<=127?++r:r+=n<=2047?2:n<=65535?3:4}return r}var L,x,U,B,j,$,W,z,H,G="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function V(e,r){F(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&j[n];)++n;if((t=n<<1)-e>32&&G)return G.decode(U.subarray(e,t));for(var i="",a=0;!(a>=r/2);++a){var s=B[e+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i}function Y(e,r,t){if(F(r%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),F("number"==typeof t,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===t&&(t=2147483647),t<2)return 0;for(var n=r,o=(t-=2)<2*e.length?t/2:e.length,i=0;i>1]=a,r+=2}return B[r>>1]=0,r-n}function q(e){return 2*e.length}function X(e,r){F(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var t=0,n="";!(t>=r/4);){var o=$[e+4*t>>2];if(0==o)break;if(++t,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n}function K(e,r,t){if(F(r%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),F("number"==typeof t,"stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===t&&(t=2147483647),t<4)return 0;for(var n=r,o=n+t-4,i=0;i=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i);if($[r>>2]=a,(r+=4)+4>o)break}return $[r>>2]=0,r-n}function J(e){for(var r=0,t=0;t=55296&&n<=57343&&++t,r+=4}return r}function Q(e){var r=I(e)+1,t=gt(r);return t&&M(e,x,t,r),t}function Z(e){L=e,r.HEAP8=x=new Int8Array(e),r.HEAP16=B=new Int16Array(e),r.HEAP32=$=new Int32Array(e),r.HEAPU8=U=new Uint8Array(e),r.HEAPU16=j=new Uint16Array(e),r.HEAPU32=W=new Uint32Array(e),r.HEAPF32=z=new Float32Array(e),r.HEAPF64=H=new Float64Array(e)}var ee=5242880;r.TOTAL_STACK&&F(ee===r.TOTAL_STACK,"the stack size can no longer be determined at runtime");var re,te=r.INITIAL_MEMORY||67108864;function ne(){var e=kt();F(0==(3&e)),$[e>>2]=34821223,$[e+4>>2]=2310721022,$[0]=1668509029}function oe(){if(!A){var e=kt(),r=W[e>>2],t=W[e+4>>2];34821223==r&&2310721022==t||ge("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+t.toString(16)+" 0x"+r.toString(16)),1668509029!==$[0]&&ge("Runtime error: The application has corrupted its heap memory area (address zero)!")}}k("INITIAL_MEMORY","INITIAL_MEMORY"),F(te>=ee,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+te+"! (TOTAL_STACK="+"5242880)"),F("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),F(!r.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),F(67108864==te,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"),function(){var e=new Int16Array(1),r=new Int8Array(e.buffer);if(e[0]=25459,115!==r[0]||99!==r[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"}();var ie=[],ae=[],se=[],le=!1;F(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),F(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),F(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),F(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var ue=0,ce=null,de=null,fe={};function pe(e){for(var r=e;;){if(!fe[e])return e;e=r+Math.random()}}function me(e){ue++,r.monitorRunDependencies&&r.monitorRunDependencies(ue),e?(F(!fe[e]),fe[e]=1,null===ce&&"undefined"!=typeof setInterval&&(ce=setInterval((function(){if(A)return clearInterval(ce),void(ce=null);var e=!1;for(var r in fe)e||(e=!0,_("still waiting on run dependencies:")),_("dependency: "+r);e&&_("(end of list)")}),1e4))):_("warning: run dependency added without ID")}function he(e){if(ue--,r.monitorRunDependencies&&r.monitorRunDependencies(ue),e?(F(fe[e]),delete fe[e]):_("warning: run dependency removed without ID"),0==ue&&(null!==ce&&(clearInterval(ce),ce=null),de)){var t=de;de=null,t()}}function ge(e){throw r.onAbort&&r.onAbort(e),_(e="Aborted("+e+")"),A=!0,new WebAssembly.RuntimeError(e)}var ve,ye,Ee;function we(e){return e.startsWith("data:application/octet-stream;base64,")}function be(e){return e.startsWith("file://")}function _e(e,t){return function(){var n=e,o=t;return t||(o=r.asm),F(le,"native function `"+n+"` called before runtime initialization"),o[e]||F(o[e],"exported native function `"+n+"` not found"),o[e].apply(null,arguments)}}function Te(e){try{if(e==ve&&E)return new Uint8Array(E);if(p)return p(e);throw"both async and sync fetching of the wasm failed"}catch(e){ge(e)}}function ke(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?Ce(n)():Ce(n)(t.arg):n(void 0===t.arg?null:t.arg)}else t(r)}}function Se(e){return e.replace(/\b_Z[\w\d_]+/g,(function(e){var r,t=(r=e,T("warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling"),r);return e===t?e:t+" ["+e+"]"}))}function Ce(e){return re.get(e)}function Pe(){var e=new Error;if(!e.stack){try{throw new Error}catch(r){e=r}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}we(ve="decoder.wasm")||(ve=function(e){return r.locateFile?r.locateFile(e,v):v+e}(ve));var Ae={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=Ae.isAbs(e),t="/"===e.substr(-1);return(e=Ae.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Ae.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:e=>{if("/"===e)return"/";var r=(e=(e=Ae.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments,0);return Ae.normalize(e.join("/"))},join2:(e,r)=>Ae.normalize(e+"/"+r)};var Fe={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:Ie.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Ae.isAbs(n)}return(r?"/":"")+(e=Ae.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=Fe.resolve(e).substr(1),r=Fe.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s0?t.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&null!==(r=readline())&&(r+="\n");if(!r)return null;e.input=pt(r,!0)}return e.input.shift()},put_char:function(e,r){null===r||10===r?(b(O(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(b(O(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,r){null===r||10===r?(_(O(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(_(O(e.output,0)),e.output=[])}}};function Oe(e){e=function(e,r){return F(r,"alignment argument is required"),Math.ceil(e/r)*r}(e,65536);var r=bt(65536,e);return r?(function(e,r){U.fill(0,e,e+r)}(r,e),r):0}var Re={ops_table:null,mount:function(e){return Re.createNode(null,"/",16895,0)},createNode:function(e,r,t,n){if(Ie.isBlkdev(t)||Ie.isFIFO(t))throw new Ie.ErrnoError(63);Re.ops_table||(Re.ops_table={dir:{node:{getattr:Re.node_ops.getattr,setattr:Re.node_ops.setattr,lookup:Re.node_ops.lookup,mknod:Re.node_ops.mknod,rename:Re.node_ops.rename,unlink:Re.node_ops.unlink,rmdir:Re.node_ops.rmdir,readdir:Re.node_ops.readdir,symlink:Re.node_ops.symlink},stream:{llseek:Re.stream_ops.llseek}},file:{node:{getattr:Re.node_ops.getattr,setattr:Re.node_ops.setattr},stream:{llseek:Re.stream_ops.llseek,read:Re.stream_ops.read,write:Re.stream_ops.write,allocate:Re.stream_ops.allocate,mmap:Re.stream_ops.mmap,msync:Re.stream_ops.msync}},link:{node:{getattr:Re.node_ops.getattr,setattr:Re.node_ops.setattr,readlink:Re.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Re.node_ops.getattr,setattr:Re.node_ops.setattr},stream:Ie.chrdev_stream_ops}});var o=Ie.createNode(e,r,t,n);return Ie.isDir(o.mode)?(o.node_ops=Re.ops_table.dir.node,o.stream_ops=Re.ops_table.dir.stream,o.contents={}):Ie.isFile(o.mode)?(o.node_ops=Re.ops_table.file.node,o.stream_ops=Re.ops_table.file.stream,o.usedBytes=0,o.contents=null):Ie.isLink(o.mode)?(o.node_ops=Re.ops_table.link.node,o.stream_ops=Re.ops_table.link.stream):Ie.isChrdev(o.mode)&&(o.node_ops=Re.ops_table.chrdev.node,o.stream_ops=Re.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,r){if(e.usedBytes!=r)if(0==r)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr:function(e){var r={};return r.dev=Ie.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,Ie.isDir(e.mode)?r.size=4096:Ie.isFile(e.mode)?r.size=e.usedBytes:Ie.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr:function(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&Re.resizeFileStorage(e,r.size)},lookup:function(e,r){throw Ie.genericErrors[44]},mknod:function(e,r,t,n){return Re.createNode(e,r,t,n)},rename:function(e,r,t){if(Ie.isDir(e.mode)){var n;try{n=Ie.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new Ie.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink:function(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir:function(e,r){var t=Ie.lookupNode(e,r);for(var n in t.contents)throw new Ie.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir:function(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink:function(e,r,t){var n=Re.createNode(e,r,41471,0);return n.link=t,n},readlink:function(e){if(!Ie.isLink(e.mode))throw new Ie.ErrnoError(28);return e.link}},stream_ops:{read:function(e,r,t,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(F(a>=0),a>8&&i.subarray)r.set(i.subarray(o,o+a),t);else for(var s=0;s0||n+t1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=Fe.resolve(Ie.cwd(),e)))return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new Ie.ErrnoError(32);for(var n=Ae.normalizeArray(e.split("/").filter((e=>!!e)),!1),o=Ie.root,i="/",a=0;a40)throw new Ie.ErrnoError(32)}}return{path:i,node:o}},getPath:e=>{for(var r;;){if(Ie.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?t+"/"+r:t+r:t}r=r?e.name+"/"+r:e.name,e=e.parent}},hashName:(e,r)=>{for(var t=0,n=0;n>>0)%Ie.nameTable.length},hashAddNode:e=>{var r=Ie.hashName(e.parent.id,e.name);e.name_next=Ie.nameTable[r],Ie.nameTable[r]=e},hashRemoveNode:e=>{var r=Ie.hashName(e.parent.id,e.name);if(Ie.nameTable[r]===e)Ie.nameTable[r]=e.name_next;else for(var t=Ie.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:(e,r)=>{var t=Ie.mayLookup(e);if(t)throw new Ie.ErrnoError(t,e);for(var n=Ie.hashName(e.id,r),o=Ie.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===r)return o}return Ie.lookup(e,r)},createNode:(e,r,t,n)=>{F("object"==typeof e);var o=new Ie.FSNode(e,r,t,n);return Ie.hashAddNode(o),o},destroyNode:e=>{Ie.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var r=Ie.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:e=>{var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>Ie.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup:e=>{var r=Ie.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:(e,r)=>{try{Ie.lookupNode(e,r);return 20}catch(e){}return Ie.nodePermissions(e,"wx")},mayDelete:(e,r,t)=>{var n;try{n=Ie.lookupNode(e,r)}catch(e){return e.errno}var o=Ie.nodePermissions(e,"wx");if(o)return o;if(t){if(!Ie.isDir(n.mode))return 54;if(Ie.isRoot(n)||Ie.getPath(n)===Ie.cwd())return 10}else if(Ie.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?Ie.isLink(e.mode)?32:Ie.isDir(e.mode)&&("r"!==Ie.flagsToPermissionString(r)||512&r)?31:Ie.nodePermissions(e,Ie.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ie.MAX_OPEN_FDS;for(var t=e;t<=r;t++)if(!Ie.streams[t])return t;throw new Ie.ErrnoError(33)},getStream:e=>Ie.streams[e],createStream:(e,r,t)=>{Ie.FSStream||(Ie.FSStream=function(){this.shared={}},Ie.FSStream.prototype={object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(e){this.shared.flags=e}},position:{get function(){return this.shared.position},set:function(e){this.shared.position=e}}}),e=Object.assign(new Ie.FSStream,e);var n=Ie.nextfd(r,t);return e.fd=n,Ie.streams[n]=e,e},closeStream:e=>{Ie.streams[e]=null},chrdev_stream_ops:{open:e=>{var r=Ie.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new Ie.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice:(e,r)=>{Ie.devices[e]={stream_ops:r}},getDevice:e=>Ie.devices[e],getMounts:e=>{for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:(e,r)=>{"function"==typeof e&&(r=e,e=!1),Ie.syncFSRequests++,Ie.syncFSRequests>1&&_("warning: "+Ie.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var t=Ie.getMounts(Ie.root.mount),n=0;function o(e){return F(Ie.syncFSRequests>0),Ie.syncFSRequests--,r(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((r=>{if(!r.type.syncfs)return i(null);r.type.syncfs(r,e,i)}))},mount:(e,r,t)=>{if("string"==typeof e)throw e;var n,o="/"===t,i=!t;if(o&&Ie.root)throw new Ie.ErrnoError(10);if(!o&&!i){var a=Ie.lookupPath(t,{follow_mount:!1});if(t=a.path,n=a.node,Ie.isMountpoint(n))throw new Ie.ErrnoError(10);if(!Ie.isDir(n.mode))throw new Ie.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},l=e.mount(s);return l.mount=s,s.root=l,o?Ie.root=l:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),l},unmount:e=>{var r=Ie.lookupPath(e,{follow_mount:!1});if(!Ie.isMountpoint(r.node))throw new Ie.ErrnoError(28);var t=r.node,n=t.mounted,o=Ie.getMounts(n);Object.keys(Ie.nameTable).forEach((e=>{for(var r=Ie.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&Ie.destroyNode(r),r=t}})),t.mounted=null;var i=t.mount.mounts.indexOf(n);F(-1!==i),t.mount.mounts.splice(i,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod:(e,r,t)=>{var n=Ie.lookupPath(e,{parent:!0}).node,o=Ae.basename(e);if(!o||"."===o||".."===o)throw new Ie.ErrnoError(28);var i=Ie.mayCreate(n,o);if(i)throw new Ie.ErrnoError(i);if(!n.node_ops.mknod)throw new Ie.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,Ie.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,Ie.mknod(e,r,0)),mkdirTree:(e,r)=>{for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,Ie.mknod(e,r,t)),symlink:(e,r)=>{if(!Fe.resolve(e))throw new Ie.ErrnoError(44);var t=Ie.lookupPath(r,{parent:!0}).node;if(!t)throw new Ie.ErrnoError(44);var n=Ae.basename(r),o=Ie.mayCreate(t,n);if(o)throw new Ie.ErrnoError(o);if(!t.node_ops.symlink)throw new Ie.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename:(e,r)=>{var t,n,o=Ae.dirname(e),i=Ae.dirname(r),a=Ae.basename(e),s=Ae.basename(r);if(t=Ie.lookupPath(e,{parent:!0}).node,n=Ie.lookupPath(r,{parent:!0}).node,!t||!n)throw new Ie.ErrnoError(44);if(t.mount!==n.mount)throw new Ie.ErrnoError(75);var l,u=Ie.lookupNode(t,a),c=Fe.relative(e,i);if("."!==c.charAt(0))throw new Ie.ErrnoError(28);if("."!==(c=Fe.relative(r,o)).charAt(0))throw new Ie.ErrnoError(55);try{l=Ie.lookupNode(n,s)}catch(e){}if(u!==l){var d=Ie.isDir(u.mode),f=Ie.mayDelete(t,a,d);if(f)throw new Ie.ErrnoError(f);if(f=l?Ie.mayDelete(n,s,d):Ie.mayCreate(n,s))throw new Ie.ErrnoError(f);if(!t.node_ops.rename)throw new Ie.ErrnoError(63);if(Ie.isMountpoint(u)||l&&Ie.isMountpoint(l))throw new Ie.ErrnoError(10);if(n!==t&&(f=Ie.nodePermissions(t,"w")))throw new Ie.ErrnoError(f);Ie.hashRemoveNode(u);try{t.node_ops.rename(u,n,s)}catch(e){throw e}finally{Ie.hashAddNode(u)}}},rmdir:e=>{var r=Ie.lookupPath(e,{parent:!0}).node,t=Ae.basename(e),n=Ie.lookupNode(r,t),o=Ie.mayDelete(r,t,!0);if(o)throw new Ie.ErrnoError(o);if(!r.node_ops.rmdir)throw new Ie.ErrnoError(63);if(Ie.isMountpoint(n))throw new Ie.ErrnoError(10);r.node_ops.rmdir(r,t),Ie.destroyNode(n)},readdir:e=>{var r=Ie.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new Ie.ErrnoError(54);return r.node_ops.readdir(r)},unlink:e=>{var r=Ie.lookupPath(e,{parent:!0}).node;if(!r)throw new Ie.ErrnoError(44);var t=Ae.basename(e),n=Ie.lookupNode(r,t),o=Ie.mayDelete(r,t,!1);if(o)throw new Ie.ErrnoError(o);if(!r.node_ops.unlink)throw new Ie.ErrnoError(63);if(Ie.isMountpoint(n))throw new Ie.ErrnoError(10);r.node_ops.unlink(r,t),Ie.destroyNode(n)},readlink:e=>{var r=Ie.lookupPath(e).node;if(!r)throw new Ie.ErrnoError(44);if(!r.node_ops.readlink)throw new Ie.ErrnoError(28);return Fe.resolve(Ie.getPath(r.parent),r.node_ops.readlink(r))},stat:(e,r)=>{var t=Ie.lookupPath(e,{follow:!r}).node;if(!t)throw new Ie.ErrnoError(44);if(!t.node_ops.getattr)throw new Ie.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>Ie.stat(e,!0),chmod:(e,r,t)=>{var n;"string"==typeof e?n=Ie.lookupPath(e,{follow:!t}).node:n=e;if(!n.node_ops.setattr)throw new Ie.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod:(e,r)=>{Ie.chmod(e,r,!0)},fchmod:(e,r)=>{var t=Ie.getStream(e);if(!t)throw new Ie.ErrnoError(8);Ie.chmod(t.node,r)},chown:(e,r,t,n)=>{var o;"string"==typeof e?o=Ie.lookupPath(e,{follow:!n}).node:o=e;if(!o.node_ops.setattr)throw new Ie.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:(e,r,t)=>{Ie.chown(e,r,t,!0)},fchown:(e,r,t)=>{var n=Ie.getStream(e);if(!n)throw new Ie.ErrnoError(8);Ie.chown(n.node,r,t)},truncate:(e,r)=>{if(r<0)throw new Ie.ErrnoError(28);var t;"string"==typeof e?t=Ie.lookupPath(e,{follow:!0}).node:t=e;if(!t.node_ops.setattr)throw new Ie.ErrnoError(63);if(Ie.isDir(t.mode))throw new Ie.ErrnoError(31);if(!Ie.isFile(t.mode))throw new Ie.ErrnoError(28);var n=Ie.nodePermissions(t,"w");if(n)throw new Ie.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate:(e,r)=>{var t=Ie.getStream(e);if(!t)throw new Ie.ErrnoError(8);if(0==(2097155&t.flags))throw new Ie.ErrnoError(28);Ie.truncate(t.node,r)},utime:(e,r,t)=>{var n=Ie.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open:(e,t,n,o,i)=>{if(""===e)throw new Ie.ErrnoError(44);var a;if(n=void 0===n?438:n,n=64&(t="string"==typeof t?Ie.modeStringToFlags(t):t)?4095&n|32768:0,"object"==typeof e)a=e;else{e=Ae.normalize(e);try{a=Ie.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(a){if(128&t)throw new Ie.ErrnoError(20)}else a=Ie.mknod(e,n,0),s=!0;if(!a)throw new Ie.ErrnoError(44);if(Ie.isChrdev(a.mode)&&(t&=-513),65536&t&&!Ie.isDir(a.mode))throw new Ie.ErrnoError(54);if(!s){var l=Ie.mayOpen(a,t);if(l)throw new Ie.ErrnoError(l)}512&t&&Ie.truncate(a,0),t&=-131713;var u=Ie.createStream({node:a,path:Ie.getPath(a),flags:t,seekable:!0,position:0,stream_ops:a.stream_ops,ungotten:[],error:!1},o,i);return u.stream_ops.open&&u.stream_ops.open(u),!r.logReadFiles||1&t||(Ie.readFiles||(Ie.readFiles={}),e in Ie.readFiles||(Ie.readFiles[e]=1)),u},close:e=>{if(Ie.isClosed(e))throw new Ie.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Ie.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,r,t)=>{if(Ie.isClosed(e))throw new Ie.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Ie.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new Ie.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read:(e,r,t,n,o)=>{if(n<0||o<0)throw new Ie.ErrnoError(28);if(Ie.isClosed(e))throw new Ie.ErrnoError(8);if(1==(2097155&e.flags))throw new Ie.ErrnoError(8);if(Ie.isDir(e.node.mode))throw new Ie.ErrnoError(31);if(!e.stream_ops.read)throw new Ie.ErrnoError(28);var i=void 0!==o;if(i){if(!e.seekable)throw new Ie.ErrnoError(70)}else o=e.position;var a=e.stream_ops.read(e,r,t,n,o);return i||(e.position+=a),a},write:(e,r,t,n,o,i)=>{if(n<0||o<0)throw new Ie.ErrnoError(28);if(Ie.isClosed(e))throw new Ie.ErrnoError(8);if(0==(2097155&e.flags))throw new Ie.ErrnoError(8);if(Ie.isDir(e.node.mode))throw new Ie.ErrnoError(31);if(!e.stream_ops.write)throw new Ie.ErrnoError(28);e.seekable&&1024&e.flags&&Ie.llseek(e,0,2);var a=void 0!==o;if(a){if(!e.seekable)throw new Ie.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,i);return a||(e.position+=s),s},allocate:(e,r,t)=>{if(Ie.isClosed(e))throw new Ie.ErrnoError(8);if(r<0||t<=0)throw new Ie.ErrnoError(28);if(0==(2097155&e.flags))throw new Ie.ErrnoError(8);if(!Ie.isFile(e.node.mode)&&!Ie.isDir(e.node.mode))throw new Ie.ErrnoError(43);if(!e.stream_ops.allocate)throw new Ie.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap:(e,r,t,n,o,i)=>{if(0!=(2&o)&&0==(2&i)&&2!=(2097155&e.flags))throw new Ie.ErrnoError(2);if(1==(2097155&e.flags))throw new Ie.ErrnoError(2);if(!e.stream_ops.mmap)throw new Ie.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o,i)},msync:(e,r,t,n,o)=>e&&e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,munmap:e=>0,ioctl:(e,r,t)=>{if(!e.stream_ops.ioctl)throw new Ie.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error('Invalid encoding type "'+r.encoding+'"');var t,n=Ie.open(e,r.flags),o=Ie.stat(e),i=o.size,a=new Uint8Array(i);return Ie.read(n,a,0,i,0),"utf8"===r.encoding?t=O(a,0):"binary"===r.encoding&&(t=a),Ie.close(n),t},writeFile:function(e,r){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.flags=t.flags||577;var n=Ie.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(I(r)+1),i=M(r,o,0,o.length);Ie.write(n,o,0,i,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");Ie.write(n,r,0,r.byteLength,void 0,t.canOwn)}Ie.close(n)},cwd:()=>Ie.currentPath,chdir:e=>{var r=Ie.lookupPath(e,{follow:!0});if(null===r.node)throw new Ie.ErrnoError(44);if(!Ie.isDir(r.node.mode))throw new Ie.ErrnoError(54);var t=Ie.nodePermissions(r.node,"x");if(t)throw new Ie.ErrnoError(t);Ie.currentPath=r.path},createDefaultDirectories:()=>{Ie.mkdir("/tmp"),Ie.mkdir("/home"),Ie.mkdir("/home/web_user")},createDefaultDevices:()=>{Ie.mkdir("/dev"),Ie.registerDevice(Ie.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),Ie.mkdev("/dev/null",Ie.makedev(1,3)),De.register(Ie.makedev(5,0),De.default_tty_ops),De.register(Ie.makedev(6,0),De.default_tty1_ops),Ie.mkdev("/dev/tty",Ie.makedev(5,0)),Ie.mkdev("/dev/tty1",Ie.makedev(6,0));var e=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return function(){return crypto.getRandomValues(e),e[0]}}if(u)try{var r=a.default;return function(){return r.randomBytes(1)[0]}}catch(e){}return function(){ge("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")}}();Ie.createDevice("/dev","random",e),Ie.createDevice("/dev","urandom",e),Ie.mkdir("/dev/shm"),Ie.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{Ie.mkdir("/proc");var e=Ie.mkdir("/proc/self");Ie.mkdir("/proc/self/fd"),Ie.mount({mount:()=>{var r=Ie.createNode(e,"fd",16895,73);return r.node_ops={lookup:(e,r)=>{var t=+r,n=Ie.getStream(t);if(!n)throw new Ie.ErrnoError(8);var o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams:()=>{r.stdin?Ie.createDevice("/dev","stdin",r.stdin):Ie.symlink("/dev/tty","/dev/stdin"),r.stdout?Ie.createDevice("/dev","stdout",null,r.stdout):Ie.symlink("/dev/tty","/dev/stdout"),r.stderr?Ie.createDevice("/dev","stderr",null,r.stderr):Ie.symlink("/dev/tty1","/dev/stderr");var e=Ie.open("/dev/stdin",0),t=Ie.open("/dev/stdout",1),n=Ie.open("/dev/stderr",1);F(0===e.fd,"invalid handle for stdin ("+e.fd+")"),F(1===t.fd,"invalid handle for stdout ("+t.fd+")"),F(2===n.fd,"invalid handle for stderr ("+n.fd+")")},ensureErrnoError:()=>{Ie.ErrnoError||(Ie.ErrnoError=function(e,r){this.node=r,this.setErrno=function(e){for(var r in this.errno=e,Ne)if(Ne[r]===e){this.code=r;break}},this.setErrno(e),this.message=Me[e],this.stack&&(Object.defineProperty(this,"stack",{value:(new Error).stack,writable:!0}),this.stack=Se(this.stack))},Ie.ErrnoError.prototype=new Error,Ie.ErrnoError.prototype.constructor=Ie.ErrnoError,[44].forEach((e=>{Ie.genericErrors[e]=new Ie.ErrnoError(e),Ie.genericErrors[e].stack=""})))},staticInit:()=>{Ie.ensureErrnoError(),Ie.nameTable=new Array(4096),Ie.mount(Re,{},"/"),Ie.createDefaultDirectories(),Ie.createDefaultDevices(),Ie.createSpecialDirectories(),Ie.filesystems={MEMFS:Re}},init:(e,t,n)=>{F(!Ie.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),Ie.init.initialized=!0,Ie.ensureErrnoError(),r.stdin=e||r.stdin,r.stdout=t||r.stdout,r.stderr=n||r.stderr,Ie.createStandardStreams()},quit:()=>{Ie.init.initialized=!1,wt();for(var e=0;e{var t=0;return e&&(t|=365),r&&(t|=146),t},findObject:(e,r)=>{var t=Ie.analyzePath(e,r);return t.exists?t.object:null},analyzePath:(e,r)=>{try{e=(n=Ie.lookupPath(e,{follow:!r})).path}catch(e){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Ie.lookupPath(e,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=Ae.basename(e),n=Ie.lookupPath(e,{follow:!r}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(e){t.error=e.errno}return t},createPath:(e,r,t,n)=>{e="string"==typeof e?e:Ie.getPath(e);for(var o=r.split("/").reverse();o.length;){var i=o.pop();if(i){var a=Ae.join2(e,i);try{Ie.mkdir(a)}catch(e){}e=a}}return a},createFile:(e,r,t,n,o)=>{var i=Ae.join2("string"==typeof e?e:Ie.getPath(e),r),a=Ie.getMode(n,o);return Ie.create(i,a)},createDataFile:(e,r,t,n,o,i)=>{var a=r;e&&(e="string"==typeof e?e:Ie.getPath(e),a=r?Ae.join2(e,r):e);var s=Ie.getMode(n,o),l=Ie.create(a,s);if(t){if("string"==typeof t){for(var u=new Array(t.length),c=0,d=t.length;c{var o=Ae.join2("string"==typeof e?e:Ie.getPath(e),r),i=Ie.getMode(!!t,!!n);Ie.createDevice.major||(Ie.createDevice.major=64);var a=Ie.makedev(Ie.createDevice.major++,0);return Ie.registerDevice(a,{open:e=>{e.seekable=!1},close:e=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(e,r,n,o,i)=>{for(var a=0,s=0;s{for(var a=0;a{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!d)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=pt(d(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new Ie.ErrnoError(29)}},createLazyFile:(e,r,t,n,o)=>{function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(e){if(!(e>this.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},i.prototype.setDataGetter=function(e){this.getter=e},i.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,i=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,a=1048576;o||(a=n);var s=this;s.setDataGetter((e=>{var r=e*a,o=(e+1)*a-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,r)=>{if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==a&&o.setRequestHeader("Range","bytes="+e+"-"+r),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):pt(o.responseText||"",!0)})(r,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!l)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:t};var u=Ie.createFile(e,r,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};return Object.keys(u.stream_ops).forEach((e=>{var r=u.stream_ops[e];c[e]=function(){return Ie.forceLoadFile(u),r.apply(null,arguments)}})),c.read=(e,r,t,n,o)=>{Ie.forceLoadFile(u);var i=e.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(F(a>=0),i.slice)for(var s=0;s{var c=r?Fe.resolve(Ae.join2(e,r)):e,d=pe("cp "+c);function p(t){function f(t){u&&u(),s||Ie.createDataFile(e,r,t,n,o,l),i&&i(),he(d)}Browser.handledByPreloadPlugin(t,c,f,(()=>{a&&a(),he(d)}))||f(t)}me(d),"string"==typeof t?function(e,r,t,n){var o=n?"":pe("al "+e);f(e,(function(t){F(t,'Loading data file "'+e+'" failed (no arrayBuffer).'),r(new Uint8Array(t)),o&&he(o)}),(function(r){if(!t)throw'Loading data file "'+e+'" failed.';t()})),o&&me(o)}(t,(e=>p(e)),a):p(t)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,r,t)=>{r=r||(()=>{}),t=t||(()=>{});var n=Ie.indexedDB();try{var o=n.open(Ie.DB_NAME(),Ie.DB_VERSION)}catch(e){return t(e)}o.onupgradeneeded=()=>{b("creating db"),o.result.createObjectStore(Ie.DB_STORE_NAME)},o.onsuccess=()=>{var n=o.result.transaction([Ie.DB_STORE_NAME],"readwrite"),i=n.objectStore(Ie.DB_STORE_NAME),a=0,s=0,l=e.length;function u(){0==s?r():t()}e.forEach((e=>{var r=i.put(Ie.analyzePath(e).object.contents,e);r.onsuccess=()=>{++a+s==l&&u()},r.onerror=()=>{s++,a+s==l&&u()}})),n.onerror=t},o.onerror=t},loadFilesFromDB:(e,r,t)=>{r=r||(()=>{}),t=t||(()=>{});var n=Ie.indexedDB();try{var o=n.open(Ie.DB_NAME(),Ie.DB_VERSION)}catch(e){return t(e)}o.onupgradeneeded=t,o.onsuccess=()=>{var n=o.result;try{var i=n.transaction([Ie.DB_STORE_NAME],"readonly")}catch(e){return void t(e)}var a=i.objectStore(Ie.DB_STORE_NAME),s=0,l=0,u=e.length;function c(){0==l?r():t()}e.forEach((e=>{var r=a.get(e);r.onsuccess=()=>{Ie.analyzePath(e).exists&&Ie.unlink(e),Ie.createDataFile(Ae.dirname(e),Ae.basename(e),r.result,!0,!0,!0),++s+l==u&&c()},r.onerror=()=>{l++,s+l==u&&c()}})),i.onerror=t},o.onerror=t},absolutePath:()=>{ge("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder:()=>{ge("FS.createFolder has been removed; use FS.mkdir instead")},createLink:()=>{ge("FS.createLink has been removed; use FS.symlink instead")},joinPath:()=>{ge("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc:()=>{ge("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath:()=>{ge("FS.standardizePath has been removed; use PATH.normalize instead")}},Le={DEFAULT_POLLMASK:5,calculateAt:function(e,r,t){if(Ae.isAbs(r))return r;var n;if(-100===e)n=Ie.cwd();else{var o=Ie.getStream(e);if(!o)throw new Ie.ErrnoError(8);n=o.path}if(0==r.length){if(!t)throw new Ie.ErrnoError(44);return n}return Ae.join2(n,r)},doStat:function(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Ae.normalize(r)!==Ae.normalize(Ie.getPath(e.node)))return-54;throw e}return $[t>>2]=n.dev,$[t+4>>2]=0,$[t+8>>2]=n.ino,$[t+12>>2]=n.mode,$[t+16>>2]=n.nlink,$[t+20>>2]=n.uid,$[t+24>>2]=n.gid,$[t+28>>2]=n.rdev,$[t+32>>2]=0,Ee=[n.size>>>0,(ye=n.size,+Math.abs(ye)>=1?ye>0?(0|Math.min(+Math.floor(ye/4294967296),4294967295))>>>0:~~+Math.ceil((ye-+(~~ye>>>0))/4294967296)>>>0:0)],$[t+40>>2]=Ee[0],$[t+44>>2]=Ee[1],$[t+48>>2]=4096,$[t+52>>2]=n.blocks,$[t+56>>2]=n.atime.getTime()/1e3|0,$[t+60>>2]=0,$[t+64>>2]=n.mtime.getTime()/1e3|0,$[t+68>>2]=0,$[t+72>>2]=n.ctime.getTime()/1e3|0,$[t+76>>2]=0,Ee=[n.ino>>>0,(ye=n.ino,+Math.abs(ye)>=1?ye>0?(0|Math.min(+Math.floor(ye/4294967296),4294967295))>>>0:~~+Math.ceil((ye-+(~~ye>>>0))/4294967296)>>>0:0)],$[t+80>>2]=Ee[0],$[t+84>>2]=Ee[1],0},doMsync:function(e,r,t,n,o){var i=U.slice(e,e+t);Ie.msync(r,i,o,t,n)},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return Ie.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-28;var n=Ie.readlink(e),o=Math.min(t,I(n)),i=x[r+o];return N(n,r,t+1),x[r+o]=i,o},doAccess:function(e,r){if(-8&r)return-28;var t=Ie.lookupPath(e,{follow:!0}).node;if(!t)return-44;var n="";return 4&r&&(n+="r"),2&r&&(n+="w"),1&r&&(n+="x"),n&&Ie.nodePermissions(t,n)?-2:0},doReadv:function(e,r,t,n){for(var o=0,i=0;i>2],s=$[r+4>>2];r+=8;var l=Ie.read(e,x,a,s,n);if(l<0)return-1;if(o+=l,l>2],s=$[r+4>>2];r+=8;var l=Ie.write(e,x,a,s,n);if(l<0)return-1;o+=l}return o},varargs:void 0,get:function(){return F(null!=Le.varargs),Le.varargs+=4,$[Le.varargs-4>>2]},getStr:function(e){return R(e)},getStreamFromFD:function(e){var r=Ie.getStream(e);if(!r)throw new Ie.ErrnoError(8);return r}};function xe(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var Ue=void 0;function Be(e){for(var r="",t=e;U[t];)r+=Ue[U[t++]];return r}var je={},$e={},We={};function ze(e){if(void 0===e)return"_unknown";var r=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=48&&r<=57?"_"+e:e}function He(e,r){return e=ze(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(r)}function Ge(e,r){var t=He(r,(function(e){this.name=r,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}));return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},t}var Ve=void 0;function Ye(e){throw new Ve(e)}var qe=void 0;function Xe(e){throw new qe(e)}function Ke(e,r,t){function n(r){var n=t(r);n.length!==e.length&&Xe("Mismatched type converter count");for(var o=0;o{$e.hasOwnProperty(e)?o[r]=$e[e]:(i.push(e),je.hasOwnProperty(e)||(je[e]=[]),je[e].push((()=>{o[r]=$e[e],++a===i.length&&n(o)})))})),0===i.length&&n(o)}function Je(e,r){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=r.name;if(e||Ye('type "'+n+'" must have a positive integer typeid pointer'),$e.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;Ye("Cannot register type '"+n+"' twice")}if($e[e]=r,delete We[e],je.hasOwnProperty(e)){var o=je[e];delete je[e],o.forEach((e=>e()))}}function Qe(e){if(!(this instanceof wr))return!1;if(!(e instanceof wr))return!1;for(var r=this.$$.ptrType.registeredClass,t=this.$$.ptr,n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o}function Ze(e){Ye(e.$$.ptrType.registeredClass.name+" instance already deleted")}var er=!1;function rr(e){}function tr(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function nr(e,r,t){if(r===t)return e;if(void 0===t.baseClass)return null;var n=nr(e,r,t.baseClass);return null===n?null:t.downcast(n)}var or={};function ir(){return Object.keys(dr).length}function ar(){var e=[];for(var r in dr)dr.hasOwnProperty(r)&&e.push(dr[r]);return e}var sr=[];function lr(){for(;sr.length;){var e=sr.pop();e.$$.deleteScheduled=!1,e.delete()}}var ur=void 0;function cr(e){ur=e,sr.length&&ur&&ur(lr)}var dr={};function fr(e,r){return r=function(e,r){for(void 0===r&&Ye("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r}(e,r),dr[r]}function pr(e,r){return r.ptrType&&r.ptr||Xe("makeClassHandle requires ptr and ptrType"),!!r.smartPtrType!==!!r.smartPtr&&Xe("Both smartPtrType and smartPtr must be specified"),r.count={value:1},hr(Object.create(e,{$$:{value:r}}))}function mr(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=fr(this.registeredClass,r);if(void 0!==t){if(0===t.$$.count.value)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?pr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):pr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,a=this.registeredClass.getActualType(r),s=or[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var l=nr(r,this.registeredClass,i.registeredClass);return null===l?o.call(this):this.isSmartPointer?pr(i.registeredClass.instancePrototype,{ptrType:i,ptr:l,smartPtrType:this,smartPtr:e}):pr(i.registeredClass.instancePrototype,{ptrType:i,ptr:l})}function hr(e){return"undefined"==typeof FinalizationRegistry?(hr=e=>e,e):(er=new FinalizationRegistry((e=>{console.warn(e.leakWarning.stack.replace(/^Error: /,"")),tr(e.$$)})),hr=e=>{var r=e.$$;if(!!r.smartPtr){var t={$$:r},n=r.ptrType.registeredClass;t.leakWarning=new Error("Embind found a leaked C++ instance "+n.name+" <0x"+r.ptr.toString(16)+">.\nWe'll free it automatically in this case, but this functionality is not reliable across various environments.\nMake sure to invoke .delete() manually once you're done with the instance instead.\nOriginally allocated"),"captureStackTrace"in Error&&Error.captureStackTrace(t.leakWarning,mr),er.register(e,t,e)}return e},rr=e=>er.unregister(e),hr(e))}function gr(){if(this.$$.ptr||Ze(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,r=hr(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return r.$$.count.value+=1,r.$$.deleteScheduled=!1,r}function vr(){this.$$.ptr||Ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ye("Object already scheduled for deletion"),rr(this),tr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function yr(){return!this.$$.ptr}function Er(){return this.$$.ptr||Ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ye("Object already scheduled for deletion"),sr.push(this),1===sr.length&&ur&&ur(lr),this.$$.deleteScheduled=!0,this}function wr(){}function br(e,r,t){if(void 0===e[r].overloadTable){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||Ye("Function '"+t+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[r].overloadTable+")!"),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}}function _r(e,r,t,n,o,i,a,s){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function Tr(e,r,t){for(;r!==t;)r.upcast||Ye("Expected null or instance of "+t.name+", got an instance of "+r.name),e=r.upcast(e),r=r.baseClass;return e}function kr(e,r){if(null===r)return this.isReference&&Ye("null is not a valid "+this.name),0;r.$$||Ye('Cannot pass "'+qr(r)+'" as a '+this.name),r.$$.ptr||Ye("Cannot pass deleted object as a pointer of type "+this.name);var t=r.$$.ptrType.registeredClass;return Tr(r.$$.ptr,t,this.registeredClass)}function Sr(e,r){var t;if(null===r)return this.isReference&&Ye("null is not a valid "+this.name),this.isSmartPointer?(t=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,t),t):0;r.$$||Ye('Cannot pass "'+qr(r)+'" as a '+this.name),r.$$.ptr||Ye("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&r.$$.ptrType.isConst&&Ye("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);var n=r.$$.ptrType.registeredClass;if(t=Tr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===r.$$.smartPtr&&Ye("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:Ye("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,Yr.toHandle((function(){o.delete()}))),null!==e&&e.push(this.rawDestructor,t)}break;default:Ye("Unsupporting sharing policy")}return t}function Cr(e,r){if(null===r)return this.isReference&&Ye("null is not a valid "+this.name),0;r.$$||Ye('Cannot pass "'+qr(r)+'" as a '+this.name),r.$$.ptr||Ye("Cannot pass deleted object as a pointer of type "+this.name),r.$$.ptrType.isConst&&Ye("Cannot convert argument of type "+r.$$.ptrType.name+" to parameter type "+this.name);var t=r.$$.ptrType.registeredClass;return Tr(r.$$.ptr,t,this.registeredClass)}function Pr(e){return this.fromWireType(W[e>>2])}function Ar(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Fr(e){this.rawDestructor&&this.rawDestructor(e)}function Dr(e){null!==e&&e.delete()}function Or(e,r,t,n,o,i,a,s,l,u,c){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,o||void 0!==r.baseClass?this.toWireType=Sr:n?(this.toWireType=kr,this.destructorFunction=null):(this.toWireType=Cr,this.destructorFunction=null)}function Rr(e,t,n){return e.includes("j")?function(e,t,n){F("dynCall_"+e in r,"bad function pointer type - no table for sig '"+e+"'"),n&&n.length?F(n.length===e.substring(1).replace(/j/g,"--").length):F(1==e.length);var o=r["dynCall_"+e];return n&&n.length?o.apply(null,[t].concat(n)):o.call(null,t)}(e,t,n):(F(Ce(t),"missing table entry in dynCall: "+t),Ce(t).apply(null,n))}function Mr(e,r){var t=(e=Be(e)).includes("j")?function(e,r){F(e.includes("j"),"getDynCaller should only be called with i64 sigs");var t=[];return function(){return t.length=0,Object.assign(t,arguments),Rr(e,r,t)}}(e,r):Ce(r);return"function"!=typeof t&&Ye("unknown function pointer with signature "+e+": "+r),t}var Nr=void 0;function Ir(e){var r=Et(e),t=Be(r);return ht(r),t}function Lr(e,r){var t=[],n={};throw r.forEach((function e(r){n[r]||$e[r]||(We[r]?We[r].forEach(e):(t.push(r),n[r]=!0))})),new Nr(e+": "+t.map(Ir).join([", "]))}function xr(e,r){for(var t=[],n=0;n>2)+n]);return t}function Ur(e){for(;e.length;){var r=e.pop();e.pop()(r)}}function Br(e,r){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var t=He(e.name||"unknownFunctionName",(function(){}));t.prototype=e.prototype;var n=new t,o=e.apply(n,r);return o instanceof Object?o:n}function jr(e,r,t,n,o){var i=r.length;i<2&&Ye("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==r[1]&&null!==t,s=!1,l=1;l0?", ":"")+d),f+=(u?"var rv = ":"")+"invoker(fn"+(d.length>0?", ":"")+d+");\n",s)f+="runDestructors(destructors);\n";else for(l=a?1:2;l4&&0==--zr[e].refcount&&(zr[e]=void 0,Wr.push(e))}function Gr(){for(var e=0,r=5;r(e||Ye("Cannot use deleted val. handle = "+e),zr[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var r=Wr.length?Wr.pop():zr.length;return zr[r]={refcount:1,value:e},r}}};function qr(e){if(null===e)return"null";var r=typeof e;return"object"===r||"array"===r||"function"===r?e.toString():""+e}function Xr(e,r){switch(r){case 2:return function(e){return this.fromWireType(z[e>>2])};case 3:return function(e){return this.fromWireType(H[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Kr(e,r,t){switch(r){case 0:return t?function(e){return x[e]}:function(e){return U[e]};case 1:return t?function(e){return B[e>>1]}:function(e){return j[e>>1]};case 2:return t?function(e){return $[e>>2]}:function(e){return W[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Jr(e,r){var t=$e[e];return void 0===t&&Ye(r+" has unknown type "+Ir(e)),t}var Qr={};var Zr=[];var et=[];function rt(e,r){return F(r===(0|r)),(e>>>0)+4294967296*r}function tt(e,r){if(e<=0)return e;var t=r<=32?Math.abs(1<=t&&(r<=32||e>t)&&(e=-2*t+e),e}function nt(e,r){return e>=0?e:r<=32?2*Math.abs(1<>3]),n+=8):"i64"==e?(r=[$[n>>2],$[n+4>>2]],n+=8):(F(0==(3&n)),e="i32",r=$[n>>2],n+=4),r}for(var i,a,s,l,u,c,d=[];;){var f=t;if(0===(i=x[t>>0]))break;if(a=x[t+1>>0],37==i){var p=!1,m=!1,h=!1,g=!1,v=!1;e:for(;;){switch(a){case 43:p=!0;break;case 45:m=!0;break;case 35:h=!0;break;case 48:if(g)break e;g=!0;break;case 32:v=!0;break;default:break e}t++,a=x[t+1>>0]}var y=0;if(42==a)y=o("i32"),t++,a=x[t+1>>0];else for(;a>=48&&a<=57;)y=10*y+(a-48),t++,a=x[t+1>>0];var E,w=!1,b=-1;if(46==a){if(b=0,w=!0,t++,42==(a=x[t+1>>0]))b=o("i32"),t++;else for(;;){var _=x[t+1>>0];if(_<48||_>57)break;b=10*b+(_-48),t++}a=x[t+1>>0]}switch(b<0&&(b=6,w=!1),String.fromCharCode(a)){case"h":104==x[t+2>>0]?(t++,E=1):E=2;break;case"l":108==x[t+2>>0]?(t++,E=8):E=4;break;case"L":case"q":case"j":E=8;break;case"z":case"t":case"I":E=4;break;default:E=null}switch(E&&t++,a=x[t+1>>0],String.fromCharCode(a)){case"d":case"i":case"u":case"o":case"x":case"X":case"p":var T=100==a||105==a;if(s=o("i"+8*(E=E||4)),8==E&&(s=117==a?(u=s[0],c=s[1],(u>>>0)+4294967296*(c>>>0)):rt(s[0],s[1])),E<=4)s=(T?tt:nt)(s&Math.pow(256,E)-1,8*E);var k=Math.abs(s),S="";if(100==a||105==a)A=tt(s,8*E).toString(10);else if(117==a)A=nt(s,8*E).toString(10),s=Math.abs(s);else if(111==a)A=(h?"0":"")+k.toString(8);else if(120==a||88==a){if(S=h&&0!=s?"0x":"",s<0){s=-s,A=(k-1).toString(16);for(var C=[],P=0;P=0&&(p?S="+"+S:v&&(S=" "+S)),"-"==A.charAt(0)&&(S="-"+S,A=A.substr(1));S.length+A.lengthR&&R>=-4?(a=(103==a?"f":"F").charCodeAt(0),b-=R+1):(a=(103==a?"e":"E").charCodeAt(0),b--),O=Math.min(b,20)}101==a||69==a?(A=s.toExponential(O),/[eE][-+]\d$/.test(A)&&(A=A.slice(0,-1)+"0"+A.slice(-1))):102!=a&&70!=a||(A=s.toFixed(O),0===s&&((l=s)<0||0===l&&1/l==-1/0)&&(A="-"+A));var M=A.split("e");if(D&&!h)for(;M[0].length>1&&M[0].includes(".")&&("0"==M[0].slice(-1)||"."==M[0].slice(-1));)M[0]=M[0].slice(0,-1);else for(h&&-1==A.indexOf(".")&&(M[0]+=".");b>O++;)M[0]+="0";A=M[0]+(M.length>1?"e"+M[1]:""),69==a&&(A=A.toUpperCase()),s>=0&&(p?A="+"+A:v&&(A=" "+A))}else A=(s<0?"-":"")+"inf",g=!1;for(;A.length>0]);else d=d.concat(pt("(null)".substr(0,I),!0));if(m)for(;I0;)d.push(32);m||d.push(o("i8"));break;case"n":var L=o("i32*");$[L>>2]=d.length;break;case"%":d.push(i);break;default:for(P=f;P>0])}t+=2}else d.push(i),t+=1}return d}function it(e){if(!e||!e.callee||!e.callee.name)return[null,"",""];e.callee.toString();var r=e.callee.name,t="(",n=!0;for(var o in e){var i=e[o];n||(t+=", "),n=!1,t+="number"==typeof i||"string"==typeof i?i:"("+typeof i+")"}t+=")";var a=e.callee.caller;return n&&(t=""),[e=a?a.arguments:[],r,t]}function at(e,r){24&e&&(r=r.replace(/\s+$/,""),r+=(r.length>0?"\n":"")+function(e){var r=Pe(),t=r.lastIndexOf("_emscripten_log"),n=r.lastIndexOf("_emscripten_get_callstack"),o=r.indexOf("\n",Math.max(t,n))+1;r=r.slice(o),32&e&&T("EM_LOG_DEMANGLE is deprecated; ignoring"),8&e&&"undefined"==typeof emscripten_source_map&&(T('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'),e^=8,e|=16);var i=null;if(128&e)for(i=it(arguments);i[1].includes("_emscripten_");)i=it(i[0]);var a=r.split("\n");r="";var s=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)"),l=new RegExp("\\s*(.*?)@(.*):(.*)(:(.*))?"),u=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var c in a){var d=a[c],f="",p="",m=0,h=0,g=u.exec(d);if(g&&5==g.length)f=g[1],p=g[2],m=g[3],h=g[4];else{if((g=s.exec(d))||(g=l.exec(d)),!(g&&g.length>=4)){r+=d+"\n";continue}f=g[1],p=g[2],m=g[3],h=0|g[4]}var v=!1;if(8&e){var y=emscripten_source_map.originalPositionFor({line:m,column:h});(v=y&&y.source)&&(64&e&&(y.source=y.source.substring(y.source.replace(/\\/g,"/").lastIndexOf("/")+1)),r+=" at "+f+" ("+y.source+":"+y.line+":"+y.column+")\n")}(16&e||!v)&&(64&e&&(p=p.substring(p.replace(/\\/g,"/").lastIndexOf("/")+1)),r+=(v?" = "+f:" at "+f)+" ("+p+":"+m+":"+h+")\n"),128&e&&i[0]&&(i[1]==f&&i[2].length>0&&(r=r.replace(/\s+$/,""),r+=" with values: "+i[1]+i[2]+"\n"),i=it(i[0]))}return r.replace(/\s+$/,"")}(e)),1&e?4&e?console.error(r):2&e?console.warn(r):512&e?console.info(r):256&e?console.debug(r):console.log(r):6&e?_(r):b(r)}function st(e){try{return w.grow(e-L.byteLength+65535>>>16),Z(w.buffer),1}catch(r){_("emscripten_realloc_buffer: Attempted to grow heap from "+L.byteLength+" bytes to "+e+" bytes, but got error: "+r)}}var lt={};function ut(){if(!ut.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:n||"./this.program"};for(var r in lt)void 0===lt[r]?delete e[r]:e[r]=lt[r];var t=[];for(var r in e)t.push(r+"="+e[r]);ut.strings=t}return ut.strings}var ct=function(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Ie.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},dt=365,ft=146;function pt(e,r,t){var n=t>0?t:I(e)+1,o=new Array(n),i=M(e,o,0,o.length);return r&&(o.length=i),o}Object.defineProperties(ct.prototype,{read:{get:function(){return(this.mode&dt)===dt},set:function(e){e?this.mode|=dt:this.mode&=-366}},write:{get:function(){return(this.mode&ft)===ft},set:function(e){e?this.mode|=ft:this.mode&=-147}},isFolder:{get:function(){return Ie.isDir(this.mode)}},isDevice:{get:function(){return Ie.isChrdev(this.mode)}}}),Ie.FSNode=ct,Ie.staticInit(),Ne={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},function(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Ue=e}(),Ve=r.BindingError=Ge(Error,"BindingError"),qe=r.InternalError=Ge(Error,"InternalError"),wr.prototype.isAliasOf=Qe,wr.prototype.clone=gr,wr.prototype.delete=vr,wr.prototype.isDeleted=yr,wr.prototype.deleteLater=Er,r.getInheritedInstanceCount=ir,r.getLiveInheritedInstances=ar,r.flushPendingDeletes=lr,r.setDelayFunction=cr,Or.prototype.getPointee=Ar,Or.prototype.destructor=Fr,Or.prototype.argPackAdvance=8,Or.prototype.readValueFromPointer=Pr,Or.prototype.deleteObject=Dr,Or.prototype.fromWireType=mr,Nr=r.UnboundTypeError=Ge(Error,"UnboundTypeError"),r.count_emval_handles=Gr,r.get_first_emval=Vr;var mt={__syscall_fcntl64:function(e,r,t){Le.varargs=t;try{var n=Le.getStreamFromFD(e);switch(r){case 0:return(o=Le.get())<0?-28:Ie.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=Le.get();return n.flags|=o,0;case 5:o=Le.get();return B[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return i=28,$[yt()>>2]=i,-1}}catch(e){if(void 0===Ie||!(e instanceof Ie.ErrnoError))throw e;return-e.errno}var i},__syscall_openat:function(e,r,t,n){Le.varargs=n;try{r=Le.getStr(r),r=Le.calculateAt(e,r);var o=n?Le.get():0;return Ie.open(r,t,o).fd}catch(e){if(void 0===Ie||!(e instanceof Ie.ErrnoError))throw e;return-e.errno}},_embind_register_bigint:function(e,r,t,n,o){},_embind_register_bool:function(e,r,t,n,o){var i=xe(t);Je(e,{name:r=Be(r),fromWireType:function(e){return!!e},toWireType:function(e,r){return r?n:o},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===t)n=x;else if(2===t)n=B;else{if(4!==t)throw new TypeError("Unknown boolean type size: "+r);n=$}return this.fromWireType(n[e>>i])},destructorFunction:null})},_embind_register_class:function(e,t,n,o,i,a,s,l,u,c,d,f,p){d=Be(d),a=Mr(i,a),l&&(l=Mr(s,l)),c&&(c=Mr(u,c)),p=Mr(f,p);var m=ze(d);!function(e,t,n){r.hasOwnProperty(e)?((void 0===n||void 0!==r[e].overloadTable&&void 0!==r[e].overloadTable[n])&&Ye("Cannot register public name '"+e+"' twice"),br(r,e,e),r.hasOwnProperty(n)&&Ye("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),r[e].overloadTable[n]=t):(r[e]=t,void 0!==n&&(r[e].numArguments=n))}(m,(function(){Lr("Cannot construct "+d+" due to unbound types",[o])})),Ke([e,t,n],o?[o]:[],(function(t){var n,i;t=t[0],i=o?(n=t.registeredClass).instancePrototype:wr.prototype;var s=He(m,(function(){if(Object.getPrototypeOf(this)!==u)throw new Ve("Use 'new' to construct "+d);if(void 0===f.constructor_body)throw new Ve(d+" has no accessible constructor");var e=f.constructor_body[arguments.length];if(void 0===e)throw new Ve("Tried to invoke ctor of "+d+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(f.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),u=Object.create(i,{constructor:{value:s}});s.prototype=u;var f=new _r(d,s,u,p,n,a,l,c),h=new Or(d,f,!0,!1,!1),g=new Or(d+"*",f,!1,!1,!1),v=new Or(d+" const*",f,!1,!0,!1);return or[e]={pointerType:g,constPointerType:v},function(e,t,n){r.hasOwnProperty(e)||Xe("Replacing nonexistant public symbol"),void 0!==r[e].overloadTable&&void 0!==n?r[e].overloadTable[n]=t:(r[e]=t,r[e].argCount=n)}(m,s),[h,g,v]}))},_embind_register_class_constructor:function(e,r,t,n,o,i){F(r>0);var a=xr(r,t);o=Mr(n,o),Ke([],[e],(function(e){var t="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[r-1])throw new Ve("Cannot register multiple constructors with identical number of parameters ("+(r-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[r-1]=()=>{Lr("Cannot construct "+e.name+" due to unbound types",a)},Ke([],a,(function(n){return n.splice(1,0,null),e.registeredClass.constructor_body[r-1]=jr(t,n,null,o,i),[]})),[]}))},_embind_register_class_function:function(e,r,t,n,o,i,a,s){var l=xr(t,n);r=Be(r),i=Mr(o,i),Ke([],[e],(function(e){var n=(e=e[0]).name+"."+r;function o(){Lr("Cannot call "+n+" due to unbound types",l)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(r);var u=e.registeredClass.instancePrototype,c=u[r];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===t-2?(o.argCount=t-2,o.className=e.name,u[r]=o):(br(u,r,n),u[r].overloadTable[t-2]=o),Ke([],l,(function(o){var s=jr(n,o,e,i,a);return void 0===u[r].overloadTable?(s.argCount=t-2,u[r]=s):u[r].overloadTable[t-2]=s,[]})),[]}))},_embind_register_class_property:function(e,r,t,n,o,i,a,s,l,u){r=Be(r),o=Mr(n,o),Ke([],[e],(function(e){var n=(e=e[0]).name+"."+r,c={get:function(){Lr("Cannot access "+n+" due to unbound types",[t,a])},enumerable:!0,configurable:!0};return c.set=l?()=>{Lr("Cannot access "+n+" due to unbound types",[t,a])}:e=>{Ye(n+" is a read-only property")},Object.defineProperty(e.registeredClass.instancePrototype,r,c),Ke([],l?[t,a]:[t],(function(t){var a=t[0],c={get:function(){var r=$r(this,e,n+" getter");return a.fromWireType(o(i,r))},enumerable:!0};if(l){l=Mr(s,l);var d=t[1];c.set=function(r){var t=$r(this,e,n+" setter"),o=[];l(u,t,d.toWireType(o,r)),Ur(o)}}return Object.defineProperty(e.registeredClass.instancePrototype,r,c),[]})),[]}))},_embind_register_emval:function(e,r){Je(e,{name:r=Be(r),fromWireType:function(e){var r=Yr.toValue(e);return Hr(e),r},toWireType:function(e,r){return Yr.toHandle(r)},argPackAdvance:8,readValueFromPointer:Pr,destructorFunction:null})},_embind_register_float:function(e,r,t){var n=xe(t);Je(e,{name:r=Be(r),fromWireType:function(e){return e},toWireType:function(e,r){if("number"!=typeof r&&"boolean"!=typeof r)throw new TypeError('Cannot convert "'+qr(r)+'" to '+this.name);return r},argPackAdvance:8,readValueFromPointer:Xr(r,n),destructorFunction:null})},_embind_register_integer:function(e,r,t,n,o){r=Be(r),-1===o&&(o=4294967295);var i=xe(t),a=e=>e;if(0===n){var s=32-8*t;a=e=>e<>>s}var l=r.includes("unsigned"),u=(e,t)=>{if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+qr(e)+'" to '+t);if(eo)throw new TypeError('Passing a number "'+qr(e)+'" from JS side to C/C++ side to an argument of type "'+r+'", which is outside the valid range ['+n+", "+o+"]!")};Je(e,{name:r,fromWireType:a,toWireType:l?function(e,r){return u(r,this.name),r>>>0}:function(e,r){return u(r,this.name),r},argPackAdvance:8,readValueFromPointer:Kr(r,i,0!==n),destructorFunction:null})},_embind_register_memory_view:function(e,r,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][r];function o(e){var r=W,t=r[e>>=2],o=r[e+1];return new n(L,o,t)}Je(e,{name:t=Be(t),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},_embind_register_std_string:function(e,r){var t="std::string"===(r=Be(r));Je(e,{name:r,fromWireType:function(e){var r,n=W[e>>2];if(t)for(var o=e+4,i=0;i<=n;++i){var a=e+4+i;if(i==n||0==U[a]){var s=R(o,a-o);void 0===r?r=s:(r+=String.fromCharCode(0),r+=s),o=a+1}}else{var l=new Array(n);for(i=0;iI(r):()=>r.length)(),i=gt(4+o+1);if(W[i>>2]=o,t&&n)N(r,i+4,o+1);else if(n)for(var a=0;a255&&(ht(i),Ye("String has UTF-16 code units that do not fit in 8 bits")),U[i+4+a]=s}else for(a=0;aj,s=1):4===r&&(n=X,o=K,a=J,i=()=>W,s=2),Je(e,{name:t,fromWireType:function(e){for(var t,o=W[e>>2],a=i(),l=e+4,u=0;u<=o;++u){var c=e+4+u*r;if(u==o||0==a[c>>s]){var d=n(l,c-l);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),l=c+r}}return ht(e),t},toWireType:function(e,n){"string"!=typeof n&&Ye("Cannot pass non-string to C++ string type "+t);var i=a(n),l=gt(4+i+r);return W[l>>2]=i>>s,o(n,l+4,i+r),null!==e&&e.push(ht,l),l},argPackAdvance:8,readValueFromPointer:Pr,destructorFunction:function(e){ht(e)}})},_embind_register_void:function(e,r){Je(e,{isVoid:!0,name:r=Be(r),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,r){}})},_emscripten_date_now:function(){return Date.now()},_emval_as:function(e,r,t){e=Yr.toValue(e),r=Jr(r,"emval::as");var n=[],o=Yr.toHandle(n);return $[t>>2]=o,r.toWireType(n,e)},_emval_call_void_method:function(e,r,t,n){var o,i;(e=Zr[e])(r=Yr.toValue(r),t=void 0===(i=Qr[o=t])?Be(o):i,null,n)},_emval_decref:Hr,_emval_get_method_caller:function(e,r){var t=function(e,r){for(var t=new Array(e),n=0;n>2)+n],"parameter "+n);return t}(e,r),n=t[0],o=n.name+"_$"+t.slice(1).map((function(e){return e.name})).join("_")+"$",i=et[o];if(void 0!==i)return i;for(var a=["retType"],s=[n],l="",u=0;u4&&(zr[e].refcount+=1)},_emval_run_destructors:function(e){Ur(Yr.toValue(e)),Hr(e)},_emval_take_value:function(e,r){var t=(e=Jr(e,"_emval_take_value")).readValueFromPointer(r);return Yr.toHandle(t)},_gmtime_js:function(e,r){var t=new Date(1e3*$[e>>2]);$[r>>2]=t.getUTCSeconds(),$[r+4>>2]=t.getUTCMinutes(),$[r+8>>2]=t.getUTCHours(),$[r+12>>2]=t.getUTCDate(),$[r+16>>2]=t.getUTCMonth(),$[r+20>>2]=t.getUTCFullYear()-1900,$[r+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;$[r+28>>2]=o},_localtime_js:function(e,r){var t=new Date(1e3*$[e>>2]);$[r>>2]=t.getSeconds(),$[r+4>>2]=t.getMinutes(),$[r+8>>2]=t.getHours(),$[r+12>>2]=t.getDate(),$[r+16>>2]=t.getMonth(),$[r+20>>2]=t.getFullYear()-1900,$[r+24>>2]=t.getDay();var n=new Date(t.getFullYear(),0,1),o=(t.getTime()-n.getTime())/864e5|0;$[r+28>>2]=o,$[r+36>>2]=-60*t.getTimezoneOffset();var i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),a=n.getTimezoneOffset(),s=0|(i!=a&&t.getTimezoneOffset()==Math.min(a,i));$[r+32>>2]=s},_mktime_js:function(e){var r=new Date($[e+20>>2]+1900,$[e+16>>2],$[e+12>>2],$[e+8>>2],$[e+4>>2],$[e>>2],0),t=$[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),s=Math.min(a,i);if(t<0)$[e+32>>2]=Number(i!=a&&s==n);else if(t>0!=(s==n)){var l=Math.max(a,i),u=t>0?s:l;r.setTime(r.getTime()+6e4*(u-n))}$[e+24>>2]=r.getDay();var c=(r.getTime()-o.getTime())/864e5|0;return $[e+28>>2]=c,$[e>>2]=r.getSeconds(),$[e+4>>2]=r.getMinutes(),$[e+8>>2]=r.getHours(),$[e+12>>2]=r.getDate(),$[e+16>>2]=r.getMonth(),r.getTime()/1e3|0},_tzset_js:function e(r,t,n){e.called||(e.called=!0,function(e,r,t){var n=(new Date).getFullYear(),o=new Date(n,0,1),i=new Date(n,6,1),a=o.getTimezoneOffset(),s=i.getTimezoneOffset(),l=Math.max(a,s);function u(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}$[e>>2]=60*l,$[r>>2]=Number(a!=s);var c=u(o),d=u(i),f=Q(c),p=Q(d);s>2]=f,$[t+4>>2]=p):($[t>>2]=p,$[t+4>>2]=f)}(r,t,n))},abort:function(){ge("native code called abort()")},emscripten_log:function(e,r,t){at(e,O(ot(r,t),0))},emscripten_resize_heap:function(e){var r=U.length;F((e>>>=0)>r);var t,n,o=2147483648;if(e>o)return _("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is "+"2147483648 bytes!"),!1;for(var i=1;i<=4;i*=2){var a=r*(1+.2/i);a=Math.min(a,e+100663296);var s=Math.min(o,(t=Math.max(e,a))+((n=65536)-t%n)%n);if(st(s))return!0}return _("Failed to grow the heap from "+r+" bytes to "+s+" bytes, not enough memory!"),!1},environ_get:function(e,r){var t=0;return ut().forEach((function(n,o){var i=r+t;$[e+4*o>>2]=i,function(e,r,t){for(var n=0;n>0]=e.charCodeAt(n);t||(x[r>>0]=0)}(n,i),t+=n.length+1})),0},environ_sizes_get:function(e,r){var t=ut();$[e>>2]=t.length;var n=0;return t.forEach((function(e){n+=e.length+1})),$[r>>2]=n,0},fd_close:function(e){try{var r=Le.getStreamFromFD(e);return Ie.close(r),0}catch(e){if(void 0===Ie||!(e instanceof Ie.ErrnoError))throw e;return e.errno}},fd_fdstat_get:function(e,r){try{var t=Le.getStreamFromFD(e),n=t.tty?2:Ie.isDir(t.mode)?3:Ie.isLink(t.mode)?7:4;return x[r>>0]=n,0}catch(e){if(void 0===Ie||!(e instanceof Ie.ErrnoError))throw e;return e.errno}},fd_read:function(e,r,t,n){try{var o=Le.getStreamFromFD(e),i=Le.doReadv(o,r,t);return $[n>>2]=i,0}catch(e){if(void 0===Ie||!(e instanceof Ie.ErrnoError))throw e;return e.errno}},fd_seek:function(e,r,t,n,o){try{var i=Le.getStreamFromFD(e),a=4294967296*t+(r>>>0),s=9007199254740992;return a<=-s||a>=s?-61:(Ie.llseek(i,a,n),Ee=[i.position>>>0,(ye=i.position,+Math.abs(ye)>=1?ye>0?(0|Math.min(+Math.floor(ye/4294967296),4294967295))>>>0:~~+Math.ceil((ye-+(~~ye>>>0))/4294967296)>>>0:0)],$[o>>2]=Ee[0],$[o+4>>2]=Ee[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0)}catch(e){if(void 0===Ie||!(e instanceof Ie.ErrnoError))throw e;return e.errno}},fd_write:function(e,r,t,n){try{var o=Le.getStreamFromFD(e),i=Le.doWritev(o,r,t);return $[n>>2]=i,0}catch(e){if(void 0===Ie||!(e instanceof Ie.ErrnoError))throw e;return e.errno}},setTempRet0:function(e){}};!function(){var e={env:mt,wasi_snapshot_preview1:mt};function t(e,t){var n,o=e.exports;r.asm=o,F(w=r.asm.memory,"memory not found in wasm exports"),Z(w.buffer),F(re=r.asm.__indirect_function_table,"table not found in wasm exports"),n=r.asm.__wasm_call_ctors,ae.unshift(n),he("wasm-instantiate")}me("wasm-instantiate");var n=r;function o(e){F(r===n,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),n=null,t(e.instance)}function i(r){return function(){if(!E&&(s||l)){if("function"==typeof fetch&&!be(ve))return fetch(ve,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+ve+"'";return e.arrayBuffer()})).catch((function(){return Te(ve)}));if(f)return new Promise((function(e,r){f(ve,(function(r){e(new Uint8Array(r))}),r)}))}return Promise.resolve().then((function(){return Te(ve)}))}().then((function(r){return WebAssembly.instantiate(r,e)})).then((function(e){return e})).then(r,(function(e){_("failed to asynchronously prepare wasm: "+e),be(ve)&&_("warning: Loading from a file URI ("+ve+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),ge(e)}))}if(r.instantiateWasm)try{return r.instantiateWasm(e,t)}catch(e){return _("Module.instantiateWasm callback failed with error: "+e),!1}E||"function"!=typeof WebAssembly.instantiateStreaming||we(ve)||be(ve)||"function"!=typeof fetch?i(o):fetch(ve,{credentials:"same-origin"}).then((function(r){return WebAssembly.instantiateStreaming(r,e).then(o,(function(e){return _("wasm streaming compile failed: "+e),_("falling back to ArrayBuffer instantiation"),i(o)}))}))}(),r.___wasm_call_ctors=_e("__wasm_call_ctors");var ht=r._free=_e("free"),gt=r._malloc=_e("malloc"),vt=r._strlen=_e("strlen"),yt=r.___errno_location=_e("__errno_location"),Et=r.___getTypeName=_e("__getTypeName");r.___embind_register_native_and_builtin_types=_e("__embind_register_native_and_builtin_types");var wt=r.___stdio_exit=_e("__stdio_exit"),bt=r._emscripten_builtin_memalign=_e("emscripten_builtin_memalign"),_t=r._emscripten_stack_init=function(){return(_t=r._emscripten_stack_init=r.asm.emscripten_stack_init).apply(null,arguments)};r._emscripten_stack_get_free=function(){return(r._emscripten_stack_get_free=r.asm.emscripten_stack_get_free).apply(null,arguments)},r._emscripten_stack_get_base=function(){return(r._emscripten_stack_get_base=r.asm.emscripten_stack_get_base).apply(null,arguments)};var Tt,kt=r._emscripten_stack_get_end=function(){return(kt=r._emscripten_stack_get_end=r.asm.emscripten_stack_get_end).apply(null,arguments)};function St(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Ct(e){function t(){Tt||(Tt=!0,r.calledRun=!0,A||(oe(),F(!le),le=!0,r.noFSInit||Ie.init.initialized||Ie.init(),Ie.ignorePermissions=!1,ke(ae),r.onRuntimeInitialized&&r.onRuntimeInitialized(),F(!r._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),function(){if(oe(),r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)e=r.postRun.shift(),se.unshift(e);var e;ke(se)}()))}ue>0||(_t(),ne(),function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)e=r.preRun.shift(),ie.unshift(e);var e;ke(ie)}(),ue>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),t()}),1)):t(),oe()))}if(r.stackSave=_e("stackSave"),r.stackRestore=_e("stackRestore"),r.stackAlloc=_e("stackAlloc"),r.dynCall_ijiii=_e("dynCall_ijiii"),r.dynCall_viiijj=_e("dynCall_viiijj"),r.dynCall_jij=_e("dynCall_jij"),r.dynCall_jii=_e("dynCall_jii"),r.dynCall_jiji=_e("dynCall_jiji"),r._ff_h264_cabac_tables=112940,P("intArrayFromString",!1),P("intArrayToString",!1),P("ccall",!1),P("cwrap",!1),P("setValue",!1),P("getValue",!1),P("allocate",!1),P("UTF8ArrayToString",!1),P("UTF8ToString",!1),P("stringToUTF8Array",!1),P("stringToUTF8",!1),P("lengthBytesUTF8",!1),P("stackTrace",!1),P("addOnPreRun",!1),P("addOnInit",!1),P("addOnPreMain",!1),P("addOnExit",!1),P("addOnPostRun",!1),P("writeStringToMemory",!1),P("writeArrayToMemory",!1),P("writeAsciiToMemory",!1),P("addRunDependency",!0),P("removeRunDependency",!0),P("FS_createFolder",!1),P("FS_createPath",!0),P("FS_createDataFile",!0),P("FS_createPreloadedFile",!0),P("FS_createLazyFile",!0),P("FS_createLink",!1),P("FS_createDevice",!0),P("FS_unlink",!0),P("getLEB",!1),P("getFunctionTables",!1),P("alignFunctionTables",!1),P("registerFunctions",!1),P("addFunction",!1),P("removeFunction",!1),P("prettyPrint",!1),P("dynCall",!1),P("getCompilerSetting",!1),P("print",!1),P("printErr",!1),P("getTempRet0",!1),P("setTempRet0",!1),P("callMain",!1),P("abort",!1),P("keepRuntimeAlive",!1),P("ptrToString",!1),P("zeroMemory",!1),P("stringToNewUTF8",!1),P("emscripten_realloc_buffer",!1),P("ENV",!1),P("ERRNO_CODES",!1),P("ERRNO_MESSAGES",!1),P("setErrNo",!1),P("inetPton4",!1),P("inetNtop4",!1),P("inetPton6",!1),P("inetNtop6",!1),P("readSockaddr",!1),P("writeSockaddr",!1),P("DNS",!1),P("getHostByName",!1),P("Protocols",!1),P("Sockets",!1),P("getRandomDevice",!1),P("traverseStack",!1),P("UNWIND_CACHE",!1),P("convertPCtoSourceLocation",!1),P("readAsmConstArgsArray",!1),P("readAsmConstArgs",!1),P("mainThreadEM_ASM",!1),P("jstoi_q",!1),P("jstoi_s",!1),P("getExecutableName",!1),P("listenOnce",!1),P("autoResumeAudioContext",!1),P("dynCallLegacy",!1),P("getDynCaller",!1),P("dynCall",!1),P("setWasmTableEntry",!1),P("getWasmTableEntry",!1),P("handleException",!1),P("runtimeKeepalivePush",!1),P("runtimeKeepalivePop",!1),P("callUserCallback",!1),P("maybeExit",!1),P("safeSetTimeout",!1),P("asmjsMangle",!1),P("asyncLoad",!1),P("alignMemory",!1),P("mmapAlloc",!1),P("reallyNegative",!1),P("unSign",!1),P("reSign",!1),P("formatString",!1),P("PATH",!1),P("PATH_FS",!1),P("SYSCALLS",!1),P("getSocketFromFD",!1),P("getSocketAddress",!1),P("JSEvents",!1),P("registerKeyEventCallback",!1),P("specialHTMLTargets",!1),P("maybeCStringToJsString",!1),P("findEventTarget",!1),P("findCanvasEventTarget",!1),P("getBoundingClientRect",!1),P("fillMouseEventData",!1),P("registerMouseEventCallback",!1),P("registerWheelEventCallback",!1),P("registerUiEventCallback",!1),P("registerFocusEventCallback",!1),P("fillDeviceOrientationEventData",!1),P("registerDeviceOrientationEventCallback",!1),P("fillDeviceMotionEventData",!1),P("registerDeviceMotionEventCallback",!1),P("screenOrientation",!1),P("fillOrientationChangeEventData",!1),P("registerOrientationChangeEventCallback",!1),P("fillFullscreenChangeEventData",!1),P("registerFullscreenChangeEventCallback",!1),P("registerRestoreOldStyle",!1),P("hideEverythingExceptGivenElement",!1),P("restoreHiddenElements",!1),P("setLetterbox",!1),P("currentFullscreenStrategy",!1),P("restoreOldWindowedStyle",!1),P("softFullscreenResizeWebGLRenderTarget",!1),P("doRequestFullscreen",!1),P("fillPointerlockChangeEventData",!1),P("registerPointerlockChangeEventCallback",!1),P("registerPointerlockErrorEventCallback",!1),P("requestPointerLock",!1),P("fillVisibilityChangeEventData",!1),P("registerVisibilityChangeEventCallback",!1),P("registerTouchEventCallback",!1),P("fillGamepadEventData",!1),P("registerGamepadEventCallback",!1),P("registerBeforeUnloadEventCallback",!1),P("fillBatteryEventData",!1),P("battery",!1),P("registerBatteryEventCallback",!1),P("setCanvasElementSize",!1),P("getCanvasElementSize",!1),P("demangle",!1),P("demangleAll",!1),P("jsStackTrace",!1),P("stackTrace",!1),P("getEnvStrings",!1),P("checkWasiClock",!1),P("writeI53ToI64",!1),P("writeI53ToI64Clamped",!1),P("writeI53ToI64Signaling",!1),P("writeI53ToU64Clamped",!1),P("writeI53ToU64Signaling",!1),P("readI53FromI64",!1),P("readI53FromU64",!1),P("convertI32PairToI53",!1),P("convertU32PairToI53",!1),P("dlopenMissingError",!1),P("setImmediateWrapped",!1),P("clearImmediateWrapped",!1),P("polyfillSetImmediate",!1),P("uncaughtExceptionCount",!1),P("exceptionLast",!1),P("exceptionCaught",!1),P("ExceptionInfo",!1),P("exception_addRef",!1),P("exception_decRef",!1),P("Browser",!1),P("setMainLoop",!1),P("wget",!1),P("FS",!1),P("MEMFS",!1),P("TTY",!1),P("PIPEFS",!1),P("SOCKFS",!1),P("_setNetworkCallback",!1),P("tempFixedLengthArray",!1),P("miniTempWebGLFloatBuffers",!1),P("heapObjectForWebGLType",!1),P("heapAccessShiftForWebGLHeap",!1),P("GL",!1),P("emscriptenWebGLGet",!1),P("computeUnpackAlignedImageSize",!1),P("emscriptenWebGLGetTexPixelData",!1),P("emscriptenWebGLGetUniform",!1),P("webglGetUniformLocation",!1),P("webglPrepareUniformLocationsBeforeFirstUse",!1),P("webglGetLeftBracePos",!1),P("emscriptenWebGLGetVertexAttrib",!1),P("writeGLArray",!1),P("AL",!1),P("SDL_unicode",!1),P("SDL_ttfContext",!1),P("SDL_audio",!1),P("SDL",!1),P("SDL_gfx",!1),P("GLUT",!1),P("EGL",!1),P("GLFW_Window",!1),P("GLFW",!1),P("GLEW",!1),P("IDBStore",!1),P("runAndAbortIfError",!1),P("InternalError",!1),P("BindingError",!1),P("UnboundTypeError",!1),P("PureVirtualError",!1),P("init_embind",!1),P("throwInternalError",!1),P("throwBindingError",!1),P("throwUnboundTypeError",!1),P("ensureOverloadTable",!1),P("exposePublicSymbol",!1),P("replacePublicSymbol",!1),P("extendError",!1),P("createNamedFunction",!1),P("registeredInstances",!1),P("getBasestPointer",!1),P("registerInheritedInstance",!1),P("unregisterInheritedInstance",!1),P("getInheritedInstance",!1),P("getInheritedInstanceCount",!1),P("getLiveInheritedInstances",!1),P("registeredTypes",!1),P("awaitingDependencies",!1),P("typeDependencies",!1),P("registeredPointers",!1),P("registerType",!1),P("whenDependentTypesAreResolved",!1),P("embind_charCodes",!1),P("embind_init_charCodes",!1),P("readLatin1String",!1),P("getTypeName",!1),P("heap32VectorToArray",!1),P("requireRegisteredType",!1),P("getShiftFromSize",!1),P("integerReadValueFromPointer",!1),P("enumReadValueFromPointer",!1),P("floatReadValueFromPointer",!1),P("simpleReadValueFromPointer",!1),P("runDestructors",!1),P("new_",!1),P("craftInvokerFunction",!1),P("embind__requireFunction",!1),P("tupleRegistrations",!1),P("structRegistrations",!1),P("genericPointerToWireType",!1),P("constNoSmartPtrRawPointerToWireType",!1),P("nonConstNoSmartPtrRawPointerToWireType",!1),P("init_RegisteredPointer",!1),P("RegisteredPointer",!1),P("RegisteredPointer_getPointee",!1),P("RegisteredPointer_destructor",!1),P("RegisteredPointer_deleteObject",!1),P("RegisteredPointer_fromWireType",!1),P("runDestructor",!1),P("releaseClassHandle",!1),P("finalizationRegistry",!1),P("detachFinalizer_deps",!1),P("detachFinalizer",!1),P("attachFinalizer",!1),P("makeClassHandle",!1),P("init_ClassHandle",!1),P("ClassHandle",!1),P("ClassHandle_isAliasOf",!1),P("throwInstanceAlreadyDeleted",!1),P("ClassHandle_clone",!1),P("ClassHandle_delete",!1),P("deletionQueue",!1),P("ClassHandle_isDeleted",!1),P("ClassHandle_deleteLater",!1),P("flushPendingDeletes",!1),P("delayFunction",!1),P("setDelayFunction",!1),P("RegisteredClass",!1),P("shallowCopyInternalPointer",!1),P("downcastPointer",!1),P("upcastPointer",!1),P("validateThis",!1),P("char_0",!1),P("char_9",!1),P("makeLegalFunctionName",!1),P("emval_handle_array",!1),P("emval_free_list",!1),P("emval_symbols",!1),P("init_emval",!1),P("count_emval_handles",!1),P("get_first_emval",!1),P("getStringOrSymbol",!1),P("Emval",!1),P("emval_newers",!1),P("craftEmvalAllocator",!1),P("emval_get_global",!1),P("emval_methodCallers",!1),P("emval_registeredMethods",!1),P("warnOnce",!1),P("stackSave",!1),P("stackRestore",!1),P("stackAlloc",!1),P("AsciiToString",!1),P("stringToAscii",!1),P("UTF16ToString",!1),P("stringToUTF16",!1),P("lengthBytesUTF16",!1),P("UTF32ToString",!1),P("stringToUTF32",!1),P("lengthBytesUTF32",!1),P("allocateUTF8",!1),P("allocateUTF8OnStack",!1),r.writeStackCookie=ne,r.checkStackCookie=oe,C("ALLOC_NORMAL",!1),C("ALLOC_STACK",!1),de=function e(){Tt||Ct(),Tt||(de=e)},r.run=Ct,r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();Ct(),e.exports=r}));const u=1e3,c=1e3,d=!1,f=!1,p=!1,m=!1,h="initVideo",g="render",v="playAudio",y="initAudio",E="audioCode",w="videoCode",b=1,_=2,T="init",k="decode",S="audioDecode",C="videoDecode",P="close",A="updateConfig",F="key",D="delta";s((function(e){!function(){var r="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,n=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,o=t.length,i={};n{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})(),Date.now||(Date.now=function(){return(new Date).getTime()}),l.postRun=function(){var e=[],r=[],t={};"VideoEncoder"in self&&(t={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:new VideoDecoder({output:function(e){t.isEmitInfo||(n.opt.debug&&console.log("Jessibuca: [worker] Webcodecs Video Decoder initSize"),postMessage({cmd:h,w:e.codedWidth,h:e.codedHeight}),t.isEmitInfo=!0,t.offscreenCanvas=new OffscreenCanvas(e.codedWidth,e.codedHeight),t.offscreenCanvasCtx=t.offscreenCanvas.getContext("2d")),t.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let r=t.offscreenCanvas.transferToImageBitmap();postMessage({cmd:g,buffer:r,delay:n.delay,ts:0},[r]),setTimeout((function(){e.close?e.close():e.destroy()}),100)},error:function(e){console.error(e)}}),decode:function(e,r){const o=e[0]>>4==1;if(t.hasInit){const n=new EncodedVideoChunk({data:e.slice(5),timestamp:r,type:o?F:D});t.decoder.decode(n)}else if(o&&0===e[1]){const r=15&e[0];n.setVideoCodec(r);const o=function(e){let r=e.subarray(1,4),t="avc1.";for(let e=0;e<3;e++){let n=r[e].toString(16);n.length<2&&(n="0"+n),t+=n}return{codec:t,description:e}}(e.slice(5));t.decoder.configure(o),t.hasInit=!0}},reset(){t.hasInit=!1,t.isEmitInfo=!1,t.offscreenCanvas=null,t.offscreenCanvasCtx=null}});var n={opt:{debug:d,useOffscreen:p,useWCS:f,videoBuffer:u,openWebglAlignment:m,videoBufferDelay:c},useOffscreen:function(){return n.opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},initAudioPlanar:function(e,t){postMessage({cmd:y,sampleRate:t,channels:e});var n=[],o=0;this.playAudioPlanar=function(t,i,a){for(var s=i,u=[],c=0,d=0;d<2;d++){var f=l.HEAPU32[(t>>2)+d]>>2;u[d]=l.HEAPF32.subarray(f,f+s)}if(o){if(!(s>=(i=1024-o)))return o+=s,r[0]=Float32Array.of(...r[0],...u[0]),void(2==e&&(r[1]=Float32Array.of(...r[1],...u[1])));n[0]=Float32Array.of(...r[0],...u[0].subarray(0,i)),2==e&&(n[1]=Float32Array.of(...r[1],...u[1].subarray(0,i))),postMessage({cmd:v,buffer:n,ts:a},n.map((e=>e.buffer))),c=i,s-=i}for(o=s;o>=1024;o-=1024)n[0]=u[0].slice(c,c+=1024),2==e&&(n[1]=u[1].slice(c-1024,c)),postMessage({cmd:v,buffer:n,ts:a},n.map((e=>e.buffer)));o&&(r[0]=u[0].slice(c),2==e&&(r[1]=u[1].slice(c)))}},setVideoCodec:function(e){postMessage({cmd:w,code:e})},setAudioCodec:function(e){postMessage({cmd:E,code:e})},setVideoSize:function(e,r){postMessage({cmd:h,w:e,h:r});var t=e*r,o=t>>2;n.useOffscreen()?(this.offscreenCanvas=new OffscreenCanvas(e,r),this.offscreenCanvasGL=this.offscreenCanvas.getContext("webgl"),this.webglObj=((e,r)=>{var t=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),n=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");r&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);var o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,t),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+e.getShaderInfoLog(o));var i=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+e.getShaderInfoLog(i));var a=e.createProgram();e.attachShader(a,o),e.attachShader(a,i),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||console.log("Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a);var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var l=e.getAttribLocation(a,"vertexPos");e.enableVertexAttribArray(l),e.vertexAttribPointer(l,2,e.FLOAT,!1,0,0);var u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var c=e.getAttribLocation(a,"texturePos");function d(r,t){var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(e.getUniformLocation(a,r),t),n}e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0);var f=d("ySampler",0),p=d("uSampler",1),m=d("vSampler",2);return{render:function(r,t,n,o,i){e.viewport(0,0,r,t),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,f),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,r,t,0,e.LUMINANCE,e.UNSIGNED_BYTE,n),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,r/2,t/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,m),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,r/2,t/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,i),e.drawArrays(e.TRIANGLE_STRIP,0,4)},destroy:function(){try{e.deleteProgram(a),e.deleteBuffer(s),e.deleteBuffer(u),e.deleteTexture(f),e.deleteTexture(p),e.deleteBuffer(m)}catch(e){}}}})(this.offscreenCanvasGL,n.opt.openWebglAlignment),this.draw=function(n,i,a,s){const u=l.HEAPU8.subarray(i,i+t),c=l.HEAPU8.subarray(a,a+o),d=l.HEAPU8.subarray(s,s+o);this.webglObj.render(e,r,u,c,d);let f=this.offscreenCanvas.transferToImageBitmap();postMessage({cmd:g,buffer:f,delay:this.delay,ts:n},[f])}):this.draw=function(e,r,n,i){const a=[Uint8Array.from(l.HEAPU8.subarray(r,r+t)),Uint8Array.from(l.HEAPU8.subarray(n,n+o)),Uint8Array.from(l.HEAPU8.subarray(i,i+o))];postMessage({cmd:g,output:a,delay:this.delay,ts:e},a.map((e=>e.buffer)))}},getDelay:function(e){if(!e)return-1;if(this.firstTimestamp){if(e){const r=Date.now()-this.startTimestamp,t=e-this.firstTimestamp;this.delay=r>=t?r-t:t-r}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.delay},resetDelay:function(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1},init:function(){n.opt.debug&&console.log("Jessibuca: [worker] init");const r=e=>{n.opt.useWCS&&n.useOffscreen()&&e.type===_&&t.decode?t.decode(e.payload,e.ts):e.decoder.decode(e.payload,e.ts)};this.stopId=setInterval((()=>{if(e.length)if(this.dropping){for((t=e.shift()).type===b&&0===t.payload[1]&&r(t);!t.isIFrame&&e.length;)(t=e.shift()).type===b&&0===t.payload[1]&&r(t);t.isIFrame&&(this.dropping=!1,r(t))}else{var t=e[0];if(-1===this.getDelay(t.ts))e.shift(),r(t);else if(this.delay>n.opt.videoBuffer+n.opt.videoBufferDelay)this.resetDelay(),this.dropping=!0;else for(;e.length&&(t=e[0],this.getDelay(t.ts)>n.opt.videoBuffer);)e.shift(),r(t)}}),10)},close:function(){n.opt.debug&&console.log("Jessibuca: [worker]: close"),clearInterval(this.stopId),this.stopId=null,o.clear&&o.clear(),i.clear&&i.clear(),t.reset&&t.reset(),this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1,this.webglObj&&(this.webglObj.destroy(),this.offscreenCanvas=null,this.offscreenCanvasGL=null,this.offscreenCanvasCtx=null),e=[],r=[],delete this.playAudioPlanar,delete this.draw},pushBuffer:function(r,t){t.type===b?e.push({ts:t.ts,payload:r,decoder:o,type:b}):t.type===_&&e.push({ts:t.ts,payload:r,decoder:i,type:_,isIFrame:t.isIFrame})}},o=new l.AudioDecoder(n),i=new l.VideoDecoder(n);postMessage({cmd:T}),self.onmessage=function(e){var r=e.data;switch(r.cmd){case T:try{n.opt=Object.assign(n.opt,JSON.parse(r.opt))}catch(e){}o.sample_rate=r.sampleRate,n.init();break;case k:n.pushBuffer(r.buffer,r.options);break;case S:o.decode(r.buffer,r.ts);break;case C:i.decode(r.buffer,r.ts);break;case P:n.close();break;case A:n.opt[r.key]=r.value}}}})); diff --git a/web-pages/public/favicon.ico b/web-pages/public/favicon.ico new file mode 100644 index 0000000..904c509 Binary files /dev/null and b/web-pages/public/favicon.ico differ diff --git a/web-pages/public/frontend-config-dev.json b/web-pages/public/frontend-config-dev.json new file mode 100644 index 0000000..c41f486 --- /dev/null +++ b/web-pages/public/frontend-config-dev.json @@ -0,0 +1,15 @@ +{ + "rkCsdjBackendUrl": "http://27.17.3.62:20629/rk-czrk-backend", + "rkKstbBackendUrl": "http://27.17.3.62:20626/rk-kstb-backend", + "sysId": "387f1f93-b5cb-46e4-9cb4-29146afa643a", + "axiosDefaultsBaseURL": "http://27.17.3.62:20626/rk-kstb-backend", + "ssoProxyLogoutPathname": "/kstb-nm/#/logout", + "ssoServerLoginUrl": "http://27.17.3.62:20601/sso-orcl/index.html#/nmgsj", + "rkSjdbBackendUrl": "http://27.17.3.62:20628/rk-sjdb-backend", + "kernelSupportBackendUrl": "http://27.17.3.62:20615/kernel-support-backend", + "rkCommonBackendUrl": "http://27.17.3.62:20625/rk-common-backend", + "ssoServerTokenUrl": "http://27.17.3.62:20612/sso-backend/token", + "rkHadoopDownLoadUrl": "http://27.17.3.62:20617/dfs/download", + "ssoServerLogoutUrl": "http://27.17.3.62:20601/sso-orcl/#/logout", + "rkConfigBackendUrl": "http://27.17.3.62:20624/rk-config-backend" +} diff --git a/web-pages/public/frontend-config-devmock.json b/web-pages/public/frontend-config-devmock.json new file mode 100644 index 0000000..75c289e --- /dev/null +++ b/web-pages/public/frontend-config-devmock.json @@ -0,0 +1,13 @@ +{ + "": "(必选)axios默认基础路径", + "axiosDefaultsBaseURL": "/api", + "": "(必选)单点登录服务前端的登录页面", + "ssoServerLoginUrl": "http://27.17.3.62:20201/user-center/biz/login/zfjd/login.html", + "": "(可选)单点登录服务前端的登出页面", + "ssoServerLogoutUrl": "http://27.17.3.62:20201/user-center/logout", + "": "(必选)单点登录服务后端的令牌地址", + "ssoServerTokenUrl": "http://27.17.3.62:20201/user-center/token", + "": "(可选)单点登录代理前端的登出页面", + "ssoProxyLogoutPathname": "/template-vue/#/logout", + "sysId": "387f1f93-b5cb-46e4-9cb4-29146afa643a" +} diff --git a/web-pages/public/frontend-config-prod.json b/web-pages/public/frontend-config-prod.json new file mode 100644 index 0000000..62e5ff6 --- /dev/null +++ b/web-pages/public/frontend-config-prod.json @@ -0,0 +1,13 @@ +{ + "": "(必选)axios默认基础路径", + "axiosDefaultsBaseURL": "http://10.73.93.232:8081/zfjfz-backend", + "": "(必选)单点登录服务前端的登录页面", + "ssoServerLoginUrl": "http://10.73.94.72/user-center/biz/login/zfjd/login.html", + "": "(可选)单点登录服务前端的登出页面", + "ssoServerLogoutUrl": "http://10.73.94.72/user-center/logout", + "": "(必选)单点登录服务后端的令牌地址", + "ssoServerTokenUrl": "http://10.73.94.72/user-center/token", + "": "(可选)单点登录代理前端的登出页面", + "ssoProxyLogoutPathname": "/template-vue/#/logout", + "sysId": "387f1f93-b5cb-46e4-9cb4-29146afa643a" +} diff --git a/web-pages/public/index.html b/web-pages/public/index.html new file mode 100644 index 0000000..89778f3 --- /dev/null +++ b/web-pages/public/index.html @@ -0,0 +1,35 @@ + + + + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + +

+ + + diff --git a/web-pages/public/index.js b/web-pages/public/index.js new file mode 100644 index 0000000..91e7593 --- /dev/null +++ b/web-pages/public/index.js @@ -0,0 +1,3 @@ +!function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function e(t){return t&&t.__esModule?t.default:t}function r(t,e,r){Object.defineProperty(t,e,{get:r,enumerable:!0})}var n,i,o=!1;function a(){return o||(o=!0,i=t=>{var e=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n"),n=t.createShader(t.VERTEX_SHADER);t.shaderSource(n,e),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+t.getShaderInfoLog(n));var i=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(i,r),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+t.getShaderInfoLog(i));var o=t.createProgram();t.attachShader(o,n),t.attachShader(o,i),t.linkProgram(o),t.getProgramParameter(o,t.LINK_STATUS)||console.log("Program failed to compile: "+t.getProgramInfoLog(o)),t.useProgram(o);var a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),t.STATIC_DRAW);var s=t.getAttribLocation(o,"vertexPos");t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0);var f=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferData(t.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),t.STATIC_DRAW);var u=t.getAttribLocation(o,"texturePos");function h(e,r){var n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.bindTexture(t.TEXTURE_2D,null),t.uniform1i(t.getUniformLocation(o,e),r),n}t.enableVertexAttribArray(u),t.vertexAttribPointer(u,2,t.FLOAT,!1,0,0);var c=h("ySampler",0),d=h("uSampler",1),l=h("vSampler",2);return function(e,r,n,i,o){t.viewport(0,0,e,r),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,c),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,e,r,0,t.LUMINANCE,t.UNSIGNED_BYTE,n),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,d),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,e/2,r/2,0,t.LUMINANCE,t.UNSIGNED_BYTE,i),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,l),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,e/2,r/2,0,t.LUMINANCE,t.UNSIGNED_BYTE,o),t.drawArrays(t.TRIANGLE_STRIP,0,4)}},r(n={},"default",(function(){return i}))),n}var s,f,u=!1;function h(){s={},a(),f=t=>{const e=document.createElement("canvas");e.style.position="absolute",e.style.top=0,e.style.left=0,t.$container.appendChild(e),t.$canvasElement=e,t.$container.style.overflow="hidden","absolute"!==t.$container.style.position&&(t.$container.style.position="relative");if(!t._supportOffscreen()){const e=(()=>{const e=t.$canvasElement;let r=null;const n=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let i=0;for(;!r&&i{t._contextGL&&(t._contextGL=null),t._contextGLRender&&(t._contextGLRender=null),t._bitmaprenderer&&(t._bitmaprenderer=null)}},r(s,"default",(function(){return f}))}function c(){return u||(u=!0,h()),s}var d,l,p,m,b,g,v=!1;function y(){return v||(v=!0,l={videoBuffer:.5,vod:!1,isResize:!0,isFullSize:!1,debug:!1,timeout:30,supportDblclickFullscreen:!1,showBandwidth:!1,keepScreenOn:!1,isNotMute:!1,hasAudio:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1},loadingText:"",background:"",decoder:"index.js",rotate:0,forceNoOffscreen:!1},r(d={},"DEFAULT_OPTIONS",(function(){return l})),p={init:"init",initSize:"initSize",render:"render",playAudio:"playAudio",print:"print",printErr:"printErr",initAudioPlanar:"initAudioPlanar",kBps:"kBps"},r(d,"CMD_TYPE",(function(){return p})),m={close:"close",play:"play",setVideoBuffer:"setVideoBuffer",init:"init"},r(d,"POST_MESSAGE",(function(){return m})),b={fullscreen:"fullscreen",play:"play",pause:"pause",mute:"mute",load:"load",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",stats:"stats",performance:"performance",record:"record",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata"},r(d,"EVEMTS",(function(){return b})),g={empty:"empty",buffering:"buffering",full:"full"},r(d,"BUFFER_STATUS",(function(){return g}))),d}var w,_=!1;function A(t){t.resume();const e=t.createBufferSource();e.buffer=t.createBuffer(1,1,22050),e.connect(t.destination),e.noteOn?e.noteOn(0):e.start(0)}function M(t,e){t&&(t.style.display=e?"block":"none")}function E(t=""){const e=t.split(","),r=atob(e[1]),n=e[0].replace("data:","").replace(";base64","");let i=r.length,o=new Uint8Array(i);for(;i--;)o[i]=r.charCodeAt(i);return new File([o],"file",{type:n})}function S(t,e){const r=document.createElement("a");r.download=e,r.href=URL.createObjectURL(t),r.click(),URL.revokeObjectURL(t)}function k(t){if(null==t||""===t)return"0 KB/S";let e=parseFloat(t);return e=e.toFixed(2),e+"KB/S"}function B(t){let e=0;return t>=24?e=2:t>=15&&(e=1),e}function T(t,e){Object.keys(e||{}).forEach((function(r){t.style[r]=e[r]}))}function R(){let t=document.fullscreenElement||window.webkitFullscreenElement||document.msFullscreenElement;return void 0===t&&(t=!1),!!t}function x(){}function C(){return(new Date).getTime()}function I(t){Object.keys(t||{}).forEach((e=>{"bgDom"!==e&&M(t[e],!1)}))}function D(t){M(t.pauseDom,!0),M(t.screenshotsDom,!0),M(t.fullscreenDom,!0),M(t.quietAudioDom,!0),M(t.textDom,!0),M(t.speedDom,!0),M(t.recordDom,!0),M(t.loadingDom,!1),M(t.playDom,!1),M(t.playBigDom,!1),M(t.bgDom,!1)}function P(t,e){let r=y().BUFFER_STATUS.buffering;return 0===t?r=y().BUFFER_STATUS.empty:t>=e&&(r=y().BUFFER_STATUS.full),r}function O(){return _||(_=!0,w={},y(),r(w,"audioContextUnlock",(function(){return A})),r(w,"$domToggle",(function(){return M})),r(w,"dataURLToFile",(function(){return E})),r(w,"downloadImg",(function(){return S})),r(w,"bpsSize",(function(){return k})),r(w,"fpsStatus",(function(){return B})),r(w,"setStyle",(function(){return T})),r(w,"checkFull",(function(){return R})),r(w,"noop",(function(){return x})),r(w,"now",(function(){return C})),r(w,"$hideBtns",(function(){return I})),r(w,"$initBtns",(function(){return D})),r(w,"bufferStatus",(function(){return P}))),w}var L,U,j=!1;function N(){return j||(j=!0,L={},O(),U=t=>{t._audioContext=new(window.AudioContext||window.webkitAudioContext),t._gainNode=t._audioContext.createGain(),t._audioEnabled=e=>{e?(O().audioContextUnlock(t._audioContext),t._audioEnabled=e=>{e?t._audioContext.resume():t._audioContext.suspend()},t._audioContext.resume()):t._audioContext.suspend()},t._audioEnabled(!0),t._mute=()=>{t._audioEnabled(!1),t.quieting=!0},t._cancelMute=()=>{t._audioEnabled(!0),t.quieting=!1},t._audioResume=()=>{t._cancelMute()},t._initAudioPlanar=e=>{const r=t._audioContext;if(!r)return!1;let n=[];const i=r.createScriptProcessor(1024,0,2);i.onaudioprocess=function(t){if(n.length){const r=n.shift();for(let n=0;n{i.disconnect(t._gainNode),t._gainNode.disconnect(r.destination),delete t._closeAudio,n=[]},t._gainNode.connect(r.destination),t._playAudio=t=>n.push(t)},t._destroyAudioContext=()=>{t._audioContext.close(),t._audioContext=null,t._gainNode=null}},r(L,"default",(function(){return U}))),L}var z,F,q=!1;function W(){return q||(q=!0,z={},O(),F=t=>{t._resize$2=()=>t.resize(),t._handleVisibilityChange$2=()=>t._handleVisibilityChange(),t._onfullscreenchange$2=()=>t._onfullscreenchange(),t._handleWakeLock$2=()=>t._handleWakeLock(),window.addEventListener("resize",t._resize$2),window.addEventListener("fullscreenchange",t._onfullscreenchange$2),document.addEventListener("visibilitychange",t._handleVisibilityChange$2),document.addEventListener("visibilitychange",t._handleWakeLock$2),window.addEventListener("fullscreenchange",t._handleWakeLock$2),t._opt.supportDblclickFullscreen&&t.$canvasElement.addEventListener("dblclick",(()=>{t.fullscreen=!t.fullscreen}),!1),t._removeEventListener=()=>{window.removeEventListener("resize",t._resize$2),window.removeEventListener("fullscreenchange",t._onfullscreenchange$2),document.removeEventListener("visibilitychange",t._handleWakeLock$2),document.removeEventListener("visibilitychange",t._handleVisibilityChange$2),window.removeEventListener("fullscreenchange",t._handleWakeLock$2)},t.$doms.playDom&&t.$doms.playDom.addEventListener("click",(e=>{e.stopPropagation(),t._play()}),!1),t.$doms.playBigDom&&t.$doms.playBigDom.addEventListener("click",(e=>{e.stopPropagation(),t._play()}),!1),t.$doms.pauseDom&&t.$doms.pauseDom.addEventListener("click",(e=>{e.stopPropagation(),t._pause()}),!1),t.$doms.screenshotsDom&&t.$doms.screenshotsDom.addEventListener("click",(e=>{e.stopPropagation();const r=t._opt.text+""+O().now();t._screenshot(r)}),!1),t.$doms.fullscreenDom&&t.$doms.fullscreenDom.addEventListener("click",(e=>{e.stopPropagation(),t.fullscreen=!0}),!1),t.$doms.minScreenDom&&t.$doms.minScreenDom.addEventListener("click",(e=>{e.stopPropagation(),t.fullscreen=!1}),!1),t.$doms.recordDom&&t.$doms.recordDom.addEventListener("click",(e=>{e.stopPropagation(),t.recording=!0}),!1),t.$doms.recordingDom&&t.$doms.recordingDom.addEventListener("click",(e=>{e.stopPropagation(),t.recording=!1}),!1),t.$doms.quietAudioDom&&t.$doms.quietAudioDom.addEventListener("click",(e=>{e.stopPropagation(),t._cancelMute()}),!1),t.$doms.playAudioDom&&t.$doms.playAudioDom.addEventListener("click",(e=>{e.stopPropagation(),t._mute()}),!1),t._enableWakeLock()},r(z,"default",(function(){return F}))),z}var H,G,Y=!1;function K(){return Y||(Y=!0,H={},O(),W(),G=t=>{t._showControl=()=>{let e=!1,r=!1;return Object.keys(t._opt.operateBtns).forEach((e=>{t._opt.operateBtns[e]&&(r=!0)})),(t._opt.showBandwidth||t._opt.text||r)&&(e=!0),e};const e={},r=document.createDocumentFragment(),n=document.createElement("div"),i=document.createElement("div"),o=document.createElement("div"),a=document.createElement("div"),s=document.createElement("div"),f=document.createElement("div"),u=document.createElement("div"),h=document.createElement("div"),c=document.createElement("div"),d=document.createElement("div"),l=document.createElement("div"),p=document.createElement("div"),m=document.createElement("div"),b=document.createElement("div"),g=document.createElement("div"),v=document.createElement("div"),y=document.createElement("div"),w=document.createElement("div");m.innerText=t._opt.loadingText||"",a.innerText=t._opt.text||"",s.innerText="",f.title="播放",h.title="暂停",c.title="截屏",d.title="全屏",l.title="退出全屏",b.title="静音",g.title="取消静音",v.title="录制",y.title="取消录制";let _={position:"absolute",width:"100%",height:"100%"};t._opt.background&&(_=Object.assign({},_,{backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"100%",backgroundImage:"url('"+t._opt.background+"')"}));const A={position:"absolute",width:"100%",height:"100%",textAlign:"center",color:"#fff",display:"none",backgroundImage:"url('data:image/gif;base64,R0lGODlhgACAAKIAAP///93d3bu7u5mZmQAA/wAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBQAEACwCAAIAfAB8AAAD/0i63P4wygYqmDjrzbtflvWNZGliYXiubKuloivPLlzReD7al+7/Eh5wSFQIi8hHYBkwHUmD6CD5YTJLz49USuVYraRsZ7vtar7XnQ1Kjpoz6LRHvGlz35O4nEPP2O94EnpNc2sef1OBGIOFMId/inB6jSmPdpGScR19EoiYmZobnBCIiZ95k6KGGp6ni4wvqxilrqBfqo6skLW2YBmjDa28r6Eosp27w8Rov8ekycqoqUHODrTRvXsQwArC2NLF29UM19/LtxO5yJd4Au4CK7DUNxPebG4e7+8n8iv2WmQ66BtoYpo/dvfacBjIkITBE9DGlMvAsOIIZjIUAixliv9ixYZVtLUos5GjwI8gzc3iCGghypQqrbFsme8lwZgLZtIcYfNmTJ34WPTUZw5oRxdD9w0z6iOpO15MgTh1BTTJUKos39jE+o/KS64IFVmsFfYT0aU7capdy7at27dw48qdS7eu3bt480I02vUbX2F/JxYNDImw4GiGE/P9qbhxVpWOI/eFKtlNZbWXuzlmG1mv58+gQ4seTbq06dOoU6vGQZJy0FNlMcV+czhQ7SQmYd8eMhPs5BxVdfcGEtV3buDBXQ+fURxx8oM6MT9P+Fh6dOrH2zavc13u9JXVJb520Vp8dvC76wXMuN5Sepm/1WtkEZHDefnzR9Qvsd9+/wi8+en3X0ntYVcSdAE+UN4zs7ln24CaLagghIxBaGF8kFGoIYV+Ybghh841GIyI5ICIFoklJsigihmimJOLEbLYIYwxSgigiZ+8l2KB+Ml4oo/w8dijjcrouCORKwIpnJIjMnkkksalNeR4fuBIm5UEYImhIlsGCeWNNJphpJdSTlkml1jWeOY6TnaRpppUctcmFW9mGSaZceYopH9zkjnjUe59iR5pdapWaGqHopboaYua1qije67GJ6CuJAAAIfkEBQUABAAsCgACAFcAMAAAA/9Iutz+ML5Ag7w46z0r5WAoSp43nihXVmnrdusrv+s332dt4Tyo9yOBUJD6oQBIQGs4RBlHySSKyczVTtHoidocPUNZaZAr9F5FYbGI3PWdQWn1mi36buLKFJvojsHjLnshdhl4L4IqbxqGh4gahBJ4eY1kiX6LgDN7fBmQEJI4jhieD4yhdJ2KkZk8oiSqEaatqBekDLKztBG2CqBACq4wJRi4PZu1sA2+v8C6EJexrBAD1AOBzsLE0g/V1UvYR9sN3eR6lTLi4+TlY1wz6Qzr8u1t6FkY8vNzZTxaGfn6mAkEGFDgL4LrDDJDyE4hEIbdHB6ESE1iD4oVLfLAqPETIsOODwmCDJlv5MSGJklaS6khAQAh+QQFBQAEACwfAAIAVwAwAAAD/0i63P5LSAGrvTjrNuf+YKh1nWieIumhbFupkivPBEzR+GnnfLj3ooFwwPqdAshAazhEGUXJJIrJ1MGOUamJ2jQ9QVltkCv0XqFh5IncBX01afGYnDqD40u2z76JK/N0bnxweC5sRB9vF34zh4gjg4uMjXobihWTlJUZlw9+fzSHlpGYhTminKSepqebF50NmTyor6qxrLO0L7YLn0ALuhCwCrJAjrUqkrjGrsIkGMW/BMEPJcphLgDaABjUKNEh29vdgTLLIOLpF80s5xrp8ORVONgi8PcZ8zlRJvf40tL8/QPYQ+BAgjgMxkPIQ6E6hgkdjoNIQ+JEijMsasNY0RQix4gKP+YIKXKkwJIFF6JMudFEAgAh+QQFBQAEACw8AAIAQgBCAAAD/kg0PPowykmrna3dzXvNmSeOFqiRaGoyaTuujitv8Gx/661HtSv8gt2jlwIChYtc0XjcEUnMpu4pikpv1I71astytkGh9wJGJk3QrXlcKa+VWjeSPZHP4Rtw+I2OW81DeBZ2fCB+UYCBfWRqiQp0CnqOj4J1jZOQkpOUIYx/m4oxg5cuAaYBO4Qop6c6pKusrDevIrG2rkwptrupXB67vKAbwMHCFcTFxhLIt8oUzLHOE9Cy0hHUrdbX2KjaENzey9Dh08jkz8Tnx83q66bt8PHy8/T19vf4+fr6AP3+/wADAjQmsKDBf6AOKjS4aaHDgZMeSgTQcKLDhBYPEswoA1BBAgAh+QQFBQAEACxOAAoAMABXAAAD7Ei6vPOjyUkrhdDqfXHm4OZ9YSmNpKmiqVqykbuysgvX5o2HcLxzup8oKLQQix0UcqhcVo5ORi+aHFEn02sDeuWqBGCBkbYLh5/NmnldxajX7LbPBK+PH7K6narfO/t+SIBwfINmUYaHf4lghYyOhlqJWgqDlAuAlwyBmpVnnaChoqOkpaanqKmqKgGtrq+wsbA1srW2ry63urasu764Jr/CAb3Du7nGt7TJsqvOz9DR0tPU1TIA2ACl2dyi3N/aneDf4uPklObj6OngWuzt7u/d8fLY9PXr9eFX+vv8+PnYlUsXiqC3c6PmUUgAACH5BAUFAAQALE4AHwAwAFcAAAPpSLrc/m7IAau9bU7MO9GgJ0ZgOI5leoqpumKt+1axPJO1dtO5vuM9yi8TlAyBvSMxqES2mo8cFFKb8kzWqzDL7Xq/4LB4TC6bz1yBes1uu9uzt3zOXtHv8xN+Dx/x/wJ6gHt2g3Rxhm9oi4yNjo+QkZKTCgGWAWaXmmOanZhgnp2goaJdpKGmp55cqqusrZuvsJays6mzn1m4uRAAvgAvuBW/v8GwvcTFxqfIycA3zA/OytCl0tPPO7HD2GLYvt7dYd/ZX99j5+Pi6tPh6+bvXuTuzujxXens9fr7YPn+7egRI9PPHrgpCQAAIfkEBQUABAAsPAA8AEIAQgAAA/lIutz+UI1Jq7026h2x/xUncmD5jehjrlnqSmz8vrE8u7V5z/m5/8CgcEgsGo/IpHLJbDqf0Kh0ShBYBdTXdZsdbb/Yrgb8FUfIYLMDTVYz2G13FV6Wz+lX+x0fdvPzdn9WeoJGAYcBN39EiIiKeEONjTt0kZKHQGyWl4mZdREAoQAcnJhBXBqioqSlT6qqG6WmTK+rsa1NtaGsuEu6o7yXubojsrTEIsa+yMm9SL8osp3PzM2cStDRykfZ2tfUtS/bRd3ewtzV5pLo4eLjQuUp70Hx8t9E9eqO5Oku5/ztdkxi90qPg3x2EMpR6IahGocPCxp8AGtigwQAIfkEBQUABAAsHwBOAFcAMAAAA/9Iutz+MMo36pg4682J/V0ojs1nXmSqSqe5vrDXunEdzq2ta3i+/5DeCUh0CGnF5BGULC4tTeUTFQVONYAs4CfoCkZPjFar83rBx8l4XDObSUL1Ott2d1U4yZwcs5/xSBB7dBMBhgEYfncrTBGDW4WHhomKUY+QEZKSE4qLRY8YmoeUfkmXoaKInJ2fgxmpqqulQKCvqRqsP7WooriVO7u8mhu5NacasMTFMMHCm8qzzM2RvdDRK9PUwxzLKdnaz9y/Kt8SyR3dIuXmtyHpHMcd5+jvWK4i8/TXHff47SLjQvQLkU+fG29rUhQ06IkEG4X/Rryp4mwUxSgLL/7IqFETB8eONT6ChCFy5ItqJomES6kgAQAh+QQFBQAEACwKAE4AVwAwAAAD/0i63A4QuEmrvTi3yLX/4MeNUmieITmibEuppCu3sDrfYG3jPKbHveDktxIaF8TOcZmMLI9NyBPanFKJp4A2IBx4B5lkdqvtfb8+HYpMxp3Pl1qLvXW/vWkli16/3dFxTi58ZRcChwIYf3hWBIRchoiHiotWj5AVkpIXi4xLjxiaiJR/T5ehoomcnZ+EGamqq6VGoK+pGqxCtaiiuJVBu7yaHrk4pxqwxMUzwcKbyrPMzZG90NGDrh/JH8t72dq3IN1jfCHb3L/e5ebh4ukmxyDn6O8g08jt7tf26ybz+m/W9GNXzUQ9fm1Q/APoSWAhhfkMAmpEbRhFKwsvCsmosRIHx444PoKcIXKkjIImjTzjkQAAIfkEBQUABAAsAgA8AEIAQgAAA/VIBNz+8KlJq72Yxs1d/uDVjVxogmQqnaylvkArT7A63/V47/m2/8CgcEgsGo/IpHLJbDqf0Kh0Sj0FroGqDMvVmrjgrDcTBo8v5fCZki6vCW33Oq4+0832O/at3+f7fICBdzsChgJGeoWHhkV0P4yMRG1BkYeOeECWl5hXQ5uNIAOjA1KgiKKko1CnqBmqqk+nIbCkTq20taVNs7m1vKAnurtLvb6wTMbHsUq4wrrFwSzDzcrLtknW16tI2tvERt6pv0fi48jh5h/U6Zs77EXSN/BE8jP09ZFA+PmhP/xvJgAMSGBgQINvEK5ReIZhQ3QEMTBLAAAh+QQFBQAEACwCAB8AMABXAAAD50i6DA4syklre87qTbHn4OaNYSmNqKmiqVqyrcvBsazRpH3jmC7yD98OCBF2iEXjBKmsAJsWHDQKmw571l8my+16v+CweEwum8+hgHrNbrvbtrd8znbR73MVfg838f8BeoB7doN0cYZvaIuMjY6PkJGSk2gClgJml5pjmp2YYJ6dX6GeXaShWaeoVqqlU62ir7CXqbOWrLafsrNctjIDwAMWvC7BwRWtNsbGFKc+y8fNsTrQ0dK3QtXAYtrCYd3eYN3c49/a5NVj5eLn5u3s6e7x8NDo9fbL+Mzy9/T5+tvUzdN3Zp+GBAAh+QQJBQAEACwCAAIAfAB8AAAD/0i63P4wykmrvTjrzbv/YCiOZGmeaKqubOu+cCzPdArcQK2TOL7/nl4PSMwIfcUk5YhUOh3M5nNKiOaoWCuWqt1Ou16l9RpOgsvEMdocXbOZ7nQ7DjzTaeq7zq6P5fszfIASAYUBIYKDDoaGIImKC4ySH3OQEJKYHZWWi5iZG0ecEZ6eHEOio6SfqCaqpaytrpOwJLKztCO2jLi1uoW8Ir6/wCHCxMG2x7muysukzb230M6H09bX2Nna29zd3t/g4cAC5OXm5+jn3Ons7eba7vHt2fL16tj2+QL0+vXw/e7WAUwnrqDBgwgTKlzIsKHDh2gGSBwAccHEixAvaqTYcFCjRoYeNyoM6REhyZIHT4o0qPIjy5YTTcKUmHImx5cwE85cmJPnSYckK66sSAAj0aNIkypdyrSp06dQo0qdSrWq1atYs2rdyrWr169gwxZJAAA7')",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"40px 40px"},M={position:"absolute",width:"100%",height:"100%",display:"none",background:"rgba(0,0,0,0.4)",backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAByBJREFUeNrlXFlIVV0U3vsaaINmZoX0YAR6y8oGMkKLoMESSjBoUJEoIogoIggigoryIQoKGqi3Roh6TKGBIkNEe6hMgzTNKLPSUlMrNdvrf/juurlP5zpc7znb+r+X755pn7W+Pe+9zpVimIEUKVKJiUIKKWRqKs5OmwZOTBQkSFBUFK5HR+tPt7WBOzpwX3U1jquqwGVleK6iQkoppSQy7a8xEBERLVwIPnsWXF9PrqCxEXzxInjpUrDH47YO0h2hw8JwtG4deN8+8OzZA0vl7Vt/iZZCCtnUhPPt7fp9o0fjvpgYHHu9uD8+Hsdsh52hggTV1uLg2DHwpUvSIz3S093ttE4hB5qSxYuRAc+f910im5vBFy6As7LALORQ7RgzBullZIBPngQ3NPRt1+vXeH7NGtN69u8oERFFRIDPnQMrZe8YZ0huLhwMDzdjb1gYC4zj4uKAeaFIkbpxAwfWvse48FOngp89s7eeS1p2Nlg63vQF7Y8iRWrlSthZXR2wZhAR0dy55gwlIqI5c8AfPtgbeuUKHIqKMi3soP3z1UzwiRP2NbqtDbxsmXuGacK3tOgG/fwJ3rbNtIDO+J2ZiQzp6ND97uzE+RUrHDaAmxprif/+HQasXm1aKKcBPxcsADc1/VEjFClS8+eH7oXcuSpSpJ480V/Y0wPOyjItjNtgofWmiPHuHa7Hxg79RUT0e1Rjxb/X1ASnDw9vf/3S9bl1K/iEFSlSixbZdz7Xr5t2fLgBuuTn2xfUjRsHmVBYGNg6gWpo+FtHNU4DuowYAZ3Ky+11GzOm/4SIiGjDBvuczM52zAHua4iI6OpVcGEheO1a8PCdP/j9CNRyKFKk9u4doBDWCRXXBOcE0GekgVBUhPuSk00LPTAdCwp0+3n0GBER4AFenbQiJ8cdg7dvpwGB5xunT4PHjTMtuL0/qan29q9fH+AB62jnyxe31moGlwFWNDbCzq1bcez+snLffr14odtrMzrCBet6/Pnz7hoabAZY8fgxT5iGRwbs36/b19kJHjnS49+BEkIIMXmy/vjt26YdCA4pKdgHKC2Fo5cvh2xiFBTu3NGPw8Ox/5CW5tG3/hi8VffokRmDQwUeNOTlwc/KSmRIbq67djx9Cm5p+W2akEKmpfnaSt5zZdTXY8+0udmQcg5h0iQwD3MfPgRPn+7UG6GjUjiqrNSver0eVIWEBP85EiSIN7H/dSxZAuY1roMHHRt02OqamOhrgnoN46SQQn76ZFoad8Hj8kOH4D/PZJOSQvYKW11jYnxNkHWK3NFhWhKz8HrB9+7xaCU06fYKIiBBgiIjfRlgHTf/j+NlNMTFgceOHXJSJEgQ9wXCVyOk9AlvLfEDWDT6X+DAAXSiHz8OOSkppJCRkfrJ9vYR+NHaql8wNV42jVevUFJ37kQ8kHX8PlRMmOD/SYIEtbZ69IAkvsATs38dP36ADx8GJyc7IzyD+xbhqxE1Nb4a8PKlfiE+HsOxyEgYZI1A+9tRUADetQtNTF2dU29CJ84Twhkz9KtVVb4+oKxMvxAWxjM101KFBvX1qNmbNkHwNWucFl4HT/QmTvSfIkGCSks9HC2MsxxzyTekp5uWLjh0dYHz88FeL2ry5ctm7LHq2NMD7rXUg6rC0cKM9+/BfQS1hghDXg1VpEjdvasvLpqHf3VWs/P+/QA3Lltm75jz8T7BZQAvn9tscJgWXpEiNWuWvd2bNwcQwONbnq6p0R8oLnYnA7Zs6Vvw7m7Yd/z4gDe5DQH2Xrum29/SwoObfh7cts1egFWrnDU4Lg785g2Ytx4LC2H4zJmmhe3XD5+dsJsD1xhHjgwwgfBwPFBXpydQXe3uFqXzfU9o7ZUSXFRkX/IHMcENGKXgixY27fBwA8TZudO+5dixY4gJ37xpyQVfvEtmpmnHTQMFMiUFevBeL6OkZMg1GQlER4P5wwTGt29g65bmvw/4HShanD+5mjIlxC+cNw/cKxqYw7RDHZY9TOEXXpEiVVurC8+jtJUrnTNAkSK1fDle2NWlG9DeDs7IMC2UM35zU2Mt8Urhel6eywalp+vCMzhM++hRDlo1LeCg/dNGNdy5Wtt4LvEuCv+HodqHCu/e2Y8Cyss5aNW0sAPzh8fx1uEkgyMGHWxqgjM8NhYGWoNSraMnvm6+89aXDHjmap1AMUpKcD9/+D2MAYNzcsD9fRDNsZMcwsedfehiPJFeUhJ4925wWVnfdvFHiDt2gEM/MXT+rwp47UMKKeT27Ti7Zw+YA6UCgbdKKyr8cTVSSCEbG3Ge/5yDwWtD48fjfv6rAl7C6LUeb4uvX8FnzuD5U6ewjP35s9M6uQaUJP4Qgz8E4SbJ2sk5BV5jevAAvHmzqS9/hs0XJxBi1CgOWtVjVnlHKSEB16Oj/wgoE0L8LsFcM169AldV8Q4UjouKULKtNch9/AdsEf6XQYgIsAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wMS0xMlQxMTo1NjowNSswODowMGcMj/QAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDEtMTJUMTE6NTY6MDUrMDg6MDAWUTdIAAAASXRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9ob21lL2FkbWluL2ljb24tZm9udC90bXAvaWNvbl9wZHMzeWYxNGczYi9ib2Zhbmcuc3Zn11us5wAAAABJRU5ErkJggg==')",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"48px 48px",cursor:"pointer"},E={position:"absolute",top:0,height:"100%",display:"flex",alignItems:"center"},S={display:"none",position:"relative",fontSize:"13px",color:"#fff",lineHeight:"20px",marginLeft:"5px",marginRight:"5px",userSelect:"none"},k={display:"none",position:"relative",width:"16px",height:"16px",marginLeft:"8px",marginRight:"8px",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"100%",cursor:"pointer"};O().setStyle(w,_),O().setStyle(n,{height:"38px",zIndex:11,position:"absolute",left:0,bottom:0,width:"100%",background:"rgba(0,0,0)"}),O().setStyle(p,A),O().setStyle(u,M),O().setStyle(m,{position:"absolute",width:"100%",top:"60%",textAlign:"center"}),O().setStyle(i,Object.assign({},E,{left:0})),O().setStyle(o,Object.assign({},E,{right:0})),O().setStyle(a,S),O().setStyle(s,S),O().setStyle(f,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAARVJREFUSMe9laEOglAUhs+5k9lJFpsJ5QWMJoNGbEY0mEy+gr6GNo0a3SiQCegMRILzGdw4hl+Cd27KxPuXb2zA/91z2YXoGRERkX4fvN3A2QxUiv4dFM3n8jZRBLbbVfd+ubJuF4xjiCyXkksueb1uSKCIZYGLBTEx8ekEoV7PkICeVgs8HiGyXoO2bUigCDM4HoPnM7bI8wwJ6Gk0sEXbLSay30Oo2TQkoGcwgFCSQMhxDAvoETEscDiQkJC4LjMz8+XyZ4HrFYWjEQqHQ1asWGWZfmdFAsVINxuw00HhbvfpydpvxWkKTqdYaRCUfUPJCdzv4Gr1uqfli0tOIAzByUT/iCrL6+84y3Bw+D6ui5Ou+jwA8FnIO++FACgAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDEtMDhUMTY6NDI6NTMrMDg6MDCKP7wnAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTAxLTA4VDE2OjQyOjUzKzA4OjAw+2IEmwAAAEl0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vaG9tZS9hZG1pbi9pY29uLWZvbnQvdG1wL2ljb25fZ2Y3MDBzN2IzZncvYm9mYW5nLnN2Z8fICi0AAAAASUVORK5CYII=')"})),O().setStyle(h,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAAHVJREFUSMftkCESwCAMBEOnCtdXVMKHeC7oInkEeQJXkRoEZWraipxZc8lsQqQZBACAlIS1oqGhhTCdu3oyxyyMcdRf79c5J7SWDBky+z4173rbJvR+VF/e/qwKqIAKqMBDgZyFzAQCoZTpxq7HLDyOrw/9b07l3z4dDnI2IAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wMS0wOFQxNjo0Mjo1MyswODowMIo/vCcAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDEtMDhUMTY6NDI6NTMrMDg6MDD7YgSbAAAASnRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9ob21lL2FkbWluL2ljb24tZm9udC90bXAvaWNvbl9nZjcwMHM3YjNmdy96YW50aW5nLnN2ZxqNZJkAAAAASUVORK5CYII=')"})),O().setStyle(c,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAAaxJREFUSMfNlLFOAkEQhmevAZMjR6OGRBJKsFBzdkYNpYSaWkopIOFRCBWh1ieA+ALGRgutjK0HzV2H5SX7W/zsmY3cnTEhcZovOzcz9+/s7Ir8d4OGht7fBwAgjvEri2OTl1ffSf0xAMBxRIkS1e3Se3+vcszEMe/6OqmT/aN2m1wsNu/o5YVsNHI7BgA4PCRfXzfXCwKy1RLbcXZG9nrkzc12jvT8nPU/PtatOThgAx8fuS4WyZ0de2e+T87n5OcnuVqRsxl5cpImQDnKUc7DA1fVqpimZCu+vCSjiNH9PlmpJNTQ0INBErfeafZRAakC6FWKfH9nwU7H/l6rGdqCOx3y7c3U+aOARsMMp+1vNskwTLjulB23XJL1epqA9OshIiKeJxAIoug7UyA4OuLi6Ynr52deu+NjOy4MSc9Ln8rMDpTLybBpaOjdXbJUIqdTm8a/t2fn/RSQewR24HicTLmGhnbdzcPquvYtGY3+PIR24UKBUXd35v6Sk4lN47+9NXm/FBAEedfGTjw9JYdDm76fm6+hoS8ujGAxT6L9Im7bTKeurvIEb92+AES1b6x283XSAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTAxLTA4VDE2OjQyOjUzKzA4OjAwij+8JwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wMS0wOFQxNjo0Mjo1MyswODowMPtiBJsAAABJdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uX2dmNzAwczdiM2Z3L2NhbWVyYS5zdmeyubWEAAAAAElFTkSuQmCC')"})),O().setStyle(d,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAALZJREFUSMftVbsORUAQVSj8DomChvh3lU5CoSVCQq2RObeYu8XG3deVoHCak81kds7Oaz3vxRcAAMwztOg6vX9d6/3XFQQC+b7iAoFhYE7Tvx9EIFAcy/ftO3MQGAQkCfM4MmeZWyajiLnvmYuCeduMAuSzvRBVYNluFHCssSgFp7Sq9ALKkjnPf9ubRtkDL27HNT3QtsY9cAjsNAVheHIKBOwD2wpxFHDbJpwmaHH2L1iWx+2BDy8RbXXtqbRBAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTAxLTA4VDE2OjQyOjUzKzA4OjAwij+8JwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wMS0wOFQxNjo0Mjo1MyswODowMPtiBJsAAABTdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uX2dmNzAwczdiM2Z3L3F1YW5waW5nenVpZGFodWEuc3ZnTBoI7AAAAABJRU5ErkJggg==')"})),O().setStyle(l,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAAYJJREFUSMfdVbGKwkAQnQn+geAfWBixUTsVgp3YGKxSWflVNmIjARULwc5KO40ipNHWRgs/wGLniucKa+Jd5ODuuGle5u3szGRmd5bor4iIiMhuB3Sc+HXXBdp2/Lpta7v4dccRJUrUdhtNQIkSVa3C8HwG1uumg34f2OnEB+h0tF1Sv5b+YIsttpZLEhKSdhvscPi8IXFF74GJiYnHY7Cex8zMvFgkbInjmJnv98kqoO30vmhLtaRMB60WtEbDNDudgMUiKiQSzfjOMzFxoQAyCPSfw7/nQZ/PUYnpNGV6OR6BmYzJbzYIoBQCzGaRBDQvJCTdLnTLolg5HN5t6f8V1h/oUT4PrVKJWBotmEzQw+vV3J9Ow851P2/BaoX9Yfh0BrJZYKlk8uUyHOpDeLuBHwzMBJtN2PV6IPUhXK9Nf5cLMAxfluanrmGkRBggtRo03wfq66P/6CsJAnOg+f6rgfZI4BGYiYlHIx048eR6krcnq34kkj1GuVz8+jceo9+SD5A8yGh8CTq7AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTAxLTA4VDE2OjQyOjUzKzA4OjAwij+8JwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wMS0wOFQxNjo0Mjo1MyswODowMPtiBJsAAABNdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uX2dmNzAwczdiM2Z3L3p1aXhpYW9odWEuc3ZnoCFr0AAAAABJRU5ErkJggg==')"})),O().setStyle(b,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAAR9JREFUSMfVlD0LglAYhe9VkwgNihpsjbYQf4JTS7+iuaGxpcGfJjS0NFRLk2NDi6MogafhJGRIX9yEzvJwrx/nvPd9VYh/F3LkyBuN2g3J1QoAgCQhPe/Hxq5Lo+0WlfJ9dYYAgGaTDAIyy/BUnwcwWJlhcLnZkN2ugIBAuy2kkEL2ep8F73S4kjfFcfn6cMj9KLodrWVBiXyf75tMyOOR+4MBOZ8XLXzorboA5UpnM/J0Ivd7+vX7xX2asqGpVKtFXi5sqWmypXefrfIWAACmU/JwKCoun8hu9zA0uk6u13wgirg+n7+bAcsibbt6SB3n9TQXPxwAwHJJpum7M6BcDDQa0SgMaw9QPkJNIxcLMo4ZcDz+eYDqQFLWbqxKV57EtW1WtMbmAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTAxLTA4VDE2OjQyOjUzKzA4OjAwij+8JwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wMS0wOFQxNjo0Mjo1MyswODowMPtiBJsAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uX2dmNzAwczdiM2Z3L2ppbmd5aW4uc3ZnIlMYaQAAAABJRU5ErkJggg==')"})),O().setStyle(g,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAAU5JREFUSMftkzGKwlAURf9PULBQwULSCKK1bZAgNuoaFFyAC3AdZg0uQCwshWzAShEEO7Gy0soUCu9Occ3An5nMGCfdzGsO7+Xy3/03iVL/lbAAACiVIBCI77O37Vi9QCDZbEqLm03ycEBUAoHk818v7nYpul5Jz4tf8HBKYa1mcjwmbzd8rG8NFIsU7ffk8UjmcjE3XK+RtB4G2PT75GbDeblMttumfjSKMRCGLxsQCKTReE9KIJDJxDw/SmKxiOZWWh+ntrSlre2WXRAorbTSrZapip7X66kbMKtQUFBQCENznsmQ93vqBhh5r8fO85jAcsnIrcce1yV3uxgD8zl5uZgU+dGBVlrp6GbTKRPwffaDAek45Gz2/M0AAJ0OeTol+w0rFYrOZ3K1MhNJEjEAwHF4cBA8Z8B1zcXV6msv+JMR2yaHQ1LrXx/8Z+sNRxsWcwZeb6UAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDEtMDhUMTY6NDI6NTMrMDg6MDCKP7wnAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTAxLTA4VDE2OjQyOjUzKzA4OjAw+2IEmwAAAEt0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vaG9tZS9hZG1pbi9pY29uLWZvbnQvdG1wL2ljb25fZ2Y3MDBzN2IzZncvc2hlbmd5aW4uc3ZnFog1MQAAAABJRU5ErkJggg==')"})),O().setStyle(v,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAAPRJREFUSMflVDEOwjAQO0e8gr2sZYVunREbD6ISfAgmkBjpC/hBEQ+AtTWD6QAI0gBlqRfLp+TiXC5n1nXgMUCS5HBoNBqj6IOMMFwuEpsNAABl6d3HihWrOJaBsuRPkGW+c929HAxuYefb6L+R0ZgkMrJYiItCnCT1sl5Y1jwXj0bNniJNJWqujfX7LyrwJh8AYDxWgulU0dPp20IFlxoODm61kpE4VnS9/puBXyPYgH7LbKY3PhwUnUw+NdC4CdW9+71UgyZspwIBB9No3O0klktxUahyx+Pz+lYG0Xzu84lXRqTqwRQAGAzns8R223gUdxZXGcAK5Hp0ClIAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDEtMDhUMTY6NDI6NTMrMDg6MDCKP7wnAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTAxLTA4VDE2OjQyOjUzKzA4OjAw+2IEmwAAAE50RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vaG9tZS9hZG1pbi9pY29uLWZvbnQvdG1wL2ljb25fZ2Y3MDBzN2IzZncvbHV6aGlzaGlwaW4uc3Zn5Zd7GQAAAABJRU5ErkJggg==')"})),O().setStyle(y,Object.assign({},k,{backgroundImage:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAAahJREFUSMdjYBjpgBFd4NZK+f+soQYG//T+yzFuUFUl2cApjEWM/758UZvysPDn3127GBkZGBgY/v4l6ICb9xTWsRbp6/9f9W8N44Jz5xgCGI4wfGFiIttrR/5n/3/U3KyR8rj8t0RdHS5lcAv+//yXzzhZTY1ii2FAmsGZocna+maD3GnWY62tNzbJBbDOffLkxie5eJYwa2uYMhaigzb2/zyGguPH/y9mTGKYYGlJUIMiYxDjHCen/4oMDAxznJzg4k8Z/jP+l5LCCAFCQP30Y5dfXVZWDI7/zzIs8PNjNGJ4/7/r+XNKA4rkoNZ4/lj0V9TmzUxJv0J+F+jrM3YyvPq/acsWujmA2oBkB9y4LifLxhoa+teAzYFtwtWr/8sZxBj9fHxo7oCbprJ72MqOHWNgZGBkYFy1isGGoZahTFSU0hAgOhcQnfph4P7/df9T9u1jPMn4nyHmxIn/bAzLGe7GxTHsZyj+f+zpUwYGBmmG6bQsiMr+L/v/rqlJY9Njm9889fW4lGEUxXCHwAomUgH3vxBG8c+f1WWf9P98sns3oaJ4FAAAbtWqHTT84QYAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDEtMDhUMTY6MzU6MjMrMDg6MDBLHbvEAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTAxLTA4VDE2OjM1OjIzKzA4OjAwOkADeAAAAE50RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vaG9tZS9hZG1pbi9pY29uLWZvbnQvdG1wL2ljb25fcTM1YTFhNHBtY2MvbHV6aGlzaGlwaW4uc3Zn6xlv1QAAAABJRU5ErkJggg==')"})),p.appendChild(m),t._opt.text&&(i.appendChild(a),e.textDom=a),t._opt.showBandwidth&&(i.appendChild(s),e.speedDom=s),t._opt.operateBtns.record&&(o.appendChild(y),o.appendChild(v),e.recordingDom=y,e.recordDom=v),t._opt.operateBtns.screenshot&&(o.appendChild(c),e.screenshotsDom=c),t._opt.operateBtns.play&&(o.appendChild(f),o.appendChild(h),e.playDom=f,e.pauseDom=h),t._opt.operateBtns.audio&&(o.appendChild(g),o.appendChild(b),e.playAudioDom=g,e.quietAudioDom=b),t._opt.operateBtns.fullscreen&&(o.appendChild(d),o.appendChild(l),e.fullscreenDom=d,e.minScreenDom=l),n.appendChild(i),n.appendChild(o),r.appendChild(w),e.bgDom=w,r.appendChild(p),e.loadingDom=p,t._showControl()&&r.appendChild(n),t._opt.operateBtns.play&&(r.appendChild(u),e.playBigDom=u),t.$container.appendChild(r),t.$doms=e,t._removeContainerChild=()=>{for(;t.$container.firstChild;)t.$container.removeChild(t.$container.firstChild)},W().default(t),O().$hideBtns(t.$doms),t._opt.isNotMute||t._mute()},r(H,"default",(function(){return G}))),H}var V,Z,$=!1;function X(){return $||($=!0,V={},y(),O(),Z=t=>{const e=new Worker(t._opt.decoder);e.onmessage=r=>{const n=r.data;switch(n.cmd){case y().CMD_TYPE.init:t.setBufferTime(t._opt.videoBuffer),e.postMessage({cmd:y().POST_MESSAGE.init,opt:JSON.stringify(t._opt),sampleRate:t._audioContext.sampleRate}),t._hasLoaded||(t._hasLoaded=!0,t.onLoad(),t._trigger(y().EVEMTS.load));break;case y().CMD_TYPE.initSize:t.$canvasElement.width=n.w,t.$canvasElement.height=n.h,t.onInitSize(),t._resize(),t._trigger(y().EVEMTS.videoInfo,{w:n.w,h:n.h}),t._trigger(y().EVEMTS.start),t._supportOffscreen()&&(t._bitmaprenderer=t.$canvasElement.getContext("bitmaprenderer"));break;case y().CMD_TYPE.render:t.loading&&(t.loading=!1,t.playing=!0,t._clearCheckLoading()),t.playing&&(t._supportOffscreen()?t._bitmaprenderer.transferFromImageBitmap(n.buffer):t._contextGLRender(t.$canvasElement.width,t.$canvasElement.height,n.output[0],n.output[1],n.output[2])),t._trigger(y().EVEMTS.timeUpdate,n.ts),t.onTimeUpdate(n.ts),t._updateStats({buf:n.delay,ts:n.ts}),t._checkHeart();break;case y().CMD_TYPE.playAudio:t.playing&&!t.quieting&&t._playAudio(n.buffer);break;case y().CMD_TYPE.print:t.onLog(n.text),t._trigger(y().EVEMTS.log,n.text);break;case y().CMD_TYPE.printErr:t.onLog(n.text),t._trigger(y().EVEMTS.log,n.text),t.onError(n.text),t._trigger(y().EVEMTS.error,n.text);break;case y().CMD_TYPE.initAudioPlanar:t._initAudioPlanar(n),t._trigger(y().EVEMTS.audioInfo,{numOfChannels:n.channels,sampleRate:n.samplerate});break;case y().CMD_TYPE.kBps:t.playing&&(t.$doms.speedDom&&(t.$doms.speedDom.innerText=O().bpsSize(n.kBps)),t._trigger(y().EVEMTS.kBps,n.kBps));default:t[n.cmd]&&t[n.cmd](n)}},t._decoderWorker=e},r(V,"default",(function(){return Z}))),V}var J,Q,tt=!1;function et(){return tt||(tt=!0,J={},O(),y(),Q=t=>{t._loading=!0,t._recording=!1,t._playing=!1,t._audioPlaying=!1,t._quieting=!1,t._fullscreen=!1,t._stats={buf:0,fps:0,abps:"",vbps:"",ts:""},t._hasLoaded=!1,t._playUrl="",t._startBpsTime="",t._bps=0,t._checkHeartTimeout=null,t._wakeLock=null,t._contextGL=null,t._contextGLRender=null,t._checkLoadingTimeout=null,t._bitmaprenderer=null,t._isPlayingBeforePageHidden=!1,t._initCheckVariable=()=>{t._startBpsTime="",t._bps=0,t._clearCheckHeartTimeout(),t._clearCheckLoading()},t._clearCheckHeartTimeout=()=>{t._checkHeartTimeout&&(clearTimeout(t._checkHeartTimeout),t._checkHeartTimeout=null)},t._startCheckHeartTimeout=()=>{t._checkHeartTimeout=setTimeout((function(){t._trigger(y().EVEMTS.timeout),t.recording=!1,t.playing=!1,t._close()}),1e3*t._opt.timeout)},t._clearCheckLoading=()=>{t._checkLoadingTimeout&&(clearTimeout(t._checkLoadingTimeout),t._checkLoadingTimeout=null)},t._checkLoading=()=>{t._clearCheckLoading(),t._checkLoadingTimeout=setTimeout((()=>{t._trigger(y().EVEMTS.timeout),t.playing=!1,t._close(),O().$domToggle(t.$doms.loadingDom,!1)}),1e3*t._opt.timeout)}},r(J,"default",(function(){return Q}))),J}var rt,nt,it=!1;function ot(){return it||(it=!0,rt={},O(),nt=t=>{t.onPlay=O().noop,t.onPause=O().noop,t.onRecord=O().noop,t.onFullscreen=O().noop,t.onMute=O().noop,t.onLoad=O().noop,t.onLog=O().noop,t.onError=O().noop,t.onTimeUpdate=O().noop,t.onInitSize=O().noop},r(rt,"default",(function(){return nt}))),rt}var at,st,ft=!1;function ut(){return ft||(ft=!0,st=t=>{t._on=(e,r)=>{let n,i,o;if(!r)return t;for(n=t.__events||(t.__events={}),e=e.split(/\s+/);i=e.shift();)o=n[i]||(n[i]=[]),o.push(r);return t},t._off=()=>{let e;return(e=t.__events)?(delete t.__events,t):t},t._trigger=(e,...r)=>{function n(t,e){if(t)for(let r=0,n=t.length;r{t._pause=()=>{t._close(),t.loading&&O().$domToggle(t.$doms.loadingDom,!1),t.recording=!1,t.playing=!1},t._play=e=>{if(!t._playUrl&&!e)return;let r=!1;e?(t._playUrl&&(t._close(),r=!0,t.clearView()),t.loading=!0,O().$domToggle(t.$doms.bgDom,!1),t._checkLoading(),t._playUrl=e):t._playUrl&&(t.loading?(O().$hideBtns(t.$doms),O().$domToggle(t.$doms.fullscreenDom,!0),O().$domToggle(t.$doms.pauseDom,!0),O().$domToggle(t.$doms.loadingDom,!0),t._checkLoading()):t.playing=!0),t._initCheckVariable(),r?setTimeout((()=>{t._decoderWorker.postMessage({cmd:y().POST_MESSAGE.play,url:t._playUrl})}),300):t._decoderWorker.postMessage({cmd:y().POST_MESSAGE.play,url:t._playUrl})},t._screenshot=(e,r,n)=>{e=e||O().now();const i={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let o=.92;void 0!==n&&(o=Number(n));const a=t.$canvasElement.toDataURL(i[r]||i.png,o);O().downloadImg(O().dataURLToFile(a),e)},t._close=()=>{t._close$2(),t._clearView()},t._close$2=()=>{t._opt.debug&&console.log("_close$2-START"),t._closeAudio&&t._closeAudio(),t._audioPlayBuffers=[],t._audioPlaying=!1,t._decoderWorker.postMessage({cmd:y().POST_MESSAGE.close}),delete t._playAudio,t._releaseWakeLock(),t._initCheckVariable(),t._opt.debug&&console.log("_close$2-END")},t._releaseWakeLock=()=>{t._wakeLock&&(t._wakeLock.release(),t._wakeLock=null)},t._clearView=()=>{t._contextGL&&t._contextGL.clear(t._contextGL.COLOR_BUFFER_BIT)},t._resize=()=>{let e=t.$container.clientWidth,r=t.$container.clientHeight;t._showControl()&&(r-=38);let n=t.$canvasElement.width,i=t.$canvasElement.height;const o=t._opt.rotate;let a=(e-n)/2,s=(r-i)/2;270!==o&&90!==o||(n=t.$canvasElement.height,i=t.$canvasElement.width);let f=e/n,u=r/i,h=f>u?u:f;t._opt.isResize||f!==u&&(h=f+","+u),t._opt.isFullResize&&(h=f>u?f:u);let c="scale("+h+")";o&&(c+=" rotate("+o+"deg)"),t.$canvasElement.style.transform=c,t.$canvasElement.style.left=a+"px",t.$canvasElement.style.top=s+"px"},t._enableWakeLock=()=>{t._opt.keepScreenOn&&"wakeLock"in navigator&&navigator.wakeLock.request("screen").then((e=>{t._wakeLock=e}))},t._supportOffscreen=()=>!t._opt.forceNoOffscreen&&"function"==typeof t.$canvasElement.transferControlToOffscreen,t._checkHeart=()=>{t._clearCheckHeartTimeout(),t._startCheckHeartTimeout()},t._updateStats=e=>{e=e||{},t._startBpsTime||(t._startBpsTime=O().now());const r=O().now();r-t._startBpsTime<1e3?t._stats.fps+=1:(t._stats.ts=e.ts,t._stats.buf=e.buf,t._trigger(y().EVEMTS.stats,t._stats),t._trigger(y().EVEMTS.performance,O().fpsStatus(t._stats.fps)),t._trigger(y().EVEMTS.buffer,O().bufferStatus(t._stats.buf,1e3*t._opt.videoBuffer)),t._stats.fps=0,t._startBpsTime=r)},t._onfullscreenchange=()=>{(void 0).fullscreen=O().checkFull()},t._handleVisibilityChange=()=>{t._opt.debug&&console.log(document.visibilityState,t._isPlayingBeforePageHidden),"visible"===document.visibilityState?t._isPlayingBeforePageHidden&&t._play():(t._isPlayingBeforePageHidden=t.playing,t.playing&&t._pause())},t._handleWakeLock=()=>{null!==t._wakeLock&&"visible"===document.visibilityState&&t._enableWakeLock()}},r(ht,"default",(function(){return ct}))),ht}var pt,mt,bt=!1;function gt(){return bt||(bt=!0,pt={},et(),ot(),ut(),lt(),mt=t=>{et().default(t),ot().default(t),ut().default(t),lt().default(t)},r(pt,"default",(function(){return mt}))),pt}var vt,yt=!1;var wt,_t,At,Mt,Et,St,kt,Bt,Tt=!1;function Rt(){throw new Error("setTimeout has not been defined")}function xt(){throw new Error("clearTimeout has not been defined")}function Ct(t){if(At===setTimeout)return setTimeout(t,0);if((At===Rt||!At)&&setTimeout)return At=setTimeout,setTimeout(t,0);try{return At(t,0)}catch(e){try{return At.call(null,t,0)}catch(e){return At.call(this,t,0)}}}function It(){St&&kt&&(St=!1,kt.length?Et=kt.concat(Et):Bt=-1,Et.length&&Dt())}function Dt(){if(!St){var t=Ct(It);St=!0;for(var e=Et.length;e;){for(kt=Et,Et=[];++Bt1)for(var r=1;r0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function Kt(t){var e,r,n=Yt(t),i=n[0],o=n[1],a=new Ft(function(t,e,r){return 3*(e+r)/4-r}(0,i,o)),s=0,f=o>0?i-4:i;for(r=0;r>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===o&&(e=zt[t.charCodeAt(r)]<<2|zt[t.charCodeAt(r+1)]>>4,a[s++]=255&e),1===o&&(e=zt[t.charCodeAt(r)]<<10|zt[t.charCodeAt(r+1)]<<4|zt[t.charCodeAt(r+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a}function Vt(t,e,r){for(var n,i,o=[],a=e;a>18&63]+Nt[i>>12&63]+Nt[i>>6&63]+Nt[63&i]);return o.join("")}function Zt(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,s=r-n;as?s:a+o));return 1===n?(e=t[r-1],i.push(Nt[e>>2]+Nt[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(Nt[e>>10]+Nt[e>>4&63]+Nt[e<<2&63]+"=")),i.join("")}function $t(){return Gt||(Gt=!0,function(){for((Ut={}).toByteArray=Kt,jt=Zt,Ut.fromByteArray=jt,Nt=[],zt=[],Ft="undefined"!=typeof Uint8Array?Uint8Array:Array,Wt=0,Ht=(qt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").length;Wt*/ +(Xt={}).read=function(t,e,r,n,i){var o,a,s=8*i-n-1,f=(1<>1,h=-7,c=r?i-1:0,d=r?-1:1,l=t[e+c];for(c+=d,o=l&(1<<-h)-1,l>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=d,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=d,h-=8);if(0===o)o=1-u;else{if(o===f)return a?NaN:1/0*(l?-1:1);a+=Math.pow(2,n),o-=u}return(l?-1:1)*a*Math.pow(2,o-n)},Jt=function(t,e,r,n,i,o){var a,s,f,u=8*o-i-1,h=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+c>=1?d/f:d*Math.pow(2,1-c))*f>=2&&(a++,f/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*f-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+l]=255&s,l+=p,s/=256,i-=8);for(a=a<0;t[r+l]=255&a,l+=p,a/=256,u-=8);t[r+l-p]|=128*m},Xt.write=Jt),Xt}var ee,re,ne,ie,oe,ae,se,fe,ue,he=!1;function ce(t){if(t>oe)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,de.prototype),e}function de(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return me(t)}return le(t,e,r)}function le(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!de.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|we(t,e),n=ce(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(He(t,Uint8Array)){var e=new Uint8Array(t);return ge(e.buffer,e.byteOffset,e.byteLength)}return be(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(He(t,ArrayBuffer)||t&&He(t.buffer,ArrayBuffer))return ge(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(He(t,SharedArrayBuffer)||t&&He(t.buffer,SharedArrayBuffer)))return ge(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return de.from(n,e,r);var i=function(t){if(de.isBuffer(t)){var e=0|ve(t.length),r=ce(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||Ge(t.length)?ce(0):be(t);if("Buffer"===t.type&&Array.isArray(t.data))return be(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return de.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function pe(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function me(t){return pe(t),ce(t<0?0:0|ve(t))}function be(t){for(var e=t.length<0?0:0|ve(t.length),r=ce(e),n=0;n=oe)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oe.toString(16)+" bytes");return 0|t}function ye(t){return+t!=t&&(t=0),de.alloc(+t)}function we(t,e){if(de.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||He(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Fe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return qe(t).length;default:if(i)return n?-1:Fe(t).length;e=(""+e).toLowerCase(),i=!0}}function _e(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Pe(this,e,r);case"utf8":case"utf-8":return Ce(this,e,r);case"ascii":return Ie(this,e,r);case"latin1":case"binary":return De(this,e,r);case"base64":return xe(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function Ae(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Me(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Ge(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=de.from(e,n)),de.isBuffer(e))return 0===e.length?-1:Ee(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ee(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Ee(t,e,r,n,i){var o,a=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,f/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var h=-1;for(o=r;os&&(r=s-f),o=r;o>=0;o--){for(var c=!0,d=0;di&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function xe(t,e,r){return 0===e&&r===t.length?$t().fromByteArray(t):$t().fromByteArray(t.slice(e,r))}function Ce(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(h=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&u)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(h=f);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&f<1114112&&(h=f)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=se)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function Ue(t,e,r,n,i,o){if(!de.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function je(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Ne(t,e,r,n,i){return e=+e,r>>>=0,i||je(t,0,r,4),te().write(t,e,r,n,23,4),r+4}function ze(t,e,r,n,i){return e=+e,r>>>=0,i||je(t,0,r,8),te().write(t,e,r,n,52,8),r+8}function Fe(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function qe(t){return $t().toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(fe,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function We(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function He(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Ge(t){return t!=t}function Ye(){ee={},$t(),te(),re="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null,ne=de,ee.Buffer=ne,ie=ye,ee.SlowBuffer=ie,50,ee.INSPECT_MAX_BYTES=50,ae=oe=2147483647,ee.kMaxLength=ae,de.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),de.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(de.prototype,"parent",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.buffer}}),Object.defineProperty(de.prototype,"offset",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.byteOffset}}),de.poolSize=8192,de.from=function(t,e,r){return le(t,e,r)},Object.setPrototypeOf(de.prototype,Uint8Array.prototype),Object.setPrototypeOf(de,Uint8Array),de.alloc=function(t,e,r){return function(t,e,r){return pe(t),t<=0?ce(t):void 0!==e?"string"==typeof r?ce(t).fill(e,r):ce(t).fill(e):ce(t)}(t,e,r)},de.allocUnsafe=function(t){return me(t)},de.allocUnsafeSlow=function(t){return me(t)},de.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==de.prototype},de.compare=function(t,e){if(He(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),He(e,Uint8Array)&&(e=de.from(e,e.offset,e.byteLength)),!de.isBuffer(t)||!de.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);in.length?de.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!de.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},de.byteLength=we,de.prototype._isBuffer=!0,de.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e50&&(t+=" ... "),""},re&&(de.prototype[re]=de.prototype.inspect),de.prototype.compare=function(t,e,r,n,i){if(He(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),!de.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),f=this.slice(n,i),u=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return Se(this,t,e,r);case"utf8":case"utf-8":return ke(this,t,e,r);case"ascii":case"latin1":case"binary":return Be(this,t,e,r);case"base64":return Te(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Re(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},de.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},se=4096,de.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||Le(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||Le(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},de.prototype.readUint8=de.prototype.readUInt8=function(t,e){return t>>>=0,e||Le(t,1,this.length),this[t]},de.prototype.readUint16LE=de.prototype.readUInt16LE=function(t,e){return t>>>=0,e||Le(t,2,this.length),this[t]|this[t+1]<<8},de.prototype.readUint16BE=de.prototype.readUInt16BE=function(t,e){return t>>>=0,e||Le(t,2,this.length),this[t]<<8|this[t+1]},de.prototype.readUint32LE=de.prototype.readUInt32LE=function(t,e){return t>>>=0,e||Le(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},de.prototype.readUint32BE=de.prototype.readUInt32BE=function(t,e){return t>>>=0,e||Le(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},de.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||Le(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},de.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||Le(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},de.prototype.readInt8=function(t,e){return t>>>=0,e||Le(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},de.prototype.readInt16LE=function(t,e){t>>>=0,e||Le(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},de.prototype.readInt16BE=function(t,e){t>>>=0,e||Le(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},de.prototype.readInt32LE=function(t,e){return t>>>=0,e||Le(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},de.prototype.readInt32BE=function(t,e){return t>>>=0,e||Le(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},de.prototype.readFloatLE=function(t,e){return t>>>=0,e||Le(t,4,this.length),te().read(this,t,!0,23,4)},de.prototype.readFloatBE=function(t,e){return t>>>=0,e||Le(t,4,this.length),te().read(this,t,!1,23,4)},de.prototype.readDoubleLE=function(t,e){return t>>>=0,e||Le(t,8,this.length),te().read(this,t,!0,52,8)},de.prototype.readDoubleBE=function(t,e){return t>>>=0,e||Le(t,8,this.length),te().read(this,t,!1,52,8)},de.prototype.writeUintLE=de.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||Ue(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n)||Ue(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},de.prototype.writeUint8=de.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,1,255,0),this[e]=255&t,e+1},de.prototype.writeUint16LE=de.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},de.prototype.writeUint16BE=de.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},de.prototype.writeUint32LE=de.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},de.prototype.writeUint32BE=de.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},de.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);Ue(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},de.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);Ue(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},de.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},de.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},de.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},de.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},de.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Ue(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},de.prototype.writeFloatLE=function(t,e,r){return Ne(this,t,e,!0,r)},de.prototype.writeFloatBE=function(t,e,r){return Ne(this,t,e,!1,r)},de.prototype.writeDoubleLE=function(t,e,r){return ze(this,t,e,!0,r)},de.prototype.writeDoubleBE=function(t,e,r){return ze(this,t,e,!1,r)},de.prototype.copy=function(t,e,r,n){if(!de.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o2){var f=n.lastIndexOf("/");if(f!==n.length-1){-1===f?(n="",i=0):i=(n=n.slice(0,f)).length-1-n.lastIndexOf("/"),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}function Qe(){return $e||($e=!0,Ve={},Lt(),(Ze={resolve:function(){for(var t,e="",r=!1,n=arguments.length-1;n>=-1&&!r;n--){var i;n>=0?i=arguments[n]:(void 0===t&&(t=Lt().cwd()),i=t),Xe(i),0!==i.length&&(e=i+"/"+e,r=47===i.charCodeAt(0))}return e=Je(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(Xe(t),0===t.length)return".";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=Je(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return Xe(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":Ze.normalize(t)},relative:function(t,e){if(Xe(t),Xe(e),t===e)return"";if((t=Ze.resolve(t))===(e=Ze.resolve(e)))return"";for(var r=1;rs){if(47===e.charCodeAt(o+u))return e.slice(o+u+1);if(0===u)return e.slice(o+u)}else i>s&&(47===t.charCodeAt(r+u)?f=u:0===u&&(f=0));break}var h=t.charCodeAt(r+u);if(h!==e.charCodeAt(o+u))break;47===h&&(f=u)}var c="";for(u=r+f+1;u<=n;++u)u!==n&&47!==t.charCodeAt(u)||(0===c.length?c+="..":c+="/..");return c.length>0?c+e.slice(o+f):(o+=f,47===e.charCodeAt(o)&&++o,e.slice(o))},_makeLong:function(t){return t},dirname:function(t){if(Xe(t),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,n=-1,i=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"//":t.slice(0,n)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');Xe(t);var r,n=0,i=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var a=e.length-1,s=-1;for(r=t.length-1;r>=0;--r){var f=t.charCodeAt(r);if(47===f){if(!o){n=r+1;break}}else-1===s&&(o=!1,s=r+1),a>=0&&(f===e.charCodeAt(a)?-1==--a&&(i=r):(a=-1,i=s))}return n===i?i=s:-1===i&&(i=t.length),t.slice(n,i)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!o){n=r+1;break}}else-1===i&&(o=!1,i=r+1);return-1===i?"":t.slice(n,i)},extname:function(t){Xe(t);for(var e=-1,r=0,n=-1,i=!0,o=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s)-1===n&&(i=!1,n=a+1),46===s?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){r=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+t+n:n}("/",t)},parse:function(t){Xe(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var r,n=t.charCodeAt(0),i=47===n;i?(e.root="/",r=1):r=0;for(var o=-1,a=0,s=-1,f=!0,u=t.length-1,h=0;u>=r;--u)if(47!==(n=t.charCodeAt(u)))-1===s&&(f=!1,s=u+1),46===n?-1===o?o=u:1!==h&&(h=1):-1!==o&&(h=-1);else if(!f){a=u+1;break}return-1===o||-1===s||0===h||1===h&&o===s-1&&o===a+1?-1!==s&&(e.base=e.name=0===a&&i?t.slice(1,s):t.slice(a,s)):(0===a&&i?(e.name=t.slice(1,o),e.base=t.slice(1,s)):(e.name=t.slice(a,o),e.base=t.slice(a,s)),e.ext=t.slice(o,s)),a>0?e.dir=t.slice(0,a-1):i&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null}).posix=Ze,Ve=Ze),Ve}var tr,er=!1;function rr(){return er||(er=!0,tr={}),tr}var nr,ir,or,ar,sr=!1;function fr(t,e){for(var r in t)e[r]=t[r]}function ur(t,e,r){return ar(t,e,r)}function hr(){return sr||(sr=!0,nr={},or=Ke(),(ar=or.Buffer).from&&ar.alloc&&ar.allocUnsafe&&ar.allocUnsafeSlow?nr=or:(fr(or,nr),ir=ur,nr.Buffer=ir),ur.prototype=Object.create(ar.prototype),fr(ar,ur),ur.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return ar(t,e,r)},ur.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=ar(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},ur.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return ar(t)},ur.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return or.SlowBuffer(t)}),nr}var cr,dr,lr,pr,mr,br=!1;function gr(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function vr(t,e){if(t>lr)throw new RangeError("requested too many random bytes");var r=pr.allocUnsafe(t);if(t>0)if(t>dr)for(var n=0;n0&&a.length>i&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=a.length,s=f,console&&console.warn&&console.warn(s)}return t}function Pr(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Or(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Pr.bind(n);return i.listener=r,n.wrapFn=i,i}function Lr(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[t];if(void 0===s)return!1;if("function"==typeof s)Sr(s,this,e);else{var f=s.length,u=jr(s,f);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},xr.prototype.listeners=function(t){return Lr(this,t,!0)},xr.prototype.rawListeners=function(t){return Lr(this,t,!1)},xr.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):Ur.call(t,e)},xr.prototype.listenerCount=Ur,xr.prototype.eventNames=function(){return this._eventsCount>0?kr(this._events):[]}),Mr}var zr,Fr=!1;function qr(){return Fr||(Fr=!0,zr={},zr=Nr().EventEmitter),zr}var Wr,Hr,Gr,Yr,Kr=!1;function Vr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Zr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $r(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return Hr.alloc(0);for(var e,r,n,i=Hr.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,Hr.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return ti.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=Hr.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:Yr,value:function(t,e){return Gr(this,function(t){for(var e=1;e2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}function pn(){return cn||(cn=!0,fn={},un={},dn("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),dn("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,o,a;if("string"==typeof e&&(i="not ",e.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(n," ").concat(ln(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(ln(e,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),dn("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),dn("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),dn("ERR_STREAM_PREMATURE_CLOSE","Premature close"),dn("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),dn("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),dn("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),dn("ERR_STREAM_WRITE_AFTER_END","write after end"),dn("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),dn("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),dn("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),hn=un,fn.codes=hn),fn}var mn,bn,gn=!1;function vn(t,e,r,n){var i=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new bn(n?r:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}function yn(){return gn||(gn=!0,mn={},bn=pn().codes.ERR_INVALID_OPT_VALUE,mn={getHighWaterMark:vn}),mn}var wn,_n=!1;function An(t,e){if(Mn("noDeprecation"))return t;var r=!1;return function(){if(!r){if(Mn("throwDeprecation"))throw new Error(e);Mn("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}function Mn(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}function En(){return _n||(_n=!0,wn={},wn=An),wn}var Sn,kn,Bn,Tn,Rn,xn,Cn,In,Dn,Pn,On,Ln,Un,jn,Nn,zn,Fn,qn,Wn=!1;function Hn(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}function Gn(){}function Yn(t,e,r){kn=kn||li(),t=t||{},"boolean"!=typeof r&&(r=e instanceof kn),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=Cn(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=!1===t.decodeStrings;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new On;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(Lt().nextTick(i,n),Lt().nextTick(ti,t,e),t._writableState.errorEmitted=!0,Fn(t,n)):(i(n),t._writableState.errorEmitted=!0,Fn(t,n),ti(t,e))}(t,r,n,e,i);else{var o=Jn(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||Xn(t,r),n?Lt().nextTick($n,t,r,o,i):$n(t,r,o,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Hn(this)}function Kn(t){var e=this instanceof(kn=kn||li());if(!e&&!qn.call(Kn,this))return new Kn(t);this._writableState=new Yn(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),Tn.call(this)}function Vn(t,e,r,n,i,o){if(!r){var a=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=Rn.from(e,r)),e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var f=e.length-1))throw new zn(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Kn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Kn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Kn.prototype._write=function(t,e,r){r(new Pn("_write()"))},Kn.prototype._writev=null,Kn.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,ti(t,e),r&&(e.finished?Lt().nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(Kn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Kn.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),Kn.prototype.destroy=sn().destroy,Kn.prototype._undestroy=sn().undestroy,Kn.prototype._destroy=function(t,e){e(t)}}function ri(){return Wn||(Wn=!0,ei()),Sn}var ni,ii,oi,ai,si,fi,ui=!1;function hi(t){if(!(this instanceof hi))return new hi(t);oi.call(this,t),ri().call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",ci)))}function ci(){this._writableState.ended||Lt().nextTick(di,this)}function di(t){t.end()}function li(){return ui||(ui=!0,function(){for(ni={},Lt(),ii=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e},ni=hi,oi=Go(),ri(),Ar()(hi,oi),ai=ii(ri().prototype),si=0;si>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function _i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function Ai(t,e){var r=function(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Mi(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function Ei(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Si(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function ki(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Bi(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Ti(t){return t.toString(this.encoding)}function Ri(t){return t&&t.length?this.write(t):""}function xi(){return vi||(vi=!0,pi={},mi=hr().Buffer,bi=mi.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},gi=yi,pi.StringDecoder=gi,yi.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===fo.prototype||(e=function(t){return fo.from(t)}(e)),n)a.endEmitted?Mo(t,new yo):xo(t,a,e,!0);else if(a.ended)Mo(t,new go);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?xo(t,a,e,!1):Po(t,a)):xo(t,a,e,!1)}else n||(a.reading=!1,Po(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=So?t=So:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function Io(t){var e=t._readableState;co("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(co("emitReadable",e.flowing),e.emittedReadable=!0,Lt().nextTick(Do,t))}function Do(t){var e=t._readableState;co("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,No(t)}function Po(t,e){e.readingMore||(e.readingMore=!0,Lt().nextTick(Oo,t,e))}function Oo(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function Uo(t){co("readable nexttick read 0"),t.read(0)}function jo(t,e){co("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),No(t),e.flowing&&!e.reading&&t.read(0)}function No(t){var e=t._readableState;for(co("flow",e.flowing);e.flowing&&null!==t.read(););}function zo(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function Fo(t){var e=t._readableState;co("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Lt().nextTick(qo,e,t))}function qo(t,e){if(co("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function Wo(t,e){for(var r=0,n=t.length;r=e.highWaterMark:e.length>0)||e.ended))return co("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?Fo(this):Io(this),null;if(0===(t=Co(t,e))&&e.ended)return 0===e.length&&Fo(this),null;var n,i=e.needReadable;return co("need readable",i),(0===e.length||e.length-t0?zo(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Fo(this)),null!==n&&this.emit("data",n),n},To.prototype._read=function(t){Mo(this,new vo("_read()"))},To.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,co("pipe count=%d opts=%j",n.pipesCount,e);var i=(!e||!1!==e.end)&&t!==Lt().stdout&&t!==Lt().stderr?a:l;function o(e,i){co("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,co("cleanup"),t.removeListener("close",c),t.removeListener("finish",d),t.removeListener("drain",s),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",l),r.removeListener("data",u),f=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||s())}function a(){co("onend"),t.end()}n.endEmitted?Lt().nextTick(i):r.once("end",i),t.on("unpipe",o);var s=function(t){return function(){var e=t._readableState;co("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&ao(t,"data")&&(e.flowing=!0,No(t))}}(r);t.on("drain",s);var f=!1;function u(e){co("ondata");var i=t.write(e);co("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==Wo(n.pipes,t))&&!f&&(co("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(e){co("onerror",e),l(),t.removeListener("error",h),0===ao(t,"error")&&Mo(t,e)}function c(){t.removeListener("finish",d),l()}function d(){co("onfinish"),t.removeListener("close",c),l()}function l(){co("unpipe"),r.unpipe(t)}return r.on("data",u),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",h),t.once("close",c),t.once("finish",d),t.emit("pipe",r),n.flowing||(co("pipe resume"),r.resume()),t},To.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,co("on readable",n.length,n.reading),n.length?Io(this):n.reading||Lt().nextTick(Uo,this))),r},To.prototype.addListener=To.prototype.on,To.prototype.removeListener=function(t,e){var r=so.prototype.removeListener.call(this,t,e);return"readable"===t&&Lt().nextTick(Lo,this),r},To.prototype.removeAllListeners=function(t){var e=so.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||Lt().nextTick(Lo,this),e},To.prototype.resume=function(){var t=this._readableState;return t.flowing||(co("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Lt().nextTick(jo,t,e))}(this,t)),t.paused=!1,this},To.prototype.pause=function(){return co("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(co("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},To.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(co("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(co("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o0,(function(t){n||(n=t),t&&o.forEach(va),a||(o.forEach(va),i(n))}))}));return e.reduce(ya)}function Aa(){return ma||(ma=!0,ha={},da=pn().codes,la=da.ERR_MISSING_ARGS,pa=da.ERR_STREAM_DESTROYED,ha=_a),ha}var Ma,Ea,Sa,ka,Ba,Ta,Ra,xa,Ca,Ia,Da=!1;function Pa(){return Da||(Da=!0,Ea={},Ma=Ea=Go(),Sa=Ma,Ea.Stream=Sa,ka=Ma,Ea.Readable=ka,Ba=ri(),Ea.Writable=Ba,Ta=li(),Ea.Duplex=Ta,Ra=ia(),Ea.Transform=Ra,xa=ua(),Ea.PassThrough=xa,Ca=Li(),Ea.finished=Ca,Ia=Aa(),Ea.pipeline=Ia),Ea}var Oa,La,Ua,ja=!1;function Na(t){Ua.call(this),this._block=La.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}function za(){Oa={},La=hr().Buffer,Ua=Pa().Transform,Ar()(Na,Ua),Na.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},Na.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},Na.prototype.update=function(t,e){if(function(t,e){if(!La.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");La.isBuffer(t)||(t=La.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},Na.prototype._update=function(){throw new Error("_update is not implemented")},Na.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},Na.prototype._digest=function(){throw new Error("_digest is not implemented")},Oa=Na}function Fa(){return ja||(ja=!0,za()),Oa}var qa,Wa,Ha,Ga,Ya,Ka=!1;function Va(){Ha.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Za(t,e){return t<>>32-e}function $a(t,e,r,n,i,o,a){return Za(t+(e&r|~e&n)+i+o|0,a)+e|0}function Xa(t,e,r,n,i,o,a){return Za(t+(e&n|r&~n)+i+o|0,a)+e|0}function Ja(t,e,r,n,i,o,a){return Za(t+(e^r^n)+i+o|0,a)+e|0}function Qa(t,e,r,n,i,o,a){return Za(t+(r^(e|~n))+i+o|0,a)+e|0}function ts(){return Ka||(Ka=!0,qa={},Wa=Ar(),Ha=Fa(),Ga=hr().Buffer,Ya=new Array(16),Wa(Va,Ha),Va.prototype._update=function(){for(var t=Ya,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=$a(r,n,i,o,t[0],3614090360,7),o=$a(o,r,n,i,t[1],3905402710,12),i=$a(i,o,r,n,t[2],606105819,17),n=$a(n,i,o,r,t[3],3250441966,22),r=$a(r,n,i,o,t[4],4118548399,7),o=$a(o,r,n,i,t[5],1200080426,12),i=$a(i,o,r,n,t[6],2821735955,17),n=$a(n,i,o,r,t[7],4249261313,22),r=$a(r,n,i,o,t[8],1770035416,7),o=$a(o,r,n,i,t[9],2336552879,12),i=$a(i,o,r,n,t[10],4294925233,17),n=$a(n,i,o,r,t[11],2304563134,22),r=$a(r,n,i,o,t[12],1804603682,7),o=$a(o,r,n,i,t[13],4254626195,12),i=$a(i,o,r,n,t[14],2792965006,17),r=Xa(r,n=$a(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=Xa(o,r,n,i,t[6],3225465664,9),i=Xa(i,o,r,n,t[11],643717713,14),n=Xa(n,i,o,r,t[0],3921069994,20),r=Xa(r,n,i,o,t[5],3593408605,5),o=Xa(o,r,n,i,t[10],38016083,9),i=Xa(i,o,r,n,t[15],3634488961,14),n=Xa(n,i,o,r,t[4],3889429448,20),r=Xa(r,n,i,o,t[9],568446438,5),o=Xa(o,r,n,i,t[14],3275163606,9),i=Xa(i,o,r,n,t[3],4107603335,14),n=Xa(n,i,o,r,t[8],1163531501,20),r=Xa(r,n,i,o,t[13],2850285829,5),o=Xa(o,r,n,i,t[2],4243563512,9),i=Xa(i,o,r,n,t[7],1735328473,14),r=Ja(r,n=Xa(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=Ja(o,r,n,i,t[8],2272392833,11),i=Ja(i,o,r,n,t[11],1839030562,16),n=Ja(n,i,o,r,t[14],4259657740,23),r=Ja(r,n,i,o,t[1],2763975236,4),o=Ja(o,r,n,i,t[4],1272893353,11),i=Ja(i,o,r,n,t[7],4139469664,16),n=Ja(n,i,o,r,t[10],3200236656,23),r=Ja(r,n,i,o,t[13],681279174,4),o=Ja(o,r,n,i,t[0],3936430074,11),i=Ja(i,o,r,n,t[3],3572445317,16),n=Ja(n,i,o,r,t[6],76029189,23),r=Ja(r,n,i,o,t[9],3654602809,4),o=Ja(o,r,n,i,t[12],3873151461,11),i=Ja(i,o,r,n,t[15],530742520,16),r=Qa(r,n=Ja(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=Qa(o,r,n,i,t[7],1126891415,10),i=Qa(i,o,r,n,t[14],2878612391,15),n=Qa(n,i,o,r,t[5],4237533241,21),r=Qa(r,n,i,o,t[12],1700485571,6),o=Qa(o,r,n,i,t[3],2399980690,10),i=Qa(i,o,r,n,t[10],4293915773,15),n=Qa(n,i,o,r,t[1],2240044497,21),r=Qa(r,n,i,o,t[8],1873313359,6),o=Qa(o,r,n,i,t[15],4264355552,10),i=Qa(i,o,r,n,t[6],2734768916,15),n=Qa(n,i,o,r,t[13],1309151649,21),r=Qa(r,n,i,o,t[4],4149444226,6),o=Qa(o,r,n,i,t[11],3174756917,10),i=Qa(i,o,r,n,t[2],718787259,15),n=Qa(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},Va.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=Ga.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},qa=Va),qa}var es,rs,ns,is,os,as,ss,fs,us,hs,cs,ds=!1;function ls(){is.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function ps(t,e){return t<>>32-e}function ms(t,e,r,n,i,o,a,s){return ps(t+(e^r^n)+o+a|0,s)+i|0}function bs(t,e,r,n,i,o,a,s){return ps(t+(e&r|~e&n)+o+a|0,s)+i|0}function gs(t,e,r,n,i,o,a,s){return ps(t+((e|~r)^n)+o+a|0,s)+i|0}function vs(t,e,r,n,i,o,a,s){return ps(t+(e&n|r&~n)+o+a|0,s)+i|0}function ys(t,e,r,n,i,o,a,s){return ps(t+(e^(r|~n))+o+a|0,s)+i|0}function ws(){return ds||(ds=!0,es={},rs=Ke().Buffer,ns=Ar(),is=Fa(),os=new Array(16),as=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ss=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],fs=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],us=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hs=[0,1518500249,1859775393,2400959708,2840853838],cs=[1352829926,1548603684,1836072691,2053994217,0],ns(ls,is),ls.prototype._update=function(){for(var t=os,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,f=0|this._b,u=0|this._c,h=0|this._d,c=0|this._e,d=0;d<80;d+=1){var l,p;d<16?(l=ms(r,n,i,o,a,t[as[d]],hs[0],fs[d]),p=ys(s,f,u,h,c,t[ss[d]],cs[0],us[d])):d<32?(l=bs(r,n,i,o,a,t[as[d]],hs[1],fs[d]),p=vs(s,f,u,h,c,t[ss[d]],cs[1],us[d])):d<48?(l=gs(r,n,i,o,a,t[as[d]],hs[2],fs[d]),p=gs(s,f,u,h,c,t[ss[d]],cs[2],us[d])):d<64?(l=vs(r,n,i,o,a,t[as[d]],hs[3],fs[d]),p=bs(s,f,u,h,c,t[ss[d]],cs[3],us[d])):(l=ys(r,n,i,o,a,t[as[d]],hs[4],fs[d]),p=ms(s,f,u,h,c,t[ss[d]],cs[4],us[d])),r=a,a=o,o=ps(i,10),i=n,n=l,s=c,c=h,h=ps(u,10),u=f,f=p}var m=this._b+i+h|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+r+f|0,this._e=this._a+n+u|0,this._a=m},ls.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=rs.alloc?rs.alloc(20):new rs(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},es=ls),es}var _s,As,Ms=!1;function Es(t,e){this._block=As.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}function Ss(){return Ms||(Ms=!0,_s={},As=hr().Buffer,Es.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=As.from(t,e));for(var r=this._block,n=this._blockSize,i=t.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},Es.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_s=Es),_s}var ks,Bs,Ts,Rs,xs,Cs,Is=!1;function Ds(){this.init(),this._w=Cs,Ts.call(this,64,56)}function Ps(t){return t<<30|t>>>2}function Os(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}function Ls(){return Is||(Is=!0,ks={},Bs=Ar(),Ts=Ss(),Rs=hr().Buffer,xs=[1518500249,1859775393,-1894007588,-899497514],Cs=new Array(80),Bs(Ds,Ts),Ds.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ds.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=r[f-3]^r[f-8]^r[f-14]^r[f-16];for(var u=0;u<80;++u){var h=~~(u/20),c=0|((e=n)<<5|e>>>27)+Os(h,i,o,a)+s+r[u]+xs[h];s=a,a=o,o=Ps(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Ds.prototype._hash=function(){var t=Rs.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},ks=Ds),ks}var Us,js,Ns,zs,Fs,qs,Ws=!1;function Hs(){this.init(),this._w=qs,Ns.call(this,64,56)}function Gs(t){return t<<5|t>>>27}function Ys(t){return t<<30|t>>>2}function Ks(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}function Vs(){return Ws||(Ws=!0,Us={},js=Ar(),Ns=Ss(),zs=hr().Buffer,Fs=[1518500249,1859775393,-1894007588,-899497514],qs=new Array(80),js(Hs,Ns),Hs.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Hs.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=(e=r[f-3]^r[f-8]^r[f-14]^r[f-16])<<1|e>>>31;for(var u=0;u<80;++u){var h=~~(u/20),c=Gs(n)+Ks(h,i,o,a)+s+r[u]+Fs[h]|0;s=a,a=o,o=Ys(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Hs.prototype._hash=function(){var t=zs.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},Us=Hs),Us}var Zs,$s,Xs,Js,Qs,tf,ef=!1;function rf(){this.init(),this._w=tf,Xs.call(this,64,56)}function nf(t,e,r){return r^t&(e^r)}function of(t,e,r){return t&e|r&(t|e)}function af(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function sf(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function ff(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function uf(){return ef||(ef=!0,Zs={},$s=Ar(),Xs=Ss(),Js=hr().Buffer,Qs=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],tf=new Array(64),$s(rf,Xs),rf.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},rf.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,f=0|this._f,u=0|this._g,h=0|this._h,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<64;++c)r[c]=0|(((e=r[c-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[c-7]+ff(r[c-15])+r[c-16];for(var d=0;d<64;++d){var l=h+sf(s)+nf(s,f,u)+Qs[d]+r[d]|0,p=af(n)+of(n,i,o)|0;h=u,u=f,f=s,s=a+l|0,a=o,o=i,i=n,n=l+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=f+this._f|0,this._g=u+this._g|0,this._h=h+this._h|0},rf.prototype._hash=function(){var t=Js.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},Zs=rf),Zs}var hf,cf,df,lf,pf,mf=!1;function bf(){this.init(),this._w=pf,Ss().call(this,64,56)}function gf(){return mf||(mf=!0,hf={},cf=Ar(),df=uf(),Ss(),lf=hr().Buffer,pf=new Array(64),cf(bf,df),bf.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},bf.prototype._hash=function(){var t=lf.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},hf=bf),hf}var vf,yf,wf,_f,Af,Mf,Ef=!1;function Sf(){this.init(),this._w=Mf,wf.call(this,128,112)}function kf(t,e,r){return r^t&(e^r)}function Bf(t,e,r){return t&e|r&(t|e)}function Tf(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Rf(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function xf(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Cf(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function If(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Df(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function Pf(t,e){return t>>>0>>0?1:0}function Of(){return Ef||(Ef=!0,vf={},yf=Ar(),wf=Ss(),_f=hr().Buffer,Af=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Mf=new Array(160),yf(Sf,wf),Sf.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sf.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,f=0|this._gh,u=0|this._hh,h=0|this._al,c=0|this._bl,d=0|this._cl,l=0|this._dl,p=0|this._el,m=0|this._fl,b=0|this._gl,g=0|this._hl,v=0;v<32;v+=2)e[v]=t.readInt32BE(4*v),e[v+1]=t.readInt32BE(4*v+4);for(;v<160;v+=2){var y=e[v-30],w=e[v-30+1],_=xf(y,w),A=Cf(w,y),M=If(y=e[v-4],w=e[v-4+1]),E=Df(w,y),S=e[v-14],k=e[v-14+1],B=e[v-32],T=e[v-32+1],R=A+k|0,x=_+S+Pf(R,A)|0;x=(x=x+M+Pf(R=R+E|0,E)|0)+B+Pf(R=R+T|0,T)|0,e[v]=x,e[v+1]=R}for(var C=0;C<160;C+=2){x=e[C],R=e[C+1];var I=Bf(r,n,i),D=Bf(h,c,d),P=Tf(r,h),O=Tf(h,r),L=Rf(a,p),U=Rf(p,a),j=Af[C],N=Af[C+1],z=kf(a,s,f),F=kf(p,m,b),q=g+U|0,W=u+L+Pf(q,g)|0;W=(W=(W=W+z+Pf(q=q+F|0,F)|0)+j+Pf(q=q+N|0,N)|0)+x+Pf(q=q+R|0,R)|0;var H=O+D|0,G=P+I+Pf(H,O)|0;u=f,g=b,f=s,b=m,s=a,m=p,a=o+W+Pf(p=l+q|0,l)|0,o=i,l=d,i=n,d=c,n=r,c=h,r=W+G+Pf(h=q+H|0,q)|0}this._al=this._al+h|0,this._bl=this._bl+c|0,this._cl=this._cl+d|0,this._dl=this._dl+l|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+b|0,this._hl=this._hl+g|0,this._ah=this._ah+r+Pf(this._al,h)|0,this._bh=this._bh+n+Pf(this._bl,c)|0,this._ch=this._ch+i+Pf(this._cl,d)|0,this._dh=this._dh+o+Pf(this._dl,l)|0,this._eh=this._eh+a+Pf(this._el,p)|0,this._fh=this._fh+s+Pf(this._fl,m)|0,this._gh=this._gh+f+Pf(this._gl,b)|0,this._hh=this._hh+u+Pf(this._hl,g)|0},Sf.prototype._hash=function(){var t=_f.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},vf=Sf),vf}var Lf,Uf,jf,Nf,zf,Ff=!1;function qf(){this.init(),this._w=zf,Ss().call(this,128,112)}function Wf(){return Ff||(Ff=!0,Lf={},Uf=Ar(),jf=Of(),Ss(),Nf=hr().Buffer,zf=new Array(160),Uf(qf,jf),qf.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},qf.prototype._hash=function(){var t=Nf.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},Lf=qf),Lf}var Hf,Gf,Yf=!1;function Kf(){return Yf||(Yf=!0,Hf={},(Gf=Hf=function(t){t=t.toLowerCase();var e=Gf[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e}).sha=Ls(),Gf.sha1=Vs(),Gf.sha224=gf(),Gf.sha256=uf(),Gf.sha384=Wf(),Gf.sha512=Of()),Hf}var Vf,Zf,$f,Xf,Jf=!1;function Qf(t){$f.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}function tu(){return Jf||(Jf=!0,Vf={},Zf=hr().Buffer,$f=Pa().Transform,Xf=xi().StringDecoder,Ar()(Qf,$f),Qf.prototype.update=function(t,e,r){"string"==typeof t&&(t=Zf.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},Qf.prototype.setAutoPadding=function(){},Qf.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},Qf.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},Qf.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},Qf.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},Qf.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},Qf.prototype._finalOrDigest=function(t){var e=this.__final()||Zf.alloc(0);return t&&(e=this._toString(e,t,!0)),e},Qf.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new Xf(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},Vf=Qf),Vf}var eu,ru,nu,iu,ou,au,su=!1;function fu(t){au.call(this,"digest"),this._hash=t}function uu(){return su||(su=!0,eu={},ru=Ar(),nu=ts(),iu=ws(),ou=Kf(),au=tu(),ru(fu,au),fu.prototype._update=function(t){this._hash.update(t)},fu.prototype._final=function(){return this._hash.digest()},eu=function(t){return"md5"===(t=t.toLowerCase())?new nu:"rmd160"===t||"ripemd160"===t?new iu:new fu(ou(t))}),eu}var hu,cu,du,lu,pu,mu,bu=!1;function gu(t,e){lu.call(this,"digest"),"string"==typeof e&&(e=du.from(e)),this._alg=t,this._key=e,e.length>mu?e=t(e):e.lengthr)?e=("rmd160"===t?new Ru:xu(t)).update(e).digest():e.lengthqu||e!=e)throw new TypeError("Bad key length")}),Fu}var Gu,Yu,Ku,Vu=!1;function Zu(){return Vu||(Vu=!0,Gu={},Lt(),t.process&&t.process.browser?Yu="utf-8":t.process&&t.process.version?(Ku=parseInt(Lt().version.split(".")[0].slice(1),10),Yu=Ku>=6?"utf-8":"binary"):Yu="utf-8",Gu=Yu),Gu}var $u,Xu,Ju=!1;function Qu(){return Ju||(Ju=!0,$u={},Xu=hr().Buffer,$u=function(t,e,r){if(Xu.isBuffer(t))return t;if("string"==typeof t)return Xu.from(t,e);if(ArrayBuffer.isView(t))return Xu.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}),$u}var th,eh,rh,nh,ih,oh,ah,sh,fh,uh,hh=!1;function ch(t,e,r){var n=function(t){function e(e){return nh(t).update(e).digest()}function r(t){return(new rh).update(t).digest()}return"rmd160"===t||"ripemd160"===t?r:"md5"===t?eh:e}(t),i="sha512"===t||"sha384"===t?128:64;e.length>i?e=n(e):e.length>>0},Lh=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},Oh.writeUInt32BE=Lh,Uh=function(t,e,r,n){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},Oh.ip=Uh,jh=function(t,e,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},Oh.rip=jh,Nh=function(t,e,r,n){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},Oh.pc1=Nh,zh=function(t,e){return t<>>28-e},Oh.r28shl=zh,Fh=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24],qh=function(t,e,r,n){for(var i=0,o=0,a=Fh.length>>>1,s=0;s>>Fh[s]&1;for(s=a;s>>Fh[s]&1;r[n+0]=i>>>0,r[n+1]=o>>>0},Oh.pc2=qh,Wh=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0},Oh.expand=Wh,Hh=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11],Gh=function(t,e){for(var r=0,n=0;n<4;n++)r<<=4,r|=Hh[64*n+(t>>>18-6*n&63)];for(n=0;n<4;n++)r<<=4,r|=Hh[256+64*n+(e>>>18-6*n&63)];return r>>>0},Oh.substitute=Gh,Yh=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7],Kh=function(t){for(var e=0,r=0;r>>Yh[r]&1;return e>>>0},Oh.permute=Kh,Vh=function(t,e,r){for(var n=t.toString(2);n.length0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},nc.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},nc.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=$h().r28shl(r,o),n=$h().r28shl(n,o),$h().pc2(r,n,t.keys,i)}},cc.prototype._update=function(t,e,r,n){var i=this._desState,o=$h().readUInt32BE(t,e),a=$h().readUInt32BE(t,e+4);$h().ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],$h().writeUInt32BE(r,o,n),$h().writeUInt32BE(r,a,n+4)},cc.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,o=c}$h().rip(a,o,n,i)},cc.prototype._decrypt=function(t,e,r,n,i){for(var o=r,a=e,s=t.keys.length-2;s>=0;s-=2){var f=t.keys[s],u=t.keys[s+1];$h().expand(o,t.tmp,0),f^=t.tmp[0],u^=t.tmp[1];var h=$h().substitute(f,u),c=o;o=(a^$h().permute(h))>>>0,a=c}$h().rip(o,a,n,i)}),oc}var lc,pc,mc,bc,gc=!1;function vc(t){tc().equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e>o%8,t._prev=Ad(t._prev,r?n:i);return a}function Ad(t,e){var r=t.length,n=-1,i=vd.allocUnsafe(t.length);for(t=vd.concat([t,vd.from([e])]);++n>7;return i}function Md(){return wd||(wd=!0,gd={},vd=hr().Buffer,yd=function(t,e,r){for(var n=e.length,i=vd.allocUnsafe(n),o=-1;++o>>24]^h[p>>>16&255]^c[m>>>8&255]^d[255&b]^e[g++],a=u[p>>>24]^h[m>>>16&255]^c[b>>>8&255]^d[255&l]^e[g++],s=u[m>>>24]^h[b>>>16&255]^c[l>>>8&255]^d[255&p]^e[g++],f=u[b>>>24]^h[l>>>16&255]^c[p>>>8&255]^d[255&m]^e[g++],l=o,p=a,m=s,b=f;return o=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&b])^e[g++],a=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[b>>>8&255]<<8|n[255&l])^e[g++],s=(n[m>>>24]<<24|n[b>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[g++],f=(n[b>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^e[g++],[o>>>=0,a>>>=0,s>>>=0,f>>>=0]}function sl(t){this._key=il(t),this._reset()}function fl(){return nl||(nl=!0,Jd={},Qd=hr().Buffer,tl=[0,1,2,4,8,16,32,64,128,27,54],el=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,f=0;f<256;++f){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[a]=u,n[u]=a;var h=t[a],c=t[h],d=t[c],l=257*t[u]^16843008*u;i[0][a]=l<<24|l>>>8,i[1][a]=l<<16|l>>>16,i[2][a]=l<<8|l>>>24,i[3][a]=l,l=16843009*d^65537*c^257*h^16843008*a,o[0][u]=l<<24|l>>>8,o[1][u]=l<<16|l>>>16,o[2][u]=l<<8|l>>>24,o[3][u]=l,0===a?a=s=1:(a=h^t[t[t[d^h]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}(),sl.blockSize=16,sl.keySize=32,sl.prototype.blockSize=sl.blockSize,sl.prototype.keySize=sl.keySize,sl.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o>>24,a=el.SBOX[a>>>24]<<24|el.SBOX[a>>>16&255]<<16|el.SBOX[a>>>8&255]<<8|el.SBOX[255&a],a^=tl[o/e|0]<<24):e>6&&o%e==4&&(a=el.SBOX[a>>>24]<<24|el.SBOX[a>>>16&255]<<16|el.SBOX[a>>>8&255]<<8|el.SBOX[255&a]),i[o]=i[o-e]^a}for(var s=[],f=0;f>>24]]^el.INV_SUB_MIX[1][el.SBOX[h>>>16&255]]^el.INV_SUB_MIX[2][el.SBOX[h>>>8&255]]^el.INV_SUB_MIX[3][el.SBOX[255&h]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=s},sl.prototype.encryptBlockRaw=function(t){return al(t=il(t),this._keySchedule,el.SUB_MIX,el.SBOX,this._nRounds)},sl.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=Qd.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},sl.prototype.decryptBlock=function(t){var e=(t=il(t))[1];t[1]=t[3],t[3]=e;var r=al(t,this._invKeySchedule,el.INV_SUB_MIX,el.INV_SBOX,this._nRounds),n=Qd.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},sl.prototype.scrub=function(){ol(this._keySchedule),ol(this._invKeySchedule),ol(this._key)},rl=sl,Jd.AES=rl),Jd}var ul,hl,cl,dl=!1;function ll(t){var e=hl.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function pl(t){this.h=t,this.state=hl.alloc(16,0),this.cache=hl.allocUnsafe(0)}function ml(){return dl||(dl=!0,ul={},hl=hr().Buffer,cl=hl.alloc(16,0),pl.prototype.ghash=function(t){for(var e=-1;++e0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=ll(i)},pl.prototype.update=function(t){var e;for(this.cache=hl.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},pl.prototype.final=function(t,e){return this.cache.length&&this.ghash(hl.concat([this.cache,cl],16)),this.ghash(ll([0,t,0,e])),this.state},ul=pl),ul}var bl,gl,vl,yl,wl,_l,Al,Ml=!1;function El(t,e,r,n){vl.call(this);var i=gl.alloc(4,0);this._cipher=new(fl().AES)(e);var o=this._cipher.encryptBlock(i);this._ghash=new wl(o),r=function(t,e,r){if(12===e.length)return t._finID=gl.concat([e,gl.from([0,0,0,1])]),gl.concat([e,gl.from([0,0,0,2])]);var n=new wl(r),i=e.length,o=i%16;n.update(e),o&&(o=16-o,n.update(gl.alloc(o,0))),n.update(gl.alloc(8,0));var a=8*i,s=gl.alloc(8);s.writeUIntBE(a,0,8),n.update(s),t._finID=n.state;var f=gl.from(t._finID);return Al(f),f}(this,r,o),this._prev=gl.from(r),this._cache=gl.allocUnsafe(0),this._secCache=gl.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}function Sl(){bl={},fl(),gl=hr().Buffer,vl=tu(),yl=Ar(),wl=ml(),_l=Xc(),Al=Pd(),yl(El,vl),El.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=gl.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},El.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=_l(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i0||n>0;){var f=new Ol;f.update(s),f.update(t),e&&f.update(e),s=f.digest();var u=0;if(i>0){var h=o.length-i;u=Math.min(i,s.length),s.copy(o,h,0,u),i-=u}if(u0){var c=a.length-n,d=Math.min(n,s.length-u);s.copy(a,c,u,u+d),n-=d}}return s.fill(0),{key:o,iv:a}}function jl(){return Ll||(Ll=!0,Dl={},Pl=hr().Buffer,Ol=ts(),Dl=Ul),Dl}var Nl,zl,Fl,ql,Wl,Hl,Gl,Yl,Kl,Vl,Zl=!1;function $l(t,e,r){Hl.call(this),this._cache=new Xl,this._cipher=new(fl().AES)(e),this._prev=ql.from(r),this._mode=t,this._autopadding=!0}function Xl(){this.cache=ql.allocUnsafe(0)}function Jl(t,e,r){var n=zl[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=ql.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=ql.from(r)),"GCM"!==n.mode&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===n.type?new Wl(n.module,e,r):"auth"===n.type?new Fl(n.module,e,r):new $l(n.module,e,r)}function Ql(t,e){var r=zl[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=Gl(e,!1,r.key,r.iv);return Jl(t,n.key,n.iv)}function tp(){return Zl||(Zl=!0,Nl={},zl=Xd(),Fl=kl(),ql=hr().Buffer,Wl=Il(),Hl=tu(),fl(),Gl=jl(),Ar()($l,Hl),$l.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return ql.concat(n)},Yl=ql.alloc(16,16),$l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(Yl))throw this._cipher.scrub(),new Error("data not multiple of block length")},$l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},Xl.prototype.add=function(t){this.cache=ql.concat([this.cache,t])},Xl.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},Xl.prototype.flush=function(){for(var t=16-this.cache.length,e=ql.allocUnsafe(t),r=-1;++r16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},dp.prototype.flush=function(){if(this.cache.length)return this.cache},fp=pp,ep.createDecipher=fp,up=lp,ep.createDecipheriv=up}function bp(){return hp||(hp=!0,mp()),ep}var gp,vp,yp,wp,_p,Ap,Mp,Ep,Sp,kp,Bp,Tp,Rp=!1;function xp(){return Object.keys(Mp)}function Cp(){return Rp||(Rp=!0,Ap={},tp(),bp(),Mp=Gd(),gp=tp().createCipher,Ep=Ap.Cipher=gp,Ap.createCipher=Ep,vp=tp().createCipheriv,Sp=Ap.Cipheriv=vp,Ap.createCipheriv=Sp,yp=bp().createDecipher,kp=Ap.Decipher=yp,Ap.createDecipher=kp,wp=bp().createDecipheriv,Bp=Ap.Decipheriv=wp,Ap.createDecipheriv=Bp,_p=xp,Tp=Ap.getCiphers=_p,Ap.listCiphers=Tp),Ap}var Ip,Dp,Pp,Op,Lp,Up,jp,Np,zp=!1;function Fp(){return zp||(zp=!0,(Pp={})["des-ecb"]={key:8,iv:0},Ip={key:8,iv:8},Op=Pp.des=Ip,Pp["des-cbc"]=Op,Dp={key:24,iv:8},Lp=Pp.des3=Dp,Pp["des-ede3-cbc"]=Lp,Up={key:24,iv:0},Pp["des-ede3"]=Up,jp={key:16,iv:8},Pp["des-ede-cbc"]=jp,Np={key:16,iv:0},Pp["des-ede"]=Np),Pp}var qp,Wp,Hp,Gp,Yp,Kp,Vp,Zp,$p,Xp,Jp,Qp,tm,em,rm,nm=!1;function im(t,e){var r,n;if(t=t.toLowerCase(),Zp[t])r=Zp[t].key,n=Zp[t].iv;else{if(!$p[t])throw new TypeError("invalid suite type");r=8*$p[t].key,n=$p[t].iv}var i=Xp(e,!1,r,n);return am(t,i.key,i.iv)}function om(t,e){var r,n;if(t=t.toLowerCase(),Zp[t])r=Zp[t].key,n=Zp[t].iv;else{if(!$p[t])throw new TypeError("invalid suite type");r=8*$p[t].key,n=$p[t].iv}var i=Xp(e,!1,r,n);return sm(t,i.key,i.iv)}function am(t,e,r){if(t=t.toLowerCase(),Zp[t])return Cp().createCipheriv(t,e,r);if($p[t])return new Vp({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function sm(t,e,r){if(t=t.toLowerCase(),Zp[t])return Cp().createDecipheriv(t,e,r);if($p[t])return new Vp({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}function fm(){return Object.keys($p).concat(Cp().getCiphers())}function um(){return nm||(nm=!0,Kp={},Vp=Wc(),Cp(),Zp=Xd(),$p=Fp(),Xp=jl(),qp=im,Jp=Kp.Cipher=qp,Kp.createCipher=Jp,Wp=am,Qp=Kp.Cipheriv=Wp,Kp.createCipheriv=Qp,Hp=om,tm=Kp.Decipher=Hp,Kp.createDecipher=tm,Gp=sm,em=Kp.Decipheriv=Gp,Kp.createDecipheriv=em,Yp=fm,rm=Kp.getCiphers=Yp,Kp.listCiphers=rm),Kp}var hm,cm=!1;function dm(){hm=function(){var t={exports:this};return function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:rr().Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=s(t,e,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,c=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;h+=(a=(i=0|t.words[p])*(o=0|e.words[l])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,f=0|h}return 0!==f?r.words[u]=0|f:r.length--,r.strip()}i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-f.length]+f+n:f+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=h[t],l=c[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:u[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,f="le"===e,u=new t(o),h=this.clone();if(f){for(s=0;!h.isZero();s++)a=h.andln(255),h.iushrn(8),u[s]=a;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,m=l>>>13,b=0|a[2],g=8191&b,v=b>>>13,y=0|a[3],w=8191&y,_=y>>>13,A=0|a[4],M=8191&A,E=A>>>13,S=0|a[5],k=8191&S,B=S>>>13,T=0|a[6],R=8191&T,x=T>>>13,C=0|a[7],I=8191&C,D=C>>>13,P=0|a[8],O=8191&P,L=P>>>13,U=0|a[9],j=8191&U,N=U>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],H=8191&W,G=W>>>13,Y=0|s[2],K=8191&Y,V=Y>>>13,Z=0|s[3],$=8191&Z,X=Z>>>13,J=0|s[4],Q=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ht=0|s[8],ct=8191&ht,dt=ht>>>13,lt=0|s[9],pt=8191<,mt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var bt=(u+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(d,F)|0))<<13)|0;u=((o=Math.imul(d,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var gt=(u+(n=n+Math.imul(c,H)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,H)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,q))+Math.imul(v,F)|0,o=Math.imul(v,q),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,G)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(_,F)|0,o=Math.imul(_,q),n=n+Math.imul(g,H)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var yt=(u+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(E,F)|0,o=Math.imul(E,q),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,q))+Math.imul(B,F)|0,o=Math.imul(B,q),n=n+Math.imul(M,H)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(x,F)|0,o=Math.imul(x,q),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var At=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,F),i=(i=Math.imul(I,q))+Math.imul(D,F)|0,o=Math.imul(D,q),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Mt=(u+(n=n+Math.imul(c,ft)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,q))+Math.imul(L,F)|0,o=Math.imul(L,q),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(N,F)|0,o=Math.imul(N,q),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(D,K)|0,o=o+Math.imul(D,V)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,dt)|0;var St=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,H),i=(i=Math.imul(j,G))+Math.imul(N,H)|0,o=Math.imul(N,G),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,dt)|0;var kt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(N,K)|0,o=Math.imul(N,V),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0;var Bt=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,X))+Math.imul(N,$)|0,o=Math.imul(N,X),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(D,rt)|0,o=o+Math.imul(D,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ut)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(M,ct)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var Tt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(N,Q)|0,o=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ut)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ut)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(N,rt)|0,o=Math.imul(N,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(D,ft)|0,o=o+Math.imul(D,ut)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var xt=(u+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,at))+Math.imul(N,ot)|0,o=Math.imul(N,at),n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0;var Ct=(u+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,ft),i=(i=Math.imul(j,ut))+Math.imul(N,ft)|0,o=Math.imul(N,ut),n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,dt)|0;var It=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,dt))+Math.imul(N,ct)|0,o=Math.imul(N,dt);var Dt=(u+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Pt=(u+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(N,pt)|0))<<13)|0;return u=((o=Math.imul(N,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,f[0]=bt,f[1]=gt,f[2]=vt,f[3]=yt,f[4]=wt,f[5]=_t,f[6]=At,f[7]=Mt,f[8]=Et,f[9]=St,f[10]=kt,f[11]=Bt,f[12]=Tt,f[13]=Rt,f[14]=xt,f[15]=Ct,f[16]=It,f[17]=Dt,f[18]=Pt,0!==u&&(f[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(l=d),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==h||u>=i);u--){var c=0|this.words[u];this.words[u]=h<<26-o|c>>>o,h=c&s}return f&&0!==h&&(f.words[f.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(f/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,f=n.length-o.length;if("mod"!==e){(s=new i(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u=0;c--){var d=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),f=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var h=n.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(h),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(h),f.isub(c)),s.iushrn(1),f.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(f)):(n.isub(e),s.isub(o),f.isub(a))}return{a:s,b:f,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),f=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.iushrn(1);for(var c=0,d=1;0==(n.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new A(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(v,g),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new y;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return b[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,u).cmp(f);)h.redIAdd(f);for(var c=this.pow(h,o),d=this.pow(t,o.addn(1).iushrn(1)),l=this.pow(t,o),p=a;0!==l.cmp(s);){for(var m=l,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=e.words[n],h=f-1;h>=0;h--){var c=u>>h&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===n&&0===h)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}f=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this),t.exports}.call({})}function lm(){return cm||(cm=!0,dm()),hm}var pm,mm,bm,gm=!1;function vm(t){this.rand=t}function ym(){return gm||(gm=!0,function(){if(pm={},pm=function(t){return mm||(mm=new vm(null)),mm.generate(t)},bm=vm,pm.Rand=bm,vm.prototype.generate=function(t){return this._rand(t)},vm.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r=0);return n},Mm.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},Mm.prototype.test=function(t,e,r){var n=t.bitLength(),i=_m.mont(t),o=new _m(1).toRed(i);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var f=t.shrn(s),u=a.toRed(i);e>0;e--){var h=this._randrange(new _m(2),a);r&&r(h);var c=h.toRed(i).redPow(f);if(0!==c.cmp(o)&&0!==c.cmp(u)){for(var d=1;d0;e--){var u=this._randrange(new _m(2),o),h=t.gcd(u);if(0!==h.cmpn(1))return h;var c=u.toRed(n).redPow(s);if(0!==c.cmp(i)&&0!==c.cmp(f)){for(var d=1;dt;)r.ishrn(1);if(r.isEven()&&r.iadd(Cm),r.testn(1)||r.iadd(Im),e.cmp(Im)){if(!e.cmp(Dm))for(;r.mod(Pm).cmp(Om);)r.iadd(Um)}else for(;r.mod(Tm).cmp(Lm);)r.iadd(Um);if(zm(n=r.shrn(1))&&zm(r)&&Fm(n)&&Fm(r)&&xm.test(n)&&xm.test(r))return r}}function Wm(){return Nm||(Nm=!0,Sm={},km=yr(),Sm=qm,qm.simpleSieve=zm,qm.fermatTest=Fm,Bm=lm(),Tm=new Bm(24),Rm=Em(),xm=new Rm,Cm=new Bm(1),Im=new Bm(2),Dm=new Bm(5),new Bm(16),new Bm(8),Pm=new Bm(10),Om=new Bm(3),new Bm(7),Lm=new Bm(11),Um=new Bm(4),new Bm(12),jm=null),Sm}var Hm,Gm=!1;function Ym(){return Gm||(Gm=!0,Hm={},Hm=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')),Hm}var Km,Vm,Zm,$m,Xm,Jm,Qm,tb,eb,rb,nb,ib,ob=!1;function ab(t,e){return e=e||"utf8",Vm.isBuffer(t)||(t=new Vm(t,e)),this._pub=new Zm(t),this}function sb(t,e){return e=e||"utf8",Vm.isBuffer(t)||(t=new Vm(t,e)),this._priv=new Zm(t),this}function fb(t,e,r){this.setGenerator(e),this.__prime=new Zm(t),this._prime=Zm.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=ab,this.setPrivateKey=sb):this._primeCode=8}function ub(t,e){var r=new Vm(t.toArray());return e?r.toString(e):r}function hb(){Km={},Vm=Ke().Buffer,Zm=lm(),$m=Em(),Xm=new $m,Jm=new Zm(24),Qm=new Zm(11),tb=new Zm(10),eb=new Zm(3),rb=new Zm(7),Wm(),nb=yr(),Km=fb,ib={},Object.defineProperty(fb.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in ib)return ib[n];var i,o=0;if(t.isEven()||!Wm().simpleSieve||!Wm().fermatTest(t)||!Xm.test(t))return o+=1,o+="02"===r||"05"===r?8:4,ib[n]=o,o;switch(Xm.test(t.shrn(1))||(o+=2),r){case"02":t.mod(Jm).cmp(Qm)&&(o+=8);break;case"05":(i=t.mod(tb)).cmp(eb)&&i.cmp(rb)&&(o+=8);break;default:o+=4}return ib[n]=o,o}(this.__prime,this.__gen)),this._primeCode}}),fb.prototype.generateKeys=function(){return this._priv||(this._priv=new Zm(nb(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},fb.prototype.computeSecret=function(t){var e=(t=(t=new Zm(t)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new Vm(e.toArray()),n=this.getPrime();if(r.length=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,n,i){for(var o=0,a=0,s=Math.min(t.length,n),f=e;f=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=s(t,e,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(t){i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?c[6-f.length]+f+n:f+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],h=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(h).toString(t);n=(p=p.idivn(h)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,c=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;h+=(a=(i=0|t.words[p])*(o=0|e.words[l])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,f=0|h}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,m=l>>>13,b=0|a[2],g=8191&b,v=b>>>13,y=0|a[3],w=8191&y,_=y>>>13,A=0|a[4],M=8191&A,E=A>>>13,S=0|a[5],k=8191&S,B=S>>>13,T=0|a[6],R=8191&T,x=T>>>13,C=0|a[7],I=8191&C,D=C>>>13,P=0|a[8],O=8191&P,L=P>>>13,U=0|a[9],j=8191&U,N=U>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],H=8191&W,G=W>>>13,Y=0|s[2],K=8191&Y,V=Y>>>13,Z=0|s[3],$=8191&Z,X=Z>>>13,J=0|s[4],Q=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ht=0|s[8],ct=8191&ht,dt=ht>>>13,lt=0|s[9],pt=8191<,mt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var bt=(u+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(d,F)|0))<<13)|0;u=((o=Math.imul(d,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var gt=(u+(n=n+Math.imul(c,H)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,H)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,q))+Math.imul(v,F)|0,o=Math.imul(v,q),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,G)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(_,F)|0,o=Math.imul(_,q),n=n+Math.imul(g,H)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var yt=(u+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(E,F)|0,o=Math.imul(E,q),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,q))+Math.imul(B,F)|0,o=Math.imul(B,q),n=n+Math.imul(M,H)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(x,F)|0,o=Math.imul(x,q),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var At=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,F),i=(i=Math.imul(I,q))+Math.imul(D,F)|0,o=Math.imul(D,q),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Mt=(u+(n=n+Math.imul(c,ft)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,q))+Math.imul(L,F)|0,o=Math.imul(L,q),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(N,F)|0,o=Math.imul(N,q),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(D,K)|0,o=o+Math.imul(D,V)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,dt)|0;var St=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,H),i=(i=Math.imul(j,G))+Math.imul(N,H)|0,o=Math.imul(N,G),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,dt)|0;var kt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(N,K)|0,o=Math.imul(N,V),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0;var Bt=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,X))+Math.imul(N,$)|0,o=Math.imul(N,X),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(D,rt)|0,o=o+Math.imul(D,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ut)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(M,ct)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var Tt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(N,Q)|0,o=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ut)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ut)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(N,rt)|0,o=Math.imul(N,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(D,ft)|0,o=o+Math.imul(D,ut)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var xt=(u+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,at))+Math.imul(N,ot)|0,o=Math.imul(N,at),n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0;var Ct=(u+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,ft),i=(i=Math.imul(j,ut))+Math.imul(N,ft)|0,o=Math.imul(N,ut),n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,dt)|0;var It=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,dt))+Math.imul(N,ct)|0,o=Math.imul(N,dt);var Dt=(u+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Pt=(u+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(N,pt)|0))<<13)|0;return u=((o=Math.imul(N,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,f[0]=bt,f[1]=gt,f[2]=vt,f[3]=yt,f[4]=wt,f[5]=_t,f[6]=At,f[7]=Mt,f[8]=Et,f[9]=St,f[10]=kt,f[11]=Bt,f[12]=Tt,f[13]=Rt,f[14]=xt,f[15]=Ct,f[16]=It,f[17]=Dt,f[18]=Pt,0!==u&&(f[19]=u,r.length++),r};function b(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(t,e,r){return b(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?b(this,t,e):g(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==h||u>=i);u--){var c=0|this.words[u];this.words[u]=h<<26-o|c>>>o,h=c&s}return f&&0!==h&&(f.words[f.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(f/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,f=n.length-o.length;if("mod"!==e){(s=new i(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u=0;c--){var d=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),f=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var h=n.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(h),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(h),f.isub(c)),s.iushrn(1),f.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(f)):(n.isub(e),s.isub(o),f.isub(a))}return{a:s,b:f,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),f=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.iushrn(1);for(var c=0,d=1;0==(n.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new S(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(_,w),_.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new A;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,u).cmp(f);)h.redIAdd(f);for(var c=this.pow(h,o),d=this.pow(t,o.addn(1).iushrn(1)),l=this.pow(t,o),p=a;0!==l.cmp(s);){for(var m=l,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=e.words[n],h=f-1;h>=0;h--){var c=u>>h&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===n&&0===h)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}f=26}return o},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this),t.exports}.call({})}var Rb,xb,Cb,Ib,Db=!1;function Pb(t){var e,r=t.modulus.byteLength();do{e=new Cb(Ib(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function Ob(t,e){var r=function(t){var e=Pb(t);return{blinder:e.toRed(Cb.mont(t.modulus)).redPow(new Cb(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),n=e.modulus.byteLength(),i=new Cb(t).mul(r.blinder).umod(e.modulus),o=i.toRed(Cb.mont(e.prime1)),a=i.toRed(Cb.mont(e.prime2)),s=e.coefficient,f=e.prime1,u=e.prime2,h=o.redPow(e.exponent1).fromRed(),c=a.redPow(e.exponent2).fromRed(),d=h.isub(c).imul(s).umod(f).imul(u);return c.iadd(d).imul(r.unblinder).umod(e.modulus).toArrayLike(xb,"be",n)}function Lb(){Rb={},xb=Ke().Buffer,Bb||(Bb=!0,Tb()),Cb=kb,Ib=yr(),Ob.getr=Pb,Rb=Ob}function Ub(){return Db||(Db=!0,Lb()),Rb}var jb,Nb=!1;function zb(){return Nb||(Nb=!0,jb={},jb=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')),jb}var Fb,qb,Wb=!1;function Hb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}return r}function Gb(t){return 1===t.length?"0"+t:t}function Yb(t){for(var e="",r=0;r(i>>1)-1?(i>>1)-f:f,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n}function tg(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,f=t.andln(3)+i&3,u=e.andln(3)+o&3;3===f&&(f=-1),3===u&&(u=-1),a=0==(1&f)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?f:-f,r[0].push(a),s=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==f?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r}function eg(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function rg(t){return"string"==typeof t?Zb.toArray(t,"hex"):t}function ng(t){return new $b(t,"hex","le")}function ig(){return Jb||(Jb=!0,Zb=Vb={},$b=lm(),Xb=tc(),Kb(),Zb.assert=Xb,Zb.toArray=Kb().toArray,Zb.zero2=Kb().zero2,Zb.toHex=Kb().toHex,Zb.encode=Kb().encode,Zb.getNAF=Qb,Zb.getJSF=tg,Zb.cachedProperty=eg,Zb.parseBytes=rg,Zb.intFromLE=ng),Vb}var og,ag,sg,fg,ug,hg=!1;function cg(t,e){this.type=t,this.p=new ag(e.p,16),this.red=e.prime?ag.red(e.prime):ag.mont(this.p),this.zero=new ag(0).toRed(this.red),this.one=new ag(1).toRed(this.red),this.two=new ag(2).toRed(this.red),this.n=e.n&&new ag(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function dg(t,e){this.curve=t,this.type=e,this.precomputed=null}function lg(){return hg||(hg=!0,og={},ag=lm(),ig(),sg=ig().getNAF,fg=ig().getJSF,ug=ig().assert,og=cg,cg.prototype.point=function(){throw new Error("Not implemented")},cg.prototype.validate=function(){throw new Error("Not implemented")},cg.prototype._fixedNafMul=function(t,e){ug(t.precomputed);var r=t._getDoubles(),n=sg(e,1,this._bitLength),i=(1<=o;f--)a=(a<<1)+n[f];s.push(a)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;s--){for(var f=0;s>=0&&0===o[s];s--)f++;if(s>=0&&f++,a=a.dblp(f),s<0)break;var u=o[s];ug(0!==u),a="affine"===t.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===t.type?a.toP():a},cg.prototype._wnafMulAdd=function(t,e,r,n,i){var o,a,s,f=this._wnafT1,u=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var l=o-1,p=o;if(1===f[l]&&1===f[p]){var m=[e[l],null,null,e[p]];0===e[l].y.cmp(e[p].y)?(m[1]=e[l].add(e[p]),m[2]=e[l].toJ().mixedAdd(e[p].neg())):0===e[l].y.cmp(e[p].y.redNeg())?(m[1]=e[l].toJ().mixedAdd(e[p]),m[2]=e[l].add(e[p].neg())):(m[1]=e[l].toJ().mixedAdd(e[p]),m[2]=e[l].toJ().mixedAdd(e[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=fg(r[l],r[p]);for(c=Math.max(g[0].length,c),h[l]=new Array(c),h[p]=new Array(c),a=0;a=0;o--){for(var A=0;o>=0;){var M=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][E-1>>1]:E<0&&(s=u[a][-E-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},dg.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},wg.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),f=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:f.add(u).neg()}},wg.prototype.pointFromX=function(t,e){(t=new mg(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},wg.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},wg.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},_g.prototype.isInfinity=function(){return this.inf},_g.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},_g.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},_g.prototype.getX=function(){return this.x.fromRed()},_g.prototype.getY=function(){return this.y.fromRed()},_g.prototype.mul=function(t){return t=new mg(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},_g.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},_g.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},_g.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},_g.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},_g.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},bg(Ag,gg.BasePoint),wg.prototype.jpoint=function(t,e,r){return new Ag(this,t,e,r)},Ag.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Ag.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Ag.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),f=o.redSub(a);if(0===s.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),c=n.redMul(u),d=f.redSqr().redIAdd(h).redISub(c).redISub(c),l=f.redMul(c.redISub(d)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,l,p)},Ag.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),u=f.redMul(a),h=r.redMul(f),c=s.redSqr().redIAdd(u).redISub(h).redISub(h),d=s.redMul(h.redISub(c)).redISub(i.redMul(u)),l=this.z.redMul(a);return this.curve.jpoint(c,d,l)},Ag.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Ag.prototype.inspect=function(){return this.isInfinity()?"":""},Ag.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}),pg}var Eg,Sg,kg,Bg,Tg=!1;function Rg(t){Bg.call(this,"mont",t),this.a=new Sg(t.a,16).toRed(this.red),this.b=new Sg(t.b,16).toRed(this.red),this.i4=new Sg(4).toRed(this.red).redInvm(),this.two=new Sg(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function xg(t,e,r){Bg.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Sg(e,16),this.z=new Sg(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}function Cg(){return Tg||(Tg=!0,Eg={},Sg=lm(),kg=Ar(),Bg=lg(),ig(),kg(Rg,Bg),Eg=Rg,Rg.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},kg(xg,Bg.BasePoint),Rg.prototype.decodePoint=function(t,e){return this.point(ig().toArray(t,e),1)},Rg.prototype.point=function(t,e){return new xg(this,t,e)},Rg.prototype.pointFromJSON=function(t){return xg.fromJSON(this,t)},xg.prototype.precompute=function(){},xg.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},xg.fromJSON=function(t,e){return new xg(t,e[0],e[1]||t.one)},xg.prototype.inspect=function(){return this.isInfinity()?"":""},xg.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},xg.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},xg.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},xg.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),f=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,f)},xg.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},xg.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},xg.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},xg.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},xg.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},xg.prototype.getX=function(){return this.normalize(),this.x.fromRed()}),Eg}var Ig,Dg,Pg,Og,Lg,Ug=!1;function jg(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,Og.call(this,"edwards",t),this.a=new Dg(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Dg(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Dg(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Lg(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function Ng(t,e,r,n,i){Og.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Dg(e,16),this.y=new Dg(r,16),this.z=n?new Dg(n,16):this.curve.one,this.t=i&&new Dg(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}function zg(){return Ug||(Ug=!0,Ig={},ig(),Dg=lm(),Pg=Ar(),Og=lg(),Lg=ig().assert,Pg(jg,Og),Ig=jg,jg.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},jg.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},jg.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},jg.prototype.pointFromX=function(t,e){(t=new Dg(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},jg.prototype.pointFromY=function(t,e){(t=new Dg(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},jg.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},Pg(Ng,Og.BasePoint),jg.prototype.pointFromJSON=function(t){return Ng.fromJSON(this,t)},jg.prototype.point=function(t,e,r,n){return new Ng(this,t,e,r,n)},Ng.fromJSON=function(t,e){return new Ng(t,e[0],e[1],e[2])},Ng.prototype.inspect=function(){return this.isInfinity()?"":""},Ng.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Ng.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),f=i.redMul(a),u=o.redMul(s),h=i.redMul(s),c=a.redMul(o);return this.curve.point(f,u,c,h)},Ng.prototype._projDbl=function(){var t,e,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),f=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(f);this.zOne?(t=a.redSub(s).redSub(f).redMul(u.redSub(this.curve.two)),e=u.redMul(n.redSub(f)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),t=a.redSub(s).redISub(f).redMul(o),e=u.redMul(n.redSub(f)),r=u.redMul(o))}else n=s.redAdd(f),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(s.redISub(f)),r=n.redMul(o);return this.curve.point(t,e,r)},Ng.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Ng.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),f=r.redAdd(e),u=o.redMul(a),h=s.redMul(f),c=o.redMul(f),d=a.redMul(s);return this.curve.point(u,h,d,c)},Ng.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),f=i.redSub(s),u=i.redAdd(s),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=n.redMul(f).redMul(h);return this.curve.twisted?(e=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=f.redMul(u)):(e=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(f).redMul(u)),this.curve.point(c,e,r)},Ng.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},Ng.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},Ng.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},Ng.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},Ng.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},Ng.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Ng.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Ng.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Ng.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},Ng.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},Ng.prototype.toP=Ng.prototype.normalize,Ng.prototype.mixedAdd=Ng.prototype.add),Ig}var Fg,qg,Wg=!1;function Hg(){return Wg||(Wg=!0,(qg=Fg={}).base=lg(),qg.short=Mg(),qg.mont=Cg(),qg.edwards=zg()),Fg}var Gg,Yg,Kg,Vg,Zg,$g,Xg,Jg,Qg,tv,ev,rv,nv,iv,ov,av,sv,fv,uv,hv,cv,dv,lv,pv,mv,bv,gv,vv,yv,wv=!1;function _v(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function Av(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&o|128):_v(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function Sv(t,e){for(var r="",n=0;n>>0}return o}function Rv(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r}function xv(t,e){return t>>>e|t<<32-e}function Cv(t,e){return t<>>32-e}function Iv(t,e){return t+e>>>0}function Dv(t,e,r){return t+e+r>>>0}function Pv(t,e,r,n){return t+e+r+n>>>0}function Ov(t,e,r,n,i){return t+e+r+n+i>>>0}function Lv(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o>>0,t[e+1]=o}function Uv(t,e,r,n){return(e+n>>>0>>0}function jv(t,e,r,n){return e+n>>>0}function Nv(t,e,r,n,i,o,a,s){var f=0,u=e;return f+=(u=u+n>>>0)>>0)>>0)>>0}function zv(t,e,r,n,i,o,a,s){return e+n+o+s>>>0}function Fv(t,e,r,n,i,o,a,s,f,u){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0}function qv(t,e,r,n,i,o,a,s,f,u){return e+n+o+s+u>>>0}function Wv(t,e,r){return(e<<32-r|t>>>r)>>>0}function Hv(t,e,r){return(t<<32-r|e>>>r)>>>0}function Gv(t,e,r){return t>>>r}function Yv(t,e,r){return(t<<32-r|e>>>r)>>>0}function Kv(){return wv||(wv=!0,Gg={},Yg=tc(),Kg=Ar(),Vg=Kg,Gg.inherits=Vg,Zg=Av,Gg.toArray=Zg,$g=Mv,Gg.toHex=$g,Xg=Ev,Gg.htonl=Xg,Jg=Sv,Gg.toHex32=Jg,Qg=kv,Gg.zero2=Qg,tv=Bv,Gg.zero8=tv,ev=Tv,Gg.join32=ev,rv=Rv,Gg.split32=rv,nv=xv,Gg.rotr32=nv,iv=Cv,Gg.rotl32=iv,ov=Iv,Gg.sum32=ov,av=Dv,Gg.sum32_3=av,sv=Pv,Gg.sum32_4=sv,fv=Ov,Gg.sum32_5=fv,uv=Lv,Gg.sum64=uv,hv=Uv,Gg.sum64_hi=hv,cv=jv,Gg.sum64_lo=cv,dv=Nv,Gg.sum64_4_hi=dv,lv=zv,Gg.sum64_4_lo=lv,pv=Fv,Gg.sum64_5_hi=pv,mv=qv,Gg.sum64_5_lo=mv,bv=Wv,Gg.rotr64_hi=bv,gv=Hv,Gg.rotr64_lo=gv,vv=Gv,Gg.shr64_hi=vv,yv=Yv,Gg.shr64_lo=yv),Gg}var Vv,Zv,$v,Xv=!1;function Jv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}function Qv(){return Xv||(Xv=!0,Vv={},Kv(),Zv=tc(),$v=Jv,Vv.BlockHash=$v,Jv.prototype.update=function(t,e){if(t=Kv().toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=Kv().join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3}function by(t){return ey(t,17)^ey(t,19)^t>>>10}function gy(){return uy||(uy=!0,ty={},Kv(),ey=Kv().rotr32,ry=hy,ty.ft_1=ry,ny=cy,ty.ch32=ny,iy=dy,ty.maj32=iy,oy=ly,ty.s0_256=oy,ay=py,ty.s1_256=ay,sy=my,ty.g0_256=sy,fy=by,ty.g1_256=fy),ty}var vy,yy,wy,_y,Ay,My,Ey,Sy=!1;function ky(){if(!(this instanceof ky))return new ky;My.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}function By(){return Sy||(Sy=!0,vy={},Kv(),Qv(),gy(),yy=Kv().rotl32,wy=Kv().sum32,_y=Kv().sum32_5,Ay=gy().ft_1,My=Qv().BlockHash,Ey=[1518500249,1859775393,2400959708,3395469782],Kv().inherits(ky,My),vy=ky,ky.blockSize=512,ky.outSize=160,ky.hmacStrength=80,ky.padLength=64,ky.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=(new this.Hash).update(t).digest()),t_(t.length<=this.blockSize);for(var e=t.length;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}function M_(){return __||(__=!0,y_={},s_(),Kb(),w_=tc(),y_=A_,A_.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},A_.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Kb().toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"}),E_}var x_,C_,I_,D_=!1;function P_(t,e){if(t instanceof P_)return t;this._importDER(t,e)||(I_(t.r&&t.s,"Signature without r or s"),this.r=new C_(t.r,16),this.s=new C_(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function O_(){this.place=0}function L_(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function U_(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}function N_(){return D_||(D_=!0,x_={},C_=lm(),ig(),I_=ig().assert,x_=P_,P_.prototype._importDER=function(t,e){t=ig().toArray(t,e);var r=new O_;if(48!==t[r.place++])return!1;var n=L_(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=L_(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var a=L_(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var s=t.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new C_(o),this.s=new C_(s),this.recoveryParam=null,!0},P_.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=U_(e),r=U_(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];j_(n,e.length),(n=n.concat(e)).push(2),j_(n,r.length);var i=n.concat(r),o=[48];return j_(o,i.length),o=o.concat(i),ig().encode(o,t)}),x_}var z_,F_,q_,W_,H_,G_,Y_,K_,V_=!1;function Z_(t){if(!(this instanceof Z_))return new Z_(t);"string"==typeof t&&(G_(Object.prototype.hasOwnProperty.call(W_,t),"Unknown curve "+t),t=W_[t]),t instanceof W_.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}function $_(){return V_||(V_=!0,z_={},F_=lm(),q_=M_(),ig(),W_=v_(),H_=ym(),G_=ig().assert,Y_=R_(),K_=N_(),z_=Z_,Z_.prototype.keyPair=function(t){return new Y_(this,t)},Z_.prototype.keyFromPrivate=function(t,e){return Y_.fromPrivate(this,t,e)},Z_.prototype.keyFromPublic=function(t,e){return Y_.fromPublic(this,t,e)},Z_.prototype.genKeyPair=function(t){t||(t={});for(var e=new q_({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||H_(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new F_(2));;){var i=new F_(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Z_.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Z_.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new F_(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new q_({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new F_(1)),u=0;;u++){var h=n.k?n.k(u):new F_(s.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var d=c.getX(),l=d.umod(this.n);if(0!==l.cmpn(0)){var p=h.invm(this.n).mul(l.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==d.cmp(l)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new K_({r:l,s:p,recoveryParam:m})}}}}}},Z_.prototype.verify=function(t,e,r,n){t=this._truncateToN(new F_(t,16)),r=this.keyFromPublic(r,n);var i=(e=new K_(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),f=s.mul(t).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(f,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},Z_.prototype.recoverPubKey=function(t,e,r,n){G_((3&r)===r,"The recovery param is more than two bits"),e=new K_(e,n);var i=this.n,o=new F_(t),a=e.r,s=e.s,f=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),f):this.curve.pointFromX(a,f);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),d=s.mul(h).umod(i);return this.g.mulAdd(c,a,d)},Z_.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new K_(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}),z_}var X_,J_,Q_,tA,eA=!1;function rA(t,e){this.eddsa=t,this._secret=Q_(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Q_(e.pub)}function nA(){return eA||(eA=!0,X_={},ig(),J_=ig().assert,Q_=ig().parseBytes,tA=ig().cachedProperty,rA.fromPublic=function(t,e){return e instanceof rA?e:new rA(t,{pub:e})},rA.fromSecret=function(t,e){return e instanceof rA?e:new rA(t,{secret:e})},rA.prototype.secret=function(){return this._secret},tA(rA,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),tA(rA,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),tA(rA,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),tA(rA,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),tA(rA,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),tA(rA,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),rA.prototype.sign=function(t){return J_(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},rA.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},rA.prototype.getSecret=function(t){return J_(this._secret,"KeyPair is public only"),ig().encode(this.secret(),t)},rA.prototype.getPublic=function(t){return ig().encode(this.pubBytes(),t)},X_=rA),X_}var iA,oA,aA,sA,fA,uA=!1;function hA(t,e){this.eddsa=t,"object"!=typeof e&&(e=fA(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),aA(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof oA&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}function cA(){return uA||(uA=!0,iA={},oA=lm(),ig(),aA=ig().assert,sA=ig().cachedProperty,fA=ig().parseBytes,sA(hA,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),sA(hA,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),sA(hA,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),sA(hA,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),hA.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},hA.prototype.toHex=function(){return ig().encode(this.toBytes(),"hex").toUpperCase()},iA=hA),iA}var dA,lA,pA,mA,bA,gA=!1;function vA(t){if(pA("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof vA))return new vA(t);t=lA[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=s_().sha512}function yA(){return gA||(gA=!0,dA={},s_(),lA=v_(),ig(),pA=ig().assert,mA=ig().parseBytes,nA(),bA=cA(),dA=vA,vA.prototype.sign=function(t,e){t=mA(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},vA.prototype.verify=function(t,e,r){t=mA(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},vA.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,n,i){for(var o=0,a=0,s=Math.min(t.length,n),f=e;f=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=s(t,e,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(t){i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?c[6-f.length]+f+n:f+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],h=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(h).toString(t);n=(p=p.idivn(h)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,c=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;h+=(a=(i=0|t.words[p])*(o=0|e.words[l])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,f=0|h}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,m=l>>>13,b=0|a[2],g=8191&b,v=b>>>13,y=0|a[3],w=8191&y,_=y>>>13,A=0|a[4],M=8191&A,E=A>>>13,S=0|a[5],k=8191&S,B=S>>>13,T=0|a[6],R=8191&T,x=T>>>13,C=0|a[7],I=8191&C,D=C>>>13,P=0|a[8],O=8191&P,L=P>>>13,U=0|a[9],j=8191&U,N=U>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],H=8191&W,G=W>>>13,Y=0|s[2],K=8191&Y,V=Y>>>13,Z=0|s[3],$=8191&Z,X=Z>>>13,J=0|s[4],Q=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ht=0|s[8],ct=8191&ht,dt=ht>>>13,lt=0|s[9],pt=8191<,mt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var bt=(u+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(d,F)|0))<<13)|0;u=((o=Math.imul(d,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var gt=(u+(n=n+Math.imul(c,H)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,H)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,q))+Math.imul(v,F)|0,o=Math.imul(v,q),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,G)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(_,F)|0,o=Math.imul(_,q),n=n+Math.imul(g,H)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var yt=(u+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(E,F)|0,o=Math.imul(E,q),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,q))+Math.imul(B,F)|0,o=Math.imul(B,q),n=n+Math.imul(M,H)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(x,F)|0,o=Math.imul(x,q),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var At=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,F),i=(i=Math.imul(I,q))+Math.imul(D,F)|0,o=Math.imul(D,q),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Mt=(u+(n=n+Math.imul(c,ft)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,q))+Math.imul(L,F)|0,o=Math.imul(L,q),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(N,F)|0,o=Math.imul(N,q),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(D,K)|0,o=o+Math.imul(D,V)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,dt)|0;var St=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,H),i=(i=Math.imul(j,G))+Math.imul(N,H)|0,o=Math.imul(N,G),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,dt)|0;var kt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(N,K)|0,o=Math.imul(N,V),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0;var Bt=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,X))+Math.imul(N,$)|0,o=Math.imul(N,X),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(D,rt)|0,o=o+Math.imul(D,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ut)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(M,ct)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var Tt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(N,Q)|0,o=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ut)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ut)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(N,rt)|0,o=Math.imul(N,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(D,ft)|0,o=o+Math.imul(D,ut)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var xt=(u+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,at))+Math.imul(N,ot)|0,o=Math.imul(N,at),n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0;var Ct=(u+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,ft),i=(i=Math.imul(j,ut))+Math.imul(N,ft)|0,o=Math.imul(N,ut),n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,dt)|0;var It=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,dt))+Math.imul(N,ct)|0,o=Math.imul(N,dt);var Dt=(u+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Pt=(u+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(N,pt)|0))<<13)|0;return u=((o=Math.imul(N,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,f[0]=bt,f[1]=gt,f[2]=vt,f[3]=yt,f[4]=wt,f[5]=_t,f[6]=At,f[7]=Mt,f[8]=Et,f[9]=St,f[10]=kt,f[11]=Bt,f[12]=Tt,f[13]=Rt,f[14]=xt,f[15]=Ct,f[16]=It,f[17]=Dt,f[18]=Pt,0!==u&&(f[19]=u,r.length++),r};function b(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(t,e,r){return b(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?b(this,t,e):g(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==h||u>=i);u--){var c=0|this.words[u];this.words[u]=h<<26-o|c>>>o,h=c&s}return f&&0!==h&&(f.words[f.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(f/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,f=n.length-o.length;if("mod"!==e){(s=new i(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u=0;c--){var d=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),f=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var h=n.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(h),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(h),f.isub(c)),s.iushrn(1),f.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(f)):(n.isub(e),s.isub(o),f.isub(a))}return{a:s,b:f,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),f=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.iushrn(1);for(var c=0,d=1;0==(n.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new S(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(_,w),_.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new A;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,u).cmp(f);)h.redIAdd(f);for(var c=this.pow(h,o),d=this.pow(t,o.addn(1).iushrn(1)),l=this.pow(t,o),p=a;0!==l.cmp(s);){for(var m=l,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=e.words[n],h=f-1;h>=0;h--){var c=u>>h&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===n&&0===h)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}f=26}return o},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this),t.exports}.call({})}function BA(){return SA||(SA=!0,kA()),EA}var TA,RA,xA,CA,IA,DA,PA=!1;function OA(){return PA||(PA=!0,function(){for(IA in TA={},Lt(),RA=Ke(),xA=RA.Buffer,CA={},RA)RA.hasOwnProperty(IA)&&"SlowBuffer"!==IA&&"Buffer"!==IA&&(CA[IA]=RA[IA]);for(IA in DA=CA.Buffer={},xA)xA.hasOwnProperty(IA)&&"allocUnsafe"!==IA&&"allocUnsafeSlow"!==IA&&(DA[IA]=xA[IA]);if(CA.Buffer.prototype=xA.prototype,DA.from&&DA.from!==Uint8Array.from||(DA.from=function(t,e,r){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return xA(t,e,r)}),DA.alloc||(DA.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=xA(t);return e&&0!==e.length?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n}),!CA.kStringMaxLength)try{CA.kStringMaxLength=Lt().binding("buffer").kStringMaxLength}catch(t){}CA.constants||(CA.constants={MAX_LENGTH:CA.kMaxLength},CA.kStringMaxLength&&(CA.constants.MAX_STRING_LENGTH=CA.kStringMaxLength)),TA=CA}()),TA}var LA,UA,jA,NA=!1;function zA(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function FA(t,e){this.path=t,this.rethrow(e)}function qA(){return NA||(NA=!0,LA={},UA=Ar(),jA=zA,LA.Reporter=jA,zA.prototype.isError=function(t){return t instanceof FA},zA.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},zA.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},zA.prototype.enterKey=function(t){return this._reporterState.path.push(t)},zA.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},zA.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},zA.prototype.path=function(){return this._reporterState.path.join("/")},zA.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},zA.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},zA.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof FA;if(e=n?t:new FA(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},zA.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},UA(FA,Error),FA.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,FA),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}),LA}var WA,HA,GA,YA,KA,VA,ZA=!1;function $A(t,e){GA.call(this,e),YA.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function XA(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return XA.isEncoderBuffer(t)||(t=new XA(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=YA.byteLength(t);else{if(!YA.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}function JA(){return ZA||(ZA=!0,WA={},HA=Ar(),GA=qA().Reporter,YA=OA().Buffer,HA($A,GA),KA=$A,WA.DecoderBuffer=KA,$A.isDecoderBuffer=function(t){return t instanceof $A||"object"==typeof t&&YA.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},$A.prototype.save=function(){return{offset:this.offset,reporter:GA.prototype.save.call(this)}},$A.prototype.restore=function(t){const e=new $A(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,GA.prototype.restore.call(this,t.reporter),e},$A.prototype.isEmpty=function(){return this.offset===this.length},$A.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},$A.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new $A(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},$A.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},VA=XA,WA.EncoderBuffer=VA,XA.isEncoderBuffer=function(t){return t instanceof XA||"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},XA.prototype.join=function(t,e){return t||(t=YA.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):YA.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}),WA}var QA,tM,eM,rM,nM,iM,oM,aM,sM,fM=!1;function uM(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}function hM(){return fM||(fM=!0,QA={},tM=qA().Reporter,eM=JA().EncoderBuffer,rM=JA().DecoderBuffer,nM=tc(),oM=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(iM=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"]),aM=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"],QA=uM,sM=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"],uM.prototype.clone=function(){const t=this._baseState,e={};sM.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},uM.prototype._wrap=function(){const t=this._baseState;oM.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},uM.prototype._init=function(t){const e=this._baseState;nM(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),nM.equal(e.children.length,1,"Root node can have only one child")},uM.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(nM(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(nM(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const n=t[r];e[n]=r})),e})))},aM.forEach((function(t){uM.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),iM.forEach((function(t){uM.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return nM(null===e.tag),e.tag=t,this._useArgs(r),this}})),uM.prototype.use=function(t){nM(t);const e=this._baseState;return nM(null===e.use),e.use=t,this},uM.prototype.optional=function(){return this._baseState.optional=!0,this},uM.prototype.def=function(t){const e=this._baseState;return nM(null===e.default),e.default=t,e.optional=!0,this},uM.prototype.explicit=function(t){const e=this._baseState;return nM(null===e.explicit&&null===e.implicit),e.explicit=t,this},uM.prototype.implicit=function(t){const e=this._baseState;return nM(null===e.explicit&&null===e.implicit),e.implicit=t,this},uM.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},uM.prototype.key=function(t){const e=this._baseState;return nM(null===e.key),e.key=t,this},uM.prototype.any=function(){return this._baseState.any=!0,this},uM.prototype.choice=function(t){const e=this._baseState;return nM(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},uM.prototype.contains=function(t){const e=this._baseState;return nM(null===e.use),e.contains=t,this},uM.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let n,i=r.default,o=!0,a=null;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(o=this._peekTag(t,n,r.any),t.isError(o))return o}else{const n=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),o=!0}catch(t){o=!1}t.restore(n)}}if(r.obj&&o&&(n=t.enterObject()),o){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const n=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(e&&e.track&&null!==r.tag&&e.track(t.path(),n,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new rM(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(n,e)}}return r.obj&&o&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==o?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,i),i},uM.prototype._decodeGeneric=function(t,e,r){const n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},uM.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),nM(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},uM.prototype._decodeChoice=function(t,e){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(o){const a=t.save(),s=r.choice[o];try{const r=s._decode(t,e);if(t.isError(r))return!1;n={type:o,value:r},i=!0}catch(e){return t.restore(a),!1}return!0}),this),i?n:t.error("Choice not matched")},uM.prototype._createEncoderBuffer=function(t){return new eM(t,this.reporter)},uM.prototype._encode=function(t,e,r){const n=this._baseState;if(null!==n.default&&n.default===t)return;const i=this._encodeValue(t,e,r);return void 0===i||this._skipDefault(i,e,r)?void 0:i},uM.prototype._encodeValue=function(t,e,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new tM);let i=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}let o=null,a=!1;if(n.any)i=this._createEncoderBuffer(t);else if(n.choice)i=this._encodeChoice(t,e);else if(n.contains)o=this._getUse(n.contains,r)._encode(t,e),a=!0;else if(n.children)o=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i}),this).filter((function(t){return t})),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,o=this._createEncoderBuffer(t.map((function(r){const n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),r))}else null!==n.use?i=this._getUse(n.use,r)._encode(t,e):(o=this._encodePrimitive(n.tag,t),a=!0);if(!n.any&&null===n.choice){const t=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===t?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(i=this._encodeComposite(t,a,r,o))}return null!==n.explicit&&(i=this._encodeComposite(n.explicit,!1,"context",i)),i},uM.prototype._encodeChoice=function(t,e){const r=this._baseState,n=r.choice[t.type];return n||nM(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},uM.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},uM.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},uM.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}),QA}var cM,dM,lM,pM,mM,bM=!1;function gM(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e}function vM(){return bM||(bM=!0,(cM={}).tagClass=dM={0:"universal",1:"application",2:"context",3:"private"},lM=gM(dM),cM.tagClassByName=lM,pM={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},cM.tag=pM,mM=gM(pM),cM.tagByName=mM),cM}var yM,wM,_M,AM,MM=!1;function EM(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new SM,this.tree._init(t.body)}function SM(t){AM.call(this,"der",t)}function kM(t){return t<10?"0"+t:t}function BM(){yM={},wM=Ar(),_M=OA().Buffer,AM=hM(),vM(),yM=EM,EM.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},wM(SM,AM),SM.prototype._encodeComposite=function(t,e,r,n){const i=function(t,e,r,n){let i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),vM().tagByName.hasOwnProperty(t))i=vM().tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}return i>=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=vM().tagClassByName[r||"universal"]<<6,i)}(t,e,r,this.reporter);if(n.length<128){const t=_M.alloc(2);return t[0]=i,t[1]=n.length,this._createEncoderBuffer([t,n])}let o=1;for(let t=n.length;t>=256;t>>=8)o++;const a=_M.alloc(2+o);a[0]=i,a[1]=128|o;for(let t=1+o,e=n.length;e>0;t--,e>>=8)a[t]=255&e;return this._createEncoderBuffer([a,n])},SM.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=_M.alloc(2*t.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let n=0;for(let e=0;e=128;r>>=7)n++}const i=_M.alloc(n);let o=i.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(i[o--]=127&r;(r>>=7)>0;)i[o--]=128|127&r}return this._createEncoderBuffer(i)},SM.prototype._encodeTime=function(t,e){let r;const n=new Date(t);return"gentime"===e?r=[kM(n.getUTCFullYear()),kM(n.getUTCMonth()+1),kM(n.getUTCDate()),kM(n.getUTCHours()),kM(n.getUTCMinutes()),kM(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[kM(n.getUTCFullYear()%100),kM(n.getUTCMonth()+1),kM(n.getUTCDate()),kM(n.getUTCHours()),kM(n.getUTCMinutes()),kM(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},SM.prototype._encodeNull=function(){return this._createEncoderBuffer("")},SM.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!_M.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=_M.from(e)}if(_M.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=_M.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const n=new Array(r);for(let e=n.length-1;e>=0;e--)n[e]=255&t,t>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(_M.from(n))},SM.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},SM.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},SM.prototype._skipDefault=function(t,e,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=t.readUInt8(e),t.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:vM().tag[r]}}function VM(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(let e=0;e0&&r.ishrn(n),r}function WS(t,e,r){var n,i;do{for(n=xS.alloc(0);8*n.length=e)throw new Error("invalid sig")}function ek(){return JS||(JS=!0,YS={},KS=hr().Buffer,VS=BA(),ZS=MA().ec,$S=SS(),XS=TS(),YS=QS),YS}var rk,nk,ik,ok,ak,sk,fk,uk=!1;function hk(t){Pa().Writable.call(this);var e=fk[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=ik(e.hash),this._tag=e.id,this._signType=e.sign}function ck(t){Pa().Writable.call(this);var e=fk[t];if(!e)throw new Error("Unknown message digest");this._hash=ik(e.hash),this._tag=e.id,this._signType=e.sign}function dk(t){return new hk(t)}function lk(t){return new ck(t)}function pk(){return uk||(uk=!0,rk={},nk=hr().Buffer,ik=uu(),Pa(),ok=Ar(),ak=GS(),sk=ek(),fk=Uu(),Object.keys(fk).forEach((function(t){fk[t].id=nk.from(fk[t].id,"hex"),fk[t.toLowerCase()]=fk[t]})),ok(hk,Pa().Writable),hk.prototype._write=function(t,e,r){this._hash.update(t),r()},hk.prototype.update=function(t,e){return"string"==typeof t&&(t=nk.from(t,e)),this._hash.update(t),this},hk.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=ak(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},ok(ck,Pa().Writable),ck.prototype._write=function(t,e,r){this._hash.update(t),r()},ck.prototype.update=function(t,e){return"string"==typeof t&&(t=nk.from(t,e)),this._hash.update(t),this},ck.prototype.verify=function(t,e,r){"string"==typeof e&&(e=nk.from(e,r)),this.end();var n=this._hash.digest();return sk(e,n,t,this._signType,this._tag)},rk={Sign:dk,Verify:lk,createSign:dk,createVerify:lk}),rk}var mk,bk,gk,vk,yk=!1;function wk(t){this.curveType=vk[t],this.curveType||(this.curveType={name:t}),this.curve=new(MA().ec)(this.curveType.name),this.keys=void 0}function _k(t,e,r){Array.isArray(t)||(t=t.toArray());var n=new bk(t);if(r&&n.lengtho-11)throw new Error("message too long");return n=r?Kk.alloc(o-i-3,255):function(t){var e,r=Kk.allocUnsafe(t),n=0,i=zk(2*t),o=0;for(;nr-a-2)throw new Error("message too long");var s=Kk.alloc(r-n-a-2),f=r-o-1,u=zk(o),h=Wk(Kk.concat([i,s,Kk.alloc(1,1),e],f),qk(u,f)),c=Wk(u,qk(h,o));return new Hk(Kk.concat([Kk.alloc(1),c,h],r))}(o,e);else if(1===n)i=Zk(o,e,r);else{if(3!==n)throw new Error("unknown padding");if((i=new Hk(e)).cmp(o.modulus)>=0)throw new Error("data too long for modulus")}return r?Yk(i,o):Gk(i,o)}}var Xk,Jk,Qk,tB,eB,rB,nB,iB,oB,aB=!1;function sB(t,e){var r=t.modulus.byteLength(),n=nB("sha1").update(oB.alloc(0)).digest(),i=n.length;if(0!==e[0])throw new Error("decryption error");var o=e.slice(1,i+1),a=e.slice(i+1),s=tB(o,Qk(a,i)),f=tB(a,Qk(s,r-i-1));if(function(t,e){t=oB.from(t),e=oB.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;for(;++ia||new eB(e).cmp(o.modulus)>=0)throw new Error("decryption error");i=r?iB(new eB(e),o):rB(e,o);var s=oB.alloc(a-i.length);if(i=oB.concat([s,i],a),4===n)return sB(o,i);if(1===n)return function(t,e,r){for(var n=e.slice(0,2),i=2,o=0;0!==e[i++];)if(i>=e.length){o++;break}var a=e.slice(2,i-1);if(("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}}var uB,hB,cB,dB,lB,pB=!1;function mB(){uB={},Vk||(Vk=!0,$k()),hB=jk,uB.publicEncrypt=hB,aB||(aB=!0,fB()),cB=Xk,uB.privateDecrypt=cB,dB=function(t,e){return hB(t,e,!0)},uB.privateEncrypt=dB,lB=function(t,e){return cB(t,e,!0)},uB.publicDecrypt=lB}var bB,gB,vB,yB,wB,_B,AB,MB=!1;function EB(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}function SB(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>AB||t<0)throw new TypeError("offset must be a uint32");if(t>wB||t>e)throw new RangeError("offset out of range")}function kB(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>AB||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>wB)throw new RangeError("buffer too small")}function BB(e,r,n,i){if(!(yB.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)i=r,r=0,n=e.length;else if("function"==typeof n)i=n,n=e.length-r;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return SB(r,e.length),kB(n,r,e.length),TB(e,r,n,i)}function TB(t,e,r,n){var i=t.buffer,o=new Uint8Array(i,e,r);return _B.getRandomValues(o),n?void Lt().nextTick((function(){n(null,t)})):t}function RB(e,r,n){if(void 0===r&&(r=0),!(yB.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return SB(r,e.length),void 0===n&&(n=e.length-r),kB(n,r,e.length),TB(e,r,n)}function xB(){return MB||(MB=!0,vB={},Lt(),hr(),yr(),yB=hr().Buffer,wB=hr().kMaxLength,_B=t.crypto||t.msCrypto,AB=Math.pow(2,32)-1,_B&&_B.getRandomValues?(bB=BB,vB.randomFill=bB,gB=RB,vB.randomFillSync=gB):(bB=EB,vB.randomFill=bB,gB=EB,vB.randomFillSync=gB)),vB}var CB,IB,DB,PB,OB,LB,UB,jB,NB,zB,FB,qB,WB=!1;function HB(){LB={},DB=yr(),IB=LB.prng=DB,CB=LB.pseudoRandomBytes=IB,UB=LB.rng=CB,LB.randomBytes=UB,PB=uu(),jB=LB.Hash=PB,LB.createHash=jB,OB=Pu(),NB=LB.Hmac=OB,LB.createHmac=NB,zB=zu(),FB=Object.keys(zB),["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(FB),Ph(),um(),Ab||(Ab=!0,Sb()),pk(),qB=Ak(),LB.createECDH=qB,pB||(pB=!0,mB()),xB()}function GB(){return WB||(WB=!0,HB()),LB}var YB,KB,VB,ZB,$B,XB,JB,QB,tT,eT,rT,nT,iT,oT,aT,sT,fT,uT,hT,cT,dT,lT,pT,mT,bT,gT,vT,yT,wT,_T,AT,MT,ET,ST,kT,BT,TT,RT,xT,CT,IT,DT,PT,OT,LT,UT,jT,NT,zT,FT,qT,WT,HT,GT,YT,KT,VT,ZT,$T,XT,JT,QT,tR,eR,rR,nR,iR,oR,aR,sR,fR,uR,hR,cR,dR,lR,pR,mR,bR,gR,vR,yR,wR,_R=!1;function AR(t){return ZB.locateFile?ZB.locateFile(t,iT):iT+t}function MR(t){MR.shown||(MR.shown={}),MR.shown[t]||(MR.shown[t]=1,cT(t))}function ER(t,e){t||jR("Assertion failed: "+e)}function SR(t,e,r){for(var n=e+r,i=e;t[i]&&!(i>=n);)++i;if(i-e>16&&t.subarray&&gT)return gT.decode(t.subarray(e,i));for(var o="";e>10,56320|1023&u)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}function kR(t,e){return t?SR(_T,t,e):""}function BR(t,e,r,n){if(!(n>0))return 0;for(var i=r,o=r+n-1,a=0;a=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a);if(s<=127){if(r>=o)break;e[r++]=s}else if(s<=2047){if(r+1>=o)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=o)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=o)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-i}function TR(t,e,r){return BR(t,_T,e,r)}function RR(t){for(var e=0,r=0;r=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&t.charCodeAt(++r)),n<=127?++e:e+=n<=2047?2:n<=65535?3:4}return e}function xR(t,e){for(var r=t,n=r>>1,i=n+e/2;!(n>=i)&&MT[n];)++n;if((r=n<<1)-t>32&&vT)return vT.decode(_T.subarray(t,r));for(var o="",a=0;!(a>=e/2);++a){var s=AT[t+2*a>>1];if(0==s)break;o+=String.fromCharCode(s)}return o}function CR(t,e,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=e,i=(r-=2)<2*t.length?r/2:t.length,o=0;o>1]=a,e+=2}return AT[e>>1]=0,e-n}function IR(t){return 2*t.length}function DR(t,e){for(var r=0,n="";!(r>=e/4);){var i=ET[t+4*r>>2];if(0==i)break;if(++r,i>=65536){var o=i-65536;n+=String.fromCharCode(55296|o>>10,56320|1023&o)}else n+=String.fromCharCode(i)}return n}function PR(t,e,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,i=n+r-4,o=0;o=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o);if(ET[e>>2]=a,(e+=4)+4>i)break}return ET[e>>2]=0,e-n}function OR(t){for(var e=0,r=0;r=55296&&n<=57343&&++r,e+=4}return e}function LR(t){IT++,ZB.monitorRunDependencies&&ZB.monitorRunDependencies(IT)}function UR(t){if(IT--,ZB.monitorRunDependencies&&ZB.monitorRunDependencies(IT),0==IT&&(null!==DT&&(clearInterval(DT),DT=null),PT)){var e=PT;PT=null,e()}}function jR(t){throw ZB.onAbort&&ZB.onAbort(t),cT(t+=""),bT=!0,1,t="abort("+t+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(t)}function NR(t){return t.startsWith(OT)}function zR(t){return t.startsWith("file://")}function FR(t){try{if(t==LT&&pT)return new Uint8Array(pT);if(sT)return sT(t);throw"both async and sync fetching of the wasm failed"}catch(t){jR(t)}}function qR(){var t={a:lR};function e(t,e){var r,n,i=t.exports;ZB.asm=i,mT=ZB.asm.J,r=mT.buffer,yT=r,ZB.HEAP8=wT=new Int8Array(r),ZB.HEAP16=AT=new Int16Array(r),ZB.HEAP32=ET=new Int32Array(r),ZB.HEAPU8=_T=new Uint8Array(r),ZB.HEAPU16=MT=new Uint16Array(r),ZB.HEAPU32=ST=new Uint32Array(r),ZB.HEAPF32=kT=new Float32Array(r),ZB.HEAPF64=BT=new Float64Array(r),TT=ZB.asm.N,n=ZB.asm.K,xT.unshift(n),UR()}function r(t){e(t.instance)}function n(e){return function(){if(!pT&&(tT||eT)){if("function"==typeof fetch&&!zR(LT))return fetch(LT,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+LT+"'";return t.arrayBuffer()})).catch((function(){return FR(LT)}));if(aT)return new Promise((function(t,e){aT(LT,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return FR(LT)}))}().then((function(e){return WebAssembly.instantiate(e,t)})).then(e,(function(t){cT("failed to asynchronously prepare wasm: "+t),jR(t)}))}if(LR(),ZB.instantiateWasm)try{return ZB.instantiateWasm(t,e)}catch(t){return cT("Module.instantiateWasm callback failed with error: "+t),!1}return pT||"function"!=typeof WebAssembly.instantiateStreaming||NR(LT)||zR(LT)||"function"!=typeof fetch?n(r):fetch(LT,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(r,(function(t){return cT("wasm streaming compile failed: "+t),cT("falling back to ArrayBuffer instantiation"),n(r)}))})),{}}function WR(t){for(;t.length>0;){var e=t.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?TT.get(r)():TT.get(r)(e.arg):r(void 0===e.arg?null:e.arg)}else e(ZB)}}function HR(){var t=new Error;if(!t.stack){try{throw new Error}catch(e){t=e}if(!t.stack)return"(no stack trace available)"}return t.stack.toString()}function GR(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return function(){return crypto.getRandomValues(t),t[0]}}if(rT)try{return GB(),function(){return GB().randomBytes(1)[0]}}catch(t){}return function(){jR("randomDevice")}}function YR(t){for(var e=function(t,e){return e||(e=dT),Math.ceil(t/e)*e}(t,65536),r=mR(e);t>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return o=28,ET[gR()>>2]=o,-1;default:return-28}}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),-t.errno}var o}function VR(t,e,r){HT.varargs=r;try{var n=HT.getStr(t),i=r?HT.get():0;return WT.open(n,e,i).fd}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),-t.errno}}function ZR(t,e,r,n,i){}function $R(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function XR(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);GT=t}function JR(t){for(var e="",r=t;_T[r];)e+=GT[_T[r++]];return e}function QR(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=ZT&&e<=$T?"_"+t:t}function tx(t,e){return t=QR(t),new Function("body","return function "+t+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(e)}function ex(t,e){var r=tx(e,(function(t){this.name=e,this.message=t;var r=new Error(t).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}function rx(t){throw new XT(t)}function nx(t){throw new JT(t)}function ix(t,e,r){function n(e){var n=r(e);n.length!==t.length&&nx("Mismatched type converter count");for(var i=0;i>o])},destructorFunction:null})}function sx(t){if(!(this instanceof vx))return!1;if(!(t instanceof vx))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,i=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return e===n&&r===i}function fx(t){rx(t.$$.ptrType.registeredClass.name+" instance already deleted")}function ux(t){}function hx(t){t.count.value-=1,0===t.count.value&&function(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}(t)}function cx(t){return"undefined"==typeof FinalizationGroup?(cx=function(t){return t},t):(QT=new FinalizationGroup((function(t){for(var e=t.next();!e.done;e=t.next()){var r=e.value;r.ptr?hx(r):console.warn("object already deleted: "+r.ptr)}})),ux=function(t){QT.unregister(t.$$)},(cx=function(t){return QT.register(t,t.$$,t.$$),t})(t))}function dx(){if(this.$$.ptr||fx(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t,e=cx(Object.create(Object.getPrototypeOf(this),{$$:{value:(t=this.$$,{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType})}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function lx(){this.$$.ptr||fx(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&rx("Object already scheduled for deletion"),ux(this),hx(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function px(){return!this.$$.ptr}function mx(){for(;eR.length;){var t=eR.pop();t.$$.deleteScheduled=!1,t.delete()}}function bx(){return this.$$.ptr||fx(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&rx("Object already scheduled for deletion"),eR.push(this),1===eR.length&&tR&&tR(mx),this.$$.deleteScheduled=!0,this}function gx(){vx.prototype.isAliasOf=sx,vx.prototype.clone=dx,vx.prototype.delete=lx,vx.prototype.isDeleted=px,vx.prototype.deleteLater=bx}function vx(){}function yx(t,e,r){if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||rx("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[e].overloadTable+")!"),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}}function wx(t,e,r,n,i,o,a,s){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=i,this.getActualType=o,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function _x(t,e,r){for(;e!==r;)e.upcast||rx("Expected null or instance of "+r.name+", got an instance of "+e.name),t=e.upcast(t),e=e.baseClass;return t}function Ax(t,e){if(null===e)return this.isReference&&rx("null is not a valid "+this.name),0;e.$$||rx('Cannot pass "'+nC(e)+'" as a '+this.name),e.$$.ptr||rx("Cannot pass deleted object as a pointer of type "+this.name);var r=e.$$.ptrType.registeredClass;return _x(e.$$.ptr,r,this.registeredClass)}function Mx(t,e){var r;if(null===e)return this.isReference&&rx("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||rx('Cannot pass "'+nC(e)+'" as a '+this.name),e.$$.ptr||rx("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&e.$$.ptrType.isConst&&rx("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);var n=e.$$.ptrType.registeredClass;if(r=_x(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&rx("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:rx("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var i=e.clone();r=this.rawShare(r,eC((function(){i.delete()}))),null!==t&&t.push(this.rawDestructor,r)}break;default:rx("Unsupporting sharing policy")}return r}function Ex(t,e){if(null===e)return this.isReference&&rx("null is not a valid "+this.name),0;e.$$||rx('Cannot pass "'+nC(e)+'" as a '+this.name),e.$$.ptr||rx("Cannot pass deleted object as a pointer of type "+this.name),e.$$.ptrType.isConst&&rx("Cannot convert argument of type "+e.$$.ptrType.name+" to parameter type "+this.name);var r=e.$$.ptrType.registeredClass;return _x(e.$$.ptr,r,this.registeredClass)}function Sx(t){return this.fromWireType(ST[t>>2])}function kx(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function Bx(t){this.rawDestructor&&this.rawDestructor(t)}function Tx(t){null!==t&&t.delete()}function Rx(t,e,r){if(e===r)return t;if(void 0===r.baseClass)return null;var n=Rx(t,e,r.baseClass);return null===n?null:r.downcast(n)}function xx(){return Object.keys(nR).length}function Cx(){var t=[];for(var e in nR)nR.hasOwnProperty(e)&&t.push(nR[e]);return t}function Ix(t){tR=t,eR.length&&tR&&tR(mx)}function Dx(){ZB.getInheritedInstanceCount=xx,ZB.getLiveInheritedInstances=Cx,ZB.flushPendingDeletes=mx,ZB.setDelayFunction=Ix}function Px(t,e){return e=function(t,e){for(void 0===e&&rx("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e}(t,e),nR[e]}function Ox(t,e){return e.ptrType&&e.ptr||nx("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!==!!e.smartPtr&&nx("Both smartPtrType and smartPtr must be specified"),e.count={value:1},cx(Object.create(t,{$$:{value:e}}))}function Lx(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=Px(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function i(){return this.isSmartPointer?Ox(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Ox(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var o,a=this.registeredClass.getActualType(e),s=rR[a];if(!s)return i.call(this);o=this.isConst?s.constPointerType:s.pointerType;var f=Rx(e,this.registeredClass,o.registeredClass);return null===f?i.call(this):this.isSmartPointer?Ox(o.registeredClass.instancePrototype,{ptrType:o,ptr:f,smartPtrType:this,smartPtr:t}):Ox(o.registeredClass.instancePrototype,{ptrType:o,ptr:f})}function Ux(){jx.prototype.getPointee=kx,jx.prototype.destructor=Bx,jx.prototype.argPackAdvance=8,jx.prototype.readValueFromPointer=Sx,jx.prototype.deleteObject=Tx,jx.prototype.fromWireType=Lx}function jx(t,e,r,n,i,o,a,s,f,u,h){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=i,this.pointeeType=o,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=f,this.rawShare=u,this.rawDestructor=h,i||void 0!==e.baseClass?this.toWireType=Mx:n?(this.toWireType=Ax,this.destructorFunction=null):(this.toWireType=Ex,this.destructorFunction=null)}function Nx(t,e,r){return t.includes("j")?function(t,e,r){var n=ZB["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}(t,e,r):TT.get(e).apply(null,r)}function zx(t,e){var r,n,i,o=(t=JR(t)).includes("j")?(r=t,n=e,i=[],function(){i.length=arguments.length;for(var t=0;t>2)+n]);return r}function Gx(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function Yx(t,e,r,n,i,o){ER(e>0);var a=Hx(e,r);i=zx(n,i);var s=[o],f=[];ix([],[t],(function(t){var r="constructor "+(t=t[0]).name;if(void 0===t.registeredClass.constructor_body&&(t.registeredClass.constructor_body=[]),void 0!==t.registeredClass.constructor_body[e-1])throw new XT("Cannot register multiple constructors with identical number of parameters ("+(e-1)+") for class '"+t.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return t.registeredClass.constructor_body[e-1]=function(){qx("Cannot construct "+t.name+" due to unbound types",a)},ix([],a,(function(n){return t.registeredClass.constructor_body[e-1]=function(){arguments.length!==e-1&&rx(r+" called with "+arguments.length+" arguments, expected "+(e-1)),f.length=0,s.length=e;for(var t=1;t0?", ":"")+c),d+=(u?"var rv = ":"")+"invoker(fn"+(c.length>0?", ":"")+c+");\n",s)d+="runDestructors(destructors);\n";else for(f=a?1:2;f4&&0==--aR[t].refcount&&(aR[t]=void 0,oR.push(t))}function Jx(){for(var t=0,e=5;e>2])};case 3:return function(t){return this.fromWireType(BT[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function oC(t,e,r){var n=$R(r);ox(t,{name:e=JR(e),fromWireType:function(t){return t},toWireType:function(t,e){if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+nC(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:iC(e,n),destructorFunction:null})}function aC(t,e,r){switch(e){case 0:return r?function(t){return wT[t]}:function(t){return _T[t]};case 1:return r?function(t){return AT[t>>1]}:function(t){return MT[t>>1]};case 2:return r?function(t){return ET[t>>2]}:function(t){return ST[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function sC(t,e,r,n,i){e=JR(e),-1===i&&(i=4294967295);var o=$R(r),a=function(t){return t};if(0===n){var s=32-8*r;a=function(t){return t<>>s}}var f=e.includes("unsigned");ox(t,{name:e,fromWireType:a,toWireType:function(t,r){if("number"!=typeof r&&"boolean"!=typeof r)throw new TypeError('Cannot convert "'+nC(r)+'" to '+this.name);if(ri)throw new TypeError('Passing a number "'+nC(r)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+n+", "+i+"]!");return f?r>>>0:0|r},argPackAdvance:8,readValueFromPointer:aC(e,o,0!==n),destructorFunction:null})}function fC(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function i(t){var e=ST,r=e[t>>=2],i=e[t+1];return new n(yT,i,r)}ox(t,{name:r=JR(r),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})}function uC(t,e){var r="std::string"===(e=JR(e));ox(t,{name:e,fromWireType:function(t){var e,n=ST[t>>2];if(r)for(var i=t+4,o=0;o<=n;++o){var a=t+4+o;if(o==n||0==_T[a]){var s=kR(i,a-i);void 0===e?e=s:(e+=String.fromCharCode(0),e+=s),i=a+1}}else{var f=new Array(n);for(o=0;o>2]=i,r&&n)TR(e,o+4,i+1);else if(n)for(var a=0;a255&&(pR(o),rx("String has UTF-16 code units that do not fit in 8 bits")),_T[o+4+a]=s}else for(a=0;a>2],a=o(),f=t+4,u=0;u<=i;++u){var h=t+4+u*e;if(u==i||0==a[h>>s]){var c=n(f,h-f);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),f=h+e}}return pR(t),r},toWireType:function(t,n){"string"!=typeof n&&rx("Cannot pass non-string to C++ string type "+r);var o=a(n),f=mR(4+o+e);return ST[f>>2]=o>>s,i(n,f+4,o+e),null!==t&&t.push(pR,f),f},argPackAdvance:8,readValueFromPointer:Sx,destructorFunction:function(t){pR(t)}})}function cC(t,e){ox(t,{isVoid:!0,name:e=JR(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(t,e){}})}function dC(t){return t||rx("Cannot use deleted val. handle = "+t),aR[t].value}function lC(t,e){var r=KT[t];return void 0===r&&rx(e+" has unknown type "+Fx(t)),r}function pC(t,e,r){t=dC(t),e=lC(e,"emval::as");var n=[],i=eC(n);return ET[r>>2]=i,e.toWireType(n,t)}function mC(t,e,r,n){var i,o;(t=fR[t])(e=dC(e),r=void 0===(o=sR[i=r])?JR(i):o,null,n)}function bC(t,e){for(var r=function(t,e){for(var r=new Array(t),n=0;n>2)+n],"parameter "+n);return r}(t,e),n=r[0],i=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",o=["retType"],a=[n],s="",f=0;f4&&(aR[t].refcount+=1)}function vC(t){Gx(aR[t].value),Xx(t)}function yC(t,e){return eC((t=lC(t,"_emval_take_value")).readValueFromPointer(e))}function wC(){jR()}function _C(){return void 0===_C.start&&(_C.start=Date.now()),1e3*(Date.now()-_C.start)|0}function AC(t,e){return(t>>>0)+4294967296*e}function MC(t,e){if(t<=0)return t;var r=e<=32?Math.abs(1<=r&&(e<=32||t>r)&&(t=-2*r+t),t}function EC(t,e){return t>=0?t:e<=32?2*Math.abs(1<0?"\n":"")+function(t){var e=HR(),r=e.lastIndexOf("_emscripten_log"),n=e.lastIndexOf("_emscripten_get_callstack"),i=e.indexOf("\n",Math.max(r,n))+1;e=e.slice(i),32&t&&MR("EM_LOG_DEMANGLE is deprecated; ignoring"),8&t&&"undefined"==typeof emscripten_source_map&&(MR('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'),t^=8,t|=16);var o=null;if(128&t)for(o=SC(arguments);o[1].includes("_emscripten_");)o=SC(o[0]);var a=e.split("\n");e="";var s=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)"),f=new RegExp("\\s*(.*?)@(.*):(.*)(:(.*))?"),u=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var h in a){var c=a[h],d="",l="",p=0,m=0,b=u.exec(c);if(b&&5==b.length)d=b[1],l=b[2],p=b[3],m=b[4];else{if((b=s.exec(c))||(b=f.exec(c)),!(b&&b.length>=4)){e+=c+"\n";continue}d=b[1],l=b[2],p=b[3],m=0|b[4]}var g=!1;if(8&t){var v=emscripten_source_map.originalPositionFor({line:p,column:m});(g=v&&v.source)&&(64&t&&(v.source=v.source.substring(v.source.replace(/\\/g,"/").lastIndexOf("/")+1)),e+=" at "+d+" ("+v.source+":"+v.line+":"+v.column+")\n")}(16&t||!g)&&(64&t&&(l=l.substring(l.replace(/\\/g,"/").lastIndexOf("/")+1)),e+=(g?" = "+d:" at "+d)+" ("+l+":"+p+":"+m+")\n"),128&t&&o[0]&&(o[1]==d&&o[2].length>0&&(e=e.replace(/\s+$/,""),e+=" with values: "+o[1]+o[2]+"\n"),o=SC(o[0]))}return e.replace(/\s+$/,"")}(t)),1&t?4&t?console.error(e):2&t?console.warn(e):512&t?console.info(e):256&t?console.debug(e):console.log(e):6&t?cT(e):hT(e)}function BC(t,e,r){kC(t,SR(function(t,e){var r=t,n=e;function i(t){var e;return n=function(t,e){return"double"!==e&&"i64"!==e||7&t&&(t+=4),t}(n,t),"double"===t?(e=BT[n>>3],n+=8):"i64"==t?(e=[ET[n>>2],ET[n+4>>2]],n+=8):(t="i32",e=ET[n>>2],n+=4),e}for(var o,a,s,f,u=[];;){var h=r;if(0===(o=wT[r>>0]))break;if(a=wT[r+1>>0],37==o){var c=!1,d=!1,l=!1,p=!1,m=!1;t:for(;;){switch(a){case 43:c=!0;break;case 45:d=!0;break;case 35:l=!0;break;case 48:if(p)break t;p=!0;break;case 32:m=!0;break;default:break t}r++,a=wT[r+1>>0]}var b=0;if(42==a)b=i("i32"),r++,a=wT[r+1>>0];else for(;a>=48&&a<=57;)b=10*b+(a-48),r++,a=wT[r+1>>0];var g,v=!1,y=-1;if(46==a){if(y=0,v=!0,r++,42==(a=wT[r+1>>0]))y=i("i32"),r++;else for(;;){var w=wT[r+1>>0];if(w<48||w>57)break;y=10*y+(w-48),r++}a=wT[r+1>>0]}switch(y<0&&(y=6,v=!1),String.fromCharCode(a)){case"h":104==wT[r+2>>0]?(r++,g=1):g=2;break;case"l":108==wT[r+2>>0]?(r++,g=8):g=4;break;case"L":case"q":case"j":g=8;break;case"z":case"t":case"I":g=4;break;default:g=null}switch(g&&r++,a=wT[r+1>>0],String.fromCharCode(a)){case"d":case"i":case"u":case"o":case"x":case"X":case"p":var _=100==a||105==a;s=i("i"+8*(g=g||4)),8==g&&(s=117==a?(s[0]>>>0)+4294967296*(s[1]>>>0):AC(s[0],s[1])),g<=4&&(s=(_?MC:EC)(s&Math.pow(256,g)-1,8*g));var A=Math.abs(s),M="";if(100==a||105==a)k=MC(s,8*g).toString(10);else if(117==a)k=EC(s,8*g).toString(10),s=Math.abs(s);else if(111==a)k=(l?"0":"")+A.toString(8);else if(120==a||88==a){if(M=l&&0!=s?"0x":"",s<0){s=-s,k=(A-1).toString(16);for(var E=[],S=0;S=0&&(c?M="+"+M:m&&(M=" "+M)),"-"==k.charAt(0)&&(M="-"+M,k=k.substr(1));M.length+k.lengthR&&R>=-4?(a=(103==a?"f":"F").charCodeAt(0),y-=R+1):(a=(103==a?"e":"E").charCodeAt(0),y--),T=Math.min(y,20)}101==a||69==a?(k=s.toExponential(T),/[eE][-+]\d$/.test(k)&&(k=k.slice(0,-1)+"0"+k.slice(-1))):102!=a&&70!=a||(k=s.toFixed(T),0===s&&((f=s)<0||0===f&&1/f==-1/0)&&(k="-"+k));var x=k.split("e");if(B&&!l)for(;x[0].length>1&&x[0].includes(".")&&("0"==x[0].slice(-1)||"."==x[0].slice(-1));)x[0]=x[0].slice(0,-1);else for(l&&-1==k.indexOf(".")&&(x[0]+=".");y>T++;)x[0]+="0";k=x[0]+(x.length>1?"e"+x[1]:""),69==a&&(k=k.toUpperCase()),s>=0&&(c?k="+"+k:m&&(k=" "+k))}else k=(s<0?"-":"")+"inf",p=!1;for(;k.length>0]);else u=u.concat(NC("(null)".substr(0,I),!0));if(d)for(;I0;)u.push(32);d||u.push(i("i8"));break;case"n":var D=i("i32*");ET[D>>2]=u.length;break;case"%":u.push(o);break;default:for(S=h;S>0])}r+=2}else u.push(o),r+=1}return u}(e,r),0))}function TC(t){_T.length;jR("OOM")}function RC(){if(!RC.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:QB||"./this.program"};for(var e in uR)t[e]=uR[e];var r=[];for(var e in t)r.push(e+"="+t[e]);RC.strings=r}return RC.strings}function xC(t,e){try{var r=0;return RC().forEach((function(n,i){var o=e+r;ET[t+4*i>>2]=o,function(t,e,r){for(var n=0;n>0]=t.charCodeAt(n);r||(wT[e>>0]=0)}(n,o),r+=n.length+1})),0}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),t.errno}}function CC(t,e){try{var r=RC();ET[t>>2]=r.length;var n=0;return r.forEach((function(t){n+=t.length+1})),ET[e>>2]=n,0}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),t.errno}}function IC(t){try{var e=HT.getStreamFromFD(t);return WT.close(e),0}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),t.errno}}function DC(t,e){try{var r=HT.getStreamFromFD(t),n=r.tty?2:WT.isDir(r.mode)?3:WT.isLink(r.mode)?7:4;return wT[e>>0]=n,0}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),t.errno}}function PC(t,e,r,n){try{var i=HT.getStreamFromFD(t),o=HT.doReadv(i,e,r);return ET[n>>2]=o,0}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),t.errno}}function OC(t,e,r,n,i){try{var o=HT.getStreamFromFD(t),a=4294967296*r+(e>>>0),s=9007199254740992;return a<=-s||a>=s?-61:(WT.llseek(o,a,n),jT=[o.position>>>0,(UT=o.position,+Math.abs(UT)>=1?UT>0?(0|Math.min(+Math.floor(UT/4294967296),4294967295))>>>0:~~+Math.ceil((UT-+(~~UT>>>0))/4294967296)>>>0:0)],ET[i>>2]=jT[0],ET[i+4>>2]=jT[1],o.getdents&&0===a&&0===n&&(o.getdents=null),0)}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),t.errno}}function LC(t,e,r,n){try{var i=HT.getStreamFromFD(t),o=HT.doWritev(i,e,r);return ET[n>>2]=o,0}catch(t){return void 0!==WT&&t instanceof WT.ErrnoError||jR(t),t.errno}}function UC(t){var e=Date.now();return ET[t>>2]=e/1e3|0,ET[t+4>>2]=e%1e3*1e3|0,0}function jC(t){lT(t)}function NC(t,e,r){var n=r>0?r:RR(t)+1,i=new Array(n),o=BR(t,i,0,i.length);return e&&(i.length=o),i}function zC(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function FC(t){function e(){yR||(yR=!0,ZB.calledRun=!0,bT||(!0,ZB.noFSInit||WT.init.initialized||WT.init(),FT.init(),WR(xT),ZB.onRuntimeInitialized&&ZB.onRuntimeInitialized(),function(){if(ZB.postRun)for("function"==typeof ZB.postRun&&(ZB.postRun=[ZB.postRun]);ZB.postRun.length;)t=ZB.postRun.shift(),CT.unshift(t);var t;WR(CT)}()))}t=t||JB,IT>0||(!function(){if(ZB.preRun)for("function"==typeof ZB.preRun&&(ZB.preRun=[ZB.preRun]);ZB.preRun.length;)t=ZB.preRun.shift(),RT.unshift(t);var t;WR(RT)}(),IT>0||(ZB.setStatus?(ZB.setStatus("Running..."),setTimeout((function(){setTimeout((function(){ZB.setStatus("")}),1),e()}),1)):e()))}function qC(){for(XB in{},YB=Lt(),KB="/Users/chengwan/Documents/GitHub/Monibuca/jessibuca/demo/public",VB=Ke().Buffer,$B={},ZB=void 0!==ZB?ZB:{})ZB.hasOwnProperty(XB)&&($B[XB]=ZB[XB]);for(XB in JB=[],QB="./this.program",function(t,e){throw e},tT=!1,eT=!1,rT=!1,nT=!1,tT="object"==typeof window,eT="function"==typeof importScripts,rT="object"==typeof YB&&"object"==typeof YB.versions&&"string"==typeof YB.versions.node,nT=!tT&&!rT&&!eT,iT="",rT?(iT=eT?Qe().dirname(iT)+"/":KB+"/",oT=function(t,e){return fT||(fT=rr()),uT||(uT=Qe()),t=uT.normalize(t),fT.readFileSync(t,e?null:"utf8")},sT=function(t){var e=oT(t,!0);return e.buffer||(e=new Uint8Array(e)),ER(e.buffer),e},YB.argv.length>1&&(QB=YB.argv[1].replace(/\\/g,"/")),JB=YB.argv.slice(2),ZB,YB.on("uncaughtException",(function(t){if(!(t instanceof zC))throw t})),YB.on("unhandledRejection",jR),function(t){YB.exit(t)},ZB.inspect=function(){return"[Emscripten Module object]"}):nT?("undefined"!=typeof read&&(oT=function(t){return read(t)}),sT=function(t){var e;return"function"==typeof readbuffer?new Uint8Array(readbuffer(t)):(ER("object"==typeof(e=read(t,"binary"))),e)},"undefined"!=typeof scriptArgs?JB=scriptArgs:void 0!==arguments&&(JB=arguments),"function"==typeof quit&&function(t){quit(t)},"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(tT||eT)&&(eT?iT=self.location.href:"undefined"!=typeof document&&document.currentScript&&(iT=document.currentScript.src),iT=0!==iT.indexOf("blob:")?iT.substr(0,iT.lastIndexOf("/")+1):"",oT=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},eT&&(sT=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),aT=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)},function(t){document.title=t}),hT=ZB.print||console.log.bind(console),cT=ZB.printErr||console.warn.bind(console),$B)$B.hasOwnProperty(XB)&&(ZB[XB]=$B[XB]);if($B=null,ZB.arguments&&(JB=ZB.arguments),ZB.thisProgram&&(QB=ZB.thisProgram),ZB.quit&&ZB.quit,dT=16,0,lT=function(t){t},ZB.wasmBinary&&(pT=ZB.wasmBinary),ZB.noExitRuntime||!0,"object"!=typeof WebAssembly&&jR("no native wasm support detected"),bT=!1,gT="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,vT="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,ZB.INITIAL_MEMORY||67108864,RT=[],xT=[],CT=[],!1,IT=0,DT=null,PT=null,ZB.preloadedImages={},ZB.preloadedAudios={},OT="data:application/octet-stream;base64,",NR(LT="ff.wasm")||(LT=AR(LT)),NT={splitPath:function(t){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1)},normalizeArray:function(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:function(t){var e="/"===t.charAt(0),r="/"===t.substr(-1);return(t=NT.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},dirname:function(t){var e=NT.splitPath(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:function(t){if("/"===t)return"/";var e=(t=(t=NT.normalize(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},extname:function(t){return NT.splitPath(t)[3]},join:function(){var t=Array.prototype.slice.call(arguments,0);return NT.normalize(t.join("/"))},join2:function(t,e){return NT.normalize(t+"/"+e)}},zT={resolve:function(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:WT.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e="/"===n.charAt(0)}return(e?"/":"")+(t=NT.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||"."},relative:function(t,e){function r(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=zT.resolve(t).substr(1),e=zT.resolve(e).substr(1);for(var n=r(t.split("/")),i=r(e.split("/")),o=Math.min(n.length,i.length),a=o,s=0;s0?r.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;t.input=NC(e,!0)}return t.input.shift()},put_char:function(t,e){null===e||10===e?(hT(SR(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&t.output.length>0&&(hT(SR(t.output,0)),t.output=[])}},default_tty1_ops:{put_char:function(t,e){null===e||10===e?(cT(SR(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&t.output.length>0&&(cT(SR(t.output,0)),t.output=[])}}},qT={ops_table:null,mount:function(t){return qT.createNode(null,"/",16895,0)},createNode:function(t,e,r,n){if(WT.isBlkdev(r)||WT.isFIFO(r))throw new WT.ErrnoError(63);qT.ops_table||(qT.ops_table={dir:{node:{getattr:qT.node_ops.getattr,setattr:qT.node_ops.setattr,lookup:qT.node_ops.lookup,mknod:qT.node_ops.mknod,rename:qT.node_ops.rename,unlink:qT.node_ops.unlink,rmdir:qT.node_ops.rmdir,readdir:qT.node_ops.readdir,symlink:qT.node_ops.symlink},stream:{llseek:qT.stream_ops.llseek}},file:{node:{getattr:qT.node_ops.getattr,setattr:qT.node_ops.setattr},stream:{llseek:qT.stream_ops.llseek,read:qT.stream_ops.read,write:qT.stream_ops.write,allocate:qT.stream_ops.allocate,mmap:qT.stream_ops.mmap,msync:qT.stream_ops.msync}},link:{node:{getattr:qT.node_ops.getattr,setattr:qT.node_ops.setattr,readlink:qT.node_ops.readlink},stream:{}},chrdev:{node:{getattr:qT.node_ops.getattr,setattr:qT.node_ops.setattr},stream:WT.chrdev_stream_ops}});var i=WT.createNode(t,e,r,n);return WT.isDir(i.mode)?(i.node_ops=qT.ops_table.dir.node,i.stream_ops=qT.ops_table.dir.stream,i.contents={}):WT.isFile(i.mode)?(i.node_ops=qT.ops_table.file.node,i.stream_ops=qT.ops_table.file.stream,i.usedBytes=0,i.contents=null):WT.isLink(i.mode)?(i.node_ops=qT.ops_table.link.node,i.stream_ops=qT.ops_table.link.stream):WT.isChrdev(i.mode)&&(i.node_ops=qT.ops_table.chrdev.node,i.stream_ops=qT.ops_table.chrdev.stream),i.timestamp=Date.now(),t&&(t.contents[e]=i,t.timestamp=i.timestamp),i},getFileDataAsTypedArray:function(t){return t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0)},expandFileStorage:function(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage:function(t,e){if(t.usedBytes!=e)if(0==e)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr:function(t){var e={};return e.dev=WT.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,WT.isDir(t.mode)?e.size=4096:WT.isFile(t.mode)?e.size=t.usedBytes:WT.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&qT.resizeFileStorage(t,e.size)},lookup:function(t,e){throw WT.genericErrors[44]},mknod:function(t,e,r,n){return qT.createNode(t,e,r,n)},rename:function(t,e,r){if(WT.isDir(t.mode)){var n;try{n=WT.lookupNode(e,r)}catch(t){}if(n)for(var i in n.contents)throw new WT.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir:function(t,e){var r=WT.lookupNode(t,e);for(var n in r.contents)throw new WT.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir:function(t){var e=[".",".."];for(var r in t.contents)t.contents.hasOwnProperty(r)&&e.push(r);return e},symlink:function(t,e,r){var n=qT.createNode(t,e,41471,0);return n.link=r,n},readlink:function(t){if(!WT.isLink(t.mode))throw new WT.ErrnoError(28);return t.link}},stream_ops:{read:function(t,e,r,n,i){var o=t.node.contents;if(i>=t.node.usedBytes)return 0;var a=Math.min(t.node.usedBytes-i,n);if(a>8&&o.subarray)e.set(o.subarray(i,i+a),r);else for(var s=0;s0||n+r8)throw new WT.ErrnoError(32);for(var i=NT.normalizeArray(t.split("/").filter((function(t){return!!t})),!1),o=WT.root,a="/",s=0;s40)throw new WT.ErrnoError(32)}}return{path:a,node:o}},getPath:function(t){for(var e;;){if(WT.isRoot(t)){var r=t.mount.mountpoint;return e?"/"!==r[r.length-1]?r+"/"+e:r+e:r}e=e?t.name+"/"+e:t.name,t=t.parent}},hashName:function(t,e){for(var r=0,n=0;n>>0)%WT.nameTable.length},hashAddNode:function(t){var e=WT.hashName(t.parent.id,t.name);t.name_next=WT.nameTable[e],WT.nameTable[e]=t},hashRemoveNode:function(t){var e=WT.hashName(t.parent.id,t.name);if(WT.nameTable[e]===t)WT.nameTable[e]=t.name_next;else for(var r=WT.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode:function(t,e){var r=WT.mayLookup(t);if(r)throw new WT.ErrnoError(r,t);for(var n=WT.hashName(t.id,e),i=WT.nameTable[n];i;i=i.name_next){var o=i.name;if(i.parent.id===t.id&&o===e)return i}return WT.lookup(t,e)},createNode:function(t,e,r,n){var i=new WT.FSNode(t,e,r,n);return WT.hashAddNode(i),i},destroyNode:function(t){WT.hashRemoveNode(t)},isRoot:function(t){return t===t.parent},isMountpoint:function(t){return!!t.mounted},isFile:function(t){return 32768==(61440&t)},isDir:function(t){return 16384==(61440&t)},isLink:function(t){return 40960==(61440&t)},isChrdev:function(t){return 8192==(61440&t)},isBlkdev:function(t){return 24576==(61440&t)},isFIFO:function(t){return 4096==(61440&t)},isSocket:function(t){return 49152==(49152&t)},flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:function(t){var e=WT.flagModes[t];if(void 0===e)throw new Error("Unknown file open mode: "+t);return e},flagsToPermissionString:function(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:function(t,e){return WT.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2},mayLookup:function(t){var e=WT.nodePermissions(t,"x");return e||(t.node_ops.lookup?0:2)},mayCreate:function(t,e){try{WT.lookupNode(t,e);return 20}catch(t){}return WT.nodePermissions(t,"wx")},mayDelete:function(t,e,r){var n;try{n=WT.lookupNode(t,e)}catch(t){return t.errno}var i=WT.nodePermissions(t,"wx");if(i)return i;if(r){if(!WT.isDir(n.mode))return 54;if(WT.isRoot(n)||WT.getPath(n)===WT.cwd())return 10}else if(WT.isDir(n.mode))return 31;return 0},mayOpen:function(t,e){return t?WT.isLink(t.mode)?32:WT.isDir(t.mode)&&("r"!==WT.flagsToPermissionString(e)||512&e)?31:WT.nodePermissions(t,WT.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd:function(t,e){t=t||0,e=e||WT.MAX_OPEN_FDS;for(var r=t;r<=e;r++)if(!WT.streams[r])return r;throw new WT.ErrnoError(33)},getStream:function(t){return WT.streams[t]},createStream:function(t,e,r){WT.FSStream||(WT.FSStream=function(){},WT.FSStream.prototype={object:{get:function(){return this.node},set:function(t){this.node=t}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}});var n=new WT.FSStream;for(var i in t)n[i]=t[i];t=n;var o=WT.nextfd(e,r);return t.fd=o,WT.streams[o]=t,t},closeStream:function(t){WT.streams[t]=null},chrdev_stream_ops:{open:function(t){var e=WT.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek:function(){throw new WT.ErrnoError(70)}},major:function(t){return t>>8},minor:function(t){return 255&t},makedev:function(t,e){return t<<8|e},registerDevice:function(t,e){WT.devices[t]={stream_ops:e}},getDevice:function(t){return WT.devices[t]},getMounts:function(t){for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs:function(t,e){"function"==typeof t&&(e=t,t=!1),WT.syncFSRequests++,WT.syncFSRequests>1&&cT("warning: "+WT.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=WT.getMounts(WT.root.mount),n=0;function i(t){return WT.syncFSRequests--,e(t)}function o(t){if(t)return o.errored?void 0:(o.errored=!0,i(t));++n>=r.length&&i(null)}r.forEach((function(e){if(!e.type.syncfs)return o(null);e.type.syncfs(e,t,o)}))},mount:function(t,e,r){var n,i="/"===r,o=!r;if(i&&WT.root)throw new WT.ErrnoError(10);if(!i&&!o){var a=WT.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,WT.isMountpoint(n))throw new WT.ErrnoError(10);if(!WT.isDir(n.mode))throw new WT.ErrnoError(54)}var s={type:t,opts:e,mountpoint:r,mounts:[]},f=t.mount(s);return f.mount=s,s.root=f,i?WT.root=f:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),f},unmount:function(t){var e=WT.lookupPath(t,{follow_mount:!1});if(!WT.isMountpoint(e.node))throw new WT.ErrnoError(28);var r=e.node,n=r.mounted,i=WT.getMounts(n);Object.keys(WT.nameTable).forEach((function(t){for(var e=WT.nameTable[t];e;){var r=e.name_next;i.includes(e.mount)&&WT.destroyNode(e),e=r}})),r.mounted=null;var o=r.mount.mounts.indexOf(n);r.mount.mounts.splice(o,1)},lookup:function(t,e){return t.node_ops.lookup(t,e)},mknod:function(t,e,r){var n=WT.lookupPath(t,{parent:!0}).node,i=NT.basename(t);if(!i||"."===i||".."===i)throw new WT.ErrnoError(28);var o=WT.mayCreate(n,i);if(o)throw new WT.ErrnoError(o);if(!n.node_ops.mknod)throw new WT.ErrnoError(63);return n.node_ops.mknod(n,i,e,r)},create:function(t,e){return e=void 0!==e?e:438,e&=4095,e|=32768,WT.mknod(t,e,0)},mkdir:function(t,e){return e=void 0!==e?e:511,e&=1023,e|=16384,WT.mknod(t,e,0)},mkdirTree:function(t,e){for(var r=t.split("/"),n="",i=0;ithis.length-1||t<0)){var e=t%this.chunkSize,r=t/this.chunkSize|0;return this.getter(r)[e]}},o.prototype.setDataGetter=function(t){this.getter=t},o.prototype.cacheLength=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw new Error("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,o=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;i||(a=n);var s=this;s.setDataGetter((function(t){var e=t*a,i=(t+1)*a-1;if(i=Math.min(i,n-1),void 0===s.chunks[t]&&(s.chunks[t]=function(t,e){if(t>e)throw new Error("invalid range ("+t+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var i=new XMLHttpRequest;if(i.open("GET",r,!1),n!==a&&i.setRequestHeader("Range","bytes="+t+"-"+e),"undefined"!=typeof Uint8Array&&(i.responseType="arraybuffer"),i.overrideMimeType&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.send(null),!(i.status>=200&&i.status<300||304===i.status))throw new Error("Couldn't load "+r+". Status: "+i.status);return void 0!==i.response?new Uint8Array(i.response||[]):NC(i.responseText||"",!0)}(e,i)),void 0===s.chunks[t])throw new Error("doXHR failed!");return s.chunks[t]})),!o&&n||(a=n=1,n=this.getter(0).length,a=n,hT("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!eT)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new o;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:r};var f=WT.createFile(t,e,s,n,i);s.contents?f.contents=s.contents:s.url&&(f.contents=null,f.url=s.url),Object.defineProperties(f,{usedBytes:{get:function(){return this.contents.length}}});var u={};return Object.keys(f.stream_ops).forEach((function(t){var e=f.stream_ops[t];u[t]=function(){return WT.forceLoadFile(f),e.apply(null,arguments)}})),u.read=function(t,e,r,n,i){WT.forceLoadFile(f);var o=t.node.contents;if(i>=o.length)return 0;var a=Math.min(o.length-i,n);if(o.slice)for(var s=0;s>2]=n.dev,ET[r+4>>2]=0,ET[r+8>>2]=n.ino,ET[r+12>>2]=n.mode,ET[r+16>>2]=n.nlink,ET[r+20>>2]=n.uid,ET[r+24>>2]=n.gid,ET[r+28>>2]=n.rdev,ET[r+32>>2]=0,jT=[n.size>>>0,(UT=n.size,+Math.abs(UT)>=1?UT>0?(0|Math.min(+Math.floor(UT/4294967296),4294967295))>>>0:~~+Math.ceil((UT-+(~~UT>>>0))/4294967296)>>>0:0)],ET[r+40>>2]=jT[0],ET[r+44>>2]=jT[1],ET[r+48>>2]=4096,ET[r+52>>2]=n.blocks,ET[r+56>>2]=n.atime.getTime()/1e3|0,ET[r+60>>2]=0,ET[r+64>>2]=n.mtime.getTime()/1e3|0,ET[r+68>>2]=0,ET[r+72>>2]=n.ctime.getTime()/1e3|0,ET[r+76>>2]=0,jT=[n.ino>>>0,(UT=n.ino,+Math.abs(UT)>=1?UT>0?(0|Math.min(+Math.floor(UT/4294967296),4294967295))>>>0:~~+Math.ceil((UT-+(~~UT>>>0))/4294967296)>>>0:0)],ET[r+80>>2]=jT[0],ET[r+84>>2]=jT[1],0},doMsync:function(t,e,r,n,i){var o=_T.slice(t,t+r);WT.msync(e,o,i,r,n)},doMkdir:function(t,e){return"/"===(t=NT.normalize(t))[t.length-1]&&(t=t.substr(0,t.length-1)),WT.mkdir(t,e,0),0},doMknod:function(t,e,r){switch(61440&e){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return WT.mknod(t,e,r),0},doReadlink:function(t,e,r){if(r<=0)return-28;var n=WT.readlink(t),i=Math.min(r,RR(n)),o=wT[e+i];return TR(n,e,r+1),wT[e+i]=o,i},doAccess:function(t,e){if(-8&e)return-28;var r;if(!(r=WT.lookupPath(t,{follow:!0}).node))return-44;var n="";return 4&e&&(n+="r"),2&e&&(n+="w"),1&e&&(n+="x"),n&&WT.nodePermissions(r,n)?-2:0},doDup:function(t,e,r){var n=WT.getStream(r);return n&&WT.close(n),WT.open(t,e,0,r,r).fd},doReadv:function(t,e,r,n){for(var i=0,o=0;o>2],s=ET[e+(8*o+4)>>2],f=WT.read(t,wT,a,s,n);if(f<0)return-1;if(i+=f,f>2],s=ET[e+(8*o+4)>>2],f=WT.write(t,wT,a,s,n);if(f<0)return-1;i+=f}return i},varargs:void 0,get:function(){return HT.varargs+=4,ET[HT.varargs-4>>2]},getStr:function(t){return kR(t)},getStreamFromFD:function(t){var e=WT.getStream(t);if(!e)throw new WT.ErrnoError(8);return e},get64:function(t,e){return t}},GT=void 0,YT={},KT={},VT={},ZT=48,$T=57,XT=void 0,JT=void 0,QT=!1,tR=void 0,eR=[],rR={},nR={},iR=void 0,oR=[],aR=[{},{value:void 0},{value:null},{value:!0},{value:!1}],sR={},fR=[],uR={},hR=function(t,e,r,n){t||(t=this),this.parent=t,this.mount=t.mount,this.mounted=null,this.id=WT.nextInode++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},cR=365,dR=146,Object.defineProperties(hR.prototype,{read:{get:function(){return(this.mode&cR)===cR},set:function(t){t?this.mode|=cR:this.mode&=~cR}},write:{get:function(){return(this.mode&dR)===dR},set:function(t){t?this.mode|=dR:this.mode&=~dR}},isFolder:{get:function(){return WT.isDir(this.mode)}},isDevice:{get:function(){return WT.isChrdev(this.mode)}}}),WT.FSNode=hR,WT.staticInit(),XR(),XT=ZB.BindingError=ex(Error,"BindingError"),JT=ZB.InternalError=ex(Error,"InternalError"),gx(),Ux(),Dx(),iR=ZB.UnboundTypeError=ex(Error,"UnboundTypeError"),tC(),lR={z:KR,y:VR,t:ZR,D:ax,o:Wx,j:Yx,g:Vx,I:$x,C:rC,m:oC,c:sC,b:fC,n:uC,i:hC,E:cC,r:pC,e:mC,p:Xx,d:bC,H:gC,q:vC,w:yC,a:wC,G:_C,f:BC,u:TC,v:xC,x:CC,l:IC,A:DC,B:PC,s:OC,k:LC,F:UC,h:jC},qR(),ZB.___wasm_call_ctors=function(){return(ZB.___wasm_call_ctors=ZB.asm.K).apply(null,arguments)},pR=ZB._free=function(){return(pR=ZB._free=ZB.asm.L).apply(null,arguments)},mR=ZB._malloc=function(){return(mR=ZB._malloc=ZB.asm.M).apply(null,arguments)},bR=ZB._strlen=function(){return(bR=ZB._strlen=ZB.asm.O).apply(null,arguments)},gR=ZB.___errno_location=function(){return(gR=ZB.___errno_location=ZB.asm.P).apply(null,arguments)},vR=ZB.___getTypeName=function(){return(vR=ZB.___getTypeName=ZB.asm.Q).apply(null,arguments)},ZB.___embind_register_native_and_builtin_types=function(){return(ZB.___embind_register_native_and_builtin_types=ZB.asm.R).apply(null,arguments)},ZB.dynCall_ijiii=function(){return(ZB.dynCall_ijiii=ZB.asm.S).apply(null,arguments)},ZB.dynCall_viiijj=function(){return(ZB.dynCall_viiijj=ZB.asm.T).apply(null,arguments)},ZB.dynCall_jij=function(){return(ZB.dynCall_jij=ZB.asm.U).apply(null,arguments)},ZB.dynCall_jii=function(){return(ZB.dynCall_jii=ZB.asm.V).apply(null,arguments)},ZB.dynCall_jiji=function(){return(ZB.dynCall_jiji=ZB.asm.W).apply(null,arguments)},ZB._ff_h264_cabac_tables=77157,PT=function t(){yR||FC(),yR||(PT=t)},ZB.run=FC,ZB.preInit)for("function"==typeof ZB.preInit&&(ZB.preInit=[ZB.preInit]);ZB.preInit.length>0;)ZB.preInit.pop()();FC(),wR=e(ZB)}var WC=!1;function HC(t){let e=t.next(),r=null;return n=>{var i=new Uint8Array(n);if(r){var o=new Uint8Array(r.length+i.length);o.set(r),o.set(i,r.length),i=o,r=null}for(;i.length>=e.value;){var a=i.slice(e.value);e=t.next(i.slice(0,e.value)),i=a}i.length>0&&(r=i)}}function GC(){({}),_R||(_R=!0,qC()),a(),(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1})(),Date.now||(Date.now=function(){return(new Date).getTime()}),wR.print=function(t){postMessage({cmd:"print",text:t})},wR.printErr=function(t){postMessage({cmd:"printErr",text:t})},wR.postRun=function(){var t=[],e={_firstCheckpoint:0,_lastCheckpoint:0,_intervalBytes:0,_lastSecondBytes:0,addBytes:function(t){0===e._firstCheckpoint?(e._firstCheckpoint=Date.now(),e._lastCheckpoint=e._firstCheckpoint,e._intervalBytes+=t):Date.now()-e._lastCheckpoint<1e3?e._intervalBytes+=t:(e._lastSecondBytes=e._intervalBytes,e._intervalBytes=t,e._lastCheckpoint=Date.now())},reset:function(){e._firstCheckpoint=e._lastCheckpoint=0,e._intervalBytes=0,e._lastSecondBytes=0},getCurrentKBps:function(){e.addBytes(0);var t=(Date.now()-e._lastCheckpoint)/1e3;return 0==t&&(t=1),e._intervalBytes/t/1024},getLastSecondKBps:function(){return e.addBytes(0),0!==e._lastSecondBytes?e._lastSecondBytes/1024:Date.now()-e._lastCheckpoint>=500?e.getCurrentKBps():0}},r={opt:{},initAudioPlanar:function(t,e){postMessage({cmd:"initAudioPlanar",samplerate:e,channels:t});var r=[],n=[],i=0;this.playAudioPlanar=function(e,o){for(var a=o,s=[],f=0,u=0;u<2;u++){var h=wR.HEAPU32[(e>>2)+u]>>2;s[u]=wR.HEAPF32.subarray(h,h+a)}if(i){if(!(a>=(o=1024-i)))return i+=a,r[0]=Float32Array.of(...r[0],...s[0]),void(2==t&&(r[1]=Float32Array.of(...r[1],...s[1])));n[0]=Float32Array.of(...r[0],...s[0].subarray(0,o)),2==t&&(n[1]=Float32Array.of(...r[1],...s[1].subarray(0,o))),postMessage({cmd:"playAudio",buffer:n},n.map((t=>t.buffer))),f=o,a-=o}for(i=a;i>=1024;i-=1024)n[0]=s[0].slice(f,f+=1024),2==t&&(n[1]=s[1].slice(f-1024,f)),postMessage({cmd:"playAudio",buffer:n},n.map((t=>t.buffer)));i&&(r[0]=s[0].slice(f),2==t&&(r[1]=s[1].slice(f)))}},inputFlv:function*(){yield 9;for(var e=new ArrayBuffer(4),r=new Uint8Array(e),o=new Uint32Array(e);;){r[3]=0;var a=yield 15,s=a[4];r[0]=a[7],r[1]=a[6],r[2]=a[5];var f=o[0];r[0]=a[10],r[1]=a[9],r[2]=a[8];var u=o[0];16777215===u&&(r[3]=a[11],u=o[0]);var h=yield f;switch(s){case 8:this.opt.hasAudio&&t.push({ts:u,payload:h,decoder:n,type:0});break;case 9:t.push({ts:u,payload:h,decoder:i,type:h[0]>>4})}}},play:function(r){this.opt.debug&&console.log("Jessibuca play",r),this.getDelay=function(t){return t?(this.firstTimestamp=t,this.startTimestamp=Date.now(),this.getDelay=function(t){return this.delay=Date.now()-this.startTimestamp-(t-this.firstTimestamp),this.delay},-1):-1};var o=this.opt.vod?()=>{if(t.length){var e=t[0];if(-1===this.getDelay(e.ts))t.shift(),this.ts=e.ts,e.decoder.decode(e.payload);else for(;t.length&&(e=t[0],this.getDelay(e.ts)>this.videoBuffer);)t.shift(),this.ts=e.ts,e.decoder.decode(e.payload)}}:()=>{if(t.length)if(this.dropping)1==(e=t.shift()).type?(this.dropping=!1,this.ts=e.ts,e.decoder.decode(e.payload)):0==e.type&&(this.ts=e.ts,e.decoder.decode(e.payload));else{var e=t[0];if(-1===this.getDelay(e.ts))t.shift(),this.ts=e.ts,e.decoder.decode(e.payload);else if(this.delay>this.videoBuffer+1e3)this.dropping=!0;else for(;t.length&&(e=t[0],this.getDelay(e.ts)>this.videoBuffer);)t.shift(),this.ts=e.ts,e.decoder.decode(e.payload)}};if(this.stopId=setInterval(o,10),this.speedSamplerId=setInterval((()=>{postMessage({cmd:"kBps",kBps:e.getLastSecondKBps()})}),1e3),0==r.indexOf("http")){this.flvMode=!0;var s=this,f=new AbortController;fetch(r,{signal:f.signal}).then((function(t){var r=t.body.getReader(),n=s.inputFlv(),i=HC(n),o=function(){r.read().then((({done:t,value:r})=>{t?n.return(null):(e.addBytes(r.byteLength),i(r),o())})).catch((function(t){n.return(null),s.opt.debug&&console.error(t),-1===t.toString().indexOf("The user aborted a request")&&postMessage({cmd:"printErr",text:t.toString()})}))};o()})).catch((t=>{postMessage({cmd:"printErr",text:t.message})})),this._close=function(){f.abort()}}else{if(this.flvMode=-1!=r.indexOf(".flv"),this.ws=new WebSocket(r),this.ws.binaryType="arraybuffer",this.flvMode){let t=this.inputFlv();var u=HC(t);this.ws.onmessage=t=>{e.addBytes(t.data.byteLength),u(t.data)},this.ws.onerror=e=>{t.return(null),postMessage({cmd:"printErr",text:e.toString()})}}else this.ws.onmessage=r=>{e.addBytes(r.data.byteLength);var o=new DataView(r.data);switch(o.getUint8(0)){case 1:this.opt.hasAudio&&t.push({ts:o.getUint32(1,!1),payload:new Uint8Array(r.data,5),decoder:n,type:0});break;case 2:t.push({ts:o.getUint32(1,!1),payload:new Uint8Array(r.data,5),decoder:i,type:o.getUint8(5)>>4})}},this.ws.onerror=t=>{postMessage({cmd:"printErr",text:t.toString()})};this._close=function(){this.ws.close(),this.ws=null}}this.setVideoSize=function(t,e){postMessage({cmd:"initSize",w:t,h:e});var r=t*e,n=r>>2;if(this.opt.forceNoOffscreen||"undefined"==typeof OffscreenCanvas)this.draw=function(t,e,i,o){var a=[wR.HEAPU8.subarray(e,e+r),wR.HEAPU8.subarray(i,i+n),wR.HEAPU8.subarray(o,o+n)].map((t=>Uint8Array.from(t)));postMessage({cmd:"render",compositionTime:t,delay:this.delay,ts:this.ts,output:a},a.map((t=>t.buffer)))};else{var i=new OffscreenCanvas(t,e),o=i.getContext("webgl"),s=a().default(o);this.draw=function(o,a,f,u){s(t,e,wR.HEAPU8.subarray(a,a+r),wR.HEAPU8.subarray(f,f+n),wR.HEAPU8.subarray(u,u+n));let h=i.transferToImageBitmap();postMessage({cmd:"render",compositionTime:o,delay:this.delay,ts:this.ts,buffer:h},[h])}}}},close:function(){this._close&&(this.opt.debug&&console.log("worker close"),this._close(),clearInterval(this.stopId),this.stopId=null,clearInterval(this.speedSamplerId),this.speedSamplerId=null,e.reset(),this.ws=null,n.clear(),i.clear(),this.firstTimestamp=0,this.startTimestamp=0,this.delay=0,this.ts=0,this.flvMode=!1,t=[],delete this.playAudioPlanar,delete this.draw,delete this.getDelay)}},n=new wR.AudioDecoder(r),i=new wR.VideoDecoder(r);postMessage({cmd:"init"}),self.onmessage=function(t){var e=t.data;switch(e.cmd){case"init":r.opt=JSON.parse(e.opt),n.sample_rate=e.sampleRate;break;case"getProp":postMessage({cmd:"getProp",value:r[e.prop]});break;case"setProp":r[e.prop]=e.value;break;case"play":r.play(e.url);break;case"setVideoBuffer":r.videoBuffer=1e3*e.time|0;break;case"close":r.close()}}}}"undefined"==typeof importScripts?yt||(yt=!0,{},c(),N(),K(),X(),gt(),y(),O(),vt=class{constructor(t){if(this._opt=Object.assign(y().DEFAULT_OPTIONS,t),this.$container=t.container,"string"==typeof t.container&&(this.$container=document.querySelector(t.container)),!this.$container)throw new Error("Jessibuca need container option");delete this._opt.container,this._opt.debug&&console.log("options",this._opt),gt().default(this),c().default(this),N().default(this),X().default(this),K().default(this)}set fullscreen(t){t?(O().checkFull()||this.$container.requestFullscreen(),O().$domToggle(this.$doms.minScreenDom,!0),O().$domToggle(this.$doms.fullscreenDom,!1)):(O().checkFull()&&document.exitFullscreen(),O().$domToggle(this.$doms.minScreenDom,!1),O().$domToggle(this.$doms.fullscreenDom,!0)),this._fullscreen!==t&&(this.onFullscreen(t),this._trigger(y().EVEMTS.fullscreen,t)),this._fullscreen=t}get fullscreen(){return this._fullscreen}set playing(t){t?(O().$domToggle(this.$doms.playBigDom,!1),O().$domToggle(this.$doms.playDom,!1),O().$domToggle(this.$doms.pauseDom,!0),O().$domToggle(this.$doms.screenshotsDom,!0),O().$domToggle(this.$doms.recordDom,!0),this._quieting?(O().$domToggle(this.$doms.quietAudioDom,!0),O().$domToggle(this.$doms.playAudioDom,!1)):(O().$domToggle(this.$doms.quietAudioDom,!1),O().$domToggle(this.$doms.playAudioDom,!0))):(this.$doms.speedDom&&(this.$doms.speedDom.innerText=""),this._playUrl&&(O().$domToggle(this.$doms.playDom,!0),O().$domToggle(this.$doms.playBigDom,!0),O().$domToggle(this.$doms.pauseDom,!1)),O().$domToggle(this.$doms.recordDom,!1),O().$domToggle(this.$doms.recordingDom,!1),O().$domToggle(this.$doms.screenshotsDom,!1),O().$domToggle(this.$doms.quietAudioDom,!1),O().$domToggle(this.$doms.playAudioDom,!1)),this._playing!==t&&(t?(this.onPlay(),this._trigger(y().EVEMTS.play)):(this.onPause(),this._trigger(y().EVEMTS.pause))),this._playing=t}get playing(){return this._playing}set quieting(t){t?(O().$domToggle(this.$doms.quietAudioDom,!0),O().$domToggle(this.$doms.playAudioDom,!1)):(O().$domToggle(this.$doms.quietAudioDom,!1),O().$domToggle(this.$doms.playAudioDom,!0)),this._quieting!==t&&(this.onMute(t),this._trigger(y().EVEMTS.mute,t)),this._quieting=t}get quieting(){return this._quieting}set loading(t){t?(O().$hideBtns(this.$doms),O().$domToggle(this.$doms.fullscreenDom,!0),O().$domToggle(this.$doms.pauseDom,!0),O().$domToggle(this.$doms.loadingDom,!0)):O().$initBtns(this.$doms),this._loading=t}get loading(){return this._loading}set recording(t){t?(O().$domToggle(this.$doms.recordDom,!1),O().$domToggle(this.$doms.recordingDom,!0)):(O().$domToggle(this.$doms.recordDom,!0),O().$domToggle(this.$doms.recordingDom,!1)),this._recording!==t&&(this.onRecord(t),this._trigger(y().EVEMTS.record,t),this._recording=t)}get recording(){return this._recording}setDebug(t){this._opt.isDebug=!!t}setTimeout(t){this._opt.timeout=Number(t)}setVod(t){this._opt.vod=!!t}setNoOffscreen(t){this._opt.forceNoOffscreen=!!t}setScaleMode(t){0===(t=Number(t))?(this._opt.isFullResize=!1,this._opt.isResize=!1):1===t?(this._opt.isFullResize=!1,this._opt.isResize=!0):2===t&&(this._opt.isFullResize=!0),this._resize()}mute(){this._mute()}cancelMute(){this._cancelMute()}audioResume(){this._cancelMute()}pause(){this._pause()}play(t){this._play(t)}close(){this._close()}destroy(){this._close(),this._destroyAudioContext(),this._destroyContextGL(),this._decoderWorker.terminate(),this._removeEventListener(),this._initCheckVariable(),this._off(),this._removeContainerChild()}clearView(){this._clearView()}resize(){this._resize()}setBufferTime(t){t=Number(t),this._decoderWorker.postMessage({cmd:y().POST_MESSAGE.setVideoBuffer,time:t})}setRotate(t){t=parseInt(t,10),this._opt.rotate!==t&&-1!==[0,90,270].indexOf(t)&&(this._opt.rotate=t,this.resize())}setVolume(t){if(this._gainNode){if(t=parseFloat(t),isNaN(t))return;this._gainNode.gain.setValueAtTime(t,this._audioContext.currentTime)}}setKeepScreenOn(){this._opt.keepScreenOn=!0}setFullscreen(t){const e=!!t;this.fullscreen!==e&&(this.fullscreen=e)}hasLoaded(){return this._hasLoaded}screenshot(t,e,r){this._screenshot(t,e,r)}on(t,e){this._on(t,e)}},window.Jessibuca=vt):WC||(WC=!0,GC())}(); \ No newline at end of file diff --git a/web-pages/public/jessibuca.js b/web-pages/public/jessibuca.js new file mode 100644 index 0000000..50928a5 --- /dev/null +++ b/web-pages/public/jessibuca.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).jessibuca=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var i,o=t((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),r=(i=o)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;const s=0,a=1,n="flv",A="m7s",d="mp4",c="webm",l={videoBuffer:1e3,videoBufferDelay:1e3,isResize:!0,isFullResize:!1,isFlv:!1,debug:!1,hotKey:!1,loadingTimeout:10,heartTimeout:5,timeout:10,loadingTimeoutReplay:!0,heartTimeoutReplay:!1,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,supportDblclickFullscreen:!1,showBandwidth:!1,keepScreenOn:!1,isNotMute:!1,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1},controlAutoHide:!1,hasControl:!1,loadingText:"",background:"",decoder:"decoder.js",url:"",rotate:0,forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:a,demuxType:n,useWCS:!1,wcsUseVideoRender:!0,useMSE:!1,useOffscreen:!1,autoWasm:!0,wasmDecodeErrorReplay:!0,openWebglAlignment:!1,wasmDecodeAudioSyncVideo:!1,recordType:c},u="init",h="initVideo",p="render",m="playAudio",g="initAudio",f="audioCode",b="videoCode",y="wasmError",v="Invalid NAL unit size",w=1,S=2,E=8,B=9,C="init",R="decode",k="audioDecode",T="close",I="updateConfig",x={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",loadingTimeout:"loadingTimeout",stats:"stats",performance:"performance",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata",resize:"resize",streamEnd:"streamEnd",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",volumechange:"volumechange",destroy:"destroy",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceBufferError:"mseSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes"},D={load:x.load,timeUpdate:x.timeUpdate,videoInfo:x.videoInfo,audioInfo:x.audioInfo,error:x.error,kBps:x.kBps,log:x.log,start:x.start,timeout:x.timeout,loadingTimeout:x.loadingTimeout,delayTimeout:x.delayTimeout,fullscreen:"fullscreen",play:x.play,pause:x.pause,mute:x.mute,stats:x.stats,performance:x.performance,recordingTimestamp:x.recordingTimestamp,recordStart:x.recordStart,recordEnd:x.recordEnd,playToRenderTimes:x.playToRenderTimes},j={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",webcodecsWidthOrHeightChange:"webcodecsWidthOrHeightChange",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceFull:x.mseSourceBufferFull,mseSourceBufferError:x.mseSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceBufferListLarge:"mediaSourceBufferListLarge",mediaSourceAppendBufferEndTimeout:"mediaSourceAppendBufferEndTimeout",wasmDecodeError:"wasmDecodeError",webglAlignmentError:"webglAlignmentError"},L="notConnect",O="open",F="close",V="error",M={download:"download",base64:"base64",blob:"blob"},U={7:"H264(AVC)",12:"H265(HEVC)"},Q=12,W={10:"AAC",7:"ALAW",8:"MULAW"},J=38,G=0,P=1,N=2,z="webcodecs",H="webgl",Y="offscreen",X="key",q="delta",Z='video/mp4; codecs="avc1.64002A"',K="ended",_="open",$="closed",ee=1e3,te=27,ie=38,oe=40,re="A key frame is required after configure() or flush()",se="The user aborted a request",ae="AbortError",ne="AbortError";class Ae{constructor(e){this.log=function(t){if(e._opt.debug){for(var i=arguments.length,o=new Array(i>1?i-1:0),r=1;r1?i-1:0),r=1;r1?t-1:0),o=1;o3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,o)));e.addEventListener(t,i,o);const r=()=>e.removeEventListener(t,i,o);return this.destroys.push(r),r}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e()))}}var ce=t((function(e){!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},i=e.exports,o=function(){for(var e,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],o=0,r=i.length,s={};o0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),o=t[0].replace("data:","").replace(";base64","");let r=i.length,s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new File([s],"file",{type:o})}function he(){return(new Date).getTime()}function pe(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function me(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{me(e,i,t[i])})),e.style[t]=i,e}function ge(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const o=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(o):o}function fe(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function be(e){let t=0,i=fe();return o=>{t+=o;const r=fe(),s=r-i;s>=1e3&&(e(t/s*1e3),i=r,t=0)}}function ye(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function ve(e){if(null==e||""===e||0===parseInt(e)||isNaN(parseInt(e)))return"0KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}function we(e){return null==e}function Se(e){return!we(e)}function Ee(e){const t=e||window.event;return t.target||t.srcElement}ce.isEnabled,(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();class Be{on(e,t,i){const o=this.e||(this.e={});return(o[e]||(o[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const o=this;function r(){o.off(e,r);for(var s=arguments.length,a=new Array(s),n=0;n1?i-1:0),r=1;r{delete i[e]})),void delete this.e;const o=i[e],r=[];if(o&&t)for(let e=0,i=o.length;e=200&&t.status<=299}function Ie(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var xe=Re.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),De="object"!=typeof window||window!==Re?function(){}:"download"in HTMLAnchorElement.prototype&&!xe?function(e,t,i){var o=Re.URL||Re.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?Te(r.href)?ke(e,t,i):Ie(r,r.target="_blank"):Ie(r)):(r.href=o.createObjectURL(e),setTimeout((function(){o.revokeObjectURL(r.href)}),4e4),setTimeout((function(){Ie(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(Te(e))ke(e,t,i);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout((function(){Ie(o)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return ke(e,t,i);var r="application/octet-stream"===e.type,s=/constructor/i.test(Re.HTMLElement)||Re.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||r&&s||xe)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},n.readAsDataURL(e)}else{var A=Re.URL||Re.webkitURL,d=A.createObjectURL(e);o?o.location=d:location.href=d,o=null,setTimeout((function(){A.revokeObjectURL(d)}),4e4)}};class je extends Ce{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.contextGlRender=null,this.contextGlDestroy=null,this.bitmaprenderer=null,this.renderType=null,this.videoInfo={width:"",height:"",encType:""},this._initCanvasRender(),this.player.debug.log("CanvasVideo","init")}destroy(){super.destroy(),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.contextGlRender&&(this.contextGlDestroy&&this.contextGlDestroy(),this.contextGlDestroy=null,this.contextGlRender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.player.debug.log("CanvasVideoLoader","destroy")}_initContextGl(){this.contextGl=function(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let o=0;for(;!t&&o{var i=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),o=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);var r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+e.getShaderInfoLog(r));var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,o),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+e.getShaderInfoLog(s));var a=e.createProgram();e.attachShader(a,r),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||console.log("Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a);var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var A=e.getAttribLocation(a,"vertexPos");e.enableVertexAttribArray(A),e.vertexAttribPointer(A,2,e.FLOAT,!1,0,0);var d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var c=e.getAttribLocation(a,"texturePos");function l(t,i){var o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(e.getUniformLocation(a,t),i),o}e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0);var u=l("ySampler",0),h=l("uSampler",1),p=l("vSampler",2);return{render:function(t,i,o,r,s){e.viewport(0,0,t,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t,i,0,e.LUMINANCE,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,h),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,r),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,s),e.drawArrays(e.TRIANGLE_STRIP,0,4)},destroy:function(){try{e.deleteProgram(a),e.deleteBuffer(n),e.deleteBuffer(d),e.deleteTexture(u),e.deleteTexture(h),e.deleteBuffer(p)}catch(e){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=e.render,this.contextGlDestroy=e.destroy}_initContext2D(){this.context2D=this.$videoElement.getContext("2d")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=z,this._initContext2D()):this._supportOffscreen()?(this.renderType=Y,this._bindOffscreen()):(this.renderType=H,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}render(e){switch(this.player.videoTimestamp=e.ts,this.renderType){case Y:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case H:this.contextGlRender(this.$videoElement.width,this.$videoElement.height,e.output[0],e.output[1],e.output[2]);break;case z:this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height)}}screenshot(e,t,i,o){e=e||he(),o=o||M.download;const r={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let s=.92;!r[t]&&M[t]&&(o=t,t="png",i=void 0),"string"==typeof i&&(o=i,i=void 0),void 0!==i&&(s=Number(i));const a=this.$videoElement.toDataURL(r[t]||r.png,s),n=ue(a);return o===M.base64?a:o===M.blob?n:void(o===M.download&&De(n,e))}clearView(){switch(this.renderType){case Y:(function(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,window.createImageBitmap(i,0,0,e,t)})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case H:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case z:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}resize(){this.player.debug.log("canvasVideo","resize");const e=this.player._opt;let t=this.player.width,i=this.player.height;e.hasControl&&!e.controlAutoHide&&(ye()&&this.player.fullscreen?t-=J:i-=J);let o=this.$videoElement.width,r=this.$videoElement.height;const s=e.rotate;let a=(t-o)/2,n=(i-r)/2;270!==s&&90!==s||(o=this.$videoElement.height,r=this.$videoElement.width);const A=t/o,d=i/r;let c=A>d?d:A;e.isResize||A!==d&&(c=A+","+d),e.isFullResize&&(c=A>d?A:d);let l="scale("+c+")";s&&(l+=" rotate("+s+"deg)"),this.$videoElement.style.transform=l,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=n+"px"}}class Le extends Ce{constructor(e){super(),this.player=e;const t=document.createElement("video");t.muted=!0,t.style.position="absolute",t.style.top=0,t.style.left=0,e.$container.appendChild(t),this.videoInfo={width:"",height:"",encType:""};const i=this.player._opt;i.useWCS&&i.wcsUseVideoRender&&(this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),t.srcObject=new MediaStream([this.trackGenerator]),this.vwriter=this.trackGenerator.writable.getWriter()),this.$videoElement=t,this.fixChromeVideoFlashBug(),this.resize();const{proxy:o}=this.player.events;o(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video","canplay")})),o(this.$videoElement,"waiting",(()=>{this.player.emit(x.videoWaiting)})),o(this.$videoElement,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.emit(x.timeUpdate,t)})),this.player.debug.log("Video","init")}destroy(){super.destroy(),this.$videoElement&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"),this.$videoElement=null),this.trackGenerator&&(this.trackGenerator=null),this.vwriter&&(this.vwriter=null),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){const e=function(){const e=navigator.userAgent.toLowerCase(),t={},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let o in i)if(i[o]){let i="";if("IE"===o)i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===o){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(o="360");i=e.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===o?i=e.match(/firefox\/([\d.]+)/)[1]:"Opera"===o?i=e.match(/opera\/([\d.]+)/)[1]:"Safari"===o?i=e.match(/version\/([\d.]+)/)[1]:"Edge"===o?i=e.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===o&&(i=e.match(/qqbrowser\/([\d.]+)/)[1]);t.type=o,t.version=parseInt(i)}return t}().type.toLowerCase();if("chrome"===e||"edge"===e){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.translateZ="0"}}play(){setTimeout((()=>{this.$videoElement&&this.$videoElement.play().then((()=>{this.player.debug.log("Video","play")})).catch((e=>{this.player.debug.warn("Video","play",e)}))}),100)}pause(e){e?this.$videoElement&&this.$videoElement.pause():setTimeout((()=>{this.$videoElement&&this.$videoElement.pause()}),100)}clearView(){}screenshot(e,t,i,o){e=e||he(),o=o||M.download;let r=.92;!{png:"image/png",jpeg:"image/jpeg",webp:"image/webp"}[t]&&M[t]&&(o=t,t="png",i=void 0),"string"==typeof i&&(o=i,i=void 0),void 0!==i&&(r=Number(i));const s=this.$videoElement;let a=document.createElement("canvas");a.width=s.videoWidth,a.height=s.videoHeight;a.getContext("2d").drawImage(s,0,0,a.width,a.height);const n=a.toDataURL(M[t]||M.png,r),A=ue(n);return o===M.base64?n:o===M.blob?A:void(o===M.download&&De(A,e))}initCanvasViewSize(){this.resize()}render(e){this.vwriter&&this.vwriter.write(e.videoFrame)}resize(){let e=this.player.width,t=this.player.height;const i=this.player._opt,o=i.rotate;i.hasControl&&!i.controlAutoHide&&(ye()&&this.player.fullscreen?e-=J:t-=J),this.$videoElement.width=e,this.$videoElement.height=t,270!==o&&90!==o||(this.$videoElement.width=t,this.$videoElement.height=e);let r=(e-this.$videoElement.width)/2,s=(t-this.$videoElement.height)/2,a="contain";i.isResize||(a="fill"),i.isFullResize&&(a="none"),this.$videoElement.style.objectFit=a,this.$videoElement.style.transform="rotate("+o+"deg)",this.$videoElement.style.left=r+"px",this.$videoElement.style.top=s+"px"}}class Oe{constructor(e){return new(Oe.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE||e.useWCS&&!e.useOffscreen&&e.wcsUseVideoRender?Le:je}}class Fe extends Be{constructor(e){super(),this.bufferList=[],this.player=e,this.scriptNode=null,this.hasInitScriptNode=!1,this.audioContextChannel=null,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.audioEnabled(!0),this.gainNode.gain.value=0,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.on(x.videoSyncAudio,(e=>{this.audioSyncVideoOption=e})),this.player.debug.log("AudioContext","init")}resetInit(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}destroy(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=le,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off(),this.player.debug.log("AudioContext","destroy")}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=W[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(x.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value||this.isStateSuspended()}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){if(this.playing=!0,this.hasInitScriptNode)return;const e=this.audioInfo.channels,t=this.audioContext.createScriptProcessor(1024,0,e);t.onaudioprocess=t=>{const i=t.outputBuffer;if(this.bufferList.length&&this.playing){if(!this.player._opt.useWCS&&!this.player._opt.useMSE&&this.player._opt.wasmDecodeAudioSyncVideo){if(this.audioSyncVideoOption.diff>ee)return void this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`);if(this.audioSyncVideoOption.diff<-1e3){this.player.debug.warn("AudioContext",`audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`);let e=this.bufferList.shift();for(;e.ts-this.player.videoTimestamp<-1e3&&this.bufferList.length>0;)e=this.bufferList.shift();if(0===this.bufferList.length)return}}if(0===this.bufferList.length)return;const t=this.bufferList.shift();t&&t.ts&&(this.player.audioTimestamp=t.ts);for(let o=0;o20&&(this.player.debug.warn("AudioContext",`bufferList is large: ${this.bufferList.length}`),this.bufferList.length>50&&this.bufferList.shift()))}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()}resume(){this.playing=!0}}class Ve{constructor(e){return new(Ve.getLoaderFactory())(e)}static getLoaderFactory(){return Fe}}class Me extends Be{constructor(e){super(),this.player=e,this.playing=!1,this.abortController=new AbortController,this.streamRate=be((t=>{e.emit(x.kBps,(t/1024).toFixed(2))})),e.debug.log("FetchStream","init")}destroy(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player._times.streamStart=he();const o=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,o).then((e=>{const t=e.body.getReader();this.emit(x.streamSuccess);const o=()=>{t.read().then((e=>{let{done:t,value:r}=e;t?i.close():(this.streamRate&&this.streamRate(r.byteLength),i.dispatch(r),o())})).catch((e=>{i.close();const t=e.toString();-1===t.indexOf(se)&&-1===t.indexOf(ae)&&e.name!==ne&&(this.abort(),this.emit(j.fetchError,e),this.player.emit(x.error,j.fetchError))}))};o()})).catch((e=>{"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(j.fetchError,e),this.player.emit(x.error,j.fetchError))}))}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}}class Ue extends Be{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=L,this.wsUrl=null,this.streamRate=be((t=>{e.emit(x.kBps,(t/1024).toFixed(2))})),e.debug.log("WebsocketLoader","init")}destroy(){this.socket&&(this.socket.close(),this.socket=null),this.socketStatus=L,this.streamRate=null,this.wsUrl=null,this.off(),this.player.debug.log("websocketLoader","destroy")}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:o}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",i(this.socket,"open",(()=>{this.emit(x.streamSuccess),t.log("websocketLoader","socket open"),this.socketStatus=O})),i(this.socket,"message",(e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)})),i(this.socket,"close",(()=>{t.log("websocketLoader","socket close"),this.emit(x.streamEnd),this.socketStatus=F})),i(this.socket,"error",(e=>{t.log("websocketLoader","socket error"),this.emit(j.websocketError,e),this.player.emit(x.error,j.websocketError),this.socketStatus=V,o.close(),t.log("websocketLoader","socket error:",e)}))}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("websocketLoader","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=he(),this.wsUrl=e,this._createWebSocket()}}class Qe{constructor(e){return new(Qe.getLoaderFactory(e._opt.protocol))(e)}static getLoaderFactory(e){return e===a?Me:e===s?Ue:void 0}}var We=t((function(t){function i(e,t){if(!e)throw"First parameter is required.";t=new o(e,t=t||{type:"video"});var s=this;function a(i){i&&(t.initCallback=function(){i(),i=t.initCallback=null});var o=new r(e,t);(h=new o(e,t)).record(),u("recording"),t.disableLogs||console.log("Initialized recorderType:",h.constructor.name,"for output-type:",t.type)}function n(e){if(e=e||function(){},h){if("paused"===s.state)return s.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===s.state||t.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',s.state),t.disableLogs||console.log("Stopped recording "+t.type+" stream."),"gif"!==t.type?h.stop(i):(h.stop(),i()),u("stopped")}else m();function i(i){if(h){Object.keys(h).forEach((function(e){"function"!=typeof h[e]&&(s[e]=h[e])}));var o=h.blob;if(!o){if(!i)throw"Recording failed.";h.blob=o=i}if(o&&!t.disableLogs&&console.log(o.type,"->",b(o.size)),e){var r;try{r=l.createObjectURL(o)}catch(e){}"function"==typeof e.call?e.call(s,r):e(r)}t.autoWriteToDisk&&d((function(e){var i={};i[t.type+"Blob"]=e,x.Store(i)}))}else"function"==typeof e.call?e.call(s,""):e("")}}function A(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,i){if(!e)throw"Pass a callback function over getDataURL.";var o=i?i.blob:(h||{}).blob;if(!o)return t.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,i)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var r=new FileReader;r.readAsDataURL(o),r.onload=function(t){e(t.target.result)}}else{var s=function(e){try{var t=l.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return l.revokeObjectURL(t),i}catch(e){}}(A);s.onmessage=function(t){e(t.data)},s.postMessage(o)}}function c(e){e=e||0,"paused"!==s.state?"stopped"!==s.state&&(e>=s.recordingDuration?n(s.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){s&&(s.state=e,"function"==typeof s.onStateChanged.call?s.onStateChanged.call(s,e):s.onStateChanged(e))}var h,p='It seems that recorder is destroyed or "startRecording" is not invoked for '+t.type+" recorder.";function m(){!0!==t.disableLogs&&console.warn(p)}var g={startRecording:function(i){return t.disableLogs||console.log("RecordRTC version: ",s.version),i&&(t=new o(e,i)),t.disableLogs||console.log("started recording "+t.type+" stream."),h?(h.clearRecordedData(),h.record(),u("recording"),s.recordingDuration&&c(),s):(a((function(){s.recordingDuration&&c()})),s)},stopRecording:n,pauseRecording:function(){h?"recording"===s.state?(u("paused"),h.pause(),t.disableLogs||console.log("Paused recording.")):t.disableLogs||console.warn("Unable to pause the recording. Recording state: ",s.state):m()},resumeRecording:function(){h?"paused"===s.state?(u("recording"),h.resume(),t.disableLogs||console.log("Resumed recording.")):t.disableLogs||console.warn("Unable to resume the recording. Recording state: ",s.state):m()},initRecorder:a,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return s.recordingDuration=e,s.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){s.onRecordingStopped=e}}},clearRecordedData:function(){h?(h.clearRecordedData(),t.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(h)return h.blob;m()},getDataURL:d,toURL:function(){if(h)return l.createObjectURL(h.blob);m()},getInternalRecorder:function(){return h},save:function(e){h?y(h.blob,e):m()},getFromDisk:function(e){h?i.getFromDisk(t.type,e):m()},setAdvertisementArray:function(e){t.advertisement=[];for(var i=e.length,o=0;o-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),m=!h&&!u&&!!navigator.webkitGetUserMedia||v()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),g=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);g&&!m&&-1!==navigator.userAgent.indexOf("CriOS")&&(g=!1,m=!0);var f=window.MediaStream;function b(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function y(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var o=t.split(".");t=o[0],i=o[1]}var r=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,r);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,r);var s=document.createElement("a");s.href=l.createObjectURL(e),s.download=r,s.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(s),"function"==typeof s.click?s.click():(s.target="_blank",s.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),l.revokeObjectURL(s.href)}function v(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function w(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function S(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===f&&"undefined"!=typeof webkitMediaStream&&(f=webkitMediaStream),void 0!==f&&void 0===f.prototype.stop&&(f.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),i.invokeSaveAsDialog=y,i.getTracks=w,i.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,o=new EBML.Decoder,r=EBML.tools,s=new FileReader;s.onload=function(e){o.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var s=r.makeMetadataSeekable(i.metadatas,i.duration,i.cues),a=this.result.slice(i.metadataSize),n=new Blob([s,a],{type:"video/webm"});t(n)},s.readAsArrayBuffer(e)},i.bytesToSize=b,i.isElectron=v;var E={};function B(){if(p||g||u)return!0;var e,t,i=navigator.userAgent,o=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(m||h)&&(e=i.indexOf("Chrome"),o=i.substring(e+7)),-1!==(t=o.indexOf(";"))&&(o=o.substring(0,t)),-1!==(t=o.indexOf(" "))&&(o=o.substring(0,t)),r=parseInt(""+o,10),isNaN(r)&&(o=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}function C(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var o;if(w(e,"video").length&&w(e,"audio").length)navigator.mozGetUserMedia?(o=new f).addTrack(w(e,"audio")[0]):o=new f(w(e,"audio")),e=o;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=m?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var r,s=[];function a(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return r&&r.mimeType?r.mimeType:e.mimeType||"video/webm"}function A(){s=[],r=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return s},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],s=[];var o=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",o),r&&(r=null),m&&!B()&&(o="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&o.mimeType&&(MediaRecorder.isTypeSupported(o.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",o.mimeType),o.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{r=new MediaRecorder(e,o),t.mimeType=o.mimeType}catch(t){r=new MediaRecorder(e)}o.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&!1===r.canRecordMimeType(o.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",o.mimeType)),r.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+b(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(o)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(o)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(s.push(e.data),a(),"function"==typeof t.ondataavailable)){var r=t.getNativeBlob?e.data:new Blob([e.data],{type:n(o)});t.ondataavailable(r)}},r.onstart=function(){d.push("started")},r.onpause=function(){d.push("paused")},r.onresume=function(){d.push("resumed")},r.onstop=function(){d.push("stopped")},r.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",o.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&r&&"inactive"===r.state)return delete t.timeslice,void r.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==r.state&&"stopped"!==r.state&&r.stop())},"number"==typeof t.timeSlice?(a(),r.start(t.timeSlice)):r.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,r&&(this.recordingCallback=e,"recording"===r.state&&r.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(s,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){r&&"recording"===r.state&&r.pause()},this.resume=function(){r&&"paused"===r.state&&r.resume()},this.clearRecordedData=function(){r&&"recording"===r.state&&i.stop(A),A()},this.getInternalRecorder=function(){return r},this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function o(){if(r&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(o,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function R(e,t){if(!w(e,"audio").length)throw"Your stream has no audio tracks.";var o,r=this,s=[],a=[],n=!1,A=0,d=2,c=(t=t||{}).desiredSampRate;function u(){if(!1===t.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function h(e,t){function i(e,t){var i,o=e.numberOfAudioChannels,r=e.leftBuffers.slice(0),s=e.rightBuffers.slice(0),a=e.sampleRate,n=e.internalInterleavedLength,A=e.desiredSampRate;function d(e,t,i){var o=Math.round(e.length*(t/i)),r=[],s=Number((e.length-1)/(o-1));r[0]=e[0];for(var a=1;a96e3)&&(t.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),t.disableLogs||t.desiredSampRate&&console.log("Desired sample-rate: "+t.desiredSampRate);var y=!1;function v(){s=[],a=[],A=0,E=!1,n=!1,y=!1,p=null,r.leftchannel=s,r.rightchannel=a,r.numberOfAudioChannels=d,r.desiredSampRate=c,r.sampleRate=b,r.recordingLength=A,B={left:[],right:[],recordingLength:0}}function S(){o&&(o.onaudioprocess=null,o.disconnect(),o=null),m&&(m.disconnect(),m=null),v()}this.pause=function(){y=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return t.disableLogs||console.log("Seems recording has been restarted."),void this.record();y=!1},this.clearRecordedData=function(){t.checkForInactiveTracks=!1,n&&this.stop(S),S()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var E=!1;o.onaudioprocess=function(e){if(!y)if(!1===u()&&(t.disableLogs||console.log("MediaStream seems stopped."),o.disconnect(),n=!1),n){E||(E=!0,t.onAudioProcessStarted&&t.onAudioProcessStarted(),t.initCallback&&t.initCallback());var i=e.inputBuffer.getChannelData(0),c=new Float32Array(i);if(s.push(c),2===d){var l=e.inputBuffer.getChannelData(1),h=new Float32Array(l);a.push(h)}A+=f,r.recordingLength=A,void 0!==t.timeSlice&&(B.recordingLength+=f,B.left.push(c),2===d&&B.right.push(h))}else m&&(m.disconnect(),m=null)},p.createMediaStreamDestination?o.connect(p.createMediaStreamDestination()):o.connect(p.destination),this.leftchannel=s,this.rightchannel=a,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=b,r.recordingLength=A;var B={left:[],right:[],recordingLength:0};function C(){n&&"function"==typeof t.ondataavailable&&void 0!==t.timeSlice&&(B.left.length?(h({desiredSampRate:c,sampleRate:b,numberOfAudioChannels:d,internalInterleavedLength:B.recordingLength,leftBuffers:B.left,rightBuffers:1===d?[]:B.right},(function(e,i){var o=new Blob([i],{type:"audio/wav"});t.ondataavailable(o),setTimeout(C,t.timeSlice)})),B={left:[],right:[],recordingLength:0}):setTimeout(C,t.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var o,r,s,a=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,A=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(a&&A&&A[2]&&(n=parseInt(A[2],10)),a&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)o=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";o=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(s=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in o?e=o.captureStream(25):"mozCaptureStream"in o?e=o.mozCaptureStream(25):"webkitCaptureStream"in o&&(e=o.webkitCaptureStream(25));try{var a=new f;a.addTrack(w(e,"video")[0]),e=a}catch(e){}if(!e)throw"captureStream API are NOT available.";(r=new C(e,{mimeType:t.mimeType||"video/webm"})).record()}else h.frames=[],u=(new Date).getTime(),l();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var o=h.frames.length;h.frames.forEach((function(e,i){var r=o-i;t.disableLogs||console.log(r+"/"+o+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(r,o);var s=e.image.toDataURL("image/webp",1);h.frames[i].image=s})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){s=!1;var o=this;i&&r?r.stop(e):this.getWebPImages((function(){h.compile((function(i){t.disableLogs||console.log("Recording finished!"),o.blob=i,o.blob.forEach&&(o.blob=new Blob([],{type:"video/webm"})),e&&e(o.blob),h.frames=[]}))}))};var d=!1;function c(){h.frames=[],s=!1,d=!1}function l(){if(d)return u=(new Date).getTime(),setTimeout(l,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),h.frames.push({image:(o=document.createElement("canvas"),r=o.getContext("2d"),o.width=e.width,o.height=e.height,r.drawImage(e,0,0),o),duration:i}),void(s&&setTimeout(l,t.frameInterval))}var o,r;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(l,t.frameInterval);u=(new Date).getTime(),h.frames.push({image:e.toDataURL("image/webp",1),duration:i}),s&&setTimeout(l,t.frameInterval)}})}this.pause=function(){d=!0,r instanceof C&&r.pause()},this.resume=function(){d=!1,r instanceof C?r.resume():s||this.record()},this.clearRecordedData=function(){s&&this.stop(c),c()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),h=new I.Video(100)}function T(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-A;return t?s?(A=(new Date).getTime(),setTimeout(i,100)):(A=(new Date).getTime(),n.paused&&n.play(),l.drawImage(n,0,0,c.width,c.height),d.frames.push({duration:t,image:c.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function o(e,t,i,o,r){var s=document.createElement("canvas");s.width=c.width,s.height=c.height;var a,n,A,d=s.getContext("2d"),l=[],u=-1===t,h=t&&t>0&&t<=e.length?t:e.length,p=0,m=0,g=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),b=i&&i>=0&&i<=1?i:0,y=o&&o>=0&&o<=1?o:0,v=!1;n=-1,A=(a={length:h,functionToLoop:function(t,i){var o,r,s,a=function(){!v&&s-o<=s*y||(u&&(v=!0),l.push(e[i])),t()};if(v)a();else{var n=new Image;n.onload=function(){d.drawImage(n,0,0,c.width,c.height);var e=d.getImageData(0,0,c.width,c.height);o=0,r=e.data.length,s=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function o(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*s[0].width:s[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),r.height=s[0].height*n}else r.width=a.width||360,r.height=a.height||240;t&&t instanceof HTMLVideoElement&&u(t),s.forEach((function(e,t){u(e,t)})),setTimeout(l,a.frameInterval)}}function u(e,t){if(!o){var i=0,r=0,a=e.width,n=e.height;1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(a=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),s.drawImage(e,i,r,a,n),"function"==typeof e.stream.onRender&&e.stream.onRender(s,i,r,a,n,t)}}function h(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||a.width||360,i.height=e.height||a.height||240,i.play(),i}function p(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=h(e);t.stream=e,i.push(t)}}))}void 0!==n?c.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(c.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){l()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var o=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var r=h(t);r.stream=t,i.push(r),o.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var s=a.audioContext.createMediaStreamSource(t);a.audioDestination=a.audioContext.createMediaStreamDestination(),s.connect(a.audioDestination),o.addTrack(a.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(o)}))},this.releaseStreams=function(){i=[],o=!0,a.gainNode&&(a.gainNode.disconnect(),a.gainNode=null),a.audioSources.length&&(a.audioSources.forEach((function(e){e.disconnect()})),a.audioSources=[]),a.audioDestination&&(a.audioDestination.disconnect(),a.audioDestination=null),a.audioContext&&a.audioContext.close(),a.audioContext=null,s.clearRect(0,0,r.width,r.height),r.stream&&(r.stream.stop(),r.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),p(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){o=!1;var t=function(){var e;p(),"captureStream"in r?e=r.captureStream():"mozCaptureStream"in r?e=r.mozCaptureStream():a.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),r.stream=t,t}(),i=function(){c.AudioContextConstructor||(c.AudioContextConstructor=new c.AudioContext);a.audioContext=c.AudioContextConstructor,a.audioSources=[],!0===a.useGainNode&&(a.gainNode=a.audioContext.createGain(),a.gainNode.connect(a.audioContext.destination),a.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=a.audioContext.createMediaStreamSource(e);!0===a.useGainNode&&i.connect(a.gainNode),a.audioSources.push(i)}})),!t)return;return a.audioDestination=a.audioContext.createMediaStreamDestination(),a.audioSources.forEach((function(e){e.connect(a.audioDestination)})),a.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function L(e,t){e=e||[];var i,o,r=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var r;i=new j(e,t.elementClass||"multi-streams-mixer"),(r=[],e.forEach((function(e){w(e,"video").forEach((function(e){r.push(e)}))})),r).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(o=new C(i.getMixedStream(),t)).record()},this.stop=function(e){o&&o.stop((function(t){r.blob=t,e(t),r.clearRecordedData()}))},this.pause=function(){o&&o.pause()},this.resume=function(){o&&o.resume()},this.clearRecordedData=function(){o&&(o.clearRecordedData(),o=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(r){if(!r)throw"First parameter is required.";r instanceof Array||(r=[r]),e.concat(r),o&&i&&(i.appendStreams(r),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function O(e,t){var i,o,r;function s(){return new ReadableStream({start:function(o){var r=document.createElement("canvas"),s=document.createElement("video"),a=!0;s.srcObject=e,s.muted=!0,s.height=t.height,s.width=t.width,s.volume=0,s.onplaying=function(){r.width=t.width,r.height=t.height;var e=r.getContext("2d"),n=1e3/t.frameRate,A=setInterval((function(){if(i&&(clearInterval(A),o.close()),a&&(a=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(s,0,0),"closed"!==o._controlledReadableStream.state)try{o.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},s.play()}})}function a(e,A){if(!t.workerPath&&!A)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){a(e,t)}))}));if(!t.workerPath&&A instanceof ArrayBuffer){var d=new Blob([A],{type:"text/javascript"});t.workerPath=l.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(o=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),o.addEventListener("message",(function(e){"READY"===e.data?(o.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),s().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):o.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(r||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],r=!1,this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){r=!0},this.resume=function(){r=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){o?(o.addEventListener("message",(function(t){null===t.data&&(o.terminate(),o=null,e&&e())})),o.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],r=!1,this.blob=null},this.blob=null}i.DiskStorage=x,i.GifRecorder=D,i.MultiStreamRecorder=L,i.RecordRTCPromisesHandler=function(e,t){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var o=this;o.recordRTC=new i(e,t),this.startRecording=function(){return new Promise((function(e,t){try{o.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{o.recordRTC.stopRecording((function(i){o.blob=o.recordRTC.getBlob(),o.blob&&o.blob.size?e(i):t("Empty blob.",o.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{o.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{o.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{o.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(o.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(o.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(o.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(o.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(o.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},i.WebAssemblyRecorder=O}));class Je extends Be{constructor(e){super(),this.player=e,this.fileName="",this.fileType=e._opt.recordType||c,this.isRecording=!1,this.recordingTimestamp=0,this.recordingInterval=null,e.debug.log("Recorder","init")}destroy(){this._reset(),this.player.debug.log("Recorder","destroy")}setFileName(e,t){this.fileName=e,d!==t&&c!==t||(this.fileType=t)}get recording(){return this.isRecording}get recordTime(){return this.recordingTimestamp}startRecord(){const e=this.player.debug,t={type:"video",mimeType:"video/webm;codecs=h264",onTimeStamp:t=>{e.log("Recorder","record timestamp :"+t)},disableLogs:!this.player._opt.debug};try{const e=this.player.video.$videoElement.captureStream(25);if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const t=this.player.audio.mediaStreamAudioDestinationNode.stream;if(t.getAudioTracks().length>0){const i=t.getAudioTracks()[0];i&&i.enabled&&e.addTrack(i)}}this.recorder=We(e,t)}catch(t){e.error("Recorder","startRecord error",t),this.emit(x.recordCreateError)}this.recorder&&(this.isRecording=!0,this.player.emit(x.recording,!0),this.recorder.startRecording(),e.log("Recorder","start recording"),this.player.emit(x.recordStart),this.recordingInterval=window.setInterval((()=>{this.recordingTimestamp+=1,this.player.emit(x.recordingTimestamp,this.recordingTimestamp)}),1e3))}stopRecordAndSave(){this.recorder&&this.isRecording&&this.recorder.stopRecording((()=>{this.player.debug.log("Recorder","stop recording"),this.player.emit(x.recordEnd);const e=(this.fileName||he())+"."+(this.fileType||c);De(this.recorder.getBlob(),e),this._reset(),this.player.emit(x.recording,!1)}))}_reset(){this.isRecording=!1,this.recordingTimestamp=0,this.recorder&&(this.recorder.destroy(),this.recorder=null),this.fileName=null,this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}}class Ge{constructor(e){return new(Ge.getLoaderFactory())(e)}static getLoaderFactory(){return Je}}class Pe{constructor(e){this.player=e,this.decoderWorker=new Worker(e._opt.decoder),this._initDecoderWorker(),e.debug.log("decoderWorker","init")}destroy(){this.decoderWorker.postMessage({cmd:T}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onmessage=t=>{const i=t.data;switch(i.cmd){case u:e.log("decoderWorker","onmessage:",u),this.player.loaded||this.player.emit(x.load),this.player.emit(x.decoderWorkerInit),this._initWork();break;case b:e.log("decoderWorker","onmessage:",b,i.code),this.player._times.decodeStart||(this.player._times.decodeStart=he()),this.player.video.updateVideoInfo({encTypeCode:i.code});break;case f:e.log("decoderWorker","onmessage:",f,i.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:i.code});break;case h:if(e.log("decoderWorker","onmessage:",h,`width:${i.w},height:${i.h}`),this.player.video.updateVideoInfo({width:i.w,height:i.h}),!this.player._opt.openWebglAlignment&&i.w/2%4!=0)return void this.player.emit(j.webglAlignmentError);this.player.video.initCanvasViewSize();break;case g:e.log("decoderWorker","onmessage:",g,`channels:${i.channels},sampleRate:${i.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(i),this.player.audio.initScriptNode(i));break;case p:this.player.handleRender(),this.player.video.render(i),this.player.emit(x.timeUpdate,i.ts),this.player.updateStats({fps:!0,ts:i.ts,buf:i.delay}),this.player._times.videoStart||(this.player._times.videoStart=he(),this.player.handlePlayToRenderTimes());break;case m:this.player.playing&&this.player.audio&&this.player.audio.play(i.buffer,i.ts);break;case y:i.message&&-1!==i.message.indexOf(v)&&(this.player.emit(x.error,j.wasmDecodeError),this.player.emit(j.wasmDecodeError));break;default:this.player[i.cmd]&&this.player[i.cmd](i)}}}_initWork(){const e={debug:this.player._opt.debug,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment};this.decoderWorker.postMessage({cmd:C,opt:JSON.stringify(e),sampleRate:this.player.audio&&this.player.audio.audioContext.sampleRate||0})}decodeVideo(e,t,i){const o={type:S,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:R,buffer:e,options:o},[e.buffer])}decodeAudio(e,t){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t)}_decodeAudio(e,t){const i={type:w,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:R,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:k,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker.postMessage({cmd:I,key:e.key,value:e.value})}}class Ne extends Be{constructor(e){super(),this.player=e,this.stopId=null,this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.initInterval()}destroy(){this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}getDelay(e){if(!e)return-1;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;this.delay=t>=i?t-i:i-t}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}initInterval(){this.player.debug.log("common dumex","init Interval");let e=()=>{let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay;if(this.bufferList.length)if(this.dropping){for(e=this.bufferList.shift(),e.type===w&&0===e.payload[1]&&this._doDecoderDecode(e);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift(),e.type===w&&0===e.payload[1]&&this._doDecoderDecode(e);e.isIFrame&&this.getDelay(e.ts)<=Math.min(t,200)&&(this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t+i?(this.resetDelay(),this.dropping=!0):(e=this.bufferList[0],this.getDelay(e.ts)>t&&(this.bufferList.shift(),this._doDecoderDecode(e)))};e(),this.stopId=setInterval(e,10)}_doDecode(e,t,i,o,r){const s=this.player;let a={ts:i,cts:r,type:t,isIFrame:!1};s._opt.useWCS&&!s._opt.useOffscreen||s._opt.useMSE?(t===S&&(a.isIFrame=o),this.pushBuffer(e,a)):t===S?s.decoderWorker&&s.decoderWorker.decodeVideo(e,i,o):t===w&&s._opt.hasAudio&&s.decoderWorker&&s.decoderWorker.decodeAudio(e,i)}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:o}=t;e.type===w?t._opt.hasAudio&&t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts):e.type===S&&(t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame):t._opt.useMSE&&o.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts))}pushBuffer(e,t){t.type===w?this.bufferList.push({ts:t.ts,payload:e,type:w}):t.type===S&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:S,isIFrame:t.isIFrame})}close(){}}class ze extends Ne{constructor(e){super(e),this.input=this._inputFlv(),this.flvDemux=this.dispatchFlvData(this.input),e.debug.log("FlvDemux","init")}destroy(){super.destroy(),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}dispatch(e){this.flvDemux(e)}*_inputFlv(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),o=this.player;for(;;){t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8];let a=i[0];16777215===a&&(t[3]=e[11],a=i[0]);const n=yield s;switch(r){case E:o._opt.hasAudio&&(o.updateStats({abps:n.byteLength}),n.byteLength>0&&this._doDecode(n,w,a));break;case B:if(o._times.demuxStart||(o._times.demuxStart=he()),o._opt.hasVideo){o.updateStats({vbps:n.byteLength});const e=n[0]>>4==1;if(n.byteLength>0){i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let t=i[0];this._doDecode(n,S,a,e,t)}}}}}dispatchFlvData(e){let t=e.next(),i=null;return o=>{let r=new Uint8Array(o);if(i){let e=new Uint8Array(i.length+r.length);e.set(i),e.set(r,i.length),r=e,i=null}for(;r.length>=t.value;){let i=r.slice(t.value);t=e.next(r.slice(0,t.value)),r=i}r.length>0&&(i=r)}}close(){this.input&&this.input.return(null)}}class He extends Ne{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy"),this.player=null}dispatch(e){const t=this.player,i=new DataView(e),o=i.getUint8(0),r=i.getUint32(1,!1);switch(o){case w:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,o,r)}break;case S:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=he()),i.byteLength>5){const s=new Uint8Array(e,5),a=i.getUint8(5)>>4==1;t.updateStats({vbps:s.byteLength}),s.byteLength>0&&this._doDecode(s,o,r,a)}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}class Ye{constructor(e){return new(Ye.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return e===A?He:e===n?ze:void 0}}class Xe{constructor(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){let e=this._total_bytes-this._buffer_index,t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t}readBits(e){if(e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let o=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-o;return this._current_word<<=o,this._current_word_bits_left-=o,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}class qe{static _ebsp2rbsp(e){let t=e,i=t.byteLength,o=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(o[r]=t[e],r++);return new Uint8Array(o.buffer,0,r)}static parseSPS(e){let t=qe._ebsp2rbsp(e),i=new Xe(t);i.readByte();let o=i.readByte();i.readByte();let r=i.readByte();i.readUEG();let s=qe.getProfileString(o),a=qe.getLevelString(r),n=1,A=420,d=[0,420,422,444],c=8;if((100===o||110===o||122===o||244===o||44===o||83===o||86===o||118===o||128===o||138===o||144===o)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(A=d[n]),c=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],w=o[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),w=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);E=i.readBool(),B=t,C=2*e,S=B/C}}let R=1;1===v&&1===w||(R=v/w);let k=0,T=0;if(0===n)k=1,T=2-m;else{k=3===n?1:2,T=(1===n?2:1)*(2-m)}let I=16*(h+1),x=16*(p+1)*(2-m);I-=(g+f)*k,x-=(b+y)*T;let D=Math.ceil(I*R);return i.destroy(),i=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:u,chroma_format:A,chroma_format_string:qe.getChromaFormatString(A),frame_rate:{fixed:E,fps:S,fps_den:C,fps_num:B},sar_ratio:{width:v,height:w},codec_size:{width:I,height:x},present_size:{width:D,height:x}}}static _skipScalingList(e,t){let i=8,o=8,r=0;for(let s=0;s ${t.codecWidth}, height ${i.height}-> ${t.codecHeight}`),void this.player.emit(j.webcodecsWidthOrHeightChange)}if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){const o=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?X:q});this.player.emit(x.timeUpdate,t);try{this.decoder.decode(o)}catch(e){this.player.debug.error("Webcodecs","VideoDecoder",e),-1!==e.toString().indexOf(re)&&this.player.emit(j.webcodecsDecodeError)}}else this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false")}else if(i&&0===e[1]){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===Q)return void this.emit(j.webcodecsH265NotSupport);this.player._times.decodeStart||(this.player._times.decodeStart=he());const i=function(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let o=t[e].toString(16);o.length<2&&(o="0"+o),i+=o}return{codec:i,description:e}}(e.slice(5));this.decoder.configure(i),this.hasInit=!0}}}const _e={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"加载",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制"};var $e=Object.keys(_e).reduce(((e,t)=>(e[t]=`\n \n ${_e[t]?`${_e[t]}`:""}\n`,e)),{}),et=(e,t)=>{const{events:{proxy:i}}=e,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank",me(o,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let r=e.width,s=e.height;i(o,"load",(()=>{i(o.contentDocument.defaultView,"resize",(()=>{e.width===r&&e.height===s||(r=e.width,s=e.height,e.emit(x.resize),n())}))})),e.$container.appendChild(o),e.on(x.destroy,(()=>{e.$container.removeChild(o)})),e.on(x.volumechange,(()=>{!function(e){if(0===e)me(t.$volumeOn,"display","none"),me(t.$volumeOff,"display","flex"),me(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=ge(t.$volumePanel,"height")||60,o=ge(t.$volumeHandle,"height"),r=i-(i-o)*e-o;me(t.$volumeHandle,"top",`${r}px`),me(t.$volumeOn,"display","flex"),me(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(x.loading,(e=>{me(t.$loading,"display",e?"flex":"none"),me(t.$poster,"display","none"),e&&me(t.$playBig,"display","none")}));const a=i=>{let o=!0===(r=i)||!1===r?i:e.fullscreen;var r;me(t.$fullscreenExit,"display",o?"flex":"none"),me(t.$fullscreen,"display",o?"none":"flex")},n=()=>{ye()&&t.$controls&&setTimeout((()=>{if(e.fullscreen){let i=e.height/2-e.width+19,o=e.height/2-19;t.$controls.style.transform=`translateX(${-i}px) translateY(-${o}px) rotate(-90deg)`}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)"}),10)};try{ce.on("change",a),e.events.destroys.push((()=>{ce.off("change",a)}))}catch(e){}e.on(x.webFullscreen,(e=>{a(e),n()})),e.on(x.recording,(()=>{me(t.$record,"display",e.recording?"none":"flex"),me(t.$recordStop,"display",e.recording?"flex":"none"),me(t.$recording,"display",e.recording?"flex":"none")})),e.on(x.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=function(e){var t;if(e>-1){var i=Math.floor(e/3600),o=Math.floor(e/60)%60,r=e%60;t=i<10?"0"+i+":":i+":",o<10&&(t+="0"),t+=o+":",(r=Math.round(r))<10&&(t+="0"),t+=r.toFixed(0)}return t}(e))})),e.on(x.playing,(e=>{me(t.$play,"display",e?"none":"flex"),me(t.$playBig,"display",e?"none":"block"),me(t.$pause,"display",e?"flex":"none"),me(t.$screenshot,"display",e?"flex":"none"),me(t.$record,"display",e?"flex":"none"),me(t.$qualityMenu,"display",e?"flex":"none"),me(t.$volume,"display",e?"flex":"none"),a(),e||t.$speed&&(t.$speed.innerHTML=ve(""))})),e.on(x.kBps,(e=>{const i=ve(e);t.$speed&&(t.$speed.innerHTML=i)}))};function tt(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}tt('@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jessibuca-container .jessibuca-icon{cursor:pointer;width:16px;height:16px}.jessibuca-container .jessibuca-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jessibuca-container .jessibuca-play-big{position:absolute;display:none;height:100%;width:100%;background:rgba(0,0,0,.4)}.jessibuca-container .jessibuca-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACgklEQVRoQ+3ZPYsTQRjA8eeZZCFlWttAwCIkZOaZJt8hlvkeHrlccuAFT6wEG0FQOeQQLCIWih6chQgKgkkKIyqKCVYip54IWmiQkTmyYhFvd3Zn3yDb7szu/7cv7GaDkPEFM94PK0DSZ9DzDAyHw7uI2HRDlVJX5/N5r9FoHCYdr/fvCRiNRmpJ6AEidoUQ15NG+AH8BgD2n9AHANAmohdJQfwAfgGA4xF4bjabnW21Whob62ILoKNfAsAGEd2PU2ATcNSNiDf0/cE5/xAHxDpgEf0NADaJ6HLUiKgAbvcjpdSGlPJZVJCoAUfdSqkLxWLxTLlc/mkbEgtgET1TSnWklLdtIuIEuN23crlcp16vv7cBSQKgu38AwBYRXQyLSArg3hsjRDxNRE+CQhIF/BN9qVAobFYqle+mkLQAdLd+8K0T0U0TRJoAbvc9fVkJId75gaQRoLv1C2STiPTb7rFLWgE6+g0RncwyYEJEtawCvjDGmpzzp5kD6NfxfD7frtVqB17xen2a7oG3ALBm+oMoFQBEPD+dTvtBfpImDXjIGFvjnD/3c7ksG5MU4HDxWeZa0HB3XhKAXcdxOn5vUi9gnIDXSqm2lHLPK8pkfVyAbSLqm4T5HRs1YB8RO0KIid8g03FRAT4rpbpSyh3TINPxUQB2GGM9zvkn05gg420CJovLZT9ISNA5tgB9ItoOGhFmnh/AcZ/X9xhj65zzV2Eiwsz1A1j2B8dHAOgS0W6YnduY6wkYj8d3lFKn/j66Ea84jtOrVqtfbQSE3YYnYDAY5Eql0hYAnNDv6kKIx2F3anO+J8DmzqLY1goQxVE12ebqDJgcrSjGrs5AFEfVZJt/AF0m+jHzUTtnAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jessibuca-container .jessibuca-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACEElEQVRoQ+2ZXStEQRjH/3/yIXwDdz7J+i7kvdisXCk3SiFJW27kglBcSFFKbqwQSa4krykuKB09Naf2Yndn5jgzc06d53Znd36/mWfeniVyHsw5PwqB0DOonYEoijYBlOpAFwCMkHwLDS/9mwhEDUCfAAyTXA4tYSLwC6CtCegegH6S56FETAR+AHRoACcBTJAUWa+RloBAXwAYIrnt0yBNgZi7qtbHgw8RFwLC/QFglOScawlXAjH3gUqrE1cirgVi7mkAYyS/0xbxJSDcdwAGSa6nKeFTIOZeUyL3aYiEEBDuLwDjJGf+KxFKIOY+BdBL8iipSGiBmHtWbbuftiJZERBuOfgGSK7aSGRJIObeUml1ayKSRQHhlgtkiaTcdltGVgUE+ppkV54FaiS78yrwqlLoOI8Cch2XV548W7WRpTVwA6DP9kGUFYEpAOUkT9LQAvtq1M+0udKkQSgBqSlJWWYxKXj8vRACK+o6bbRIdYI+Ba7U7rKjg7L53JdAhWTZBsy0rWuBXZUuNVMg23auBF7UIl2yBbJt70JAoKV6/WwLk6R9mgKSJlJ1kLTxFmkJyCla8UZd15GJQKvyumyJ8gy8DAEvfZoINPqD41EtUjmUgoaJwAaAnjrKebVI34OSq85NBNqlCAWgE0CV5GEWwI3vQlmCbcSinYFCwPEIFDPgeIC1P1/MgHaIHDf4Aydx2TF7wnKeAAAAAElFTkSuQmCC")}.jessibuca-container .jessibuca-recording{display:none;position:absolute;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:95px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jessibuca-container .jessibuca-recording .jessibuca-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jessibuca-container .jessibuca-recording .jessibuca-recording-time{font-size:14px;font-weight:500;color:#ddd}.jessibuca-container .jessibuca-recording .jessibuca-icon-recordStop{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jessibuca-container .jessibuca-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jessibuca-container .jessibuca-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;transition:all .2s ease-in-out;-webkit-user-select:none;user-select:none;transition:width .5s ease-in}.jessibuca-container .jessibuca-controls .jessibuca-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jessibuca-container .jessibuca-controls .jessibuca-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jessibuca-container .jessibuca-controls .jessibuca-fullscreen,.jessibuca-container .jessibuca-controls .jessibuca-fullscreen-exit,.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-microphone-close,.jessibuca-container .jessibuca-controls .jessibuca-pause,.jessibuca-container .jessibuca-controls .jessibuca-play,.jessibuca-container .jessibuca-controls .jessibuca-record,.jessibuca-container .jessibuca-controls .jessibuca-record-stop,.jessibuca-container .jessibuca-controls .jessibuca-screenshot{display:none}.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-icon-mute{z-index:1}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom{display:flex;justify-content:space-between;height:100%}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-left,.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-right{display:flex;align-items:center}.jessibuca-container.jessibuca-controls-show .jessibuca-controls{opacity:1;visibility:visible}.jessibuca-container.jessibuca-controls-show-auto-hide .jessibuca-controls{opacity:.8;visibility:visible;display:none}.jessibuca-container.jessibuca-hide-cursor *{cursor:none!important}.jessibuca-container .jessibuca-icon-loading{width:50px;height:50px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAHHklEQVRoQ91bfYwdVRX/nTvbPuuqlEQM0q4IRYMSP0KkaNTEEAokNUEDFr9iEIOiuCC2++4dl+Tti9nOmbfWFgryESPhH7V+IIpG8SN+Fr8qqKgQEKoUkQREwXTLs8495mze1tf35s2bfTu7ndf758y55/x+c879OvcMYYnbxMTEy4IgOImIxkRkrYisNsasUrPe+wNE9C8ielRE9iVJsndmZubBpYRES6E8DMNXeu83ENHrAJwO4OUARvrY+i+ABwDcLSJ7jDF3RlF0f9H4CiNcrVZPCIJgk4hcCOCNBQH9EYBveO93NRqNx4rQuWjCExMT64IguEJE3kdEq4sA1alDRDTsb02SZOfMzMxDi7ExMGFr7THGGCciVwKYG5PL0HTMb69UKtNTU1Ozg9gbiLC1diMRXQ/gxEGMFtDnQRHZHMfxHQvVtWDCzrkdANSredvfRWQ3Ee0F8DCAJwDs994nQRCM6qxNROu892uI6A0ATs2rWER2xHF8VV55lctN2Dl3LICvA3hzDgMPENFXROT2SqVyb71efzZHnzkRnRNGRkY2isj5AM7K0e/HAN7OzP/MIZuP8OTk5FiSJDpjnpylVER+YIzZEUXRN/MY7ydTrVbXE9FlRPT+LFkiesh7f1Ycx4/009nXw9balxDRLwC8OEPZ/SLi4jjWCCi8WWtfA2CKiN6WofzxIAhePz09/dfMj5P1slqtPj8IgntEZF0vORH51Ozs7NU7d+5sFs60Q2EYhpeKyDUZq8LDInJ6HMdP98KS6WHn3E8BvKlHZx2X72Xmry410Xb91trTiOjLAF7Rw+5uZu6FufcYds7pl7wiTSkRPSUi5zHzr5eT7LytWq32gmaz+a0MZ1zDzB9LxZ72sFqtbjDGfLcHmWeI6IwoinTfe8RarVYzzWbzJxnb2A3M/P1OgF0hPT4+XhkdHd0H4LgUNv8xxpy5devW3x4xpm2Gt2zZMjoyMnJ363DSCemJ/fv3j3XOLV2EnXMNXQ57hPIFURTdVgay8xhaq4geKVem4Jph5mr788MIV6vVtcYY9W5XI6Iboij6SJnIzmNxzl0E4Itp2IIgWDs9Pf23+XeHEQ7D8EYR+VBKx8eYeU0ZybaR1s3OxhSMNzLzh7sIb968+YUrVqxQ7z6na6ATlS6UOzG2Qlv366bj3bMHDx4c27Zt25P6/JCHnXO6Cf90yhe6l5lfXWbvto3nm4no0hSHXRVFkR56/k/YWvsbItJ0zGFNRC6K4/hLQ0JYt8FdW0si2hNF0RmHCLcSbWnr6pPM/CIAMgyEFaNz7tsAzuvEmyTJKZotmQtpa+04EV2bQuo6Zh4fFrItwu8C8PmUSP1oHMfXzxEOw3CXiGzqFPLen9NoNL43TIQ19UREmmRY0YF7FzO/k5xzLwWgYdCZaZj13h/faDT+PUyEW15OO/T8MQiCjUr4HAC6Ee/MG/+MmfNkN0r3Pay124jo4x3ADuiBRwl/EMBNKTF/SxzHl5SOTQ5AzrnLANyQsjxdooRrmk1I0TPFzPUc+ksnYq09l4i+k8aJrLXbiajr7EhEV0ZRlDZzl45gJyDNhRljfpkCdLt6WF2vIdDZPsDMnys9uxSA1tpXEdHvU1599qgknHHqu/moDOlWNkTTyu2rTGKMOfeonLQ0lFunv08AOBPAXu/9jkajsafnsgTgVma+eBjHcBbmrI3HXcxc1D1vab5b1tbyQKVSOb5erz9TGrQFAMk8POhWLI7jOwuwUxoV/Y6Hn2Hmy0uDtgAgc4RbZQt/Ttl7PrVy5crj6vW6L8BWKVS057TuAqAX0p3t3cz8hVKgLQDEIcLW2suJ6LoUnX9i5tMKsFUKFYcIZ6VpAWxiZr2xG/p2WCI+4yDxeKVSWXM0jOXDCE9OTq5JkuTRNDcS0U1RFKWdqobK612XaWEYflJEru7BYuhDu4tw66ShxSFpd0laD7meme8ZKre2gU0teXDOnQ2gV3q2FBfig37wnjUevVI/auhIlzwMSnYOe1bnPkUtWrXznuUualkM2b6EtWzJGKMlBaf0MrScZUuLJduXsAq07l1/DuCEDIP3iUi4VIVpRRCd19G3Ek8FtfTQe//DrAI1lSu69LBIogsirMK1Wm11s9n8GoC35AByH4DbvPe3r1q16g8LKS7NoXtRIrk83G4ha/bugURL93cD+Mt8+TAR6YT3j0ql8rtBC70HZb1gwmooDMO3eu+vJaKTBjXc6rfPe39ho9H41SL15O4+EOFWiGv5n2sViz83t8VuwWW9pRyY8Dxu59zJIqJVAhcP+JPHI8y8bL8SLJrwPHH9jYeI3kFEF+Ssmp/rqjN7HMe6lV2WVhjhdrRhGJ7a+lFrPYDXAtB667Q/X5723p+tNwLLwrbf1rIIEBryxpgTkyQZA6DlFccS0fMA6G84d6RVvBZht5eO/wEB1Kvsoc6vtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;animation:rotation 1s linear infinite}.jessibuca-container .jessibuca-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAE5UlEQVRoQ+1YW2sdVRT+1s7JxbsoVkEUrIIX0ouz15zYNA+N1RdtQfCltlUfvLbqL/BCwZ8grbHtizQqPojgBSr0JkiMmT2nxgapqBURtPVCq7HxJCeZJVPmxDlzZubMmXOSEsnAvOy917fXt9e39tp7E5b4R0vcfywTuNgRbBgBx3HuJqLVzPzmYjprjHkcwAlmLqXNm4XAISLaSESPaq2HF4OE67rbRGRYRA7btn1fbgLGmKsA/Azg0gBkGzO/vZAkHMd5hIiqc5wHcCMz/5k0Z2oExsfHV1QqldPAf8lORNu11m8tBAljzFYAYWxRSl1vWdZvuQj4RsYYF4AVBlgIOVVlE55HRIxt23ZuCfmGjuOsJ6LPoiAistW27XfaEYmIbOYhPc9bXywWR1oiEJDYQkR1zrYjEjGyqfqbKd8a7kJVtLgQ+30i8pht2wfyRKIdmJkJBPkQTbILfudJ7CTZNBvVpggEcgpvc/ML38zESbLJsxBNE/A9biX0rdjGyTQXgbxyapdsarb0PMlXtWnGoXbKpm0Essqp3bJpK4E0OXmed3+hUBDP8w5FI91M0rdcyLLILElOCbaZilSWeXMncRx4klTCY1spfG3dhZJWx3GcDUR0EEB3ZMw0ET2gtT6SZWWzjmlrBIJCl0hAKfWgZVmHszqXZVxbCSxpCS2JJA6umIhe8ZKKVLPbaBJ+S9toqVRa53nedgAbAKwIwH4FcAzAa0R0l4i8F7PPz189k6RFRA+LyNcAXojDV0oNW5b1eW4Cxpg9AHZkSaaa6hhzb065uDSCH2LmRB8Sk9gY4293g43Qo/1pV80m8yQMfZSZ781cB1zXHRKRZ2IMpgD8A+DamL4ZItqitX4/jbQx5iEA7wLoihn3V/ACckWMJN/QWj9b1x5tGBsbW6uUOh5pPy0iL3Z2dn6ilJqanp5ep5TaJSLhF4NppdRNaU8gPmapVLrO87yfIoXuWyJ6uVKp+HmFjo6OQSJ6FcBtYT+UUmstyxqvkWuUgDFmP4AnQu2/e563qlgs+u9DNZ8xZhRAX7VRRPbath0XuXk7Y8xeAE+FgL6fnJzsHRwcLIfBR0ZGLunq6poAsDLUvp+Zw7b1r9PGmJMAbg8Z7WDmoThZuK67WkS+DD18fcPMdzSQUBR/EzN/nIC/SUQ+DPXV4dclsTHmHAD/SfHCNzc3t7Kvr++HJKeMMacA3BL0nyuXyzcPDAxMxo0fHR29slAo/Ajg6qD/fE9Pzw29vb1/x42fmJi4vFwu+5G/LOg/y8zXNJLQ2dAES5JANMQ7mfn1jBI6ycx3NiMhItqstf4oAX+ziHwQ6qvDj5NQNIn/ALCKmX+JSeIvABRD7fuY+ekGBPYBeDI05tTMzExvf3+/vz2Hk91/ET8RSeI6/DoCpVJpjed5fmKGvzMAXpqdnT3oed5Ud3d3v4jsAqBr9Ei0Rmv9VRqBBPzvROQVETnq2xJRdRu9tRF+bCVOKWT+Kvl/TSIFk6SW/LAjKfjV5K8rZABi8dOOEv7FI7Z8x6zwEWbemLbyMfJr5qiSiJ96oclymBOR3bZtP9+M89WxxpjdAHY2sN3DzM8ljWl4I3Nd9x7/OE1ENcdpETnmH3e11n41zv0l4J8RkU+J6AAz+xtF4teQQG7PFslwmcAiLfSyhC72Qv9/I/Avns2OT7QJskoAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAED0lEQVRoQ+2ZycsdRRTFf2ejqHFAMQqiYBTUoElUHLNx3GgCgpuYRF2o0UT9CxwQ/BMkMSbZSKLiQgQHUDCJgjiAxiEiESdEcJbEedgcKaj3UV+/6q7u/jovPPkK3qbr1ql76p5bt6qemPKmKfefeQKHOoLFCNg+H1gi6fFJOmv7VmCvpD1N87Yh8ApwNXCzpB2TIGF7DRDm2inpmt4EbB8LfAMcGUHWSHryYJKwfRMwmuMP4BRJv9TN2RgB2wuB72BWsq+V9MTBIGF7NZBiGzhJ0o+9CIRBtt8FLqgADC6nRDbpVO9Iuqi3hCKB5cDrGZDVkp4aIhIV2aSQyyW9MScCkcQqIOfsnCORkc3I31b5VtyFRmg1IQ7dt0ja3icSQ2C2JhAjUU2ykd+dE7tBNp2i2olAJJFuc+nCt564QTadF6IzgUhiVGiqyinKaQjZpJP2ItBXTkPJZhACXeU0pGwGI9BWTkPLZlACBTldG4o5EA6E1dY66edcyNrs8Q36zg1vVaTazNs7iXPgDVJJzYs7VRvHRzaDEohyugJ4CTi84sg/wHWSdnVxsGQ7aQLXS9pZcqpL/6AEplpCU5HE8YpJ9YrXUKQ6baN1+HPaRm1fBqwFQnKGK2ZoPwCvAo8Ai4FnMpPMHMwapHUj8DFwbw3+Dklv9iZgexOwvktSRduxU2VDlErwmyXV+lCbxLbDdndlCT3TX3vV7JgnKfRuSVflfMkSsL0ZuDMz4E/gL+CETN+/wCpJzzaRtn0D8DRwWMbu1/gCcnSm7zFJd1W/jxGwvQx4r2IYnlbuA14GAomQFw8B6YtBKFSnNj2BxEJ3IvB1pdB9CjwQ8yqYhcg/DJxZ8WOZpA/SbzkC24DbEqOfgPMkBRKzmu23gEuSj1sk5SI3Y2J7C3BHMuZz4FxJf6fgto8APgIWJd+3SUrHjr9O294HnJUMWi8pSGqs2V4CvJ88fH0i6eyChKr4KyS9WIO/Ang+6RvDz0XgABCeFEdtkaQv65yy/QVweuwPY0+T9FuNQ8cAXwHHxf7wdHiypN9r7BfEl8GjYv9+SceXJLQ/mSDYTh2Baog3SHq0pYT2STqno4RWSnqhBn8l8FzSN4bfJol/jkn8bXUS228DFyfft0paVyCwFbg9sQkSDEkctueZZju8iO+tJPEYfo7A0piYKd73wP3xnB+20cvjNnphxdmlkj4sEMjhfwY8COyOY0fb6Bkl/K6FLKxS+M1KpDhJY8mvrG5doRwlf66QZfGbjhLh4pEt35kV3iUp/IvTunU8qtTil/7gaHOY2yjpntaez9b5RmBDYewmSXfX2RRvZLYvbThOh+NuqMa9Ww1+yLnXgO2SwkZR24oEens2oYHzBCa00PMSOtQL/f+NwH+Hg8hAnbrYgQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACgklEQVRoQ+3ZPYsTQRjA8eeZZCFlWttAwCIkZOaZJt8hlvkeHrlccuAFT6wEG0FQOeQQLCIWih6chQgKgkkKIyqKCVYip54IWmiQkTmyYhFvd3Zn3yDb7szu/7cv7GaDkPEFM94PK0DSZ9DzDAyHw7uI2HRDlVJX5/N5r9FoHCYdr/fvCRiNRmpJ6AEidoUQ15NG+AH8BgD2n9AHANAmohdJQfwAfgGA4xF4bjabnW21Whob62ILoKNfAsAGEd2PU2ATcNSNiDf0/cE5/xAHxDpgEf0NADaJ6HLUiKgAbvcjpdSGlPJZVJCoAUfdSqkLxWLxTLlc/mkbEgtgET1TSnWklLdtIuIEuN23crlcp16vv7cBSQKgu38AwBYRXQyLSArg3hsjRDxNRE+CQhIF/BN9qVAobFYqle+mkLQAdLd+8K0T0U0TRJoAbvc9fVkJId75gaQRoLv1C2STiPTb7rFLWgE6+g0RncwyYEJEtawCvjDGmpzzp5kD6NfxfD7frtVqB17xen2a7oG3ALBm+oMoFQBEPD+dTvtBfpImDXjIGFvjnD/3c7ksG5MU4HDxWeZa0HB3XhKAXcdxOn5vUi9gnIDXSqm2lHLPK8pkfVyAbSLqm4T5HRs1YB8RO0KIid8g03FRAT4rpbpSyh3TINPxUQB2GGM9zvkn05gg420CJovLZT9ISNA5tgB9ItoOGhFmnh/AcZ/X9xhj65zzV2Eiwsz1A1j2B8dHAOgS0W6YnduY6wkYj8d3lFKn/j66Ea84jtOrVqtfbQSE3YYnYDAY5Eql0hYAnNDv6kKIx2F3anO+J8DmzqLY1goQxVE12ebqDJgcrSjGrs5AFEfVZJt/AF0m+jHzUTtnAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACEElEQVRoQ+2ZXStEQRjH/3/yIXwDdz7J+i7kvdisXCk3SiFJW27kglBcSFFKbqwQSa4krykuKB09Naf2Yndn5jgzc06d53Znd36/mWfeniVyHsw5PwqB0DOonYEoijYBlOpAFwCMkHwLDS/9mwhEDUCfAAyTXA4tYSLwC6CtCegegH6S56FETAR+AHRoACcBTJAUWa+RloBAXwAYIrnt0yBNgZi7qtbHgw8RFwLC/QFglOScawlXAjH3gUqrE1cirgVi7mkAYyS/0xbxJSDcdwAGSa6nKeFTIOZeUyL3aYiEEBDuLwDjJGf+KxFKIOY+BdBL8iipSGiBmHtWbbuftiJZERBuOfgGSK7aSGRJIObeUml1ayKSRQHhlgtkiaTcdltGVgUE+ppkV54FaiS78yrwqlLoOI8Cch2XV548W7WRpTVwA6DP9kGUFYEpAOUkT9LQAvtq1M+0udKkQSgBqSlJWWYxKXj8vRACK+o6bbRIdYI+Ba7U7rKjg7L53JdAhWTZBsy0rWuBXZUuNVMg23auBF7UIl2yBbJt70JAoKV6/WwLk6R9mgKSJlJ1kLTxFmkJyCla8UZd15GJQKvyumyJ8gy8DAEvfZoINPqD41EtUjmUgoaJwAaAnjrKebVI34OSq85NBNqlCAWgE0CV5GEWwI3vQlmCbcSinYFCwPEIFDPgeIC1P1/MgHaIHDf4Aydx2TF7wnKeAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABA0lEQVRoQ+1YwQqCUBAcfWXXsLr2AXWTPXno8yVB8AP6Aa3oHI+kCDqYaawJljSe133uzO44bx0M/HEG/v1gAd9mkAyQgY4I/F8LJUlyrQFtD2AtIkcNoFEU+Z7n7QD4DfFHEVlocrVmgAUAIAOl3mILPcDgEFcUhyrUKMGUUcroc3NQRimj9XJBGaWMvvPydKN0o6/9QTdKN6rZANxj6EbpRulGuZnjYqs8BbyR8Ub2Izeys+u6yyAIDpo/ehzHM2NMDsA0xFsRmWhyfTIDWSXxCEBmrd2EYXjSHJqm6bQoii2AOYBL5Z0xgFxEVppcrQvQJO0zhgX0iXbdWWSADHRE4AZQ731AhEUeNwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAA7klEQVRoQ+2YSwrCQBBEX6HiVvxsPYDewfN7By/gD9ciQkvERQwJdBSiYs0mEDo96aruombEjy/9+P/jAj7NoBkwA28i8H8tFBFRA9oeWEo6ZgCNiDGwAYpn3TpKmmVytWbABQBmoNRbbqEHGB7iiuJYhRol2DJqGX1uDsuoZdRmLuNZSzGWUcuoZdRHSp/IylNgK2ErYSthK3FHwLcSvpXIjoLt9Jfa6TMwl3TIMBkRE2AH9BriL5KGmVyvWIltJXEfKN6tJJ0ym0bECFgDU+Ba+WZQFCdpkcnVuoBM0i5jXECXaNftZQbMwJsI3AAPN3dAQflHegAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC+UlEQVRoQ+1ZS2sTURT+zlDJYE3XSq219QHVuEjnJDT+Bff9Abqw2voAEfGxqygUqWhVFHGl/yMLu9BwByxk5SNI66ML6U7axjhHbmhgWiftncxoOiV3FcI53z3f/e65594zhIQPSnj86BBot4IdBToKRFyBnbeFlFIScVEiuYvIWC6Xe2YK8pcC7SYA4CMzH4mDQBXAqilQBDsLQLfPf9FxnF4i8kwwmypARI+Wl5dvmIBEsUmlUkNE9NaHsVCpVAZGR0d/m+A2JSAid3K53E0TkCg2pVKpz7KseR/GfKVSGYxMAMA0M1+JEpyJb6lUOm5ZVnkrAsVisaunp+esiByr1Wp3R0ZGvmifzZK4XQQWHMc52MgBpdQuAOcAXABwuB400ZTjONdaIjA7O5u2bVsnWU1EujzP+5nP5xdMVjvIJkCBD8x8VCm1G8AYgAkAAxt8Z5j5YmgCSqlTAJ4D2OcD/AXgATNfbYVEAIFPIvKKiE4D6GuCea8xX6gtpJT6DmBvECgRFRzHeROWRAABE4iWCbwHEFhkPM/L5vP5dyaz+23+KwHXdR3P854S0YG1ILSCuthNMfNM2OC1/RYENLY+ygcBnPfht6ZAA6BYLNr6dyqVokKhsGpaNQ2TWJstreXaE2aed133sojcj41AKyvdzCdAgSXLsk4MDw9/a/i4rntbRPxFNZoC/5jAV2be759DKTUJ4FZSFFi0bbs/k8noy2R9dAjEuWU2YgXkQOK3kD6BMsysi2Z9JC2Jdcw/ALzwPO+xvmcl7Rj177JVEbkO4BARjSflFDJJuW1dBxJPoCIiL4noDIB1BS0pW6j+oJmbm+uuVqvjRKQfLr0bZHnIzJf0f6HeAybahrUJqAPruhLlcnnPysqKfpXp11n/Gv62zoHAroS+AafT6QkiGrIsazKbzX7eVIHEt1US39gCkOzWYthkjNE+tuZujDGZQ8XRXn8N4KT5lLFZ6uaYPt+nwyDuvC80YdhvB9uOAu1WoaNAR4GIK/AHvdr+QAexB7EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACfUlEQVRoQ+2ZSYsUQRCFvycK4nJXXEbHBdwO4kn/gv9CD467ICIutxEFkREdFUU86T/xojcPntyQcT2INw+uISFVkD1Wd2dWlU7nUHlqisiX+fJFZGREi8yHMt8/HYG5VrBToFOg4QnMPxcyM2t4KE2nT0i6EwvylwIjQOCFpE1tEPgGfI0FamC3AFgazP8IrJL0KwZzkAI3gLMxIA1ttgCPA4w3wHpJP2NwBxG4KOlcDEgTGzNbA8wEGP57vA0CU5JONtlczFwz2wY8HUbAzBYCB4CtwCVJb33OIAXmioC70LoyBsxsEXAQOApsLIhelnS6FgEzW+5BBvwA/FS+SPJFa40KBZ5L2mxmS4AJ4IjHxCzwaUnHkgmY2V7gLrAyAPwOXJN0qg6DCgIvgQfAPsDjo2pcKddLciEz+wCs6AO6W9KjVBIVBGIgahN4BvRLMjslPYlZPbT53wR2AbeBtcUmXEFPdh5U06mbd/shBBzbr/Jx4FCAX0+BEsDMFocEYrNmFcE+BD4XsXZL0oyZnQCutkagzkn3m1NBwDe/Q9L74MAuFEqUn5op8I8JvJO0elacTALnc1HAH3Njkvwx+WeYWUegTa/pwaqIgexdyIN4uyRPmqULZRXEvulPwD3gpr+zcrtGQxfzRHYG2AAczuUWiom3kc4D2RN4BdwH9gM9CS0XFyoLGu9UuN974eIFVDiuSzruH5LqgRhtU20q8kBPV8LMlhVVmVdnYwX+SMdAZVeieAF7eeltmElJr4cpkH1bJfvGVvatxdR4bMu+teZuWxtKxWncXn8I7EldtQV7vz79fp9KwZp//9CksB8F206BuVahU6BToOEJ/Ab7+KdABdTt8AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAGDElEQVRoQ82ZaahVVRTHf//moKKggQawcmg0olGl0awvRoMVBRGFlQ1YQZIZqRVKmJmFgVk59EFQykYjgmajbJ7n2WiAbKKCBq0Vfznndd723Lvvve/5bMH9cvfaa63/2WuvaYteoIjYHDgEOAAYDOwIbA/4f9PvwHfAt8DbwGvAS5L8f49Ine6OCO89CTgFOBrYqU1Z3wBPAUskPdDm3i72jgBExCXAWGBQp4qTfR8CMyXd0a68tgBExEjgBmCfdhW1yP8eMFHS/S3y0xKAiNgQmA2MaUHwB8DnwNfAbwX/FsDOwG7Ani3I8ElcLOnvHG8WQET0Ax4C9msi7BHgbuAFSXaHhhQRewBDgZOBE5qwvuV1SSuayWsKICIcVZ4Atq4R8mdxKnMkfZT7UnXrEeE7dD7gO7VpDc/PwAhJrzaS3xBAROzrUFcJhVUZjhrjJX3cieHpnogYUNytUTXy/gAOlvROna5aABHhGG5f3qZmk33ztt4wvAbIBcCcBicxSNLKdK0RgNeB/RPmVcBxkp5eF8aXMiPiKODRGpd6XZJduhutBSAipgNX1Bg/tJkv9iao4u4tBzZJ5N4oaXz1v24AImIvwLE4peGSnDX7jCLC2f3JGoV7S3q//D8F8DJwULJpgiQnrz6niLgSmJYofkXSwWsBiIgRwGPNmPscARARDqGp7zu0Orz/l4kjYhlweGLk4Ebhq8oXEc6wGwH/tAhyA2C1JGfsphQRTqBvJkzLJB3ZBaBIKGkGXSqpWab013FWvacooXO21K07256WS4QRsRQ4PhHgsPrxmjsQEZOB6xKGIZJebGZVRDwOHNOJ5ZU9j0s6NqPnUJcpCc9kSVNKAA5ZQyoMn0gamDMsIj4rCrQca7P1zyT1zwmIiE+AKt9yScNUFGuuZaoxd7okR4Ccfzq997S0fleSy5acrjQ//QUMNADXH/cmu0dKcoWZE+r2MKs8I+YdSW5Dc7rcizycMI0ygKuA6ysLjiT9JX3RgtC+BLArYJet5q4JBuBG5aKKsV/ZryWt/p8BcJj2R3VjVNJsA1gEnFH5821JzZqXLtaI6LMTsNIafYsM4L6iOyoNe1FSNSI1PIj1AMCh1CG1pPsNYEkxGin/fFVSWg/VglgPAF4BDqwYs8QAFgDnVP78SJIzbJbWAwBXC9VRzgIDcLVXjfm/AP0kuR/NhbY+uwMR4e7QDf6WFaOmGYBHJbcnlh7USvPSlycQEXYdu1CVxhiARxzPJwsXSarrTbux9TEAh3qH/CqtKSU2Az5NZpsPSTqxBRdy49/SfWki60NJ2WFXTUXqwdmAsphbCJxZUeIGfltJvg8NKSIMfPcc0Mx6tpiLiK2AH4qeoxS3UNJZJYC6emicpJkZAOOAGT0EcLmkmzvQM8oz1BLAxsX8vjqBWynJ86FcJDoLGO4OC8jOMgthnrX696Qkn35Oh+dB21aYfgJ2kLSqqzCKiGuAaxNJkyRNzSlYl+sNmq2pkiZZbxWAJ8g/Aj6NksI+3kplui5AFL2271m1AvVJb1fmqXSsMhGYkhjznqSeNi0d4YsIz3/SCNXNK+omcy5ZPVKv0r2STu3Iig431dRolrRCkvuCLqoD4BlM3Th7nqTzOrSnrW0RcSdQp+tASX4gbAzAK8Ub2KwarQ8Cp0vy20CvU5FUFwN1SfRSSbemSpu9D9wCXFZjpacDoyU925sIIuIw4K5k8lCqmCWpzpbmb2QRMRc4t4GhfiOYJunLngCJiF2Aq4ELG8iZL6mRDflHvohwpnXGrSM/VM8DFkt6rh0gxRd3K3s24BBeRzMkpaP+bnzZR77iTvgLuOR29mxEDnmer7rk9dPT98CvBbNreGdSD8s8WT4i81rpjD5G0vzcR2kJQAHCs5ubgKZjwERhednrHvAa2eaPMFaSm6UstQyglBQRDm92qWwJnNXencGnZpdp67W+bQAVIKOLCz6sTUNTdjdTcyW5N2+bOgZQAeLHQLuV5/UeM6ZZPDXKfa1nqs/4QUXSG21bXdnQYwBV5RHhy2rXcmh0E+5GxOTGyCWwp34fSCovd09sX7P3X2uzPXCoLsVMAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHn0lEQVRoQ81ZbYxcVRl+nnvu7ErSEmtqDdKwO3e2LWJLSEuFNiofFv9AUIpfiSFqCzt31lITGgEjHxKIKVirqXbnzpZSf5BAoHwIhpiAgDVSwBaU1rZLd+7skiIJKCWVpOzOPfc1d3dn986dO3Nn9kvuz3ve87zPc857znnPe4gZ+BZvlzPMed4XDG2sBGWFAGcRXET6ZwTwIsZpgbxL4B0ID/nKf8370Hz1xE08PV33nDKACDOO/roQ15K4TASfbQWLxL9E8AKJvcWs+WQrfcO2UxKQcfSNAn8TwKVTdVzdT/oJbi/aZl+reC0JsArelRDeC8jnW3XUnL0cofC2Ys58ojl7oDkBj4hKv697CXQnA8sxCEsE3hbKh4E9hfMEOBuUNMBzkzAE6Ct9SvXgW9RJtokC0r+VDqb8pyByfgOwZ0g84mv1cqmH/Y2cpntlmUG9BgauEcHVdW3JN6RsXF3axKFGeA0FdBVGVvpi/AnAJ2NAhkHpBU3H7eabSSMV1271yVL63g0C3gigPcbmA/r+umJP28F6+HUFZPLDy4XqVQCjW2HkexJQN7s2j0+FeLRPZqd0idL3Algfg/cRRa8u5toPx/mKFZDJyyKhPgZgQU0nssfNqvxMEK8RktdZoThxM2G0qaUDG/hetC1WgOXo1wG5IGJcNkS+OpBLvTgb5CuYXfnypT75x2hICfh6yVYrEwWknfJ9BH8cJU/fX9MoFmdS1Pja2w+gLYwrkF+U7NTN4X9VM9CxUz6nlD5So5JyeTGbemEmSSZhZQrly0T4fNROa3Xe0A95tPK/SoDleH8DcGF1J97q2ipYYHP+WY6+BZCtEccHXNtcXSPA6iuvg89nGxnPuQIAlqMPAhKJfVnn2qlge588iS3H2wfgS1XxJXpFve0rbNexS9JKwzQIvxmRvsDQCt7QDSwl2ad7h8+nof4Rsdvn2uYlEwKCAwW+jp6gT7u2Wf+kBBCcqjT8RwFZkUQktp18AzS+mXQQWo73NICrqjHU0uAcGl0DlqPvAOSusIFP/+LBbNsrjYhZjvccgK9MiXylk+A5N2de0QijszBykSHGy1XRQd5RzKq7RwVkHG+/ABdPGBADbtZckkTMcjw3mIgku0btArgl28wkYViONxBQndSN/SXbXMvRZM3UQS4zuedS7nOzqVuSQfXh6afW/Kdrq+VJvmLOpxFQLaHleEH+8VgE4ErXNp9JArUcfQiQROeNcXjYtVXiGhq7i+AP1ZsM1tNy9E8A+XmowfdFZQZzHPw4CejMS6dBHYRs6OzirbTyXi+IXIjsiXPeUekX76L3cRJw6Z1ivnWWDgb17BCvXloF7yEIvjP5k4dcWzW6vEyYzmUIje+W0ZB9KFgDjwO4JqTqFdc2J3ekBtMw9wK8YCu9KETpiWAG9kJwbejnQdc2I/lQvIr/g4ADAFaF2OwNZmAPgO9P/pQ3XTu1LCn+60xpM90iNs3tQmP+yv2RUs4eWk55K8Dwnn/Kb1cdgz/gB0ls5nIGzumVBaahgwv+/AleIluZcbxuAQpV+6vvX9jM5WUuBWR6R1aJYQQhFOKPbnY55TU++FL1aDPn2irublplNpcCrILOQaQ3TMCArGXnHvmEGtHFcG2TxFPFrPm15BAqHwPY1HqpjyX9rp1KLHbFZKRv++2qazwb9R4E8N2Qk7IxohYObOapRiLSjlckYCUJbdTeTDLXtUPO9Nv0fwCYIawHXdu8riIgJh/iFtdW2xsKKOgtFNk2HQEQ3uTm1K9a9UPB+qCGOipgVUFSJ0W/W1WBE7zn5sxFSeTSee86EpdT4ImBxFpmgEcfSgglwPMl2wxmv+FnOV5QD1oYMjq5gOozB7MsTyRGVkHfCZGfVe1G4O1FW92T5GA22+MuWwK5p2Snbh8djIrz83bKvI+Ufh9AKrxT+aKsZjLT2RAxdtfWxeoMFJ7frj5dOaeqyioZR98mkLurycgR107N0ntAUuiUj0bL8YxERU1p0Sp4gxB0VEETj7lZ8xuzMcr1MGNytCBehtys2Vkd5hGE8bJeXDl7t2ub18+FiEze2yVEjS+D/qqBbNtrDQUEjWNvYLIjSlaA36sR9e2BzRyeDSHBocph/TCBmkOU4OairX4T9Vv3fcByyr8G+KMaosSAaNlQ6kn9ZSZFWIXyFyH8XbjyUMEXkR2lXKqWS2R11/CxHO9+ABtjiQryMNRWN8u3piOka5cs9rX+KQA7Fod4wM2a8RySBIyGU768TcgtdUieJrEbvjxczKX+2oqQ8REPrrLfAzAvri8h24p2Klrqj+wvTXhNO95GjqXcqp45KUcF3CfAAaEcN+H/25e2/wb2BkfmezAWUrgEgtWEfDnhtVJD0O3mzAeS6CW+UlYArMLwCoj6JYCGZcCIw8pij3vAq8dtH6g3udn2Q0nkg/amBVTA0gXveopsaea9txkCkzZynOC2Vl/rWxYwMSN5b8PoAifWtkY0Yi14CcT9rm0Gd/OWvykLqHjq7Bu5QIm6QkQuAbG85hSPUiKGIDhM8s+a+tnB7ra/t8w61GHaAsLOl+2W+WVdPpfaWCzBE63BM0fbfTlF4KQo/0RKpY71b+To4p6J73/tXyc1fevA3AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHTElEQVRoQ+1Zb4xcVRX/nZl5u2/LrrO0EFKoBYpVaRu3u/e+3WlDZJdIRLQhNLIiEggxqURIjGmqTTAmWiRpjH4wghq+KIQYupYQEvEDmEVdyu7OfbPbzQaEYqtSwTb4Z3aV7s6b9445mzvm7XRm3oy7oanZ82ny5txzz++ec8+/S7jIiS5y/bEG4EJbcJkFpqenryqXy6cbKBUB+AeANIBuAG8AuAzAn06ePOkNDw+H9dZOTU11h2H4EwB7ALwL4FIA7wFw7O9aSxkAE9H9SqnHazGc50LGGFFQlGuW/pbNZq/aunXrYtICY8xmAD8C8HEAnUn8sf9/oLX+SiKAQqFweRRFvwewvgbzmwA+BOAkgEsAZAG85rpubseOHaVmlTHGfBTAYwA6gKU7WCaiOWaWPT9mv1eLO6S1/mYiAGPMddYtUtXMRPRVx3F+FkXRup07d/7FGDMEYExrHTSrfIVvfHx8Uy6XO22MWae1fu/IkSPpbdu2pRcWFmpakYgeVEo92gyAdQCKADI1HZL581rrp4lIfHPV6Pjx45cEQfCvBgL3a62/nwhgZmbm0lKp9OeYf56rMqmc9v4oikb6+/v/uhoIGigvAUGChdBBrfXhRAD5fL6XiCZsZDhHRAeY+VBVlIiYeTQMw725XG5uJSDqKc/M9xDR1wFsF/lEdKdS6ulEABMTExvS6fQMgCsBhPPz825nZ+dnieinANrjApj5mSAI7t61a9fC/+JSDZS/t62t7WgQBH+0IVoA7GsqjDIz+b4vCyXcnSuXy9fmcrkz+Xz+TgB3ENHeqlN43HXdB7dv3x60AqKR8p7nPXHixIn2YrEo7itRipn5057n/SrRAhbA320eEAGbtdbvyvfJycn16XR6BIBEnzg9PD8//63BwcGwGRBJylcEG2MkbEtUFAS3NgVAmI0xkl23Wt/bppR6rSK0UChcGUXRcwBUFYjDWuuDSffBHpBk82XEzPfKyVc+Wlf+HQDJGQLgDs/zjiZawJrudQBXAzirlNpIRMs2nJiY+HA6nRYQH4kJ7NZaS/htSBLlgiB4jJnFJZeoWnn7jYwxDxCRJK/LmXnI87yXEgHEzHs2m81urlce5PP5fiL6BYAPAmhrJZmNjo5murq6ngdwcy3lK0rKYc7Nze1n5gNE9Cml1HgiAGviguu6A0nlge/7N83Nzf12aGionHTy1f+Pjo5KdBuOu00tGZKpmfmHAJ5oygJjY2Nd3d3di0nKt6rwSvjFK6Iocnp7e/+ZaIGVbHSh1q51ZBfq5Cv7rllgzQIrPIGLwoUkqdVLqssASCKbnp6+ure3VyrSRGLmVHWpkbioRYbx8fErHMcZbKofsGMVKRHu01pLc1+XJMGUSqXPEdGTrZQSIlAycVdX1+FSqXRw9+7dUvXWJFE+k8lI53e71vrZphKZMeYPMvvJZDK3SfNea1GsZpoH8EWl1NFmLTE7O9u2sLDwNoANAA65rvtwrcw/NTV1TRiGp2w/8AXP836eCMAWWicAXENEvymXy/sGBgakvP4v1ajnzzDzl7TWzyX1A1KquK4r7hkf2xxQSn2vem2sHwijKLqlv7//xUQAtpyW6YBMJUJm3hNvJBo0I3XL3fim1kVfAHB9/Dsz3+95nkztlsgClYr1BgBRKpW6oa+v75VEAMJgjDkrNbj8jndCzXZSSXfU930l/bRtWyvsC+KKAEYq98kYIzy3W4abtNajiQCsBQTAByzzsNZ6ZLWUrygwOTl5YyqVEgXjriQjzVcdx9nb09Nz1vf9F5j5EzK5Y+ZBz/NeTgRw7Nixjra2NpkLycBW5jK3OY7zUq2hU6NmJMkK8r/v+3uYWXrsZdMOAM86jnN3EAS/BjAgjgDgy1rrHycCsBNkCZ9X2DtwIxGNVS9cqfLWPalQKNzFzN8GcK2dQCxtRUTSxPQx827L+13P876WCMA27W8BOG82Wlm8GsrHZNHIyEhqy5YtvwTwyXqWI6KHlFKPJAKwYVSiULVZl9aupvJxZexIU+J8TRBE9B2l1DcSAdjLKneg1nh9fzabfbRYLG4qlUpvd3R0bCqXy7tOnTr1VKOHjVqb2jC5j4gmwzAM0+l0OgzDVCqVkvGhuO8yYuZHPM97KBGA7/vXM/O0TBpqMMvo+x17waWGkhLgMrGK1vrJpCRWkRcrD+STvCvIXiJLhgNdddzoAa21vCmcR8uKOWPMRgBSPrRSpcpY8T6l1FNJ0UfeBTKZjNyxlqg60cUXL1PUupBsIO9XMkqX96v4mFvcS0Z+Mg86TUTtzCxvCh1E9BmllPxXk+zrzxQRzTBzJxG5zCzuIjJ32DG+WCOuk1hFqoKlfNSMBWSU5zDzFnEPInqLmSWpbZANARzRWr8jQHt6ev4tAuX34uLi+iiKiknjdskzlepzdna2s729PSgWi24YhuszmYxn99sYRdHSGx0RnUmlUqf7+vqO1zuYVlylJbO/X8xrAN6vk15zoQt90v+3FvgPXUePXrKTg9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAFvklEQVRoQ+2ZaaiVVRSGn9fS0iabCNO0eSaosAmplKJRxMiygSQCixQipBKMoDRBon5EI/0pQ8JuRQTVj4omo+FH04/muVum2GCDWVYr3ss+8t3vfud8+3guXi6cBYc7nD2sd6+11/BuMcxFw1x/ugCG2oL9LBAR44HeFkr9B/wMbAOMBT4B9gC+BiZL+rfZ3Ijw+PuB6cA6YFdgAzAy/V41NQB/rpL0QNWAAS4UEVbQm+XKj8B4SX/VTYiIicC9wMnAjnXjC9/fKemaWgARsSfwEbBbxeDPgAOBL4AdgF2AD4ETJP2dq0xEHArcA4yGvjv4D/Br2vOo9P/ycosl3ZQD4IDkFiMqBl8LPASMkfRdREwFVknalKt8Y1xETJDUGxFea0NE2CX9aWbF+ZLuzgEwBlgPbNtEqYuAlZLsl4MmEWGL/t5iwQWS7sgB4Iv1TcE//yyZ1Ke9AOiR9MNgIGihvAOCrWJZKGlZDoCjgTdTZLDy1wGLS1HCkehF4DxJ9t0tlhbKXwbcAByRFp8taWUOgN2B94G9AZ/A9sD5wIPAdqUFngAuBTZuiUu1UH4O8DjwVQrR3nZuVhiNCEcFT3S4swX2k7QmImYDs3zqJRCOzfOBTe2AaKW8pOUR4cPy/tbH9+0cSc/mWMATfkp5wAtMlLQuAXNo7QEcfYqyBLjZFssBUad8IVI5bDsqWs7OAuCREeHselCaeLgkx/o+iQi71lPAsSUQyyQtrLsM6SB8h8oyxydf2Meu/CrgnGGZJcluNUDKpYRN9zEwCVgLjJPUb8OIODiBOKSw2lhJDr8tJSIc5ZzE7JIN6ad8OijrNQ9w8nJynSrppRwAjXhs5e0+lYklIo4DHgP2AUa1k8wiwjnmGeB0YIDyBSv4MB2yHQnPkvRGDgAjfxs4vq48iIhpwCuSXAq0JRHh6HZB0W2qFnCmBu4CludaYCen8zrl29K2w8Hp0o+U9EutBTrca0imdzuyITn2wqZdC3Qt0OEJDAsXcnHXLKmWSwn/PUmSK9JaiYgR5VKjdlKbAyJiL+DU3H7AtIpLhMslublvKinBXAg83E4pkWodZ2J3WO60XPVWSlLend9MSU9mJbKI+DxxPzPcvDdJ8Y2a6TfgCjcguZaIiFHA94ArTnd7S6oyf0TsC3yZ+oFLJD1SCyAVWp8Cnvxy6oRcXm+Winp+DXClK9S6fiAiXKrYPYu0jYu128tzI6LRD7gzPFPS8zkAXAGaHXDF6InTi41Ei2akablbAm8XfQ44rKSMmTezdn2SgLpinQK4nJ8i6fVaAGmyS2nX4JbNnVBuJ1V3RyPCzZD7abetDdmYXNFsRx/PFBEeMzMNmCbJRMIAqWpoDGDnNNIlb89gKV844VMSiKIrmdL8ILEdayPCljotMXeOQq/lADDdZ17IhK1daAbgTqiKdGrajNRZIZ2wSV732GW2w9HGbMcL7kvSJb5a0n05AEzqOnw69hqAT2pVxcSOlE8AbP2LgVvMfiQGorGVm5hjgJPSP26TdH0OADft3wJV3GhjfsfKF1zJILzX08AZLSy3SNLSHACOPnaXslkHXfmiMqnZd5xvBuJWSTfmAHCC8h2ootfdYJshnpASkX+eCKxo9bBRtWkKk3OBt5KrmgO1JUwf2n3LslTSohwAjs/vmmmoGGyGYnW64Da9SwBfdlOBLieyGOtCeeAt/K7gvbyWyQEnuiqZJ8l0zAAph9FxgMuHdqpUx23XTivqoo/fBdIdqxta/r5foit+WQZgF/IlNgFlxfx+VaS57V5O8eaD/Jbmu2Lqw+H3XEn+rlLS6887iTz285ILOruL1zwyrWFrFHWyVXwv+/JRjgVM5Vnp/ZN7GIyTmgsvb/iopNVObJL+8IIpyfnOrK+j2yNidKP6jAiD8CF5Xc+fnA7PXtB4o3Od1SvpvWYH046rtGv2rTK+C2CrHHOLTboW6FqgwxP4Hz4mJ0+J869tAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADd0lEQVRoQ+2Zz2sdVRTHv+fJBDW6anDVXen6wZszYxYBiYgtFGst3VSDunKjpS0GpUlqfjVpsVVs6aaL0or4YxMVFCJZ2ZLdPUP+gq5bQnTxtNAkfTnlhnnlkmQy9yV9780rudt77tzv5/y4v4bQ4Y06XD/2ANodwec/AiJygJnvtdvTWfPnRkBEJAiCN8rl8kMfiPn5+Ve7u7v3rays0Orq6lJfX99/PuN2auMDoAD+BvA2M6/mTWSMOUtE48D6AjHGzN/kjdlNvy+AnWOOmQ/lTSYiEwDOWzsimgrDcCRvzG76GwGw8/zJzO9sN6GInAMwbW1UdSSKoqndCMwb6wNwGsB39Q+p6h/M/C4R2dTa1AoHYBWKyCkA1+pqiWi2Wq0e7e/vf7yRoJAAKcQggMtuJKIoOtoxACnE0/xOi/SXMAxPuhCFjUBdpIjYVWXSEf0TM3/g9BeriDMKdSPEz8z8vrU1xgwT0YXCrEJZy1iSJKOqOub0/8jMA0mSfKKqNwoPkHp7ioiGHIhRIvpHVa93BEBa2JcAfOlALAHo6RgAKzRJkk9V1S6xL7kpV4idOM31taxaIKJHqmpPnMMA9hcOQES2PDJkAT1XAAC+ZebPfWB3auNzmLObVsNRUNUXVHUujuM7OxXnMy4XwOcj29mIyOuq+lapVGrYCelKpkEQ3CyXy4tbzdN0AGPMxr2iYZ+sra3FcRybtgCIiK2BKw2rdgaUSqWoUqlIkQAepFDdAF7cBq5ERI9rtdr1OI7tmE2t6SmUEYFHAEaexYW/1QC2EF+ru5GIvg7D0D2GNJxprQY4o6qv1I/b6SpzOYqiLxpWng5oOQAzXxWRWwA+dkRfYOb1p5hGW6sBJpn5KytSRG4D+KguWFXHoyhy7xdeLC0F2ChSRL4H8OFuINoKYIUbY34gogHH3eeZef1K6tPaDpCm068A3nMEDzHzxY4BUNWSiPxORO6z5aDPPlGICNQ9bYyZIaLjjudzIQoFkKbTbwCO+UI0HcB9J/LdeY0xs0R02IGYYObRrWqiFQCfEZEtSHsfmGZm+4qxbbM/hQD8BeBNa0hEM2EYnmgLgP3lFARBT1dXly4vL//b29tbzQNIU+llAHeJaLFSqRzJes5vegR8xGbZLCwsHKzVav8z8/0sm0ID+MDvAfh4qZk2exFopnd9vv0ELrXBQO7fD10AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC/ElEQVRoQ+2Zy49NQRCHvx+ReK6IlZ34E7CUiCAR4xEbTLCyQRATYswwb2IQZDYWgojHZpCQECts+ResiQwLj0RClNSkb9Lu3HtPz7mZc8+V6eXt6tP1VVV3VdcVbT7U5vozC9BqD/7/HjCzlZLet9rS9fbP9ICZvQPWSfqRAmFmS4ClMHm+JiR9S1mXVyYFwIBXwEZJv7I2MrPjQH8A6JN0OWtNM/OpAL7HS0mbsjYzswGgN8gNS+rJWtPM/HQAfJ9nkrY22tDMTgMjQaZH0nAzCmatTQE4ClyNPvQU2CbJQ2vKKB2Aa2hmR4DrkbbPgQ5Jv6sJSgkQILqA0dgTkjraBiBAxPHtPz2UtDuGKK0HKkqamd8qg5HS9yXtjebLdYjrHNRqiAeS9gQvnQGGSnML1bvGzOwc0BfN35PUaWYHgRulBwjW9ju+O4JwqM/AWFsABIgLwKkIYgJY1jYAAeJQuGIXVIVcKTKxh8WfBin9J+AVpx/eFWUEqFkyNACKp0rhgWYArkg6kQibSyylmPOklQdibijBX+fSLHFRJkDid+qKmdlaYENOI0zeEcBNSZ9qbVIEQHWuyGOTNZLetgrAz8ClPFpHa1ZL8rf5lFGEB2oBfAxQi4D5DeDmAP7mGJPka0oD4LnDr9imH/xFe8AP4vLIjBclxWXItCOtaIBjwOKo3HaFRyWdnLbmYUHhAJKumdkt4ECk9JCkSitmWixFAwxKOjt5uZvdBvZH2vZLit8XSSBFA/yjpJndAfY1A9FSgOCJu0BnBNErqfIkzfRCywECxCNgR6Rtt6TzmdqHBmyKXG4ZM4sTWc04NzNPWE+AuG3ZlZInSuGBinXMbBzYGVkrE6JUACGcHgPbUyGKAIj7REmZ18y897o5ghiQ5E/bltRChwE/kF7Xj0jyLkbDYWbzgBfA+iA4LmlXqwD8LydvszjAF0lfswBCKC0E3gBeP22p186f8RBKUbaejJmtAr5L+lBPptQAKfCzAClWmkmZWQ/MpHVTvv0X9iFAQGQyevIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACrUlEQVRoQ+2ZPYgTURCAZzbBXJnCeL2Cnb87b9MEtPBUrrMQFAtrtT5/ClGs9LBWWz0RtbBUFCF4oJDsbO68wsLA2YqQSmLlvpEHu7IuMdlLcus+yUKKhJfZ+ebnvZl5CJY/aLn+MAP41x7M1QPMfFtr/crzvHfTAs8FoNPp1LTWzwHgqIg0lFLvrQHwfX8BER8DwC6jNCIecF13wwoA3/dvIuKNpLJa60Oe560XGoCZd4rICiKeTCtaeABmPg4AJmRqg6xcaABmvg4At4aFRyEBhoVM4UMoCplHADCfJTEL5YEsIVNID5iQAYCHALCYxeq5b6PMfF5EBAAEESthGK7W6/XPRpFWq7W3VCqtZg2ZcT3g+/6i4zjzIlLSWn/yPO/DIGMNLCWY2Sj/+xGRK0qpZfNDEASnROTFVi0fr8+aA8z8Ld6KEfGt67oLYwMAwEUium8EREn7OgeAjwCwPyo/nrque3YSgAtE9GDaAM1mc65arc4Zuf1+P2w0Gt9jJZl5DQAORt+fENG5wgEw8zUAMB/zbBBRwyqAIAjuiMjlSOlNItpjFUCqWl0josMzgChR/9hGAWBbknjmAdPhDdqa0gfZzAMJKyVP4v8hhJYRcSni+0JEu63ahZj5anyQici6UuqIVQDdbrfS6/UqRulyufyTiH5sF8AlIro37VpoWEHIzGZ2tM+sEZFnSqkzk9RCS0R01wjIsZz+mug53hDRia0AnI4bGgDYISItz/M2jYC8Gpp2u30MEWuO4zha665Sqp0ZYFStX/iWchRAItFGzoHSsrJ2ZFl1mHg6bfVYJeGJv85CC++BpIJZ5kSFC6G0ha0e7mYJqcJ7IOkRay84UhD2XjHFIFZf8iW9YcYoYRi+tO6aNeupOs66iU/icV46zf/MAKZpzXFk/QL+JG1PUPhRiQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACSElEQVRoQ+2Zu4sUQRCHf5+C+gf4yBXMfMYHGvjCzEBQDIzV+HwEohipGKupD0QNDE8UEwUFTe68wEDhTMVUMFJ+0tArzbjs9u3Ojt0wBR0M9MzUV1XdXVWNKhcq1189wP/2YKcesH1d0nPgdVvgnQDY3iTpqaT9kuaAt9UA2D4o6aGkzVHpXcByFQC2r0q60lB2D7BUNIDtjZIeSDoyRNGyAWwfiiET4n6YlAtg+7Kka2PCozyAMSHT5CkLIIbMfUlbMhdmOQCZIVOeB2LI3JN0NNPq6bTZe8D2aUmOY72kN8DnoIXt7eF5FSEzkQdsB+OEsFwr6RPwbpixhqYStoPyqVwAbkaAY5KeTWD5wStZHrD9XdJgK34FhBP9H8kFOAvciQBhn3/RAcBHSTvjfx4DJ6cBOAPcbRvA9gZJYQT5DfwYKGl7UdLu+PwIOFUiwCVJYQRZBuZqA7gh6XxUegXYVhtAmq0uAnt7gLhQm9vorBZx74Hcc6D3QLKH/z2JGyVnlYs4pCfzEe4rsLW2XehicpAtAftqAwiZbhhBfgE/ZwVwDrjddi40KiG0HXpHO+KcJ8CJaXKheeBWBOgqnf6W1BwvgcOrATieFDTrJL0HViJAVwXNgVgPrJH0BfiQDTDKtREiNK7KLSnHASQLLacP1PxcVkWWq8PU3emq2yqJJ0b1Qsv2QKpdZp+orBBqmrfq5m5mSJXtgUZI1XnB0YCo94opCal6L/ka3ghtlIXqrllzT9VJ5k19Ek/y0zbf6QHatOYk3/oDujC8QMWgjf4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAKYklEQVRoQ+1Z+3NV1Rld397nXJIbIGBARTQgohGNQZJLEtFSMmpfan10aJ1OZzqd/jOd/g3t9AetD2KLCiigNFUgj/tIQoh1SqBRwVqNYgp53XvP2V9nped0Lpebl/LQmZ4ZZpjkZJ+99voe61tb8C1/5Fu+f/wfwPVm8DIG+vv7H1bVWufcp9baUefcWCqVKi5lo11dXV5NTc06EblPRNoAtABYqapD1tq9zrmelpaWaRHRpaxb6d3LAGSz2d+IyAbn3FljTG+xWEy3t7efW+yHuru7q621t3med7+qPgigGcCdAPIAuowxzyUSiaONjY2Fxa4533uVABwEsA3ARQDHAez1fb9769atn823kKrKyZMnVxUKhdtFJKWq3wWQAnAzgBoAH6vqQWvtH8nAUlmd69uXAcjlci+q6sMA1gL4BMB+Vd2fSCR6K4HYs2eP3bRp0zJjDN/f7Jzjphk2PPkN0YcDACOqekhVO5PJZPZqMvBLAI8BeATAagBnARwRkT97ntdXDmJ4eHj59PT0emPMVufcA9y8iNwBoA6AjQCEAE5dEwDpdPo2EXlQRJ4G8B0A6yImDqjqvnImstnsOlVtFZHvA9gJ4C4AfhnlLAJnABxW1T3V1dWZq8aAqppMJrM+AvE4gB8CuKGUCd/3jzU1NX3JuB8cHNwchuGjBKyq7QCWV4jXawcg/ng6nb7ZWrtTVX8C4CEAtxCEiLzBZAzD8ERNTc1YoVBY6ZxjtXkyYoDvxaETL3ftAfDLvb29t1prufnHohBZQxCqmmVJVNVjQRB8VF1dXeece0hVfxAlcD1wSZe/dgCy2Wy97/sz1topAIWpqambRKTDGPOsqu4AUAvgPICMiBxU1SMzMzMfJJPJG1SVYB+P6n8pE6xCpxebA8PDw4mJiYkqHqLnedPzldxKZfRXqvqliJwtFosjXEBVG0Xkp9wcgMYoLr4EMAjgDRE5PD09PVpTU1MXhiHrP6sY8+G2kjIaJ/HLCyXxiRMnbiwWi7cqk0zkbCqV+nzRfSCbzXay6ojISQDHVq5c+Y+JiYl1zrmnnHNPiwjre5yoFwAwnN6MQfi+v8bzvF0EoaqsYgw7wyokIm86515aCEAul9vinNtujHFBEKTb2tpOLQXApwA+EJHjzrnX8/l8jicbBAE3z4S+P+qs8ZrjERMHABxiOFVVVd2oqruMMT9WVTY2gjgXFYCXAfTNFxa5XI7sMRT57Nu+fXt6KQAosNj2uwB0iki3tXZ1GIbPAOA/hlCybMF/A8gxnBjnQRB86Ps+QbAZMrG3RlqIDfGlCxcu9OzatcsNDg5S4NWqqm+tpbgbb2pqmh4YGHjIOfczfoPvt7S0HF0qgDEROaKqPK1jUeKyzj8jIk1lDJQzsb8ExHrn3E4RmZUmqsqceWV0dLS3oaGhKp/P3yMid3N9Y8xnVKuFQoHgm0WEADwRefGrAPhYRP5CBoIg6BaRWmstw4EMUOhValYEEjNxwDl3yPf9j4MguMkYs9M5x80yPA9fvHhxqKamZo21ltKd+ULBNyoiB/L5fMbzvDuMMVQCy5xzf2ptbe1eKgPUP7MACoVCj+d5q4wxTwCIc2DFPMqUOdEP4HWWWM/zzhWLRXb2LSISOOeGkskkf7YhyitulKLvfRF5XkQOOeduFpEnVLVaRF5taWnpXSqAD6NG1VksFnuXCIDfIog0O7Yx5kgYhp8ZYyipYa39Ynx8fKa2trbBOccDeRbA7QCGVfX3IkLgdSLCUsxcey2VSvVdawD8XtwnWJ2YR2dqa2svnjt3jsrUiwAwJH8OYBMBAPgdN/xNAVCaE2855w4mk8m/UYVGM8RG6iwRoXznxDYLwDm3T0TWiAibZlJEXrseIVTKeJwTrzKcEonEaYIYGhpanc/nycCvRaRRVf8uIn+IBiiG0DcGAMF8QW3IzYVheKitrW2UP0yn048YY34BoDV655UwDF83xqyKc4A5cb0ZiNn4XFXfBfCC53lHtm3bNp7NZjm5dQCgHE+q6lFjzEHn3IqIgerrmcSVCgfdjTe5Kd/3M9PT0zO+76+PbBdK8DOq2kPpEZXRqq+aAx+xjLIPhGHYW9LIWPYoC+brA/O0CLhosnuHGkdV+4wxDC+OpRxlLyQSidGZmZnN1tonnXMJ+kjNzc0EVfGpZKtQC/2LjYzzK0VdJCWeiqrGffN04rm+w3mAQ00imtZo0bxFJpxzRycnJ8fr6uqqwzBU3/enpqamUiKyW0SoYjtTqRTL8JIA0E75K4A9xpjjFFwAqIXIAAGUi7n5Tp2/m4yaG4f9G6OXeUizboeI9J4+ffrT3bt3kyFkMpkHjDEssRKG4StLlRKcxCglqAD3MoRokVhr2fJ3A6CYK3cdFgLAuYGHwpLqAWDcU/9QwB02xuwLw/Dd1tZWgmJ1utcY8wgNBpbelpaWoaUwMCAiH3Hudc4dcc4Ne55H04oDCk+ldKBZaOPx78kAxdowLUsRIQBWn1nLRkTeJtu+7x+n28GJrFAo3Gmttc65kVQqRfCLC6FMJvPbSDWeofCanJz854oVK2hwcd79UVTyKL4Yz4t9ZiJfiALxqIgkVPVRAN8r8Z32s+aLSF8ikaCqTUxOTi6bmpqa7Ojo4N8vDkB/fz/dNYbRuLX2cw4YuVyuyhhzZxiG7SLCmZdT2UYArNOLeWjkciamOfaqqn5ijGmKGOXAE7sdbxtj9pY6gP8di+d2sS+rQl1dXVVr1651Y2NjrqOjg9UDXKSnp2d1IpHgpptVdbuI0DKnilwVzbzzAZm1VTgTR0NSfxAEN/i+z1mA1S2eCRgqByImepubm8cWOp1F39Awod57771ksVjkgH+3qpIpzrtbANy0QGLPAqC85ogYy2P6Tr7vP6iqnDViB5DNjjlBWdHb1tbGPjHns2gA8QpUkhs3blxrjOHGyQJ1zD2RhcIGV2nNS4ytVCrVIyKzJTM2zyIvlt4qq9MsE5W82HIkSwYQh1Qul1sJoF5EtkbOA9mgLGbFKl/3EgATExN9peHZ19e3ng5gpH8uYWIuVzwG8pUAxH+czWbpJqwPw/DeyMjaDoD/Z7MqrVIEMOvMOef2VLofKGMidsU5Qx+iig2CoGf58uXjjY2NE6UsfC0AXIgh1dDQQEeOecEEZ25QL3HKihveggCYY319fbdUYIJ9gobYc6p6prW1lU32f8/XBhCvxAGF10uqui262GNusGpRhvDhnM24fkFE0nMZW2TC8zzmAjs/c4ylukdVOa29H88SVySEyhMqm81yBKSpu4VMiMgOVaX0YCOcva4yxjw/3x0ZmcjlcrxnI5Ps+mtUdYTgwzD8sLwqXTEGSqtUfX09PR/aKIxldvAGOt0A3nHOvRwEwfEdO3ZMz1UbR0ZGlp0/f/4WEam31vL+4by19hQ7dPnNzhUHEG9qYGBgVRAEd0UNj2YYWThjjHmrUChk2tvbKfDmfHjX7Pt+te/7nAnYUKcqhd1VA8Dkrq+vXxcxQdnAewbOAb1BEAwtBCAq16azs3N2j5TalSTFVQMw3+leyd996wH8BxA4v3x6wGifAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHsUlEQVRoQ+2Z969VVRCFv7H33nvvvfcSe2+xxJgY4z9j/Bs0/mABFQXBhl1sgNjQSCyoiL2BDaxs873MJsfDuZd7gfeQxJ3cvAfv3HP22rNmzZo5wRq+Yg3fP/8DWN0RXCYCpZSzgM2Br4GPgW8j4s9hNlpKWQfYETgUOB44GtgMmA1MBF4BFkdEGea+Xdd2AbgF2B2YD0wHZkbEZ4M+qJSyIbArcARwMnAUsC/wO/AscCfwQkT8Meg9+13XBeBx4EjgZ+ClPLGXI+KbfjcqpXivLYA9gWOA0/PnDsDGwOeA977bCAwb1V7P7gIwDpBG2wJfAg/nZ3oXiFLK2sD6ef0+uWlp48kbSddfwAfAVOB+YNZoRuBG4CLgbGDLpNLTwIPAjDaIUsomwM7A4cCJyfm9ga0Bwbn+Bt4fKwDyV+5eAZyayWgkHgGmmBdNEKUUk/U44DzgNGA/YN1WyBWBucATwH3Aq6MZgbXyRAVxMXABsFUrEi9GxILkvbQ5JwGfABiR9ho7APXJpRSTzxO9CjgF2ClBPJrJ+JYSm/Io2Mvyeq+r1Km3G3sAPrmUsktu3pyQItskiFkpiS8CnybfBXl+5sBu8K8qP3YASik+/DdgEaBWbw+cCVwHnJRF7gd5nJEwwT9JmglC2hmRZiRUoQ8HzYFSynrABhk+C17PQtolozcBC/Kklb7FwCHANbk5f3d5zZuAlDI5rdoqj/pvxMwHBaHKaE3ie5eXxKWU7QCjb6WeHxHfDVMH1GlV521AinyUSnR5Jqr6XhP1JzUdeKwBQpqdkSBUMf+tMAjA68YPAOBA4FhgSToBJbhzdUVADyQlrMKTgdfyZJVVE1qLYGWta2FGQpm1UPldT1AQl2ZhE4R2xGgZAetJT1qUUoyeVDQCUyJi5jAA/JJlX99iNF7OgnYl4EcKbdS64Y8JtNJpXoKwGJrYFjm9kPliBDRznq4GT+No3ZCqHoY/zaVr8xnjI+KFYQEojz7M05JGPsQICOCwVgTakdB6mBOCsEIrxdWamDMT0iSapAcBB+T99Vq6Vb8nTQWgqx23IgCMwDONCAhAOghAo9dVrARSI1Hp5H1UMUG4WekpODcqrQQm1aw5ioDfU920Ih6YHuuBiJAFA+fASOY3ABhuXeYljRzYtNcNkwavZ/4YRblvJExM5dTN+38aPTfpx9/nAHdlHgnI52nNJ0WEtn4oAIax5oBfHgaAD5LLJp72WRDSoyb+91ln9s8Dsb5owd8Bbk/gyrFSbK49FBEzxhpAs05IC/NIGbXH0JnKbQFIyeuBvRLAbW44VW+1A2jmxJMZjXd1odlD7JER0L7bsRkBAeh4zQ9ltEZgzCnUjLh0MicmJZ0+TBD2Gkbg5pTm94A7snmSQv8ZAIKR956iEjs1IlQczaJ14obsJ7xGibV4mnOVQpNXRxJ35Zx+Zhpwj5GIiIWlFOVSo6j5ky4WLBNflTMCqtBqS+IuEMqnfshEVe91vUqsYxddsImubJsDyqjFTgBD54AevymjtZDphbQF/epAnxIxYh+sMc9nsiqPUse2VOeqOZRednk2SNrqiREhqKHqwFdZyOxfNXUC0I0KwGFVr0rc6zkWMM2bG7Jbsy6oTEZC2pjo0sUiah/iWObqdLH3R4QyPBQA7fRz2YBXANWNCqBt5vqdun/7NTepadOpujykOu2QItoMI+RyuuFh6ZYnDGslPAHD7Mk4BvTmypoAPBXNXHvqsDwAUsND8aQtYvJeu2Ak9EZq/7SIEJTqdHCOdewjTHjtx8AReCP7XBsVT8gC45BLWfNUmg3N8jZe/24E5Lb38nAEoPrIfYE9VaOd0w6jZHGTbh9EhNcMDODWDKeKIPIvsh/Qo1+Ykqf5ks+DLtXG++lwjazfdRRzbgOENcIaYGLrar1GN/prRPj9gQHIP2lkuNVuGwzlzBOxU7LntSvTCph4gyyHAwLQF1mRPVGpaERteOq0w0hI26UTQGdP/abYXS2lmzWZlkSE6iEnvc7S76alkP2q2q2LtGrK1X6rjlWsATZJWguHZfYCqlvtCeoE0Eg4AbSx6rsGfkNTSnGTqo+8tYsyUsqdPt+mpV9iVwBWWVvEEXuccyersEWrTgAtdkZipHOLCOtEzzUwgHqHdJImtRs3Cs5F7bYsRBa4rnu2B1uO10ckszE8U+Xs3FSnnrPYNpKhATQoZUNu+bcyGwk/5ong2vdtA5DjTXqqSnUo1o5E51S8AlkhAI1oSBsfrm6b4OaGvyuDTZUSQHMyt8z7gVYk6lTc4uaoRoXSTiyMiF+aUVgpABkNtdpCZ16Y4OaGUbHLqnkxCABzzHFkOxLSyeT31dTciLCOLF0rDaARDVVKVXJq4Rsac0PV0ke57LOVUe207906B1sZCXPBnDDHlGpP325tTu0lVgmF2glVSlGlPEUT3Eg4DFbvBVdfVzl56PmOLNXOg/D7RtQa4YxW8PPaqrTKItBSKR8qCLksJWzgLWbaaOvASxFhgexcpRQrsAehSCgWTsOdj/7YfrOzygE0gFjgfN0kDaSVUbAaa6N9xaTB67nyXbP0UQxUrEVdtBtNACa3Rc9ISCOLne5Tdzt7eQBSIEzsukedwTIvxkcNQL/TXZV/W+MB/AMANfVPjBGemwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-text{font-size:14px;width:30px}.jessibuca-container .jessibuca-speed{font-size:14px;color:#fff}.jessibuca-container .jessibuca-quality-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px}.jessibuca-container .jessibuca-quality-menu-list.jessibuca-quality-menu-shown{visibility:visible;opacity:1}.jessibuca-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jessibuca-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jessibuca-container .jessibuca-quality-menu{padding:8px 0}.jessibuca-container .jessibuca-quality-menu-item{display:block;height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jessibuca-container .jessibuca-quality-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-quality-menu-item:focus{outline:none}.jessibuca-container .jessibuca-quality-menu-item.jessibuca-quality-menu-item-active{color:#2298fc}.jessibuca-container .jessibuca-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-wrap.jessibuca-volume-panel-wrap-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jessibuca-container .jessibuca-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:before{bottom:-54px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-volume-panel-handle:after,.jessibuca-container .jessibuca-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-controls{width:100vh}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading{flex-direction:row}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading-text{transform:rotate(270deg)}');class it{constructor(e){var t;this.player=e,((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jessibuca-controls-show-auto-hide"):e.$container.classList.add("jessibuca-controls-show");const i=e._opt,o=i.operateBtns;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n ${$e.loading}\n ${i.loadingText?`
${i.loadingText}
`:""}\n
\n ${i.hasControl&&o.play?'
':""}\n ${i.hasControl?`\n
\n
\n
00:00:01
\n
${$e.recordStop}
\n
\n `:""}\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
\n ${o.audio?`\n
\n ${$e.audio}\n ${$e.mute}\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${o.play?`
${$e.play}
${$e.pause}
`:""}\n ${o.screenshot?`
${$e.screenshot}
`:""}\n ${o.record?`
${$e.record}
${$e.recordStop}
`:""}\n ${o.fullscreen?`
${$e.fullscreen}
${$e.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jessibuca-play")}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jessibuca-record")}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jessibuca-speed")})})(e,this),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls.getBoundingClientRect()}),et(e,this),((e,t)=>{const{events:{proxy:i},debug:o}=e;function r(e){const{bottom:i,height:o}=t.$volumePanel.getBoundingClientRect(),{height:r}=t.$volumeHandle.getBoundingClientRect();return pe(i-e.y-r/2,0,o-r/2)/(o-r)}if(i(window,["click","contextmenu"],(i=>{i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1})),i(window,"orientationchange",(()=>{setTimeout((()=>{e.resize()}),300)})),i(t.$controls,"click",(e=>{e.stopPropagation()})),i(t.$pause,"click",(t=>{e.pause()})),i(t.$play,"click",(t=>{e.play(),e.resumeAudioAfterPause()})),i(t.$playBig,"click",(t=>{e.play(),e.resumeAudioAfterPause()})),i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jessibuca-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jessibuca-volume-panel-wrap-show")})),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),me(t.$volumeOn,"display","none"),me(t.$volumeOff,"display","block");const o=e.volume;e.volume=0,e._lastVolume=o})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),me(t.$volumeOn,"display","block"),me(t.$volumeOff,"display","none"),e.volume=e.lastVolume||.5})),i(t.$screenshot,"click",(t=>{t.stopPropagation(),e.video.screenshot()})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=r(t)})),i(t.$volumeHandle,"mousedown",(()=>{t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=r(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)})),i(t.$record,"click",(t=>{t.stopPropagation(),e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),e.recording=!1})),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),e.recording=!1})),i(t.$fullscreen,"click",(t=>{t.stopPropagation(),e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),e.fullscreen=!1})),e._opt.hasControl&&e._opt.controlAutoHide){i(e.$container,"mouseover",(()=>{e.fullscreen||(me(t.$controls,"display","block"),r())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(me(t.$controls,"display","block"),r()))})),i(e.$container,"mouseout",(()=>{s(),me(t.$controls,"display","none")}));let o=null;const r=()=>{s(),o=setTimeout((()=>{me(t.$controls,"display","none")}),5e3)},s=()=>{o&&(clearTimeout(o),o=null)}}})(e,this),e._opt.hotKey&&((e,t)=>{const{events:{proxy:i}}=e,o={};function r(e,t){o[e]?o[e].push(t):o[e]=[t]}r(te,(()=>{e.fullscreen&&(e.fullscreen=!1)})),r(ie,(()=>{e.volume+=.05})),r(oe,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=o[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.player.debug.log("Control","init")}destroy(){this.$poster&&this.player.$container.removeChild(this.$poster),this.$loading&&this.player.$container.removeChild(this.$loading),this.$controls&&this.player.$container.removeChild(this.$controls),this.$recording&&this.player.$container.removeChild(this.$recording),this.$playBig&&this.player.$container.removeChild(this.$playBig),this.player.debug.log("control","destroy")}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,o=t/i,r=e.video.$videoElement.width/e.video.$videoElement.height;if(o>r){const o=(t-i*r)/2;e.$container.style.padding=`0 ${o}px`}else{const o=(i-t/r)/2;e.$container.style.padding=`${o}px 0`}}}tt(".jessibuca-container{position:relative;display:block;width:100%;height:100%;overflow:hidden}.jessibuca-container.jessibuca-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}");class ot{static init(){ot.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};for(let e in ot.types)ot.types.hasOwnProperty(e)&&(ot.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=ot.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,o=Array.prototype.slice.call(arguments,1),r=o.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return ot.box(ot.types.trak,ot.tkhd(e),ot.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,o=e.presentWidth,r=e.presentHeight;return ot.box(ot.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,o>>>8&255,255&o,0,0,r>>>8&255,255&r,0,0]))}static mdia(e){return ot.box(ot.types.mdia,ot.mdhd(e),ot.hdlr(e),ot.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return ot.box(ot.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?ot.constants.HDLR_AUDIO:ot.constants.HDLR_VIDEO,ot.box(ot.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?ot.box(ot.types.smhd,ot.constants.SMHD):ot.box(ot.types.vmhd,ot.constants.VMHD),ot.box(ot.types.minf,t,ot.dinf(),ot.stbl(e))}static dinf(){return ot.box(ot.types.dinf,ot.box(ot.types.dref,ot.constants.DREF))}static stbl(e){return ot.box(ot.types.stbl,ot.stsd(e),ot.box(ot.types.stts,ot.constants.STTS),ot.box(ot.types.stsc,ot.constants.STSC),ot.box(ot.types.stsz,ot.constants.STSZ),ot.box(ot.types.stco,ot.constants.STCO))}static stsd(e){return"audio"===e.type?ot.box(ot.types.stsd,ot.constants.STSD_PREFIX,ot.mp4a(e)):"avc"===e.videoType?ot.box(ot.types.stsd,ot.constants.STSD_PREFIX,ot.avc1(e)):ot.box(ot.types.stsd,ot.constants.STSD_PREFIX,ot.hvc1(e))}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return ot.box(ot.types.mp4a,o,ot.esds(e))}static esds(e){let t=e.config||[],i=t.length,o=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return ot.box(ot.types.esds,o)}static avc1(e){let t=e.avcc;const i=e.codecWidth,o=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,o>>>8&255,255&o,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ot.box(ot.types.avc1,r,ot.box(ot.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,o=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,o>>>8&255,255&o,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ot.box(ot.types.hvc1,r,ot.box(ot.types.hvcC,t))}static mvex(e){return ot.box(ot.types.mvex,ot.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return ot.box(ot.types.trex,i)}static moof(e,t){return ot.box(ot.types.moof,ot.mfhd(e.sequenceNumber),ot.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return ot.box(ot.types.mfhd,t)}static traf(e,t){let i=e.id,o=ot.box(ot.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=ot.box(ot.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=ot.sdtp(e),a=ot.trun(e,s.byteLength+16+16+8+16+8+8);return ot.box(ot.types.traf,o,r,a,s)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,ot.box(ot.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let o=e.duration,r=e.size,s=e.flags,a=e.cts;return i.set([o>>>24&255,o>>>16&255,o>>>8&255,255&o,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),ot.box(ot.types.trun,i)}static mdat(e){return ot.box(ot.types.mdat,e)}}ot.init();class rt extends Be{constructor(e){super(),this.player=e,this.isAvc=!0,this.mediaSource=new window.MediaSource,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.cacheTrack={},this.timeInit=!1,this.sequenceNumber=0,this.mediaSourceOpen=!1,this.dropping=!1,this.firstRenderTime=null,this.mediaSourceAppendBufferError=!1,this.mediaSourceAppendBufferFull=!1,this.isDecodeFirstIIframe=!1,this.player.video.$videoElement.src=window.URL.createObjectURL(this.mediaSource);const{debug:t,events:{proxy:i}}=e;i(this.mediaSource,"sourceopen",(()=>{this.mediaSourceOpen=!0,this.player.emit(x.mseSourceOpen)})),i(this.mediaSource,"sourceclose",(()=>{this.player.emit(x.mseSourceClose)})),e.debug.log("MediaSource","init")}destroy(){this.stop(),this.mediaSource=null,this.mediaSourceOpen=!1,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.sequenceNumber=0,this.cacheTrack=null,this.timeInit=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAppendBufferFull=!1,this.isDecodeFirstIIframe=!1,this.off(),this.player.debug.log("MediaSource","destroy")}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===_}get isStateClosed(){return this.state===$}get isStateEnded(){return this.state===K}get duration(){return this.mediaSource&&this.mediaSource.duration}set duration(e){this.mediaSource.duration=e}decodeVideo(e,t,i,o){const r=this.player;if(r)if(this.hasInit){if(i&&0===e[1]){let t=Ze(e.slice(5));const i=this.player.video.videoInfo;t.codecWidth===i.width&&t.codecHeight===i.height||(this.player.debug.warn("MediaSource",`width or height is update, width ${i.width}-> ${t.codecWidth}, height ${i.height}-> ${t.codecHeight}`),this.isInitInfo=!1,this.player.video.init=!1)}if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){null===this.firstRenderTime&&(this.firstRenderTime=t);const r=t-this.firstRenderTime;this._decodeVideo(e,r,i,o)}else this.player.debug.warn("MediaSource","decodeVideo isDecodeFirstIIframe false")}else if(i&&0===e[1]){const o=15&e[0];if(r.video.updateVideoInfo({encTypeCode:o}),o===Q)return void this.emit(j.mediaSourceH265NotSupport);r._times.decodeStart||(r._times.decodeStart=he()),this._decodeConfigurationRecord(e,t,i,o),this.hasInit=!0}}_decodeConfigurationRecord(e,t,i,o){let r=e.slice(5),s={};s=Ze(r);const a={id:1,type:"video",timescale:1e3,duration:0,avcc:r,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},n=ot.generateInitSegment(a);this.isAvc=!0,this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack=null,this.timeInit=!1}_decodeVideo(e,t,i,o){const r=this.player;let s=e.slice(5),a=s.byteLength;const n=r.video.$videoElement,A=r._opt.videoBufferDelay;if(n.buffered.length>1&&(this.removeBuffer(n.buffered.start(0),n.buffered.end(0)),this.timeInit=!1),this.dropping&&t-this.cacheTrack.dts>A)this.dropping=!1,this.cacheTrack={};else if(this.cacheTrack&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(ot.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts;let o=ot.moof(this.cacheTrack,this.cacheTrack.dts),s=new Uint8Array(o.byteLength+i.byteLength);s.set(o,0),s.set(i,o.byteLength),this.appendBuffer(s.buffer),r.handleRender(),r.updateStats({fps:!0,ts:t,buf:r.demux&&r.demux.delay||0}),r._times.videoStart||(r._times.videoStart=he(),r.handlePlayToRenderTimes())}else r.debug.log("MediaSource","timeInit set false , cacheTrack = {}"),this.timeInit=!1,this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=1,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=a,this.cacheTrack.dts=t,this.cacheTrack.cts=o,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=s,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},this.timeInit||1!==n.buffered.length||(r.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,n.currentTime=n.buffered.end(0)),!this.isInitInfo&&n.videoWidth>0&&n.videoHeight>0&&(r.debug.log("MediaSource",`updateVideoInfo: ${n.videoWidth},${n.videoHeight}`),r.video.updateVideoInfo({width:n.videoWidth,height:n.videoHeight}),r.video.initCanvasViewSize(),this.isInitInfo=!0)}appendBuffer(e){const{debug:t,events:{proxy:i}}=this.player;if(null===this.sourceBuffer&&(this.sourceBuffer=this.mediaSource.addSourceBuffer(Z),i(this.sourceBuffer,"error",(e=>{this.player.emit(x.mseSourceBufferError,e)}))),this.mediaSourceAppendBufferError)t.error("MediaSource","this.mediaSourceAppendBufferError is true");else if(this.mediaSourceAppendBufferFull)t.error("MediaSource","this.mediaSourceAppendBufferFull is true");else if(!1===this.sourceBuffer.updating&&this.isStateOpen)try{this.sourceBuffer.appendBuffer(e)}catch(e){t.warn("MediaSource","this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.emit(j.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.emit(j.mediaSourceAppendBufferError)):(t.error("MediaSource","appendBuffer error",e),this.player.emit(x.mseSourceBufferError,e))}else this.isStateClosed?this.player.emit(j.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed"):this.isStateEnded?this.player.emit(j.mseSourceBufferError,"mediaSource is closed"):!0===this.sourceBuffer.updating&&this.player.emit(x.mseSourceBufferBusy)}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}dropSourceBuffer(e){const t=this.player.video.$videoElement;this.dropping=e,t.buffered.length>0&&t.buffered.end(0)-t.currentTime>1&&(this.player.debug.warn("MediaSource","dropSourceBuffer",`$video.buffered.end(0) is ${t.buffered.end(0)} - $video.currentTime ${t.currentTime}`),t.currentTime=t.buffered.end(0))}removeBuffer(e,t){if(this.isStateOpen&&!1===this.sourceBuffer.updating)try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn("MediaSource","removeBuffer() error",e)}else this.player.debug.warn("MediaSource","removeBuffer() this.isStateOpen is",this.isStateOpen,"this.sourceBuffer.updating",this.sourceBuffer.updating)}endOfStream(){if(this.isStateOpen)try{this.mediaSource.endOfStream()}catch(e){this.player.debug.warn("MediaSource","endOfStream() error",e)}}abortSourceBuffer(){this.isStateOpen&&this.sourceBuffer&&(this.sourceBuffer.abort(),this.sourceBuffer=null)}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource&&this.sourceBuffer)try{this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.warn("MediaSource","removeSourceBuffer() error",e)}}}const st=()=>"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,at=()=>"wakeLock"in navigator;class nt{constructor(e){if(this.player=e,this.enabled=!1,at()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else st()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,i){var o=document.createElement("source");o.src=i,o.type=`video/${t}`,e.appendChild(o)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(at())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.error("wakeLock",`${t.name}, ${t.message}`),t}));if(st())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();return this.noSleepVideo.play().then((e=>(this.enabled=!0,e))).catch((e=>{throw this.enabled=!1,e}))}disable(){const e=this.player.debug;at()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):st()?this.noSleepTimer&&(e.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}class At extends Be{constructor(e,t){var i;super(),this.$container=e,this._opt=Object.assign({},l,t),this.debug=new Ae(this),this._opt.useWCS&&(this._opt.useWCS="VideoEncoder"in window),this._opt.useMSE&&(this._opt.useMSE=window.MediaSource&&window.MediaSource.isTypeSupported(Z)),this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=window.MediaStreamTrackGenerator&&"function"==typeof window.MediaStreamTrackGenerator),this._opt.useMSE&&(this._opt.useWCS&&this.debug.log("Player","useWCS set true->false"),this._opt.forceNoOffscreen||this.debug.log("Player","forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0),this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.hasAudio||(this._opt.operateBtns.audio=!1),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,i=this,Object.defineProperty(i,"rect",{get:()=>{const e=i.$container.getBoundingClientRect();return e.width=Math.max(e.width,i.$container.clientWidth),e.height=Math.max(e.height,i.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(i,e,{get:()=>i.rect[e]})})),this.events=new de(this),this.video=new Oe(this),this._opt.hasAudio&&(this.audio=new Ve(this)),this.recorder=new Ge(this),this._onlyMseOrWcsVideo()?this.loaded=!0:this.decoderWorker=new Pe(this),this.stream=null,this.demux=null,this._lastVolume=null,this._opt.useWCS&&(this.webcodecsDecoder=new Ke(this),this.loaded=!0),this._opt.useMSE&&(this.mseDecoder=new rt(this),this.loaded=!0),this.control=new it(this),ye()&&(this.keepScreenOn=new nt(this)),(e=>{try{const t=t=>{Ee(t)===e.$container&&(e.emit(D.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};ce.on("change",t),e.events.destroys.push((()=>{ce.off("change",t)}))}catch(e){}if(e.on(x.decoderWorkerInit,(()=>{e.debug.log("player","has loaded"),e.loaded=!0})),e.on(x.play,(()=>{e.loading=!1})),e.on(x.fullscreen,(t=>{if(t)try{ce.request(e.$container).then((()=>{})).catch((t=>{e.webFullscreen=!0}))}catch(t){e.webFullscreen=!0}else try{ce.exit().then((()=>{})).catch((()=>{e.webFullscreen=!1}))}catch(t){e.webFullscreen=!1}})),e.on(x.webFullscreen,(t=>{t?e.$container.classList.add("jessibuca-fullscreen-web"):e.$container.classList.remove("jessibuca-fullscreen-web"),e.emit(D.fullscreen,e.fullscreen)})),e.on(x.resize,(()=>{e.video.resize()})),e._opt.debug){const t=[x.timeUpdate];Object.keys(x).forEach((i=>{e.on(x[i],(o=>{t.includes(i)||e.debug.log("player events",x[i],o)}))})),Object.keys(j).forEach((t=>{e.on(j[t],(i=>{e.debug.log("player event error",j[t],i)}))}))}})(this),(e=>{const{_opt:t,debug:i,events:{proxy:o}}=e;t.supportDblclickFullscreen&&o(e.$container,"dblclick",(t=>{const i=Ee(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),o(document,"visibilitychange",(()=>{t.hiddenAutoPause&&(i.log("visibilitychange",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),o(window,"fullscreenchange",(()=>{null!==e.keepScreenOn&&"visible"===document.visibilityState&&e.enableWakeLock()}))})(this),this._opt.useWCS&&this.debug.log("Player","use WCS"),this._opt.useMSE&&this.debug.log("Player","use MSE"),this._opt.useOffscreen&&this.debug.log("Player","use offscreen"),this.debug.log("Player options",this._opt)}destroy(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(this.stream.destroy(),this.stream=null),this.recorder&&(this.recorder.destroy(),this.recorder=null),this.control&&(this.control.destroy(),this.control=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.demux&&(this.demux.destroy(),this.demux=null),this.events&&(this.events.destroy(),this.events=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}set fullscreen(e){ye()?(this.emit(x.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(x.fullscreen,e)}get fullscreen(){return ce.isFullscreen||this.webFullscreen}set webFullscreen(e){this.emit(x.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("jessibuca-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(x.playing,e),this.emit(x.volumechange,this.volume),e?this.emit(x.play):this.emit(x.pause))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio&&this.audio.setVolume(e),this._lastVolume=e)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(x.loading,this._loading))}get loading(){return this._loading}set recording(e){e?this.playing&&this.recorder&&this.recorder.startRecord():this.recorder&&this.recorder.stopRecordAndSave()}get recording(){return!!this.recorder&&this.recorder.recording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(x.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}updateOption(e){this._opt=Object.assign({},this._opt,e)}init(){return new Promise(((e,t)=>{this.stream||(this.stream=new Qe(this)),this.audio||this._opt.hasAudio&&(this.audio=new Ve(this)),this.demux||(this.demux=new Ye(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new Ke(this))),this._opt.useMSE&&(this.mseDecoder||(this.mseDecoder=new rt(this))),this.decoderWorker||this._onlyMseOrWcsVideo()?e():(this.decoderWorker=new Pe(this),this.once(x.decoderWorkerInit,(()=>{e()})))}))}play(e,t){return new Promise(((i,o)=>{if(!e&&!this._opt.url)return o();this.loading=!0,this.playing=!1,this._times.playInitStart=he(),e||(e=this._opt.url),this._opt.url=e,this.clearCheckHeartTimeout(),this.init().then((()=>{this._times.playStart=he(),this._opt.isNotMute&&this.mute(!1),this.webcodecsDecoder&&this.webcodecsDecoder.once(j.webcodecsH265NotSupport,(()=>{this.emit(j.webcodecsH265NotSupport),this._opt.autoWasm||this.emit(x.error,j.webcodecsH265NotSupport)})),this.mseDecoder&&(this.mseDecoder.once(j.mediaSourceH265NotSupport,(()=>{this.emit(j.mediaSourceH265NotSupport),this._opt.autoWasm||this.emit(x.error,j.mediaSourceH265NotSupport)})),this.mseDecoder.once(j.mediaSourceFull,(()=>{this.emit(j.mediaSourceFull)})),this.mseDecoder.once(j.mediaSourceAppendBufferError,(()=>{this.emit(j.mediaSourceAppendBufferError)})),this.mseDecoder.once(j.mediaSourceBufferListLarge,(()=>{this.emit(j.mediaSourceBufferListLarge)})),this.mseDecoder.once(j.mediaSourceAppendBufferEndTimeout,(()=>{this.emit(j.mediaSourceAppendBufferEndTimeout)}))),this.enableWakeLock(),this.stream.fetchStream(e,t),this.checkLoadingTimeout(),this.stream.once(j.fetchError,(e=>{o(e)})),this.stream.once(j.websocketError,(e=>{o(e)})),this.stream.once(x.streamEnd,(()=>{o()})),this.stream.once(j.hlsError,(e=>{o(e)})),this.stream.once(x.streamSuccess,(()=>{i(),this._times.streamResponse=he(),this.video.play(),this.checkStatsInterval()}))})).catch((e=>{o(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()}))}))}resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise(((e,t)=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.playing=!1,this.loading=!1,this.recording=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((()=>{e()}),0)}))}pause(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.close():this._close()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}stopRecordAndSave(){this.recording&&(this.recording=!1)}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&(t=!0)})),(this._opt.showBandwidth||this._opt.text||t)&&(e=!0),e}_onlyMseOrWcsVideo(){return!1===this._opt.hasAudio&&(this._opt.useMSE||this._opt.useWCS&&!this._opt.useOffscreen)}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{this.pause().then((()=>{this.emit(x.timeout,x.delayTimeout),this.emit(x.delayTimeout)}))}),1e3*this._opt.heartTimeout)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.pause().then((()=>{this.emit(x.timeout,x.loadingTimeout),this.emit(x.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.loading&&(this.emit(x.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}updateStats(e){e=e||{},this._startBpsTime||(this._startBpsTime=he()),Se(e.ts)&&(this._stats.ts=e.ts),Se(e.buf)&&(this._stats.buf=e.buf),e.fps&&(this._stats.fps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps);const t=he();t-this._startBpsTime<1e3||(this.emit(x.stats,this._stats),this.emit(x.performance,function(e){let t=0;return e>=24?t=2:e>=15&&(t=1),t}(this._stats.fps)),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=t)}resetStats(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}handlePlayToRenderTimes(){const e=this._times;e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart,e.demuxTimestamp=e.demuxStart-e.streamResponse,e.decodeTimestamp=e.decodeStart-e.demuxStart,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,this.emit(x.playToRenderTimes,e)}getOption(){return this._opt}}class dt extends Be{constructor(e){super();let t=e,i=e.container;if("string"==typeof e.container&&(i=document.querySelector(e.container)),!i)throw new Error("Jessibuca need container option");if("CANVAS"===i.nodeName||"VIDEO"===i.nodeName)throw new Error(`Jessibuca container type can not be ${i.nodeName} type`);i.classList.add("jessibuca-container"),delete t.container,Se(t.videoBuffer)&&(t.videoBuffer=1e3*Number(t.videoBuffer)),Se(t.timeout)&&(we(t.loadingTimeout)&&(t.loadingTimeout=t.timeout),we(t.heartTimeout)&&(t.heartTimeout=t.timeout)),this._opt=t,this.$container=i,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.events=new de(this),this._initPlayer(i,t)}destroy(){this.events&&(this.events.destroy(),this.events=null),this.player&&(this.player.destroy(),this.player=null),this.$container=null,this._opt=null,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.off()}_initPlayer(e,t){this.player=new At(e,t),this.player.debug.log("jessibuca","_initPlayer",this.player.getOption()),this._bindEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,e),this._opt.url="",this._initPlayer(this.$container,this._opt)}_bindEvents(){Object.keys(D).forEach((e=>{this.player.on(D[e],(t=>{this.emit(e,t)}))}))}setDebug(e){this.player.updateOption({debug:!!e})}mute(){this.player.mute(!0)}cancelMute(){this.player.mute(!1)}setVolume(e){this.player.volume=e}audioResume(){this.player.audio&&this.player.audio.audioEnabled(!0)}setTimeout(e){e=Number(e),this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){let t={isFullResize:!1,isResize:!1};switch(e=Number(e)){case G:t.isFullResize=!1,t.isResize=!1;break;case P:t.isFullResize=!1,t.isResize=!0;break;case N:t.isFullResize=!0,t.isResize=!0}this.player.updateOption(t),this.resize()}pause(){return this.player.pause()}close(){return this._opt.url="",this._opt.playOptions={},this.player.close()}clearView(){this.player.video.clearView()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,o)=>{if(!e&&!this._opt.url)return this.emit(x.error,j.playError),void o("play url is empty");e?this._opt.url?e===this._opt.url?this.player.playing?i():(this.clearView(),this.player.play(this._opt.url,this._opt.playOptions).then((()=>{i(),this.player.resumeAudioAfterPause()})).catch((e=>{this.player.debug.warn("jessibuca","pause -> play and play error",e),this.player.pause().then((()=>{o(e)}))}))):this.player.pause().then((()=>{this.clearView(),this._play(e,t).then((()=>{i()})).catch((e=>{this.player.debug.warn("jessibuca","this._play error",e),o(e)}))})).catch((e=>{this.player.debug.warn("jessibuca","this._opt.url is null and pause error",e),o(e)})):this._play(e,t).then((()=>{i()})).catch((e=>{this.player.debug.warn("jessibuca","this._play error",e),o(e)})):this.player.play(this._opt.url,this._opt.playOptions).then((()=>{i(),this.player.resumeAudioAfterPause()})).catch((e=>{this.player.debug.warn("jessibuca","url is null and play error",e),this.player.pause().then((()=>{o(e)}))}))}))}_play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,o)=>{this._opt.url=e,this._opt.playOptions=t;const r=0===e.indexOf("http"),d=r?a:s,c=r||-1!==e.indexOf(".flv")||this._opt.isFlv?n:A;this.player.updateOption({protocol:d,demuxType:c}),this.player.once(j.webglAlignmentError,(()=>{this.pause().then((()=>{this.player.debug.log("Jessibuca","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(e).then((()=>{this.player.debug.log("Jessibuca","webglAlignmentError and play success")})).catch((()=>{this.player.debug.log("Jessibuca","webglAlignmentError and play error")}))}))})),this.player.once(j.mediaSourceH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e,t).then((()=>{this.player.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.player.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play error")})))}))})),this.player.once(j.webcodecsH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.player.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play success")})).catch((()=>{this.player.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play error")})))}))})),this.player.once(j.mediaSourceFull,(()=>{this.pause().then((()=>{this.player.debug.log("Jessibuca","media source full"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Jessibuca","media source full and reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","media source full and reset player and play error")}))}))})),this.player.once(j.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Jessibuca","media source append buffer error"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Jessibuca","media source append buffer error and reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","media source append buffer error and reset player and play error")}))}))})),this.player.once(j.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.player.debug.log("Jessibuca","media source buffer list large"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Jessibuca","media source buffer list large and reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","media source buffer list large and reset player and play error")}))}))})),this.player.once(j.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.player.debug.log("Jessibuca","media source append buffer end timeout"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Jessibuca","media source append buffer end timeout and reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","media source append buffer end timeout and reset player and play error")}))}))})),this.player.once(j.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Jessibuca","mseSourceBufferError close success")}))})),this.player.once(j.webcodecsH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","auto wasm [wcs-> wasm] reset player and play error")})))}))})),this.player.once(j.webcodecsWidthOrHeightChange,(()=>{this.pause().then((()=>{this.player.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play"),this._resetPlayer({useWCS:!0}),this.play(e).then((()=>{this.player.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","webcodecs Width Or Height Change reset player and play error")}))}))})),this.player.once(j.webcodecsDecodeError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Jessibuca","webcodecs decode error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Jessibuca","webcodecs decode error reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","webcodecs decode error reset player and play error")})))}))})),this.player.once(j.wasmDecodeError,(()=>{this.player._opt.wasmDecodeErrorReplay&&this.pause().then((()=>{this.player.debug.log("Jessibuca","wasm decode error and reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.player.debug.log("Jessibuca","wasm decode error and reset player and play success")})).catch((()=>{this.player.debug.warn("Jessibuca","wasm decode error and reset player and play error")}))}))})),this.player.on(x.delayTimeout,(()=>{this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{this._heartTimeoutReplayTimes=0})).catch((()=>{})))})),this.player.on(x.loadingTimeout,(()=>{this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{this._loadingTimeoutReplayTimes=0})).catch((()=>{})))})),this.hasLoaded()?this.player.play(e,t).then((()=>{i()})).catch((e=>{this.player.debug.warn("Jessibuca","hasLoaded and play error",e),this.player.pause().then((()=>{o(e)}))})):this.player.once(x.decoderWorkerInit,(()=>{this.player.play(e,t).then((()=>{i()})).catch((e=>{this.player.debug.warn("Jessibuca","decoderWorkerInit and play error",e),this.player.pause().then((()=>{o(e)}))}))}))}))}resize(){this.player.resize()}setBufferTime(e){e=Number(e),this.player.updateOption({videoBuffer:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"videoBuffer",value:1e3*e})}setRotate(e){e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)&&(this.player.updateOption({rotate:e}),this.resize())}hasLoaded(){return this.player.loaded}setKeepScreenOn(){this.player.updateOption({keepScreenOn:!0})}setFullscreen(e){const t=!!e;this.player.fullscreen!==t&&(this.player.fullscreen=t)}screenshot(e,t,i,o){return this.player.video.screenshot(e,t,i,o)}startRecord(e,t){return new Promise(((i,o)=>{this.player.playing?(this.player.startRecord(e,t),i()):o()}))}stopRecordAndSave(){this.player.recording&&this.player.stopRecordAndSave()}isPlaying(){return!!this.player&&this.player.playing}isMute(){return!this.player.audio||this.player.audio.isMute}isRecording(){return this.player.recorder.recording}}return r(dt,"ERROR",j),r(dt,"TIMEOUT",{loadingTimeout:x.loadingTimeout,delayTimeout:x.delayTimeout}),window.Jessibuca=dt,dt})); diff --git a/web-pages/public/logo.png b/web-pages/public/logo.png new file mode 100644 index 0000000..0e7170b Binary files /dev/null and b/web-pages/public/logo.png differ diff --git a/web-pages/public/static/liveplayer/liveplayer-component.min.js b/web-pages/public/static/liveplayer/liveplayer-component.min.js new file mode 100644 index 0000000..87a7edd --- /dev/null +++ b/web-pages/public/static/liveplayer/liveplayer-component.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("LivePlayer",[],t):"object"==typeof exports?exports.LivePlayer=t():e.LivePlayer=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}({0:function(e,t,n){e.exports=n("qtAY")},"2SVd":function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},"5oMp":function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},"8MIm":function(e,t,n){(e.exports=n("I1BE")(void 0)).push([e.i,'.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{position:absolute;top:0;left:0;width:100%;height:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABDkAAsAAAAAG6gAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV3hY21hcAAAAYQAAADaAAADPv749/pnbHlmAAACYAAAC3AAABHQZg6OcWhlYWQAAA3QAAAAKwAAADYZw251aGhlYQAADfwAAAAdAAAAJA+RCLFobXR4AAAOHAAAABMAAACM744AAGxvY2EAAA4wAAAASAAAAEhF6kqubWF4cAAADngAAAAfAAAAIAE0AIFuYW1lAAAOmAAAASUAAAIK1cf1oHBvc3QAAA/AAAABJAAAAdPExYuNeJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGS7wTiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGJHcRdyA4RZgQRADK3CxEAAHic7dFZbsMgAEXRS0ycyZnnOeG7y+qC8pU1dHusIOXxuoxaOlwZYWQB0Aea4quIEN4E9LzKbKjzDeM6H/mua6Lmc/p8yhg0lvdYx15ZG8uOLQOGjMp3EzqmzJizYMmKNRu27Nhz4MiJMxeu3Ljz4Ekqm7T8P52G8PP3lnTOVk++Z6iN6QZzNN1F7ptuN7eGOjDUoaGODHVsuvU8MdTO9Hd5aqgzQ50b6sJQl4a6MtS1oW4MdWuoO0PdG+rBUI+GejLUs6FeDPVqqDdDvRvqw1CfhpqM9At0iFLaAAB4nJ1YDXBTVRZ+5/22TUlJ8we0pHlJm7RJf5O8F2j6EymlSPkpxaL8U2xpa3DKj0CBhc2IW4eWKSokIoLsuMqssM64f+jA4HSdWXXXscBq67IOs3FXZ1ZYWVyRFdo899yXtIBQZ90k7717zz3v3HPPOfd854YCCj9cL9dL0RQFOqCbGJnrHb5EayiKIWN8iA/hWBblo6hUWm8TtCDwE80WMJus/irwyxOdxeB0MDb14VNJHnXYoLLSl6FfCUYO9nYPTA8Epg9090LprfbBbZ2hY0UlJUXHQp3/vtWkS6EBv8+rPMq5u9692f/dNxJNiqwC1xPE9TCUgCsSdQWgE3XQD25lkG4CN2xmTcOXWBOyser6RN6KnGbKSbmQ3+d0OI1m2W8QzLLkI2sykrWAgJJEtA8vGGW/2Q+CmT3n8zS9wZwu2DCvtuZKZN3xkrLh36yCZuUomQSqGpY8t/25VfHVhw8z4ebGBtfLb0ya9PCaDc+8dGTvk2dsh6z7WzvowlXKUSWo9MJ15a3KrEP2loOr2Ojhw6iW6hf2BDdEccQvZGpaAy7YovSwq8kr7HGllxpd71rkS6G0Sf11sl9OvMK1+jwPPODxjUwkOim9CU3ix1wNjXDfmJSEn618Bs6lpWwUpU+8PCqLMY650zjq8VhCIP17NEKTx3eaLL+s5Pi6yJWaWjTHLR1jYzPSV9VF/6Ojdb/1kO3Mk3uhHC0x6gc1BjlKQ+nQFxTYdaJkZ7ySVxLBbhR1dsboNXp1tCYKW2LRaEzpYcIx2BKNxaL0ZaUnSqfFoiNhHKR/GkX6PWUSAaJelQaqZL1EpoHNsajSEyPSoJ9IjhIxTdjHLmwZvhRDOiFTY/YeQnvrVZmiTQtGncECXtFTBZLOVwwMRgoXHAkXzMzPn1nAJJ8jYSbMDaqN2waGLzNhih/bZynUBMpIWSg7VYi7DRx2m8ALkIdRCJwI6ArJx2EI8kaDWeTQKeAFk9fjl/1AvwktjQ1P7NjyMGQyfd4vjipX6M/i52D7Cq80kqlcxEcGXRr/FEcgs0u5uGgB4VWuMFfpdn2Re6Hi3PqzmxWKsz6+ae2Pn9hXXw/fqM859UiGC0oKYYILJBqJrsn1Z1E5qOs9rQCiUQRREjm8yJcbHF5cUJufX1vAHlefw0XgUoboS3ETfQlTxBC4SOtuE8VPRJTBSCQSjZCpk7Gqzu+masaZ2y7Zjehho4F3g82BNDkAHpORG4+OCS+f6JTPmtRn/PH1kch6d04sp7AQb25aQ/pqUyXeQ8vrebG8OYQdXOQ+585u0sdW9rqalzRURiJ+9F4MweRFrKUjl1GUYhH1A27WOHw5cTFSFPMo9EeUIGnQTZHIaJ7AHLaOKsOODaNF9jkBjYG2QEsQ2xjMUAx2bBEbeTBWMHwskBjngq56S/yfgkBnWBa4K9sqKtq2t1UI8S9He5XuBRbawAdatrQEAi30Aks2+LM8WeCbalVZkWNylvJ+dqJnzVb+OHlSoKW8nPCP7Rd+CcZ2DdWAGqJ2CBFOphgywFFCFBNtfAbGtNPBCwxvygHeYMZMY9ZboBqwq/pVrsbgN5tkv152ODlbMfiqwGMBgxa4Exz3QhovRIUp6acqZmQzRq0ypDXS2TPLT02YIkQETnOE445oOGxOmXAqUJNNG7XgupMjPq2ua9asrj5yY/yuKteO1Kx0YNJTufrirLe1mZnat7OL6rnUdCWenpW6I8mAnbsY8KWs1PuSovCW9A/Z25PQ24a7cNOqgmTkLmBMgh4THgc4b9k2IVv1/g/F5nGljwPLfOgHAzJzh45V/4+WenTzmMtR5Z7us2Tys909UHqrPY7KbckoxRvRHhmVc3cJGE97uml0R1S0jdULVl7EvZtDFVBF35N9cEdjpgmAiOlFZ+Dtoh93+D3zzHr8RRNZQhnCNMNbcegOvpEwZoL+06cJQ07h+th3fZ/7PVbVC6ngTAV/KoLFuO6+2KFcU651gEb5ugPSIb1D+Xp8V4+k3sEIGnw5mYe4If4k1lFYr6SCzmM2EQ8iWtmwjnBI9kTwe1TlfAmXh7H02by9fW2gsjKwtv0aaURKil4OdV7rDL1MXIFNrhdxohcZXYTnq47WisrKitaObbf5+yvkLi5J6lCNZZ+B6GC38VNBZBDidSS/+mSvh6s+srgC8pyKMvDtt+de3c9fU76ZPfuM8ud4Kv0fyP/LqfepMT/3oZxSqpZaTa1DaQYLY8TFsHYbWYsPoRhRWfL5eSSQbhUGgGC3YLbVMk6PitTFNGpAsNrC6D1VNBKgBHMejaiuRWEWGgsSDBTJjqWIl8kJLlsaLJ2tXDr6xGfT85bM2Q06a46x2HTgvdnV8z5YDy/27J4zt6x2VtkzjoYpkq36kaBr4eQSg7tyiVweWubXZugtadl58ydapfbORfKsDTuZ0OBgx4cfdjCf5tbWNITnL120fdOi1RV1C3uKGzNdwYLcMvZ3BxoPyTOCD1XvXTp7U10gWCVmTV9b3r2z0SkGWovb2hp9I89O8a2smlyaO8muMU+dRmtzp60IzAoFpjLr1n388boLyf0dRvxhsHZ0qbWqDkwqvvpkj4l0fY6EIXRi5sQSrAvsVYwXRy4qJ2EVtD1AN7a0HWth9ymvL1xc3WTUKK/TAHA/bXDVtVWfOMfuGxGZv4Ln/jVr9jc3j1yMv0tndmyt9Vq88Y9gH1wtLX3KWjot5++jWHgAoZZkQ14wGQ20Fli71UmKJAy4xKMSTGbVdybW7FDDAut9XpD5AzWrYO7zQ8qffqF8+Ynd/clrHcdyxGy3a/3+mfNnzC/cBsveTjnTvXf1o6vzOlZw7WtqtdmPK/Errz/6NNtD72zmNOZfbmYdTGHfoofqI79Oc+R2n1lrnL6pOm0Up7kwxhTW12Amm7WYkXR2qYrF2AmgmbAsxZjwy1xpg/m1Je2vrp8v/nz2xpmlBg4E9hrMU341wVpTOh/OfmGvAnra8q6uctr60ZQHV3Q+WMQJykMj8ZsWn2QBOmmHMB+m5pDIpTFonYigiaKAhGEiAHF7EliVnQkjoLVIMPtJpBKHYd3A8GYH9jJzrWwmHx5Qjp7vDAX0suGRym1vtm/9W1/HyR8vczfMs6Sk8DSv855/5dlX9oQq52hT8syyp2rx5Id17IAyAM3wIjQPMOHzytEB64q6D5zT91yNbnx3V/nqnd017S9Y0605k3izoXLpsxde2n38yoOV9s1LcjwzNjbdX6asnBVaBj/6/DwKwPkpcqbDG7BnsXoSqWnUAmottYF6jMSdVyYZh3zVXCjwTiwwHH6sGuRiEHQGzuRX6whZkp123oy1BWE2mEfJ/tvIRtM4ZM5bDXiMsPMaAKOTyc5uL57rqyyc5y5JE5pm1i2S2iUX0CcaQ6lC6Zog7JqSqZmYlosl2K6pwNA84zRnQW6SaALYZQGW5lhCtU/W34N6o+bKfZ8cf3/Cl/+iTX3wBzpOY4mRkeNf3rptycGSshQWgGbYt5jFc2e0+DglIrwl6DVWQ7BuwaJ3Xk1J4VL5urnLl/Wf+gHU/hZoZdKNym6lG+I34FaNeZKcSpJIo2IeCVvpdsDGfKvzJnAwmeD37Ow65ZWwSowpgwX5T69s/rB55dP5BcpgDKFV8p7q2sn/1uc93bVzT/w6UrCqDTWvfCq/oCD/qZXNoUj8BL5Kp6GU017frfNXkAtiiyf/SOCEeLqnd8R/Ql9GlCRfctS6k5chvIBuQ1zCCjoCHL2DHNHIXxMJ3kQeO8lbsUXONeSfA5EjcG6/E+KdhN4bP04vBhdi883+BFBzQbxFbvZzQeY9LNBZc0FNfn5NwfDn6rCTnTw6R8o+gfpf5hCom33cRuiTlss3KHmZjD+BPN+5gXuA2ziS/Q73mLxUkpbKN/eqwz5uK0X9F3h2d1V4nGNgZGBgAOJd776+iue3+crAzc4AAje5Bfcg0xz9YHEOBiYQBQA8FQlFAHicY2BkYGBnAAGOPgaG//85+hkYGVCBMgBGGwNYAAAAeJxjYGBgYB8EmKOPgQEAQ04BfgAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAcICGAJYArQC4AMwA7AD3gQwBJYE3AUkBWYFigYgBmYGtAbqB1gIEghYCG4IhAi2COh4nGNgZGBgUGYoZWBnAAEmIOYCQgaG/2A+AwAYCQG2AHicXZBNaoNAGIZfE5PQCKFQ2lUps2oXBfOzzAESyDKBQJdGR2NQR3QSSE/QE/QEPUUPUHqsvsrXjTMw83zPvPMNCuAWP3DQDAejdm1GjzwS7pMmwi75XngAD4/CQ/oX4TFe4Qt7uMMbOzjuDc0EmXCP/C7cJ38Iu+RP4QEe8CU8pP8WHmOPX2EPz87TPo202ey2OjlnQSXV/6arOjWFmvszMWtd6CqwOlKHq6ovycLaWMWVydXKFFZnmVFlZU46tP7R2nI5ncbi/dDkfDtFBA2DDXbYkhKc+V0Bqs5Zt9JM1HQGBRTm/EezTmZNKtpcAMs9Yu6AK9caF76zoLWIWcfMGOSkVduvSWechqZsz040Ib2PY3urxBJTzriT95lipz+TN1fmAAAAeJxtkMl2wjAMRfOAhABlKm2h80C3+ajgCKKDY6cegP59TYBzukAL+z1Zsq8ctaJTTKPrsUQLbXQQI0EXKXroY4AbDDHCGBNMcYsZ7nCPB8yxwCOe8IwXvOIN7/jAJ76wxHfUqWX+OzgumWAjJMV17i0Ndlr6irLKO+qftdT7i6y4uFSUvCknay+lFYZIZaQcmfH/xIFdYn98bqhra1aKTM/6lWMnyaYirx1rFUQZFBkb2zJUtoXeJCeg0WnLtHeSFc3OtrnozNwqi0TkSpBMDB1nSde5oJXW23hTS2/T0LilglXX7dmFVxLnq5U0vYATHFk3zX3BOisoQHNDFDeZnqKDy9hRNawN7Vh727hFzcJ5c8TILrKZfH7tIPxAFP0BpLeJPA==) format("woff");font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\\F101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:"\\F102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\\F103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\\F104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\\F105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\\F106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\\F107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\\F108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\\F109"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:"\\F10A"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:"\\F10B"}.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\\F10C"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\\F10D"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\\F10E"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:"\\F10F"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:"\\F110"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\\F111"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:"\\F112"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\\F113"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:"\\F114"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\\F115"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\\F116"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:"\\F117"}.vjs-icon-gplus{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-gplus:before{content:"\\F118"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:"\\F119"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:"\\F11A"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:"\\F11B"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:"\\F11C"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\\F11D"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\\F11E"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:"\\F11F"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:"\\F120"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\\F121"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\\F122"}.video-js{display:block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:normal}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:none}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-4-3,.video-js.vjs-16-9,.video-js.vjs-fluid{width:100%;max-width:100%;height:0}.video-js.vjs-16-9{padding-top:56.25%}.video-js.vjs-4-3{padding-top:75%}.video-js.vjs-fill,.video-js .vjs-tech{width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0}body.vjs-full-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen{width:100%!important;height:100%!important;padding-top:0!important}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1;visibility:visible}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:10px;left:10px;padding:0;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:rgba(43,51,63,.7);border-radius:.3em;transition:all .4s}.vjs-big-play-centered .vjs-big-play-button{top:50%;left:50%;margin-top:-.81666em;margin-left:-1.5em}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{border-color:#fff;background-color:#73859f;background-color:rgba(115,133,159,.5);transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause .vjs-big-play-button{display:block}.video-js button{background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0;margin-bottom:1.5em;border-top-color:rgba(43,51,63,.7)}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover,.video-js.vjs-no-flex .vjs-menu-button-inline{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-no-flex .vjs-menu-button-inline .vjs-menu{display:block;opacity:1;position:relative;width:auto}.vjs-no-flex .vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-no-flex .vjs-menu-button-inline:focus .vjs-menu,.vjs-no-flex .vjs-menu-button-inline:hover .vjs-menu{width:auto}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.vjs-has-started .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible}.vjs-has-started.vjs-no-flex .vjs-control-bar{display:table}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js .vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.vjs-no-flex .vjs-control{display:table-cell;vertical-align:middle}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.vjs-no-flex .vjs-progress-control{width:auto}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;top:-.3333333333em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:hsla(0,0%,100%,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.vjs-no-flex .vjs-progress-control .vjs-mouse-display{z-index:0}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.video-js.vjs-user-inactive.vjs-no-flex .vjs-progress-control .vjs-mouse-display{display:none}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#73859f;background-color:rgba(115,133,159,.5)}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em}.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{width:9em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js.vjs-no-flex .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;visibility:visible;opacity:1;position:relative;transition:none}.video-js.vjs-no-flex .vjs-volume-control.vjs-volume-vertical,.video-js.vjs-no-flex .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{position:absolute;bottom:3em;left:.5em}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{top:-.3em;right:-.5em}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.vjs-poster{display:inline-block;vertical-align:middle;background-repeat:no-repeat;background-position:50% 50%;background-size:contain;background-color:#000;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster{display:block}.vjs-using-native-controls .vjs-poster{display:none}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.vjs-no-flex .vjs-live-control{display:table-cell;width:auto;text-align:left}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.vjs-no-flex .vjs-seek-to-live-control{display:table-cell;width:auto;text-align:left}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-no-flex .vjs-current-time,.vjs-no-flex .vjs-duration{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-live .vjs-time-divider{display:none}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js .vjs-fullscreen-control,.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-error .vjs-error-display:before{color:#fff;content:"X";font-family:Arial,Helvetica,sans-serif;font-size:4em;left:0;line-height:1;margin-top:-.5em;position:absolute;text-shadow:.05em .05em .1em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;opacity:.85;text-align:left;border:6px solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:50px;height:50px;border-radius:25px;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:block;-webkit-animation:vjs-spinner-show 0s linear .3s forwards;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-loading-spinner:after,.vjs-loading-spinner:before{content:"";position:absolute;margin:-6px;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{-webkit-animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite;animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;-webkit-animation-delay:.44s;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@-webkit-keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(1turn)}}@-webkit-keyframes vjs-spinner-spin{to{-webkit-transform:rotate(1turn)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}@-webkit-keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\\F10D";font-size:1.5em;line-height:inherit}.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \\F11D";font-size:1.5em;line-height:inherit}.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-audio-button,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-captions-button,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-chapters-button,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-current-time,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-descriptions-button,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-duration,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-playback-rate,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-remaining-time,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-subtitles-button,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-time-divider,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-volume-control,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-audio-button,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-captions-button,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-chapters-button,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-current-time,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-descriptions-button,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-duration,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-playback-rate,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-remaining-time,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-subtitles-button,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-time-divider,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-volume-control,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-audio-button,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-captions-button,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-chapters-button,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-current-time,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-descriptions-button,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-duration,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-playback-rate,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-remaining-time,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-subtitles-button,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-time-divider,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-volume-control{display:none}.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js:not(.vjs-fullscreen).vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js:not(.vjs-fullscreen).vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto}.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-subs-caps-button,.video-js:not(.vjs-fullscreen).vjs-layout-x-small:not(.vjs-live) .vjs-subs-caps-button,.video-js:not(.vjs-fullscreen).vjs-layout-x-small:not(.vjs-liveui) .vjs-subs-caps-button{display:none}.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-custom-control-spacer,.video-js:not(.vjs-fullscreen).vjs-layout-x-small.vjs-liveui .vjs-custom-control-spacer{flex:auto;display:block}.video-js:not(.vjs-fullscreen).vjs-layout-tiny.vjs-no-flex .vjs-custom-control-spacer,.video-js:not(.vjs-fullscreen).vjs-layout-x-small.vjs-liveui.vjs-no-flex .vjs-custom-control-spacer{width:auto}.video-js:not(.vjs-fullscreen).vjs-layout-tiny .vjs-progress-control,.video-js:not(.vjs-fullscreen).vjs-layout-x-small.vjs-liveui .vjs-progress-control{display:none}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:5px;padding:3px;border:none}.vjs-text-track-settings fieldset span{display:inline-block}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;margin:0 0 5px}.vjs-text-track-settings .vjs-label{position:absolute;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);display:block;margin:0 0 5px;padding:0;border:0;height:1px;width:1px;overflow:hidden}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f)}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible),.video-js .vjs-menu :focus:not(:focus-visible),.video-js :focus:not(:focus-visible){outline:none;background:none}',""])},"8eWk":function(e,t,n){var r=n("LboF"),o=n("qFNJ");"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};r(o,i);e.exports=o.locals||{}},"8oxB":function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,l=[],c=!1,f=-1;function v(){c&&u&&(c=!1,u.length?l=u.concat(l):f=-1,l.length&&p())}function p(){if(!c){var e=a(v);c=!0;for(var t=l.length;t;){for(u=l,l=[];++f1)for(var n=1;n=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var s="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n&&n.global===n?n:void 0,a=s.saveAs||("object"!=typeof window||window!==s?function(){}:"download"in HTMLAnchorElement.prototype?function(e,t,n){var a=s.URL||s.webkitURL,u=document.createElement("a");t=t||e.name||"download",u.download=t,u.rel="noopener","string"==typeof e?(u.href=e,u.origin===location.origin?i(u):o(u.href)?r(e,t,n):i(u,u.target="_blank")):(u.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(u.href)}),4e4),setTimeout((function(){i(u)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,n,s){if(n=n||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,s),n);else if(o(e))r(e,n,s);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout((function(){i(a)}))}}:function(e,t,n,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return r(e,t,n);var i="application/octet-stream"===e.type,a=/constructor/i.test(s.HTMLElement)||s.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||i&&a)&&"object"==typeof FileReader){var l=new FileReader;l.onloadend=function(){var e=l.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},l.readAsDataURL(e)}else{var c=s.URL||s.webkitURL,f=c.createObjectURL(e);o?o.location=f:location.href=f,o=null,setTimeout((function(){c.revokeObjectURL(f)}),4e4)}});s.saveAs=a.saveAs=a,e.exports=a})?r.apply(t,o):r)||(e.exports=i)}).call(this,n("yLpj"))},JEQr:function(e,t,n){"use strict";(function(t){var r=n("xTJ+"),o=n("yK9s"),i={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,u={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t)&&(a=n("tQ2B")),a),transformRequest:[function(e,t){return o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(s(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){u.headers[e]=r.merge(i)})),e.exports=u}).call(this,n("8oxB"))},LYNF:function(e,t,n){"use strict";var r=n("OH9c");e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},LboF:function(e,t,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n"']/g,K=RegExp(G.source),X=RegExp(Z.source),$=/<%-([\s\S]+?)%>/g,ee=/<%([\s\S]+?)%>/g,te=/<%=([\s\S]+?)%>/g,ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,re=/^\w*$/,oe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ie=/[\\^$.*+?()[\]{}|]/g,se=RegExp(ie.source),ae=/^\s+|\s+$/g,ue=/^\s+/,le=/\s+$/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,fe=/\{\n\/\* \[wrapped with (.+)\] \*/,ve=/,? & /,pe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,de=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,je=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,be=/^0o[0-7]+$/i,we=/^(?:0|[1-9]\d*)$/,_e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xe=/($^)/,Ae=/['\n\r\u2028\u2029\\]/g,ke="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Be="a-z\\xdf-\\xf6\\xf8-\\xff",Te="A-Z\\xc0-\\xd6\\xd8-\\xde",Oe="\\ufe0e\\ufe0f",Ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Re="['’]",ze="[\\ud800-\\udfff]",Ee="["+Ce+"]",Fe="["+ke+"]",Le="\\d+",Ie="[\\u2700-\\u27bf]",Je="["+Be+"]",Ue="[^\\ud800-\\udfff"+Ce+Le+Se+Be+Te+"]",qe="\\ud83c[\\udffb-\\udfff]",De="[^\\ud800-\\udfff]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Ne="[\\ud800-\\udbff][\\udc00-\\udfff]",Ve="["+Te+"]",We="(?:"+Je+"|"+Ue+")",Pe="(?:"+Ve+"|"+Ue+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",Ye="(?:['’](?:D|LL|M|RE|S|T|VE))?",Qe="(?:"+Fe+"|"+qe+")"+"?",Ge="[\\ufe0e\\ufe0f]?",Ze=Ge+Qe+("(?:\\u200d(?:"+[De,Me,Ne].join("|")+")"+Ge+Qe+")*"),Ke="(?:"+[Ie,Me,Ne].join("|")+")"+Ze,Xe="(?:"+[De+Fe+"?",Fe,Me,Ne,ze].join("|")+")",$e=RegExp(Re,"g"),et=RegExp(Fe,"g"),tt=RegExp(qe+"(?="+qe+")|"+Xe+Ze,"g"),nt=RegExp([Ve+"?"+Je+"+"+He+"(?="+[Ee,Ve,"$"].join("|")+")",Pe+"+"+Ye+"(?="+[Ee,Ve+We,"$"].join("|")+")",Ve+"?"+We+"+"+He,Ve+"+"+Ye,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Le,Ke].join("|"),"g"),rt=RegExp("[\\u200d\\ud800-\\udfff"+ke+Oe+"]"),ot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],st=-1,at={};at[J]=at[U]=at[q]=at[D]=at[M]=at[N]=at[V]=at[W]=at[P]=!0,at[g]=at[b]=at[L]=at[w]=at[I]=at[_]=at[x]=at[A]=at[S]=at[B]=at[T]=at[C]=at[R]=at[z]=at[F]=!1;var ut={};ut[g]=ut[b]=ut[L]=ut[I]=ut[w]=ut[_]=ut[J]=ut[U]=ut[q]=ut[D]=ut[M]=ut[S]=ut[B]=ut[T]=ut[C]=ut[R]=ut[z]=ut[E]=ut[N]=ut[V]=ut[W]=ut[P]=!0,ut[x]=ut[A]=ut[F]=!1;var lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ct=parseFloat,ft=parseInt,vt="object"==typeof e&&e&&e.Object===Object&&e,pt="object"==typeof self&&self&&self.Object===Object&&self,dt=vt||pt||Function("return this")(),ht=t&&!t.nodeType&&t,jt=ht&&"object"==typeof r&&r&&!r.nodeType&&r,mt=jt&&jt.exports===ht,yt=mt&&vt.process,gt=function(){try{var e=jt&&jt.require&&jt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),bt=gt&>.isArrayBuffer,wt=gt&>.isDate,_t=gt&>.isMap,xt=gt&>.isRegExp,At=gt&>.isSet,kt=gt&>.isTypedArray;function St(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Bt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o-1}function Et(e,t,n){for(var r=-1,o=null==e?0:e.length;++r-1;);return n}function tn(e,t){for(var n=e.length;n--&&Nt(t,e[n],0)>-1;);return n}function nn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var rn=Yt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),on=Yt({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+lt[e]}function an(e){return rt.test(e)}function un(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function ln(e,t){return function(n){return e(t(n))}}function cn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n",""":'"',"'":"'"});var jn=function e(t){var n,r=(t=null==t?dt:jn.defaults(dt.Object(),t,jn.pick(dt,it))).Array,o=t.Date,ke=t.Error,Se=t.Function,Be=t.Math,Te=t.Object,Oe=t.RegExp,Ce=t.String,Re=t.TypeError,ze=r.prototype,Ee=Se.prototype,Fe=Te.prototype,Le=t["__core-js_shared__"],Ie=Ee.toString,Je=Fe.hasOwnProperty,Ue=0,qe=(n=/[^.]+$/.exec(Le&&Le.keys&&Le.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",De=Fe.toString,Me=Ie.call(Te),Ne=dt._,Ve=Oe("^"+Ie.call(Je).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),We=mt?t.Buffer:i,Pe=t.Symbol,He=t.Uint8Array,Ye=We?We.allocUnsafe:i,Qe=ln(Te.getPrototypeOf,Te),Ge=Te.create,Ze=Fe.propertyIsEnumerable,Ke=ze.splice,Xe=Pe?Pe.isConcatSpreadable:i,tt=Pe?Pe.iterator:i,rt=Pe?Pe.toStringTag:i,lt=function(){try{var e=pi(Te,"defineProperty");return e({},"",{}),e}catch(e){}}(),vt=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,pt=o&&o.now!==dt.Date.now&&o.now,ht=t.setTimeout!==dt.setTimeout&&t.setTimeout,jt=Be.ceil,yt=Be.floor,gt=Te.getOwnPropertySymbols,qt=We?We.isBuffer:i,Yt=t.isFinite,mn=ze.join,yn=ln(Te.keys,Te),gn=Be.max,bn=Be.min,wn=o.now,_n=t.parseInt,xn=Be.random,An=ze.reverse,kn=pi(t,"DataView"),Sn=pi(t,"Map"),Bn=pi(t,"Promise"),Tn=pi(t,"Set"),On=pi(t,"WeakMap"),Cn=pi(Te,"create"),Rn=On&&new On,zn={},En=Di(kn),Fn=Di(Sn),Ln=Di(Bn),In=Di(Tn),Jn=Di(On),Un=Pe?Pe.prototype:i,qn=Un?Un.valueOf:i,Dn=Un?Un.toString:i;function Mn(e){if(ra(e)&&!Hs(e)&&!(e instanceof Pn)){if(e instanceof Wn)return e;if(Je.call(e,"__wrapped__"))return Mi(e)}return new Wn(e)}var Nn=function(){function e(){}return function(t){if(!na(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Vn(){}function Wn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Pn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function lr(e,t,n,r,o,s){var a,u=1&t,l=2&t,c=4&t;if(n&&(a=o?n(e,r,o,s):n(e)),a!==i)return a;if(!na(e))return e;var f=Hs(e);if(f){if(a=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Je.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!u)return Ro(e,a)}else{var v=ji(e),p=v==A||v==k;if(Zs(e))return ko(e,u);if(v==T||v==g||p&&!o){if(a=l||p?{}:yi(e),!u)return l?function(e,t){return zo(e,hi(e),t)}(e,function(e,t){return e&&zo(t,Fa(t),e)}(a,e)):function(e,t){return zo(e,di(e),t)}(e,ir(a,e))}else{if(!ut[v])return o?e:{};a=function(e,t,n){var r=e.constructor;switch(t){case L:return So(e);case w:case _:return new r(+e);case I:return function(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case J:case U:case q:case D:case M:case N:case V:case W:case P:return Bo(e,n);case S:return new r;case B:case z:return new r(e);case C:return function(e){var t=new e.constructor(e.source,je.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new r;case E:return o=e,qn?Te(qn.call(o)):{}}var o}(e,v,u)}}s||(s=new Zn);var d=s.get(e);if(d)return d;if(s.set(e,a),ua(e))return e.forEach((function(r){a.add(lr(r,t,n,r,e,s))})),a;if(oa(e))return e.forEach((function(r,o){a.set(o,lr(r,t,n,o,e,s))})),a;var h=f?i:(c?l?si:ii:l?Fa:Ea)(e);return Tt(h||e,(function(r,o){h&&(r=e[o=r]),nr(a,o,lr(r,t,n,o,e,s))})),a}function cr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Te(e);r--;){var o=n[r],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function fr(e,t,n){if("function"!=typeof e)throw new Re(s);return Ei((function(){e.apply(i,n)}),t)}function vr(e,t,n,r){var o=-1,i=zt,s=!0,a=e.length,u=[],l=t.length;if(!a)return u;n&&(t=Ft(t,Kt(n))),r?(i=Et,s=!1):t.length>=200&&(i=$t,s=!1,t=new Gn(t));e:for(;++o-1},Yn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Hn,map:new(Sn||Yn),string:new Hn}},Qn.prototype.delete=function(e){var t=fi(this,e).delete(e);return this.size-=t?1:0,t},Qn.prototype.get=function(e){return fi(this,e).get(e)},Qn.prototype.has=function(e){return fi(this,e).has(e)},Qn.prototype.set=function(e,t){var n=fi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Zn.prototype.clear=function(){this.__data__=new Yn,this.size=0},Zn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Zn.prototype.get=function(e){return this.__data__.get(e)},Zn.prototype.has=function(e){return this.__data__.has(e)},Zn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Yn){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Qn(r)}return n.set(e,t),this.size=n.size,this};var pr=Lo(wr),dr=Lo(_r,!0);function hr(e,t){var n=!0;return pr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function jr(e,t,n){for(var r=-1,o=e.length;++r0&&n(a)?t>1?yr(a,t-1,n,r,o):Lt(o,a):r||(o[o.length]=a)}return o}var gr=Io(),br=Io(!0);function wr(e,t){return e&&gr(e,t,Ea)}function _r(e,t){return e&&br(e,t,Ea)}function xr(e,t){return Rt(t,(function(t){return $s(e[t])}))}function Ar(e,t){for(var n=0,r=(t=wo(t,e)).length;null!=e&&nt}function Tr(e,t){return null!=e&&Je.call(e,t)}function Or(e,t){return null!=e&&t in Te(e)}function Cr(e,t,n){for(var o=n?Et:zt,s=e[0].length,a=e.length,u=a,l=r(a),c=1/0,f=[];u--;){var v=e[u];u&&t&&(v=Ft(v,Kt(t))),c=bn(v.length,c),l[u]=!n&&(t||s>=120&&v.length>=120)?new Gn(u&&v):i}v=e[0];var p=-1,d=l[0];e:for(;++p=a?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Hr(e,t,n){for(var r=-1,o=t.length,i={};++r-1;)a!==e&&Ke.call(a,u,1),Ke.call(e,u,1);return e}function Qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;bi(o)?Ke.call(e,o,1):vo(e,o)}}return e}function Gr(e,t){return e+yt(xn()*(t-e+1))}function Zr(e,t){var n="";if(!e||t<1||t>h)return n;do{t%2&&(n+=e),(t=yt(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return Fi(Ti(e,t,iu),e+"")}function Xr(e){return Xn(Na(e))}function $r(e,t){var n=Na(e);return Ji(n,ur(t,0,n.length))}function eo(e,t,n,r){if(!na(e))return e;for(var o=-1,s=(t=wo(t,e)).length,a=s-1,u=e;null!=u&&++oi?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=r(i);++o>>1,s=e[i];null!==s&&!ca(s)&&(n?s<=t:s=200){var l=t?null:Ko(e);if(l)return fn(l);s=!1,o=$t,u=new Gn}else u=t?[]:a;e:for(;++r=r?e:oo(e,t,n)}var Ao=vt||function(e){return dt.clearTimeout(e)};function ko(e,t){if(t)return e.slice();var n=e.length,r=Ye?Ye(n):new e.constructor(n);return e.copy(r),r}function So(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function Bo(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function To(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,s=ca(e),a=t!==i,u=null===t,l=t==t,c=ca(t);if(!u&&!c&&!s&&e>t||s&&a&&l&&!u&&!c||r&&a&&l||!n&&l||!o)return 1;if(!r&&!s&&!c&&e1?n[o-1]:i,a=o>2?n[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&wi(n[0],n[1],a)&&(s=o<3?i:s,o=1),t=Te(t);++r-1?o[s?t[a]:a]:i}}function Mo(e){return oi((function(t){var n=t.length,r=n,o=Wn.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new Re(s);if(o&&!u&&"wrapper"==ui(a))var u=new Wn([],!0)}for(r=u?r:n;++r1&&g.reverse(),p&&cu))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var f=-1,v=!0,p=2&n?new Gn:i;for(s.set(e,t),s.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Tt(y,(function(n){var r="_."+n[0];t&n[1]&&!zt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(fe);return t?t[1].split(ve):[]}(r),n)))}function Ii(e){var t=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ji(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,as(e,n)}));function ds(e){var t=Mn(e);return t.__chain__=!0,t}function hs(e,t){return t(e)}var js=oi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ar(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Pn&&bi(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:hs,args:[o],thisArg:i}),new Wn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)}));var ms=Eo((function(e,t,n){Je.call(e,n)?++e[n]:sr(e,n,1)}));var ys=Do(Pi),gs=Do(Hi);function bs(e,t){return(Hs(e)?Tt:pr)(e,ci(t,3))}function ws(e,t){return(Hs(e)?Ot:dr)(e,ci(t,3))}var _s=Eo((function(e,t,n){Je.call(e,n)?e[n].push(t):sr(e,n,[t])}));var xs=Kr((function(e,t,n){var o=-1,i="function"==typeof t,s=Qs(e)?r(e.length):[];return pr(e,(function(e){s[++o]=i?St(t,e,n):Rr(e,t,n)})),s})),As=Eo((function(e,t,n){sr(e,n,t)}));function ks(e,t){return(Hs(e)?Ft:Dr)(e,ci(t,3))}var Ss=Eo((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Bs=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&wi(e,t[0],t[1])?t=[]:n>2&&wi(t[0],t[1],t[2])&&(t=[t[0]]),Pr(e,yr(t,1),[])})),Ts=pt||function(){return dt.Date.now()};function Os(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,$o(e,v,i,i,i,i,t)}function Cs(e,t){var n;if("function"!=typeof t)throw new Re(s);return e=ja(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Rs=Kr((function(e,t,n){var r=1;if(n.length){var o=cn(n,li(Rs));r|=c}return $o(e,r,t,n,o)})),zs=Kr((function(e,t,n){var r=3;if(n.length){var o=cn(n,li(zs));r|=c}return $o(t,r,e,n,o)}));function Es(e,t,n){var r,o,a,u,l,c,f=0,v=!1,p=!1,d=!0;if("function"!=typeof e)throw new Re(s);function h(t){var n=r,s=o;return r=o=i,f=t,u=e.apply(s,n)}function j(e){return f=e,l=Ei(y,t),v?h(e):u}function m(e){var n=e-c;return c===i||n>=t||n<0||p&&e-f>=a}function y(){var e=Ts();if(m(e))return g(e);l=Ei(y,function(e){var n=t-(e-c);return p?bn(n,a-(e-f)):n}(e))}function g(e){return l=i,d&&r?h(e):(r=o=i,u)}function b(){var e=Ts(),n=m(e);if(r=arguments,o=this,c=e,n){if(l===i)return j(c);if(p)return l=Ei(y,t),h(c)}return l===i&&(l=Ei(y,t)),u}return t=ya(t)||0,na(n)&&(v=!!n.leading,a=(p="maxWait"in n)?gn(ya(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),b.cancel=function(){l!==i&&Ao(l),f=0,r=c=o=l=i},b.flush=function(){return l===i?u:g(Ts())},b}var Fs=Kr((function(e,t){return fr(e,1,t)})),Ls=Kr((function(e,t,n){return fr(e,ya(t)||0,n)}));function Is(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Re(s);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Is.Cache||Qn),n}function Js(e){if("function"!=typeof e)throw new Re(s);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Is.Cache=Qn;var Us=_o((function(e,t){var n=(t=1==t.length&&Hs(t[0])?Ft(t[0],Kt(ci())):Ft(yr(t,1),Kt(ci()))).length;return Kr((function(r){for(var o=-1,i=bn(r.length,n);++o=t})),Ps=zr(function(){return arguments}())?zr:function(e){return ra(e)&&Je.call(e,"callee")&&!Ze.call(e,"callee")},Hs=r.isArray,Ys=bt?Kt(bt):function(e){return ra(e)&&Sr(e)==L};function Qs(e){return null!=e&&ta(e.length)&&!$s(e)}function Gs(e){return ra(e)&&Qs(e)}var Zs=qt||yu,Ks=wt?Kt(wt):function(e){return ra(e)&&Sr(e)==_};function Xs(e){if(!ra(e))return!1;var t=Sr(e);return t==x||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sa(e)}function $s(e){if(!na(e))return!1;var t=Sr(e);return t==A||t==k||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ea(e){return"number"==typeof e&&e==ja(e)}function ta(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function na(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ra(e){return null!=e&&"object"==typeof e}var oa=_t?Kt(_t):function(e){return ra(e)&&ji(e)==S};function ia(e){return"number"==typeof e||ra(e)&&Sr(e)==B}function sa(e){if(!ra(e)||Sr(e)!=T)return!1;var t=Qe(e);if(null===t)return!0;var n=Je.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ie.call(n)==Me}var aa=xt?Kt(xt):function(e){return ra(e)&&Sr(e)==C};var ua=At?Kt(At):function(e){return ra(e)&&ji(e)==R};function la(e){return"string"==typeof e||!Hs(e)&&ra(e)&&Sr(e)==z}function ca(e){return"symbol"==typeof e||ra(e)&&Sr(e)==E}var fa=kt?Kt(kt):function(e){return ra(e)&&ta(e.length)&&!!at[Sr(e)]};var va=Qo(qr),pa=Qo((function(e,t){return e<=t}));function da(e){if(!e)return[];if(Qs(e))return la(e)?dn(e):Ro(e);if(tt&&e[tt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[tt]());var t=ji(e);return(t==S?un:t==R?fn:Na)(e)}function ha(e){return e?(e=ya(e))===d||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ja(e){var t=ha(e),n=t%1;return t==t?n?t-n:t:0}function ma(e){return e?ur(ja(e),0,m):0}function ya(e){if("number"==typeof e)return e;if(ca(e))return j;if(na(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=na(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(ae,"");var n=ye.test(e);return n||be.test(e)?ft(e.slice(2),n?2:8):me.test(e)?j:+e}function ga(e){return zo(e,Fa(e))}function ba(e){return null==e?"":co(e)}var wa=Fo((function(e,t){if(ki(t)||Qs(t))zo(t,Ea(t),e);else for(var n in t)Je.call(t,n)&&nr(e,n,t[n])})),_a=Fo((function(e,t){zo(t,Fa(t),e)})),xa=Fo((function(e,t,n,r){zo(t,Fa(t),e,r)})),Aa=Fo((function(e,t,n,r){zo(t,Ea(t),e,r)})),ka=oi(ar);var Sa=Kr((function(e,t){e=Te(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&wi(t[0],t[1],o)&&(r=1);++n1),t})),zo(e,si(e),n),r&&(n=lr(n,7,ni));for(var o=t.length;o--;)vo(n,t[o]);return n}));var Ua=oi((function(e,t){return null==e?{}:function(e,t){return Hr(e,t,(function(t,n){return Oa(e,n)}))}(e,t)}));function qa(e,t){if(null==e)return{};var n=Ft(si(e),(function(e){return[e]}));return t=ci(t),Hr(e,n,(function(e,n){return t(e,n[0])}))}var Da=Xo(Ea),Ma=Xo(Fa);function Na(e){return null==e?[]:Xt(e,Ea(e))}var Va=Uo((function(e,t,n){return t=t.toLowerCase(),e+(n?Wa(t):t)}));function Wa(e){return Xa(ba(e).toLowerCase())}function Pa(e){return(e=ba(e))&&e.replace(_e,rn).replace(et,"")}var Ha=Uo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ya=Uo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Qa=Jo("toLowerCase");var Ga=Uo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Za=Uo((function(e,t,n){return e+(n?" ":"")+Xa(t)}));var Ka=Uo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xa=Jo("toUpperCase");function $a(e,t,n){return e=ba(e),(t=n?i:t)===i?function(e){return ot.test(e)}(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.match(pe)||[]}(e):e.match(t)||[]}var eu=Kr((function(e,t){try{return St(e,i,t)}catch(e){return Xs(e)?e:new ke(e)}})),tu=oi((function(e,t){return Tt(t,(function(t){t=qi(t),sr(e,t,Rs(e[t],e))})),e}));function nu(e){return function(){return e}}var ru=Mo(),ou=Mo(!0);function iu(e){return e}function su(e){return Ir("function"==typeof e?e:lr(e,1))}var au=Kr((function(e,t){return function(n){return Rr(n,e,t)}})),uu=Kr((function(e,t){return function(n){return Rr(e,n,t)}}));function lu(e,t,n){var r=Ea(t),o=xr(t,r);null!=n||na(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=xr(t,Ea(t)));var i=!(na(n)&&"chain"in n&&!n.chain),s=$s(e);return Tt(o,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),o=n.__actions__=Ro(this.__actions__);return o.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Lt([this.value()],arguments))})})),e}function cu(){}var fu=Po(Ft),vu=Po(Ct),pu=Po(Ut);function du(e){return _i(e)?Ht(qi(e)):function(e){return function(t){return Ar(t,e)}}(e)}var hu=Yo(),ju=Yo(!0);function mu(){return[]}function yu(){return!1}var gu=Wo((function(e,t){return e+t}),0),bu=Zo("ceil"),wu=Wo((function(e,t){return e/t}),1),_u=Zo("floor");var xu,Au=Wo((function(e,t){return e*t}),1),ku=Zo("round"),Su=Wo((function(e,t){return e-t}),0);return Mn.after=function(e,t){if("function"!=typeof t)throw new Re(s);return e=ja(e),function(){if(--e<1)return t.apply(this,arguments)}},Mn.ary=Os,Mn.assign=wa,Mn.assignIn=_a,Mn.assignInWith=xa,Mn.assignWith=Aa,Mn.at=ka,Mn.before=Cs,Mn.bind=Rs,Mn.bindAll=tu,Mn.bindKey=zs,Mn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Hs(e)?e:[e]},Mn.chain=ds,Mn.chunk=function(e,t,n){t=(n?wi(e,t,n):t===i)?1:gn(ja(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,u=r(jt(o/t));so?0:o+n),(r=r===i||r>o?o:ja(r))<0&&(r+=o),r=n>r?0:ma(r);n>>0)?(e=ba(e))&&("string"==typeof t||null!=t&&!aa(t))&&!(t=co(t))&&an(e)?xo(dn(e),0,n):e.split(t,n):[]},Mn.spread=function(e,t){if("function"!=typeof e)throw new Re(s);return t=null==t?0:gn(ja(t),0),Kr((function(n){var r=n[t],o=xo(n,0,t);return r&&Lt(o,r),St(e,this,o)}))},Mn.tail=function(e){var t=null==e?0:e.length;return t?oo(e,1,t):[]},Mn.take=function(e,t,n){return e&&e.length?oo(e,0,(t=n||t===i?1:ja(t))<0?0:t):[]},Mn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=r-(t=n||t===i?1:ja(t)))<0?0:t,r):[]},Mn.takeRightWhile=function(e,t){return e&&e.length?ho(e,ci(t,3),!1,!0):[]},Mn.takeWhile=function(e,t){return e&&e.length?ho(e,ci(t,3)):[]},Mn.tap=function(e,t){return t(e),e},Mn.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Re(s);return na(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Es(e,t,{leading:r,maxWait:t,trailing:o})},Mn.thru=hs,Mn.toArray=da,Mn.toPairs=Da,Mn.toPairsIn=Ma,Mn.toPath=function(e){return Hs(e)?Ft(e,qi):ca(e)?[e]:Ro(Ui(ba(e)))},Mn.toPlainObject=ga,Mn.transform=function(e,t,n){var r=Hs(e),o=r||Zs(e)||fa(e);if(t=ci(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:na(e)&&$s(i)?Nn(Qe(e)):{}}return(o?Tt:wr)(e,(function(e,r,o){return t(n,e,r,o)})),n},Mn.unary=function(e){return Os(e,1)},Mn.union=rs,Mn.unionBy=os,Mn.unionWith=is,Mn.uniq=function(e){return e&&e.length?fo(e):[]},Mn.uniqBy=function(e,t){return e&&e.length?fo(e,ci(t,2)):[]},Mn.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?fo(e,i,t):[]},Mn.unset=function(e,t){return null==e||vo(e,t)},Mn.unzip=ss,Mn.unzipWith=as,Mn.update=function(e,t,n){return null==e?e:po(e,t,bo(n))},Mn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:po(e,t,bo(n),r)},Mn.values=Na,Mn.valuesIn=function(e){return null==e?[]:Xt(e,Fa(e))},Mn.without=us,Mn.words=$a,Mn.wrap=function(e,t){return qs(bo(t),e)},Mn.xor=ls,Mn.xorBy=cs,Mn.xorWith=fs,Mn.zip=vs,Mn.zipObject=function(e,t){return yo(e||[],t||[],nr)},Mn.zipObjectDeep=function(e,t){return yo(e||[],t||[],eo)},Mn.zipWith=ps,Mn.entries=Da,Mn.entriesIn=Ma,Mn.extend=_a,Mn.extendWith=xa,lu(Mn,Mn),Mn.add=gu,Mn.attempt=eu,Mn.camelCase=Va,Mn.capitalize=Wa,Mn.ceil=bu,Mn.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ya(n))==n?n:0),t!==i&&(t=(t=ya(t))==t?t:0),ur(ya(e),t,n)},Mn.clone=function(e){return lr(e,4)},Mn.cloneDeep=function(e){return lr(e,5)},Mn.cloneDeepWith=function(e,t){return lr(e,5,t="function"==typeof t?t:i)},Mn.cloneWith=function(e,t){return lr(e,4,t="function"==typeof t?t:i)},Mn.conformsTo=function(e,t){return null==t||cr(e,t,Ea(t))},Mn.deburr=Pa,Mn.defaultTo=function(e,t){return null==e||e!=e?t:e},Mn.divide=wu,Mn.endsWith=function(e,t,n){e=ba(e),t=co(t);var r=e.length,o=n=n===i?r:ur(ja(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Mn.eq=Ns,Mn.escape=function(e){return(e=ba(e))&&X.test(e)?e.replace(Z,on):e},Mn.escapeRegExp=function(e){return(e=ba(e))&&se.test(e)?e.replace(ie,"\\$&"):e},Mn.every=function(e,t,n){var r=Hs(e)?Ct:hr;return n&&wi(e,t,n)&&(t=i),r(e,ci(t,3))},Mn.find=ys,Mn.findIndex=Pi,Mn.findKey=function(e,t){return Dt(e,ci(t,3),wr)},Mn.findLast=gs,Mn.findLastIndex=Hi,Mn.findLastKey=function(e,t){return Dt(e,ci(t,3),_r)},Mn.floor=_u,Mn.forEach=bs,Mn.forEachRight=ws,Mn.forIn=function(e,t){return null==e?e:gr(e,ci(t,3),Fa)},Mn.forInRight=function(e,t){return null==e?e:br(e,ci(t,3),Fa)},Mn.forOwn=function(e,t){return e&&wr(e,ci(t,3))},Mn.forOwnRight=function(e,t){return e&&_r(e,ci(t,3))},Mn.get=Ta,Mn.gt=Vs,Mn.gte=Ws,Mn.has=function(e,t){return null!=e&&mi(e,t,Tr)},Mn.hasIn=Oa,Mn.head=Qi,Mn.identity=iu,Mn.includes=function(e,t,n,r){e=Qs(e)?e:Na(e),n=n&&!r?ja(n):0;var o=e.length;return n<0&&(n=gn(o+n,0)),la(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Nt(e,t,n)>-1},Mn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ja(n);return o<0&&(o=gn(r+o,0)),Nt(e,t,o)},Mn.inRange=function(e,t,n){return t=ha(t),n===i?(n=t,t=0):n=ha(n),function(e,t,n){return e>=bn(t,n)&&e=-9007199254740991&&e<=h},Mn.isSet=ua,Mn.isString=la,Mn.isSymbol=ca,Mn.isTypedArray=fa,Mn.isUndefined=function(e){return e===i},Mn.isWeakMap=function(e){return ra(e)&&ji(e)==F},Mn.isWeakSet=function(e){return ra(e)&&"[object WeakSet]"==Sr(e)},Mn.join=function(e,t){return null==e?"":mn.call(e,t)},Mn.kebabCase=Ha,Mn.last=Xi,Mn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ja(n))<0?gn(r+o,0):bn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Mt(e,Wt,o,!0)},Mn.lowerCase=Ya,Mn.lowerFirst=Qa,Mn.lt=va,Mn.lte=pa,Mn.max=function(e){return e&&e.length?jr(e,iu,Br):i},Mn.maxBy=function(e,t){return e&&e.length?jr(e,ci(t,2),Br):i},Mn.mean=function(e){return Pt(e,iu)},Mn.meanBy=function(e,t){return Pt(e,ci(t,2))},Mn.min=function(e){return e&&e.length?jr(e,iu,qr):i},Mn.minBy=function(e,t){return e&&e.length?jr(e,ci(t,2),qr):i},Mn.stubArray=mu,Mn.stubFalse=yu,Mn.stubObject=function(){return{}},Mn.stubString=function(){return""},Mn.stubTrue=function(){return!0},Mn.multiply=Au,Mn.nth=function(e,t){return e&&e.length?Wr(e,ja(t)):i},Mn.noConflict=function(){return dt._===this&&(dt._=Ne),this},Mn.noop=cu,Mn.now=Ts,Mn.pad=function(e,t,n){e=ba(e);var r=(t=ja(t))?pn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Ho(yt(o),n)+e+Ho(jt(o),n)},Mn.padEnd=function(e,t,n){e=ba(e);var r=(t=ja(t))?pn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=xn();return bn(e+o*(t-e+ct("1e-"+((o+"").length-1))),t)}return Gr(e,t)},Mn.reduce=function(e,t,n){var r=Hs(e)?It:Qt,o=arguments.length<3;return r(e,ci(t,4),n,o,pr)},Mn.reduceRight=function(e,t,n){var r=Hs(e)?Jt:Qt,o=arguments.length<3;return r(e,ci(t,4),n,o,dr)},Mn.repeat=function(e,t,n){return t=(n?wi(e,t,n):t===i)?1:ja(t),Zr(ba(e),t)},Mn.replace=function(){var e=arguments,t=ba(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Mn.result=function(e,t,n){var r=-1,o=(t=wo(t,e)).length;for(o||(o=1,e=i);++rh)return[];var n=m,r=bn(e,m);t=ci(t),e-=m;for(var o=Zt(r,t);++n=s)return e;var u=n-pn(r);if(u<1)return r;var l=a?xo(a,0,u).join(""):e.slice(0,u);if(o===i)return l+r;if(a&&(u+=l.length-u),aa(o)){if(e.slice(u).search(o)){var c,f=l;for(o.global||(o=Oe(o.source,ba(je.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var v=c.index;l=l.slice(0,v===i?u:v)}}else if(e.indexOf(co(o),u)!=u){var p=l.lastIndexOf(o);p>-1&&(l=l.slice(0,p))}return l+r},Mn.unescape=function(e){return(e=ba(e))&&K.test(e)?e.replace(G,hn):e},Mn.uniqueId=function(e){var t=++Ue;return ba(e)+t},Mn.upperCase=Ka,Mn.upperFirst=Xa,Mn.each=bs,Mn.eachRight=ws,Mn.first=Qi,lu(Mn,(xu={},wr(Mn,(function(e,t){Je.call(Mn.prototype,t)||(xu[t]=e)})),xu),{chain:!1}),Mn.VERSION="4.17.11",Tt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mn[e].placeholder=Mn})),Tt(["drop","take"],(function(e,t){Pn.prototype[e]=function(n){n=n===i?1:gn(ja(n),0);var r=this.__filtered__&&!t?new Pn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,m),type:e+(r.__dir__<0?"Right":"")}),r},Pn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Tt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Pn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ci(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Tt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Pn.prototype[e]=function(){return this[n](1).value()[0]}})),Tt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Pn.prototype[e]=function(){return this.__filtered__?new Pn(this):this[n](1)}})),Pn.prototype.compact=function(){return this.filter(iu)},Pn.prototype.find=function(e){return this.filter(e).head()},Pn.prototype.findLast=function(e){return this.reverse().find(e)},Pn.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Pn(this):this.map((function(n){return Rr(n,e,t)}))})),Pn.prototype.reject=function(e){return this.filter(Js(ci(e)))},Pn.prototype.slice=function(e,t){e=ja(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Pn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ja(t))<0?n.dropRight(-t):n.take(t-e)),n)},Pn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Pn.prototype.toArray=function(){return this.take(m)},wr(Pn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Mn[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);o&&(Mn.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,u=t instanceof Pn,l=a[0],c=u||Hs(t),f=function(e){var t=o.apply(Mn,Lt([e],a));return r&&v?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var v=this.__chain__,p=!!this.__actions__.length,d=s&&!v,h=u&&!p;if(!s&&c){t=h?t:new Pn(this);var j=e.apply(t,a);return j.__actions__.push({func:hs,args:[f],thisArg:i}),new Wn(j,v)}return d&&h?e.apply(this,a):(j=this.thru(f),d?r?j.value()[0]:j.value():j)})})),Tt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ze[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Mn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Hs(o)?o:[],e)}return this[n]((function(n){return t.apply(Hs(n)?n:[],e)}))}})),wr(Pn.prototype,(function(e,t){var n=Mn[t];if(n){var r=n.name+"";(zn[r]||(zn[r]=[])).push({name:t,func:n})}})),zn[No(i,2).name]=[{name:"wrapper",func:i}],Pn.prototype.clone=function(){var e=new Pn(this.__wrapped__);return e.__actions__=Ro(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ro(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ro(this.__views__),e},Pn.prototype.reverse=function(){if(this.__filtered__){var e=new Pn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Pn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Hs(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Mn.prototype.plant=function(e){for(var t,n=this;n instanceof Vn;){var r=Mi(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Mn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Pn){var t=e;return this.__actions__.length&&(t=new Pn(this)),(t=t.reverse()).__actions__.push({func:hs,args:[ns],thisArg:i}),new Wn(t,this.__chain__)}return this.thru(ns)},Mn.prototype.toJSON=Mn.prototype.valueOf=Mn.prototype.value=function(){return jo(this.__wrapped__,this.__actions__)},Mn.prototype.first=Mn.prototype.head,tt&&(Mn.prototype[tt]=function(){return this}),Mn}();dt._=jn,(o=function(){return jn}.call(t,n,t,r))===i||(r.exports=o)}).call(this)}).call(this,n("yLpj"),n("YuTi")(e))},MLWZ:function(e,t,n){"use strict";var r=n("xTJ+");function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)&&(t+="[]"),r.isArray(e)||(e=[e]),r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}return i&&(e+=(-1===e.indexOf("?")?"?":"&")+i),e}},OH9c:function(e,t,n){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e}},OKyS:function(e,t,n){var r=n("LboF"),o=n("8MIm");"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};r(o,i);e.exports=o.locals||{}},OTTw:function(e,t,n){"use strict";var r=n("xTJ+");e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},"Rn+g":function(e,t,n){"use strict";var r=n("LYNF");e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},UBF9:function(e,t,n){"use strict";var r=n("8eWk");n.n(r).a},UnBK:function(e,t,n){"use strict";var r=n("xTJ+"),o=n("xAGQ"),i=n("Lmem"),s=n("JEQr"),a=n("2SVd"),u=n("5oMp");function l(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return l(e),e.baseURL&&!a(e.url)&&(e.url=u(e.baseURL,e.url)),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return l(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(l(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},YuTi:function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},endd:function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},eqyj:function(e,t,n){"use strict";var r=n("xTJ+");e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},"jfS+":function(e,t,n){"use strict";var r=n("endd");function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},n6bm:function(e,t,n){"use strict";function r(){this.message="String contains an invalid character"}r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=function(e){for(var t,n,o=String(e),i="",s=0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.charAt(0|s)||(a="=",s%1);i+=a.charAt(63&t>>8-s%1*8)){if((n=o.charCodeAt(s+=3/4))>255)throw new r;t=t<<8|n}return i}},qFNJ:function(e,t,n){(e.exports=n("I1BE")(void 0)).push([e.i,'.video-wrapper .show-time .video-js .vjs-time-control:not(.vjs-remaining-time){padding-left:.5em;padding-right:0;min-width:0;display:block}.video-wrapper .video-js .vjs-remaining-time{display:none}.video-wrapper .live .vjs-progress-control{visibility:hidden}.video-wrapper .av-loading .vjs-big-play-button,.video-wrapper .live .vjs-remaining-time,.video-wrapper .live .vjs-time-control{display:none}.video-wrapper .hide-big-play-button .vjs-big-play-button,.video-wrapper .hide-controls .vjs-control-bar,.video-wrapper .hide-fluent-button .live-player-fluent-btn,.video-wrapper .hide-fullscreen-button .vjs-fullscreen-control,.video-wrapper .hide-pic-in-pic .video-js .vjs-picture-in-picture-control,.video-wrapper .hide-snapshot-button .vjs-snapshot-control,.video-wrapper .hide-stretch-button .live-player-stretch-btn,.video-wrapper .hide-waiting .vjs-seeking .vjs-loading-spinner,.video-wrapper .hide-waiting .vjs-waiting .vjs-loading-spinner{display:none!important}.video-wrapper .alt{position:absolute;left:0;top:0;right:0;bottom:0;vertical-align:middle;background-repeat:no-repeat;background-position:50% 50%;background-size:contain;background-color:#000;color:#fff;text-align:center}.video-wrapper .alt>table{width:100%;height:100%}.video-wrapper .alt>table tr>td{vertical-align:middle}.video-wrapper .video-js .video-slot{font-size:14px}.video-wrapper .video-js .video-title{font-size:14px;position:absolute;top:5px;right:5px;color:#fff;background-color:hsla(0,0%,50%,.5);border-radius:2px;padding:5px;max-width:120px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.video-wrapper .video-js .vjs-control-bar .vjs-button{cursor:pointer;outline:none}.video-wrapper .video-js .vjs-control-bar .vjs-icon-spinner:before{font-size:1.4em;line-height:1.87}.video-wrapper .vjs-error-display{display:none}.video-wrapper .video-js .vjs-time-control{font-size:1.035em;line-height:2.93em}.video-wrapper .vjs-resolution-button{color:#ccc;font-family:VideoJS}.video-wrapper .vjs-resolution-button .vjs-resolution-button-staticlabel:before{content:"\\F110";font-size:1.8em;line-height:1.7em}.video-wrapper .vjs-resolution-button .vjs-resolution-button-label{width:100%;height:.6em;display:block!important}.video-wrapper .vjs-resolution-button .vjs-resolution-button-label-ie{width:100%;height:.4em;display:block!important}.video-wrapper .vjs-resolution-button ul.vjs-menu-content{width:4em!important}.video-wrapper .vjs-resolution-button .vjs-menu{left:0}.video-wrapper .vjs-resolution-button .vjs-menu li{text-transform:none;font-size:1em;line-height:1.5em;font-family:Arial,Helvetica,sans-serif}.video-wrapper .vjs-audio-button{display:none!important}.video-wrapper .video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-wrapper .vjs-button>.vjs-icon-placeholder:before{position:relative!important}.video-wrapper .video-js .vjs-play-progress:before{top:-.33em!important}@media screen and (-webkit-min-device-pixel-ratio:0){.video-wrapper .video-js .vjs-control-bar{font-size:14px}.video-wrapper .video-js .vjs-slider-vertical .vjs-volume-level:before{left:-.33em!important}}.video-wrapper.video-wrapper-stretch .alt,.video-wrapper.video-wrapper-stretch .video-js .vjs-poster{background-size:100% 100%}',""])},qtAY:function(e,t,n){"use strict";n.r(t);n("OKyS");var r=n("LvDl"),o=n.n(r),i=n("vDqi"),s=n.n(i),a=n("Iab2"),u=n.n(a);videojs.options.controlBar={volumePanel:{inline:!1}},videojs.options.flash.swf="liveplayer.swf",videojs.options.techOrder=["html5","flash"],videojs.browser.IE_VERSION&&videojs.browser.IE_VERSION<11&&(videojs.options.techOrder=["flash","html5"]),videojs.log.level("off"),flvjs.LoggingControl.enableAll=!1;var l={name:"live-player",data:function(){return{player:null,timer:0,fluentBtnCls:"live-player-fluent-btn",stretchBtnCls:"live-player-stretch-btn",snapFromOutside:!1,snapForPoster:!1,snapForReload:!1,showSlot:!1,fluent_:!0,muted_:!0,stretch_:!1,poster_:"",avLoading:!1,resolutionName:{sd:"标清",hd:"高清",fhd:"超清",yh:"原画"},playbackRate_:1}},props:{videoUrl:{type:String,default:""},videoTitle:{type:String,default:""},poster:{default:""},autoplay:{type:Boolean,default:!0},live:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},currentTime:{type:Number,default:0},timeout:{type:Number,default:20},alt:{type:String,default:"无信号"},muted:{type:Boolean,default:!0},aspect:{type:String,default:"16:9"},videoBufferSize:{type:Number,default:204800},audioBufferSize:{type:Number,default:131072},hlsErrorSeek:{type:Number,default:3},pauseWhenHidden:{type:Boolean,default:!0},fluent:{type:Boolean,default:!0},stretch:{type:Boolean,default:!1},loop:{type:Boolean,default:!1},controls:{type:Boolean,default:!0},hideBigPlayButton:{type:Boolean,default:!1},hideSnapshotButton:{type:Boolean,default:!1},hideFullscreenButton:{type:Boolean,default:!1},hideFluentButton:{type:Boolean,default:!1},hideStretchButton:{type:Boolean,default:!1},hidePicInPic:{type:Boolean,default:!0},hideWaiting:{type:Boolean,default:!0},showTime:{type:Boolean,default:function(){return!videojs.browser.IS_IOS&&!videojs.browser.IS_ANDROID}},showCustomButton:{type:Boolean,default:!0},debug:{type:Boolean,default:!1},hasvideo:{type:Boolean,default:void 0},hasaudio:{type:Boolean,default:void 0},resolution:{type:String,default:""},resolutiondefault:{type:String,default:"hd"},reconnect:{type:Boolean,default:!1},playbackRates:{type:Array,default:function(){return videojs.browser.IS_IOS||videojs.browser.IS_ANDROID?[]:[.5,1,2,3]}},playbackRate:{type:Number,default:1},cors:{type:Boolean,default:!0},withCredentials:{type:Boolean,default:!1}},beforeDestroy:function(){this.destroyVideoJS()},deactivated:function(){this.destroyVideoJS()},watch:{videoUrl:function(e){this.reload()},fluent:function(e){this.fluent_=e,this.reload()},muted:function(e){this.muted_=e,this.reload()},stretch:function(e){this.stretch_=e,this.reload()},poster:function(e){this.poster_=e},loop:function(e){this.reload()},currentTime:function(e){this.player&&this.player.currentTime(e)}},mounted:function(){flvjs.reconnect=this.reconnect,this.muted_=this.muted,this.fluent_=this.fluent,this.stretch_=this.stretch,this.poster_=this.poster,this.playbackRate_=this.playbackRate,this.debug&&(videojs.log.level("info"),flvjs.LoggingControl.enableAll=!0),this.initVideoJS()},computed:{videoType:function(){var e="video/mp4";return this.rtmp?e="rtmp/mp4":(this.http||this.ws)&&this.flv?e="video/x-flv":this.m3u8&&(e="application/x-mpegURL"),e},videoWrapperStyle:function(){if("100%"==this.aspect||"fullscreen"==this.aspect)return{width:"100%",height:"100%"};var e=this.aspect.split(":"),t=parseInt(e[0])||16;return{paddingBottom:(parseInt(e[1])||9)/t*100+"%",position:"relative",margin:"0 auto",overflow:"hidden"}},rtmp:function(){return 0==(this.src||"").indexOf("rtmp")},http:function(){return 0==(this.src||"").indexOf("http")},ws:function(){return 0==(this.src||"").indexOf("ws")},mp4:function(){return/\.mp4.*$/.test(this.src||"")},m3u8:function(){return/\.m3u8.*$/.test(this.src||"")},flv:function(){return/\.flv.*$/.test(this.src||"")},src:function(){return this.videoUrl?0===this.videoUrl.indexOf("//")?location.protocol+this.videoUrl:0===this.videoUrl.indexOf("/")?location.protocol+"//"+location.host+this.videoUrl:this.videoUrl:""},blankHtml:function(){return this.poster_&&this.src?'\n
\n
\n ":'\n
\n \n \n \n \n
'+this.alt+"
\n
\n "},videoHtml:function(){return this.src?this.rtmp||this.http||this.flv||this.mp4?'\n \n ':'\n \n ':this.blankHtml}},methods:{isMobile:function(){return videojs.browser.IS_IOS||videojs.browser.IS_ANDROID},hasUsableSWF:function(){return!!(void 0!==window.ActiveXObject?new ActiveXObject("ShockwaveFlash.ShockwaveFlash"):navigator.plugins["Shockwave Flash"])},reload:function(){this.destroyVideoJS(),this.initVideoJS()},loadResolutionlist:function(e){if(""!=this.resolution){for(var t,n=this.resolution.split(","),r=[],o=0;o0?t[0]:null},customFlashButton:function(){var e=this;if(!this.getCustomBtn(this.fluentBtnCls)){var t=this.player.controlBar.addChild("button");t.el_.classList.add(this.fluentBtnCls),t.el_.innerText=this.fluent_?"流畅":"极速",t.el_.title=this.fluent_?"点击切换到极速播放":"点击切换到流畅播放";var n=function(){e.fluent_=!e.fluent_,t.el_.innerText=e.fluent_?"流畅":"极速",t.el_.title=e.fluent_?"点击切换到极速播放":"点击切换到流畅播放",e.player.tech_.setFluent(e.fluent_)};t.on("click",n),t.on("tap",n)}if(!this.getCustomBtn(this.stretchBtnCls)){var r=this.player.controlBar.addChild("button");r.el_.classList.add(this.stretchBtnCls),r.el_.innerText=this.stretch_?"拉伸":"标准",r.el_.title=this.stretch_?"点击切换到标准显示":"点击切换到拉伸显示";n=function(){e.stretch_=!e.stretch_,r.el_.innerText=e.stretch_?"拉伸":"标准",r.el_.title=e.stretch_?"点击切换到标准显示":"点击切换到拉伸显示",e.player.tech_.setStretch(e.stretch_)};r.on("click",n),r.on("tap",n)}},customH5Button:function(){var e=this;if(!this.getCustomBtn(this.stretchBtnCls)&&!videojs.browser.IE_VERSION){var t=this.player.controlBar.addChild("button");t.el_.classList.add(this.stretchBtnCls),t.el_.innerText=this.stretch_?"拉伸":"标准",t.el_.title=this.stretch_?"点击切换到标准显示":"点击切换到拉伸显示";var n=function(){e.stretch_=!e.stretch_,t.el_.innerText=e.stretch_?"拉伸":"标准",t.el_.title=e.stretch_?"点击切换到标准显示":"点击切换到拉伸显示";var n=e.$el.querySelector("video");n?n.style.objectFit=e.stretch_?"fill":"":e.player.tech_.setStretch(e.stretch_)};t.on("click",n),t.on("tap",n)}},destroyVideoJS:function(){this.showSlot=!1;var e=this.$el.querySelector(".video-js"),t=this.$el.querySelector(".video-wrapper");if(e&&t){var n=e.querySelector(".video-slot");n&&(e.removeChild(n),t.appendChild(n));var r=e.querySelector(".video-title");r&&(e.removeChild(r),t.appendChild(r))}this.player&&this.player.dispose&&(this.player.dispose(),this.player=null),this.player&&this.player.destroy&&(this.player.destroy(),this.player=null),this.timer&&(clearInterval(this.timer),this.timer=0),this.$el.querySelector(".video-inner").innerHTML=this.blankHtml,this.$emit("update:loading",!1)},getCurrentTime:function(){return this.player&&"function"==typeof this.player.currentTime?this.player.currentTime():-1},snap:function(){this.player&&this.player.cameraButton&&(this.snapFromOutside=!0,this.player.cameraButton.el().click())},play:function(){this.player&&this.player.play()},pause:function(){this.player&&this.player.pause()},paused:function(){return!!this.player&&this.player.paused()},setMuted:function(e){this.player&&this.player.muted(!!e)},getMuted:function(){return!!this.player&&this.player.muted()},setVolume:function(e){this.player&&this.player.volume(e)},getVolume:function(){return this.player?this.player.volume():0},isFullscreen:function(){return!!this.player&&this.player.isFullscreen()},requestFullscreen:function(){this.player&&this.player.requestFullscreen()},exitFullscreen:function(){this.player&&this.player.exitFullscreen()},toggleFullscreen:function(){this.player&&(this.player.isFullscreen()?this.player.exitFullscreen():this.player.requestFullscreen())},convertDataURIToBinary:function(e){for(var t=";base64,",n=e.indexOf(t)+t.length,r=e.substring(n),o=window.atob(r),i=o.length,s=new Uint8Array(i),a=0;a0&&void 0!==arguments[0]?arguments[0]:"",t="data:",n=";base64,",r=e.indexOf(t);0==r&&(r+=t.length);var o=e.indexOf(n);return r>=0&&o>r?e.substring(r,o):""},saveFile:function(e){if(e&&e.length>100){this.poster_=e;var t=this.$el.querySelector("video");t&&t.setAttribute("poster",e)}if(this.snapFromOutside)return this.$emit("snapOutside",e),this.snapFromOutside=!1,this.snapForPoster=!1,void(this.snapForReload=!1);if(this.snapForPoster)this.snapForPoster=!1;else{if(this.snapForReload)return this.snapForReload=!1,void this.reload();this.$emit("snapInside",e);var n=this.convertDataURIToBinary(e),r=this.convertDataURIToMIME(e),o=".jpg",i=r.indexOf("/");i>0&&(o="."+r.substring(i+1)),u.a.saveAs(new Blob([n],{type:r}),(this.videoTitle||"snap")+o)}},debounceInitVideoJS:o.a.debounce((function(){this.initVideoJS()}),500),initVideoJSOK:function(){var e=this;this.player&&(this.player.muted(this.muted_),this.player.on("pause",(function(){e.$emit("pause",e.player.currentTime())})),this.player.on("snap",(function(t,n){e.saveFile(n)})),this.player.on("volumechange",(function(t,n){e.muted_=e.player.muted()})));var t=this.$el.querySelector(".video-js"),n=this.$el.querySelector(".video-wrapper");if(t&&n){var r=n.querySelector(".video-slot");r&&(n.removeChild(r),t.appendChild(r));var o=n.querySelector(".video-title");o&&(n.removeChild(o),t.appendChild(o))}this.showSlot=!0},initVideoJS:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.$el.querySelector(".video-inner").innerHTML=this.videoHtml,this.src)if(this.rtmp||videojs.browser.IE_VERSION&&this.http&&this.flv){var n=document.title;this.player=videojs(this.$el.querySelector("video"),{notSupportedMessage:"您的浏览器没有安装或开启Flash",tech:["flash"],autoplay:this.autoplay,stretch:this.stretch,fluent:this.fluent,controls:!0}),videojs.browser.IS_SAFARI||this.player.snapshot(),this.player.one("ready",(function(){e.initVideoJSOK(),videojs.browser.IE_VERSION&&e.player.tech_.off("fullscreentoggle"),e.$emit("update:loading",!1),document.title=n,e.player.hotkeys({volumeStep:.1,seekStep:5,enableModifiersForNumbers:!1,enableVolumeScroll:!1}),e.player.on("ended",(function(){e.$emit("ended")})),e.player.on("error",(function(t){e.$emit("error",t)})),e.player.on("timeupdate",(function(){e.$emit("timeupdate",e.player.currentTime())})),e.player.on("playing",(function(){e.$emit("play",e.player.currentTime())})),e.showCustomButton&&e.customFlashButton();var t=e.$el.querySelectorAll(".video-js .vjs-control-bar .vjs-button"),r=!0,o=!1,i=void 0;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done);r=!0){s.value.addEventListener("mouseup",(function(){e.player.focus()}))}}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}if(!e.hasUsableSWF()){var u=e.$el.querySelector(".vjs-poster");u&&(u.style.display="none")}document.getElementsByClassName("vjs-picture-in-picture-control")[0].style.display="none"})),document.title=n,this.player.on("error",(function(t){(t=e.$el.querySelector(".vjs-error .vjs-error-display .vjs-modal-dialog-content")).innerHTML=""+t.textContent+""}))}else if((this.http||this.ws)&&this.flv){var r={isLive:this.live,cors:this.cors,withCredentials:this.withCredentials},o={enableWorker:!1,enableStashBuffer:!1};null!=this.hasaudio&&(r.hasAudio=this.hasaudio),null!=this.hasvideo&&(r.hasVideo=this.hasvideo),this.player=videojs(this.$el.querySelector("video"),{techOrder:["flvjs","html5"],controls:!0,flvjs:{mediaDataSource:r,config:o}}),videojs.browser.IS_SAFARI||this.player.snapshot(),this.player.one("ready",(function(){e.initVideoJSOK(),e.$emit("update:loading",!1),e.stretch_&&(e.player.tech_.el_.style.objectFit="fill"),e.player.hotkeys({volumeStep:.1,seekStep:5,enableModifiersForNumbers:!1,enableVolumeScroll:!1});e.player.tech_.flvPlayer.on("error",(function(t){!function t(n){e.debug,e.live&&e.src&&(e.avLoading=!0,e.player.isFullscreen()?(e.player.tech_.flvPlayer.unload(),e.player.tech_.flvPlayer.detachMediaElement(),e.player.tech_.flvPlayer.destroy(),e.player.tech_.flvPlayer=window.flvjs.createPlayer(Object.assign({},r,{type:void 0===r.type?"flv":r.type,url:e.videoUrl}),o),e.player.tech_.flvPlayer.attachMediaElement(e.player.tech_.el_),e.player.tech_.flvPlayer.on("error",(function(e){t(e)})),e.player.tech_.flvPlayer.load()):!e.snapForReload&&e.player.cameraButton&&(e.snapForReload=!0,e.player.cameraButton.el().click()))}()})),e.player.on("canplay",(function(){e.autoplay&&e.player.tech_.flvPlayer.play().catch((function(){}))})),e.player.on("timeupdate",(function(){var t=e.player.currentTime();!e.snapForPoster&&!e.poster_&&t>2&&e.player.cameraButton&&(e.snapForPoster=!0,e.player.cameraButton.el().click()),e.$emit("timeupdate",t)})),e.player.on("error",(function(t){e.$emit("error",t)})),e.player.on("ended",(function(){e.live&&(e.avLoading=!0,!e.snapForReload&&e.player.cameraButton&&(e.snapForReload=!0,e.player.cameraButton.el().click())),e.$emit("ended")})),e.player.on("playing",(function(){e.avLoading=!1,e.$emit("play",e.player.currentTime())})),e.showCustomButton&&e.customH5Button();var t=e.$el.querySelectorAll(".video-js .vjs-control-bar .vjs-button"),n=!0,i=!1,s=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){a.value.addEventListener("mouseup",(function(){e.player.focus()}))}}catch(e){i=!0,s=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw s}}}))}else if(this.http&&this.m3u8){var i=(new Date).getTime();this.$emit("update:loading",!0),this.avLoading=!0;var a=0,u=function(){var n=document.title;e.player||(""!=e.resolution?(-1==e.resolution.indexOf(e.resolutiondefault)&&(e.resolutiondefault="yh"),e.player=videojs(e.$el.querySelector("video"),{autoplay:e.autoplay,stretch:e.stretch,controls:!0,plugins:{videoJsResolutionSwitcher:{default:e.resolutiondefault,dynamicLabel:!0}},playbackRates:e.live?[]:e.playbackRates}),e.loadResolutionlist(e.player)):e.player=videojs(e.$el.querySelector("video"),{autoplay:e.autoplay,stretch:e.stretch,controls:!0,playbackRates:e.live?[]:e.playbackRates}),e.live||1==e.playbackRate_||e.player.playbackRate(e.playbackRate_),e.player.on("ratechange",(function(){e.playbackRate_=e.player.playbackRate()})),videojs.browser.IS_SAFARI||e.player.snapshot(),e.player.one("ready",(function(){e.initVideoJSOK(),a=setTimeout((function(){e.avLoading=!1,e.$emit("update:loading",!1)}),1e3),document.title=n,e.player.hotkeys({volumeStep:.1,seekStep:5,enableModifiersForNumbers:!1,enableVolumeScroll:!1}),e.player.on("ended",(function(){e.$emit("ended")})),e.player.on("timeupdate",(function(){e.$emit("timeupdate",e.player.currentTime())})),e.player.on("playing",(function(){e.$emit("play",e.player.currentTime())})),e.player.one("error",(function(n,r){a&&(clearTimeout(a),a=0),e.$emit("error",n),e.live?setTimeout((function(){e.destroyVideoJS(),e.initVideoJS()}),1e3):e.hlsErrorSeek>0&&(e.destroyVideoJS(),t+=e.hlsErrorSeek,e.initVideoJS(t))})),document.title=n,e.live?e.player&&e.player.reloadSourceOnError():e.player&&(e.currentTime>0||t>0)&&(videojs.browser.IE_VERSION?e.player.on("loadeddata",(function(){setTimeout((function(){e.player.currentTime(e.currentTime+t)}),500)})):e.isMobile()?setTimeout((function(){var n=e.$el.querySelector("video");n&&(n.currentTime=e.currentTime+t)}),3200):e.player.currentTime(e.currentTime+t)),e.autoplay&&setTimeout((function(){var t=e.$el.querySelector(".vjs-big-play-button");if(t){var n=window.getComputedStyle(t);n&&"block"===n.display&&t.click()}}),2e3),e.showCustomButton&&e.customH5Button();var r=e.$el.querySelectorAll(".video-js .vjs-control-bar .vjs-button"),o=!0,i=!1,s=void 0;try{for(var u,l=r[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){u.value.addEventListener("mouseup",(function(){e.player.focus()}))}}catch(e){i=!0,s=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw s}}})))};this.timer=setInterval((function(){var t=(new Date).getTime();return e.timeout>0&&t-i>1e3*e.timeout?(clearInterval(e.timer),e.timer=0,e.$emit("update:loading",!1),e.avLoading=!1,void e.$emit("message",{type:"error",message:"加载播放资源失败"})):e.src?void s.a.head(e.src).then((function(t){clearInterval(e.timer),e.timer=0,u()})).catch((function(t){e.debug})):(clearInterval(e.timer),e.timer=0,e.$emit("update:loading",!1),void(e.avLoading=!1))}),1e3)}else this.player=videojs(this.$el.querySelector("video"),{autoplay:this.autoplay,stretch:this.stretch,controls:!0,playbackRates:this.live?[]:this.playbackRates}),this.live||1==this.playbackRate_||this.player.playbackRate(this.playbackRate_),this.player.on("ratechange",(function(){e.playbackRate_=e.player.playbackRate()})),videojs.browser.IS_SAFARI||this.player.snapshot(),this.player.one("ready",(function(){e.initVideoJSOK()})),this.player.on("ended",(function(){e.$emit("ended")})),this.player.on("timeupdate",(function(){e.$emit("timeupdate",e.player.currentTime())})),this.player.on("playing",(function(){e.$emit("play",e.player.currentTime())})),this.player.on("error",(function(t){e.$emit("error",t)}))}}};n("UBF9");var c=function(e,t,n,r,o,i,s,a){var u,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),r&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),s?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},l._ssrRegister=u):o&&(u=a?function(){o.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:o),u)if(l.functional){l._injectStyles=u;var c=l.render;l.render=function(e,t){return u.call(t),c(e,t)}}else{var f=l.beforeCreate;l.beforeCreate=f?[].concat(f,u):[u]}return{exports:e,options:l}}(l,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"player-wrapper"},[n("div",{class:["video-wrapper",{"video-wrapper-stretch":this.stretch_}],style:e.videoWrapperStyle},[n("div",{staticClass:"video-inner",class:{live:e.live,"av-loading":e.avLoading,"hide-waiting":e.hideWaiting,"hide-controls":!e.controls,"hide-big-play-button":e.hideBigPlayButton,"hide-snapshot-button":e.hideSnapshotButton,"hide-fullscreen-button":e.hideFullscreenButton,"hide-stretch-button":e.hideStretchButton,"hide-fluent-button":e.hideFluentButton,"hide-pic-in-pic":e.hidePicInPic,"show-time":e.showTime&&!e.live},staticStyle:{position:"absolute",top:"0",bottom:"0",left:"0",right:"0"}}),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.showSlot,expression:"showSlot"}],staticClass:"video-slot"},[e._t("default")],2),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.videoTitle&&e.showSlot,expression:"videoTitle && showSlot"}],staticClass:"video-title",attrs:{title:e.videoTitle}},[e._v(e._s(e.videoTitle))])])])}),[],!1,null,null,null).exports;c.install=function(e){"undefined"!=typeof window&&window.Vue&&(e=window.Vue),e.component(c.name,c)};t.default=c},tQ2B:function(e,t,n){"use strict";var r=n("xTJ+"),o=n("Rn+g"),i=n("MLWZ"),s=n("w0Vi"),a=n("OTTw"),u=n("LYNF"),l="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n("n6bm");e.exports=function(e){return new Promise((function(t,c){var f=e.data,v=e.headers;r.isFormData(f)&&delete v["Content-Type"];var p=new XMLHttpRequest,d="onreadystatechange",h=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in p||a(e.url)||(p=new window.XDomainRequest,d="onload",h=!0,p.onprogress=function(){},p.ontimeout=function(){}),e.auth){var j=e.auth.username||"",m=e.auth.password||"";v.Authorization="Basic "+l(j+":"+m)}if(p.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p[d]=function(){if(p&&(4===p.readyState||h)&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in p?s(p.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:1223===p.status?204:p.status,statusText:1223===p.status?"No Content":p.statusText,headers:n,config:e,request:p};o(t,c,r),p=null}},p.onerror=function(){c(u("Network Error",e,null,p)),p=null},p.ontimeout=function(){c(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var y=n("eqyj"),g=(e.withCredentials||a(e.url))&&e.xsrfCookieName?y.read(e.xsrfCookieName):void 0;g&&(v[e.xsrfHeaderName]=g)}if("setRequestHeader"in p&&r.forEach(v,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete v[t]:p.setRequestHeader(t,e)})),e.withCredentials&&(p.withCredentials=!0),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),c(e),p=null)})),void 0===f&&(f=null),p.send(f)}))}},vDqi:function(e,t,n){e.exports=n("zuR4")},w0Vi:function(e,t,n){"use strict";var r=n("xTJ+"),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},x86X:function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},xAGQ:function(e,t,n){"use strict";var r=n("xTJ+");e.exports=function(e,t,n){return r.forEach(n,(function(n){e=n(e,t)})),e}},"xTJ+":function(e,t,n){"use strict";var r=n("HSsa"),o=n("x86X"),i=Object.prototype.toString;function s(e){return"[object Array]"===i.call(e)}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===i.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var n=0,r=e.length;n1?t-1:0),n=1;n0)for(var n=e.attributes,r=n.length-1;r>=0;r--){var a=n[r].name,s=n[r].value;"boolean"!=typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function O(e,t){return e.getAttribute(t)}function P(e,t,i){e.setAttribute(t,i)}function I(e,t){e.removeAttribute(t)}function R(){t.body.focus(),t.onselectstart=function(){return!1}}function x(){t.onselectstart=function(){return!0}}function D(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(f(e,"height"))),i.width||(i.width=parseFloat(f(e,"width"))),i}}function U(i){var n;if(i.getBoundingClientRect&&i.parentNode&&(n=i.getBoundingClientRect()),!n)return{left:0,top:0};var r=t.documentElement,a=t.body,s=r.clientLeft||a.clientLeft||0,o=e.pageXOffset||a.scrollLeft,u=n.left+o-s,l=r.clientTop||a.clientTop||0,d=e.pageYOffset||a.scrollTop,c=n.top+d-l;return{left:Math.round(u),top:Math.round(c)}}function M(e,t){var i={},n=U(e),r=e.offsetWidth,a=e.offsetHeight,s=n.top,o=n.left,u=t.pageY,l=t.pageX;return t.changedTouches&&(l=t.changedTouches[0].pageX,u=t.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(s-u+a)/a)),i.x=Math.max(0,Math.min(1,(l-o)/r)),i}function B(e){return c(e)&&3===e.nodeType}function j(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function N(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return"function"==typeof e&&(e=e()),y(e)||B(e)?e:"string"==typeof e&&/\S/.test(e)?t.createTextNode(e):void 0}).filter(function(e){return e})}function F(e,t){return N(t).forEach(function(t){return e.appendChild(t)}),e}function V(e,t){return F(j(e),t)}function q(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var H=_("querySelector"),G=_("querySelectorAll"),z=Object.freeze({isReal:g,isEl:y,isInFrame:v,createEl:b,textContent:T,prependTo:S,hasClass:k,addClass:w,removeClass:E,toggleClass:C,setAttributes:A,getAttributes:L,getAttribute:O,setAttribute:P,removeAttribute:I,blockTextSelection:R,unblockTextSelection:x,getBoundingClientRect:D,findPosition:U,getPointerPosition:M,isTextNode:B,emptyEl:j,normalizeContent:N,appendContent:F,insertContent:V,isSingleLeftClick:q,$:H,$$:G}),W=new WeakMap,K=1;function X(){return K++}function $(e,t){if(W.has(e)){var i=W.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&W.delete(e)}}function Y(e,t,i,n){i.forEach(function(i){e(t,i,n)})}function Q(i){function n(){return!0}function r(){return!1}if(!i||!i.isPropagationStopped){var a=i||e.event;for(var s in i={},a)"layerX"!==s&&"layerY"!==s&&"keyLocation"!==s&&"webkitMovementX"!==s&&"webkitMovementY"!==s&&("returnValue"===s&&a.preventDefault||(i[s]=a[s]));if(i.target||(i.target=i.srcElement||t),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){a.preventDefault&&a.preventDefault(),i.returnValue=!1,a.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){a.stopPropagation&&a.stopPropagation(),i.cancelBubble=!0,a.cancelBubble=!0,i.isPropagationStopped=n},i.isPropagationStopped=r,i.stopImmediatePropagation=function(){a.stopImmediatePropagation&&a.stopImmediatePropagation(),i.isImmediatePropagationStopped=n,i.stopPropagation()},i.isImmediatePropagationStopped=r,null!==i.clientX&&void 0!==i.clientX){var o=t.documentElement,u=t.body;i.pageX=i.clientX+(o&&o.scrollLeft||u&&u.scrollLeft||0)-(o&&o.clientLeft||u&&u.clientLeft||0),i.pageY=i.clientY+(o&&o.scrollTop||u&&u.scrollTop||0)-(o&&o.clientTop||u&&u.clientTop||0)}i.which=i.charCode||i.keyCode,null!==i.button&&void 0!==i.button&&(i.button=1&i.button?0:4&i.button?1:2&i.button?2:0)}return i}var J=!1;!function(){try{var t=Object.defineProperty({},"passive",{get:function(){J=!0}});e.addEventListener("test",null,t),e.removeEventListener("test",null,t)}catch(e){}}();var Z=["touchstart","touchmove"];function ee(e,t,i){if(Array.isArray(t))return Y(ee,e,t,i);W.has(e)||W.set(e,{});var n=W.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=X()),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=Q(t);var r=n.handlers[t.type];if(r)for(var s=r.slice(0),o=0,u=s.length;o-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function te(e,t,i){if(W.has(e)){var n=W.get(e);if(n.handlers){if(Array.isArray(t))return Y(te,e,t,i);var r=function(e,t){n.handlers[t]=[],$(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s0)for(var a=0,s=r.length;a=i&&(t.apply(void 0,arguments),n=r)}},ge=function(t,i,n,r){var a;void 0===r&&(r=e);var s=function(){var e=this,s=arguments,o=function(){a=null,o=null,n||t.apply(e,s)};!a&&n&&t.apply(e,s),r.clearTimeout(a),a=r.setTimeout(o,i)};return s.cancel=function(){r.clearTimeout(a),a=null},s},ye=function(){};ye.prototype.allowedEvents_={},ye.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ee(this,e,t),this.addEventListener=i},ye.prototype.addEventListener=ye.prototype.on,ye.prototype.off=function(e,t){te(this,e,t)},ye.prototype.removeEventListener=ye.prototype.off,ye.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ne(this,e,t),this.addEventListener=i},ye.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},re(this,e,t),this.addEventListener=i},ye.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=Q(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ie(this,e)},ye.prototype.dispatchEvent=ye.prototype.trigger,ye.prototype.queueTrigger=function(t){var i=this;de||(de=new Map);var n=t.type||t,r=de.get(this);r||(r=new Map,de.set(this,r));var a=r.get(n);r.delete(n),e.clearTimeout(a);var s=e.setTimeout(function(){0===r.size&&(r=null,de.delete(i)),i.trigger(t)},0);r.set(n,s)};var ve=function(e){return e instanceof ye||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},_e=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},be=function(e){if(!e.nodeName&&!ve(e))throw new Error("Invalid target; must be a DOM node or evented object.")},Te=function(e){if(!_e(e))throw new Error("Invalid event type; must be a non-empty string or array.")},Se=function(e){if("function"!=typeof e)throw new Error("Invalid listener; must be a function.")},ke=function(e,t){var i,n,r,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return a?(i=e.eventBusEl_,t.length>=3&&t.shift(),n=t[0],r=t[1]):(i=t[0],n=t[1],r=t[2]),be(i),Te(n),Se(r),{isTargetingSelf:a,target:i,type:n,listener:r=pe(e,r)}},we=function(e,t,i,n){be(e),e.nodeName?se[t](e,i,n):e[t](i,n)},Ee={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),W.has(this.el_)&&W.delete(this.el_),this.el_=null),this.player_=null},i.player=function(){return this.player_},i.options=function(e){return e?(this.options_=Ie(this.options_,e),this.options_):this.options_},i.el=function(){return this.el_},i.createEl=function(e,t,i){return b(e,t,i)},i.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],u=i;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r})),u},i.contentEl=function(){return this.contentEl_||this.el_},i.id=function(){return this.id_},i.name=function(){return this.name_},i.children=function(){return this.children_},i.getChildById=function(e){return this.childIndex_[e]},i.getChild=function(e){if(e)return this.childNameIndex_[e]},i.addChild=function(e,i,n){var r,a;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof e){a=Pe(e);var s=i.componentClass||a;i.name=a;var o=t.getComponent(s);if(!o)throw new Error("Component "+s+" does not exist");if("function"!=typeof o)return null;r=new o(this.player_||this,i)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(a=a||r.name&&Pe(r.name()))&&(this.childNameIndex_[a]=r,this.childNameIndex_[Oe(a)]=r),"function"==typeof r.el&&r.el()){var u=this.contentEl().children[n]||null;this.contentEl().insertBefore(r.el(),u)}return r},i.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Pe(e.name())]=null,this.childNameIndex_[Oe(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},i.initChildren=function(){var e=this,i=this.options_.children;if(i){var n,r=this.options_,a=t.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter(function(e){return!n.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(t){var n,r;return"string"==typeof t?r=i[n=t]||e.options_[n]||{}:(n=t.name,r=t),{name:n,opts:r}}).filter(function(e){var i=t.getComponent(e.opts.componentClass||Pe(e.name));return i&&!a.isTech(i)}).forEach(function(t){var i=t.name,n=t.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=e.options_.playerOptions;var a=e.addChild(i,n);a&&(e[i]=a)}})}},i.buildCSSClass=function(){return""},i.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},i.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)},i.$=function(e,t){return H(e,t||this.contentEl())},i.$$=function(e,t){return G(e,t||this.contentEl())},i.hasClass=function(e){return k(this.el_,e)},i.addClass=function(e){w(this.el_,e)},i.removeClass=function(e){E(this.el_,e)},i.toggleClass=function(e,t){C(this.el_,e,t)},i.show=function(){this.removeClass("vjs-hidden")},i.hide=function(){this.addClass("vjs-hidden")},i.lockShowing=function(){this.addClass("vjs-lock-showing")},i.unlockShowing=function(){this.removeClass("vjs-lock-showing")},i.getAttribute=function(e){return O(this.el_,e)},i.setAttribute=function(e,t){P(this.el_,e,t)},i.removeAttribute=function(e){I(this.el_,e)},i.width=function(e,t){return this.dimension("width",e,t)},i.height=function(e,t){return this.dimension("height",e,t)},i.dimensions=function(e,t){this.width(e,!0),this.height(t)},i.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+Pe(e)],10)},i.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=f(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+Pe(e);t=this.el_[i]}return t},i.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},i.currentWidth=function(){return this.currentDimension("width")},i.currentHeight=function(){return this.currentDimension("height")},i.focus=function(){this.el_.focus()},i.blur=function(){this.el_.blur()},i.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},i.handleKeyPress=function(e){this.handleKeyDown(e)},i.emitTapEvents=function(){var t,i=0,n=null;this.on("touchstart",function(r){1===r.touches.length&&(n={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},i=e.performance.now(),t=!0)}),this.on("touchmove",function(e){if(e.touches.length>1)t=!1;else if(n){var i=e.touches[0].pageX-n.pageX,r=e.touches[0].pageY-n.pageY;Math.sqrt(i*i+r*r)>10&&(t=!1)}});var r=function(){t=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(r){(n=null,!0===t)&&(e.performance.now()-i<200&&(r.preventDefault(),this.trigger("tap")))})},i.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=pe(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},i.setTimeout=function(t,i){var n,r=this;return t=pe(this,t),this.clearTimersOnDispose_(),n=e.setTimeout(function(){r.setTimeoutIds_.has(n)&&r.setTimeoutIds_.delete(n),t()},i),this.setTimeoutIds_.add(n),n},i.clearTimeout=function(t){return this.setTimeoutIds_.has(t)&&(this.setTimeoutIds_.delete(t),e.clearTimeout(t)),t},i.setInterval=function(t,i){t=pe(this,t),this.clearTimersOnDispose_();var n=e.setInterval(t,i);return this.setIntervalIds_.add(n),n},i.clearInterval=function(t){return this.setIntervalIds_.has(t)&&(this.setIntervalIds_.delete(t),e.clearInterval(t)),t},i.requestAnimationFrame=function(t){var i,n=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),t=pe(this,t),i=e.requestAnimationFrame(function(){n.rafIds_.has(i)&&n.rafIds_.delete(i),t()}),this.rafIds_.add(i),i):this.setTimeout(t,1e3/60)},i.cancelAnimationFrame=function(t){return this.supportsRaf_?(this.rafIds_.has(t)&&(this.rafIds_.delete(t),e.cancelAnimationFrame(t)),t):this.clearTimeout(t)},i.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var i=t[0],n=t[1];e[i].forEach(e[n],e)}),e.clearingTimersOnDispose_=!1}))},t.registerComponent=function(e,i){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n,r=t.getComponent("Tech"),a=r&&r.isTech(i),s=t===i||t.prototype.isPrototypeOf(i.prototype);if(a||!s)throw n=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+n+".");e=Pe(e),t.components_||(t.components_={});var o=t.getComponent("Player");if("Player"===e&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map(function(e){return u[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[e]=i,t.components_[Oe(e)]=i,i},t.getComponent=function(e){if(e&&t.components_)return t.components_[e]},t}();function xe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function De(e,t){return(De=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ue(e,t,i){return(Ue=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&De(r,i.prototype),r}).apply(null,arguments)}function Me(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}Re.prototype.supportsRaf_="function"==typeof e.requestAnimationFrame&&"function"==typeof e.cancelAnimationFrame,Re.registerComponent("Component",Re);var Be,je=e.navigator&&e.navigator.userAgent||"",Ne=/AppleWebKit\/([\d.]+)/i.exec(je),Fe=Ne?parseFloat(Ne.pop()):null,Ve=/iPad/i.test(je),qe=/iPhone/i.test(je)&&!Ve,He=/iPod/i.test(je),Ge=qe||Ve||He,ze=(Be=je.match(/OS (\d+)_/i))&&Be[1]?Be[1]:null,We=/Android/i.test(je),Ke=function(){var e=je.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),Xe=We&&Ke<5&&Fe<537,$e=/Firefox/i.test(je),Ye=/Edge/i.test(je),Qe=!Ye&&(/Chrome/i.test(je)||/CriOS/i.test(je)),Je=function(){var e=je.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Ze=function(){var e=/MSIE\s(\d+)\.\d/.exec(je),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(je)&&/rv:11.0/.test(je)&&(t=11),t}(),et=/Safari/i.test(je)&&!Qe&&!We&&!Ye,tt=(et||Ge)&&!Qe,it=/Windows/i.test(je),nt=g()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),rt=Object.freeze({IS_IPAD:Ve,IS_IPHONE:qe,IS_IPOD:He,IS_IOS:Ge,IOS_VERSION:ze,IS_ANDROID:We,ANDROID_VERSION:Ke,IS_NATIVE_ANDROID:Xe,IS_FIREFOX:$e,IS_EDGE:Ye,IS_CHROME:Qe,CHROME_VERSION:Je,IE_VERSION:Ze,IS_SAFARI:et,IS_ANY_SAFARI:tt,IS_WINDOWS:it,TOUCH_ENABLED:nt});function at(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function st(e){return void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:at.bind(null,"start",0,e),end:at.bind(null,"end",1,e)}}function ot(e,t){return Array.isArray(e)?st(e):void 0===e||void 0===t?st():st([[e,t]])}function ut(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=ot(0,0));for(var a=0;at&&(n=t),r+=n-i;return r/t}for(var lt,dt={prefixed:!0},ct=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],ht=ct[0],ft=0;ft=0;n--)if(t[n].enabled){Ot(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}xe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Ot(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Ot(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(At),It=function(e,t){for(var i=0;i=0;n--)if(t[n].selected){It(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(Me(i),"selectedIndex",{get:function(){for(var e=0;e',r=a.firstChild,a.setAttribute("style","display:none; position:absolute;"),t.body.appendChild(a));for(var o={},u=0;ux',e=i.firstChild.href}return e},Ht=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},Gt=function(t){var i=e.location,n=Vt(t);return(":"===n.protocol?i.protocol:n.protocol)+n.host!==i.protocol+i.host},zt=Object.freeze({parseUrl:Vt,getAbsoluteURL:qt,getFileExtension:Ht,isCrossOrigin:Gt}),Wt=function(e){var t=Kt.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)},Kt=Object.prototype.toString;var Xt,$t=Array.prototype.slice,Yt=Object.prototype.toString,Qt=Function.prototype.bind||function(e){var t=this;if("function"!=typeof t||"[object Function]"!==Yt.call(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var i,n=$t.call(arguments,1),r=Math.max(0,t.length-n.length),a=[],s=0;s=0&&"[object Function]"===Jt.call(e.callee)),i};if(!Object.keys){var ei=Object.prototype.hasOwnProperty,ti=Object.prototype.toString,ii=Zt,ni=Object.prototype.propertyIsEnumerable,ri=!ni.call({toString:null},"toString"),ai=ni.call(function(){},"prototype"),si=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],oi=function(e){var t=e.constructor;return t&&t.prototype===e},ui={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},li=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!ui["$"+e]&&ei.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{oi(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();Xt=function(e){var t=null!==e&&"object"==typeof e,i="[object Function]"===ti.call(e),n=ii(e),r=t&&"[object String]"===ti.call(e),a=[];if(!t&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var s=ai&&i;if(r&&e.length>0&&!ei.call(e,0))for(var o=0;o0)for(var u=0;u2?arguments[2]:{},n=mi(t);gi&&(n=vi.call(n,Object.getOwnPropertySymbols(t)));for(var r=0;r1&&"boolean"!=typeof t)throw new TypeError('"allowMissing" argument must be a boolean');var i="$ "+e;if(!(i in Li))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===Li[i]&&!t)throw new TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return Li[i]},Pi=Qt.call(Function.call,Object.prototype.hasOwnProperty),Ii=Oi("%TypeError%"),Ri=Oi("%SyntaxError%"),xi={"Property Descriptor":function(e,t){if("Object"!==e.Type(t))return!1;var i={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var n in t)if(Pi(t,n)&&!i[n])return!1;var r=Pi(t,"[[Value]]"),a=Pi(t,"[[Get]]")||Pi(t,"[[Set]]");if(r&&a)throw new Ii("Property Descriptors may not be both accessor and data descriptors");return!0}},Di=function(e,t,i,n){var r=xi[t];if("function"!=typeof r)throw new Ri("unknown record type: "+t);if(!r(e,n))throw new Ii(i+" must be a "+t);console.log(r(e,n),n)},Ui=Number.isNaN||function(e){return e!=e},Mi=Number.isNaN||function(e){return e!=e},Bi=Number.isFinite||function(e){return"number"==typeof e&&!Mi(e)&&e!==1/0&&e!==-1/0},ji=function(e){return e>=0?1:-1},Ni=Function.prototype.toString,Fi=/^\s*class\b/,Vi=function(e){try{var t=Ni.call(e);return Fi.test(t)}catch(e){return!1}},qi=Object.prototype.toString,Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,Gi=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(Hi)return function(e){try{return!Vi(e)&&(Ni.call(e),!0)}catch(e){return!1}}(e);if(Vi(e))return!1;var t=qi.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t},zi=function(e){return null===e||"function"!=typeof e&&"object"!=typeof e},Wi=Object.prototype.toString,Ki=function(e){var t;if((t=arguments.length>1?arguments[1]:"[object Date]"===Wi.call(e)?String:Number)===String||t===Number){var i,n,r=t===String?["toString","valueOf"]:["valueOf","toString"];for(n=0;n1?Ki(e,arguments[1]):Ki(e)},ToBoolean:function(e){return!!e},ToNumber:function(e){return+e},ToInteger:function(e){var t=this.ToNumber(e);return Ui(t)?0:0!==t&&Bi(t)?ji(t)*Math.floor(Math.abs(t)):t},ToInt32:function(e){return this.ToNumber(e)>>0},ToUint32:function(e){return this.ToNumber(e)>>>0},ToUint16:function(e){var t=this.ToNumber(e);return Ui(t)||0===t||!Bi(t)?0:function(e,t){var i=e%t;return Math.floor(i>=0?i:i+t)}(ji(t)*Math.floor(Math.abs(t)),65536)},ToString:function(e){return Yi(e)},ToObject:function(e){return this.CheckObjectCoercible(e),Xi(e)},CheckObjectCoercible:function(e,t){if(null==e)throw new $i(t||"Cannot call method on "+e);return e},IsCallable:Gi,SameValue:function(e,t){return e===t?0!==e||1/e==1/t:Ui(e)&&Ui(t)},Type:function(e){return null===e?"Null":void 0===e?"Undefined":"function"==typeof e||"object"==typeof e?"Object":"number"==typeof e?"Number":"boolean"==typeof e?"Boolean":"string"==typeof e?"String":void 0},IsPropertyDescriptor:function(e){if("Object"!==this.Type(e))return!1;var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var i in e)if(Pi(e,i)&&!t[i])return!1;var n=Pi(e,"[[Value]]"),r=Pi(e,"[[Get]]")||Pi(e,"[[Set]]");if(n&&r)throw new $i("Property Descriptors may not be both accessor and data descriptors");return!0},IsAccessorDescriptor:function(e){return void 0!==e&&(Di(this,"Property Descriptor","Desc",e),!(!Pi(e,"[[Get]]")&&!Pi(e,"[[Set]]")))},IsDataDescriptor:function(e){return void 0!==e&&(Di(this,"Property Descriptor","Desc",e),!(!Pi(e,"[[Value]]")&&!Pi(e,"[[Writable]]")))},IsGenericDescriptor:function(e){return void 0!==e&&(Di(this,"Property Descriptor","Desc",e),!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e))},FromPropertyDescriptor:function(e){if(void 0===e)return e;if(Di(this,"Property Descriptor","Desc",e),this.IsDataDescriptor(e))return{value:e["[[Value]]"],writable:!!e["[[Writable]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};if(this.IsAccessorDescriptor(e))return{get:e["[[Get]]"],set:e["[[Set]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};throw new $i("FromPropertyDescriptor must be called with a fully populated Property Descriptor")},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e))throw new $i("ToPropertyDescriptor requires an object");var t={};if(Pi(e,"enumerable")&&(t["[[Enumerable]]"]=this.ToBoolean(e.enumerable)),Pi(e,"configurable")&&(t["[[Configurable]]"]=this.ToBoolean(e.configurable)),Pi(e,"value")&&(t["[[Value]]"]=e.value),Pi(e,"writable")&&(t["[[Writable]]"]=this.ToBoolean(e.writable)),Pi(e,"get")){var i=e.get;if(void 0!==i&&!this.IsCallable(i))throw new TypeError("getter must be a function");t["[[Get]]"]=i}if(Pi(e,"set")){var n=e.set;if(void 0!==n&&!this.IsCallable(n))throw new $i("setter must be a function");t["[[Set]]"]=n}if((Pi(t,"[[Get]]")||Pi(t,"[[Set]]"))&&(Pi(t,"[[Value]]")||Pi(t,"[[Writable]]")))throw new $i("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t}},Ji=Qt.call(Function.call,String.prototype.replace),Zi=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,en=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/,tn=function(){var e=Qi.ToString(Qi.CheckObjectCoercible(this));return Ji(Ji(e,Zi,""),en,"")},nn=function(){return String.prototype.trim&&"​"==="​".trim()?String.prototype.trim:tn},rn=Qt.call(Function.call,nn());ki(rn,{getPolyfill:nn,implementation:tn,shim:function(){var e=nn();return ki(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}}),e}});var an=rn,sn=Object.prototype.toString,on=Object.prototype.hasOwnProperty,un=function(e,t,i){if(!Gi(t))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),"[object Array]"===sn.call(e)?function(e,t,i){for(var n=0,r=e.length;n0&&(u=setTimeout(function(){if(!s){s=!0,o.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}},e.timeout)),o.setRequestHeader)for(a in h)h.hasOwnProperty(a)&&o.setRequestHeader(a,h[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(o.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(o),o.send(c||null),o}pn.XMLHttpRequest=e.XMLHttpRequest||function(){},pn.XDomainRequest="withCredentials"in new pn.XMLHttpRequest?pn.XMLHttpRequest:e.XDomainRequest,function(e,t){for(var i=0;i0&&(e.console&&e.console.groupCollapsed&&e.console.groupCollapsed("Text Track parsing errors for "+i.src),r.forEach(function(e){return a.error(e)}),e.console&&e.console.groupEnd&&e.console.groupEnd()),n.flush()},yn=function(t,i){var n={uri:t},r=Gt(t);r&&(n.cors=r),hn(n,pe(this,function(t,n,r){if(t)return a.error(t,n);i.loaded_=!0,"function"!=typeof e.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return gn(r,i);a.error("vttjs failed to load, stopping trying to process "+i.src)}):gn(r,i)}))},vn=function(t){function i(e){var i;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var n=Ie(e,{kind:jt[e.kind]||"subtitles",language:e.language||e.srclang||""}),r=Nt[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=t.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[];var s=new Ut(i.cues_),o=new Ut(i.activeCues_),u=!1,l=pe(Me(i),function(){this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1)});return"disabled"!==r&&i.tech_.ready(function(){i.tech_.on("timeupdate",l)},!0),Object.defineProperties(Me(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){var t=this;Nt[e]&&("disabled"!==(r=e)?this.tech_.ready(function(){t.tech_.on("timeupdate",l)},!0):this.tech_.off("timeupdate",l),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i=e?t.push(r):r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function Pn(){this.values=An(null)}function In(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);if(2===s.length)t(s[0],s[1])}}function Rn(e,t,i){var n=e;function r(){var t=On(e);if(null===t)throw new Ln(Ln.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new Ln(Ln.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var n=new Pn;In(e,function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","middle","end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","middle","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","middle","end","left","right"])}},/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical",""),t.line=n.get("line","auto"),t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align","middle"),t.position=n.get("position",{start:0,left:0,middle:50,end:100,right:100},t.align),t.positionAlign=n.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},t.align)}(e,t)}Ln.prototype=An(Error.prototype),Ln.prototype.constructor=Ln,Ln.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Pn.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n=0&&t<=100)&&(this.set(e,t),!0)}};var xn={"&":"&","<":"<",">":">","‎":"‎","‏":"‏"," ":" "},Dn={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Un={v:"title",lang:"lang"},Mn={rt:"ruby"};function Bn(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e){return xn[e]}function r(e){for(;f=e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)e=e.replace(f[0],n);return e}function a(e,t){return!Mn[t.localName]||Mn[t.localName]===e.localName}function s(t,i){var n=Dn[t];if(!n)return null;var r=e.document.createElement(n);r.localName=n;var a=Un[t];return a&&i&&(r[a]=i.trim()),r}for(var o,u=e.document.createElement("div"),l=u,d=[];null!==(o=i());)if("<"!==o[0])l.appendChild(e.document.createTextNode(r(o)));else{if("/"===o[1]){d.length&&d[d.length-1]===o.substr(2).replace(">","")&&(d.pop(),l=l.parentNode);continue}var c,h=On(o.substr(1,o.length-2));if(h){c=e.document.createProcessingInstruction("timestamp",h),l.appendChild(c);continue}var f=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!f)continue;if(!(c=s(f[1],f[3])))continue;if(!a(l,c))continue;f[2]&&(c.className=f[2].substr(1).replace("."," ")),d.push(f[1]),l.appendChild(c),l=c}return u}var jn=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Nn(e){for(var t=0;t=i[0]&&e<=i[1])return!0}return!1}function Fn(){}function Vn(e,t,i){Fn.call(this),this.cue=t,this.cueDiv=Bn(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:function(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var a=0;a=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;rc&&(d=d<0?-1:1,d*=Math.ceil(c/l)*l),s<0&&(d+=""===a.vertical?i.height:i.width,o=o.reverse()),r.move(h,d)}else{var f=r.lineHeight/i.height*100;switch(a.lineAlign){case"middle":s-=f/2;break;case"end":s-=f}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new qn(t)}var p=function(e,t){for(var r,a=new qn(e),s=1,o=0;ou&&(r=new qn(e),s=u),e=new qn(a)}return r||a}(r,o);t.move(p.toCSSCompatValues(i))}function Gn(){}Fn.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Fn.prototype.formatStyle=function(e,t){return 0===e?0:e+t},Vn.prototype=An(Fn.prototype),Vn.prototype.constructor=Vn,qn.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},qn.prototype.overlaps=function(e){return this.lefte.left&&this.tope.top},qn.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},qn.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},qn.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},qn.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},qn.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},Gn.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Gn.convertCueToDOMTree=function(e,t){return e&&t?Bn(e,t):null};Gn.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t100)throw new Error("Position must be between 0 and 100.");f=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return p},set:function(e){var t=$n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");p=t,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=$n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Yn.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Qn=Yn,Jn={"":!0,up:!0};function Zn(e){return"number"==typeof e&&e>=0&&e<=100}var er=function(){var e=100,t=3,i=0,n=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Zn(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!Zn(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!Zn(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!Zn(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!Zn(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!Jn[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("An invalid or illegal string was specified.");s=t}}})},tr=kt(function(t){var i=t.exports={WebVTT:zn,VTTCue:Qn,VTTRegion:er};e.vttjs=i,e.WebVTT=i.WebVTT;var n=i.VTTCue,r=i.VTTRegion,a=e.VTTCue,s=e.VTTRegion;i.shim=function(){e.VTTCue=n,e.VTTRegion=r},i.restore=function(){e.VTTCue=a,e.VTTRegion=s},e.VTTCue||i.shim()});tr.WebVTT,tr.VTTCue,tr.VTTRegion;var ir=function(i){function n(e,t){var n;return void 0===e&&(e={}),void 0===t&&(t=function(){}),e.reportTouchActivity=!1,(n=i.call(this,null,e,t)||this).hasStarted_=!1,n.on("playing",function(){this.hasStarted_=!0}),n.on("loadstart",function(){this.hasStarted_=!1}),Cn.names.forEach(function(t){var i=Cn[t];e&&e[i.getterName]&&(n[i.privateName]=e[i.getterName])}),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===e["native"+t+"Tracks"]&&(n["featuresNative"+t+"Tracks"]=!1)}),!1===e.nativeCaptions||!1===e.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.autoRemoteTextTracks_=new Cn.text.ListClass,n.initTrackListeners(),e.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}xe(n,i);var r=n.prototype;return r.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)}),this.trigger({src:e,type:"sourceset"})},r.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},r.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},r.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(pe(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()}),500)},r.onDurationChange=function(e){this.duration_=this.duration()},r.buffered=function(){return ot(0,0)},r.bufferedPercent=function(){return ut(this.buffered(),this.duration_)},r.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},r.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},r.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},r.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},r.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},r.dispose=function(){this.clearTracks(wn.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),i.prototype.dispose.call(this)},r.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach(function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}})},r.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},r.reset=function(){},r.error=function(e){return void 0!==e&&(this.error_=new mt(e),this.trigger("error")),this.error_},r.played=function(){return this.hasStarted_?ot(0,0):ot()},r.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},r.initTrackListeners=function(){var e=this;wn.names.forEach(function(t){var i=wn[t],n=function(){e.trigger(t+"trackchange")},r=e[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),e.on("dispose",function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)})})},r.addWebVttScript_=function(){var i=this;if(!e.WebVTT)if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&h(tr)&&Object.keys(tr).length>0)return void this.trigger("vttjsloaded");var n=t.createElement("script");n.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",n.onload=function(){i.trigger("vttjsloaded")},n.onerror=function(){i.trigger("vttjserror")},this.on("dispose",function(){n.onload=null,n.onerror=null}),e.WebVTT=!0,this.el().parentNode.appendChild(n)}else this.ready(this.addWebVttScript_)},r.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e=0;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,o,s),o}var ur={buffered:1,currentTime:1,duration:1,seekable:1,played:1,paused:1,volume:1},lr={setCurrentTime:1,setVolume:1},dr={play:1,pause:1};function cr(e){return function(t,i){return t===ar?ar:i[e]?i[e](t):t}}var hr={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",oga:"audio/ogg",m3u8:"application/x-mpegURL",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},fr=function(e){void 0===e&&(e="");var t=Ht(e);return hr[t.toLowerCase()]||""};function pr(e){if(!e.type){var t=fr(e.src);t&&(e.type=t)}return e}var mr=function(e){function t(t,i,n){var r,a=Ie({createEl:!1},i);if(r=e.call(this,t,a,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,o=i.playerOptions.techOrder;s